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/AUTHORS | 29 + Source/DirectFB/COPYING | 504 + Source/DirectFB/ChangeLog | 37587 +++++++++++++++++++ Source/DirectFB/INSTALL | 237 + Source/DirectFB/Makefile.am | 60 + Source/DirectFB/Makefile.in | 811 + Source/DirectFB/NEWS | 3626 ++ Source/DirectFB/README | 437 + Source/DirectFB/TODO | 63 + Source/DirectFB/aclocal.m4 | 7776 ++++ Source/DirectFB/autogen.sh | 147 + Source/DirectFB/compile | 142 + Source/DirectFB/config.guess | 1516 + Source/DirectFB/config.h.in | 161 + Source/DirectFB/config.sub | 1626 + Source/DirectFB/configure | 30851 +++++++++++++++ Source/DirectFB/configure.in | 1797 + Source/DirectFB/data/Makefile.am | 7 + Source/DirectFB/data/Makefile.in | 431 + Source/DirectFB/data/cursor.dat | Bin 0 -> 6400 bytes Source/DirectFB/depcomp | 589 + Source/DirectFB/directfb-config.in | 315 + Source/DirectFB/directfb-internal.pc.in | 11 + Source/DirectFB/directfb.pc.in | 12 + Source/DirectFB/directfb.spec | 118 + Source/DirectFB/directfb.spec.in | 118 + Source/DirectFB/docs/Makefile.am | 40 + Source/DirectFB/docs/Makefile.in | 691 + Source/DirectFB/docs/README.screenshots | 58 + Source/DirectFB/docs/dfbg.1.in | 54 + Source/DirectFB/docs/directfb-csource.1.in | 79 + Source/DirectFB/docs/directfbrc.5.in | 583 + Source/DirectFB/docs/html/Makefile.am | 16 + Source/DirectFB/docs/html/Makefile.in | 414 + Source/DirectFB/docs/html/dfb_logo-alpha.png | Bin 0 -> 12919 bytes Source/DirectFB/fb.modes | 90 + Source/DirectFB/gfxdrivers/Makefile.am | 151 + Source/DirectFB/gfxdrivers/Makefile.in | 622 + Source/DirectFB/gfxdrivers/ati128/Makefile.am | 41 + Source/DirectFB/gfxdrivers/ati128/Makefile.in | 603 + Source/DirectFB/gfxdrivers/ati128/ati128.c | 842 + Source/DirectFB/gfxdrivers/ati128/ati128.h | 76 + Source/DirectFB/gfxdrivers/ati128/ati128_overlay.c | 447 + Source/DirectFB/gfxdrivers/ati128/ati128_state.c | 314 + Source/DirectFB/gfxdrivers/ati128/ati128_state.h | 62 + Source/DirectFB/gfxdrivers/ati128/mmio.h | 121 + Source/DirectFB/gfxdrivers/ati128/regs.h | 919 + Source/DirectFB/gfxdrivers/cle266/Makefile.am | 47 + Source/DirectFB/gfxdrivers/cle266/Makefile.in | 619 + Source/DirectFB/gfxdrivers/cle266/mmio.h | 43 + Source/DirectFB/gfxdrivers/cle266/regs2d.h | 197 + Source/DirectFB/gfxdrivers/cle266/regs3d.h | 1641 + Source/DirectFB/gfxdrivers/cle266/uc_accel.c | 504 + Source/DirectFB/gfxdrivers/cle266/uc_accel.h | 119 + Source/DirectFB/gfxdrivers/cle266/uc_fifo.c | 198 + Source/DirectFB/gfxdrivers/cle266/uc_fifo.h | 268 + Source/DirectFB/gfxdrivers/cle266/uc_hw.h | 93 + Source/DirectFB/gfxdrivers/cle266/uc_hwmap.c | 357 + Source/DirectFB/gfxdrivers/cle266/uc_hwset.c | 419 + Source/DirectFB/gfxdrivers/cle266/uc_overlay.c | 320 + Source/DirectFB/gfxdrivers/cle266/uc_overlay.h | 85 + Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwmap.c | 560 + Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwset.c | 266 + Source/DirectFB/gfxdrivers/cle266/uc_primary.c | 176 + Source/DirectFB/gfxdrivers/cle266/uc_state.c | 269 + Source/DirectFB/gfxdrivers/cle266/uc_state.h | 68 + Source/DirectFB/gfxdrivers/cle266/unichrome.c | 548 + Source/DirectFB/gfxdrivers/cle266/unichrome.h | 140 + Source/DirectFB/gfxdrivers/cle266/vidregs.h | 498 + Source/DirectFB/gfxdrivers/cyber5k/Makefile.am | 41 + Source/DirectFB/gfxdrivers/cyber5k/Makefile.in | 607 + Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c | 824 + Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h | 63 + Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c | 260 + Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h | 64 + .../DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c | 376 + .../DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h | 92 + .../DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c | 301 + Source/DirectFB/gfxdrivers/cyber5k/mmio.h | 126 + Source/DirectFB/gfxdrivers/cyber5k/regs.h | 387 + Source/DirectFB/gfxdrivers/davinci/Makefile.am | 77 + Source/DirectFB/gfxdrivers/davinci/Makefile.in | 771 + Source/DirectFB/gfxdrivers/davinci/Makefile.kernel | 6 + Source/DirectFB/gfxdrivers/davinci/c64xdump.c | 117 + Source/DirectFB/gfxdrivers/davinci/davinci_2d.c | 1050 + Source/DirectFB/gfxdrivers/davinci/davinci_2d.h | 79 + Source/DirectFB/gfxdrivers/davinci/davinci_c64x.c | 2053 + Source/DirectFB/gfxdrivers/davinci/davinci_c64x.h | 935 + .../gfxdrivers/davinci/davinci_gfxdriver.c | 343 + .../gfxdrivers/davinci/davinci_gfxdriver.h | 169 + Source/DirectFB/gfxdrivers/davinci/davinci_osd.c | 681 + Source/DirectFB/gfxdrivers/davinci/davinci_osd.h | 53 + .../DirectFB/gfxdrivers/davinci/davinci_osd_pool.c | 394 + .../DirectFB/gfxdrivers/davinci/davinci_osd_pool.h | 39 + .../DirectFB/gfxdrivers/davinci/davinci_screen.c | 124 + .../DirectFB/gfxdrivers/davinci/davinci_screen.h | 39 + Source/DirectFB/gfxdrivers/davinci/davinci_video.c | 744 + Source/DirectFB/gfxdrivers/davinci/davinci_video.h | 58 + .../gfxdrivers/davinci/davinci_video_pool.c | 393 + .../gfxdrivers/davinci/davinci_video_pool.h | 39 + Source/DirectFB/gfxdrivers/davinci/davincifb.h | 581 + Source/DirectFB/gfxdrivers/davinci/directfbrc | 56 + .../gfxdrivers/davinci/kernel-module/Makefile | 34 + .../gfxdrivers/davinci/kernel-module/c64x/Makefile | 2 + .../gfxdrivers/davinci/kernel-module/c64x/c64x.c | 507 + .../davinci/kernel-module/include/linux/c64x.h | 281 + .../ti-davinci-2.6.10-mvl401-fbio_set_start.patch | 123 + Source/DirectFB/gfxdrivers/ep9x/Makefile.am | 33 + Source/DirectFB/gfxdrivers/ep9x/Makefile.in | 595 + Source/DirectFB/gfxdrivers/ep9x/ep9x.c | 474 + Source/DirectFB/gfxdrivers/ep9x/ep9x.h | 87 + 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 + Source/DirectFB/gfxdrivers/i810/Makefile.am | 35 + Source/DirectFB/gfxdrivers/i810/Makefile.in | 597 + Source/DirectFB/gfxdrivers/i810/i810.c | 1044 + Source/DirectFB/gfxdrivers/i810/i810.h | 832 + Source/DirectFB/gfxdrivers/i810/i810_overlay.c | 598 + Source/DirectFB/gfxdrivers/i830/Makefile.am | 35 + Source/DirectFB/gfxdrivers/i830/Makefile.in | 597 + Source/DirectFB/gfxdrivers/i830/i830.c | 635 + Source/DirectFB/gfxdrivers/i830/i830.h | 406 + Source/DirectFB/gfxdrivers/i830/i830_overlay.c | 807 + Source/DirectFB/gfxdrivers/mach64/Makefile.am | 39 + Source/DirectFB/gfxdrivers/mach64/Makefile.in | 603 + Source/DirectFB/gfxdrivers/mach64/mach64.c | 1640 + Source/DirectFB/gfxdrivers/mach64/mach64.h | 120 + Source/DirectFB/gfxdrivers/mach64/mach64_overlay.c | 724 + Source/DirectFB/gfxdrivers/mach64/mach64_state.c | 654 + Source/DirectFB/gfxdrivers/mach64/mach64_state.h | 90 + Source/DirectFB/gfxdrivers/mach64/mmio.h | 198 + Source/DirectFB/gfxdrivers/mach64/regs.h | 883 + Source/DirectFB/gfxdrivers/matrox/Makefile.am | 47 + Source/DirectFB/gfxdrivers/matrox/Makefile.in | 618 + Source/DirectFB/gfxdrivers/matrox/matrox.c | 2930 ++ Source/DirectFB/gfxdrivers/matrox/matrox.h | 157 + Source/DirectFB/gfxdrivers/matrox/matrox_3d.c | 627 + Source/DirectFB/gfxdrivers/matrox/matrox_3d.h | 36 + Source/DirectFB/gfxdrivers/matrox/matrox_bes.c | 783 + Source/DirectFB/gfxdrivers/matrox/matrox_crtc2.c | 751 + Source/DirectFB/gfxdrivers/matrox/matrox_maven.c | 785 + Source/DirectFB/gfxdrivers/matrox/matrox_maven.h | 64 + .../gfxdrivers/matrox/matrox_screen_crtc2.c | 279 + Source/DirectFB/gfxdrivers/matrox/matrox_spic.c | 314 + Source/DirectFB/gfxdrivers/matrox/matrox_state.c | 810 + Source/DirectFB/gfxdrivers/matrox/matrox_state.h | 70 + Source/DirectFB/gfxdrivers/matrox/mmio.h | 118 + Source/DirectFB/gfxdrivers/matrox/regs.h | 454 + Source/DirectFB/gfxdrivers/neomagic/Makefile.am | 35 + Source/DirectFB/gfxdrivers/neomagic/Makefile.in | 601 + Source/DirectFB/gfxdrivers/neomagic/neo2200.c | 570 + Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c | 349 + Source/DirectFB/gfxdrivers/neomagic/neomagic.c | 223 + Source/DirectFB/gfxdrivers/neomagic/neomagic.h | 147 + Source/DirectFB/gfxdrivers/nsc/Makefile.am | 40 + Source/DirectFB/gfxdrivers/nsc/Makefile.in | 714 + Source/DirectFB/gfxdrivers/nsc/include/Makefile.am | 5 + Source/DirectFB/gfxdrivers/nsc/include/Makefile.in | 403 + Source/DirectFB/gfxdrivers/nsc/include/gfx_regs.h | 1733 + Source/DirectFB/gfxdrivers/nsc/include/gfx_type.h | 426 + .../DirectFB/gfxdrivers/nsc/include/nsc_galproto.h | 1987 + Source/DirectFB/gfxdrivers/nsc/include/pnl_defs.h | 201 + Source/DirectFB/gfxdrivers/nsc/nsc.c | 592 + Source/DirectFB/gfxdrivers/nsc/nsc_galfns.c | 4905 +++ Source/DirectFB/gfxdrivers/nvidia/Makefile.am | 45 + Source/DirectFB/gfxdrivers/nvidia/Makefile.in | 614 + Source/DirectFB/gfxdrivers/nvidia/nvidia.c | 2046 + Source/DirectFB/gfxdrivers/nvidia/nvidia.h | 238 + Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.c | 549 + Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.h | 48 + Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.c | 522 + Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.h | 36 + Source/DirectFB/gfxdrivers/nvidia/nvidia_accel.h | 246 + Source/DirectFB/gfxdrivers/nvidia/nvidia_objects.h | 160 + Source/DirectFB/gfxdrivers/nvidia/nvidia_overlay.c | 566 + Source/DirectFB/gfxdrivers/nvidia/nvidia_primary.c | 189 + Source/DirectFB/gfxdrivers/nvidia/nvidia_regs.h | 1636 + Source/DirectFB/gfxdrivers/nvidia/nvidia_state.c | 730 + Source/DirectFB/gfxdrivers/nvidia/nvidia_state.h | 58 + Source/DirectFB/gfxdrivers/omap/Makefile.am | 34 + Source/DirectFB/gfxdrivers/omap/Makefile.in | 598 + Source/DirectFB/gfxdrivers/omap/omap.c | 142 + Source/DirectFB/gfxdrivers/omap/omap.h | 48 + Source/DirectFB/gfxdrivers/omap/omap_primary.c | 102 + Source/DirectFB/gfxdrivers/omap/omapfb.h | 163 + Source/DirectFB/gfxdrivers/radeon/Makefile.am | 52 + Source/DirectFB/gfxdrivers/radeon/Makefile.in | 625 + Source/DirectFB/gfxdrivers/radeon/r100_3d.c | 523 + Source/DirectFB/gfxdrivers/radeon/r100_state.c | 954 + Source/DirectFB/gfxdrivers/radeon/r200_3d.c | 508 + Source/DirectFB/gfxdrivers/radeon/r200_state.c | 985 + Source/DirectFB/gfxdrivers/radeon/r300_3d.c | 492 + Source/DirectFB/gfxdrivers/radeon/r300_program.h | 151 + Source/DirectFB/gfxdrivers/radeon/r300_state.c | 1103 + Source/DirectFB/gfxdrivers/radeon/radeon.c | 1753 + Source/DirectFB/gfxdrivers/radeon/radeon.h | 224 + Source/DirectFB/gfxdrivers/radeon/radeon_2d.c | 397 + Source/DirectFB/gfxdrivers/radeon/radeon_2d.h | 38 + Source/DirectFB/gfxdrivers/radeon/radeon_3d.h | 81 + .../DirectFB/gfxdrivers/radeon/radeon_chipsets.h | 169 + Source/DirectFB/gfxdrivers/radeon/radeon_crtc1.c | 171 + Source/DirectFB/gfxdrivers/radeon/radeon_crtc2.c | 1011 + Source/DirectFB/gfxdrivers/radeon/radeon_mmio.h | 163 + Source/DirectFB/gfxdrivers/radeon/radeon_overlay.c | 983 + Source/DirectFB/gfxdrivers/radeon/radeon_regs.h | 4364 +++ Source/DirectFB/gfxdrivers/radeon/radeon_state.h | 160 + Source/DirectFB/gfxdrivers/radeon/vertex_shader.h | 83 + Source/DirectFB/gfxdrivers/savage/Makefile.am | 45 + Source/DirectFB/gfxdrivers/savage/Makefile.in | 611 + Source/DirectFB/gfxdrivers/savage/mmio.h | 98 + Source/DirectFB/gfxdrivers/savage/savage.c | 346 + Source/DirectFB/gfxdrivers/savage/savage.h | 145 + Source/DirectFB/gfxdrivers/savage/savage2000.c | 199 + Source/DirectFB/gfxdrivers/savage/savage2000.h | 105 + Source/DirectFB/gfxdrivers/savage/savage3d.c | 561 + Source/DirectFB/gfxdrivers/savage/savage3d.h | 121 + Source/DirectFB/gfxdrivers/savage/savage4.c | 599 + Source/DirectFB/gfxdrivers/savage/savage4.h | 146 + Source/DirectFB/gfxdrivers/savage/savage_bci.h | 208 + .../gfxdrivers/savage/savage_streams_old.c | 916 + .../gfxdrivers/savage/savage_streams_old.h | 142 + Source/DirectFB/gfxdrivers/sh772x/Makefile.am | 80 + Source/DirectFB/gfxdrivers/sh772x/Makefile.in | 726 + Source/DirectFB/gfxdrivers/sh772x/Makefile.kernel | 61 + Source/DirectFB/gfxdrivers/sh772x/README.sh7722 | 172 + .../DirectFB/gfxdrivers/sh772x/directfbrc.sh7722 | 10 + .../DirectFB/gfxdrivers/sh772x/directfbrc.sh7723 | 10 + .../gfxdrivers/sh772x/kernel-module/Makefile | 3 + .../gfxdrivers/sh772x/kernel-module/sh7722.c | 1192 + .../gfxdrivers/sh772x/kernel-module/sh7722.h | 21 + .../gfxdrivers/sh772x/kernel-module/sh7723.c | 566 + .../gfxdrivers/sh772x/kernel-module/sh7723.h | 21 + .../sh772x/kernel-module/sh772x_driver.c | 82 + .../gfxdrivers/sh772x/kernel-module/sh772x_gfx.h | 105 + Source/DirectFB/gfxdrivers/sh772x/sh7722.c | 490 + Source/DirectFB/gfxdrivers/sh772x/sh7722.h | 131 + Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.c | 2013 + Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.h | 214 + Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeg.c | 395 + Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.c | 1654 + Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.h | 47 + .../DirectFB/gfxdrivers/sh772x/sh7722_jpegtool.c | 142 + Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.c | 529 + Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.h | 11 + Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.c | 172 + Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.h | 17 + Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.c | 412 + Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.h | 11 + Source/DirectFB/gfxdrivers/sh772x/sh7722_regs.h | 624 + Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.c | 85 + Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.h | 9 + Source/DirectFB/gfxdrivers/sh772x/sh7722_types.h | 136 + Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.c | 890 + Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.h | 239 + Source/DirectFB/gfxdrivers/sis315/Makefile.am | 42 + Source/DirectFB/gfxdrivers/sis315/Makefile.in | 607 + Source/DirectFB/gfxdrivers/sis315/sis315.c | 355 + Source/DirectFB/gfxdrivers/sis315/sis315.h | 59 + Source/DirectFB/gfxdrivers/sis315/sis315_accel.c | 250 + Source/DirectFB/gfxdrivers/sis315/sis315_accel.h | 32 + Source/DirectFB/gfxdrivers/sis315/sis315_compat.h | 89 + Source/DirectFB/gfxdrivers/sis315/sis315_mmio.c | 51 + Source/DirectFB/gfxdrivers/sis315/sis315_mmio.h | 37 + Source/DirectFB/gfxdrivers/sis315/sis315_regs.h | 161 + Source/DirectFB/gfxdrivers/sis315/sis315_state.c | 164 + Source/DirectFB/gfxdrivers/sis315/sis315_state.h | 34 + Source/DirectFB/gfxdrivers/tdfx/Makefile.am | 34 + Source/DirectFB/gfxdrivers/tdfx/Makefile.in | 595 + Source/DirectFB/gfxdrivers/tdfx/tdfx.c | 884 + Source/DirectFB/gfxdrivers/tdfx/tdfx.h | 250 + Source/DirectFB/gfxdrivers/unichrome/Makefile.am | 50 + Source/DirectFB/gfxdrivers/unichrome/Makefile.in | 626 + Source/DirectFB/gfxdrivers/unichrome/mmio.h | 43 + Source/DirectFB/gfxdrivers/unichrome/regs2d.h | 197 + Source/DirectFB/gfxdrivers/unichrome/regs3d.h | 1642 + Source/DirectFB/gfxdrivers/unichrome/uc_accel.c | 578 + Source/DirectFB/gfxdrivers/unichrome/uc_accel.h | 123 + Source/DirectFB/gfxdrivers/unichrome/uc_fifo.c | 198 + Source/DirectFB/gfxdrivers/unichrome/uc_fifo.h | 268 + Source/DirectFB/gfxdrivers/unichrome/uc_hw.h | 105 + Source/DirectFB/gfxdrivers/unichrome/uc_hwmap.c | 362 + Source/DirectFB/gfxdrivers/unichrome/uc_hwset.c | 446 + Source/DirectFB/gfxdrivers/unichrome/uc_ioctl.h | 35 + Source/DirectFB/gfxdrivers/unichrome/uc_overlay.c | 405 + Source/DirectFB/gfxdrivers/unichrome/uc_overlay.h | 98 + .../DirectFB/gfxdrivers/unichrome/uc_ovl_hwmap.c | 609 + .../DirectFB/gfxdrivers/unichrome/uc_ovl_hwset.c | 283 + Source/DirectFB/gfxdrivers/unichrome/uc_primary.c | 182 + Source/DirectFB/gfxdrivers/unichrome/uc_probe.h | 42 + Source/DirectFB/gfxdrivers/unichrome/uc_spic.c | 193 + Source/DirectFB/gfxdrivers/unichrome/uc_state.c | 350 + Source/DirectFB/gfxdrivers/unichrome/uc_state.h | 68 + Source/DirectFB/gfxdrivers/unichrome/unichrome.c | 596 + Source/DirectFB/gfxdrivers/unichrome/unichrome.h | 151 + Source/DirectFB/gfxdrivers/unichrome/vidregs.h | 499 + Source/DirectFB/gfxdrivers/vmware/Makefile.am | 36 + Source/DirectFB/gfxdrivers/vmware/Makefile.in | 598 + Source/DirectFB/gfxdrivers/vmware/vmware_2d.c | 402 + Source/DirectFB/gfxdrivers/vmware/vmware_2d.h | 67 + .../DirectFB/gfxdrivers/vmware/vmware_gfxdriver.c | 128 + .../DirectFB/gfxdrivers/vmware/vmware_gfxdriver.h | 58 + Source/DirectFB/include/Makefile.am | 119 + Source/DirectFB/include/Makefile.in | 590 + Source/DirectFB/include/dfb_types.h | 46 + Source/DirectFB/include/dfiff.h | 60 + Source/DirectFB/include/dgiff.h | 101 + Source/DirectFB/include/directfb.h | 6642 ++++ Source/DirectFB/include/directfb_keyboard.h | 820 + Source/DirectFB/include/directfb_keynames.h | 639 + Source/DirectFB/include/directfb_strings.h | 474 + Source/DirectFB/include/directfb_util.h | 612 + Source/DirectFB/include/directfb_version.h | 38 + Source/DirectFB/include/directfb_version.h.in | 38 + Source/DirectFB/include/directfb_windows.h | 240 + Source/DirectFB/include/directfbgl.h | 118 + Source/DirectFB/inputdrivers/Makefile.am | 98 + Source/DirectFB/inputdrivers/Makefile.in | 597 + .../DirectFB/inputdrivers/dbox2remote/Makefile.am | 31 + .../DirectFB/inputdrivers/dbox2remote/Makefile.in | 598 + .../inputdrivers/dbox2remote/dbox2remote.c | 340 + .../inputdrivers/dreamboxremote/Makefile.am | 31 + .../inputdrivers/dreamboxremote/Makefile.in | 598 + .../inputdrivers/dreamboxremote/dreamboxremote.c | 329 + Source/DirectFB/inputdrivers/dynapro/Makefile.am | 30 + Source/DirectFB/inputdrivers/dynapro/Makefile.in | 592 + Source/DirectFB/inputdrivers/dynapro/dynapro.c | 356 + Source/DirectFB/inputdrivers/elo/Makefile.am | 31 + Source/DirectFB/inputdrivers/elo/Makefile.in | 592 + Source/DirectFB/inputdrivers/elo/elo.c | 539 + Source/DirectFB/inputdrivers/gunze/Makefile.am | 30 + Source/DirectFB/inputdrivers/gunze/Makefile.in | 592 + Source/DirectFB/inputdrivers/gunze/gunze.c | 576 + Source/DirectFB/inputdrivers/h3600_ts/Makefile.am | 31 + Source/DirectFB/inputdrivers/h3600_ts/Makefile.in | 593 + Source/DirectFB/inputdrivers/h3600_ts/h3600_ts.c | 239 + Source/DirectFB/inputdrivers/joystick/Makefile.am | 31 + Source/DirectFB/inputdrivers/joystick/Makefile.in | 594 + Source/DirectFB/inputdrivers/joystick/joystick.c | 279 + Source/DirectFB/inputdrivers/keyboard/Makefile.am | 33 + Source/DirectFB/inputdrivers/keyboard/Makefile.in | 596 + Source/DirectFB/inputdrivers/keyboard/keyboard.c | 524 + .../DirectFB/inputdrivers/linux_input/Makefile.am | 34 + .../DirectFB/inputdrivers/linux_input/Makefile.in | 601 + .../DirectFB/inputdrivers/linux_input/input_fake.h | 84 + .../inputdrivers/linux_input/linux_input.c | 1994 + Source/DirectFB/inputdrivers/lirc/Makefile.am | 32 + Source/DirectFB/inputdrivers/lirc/Makefile.in | 593 + Source/DirectFB/inputdrivers/lirc/lirc.c | 353 + Source/DirectFB/inputdrivers/mutouch/Makefile.am | 30 + Source/DirectFB/inputdrivers/mutouch/Makefile.in | 590 + Source/DirectFB/inputdrivers/mutouch/mutouch.c | 615 + Source/DirectFB/inputdrivers/penmount/Makefile.am | 29 + Source/DirectFB/inputdrivers/penmount/Makefile.in | 591 + Source/DirectFB/inputdrivers/penmount/penmount.c | 363 + Source/DirectFB/inputdrivers/ps2mouse/Makefile.am | 31 + Source/DirectFB/inputdrivers/ps2mouse/Makefile.in | 594 + Source/DirectFB/inputdrivers/ps2mouse/ps2mouse.c | 576 + .../DirectFB/inputdrivers/serialmouse/Makefile.am | 30 + .../DirectFB/inputdrivers/serialmouse/Makefile.in | 595 + .../inputdrivers/serialmouse/serialmouse.c | 572 + Source/DirectFB/inputdrivers/sonypi/Makefile.am | 31 + Source/DirectFB/inputdrivers/sonypi/Makefile.in | 592 + Source/DirectFB/inputdrivers/sonypi/sonypi.c | 265 + Source/DirectFB/inputdrivers/tslib/Makefile.am | 33 + Source/DirectFB/inputdrivers/tslib/Makefile.in | 605 + Source/DirectFB/inputdrivers/tslib/tslib.c | 292 + .../DirectFB/inputdrivers/ucb1x00_ts/Makefile.am | 31 + .../DirectFB/inputdrivers/ucb1x00_ts/Makefile.in | 594 + .../DirectFB/inputdrivers/ucb1x00_ts/ucb1x00_ts.c | 361 + Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.am | 31 + Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.in | 593 + Source/DirectFB/inputdrivers/wm97xx_ts/wm97xx_ts.c | 260 + Source/DirectFB/inputdrivers/zytronic/Makefile.am | 30 + Source/DirectFB/inputdrivers/zytronic/Makefile.in | 591 + Source/DirectFB/inputdrivers/zytronic/zytronic.c | 628 + Source/DirectFB/install-sh | 519 + .../DirectFB/interfaces/IDirectFBFont/Makefile.am | 77 + .../DirectFB/interfaces/IDirectFBFont/Makefile.in | 648 + .../interfaces/IDirectFBFont/default_font.h | 623 + .../IDirectFBFont/idirectfbfont_default.c | 322 + .../interfaces/IDirectFBFont/idirectfbfont_dgiff.c | 364 + .../interfaces/IDirectFBFont/idirectfbfont_ft2.c | 949 + .../interfaces/IDirectFBFont/idirectfbfont_lino.c | 1324 + .../interfaces/IDirectFBImageProvider/Makefile.am | 82 + .../interfaces/IDirectFBImageProvider/Makefile.in | 683 + .../idirectfbimageprovider_dfiff.c | 374 + .../idirectfbimageprovider_gif.c | 924 + .../idirectfbimageprovider_jpeg.c | 640 + .../idirectfbimageprovider_png.c | 868 + .../interfaces/IDirectFBVideoProvider/Makefile.am | 57 + .../interfaces/IDirectFBVideoProvider/Makefile.in | 635 + .../idirectfbvideoprovider_gif.c | 1075 + .../idirectfbvideoprovider_v4l.c | 1523 + .../interfaces/IDirectFBVideoProvider/videodev.h | 353 + .../interfaces/IDirectFBVideoProvider/videodev2.h | 897 + .../IDirectFBWindows/idirectfbwindows_default.c | 339 + .../IDirectFBWindows/idirectfbwindows_default.h | 50 + .../IDirectFBWindows/idirectfbwindows_dispatcher.c | 325 + .../IDirectFBWindows/idirectfbwindows_dispatcher.h | 53 + .../IDirectFBWindows/idirectfbwindows_requestor.c | 365 + .../IDirectFBWindows/idirectfbwindows_requestor.h | 58 + Source/DirectFB/interfaces/Makefile.am | 6 + Source/DirectFB/interfaces/Makefile.in | 560 + Source/DirectFB/lib/Makefile.am | 7 + Source/DirectFB/lib/Makefile.in | 557 + Source/DirectFB/lib/direct/Makefile.am | 138 + Source/DirectFB/lib/direct/Makefile.in | 769 + Source/DirectFB/lib/direct/armasm_memcpy.S | 421 + Source/DirectFB/lib/direct/armasm_memcpy.h | 32 + Source/DirectFB/lib/direct/build.h.in | 51 + Source/DirectFB/lib/direct/clock.c | 135 + Source/DirectFB/lib/direct/clock.h | 45 + Source/DirectFB/lib/direct/conf.c | 348 + Source/DirectFB/lib/direct/conf.h | 92 + Source/DirectFB/lib/direct/debug.c | 430 + Source/DirectFB/lib/direct/debug.h | 287 + Source/DirectFB/lib/direct/direct.c | 197 + Source/DirectFB/lib/direct/direct.h | 49 + Source/DirectFB/lib/direct/direct.pc.in | 13 + Source/DirectFB/lib/direct/fastlz.c | 97 + Source/DirectFB/lib/direct/fastlz.h | 52 + Source/DirectFB/lib/direct/flz.c | 555 + Source/DirectFB/lib/direct/flz.h | 100 + Source/DirectFB/lib/direct/hash.c | 268 + Source/DirectFB/lib/direct/hash.h | 61 + Source/DirectFB/lib/direct/interface.c | 474 + Source/DirectFB/lib/direct/interface.h | 215 + .../DirectFB/lib/direct/interface_implementation.h | 91 + Source/DirectFB/lib/direct/list.c | 35 + Source/DirectFB/lib/direct/list.h | 224 + Source/DirectFB/lib/direct/log.c | 414 + Source/DirectFB/lib/direct/log.h | 89 + Source/DirectFB/lib/direct/mem.c | 350 + Source/DirectFB/lib/direct/mem.h | 84 + Source/DirectFB/lib/direct/memcpy.c | 265 + Source/DirectFB/lib/direct/memcpy.h | 51 + Source/DirectFB/lib/direct/messages.c | 215 + Source/DirectFB/lib/direct/messages.h | 173 + Source/DirectFB/lib/direct/modules.c | 463 + Source/DirectFB/lib/direct/modules.h | 95 + Source/DirectFB/lib/direct/ppc_asm.h | 115 + Source/DirectFB/lib/direct/ppcasm_memcpy.S | 77 + Source/DirectFB/lib/direct/ppcasm_memcpy.h | 7 + .../DirectFB/lib/direct/ppcasm_memcpy_cachable.S | 180 + Source/DirectFB/lib/direct/serial.h | 118 + Source/DirectFB/lib/direct/signals.c | 480 + Source/DirectFB/lib/direct/signals.h | 70 + Source/DirectFB/lib/direct/stream.c | 2286 ++ Source/DirectFB/lib/direct/stream.h | 129 + Source/DirectFB/lib/direct/system.c | 68 + Source/DirectFB/lib/direct/system.h | 40 + Source/DirectFB/lib/direct/thread.c | 795 + Source/DirectFB/lib/direct/thread.h | 168 + Source/DirectFB/lib/direct/trace.c | 676 + Source/DirectFB/lib/direct/trace.h | 98 + Source/DirectFB/lib/direct/tree.c | 307 + Source/DirectFB/lib/direct/tree.h | 67 + Source/DirectFB/lib/direct/types.h | 169 + Source/DirectFB/lib/direct/utf8.c | 36 + Source/DirectFB/lib/direct/utf8.h | 80 + Source/DirectFB/lib/direct/util.c | 519 + Source/DirectFB/lib/direct/util.h | 330 + Source/DirectFB/lib/fusion/Makefile.am | 100 + Source/DirectFB/lib/fusion/Makefile.in | 804 + Source/DirectFB/lib/fusion/arena.c | 566 + Source/DirectFB/lib/fusion/arena.h | 62 + Source/DirectFB/lib/fusion/build.h.in | 36 + Source/DirectFB/lib/fusion/call.c | 581 + Source/DirectFB/lib/fusion/call.h | 74 + Source/DirectFB/lib/fusion/conf.c | 113 + Source/DirectFB/lib/fusion/conf.h | 55 + Source/DirectFB/lib/fusion/fusion.c | 2658 ++ Source/DirectFB/lib/fusion/fusion.h | 142 + Source/DirectFB/lib/fusion/fusion.pc.in | 11 + Source/DirectFB/lib/fusion/fusion_internal.h | 185 + Source/DirectFB/lib/fusion/hash.c | 560 + Source/DirectFB/lib/fusion/hash.h | 179 + Source/DirectFB/lib/fusion/lock.c | 687 + Source/DirectFB/lib/fusion/lock.h | 122 + Source/DirectFB/lib/fusion/object.c | 640 + Source/DirectFB/lib/fusion/object.h | 279 + Source/DirectFB/lib/fusion/property.c | 530 + Source/DirectFB/lib/fusion/property.h | 114 + Source/DirectFB/lib/fusion/protocol.h | 119 + Source/DirectFB/lib/fusion/reactor.c | 1868 + Source/DirectFB/lib/fusion/reactor.h | 197 + Source/DirectFB/lib/fusion/ref.c | 849 + Source/DirectFB/lib/fusion/ref.h | 134 + Source/DirectFB/lib/fusion/shm/Makefile.am | 31 + Source/DirectFB/lib/fusion/shm/Makefile.in | 565 + Source/DirectFB/lib/fusion/shm/fake.c | 163 + Source/DirectFB/lib/fusion/shm/heap.c | 802 + Source/DirectFB/lib/fusion/shm/pool.c | 954 + Source/DirectFB/lib/fusion/shm/pool.h | 69 + Source/DirectFB/lib/fusion/shm/shm.c | 337 + Source/DirectFB/lib/fusion/shm/shm.h | 48 + Source/DirectFB/lib/fusion/shm/shm_internal.h | 264 + Source/DirectFB/lib/fusion/shmalloc.c | 679 + Source/DirectFB/lib/fusion/shmalloc.h | 124 + Source/DirectFB/lib/fusion/types.h | 87 + Source/DirectFB/lib/fusion/vector.c | 230 + Source/DirectFB/lib/fusion/vector.h | 164 + Source/DirectFB/lib/voodoo/Makefile.am | 82 + Source/DirectFB/lib/voodoo/Makefile.in | 666 + Source/DirectFB/lib/voodoo/app.h | 66 + Source/DirectFB/lib/voodoo/build.h.in | 34 + Source/DirectFB/lib/voodoo/client.c | 208 + Source/DirectFB/lib/voodoo/client.h | 44 + Source/DirectFB/lib/voodoo/compat.h | 8 + Source/DirectFB/lib/voodoo/conf.c | 253 + Source/DirectFB/lib/voodoo/conf.h | 58 + Source/DirectFB/lib/voodoo/connection.cpp | 70 + Source/DirectFB/lib/voodoo/connection.h | 60 + Source/DirectFB/lib/voodoo/connection_link.cpp | 331 + Source/DirectFB/lib/voodoo/connection_link.h | 106 + Source/DirectFB/lib/voodoo/connection_packet.cpp | 368 + Source/DirectFB/lib/voodoo/connection_packet.h | 61 + .../DirectFB/lib/voodoo/connection_packet_old.cpp | 433 + Source/DirectFB/lib/voodoo/connection_packet_old.h | 87 + Source/DirectFB/lib/voodoo/connection_raw.cpp | 341 + Source/DirectFB/lib/voodoo/connection_raw.h | 60 + Source/DirectFB/lib/voodoo/dispatcher.cpp | 231 + Source/DirectFB/lib/voodoo/dispatcher.h | 71 + Source/DirectFB/lib/voodoo/instance.cpp | 107 + Source/DirectFB/lib/voodoo/instance.h | 61 + Source/DirectFB/lib/voodoo/interface.c | 114 + Source/DirectFB/lib/voodoo/interface.h | 52 + Source/DirectFB/lib/voodoo/internal.h | 40 + Source/DirectFB/lib/voodoo/ivoodooplayer.c | 247 + Source/DirectFB/lib/voodoo/ivoodooplayer.h | 74 + .../DirectFB/lib/voodoo/ivoodooplayer_dispatcher.c | 359 + .../DirectFB/lib/voodoo/ivoodooplayer_dispatcher.h | 41 + .../DirectFB/lib/voodoo/ivoodooplayer_requestor.c | 330 + Source/DirectFB/lib/voodoo/link.h | 78 + Source/DirectFB/lib/voodoo/manager.cpp | 937 + Source/DirectFB/lib/voodoo/manager.h | 279 + Source/DirectFB/lib/voodoo/manager_c.cpp | 553 + Source/DirectFB/lib/voodoo/message.h | 258 + Source/DirectFB/lib/voodoo/mutex.c | 105 + Source/DirectFB/lib/voodoo/mutex.h | 142 + Source/DirectFB/lib/voodoo/packet.h | 285 + Source/DirectFB/lib/voodoo/play.c | 935 + Source/DirectFB/lib/voodoo/play.h | 146 + Source/DirectFB/lib/voodoo/play_internal.h | 89 + Source/DirectFB/lib/voodoo/play_server.c | 430 + Source/DirectFB/lib/voodoo/play_server.h | 79 + Source/DirectFB/lib/voodoo/server.c | 459 + Source/DirectFB/lib/voodoo/server.h | 52 + Source/DirectFB/lib/voodoo/types.h | 97 + Source/DirectFB/lib/voodoo/unix/interfaces_unix.c | 237 + Source/DirectFB/lib/voodoo/unix/link_unix.c | 567 + .../DirectFB/lib/voodoo/unix/link_unix_1408limit.c | 422 + Source/DirectFB/lib/voodoo/voodoo.pc.in | 11 + Source/DirectFB/lib/voodoo/waitqueue.h | 117 + Source/DirectFB/ltmain.sh | 6964 ++++ Source/DirectFB/m4/as-ac-expand.m4 | 43 + Source/DirectFB/missing | 367 + Source/DirectFB/patches/Makefile.am | 16 + Source/DirectFB/patches/Makefile.in | 412 + Source/DirectFB/patches/README.davincifb | 2 + Source/DirectFB/patches/README.fusion | 1 + .../patches/README.matroxfb-vsync-irq-patch | 4 + Source/DirectFB/patches/README.savagefb | 13 + .../patches/davincifb-triple-osd0-2.6.10.patch.bz2 | Bin 0 -> 585 bytes ...matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2 | Bin 0 -> 510 bytes .../patches/matroxfb-g400-clock-2.4.22.patch.bz2 | Bin 0 -> 1995 bytes .../patches/matroxfb-vsync-irq-2.4.20.patch.bz2 | Bin 0 -> 2076 bytes .../matroxfb-vsync-irq-2.4.21-pre6.patch.bz2 | Bin 0 -> 2094 bytes .../patches/savagefb-0.3.2-linux-2.4.26.patch.bz2 | Bin 0 -> 17886 bytes .../patches/savagefb-0.4.0-linux-2.4.19.patch.bz2 | Bin 0 -> 19306 bytes .../savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2 | Bin 0 -> 19342 bytes .../patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2 | Bin 0 -> 13892 bytes Source/DirectFB/proxy/Makefile.am | 3 + Source/DirectFB/proxy/Makefile.in | 556 + Source/DirectFB/proxy/dispatcher/Makefile.am | 124 + Source/DirectFB/proxy/dispatcher/Makefile.in | 1402 + .../proxy/dispatcher/idirectfb_dispatcher.c | 1305 + .../proxy/dispatcher/idirectfb_dispatcher.h | 110 + .../dispatcher/idirectfbdatabuffer_dispatcher.c | 673 + .../dispatcher/idirectfbdatabuffer_dispatcher.h | 47 + .../dispatcher/idirectfbdisplaylayer_dispatcher.c | 900 + .../dispatcher/idirectfbdisplaylayer_dispatcher.h | 79 + .../dispatcher/idirectfbeventbuffer_dispatcher.c | 272 + .../dispatcher/idirectfbeventbuffer_dispatcher.h | 63 + .../proxy/dispatcher/idirectfbfont_dispatcher.c | 532 + .../proxy/dispatcher/idirectfbfont_dispatcher.h | 43 + .../proxy/dispatcher/idirectfbfoo_dispatcher.c | 194 + .../proxy/dispatcher/idirectfbfoo_dispatcher.h | 48 + .../dispatcher/idirectfbimageprovider_dispatcher.c | 296 + .../dispatcher/idirectfbimageprovider_dispatcher.h | 39 + .../dispatcher/idirectfbinputdevice_dispatcher.c | 635 + .../dispatcher/idirectfbinputdevice_dispatcher.h | 60 + .../proxy/dispatcher/idirectfbpalette_dispatcher.c | 408 + .../proxy/dispatcher/idirectfbpalette_dispatcher.h | 41 + .../proxy/dispatcher/idirectfbscreen_dispatcher.c | 572 + .../proxy/dispatcher/idirectfbscreen_dispatcher.h | 58 + .../proxy/dispatcher/idirectfbsurface_dispatcher.c | 2149 ++ .../proxy/dispatcher/idirectfbsurface_dispatcher.h | 93 + .../proxy/dispatcher/idirectfbwindow_dispatcher.c | 1391 + .../proxy/dispatcher/idirectfbwindow_dispatcher.h | 104 + Source/DirectFB/proxy/requestor/Makefile.am | 125 + Source/DirectFB/proxy/requestor/Makefile.in | 1401 + .../DirectFB/proxy/requestor/idirectfb_requestor.c | 1045 + .../requestor/idirectfbdatabuffer_requestor.c | 484 + .../requestor/idirectfbdisplaylayer_requestor.c | 721 + .../requestor/idirectfbdisplaylayer_requestor.h | 47 + .../requestor/idirectfbeventbuffer_requestor.c | 300 + .../requestor/idirectfbeventbuffer_requestor.h | 54 + .../proxy/requestor/idirectfbfont_requestor.c | 530 + .../proxy/requestor/idirectfbfont_requestor.h | 47 + .../proxy/requestor/idirectfbfoo_requestor.c | 135 + .../proxy/requestor/idirectfbfoo_requestor.h | 45 + .../requestor/idirectfbimageprovider_requestor.c | 264 + .../requestor/idirectfbinputdevice_requestor.c | 469 + .../requestor/idirectfbinputdevice_requestor.h | 45 + .../proxy/requestor/idirectfbpalette_requestor.c | 335 + .../proxy/requestor/idirectfbpalette_requestor.h | 45 + .../proxy/requestor/idirectfbscreen_requestor.c | 524 + .../proxy/requestor/idirectfbsurface_requestor.c | 1852 + .../proxy/requestor/idirectfbsurface_requestor.h | 80 + .../proxy/requestor/idirectfbwindow_requestor.c | 1120 + .../proxy/requestor/idirectfbwindow_requestor.h | 47 + Source/DirectFB/rules/Makefile.am | 1 + Source/DirectFB/rules/Makefile.in | 398 + Source/DirectFB/rules/libobject.make | 9 + Source/DirectFB/rules/nmfile.make | 11 + Source/DirectFB/src/Makefile.am | 73 + Source/DirectFB/src/Makefile.in | 745 + Source/DirectFB/src/core/Makefile.am | 84 + Source/DirectFB/src/core/Makefile.in | 648 + Source/DirectFB/src/core/clipboard.c | 298 + Source/DirectFB/src/core/clipboard.h | 53 + Source/DirectFB/src/core/colorhash.c | 366 + Source/DirectFB/src/core/colorhash.h | 54 + Source/DirectFB/src/core/core.c | 1160 + Source/DirectFB/src/core/core.h | 162 + Source/DirectFB/src/core/core_parts.c | 202 + Source/DirectFB/src/core/core_parts.h | 131 + Source/DirectFB/src/core/core_system.h | 141 + Source/DirectFB/src/core/coredefs.h | 48 + Source/DirectFB/src/core/coretypes.h | 89 + Source/DirectFB/src/core/fonts.c | 660 + Source/DirectFB/src/core/fonts.h | 250 + Source/DirectFB/src/core/gfxcard.c | 2921 ++ Source/DirectFB/src/core/gfxcard.h | 470 + Source/DirectFB/src/core/graphics_driver.h | 86 + Source/DirectFB/src/core/input.c | 2668 ++ Source/DirectFB/src/core/input.h | 203 + Source/DirectFB/src/core/input_driver.h | 103 + Source/DirectFB/src/core/layer_context.c | 1947 + Source/DirectFB/src/core/layer_context.h | 149 + Source/DirectFB/src/core/layer_control.c | 589 + Source/DirectFB/src/core/layer_control.h | 72 + Source/DirectFB/src/core/layer_region.c | 1129 + Source/DirectFB/src/core/layer_region.h | 100 + Source/DirectFB/src/core/layers.c | 640 + Source/DirectFB/src/core/layers.h | 359 + Source/DirectFB/src/core/layers_internal.h | 196 + Source/DirectFB/src/core/local_surface_pool.c | 313 + Source/DirectFB/src/core/palette.c | 317 + Source/DirectFB/src/core/palette.h | 106 + Source/DirectFB/src/core/prealloc_surface_pool.c | 192 + Source/DirectFB/src/core/screen.c | 540 + Source/DirectFB/src/core/screen.h | 122 + Source/DirectFB/src/core/screens.c | 591 + Source/DirectFB/src/core/screens.h | 263 + Source/DirectFB/src/core/screens_internal.h | 81 + Source/DirectFB/src/core/shared_surface_pool.c | 227 + Source/DirectFB/src/core/state.c | 416 + Source/DirectFB/src/core/state.h | 362 + Source/DirectFB/src/core/surface.c | 768 + Source/DirectFB/src/core/surface.h | 446 + Source/DirectFB/src/core/surface_buffer.c | 1206 + Source/DirectFB/src/core/surface_buffer.h | 257 + Source/DirectFB/src/core/surface_core.c | 214 + Source/DirectFB/src/core/surface_pool.c | 1263 + Source/DirectFB/src/core/surface_pool.h | 272 + Source/DirectFB/src/core/surface_pool_bridge.c | 531 + Source/DirectFB/src/core/surface_pool_bridge.h | 187 + Source/DirectFB/src/core/system.c | 464 + Source/DirectFB/src/core/system.h | 258 + Source/DirectFB/src/core/windows.c | 1908 + Source/DirectFB/src/core/windows.h | 316 + Source/DirectFB/src/core/windows_internal.h | 211 + Source/DirectFB/src/core/windowstack.c | 998 + Source/DirectFB/src/core/windowstack.h | 105 + Source/DirectFB/src/core/wm.c | 1440 + Source/DirectFB/src/core/wm.h | 468 + Source/DirectFB/src/core/wm_module.h | 274 + Source/DirectFB/src/directfb.c | 311 + Source/DirectFB/src/display/Makefile.am | 30 + Source/DirectFB/src/display/Makefile.in | 570 + .../DirectFB/src/display/idirectfbdisplaylayer.c | 1076 + .../DirectFB/src/display/idirectfbdisplaylayer.h | 43 + Source/DirectFB/src/display/idirectfbpalette.c | 365 + Source/DirectFB/src/display/idirectfbpalette.h | 51 + Source/DirectFB/src/display/idirectfbscreen.c | 722 + Source/DirectFB/src/display/idirectfbscreen.h | 42 + Source/DirectFB/src/display/idirectfbsurface.c | 2841 ++ Source/DirectFB/src/display/idirectfbsurface.h | 123 + .../DirectFB/src/display/idirectfbsurface_layer.c | 244 + .../DirectFB/src/display/idirectfbsurface_layer.h | 57 + .../DirectFB/src/display/idirectfbsurface_window.c | 353 + .../DirectFB/src/display/idirectfbsurface_window.h | 48 + Source/DirectFB/src/gfx/Makefile.am | 29 + Source/DirectFB/src/gfx/Makefile.in | 676 + Source/DirectFB/src/gfx/clip.c | 379 + Source/DirectFB/src/gfx/clip.h | 125 + Source/DirectFB/src/gfx/convert.c | 1427 + Source/DirectFB/src/gfx/convert.h | 562 + Source/DirectFB/src/gfx/generic/Makefile.am | 62 + Source/DirectFB/src/gfx/generic/Makefile.in | 602 + Source/DirectFB/src/gfx/generic/duffs_device.h | 89 + Source/DirectFB/src/gfx/generic/generic.c | 9161 +++++ Source/DirectFB/src/gfx/generic/generic.h | 174 + Source/DirectFB/src/gfx/generic/generic_64.h | 207 + Source/DirectFB/src/gfx/generic/generic_dummy.c | 94 + Source/DirectFB/src/gfx/generic/generic_mmx.h | 659 + Source/DirectFB/src/gfx/generic/stretch_hvx_16.h | 469 + Source/DirectFB/src/gfx/generic/stretch_hvx_32.h | 174 + Source/DirectFB/src/gfx/generic/stretch_hvx_8.h | 149 + Source/DirectFB/src/gfx/generic/stretch_hvx_88.h | 152 + Source/DirectFB/src/gfx/generic/stretch_hvx_N.h | 121 + .../DirectFB/src/gfx/generic/stretch_up_down_16.h | 68 + .../DirectFB/src/gfx/generic/stretch_up_down_32.h | 68 + .../src/gfx/generic/stretch_up_down_32_indexed.h | 82 + .../DirectFB/src/gfx/generic/stretch_up_down_8.h | 72 + .../DirectFB/src/gfx/generic/stretch_up_down_88.h | 72 + .../src/gfx/generic/stretch_up_down_table.h | 59 + Source/DirectFB/src/gfx/generic/template_acc_16.h | 382 + Source/DirectFB/src/gfx/generic/template_acc_32.h | 261 + .../src/gfx/generic/template_colorkey_16.h | 369 + .../src/gfx/generic/template_colorkey_32.h | 206 + Source/DirectFB/src/gfx/generic/yuvtbl-gen.c | 199 + Source/DirectFB/src/gfx/generic/yuvtbl.h | 296 + Source/DirectFB/src/gfx/util.c | 270 + Source/DirectFB/src/gfx/util.h | 42 + Source/DirectFB/src/idirectfb.c | 1965 + Source/DirectFB/src/idirectfb.h | 89 + Source/DirectFB/src/input/Makefile.am | 22 + Source/DirectFB/src/input/Makefile.in | 556 + Source/DirectFB/src/input/idirectfbinputbuffer.c | 1121 + Source/DirectFB/src/input/idirectfbinputbuffer.h | 56 + Source/DirectFB/src/input/idirectfbinputdevice.c | 446 + Source/DirectFB/src/input/idirectfbinputdevice.h | 40 + Source/DirectFB/src/media/Makefile.am | 29 + Source/DirectFB/src/media/Makefile.in | 570 + Source/DirectFB/src/media/idirectfbdatabuffer.c | 264 + Source/DirectFB/src/media/idirectfbdatabuffer.h | 104 + .../DirectFB/src/media/idirectfbdatabuffer_file.c | 297 + .../src/media/idirectfbdatabuffer_memory.c | 266 + .../src/media/idirectfbdatabuffer_streamed.c | 529 + Source/DirectFB/src/media/idirectfbfont.c | 965 + Source/DirectFB/src/media/idirectfbfont.h | 82 + Source/DirectFB/src/media/idirectfbimageprovider.c | 167 + Source/DirectFB/src/media/idirectfbimageprovider.h | 48 + Source/DirectFB/src/media/idirectfbvideoprovider.c | 387 + Source/DirectFB/src/media/idirectfbvideoprovider.h | 54 + Source/DirectFB/src/misc/Makefile.am | 29 + Source/DirectFB/src/misc/Makefile.in | 564 + Source/DirectFB/src/misc/conf.c | 1947 + Source/DirectFB/src/misc/conf.h | 287 + Source/DirectFB/src/misc/dither565.h | 211 + Source/DirectFB/src/misc/gfx_util.c | 964 + Source/DirectFB/src/misc/gfx_util.h | 48 + Source/DirectFB/src/misc/util.c | 471 + Source/DirectFB/src/misc/util.h | 34 + Source/DirectFB/src/windows/Makefile.am | 20 + Source/DirectFB/src/windows/Makefile.in | 552 + Source/DirectFB/src/windows/idirectfbwindow.c | 1446 + Source/DirectFB/src/windows/idirectfbwindow.h | 44 + Source/DirectFB/systems/Makefile.am | 40 + Source/DirectFB/systems/Makefile.in | 568 + Source/DirectFB/systems/devmem/Makefile.am | 40 + Source/DirectFB/systems/devmem/Makefile.in | 628 + Source/DirectFB/systems/devmem/devmem.c | 374 + Source/DirectFB/systems/devmem/devmem.h | 60 + .../DirectFB/systems/devmem/devmem_surface_pool.c | 394 + Source/DirectFB/systems/devmem/surfacemanager.c | 575 + Source/DirectFB/systems/devmem/surfacemanager.h | 110 + Source/DirectFB/systems/fbdev/Makefile.am | 48 + Source/DirectFB/systems/fbdev/Makefile.in | 637 + Source/DirectFB/systems/fbdev/agp.c | 511 + Source/DirectFB/systems/fbdev/agp.h | 53 + Source/DirectFB/systems/fbdev/fb.h | 366 + Source/DirectFB/systems/fbdev/fbdev.c | 2782 ++ Source/DirectFB/systems/fbdev/fbdev.h | 142 + Source/DirectFB/systems/fbdev/fbdev_surface_pool.c | 423 + Source/DirectFB/systems/fbdev/surfacemanager.c | 617 + Source/DirectFB/systems/fbdev/surfacemanager.h | 117 + Source/DirectFB/systems/fbdev/vt.c | 675 + Source/DirectFB/systems/fbdev/vt.h | 83 + Source/DirectFB/systems/osx/Makefile.am | 59 + Source/DirectFB/systems/osx/Makefile.in | 685 + Source/DirectFB/systems/osx/osx.c | 263 + Source/DirectFB/systems/osx/osx.h | 43 + Source/DirectFB/systems/osx/osxinput.c | 311 + Source/DirectFB/systems/osx/primary.c | 623 + Source/DirectFB/systems/osx/primary.h | 49 + Source/DirectFB/systems/sdl/Makefile.am | 86 + Source/DirectFB/systems/sdl/Makefile.in | 773 + Source/DirectFB/systems/sdl/primary.c | 669 + Source/DirectFB/systems/sdl/primary.h | 49 + Source/DirectFB/systems/sdl/sdl.c | 396 + Source/DirectFB/systems/sdl/sdl.h | 70 + Source/DirectFB/systems/sdl/sdl_surface_pool.c | 349 + Source/DirectFB/systems/sdl/sdlgfx.c | 302 + Source/DirectFB/systems/sdl/sdlinput.c | 571 + Source/DirectFB/systems/vnc/Makefile.am | 55 + Source/DirectFB/systems/vnc/Makefile.in | 682 + Source/DirectFB/systems/vnc/primary.c | 993 + Source/DirectFB/systems/vnc/primary.h | 50 + Source/DirectFB/systems/vnc/vnc.c | 313 + Source/DirectFB/systems/vnc/vnc.h | 86 + Source/DirectFB/systems/vnc/vncinput.c | 128 + Source/DirectFB/systems/x11/Makefile.am | 63 + Source/DirectFB/systems/x11/Makefile.in | 624 + Source/DirectFB/systems/x11/README | 11 + Source/DirectFB/systems/x11/glx_surface_pool.c | 838 + Source/DirectFB/systems/x11/glx_surface_pool.h | 79 + Source/DirectFB/systems/x11/primary.c | 664 + Source/DirectFB/systems/x11/primary.h | 39 + Source/DirectFB/systems/x11/surfacemanager.c | 559 + Source/DirectFB/systems/x11/surfacemanager.h | 110 + Source/DirectFB/systems/x11/vpsmem_surface_pool.c | 421 + Source/DirectFB/systems/x11/vpsmem_surface_pool.h | 37 + Source/DirectFB/systems/x11/x11.c | 570 + Source/DirectFB/systems/x11/x11.h | 116 + Source/DirectFB/systems/x11/x11_surface_pool.c | 369 + Source/DirectFB/systems/x11/x11_surface_pool.h | 47 + .../DirectFB/systems/x11/x11_surface_pool_bridge.c | 331 + .../DirectFB/systems/x11/x11_surface_pool_bridge.h | 37 + Source/DirectFB/systems/x11/x11image.c | 231 + Source/DirectFB/systems/x11/x11image.h | 76 + Source/DirectFB/systems/x11/x11input.c | 768 + Source/DirectFB/systems/x11/x11types.h | 35 + Source/DirectFB/systems/x11/xwindow.c | 294 + Source/DirectFB/systems/x11/xwindow.h | 77 + Source/DirectFB/tests/Makefile.am | 58 + Source/DirectFB/tests/Makefile.in | 612 + Source/DirectFB/tests/dfbtest_blit.c | 316 + Source/DirectFB/tests/dfbtest_font.c | 206 + Source/DirectFB/tests/dfbtest_reinit.c | 72 + Source/DirectFB/tests/dfbtest_scale.c | 156 + Source/DirectFB/tests/dfbtest_window.c | 1241 + Source/DirectFB/tests/dfbtest_windows_watcher.c | 227 + Source/DirectFB/tests/dfbtest_write.c | 162 + Source/DirectFB/tests/direct_stream.c | 139 + Source/DirectFB/tests/direct_test.c | 119 + Source/DirectFB/tests/fusion_fork.c | 172 + Source/DirectFB/tests/fusion_reactor.c | 199 + Source/DirectFB/tests/fusion_skirmish.c | 131 + Source/DirectFB/tests/fusion_stream.c | 545 + Source/DirectFB/tests/smiley_test.c | 215 + Source/DirectFB/tools/Makefile.am | 109 + Source/DirectFB/tools/Makefile.in | 760 + Source/DirectFB/tools/README | 24 + Source/DirectFB/tools/application.lst | 15 + Source/DirectFB/tools/dfbdump.c | 928 + Source/DirectFB/tools/dfbfx.c | 630 + Source/DirectFB/tools/dfbg.c | 280 + Source/DirectFB/tools/dfbinfo.c | 605 + Source/DirectFB/tools/dfbinput.c | 331 + Source/DirectFB/tools/dfbinspector.c | 288 + Source/DirectFB/tools/dfblayer.c | 625 + Source/DirectFB/tools/dfbmaster.c | 68 + Source/DirectFB/tools/dfbpenmount.c | 228 + Source/DirectFB/tools/dfbproxy.c | 162 + Source/DirectFB/tools/dfbscreen.c | 660 + Source/DirectFB/tools/directfb-csource.c | 894 + Source/DirectFB/tools/fusion_bench.c | 537 + Source/DirectFB/tools/gendoc.pl | 936 + Source/DirectFB/tools/mkdfiff.c | 444 + Source/DirectFB/tools/mkdgiff.c | 616 + Source/DirectFB/tools/mkdgifft.cpp | 1043 + Source/DirectFB/tools/mknames.sh | 33 + Source/DirectFB/tools/raw15toraw24.c | 61 + Source/DirectFB/tools/raw16toraw24.c | 61 + Source/DirectFB/tools/raw32toraw24.c | 63 + Source/DirectFB/tools/voodooplay.c | 164 + Source/DirectFB/tools/voodooplay_client.c | 317 + Source/DirectFB/tools/voodooplay_server.c | 318 + Source/DirectFB/wm/Makefile.am | 9 + Source/DirectFB/wm/Makefile.in | 558 + Source/DirectFB/wm/default/Makefile.am | 33 + Source/DirectFB/wm/default/Makefile.in | 595 + Source/DirectFB/wm/default/default.c | 4073 ++ Source/DirectFB/wm/unique/Makefile.am | 150 + Source/DirectFB/wm/unique/Makefile.in | 979 + Source/DirectFB/wm/unique/classes/Makefile.am | 22 + Source/DirectFB/wm/unique/classes/Makefile.in | 527 + Source/DirectFB/wm/unique/classes/foo.c | 232 + Source/DirectFB/wm/unique/classes/frame.c | 53 + Source/DirectFB/wm/unique/classes/root.c | 206 + Source/DirectFB/wm/unique/classes/window.c | 165 + Source/DirectFB/wm/unique/context.c | 711 + Source/DirectFB/wm/unique/context.h | 134 + Source/DirectFB/wm/unique/data/Makefile.am | 31 + Source/DirectFB/wm/unique/data/Makefile.in | 420 + Source/DirectFB/wm/unique/data/foo_e.png | Bin 0 -> 121 bytes Source/DirectFB/wm/unique/data/foo_n.png | Bin 0 -> 173 bytes Source/DirectFB/wm/unique/data/foo_ne.png | Bin 0 -> 697 bytes Source/DirectFB/wm/unique/data/foo_nw.png | Bin 0 -> 530 bytes Source/DirectFB/wm/unique/data/foo_s.png | Bin 0 -> 169 bytes Source/DirectFB/wm/unique/data/foo_se.png | Bin 0 -> 782 bytes Source/DirectFB/wm/unique/data/foo_sw.png | Bin 0 -> 644 bytes Source/DirectFB/wm/unique/data/foo_w.png | Bin 0 -> 101 bytes Source/DirectFB/wm/unique/decoration.c | 190 + Source/DirectFB/wm/unique/decoration.h | 132 + Source/DirectFB/wm/unique/device.c | 495 + Source/DirectFB/wm/unique/device.h | 139 + Source/DirectFB/wm/unique/devices/Makefile.am | 21 + Source/DirectFB/wm/unique/devices/Makefile.in | 525 + Source/DirectFB/wm/unique/devices/keyboard.c | 192 + Source/DirectFB/wm/unique/devices/pointer.c | 259 + Source/DirectFB/wm/unique/devices/wheel.c | 182 + Source/DirectFB/wm/unique/input_channel.c | 206 + Source/DirectFB/wm/unique/input_channel.h | 74 + Source/DirectFB/wm/unique/input_events.h | 114 + Source/DirectFB/wm/unique/input_switch.c | 776 + Source/DirectFB/wm/unique/input_switch.h | 78 + Source/DirectFB/wm/unique/internal.h | 378 + Source/DirectFB/wm/unique/stret.c | 837 + Source/DirectFB/wm/unique/stret.h | 155 + Source/DirectFB/wm/unique/stret_iteration.c | 209 + Source/DirectFB/wm/unique/stret_iteration.h | 68 + Source/DirectFB/wm/unique/stret_test.c | 153 + Source/DirectFB/wm/unique/test_color.c | 221 + Source/DirectFB/wm/unique/test_foo.c | 288 + Source/DirectFB/wm/unique/types.h | 53 + Source/DirectFB/wm/unique/unique.c | 1064 + Source/DirectFB/wm/unique/uniquewm.c | 451 + Source/DirectFB/wm/unique/uniquewm.h | 48 + Source/DirectFB/wm/unique/uwmdump.c | 267 + Source/DirectFB/wm/unique/window.c | 1525 + Source/DirectFB/wm/unique/window.h | 135 + 940 files changed, 451460 insertions(+) create mode 100755 Source/DirectFB/AUTHORS create mode 100755 Source/DirectFB/COPYING create mode 100755 Source/DirectFB/ChangeLog create mode 100755 Source/DirectFB/INSTALL create mode 100755 Source/DirectFB/Makefile.am create mode 100755 Source/DirectFB/Makefile.in create mode 100755 Source/DirectFB/NEWS create mode 100755 Source/DirectFB/README create mode 100755 Source/DirectFB/TODO create mode 100755 Source/DirectFB/aclocal.m4 create mode 100755 Source/DirectFB/autogen.sh create mode 100755 Source/DirectFB/compile create mode 100755 Source/DirectFB/config.guess create mode 100755 Source/DirectFB/config.h.in create mode 100755 Source/DirectFB/config.sub create mode 100755 Source/DirectFB/configure create mode 100755 Source/DirectFB/configure.in create mode 100755 Source/DirectFB/data/Makefile.am create mode 100755 Source/DirectFB/data/Makefile.in create mode 100755 Source/DirectFB/data/cursor.dat create mode 100755 Source/DirectFB/depcomp create mode 100755 Source/DirectFB/directfb-config.in create mode 100755 Source/DirectFB/directfb-internal.pc.in create mode 100755 Source/DirectFB/directfb.pc.in create mode 100755 Source/DirectFB/directfb.spec create mode 100755 Source/DirectFB/directfb.spec.in create mode 100755 Source/DirectFB/docs/Makefile.am create mode 100755 Source/DirectFB/docs/Makefile.in create mode 100755 Source/DirectFB/docs/README.screenshots create mode 100755 Source/DirectFB/docs/dfbg.1.in create mode 100755 Source/DirectFB/docs/directfb-csource.1.in create mode 100755 Source/DirectFB/docs/directfbrc.5.in create mode 100755 Source/DirectFB/docs/html/Makefile.am create mode 100755 Source/DirectFB/docs/html/Makefile.in create mode 100755 Source/DirectFB/docs/html/dfb_logo-alpha.png create mode 100755 Source/DirectFB/fb.modes create mode 100755 Source/DirectFB/gfxdrivers/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/ati128/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/ati128/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/ati128/ati128.c create mode 100755 Source/DirectFB/gfxdrivers/ati128/ati128.h create mode 100755 Source/DirectFB/gfxdrivers/ati128/ati128_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/ati128/ati128_state.c create mode 100755 Source/DirectFB/gfxdrivers/ati128/ati128_state.h create mode 100755 Source/DirectFB/gfxdrivers/ati128/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/ati128/regs.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/cle266/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/cle266/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/regs2d.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/regs3d.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_accel.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_accel.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_fifo.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_fifo.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_hw.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_hwmap.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_hwset.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_overlay.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwmap.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwset.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_primary.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_state.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/uc_state.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/unichrome.c create mode 100755 Source/DirectFB/gfxdrivers/cle266/unichrome.h create mode 100755 Source/DirectFB/gfxdrivers/cle266/vidregs.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/regs.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/davinci/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/davinci/Makefile.kernel create mode 100755 Source/DirectFB/gfxdrivers/davinci/c64xdump.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_2d.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_2d.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_c64x.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_c64x.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_osd.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_osd.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_screen.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_screen.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_video.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_video.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/davincifb.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/directfbrc create mode 100755 Source/DirectFB/gfxdrivers/davinci/kernel-module/Makefile create mode 100755 Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/Makefile create mode 100755 Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/c64x.c create mode 100755 Source/DirectFB/gfxdrivers/davinci/kernel-module/include/linux/c64x.h create mode 100755 Source/DirectFB/gfxdrivers/davinci/patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch create mode 100755 Source/DirectFB/gfxdrivers/ep9x/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/ep9x/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/ep9x/ep9x.c create mode 100755 Source/DirectFB/gfxdrivers/ep9x/ep9x.h 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 create mode 100755 Source/DirectFB/gfxdrivers/i810/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/i810/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/i810/i810.c create mode 100755 Source/DirectFB/gfxdrivers/i810/i810.h create mode 100755 Source/DirectFB/gfxdrivers/i810/i810_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/i830/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/i830/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/i830/i830.c create mode 100755 Source/DirectFB/gfxdrivers/i830/i830.h create mode 100755 Source/DirectFB/gfxdrivers/i830/i830_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/mach64/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/mach64/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/mach64/mach64.c create mode 100755 Source/DirectFB/gfxdrivers/mach64/mach64.h create mode 100755 Source/DirectFB/gfxdrivers/mach64/mach64_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/mach64/mach64_state.c create mode 100755 Source/DirectFB/gfxdrivers/mach64/mach64_state.h create mode 100755 Source/DirectFB/gfxdrivers/mach64/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/mach64/regs.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/matrox/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_3d.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_3d.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_bes.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_crtc2.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_maven.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_maven.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_screen_crtc2.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_spic.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_state.c create mode 100755 Source/DirectFB/gfxdrivers/matrox/matrox_state.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/matrox/regs.h create mode 100755 Source/DirectFB/gfxdrivers/neomagic/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/neomagic/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neo2200.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neomagic.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neomagic.h create mode 100755 Source/DirectFB/gfxdrivers/nsc/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/nsc/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/gfx_regs.h create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/gfx_type.h create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/nsc_galproto.h create mode 100755 Source/DirectFB/gfxdrivers/nsc/include/pnl_defs.h create mode 100755 Source/DirectFB/gfxdrivers/nsc/nsc.c create mode 100755 Source/DirectFB/gfxdrivers/nsc/nsc_galfns.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/nvidia/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_accel.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_objects.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_primary.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_regs.h create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_state.c create mode 100755 Source/DirectFB/gfxdrivers/nvidia/nvidia_state.h create mode 100755 Source/DirectFB/gfxdrivers/omap/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/omap/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/omap/omap.c create mode 100755 Source/DirectFB/gfxdrivers/omap/omap.h create mode 100755 Source/DirectFB/gfxdrivers/omap/omap_primary.c create mode 100755 Source/DirectFB/gfxdrivers/omap/omapfb.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/radeon/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/radeon/r100_3d.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/r100_state.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/r200_3d.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/r200_state.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/r300_3d.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/r300_program.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/r300_state.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_2d.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_2d.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_3d.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_chipsets.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_crtc1.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_crtc2.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_mmio.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_regs.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/radeon_state.h create mode 100755 Source/DirectFB/gfxdrivers/radeon/vertex_shader.h create mode 100755 Source/DirectFB/gfxdrivers/savage/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/savage/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/savage/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage.c create mode 100755 Source/DirectFB/gfxdrivers/savage/savage.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage2000.c create mode 100755 Source/DirectFB/gfxdrivers/savage/savage2000.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage3d.c create mode 100755 Source/DirectFB/gfxdrivers/savage/savage3d.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage4.c create mode 100755 Source/DirectFB/gfxdrivers/savage/savage4.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage_bci.h create mode 100755 Source/DirectFB/gfxdrivers/savage/savage_streams_old.c create mode 100755 Source/DirectFB/gfxdrivers/savage/savage_streams_old.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/sh772x/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/sh772x/Makefile.kernel create mode 100755 Source/DirectFB/gfxdrivers/sh772x/README.sh7722 create mode 100755 Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7722 create mode 100755 Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7723 create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/Makefile create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_driver.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_gfx.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeg.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_jpegtool.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_regs.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7722_types.h create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.c create mode 100755 Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/sis315/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315.c create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_accel.c create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_accel.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_compat.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_mmio.c create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_mmio.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_regs.h create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_state.c create mode 100755 Source/DirectFB/gfxdrivers/sis315/sis315_state.h create mode 100755 Source/DirectFB/gfxdrivers/tdfx/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/tdfx/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/tdfx/tdfx.c create mode 100755 Source/DirectFB/gfxdrivers/tdfx/tdfx.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/unichrome/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/unichrome/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/regs2d.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/regs3d.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_accel.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_accel.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_fifo.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_fifo.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_hw.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_hwmap.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_hwset.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_ioctl.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_overlay.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwmap.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwset.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_primary.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_probe.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_spic.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_state.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/uc_state.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/unichrome.c create mode 100755 Source/DirectFB/gfxdrivers/unichrome/unichrome.h create mode 100755 Source/DirectFB/gfxdrivers/unichrome/vidregs.h create mode 100755 Source/DirectFB/gfxdrivers/vmware/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/vmware/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/vmware/vmware_2d.c create mode 100755 Source/DirectFB/gfxdrivers/vmware/vmware_2d.h create mode 100755 Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.c create mode 100755 Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.h create mode 100755 Source/DirectFB/include/Makefile.am create mode 100755 Source/DirectFB/include/Makefile.in create mode 100755 Source/DirectFB/include/dfb_types.h create mode 100755 Source/DirectFB/include/dfiff.h create mode 100755 Source/DirectFB/include/dgiff.h create mode 100755 Source/DirectFB/include/directfb.h create mode 100755 Source/DirectFB/include/directfb_keyboard.h create mode 100755 Source/DirectFB/include/directfb_keynames.h create mode 100755 Source/DirectFB/include/directfb_strings.h create mode 100755 Source/DirectFB/include/directfb_util.h create mode 100755 Source/DirectFB/include/directfb_version.h create mode 100755 Source/DirectFB/include/directfb_version.h.in create mode 100755 Source/DirectFB/include/directfb_windows.h create mode 100755 Source/DirectFB/include/directfbgl.h create mode 100755 Source/DirectFB/inputdrivers/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/dbox2remote/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/dbox2remote/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/dbox2remote/dbox2remote.c create mode 100755 Source/DirectFB/inputdrivers/dreamboxremote/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/dreamboxremote/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/dreamboxremote/dreamboxremote.c create mode 100755 Source/DirectFB/inputdrivers/dynapro/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/dynapro/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/dynapro/dynapro.c create mode 100755 Source/DirectFB/inputdrivers/elo/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/elo/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/elo/elo.c create mode 100755 Source/DirectFB/inputdrivers/gunze/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/gunze/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/gunze/gunze.c create mode 100755 Source/DirectFB/inputdrivers/h3600_ts/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/h3600_ts/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/h3600_ts/h3600_ts.c create mode 100755 Source/DirectFB/inputdrivers/joystick/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/joystick/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/joystick/joystick.c create mode 100755 Source/DirectFB/inputdrivers/keyboard/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/keyboard/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/keyboard/keyboard.c create mode 100755 Source/DirectFB/inputdrivers/linux_input/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/linux_input/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/linux_input/input_fake.h create mode 100755 Source/DirectFB/inputdrivers/linux_input/linux_input.c create mode 100755 Source/DirectFB/inputdrivers/lirc/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/lirc/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/lirc/lirc.c create mode 100755 Source/DirectFB/inputdrivers/mutouch/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/mutouch/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/mutouch/mutouch.c create mode 100755 Source/DirectFB/inputdrivers/penmount/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/penmount/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/penmount/penmount.c create mode 100755 Source/DirectFB/inputdrivers/ps2mouse/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/ps2mouse/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/ps2mouse/ps2mouse.c create mode 100755 Source/DirectFB/inputdrivers/serialmouse/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/serialmouse/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/serialmouse/serialmouse.c create mode 100755 Source/DirectFB/inputdrivers/sonypi/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/sonypi/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/sonypi/sonypi.c create mode 100755 Source/DirectFB/inputdrivers/tslib/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/tslib/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/tslib/tslib.c create mode 100755 Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/ucb1x00_ts/ucb1x00_ts.c create mode 100755 Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/wm97xx_ts/wm97xx_ts.c create mode 100755 Source/DirectFB/inputdrivers/zytronic/Makefile.am create mode 100755 Source/DirectFB/inputdrivers/zytronic/Makefile.in create mode 100755 Source/DirectFB/inputdrivers/zytronic/zytronic.c create mode 100755 Source/DirectFB/install-sh create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/Makefile.am create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/Makefile.in create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/default_font.h create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_default.c create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_dgiff.c create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_ft2.c create mode 100755 Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_lino.c create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.am create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.in create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_dfiff.c create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_gif.c create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c create mode 100755 Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.am create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.in create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_gif.c create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev.h create mode 100755 Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev2.h create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.c create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.h create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.c create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.h create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.c create mode 100755 Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.h create mode 100755 Source/DirectFB/interfaces/Makefile.am create mode 100755 Source/DirectFB/interfaces/Makefile.in create mode 100755 Source/DirectFB/lib/Makefile.am create mode 100755 Source/DirectFB/lib/Makefile.in create mode 100755 Source/DirectFB/lib/direct/Makefile.am create mode 100755 Source/DirectFB/lib/direct/Makefile.in create mode 100755 Source/DirectFB/lib/direct/armasm_memcpy.S create mode 100755 Source/DirectFB/lib/direct/armasm_memcpy.h create mode 100755 Source/DirectFB/lib/direct/build.h.in create mode 100755 Source/DirectFB/lib/direct/clock.c create mode 100755 Source/DirectFB/lib/direct/clock.h create mode 100755 Source/DirectFB/lib/direct/conf.c create mode 100755 Source/DirectFB/lib/direct/conf.h create mode 100755 Source/DirectFB/lib/direct/debug.c create mode 100755 Source/DirectFB/lib/direct/debug.h create mode 100755 Source/DirectFB/lib/direct/direct.c create mode 100755 Source/DirectFB/lib/direct/direct.h create mode 100755 Source/DirectFB/lib/direct/direct.pc.in create mode 100755 Source/DirectFB/lib/direct/fastlz.c create mode 100755 Source/DirectFB/lib/direct/fastlz.h create mode 100755 Source/DirectFB/lib/direct/flz.c create mode 100755 Source/DirectFB/lib/direct/flz.h create mode 100755 Source/DirectFB/lib/direct/hash.c create mode 100755 Source/DirectFB/lib/direct/hash.h create mode 100755 Source/DirectFB/lib/direct/interface.c create mode 100755 Source/DirectFB/lib/direct/interface.h create mode 100755 Source/DirectFB/lib/direct/interface_implementation.h create mode 100755 Source/DirectFB/lib/direct/list.c create mode 100755 Source/DirectFB/lib/direct/list.h create mode 100755 Source/DirectFB/lib/direct/log.c create mode 100755 Source/DirectFB/lib/direct/log.h create mode 100755 Source/DirectFB/lib/direct/mem.c create mode 100755 Source/DirectFB/lib/direct/mem.h create mode 100755 Source/DirectFB/lib/direct/memcpy.c create mode 100755 Source/DirectFB/lib/direct/memcpy.h create mode 100755 Source/DirectFB/lib/direct/messages.c create mode 100755 Source/DirectFB/lib/direct/messages.h create mode 100755 Source/DirectFB/lib/direct/modules.c create mode 100755 Source/DirectFB/lib/direct/modules.h create mode 100755 Source/DirectFB/lib/direct/ppc_asm.h create mode 100755 Source/DirectFB/lib/direct/ppcasm_memcpy.S create mode 100755 Source/DirectFB/lib/direct/ppcasm_memcpy.h create mode 100755 Source/DirectFB/lib/direct/ppcasm_memcpy_cachable.S create mode 100755 Source/DirectFB/lib/direct/serial.h create mode 100755 Source/DirectFB/lib/direct/signals.c create mode 100755 Source/DirectFB/lib/direct/signals.h create mode 100755 Source/DirectFB/lib/direct/stream.c create mode 100755 Source/DirectFB/lib/direct/stream.h create mode 100755 Source/DirectFB/lib/direct/system.c create mode 100755 Source/DirectFB/lib/direct/system.h create mode 100755 Source/DirectFB/lib/direct/thread.c create mode 100755 Source/DirectFB/lib/direct/thread.h create mode 100755 Source/DirectFB/lib/direct/trace.c create mode 100755 Source/DirectFB/lib/direct/trace.h create mode 100755 Source/DirectFB/lib/direct/tree.c create mode 100755 Source/DirectFB/lib/direct/tree.h create mode 100755 Source/DirectFB/lib/direct/types.h create mode 100755 Source/DirectFB/lib/direct/utf8.c create mode 100755 Source/DirectFB/lib/direct/utf8.h create mode 100755 Source/DirectFB/lib/direct/util.c create mode 100755 Source/DirectFB/lib/direct/util.h create mode 100755 Source/DirectFB/lib/fusion/Makefile.am create mode 100755 Source/DirectFB/lib/fusion/Makefile.in create mode 100755 Source/DirectFB/lib/fusion/arena.c create mode 100755 Source/DirectFB/lib/fusion/arena.h create mode 100755 Source/DirectFB/lib/fusion/build.h.in create mode 100755 Source/DirectFB/lib/fusion/call.c create mode 100755 Source/DirectFB/lib/fusion/call.h create mode 100755 Source/DirectFB/lib/fusion/conf.c create mode 100755 Source/DirectFB/lib/fusion/conf.h create mode 100755 Source/DirectFB/lib/fusion/fusion.c create mode 100755 Source/DirectFB/lib/fusion/fusion.h create mode 100755 Source/DirectFB/lib/fusion/fusion.pc.in create mode 100755 Source/DirectFB/lib/fusion/fusion_internal.h create mode 100755 Source/DirectFB/lib/fusion/hash.c create mode 100755 Source/DirectFB/lib/fusion/hash.h create mode 100755 Source/DirectFB/lib/fusion/lock.c create mode 100755 Source/DirectFB/lib/fusion/lock.h create mode 100755 Source/DirectFB/lib/fusion/object.c create mode 100755 Source/DirectFB/lib/fusion/object.h create mode 100755 Source/DirectFB/lib/fusion/property.c create mode 100755 Source/DirectFB/lib/fusion/property.h create mode 100755 Source/DirectFB/lib/fusion/protocol.h create mode 100755 Source/DirectFB/lib/fusion/reactor.c create mode 100755 Source/DirectFB/lib/fusion/reactor.h create mode 100755 Source/DirectFB/lib/fusion/ref.c create mode 100755 Source/DirectFB/lib/fusion/ref.h create mode 100755 Source/DirectFB/lib/fusion/shm/Makefile.am create mode 100755 Source/DirectFB/lib/fusion/shm/Makefile.in create mode 100755 Source/DirectFB/lib/fusion/shm/fake.c create mode 100755 Source/DirectFB/lib/fusion/shm/heap.c create mode 100755 Source/DirectFB/lib/fusion/shm/pool.c create mode 100755 Source/DirectFB/lib/fusion/shm/pool.h create mode 100755 Source/DirectFB/lib/fusion/shm/shm.c create mode 100755 Source/DirectFB/lib/fusion/shm/shm.h create mode 100755 Source/DirectFB/lib/fusion/shm/shm_internal.h create mode 100755 Source/DirectFB/lib/fusion/shmalloc.c create mode 100755 Source/DirectFB/lib/fusion/shmalloc.h create mode 100755 Source/DirectFB/lib/fusion/types.h create mode 100755 Source/DirectFB/lib/fusion/vector.c create mode 100755 Source/DirectFB/lib/fusion/vector.h create mode 100755 Source/DirectFB/lib/voodoo/Makefile.am create mode 100755 Source/DirectFB/lib/voodoo/Makefile.in create mode 100755 Source/DirectFB/lib/voodoo/app.h create mode 100755 Source/DirectFB/lib/voodoo/build.h.in create mode 100755 Source/DirectFB/lib/voodoo/client.c create mode 100755 Source/DirectFB/lib/voodoo/client.h create mode 100755 Source/DirectFB/lib/voodoo/compat.h create mode 100755 Source/DirectFB/lib/voodoo/conf.c create mode 100755 Source/DirectFB/lib/voodoo/conf.h create mode 100755 Source/DirectFB/lib/voodoo/connection.cpp create mode 100755 Source/DirectFB/lib/voodoo/connection.h create mode 100755 Source/DirectFB/lib/voodoo/connection_link.cpp create mode 100755 Source/DirectFB/lib/voodoo/connection_link.h create mode 100755 Source/DirectFB/lib/voodoo/connection_packet.cpp create mode 100755 Source/DirectFB/lib/voodoo/connection_packet.h create mode 100755 Source/DirectFB/lib/voodoo/connection_packet_old.cpp create mode 100755 Source/DirectFB/lib/voodoo/connection_packet_old.h create mode 100755 Source/DirectFB/lib/voodoo/connection_raw.cpp create mode 100755 Source/DirectFB/lib/voodoo/connection_raw.h create mode 100755 Source/DirectFB/lib/voodoo/dispatcher.cpp create mode 100755 Source/DirectFB/lib/voodoo/dispatcher.h create mode 100755 Source/DirectFB/lib/voodoo/instance.cpp create mode 100755 Source/DirectFB/lib/voodoo/instance.h create mode 100755 Source/DirectFB/lib/voodoo/interface.c create mode 100755 Source/DirectFB/lib/voodoo/interface.h create mode 100755 Source/DirectFB/lib/voodoo/internal.h create mode 100755 Source/DirectFB/lib/voodoo/ivoodooplayer.c create mode 100755 Source/DirectFB/lib/voodoo/ivoodooplayer.h create mode 100755 Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.c create mode 100755 Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.h create mode 100755 Source/DirectFB/lib/voodoo/ivoodooplayer_requestor.c create mode 100755 Source/DirectFB/lib/voodoo/link.h create mode 100755 Source/DirectFB/lib/voodoo/manager.cpp create mode 100755 Source/DirectFB/lib/voodoo/manager.h create mode 100755 Source/DirectFB/lib/voodoo/manager_c.cpp create mode 100755 Source/DirectFB/lib/voodoo/message.h create mode 100755 Source/DirectFB/lib/voodoo/mutex.c create mode 100755 Source/DirectFB/lib/voodoo/mutex.h create mode 100755 Source/DirectFB/lib/voodoo/packet.h create mode 100755 Source/DirectFB/lib/voodoo/play.c create mode 100755 Source/DirectFB/lib/voodoo/play.h create mode 100755 Source/DirectFB/lib/voodoo/play_internal.h create mode 100755 Source/DirectFB/lib/voodoo/play_server.c create mode 100755 Source/DirectFB/lib/voodoo/play_server.h create mode 100755 Source/DirectFB/lib/voodoo/server.c create mode 100755 Source/DirectFB/lib/voodoo/server.h create mode 100755 Source/DirectFB/lib/voodoo/types.h create mode 100755 Source/DirectFB/lib/voodoo/unix/interfaces_unix.c create mode 100755 Source/DirectFB/lib/voodoo/unix/link_unix.c create mode 100755 Source/DirectFB/lib/voodoo/unix/link_unix_1408limit.c create mode 100755 Source/DirectFB/lib/voodoo/voodoo.pc.in create mode 100755 Source/DirectFB/lib/voodoo/waitqueue.h create mode 100755 Source/DirectFB/ltmain.sh create mode 100755 Source/DirectFB/m4/as-ac-expand.m4 create mode 100755 Source/DirectFB/missing create mode 100755 Source/DirectFB/patches/Makefile.am create mode 100755 Source/DirectFB/patches/Makefile.in create mode 100755 Source/DirectFB/patches/README.davincifb create mode 100755 Source/DirectFB/patches/README.fusion create mode 100755 Source/DirectFB/patches/README.matroxfb-vsync-irq-patch create mode 100755 Source/DirectFB/patches/README.savagefb create mode 100755 Source/DirectFB/patches/davincifb-triple-osd0-2.6.10.patch.bz2 create mode 100755 Source/DirectFB/patches/matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2 create mode 100755 Source/DirectFB/patches/matroxfb-g400-clock-2.4.22.patch.bz2 create mode 100755 Source/DirectFB/patches/matroxfb-vsync-irq-2.4.20.patch.bz2 create mode 100755 Source/DirectFB/patches/matroxfb-vsync-irq-2.4.21-pre6.patch.bz2 create mode 100755 Source/DirectFB/patches/savagefb-0.3.2-linux-2.4.26.patch.bz2 create mode 100755 Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.19.patch.bz2 create mode 100755 Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2 create mode 100755 Source/DirectFB/patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2 create mode 100755 Source/DirectFB/proxy/Makefile.am create mode 100755 Source/DirectFB/proxy/Makefile.in create mode 100755 Source/DirectFB/proxy/dispatcher/Makefile.am create mode 100755 Source/DirectFB/proxy/dispatcher/Makefile.in create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.h create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.c create mode 100755 Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.h create mode 100755 Source/DirectFB/proxy/requestor/Makefile.am create mode 100755 Source/DirectFB/proxy/requestor/Makefile.in create mode 100755 Source/DirectFB/proxy/requestor/idirectfb_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbdatabuffer_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbfont_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbfont_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbimageprovider_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbscreen_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.h create mode 100755 Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.c create mode 100755 Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.h create mode 100755 Source/DirectFB/rules/Makefile.am create mode 100755 Source/DirectFB/rules/Makefile.in create mode 100755 Source/DirectFB/rules/libobject.make create mode 100755 Source/DirectFB/rules/nmfile.make create mode 100755 Source/DirectFB/src/Makefile.am create mode 100755 Source/DirectFB/src/Makefile.in create mode 100755 Source/DirectFB/src/core/Makefile.am create mode 100755 Source/DirectFB/src/core/Makefile.in create mode 100755 Source/DirectFB/src/core/clipboard.c create mode 100755 Source/DirectFB/src/core/clipboard.h create mode 100755 Source/DirectFB/src/core/colorhash.c create mode 100755 Source/DirectFB/src/core/colorhash.h create mode 100755 Source/DirectFB/src/core/core.c create mode 100755 Source/DirectFB/src/core/core.h create mode 100755 Source/DirectFB/src/core/core_parts.c create mode 100755 Source/DirectFB/src/core/core_parts.h create mode 100755 Source/DirectFB/src/core/core_system.h create mode 100755 Source/DirectFB/src/core/coredefs.h create mode 100755 Source/DirectFB/src/core/coretypes.h create mode 100755 Source/DirectFB/src/core/fonts.c create mode 100755 Source/DirectFB/src/core/fonts.h create mode 100755 Source/DirectFB/src/core/gfxcard.c create mode 100755 Source/DirectFB/src/core/gfxcard.h create mode 100755 Source/DirectFB/src/core/graphics_driver.h create mode 100755 Source/DirectFB/src/core/input.c create mode 100755 Source/DirectFB/src/core/input.h create mode 100755 Source/DirectFB/src/core/input_driver.h create mode 100755 Source/DirectFB/src/core/layer_context.c create mode 100755 Source/DirectFB/src/core/layer_context.h create mode 100755 Source/DirectFB/src/core/layer_control.c create mode 100755 Source/DirectFB/src/core/layer_control.h create mode 100755 Source/DirectFB/src/core/layer_region.c create mode 100755 Source/DirectFB/src/core/layer_region.h create mode 100755 Source/DirectFB/src/core/layers.c create mode 100755 Source/DirectFB/src/core/layers.h create mode 100755 Source/DirectFB/src/core/layers_internal.h create mode 100755 Source/DirectFB/src/core/local_surface_pool.c create mode 100755 Source/DirectFB/src/core/palette.c create mode 100755 Source/DirectFB/src/core/palette.h create mode 100755 Source/DirectFB/src/core/prealloc_surface_pool.c create mode 100755 Source/DirectFB/src/core/screen.c create mode 100755 Source/DirectFB/src/core/screen.h create mode 100755 Source/DirectFB/src/core/screens.c create mode 100755 Source/DirectFB/src/core/screens.h create mode 100755 Source/DirectFB/src/core/screens_internal.h create mode 100755 Source/DirectFB/src/core/shared_surface_pool.c create mode 100755 Source/DirectFB/src/core/state.c create mode 100755 Source/DirectFB/src/core/state.h create mode 100755 Source/DirectFB/src/core/surface.c create mode 100755 Source/DirectFB/src/core/surface.h create mode 100755 Source/DirectFB/src/core/surface_buffer.c create mode 100755 Source/DirectFB/src/core/surface_buffer.h create mode 100755 Source/DirectFB/src/core/surface_core.c create mode 100755 Source/DirectFB/src/core/surface_pool.c create mode 100755 Source/DirectFB/src/core/surface_pool.h create mode 100755 Source/DirectFB/src/core/surface_pool_bridge.c create mode 100755 Source/DirectFB/src/core/surface_pool_bridge.h create mode 100755 Source/DirectFB/src/core/system.c create mode 100755 Source/DirectFB/src/core/system.h create mode 100755 Source/DirectFB/src/core/windows.c create mode 100755 Source/DirectFB/src/core/windows.h create mode 100755 Source/DirectFB/src/core/windows_internal.h create mode 100755 Source/DirectFB/src/core/windowstack.c create mode 100755 Source/DirectFB/src/core/windowstack.h create mode 100755 Source/DirectFB/src/core/wm.c create mode 100755 Source/DirectFB/src/core/wm.h create mode 100755 Source/DirectFB/src/core/wm_module.h create mode 100755 Source/DirectFB/src/directfb.c create mode 100755 Source/DirectFB/src/display/Makefile.am create mode 100755 Source/DirectFB/src/display/Makefile.in create mode 100755 Source/DirectFB/src/display/idirectfbdisplaylayer.c create mode 100755 Source/DirectFB/src/display/idirectfbdisplaylayer.h create mode 100755 Source/DirectFB/src/display/idirectfbpalette.c create mode 100755 Source/DirectFB/src/display/idirectfbpalette.h create mode 100755 Source/DirectFB/src/display/idirectfbscreen.c create mode 100755 Source/DirectFB/src/display/idirectfbscreen.h create mode 100755 Source/DirectFB/src/display/idirectfbsurface.c create mode 100755 Source/DirectFB/src/display/idirectfbsurface.h create mode 100755 Source/DirectFB/src/display/idirectfbsurface_layer.c create mode 100755 Source/DirectFB/src/display/idirectfbsurface_layer.h create mode 100755 Source/DirectFB/src/display/idirectfbsurface_window.c create mode 100755 Source/DirectFB/src/display/idirectfbsurface_window.h create mode 100755 Source/DirectFB/src/gfx/Makefile.am create mode 100755 Source/DirectFB/src/gfx/Makefile.in create mode 100755 Source/DirectFB/src/gfx/clip.c create mode 100755 Source/DirectFB/src/gfx/clip.h create mode 100755 Source/DirectFB/src/gfx/convert.c create mode 100755 Source/DirectFB/src/gfx/convert.h create mode 100755 Source/DirectFB/src/gfx/generic/Makefile.am create mode 100755 Source/DirectFB/src/gfx/generic/Makefile.in create mode 100755 Source/DirectFB/src/gfx/generic/duffs_device.h create mode 100755 Source/DirectFB/src/gfx/generic/generic.c create mode 100755 Source/DirectFB/src/gfx/generic/generic.h create mode 100755 Source/DirectFB/src/gfx/generic/generic_64.h create mode 100755 Source/DirectFB/src/gfx/generic/generic_dummy.c create mode 100755 Source/DirectFB/src/gfx/generic/generic_mmx.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_hvx_16.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_hvx_32.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_hvx_8.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_hvx_88.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_hvx_N.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_16.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_32.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_32_indexed.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_8.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_88.h create mode 100755 Source/DirectFB/src/gfx/generic/stretch_up_down_table.h create mode 100755 Source/DirectFB/src/gfx/generic/template_acc_16.h create mode 100755 Source/DirectFB/src/gfx/generic/template_acc_32.h create mode 100755 Source/DirectFB/src/gfx/generic/template_colorkey_16.h create mode 100755 Source/DirectFB/src/gfx/generic/template_colorkey_32.h create mode 100755 Source/DirectFB/src/gfx/generic/yuvtbl-gen.c create mode 100755 Source/DirectFB/src/gfx/generic/yuvtbl.h create mode 100755 Source/DirectFB/src/gfx/util.c create mode 100755 Source/DirectFB/src/gfx/util.h create mode 100755 Source/DirectFB/src/idirectfb.c create mode 100755 Source/DirectFB/src/idirectfb.h create mode 100755 Source/DirectFB/src/input/Makefile.am create mode 100755 Source/DirectFB/src/input/Makefile.in create mode 100755 Source/DirectFB/src/input/idirectfbinputbuffer.c create mode 100755 Source/DirectFB/src/input/idirectfbinputbuffer.h create mode 100755 Source/DirectFB/src/input/idirectfbinputdevice.c create mode 100755 Source/DirectFB/src/input/idirectfbinputdevice.h create mode 100755 Source/DirectFB/src/media/Makefile.am create mode 100755 Source/DirectFB/src/media/Makefile.in create mode 100755 Source/DirectFB/src/media/idirectfbdatabuffer.c create mode 100755 Source/DirectFB/src/media/idirectfbdatabuffer.h create mode 100755 Source/DirectFB/src/media/idirectfbdatabuffer_file.c create mode 100755 Source/DirectFB/src/media/idirectfbdatabuffer_memory.c create mode 100755 Source/DirectFB/src/media/idirectfbdatabuffer_streamed.c create mode 100755 Source/DirectFB/src/media/idirectfbfont.c create mode 100755 Source/DirectFB/src/media/idirectfbfont.h create mode 100755 Source/DirectFB/src/media/idirectfbimageprovider.c create mode 100755 Source/DirectFB/src/media/idirectfbimageprovider.h create mode 100755 Source/DirectFB/src/media/idirectfbvideoprovider.c create mode 100755 Source/DirectFB/src/media/idirectfbvideoprovider.h create mode 100755 Source/DirectFB/src/misc/Makefile.am create mode 100755 Source/DirectFB/src/misc/Makefile.in create mode 100755 Source/DirectFB/src/misc/conf.c create mode 100755 Source/DirectFB/src/misc/conf.h create mode 100755 Source/DirectFB/src/misc/dither565.h create mode 100755 Source/DirectFB/src/misc/gfx_util.c create mode 100755 Source/DirectFB/src/misc/gfx_util.h create mode 100755 Source/DirectFB/src/misc/util.c create mode 100755 Source/DirectFB/src/misc/util.h create mode 100755 Source/DirectFB/src/windows/Makefile.am create mode 100755 Source/DirectFB/src/windows/Makefile.in create mode 100755 Source/DirectFB/src/windows/idirectfbwindow.c create mode 100755 Source/DirectFB/src/windows/idirectfbwindow.h create mode 100755 Source/DirectFB/systems/Makefile.am create mode 100755 Source/DirectFB/systems/Makefile.in create mode 100755 Source/DirectFB/systems/devmem/Makefile.am create mode 100755 Source/DirectFB/systems/devmem/Makefile.in create mode 100755 Source/DirectFB/systems/devmem/devmem.c create mode 100755 Source/DirectFB/systems/devmem/devmem.h create mode 100755 Source/DirectFB/systems/devmem/devmem_surface_pool.c create mode 100755 Source/DirectFB/systems/devmem/surfacemanager.c create mode 100755 Source/DirectFB/systems/devmem/surfacemanager.h create mode 100755 Source/DirectFB/systems/fbdev/Makefile.am create mode 100755 Source/DirectFB/systems/fbdev/Makefile.in create mode 100755 Source/DirectFB/systems/fbdev/agp.c create mode 100755 Source/DirectFB/systems/fbdev/agp.h create mode 100755 Source/DirectFB/systems/fbdev/fb.h create mode 100755 Source/DirectFB/systems/fbdev/fbdev.c create mode 100755 Source/DirectFB/systems/fbdev/fbdev.h create mode 100755 Source/DirectFB/systems/fbdev/fbdev_surface_pool.c create mode 100755 Source/DirectFB/systems/fbdev/surfacemanager.c create mode 100755 Source/DirectFB/systems/fbdev/surfacemanager.h create mode 100755 Source/DirectFB/systems/fbdev/vt.c create mode 100755 Source/DirectFB/systems/fbdev/vt.h create mode 100755 Source/DirectFB/systems/osx/Makefile.am create mode 100755 Source/DirectFB/systems/osx/Makefile.in create mode 100755 Source/DirectFB/systems/osx/osx.c create mode 100755 Source/DirectFB/systems/osx/osx.h create mode 100755 Source/DirectFB/systems/osx/osxinput.c create mode 100755 Source/DirectFB/systems/osx/primary.c create mode 100755 Source/DirectFB/systems/osx/primary.h create mode 100755 Source/DirectFB/systems/sdl/Makefile.am create mode 100755 Source/DirectFB/systems/sdl/Makefile.in create mode 100755 Source/DirectFB/systems/sdl/primary.c create mode 100755 Source/DirectFB/systems/sdl/primary.h create mode 100755 Source/DirectFB/systems/sdl/sdl.c create mode 100755 Source/DirectFB/systems/sdl/sdl.h create mode 100755 Source/DirectFB/systems/sdl/sdl_surface_pool.c create mode 100755 Source/DirectFB/systems/sdl/sdlgfx.c create mode 100755 Source/DirectFB/systems/sdl/sdlinput.c create mode 100755 Source/DirectFB/systems/vnc/Makefile.am create mode 100755 Source/DirectFB/systems/vnc/Makefile.in create mode 100755 Source/DirectFB/systems/vnc/primary.c create mode 100755 Source/DirectFB/systems/vnc/primary.h create mode 100755 Source/DirectFB/systems/vnc/vnc.c create mode 100755 Source/DirectFB/systems/vnc/vnc.h create mode 100755 Source/DirectFB/systems/vnc/vncinput.c create mode 100755 Source/DirectFB/systems/x11/Makefile.am create mode 100755 Source/DirectFB/systems/x11/Makefile.in create mode 100755 Source/DirectFB/systems/x11/README create mode 100755 Source/DirectFB/systems/x11/glx_surface_pool.c create mode 100755 Source/DirectFB/systems/x11/glx_surface_pool.h create mode 100755 Source/DirectFB/systems/x11/primary.c create mode 100755 Source/DirectFB/systems/x11/primary.h create mode 100755 Source/DirectFB/systems/x11/surfacemanager.c create mode 100755 Source/DirectFB/systems/x11/surfacemanager.h create mode 100755 Source/DirectFB/systems/x11/vpsmem_surface_pool.c create mode 100755 Source/DirectFB/systems/x11/vpsmem_surface_pool.h create mode 100755 Source/DirectFB/systems/x11/x11.c create mode 100755 Source/DirectFB/systems/x11/x11.h create mode 100755 Source/DirectFB/systems/x11/x11_surface_pool.c create mode 100755 Source/DirectFB/systems/x11/x11_surface_pool.h create mode 100755 Source/DirectFB/systems/x11/x11_surface_pool_bridge.c create mode 100755 Source/DirectFB/systems/x11/x11_surface_pool_bridge.h create mode 100755 Source/DirectFB/systems/x11/x11image.c create mode 100755 Source/DirectFB/systems/x11/x11image.h create mode 100755 Source/DirectFB/systems/x11/x11input.c create mode 100755 Source/DirectFB/systems/x11/x11types.h create mode 100755 Source/DirectFB/systems/x11/xwindow.c create mode 100755 Source/DirectFB/systems/x11/xwindow.h create mode 100755 Source/DirectFB/tests/Makefile.am create mode 100755 Source/DirectFB/tests/Makefile.in create mode 100755 Source/DirectFB/tests/dfbtest_blit.c create mode 100755 Source/DirectFB/tests/dfbtest_font.c create mode 100755 Source/DirectFB/tests/dfbtest_reinit.c create mode 100755 Source/DirectFB/tests/dfbtest_scale.c create mode 100755 Source/DirectFB/tests/dfbtest_window.c create mode 100755 Source/DirectFB/tests/dfbtest_windows_watcher.c create mode 100755 Source/DirectFB/tests/dfbtest_write.c create mode 100755 Source/DirectFB/tests/direct_stream.c create mode 100755 Source/DirectFB/tests/direct_test.c create mode 100755 Source/DirectFB/tests/fusion_fork.c create mode 100755 Source/DirectFB/tests/fusion_reactor.c create mode 100755 Source/DirectFB/tests/fusion_skirmish.c create mode 100755 Source/DirectFB/tests/fusion_stream.c create mode 100755 Source/DirectFB/tests/smiley_test.c create mode 100755 Source/DirectFB/tools/Makefile.am create mode 100755 Source/DirectFB/tools/Makefile.in create mode 100755 Source/DirectFB/tools/README create mode 100755 Source/DirectFB/tools/application.lst create mode 100755 Source/DirectFB/tools/dfbdump.c create mode 100755 Source/DirectFB/tools/dfbfx.c create mode 100755 Source/DirectFB/tools/dfbg.c create mode 100755 Source/DirectFB/tools/dfbinfo.c create mode 100755 Source/DirectFB/tools/dfbinput.c create mode 100755 Source/DirectFB/tools/dfbinspector.c create mode 100755 Source/DirectFB/tools/dfblayer.c create mode 100755 Source/DirectFB/tools/dfbmaster.c create mode 100755 Source/DirectFB/tools/dfbpenmount.c create mode 100755 Source/DirectFB/tools/dfbproxy.c create mode 100755 Source/DirectFB/tools/dfbscreen.c create mode 100755 Source/DirectFB/tools/directfb-csource.c create mode 100755 Source/DirectFB/tools/fusion_bench.c create mode 100755 Source/DirectFB/tools/gendoc.pl create mode 100755 Source/DirectFB/tools/mkdfiff.c create mode 100755 Source/DirectFB/tools/mkdgiff.c create mode 100755 Source/DirectFB/tools/mkdgifft.cpp create mode 100755 Source/DirectFB/tools/mknames.sh create mode 100755 Source/DirectFB/tools/raw15toraw24.c create mode 100755 Source/DirectFB/tools/raw16toraw24.c create mode 100755 Source/DirectFB/tools/raw32toraw24.c create mode 100755 Source/DirectFB/tools/voodooplay.c create mode 100755 Source/DirectFB/tools/voodooplay_client.c create mode 100755 Source/DirectFB/tools/voodooplay_server.c create mode 100755 Source/DirectFB/wm/Makefile.am create mode 100755 Source/DirectFB/wm/Makefile.in create mode 100755 Source/DirectFB/wm/default/Makefile.am create mode 100755 Source/DirectFB/wm/default/Makefile.in create mode 100755 Source/DirectFB/wm/default/default.c create mode 100755 Source/DirectFB/wm/unique/Makefile.am create mode 100755 Source/DirectFB/wm/unique/Makefile.in create mode 100755 Source/DirectFB/wm/unique/classes/Makefile.am create mode 100755 Source/DirectFB/wm/unique/classes/Makefile.in create mode 100755 Source/DirectFB/wm/unique/classes/foo.c create mode 100755 Source/DirectFB/wm/unique/classes/frame.c create mode 100755 Source/DirectFB/wm/unique/classes/root.c create mode 100755 Source/DirectFB/wm/unique/classes/window.c create mode 100755 Source/DirectFB/wm/unique/context.c create mode 100755 Source/DirectFB/wm/unique/context.h create mode 100755 Source/DirectFB/wm/unique/data/Makefile.am create mode 100755 Source/DirectFB/wm/unique/data/Makefile.in create mode 100755 Source/DirectFB/wm/unique/data/foo_e.png create mode 100755 Source/DirectFB/wm/unique/data/foo_n.png create mode 100755 Source/DirectFB/wm/unique/data/foo_ne.png create mode 100755 Source/DirectFB/wm/unique/data/foo_nw.png create mode 100755 Source/DirectFB/wm/unique/data/foo_s.png create mode 100755 Source/DirectFB/wm/unique/data/foo_se.png create mode 100755 Source/DirectFB/wm/unique/data/foo_sw.png create mode 100755 Source/DirectFB/wm/unique/data/foo_w.png create mode 100755 Source/DirectFB/wm/unique/decoration.c create mode 100755 Source/DirectFB/wm/unique/decoration.h create mode 100755 Source/DirectFB/wm/unique/device.c create mode 100755 Source/DirectFB/wm/unique/device.h create mode 100755 Source/DirectFB/wm/unique/devices/Makefile.am create mode 100755 Source/DirectFB/wm/unique/devices/Makefile.in create mode 100755 Source/DirectFB/wm/unique/devices/keyboard.c create mode 100755 Source/DirectFB/wm/unique/devices/pointer.c create mode 100755 Source/DirectFB/wm/unique/devices/wheel.c create mode 100755 Source/DirectFB/wm/unique/input_channel.c create mode 100755 Source/DirectFB/wm/unique/input_channel.h create mode 100755 Source/DirectFB/wm/unique/input_events.h create mode 100755 Source/DirectFB/wm/unique/input_switch.c create mode 100755 Source/DirectFB/wm/unique/input_switch.h create mode 100755 Source/DirectFB/wm/unique/internal.h create mode 100755 Source/DirectFB/wm/unique/stret.c create mode 100755 Source/DirectFB/wm/unique/stret.h create mode 100755 Source/DirectFB/wm/unique/stret_iteration.c create mode 100755 Source/DirectFB/wm/unique/stret_iteration.h create mode 100755 Source/DirectFB/wm/unique/stret_test.c create mode 100755 Source/DirectFB/wm/unique/test_color.c create mode 100755 Source/DirectFB/wm/unique/test_foo.c create mode 100755 Source/DirectFB/wm/unique/types.h create mode 100755 Source/DirectFB/wm/unique/unique.c create mode 100755 Source/DirectFB/wm/unique/uniquewm.c create mode 100755 Source/DirectFB/wm/unique/uniquewm.h create mode 100755 Source/DirectFB/wm/unique/uwmdump.c create mode 100755 Source/DirectFB/wm/unique/window.c create mode 100755 Source/DirectFB/wm/unique/window.h (limited to 'Source/DirectFB') diff --git a/Source/DirectFB/AUTHORS b/Source/DirectFB/AUTHORS new file mode 100755 index 0000000..8771007 --- /dev/null +++ b/Source/DirectFB/AUTHORS @@ -0,0 +1,29 @@ +Main Developers +--------------- + +Denis Oliver Kropp +Andreas Hundt +Sven Neumann +Ville Syrjälä +Claudio Ciccani + + +Helping Developers +------------------ + +Andreas Robinson (CLE266 gfx driver) +Daniel Foesch (nVidia gfx driver) +Michel Dänzer (Radeon gfx driver) +Vadim Catana (Radeon overlay support) +Sarma Kolluru (NSC Geode gfx driver) +Oliver Schwartz (nVidia gfx driver) +Alex Song (Savage gfx driver) +Simon Ueng (MuTouch Touchscreen driver) +Holger Wächtler (Linux Input driver) +David Wood (Voodoo gfx driver) +Liam Girdwood (WM97xx Touchscreen driver) +Brandon M. Reynolds (ELO Touchscreen driver) +Andreas Oberritter (SiS 315 gfx driver) +Nathanael D. Noblet (Gunze Touchscreen driver) + +See also "Thanks To" section in README. diff --git a/Source/DirectFB/COPYING b/Source/DirectFB/COPYING new file mode 100755 index 0000000..223ede7 --- /dev/null +++ b/Source/DirectFB/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (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 + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/Source/DirectFB/ChangeLog b/Source/DirectFB/ChangeLog new file mode 100755 index 0000000..00482b7 --- /dev/null +++ b/Source/DirectFB/ChangeLog @@ -0,0 +1,37587 @@ +commit cd3e0306347ab0601ad1e6b98b0897aac2fb8942 +Merge: b4cf1e3... b29d791... +Author: Niels Roest +Date: Tue Jun 2 18:47:24 2009 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit b29d791b04000d0dd1d46331fcf6bce1802937ef +Author: Sven Neumann +Date: Fri May 29 17:37:01 2009 +0200 + + updated copyright in source files + + Changed the DirectFB Open Source Community copyright from 2001-2008 to + 2001-2009 all over the place. + +commit 15b303d8946250d424b596565507dce081bfba23 +Author: Denis Oliver Kropp +Date: Thu May 28 08:37:03 2009 +0200 + + [fbdev] Allow accelerator id to be overridden by runtime option, print some info during init. + +commit b4cf1e38969bb931e24592d4098d5bc2552d63f1 +Author: Niels Roest +Date: Mon May 25 14:20:16 2009 +0200 + + [layer] Bug when switching source from surface to surfaceless (video). + The bug is caused by the destruction of the region surface before + the active buffer is unlocked (lock being held by layer). + Thanks to Sorin Otescu for the patch. + +commit 9df11d6795de316b3bf8a8e014095549b5a0a822 +Author: Niels Roest +Date: Mon May 25 14:09:09 2009 +0200 + + [build] fix for commit 5a941ac479883bef11bd9ada65b07fafafff2ad1 + INCLUDES were in the wrong order. Thanks Andre. + +commit 95c1ed2a6afa5eee838378dcc9557ce975ab54ff +Author: Niels Roest +Date: Mon May 25 12:14:00 2009 +0200 + + [surfaces] Clean up after failed pool init to keep the memory consistent; + consistency is required by ASSERTs. Thanks to Andre Draszik. + +commit 68ff8b08292622c8b0d65812858898ebb121b47d +Author: Sven Neumann +Date: Fri May 22 09:30:45 2009 +0200 + + Removed const qualifier from destination pointer + + The recently introduced IDirectFBSurface::Read method had a const + qualifier for the pointer to the destination memory. Removed this + qualifier as the method writes to this memory. + +commit 689a97a85fa0c79c1ab2ff60803d950506d346de +Author: Ville Syrjala +Date: Sat May 16 00:31:45 2009 +0300 + + layers: Prevent deadlock when destroying context + + A deadlock can happen between the input device shared reactor global + lock and the layer context lock if the layer context destruction and + input even processing happen at the same time since the code paths + acquire the locks in different order. Fix the problem by detaching the + input devices from the windowstack before taking the layer context lock + in the context destruction path. Nothing ever modifies the + windowstack's device list so AFAICS it should be safe to do this + without holding the layer context lock. + + This is a backtrace of the deadlock: + + Thread 13 (Thread 0x436a7950 (LWP 6158)): + 0 0x00007f23b8125117 in ioctl () from /lib/libc.so.6 + 1 0x00007f23b95982ee in fusion_skirmish_prevail () + from /usr/local/lib/libfusion-1.3.so.0 + 2 0x00007f23b9846604 in dfb_layer_context_lock () + from /usr/local/lib/libdirectfb-1.3.so.0 + 3 0x00007f23b985690e in _dfb_windowstack_inputdevice_listener () + from /usr/local/lib/libdirectfb-1.3.so.0 + 4 0x00007f23b959a12c in fusion_reactor_dispatch_channel () + from /usr/local/lib/libfusion-1.3.so.0 + 5 0x00007f23b9843dff in dfb_input_dispatch () + from /usr/local/lib/libdirectfb-1.3.so.0 + 6 0x00007f23b5a4b1f6 in linux_input_EventThread () + from /usr/local/lib/directfb-1.3-0/inputdrivers/libdirectfb_linux_input.so + 7 0x00007f23b9387ec6 in direct_thread_main () + from /usr/local/lib/libdirect-1.3.so.0 + 8 0x00007f23b904e087 in start_thread () from /lib/libpthread.so.0 + 9 0x00007f23b812bccd in clone () from /lib/libc.so.6 + 10 0x0000000000000000 in ?? () + + Thread 18 (Thread 0x40832950 (LWP 6153)): + 0 0x00007f23b8125117 in ioctl () from /lib/libc.so.6 + 1 0x00007f23b95982ee in fusion_skirmish_prevail () + from /usr/local/lib/libfusion-1.3.so.0 + 2 0x00007f23b959944a in fusion_reactor_detach_global () + from /usr/local/lib/libfusion-1.3.so.0 + 3 0x00007f23b98574cd in dfb_windowstack_destroy () + from /usr/local/lib/libdirectfb-1.3.so.0 + 4 0x00007f23b98476f8 in context_destructor () + from /usr/local/lib/libdirectfb-1.3.so.0 + 5 0x00007f23b959900e in object_reference_watcher () + from /usr/local/lib/libfusion-1.3.so.0 + 6 0x00007f23b9595026 in _fusion_call_process () + from /usr/local/lib/libfusion-1.3.so.0 + 7 0x00007f23b9596d5a in fusion_dispatch_loop () + from /usr/local/lib/libfusion-1.3.so.0 + 8 0x00007f23b9387ec6 in direct_thread_main () + from /usr/local/lib/libdirect-1.3.so.0 + 9 0x00007f23b904e087 in start_thread () from /lib/libpthread.so.0 + 10 0x00007f23b812bccd in clone () from /lib/libc.so.6 + 11 0x0000000000000000 in ?? () + +commit 10c2bee93fa36b518de06be670669ce7c263c9a7 +Author: Sven Neumann +Date: Tue May 19 09:37:45 2009 +0200 + + core: added a const qualifier for the source buffer + +commit db6b85fd39a26714d173ac3e479688158fbd0e95 +Author: Ville Syrjala +Date: Mon May 18 02:29:35 2009 +0300 + + matrox: Fix BES single buffering + + Commit f94cc4934addfc80025d4fbc6a4f0b98042e6d8f introduced a problem + where SetRegion() would update the inactive set of buffer registers. + The problem was only really visible with single buffering since the + active registers were never updated as FlipRegion() was never called. + +commit adab4e0a39c096c1f5359c975c10856c7dc06324 +Author: Sven Neumann +Date: Fri May 15 09:38:40 2009 +0200 + + gfx: sprinkled the code with const qualifiers + + Add const qualifiers to the source pointers for all pixel-format + conversion functions. Also move some variables to local scope. + +commit 555970f9b6707790b9ec5697f542ca0ae75f6c50 +Author: Niels Roest +Date: Thu May 14 20:27:33 2009 +0200 + + [input] fix for shutdown crash reproducible with "splashy" boot screen + +commit 49baa1d479d3fe65b33d7db5d97de2ec15bc249c +Merge: b13d1a0... df22ef6... +Author: Niels Roest +Date: Thu May 14 20:25:38 2009 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit df22ef6e4fc5141461afaf46a6b61f7dc1d83a3b +Author: Sven Neumann +Date: Thu May 14 14:53:36 2009 +0200 + + Add defines for the RGB16 dithering methods + +commit 90fa8286cf22f6d91f29df8c92ea3f71758d9478 +Author: Sven Neumann +Date: Thu May 14 14:38:23 2009 +0200 + + tools: add --dither-rgb16 option to directfb-csource + +commit b13d1a0c4b0085fadbca3a1293118afacd202f02 +Author: Niels Roest +Date: Wed May 13 21:47:58 2009 +0200 + + [API] add NTSC-443 enum format; add some missing frequency enums. + +commit 4b2dfd572bb0ae8863f60d53c9d73c9da14dd5dc +Author: Niels Roest +Date: Wed May 13 21:46:31 2009 +0200 + + [jpeg] plug mem leak on file read error + +commit b794f110988652354a0f51d126b9b5b62249e217 +Author: Niels Roest +Date: Wed May 13 21:45:58 2009 +0200 + + [matrox] add #ifdef to prevent wrong asm on non-X86 build + +commit 5a941ac479883bef11bd9ada65b07fafafff2ad1 +Author: Niels Roest +Date: Wed May 13 21:45:28 2009 +0200 + + [build] add missing include path for builddir != srcdir + reshuffle makefiles to make changes easier and shorter + +commit 50aa399b878c4811d061e50b33e479ddd4401da0 +Author: Niels Roest +Date: Wed May 13 21:43:35 2009 +0200 + + [sis315] fix: allow a program to call both blit and stretchblit. + +commit b142a30140673eeffc6823da40cea6df76df19a5 +Author: Sven Neumann +Date: Tue May 12 18:12:42 2009 +0200 + + gfx: introduce optional dithering for RGB16 surfaces + + Introduce a configure switch to enable dithering when + rendering an image to a RGB16 surface. The pre-generated + dither matrices are taken from GdkRGB. + +commit cefa2171ff9c9122ce26821cba4c88c33fe58a6e +Author: Sven Neumann +Date: Tue May 12 15:27:20 2009 +0200 + + cosmetics + +commit c414dedf8dadacd489b35de2ff531d139ddea923 +Author: Sven Neumann +Date: Tue May 12 15:25:33 2009 +0200 + + cosmetics + +commit 8082fcb0a454f55ab5a8c82159047661a6e4b519 +Merge: b1f8ddb... 970c13c... +Author: Niels Roest +Date: Tue May 12 15:12:52 2009 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit b1f8ddbbca046fdd55ca02ab5e3fb86bacf2abd6 +Author: Niels Roest +Date: Tue May 12 15:12:40 2009 +0200 + + [build] compiler warning, debug message extended, include file order + +commit 970c13c54dcdb94dde9eca215ae914ccfb115d60 +Author: Sven Neumann +Date: Tue May 12 14:41:56 2009 +0200 + + Consistently use doubles to calculate the inverse scale factors + + Use of floats here triggered a bug in the gcc 4.3 soft-float code. Since + we are already using 1.0/scale in some places, it seems OK to make this + consistent. + +commit 97fd4ba6f39f890f6267960a50e796e581da14ee +Author: Sven Neumann +Date: Tue May 12 14:33:17 2009 +0200 + + cosmetics + +commit 1300cd4814b8e1691a5651ae447e84e5753efc24 +Author: Sven Neumann +Date: Tue May 12 11:46:54 2009 +0200 + + added more const qualifiers, moved variables into local scopes + +commit e0be70ec8aedde56f23d216530746a93e7746ff6 +Author: Ville Syrjala +Date: Tue May 12 04:16:57 2009 +0300 + + vt/keyboard: Flush console input when not used + + To keep the kernel happy the console buffer must be kept from filling + up. If the buffer is sufficiently full the kernel stop sleeping and + instead wakes up every tick to do something. This problem occurs when + the keyboard driver is not used and the linuxinput driver does not grab + the devices. Add a new thread whose job is to keep flushing the buffer + when the keyboard driver is not there to consume the data. + +commit a9edc19c0275527144cae7bd7ba9b66224924708 +Author: Ville Syrjala +Date: Sun May 10 01:23:46 2009 +0300 + + Silence some compiler warnings + +commit ffa522e63e4de0a999566821f3c17b78141cec86 +Author: Sven Neumann +Date: Fri May 8 17:00:26 2009 +0200 + + removed trailing whitespace + +commit bac0f25ce65795d63354d3ba3b9eded4a910351e +Author: Sven Neumann +Date: Fri May 8 16:55:42 2009 +0200 + + Sprinkled the code with const qualifiers + +commit 49e8ec67d124093a57492aecf5fbc65a6422a2be +Author: Sven Neumann +Date: Mon May 11 16:46:14 2009 +0200 + + font: introduce new font attribute DFFA_NOBITMAP + + Some truetype fonts include bitmap strikes for certain sizes. A new font + attribute is introduced to the DFBFontAttributes enum. It maps to + the FT_LOAD_NO_BITMAP attribute in the freetype2 renderer. This + tells the renderer to always provide an anti-aliased rendering, + ignoring bitmap strikes embedded in the font. For bitmap-only fonts this + flag is ignored. + +commit 153cbdcce3b1334f5fc74d87516edda1ad228103 +Author: Sven Neumann +Date: Mon May 11 16:44:21 2009 +0200 + + indentation cleanup + +commit f94cc4934addfc80025d4fbc6a4f0b98042e6d8f +Author: Ville Syrjala +Date: Tue May 5 22:09:13 2009 +0300 + + matrox: Improve BES triple buffering + + The BES has two sets of buffer registers and a status register which + can report the status which buffer is being displayed. besvcnt can be + used to make the buffer flip + status read atomic which allows + guaranteed tear free triple buffering. besvcnt can also be used to + make all other BES register updates atomic. + +commit 094540b0a6e493945fab560c737700948b70b07e +Author: Ville Syrjala +Date: Tue May 5 22:07:20 2009 +0300 + + surface: Fix back<->front swap + + Wrong back and front buffer indices were used when performing the + back<->front buffer swap which caused the the application render + into the wrong buffer. + +commit 32e49cdac7a18d9ac0195d50c19c58186acc88e1 +Author: Sven Neumann +Date: Thu May 7 21:27:13 2009 +0200 + + input: no need to set min and max for the touchpad, it doesn't deliver + absolute events; check that minimum or maximum is != 0 + +commit 6c9c5db93abc2ae6e93659af3e71a3dbdd460748 +Author: Sven Neumann +Date: Thu May 7 21:15:30 2009 +0200 + + git: don't ignore the m4 whole directory but only the files that libtool + adds there + +commit b0373d3f3b5f55be43d07f9d1b5b9cce51f65c6e +Author: Sven Neumann +Date: Thu May 7 17:26:32 2009 +0200 + + git: ignore the m4 directory + +commit ea1ee89c7a06605f4c9879040542eb42c3dd582e +Author: Sven Neumann +Date: Thu May 7 11:34:52 2009 +0200 + + input: Implement driver_get_axis_info() in the linux-input driver + +commit c6c28a529def38f174040f00018638cf82d4b8a2 +Author: Sven Neumann +Date: Fri May 1 09:49:18 2009 +0200 + + Makefile: include armasm_memcpy files in EXTRA_DIST + + Include the recently added optimized memcpy implementation for the ARM + platform in EXTRA_DIST so that the files end up in the release tarball. + +commit 338646f31ca2a5786454f02e17dc7b5adce137b9 +Author: Ville Syrjala +Date: Wed Apr 29 23:04:22 2009 +0300 + + modules: Don't touch the module entry after dlclose() + + When a module was unloaded with dlclose() the destructor function + (direct_modules_unregister() for the input drivers) was called. The + dtor freed the module entry but the code calling dlclose() proceeded to + fiddle with the already freed entry afterwards. Reorganize the code + slightly to avoid the problem and add a few comments to remind people + what may happen when dlclose() is called. + + The problem sometimes manifested itself as a segfault when loading the + modules. Suppressing all but the required input modules was an + effective workaround for the problem. + +commit 41ef7a58e47eaba0d35635a6031f10a31adb97d5 +Author: Ville Syrjala +Date: Wed Apr 29 03:09:07 2009 +0300 + + modules: Simplify the path string handling + + The code does unnecessary NULL checks which would have triggered an + assertion or segfault earlier. Also trying to avoid a few extra '/' + characters makes the code hard to read. Just make it simple. + +commit 2c9cca71b759af7e2bd124066b16f900e37dd4d0 +Author: Ville Syrjala +Date: Fri Nov 28 00:12:06 2008 +0200 + + modules: Add some error checking and assertions + +commit 5568eef87d2fdd15d2e331725eabb029671eef62 +Author: Ville Syrjala +Date: Fri Nov 28 00:11:52 2008 +0200 + + input: Check allocations + +commit 0a6ab4e7670baa225fbe89855279be6370ca210c +Author: Ville Syrjala +Date: Wed Apr 29 03:26:32 2009 +0300 + + configure: Remove a stray comma in summary output + +commit 9b69da8350463103a8216f1661c7e9cdea5d9898 +Author: Ville Syrjala +Date: Wed Apr 29 22:01:43 2009 +0300 + + gl: Link w/ -Wl,-no-undefined + +commit b6b6ebd0b805d2453e35e8941d09ab22fb6f8c81 +Author: Ville Syrjala +Date: Wed Apr 29 03:09:30 2009 +0300 + + Makefiles: s/-export-dynamic/-module + + Libtool's -export-dynamic option should be used when symbols from the + output file must be used to resolve undefined references. That is not + the case with our modules. Instead use the -module option which tells + libtool we're building a module that will be dlopened. + +commit b4df34ce12f0739ac6d9105d808d22d56ee07eeb +Author: Ville Syrjala +Date: Wed Apr 29 03:06:54 2009 +0300 + + elo: Silence a compiler warning + +commit 2803b16d3c853a76e50fc16c15fd195a5a78c620 +Author: Ville Syrjala +Date: Wed Apr 29 03:03:59 2009 +0300 + + mutouch/penmount/zytronic/sdl: Make the driver names match the file name + + It's a lot easier to use disable-module when you can just look at the + module file name instead of having to dig through the source code. + +commit 05f7d9ca0f240ba92a10bd727743e1fb0750bd66 +Author: Niels Roest +Date: Thu Apr 9 11:57:42 2009 +0200 + + [sis315] added support for: + XGI Z series chip, STRETCHBLIT, and big endian handling + Thanks to Yi-Lin Shieh for the patch + +commit 58e39b27fc7c7f3bb4aeabff9f2688b7ffdf3d0d +Author: Niels Roest +Date: Wed Apr 8 11:14:00 2009 +0200 + + [sis315] patch when blitting to y < 0 + Thanks to Yi-Lin Shieh for the patch + +commit 282a00d95b03a732c8375f28c2009a4b82c40b48 +Merge: 50482eb... 5b02825... +Author: Niels Roest +Date: Tue Apr 7 19:13:11 2009 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 50482eb3b7f2df314befbfd71e3f242cfb83b14a +Author: Niels Roest +Date: Tue Apr 7 19:12:57 2009 +0200 + + [voodoo] bug in DisableAcceleration causing ASSERT + thanks to Costa Michelakis for the fix. + +commit 5b028250d134dcd69ee192dc91297088eb78baa8 +Author: Nikita Egorov +Date: Mon Apr 6 12:27:23 2009 +0400 + + implemented three skipped 16-bit functions when rotation angle is not 0 + +commit 5e542f3f4b005cab15c4e7fff5c3e40022799720 +Author: Niels Roest +Date: Wed Apr 1 12:57:09 2009 +0200 + + [doc] rephrase + +commit 9239fd5c147772d2406ecff3d303509bef87e21e +Author: Niels Roest +Date: Tue Mar 31 19:40:33 2009 +0200 + + [release] DirectFB 1.3.1 + +commit 14f274b390072a7eec6a4fb8608fda901036d108 +Author: Niels Roest +Date: Tue Mar 31 11:27:07 2009 +0200 + + [surface] add Write/Read + +commit b76a683c6dcc8f9f06e8d179689c8105123ba708 +Author: Niels Roest +Date: Tue Mar 31 14:29:42 2009 +0200 + + [surfaces] local pool clean-up was too greedy; fixed + +commit dcc121eff4d04ee48b3fb4a5a73e1ac3ae9647b2 +Author: Niels Roest +Date: Mon Mar 30 20:22:53 2009 +0200 + + [fusion] changes for Fusion 0.8.1, forgotten this. + +commit 2ca169d55aed8a000dc2da574d1ad93e0e6b9984 +Author: Niels Roest +Date: Mon Mar 30 20:21:33 2009 +0200 + + [fbdev] corrected ioctl error handling: now stops on error. + +commit 6b110a50afe68d1aa21c44ea6e94496f0cb95228 +Author: Niels Roest +Date: Mon Mar 30 20:20:22 2009 +0200 + + [x11] additional logging and error detection, mainly for GLX handling. + +commit 73f9dec427de71282dccc25fa7760def5f86f3d9 +Author: Niels Roest +Date: Mon Mar 30 20:18:48 2009 +0200 + + [direct] include ARM memcpy routines (big endian only) + patch provided by Vince, thanks. + +commit e3710677b4ee2f3cb7a9d9b9ffc767175c57dfab +Author: Niels Roest +Date: Fri Mar 13 16:24:38 2009 +0100 + + [x11] fix crashes: + - glX context destroyed while still being accessed. + - avoid double free if XShm is not available: XCreateImage will call free(). + - also use "%s" to improve snprintf security. + +commit 3bd7289c5a136ab3ef420ad8b99fe6744352f24a +Author: Niels Roest +Date: Fri Mar 13 14:33:25 2009 +0100 + + [unichrome] support for accel stretchblit YUV->RGB for CX700/M/2. + Thanks to Deng XueFeng for sending in the patch. + +commit 74c58d4a8ac69f11b09fe7b84d8decf128687746 +Author: Niels Roest +Date: Fri Mar 13 14:29:00 2009 +0100 + + [core] support IDirectFBDisplayLayer::SetSourceRectangle + for non-scalable surfaces: change dst size to match source size. + documentation: extension and recitifactions. + Thanks to Timothy Strelchun for sending in these patches. + +commit e064e1e3b4bf4cc36e448f850c93a76f008dcbdb +Author: Niels Roest +Date: Thu Mar 12 22:07:20 2009 +0100 + + [conf] added 'include' option, to include config files. + This allows grouping configuration and enabling it with one line changed. + +commit 96bf5bddc2abcaf715476b38a06da6aed2ebfe7b +Author: Niels Roest +Date: Thu Mar 12 21:58:42 2009 +0100 + + [gfx] blending bug fixed in special cases. + + when using src, and when using and changing dst + a third intermediate buffer is needed: unchanged dst. + This is now added. + Slows down slightly certain non-default use cases due to extra copy: + blit blend-one, certain blit source colour keying cases. + +commit da8ee279cd4852b508a4e0f007f09777fcf47da4 +Author: Niels Roest +Date: Thu Mar 12 21:54:31 2009 +0100 + + [fusion] changes for Fusion 0.8.1 + +commit 2695ae0d5b7c0adab17dbaaa4eb82c508ae1332e +Author: Niels Roest +Date: Tue Jan 20 19:35:10 2009 +0100 + + [tools] dfbinfo: now shows multiple encoder types correctly + +commit 5dd30e68aa330bea5598ba2eea0344517ce38c3e +Author: Niels Roest +Date: Mon Jan 19 17:42:42 2009 +0100 + + [zytronic] compiler complaint: changed function order, fix in debug print. + +commit d9b6eb619fbb490006a9d983cb81c5d0734fd29d +Author: Niels Roest +Date: Mon Jan 19 16:14:11 2009 +0100 + + [surfaces] clean-up local pool on 'leave' and 'destroy' + Fixes issue when deallocates are initiated too close to IDirectFB Release. + +commit b95b785c0162f729893b811519411c80234efcf1 +Author: Niels Roest +Date: Mon Jan 12 18:04:31 2009 +0100 + + [input] correctly read modifiers for load_keymap + +commit 8f5b61297727e7a9c01e60cc6f2a11ff4f474572 +Author: Niels Roest +Date: Fri Jan 9 18:09:56 2009 +0100 + + [core] typo in debug msg + +commit d2741208dd0203fe2cc06e7f4cffd13b9f8b2974 +Author: Denis Oliver Kropp +Date: Tue Dec 16 07:53:08 2008 +0100 + + [v4l] Fixed warning (unused variables). + +commit 03b93ba6855841b8bc6f038bfa4a6e1ea1e7d4c9 +Author: Niels Roest +Date: Wed Nov 26 19:15:22 2008 +0100 + + [palette] when setting a YUV Palette alpha is not discarded anymore. + +commit da790bdc9d4a526fc5edefd2f38bd5a35a7d2e88 +Author: Niels Roest +Date: Fri Dec 12 11:36:47 2008 +0100 + + [surface] follow policy changes.. fix + forgot DLBM_FRONTONLY handling. + +commit 3219f75570d4a1b7544a06d02dd143cd4fec4db9 +Author: Niels Roest +Date: Fri Dec 12 10:28:09 2008 +0100 + + [surface] follow policy changes + +commit f7bf438159e3da4c733d98c1a0e47eee11f50795 +Author: Niels Roest +Date: Wed Dec 10 14:12:56 2008 +0100 + + [keyboard] added setting/loading of keyboard keymaps via IDirectFBInputDevice + +commit e1fb12da71a5efe61cc9e8055bffa4f673ccd04e +Author: Niels Roest +Date: Tue Dec 2 12:25:16 2008 +0100 + + [layer] rotation: update can be 0, e.g. frontonly-exclusive getsurface. + +commit f2108ba5c9a0723c4da900002a431f4d74487352 +Author: Niels Roest +Date: Mon Dec 1 20:28:27 2008 +0100 + + [zytronic] added zytronic touch screen driver (input) + +commit fea6fcf93b52c3a5bc2143577deadc4e469dedb7 +Author: Niels Roest +Date: Mon Dec 1 17:33:19 2008 +0100 + + [sh772x] namespace conformance + +commit 83f49b880e5d0313ea23bf0fc029cf0752c3160f +Author: Niels Roest +Date: Mon Dec 1 16:13:33 2008 +0100 + + [conf] unused variable + +commit 6ffed16b3b4820c3c1e069d16a96e1a824dbdfa4 +Author: Niels Roest +Date: Mon Dec 1 15:34:21 2008 +0100 + + [sh772x] changes: + - obtain LCD parameters via linux/fbdev + - BEU byte swapping removed (not needed with current fbdev/LCDC settings) + - JPU temporarily disabled due to conflicts + +commit 84bceadc7561536e6c81e48d94bc794fceb60fac +Merge: 0d5e504... 36e96c1... +Author: Niels Roest +Date: Mon Dec 1 12:45:58 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 0d5e50498d0aa92c1a208e732dc9b692c15622c4 +Author: Niels Roest +Date: Mon Dec 1 12:45:43 2008 +0100 + + [devmem] fix the displayed-by-dfbdump devmem pool size. + The internal size was not broken. + +commit 36e96c16f3a738fb7bc3c2cd710f455e6cea0e1e +Author: Ville Syrjala +Date: Mon Dec 1 07:46:22 2008 +0200 + + surface_pool: Fix debug print + +commit 2588db1c17a2950fd937ae683fe80bf63006cad5 +Author: Ville Syrjala +Date: Mon Dec 1 07:33:33 2008 +0200 + + prealloc_surface_pool: Add CSTF_INTERNAL to types + +commit 1e4c14889c8d77563dc13f192c8c774bd644f0ff +Author: Ville Syrjala +Date: Mon Dec 1 07:32:52 2008 +0200 + + Revert "surface: Clear DSCAPS_SYSTEMONLY for preallocated surfaces" + + This reverts commit 90cb3c5dd3796a700133216b9ea06509cb8cb8f4. + + A better fix is to add CSTF_INTERNAL to prealloc_surface_pools's types. + +commit e2e757030ede203247b4d641002878d353d2eaf6 +Author: Ville Syrjala +Date: Sat Nov 29 11:11:01 2008 +0200 + + surface_pool: Show CSTF_PREALLOCATED in the debug output + +commit 90cb3c5dd3796a700133216b9ea06509cb8cb8f4 +Author: Ville Syrjala +Date: Thu Nov 27 22:59:07 2008 +0200 + + surface: Clear DSCAPS_SYSTEMONLY for preallocated surfaces + +commit 8cd5f5f42306eb86f3ff2dfaa9ab4d9a27648856 +Author: Ville Syrjala +Date: Tue Nov 18 17:04:56 2008 +0200 + + directfb.h: Document the blend functions + +commit 78a3a8262a05b7791999b012fda80bc636eee602 +Author: Niels Roest +Date: Thu Nov 27 16:40:48 2008 +0100 + + [conf] read /proc/self/cmdline if DirectFBInit() does not receive argv/argc. + +commit a77a88e76123f31b3ee244e006f24d84890bdef5 +Author: Niels Roest +Date: Thu Nov 27 11:49:55 2008 +0100 + + [devmem] fix the displayed-by-dfbdump buffer size for certain formats. + The internal size was not broken. + +commit 7920364b887fc7d88aff01acf578ec85064f498e +Author: Denis Oliver Kropp +Date: Sat Nov 15 05:04:28 2008 +0100 + + [surfaces] Fixed missing initialization of bridge pointer, crashing when no bridge is available. + +commit e344e3b9199fce5f8301f0c59510f7ebe57ad9fe +Author: Niels Roest +Date: Tue Nov 11 19:33:15 2008 +0100 + + [fusion] skirmish wait argument not taken as msec but usec + +commit 8594ccf5aa561a0cf1e992c741f942078cdb2101 +Author: Ville Syrjala +Date: Mon Oct 29 19:51:52 2007 +0200 + + savage: Make the stream engine code compile + + Update the stream engine code so it compiles. No idea why it was disabled + originally. I still left the layer registration code commented out in + case the code is broken. Completely untested due to lack of hardware. + +commit 17108e4cbb2e57df4bea715d7826961e019326a6 +Author: Ville Syrjala +Date: Sat Nov 8 21:59:40 2008 +0200 + + unichrome/cle266: Make the files non-executable + +commit 29ccb1d4d3fff41f482e8770d5bfc902cab1ca97 +Author: Ville Syrjala +Date: Sat Nov 8 16:53:32 2008 +0200 + + unichrome/cle266: Drop useless inline keywords + + The functions are never inlined since they are defined in another + translation unit to the one where they are called. + +commit b84dad7ba84aec9dd9b68fcbe7e5311a6598d5aa +Author: Ville Syrjala +Date: Sat Nov 8 16:34:49 2008 +0200 + + modules: Add some constness + +commit 370f575d8e95d342a00e65fe03223b30c007de01 +Author: Ville Syrjala +Date: Sat Nov 8 13:10:27 2008 +0200 + + Silence compiler warnings + +commit 93163abf1dc2c29f2735ba38c6ebeb292b5d6ff3 +Author: Ville Syrjala +Date: Sat Nov 8 14:02:22 2008 +0200 + + Convert to C99 initializers + +commit aea3b1e28ea832a1b195a09f101b148dea726da4 +Author: Ville Syrjala +Date: Sat Nov 8 14:00:50 2008 +0200 + + core_parts: Fix prototypes and convert to C99 initializers + +commit d33362717ceef41c79f9013077c27bba76525cfd +Author: Ville Syrjala +Date: Mon Nov 3 13:52:45 2008 +0200 + + Check allocation results + +commit 7306d11c6099e48f6cf54a3123b957cd35359ebd +Author: Ville Syrjala +Date: Mon Nov 3 00:43:14 2008 +0200 + + linuxinput: Include linux/input.h before using the defines from it + +commit e9d481fd6b2dfcc19111cb70c81557791c2ce589 +Author: Ville Syrjala +Date: Mon Nov 3 01:17:22 2008 +0200 + + cle266: Linking needs -lm + +commit 6125bdadb1b6424b86223ccfe3f2d28ca0b7d90f +Author: Ville Syrjala +Date: Sat Nov 1 19:47:50 2008 +0200 + + wm/default: Fix DLBM_TILE clipping + +commit e64fd8d193c9bc5f98d61a7d72895c30c0ab1b37 +Author: Ville Syrjala +Date: Sat Nov 1 17:21:24 2008 +0200 + + linuxinput: Fix LED handling + +commit 4656ada2bea19c093114f554c84f212e2ac59ab0 +Author: Ville Syrjala +Date: Sat Nov 1 17:24:02 2008 +0200 + + linuxinput: Zero-initialize DFBInputEvents + +commit 74a10953c8bd35d1c4c84ced0a1a3fc046290a18 +Author: Ville Syrjala +Date: Sat Nov 1 17:05:56 2008 +0200 + + vt/keyboard: Move keyboard mode handling to the vt code + + Move the keyboard XLATE/MEDIUMRAW handling to the vt code. + Now there is no need for the linuxinput driver to grab the devices + thus allowing other programs to use them concurrently. + +commit 23f24831132899348d83f5fc7d9ced60685b416d +Author: Ville Syrjala +Date: Sat Nov 1 15:07:53 2008 +0200 + + fbdev: Nuke trailing whitespace + +commit d2cfe5771a35d0448a450e6a3803b48f640828c5 +Author: Ville Syrjala +Date: Wed Oct 22 01:01:07 2008 +0300 + + fbdev: Fix pan & zoom functionality + +commit 23c7e698308036f1bcbaf76aad6405243562b111 +Author: Ville Syrjala +Date: Wed Oct 22 00:53:24 2008 +0300 + + fbdev: Cleanups for the panning code + +commit 866c0ba578aad9340892f2e2780803fdb9db3d10 +Author: Ville Syrjala +Date: Sat Nov 1 14:49:23 2008 +0200 + + fbdev_surface_pool: Set the mode when allocating the first buffer + + The mode change needs to happen when the first buffer is allocated to + get the correct pitch from the fb device. After commit + 53ad404266ece35e6e6e625ec5d87c6a57c56ee3 the proper buffer index seems + to be always 0. + +commit 60f030e46bdf50bccb6c1c4d132596f94e0fc296 +Author: Ville Syrjala +Date: Mon Oct 27 16:42:39 2008 +0200 + + fbdev_surface_pool: Test non-primary layer allocations + +commit 0c284de9d2507a112e2c5893d4596fd152b498bc +Author: Niels Roest +Date: Fri Oct 24 11:21:17 2008 +0200 + + [modules] fix for static linking (module unload not available then) + +commit 5a6be0f83ac1f20b635a7c7df23478be1621e367 +Merge: 489c4ce... 51db5c7... +Author: Niels Roest +Date: Wed Oct 22 16:26:31 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + + Conflicts: + + lib/direct/modules.c + +commit 489c4ce9777b134af8e9fdafcfc1e235ae1e882d +Author: Niels Roest +Date: Wed Oct 22 16:03:30 2008 +0200 + + [modules] add option to specify module dir. + You have to specify the base-dir, so the dir that contains + the drivers/systems/wm directories + +commit 51db5c77de51a4ded0f548af1143558f683b74e4 +Author: Ville Syrjala +Date: Wed Oct 22 00:19:41 2008 +0300 + + directfbrc.5: Document triple and windows desktop-buffer-mode options. + +commit 989ce3a6d746c78cee250cc96705564c74e9e7a6 +Author: Ville Syrjala +Date: Wed Oct 22 00:19:11 2008 +0300 + + dfbdump: Deal with CSALF_ONEFORALL + +commit ff6d88ddebbf21e0a295eaecf2d48e77bb0089af +Author: Ville Syrjala +Date: Wed Oct 22 00:09:11 2008 +0300 + + v4l: Clean up the oddball coding style in the v4l2 code. + +commit c9b5bdcdf7ae7646b7aac95fb4fea2aa2b4a138c +Author: Ville Syrjala +Date: Tue Oct 21 01:13:03 2008 +0300 + + v4l: Fix v4l2 build. Untested. + +commit e582ab3c9c004ff73f63deda4bb7f548f069408c +Author: Ville Syrjala +Date: Tue Oct 21 16:30:51 2008 +0300 + + matrox: Wrong chroma plane offset was being used with deinterlace blits. + +commit 6eadb8117df4107bc3a083b90fc52d0d66d7bb23 +Author: Ville Syrjala +Date: Tue Oct 21 04:43:21 2008 +0300 + + inputdrivers: Fix possible array overruns + +commit 8777f4a21098e313d4d13128126ff6aeb621a22a +Author: Ville Syrjala +Date: Tue Oct 21 04:38:25 2008 +0300 + + linuxinput: Use proper sizes for the bitmaps. + +commit a07d490cd20e6d596083ef2a1f6e602e65c42c8b +Author: Ville Syrjala +Date: Tue Oct 21 04:35:53 2008 +0300 + + linuxinput: Count KEY_M + +commit f58cf75c5d47294fe8eee2618c5a9bf61080f962 +Author: Ville Syrjala +Date: Tue Oct 21 04:13:37 2008 +0300 + + dynapro: Fix warning + + dynapro.c:124: warning: control reaches end of non-void function + +commit 3366291eb27389bdf021589e92c9b0c2429ec5f5 +Author: Ville Syrjala +Date: Tue Oct 21 04:13:05 2008 +0300 + + omap: Fix warning + + omap.c:63: warning: no return statement in function returning non-void + +commit 23c806d2c9e40dd6dc427471468cdc16379acf4b +Author: Ville Syrjala +Date: Tue Oct 21 04:09:39 2008 +0300 + + Function prototype cleanups. + +commit 27159d0ec866412f069844b46cd2830521901a6a +Author: Ville Syrjala +Date: Tue Oct 21 02:19:28 2008 +0300 + + Constness cleanups. + +commit 871226fe1f3e90d63d22fa2f89cd6c4bbc3e8df4 +Author: Ville Syrjala +Date: Tue Oct 21 01:51:54 2008 +0300 + + Fix build with LDFLAGS="-Wl,-no-undefined". + +commit b6a4fa8440d5edbb6db3ecb08d46c2a5e6a20bbf +Author: Ville Syrjala +Date: Tue Oct 21 01:36:38 2008 +0300 + + Fix build when srcdir != builddir. + +commit d60830df6bc8a2116be4bb5fcd7163e0f570f1cb +Author: Ville Syrjala +Date: Tue Oct 21 01:18:27 2008 +0300 + + configure: Use -Wno-inline with -fno-inline. + +commit d0bfced1ef4e48f7b128b3a41e6740aeeb96cc6b +Merge: 6db2d85... 73aa410... +Author: Niels Roest +Date: Tue Oct 21 15:09:23 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 6db2d8546e9df7ba5d2f0667eb3cfb7d68df9874 +Author: Niels Roest +Date: Tue Oct 21 15:08:52 2008 +0200 + + [sh772x] allow revisions of sh7722 and sh7723 to be detected + +commit 73aa4100e783ff31ab42b5945af626d2e4abcfba +Author: Denis Oliver Kropp +Date: Sat Oct 18 07:49:40 2008 +0200 + + [input] In init_devices() use direct_list_foreach_safe() instead of direct_list_foreach(). + +commit d3a426f0139e0feed50ca854e938e0caaf9acc18 +Author: Denis Oliver Kropp +Date: Sat Oct 18 07:48:21 2008 +0200 + + [input] Use direct_modules_unregister() in destructor of input driver modules. + +commit 9cc6e2c61e59de7c586255de71a6b2ba4e3d9739 +Author: Denis Oliver Kropp +Date: Sat Oct 18 07:47:25 2008 +0200 + + [direct] Added direct_modules_unregister()...... + +commit 49175b8aa213e6f980194aecdca99b2a8dc1a590 +Merge: 020f6b0... 98a7b51... +Author: Denis Oliver Kropp +Date: Sat Oct 18 03:37:04 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 020f6b0163e1b0436f4d4e618762b6478471d7a9 +Author: Denis Oliver Kropp +Date: Sat Oct 18 03:34:23 2008 +0200 + + [fusion] Don't return calls with zero serial, avoiding overhead when kernel calls or FCEF_ONEWAY is used. + +commit 98a7b516d012097951326e01a31ed64404d3240a +Merge: 633ac3e... 347dda2... +Author: Niels Roest +Date: Wed Oct 15 15:47:43 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 633ac3e8a832618d70d993a82931e36350e75529 +Author: Niels Roest +Date: Wed Oct 15 15:47:18 2008 +0200 + + [sh7722] jpegtool.c - fix + +commit 347dda20f19d56bdda01d3881fa6632142be828a +Author: Denis Oliver Kropp +Date: Wed Oct 15 11:03:42 2008 +0200 + + [default wm] Fixed advanced blending with only DSBLIT_BLEND_COLORALPHA being used. + +commit 3439ef31e02802217e90d38c04a097f7f7c9d9d0 +Merge: 14cfb64... 487d159... +Author: Denis Oliver Kropp +Date: Wed Oct 15 11:02:09 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 14cfb648fb86c83fb194cf5cd1dfe96b1a5aa57c +Author: Denis Oliver Kropp +Date: Wed Oct 15 11:01:20 2008 +0200 + + [default wm] Fixed move_window() for invisible windows which got broke in 1.3.0. + +commit 487d159f507aa58f0ce6e8b5cf7ff46269340b35 +Author: Niels Roest +Date: Tue Oct 14 19:33:28 2008 +0200 + + [fbdev] use directfbrc for initial screen size, if specified. + suggestion and patch by Stefan Lucke. + +commit 31479007bb3e908b565347727c1b882da115ba95 +Author: Niels Roest +Date: Tue Oct 14 18:44:43 2008 +0200 + + [sh772x] JPEG writeback improvements + - correct handling of colour of NV12 and NV16 input in line mode + - recorrect not-scaled NV12 and NV16 input (jpeg_writing = 2) + - handle odd input sizes + - handle error condition, on tmp-storage request failure, properly + +commit ca876fdf1c93ca003b204cfd723d79cbc1193874 +Merge: faaaab8... 93351e5... +Author: Denis Oliver Kropp +Date: Sat Oct 11 00:42:00 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 93351e5dffa3dfc5d9369b6415e0d0c6e2bcc061 +Author: Niels Roest +Date: Fri Oct 10 21:14:51 2008 +0200 + + [sh772x] jpeg intermediate buffer creation + +commit cbe8ac53c04c896559bc77f7f0245369f9088dcd +Author: Niels Roest +Date: Fri Oct 10 20:49:10 2008 +0200 + + [gfx] added RGBA4444 support + +commit af6dbdad1be58e89c0162ed2a8e97f07654ff409 +Author: Niels Roest +Date: Thu Oct 9 18:48:21 2008 +0200 + + [SH772X] adjust makefiles to rename + +commit 00b952b24fa25cd215747da2603df1fbfd2ae605 +Author: Niels Roest +Date: Thu Oct 9 18:42:23 2008 +0200 + + [SH772X] rename driver + +commit 290759e3b9f232bda83d569bb819cc5760fdc626 +Author: Niels Roest +Date: Thu Oct 9 14:48:00 2008 +0200 + + [sh772x] added display power on, + other stuff: + - include display power-on in sh772x kernel module so we don't need + the fb driver from the kernel, current implementation limited to sh7723. + - limit pitch alignment to 16 bytes, more currently not needed + - extend JPEG encode with tmpphys; will be used to store intermediate + between BEU and JPU, to prevent 16-line-chunk-scaling issues. + +commit cb600d605b500768b89d0a728be37802dcf32cd7 +Author: Niels Roest +Date: Wed Oct 8 15:04:09 2008 +0200 + + [v4l] conform v4l to new surface core architecture + +commit 5fb69be91e2fbd246cdeaa4f3d4a5ff2a72111ed +Author: Niels Roest +Date: Wed Oct 8 12:03:42 2008 +0200 + + [v4l] v4l sources were not part of distro. fixed. + +commit 09c24692a7c6e5c72b37b12932d624c6b4916c29 +Author: Denis Oliver Kropp +Date: Thu Oct 2 04:00:19 2008 +0200 + + [omap] Added omapfb.h to SOURCES. + +commit faaaab8385e8d164633750a8685ef29667455ff4 +Merge: 2454796... 009d02a... +Author: Denis Oliver Kropp +Date: Wed Oct 1 02:54:01 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 009d02a3a57af8ebd996bad075dd8458dd88a92d +Author: Denis Oliver Kropp +Date: Wed Oct 1 02:50:10 2008 +0200 + + [x11] Remember each GLXContext's drawable and set update flag only if it changed. + +commit c645f44c97d64e442a49b2b952a0ee9dcfdc8c4b +Author: Denis Oliver Kropp +Date: Wed Oct 1 01:27:09 2008 +0200 + + [x11] Manage second GLX context per thread via another surface accessor ID. + +commit fd133765fc4c3cabe06ef23f7445ce74e1b3d52c +Author: Denis Oliver Kropp +Date: Wed Oct 1 00:43:55 2008 +0200 + + [default font] Support premultiplied font formats. + +commit 9f5d378bbf45c5dcc837b4a25b5abded203ced7e +Author: Denis Oliver Kropp +Date: Mon Sep 29 18:31:41 2008 +0200 + + [default wm] Added Meta-R for window rotation. + +commit 3fc2cda70ab14e3d79891996bac590d905ce1286 +Author: Denis Oliver Kropp +Date: Mon Sep 29 16:37:58 2008 +0200 + + [sh7722] Fixed wrong number of arguments in JPEG test program. + +commit 155cd2c8dcee78062d117a1fd3cab88fc50905bd +Author: Denis Oliver Kropp +Date: Mon Sep 29 15:12:47 2008 +0200 + + updated again for 1.3.0 + +commit 375e21f904ae1b17aad9bfeadcd3422b92b19377 +Author: Denis Oliver Kropp +Date: Mon Sep 29 15:11:44 2008 +0200 + + [options] Set default font format to A8 for new surface hint code to always work. + +commit 1837deea823d728cab760b3d340470ce2cc592e7 +Author: Denis Oliver Kropp +Date: Mon Sep 29 13:39:45 2008 +0200 + + updated ChangeLog once more + +commit e53b0eb0b2906255d95c4b7ac35ac7406311658e +Author: Denis Oliver Kropp +Date: Mon Sep 29 13:39:12 2008 +0200 + + [NEWS] Added more news... + +commit f45abff01200c7dcf090530234f446906909aa12 +Author: Denis Oliver Kropp +Date: Mon Sep 29 13:09:48 2008 +0200 + + Updated ChangeLog and NEWS for DirectFB 1.3.0! + +commit 96b8e12ff8436f0bb7d111325085c4377d20ee6e +Author: Denis Oliver Kropp +Date: Mon Sep 29 11:21:46 2008 +0200 + + [IDirectFBSurface] Added DFBSurfaceHintFlags for optimized allocation, format selection etc. + + Added DSDESC_HINTS to DFBSurfaceDescriptionFlags. + + Added 'hints' to DFBSurfaceDescription. + + Implemented DSHF_FONT by selecting the configured font format and premultiplication. + +commit 7296d476f6691dc727782e9ba33fb325f6742ff6 +Author: Denis Oliver Kropp +Date: Mon Sep 29 02:49:25 2008 +0200 + + [x11] Optimized locking for lock-free case when nothing has changed. + +commit 4e2d62d344f9e6b7a5fd7686a1cddf25c8e67ebb +Author: Denis Oliver Kropp +Date: Mon Sep 29 02:26:25 2008 +0200 + + [x11] Fixed GLX texture corruption by making sure ReleaseTexImageEXT() is called *after* glXMakeContextCurrent() + + when the pixmap was bound as a texture before, especially from another thread/context. + +commit 2454796b952bce956351bf5a1d6d289e4509e94a +Merge: b530494... ac2a3c2... +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:57:32 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit ac2a3c267652bfaf95867e43ad687c237d06c8be +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:54:05 2008 +0200 + + [dispatcher] Use direct_thread_lock()/unlock() in dispatcher and stopping function to fix remaining issues. + +commit 533e1cb6bfd5974d1f011332eb9926d00031b64b +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:33:55 2008 +0200 + + [x11] Use XShmCreatePixmap() and XCopyArea() instead of XShmGet/PutImage() allowing partial transfers in both directions! + +commit 41d7d3cab148b3e53607597c69dd79bc2125074b +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:33:19 2008 +0200 + + [x11] Evil error handling... + +commit 8eafc86b91340200050bbb0de7c0dabe9c99e269 +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:32:22 2008 +0200 + + [x11] Fixed remaining crash with expose events that ran into a NULL window. + +commit 67a367273916fbd4cdba6e46d434e07ee6188346 +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:31:25 2008 +0200 + + [wm] Lots of useful debug messages. + +commit 7de055f41796e32dfef59f97f5c4c8b8f7e876e7 +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:30:39 2008 +0200 + + [core] Call fusion_stop_dispatcher() before destroying pools to fix lots of shutdown issues. + +commit 744a03d368e5ee3d2b1cf371190a08764c0a29d1 +Author: Denis Oliver Kropp +Date: Sun Sep 28 23:29:45 2008 +0200 + + [fusion] Added fusion_stop_dispatcher() to be called before destroying pools etc... fixing lots of shutdown issues! + +commit b530494dd1fcd251e9ad9c114d0bf4f67f28d6a6 +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:26:28 2008 +0200 + + [util] Added dfb_updates_add_rect(), dfb_updates_deinit() and DFB_UPDATES_ASSERT(). + +commit 7bcddc09975447dca83e86bbe22d0dcbbd2fb49a +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:25:38 2008 +0200 + + [interfaces] Added some debug messages to DirectInterface code. + +commit e9b0350475504a535f4db6c85a5085403cfaf946 +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:24:47 2008 +0200 + + [util] Added dfb_updates_get_rectangles() for convenience, doing bounding box trade off etc... + +commit b9962de77dc15dfe31c4ab51c1ef8b88ea3b6f13 +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:21:41 2008 +0200 + + [UniQuE] A debug message and a minor safety check. + +commit 589179f256a2426759b4888b89cb369f7be84a34 +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:20:35 2008 +0200 + + [UniQuE] Unload foo surface (border tiles) during master shutdown. + +commit 778d6a7d28e15d25d089a15051dfe1b2e2477270 +Author: Denis Oliver Kropp +Date: Sun Sep 28 21:19:34 2008 +0200 + + [OpenGL] Don't switch to ARGB fonts if acceleration is disabled. + +commit f7f22e3df68a0b1e18b5497ed5e233af40c51aae +Author: Denis Oliver Kropp +Date: Sun Sep 28 14:04:20 2008 +0200 + + [thread] Added direct_thread_wait() / _notify(), _lock(), _unlock() and _terminate(). + +commit 82e0198724ff2a4caa301b3cdd89d5bb8760f433 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:54:36 2008 +0200 + + [software] Disable MMX functions not supporting rotation (Ostep/Dstep) properly. + +commit 3e2919e719f3592bd9d2904e1b348c299a5e2168 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:48:07 2008 +0200 + + [default wm] Implement stack rotation and window rotation, thanks to Young Hoon for the original patch! + +commit 8339b0644ac6a2ec1ca31c73a357e048364c4c59 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:45:38 2008 +0200 + + [layers] Implement layer rotation using DSCAPS_ROTATED if available, otherwise using rotated window stack. + + With just a single buffer (frontonly), it always uses rotation of the window stack. + + Thanks to Young Hoon for the original patch! + +commit 09bc7acb42ee21eeb053483f99a67f859c668272 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:44:27 2008 +0200 + + [dfbdump] Show layer and window rotation. + +commit b7da6d0e033d85e3ef74e27d15babd73e84db135 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:43:08 2008 +0200 + + [IDirectFBWindow] Added SetRotation() for 90, 180 and 270 degree rotation per window. + + Thanks to Young Hoon for the original patch! + +commit 6d4e5b8b08c8085215d4b01654641265b0bdeb08 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:26:36 2008 +0200 + + [IDirectFBSurface] Added (unimplemented!) DSCAPS_ROTATED to allocate back buffers with width/height swapped. + +commit 0826c71717a168423395b27405cfa49291f7db75 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:20:30 2008 +0200 + + [IDirectFBDisplayLayer] Added GetRotation() to query the layer rotation. + +commit a42d0243b668376006e673781722bd7f11549857 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:17:29 2008 +0200 + + [graphics] Implement proper clipping for rotated blits of 90, 180 or 270 degree. + +commit b265d72582f5b230bf35676e8c1f83a3f86bd01a +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:16:08 2008 +0200 + + [options] Allow '90' and '270' for "layer-rotate" option. + +commit 8525bb01605913ccefc82963cfd95ee7989f50fa +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:12:16 2008 +0200 + + [util] Replaced dfb_back_to_front_copy_180() by dfb_back_to_front_copy_rotation() with extra argument. + + Thanks to Young Hoon for the original patch! + +commit 96842fc12394e4a89a66a05f5cf083a5d3441595 +Author: Denis Oliver Kropp +Date: Sun Sep 28 01:05:30 2008 +0200 + + [IDirectFBSurface] Added DSBLIT_ROTATE90 and DSBLIT_ROTATE270. Thanks to Young Hoon for original patch! + +commit 44c300ddb9d5d8e003c06eb8d5e49572f40e3df7 +Author: Denis Oliver Kropp +Date: Sun Sep 28 00:59:22 2008 +0200 + + [util] Added dfb_region_from_rotated(), dfb_rectangle_from_rotated() and dfb_point_from_rotated_region(). + +commit 55b46effe7f19ef554ba09517e556105fd21ed74 +Author: Denis Oliver Kropp +Date: Sun Sep 28 00:55:07 2008 +0200 + + [util] Added D_UTIL_SWAP(a,b) to exchange values. + +commit e1c2174e4aa0519bc8463df2c0d3981096aefc1e +Author: Denis Oliver Kropp +Date: Fri Sep 26 22:12:20 2008 +0200 + + [layers] Fixed missing lock on surface structure around dfb_surface_allocation_update() call. + +commit 66387ba7565804a12be2b102a392f78cb56f38cf +Author: Denis Oliver Kropp +Date: Fri Sep 26 22:07:21 2008 +0200 + + [surfaces] Fixed wrong allocations being used for locks due to a copy'n'paste error during last cleanup. + +commit 0e8877d5706e824b5a2d48b1cdf5e48b24462851 +Author: Denis Oliver Kropp +Date: Fri Sep 26 21:50:21 2008 +0200 + + ignore + +commit 2a91a14e8171c374ff712b1605a26a69c108e86e +Author: Niels Roest +Date: Thu Sep 25 19:34:40 2008 +0200 + + [sh772x] for JPEG encoding: horz/vert up/downscaling + offset + scaling is without n-line mode, so there are artefacts visible vertically + (since there operation is handled in 16-pixel steps) + todo: if enough memory is available, perform full-picture malloc and scale in 1 step + +commit c1e82561ca9ca338fcaf4964d9e6ea54dde0536a +Author: Niels Roest +Date: Mon Sep 22 20:06:12 2008 +0200 + + [sh772x] fix JPEG encoding. + n-line mode impossible because destination addresses of VEU cannot be updated intermediately. + current implementation generates ints every 16 lines to reprogram VEU. + Disadvantage: phase is lost when scaling. (scaling not tested yet) + +commit 6c32f67dc024d80dd72fe32c9922a21a82248dc2 +Author: Nikita Egorov +Date: Thu Sep 25 13:52:52 2008 +0400 + + Set glyph alignment of 8 bytes for all font formats + +commit 53f333bd8c44a2aabe1062dda6792df288ce3b35 +Author: Denis Oliver Kropp +Date: Thu Sep 25 01:10:20 2008 +0200 + + [fonts] Fixed alignment on eight byte boundary, thanks to Nikita Egorov for spotting! + +commit 5fcc55be33005938b2b8c891542ab542bdfbfd56 +Author: Niels Roest +Date: Tue Sep 23 12:42:48 2008 +0200 + + [x11] build fixes for people without GLX + +commit 11f7f8d45a3b09fb1eb58c57db3dc58066172e65 +Author: Nikita Egorov +Date: Mon Sep 22 15:41:00 2008 +0400 + + Don't switch to fill rectangle in DrawLine() if matrix is used. + +commit cce58cd1c1cce5d0708db3cfd0c8ca1fcb8d43c5 +Author: Denis Oliver Kropp +Date: Mon Sep 22 12:39:18 2008 +0200 + + [sh772x] Build fix for 1.3.x. + +commit 255907bd76c9e8af7390944bb87715a2d12bedf1 +Author: Denis Oliver Kropp +Date: Sat Sep 20 10:03:59 2008 +0200 + + [default wm] In window_at_pointer() use dfb_surface_read_buffer() with 1x1 rectangle instead of lock/unlock. + +commit f13337b3bb9ea83881ebccbd98e2ab2a6912d15f +Author: Denis Oliver Kropp +Date: Sat Sep 20 10:00:30 2008 +0200 + + [x11] Use new dfb_surface_buffer_lock_deinit() rather than clearing the magic. + +commit 539cec381cf29413df91e3ec72d88bb2134af81c +Author: Denis Oliver Kropp +Date: Sat Sep 20 09:57:08 2008 +0200 + + [surfaces] Implemented dfb_surface_buffer_read(), added dfb_surface_buffer_lock_deinit(), moved out format conversion. + + Added dfb_convert_to_rgb24() and dfb_convert_to_a8(), used for surface dumps to .ppm files. + +commit d9aaad3f6a8e8ed3cb19ef0afebb8d531057e261 +Author: Denis Oliver Kropp +Date: Sat Sep 20 09:41:41 2008 +0200 + + [UniQuE] Added experimental border event handling in test_foo program to move/raise any window :) + + Try running: + ./test_foo & + and + gtk-demo + + Note: Raising windows confuses GDK-DirectFB and moving a window over another has grabbing issues, + but this was just a quick test and the solution to these issues is clear ;) + +commit 05ac679d7d23d59cc20dbea93211c1f43bfbdddd +Author: Denis Oliver Kropp +Date: Sat Sep 20 09:40:07 2008 +0200 + + [UniQuE] Use dfb_surface_write_buffer() instead of lock/memcpy/unlock for border images (foo). + +commit 3f2dadcee38044fe6c40d194551db004c093076f +Author: Denis Oliver Kropp +Date: Fri Sep 19 04:04:48 2008 +0200 + + [x11] Fixed missing x11types.h in SOURCES definition. + +commit 6952526a54a4adf7c2e0f43d3a2f47d4a4cfbc5d +Author: Denis Oliver Kropp +Date: Fri Sep 19 04:03:06 2008 +0200 + + [sh7722] Fixed EXTRA_DIST. + +commit 6b258d60b619c26f5483234894513e4272608402 +Author: Denis Oliver Kropp +Date: Thu Sep 18 22:11:55 2008 +0200 + + [x11] In glxDeallocateBuffer() don't use GetLocalPixmap(), but only direct_hash_lookup(). + + This avoids creating the pixmap if it did not exist, yet, e.g. no Lock() happened. + +commit 6e34c52a52e0b0136a50fad63f719c59ee614c84 +Author: Denis Oliver Kropp +Date: Thu Sep 18 21:27:18 2008 +0200 + + [x11] When update goes directly from XShmImage without copy/convert (single buffer layer), do an XSync()! + +commit 8cc7a4021cf98db2730b3bf0de4effd1cb98c984 +Author: Denis Oliver Kropp +Date: Thu Sep 18 21:26:50 2008 +0200 + + [x11] Hotfix missing update queue... + +commit 2df15476a32f2a795446a4b51e090114b972e4f8 +Author: Denis Oliver Kropp +Date: Thu Sep 18 21:01:02 2008 +0200 + + [x11] Lookup visual in master where XShmCreateImage is actually called. + +commit 53ad404266ece35e6e6e625ec5d87c6a57c56ee3 +Author: Denis Oliver Kropp +Date: Thu Sep 18 19:43:30 2008 +0200 + + [windowstack] Set background mode of new contexts to DLBM_DONTCARE. + +commit 286730ed5ed1358aae77946ff7c827b94be9b727 +Author: Denis Oliver Kropp +Date: Thu Sep 18 19:10:57 2008 +0200 + + [thread] Fixed missing magic value in thread structure created for non-direct threads. + +commit 8e34df9400f6161c1885de710e5df5d64dcd6c98 +Author: Denis Oliver Kropp +Date: Thu Sep 18 19:02:27 2008 +0200 + + [layers] Fixed unlocking of destroyed skirmish in context destructor. + + [merged from release_1_2_x] + +commit cdc9cae71ce7ac43f73ed919d853ff0f471289be +Author: Denis Oliver Kropp +Date: Thu Sep 18 17:28:44 2008 +0200 + + [x11] Implemented Surface Pool Bridge for fast transfer between XShmImage and GLX pool. + + Using XShmPutImage/XShmGetImage instead of using XPutImage/XGetImage speeds up df_andi + by more than 100% in my tests. + +commit 9a65e7235b619396096bc01fcb02b3dffc51ef27 +Author: Denis Oliver Kropp +Date: Thu Sep 18 17:23:56 2008 +0200 + + [surfaces] Added Surface Pool Bridge[tm] technology to speed up transfer between pools. + + New API can be implemented to do optimized transfer from one surface pool to another. + + CheckTransfer() is called to probe each registered CoreSurfacePoolBridge. + + CoreSurfacePoolTransfer is allocated with one or more rectangles to be transfered. + + StartTransfer() and FinishTransfer() are used to actually execute the transfer + which could be queued, but is synchronous at the moment (Start+Finish). + +commit b0c0ba9446ca0fe67ab940433b149fc7a1d4fb85 +Author: Denis Oliver Kropp +Date: Thu Sep 18 00:04:38 2008 +0200 + + [IDirectFBImageProvider_PNG] Use dfb_surface_write_buffer() if possible. + +commit b737a1bc975555ad1b897975803808f0cfce3dd6 +Author: Denis Oliver Kropp +Date: Thu Sep 18 00:00:29 2008 +0200 + + [surfaces] Implemented dfb_surface_buffer_write() using Write() on allocation. + + New algorithm for finding the allocation which to Write() to, using last read + allocation or other up to date allocation. + + Remember last read allocation for better negotiation in case of multiple up to + date allocations. + +commit 0c5e8ec043a25184bd2d501417985fa122ec9596 +Author: Denis Oliver Kropp +Date: Wed Sep 17 23:55:27 2008 +0200 + + [dfbtest_blit] Added option "-R" to rerender image to surface before every blit (benchmark). + +commit 73e61e0fd4fb4b0ac69882b6a9c94e1ee061be7b +Author: Denis Oliver Kropp +Date: Wed Sep 17 21:00:47 2008 +0200 + + [x11] Move definition of USE_GLX to configure. + +commit 89b08b7254cd4d56b20b8205a1770aec2b687c49 +Author: Denis Oliver Kropp +Date: Wed Sep 17 20:56:50 2008 +0200 + + [x11] Fixed another 'missing separator' error in Makefile. + +commit fde10fcaad76bfd25081936a082eef5223e580af +Author: Denis Oliver Kropp +Date: Wed Sep 17 20:55:39 2008 +0200 + + [x11] Fixed 'missing separator' error in Makefile. + +commit 3a60e628798ca0df33779c4b68c631a50007c060 +Merge: dec7005... ab2b4d7... +Author: Niels Roest +Date: Wed Sep 17 20:39:26 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit dec70057d72dcf7f0f5a1b62d8fc848ab1ddace8 +Author: Niels Roest +Date: Wed Sep 17 20:39:15 2008 +0200 + + [x11] x11 should not rely on gl.h header file presence. + +commit ab2b4d7568053c963d15083f798cded3448d1d4a +Author: Denis Oliver Kropp +Date: Wed Sep 17 20:16:36 2008 +0200 + + [davinci] Update driver for 1.3.0 changes in surface pools. + +commit ad2f11641d2a23c00a0917c4060858edc1c73413 +Author: Denis Oliver Kropp +Date: Wed Sep 17 16:11:12 2008 +0200 + + [davinci] Workaround broken DSP cache invalidation function. + +commit 8403a7fd6d6d79885aa5e62a38929185b589cf4a +Merge: d1b2807... 5c71f6f... +Author: Niels Roest +Date: Wed Sep 17 19:09:06 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit d1b2807efab53fcd30b0cd3c0d5e0a099555b5b0 +Author: Niels Roest +Date: Wed Sep 17 19:08:48 2008 +0200 + + [core] check and handle return value of get_layer_dimension(). + Can go wrong with davinci driver without GET_TIMING patches. + +commit 6d1f4e5ea2166f68270230f779b07203aba581db +Author: Niels Roest +Date: Wed Sep 17 19:06:07 2008 +0200 + + [davinci] param missing in debug print + +commit 9c2808bf55f36d96326f170057a3c4225c9a50bf +Author: Niels Roest +Date: Wed Sep 17 19:05:19 2008 +0200 + + [x11 input] possible lock at shutdown due to thread trying to kill itself + +commit 5c71f6f7fb98166c0224e5141e7df6f88fb34aa6 +Author: Denis Oliver Kropp +Date: Wed Sep 17 18:32:50 2008 +0200 + + [x11] Added missing header from last major cleanup. + +commit e08c004f94228c022cc78e91b12d9df3f5aa3641 +Merge: b67d7df... 69ecb59... +Author: Denis Oliver Kropp +Date: Wed Sep 17 18:27:56 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit b67d7df1780848705949b7a8819534079ea4be68 +Author: Denis Oliver Kropp +Date: Wed Sep 17 18:26:03 2008 +0200 + + [OpenGL] Restructured surface pool and graphics driver, leaving GLX in the system module... + + Also tried to make multi application working, but it seems that for an X11 Pixmap there can + only be one process doing a glXCreatePixmap() which also does not allow the GLXPixmap to be + shared :( + +commit 2b63196cd9e93f492cc1c9058c92cfe8d691a9b8 +Author: Denis Oliver Kropp +Date: Wed Sep 17 18:25:06 2008 +0200 + + [surfaces] Assert that pitch is != 0 only if virtual or physical address is present. + +commit 69ecb59725ec375da89ee57218afccf56d8bfdc4 +Author: Denis Oliver Kropp +Date: Wed Sep 17 12:16:49 2008 +0200 + + [davinci] Raise OSD surface pool priority to allocate in frame buffer rather than /dev/mem. + +commit e10cb3822ac5d0842a0e489fb30ffdcac0532700 +Author: Denis Oliver Kropp +Date: Wed Sep 17 12:05:43 2008 +0200 + + [trace] Fixed static build. + +commit ddae89777f9350ce5a5ff754f5909cc950bd08c5 +Author: Denis Oliver Kropp +Date: Sun Sep 14 16:33:59 2008 +0200 + + [x11] MAJOR cleanup of system module code. Every slave connects to the server now as well! + + Separated shared and local parts in the setup to avoid code duplication. + + It looks like all processes can have their own DirectFB windows and render to them via OpenGL, + but putting them on the screen (X window) fails. It seems binding another process' GLXPixmap + is not allowed. Hopefully I can just create each process own GLXPixmap wrapper around the real + XPixmap... + +commit ca33e763a6881d36902bf04da0b7b5a376992250 +Author: Denis Oliver Kropp +Date: Sun Sep 14 11:37:44 2008 +0200 + + [OpenGL] GLX to be precise... full featured GL based acceleration on top of X11 system module! + + Some changes have been necessary to make this happen... a few at least :) + + $ df_dok --dfb:mode=800x600 --dump --accelonly + + ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.3.0 |~~~~~~~~~~~~~~~~~~~~~~~~~~ + (c) 2001-2008 The world wide DirectFB Open Source Community + (c) 2000-2004 Convergence (integrated media) GmbH + ---------------------------------------------------------------- + + (*) DirectFB/Core: Single Application Core. (2008-09-14 09:06) + (*) Direct/Memcpy: Using libc memcpy() + (*) GLX/Surfaces: Using visual 0x2e (24bit) and 0x64 (32bit) + (*) Direct/Thread: Started 'X11 Input' (29248) [INPUT OTHER/OTHER 0/0] <8388608>... + (*) DirectFB/Input: X11 Input 0.1 (directfb.org) + (*) DirectFB/Genefx: MMX detected and enabled + (*) DirectFB/Graphics: OpenGL Acceleration - GeForce 8800 GTX/PCI/SSE2 0.5 (Denis Oliver Kropp) + (*) DirectFB/Core/WM: Default 0.3 (directfb.org) + (*) X11/Window: Creating 800x 600 RGB32 window... + (*) X11/Display: Using XShm. + (*) Direct/Interface: Loaded 'PNG' implementation of 'IDirectFBImageProvider'. + (*) Direct/Interface: Loaded 'FT2' implementation of 'IDirectFBFont'. + (*) Direct/Interface: Using 'GIF' implementation of 'IDirectFBImageProvider'. + + Benchmarking 256x256 on 800x580 RGB32 (32bit)... + + Anti-aliased Text 3.000 secs (*4736.400 KChars/sec) [ 99.6%] + Anti-aliased Text (blend) 3.000 secs (*4724.400 KChars/sec) [ 99.3%] + Fill Rectangle 4.288 secs (*13269.205 MPixel/sec) [100.0%] + Fill Rectangle (blend) 5.495 secs (*6860.110 MPixel/sec) [100.0%] + Fill Rectangles [10] 4.614 secs (*13280.485 MPixel/sec) [100.0%] + Fill Rectangles [10] (blend) 6.125 secs (*6858.543 MPixel/sec) [100.0%] + Fill Triangles 4.841 secs (*13359.001 MPixel/sec) [100.0%] + Fill Triangles (blend) 6.565 secs (*6908.482 MPixel/sec) [ 99.8%] + Draw Rectangle 3.000 secs (*1206.566 KRects/sec) [ 99.3%] + Draw Rectangle (blend) 3.000 secs (*1205.933 KRects/sec) [ 99.3%] + Draw Lines [10] 3.000 secs (*4576.000 KLines/sec) [ 99.6%] + Draw Lines [10] (blend) 3.000 secs (*4582.333 KLines/sec) [ 99.6%] + Fill Spans 3.002 secs (*2021.530 MPixel/sec) [ 99.6%] + Fill Spans (blend) 3.001 secs (*2026.571 MPixel/sec) [ 99.3%] + Blit 4.867 secs (*9148.378 MPixel/sec) [ 99.5%] + Blit 180 4.867 secs (*9167.230 MPixel/sec) [100.0%] + Blit with colorizing 4.872 secs (*9133.609 MPixel/sec) [ 99.7%] + Blit from 32bit (blend) 5.906 secs (*5886.699 MPixel/sec) [100.0%] + Blit from 32bit (blend) with colorizing 5.917 secs (*5869.110 MPixel/sec) [ 99.8%] + Stretch Blit 4.677 secs (*11836.563 MPixel/sec) [ 99.7%] + + http://www.directfb.org/tests/benchmarks/DirectFB_OpenGL_GeForce_8800_GTX/ + +commit 806763a3e190ec55357175197fb01597bf79c874 +Author: Denis Oliver Kropp +Date: Sun Sep 14 05:35:40 2008 +0200 + + [call] Added debug messages. + +commit 29b4f65de808fe56d0315a518a251342157849df +Author: Denis Oliver Kropp +Date: Sat Sep 13 20:53:37 2008 +0200 + + [options] Fixed pixel format parsing code, first check for exact, then for partial matches. + +commit 7872de5113e4ca56c281d585d5b164215c276b56 +Author: Denis Oliver Kropp +Date: Sat Sep 13 20:49:22 2008 +0200 + + [graphics] Only have DSRO_MATRIX be mandatory for now. Other flags no longer prohibit acceleration. + + Worst case was when DSRO_SMOOTH_UP/DOWNSCALE was turned on globally via "smooth-upscale" or "smooth-downscale" + runtime option which caused all operations to use software fallbacks, not only StretchBlit()! + +commit aeb008fe40f57fbad4572c077c0ee529e5890538 +Author: Denis Oliver Kropp +Date: Thu Sep 11 02:41:22 2008 +0200 + + [generic] Added optimized Bop_argb_blend_alphachannel_one_invsrc_Aop_argb() -> 6x speed + +commit 7683d221c355d432c62456e40af85dadd5274840 +Author: Denis Oliver Kropp +Date: Wed Sep 10 22:11:03 2008 +0200 + + [SH7722] Follow device name change in JPEG code, too. + +commit 0a47e5fecb45cf9cb30ee5bcc897d7a4de369b06 +Author: Denis Oliver Kropp +Date: Wed Sep 10 21:38:14 2008 +0200 + + ignore + +commit 898e42cc05c2b306de1f11658a884b5bf79573af +Author: Denis Oliver Kropp +Date: Wed Sep 10 21:33:30 2008 +0200 + + [SH7723] Added support for SH7723 to SH7722 driver and kernel module. + + (*) DirectFB/Graphics: Renesas SH7723 0.9 (Denis & Janine Kropp) + (*) DirectFB/Core/WM: SaWMan 0.2 (directfb.org) + (*) SaWMan/Config: Parsing config file '/etc/sawmanrc'. + (*) SaWMan: Initializing stack 0x432078 for tier 0x431a48, 0x0, layer 0, context 0x431e78 [1]... + (*) SaWMan/Init: Layer 0: 800x480, RGB16, options: 1 + (*) SaWMan/Init: Border 0: 800x480, RGB16, options: 8 + (*) Direct/Interface: Using 'PNG' implementation of 'IDirectFBImageProvider'. + (*) Direct/Interface: Using 'FT2' implementation of 'IDirectFBFont'. + (*) Direct/Interface: Using 'GIF' implementation of 'IDirectFBImageProvider'. + + Benchmarking 256x256 on 800x464 RGB16 (16bit)... + + Fill Rectangle 5.350 secs (* 200.895 MPixel/sec) [ 3.9%] + Fill Rectangle (blend) 8.590 secs (* 78.582 MPixel/sec) [ 1.7%] + Fill Rectangles [10] 5.226 secs (* 200.646 MPixel/sec) [ 1.1%] + Fill Rectangles [10] (blend) 11.699 secs (* 78.425 MPixel/sec) [ 0.3%] + Fill Triangles 14.254 secs (* 26.436 MPixel/sec) [ 1.1%] + Fill Triangles (blend) 26.657 secs (* 8.727 MPixel/sec) [ 0.4%] + Draw Rectangle 3.127 secs (* 30.444 KRects/sec) [ 44.8%] + Draw Lines [10] 3.062 secs (* 122.468 KLines/sec) [ 35.9%] + Fill Spans 3.013 secs (* 147.907 MPixel/sec) [ 73.4%] + Fill Spans (blend) 3.037 secs (* 73.369 MPixel/sec) [ 27.0%] + Blit 11.698 secs (* 56.023 MPixel/sec) [ 1.4%] + Blit colorkeyed 8.376 secs (* 59.464 MPixel/sec) [ 1.6%] + + TODO: more acceleration work... + +commit 19629048a342561cbaa3052eece6d2e75fbc3db2 +Author: Denis Oliver Kropp +Date: Wed Sep 10 13:39:32 2008 +0200 + + [SH7722] Fixed missing update of rendering destination buffer. + +commit b9080ea41cc5b711fa91269a0839d9fe5e0f4b35 +Author: Denis Oliver Kropp +Date: Wed Sep 10 13:39:02 2008 +0200 + + [windows] Set magic value in CoreWindow before calling WM functions. + +commit 7a005609bc7d15564dd11fe75476e71ba8659d74 +Author: Denis Oliver Kropp +Date: Wed Sep 10 11:07:57 2008 +0200 + + [SH7722] Fixed software fallback for JPEG decoding to unsupported formats. + +commit 09affae4b0301cca29b96305b473995d652e427f +Author: Denis Oliver Kropp +Date: Wed Sep 10 10:38:48 2008 +0200 + + [trace] Added missing dummies of new lookup functions for non-trace builds. + +commit 230ff7fdd3a660a19f1b06f664e7ac3f33630524 +Author: Denis Oliver Kropp +Date: Wed Sep 10 10:24:22 2008 +0200 + + [util] Added exported dfb_pixelformat_names[] and replaced relevant code. + +commit 6c311c746f706373dd19d043e6c4065c739c864d +Author: Denis Oliver Kropp +Date: Wed Sep 10 10:22:42 2008 +0200 + + [mknames] Generate separate declaration of value/name pair structures. + +commit 3869d4e007c82cfe58d094072dcbb81179e53410 +Author: Denis Oliver Kropp +Date: Wed Sep 10 09:30:32 2008 +0200 + + [generic] Get rid of YUV tables saving 5k binary size! + +commit 67a89c7383af3c49d7de0ea78904a82e693b4bf6 +Author: Denis Oliver Kropp +Date: Wed Sep 10 09:05:37 2008 +0200 + + [header] tab->space + +commit 1179e5c81de1312064d0c9475389e6c7b9e39e13 +Author: Denis Oliver Kropp +Date: Wed Sep 10 09:04:21 2008 +0200 + + [SDL] Replaced code in commented section by using dfb_convert_to_rgb16(). + +commit 392b6dfbd6ff69e54e6f31e81422e2da2e863e20 +Author: Denis Oliver Kropp +Date: Wed Sep 10 09:03:07 2008 +0200 + + [formats] Fixed many NV12, NV16 and NV21 code areas, mostly for big endian. + +commit edb133bd9b26baa21c641acaa0e05f2724260109 +Author: Denis Oliver Kropp +Date: Wed Sep 10 08:59:59 2008 +0200 + + [JPEG] Fix direct decoding to NV16 (no to+from RGB) for little endian. + +commit feb307b7c28a52ba38353e96a5816cd374909705 +Author: Denis Oliver Kropp +Date: Wed Sep 10 08:59:18 2008 +0200 + + [formats] Clarify definition of NV12, NV16 and NV21. + +commit c723856a84d1892eca64c5b7c3227e665a288c4b +Author: Denis Oliver Kropp +Date: Wed Sep 10 06:46:45 2008 +0200 + + [dfbtest_blit] Added test program for (Stretch)Blit with an image from file. + + Options: + -h, --help Show this help message + -v, --version Print version information + -s, --source Source pixel format + -d, --dest Destination pixel format + -r, --resize Set destination from source size + -b, --benchmark Enable benchmarking mode + +commit 391cf2c4c33738c114a40c0ba0edfffcdac24233 +Author: Denis Oliver Kropp +Date: Wed Sep 10 06:45:03 2008 +0200 + + [generic] Rewrote Dacc_RGB_to_YCbCr_C and Dacc_YCbCr_to_RGB_C using Duff's device with macros. + + Conversion also supports 4:4:4 by this change, not optimizing for 4:2:x cases. + +commit 687dd974b9531e71115dbf833ac7ec0c6e3b9bc3 +Author: Denis Oliver Kropp +Date: Wed Sep 10 06:42:51 2008 +0200 + + [convert] Fix missing parentheses around macro parameters in YCBCR_TO_RGB(). + +commit ce7dc5e548faef36201be5beb51d1311ef41c78a +Author: Denis Oliver Kropp +Date: Wed Sep 10 06:35:15 2008 +0200 + + [convert] Rewrote YCbCr<->RGB conversion routines without lookups which are much more expensive on embedded devices. + +commit 13425aeb1e3f28e7d595f578047f4dc3f069a5b4 +Author: Denis Oliver Kropp +Date: Wed Sep 10 03:26:18 2008 +0200 + + [options] New option "[no-]software-trace" to show every stage of the software rendering pipeline. + +commit 01ab1f314edb281b30913d9295a8571f450eca80 +Author: Denis Oliver Kropp +Date: Wed Sep 10 03:24:30 2008 +0200 + + [direct] Added file and symbol lookup functions to trace code for external usage. + + New functions are direct_trace_lookup_file(), direct_trace_lookup_symbol() and + a convenience function combining the above called direct_trace_lookup_symbol_at(). + +commit 59bbf8d99d59a9e6cf706bf4c4ad3f312905e019 +Author: Denis Oliver Kropp +Date: Thu Sep 4 01:02:36 2008 +0900 + + [README] Added some packages for autofoo... + +commit a37835f7cddd8920086d0f7aff812937f9c79368 +Author: Denis Oliver Kropp +Date: Sun Aug 24 21:24:06 2008 +0200 + + [default wm] Fixed crash with DWCAPS_NOFOCUS implementation. + +commit 47b59c53b7ca42c63b82710fd872081f8e82ed93 +Author: Denis Oliver Kropp +Date: Sun Aug 24 17:10:45 2008 +0200 + + [default wm] Implemented DWCAPS_NOFOCUS. + +commit 7ca1f65b1b5b9648c136ad60530199a63ac51648 +Author: Denis Oliver Kropp +Date: Sun Aug 24 17:10:19 2008 +0200 + + [IDirectFBWindow] Added DWCAPS_NOFOCUS: window will never get focus or receive key events, unless it grabs them. + +commit df96caeb46881c266cbd871d0ff8ef182e1eb2ff +Author: Denis Oliver Kropp +Date: Sat Aug 23 13:58:10 2008 +0200 + + [configure] Switch to pkg-config for SDL and FreeType2, thanks to Keith Mok! + +commit a812539bf6af796fb236762e75982b5d45b87eff +Author: Denis Oliver Kropp +Date: Fri Aug 22 20:32:30 2008 +0200 + + [input] Fixed boundary check for axis info array access. + +commit 967af1280ad5d103c086e8cdfa0200e31bf00892 +Author: Denis Oliver Kropp +Date: Fri Aug 22 20:01:45 2008 +0200 + + [sh7722] Build only for SH4. + +commit 2b7886ff4e966a3a9a8df499991092058019fc7d +Author: Denis Oliver Kropp +Date: Fri Aug 22 19:46:45 2008 +0200 + + [default wm] Use min/max values from absolute axis motion events if present. + +commit a7b2e45fa92d1914277bd25e44f2ea9a8703dad5 +Author: Denis Oliver Kropp +Date: Fri Aug 22 19:46:05 2008 +0200 + + [input] Query axis information from driver and put it into events. + +commit 615d54cfea5becdefd4bd388b7f61b7a9b3dcd3f +Author: Denis Oliver Kropp +Date: Fri Aug 22 19:41:40 2008 +0200 + + [IDirectFBInputDevice] Added DIEF_MIN/MAX and min/max to DFBInputEvent, e.g. for axis boundaries. + +commit 698d68a5c0afbf3e4e5f477c4da8e705d78adae8 +Author: Denis Oliver Kropp +Date: Fri Aug 22 16:44:26 2008 +0200 + + [input] Added GetAxisInfo() to InputDriverFuncs to query information about one axis. + + Make use of it in input_driver.h only if driver has defined DFB_INPUTDRIVER_HAS_AXIS_INFO + to avoid having to change all input drivers. + +commit 043cf5674b99087df7ceebe3749edf7f2268b68d +Author: Denis Oliver Kropp +Date: Fri Aug 22 16:44:10 2008 +0200 + + [IDirectFBInputDevice] Added DFBInputDeviceAxisInfo(Flags) with DIAIF_ABS_MIN/MAX flags and abs_min/max fields. + +commit b12044ecd6f738bfa28052fcc8b36c520dffe578 +Merge: 6832da9... 8d5f445... +Author: Niels Roest +Date: Thu Aug 21 17:29:30 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 6832da9ae538d5d062e820782e96114757ed8c3b +Author: Niels Roest +Date: Thu Aug 21 17:27:34 2008 +0200 + + [davinci] In ARGB OSD dithering use task buffer and add missing locks. + +commit 8d5f44551430c5e4005fd9b60edd27e9f383d00b +Author: Denis Oliver Kropp +Date: Thu Aug 21 11:34:08 2008 +0200 + + [sh7722] Fixes for JPEG encoding with conversion, cleanups... + +commit a29676ac604b3e3f9fa00543330464f77442c9a5 +Author: Denis Oliver Kropp +Date: Thu Aug 21 08:21:34 2008 +0200 + + [interfaces] Important fix for having multiple interface implementations in one module. + +commit 5b80d5d1bdec3e3334b4f9119d92f1cb3fcbcea1 +Author: Denis Oliver Kropp +Date: Tue Aug 19 11:21:52 2008 +0200 + + [windows] Added magic value to CoreWindow. + +commit 294a40d71c8173ba2e539721d8988e58ff5c9436 +Author: Denis Oliver Kropp +Date: Sat Aug 16 02:08:45 2008 +0200 + + [IDirectFBWindow] Added DWOP_FOLLOW_BOUNDS to make bounds follow the parent window. + +commit ca9c9600e0f1a8f1cb243eb7ecf22115c98669ec +Author: Denis Oliver Kropp +Date: Sat Aug 16 01:57:03 2008 +0200 + + [x11] Fixed new bug with reopening X11 window when layer resizes. + +commit b2611d5352b1548900202cc9418e6e83b4b81ca8 +Author: Denis Oliver Kropp +Date: Sat Aug 16 00:36:31 2008 +0200 + + [dfbtest_window] Implemented selection of individual tests for top/sub window and added option to wait at the end. + +commit e0a02568469a1325de9a5c4a3e9447571f390a1b +Author: Denis Oliver Kropp +Date: Fri Aug 15 22:59:18 2008 +0200 + + [dfbtest_window] Added options for setting window options and for window association. + +commit 63c4da3b3a720fd41a59e07c1344614f3956c9eb +Merge: 779b31c... 0148ec4... +Author: Denis Oliver Kropp +Date: Fri Aug 15 21:00:33 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 779b31c4fbddfc8890d4fb57bbf9ef93ebde62cc +Author: Denis Oliver Kropp +Date: Fri Aug 15 21:00:04 2008 +0200 + + [strings] Generate name/value pairs for DFBWindowOptions. + +commit 0148ec4dacbe599d9b10e0075237e87a8f064578 +Author: Niels Roest +Date: Fri Aug 15 20:09:50 2008 +0200 + + [x11] improve shutdown behaviour of X11 module. + + Certain race conditions at shutdown prevented, leading to lock or crash. + x11input and x11 modules combined into 1. + +commit 0b090e40b85160ce947d7b931f9a6ece54862d29 +Author: Denis Oliver Kropp +Date: Fri Aug 15 18:54:59 2008 +0200 + + [interfaces] Fix previous commit for unregistering interfaces, removing the proto type which had the old name. + +commit af62273b41eab8d66d6ff1cafe1941ef6f7f836d +Author: Denis Oliver Kropp +Date: Fri Aug 15 18:31:34 2008 +0200 + + [interfaces] Added DirectUnregisterInterface() and destructor to call it. + + Added magic value to interface implementation structure and use D_CALLOC/D_FREE. + +commit 47ec69f0cb945a74269859a91c2b359deb6d0660 +Author: Denis Oliver Kropp +Date: Fri Aug 15 16:40:50 2008 +0200 + + [dfbtest_window] Added advanced window geometry tests. + +commit f6b440a1b7beb0ccb6984930422c2ae65accb7e3 +Author: Denis Oliver Kropp +Date: Wed Aug 13 19:12:04 2008 +0200 + + [dfbtest_window] Enhanced testing and logging code. Run most tests on sub window, too. + +commit 4124b63f7f897408c9c5ef7b62fed029dd62a64e +Author: Denis Oliver Kropp +Date: Wed Aug 13 19:08:55 2008 +0200 + + [dfbmaster] Added very simple dedicated master for safety, stability or enhanced testing pleasure. + +commit 4a3d91bc149d25a6dfaf77b58418d86295033ae1 +Author: Denis Oliver Kropp +Date: Wed Aug 13 06:14:49 2008 +0200 + + [default wm] Build fix for previous commit that reduces recursion. + +commit 4596df5e093d5b054f38780577a5fb02252792e5 +Author: Denis Oliver Kropp +Date: Wed Aug 13 06:05:55 2008 +0200 + + [default wm] Make sure window has a surface before restoring its size when disabling scaling. + +commit efb4e64a74157b65458ed4c4e297ab3a2b307fca +Author: Denis Oliver Kropp +Date: Wed Aug 13 06:05:02 2008 +0200 + + [strings] Generate name/value pairs for DFBWindowCapabilities. + +commit e27b49141e988748b059f1672a6d98a3baf02389 +Author: Denis Oliver Kropp +Date: Wed Aug 13 06:04:07 2008 +0200 + + [dfbtest_window] New option to pass window caps for top or sub window. + + Fixes for input only windows, e.g. don't try to grab surface :) + +commit 6b6803f94de9da390c32e029211d8c10aba1113e +Author: Denis Oliver Kropp +Date: Wed Aug 13 05:07:11 2008 +0200 + + [x11] Implemented primaryRemoveRegion() with a new call to destroy the X11 window. + + Also cleaned up name of window creation call (set_video_mode -> create_window). + +commit e66998a2459aca790752a7511eab41239112c372 +Author: Denis Oliver Kropp +Date: Wed Aug 13 05:06:20 2008 +0200 + + [dfbtest_window] Added test that hides the top level window and shows it again. + +commit 603158aaa73dbf713cf1b66692ec179c6668f8ce +Author: Denis Oliver Kropp +Date: Wed Aug 13 04:27:31 2008 +0200 + + [subwindows] Destroy all sub windows first in window destruction code. + +commit fcb4bd03e2dda669f8c221d236a3828af50f58f7 +Author: Denis Oliver Kropp +Date: Wed Aug 13 04:24:46 2008 +0200 + + [dfbtest_window] Added more options, window destroy test and proper cleanup. + + Added -p / --pos for top level position and added a sub window version of each top level option. + + New test at the end destroys the top level window. + + Remember top level (if created) and sub window and release them before exit. + +commit 285b2ccbbcb41c5e6655edd7ebb1974a6bb89cf9 +Author: Denis Oliver Kropp +Date: Wed Aug 13 03:27:54 2008 +0200 + + [default wm] Avoid most of the recursive calls of wind_of_change(). + +commit ebfdb3cf9d20b43475ad9375e028e965ae2cc7e6 +Author: Denis Oliver Kropp +Date: Wed Aug 13 00:55:38 2008 +0200 + + [x11] Fixed race condition and X error when switching resolution quickly. + +commit d934bdd21fb0ca42e86e5c7e0c2c146fa2e1c820 +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:25:28 2008 +0200 + + [x11] More X locking and checks for input thread exit... still not satisfied... + +commit da6fcf72c6b101f8890a1d08d513eda67935343c +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:23:19 2008 +0200 + + [dfbtest_window] Added new program for testing window and sub window features :) + + Tests done right now: + - create top level + - create sub window + - move top level + - scale top level + +commit d1072e7e22013eb0a12f997950499da0b5d2b5eb +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:18:11 2008 +0200 + + [IDirectFBWindow] Initial checkin of sub window support (one level only for DirectFB 1.4)... + + Added DWCAPS_SUBWINDOW, DWDESC_TOPLEVEL_ID and "toplevel_id" to DFBWindowDescription. + + Manage ref to top level window and vector of sub windows in window core, but leave scaling, + translation and clipping of sub window bounds based on top level bounds to the WM module. + + Cleaned up IDirectFBWindow method order... + +commit 0ad26c8f57494bca399f09133e04bef17f9f0521 +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:15:54 2008 +0200 + + [windows] Added lock and ref around dfb_wm_close_stack() in dfb_wm_close_all_stacks(), added context magic and lock assertions everywhere! + +commit 535061197082f993d05f9dd28c3b231cfdf49423 +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:14:46 2008 +0200 + + [windows] Added missing locks around direct dfb_wm_... calls... + +commit e9ba4041cea208c442d6a5d0b1f0a5fd9a46fb1f +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:13:37 2008 +0200 + + [layers] Added magic vaue to CoreLayerContext structure, improved debug messages. + +commit 9422d85f922a740ec06a0f5e0955a9eaf419e194 +Author: Denis Oliver Kropp +Date: Tue Aug 12 14:08:37 2008 +0200 + + [version] 1.3.0 :-) + +commit 85f0417c8392b37ec9543e64e1a1c3a2d2f5703d +Author: Denis Oliver Kropp +Date: Tue Aug 12 10:56:35 2008 +0200 + + [layers] Added debug message to print context being returned by dfb_layer_get_active_context(). + +commit 21067461e719feaafbb404dfd0fe18f61ac01138 +Author: Denis Oliver Kropp +Date: Tue Aug 12 10:47:03 2008 +0200 + + [IDirectFBSurface_Window] Added missing layer context locking around dfb_wm_get_insets() in IDirectFBSurface_Window_Construct(). + +commit 43cc1713fd9dee2e6c8f9d65ef0d6192187b6a37 +Author: Denis Oliver Kropp +Date: Tue Aug 12 10:20:27 2008 +0200 + + [layers] Fixed failing context lock assertion in dfb_wm_close_stack() by locking in context destructor. + +commit b00124a5811ba90ca84dab646d42ef8f6a5b184f +Author: Denis Oliver Kropp +Date: Tue Aug 12 10:15:21 2008 +0200 + + [fusion] Fixed single app skirmish lock counting (copy'n'paste bug). + +commit a21e4cd136e7b293eb3c2d2f4b8e1426db8b195f +Author: Denis Oliver Kropp +Date: Tue Aug 12 08:27:39 2008 +0200 + + [windows] Avoid recursive dfb_wm_close_stack() caused by SaWMan's CloseStack() unref on the layer region. + + This issue happens only in single app build, where the layer region constructor gets called synchronously + and destroys the window stack structure before the dfb_wm_close_stack() has finished. + + Fixed by calling CloseStack() at the end dfb_wm_close_stack(), moving the list removal and flag clearing + before the call and freeing the stack data in dfb_windowstack_destroy() or recurring dfb_wm_init_stack(). + +commit b15eb23d6e53f9bb1638575f97e1a6c31a8ef690 +Author: Denis Oliver Kropp +Date: Fri Aug 8 16:39:50 2008 +0200 + + updated TODO + +commit 550bb3a859161a6ce613dfebebe8b0c86b5701b3 +Author: Denis Oliver Kropp +Date: Fri Aug 8 16:00:31 2008 +0200 + + updated ChangeLog + +commit 8881c385160ebb1fbf20093755866c1f29b1993f +Author: Denis Oliver Kropp +Date: Fri Aug 8 15:59:01 2008 +0200 + + Updated NEWS for 1.2.1 release + +commit 3a7f7c9872db39a131bfec3be411568ecaa356d0 +Author: Denis Oliver Kropp +Date: Fri Aug 8 15:56:00 2008 +0200 + + [keyboard] Only become active if FBDev or DevMem is used to avoid grabbing keyboard from X11 for example. + +commit 7a34de0dd8584cc4c5bc4ab20288099e1c535177 +Author: Denis Oliver Kropp +Date: Fri Aug 8 15:47:42 2008 +0200 + + [fbdev] Update surface manager code from X11 virtual physical testing pool. + +commit c450bca736be7850a064ae3071d560a948fdcd5e +Author: Denis Oliver Kropp +Date: Fri Aug 8 15:47:05 2008 +0200 + + [devmem] Update surface manager code from X11 virtual physical testing pool. + +commit 5de1c0424fdd7a08288f071cd2e891a87c78b70e +Author: Denis Oliver Kropp +Date: Fri Aug 8 14:59:18 2008 +0200 + + [x11] Set buffer lock offset in fallback mode to satisfy assumption in surface core. + +commit dca79d97500dab35ff3a6c407b6a9c191bdeec44 +Author: Denis Oliver Kropp +Date: Fri Aug 8 14:58:15 2008 +0200 + + [surfaces] Cleanup buffer initialization and reset with two new convenience functions. + +commit 11703ae62d1e7246dd55d755b8b1a742c047cae4 +Author: Denis Oliver Kropp +Date: Fri Aug 8 11:34:04 2008 +0200 + + [IDirectFBSurface] Fix Lock() on layer surfaces with system memory back buffer. + + This reverts commit 4cc82baddbc3a9849c2ff6c4979a65bcfb6ba96b and fixes + GetFramebufferOffset() properly by not adding CSAF_GPU_READ in Lock(), but + checking if there's a physical address provided by the surface pool via the + buffer lock in GetFramebufferOffset(). + +commit 79332a26310c7b03abe059c08b1a0d087f7ed14b +Author: Denis Oliver Kropp +Date: Fri Aug 8 11:33:36 2008 +0200 + + [dfblayer] Add testing Lock() with read/write, read only or write only. + +commit 56a7aefda6b61c18167574a564defeb5c6058c3d +Author: Denis Oliver Kropp +Date: Tue Jul 29 05:44:41 2008 +0200 + + [sh7722] Build fix (link against libdirectfb for dfb_pixelformat_name). + +commit 435ca9a063582bbafe07563b0c1d3d9c4044268d +Author: Denis Oliver Kropp +Date: Tue Jul 29 05:37:54 2008 +0200 + + [sh7722] JPEG encoding, code moved into library, JPEG lock and buffer allocation in kernel + +commit aa8fd4aa6d4261979900a3c51a4aa5ff926e3e09 +Author: Denis Oliver Kropp +Date: Tue Jul 29 04:35:01 2008 +0200 + + [IDirectFBImageProvider] Added simple WriteBack() method for encoding surface data. + +commit 871bc2ac72d15c1cb2f8f702e268e2774d7b2b0e +Author: Denis Oliver Kropp +Date: Tue Jul 29 04:34:36 2008 +0200 + + [options] Fixed warning. + +commit db4030c985b3b824c0986b95a4ec9d92325f7cd0 +Author: Denis Oliver Kropp +Date: Tue Jul 29 00:26:56 2008 +0200 + + [x11] Return accelerator as set in config. + +commit 62c8ed26e0585926c7d9ce16e8c8bba02ad3d356 +Author: Denis Oliver Kropp +Date: Fri Jul 25 16:56:56 2008 +0200 + + [config] Allocate palette on demand saving 16kB of the 60kB allocated until after DirectFBCreate(). + +commit 99f4fd47a12f26d8ddae00101b354563ea863ca1 +Author: Denis Oliver Kropp +Date: Fri Jul 25 16:42:12 2008 +0200 + + [options] Added "keep-accumulators = " to allow freeing of accumulators above the limit. + + Setting -1 never frees accumulators until the state is destroyed (previous behaviour). + + The default is 1024 which already means up to 16kB are kept! + +commit 9c09c56afb9c3b2d491d27ab4ac292d13d997fdd +Author: Denis Oliver Kropp +Date: Fri Jul 25 16:06:41 2008 +0200 + + [surface] Use fusion_ref_set_name() to show the same info as with the skirmish. + + TODO: Update information on both when surface is reconfigured! + +commit c326ef6b5556111a870d4cce2b66f41401185999 +Author: Denis Oliver Kropp +Date: Fri Jul 25 16:06:04 2008 +0200 + + [fusion] Added fusion_ref_set_name(), e.g. for better debug information on object references. + +commit b180da246613406fec27abbe2139fed2cafbedf1 +Author: Denis Oliver Kropp +Date: Fri Jul 25 16:00:48 2008 +0200 + + [options] New option "warn=" to print warnings on surface/window creation or surface buffer allocations. + + Example: + warn = allocate-buffer:300x300 + + Prints a warning for every surface buffer allocation made with both width and height of 300 or above. + +commit 4abe47f51b2164e37632566dd300e7f69548ff9c +Author: Denis Oliver Kropp +Date: Wed Jul 23 15:53:22 2008 +0200 + + [x11] Build fix. + +commit 5730f838a7ac3b39b5e83e3bc7cea197fac513ed +Merge: 701aa94... d9461ad... +Author: Denis Oliver Kropp +Date: Wed Jul 23 15:51:47 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit d9461ad5e8e46a5d0f8f1279f214bce64c9bfb0b +Author: Denis Oliver Kropp +Date: Wed Jul 23 15:28:23 2008 +0200 + + [x11] Build fix. + +commit b815d1b7adb82c9791fc31e546a8e3e8bbbfd73a +Author: Denis Oliver Kropp +Date: Wed Jul 23 15:24:47 2008 +0200 + + [version] Also increase binary age (don't think compatibility is broken). + +commit 701aa94e931d85cd18b0b5ff47a32beeb1472fec +Merge: f00bc9f... 10fc3aa... +Author: Denis Oliver Kropp +Date: Wed Jul 23 14:59:27 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit f00bc9fc3a4febd48b159f6534068552917a8610 +Author: Denis Oliver Kropp +Date: Wed Jul 23 11:05:29 2008 +0200 + + [x11] Enhance surface manager to find the best matching group of allocations to muck out. + + This is the first time multiple smaller allocations can be mucked out for a bigger one. + The code that determines these allocations is still O(1) and finds the best matching + group within all possible combinations. + +commit 3a607bdc5cae5e0766b4962794741b7476db496e +Author: Denis Oliver Kropp +Date: Wed Jul 23 11:03:46 2008 +0200 + + [surfaces] Fixes for mucking out multiple allocations. Cleanups. + +commit 97727598045878dba91d7f61d3bb77d9acf61b3f +Author: Denis Oliver Kropp +Date: Mon Jul 21 18:17:16 2008 +0200 + + [x11] Enhancements to surface manager code and fixes for old behaviour (without virtual physical surface pool). + + Extend dfb_surfacemanager_displace() to check policies, reimplement toleration code + and take free space before and after an occupied chunk into account. + + Cleanup dfb_surfacemanager_allocate() to only check for free chunks. + + Always initialize x11(Shm)Image surface pool, regardless of virtual physical + surface pool being enabled. + + Never fail in x11TestConfig() if virtual physical surface pool is not enabled, + but use Fusion shared memory allocations as a fallback (previous behaviour). + + Update allocation size from chunk length which is usually bigger (at least 16 + bytes of safety area). + +commit 29ab6ef9f3d1e978d99a6523b429398e8df8edf1 +Author: Denis Oliver Kropp +Date: Mon Jul 21 18:07:07 2008 +0200 + + [surfaces] Enhanced backup strategy when mucking out allocations. + + First check if any of the existing allocations is up to date, + otherwise try to update one of the existing allocations. + + Enforce same order of joining pools as of initializing them. + + Fixed invalid 'buffer->written' allocation pointer when using "thrifty-surface-buffers" option. + + Fixed wrong order of joining surface pools in slaves. + + Other fixes and enhanced debugging output. + +commit 10fc3aa44ee4c79f06c87a44aecd51a027f6fed5 +Author: Denis Oliver Kropp +Date: Mon Jul 21 18:00:21 2008 +0200 + + [misc] Bumped version to 1.2.1 and did forgotten increase of the core ABI. + +commit 01b57b96155cbcb512218dca1a7997866fb3e0ae +Author: Denis Oliver Kropp +Date: Mon Jul 21 13:35:05 2008 +0200 + + [x11] XShm fixes and new virtual physical surface pool for development and testing. + + Specifying 'video-length = ' option will create a shared memory block of that + size and initialize a surface pool with a surface manager supporting the new MuckOut() call. + + Changed x11(Shm)Image pool to only allow allocations for supported visuals (no fallback + shared memory allocations) when the new option is used. + + Return accelerator ID 51 for testing with the virtual acceleration (currently called vmware). + + Make usage of XShmQueryVersion() to check for XShm support. + + Other cleanups and fixes. + +commit 03c500eea0451a8164090f86f5ff9ae1a529aeeb +Author: Denis Oliver Kropp +Date: Mon Jul 21 13:33:24 2008 +0200 + + [surfaces] Implemented strategy for surface allocations when pools are out of memory. + + Extended dfb_surface_pools_negotiate() to return a list of capable pools order by priority + including pools out of memory at the end of the list. + + Added MuckOut() to the surface pool API to tag all allocations for removal to free up memory + for a new allocation. If not provided by the pool, a fallback implementation will do the job, + but that's not implemented yet. + + Added dfb_surface_pool_displace() to muck out and backup allocations and do the new allocation. + + Moved allocate_buffer() from surface buffer to surface pool code as dfb_surface_pools_allocate() + with extended negotiation using a list of possible pools and with ability to muck out allocations. + + Changed static update_allocation() to exported dfb_surface_allocation_update(). + + Added dfb_surface_trylock() for a fusion_skirmish_swoop() on the surface lock. + + Call dfb_surface_lock() and dfb_surface_unlock() in surface_destructor(). + + Moved surface core initialization before system module to have generic pools always at + the same position (with the same pool IDs). + + Keep an ordered list of surface pool IDs based on priority. + + Have a pointer to a backup pool in every pool which is set to the shared memory surface pool by default. + +commit 5ffb341a6f716bfc900bd722317dd63451911e0b +Merge: c148939... d5bda88... +Author: Denis Oliver Kropp +Date: Mon Jul 21 13:32:34 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit c148939c7c01ffc6f4491dc7fb9339180c9350af +Author: Denis Oliver Kropp +Date: Mon Jul 21 12:57:00 2008 +0200 + + [surfaces] Use convenience functions where possible, e.g. dfb_surface_lock_buffer() instead of dfb_surface_get_buffer() and dfb_surface_buffer_lock() etc. + +commit d5bda88808477881fa5fc58f9684aa1bd0867d83 +Author: Denis Oliver Kropp +Date: Mon Jul 21 12:57:00 2008 +0200 + + [surfaces] Use convenience functions where possible, e.g. dfb_surface_lock_buffer() instead of dfb_surface_get_buffer() and dfb_surface_buffer_lock() etc. + +commit 0c9a7dca0bd288479c773191435042b6853e273f +Author: Denis Oliver Kropp +Date: Mon Jul 21 12:56:08 2008 +0200 + + [windows] Shutdown fixes in the window management and new flags for the state of the stack. + + Added CoreWindowStackFlags with CWSF_INITIALIZED and CWSF_ACTIVATED to CoreWindowStack. + + In dfb_wm_close_all_stacks() simply call dfb_wm_close_stack() for any stack with CWSF_INITIALIZED set. + The previous code did only half of it, just clearing context->stack pointer and clearing the magic value + resulting in the notification handler for the background image accessing a stack structure without magic. + + In dfb_wm_close_stack() first deactivate the stack if CWSF_ACTIVATED is set. + + Safe state handling in dfb_wm_set_active(). + + Moved magic value set/clear from wm.c to windowstack.c where the structure is allocated and freed. + + Check return value of dfb_wm_init_stack(). + +commit c32441475ff21fbbae477129310a9d594a7cb72d +Author: Denis Oliver Kropp +Date: Sun Jul 20 15:13:21 2008 +0200 + + [x11] Output ARGB when depth is 32, support AYUV input (layer format). + +commit 38d4b138168b56330c54f3bb92673f5017444f6b +Author: Denis Oliver Kropp +Date: Sun Jul 20 15:03:15 2008 +0200 + + [dfbdump] Show capacity in pool info (with "-p") and only dump shared or explicitly specified surfaces to avoid crashes. + +commit c2bea38a0855e8c7e050e693a4e36705026bc92a +Author: Denis Oliver Kropp +Date: Sun Jul 20 15:00:08 2008 +0200 + + [convert] Added conversion to RGB555 and from AYUV (added to all conversion functions). + +commit cc328caa46510e5b0e185edbb17bd732b40a3d8a +Author: Denis Oliver Kropp +Date: Sun Jul 20 14:59:26 2008 +0200 + + [surfaces] A bit more debug when locking buffers. + +commit c319b6a969a064a83e7e7da308daaca7fb1f4866 +Author: Denis Oliver Kropp +Date: Sun Jul 20 14:58:31 2008 +0200 + + [virtual2d] Fixed copy'n'paste bug in virtual driver. + +commit edaf0352f0a90ef68ef0b571fb1fe52abb5907df +Author: Denis Oliver Kropp +Date: Sun Jul 20 14:57:39 2008 +0200 + + [surfaces] Cleanup complex assertions, no CORE_SURFACE_ALLOCATION_ASSERT within CORE_SURFACE_BUFFER_LOCK_ASSERT, only D_ASSERTs. + +commit 95d25625adbd57ac04dd5a04f42a2b3d1056fd52 +Author: Denis Oliver Kropp +Date: Sun Jul 20 01:06:48 2008 +0200 + + [layers] Fix failing assertion due to recent code cleanup. + +commit 123d8d07824ab4112350d763bb21ababb5b343fb +Author: Denis Oliver Kropp +Date: Sun Jul 20 01:05:28 2008 +0200 + + [fusion] Clear object list (pointer to NULL) after cleanup for safety. + +commit d52e27ac0165199dc90987bba232474b31bf6385 +Author: Denis Oliver Kropp +Date: Sun Jul 20 01:02:17 2008 +0200 + + [fusion] Print warning for FUSION_CALL_RETURN if caller could not receive result due to a signal. + +commit f7eee07eac4bf0cf6ca96ac03c77b7c447b32e74 +Author: Denis Oliver Kropp +Date: Tue Nov 21 04:56:02 2028 +0100 + + [x11] Fixed bytes per pixel and pitch calculation for fallback XCreateImage() when no XShm is available. + +commit e766efa2b9cac28d76fc014774bb9f28e15df70e +Author: Denis Oliver Kropp +Date: Tue Nov 21 04:55:54 2028 +0100 + + [x11] Take first matching visual for each format instead of last and handle RGB32 and ARGB separately (depth 24 and 32). + +commit 84059022f5d1bcaf685b38d6a5009230c663d652 +Author: Denis Oliver Kropp +Date: Tue Nov 21 04:55:37 2028 +0100 + + [fusion] Fixed dead lock with references in single app mode. + + fusion_ref_zero_lock() no longer leaves the mutex locked. Turned + 'waiting' into 'locked' to keep size for binary compatibility. + +commit a39849d8bb11301ec3d5c2420b026f7dbaa0e5a7 +Author: Denis Oliver Kropp +Date: Sat Jul 19 04:52:11 2008 +0200 + + [devmem] Partially reverted cleanup of surface manager code. + + The workaround for the surface manager creation happening before graphics driver + initialization with possible dfb_gfxcard_reserve_memory() calls is still required. + +commit 811ee7208e30cf72d98e44cbc7a672eb589a6337 +Author: Denis Oliver Kropp +Date: Mon Jul 14 02:45:07 2008 +0200 + + [IDirectFBSurface] Added MakeSubSurface() to make this surface a sub surface or adjust the rectangle of this sub surface. + +commit dac4a5fe8c43205ca9854f48183134325e8897c8 +Author: Denis Oliver Kropp +Date: Sun Jul 13 16:28:43 2008 +0200 + + updated once more + +commit 7cb19857f5e3feb6d6daf43bffbc52ce28ddd2ff +Author: Denis Oliver Kropp +Date: Sun Jul 13 16:28:06 2008 +0200 + + 1.2.0 + +commit 7bbab526840d15886dbdbe62ab8691f9b40df1e2 +Author: Denis Oliver Kropp +Date: Sun Jul 13 16:25:25 2008 +0200 + + [IDirectFB] Don't check for input device caps in CreateEventBuffer_Callback() which are checked already. + + This also fixes missing events from devices without caps. + +commit 14ddb08b822effda0884155353d30ec8f65c890d +Author: Denis Oliver Kropp +Date: Sun Jul 13 15:55:30 2008 +0200 + + [x11] Don't use XShm for offscreen surfaces, but always use Fusion SHM. + + Other cleanups and input thread cancellation fixes. + +commit bf9272493b021d4b4b4b32d81b5306e667a10e2a +Author: Denis Oliver Kropp +Date: Sun Jul 13 13:34:14 2008 +0200 + + [x11] Make visual info just debug messages, better error message on XOpenDisplay() failure. + +commit 02779f1f765085f6e54c517593f9fd9c5567255d +Author: Denis Oliver Kropp +Date: Sun Jul 13 13:33:39 2008 +0200 + + [core] Call dfb_wm_close_all_stacks() only if already initialized. + +commit 2c111d0071809171482554f412ea43bdc3ad9740 +Author: Denis Oliver Kropp +Date: Fri Jul 11 17:02:06 2008 +0200 + + [util] Optimized dfb_updates_add() incl. usage of dfb_region_region_extends() to combine adjacent regions. + +commit ae3258c3c457a12de52b59ed515d5513e915fb71 +Author: Denis Oliver Kropp +Date: Fri Jul 11 17:00:03 2008 +0200 + + [util] Added dfb_region_region_extends() returning true if both regions' number of pixels added equals to number of pixels of their bounding box. + +commit b4102221ad64904f414bc90464b02a2df6f444bf +Author: Denis Oliver Kropp +Date: Thu Jul 10 01:25:08 2008 +0200 + + [input] If a device has no caps at all, let it match with any caps being requested. + +commit 1f5c911d6fb78100b8558180244582b13351bd7d +Author: Denis Oliver Kropp +Date: Thu Jul 10 01:07:36 2008 +0200 + + [option] New runtime option "thread-priority-scale=<100th>" to apply a scaling factor on thread type based priorities. + +commit 5a0efaa2c12ba5eb260401e552718de71b07e475 +Merge: 111cd2d... 568cff6... +Author: Denis Oliver Kropp +Date: Thu Jul 10 00:14:43 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 111cd2dba120b89c05206ca7656c253dfe94f1fb +Author: Denis Oliver Kropp +Date: Thu Jul 10 00:14:09 2008 +0200 + + [core] Only suspend the input core during shutdown if it has been initialized already. + +commit 568cff642107feb98c8a9b4ad3e057745811058a +Merge: a6dcfee... 7490602... +Author: Denis Oliver Kropp +Date: Thu Jul 10 00:13:05 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit a6dcfee1f13b9cfccf5c71114714cc175411c154 +Author: Denis Oliver Kropp +Date: Thu Jul 10 00:01:36 2008 +0200 + + [wm] Keep a list of window stacks, added dfb_wm_close_all_stacks() called early during core shutdown. + + Fixes shutdown misbehaviour. + + Added D_MAGIC_ASSERT() for CoreWindowStack functions. + +commit 16afac667b5927bba5637fbb5d71983a8e4ad09c +Author: Denis Oliver Kropp +Date: Wed Jul 9 23:54:54 2008 +0200 + + [interfaces] Turn error from missing interface directories into a debug message. + +commit 7490602e83e5e3b6a9af0aa90fa151f60e4e1920 +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:42:39 2008 +0200 + + [nvidia] Indicate CCF_RENDEROPTS (render options support). + +commit 01558be062fbbf0c210382f80f7cda34a31e5783 +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:42:23 2008 +0200 + + [radeon] Indicate CCF_RENDEROPTS (render options support). + +commit 930bdad51885bc118bda98cab5655ab926b1459d +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:41:54 2008 +0200 + + [sh7722] Indicate CCF_RENDEROPTS (render options support). + +commit d12c253cbac831940334f5fcbccc8eddd3e505c3 +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:40:31 2008 +0200 + + [graphics] Added CCF_RENDEROPTS that needs to be set by the driver to allow acceleration when != DSRO_NONE. + +commit 4491f78d48bf268e72b9aebedeb2cfac14199727 +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:28:31 2008 +0200 + + [vnc] Builds, runs again, but looks wrong... + +commit f990c1afe695d188d086851902147ac80b996ffc +Author: Denis Oliver Kropp +Date: Wed Jul 9 20:27:39 2008 +0200 + + [layers] Check if region surface is system only and avoid using CSAF_GPU_READ which would fail. + +commit 3f09498bd5a57e33334242cd6c187b288c55b53e +Author: Denis Oliver Kropp +Date: Wed Jul 9 19:25:30 2008 +0200 + + [sdl] Small fix using mod_hw instead of modified. + +commit 406e279d55aeb22009dd5e8ebb7b5ef7bc099ff0 +Author: Denis Oliver Kropp +Date: Wed Jul 9 18:33:29 2008 +0200 + + [CirrusLogic] New EP9xx driver, thanks to Brian Austin! + +commit 56279c0acf016858a180fa4bbd405df53bb39b88 +Author: Denis Oliver Kropp +Date: Wed Jul 9 07:28:31 2008 +0200 + + [test] Added reinitialization test program. + +commit d697b7310b3bddb4c649f437f8b0ac0c02ca2ff9 +Author: Denis Oliver Kropp +Date: Wed Jul 9 06:53:15 2008 +0200 + + [mem] Doh! ...doh! .....Dooooh! Actual realloc() was missing in runtime-disabled debug mode. + +commit 8d262f21b2eb83dda14f73370ea53c62f4ec2122 +Author: Denis Oliver Kropp +Date: Tue Jul 8 20:15:27 2008 +0200 + + [gfxutil] Changed dfb_convert_to_*() functions from static inline to non-inline. + +commit 9cd095ba55897a2431c9e07b7da4c72c1e82ac86 +Author: Denis Oliver Kropp +Date: Tue Jul 8 20:11:09 2008 +0200 + + [x11] Added missing check of layer pixel format based on conversion routines available. + +commit 2298104d1af5ea8736e75287e77ddc4db9731ad3 +Author: Denis Oliver Kropp +Date: Tue Jul 8 19:50:57 2008 +0200 + + [linux_input] Thanks to Phil Endecott for adding F13 to F24 support! + +commit 32adbf9ba07da09927e84c7bc5c973b131d5b176 +Merge: eaea0e3... ef9efd7... +Author: Denis Oliver Kropp +Date: Tue Jul 8 19:31:13 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit eaea0e34702b7bcb8839b6df0397cbe313d4dd7f +Author: Denis Oliver Kropp +Date: Tue Jul 8 19:30:32 2008 +0200 + + [pixelformats] This patch adds BGR555 as a new pixel format, thanks to GARDET Guillaume! + +commit ef9efd7e9179cb7bb3a1528437aa752831e7c781 +Merge: 22c876f... c8255c8... +Author: Denis Oliver Kropp +Date: Tue Jul 8 14:34:31 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit c8255c8d85f608c5e6a4573689e993530c17004d +Merge: d00dbd4... 701bf91... +Author: Denis Oliver Kropp +Date: Tue Jul 8 14:34:22 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit d00dbd4512f9caf29e0768cc33e0e10a66adb2ce +Author: Denis Oliver Kropp +Date: Tue Jul 8 12:52:38 2008 +0200 + + [IDirectFBFont] Bug fixes in GetStringBreak(), thanks to Keith Mok! + + 1.) The ret_next_line is not initialized, so if the initial string is too long without delimiter, "if (*ret_next_line == NULL)" will not run. + + 2.) If the initial string is too long without delimiter, the return string should be minus one character since the width had already longer than the input width. + Should keep the width within input width unless only one character. + + 3.) The return length should not minus one when whole string is within input width, otherwise one character is cropped. + +commit 22c876fcc30d48920ebe47856cff79c889b11165 +Author: Denis Oliver Kropp +Date: Tue Jul 8 11:54:22 2008 +0200 + + [windows] Fixed missing return value. + +commit 0c90ba1bd190da49b9e957dea0820e4c17962315 +Author: Denis Oliver Kropp +Date: Tue Jul 8 11:54:06 2008 +0200 + + [layers] Fixed warning in non-debug mode. + +commit 89bb501307b4904cf3c45f24a09c3da3e286b196 +Author: Denis Oliver Kropp +Date: Tue Jul 8 11:53:00 2008 +0200 + + [IDirectFBVideoProvider] Fixed copy'n'paste(?) bug in SetStreamAttributes() argument. + + The argument was DFBStreamDescription, but obviously should be DFBStreamAttributes. + +commit 701bf9100f84f44b894661799b455e67c4fd2158 +Author: Denis Oliver Kropp +Date: Mon Jul 7 10:33:48 2008 +0200 + + [fbdev] Ignore panning errors as before. + +commit 80d913df4165389dc06767548420813784f6052f +Author: Denis Oliver Kropp +Date: Mon Jun 30 15:32:17 2008 +0200 + + [davinci] Added local task buffer for preparing a list of commands and send at once. + + This avoids overhead due to uncached task control structure being accessed for every + task that is added. A new function will emit all tasks at once using memcpy() that allows + write combining on the uncached area. + + Changed all 2D rendering to use new functions for preparing tasks reducing CPU load in + DrawString(), FillSpans() etc. + + Benchmarking 256x256 on 800x580 ARGB (32bit)... + + Anti-aliased Text 3.085 secs (* 208.881 KChars/sec) [ 87.9%] + Anti-aliased Text (blend) 3.084 secs (* 208.949 KChars/sec) [ 89.6%] + Fill Rectangle 27.189 secs (* 44.351 MPixel/sec) [ 2.5%] + Fill Rectangle (blend) 27.334 secs (* 44.355 MPixel/sec) [ 2.3%] + Fill Rectangles [10] 28.063 secs (* 44.371 MPixel/sec) [ 0.8%] + Fill Rectangles [10] (blend) 28.065 secs (* 44.367 MPixel/sec) [ 0.6%] + Fill Spans 3.115 secs (* 35.766 MPixel/sec) [ 25.4%] + Fill Spans (blend) 3.117 secs (* 35.743 MPixel/sec) [ 20.9%] + Blit 40.124 secs (* 28.910 MPixel/sec) [ 1.6%] + Blit colorkeyed 36.324 secs (* 32.295 MPixel/sec) [ 2.0%] + Blit from 32bit (blend) 38.073 secs (* 30.639 MPixel/sec) [ 1.9%] + Blit from 32bit (blend) with colorizing 38.065 secs (* 30.646 MPixel/sec) [ 2.2%] + Stretch Blit 105.843 secs (* 16.893 MPixel/sec) [ 0.6%] + +commit 19699fb58779a3a46f53a9820b4b5c68ad21c734 +Author: Denis Oliver Kropp +Date: Mon Jun 30 15:30:01 2008 +0200 + + [davinci] Set address back from 0x86000000 to 0x8e000000 for using the uncached window at 0x8f000000. + + The address wraps around when 128MB are available instead of 256MB. + +commit 028288dcd22009d2060755256cd857579592692e +Author: Denis Oliver Kropp +Date: Mon Jun 30 15:10:18 2008 +0200 + + [layers] Added CLRCF_FREEZE for dfb_layer_region_set_configuration() to set CLRSF_FROZEN. + + Changes are not applied until dfb_layer_region_flip_update() is called. + +commit bd8749232bd22df253a3e99c02a230f54f12e089 +Author: Denis Oliver Kropp +Date: Tue Jun 24 16:49:32 2008 +0200 + + [davinci] Fixed timeout detection in DAVINCI_IOCTL_WAIT_LOW. + + - reduced polling frequency from 1/HZ sec to 1/50 sec with an allowed + total of almost one second while still running the same command (DSP stuck) + - or timeout immediately (after 1/50 sec) if idle counter changed (DSP felt idle) + + - enhanced queue dump on timeout + - disabled user space write combine on control structure (just one member written) + +commit 1640375755e5bab96a21be1a697fb65c18b4e5a3 +Author: Denis Oliver Kropp +Date: Tue Jun 24 05:09:45 2008 +0200 + + [davinci] Added scaling support to video layer using the Davinci Resizer. + + Surface buffers must be allocated in devmem as the fb memory of the layer + is used to store the resized data. Applications can set source and destination + rectangles as with other scaled layers, but a Flip() is always required to + show updates even in a single buffer mode. + + Minor fixes and cleanups. + +commit 7f861b88953fd1d064acb77ada8d51fd2a44fa75 +Author: Denis Oliver Kropp +Date: Tue Jun 24 03:54:58 2008 +0200 + + [davinci] Commented out davinci_c64x_write_back_all() in EngineSync() which is still not working properly anyhow. + +commit 20ce5efe7bbc98b0c3e89570c42d641a31cd44e3 +Author: Denis Oliver Kropp +Date: Tue Jun 24 03:43:07 2008 +0200 + + added fixme note + +commit 20716634b6bd361d1851111c9a771618cea8a722 +Author: Denis Oliver Kropp +Date: Tue Jun 24 03:31:59 2008 +0200 + + [devmem] Minor cleanup removing the unneeded heap offset adjustment. + +commit f48943cf555b72f249d3f75a94390bc5ea4c38b7 +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:57:31 2008 +0200 + + [convert] Removed D_CONST_FUNC from dfb_pixel_to_color() and dfb_pixel_from_color(). + +commit 059a4fdad664c60ce8c2e50d32b1ef265c981e12 +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:56:35 2008 +0200 + + [surfaces] Fixed return type of dfb_surface_lock/unlock() for C++. + +commit 857c82cd4563e12ca50e57110108245d1e920149 +Merge: 4ed64ec... 399266a... +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:16:45 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 4ed64ec5d5ce68a02f526459d8e7d3cfea7d40cd +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:16:09 2008 +0200 + + [IDirectFBSurface] Extended debugging messages, mostly coordinates of rendering operations. + +commit f8cbbf52d7e4bc9e8d1c5f3e7041d362ef267182 +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:14:40 2008 +0200 + + [util] Added DFB_RECTANGLES_DEBUG_AT() to dump one or more rectangles. + +commit 1e48f64765f02e403d29a74970d7e500a9ba806e +Author: Denis Oliver Kropp +Date: Sun Jun 22 02:13:54 2008 +0200 + + [IDirectFBWindow] Added basic debug message to each method. + +commit 399266add735534c4c2722726332b04f8f0be830 +Author: Denis Oliver Kropp +Date: Sat Jun 21 14:22:27 2008 +0200 + + [davinci] Moved call to set buffer start address to videoUpdateRegion(). + + Also made videoSetRegion() very lightweight, e.g. when only the surface is changed. + +commit ea47bd8c24e4c8b260cc8c3a676551cf385d74a8 +Author: Denis Oliver Kropp +Date: Sat Jun 21 12:04:40 2008 +0200 + + [IDirectFBSurface] Optimized DrawLines() to use rectangle filling if all lines are horizontal/vertical. + + This allows hardware acceleration to be used, e.g. in GTK+ using gdk_directfb_draw_segments() a lot with + only horizontal and vertical lines for widgets. + +commit b00372c5f6af1a749c1e13bb95fe9552c0e45318 +Author: Denis Oliver Kropp +Date: Sat Jun 21 03:22:19 2008 +0200 + + [davinci] Replaced all hard coded addressing of 32MB DSP working area by DAVINCI_C64X_MEM. + + DAVINCI_C64X_MEM is defined in to be 0x86000000 if not defined from outside. + + FIXME: We could save probably most of the 32MB... + +commit 2f5c21a288e4111ecd079a68f9f63d647b5436a5 +Author: Denis Oliver Kropp +Date: Sat Jun 21 03:19:18 2008 +0200 + + [graphics] Removed dfb_gfxcard_sync() call from slave leaving procedure. + +commit fea27e5d2e5e359658cbcb182805c6eba8e98531 +Author: Denis Oliver Kropp +Date: Sat Jun 21 03:14:36 2008 +0200 + + [IDirectFB] Added sanity limit of 20480x20480 to CreateSurface(). + + This way further calculations like 20480*20480*4 still work and + buffer allocations can be made (rather rejected) as there's no + wrap around with 31 or 32 bit numbers. + +commit 884c9d9e1a2f8a5aa33e5d0a29be87505be7389e +Author: Denis Oliver Kropp +Date: Sat Jun 21 03:06:45 2008 +0200 + + [keyboard] Make driver usable without fbdev/vt just for the sake of a keymap. + + If the FBDev system module is not used, e.g. using DevMem system module, try + opening /dev/tty0 just to be able to register a keyboard device with a keymap. + + GTK+-DirectFB still does not work without it... + +commit 2d2eb9803277ab5f8f749374b37a73a7fbb788a1 +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:38:55 2008 +0200 + + [generic] Dacc_premultiply_color_alpha() also needs Cacc.a to be set, thanks to Mandy Wu for spotting! + + When only DSBLIT_SRC_PREMULTCOLOR was used, the Cacc.RGB.a value was not set at all. + This was only done in conjunction with DSBLIT_BLEND_COLORALPHA or DSBLIT_COLORIZE. + +commit b1ff8418ed52127a7735b610b723934957c6cef5 +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:19:54 2008 +0200 + + [davinci] Added lots of debug messages to 2D acceleration, set StretchBlit() hook statically. + + As there's no other implementation than for 32 bit at the moment, assign the function pointer + for StretchBlit once during driver initialization to save (very minimal) overhead. + +commit 706d0542ecfe318a99d75a881ea5baddf457c356 +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:16:55 2008 +0200 + + [davinci] Allow external definition of DAVINCI_C64X_IDLE_MAX for c64xdump tool. + +commit 29700e4d2a04f213710dae7c10e759ff36622a98 +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:16:27 2008 +0200 + + [util] Added DFB_COLORKEY_VALS(). + +commit b1f15d73e55225c656ca5f2a208202b11fa2930c +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:15:30 2008 +0200 + + [layers] Enhanced debugging output for layer regions. + +commit 9dff083726ddefb6d773697af1958e3070cc850c +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:14:38 2008 +0200 + + [layers] Added DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT() to dump a configuration. + +commit 99a2fea3f71be631629d6ddc921ff79c9d364f8b +Author: Denis Oliver Kropp +Date: Fri Jun 20 11:13:41 2008 +0200 + + [IDirectFBSurface_Layer] Moved interface data structure definition to header file. + +commit eec017753d1e32ccf6c6f1ecebfdaeca9ee0b8cb +Author: Denis Oliver Kropp +Date: Mon Jun 16 09:19:01 2008 +0200 + + [davinci] Update allocations during Lock(). + +commit 08d636baa4399f63d78b1e96127855b55d20c27f +Author: Denis Oliver Kropp +Date: Mon Jun 16 09:18:02 2008 +0200 + + [davinci] Updated kernel module. + +commit 432c828da55b829adff0dca888d519c42c3e6aef +Author: Denis Oliver Kropp +Date: Mon Jun 16 09:07:23 2008 +0200 + + [davinci] Build libdavinci_c64x.la and install headers. + +commit e456cdc058546a19d405d18ab88f9dabbdd568b7 +Author: Denis Oliver Kropp +Date: Mon Jun 16 09:04:14 2008 +0200 + + [tslib] Include . + +commit d261c76eb8c8a53bc8e2132f6b8905b58a01340d +Author: Denis Oliver Kropp +Date: Sat Jun 14 10:10:07 2008 +0200 + + [davinci] Use FBIO_GET_TIMING to query screen size. + +commit 87943754c47067a2d88ea791d3144607792315bb +Author: Denis Oliver Kropp +Date: Thu Jun 12 09:34:07 2008 +0200 + + [davinci] Remove sizeof() from ioctl definitions. Thanks to Eric Nelson! + +commit 7c1d09bb5e1e76d69af33af2e14ac4418485d7bb +Merge: ef6be22... 1c605ad... +Author: Denis Oliver Kropp +Date: Thu Jun 12 09:16:42 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit ef6be22899e343dfa84e3df822b43a8544c7adcc +Author: Denis Oliver Kropp +Date: Thu Jun 12 09:15:19 2008 +0200 + + [convert] Added dfb_pixel_from_color() for full ARGB version of dfb_color_to_pixel(). + + The latter is still there for compatibility, but calling dfb_pixel_from_color() with alpha = 0. + +commit 65c355244ce1a2e00197a1113ef1a420a1029c68 +Author: Denis Oliver Kropp +Date: Thu Jun 12 09:12:00 2008 +0200 + + [davinci] Temporary workaround for getting the screen size. Thanks to Eric Nelson! + +commit 1c605ade7e377ff3cdcea67669692e7530a9cf1e +Author: Denis Oliver Kropp +Date: Wed Jun 11 23:57:19 2008 +0200 + + [davinci] Use KCPPFLAGS and set CROSS_COMPILE_PREFIX. + +commit 62e92a111de85dc720521bef7388b8aa94d791a7 +Author: Denis Oliver Kropp +Date: Wed Jun 11 04:14:07 2008 +0200 + + [options] Added "[no-]cursor-updates" to never show a cursor, but still handle it. + +commit efab271d361fa8981416180347bc94d020801b09 +Author: Denis Oliver Kropp +Date: Tue Jun 10 11:31:25 2008 +0200 + + [x11] Fixed double wheel events by discarding ButtonUps. + +commit 94e9fc75aa7cc83eea759f7fb00e0ec0c9aa5b88 +Author: Denis Oliver Kropp +Date: Mon Jun 9 21:15:54 2008 +0200 + + [IDirectFBSurface] Don't build hierarchy of sub surfaces if start-stop is not used. + +commit 0752af54638978b49045817a30e9e473a9b29f20 +Author: Denis Oliver Kropp +Date: Mon Jun 9 19:16:15 2008 +0200 + + fixed png filename + +commit 44c85a885e88fce2ed43a0bb5dcb7a8095ff82b0 +Merge: a420a6c... e554901... +Author: Denis Oliver Kropp +Date: Mon Jun 9 02:44:39 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit a420a6c70c056e8dfb88d64c51d737fe0ea74381 +Author: Denis Oliver Kropp +Date: Mon Jun 9 02:41:57 2008 +0200 + + [list] Remove check on element in direct_list_contains_element_EXPENSIVE() used for debugging. + + When checking for existence in a list, avoid crashes due to already freed elements being passed + in as a pointer and checked for existence in a list. + +commit e554901f69e726397f29c8480a71ed28d70a530a +Author: Denis Oliver Kropp +Date: Thu Jun 5 09:32:20 2008 +0200 + + This patches teaches directfb-config about SYSROOT and removes -L/usr/X11R6/lib + + Signed-off-by: Marc Kleine-Budde + +commit c59be091ecbd83bfcc1535c934bbaf1305b5feac +Author: Denis Oliver Kropp +Date: Wed Jun 4 23:00:39 2008 +0200 + + [dgiff] Revival of the DGIFF (DirectFB Glyph Image File Format). Thanks to Vaclav Slavik! + +commit 28207ee35af6157032ca3059fc723ec2eefd757a +Author: Denis Oliver Kropp +Date: Tue Jun 3 11:08:07 2008 +0200 + + [gendoc] Adjusted page top and added better logo image. + +commit 483c9a336355c9bdbfa12ac6329bd39e583d2438 +Author: Denis Oliver Kropp +Date: Mon Jun 2 21:10:01 2008 +0200 + + [NEWS] Updated for 1.2.0-rc1. + +commit 4e7313e6e15d9a00203a864532b43618460a1683 +Author: Denis Oliver Kropp +Date: Mon Jun 2 11:12:11 2008 +0200 + + [x11] Use XNextEvent() again instead of usleep() based polling after fixes. + + Pull up to 100 events per round, i.e. until accumulated motion events + are flushed and thread exit status is checked. + + Send ClientMessage to wake up thread from blocking XNextEvent(). + + NOTE: Assuming XNextEvent() is thread safe by itself and does not require + to use XLock/UnlockDisplay(), because using it blocks all other threads + while XNextEvent() is blocking... + +commit c040e8b5baa2b748b08efb7b6cf8bdcfe4b9ef82 +Author: Denis Oliver Kropp +Date: Mon Jun 2 10:31:35 2008 +0200 + + [x11] Missed one Xlib actor site not enclosed by XLock/UnlockDisplay(). + +commit ab863f2ab71453bdc1a1574bb862a7891d3c5d00 +Author: Denis Oliver Kropp +Date: Mon Jun 2 10:18:07 2008 +0200 + + [IDirectFBSurface_Layer] Added debug domain IDirectFBSurfaceL with messages as in IDirectFBSurfaceW. + +commit c64fe7d7aa06114cc91b005f5b9045e57995ef45 +Author: Denis Oliver Kropp +Date: Mon Jun 2 10:17:20 2008 +0200 + + [surface_core] Changed debug domain name from Core/Surface to Core/SurfaceCore. + +commit c54118cc9ed7eae4a6df417a8c9613a07fc0dc3e +Author: Denis Oliver Kropp +Date: Mon Jun 2 10:15:42 2008 +0200 + + [x11] Fixed threading issues using XLock/UnlockDisplay(), reduced invisible 16x16 cursor to 1x1, minor cleanups. + +commit f59e9e8d861ca7156ff1d0ffd2104290da608efe +Author: Denis Oliver Kropp +Date: Mon Jun 2 08:22:42 2008 +0200 + + [IDirectFBVideoProvider] Applied patch from Daniel Laird adding buffer threshold control/notifications. Thanks! + +commit 18552ace2ccfd852fac90016844cd30027b432aa +Author: Denis Oliver Kropp +Date: Sun Jun 1 15:03:11 2008 +0200 + + [fbdev] The big fix[tm] + + Still not working again is support for virtual resolutions with panning, + not double/triple buffering which works. + +commit ba01767fcdaa91b00ae739e82ca270c5f810b74f +Author: Denis Oliver Kropp +Date: Sat May 31 18:13:08 2008 +0200 + + [copyright] Update copyright headers. + +commit 3b52479e932f1ba951778283fee10351903b2350 +Author: Denis Oliver Kropp +Date: Sat May 31 18:08:26 2008 +0200 + + 1.2.0-rc1 + +commit 504fcd5fa51fb67bcd8f2eb0dfea59cebb7f8875 +Merge: e02436f... 5b83790... +Author: Denis Oliver Kropp +Date: Sat May 31 17:36:43 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit e02436f38eb1bee6e9312ee3a4ffaeeb76d681a6 +Author: Denis Oliver Kropp +Date: Sat May 31 17:26:22 2008 +0200 + + [interfaces] Fixed assignments of invalid pointer type. AddRef/Release return DirectResult now. + +commit ebca2537c452aac57fae113c1359051620b0c3bf +Author: Denis Oliver Kropp +Date: Sat May 31 17:20:34 2008 +0200 + + [clip] Fixed bogus gcc-4.1 warning. + +commit 5b837903a083655800970fcbfee7dfe6a5e28310 +Author: Denis Oliver Kropp +Date: Sat May 31 16:28:08 2008 +0200 + + [dfbdump] Show sum of buffers' "locked" value. + +commit 2dd15de3123d80105b06bc11a605cf0db3f902a7 +Author: Denis Oliver Kropp +Date: Sat May 31 16:05:26 2008 +0200 + + [README] Elaborate requirements, use Debian package names. + +commit 0d395ea7a4618dace405c9bc66909bc5d0450b9d +Author: Denis Oliver Kropp +Date: Fri May 30 13:48:47 2008 +0200 + + [SDL] Fix mode switching/surface creation, having working accelerated SDL backend again. + +commit 0f05533015beea8847bcc56c6188a02f96ae0dd4 +Author: Denis Oliver Kropp +Date: Fri May 30 13:47:59 2008 +0200 + + [surface] Commented out annoying assumption for now. + +commit a08511ae755464e93f05fd66bb6da6a0320f240c +Author: Denis Oliver Kropp +Date: Wed May 28 08:15:38 2008 +0200 + + ignore all SlickEdit project/workspace files + +commit 703f622980d497b85541c4501ceea2844c9050ee +Author: Denis Oliver Kropp +Date: Wed May 28 08:12:59 2008 +0200 + + Revert "[input] Patch to reopen console if zero length byte is read" + + Fails in the usual case, but works when run through strace. + + This reverts commit cb9e767d7a829801a53952e3a34eb770fd8bfff4. + +commit c2c776002794e6793867ed9a2138ab02915a73cd +Merge: 9c357f6... c291ee5... +Author: Denis Oliver Kropp +Date: Tue May 27 08:13:04 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 9c357f658c967d8b93d90c39cff691a8bcaddc06 +Author: Denis Oliver Kropp +Date: Tue May 27 08:12:45 2008 +0200 + + [graphics] Added dfb_gfxcard_get_primary(). + +commit c291ee57abd3d9149e9f3a8ed4a82e4ee69a9f0e +Author: Denis Oliver Kropp +Date: Wed May 21 00:16:42 2008 +0200 + + [davinci] Allow layers up to 1920x1080 instead of the bogus limit I added before. + + The original patch did not include any limit at all. + +commit 0ac0d24980d2f2d4b1d1a238d78f29658c23197d +Author: Denis Oliver Kropp +Date: Tue May 20 19:15:24 2008 +0200 + + [davinci] build fix + +commit 575de8b0d56bd26a0e4191d99a25f360d865cd01 +Author: Denis Oliver Kropp +Date: Tue May 20 19:10:50 2008 +0200 + + [davinci] More changes for HD support, thanks to Eric Nelson! + +commit 1384d02151c248dba0a200ad73c624a7e56b5255 +Merge: 82fa12f... c65ed1d... +Author: Denis Oliver Kropp +Date: Tue May 20 18:44:53 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 82fa12f125e41619ed772b02ac39fa149eab2a83 +Author: Denis Oliver Kropp +Date: Tue May 20 18:41:58 2008 +0200 + + [davinci] Patch from Eric Nelson to support HD OSD planes. + +commit c65ed1da33a374047a62d62310c6ab971b5a9ccc +Author: Claudio Ciccani +Date: Tue May 20 12:04:04 2008 +0200 + + [radeon] Implemented DSBLIT_SRC_PREMULTIPLY (R100/R200 only). + +commit 8eeb64fc9564d804e01548659f5807049b54afa8 +Merge: cb9e767... 449e86d... +Author: Denis Oliver Kropp +Date: Sat May 17 23:36:19 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit cb9e767d7a829801a53952e3a34eb770fd8bfff4 +Author: Denis Oliver Kropp +Date: Sat May 17 23:15:31 2008 +0200 + + [input] Patch to reopen console if zero length byte is read + + As reported by John Hughes on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=462626, Splashy is a small boot splash program that starts from initramfs during early boot on Linux. While Splashy is running, the contents of root (/) gets umounted and cleaned up loosing access to the devices when the system started. + + Using the following patch, when libdirectfb detects zero length reads, it attempts to reopen the console (possibly from a newly mounted root tree). + + This was the same solution that was suggested to us by Dennis a few months ago. John arrived to the same conclusion independently (and submitted a patch!) + +commit 449e86d519e98cd1d189ac07e97229841250ebe6 +Author: Denis Oliver Kropp +Date: Wed May 14 07:04:34 2008 +0200 + + [options] New runtime option "quiet=" to disable only certain message types. + + Thanks to Niels Roest! + + [merged from b2007ph1] + +commit 991d8ff7d13d1ad84cc33d1390a962b6bb63d4c6 +Author: Denis Oliver Kropp +Date: Mon May 5 01:02:31 2008 +0200 + + [tests] Smooth indexed -> ARGB scaling test. + +commit b79c72198361748528f7ff0e6426784a8647bed9 +Author: Denis Oliver Kropp +Date: Mon May 5 00:47:23 2008 +0200 + + [generic] Fixed dumb mistake in premultiplication of alpha during smooth scaling. + +commit 749f21a25614a01cce60804792af9ddba6a7fb5f +Author: Denis Oliver Kropp +Date: Sun Apr 27 14:00:44 2008 +0200 + + [generic] Allow DSBLIT_SRC_PREMULTIPLY while scaling from indexed to alpha formats. + + Scaling an image which has alpha values != 255 (non-premultiplied) now produces + premultiplied output (smooth scaling only). Support for non-indexed sources still + needs to be added. + +commit ff8d4e51c6d09efef9448d1dd282f8225ba7dcb5 +Author: Claudio Ciccani +Date: Thu Apr 17 15:38:06 2008 +0200 + + [radeon] Follow changes. + +commit 5e81db40d3dc93b7f467336e872656a4ba2b9680 +Author: Claudio Ciccani +Date: Thu Apr 17 15:36:44 2008 +0200 + + Entering version 1.2. + +commit 34356075fe7910e6974c8528deac5eb6c2797919 +Author: Claudio Ciccani +Date: Thu Apr 17 15:35:44 2008 +0200 + + IDirectFBSurface API changes. + + Added IDirectFBSurface::FillTriangles(). + IDirectFBSurface::SetMatrix() takes a 3x3 matrix. + +commit e0f615d069d267bcd6e1e6c2bb62ce8ff23d246b +Author: Denis Oliver Kropp +Date: Fri Apr 11 19:17:30 2008 +0200 + + [davinci] Work around missing alpha plane pitch setting (when differing from RGB plane). + + The DSP function needs to be extended to fix it properly. + +commit 4c1b8080a3e2b1abb55428b8b668332d2f93d2ae +Author: Denis Oliver Kropp +Date: Fri Apr 11 18:10:27 2008 +0200 + + [davinci] In c64xdump do 4 instead of 10 updates/sec and switch to automatic idle_max. + + You should measure your idle_max once with an idle system and set the IDLE_MAX macro accordingly. + +commit ff8d40c4520de2dfe140da777166d5b9993abc6e +Author: Denis Oliver Kropp +Date: Fri Apr 11 18:00:50 2008 +0200 + + [davinci] Fix double error message. + +commit dd272a04d4f9ed177fbcbe67e6f0329d71554380 +Author: Denis Oliver Kropp +Date: Fri Apr 11 17:58:40 2008 +0200 + + [davinci] Further DSP interface updates and cleanups. + +commit e648a4d07251a7d1c3ca5db13ea6c35f1b433b5f +Author: Denis Oliver Kropp +Date: Fri Apr 11 17:57:31 2008 +0200 + + [davinci] Added small tool for showing DSP status. + +commit 1d67f2e5451fbbebe5ea5ab75bbd3c98073c456f +Author: Denis Oliver Kropp +Date: Fri Apr 11 17:51:54 2008 +0200 + + ignore + +commit 3d9890e79aa10c9e00f4b710ae3189e94bcd182d +Merge: 9dd3fd8... 468b12e... +Author: Denis Oliver Kropp +Date: Fri Apr 11 17:39:30 2008 +0200 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 9dd3fd82fb5c3bbe382e915923bd5265f01f4bde +Author: Denis Oliver Kropp +Date: Fri Apr 11 17:39:19 2008 +0200 + + [davinci] Task handling fixes. + +commit 468b12e10db3d55d918a7c254ea9e720efb273ff +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:34:37 2008 +0200 + + [IDirectFB] Added more debug messages to IDirectFB::CreateSurface(). + +commit 21cebe19e4db44858bf457da535971f588683fac +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:33:57 2008 +0200 + + [davinci] Fixed kernel module for more recent kernels. + +commit da483de031e5b603ddf3e53ce81839424408435b +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:32:38 2008 +0200 + + [davinci] Suppress errors of custom ioctls for now. + +commit b18878562fb8f8b14bcfac77e9a4d4e81b9dcdb2 +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:31:49 2008 +0200 + + [davinci] Allow explicit driver usage without probing by setting accelerator id to 6400. + + system = devmem + accelerator = 6400 + video-phys = 86000000 + video-length = 8388608 + +commit ebb40f5c738f359d645ab6ee8db049ea3079bd58 +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:30:04 2008 +0200 + + [davinci] Fixed double error message. + +commit 9edf2a0a09b7c6fa0ceffd380975d66fb496ea9b +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:29:44 2008 +0200 + + [davinci] Set default kernel source location to be "linux-davinci-2.6" next to "DirectFB". + +commit 243705777c7b280e61de721433bafb136ee93022 +Author: Denis Oliver Kropp +Date: Fri Apr 11 16:29:01 2008 +0200 + + [configure] Fixed typo in X11 detection. + +commit e78501238b28f6bb318b89532743b91cece1c5b3 +Author: Denis Oliver Kropp +Date: Wed Mar 19 14:08:29 2008 +0100 + + [util] Added DFB_TRIANGLE_VALS(t) + +commit c469e1004ed4544fd7e2896c1fe3e83d04b8063e +Author: Denis Oliver Kropp +Date: Mon Mar 17 19:54:06 2008 +0100 + + [docs] Changes to gendoc.pl to fix missing character after newline. + + Other changes: + - Ignore redeclarations of interfaces (no double items in index) + - Warn about interface definitions without a declaration (not indexed) + - Indention... + +commit c386f912febdf7ca7b7d264e701ab98a9d65fb26 +Author: Denis Oliver Kropp +Date: Mon Mar 17 15:35:50 2008 +0100 + + warmer... + +commit becaa3e3533b1dbb2f9faa94c0cb3acea49fc98c +Author: Denis Oliver Kropp +Date: Sun Mar 16 18:35:00 2008 +0100 + + [docs] Made color equal on most systems (RGB16 did differ before). + +commit bb71cad3e17fb8f9a068ffa94e66473186c4e3e7 +Author: Denis Oliver Kropp +Date: Fri Mar 14 02:13:34 2008 +0100 + + [docs] Update version. + +commit 6cc35d5d1d0bc2a1a5129aa7e0f6c312d0e2aada +Author: Ville Syrjala +Date: Tue Mar 11 02:41:07 2008 +0200 + + surface core: Fix a potential problem with deallocating buffers. + + dfb_surface_buffer_lock() walks the buffer allocations with + fusion_vector_foreach (alloc, i, buffer->allocs) and if it doesn't + find a suitable allocation it will allocate one. It then tests + alloc against NULL in the error paths to determine if the + allocation was performed. If there are only unsuitable allocations + alloc will not be NULL even though a new allocation was made. + So use other means to keep track if allocation was made. + + In the name of keeping the code more readable give + dfb_surface_buffer_write() the same treatment even though it's + not actually necessary there. + +commit db3a591846f12c1b284a71e2d2346c45d94a85a0 +Author: Ville Syrjala +Date: Mon Sep 17 22:21:52 2007 +0300 + + Don't access FusionVector members directly. + + Surface core seems to test FusionVector::elements against NULL to + determine if the vector is empty. That won't work when the vector has + contained some data but has since become empty (since elements is not + deallocated/set to NULL). AFAICS that could happen eg. when + dfb_surface_buffer_write() would do the first allocation and + update_allocation() would then fail which would lead to deallocation in + the error path. The next dfb_surface_buffer_write() would then fail + to detect that there are no allocations and would not try to make a new + allocation. + + There are several other places where FusionVector members are accessed + directly. AFAICS nothing that could cause bugs but I decided to clean + them up at the same time. + +commit 9f693ab58d17a4a3cb235956a2b754d0122dc2b2 +Author: Ville Syrjala +Date: Tue Mar 11 18:11:04 2008 +0200 + + dfbinfo: Show min/max keycodes. + +commit cb71d1da5ac1f31d70404de4bfcf62cd62faf2f0 +Author: Ville Syrjala +Date: Tue Mar 11 18:12:51 2008 +0200 + + fbdev: Eliminate floats. + +commit 45db5ded04afcaa4a015efd9670d57f2fe5f4eac +Author: Ville Syrjala +Date: Tue Mar 11 18:12:40 2008 +0200 + + fbdev: Use CLAMP(). + +commit 9a3abe8781628d994f7ecf7bab3b49b61d259834 +Author: Ville Syrjala +Date: Tue Mar 11 18:14:47 2008 +0200 + + jpeg: Use #ifdef WORDS_BIGENDIAN instead of #if WORDS_BIGENDIAN + +commit 552ab7a4ce5829b3f81254002b516617d3656419 +Author: Claudio Ciccani +Date: Tue Mar 11 12:21:59 2008 +0100 + + [fusion] Added fusion_world_get_fork_action() and fusion_world_set_fork_callback(). + + fusion_world_set_fork_callback() allows to register a callback called during + the different states of fork() (prepare, parent, child) and before the actual fork + action is performed. Useful to free local resources when fork action is FFA_CLOSE. + +commit 886be63179ed680f52ba30577bc6ceb7eedf8be6 +Author: Denis Oliver Kropp +Date: Thu Mar 6 17:08:26 2008 +0100 + + [docs] Fixed reference to SetSourceMask(). + +commit 3bd7cf172c17edb17794b6942790bbc4fa50dbe7 +Author: Ville Syrjala +Date: Thu Mar 6 12:33:32 2008 +0200 + + fbdev: Initialize primary layer config width and height + + primaryInitLayer() forgot to initialize the config width and height + that were passed to dfb_fbdev_set_mode(). Also memset() the config + to 0 for good measure. + +commit a4968c5e842271b9e37edda1fe2e4f7585d2e385 +Author: Claudio Ciccani +Date: Mon Mar 3 18:33:34 2008 +0100 + + Added support for affine transformations to dfb_gfxcard_draw_string(). + + Actually this is done by using gStretchBlit. + Direct glyph transformation (done by the font provider) would be better. + +commit dd3f1f2cc6b9b5066c68f0cf8b9ade53ca50091f +Author: Claudio Ciccani +Date: Mon Mar 3 18:30:58 2008 +0100 + + [radeon] Emit transformed rectangle using TRIANGLE_LIST instead of TRIANGLE_FAN. + + Because of vertex buffering, TRIANGLE_FAN leds to incorrect result when drawing multiple rectangles. + +commit 5ffa438d0872695bcac73f48fbe3856416d47202 +Author: Claudio Ciccani +Date: Sun Mar 2 15:57:23 2008 +0100 + + Started implementing affine transformations in software. + Also fixed incorrect clipping when DSRO_MATRIX is set. + +commit bfad60cbd3269aa33ea360aad843bb266046ad88 +Author: Claudio Ciccani +Date: Sun Mar 2 15:55:42 2008 +0100 + + Implemented triangle clipping. + +commit e5448dff452407df4d1d28acb402650c0e75f8f4 +Author: Claudio Ciccani +Date: Sun Mar 2 15:55:01 2008 +0100 + + Added dfb_line_segment_intersect(). + Gets the intersection point between a line and segment within the given segment. + +commit 5081997bbf0e59d2f4a70148f37e1d2acc267504 +Author: Claudio Ciccani +Date: Sun Mar 2 13:27:07 2008 +0100 + + [nvidia] Fixed buggy vertices formation in TextureTriangles. + +commit 01d772a3741b5865ad4758d98bb3f1d82cb278cf +Author: Claudio Ciccani +Date: Fri Feb 29 16:15:01 2008 +0100 + + [direct] Fixed a prototype. + +commit 73cd5a4f3c578bf0d8d9d5f16fac5a72aa628d56 +Author: Claudio Ciccani +Date: Fri Feb 29 15:25:00 2008 +0100 + + [nvidia] Cleanup overlay code. Enbale using NV12 (requires NV30 or newer). + +commit 83d555be5f3f22be050e854d9c132277c3edc57c +Author: Claudio Ciccani +Date: Fri Feb 29 15:23:28 2008 +0100 + + [nvidia] In case of unsupported arch (NV40), skip objects and fifo setup. + +commit 72e8be27b38ad21d9e55819d2c6bbdee25630798 +Author: Denis Oliver Kropp +Date: Thu Feb 28 14:53:48 2008 +0100 + + [dfbdump] Build fix. + +commit 5997403179ffb774e40cd7ad9c0313025e077dbf +Author: Denis Oliver Kropp +Date: Thu Feb 28 13:36:17 2008 +0100 + + [fusion] Fix multi app core build. + +commit c89ee26379d95b7297c4b419efbf44221bc2f180 +Merge: 16d886a... 14b09af... +Author: Denis Oliver Kropp +Date: Wed Feb 27 04:25:03 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 16d886addf8386d5c8e0a268d33cdba5d9845828 +Author: Denis Oliver Kropp +Date: Wed Feb 27 04:24:49 2008 +0100 + + [DirectResult] Added extensible result codes and made other fixes to ban from libdirect and others. + + Made DirectResult the primary type for result codes. + + Added D_RESULT_TYPE_BASE, D_RESULT_TYPE_MAX and D_RESULT_TYPE_IS for extended result codes. + + Changed most of DFB_ codes to be assigned the corresponding DR_ code. + + Three DirectFB specific codes remain, after DFB__RESULT_OFFSET defined as D_RESULT_TYPE_BASE('D','F','B'). + + Added DirectEnumerationResult. + + Moved DECLARE_INTERFACE and DEFINE_INTERFACE to . + + NOTE: Need type changes of all AddRef/Release implementations from return type DFBResult to DirectResult! + + No more inclusion of outside of DirectFB! + +commit 14b09af2a288f71f90dee1cfd508033969e55e42 +Merge: 8fb7df8... ca24167... +Author: Claudio Ciccani +Date: Tue Feb 26 19:07:01 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 8fb7df82d8ee14859b809c49f00350808df407c8 +Author: Claudio Ciccani +Date: Tue Feb 26 18:58:59 2008 +0100 + + NVIDIA: Implemented affine transformations. + +commit ca241672be0b4bd9bdd92629d2d96e3e83f581c7 +Author: Denis Oliver Kropp +Date: Tue Feb 26 17:13:01 2008 +0100 + + [docs] Fixed broken interface description, only IDirectFB had one. + +commit 2d934900ae4ef394bafb3b26d1415acda5966477 +Author: Denis Oliver Kropp +Date: Tue Feb 26 16:41:45 2008 +0100 + + [tests] Fixed warning due to a stupid mixup of void/char. + +commit 055a18e3d069a86b01aa8081ba769075279d2c3a +Author: Denis Oliver Kropp +Date: Tue Feb 26 16:28:05 2008 +0100 + + [docs] Fixed missing new argument to gendoc.pl call. + +commit 774d0b4c86bf1ebe75c356f9162c014ea2c91b91 +Merge: 3d9759e... b933f4a... +Author: Denis Oliver Kropp +Date: Tue Feb 26 16:25:52 2008 +0100 + + Merge branch 'master' of ssh://directfb.org/git/directfb/core/DirectFB + +commit 3d9759ef23e517557d3a475df5cb66aa50de07e2 +Author: Denis Oliver Kropp +Date: Tue Feb 26 16:15:53 2008 +0100 + + [docs] Improved generated documentation to include more and look better. + +commit 4b6b14ef9e9422d88c5de5dcbfba015d9cefb827 +Author: Denis Oliver Kropp +Date: Tue Feb 26 16:21:12 2008 +0100 + + [util] Added macro to determine the first set bit of a 32 bit constant at compile time. + +commit 60f1b19e2aef15ba1a4c5bb47970b4ec1543ac5e +Author: Denis Oliver Kropp +Date: Sat Feb 23 16:48:03 2008 +0100 + + [surface] Allow second string (prefix) in Dump() to be NULL to dump without numbering. + +commit b933f4a4bb38a00b770ec8241f3df46ca003303d +Author: Claudio Ciccani +Date: Mon Feb 25 17:40:22 2008 +0100 + + RADEON: Implemented DSPF_DSTALPHA/INVDSTALPHA for A8. + +commit 21b739036416c96de21db34ae5395970bec19aeb +Author: Claudio Ciccani +Date: Sun Feb 24 21:24:40 2008 +0100 + + Specify that alphablend must be enabled for antialiasing. + +commit c8060ca4e611716e46e0c9f2577db28d17f52a2c +Author: Claudio Ciccani +Date: Sun Feb 24 21:23:41 2008 +0100 + + RADEON: Implemented antialiasing (R100 and R200 only). + Fixed conversion+blend with A8 destination. + Use LINE primitive for transformed DrawRectangle. + Use POINT primitive for 1x1 rectangles. + +commit b417724db62384eba84c481c6c7f670f4347a295 +Author: Denis Oliver Kropp +Date: Fri Feb 22 21:08:59 2008 +0100 + + [surface core] Hotfix failing assumption that flags would still be set when unlocking. + + While locking the surface and managing interlocks, only clear access flags when the + buffer has not been locked before. Probably we should have an allocation lock counter. + + But it needs to be protected anyhow, e.g. using FusionRef, but I'd like to avoid overhead + and instead add an allocation manager per Fusionee. This one would just have one FusionRef, + e.g. as a FusionObject, and a list of locked allocations. The destructor handles them all. + + Another important job for the local allocation manager would be to remember allocations that + have been attached to locally, e.g. mapped, and require to be detached by everyone when destroyed. + + The XShmImages in the X11 backend are currently only shmat()ed by slave processes :-P + +commit 7decf9233c0c0b753bad72ace4959862e4d53027 +Author: Denis Oliver Kropp +Date: Fri Feb 22 21:43:31 2008 +0100 + + [deinit] Fix crashes during shutdown by suspending the input core before shutting down anything. + + The input core is shutdown almost at last. Lots of shutdown happens before, which + could collide with input threads doing fancy stuff like handling expose events :) + + With this change the input core is suspended before any other shutdown. + This closes all input threads to avoid crashes or other misbehaviour. + + Made the input core allow shutdown during suspended state. Added debug messages, assertions... + +commit 4f957b6ccbe0f108c448dad7572c885d34b94e2c +Author: Denis Oliver Kropp +Date: Fri Feb 22 20:37:46 2008 +0100 + + [deinit] Fix deinitialization order in IDirectFB_Destruct(). + + This fixes an assertion happening when drop_window() enables the + cursor of the context that has been destroyed (unrefed) just before. + +commit 09c35c9c27783cceb3446079dd8b67fc63c866c5 +Author: Claudio Ciccani +Date: Thu Feb 21 18:45:50 2008 +0100 + + Added missing definition of DATADIR. + +commit 942c98ba5385060a4dcb9f3d9e88f90354370563 +Author: Denis Oliver Kropp +Date: Wed Feb 20 15:12:58 2008 +0100 + + [tests] oops, forgot the source. + +commit ac760580de6bcaf0b8087d7949c161bfd64a96a7 +Author: Denis Oliver Kropp +Date: Wed Feb 20 01:12:00 2008 +0100 + + [x11] Bring in line with 1.0 features, expose handler, format conversion, shm, smp... + +commit 2bb6bfccfd7d35d0fa299f6829456e1970ca49b9 +Merge: 4d12462... aec6c55... +Author: Denis Oliver Kropp +Date: Wed Feb 20 00:14:37 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 4d12462cf000758748bc808d469121251c1dca97 +Author: Denis Oliver Kropp +Date: Wed Feb 20 00:14:27 2008 +0100 + + [software] Have two stages of software fallback warnings. + + If software fallbacks are disabled, just print a brief message as before, + otherwise print a detailed message in the specific functions. + +commit 287af30cd2679d70a8a97016b9090156aeec9ae6 +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:58:37 2008 +0100 + + [surfac core] Added more debug and an assumption with a FIXME. + +commit aec6c554d8fa99f72edaa1b9819740a6dfdf8c78 +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:31:44 2008 +0100 + + [tools] Added dfbinspector as a small C app. + +commit f9137c2e57b78e6a1d28ae27a3d70a4b400238ae +Merge: f648447... 25fbe5a... +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:23:47 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit f64844754cab020c11e88b210329372e15ac67c2 +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:23:36 2008 +0100 + + [fusion] Implemented lock counter in single app Fusion. + +commit 4b245174e0253343a43ec1e8a4bf786c534bfa0f +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:22:38 2008 +0100 + + [threads] Added debug messages. + +commit 69465c68c3fa3cdfbb64f5f3a328562b91b9ce77 +Author: Denis Oliver Kropp +Date: Tue Feb 19 23:21:55 2008 +0100 + + [graphics/font] Fixed state handling bug causing wrong acceleration masks. + + Added special graphics state debug messages in domain "Core/GfxState". + + Added separate blittingflags member to the font as the one in the state will be modified. + +commit d71d8a0f6d2e6c74f0c6172a7068501c5d2aba96 +Author: Denis Oliver Kropp +Date: Tue Feb 19 18:07:11 2008 +0100 + + [core] Late increase of ABI version after adding pool size to the description. + +commit ee0a49e338a8c712e2c67357b319189c2df0bc9f +Author: Denis Oliver Kropp +Date: Tue Feb 19 18:04:13 2008 +0100 + + [tests] Small restructuring, new test writing data retrieved from an URL to stdout. + +commit 25fbe5a187e3b9a9e910985ee57e0cf2668ea876 +Author: Denis Oliver Kropp +Date: Tue Feb 19 15:29:55 2008 +0100 + + [fusion] Support resume of interrupted wait on a skirmish. + +commit da996c99b1686f91ae6829388f188d60a64b1883 +Author: Denis Oliver Kropp +Date: Tue Feb 19 15:20:41 2008 +0100 + + [mem] Fixed allocation debugging always being used when available. + +commit 875dea04fe7291afa8cb53206ded0d6c4ebb5b68 +Author: Denis Oliver Kropp +Date: Tue Feb 19 14:57:59 2008 +0100 + + Test skirmish wait timeout. + +commit 94479dccd2d9f11ff44f4fca658be9f56b53fe9a +Author: Denis Oliver Kropp +Date: Sun Feb 17 16:24:36 2008 +0100 + + [surface core] Added CORE_SURFACE_BUFFER_LOCK_ASSERT(lock) and CORE_SURFACE_ALLOCATION_ASSERT(lock). + + These two macros are consisting of assertions for all they could check. + +commit 03e4ee39816a3179f6013e9eabfd9a63a948627d +Author: Denis Oliver Kropp +Date: Sun Feb 17 16:19:54 2008 +0100 + + [fbdev] Added DSPF_ARGB6666 to formats checked at depth 24. + +commit 85c5b5961d0f98a42d39f2158bce91ba3531b299 +Author: Denis Oliver Kropp +Date: Sun Feb 17 16:17:50 2008 +0100 + + [surface pools] added size field to description for pools with a defined maximum. + +commit 86ce96319e81052b0ee8e60401ccc6a19a379a33 +Author: Denis Oliver Kropp +Date: Sun Feb 17 16:16:04 2008 +0100 + + ignore + +commit 77919e759c7f1cc3738f07fe0419d4b94970b348 +Author: Denis Oliver Kropp +Date: Sun Feb 17 16:14:22 2008 +0100 + + [config] strip off "lt-" at the beginning of a program name. + +commit 93d6dc2d2fd5dad1fe84d9829c6f9c08c6c7fecb +Author: Claudio Ciccani +Date: Thu Feb 14 18:40:16 2008 +0100 + + Ported radeonfb patch to linux-2.6.22. + +commit 9eba76a734d6937932c11a764a1c215999d93848 +Author: Claudio Ciccani +Date: Thu Feb 14 18:38:45 2008 +0100 + + RADEON: Implemented affine transformation (all cards) and source masking (R100/R200 only). + Switched to version 1.1.2. + +commit e64f23f7425322d9514a84166f0bb07f232f6301 +Merge: d8114d4... 974cc71... +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:36:43 2008 +0100 + + Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB + +commit 974cc710f1bd92707278a6622bfa7ea14f68c43d +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:35:58 2008 +0100 + + SH7722: Remove a temporary printf and two commented out. + +commit 99bc47070b386fbd2df4731711ccd2364f262bf8 +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:29:40 2008 +0100 + + SH7722: Implemented DSBLIT_SRC_MASK_ALPHA, cleaned up and optimized state handling. + +commit fe25a2d4bbbecc4abfa474098d9e0d3bca4ae2cd +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:26:30 2008 +0100 + + RENDER: Added IDirectFBSurface::SetSourceMask() - yes, a third blitting operand :) + + Added DSBLIT_SRC_MASK_ALPHA to modulate source alpha channel with alpha channel from source mask. + Added DSBLIT_SRC_MASK_COLOR to modulate source color channels with color channels from source mask. + + Added IDirectFBSurface::SetSourceMask() with a surface argument plus x/y offset and flags. + + Added DFBSurfaceMaskFlags with DSMF_STENCIL to make x/y offset absolute and always start at a + fixed position in the mask, otherwise x/y from the Blit() are added. + + Implemented interface and core code for the new API, adding some new core functions and flags, + mostly state handling, e.g. dfb_state_set_source_mask(). + + Added DFB_POINT_EQUAL(a,b). + + Added DFXL_ALL_DRAW and DFXL_ALL_BLIT. + + Did some cleanup... + +commit 63a5ee545b5d96616b4cdd1115a35bab28175b4d +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:14:44 2008 +0100 + + CLOCK: Moving includes solved a build issue here. + +commit d16c5807c105abf2dd7f8894b1bdf4f27a86fe87 +Author: Denis Oliver Kropp +Date: Mon Feb 11 23:12:07 2008 +0100 + + SH7722: Use RGB16 in LCD buffer again. NV16 did flicker. + +commit d8114d40845168aa563ad572bbe864c22ea34eb7 +Author: Denis Oliver Kropp +Date: Mon Feb 11 20:24:44 2008 +0100 + + UTIL: Added dfb_window_event_type_name(). + +commit 4f1de5ecd83b25b7cea5d777780b5e33774151c5 +Author: Denis Oliver Kropp +Date: Sun Feb 10 17:50:03 2008 +0100 + + GENDOC: Preserve preceding spaces and line breaks in comments, e.g. to use
.
+
+commit 70f7977c9812df8276c520f3dccb80f2e12b0bca
+Merge: 35b3ba2... 4d7dec6...
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 10 13:12:37 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 4d7dec6d68edbeeb085e5c59b716a16677dd640c
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 10 11:38:46 2008 +0100
+
+    SH7722: Implemented XOR for drawing and blitting. Version 0.8 now.
+
+commit 35b3ba298131e69328240593195757ef4fce8b87
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 2 17:35:25 2008 +0100
+
+    [DirectLog] The default/fallback instance is no longer allocated dynamically,
+    but still initialized on demand.
+
+commit f3e472e86198b5c32d3899f5ec7dbe9df1235f9e
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 2 17:32:14 2008 +0100
+
+    EVENTBUFFER: Don't allow posting of universal events bigger than DFBEvent.
+    
+    This avoids crashes when GetEvent() has been called with just a DFBEvent
+    as a buffer. Sometimes you don't know.
+    
+    Added missing newlines to debug messages.
+
+commit 880a47b5212c1f17e796e7b622d8ddf7a7667de5
+Author: Ville Syrjala 
+Date:   Wed Jan 30 13:22:51 2008 +0200
+
+    fbdev: Don't pan at all when it's not supported by the device
+
+commit 170dd0cfeb4d46dd914a701c1a33e035d7262358
+Author: Ville Syrjala 
+Date:   Wed Jan 30 22:44:18 2008 +0200
+
+    direct/thread.h needs direct/conf.h
+
+commit ed62a4a5e830dbdabb6004bd91d8d6a244d6b39d
+Author: Claudio Ciccani 
+Date:   Tue Jan 29 12:35:58 2008 +0100
+
+    TESTS: Reset the fork action to FFA_CLOSE after forking.
+
+commit f576123a36f4a6ef0b8854e0095242db3f23e79a
+Author: Claudio Ciccani 
+Date:   Tue Jan 29 12:31:18 2008 +0100
+
+    BUILTIN-FUSION: Stop other threads from killing fusion_skirmish_wait() when timeout is expired.
+
+commit 0bba7d29e2a61d475bee10178515c5261c479de8
+Author: Claudio Ciccani 
+Date:   Tue Jan 29 12:26:51 2008 +0100
+
+    FUSION: Finally solved the master-forks problem.
+    
+    This is done by adding a reference counter to FusionWorldShared, increased by the master on fork().
+    Shared memory gets deinitialized only when the counter reaches 0.
+
+commit ab4530bdbb9a1d75e4cf82940ecb8d1cca4a7e2a
+Merge: 1c7c5c6... c80e5c7...
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 28 22:34:54 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 1c7c5c609b23c53299e1844308a72b2c036aa634
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 28 22:30:16 2008 +0100
+
+    DAVINCI: Real IRQ based synchronization, optimization for opaque filled rectangles.
+    
+    Added C64X_FLAG_INTERRUPT to get an interrupt when the command is finished.
+    
+    Function zero is NOP now, e.g. to generate an interrupt at the end of the queue,
+    without setting the interrupt generation bit in already queued commands.
+    
+    davinci_c64x_wait_low() no longer does a usleep() leading to big performance loss,
+    when it's called often with almost nothing on the queue. If synchronization needs
+    to be done, it queues a NOP with Interrupt flag and calls C64X_IOCTL_WAIT_LOW to
+    wait inside the kernel for the end of the queue, and continue without a huge latency.
+    
+    Because blended rectangles are much faster, use the blending function on DSP also
+    for non-blended filling if possible, i.e. alpha = 0xff.
+    
+    Updated tests. Cleanups.
+
+commit c80e5c712943c5774396f10479dd046eb64a290d
+Author: Claudio Ciccani 
+Date:   Mon Jan 28 21:45:53 2008 +0100
+
+    DIRECT-STREAM: Fixed HTTP Content-Type parsing (mimetype might be followed by a charset).
+
+commit e36b34847dbffddb4ec3b796018d707b14801320
+Merge: 7e032d9... be5597c...
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 26 12:53:00 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 7e032d95f71442b42c821e874a26099112f4917b
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 26 12:29:37 2008 +0100
+
+    MODULES: Use standard syntax for initialization of struct members in headers.
+    
+    Thanks to Daniel J. Laird!
+
+commit e443b848e3459bb8cfd23f891cf8a51f57f4e1f9
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 26 12:26:43 2008 +0100
+
+    INPUT: Fix debug message in core.
+
+commit 174f6fa683d4bbb141fd3230723b1df49d845b6a
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 26 09:02:16 2008 +0100
+
+    More info in configure output.
+
+commit be5597c601f6364c35b7bea554d25560e36353f6
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 26 07:18:01 2008 +0100
+
+    THREAD: Added options to set default priority, policy and stack size for threads.
+    
+    Initialize attributes before creating the thread.
+
+commit 4a4c6496109cf818378a2ddc012b1275f13e403d
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 14 15:12:29 2008 +0100
+
+    CONFIG: Added option "surface-shmpool-size=" to set the size of the shared memory pool
+    used for shared system memory surfaces.
+    
+    [merged from b2007ph1]
+
+commit cc014b4447eafc2505e9b2f55b73b6ad7fb0695a
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 22 06:57:52 2008 +0100
+
+    IDirectFBVideoProvider: New events and SetAudioDelay().
+    
+    Thanks to Daniel J Laird!
+
+commit ec7a8323889e06379220d92bbe68a1a51bf6f867
+Author: Claudio Ciccani 
+Date:   Mon Jan 21 14:41:05 2008 +0100
+
+    BUILTIN-FUSION: Flush pending signals before re-acquiring the lock in fusion_skirmish_wait().
+
+commit 0321bd2d2a81c4a73d22a7cfdcc3daccd888a883
+Merge: f763b52... 14b96b6...
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 18 20:13:00 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit f763b520dc525c1f6b7fa6ddf6a60a5efdb657a8
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 18 20:12:50 2008 +0100
+
+    IMAGEPROVIDER: Include .
+
+commit 14b96b6a9019a296011db914eac5b666e93dace7
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 18 12:06:08 2008 +0100
+
+    DAVINCI: Better support for blended FillRectangle(), cleanups...
+
+commit 059e7d5e61a50752d66983b050efb86d280e5d72
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 16 16:49:58 2008 +0100
+
+    JPEG: Fix broken merge (merged but not ported).
+    
+    aea0bea25384584c6f30e2967d369be8116a6a5d
+        JPEG: Implemented directly loading to NV16 surfaces staying in YCbCr space.
+
+commit 58c282e03f7cd2cdffdad2015bd55812422723d9
+Merge: 783ce73... 3fbbd91...
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 16 16:45:37 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 3fbbd911976ac59ce37c366631bce63d85da6a09
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 16 12:46:47 2008 +0100
+
+    SURFACE: Support NV16 in dfb_surface_dump() and so IDirectFBSurface::Dump().
+    
+    [merged from old-surface-core-1.1]
+
+commit aea0bea25384584c6f30e2967d369be8116a6a5d
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 16 12:45:16 2008 +0100
+
+    JPEG: Implemented directly loading to NV16 surfaces staying in YCbCr space.
+    
+    No offsets, clipping or scaling supported.
+    
+    In my test (df_dok --load-image wood_andi.jpg) NV16 had a 34% advantage
+    over RGB16 with this change. It has been the other way around before.
+    
+    [merged from old-surface-core-1.1]
+
+commit 783ce73133ade984952daa169180246cb15dd986
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 23:18:52 2008 +0100
+
+    DAVINCI: StretchBlit() fix, FillRectangle() blended, progress on the caching front
+    and more work behind the DVA (DirectFB Accelerated Video) scenes.
+
+commit 9c07e574535db5d86ef11bda0bbe7a18e2a2f306
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 23:04:57 2008 +0100
+
+    CONFIG: Added option "[no-]software-warn" to show warnings when doing/dropping software operations.
+    
+    No longer print a warning when software fallbacks are disabled. Use the new option!
+
+commit aa1f5ffc61fcb99a2e64ad9750fcc1e666f73595
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 23:03:50 2008 +0100
+
+    Cleanup .gitignore files.
+
+commit 5d6d2a89d90233297a5f3f0b468ea80bd4d86334
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 12:47:55 2008 +0100
+
+    HEADER: Don't define inline conversion functions due to void* arithmetic if C++ is used.
+
+commit 213517ebfa140ac3a2d6ece256c4ec96b3906712
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 12:38:15 2008 +0100
+
+    DFBFX: Fixed copy'n'paste bug.
+
+commit 4d72b6c01ee44dfeb97f0dc0fb99ca3acfe1d4a4
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 15 12:37:51 2008 +0100
+
+    HEADERS: C++ fixes.
+
+commit 18b15a9003153b4c9e604888f080a8a2cd2df666
+Author: Claudio Ciccani 
+Date:   Tue Jan 15 08:29:11 2008 +0100
+
+    [builtin-fusion] Cleanup socket directory and shm files on exit.
+    Return DFB_FUSION instead of DFB_DEAD if the recipient is unreachable.
+
+commit 3f726505d53b68f4f506fe30b39436b3adac848a
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 13 14:11:09 2008 +0100
+
+    SH7722: Step back to RGB as default input color space until we can
+    switch dynamically and maybe automatically. This means all Inputs
+    (3 Layers) and Windows on MultiWindow Layer (4th) can be (A)RGB,
+    only Input 1 can be configured to NV12/NV16...
+    
+    Many cleanups, new macros etc.
+
+commit 6abd2846eebb06a1744fbc9515f95237b8587b04
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 13 11:02:05 2008 +0100
+
+    Cleaned up LCD Buffer Setup Code. A variable for selecting between RGB16 and NV16 is in the code.
+    
+    Clear LCD Buffer after allocation with black using memset, one for RGB16 and two for NV16.
+
+commit 890f8bb71477aaba7d2621cdc6605863cb4b3018
+Merge: 0eca8a2... bd08a3e...
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 10 04:25:41 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 0eca8a246c4ed8df3f5b1b94ce2067b559f27eaa
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 10 04:25:33 2008 +0100
+
+    INPUT: Added dfb_input_event_type_name() and event debug at Core/Input/Evt.
+
+commit ef3dcdaf776d204519dd171adf9292db57da8813
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 10 04:24:40 2008 +0100
+
+    DEFAULTWM: Combine multiple x and/or y motion events before sending events or updating the cursor.
+    
+    This is a better way as opposed to have the driver do the work,
+    otherwise there was too much cursor acceleration in such a case.
+
+commit d63edceff38d3ba40dad7588faf04b83f689c632
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 10 04:16:23 2008 +0100
+
+    LINUX-INPUT: Set DIEF_FOLLOW on all events known not to be the last.
+
+commit a37b95f3d6a7dd1c3723244a08e23081f9e818d1
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 10 04:03:56 2008 +0100
+
+    CORE: A bit late ABI++ after last clipping feature in gfxcard.c.
+
+commit bd08a3e3edb113a9f360e6ac73c432c15d1d92b6
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 23:38:32 2008 +0100
+
+    DAVINCI: Fixed sub directory used by wrapper Makefile.kernel.
+
+commit d699b968396c9c8e494b2cf06eff74718f7abe9f
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 10:54:12 2008 +0100
+
+    CONFIG: Don't enable mouse motion compression at input drivers by default.
+
+commit 47658336e8fb38f259af9d60e110671c07769ed0
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 10:52:36 2008 +0100
+
+    IDirectFBImageProvider: Don't fail if PeekData() is not supported, same behaviour as video providers...
+    
+    Thanks to Daniel J Laird!
+    
+    I also added clearing the context struct for safety,
+    especially regarding the header data which might not be read in completely.
+
+commit f9dfac2d159229fd57fcebb6ba87b15b79c7c6d8
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 06:17:28 2008 +0100
+
+    DIRECT: Move default log instantiation into DirectLog code.
+
+commit e5d3a344e30efbf5f0fd8ac6741155cdf2bdf788
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 06:15:06 2008 +0100
+
+    DAVINCI: Added experimental ioctl similar to the flip ioctl,
+    just testing, could not find the original flip ioctl so far.
+    
+    Arguments are:
+    - byte offset from frame buffer device base OR a physical address
+    - optional target sync count when to show the frame
+    - returns sync count of actual setting or 0 if pending
+
+commit 54bbd5beb8e324fd9c38357b5f2cc0836404fee3
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 05:22:15 2008 +0100
+
+    DAVINCI: Fixed recently broken blend and new colorize.
+
+commit bc2506ff29f855df43af096758c065c98784f289
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 05:21:36 2008 +0100
+
+    DAVINCI: Minor cleanup.
+
+commit 64ecce22f31da6f88dc140ad6177c7fdc8f6e89e
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 9 01:30:03 2008 +0100
+
+    DAVINCI: Added colorizing support to blend functions. No additional cycles in DSP :)
+
+commit 484b3777238cf2b49c5d4fc51e66016eba21a5b7
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 12:30:58 2008 +0100
+
+    DIRECT: Fixed missing declaration of debug functions when debug support is enabled, but no debug active.
+
+commit 7a15814e056c9411b7269eb5c6649cd43521b71a
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 07:08:42 2008 +0100
+
+    DAVINCI: Fixed incomplete header file update.
+
+commit cb1a784ac6ce868176a98ec71dc02c27726d6c9b
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 07:01:58 2008 +0100
+
+    DAVINCI: More acceleration (StretchBlit for ARGB, ARGB/RGB32->RGB16 conversion) and fixes.
+    
+    Added properly clipped (phases!) StretchBlit() for ARGB and RGB32 without any blitting flags.
+    
+    Added ARGB/RGB32 conversion to RGB16 without any flags (currently writing alpha data to scratch area).
+    
+    Fixed color calculation for filling/drawing to UYVY.
+    
+    Moved write back from EngineSync() to EmitCommands() as there's no guarantee for EngineSync() to be called :(
+    
+    More tests for DSP internal MPEG2 functions.
+    
+    Only run DSP test code if C64X_TEST is exported.
+
+commit 45b8a0975257cdcee16b92dc161107754b2c02f9
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:36:10 2008 +0100
+
+    DAVINCI: Added davinci_c64x_write_back_all() after davinci_c64x_dither_argb() for OSD updates.
+
+commit 88e33559fe7521794f37fabfe1103a23ae6d3ea1
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:28:28 2008 +0100
+
+    DIRECT: Fixed 'log-file' and 'log-udp' option.
+
+commit 322f0fe1dd9aeb538e675a4137a5c80e8668fa9c
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:20:53 2008 +0100
+
+    FONTS: Added minimum glyph alignment of 8 bytes.
+
+commit fd3a4151a9b9e0ec8fe94d93d06da364e04a3013
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:16:24 2008 +0100
+
+    GFXCORE: Added mask of clipped functions to internal CardCapabilities (gfx drivers).
+    
+    Instead of providing clipping for none or for all functions (CCF_CLIPPING) a driver
+    can set individual functions to be hardware clipped, e.g. DFXL_STRETCHBLIT where
+    clipping is crucial.
+
+commit 2c7096c217f15136cf9e5e3a4f36709fb1fc55fe
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:02:53 2008 +0100
+
+    LAYERS: Only sync with accelerator in dfb_layer_region_flip_update() when DSFLIP_PIPELINE is not set.
+
+commit df15f4ba6ad4d7dd964d61b85ea3b651168ceb1a
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 06:00:39 2008 +0100
+
+    GENERIC: Print blend funcs in warning caused by 'no-software'.
+
+commit 5b2fb854ee2a57408059778d1bdd88e063d085a6
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 8 05:59:41 2008 +0100
+
+    Added option "-ds" for dumping surfaces.
+
+commit 98f761d339c6cd7e6f8c37e3e32b2f617eec8013
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 21:09:11 2008 +0100
+
+    SH7722: Use VEU for scaling and format conversion of JPEG decoded data (line buffer mode).
+    
+    Support 4:2:0 and 4:2:2 to
+    - NV12
+    - NV16
+    - RGB16
+    - RGB24
+    - RGB32
+    
+    Allocate two line buffers (2560x16 pixels). Let JPU decode into line buffers. Each line
+    buffer (16 lines) will be converted by VEU to destination surface. CPU, JPU and VEU can
+    work in parallel (loading coded data to reload buffer 0/1, decoding data to line buffer 0/1,
+    converting from line buffer 0/1 to destination). Conversion is enable using one the new
+    flags: SH7722_JPEG_FLAG_CONVERT.
+    
+    Less overhead for smaller JPEGs. Only request further reloads if data is available, i.e. if
+    any GetData() returns less than SH7722_JPEG_RELOAD_SIZE, clear SH7722_JPEG_FLAG_RELOAD.
+    
+    Cleanups.
+
+commit 93136ba54a7b7d0ce835526e5e9c5a12e2aaab56
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 20:40:46 2008 +0100
+
+    DEBUG: Cleanup header.
+
+commit 04a16a088f0b8af2754109e9e949359401a83a82
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 11:01:39 2008 +0100
+
+    MPEG2: Removed MPEG2 I-Frame Imageprovider. Patch by Daniel J Laird - daniel.j.laird _ nxp.c0m
+
+commit 32673352738ecfb030181fc689e8a537a205bd29
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 10:51:13 2008 +0100
+
+    ignore
+
+commit c23c88c7f76e9f7a2ffa12a0d87979f8bea8a8b7
+Merge: ff62e5a... 0825352...
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 10:04:33 2008 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit ff62e5a349bd043152ff014f767456be7fc8dfce
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 3 10:04:23 2008 +0100
+
+    SH//22: Kernel based state machine for less overhead and latencies.
+    
+    After filling the first reload buffer, execution enters the kernel
+    which starts the decoder and only returns to user space for
+      - end of decoding
+      - error in decoding
+      - less than two buffers loaded or in use (reload)
+
+commit 0825352a4de6e3d8abaf41a6105ceaa5df43b518
+Author: Claudio Ciccani 
+Date:   Wed Jan 2 14:20:21 2008 +0100
+
+    [builtin-fusion] Replaced usage of getpid() by direct_gettid().
+
+commit 561c4a9099115bdf921c2b5ea7d95e8c4cb45fa7
+Author: Claudio Ciccani 
+Date:   Wed Jan 2 12:49:19 2008 +0100
+
+    Handle option [no-]thread_block_signals in direct_config_set().
+
+commit a5d3346339b9fe3197fb216447e42c87b7fe19f8
+Author: Claudio Ciccani 
+Date:   Wed Jan 2 11:45:14 2008 +0100
+
+    Check whether mount point is writable in find_tmpfs().
+
+commit 7818ff8c8b5578de135c61389c43f87ff7e1747b
+Author: Claudio Ciccani 
+Date:   Wed Jan 2 11:37:35 2008 +0100
+
+    Include directfb_util.h (defines dfb_pixelformat_name()).
+
+commit 3a36cc5ae838fb012a0d63943f92dde5244359b6
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 28 23:27:51 2007 +0100
+
+    fbdev: Fixed missing include.
+
+commit 69f61b2cc7b4b22f490895953a8b58454398096c
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 28 23:25:48 2007 +0100
+
+    IDirectFBInputBuffer: I thought I built this code already...
+
+commit 2a41f52a00240644a49f65dfb6f7e02b21210c4e
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 28 23:25:14 2007 +0100
+
+    libdirect: Fixed warnings.
+
+commit 19f3486f6b14a573dc6c9d1ffd43f5edb270ddbd
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 26 04:08:07 2007 +0100
+
+    SH7722: JPEG enhancements
+    
+    - Decode header in Construct()
+    - Utilize reload buffers properly (fill one while hw reads the other)
+    - Support NV12 and NV16 (4:2:0 and 4:2:2 images)
+    - Added locking for JPU usage
+
+commit 8f1ac453e7bc13b78ad8ac87a3ed6e680c6954f8
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 26 04:00:57 2007 +0100
+
+    DEBUG: Missed one line in last commit (adding debug messages).
+
+commit f23610b51e7d099bd129afa4a9b802133316dc99
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 24 04:28:23 2007 +0100
+
+    DEBUG: Further cleanup of debugging code. New minimal debug mode
+    to support D_DEBUG_AT, D_ASSERT and D_ASSUME when debug support is
+    disabled, but DIRECT_ENABLE_DEBUG or DIRECT_FORCE_DEBUG have been
+    defined. No domain filters, just formatted output (all or nothing).
+
+commit f3fdc7435788346515d993651abc3640d05d4db6
+Merge: 75dd9d7... 3afd652...
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 24 02:45:51 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 75dd9d767f1e0a0317c251aafe257a00e58ee697
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 24 02:45:29 2007 +0100
+
+    LINUX-INPUT: Fix redefinitions by moving up kernel headers.
+
+commit 3afd652d8be162b15ec2fbfd6921af95f48de763
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 23 16:11:30 2007 +0100
+
+    SH7722: Experimental JPEG decoding (first working version) and other enhancements and fixes.
+    
+    Changed the LCD buffer from RGB16 to NV16 to improve image quality with same amount of data.
+    BEU generates YCbCr 4:2:2 content, LCDC converts and sends RGB18 data to the display (at least on AP325).
+    
+    Switched BEU to YCbCr input by default, thus allowing only the first layer to be (A)RGB.
+    Implemented LUT8 support for the third layer. Added lock for BEU code called for different layers.
+    Automatic parent input system selection and other fixes, allowing to run df_fire on third and df_dok
+    with alpha channel on first layer.
+    
+    Fixed byte swapping issues, e.g. no more swapping between BEU and LCDC, correct swapping of BEU input
+    depending on number of bytes per pixel.
+    
+    Added experimental first working version of hardware JPEG decoding:
+    
+         /*
+          * FIRST WORKING VERSION [tm]
+          *
+          * Almost user space based only. To NOT USE usleep() & friends and loose throughput (sleep) or
+          * CPU resources (busyloop), I added an ioctl that waits for the next interrupt to occur.
+          *
+          * With a 128x128 image (23k coded data) being loaded in a loop, this temporary mechanism is
+          * achieving almost the same throughput as a busyloop, but with only half the CPU load.
+          *
+          * TODO
+          * - prefetch image info with a state machine used by Construct(), GetSurfaceDescription() and RenderTo().
+          * - utilize both reload buffers properly (pipelining)
+          * - implement clipping, scaling and format conversion via VEU (needs line buffer mode)
+          * - add locking and/or move more code into the kernel module (multiple contexts with queueing?)
+          */
+    
+    Kernel Module
+    - Added SH7722GFX_IOCTL_WAIT_JPEG to wait for the next interrupt.
+    - Added JPU IRQ handler: save interrupt status in shared memory, clear interrupt and wake up waiter.
+
+commit 65040dc9d34566454f94be4d1b1f47f57dd9a7c0
+Merge: 1c82251... 5a3d3e3...
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 23 13:22:13 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 1c82251e77e13038ee4c4c94401efef8361165e9
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 23 13:22:03 2007 +0100
+
+    DEBUG: Added "[no-]fatal-break", d_debug_at() and direct_debug_at_always().
+    
+    The new runtime option was added to enable/disable the trap in D_BREAK().
+    
+    Even without debug support (but text) in libdirect, changing one D_DEBUG_AT()
+    to d_debug_at() - which is a single shortcut in my SlickEdit - will bypass the
+    check for the domain or any debug macros and directly print out the message.
+    
+    The new function direct_debug_at_always() is called by the new d_debug_at() macro
+    unless text support is completely disabled, e.g. configured with "--disable-text".
+    
+    Added static inline debug_domain_vprintf() to clean up debug message printing code
+    a bit and optimize it, saving two intermediate printfs, one for "%s:" (domain name)
+    and the other for the final format string.
+    
+    Domain less D_DEBUG() messages are using the same format/function now (domain "- - ").
+
+commit 5a3d3e31a74db36395cdeba13a4fed83198fb1f5
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 23 06:58:48 2007 +0100
+
+    CONFIGURE: Show $SYSCONFDIR in summary.
+
+commit 154f272eb2173a41f5a2289e3e92c019ac47a6d9
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 23 06:58:10 2007 +0100
+
+    DIRECT: Added MODULEDIR to direct.pc, until this becomes configurable for each package.
+
+commit 81316724cab757636ac25361ceba312f86cc733f
+Author: Marc Kleine-Budde 
+Date:   Fri Dec 21 09:50:08 2007 +0100
+
+    add AC_SUBST(LD) to configure.in
+    
+    $(LD) is used in Makefile.am, but when using libtool $(LD) sems not to
+    substituted automatically. This patch adds the missing AC_SUBST().
+    
+    Signed-off-by: Marc Kleine-Budde 
+    Signed-off-by: Denis Oliver Kropp 
+
+commit f683452e5227b1cd4934b700b0a79c24d71060f6
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 17 18:13:14 2007 +0100
+
+    Fix unconditional use of SA_SIGINFO, thanks to Samuel Thibault!
+
+commit 5551b51ff8dfb0b4f4c5cf287a34ec20d5247b1b
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 17 18:10:02 2007 +0100
+
+    MAKE: Clean autogenerated header files on distclean, thanks to Tobias Grimm (now really).
+
+commit 60e5be4e3122cdc219898caaac92d61be8806e60
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 19:01:54 2007 +0100
+
+    BUILD-OPTIONS: Set smooth scaling to 'no' if software rendering already is.
+
+commit dbb7b400a84b1579a9e6193eed59f3a5bfbaedfe
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 18:56:20 2007 +0100
+
+    BUILD-OPTIONS: Added "--without-software" to save 100k+ binary size if really not needed.
+
+commit d30a1839d517612fdfbd806f206517375193a2ff
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 18:33:51 2007 +0100
+
+    DIRECT: Fixed warnings for building with DIRECT_BUILD_TEXT set to 0.
+
+commit 3e6f6e2be975a9abee6d2d9321917192fbcb13b0
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:38:49 2007 +0100
+
+    Generated ChangeLog for 1.1.1.
+
+commit c3a7068532972d18feaf0efd82aef2db04bd96d7
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:31:05 2007 +0100
+
+    Updated NEWS for 1.1.1.
+
+commit d361c4dc7adb7b255655d31574f282348695d65d
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:25:15 2007 +0100
+
+    Do not use PAGE_SIZE at all on Linux, thanks to Guillem Jover.
+
+commit a206e44a9a7067f2deec0e09323b4176f51268b4
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:24:52 2007 +0100
+
+    Use  instead of __, thanks to Guillem Jover.
+
+commit a27f1df63f3718d3ebcc2ede5cbf10b758a2ebea
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:24:16 2007 +0100
+
+    Add missing libsysfs when statically linking, thanks to Guillem Jover.
+
+commit 793e98018bb03505a74b906830e4e375fabc63de
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 16:23:52 2007 +0100
+
+    Do not leak private labraries for dynamic, thanks to Guillem Jover.
+
+commit e6490162e1938988e4149b2a4e2946cbc3eb0b6d
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 14:21:27 2007 +0100
+
+    RUNTIME-OPTIONS: Added "[no-]autoflip-window" to automatically flip non-flipping windowed primary surfaces.
+    
+    Previously, the default was to automatically Flip() in a thread. Now it's not.
+
+commit 9a8e201d180d2b170e1d3b01180b538aac796d4d
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 14:08:51 2007 +0100
+
+    BUILD-OPTIONS: Added "--with-smooth-scaling", turned off by default to avoid 100k+ binary size increase.
+
+commit 220dc9c20ed8aad4437b14df62ee9cc518bd9621
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 13:47:37 2007 +0100
+
+    SOFTWARE-RENDER: Added missing header files in Makefile.am.
+
+commit 004fde4d425b936a8496be90f263f6156c1e4103
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 15 13:47:06 2007 +0100
+
+    DAVINCI: Added missing kernel module Makefiles.
+
+commit 5e3e18881b83c0ded4296523eb585d02928a33fb
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 29 13:53:34 2007 +0100
+
+    IDIRECTFBDISPLAYLAYER: Pass down resource id (DWDESC_RESOURCE_ID) in CreateWindow().
+
+commit 33f6701408c0790cd1341b5ee5a664d438a63dde
+Author: Claudio Ciccani 
+Date:   Tue Dec 11 19:36:29 2007 +0100
+
+    Optimized pixel premultiplication.
+
+commit 6cffc100034190a068b4fa2efb67ab96e01fbdfd
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 22:17:18 2007 +0100
+
+    SURFACE-CORE: Added CSALF_VOLATILE and CSALF_PREALLOCATED. Reimplemented "thrifty-surface-buffers".
+    
+    The "thrifty-surface-buffers" option is implemented by iterating through all allocations at the end of
+    an update_allocation() and deallocate all other allocations, unless they have the CSALF_PREALLOCATED
+    flag. In the latter case it would not be a benefit, but the disadvantage of losing an allocation that
+    is still up to date and would probably be faster (CPU read) than others.
+    => The 'preallocated' surface pool sets CSALF_PREALLOCATED upon allocation.
+    
+    Another flag CSALF_VOLATILE has been introduced. In case of a write access to one allocation, any other
+    allocation is deallocated if it has the flag. This is independent of the "thrifty-surface-buffers" option.
+    => The 'local', 'shared' and 'preallocated' surface pools set CSALF_VOLATILE upon allocation.
+    
+    That means the preallocated surface buffers are kept as long as they're still up to date with other
+    allocations (copies of them), e.g. an image resource loaded into accelerator memory, never written to,
+    but read from by GPU as well as CPU. As soon as one of the allocations has been written to, the
+    preallocated buffer becomes useless, if we cannot write back to it (which we don't as there's not yet
+    a way to specify read/write permissions when creating preallocated surfaces).
+
+commit f33f1333a34f92faeadbd1c604506de81d499edd
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 15:02:38 2007 +0100
+
+    DAVINCI: Use D_PERROR() if FBIO_GET_TIMING fails.
+
+commit 0c40638344664973b66e1760edede0a812fd796b
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 14:55:56 2007 +0100
+
+    DAVINCI: Revert header changes made to fix build on newer kernels.
+    
+    Instead workaround it without changing the resulting ioctl number.
+
+commit b037a96795eb528ac451047eae2cd39ff295b758
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 10:27:57 2007 +0100
+
+    SH7722: Fixed debug build.
+
+commit a58ecc1c555a181957af2bc78a37f0b3da3b541c
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 10:27:32 2007 +0100
+
+    UNICHROME: Fixed a warning.
+
+commit 443a095ed4ab72aa1bf735b28e2e086312f279bc
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 10:27:01 2007 +0100
+
+    DAVINCI: Build fixes.
+
+commit b1b8bed6448c8d06d819a2319e7caf566cd5a766
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 10:15:52 2007 +0100
+
+    DAVINCI: Removed junk from Makefile.
+
+commit 89d526030502850095cdb611b43ce1011a15413e
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 10:06:14 2007 +0100
+
+    DAVINCI: Hardware acceleration using the DSP with a special firmware and kernel module.
+    
+    The DSP runs an ~8k firmware (in L1 cache) and provides different functions. These
+    are called by writing a command packet into the 512k command queue in memory. Each
+    function can have up to seven 32 bit arguments, up to eight flags and a sub function
+    index of 8 bit.
+    
+    There's a low and high priority queue, but only one is implemented at the moment. The
+    idea is that the high priority queue can preempt the low priority queue at any time when
+    a command is added. The low priority queue can only continue when the high priority queue
+    is empty.
+    
+    There are no interrupts from DSP nor to it so far. Waiting for a free queue entry or for
+    an empty queue uses usleep() at the moment, but it's working quite well. An interrupt handler
+    and a few ioctls() should be added.
+    
+    Text rendering is just white at the moment. Blended rectangle filling will be implemented.
+    
+    Graphics Layer updates from ARGB to RGB16/A3 (dithered) planes are done by the DSP, very fast.
+    
+    We're mainly working on MPEG2 at the moment...
+    
+    Benchmarking with 256x256 in 16bit mode... (16bit)
+    
+    Fill Rectangle                                20.936 secs (*  59.788 MPixel/sec) [  7.4%]
+    Fill Rectangles [10]                          23.168 secs (*  61.383 MPixel/sec) [  0.3%]
+    Fill Spans                                     3.136 secs (*  45.975 MPixel/sec) [  1.2%]
+    Blit                                          25.328 secs (*  48.127 MPixel/sec) [  9.0%]
+    Blit colorkeyed                               25.542 secs (*  47.724 MPixel/sec) [  8.8%]
+    
+    Benchmarking with 256x256 in 24bit mode... (32bit)
+    
+    Anti-aliased Text                              3.020 secs (* 138.278 KChars/sec) [ 99.3%]
+    Anti-aliased Text (blend)                      3.040 secs (* 139.736 KChars/sec) [ 99.3%]
+    Fill Rectangle                                31.360 secs (*  37.825 MPixel/sec) [  4.7%]
+    Fill Rectangles [10]                          32.120 secs (*  37.950 MPixel/sec) [  0.1%]
+    Fill Spans                                     3.270 secs (*  32.066 MPixel/sec) [  0.9%]
+    Blit                                          39.580 secs (*  29.307 MPixel/sec) [  5.3%]
+    Blit colorkeyed                               35.560 secs (*  32.989 MPixel/sec) [  6.0%]
+    Blit with colorizing                          39.600 secs (*  29.292 MPixel/sec) [  5.7%]
+    Blit from 32bit (blend)                       36.960 secs (*  31.562 MPixel/sec) [  6.0%]
+    Blit from 32bit (blend) with colorizing       36.960 secs (*  31.562 MPixel/sec) [  6.3%]
+
+commit 6f65946fe5387834ec996e8ba7426237337bc1cd
+Merge: b840827... c426dac...
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 06:12:25 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit b840827a900828b5c17d66ca279da0d3f319ef20
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 06:11:02 2007 +0100
+
+    FUSION-SHM: Added "ramfs" to possible types during mount point probing.
+
+commit 83ae918134e0c4a696f6a43f2d3903da5caff42b
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 9 06:08:41 2007 +0100
+
+    DEBUG: Added checks if debug support is disabled.
+    
+    If DIRECT_ENABLE_DEBUG is defined, silently undefine it.
+    
+    If DIRECT_FORCE_DEBUG is define, show a warning and undefine it.
+
+commit c426dace42831c7a2fb96801d00e86fcd2d8223b
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 6 16:53:39 2007 +0100
+
+    GRAPHICS: Skip prechecking clip in FillRectangles() if DSRO_MATRIX is used.
+    
+    Other functions are also affected, but not fixed.
+
+commit 32ed166b03bf2d0dc33fb65562788b1e3e22eceb
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 6 14:05:28 2007 +0100
+
+    SH7722: Implemented DSRO_ANTIALIAS for all drawing operations.
+    
+    The hardware provides "anti-aliased" lines by drawing a line
+    with doubled pixel width (minor axis). This should be drawn with
+    a transparency factor. Finally the original line is drawn on top
+    of this.
+    
+    For filled rectangles and triangles, only the double width line is
+    drawn and then the shape is filled.
+    
+    Fixed off-by-one in rectangle outlines.
+
+commit 992ed320a16aa7c804873aab95a9acdf0617849c
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 6 13:30:08 2007 +0100
+
+    API: Added DSRO_ANTIALIAS to enable anti-aliasing for edges, lines...
+
+commit 9285afb3671ffab0048fdf2308be5db08621a95b
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 6 13:29:18 2007 +0100
+
+    FONT: Fixed "no-font-premult" option.
+
+commit 35ccb45aecdebd6b7f3d5993967fa38777a561e0
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 16:31:24 2007 +0100
+
+    SH7722: Need to transform coordinates in DrawRectangle() and DrawLine() in software.
+
+commit 4814087e8b95e4710c031a3b049c1af80a5d671e
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 16:30:20 2007 +0100
+
+    IDirectFBSurface: Changed matrix entities from u32 to s32.
+
+commit 60e32cc311099ddc56b75ddc16cd7e170de17948
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 15:25:40 2007 +0100
+
+    IDirectFBSurface: Set render options temporarily to DSRO_NONE in Clear().
+
+commit 8e283719a15f726558df0c8a962f7f77b4ae7075
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 13:46:19 2007 +0100
+
+    FUSION: Fixed warning about unused pGroupInfo.
+
+commit f0b84341906c5033c1b33c3311a39a972bdba4f4
+Merge: f00efe8... 127ec41...
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 13:34:54 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit f00efe82b5f1c01f9b27201432835093651d824a
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 13:34:47 2007 +0100
+
+    SH7722: Implemented 3x2 transformation for drawing and blitting.
+    
+    Use hardware 3x2 matrix to implement DSRO_MATRIX.
+    
+    Cleanups. Flush cache in ISR, not every EmitCommands().
+
+commit 07208f80501755476cd50e2b1d31da6bc82eff7c
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 5 13:32:27 2007 +0100
+
+    IDirectFBSurface: Added 3x2 transformation for all drawing and blitting.
+    
+    Added render option DSRO_MATRIX and IDirectFBSurface::SetMatrix().
+    
+    The matrix consists of 3x2 fixed point 16.16 values.
+    The order in the array is from left to right and from top to bottom.
+    
+    All drawing and blitting will be transformed:
+    
+    X' = X * v0 + Y * v1 + v2
+    Y' = X * v3 + Y * v4 + v5
+
+commit 127ec410b49e105163fca186e3335c8d9fe2490d
+Author: Claudio Ciccani 
+Date:   Sun Dec 2 14:26:06 2007 +0100
+
+    BULTIN-FUSION: chown() the sockets directory according to "shmfile-group".
+
+commit 9347510b5210fad8d9eb3c5bef2393257a6882ed
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 2 09:13:01 2007 +0100
+
+    SOFTWARE-RENDER: Fast RGB32/ARGB to RGB16 conversion (little endian).
+
+commit 130dbc483c09c858eb27988fa9a50720810336ae
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 2 08:59:25 2007 +0100
+
+    TSLIB-INPUT: Check the device in $TSLIB_TSDEVICE when guessing (no option given).
+
+commit 51a848f4bcbb454b0579758d26719f38791f7d81
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 2 08:57:29 2007 +0100
+
+    LINUX-INPUT: Ignore input devices matching the TSLIB_TSDEVICE environment variable.
+
+commit 2b5aad59838538682ab06dc405ed37a49d386e59
+Merge: 5241ef1... 63a2d8e...
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 2 08:25:45 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 5241ef1027caac77535253f72bdb70a2c4add454
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 2 08:25:14 2007 +0100
+
+    WM-DEFAULT: Added WM key combo - to redraw the whole window stack.
+
+commit 63a2d8e8363adc7acc8dd78e9b9e784652dbb421
+Author: Claudio Ciccani 
+Date:   Sat Dec 1 15:56:26 2007 +0100
+
+    [Builting Fusion]
+    Moved socket directory from "/tmp/fusion.#" to "/tmp/.fusion-#".
+    Change socket ownership according to shmfile group.
+    Speed up fusion_call_execute(FCEF_ONEWAY) by not creating a new socket.
+
+commit fb5a9c5cac676c51c04bc340c7921ef17fa8d5f4
+Author: Claudio Ciccani 
+Date:   Sat Dec 1 15:52:18 2007 +0100
+
+    (Pre)Parse shmfile group in fusion_config_set().
+
+commit 9fa548c28b76a667c3425f603695e365f92b8483
+Author: Claudio Ciccani 
+Date:   Sat Dec 1 12:37:29 2007 +0100
+
+    [Builtin Fusion]
+    Enable sleeping in fusion_property_lease()/purchase().
+
+commit f50e96923f50c9430d33e8e3d2b979b74803d99c
+Author: Claudio Ciccani 
+Date:   Sat Dec 1 12:36:10 2007 +0100
+
+    [Builtin Fusion]
+    Fail in fusion_skirmish_notify() if playback was destroyed.
+    Sleep for at least 10ms in fusion_skirmish_prevail().
+
+commit b5898ff1d5c8d01ab6fd8e8872d4edc9d98c9685
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 30 15:10:03 2007 +0100
+
+    DIRECT: Use direct_log_lock()/unlock() to ensure stack traces are one contiguous block.
+
+commit 084bc400befc0c03a115deaca1e196b25217c4f5
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 30 15:08:34 2007 +0100
+
+    DIRECT: Added direct_log_lock()/unlock() for ensuring multiple prints are not mixed with others.
+
+commit 93befe97085f492be31534e019f4417863755334
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 30 15:07:34 2007 +0100
+
+    DIRECT: Create default log object.
+
+commit 96869c86a02a9cf99a4ac5170a4c49fd316eab25
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 21 10:30:33 2007 +0100
+
+    SH7722: Added missing Makefile and .gitignore file.
+
+commit 94bd42fab1a1c3dd30df8bd9fb7567f9d9b731e4
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 21 02:56:10 2007 +0100
+
+    Fixed warnings and added more safety in generic rasterizer about blend functions being array indices.
+
+commit 0d04944ae20ebed62ca0fa3b53b316e64c83581e
+Merge: 5bb065a... 0b83ac2...
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 21 02:22:25 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 5bb065a3469a4a2479d35f54a6dd5ae3605e29e0
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 21 02:22:14 2007 +0100
+
+    API: Added DSBF_UNKNOWN for mknames.sh's sake.
+
+commit afb035127e738f3cb94cab19485d32a9239b702a
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 21 02:19:49 2007 +0100
+
+    MKNAMES: Reverted change that made mknames.sh output '0' instead of the identifier for it.
+    
+    C++ doesn't like it and it's too bad for working around enums without a null identifier.
+
+commit 0b83ac212dd46f69fd75adf180e951695a61d07c
+Author: Claudio Ciccani 
+Date:   Tue Nov 20 19:05:49 2007 +0100
+
+    [Builtin Fusion]
+    Implemented fusion_reactor_set_dispatch_callback().
+
+commit 3a86b35b9222eb987744a5737366b9ecc430c138
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 12:44:45 2007 +0100
+
+    CONF: Fixed warning in config_values_parse(), check for D_STRDUP() result with D_OOM() in case of failure.
+
+commit a00d8d052a042c0abdce48d3d86444bcdbe039d6
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 03:52:04 2007 +0100
+
+    GFXCORE: When resetting the 'checked' flags also reset the same in 'accel' flags.
+
+commit 7d693457a0019c1d85ca2d774502a1f20495408f
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 02:06:54 2007 +0100
+
+    MKNAMES: Made it output '0' instead of an identifier for termination.
+
+commit 9b2a22be5939de079fc6a216b4cf5c8321abc8dc
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 02:05:03 2007 +0100
+
+    DFBFX: Added more options: source, destination, color, srcblend, dstblend.
+
+commit c8a35841d38b650bb999973b4621365bb86b6356
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 02:03:57 2007 +0100
+
+    MKNAMES: Moved mknames.sh to the 'tools' top level sub directory.
+    
+    Made it output '0' instead of an identifier for termination.
+    
+    Added DFBSurfaceBlendFlags.
+
+commit eff7d38d602c8b6a518b20b0a40d72586b521837
+Merge: abe3853... 77e2a1c...
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 00:01:16 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit abe3853c06859b53185df2fe54f871c52024687c
+Author: Denis Oliver Kropp 
+Date:   Tue Nov 20 00:01:09 2007 +0100
+
+    Fixed warning.
+
+commit 77e2a1cabccad357cb3b3be58efe37e244137b72
+Merge: 0de9e90... beba5ac...
+Author: Claudio Ciccani 
+Date:   Mon Nov 19 16:01:15 2007 +0100
+
+    Merge branch 'master' of git+ssh://directfb.org/git/directfb/core/DirectFB
+
+commit 0de9e90ad729bef0141e4d7e4ecea36500b67c2c
+Author: Claudio Ciccani 
+Date:   Mon Nov 19 15:59:41 2007 +0100
+
+    [Builtin Fusion]
+    Honor FCEF_ONEWAY in fusion_call_execute().
+    
+    Execute ref watcher with the FCEF_ONEWAY flag.
+    
+    Avoid blocking in _fusion_check_locals():
+    instead of removing dead references while iterating the list of fusionees,
+    build a local list of references that must be removed and process them later.
+
+commit beba5ac47474e45b821362444fb31978a7183e17
+Merge: 51a97f4... d7b6ca4...
+Author: Denis Oliver Kropp 
+Date:   Mon Nov 19 15:51:15 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 51a97f42b4a0c3c62a7fd064c02aca0c5d3e4c35
+Author: Denis Oliver Kropp 
+Date:   Mon Nov 19 15:50:45 2007 +0100
+
+    DIRECT: Call DEFINE_INTERFACE() for IAny properly, i.e. with a comma at least.
+
+commit d7b6ca4e98a40932517e6a166bb2f4d5c28ecf79
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 18 11:17:34 2007 +0100
+
+    DFBFX: Provide two example states, the new premultiplied font rendering and the old broken (for dstalpha) one.
+
+commit ea07fe7128ee5f482e8705c7c19c078d6abf068f
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 18 02:42:31 2007 +0100
+
+    fx is replaced by dfbfx and gets installed. Documented code. Ongoing command line parsing...
+
+commit 289295be51a0077e11e7ef0e72fe650363395df9
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 21:18:59 2007 +0100
+
+    VERSION: 1.1.1 (same binary age)
+
+commit 409d3389070a147f06b4cc3159724161e718e2ed
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 20:58:47 2007 +0100
+
+    RC: Moved new 'linux_input_grab' member in the DFBConfig structure to the end
+    for binary compatibility with DirectFB 1.1.0 release.
+
+commit 6f9aec1af1844463fc64193330de3b6c246874d2
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 19:49:11 2007 +0100
+
+    Fixed type issues (at least with 2.6.24-rc3) by moving  further up.
+
+commit 975798d0b0977408000c42fc8892b8294835f344
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 19:41:19 2007 +0100
+
+    Output "Fusion Kernel Device" flag in configure output.
+    
+    Also print a warning at the end if builtin Fusion is used.
+
+commit 0ee6ee9619117e87f278d18078c51cdb20f5db8a
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 17:26:21 2007 +0100
+
+    Fixed warnings.
+
+commit f793e0660c552e0eea66d05507b5754749af5699
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 15:36:57 2007 +0100
+
+    Fix format issues because of varying u64 definitions, use "%llu" again and cast to unsigned long long.
+
+commit 34406baa244ed31c37ce3bbd8b96832f2eba3e05
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 15 18:01:56 2007 +0100
+
+    Fixed warnings.
+
+commit fc2a43d08af2352c2a7e1cd18e486229139ee55e
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 15:25:13 2007 +0100
+
+    Added "-dl" or "--dumplayer" for dumping the front buffer of each active contexts' primary region.
+
+commit df4b2cbde8a6d2d76f3b2be1eb7cdcd74f72fbc6
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 15:09:19 2007 +0100
+
+    Added convenience function dfb_surface_dump_buffer().
+
+commit 6c44ce8cf2aa9292972cd8ee8c485082e227576e
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 09:13:40 2007 +0100
+
+    Added "[no-]thread-block-signals" and cleaned up config code.
+    
+    Moved direct and fusion option parsing into direct_config_set() and fusion_config_set().
+    
+    Call these from higher level config code.
+    
+    Added direct_config_usage and fusion_config_usage and use it the same way.
+
+commit af67337836291ae86a98e3c916de51b45ecb4d0a
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 09:11:14 2007 +0100
+
+    Fixed debug message.
+
+commit 8b7d1920aa554559299847e58a8812f78dfc6f68
+Merge: 4cc82ba... c678f5c...
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 09:09:56 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 4cc82baddbc3a9849c2ff6c4979a65bcfb6ba96b
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 08:22:55 2007 +0100
+
+    Fixed GetFramebufferOffset() by adding CSAF_GPU_READ when Lock() is called on a DSCAPS_VIDEOONLY surface.
+
+commit c678f5c042b60b2dd2e00fe0945711ade703451a
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 18 15:57:41 2007 +0200
+
+    Added debug and error messsages to dfb_layer_context_set_configuration().
+
+commit ba7c645417dd2d7c72a87f18dff2509031ab99ef
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 15 22:13:39 2007 +0100
+
+    Added fusion_reactor_set_name() to change the name of a reactor after its creation.
+
+commit 8427e5add8addf5a66098fbd667f70031c434670
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 15 18:57:36 2007 +0100
+
+    Added "Core/GraphicsOps" debug domain with a message per graphics operation.
+
+commit 6eef50dacf42907e53e7b236ce4393753dd27a74
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 15 18:09:49 2007 +0100
+
+    When switching to an indexed layer format, use dfb_surface_init_palette() if no palette exists already.
+
+commit f05de1d313d84e5f1e989b30c4e8605e79b2a0b2
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 15 17:17:25 2007 +0100
+
+    Moved surface palette creation from dfb_surface_create() into new dfb_surface_init_palette().
+
+commit 237efd2ec9cd30fada65d9437d05f2ce121a313b
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 18 15:57:41 2007 +0200
+
+    Added debug and error messsages to dfb_layer_context_set_configuration().
+
+commit 01536af1b96f7212d4c55566caea1c9c8984ba68
+Merge: 619d813... 7fb1cb2...
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 08:18:30 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 619d813b9a6568e027140e20306f06aac221d87a
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 17 08:16:24 2007 +0100
+
+    Use SO_REUSEADDR in case of multicast.
+
+commit 7fb1cb229068b9ebf9e9b5f7bb5ff68b0dbc9261
+Author: Claudio Ciccani 
+Date:   Thu Nov 15 10:46:03 2007 +0100
+
+    Added new URI fd:/.
+    Used to create a DirectStream from an already opened file descriptor.
+
+commit d5c44b9f46505792d65cafc91479662248b3dcd6
+Author: Claudio Ciccani 
+Date:   Wed Nov 7 14:57:52 2007 +0100
+
+    [Builtin Fusion]
+    Check for dead property purchaser, too.
+
+commit 428a5be29271ba1098c5d2253225c7306d0f999a
+Author: Claudio Ciccani 
+Date:   Wed Nov 7 14:56:26 2007 +0100
+
+    [Builtin Fusion]
+    In fusion_ref_zerolock(): check local references before entering the loop.
+
+commit 1b2b598b8c6c8d45d01618ce4ca85583268694b5
+Author: Claudio Ciccani 
+Date:   Tue Nov 6 10:13:28 2007 +0100
+
+    Sleep for 10 usec in WaitVSync loop.
+
+commit f5bbbf1e7c3ec13d9eb24e0fb50ede1415f45ea1
+Author: Claudio Ciccani 
+Date:   Mon Nov 5 12:26:57 2007 +0100
+
+    [Builtin Fusion]
+    Use fusion_skirmish_wait() instead of usleep() in fusion_ref_zerolock().
+
+commit e1805a4018dccbdc5749c867fa962e14e3449e84
+Author: Claudio Ciccani 
+Date:   Sun Nov 4 12:55:03 2007 +0100
+
+    Added a couple of videoprovider events:
+     - DVPET_FINISHED, sent when playback is finished
+     - DVPET_SURFACECHANGE, sent when size/format change
+
+commit b84e090292684cf1f9d60ea35d0c506c8cb9ce2c
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 14:40:52 2007 +0100
+
+    Added missing DSCCAPS_VSYNC flag to indicate support for WaitForSync().
+
+commit 4fcb711d661e3d9b8541b08eb3c043c2df759c60
+Merge: ef9942b... 2022577...
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 14:10:20 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit ef9942b04dd30e05683e106095def32087699a97
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 14:06:47 2007 +0100
+
+    Added patch for davincifb to support triple buffering on OSD.
+
+commit 20225771508792b4511550d83e3af4ad9c697309
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 13:33:21 2007 +0100
+
+    Set driver vendor for TI Davinci.
+
+commit 5b2d53ba81a83ab7d2d89d29aec251622ed6f9b8
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 12:25:28 2007 +0100
+
+    Added TI Davinci driver.
+    
+    Supports OSD and Video with positioning, color key, opacity and alpha channel.
+    
+    The driver uses the devmem system and opens all frame buffer devices itself.
+    This is required for extended ioctls like setting the OSD position, but also to
+    support alpha channels which are stored in a different frame buffer device. In
+    case of ARGB for the OSD, the alpha channel (3 bit!) is dithered during conversion.
+    
+    Implemented surface pools for OSD and Video layer. This enables direct usage
+    of the frame buffers in case of RGB16 for OSD and UYVY for Video.
+
+commit 8528a2076e3c3639a025f1a02fb2ca4aa107b30f
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 2 11:04:19 2007 +0100
+
+    Fixed allocation size for planar formats in FBDev Surface Pool.
+
+commit 32897684d0b6f6bcda0c1056ea1783853b01cb58
+Merge: 7816a30... e906b75...
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 31 10:46:05 2007 +0100
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 7816a304a37a5dc8be620ce59d6877e50814e9be
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 31 10:45:08 2007 +0100
+
+    Moved IDirectFBDataBuffer_File_data to header file.
+
+commit e906b757451e61d18eaec42f9c5e7f69c1ab6a68
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:27:52 2007 +0200
+
+    Fix a pointer buglet.
+    
+    The pfetch pointer was compared/set instead of the value to which it pointed.
+
+commit 5b8a374d114f86814ce8fdfcd514319e477584c5
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:18:37 2007 +0200
+
+    Build the nvidia driver with gfxdrivers=all.
+
+commit 36c7777b9440c9b9b6117672e4193df1dfb45d9c
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:17:55 2007 +0200
+
+    Port unichrome to the new surface core. Only compile tested.
+
+commit e77bf93bfbc450f756c07316b36ec08549223450
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:17:40 2007 +0200
+
+    Port tdfx to the new surface core. Only compile tested.
+
+commit 42e7d212b311b7a1452e102b43c80e86bbcab264
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:17:28 2007 +0200
+
+    Port sis315 to the new surface core. Only compile tested.
+
+commit 093134120e7f66773c30565679ac944c7f117ca8
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:17:06 2007 +0200
+
+    Port savage to the new surface core. Only compile tested.
+
+commit 50558df00a6ca857c942ded9ab1334dd508db5ab
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:16:43 2007 +0200
+
+    Port nsc to the new surface core. Only compile tested.
+
+commit a21757e38bef58948b2863ba07e2d3fed276af1e
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:16:25 2007 +0200
+
+    Port neomagic to the new surface core. Only compile tested.
+
+commit 71bbcc90bdf32dab81d9341d2874b4b7acd44991
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:14:57 2007 +0200
+
+    Port i830 to the new surface core. Only compile tested.
+
+commit 12c5dbb1675ca5fdfecd26dbc308da595f6f0ad3
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:14:39 2007 +0200
+
+    Port i810 to the new surface core. Only compile tested.
+
+commit 4cb0627e7b8a71d51dbe21a038ed00fd7191312a
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:14:24 2007 +0200
+
+    Port cyber5k to the new surface core. Only compile tested.
+
+commit 030a19a4dc8764b85b2801773e8d06c87e2ada99
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:14:11 2007 +0200
+
+    Port cle266 to the new surface core. Only compile tested.
+
+commit 7775f860ff39b818f8fc0a8af918907a1e245421
+Author: Ville Syrjala 
+Date:   Mon Oct 29 20:13:53 2007 +0200
+
+    Port ati128 to the new surface core. Only compile tested.
+
+commit 963e73a8dfcec4a3475110b06745f7c05e15ccab
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 25 16:47:31 2007 +0200
+
+    Reallocate layer region surfaces on context activation.
+
+commit 0dbccefb4af1e271453276f0755da329626fca29
+Merge: 19683c1... 6ffb80f...
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 25 13:32:23 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 19683c1e1ea3de951c6cd4ae0e2ecfec259d6847
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 25 13:32:15 2007 +0200
+
+    Join multicast group if family is AF_INET and IN_MULTICAST is true.
+    
+    Use bind() instead of connect() for receiving UDP data.
+
+commit 6ffb80f98c2190616509207ab3c4710380fb9e64
+Merge: bfaf34f... 57e5c3e...
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 20 15:51:06 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit bfaf34f83b2594a2d37b0703aeb69ef56d8ea442
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 20 15:50:02 2007 +0200
+
+    Changed assertion into a check, in case of a failure, unrealize_region() can
+    be called with the surface not being locked.
+
+commit 57e5c3e8988bf7b3136cb3a03a769c2c08aab054
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 18 15:58:01 2007 +0200
+
+    Added debug message to dfb_surface_reconfig().
+
+commit fba8b289dd576989fdf9a18a71581ce5616ae232
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 18 15:57:41 2007 +0200
+
+    Added debug and error messsages to dfb_layer_context_set_configuration().
+
+commit fcb10e2f939a01dd9252880b74de0193ed7014b7
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 18 15:50:13 2007 +0200
+
+    If alpha is zero, still check for RGB when looking up the index.
+
+commit d6985e88eb3de5ae9f32e2f7480086aaba14a873
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 15 08:47:32 2007 +0200
+
+    Sleep 2ms when read returns 0, to avoid CPU hogging.
+    
+    Thanks to Luis Mondesi lemsx1 gmail.
+
+commit bcd261d167587a87db3a6377836e74a24f3193a2
+Merge: 40f5795... 50297fc...
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 18:27:57 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 40f579579ff6a7a15ab919ac765398062a898dd7
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 18:27:48 2007 +0200
+
+    Fixed alignment issues by applying VOODOO_MSG_ALIGN() on each message block.
+
+commit b5ce8fca87d885269239aefb42e8e33e33677410
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 18:26:56 2007 +0200
+
+    Initialize libdirect in DirectFBCreate() already.
+
+commit 50297fc3e1655ded4717d5fb6db9cf3e5646d41c
+Merge: 6a364bd... 0c58770...
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 17:37:57 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 6a364bd5196d3de87a92c731eedf76a96d6bf8e0
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 17:37:41 2007 +0200
+
+    Implemented some more requestor/dispatcher methods.
+
+commit 0c587702a603fe93a96009a983b2350d9e839c0f
+Author: Claudio Ciccani 
+Date:   Sun Oct 14 17:31:19 2007 +0200
+
+    Fixed possible deadlock in IDirectFBDataBuffer_File_WaitForDataWithTimeout().
+
+commit 1c8ef7b8b6970d6e91294dc15b08b304a110b6a4
+Merge: eb2825d... a8f1402...
+Author: Claudio Ciccani 
+Date:   Sun Oct 14 16:11:02 2007 +0200
+
+    Merge branch 'master' of git+ssh://directfb.org/git/directfb/core/DirectFB
+
+commit eb2825d945fd2f9893f6acbf83d52166b36cedf5
+Author: Claudio Ciccani 
+Date:   Sun Oct 14 16:10:32 2007 +0200
+
+    usleep(0) -> usleep(1)
+
+commit a8f1402edb9b21acab4344af00760528400e1a4c
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 14 16:09:30 2007 +0200
+
+    Workaround redefinition of SIZEOF_LONG in FT2 headers.
+
+commit 6a9128fdb0187ec7c9a99bb6b88c6c369eaa49a6
+Author: Claudio Ciccani 
+Date:   Sun Oct 14 14:44:25 2007 +0200
+
+    [builtin-fusion]
+    SHMPool:
+     - Return DFB_NOSHAREDMEMORY if reaquested allocation exceeds the maximum address of the pool.
+    
+    Ref:
+     - Added _fusion_ref_change() (implements fusion_ref_up/down())
+     - When local references must be dropped, do not modify the FusionRef directly, use _fusion_ref_change() instead.
+    
+    Skirmish:
+     - When fusion_skirmish_wait() gets called with a timeout value, check whether the timeout expired *before* sleeping.
+
+commit 6850da1757bc6b8a32859ed131b7289317f1e87c
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 13 01:00:40 2007 +0200
+
+    Translate characters to indices in IDirectFBFont::GetKerning().
+
+commit e7f2fd5ff297cd459be3d7227899c42dbf67426f
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 20:46:15 2007 +0200
+
+    The source rectangle 'rect' argument to dfb_gfx_copy() and dfb_gfx_copy_to() is const now.
+
+commit 00a94f55d4426d12dae777526484648d6862ee14
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 07:54:38 2007 +0200
+
+    In GetSurface() for exclusive single buffer layer call dfb_layer_region_flip_update()
+    after clearing the surface.
+
+commit ee7b5a24f01b0f77e5f4520e84a54759f7505175
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 00:55:25 2007 +0200
+
+    Clear stacking class flags before parsing layer-stacking option.
+
+commit 049c9c93bb574aed8b8927b507610965472b0503
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 00:46:11 2007 +0200
+
+    Added "no-init-layer [= ]" option to disable initialization of layers.
+    
+    Primary layer is initialized by default, use this option to avoid that.
+
+commit a9c1a7d8192c7730445c24ca096675834d8aaf41
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 00:32:28 2007 +0200
+
+    Set default stacking classes for primary layer.
+    
+    This fixes the need to set "layer-stacking" in the directfbrc.
+
+commit fc1df58d400bf9e3845024a198b1920b075ceb12
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 00:06:28 2007 +0200
+
+    Made unrealize in disable/deactivate depend on CLRSF_REALIZED.
+
+commit 116096a84f8453d34544c0bc0e1b42acc32c87a7
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 12 00:00:27 2007 +0200
+
+    Fix debug build.
+
+commit 1f6003afb2d2549b98b411a4c7d1e5ddab20d2c9
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 11 13:00:57 2007 +0200
+
+    Implemented defered region realization by adding CLRSF_FROZEN
+    which is set initially on every region that is created.
+    
+    As long as CLRSF_FROZEN is set, all SetRegion() calls to the
+    driver (and buffer allocations due to it) are simply discarded.
+    
+    Only when dfb_layer_region_flip_update() is called and the region
+    is enabled and active, the flag is removed and the region is either
+    realized or the config is just set if it was already/still realized.
+    
+    That means from a driver's point of view: AddRegion(), SetRegion()
+    and either FlipRegion() or UpdateRegion() are called in a row for
+    the first time, with a buffer that is already initialized with the
+    proper content.
+    
+    However, the driver should still not show the region in SetRegion(),
+    but in FlipRegion() or UpdateRegion(). This is because between the
+    SetRegion() and the FlipRegion() call, the locked buffer changes to
+    the correct one (only for multi buffer modes).
+    
+    NOTE: This needs more testing, especially single buffered exclusive
+    contexts where the application might never call dfb_layer_region_flip_update().
+
+commit df154b87b4cf7f7dc2707ae9f31201c3497cf02f
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 11 12:01:34 2007 +0200
+
+    Ignore files.
+
+commit e3e13042b565b5efddb50aaf1f1bca2b91045073
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 9 03:46:06 2007 +0200
+
+    Made argument to fusion_skirmish_lock_count() const.
+    
+    Added unimplemented fusion_skirmish_lock_count() for single app.
+
+commit 6e753d283215db8743876880d3871c0dd9a02bf5
+Merge: 3a39545... cc5cff7...
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 11 16:08:02 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 3a395457e642b41f9718716f2116734f4d454859
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 11 16:07:54 2007 +0200
+
+    Added dfb_gfxcard_get_driver_data().
+
+commit cc5cff7ca6637a32ffe06c4880befc7df68a4a4b
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 23:37:22 2007 +0200
+
+    Make DFIFF fast for the standard case again (60->483 MPixel/sec).
+    
+    Added support for sub surfaces with proper clipping/offset.
+    
+    Check for unscaled and unclipped loading without format conversion
+    and just use dfb_surface_write_buffer().
+
+commit 94106005540286080edcfb0eeebd0fb5ed42e2a7
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 23:34:50 2007 +0200
+
+    Added convenience functions dfb_surface_read/write_buffer().
+
+commit 1e264d5a0e6348d901cbd476bae94118487255f3
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 11:16:28 2007 +0200
+
+    Fixed missing error return in IDirectFB_CreateDataBuffer().
+
+commit 7c570d664d212eef5210c4c1025c30031c60c6ed
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 11:15:50 2007 +0200
+
+    Improved debug messages in thread code.
+    
+    Added "Direct/Thread/Init" domain to watch creation, wait,
+    startup, initialization, notification ...
+
+commit 0bd6594f819cec774a43c203da4e147d980e1bbb
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 7 19:55:40 2007 +0200
+
+    Big smooth scaler restructuring and cleanup. Added DSBLIT_COLORKEY_PROTECT to
+    prohibit writing the color that the destination surface uses as a source color key.
+    
+    This is used internally at the moment.
+    
+    Removed messages from non-debug mode.
+
+commit e5d3101bcb67bacb8a8772f222729dc4dc692b3a
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 10:35:32 2007 +0200
+
+    Made smooth scaling support source rectangles not starting at 0,0.
+
+commit bbc638f3392549718d3047209a8b20d57ec3ac0d
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 11:58:40 2007 +0200
+
+    Fixed illness in processing read data in serial driver and fixed error path. (2)
+
+commit 3df393e8ec53c54af2ba94e7cb3b59aae299028b
+Merge: 82e1d70... a047bd9...
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 11:55:02 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 82e1d70612cd58f2d3cded4c7baf60ae3d5432e5
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 8 11:54:47 2007 +0200
+
+    Fixed illness in processing read data in serial driver and fixed error path.
+
+commit a047bd9c0bf9e6a2852915d8d32b4a9c5c03dd7f
+Author: Claudio Ciccani 
+Date:   Mon Oct 8 11:42:59 2007 +0200
+
+    Check for dead local references in fusion_ref_zero_lock()/trylock().
+
+commit 18cac729a47d2cbe637d78d90441e7305be063b5
+Author: Claudio Ciccani 
+Date:   Mon Oct 8 11:20:29 2007 +0200
+
+    Fixed lock+reconfig bug: fail when trying to reconfig a locked surface.
+
+commit 7c861f6d153e428cc649f47671b8e7b164d36f80
+Author: Claudio Ciccani 
+Date:   Mon Oct 8 11:18:28 2007 +0200
+
+    Fixed missing DSCAPS_SHARED.
+
+commit 5532c78bba32e1c5c3dc54894b1d4825cd6b6290
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 5 12:36:55 2007 +0200
+
+    Added dfb_convert_to_uyvy() and dfb_convert_to_yuy2(), only copy supported yet.
+
+commit c57cc4e28da2726ba185babfb7b14f8a9fc1c552
+Author: Denis Oliver Kropp 
+Date:   Fri Oct 5 12:36:15 2007 +0200
+
+    Made DisplayLayerFuncs const when being passed or used.
+
+commit 05525befa49b2ef2239e536854380e3e1b962011
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 23:10:58 2007 +0200
+
+    Added dfb_convert_to_a4() and added RGB32/ARGB support to dfb_convert_to_rgb16().
+
+commit 33d8c704ad09eecd37e034a3127880ddc48467a3
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 17:33:31 2007 +0200
+
+    Added CORE_TI_CMEM.
+
+commit da5c817392e3caa2ad225f2dc3305cc6beb594a0
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 17:29:52 2007 +0200
+
+    Refuse to set non-shared surfaces as a background image for a window stack.
+
+commit 20aa428fc8bdf482a22b5267460c0cd8eb6a5fb8
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 17:29:09 2007 +0200
+
+    Added DSCAPS_SHARED for creating shared surfaces, not using local (malloced) memory pool.
+
+commit ef26fc5c15468c17cd417a954e10c01a01f391e9
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 13:54:36 2007 +0200
+
+    Fix usage of hardcoded /dev/mem while the error message was already using DEV_MEM macro.
+
+commit 5754b68d8c62e9a1e1e3116f583011f25a9e2432
+Merge: 303e4c7... d95d532...
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 13:51:56 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 303e4c7da3ba3c23b8f02cd908a6a3a793d175a7
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 13:51:01 2007 +0200
+
+    Fix redefinition of MIN by including  earlier.
+
+commit de20d5e0b57e2210261e33a7f5317ee1ea72020b
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 13:50:13 2007 +0200
+
+    Fix surface pool name in DevMem system.
+
+commit 7ab218745a0fbac3c9a19c3a84d81eef5ac9f6be
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 4 13:49:14 2007 +0200
+
+    Fix redefinition of HAVE_STDLIB_H in jconf.h by undefing it before including jpeglib.h as last.
+
+commit d95d5329e34b012f8a247ffa1a18ed9fbf39c79e
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 3 00:49:53 2007 +0200
+
+    Added mutex and condition for thread initialization and revert recent priority initialization via pthread_attr_t.
+    
+    No more DIRECT_THREAD_WAIT_CREATE.
+    No more sched_yield().
+
+commit 0dd046043497678a3f344f80b263d4bf842a8793
+Author: Claudio Ciccani 
+Date:   Tue Oct 2 18:39:36 2007 +0200
+
+    Enable using premultiplied ARGB4444, too.
+
+commit 4853800fe95c1a19988adcf9a7e9f896402012a5
+Author: Claudio Ciccani 
+Date:   Tue Oct 2 18:37:41 2007 +0200
+
+    Instead of emitting vertices instantly, store them in a buffer that is submitted on EmitCommands() (this way DrawString() is about 45% faster with my 9200SE).
+    
+    R100/R200: Dropped some blend functions when destination format is A8 ((INV)DEST alpha never worked because A8 isn't really supported as dest format).
+    
+    R300: Implemented BLEND_COLORALPHA, COLORIZE, PREMULTCOLOR with some limitations (source must be premultiplied and COLORALPHA+ALPHABLEND isn't supported at all).
+    
+    Switch to version 1.1
+
+commit 4ad84d63cdf29742f8ec8e3726b7e30c9beff773
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 16:12:56 2007 +0200
+
+    Initialize scheduling priority & co right away via pthread_attr_t.
+
+commit 10cc8e482accc24404dc1c8d4e916a14baed57d9
+Author: Ville Syrjala 
+Date:   Thu Sep 27 22:04:35 2007 +0300
+
+    Add linux-input-devices and tslib-devices options
+    
+    These options can be used to specify a list of devices to use. If these
+    are specified the normal probing using standard device names is not
+    performed.
+
+commit b53b207b93669649942cadb75d5e5caaf7f526ba
+Author: Ville Syrjala 
+Date:   Thu Sep 27 14:58:58 2007 +0300
+
+    Add a new option [no-]linux-input-grab.
+    
+    [no-]linux-input-grab will control whether linux_input will grab the
+    devices. This is useful in cases where multiple processes want to receive
+    input events.
+
+commit 5cf85082ae56fa9879aaa1dad6cc086fda054501
+Author: Ville Syrjala 
+Date:   Thu Sep 27 22:15:55 2007 +0300
+
+    Fix compilation with zlib.
+
+commit c4692d94256e865070eb0db37c15dd0896fa1557
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 27 19:32:10 2007 +0200
+
+    Fixed DevMem system for multi app.
+
+commit b76f7b0606f4d338d8766a878fa4026b1c282023
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 13:30:27 2007 +0200
+
+    Implemented DSBLIT_BLEND_COLORALPHA on SH7722.
+    
+    Does not work in conjunction with DSBLIT_BLEND_ALPHACHANNEL, yet :(
+
+commit f46381f1dba1685bd892458fa0b406c4fd91c392
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:49:59 2007 +0200
+
+    Added ClanBomber2 at 800x600 with 48 fps and 46% load to SH7722 README.
+
+commit 43547a4e959cbd966b1699b9d08b477a9e109e15
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:48:14 2007 +0200
+
+    Clip SH7722 layer (only width/height yet, x/y set to 0 if <0).
+
+commit 2cc3f22838977ab1208dd57a835ecf0dc74a588e
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:20:14 2007 +0200
+
+    Updated SH7722 README.
+
+commit f30b7d2d05e3bd917ce89497a21cce32834ac018
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:19:07 2007 +0200
+
+    Accelerate DSBLIT_COLORIZE on SH7722 only for font surfaces! Check for CSTF_FONT :)
+
+commit c5717d0b436c850182e0a3e7cada34b90520c33e
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:09:22 2007 +0200
+
+    Implemented DrawString() for SH7722.
+    
+    It's using color change frmo 0xffffff to the text color,
+    i.e. any other colorizing blit with non-white pixels is
+    not correct at the moment.
+    
+    Anti-aliased Text                              3.056 secs (*  98.952 KChars/sec) [ 46%]
+
+commit 3e057e7fe1bbcfc092ada83a29ce86d26e2c55b5
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 12:06:19 2007 +0200
+
+    Added option "[no-]font-premult" for premultiplication in case of ARGB glyph images. Default is enabled.
+
+commit 8388ad4feff94e7a4515426e846acc33e80a5347
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 10:49:07 2007 +0200
+
+    Updated SH7722 results in README.
+
+commit 1c35ccc706ca693c06a3d16ffc8b90c7d918740d
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 10:32:28 2007 +0200
+
+    Implemented DSBLIT_ROTATE180 for SH7722.
+
+commit ec118fe86657723aec9688e7322d9b3d715384a5
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 10:26:49 2007 +0200
+
+    Don't use page flipping, but blitting, if rotation is active.
+
+commit 52df55b9879869764908b214fe532624b1fefddc
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 25 09:35:59 2007 +0200
+
+    Implemented triangle filling on SH7722.
+    
+    Indicate hardware clipping, other minor cleanup.
+    
+    Benchmarking with 256x256 in 16bit mode... (16bit)
+                                                                                    CPU load
+    Fill Rectangle                                 5.736 secs (*  69.694 MPixel/sec) [  3%]
+    Fill Rectangle (blend)                        11.576 secs (*  22.079 MPixel/sec) [  1%]
+    Fill Triangles                                 4.175 secs (*  62.004 MPixel/sec) [  6%]
+    Fill Triangles (blend)                         8.134 secs (*  21.754 MPixel/sec) [  2%]
+    
+    (*) SH7722/BLT: 37 starts, 37 done, 37 interrupts, 9 wait_idle, 11 wait_next, 16 idle
+    (*) SH7722/BLT: 351922 words, 9511 words/start, 21995 words/idle, 2 starts/idle
+
+commit 3e5797b41f93a7a02be20f21585fc3fe59304e46
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 18:40:04 2007 +0200
+
+    more ignores
+
+commit bb9fefe9a4bf702d5acf2c323f7ea28f6e464e0c
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 14:32:57 2007 +0200
+
+    Removed "Benchmarking with..." line in case study.
+
+commit cc3a850db1456c41c934a7d1d7e460b34b75ded5
+Merge: 495b733... f573fb7...
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 14:27:53 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 495b733dce6dc8089cb2a3e2957f95d1c2bf80ad
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 06:04:29 2007 +0200
+
+    Added 127.79 BogoMIPS to the figure, yeah that's true, just 127.79 and only 14% CPU load with df_andi running 800x480 at 28.1 fps :)
+
+commit f9601806b03aa9d7ad111a27c8c4e6c8ad71456b
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 06:00:28 2007 +0200
+
+    Fixed DrawRectangle() for 1xN and Nx1 cases.
+
+commit f573fb781400ca68129261ee014b64f825c429f8
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 05:17:13 2007 +0200
+
+    Added dfb_surface_buffer_dump() implementation.
+
+commit 44be56c9d7c8e9ada5115c99ea971751b8683f81
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 05:11:10 2007 +0200
+
+    Fixed missing color key flags when only index is set via config file.
+
+commit 88789f729eabcd0e7393e8281afe353da3d7582b
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 05:00:57 2007 +0200
+
+    Added gitignore file.
+
+commit 7ba48e5ab16a044d8c6966224fdd76ac992b3d72
+Merge: 3952674... 9066689...
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 04:58:23 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 9066689be79d9498b04a5c7009a90a8ef88bfe08
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 03:42:25 2007 +0200
+
+    Renesas SH7722 graphics driver
+    ==============================
+    
+    This driver supports the SH7722 SoC from Renesas Solutions Corp. controlling
+    - LCDC (LCD Controller) for display
+    - BEU (Blit Engine Unit) for blending of planes
+    - TDG (2D Graphics) for accelerated operations
+    
+    It's using a kernel device called sh7722gfx which mainly does interrupt handling.
+    
+    The 2D Graphics unit supports display lists in RAM and reads them via DMA. These
+    lists consist of double word entries, first word designates a register, second
+    word contains the data to write. Once a list has been completely processed, the
+    hardware generates an interrupt to start the next list.
+    
+    The kernel module allocates a ring buffer for usage as a display list. The user
+    space prepares a block of commands and puts it into the ring buffer. If the hardware
+    is idle, it's started directly from user space. When a DMA completion interrupt
+    is received, the next block of commands is started from kernel space. If the
+    hardware is still running the previous block, new commands are appended to the
+    next one. The driver is designed to run without any locking or system calls. Only
+    a few interrupts happen over time depending on the operations. The hardware is not
+    getting idle, while commands are being sent to keep it busy. There's just a minimal
+    gap which is the interrupt handler setting the new start address and kicking the
+    hardware again.
+    
+    To build the kernel module use "make -f Makefile.kernel". You might want to set
+    the variables KERNEL_SOURCE, KERNEL_BUILD (if != KERNEL_SOURCE), KERNEL_VERSION
+    and DESTDIR.
+    
+    To run the driver you need the DevMem system module using the directfbrc.sh7722
+    file (renamed to directfbrc in $prefix/etc).
+    
+    Performance (as of 2007-09-20, multi app)
+    -----------------------------------------
+    
+    Benchmarking with 256x256 in 16bit mode... (16bit)
+                                                                                    CPU load
+    Anti-aliased Text                              3.020 secs (   41.721 KChars/sec) [100%]
+    Anti-aliased Text (blend)                      3.328 secs (   10.817 KChars/sec) [100%]
+    Fill Rectangle                                 5.549 secs (*  69.681 MPixel/sec) [  3%]
+    Fill Rectangle (blend)                        11.873 secs (*  22.079 MPixel/sec) [  1%]
+    Fill Rectangles [10]                           9.384 secs (*  69.838 MPixel/sec) [  0%]
+    Fill Rectangles [10] (blend)                  14.836 secs (*  22.086 MPixel/sec) [  0%]
+    Fill Triangles                                 3.024 secs (+  50.929 MPixel/sec) [ 40%]
+    Fill Triangles (blend)                         3.064 secs (+  20.319 MPixel/sec) [  8%]
+    Draw Rectangle                                 3.284 secs (*   6.942 KRects/sec) [ 26%]
+    Draw Rectangle (blend)                         3.302 secs (*   6.268 KRects/sec) [ 25%]
+    Draw Lines [10]                                3.238 secs (*  28.103 KLines/sec) [ 20%]
+    Draw Lines [10] (blend)                        3.198 secs (*  27.829 KLines/sec) [ 19%]
+    Fill Spans                                     3.092 secs (*  61.466 MPixel/sec) [ 33%]
+    Fill Spans (blend)                             3.094 secs (*  21.181 MPixel/sec) [ 11%]
+    Blit                                          10.436 secs (*  30.143 MPixel/sec) [  2%]
+    Blit colorkeyed                                9.333 secs (*  32.301 MPixel/sec) [  2%]
+    Blit destination colorkeyed                    3.763 secs (    6.966 MPixel/sec) [ 99%]
+    Blit with format conversion                   13.369 secs (*  22.549 MPixel/sec) [  1%]
+    Blit with colorizing                           4.419 secs (    2.966 MPixel/sec) [100%]
+    Blit from 32bit (blend)                       21.973 secs (*  13.123 MPixel/sec) [  1%]
+    Blit from 32bit (blend) with colorizing        5.129 secs (    1.277 MPixel/sec) [100%]
+    Stretch Blit                                  10.271 secs (*  33.463 MPixel/sec) [  3%]
+    Stretch Blit colorkeyed                        7.895 secs (*  35.159 MPixel/sec) [  3%]
+    
+    (*) SH7722/BLT: 940 starts, 940 done, 940 interrupts, 43 wait_idle, 780 wait_next, 89 idle
+    (*) SH7722/BLT: 24700744 words, 26277 words/start, 277536 words/idle, 10 starts/idle
+    
+    * = accelerated
+    + = half way accelerated
+    
+    Statistics
+    ----------
+    
+    The statistics at the end are more valuable when looking at one case at a time:
+    
+    Fill Rectangle                                 5.834 secs (*  69.647 MPixel/sec) [  4%]
+    
+    (*) SH7722/BLT: 16 starts, 16 done, 16 interrupts, 4 wait_idle, 2 wait_next, 11 idle
+    (*) SH7722/BLT: 74840 words, 4677 words/start, 6803 words/idle, 1 starts/idle
+    
+    This means that while the FillRectangle() benchmark was running, the hardware
+    didn't get idle, which is obvious when running the benchmark for just 10 ms:
+    
+    Benchmarking with 256x256 in 16bit mode... (16bit)
+    
+    Fill Rectangle                                 0.191 secs (*  68.624 MPixel/sec) [ 10%]
+    
+    (*) SH7722/BLT: 13 starts, 13 done, 13 interrupts, 4 wait_idle, 0 wait_next, 11 idle
+    (*) SH7722/BLT: 2840 words, 218 words/start, 258 words/idle, 1 starts/idle
+    
+    See? The same number of times becoming idle, but a few less interrupts. Don't
+    worry about the 191 ms the benchmark needed to complete, after 10 ms of stuffing
+    the display list, we need to wait until the hardware is done before measuring
+    the time it took and calculating the result.
+    
+    Here's FillSpans() which as opposed to FillRectangle() does a lot of small commands:
+    
+    Fill Spans                                     3.028 secs (*  61.467 MPixel/sec) [ 34%]
+    
+    (*) SH7722/BLT: 245 starts, 245 done, 245 interrupts, 3 wait_idle, 185 wait_next, 22 idle
+    (*) SH7722/BLT: 5828128 words, 23788 words/start, 264914 words/idle, 11 starts/idle
+    
+    Example kernel log (debug mode)
+    -------------------------------
+    
+    0.549.014 - sh7722_reset     : Resetting hardware...
+    0.549.046 - sh7722_reset     : Initializing shared area...
+    0.549.748 - sh7722_reset     : Clearing interrupts...
+    0.549.770 - sh7722_reset     : Ready        (   idle, hw     0-    0, next     0-    0, invalid, HC 0000000, INT 000000)
+    0.568.700 - sh7722_wait      : Waiting..... (running, hw     0-   54, next    56-   56, invalid, HC 1010111, INT 000000)
+    0.573.339 - sh7722_tdg_irq   : -Interrupt   (running, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 100100)
+    0.573.397 - sh7722_tdg_irq   :  '-> Idle.   (running, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 000000)
+    0.573.480 - sh7722_wait      : ........done (   idle, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 000000)
+    0.583.575 - sh7722_wait      : Waiting..... (running, hw    56-   78, next    80-   80, invalid, HC 1010111, INT 000000)
+    0.588.414 - sh7722_tdg_irq   : -Interrupt   (running, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 100100)
+    0.588.470 - sh7722_tdg_irq   :  '-> Idle.   (running, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 000000)
+    0.588.544 - sh7722_wait      : ........done (   idle, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 000000)
+    0.601.336 - sh7722_tdg_irq   : -Interrupt   (running, hw    80-  102, next   104-  104, invalid, HC 0000000, INT 100100)
+    0.601.420 - sh7722_tdg_irq   :  '-> Idle.   (running, hw    80-  102, next   104-  104, invalid, HC 0000000, INT 000000)
+    0.700.117 - sh7722_tdg_irq   : -Interrupt   (running, hw   104-  124, next   128-  128, invalid, HC 0000000, INT 100100)
+    0.700.205 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   104-  124, next   128-  128, invalid, HC 0000000, INT 000000)
+    3.115.419 - sh7722_tdg_irq   : -Interrupt   (running, hw   128-  220, next   224-  224, invalid, HC 0000000, INT 100100)
+    3.115.506 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   128-  220, next   224-  224, invalid, HC 0000000, INT 000000)
+    3.151.700 - sh7722_tdg_irq   : -Interrupt   (running, hw   224-  324, next   328-  328, invalid, HC 0000000, INT 100100)
+    3.151.788 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   224-  324, next   328-  328, invalid, HC 0000000, INT 000000)
+    3.159.160 - sh7722_wait      : Waiting..... (running, hw   328-  444, next   448-12994,   valid, HC 1010111, INT 000100)
+    3.161.783 - sh7722_tdg_irq   : -Interrupt   (running, hw   328-  444, next   448-12994,   valid, HC 0000000, INT 100100)
+    3.161.839 - sh7722_tdg_irq   :  '-> Start!  (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
+    4.316.367 - sh7722_tdg_irq   : -Interrupt   (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 100100)
+    4.316.434 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
+    4.316.505 - sh7722_wait      : ........done (   idle, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
+
+commit f7c9d102b178c355582992ad7a3ec22466f19649
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 02:19:55 2007 +0200
+
+    Added direct_page_align().
+
+commit b9e6eafc18de87413cd0de7b6204c4d2c803bb3f
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 01:34:26 2007 +0200
+
+    Use sysconf() if PAGE_SIZE is not defined, though we were able to include .
+
+commit 0925df1ae92832eaebd4698352ce1a80165823fe
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 21 01:18:46 2007 +0200
+
+    Fix missing fusion_shm_enum_pools() for single app core.
+
+commit 9043fb3df3c07554875a21b2391de41971202678
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 20 14:23:37 2007 +0200
+
+    Ignore object files.
+
+commit a98732d61c03a7dd34cf2f53ef6839a56a4d8244
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 20 13:28:12 2007 +0200
+
+    Make bound_windows a DirectLink like usual, fixes aliasing warnings.
+
+commit a019e74d2cc65f3273467b94b1e28d919e4a0b1e
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 20 13:27:16 2007 +0200
+
+    Fixed warning.
+
+commit ff601e69189cce0b6465e57bd112829498bfa64e
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 20 13:26:43 2007 +0200
+
+    Fixed uninitialized warnings.
+
+commit 7373e87d2cc9fc60c3658334577bf65fbbffedc1
+Author: Claudio Ciccani 
+Date:   Wed Sep 19 18:30:34 2007 +0200
+
+    Removed 'HACK FIXME_SC_2 ALLOCATE/SETMODE TWIST' (commit cf4de7cf3677a6252d667342f425f99d8d232043) in primarySetRegion():
+    it was causing DirectFB to not restore the previous video mode when an application exits from fullscreen mode.
+
+commit 3952674f9c7940ce0c3ef24e0702ab5693679403
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 19 08:54:30 2007 +0200
+
+    Added debug message to dfb_layer_set_src_colorkey().
+
+commit 6cf19f1e3a3d13cff8b518b0a92de44502fd87c6
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 10 13:42:29 2007 +0200
+
+    Deallocate layer region surface buffers if the region is being unrealized.
+
+commit c971f839f93c867f17e45264d000572e87f1782a
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 10 13:41:57 2007 +0200
+
+    Added resource_id to DFBWindowDescription and DWDESC_RESOURCE_ID to
+    specify the resource id to use for window surface creation, rather
+    than using the window id for that.
+
+commit ecc8106c6d2ec79b61181e8c8817d0c1848b030e
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 19 08:53:14 2007 +0200
+
+    Fix background color index support.
+
+commit ea8b81988bad68f38bb791d3ab2f1c0d61185bd6
+Author: Ville Syrjala 
+Date:   Mon Sep 17 22:34:34 2007 +0300
+
+    Add TI OMAP gfxdriver.
+    
+    No video layer or other fancy stuff yet.
+    Enough to run XDirectFB on the Nokia N800 though.
+
+commit 024c436d75e8936cb11b974ce8df58cbffc3eab5
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 18 21:35:34 2007 +0200
+
+    If no mixer is showing the layer, use the first one which would support it.
+    
+    Still not the best solution.
+
+commit 05c2b9f22bc829ddb925ef6c3b144b003b31a973
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 17 03:30:01 2007 +0200
+
+    Fix crash in shutdown of /dev/mem system.
+
+commit f7df7fbc8548593fd7e930b7e8ffcdc2ed763b21
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 17 03:00:05 2007 +0200
+
+    Finalize /dev/mem system for new surface core.
+    
+    - Implement surface pool using surface manager.
+    - Added local/shared system data.
+    - Added configure.in and Makefile.am parts.
+    - Cleanups.
+
+commit 0982b02735b76e636d840cffa02a3e8643e18d43
+Author: Denis Oliver Kropp 
+Date:   Sun Sep 16 22:18:39 2007 +0200
+
+    Added LUT8 -> ARGB4444 smooth scaling.
+
+commit 1317af26ea1fb28a762b331f65df566053050e93
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 7 14:57:16 2007 +0200
+
+    Commented out auto center.
+
+commit aa723971a08ecad42dd4ee8cd8a1d4c15fc8ba99
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 7 14:56:53 2007 +0200
+
+    Fixed wheel direction.
+
+commit 9e37f4d7fd4f96237ba3d6c58cda63be74f46b73
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 7 12:52:52 2007 +0200
+
+    Build fixes for Voodoo and Unique on new surface core.
+
+commit 91a28279e8490ba47e217cf038dfe4fb879a86b2
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 7 12:52:23 2007 +0200
+
+    Follow API change in DirectHash.
+
+commit 8c04bfefec14ac83e7cb191b7a17e76973f8b8c2
+Author: Claudio Ciccani 
+Date:   Fri Sep 7 11:09:57 2007 +0200
+
+    Print an alert message when using builtin implementation of fusion.
+
+commit d5023923233e4823077255a922492fe97a9f1f37
+Author: Claudio Ciccani 
+Date:   Fri Sep 7 11:08:08 2007 +0200
+
+    Always free resources allocated in builtin implementation of fusion_skirmish_wait(), either if the skirmish was destroyed.
+
+commit a4c8aedf8fc09ded54f40c9194cefbc818b9ba23
+Merge: 6978e3e... ace1b81...
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 5 08:18:16 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 6978e3ef0dbdec1c9963d24c16e963413d437eb0
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 5 08:17:27 2007 +0200
+
+    Build fixes.
+
+commit ace1b81011cf8c1dd45413786217b729fe19053c
+Author: Kieran Bingham 
+Date:   Tue Sep 4 22:02:58 2007 +0300
+
+    Fix SetMode / Panning Bug
+    
+    When a graphics driver has its own primary layer hooks implementation, and
+    then defers to fbdev for primarySetRegion(), dfb_fbdev_set_mode() is called
+    unnecessarily.
+    
+    The original implementation in DFB1.0.0 would only call dfb_fbdev_set_mode()
+    if a flag indicated a change, however now that dfb_fbdev_set_mode() is in
+    the default case of a switch statement, it is always called regardless. This
+    has the side effect of resetting the panning, when features implemented in
+    the graphics driver are called such as setting opacity.
+
+commit c788839b5b00ad278687d52efac2391f357ca76c
+Author: Claudio Ciccani 
+Date:   Sun Sep 2 11:39:58 2007 +0200
+
+    Builtin Multi: provided a REAL implementation of fusion_skirmish_wait/notify().
+
+commit d08e95b65d460c92a8cf4a866fc0bcb85ab1dce8
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 1 19:27:53 2007 +0200
+
+    Added capabilities for display layer sources.
+    
+    Added DFBDisplayLayerSourceCaps featuring DDLSCAPS_SURFACE.
+    
+    Check source capabilities if present when determining
+    whether to allocate a surface for a layer region.
+    
+    This allows to add layer sources in addition to DLSID_SURFACE
+    that have a surface without using DLCAPS_SURFACE which enables
+    surfaces for all sources.
+
+commit 256ec4d9e47d2de09b16f01134973055a9a0854a
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 1 17:02:02 2007 +0200
+
+    Added GetMixerState() to screen driver API and dfb_screen_get_layer_dimension() to be used instead of the deprecated dfb_screen_get_screen_size().
+    
+    New function looks up mixer belonging to layer and queries its state containing
+    the coordinate space for layers. Use it in layer core to center layers or calculate
+    pixel coordinates from normalized values.
+
+commit ec79ff33dbcc966976835d6120dd9da8cdc63405
+Author: Claudio Ciccani 
+Date:   Wed Aug 29 12:09:20 2007 +0200
+
+    Fixed texture uploading: use the current surface lock instead of locking again.
+    
+    Replaced state->modified by state->mod_hw.
+    
+    Disabled some features not working with the new surface core, including:
+     - Host to Video memory blits
+     - Support for planar formats (YV12/I420) in the overlay
+
+commit 1bce6d23d76a03e13928bc4ba158a96e4c351c5e
+Author: Ville Syrjala 
+Date:   Tue Aug 28 22:42:32 2007 +0300
+
+    Fix directfbrc location in the manual page.
+    
+    Document the actual directfbrc location in the manual page. This requires
+    expansion of $sysconfdir so borrow the AS_AC_EXPAND m4 macro from GStreamer.
+
+commit 4a88acc6bd41abbf4ae4d3ce4a5e3bdd52fdc4ad
+Author: Ville Syrjala 
+Date:   Tue Aug 28 21:23:46 2007 +0300
+
+    Revert "Flush the read cache only when a CPU read access is requested."
+    
+    This reverts commit fd596f8f4c906d78ebbf1d710448aaef01cfb208.
+    
+    If a CPU write access is requested but nothing is actually written to the
+    framebuffer the hardware will not flush the cache. The next CPU read access
+    will fail to explicitly flush since the GPU write flag has already been
+    cleared. So simply flush the read cache even on CPU write access.
+
+commit 7e57933a7a375c357d5f2c398768f674c24edbf7
+Author: Claudio Ciccani 
+Date:   Tue Aug 28 15:41:14 2007 +0200
+
+    Added direct_cleanup_handler_{add/remove} to install a cleanup handler called upon exit.
+
+commit 0d9188ce2911c3aba09f9c4a5ea174ef7f9d2b33
+Author: Ville Syrjala 
+Date:   Mon Aug 27 23:13:22 2007 +0300
+
+    Avoid unnecessary dfb_gfxcard_sync().
+    
+    Avoid waiting for idle accelerator twice by clearing the GPU read
+    access flag when handling GPU write access.
+
+commit 22ac13e66da5409ff1b0b28bb6477aa144f9955d
+Author: Ville Syrjala 
+Date:   Mon Aug 27 23:10:45 2007 +0300
+
+    Fix CPU read/write access confusion.
+    
+    CPU read access after GPU read does not need any handling. CPU write after
+    a GPU read needs a sync. Flushing the texture cache is not needed.
+
+commit fd596f8f4c906d78ebbf1d710448aaef01cfb208
+Author: Ville Syrjala 
+Date:   Mon Aug 27 23:06:42 2007 +0300
+
+    Flush the read cache only when a CPU read access is requested.
+
+commit be631ba93675435d95d109c7bf360a3dab3a04b6
+Author: Ville Syrjala 
+Date:   Mon Aug 27 22:38:37 2007 +0300
+
+    Silence a compiler warning.
+
+commit 59657b0dd2d5bb525ec1a78944c0823f9270d4ef
+Author: Ville Syrjala 
+Date:   Mon Aug 27 22:01:51 2007 +0300
+
+    Constify linux_input.c.
+
+commit 38488b8c3b2807c4a1fbb102b95421243241ffbe
+Author: Ville Syrjala 
+Date:   Mon Aug 27 21:47:45 2007 +0300
+
+    Boolify linux_input.c.
+
+commit f7a5d10bb03ad28b28155c21a30ac7eac97f5bd5
+Author: Ville Syrjala 
+Date:   Mon Aug 27 21:24:24 2007 +0300
+
+    s/ati/ati128
+
+commit 2e263c6205c676f4c61ef5148b9a5c1730a2b3a3
+Author: Ville Syrjala 
+Date:   Sun Aug 26 17:38:06 2007 +0300
+
+    Sort inputdrivers alphabetically.
+
+commit debca9536998c6d1a4bfc32a889eb73589926a53
+Author: Ville Syrjala 
+Date:   Sun Aug 26 17:25:12 2007 +0300
+
+    Sort gfxdrivers alphabetically.
+
+commit 722f2b9c2149213e3041aaeeb7f2a83457d012d9
+Author: Claudio Ciccani 
+Date:   Mon Aug 27 22:28:10 2007 +0200
+
+    Builds again.
+
+commit 127de279f23cf21f6dcf285acb824121a5b5b7d6
+Author: Claudio Ciccani 
+Date:   Mon Aug 27 21:01:52 2007 +0200
+
+    Fixed build on big endian machines.
+
+commit 06179dc659519dc65d97550ce0faf0b87e354447
+Merge: 82812b3... 32d3d68...
+Author: Claudio Ciccani 
+Date:   Mon Aug 27 16:03:09 2007 +0200
+
+    Merge branch 'master' of git+ssh://directfb.org/git/directfb/core/DirectFB
+
+commit 82812b37302a179ab2f89f0eb77338d6b88391b3
+Author: Claudio Ciccani 
+Date:   Mon Aug 27 16:02:19 2007 +0200
+
+    Moved FUSION_ID_MASTER definition to types.h.
+
+commit 32d3d681fbaf27118fbbd1f60bb9038a9d29c2f0
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 27 13:08:13 2007 +0200
+
+    updated
+
+commit 434fab3f9c28b0873148259a02d64684dd57dd49
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 27 13:06:58 2007 +0200
+
+    Fixed single app core built.
+
+commit 1c7e7614fa1ac1d5702afd794d5905f65ba67b7e
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 27 11:36:08 2007 +0200
+
+    Moved call to dfb_core_activate() after call to dfb_wm_post_init().
+    
+    Consistent with 1.0 branch now.
+
+commit c41515f07dc5e448672cebd4bac6e4599dabfde6
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 27 11:18:08 2007 +0200
+
+    Updated for 1.1.0
+
+commit 5d3daaf93f240abe1433bf976251a9e27b40b890
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 20 10:19:10 2007 +0200
+
+    Use a Skirmish to synchronize slaves with the master's post core initialization.
+    
+    The new function dfb_core_activate() will allow other processes to join.
+
+commit 2c863355342f471cfdc44c051cab3bf1de4a3491
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 19:56:33 2007 +0200
+
+    Debug and error messages for window creation.
+
+commit 9871bba44cfea47ba1fac4e2bb9322746f482b80
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 19:56:05 2007 +0200
+
+    Compatibility and warning for drivers still using state->modified.
+    
+    Every SetState() call will be made with modified = SMF_ALL. Afterwards
+    the value is checked (warn if changed) and reset to 0.
+
+commit d5a01a4ca067b75dfbc5f153e998ca12faa1036a
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 19:54:27 2007 +0200
+
+    Idea is to have a Flip() with multiple regions passed in.
+
+commit 4d65f87a41b2a4a3b7ac2ce42a13dd3cf017290b
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 16:15:20 2007 +0200
+
+    Don't print any error at all if pool negotiation fails.
+    
+    Enhanced debug messages.
+    
+    Added TODO about preallocated surfaces.
+
+commit db9161c5edf9d6bd494d902f35c744b39c066910
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:57:23 2007 +0200
+
+    Fixed uninitialized result in dfb_fbdev_pan().
+
+commit 3be32aaf85a40fa7d46ce5f91ceb839716a3da8c
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:54:26 2007 +0200
+
+    Fixed unitialized values in scaling code.
+
+commit 05ea285c5f963fecf80eff262b8b71c08e550fad
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:08:15 2007 +0200
+
+    Fix warnings and indention.
+
+commit d96503f371880bc0c5a3d7d9ee346d05e5c24734
+Merge: 4abe5ca... 29dd8f3...
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:01:57 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 4abe5cae85d57d66593967c3f19047995cb33f76
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:01:46 2007 +0200
+
+    Fix warnings.
+
+commit 898cbe97a80c88bf082805f39d49535ce27e5672
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 15 13:01:28 2007 +0200
+
+    Calculate binary version from micro-binary age.
+
+commit 23079760c28d2e228da8829782071474b99a6de5
+Author: Denis Oliver Kropp 
+Date:   Tue Aug 14 20:20:48 2007 +0200
+
+    Format fixes in Voodoo.
+
+commit 29dd8f3790d6ace7ed534c4d52d0328fa0703ff2
+Author: Mike Crowe 
+Date:   Wed Aug 15 00:34:46 2007 +0300
+
+    Fix potential SEGV in linux_input
+    
+    I've managed to provoke a segfault in DirectFB by unplugging a USB
+    input device.
+    
+    linux_input_EventThread divides the result of reading from the input
+    device by sizeof(levt) prior to checking for error. Because the type
+    of sizeof may be unsigned the int result of read is promoted
+    to unsigned prior to the division. This means that a read error will
+    cause readlen to contain a number larger than the size of the array
+    causing the following loop to exceed its bounds.
+    
+    This patch defers the division until the value is known to be positive.
+
+commit f52c0c4236a0571e7f7fd550202343ca23239b7a
+Author: Ville Syrjala 
+Date:   Mon Aug 13 22:18:29 2007 +0300
+
+    Silence some automake warnings.
+
+commit 1223551c76cb94e1ceadad0439f7ffa88cf9170c
+Author: Ville Syrjala 
+Date:   Tue Aug 14 23:53:03 2007 +0300
+
+    Reset besvcnt to 0 prior to disabling the backend scaler.
+    
+    Sometimes the BES would not turn off with just BESCTL. It seems besvcnt
+    not being programmed to zero has something to do with it since resetting
+    BESGLOBCTL before BESCTL seems to help.
+
+commit 310477a4caf88878df38365bce8cd9f629a05097
+Author: Ville Syrjala 
+Date:   Mon Aug 13 22:13:15 2007 +0300
+
+    Port mach64 to the new surface core.
+
+commit 1b097dd4188819b828a7542ef6e9efe1e51a27b6
+Author: Ville Syrjala 
+Date:   Tue Aug 14 09:33:45 2007 +0300
+
+    Port matrox to the new surface core.
+
+commit 125aa35304d9b125b67c2a683a5bdf447eb24285
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 18:50:04 2007 -0700
+
+    Fusion 7.0: Messages are aligned on a 4 byte boundary now.
+
+commit 7d5bd536ae8efb0bdacc064d99c0537d9af09812
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 18:07:44 2007 +0200
+
+    Rearrange locks to avoid dead locks in certain circumstances.
+
+commit 2089ff70b727b8bdbab33f3b03d62a246d506543
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 17:37:23 2007 +0200
+
+    Added universal resource id (unsigned long) that belongs to each surface,
+    e.g. the layer id or window id. General purpose surfaces can be given an
+    id by using the new flag DSDESC_RESOURCE_ID and setting the resource_id field.
+    
+    Fixed surface allocation for additional layers. Next to the flag CSTF_LAYER
+    the resource id belonging to the surface needs to be DLID_PRIMARY.
+
+commit cd465ade0d737ef4a1e8bce2fc9d798fb83ea91d
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 16:20:40 2007 +0200
+
+    Do FBIOPAN_DISPLAY ioctls directly.
+
+commit 061313442046a44af3dd64cb74670f6b392bf102
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 16:07:36 2007 +0200
+
+    Fix transfer of errno from master to slaves when doing ioctls.
+
+commit 6a0e6404c77a6f11d4bfc946b2d4e5ac0fe553b1
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 02:36:48 2007 +0200
+
+    Fix 64bit implementations of RGB32 source and destination color keying.
+
+commit 7184b00ffe01756f9a025e9f3bafd79ccdc4edc3
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 02:20:04 2007 +0200
+
+    Disable SDL backend by default, enable X11 backend by default.
+    
+    Support 15 and 16 bit depth server (RGB555 and RGB16).
+
+commit 152474391fd2046e80d1a84dddb870d033402b99
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 02:03:33 2007 +0200
+
+    Revived DSCAPS_STATIC_ALLOC, but not tested.
+
+commit 8c01aa7a757623ee5777499cec4b665207080234
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 01:41:09 2007 +0200
+
+    Negotiation prefers up to date buffers, e.g. do not update
+    the system memory from the video memory allocation, but use
+    the video memory allocation directly.
+    
+    Debug messages, minor cleanup.
+
+commit 297b67d655325fd61514b77945dcb973b57a3d5a
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 13 01:38:10 2007 +0200
+
+    Fix includes.
+
+commit cf4de7cf3677a6252d667342f425f99d8d232043
+Author: Denis Oliver Kropp 
+Date:   Sun Aug 12 22:11:26 2007 +0200
+
+    MERGE of branch surface_core into master!
+    
+    The new surface core is stable enough, still not
+    completely implemented and tested, but I can run my
+    working environment.
+    
+    See TODO for next action items.
+
+commit 02e75aff72362c4a1f299da068f9e18c868fe48c
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 10 19:18:16 2007 +0200
+
+    Hotfix single app build.
+
+commit ddc79a29d3ba9546559d1610b6ff7510b0a7431a
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 10 02:27:07 2007 +0200
+
+    Fix potential dead lock in dfb_layer_context_get_primary_region().
+
+commit 73a8dc87fa1a833b10f672b9910cb2f586a3a8d8
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 10 02:26:01 2007 +0200
+
+    Fix potential dead lock in layer context initialization.
+
+commit f2d1bc51c8ed5db5e0e151b056913f9d2762323a
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 10 02:24:42 2007 +0200
+
+    Added fusion_reactor_set_lock_only() which does not lock and
+    use it in fusion_object_set_lock() as this is called during
+    object initialization.
+
+commit 50fee612fadaa3a9534cff99a136192c767e0139
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 10 02:19:10 2007 +0200
+
+    Fix lock order in fusion_shm_pool_destroy().
+
+commit 13f42cb5535512e47e4a54835f7c60e75c260dbd
+Merge: c0802f7... 77b5640...
+Author: Denis Oliver Kropp 
+Date:   Tue Aug 7 21:31:07 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit c0802f7058b32509ac003c0c7e111e124ccb3c1b
+Author: Denis Oliver Kropp 
+Date:   Tue Aug 7 21:28:30 2007 +0200
+
+    Fix size_t printf format.
+
+commit 77b564072b8b4afc5aca9107f1ba075f4acf8a98
+Author: Denis Oliver Kropp 
+Date:   Tue Aug 7 11:49:22 2007 +0200
+
+    Fix size_t/sizeof format correctly with "%zu".
+
+commit 7295da6c9aa8143e526a21f86ce6598a6003d901
+Author: Claudio Ciccani 
+Date:   Tue Aug 7 11:34:07 2007 +0200
+
+    Removed volatile keyword from structures.
+    Added some asm() code raising memory barrier in critical points.
+
+commit 6f8cd393c54849a1e029de68e16c8d30fe70f6fd
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 6 13:14:26 2007 +0200
+
+    Follow API change in DirectHash.
+
+commit d1c7a2c7836029dfa2dce24ba507a3f9e7fca7d8
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 6 13:13:18 2007 +0200
+
+    Added direct_serial_check() returning true if the target serial is not higher.
+
+commit bcab4383e5eff57aba0e76b0f99b0568ee883082
+Merge: 4eb2645... 0bfa945...
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 6 13:11:41 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 4eb2645d17dc3126b02b03a79da3ba16805d1aa3
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 6 13:07:54 2007 +0200
+
+    Changed DirectHash's u32 key to be unsigned long. This allows to use pointers.
+
+commit 0bfa945e3aee20759afabd9fd6041a58bfbeab70
+Author: Denis Oliver Kropp 
+Date:   Thu Aug 2 14:27:41 2007 +0200
+
+    Added dfb_pixel_to_color( format, pixel, ret_color ) using proper expansion.
+
+commit e88e7a81ffbf05a40c0eb180986c42caa3c6e045
+Author: Denis Oliver Kropp 
+Date:   Thu Aug 2 00:34:34 2007 +0200
+
+    Added generic /dev/mem based system module.
+    
+    There's no screen or layer registered, a graphics driver is required.
+    
+    Added options for the module:
+      video-phys=        Physical start of video memory
+      video-length=           Length of video memory
+      mmio-phys=         Physical start of MMIO area
+      mmio-length=            Length of MMIO area
+      accelerator=               Accelerator ID selecting graphics driver
+
+commit 8ec0f1c3759f6200883c8ca3f0837a12643223d9
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 1 22:47:12 2007 +0200
+
+    Print an error and return if no layers are available.
+
+commit 1e3143ddaab9a6deee8d0abf2fce3b808a059889
+Merge: e5b17bb... 781d713...
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 1 22:43:41 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit e5b17bbbe91c4db3c38e06337196b2f6a1d74ff1
+Author: Denis Oliver Kropp 
+Date:   Wed Aug 1 22:35:53 2007 +0200
+
+    Readded "%.nm" as an alternative to "nm-n.%".
+
+commit 781d713b48d87485a6809d771be7f4c3f052a5a3
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 29 14:25:42 2007 +0200
+
+    Fixed different bugs/crashes in the scaling code.
+    
+    Added RGB32 smooth scaling.
+
+commit 774c84357f99c8119df9303a871980767c56dbb5
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 15:23:08 2007 +0200
+
+    Fixed warnings.
+
+commit 3a3577147d1f1185906d64abdeb34997e3e1ff68
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 15:08:39 2007 +0200
+
+    Follow DFBColorKey change in layer API.
+
+commit 94c59f30479ffacc3aaa3aa04fe3048141caa542
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 13:27:56 2007 +0200
+
+    Added copyright footer.
+
+commit 313623224d91258e3fdbee90da2ba6ee447b48c8
+Merge: 19461c2... 2e28cc7...
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 13:27:29 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 19461c27471d602daa21ebe2360fce028d82699a
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 13:27:24 2007 +0200
+
+    Added direct_list_foreach_reverse().
+
+commit 2e28cc7ff1127118e136fd5f5a83b44ff5da2761
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 25 11:51:52 2007 +0200
+
+    Added option "layer-src-key-index".
+    
+    Added DFBColorKey which is binary compatible with DFBColor for RGB, but
+    has an 8 bit color index instead of the alpha value.
+    
+    Use DFBColorKey instead of DFBColor in the CoreLayerRegionConfig.
+    
+    Added index argument to core layer configuration functions.
+
+commit 7e6800088fa0c087164cf530d9ac2cf161609997
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 18 21:16:20 2007 +0200
+
+    Few more debug messages.
+
+commit 6863d69d88569a690909c4767a1687bdf3c08b2d
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 23 13:19:58 2007 +0200
+
+    Added source color keying and destination color key protection in 16 bit scaling template.
+
+commit 85b80ad3917d3de1cc2a8d69d27cf4b44895610d
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 23 13:20:17 2007 +0200
+
+    Fix warnings.
+
+commit c98eadab4c446c28a19852d39ffb227b9b3c0bb6
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 23 13:22:32 2007 +0200
+
+    Don't bail out with other system modules if LINUX_INPUT_USE_FBDEV is not set.
+
+commit f65acb0fd1a06f3b694d25273b7531ab1d97c982
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 18 20:36:19 2007 +0200
+
+    Added debug messages.
+
+commit 73f20c57998159710eeb609e166122b10581cb24
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 18 20:36:01 2007 +0200
+
+    Raise max number of shm pools to 16.
+
+commit ec4e5ed6e363b3793d8e90e6fbadd4c4ed6ded3f
+Merge: aed1290... 8f28528...
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 17 01:09:06 2007 +0200
+
+    Merge branch 'master' of ssh+git://git.directfb.org/git/directfb/core/DirectFB
+
+commit aed1290039fd229db3e735b84e9947ef1175cb45
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 17 01:08:47 2007 +0200
+
+    Added direct_list_foreach_reverse().
+
+commit 8f285284dd14c5c0bb53d85ba3b9fded5c7fd635
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 17 00:57:30 2007 +0200
+
+    build fixed
+
+commit 4f0f00961139e9c59ab97efd6fa87216fce83a9f
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 16 18:44:15 2007 +0200
+
+    HD extensions, thanks to Daniel J Laird!
+
+commit 826d7ae1aea550a7cf8312848f26d8111232d609
+Merge: cc04f11... fd6854f...
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 16 10:27:16 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit cc04f11f830991c812f77a9e9261a1fb5dd96203
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 16 10:22:05 2007 +0200
+
+    Extended video provider capabilities, thanks to Daniel J Laird!
+
+commit fd6854fe1b77bf3a9621b098c82f4c36ed2a96c5
+Author: Claudio Ciccani 
+Date:   Thu Jul 12 12:36:08 2007 +0200
+
+    Declare some structs 'volatile' to prevent bad assumptions by the compiler.
+    
+    Provided 'builtin-multi' end 'single' implementations of fusion_skirmish_wait() and fusion_skirmish_notify().
+    
+    Check for a dead owner in FusionProperty too.
+
+commit d9f96a4daa43683e17bb5b90f453a2be762e169b
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 10 16:47:15 2007 +0200
+
+    Provide the original timestamps from the X events.
+    
+    Use DIEF_FOLLOW for x/y motion.
+
+commit 7633e99995f0d90d3edd825d71a5e12b2bede278
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 10 16:30:49 2007 +0200
+
+    Work around a strange issue where XNextEvent() blocks on the
+    last event until a newer one is received.
+    
+    Any X expert who can explain the error to me?
+
+commit 74e90cb10a2627fb58aaca2593105c31fd795537
+Merge: ad16899... ddc3298...
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 10 15:51:12 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit ad16899fd45e40fd17d45a9f14afe7aabbf8afc8
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 10 15:50:38 2007 +0200
+
+    Added true keymap support to X11 input driver.
+    
+    Read the X11 keymap entries properly and translate to identifier and symbols.
+    
+    Only send key code in events.
+    
+    X KeySym to DFBInputDeviceKeySymbol translation might not be complete for everyone.
+
+commit ddc3298c0a0665ba0041b1877ebf8c66752fb67d
+Author: Claudio Ciccani 
+Date:   Tue Jul 10 12:11:19 2007 +0200
+
+    Implemented DSBLIT_ROTATE180.
+
+commit 1cd3b70ca91715b396c1d361db1647d4e0e38c66
+Author: Claudio Ciccani 
+Date:   Tue Jul 10 11:25:51 2007 +0200
+
+    Override umask when making directories and sockets.
+
+commit 17132f3fceee231bdd3196b1d3451d6872447b71
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 22:05:09 2007 +0200
+
+    Fix 3/4 byte issue for partial updates.
+
+commit b96e94467bf956a33c11605ef485d8ab47da0936
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 21:50:57 2007 +0200
+
+    Use an ShmImage with twice the height of the output.
+    
+    Alternate between bottom and top image and
+    do XSync() BEFORE doing the next XShmPutImage().
+    
+    Only call XShmPutImage() for the updated region.
+    
+    Removed XFlush() call.
+    
+    Runs nicely on dual core now.
+
+commit d468b0e68105d494c7799f54feb933887c48f379
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 21:09:09 2007 +0200
+
+    Minor optimization in 555->565.
+
+commit 5d77a01e94016f979f373bc5ccf21b80b26dc5c6
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 21:07:24 2007 +0200
+
+    Support conversion from 32 to 16 bit.
+
+commit f6d5eda0164895d2be6c55355f871a81587f064f
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 21:05:04 2007 +0200
+
+    Added dfb_convert_to_rgb32().
+    
+    Support 32 bit (depth 24) displays in SDL and X11 backend.
+
+commit b8649c8cae7eb9db2f8f2bfb8ed29c0dc8e5f7a8
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 20:32:07 2007 +0200
+
+    Added dfb_convert_to_rgb16().
+    
+    Use it in SDL system.
+    
+    Cleaned up X11 system a bit and made it use dfb_convert_to_rgb16().
+
+commit 4e96b36727571ee0c70fe620d178b4c8b318ef99
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 15:45:51 2007 +0200
+
+    Added IDirectFBDisplayLayer::SetRotation().
+    
+    Added option "-R " to dfblayer.
+
+commit 121e8a229f4be2909bdbde8e7be2520a1d090d33
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 15:09:15 2007 +0200
+
+    Added dfb_gfx_back_to_front_copy_180().
+    
+    Added runtime option "layer-rotate = " with 0 and 180 supported.
+    
+    Try it with desktop-buffer-mode=backsystem until graphics drivers support the flag.
+    
+    I'm committing this with my screen content rotated by 180 degree but not the screen itself.
+    Typing and reading is fine, but editing text, especiallusing y del/backspace, is horrible.
+
+commit 7c6330ce36593169e5e740b2bd98ad81c230b461
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 14:40:57 2007 +0200
+
+    Added DSBLIT_ROTATE180 with a basic software implementation.
+
+commit 1f73f307dbcd5272ebad51a78c9c652c4b638f14
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 9 13:00:45 2007 +0200
+
+    Finalized ARGB4444 smooth scaling support.
+
+commit d8276f7799e60009650e28888e9fcbc024bb7253
+Merge: 977ec21... 2b48aaa...
+Author: Denis Oliver Kropp 
+Date:   Sat Jul 7 21:17:28 2007 +0200
+
+    Merge branch 'master' of git+ssh://git.directfb.org/git/directfb/core/DirectFB
+
+commit 2b48aaa07cbcfe1d2bea3182ffcbaf02269729f6
+Author: Denis Oliver Kropp 
+Date:   Fri Jul 6 15:27:22 2007 +0200
+
+    Added multifunctional color configuration function dfb_state_set_color_or_index().
+    Always tries to set both color and index. If color index is -1, color is used and
+    searched in palette of destination surface if present. If color index is valid the
+    color is looked up in palette if present.
+    
+    Added option "layer-bg-color-index = n".
+
+commit 0c01366a6f5b37a1dd00b513e6c62b1056b910b8
+Merge: 14ba567... 098b862...
+Author: Denis Oliver Kropp 
+Date:   Fri Jul 6 14:40:23 2007 +0200
+
+    Merge branch 'master' of ssh+git://git.directfb.org/git/directfb/core/DirectFB
+
+commit 14ba567e3b00d273f063d0e97f64f00e02aa756c
+Author: Denis Oliver Kropp 
+Date:   Fri Jul 6 14:38:51 2007 +0200
+
+    no-force-slave
+
+commit 977ec21feffd47b27e365e594e0e66c27f342c25
+Author: Denis Oliver Kropp 
+Date:   Fri Jul 6 13:31:36 2007 +0200
+
+    Big progress on the scaling front.
+
+commit d8d9f23b914c07c3e69680980c4425beeae92634
+Author: Denis Oliver Kropp 
+Date:   Thu Jul 5 23:31:40 2007 +0200
+
+    Added support for ARGB4444, RGB444 and NV16 on a 16 bit RGB16 SDL window.
+
+commit 098b862938c4f577879059f6e0c8e4a17049a45f
+Author: Claudio Ciccani 
+Date:   Mon Jul 2 12:03:11 2007 +0200
+
+    Added FusionLeave, a message sent from a slave in emergency mode to notify the master
+    that local refs belonging to the sender must be removed.
+
+commit 0a2f0b3af5a3f0e0f498e47d55c4d5ddb610242b
+Author: Claudio Ciccani 
+Date:   Mon Jul 2 11:57:19 2007 +0200
+
+    Forgot a newline.
+
+commit 4160d212709952ae06316a54474e46810b3d8492
+Author: Claudio Ciccani 
+Date:   Sun Jul 1 17:19:43 2007 +0200
+
+    Actually fail if a parent window for the newly created one was specified.
+
+commit a5040250b5523b7d0e2464690d158d604517d335
+Author: Claudio Ciccani 
+Date:   Sun Jul 1 16:03:33 2007 +0200
+
+    Use fprintf() instead of direct_log_printf() to print config_usage.
+
+commit e206b97ff745eb58824b0eb91997c49eb44adbe5
+Author: Claudio Ciccani 
+Date:   Sat Jun 30 14:56:42 2007 +0200
+
+    dfb_surface_reformat() no longer fails immediatly if the surface is locked, instead it waits for 3 loops before doing it.
+
+commit 0f7dd53285a56bbf38a02b82b47a7f2ee85a1f09
+Author: Claudio Ciccani 
+Date:   Sat Jun 30 14:54:52 2007 +0200
+
+    When using the builtin IPC implementation, chose a pool allocation base address that won't collide
+    with those used by other worlds, i.e. the pool base of world N starts 128M after the pool baseof world N-1.
+    As a consequence of this the maximum amount of shared memory allocatable by a world is limited to 128M.
+
+commit dcf2a2b7089fd02105f68bba5da3130c1d72f42c
+Author: Claudio Ciccani 
+Date:   Fri Jun 29 14:48:28 2007 +0200
+
+    Added a new Fusion/IPC implementation using standard system calls:
+    
+     - Skirmish gets implemented by using sched_yield()+usleep, exactly like linuxthreads does with pthread mutexes,
+       but it's also capable of automatically unlocking whether the owner process died without doing it.
+    
+     - Property works like Skirmish, but it doesn't sleep and it doesn't check for a dead owner.
+    
+     - Dispatching and co. make use of raw unix sockets: there is a local address specific to each fusionee
+       (/tmp/fusion.@WORLD_INDEX@/@HEX_FUSION_ID@) and each call (/tmp/fusion.@WORLD_INDEX@/call.@HEX_CALL_ID@.@HEX_CALL_SERIAL@),
+       and messages are sent directly from the generator to the socket of the listeners.
+       From a network point of view, this is similar to UDP Multicast (e.g. conference or meeting).
+    
+    The new implementation gets build when --enable-bulti is specified but no usable linux/fusion.h was found
+    (however you can edit fusion/build.h to force building it).
+
+commit 21bb8adc7377b8a5be57e9e1a092513ed8cb0da6
+Author: Claudio Ciccani 
+Date:   Fri Jun 29 14:31:18 2007 +0200
+
+    Open log file with mode 0664.
+    Automatically flush stderr.
+
+commit 90a53ee2da89805844cd364c52379089d16acc80
+Author: Claudio Ciccani 
+Date:   Fri Jun 29 14:30:00 2007 +0200
+
+    Added direct_sched_yield().
+
+commit 8f02626a2434d6fd3fbfd14331c72b1450620c62
+Author: Denis Oliver Kropp 
+Date:   Wed Jun 27 00:15:53 2007 +0200
+
+    Fix 64 bit symbol address parsing in trace code.
+    
+    Fix missing target directory for nm-n files.
+
+commit beab80191a61967d5b1a75e9a468f11265f40d15
+Author: Ville Syrjala 
+Date:   Fri Jun 22 10:45:15 2007 +0300
+
+    Also make sure fix.ypanstep is not zero before using it.
+
+commit 6447b0f8ae8ad7212a8a74e9596f5c19870f7a48
+Author: Ville Syrjala 
+Date:   Wed Jun 20 23:12:37 2007 +0300
+
+    Make sure fix.xpanstep is not zero before using it.
+
+commit da50bb89855497db778d4fe5c8c951d3a74fb07b
+Author: Ville Syrjala 
+Date:   Sun Jun 17 13:25:24 2007 +0300
+
+    Eliminate libsysfs dependency from i2c detection.
+    
+    Recent changes in sysfs layout broke the i2c detection. Fix the problem
+    and remove the dependency on libsysfs. Use of libsysfs is no longer
+    recommended by the kernel developers.
+
+commit 1a0ac5594506b71189346be53e84615f09820ac8
+Author: Denis Oliver Kropp 
+Date:   Fri Jun 15 16:19:45 2007 +0200
+
+    Thanks to Daniel Laird for Video Provider Events!
+
+commit 66d8693e2b45db7c26c7d22c70781dce2e2fdbab
+Author: Denis Oliver Kropp 
+Date:   Mon Jun 4 13:39:01 2007 +0200
+
+    Implemented StartDrawing/StopDrawing() for states.
+    
+    When a surface is being rendered to, its graphics
+    state is set to DRAWING. Upon Flip() the state is
+    flushed.
+    
+    Each sub surface interface has a reference to its
+    parent and a list of its children.
+    
+    The new mechanism needs to be enabled via "startstop"
+    option.
+    
+    StartDrawing/StopDrawing() can be implemented by the
+    graphics driver. e.g. to keep track dirty surfaces
+    and defer flipping if it would reveal other's drawing.
+
+commit b630f7539003e04a21d6d7e44023461ecf0e2143
+Author: Ben Combee 
+Date:   Fri Jun 15 05:01:59 2007 +0200
+
+    Add --raw option to directfb-csource to allow encoding data files in headers
+    
+    
+    via git-CVS emulator
+
+commit 6987c883a18be767085d55e22638520a7d80fbc6
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 12 19:39:30 2007 +0200
+
+    Eek, disable smooth scaling until code supports big endian as well.
+
+commit 58c1d37bad0e6dc50db4cac3d650caf6bb07722d
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 12 19:34:23 2007 +0200
+
+    Fix hi/lo mixup for big/little endian in 32 bit wise 16 bit color keying code.
+
+commit c0142f6bf506d09449cdf9d2ca0250dcb05cf7fc
+Merge: 14f3aef... 8bba6d9...
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 12 18:57:41 2007 +0200
+
+    Merge branch 'master' of ssh+git://git.directfb.org/git/directfb/core/DirectFB
+
+commit 14f3aef4d4d9fc3f075209a9543b1022f8588493
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 12 17:52:39 2007 +0200
+
+    Added layer palette initialization via "layer-palette- = " option.
+
+commit 97c631660fe977d6d8bb5d4ddf86e1ca1d4e8001
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 12 17:49:43 2007 +0200
+
+    If no alignment is specified (0), default to 8 bytes offset and pitch alignment.
+    
+    To disable alignment, simply set to 1.
+
+commit 8bba6d96df16e3cd11445995cb6704676151e7c3
+Author: Ville Syrjala 
+Date:   Sat Jun 2 22:19:14 2007 +0300
+
+    Check fbdev pan/wrap capabilities for double/triple buffering.
+
+commit 68d8b7ac45293dfc1b03e984a7e5a7b183382313
+Author: Ville Syrjala 
+Date:   Mon Jun 11 00:58:09 2007 +0300
+
+    Fix fbdev_ioctl_call_handler() return value.
+
+commit fa628067a16af972a70cec416ce7b88f9c1bda5f
+Author: Ville Syrjala 
+Date:   Sat Jun 2 22:05:18 2007 +0300
+
+    More uses for D_ARRAY_SIZE().
+
+commit aba1f2a73f4870e1bfc0384a06e49c2acb66d884
+Author: Claudio Ciccani 
+Date:   Fri Jun 8 15:08:39 2007 +0200
+
+    Use a preallocated surface to render the image
+    (this should fix support for destinations that are premultiplied, separated, and co.).
+
+commit 00a47324bb5988fbc5d368f4730a1fc9ab935636
+Author: Denis Oliver Kropp 
+Date:   Sun Jun 3 19:08:39 2007 +0200
+
+    Removed bogus assert.
+
+commit d44cb34fa00fede36e757238f02be6e953855c5a
+Author: Denis Oliver Kropp 
+Date:   Sun Jun 3 18:32:59 2007 +0200
+
+    Use sysconfdir.
+
+commit 69cf22cc7a65ee4251e5d98f505e473490f35536
+Author: Denis Oliver Kropp 
+Date:   Sat Jun 2 21:46:07 2007 +0200
+
+    Added YUV palette support.
+    
+    CorePalette has a second array for YUV entries.
+    
+    Added IDirectFBPalette::SetEntriesYUV(), GetEntriesYUV() and FindBestMatchYUV().
+    
+    Either of the APIs can be used, both arrays are kept synchronized.
+    
+    Drivers can choose.
+
+commit 9c484e1679bdfa922d90d1d5feebc6b0106fdf89
+Author: Denis Oliver Kropp 
+Date:   Sat Jun 2 21:43:34 2007 +0200
+
+    ARGB4444_TO_RGB32(pixel)
+
+commit 92eb83fc571dc67d8994c58cb7b8efb18ad32b2f
+Author: Denis Oliver Kropp 
+Date:   Sat Jun 2 09:27:45 2007 +0200
+
+    Fixed _fusion_reactor_process_message()'s usage of FUSION_REACTOR_DETACH.
+
+commit b1037357aacd70152895826c4b7ed48ea192a1ce
+Author: Denis Oliver Kropp 
+Date:   Fri Jun 1 11:54:40 2007 +0200
+
+    Single app core build fixes.
+
+commit 40bb22a6fa39999074cb5d8b635ab6353c66f23d
+Author: Denis Oliver Kropp 
+Date:   Fri Jun 1 09:55:46 2007 +0200
+
+    Added timeout to fusion_skirmish_wait(), 0 means unlimited.
+
+commit 269df8137fd06a51f4b388432bc8e395265bd1fa
+Author: Denis Oliver Kropp 
+Date:   Thu May 31 17:24:47 2007 +0200
+
+    Replaced dfb_wm_start_desktop() by dfb_wm_post_init().
+    
+    Removed StartDesktop which had no context pointers from WM API
+    and added PostInit with proper context pointers.
+
+commit 988f0e78899cd5b88983f3460436740c45f12f39
+Author: Denis Oliver Kropp 
+Date:   Wed May 30 18:07:55 2007 +0200
+
+    Added DWOP_KEEP_ABOVE and DWOP_KEEP_UNDER.
+
+commit ee262b3fca03b5aafefbd789b698181dd732f619
+Merge: 41e5c47... 0d71e41...
+Author: Denis Oliver Kropp 
+Date:   Wed May 30 10:01:58 2007 +0200
+
+    Merge branch 'master' of ssh+git://git.directfb.org/git/directfb/core/DirectFB
+
+commit 41e5c4767107a8cd965617c680ad2c8cd3d9f498
+Author: Denis Oliver Kropp 
+Date:   Wed May 30 09:58:51 2007 +0200
+
+    Export dfb_config_parse_pixelformat().
+
+commit 0e9eba57d87a1e8d0f446de2daa65fc84617e879
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 23:21:30 2007 +0200
+
+    Extend list of custom keys.
+
+commit 0d71e415412bbb21e6bed49bd41e32d421b254ca
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 23:10:23 2007 +0200
+
+    Fixes for grayscale PNGs.
+
+commit 67350f49d39c9c168575384279b1a92484c6e6f7
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:52:08 2007 +0200
+
+    Added DFFA_FIXEDCLIP that can be used in addition to fixed advance
+    and cuts off glyphs if they are wider than that.
+
+commit bbbd47a34281d756218e6decea0a61844c0a97ea
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:50:28 2007 +0200
+
+    Use direct_list_foreach_safe() for links as well.
+
+commit d25b01b3a74021ba4ecf56219695c3251f4ea76f
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:48:16 2007 +0200
+
+    Check for NULL type earlier.
+
+commit dde7fa2a3bef0143334450641a5c11d524f75337
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:47:40 2007 +0200
+
+    Added "[no-]madv-remove" to get around the auto detection.
+
+commit 1f312b1091a5ef85089f685dfd0fcd7c56ada8ea
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:47:11 2007 +0200
+
+    Added DFB_INCOMPLETE to stringification.
+
+commit c90cd950116b20eb4dcdd0e60352cc91f8df0467
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:45:26 2007 +0200
+
+    Avoid "unused warning" if debug domains are declared, but not used.
+
+commit fb76d8e75e86a194e5b03a377950a33380c79850
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:44:03 2007 +0200
+
+    Added DFB_INCOMPLETE and return it from image providers
+    if rendering has been aborted by the render callback.
+
+commit 8218b2a254a0fd4705fc47af35d0be41d73cd19c
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:36:26 2007 +0200
+
+    Image providers et al can access memory of memory based data buffers directly now.
+
+commit 8e185ff671d3cd745e66c443c8a658e5d82e9936
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:35:13 2007 +0200
+
+    Use CSLF_FORCE to lock a surface for software StretchBlit().
+    
+    Check CSLF_FORCE when locking "video-low" surface buffers for
+    CPU access and pull buffer into system memory if set.
+
+commit 8646db00b0c5cc7df8fc6430fd8a26660dc7c62a
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:29:22 2007 +0200
+
+    Cast to ulong, not u32, to align pointers.
+
+commit 8fc54bcffcdb1dae57a878e1b9b735b336713170
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:24:59 2007 +0200
+
+    Added IDirectFBSurface::SetRenderOptions() as a new state element, but not
+    mandatory for graphics drivers. At the moment it's used by the software
+    driver to choose smooth or standard scaling.
+    
+    Added smooth up/down scaling for RGB16.
+    
+    Added "smooth-upscale" and "smooth-downscale" options to choose a default.
+
+commit 52bb513a1d63912bf67d28caebd97f5b2d888475
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:16:37 2007 +0200
+
+    New option "surface-sentinel" to enable surface sentinels at the end of chunks in video memory.
+
+commit 464e40e8feb90ead4eab2168252f644d71fb53f1
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:07:58 2007 +0200
+
+    List buffers in video memory if "-s" is passed.
+
+commit 48e8de5a110010b4656fc402edf0b18ffa518090
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:06:08 2007 +0200
+
+    Explicit shutdown order of core parts and pools.
+
+commit 8a8141d41681cacbed1eb667ad88ba07d842a660
+Author: Denis Oliver Kropp 
+Date:   Tue May 29 22:01:55 2007 +0200
+
+    Use a FusionRef as a lock counter.
+
+commit 7982b09b68f45182d2b98ead917f8c9a831da31a
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 22:52:58 2007 +0200
+
+    Added missing  include.
+
+commit 0496e6e3a38e01aa5b0fc07472a60776de9d0ffd
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 22:08:17 2007 +0200
+
+    Added direct_thread_get_tid().
+
+commit 1a80a3bad8b8cbba34f8004fb67759b878483c5c
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 22:08:34 2007 +0200
+
+    Added fusion_dispatcher_tid().
+
+commit eea7bfaf9bc0cad1660ed6dea4989c1774f08564
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 19:49:49 2007 +0200
+
+    Added fusion_skirmish_wait() and fusion_skirmish_notify().
+    
+    When you hold the lock you can wait until you get notified,
+    where others can get the lock while you're waiting.
+    
+    At the moment it requires the notifier to acquire the lock.
+
+commit a5f613e79af04a098f03b0d9614b9e2fbfe5f0ff
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 18:08:52 2007 +0200
+
+    API break!
+    
+    Support destructor context pointer.
+    
+    Added "ctx" argument to fusion_object_pool_create().
+    Added "ctx" argument to FusionObjectDestructor.
+
+commit 5984bb10163cff00318939c01251e9f5c3acd196
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 17:06:04 2007 +0200
+
+    Keeps API compatibility.
+    
+    Added fusion_reactor_attach/dispatch_channel() with the older
+    calls using channel zero.
+
+commit 626ad855b335426e44da22f52a70f1c82a6a266b
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 14:33:51 2007 +0200
+
+    Removed call_arg option from dispatch callback. It will be used for something else.
+
+commit 4ba4f45f8db7e8b7a6145562e0ebfb9d08b3ed10
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 11:48:18 2007 +0200
+
+    Follow FusionCall API changes.
+
+commit 259d8890d3103da98c31b39499f6ee22930da9fa
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 10:46:00 2007 +0200
+
+    API break!
+    
+    Changed call handler function type.
+    
+    +typedef enum {
+    +     FCHR_RETURN,
+    +     FCHR_RETAIN
+    +} FusionCallHandlerResult;
+    +
+    +typedef FusionCallHandlerResult (*FusionCallHandler) (int           caller,   /* fusion id of the caller */
+    +                                                      int           call_arg, /* optional call parameter */
+    +                                                      void         *call_ptr, /* optional call parameter */
+    +                                                      void         *ctx,      /* optional handler context */
+    +                                                      unsigned int  serial,
+    +                                                      int          *ret_val );
+    
+    The return value defines the library's behaviour after exiting from the handler.
+    To return a value immediately, write to *ret_val and return FCHR_RETURN.
+    
+    If you want to make a call later on to fusion_call_return() yourself, use FCHR_RETAIN.
+    
+    The new serial value allows to have more than one call pending while calls can
+    be returned in any order. The caller is still blocked on its single call, of course.
+    
+    +DirectResult fusion_call_return ( FusionCall          *call,
+    +                                  unsigned int         serial,
+    +                                  int                  val );
+
+commit 04d8bd665987909eb07b37e77f51ff2361dc172a
+Author: Denis Oliver Kropp 
+Date:   Mon May 28 10:36:00 2007 +0200
+
+    Additionally check if SOPATH is defined when checking for DFB_DYNAMIC_LINKING
+    to do a strange workaround which was needed at some point, but I don't remember
+    and plan to remove this.
+
+commit e1d40d341a808bdd9112a4fad06f69bd58b5f14b
+Author: Denis Oliver Kropp 
+Date:   Sun May 27 12:05:45 2007 +0200
+
+    Added fusion_reactor_set_dispatch_callback() with a test.
+
+commit 98020fc92d03026bde70772bfe01634b8bce9e3b
+Author: Denis Oliver Kropp 
+Date:   Sun May 27 12:05:27 2007 +0200
+
+    Fix zero FusionID in forked process by entering the world after reopening it.
+
+commit 4b253a59842f91db228924d579423594258e0950
+Author: Claudio Ciccani 
+Date:   Sun May 27 10:07:44 2007 +0200
+
+    Removed limit of 8x8 surfaces:
+    apparently it comes from the Rage128 driver but it doesn't apply to Radeon(s).
+
+commit 8a1f12ee0e8273a36db3b8825edc5cf56fb2f3bc
+Author: Ville Syrjala 
+Date:   Wed May 23 23:16:08 2007 +0300
+
+    matrox: Add RGB444 and RGB555 support.
+
+commit e467eba04f4776ada3c95888b094cde04876f87d
+Author: Ville Syrjala 
+Date:   Wed May 23 22:23:36 2007 +0300
+
+    mach64: Add RGB444 and RGB555 support.
+
+commit dfb1d44c61e614974725b48470a3920092d5b1eb
+Author: Ville Syrjala 
+Date:   Wed May 23 22:30:29 2007 +0300
+
+    Plug a memory leak in the PNG image provider.
+    
+    Thanks to Eugene Everson.
+
+commit f33776a36ad561d40ede15bb565f91468f05007c
+Author: Denis Oliver Kropp 
+Date:   Tue May 22 22:50:13 2007 +0200
+
+    Fix code that controls single/double buffer window
+    
+    creation for primary surfaces in windowed mode. If
+    DSCAPS_FLIPPING is set, it uses one buffer which
+    already requires a Flip due to the window. Only if
+    DOUBLE is set explicitly, create two buffers.
+
+commit c91b87c6cab9e6071b9d7fe7cce0d3399acb2e18
+Author: Claudio Ciccani 
+Date:   Tue May 22 17:54:17 2007 +0200
+
+    Reverted default border mode to CLAMP_LAST.
+
+commit 1822b835b992367da001d2c4292b0f3c15ee72fa
+Author: Denis Oliver Kropp 
+Date:   Tue May 22 13:02:12 2007 +0200
+
+    Added advanced window geometry for positioning and scaling of windows
+    relative to their own bounds, with ability derive from parent geometry.
+    
+    DFBWindowGeometryMode: DWGM_DEFAULT, DWGM_FOLLOW, DWGM_RECTANGLE, DWGM_LOCATION.
+    DFBWindowGeometry: mode, rectangle, location.
+    
+    IDirectFBWindow::SetSrcGeometry() and IDirectFBWindow::SetDstGeometry().
+    
+    Added generic dfb_window_set_config() for simplifying core code and moving
+    config handling into interfaces.
+
+commit d82a8e129b09a38e6cc8f966bdd6e2baf2709303
+Author: Denis Oliver Kropp 
+Date:   Tue May 22 12:49:55 2007 +0200
+
+    New layer configuration system, staying compatible with older options:
+    
+      init-layer=                Initialize layer with ID (following layer- options apply)
+      layer-size=x    Set the pixel resolution
+      layer-format=     Set the pixel format
+      layer-depth=       Set the pixel depth
+      layer-buffer-mode=(auto|triple|backvideo|backsystem|frontonly|windows)
+      layer-bg-none                  Disable background clear
+      layer-bg-color=AARRGGBB        Use background color (hex)
+      layer-bg-image=      Use background image
+      layer-bg-tile=       Use tiled background image
+      layer-src-key=AARRGGBB         Enable color keying (hex)
+
+commit cd983756cf48cc5adc54eeaf17a5ca606c4ec4fb
+Author: Denis Oliver Kropp 
+Date:   Tue May 22 12:34:42 2007 +0200
+
+    igittigit
+
+commit 8f5294201ad2e15c566563dfd544816bef601378
+Author: Claudio Ciccani 
+Date:   Mon May 21 21:16:44 2007 +0200
+
+    Set texture border mode to CLAMP_TO_BORDER when using TextureTriangles()
+    (for compatibility with Xrender/Cairo).
+
+commit 05b15944eb91f14a7dacdc37fc6eed13e3e2983a
+Author: Claudio Ciccani 
+Date:   Sat May 19 10:44:12 2007 +0200
+
+    RGB555 support.
+
+commit 0ab0c8406252846113496a0ed4fcc75f6eccdde5
+Author: Claudio Ciccani 
+Date:   Tue May 15 21:24:28 2007 +0200
+
+    Workaround to make forked processes work with fusion:
+    if the master forks, release shared memory only when the child exits.
+
+commit 130e091f281f290d10a7117a0bb6c512e611bf82
+Author: Claudio Ciccani 
+Date:   Mon May 14 17:26:33 2007 +0200
+
+    Support RGB555 and RGB444.
+
+commit 4edc1b1e122742d9b764ef92de97b4cbed014356
+Author: Claudio Ciccani 
+Date:   Mon May 14 14:59:43 2007 +0200
+
+    Optimizations again.
+
+commit 6dccd0b712e9e8aef9e8acbf786231a0e02fe951
+Author: Claudio Ciccani 
+Date:   Sun May 13 19:17:51 2007 +0200
+
+    Fixed previous commit (missing some switches).
+
+commit 7b95216119505437aee894b15a76ee065405f822
+Author: Claudio Ciccani 
+Date:   Sun May 13 19:12:59 2007 +0200
+
+    Added support for RGB555.
+
+commit 175996969fa3d1c159d81f3d297691ea78e98b03
+Author: Claudio Ciccani 
+Date:   Sun May 13 18:49:23 2007 +0200
+
+    Made DisableAcceleration( DFXL_DRAWSTRING ) work.
+
+commit a949dea3a711e26bd16bdaf1b60e7a66f675a57e
+Author: Claudio Ciccani 
+Date:   Sun May 13 17:27:07 2007 +0200
+
+    Still optimizations.
+
+commit 79dba40188d55587dee815b29fbc8aecd72d6b6b
+Author: Claudio Ciccani 
+Date:   Sun May 13 16:28:02 2007 +0200
+
+    Optimizations.
+
+commit 7dfb4e14a2235945e4fbe1f54e722f925a521591
+Author: Claudio Ciccani 
+Date:   Sun May 13 15:27:07 2007 +0200
+
+    Optimizations and cleanup.
+
+commit 6f1c7ee42abeb6c341bf294d4da8fa74f9d1e62e
+Author: Claudio Ciccani 
+Date:   Sun May 13 11:25:51 2007 +0200
+
+    Fixed support for premultiplied surfaces.
+    Dropped down blits from system memory on the NV20 (crashes on Xbox).
+
+commit d6ec7e5f66faec146df5c279ab6f2e0a66acce13
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 22:58:44 2007 +0200
+
+    Added DWDESC_OPTIONS and DWDESC_STACKING to give initial values in the
+    DFBWindowDescription using the new fields 'options' and 'stacking'.
+    
+    Added DWDESC_PARENT to DFBWindowDescriptionFlags and 'parent_id' to
+    DFBWindowDescription. This can be used to associate a window to another,
+    but it's up to the WM to implement it. In SaWMan this makes the window
+    cover exactly the area of the parent window including scaling if needed.
+    Associated windows do not get focus or events themselves, but their parent.
+    
+    Added IDirectFBWindow::SetKeySelection() that selects a mode for filtering
+    keys while being focused. The selection defines whether all, none or a
+    specific set (list) of keys is selected.
+    
+    Added DFBWindowKeySelection featuring DWKS_ALL, DWKS_NONE and DWKS_LIST.
+    
+    Added IDirectFBWindow::GrabUnselectedKeys() and UngrabUnselectedKeys()
+    to have a key collector window receiving all keys that the focused
+    window did not select.
+    
+    Added DFBWindowEventFlags featuring DWEF_RETURNED so far, which means that
+    the event has been returned, i.e. has not been consumed by the original
+    recipient. The DFBWindowEvent field 'flags' has also been added.
+    
+    Simplified internal dfb_layer_context_create_window() and dfb_window_create()
+    and replaced dfb_window_*grab*() by dfb_window_change_grab().
+    
+    Changed IDirectFB::CreateSurface() behaviour: For primary surfaces in
+    windowed mode, only create a window with two buffers if DSCAPS_DOUBLE
+    is set, but not DSCAPS_FLIPPING.
+    
+    Added DWDESC_PARENT to DFBWindowDescriptionFlags and 'parent_id' to
+    DFBWindowDescription. This can be used to associate a window to another,
+    but it's up to the WM to implement it. In SaWMan this makes the window
+    cover exactly the area of the parent window including scaling if needed.
+
+commit 1fa85033db594e51e811307775ceaa4b1eee882a
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 19:46:09 2007 +0200
+
+    Only use FBDev systme module data in linux input driver if system is built.
+
+commit 24b48dad33f667887addf612238f446012f05b54
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 17:52:13 2007 +0200
+
+    gcc 2.95 fixes
+
+commit d22702f8fb2b31fd67e6586022a7b00bee5625b3
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 17:37:06 2007 +0200
+
+    Sorted format_strings[].
+
+commit 33bf1df595d7392e626cc30bcdd531dbc7173b16
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 17:21:56 2007 +0200
+
+    RGB444 and RGB555, thanks to Daniel J Laird!
+
+commit bbc5ef93f0fb97e7a9df9bf29c5b04d6cff5d890
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 16:51:50 2007 +0200
+
+    gcc-2.95 fix
+
+commit 5bd55fa674304859b9dade0849ec0cc6cfb708d3
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 16:48:07 2007 +0200
+
+    Removed obsolete warning.
+
+commit 692d8f9ffa334f41b28bd27c81e7daaf50da40ea
+Author: Denis Oliver Kropp 
+Date:   Tue May 8 16:06:31 2007 +0200
+
+    1.1.0
+
+commit 2797c2cc4b15e0e94b9dbab6221f9c536b175ac5
+Author: Ville Syrjala 
+Date:   Tue May 8 03:01:31 2007 +0300
+
+    Pan the layer to follow the mouse cursor (aka. virtual resolution).
+
+commit 6cde04843dfdbe77b09bc4bc5b56305140b6687c
+Author: Ville Syrjala 
+Date:   Tue May 8 02:59:18 2007 +0300
+
+    Add source rectangle support to fbdev layer.
+
+commit 9d6fa50384abdce554d4ae54d548865f74b9f2f1
+Author: Claudio Ciccani 
+Date:   Tue Apr 24 17:11:58 2007 +0200
+
+    Fixed a segfault when freeing reactor nodes.
+
+commit 6904ef61213633cbbc3b789bbe8fcdca4c2ff87c
+Author: Claudio Ciccani 
+Date:   Mon Apr 23 19:03:29 2007 +0200
+
+    Clarified some aspects about the behaviour of IDirectFBWindow::Bind().
+
+commit f7abc96cc2fcee72fd35e7ec4220f05a389b9fd4
+Author: Claudio Ciccani 
+Date:   Mon Apr 23 16:45:32 2007 +0200
+
+    Implemented IDirectFBWindow::Bind()/Unbind(). :)
+    
+    The change is backward and binary compatible.
+
+commit 2735a9544c999369a5000324dbdd550c7c276268
+Author: Ville Syrjala 
+Date:   Sun Apr 8 02:09:39 2007 +0300
+
+    Use D_ARRAY_SIZE() macro where appropriate.
+
+commit 47d97462a08240236683b4cc3aa77c66bd8ca241
+Author: Ville Syrjala 
+Date:   Thu Apr 12 02:49:39 2007 +0300
+
+    Fix evdev ioctl() parameters.
+
+commit a7d95847288c8c490c4ea4d60e973e2838e5ac2c
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 11 16:13:42 2007 +0200
+
+    Previously, in dfb_thread_destroy() if a thread is neither
+    detached not joined, it was just canceled and the struct was
+    freed, magic cleared etc.
+    
+    To avoid an assertion in the cleanup handler of the thread,
+    detach it before canceling, don't free its struct etc.
+
+commit db515696b39af71bea30e09d2fd48a1040addd0b
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 11 16:04:37 2007 +0200
+
+    Misc debug messages.
+
+commit 6299a9a345d38f9b94e6b82d415dbd4554745e15
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 11 16:02:01 2007 +0200
+
+    Fix copy'n'paste error that caused values to be freed if keys should be.
+
+commit f76465a11cd72af4dfbbe48f1ed9ec4abc67b045
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 11 16:00:12 2007 +0200
+
+    Fix (un)locking.
+
+commit e286be1d7ff4149e6ee6b710e6f26d9077182a95
+Author: Denis Oliver Kropp 
+Date:   Mon Apr 2 09:31:33 2007 +0200
+
+    Fixed false assertions...
+
+commit 7796a5e3a8b1235f1e78fae540837198858acbcd
+Author: Denis Oliver Kropp 
+Date:   Sun Apr 1 15:32:40 2007 +0200
+
+    Validate clip in dfb_state_update() also if destination
+    was just set manually, not via dfb_state_set_destination().
+
+commit d44db9c74b717ae9b7edb51cfd684dc4b88d5c15
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 31 16:36:06 2007 +0200
+
+    Thanks to Thanks to sridewa #sridewa gmail.com#!
+
+commit 2645d66bd67746e970741839f9d4ec11a9c2c5a6
+Author: Denis Oliver Kropp 
+Date:   Wed Mar 28 12:07:42 2007 +0200
+
+    Clear header structure before (partially) filling it,
+    to avoid leaking data from stack into file.
+    
+    Turn on memory allocation debugging.
+
+commit c569762cef58f40fbee123fd5b7ddbd64a813a07
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 24 22:35:31 2007 +0100
+
+    Added missing pthread_rwlock_destroy().
+
+commit 330450df944b491bef4d0c49f8567f8f3cc41be9
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 24 12:25:11 2007 +0100
+
+    Fix general dead lock problem with reactors.
+    
+    - Replace mutex by read/write lock.
+    - Write lock during attach/detach()
+    - Read lock during dispatch()
+    - Only remove reactions from node if write lock is held.
+    - Don't link reactions into the node, but allocate an extra link structure, to avoid accessing foreign and probably deallocated memory.
+    - In dispatch() if reaction returns RS_REMOVE, just mark the link as dead and don't write to reaction structure, which might be deallocated by the reaction handler.
+    - More changes, even more details...
+
+commit fcc80bc32ebf455329130d648e70336e3f3d9b5a
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 16:21:44 2007 +0100
+
+    Use FusionHash for arena fields.
+    
+    Avoids multiple fields with the same name and just replaces the value.
+    
+    Should also be a faster for arenas with more than three or four fields.
+    
+    Minor code cleanup in lock_arena().
+    
+    Added debug domain and messages.
+
+commit 7711a22301ebf93904fb3997cba09f5b5e6fe7e8
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 16:18:02 2007 +0100
+
+    Added fusion_hash_set_autofree() to enable/disable
+    automatic freeing of values and/or keys.
+
+commit 3663b176f629e2487bc32095dc3c3a9591a1f681
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 16:11:41 2007 +0100
+
+    Reinitialize entries in static pool array properly.
+    
+    Added debug domain and messages to SHMALLOC and friends.
+
+commit 0a6c3fd384db48d679f274b31f21fb03db08812e
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 15:54:42 2007 +0100
+
+    Fix typo in error message.
+
+commit c3b24b2df174cdb029d50485c9aed75a62555736
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 15:46:30 2007 +0100
+
+    Close file descriptor of shared memory files and be happy with just the
+    static mmap() and the filename for using truncate() instead of ftruncate().
+    
+    
+    via git-CVS emulator
+
+commit d3a576aef5806c82576abdd8ec936dd0f6832d29
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 15:40:11 2007 +0100
+
+    Added direct_thread_detach() and direct_thread_is_detached().
+    
+    Use pthread cleanup to free the DirectThread structure etc.
+    
+    
+    via git-CVS emulator
+
+commit 3fcc94f1f0964fc19d5e228ba4df8a67d1501090
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 23 15:03:59 2007 +0100
+
+    Fix ARGB on RGB16 blending. Use Duff's Device and optimize for 0% and 100% opaque.
+    
+    
+    via git-CVS emulator
+
+commit 8ce787dedf27a17394b73e94a9e0c832593b3260
+Author: Denis Oliver Kropp 
+Date:   Thu Mar 22 11:31:20 2007 +0100
+
+    Fixed RGB24 to RGB16 conversion.
+    
+    
+    via git-CVS emulator
+
+commit 848cfefef00b738d736ceac287001da1141de9a5
+Author: Denis Oliver Kropp 
+Date:   Wed Mar 21 00:36:28 2007 +0100
+
+    Use setjmp() before having libpng trying the longjmp().
+    This avoids the unwanted abort().
+    
+    
+    via git-CVS emulator
+
+commit 22779946a4f70a31f8d79be3bac96b635ad5d338
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:30:21 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit d2038767ceaab5c746d73c2ff31d753a632f9bd3
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:18:55 2007 +0100
+
+    test
+
+commit e1d02c08381e753e2c15106f492f166fe0c525c6
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:16:27 2007 +0100
+
+    test
+
+commit 0c7afb4c46387e001cebc9bd68a085965f1d2f29
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:12:25 2007 +0100
+
+    test
+
+commit 175927a7e63be7d6e111fa1677fb88f12704ca6b
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:10:08 2007 +0100
+
+    Test
+
+commit c70d1312b75d47991e9aeab733aa98b645e67ff7
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 18:02:47 2007 +0100
+
+    test
+
+commit 70f47b5508245a501487fe194d3149d6a924b014
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:52:43 2007 +0100
+
+    Test
+
+commit f511fe426936a2131835d7efc7c48fb33b372f88
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:43:58 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit 8f03a4f0485a1f1160b014fcc7ac4357b46189fa
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:42:24 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit bd60a241b6a71be7f7649d8531b7be10a4e77c65
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:40:36 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit ddb706580c35327cabdaeae85850c0287694ca16
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:38:47 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit 5132c7082d36e19ade81cc9b2fc6874947dd125b
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 20 17:34:33 2007 +0100
+
+    Test
+    
+    via git-CVS emulator
+
+commit 7750c66985bc64958e10055245d662777f61b6e6
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 17 00:02:28 2007 +0100
+
+    Revert to old format.
+
+commit be496f6044188236a2b52859f3d0cccabb96dd4b
+Author: Mark Adams 
+Date:   Wed Mar 7 10:39:49 2007 +0000
+
+    Fix blitting of planar surfaces (YV12/I420) when a source rectangle is used
+    or the source and destination surfaces are different sizes.
+
+commit e7d1e212ec250cd9f8ae43fc2c79b904f6208278
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 4 01:05:28 2007 +0000
+
+    hotfix
+
+commit 8fbcdaeb947cd5fac4d09e3a76ce2a5322210586
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 23:08:04 2007 +0000
+
+    updated
+
+commit affa1214d3097c2834a4407e98e71c908751fbf8
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 22:46:13 2007 +0000
+
+    1.0.0
+
+commit b595995119c8fa9fca93c278cc3c90a837f44546
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 21:53:44 2007 +0000
+
+    Fix type punn-ishment.
+
+commit e46da95536009730b0d26c8462f0c322efd918df
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 20:53:51 2007 +0000
+
+    Updated copyright information.
+
+commit f873d6cc66e68df4056c36e9a42fe0f5377a264c
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 20:06:47 2007 +0000
+
+    |     =======================|  DirectFB 1.0.0-rc5  |=======================
+    |          (c) 2001-2007  The DirectFB Organization (directfb.org)
+    |          (c) 2000-2004  Convergence (integrated media) GmbH
+    |        ----------------------------------------------------------------
+    
+    
+    comments?
+
+commit 5dea556e582cc510cad0556df3247b4a6438faf7
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 19:57:30 2007 +0000
+
+    Thanks to Ben Combee for adding DIEF_FOLLOW support to SDL Input!
+
+commit d6440af4b9a9538dbf1a2c5f32fa5b2022f93bd6
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 19:35:03 2007 +0000
+
+    ignore
+
+commit 67852690cb18711f2605bcc9e523c8f43e53ca64
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 19:33:34 2007 +0000
+
+    Use local memory (D_MALLOC instead of SHMALLOC) if pool is NULL.
+
+commit 273e33c9f02e985865526b2713acf4d036fadd95
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 19:32:17 2007 +0000
+
+    typo
+
+commit 78e6f0d83458c51eeb3fd28b7b390d9389870b83
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 19:00:51 2007 +0000
+
+    Wuah...
+
+commit db8a2db9657b9629e9c4df7a3ae21ac8e8461a88
+Author: Denis Oliver Kropp 
+Date:   Sat Mar 3 11:01:46 2007 +0000
+
+    align output
+
+commit 1a563fcbba64619b2f2a6def77c59a433740d9f5
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 2 20:39:29 2007 +0000
+
+    Updated.
+    
+    TODOs for 1.0.0 added, feel free to extend this list :)
+
+commit 8f9e8cac1c4836bceef7355309d0fc326cad559a
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 2 20:14:44 2007 +0000
+
+    New option "vt-num=" to use given VT instead of current/new one.
+
+commit 2db3166fb667897a7cb838fc64b0cb2deec6fe88
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 2 19:51:01 2007 +0000
+
+    RC5
+
+commit 490e2a5924847cc6a06c177eb1bcbc48bac5bebb
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 2 19:48:20 2007 +0000
+
+    Implemented 1 and 2 bit indexed PNG support.
+
+commit 7bf75e3cc78a0b358f863efea7fe10138fc43230
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 2 17:44:44 2007 +0000
+
+    Show creator of references.
+
+commit c3d599f8b31bd9afe856b94223f0933142c42e58
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 21:12:23 2007 +0000
+
+    Don't abort if an unsupported option is found, but give a fat warning.
+
+commit c39131aa31bcc2bf1b3920a02ab414744e61342f
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:59:57 2007 +0000
+
+    Don't deallocate locked buffers on suspend.
+
+commit 280e77614e48406f14df21e7a52f81dea35981e0
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:54:56 2007 +0000
+
+    Free previous string when shmfile-group is overridden.
+    Don't set a default group.
+
+commit bc86cf3350fed27d8f5a4d2381a3af3bab99d6c3
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:47:10 2007 +0000
+
+    typo :(
+
+commit c5d20401633e1c9385366320af1966c1fb00ef3c
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:45:29 2007 +0000
+
+    Surface manager always deallocates all auto video instances when suspending.
+    This has the nice side effect of free space being defragmented after resume :)
+    
+    Added option "[no-]thrifty-surface-buffers" to free sysmem instance on xfer to video memory.
+
+commit 606aeb4bb55672bd5f51932cf1b06ca5f3b10f1a
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:23:18 2007 +0000
+
+    Added fast RGB24 to RGB16 conversion (little endian only).
+
+commit a4fc36250c63e5f0e79b19d0ddd9ae74d3e57654
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:13:28 2007 +0000
+
+    Added keypad equal support.
+
+commit e841d7c455b9bfce6be4c0a2b2e2d4251f4817be
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 20:07:47 2007 +0000
+
+    New option "shmfile-group=" to set the group that owns shared memory files.
+
+commit 78a849cf6a1f4b1d8e1503c3a6d6ce3c06af9e78
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:59:51 2007 +0000
+
+    This patch adds '--with-message-size=SIZE' to allow fusion messages up to SIZE bytes (default is 1024).
+
+commit b50ddd5b53d12900ee837afa7a69942e0e1334c0
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:56:29 2007 +0000
+
+    This patch sets FD_CLOEXEC on the frame buffer device file descriptor.
+
+commit d6a296f82431342e75627b33e8064048223db751
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:49:56 2007 +0000
+
+    Don't notify WM if cursor opacity didn't actually change.
+
+commit 26eac7159fc79e061b4a712b5b3d614de4a8ecc4
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:48:54 2007 +0000
+
+    This fixes unconditional access to conditionally allocated data, thanks to Ben Combee!
+
+commit cf8d109b1d6c23c9761d370a1d2d1e924b6e5f1d
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:44:46 2007 +0000
+
+    Added dfb_gfxcard_get_device_data().
+
+commit ab497c32f62c4e0e7c1df7396fdabf7169013ea1
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 24 19:40:33 2007 +0000
+
+    Improved robustness of VT switching, e.g. for rapidly switching back and forth.
+
+commit 5ed9b956381cbeeea463e2bac37fcee88682de7f
+Author: Claudio Ciccani 
+Date:   Fri Feb 23 16:10:46 2007 +0000
+
+    Finally found the way to embed MPEG streams within the RMF container.
+    Dropped down RTSP seekability (never worked fine).
+
+commit 0253831e77c81ff7cf46b59f56a849b1338507a5
+Author: Claudio Ciccani 
+Date:   Wed Feb 21 11:05:21 2007 +0000
+
+    Another (binary compatible) API change: added DVSTATE_BUFFERING.
+
+commit 919995193f17be8c217f7ece366ff867903eb0f8
+Author: Denis Oliver Kropp 
+Date:   Mon Feb 12 11:55:35 2007 +0000
+
+    Just another test app.
+
+commit 32e5459170f2a9e4ef9f8dfb7d441ccbe03c9379
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 10 23:22:10 2007 +0000
+
+    Thanks to Philip Jägenstedt :philipj 0pera c0m: for fixing the H3600 check!
+
+commit 255c93750d1b2d4c17c51ab4aee803edc4c4cb33
+Author: Mark Adams 
+Date:   Fri Feb 9 14:57:03 2007 +0000
+
+    Attempt to fix problems with redefinition of s64, u64 types.
+
+commit d113ba23bedf936ad37115d1f83b3dc0be99fee4
+Author: Mark Adams 
+Date:   Fri Feb 9 12:16:54 2007 +0000
+
+    Attempt to fix problems with redefinition of s64, u64 types.
+
+commit 66d84298ec6153da512be376b7394602171701c5
+Author: Claudio Ciccani 
+Date:   Fri Feb 9 11:32:15 2007 +0000
+
+    Converted old dfb types to new types.
+
+commit 807ce0aff857ac99042ddd08005ea925e2193459
+Author: Denis Oliver Kropp 
+Date:   Fri Feb 9 01:44:20 2007 +0000
+
+    The uncommitten...
+
+commit eafaa77fd598efb2e8cdd3111ef8a142e87af1ff
+Author: Ville Syrjala 
+Date:   Wed Feb 7 22:45:43 2007 +0000
+
+    Including linux/unistd.h appears to be unnecessary.
+
+commit 12a5f5a7f4983122a6189a21e36c73e67c4faed2
+Author: Ville Syrjala 
+Date:   Tue Feb 6 21:27:12 2007 +0000
+
+    Don't try to read() if select() returned with EINTR.
+
+commit ba381d1cc20bce277041ee9fee27e1e0a20609df
+Author: Ville Syrjala 
+Date:   Tue Feb 6 21:21:20 2007 +0000
+
+    Make CODING_STYLE actually follow it's own recommendations ;)
+
+commit 13a840994684a8975fa3316da05ac26b4a2dbe76
+Author: Mark Adams 
+Date:   Tue Feb 6 14:46:00 2007 +0000
+
+    Fix video layer flicker when layer is positioned partially off screen.
+    Also improve positioning accuracy in this situation (but with a little more
+    masking at the screen edge).
+
+commit b82c237a827fa1b5a8a0c60bc73210aceffa1b74
+Author: Ville Syrjala 
+Date:   Mon Feb 5 21:50:14 2007 +0000
+
+    Add a configure check for struct input_absinfo.
+
+commit 7ea7063ac7a1270d554a3c3ca0c90b0e82f3d7c1
+Author: Denis Oliver Kropp 
+Date:   Mon Feb 5 11:48:52 2007 +0000
+
+    Many thanks to Vaclav Slavik for these many fixes :-)
+    
+    * Previously, the process attached itself to a new controlling TTY
+    only if vt_switch option was on. This patch changes it to always
+    (unless VT handling is completely disabled, of course) attach the
+    process to the TTY being used by the app as the new controlling TTY.
+    This is because we always need some controlling TTY, without it, there
+    could be SIGHUP/SIGCONT signals (see e.g. my post about re-adding
+    setpgid() call). Note that the patch moves TIOCSCTTY call outside
+    of "if vt-switch" branch, but completely removes TIOCNOTTY - - that's
+    because the latter is not needed, setsid() already detached the
+    process from controlling TTY. So "vt-switch" now only
+    controls "physical" change of the currently active console.
+    
+    * /dev/tty? files are opened with O_NOCTTY. Linux kernel has a feature
+    that if a process without controlling TTY opens a TTY device, it's
+    made its controlling TTY, unless you use O_NOCTTY, so this change
+    ensure that we only attach to the desired TTY explicitly using
+    TIOCSCTTY.
+    
+    * Moved TIOCSCTTY before KBSETMODE use, otherwise non-root users get
+    EPERM from KBSETMODE ioctl(), because you can't do that operation on
+    anything other than your controlling TTY normally.
+    
+    * Removed setpgid() calls, because they interfered with setsid() later
+    and weren't really necessary now that other cTTY problems were fixed.
+    Ditto for the removed dfb_vt_detach() call (I couldn't find any
+    information about why it was there in the first place, but everything
+    works without it as far as I can tell).
+
+commit 1f63064d4fa2ef81f1388a852277ff66c416dafb
+Author: Claudio Ciccani 
+Date:   Sat Feb 3 11:54:58 2007 +0000
+
+    Avoid cutting away the last pixel of a planar yuv row.
+
+commit 121d7ca0a14569dbc971865fdf3356cc76c3a004
+Author: Claudio Ciccani 
+Date:   Sat Feb 3 11:36:33 2007 +0000
+
+    Changed my email address.
+
+commit 90bf0a5075d84286580525889e0a61ff064c8e0d
+Author: Claudio Ciccani 
+Date:   Sat Feb 3 11:35:45 2007 +0000
+
+    Distribute autogen.sh.
+
+commit e83cc57ed68f395f853d15315b6eb41be508144e
+Author: Denis Oliver Kropp 
+Date:   Fri Feb 2 23:10:43 2007 +0000
+
+    Add new lines to work around nested structs being taken by the doc generator.
+
+commit 00ad661e60b8a4de0ac3b9ae44b635ea4576d94c
+Author: Claudio Ciccani 
+Date:   Fri Feb 2 18:30:41 2007 +0000
+
+    Display my new email address (the old one may not work in future).
+
+commit b548b38e012ca1011a4a016b2931278dee5a431a
+Author: Mark Adams 
+Date:   Thu Feb 1 18:42:44 2007 +0000
+
+    Allow for improved timing of video layer flips when the FIELD_PARITY option
+    is in use.  The improvement is only possible if the kernel framebuffer
+    supports it.  If not, we do the best we can but occasional glitches may
+    occur under high processor load.
+
+commit 833344e2caa02f416446e6e8ad45a08d162ee1be
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 20:28:50 2007 +0000
+
+    updated for RC3
+
+commit b87c1df32781e8159ff6b9dee04e1a28ff1137e2
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 20:27:21 2007 +0000
+
+    Argh, reading the NEWS I recognized I forgot to change the ambiguous
+    fusion_reactor_sync() into fusion_reactor_direct() to make it more clear:
+    
+    Specify whether local message handlers (reactions) should be called directly.
+
+commit bddb52854e01fe4305086c10194ca260e2d8ddaf
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 15:47:57 2007 +0000
+
+    updated
+
+commit d60c89ecf9cfe07a605657bc16ac8ea0718daabb
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 04:13:29 2007 +0000
+
+    We should "Support vga16, i.e. add DSPF_LUT4."
+
+commit 4b923dfec340950ebd29acd6f52fb2d59d758220
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 01:00:45 2007 +0000
+
+    In drivers including  do that before  gets in.
+
+commit d55bc774043e5ece1d6c2b1efd85bcfe975ac5ce
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 29 01:00:01 2007 +0000
+
+    Include  before  is included somehow.
+    
+    This works around the 64bit type clash between  and  (used by dfb_types.h).
+    
+    Any help for proper fixes or some explanation would be appreciated!
+
+commit 6d6a481e8b42f3a60c01e09061082773ec172b0e
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 28 21:24:44 2007 +0000
+
+    In dfb_gfxcard_reserve_memory() show sizes in warning about too less memory,
+    also align the requested size according to byte offset alignment or warn if
+    that's not specified, yet.
+
+commit 6428590ce4a688bc0ecc8441bd03e0bbdc74c2d0
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 27 18:03:23 2007 +0000
+
+    Fix fusion_sync() timeout during XDirectFB shutdown.
+    
+    Apart from other small changes, fusion_sync() returns DFB_OK in case
+    the select() call was interrupted (EINTR). Continuously sent signals
+    could have cause these timeouts, but I don't know if and why they would
+    be there.
+    
+    It's still a hot fix, as it could be that the call is interrupted with
+    data available, couldn't it?
+    
+    A proper solution could be to support fsync(fusion_fd), but what about
+    the timeout?
+
+commit ba6b67234d44eea9c580bf8e9f919f67b670a6d7
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 27 15:23:48 2007 +0000
+
+    Further minimize impact of a shutdown issue which only seems to happen with
+    XDirectFB, e.g. on Ctrl-Alt-BackSpace. The problem is that waiting for the
+    dispatcher to process pending messages fails, or at least the detection is
+    broken whether there are any pending messages.
+    
+    Only call fusion_sync() if the pool that is to be destroyed has objects.
+
+commit b8bc3b706492a4dabca1b5801c534fc192351598
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 26 23:32:24 2007 +0000
+
+    Added -lm for sin().
+
+commit 16f4e0f72494d8479e1c867066c8ab86b137c06a
+Author: Ville Syrjala 
+Date:   Fri Jan 26 08:24:38 2007 +0000
+
+    Revert the previous AiRGB change. Not sure what I was thinking...
+
+commit ad60e033b6c3b35a3e05f9468386ed297bece1ba
+Author: Ville Syrjala 
+Date:   Thu Jan 25 21:21:21 2007 +0000
+
+    Source color alpha value wasn't always correctly inverted for AiRGB.
+
+commit 6a1089a0ae9b1693d1cf6b7b26813e67be22dcfc
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 25 02:52:44 2007 +0000
+
+    Use DFBUpdates to manage an update queue and do optimizations like taking
+    the bounding box instead of multiple smaller regions if the number of pixels
+    in the bounding box is not much higher than the total of the smaller ones.
+    
+    Even this takes the number of smaller regions into account, because of the
+    increasing overhead per region.
+    
+    Next to performance, the visual experience is enhanced by coalesced updates.
+    
+    Another advantage is that when multiple regions are updated, first it renders
+    all regions and then it flips all regions. Previously, each time the flip was
+    done immediately for each rendered region.
+
+commit 5606d17f9ecc4d06b019151198eaacf349ebc7fd
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 25 01:34:23 2007 +0000
+
+    Fixed missing bounding box update when a newly added update is merged with an existing.
+
+commit cf76229662140c451c6e6cc39dcfa52bece16444
+Author: Ville Syrjala 
+Date:   Wed Jan 24 23:48:21 2007 +0000
+
+    Fixed a bug in dfb_gfxcard_tileblit(). It first removes all completely
+    clipped tiles, but then forgets the new dx1 coordinate and starts
+    blitting from the original dx1 position.
+
+commit 97bd3995fb662cfc9933a6fb8ed8505a4423446b
+Author: Ville Syrjala 
+Date:   Wed Jan 24 22:10:56 2007 +0000
+
+    SMF_CLIP was ignored.
+
+commit 86519ba74b49e52284a611956de71dce43f18618
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 24 03:56:32 2007 +0000
+
+    Cleanup, reorder, rephrase, ...
+
+commit 1d5e207f835aec6d8527b387797d718033b5c4c3
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 24 03:12:35 2007 +0000
+
+    Added fusion_shm_attach_unattached() to attach to pools that have been
+    created AFTER fusion_shm_init() attached to pools during fusion_enter().
+    
+    This can happen easily when starting a number of processes with the new
+    "force-slave" option. They'll all block at fusion_enter() until the master
+    has completed its fusion_enter().
+    
+    DirectFB shared memory pools are created by the master after fusion_enter(),
+    but during fusion_arena_enter(). Slaves will block at this point again, until
+    the master has finished the rest of the setup and returns from entering the
+    arena.
+    
+    When others actually join the arena, right after acquiring the lock for it,
+    the new function fusion_shm_attach_unattached() is called to attach to any
+    pools created by the master while entering (initializing) the arena.
+
+commit 216286888dab1ba8eb54edce240f446e4f745531
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 24 02:04:00 2007 +0000
+
+    Added runtime option "force-slave" to always enter as a slave, waiting for
+    the master, if not already there. This feature only works with recent kernel
+    module.
+
+commit 144e3ef3691c013bcc2abd2f891ee16b5db69ce6
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 24 01:22:53 2007 +0000
+
+    Read DIRECTFB_SESSION variable after reading all files and DFBARGS,
+    so only the command line can override the current session.
+    
+    Still thinking though, if DFBARGS should override DIRECTFB_SESSION...
+
+commit 79c52e6bdf260d86f09b0f7289c744819aaf3002
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 23:00:07 2007 +0000
+
+    If trace support and shared libraries are enabled, for each library to install,
+    also generate a file containing the output of "nm -n ".
+    
+    That's the command that is used at runtime via popen().
+    
+    Now the code first checks if it can fopen() a file with the same name as the
+    one passed to "nm -n", but with an "nm-n." prefix.
+    
+    This is both a performance improvement and a nice solution for (embedded) targets
+    without 'nm' being available or fast enough.
+
+commit 18585f0743fda2c7a42fc0dbf6d2bf336f212546
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 20:56:04 2007 +0000
+
+    Made direct_snputs() static inline.
+    
+    Removed assertion 'n > 0', instead return NULL if destination can't
+    even hold the zero termination character.
+
+commit 19efc71ab311496ef3b8b839d26470740c7cca80
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 20:49:38 2007 +0000
+
+    Removed  include.
+
+commit 457a0207f9cc43be2d581a7726b2f5cfb6290d94
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 20:48:51 2007 +0000
+
+    Added missing  includes.
+
+commit 91239996d0714ac8c1c3e9a450da37f789397826
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 20:26:54 2007 +0000
+
+    Easy part, replacing strncpy() by direct_snputs().
+    
+    Replacing all relevant snprintf() will be harder...
+
+commit d2624a70c937219f802e15e09c573cbb374a2086
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 18:47:09 2007 +0000
+
+    Added direct_snputs(s,d,n) to set a string with a maximum size including the
+    zero termination. This acts like a strncpy(d,s,n), but always terminates the
+    string like snprintf(d,n,"%s",s) which is more or less slower.
+
+commit 3d2abfc029117b398d12fc718d656739cb05e007
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:46:55 2007 +0000
+
+    When Meta-P is pressed, only show/enable the cursor if it has ever been set.
+    
+    This fixes the cursor showing up on my Xv enabled Xawtv window (cursor on video layer :).
+
+commit 6a5910d4c94d700f47a58af5fbe53cd09c665ab6
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:33:38 2007 +0000
+
+    Fixed DIKT_UNICODE detection in DFB_KEY_TYPE(symbol) for values > 255.
+
+commit 0f779e4e1ec96f75c560e37b231072ce8d682214
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:26:04 2007 +0000
+
+    Do the same as for surfaces recently: revert to direct local reaction calls.
+    Fixes rare glitches in heavy window resizing in LiTE.
+
+commit 9a172ce84938ee90f606331e54911af3a78b2fc1
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:22:39 2007 +0000
+
+    Reduce timeout in fusion_sync().
+    
+    At the moment it always seems to fail, but this should be fixed asap.
+
+commit fef7dc8fc21d33a5350058bd94c274ca25c52c53
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:21:23 2007 +0000
+
+    Already fixed.
+
+commit 21c5562661535de95b640943fef2004e4e12fd39
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 16:11:30 2007 +0000
+
+    Commented out recent change until it's fixed.
+
+commit de6989fbe17e2f3864589bfefa129c0c4b2b434c
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 13:14:54 2007 +0000
+
+    Use direct_list_move_to_front() in lock_node() as the list could be long
+    in case an application attaches to a lot of reactors, most probably its own,
+    e.g. using a lot of small surfaces.
+
+commit c08e629fb6817d006a9a9082fff12bda1fe08fc3
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 23 13:11:46 2007 +0000
+
+    Added direct_list_move_to_front( **list, *link ).
+
+commit 70ca7950f9b3225744e356c6426bd545981ab07d
+Author: Ville Syrjala 
+Date:   Mon Jan 22 21:31:48 2007 +0000
+
+    Eliminate bashism (function keyword).
+
+commit 7329e0b5a4e973f6daf92008ce9703f84d73d71d
+Author: Ville Syrjala 
+Date:   Mon Jan 22 21:26:11 2007 +0000
+
+    Fix ALUT44 Clear() by calling dfb_state_set_color().
+
+commit 8969c27479e55c1ed5e599495d9d47fb4afb5ab7
+Author: Ville Syrjala 
+Date:   Mon Jan 22 21:20:18 2007 +0000
+
+    Fix glyph rendering to indexed formats by calling dfb_state_set_color().
+
+commit 67de5e89280d2b264f71d9e2dfcf2fa7b28c134c
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 22 19:54:29 2007 +0000
+
+    Only use MADV_REMOVE if kernel version is 2.6.19.2 or higher.
+    
+    Print info message during startup.
+    
+    Use fallback definition for MADV_REMOVE (9) if headers don't have it. This
+    is ok for now, as we're only using it with 2.6.19.2 or higher anyways. It
+    would be bad if this feature was unused just because of the headers at build
+    time...
+
+commit 38d27ad4f188a6ee1a4ba62290df6c5974722f1f
+Author: Ville Syrjala 
+Date:   Mon Jan 22 19:25:54 2007 +0000
+
+    Use cpp templates for 16bpp and 32bpp code.
+    - Removes duplicated code.
+    - Implements some missing gfx funcs.
+    - Fixes missing EXPAND() calls in some acc funcs.
+    - Fixes blit direction handling in some 16bpp blit funcs.
+
+commit f3eaefc0cc9fcfe83ae52fd6a87a61790fc7ad16
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 22 03:06:11 2007 +0000
+
+    That's birthday and christmas at once: Glorious MADV_REMOVE! I found you!
+    
+    If available, the code for freeing blocks in the heap uses
+    
+    	madvise( ADDRESS(block), blocks * BLOCKSIZE, MADV_REMOVE )
+    
+    to punch a whole in the tmpfs file (loosing the data) to really free
+    the associated physical RAM.
+    
+    
+    You can see the difference in 'ls -l' and 'df'.
+
+commit 66dd3e6aa38f591f146d904cc23a21978b8af132
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 22 02:38:50 2007 +0000
+
+    Good bye shared memory segfault cure handler :)
+    
+    It'd been so easy. Simply mmap() the whole address range once and
+    only ftruncate() for resizing the heap.
+    
+    No more dynamic remapping, no more pending remap messages...
+
+commit 037867173da06f66f683ff5a4ff745b58dadbb95
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 22 01:24:16 2007 +0000
+
+    Not needed here.
+
+commit 243628484072c7c6070cb58e3d4f62047c79c1ce
+Author: Denis Oliver Kropp 
+Date:   Mon Jan 22 01:21:27 2007 +0000
+
+    Replaced 'unlink before (re)open or memset' by a simple O_TRUNC, doooh...
+
+commit cabc30e828a060cf06ad2b2bda7087e841c77556
+Author: Ville Syrjala 
+Date:   Sun Jan 21 22:39:09 2007 +0000
+
+    Fix version check for automake-1.10.
+
+commit d6c7ad84ad54362771c37a8ab167c4d908dd6ed7
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 21 22:11:25 2007 +0000
+
+    Added a few more formats that make the windowed primary use DWCAPS_ALPHACHANNEL.
+
+commit 4005425cc796a538505f689e8653001dfd3182af
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 20 04:04:13 2007 +0000
+
+    Use O_APPEND for FER_SLAVE.
+
+commit 9248605c594822d331733bb57d3028a514ae45fa
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 14 21:06:45 2007 +0000
+
+    Change minimum pool size (without info table) to 8192 (from 16384).
+    A value of 4096 didn't work somehow.
+
+commit d87e5a6e1950f28530d85ee6d7f7c76d0307ae4e
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 14 21:03:34 2007 +0000
+
+    Call dfb_windowstack_resize() and dfb_windowstack_repaint_all() later, i.e.
+    after the new settings have been written back into the context's config structure.
+
+commit b14f63813c9fc5dee7737b6ce9986da8bee12f34
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 14 21:02:11 2007 +0000
+
+    Added FCEF_NODIRECT which forces execution of the call in the Fusion
+    Dispatch thread even if it's the calling process' own call.
+
+commit 3f64ddc4f1e2ba8a2526b00a8fb09ceacd6975a3
+Author: Andreas Hundt 
+Date:   Thu Jan 11 18:05:24 2007 +0000
+
+    - include 
+    - -framework CoreGraphics is obsolete in OSX 10.4, use ApplicationServices instead
+
+commit 3549796556d79b5040fef7684a880d25b3925772
+Author: Ville Syrjala 
+Date:   Wed Jan 10 18:18:24 2007 +0000
+
+    Some stretch ops didn't start at Xphase.
+
+commit 2140dddeea2784c95f63f247badcfe42a424353e
+Author: Ville Syrjala 
+Date:   Wed Jan 10 18:06:39 2007 +0000
+
+    Fix bugs in RGB18/ARGB1666/ARGB6666 support,
+    and eliminate unnecessary gfx functions.
+
+commit 2ffb553edcb8c89c52142bcedfd73356724ff5b5
+Author: Claudio Ciccani 
+Date:   Wed Jan 10 10:06:36 2007 +0000
+
+    Removed check for sisfb.h.
+
+commit 18c76b3613ac42a9a1e79dafb8d648851c994097
+Author: Denis Oliver Kropp 
+Date:   Wed Jan 10 01:57:37 2007 +0000
+
+    Replaced "#ifndef input_absinfo" which doesn't work
+    by "#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)".
+
+commit b17fb847a5a8a8955eec0ed6c2b7863fa670bcc8
+Author: Denis Oliver Kropp 
+Date:   Tue Jan 9 23:33:25 2007 +0000
+
+    Make cursor area backing store surface same format as layer.
+
+commit 0bde50377717522ef56e6d05587e55161657d699
+Author: Marcel Siegert 
+Date:   Tue Jan 9 18:34:13 2007 +0000
+
+    added compat defines for touchpad linux input support for
+    kernels before 2.6.x;
+    should break nothing for now - hopefully :)
+
+commit 875df126b0076169d0ad96d5670e8a93b2169c05
+Author: Ville Syrjala 
+Date:   Tue Jan 9 17:24:34 2007 +0000
+
+    Cosmetics.
+
+commit 03d0e7c2cfe1c44ddeb766167c9e9bff9f9d9030
+Author: Ville Syrjala 
+Date:   Sun Jan 7 22:49:14 2007 +0000
+
+    Don't corrupt the return interface pointer in API methods,
+    ie. only set the pointer if the method succeeds.
+
+commit 606026c2b82c22f2bd9bb8a7777c1eaf89b9666a
+Author: Ville Syrjala 
+Date:   Sun Jan 7 22:46:03 2007 +0000
+
+    Fix a memory leak.
+
+commit 8b164dcd977c3f55e4d88bf1c1785b356dfbf211
+Author: Ville Syrjala 
+Date:   Sat Jan 6 18:09:10 2007 +0000
+
+    Remove a misplaced semicolon.
+
+commit 34526a3fe61f50f72753325361655f5943a71f9c
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 5 17:55:08 2007 +0000
+
+    Nicer shared memory allocation info as in dfbdump.
+
+commit e4f5ecc8f753993b2130079020f8ce47655af681
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 5 17:54:51 2007 +0000
+
+    Print shared memory leaks on pool shutdown (debug mode and 'debugshm' option).
+
+commit c5ed38aab5e1b9c94862baf454e3acba27e26ec9
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 5 17:53:29 2007 +0000
+
+    Free fake modes on shutdown.
+
+commit 7f44a10a1856ccb742179baae47f8968e325edde
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 5 17:52:59 2007 +0000
+
+    Added some basic update region management.
+
+commit ba098e2f65d6b902676b25e63a0ce289d26e62c3
+Author: Mark Adams 
+Date:   Wed Jan 3 10:42:13 2007 +0000
+
+    Document recommended changes in overlay and AiRGB usage.
+
+commit 30546551f38405578eaa90ff9cf15fac13beccdc
+Author: Mark Adams 
+Date:   Tue Jan 2 17:46:19 2007 +0000
+
+    Remove redundant comment.
+
+commit 98504be4d8ff16240f0baaff610cbf8235c09138
+Author: Mark Adams 
+Date:   Tue Jan 2 17:45:58 2007 +0000
+
+    Implemented acceleration for blits involving the AiRGB pixel format.
+    
+    DSPF_AiRGB is now supported as a source format for most blits and stretch
+    blits.  Blits _to_ AiRGB surfaces are also accelerated provided they don't
+    require blending.
+
+commit d57ecf551b50302b09e5abaf9d3a12038ef9ca66
+Author: Ville Syrjala 
+Date:   Sat Dec 30 18:26:36 2006 +0000
+
+    Improve touchpad support:
+    - Detect touchpads in init.
+    - Read min/max coordinates from the device.
+    - Add drag support.
+    - Clean up the code.
+
+commit cbc098d1f241feecfd3a511bc86ef3ff159c8fb7
+Author: Ville Syrjala 
+Date:   Fri Dec 29 20:31:20 2006 +0000
+
+    Fix some incorrect key mappings. Patch from Stefan Lucke.
+
+commit ee675c1efae5b265dff5fb084fcafa017f5b89ad
+Author: Claudio Ciccani 
+Date:   Thu Dec 28 11:19:25 2006 +0000
+
+    In IDirectFBSurface_FillRectangles():
+    use D_MALLOC/D_FREE instead of malloc/free (thanks to Kamijo Takashi ).
+
+commit 3f1e06d97b9f0f2539bfcc028e17a1aa90ca133a
+Author: Claudio Ciccani 
+Date:   Sun Dec 24 14:23:01 2006 +0000
+
+    Avoid locking in HasData().
+
+commit 5ee4aed4a5076543f4706c140de0cdcf10f005f0
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 22 19:14:42 2006 +0000
+
+    Check bit depth in case of an indexed PNG. Don't assume 8 bit. Added 4 bit
+    support.
+
+commit 2e2dd0d00e032a6519538fc26dfe99c1d7e83903
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 20 02:05:32 2006 +0000
+
+    Support DLBM_BACKSYSTEM as a default.
+
+commit b35bc079cca2c6f27857cc65a59e166222eb9605
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 20 02:04:07 2006 +0000
+
+    Fall back to /dev/shm if no mount point could be determined.
+
+commit 2bb5e7aab54fc6fd2647aff9c7fa515af10fb8e8
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 20 02:03:04 2006 +0000
+
+    Turn warning into debug.
+
+commit 8baa6c6a3b35ba5ee1676104660b633167a9384a
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 14 09:44:22 2006 +0000
+
+    Allow read access to "owned" surfaces.
+
+commit 356c9c2b9029109a08bbc8d0f36dad669b907ae5
+Author: Claudio Ciccani 
+Date:   Wed Dec 13 18:16:30 2006 +0000
+
+    Initialize pointsize register.
+
+commit b34b0f24afe593a81cd4624d7576f390e4a42c94
+Author: Claudio Ciccani 
+Date:   Wed Dec 13 18:15:22 2006 +0000
+
+    Must adjust point coordinates by +1.
+
+commit 620aebc3869d625cf5455c572fe195564eedbec7
+Author: Claudio Ciccani 
+Date:   Tue Dec 12 20:36:06 2006 +0000
+
+    Check pixelformat when enabling alphachannel (it should be AiRGB, I think).
+
+commit f64cf8956260a94dc917689a3b6d4fecafa8e6a5
+Author: Claudio Ciccani 
+Date:   Mon Dec 11 14:44:25 2006 +0000
+
+    Set RTSP connection type to Close.
+
+commit e8d8c7b7e59c069c463e6e711ce5d665cabedcbb
+Author: Claudio Ciccani 
+Date:   Mon Dec 11 13:56:49 2006 +0000
+
+    Implemented seekability over RTSP.
+
+commit 72304713577dbef90a1d586145b6d67a3b42358a
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 10 00:01:30 2006 +0000
+
+    Fix fusion_hash_iterate() to support a nested fusion_hash_remove() on the
+    current item (or others, except the next).
+
+commit c00c96c4f0501036d65eb4f044af7f85a4f729d1
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 9 15:35:18 2006 +0000
+
+    Added missing prototype of fusion_hash_size().
+
+commit fba1263a10ed786e2ee3684ed67848f47f2b02e1
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 9 14:47:39 2006 +0000
+
+    Fixed fusion_hash_create() that was not passing the pool pointer to the
+    internal function.
+
+commit fb8637bf1ed5abb3dd77dfd3d6c9fee98244f149
+Author: Claudio Ciccani 
+Date:   Sat Dec 9 11:27:28 2006 +0000
+
+    Autodetect clock skew.
+
+commit 4d308b35b0572eb05c1da403f6a8d9fca400c6fd
+Author: Claudio Ciccani 
+Date:   Fri Dec 8 12:16:39 2006 +0000
+
+    Fixed a wrong comparison.
+
+commit 9acb2361e7e2c057d67cfecc4d28f5fc830913b5
+Author: Claudio Ciccani 
+Date:   Fri Dec 8 12:15:33 2006 +0000
+
+    Added radeonInvalidateState().
+
+commit ab02ecc45130368d8de4ff6c27dfc026d3670e06
+Author: Claudio Ciccani 
+Date:   Fri Dec 8 12:14:37 2006 +0000
+
+    Added GraphicsDeviceFuncs::InvalidateState(): notify the driver that
+    the current rendering state is no longer valid.
+
+commit e74fe32d7a028bfdec3e34f0175cb3c8ec09f8e9
+Author: Claudio Ciccani 
+Date:   Wed Dec 6 14:10:13 2006 +0000
+
+    Dispatch surface's notifications asynchronously.
+    
+    This change fixes an assertion failure that happens in the following case:
+    1. Resize (Downsize) Surface
+    ... and immediatly after ...
+    2. Blit to Surface
+
+commit a27ab3ff0fd81de547cbccecfb8686f72bfae70a
+Author: Claudio Ciccani 
+Date:   Wed Dec 6 14:05:13 2006 +0000
+
+    Added fusion_reactor_sync(bool) to specify whether message dispacthing to
+    local reactions must be synchronized with global reactions or not
+    (i.e. fusion_reactor_sync(false) makes notifications happen immediatly in the dispatcher process).
+
+commit e5a3616361f0a3b03dc7c6d0aa6ae0b96b3cdb0e
+Author: Claudio Ciccani 
+Date:   Wed Dec 6 14:00:27 2006 +0000
+
+    Provided a return value to radeon_waitfifo() and radeon_waitidle().
+
+commit cdccba6ec52c1b5eb1eeeb89aecb713736877b83
+Author: Denis Oliver Kropp 
+Date:   Mon Dec 4 22:52:38 2006 +0000
+
+    Thanks to Vaclav Slavik for fixing loading of mono-only fonts.
+
+commit 911c44afa750cd93af20717437e1e73ba709994f
+Author: Claudio Ciccani 
+Date:   Mon Dec 4 17:49:53 2006 +0000
+
+    R300 supports 3D Colorkeying. :)
+
+commit 91103de9ca26c63125eda9c978915e13d97fdaa8
+Author: Claudio Ciccani 
+Date:   Mon Dec 4 11:35:26 2006 +0000
+
+    Implemented r300Blit3D_420, R300StretchBlit_420 and r300TextureTrinangles_420.
+
+commit 1a8122316b26f53e5fd4a932a21ef13e0eb92408
+Author: Claudio Ciccani 
+Date:   Sun Dec 3 19:02:05 2006 +0000
+
+    Implemented
+     - StretchBlit
+     - TextureTriangles
+     - Alphablend
+     - Deinterlacing
+    for the R300 chipset family (thanks to Timon ).
+
+commit d9c0b1c9475280480f48e4ad3a0061ab3880d238
+Author: Claudio Ciccani 
+Date:   Sat Dec 2 09:07:59 2006 +0000
+
+    Allow the DirectFBGL module to Probe the destination surface.
+
+commit f9433b8dba5b677ca8936f036d483cbd9cf3591e
+Author: Claudio Ciccani 
+Date:   Sat Dec 2 09:06:46 2006 +0000
+
+    Workaround for a repeated char (0) within the glyphs table.
+
+commit 420a0afc6b71acf2a046c0f59663f4421d69313d
+Author: Claudio Ciccani 
+Date:   Fri Dec 1 17:35:44 2006 +0000
+
+    Check for stdbool.h presence during configuration and define DIRECT_BUILD_STDBOOL accordingly.
+
+commit 4e6f98284583bba353127dc869c2073142b83af0
+Author: Claudio Ciccani 
+Date:   Fri Dec 1 14:06:18 2006 +0000
+
+    Added IDirectFBGL::GetProcAddress(), get the address of on OpenGL function
+    (required to avoid hard dependency and allow portability between different environments).
+    
+    Added definition DIRECTFBGL_INTERFACE_VERSION to check interface compatibility.
+
+commit 13d1392ed1e0e24c803e54b213666eae3bd261e7
+Author: Claudio Ciccani 
+Date:   Fri Dec 1 10:43:34 2006 +0000
+
+    Implemented GetID, GetDescription, GetSize, SetPowerMode and WaitForSync.
+
+commit e0d89b6dd42eaec32a951809b53692185534a9db
+Author: Claudio Ciccani 
+Date:   Fri Dec 1 10:42:27 2006 +0000
+
+    Implemented GetPosition and GetSize.
+
+commit b436407dfc07df577c7156771ce8e9fd9ca89738
+Author: Claudio Ciccani 
+Date:   Thu Nov 30 17:08:00 2006 +0000
+
+    Added missing methods.
+
+commit 611b595471da9fc5f007c19f83289bfd260188e9
+Author: Claudio Ciccani 
+Date:   Thu Nov 30 14:57:49 2006 +0000
+
+    Added missing methods.
+
+commit 8c344d1fdd92d7be456d6465aef070112bffb285
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 29 11:38:07 2006 +0000
+
+    Added Bop_argb_blend_alphachannel_src_invsrc_Aop_PFI[] as a fast path
+    for blending from ARGB with SRCALPHA / INVSRCALPHA.
+    Implemented for RGB16 and RGB32 so far.
+
+commit 5641b56573b2e5eedbf998aa6bd6c150d7e72e65
+Author: Claudio Ciccani 
+Date:   Wed Nov 29 09:32:25 2006 +0000
+
+    C++ fix.
+
+commit d36e6023a877717c86c359b93914472a01b3d475
+Author: Claudio Ciccani 
+Date:   Tue Nov 28 18:30:19 2006 +0000
+
+    Removed 2.6.18-rc2, added 2.6.18.
+
+commit 50589388c8a9b66637efba874c70e7f19f4d86a3
+Author: Claudio Ciccani 
+Date:   Tue Nov 28 10:53:42 2006 +0000
+
+    Removed sisfb.h. Put the declarations in sis315_compact.h.
+
+commit 2454efb92d71fff78af7d3c2804f09a9e64d1bd2
+Author: Claudio Ciccani 
+Date:   Sun Nov 26 14:01:26 2006 +0000
+
+    Compare bytes instead of bits when checking for pixelformat compatibility.
+
+commit 20682a6a72f91f385a21d66f91edc077b6a78979
+Author: Claudio Ciccani 
+Date:   Sun Nov 26 14:00:02 2006 +0000
+
+    Allow to wait() on a RTSP stream.
+
+commit 080185adf29bc2c3be8e68d934fca3a4c88841c4
+Author: Claudio Ciccani 
+Date:   Sun Nov 26 13:58:58 2006 +0000
+
+    Be more precise about the behaviour of IDirectFBSurface::Flip().
+
+commit 01c575483b9858703db51d929d61608396ee45d5
+Author: Ville Syrjala 
+Date:   Fri Nov 24 23:53:55 2006 +0000
+
+    tslib input driver by Shane Volpe . Thanks!
+    Support for multiple devices and some coding style cleanups by me.
+
+commit aed99e3a1e99b997aaa6166185b30fc8b01b156c
+Author: Marcel Siegert 
+Date:   Fri Nov 24 16:16:09 2006 +0000
+
+    add some personal stuff in .cvsignore
+    e.g. kdevelop project files
+
+commit 594b43580f6bbed705c88de53b09585667e729bb
+Author: Marcel Siegert 
+Date:   Fri Nov 24 16:10:14 2006 +0000
+
+    add .cvsignore
+
+commit 2bf905595a2999b896b79d61360c2385a07e537e
+Author: Marcel Siegert 
+Date:   Fri Nov 24 16:09:02 2006 +0000
+
+    add cvsignore
+
+commit 18573a6e1c699d9fa0db336375c7c005658bded2
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 24 14:02:55 2006 +0000
+
+    Thanks a lot to Attilio Fiandrotti for adding touchpad support!
+
+commit ef443a2d5b45b5451b53edf94ada9525ae93d824
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 24 00:08:14 2006 +0000
+
+    Readded setpgid(0,0) also in system_join().
+
+commit 765669036f0299d38820dc3101a12faec40bca9e
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 23 10:26:13 2006 +0000
+
+    Readded setpgid(0,0) in system_initialize().
+
+commit 80d78094120294ef382023c37072f621af8a4afd
+Author: Claudio Ciccani 
+Date:   Tue Nov 21 16:03:46 2006 +0000
+
+    Need sisfb.h to build.
+    Either if sisfb.h is in the include path (i.e. headers come form linux-2.4)
+    the driver should not rely on that header because linux-2.6 may be running
+    instead and 2.4 and 2.6 versions of sisfb_info are incompatible.
+
+commit 47d476067194f68435ad01c9cc979a73fd0e204f
+Author: Claudio Ciccani 
+Date:   Tue Nov 21 14:55:40 2006 +0000
+
+    Fixed warnings (on x86_64).
+
+commit d5b5b463b0ff6e97d1b543f5eba235b9e3467aaa
+Author: Claudio Ciccani 
+Date:   Tue Nov 21 14:36:36 2006 +0000
+
+    Cosmetics.
+
+commit bd49dc56fb590599aff402b0fb13c99c951a2341
+Author: Claudio Ciccani 
+Date:   Tue Nov 21 13:19:35 2006 +0000
+
+    Enable DWOP_SCALE by default for windowed primary surfaces.
+
+commit e03598c8de76abe339be67ab46dfa83efb0cf1cc
+Author: Claudio Ciccani 
+Date:   Tue Nov 21 13:18:11 2006 +0000
+
+    In dfb_gfxcard_stretchblit():
+    be smart and execute dfb_gfxcard_blit when possible.
+
+commit e54ce388ad0cc5ccd8de3d3008371b0fd648a47b
+Author: Ville Syrjala 
+Date:   Mon Nov 20 22:04:44 2006 +0000
+
+    Don't try to immediately allocate the new video instance when reallocating
+    a buffer (unless the policy is CSP_VIDEOONLY). Fixes corruption problems
+    in XDirectFB caused by window resize failing.
+
+commit 0cd7483fae6316eb10da67a4f51c2dadd8a0c9b4
+Author: Ville Syrjala 
+Date:   Mon Nov 20 20:52:29 2006 +0000
+
+    v4l2 code still used dfb_surface_soft_lock() without the CoreDFB argument.
+
+commit 682a9fa560f2aa2676e22e031f0e8cdbd97538b1
+Author: Denis Oliver Kropp 
+Date:   Mon Nov 20 11:40:13 2006 +0000
+
+    Readded generic64_memcpy().
+
+commit 052e2ad9dfbfda4d31dd8c4c59a4add6d0605100
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 19 11:41:44 2006 +0000
+
+    Fix array stride mismatch in FindColorKey(), thanks to Ben Combee!
+
+commit a1e3d13351d026897e388f32eff73b48a8c8170a
+Author: Claudio Ciccani 
+Date:   Sat Nov 18 11:54:13 2006 +0000
+
+    Fixed incorrect frame delay computation.
+    Do not use variadic arguments.
+
+commit dc692efba341d3dd7060d7822e6da3ebd58739eb
+Author: Claudio Ciccani 
+Date:   Sat Nov 18 11:08:41 2006 +0000
+
+    Enable passing the actual CoreDFB to all external interfaces
+    (excluding DirectFBGL that gets its own IDirectFBSurface).
+
+commit 9495ae70670c12631f5f170d08f08c81db4fb3a9
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 18 10:45:14 2006 +0000
+
+    Added option "no-software" to disable software fallbacks. This is mainly for
+    debugging/profiling purpose. It will print out a warning with the operation
+    and flags each time a fallback would occur.
+
+commit 70cdce08db7f11e40a83923ddc971d76ebe69696
+Author: Claudio Ciccani 
+Date:   Fri Nov 17 17:28:02 2006 +0000
+
+    Workaround to follow recent API changes (that shouldn't happen between release candidates!!).
+
+commit aa47c8c6bd7d76fafcb4daec9692f1db0e0543ca
+Author: Claudio Ciccani 
+Date:   Fri Nov 17 17:25:49 2006 +0000
+
+    Attempt to make acceleration work on ppc:
+    enable acceleration only for formats that have the same pixel size
+    as the primary layer (to avoid changing the byte swapper).
+
+commit 909a3befdce44240d6a4bfe238b3c4f6b348af48
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 15 02:12:48 2006 +0000
+
+    round 2
+
+commit 2d0fb5e39cd98888f417100c89319ce5c2d74041
+Author: Denis Oliver Kropp 
+Date:   Mon Nov 13 21:42:28 2006 +0000
+
+    Fix SHCALLOC and friends, i.e follow API change.
+    
+    Can't test myself.
+
+commit 811f7e113a0c33ea34d88bd017b0c9c0f1682a41
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 12 12:19:54 2006 +0000
+
+    Added support for scaled windows.
+    
+    New window option DWOP_SCALE prevents the surface from being resized when the window
+    size on screen changes, i.e. via IDirectFBWindow::Resize() or SetBounds().
+    
+    The surface can be resized separately using IDirectFBWindow::ResizeSurface() if needed.
+    
+    New runtime option "scaled=x" scales the window to the specified size
+    for 'force-windowed' apps. The surface size will not be affected, still set via "mode=".
+    
+    
+    Try "df_andi --dfb:force-windowed,mode=640x480,scaled=800x600" in a running session!
+    
+    Also enjoy resizing the window (just scaling differently) using Meta-Ctrl-MouseMotion :)
+
+commit 51e8d6c3b2280fab29de5ecac3e6f9f01cd5f41d
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 12 11:33:37 2006 +0000
+
+    Added IDirectFBWindow::SetBounds() to do a move and resize in one step.
+    
+    Internally this will use existing the WM API that allows changing any
+    combination of items in the window configuration. Due to historical reasons
+    there has only been one item changed at a time. Now it can happen that both
+    flags CWCF_POSITION and CWCF_SIZE are set when calling wm_set_window_config().
+    
+    The default window manager module got a special function to implement the
+    combined move/resize in this case. The older separate move and resize functions
+    could be replaced by calling the new function, but that's not done, yet.
+
+commit 3fab1f8192e5c4c838e2f83e0214778b2705866a
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 12 09:54:04 2006 +0000
+
+    Fixed prototype.
+
+commit aeea8d7b2192174bc90bc84d0aa889764916b1b4
+Author: Claudio Ciccani 
+Date:   Sat Nov 11 09:29:48 2006 +0000
+
+    Skip MMX test on AMD64.
+
+commit d6a4884c465dc7152a1cfebc8dd5d386405280ab
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 10 21:34:10 2006 +0000
+
+    Support loading of indexed PNG files directly to LUT8 surface.
+    
+    Provide palette of image via GetSurfaceDescription().
+
+commit cd4c579761c653322422caf32e8b95f015cdf6a1
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 10 13:13:30 2006 +0000
+
+    Fixed warning.
+
+commit bfe3a678d3399911927b50623eebc6d6315697be
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 10 13:06:25 2006 +0000
+
+    #include 
+
+commit 4893a9b7179e7a676d4e51bc696ade21f5316600
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 9 10:59:30 2006 +0000
+
+    Added ability to let only one Fusionee write to a surface,
+    set via owner field of CoreSurface.
+    
+    Had to add CoreDFB* parameter to dfb_surface_software_lock() and
+    dfb_surface_hardware_lock() where the owner is being checked.
+
+commit e7da8d24a58774b43821302ddf54ab115e2b247c
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 9 10:54:33 2006 +0000
+
+    Removed "Unknown key pressed" message which can happen on supported (via symbol) keys.
+
+commit 1e238abcec4aa702384b80a0ea498e17a34d5518
+Author: Denis Oliver Kropp 
+Date:   Sun Nov 5 19:40:45 2006 +0000
+
+    Fix single app build.
+
+commit b8b42d3aa866513ea35c3ea746161a8b8c44c1c0
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 4 13:25:47 2006 +0000
+
+    Give the WM a chance to provide its own surface.
+    
+    The WM may link a surface to the window in the PreConfigureWindow() call.
+
+commit 1d0967541bf94330595e4dc7b5b6c4409af08798
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 4 13:21:29 2006 +0000
+
+    Removed more.
+
+commit 96dd89fd03f84c0cdb91ed8af87df2831e668453
+Author: Denis Oliver Kropp 
+Date:   Sat Nov 4 13:04:09 2006 +0000
+
+    Removed some obsolete crap.
+
+commit 8ae92c06ddd3fa95551fb02194ad08acc63bedf3
+Author: Denis Oliver Kropp 
+Date:   Fri Nov 3 00:19:24 2006 +0000
+
+    That was enough for RC3.
+
+commit e630981153c0c76f88237f37560dcd3e99588198
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 23:56:15 2006 +0000
+
+    Increase row width.
+
+commit 74f36bfa187ac689ddb0744a98b8fc4385b3c975
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 23:44:54 2006 +0000
+
+    Fixed wrong pixel format index of LUT2.
+
+commit 559d5759faec519a3956ec8fccc2d5b713e2944b
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 23:24:57 2006 +0000
+
+    Make shared memory allocation output use direct_log_printf as for local memory.
+    
+    Print list of allocations if maximum heap size has been reached.
+
+commit d781a544bb60eb3291ff74567333ddb9befcba47
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 23:06:06 2006 +0000
+
+    Show allocations in both DirectFB shared memory pools with option "-s".
+    
+    Show FusionID and offset within file/heap.
+
+commit 30edbe51bfb9de91d18a8bc9c282e4f61aa1ce0b
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 22:45:10 2006 +0000
+
+    Let "debugmem" option only influence output of allocations, but always track
+    them in debug enabled builds.
+
+commit edc68dcb060bf63c3c67faf14ab1c5e84900b17b
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 22:34:47 2006 +0000
+
+    Added options "debugmem" and "debugshm" to turn on local/shared memory allocation
+    debugging separately from "debug" option.
+
+commit d97ef8adc3ca4d4fa1e48e004acc615c6f111648
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 22:32:38 2006 +0000
+
+    Fixed crash with symbol table lookup code when filename is NULL.
+
+commit 480000cbe4c3b27c3d543165a3a706a26beced4c
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 22:25:10 2006 +0000
+
+    Use direct_memmove() here, too.
+
+commit 567660bed608f07d07f0480b04218278ee0af73d
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 21:58:50 2006 +0000
+
+    Use memmove() in any overlapping case, don't allow moving downward, because
+    the read/write block size of the memcpy() is not known and the difference
+    between from and to area is often only a few bytes, e.g. moving trailing items
+    after removing an item from an array.
+
+commit ea7c39df84ae0cd9efd46f79a8cb1d3b08b2bf1d
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 21:25:04 2006 +0000
+
+    Include Fusion ID of allocator in debug info.
+
+commit c0ab69c76ae0c637b7d3c863f71f0e483cc2fd86
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 21:10:07 2006 +0000
+
+    Just for debugging I added the option "-p" to pause() dfbdump.
+    
+    One could run it as a master and look at the foot print or other
+    things that are there before any application specific stuff happens.
+
+commit c6f22948a08317259b5d1ada8cd6c0d8a2ba6673
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 21:06:26 2006 +0000
+
+    Initialize the heap info table to serve for the maximum pool size specified
+    at creation of the pool. Previously, the initial table served for 4 MB heap.
+    If there were more allocations, the heap info table was reallocated at the
+    end of the heap, i.e. at 4 MB making it impossible to ever go back below
+    the 4 MB heap size. Next barrier was 8 MB, 16 MB ...these are gone.
+    
+    Unlink potentially remaining file from a previous session before creating
+    the shared memory file in tmpfs.
+    
+    Removed memset() on the initial heap to take advantage of the actual allocation
+    of the pages happening when first accessed. If it's a new file, which it is
+    now, it will be zeroed anyways.
+    
+    The maximum size specified during creation of a pool is now taken as an
+    additional size after the heap info table. Previously, it could happen that
+    the size was too small to host the fixed sized heap info table.
+
+commit 057fc7fa22ac6e73c6b20ab75b7a9592f3e6cb33
+Author: Denis Oliver Kropp 
+Date:   Thu Nov 2 20:52:28 2006 +0000
+
+    Fixed two messages not being debug messages.
+
+commit aeb7f4003cb6a120aeb8894ef808df8383677ff3
+Author: Claudio Ciccani 
+Date:   Thu Nov 2 13:53:47 2006 +0000
+
+    Fixed hundredths to microseconds conversion.
+
+commit ba55457269f182f614e05d22d7ec709a495a8c98
+Author: Claudio Ciccani 
+Date:   Thu Nov 2 11:52:27 2006 +0000
+
+    __inline__ instead of inline (same as typeof).
+
+commit 6b028683917d91cc06221a062bffd75279ae2db1
+Author: Claudio Ciccani 
+Date:   Thu Nov 2 11:46:12 2006 +0000
+
+    Use __typeof__ instead of typeof because the latter requires standard to be gnu89/gnu99.
+
+commit 1f536276de06b0628637018ec09821a277fade5a
+Author: Denis Oliver Kropp 
+Date:   Wed Nov 1 09:00:12 2006 +0000
+
+    type fixes
+
+commit b661e583f6e88178367140e4e22f8ba294ee2d50
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 31 11:26:32 2006 +0000
+
+    This was missing from the recent LUT2 commit.
+    
+    It adds support for LUT2 fonts to the FT2 module.
+
+commit a4abc1531310f4a99be0b482f1ac64bd05253150
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 30 00:37:40 2006 +0000
+
+    Added dgiff.h
+
+commit c43ae3c827623e1f5cd1c934a12b789a56b9f234
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 30 00:12:35 2006 +0000
+
+    shine
+
+commit b86be9e1819c26487826e45f396e61bcdc39aacf
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 30 00:10:11 2006 +0000
+
+    Let'em go...
+
+commit 41e09f6592d9500783dd6c69346516d657eaee44
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 23:26:42 2006 +0000
+
+    Also actually include  now.
+
+commit d0a2fd3a61f19ad054be917da489284a340a21c9
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 23:24:50 2006 +0000
+
+    Change license to LGPL.
+    Remove kernel header.
+    Build only if  is found.
+
+commit 7c9f83c3d73516f05dd6375a3d5fc2cf62fc6dc6
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 11:16:54 2006 +0000
+
+    Removed GPLed header and made driver build with latest kernel i2c headers.
+    
+    How about older versions, is there something to be done differently?
+    
+    Maybe different header files to include?
+
+commit 34cb23d069898dd800af7d1a7665475a49bb163c
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 10:54:42 2006 +0000
+
+    cosmetics
+
+commit 1ae6b87fbf1c50508a5a69f9b461bab8f0af34b4
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 10:53:55 2006 +0000
+
+    Changed license to LGPL in these files, thanks to Paul Mackerras |paulus * s amba.org!
+
+commit 0263ee03c27b67ee7e71c5ce38bb9de3ea5222f0
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 29 10:48:35 2006 +0000
+
+    Removed GPL code, mainly optimized x86 memcpy routines. libc seems fastest
+    now anyways.
+
+commit 794956b6aec1497c236021e40d9d0be1b636fe49
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 21:15:22 2006 +0000
+
+    build fix
+
+commit 39779d043bc74b0be92014d36fd1c8903d77736a
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 20:38:49 2006 +0000
+
+    Breaking the API freeze, but keeping binary compatibility.
+    
+    This is something that I have forgotten to apply before freezing the API.
+    
+    Added DSPF_LUT2 being indexed 2 bit per pixel packed, i.e. four pixel in one byte.
+    
+    Added IDirectFBSurface::SetIndexTranslation() that sets a translation table used for
+    fast indexed to indexed pixel format conversion. Negative or undefined values in the
+    table will result in no pixel being written.
+    
+    Added DSBLIT_INDEX_TRANSLATION to do fast indexed to indexed translation, this flag
+    is mutual exclusive with all others.
+    
+    
+    So far only LUT2 to LUT8 is supported, used for fast anti-aliased text rendering
+    to indexed format. The translation table contains "-1, 36, 37, 38" for example.
+    First entry makes the background transparent and the other three are shaded versions
+    of the text color.
+
+commit c031ecd3059c82ba3f95681738282ad1ffadd28e
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 20:25:16 2006 +0000
+
+    Fix Bop_a8_set_alphapixel_Aop_yuy2() for big endian.
+
+commit 5da12d377c4ec971e345104e5b1c94af85f62667
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 20:23:09 2006 +0000
+
+    In dfb_layer_context_get_primary_region() if increasing the ref count of the
+    existing primary region fails, due it being destroyed, wait for a short time
+    and try again, probably recreating the region.
+
+commit d2ac0696581f9dbd70dfdfc0012c1ccb3357e205
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 20:20:15 2006 +0000
+
+    Don't print an error if an object revived after it's ref count reached
+    zero but got increased again before the destructor is called. That applies
+    to the multi application core only. In the single application core the
+    destructor is called synchronously.
+
+commit fd87ebf9b2320a0a525c537e531aee9896e56432
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 18:47:34 2006 +0000
+
+    No longer create a new process group in dfb_core_create().
+    
+    No longer use pthread_kill(KILL) which doesn't only kill the specified thread, use pthread_cancel().
+    
+    Let direct_assert() and others try raise(TRAP) first, then killpg(0,TRAP) and pthread_exit().
+    
+    At the end of the global signal handler no longer use killpg(0,KILL) but remove all handlers,
+    raise(num), abort() and then exit( -num ). But the exit shouldn't be reached.
+    
+    Register signal handler with empty instead of full blocking mask and use SA_NODEFER except
+    for SIGSEGV. Also no longer use SA_RESTART.
+    
+    Don't take certain locks in core shutdown functions if emergency is true.
+    
+    Use recursive mutexes in trace support if available.
+    
+    Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in configure.
+
+commit 73b008e4f20092c61aed03fc2db94722cb249e1c
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 28 13:35:54 2006 +0000
+
+    Use other signals than SIGUSR1/SIGUSR2, as defined at the top of the file.
+
+commit 8ab76006de60ad761be1528e75f7e9898270c1f9
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 23 09:16:16 2006 +0000
+
+    Define compatibility macros for __ types unless DIRECTFB_NO_CRUFT is defined.
+
+commit 8cce1d2523e84e57aed21d49aed43d78ec68c00e
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 23 09:10:14 2006 +0000
+
+    Don't depend on "debug" option when printing interface leakage at exit time.
+
+commit 581797757fb1a966affb1681b19d7fc062397503
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 19 01:22:21 2006 +0000
+
+    Fix software access to chunk less video buffer, was just broken.
+
+commit 595f125c7cabeddeb19ad7a16e7241c52633693b
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 17 11:25:05 2006 +0000
+
+    Print warning if object could not be created.
+
+commit 6000cbfbe3bda148a91f1fe265040bcee4553c9c
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 17 11:24:49 2006 +0000
+
+    Added some D_OOSHM().
+
+commit 1932030c078442763fe859e0966e4ac5c5966850
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 17 09:55:52 2006 +0000
+
+    Renamed CSS_SYSTEM to CSS_NONE.
+    
+    No longer change buffer storage when system memory instance is valid.
+    
+    Only set buffer storage once in occupy_chunk() and only clear it once in free_chunk().
+    
+    This fixes NULL pointer returned by an autovideo lock on video memory instance
+    when storage had been set to CSS_SYSTEM while the video instance was still valid.
+    In that case (storage != CSS_VIDEO) it returned the auxiliary memory.
+
+commit 0602cf0b7a87d0ee380a8fdea0250555cbeade78
+Author: Denis Oliver Kropp 
+Date:   Tue Oct 17 09:52:26 2006 +0000
+
+    Made DFFA_NOCHARMAP work again.
+    
+    If Unicode/Latin1 failed, try Symbol Encoding and do some 0xf000 magic.
+
+commit bdd04791a1c6232f21668ab48306d0a86fba15c1
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 15 21:40:43 2006 +0000
+
+    Keep formats sorted!
+
+commit 88bd62a8f93e0f039e63ca5c484f26287ce21e00
+Author: Denis Oliver Kropp 
+Date:   Sat Oct 14 13:05:36 2006 +0000
+
+    Thanks to Guillem Jover for fixing the kernel type usage, replaces __u8 by u8 etc.
+
+commit 676c74dea81f0e11f9ebebff375c676378f2b6f6
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 12 20:58:07 2006 +0000
+
+    Added missing unistd.h include, thanks to Shane !
+
+commit dc3a14e04168539a4434ed53f24b3ed6cb11425f
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 12 11:23:00 2006 +0000
+
+    Build mkdfiff only if PNG support is enabled.
+
+commit 17b8e8a124e4128694f33de95fee34507e14ca51
+Author: Ville Syrjala 
+Date:   Tue Oct 10 00:15:22 2006 +0000
+
+    Don't include config.h in direct/types.h. Fix stdbool.h warnings.
+
+commit c22e82ecfd58992193c6f42727dcdf976811309f
+Author: Ville Syrjala 
+Date:   Mon Oct 9 23:53:53 2006 +0000
+
+    Silence a compiler warning.
+
+commit f0701d7a62988f7d19d17407ba41fe7e59e18de1
+Author: Ville Syrjala 
+Date:   Mon Oct 9 23:53:15 2006 +0000
+
+    Ignore repeat events for mouse buttons.
+
+commit 10a4d8721196a0495d6326a2420fe72bb70e9e47
+Author: Ville Syrjala 
+Date:   Mon Oct 9 23:52:07 2006 +0000
+
+    Disable dithering when doing alpha blended blits. Dithering it is applied
+    even when the source pixels are completely transparent. This change makes
+    the mouse cursor look sane.
+
+commit 6e26969bcc7a7cae72654c60b316dc2fe41c3827
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 9 20:24:37 2006 +0000
+
+    Added D_WARN() in dfb_gfxcard_reserve_memory() for each case in which allocation fails.
+
+commit f2546210359388095a1187e0cff9008be5d2c05f
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 9 20:19:21 2006 +0000
+
+    Yuck! The "tmpfs" option was ignored for quite some time.
+
+commit 5e09ca1ddd900cdc99aa84a4031f8d05d2776591
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 9 08:09:39 2006 +0000
+
+    DGIFF - DirectFB Glyph Image File Format
+    
+    Added a new font module and a tool called mkdgiff to generate .dgiff from .ttf or other.
+    
+    Purpose of DGIFF is to offload as much as possible from runtime, especially during
+    application startup when loading the default or system fonts. mkdgiff uses FreeType2
+    to load the glyphs of the font and stores them in one or more ready to use font cache
+    rows, up to 2047 pixels wide right now.
+    
+    The loader creates preallocated surfaces from the mmapped font file. The only copy ever
+    made would be when the surface is transfered to video memory for acceleration.
+    
+    DGIFF supports different sizes of one face in a single file.
+    
+    You can specify these options on the mkdgiff command line:
+    
+       -f, --format       Choose the pixel format (default A8)
+       -s, --sizes     [,s2...]    Choose sizes to generate glyph images for
+
+commit 63607c8aa5ae4bedec39cfa0660f80587103d610
+Author: Claudio Ciccani 
+Date:   Fri Oct 6 12:09:53 2006 +0000
+
+    readdir_r() instead of readdir().
+
+commit 9f4e4519997401f934575699510ab7eb47a0e915
+Author: Claudio Ciccani 
+Date:   Thu Oct 5 12:27:51 2006 +0000
+
+    Fixed username/password parsing.
+
+commit 90b3c513b4ef08d66e61bea85b3f662b45c6afeb
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 5 10:03:33 2006 +0000
+
+    Plugged mem leak of AttachedWindow struct when DetachEventBuffer() happens
+    after the window has been destroyed.
+
+commit 2d564735169fc46eb91458b390cae7c393d74fe7
+Author: Denis Oliver Kropp 
+Date:   Thu Oct 5 07:06:09 2006 +0000
+
+    Use libpng-config if present. Thanks to Gery !
+
+commit 65819c113c1e6869a52edc12393c081f9c752b32
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 4 11:44:48 2006 +0000
+
+    Safely cycle through nodes while freeing them.
+
+commit f5d3dd0d584d8684fbcca32c0c6bbcf3c15b6aa4
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 4 10:14:01 2006 +0000
+
+    typo
+
+commit b30e5e41c01f9bebb4c6eea6456aaff7b8d4dd56
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 4 10:12:43 2006 +0000
+
+    Fix vendor strings.
+
+commit cba26f9d02423522819ae8a324e922784dd75707
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 4 10:05:40 2006 +0000
+
+    Fixed vendor string.
+
+commit 0e600cda403b1859a5084e67ddad67827bd2a846
+Author: Denis Oliver Kropp 
+Date:   Wed Oct 4 10:04:25 2006 +0000
+
+    Fix vendor strings.
+
+commit ac94b2ebc28cf6cc28c8c8357e48b9869c1501d9
+Author: Claudio Ciccani 
+Date:   Tue Oct 3 12:19:15 2006 +0000
+
+    Use readdir_r() instead of readdir().
+
+commit 784530e8a32a6074d637b04d8e6a9fe1ca029bd9
+Author: Claudio Ciccani 
+Date:   Mon Oct 2 15:18:56 2006 +0000
+
+    Replaced the usage of setitimer()+recv() in net_peek() with a single call to select().
+
+commit 829e04ca231c443b7b1606e9bf5d9350fdfe84ea
+Author: Claudio Ciccani 
+Date:   Mon Oct 2 12:18:39 2006 +0000
+
+    Print only a debug message if palette could not be retrieved/restored.
+
+commit c3f2b4b997f41e6ecc76ecc355cbd61867dc19d6
+Author: Denis Oliver Kropp 
+Date:   Mon Oct 2 06:38:06 2006 +0000
+
+    Added option "primary-only" to tell applications only about the primary layer,
+    pretending there are no others.
+
+commit 7e8dd6149557eb8532bbf037d914b55ebd0505f8
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 1 09:23:53 2006 +0000
+
+    will
+
+commit abecc74013c02f5d4c7f2beb855aafb706388a07
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 1 07:13:19 2006 +0000
+
+    Complete last fix.
+
+commit 73d6d5fdcf3a6da56c7f0f2c0a0bb1003932a4c3
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 1 07:11:37 2006 +0000
+
+    Fix ARGB1555 color keyed blitting which dropped the alpha channel.
+
+commit c07792b19ccb7f34d45c75e9e3e36f6ebf8d69df
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 1 00:16:09 2006 +0000
+
+    Fixed missing fusion_world_set_fork_action() in single app build.
+
+commit 4e28d34acf7a2c2da117328350e11565f5dad915
+Author: Denis Oliver Kropp 
+Date:   Sun Oct 1 00:08:51 2006 +0000
+
+    Patch from Stefan Lucke that adds IDirectFBSurface::GetFramebufferOffset().
+
+commit e0c7700a5fe0fa279a5f0787dde8724e303fb270
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 23:36:31 2006 +0000
+
+    Added IDirectFBDisplayLayer::SwitchContext() that switches between the shared
+    and the exclusive context if present.
+
+commit 08c9f3ddf541cf41bcd0d979aec60d244fea10dd
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 23:27:54 2006 +0000
+
+    Patch from Daniel Laird to allow connectors to be selected at the encoders
+    without the need to define outputs. Additionally, slow blanking has been added.
+
+commit f2b1bb23e7148891e10a81cda7e85e3139e92f67
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 23:16:55 2006 +0000
+
+    Added IDirectFBFont::GetStringBreak() to break a text line by line.
+    
+    Thanks to sridewa  for the initial patch!
+
+commit f4bba0f41249b146adf0cc892971083882feb257
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 22:46:24 2006 +0000
+
+    Disable hardware cursor in VIA_REG_CURSOR_MODE.
+    
+    Thanks to Michel van Noorloos !
+
+commit fcd8ccf251bb42ecba4bb97b7e075572f067bdf9
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 21:17:43 2006 +0000
+
+    New 3M DynaPro Touchscreen driver, thanks to Pär Degerman !
+
+commit 45b09dd67452db159509d5d048dce0232014d007
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 21:16:08 2006 +0000
+
+    Recent vararg patch was missing some of the necessary changes.
+
+commit 569ad4481b1097247324c320a8f0bde4542fb424
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 20:16:14 2006 +0000
+
+    This patch fixes inconsistency in usage of variable arguments.
+    
+    
+    The function Construct is of type:
+    typedef DirectResult (*DirectInterfaceGenericConstructFunc)( void *interface,
+    .. );
+    
+    
+    One possible implementation of the function looks like this:
+    
+    static DFBResult
+    Construct( IDirectFBImageProvider *thiz,
+               IDirectFBDataBuffer    *buffer )
+
+commit f78f307aef017aa13a7fe6139c8f8001c67806f1
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 19:56:31 2006 +0000
+
+    Made "Parsing config file..." a debug message.
+
+commit da6484df4cde6564b887b25a4b6a2f84c0f26253
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 19:52:19 2006 +0000
+
+    a bit more chiefly
+
+commit c63049e0d47c0ae50549e47b485db96033201cd4
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 16:15:34 2006 +0000
+
+    Thanks to Stefan Lucke for fixing overlay destination color keying for
+    8/15/16 bit primary layer formats and adding a "i8xx_overlay_pipe_b" option!
+
+commit 4976dd3363743f6416295b8ea3aecb42d664a1d4
+Author: Denis Oliver Kropp 
+Date:   Sat Sep 30 16:08:16 2006 +0000
+
+    Rewrote one line interface descriptions.
+
+commit 752fe9cd5951dfa4103e82ce43bb0e6a64ff3ad9
+Author: Denis Oliver Kropp 
+Date:   Fri Sep 29 11:50:25 2006 +0000
+
+    Prepare for version 1.0.0-rc1!
+    
+    The overdone banner text is a placeholder :-)
+
+commit d19b26cbcc7c64c2d3e3ef35c96a5fc8127d2252
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 14:12:16 2006 +0000
+
+    Fix pure release build.
+
+commit 2bcb01589f2a037e9117c4d4e21c7fd73f12e9f0
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 13:50:39 2006 +0000
+
+    Fix warnings.
+
+commit 4d73cf58a459cb626334b682855208143f9f4e17
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 12:48:32 2006 +0000
+
+    Detach from shm pools when leaving in fusion_shm_deinit().
+    
+    This fixes mremap errors after reentering a world.
+
+commit 8b20b296996e9b75b4d8fdf3df7a7f56e63dabbd
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 01:16:07 2006 +0000
+
+    Hmm, seems the debug domain is required if DIRECT_BUILD_NETWORK is true.
+
+commit 7c1aa30cbd307be0c8ddd16831bb5dc0ec52db0e
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 01:11:13 2006 +0000
+
+    Fixed warning about unused debug domain by commenting it out.
+
+commit 589828e69ef3e438565a824489567f1fa5d61fc5
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 28 00:35:51 2006 +0000
+
+    Install internal headers.
+
+commit d103c23abfd5b8e03c339592e9a29cc73ffdf611
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 22:22:16 2006 +0000
+
+    Add stdbool.h to AC_CHECK_HEADERS.
+
+commit 7474324986816306b116be02da6171bc1aa4b748
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 22:20:37 2006 +0000
+
+    Include config.h if HAVE_CONFIG_H is defined and include stdbool.h if HAVE_STDBOOL_H is defined.
+    
+    If still no bool is declared after this, show a warning with instructions:
+    
+    "bool definition herein is not 100% compliant,
+     add AC_CHECK_HEADERS(stdbool.h) to your configure.in
+     or define HAVE_STDBOOL_H or NO_WARN_STDBOOL."
+
+commit f129bd488dce35169972bd087ce9af14206d0212
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 21:46:47 2006 +0000
+
+    No longer unref source after usage by Blit() & Co. This was a recent hotfix
+    which dragged down performance and is now reverted.
+    
+    Instead I added ReleaseSource():
+    
+    "Release possible reference to source surface.
+    
+     For performance reasons the last surface that has been used for Blit() and others stays
+     attached to the state of the destination surface to save the overhead of reprogramming
+     the same values each time.
+    
+     That leads to the last source being still around regardless of it being released
+     via its own interface. The worst case is generation of thumbnails using StretchBlit()
+     from a huge surface to a small one. The small thumbnail surface keeps the big one alive,
+     because no other blitting will be done to the small surface afterwards.
+    
+     To solve this, here's the method applications should use in such a case."
+
+commit b65a672a1f7c7dbf383342b43dfbb4a997fba441
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 21:11:39 2006 +0000
+
+    In addition to DIRECT_FORCE_DEBUG one can use DIRECT_ENABLE_DEBUG now.
+
+commit 0827bec7e8c2204d5eade78160fca072244ad383
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 21:09:15 2006 +0000
+
+    Only duplicate used portion of array in direct_trace_copy_buffer(), set limit from 256 to 200.
+
+commit 5d3038ca4179c3b3c61e0e92108cb722c8eb35fe
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 20:17:04 2006 +0000
+
+    Added global function pointer __DFB_CoreRegisterHook with __DFB_CoreRegisterHookCtx
+    to allow application level layer (and screen) implementations building on top of
+    existing layers.
+    
+    The callback happens during DirectFBCreate(), right after the driver's register
+    calls, the application can call dfb_screens_register() and dfb_layers_register(),
+    right before all registered implementations get activated.
+
+commit 15d1b138554de065f15d99915ab28e0df97f36d7
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 19:42:36 2006 +0000
+
+    Fix build when including header in C++ code.
+
+commit 5534352f92b46262262d62c259d9cd5e489757ee
+Author: Denis Oliver Kropp 
+Date:   Tue Sep 26 19:41:28 2006 +0000
+
+    Rework structure of wm_update_cursor() implementation, fixing a failing assertion.
+
+commit 31473a446d3f1214cff1baf5164116cf2d24503b
+Author: Claudio Ciccani 
+Date:   Tue Sep 26 10:28:35 2006 +0000
+
+    Fixed warnings about uninitialized variable.
+
+commit 4be72123e955acf5898c82fd78bf53a00f38f8d4
+Author: Claudio Ciccani 
+Date:   Mon Sep 25 12:40:14 2006 +0000
+
+    Faster response matching (use only sscanf()).
+
+commit 3b7000cfd50009c13a1935123bcdb23fb97ac65a
+Author: Claudio Ciccani 
+Date:   Sun Sep 24 19:46:56 2006 +0000
+
+    Fixed FTP response handling.
+
+commit 53ae0ec80c73a0dacb247205626d730e79c4bf55
+Author: Claudio Ciccani 
+Date:   Sun Sep 24 17:53:14 2006 +0000
+
+    Added:
+     - BSWAP16 and BSWAP32 macros
+     - direct_base64_encode (moved from Direct/Stream) and direct_base64_decode
+     - direct_md5_sum
+
+commit 5a748d95c9265d383f94712ff0d475605732724a
+Author: Claudio Ciccani 
+Date:   Sun Sep 24 17:51:13 2006 +0000
+
+    Added option --enable-netork to enable/disable building network protocols handlers.
+    
+    Reworked Direct/Stream to gain more efficiency.
+    
+    Added rtsp:// protocol support to Direct/Stream.
+    This implementation supports both Standard and RealMedia protocol.
+    It works by outputting either raw packets (e.g. audio/mpeg stream) or
+    a RMF (.rm) container stream.
+
+commit fd3a08be1eaffd0b0c78122b225ceb098d849f8c
+Author: Claudio Ciccani 
+Date:   Fri Sep 22 08:17:20 2006 +0000
+
+    In trim(): check if e > s.
+
+commit e7b3cd88bd86ff5c2770fcb78ec1822f32601753
+Author: Mike Emmel 
+Date:   Wed Sep 20 16:03:17 2006 +0000
+
+    Adding support for the 18bpp format family
+    these have 6 bits per pixel and use 3 bytes.
+    This format is used in  embedded platform lcd controllers.
+
+commit 4c759e6f2649f78c2d628b048b9a33f5924dba15
+Author: Claudio Ciccani 
+Date:   Mon Sep 18 17:42:14 2006 +0000
+
+    In trim(): clear to zero trailing spaces.
+
+commit dbb8aed829ee1e85d0c80f44c8f3f79755528ca6
+Author: Claudio Ciccani 
+Date:   Mon Sep 18 13:51:48 2006 +0000
+
+    unsv:// protocol support (acronymous for http://).
+
+commit 1a35f3d6c2e5075406a125959218466d9e550d4a
+Author: Claudio Ciccani 
+Date:   Mon Sep 18 10:16:14 2006 +0000
+
+    Treat http headers case-insensitive and accept any kind of spaces within them.
+
+commit 36fc07b13d69d589fea3950e09ecfa787ef2b5cf
+Author: Claudio Ciccani 
+Date:   Mon Sep 18 09:32:33 2006 +0000
+
+    Support Icecast protocol within http.
+
+commit 803832c6588dc7b28cc434a0005ffd7a1021d5dd
+Author: Claudio Ciccani 
+Date:   Sun Sep 17 13:08:14 2006 +0000
+
+    Added direct_stream_mime(): returns mime description of the stream.
+
+commit 1881c7fa64e27dcc9359d54eb93ab8e97163d903
+Author: Denis Oliver Kropp 
+Date:   Thu Sep 14 16:45:55 2006 +0000
+
+    Fix DrawLine() for horizontal and vertical lines in negative direction.
+
+commit 590157b49e3bb76fd49cdfb50a693727d877ff03
+Author: Ville Syrjala 
+Date:   Wed Sep 13 21:35:43 2006 +0000
+
+    Recalculate buffer offset when field blit mode changes.
+
+commit 8c1195fb29618bdf92047a01e5b3b80a2e491fc9
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 13 14:26:44 2006 +0000
+
+    Removed false assertions.
+
+commit 5d40076446d95bd07fa3a4f45d9e705fb8123e4f
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 18:57:13 2006 +0000
+
+    Fixed prototype.
+
+commit 2a9ee4f0a54c07d9d840fc8da0e6136418b17eb9
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 18:09:55 2006 +0000
+
+    Eliminate need for linking against libdirectfb.
+
+commit 40773ff57fc612c16be262df2a85443875661a6a
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 17:17:23 2006 +0000
+
+    Align pitch of system memory buffers to be a multiple of 8 instead 4.
+    
+    Add extra 16 bytes at the end of a buffer as a dummy area for optimized
+    routines, e.g. to avoid segfaults due to prefetching.
+
+commit cbe590f1452e64c2607ef302692a0f8f717e9b40
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 15:40:24 2006 +0000
+
+    Moved clipping from dfb_clip_stretchblit() to gStretchBlit() doing all
+    clipping, phase and offset calculations in place, well, handling the phase
+    of clipped stretching at all (initial .16 value for iteration) hasn't been
+    there before.
+    
+    Before that, clipping suffered from rounding and off-by-one errors due to
+    going back to integer in between.
+    
+    Accesses out of surface bounds and jumping images are gone. Jumping was
+    visible when the same image was stretched with the same source and
+    destination rectangle each time, but with randomly changing clip rectangles.
+
+commit d5ffae06a16ca4fb8dac83c94ad7208c86454f7c
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 15:04:56 2006 +0000
+
+    First shot at DFIFF - DirectFB Fast Image File Format
+    
+    Includes mkdfiff tool and a very simple and fast image provider.
+    
+    Loading of a 32x32 icon, for example, was about six times faster
+    than with the PNG loader.
+
+commit 2d628eeb77b84c10dc736b89fbd6d0983652dac7
+Author: Denis Oliver Kropp 
+Date:   Mon Sep 11 15:01:25 2006 +0000
+
+    New capabilities for setting destination size limit. If the rectangle is
+    too big, first try clip, then try again and eventually fall back to software.
+
+commit 820f76fed710224756a4aa070c327c825b08c937
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 6 19:08:17 2006 +0000
+
+    Just added some debug.
+
+commit 6781895cd4e31a5a1d076cf55f5fa75e5df50d99
+Author: Denis Oliver Kropp 
+Date:   Wed Sep 6 19:08:05 2006 +0000
+
+    Fixed problem with remaining layer context.
+
+commit 027c5d8a5dd0ddaecb353941ca109239294a0627
+Author: Denis Oliver Kropp 
+Date:   Sun Sep 3 14:29:18 2006 +0000
+
+    Speed up DrawString() by 7-10% (as seen so far) bypassing the hash table
+    for indices < 128, storing them in a fast array.
+
+commit 1ff295081aeed3488ef9a556775cc6bedbcee154
+Author: Denis Oliver Kropp 
+Date:   Sun Sep 3 12:11:58 2006 +0000
+
+    Return RS_REMOVE in test reaction.
+
+commit fab18c68d21b1c8a164957b22d9b148a62499e49
+Author: Denis Oliver Kropp 
+Date:   Sun Sep 3 12:11:26 2006 +0000
+
+    Added fusion_reactor_destroy() like fusion_reactor_free() but without
+    freeing the shared structure etc.
+    
+    No longer (need to) access the shared structure during local message
+    processing in the Fusion dispatcher.
+    
+    Other cleanups.
+
+commit 342a45e0e0db54869e31a0569372ac42c95ec8ab
+Author: Denis Oliver Kropp 
+Date:   Sun Sep 3 11:54:39 2006 +0000
+
+    Small test for problem with pending messages from destroyed reactors.
+
+commit bd892048bcc61267fa2a59831c21c98431cec355
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 26 11:50:04 2006 +0000
+
+    Patch adds fusion_skirmish_lock_count() to utilize the recently added ioctl.
+
+commit d9deb140c0946c0ed64bdb9e2c3656d3e0838f41
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 26 11:00:50 2006 +0000
+
+    Added diaeresis dead key combinations.
+    Cast all characters to unsigned ones.
+
+commit 137d1ec812fc7d1a2de7b254aea20be0d3905a23
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 26 10:39:29 2006 +0000
+
+    Mask out alpha bits properly using 0x7FFF in 15bit color keyed blit.
+    
+    Also avoid crossing 32bit boundaries with one access in 16bit color keyed blit.
+
+commit 34c9aaf5e1494cc9f9c18ada18ce3262d17d136c
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 26 09:34:18 2006 +0000
+
+    Added DFBResult return value to graphics driver's EngineSync() and WaitSerial()
+    to be able to return DFB_TIMEDOUT or other errors. In these cases the core resets
+    the accelerator via EngineReset() and takes care of state invalidation etc.
+    
+    dfb_gfxcard_sync() and dfb_gfxcard_waitserial() also lease the graphics property,
+    i.e. there are no more concurrent calls to the driver, e.g. FillRectangle() along
+    with EngineSync().
+
+commit 1b1c2fde21ffdc0005bcf9eb8d0399d7e5be3019
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 26 09:00:47 2006 +0000
+
+    Added some D_ASSERTs checking for properly clipped coordinates.
+
+commit 1e42184c518b0a711c26fbd773b0e0ca2175e0b7
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 19 22:30:20 2006 +0000
+
+    Removed call to dfb_gfxcard_sync() in dfb_fbdev_pan().
+    
+    The core takes care of that.
+
+commit df0a87c357997c35df2b6d07ba30cbba2a4e8439
+Author: Claudio Ciccani 
+Date:   Sat Aug 19 13:02:15 2006 +0000
+
+    Enable VC_32BIT_SWAP on big-endian machines.
+
+commit 3ad326aeaba5fa93e7f75ac3fce527f918382293
+Author: Claudio Ciccani 
+Date:   Sat Aug 19 13:01:04 2006 +0000
+
+    Use radeon_out32() to emit vertices.
+
+commit 0e1b344147c0cae81a38902a2435a803b90a9551
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 14 23:04:52 2006 +0000
+
+    In case of no hardware clipping but rectangle filling, if in DrawRectangle()
+    the whole rectangle outline was outside the clipping area, the clipping area
+    was drawn in the software fallback code.
+
+commit f59f89a64adf427d30cc247a211e58c5dd803d80
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 14 09:19:32 2006 +0000
+
+    Implemented experimental fork() handling in Fusion.
+    
+    Added FusionForkAction being FFA_CLOSE by default, which can be changed to
+    FFA_FORK with a call to fusion_world_set_fork_action() for each Fusionee/World.
+    
+    Added test program "fusion_fork" to demonstrate and test the new feature.
+
+commit ce1bd1db0ed2b6caf294da52575054d335753ad2
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 14 09:05:53 2006 +0000
+
+    Fixed warning.
+
+commit fc4be0f1dadbd02495b86f7cc3e17ae9b72b7b55
+Author: Denis Oliver Kropp 
+Date:   Tue Aug 8 18:37:24 2006 +0000
+
+    In dfb_surfacemanager_deallocate() make sure no hardware read or write
+    access on the buffer is pending before freeing the chunk :-P
+
+commit afe93525dd2c03adbb96cf253c5a773237610930
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 7 11:39:50 2006 +0000
+
+    Added DIEF_FOLLOW to DFBInputEventFlags which indicates that another event
+    will follow immediately.
+    
+    In the mouse driver this is used to "link" the x/y axis motion events.
+    
+    The window manager no longer sends two motion events (x/0, 0/y) for
+    one x/y mouse movement (x and y axis at once)!
+    
+    Zig-zag cursor/window movement and double event/update rate are gone :)
+
+commit d9a11536a82666b67c2873a17f67feaf629f4391
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 7 08:55:26 2006 +0000
+
+    Clean up error handling in system_initialize() and fix bug with shared
+    memory (de)allocation.
+
+commit 4c2ad20ec72d985c98fb224a276b39b6ed7b0bc0
+Author: Denis Oliver Kropp 
+Date:   Mon Aug 7 08:52:26 2006 +0000
+
+    Finally decided to catch horizontal/vertical lines in
+    DrawLine() and optimize them using rectangle filling.
+
+commit 1441f1e2e890e52453a9f534237f548e42275dd5
+Author: Claudio Ciccani 
+Date:   Sat Aug 5 13:41:55 2006 +0000
+
+    Check for PTHREAD_MUTEX_RECURSIVE declaration.
+
+commit 63b8dc4f3dc25e229187ba4f8adb7d65213bca66
+Author: Denis Oliver Kropp 
+Date:   Sat Aug 5 10:43:51 2006 +0000
+
+    Fixed root cause for negative coordinates.
+    
+    Thought I committed that a few days ago...
+
+commit f0053bacf7d8b6685b21903f86c6f61af511084c
+Author: Claudio Ciccani 
+Date:   Sat Aug 5 10:37:48 2006 +0000
+
+    Made 'key' argument of IDirectFBWindow::*Property() constant.
+    
+    Cosmetics.
+
+commit 32fc98f444b442d802e4777e62f8b0cfb9dd787c
+Author: Claudio Ciccani 
+Date:   Sat Aug 5 10:00:12 2006 +0000
+
+    Workaround for (default) window manager passing negative rectangle to dfb_gfxcard_blit().
+
+commit e80c9279635ed1dd16241201e28fc19c97fe6195
+Author: Mike Emmel 
+Date:   Sat Aug 5 01:59:11 2006 +0000
+
+    /tmp/cvsIa7FG7
+
+commit d239530a079a266a55ab22057f4dc70e153c5fd9
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 4 21:05:09 2006 +0000
+
+    Check if window is destroyed and return DFB_DESTROYED in all functions
+    which would have called the WM, because a destroyed window is no longer
+    known to the WM and the WM's window data structure is deallocated.
+
+commit 4b7976bb244fae7eaaca7e5236219bfdd42a2f46
+Author: Denis Oliver Kropp 
+Date:   Fri Aug 4 16:29:19 2006 +0000
+
+    Added "name" parameter to fusion_ref_init() like others already have.
+    
+    Gives nice debugging in /proc/fusion/../refs now :)
+
+commit f23da51a0c291e976d524e6cbd98c81e0c5e849d
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 17:57:56 2006 +0000
+
+    Unref attached window on destroy event.
+
+commit 70e3596f5ab2d22f146d1c6e0d4a0fbc83cad888
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 17:20:00 2006 +0000
+
+    This is my latest development version of the radeon driver.
+    Main changes affect the R300, which now supports FillTriangles() and DSDRAW_BLEND.
+
+commit 40da4bef4cdb8a674d2b3be8945f83229780e1f9
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 17:03:49 2006 +0000
+
+    No longer unref the window in IDirectFBWindow_React().
+
+commit 097955a4b08aa174145e48aae46eed57db8da9aa
+Author: Denis Oliver Kropp 
+Date:   Thu Aug 3 16:49:07 2006 +0000
+
+    Return DFB_LOCKED in fusion_ref_up() if EAGAIN is received (ref is zero locked).
+    
+    Added D_UNIMPLEMENTED() message to single app version of fusion_ref_inherit().
+
+commit f45a2fdfc2194c59a10cef47085ce528ba8477b4
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 13:48:23 2006 +0000
+
+    Debug already destroyed windows in dfb_window_destroy().
+
+commit 6b8aa0d5240f2af69ff4d71751ee137e5ddad8b2
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 13:46:45 2006 +0000
+
+    Undone last change: do not destroy the window, but always unref it (to destroy the fusion object).
+
+commit d60d9cabb5c6f9c0cf0904831a45e2386aab37ea
+Author: Claudio Ciccani 
+Date:   Thu Aug 3 13:14:40 2006 +0000
+
+    IDirectFBEventBuffer references attached windows and IDirectFBWindow always
+    destroyes the window on release: this way releasing the event buffer before
+    the window no longer causes an assertion failure.
+
+commit 98ac58d1e6621c9bf4928637ed46a5e6e7bd3d93
+Author: Claudio Ciccani 
+Date:   Wed Aug 2 09:52:47 2006 +0000
+
+    Implemented Bop_4_to_Aop and Sacc_to_Aop_a4.
+
+commit 23fd8a929012e8d0827efafaa26c4f82f766b2cd
+Author: Claudio Ciccani 
+Date:   Wed Aug 2 09:51:00 2006 +0000
+
+    DSPF_A8 and DSPF_RGB332 were writing (dx+len) pixels instead of (len).
+
+commit fe3288451d6e3fe70c94233cabd6d01caf7c07f1
+Author: Claudio Ciccani 
+Date:   Tue Aug 1 13:46:39 2006 +0000
+
+    Enable using recursive mutexes when PTHREAD_MUTEX_RECURSIVE || __USE_UNIX98 are defined.
+
+commit 5e14aa5189b2be1ce47a6a6391ee343280323cca
+Author: Claudio Ciccani 
+Date:   Tue Aug 1 09:35:07 2006 +0000
+
+    Fixed compilation failure with gcc-2.95.
+
+commit f52a9b083cbbb60870e8b415802e3082c86800dd
+Author: Claudio Ciccani 
+Date:   Mon Jul 31 16:39:41 2006 +0000
+
+    Handle NULL subsurface's rectangle.
+
+commit 0a15bc4dab135cd06871adb799838042c1b3f65d
+Author: Claudio Ciccani 
+Date:   Mon Jul 31 11:12:41 2006 +0000
+
+    Remember if a subsurface was created with a NULL rectangle, in this case
+    treat it as normal surface in case of parent resizement.
+    This is actually a workaround, because it won't work in the following situation:
+      surface->GetSubSurface( rect, &surface1 );
+      surface1->GetSubSurface( NULL, &surface2 );
+      // surface2 won't fit surface1 on resizement
+    
+    
+    Fixed window manager's isets stuff:
+      IDirectFBSurface_Construct() takes a DFBInsets argument
+      that will be used to compute the clipping rectangle for the current area.
+
+commit fb3523ead498371e93718b6b7550220496fe092f
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 31 10:59:38 2006 +0000
+
+    If a channel has no bits, don't care about their position :)
+
+commit d18117e7adb52a172af3f382a9489b8e1b6d51f5
+Author: Claudio Ciccani 
+Date:   Mon Jul 31 10:58:28 2006 +0000
+
+    Added dfb_rectangle_subtract(): subtract insets to rectangle.
+
+commit a697f328d93845c37642ab0ae55b6482c7802429
+Author: Claudio Ciccani 
+Date:   Sat Jul 29 10:27:34 2006 +0000
+
+    Allocate the accumulator only if it will be used.
+
+commit ee57c56d78e6ff64c6648039183e723933f67847
+Author: Denis Oliver Kropp 
+Date:   Thu Jul 27 22:07:04 2006 +0000
+
+    Make sure pool is mapped properly before actually doing the malloc/realloc/free.
+    
+    Now the lock order "shm shared lock -> shm pool lock" should not be violated,
+    because _fusion_shmalloc_cure() should not be called in a malloc/realloc/free
+    context anymore.
+
+commit ce3e45a6b8db169432f933bf2e545796ed11ce84
+Author: Denis Oliver Kropp 
+Date:   Thu Jul 27 21:04:33 2006 +0000
+
+    Fix deadlock caused by lock twists.
+
+commit 67e04b3abad99a5d8d11237505b544eebadcad66
+Author: Mark Adams 
+Date:   Thu Jul 27 15:36:18 2006 +0000
+
+    Added PCI ID for CN700.
+
+commit afa584564ab4296cd1b4f7d03c71c90c465a0c90
+Author: Claudio Ciccani 
+Date:   Thu Jul 27 13:00:48 2006 +0000
+
+    Removed (erroneously set) flag VF_RADEON_MODE in r200DoDrawRectangle3D().
+
+commit 3dbb6d54df8dc23f11a69c276292e7fb2240bc78
+Author: Mark Adams 
+Date:   Wed Jul 26 16:45:35 2006 +0000
+
+    Now saves PCI ID for use elsewhere (comments said it did before but it
+    didn't).
+
+commit 84497be99cdfb491a9c26c61bde5b0df531cbf46
+Author: Claudio Ciccani 
+Date:   Mon Jul 24 10:43:47 2006 +0000
+
+    Print device name all uppercase.
+
+commit 46d0cc6874b598cf77df8dc177fbec4819a94054
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 16:49:35 2006 +0000
+
+    Due to increasing amount of debug messages the default is "no-debug" now.
+    
+    It makes more sense to only enable wanted debug domains by hand, e.g. "debug=core/font".
+    
+    Otherwise, "debug" option still works, too.
+
+commit 73556cd75075ce3c4e9555f126fbb7e72cbd9be5
+Author: Claudio Ciccani 
+Date:   Sun Jul 23 14:10:38 2006 +0000
+
+    Store delayTime in microsecs and use gettimeofday() instead of ftime().
+
+commit 2689ae02df370edf2fddf18a802c775fff73ed64
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 13:54:01 2006 +0000
+
+    Include  only if present.
+
+commit 406a3ad580bdf166726fc1845b3550d42b95bdbe
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 13:51:08 2006 +0000
+
+    Fixed warning about unused debug domain by commenting it out.
+
+commit ff5d776bf66d2bedffb38d5e762220e652a79844
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 13:11:08 2006 +0000
+
+    Plug brand new leakage of glyph data.
+
+commit 42ba63c0efeb91ab13923e41484fda863677ed9f
+Author: Claudio Ciccani 
+Date:   Sun Jul 23 12:46:42 2006 +0000
+
+    Moved DirectFBGL header to the proper location.
+    
+    We need the header here since the DirectFBGL interface is strongly
+    integrated within DirectFB and we want to support external implementations.
+
+commit f09a398ba83aff7141df6851cebce4288756c534
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 12:46:21 2006 +0000
+
+    Line length is 120 :)
+
+commit 24adf00bb9d8037bffa34f4c213aa625752c0d4f
+Author: Claudio Ciccani 
+Date:   Sun Jul 23 12:24:45 2006 +0000
+
+    First attempt to give some hints on the coding style.
+
+commit 1ea4ceae0c1923cfb3832f2619389dd25424c7cd
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 11:38:59 2006 +0000
+
+    Increased core ABI after recent changes in FusionObject.
+
+commit 3175121fdc1b9ebeba9151f76815887fe3714f17
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 23 11:01:06 2006 +0000
+
+    Finalized code, not only cosmetics, fixed const/non-const, missing return
+    values, suggested braces, assertions, complete error handling etc...
+
+commit a647aec39a924cee7e7805e1118fa82df98ccb54
+Author: Mike Emmel 
+Date:   Sat Jul 22 20:24:28 2006 +0000
+
+    New fusion hash and property support for object
+
+commit 095175591a5ed516d60e9dd6a46e08613a5622e7
+Author: Denis Oliver Kropp 
+Date:   Sat Jul 22 18:46:29 2006 +0000
+
+    Implemented font cache limit, currently hardcoded to five rows, each row
+    stores a number of glyphs.
+    
+    When the maximum number is reached it will reuse the least recently used
+    row, kicking out glyphs that have been on it.
+    
+    Doing that on a glyph basis would require some more work and has a greater overhead.
+
+commit f46dce7c4f05e7415f7b4bbfa9806da1ecada242
+Author: Claudio Ciccani 
+Date:   Sat Jul 22 15:07:53 2006 +0000
+
+    Added patch to radeonfb fixing support for R300 chipsets (it also adds new devices).
+
+commit a922650a4ffc47ea5fba1369d798150c842818b6
+Author: Denis Oliver Kropp 
+Date:   Sat Jul 22 14:46:59 2006 +0000
+
+    Fixed warnings.
+
+commit 85e6caefe8c595a16dccd2e1d3e380945596cf7b
+Author: Denis Oliver Kropp 
+Date:   Sat Jul 22 11:19:09 2006 +0000
+
+    Simply use a hash for glyph infos instead of a tree with an array for
+    the first 127 keys (fast indices)...
+
+commit 46b6f75bb024019d95c76d0146dd6e10c609af51
+Author: Claudio Ciccani 
+Date:   Fri Jul 21 20:50:23 2006 +0000
+
+    Avoid writing to R300_TX_OFFSET_1, radeonfb must be patched before doing it.
+
+commit b9d8aa6313893e0738b9694fbc5a6bc235b9450c
+Author: Claudio Ciccani 
+Date:   Fri Jul 21 20:13:44 2006 +0000
+
+    Use different settings for R300 and non-R300 when setting MC_FB_LOCATION.
+
+commit cea99f8a346ff1ba379cd5a9626b658577da28b3
+Author: Claudio Ciccani 
+Date:   Fri Jul 21 18:09:52 2006 +0000
+
+    Need to set MC_FB_LOCATION at offset 0 to avoid crash with R300s.
+
+commit 452c3817945dc530079e25137eb1b2db3f3b1135
+Author: Claudio Ciccani 
+Date:   Thu Jul 20 13:19:46 2006 +0000
+
+    Replaced direct_stream_fopen() by direct_stream_fileno().
+    Added direct_stream_dup() (increase stream's reference counter).
+
+commit c13d5cea603f305f0e76300dff857d14cff44d29
+Author: Claudio Ciccani 
+Date:   Thu Jul 20 13:17:13 2006 +0000
+
+    Dropped support for GIF87 (can't be animated).
+
+commit 077f1ae89cf73f2171774b2469805c8c932514da
+Author: Claudio Ciccani 
+Date:   Wed Jul 19 12:28:40 2006 +0000
+
+    Notify speed change to video thread.
+
+commit e85c861bda261c169e5d2ffcd68c637a57d55c60
+Author: Claudio Ciccani 
+Date:   Wed Jul 19 10:10:32 2006 +0000
+
+    Added Animated GIF video provider.
+    (I put it here, instead of DirectFB-extra, because it may be usefull for animated cursors).
+
+commit 9cc7558c5b6484a107fc231a7e5879927aa96905
+Author: Denis Oliver Kropp 
+Date:   Wed Jul 19 01:48:11 2006 +0000
+
+    Local 'local reactions' are no longer processed
+    before dispatching further via the kernel device.
+    
+    This causes all local reactions within each Fusionee to
+    be called by the Fusion Dispatcher only, in chronological order.
+    
+    It's a fundamental change in runtime behaviour which might break
+    some code that relies on the synchronous execution of some of the
+    local reactions, the dispatcher's own.
+
+commit e69ef63383b5f6d8536d568b23c5f4d15519a264
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 18 17:05:08 2006 +0000
+
+    Show which surfaces are preallocated.
+
+commit 5cd415372b356750e72ab4d1c130dad622e9c07b
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 18 01:07:13 2006 +0000
+
+    Before every graphics operation, i.e. in dfb_gfxcard_state_check(),
+    clip the state's clipping region to the destination surface dimension.
+    
+    In debug mode too big clipping regions will still show a failing D_ASSUME,
+    while other errors like x1 > x2 or x < 0 will break with a failing D_ASSERT.
+
+commit 52b0a995a642e3e5f14732f2fcc2e1e0773340e1
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 17 23:13:29 2006 +0000
+
+    Fix warning in non-debug build by putting an '#if D_DEBUG_ENABLED' around
+    the static const table of strings used only in the debug message further below.
+
+commit 524f9a21099d0037d4e28fa427d0feea63501d63
+Author: Claudio Ciccani 
+Date:   Mon Jul 17 13:12:21 2006 +0000
+
+    Removed return value from DVFrameCallback.
+
+commit 7ddb76e6dd224a85005d4ef6a6642ae4d9cf9196
+Author: Claudio Ciccani 
+Date:   Mon Jul 17 13:10:45 2006 +0000
+
+    Declare PCI regs locally (avoid inclusion of ).
+
+commit ac91f7c11b55222bcbf3a2f72eb5281dd1d59c61
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 16 21:06:50 2006 +0000
+
+    Added option --rgbformat which in contrast to the --format option
+    only is effective if the image doesn't require an alpha channel.
+    
+    That's useful e.g. with RGB16 for opaque and ARGB for blended images,
+    when the primary format will be RGB16.
+    
+    So far directfb-csource either used ARGB/RGB32 automatically,
+    or it always used RGB16 or whatever you specified via --format.
+
+commit 10c3e898329f470e7c35e05783bab5f335514c3b
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 16 10:15:29 2006 +0000
+
+    Rewritten cursor handling (software cursor) to use a surface instead of a window.
+    
+    The window manager module gets notified about all kinds of updates regarding the cursor.
+    
+    All window manager modules use the same code for now, using backing store for the region under
+    the cursor. This avoids revealing window content that hasn't been commited via Flip(), yet.
+    
+    It should also be faster as it no longer depends on the windows that are covered by the cursor.
+
+commit 1d3e3e027e01b77c61e51e5a320202225e04cc69
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 16 10:15:00 2006 +0000
+
+    Added some assertions to dfb_gfxcard_blit()
+    checking for a properly clipped source rectangle.
+
+commit 8a99e6e2825b17c27214ff9d87f1b226b1818509
+Author: Ben Combee 
+Date:   Sun Jul 16 08:29:43 2006 +0000
+
+    Add DFB_RECTANGLE_CONTAINS_POINT and DFB_REGION_CONTAINS_POINT macros to directfb_util.h
+
+commit d41c702d3967f667a78b69918bb3abe589405f22
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 16 08:28:35 2006 +0000
+
+    Added dfb_gfx_copy_to() as an extension of dfb_gfx_copy().
+    
+    The advantages are
+    - destination offset can be different from source offset
+    - blitting from the back buffer is available
+    
+    The latter was a must for the backing store based software cursor.
+
+commit 8f90d901bef3bb9976a86db4cf2dd109448f1ca2
+Author: Denis Oliver Kropp 
+Date:   Sun Jul 16 08:25:47 2006 +0000
+
+    Show base address of each file to allow offset calculation 'by hand' within
+    dynamically loaded modules, i.e. where ldd doesn't help.
+
+commit 27527bfaa451fe99444e11ad62915790f9f94a2c
+Author: Claudio Ciccani 
+Date:   Thu Jul 13 12:56:16 2006 +0000
+
+    Handle driver's functions return value.
+
+commit 6cbfd93bed9ced28a17c380eae4836e2913a3412
+Author: Claudio Ciccani 
+Date:   Thu Jul 13 10:59:49 2006 +0000
+
+    Ignore callback result when rendering buffered image data.
+
+commit ab1e80eaa80ebe6f8feec30dd02cba262a25c420
+Author: Claudio Ciccani 
+Date:   Wed Jul 12 16:37:31 2006 +0000
+
+    Follow changes.
+    
+    Added support for streaming databuffers.
+
+commit 01e59378c3a712a3336d44684f8d9fc487e080f4
+Author: Claudio Ciccani 
+Date:   Wed Jul 12 16:36:52 2006 +0000
+
+    Follow changes.
+
+commit ccd66054ff53b59bfadcd6f00c53bed4715931fa
+Author: Claudio Ciccani 
+Date:   Wed Jul 12 16:35:57 2006 +0000
+
+    dfb_scale_linear_32() and dfb_copy_buffer_32() take a DFBRegion argument
+    specifing the destination clipping region (passing a NULL region means that
+    destination rectangle was already clipped).
+    
+    This change allow to render images on a portion of the surface preserving
+    the original scale factor.
+
+commit c11392025a92412d2510c32a6cf4c4243f9f0866
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 10 22:39:57 2006 +0000
+
+    After resizing the hash free old array.
+
+commit b7f248610db8264cfdc3650737d8958c5e2d23f4
+Author: Claudio Ciccani 
+Date:   Mon Jul 10 09:38:11 2006 +0000
+
+    Put AGP aperture start location after frambuffer memory location.
+
+commit 1d9c363691a204b164e85982d305d74f20f2f4c4
+Author: Ville Syrjala 
+Date:   Mon Jul 10 08:46:22 2006 +0000
+
+    Use CONFIG_APER_* to set MC_FB_LOCATION. Otherwise my M6 will hang when
+    using the overlay.
+
+commit 2178fb52619977f82aa360400e02c8bc7270530a
+Author: Claudio Ciccani 
+Date:   Sun Jul 9 15:40:16 2006 +0000
+
+    DVPLAY_NORMAL renamed DVPLAY_NOFX.
+
+commit 034b697ffda0627f4cfcf61ef3877071ad3338a2
+Author: Ville Syrjala 
+Date:   Sat Jul 8 19:47:48 2006 +0000
+
+    Fixed planar data copy. Added more pixelformat for v4l2.
+
+commit 74d1ca9bcfb57703fbf0ed718abb36c55346439b
+Author: Ville Syrjala 
+Date:   Sat Jul 8 19:31:45 2006 +0000
+
+    Removed some useless code and made wait_for_buffer() static.
+
+commit 4e4518f49d440e2f2969f88877184aa7fbc3553a
+Author: Ville Syrjala 
+Date:   Sat Jul 8 16:12:22 2006 +0000
+
+    Reduced ifdef clutter.
+
+commit 5f5a5ed7108fadcbd36ebbb1150418abe6a4e23d
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 4 09:23:06 2006 +0000
+
+    Moved modification of caps depending on policy into static inline helper
+    function dfb_surface_caps_apply_policy(policy, &caps).
+
+commit 7435837e15f1a86658a49b40c39b01ee7ae09bbc
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 4 09:21:37 2006 +0000
+
+    Removed another warning.
+
+commit b6ded019dda2a19996a88d2c3c640dc6afb3f223
+Author: Denis Oliver Kropp 
+Date:   Tue Jul 4 09:11:44 2006 +0000
+
+    Fixed failing assumptions due to late initialization of dfb_sdl_core after
+    call to dfb_fbdev_read_modes() used for faking video modes, added recently.
+
+commit 77abe4afdb0aa456f33c50c912b62a9bcb9c58e0
+Author: Denis Oliver Kropp 
+Date:   Mon Jul 3 16:40:40 2006 +0000
+
+    Fixed warnings.
+
+commit 9da576fcedb3294a9f5779deaf211f46f2598ae8
+Author: Ben Combee 
+Date:   Sun Jul 2 20:43:18 2006 +0000
+
+    libdirect - fix memory leak that occured when creating a stream failed
+
+commit 3f5e907d23e9977999e6a013656ec7ca9135d5a7
+Author: Denis Oliver Kropp 
+Date:   Thu Jun 29 16:55:38 2006 +0000
+
+    Link libdirect into fx for debug.
+
+commit 8ae52fa3aeb060410de61500139c8faad1c61083
+Author: Claudio Ciccani 
+Date:   Thu Jun 29 10:22:52 2006 +0000
+
+    Dropped down YUV->RGB on the RV250.
+
+commit 9eee9af41559b3645d4953b7b876a4ac5c8f495d
+Author: Claudio Ciccani 
+Date:   Thu Jun 29 09:55:51 2006 +0000
+
+    Get the device id from the PCI config space.
+
+commit 827e539061bb87b926f66908fea3fdaa57f6d840
+Author: Claudio Ciccani 
+Date:   Wed Jun 28 17:13:56 2006 +0000
+
+    Avoid to set the overlay memory limit, it's already done by the kernel.
+
+commit d7d018ac8c1d76281fa94f8f273ba9941c373b25
+Author: Claudio Ciccani 
+Date:   Wed Jun 28 17:12:58 2006 +0000
+
+    Basic acceleration for ALUT44.
+    Check for source and destination's palette equality.
+
+commit 32699b0c8c5cdf40f4658e43173c7dec6cacbeea
+Author: Ben Combee 
+Date:   Wed Jun 28 16:46:54 2006 +0000
+
+    Change another set of declarations to prototypes to avoid use-time warnings, this time in DFB's core
+
+commit 59ea034507fa4bf4b59be66a87353d3777d1c405
+Author: Denis Oliver Kropp 
+Date:   Wed Jun 28 15:58:12 2006 +0000
+
+    Use DFBSurfaceLockFlags instead of unsigned int flags in prototype of locking functions.
+    
+    Thanks to Nils Magnus Larsgard !
+
+commit 521b092a58b42333ffd0b54b14cb382f0e0272a8
+Author: Denis Oliver Kropp 
+Date:   Wed Jun 28 15:53:59 2006 +0000
+
+    Very basic program to emulate/illustrate the pixel pipeline, blitting flags etc.
+    No 100% guarantee that itself is correct, but in the end it will serve as a
+    verification for software/hardware driver.
+
+commit 16bbc2a20be137f39891e849b41f67f2bbccc1b4
+Author: Denis Oliver Kropp 
+Date:   Wed Jun 28 15:50:32 2006 +0000
+
+    Just a rough diagram (overview) I made a while back.
+    
+    While it lacks some explanations, it's a good help reading the code.
+
+commit 57cb1d5d04c95f76b878395141bd1b16c0aaa414
+Author: Ben Combee 
+Date:   Wed Jun 28 08:29:41 2006 +0000
+
+    Turn void function declarations into true prototypes in libdirect
+
+commit d94635495570ce9ef975dc4f3f876f61bb1d1d6b
+Author: Ville Syrjala 
+Date:   Tue Jun 27 21:16:26 2006 +0000
+
+    Applied a patch from Marko Mäkelä  fixing build
+    problems with gcc (GCC) 4.1.2 20060613 (prerelease) (Debian 4.1.1-5).
+
+commit d0cdeced1f24a031a7837cd365706421791f0309
+Author: Claudio Ciccani 
+Date:   Sun Jun 25 13:53:09 2006 +0000
+
+    Fail if a blitting function between surfaces with different palettes is requested.
+
+commit 02d5d94561490e4c81d4ad6c82241b9d3187d94c
+Author: Claudio Ciccani 
+Date:   Sun Jun 25 13:50:45 2006 +0000
+
+    Check if palettes are equal when blitting indexed formats.
+
+commit 3c98e7c650ced57002a39e97858f3f2f4a773dfc
+Author: Claudio Ciccani 
+Date:   Sun Jun 25 13:49:00 2006 +0000
+
+    Added dfb_palette_equal(): check if two palettes are equal.
+
+commit 2ecc8ab0ba278b27ce45961fbc50eb0153ef2f9c
+Author: Denis Oliver Kropp 
+Date:   Sat Jun 24 14:08:01 2006 +0000
+
+    Made predefined palette entries in DFBSurfaceDescription const.
+
+commit 472251c4955b2b5bde4c388306f5308f94e109a0
+Author: Claudio Ciccani 
+Date:   Sat Jun 24 12:50:02 2006 +0000
+
+    Added IDirectFBVideoProvider::GetVolume() (for completeness).
+
+commit 79e81a14355c6cead7c82ee56e05183976e8da14
+Author: Claudio Ciccani 
+Date:   Sat Jun 24 10:14:14 2006 +0000
+
+    Added dfb_screens_at_translated() and dfb_screen_id_translated().
+    Set the primary screen according to the primary layer.
+
+commit 8edf62d2036ce4fea290f2b9e7838ed8f7b27bec
+Author: Claudio Ciccani 
+Date:   Sat Jun 24 10:10:38 2006 +0000
+
+    Added IDirectFBVideoProvider::SetVolume().
+
+commit afec34d3acfbcf78204dbe1e3d41cf81bb3349e5
+Author: Claudio Ciccani 
+Date:   Fri Jun 23 17:59:03 2006 +0000
+
+    Added IDirectFBVideoProvider::SetPlaybackFlags(),
+          IDirectFBVideoProvider::SetSpeed(),
+          IDirectFBVideoProvider::GetSpeed() (preplace trick mode methods).
+    
+    Added IDirectFBScreen::GetSize(): fast way to detect screen size
+    without the need of scanning layers in search of the underlay
+    (usefull when working with overlays).
+
+commit 435956a0f1c89b882d76d8ee41136d32805b4b98
+Author: Claudio Ciccani 
+Date:   Fri Jun 23 06:01:37 2006 +0000
+
+    More Porter/Duff rules (SRC_ATOP,DST_ATOP,ADD,XOR).
+
+commit e51000bc963406518d1132834e3f0ae05db5d17d
+Author: Ville Syrjala 
+Date:   Thu Jun 22 19:44:55 2006 +0000
+
+    Increased bytepitch alignment to match field blitting requirements.
+
+commit c9347d3778cf38bdaf1afd18c7420191849f5aa1
+Author: Claudio Ciccani 
+Date:   Thu Jun 22 12:31:35 2006 +0000
+
+    Replaced tabs by spaces.
+
+commit 3f9801f4f6df0256caa9ab3a3ae28032249ea41b
+Author: Claudio Ciccani 
+Date:   Thu Jun 22 12:30:39 2006 +0000
+
+    When enabling DLOP_ALPHACHANNEL on the underlay, do not fail if the overlay
+    level is still set to 1.
+
+commit 0b0b9f37b5f5641ba2ba515d9530412443c6d601
+Author: Ville Syrjala 
+Date:   Thu Jun 22 00:36:11 2006 +0000
+
+    Field based blitting.
+
+commit cb767ad5712b10192ec421a0322e796202e7f3dd
+Author: Ville Syrjala 
+Date:   Thu Jun 22 00:04:23 2006 +0000
+
+    Added DSCAPS_SEPARATED support to BES, CRTC2 and SPIC.
+
+commit b8cf8d2a18c084121f3e18ad7640200339f24784
+Author: Ville Syrjala 
+Date:   Thu Jun 22 00:02:05 2006 +0000
+
+    Fixed pixelpitch alignment for YUY2/UYVY.
+
+commit 32723da73f98a9114389d5f4fa3ae6961597f2fb
+Author: Claudio Ciccani 
+Date:   Wed Jun 21 09:20:59 2006 +0000
+
+    Treat fbdev format 8/16,8/8,8/0,0/0 as ARGB when ARGB was requested
+    (that because framebuffer drivers generally ignore the alpha channel).
+
+commit d239aec02d7d00dea64cbbe47c20f9d852652b62
+Author: Ville Syrjala 
+Date:   Tue Jun 20 19:34:51 2006 +0000
+
+    PAL-60 support (or at least close enough for my TV).
+
+commit d4ed9134426b8a23ea098eb36a5b8e5e65581c60
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 20 12:10:21 2006 +0000
+
+    Populating screen API a bit more, thanks to Daniel Laird !
+
+commit f71d0dcd9c5eb88eb36a903b8479987c8ac039e0
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 20 12:08:21 2006 +0000
+
+    Trick modes thanks to Daniel Laird !
+
+commit d888005e053ee8b7225cc0e1139fffb38fab572c
+Author: Claudio Ciccani 
+Date:   Tue Jun 20 10:11:58 2006 +0000
+
+    Added the possibility to use the underlay as an OSD.
+    It works exactly the same way as in the unichrome driver:
+     - Set the overlay level to -1;
+     - Enable DLOP_ALPHACHANNEL on the underlay.
+
+commit 95f01e68149593bf2ecfb6f32d2f6e36ccf24a29
+Author: Ville Syrjala 
+Date:   Sun Jun 18 19:52:46 2006 +0000
+
+    Cosmetics.
+
+commit 9f3a968772b0679336908839619bdd1b86baac1d
+Author: Ville Syrjala 
+Date:   Sun Jun 18 19:52:19 2006 +0000
+
+    Removed unnecessary headers and libs.
+
+commit 9b52d2b4f9f07dac7243de54545f3c67eeed099a
+Author: Ville Syrjala 
+Date:   Sat Jun 17 16:21:24 2006 +0000
+
+    Silenced some compiler warnings.
+
+commit 7cdcda360372afe14227794900630e159ac62583
+Author: Denis Oliver Kropp 
+Date:   Thu Jun 15 18:59:17 2006 +0000
+
+    Fixed prototypes.
+
+commit f4153d9c676a31ec6c31954cbcfe6016bb17ee48
+Author: Mike Emmel 
+Date:   Wed Jun 14 18:52:55 2006 +0000
+
+    Added the StartDesktop hook to run a advanced complex wm
+    Note I made a change to unique it was not handing out the window for the cursor
+    this broke code that thought with a valid id it would get a window
+    it sets it to null and returns DFB_OK
+    Denis you make want to check this but we don't want to return DFB_OK I think if
+    we set the window to null
+
+commit d96b3e16aba1b882bf5e4b4193728b7f38443959
+Author: Denis Oliver Kropp 
+Date:   Wed Jun 14 07:06:03 2006 +0000
+
+    Some changes that decrease system memory usage for surface buffers,
+    especially where graphics memory is available.
+    
+    
+    Allocate system instance of auto-video buffers on first access,
+    not immediately during creation of the surface.
+    
+    Deallocate system memory when buffer is written to in video memory.
+    Reallocate it if the buffer is kicked out of video memory.
+    
+    Implemented "suspended" surface buffers, temporarily deallocated.
+    No valid instance at all until it's resumed.
+    
+    Added dfb_surface_buffer_suspend/resume().
+    Added SBF_SUSPENDED.
+    
+    Cleaned up some surface manager and surface locking functions.
+
+commit 929f70068fb2cf45af8cc395ec593f848e90ae99
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 13 14:13:17 2006 +0000
+
+    Added DFB_SUSPENDED error meaning "The requested object is suspended!".
+
+commit fd15a66f7da9452d396a93650433d5cf8860b298
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 13 14:11:02 2006 +0000
+
+    Fixed dfb_window_create(). Alpha blended windows have been broken due to
+    wrong order of code segments.
+
+commit 1eba7234aa3870fe44f1a77d4fb796f7b3c0c01a
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 13 10:48:41 2006 +0000
+
+    cosmetics
+
+commit a906bc47e075c31eef9023f2ac1931eb56bce3f3
+Author: Denis Oliver Kropp 
+Date:   Tue Jun 13 10:47:18 2006 +0000
+
+    Thanks Mike! Looks like I took the last but one diff that I made when taking
+    over these changes...
+
+commit a59198e49e6d71ff426091b95d74a2350ba57a8e
+Author: Mike Emmel 
+Date:   Mon Jun 12 21:35:19 2006 +0000
+
+    Fixed unclosed comment that broke the build
+
+commit 202dfb7eceefe5fa0d090dedb03467d38cdde943
+Author: Denis Oliver Kropp 
+Date:   Mon Jun 12 17:31:44 2006 +0000
+
+    Added IDirectFBDisplayLayer::SetClipRegions().
+    
+    If supported, this method sets the clipping regions that are used to
+    to enable or disable visibility of parts of the layer. The number of
+    regions is stated in the display layer description. The layer will be
+    shown only in these regions or except in these regions.
+
+commit d6d31c32bb95b58d453acb9a999e72492225ddda
+Author: Mike Emmel 
+Date:   Sun Jun 11 20:29:59 2006 +0000
+
+    Added GetPosition to Surface it was missing I needed it and
+    it seems innocous and consistent.
+    If there is a problem we can discuss on the list
+
+commit d387aaea9a3705653792033fce76037a5fa3fb74
+Author: Mike Emmel 
+Date:   Sun Jun 11 18:23:09 2006 +0000
+
+    Redid XServer to open display outside window
+    and save it in the dfb_x11 main struct
+    this gets rid of a lot of race conditions and problems
+    also starts toward setting up the driver for optional rootless operation
+
+commit dceff0bf9a18f0a0d44a1bef86877400a1639d98
+Author: Claudio Ciccani 
+Date:   Sun Jun 11 17:55:10 2006 +0000
+
+    Disable writing to the R300_TX_CNTL register
+    because radeonfb doesn't map that range of the mmio.
+
+commit d8bdd086a1b7a40fde33c9c4392dfa4ea3c267a8
+Author: Mike Emmel 
+Date:   Sun Jun 11 16:44:34 2006 +0000
+
+    Missed file
+
+commit dd1fde38a5532d719a130c5555ba4a578b6cdbef
+Author: Mike Emmel 
+Date:   Sun Jun 11 16:33:00 2006 +0000
+
+    /tmp/cvsRBHEMO
+
+commit 4a68f1b26b0fc9c705e13cc65988564150bb7e07
+Author: Ville Syrjala 
+Date:   Sun Jun 4 20:34:04 2006 +0000
+
+    Avoid negative array indices.
+
+commit a0793d8fca9bf7c31b063f85c02fd08581d3e7d0
+Author: Ville Syrjala 
+Date:   Sun Jun 4 20:29:04 2006 +0000
+
+    Silence warnings.
+
+commit 8e02ad194ba004d9b37fe7e427b10aeed01cf1ec
+Author: Ben Combee 
+Date:   Sun Jun 4 17:53:42 2006 +0000
+
+    Add accessor for debugging fusion ref-count problems
+
+commit ac80ac727942d7e71b41c01b02132184ddcccd84
+Author: Ben Combee 
+Date:   Sun Jun 4 17:52:22 2006 +0000
+
+    Update graphics ops to immediately unref source surfaces allowing quicker memory reuse
+
+commit c4e66c057a1b06e644ed2153b3a34306a655d07d
+Author: Ben Combee 
+Date:   Sun Jun 4 17:51:20 2006 +0000
+
+    Update SDL input handling to better emulate keymaps
+
+commit 6c5862a82d94f3d27d1c968b3eec1a231beaf01f
+Author: Ben Combee 
+Date:   Sun Jun 4 17:50:10 2006 +0000
+
+    new libdirect function to duplicate a file descriptor as needed, making sure new filedes isn't mapped to stdin, stdout, or stderr
+
+commit 1263c28fd977a24a2dd45f146c5f9e7134485325
+Author: Ben Combee 
+Date:   Sun Jun 4 17:48:34 2006 +0000
+
+    directfb-csource tool now makes strucs and bitmap data const, helps with use in shared libs
+
+commit 082b950db08724dee40a1a80fefc07b92a08f4e4
+Author: Ben Combee 
+Date:   Sun Jun 4 17:47:54 2006 +0000
+
+    Add ability to tell image provider to abort rendering
+
+commit 051aa4f862d2e0fe1a6a4e0639c013a14b4a541d
+Author: Ben Combee 
+Date:   Sun Jun 4 17:47:01 2006 +0000
+
+    Blit to misaligned surface fix
+
+commit 1a7a4bb161cdb42c2ce4d5c96b9c782a45442aa9
+Author: Mike Emmel 
+Date:   Sat Jun 3 18:57:52 2006 +0000
+
+    Both
+    IDirectFB_GetDisplayLayer
+    and
+    IDirectFBDisplayLayer_SetConfiguration
+    cause a xwindow to be created
+    this causes the first window to be destroyed
+    and a second to be created with the new configuration.
+    There are a number of problems here and the code
+    needs to be reworked to not create the window or at least not
+    display it because were changing configurations or enumerating layers.
+    There are several conceptual problems here.
+    but at least we won't get two windows with one not used
+
+commit 9c7848b6e84521b7a07e48f44e6290eecbd504a7
+Author: Mike Emmel 
+Date:   Fri Jun 2 17:50:31 2006 +0000
+
+    Added some more checks for race condition between input and connecting to
+    the display
+    this should have a lock I think
+
+commit 9915bb2814e5cb057b74a1a98212a978e72c27b1
+Author: Mike Emmel 
+Date:   Sun May 28 05:24:42 2006 +0000
+
+    Added scrollwheel patch
+
+commit c8cac4cace7c77ea25598e4b044c2418699745f6
+Author: Claudio Ciccani 
+Date:   Sat May 27 13:05:53 2006 +0000
+
+    Applied patch by Christer Palm : fixes word swapping on PPC.
+
+commit 045c214d2a5a91c5ea4b3bf8972533d809ef881e
+Author: Denis Oliver Kropp 
+Date:   Fri May 26 08:19:52 2006 +0000
+
+    Added 4 bit packed alpha pixel format DSPF_A4, e.g. for fonts.
+
+commit 714d543c30311d7466a99de9c13d1dabbec111ec
+Author: Claudio Ciccani 
+Date:   Thu May 18 15:26:17 2006 +0000
+
+    Added IDirectFBInputDevice::DetachEventBuffer() and IDirectFBWindow::DetachEventBuffer() to
+    detach an event buffer from an interface.
+
+commit 29cf44cd57b81d4a6ed870d2bb687f6b0a66b552
+Author: Ville Syrjala 
+Date:   Tue May 16 18:55:07 2006 +0000
+
+    Wait for correct amount of fifo entries.
+
+commit c365ba8cf8822535607627af61a52062ba01aa1e
+Author: Ville Syrjala 
+Date:   Fri May 12 19:50:00 2006 +0000
+
+    - Don't touch console blanking when using graphics-vt.
+    - Disable cursor on startup.
+
+commit 3a5cdbc71a905bba703ba6a148f4881eae0129f6
+Author: Denis Oliver Kropp 
+Date:   Sat May 6 23:59:43 2006 +0000
+
+    Fake video modes by reading fb.modes, just like the fbdev backend.
+
+commit 0e2795f29ae7c1009739243ff2c486dfcfd2e8d1
+Author: Denis Oliver Kropp 
+Date:   Sat May 6 23:44:19 2006 +0000
+
+    Added new debug domain Core/Graphics.
+    
+    Added two debug messages to dfb_gfxcard_drawglyph().
+
+commit dd2e0972d382568051958952f3a298a98b4192f4
+Author: Denis Oliver Kropp 
+Date:   Sat May 6 23:43:08 2006 +0000
+
+    Fixed occasionally invisible DrawGlyph(), parameter and local variable name
+    changes were not complete and an uninitialized local variable was checked
+    instead of the parameter.
+
+commit fe061852e95b8adefc335c66739c4ee90a67f1c3
+Author: Denis Oliver Kropp 
+Date:   Sat May 6 23:29:18 2006 +0000
+
+    Fixed (serious) warnings.
+
+commit df086edaac6a3e04cfa9c68760927b24594a19fd
+Author: Denis Oliver Kropp 
+Date:   Sat May 6 15:25:42 2006 +0000
+
+    Welcome 0.9.26
+    
+    Added support for other encodings than UTF8. Encodings are (or can be) provided
+    with each font implementation. This model reduces code sharing slightly, but
+    allows higher efficiency via optimized combination of decoding and translation.
+    
+    Every encoding just has a name and an ID, where the name can be chosen freely,
+    except for DTEID_UTF8 which is always available and has the name "UTF8".
+    
+    Added interface methods
+    - IDirectFBFont::EnumEncodings() enumerates all provided encodings.
+    - IDirectFBFont::FindEncoding() looks up an encoding directly by its name.
+    - IDirectFBFont::SetEncoding() for local methods and as a default for surfaces.
+    - IDirectFBSurface::SetEncoding() chooses an encoding for the text routines, will be
+      overwritten by SetFont() which takes the default encoding of the new font.
+    
+    Reworked all loops dealing with strings, characters and glyph information.
+    
+    Implemented UTF8 and "Latin1" encoding in FT2 font loader. Nice demonstration how
+    different encodings can be used, while still having a single glyph cache, which is
+    no longer based on character codes, but on their raw indices.
+    
+    ---
+    
+    Added dfb_font_register_encoding( id, name, funcs ) that is called by the font
+    module to register implementations. The 'id' can be DTEID_UTF8 or DTEID_OTHER,
+    where in the latter case the actual id will be allocated dynamically.
+    
+    Added CoreEncodingFuncs only containing GetCharacterIndex() and DecodeText() to
+    do character to index translation and text decoding (including translation).
+    
+    Other functions like GetGlyphInfo() or GetKerning() take raw indices instead
+    of unicode character codes now.
+    
+    In the case of DTEID_UTF8 it's allowed in an implementation to
+    just provide GetCharacterIndex() and let the core do the DecodeText(),
+    but that would cause one GetCharacterIndex() call per decoded unicode
+    character. So implementing both functions is advisable.
+    
+    If nothing is registered for DTEID_UTF8 at all, the core will
+    pass the raw unicode characters to GetGlyphInfo(), RenderGlyph() etc.
+    That's the old behaviour, fully compatible with old modules. It's
+    also a good choice if you want to avoid the character translation,
+    having an efficient font module which is based natively on unicode
+    characters only.
+    
+    When registering an encoding implementation using DTEID_OTHER,
+    both GetCharacterIndex() and DecodeText() must be provided.
+    
+    Added dfb_font_decode_character() to get the raw index of a single character
+    and dfb_font_decode_text() which decodes an encoded sequence of characters,
+    stores all their indices in the provided array and returns the amount.
+    Both functions have a parameter to select the encoding for the operation.
+    
+    ---
+    
+    Changed DirectTree's fast key range from 32-128 to 0-128 as we are no longer
+    having ASCII values but zero based glyph indices.
+    
+    Added some debug messages and domains, like Core/Font.
+    
+    Cleanups.
+
+commit 4e3161e6c83d761e010f27de7b2cb5060fcfed66
+Author: Denis Oliver Kropp 
+Date:   Fri May 5 23:07:23 2006 +0000
+
+    First and fully working implementation of dead key handling using static
+    tables for mapping of dead keys and following symbols to the combined symbol.
+
+commit a24387318b5601a03ed5be8767157d0cb17f2750
+Author: Denis Oliver Kropp 
+Date:   Fri May 5 23:04:08 2006 +0000
+
+    Added support for dead keys.
+
+commit 9622c691964ba82cd069fbc29f66511c67afe758
+Author: Denis Oliver Kropp 
+Date:   Fri May 5 23:01:45 2006 +0000
+
+    Show hex values for symbols without an enum entry.
+
+commit 53bea559fec69effbbaea2c8bfbbfa6ae17624df
+Author: Claudio Ciccani 
+Date:   Fri May 5 12:31:14 2006 +0000
+
+    Disable host-to-video hardware blit for simple blits without format conversion.
+    Added nvEngineReset().
+
+commit c569028afb8cc3efd9b5a8836c9395f2fb2cc01c
+Author: Denis Oliver Kropp 
+Date:   Wed May 3 07:38:51 2006 +0000
+
+    regenerated
+
+commit 82f09f8eed7f95ad7634c7f31064fef0aefe845f
+Author: Denis Oliver Kropp 
+Date:   Wed May 3 07:37:05 2006 +0000
+
+    Fix build problem by swapping two includes.
+
+commit b18fae799efcbd5ed68b11d940e0752002a56ca4
+Author: Denis Oliver Kropp 
+Date:   Wed May 3 07:35:48 2006 +0000
+
+    More EXTRA_DIST stuff.
+
+commit f5e3029aa3f1ff17aa167f6249d6f0fcb291389e
+Author: Denis Oliver Kropp 
+Date:   Wed May 3 07:34:53 2006 +0000
+
+    Added "fake.c" also to EXTRA_DIST...
+
+commit 131e98d705e1d076c9bab9b3aef29f56c93602cc
+Author: Denis Oliver Kropp 
+Date:   Tue May 2 22:41:06 2006 +0000
+
+    New changelog and news.
+
+commit 66cc6b43047cb9943335853556d54201cad80845
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 19:11:14 2006 +0000
+
+    #include 
+
+commit 74626c64f90d54d1e885a22a4a49c84a365da357
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 19:09:28 2006 +0000
+
+    This patch is similar in spirit as the v4l one. Includes the fb.h
+    header into the sources so the definitions can be used freely.
+    Also this would make the 'accelerators.h' file obsolete.
+
+commit 72af467dd5112597fb5d1a3be31a61494a558388
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 18:51:52 2006 +0000
+
+    Thanks to Andreas Jochens  for this patch that "fixes
+    a build failure on amd64 due to types clashing by including 'dfb_types.h'
+    instead of 'asm/types.h' (needs to be applied after the fbdev one, or just
+    ignore the error from the missing file)".
+
+commit 7ee805737c46c557c0363218ee800ea90ac70d03
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 18:44:20 2006 +0000
+
+    This patch includes the V4L header files into the directfb sources, so
+    it can use the features even when building on a kernel that does not
+    support them. That at least makes life easier for distributions. It's
+    also safer for the developers, because then you can use the
+    definitions freely.
+
+commit 84008f26a9f6033b0e579e1877c99e919bf6b682
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 18:39:38 2006 +0000
+
+    Thanks to Jeff Bailey  for this patch that "removes
+    unneeded unconditonal  includes".
+
+commit 193d22aaa28f3b6c83e1d6011a690cae7b1f1430
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 18:37:58 2006 +0000
+
+    Thanks to Jeff Bailey  for this patch that "fixes
+    a build failure on ia64, by using syscall() instead of _syscall0
+    as the later is not supported there".
+
+commit 00487fa87bc6b9876d78d54b1406bf4d91d1464b
+Author: Denis Oliver Kropp 
+Date:   Mon May 1 18:34:21 2006 +0000
+
+    Thanks to Colin Watson  and Guillem Jover 
+    for this patch that "fixes the link dependencies for the plugins.
+    So that stuff like library symbol reduction in debian-installer can
+    work properly".
+
+commit 3e1fb630755394a5925424dfb0b6a1da102e40c0
+Author: Ville Syrjala 
+Date:   Tue Apr 18 09:00:08 2006 +0000
+
+    Return shifted symbols for DIKI_0-9 and DIKI_LESS_SIGN.
+
+commit f57b308f0ef39b66415677346975431e11157211
+Author: Claudio Ciccani 
+Date:   Wed Apr 12 10:29:07 2006 +0000
+
+    Updated the manual page.
+
+commit bfd15b30f7ad17e44244d713cb0b2ef99b48ee3c
+Author: Claudio Ciccani 
+Date:   Sat Apr 8 13:21:57 2006 +0000
+
+    Compute the Low Destination ColorKey taking int account a dithered color conversion.
+
+commit d3f2b39dec3b2ad9a421b967cc7aabe5958f2ec5
+Author: Claudio Ciccani 
+Date:   Sat Apr 8 13:20:06 2006 +0000
+
+    Fix: blitting A8 surfaces with colorization to AYUV is supported.
+
+commit 738efe52d87657b942bc9efd6443b6233b69565f
+Author: Denis Oliver Kropp 
+Date:   Fri Apr 7 19:24:26 2006 +0000
+
+    DIKI_ALTGR is gone. The key right to the space bar is the right alt key.
+    No matter which map is loaded, the identifiers are just named hardware keys,
+    where you really specify the physical entity on your keyboard. In this case
+    it's always DIKI_ALT_R, no matter if it's mapped to DIKS_ALTGR or DIKS_ALT.
+    On standard keyboards it's also always the same hardware key code, no matter
+    if you by a German keyboard with AltGr or a U.$. one with Alt.
+    
+    Changed the input core logic for keeping track of modifiers. If DIKI_ALT_R
+    is pressed, also look at the symbol to decide if DIMM_ALT or DIMM_ALTGR is
+    to be added/removed.
+    
+    Now application developers don't need to check for both DIKI_ALTGR and
+    DIKI_ALT_R if they want to check for the key right next to the space bar :)
+
+commit 5932ee83906262524c3b029c8dfad42191a19d09
+Author: Claudio Ciccani 
+Date:   Fri Apr 7 15:10:28 2006 +0000
+
+    Fixed Cb/Cr offset computation (height*pitch/4 is different from height/2*pitch/2 if height is odd).
+
+commit bc988ff64737032f69d6ca95011850488e62abd5
+Author: Claudio Ciccani 
+Date:   Fri Apr 7 15:07:58 2006 +0000
+
+    Fixed incorrect Cr offset computation in dfb_copy_buffer_32().
+
+commit 39a4fe8ed0d50d287a425be7ac64296df6f77782
+Author: Claudio Ciccani 
+Date:   Fri Apr 7 12:29:13 2006 +0000
+
+    Fixed memory leak: dfb_state_destroy() was still freeing gfxs->Aacc instead of gfxs->ABstart.
+
+commit e1104068434774eb31cb2d7207172837a95e52f4
+Author: Claudio Ciccani 
+Date:   Fri Apr 7 09:39:15 2006 +0000
+
+    Added acceleration for AYUV, but color conversion is not supported because
+    radeon supports AVYU instead of AYUV.
+
+commit 0494597af04300ddf93ec5b0e1b4ffe7833b3e78
+Author: Denis Oliver Kropp 
+Date:   Thu Apr 6 23:15:52 2006 +0000
+
+    Added missing inputdrivers/penmount/Makefile.
+
+commit ad0d296161775933eacca9dca67c792d0faa41d9
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 17:46:14 2006 +0000
+
+    Fixed a wrong pointer.
+
+commit 05673fc0681e1df121c945d9029785d25d390ec0
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 13:29:17 2006 +0000
+
+    Almost completed AYUV support (lacks colorkeying).
+
+commit 892c5099f3678b6cbad93cfbbd6969dd2fb6797f
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 13:05:03 2006 +0000
+
+    Fixed AYUV span writing.
+
+commit 106e3d8bdd9e8d92d307d36f87b644c00ddb519b
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 13:03:53 2006 +0000
+
+    Check for penmount input driver.
+
+commit 54ae63e6ff1bdddf3ff842074d3927730abd178a
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 12:44:24 2006 +0000
+
+    Replaced error message about access failed to /proc/bus/pci/devices with a debug message.
+
+commit 861f5b0aed6bf2633d639d3c837032870d61c214
+Author: Claudio Ciccani 
+Date:   Thu Apr 6 12:42:59 2006 +0000
+
+    Replaced freetype-config by $FREETYPE_CONFIG.
+
+commit bf894a1471500feb5f39fbe34e8c2de59f91e8a5
+Author: Denis Oliver Kropp 
+Date:   Thu Apr 6 12:00:34 2006 +0000
+
+    Added DSPF_AYUV, a 32bit packed AYUV format for graphics,
+    being the counterpart of ARGB in the YUV color space.
+
+commit 4868de1074f49c45eef191df4e8a129518f65eff
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 5 23:34:29 2006 +0000
+
+    Removed r100 and r200 driver in favor of the latest and greatest Radeon driver.
+
+commit e4bd6e3b474b0b254e764bc535db7d084018e4dc
+Author: Denis Oliver Kropp 
+Date:   Wed Apr 5 23:29:01 2006 +0000
+
+    Applied patch from Christian Krause  that allows
+    usage of the option "mouse-source" without "mouse-gpm-source".
+
+commit 59b321d5b167cb91c0c9e8780ddd46c9028e0697
+Author: Nikita Egorov 
+Date:   Tue Apr 4 15:01:43 2006 +0000
+
+    Added input driver for PenMount 9509 serial touchscreen.
+
+commit b1933e0cf278ec9d7f6a55b4d8eb593c67fb3cf1
+Author: Ville Syrjala 
+Date:   Tue Apr 4 05:26:58 2006 +0000
+
+    Fix negative line width handling in fill_tri().
+
+commit 84ba3971285041762e2af83e2d41d2e8d6d7332d
+Author: Denis Oliver Kropp 
+Date:   Sun Apr 2 12:50:38 2006 +0000
+
+    Thanks to Andy Stewart for fixing the hash table reallocation which didn't
+    check for collisions during reinsertion.
+
+commit 7a5310428d8784285d32dc353177fea6ea9f4677
+Author: Denis Oliver Kropp 
+Date:   Sun Apr 2 12:40:53 2006 +0000
+
+    Fix wrong signedness in IDirectFBSurface_GetClip().
+
+commit 206274287105126859013256e3d7062d4a9a3520
+Author: Denis Oliver Kropp 
+Date:   Sun Apr 2 12:18:18 2006 +0000
+
+    Fixed errors and warnings.
+
+commit 844a82586f477151d58f8ae4f9c64d26e14c8021
+Author: Denis Oliver Kropp 
+Date:   Thu Mar 30 12:38:09 2006 +0000
+
+    Fix errors given by including the header in a C++ code.
+
+commit 5bebc73b6ea7094d9654220e0a349a4d8a7ab830
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 26 14:27:00 2006 +0000
+
+    Fixed bogus "fbdev driver possibly buggy" warning if the video memory is too
+    small to set the mode properly, i.e. when vyres is clipped by the driver.
+
+commit 4d5ae5061ea6c681969463c18a4d018f154442be
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 26 11:45:48 2006 +0000
+
+    Fixed (unused) macro EXPAND_7to8.
+
+commit 11c9529d4b70281aa3790561d95e916627b861e0
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 26 11:33:36 2006 +0000
+
+    Read up to 64 events with one read().
+    
+    Combine motion events if they follow each other immediately and would
+    cause a lag or buffer overrun otherwise.
+
+commit 0e9a0ac8d78df9b666d065479e70e7a56c0370ca
+Author: Claudio Ciccani 
+Date:   Wed Mar 22 13:12:22 2006 +0000
+
+    Try to get vendor/device id from mmio.
+
+commit 217a73989ba858b1cdb47d6affa1925455a048e9
+Author: Claudio Ciccani 
+Date:   Wed Mar 22 10:38:09 2006 +0000
+
+    Initialize interface pointers (loaded module may not be up to date with the interface version).
+
+commit 163bd788abba21335958a90899edfe3e48415a9e
+Author: Claudio Ciccani 
+Date:   Wed Mar 22 10:35:42 2006 +0000
+
+    Warn if the device id detection fails.
+
+commit 2df87b81d3235fce9c162b2ba5ad4dbe88055d33
+Author: Claudio Ciccani 
+Date:   Tue Mar 21 11:41:45 2006 +0000
+
+    Follow changes.
+
+commit e96e2ae11a0cfa730d26bf9b2e1b9be4c3b677e1
+Author: Claudio Ciccani 
+Date:   Tue Mar 21 11:40:35 2006 +0000
+
+    Centralized the selection of the default resolution/pixelformat.
+
+commit 051ce5fc92328cb961534983083ce60351c84ef3
+Author: Claudio Ciccani 
+Date:   Mon Mar 20 14:27:21 2006 +0000
+
+    Imported the new Unified Radeon driver, with a lot of improvements and new features:
+     - supports smooth page flipping
+     - supports seconday head output
+     - supports overlay on secondary head
+     - improved overlay RGB rendering
+     - improved R100/R200 3d functions performance
+     - fixed 2d/3d engines syncronization
+    
+    TODO:
+     - 3d acceleration on R300 chipsets
+     - TV output
+
+commit a47cf485b09a9e92a892321bf225251ff5e0823f
+Author: Claudio Ciccani 
+Date:   Mon Mar 20 14:20:13 2006 +0000
+
+    Added dfb_gfxcard_surface_{enter/leave}(), called when a software access to
+    video memory begins/finishes.
+    
+    Needed by the Radeon driver to swap pixels on big-endian machines
+    (actually the method doesn't work fine when surfaces are locked for long time).
+
+commit cc555969fcb9ca6181fa53dfade137a23110982f
+Author: Denis Oliver Kropp 
+Date:   Mon Mar 20 01:26:50 2006 +0000
+
+    Fix inverted module directory condition.
+
+commit 5ca055496904f9edd97abb2fec7e9cb5c9cf2d98
+Author: Denis Oliver Kropp 
+Date:   Mon Mar 20 00:35:35 2006 +0000
+
+    Manage UCB1x00 Touchscreen driver build as others, enabled by default on arm.
+
+commit a0df9c7eb6fc447d5097c55cd8b6d1a8085b3996
+Author: Denis Oliver Kropp 
+Date:   Mon Mar 20 00:27:09 2006 +0000
+
+    In case of an error in dfb_surface_dump() only release the palette if non-NULL.
+
+commit 23596187016e9f002248814cd3b1015e946243ca
+Author: Denis Oliver Kropp 
+Date:   Mon Mar 20 00:19:59 2006 +0000
+
+    Allow NULL argument in direct_free().
+
+commit 5aa3fdb2dbdebbca51252e49af5546cfb41c8c5a
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 19 21:44:13 2006 +0000
+
+    Replaced the enum based bool definition by a typedef to __u8.
+    Defined false and true via macros like stdbool.h does.
+    
+    Before that the sizeof bool didn't match the real one.
+
+commit 221162d18d7702d649443ee757c59a5a14b5bb0f
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 19 21:23:19 2006 +0000
+
+    Don't return a bitmask but a real boolean value in dfb_gfxcard_state_check().
+
+commit e1b6815022f8cabca6c67a87cd9f170ae6218ca1
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 19 00:47:56 2006 +0000
+
+    fixed
+
+commit 34beea7207f699703952228d2081b89fcf39bfe8
+Author: Denis Oliver Kropp 
+Date:   Sun Mar 19 00:30:16 2006 +0000
+
+    Change the module directory only for builds that don't *support* debug.
+
+commit e2b9cf4522a3abaefb48a929c689d7b19a8f0e8a
+Author: Denis Oliver Kropp 
+Date:   Tue Mar 14 23:25:52 2006 +0000
+
+    Include  only if it exists, otherwise include .
+
+commit d235d766d95bc746fbd3e4d80f725561ac62a0de
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 10 17:07:05 2006 +0000
+
+    Added FusionCall to each input device for maintenance via master,
+    driver calls etc. using new CoreInputDeviceCommand enum.
+    
+    Added dfb_input_device_reload_keymap() implemented via the new call passing
+    the CIDC_RELOAD_KEYMAP command. The master will reload the whole keymap via
+    driver API.
+    
+    Added debug domain "Core/Input" with some debug messages.
+    
+    Added a new tool called "dfbinput" which features keymap dump/reload so far.
+
+commit c973fa3f2ef2dcdc1b7e4e3890f1b81d6ce35e9f
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 10 12:58:03 2006 +0000
+
+    Check for device->shared in dfb_input_dispatch() to catch early birds :)
+
+commit 7a64e09458fbf660d631a1e130ad1f58529632dc
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 10 12:39:07 2006 +0000
+
+    Include  instead of .
+    
+    Fixes build for me. If it fails with older headers we need to add a check.
+
+commit 7b2ccd9601870eb9ceb963bc6df2f2c5b503d9a5
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 10 12:30:42 2006 +0000
+
+    Fixed autoconf detection. Don't know exactly what, but I guess
+    it got confused with the output of a newer wrapper script.
+
+commit d1cc303f91368155d7c8a7ceab91cac2a0c8b075
+Author: Denis Oliver Kropp 
+Date:   Fri Mar 10 12:24:56 2006 +0000
+
+    Allow pending reactions (in local dispatcher queue) to be executed
+    after the shared reactor part has been destroyed. This fixes for example
+    occasionally missing DWET_DESTROYED events.
+
+commit ac26da5f8e1a8387031c80987788d46d54c38074
+Author: Denis Oliver Kropp 
+Date:   Wed Mar 1 04:23:11 2006 +0000
+
+    Added FusionCallExecFlags parameter to fusion_call_execute().
+    
+    Use the flag FCEF_ONEWAY in the SDL backend to not wait for the
+    call being executed, otherwise a deadlock could occur. The return
+    value is meaningless anyways. Queued updates will be merged on the
+    receiving side (master) to avoid a lag and improve performance.
+
+commit c34a83b83c64a1866076b8a7cbfa02c9a45fe855
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 22 08:27:02 2006 +0000
+
+    Make compiler happy.
+
+commit 61e157e0572a6bfc8adc457d9bea10db81782805
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 15 16:17:27 2006 +0000
+
+    Added a parameter to fusion_enter() - FusionEnterRole - to specify either
+    FER_ANY, FER_MASTER or FER_SLAVE. If the world can't be entered playing the
+    specified role, an error message is printed and DFB_UNSUPPORTED is returned.
+
+commit 033c177bf046450e8d9e1b049c7d1b49abe5a0ef
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 15 16:14:54 2006 +0000
+
+    Added D_ASSERT( object->state != FOS_ACTIVE ) to fusion_object_destroy().
+    
+    Only objects in state FOS_INIT or FOS_DEINIT are allowed to be destroyed directly.
+
+commit 7b69a56bfa1e86aa7de8be2f4d873afffc038c23
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 12 03:44:35 2006 +0000
+
+    Fixed build.
+
+commit f78abae42ad90072ccab068ba005c32ea7c41d7d
+Author: Denis Oliver Kropp 
+Date:   Sat Feb 11 16:47:22 2006 +0000
+
+    Fixed destination offset when no scaling is used, thanks to otokawa.
+
+commit 5eab7d24de9bf791bc83ed56155afa1c36f48f68
+Author: Denis Oliver Kropp 
+Date:   Fri Feb 10 13:25:51 2006 +0000
+
+    Added symbol resolving support for static binaries.
+
+commit e7cf0a183f2b4ac619d68d834570fbb18f3d3366
+Author: Denis Oliver Kropp 
+Date:   Fri Feb 10 13:21:36 2006 +0000
+
+    In Probe() call FT_Done_Face() only if FT_New_Face() succeeded, otherwise
+    random segfaults can occur.
+
+commit f51f94061e29da5048952d8631dfb36298bbc382
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 15:47:59 2006 +0000
+
+    When AGP support is enabled, turn off pci gart and turn on bus mastering.
+
+commit 2a0c71a3c99b098569e151cef01ef15474b2381d
+Author: Denis Oliver Kropp 
+Date:   Tue Feb 7 12:17:14 2006 +0000
+
+    Increased ABI version to avoid problems :)
+
+commit b5334b8279ffbacd63b0c0ec2bcb0df454f755a4
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 10:05:38 2006 +0000
+
+    Check if dfb_agp_join() fails.
+
+commit 550d0482ebf5324b5ad04e510dfb6f732ef17b73
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 09:35:38 2006 +0000
+
+    Follow API changes.
+
+commit 51d7213d0c4f02f8371f9cc7a9210c201d34349b
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 09:34:32 2006 +0000
+
+    Added support for surfaces stored in AGP memory.
+
+commit 5d67f5110cf61e0e3b1ec3abe1474cdb518022ec
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 09:33:34 2006 +0000
+
+    Use internal AGP access.
+
+commit 759d3d256c7fe0cf840c83d04380b81f2b82fac5
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 09:32:09 2006 +0000
+
+    Added AGP support.
+
+commit b4dbcde5d2c6251755ffb1abbdd7a1c53586ae70
+Author: Claudio Ciccani 
+Date:   Tue Feb 7 09:30:41 2006 +0000
+
+    Added support for surfaces stored in auxiliray memory (PCI/AGP/PCIE).
+    
+    Added support for Surface Managers with a variable number of heaps.
+
+commit b411dae7cec0c9065e2eba4e204085617e7810ee
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 5 17:31:03 2006 +0000
+
+    Install the new header file.
+
+commit e39705caa934a584fe7101b1e8183d35ff2fbf63
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 5 17:30:27 2006 +0000
+
+    Moved misc/util.h to include/directfb_util.h to use it in applications.
+    
+    More to come :)
+
+commit 27a505c4ed1d2ece73a0daf0b1863bcb0c68fc7c
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 5 16:03:06 2006 +0000
+
+    Added new runtime option:
+    
+    fatal-level=
+      Abort on NONE, ASSERT (default) or ASSUME (incl. assert)
+    
+    
+    Finally added documentation of "[no]-vt" :)
+
+commit 0152edecf64afb473b5c297a2cebebeb5ce1f3ce
+Author: Denis Oliver Kropp 
+Date:   Sun Feb 5 16:00:04 2006 +0000
+
+    Do the shmalloc benchmark once with debug and once without.
+
+commit 2644c58611042a2c57cdbaa459767bf73b48c21e
+Author: Denis Oliver Kropp 
+Date:   Thu Feb 2 18:59:25 2006 +0000
+
+    Made debug/release versions binary compatible, being able to link
+    dynamically against both or even run in the same session.
+    
+    This enables single hybrid SDKs for debug and release platforms.
+    
+    To achieve this all "debug support code" is in the library, whether
+    itself uses debug mechanisms or not.
+    
+    But the option "--disable-debug-support" builds a "pure release" lib
+    to save a few kb in binary size, but basically no runtime overhead.
+    
+    The shared memory pools accept a new option at creation, that is
+    whether to debug allocations. This is stored in the pool info and
+    anyone joining the pool must follow it (for the pool).
+    
+    Except pure release versions which can't join debug enabled pools.
+    
+    Another limitation is that debug enabled applications cannot link
+    against pure release libraries, but a debug enabled application
+    can be linked statically against its debug/release library and run
+    in a pure release session.
+    
+    There shouldn't be other limitations and you'll warnings/errors
+    before anything crashes etc.
+    
+    The default for the "debug" option is true in debug enabled libs
+    and false in release (debug disabled, but supported) libs. This
+    option currently determines if shared memory pools are debug enabled.
+    
+    Happy mixing :)
+
+commit 7e03efde3ab18d63eb23863e8eb6db6d0f1a2a41
+Author: Denis Oliver Kropp 
+Date:   Thu Feb 2 18:26:21 2006 +0000
+
+    Use D_DEBUG_ENABLED instead of DIRECT_BUILD_DEBUG.
+
+commit 2e3877f35ba6ca291562a4ce8cf119abf6fb36dc
+Author: Denis Oliver Kropp 
+Date:   Thu Feb 2 17:20:04 2006 +0000
+
+    Fixed failing assertion due to a race condition between shutdown and update.
+    
+    Added debug domain "SDL/Updates" and lots of debugging messages.
+
+commit e91706ef22d8ff39e7f04f4879a060ac3fe7390c
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 1 23:10:13 2006 +0000
+
+    Decoupled screen updates from Fusion Dispatcher.
+    
+    Updates are handled in a separate thread; they're accumulated rather than
+    queued in case an update is already pending.
+
+commit 241c6ecaed03c832de3b06dc1aebae0d3febee64
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 1 18:57:23 2006 +0000
+
+    Fixed warning (signedness).
+
+commit d603b491aa02f25ecb3e457606af745e73a8fd98
+Author: Denis Oliver Kropp 
+Date:   Wed Feb 1 18:55:37 2006 +0000
+
+    Workaround broken(?) 2.6.16 headers.
+
+commit eebc3b866e5c7c10849da0e21c802fcb21a30c16
+Author: Claudio Ciccani 
+Date:   Wed Feb 1 13:39:25 2006 +0000
+
+    Avoid sending s/t coordinates when drawing only shapes.
+
+commit dfb96eae46811476f104847689c91976d4e4bb8f
+Author: Claudio Ciccani 
+Date:   Wed Feb 1 10:24:44 2006 +0000
+
+    Add fb_offset to the dma offset.
+
+commit e9c54218d3d26941a18fdb1830e706fc9dc605df
+Author: Claudio Ciccani 
+Date:   Wed Feb 1 09:35:12 2006 +0000
+
+    No longer change the value of MC_FB_LOCATION unless an IGP chipset is used
+    (old radeonfb doesn't set the register correctly on IGPs).
+
+commit 8232568b4d550dfe3f6f7904f57e49a0dfaa27b6
+Author: Claudio Ciccani 
+Date:   Wed Feb 1 09:32:37 2006 +0000
+
+    Imported the new R100 driver.
+
+commit a1b1fd67e9739674e05ee02cfca29f98cab580a9
+Author: Claudio Ciccani 
+Date:   Sat Jan 28 11:41:29 2006 +0000
+
+    Added a patch that allows to mmap AGP memory without root privileges.
+
+commit f82fbb027f259719919c46bcbae0395efe91b2d5
+Author: Claudio Ciccani 
+Date:   Sat Jan 28 11:39:15 2006 +0000
+
+    Open log file in append mode.
+
+commit 2420e8994dc3b9d5ec10cd1241816028595bcc02
+Author: Claudio Ciccani 
+Date:   Sat Jan 28 11:38:13 2006 +0000
+
+    Added option [no-]dma (disabled by default).
+
+commit 8cef104e7238329be949e72b77c8412d87f80ddc
+Author: Claudio Ciccani 
+Date:   Sat Jan 28 11:36:56 2006 +0000
+
+    Version 0.6 of the NVidia driver:
+    - Added support for AGP
+    - Added support for DMA using AGP or Framebuffer memory.
+    
+    Currently DMA is not faster than PIO, therefore it's disabled by default.
+
+commit b7d7a76043950102126d000aaa24043ee8f3f7e0
+Author: Claudio Ciccani 
+Date:   Fri Jan 27 13:35:02 2006 +0000
+
+    Check for integrated GPUs.
+
+commit dff1a5effe84809feb612662a859b84a7714ee4a
+Author: Claudio Ciccani 
+Date:   Wed Jan 25 14:40:14 2006 +0000
+
+    Reset MC_FB_LOCATION to avoid problems with X (thanks to Michel Danzer).
+
+commit ec0ab004c4a40f8a07aa376da03bb65423ae0bfc
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 21:19:23 2006 +0000
+
+    Finally fixed the "random-crashes-when-blitting-from-system-memory" problem.
+
+commit 0772894a73e146ef55a0f8c2dd19102993a572dc
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 17:00:02 2006 +0000
+
+    Print less cryptic debugging messages.
+
+commit 9b4b1a0c0046a3c2d3b246ef2d35132014177f98
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 11:35:33 2006 +0000
+
+    Fixed a potential memleak.
+
+commit 0ddf560300d58300b0dd8060c3d591992dab7e0a
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 11:33:18 2006 +0000
+
+    Fail during probe() if the framebuffer device doesn't provide access to MMIO.
+
+commit 3fa3f80704f3067c04bd8afaf2528fde8e20728d
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 11:32:00 2006 +0000
+
+    Fixed a typo.
+
+commit 3c4e3d1b45e4f452ea6ec69fe670b4bbedf19878
+Author: Claudio Ciccani 
+Date:   Mon Jan 23 11:31:17 2006 +0000
+
+    Fixed wrong register in R200_SET_YUV422_COLOR().
+
+commit 410aab6f33e6d132713657420d408372379f155c
+Author: Mike Emmel 
+Date:   Sun Jan 22 03:54:52 2006 +0000
+
+    removed extra return
+
+commit 0ebcf50d3c945a40bed265e548668df61a6f4eba
+Author: Mike Emmel 
+Date:   Sun Jan 22 03:54:12 2006 +0000
+
+    copied shift fixed for id to char from sdl to x11 driver to fix symbols sent when shift is down
+
+commit d3d032ff58dca4aa22ca023eb2b89f8a24485c39
+Author: Denis Oliver Kropp 
+Date:   Thu Jan 19 16:42:26 2006 +0000
+
+    Fixed wrong enum names used (missing E in DVSTATE_).
+
+commit 90500310dc14cc5747c4309c056085afbbf4f57b
+Author: Claudio Ciccani 
+Date:   Thu Jan 19 13:56:14 2006 +0000
+
+    Speed up FillRectangle, Blit and StretchBlit by using the RECTANGLE_LIST primitive
+    instead of QUAD_LIST [~15% faster]. :)
+
+commit 4a1f56c517bb83655cb6340dbc2bfee4eb120a9f
+Author: Claudio Ciccani 
+Date:   Wed Jan 18 17:31:54 2006 +0000
+
+    Use the POINT primitive to fill rectangles with size=1 (i.e. to draw points) [~60% faster].
+
+commit 76c0abb70404bd03ece844054d67ec192acb2b33
+Author: Claudio Ciccani 
+Date:   Sun Jan 15 19:13:27 2006 +0000
+
+    Follow API changes.
+
+commit 4d123961453d876db72d881331f164a9cfdf1ba3
+Author: Claudio Ciccani 
+Date:   Sun Jan 15 19:12:11 2006 +0000
+
+    Added IDirectFBVideoProvider::GetStatus() to get the status of the playback;
+    this method replaces the previous end-of-playback detection method using GetPos().
+    
+    Be more explicit about the coordinates system used by IDirectFBVideoProvider::SendEvent().
+
+commit 10064fbb3b81d8b3b1e313e494323d5743687e23
+Author: Claudio Ciccani 
+Date:   Sat Jan 14 15:14:00 2006 +0000
+
+    Added IDirectFBVideoProvider::GetStreamDescription() to query informations about the stream.
+
+commit 0045fc110a08f826cda49e5f5adc122aed23d97a
+Author: Denis Oliver Kropp 
+Date:   Sun Jan 8 06:42:52 2006 +0000
+
+    Fixed disabling video4linux provider.
+
+commit 460f44a2c1fa84ac8ef6aa811b598d65498daa2e
+Author: Denis Oliver Kropp 
+Date:   Sat Jan 7 15:08:13 2006 +0000
+
+    Added DFBEventBufferStats containing various counters for the event queue,
+    e.g. total number of events, number of window events, motion events etc.
+    
+    These reflect the current content of the queue, i.e. dequeueing decrements.
+    
+    Added IDirectFBEventBuffer::EnableStatistics() to enable/disable collection.
+    
+    Added IDirectFBEventBuffer::GetStatistics() to query current statistics.
+
+commit 524844576fb90d9a10c521c61237e09e1c54c872
+Author: Denis Oliver Kropp 
+Date:   Fri Jan 6 19:57:38 2006 +0000
+
+    Added IDirectFBSurface::GetClip().
+
+commit 73ee7d922a2ed6c0a809e7bdca85e95d2178e864
+Author: Mike Emmel 
+Date:   Fri Jan 6 17:39:28 2006 +0000
+
+    Added Alex Lau's patch
+
+commit 9dccd6c4ea61bfe695151dca34de2751c6c86398
+Author: Claudio Ciccani 
+Date:   Fri Jan 6 11:26:02 2006 +0000
+
+    Implemented IDirectFBDataBuffer::Finish().
+
+commit 6a6d9324dd2086d0486bd66e561f8ecca4cf41d5
+Author: Claudio Ciccani 
+Date:   Thu Jan 5 18:50:30 2006 +0000
+
+    Use getaddrinfo() to resolve hostname.
+
+commit 796b4bff740d390138bf2dca28b3d3fcd0a19433
+Author: Claudio Ciccani 
+Date:   Thu Jan 5 18:31:18 2006 +0000
+
+    Use getaddrinfo() to resolve host.
+
+commit 2d68cdfd03b66feedf80f799e577c7f095ed9ca8
+Author: Mike Emmel 
+Date:   Thu Jan 5 15:08:23 2006 +0000
+
+    Added fix for keyboard id conver from Alex Lau
+
+commit 2fca19d866f2211c2a864b9a0df4fd33da4d997f
+Author: Claudio Ciccani 
+Date:   Thu Jan 5 12:04:45 2006 +0000
+
+    Added UDP support.
+    
+    In parse_url(), use memcpy() instead of strncpy() and null-terminate the string
+    (from strncpy manual page: "if there is no null byte among the first n bytes of src,
+     the result will not be null-terminated").
+
+commit a25bf8eff6583f2c487bb6c3a3abd5b1a44acfca
+Author: Claudio Ciccani 
+Date:   Wed Jan 4 12:02:44 2006 +0000
+
+    Completed support for YCbCr formats.
+
+commit 82f5dc648b10b60043430e08d2c47cf8f086e608
+Author: Claudio Ciccani 
+Date:   Mon Jan 2 11:36:59 2006 +0000
+
+    Allow to control background and cursor in exclusive cooperative level.
+
+commit 7fd998c896da7506f0736c382e2b313d11643de1
+Author: Claudio Ciccani 
+Date:   Sun Jan 1 11:49:04 2006 +0000
+
+    If the surface is locked, dfb_surface_reformat() fails returning DFB_LOCKED to avoid deadlocks.
+
+commit 55ebb159dbcc4672d8607e186899e5ed1bbd18a4
+Author: Claudio Ciccani 
+Date:   Sun Jan 1 11:01:01 2006 +0000
+
+    Almost completed support for Planar YUV formats (lacks colorkeying).
+
+commit a14abfd35a828f896a5a1239aa9964ad1e25b5c0
+Author: Mike Emmel 
+Date:   Fri Dec 30 18:41:52 2005 +0000
+
+    Fixed a small bug in key translations
+
+commit 98cc030ec67cf2efd759f39e65763879810e1996
+Author: Mike Emmel 
+Date:   Fri Dec 30 18:22:06 2005 +0000
+
+    Changed key handling in SDL driver to match the X11 driver which seems correct
+
+commit c70df84879a87b3e9ef3e237e244002034b39506
+Author: Andreas Hundt 
+Date:   Fri Dec 30 11:45:15 2005 +0000
+
+    - replaced strdupa()/strndupa() by alloca() and strcpy()/strncpy()
+    (avoid GNU extensions)
+
+commit 9b06988bf6a133252be2e800f24f7d04102f5a0c
+Author: Andreas Hundt 
+Date:   Fri Dec 30 00:09:32 2005 +0000
+
+    include , required for fstat on some OS
+
+commit 068d9406127980d1477392361255ddd0e5ad13c3
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 29 04:21:10 2005 +0000
+
+    Lock surface manager in dfb_surface_unlock() to make lock counter
+    decrement atomic! I'm not sure, but I think I just hit that one,
+    because the lock counter was one for an unknown reason and resizing
+    a window blocked.
+
+commit 45f4421662ff4489500f35cdd719d18da4a3d198
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 29 03:29:19 2005 +0000
+
+    Implemented requestor/dispatcher FillSpans().
+
+commit fdb690aca93b76297eca6d348992ec09129820b9
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 29 03:14:29 2005 +0000
+
+    Implemented requestor/dispatcher FillRectangles().
+
+commit bb9bcb6be49309ae5e3267c952c07df73c8fb1ca
+Author: Denis Oliver Kropp 
+Date:   Thu Dec 29 02:35:19 2005 +0000
+
+    Commented out -Wno-strict-aliasing for now. Need to add a check for the gcc version!
+
+commit 54be67b7daf0d144a49ae32bb90e3a114f91c20d
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 28 02:23:55 2005 +0000
+
+    Added debug messages.
+
+commit b3712b434f3c2a1438228931605cf638d7a7a61a
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 28 02:22:44 2005 +0000
+
+    Fixed warnings.
+
+commit 95115bc9640e5d0bc5fb0a9e70e053b83d3b9c17
+Author: Claudio Ciccani 
+Date:   Tue Dec 27 13:58:33 2005 +0000
+
+    typo.
+
+commit 3e4475dc8c866b707f75c2d93c4c8dd03f52ea6b
+Author: Claudio Ciccani 
+Date:   Tue Dec 27 13:57:48 2005 +0000
+
+    Removed GetScreenSize() hook.
+
+commit 68d52235e70b7da723f22c0c7d021e9b078f76a4
+Author: Claudio Ciccani 
+Date:   Sat Dec 24 10:50:11 2005 +0000
+
+    Use dfb_system_current_mode() instead of reading CRTC mode registers.
+
+commit 7c349ff8afd7211f58dfee3a3a2d1e236602b499
+Author: Claudio Ciccani 
+Date:   Fri Dec 23 15:23:26 2005 +0000
+
+    Ignore return value from IDirectFBDataBuffer::PeekData().
+
+commit f564ee10a516fd7d120a64892d302072c744ebdc
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 23 02:47:53 2005 +0000
+
+    Set FD_CLOEXEC flag on Fusion device.
+
+commit 4aa020538620c9e54566b07d76ff15bcf7d1674e
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 23 01:03:18 2005 +0000
+
+    Don't depend on pure existence of "freetype-config" if FREETYPE_CFLAGS
+    and FREETYPE_LIBS are already exported prior to running configure.
+
+commit 97416def2b6f522764dc8a0dbf278419ba451d14
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 23 00:53:34 2005 +0000
+
+    Don't just return DFB_OK to fake fusion_shm_pool_create().
+    
+    Allocate fake struct, do D_MAGIC stuff, count attach and assert in detach.
+    
+    
+    Fixes the failing assertion in fbdev_shutdown() as the pool pointer was NULL.
+
+commit 6dc3445519b6640562fa49e07602b7722b665fe8
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 23 00:48:22 2005 +0000
+
+    Let D_OOSHM() be defined to D_OOM() in non-multi app fusion again.
+
+commit e2128019f581d2879b9400e47674c92cb94a5a58
+Author: Denis Oliver Kropp 
+Date:   Fri Dec 23 00:47:38 2005 +0000
+
+    Fixed double D_OOSHM().
+
+commit be95bcee0c74ee939c27452020db7fd24ebfcbfb
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 18 14:01:36 2005 +0000
+
+    Check if already locked and return DFB_LOCKED in Lock().
+    
+    Automatically unlock when fully released, i.e. in Destruct().
+
+commit 3070e619d07331f30ad9b9adbf91f6d0c9dee3fe
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 18 14:00:07 2005 +0000
+
+    Added lots of debug messages.
+
+commit 5d63e417f0a706b63a1ee7cb06859e9328854408
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 18 12:54:35 2005 +0000
+
+    Added DSDESC_NONE and DSDESC_ALL.
+
+commit ef2121f762acb71491bf9ba891c5cfa8172de374
+Author: Denis Oliver Kropp 
+Date:   Sun Dec 18 02:03:32 2005 +0000
+
+    Make handlers_lock a recursive mutex again to fix a deadlock during signal
+    handling recently introduced. Pressing Ctrl-C works again.
+
+commit 9b1afeb0bbf558b3c123ff9d05a043ef5e94d4e4
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 17 05:38:56 2005 +0000
+
+    Applied patch containing a hotfix for the "concurrent-render-resize" problem.
+    Thanks to Ryan Burns !
+    
+    This is an intermediate (dirty) solution before the new surface core is finished.
+
+commit 85cfc4f00e84be9dd141b218ae82a3d6e033d912
+Author: Denis Oliver Kropp 
+Date:   Sat Dec 17 05:35:42 2005 +0000
+
+    Allow empty flags in IDirectFBDisplayLayer::SetColorAdjustment().
+    
+    Added DCAF_ALL.
+
+commit b7e5ae27b0a81fbb51370232e6acf2ffefc1535d
+Author: Claudio Ciccani 
+Date:   Thu Dec 15 14:32:06 2005 +0000
+
+    Replaced size_t by ssize_t.
+
+commit a60888bdab8aef741387fdc2eb7729969f4ce05b
+Author: Denis Oliver Kropp 
+Date:   Wed Dec 14 15:55:43 2005 +0000
+
+    Disable elo by default.
+
+commit 823f9e457f69ffde4df0e874b5a913bcfff2217e
+Author: Denis Oliver Kropp 
+Date:   Tue Dec 13 16:30:03 2005 +0000
+
+    Check mixer/encoder/output indices.
+
+commit ab1ba46972ff484cd40457e0075eb6abb72ea5fa
+Author: Denis Oliver Kropp 
+Date:   Tue Dec 13 16:08:41 2005 +0000
+
+    Show version number.
+    
+    Use  tag much better.
+
+commit 4f369a3c1c7fa73de05b73ce04da53a550796131
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 10 16:56:16 2005 +0000
+
+    Don't build gunze by default. It seems to miss proper detection code.
+
+commit c54ca76b4857f2314228bfc55f021b29d145d128
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 10 16:00:54 2005 +0000
+
+    Use a separate shared memory pool for surface buffer data.
+
+commit 50ed492c997131277dddaee19d13d6f0e0a41fc0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Dec 9 19:46:54 2005 +0000
+
+    Delete trailing whitespace.
+
+commit 350f73e37a19dd7007667a7596a15fa796efc012
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Dec 9 19:04:54 2005 +0000
+
+    Added framework to support all colorkeying combinations.
+
+commit 4d1359263ff409819439010012c29be0b22cfcab
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Dec 9 16:15:38 2005 +0000
+
+    Removed duplicate Duff's device definitions.
+
+commit f0b0aab3360605ad01a61888a9b80f1d2279f9f3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 15:43:44 2005 +0000
+
+    This patch adds fusion_reactor_sized_dispatch():
+    
+    Dispatch a message to any attached reaction with a given size. Instead of
+    using the size defined by the reactor, the caller can specify the size of
+    the data.
+
+commit 231ab3e06e8ddf09c5935275630b0f590defeb67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 15:24:05 2005 +0000
+
+    Another patch, this one brings D_DEBUG_ENTER and D_DEBUG_EXIT to ease debug
+    messages for tracing function calls.
+
+commit 866c04d5bb4a907ac0e1631d1d5c10fbbc9179c2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 15:15:09 2005 +0000
+
+    If the domain being registered contains a slash, but didn't exactly match an entry
+    in directfbrc, check to see if the domain is descended from an entry in directfbrc,
+    e.g. 'ui/field/messages' matches 'ui' or 'ui/field'.
+
+commit a8d04182e628a32420c696f491f68b248a995ae1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 15:00:11 2005 +0000
+
+    Allow trailing comments.
+
+commit f368d2e423efffdf8bdc2fae6c4c7d69ead13516
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 14:59:31 2005 +0000
+
+    Use more D_OOSHM().
+
+commit b460ee004020e1d02f092c4a71d8b3bec2814cff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 14:57:01 2005 +0000
+
+    Fixed warnings.
+
+commit 77eba9bae5ee19cb222c80be2c74028861ea214a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 14:55:39 2005 +0000
+
+    Added -Wno-strict-aliasing.
+
+commit e231543297cfea4d58101bbc4a52d557a9002b0e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 14:36:56 2005 +0000
+
+    Don't toggle lock states repeatedly when holding a lock key.
+
+commit 40c2c5d069aa7ef57d0f464fe113c637ccd92e79
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 9 14:33:01 2005 +0000
+
+    Install internal headers for now.
+
+commit 541da61289915f76a01d6eeba7b8bcde17ff37ff
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Dec 9 12:59:36 2005 +0000
+
+    Use front_buffer in SetRegion() and back_buffer in FlipRegion().
+
+commit fe4ff9bd077562ce36e92626cbaa87395790ece5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Dec 9 12:40:52 2005 +0000
+
+    G200 BES doesn't support color adjustments.
+
+commit 354e60d06e53326bc5b3c93dbe7ae127625b2d17
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 8 21:46:30 2005 +0000
+
+    Don't advertise DFXL_STRETCHBLIT when it hasn't been checked.
+
+commit db5bc68d97a833872e6d5746b1d172c5bc62e17d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 8 20:36:27 2005 +0000
+
+    Added missing DSPF_ARGB case.
+
+commit b8b3b4328cb882a4c95cb252e07a3fc2c855b570
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 8 20:33:04 2005 +0000
+
+    - Fixed color keying mask.
+    - G100 doesn't have TEXCTL2 so TEXTRANS must be used to disable color keying.
+
+commit 843fcd7be3f1280c170729e167e2b56d74eec3f1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 8 20:13:27 2005 +0000
+
+    Fixed YUY2/UYVY and texture LUT state handling.
+
+commit b84d51c57bd4619ba91e8d63714d8295264167ca
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 8 19:13:13 2005 +0000
+
+    Fixed rectangle intersect functions.
+
+commit b151b155b7f037384bf9533de525b3932cdaaca4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 7 19:19:55 2005 +0000
+
+    test
+
+commit 113e1bc1cf038619ccc14f371e97639fe96501fa
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Dec 6 02:32:02 2005 +0000
+
+    Fixes for G100 with SDRAM.
+
+commit fac82aaf020f2cddf4960982223e92e11982ce85
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 4 21:06:46 2005 +0000
+
+    Added Gunze Touchscreen driver, thanks to Nathanael D. Noblet <nathanael@gnat.ca>!
+
+commit 0085667e71a981a82656e0b2baf72d318e293cce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 1 18:55:12 2005 +0000
+
+    cvs test
+
+commit 54a05e7bf30a9644c37b261a785eb86bc51adfd3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 1 18:52:33 2005 +0000
+
+    test2
+
+commit 0662da8f5de561ff5b0344a95b1eddbfe63f7df0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 1 18:48:21 2005 +0000
+
+    cvs test
+
+commit a80b270fcadc6532254e4e07c5d45dfa0eb1753e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 12:58:42 2005 +0000
+
+    Fixed a cut-and-paste bug.
+
+commit 86a3bdfc78094bea23eb533b25c9dc2ae2e4b75d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 11:38:08 2005 +0000
+
+    Limited support for DSBLIT_SRC_PREMULTIPLY.
+
+commit c91d670c62da02987df268c5623b57c655a4cf07
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 11:07:33 2005 +0000
+
+    Support for DSDRAW_SRC_PREMULTIPLY.
+
+commit 2ccdb5f94dafcaaa820fabebef550e42d0b1ee42
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 10:52:50 2005 +0000
+
+    Completely untested PPC support.
+
+commit 8cc254dd99e2116e9171e542741fc08ee54baf00
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 10:41:37 2005 +0000
+
+    Added support for DSDRAW_SRC_PREMULTIPLY and DSBLIT_SRC_PREMULTCOLOR.
+
+commit 5b3d80ffe8c9d64551cdfaff54bba4f8e7e006ad
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 10:10:40 2005 +0000
+
+    Use DITHER_EN and SCALE_PIX_EXPAND only when color bits < 24.
+
+commit e01fb997733015324b158976df32cbf288ebbc8a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 10:08:40 2005 +0000
+
+    Avoid chip lockups with destination color keying.
+
+commit 24df2355bb907366b3dbd5d443badfc751aeb3ea
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 09:24:18 2005 +0000
+
+    Enabled SCALE_Y2R_TEMP.
+
+commit ad6fe6cc01b2bbb8dac1668e8b063d6de5337d7d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 09:22:05 2005 +0000
+
+    OVERLAY_EXCLUSIVE registers aren't supported on rev. A chips.
+
+commit 22efa76598be431fc82963a23b10d80ed87bcb46
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 09:17:47 2005 +0000
+
+    Check the chip type in ovSetColorAdjustment().
+
+commit 8ce0dae79b5991010300e09b111f4e67b9d03da4
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 09:13:51 2005 +0000
+
+    Fixed color keying on 264VT2.
+
+commit 4c168edd661a7af01e6a00fb8c73967628b03642
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Dec 1 08:59:46 2005 +0000
+
+    Fixed surface size limits.
+
+commit 2fb6bceccb5c74f6ad4956f6b9a2059fd617871f
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Nov 26 14:32:26 2005 +0000
+
+    Don't overwrite the last char of info->desc.name with EVIOCGNAME.
+
+commit 782df7dad8eae7f8d95dc106fcca75facab86250
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Nov 26 13:45:58 2005 +0000
+
+    Minor cleanup.
+
+commit 4dc2827318b27c3c4da6dab75c7dc14dc7b04019
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Nov 26 13:42:12 2005 +0000
+
+    Fixed scaler/texture color key for chips < 3D Rage Pro.
+
+commit a104f56c4f131d5efefbb14cb6303cfd6d54163f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 24 12:35:38 2005 +0000
+
+    Added DIRECT_SIGNAL_ANY as a replacement for the magic -1.
+
+commit 3223f341a7c0b81d6218a469f28c1fe54fee1907
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 23 17:18:53 2005 +0000
+
+    test of new server
+
+commit 939a5c784979d266f9f1324e73f7c59d760cebf0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 23 14:18:58 2005 +0000
+
+    Removed dependency on -D_GNU_SOURCE when including <direct/util.h>:
+    
+    Made direct_util_recursive_pthread_mutex_init() non-static-inline.
+    
+    Removed DIRECT_UTIL_RECURSIVE_PTHREAD_MUTEX_INITIALIZER and replaced all
+    of its occurences by PTHREAD_MUTEX_INITIALIZER. These didn't need to be
+    recursive. If there's a recursive mutex required, you can still use the
+    utility function direct_util_recursive_pthread_mutex_init().
+    
+    Removed -D_GNU_SOURCE from direct.pc and directfb-config.
+
+commit fb2086a780330031274279555e7511b0a26e83f4
+Author: Mark Adams <marka@directfb.org>
+Date:   Tue Nov 15 16:00:47 2005 +0000
+
+    Silence warning.
+
+commit 5d615d198e095608edbb0f55cbb7c0fc6babce88
+Author: Mark Adams <marka@directfb.org>
+Date:   Tue Nov 15 15:51:15 2005 +0000
+
+    Overhaul of LEVELS, OPACITY and primary ALPHACHANNEL features which were
+    previously only partially implemented and did not work together.
+    
+    The video overlay and the primary layer now both support the OPACITY option
+    and either can be on top.  The order is determined by the 'level' assigned
+    to the video layer.  The primary also supports an alpha channel which is
+    useful when the video layer is positioned behind.
+    
+    The old DFB_CLE266_UNDERLAY environment variable switch has been removed.
+
+commit a4377c63d838ae49e81653600bf6e9d5639ecd91
+Author: Mark Adams <marka@directfb.org>
+Date:   Thu Nov 10 10:26:15 2005 +0000
+
+    New acceleration:
+    - ARGB4444 as source and destination pixel format for all supported
+    operations.
+
+commit f1ac90cc099d900d33645be4c185bde492b3eb11
+Author: Mark Adams <marka@directfb.org>
+Date:   Tue Nov 8 19:31:21 2005 +0000
+
+    Added missing fifo space checks and corrected an excessive allocation.
+
+commit f5ddab4126ee2d8bbfc056c6dc855aa927dfb92a
+Author: Mark Adams <marka@directfb.org>
+Date:   Tue Nov 8 19:29:11 2005 +0000
+
+    Fix 'unexpected pixel format' errors.
+
+commit dff7a5cbf96393921c6a18aed6337e6e72fbbe2b
+Author: Mark Adams <marka@directfb.org>
+Date:   Fri Nov 4 17:11:38 2005 +0000
+
+    Documentation updated to reflect the features and limitations of the
+    current code.
+
+commit f41c1d5e9953fefaa0367c069a25608ed7b9989f
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 16:16:45 2005 +0000
+
+    - Fixed Mystique vs. Mystique 220 detection.
+    - Made device_info->name a bit more verbose.
+
+commit ee2bc368905168d1141523553867199e126997af
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 16:13:13 2005 +0000
+
+    Remove unused variable.
+
+commit 9150ceaa6a75b17486b736c13a4256c3fe158be0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 16:08:09 2005 +0000
+
+    - Don't touch hardware in SetRegion() if nothing changed.
+    - Separated spic_calc_buffer() out of spic_set_buffer().
+
+commit 0d9335f3cfabba7c5c7d542ad974e8b4441973c3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 15:26:28 2005 +0000
+
+    Setting VIDRST bits is pointless as the hardware ignores them.
+
+commit a05184933fbd88a6c301f63fb879fe8fa0e71baf
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 15:11:14 2005 +0000
+
+    Forgot to include misc/util.h for dfb_region_intersect().
+
+commit bca23d880c5e4f13af6d167af82cab66e3bedf4c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 15:08:46 2005 +0000
+
+    - Disable BES if the destination region is completely off-screen.
+    - Renamed current_mode to mode because it's shorter :)
+
+commit 07222c75c9b465ec04cdb1d6daa13ba934fab806
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Nov 1 11:56:24 2005 +0000
+
+    - Allow surface height up to 2048 with DLOP_DEINTERLACING.
+    - Limit surface width with DLOP_DEINTERLACING to guarantee BESPITCH < 4096.
+    - Disable vertical filtering when surface width > 1024.
+
+commit d5b53c231dee836fc200e5169fb48238df337125
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Oct 31 11:41:23 2005 +0000
+
+    Added SendEvent().
+
+commit ff618c647fb60c799e6890e216fca27f41678304
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Oct 30 18:17:32 2005 +0000
+
+    Added IDirectFBVideoProvider::SendEvent() to send a window or input event
+    to video providers that supports interactivity (DVCAPS_INTERACTIVE).
+    
+    For cursor events, coordinates must be in the destination rectangle space.
+
+commit 127b8c524353fe3197ff1a49deab248067a8739d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 02:20:54 2005 +0000
+
+    Show "1k" again for '0 < bytes < 1024'.
+
+commit cec48179f09d30197ddc61a09d48b9a9c775d771
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 02:12:06 2005 +0000
+
+    Fixed warnings.
+
+commit 6e510a6e2e7f2f8579c72664a10e907c5c1a8990
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 02:03:11 2005 +0000
+
+    Fixed warnings.
+
+commit 23c57785394db1b1f4be09e92efe66e2486ac175
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 01:57:17 2005 +0000
+
+    Fixed warning: dereferencing type-punned pointer will break strict-aliasing rules
+
+commit 114d8e1c738215497e7c66b3c2b2921a1217bd74
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 01:47:18 2005 +0000
+
+    Avoid tons of warnings by using D_MAGIC_SET_ONLY instead of D_MAGIC_SET.
+
+commit 321594863aa186845180a836149dcea9d01172c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 01:46:40 2005 +0000
+
+    Added D_MAGIC_SET_ONLY which is D_MAGIC_SET without assuming that the magic
+    hasn't been set already. Useful to avoid compiler warnings when acting on
+    uninitialized structures on the stack.
+
+commit 8b4d2210a9b6b5e4ea2937a83e08ca3fbabbb9b8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 29 00:40:56 2005 +0000
+
+    0.9.25
+    
+    
+    Using the new Fusion Kernel API 2.0
+    - Parallel Fusion Worlds in one process via extended API
+    - Multiple Shared Memory Pools in one world via new API
+    - No race condition between (potential master) processes starting in parallel
+    
+    Fusion APIs have been extended to support different worlds and pools.
+    
+    Pass CoreDFB to graphics drivers as a new argument to driver_init_driver().
+
+commit 562028d388d8e9f26cb2e5f4850e389ab74af5c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 28 21:09:21 2005 +0000
+
+    Avoid division by zero if no video memory is available.
+
+commit 9ab7016f71d61059f190afccd579414a45c07fdf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 28 21:06:46 2005 +0000
+
+    Added D_OOM() message if thread structure can't be allocated.
+
+commit e2c4691f4bb46223ae2ba42a90eed56de50320d1
+Author: Mark Adams <marka@directfb.org>
+Date:   Thu Oct 27 15:56:28 2005 +0000
+
+    Added support for DLOP_FIELD_PARITY.  For this to work, the kernel
+    framebuffer must support an extension of the WAITFORVSYNC ioctl that
+    allows waiting for the top or bottom field.
+
+commit faaa1555d999ee67338a5945d8b16aefef0f6c3d
+Author: Mark Adams <marka@directfb.org>
+Date:   Thu Oct 27 10:38:17 2005 +0000
+
+    New accelerations:
+    - YV12, I420, YUY2 and AiRGB simple blits
+    - AiRGB 2D drawing
+
+commit 3e6f19d3b6cd1d9b7f3b0880d0b8adf316ad6f03
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 10:43:36 2005 +0000
+
+    Disable broken SetColorAdjustment implementation (already partly disabled).
+    Remove color keying diagnostic.
+
+commit 5aa72ae237fea0b35e3a47806c007ae961eb3064
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 10:37:45 2005 +0000
+
+    Round to nearest when positioning up-scaled YV12/I420 video to reduce
+    error.
+
+commit 1c48072fcf7c9c2009863d893f00041b32f25b38
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 10:34:55 2005 +0000
+
+    Fix YV12/I420 video layer corruption on revision 0x11 hardware.
+
+commit b8d2cfd4d1190de40980e7a167fb139639d977eb
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 09:37:28 2005 +0000
+
+    Fix bug setting SUBP_CONTROL_STRIDE register in uc_spic_set_buffer.  Sadly
+    subpicture layer still doesn't work.
+
+commit 6b95bde969c8ceb3389a1bf35fabf8aa6dd2d39c
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 09:34:45 2005 +0000
+
+    Fix hardware revision number detection and allow override via new config
+    option unichrome-revision=<rev>.  The revision number can only be
+    auto-detected if the process runs as root.
+    
+    Added simple script to determine revision number for addition to
+    directfbrc.
+
+commit c0c00a4b6f797dc976da1e23344f2d6831dc0f94
+Author: Mark Adams <marka@directfb.org>
+Date:   Wed Oct 26 09:26:44 2005 +0000
+
+    Added config option unichrome-revision=<rev> to manually set the hardware
+    revision number for the unichrome driver.  This cannot be determined
+    automatically unless the process runs as root.
+
+commit 2bdf900f76a13d528b9a838473587559b4f3a56a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 07:33:08 2005 +0000
+
+    Silence compiler warning.
+
+commit a93779d8d48a4e0f018dc836bb5e0177678cadc2
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 07:26:16 2005 +0000
+
+    - Finally remove DLOP_FLICKER_FILTERING.
+    - Don't reinitialize the whole TV encoder when changing field parity.
+    - Misc. cleanups.
+
+commit 4c0e111298a16efc15daefd3eb2134dec7d3c308
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 07:23:16 2005 +0000
+
+    Allow DSPF_ARGB surface + misc. cleanups.
+
+commit 53c13af3a58670b652798431656600a5ac34bec4
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 06:33:46 2005 +0000
+
+    PCI device ID cleanup.
+
+commit 58e392a7a1caff7f60e658ad12bba894fb63e8e3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 06:13:51 2005 +0000
+
+    Prefer /dev/shm over other tmpfs mount points with the same size.
+
+commit b74f892dbd0fe5ece7af3b35eb793772e3b1293e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 06:09:39 2005 +0000
+
+    In dfb_surfacemanager_allocate() do dfb_gfxcard_sync() only if hardware has
+    read from the buffer about to be kicked out. The call to
+    dfb_surfacemanager_assure_system() should already take care of the hardware
+    write case.
+    
+    Change dfb_surfacemanager_assure_system() to call dfb_gfxcard_wait_serial()
+    instead of dfb_gfxcard_sync() since we're only interested whether the
+    hardware has written to the buffer.
+
+commit b1b36f59a95bd1fc321bf099bc8e3b9501f1f13f
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 26 05:38:38 2005 +0000
+
+    Added FlushReadCache() to the graphics driver API.
+    
+    Used in the matrox driver to flush the direct access read cache.
+
+commit 6cc6de1ded1ccec798424d205947b2eefba2d151
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 25 14:45:30 2005 +0000
+
+    Include "libobject.make" for static builds in distribution.
+
+commit e24732ab81e9244437c2159f2bd47572e4cef81d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:20:42 2005 +0000
+
+    updated
+
+commit 23fcd1ec07ffbb070855899fca9963674a5ef9a9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:11:53 2005 +0000
+
+    0.9.24
+
+commit c356add186f08cd9254417d42b453d3b4c8dc5bd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:11:42 2005 +0000
+
+    Fixed warnings.
+
+commit 86d310934852aad912f3333418c847446c5d04f0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:11:29 2005 +0000
+
+    one more missing header added
+
+commit ea39d94aa9635422ecc260dc56ac2068bb7ee8c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:06:30 2005 +0000
+
+    Fixed a warning.
+
+commit f9bda56c9a1a63a44d8eaad1de046e3465d1f833
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 17:01:08 2005 +0000
+
+    Removed all checks for FB_ACCEL_* as fallbacks are in core/accelerators.h now.
+    
+    Don't build cle266 by default as it's obsolete because of the unichrome driver.
+
+commit b29482db505d6865c2e968f71e4165e0d483a725
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:58:19 2005 +0000
+
+    Added missing includes of <core/accelerators.h>.
+
+commit 050ef126dc428aac716ac37306034c2e591d39b3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:47:31 2005 +0000
+
+    No need for linux/wm97xx.h anymore.
+
+commit 2c115a96033a43f3450c216c665c7b031b23a3f8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:42:46 2005 +0000
+
+    Don't use fusion_reactor_free() too early in case of an error in init_devices().
+    
+    Thanks to "Jakub Bogusz <qboosh@pld-linux.org>" for this and other patches.
+
+commit 7afd787e8762a18e6a2fe6c6942237896512b194
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:40:46 2005 +0000
+
+    Added missing headers to SOURCES.
+
+commit f8c70edfcdbda3275c041d08d73a0fba5bf2d973
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:40:31 2005 +0000
+
+    Added missing types.h to SOURCES.
+
+commit 2ea2b5c32c37b046146e29710051536f41e2e15d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 24 16:40:14 2005 +0000
+
+    Added sisfb.h to SOURCES. Removed check for sisfb.h.
+
+commit d64523c0733df61bfeb0568477dfd366ec465984
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Oct 24 13:46:13 2005 +0000
+
+    IDirectFBVideoProvider::GetPos() returns DFB_EOF to notify end-of-playback.
+    After stream has reached the end, the next call to PlayTo() restarts playback from the beginning.
+
+commit 409199cfa6eb957d5367b4ece165a9e1d940820f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 23:38:50 2005 +0000
+
+    no more patches
+
+commit d47823532f67be7a8ede71c45ceff60105751ecf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 22:54:48 2005 +0000
+
+    Seems that sisfb.h is still required.
+
+commit acbc6c626c79779ebfc0631ac7efa7228dcba126
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 18:01:07 2005 +0000
+
+    New changelog and summary for 0.9.23 :)
+
+commit 4efa1d4d6c4f14c84fb0559f5360a5c39a09bfb1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Oct 18 14:37:39 2005 +0000
+
+    Plug a leak and add a comment about freetype bugs.
+
+commit b0ee0b88ece091c7264ccb7c77f100d6c97bcadd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 10:57:32 2005 +0000
+
+    Oops, somehow I managed to apply another patch with something already added :)
+
+commit 241e7cafec1ba50600b5a63e7b2161c35ef82974
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 10:04:52 2005 +0000
+
+    Added support for DSPF_ARGB4444.
+
+commit 25e6a28ef699fbda53b1a5ea77cc3a0848f4c39b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 10:04:21 2005 +0000
+
+    If during window creation the pixel format for windows with an alpha channel is
+    unspecified, don't always take DSPF_ARGB, but the layer's format if it has alpha.
+
+commit c7e0c35446f43ed0e1168649bee6e81ed2e2ca06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 10:02:20 2005 +0000
+
+    During flip using blitting, wait for pending writes to the back buffer
+    before issuing the blit command from back to front buffer to avoid lags
+    caused by too much queued commands.
+
+commit 8c2c8492949a6c40466fbfafb5ec90faba13b65f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 10:00:27 2005 +0000
+
+    For PNGs with alpha don't always suggest DSPF_ARGB, but the primary layer
+    format if it has alpha.
+
+commit bb4148c9341306abb40e85e56f54bf63524c685b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 09:59:30 2005 +0000
+
+    Don't abort if checking for LEDs fails.
+
+commit 134706f3b347f420d618a6a73446d2f05987d3a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 18 09:56:45 2005 +0000
+
+    Simplified regex a bit.
+
+commit e95a6dc94119fcc4cc1efb1e82d3e6c29a99448e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Oct 17 18:00:06 2005 +0000
+
+    Fixed segmentation fault when loading OpenType fonts.
+
+commit da18a5a083d72ce667707cccca33c43e368b93e4
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Sun Oct 16 05:12:41 2005 +0000
+
+    Removed the depth hard code to 24 and open the display in primary.c
+    to get its real depth.  Note this needs to be done a cleaner way since
+    we open close the display then reopen but its right.
+
+commit 88c65e1f8bec846962a70e50e4520526752a702c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Oct 15 08:26:06 2005 +0000
+
+    Ignore a return value of DFB_EOF from IDirectFBDataBuffer::PeekData().
+
+commit b168dacec35907a42d732c7fd8aded89cc356f3a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Oct 12 08:46:49 2005 +0000
+
+    Reduce probing context header to 64 bytes.
+
+commit 096ffa1348773d66ab6b28084810a709d45c5516
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 28 20:24:47 2005 +0000
+
+    Added Probe and Construct function pointer typedefs for casting to make g++ happy.
+
+commit d99b70fe738a76be1ef2c2877d697b185d46fe52
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 28 19:00:42 2005 +0000
+
+    Thanks to Damian Kowalewski <damian.kowalewski@mail.mcgill.ca> for fixing
+    artifacts produced by clipped triangles.
+
+commit 4c9f55bdeb484c5cec188a7ff5406c01d2fa71a6
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 26 14:04:51 2005 +0000
+
+    Support streamed data buffers.
+
+commit 5aabb8c117129096ace4c06af537ef987c593b4a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 26 10:40:11 2005 +0000
+
+    Follow IDirectFBDataBuffer changes.
+
+commit 01491e0f5126c49ae6447f855ea56a67c9c0cdf9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 26 10:39:15 2005 +0000
+
+    Added IDirectFBDataBuffer::Finish(): used to notify a streaming databuffer that
+    the end-of-file has been reached.
+    
+    After the method has been called, PutData() fails with DFB_UNSUPPORTED
+    while GetData() returns DFB_EOF unless there is still data to be fetched.
+
+commit 391e596c93564cf9e9bdd9d9a597623962a77fdc
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 26 10:27:54 2005 +0000
+
+    direct_stream_peek() and direct_stream_read() return DFB_BUFFEREMPTY if there is
+    no data available.
+
+commit 28c7cd7a6f055a0eab248301292c66c1c47eb51c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Sep 25 20:00:39 2005 +0000
+
+    Applied patch from "Stefan Lucke <stefan@lucke.in-berlin.de>" for better
+    touchscreen/smartpad detection.
+
+commit 2088c11908d06f6aa5c2682fed700ca78621d57a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 24 15:53:31 2005 +0000
+
+    In pipe_read(): decrement 'length' when reading from the cache.
+
+commit e32905316fce51d6ad37c39f7676ed852334202f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 24 08:54:43 2005 +0000
+
+    Lock the mutex before seeking.
+
+commit d710d0c92f6e9a04ac84b0058fa65eb5699389d5
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 24 08:53:33 2005 +0000
+
+    API change: direct_stream_seek() takes an absolute offset as argument instead of a relative one.
+
+commit 6fd8dd70d1cf10d1ead2261278d976cf07a6f4fe
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 24 08:30:59 2005 +0000
+
+    Return DFB_INVARG from direct_stream_seek() if absolute offset is negative.
+
+commit 46b1feb847f4772643194ffad07396112da41b60
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 23 13:44:00 2005 +0000
+
+    Use nanosleep() instead of usleep().
+
+commit d0fdd0b973f1969225d886da9a4857c28964e50a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 23 13:42:53 2005 +0000
+
+    Actually do no fail if IDirectFBDataBuffer::PeekData() returns DFB_BUFFEREMPTY,
+    opened file could be a device (e.g. /dev/video).
+
+commit 803a6227862c3217b76937318a10a5c1f3e52dbb
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 23 09:47:54 2005 +0000
+
+    Follow changes.
+
+commit e8d7705fd6c2e06c182cfa8fe072fba556bd8197
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 23 09:46:55 2005 +0000
+
+    Create Video Providers from DataBuffers.
+    
+    Added IDirectFBDataBuffer::CreateVideoProvider().
+
+commit cac69da8b6257148ea5b8601a7fdc7bf6856d060
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 22 16:37:24 2005 +0000
+
+    Added priority to video mode definition.
+    
+    Search for mode with highest priority.
+
+commit a2f07cf35b0463f1795072a219a949c5d42e0c88
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 22 15:11:30 2005 +0000
+
+    Added CoreSystemCapabilities with one capability until now: CSCAPS_ACCELERATION.
+    Probe for graphics drivers if this capability is set. Removed implicit version of
+    this check (the check for the accelerator).
+
+commit 23d1c3d515cfd36677a9fea1a98544b217e2e691
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 22 14:44:29 2005 +0000
+
+    Support fractional font sizes in API and FreeType2 Font Loader.
+
+commit ef3c4c8a1a61731be81df3f9ed571389a2633c03
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 22 13:44:32 2005 +0000
+
+    Reverted change of bool until I found out why it breaks the R200 driver
+    and possibly others (no hw blitting anymore).
+
+commit 45caa29ae93df5b75f0319526a50da3dc329f211
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 22 12:59:35 2005 +0000
+
+    Fix wrong size of bool.
+
+commit fb784c0af2c563b7b57db6e914bcd551768ca3b1
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Sep 22 09:22:01 2005 +0000
+
+    fbdev->shared->current_mode is now static and gets updated according to current var
+    when the video mode changes.
+    This way dfb_system_current_mode() always return the effective video mode.
+
+commit a75f8d4fbf32a37e711fa93d789078e6a564493c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 21 16:13:40 2005 +0000
+
+    Use DirectStream.
+
+commit 32d48a32a0203ad2624b8079f7f8ca69d2b6abbb
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 21 16:10:11 2005 +0000
+
+    Added DirectStream, a wrapper for accessing files locally and through network (http, ftp and generic tcp).
+    The API is derived from the IDirectFBDataBuffer interface.
+
+commit 6fe70d12cc3daeab6d463ff9cb1c2124d0591e35
+Author: Martin Lütken <ml@directfb.org>
+Date:   Mon Sep 19 22:48:27 2005 +0000
+
+    Small change just to be able to get help from DFB people
+
+commit a4c9b7fa573350905697dfe720aab3026eef0302
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 14 17:26:44 2005 +0000
+
+    Another patch from Mark Adams <mark147m@gmail.com> removing the check for
+    a real file name in CreateVideoProvider() to support Xine's MRLs.
+
+commit 3ef6c7983ada2802909dbc20e6336941561a2898
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 14 16:42:48 2005 +0000
+
+    If the master application only accesses the BES layer, current VideoMode is NULL;
+    in that case rely on the default VideoMode.
+
+commit 8018e8cc61b997aa7ae08781bde8a4be8a38c42e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 14 16:05:51 2005 +0000
+
+    Dropped down YUV Source Colorkeying.
+
+commit 18c3709af853431a53fb77d59866574242be4042
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 14 11:02:30 2005 +0000
+
+    Applied patch from "Mark Adams <mark147m@gmail.com>" fixing a rare crash
+    in the single application core. Thanks!
+
+commit 318f510a4b0e57f316ae633013e4ace127e1e109
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 14 08:36:30 2005 +0000
+
+    Added new input event flag DIEF_REPEAT indicating a repeated key or button press.
+    
+    Make usage of it in the linux_input driver.
+    
+    
+    Thanks to "Marko Mäkelä <marko.makela@hut.fi>" for the initial version of the patch.
+
+commit 3da874e2803d3271aac79eff7ac65443a5f9e6ab
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Sep 11 15:27:37 2005 +0000
+
+    Planar YCbCr deinterlacing.
+
+commit 8b592375042eeac3c2006e94889cea37cdaa9e73
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 7 10:18:02 2005 +0000
+
+    Fixed rendering to A8 surfaces (color must be replaced by alpha since the destination format is set to RGB8).
+    
+    Workaround to make byte-swapping work properly on big-endian machines (better than nothing for now).
+
+commit 2ccdbf17b6d05c02e19a2c4c7c65b1405d40c09e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Sep 6 12:51:15 2005 +0000
+
+    RGB24 byte swapping on big-endian hosts happened when the destination format was RGB32,
+    probably because of a patch applied for a different revision of gfx_util.c.
+
+commit 9836c81537583f27b45fdbe331b19d837777a961
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 3 10:41:58 2005 +0000
+
+    New supported values for mouse-protocol: PS/2, IMPS/2.
+
+commit 6c1a672d1e7773004e481db516e0f4a15c2e2983
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 3 10:40:07 2005 +0000
+
+    Display help for the following options: mouse-source and mouse-gpm-source.
+
+commit 89ceb472a2d785f60d21ccc18879549462c6dcae
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 3 10:38:47 2005 +0000
+
+    Added GPM support.
+    The moouse-protocol option specifies the protocol for
+    the mice or the repeater (supported values: PS/2 and IMPS/2).
+
+commit da3efadfd6ac7c7a26cd2c3f68117c6245a900cf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 2 20:09:11 2005 +0000
+
+    Suppressed some debug.
+
+commit d3dadc1b045cdc58d3c3b0b1ef6a28996353b8c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 2 19:59:56 2005 +0000
+
+    Fixed an evil dead lock that only occured by moving a window with one of
+    my new mice, having superior precision generating lots of events, thanks
+    for spotting this bug, Logitech :)
+
+commit 8af84ef7b2a96b0539099778701d0d59b0e8098b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 30 15:41:36 2005 +0000
+
+    Added universal event class for custom usage with variable size.
+    
+    New structure DFBUniversalEvent has a 'clazz' and a 'size' member. The clazz
+    is always DFEC_UNIVERSAL and the size is at least sizeof(DFBUniversalEvent).
+    There are no other members, but any amount of additional data may follow
+    according to the specified size. Best usage would be to derive from the struct.
+    
+    The pipe mode currently doesn't support universal events, because the event
+    size (write()/read() block size) is fixed to sizeof(DFBEvent).
+
+commit 2b2a778a7691fc737baea0b6974257f84b1f5f69
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 29 09:19:05 2005 +0000
+
+    Added direct_thread_set_name() for setting the name of threads that haven't
+    been created by direct_thread_create().
+    
+    Use direct_thread_set_name() in direct_initialize() setting "Main Thread"
+    if direct_thread_self_name() returns NULL.
+
+commit 9f07b205a7d81fb702fdd1a8431331a0ebcf13d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 29 09:17:06 2005 +0000
+
+    Added duff's device for 8 bit color keying.
+
+commit 23d409e357ecc5ebe63ed3760cbc5aa81ab831eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 29 09:15:52 2005 +0000
+
+    Added RGB332 and LUT8 support to dfb_surface_dump().
+
+commit 91492126ab383d76f9724199803207bd1d89fb8e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 29 09:15:03 2005 +0000
+
+    Added 'const' to DFBPaletteDescription\'s entries.
+
+commit 73255756d8d06eb95308ee9b67c5897f18ff3c57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 27 15:08:04 2005 +0000
+
+    Added low level logging abstraction.
+    
+    direct_log_create() is used to setup logging for the following types:
+    - DLT_STDERR  writes all messages to stderr
+    - DLT_FILE    writes all messages to a file
+    - DLT_UDP     sends all messages via UDP to a specific host and port
+    
+    direct_log_destroy() is obvious :)
+    
+    direct_log_printf() is a printf fashioned funtion to write a message.
+    
+    direct_log_set_default() sets the default log that is used when
+    no valid log is passed to direct_log_printf(), as done by all legacy
+    code for now. If the default is also invalid, stderr is used.
+    
+    Added runtime options "log-file = <name>" and "log-udp = <host>:<port>"
+    for configuring the default log.
+    
+    
+    On the receiver side start e.g.: "netcat -l -p <port> -u"
+
+commit 8ea8a38285bd3b9ede95baeb60cbc74db6a2178f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 27 14:07:48 2005 +0000
+
+    Added missing include.
+
+commit 67536932c229b35ae28c602acd335550a8987bb6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 27 14:05:03 2005 +0000
+
+    Fixed a warning.
+
+commit 8ca22f8333488c6a8c38b8b387dca245942d67d0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 26 10:02:30 2005 +0000
+
+    Take into consideration DSDRAW_DST_COLORKEY and DSDRAW_XOR when drawing strings.
+
+commit 440a3261fc1054fa01f1861c53ac8aba7d1fc52a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 26 10:00:58 2005 +0000
+
+    DSBLIT_XOR.
+
+commit 1bceb7e2417646a1bfe720bdfa261371e3dc67d9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 26 09:59:31 2005 +0000
+
+    Added DSBLIT_XOR.
+
+commit 8ef2c046d6cadfa7acedf4009e73acefd4cf8d2e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 23 15:26:47 2005 +0000
+
+    - FillTriangle,DrawRectangle,DrawLine (with Xor and Alpha Blend) on YUY2/UYVY/YV12/I420.
+    - DrawString (A8 fonts) on YUY2/UYVY/YV12/I420.
+    - Blit with Source Colorkey on YV12/I420.
+
+commit e0dc4ad4951668639c47e0415c7cdd64b62e6787
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 23 15:25:20 2005 +0000
+
+    dfb_color_to_pixel() returns (y@0, cb@8, cr@16) for I420/YV12.
+
+commit 83f515d8a2441416f9083bb5e4e75bfe42e1311c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 22 21:08:11 2005 +0000
+
+    Added fusion_object_get() that gets a pool and an object id and returns
+    the appropriate object with a local reference added to it. If the object
+    is not found DFB_IDNOTFOUND is returned, or any abnormal other error from
+    locking or referencing.
+    
+    Added FusionObjectID to replace plain int usage.
+    
+    Added D_MAGIC_* to FusionObjectPool.
+    
+    Added more D_MAGIC_ASSERT for FusionObject.
+    
+    Simplified fusion_object_pool_enum() using direct_list_foreach().
+
+commit 51677e66aeddb7258a5c49c484ff0aa0e860b7ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 18 13:20:00 2005 +0000
+
+    Fixed build_clipped_rectangle_outlines() to handle special cases
+    where width and/or height is/are one or two.
+
+commit cc504446887022abd12e104d00b4954c9c3f1060
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 18 11:18:11 2005 +0000
+
+    Added dfb_region_region_union().
+
+commit 15739b12f389e38456ef802adce072111b6b7e99
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 18 11:13:43 2005 +0000
+
+    Fixed a bug in direct_list_remove()!
+    
+    If the last item is removed while other items exist, the first
+    item's "prev" pointer was not updated (pointing to the last element).
+    
+    
+    Cast to (typeof(elem)) instead of (void*), to make C++ compiler happy.
+
+commit ce858d75ccfbc9ad837faaa57f966fb98499e770
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 15 13:40:54 2005 +0000
+
+    Lot of improvements and new features.
+    
+    Engine:
+      - Fixed all cache related problems.
+      - No longer _exit if a timeout occurs, try a reset instead.
+    
+    Acceleration:
+      - Added support for the following formats: LUT8, ALUT44, ARGB2554, AiRGB.
+      - Speed up font rendering by bypassing the TCL.
+    
+    Overlay:
+      - Fixed support for very high resolutions (dotclock >= 175Mhz).
+    
+    
+    Switched to version 0.2.
+
+commit 15eca8fd93a57335fc624f96e9897f64cf652e1c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 12 11:03:15 2005 +0000
+
+    Do not try to load the driver if the accelerator is -1.
+
+commit fbf15dbbba6398850b54112ace094d019351a44a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 12 11:00:56 2005 +0000
+
+    system_get_accelerator() returns -1 if mmio memory lenght is 0.
+
+commit 5c54a533eb0af58a23ea7e2cd3dac77c1b714828
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Aug 11 06:43:30 2005 +0000
+
+    Fixed a typo.
+
+commit 8caa3202616c1bb7ff9f497d4a99d3225717ab1f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Aug 11 06:42:52 2005 +0000
+
+    Missing copyright.
+
+commit a373338efcc3a3cc295e549891b0df2018e5642b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 9 13:15:42 2005 +0000
+
+    Fixed bug due to negative coordinates when the overlay goes outside the top/left border of the screen.
+
+commit 7c87cb4ce653263bcd8417cd649303abf820c696
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 9 08:17:28 2005 +0000
+
+    - Re-enabled the CCF_READSYSMEM flag on NV5/NV10 only for TextureTriangles().
+    - Made deinterlacing work properly with TextureTriangles().
+    - Pay attention to the DSCAPS_SEPARATED flag.
+
+commit e65a7482c140d3075755cdbc5456d06a3fef1365
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 8 13:04:24 2005 +0000
+
+    Fixed planar source cropping.
+
+commit a8b9045c367c8f4341a142f1fd47a7523a75b9f5
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 8 13:03:54 2005 +0000
+
+    Pay attention to the DSCAPS_SEPARATED flag.
+
+commit 0283d7888a6468b2aa51a6fa3dbb11726ebe8f5c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Aug 7 10:27:24 2005 +0000
+
+    StretchBlit() improvements:
+         When the suppplied blittingflags require to read from the destination,
+         source is scaled to the accumulator on start, otherwise scaling happens
+         when the pixels in the accumulator are written to the destination.
+         This way StretchBlit() is faster if source has not to be blended togheter
+         with the destination.
+
+commit 61d13145259257f408fe12b82e755416518bfbcb
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Aug 6 08:26:17 2005 +0000
+
+    Allow YV12/I420 deinterlacing.
+
+commit 55a9c0172952261608a133571e7657a672ef057d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 4 20:45:28 2005 +0000
+
+    Added -D_GNU_SOURCE as this script currently covers libdirect, too.
+
+commit 34317d738cf3573ce0668050ad45ab962b3ee1c4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Aug 3 10:56:59 2005 +0000
+
+    Option 'pci-id' renamed 'busid' (however 'pci-id' still works).
+
+commit 1698125f7e2452378385a0c09da77150a76a8931
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Aug 3 10:01:18 2005 +0000
+
+    If JFIF or Exif header detection failed, try detecting by filename extension.
+
+commit 6d85625c8956224f67ac5afc7b17b5e2b8a68206
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Aug 3 09:21:41 2005 +0000
+
+    Include <core/accelerators.h>.
+
+commit 07d5f258209578ac1e0042ca66fee68758a7786e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Aug 3 09:14:56 2005 +0000
+
+    Added a list of supported accelerators.
+    This avoid relaying on <linux/fb.h>, that could be a very old header,
+    and gives the possibility to add accelerators for other systems.
+
+commit 0255ed695e5dbbe6c315cd2e2d67b6dce38491e5
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 2 20:54:46 2005 +0000
+
+    If there is not enough video memory for textures buffer,
+    do not fail returning DFB_NOVIDEOMEMORY but simply disabable 3D acceleration.
+
+commit d9fd90296c25d0bb23e1130751748faaa3cf65e4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 2 17:00:01 2005 +0000
+
+    Deinterlacing.
+
+commit f17881a6b2aa4a136b1bfaa8238a248a491db8bb
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 2 14:06:08 2005 +0000
+
+    Deinterlacing.
+
+commit 564c13062a64164957b7b42c213b2650b228d2d5
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 2 09:04:15 2005 +0000
+
+    Replaced dfb_screens_register_primary() by dfb_screens_hook_primary().
+
+commit e497b8db39401cb53eea365f06ebf122733dad9d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 2 08:11:53 2005 +0000
+
+    Dacc_xor() at 64bit.
+
+commit 6664180f2be3869a20528a4101d70c3bca14a13e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 1 07:39:23 2005 +0000
+
+    Added some functions optimized for 64bit architectures.
+
+commit e55c57064b29ebfa1869b013d89928b85330eda2
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jul 31 18:07:59 2005 +0000
+
+    Optimizations on generic64_memcpy().
+
+commit 81f6bc57b18a62d5202a42f497aff9531e59d959
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jul 31 14:42:51 2005 +0000
+
+    Cast pointers to long instead of __u32.
+
+commit 9267d12ac866903e7eef86fb8448a249dc62dc7b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jul 31 11:04:41 2005 +0000
+
+    Fixed missing debugging symbols on AMD64.
+
+commit 70aa8a73b99722f7d0cd5d8c1be89dbafac29ec6
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jul 31 09:34:22 2005 +0000
+
+    MMX and SSE support on AMD64.
+
+commit e98ffa98f573af7acd1ec242e695f1f6a5fd686f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jul 31 09:31:53 2005 +0000
+
+    Ported to AMD64.
+
+commit 48f53c73335d7889d1290d13fb56972fc8d9655b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Jul 30 16:53:46 2005 +0000
+
+    Check if we are compiling for AMD64.
+
+commit ba704c43aa62f6c7a25e35da3cf4d37fdba59f2c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Jul 30 16:52:32 2005 +0000
+
+    Enable X86 memcpy()s on AMD64.
+    Added a generic memcpy() for 64bit Architectures.
+
+commit 50ffd957cba94eae6b88f88189653e64360eba7e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Jul 30 09:13:49 2005 +0000
+
+    dfb_screens_hook_primary() instead of dfb_screen_register_primary().
+
+commit e638f9948b39ac33fc8ba26a4745c26c84ee9c29
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Jul 30 09:11:55 2005 +0000
+
+    Added dfb_screens_hook_primary().
+
+commit 4a16d536c24c9952360ec4ca6d10558111860a33
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jul 28 12:30:44 2005 +0000
+
+    call $(AR) not ar. Fixes nothing yet since AR is always ar, for some strange reason.
+
+commit 153900c7f98b453c1d2c9b7e010914137d53aa03
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jul 27 14:09:41 2005 +0000
+
+    Use dfb_system_get_deviceid() instead of accessing FBDev system's private data.
+
+commit c77022f1a3e26d008ac3a067fff46316a3537409
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jul 27 14:07:04 2005 +0000
+
+    Added dfb_system_get_busid() and dfb_system_get_deviceid().
+
+commit bd2930fc462e706c5851e830319f206a3a6854d1
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jul 27 14:05:09 2005 +0000
+
+    Call pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ) when __USE_UNIX98 is defined
+    (PTHREAD_MUTEX_RECURSIVE is not a definition in LinuxThreads).
+
+commit ac59b8b44b21b9f17d39bb0c5e725d0c8307ff4d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 26 21:30:11 2005 +0000
+
+    On KallistiOS:
+    - do not call killpg()
+    - do not include dlfcn.h
+
+commit bbb4a2e18a6899fa92064a28bb577a5ed784516b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 26 21:07:08 2005 +0000
+
+    - only call pthread_mutexattr_settype() when PTHREAD_MUTEX_RECURSIVE is defin is defined
+
+commit feb728448e1fae2597921497a9f762f7eacf9380
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 26 20:58:50 2005 +0000
+
+    when compiling for KallistiOS define __* types another way.
+
+commit b80dab075edcbbf07734c9fdf7fe67845afa7878
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 26 16:47:15 2005 +0000
+
+    - dont check for libpthread when compiling for KallistiOS
+
+commit 2d0fd8679712ef7725205f0d21f7a5cad842f800
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 26 15:19:39 2005 +0000
+
+    some more BSD compatibility for linking statically
+
+commit e5736dc9c4a5c494790e009bc4e4289329a4b089
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 26 13:49:12 2005 +0000
+
+    Added ARGB4444 support, untested.
+
+commit c7ff8b2a5bad2917322bc643d007ecb2de948685
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 24 17:55:06 2005 +0000
+
+    Fixed wrong signature of DirectFBInit() and dfb_config_init().
+    
+    -DirectFBInit( int *argc, char **argv[] )
+    +DirectFBInit( int *argc, char *(*argv[]) )
+
+commit 5c99371dbd110ce88404346988e19f72809f88a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 24 17:42:39 2005 +0000
+
+    Was missing.
+
+commit e8ca623d7526e68517fa5a06b1465fb7f4657d6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 24 17:29:52 2005 +0000
+
+    Replaced old code by using direct_try_open().
+    
+    Fixes double negative in error message.
+
+commit d88a02e219cc1f076004123a4313f2f0567e4bbf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 24 17:09:40 2005 +0000
+
+    Added translation of
+    - KEY_FASTFORWARD
+    - KEY_SOUND
+    - KEY_QUESTION
+    - KEY_EMAIL
+    - KEY_CANCEL
+
+commit 46a7ab8ba61d441aa851fb3d03195e63b9b602ea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 21 21:43:35 2005 +0000
+
+    Protect against bogus siginfo_t pointer by checking if it's smaller than 0x100.
+
+commit 8fada1177e1daadc52a085490c6f6bcadcfc0834
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 21 21:34:03 2005 +0000
+
+    New configure option "--with-sysroot=DIR" lets you prepend a path to
+    the runtime library/module paths.
+
+commit ddcddb348a919152e81bbd8d67fc198fc415a013
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Jul 19 08:58:30 2005 +0000
+
+    Oops, written fbdev->shared->device.model instead of fbdev->shared->device.vendor.
+
+commit 87f5fa10efe469cc86d35cc3ca3c3c3e66bf25b0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Jul 19 08:53:21 2005 +0000
+
+    Applied patch by Vadim Catana <vcatana@registru.md> with some modifications due to last changes.
+
+commit 69a08d4c0471ce53943864fdf0b57ac66d4348d2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jul 18 19:07:19 2005 +0000
+
+    - BSD compatibility: changed "cp -af" to "cp -pf"
+
+commit 5dafc702460aff8b2895763f66ef3ba31e42a497
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jul 18 18:56:00 2005 +0000
+
+    - specify path when calling "find", improves BSD compatibility when linking statically
+
+commit 1d66c37a83b4d748ae848840ee0d7dbc89fd0be4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 16:28:19 2005 +0000
+
+    No longer need to link against libsysfs.
+
+commit 26ca622aa686781a088facd147ca50ced7dd5fbb
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 16:27:28 2005 +0000
+
+    Use informations stored in FBDevShared to detect chipset architecture.
+
+commit e96da2dc220a1b582368d6f74eb13fd2a81d0d67
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 16:26:21 2005 +0000
+
+    Use informations stored in FBDevShared to detect chipset identifier.
+    
+    No longer need to link against libsysfs.
+
+commit 4bbf6043c12d660353980d57c04a388961c57e2f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 16:24:38 2005 +0000
+
+    Added option 'pci-id' to specify the graphics card bus id (unused if sysfs support is enabled).
+
+commit 19aed80be4aa696d97ac3a170b05b4b8cacb6811
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 16:22:57 2005 +0000
+
+    The FBDev system is now responsible of retrieving the PCI Bus, Card Vendor and Device identifiers.
+    These informations are stored in the FBDevShared structure.
+
+commit b7d88f51038bfee28999acbbd4488837657710a4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jul 18 09:35:56 2005 +0000
+
+    Overlay supports deinterlacing.
+    Enable Gouraud shading for TextureTriangles() by default.
+    Rewritten chipset probe function (faster).
+
+commit 66e7126ad6f6b80cc48d2549d9450ff3f6219ab8
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Fri Jul 15 17:43:40 2005 +0000
+
+    Added vncserver url http://libvncserver.sourceforge.net to config warning
+
+commit 4b7b953d5643b18787aa6de11b6e15abf9f841ac
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Fri Jul 15 17:33:10 2005 +0000
+
+    Initial checkin of the vnc backend please let me know asap if I've broken anything.
+    Known bugs: The cursor support is munged
+
+commit 42ecca08e6e709f0b7224c451af0a2a926d133aa
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Jul 15 13:30:19 2005 +0000
+
+    When a layer is re-configured for deinterlaing, the corresponding IDirectFBSurface's capabilities aren't updated to include DSCAPS_INTERLACED flag; therefore test for DSCAPS_INTERLACED flag on the wrapped CoreSurface's capabilities in SetField().
+
+commit 2c6f8ba4b41a81b0f92ba3dd44de0c20963b0a2e
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Sun Jul 10 16:26:50 2005 +0000
+
+    there's no more need to look for sisfb.h
+
+commit 72e427039a3ca1363e5d8d88cdc9eb6ea6ffa3bb
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Sun Jul 10 16:25:41 2005 +0000
+
+    compatibility stuff for newer fb driver versions
+
+commit 5f051dfd18bc883ea1b02b0c15c52d48021f1841
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 10 00:11:37 2005 +0000
+
+    Fixed another warning.
+
+commit 12b84cd92ff27815878ba78b4a4b407fcc13ea60
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 10 00:06:40 2005 +0000
+
+    Fixed signedness warning.
+
+commit fd89d932c541d6f58071d74f6cec928eb021ce3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 8 06:33:44 2005 +0000
+
+    Use "signed char" explicitly to fix kerning on PPC, thanks to Uli!
+
+commit 9dc3b8ca38aa49ce6ad94a3a4e92ae065f443786
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 1 21:17:05 2005 +0000
+
+    Added:
+    
+    #define D_FLAGS_ASSERT(flags,f)    D_ASSERT( D_FLAGS_ARE_IN(flags,f) )
+    
+    static inline int direct_util_align( int value, int alignment )
+
+commit 4e2c8c2c55792002b9f2afffc00e6541b985dd03
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 1 21:15:33 2005 +0000
+
+    Fixed direct_try_open() not always honoring error_msg parameter.
+
+commit 1612a12f08391e0ba0544e550b4672eaf77694eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 24 09:19:59 2005 +0000
+
+    Added "Claudio Ciccani <klan82@cheapnet.it>" to main authors,
+    welcome number five and thanks for your appreciated work :-)
+
+commit 5149df555c64d9eaff82be596ba3e7215ff13229
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jun 22 21:48:20 2005 +0000
+
+    make w key work. it was missing in the translation code
+
+commit 3d5830470cb937129c910d86646b01a245c8f256
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 20 20:13:58 2005 +0000
+
+    Fixed warnings.
+
+commit 26add1263a82c1e3afe26214e194a1614e83cd26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 17 00:20:01 2005 +0000
+
+    Fixed mouse motion compression to eliminate massive input lag, e.g. cursor movement.
+
+commit 37b2730d7f8eb85afee130cb7e547738da3a8387
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 17 00:10:57 2005 +0000
+
+    Commented out locks as they shouldn't be needed, but cause a dead lock.
+
+commit 5c9e7b15656acbb8eabe71c6deb84611ea4b09ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 16 22:13:43 2005 +0000
+
+    Fixed typo.
+
+commit 0ec583a0c98d4c54d1b20c2677cbf3349d44eebb
+Author: Martin Lütken <ml@directfb.org>
+Date:   Thu Jun 16 20:58:36 2005 +0000
+
+    Disabled default X11 cursor
+
+commit e181bb7b3f76f56fdcff2ce055a756d59b117618
+Author: Martin Lütken <ml@directfb.org>
+Date:   Thu Jun 16 20:18:53 2005 +0000
+
+    Removed printf(ML: spam
+
+commit ebdb54b2406dac2093fb1f56213add6b3f4e57c8
+Author: Martin Lütken <ml@directfb.org>
+Date:   Thu Jun 16 19:24:53 2005 +0000
+
+    Fix input mask and missing input y-axis in mouse input
+
+commit 1b08d287b092e90159a06fcf6c265c5aedc645d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 14 12:49:53 2005 +0000
+
+    Fixed formatting.
+
+commit e702230692348ed50c59808040db79f6e558848b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 14 08:31:11 2005 +0000
+
+    Make sure that "dtest" is excluded from static lib.
+
+commit e14e1dd7d70a4d7a5da9dd26a92acfb1afbba71a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 14 01:00:03 2005 +0000
+
+    Option "-s" additionally shows the shared memory file size, now.
+
+commit d28a12f0512ff8f1a810328262be6a60ef18e20e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 14 00:59:07 2005 +0000
+
+    Put shared memory file size into heap structure for tracking.
+
+commit 3924365b5ed08e5b4ec5a3926f22948e678647cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 10 18:38:08 2005 +0000
+
+    Limit number of weights to 64 in x and y direction for down scaling.
+    Without this limitation down scaling to 1x1 or similar could take minutes
+    on embedded platforms.
+
+commit 43b15696735f1836f3572fa6b7d0e5d7c53af5b3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 10 08:23:46 2005 +0000
+
+    Rendering A8 font onto A8 should be fixed now.
+
+commit 10f1b356a0678fcacbbe4d5b0c189b86307de813
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 8 20:04:43 2005 +0000
+
+    Removed Bop_8_Kto_Aop overkill.
+
+commit 8a7d402bc0b709e0329da8f90f30dc8160b3616f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 8 18:26:48 2005 +0000
+
+    Use double quotes if header is in same directory.
+
+commit 11ab42ed3296a4cd698df888fa2f6817a24421a5
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jun 5 10:33:01 2005 +0000
+
+    Rewrite of the nvidia driver.
+    
+    Driver structure:
+    - Follows a common driver template (i.e. Matrox driver);
+    - Added a basic list of registers.
+    
+    Hardware support:
+    - Overlay supports Deinterlacing;
+    - WaitForSync no longer burns the CPU (but actually requires a 2.6 kernel);
+    - Decide texture buffer size according to available video memory
+      (<= 16MB -> 512Kb; 32MB -> 1024Kb; >= 64MB -> 2048Kb).
+    
+    Switch to version 0.5.
+
+commit 2c59b963d12aa4f43663c07385f6a73f0a90b14f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 2 18:27:18 2005 +0000
+
+    Started work on the decoration framework.
+
+commit 009dc5d39dc6c46118561f351c38089bdb76ab75
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 2 11:00:49 2005 +0000
+
+    Applied path from Sylvain Meyer <sylvain.meyer@worldonline.fr>, thank you!
+    
+            Hi,
+    
+        I did a small patch to fix minor issues with i830 gfxdriver. Now the
+    driver can more nicely live with the linux intelfb driver. Now it can be
+    used even when intelfb has accel set to 1, just in configuring in
+    /etc/fb.modes "accel false" to disable console acceleration when
+    DirectFB is working. To work, the last intelfb patch is needed. I just
+    sended it to linux-fbdev mailing list and Andrew Morton and it should be
+    in the next mm series of linux kernels.
+        I also fixed the ovlSetColorAdjustment function and now brightness,
+    contrast and saturation settings are enabled.
+    
+    Regards
+    Sylvain
+
+commit 33081a8e6db1e587b54bcde5a6daa961ed726987
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 2 10:37:12 2005 +0000
+
+    fixed warnings
+
+commit 0c7a6efd8ec219e2996f62b40adbb1bbb648198d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 2 10:34:08 2005 +0000
+
+    Fixed warnings.
+    
+    Changed statement with no effect (comparison) into an assignment.
+
+commit f3ae3806a88b6adc71a09952f4f508430e993823
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 2 10:33:17 2005 +0000
+
+    Temporarily add "-I/usr/X11R6/include" when checking for "X11/X.h".
+
+commit 6d443af1c64d3123d81c8f52e3d4cdea69cf563b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 1 12:03:49 2005 +0000
+
+    Fixed A8 font rendering onto areas that are not black.
+
+commit 56d0ada371c14b9f249f447272fd36f4d1055f6d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jun 1 09:45:27 2005 +0000
+
+    Acceleration for YV12/I420:
+      Drawing Functions:  FillRectangle
+      Blitting Functions: Blit,StretchBlit,TextureTriangles
+      Drawing Flags:      XOR
+      Blitting Flags:     BLEND_COLOR_ALPHA
+
+commit d31dd0add4e2cf5263bc719e9fd8dbcd7a23d28e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 31 07:02:18 2005 +0000
+
+    Hot fix crash during initialization.
+
+commit c2783ae43904e03b5f5f2c7bd29f1121a189c2f5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 22:49:44 2005 +0000
+
+    - now RGB16 really works (and ARGB1555)
+
+commit 664a475dbe0d0cb449ae871555abfd26697fc78b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 21:50:45 2005 +0000
+
+    - support for pixelformats other than ARGB
+
+commit a7e2d5564bfc2eea94cb0f8c95098ed03348e7e8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 21:26:37 2005 +0000
+
+    - added XInitThreads() call
+    - added README
+    - disable x11 system by default
+
+commit f372777c73acd1a562a7def9e6b783527b8edce8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 20:03:20 2005 +0000
+
+    added -I/usr/X11R6/include to X11_CFLAGS
+
+commit 2980dba3676336d8b2e5da460cbf5f609486c777
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 16:55:22 2005 +0000
+
+    - fix to make separated input driver work
+
+commit 41bcb86a5ce284b8d95ec32cd4215177f3d6659e
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 14:08:58 2005 +0000
+
+    forgot $(X11_DIR)
+
+commit 1ce7281f393d260f48669615e7b9b4d077c8301d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 30 13:57:44 2005 +0000
+
+    - added X11 system from Martin Luetken (nitram at lutken dot dk), thank you!
+    TODO: add support for non-24bpp modes
+
+commit 7610d5e0af22b232a5c9c1b156b646fd04069f0d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed May 25 09:40:44 2005 +0000
+
+    Always flush cache when switching to 2d/3d engine.
+    Disable 0-1 pixel clamp.
+    Set framebuffer location according to rdev->fb_offset.
+
+commit 759f598fa39811e0f805089886341e88f0c87189
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 22 20:56:46 2005 +0000
+
+    Added "bool error_msg" parameter to direct_try_open(). Used to suppress
+    the error messages when fusion_init() probes for a new world.
+
+commit 7d1a353886b857e9915d6cf355768751af8a8dc0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri May 20 16:48:01 2005 +0000
+
+    Added errorcode DFB_EOF.
+
+commit 61fd3505622e262051ddebcb275af1e6b0f883d5
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Mon May 16 01:44:39 2005 +0000
+
+    Changed fake keyboard mapping to actually work
+    the old code was sending codes not unicode chars
+    This is simpler but correct and lite works now
+    so I am going ahead and checking in.
+
+commit fa3bbf08c1890f971e62d66ac0445071ba61b597
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 15 00:27:27 2005 +0000
+
+    Some fixes related to touchpads.
+
+commit b658a4c972b4f817b730e499c7422cc78aefbcc0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 11 09:39:04 2005 +0000
+
+    Merged back multi app fixed from i830 driver. Not tested! Compiles at least...
+
+commit cb5b1fda6c5c39a01aa1365d9c0aca40e259f95a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 9 18:29:52 2005 +0000
+
+    Use the window stack of new contexts.
+
+commit 104772d2d3b422a3e274fa37cf22c686c9c234d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 9 18:19:49 2005 +0000
+
+    It's allowed to create and use windows in exclusive mode,
+    showing the own windows only, of course.
+    
+    Changed EnableCursor() to be allowed in exclusive mode, too.
+
+commit d65695f814a21eeba45eb64e8fa0ff028091f33d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 6 11:04:49 2005 +0000
+
+    test
+
+commit 732497b3359f0dae5731c7ccfc8db2787bfd0a26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 6 11:02:22 2005 +0000
+
+    test
+
+commit f89763d7dd06fb39b8fb6a8ae0600c0a8eb23c12
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 5 11:18:42 2005 +0000
+
+    Try old style device names, too.
+
+commit 5e6750dce07d521e78c5113bc3e10bffcaa36c07
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 5 11:17:08 2005 +0000
+
+    Fixed multi application support, but it only works with root privileges so far.
+
+commit 78f1268876451d527107e987f9652841b793bffe
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu May 5 10:09:29 2005 +0000
+
+    do not build i830 and savage driver if sys/io.h is not available
+
+commit b0f8fffd3b3d8b830fc85c49df6e1c65e6bbff05
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed May 4 16:16:04 2005 +0000
+
+    Improved Dacc_YCbCr_to_RGB_MMX.
+    Cosmetics.
+
+commit 8a2d5984b2cb204035b7d15ad3192011aef9f2ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 3 06:55:10 2005 +0000
+
+    small fix
+
+commit b43af50859f73e181393d470679bf5cf0d4ab795
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 3 06:48:33 2005 +0000
+
+    Added options "--system=" and "--wm=".
+    
+    Enhanced help text.
+
+commit f2d3d6d7dfb011c58dc6dc2c39b35c5d2025e411
+Author: Marcel Siegert <mws@directfb.org>
+Date:   Mon May 2 19:47:34 2005 +0000
+
+    added 2 special keys for dm 500 remote-control;
+
+commit 5af316dd5e494fe50d7529cb7cb8a25f77bd3431
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Apr 30 14:17:22 2005 +0000
+
+    Use tables generated by yuvtbl-gen for YCbCr<->RGB conversion (essential for colorkeying).
+
+commit efe1c9d3639d97791087c12564ea4ad09358690e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Apr 30 14:14:40 2005 +0000
+
+    Completed support for YUV422:
+    apart from Colorization, all blitting/drawing flags are supported
+    and we can convert YUY2<->UYVY.
+    
+    RGB->YCbCr is supported, too.
+
+commit b35609b62a21ad8f5470f34de23688b3578ace27
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 25 09:09:08 2005 +0000
+
+    Commented out usage of DST_PREMUTIPLY and DEMULTIPLY for now.
+
+commit 8d06837618e40a8bf3828db72f3d23d9a73c0e11
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Apr 22 15:34:30 2005 +0000
+
+    Fixed YUV422 clipping and blitting coordinates.
+    Simple blits with src colorkey.
+
+commit 641cff3727a03c0b8aa21079861374d3a04bee40
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Apr 20 09:18:19 2005 +0000
+
+    Fixed a bug in dfb_window_set_opaque (config.opaque.y1 instead of config.opaque.y2).
+    SetOpaqueRegion works again now.
+
+commit 065afbf721c52b45ea536915af6c0fab05635540
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 19 17:45:16 2005 +0000
+
+    Fixed 2d<->3d engine switching.
+
+commit 22955115b0b1be536020b5b0ab45078bcde34424
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 12 14:18:59 2005 +0000
+
+    Commented out checks that avoided hw state updates also when they're needed.
+
+commit 852f0ca9dbbf988c2e9c7d1fe40e3b32560aa8b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 12 14:05:16 2005 +0000
+
+    Use iopl(3) and check the return result before doing port IO.
+    
+    FIXME: Check out how setting via MMIO works.
+
+commit 3b1dd3accd70bb2c430e4f7505a86f7b176dddf0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 12 13:45:17 2005 +0000
+
+    Removed opacity from layer context, using opacity within region config only, fixes missing updates.
+
+commit da974b0cb430b5141c414e21add1b119d8a72bd5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 12 13:39:16 2005 +0000
+
+    Show max. axis and button if appropriate.
+    linux_input currently reports wrong values (num-1 instead of the highest one).
+
+commit bb4e9d0377ef3eabbbf46ae22f232b8275b42e14
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 12 13:17:37 2005 +0000
+
+    Modify surface's capabalities according to layer options after clearing them (not before!).
+
+commit 241d650b3f13f7bc58765feb675e98faec1ec3ec
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Apr 9 09:42:58 2005 +0000
+
+    DLOP_OPACITY.
+
+commit 19d6e2152b49657c045ad9e5b2a671a698c5c0e2
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Apr 7 13:10:45 2005 +0000
+
+    Sleep while waiting for vertical retrace.
+
+commit 97efc5f68495a30da5b8321dc4b9d94b7c5a72a7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 7 07:09:30 2005 +0000
+
+    Added DFBAccelerationMask to directfb_strings.h.
+
+commit f0de4f581629674756c12ee4c78c4b57e04dd063
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 7 06:33:38 2005 +0000
+
+    Added DFBSurfaceDrawingFlags to directfb_strings.h.
+
+commit 67890d66a5266ea58787a0df069164a8610b30de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 6 21:39:18 2005 +0000
+
+    Replaced driver vendor "convergence integrated media GmbH" by "directfb.org".
+
+commit 30ddbe9d6368a95aa6dd91f2cdcb5571d9fa5574
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 6 20:52:35 2005 +0000
+
+    Replaced IDirectFB::GetCardCapabilities() by GetDeviceDescription()
+    and DFBCardCapabilities by DFBGraphicsDeviceDescription which contains
+    additional information like device and driver name, version etc.
+
+commit 41ed91edb7afeb274d679f120820e589829f0d37
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 6 18:23:48 2005 +0000
+
+    Removed a pre-0.9.0 artifact: CardResult.
+
+commit 2563d559165dd9dccbe49e7264e06315a7054ea4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Apr 6 17:50:39 2005 +0000
+
+    Added support for ARGB1555,RGB16,RGB32 and ARGB.
+
+commit 3ce4b48b4d6dcb259eace2372ce6783646261bb7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Apr 6 12:35:50 2005 +0000
+
+    ARGB4444 supported as destination format.
+    DSBLIT_SRC_PREMULTCOLOR.
+    Fiexd overlay coordinates for RV250 and newer (offset x by 8).
+
+commit 6b7838034a93668e8fe83e1a40f72ad7189e3f33
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 6 05:33:35 2005 +0000
+
+    D_ARRAY_SIZE() is a signed int now (for simplicity).
+
+commit 18715d24665697ba1cdf69ba8566b6200830d229
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 5 17:24:56 2005 +0000
+
+    Dropped down RS200/RS250 chipsets (R100 based).
+    Added RS300/RS350.
+
+commit a2afb7f3712abfe799389641c9e37db83ed34f02
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 5 10:37:08 2005 +0000
+
+    Still on destination colorkey: green and blue were inverted.
+
+commit f5c6c9c41902c93c6b8499aa18cbf31a5cccd393
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 5 10:03:28 2005 +0000
+
+    Fixed destination colorkey calculation.
+
+commit a7d313bc62f7c4cbc32c40d8bcfc7711ef2ff7d9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Apr 5 08:56:35 2005 +0000
+
+    Removed DLCAPS_SRC_COLORKEY and DLCAPS_DEINTERLACING, they were tests.
+
+commit 3e408bd2ba0b41f377c4aca6b3a9357fb03876e8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 5 08:29:33 2005 +0000
+
+    Fixed minor typo (replaced "," by ";" in for statement).
+
+commit 880393adf42681de7c1a2837396f84c2c5eb78d9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Apr 4 20:30:49 2005 +0000
+
+    New driver for ATI Radeon R200 based cards.
+    
+    Accelerates FillRectangle,FillTriangle,DrawRectangle,DrawLine,
+                Blit,StretchBlit,TextureTriangles.
+    Supported Drawing Flags: Blend, Xor.
+    Supported Blitting Flags: Alphablend, Coloralpha, Colorize.
+    
+    Supported Destination Formats: A8, RGB332, ARGB1555, RGB16, RGB32, ARGB, YUY2, UYVY.
+    Supported Source Formats: A8, RGB332, ARGB4444, ARGB1555, RGB16, RGB32, ARGB, YUY2, UYVY.
+    
+    Overlay supports YUY2/UYVY/YV12/I420 formats, color adjustments and DST_COLORKEY.
+
+commit a821c072642d5e859140a6550761eb73f68b60f8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 2 21:22:11 2005 +0000
+
+    If the font format is ARGB, use premultiplied font surfaces.
+    Extracted common font state code into setup_font_state().
+
+commit bc1a3eb661a1db8ca9efea45996bf35eb75538e0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 1 07:07:10 2005 +0000
+
+    Use DECALDIS for A8 with colorizing though.
+
+commit 5d4f5409ce683ef88fafe25b3a159c11735fff77
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 1 07:00:42 2005 +0000
+
+    Implemented DSBLIT_SRC_PREMULTCOLOR using the Color ALU. If it's already
+    used for colorizing, simply modulate the color values with the alpha,
+    otherwise overwrite them.
+    
+    Set DECALDIS if and only if TMODULATE is NOT set.
+
+commit 7a4f301c3be38cb9c512e8c63477b2f21a12fe68
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 21:24:36 2005 +0000
+
+    If the destination has premultiplied alpha do real Porter/Duff SRC_OVER
+    composition for glyphs.
+
+commit 6fcbacbae9e210f2ae294b73aaba7b1cd485b430
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 21:10:30 2005 +0000
+
+    Changed Bop_a8_set_alphapixel_Aop_argb() to be a fast path for real SRC_OVER
+    DrawString() that uses DSBLIT_SRC_PREMULTIPLY and DSBLIT_BLEND_ALPHACHANNEL
+    with SrcBlend = ONE and DstBlend = INVSRCALPHA. Other formats will follow.
+    
+    Fixed DSDRAW_SRC_PREMULTIPLY if used used without blending.
+    
+    Implemented DSBLIT_SRC_PREMULTCOLOR.
+    
+    Added optimization for drawing blended with Src = ONE, Dst = ZERO.
+
+commit afce0acbceaeb08afdb8deb313b6050a489e8884
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 20:53:11 2005 +0000
+
+    s/0/DSCAPS_NONE/
+
+commit 8fce05739333086d0300c81733f51234c3ffa68c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 14:05:43 2005 +0000
+
+    Take over DSCAPS_PREMULTIPLIED from the configuration.
+
+commit 25dde4b7ecd26d7268184a3a3de1c60a58211cbb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 14:04:22 2005 +0000
+
+    Use DLCONF_SURFACE_CAPS if DSCAPS_PREMULTIPLIED is
+    requested for a fullscreen primary.
+
+commit 5981ec02e12d608029257d95c1d13cc22f76830b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 13:24:37 2005 +0000
+
+    Implement window opacity (Ac) for premultiplied windows
+    by using DSBLIT_SRC_PREMULTCOLOR.
+
+commit 349072fb98934ce246f7624b6a45b28cf439c4b7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 13:21:52 2005 +0000
+
+    Added DSBLIT_SRC_PREMULTCOLOR which modulates the source color with the
+    color alpha value only.
+
+commit a9ea5dacf7a8a1f443e80fbf30b4e941bcdef4f0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 08:58:31 2005 +0000
+
+    Changed an assertion in _fusion_reactor_process_message() to an assumption for now.
+
+commit c1dde73d573555705119fd170174dc583b232e20
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 08:53:56 2005 +0000
+
+    Added D_MAGIC_ASSUME.
+
+commit 3742de423610c8c436d6904db29ac3c79b401648
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 08:26:52 2005 +0000
+
+    Added notes about the coefficient 'Ac' not always working properly, yet.
+
+commit 24178e5190498d0e1fc89894623a90af400a1fb3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 07:45:42 2005 +0000
+
+    Support premultiplied cursor shapes.
+
+commit 07c2da34296a12adc33fe89d5f20348487534579
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 31 07:43:13 2005 +0000
+
+    Show 'premultiplied' surface capability.
+
+commit 08b853e5cec53d1081702cdf879be8d976f65c8b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 30 16:31:47 2005 +0000
+
+    Fixed recent 24bit fix. Maybe the patch applied at the wrong offset?
+
+commit 5cc35122fda7bccfb294948ecc8ce308254c1ae3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 30 15:56:24 2005 +0000
+
+    reverted (wrong file commited)
+
+commit a06091abaae11be3cf935aabc1a2a89d2859c808
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 30 15:54:45 2005 +0000
+
+    Premultiply image data when loading into premultiplied alpha surfaces.
+
+commit 9434edc4676c577286f2cfa105c96b78bd49da60
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 30 12:39:16 2005 +0000
+
+    Handle (non)premultiplied window and layer surfaces.
+    Always use compliant Porter/Duff SRC_OVER.
+    
+    Different compositing methods are used depending on the destination format.
+    
+    
+    DESTINATION WITH ALPHA
+    
+    /*
+    Cd = destination color  (non-premultiplied)
+    Ad = destination alpha
+    
+    Cs = source color       (non-premultiplied)
+    As = source alpha
+    
+    Ac = color alpha
+    
+    cd = Cd * Ad            (premultiply destination)
+    cs = Cs * As            (premultiply source)
+    
+    The full equation to calculate resulting color and alpha (premultiplied):
+    
+    cx = cd * (1-As*Ac) + cs * Ac
+    ax = Ad * (1-As*Ac) + As * Ac
+    */
+    
+    dfb_state_set_src_blend( state, DSBF_ONE );
+    
+    /* Need to premultiply source? */
+    if (! (window->surface->caps & DSCAPS_PREMULTIPLIED))
+    .     flags |= DSBLIT_SRC_PREMULTIPLY;
+    
+    /* Need to premultiply/demultiply destination? */
+    if (! (state->destination->caps & DSCAPS_PREMULTIPLIED))
+    .     flags |= DSBLIT_DST_PREMULTIPLY | DSBLIT_DEMULTIPLY;
+    
+    
+    DESTINATION WITHOUT ALPHA
+    
+    /*
+    We can avoid DSBLIT_SRC_PREMULTIPLY for destinations without an alpha channel
+    by using another blending function, which is more likely that it's accelerated
+    than premultiplication at this point in time.
+    
+    This way the resulting alpha (ax) doesn't comply with SRC_OVER,
+    but as the destination doesn't have an alpha channel it's no problem.
+    
+    As the destination's alpha value is always 1.0 there's no need for
+    premultiplication. The resulting alpha value will also be 1.0 without
+    exceptions, therefore no need for demultiplication.
+    
+    cx = Cd * (1-As*Ac) + Cs * As*Ac  (still same effect as above)
+    ax = Ad * (1-As*Ac) + As * As*Ac  (wrong, but discarded anyways)
+    */
+    
+    if (window->surface->caps & DSCAPS_PREMULTIPLIED)
+    .     dfb_state_set_src_blend( state, DSBF_ONE );
+    else
+    .     dfb_state_set_src_blend( state, DSBF_SRCALPHA );
+
+commit 3ae97148f35c2c7b1b17227e4de5a779cfa96931
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 29 11:11:23 2005 +0000
+
+    Added dfb_gfxcard_invalidate_state() which sets the state pointer to NULL
+    and therefore forces a full SetState() before the next operation is executed.
+
+commit 172da343256298842822cf5271e96712728e1ef2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 29 10:42:16 2005 +0000
+
+    Fixed plane multiplier of NV16.
+
+commit 236c0f4c2f7bf60392a757c05d43388fcb22ef85
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 27 19:33:45 2005 +0000
+
+    Added DirectFBSurfaceBlittingFlagsNames.
+
+commit 83b29735dff50a759a274f6cb55eb1a8e16c445c
+Author: Marcel Siegert <mws@directfb.org>
+Date:   Sun Mar 20 20:21:01 2005 +0000
+
+    build fix for default wm
+    __u8 p was declared at wrong place;
+
+commit 0a4827266e63816c853634b3c1e7873aee7fc4e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 20 13:08:04 2005 +0000
+
+    Applied patch from Mark Salter <msalter@redhat.com> to fix 24bit support
+    on big endian platforms. Thanks!
+
+commit a3b664abec79c239ba78a7e1b6c65a2454dd777f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 20 13:02:51 2005 +0000
+
+    Applied patch from Ivan Daniluk <ivan@shvydko.ua>:
+    
+    Hi!
+    Recently I've got strange behavior with MuTouch input. The trouble was in
+    packet reading routine - in some cases(very fast touch-untouch) packet was
+    read in two passes and was interpeted as two events with wrong coordinates.
+    In attached patch I've added filling packet with data until it's size grows to
+    desired packet size.
+    As well, added syncronization check for each packet - it will prevent some
+    weird situations on misconfigured devices.
+    
+    Cheers,
+    --
+    Ivan Daniluk
+
+commit 7f042827957f8ee4f17b768d6a49bc0c868e10ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 20 12:59:49 2005 +0000
+
+    Maximum number of simultaneously pressed keys increased from 8 to 16.
+    
+    Thanks to Ivan Daniluk <ivan@shvydko.ua>.
+
+commit 17894090d21ffcba620c4bf28b334ea56ec37d97
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 20 12:58:34 2005 +0000
+
+    Use D_DEBUG_AT.
+
+commit 6be13f5c78a9d646642585d78cb85474001a1d2e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 18 23:33:01 2005 +0000
+
+    TODO
+    
+    Move config system to libdirect with more features.
+    
+    Write well documented driver skeletons.
+    
+    Add core cursor component with animated shape support and better integrated
+    changes caused by entering different windows.
+
+commit 3b32a47605451693ea0b5b4bd81210de9f954dec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 18 23:30:31 2005 +0000
+
+    Hotfix to show the cursor after entering a window with a cursor that is made
+    invisible by another application.
+
+commit aa1a1b12f2171d5bf8c0686a36d5f1f1f00c6b99
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 17 10:28:40 2005 +0000
+
+    Allow predefinition of FREETYPE_CFLAGS and FREETYPE_LIBS outside of configure.
+
+commit c677d13005edbfcb3036cd7ccbc4a1bb9e87a0d7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Mar 12 09:49:41 2005 +0000
+
+    Added macros to convert ARGB1555,RGB16,RGB32 to ARGB2554,ARGB4444.
+
+commit 0ba7ce64a05cbf8ef5521d928665d8f2232b3d21
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Thu Mar 10 17:43:37 2005 +0000
+
+    Hide the SDL cursor so DirectFB one shows
+
+commit e11edb46b9308e4adfdba94b05114cd10e76c2fd
+Author: Mike Emmel <memmel@directfb.org>
+Date:   Wed Mar 9 17:57:39 2005 +0000
+
+    Added support for fake scancodes this needs to probably move to a more generic layer so it can be used by backends that don't provide scancodes.
+
+commit 41d3c4d990b121f04aeecb61d1b7438b5185fcbd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 9 15:21:55 2005 +0000
+
+    Build driver only if FB_ACCEL_I830 is defined in <linux/fb.h>.
+    
+    Probe for FB_ACCEL_I830 in the driver.
+
+commit d4c0b18ccae20b075efe11cbcc970588177ec176
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Mar 9 10:38:38 2005 +0000
+
+    Made the driver work with the new nvidiafb framebuffer driver.
+    StretchBlit() on A8,LUT8,RGB332 (>= NV20).
+
+commit 4a48af0d9fae66b86b47a723b39704f8f735c209
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 7 21:45:46 2005 +0000
+
+    Cosmetics.
+
+commit abb420e29a0f063d3ced3c78ed9d1f26f411878f
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 7 21:37:49 2005 +0000
+
+    Some mach64_waitfifo() calls were missing.
+
+commit df07da0371b6a4ebc2a8cbbb9a6254a6b57d896c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 7 21:34:15 2005 +0000
+
+    Reset HW_DEBUG in EngineReset().
+
+commit 29aba4d3d46d404803741113392387735c1b00a9
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 7 21:25:23 2005 +0000
+
+    Reset otherwise unused registers in SetRegion() when CLRCF_ALL is set instead of InitLayer().
+
+commit 4188f67e31d54c46f03c1759422639302d96a75b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Mar 4 14:25:56 2005 +0000
+
+    FillRectangle(),DrawRectangle(),FillTriangle(),DrawLine(),Blit() on LUT8,RGB332 and A8.
+    StretchBlit(),TextureTriangles(),[DrawString()],Alphablend and Colorize from A8 (>= NV10).
+    Alphachannel blend for ARGB1555.
+
+commit 02702315c30b0e29a450d1a6c82a9b220a7484d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 4 13:34:46 2005 +0000
+
+    Implemented destination color keying.
+
+commit 3ea54379117258e7781f218b7aa965fac848bc3a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 3 17:33:24 2005 +0000
+
+    Fixed AltGr.
+
+commit 65aca601076923a8f217664eb486c165dd1372ee
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Mar 3 11:07:00 2005 +0000
+
+    Always use alphamode = ALPHACHANNEL.
+
+commit b97fd4a79e6948bf83d3f28a23e82e0fa42dea3b
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Mar 2 23:36:17 2005 +0000
+
+    Don't care about LOG_MAX_INC.
+
+commit 8f0f3e61c75b11a8c012985ebfaf01c8706a5636
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Mar 2 21:10:49 2005 +0000
+
+    Fixed pixelformat=NV21 option.
+
+commit fad49386821bc431bc960e8f6571f9cce0b1a35c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Mar 2 21:02:57 2005 +0000
+
+    Fixed inverted YV12 colors.
+
+commit 6440e30ed0457e09fdd8d20ac00ff562a5ad0193
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 2 12:45:57 2005 +0000
+
+    Keep the original display offset if no mode has been set,
+    e.g. just running "dfbinfo".
+
+commit 73b9b419dbe9967fc982008aa38a386c4b12a089
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 2 12:42:16 2005 +0000
+
+    When restoring the video mode during shutdown, set xoffset and yoffset to 0.
+    
+    This fixes wrong scroll offset after quitting a DirectFB master started as
+    a normal user from a console.
+
+commit fd83d2275755b7b9272f6c390ca73d89faeb0dc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 2 12:36:24 2005 +0000
+
+    Improved description of required permissions to devices etc.
+
+commit 8a0bc0d96394f13d0ba78edd3c5d8e3b67419349
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 1 15:53:42 2005 +0000
+
+    Big acceleration code update:
+    - Scaler/3D acceleration now works on older GT chips. Tested on Rage II+
+      and IIC.
+    - Splitted SetState() to GX/CT/VT and GT variants.
+    - Added scaler source size check. Limits found empirically.
+    - Removed explicit fast fill/block write code. Use the automatic feature
+      found in 3D Rage Pro and newer chips instead.
+    - ARGB4444 support for GT chips.
+
+commit b9311e7a29e8ea613bf87d67cacc4459ba5be555
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 1 15:49:47 2005 +0000
+
+    Big overlay code update:
+    - 3D Rage and 264VT(2) apparently have somewhat different overlay/scaler
+      registers. Details were taken from the XFree86 ati driver.
+    - Improved surface size and format limitations. Limits were found
+      empirically and since I don't have every mach64 chip in existence some
+      limits may still be wrong.
+    - Take ECP (scaler/overlay clock) diviver into account in horizontal
+      scaling.
+    - Added support for doublescanned and interlaced display modes.
+    - Check updated flags in SetRegion() and try to update only the
+      necessary registers.
+    - Don't advertise DCAF_BRIGHTNESS and DCAF_SATURATION on older chips.
+    - Added support for DLOP_DEINTERLACING.
+
+commit 18fd75329b1eed28a7d48b0fc7f1ffa5936cd9d3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 1 15:46:01 2005 +0000
+
+    Made LCD register access work on 3D Rage LT.
+
+commit 6cc9ffff512c32b84fe3198b26e6d4a86431b8e6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 1 15:44:50 2005 +0000
+
+    Improved chip type detection.
+
+commit 52321fdf56ba0c4c877ef8317b61e707f82fb2b1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 1 15:42:55 2005 +0000
+
+    Cleaned up register definitions and added all known register names.
+
+commit a8024d861d8cfad53c5c933064c14a74204357b6
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 28 10:31:44 2005 +0000
+
+    Added support for system to video memory blits.
+    Improved TextureTriangles() performance.
+    NV30 supports StretchBlit(), blit with format conversion, alphablend and colorize.
+    Switch to version 0.4.
+
+commit d4e3db4fdcec5ac5098a5766c93e40473a799969
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 28 10:26:14 2005 +0000
+
+    Added support for system to video memory blits in hardware.
+
+commit fa6d3ad547ea5bf6d69144310b962e0522545eb9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 28 09:47:07 2005 +0000
+
+    0.9.23 /o\
+
+commit 54719ef051990718ddb5b002d38a49cf338d6588
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 28 09:40:58 2005 +0000
+
+    Added IDirectFBSurface::DisableAcceleration( DFBAccelerationMask mask ):
+    
+    If any function in the mask is set, acceleration will not be used for it.
+    Default is DFXL_NONE.
+    
+    
+    Added D_FLAGS_INVALID to check if a flag set contains invalid flags.
+
+commit c77446ff9485e5aec0f0acd15f58a63225420b4b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 28 09:11:59 2005 +0000
+
+    Fixed D_FLAGS_ARE_IN.
+
+commit f30c82bc7f789121f7041fe54a0c721edae33d93
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Feb 27 18:43:52 2005 +0000
+
+    Added DLCAPS_LEVEL to layer capabilities,
+    thanks to Stefan Lucke <stefan@lucke.in-berlin.de>.
+
+commit e630e09d4d858f11cc5ceca7ad595f2b4a415481
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Feb 27 17:49:44 2005 +0000
+
+    Updated to linux 2.6.10.
+
+commit 3cc3d7af1229362fe15be04e9b746fc10ec17c59
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Feb 27 12:13:38 2005 +0000
+
+    Updated patch.
+    Fixed NV30 initialization.
+
+commit 42327305b6ce45781f50c1de139c455ce237554d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Feb 27 10:57:01 2005 +0000
+
+    Made DIKS_PRINT work.
+
+commit a72ec467bf90d01037fd39a2973e130b188aae17
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Feb 27 10:43:44 2005 +0000
+
+    Don't try to use already grabbed devices.
+
+commit bf9f78dd373dfdafcc84ee9bef93505085adc53f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 24 14:52:00 2005 +0000
+
+    Remove directfb_keynames.h and directfb_strings.h during "make fistclean".
+
+commit 8d9e4b13fd5fd33d2de5ace53d4c41857db0e7c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 24 14:35:30 2005 +0000
+
+    Put all builddir includes in front of the srcdir includes.
+    
+    Still need to know if something like EXTRA_NODIST exists.
+
+commit da4f0a83a314bafd31de8427f08406281edcd017
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 24 14:13:11 2005 +0000
+
+    Use "$(top_srcdir)/include/" prefix to file argument of mknames.sh.
+    
+    Thanks to LUDER Jacques <JACQUES.LUDER@THALES-TRANSPORTSERVICES.COM>.
+
+commit e33942c6deb94c490914593d362dda87cbef15e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 24 14:05:05 2005 +0000
+
+    Summarized changes for 0.9.22 and generated new ChangeLog.
+
+commit 086837c7119bc3650dcb6b122da593808d853fe8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 24 14:03:44 2005 +0000
+
+    Fixed EXTRA_DIST.
+
+commit 073536ce77de3eedebd66d52b41346c958f900c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 23 12:24:15 2005 +0000
+
+    Show the correct device in error messages.
+
+commit 9b5dad02d6fae560a2e7b9f746a7c9120ae915fc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 23 10:57:33 2005 +0000
+
+    Added option "h3600-device", keeping the default of "/dev/ts".
+    
+    Added option "mut-device" which must be used to enable the driver.
+
+commit 1c04008cf36c0689fe4ce15f745c3f6489302e3c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 23 10:09:20 2005 +0000
+
+    Put this around bool enum declaration instead of #ifndef __cplusplus:
+    
+    #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
+
+commit 3363495835d87a1316d6bbd23a797b5276d8dc28
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 23 10:06:14 2005 +0000
+
+    Restore color adjustment when (re)activating a context.
+
+commit 33286a9809a0b41bf2c92df8dae4bea6300148c7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Feb 22 14:13:32 2005 +0000
+
+    Swap video buffers in single buffermode, too.
+
+commit 583bbb005a3a321a7cea9eece0e804a15503f4f1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 22 14:12:49 2005 +0000
+
+    Activate the most recent context instead of the primary context when the current context is removed.
+
+commit b3d08c2d1edc7138b92b2debabb2dacaee6ee872
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 22 12:57:05 2005 +0000
+
+    Added IDirectFBDisplayLayer::SetScreenRectangle().
+    
+    Rearranged some function pointers in IDirectFBDisplayLayer.
+
+commit 2630f8fee3791fe334322ade26f96c1c873843ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 22 12:28:39 2005 +0000
+
+    Added DSECAPS_BRIGHTNESS, DSECAPS_CONTRAST, DSECAPS_HUE, DSECAPS_SATURATION.
+    
+    Added DSECONF_ADJUSTMENT to DFBScreenEncoderConfigFlags.
+    Added 'DFBColorAdjustment adjustment' to DFBScreenEncoderConfig.
+
+commit bc1710e8b12c7ad14e723e81a3cb4a92f5837668
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 22 12:26:05 2005 +0000
+
+    Check capabilities in SetScreenLocation(), SetScreenPosition() and SetLevel().
+
+commit c4e04163827fff873a12604f34e3aba023343312
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Feb 22 11:40:34 2005 +0000
+
+    Do not round up X coordinate for 422 formats.
+
+commit ac35fd91cc772169109e54502c5a333e07876d3c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 22 11:31:27 2005 +0000
+
+    Fixed DLCAPS_ALL.
+
+commit 244e11fced4d3996f6b45bf9bb7008fe6fc833a0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 22 09:53:08 2005 +0000
+
+    YUY2/UYVY FillRectangle(), Blit() and StretchBlit().
+
+commit 87c020414496a5727e484b9055657b1a40b17af7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 21 21:07:03 2005 +0000
+
+    Removed DrawRectangle(),FillTriangle(),DrawLine() for YUY2/UYVY (don't work properly).
+    Added an hack to do StretchBlit() on YUV422 (result is almost acceptable).
+
+commit a4a8f50ac360a9666a89d65e0c4614fc3627b30d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 21 13:36:36 2005 +0000
+
+    Implemented hw window resizing.
+
+commit 338a7e914999c16669ccfb80b4506dbc6e74acb1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 21 12:06:30 2005 +0000
+
+    Propagate error to application if window movement failed.
+
+commit 9913d1eb31b8b8562bf544ac8151fce835379174
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 21 11:36:01 2005 +0000
+
+    Handle error if dfb_layer_region_set_configuration() failed to move a hw window.
+
+commit 9137fccebf1fdb3afb3555c97dd815ad6fef612e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 21 09:10:25 2005 +0000
+
+    No longer return a surface stored in system memory for YUY2 and UYVY;
+    return directly the video surface instead
+
+commit 12d9d6dbc6e30545bf2b8035b937051694ac1788
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 21 09:08:56 2005 +0000
+
+    Added FillRectangle(),DrawRectangle(),FillTriangle(),DrawLine(),Blit()
+    (without effects) for YUY2 and UYVY.
+
+commit f510b808528b4184031b69927a87e38c36abf8c0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Feb 21 09:07:09 2005 +0000
+
+    Optimized Bop_yuy2_Sto_Aop() and Bop_uyvy_Sto_Aop().
+
+commit 8b79c24cc4b81dc53e562f81399d328bfa71f9b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 21 00:22:05 2005 +0000
+
+    Added DLCAPS_SCREEN_POSITION and DLCAPS_SCREEN_SIZE.
+    These are set if DLCAPS_SCREEN_LOCATION is set and vice versa.
+    
+    Unscalable layers just have DLCAPS_SCREEN_POSITION.
+    
+    
+    Store normalized and pixel based destination area
+    in a layer context.
+    
+    Added CoreLayerLayoutMode which defines incorporation of
+    configuration based size changes and destination area values.
+    
+    +     CLLM_LOCATION,      /* Keep normalized area. */
+    +     CLLM_CENTER,        /* Center layer after resizing destination area. */
+    +     CLLM_POSITION,      /* Keep pixel position, but resize area. */
+    +     CLLM_RECTANGLE      /* Keep pixel based area. */
+    
+    
+    Default for layers with DLCAPS_SCREEN_POSITION only is CENTER,
+    otherwise it's LOCATION.
+    
+    After calling SetScreenPosition(), mode is POSITION.
+    
+    After calling SetScreenLocation(), mode is LOCATION.
+    
+    
+    Moved core abi definition to header file.
+
+commit e2b17de96abd7eb75375f10b07774d2653de1d6e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 22:08:39 2005 +0000
+
+    - Dropped I420/YV12 support for old chips.
+    - NV12/NV21 Blit() for >= G200.
+    - NV12/NV21 StretchBlit() for >= G400.
+    - Accelerated I420/YV12/NV12/NV21 FillRectangle().
+    - Separated all planar stuff to their own functions.
+    - Tried to make CheckState() functions a bit better looking.
+
+commit 7e91278bbade3d3519ce180c79d36442045bd847
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 15:39:13 2005 +0000
+
+    - Defined constants for CRTC2 register values.
+    - Alpha ramp support for CRTC2.
+    - Added support for progressive chroma on CRTC2.
+    - Added support for progressive half-height sub-picture.
+
+commit 8791331bdb4d1bfc72caf26f86ea29583ee3c6f6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 15:25:26 2005 +0000
+
+    Cosmetics.
+
+commit 5d4d46263f1ecb76f63bda2a27f336284791a2ea
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 15:22:33 2005 +0000
+
+    Added comment about flicker filter not working.
+
+commit f69791a8182d9d74462d8b74fcdb3f571cc83108
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 13:33:56 2005 +0000
+
+    init_region_config() forgot to initialize surface_caps.
+
+commit 60f105be89e2a28314df9306c96791e9999ecea2
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 18 06:45:48 2005 +0000
+
+    Replaced argb-font and a1-font options with a more flexible font-format option.
+
+commit d14a396442960d201c97f50a7aa21c52aff99a8b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 17 12:59:10 2005 +0000
+
+    Added IDirectFBSurface::FillRectangles().
+    
+    Generated new ChangeLog.
+
+commit f9790702e9e429b27f3fe22156253420ee0b7e69
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 17 10:12:48 2005 +0000
+
+    Take the largest one, if multiple tmpfs are found!
+
+commit 2c6c2130401cca7230e8ea17ed74c677ad14e90f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 17 09:28:23 2005 +0000
+
+    More than two months ago I made this progress with Unique. I wanted to make
+    it usable again before commiting, but I think it's better not to wait any
+    longer ;)
+    
+    These tons of changes are mostly implementation of things described in IDEAS.
+
+commit 822d8f25a03e7cb3d7e5df3468e6e873544f3e67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 17 09:09:27 2005 +0000
+
+    Work around compiler error when building with trace support (gcc 3.3.5):
+    
+    generic_mmx.h: In function `Sop_argb_Sto_Dacc_MMX':
+    generic_mmx.h:172: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
+    
+    Added "__attribute__((no_instrument_function))" to that function.
+    
+    IIRC it didn't work with 3.4 or others.
+
+commit 779679d4a12bcafc51d8d774ddc57e5056159519
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 17 08:47:48 2005 +0000
+
+    Make "graphics-vt" the default.
+
+commit fba207430411bfccf9c2b9e6d84c07bc94fa7ff9
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 17 02:10:04 2005 +0000
+
+    dfb_surface_reconfig() was still leaking video memory via depth buffer.
+
+commit fabf5c26350b175f9b4754210757db7d7ef11f6a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Feb 16 08:45:31 2005 +0000
+
+    Fixed YUV422 handling on big-endian architectures.
+
+commit 4ba580227b8457295bd2a704326771727c57fc49
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Feb 15 09:16:03 2005 +0000
+
+    Removed macro ARGB_TO_ARGB4444.
+
+commit e11271add05790ad7c11c8f64bb0011b9680b17c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Feb 15 09:14:48 2005 +0000
+
+    Fixed bug in Sop_yuy2_to_Dacc_MMX and Sop_uyvy_to_Dacc_MMX:
+    forgot to check if counter is zero.
+
+commit b3c480ae69985e965e6a95d9fa6963e143864ada
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 15 08:31:02 2005 +0000
+
+    Added DLCAPS_PREMULTIPLIED indicating that a display layer
+    can display surfaces with premultiplied alpha.
+    
+    Added DSCAPS_PREMULTIPLIED indicating that the surface has premultiplied alpha.
+    
+    Added DLCONF_SURFACE_CAPS and field 'surface_caps' to DFBDisplayLayerConfig
+    to specify any combination of the flags: DSCAPS_INTERLACED, DSCAPS_SEPARATED
+    or DSCAPS_PREMULTIPLIED.
+    
+    Added CLRCF_SURFACE_CAPS and field 'surface_caps' to CoreLayerRegionConfig in
+    the display layer driver API.
+    
+    HW Windows created with DWDESC_SURFACE_CAPS and DSCAPS_PREMULTIPLIED
+    in 'desc.surface_caps' are created as premultiplied layer regions.
+
+commit 45b4f6a01032b5716f49e3fe3e77e27c5d8cfd4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 15 08:21:40 2005 +0000
+
+    Implemented BatchBlit() on both sides.
+
+commit 10ba719856cf2ffba8e33b14676122e276e1948f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 14 20:34:25 2005 +0000
+
+    Hot fix cross compiling by commenting out rule for building "yuvtbl.h".
+
+commit 606d97d421644d744ebe592766bc7fc9d48ff591
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 14 20:18:18 2005 +0000
+
+    Changed CbCr to CrCb in the comment of DSPF_NV21.
+
+commit 4f2611df876a499532e3d5fdbd37041a60d36b19
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Feb 14 20:06:18 2005 +0000
+
+    Missed a few cases of NV21.
+
+commit 20ccaace8712a2eae7f61e69f46af8935c719185
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 14 20:03:14 2005 +0000
+
+    Hopefully fix cross compile by keeping yuvtbl.h in CVS and after make clean.
+
+commit b30c3a48d2970d21d1c798f8da5cdb53f53b5157
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Feb 14 19:52:19 2005 +0000
+
+    - Added NV12/NV21/NV16 blitting and rectangle filling.
+    - Made YV12<->I420 blitting possible.
+    - Round chroma width and height up. It seems better than rounding down.
+
+commit be603c7972416523a77bdce3d9a28af5580745b5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Feb 14 15:23:27 2005 +0000
+
+    - DSPF_NV21 support.
+    - G200 can handle NV12/NV21.
+    - Check for odd width/height with YUV formats.
+
+commit 2d1ccaecf430cbd55fa1ceb310a8119eb23e5684
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Feb 14 15:12:26 2005 +0000
+
+    Added DSPF_NV21 and made dfb_surfacemanager_assure_*() handle NV?? formats.
+
+commit e4f427c2034c821aeea17a41e6d0a9b38fcbbf84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Feb 12 08:32:39 2005 +0000
+
+    Remove legacy.
+
+commit 25880f9fbd42b5a35ae608cf32a89ebeb7e7f7f8
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 10 19:34:48 2005 +0000
+
+    Disabled DH add-on detection since it doesn't always work.
+
+commit 95754ac86ddeb704014757faee9374ce009d12f0
+Author: Marcel Siegert <mws@directfb.org>
+Date:   Thu Feb 10 16:39:31 2005 +0000
+
+    added dreamboxremote directory
+    added dreamboxremote driver mainly based on dbox2remote
+    adjusted Makefile for inputdrivers
+
+commit b0fb1c512362a778516c624092c67acc472a3e10
+Author: Marcel Siegert <mws@directfb.org>
+Date:   Thu Feb 10 16:09:08 2005 +0000
+
+    added dreamboxremote configure option for inputdrivers
+
+commit abdb26e42eb7cd2d42247bf75fec3f34c63554c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 15:37:46 2005 +0000
+
+    Moved alpha ramp setting from DFBDisplayLayerConfig
+    to IDirectFBSurface::SetAlphaRamp() for usage with hw windows.
+
+commit 19509c3fc437e73e6ba4492be897a04f553e6352
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 13:45:47 2005 +0000
+
+    More method link substitution (enum and struct entries).
+
+commit 863c4efc22599044fc8318f5db1c2ae364f4dbe6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 13:39:45 2005 +0000
+
+    Fixed parsing of DFBBoolean by allowing "!" in enum value assignment.
+
+commit 80da068b80d8bef7b5b12cbb30f7acc5e8079b69
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 13:28:31 2005 +0000
+
+    Fixed warnings due to unused debug domains depending on architecture.
+
+commit 268f4f125b047e4cbdfeebdd6c3a3d945dabc54a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 12:02:58 2005 +0000
+
+    Keep a list of all realized (added) regions to remove them during
+    emergency shutdown, e.g. signal received or missing deinit of master app.
+    
+    Converted layer related debug messages to use debug domain "Core/Layers".
+
+commit 4531cfb5e595c413e602ff497fd1585388a77898
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 10 12:00:35 2005 +0000
+
+    Added i830 driver (overlay support only) for Servision Ltd.
+    (http://www.servision.net/)
+    
+    Note, due to unsolved conflicts regarding ring buffer usage
+    you have to load the "intelfb" module with the parameter "accel=0".
+
+commit e4bdc6f4d7c26d2fa61e8bd59268aaf7144dfda0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 7 12:34:20 2005 +0000
+
+    Perform additional check (returned phys. fb base) before considering the
+    fb driver to be the one that it's expected to be.
+
+commit 3b16b3f4b995de66a06e6c564bdfcd98c476487e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 4 12:56:59 2005 +0000
+
+    Activate DWOP_ALPHACHANNEL for other non indexed alpha formats, too.
+
+commit f4aa13bef0350c0a332bf0126d9eee7c24b01990
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 4 12:40:10 2005 +0000
+
+    Honor DWCAPS_ALPHACHANNEL for creation of hw window.
+
+commit bcd417d65a39dcac3a1403244430a457f102fe66
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 4 10:51:27 2005 +0000
+
+    Added yuvtbl.h
+
+commit f122362997cd7ccbeca815700e9a24e4ce0ab472
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 4 10:48:20 2005 +0000
+
+    Create layer regions for hw windows in single buffered mode, unless
+    explicitly configured using DSCAPS_DOUBLE/TRIPLE or DWCAPS_DOUBLEBUFFER.
+    
+    This is a preliminary solution, because by default a window surface should
+    require a Flip() to make changes visible.
+
+commit ee5a5de8a1c74b8ecfb317d59e9e15ae67b8eeae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 4 09:59:36 2005 +0000
+
+    Removed an assumption.
+
+commit cd86de7338e6edc894cc5be1bd6ad551e6960b61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 3 18:38:03 2005 +0000
+
+    Replaced spaces by tabs for indentation.
+
+commit 39e46bc4c00cf7b93cd91ff7900f42abe85136ca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 2 14:30:44 2005 +0000
+
+    Added yuvtbl-gen.c to EXTRA_DIST.
+
+commit 638fbcf88a88c59922e3c6093546d7fcb26ce763
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 2 12:18:29 2005 +0000
+
+    Added generic.c's dependency on yuvtbl.h manually.
+    
+    Removed generated file from CVS.
+
+commit 759573e7049736d0142b114d2b14506cca7b9994
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jan 26 10:53:13 2005 +0000
+
+    - do not dispatch events if unknown or JS_EVENT_INIT are received. Fixes
+      crash upon initialization under some conditions
+    - added missing newline to debug output
+
+commit 7e4710cdac97da4bef495d55493cf7e5fbc10727
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Jan 21 15:53:16 2005 +0000
+
+    Fixed DH add-on detection code.
+
+commit 6bc8e647b685b84459eb05f96927dcbba165ad92
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 19 21:30:14 2005 +0000
+
+    Added IDirectFBDisplayLayer::SetScreenPosition( int x, int y ) which
+    sets the position of the layer on the screen specified in pixels.
+
+commit 71000ee9a0d4fe04b5bf5c6900abd7e020a04dec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 19 15:09:18 2005 +0000
+
+    Don't choose between reallocation and allocation based on the region's state,
+    but simply check if the region's surface pointer is non NULL.
+
+commit cd76e79e2f61088e1dc2d8e06f0a7b3a6609e01a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 19 15:06:35 2005 +0000
+
+    Write luma plane at least when loading images to YV12, I420, NV12 or NV16.
+
+commit 8a837ebafad6ad57c263bacba81b09997bb3ecb2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 19 12:15:45 2005 +0000
+
+    Fixed a video memory leak in dfb_surface_reconfig() that happened if a
+    surface with multiple buffers is configured to have less, e.g. switching
+    a layer from DLBM_TRIPLE to DLBM_FRONTONLY.
+
+commit c11c96362685921426c3b2e029fece42a93df630
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 18 11:57:27 2005 +0000
+
+    Reset the destination rectangle upon layer resizing, centered on the screen.
+
+commit c642890d0645cb121527e79010a9a8c457dc1a83
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 18 09:38:22 2005 +0000
+
+    During reallocation of the layer surface, disable automatic palette
+    switching in the region surface listener. Otherwise the palette got
+    set before the region is configured to indexed format.
+
+commit 1b4c1dcb21cd69ae1ddd19ad2be1ba8c470695ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 18 09:36:39 2005 +0000
+
+    Added debug message to dfb_surface_reformat().
+    
+    Generate RGB332 palette for LUT8 and RGB121 for ALUT44.
+
+commit 65e714480cbbaa0c0583b0375c733afff305adad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 18 09:35:14 2005 +0000
+
+    Added dfb_pixelformat_name(format) to be used for (debug) messages.
+
+commit 5821777de0aa4b518cbf469b868220faf3d12911
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Jan 17 11:07:10 2005 +0000
+
+    Fixed a logic bug which allowed CreateSurface() to succeed even though
+    dfb_layer_context_set_configuration() returned an error.
+
+commit b450e8b93bdccba17f4fa54bc573af4e1e2f0c89
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Jan 17 11:01:29 2005 +0000
+
+    Cleaned up the way CreateSurface() determines the primary surface
+    pixelformat and size. Previously the behavior varied depending on
+    cooperative level and the force-desktop option.
+    
+    New behavior:
+    1. DSDESC_{WIDTH,HEIGTH,PIXELFORMAT}
+    2. SetVideoMode()
+    3. mode= and pixelformat= options
+    4. current layer config
+
+commit e90fb3897677d60a1dc62477a0defbb0f27bc8c6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jan 16 20:50:51 2005 +0000
+
+    Added support for G400 dual head add-on.
+
+commit 1c179e6e293f5790714371774e71a0891690a8ce
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jan 16 20:06:20 2005 +0000
+
+    Reset PLNWT.
+
+commit 2de23409a80df4261d95b2069ed574a4ec057b0c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jan 16 20:00:59 2005 +0000
+
+    Added ARGB4444 support.
+
+commit 4a01d4cbe48648c6cb702c307c1246525b1c5593
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 16 17:19:05 2005 +0000
+
+    Propagate horizontal destination coordinate to refine hack.
+
+commit d7a6bab2b84089b3084cf0fc247e0351f2ae8a65
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 16 16:57:39 2005 +0000
+
+    Force alignment to even coordinates if blitting YUY2 or UYVY.
+
+commit 7d708e8315f4f33d74b1181f120eefe7cfd3b4de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 16 16:45:37 2005 +0000
+
+    Added ugly hack to load images to YUY2 or UYVY surfaces.
+
+commit 18d7324d91e92dfc93a31a93352b68b1aa1fc99b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jan 15 16:28:12 2005 +0000
+
+    Set default alpha ramp in default layer configuration.
+
+commit 83cd5e1cea60eccbb725cb7f7f67b855c2b5264e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jan 15 16:24:19 2005 +0000
+
+    Added DLCAPS_ALPHA_RAMP:
+    
+    Alpha values for formats with one or two alpha bits
+    can be chosen, i.e. using ARGB1555 or ARGB2554 the
+    user can define the meaning of the two or four
+    possibilities. In short, this feature provides a
+    lookup table for the alpha of these formats.
+    
+    
+    Added "__u8 alpha_ramp[4]" to DFBDisplayLayerConfig along
+    with DLCONF_ALPHA_RAMP in DFBDisplayLayerConfigFlags:
+    
+    Alpha values for 1 or 2 bit lookup.
+    See description of DLCAPS_ALPHA_RAMP.
+    Either all four values or the first and the
+    last one are used, depending on the format.
+    Default values are: 0x00, 0x55, 0xaa, 0xff.
+
+commit 8d3f1213a88f54528c879a34ec695d147d3cd196
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 14 21:47:15 2005 +0000
+
+    Added missing case for ARGB2554 and ARGB4444 to dfb_color_to_pixel().
+
+commit 1011a73c382ae5b896e83c4ca3edb78587eb0a09
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 14 21:46:45 2005 +0000
+
+    Show the layer level if supported.
+
+commit 962c3fdaee7d217543a4304a91f355dcdf56c3f0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Jan 13 21:01:21 2005 +0000
+
+    Additional small optimizations.
+
+commit 87547d374baeef4bc41ed8d3bfbf66f5d3bb26e3
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Jan 13 14:43:20 2005 +0000
+
+    Further optimizations: reset drawing/blitting operation only when operation mode changes.
+
+commit 207587aaa1d6f59c91ef5093d52d501197ce9914
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 12 00:14:58 2005 +0000
+
+    Forgot to mention in previous commit:
+    
+    Bumped version number to 0.9.22.
+
+commit 02f01709a406fcad61a41c505883a30b8ec83710
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 12 00:10:14 2005 +0000
+
+    Added ARGB2554 and ARGB4444.
+    
+    Implemented all mandatory software driver snippets for these formats
+    and any conversion or image loading routines.
+    
+    Only the optimized A8 font rendering routine (optional) is
+    unimplemented, i.e. Bop_a8_set_alphapixel_Aop_argb2554/4444.
+
+commit 78b8f11d59443b0d0659924f677ad18f8f6ce123
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 11 15:17:02 2005 +0000
+
+    Accept NV12 and NV16 in CreateSurface().
+
+commit 6dd10e932f9b3bb17428b88c1affcf1166d5583e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 10 20:35:35 2005 +0000
+
+    Copy definition of TS_EVENT like the ucb1x00 driver does.
+    
+    Please report if this fails with Linux 2.6 header files.
+
+commit b2a9c88d27a9f080755ac2fdc9db92bc34ce1c4c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 10 20:33:06 2005 +0000
+
+    Use tab instead of spaces.
+
+commit 7e4e970c6ec323b9ed1a18a5e8a23c28afb5f95a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 10 20:32:38 2005 +0000
+
+    Added yuvtbl-gen.
+
+commit 8b6b9e3fa587b0465df01caa6642309372a2a88b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 10 20:32:13 2005 +0000
+
+    Fixed typo to avoid rebuilding the sources every time.
+    
+    Added clean-local rule to remove the binary and the header file.
+
+commit 21bf368ffcd4d5e358f06bab1603d448b53372c4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Jan 10 19:07:35 2005 +0000
+
+    Fixed StretchBlit clipping.
+
+commit 9ef873fbbf3cc6627b34165be982ec6f24e25f4e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jan 9 18:50:54 2005 +0000
+
+    Enable dithering by default.
+
+commit 6479022bd613e02cd31cd39795b4efee8683382e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jan 9 12:05:52 2005 +0000
+
+    Added basic support for drawing with alphablend on NV20.
+    Great performance improvements: it's possible to move a translucent window
+    at 32bpp while the cpu stays idle.
+
+commit 08d6d07342e676adbafdc8502c38013f937d4207
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jan 9 12:02:36 2005 +0000
+
+    Killed a FIXME: detect screen resolution from registers.
+
+commit 42947e6e73593e24b9f4b18cd3476ee13d9cb758
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Jan 6 20:48:04 2005 +0000
+
+    YUV to YUV conversion is not supported.
+
+commit 2e9c502f876c31f81e600e1aeef2141036c0710f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Jan 6 20:47:19 2005 +0000
+
+    Removed an unused array.
+
+commit 32821a45d84866210f85f3a9c4765e50ffbd9a2c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jan 5 10:40:05 2005 +0000
+
+    Added support for YUY2/UYVY->RGB conversion (with src colorkeying):
+    we use four lookup tables generated at compilation time by yuvtbl-gen.
+    Make sure accumulator is aligned to 8.
+
+commit 3897203bcf29d4614bf9976d8047a6b939dc0d44
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 4 11:39:27 2005 +0000
+
+    Try to fix kerning bug on PPC using explicit type casts.
+
+commit 4ac5b602ed638e9791c3c51319b6056eda18acd8
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Jan 1 14:48:04 2005 +0000
+
+    Found the way to make NVScaledImageFromMemory (used for StretchBlit, Alphablend, Color Conversion)
+    work on NV20 chipset:
+    it was another rivafb bug, therefore the rivafb-nv20fix-* patch is absolutely required.
+
+commit 31ce60f3a312ff6fa9902f613d34e5cee050b58d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 29 14:33:40 2004 +0000
+
+    Thanks to "Mws <mws@twisted-brains.org>" for this patch that adds a
+    configure option "--with-inputdrivers=<...>"!
+
+commit fa2805c536c7e8683993e115f45ea5f2831ca39f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Dec 29 10:38:07 2004 +0000
+
+    Write objects configuration during device initialization and do not override rivafb objects.
+    
+    Added expertimental Alphablend support on Riva TNT.
+    
+    Fixed NV20 and GeForce3 Xbox support, Blit() should work on the latter now.
+    
+    Added experimental support for NV30 chipsets.
+    
+    General cleanup.
+
+commit 306c69ae8b3af716607b4c487b1678c09d7e52ba
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Dec 22 10:26:59 2004 +0000
+
+    2.4 kernels don't have EVIOCGLED.
+
+commit e8aeaa0da4dbb72a0f57603a7ac86bd84a75c929
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 22 07:18:27 2004 +0000
+
+    Changed date.
+
+commit 8809181f7c68fdc396c065540d132a02cc615694
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Dec 22 01:53:29 2004 +0000
+
+    Fixed a typo.
+
+commit f3d055b0e96f18743023bd780ee597b287e769ae
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Dec 20 20:03:16 2004 +0000
+
+    drop SDL support on osx, fix osx system for release. still in a very early
+    stage, but working somehow.
+
+commit f164f010e6ad38b7d2f7f565c517fad33b16647a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 13:21:43 2004 +0000
+
+    Commented out two messages for release.
+
+commit ecb877b6c296ec04bbb8d399b8486554ac1e43f3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 08:52:54 2004 +0000
+
+    Updated instructions.
+
+commit f005c736b8174b2c0acbe460d4e26835447afb6f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 08:48:39 2004 +0000
+
+    New patches.
+
+commit babf6a1a85a132a72b2838faa04ac234900a96cd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 07:53:43 2004 +0000
+
+    Spelling, wording and phrasing fixes ;)
+
+commit 57d3df846505acfa19b3a494d5be0710225ee871
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 07:32:20 2004 +0000
+
+    Wrote "summary" of changes between 0.9.20 and 0.9.21 ;)
+
+commit b5adab0b60a42f80359f9657fde5d4e07781a51d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 04:06:17 2004 +0000
+
+    Added Andreas Oberritter <obi@tuxbox.org> (SiS 315 gfx driver).
+
+commit e9ee6fb77ee88eefb6a1c45cbe4019e5279169b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 20 01:37:07 2004 +0000
+
+    Readded ".o" files.
+
+commit 2bdf35b538a9653eda5efd8f6f510f64bcdd7897
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Dec 20 00:40:49 2004 +0000
+
+    compile fixes.
+
+commit e18bb7a97ae20aeca1d7f26c8e4f8628b2272e52
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Dec 18 13:02:26 2004 +0000
+
+    Rearranged a few keycodes to match reality.
+
+commit d81a4f14f084aede935560b13d4f8aca5272b62a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Dec 18 10:49:58 2004 +0000
+
+    - Support more axes
+    - Invert Z axis
+
+commit 85aca7a39c8f91918f3d968e164cd0e1fa7bb071
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Dec 18 10:42:47 2004 +0000
+
+    Copied keymap support from the keyboard driver.
+
+commit fd23182e7bc36203e2cc82f01d46432bec47d70a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Dec 18 10:00:46 2004 +0000
+
+    Cosmetics.
+
+commit d6f76fd50d532e3a1965eca6327966bc2c2465d4
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Dec 18 09:57:33 2004 +0000
+
+    Added keyboard LED support.
+
+commit 86ab20b6a430b2e9c40ac6d0df86c00618aa137e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Dec 14 15:47:27 2004 +0000
+
+    Respect endianess when converting surface to texture.
+    Fixed a typo.
+
+commit d88c83301e090cec60c5b30eca3870d389362d2c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Dec 13 09:58:17 2004 +0000
+
+    Separated GeForce3 XBox from common NV20 and disabled all blitting functions on this chipset.
+
+commit 173d83c017024890b000afb095244b5244ba0a58
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 11 19:38:35 2004 +0000
+
+    Reduced kerning cache size by 50% and slightly increased performance.
+
+commit e61be81dad8b9f38830b9a66ed2bdc7addd872e7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 11 16:32:38 2004 +0000
+
+    Fixed warnings.
+
+commit aac195fdfdffb9e1ab7b3cf7fcd0feaf64cdfdd2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 11 16:16:53 2004 +0000
+
+    Don't check for directfb-csource at all, if UniQuE is disabled.
+
+commit 043d032fca661e82734265747b9fb4a886f7ac85
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Dec 10 22:21:58 2004 +0000
+
+    Fixed segfault in Sop_argb_Sto_Dacc_MMX() when DirectFB is compiled with trace support:
+    use edx instead of ebx.
+
+commit 126e2434788b540bff2f33a69e7a1c6be02fa851
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Dec 10 11:12:55 2004 +0000
+
+    Wait idle before setting alpha and color (Beta1 and Beta4).
+
+commit 7186e37c3ed0de54551751a86e5701b0ee7271d7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Dec 9 21:41:51 2004 +0000
+
+    Avoid division by zero during performance monitoring report.
+
+commit 9640bc762ed937d688fd1dafb3989380d62e5ead
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Dec 9 20:35:44 2004 +0000
+
+    Set nv_waitidle() cycles limit to 10000000.
+    No longer compile in unsed tables.
+
+commit 619dd70ee965543aeb46907b951e9e958973b1da
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Dec 9 16:23:00 2004 +0000
+
+    Added support for A8,YUY2 and UYVY surfaces in dfb_surface_dump().
+
+commit 4e9adf954c6fb8152847521893e586e43b70a3db
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Dec 8 14:20:06 2004 +0000
+
+    Use ScaledImageFromMemory 0x77 instead of 0x89 for NV10/NV20.
+
+commit c02bb37a31a8eb1748d9d2c57ca84aa09a0d4cea
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Dec 8 10:42:15 2004 +0000
+
+    Fixed bug when negative coordinates are passed to drawing/blitting functions.
+    
+    Fixed bug with ARGB destination surfaces: alpha component was not set correctly.
+    
+    Added Alphachannel Blend support (!!!!).
+
+commit ab55bd5771567852c31356e07a1c837338295d6d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Dec 5 18:40:34 2004 +0000
+
+    Revert to previous method in CheckState() and return if DFXL_TEXTRIANGLES is
+    passed to nv20CheckState().
+
+commit 9c3fd2e37db283bc0560d81259aec2f323fabd90
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Dec 5 18:15:46 2004 +0000
+
+    Cleanup & some bugfixes:
+    acceleration was not set correctly in CheckState().
+
+commit 2c66f03231b16d2ce212c6090666ae0b3382f587
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Dec 5 17:58:33 2004 +0000
+
+    DFXL_TEXTRIANGLES was not checked in IDirectFBSurface::GetAccelerationMask().
+
+commit ac58751959db1eb9da1a358d2b984203bc33ac85
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Dec 5 11:02:41 2004 +0000
+
+    Moved surface-to-texture conversion functions to nvidia_3d.c.
+    
+    Surface-to-texture conversion is now performed each time DFXL_TEXRIANGLES is acquired.
+    
+    Source and Destination Blend Functions were not set when DFXL_TEXTRIANGLES was acquired; fixed.
+
+commit f5a467b3b0c6b755ba3331596ecb834dcfd13eea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 4 19:13:20 2004 +0000
+
+    Added support for DSPF_NV12, untested.
+
+commit 186294b2dac5ef47aaff287962da9af26c53cfab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 4 16:53:32 2004 +0000
+
+    Stay with FourCC definitions and use NV12 for YC420.
+    
+    I used NV16 for YC422, but that was just a guess, because I didn't
+    find any FourCC matching this format.
+
+commit 8579792b7d763b436ec4028770c88d7a0c9e11ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 4 14:09:21 2004 +0000
+
+    Hot fixed most annoying problems with device probing:
+    
+    - Just use one of "/dev/psaux" and "/dev/misc/psaux" if both are available.
+    - Don't try them at all if uname() yields release "2.5.*" or "2.6.*".
+
+commit 51dc3cc5c48a84f76a8b7ef5a03c6306205f9ca6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Dec 4 13:45:04 2004 +0000
+
+    Added dummy functions for encoder and output configurations.
+
+commit f55f49ebfe02e90301db52509f5d05a754e44ec3
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Dec 3 18:25:05 2004 +0000
+
+    Reserve unusable memory at the of framebuffer during device initialization;
+    kernel patches are no longer required.
+
+commit edb6fc01c563e83203231d9a8a13655a92d6e15d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Dec 3 14:26:55 2004 +0000
+
+    Set video buffers limit to avoid problems width old rivafb (2.4.x kernels).
+
+commit 2a86c04dfaf373086725c1e38c3c5b0ed9965888
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 12:22:37 2004 +0000
+
+    Added option "-L, --level <level>".
+
+commit bcceb61c45ecf935e50853ace896d8e5520f9a8f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Dec 3 09:58:30 2004 +0000
+
+    Giant cleanup and rewite of the objects configuration routines:
+    we use runtime configuration istead of fixed tables now.
+
+commit e74a1f75b442900607e433e08ae827e3d9da7b30
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 08:24:21 2004 +0000
+
+    Added dfb_color_to_argb().
+    
+    Made dfb_color_to_aycbcr() and dfb_color_to_argb() static inline.
+
+commit 3d9d2238259c1c2b8f01b1336ae977c9a350a7d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 08:10:32 2004 +0000
+
+    Updated some comments.
+
+commit 70b7becc5e692ff2faf394ed1a7789aa2d26185a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 08:00:51 2004 +0000
+
+    Added comment to DFBSurfacePixelFormat.
+
+commit 82e6a73123504b7f01b17043299d91acfd866e8c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 07:56:11 2004 +0000
+
+    Show index of types and definitions on the index page.
+
+commit a4cba0d3c143321acf7032538f6a495eb19f9224
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 07:15:15 2004 +0000
+
+    Added two planar YUV formats:
+    
+    DSPF_YC420  8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane
+    
+    DSPF_YC422  8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane
+
+commit 0926b621d6d71a85ee773081bbaec9b7c72f21eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 3 06:18:13 2004 +0000
+
+    Updated.
+
+commit 9a4fdb7b1c0c3952d021a2dc308da133442c578c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 1 08:51:08 2004 +0000
+
+    Added DLCAPS_SOURCES which indicates that the layer supports multiple
+    sources that can be selected, e.g. from frame buffer (surface) or from
+    hardware decoders (using buffers outside of the frame buffer).
+    
+    Added DFBDisplayLayerSourceID with pre-defined DLSID_SURFACE.
+    
+    Added number of supported sources to DFBDisplayLayerDescription.
+    
+    Added DFBDisplayLayerSourceDescription containing the ID and a name.
+    
+    Added DLCONF_SOURCE along with a field in DFBDisplayLayerConfig to
+    select the source to be used.
+    
+    Added IDirectFBDisplayLayer::GetSourceDescriptions().
+    
+    Added InitSource() to the layer driver API.
+    
+    Added source_id to CoreLayerRegionConfig
+    and CLRCF_SOURCE_ID to CoreLayerRegionConfigFlags.
+    
+    Added layer sources to dfbinfo.
+
+commit e497e3b0caeba1b6e3ef12389209d30376855489
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Nov 30 11:36:49 2004 +0000
+
+    Fixed TextureTriangles() bug in desktop mode.
+
+commit 0eba4f14bfd9f5001444f47e7158894e2314bbb9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 28 23:34:02 2004 +0000
+
+    Code lifting.
+
+commit b354ffaa08303d895ea7342e7f5ea743248066b7
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Nov 28 22:21:34 2004 +0000
+
+    Depth buffer pitch was set wrong.
+
+commit 491a26eedbaad62f4b1e01b807c749ad60095728
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 28 21:23:43 2004 +0000
+
+    Missed a bit in DSECONF_ALL.
+
+commit 9db390788d2815de7921c1a4faacfc19446f6914
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 28 21:09:14 2004 +0000
+
+    Added assertions before calling Set*Config() during initialization.
+    
+    Hotfix missing functions in the Matrox driver.
+
+commit 30cb8ed0d9837d8d571b0c22a1f019ba55ae2f42
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Nov 28 20:00:24 2004 +0000
+
+    Forgot to add nvidia_mmio.h.
+
+commit 102afe0c8c3e07de057b15d9fe0c375492460b7a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Nov 28 16:40:48 2004 +0000
+
+    Added TextureTriangles(): it's very slow, texture size is limited
+    to 512x512, it's somewhat buggy in desktop mode... but we have it!!
+    
+    Added nv_out8(), nv_out16(), nv_out32(), nv_in8(), nv_in16(), nv_in32().
+    
+    General cleanup.
+
+commit 6a1e2e8aed45938713547ba18d9cc6ea5708010d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 05:58:45 2004 +0000
+
+    Added "__u32 dfb_color_to_aycbcr( const DFBColor *color )".
+
+commit aed78e08a49ca7639c95aeb81d1ff29b915f8607
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 05:56:40 2004 +0000
+
+    Fixed two comments after name change.
+
+commit 8577b27c798c1342da0b90b8332604b119e311d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 04:36:39 2004 +0000
+
+    Fixed a warning.
+
+commit 816fed6cf263be91949e2b77534d36d9198b5bae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 04:32:43 2004 +0000
+
+    Changed all test picture mode names using shorter versions.
+
+commit 37097b6cf718853682d465b76bc63b753345f95d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 04:15:27 2004 +0000
+
+    Added 'test_color' to DFBScreenEncoderConfig.
+    Added DSECONF_TEST_COLOR to DFBScreenEncoderConfigFlags.
+    
+    Added test picture mode DSETP_SINGLE_COLOR using color from configuration.
+
+commit 52ae011519cce3a35ce8536ea92a0b90978bebc0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 03:47:04 2004 +0000
+
+    Prefer full matches in enum parsing, e.g. always have "yc" be "DSOS_YC", but
+    still allow "ycb" for "DSOS_YCBCR" or "m" for "DSETP_MULTI_COLOR".
+
+commit 5405362fead1aaab8061ec777332837b1e61f9b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 27 03:13:35 2004 +0000
+
+    Use D_DERROR instead of D_ERROR in two cases.
+
+commit 331aed7a8763d3c3e19ec11d0221f2e8330ed140
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 26 22:23:51 2004 +0000
+
+    Allow empty layer lists like "," to select no layer.
+
+commit 61df803041a0aa635bffa651fe5a590791308399
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 26 22:20:58 2004 +0000
+
+    Set each mixer's, encoder's or output's default configuration.
+
+commit 32de10a3f5c32cd66384866d283e966274daa16b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 26 22:18:41 2004 +0000
+
+    Changed DSOS_UNKNOWN to DSOS_NONE, e.g. for disabling the encoder.
+
+commit 1de546246cffad4ae2d23bd478ccd04d1329921c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 25 22:55:05 2004 +0000
+
+    Added "--enable-unique", disabled by default.
+
+commit feb5b218670fa60c294d37854047587a54b30feb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 25 22:17:52 2004 +0000
+
+    Fixed background color output format (printf).
+
+commit 3de5c4432c2489686b80f85a959df7549ebcf21e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 25 21:16:25 2004 +0000
+
+    ID mask is 32 bit.
+
+commit 5f4133e3e7d95c40763689d616ee9cb0fb7990e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 25 20:48:55 2004 +0000
+
+    Added direct_util_count_bits(), slow version,
+    but optimized for bit sets with lower bits set only.
+
+commit d7060c3471b03b2de7028c929d3ab1a200c13121
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 25 18:33:30 2004 +0000
+
+    Added mixer configuration options.
+
+commit e9523a6d2c5a142b197b31347aeee4574e2564cf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 24 09:45:05 2004 +0000
+
+    Fixed warning.
+
+commit b723ae8b479ade002c1a3cb3eaa4aa11e2cefa91
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 24 09:42:06 2004 +0000
+
+    Added configuration tool for mixers, encoders and outputs.
+
+commit 385b378513d01dd81d86b411d7f2a59f45a10bb2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 24 04:36:45 2004 +0000
+
+    Added 'name' to mixer, encoder and output description.
+    
+    Renamed 'num_layers' to 'sub_num'.
+
+commit 7bdeb52ccb44cd80476740fc633c1181d5c9cf0a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 24 04:35:03 2004 +0000
+
+    Handle recently added DSECONF_OUT_SIGNALS and DSECONF_SCANMODE.
+
+commit ce2ab980906ba9b4e0e49ccba32fe6b3b7e79637
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 24 04:21:53 2004 +0000
+
+    Added name generation for DFBScreenMixerTree,
+    DFBScreenEncoderTestPicture and DFBScreenEncoderScanMode.
+
+commit 518fbc02bbc97ed41c2cafc8ab9169b56416db34
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 23 19:11:43 2004 +0000
+
+    Fixed warning.
+
+commit 87eb53fc7272a8e3a67d3ac10243d4cd8603aaca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 22 18:09:43 2004 +0000
+
+    Segfault should be fixed now.
+
+commit 1a6e108cd59262453be6a83e2cadb870bddff5f4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Nov 22 16:16:14 2004 +0000
+
+    Limit waitfifo cycles to 65536.
+    Yet some small optimizations.
+
+commit 8c7e4a682e25a60ddf05350f2c25b2afbc7fdbd6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 22 06:35:46 2004 +0000
+
+    Commented out an assertion.
+
+commit 41a988541f9ce81c5de566727a8139bd79ba9197
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Nov 21 18:01:57 2004 +0000
+
+    It seems that NVScreenBlit 0x5F doesn't support ARGB format;
+    revert to NVScreenBlit 0x1F and use NVScaledImage to apply effects (ColorAlphaBlend, Colorize).
+
+commit 9a77a18c4fe360c0681d09167e0f3c5eba8b1f64
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 20 23:57:54 2004 +0000
+
+    Added a parameter to "fusion_skirmish_init()" and "fusion_reactor_init()" to
+    set the name of the skirmish or reactor using the ioctl FUSION_ENTRY_SET_INFO.
+    
+    Use the new parameter for all skirmishs and reactors ever created.
+    
+    ---
+    
+    Don't create a skirmish for each reactor's global reactions, but use a single
+    skirmish for all reactors which is created during Fusion's initialization.
+    
+    Added "fusion_reactor_set_lock()" to use another skirmish for the global
+    reactions of the reactor.
+    
+    Added "fusion_object_set_lock()" to set the skirmish for the global reactions
+    of the object's reactor, while default is the skirmish used to lock the pool.
+    
+    Use the skirmish of layer contexts and layer regions for their object reactors.
+    
+    ---
+    
+    Heavily cleaned up code of FusionReactor and added lots of debug messages and
+    comments. You should add "no-debug = fusion/reactor" to disable these loads
+    of debug messages, while still showing other messages if "debug" is used.
+    
+    Documented all functions in the FusionReactor header file.
+    
+    Cleaned up FusionObject code and debug messages.
+    
+    Added some assertions and assumptions to the shared memory code.
+    
+    Added debug domain for FusionReactor and FusionSkirmish.
+    
+    Renamed function type definition "React" to "ReactionFunc".
+    
+    ---
+    
+    Added "dfb_input_add_global()" and "dfb_input_set_global()" to register global
+    reactions at run time, e.g. from another library or module in which case the
+    static reaction table can't be initialized with the address of those functions.
+    
+    Cleaned up input core code, e.g. by replacing the "inlined" singly linked list
+    code by using a "DirectLink" and the "direct_list_*()" functions, or by adding
+    magic assertions etc.
+    
+    Removed InputDevice and replaced all remaining occurences by CoreInputDevice.
+    
+    ---
+    
+    Build all graphics drivers by default again.
+
+commit 38bc8efde3f629608b716da8efcd5105ab41c79d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 20 22:00:13 2004 +0000
+
+    Added debug domain.
+
+commit 05c817cbdc3db176607b769708e4ce5fbf8d73bd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 20 21:52:43 2004 +0000
+
+    Renamed "direct_list_contains()" to "direct_list_contains_element_EXPENSIVE()"
+    to ensure that developers know that they shouldn't use it in non-debug code.
+    
+    Added "direct_list_count_elements_EXPENSIVE()".
+
+commit 3bc0ed3ecf3e4f9e736a9b0c795382b900781309
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 20 21:40:53 2004 +0000
+
+    Added TraceFlags to each frame, featuring TF_DEBUG which indicates that
+    the function of the current frame wrote at least one debug message.
+    
+    Added "direct_trace_debug_indent()" which sets the flag TF_DEBUG for the
+    current frame and returns the current debug message indention level by
+    examining the stack, counting any upper frames that produced debug output.
+    
+    Increased maximum trace depth to 256.
+    
+    
+    Here is an example:
+    
+    (-) [SDL Input  18.814] (18246) Fusion/Reactor:    fusion_reactor_dispatch( 0x20007ee0 [1], msg_data 0xbf5ffa54, self true, globals 0x400a1720)
+    (-) [SDL Input  18.815] (18246) Fusion/Reactor:        fusion_reactor_dispatch( 0x20007c00 [17], msg_data 0xbf5ff814, self true, globals 0x4009f7d4)
+    (-) [SDL Input  18.815] (18246) IDirectFBWindow:           IDirectFBWindow_React()
+    (-) [  NO NAME  18.815] (18239) Core/Windows:      dfb_window_resize (0x2013db00) [  -2,  27 -  616x 460 -> 99x40]
+    (-) [  NO NAME  18.815] (18239) WM/Default:            resize_window( 99, 40 )
+    (-) [  NO NAME  18.815] (18239) Fusion/Reactor:            fusion_reactor_dispatch( 0x20007000 [0], msg_data 0x400c872c, self false, globals (nil))
+    (-) [  NO NAME  18.815] (18239) Fusion/Reactor:            fusion_reactor_dispatch( 0x20007be0 [18], msg_data 0xbffff500, self true, globals 0x400a1880)
+    (-) [  NO NAME  18.834] (18239) Fusion/Reactor:            fusion_reactor_dispatch( 0x20007c00 [17], msg_data 0xbffff5e0, self true, globals 0x4009f7d4)
+    (-) [  NO NAME  18.834] (18239) IDirectFBWindow:               IDirectFBWindow_React()
+
+commit bf254e5aca4a6e384c303a8a95021d43751a876c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 20 21:18:07 2004 +0000
+
+    Added parameter "write_front" to dfb_surface_flip_buffers() which is useful
+    for triple buffering. If true, the new back buffer will be the front buffer.
+    Drivers should detect if the current front buffer is not being shown already,
+    in which case the idle buffer might be still shown and should not be written
+    to.
+
+commit 758081449905c2bd7c1b5d758e3c23f866f10c9b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Nov 20 17:59:20 2004 +0000
+
+    Added experimental support for Colorizing.
+
+commit 0c934aa3bad7b03057e0d24aa64eb8ea227eb70d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Nov 20 10:45:28 2004 +0000
+
+    Accidentally byteoffset_alignment was reset to 128.
+
+commit 6d7fead382acb0673acd5794a9eb60cd7e28a75b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Nov 20 10:38:24 2004 +0000
+
+    General clean-up and optimization.
+    Use strict chipset/architecture detection.
+
+commit 31ad26aeec0a381d401d19d25f38cc387b7f34ea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 19 23:38:58 2004 +0000
+
+    Thanks to Stefan Lucke <stefan@lucke.in-berlin.de>:
+    
+    Hi,
+    
+    the follow patch enables reporting of destination colorkey capability.
+    So apps (like vdr-softdevice) can test this in order to
+    set layer options correct.
+
+commit a09ec2f607336d1e02b05eb8e109f6486a150d54
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 18 05:36:34 2004 +0000
+
+    Added DFBScreenEncoderScanMode for interlaced/progressive output.
+    
+    Added DSECAPS_SCANMODE and DSECONF_SCANMODE.
+
+commit 7d7c2e49ff1ddb7102dd1ed15f0e9ba9c07c429a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 18 05:09:43 2004 +0000
+
+    Added output signals to encoder caps and configuration.
+    
+    Added YCbCr to output signals.
+
+commit 5fc17831e8a90389ddcb57bf51f0aa6b2e85ab58
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 14 10:20:44 2004 +0000
+
+    Added "D_OOSHM()" which is the same as "D_OOM()" in single app build.
+    
+    Only in multi app build it prints the warning "out of shared memory"
+    and gives DFB_NOSHAREDMEMORY if used as a (return) value.
+
+commit 1b192843e225a0028afd4530aff47a8d795b72e4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 14 10:15:31 2004 +0000
+
+    Added "D_OOM()" which prints the warning "out of memory".
+    
+    
+    It can be used solely or with a return in front:
+    
+    :	D_OOM();
+    :	return DFB_NOSYSTEMMEMORY;
+    
+    Can be written as:
+    
+    :	return D_OOM();
+
+commit 939614a213f3a0ded84e7f75c0d853a8b0dc1544
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 14 10:13:24 2004 +0000
+
+    Added "static inline bool direct_list_contains( list, link )".
+    
+    In direct_list_remove(): "D_ASSERT( direct_list_contains( *list, link ) )".
+
+commit ac8807f8445134892619fc4fdb7d7d1b5c3d6ad3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 14 10:07:38 2004 +0000
+
+    Added DFB_NOSHAREDMEMORY error code.
+
+commit 7118e45b0cf532d473a7d670e473e3ec086c2302
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 13 04:53:30 2004 +0000
+
+    Working on implementation of UniqueInputSwitch.
+
+commit 076b2df147b991f13e99b33c46b28ec781ba8e55
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 13 02:17:46 2004 +0000
+
+    Create an instance of each device class and
+    connect sources matching certain capabilities.
+    
+    Added magic to WMShared.
+
+commit 2368c36a52beccf37794ccbb45f6ff431515cbf9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 13 02:15:52 2004 +0000
+
+    Added DFBInputDeviceCapabilities parameter to dfb_input_enumerate_devices().
+
+commit b9ed525415145a6ffda4fce809f2e58181af4703
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 13 01:30:41 2004 +0000
+
+    Wrote about UniqueInputSwitch and UniqueInputChannel. Updated UniqueCursor.
+
+commit 489dd07038d10673255781c4d59e10b88bd9f9f3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 23:58:50 2004 +0000
+
+    Increased lower domain field width from 16 to 18.
+
+commit 5fc5e89aca1b8c4954c49ccc0c314b2b43e4342f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 23:53:50 2004 +0000
+
+    Added debug domain "Core/SurfaceMgr".
+
+commit 5f25f78470595462a1dd73587b311a8881096809
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 23:47:33 2004 +0000
+
+    Added debug domain and a message in dfb_surface_create() including the
+    name of the pixel format.
+
+commit e54470da77b92d070825c434efb21d7aeb2e834c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 23:46:43 2004 +0000
+
+    Added D_DEBUG_ENABLED which is defined depending on three other macros.
+    It's defined to be 1, if the D_DEBUG* macros produce code. Useful for
+    embracing code that it's just required for the debugging output.
+
+commit 6512c128f47a3613af2405d8f16e0a9736dcf042
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 20:59:40 2004 +0000
+
+    "make distcheck" works again.
+
+commit 83adb9ad138de068b61ee13de5b81c34b4f7445b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 12 17:53:57 2004 +0000
+
+    Worked on the design and began with its implementation.
+
+commit 064c7d839e50c94f224f2ba91d07a69638b4b6c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 11 20:08:08 2004 +0000
+
+    Comment out ".o" here.
+
+commit 5ee75de3e1cc595c8e89b2b6529bb43a8cea96be
+Author: Andreas Kotes <count@directfb.org>
+Date:   Thu Nov 11 19:18:13 2004 +0000
+
+    apply more fixes
+
+commit ce1ca42ca9c15ef969b3c7a71252216deee9769b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 11 16:34:32 2004 +0000
+
+    nother try
+
+commit c1c84c8bea2615d43f4e43e1c131fc284da3d349
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 11 13:56:49 2004 +0000
+
+    Commented out ".o" files here until build problems are fixed.
+
+commit 9e0e490838b44d0eacc15709c6f631e5d94c9f14
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 10 23:34:54 2004 +0000
+
+    Use core functions for the wm hack implementation to keep the core's opinion
+    about the window configuration in sync with ours.
+    This workaround will be obsolete soon.
+
+commit f92df569d5ce6d3377e011b241c58b69c0e5ef29
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Nov 9 18:50:10 2004 +0000
+
+    Fixed ram amount detection on Xbox (thanks to Oliver Schwartz).
+
+commit 1e157c6042bc1fa46da166f1e975eefafd23643c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 09:39:39 2004 +0000
+
+    Code cosmetics.
+
+commit 8c6cb4e8a7a52a0a03c5015ff34fdef46a8cc4db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 08:06:22 2004 +0000
+
+    Use colorizing for the borders. The color can be changed with "test_color".
+    
+    Some fixes.
+
+commit 0e1a7cd82b22d04bd8a6c2035f5194aea130e0a9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 07:37:56 2004 +0000
+
+    Added debug domain.
+    
+    Added debug message in dfb_window_resize().
+
+commit d1c71218d539f6f493926ecae5c3bf5d9b1e9a66
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 07:36:27 2004 +0000
+
+    Fixed wrong assertions in dfb_region_from_rectangle().
+
+commit 9fcd8bddb3965962e85e1048ed54b15d5f4be458
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 04:47:40 2004 +0000
+
+    Removed obsolete Reaction structs from CardState.
+
+commit eee48a56b8c74b19c499f56307771f37b50543f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 04:21:36 2004 +0000
+
+    Simplified Flip().
+
+commit 0cf9dd0dc7a265e5efe30eaf909a0a53281325b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 04:03:14 2004 +0000
+
+    Simplified Flip() here, too.
+    
+    Added "const" to the region parameter of dfb_window_repaint().
+
+commit dc86a5b0b0aa47dcab63df5171922b24e2342891
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 03:54:47 2004 +0000
+
+    Simplified Flip() a lot.
+
+commit 64f4b8c62d5859359eb285ac7cf36ecaf56f890c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 03:36:40 2004 +0000
+
+    Removed influence on layer context reference count which caused the
+    cursor window reference count to be one greater in the output than
+    the layer context reference count, because during window dump the
+    context reference was increased.
+
+commit 94b605ce88d584258a9823e94eb1b7c42da59537
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 03:22:52 2004 +0000
+
+    Forgot dfb_font_drop_destination() in IDirectFBSurface_Destruct().
+
+commit 7d0e56baf7a5c8b206c3e7aa8bbd2b9156ab816f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 03:05:39 2004 +0000
+
+    Fixed invalid clipping region of sub surfaces
+    created outside of the physical surface's area.
+    
+    Thanks to DFB_REGION_ASSERT() in dfb_state_lock()  :-)
+
+commit f64144067fe8a2843ea8e1cafc71aa9a100ca5fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 02:35:16 2004 +0000
+
+    Added -D_GNU_SOURCE.
+
+commit 17ebdfb372b4b420be3e0c00f928845ad731e75b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 02:28:03 2004 +0000
+
+    Use DirectSerial for CoreSurface, increased by dfb_surface_notify_listeners().
+    
+    Removed the surface listeners attached by dfb_state_set_destination() and
+    dfb_state_set_source().
+    
+    Store the serial of the source and destination surface in each state.
+    
+    Added dfb_state_update() which does the work of the removed listeners
+    if direct_serial_update() returns true. Updating the source is optional.
+    Only surfaces set via dfb_state_set_*() are handled.
+    
+    Use dfb_state_update() in dfb_gfxcard_state_acquire() and gAcquire().
+    
+    Use dfb_state_set_destination() for the font's state to avoid setting up the
+    accelerators destination settings for each DrawString().
+    
+    Added dfb_font_drop_destination() being called by IDirectFBSurface::SetFont()
+    and IDirectFBSurface_Destruct() and unsets the font's state destination if it
+    matches the specified surface. This avoids late deallocation of the surface
+    when the font's state destination is changed for another reason.
+
+commit 815aa7030956c56581aefc73dc3a8204be7a460e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 01:57:34 2004 +0000
+
+    Added DirectSerial providing a 64 bit serial number
+    while the implementation uses two unsigned 32 bit integers.
+    
+    Measurements have shown that (at least on my Athlon Thunderbird 1.33)
+    emulating the 64 bit value myself is 50% to 100% faster
+    than simply using the builtin 64 bit code of the compiler.
+    
+    The following static inline functions are defined:
+    - direct_serial_init()      initialize serial to zero, set magic
+    - direct_serial_deinit()    right now it only clears the magic
+    - direct_serial_increase()  advance serial number by one
+    - direct_serial_copy()      set serial to the value of another
+    - direct_serial_update()    returns false if the serial is up to date
+                                with another, otherwise returns true
+                                after updating the serial
+
+commit 11dd34edd2627c0ff8a01339c567828877589290
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 9 00:44:48 2004 +0000
+
+    Added D_FLAGS_ARE_IN(flags,f) to check that any set flags are contained in 'f'.
+
+commit e9b82464e93b2b11b2af088e089d10014abce543
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Nov 8 17:39:02 2004 +0000
+
+    Work around on ram amount detection on Xbox.
+
+commit bce285dde29a1bab7dc6dea9bee08742b4511d3e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Nov 8 14:13:20 2004 +0000
+
+    Fixed offset mask calculation.
+
+commit 60f54769167e9289a426620d6a13287a92ee5db8
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Nov 8 13:42:05 2004 +0000
+
+    Memory alignment set to 64.
+    Use offset mask according to the effective memory size.
+
+commit ea6f27ec0621dc2653c955a11c2deabb58e31af5
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Mon Nov 8 12:32:28 2004 +0000
+
+    - link stret_test against $(top_builddir)/src/libdirectfb.la
+    - removed trailing whitespace
+
+commit 7b23fba83d9b3683c8865f69b4fdd2a4d5c12859
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 8 00:36:10 2004 +0000
+
+    Hotfix missing fusion_ref_inherit() in single app fusion.
+
+commit fead4b726fb52e5a0aef6aea465ef32c0a90cdea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 8 00:31:19 2004 +0000
+
+    Fix compile error with single app core.
+
+commit 5723501ac7c5cc6d755f727d71c0b19a1b3749a9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Nov 7 16:12:47 2004 +0000
+
+    Scan only devices on bus 1 and following (fixes wrong detection with nForce boards).
+
+commit 99088b057afb83c2d58def1d4e89b41833784b3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 14:44:25 2004 +0000
+
+    Optionally, stret_region_at() can look for a specific region class only.
+    
+    Added some safety to unique_context_window_at() in case other regions
+    have SRF_INPUT set while not being UCI_WINDOW or UCI_FOO. It doesn't use
+    the feature above, though.
+
+commit 1a3d6fbee3b62af9c591871bf4ab8945351d43e9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 14:18:33 2004 +0000
+
+    Fixed failing assumption due to missing stret_iteration_abort() in region_update().
+
+commit d54cb26f75520e9bf00764ee767069005c884705
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 14:06:14 2004 +0000
+
+    Added option "no-decorations".
+
+commit 0a26336da079447f016ad12421ed0abad6a7dfbd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 13:29:19 2004 +0000
+
+    Fixed update of frames with opaque content.
+
+commit 68ec27cf94fe07d705a58fc3825db7ba3abc808e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 12:27:51 2004 +0000
+
+    Fixed missing updates when undecorated windows are resized.
+
+commit 48ab92e77d81a06140eae7a8491274c3ae6cf934
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 12:06:01 2004 +0000
+
+    Added global reactions to be notified, when a context or window is destroyed.
+    The reactions are in the wm module. Therefore wrapper functions had to be
+    added in the wm library, to avoid linking the library against the module.
+    The wrappers are using callbacks passed to the library during module init.
+
+commit ae7302082ef95a9aef3cedf967c808462a89dbc7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 12:00:27 2004 +0000
+
+    Unlink layer region in window_destructor(), not in dfb_window_destroy().
+
+commit c3a2645ae7c41d1f4aff7f5da7def6e5a91711c2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 10:19:17 2004 +0000
+
+    Show list of windows in uwmdump.
+
+commit 19429a502d9b0cd3eee8c1141c22e7295a290fc0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 7 09:15:20 2004 +0000
+
+    Use new Fusion API for entering the world.
+    
+    Added fusion_ref_inherit() using the new ioctl FUSION_REF_INHERIT.
+    
+    Added fusion_object_inherit() to inherit the local reference count
+    from another object of any type.
+    
+    Fixed the global reference cycle "Layer Context, Layer Region,
+    Cursor Window" by removing the global reference to the Cursor Window,
+    which now inherits local references from the Layer Context, i.e. if the
+    last application releases the stack, the cursor gets destroyed :-)
+    
+    Fixed the global reference cycle of "Layer Context, Layer Region,
+    Unique Context" using the same technique.
+    
+    Added "docs/ReferenceMaps.txt" which explains references
+    and visualizes different cases of inter object referencing.
+    
+    -
+    
+    Split unique window manager code into the objects UniqueContext
+    and UniqueWindow. The wm module only uses the unique wm library,
+    nothing is implemented in the module any longer. Moved all stuff
+    from StackData and WindowData to UniqueContext and UniqueWindow
+    respectively. Added methods to these new objects to implement
+    the current functionality for now.
+    
+    Added the ability to create a StReT Region with multiple levels.
+    Actually, there's a variable number of children vectors now. This
+    eliminates the usage of invisible StReT Regions all having the same
+    size to emulate the levels. Creation of a Region needs specification
+    of the number of provided levels, now. Additionally, the level to
+    be added to within the parent must be specified.
+    
+    The Root Region consists of these UniqueRootLevel's:
+    - UNRL_DESKTOP     Icons, redirected fullscreen apps (force-desktop)
+    - UNRL_USER        User windows (currently available stacking classes)
+    - UNRL_SYSTEM      Dock/Panel, Glass, Exposé, Clipboard, Virtual Keyboard, IMs
+    - UNRL_CURSOR      Cursor shape and attached objects, e.g. Drag'N'Drop
+    - UNRL_SCREEN      Display Locking, Screensaver
+    
+    The Frame Region consists of these UniqueFrameLevel's:
+    - UNFL_BACKGROUND  Background for blended content, effects, decorations
+    - UNFL_CONTENT     The actual DirectFB Window, i.e. its content
+    - UNFL_FOREGROUND  Decorations, effects, any other content overlay
+    
+    Added "uwmdump" in the flavor of "dfbdump", but not showing much, yet.
+    
+    Added debug domain and messages to StReT Iteration code, along with support
+    for the new level feature.
+    
+    Enhanced "stret_test" to check for correct implementation of multiple levels.
+    
+    -
+    
+    Added a CoreWindowConfig containing position, size, opacity, stacking,
+    options, events, color key and opaque region.
+    
+    Added dfb_wm_set_window_config() to change any combination of the different
+    settings with one call. Current implementations, however, simply iterate over
+    each entry, e.g. still two window stack updates for changing position and size.
+    
+    Removed dfb_wm_move_window(), dfb_wm_resize_window(), dfb_wm_set_opacity()
+    and dfb_wm_set_options().
+    
+    Added dfb_wm_set_active() to notify the window manager about layer context
+    switches, e.g. switching to a full screen application.
+    
+    In dfb_layer_context_activate() and dfb_layer_context_deactivate(): replaced
+    calls to dfb_windowstack_repaint_all() and dfb_wm_flush_keys()
+    by dfb_wm_set_active().
+    
+    Replaced dfb_window_set_options() by dfb_window_change_options() which takes
+    two bit masks: one for clearing bits and one for setting bits afterwards.
+    
+    Added dfb_window_change_events() in the same flavor.
+    
+    -
+    
+    Added debug domain to the main file of fusion.
+    
+    Minor API cleanups, e.g. adding return values (DFBResult).
+
+commit 0c23dc54c9a9bc625ba821b90feeaeb8445f67b8
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Nov 6 13:33:39 2004 +0000
+
+    Attempt to make the driver work with GeForce3/4 and XBox.
+
+commit 61f28b7d386332698e1dab4df0bb43a0208d3430
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:16:31 2004 +0000
+
+    Added DWET_NONE.
+    
+    Clarified two statements.
+
+commit 66f665d11701633bc367af5c13070b92a71349a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:14:06 2004 +0000
+
+    Added
+    - DFB_RECTANGLE_VALS(r)
+    - DFB_REGION_VALS(r)
+    - DFB_REGION_VALS_FROM_RECTANGLE_VALS(x,y,w,h)
+    - DFB_REGION_INIT_FROM_RECTANGLE_VALS(x,y,w,h)
+    - dfb_rectangle_from_rectangle_plus_insets(dest,source,insets)
+    - dfb_region_region_intersects(r1,r2)
+
+commit fc227db2ca95117307b2f22ddd5df5ab3f23e1da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:10:08 2004 +0000
+
+    Some debug messages in Destruct().
+
+commit 994af0398a72e7b0f9300abd6e1f963274039842
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:07:38 2004 +0000
+
+    More debug messages during pool destruction.
+
+commit dc6ea7a11c3294f0aadfe853a9aece51e99d7c4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:06:30 2004 +0000
+
+    Send SIGKILL to the process group instead of the received signal at the
+    end of the handler.
+
+commit c7aec808f65ad07c39c09c9c885df31845b959d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:05:26 2004 +0000
+
+    Fix endless recursion if warning about the number of frames
+    is printed while printing a stack trace.
+
+commit 9f56d78b1b1e4e9d09208c92773048154f3611d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 6 08:03:20 2004 +0000
+
+    Added D_MAGIC_ASSERT_IF which doesn't fail if the pointer is NULL.
+
+commit 66ce447fb6c36197cd002a34835280ecdcbee8b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 5 20:44:15 2004 +0000
+
+    Build tools before wm.
+
+commit 481c314144166b7b22174e4d42023bf558f334d4
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Nov 5 17:51:39 2004 +0000
+
+    Partial rewrite of the nVidia driver:
+         - all drawing blend functions are supported,
+         - StretchBlit supports RGB16 now,
+         - added a really fast Flip() function,
+         - experimental WaitForSync() support.
+    
+    Switch to version 0.3.
+
+commit db650aca44d4868d3de12d7eb747388e4d659a8c
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Fri Nov 5 14:26:10 2004 +0000
+
+    - renamed conditional DIRECTFB_CSOURCE to BUILD_DIRECTFB_CSOURCE
+    - check for directfb-csource in PATH if we are cross compiling or
+      building --without-tools
+    - use the directfb-csource from PATH only in the above cases and use
+      the one from $(top_builddir)/tools otherwise.
+
+commit 0b04d88319b79642092304c728c4b3bf4fa4471f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 5 13:07:08 2004 +0000
+
+    Use old allocation behaviour, but fix the static assignment of Sacc and Dacc.
+
+commit 6f8a1aff2f008a6d5b53ec87b6f1b0f145aa397f
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Nov 5 11:04:08 2004 +0000
+
+    BugFix:
+    since gfxs->Sacc of gfxs->Dacc may point to gfxs->Aacc, allocate
+    the accumulation buffer when the Swrast histance is created and use
+    realloc to resize.
+
+commit 92b71fd51b0490cc463666ef6d0b6307e1cd3c49
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 5 01:45:48 2004 +0000
+
+    Removed FusionResult using DirectResult instead.
+
+commit 367016d1af6378321c528f08c66ec17e2d55dfb1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Nov 4 15:35:21 2004 +0000
+
+    Primary mouse should actually be a mouse.
+
+commit 63291c3f80c39beecd0084379f33b26905bd8e6e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 4 05:46:21 2004 +0000
+
+    Thanks to Bryce Nichols <bryce@bnichols.org> for reducing the hardware
+    rounding errors in 16 bit mode by rendering the upper left and lower right
+    triangle pair instead of the upper right and lower left.
+
+commit 30bb86d7011b05b7fd6e6176c6ccd0fbe7d8a0e3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 2 16:12:38 2004 +0000
+
+    Added missing includes.
+
+commit 7c8473d0795aa5ef859d946303fada9a39056faf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 2 16:11:51 2004 +0000
+
+    Moved D_FORMAT_PRINTF to <direct/messages.h> again.
+
+commit f0d5db467127dfe01338ebcaf5e29ed2d8b519b8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 2 15:55:11 2004 +0000
+
+    Renamed DIRECT_BUILD_NOTEXT to DIRECT_BUILD_TEXT.
+    
+    Exclude debug message functions from the library
+    if DIRECT_BUILD_TEXT is false.
+    
+    Always enable magic handling macros, because
+    - just setting and clearing the magic in non-debug mode doesn't hurt
+    - DIRECT_FORCE_DEBUG works for magic assertions again
+    
+    Renamed all flag manipulation macros, using the prefix "D_FLAGS_" now.
+    
+    Moved D_FORMAT_PRINTF(n) and D_CONST_FUNC to <direct/util.h>.
+    
+    Added D_ARRAY_SIZE(array).
+
+commit 74955c65a1b512a8a0cbd809f1cf65c862eaa570
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 23:09:12 2004 +0000
+
+    Ensure minimum region sizes at least (1x1).
+
+commit a55745305b000efb3d3fe1f70823e76119f6f7ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 22:49:29 2004 +0000
+
+    Added dfb_window_set_options() which calls the new window manager function
+    SetOptions() to keep track of and control changes.
+    
+    Update region flags when the window options are changed.
+    
+    Update window border region layout when the window is resized.
+
+commit 57f946df5673e8a55501051c4ede1cd5c22b884a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 18:37:25 2004 +0000
+
+    Fixed author parsing (did the cvs log format change?).
+
+commit a351585cc9167aa6e2602dd86f8caab708930465
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Nov 1 16:57:29 2004 +0000
+
+    If core/state.h includes gfx/generic/generic.h then generic.h must be
+    installed.
+
+commit 360070605ec1f6c2ad8193a706a32baad1984f84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 10:13:41 2004 +0000
+
+    Pass the CoreLayer to IDirectFBWindow_Construct() which
+    doesn't require the internal layer header anymore, removed FIXME.
+
+commit beda24ea9fa888264b1f6a38306a909fee53326c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 10:00:11 2004 +0000
+
+    Allocate accumulators dynamically, removed FIXME.
+    
+    Accumulators are allocated upon first usage.
+    Subsequent usage can only grow the accumulators.
+    
+    Sizes allocated are 256 at least, otherwise power of two. This should
+    guarantee that there are very few (re)allocations, even in the worst case.
+
+commit b27f104b1bfcf071554e5a9e89c2225453da5ce5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 09:13:31 2004 +0000
+
+    Implemented Sacc_toK_Aop_rgb24() correctly, removed FIXME.
+
+commit fcabef16dded69b6a5e4d08d33ed49fb8d64c54d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 09:06:59 2004 +0000
+
+    Added Sop_rgb332_SKto_Dacc(), removed FIXME.
+
+commit 1144015f65718c33dbd79086cc5832af738089de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 08:59:08 2004 +0000
+
+    Killed another FIXME: Implement Bop_a8_set_alphapixel_Aop_rgb332() correctly.
+
+commit e14006b2865d67eef93f607ad4b290de1e293fe5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 08:16:14 2004 +0000
+
+    Removed a FIXME: Pass a valid core to dfb_core_is_master() and turn
+    the assumption "core != NULL" into an assertion.
+
+commit 6f9a2176b2c3aac4946381828adadecd679d88cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 07:55:59 2004 +0000
+
+    Implemented software clipping for hardware accelerated DrawRectangle().
+    
+    Use hardware accelerated FillRectangle() if DrawRectangle() is not accelerated.
+
+commit 0a5cfe68edceb68509b90c60ca36245f4495a5c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 07:01:45 2004 +0000
+
+    Replace gDrawLine() usage by gFillRectangle() in
+    software based rectangle outline drawing code.
+
+commit 29cb9ae3a4b122dfc4c30796efaaec3a87df3a68
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 06:34:43 2004 +0000
+
+    First version of builtin window borders implemented by the "foo" class.
+    This is just for testing and will be replaced by a more flexible approach.
+    
+    Use *much* simpler and cleaner recursive code for stret_region_visible() and
+    stret_region_update() by separating their linear components from the recursive.
+    
+    Added functions for StReT iteration using one struct to hold the current state.
+    This code is the linear part of the recursive functions mentioned above.
+    
+    Added small test program for StReT iteration code.
+    
+    Added default StReT region class to be used for "containing-only" regions
+    which don't have any input or output themselves (only their children).
+    
+    Added stret_region_at() used in window_at_pointer().
+    
+    Added stret_region_get_size() and stret_region_data().
+
+commit 6298ace03112c3a6b5d5a11f715bf710553afa9c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 06:12:22 2004 +0000
+
+    Added DWCAPS_NODECORATION, e.g. used for the cursor window.
+    
+    Preliminary and testing, might be changed.
+
+commit 7cedf18f34f517c9e0fe992521efa7271f1eb1f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 06:10:38 2004 +0000
+
+    Replaced dfb_gfxcard_fillrectangle() by dfb_gfxcard_fillrectangles().
+
+commit cd460b4a513ea758887f10b48d869c84160b72cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 1 05:53:09 2004 +0000
+
+    Added dfb_rectangle_region_intersects().
+    
+    Added 'const' to dfb_region_intersects() parameter.
+    
+    Added some DFB_REGION_ASSERT where appropriate.
+
+commit d7b3a6c73e52830617e085c532cf0ea696f79eb9
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Oct 31 14:33:51 2004 +0000
+
+    Re-enable double/triple buffering.
+
+commit 31b8cfbc1dfb0b84e61c8b53cf215257fb51027e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 30 20:02:46 2004 +0000
+
+    Removed StReT stuff from default window manager module.
+    
+    Forked a new window manager module with the new StReT stuff.
+    
+    The new window manager consists of the wm module that is plugged into
+    DirectFB and a library that contains the wm implementation. This library
+    can be linked into programs, like in the "test_color" example which
+    changes the global window border color. This test will be removed and
+    replaced by a more sophisticated configuration system.
+
+commit 5110b85cf2f58c5d686a14d078494c1edbfe4ab7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 30 19:52:05 2004 +0000
+
+    Added fusion_object_globalize() doing the often used combination of
+    fusion_object_link() and fusion_object_unref(), i.e. increasing the global
+    reference counter and decreasing the local reference counter.
+
+commit d4186985036bf3aac3fe22cfcd6dd70621463e8f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 30 19:50:45 2004 +0000
+
+    Align debug output of domains.
+
+commit 030682f88cc0bcb344cb007fff52281f1d2e40f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 30 19:50:12 2004 +0000
+
+    Added debug domain.
+
+commit eb3b21e5dcfcb66e2bcffb42af6c73118bcc6147
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 30 17:38:46 2004 +0000
+
+    Commented out call to missing Gal_set_source_transparency().
+
+commit 07993fffa1496b0d7b6bd2a1145ee378aa1ba941
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 28 01:32:17 2004 +0000
+
+    Use RTLD_NOW to detect undefined symbols before the module is used at all.
+
+commit f7a63c08fcba8c08b42eea1eedd6a9b12beed5fb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 23:40:31 2004 +0000
+
+    No longer show MMX in core info line, but show debug / trace build.
+
+commit 7a5d89ba08bd57b4763ce04b5fbf9b3641438247
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 23:33:33 2004 +0000
+
+    Fixed missing MMX initialization in slaves, only the master used MMX before :O
+    
+    Fixed missing card capabilities in slaves with acceleration enabled,
+    if the master has acceleration disabled.
+
+commit 1aad6a601f842a1c58c276ce359bb9f27862a71c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 20:28:13 2004 +0000
+
+    In shared memory summary also show the total amount without pixel buffers.
+
+commit 001260835423a2df1763936666824fc0ec020283
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 17:49:49 2004 +0000
+
+    Added DFB_VERSIONMISMATCH error code.
+    
+    Added DFBInsets specifying a distance from each
+    edge of a rectangle: left, top, right, bottom.
+
+commit 9eb68b9b08579e8fab6b6b2ee099aa79eeecbe56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 17:46:51 2004 +0000
+
+    More convenience:
+    
+    DFB_RECTANGLE_ASSERT(r) and DFB_REGION_ASSERT(r) fail if 'r' is NULL
+    or if the coordinates are illegal, e.g. negative width or x1 > x2 etc.
+    
+    DFB_RECTANGLE_ASSERT_IF(r) and DFB_REGION_ASSERT_IF(r) don't fail
+    if 'r' is NULL, but fail if 'r' is set with illegal coordinates.
+    
+    DFB_REGION_VALS_TRANSLATED(r,x,y)  (r)->x1 + x, (r)->y1 + y, (r)->x2 + x, (r)->y2 + y
+    DFB_REGION_INIT_TRANSLATED(r,x,y)  { DFB_REGION_VALS_TRANSLATED(r,x,y) }
+    
+    DFB_REGION_VALS_INTERSECTED(r,X1,Y1,X2,Y2) in addition to
+    the existing DFB_REGION_INIT_INTERSECTED(r,X1,Y1,X2,Y2).
+
+commit 9a5ec2cfebc9ca9591abf645d17a6528c6030086
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 27 17:38:00 2004 +0000
+
+    Exclude D_MAGIC_ASSERT & Co from DIRECT_FORCE_DEBUG enabled macros,
+    because the magic value might not be set by other code compiled without
+    debug macros.
+
+commit c1613c8ddfa4d3c15618d9e0e7f1ad1e2ea4d84e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 27 03:31:30 2004 +0000
+
+    Fixed typo: DSOS_YC -> DSOC_YC.
+
+commit fbde562b5c4e094f6d103e07a49f5d008106b64f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 16:10:33 2004 +0000
+
+    Rewrote the recursive window stack update code in a reusable form.
+    
+    Those regions of the window stack being transparent, opaque, shaped etc.
+    had been each window itself, but the new code allows to have a complete
+    hierarchie of those regions.
+    
+    Therefore, the new code is all about the 'StReT', the Stack Region Tree.
+    
+    Right now, there's one StReT Region for each Window, but window borders
+    are coming soon and each Window's StReT Region will be embedded into the
+    border's StReT Region, either as a child or a sibling.
+    
+    Currently, DWOP_OPAQUE_REGION is not working. The complicated code for
+    opaque sub parts has been removed. Instead another StReT Region has to
+    be created as an opaque child region of the transparent.
+
+commit f8fe6ebbdb53e84cfc0bc3cc651eab0b181819b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:49:14 2004 +0000
+
+    Added some macros and static inline functions for convenience:
+    
+    DFB_RECTANGLE_VALS_FROM_REGION(r)   (r)->x1, (r)->y1, (r)->x2-(r)->x1+1, (r)->y2-(r)->y1+1
+    DFB_RECTANGLE_INIT_FROM_REGION(r)   { DFB_RECTANGLE_VALS_FROM_REGION(r) }
+    
+    DFB_REGION_VALS_FROM_RECTANGLE(r)   (r)->x, (r)->y, (r)->x+(r)->w-1, (r)->y+(r)->h-1
+    DFB_REGION_INIT_FROM_RECTANGLE(r)   { DFB_REGION_VALS_FROM_RECTANGLE(r) }
+    
+    DFB_REGION_INIT_INTERSECTED(r,X1,Y1,X2,Y2)  {
+    (r)->x1 > (X1) ? (r)->x1 : (X1),  (r)->y1 > (Y1) ? (r)->y1 : (Y1),
+    (r)->x2 < (X2) ? (r)->x2 : (X2),  (r)->y2 < (Y2) ? (r)->y2 : (Y2)
+    }
+    
+    dfb_rectangle_translate(), dfb_region_translate(), dfb_rectangle_resize(),
+    dfb_region_resize(), dfb_region_intersects(), dfb_region_clip().
+    
+    Removed obsolete dfb_get_millis() and dfb_get_micros().
+
+commit 2b8dac1f42e36f8f4422c5c8b8319117da90115c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:44:20 2004 +0000
+
+    Cleaned up tile blitting a bit.
+    
+    Two steps added for performance:
+    - Check if anything is drawn at all before looping through tiles.
+    - Modify coordinates to exclude fully clipped tiles from loops.
+
+commit b7b651e02dbd72bd8e22b7a7edab0f86d7594b38
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:41:02 2004 +0000
+
+    Follow const change.
+
+commit 67077e82fee78226644eba2ddd639f3a8e047603
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:40:26 2004 +0000
+
+    Added "const" to UpdateRegion()'s "region" parameter.
+
+commit 53795be1d6baff38e9630887ba5b441c980de171
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:37:20 2004 +0000
+
+    Use direct_clock_get_millis() instead of dfb_get_millis().
+
+commit de8b5719dbda68c5c52fc2ce4ecb03bd96120183
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:33:05 2004 +0000
+
+    Added an assumption to D_MAGIC_SET that the magic value is not set already.
+
+commit 583f014cf9de90e08d72958a6e7d08970afb0bab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 26 15:31:43 2004 +0000
+
+    Added D_DERROR(ret,message) which acts like D_PERROR(message), but takes
+    a DirectResult (DFBResult) instead of using errno.
+
+commit dc498e8cd3020a4482113a9c718ce7aad4909ca1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 23 16:37:10 2004 +0000
+
+    Hopefully fix single buffered window updates again.
+
+commit f58308d86655010799c6c17c0220a0df659d02ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 23 14:52:00 2004 +0000
+
+    Create regions with opacity 0.
+    
+    Implement SetOpacity using DLOP_OPACITY, if available.
+
+commit 6a4ce6fbbe9d584744b07775e918d8ed939ea370
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 23 14:04:09 2004 +0000
+
+    Inherit DLOP_ALPHACHANNEL from layer context config only if the region that
+    is to be created for the window has a pixelformat with alpha.
+
+commit d0caaac3324667bc72f89b58024c04021d4d751e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 23 13:08:06 2004 +0000
+
+    Starting revival of DLBM_WINDOWS.
+    
+    A layer regions is now created for each window in the desired size and
+    pixel format.
+    
+    Moving windows (regions) around is working, too.
+    
+    Flipping the window surface flips the layer region.
+
+commit cb9c07f7c7c33f70f972bca573b0443035061c0c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 23 01:19:11 2004 +0000
+
+    Use debug domains.
+
+commit 2eb33ae1e66d5fbeb9c3465b9be99ed7b783ab41
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 20 20:02:18 2004 +0000
+
+    Added texture LUT support and some other 8bpp improvements.
+
+commit 7429ea957c5408f66f5201cad7eaeabaab2387d8
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 20 18:48:01 2004 +0000
+
+    The fb.offset trick should only be used on G400/G450/G550.
+
+commit 62e4c3d7165350c6fa67cb958392becbeaba4691
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 20 16:30:18 2004 +0000
+
+    FIxed mixup of true and false for DIRECT_BUILD_GETTID.
+
+commit 3679007f7faf73df5e14620276b48b3343c93f41
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 16 02:17:05 2004 +0000
+
+    Removed newline.
+
+commit 49711caa4aea6e445a119680b8163509d7a900c8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 16 01:54:59 2004 +0000
+
+    Made bug messages much more verbose.
+
+commit 23d3e3acd74dd88da8754d773165e1750a90bc54
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 16 00:44:11 2004 +0000
+
+    With "--disable-gettid" one can enforce usage of getpid(),
+    e.g. on broken systems where gettid() simply segfaults,
+    though the system call is in <linux/unistd.h>.
+
+commit 21b0e45b5959b29cac98314059461549a2058fa4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 16 00:12:46 2004 +0000
+
+    Forgot to increment core abi.
+
+commit d1187d5755d900a5ccf5a8c67312aed120e7edce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 16 00:11:30 2004 +0000
+
+    Changed color hash size from 2777 to 823.
+
+commit 4e52452ae9e46ca2faa6abbfc8c760acf8d2d559
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 22:51:20 2004 +0000
+
+    Old debug messages (D_DEBUG) should be grouped in domains (D_DEBUG_AT).
+
+commit 99081b0c02f8acf9739b81b4c0c3ab48459ac7d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 14:38:09 2004 +0000
+
+    Wait for only the last write operation queued for a buffer,
+    if the software needs to access it.
+
+commit 83942cc150d57499d696687054011c49714bf708
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 14:05:56 2004 +0000
+
+    Show TV Standards only if supported.
+
+commit 764ef719755c598af031a8e0cec8017949b9c66a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 13:53:53 2004 +0000
+
+    Store the serial of the most recent accelerated graphics operation that has
+    been queued for writing to a surface buffer.
+    
+    dfb_layer_region_flip_update() is no longer waiting for an idle accelerator,
+    if the buffer that is becoming the front has or had a write operation queued.
+    
+    Instead it waits exactly for the last operation that is or was about to write
+    to this buffer ;)
+    
+    If WaitSerial() is not supported by the driver and/or hardware, the fallback,
+    of course, is to wait for each and every operation to finish.
+
+commit 3da67648121d97caa3f40efa6fa04f09f3bfa4f0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 01:13:52 2004 +0000
+
+    Fixed a newline.
+
+commit af632aedeac24b708d976f7471960e34aacecec2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 00:59:26 2004 +0000
+
+    Added supported output signals to encoder description.
+
+commit 12f8d877abc8afd008522d87eabbd7bf8ffcb451
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 00:38:05 2004 +0000
+
+    Minor fix to mixer info.
+
+commit a361ac0c9162a9b72262dec4ca44a99999e9f03e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 00:35:52 2004 +0000
+
+    Added DFB_DISPLAYLAYER_IDS_MAX.
+
+commit ba69d611e30c10ea39a8592a743ca66cb195e132
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 15 00:31:14 2004 +0000
+
+    Added some notes about --enable-multi, --enable-debug and --enable-trace.
+
+commit 4d14d1e65213338b35a481cee9a73fa277aedfab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 23:52:10 2004 +0000
+
+    Fixed segfault during cleanup in single app core.
+
+commit 84878f5474de957f4c3762867e38a4cb89b372e0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 22:56:57 2004 +0000
+
+    Reduced layer id mask from 64 to 32 bit.
+
+commit 97471a2f2a1b9530f56f2f047220e69e43203737
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 22:56:42 2004 +0000
+
+    I thought I already removed that...
+
+commit f64f088f9f8a644d553eac192117f8f83bb8f4a4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 22:51:39 2004 +0000
+
+    Removed superfluous argument.
+
+commit 53089c1b9f0296def114871821183e0dfb341bef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 22:38:36 2004 +0000
+
+    Show mixers, too.
+
+commit fad9dd12d34b948b843b0babd27f9439ab1e4009
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 14 21:58:33 2004 +0000
+
+    Fixed DSECAPS_MIXER_SEL.
+
+commit 5d6e2dafb08197bbdd3c76b5cd9a54d48f335a61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 13 17:12:04 2004 +0000
+
+    Added DirectFBScreenMixerCapabilitiesNames.
+
+commit f516b416953109ff1bdb56f53b63f7bca9918968
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 13 16:26:30 2004 +0000
+
+    Clear description on the stack.
+
+commit 6313a485a793a94544854261708035571ccbfc7f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 13 16:20:57 2004 +0000
+
+    Added some assumptions about the combination of capabilities and number
+    of mixers, encoders and outputs.
+
+commit 535918aa3386a1b5808d194fa26f9515ceea5e83
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 13 13:09:23 2004 +0000
+
+    Added an assertion.
+
+commit 4dcea3a508d6774ee5c06f2f83f71e6dd196c9b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 13 02:49:58 2004 +0000
+
+    Applied patch from "Oskar Liljeblad <oskar@osk.mine.nu>"
+    which adds the configure option "--disable-sonypi-jogdial".
+
+commit ca58ee9095009ba221522a60e1186c40280097c7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 10 08:51:49 2004 +0000
+
+    Thanks to "Tom Bridgwater <genuss@gmail.com>" for pointing out a
+    memory leak during vector resizing.
+
+commit dd6c4be9f9d1fc4988189fd4195f0e9c0734a916
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 10 05:17:29 2004 +0000
+
+    Added "nowrap" to title.
+
+commit 85f75711418b5624f472cf34b5d26f8d69a1d5b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 02:28:43 2004 +0000
+
+    Fixed missing "-ldl".
+
+commit fbfe7ebb2bdd109a6767c56152628170151f94dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 02:26:26 2004 +0000
+
+    Commented out static/shared settings for Cygwin. For a strange reason
+    the settings are always made.
+
+commit 864eb8f86c833a0efc1a8a6b685c5b822efa5f73
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 00:55:16 2004 +0000
+
+    Use strrchr() instead of basename(), because <libgen.h> is not present in Cygwin.
+
+commit a3bddc90e844a0a9acd7832e01af061587ebc0c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 00:53:21 2004 +0000
+
+    Removed apparently unused <sys/user.h> which is not present in Cygwin.
+
+commit f3d1da4c340f9dbfe6864a72780213095c4061fb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 00:13:49 2004 +0000
+
+    Added ".o" support.
+
+commit 47bd8332625db0d9c44429463e7d474ea859f1f2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 9 00:00:44 2004 +0000
+
+    Added ".o" support for gfxdrivers.
+
+commit d147ceb5b907a65deb98c3b59de55cc47f29bdb2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 23:51:42 2004 +0000
+
+    Added missing ".o" for OSX.
+    
+    Added missing "if BUILD_STATIC" to SDL.
+
+commit 56a1c5e824903c7492c7d5d800e5d732f38bb8b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 23:39:23 2004 +0000
+
+    Use new ".o" versions for all modules except input and graphics, which
+    don't have ".o" versions, yet.
+    
+    New option "--voodoo" prints out all modules for statically linking in Voodoo.
+
+commit b38bb6323c2862d448f2c9c10294918a9a4cf755
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 23:10:36 2004 +0000
+
+    Added ".o" versions here, too.
+
+commit f0c5bb5211e8f8c68173875a424489d4693f1a47
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 23:01:56 2004 +0000
+
+    In static build mode, add an ".o" version of the ".a" module file.
+    
+    Applications can link statically against the ".o" files without having
+    to specify an extra linker option for each module, e.g. "-Wl,-udirectfb_sdl".
+    
+    The same support will follow for gfxdriver, inputdrivers and proxy modules.
+
+commit d897f15b75a3f9275511ed91d7fa2ff12be91e40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 22:40:22 2004 +0000
+
+    Detect cygwin, default to static builds and don't require libdl.
+
+commit f72307ea5869a4ed49ed305d9a53ddd1ae2d19fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 21:17:47 2004 +0000
+
+    Include <linux/compiler.h> to fix compilation of 2.6.8.1 <linux/videodev.h>.
+
+commit 2258eaf46d681cea4cf7dc647859bdcefd13d329
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 8 20:58:58 2004 +0000
+
+    When specified use the pixelformat of the surface description
+    to create a windowed primary surface.
+
+commit 26d39894366afee2d5faffbb1f10fb1b492519f8
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Oct 6 16:51:30 2004 +0000
+
+    Added sysfs support.
+
+commit 94520969d3e0659c23e7e1c4432b47b9f87ac100
+Author: Andreas Kotes <count@directfb.org>
+Date:   Mon Sep 27 13:22:24 2004 +0000
+
+    revise accidental commits
+
+commit 0bee6d2d618c8255f9e74b4925769f24ca351534
+Author: Andreas Kotes <count@directfb.org>
+Date:   Mon Sep 27 13:21:12 2004 +0000
+
+    input device stuff
+
+commit d05e9f6175c229a3e7f9e40c2cf445673c1fa417
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 27 13:00:44 2004 +0000
+
+    Removed two obsolete entries.
+
+commit 847e473ed1f5b603392c223368669b2911d277b0
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 27 08:35:15 2004 +0000
+
+    Added nvidia_tables.h.
+
+commit 92f123078c92f0888bae19a0d2b5de2fe31e0fbc
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 24 07:08:33 2004 +0000
+
+    Fixed PVIDEO limit (maximum memory offset is 0x07FFFFC0).
+
+commit 048ace6341f78ec00d3490efeac15e9add447911
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 23 06:54:18 2004 +0000
+
+    State handling hot-fixed and optimized.
+    
+    Corrected all pixel format settings in the tables, but StretchBlit()
+    still doesn't seem to work with RGB16.
+
+commit 7e75f79353cdcf719b9a3c1c6d143a958422a431
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 22 10:22:12 2004 +0000
+
+    Added "<Meta>-<BackSpace>" debugging shortcut for
+    dumping the stack of each thread of the master process.
+
+commit 4d40e2d7bdc5ed0729ef341e0526298153611eb5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 22 10:19:47 2004 +0000
+
+    Show file descriptor debug messages only if heavy debug mode is on.
+
+commit 2e3cffdf684c454b69185c12cb83af37374e7726
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 20 07:58:05 2004 +0000
+
+    Always update alpha value when blitting/drawing flags are set.
+
+commit 0695114645cc9d8e3eb7843f088404eed9d8554c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 11 12:00:32 2004 +0000
+
+    SetSourceRectangle works now.
+
+commit 316c5021c6edf470689ef3fa9e6a20a577c54326
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Sep 9 18:00:26 2004 +0000
+
+    Small adjustments.
+
+commit 9c4891499c8e092ab62ee83ec343b398d32210ac
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Sep 9 14:14:58 2004 +0000
+
+    Added support for Destination ColorKey.
+
+commit 12330221f61b86dc1305f02951f1ae495bcdb0bf
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Sep 9 09:15:35 2004 +0000
+
+    Many corrections.
+
+commit d7b01e0701dac8e42c4162c715816c5bb152c623
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Sep 7 12:43:29 2004 +0000
+
+    Added README for rivafb-smemlen patch.
+
+commit a3ca961253036221a8f4fc1ba9b97f3adde13008
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 6 11:09:38 2004 +0000
+
+    Still on StretchBlit source point: not the best way, but works.
+
+commit eb5392f197b9d4e5c1cca466289f95c2d677f405
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 6 10:29:34 2004 +0000
+
+    Workaround on StretchBlit source point.
+
+commit 9c77c849c96cf509974ea62780f1a92c691373ed
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Sep 6 08:46:36 2004 +0000
+
+    Added missing ';'.
+
+commit 495b05375e7364fedb16a30117a4a977e3a3cdf1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 6 02:05:50 2004 +0000
+
+    Fixed Sop_argb1555_to_Dacc() which didn't evaluate the alpha bit.
+    
+    This should fix blending and other effects from and/or to ARGB1555.
+
+commit 386bff2285fe26efb285b23761a58499e460e1ae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 6 01:06:57 2004 +0000
+
+    Fixed destination color keying for RGB16. Two pixels are compared at once,
+    but if only one pixel matched, it wasn't written.
+    
+    Implemented destination color keying for ARGB1555.
+
+commit 34986942f75ee05a60049d4dc3e03f01188956d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 6 00:37:15 2004 +0000
+
+    Fixed Bop_rgb15_SKto_Aop(), that's in english:
+    
+    StretchBlit with color keying from ARGB1555 to ARGB1555 dropped the alpha bit!
+
+commit b057d533c103acde02df60c4900df90828bbb967
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sat Sep 4 11:11:59 2004 +0000
+
+    Small fixes.
+
+commit 9540a7fd004bc635d1f9b0a11dcacaed755f9013
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Sep 4 03:15:02 2004 +0000
+
+    Thanks to "Tom Bridgwater <genuss@gmail.com>" for this nice patch that
+    adds support for SDL wheel events translated to relative Z axis motion
+    events (like all drivers with wheel support).
+
+commit 51dc332295490261709738df409957714a01b4c7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 3 16:36:27 2004 +0000
+
+    Added 'Claudio Ciccani <klan82@cheapnet.it>' to "Thanks To" section
+    and "Helping Developers" for the nVidia driver. Keep up the good work ;)
+
+commit 092fb9dd484fdc1deb50593542260da97e37ad58
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Sep 3 15:19:20 2004 +0000
+
+    Set alpha value only when using transparency.
+
+commit cdc5232f68567f946586b338f566319cb8acfb4c
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Sep 1 17:07:58 2004 +0000
+
+    Implemented alphablending (coloralpha for blitting and srcalpha/invsrcalpha for drawing).
+
+commit 8e6c64b05387e80d91a7ea51964d32506a354c1b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 31 07:40:10 2004 +0000
+
+    Perform PVIDEO initialization.
+
+commit 3286a4b852ac735f90f1a8eee0c855ced2b6f36e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Tue Aug 31 07:39:02 2004 +0000
+
+    Added UpdateRegion and support for adjusting Brightness, Contrast, Saturation and Hue.
+
+commit 854e7343e20b617e46f775567fb0454cc8e459e1
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 30 15:56:46 2004 +0000
+
+    This patch fixes a bug in rivafb:
+    the driver returns all videoram as usable memory while 128 Kb at the end are not usable.
+
+commit f2fa8d46fd669926f2078028d04d7fbd32be0f04
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Aug 27 06:31:45 2004 +0000
+
+    Disable draw/blending until we have more.
+
+commit 93041ba7e24756812419e73e47eb986428062f6a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Aug 26 17:17:42 2004 +0000
+
+    Added support for YUY2 and UYVY on primary layer.
+
+commit ccfb3c37aac2436519f26f830c75ce4a369b5c21
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Aug 26 14:13:29 2004 +0000
+
+    StretchBlit supports ARGB1555 now.
+    Added support for blit with conversion (ARGB1555,RGB32,ARGB to all).
+
+commit 825dd975904d25d3c21d64982702faace6004376
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Aug 25 21:24:32 2004 +0000
+
+    Now StretchBlit works at least at 32bpp.
+    Initial support for blending functions (only DSBF_ZERO).
+    Some fixes and clean-up.
+
+commit 08cdc18274eccc65c8978908c72fbfec81aac32d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 23 11:29:48 2004 +0000
+
+    Removed debug printf().
+
+commit b7ec3e8259c0a499e940cf4fc539183ad549813a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 23 10:06:48 2004 +0000
+
+    Start with object ID '1' to reserve '0'.
+
+commit 0764135cdef22742ebe01a1cd70bb4eba300569b
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Mon Aug 23 08:47:27 2004 +0000
+
+    Added support for ARGB1555, RGB32 and ARGB.
+
+commit 903b1915fb87581a85c22101b5fae4d5edccbfab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:26:51 2004 +0000
+
+    Added CLRCF_SURFACE and CLRCF_PALETTE to avoid setting the video mode each time the palette is changed, especially with df_palette example.
+
+commit 0501dfb8e54e86c2b3732c6ffea3257b1ab37860
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:18:51 2004 +0000
+
+    Added some D_ASSUME to check the clipping region in dfb_gfxcard_state_check().
+
+commit 114ba86e1c64c8cdb4321caf740568391b16fcc9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:16:58 2004 +0000
+
+    Show stack trace upon timeout waiting for empty read buffer.
+
+commit 87932454370e833e1305721add6b802057494aa6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:15:36 2004 +0000
+
+    Use CoreLayerRegionConfigFlags instead of DFBDisplayLayerConfigFlags.
+
+commit 5d379c4b61874dc3f6ded589c8f9c2e860ce85bd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:10:10 2004 +0000
+
+    Removed empty besAddRegion(). It's not required.
+
+commit 51aacaa25a47346a09a8d137f483f1018dde0642
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 22 22:06:22 2004 +0000
+
+    Ported to new driver API.
+
+commit ee528e1c29f18791f4eb5c7d82adc93ee98d3dc7
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Aug 19 15:42:09 2004 +0000
+
+    - support for cursor keys
+
+commit 616cad7dda601c2a20a75ef774ecefb518db4d6b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Aug 19 14:29:05 2004 +0000
+
+    - support for key repeat
+    - support for the left mouse button (no mouse motion)
+
+commit 171919f4ca0ddb0f05e4aebb3821f97bfc8750ec
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Aug 19 13:55:10 2004 +0000
+
+    - allocate four more bytes for images beeing loaded and scaled, this is
+      a workaround for a longstanding off-by-one bug in the scaling code
+      in src/misc/gfx_util.c which seems to tap one pixel behind the allocated
+      memory. this fixes problems on darwin/osx which has obviously more preceise
+      memory protection.
+
+commit 5a1548653580114cb0f005833a34c280ced7605f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 18 17:04:46 2004 +0000
+
+    just assign the charCodeMask to the key symbol for now.
+
+commit 7c7229870507c287ef18806c2d985b2b452d62fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 18 16:01:25 2004 +0000
+
+    Added shmalloc/shfree benchmark.
+
+commit 8f78bc8cd09a3316fbf950e1f094a3cb1d73761f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 18 15:59:25 2004 +0000
+
+    Added direct_pagesize() which returns the value from <asm/page.h> if present,
+    otherwise it falls back to sysconf() which is not suitable for cross compiling.
+    
+    Use direct_pagesize() in fbdev code and reenable the new mmio code.
+
+commit bd892091fca1549bf4bedcb09933c61735982094
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 18 15:19:34 2004 +0000
+
+    added support for FRONTONLY primary surfaces. this writes directly to the framebuffer. (df_dok works somehow now)
+
+commit 86127909ee3fb059eaf1f9d965b65b2520a6d123
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 17 19:58:03 2004 +0000
+
+    A small debug printf, sorry.
+
+commit 9e64bb54c068f6060616297f8dde82794d845fd0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 17 17:02:07 2004 +0000
+
+    Better style of using references.
+
+commit 8cd0f1851f1ddc01e7456a45ffc0a08dbe891758
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Aug 17 11:24:34 2004 +0000
+
+    forgot this file
+
+commit cbe9cfd0446bfa8c6fcd18b7cbc805566eec9b5d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Aug 17 11:23:54 2004 +0000
+
+    - added native osx system. yes osx support without SDL.
+    
+    what works:
+    - fullscreen
+    - mode switching
+    - keyboard (keys a-z only)
+    
+    TODO:
+    - make all keys working
+    - support frontonly modes
+    - cleanups
+    - joystick support
+    - mouse support
+    - window mode
+
+commit dd69544f332c1d05c9d6859942ddf12e395d0af5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 17 11:20:43 2004 +0000
+
+    fixed typo
+
+commit 9f90b6afdf794932392ff9a506bef4c18c68c3ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 16 15:35:44 2004 +0000
+
+    Temporarily comment out mmio alignment patch for debugging.
+
+commit 5234526f633b1fc1eb0e78ae794aa23ea0265db8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 16 15:13:59 2004 +0000
+
+    Added parentheses to conditional statement in system_map_mmio() to be sure.
+
+commit 0ea07c711878b7711671da189b48eff2bc2fb2c4
+Author: Andreas Kotes <count@directfb.org>
+Date:   Sun Aug 15 13:35:48 2004 +0000
+
+    fix message
+
+commit 54a2b593e44cb9801a85532e174fe4a993e05f66
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Aug 13 13:12:25 2004 +0000
+
+    do not report unknown event for JS_EVENT_INIT. print note about calibrating
+    the joystick using 'jscal' instead.
+
+commit 4aac0769b2702918e60818b1fb54b6a318d41e78
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 13 10:37:41 2004 +0000
+
+    Why has dfbsummon been in non-installed LINUX_ONLY_TOOLS?
+
+commit e34adb81a0e92aaa47471e3c376e5bdd2b5fecc4
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Aug 13 08:53:26 2004 +0000
+
+    Fix for mmio alignment on mach64.
+
+commit 28eb2c80f4f10ee9afaaf726a2f7f0178caefdb8
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Aug 13 04:37:09 2004 +0000
+
+    Open /dev/tty and /dev/tty0 as read-only.
+    
+    dfb_vt->fd wasn't being closed with no-vt-switch.
+
+commit d5ca83dec701550826dc8adc5037f8fbb1064c9f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 10 10:10:29 2004 +0000
+
+    Fixed NULL pointer check in dfb_gfxcard_wait_serial().
+
+commit ff188ec45bd74ca2ec2396452aec6a6fdef47434
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 9 18:36:35 2004 +0000
+
+    Added crtc2GetScreenSize().
+
+commit 1c1ea4d1d9938d1889b086c56e0fd3b00592ced6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 9 18:34:21 2004 +0000
+
+    Added GetScreenSize() to the screen API to get rid off the "no video
+    mode set yet" warning.
+
+commit 2e3efaeb9f93b4c4abf58963e7a7f6f5f12d3c63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 9 16:19:52 2004 +0000
+
+    Added new drawing function "FillSpans" which gets an y start value and
+    an array of "DFBSpan"s containing 'x' and 'width' of each span.
+    
+    It's implemented in the core right now, using FillRectangle() of the
+    drivers. For maximum performance we could add a FillSpans() function
+    to the drivers.
+
+commit f9fdf1bda973bd8c7e3272c1d951b1ecf0e3787d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 9 10:25:24 2004 +0000
+
+    Wait for the accelerator earlier, i.e. at the beginning of Flip(),
+    but wait for the one before the previous one.
+
+commit 57f6b5975a3adbd64f3d3492efd2cd644404a01b
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Aug 8 19:53:03 2004 +0000
+
+    More cropping fixes.
+
+commit 63afd5369435f37da08a7f58853fc797620daf13
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 6 19:26:30 2004 +0000
+
+    Moved storage of serial to window temporarily.
+
+commit fd878fc3d7cc5efaf0bb483e1c8957b6e9a45cf7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 6 14:50:31 2004 +0000
+
+    Added DSFLIP_PIPELINE for advanced synchronization with the accelerator,
+    currently implemented for Flip() on window surfaces.
+    
+    This feature is especially for accelerators with a command buffer that
+    can store more graphics operations than required to render one frame.
+    
+    
+    Behind the scenes:
+    
+    Added CoreGraphicsSerial which stores the "serial" of a certain graphics
+    operation and the "generation" of serials to handle more than 4 Giga Ops
+    in one session.
+    
+    Added GetSerial() and WaitSerial() to the graphics driver API.
+    
+    GetSerial() returns the serial of the last queued graphics operation.
+    
+    WaitSerial() waits until the operation with the specified serial is finished.
+    
+    Added CoreGraphicsSerial to CardState. It's updated by dfb_gfxcard_unlock(),
+    i.e. after issuing an operation using this state.
+    
+    At the end of Flip() the current graphics serial is stored and
+    the previously stored serial is being waited for.
+
+commit 2ebecce1eb1d7ba026bb604c67d234719e2c4606
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 12:50:43 2004 +0000
+
+    Removed "-Wno-strict-aliasing" until a check for the gcc version is added.
+
+commit 5aba21cfed1871d077bee1cdc70bc7c83555b429
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 12:42:31 2004 +0000
+
+    Delegate writes to the file descriptor to a new thread called 'EventBufferFeed'
+    to avoid dead locks in case the write() blocks.
+
+commit ec6bcdc9473997b48ce68f0e2b3cbd5175f0e702
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Aug 5 10:28:51 2004 +0000
+
+    describe workaround, better do not read it.
+
+commit 1e9966fcc8de3bac17eaa860f58a8c19481b9b38
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Aug 5 10:26:31 2004 +0000
+
+    found out why input is not working on OSX, added the following to
+    README.OSX:
+    
+       You will notice that input does not work, that's because it seems to be
+       neccessary to process input events in the thread that set the video mode.
+       (under linux it works anyway but we seem to violate the specs)
+    
+       see http://www.libsdl.org/pipermail/sdl/2004-February/060190.html
+
+commit b422f914168d70077f97cfc6292c86e86456c0da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 08:16:37 2004 +0000
+
+    Added "-Wno-strict-aliasing".
+
+commit efce9da93639ec6162c56270e6e01ecfbac34602
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 08:05:35 2004 +0000
+
+    Fixed gcc 3.4 warnings due to missing "const".
+
+commit b3c2d6becb841d0773266d095754c08a376c25c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 08:05:13 2004 +0000
+
+    Remove "--force" again, because it removes the file "COPYING".
+
+commit 32e337f1b5d34393984ee127e6718f7c86cdcc88
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 5 07:51:00 2004 +0000
+
+    Added "--force" to automake arguments for easier version hopping.
+
+commit 4e2130a673ed7c9c6bc8a0153f75960c48a54cfa
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 4 16:28:19 2004 +0000
+
+    added some hacks for better OSX/SDL compatibility
+    - added sdl libs to directfb.pc for OSX
+    - added dirty "#define main SDL_main" to directfb.h for OSX, this suck because
+      i have to undef it again in libdirect headers where directfb.h is still
+      included.
+    - added README.OSX containing instructions how to compile DirectFB on OSX
+    - updated README regarding OSX support
+
+commit d5b07a6e386e7bd5ce07b6e905c6ed87c0f9c1dd
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Aug 4 00:32:32 2004 +0000
+
+    Screen registration was missing from system_join().
+
+commit b6e454e10e9ddeda8b6ec801f68c78ca46b7cba4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 3 20:56:03 2004 +0000
+
+    Don't use this driver if "no-vt" option is used.
+
+commit 9cfca31df635281553ca167bdbe337dc42302be0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Aug 1 21:44:18 2004 +0000
+
+    Fixed vertical cropping.
+
+commit 7eac2cfeff2e132884c8eb6b1a993b110b6c46d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 30 14:22:30 2004 +0000
+
+    Added all missing va_end().
+
+commit a612dd72d1914f5ee3702b23ca6dfbf607773175
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 18:37:49 2004 +0000
+
+    Added (disabled) debug messages before and after write().
+
+commit a4c7cfd9b29f3a52bf9f6a25361d08409ff314ef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 18:21:34 2004 +0000
+
+    Fixed debug messages.
+
+commit fc5609928469c137dd65f9eee999fb9c5916abac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 17:44:22 2004 +0000
+
+    Don't wait for Fusion Dispatch Thread during emergency shutdown.
+
+commit ca092ab16f19a58ac0464ab1e6e9a470d6c639eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 17:35:23 2004 +0000
+
+    Added DSFLIP_NONE and enhanced documentation of all other DFBSurfaceFlipFlags.
+
+commit c300b97da974cd23d7b0e7e976b76c8b0dbea8fd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 16:06:44 2004 +0000
+
+    PostEvent() is the only method that is functional in pipe mode.
+
+commit 535163f993d7ec106daab4ddc9eac47a3dd43dcf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 15:59:56 2004 +0000
+
+    Added much text to CreateFileDescriptor() documentation.
+    
+    Made CreateFileDescriptor() turn the IDirectFBEventBuffer in pipe-only mode
+    in which all other methods return DFB_UNSUPPORTED.
+
+commit 411f56f725c7e251f64ee1d7f33d19f1081321f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 15:11:10 2004 +0000
+
+    Use socketpair() instead of pipe() to allow bigger buffers.
+
+commit a3098043441927ae0c5bf6b36da277cfc701d16c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 28 09:28:10 2004 +0000
+
+    While in WM mode pass through all keys except WM keys again.
+
+commit 6eeeea6785d6f1434e0d6c8449dd667006ca3b4a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 27 17:24:18 2004 +0000
+
+    Fixed sticky WM mode if Alt or Ctrl are released before Meta.
+
+commit 7d0e1d74789c65fc6bc90ede0d284452b69e1fe8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 27 15:50:21 2004 +0000
+
+    Support OpenGL on sub surfaces ;)
+
+commit e2bdb6b2a5bc23af565650ad759f89bbfde01770
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 26 12:52:46 2004 +0000
+
+    Thanks a lot to Ed Millard <emillard@direcway.com> for this patch:
+    
+    DIRECTFB PATCH
+    
+    The DirectFB patch implements hardware blitting on  GX1 graphics though
+    it is constrained, by hardware, to only blit surfaces whose width
+    matches the stride of the frame buffer.  In other cases it reverts to
+    the generic software blit.  The current driver in CVS only implements
+    hardware blit on GX2 graphics which doesn't  have this stride
+    limitation.
+    
+    The hardware accelerated functions for line, rectangle and fill have
+    been modified to honor  dst_offset for Y so they work properly with
+    double buffering.  In the current CVS version these don't honor
+    dst_offset and are working on the wrong buffer in double buffered mode
+    half the time.  X offset is not currently implemented in this patch
+    which is focused on making double buffering work.
+    
+    GEODE COMPRESSION BUFFER
+    
+    The patch is disabling the Geode's compression buffer when the DirectFB
+    nsc driver is initialized.  This may be a potential drag on performance
+    since it increases memory traffic on the video memory during refresh.
+    The compression buffer is very problematic for DirectFB since it is
+    unaware of it location in video memory.  For example at 1024x768 the
+    compression buffer is mapped right at the start of the second buffer.
+    You will see display artifacts if its not disabled and you will usually
+    crash the box as DirectFB overwrites the compression buffer with
+    randomness. In the future the compression buffer could be moved to the
+    end of video memory and video ram could be limited to prevent it from
+    overwriting it.
+    
+    VIDEO HARDWARE INTERACTION
+    
+    Moving the compression buffer to the end of video RAM can result in
+    conflicts if you are using video hardware since the geode_v driver in
+    geode_v4l2-2.3.2  also uses video memory.  In fact geode_v is currently
+    putting its video buffers in video memory in an area that will also
+    overlap the second buffer in double buffered mode at 1024x768.  This
+    problem can be remedied by changing geodedrv.c memory buffer offset to:
+    
+    #define MULTIBUFF_OFFSET          0x0
+    
+    This puts the video buffer at the very end of video memory.  It is
+    currently offset from the end of video memory by approximately 512K
+    which causes it to interfere with DirectFB double buffering at
+    1024x768.
+    
+    If you set MULTIBUFF_OFFSET  to 0, shut off the compression buffer and
+    limit DirectFB video ram to 3 MB you can run DirectFB double buffered
+    at 1024x768 and play video at the same time.
+    
+    -- Ed Millard
+
+commit 629403203197b163a4d010ef71b81023eeffe2c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 19 11:08:17 2004 +0000
+
+    Fixed usage of DIRECT_UTF8_SKIP in GetStringWidth.
+
+commit 4550b673f89f1e32ffeda84dc132a51861110790
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 14 09:08:29 2004 +0000
+
+    Added prefix "ret_" to all output parameters.
+    
+    Added "const" where appropriate.
+
+commit 8d5b0c2defe380aa6eb0f70ca1b9bb6779b6d850
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 14 07:16:16 2004 +0000
+
+    Use DirectList for events.
+
+commit b668d0db33012cc44bc24a54f5e4ad4b1b772d4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 14 04:48:28 2004 +0000
+
+    Automatically generate links if comments include function names,
+    e.g.: "... IDirectFB::GetDisplayLayer() ..."
+    
+    Minor code cleanup.
+
+commit aee2cfce4fdddba5e7afb756eaa01ecc2eedb060
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 14 00:58:06 2004 +0000
+
+    Added callback definitions to types page.
+    
+    Added css for removing the underline from links.
+    
+    Fixed margin for interface abstracts.
+
+commit f0064d59d0eae23167386a724754f88dfed4ddd2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 13 22:42:58 2004 +0000
+
+    Clear key code if CapsLock has been changed to Meta.
+
+commit 2532c69c99dc33474fa8e78bbeb46cd06174835d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 13 22:25:47 2004 +0000
+
+    Fixed capslock-meta which is a bit more complicated to implement in the core.
+
+commit 2c5dab220baaf5e23835355202f31b0855b00454
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 13 15:34:37 2004 +0000
+
+    Moved handling of "capslock-meta" to the input core.
+
+commit d4e98ec9f5f8f042d203851a27f00a0a73f10d35
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 13 11:12:39 2004 +0000
+
+    Added option "no-vt" which disables usage of VT code completely.
+
+commit ab796a5028b54b71a1dba10d6ad1637ea380c0fd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 12 21:15:25 2004 +0000
+
+    Simplified direct_list_foreach usage.
+
+commit a818de8efaff52c9d742a8ce9900a24928547558
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 17:38:24 2004 +0000
+
+    Put keyboard types to the end of the types page by moving the filename to
+    the end of the gendoc.pl command line.
+
+commit f64f7821758317cdc0b2b6d484e67d8c04ef8de5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 17:31:12 2004 +0000
+
+    Suppress some macros by using "@internal" within the comment.
+    
+    Added comments to DFB_DISPLAYLAYER_IDS_* macros.
+
+commit 1449be0c1cc185819b504589d8242b19dd8ad6b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 17:30:16 2004 +0000
+
+    Improved comment parsing: options can be embedded via "@<name>[=<value>]" at
+    the beginning of a line (after the asterisk though).
+    
+    Suppress some macros by using "@internal" within the comment.
+
+commit fa099ed411ca2986d818325ffe96fd2861858b4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 16:37:28 2004 +0000
+
+    Improved layout of types page.
+    Added macros to types page.
+
+commit cedf45ffe7a41d53d3885c0d3070a3f3f4ac7f41
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 15:47:31 2004 +0000
+
+    Fixed hyper link generation for "const" parameters.
+
+commit 8f60a8d6793ad0a98b0ab00f02ebff2c46951b86
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 14:45:54 2004 +0000
+
+    Allow sub surfaces to be used a texture by adjusting the texture coordinates.
+
+commit 1859f8c8c84bfa7a011837412f14808ae82601da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 9 12:45:01 2004 +0000
+
+    "vt-switching" is true by default now.
+
+commit 89180c26ea827653942657cc1d42dc524a6ee6d1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 27 23:52:01 2004 +0000
+
+    Corrected a mishap from RGB_TO_YCBCR() change.
+
+commit 547114fd6731429a535b809cb2de0880736e8a25
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 27 15:15:33 2004 +0000
+
+    Increment trapezoid trailing edge x coordinates.
+
+commit 89c233a306acdeb24b3f335709a21aca1a02e904
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 27 15:06:50 2004 +0000
+
+    Call dfb_gfxcard_sync() before FlipRegion() only if hardware has written to the back buffer.
+
+commit a36337ccaeb5483c61e97da55163b850b65973cb
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 27 14:55:32 2004 +0000
+
+    Made RGB <-> YCbCr conversion use integer arithmetic.
+
+commit f49b0750c11e31b67d0f931d55d4cf84c89f1c1a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Thu Jun 24 08:13:35 2004 +0000
+
+    Save some instructions in YUY2/UYVY scaling functions.
+
+commit c140da1858423e2f4684a3fb2f09a2595891530d
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Wed Jun 23 16:33:31 2004 +0000
+
+    Blit 32 bits at once when scaling YUV4:2:0.
+
+commit 3e8b52f63c1b39f5330d03d70535b2f6eb0dc516
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 22 19:08:09 2004 +0000
+
+    Added IDirectFBDisplayLayer::SetSourceRectangle() to configure layer source
+    cropping. Includes the relevant changes to mach64 and matrox drivers.
+
+commit 10e0c896caf5ec281355144d9ae462cf7b0be993
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 22 07:51:59 2004 +0000
+
+    Added convenience macros and inline functions for setting state members.
+
+commit 4db272c7c57c68a178155c91ba1fd6df1c25a9c2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jun 21 22:17:22 2004 +0000
+
+    include <sys/signal.h> for sigset_t on non-linux systems.
+    (needed by darwin)
+
+commit 772eb702f5340cb8c2193ea595d343ed6c84334d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 17 14:02:15 2004 +0000
+
+    shut up CVS
+
+commit 1a54a1f320f081e5860d45b8606034ca50a9f955
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jun 16 14:17:22 2004 +0000
+
+    removed compiled module, remove windows-style <CR><LF> in Readme.txt
+
+commit d5807ce153d02febe4c646186a0d9527ee1b115a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Jun 14 23:45:24 2004 +0000
+
+    Bresenham line parameters must be calculated differently for the 2D and 3D engines.
+
+commit 6bd147d69849b232285e4b3eb2de71fbb6d58a81
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 14 14:47:57 2004 +0000
+
+    typo
+
+commit 344c1378aa7193cc2b59335dd7f8db484278c698
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 14 14:46:44 2004 +0000
+
+    Update source rectangle in region config accordingly.
+
+commit bf2c03472904994e6da4067a3244013fc19ca363
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 14 13:37:52 2004 +0000
+
+    Show module name in error message if file name is (null) due to static linkage.
+
+commit c1aeb277c13ad5d4f6e2768bfc9e29f6aac2f660
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 14 12:21:04 2004 +0000
+
+    Thanks to "Antonino A. Daplas" <adaplas@pol.net> for porting the driver
+    according to internal API changes.
+
+commit 95f4735ee883bec7156f5c084fff054c51f09b5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 14 12:05:05 2004 +0000
+
+    Include C++ symbols in "nm" parsing code.
+
+commit eeacea40bef656d3d348449bed46ab625814d19d
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Mon Jun 14 12:04:33 2004 +0000
+
+    VIA Unichrome driver added.
+
+commit 25253d8547f20e451da7ae94e7bb142610582f1e
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Mon Jun 14 11:56:25 2004 +0000
+
+    Unichrome directory added.
+
+commit 2ad75b36b5d9945cb55f28e19e096629c4a82e8d
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Mon Jun 14 11:53:35 2004 +0000
+
+    Initial import of the renamed CLE266 driver. New features: support for multiple north bridges, the DVD subpicture layer and destination color keying in the video layer
+
+commit 02a39fcf81219512ebc7d14da990737e420cdfe3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 13 20:47:14 2004 +0000
+
+    Forgot to initialize a variable.
+
+commit e509c705cfc62378c144eed5393a97135dd95a65
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Jun 13 20:35:56 2004 +0000
+
+    Fixed yet another alpha channel problem. Non-blended scaler/texture blits
+    didn't copy the alpha channel.
+
+commit 69248e96d7dae4a058f1bc4cb8001fe3724ec78e
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Sun Jun 13 09:39:48 2004 +0000
+
+    Some improvements in YUV scaling functions.
+
+commit 6b9783f7705f437c600cfe94b54f4294f03a0a6a
+Author: Claudio Ciccani <klan@directfb.org>
+Date:   Fri Jun 11 19:55:26 2004 +0000
+
+    Implemented stretchblitting for YUV.
+
+commit 260d8c2362d2929ab25db3a86fb9bf6673ecd7fb
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Jun 10 01:43:20 2004 +0000
+
+    Wrong alpha value was being written to the destination.
+    
+    Bumped driver version to 0.13.
+
+commit 10dd6ee2ec0f246289e506755dc2dd47ccaa458d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Jun 9 18:39:46 2004 +0000
+
+    Added support for power-of-two pitch allocations.
+    
+    Enabled mach64 texture engine code.
+
+commit e1aceff61c244dc646f432b1873c10339624ab6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 9 15:31:31 2004 +0000
+
+    Added "#ifndef __cplusplus" around bool declaration.
+
+commit a27a27a1a94a9e4335c4676f19df6f1d4e237213
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 9 14:42:49 2004 +0000
+
+    Fix non-debug builds.
+
+commit b99118a46014e21c7ee7c3f1e3c2f558e2b596f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 9 12:02:14 2004 +0000
+
+    Added option "[no-]trace".
+
+commit 81f0f838c513d9538fbf8247cd4b179bebdeed59
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 9 11:19:11 2004 +0000
+
+    Implemented debug domains which can be enabled/disabled separately.
+    
+    But still a lot of code has to be changed to use domains!
+    
+    The new macro "D_DEBUG_DOMAIN (identifier, name, description)" is used to
+    define a debug domain which is used via "D_DEBUG_AT (identifier, ...)".
+    
+    The user can select debug output now, e.g.:
+    
+    no-debug
+    debug = direct
+    no-debug = direct/memcpy
+    
+    This disables debug messages in general,
+    but enables all "Direct/" messages except "Direct/Memcpy".
+    
+    The other way around:
+    
+    debug
+    no-debug = direct
+    debug = direct/memcpy
+    
+    This enables debug messages in general,
+    but disables all "Direct/" messages except "Direct/Memcpy".
+
+commit b14e0ec540bfdbdda959a344789f0d01d22810a2
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Jun 9 00:52:59 2004 +0000
+
+    Added texture engine blitting code. The texture engine requires a power of two source pitch so the code is still disabled.
+
+commit 8b1b25dfab1e51b20537d601242dcaef81e2c9b3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 23:01:33 2004 +0000
+
+    Mask x and y coordinate values. Fixes problems with negative coordinates.
+
+commit 7fe49524155576faa3eacef7dd07fe7aaa746ed3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 22:52:42 2004 +0000
+
+    Some cleanups, mainly cosmetic.
+
+commit 605276fb0dc30ec2b464d977780e7cb78ed4bd4a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 22:48:05 2004 +0000
+
+    Fixed GetAccelerationMask( DFXL_DRAWSTRING ).
+
+commit e61b9126c67d07090e62c35934be56503d2f8483
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 19:00:29 2004 +0000
+
+    Implemented missing blending modes.
+
+commit 6b381d4ee31f2bbc9705a04753253da4685c2a8a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 18:51:01 2004 +0000
+
+    Check for illegal blending modes in ati128, mach64 and matrox drivers.
+
+commit dce4be52d3af6916d554022a8e136d45043069f0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 10:26:26 2004 +0000
+
+    Another tiny fix.
+
+commit ff294df8db6d9717fbc238673f5ceb16c1888dd9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 10:16:34 2004 +0000
+
+    Minor fixes.
+
+commit 6803f282d6b488d60dd7216a70d4bd3d9e9f3a5d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 09:42:35 2004 +0000
+
+    Moved fusion_reactor_attach() after ABI version check to fix the failing
+    D_MAGIC_ASSERT() and print the default ABI version error instead.
+
+commit ce00db0008ae037f6946365c31f6590e4c76b8d4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 09:30:56 2004 +0000
+
+    If the file passed to load_symbols() is not existent, lookup the full
+    executable path via "/proc/self/exe" and compare its basename with the
+    file name of the object for which the symbol table should be loaded.
+    
+    Avoid recursive (most probably endless) calls to direct_trace_print_stack().
+
+commit 3a99032c58e37451d9ccdc2567f9a36e68d11259
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 08:38:11 2004 +0000
+
+    Fixed format strings.
+
+commit 52fb37e5bdfe27a85dc0fc52dae0d545ebb39ef1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 08:22:43 2004 +0000
+
+    Apply format & argument checking to message & logging functions.
+
+commit 664521f07fc248cacc6e845c2e54edb6a93705f7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 07:56:22 2004 +0000
+
+    When building shared AND static, filter out ".libs" for static libraries with newer libtool.
+
+commit 97086ad9e7474a4ca1f3da911f9fb2b62eb4489d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 06:54:31 2004 +0000
+
+    Replaced double with float.
+
+commit 684f705cabbb41354e2c633c5071b560668aa58b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 06:35:21 2004 +0000
+
+    Cosmetics.
+
+commit 5ee8d3241d7980284b2d488ff2cb4cd3ebd6a237
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 8 05:59:02 2004 +0000
+
+    Corrected CLRCF_ALL.
+
+commit 33180cea6683bae181fc0bab5eabf30dae3d3515
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jun 8 00:07:55 2004 +0000
+
+    Fixed triple buffering.
+
+commit 9f376b09b3f99800b01ce551065da1777c125ddb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 4 11:38:15 2004 +0000
+
+    Initialize addrlen.
+
+commit ed5881be57ae35c3475206983175f1f973e39311
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 4 11:07:17 2004 +0000
+
+    Code moved to wm.
+
+commit 94c0b384cf29380074db0ffb76c1063fb70d78dd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 3 15:47:19 2004 +0000
+
+    Fix scope of y.
+
+commit 8f42360aea036d8a37409ebc5dc62ce1d19fdda2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 3 04:32:19 2004 +0000
+
+    Over 20% of all added code lines ("+..." in this diff) are "D_ASSERT(...)"  ;)
+    
+    
+    Finished first version of modularized window management including the WM API.
+    
+    All wm specific stuff from the core has been moved to the "default" wm module.
+    The refactored code is heavily cleaned up and easier to overview or understand.
+    
+    Some parts are much simpler now, e.g. using a single fusion_vector_*() line
+    instead of several lines of code dealing with (re)allocation, moving etc.
+    
+    Another example is the merge of all seven restacking function implementations,
+    being a single function now that uses fusion_vector_move() after calculating
+    the new index based on different combinations of its three parameters that all
+    seven cases can be mapped to.
+    
+    Changed parameter order of fusion_vector_foreach() to "element, index, vector".
+    
+    Added fusion_vector_foreach_reverse() processing the elements in reversed order.
+    
+    Changed fusion_vector_index_of() to return "INT_MIN >> 2" instead of "-1"
+    if the element wasn't found. In case the return value isn't checked by the
+    caller, this will most likely generate a bad address at least.
+    
+    Added fusion_vector_has_elements() as a more
+    readable alternative to !fusion_vector_is_empty().
+    
+    Added fusion_vector_move() to move an element from one index to another.
+    
+    Added DFB_ITEMNOTFOUND with string "Appropriate item not found!".
+    
+    Added magic to DirectLink being asserted whenever possible in direct_list_*().
+    
+    Changed direct_list_foreach*() to allow variables that are no DirectLink*:
+    
+    Foo *foo;
+    direct_list_foreach( foo, list ) {
+    }
+    
+    versus:
+    
+    DirectLink *l;
+    direct_list_foreach( l, list ) {
+         Foo *foo = (Foo*) l;
+    }
+
+commit 5a196b611d1a72a7d4dafd3e152bbb2d4268cdaa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 2 17:06:49 2004 +0000
+
+    Implemented SetRenderCallback().
+
+commit fcc9698bfb052820db5f21ff5be21bbc0afc0b57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 1 23:09:31 2004 +0000
+
+    First step towards pluggable window management:
+    
+    Added wm module framework as a new core part similar to core systems.
+    Added option "wm=<wm>" to select the window manager module to use.
+    
+    Moved input event handling to wm module.
+    
+    Everything should work as before.
+    The "default" wm module implements the recent behaviour.
+
+commit 51685c17447a6b40adc1aa925af71a610ba3f819
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 1 21:49:17 2004 +0000
+
+    Use repeat mode for power-of-two textures.
+
+commit 82d72d044a6d965aa17013eef32faf132800e888
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 1 21:48:06 2004 +0000
+
+    Removed outdated script, use directfb-config instead.
+
+commit d01b432155b48829ce156d08639d7165b38a717b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 1 11:14:18 2004 +0000
+
+    Implemented TextureTriangles().
+
+commit 97630b619dd1caeae52903ae7a6ee13b8ac1aebf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 1 11:03:50 2004 +0000
+
+    Fixed missing buffer format in dfb_surface_create_preallocated().
+
+commit c8e98c239062a130a90145ae6167c57a48dca59f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 27 08:39:51 2004 +0000
+
+    Added optional 'indices' parameter to TextureTriangles() for indexed setup.
+    
+    Added method documentation:
+    
+    Maps a <b>texture</b> onto triangles being built
+    from <b>vertices</b> according to the chosen <b>formation</b>.
+    
+    Optional <b>indices</b> can be used to avoid rearrangement of vertex lists,
+    otherwise the vertex list is processed consecutively, i.e. as if <b>indices</b>
+    contains ascending numbers starting at zero.
+    
+    The number of <b>indices</b> (if non NULL) or the number of <b>vertices</b> is
+    specified by <b>num</b> and has to be three at least. If the chosen <b>formation</b>
+    is DTTF_LIST it also has to be a multiple of three.
+
+commit e5de307b0c1531a004a7796ffd654cc4fe9f5993
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 26 23:53:57 2004 +0000
+
+    Fixed __NR_gettid related preprocessor conditions.
+
+commit 342f9b61b4969c187f16206f342d54a6b6be7313
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 26 10:38:46 2004 +0000
+
+    Honor $(DESTDIR) when removing old header files, thanks to
+    Kristof Pelckmans <kristof.pelckmans@antwerpen.be> for spotting.
+
+commit ca0fbd7ff3b25d7b77105e8fc12fdefc6cf70536
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 26 05:06:29 2004 +0000
+
+    Some fixes.
+
+commit 1ab80e24df984fd77e6d7e4833b81da146bb4988
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 25 18:17:04 2004 +0000
+
+    Changed HAVE_V4L2 to DFB_HAVE_V4L2.
+
+commit 0a5534411d38008aaad6cbcc1055dfa317389e84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 25 14:21:08 2004 +0000
+
+    Fixed bug with Z buffer bits != RGB bits.
+
+commit 3beaf31b84bff8eb9b04a18121db1fb82c3f011d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 25 14:08:31 2004 +0000
+
+    Fixed dfb_surface_reconfig().
+
+commit 05098202905db122564265a5b96729aaa65d209e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 25 13:57:34 2004 +0000
+
+    Changed include order.
+
+commit 8890d5131ef1ce1c1d75d0f1522647ee5151dd83
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 25 12:48:05 2004 +0000
+
+    Clear depth buffer with all bits set.
+    
+    Use z compare function LTE instead of GT.
+    
+    Multiply Z value by 65535.0f in the driver.
+    
+    Remove Z value offset.
+    
+    Added correct InvWScale for a nearVal of 1.0f.
+
+commit 35fc3a37e603988c4cc26f531ee934c6ec7ee684
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 24 11:56:23 2004 +0000
+
+    Fix off by one that caused a segfault.
+
+commit 8492716849b66718e63287f571fa3863eefa2d90
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 24 10:44:02 2004 +0000
+
+    V4L2 has to be enabled explicitly via "--enable-video4linux2".
+
+commit 0de45b1a5a4398aeb8476eb3aa9957c6f77bb2bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 21 09:33:28 2004 +0000
+
+    Preliminary depth buffer support.
+    
+    Specify DSCAPS_DEPTH to have a depth buffer allocated and used,
+    currently hard coded to 16 bit.
+    
+    Some cleanups.
+
+commit 42f6c0331fa5e610c1baf6e264d811059fe003fb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 11:31:28 2004 +0000
+
+    Added pc file.
+
+commit dcf71b630b6eeae724f02dd1d4c0e0622d5829dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 11:30:56 2004 +0000
+
+    Don't allow GetWindow() on the cursor window.
+    
+    Added more "$(top_builddir)/lib".
+
+commit 869921f4a15f31c4e34a3e2d837cb0e6fd9cc28b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 11:25:24 2004 +0000
+
+    Moved new stuff into separate file.
+
+commit 753db174215c1c9632ca7c7d19f460ab4c4af932
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Wed May 19 10:52:03 2004 +0000
+
+    changed argument of SISFB_SET_AUTOMAXIMIZE from unsigned long to unsigned int
+
+commit 89bc6aa53001df78979448dd1f9f216322480e42
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 10:46:53 2004 +0000
+
+    Got textured triangles fully working.
+    
+    Fractional bits of Q are now 20 instead of 16, so the driver
+    version is not run time compatible with previous versions.
+    
+    Finally have a working mga_log2() again.
+    
+    Adjusted card limitations, added byte pitch alignment.
+    
+    Added some safety to calculation of register values (use masks etc.).
+    
+    Cleanups and optimizations, a few assertions added.
+
+commit a2fa0d5605327c5cb5503b41049d351b1176afb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 03:25:33 2004 +0000
+
+    Corrected scaling of NPOT textures.
+
+commit 0e7bf78c415059b27cde21a1de4344024c0654df
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 19 03:21:38 2004 +0000
+
+    Enabled anisotropic filtering in TextureTriangles().
+    
+    Removed NOPERSPECTIVE flag, adjusted mga_log2().
+    
+    NPOT textures still have wrong scaling.
+
+commit ff19077eda60deac44402a15894b951b586ba820
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 18 22:42:52 2004 +0000
+
+    Implemented matroxTextureTriangles().
+
+commit 2606be70cd5f0bdc239c18763afb8534dde1c5df
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 18 14:40:55 2004 +0000
+
+    Moved Voodoo headers to public directory.
+    
+    Remove old include directories during "make install"
+    (directfb-internal/direct or /fusion or /voodoo).
+    I know that's evil, but...
+
+commit 418bd2b4bd3143147da5bd46722ee2dda3960198
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 18 01:11:55 2004 +0000
+
+    Include shmalloc in SUBDIRS for single app, too.
+    This is to clean the directory via "make clean" after switching from
+    multi to single app.
+
+commit 2871c0321683c87643946130e536c6fa3ff6e74d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 17 08:02:00 2004 +0000
+
+    Implemented GetID(), GetDescription() and GetKeymapEntry().
+
+commit 2626e4824d622af2af5221ab7489ef6143804eb5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat May 15 17:38:25 2004 +0000
+
+    Updated matroxfb patches for linux-2.6.6.
+
+commit ca169d37a174d9950bcfe2eb4e447b3723702709
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 19:48:08 2004 +0000
+
+    Applied patch from Henning Glawe <glaweh@physik.fu-berlin.de>:
+    
+    - fix the 'Makefile.am's to include $(top_builddir)/lib, so the
+      construct 'mkdir blah; cd blah; ../configure; make ' works again
+    
+    - include the rest of the tools in libdirectfb-bin
+
+commit 4141bc3d519ca8f2b34ce93e4500f0fdf4ee8d2e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 18:05:21 2004 +0000
+
+    Fixed debug messages.
+    
+    Added direct_initialize() and direct_shutdown() calls to the test program.
+
+commit b9d01dfbf01b7f80857b6683057960b70a69a206
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 17:47:34 2004 +0000
+
+    Increased read size for header and data, adjusted loop.
+    
+    Added some debug messages.
+
+commit f2c70b6f72d0e68eb1b313dccfc46ca5759ada19
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 17:45:47 2004 +0000
+
+    Fixed streaming buffer which was broken by the list structure change.
+    It uses direct_list_append() and direct_list_foreach_safe() now.
+
+commit 1994b6bf3699eaa3ca101a5bdf2db7712e99adc1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 16:48:49 2004 +0000
+
+    Moved signal handling to libdirect.
+
+commit 8951f8859fec145a1d91d0a9f0e03b075b1f330c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 16:36:14 2004 +0000
+
+    Added <Meta>-<Escape> description:
+    
+    Press Escape to return from fullscreen mode to the desktop.
+    (currently not advisable if the fullscreen app is still flipping)
+
+commit 6cef9e240831e46afca9895d0279227ef507c877
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 12:16:02 2004 +0000
+
+    Implemented IDirectFB::GetInputDevice().
+    
+    Added Dispatcher and Requestor for IDirectFBInputDevice and
+    implemented CreateEventBuffer() and AttachEventBuffer().
+    
+    Replaced some old copyright headers.
+
+commit a5d7a35dcab5560d49014e28ec57423058ae563e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 10:27:10 2004 +0000
+
+    Link against libvoodoo and libdirect.
+
+commit a68ffc843b64a8cda6c5351e5ae86ba200ad309d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 10:12:19 2004 +0000
+
+    Implemented all remaining IDirectFBFont methods.
+
+commit 579f6ac7da39a5f49517ced5c84a35ae4fa94d1e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 14 08:43:42 2004 +0000
+
+    Implemented GetAscender().
+
+commit b40d72aa3f92b25d57cbd90dbc17de84e6f24b70
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 13 20:58:50 2004 +0000
+
+    Implemented IDirectFBSurface::GetVisibleRectangle().
+
+commit 131d5d361128fa2e571dbe149f995f769dd37e7e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 13 19:03:05 2004 +0000
+
+    Implemented IDirectFB::CreateEventBuffer()
+    and IDirectFBWindow::AttachEventBuffer(), phew... ;)
+    
+    Renamed voodoo_manager_register() to voodoo_manager_register_local()
+    and voodoo_manager_lookup() to voodoo_manager_lookup_local().
+    
+    Added voodoo_manager_register_remote() and voodoo_manager_lookup_remote().
+
+commit 9d07571c402debbb3e24963283537b8ba962cce1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 13 19:00:33 2004 +0000
+
+    Forgot to commit the description of <Meta>-'S'.
+
+commit 1f191e8d43c43e068370e7169609a74c252b50e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 11 12:03:36 2004 +0000
+
+    Allow per file debug mode forcing via definition of DIRECT_FORCE_DEBUG.
+
+commit 00854ecc0aa9ee8a8e8d9c615205332bf17ccccd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 11 04:21:18 2004 +0000
+
+    Changed <Meta>-'S' to raise the lowest window, e.g. to revert a <Meta>-'A'.
+
+commit bab7379a565a586d792b1e7bac2a1ca3b6f93ef0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 11 03:51:16 2004 +0000
+
+    Added DFXL_DRAWSTRING that is set by dfb_gfxcard_drawstring_check_state() when
+    it is called by IDirectFBSurface::GetAccelerationMask() for the current font.
+
+commit e65890898b0e10e2edfa0b6a3d34799349c7e774
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 9 23:38:05 2004 +0000
+
+    Added #ifndef around ABS and SIGN.
+
+commit d832fca05530f36776848b1a272122b46359486c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 9 21:48:23 2004 +0000
+
+    Wrong variable name.
+
+commit 5ac7f9c109d32ae9d2ac188eb68fcfab9164df2a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 9 19:31:31 2004 +0000
+
+    Added pkg-config files for libdirect and libfusion.
+    
+    direct/ and fusion/ headers are installed to the public include directory, now.
+    
+    Added a simple figure of the DirectList's structure.
+
+commit 5f1e8b422f714148cb079a239d29cf4668e05f05
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 6 04:42:07 2004 +0000
+
+    Even nicer.
+
+commit 23cc3a2e3c17b8c9637366ecf0274ccb9e80adc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 6 04:30:34 2004 +0000
+
+    Print error message if the given mode (via "mode=" option) is not supported.
+
+commit 1c1b08ad535b9b7c7fbb16991d4e41309b08b996
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 21:28:36 2004 +0000
+
+    Added message "DSDESC_PALETTE and DSDESC_PREALLOCATED not supported yet".
+
+commit 97752cc3a01c49ca818a4ca25b5e8166934fa840
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 20:56:10 2004 +0000
+
+    Increased color hash size.
+
+commit ec74d4066d9b8f1dc9209ec616999024f8b626a6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 19:55:00 2004 +0000
+
+    Migrated module management.
+
+commit 894b2e4787ca0556e2f3b75a06bf171a3bad89b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 19:02:49 2004 +0000
+
+    Added direct_list_append() and changed the list structure to have
+    the first element's 'prev' pointing to the last element of the list ;)
+    
+    Made direct_list_*() functions static inline.
+    
+    Added DirectThreadInitHandler which can be installed/uninstalled using
+    direct_thread_add_init_handler() and direct_thread_remove_init_handler().
+    The registered init handler function is called at the beginning of new threads.
+    
+    Use DirectThread all over the place.
+    Install init handler that calls dfb_system_thread_init().
+
+commit 19793d56446fbd7500c941dd0405ecfdd3e1befc
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 5 17:54:30 2004 +0000
+
+    no longer include <linux/cache.h> and define __KERNEL__ which led to problems with some kernels, define cache size macros ourserlves.
+
+commit e8a985fec62da49df5c9aaecb363d357241f43ca
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 5 16:54:21 2004 +0000
+
+    remove unneccessary #includes
+
+commit 42b58de2e5b82826a48dad1c41c21a5754cd867d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 08:07:30 2004 +0000
+
+    Removed obsolete stuff.
+
+commit dae42f97a074efc2418a6e118dabf1bba7ceedab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 02:04:37 2004 +0000
+
+    Implemented SetVideoMode().
+
+commit 63bdca7dd126c4a0f0c9e2766ef5f5d5fedef952
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 5 00:46:24 2004 +0000
+
+    Flush output buffer automatically after waiting 50 ms for explicit flush.
+
+commit d697db2f759215dda1c7b08ce4607c5c51fdab74
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 23:31:48 2004 +0000
+
+    Wait for response in Flip() if flags contain DSFLIP_WAIT.
+
+commit 6e2128e172c179cab8089c9cf377c27cbac7cb5d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 23:23:03 2004 +0000
+
+    Don't use VREQ_QUEUE for Flip().
+
+commit 01a2da6b309059c1a98b0be541c23cacb6a89af6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 23:14:24 2004 +0000
+
+    Added flag VREQ_QUEUE which has the effect that voodoo_manager_request()
+    doesn't wake up the output flushing thread. It's used for all drawing related
+    requests to increase the rendering throughput by avoiding small send()s.
+    
+    Experimentally using IPTOS_LOWDELAY.
+
+commit b210ce7ae2f3b7e6df8667586d82b5c243c7eb75
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 18:05:08 2004 +0000
+
+    Added interface instance tracking in debug mode,
+    showing remaining instances at exit time (like it's done for allocated memory).
+    
+    Added DIRECT_UTIL_RECURSIVE_PTHREAD_MUTEX_INITIALIZER.
+
+commit b5438f94a2ab7f3e5774fd66e6d9013c4607b5c0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 16:38:50 2004 +0000
+
+    Link executables against libfusion and libdirect explicitly.
+
+commit 86bcba1e00ed0e615d90add6401d49f68e60cbdb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 16:25:51 2004 +0000
+
+    Added thread names to debug output, stack traces etc.
+    
+    Added direct_thread_self(), direct_thread_get_name(thread)
+    and direct_thread_self_name().
+
+commit f001b12fba0e4f740dd96a0e3563a4bee77ec610
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 14:05:02 2004 +0000
+
+    Added configure option "--enable-voodoo", default is no.
+
+commit 55f6903bb0007a20357b37034ad2a1f83f755f16
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 12:53:02 2004 +0000
+
+    Implemented GetOpacity().
+
+commit dd6f6012e196f231cc0e9a903c2ba2d108251954
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 12:30:24 2004 +0000
+
+    Further implementation.
+
+commit e18d3829ea6cb399cae7f4054e86080e0a9f30b5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 12:28:54 2004 +0000
+
+    Use TCP_NODELAY, increased buffer and max. message size.
+
+commit 191ef7eb9935f9ce75d15e286add59c54567e6e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 4 12:27:33 2004 +0000
+
+    Implemented hash table resizing.
+
+commit 6efcdc4da28ecb44dd9e8284fafdf9de69a619d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 14:59:08 2004 +0000
+
+    Ongoing Voodoo... got DFBTerm running.
+
+commit a2744e73568d7b1475fd7146c8f91ed5d6d6db76
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 10:53:34 2004 +0000
+
+    Argh.
+
+commit 333f553eeac0e1dde6982a2a6b95c74ea4bdc225
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 10:36:21 2004 +0000
+
+    Added requestor template.
+
+commit c6e9685ae1f0205cfda025e447e13fb259c99cff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 10:32:21 2004 +0000
+
+    Added more cancelation points to event buffer feeding thread.
+
+commit 2ca894baedf945849e1e5a2f751b65f843c48a44
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 10:31:31 2004 +0000
+
+    Start debug output with upper case.
+
+commit 2ca51d1e4ff5981fd998a0944f2b328d556b8884
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 3 10:30:50 2004 +0000
+
+    Link against libfusion.
+
+commit 0ba4c4ac1fc2c918b1310188930e68605cdbe959
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 30 02:25:12 2004 +0000
+
+    Improved and cleaned up thread loops, resulting in better performance.
+
+commit 4adb447e964d75fd2adb2d13a27ac313122a6d30
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Apr 29 23:12:11 2004 +0000
+
+    if we do not have <linux/unistd.h> include <unistd.h> for getpid
+
+commit ebe125822d3450a82a9d30843641fbd91480b6d9
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Apr 29 23:08:57 2004 +0000
+
+    include pthread.h which is required for pthread_sigmask() on BSD
+
+commit 4def0b9f0497bc400a81a5874ab52c46e142b1b7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 21:50:11 2004 +0000
+
+    Fix gcc 2.95 build.
+
+commit 675d78194aa08c849a0f3015f95bf7441cc5a333
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 19:08:35 2004 +0000
+
+    VOODOO
+    
+    Added network transparency to DirectFB ;)
+    
+    The concept is quite simple and working great. Each interface has two
+    new implementations: "Requestor" on client side and "Dispatcher" on
+    server side. Between them is a very small libvoodoo which manages network
+    connections and provides fast and powerful message encoding and decoding.
+    
+    Each Dispatcher instance gets an ID which is also managed by libvoodoo.
+    The Requestor sends a request message for each method call, specifying the
+    remote instance ID and the method that is to be called. Parameters are appended
+    to that message before it gets sent to the server. On the server side the
+    Dispatcher interface is looked up in a hash table using the instance ID.
+    After fetching the parameters from the message without copying any data
+    except for some rare cases, the Dispatcher calls the "real" implementation.
+    
+    Some requests have a corresponding response and some don't, e.g. all drawing
+    related methods return immediately after sending out the request. Methods
+    that require a response block until the response is received. Each response
+    contains at least the result (DFBResult). Further response data is appended
+    to the response message and returned to the application after being processed
+    by the Requestor.
+    
+    Not every Dispatcher is server side and not every Requestor is client side.
+    IDirectFBEventBuffer and IDirectFBDataBuffer have a client side Dispatcher
+    and a server side Requestor. The server has to send events to the client side
+    by making a PostEvent request (without response). It also has to fetch data
+    via requests to the client side data buffer (with response), e.g. while
+    it is dispatching a RenderTo request. The client will send its compressed
+    data (PNG for example) over network to the server ;)
+    
+    Another advantage is that existing applications can be used without changes.
+    
+    The setup is quite simple: There's a new program called "dfbproxy" which
+    just waits for incoming connections (currently port 2323). It doesn't even
+    call DirectFBCreate() before clients request that.
+    
+    Running applications via the proxy is done by passing "--dfb:remote=<host>".
+    
+    Notes about performance: If DirectFB is built with debug mode disabled,
+    df_dok produces nearly the same results over ethernet. Running both the
+    client and the server on the same machine is slightly slower right now.
+    
+    Notes about the implementation status: A lot of Requestor and Dispatcher
+    methods are not implemented yet, but many demos are running already.
+    IDirectFBDisplayLayer, IDirectFBWindow and IDirectFBInputDevice are missing
+    completely so far. IDirectFBFont has to be changed to use data buffers, too.
+    Currently the filename is transmitted over network and the font file is
+    loaded from the file system of the server.
+    
+    
+    OTHER CHANGES
+    
+    Print a warning message in dfb_screen_rectangle()
+    when dfb_system_current_mode() returns NULL, e.g. during initialization.
+    
+    Moved fbdev and sdl modules from src/core/ to systems/.
+    
+    Added a magic to public interface structs,
+    i.e. use D_MAGIC_SET/ASSERT/CLEAR to detect life cycle problems.
+    
+    Added "const" to some parameters in the public API.
+    
+    Added a minimalistic hash table implementation for usage with IDs as keys.
+    
+    Added direct_clock_set_start() that is called by Fusion's initialization
+    to synchronize time stamps of debug messages.
+    
+    Changed D_MAGIC to enable spells with less than eight characters;
+    this macro generates a magic based on the string (spell) passed to it.
+    
+    Added DirectResult which is the DFBResult outside of DirectFB.
+    
+    Added message macro D_UNIMPLEMENTED which prints a warning once.
+    
+    Added a name argument to direct_thread_create(),
+    printed during creation and termination of threads.
+    
+    Moved fusion_pthread_recursive_mutex_init() to libdirect,
+    being called direct_util_recursive_pthread_mutex_init().
+
+commit b16bb03632ba78e661f4c0ac52a4897a550f637d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 14:57:56 2004 +0000
+
+    Great thanks to "Vadim Catana <vcatana@registru.md>" for this
+    patch fixing several issues with the overlay on Radeon9200!
+
+commit 707a3102d74726f00bd81e2e7a410bada8767b1f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 05:54:54 2004 +0000
+
+    Allow kern_x or kern_y to be NULL.
+
+commit 28b98a461ec9312078dd49d473cbf848a8772aef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 03:58:34 2004 +0000
+
+    Follow UTF8 code changes.
+
+commit b65a2f1940c5e04072f6d21dd966ce2f7d188ee9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 03:57:35 2004 +0000
+
+    Wrote a highly optimized version of "IDirectFBFont_GetStringWidth()".
+    The previous version used the bloated "IDirectFBFont_GetStringExtents()".
+
+commit 413823c2c1aa4518eaa376f5fda7d22aa4c8bbb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 03:53:21 2004 +0000
+
+    Replaced 256 entries lookup table "direct_utf8_skip"
+    by the macro "DIRECT_UTF8_SKIP" and a 64 entries lookup table
+    which is statically defined in the header again.
+    
+    Replaced the non-inlined function "direct_utf8_get_char()"
+    by the macro "DIRECT_UTF8_GET_CHAR" which uses a much smaller
+    and inlined function for non-ascii cases.
+
+commit bfb0dbeeff67354fb11f3155c5dd16fb8fe9626c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 29 01:42:44 2004 +0000
+
+    If "__NR_gettid" is still not defined after including <linux/unistd.h>,
+    print a warning and use getpid instead of gettid.
+
+commit 315df6985af6cf99afe9fe1b1b3a79bedbc4bd46
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 28 03:25:35 2004 +0000
+
+    Work around libstuhl's sys_lib_??search_path_spec during cross builds (untested).
+
+commit afec3553f325e9d6ad9009c33754a6a00d155850
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 27 06:15:20 2004 +0000
+
+    Added internal documentation, mostly diagrams.
+
+commit 1e7fd7dda91dee85372c5c391281f0ab56c83bd5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Apr 22 15:49:59 2004 +0000
+
+    Fixed field parity option.
+
+commit 084564e29cead69c896834729c154edb74d98b18
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Apr 21 14:21:23 2004 +0000
+
+    updated savagefb patch for 2.4.26
+
+commit 6f84fca7e84bb2ee193bd9cadb21570556742a59
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Apr 21 13:50:37 2004 +0000
+
+    - compile fixes
+    - disable overlay support
+
+commit 7a8869e366b93b60d2cb82a885a683096a60aa30
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Apr 15 15:50:28 2004 +0000
+
+    -optimized version of rgb16 blitting with destination color keying
+    -support for rgb32 blitting with destination color keying
+
+commit 35e00c9e7e36cabde22292e96127a21331c7b65f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Apr 14 18:17:56 2004 +0000
+
+    unoptimized implemetation of rgb16 to rgb16 destination color keying for testing purposes.
+
+commit 856de6055c24ca9058ff3bc96c8e86f8715f2bb1
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Apr 13 22:33:12 2004 +0000
+
+    minor cleanup
+
+commit 144be84f594841e2796c58019f5b4ecaa0a2f321
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Apr 13 20:08:44 2004 +0000
+
+    build neomagic driver
+
+commit fc6ebe75205c032cbd8bbfdca64d3bbcbead8022
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Apr 13 20:08:26 2004 +0000
+
+    port driver to DirectFB 0.9.21 internals
+
+commit ca4e31f1aadb91e70376d6a4bac878a16931c8d5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 8 12:02:55 2004 +0000
+
+    Fix single app core build.
+
+commit 931dc2843055f679b3176a9a10a0976a86bb39e8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 8 11:22:46 2004 +0000
+
+    include errno.h
+
+commit ce584f6609ccdc97acd8ba13cee9a38e6ea2b8d6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 8 10:25:27 2004 +0000
+
+    Fix assertion caused by double destruction of the core
+    when applying the configuration fails.
+
+commit 7527482b1c8a9222f211e0af7622e556de842bf5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 8 09:14:18 2004 +0000
+
+    Force CPPFLAGS to be included for compiling dtest.
+
+commit fd0cc4dd01780c5a9ab47bdc5d2cd3fde576e755
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Apr 7 15:09:34 2004 +0000
+
+    - increase minor version (0.2)
+    - applied overlay patch from Vadim Catana (thanks!)
+    looks good, needs testing (no radeon here to test)
+
+commit f48b4bac7d6b9d490ae111240347e34679437615
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 5 12:27:56 2004 +0000
+
+    Moved interface handling to libdirect.
+
+commit 649540bcd8afa16e139aa55f7b988d437525c1af
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 5 10:35:19 2004 +0000
+
+    Cleanup includes.
+
+commit 9d55931f5ca7cef5a8a456d624f70111e863e612
+Author: Andreas Kotes <count@directfb.org>
+Date:   Fri Apr 2 12:34:38 2004 +0000
+
+    compare errno instead of ret with EINVAL - fixes linux_input on 2.4
+
+commit c3b29d306934ffbb7169c3f024dae253af03e7bb
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Apr 1 18:41:50 2004 +0000
+
+    Use EVIOCGRAB ioctl to grab the device.
+
+commit fcb650ef87b167d5eaa49f1e272928b03d0ef237
+Author: hunold <hunold>
+Date:   Wed Mar 31 10:13:30 2004 +0000
+
+    - fix unknown reference to MAX by includeing <direct/util.h>
+
+commit 2b5bafc3f14dd9b34e7115187a8ac686cd664875
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 23:42:36 2004 +0000
+
+    Further migration.
+
+commit b742b1cee162ee36d81781ecccee973461bbaa11
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 22:51:33 2004 +0000
+
+    Migrating tree *creak*
+
+commit b92f364bf157c52d4466db6efc9b52633ef7c02a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 21:38:37 2004 +0000
+
+    Migration.
+
+commit 9c424317a8c7e65892068456c44958c202bd5c50
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 19:48:08 2004 +0000
+
+    One more include was missing.
+    
+    Remove accidently added file.
+
+commit dcd1e2edf6ac5030c5270c9bc78c10bec412f50e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 19:37:11 2004 +0000
+
+    Fix Makefile.am for static builds, copy'n'paste broke it.
+
+commit 9e0b23a846e2a394346ac1efca2cb724258884d1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 19:13:39 2004 +0000
+
+    Added missing includes.
+
+commit 943227457616cf3c9c04c249a3c756acc37400c5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 18:35:08 2004 +0000
+
+    Giant cleanup and restructuring.
+    
+    There are three libraries now: libdirect, libfusion and libdirectfb.
+
+commit a5b43ba63b828190794208c46be861d41af9d36a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 13:27:19 2004 +0000
+
+    Fix non-debug build.
+
+commit 115b24243e7de219d80237f74c94a969027bf45e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 12:03:36 2004 +0000
+
+    Fixed warnings.
+
+commit a548edfedf927f3cae542924b1481f3bc9a0b6ac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 10:31:27 2004 +0000
+
+    Added DIRECT_BUILD_TRACE and DIRECT_BUILD_NOTEXT.
+
+commit 51ae67bcfdd5428f37a7450f632c3a258573fe7a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 10:12:58 2004 +0000
+
+    Generate and install a header file containing some defines like DIRECT_BUILD_DEBUG.
+
+commit b9035dbe990697ca3b72ecae6530a2a82297a5b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 30 09:31:13 2004 +0000
+
+    Migrating base functionality to libdirect.
+
+commit 9e6d496157d58194ea7c47cb80b01970117bb20a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 30 05:25:46 2004 +0000
+
+    Use better constants for black/white level calculation on G450/G550.
+
+commit 43fd328e78d9b7ed8fdff92f9a8687fbe5869608
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 26 18:33:26 2004 +0000
+
+    Added missing break in WaitForDataWithTimeout() to return upon timeout instead
+    of busy looping.
+
+commit cdb8309a90477700abb0a126ab0ea77e932321da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 24 12:26:07 2004 +0000
+
+    Return DFB_DESTROYED in IDirectFBSurface_Window_GetSubSurface() if the
+    surface of the window is NULL, e.g. after destroying the window.
+
+commit 671918392e4fa14d61b292dfe00e9b219cbb4269
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 24 07:26:39 2004 +0000
+
+    Show total number of bytes allocated.
+
+commit 9bcb4d6eb278efff00fc3ba1ff49e6977cd6d624
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 24 07:16:14 2004 +0000
+
+    Rewrote shared memory allocation debug list handling
+    using capacity based list reallocation like FusionVector does.
+    
+    No longer store local pointers to file and function names within the shared
+    memory list entry *sigh*, but copy the strings into the list entry which stores
+    function names with up to 48 characters and file names with up to 24 characters.
+    
+    Added option "-s" to dfbdump to show this list of all shared memory allocations.
+
+commit 0e9e6b734048b22228c35fe138ccc9725687cb47
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 24 03:25:47 2004 +0000
+
+    Show the reference id of new objects in debug message.
+
+commit b1567802b3e34acfdcafd4c536917649c31f5907
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 23 21:28:27 2004 +0000
+
+    Fix collision of "signals" with Qt headers.
+
+commit e69a4701dc2046d8860409ffefb48f097bc85ca0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 22 01:04:08 2004 +0000
+
+    Workaround for segfault due to dfb_system_current_mode() returning NULL.
+
+commit c64d36e5d4ae80cdb0de30fd119fb05219da6c91
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Mar 19 10:46:17 2004 +0000
+
+    mga_waitidle() should wait for idle DMA.
+
+commit 4951d56d2aef27a9d88e527323d45c7f4701d5ef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 16 14:47:09 2004 +0000
+
+    Resolve more symbols.
+
+commit 6559b36053961aa29c5fb03f1b17bb98b43daf59
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 15 18:34:13 2004 +0000
+
+    Fixed and used fusion_list_foreach_safe.
+
+commit dc9f26632de2db1866fb69b751e5182cba6be822
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 15 18:33:41 2004 +0000
+
+    Print full object path in stack trace.
+
+commit b9b95e4b8962f0e02c410b4267f31b44206351eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 8 11:50:29 2004 +0000
+
+    Turn AC_MSG_ERROR into AC_MSG_WARN.
+
+commit 26fab30bf10f416cbc77e952c02d2defd1fde912
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Mar 8 06:38:23 2004 +0000
+
+    Added sysfs support to matrox i2c detection code. Now it works on 2.6 kernels.
+
+commit ce2812c501dfee69f1d964ed7d17096bb9604b98
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 2 23:59:32 2004 +0000
+
+    Millennium I doesn't support source color keying.
+
+commit d56ae483e01fe63ae8b4d67b3eef7d64b50a69bd
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 2 23:51:41 2004 +0000
+
+    Don't try to find the PCI device unless it's actually needed. The
+    framebuffer address check can actually fail with Millennium I/II because
+    matroxfb lies about the address.
+
+commit 2a5a5d22812a27619a69318fca127ebefcb7802e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 2 19:33:41 2004 +0000
+
+    Added SGRAM autodetection for mach64.
+    
+    Removed [no-]mach64-sgram options.
+
+commit f617549fb705e1ea3def2bc76e7e2b6f3dae8db1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Mar 2 16:17:13 2004 +0000
+
+    SGRAM auto-detection via /proc/bus/pci.
+    
+    Verify that we have found the correct entry in /proc/bus/pci by checking against the
+    physical frambuffer address.
+    
+    Tried to make /proc/bus/pci code better looking :)
+    
+    Moved mdrv->g450 to mdev->g450_matrox and added device_data pointer to driver_data.
+    
+    Removed "#ifdef FB_ACCEL_MATROX_MGAG400" stuff. Not all instances were covered anyway.
+
+commit 295588832f120d590457d52fa999eebe6545a1a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 27 16:17:40 2004 +0000
+
+    Remove accidently commited test of "__attribute__((const))".
+
+commit 9e632b5def17fb91074fc3659b1503ab99289120
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 27 11:28:14 2004 +0000
+
+    Switch to color keyed cursor if shape doesn't have alpha or if translucent
+    windows are disabled.
+    
+    Color key is hard coded to 0xff 0x00 0xff. This will change upon introduction
+    of real cursor objects in the core.
+
+commit b0ca6c15ed3873b410f31937b4f04796ef3176af
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 27 10:43:20 2004 +0000
+
+    Fixed redefinitions of _GNU_SOURCE.
+
+commit 458a61d13665b8aeb1500e2939128a94140dc884
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 27 08:48:43 2004 +0000
+
+    Fixed failing assumption upon window destruction, i.e. assume that
+    either the window is not destroyed or the event is DWET_DESTROYED in
+    dfb_window_post_event().
+
+commit 47a931d734f265f3eeb1bf31ed9b3bbbb016b66c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 27 08:44:25 2004 +0000
+
+    Added DFB_MAGIC stuff to arena.
+
+commit 55fb47d38adcb2a6124dae687e5da05cd443ade3
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 27 05:31:29 2004 +0000
+
+    Added SGRAM block write support to mach64 driver.
+    Bumped mach64 driver version to 0.12.
+
+commit e457bfae62455f53bb62accc3dd566881a9a3b49
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 27 04:58:06 2004 +0000
+
+    Added detection for Rage Pro chips.
+
+commit 531bc44bc40274bf067ebf7e74c9a0b5a8502fb2
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 27 04:44:40 2004 +0000
+
+    Fixed blending once more. Some 3D registers aren't accessible unless
+    SCALE_3D_FCN is set.
+
+commit 22ddbb31a72d8ee753b5fbd3ee3a7d9049ccd4bc
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Feb 25 13:21:07 2004 +0000
+
+    Re-enabled 2x horizontal zoom with RGB32 on G400. The problem was that
+    BESHISCAL wasn't doubled when 2x zoom was enabled.
+
+commit b71d409302e1dc8737bd9daeafdd61865f6fa5bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 25 03:15:13 2004 +0000
+
+    Add "-D_GNU_SOURCE" to DFB_INTERNAL_CFLAGS instead of CPPFLAGS
+    to have it exported via directfb-internal.pc making external modules
+    much more convenient.
+
+commit 3319099f98e4964ee1515cb76a53537771d42089
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 24 09:23:12 2004 +0000
+
+    Renamed DSCAPS_FLIPPPING to DSCAPS_DOUBLE.
+
+commit f7f3ceb88b3df242385f264bd1d4f19b138a2349
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 24 04:07:36 2004 +0000
+
+    2x horizontal zoom doesn't work right on G400 with RGB32. It doubles the
+    image width and if you move the image to the right so that over half of it
+    gets cropped the whole image disappears. Without hzoom enabled things seem
+    to work just fine even with the pixel clock running at > 200 MHz.
+
+commit fd10e00bc33c9d48c74a048e95774bf7c81a6a28
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 24 02:09:12 2004 +0000
+
+    Matrox BES overhaul:
+    - Moved G450/G550 detection out of CRTC2 specific code because BES needs it too.
+    - Max source width is 2048 for G450/G550.
+    - 2x horizontal zoom pixel clock limit is 234 MHz for G450/G550 (from XFree86 source).
+    - Handle destination cropping.
+    - On G400 all horizontal parameters need to be doubled for RGB32.
+    - G450/G550 can handle RGB32 without scaling limitation.
+    - Bumped driver version to 0.7.
+
+commit bba9cd1250e9b13feb0690cc5565c1ab106b4ab8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 23 22:44:44 2004 +0000
+
+    Fixed Bop_a8_set_alphapixel_Aop_airgb(), i.e. render opaque pixels of
+    glyphs correctly onto AiRGB surfaces.
+
+commit d3de90207dc5c9153f06a66b11b7acfe2d246291
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Mon Feb 23 09:05:14 2004 +0000
+
+    Long standing I420 video bug (trashed display) fixed.
+
+commit b58dc796f21ec8d682c0ba88641896dc94abc880
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Mon Feb 23 08:58:13 2004 +0000
+
+    Added color adjustment code. It is disabled for now - the DFB->HW mapping is not
+    yet producing correct results.
+
+commit 6e6ae0ebe8e576b3b5e93b6a3eab67e68bda68c7
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Feb 21 04:28:31 2004 +0000
+
+    Oops.
+
+commit 08ccb946c95f34498c000c5aefb11c7e8a6bd5f6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Feb 21 04:25:58 2004 +0000
+
+    Destructor forgot to use dfb_layer_region_unref().
+
+commit 7371f807f041c1cec16fa927f1eb4da848c6280e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 20 22:58:23 2004 +0000
+
+    Fixed long standing typo: gAquire() -> gAcquire().
+
+commit a55c4c9625af7abafb821fe990a216f7e779935b
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 19 22:43:43 2004 +0000
+
+    Added support for format conversion blits and DSBLIT_BLEND_COLORALPHA.
+    DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_COLORIZE and TextureTriangle() would
+    require using the texture engine. Unfortunately texture pitch must be a
+    power of two value so this would require changes to the memory allocator :(
+    
+    Changed alignment limits to match hardware capabilities (hopefully).
+    
+    Reset SCALE_3D_CNTL and OVERLAY_SCALE_CNTL driver_close_device().
+    
+    Bumped driver version to 0.11.
+
+commit deb1d1bf019469a5de6a66f8bd1771b09131fac2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Feb 16 15:45:18 2004 +0000
+
+    Changed License field to LGPL.
+
+commit 134ab65fe5ac7015cc6b57b96babb9f59ccd1858
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Feb 14 20:58:48 2004 +0000
+
+    dfb_layer_context_set_configuration() used old data for window stack
+    update which eventually caused a segfault in gFillRectangle().
+
+commit 1bdb1a10c6cdd2a8188ce812e9d7baaca713b34a
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 13 15:50:09 2004 +0000
+
+    Initialize ALPHA_TEST_CNTL in mach64EngineReset(). Fixes blending.
+    
+    Bumped driver version 0.10.
+
+commit c7d03fce9f1ffef992887b93e8b50bacf1eaee70
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 13 01:26:18 2004 +0000
+
+    Added DSDRAW_BLEND support for GT chips.
+    
+    Added mach64EngineReset() and initialized some registers just in case.
+    
+    Divided mach64CheckState() to GT and non-GT variants.
+    
+    DST_BRES_LNTH was written too early which broke blended lines. Strangely enough non-blended
+    lines were fine without this change.
+    
+    Reduced top trapezoid height by one in FillTriangle(). The line in the middle was being
+    drawn twice which looked bad with blending.
+    
+    Bumped driver version to 0.9.
+
+commit 8f7a2d5fd10ae2626e647f9d6f895e6fa29fe766
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 12 17:06:01 2004 +0000
+
+    Bumped driver version to 0.8.
+
+commit 71761cffc62f8b79bdda330b86c0ac9c91f55e79
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 12 17:04:34 2004 +0000
+
+    Added FillTriangle() support for GT chips.
+
+commit eb9ca3734c67d1ffe623961a53ec53b3f470ceda
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Feb 11 10:44:46 2004 +0000
+
+    Only GT models have front end scaler -> no StretchBlit() for older models.
+    
+    Only set DST_LAST_PEL bit for bresenham lines. It doesn't affect antyhing else.
+    
+    Overlay source size is limited to 720x1024. It's actually 768x1024 for 3D Rage (LT) Pro but we can't tell the difference
+    from the accelerator ID :(
+    
+    Fixed overlay source color keying.
+    
+    Fixed overlay source cropping for planar formats.
+    
+    Bumped driver version to 0.7.
+
+commit 9a6545e8e81429a68a2b1b23149488b6b895e043
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 11 05:41:02 2004 +0000
+
+    Fixed segfault during destruction of input only windows,
+    e.g. when closing the context menu of an entry in gtk+-directfb.
+    
+    Added utility function fusion_pthread_recursive_mutex_init() which
+    is used everywhere now instead of several pthread_mutexattr_*foo() calls.
+    
+    Moved DWET_DESTROYED notification to the end of dfb_window_destroy().
+    
+    Increased safety of single app core version of fusion_ref_down(),
+    i.e. move the reference watcher call into the locked code section.
+    
+    Moved "-D_REENTRANT" from CFLAGS to CPPFLAGS.
+    Added "-D_GNU_SOURCE" to CPPFLAGS.
+
+commit d873c7184ad462fe74df150927230bdf9ccbb277
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 11 05:17:58 2004 +0000
+
+    In DFB_MAGIC_ASSERT(obj,magic) do DFB_ASSERT(obj!=NULL) first.
+
+commit 31063039e29e3c2b020a65ebf58af000a4ae372c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 11 04:39:20 2004 +0000
+
+    Removed annoying surface listener debug output.
+
+commit 9e5c4b6a5b4b2a7de27e7f8b010d5835688be986
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 10 12:43:17 2004 +0000
+
+    Reset input field to zero upon Flip().
+    
+    Don't wait for previous settings to be loaded when setting new ones.
+    
+    Use correct vertical zoom again, green line at bottom is from decoder.
+
+commit 0fddb092efae0454e3b98013159ada59b8ff77d6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 10 11:45:11 2004 +0000
+
+    Added stretch blitting support.
+    Bumped driver version to 0.6.
+
+commit 46e5334ceb0fea0d94d2df74b657e50ded8aeee0
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Feb 9 19:07:13 2004 +0000
+
+    - support for powerpc (handle mmio reads and writes correctly)
+
+commit 90d96c8f8d054ee291f7dcf48fa73deb2d305648
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Feb 9 09:02:57 2004 +0000
+
+    Added source and destination color keying to the overlay layer.
+    Fixed drawing/blitting color keying bugs.
+    No need to replicate bits to fill whole DP_FRGD_CLR register.
+    Removed a DSPF_RGB24 case that was left in accidentally.
+    Bumped driver version to 0.5.
+
+commit cd532f73b7781d027a30e45b0f47314f2bc15d28
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 6 18:07:07 2004 +0000
+
+    Added DLOP_DEINTERLACING support to video layer.
+
+commit 34e921cc7e41f7ebc95caef8cce18550db073228
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Feb 6 14:06:18 2004 +0000
+
+    shut up CVS
+
+commit 5aed191fc82c78cd644535c5f9237b9e29568ed9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 6 13:53:57 2004 +0000
+
+    Commented out annoying assumption in dfb_core_is_master().
+
+commit 0a80ea3e036187f47b2c5e6aef10b527ecfcb0a2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 6 13:50:34 2004 +0000
+
+    Replaced all 'x$foo = xyes' by '"$foo" = "yes"' etc.
+
+commit bddff63b33c38c5cd76c1c0e07cacc94d01eade4
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Feb 6 11:56:15 2004 +0000
+
+    Initialize SCALER_H_COEFF registers.
+    Bumped driver version to 0.4.
+
+commit 0d1f448a5c13b408293aed32a5970ccdd8145a9d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Feb 5 11:54:33 2004 +0000
+
+    Added overlay support.
+    Bumped driver version to 0.3.
+
+commit b28ff9f69c42d5c6756c50ee558420d58cc19045
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Feb 4 14:11:46 2004 +0000
+
+    Fixed state handling.
+    Bumped driver version to 0.2.
+
+commit 359ea62ac8754978d9190e7d484ae2ebe09595d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 4 07:47:55 2004 +0000
+
+    Some optimizations.
+
+commit 4a463d3c6ed006d772d10d73b9abf69fac3fc427
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 4 05:18:29 2004 +0000
+
+    Rewrote symbol lookup used by stack trace dumping code.
+    
+    The symbol list is no longer generated at build time for libdirectfb.
+    
+    Use popen("nm -n ...") to load symbols of any module on demand.
+    
+    Produce gdb like stack dumps (output formatting).
+
+commit 104d42e5c792f7ae7f467494123a17ae74e06d97
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 23:07:14 2004 +0000
+
+    Removed all "non-static inline" for now.
+
+commit d5b60341429292bd11b6c42e8918bb202a2cd6d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 23:05:58 2004 +0000
+
+    Added DFBDisplayLayerBufferMode to the auto generated
+    "enum value / name string" mappings in "directfb_strings.h".
+    
+    Added DLBM_UNKNOWN for null termination of the map.
+    
+    Removed top level indention of "directfb_keyboard.h".
+
+commit 2173c24d57b786186f497beba4c4a43d8f992947
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 17:15:22 2004 +0000
+
+    Put DFB_DEBUG into config.h, too.
+
+commit 1304629fb2e6d966866fca7d993ab053b933ff07
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 3 14:08:30 2004 +0000
+
+    Fixed cosmetic copy-paste error.
+
+commit 7faf2adef1603907f4ffa9e69a3cd2883fdc426d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Feb 3 12:57:36 2004 +0000
+
+    Added ATI Mach64 driver.
+
+commit 7908d7f1790fd27e42624734398f495eebc2211d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 04:02:59 2004 +0000
+
+    Check for timeout more often (every 16384 th iteration, was every 65536 th before).
+
+commit 344f1068e072c445c070247dd57fee37d53fbd22
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 03:54:57 2004 +0000
+
+    Added benchmarking macros.
+    
+    Each benchmark runs for one second now.
+
+commit b2f63d65392a676f93209228268598c767b0e7b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 03:16:13 2004 +0000
+
+    Use recursive mutexes in threaded mutex benchmark.
+
+commit 1a85345b7bfb4f56b9df63ef2705659f80b42b4a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 3 02:56:20 2004 +0000
+
+    Replaced getpid() reference benchmark with an flock(2) benchmark.
+
+commit e3ea9127a481d3bc9839474e77bfb3d5f14e89ea
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Feb 2 20:52:15 2004 +0000
+
+    - set default overlay mode to YV12 instead of RGB16 (just testing)
+
+commit 02ac1ef679c119ca9d7062829a858f1ef78ef41b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 2 20:49:53 2004 +0000
+
+    Added configure option "--enable-zlib" that activates gzipped screen shots etc.
+
+commit cb1458c01f68c68fab416e51ec1f735e55963bd0
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Feb 2 19:48:51 2004 +0000
+
+    - if the environment variable DFB_CLE266_UNDERLAY is set, the videolayer
+      is treated as underlay. primary layer hooks will be installed, so that
+      the transparency of the overlay cat be set by using the primary layer
+      interface.
+    
+    the GetLevel/SetLevel stuff might act strange now. will be fixed later.
+
+commit 8bd1780423c751fdd1c281b946e6c055b1a70c67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 30 16:34:12 2004 +0000
+
+    Fixed an error handler.
+
+commit 30b3f1d25c058f3ca8ca6e27a15a98ae88de5bce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 30 15:08:35 2004 +0000
+
+    Forgot to decrement num_buffers in buffer_destroy().
+
+commit 5a5077d6e8b8f7bbcdf13c1b79c1de33ecf7f8fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 30 14:57:34 2004 +0000
+
+    Add -finstrument-functions to internal flags if enabled.
+
+commit b40f2a64c048f750f789e3220cb4c8dcf5843f04
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 29 15:18:08 2004 +0000
+
+    Enforce realization of layer region upon GetDisplayLayer()
+    and SetCooperativeLevel() again to fix e.g. SetScreenLocation() for
+    layers without a surface.
+
+commit 19fe0bc3474d075e339b413f155fd90c39ec0cba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 28 17:32:35 2004 +0000
+
+    Show layer levels.
+
+commit 7a43f301c0e2b223901b337a2f1723035254503c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 28 17:17:11 2004 +0000
+
+    Print "unknown" if pixel format of context is unknown.
+
+commit fc1a25296fe1324f7baa57285ed9e0cce9a2bf67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 28 08:33:38 2004 +0000
+
+    Dump contexts.
+
+commit e5de11210b19b571a47ff3c00004d8ed2b48ce02
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 28 07:44:39 2004 +0000
+
+    Avoid multiple dumps of local memory leaks at exit time.
+
+commit 2979c927f785fc79c55084ec746fc2ec156af0d6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 28 07:28:28 2004 +0000
+
+    Further finalization of the new layer code.
+    
+    The primary region of a layer is no longer created and activated
+    during creation of the context.
+    
+    IDirectFB::GetDisplayLayer() no longer causes the layer to be shown or
+    its surface to be created. Even IDirectFBDisplayLayer::SetCoooperativeLevel()
+    and IDirectFBDisplayLayer::SetConfiguration() no longer cause that.
+    
+    A layer is allocated and shown upon:
+    1) IDirectFBDisplayLayer::CreateWindow()
+    2) IDirectFBDisplayLayer::GetSurface()
+    3) IDirectFB::CreateSurface() <- if primary & fullscreen
+    
+    Fixed failing assumption for exclusive access to additional layers.
+    Fixed missing context and region destruction after releasing the layer.
+
+commit f153145ac8711da92e4b239ea2c1d1f77f47e300
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jan 27 22:27:58 2004 +0000
+
+    Re-added CRTC2 sub-picture opacity handling.
+    Don't touch sup-picture bits of C2DATACTL in CRTC2 code.
+    Removed mcrtc2->enabled.
+
+commit e435f5cfa515eccb42cca5c7004784d5ec6f157d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 26 14:41:52 2004 +0000
+
+    Decided to use floats in DFBVertex instead of fixed point.
+
+commit 38c8f414f0cd14bcb669a33e581d8fd38d0365c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 26 14:36:41 2004 +0000
+
+    Fix sanity check for DTTF_STRIP.
+
+commit a60fd1a4fafdc87574ee7752864c93606abbba4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 26 14:25:47 2004 +0000
+
+    Initialize pthread key.
+
+commit ca5cdd584ab32b16be51f9266edd827b088e5ae1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Jan 23 18:49:50 2004 +0000
+
+    Use DFB_COLOR_BITS_PER_PIXEL() to calculate surface palette size.
+
+commit b545132b89b811a127676300a808e1c1bd2e5efd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 22 17:15:06 2004 +0000
+
+    Added IDirectFBSurface::BatchBlit() which increases pixel throughput
+    of many small blits with same source and destination, e.g. custom font
+    rendering like GTK+-DirectFB does.
+    
+    Benchmarks (P3 800 MHz, G450 AGP, 1280x1024, 16bit)
+    
+    Size.......Blit...BatchBlit (10 blits at once)
+    8x8..........9.....35
+    16x16.......36....138
+    32x32......144....259
+    64x64......326....327
+    128x128....363....367
+    256x256....386....390              in MPixels/sec
+
+commit 708bae68c06eb7fc38910c711215fb5bf9c27e84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 21 22:00:16 2004 +0000
+
+    Fix build for gcc 2.95.
+
+commit 31084e7aa9ca07bbf4a50bf2cbf53e0803506f57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 21 18:41:16 2004 +0000
+
+    Fixed option "linux-input-ir-only".
+
+commit 88f30c57c6ce95487f86c0109a7577858c4e38f8
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Jan 20 22:09:26 2004 +0000
+
+    Store default color adjustment into layer context.
+
+commit 1d9ecac807dfd2606164ef588ea842f817925c3d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 20 19:36:39 2004 +0000
+
+    Added option "linux-input-ir-only" which tells the linux input driver
+    to ignore all non-IR Linux Input devices.
+
+commit 6ba9f68f786ed958cd757d3301919ee84937b190
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 20 02:24:14 2004 +0000
+
+    Implemented DTTF_STRIP and DTTF_LIST, too.
+
+commit e24979c34a8b5079d87f972fb51b28f7339d6b36
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 20 02:21:00 2004 +0000
+
+    Fix doc for DFBTriangleFormation.
+
+commit eefb37cb8a3c8ddc3206d240f004d0a5c2e42d6e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 19 17:31:31 2004 +0000
+
+    Take linux input code as hardware keycode.
+
+commit 87de49babbb52e72116f278697ce5adb3ae06d54
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 19 14:09:54 2004 +0000
+
+    dist fixes
+
+commit 86a349cf91e7218bb6cda8ccead1d3275d0039df
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 20:27:47 2004 +0000
+
+    Use CSLF_FORCE, fixes failing PlayTo() on a fresh surface.
+
+commit 1f7264083e7d5c8bf334cb7c6d9d2754b7e3728b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Jan 16 17:54:08 2004 +0000
+
+    do not use uc_ovl_setup_fifo(), it does not work as expected and causes display errors.
+
+commit 2e78810414fb82a3f70408877cb8026d3b25d9e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 17:42:59 2004 +0000
+
+    Fix a8 font rendering for argb1555, i.e. remove alpha pits around glyphs.
+
+commit ecea51abf206a2112017158f22386699ed3c490d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 06:35:04 2004 +0000
+
+    Added DFB_MAGIC handling to surface manager and state functions.
+
+commit 50c5949636f540ae507df515ef5fc54808a4092f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 06:10:04 2004 +0000
+
+    Added DFB_MAGIC handling to CoreFont functions.
+    
+    Reduced minimum spell length to eight (including null character).
+
+commit e07223db3674d2dd5e6b966370c7c10235110eff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 05:27:20 2004 +0000
+
+    #include <errno.h>
+
+commit c315940a773940ffa21fb797acb0128ce6d19e78
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 16 05:03:20 2004 +0000
+
+    Initial version of the screen mixer/encoder/output APIs.
+    
+    An output is connected to an encoder which is connected to a mixer which
+    combines selected display layers ;)
+    
+    Added a lot of types for description and configuration of these components.
+
+commit b46a812e8f597505839f7e716892da083807d33a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 17:14:01 2004 +0000
+
+    Renamed DFBScreenEncoderTVNorms to DFBScreenEncoderTVStandards.
+
+commit 841a4e6f610b4c15fba8291ec1e358f3aba8e848
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 15:26:29 2004 +0000
+
+    Initial support for encoders and outputs.
+    
+    Added IDirectFBScreen::GetEncoderDescriptions() and GetOutputDescriptions().
+    
+    Added all new types to the auto generated "directfb_strings.h" and dfbinfo.
+
+commit f8118c235c8150e3b27a7040803995dccb4277cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 13:38:45 2004 +0000
+
+    Set stack->cursor.window = NULL in window_destructor() if the cursor window
+    is being destroyed, e.g. during shutdown.
+
+commit 972cef2f5778d120ad6d52c3f73900fba54eedab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 13:19:02 2004 +0000
+
+    Ooops.
+
+commit 02298a10df1efad7a4ce66dcf6d4b3e88903a160
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 13:17:16 2004 +0000
+
+    Set keys[i].code = -1 in window_withdraw().
+
+commit bb9aa1b5dbb241985aa643b7ed6ecb9225c83f8f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 15 13:13:27 2004 +0000
+
+    #include <pthread.h>
+
+commit 492d994f87a3d6f9efd56df54b910a2ac6ec28db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 14 14:53:37 2004 +0000
+
+    Fix plane multiplier for YV12 and I420.
+
+commit 7a4142f6b790b6348aab85720f1d75418039673d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 13 23:54:48 2004 +0000
+
+    Moved write() call after the unlock.
+
+commit 734014b8868a23628ad943259bcdaba7a2f3931d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 13 19:09:48 2004 +0000
+
+    Use flags for dfb_gfxcard_lock() instead of four booleans.
+
+commit 8889d1087b0ff77834699a3d911a14044bbed72f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 13 19:08:53 2004 +0000
+
+    Argh, move magic behind link header.
+
+commit 856b3cb3b2dfc06b3989518fabf9dcaed4750371
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 13 17:44:58 2004 +0000
+
+    Use DFB_MAGIC_SET/ASSERT/CLEAR for FusionObject and FusionReactor.
+
+commit ca4faa96434e501e910e111a6ae4dfc674fc4cfd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 12 20:34:12 2004 +0000
+
+    Readded IDirectFBDisplayLayer::WaitForSync() for convenience.
+
+commit 0896b5ed31cdabe4db1ddf4f5bff68aa6b8fb723
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 12 15:28:29 2004 +0000
+
+    Added a missing lock/unlock pair.
+
+commit 49ad2ee6c6138875587bbc7be40f982cfa097111
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 12 12:44:47 2004 +0000
+
+    Speed up builtin stack trace support a lot
+    by using thread specific data instead of gettid().
+
+commit 3d6ad2a20f03b8d10b0843ee5409a674de926efc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 9 11:14:51 2004 +0000
+
+    Quick solution for middle mouse button emulation:
+    Press <Meta>-<Ctrl> + Left/Right Click generates 3rd/4th button event.
+
+commit 583397b66a7d9d790e80facdeb5f23980863c91b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 9 10:32:28 2004 +0000
+
+    Fix Makefile for newer automake.
+
+commit 9b666f3515bc4fead73a1dcf3e2f4f9006ad3f01
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 8 19:49:55 2004 +0000
+
+    Added IDirectFBSurface::TextureTriangles() which takes a source surface
+    as the texture, a pointer to a DFBVertex array, the array size and the
+    DFBTriangleFormation which can be DTTF_LIST, DTTF_STRIP or DTTF_FAN.
+    
+    Each DFBVertex contains transformed x, y, z, w, s and t coordinates
+    using some fixed point integers.
+    
+    The set blitting flags are used.
+    
+    Implemented textured triangles for CLE266 (only DTTF_FAN yet).
+    
+    Started a Matrox implementation, but don't know how to calculate
+    perspective coordinates for the trapezoids (s, t and q).
+    
+    The added code is very small, but applications can now render full
+    3D scenes with alpha blending, color modulation (for lighting) etc. ;)
+    
+    But be aware of the missing Z buffer...
+
+commit b2a89e2a76bfb47a42512e4e3edd616db1ec1f8e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 8 19:26:44 2004 +0000
+
+    Introduce IDirectFBScreen:
+    - Display encoder and output connector settings,
+    - input device assignment in multi head environments,
+    - power management, synchronization.
+    
+    Added DFBScreenCapabilities with DSCCAPS_VSYNC,
+    DSCCAPS_TV_ENCODER and DSCCAPS_POWER_MANAGEMENT for now.
+    
+    Added DFBScreenDescription with the caps and a screen name.
+    
+    Added IDirectFB::EnumScreens() and GetScreen().
+    
+    Added IDirectFBScreen::GetID(), GetDescription()
+    and EnumDisplayLayers() limited to the layers on the screen.
+    
+    Added IDirectFBDisplayLayer::GetScreen().
+    
+    Moved IDirectFBDisplayLayer::SetScreenPowerMode()
+    to IDirectFBScreen, called SetPowerMode().
+    
+    Moved IDirectFBDisplayLayer::WaitForSync() to IDirectFBScreen, too.
+    
+    Added Matrox CRTC2 screen.
+    
+    Added more types to the auto generated "directfb_strings.h".
+    
+    Added screen information to 'dfbinfo'.
+    
+    Added CoreScreen and ScreenFuncs.
+    
+    dfb_screens_register() returns the CoreScreen pointer to the driver.
+    
+    dfb_layers_register() takes a CoreScreen pointer as its first argument now
+    and returns the CoreLayer.
+    
+    Added dfb_gfxcard_sync() call in front of the driver's FlipRegion() call.
+    
+    Moved WaitVSync() and SetScreenPowerMode() from LayerFuncs to ScreenFuncs.
+
+commit 714b6483110071d09102fa2e8592312586677064
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 8 18:20:17 2004 +0000
+
+    GPM repeater support by Micha Nelissen <micha@neli.hopto.org>.
+
+commit f12c38992b4ac64878b29623d499efa39fe36103
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jan 8 15:08:15 2004 +0000
+
+    updated section about BSD
+
+commit 538a4ffa3a3ed25c212230bf0a003f298f29a893
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jan 8 13:48:13 2004 +0000
+
+    remove (__compar_fn_t) typecast, this is not available on FreeBSD and others
+
+commit 77b9447ae9756c5fcb299d2ff3a19a32fbd015f8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jan 8 13:43:33 2004 +0000
+
+    also define __s32 for non-linux platforms
+
+commit 70b784d64298005614b4b971fe9ed64d07f8c4a9
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jan 8 00:01:39 2004 +0000
+
+    put #ifdefs around si_codes, not every platform defines all of them.
+
+commit 30badb490ea3445c3b5e40eb4acc9e47ead4f1bb
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jan 7 23:33:06 2004 +0000
+
+    make platforms without PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP happy.
+    (reviving FreeBSD support)
+
+commit ee1bee0316ea6dfbaff5d71cde8f179947d10d63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 6 09:27:54 2004 +0000
+
+    Cosmetics.
+
+commit f69169267319da728586d5c62fb914721549a3bb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 5 15:27:31 2004 +0000
+
+    order the default set of gfx drivers alphabetically
+
+commit 26a1a960de923bfc5c570e200bfe6e542a002f0b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 5 14:27:41 2004 +0000
+
+    Use gettid() instead of getpid() if available.
+
+commit 6d086443ffe430cbcd4ac52d8fa642d7a147c4cd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 5 13:36:18 2004 +0000
+
+    Don't enable ELO input driver by default. It blocks during probe.
+
+commit 2fb01242b944bb5244d3f2d747dc575b9db994fc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 28 09:19:52 2003 +0000
+
+    Clip opaque region to window boundaries.
+    
+    Minor cleanups.
+
+commit 7891d5625b0d26ca5506e42eca974aded4a68076
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 28 03:08:07 2003 +0000
+
+    Added IDirectFBEventBuffer::CreateFileDescriptor() that returns a file
+    descriptor that can be read from including support for select().
+    If only the file descriptor is used the buffer still needs to be flushed
+    via IDirectFBEventBuffer::Reset().
+    
+    Reduced reference up/down in window stacking code.
+
+commit 9421c92d391feac85e2ccc9e45435758247a38e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 19 20:35:21 2003 +0000
+
+    Fixed recognition of "a1-font" option when no attributes are specified.
+
+commit 3dbe49b124c5ec7c9df42812fb75c8b86a98972f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 19 12:47:03 2003 +0000
+
+    ELO Touchscreen driver, thanks to Brandon M. Reynolds <breynolds@comtime.com>!
+
+commit 0b56002fdf16c481a076428d3e227475cc8a8426
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 19 12:01:08 2003 +0000
+
+    Added /dev/misc/psaux.
+
+commit 327ca686a48e958d00e772da39d4e70485957bb7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 18 15:42:30 2003 +0000
+
+    Added "a1-font" and did some updates.
+
+commit da6336529b63b4862254c5a46061ecdf05560a13
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 18 15:26:51 2003 +0000
+
+    Added "a1-font" option.
+
+commit de20f813f6cf1af872bb43b078a53b9127e22575
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 18 15:11:42 2003 +0000
+
+    Implemented all Bop_a1_set_alphapixel_Aop.
+
+commit dd03d03ba33fdacbab242d2e11177048d13e0eb7
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Dec 18 13:10:42 2003 +0000
+
+    - fix segfault, overlay still does not work for me (never did?)
+    - remove XBOX specific code for now.
+
+commit 5e8ec08b08ae862fabca7e47c03fdc724925bb2d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Dec 17 20:24:06 2003 +0000
+
+    build nvidia driver by default
+
+commit 964953e44c9f71ccd0a388c45de01d04af6f9071
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Dec 17 20:19:26 2003 +0000
+
+    updated nvidia driver (follow internal layer/region api changes).
+    I couldn't test if it still works, at least it compiles.
+
+commit 0a739673580b257c9dd0da9688a5bcd99943af5e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 17 03:14:18 2003 +0000
+
+    Speed up kerning cache.
+
+commit faf9876dfc07754067aecf54771a320db9571731
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 17 01:02:19 2003 +0000
+
+    Align the surface width to be a multiple of eight pixels.
+
+commit b5fefd537696597c49b26a5169f2646b60dabae8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 17 00:10:47 2003 +0000
+
+    Rubbish.
+
+commit b9465d4cd089eb9c295d2d3203678be91e4477ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 23:41:44 2003 +0000
+
+    Drivers can choose between byte/pixel pitch alignment, or even use both.
+
+commit ae630e568666412bf865c354f16d6422b2968818
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 22:58:56 2003 +0000
+
+    Preliminary DSPF_A1 support.
+    
+    Added DFB_PIXELFORMAT_ALIGNMENT(format) which is non-zero if alignment
+    is required to do byte aligned access, e.g. 7 for DSPF_A1.
+    
+    Added DSPF_A1 support to FreeType2 font implementation.
+    
+    Implemented Bop_a1_set_alphapixel_rgb16(), "df_dok --mono" works using A1.
+
+commit e91fac3f6eff151676d2e02ae79b94b633b1a9c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 22:30:16 2003 +0000
+
+    Optimized glyph info prefetching code,
+    speeds up DrawString in df_dok by ~10% on my Matrox G450 (P3 800E).
+
+commit 7b8ecee801e19525c4d0720f732428d9ef1d4570
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 20:49:32 2003 +0000
+
+    Don't rely on correct kernel headers.
+
+commit 09975184a1d4f99ece54e8a2748f3306783cb66c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 06:51:34 2003 +0000
+
+    Readded missing call to dfb_windowstack_flush_keys() during context switch.
+    
+    E.g. pressing Return in an xterm to start a fullscreen app didn't send the
+    corresponding release event, because the fullscreen app was already running
+    during the real release of the key.
+
+commit 1d581b0ab1bc8fb4864ba5728080e7048fa271d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 16 02:44:26 2003 +0000
+
+    Fix failing assertion [stack->cursor.window != NULL] in windowstack.c:350.
+    It was triggered by setting the cursor opacity to zero.
+
+commit b599e240e9b099360e90e328e72b30b7e547f048
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 11 02:25:27 2003 +0000
+
+    Added DFB_PIXELFORMAT_INV_ALPHA(format).
+
+commit 714d832a8dfcffe5da54fe6299e685a32e9e681b
+Author: Andreas Kotes <count@directfb.org>
+Date:   Wed Dec 10 21:17:25 2003 +0000
+
+    revert strange side-commit
+
+commit 787abb9a3d46f86e4c0a38e3b9e3aee8819fa4ea
+Author: Andreas Kotes <count@directfb.org>
+Date:   Wed Dec 10 21:15:48 2003 +0000
+
+    repeat a liiittle later
+
+commit f9cb70c2f01b591e0a568d528025880cf100c1d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 19:56:29 2003 +0000
+
+    Use DSBF_ONE for destination alpha if DSBF_INVSRCALPHA is used.
+
+commit 0f1b805c87f0ecc2d68f1e282ab95305578e73de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 19:01:25 2003 +0000
+
+    Fix format conversion blits from non-alpha to alpha surfaces
+    by enabling alpha channel writes and fixing uc_map_blitflags().
+
+commit a8150942177a97d17f21158bad06de57c388816b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 17:59:52 2003 +0000
+
+    Finally remove DSPF_RGB15.
+    
+    Fixed enum name generation for constants with lower case characters.
+
+commit 91a55500cae447fe181676f916dbc0a67c531141
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 16:04:00 2003 +0000
+
+    Reset repeat counter only if symbols differ.
+
+commit 838fa2ad266c7c4796d73d856d536458cb6fab5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 15:49:03 2003 +0000
+
+    Fix copy'n'paste bug.
+
+commit 7d68a53a5a2a74d5e25d5a879f69dcd61efba8a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 14:14:09 2003 +0000
+
+    Reset repeat counter.
+
+commit d3a0e089a392a7ce6f57d561403c34234e506f1a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 10 13:50:40 2003 +0000
+
+    Fixed assumptions.
+
+commit 57f3a7c73214356098357224a235b8673c0424ef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 21:24:31 2003 +0000
+
+    Use software fallback for broken blitting from non-alpha to alpha surfaces.
+
+commit 2f8cce6b7aba0cf99586e7cc5dcb83ce27a3b6d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 20:28:07 2003 +0000
+
+    Hopefully fixed blitting of surfaces with an alpha channel, but without
+    using DSBLIT_BLEND_ALPHACHANNEL.
+
+commit 779a098c1f43c772fc1751619af43580e675ca0b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 20:25:34 2003 +0000
+
+    Emulate keyboard like key repeat behaviour using select() with timeout
+    and a counter to drop the first two repeats.
+
+commit ef44d77b322f12e97f5d2576648f993263498bab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 15:46:45 2003 +0000
+
+    Added diagonal cursor keys.
+
+commit 45b1cbcdae7f128e29b7d1dc94d113fc14ff844d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 14:57:14 2003 +0000
+
+    Don't destroy object pools during emergency shutdown.
+
+commit 49d9a0b9533947ae71b6b98587d2dd8565de105f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 9 14:51:41 2003 +0000
+
+    Added support for DSPF_AiRGB.
+
+commit d7aa86cec7793327a751c6ba290f207aeb0ce9a4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 8 20:55:32 2003 +0000
+
+    Color bug seems to have reappeared after I readded the W component.
+    Enabled dithering again ;(
+
+commit 85e483fe7dae0e68d1382f6592c4793c113ed63a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 8 18:28:19 2003 +0000
+
+    Added new pixel format DSPF_AiRGB, i.e. DSPF_ARGB with inverted alpha channel.
+
+commit f31738c706e139cf5e9ff126ae1da4e0e2aedeb9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 15:13:56 2003 +0000
+
+    Added debug message after module registration.
+
+commit 681a7be9e7b5bb69ec0fa9c1ca63aa1befbd3a1d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 13:42:34 2003 +0000
+
+    Corrected to DFB_GRAPHICS_DRIVER(cle266) to match library name.
+
+commit 097bac636f36b2b384d0aac80caa707766675ec3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 12:19:56 2003 +0000
+
+    Added DSBLIT_DEINTERLACE support to gBlit.
+
+commit 14188ad426b7327c2013619a08ff6f378061452c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 05:49:01 2003 +0000
+
+    Set 64k stdout buffer.
+
+commit ce912964c1359817e316c8ffa784f82de27e8b67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 04:01:06 2003 +0000
+
+    Updated copyright header.
+
+commit dbcfd6214db52610e1ac1ebcd2ae5dd7c3ba9bf1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 5 00:17:44 2003 +0000
+
+    Added DFB_MAGIC_SET, DFB_MAGIC_ASSERT and DFB_MAGIC_CLEAR.
+
+commit f163a2f73b9784232a99d1b9cc18d90fe645e3d6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 20:43:45 2003 +0000
+
+    Add local reference to primary region of primary context.
+
+commit 21de00a5d5fc61bec4a371daaa2d764c3344b55b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 19:15:24 2003 +0000
+
+    Show layer name in debug message of destructor.
+
+commit c1a059d6b23cb4bd2b93e9ddefd40985bf5d6c1f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 18:07:04 2003 +0000
+
+    Link the primary region into the window to fix the destruction order of objects.
+
+commit 9e083274e418151cf10f3adcbfcd8e4b6be9c651
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 18:05:02 2003 +0000
+
+    Added timeout to fusion_sync().
+
+commit 7df0d946fae81874d010d4394b40ee985820fcbf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 17:20:49 2003 +0000
+
+    Clear the stack pointer after destruction.
+
+commit c6c466f75310662ea5bb06e0f10651e24c962e03
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 4 15:43:07 2003 +0000
+
+    Added call to dfb_system_lookup() to fix initialization.
+
+commit bd562f76d999828ca7c26d9df042e5af7ee5ef62
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Dec 4 12:32:57 2003 +0000
+
+    Do not build the wm97xx driver by default.
+    The kernel header seems broken and until this is fixed, you will have
+    to enable the build explicitely.
+
+commit e26839d242693efd1a158018aae0e7d2d4185c70
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 19:08:26 2003 +0000
+
+    Added "bcast true" support to fb.modes parser.
+
+commit 5fee2d09c8cf2154d5c615d057f3319275c261c5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 19:07:41 2003 +0000
+
+    Added another sched_yield().
+
+commit a582c66f7712cb1bda026b870c3dd0d63f722c52
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 18:47:31 2003 +0000
+
+    Back to local uc_fifo ;(
+
+commit 7e59edf3764175cd0553d622c07fd418137b9244
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 18:33:11 2003 +0000
+
+    Made struct uc_fifo volatile.
+
+commit cb3c02bfdc9eb0610813d8d20cff716da745f120
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 16:57:24 2003 +0000
+
+    Removed function pointer from shared memory.
+
+commit 7f43a7d5d26d455b4f25762228970125b13372e3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 16:51:40 2003 +0000
+
+    Increase surface reference counter in grabbing thread.
+
+commit db49c9782324ec733767b8b5b4ebfc368fffeef3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 13:55:06 2003 +0000
+
+    Use +0.5f/-0.5f instead of +0.6f/-0.6f for vertical field alignment on the
+    destination when DSBLIT_DEINTERLACE is used.
+
+commit bd86f4f44f704c0e5fef0ab473fc7d024fd9305d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 13:51:53 2003 +0000
+
+    Added deinterlacing support for grabbing mode,
+    i.e. added dfb_surface_set_field() calls to grabbing thread and added
+    second frame callback to the loop (to make 50Hz out of the 25Hz of v4l).
+    
+    Made grabbing thread CTT_INPUT (with nice value -10 having the same
+    priority as input threads).
+    
+    Made grab mode surface listener be aware of video memory surfaces.
+
+commit 755acf026fcde72c5b675183b32ddf6772a6d8e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 3 13:04:52 2003 +0000
+
+    Added option to disable WM97xx driver.
+
+commit e51ffea956af5a95c3499d6fede86344b04ab85c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 08:44:03 2003 +0000
+
+    Fix screen location.
+
+commit c868a1c9b499f11d08dacacb652a2ce2ecccbada
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 06:18:18 2003 +0000
+
+    Beautifications.
+
+commit 73f43162c74557d5f3279874a2f45c383edd939e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 05:36:04 2003 +0000
+
+    Optimizations and cleanups.
+
+commit aa48f0af5db23d12971ce8dca0f3ae9c0d11d3d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 04:28:44 2003 +0000
+
+    Remember clipping region and only update hardware if the clip changed.
+
+commit c925940e3a36b3303a6e8ec22eb2814e03ca81cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 04:16:36 2003 +0000
+
+    Added state (in)validation for color2d and colorkey2d,
+    invalidating each other during validation.
+
+commit db6f08e9ad704a6fb935d87cf343954c70843a27
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 03:39:43 2003 +0000
+
+    Use one set of flags instead of several booleans for state validation.
+
+commit 839a36e01a6b7d1a7436429d392dfdbe0bff8d00
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 03:25:55 2003 +0000
+
+    Use one uc_fifo struct for all processes.
+
+commit 949f717f6271bae8e856e2c84ea5496503c23481
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 02:55:49 2003 +0000
+
+    Minimize state changes during text drawing.
+
+commit 1b4d59d640150b606058c61b9f83cb6c2ef72cf8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 2 01:26:01 2003 +0000
+
+    Define FBIO_WAITFORVSYNC ourself if it's not defined by <linux/fb.h>.
+
+commit 17569cbb0eb1ccbf593445a154fd247fea26872f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 1 18:41:29 2003 +0000
+
+    Readded W.
+
+commit 346fe69aba1e2b86fc1587671039f33e8b85c7bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 28 16:59:13 2003 +0000
+
+    Implemented DSBLIT_DEINTERLACE.
+
+commit aa1d26ed9b8825c344973560a93073800e031600
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 28 06:06:14 2003 +0000
+
+    Disabled dithering again...
+    
+    ... because: I fixed the triangle (rectangle) color bug! ;-]  *jump* *jump*
+    
+    Use HC_HShading_FlatC instead of HC_HShading_FlatA, so the hardware takes the
+    color value from vertex C which is the only vertex being written twice, i.e.
+    once for each triangle. It seems that the hardware (which got the color via
+    vertex A only once for both triangles) kept an RGB16 version of the color
+    and used that for the second triangle...
+    
+    To clarify this in the code even more, vertex A and vertex B have a '0' instead
+    of 'ucdev->color3d' written to the FIFO.
+    
+    I also changed uc_fill_rectangle_3d() to use the "HC_HVCycle_AA, HC_HVCycle_BB,
+    HC_HVCycle_NewC" sequence to use HC_HShading_FlatC instead of HC_HShading_FlatA.
+    
+    
+    Heavy DMA problems with v4l overlay capture some to be gone! ;-]  *jump* *jump*
+    
+    Still some minor glitches are noticable under huge GPU load.
+    But these appear just for one frame. There are no dead regions
+    (bunch of lines which can't be written to for several seconds) anymore.
+    
+    The fix seemed to be setting 'ucdev->must_wait = 1' after flushing the FIFO
+    in uc_emit_commands(), it was never set to 1 at all before.
+    
+    
+    Fixed the broken fonts problem! ;-]  *jump* *jump*
+    
+    Added uc_flush_texture_cache() which simply writes four entries to the FIFO.
+    These entries were written in uc_set_source3d() before my changes...
+    
+    Use correct state invalidation now,
+    e.g. no longer set 'v_source3d = 0' if the source wasn't changed ;)
+    
+    
+    Removed UC_FIFO_FLUSH(fifo) from uc_set_state() again :-}
+    
+    Use UC_FIFO_PAD_EVEN(fifo) at all places where 'cmdA_End' was replicated before,
+    doesn't give any performance improvement though...
+    
+    Changed the FIFO depth from 2000 to 4096 entries to finish a complete string
+    without intermediate flushing, even if the string has more than ~70 characters.
+    
+    Added timeout error message to uc_waitcmd() and uc_engine_sync().
+    
+    Fixed passing of the destination format to uc_map_blending_fn().
+
+commit eba7584a163c14ebdd85a459c007a8986d919a06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 28 01:14:39 2003 +0000
+
+    Fixed removing an active context while the session is suspended.
+
+commit f1a8923dc6a4499e0bb24814e3e251753850043b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 28 01:12:48 2003 +0000
+
+    If a dlopen()'ed module did not register itself, try to dlsym() and call
+    the default contructor (filename without "lib_" and ".so").
+
+commit 02c5dbd24431dc9489c72155089affe65b61c009
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 27 11:12:07 2003 +0000
+
+    Readded the FIFO flush and HC_SubA_HPixGC setting,
+    text rendering was suddenly broken, though I tested it before the commit.
+
+commit d1c8456af0f340ee57c21c8b166bf8ca115789f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 27 10:55:38 2003 +0000
+
+    Added some comments to guess meanings of HC_Hen*_MASK.
+    
+    Andreas Robinson, please check those, thanks.
+
+commit a43e0ac46ecd2c57113607996bc77d487a19d0f4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 27 10:48:31 2003 +0000
+
+    Use HC_HenDT_MASK to enable dithering, triangle color bug almost invisible now.
+    
+    Added UC_FIFO_ADD_XYCST, don't send W coords, saving four FIFO entries per blit.
+    
+    Invalidate texenv also if source changed (texenv depends on the source format).
+    
+    Don't set HC_SubA_HPixGC. DRI does it, but we don't seem to need that.
+    
+    Don't flush the FIFO in uc_set_state(), it's flushed shortly after anyways.
+
+commit 4f7523ba01efee8a4897eeee731ad51270fd0927
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 27 06:50:51 2003 +0000
+
+    Call iopl(3) in each waitretrace(), not just once.
+
+commit 7324e6ab0fe13dac35fc9d83baf91553525e2a0d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 27 01:04:45 2003 +0000
+
+    Use fbdev to map registers, obsoletes cle266vgaio!
+    
+    Code still works with cle266vgaio for vesafb users...
+    
+    Made all register pointers volatile.
+
+commit 32d8bf490131f1c9e3a99627b34d62bd75fc8190
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 26 13:14:28 2003 +0000
+
+    Forgot to add CLRCF_DEST to CLRCF_ALL.
+
+commit 6b60c3be92cd724a2026aaadff8128b4748d3996
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Nov 26 13:12:25 2003 +0000
+
+    fix some layer specific stuff
+
+commit 8f50421259290c0514a6863a60282815522a0451
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 26 13:07:39 2003 +0000
+
+    Forgot to add that.
+
+commit dcac37122f80c8184c474959bbb6d41b956c011f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 23:09:18 2003 +0000
+
+    Option "force-desktop" supports stretching now, e.g. using "mode=".
+
+commit ef2ac0adeb2f0f57d2491696a4d22f1d933663ea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 22:53:42 2003 +0000
+
+    Install symbol map for dynamic library if --enable-trace is used.
+    
+    Shows static symbols in stack traces now.
+
+commit 3ae7aec7743c85d927ce5f529c89e9fecbc471bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 21:55:02 2003 +0000
+
+    Allow --enable-static and --enable-trace at the same time.
+
+commit 85f6db10a0019c6c0d6c72e4fb9770692be08bd1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 17:03:27 2003 +0000
+
+    Fixed VT switching.
+
+commit c9361b0aa96b76e4176ddbbc4a2a2a5481264b72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 16:12:22 2003 +0000
+
+    Set hardware palette in region surface listener only if the region is realized.
+
+commit 7df2baa067ae385521970b74b20c26bea6bcda31
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 15:35:16 2003 +0000
+
+    Fix width and height of primary surface as set by SetVideoMode().
+
+commit 1da80e7698efa86752f83d82ba8a5a1cb0674a35
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 15:28:22 2003 +0000
+
+    Use negative ABI versions for debug enabled builds.
+
+commit 8a0e5f631660c401148c9527a275384b9d227c73
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 13:11:01 2003 +0000
+
+    Added DFBLocation which is like DFBRectangle but has normalized coordinates.
+    
+    Added macros to compare rectangles, regions and locations.
+    
+    Added preliminary dfb_screen_rectangle() which behaves like the removed
+    dfb_primary_layer_rectangle(). The final version of this function will
+    be done upon introduction of screens.
+
+commit a16b9e42fe5c87803e808185c17032aa6d0226f4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 12:19:25 2003 +0000
+
+    Be aware of layers without DLCAPS_SURFACE.
+
+commit f1af06ff3b0ebb8b2619bc5310087c3fa53b4aba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 25 12:11:10 2003 +0000
+
+    Fixed usage of layers without configuring them.
+
+commit 599988f97b57535d7c482c9049fb7c3496e8eb2e
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Tue Nov 25 10:57:30 2003 +0000
+
+    added two more header files to make "make dist" happy again
+
+commit 7249619191a1aba73a6f49a5ac86b58829385cfc
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Tue Nov 25 10:53:48 2003 +0000
+
+    - divided driver into multiple source files.
+    - removed stretchblit (not supported by hardware).
+    - added some more compatibility definitions, so a driver built with and old
+      sisfb.h can use the features of new sisfb versions.
+    - cleaned up sisfb version check.
+    - set state->accel = 0 for DFXL_FILLTRIANGLE. makes it a lot faster, but
+      I don't know why, because this function is not supported anyway.
+    - added "xabre" to supported fb accel ids (SiS 330).
+
+commit f3158e5df082608dc847163128dfeeb1c2b745d6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Nov 24 18:52:01 2003 +0000
+
+    don't generate trailing whitespace
+
+commit 6c3eb929b030bd26883f12cb2305cc434eb89601
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 24 18:24:27 2003 +0000
+
+    forgot to port uc_ovl_disable
+
+commit 42abc000fa7a84e82fa84ff3a6ff8eaf259ebc21
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 24 17:55:41 2003 +0000
+
+    Added boolean to dfb_layer_get_primary_context() to activate the context
+    if no other context is already active.
+
+commit 723ffe33fedaefab2cad17a5afbbcf2ac0a9ddc8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 24 17:15:14 2003 +0000
+
+    build cle266 driver by default
+
+commit aadfe5ac8a0580f4ea83e3ba0bee58c9e0c8347c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 24 17:09:33 2003 +0000
+
+    ported to new internal layer/region api
+
+commit 9848bb5f939bba6be889b4ee501881b8019af3ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 24 16:49:35 2003 +0000
+
+    Fixed shared window palettes.
+
+commit 6db29052d2c0db950ff12395382ed9b4aac0728d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 24 13:08:30 2003 +0000
+
+    Refactored display layer core. Added contexts and regions allocated
+    within a context. Drivers are only aware of regions now. Usually a driver
+    supports one region per layer. Hardware windows are implemented via regions.
+    
+    Not yet compiling drivers are disabled in configure.in
+    (default of --with-gfxdrivers contains ported drivers only).
+    
+    Sorry for the driver API driver change, but it's much cleaner now.
+    
+    Added DFB_COLOR_BITS_PER_PIXEL and DFB_ALPHA_BITS_PER_PIXEL,
+    pixel format constants changed, too.
+    
+    Some other changes and improvements.
+
+commit 814009fb7faa6377862d7dc2074467e18c887ecb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 21 15:07:36 2003 +0000
+
+    If CheckState() reports other functions than the requested one as supported,
+    don't ask for them again.
+
+commit 50c4767be94b54cac58ac65c3264001235ef77d4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 21 14:58:54 2003 +0000
+
+    Reject format conversion blits which are unsupported.
+    
+    Minor state handling fix.
+
+commit aa44468092464b0b5f5229f65385a84bea6fd486
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 21 14:00:43 2003 +0000
+
+    Parse preceding comments in enums.
+
+commit 01724602af1373b1fa7bf4f788480464259c6672
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 14:30:59 2003 +0000
+
+    fixed make dist
+
+commit 2f49ac11e807fb5b13f31d9a3cff3cc498d5e4ef
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 14:28:02 2003 +0000
+
+    removed non existant sisfb patch
+
+commit f45dda572a20b62f86a8b48625021e2f60abaa69
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 13:09:29 2003 +0000
+
+    compatibility definitions
+
+commit 53980785f92e97b4059cd43910ff7561a62181a9
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 10:39:46 2003 +0000
+
+    removed obsolete patch. please use sisfb 1.6.23 or above.
+
+commit c7e50e5a6d66bc187e307465c4a6763867c65c0d
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 10:38:37 2003 +0000
+
+    - use 32 bit access only
+    - configure sisfb so that it does not always maximize vyres
+      (requires version 1.6.23 of sisfb)
+    - added destination color keying
+
+commit 498f8d98a90661106fc8a9ce1f99bc81efb1c029
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 20 10:33:18 2003 +0000
+
+    require <linux/sisfb.h> for sis315 gfxdriver
+
+commit 5d7ed91179ac2cd73003c1ff9c8e066aef30afb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 18 22:45:18 2003 +0000
+
+    Removed AC_C_CONST which defined "const" to nothing if -Werror was used, argh!
+
+commit 6129fcb53475bffd6c9899f59ada0ce9fbbaa20d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 17 20:32:44 2003 +0000
+
+    added hack for forcing grab mode if environment variable DFB_VL4_GRAB is set. (this is for broken hardware with broken busmastering)
+
+commit 9440abb22bd202bbd14796cf52f22a20c6a80c39
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Nov 17 11:02:54 2003 +0000
+
+    Use the recommened way to include freetype headers.
+
+commit feeb770ee07dbad6ac4f7dc8e167c828a4a42ffc
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Thu Nov 13 13:43:37 2003 +0000
+
+    Added video underlay mode. Updated Readme.txt
+
+commit 3f46eb7e83ffc266455d74d990bb4d51efc6664d
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Thu Nov 13 12:41:51 2003 +0000
+
+    Print error message on startup if cle266vgaio module can not be accessed.
+
+commit 5970a1600f540b42b1e815fc6f851ebae4250634
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 10 16:53:06 2003 +0000
+
+    - remove libmpeg3 video provider, it has been moved to DirectFB-extra
+      and includes FusionSound support.
+
+commit f597aeb3bc878451e078630becc933ab45c0f091
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Fri Nov 7 05:00:31 2003 +0000
+
+    include sisfb patch in extra dist
+
+commit f033956fd415a4db7db6802a6c64fa62ba84f39b
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Fri Nov 7 04:11:30 2003 +0000
+
+    sisfb does always set vyres to the maximum. this patch allows to set custom
+    vyres resolutions and therefore makes directfb's accelerated blit working.
+
+commit b3237924252b09b18ee64f0fc9c526593f888656
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Fri Nov 7 04:04:27 2003 +0000
+
+    - added drawing of rectangles
+    - added source colorkeyed blits
+    - fixed clipping
+    - refuse blit with color format conversion
+
+commit 0adff149f2aeeacb1fc92e9a4b4a23ff61ebc675
+Author: Andreas Oberritter <oberritter@directfb.org>
+Date:   Thu Nov 6 18:50:11 2003 +0000
+
+    new driver for SiS315 chipset with line drawing, rectangle filling in 8, 16 and 32 bpp, blit in 8 and 16 bpp, clipping
+
+commit b52450602059f7b65b48d9764d61f30220e6c5b1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Nov 6 15:56:53 2003 +0000
+
+    Removed the notice about multi-image powers.
+    Not needed any longer now that the version number has been increased.
+
+commit 3bf11e77561e2db1461aeb25a1ea87fa674e76ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 5 23:55:28 2003 +0000
+
+    Don't pause() after kill().
+
+commit 881c6c1a4eb4786e80ec9eb53fc7f20ee4ac3acf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 5 16:24:58 2003 +0000
+
+    No need to SetOpacity() before RequestFocus() for input only windows.
+
+commit 014d792936f01f05bef661396ac6b3fcc8d86d5c
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Nov 5 13:39:17 2003 +0000
+
+    Define UC_ENABLE_3D. (I forgot to restore it after testing.)
+
+commit 55b5b7c345a65009eea74c319b72386d28318724
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Nov 5 13:36:23 2003 +0000
+
+    The driver can now be made to avoid the 3D engine by undefining UC_ENABLE_3D in unichrome.h
+
+commit aafe251418f54f1ad6cd141756c4468c4350af61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 4 22:01:05 2003 +0000
+
+    usleep(20000) -> usleep(10000), much smoother input
+
+commit 145ac49c488752486bf8e712f8342e3485375287
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 4 21:55:13 2003 +0000
+
+    Restore file content.
+
+commit bdac023a0ba082c77195ab723170c7d7f0160e3d
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Tue Nov 4 08:43:57 2003 +0000
+
+    Added devfs-free compilation options. Minor cleanups.
+
+commit a760fb19ecb6bce5e3077b946cd24706fbfacab0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 1 03:14:44 2003 +0000
+
+    Major code cleanup.
+    Introduce new structure "CoreDFB".
+    Nearly rewrote src/core/core.[ch] in the way of FusionSound's core.
+
+commit 0a9066211cb54c04fa9b1cfaa2edee8fc6e834fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 29 18:32:54 2003 +0000
+
+    Added option "force-desktop" ;)
+
+commit 4891a5b88caa183fb6d1624ded58e9373313d7c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 29 16:59:43 2003 +0000
+
+    0.9.21
+
+commit 10a6b8872855da5f52b38d001463a189877a7c8a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 29 16:59:02 2003 +0000
+
+    All <object>_unlink() functions take a pointer to the object pointer now
+    and write a NULL into this location themself.
+    
+    Fixed warnings.
+
+commit 2bf0b10263ce2383004b3723f606f498ab852093
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Oct 29 13:37:10 2003 +0000
+
+    Benchmarks updated. Minor cleanups.
+
+commit c937d39055eef2807ea29b6cfaa8d7f7de1abe68
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Oct 29 12:44:42 2003 +0000
+
+    Performs userspace PCI-bus probing and memory mapping.
+    Depends on /proc/bus/pci/devices and /dev/mem.
+
+commit 8b7ba2909e0aa7aaeeea65d06da3720f7a6a5a09
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 29 01:48:44 2003 +0000
+
+    Removed an assertion.
+
+commit 92e9ccc7fe03ef33390301ce574720fed6b3c830
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 29 00:03:07 2003 +0000
+
+    DisplayLayer is now called CoreLayer.
+    
+    Indention fixes.
+
+commit 723aa1dee06266439a6a8fc91cbeceda87d76b0e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 21:36:06 2003 +0000
+
+    Set default screen location back to fullscreen.
+
+commit e1e1d4ed744f1c4b2de202fa6abf59401930247e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 21:31:11 2003 +0000
+
+    Increase the reference counter in dfb_layer_enable() if it's already enabled.
+
+commit 8120a2db671e34b1958a34bb50f237be119099bc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 21:25:51 2003 +0000
+
+    Introduced new object for allocation of hardware regions within layers.
+    
+    Work in progress, behaviour is still the same,
+    but automatic deallocation of layers (disable) is already working.
+    
+    Test with: "dfblayer -l 1" (should show the overlay for a really short time)
+
+commit b3cfbc1659873a451da8bc5f726cc441eab3aab0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 20:48:02 2003 +0000
+
+    Added global ABI version for shared memory.
+
+commit 4c7d26d446d7b2d4c904e99b33be2167545da296
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 18:47:44 2003 +0000
+
+    +#include <config.h>
+
+commit d249eec0c3964b3238b9ef82df9e830a869b3957
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 28 16:33:16 2003 +0000
+
+    Added functions for DFB_ASSERT and DFB_ASSUME to save binary size in debug mode.
+
+commit 7cd990d09885d20ab91ee1460a68bd7da947abc6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Oct 24 23:38:44 2003 +0000
+
+    Mention the multi-image functionality in the usage string.
+
+commit b40555f2ae6e5054fe0e87639f7cc8180aed727e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Oct 24 18:49:53 2003 +0000
+
+    Tweaked name mangling routines.
+
+commit 04a520acde92e0dd8bd2735870575bc3954f27ec
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Oct 24 18:21:39 2003 +0000
+
+    Do variable name translation for the case of multiple images as well.
+
+commit c3b15976a2c89f5a5c9a4cad4ce957941fe9e049
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Oct 24 16:16:35 2003 +0000
+
+    Dump an array of names and rectangles when processing multiple images.
+    Document the new feature.
+
+commit 4860226fb2863977073bd3e77f6471bdf6284e11
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Oct 24 13:46:46 2003 +0000
+
+    Started to add support for combining multiple images into one surface.
+    Lacks a few minor features still but shouldn't change the existing
+    behaviour.
+
+commit 1a6bb6c5ef0ab781a62800c659b675340cab29ea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 24 04:36:04 2003 +0000
+
+    Added option "--fusionsound" for statically linking with fusion sound.
+
+commit a6695a466e1658b28bcf064462f9ea8452f8691a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 23 16:32:12 2003 +0000
+
+    regenerated
+
+commit 7d9e53cb891e934504d42b204ee81af5002d47ec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 23 16:30:55 2003 +0000
+
+    readd with executable flag
+
+commit e99cf70d2187c19d967bb9459d812b976f319fdb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 23 16:30:32 2003 +0000
+
+    temp. remove
+
+commit a0dc28df72b8257818c831dc7daf9990eef97548
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Oct 23 16:23:54 2003 +0000
+
+    changed andros email address
+
+commit 049616da2bd03dbcab874f79f804afe9c803ba8c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 23 16:01:07 2003 +0000
+
+    Updated.
+
+commit aacf5d4520c6ef04be7f2ac72d300a00e081e35b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Oct 23 14:12:00 2003 +0000
+
+    minor code formatting changes
+
+commit 5f2dce31898b6945116c1edfdbbb3dfbdfbc9e5a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Oct 22 09:01:14 2003 +0000
+
+    added Andreas Robinson <andro134 at student.liu.se>
+
+commit b654880727c4709c95f4a9c581054ca73bdb49ac
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Tue Oct 21 23:24:10 2003 +0000
+
+    Updated changelog for v0.3.0
+
+commit 5f481a40e34079d6d74db83acaae30cbce529376
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 21 15:30:03 2003 +0000
+
+    - version number = 0.3
+    - imrovements to state handling
+    - workaround for font rendering in some applications
+
+commit b4e22eb8a01b8e6fc97a0d23330cae9ea8237cc9
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 21 13:56:31 2003 +0000
+
+    another state handling fix.
+
+commit e4c656cb8df311fb6db09c9cc9c05345adbd5313
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 21 13:19:32 2003 +0000
+
+    COMPILE WITH GCC 2.95!!!
+
+commit 924de35c6c6c19c29be5bbc822337cb9421e865a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 20 20:04:32 2003 +0000
+
+    Compile with gcc 2.95.
+
+commit 8497262cc2d34cae2b8d710e7ac5b17ebcacf1ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 20 13:39:30 2003 +0000
+
+    Fixed warning.
+
+commit 3fcbdf1fb7bdf5a19d26729b66f5fb47aa1ce320
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 20 13:39:14 2003 +0000
+
+    Added missing ranlib call.
+
+commit e02bf2c3cb58ba92d4bd15c059d693fdf3c0bf3a
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sun Oct 19 22:49:56 2003 +0000
+
+    Added AfterSetVar() function. May help with VIA-drivers crash bug.
+
+commit 76b933ae5b41d7948986da541c3fd30babdecf3a
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sun Oct 19 22:44:20 2003 +0000
+
+    Fixed some compiler warnings.
+
+commit 72d1f1682c9335ba3b2ff71e1bc03531e7279500
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sun Oct 19 22:39:31 2003 +0000
+
+    Print debug msg before writing to hardware register.
+
+commit e7fd0fbdb44022543badc0303082057c4566acd3
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sat Oct 18 11:51:41 2003 +0000
+
+    Made the driver use EmitCommands().
+
+commit 45d6d92927dc92ac1fc8478a2b13ddd8868bc5ba
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sat Oct 18 11:50:01 2003 +0000
+
+    Removed an unused variable.
+
+commit 562c4f918dd6f6a47e89e4c9ec205754cb6cc54e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 17 16:12:18 2003 +0000
+
+    Fixed warnings.
+
+commit 43d56afae8ddc8d84c495ce4273b7dea678a7928
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 17 16:09:25 2003 +0000
+
+    Added graphics driver function EmitCommands().
+    
+    It's called when a state is released. Drivers can flush or emit any kind of
+    command buffer. This is an advantage over flushing after each command,
+    especially for dfb_gfxcard_draw_string() and dfb_gfxcard_fill_triangle() with
+    semi acceleration.
+    
+    Made dfb_clip_blit_precheck() static inline.
+
+commit 2bd54e3f72512e52f59ccc2a63a235f248c7cdf0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 17 05:34:55 2003 +0000
+
+    Updated, too.
+
+commit 239a4965630d9e02a294a62a3e52ea934d30f1f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 17 05:32:02 2003 +0000
+
+    Added getpid() benchmark as a reference value for system calls.
+
+commit ba4d5f186b126a74b477cdefe0d913de2d4a7966
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 15 21:41:49 2003 +0000
+
+    Added error checking to IDirectFBSurface_Window_Construct().
+
+commit 8aeb95838c0572f30af4d285c54476aa0af6de18
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 15 21:07:19 2003 +0000
+
+    - sync/sleep before each test
+    - use simple version for mutex/skirmish with one thread
+    - added recursive mutex benchmark
+    - added reactor_attach/detach_global() benchmark
+
+commit 283a996ea772a288002d554a33696e4aba6cfe51
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 15 17:01:29 2003 +0000
+
+    Use dfb_surface_data_offset() in dfb_surface_dump() to support DSCAPS_SEPARATED.
+
+commit a86ea87a041bd6f5add62297dd7bb97025a58bfb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 15 16:41:17 2003 +0000
+
+    Added dfb_surface_data_offset() which calculates the data pointer for a
+    given coordinate (x/y) based on the pointer and pitch passed to it.
+    
+    It also handles DSCAPS_SEPARATED depending on the surface which is passed, too.
+
+commit 1c85042724e8b733e0f427584635a34d8d9a24e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 14 07:59:00 2003 +0000
+
+    Updated.
+
+commit 019fc07ab06906f4a464649a55936a85e4a34c1e
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 13 17:15:50 2003 +0000
+
+    fix state handling
+
+commit c5e8b10aab4e3ab1a415b6227c781284964d2f82
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 13 04:08:16 2003 +0000
+
+    Don't attach the font state to the destination to avoid increasing its
+    reference count until the font is destroyed or used on another surface.
+    
+    Lock original state, too.
+
+commit 9ffde3df5ae0769d999dfb60ed32a4c6571be8dd
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sat Oct 11 11:22:11 2003 +0000
+
+    Increased pixelpitch alignment from 16 to 32 to overcome a limitation in
+    the video overlay hardware.
+
+commit d3031d2ebafb6081d8432641084865a1d8f5af9d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 10 19:35:46 2003 +0000
+
+    Higher video priority buffers always kick out lower priority buffers.
+
+commit 8433220f469d2fd61e1a98b144cbfb387d702dbb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 10 19:16:40 2003 +0000
+
+    Indicate locked buffers.
+
+commit e3fec9a655c7462d5583e6084230fff2a8a88ca9
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Fri Oct 10 16:11:52 2003 +0000
+
+    viafb problem workaround rollback - it worked once, but not twice. :-/
+
+commit 0e65489ee6b8c3a6357c846d7d208068ea7ca199
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Fri Oct 10 15:26:52 2003 +0000
+
+    Worked around the problem which hangs the computer hard if e.g viafb is installed.
+    I don't know why VIA's own drivers don't need the same fix ...
+
+commit af5c3cc162f5cf1607e2e06d20d616d1672ca0f4
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Thu Oct 9 17:17:28 2003 +0000
+
+    Made DSBLIT_COLORIZE and DSBLIT_BLEND_COLORALPHA work in df_neo and df_dok.
+
+commit ec5ccd43f39e51a85d6b20741c10c0ba2c60420c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 14:00:22 2003 +0000
+
+    Small fix.
+
+commit 68dcd5ca801bcd184f59713467347a5e30ae601e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 13:57:17 2003 +0000
+
+    Improved output.
+
+commit e21d5f94950f8238b27d6b42ca306a516aa51503
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 13:37:34 2003 +0000
+
+    Show window id.
+
+commit 5a83bc9115286373039442e86c4c56d818f6c8d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 12:59:39 2003 +0000
+
+    Print "DESTROYED" if window is destroyed explicitly but object is still alive.
+    
+    Show reference ids for further investigation via /proc/fusion.
+    
+    Added table header to surface list.
+
+commit 6f372207d30b0272eb66421b51b5251b8e7c8e74
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 12:57:37 2003 +0000
+
+    Don't remove the window from the stack in dfb_window_destroy(),
+    but in the window destructor (object finalizer) after remaining
+    references went off.
+    
+    This way dfbdump can show (not fully) destroyed windows.
+
+commit b0ec0e30491543f143e8c81dc3a608ad3e806a56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 02:13:16 2003 +0000
+
+    Print "GHOST" for ghost windows.
+
+commit 1267fc18565416505f0bb9378074c74d04ed2bc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 9 02:09:06 2003 +0000
+
+    Silently mask out DWOP_ALPHACHANNEL instead of failing in SetOption()
+    if it's not supported.
+
+commit c873b06ebfe9aeb1fb78638ab561caf11c04f4b4
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Oct 8 17:08:55 2003 +0000
+
+    fix off by one bug for blended filled rectangles
+
+commit 2a9513faf71efcdf9fce08c858bb50ae6bdb18bd
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Oct 8 16:50:43 2003 +0000
+
+    - correct pixelpitch and byteoffset alignment for surfaces
+    - fix off by one error for 3d clipping
+    - reenable 3d blitting
+
+commit 3efd2530401af6d01ec8eb143e5106506e6fedb9
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Oct 8 16:13:44 2003 +0000
+
+    fix off by one bug in uc_stretch_blit()
+
+commit 862b5965b7b73ad526572eb06a4fff12fb11d835
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Oct 8 15:23:31 2003 +0000
+
+    Partial fix for 3D-blitting size problem. Blitting arbitrary (non 2^n) sizes
+    works much better now, but there is still a one-pixel-off error in df_window.
+
+commit 2af2bd3d65b835bf01eca618d63338461c855ac1
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Wed Oct 8 14:00:55 2003 +0000
+
+    Fixed LUT8 blit bug. The driver erroneously tried to do a LUT8->LUT8 stretch
+    blit, which isn't supported.
+
+commit 485126ab97e797826ebaeef5b4ef5bb8408f8c2b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 7 16:54:06 2003 +0000
+
+    remove check for VIDEOONLY surfaces, disable blit_3d stuff because it
+    is broken.
+
+commit 5a8ce171861b0eda510e2eb6ad0ff6dd8f6d6c2c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Oct 7 12:14:47 2003 +0000
+
+    Added DSFLIP_ONSYNC support to fbdev layer.
+
+commit 13c94ded77477363f01f06d702ef97db9ce31a7a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 7 11:17:32 2003 +0000
+
+    fixed optimized 8bit colorkeying for little endian. disable it on x86
+    since it is much slower. have to test on my little endian arm machine.
+
+commit 1a8d500ba8eda04b28a85a2753331a34941b0b37
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 7 10:09:27 2003 +0000
+
+    removed my stupid debug message
+
+commit e7acfd4be08e50f51660c41d862ce8cc80f9989a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 7 10:00:17 2003 +0000
+
+    Removed evil artifact.
+
+commit 29d3c0334d0cb4a3451d92994a52ab7aa483e924
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 7 09:52:58 2003 +0000
+
+    enable dok's 8 bit colorkeying optimization for all big endian architecures
+    
+    PowerBook G3 400Mhz
+    
+    df_dok --dfb:pixelformat=LUT8 --blit-colorkeyed
+    
+    before: 13.16
+    after 42.70(!)
+
+commit ea35317ab285ad9bf8ddf29b6e8bc432b9ec7e27
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 7 07:56:55 2003 +0000
+
+    Added null pointer check.
+
+commit 1dc1312bfe281addce79ffbe429e19b4d10a570e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 7 07:53:59 2003 +0000
+
+    Fixed segfault.
+
+commit 72eef2f506f36a5fc23097c9aacf17552053273b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 7 07:13:55 2003 +0000
+
+    Wrote two complex 8 bit color keying implementations optimized for alignment,
+    currently only enabled for MIPS Big Endian for testing.
+    
+    1) (sx & 3) != (dx & 3) ->  30% boost
+    2) (sx & 3) == (dx & 3) -> 120% boost
+    
+    Should be tested on other platforms. Little Endian is not supported by 1), yet.
+
+commit f88d3a3f8dd5435b67aa5e863ab6086401027e06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 21:45:25 2003 +0000
+
+    Start with 0x00000001 in DFBDisplayLayerBufferMode which can be used as flags.
+    
+    Sorry for binary incompatibility.
+
+commit d548d69994d024b7137f7ef4b451e1ce4314e085
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 19:29:29 2003 +0000
+
+    Fixed 'for' condition.
+
+commit 6fa41938153b2815cb953101fd071384d8c85b6c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 19:18:59 2003 +0000
+
+    Clean up dfb_scale_linear_32() and dfb_copy_buffer_32() parameters.
+    
+    Destination offset is now handled by these functions,
+    fixing rendering to field separated surfaces with an offset != 0, 0.
+
+commit 0d4d2dba153e4ea79211c011ad6a00d7be4ac471
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 6 17:53:15 2003 +0000
+
+    fixes for multi-application support
+    
+    - move vq stuff from driver_data to device_data
+    - allow cle266vgaio device to be opened more than once
+
+commit 2ac36d3e587002ff96cca0b827de565b98fb8baf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 09:42:17 2003 +0000
+
+    Added some keys to id_to_symbol().
+
+commit 7b024144488e57826f394251b6fa00b287ff340e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 09:41:44 2003 +0000
+
+    Minor simplification.
+
+commit cf72b56db892497c6672fbf96744d3e215113ffc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 6 09:38:37 2003 +0000
+
+    Added DFB_KEY_INDEX macro.
+
+commit 8a4c7d1be28586c2b09cfe420f102f447fd89b2f
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sun Oct 5 11:59:27 2003 +0000
+
+    YUV planar mode bugfix. U and V planes were not set up correctly and did not look right.
+
+commit aa1c81f7f81f26c978b6023d14327703c0ff8ef1
+Author: Andreas Robinson <andors@directfb.org>
+Date:   Sun Oct 5 11:33:11 2003 +0000
+
+    Added WaitVSync() to video overlay.
+
+commit 561d695d2bf7ecec8e8095166c4b52a447cd077f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 4 19:30:53 2003 +0000
+
+    New version for VMware Workstation 4.0, supports switching of bits per pixel
+    at run time, can disable acceleration at run time. Also fixed palette mode.
+
+commit 4aaae87c1b9572853df7397a2553d496de5487b5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Oct 2 17:54:14 2003 +0000
+
+    fix FillTriangle() for non 32bit modes
+
+commit b9a6e63dcbb0542cbf563ad50319aab265881f64
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Oct 2 16:44:19 2003 +0000
+
+    bugfix for blended FillRectangle(), DrawRectangle() and DrawLine()
+    in non 32-bit modes.
+    
+    (while performing 3d operations, the source color is always 32 bit ARGB,
+    not in the destinations's pixelformat)
+
+commit d769aa4937bdf54641e75c3a2e3025b505f67d26
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Oct 2 15:42:48 2003 +0000
+
+    - removed surface allocation for vc buffer,
+      use dfb_gfxcard_reserve_memory() instead.
+    - added note about vram command line boot parameter
+    - removed bug note about wrong driver announcement
+
+commit 0040a5698a575787a2331e305efd921395c988ae
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 1 20:41:25 2003 +0000
+
+    Fix for CONFIG_FB_MATROX_MULTIHEAD.
+
+commit ceafba96eef8161909930b8169b12597aff3487d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Oct 1 17:32:36 2003 +0000
+
+    Patch to set the clocks on a G400 to proper values.
+
+commit 26e24bd633adf79e4ca4af942ba6560bf46d11ec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 12:28:35 2003 +0000
+
+    Commented out assertion.
+
+commit 45cf404c12027db827c1b17a976938256ce255c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 12:03:49 2003 +0000
+
+    Fixed dfb_colorhash_invalidate() which did not invalidate the first entry.
+
+commit 9236c4548c7b9d27e0b631adcfd7db9e557a3a72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 12:02:18 2003 +0000
+
+    Removed debugging artifacts.
+
+commit d73a23fa09b57f18b727cb60fde34df8a1ee342c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 12:00:32 2003 +0000
+
+    Forgot to add that.
+
+commit 20d4cf1a29b166b373428ea4e755ec5b610bcb18
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 11:59:58 2003 +0000
+
+    Removed bogus flag.
+
+commit eb7796df28e8c762ffed4485e9388b7e3cf2bf52
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 11:40:14 2003 +0000
+
+    Added new display layer buffer mode DLBM_WINDOWS where the layer itself
+    has no surface, but the hardware is aware of each window and displays the
+    window stack.
+    
+    Added DLCAPS_WINDOWS and three display layer driver calls to add, update
+    and remove windows.
+
+commit 1a0a2e4f1b505b1abb20c9e50c21cc2c7f2bdac8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 11:25:21 2003 +0000
+
+    Pass real alpha value to conversion routine.
+
+commit c7dbd0e4656b042ee1b086076f624e325c96c821
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 1 11:20:34 2003 +0000
+
+    Added "void *device_data" to InitDriver().
+    
+    Drivers can store a pointer to the shared device data in the local driver data,
+    e.g. to access the device data in display layer functions which only get the
+    driver data passed.
+
+commit bd189db4e963eb4509ea1620ace896d2d313d80e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 30 14:59:54 2003 +0000
+
+    Don't blend pixels with black when loading images with alpha to non-alpha formats.
+
+commit 0cd1d62c5fed01a9670d4d16862ea40d730cdc21
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 29 14:37:12 2003 +0000
+
+    Fix for v4l2.
+
+commit 66e5423fcdc5c14da59502982a1aa652a3083079
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 29 13:42:36 2003 +0000
+
+    Video4Linux 2 support by Michael Hunold <hunold@convergence.de>, thanks!
+
+commit d37b5d90a0f278fa4bf805e80727ef1a67bd52ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 25 06:35:12 2003 +0000
+
+    Creating a fullscreen primary with a pixel format set in the description
+    took the pixel format specified via "pixelformat=" option if the current
+    pixel format already was the pixel format set in the description.
+    
+    Make sure the "primary-layer=" option used for slaves enables the display
+    layer before usage.
+
+commit b916326e4eeafde64c422adb50a5ddc57e937abc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 25 05:23:58 2003 +0000
+
+    Include <sys/io.h>.
+    
+    Build CLE266 driver on platforms with sys/io.h only.
+
+commit a07f1f0272ebfd8e68703ccc063b22e0fae9d683
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 25 05:21:41 2003 +0000
+
+    Compile fixes for 2.95
+
+commit 7b76b469d759d8d833b4e12648644bac3dfb80ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 25 04:30:57 2003 +0000
+
+    CLE266 driver by Andreas Robinson <andro134 at student.liu.se>, thank you!
+
+commit ca271e02747c86c00e88aff7cb45821d08acdb3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 23 20:35:22 2003 +0000
+
+    Added "LL" suffix to constants of multiplication to preserve long long type.
+    
+    Otherwise the session uptime turns negative after about 25 days,
+    e.g. using dfbdump to display it.
+    
+    Yes, my working session is up for "29 days, 10:02:37" now ;)
+    
+    My secondary session (dedicated to XDirectFB + streamtuner + xmms)
+    is up for "36 days, 05:48:40" !!!
+
+commit bd288a776bc69d170e8dfd459bca993c23548378
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 23 14:38:27 2003 +0000
+
+    Don't set alpha value of color key palette index to 0xff.
+
+commit a42b6759c6f3b29a577ca81855d731da3d9920ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 23 13:11:30 2003 +0000
+
+    Simplified Bop_a8_set_alphapixel_Aop_lut8 for monochrome fonts.
+
+commit d4118854c73912a533bbeb4de439d2c86f697081
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 22 20:25:29 2003 +0000
+
+    Ignore r, g and b difference if alpha is zero.
+
+commit 2b49dc202687883cc1f00d658a4086f0066cc3e1
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri Sep 19 01:17:21 2003 +0000
+
+    PIXEL_RGB24 is gone, use PIXEL_RGB32.
+
+commit 184090db8eb237002bb4cfd925a5aeacf840160a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 12 21:41:16 2003 +0000
+
+    Remember and compare the Fusion ID of the last state's owner.
+    
+    Fixes cases where state pointers equal but don't belong to the
+    same application.
+    
+    I wondered for a long time why two instances of e.g. df_andi
+    running windowed mixed up their blits.
+
+commit 8e7b5602dc9b3f4ee45826406d762546be9ef8a5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 10 08:17:45 2003 +0000
+
+    Show actually allocated bytes for each surface (video + system).
+
+commit 87733c28aa29cee2cffff1f4d09cc3243f460ea8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 10 02:14:32 2003 +0000
+
+    Less weight for alpha.
+
+commit 54c0a89735543499f7dba2a7d24a7e8e5b95389f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 9 18:33:25 2003 +0000
+
+    Multi app related stuff.
+
+commit ecfede23d0e9550b24ce7da5cff8a05a4b994892
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 5 12:19:08 2003 +0000
+
+    Restore KD_GRAPHICS after switching back to DirectFB.
+
+commit 7bd63a145351bad21587fd1fec75ddafcaac68f6
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Sep 1 11:44:48 2003 +0000
+
+    Enable dithering and filtering for RGB modes instead of YUV modes.
+
+commit 23e412b8ce9c6fc86d8aa4c3d33f24f265290148
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 28 17:32:01 2003 +0000
+
+    Use the generic conversion routines for surfaces with DSCAPS_SEPARATED.
+
+commit c1db9e241e3701dd738c89254208973bf928c6b8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 27 17:43:25 2003 +0000
+
+    Call driver's SetOpacity() only if the opacity changed.
+
+commit b73abf5d2d7ba256cb3a457393b490efd8a0e786
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 27 17:42:00 2003 +0000
+
+    Call driver's SetScreenLocation() only if the location changed.
+
+commit 292839add3bac966386165e8d40539242f9b1cb5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 27 17:39:15 2003 +0000
+
+    Don't call dfb_window_init() for each IDirectFBWindow_Construct(),
+    but only for the first time.
+
+commit 67fb4661bb6704e9d54536bf1ac5b83eb3e99b72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 27 16:38:55 2003 +0000
+
+    Commented out assumption.
+
+commit ed6c1bf5292a2098b125eabd7001becbe6ae20c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 26 16:32:57 2003 +0000
+
+    Added some more exit points to the grabbing thread.
+
+commit d9482155ef4f59f552c74e30b32a12d7cfaf82b8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 26 16:29:12 2003 +0000
+
+    Don't support A8 destination on a G200. It doesn't support it as a source, too.
+
+commit 1bb2c3e3ebab26a3d25f571255032d24e40e9eef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 25 17:37:11 2003 +0000
+
+    Align glyph offsets to a multiple of four.
+
+commit 0063479f433f7bdb1cfbc47c652a279d15c9c13e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 25 17:27:37 2003 +0000
+
+    10% DrawString() boost by changing __u16 to __u32.
+
+commit d689e99d3068c243173b7cf11770af49419b2cab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 25 16:40:45 2003 +0000
+
+    Lookup color index for layer's background color.
+
+commit 2f697d6f809a9d555b062e8e33b03da455ff395e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 25 15:13:30 2003 +0000
+
+    Support DSCAPS_SEPARATED in dfb_copy_buffer_32(), too.
+
+commit d1b95d9d25e369eaa48a60346fdee2302c2b8820
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 25 14:43:00 2003 +0000
+
+    Support DSCAPS_SEPARATED in dfb_scale_linear_32().
+
+commit 4ff8d5fcf2327fccfb5439a01bc04914b9f48fd5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 21 17:57:41 2003 +0000
+
+    Don't optimize repaints for restacking.
+
+commit c4ff4c86f8c3f6ccf845ba3c726ff60026a1ae9e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 21 15:12:07 2003 +0000
+
+    Translate DIKI_KP_0-9 to DIKS_0-9 instead of DIKS_HOME etc.
+
+commit 1413fa17c1fae2534d3b457d90316fce3631b7cd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 20 07:38:53 2003 +0000
+
+    Added support for color keyed PNGs.
+    
+    Instead of converting an 8 bit palette PNG (with tRNS) to ARGB,
+    convert it to RGB and generate a color key.
+
+commit af70e6a23abec16acfc4e3b8c82677692828891e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 20 00:16:20 2003 +0000
+
+    Applied a great patch from Maurizio Monge <monge@sns.it>.
+    
+    When repainting the stack due to a window update, e.g. a Flip(),
+    skip those regions which are hidden by opaque windows above the window
+    that changed.
+    
+    This increases performance and reduces artifacts.
+    
+    Example: Terminal with tons of debug messages under opaque window caused
+    the opaque window to be updated, too, within the intersection of both windows.
+    
+    Another example: Run a fullscreen app in windowed mode, e.g. df_andi, and
+    see how frame rate increases as more of df_andi is hidden by opaque windows ;)
+
+commit 73f0ad283a03ed088557ebd556361317c421dceb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 19 18:25:19 2003 +0000
+
+    Fix warning for builds without MMX.
+
+commit d85ceab93ecd4827c81ccc4197844bf9897a756b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 19 10:45:49 2003 +0000
+
+    Set SBF_WRITTEN if hardware writes, too.
+    
+    Fixes garbage after VT switching (in case the surface has never been written
+    to in system memory and therefor was not properly restored).
+
+commit 9fafe00f378080fe74ecf779479b72179e986c28
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 19 01:15:51 2003 +0000
+
+    Fixed warning.
+
+commit 67785b48226cf23afc156c919777d612d5ba84a2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 18 20:15:44 2003 +0000
+
+    Don't automatically flip in SetOptions().
+
+commit 1d5052a2fb100c0f1781fc9d102e541ea6daca4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 18 17:27:30 2003 +0000
+
+    Added IDirectFBSurface::Dump(), e.g. for debugging.
+
+commit 7fdf409cd2f23d1f8a386e8caa1b049cf58edee5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Aug 18 14:35:12 2003 +0000
+
+    PIXEL_RGB24 is gone, use PIXEL_RGB32. memset() needs string.h.
+
+commit 748d8bf79a3d5a693f495d9087bd9ce3582b90c6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 18 12:40:14 2003 +0000
+
+    Added "-lm" to libmpeg3 module.
+
+commit e014db19a718da18743cb336e3a36a43be2a8bd3
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Aug 17 09:29:25 2003 +0000
+
+    use -module flag, which causes libtool to create mach-o "bundles" on darwin/osx
+    instead of dynamic libraries which cannot be dlopen()ed
+
+commit 1a30be08ea5c1c37fe8f1c339f64f029d5d753fb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 18:22:31 2003 +0000
+
+    non-debug apps in a debug session break shared memory assertions
+
+commit fa81c6583daf14c848e720ed5fc47614413fcf63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 15:58:30 2003 +0000
+
+    Updated.
+
+commit e44c645719565c4fd24ba0ab6369be46b6c1d12d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 15:56:05 2003 +0000
+
+    Enable key repeat.
+
+commit adced8db12eb1795865343bf22576d4b90f565ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 15:11:00 2003 +0000
+
+    Added the obligatory "other bug fixes" line ;)
+
+commit 34855e0345f501b223958db584a6610eacb95f49
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 13:48:05 2003 +0000
+
+    Updated.
+
+commit 15b67b79834af201cb81ceea477639e1eff80f9a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 13:04:46 2003 +0000
+
+    Added WM97XX Touchscreen driver,
+    thanks to Liam Girdwood <liam.girdwood@wolfsonmicro.com>!
+
+commit f487f74e1e8ca28ddcc66568b35994b3fb107196
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 11:59:12 2003 +0000
+
+    Increased timeout from 100 to 200 ms.
+
+commit 6817712e18fe545e8f47d01ede8681185ac29b06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 11:57:10 2003 +0000
+
+    oops
+
+commit 39b0c525540d88b5ee89304d529186e50e1e2e63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 15 11:39:13 2003 +0000
+
+    Call tracing has to be enabled via "--enable-trace" now.
+    
+    Show stack trace of all threads when a signal is received.
+    
+    Include <config.h> everywhere.
+
+commit 66eeb5c72ef3af8baa306b3c2c5409774e5626bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 14 16:06:57 2003 +0000
+
+    Fixed warning.
+
+commit b7b2a52cf15b74424e5b2d88f847df4a0029eb8d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 14 16:06:09 2003 +0000
+
+    Allow signal handler in slaves again.
+
+commit c667284cd84485ef00fdae1578dc39822ab81807
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 14 16:04:23 2003 +0000
+
+    Added new debugging method "dfb_debug_print_stack()" that dumps the current
+    stack trace. But it just includes functions that are compiled with the gcc
+    option "-finstrument-functions", currently all of DirectFB when --enable-debug
+    is used.
+
+commit 10b10d22a96e1b833f8f08f0be0e77ff00be3da3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 14 14:54:26 2003 +0000
+
+    Include <config.h> at least in all files depending on FUSION_FAKE.
+    
+    Switching single/multi app between builds should be working now.
+
+commit b40c289d517bd59fecb7add77f662869a81e9c4c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 14 00:42:18 2003 +0000
+
+    <Meta>-<Print> now stores the alpha channel of the window, too.
+    It's a pgm and is stored with the same file name except the extension.
+    
+    To convert from ppm/pgm to png do:
+    
+    pnmtopng -alpha dfb_window_0000.pgm dfb_window_0000.ppm > dfb_window_0000.png
+    
+    
+    Minor debug changes.
+
+commit 595818cdb1ec763cd075de26006883c7668463a7
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 13 17:39:42 2003 +0000
+
+    build pixelformat conversion utilities only on linux systems.
+
+commit 3390dcb2a4d10b96c20737c7591eb7619b300b69
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 13 17:34:49 2003 +0000
+
+    use setpgid() instead of setpgrp() to restore darwin and probably other BSD compatibility.
+
+commit 0afa6eb90431402d6024c8e23b07da46e9626687
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 12 12:10:36 2003 +0000
+
+    Added another lock check.
+
+commit 92907473feeefb43e5cc5601d59899150090f658
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 12 12:09:24 2003 +0000
+
+    Added a lot of necessary locks.
+    
+    IDirectFBDisplayLayer::GetWindow() is safe now, too. Was an urgent fixme.
+
+commit 70934ac3d6a89da84cfe5a59922127e66b93effc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 16:49:51 2003 +0000
+
+    Skip copying from system to video memory during auto video buffer upload
+    if the buffer has never been locked for write access.
+    
+    Enable upload of auto video buffers for write only GPU access, too.
+    
+    Speeds up surface create/clear/release cycles, nearly as fast as for video
+    only surfaces.
+
+commit 27dcc549b52e0bfffa377e65cf420abbce2d89c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 16:09:56 2003 +0000
+
+    Indicate if segfault has been cured.
+
+commit 4b9be667e85bb8e17a59b02a1383f05646ea3667
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 15:59:31 2003 +0000
+
+    Hot fixed rare segfaults which occur if a valid shared memory pointer is
+    derefenced but the address lies in a new region which hasn't been mapped
+    locally yet.
+    
+    Added "bool fusion_shmalloc_cure( const void *ptr )" which is called by the
+    signal handler to recover such segfaults by remapping the file immediately.
+    It returns true if the segfault is cured and the signal handler may drop it.
+    
+    This is a hack until there's a better solution, maybe via Fusion Kernel Device.
+
+commit bcb98df83ec26b6f85c3893fbbe40a78f42b025a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 13:23:33 2003 +0000
+
+    Show faulting address in case of SIGSEGV.
+
+commit c2d57d6eed7b5f2acda053760463f366951dcbc9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 13:22:49 2003 +0000
+
+    Converted assertion to assumption, added another assumption.
+
+commit db8969b35610232046ae1389f454eb5215705d56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 13:20:04 2003 +0000
+
+    Added debug messages to __shmalloc_brk() and __shmalloc_react().
+
+commit 50afa6f82552d29fc7a7573c375015614af65045
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 11 10:19:35 2003 +0000
+
+    Fixed button events, thanks to Tim Wright <tim.wright@iosystems.co.uk>.
+
+commit 960473810e39d9ba24233454e2a444edcd266cf3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 23:17:03 2003 +0000
+
+    Removed a caution message.
+
+commit 1a4895b0ec854bc41b4318c04686a47ee5760beb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 23:10:58 2003 +0000
+
+    Block signals in slave threads and fusion read (master & slave) thread, too.
+    
+    Enhanced debug, minor cleanup.
+
+commit 92855f15661bd23324283d377c4d8bbe2e9fb8a6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 21:52:49 2003 +0000
+
+    Cleanup, enhanced debugging and safety.
+
+commit 8683c48420d5f20b39cd649c1c16eb80552764b3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 19:39:29 2003 +0000
+
+    Waiting for pthread_create is required, but it's done later now.
+
+commit ec9ec6272838f49a8fb4fe01b7fd70329fb73b3c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 19:10:27 2003 +0000
+
+    Create a new process group early during initialization.
+    
+    Send SIGTRAP to process group leader instead of the calling process
+    in DFB_ASSERT and DFB_BREAK. Otherwise the signal would be blocked
+    if the assertion or break happens in a thread, e.g. an input thread.
+    
+    Call pause() after sending the signal, otherwise execution continues
+    until the signal is caught.
+
+commit 1453745874d5e9d62ff78baa5d7acdb082c60171
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 18:16:47 2003 +0000
+
+    Use pid instead of pthread id in debug messages.
+
+commit fd7080b1a71f7d435547a2a6ce3607eb6d7a7ab4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 8 18:10:16 2003 +0000
+
+    Added DFB_ASSUME which is like DFB_ASSERT, but doesn't send SIGTRAP and
+    has "(?)" instead of "(!)" at the beginning of the debug message.
+    Failing assumptions are not fatal. They can be used to unveil unusual
+    behaviour, e.g. dfb_thread_join() called while already joining/joined.
+    
+    Optimized creation of new threads by not waiting for pthread_create completion
+    in spawned threads. Also don't enter the main routine after initialization if
+    another is already joining. This is useful if DirectFB is initialized, but
+    deinitialized shortly after. In this case the fusion_read_loop() is not entered.
+    
+    
+    On a P3 800E with only fbdev (systems) and matrox (gfxdrivers) installed I did
+    
+    "while true; do dfb_init_deinit &> /dev/null; done"
+    
+    where 'dfb_init_deinit' (slave) just calls DirectFBInit/Create/Release.
+    This results in about 170 iterations per second and looks like 5.8 ms for a
+    complete init/deinit for slaves, but bash is consuming a lot of CPU, too.
+    
+    Debug messages show that a complete DirectFBInit/Create/Release (as a slave)
+    takes 3-4 ms ;)
+
+commit 93a3e94a69897239f4610b5cb399bf14b4f4a470
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 16:46:19 2003 +0000
+
+    Check desc.width and desc.height for being positive in CreateFont().
+
+commit 640d8d255bdbce4bb39a8d83abe9f171123cde4d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 16:42:11 2003 +0000
+
+    Added error handling to glyph surface creation.
+
+commit cf85555e82c93ec26ec51a7d78057aa9a62c3b0d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 16:26:38 2003 +0000
+
+    Added some assertions and argument checking.
+
+commit 4c26f3dcaa8242afbe4d770bb2171bcf634e864f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 16:05:27 2003 +0000
+
+    Don't filter all print keys.
+
+commit 5ee697e6b0e59f961abf7e47bf8acbcf0a40081e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 16:00:20 2003 +0000
+
+    Added <Meta>-<Print> hot key to make a screenshot of the focused window ;)
+    
+    Added dfb_surface_dump() which is used for screenshots now, replaces static
+    function dump_screen() and will store the alpha channel to an extra pgm soon.
+
+commit 7bf4f7ad0f405e98e85afa9c998a249448043eac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 7 00:46:50 2003 +0000
+
+    Check if the font is already set in IDirectFBSurface::SetFont(),
+    saves just a few CPU cycles though.
+
+commit 05de94bd9be5d4d52306f3fe7d22420d453fa236
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 6 17:52:20 2003 +0000
+
+    New environment variable "DFBARGS" is now parsed
+    like everything after "--dfb:" on the command line.
+    
+    New order:
+    
+    system       /etc/directfbrc
+    user         <home>/.directfbrc
+    system/app   /etc/directfbrc.<app>
+    user/app     <home>/.directfbrc.<app>
+    
+    environment  $DFBARGS
+    
+    command line
+
+commit e3137b83b254ddfc8740cada13b01159bc3ee8b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 4 19:09:28 2003 +0000
+
+    Need long long.
+
+commit 6fd06aa07fc046fa25b2db1ad87f29f969a2e519
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 4 19:00:13 2003 +0000
+
+    Reject very large surface creations (> 4096*4096 pixels).
+
+commit 39368f0436ec7267eae8432c1d482a8340a507fc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 4 18:39:03 2003 +0000
+
+    DWOP_SHAPED support for color keyed windows,
+    thanks to Maurizio Monge <monge@sns.it>.
+
+commit cd5c4b8b34b3f15bf314648a56ce7e206b13fa0a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 2 19:35:40 2003 +0000
+
+    Added IDirectFBEventBuffer::WakeUp().
+    
+    Wakes up any thread waiting for events in this buffer.
+    This method causes any WaitForEvent() or WaitForEventWithTimeout() call
+    to return with DFB_INTERRUPTED.
+    This method should be used rather than sending wake up messages which
+    may pollute the queue and consume lots of CPU and memory compared to
+    this 'single code line method'.
+
+commit c1282ad0a2dc5613d67c9f0b5546245c542d7cfd
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 29 13:05:13 2003 +0000
+
+    version number 0.9.19+0.9.20WIP-1
+
+commit 771162e2b83d0079f21f1a7d773301d7067f8946
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 29 04:00:11 2003 +0000
+
+    Fixed non-x86/ppc builds.
+
+commit c85bc934af9604c65f01c7bb9a4218a91bea4822
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 29 03:46:37 2003 +0000
+
+    Don't segfault in slaves if no graphics driver is used by the master.
+
+commit dc421ed0b976aa61d92892f8a36ef8caf18d59cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 20:53:13 2003 +0000
+
+    Added "memcpy = <method>" option to save a lot of startup time.
+    "time dfbinfo" went from 0.080 secs to < 0.010 secs!
+
+commit b849e25a6475473a4691f61caa1acc979a15b485
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 19:36:47 2003 +0000
+
+    0.9.20 looks fine.
+    
+    Updated copyright in banner.
+
+commit 5d39a6da0a02907f568d141ba93a1687ca23879a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 18:44:16 2003 +0000
+
+    Include URL http://www.linuxbase.org/spec/gLSB/gLSB/libpthread.html
+
+commit 5edaaaf1ff9290a45229b1c12cc88b9b51f1d1a1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 18:40:26 2003 +0000
+
+    Added:
+    
+    
+    LSB violations (from http://www.opengroup.org/personal/ajosey/tr28-07-2003.txt)
+    -------------------------------------------------------------------------------
+    
+    215 Applications must disconnect from the controlling tty before calling
+    216 pthread_create.
+    
+    225 Threaded applications cannot use SIGUSR1 or SIGUSR2.
+
+commit 351431ada9916c90ba680432f31fa36e2a04f5cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 14:21:52 2003 +0000
+
+    Added DWOP_SHAPED that adds shape support to cursor movements,
+    i.e. ignore the window if alpha is zero at the cursor location.
+    
+    This is based on a patch by Monge Maurizio <monge@linuz.sns.it>, thanks!
+
+commit 2f729c9cc1ba11c4c43f4af7b666e4d2a594a347
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 13:47:39 2003 +0000
+
+    Restore layer opacity during resume.
+    
+    This way one can switch to the linux console and do "dfblayer -l 1 -o 0"
+    to disable the Matrox BES or any other overlay if it covers the whole
+    screen and makes the session unusable. But "fbset -accel false" might
+    be needed on that console.
+
+commit 7d312dd530d5a89a54dd51f835d0250c758abfc2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 28 12:01:54 2003 +0000
+
+    Fixed undeclared "dfb_fbdev" for builds with FBIO_WAITFORVSYNC defined.
+
+commit fab9fef07740ea23371d0f773057db10a99b1f32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 25 12:47:23 2003 +0000
+
+    Have fusion-full-linux-2.60-test1.patch.bz2 in EXTRA_DIST.
+    
+    Remove old and broken patch.
+
+commit 753862e12a9f518226b74fdcfe5eafc0304a3928
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jul 24 11:44:48 2003 +0000
+
+    working patch for 2.6.0-test1 (support new internal devfs api)
+
+commit def4946a0eb8339166c9cd2d706946a72f911a7e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 23 14:36:19 2003 +0000
+
+    Don't show "make" message if configure failed.
+
+commit a90237e4f3803c59884ddc4969cc86f5893119c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 21 12:00:02 2003 +0000
+
+    Updated.
+
+commit a1927e4e9551046da4a21d326feae196d2931381
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 21 11:24:21 2003 +0000
+
+    Removed automake -ldl issue.
+
+commit f8679858acf44b8551051952dfeb972f4720efe9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 21 10:57:10 2003 +0000
+
+    Do not cover the whole screen by default.
+
+commit 571c2c1a9150fd8f67281911a868d008f4f92e20
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 21 10:55:02 2003 +0000
+
+    Added parameter for opacity changes. Also useful to disable an overlay.
+    
+    Show layer options in configuration dump.
+
+commit 13e834b74cb35711dc071beaa5e48001cb757fed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 16 16:28:05 2003 +0000
+
+    Moved min_toleration to shared manager data.
+
+commit a88097485ec3cbbe0fd5bac5fc3bbe91f9241fc6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 16 03:55:06 2003 +0000
+
+    Cleaned up debug messages.
+
+commit 931bf8281416b9050e94f624f4f6c9fba7aef853
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 16 03:05:44 2003 +0000
+
+    Removed "soft lock" hack that just increased the lock counter.
+    
+    Use dfb_surface_hardware_lock() now as we can maintain the lock until
+    the video is stopped.
+
+commit 6061bc28321bb1c29af3067791061c99b5108da8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 16 02:49:09 2003 +0000
+
+    Removed front and back buffer locks from surface.
+    Locking is provided by the embracing surface manager lock.
+    
+    This saves two system calls per drawing operation and even four system
+    calls per blitting operation.
+    
+    Locking a surface won't block anymore. Currently any number of
+    concurrent read/write accesses by cpu/gpu are allowed.
+    Locking is a way of pinning the surface buffer to a pool.
+    The hardware lock fails if the system memory instance is locked.
+    
+    
+    Check the benchmarks, some values nearly doubled ;)
+    
+    BEFORE
+    
+    Benchmarking with 1x1 in 16bit mode... (16bit)
+    
+    Anti-aliased Text                              3.00 secs (  626.97 KChars/sec)
+    Anti-aliased Text (blend)                      3.00 secs (  633.18 KChars/sec)
+    Fill Rectangles                                3.00 secs (    0.14 MPixel/sec)
+    Fill Rectangles (blend)                        3.00 secs (    0.13 MPixel/sec)
+    Fill Triangles                                 3.00 secs (    0.06 MPixel/sec)
+    Fill Triangles (blend)                         3.00 secs (    0.06 MPixel/sec)
+    Draw Rectangles                                3.00 secs (  128.37 KRects/sec)
+    Draw Rectangles (blend)                        3.00 secs (  125.77 KRects/sec)
+    Draw Lines                                     3.00 secs (  737.33 KLines/sec)
+    Draw Lines (blend)                             3.00 secs (  718.00 KLines/sec)
+    Blit                                           3.00 secs (    0.10 MPixel/sec)
+    Blit colorkeyed                                3.00 secs (    0.10 MPixel/sec)
+    Blit with format conversion                    3.00 secs (    0.12 MPixel/sec)
+    Blit from 32bit (alphachannel blend)           3.00 secs (    0.09 MPixel/sec)
+    Blit from 8bit palette                         3.00 secs (    0.11 MPixel/sec)
+    Blit from 8bit palette (alphachannel blend)    3.00 secs (    0.09 MPixel/sec)
+    Stretch Blit                                   3.24 secs (   99.88 MPixel/sec)
+    Stretch Blit colorkeyed                        3.23 secs (  100.16 MPixel/sec)
+    
+    
+    AFTER
+    
+    Benchmarking with 1x1 in 16bit mode... (16bit)
+    
+    Anti-aliased Text                              3.00 secs (  675.60 KChars/sec)
+    Anti-aliased Text (blend)                      3.00 secs (  677.32 KChars/sec)
+    Fill Rectangles                                3.00 secs (    0.17 MPixel/sec)
+    Fill Rectangles (blend)                        3.00 secs (    0.16 MPixel/sec)
+    Fill Triangles                                 3.00 secs (    0.07 MPixel/sec)
+    Fill Triangles (blend)                         3.00 secs (    0.07 MPixel/sec)
+    Draw Rectangles                                3.00 secs (  168.70 KRects/sec)
+    Draw Rectangles (blend)                        3.00 secs (  159.00 KRects/sec)
+    Draw Lines                                     3.00 secs (  833.00 KLines/sec)
+    Draw Lines (blend)                             3.00 secs (  809.33 KLines/sec)
+    Blit                                           3.00 secs (    0.15 MPixel/sec)
+    Blit colorkeyed                                3.00 secs (    0.15 MPixel/sec)
+    Blit with format conversion                    3.00 secs (    0.21 MPixel/sec)
+    Blit from 32bit (alphachannel blend)           3.00 secs (    0.16 MPixel/sec)
+    Blit from 8bit palette                         3.00 secs (    0.20 MPixel/sec)
+    Blit from 8bit palette (alphachannel blend)    3.00 secs (    0.15 MPixel/sec)
+    Stretch Blit                                   4.41 secs (  110.36 MPixel/sec)
+    Stretch Blit colorkeyed                        3.14 secs (  103.09 MPixel/sec)
+
+commit 0031ed38aaa3079dc9648cc37489a7e842120699
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 16 02:11:27 2003 +0000
+
+    Removed dfb_surface_destroy() from exported API. Destroy surfaces
+    in the destructor only. Saves a skirmish and some code.
+
+commit b602b630a2749a338dabcd6ffd2054bb7adfa3e3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 15 05:28:10 2003 +0000
+
+    Wrote generic enum to string table conversion script used for key symbols,
+    key identifiers and pixel formats.
+
+commit 4175cb431e34036df58414464efb308f640ff9f8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 15 01:49:51 2003 +0000
+
+    Added buffer mode changing.
+
+commit 4a114eb6b92f3ecae88f421c9decd586d231e92c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 14 17:22:18 2003 +0000
+
+    Added "dfblayer", a display layer configuration tool.
+    
+    Added generation of pixel format names into the new directfb_strings.h header.
+
+commit 93e88d3ca68130bbf54a8c375253fa90bda685ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 14 16:18:02 2003 +0000
+
+    Added DLCONF_NONE = 0.
+
+commit 7aa02fba8d0ed92e0016e62588cac69683fc1c1d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 14 15:19:55 2003 +0000
+
+    Fixed "primary-layer" option for the master.
+
+commit b93ef403fb0387279c661aa43c1442bc5e1c48a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 13 22:26:17 2003 +0000
+
+    Platform independent radeonWaitVSync() by Michel Dänzer <michel@daenzer.net>.
+
+commit ef14c095e2af8824530bcc61534ea4f427da93d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jul 12 17:34:09 2003 +0000
+
+    This is the initial version of a Radeon acceleration driver by
+    Michel Dänzer <michel@daenzer.net>, great thanks!
+    
+    <quote>
+    I've tested the driver on an M9 in a PowerBook and a Radeon 7200 in a
+    Cube. It's based on the ati128 driver, but has only basic acceleration
+    so far.
+    </quote>
+
+commit 62f285f9e40991ca984e995654819ba7c0f2da37
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 11 20:24:43 2003 +0000
+
+    Fixed "primary-layer" option for fullscreen applications.
+
+commit b9a943d05406e69078055a48664a459597af002c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 11 20:15:25 2003 +0000
+
+    Added option "primary-layer=<id>":
+    
+    Selects which layer is the "primary layer", default is the first.
+    Check 'dfbinfo' for a list of layers supported by your hardware.
+    
+    All fullscreen and windowed applications should run with this,
+    for the application the first and the primary layer are swapped.
+
+commit 2c99152e4f2b48b38421ce7f26d19da4fa9cc03b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 11 18:57:28 2003 +0000
+
+    Fixed dead lock due to thread safetiness added recently.
+
+commit f92302138cc8726e1b877b680f4bb93df2ce7b80
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 11 16:57:06 2003 +0000
+
+    Made implementation thread safe.
+    
+    Fixes assertion when implicit (by surface listener) and explicit (by ::Stop())
+    v4l_stop() calls are running simultaneously.
+
+commit 01d13bf2b53fb8dc8b1d74b448708e601e46d4e0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 11 15:07:39 2003 +0000
+
+    Don't handle enter/leave/focus while the builtin wm hack is active
+    (e.g. during resize via <Meta>-<Ctrl> and mouse).
+
+commit 03e750905ebf6478524b8331e169bada0f9f7eb5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 10 17:37:30 2003 +0000
+
+    Work around a bug in the DVB kernel driver (more likely) or the DVB hardware.
+    When using buffers with a pitch much higher than the width suggests (e.g. using
+    DSCAPS_STATIC_ALLOC and downsizing), the lower part of the video is cut off.
+    
+    -          b.width = surface->width;
+    +          b.width = buffer->video.pitch / ((bpp + 7) / 8);
+
+commit 44cec7458b19ae60f2e3f66630cc85ec4d01e6ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 10 17:11:28 2003 +0000
+
+    Stop the video playback if the size or format of the surface changed.
+    
+    Fixed dead lock between overlay thread and surface listener calling v4l_stop()
+    by adding additional break points to the overlay thread. Only 99.999% safe,
+    but the v4l code should be rewritten anyway.
+
+commit 676e3197fe73b8f6bab9587aa0018f872107cd5a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 10 09:36:53 2003 +0000
+
+    Don't include "-ldl" if linking statically.
+
+commit 7ffbd9c84fc4a6d53f287016200a18d66d633f81
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 10 00:22:18 2003 +0000
+
+    New patches.
+
+commit d9843e7ae2518bc8e69d8acbef9f76647572a71a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 10 00:17:35 2003 +0000
+
+    Drop bone collector threads completely, which have been three per session.
+    
+    Use new fusion_ref_watch() instead of creating a bone collector thread for each
+    object pool where each thread polled all references ten times per second:
+    
+    1) Create a FusionCall in fusion_object_pool_create() with the pool being the
+    call context pointer.
+    
+    2) Call fusion_ref_watch() in fusion_object_create() after increasing the
+    reference counter to one. Specify the call created with the pool, pass the
+    object id as the call argument.
+    
+    When the call handler is executed (in the pool owner's messaging thread) upon
+    zero reference, it gets its pointer to the pool (call context) and the id of
+    the object (call argument). The handler looks for this id and calls the object
+    destructor if the id has been found and the reference counter is still zero.
+    
+    
+    This has several advantages for single and multi app core:
+    
+    - Removed three threads from master (window, surface and palette pool).
+    - No more polling of each object's reference counter ten times per second.
+    - Objects are destructed nearly immediately (even a direct call in single app).
+    - Less shutdown time (100-200 ms or more waiting for sleeping bone collectors).
+    
+    The same applies to FusionSound with two object pools (buffer and playback).
+    
+    
+    Commented out debug message for key events.
+
+commit 3cee608af1af0107e1d47268670558e23ff9f321
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 9 15:43:08 2003 +0000
+
+    Added missing free of root data (allocated once per session).
+    Moved shared memory leak dump into shared memory deinitialization to
+    show leaks after the our last free, no leaks left ;)
+
+commit bfb471d66ac0d188a2aa14192a2388e0f854d219
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 9 15:14:57 2003 +0000
+
+    Do not cancel the fusion read loop thread, but send ourself a message.
+
+commit 718f76451604ca6a7d25059093fbde0d77daf856
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 9 14:59:09 2003 +0000
+
+    fixed a typo
+
+commit 8ddbc32997b728307b1a4185e1733ec8d8378138
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 21:05:06 2003 +0000
+
+    Fixed multiple free during destruction of the window stack (grabbed keys).
+
+commit 1415a628c01d2cffd7b9674e9bf192123b6144c0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 20:37:57 2003 +0000
+
+    Added the same debugging facility for shared memory as for local memory.
+    The master shows during shutdown which chunks in the shared memory are
+    still allocated.
+
+commit 75d0bbe326639e275101a113b5ed7213b87d174a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 20:28:20 2003 +0000
+
+    Fixed typo for single app.
+
+commit 356521bf569414139db3d9ed9c6c83256276728e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 20:10:19 2003 +0000
+
+    Removed invalid assertion.
+
+commit b779d782d321bf4cb922efaa79dc7121a1889638
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 17:54:55 2003 +0000
+
+    Use ERRORMSG instead of DEBUGMSG before sending SIGTRAP.
+
+commit 3d61a1b89664562a0c7bb9b5add5952c58d1e4f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 17:54:38 2003 +0000
+
+    Added many assertions, most of them for the fusion file descriptor.
+
+commit ec5b7967bb614dc81d31f50ee95c4e2996ba7c7e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 17:14:13 2003 +0000
+
+    Removed obsolete prototype.
+
+commit 82cdf8f03ad44c0203b653d1040b0d3a6edb3219
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 16:55:30 2003 +0000
+
+    Use dfb_memmove() and dfb_memcpy().
+
+commit 84935169e85b57bc10ae4892ec0d5b4a84e48cb4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 16:37:23 2003 +0000
+
+    Cleaned up pixel conversion stuff.
+
+commit 4f6663a446bb42617e395c7b7c9b8bb58f19890c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 15:37:04 2003 +0000
+
+    Show number of bytes allocated for each chunk in final allocation debug output.
+    
+    We don't need PAGE_SIZE.
+    
+    Cleaned up some includes.
+
+commit 976469d99c64a05aadd686c64964e064eb09a00f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 15:09:46 2003 +0000
+
+    Use dfb_memcpy() everywhere.
+
+commit 3d10bd92dd701a04336c88037ed3d4abc2ed8a55
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 14:41:29 2003 +0000
+
+    Documented clipping header.
+    Use DFBBoolean instead of int.
+    Use DFBEdgeFlags instead of unsigned int.
+    Split up dfb_clip_rectangle() into dfb_clip_edges() and a simpler
+    version still named dfb_clip_rectangle().
+
+commit cd671a1f0793aad1c5cdf432c20a6abe61a03e54
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 8 13:48:26 2003 +0000
+
+    Right patches now.
+
+commit e2017f228fa55337c9612d1f2a432f692f2daa17
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 18:04:25 2003 +0000
+
+    FusionCallHandler is always declared here, now.
+    
+    Update linux/fusion.h or get multiple definitions.
+
+commit 67ba3f518c778f64f2426b11fe6db8b1afe4b8c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 17:44:07 2003 +0000
+
+    Made mutexes used by fake mode (single app) recursive.
+
+commit f3002fc75d18091d4b3e7d9cb967c86cc22d761f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 17:25:36 2003 +0000
+
+    Further single/multi compatibility.
+
+commit d1db40d82a3316591120c378ceaf3a2267641e63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 17:07:26 2003 +0000
+
+    Forgot fusion_is_shared() in single app core.
+
+commit 80b45479703a84ddf14a98c8f3e4d7d9b6e1774b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 16:37:53 2003 +0000
+
+    Made single/multi app core binary compatible for drivers and other modules,
+    in addition to the single/multi app binary compatibility for applications.
+    Running a multi app libdirectfb with single app modules and vice versa is
+    possible, now.
+
+commit f4c1d67ef479952a702a0644bfb4824d58f16fb6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 14:50:31 2003 +0000
+
+    First entry sounds nicer now.
+
+commit f776a3b1e3850940c01af54654ad461b5d0d7672
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 14:48:16 2003 +0000
+
+    Wrote summary for 0.9.19 which looks like a major multi app enhancement.
+
+commit e07394060fba47f7a7b0209ffca46633ee94b4be
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 7 13:24:02 2003 +0000
+
+    Set DWOP_ALPHACHANNEL automatically upon window creation only for DSPF_ARGB.
+
+commit a3ddb36051d2b450dfebeda71c77231cf0997ce3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 4 17:30:22 2003 +0000
+
+    Added "moduledirname" to pc file which is "moduledir" without libdir.
+
+commit bec28d3924041b915795718091f5c2dc661f3803
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jul 4 12:49:23 2003 +0000
+
+    respect --disable-sse and skip checks for SSE support
+
+commit 2cdd96d14ee5ffab10bc74847f776282488c4ae1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 16:36:13 2003 +0000
+
+    Fixed many warnings produced using "-std=gnu99 -pedantic".
+
+commit e2bd9aef0b206016ada6701fa9ac6d35bfe2bb45
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 15:11:51 2003 +0000
+
+    Reverted making a function static that really should be exported.
+
+commit a9698c2989d802508a96cb9e0ccc4aea7cbd9300
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 07:35:49 2003 +0000
+
+    Added "-ffast-math".
+
+commit 97d178b9fa211e19bff30f30f654330fc47161ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 05:00:39 2003 +0000
+
+    Avoid discarding qualifiers.
+
+commit 7119afe4e809b57f2793abcf72ab9a8ecb887d49
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 04:54:37 2003 +0000
+
+    Removed option to disable RGB332 support, it has no impact anymore
+    and having such a switch for one format only looks odd.
+
+commit c0c3c1b4d4e71a9d4ef597278a64bc4214db3e87
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 04:40:24 2003 +0000
+
+    Added configure option "--enable-extra-warnings" adding:
+    
+    -W -Wno-sign-compare -Wno-unused-parameter -Wundef -Wcast-qual
+    -Wcast-align -Waggregate-return -Wmissing-declarations -Winline
+    
+    
+    Fixed tons of warnings, most of them were related to qualifiers,
+    some were aggregate returns, some other...
+
+commit 61af1ed23be541abfd94c5e826bb1ae3796b1111
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 02:13:38 2003 +0000
+
+    Don't discard qualifier in cast.
+
+commit c7cb0d6c89dd55fd5ac796b331132c07a6d672cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 2 00:15:02 2003 +0000
+
+    Destroy CoreThread structure after joining.
+
+commit c98305f3bc3cf66148d7d3514b95aded71ee0819
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 19:48:02 2003 +0000
+
+    On <Meta>-X do not only switch the focus but also leave the window under
+    the cursor if it's not the focused one. This is the behaviour of RequestFocus()
+    and causes the focus to return to the window under the cursor on any cursor
+    move or window resize.
+
+commit 8b9de1d286d6b83f88c2ab759146b327a31837b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 19:40:07 2003 +0000
+
+    Simplified forward declaration macro for interfaces.
+
+commit e85c552ce04c14313b56952f0887fbb2ae955905
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 04:39:44 2003 +0000
+
+    Honor opaque region even if opacity is < 0xff or color keying is used
+    (just turn off alpha channel blend for that region but keep other things).
+
+commit 8dc875c6cd540f9266dbc11afaa09dad87fe3511
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 02:54:10 2003 +0000
+
+    Do not probe graphics drivers as a slave, but load the running one.
+
+commit 1557811458c0156dcd30696553f37a0380fb3f79
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 01:58:38 2003 +0000
+
+    IDirectAudio -> IFusionSound
+
+commit 1fe6d2b1eb039780713a3de5b22921f38d23b038
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 01:01:35 2003 +0000
+
+    Added "tmpfs" option.
+
+commit 734802002d1f1b2b7aead9ba78cfed98e2c301e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 1 00:31:32 2003 +0000
+
+    Reject tmpfs mount points with less than 4 MB of free space.
+
+commit b442a1603099e08716399f3d894d6eb8c3c04cbf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 30 23:54:22 2003 +0000
+
+    Moved all global variables of the software driver to a new struct called
+    GenefxState. Genefx (pron. 'genie facts') is the new name for the virtual
+    GPU being emulated.
+    
+    For each CardState a GenefxState is allocated the first time the software
+    driver is used with this state. It gets freed when the CardState is destroyed.
+    
+    Removed global software driver mutex, doubles software driver performance
+    when multiple threads are rendering on an SMP machine.
+    
+    The pipeline parts are called GenefxFunc instead GFunc now. These functions
+    get a pointer to a GenefxState now. Nothing else outside is referenced.
+    
+    Surprisingly or not, the software only got faster though much dereferencing
+    of GenefxState pointers is done. I guess removing the mutex and avoiding
+    the global offset table made it faster.
+    
+    FillRectangle(1x1) throughput got increased by ~16% on my P3 800 E.
+    
+    This change was necessary to modularize pixel formats.
+
+commit 51f88eca40a0736b544cfd975b0634eb50d54619
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 30 16:44:33 2003 +0000
+
+    Fixed patches.
+
+commit 19a8cbbc323f2537ef467d4eaecb297e364f80b8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Jun 27 22:25:06 2003 +0000
+
+    cleanups for cvs debian packages, removed udeb stuff
+
+commit 2b63a3b8a60f138739e8c89ae1a6ab9cd3a56170
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 20:40:33 2003 +0000
+
+    Handle enter/leave/focus if a window is resized.
+
+commit 9de75b23b9cec2df1d593bce05e50fd4f56d9a2b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 19:44:29 2003 +0000
+
+    Don't focus the window under the cursor when releasing caps-lock or meta.
+
+commit 074712388568fe3b8225de34a1408b2d8e9df62c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 17:19:46 2003 +0000
+
+    Added timestamp to window events.
+
+commit 7a818974ae41b46a305ae308ede8eaf880832afa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 14:28:49 2003 +0000
+
+    #define _GNU_SOURCE
+
+commit f37ad7a97be2971bc262b9a8b51fc7ab9a660c6a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 27 13:46:51 2003 +0000
+
+    cleaned up include order
+
+commit 274695f487a9a87709093010ec64d8fb2cc43234
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 13:11:23 2003 +0000
+
+    Added 720x576 50Hz.
+
+commit 71f13cb17d8c82a876f890ad2292dde4d5d96e68
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 12:36:45 2003 +0000
+
+    Fixed -Werror-implicit-function-declaration[s] <- removed this character
+
+commit 065e83f29fae9e0966f0dedd7acf8c5b6d982272
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 27 11:15:56 2003 +0000
+
+    Added "-lm".
+
+commit 51f316eb6cb6182bd5160ce6a607d7d9a1f27e15
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 26 15:48:15 2003 +0000
+
+    Made fusion debug/error messages look like DirectFB's again.
+
+commit 19d8455284d2416faf96daec35503f3d81b20e3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 26 13:49:43 2003 +0000
+
+    Added DFB_BUFFERTOOLARGE.
+
+commit 1d0e29c6481811281fa87403b490245b51da17e7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 25 13:30:57 2003 +0000
+
+    Fixed static gif provider linking if specified as lowercase.
+
+commit 6cac8fb729f8e12610d0ba41b25a36bc0d718ba1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 25 13:10:30 2003 +0000
+
+    Fixed static-only builds with -j2 or higher.
+
+commit 8e4fb0c0f6d54084fc1aaf6ddf7d5bec04b1f5c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 24 14:41:12 2003 +0000
+
+    Don't cancel the v4l thread, but just indicate it should stop after this frame.
+    
+    This avoids dead locks caused when the thread is canceled while it's calling
+    the frame callback.
+
+commit 7d390bf0f73d15fa47a9af4e9cb0af628ee4c374
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 20 10:42:54 2003 +0000
+
+    Changed James Su's email address to suzhe@turbolinux.com.cn.
+
+commit c7ba3c60b803dfecc3fb51485aeb96400907a101
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 19 19:08:56 2003 +0000
+
+    Added "fake arena" for single app builds of DirectFBGL and DirectAudio.
+
+commit 47b6160ee4d39249ba09788c915d9c38378f5c5e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 18 15:08:26 2003 +0000
+
+    If fusion_arena_exit() is called without a pointer to a leave method,
+    it refuses to leave the arena and return an error instead.
+    This way a master can wait for slaves to leave before shutting down.
+
+commit a70e3123c09e731071b6e82f36a768f1a549690c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 18 14:05:56 2003 +0000
+
+    Added dfb_get_micros().
+
+commit 1efc92da25a2f446b5537bea4b67b9b9458e26e2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 18 10:45:39 2003 +0000
+
+    Added IDirectFB::GetInterface() that loads interface modules not starting with
+    "IDirectFB". This is a preliminary way of loading extensions and other Fusion
+    based libraries, e.g. "IDirectAudio" offering another bunch of new interfaces.
+    
+    Removed "object methods" fusion_object_ref(), _unref(), _link(), _unlink(),
+    _attach(), _detach(), _attach_global(), detach_global() and _dispatch().
+    
+    Added an "object methods" template macro using a special object type and
+    method prefix, e.g. "dfb_surface_ref( CoreSurface *object )" etc.
+    
+    Replaced "object methods" dfb_surface_*, dfb_window_* and dfb_palette_* by
+    FUSION_OBJECT_METHODS(CoreSurface, dfb_surface) etc.
+    
+    Added fusion_list_foreach_safe() acting like fusion_list_foreach()
+    but allowing to remove or free the current element.
+
+commit a9f66e8ffc7dc04c0d8e3704ad285eb9d3a93a0c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 17 15:05:36 2003 +0000
+
+    Added window manager key 'E' to focus the window under the mouse cursor.
+    
+    Useful in this situation:
+    - Have an X11 window under the cursor.
+    - Have a DFBTerm on top of the X11 window.
+    - Switch to the DFBTerm via <Meta>-X.
+    - Switch back to the X11 window via <Meta>-E instead of abandoning (lower)
+      the DFBTerm via <Meta>-A or moving the mouse out of and back into the
+      X11 window.
+
+commit 3e4bf767e2153dfbb7fdf9fa71aa9b971d936180
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 16 21:33:12 2003 +0000
+
+    Don't fill background of primary layer with the background color if a
+    background image is loaded anyways. Nicer startup of new sessions with bg-image.
+    
+    Display session uptime in dfbdump.
+
+commit 3de42c762771012049b4b98fa97577dfe8523307
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 16 20:03:38 2003 +0000
+
+    Automatically unset SDL_VIDEODRIVER if it's "directfb",
+    which doesn't work if DirectFB is running on SDL itself.
+
+commit 7c8e91812940c7b0605deb880a37bff9eae43af5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 16 19:21:05 2003 +0000
+
+    Fixed "make clean" if man2html is not present.
+
+commit 8400a00da3ee848115888245d0fef78fb19f5cc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 16 17:50:33 2003 +0000
+
+    Updated, too.
+
+commit 39dae2efce95e3683a85a7d2948ecd0ffe9e3248
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 16 17:47:05 2003 +0000
+
+    Added support for multiple multi application worlds.
+    
+    Added option "session=<num>":
+    Selects the multi application world which is joined or created.
+    Starting with zero, negative values force creation of a new
+    world using the lowest unused session number. This will override
+    the environment variable "DIRECTFB_SESSION".
+    
+    Shared memory initialization looking for "tmpfs" looks for "shmfs", too, now.
+
+commit 57523553df09eadb177da0d3b8c696f02b4ae0ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 12 20:01:16 2003 +0000
+
+    Lock surface manager before software driver lock to avoid dead locks
+    when gAcquire() is entered with the surface manager lock already held,
+    e.g. each dfb_back_to_front_copy().
+
+commit 02c63c94b91dd4a714f74df730c8b3fd6821386b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 12 18:23:39 2003 +0000
+
+    Don't ungrab explicitly grabbed keys of a window when its opacity gets zero.
+
+commit 01b41de31054a58f4d5e9ac89ab45deee06e2e96
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 12 15:40:58 2003 +0000
+
+    Added note about font sharing and run time single/multi app core selection.
+
+commit b07d99b86e5b7b44005fe810014ab221a4aa0eb6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 12 13:44:48 2003 +0000
+
+    Don't switch cursor on during close of keyboard device, but during shutdown.
+    
+    This results in better looking VT switching.
+
+commit 1934c853ec9cdf2146f1046f38f50a552e708f89
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 21:55:29 2003 +0000
+
+    Print a warning when a video only buffer is locked by software during suspend.
+    
+    Call dfb_surfacemanager_assure_video() in dfb_surface_hardware_lock() for
+    video only surfaces, too. To have it fail during suspend.
+
+commit 4572ea45a16ea42a8535cabaf1d86a74d7bbdfb9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 20:53:58 2003 +0000
+
+    Got rid off global variables exported by modules (dfb_fbdev, dfb_vt, dfb_sdl).
+
+commit 26e65b865faba5e7b3231720ae101b2e6f7013db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 20:03:47 2003 +0000
+
+    Updated modification time.
+
+commit b729cecd32d1ce2cfebaf6a3bd83b492f96ce751
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 20:00:15 2003 +0000
+
+    Updated dfbg man page and usage information printing.
+    
+    Changed default background color.
+
+commit 98cda8f84369b6170d3c9e9ad5cef957320ea55a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 18:45:15 2003 +0000
+
+    Must implement switching support during exclusive access to a layer.
+
+commit 5085ccbbd766a0811c407e1b13c1c36ba321f95f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 18:36:52 2003 +0000
+
+    Do not restore auto-video buffers while DirectFB is suspended.
+
+commit 5f40d6b8ee99ab51ecd41f49e18e08b8181cdd71
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 18:07:38 2003 +0000
+
+    Bumped version number to 0.9.19.
+    
+    Core systems (currently FBDev and SDL) are no longer builtin modules by default.
+    
+    Generate html versions of the man pages if man2html is present.
+    
+    Fixed bug message during deinitialization if prior initialization failed.
+
+commit 7cb87ee73b38ada2e2fce0e71fc3fb78b322cae1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 13:46:32 2003 +0000
+
+    Minor change.
+
+commit 2108f9e516c2bf1b9cf773e43575d180db53212e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 13:44:11 2003 +0000
+
+    Major update.
+
+commit bbea70f6ad204a6ee92b7edc4e9b7da68737e65a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 11 12:56:16 2003 +0000
+
+    Made size of duffs device configurable (2, 4, 8 or 16), kept default of 8.
+    
+    Implemented last missing one of five key event fixup cases.
+
+commit ededb0cbd83435a1bea3d11fd0e5b22a780efcd9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 10 20:10:24 2003 +0000
+
+    Pressed modifier keys are now released during switch from DirectFB.
+    
+    VT switching with XDirectFB plus native applications seems to work fine,
+    though XDirectFB may continue writing to the video memory.
+    
+    Implemented key code & symbol lookup from key identifier for devices with a map.
+
+commit f3291be5e2c24a4f0975d45cd5730efeea7c64a7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 10 18:19:34 2003 +0000
+
+    First working version of vt switching support for single and multi
+    application core.
+    
+    Still unhandled are video only surfaces and other buffers stick to
+    video memory due to locking.
+    
+    Try (with --dfb:vt-switching)
+    - start df_window as the master
+    - switch to the previous console by pressing <Ctrl>-<Alt>-<Fn>
+    - start df_andi
+    - switch back to the DirectFB console
+    - you see df_window again with df_andi running in a window (due to vt switch)
+    
+    Applications are not blocked at any time during "switch off".
+    So in the example above df_andi consumes all of your CPU rendering
+    to the window back buffer (in system memory) with the software driver.
+    
+    I haven't tried XDirectFB, yet. Will do so now. Most probably the permanent
+    locking of the window surfaces causes a problem.
+
+commit ca7e36f8e9e1ea581c1b1fe9cf4a563e5e1b06c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 5 14:51:45 2003 +0000
+
+    Applied fix by J.P. Delport <jpdelport@csir.co.za>:
+    
+    Replace hardcoded default size of 768x576 by the values queried earlier
+    from the capture driver.
+
+commit 5cef9f3ab4b327f9663cc1de04cbbb5ad5f849dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 4 19:09:39 2003 +0000
+
+    Before shutdown the master now sends a SIGTERM to all slaves with a timeout
+    of 5 seconds, after that it sends SIGKILL.
+    
+    It looks cool quitting X (my master) while having several DFBTerms still
+    running. The terminals disappear one after the other before shutdown.
+    
+    To use this feature you must update Fusion including the header,
+    otherwise the feature will be silently disabled. This automation will
+    be removed before the next release, forcing an update then.
+    
+    It uses this new function (intermediate solution):
+    
+    FusionResult fusion_kill( int fusion_id, int signal, int timeout_ms );
+    
+    Sends a signal to one or more fusionees and optionally waits
+    for their processes to terminate.
+    
+    A fusion_id of zero means all fusionees but the calling one.
+    A timeout of zero means infinite waiting while a negative value
+    means no waiting at all.
+
+commit d3cf68f75bff721df78a4a295e213f26b2e59158
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 4 16:03:53 2003 +0000
+
+    Fixed error checking at the end of fusion_read_loop().
+
+commit 5319d9e9818ac11dc5d108d6aa1d644f0c7f024a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 4 14:42:47 2003 +0000
+
+    Move "--libs" output to the end, fixes undefined references in static build.
+
+commit 8f4ebc6f579785a2a5e6212a7ba22a5acee7f3f6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 4 14:10:46 2003 +0000
+
+    Use one cpuid macro for both PIC and non-PIC.
+
+commit 3fe59c16a2ea2cf08c8cf6264e740f727bcd61d3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 3 00:13:01 2003 +0000
+
+    Everyone seems to be starting the Description field with an upper-case
+    letter, now we do so as well.
+
+commit ae0fb423a41814a5bd28620231c8a59541d065e2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 17:13:59 2003 +0000
+
+    EXTRA_DIST fixes, updated patches.
+
+commit 500f538aea1769a1077ff1126245d4ac9d077c5f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jun 2 17:11:21 2003 +0000
+
+    fix compilation on ppc
+
+commit b59c635fcdc1242c3dbed85a3cf4362d9fc1fba7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 16:58:41 2003 +0000
+
+    Updated for 0.9.18 ;)
+
+commit e75e23cbe0cca617e1fef732009b62ebefb39e8f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 15:33:52 2003 +0000
+
+    Major namespace/static cleanup.
+
+commit 7721709cdba1a65b3c25e6feed7b3c7c561372f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 15:08:18 2003 +0000
+
+    Fixed namespace for global "pfuncs" and "pdriver_data".
+
+commit af378d81577e40e8e058b620f70ab3447f4dee6f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:47:32 2003 +0000
+
+    Underscores for "fusion_shared".
+
+commit e03726f5e8f3c27284e81377297e7881761e1d5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:44:51 2003 +0000
+
+    Added underscores to internal global variables fusion_id and fusion_fd.
+
+commit 29c98be5225d8b0a57cf0276dc259e9dddffcf18
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:43:12 2003 +0000
+
+    Made remaining items (GFunc arrays) static.
+
+commit 7dbfeacf6f00566f07df2e6686ed712f69944012
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:42:12 2003 +0000
+
+    Renamed global variable "mmio_base" to "cyber_mmio", should be fixed anyway.
+
+commit 6a3c0285927b91c01af83ac44ac8730b7b583f24
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:19:36 2003 +0000
+
+    Everything static.
+
+commit 66884830cf4bc767ee33b6ee66d0602f453efaf4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 14:18:57 2003 +0000
+
+    MMX routines are included now as a header.
+    
+    No global variables anymore.
+
+commit e9604f0f30bc469b3ab72a2c2a0718a414ae2bb7
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jun 2 12:17:35 2003 +0000
+
+    - fixed state handling
+    - version = 0.2
+
+commit 640f1ee7cb0086d10c4ce7b6b2187421f9d241a7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 2 11:58:38 2003 +0000
+
+    Added missing call to fusion_object_activate(), fixes CAUTION message.
+
+commit f3abf93be5cd6e8ae13ca20d1733dc278d368f25
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat May 31 15:01:58 2003 +0000
+
+    - added support for RGB332
+    - fixed strechblit bug in ARGB1555 mode
+
+commit f0b559a64dec03e29ec2ee2c8cfb34bcd3dee983
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat May 31 14:01:25 2003 +0000
+
+    ppc inline assembler is now asm volatile(...)
+    
+    gcc-3.x broke the code when compiling with -O2 or higher.
+
+commit 85cf240a6e60a629416c6d6d070f2917295a4c7b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri May 30 15:45:29 2003 +0000
+
+    fix for line drawing (invisible lines in df_dok).
+
+commit 12fd28529ff022fb6d0657f21aea6b3901f82255
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 30 15:20:38 2003 +0000
+
+    Forgot to add Florian <florian.fernandez2@wanadoo.fr>.
+
+commit 5d58fc31df459be26051b41f7ccd6cd27ea08be8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 30 15:14:05 2003 +0000
+
+    nVidia Overlay support by Oliver Schwartz <Oliver.Schwartz@gmx.de>:
+    
+    The driver contains a XBox specific register setting which is
+    necessary because of the shared memory architecture on XBox. For
+    plain NVidia graphics adapter you need to change line 618ff of
+    nvidia_overlay.c (uncomment line 618, comment out line 620). This
+    will hopefully be unneccessary once the xbox can be identified by the
+    driver.
+    
+    Readded surface manager's optimizations due to them being fixed with this patch.
+
+commit d6c917b5752f896851efe2296a5a8532ab0df08c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 30 14:56:32 2003 +0000
+
+    Updated savage patch, didn't test it,
+    thanks to Florian <florian.fernandez2@wanadoo.fr>.
+
+commit 2d26dfffe389e50cede5e29fbf1c95e9c632c58c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 28 20:06:56 2003 +0000
+
+    Added IDirectFB::GetClipboardTimeStamp().
+    Added optional time stamp return value to SetClipboardData().
+
+commit 8ab6a0474a6bd020c6fcfd54d04d2cc2944bacf7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 26 20:08:31 2003 +0000
+
+    Leave the entered window if focus is explicitly requested by another window.
+
+commit d72041ba3040d066c19ec4d2dd65b244a307e344
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 21 19:33:57 2003 +0000
+
+    Changed while to for loop in RUN_PIPELINE.
+
+commit 4b33e99d8c388cc06913a5fff1da0abdc30ec608
+Author: holger <holger>
+Date:   Wed May 21 15:10:43 2003 +0000
+
+    try to improve primary input device detection
+
+commit a019d0250d19a5ccf1ee3866884648c45f1adc5e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 21 14:48:11 2003 +0000
+
+    Force DICAPS_ALPHACHANNEL if PNG is indexed because the palette may contain
+    transparent pixels. FIXME: Add detection if transparent entries exist.
+
+commit e0b7ebcd1fdc2d50dc7df264e6cfcb6be4b90055
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 21 12:51:04 2003 +0000
+
+    Don't call destructor on incomplete objects but print a caution message.
+    
+    Incomplete objects exist if a process dies between the object creation and
+    its activation, e.g. during dfb_surface_create() or dfb_window_create().
+
+commit b7b25626ad691b6ff2ef9039be1ce377c9e34f2f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 21 12:25:14 2003 +0000
+
+    Removed an assertion in dfb_layer_update_region(), region is allowed to be NULL!
+    
+    Thanks to Johannes Stezenbach <js@convergence.de> for pointing it out.
+
+commit 10da285ef8f674a5a107ac2e5de835ce84bfee8b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun May 18 19:40:12 2003 +0000
+
+    replaced hallon at debian dot org's email address with mine, don't want
+    him to receive emails, because of my broken packages.
+
+commit e4040df569666650ed786897e8277091c11b390c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 16 13:07:12 2003 +0000
+
+    Use font->height+1 as glyph surface height as debug messages showed that
+    glyph bitmaps are sometimes larger.
+
+commit 98364c73d3dfe080ec0a6e9af8cc190cf8de2658
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 16 12:55:33 2003 +0000
+
+    Fixed glyph surface height calculation. Ascender + Descender was not enough,
+    had to add 1 for glyphs reaching from ascender to descender.
+
+commit 9350f55a5697f553e5c48ae99dee86af8ed6af36
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 13 20:48:27 2003 +0000
+
+    Fixed dead lock in layer configuration recovery.
+    
+    Cleanly destroy arena if its initialize method failed.
+
+commit 80b7c6956aeda9e465aed107bafb3202da34c6ce
+Author: leitner <leitner>
+Date:   Tue May 13 20:01:19 2003 +0000
+
+    remove gcc 3 prototype kludgery from string.h
+
+commit b38239102c53d8b07d72c0984728cda0fd4e949a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 13 18:01:10 2003 +0000
+
+    Reverted dead lock fix. It probably introduced insafetiness and is
+    obsolete anyway.
+
+commit f9976c0ef2dcec721e7b22e1bb0f41855499b105
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 12 16:19:25 2003 +0000
+
+    Set byte offset alignment to 512 to make ZORG happy.
+    Have to add support for different alignments.
+
+commit 8c8e53fac1fd8f42a5ed8a538d606f2758490e09
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 12 14:07:08 2003 +0000
+
+    Added note about reducing sched_yield() usage.
+
+commit 06b9c7cd4c7fece8a3f14dfb38d973de3af73712
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 11 18:08:18 2003 +0000
+
+    Reverted ref/unref as it currently causes that windows are not destroyed
+    unless the event buffer is released, too.
+
+commit 6b20f84bfa1472dc90874223c9e5e09027f66abb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 11 15:42:41 2003 +0000
+
+    Fixed cursor/blank off in master.
+
+commit defa4efa4f43781f3185ad2d8cf10091441b2210
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 11 13:25:06 2003 +0000
+
+    Ref/unref attached windows, avoids fusion error if window is released before
+    event buffer.
+
+commit ed3ece1c3651c5a5ebdbb008c1393ae55b4c0964
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Fri May 9 23:37:34 2003 +0000
+
+    Fixed reversed CRTC2 SetFieldParity().
+
+commit c2f08f1be4d32c62deb9baec6ebb7905d8f7fc44
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 9 14:51:34 2003 +0000
+
+    New mga memory patch:
+    
+    1. Don't touch maxdisplayable, but use len instead of len_usable in get_fix.
+    Fixes too high virtual resolution resulting in garbage after scrolling a lot
+    in the console.
+    
+    2. Disable hw cursor by default, otherwise matroxfb writes the cursor image
+    into DirectFB's memory and the cursor appears (blinking) as soon as DirectFB
+    overwrites it.
+
+commit 9b909787a7288929f8dbbe0cfde7ce31a4c11a29
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 9 12:55:44 2003 +0000
+
+    Fixed two evil brain bugs in lock/unlock with flags.
+    Removed flag execution from unlock() again, works well now.
+
+commit 6b16c1f9d0ab7b4ec563d8cc70c809c3e8dd5f69
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 8 17:47:39 2003 +0000
+
+    Fixed dead lock in dfb_back_to_front_copy(). Unlock surface manager earlier.
+    
+    Do engine reset and state invalidation to dfb_gfxcard_unlock() again but
+    keep the cleanup in dfb_gfxcard_lock().
+
+commit c01763408ee7229539b5518a197a6439d008d8ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 8 13:33:34 2003 +0000
+
+    Fixed bug introduced yesterday.
+
+commit bee62177bb620488eee6622f7647cd6bf46423ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 7 23:36:52 2003 +0000
+
+    Added DFB_KEY_IS_ASCII.
+    
+    Disable cursor and console blank each time a mode is set.
+    
+    Show cursor on escape during auto grab mode (not the ideal solution yet).
+    
+    Also holdup graphics card property on Ctrl-Alt-Break.
+
+commit 52041116368be9153374a259677a2da945506fd7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 7 12:16:57 2003 +0000
+
+    Added a new option for windows with an alpha channel: DWOP_OPAQUE_REGION.
+    
+    Along with IDirectFBWindow::SetOpaqueRegion(x1, y1, x2, y2):
+          *
+          * Disable alpha channel blending for one region of the window.
+          *
+          * If DWOP_ALPHACHANNEL and DWOP_OPAQUE_REGION are set but not DWOP_COLORKEYING
+          * and the opacity of the window is 255 the window gets rendered
+          * without alpha blending within the specified region.
+          *
+          * This is extremely useful for alpha blended window decorations while
+          * the main content stays opaque and gets rendered faster.
+          *
+
+commit cd3d35592f2c9820296472b8f24207c123292260
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 6 17:59:08 2003 +0000
+
+    Fixed dead lock in write to stderr ;)
+    
+    Scenario: OpenGL app locked the graphics card to do OpenGL stuff and
+    writes debugging messages to stdout or stderr. The DFBTerm it's running
+    in reads these debug messages and starts to render them waiting for the
+    garphics card lock. But if the io buffer in the kernel is full the write
+    of the OpenGL app blocks while it doesn't allow the DFBTerm to acquire the
+    lock.
+    
+    Solution: Made graphics card lock a Fusion Property, like the lock for
+    display layers (shared/exclusive access). DirectFB graphics operations
+    are handled by the software driver now if an OpenGL context is locked.
+    That's not the best solution yet, but at least the dead lock is dead.
+    
+    Fortunately moving a window over an OpenGL window always uses the hardware
+    because the lock is synchronized via the blocking surface buffer locks.
+    If a window is moved not touching the OpenGL window it gets slow ;(
+
+commit 0fd471733b9fb74556f3cea48522555f8fce2259
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 6 17:13:55 2003 +0000
+
+    Moved state invalidation and engine reset from dfb_gfxcard_unlock() to
+    dfb_gfxcard_lock() by setting flags for the next lock. This is for the case
+    that the process that locks the hardware dies.
+    
+    Alwass blit from top to bottom if source and destination buffers differ
+    in the software driver.
+
+commit a188d3bb0de0f0ebab14400efa971231f1772e40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 3 23:05:03 2003 +0000
+
+    Pass the CoreSurface to the Constructor of IDirectFBGL.
+
+commit 085f9271d27bc380bff1d0fb68c5b440e3f9eac9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 29 19:37:26 2003 +0000
+
+    Added DFB_FORCE_DEBUG which can be defined before including coredefs.h in
+    order to enable debug messages for specific files if overall debug is disabled.
+    
+    Accept zero length as an automatic value for MMIO mapping, too.
+    
+    Print an error if an orphaned arena is being entered.
+    
+    Nicer debug output (show time in seconds with three digits after the comma).
+    
+    Added DFB_BREAK which acts like a failing assertion.
+    
+    Send signal to current process only, not to the group.
+    
+    Cosmetic changes.
+
+commit 072182f5a65ed4e5dee38047e038403178adc3c2
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Tue Apr 29 06:08:13 2003 +0000
+
+    Return DFB_UNSUPPORTED if pixelformat isn't supported.
+
+commit bef0c9a458eaf4dfd4eaa901bfa6df49fb47d911
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 28 16:51:23 2003 +0000
+
+    Added GraphicsDeviceFunc 'EngineReset()':
+    
+    +      * Called after driver->InitDevice() and during dfb_gfxcard_unlock( , true ).
+    +      * The driver should do the one time initialization of the engine,
+    +      * e.g. writing some registers that are supposed to have a fixed value.
+    +      *
+    +      * This happens after mode switching or after returning from
+    +      * OpenGL state (e.g. DRI driver).
+    
+    Moved one time register writes from InitDevice() to new matroxEngineReset().
+
+commit c3736101ccb2d36976fe6d7197b17e4f88bc5834
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 28 16:05:12 2003 +0000
+
+    Synchronize the content of the front and back buffer of the window stack
+    before entering fullscreen mode. Otherwise old window stack content is
+    shown if the application does not clear immediately (and maybe even then).
+    
+    Added dfb_gfxcard_sync() to dfb_gfxcard_lock().
+
+commit cd51543873c406bfd42b77d9f17e9bf154eddc82
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 28 15:50:49 2003 +0000
+
+    Fixed automatic mouse grabbing for button events.
+
+commit cc4541e55f883dafede4f9edbff503b5f37fd3ac
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Apr 26 11:09:09 2003 +0000
+
+    Added Matrox TV output cable type selection.
+
+commit 93f032f19ee2e7aa3377dcf420d069c1f5d5a98d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Apr 24 08:56:29 2003 +0000
+
+    Reorganized matrox blit code:
+    - Moved TEXORG & co. back to matrox_state.c. DrawString() gained some speed.
+    - Did the same for SRCORG in the name of symmetry :)
+    - Made DSBLIT_DEINTERLACE work with DSCAPS_SEPARATED.
+    - TW8A and BYPASS332 are G400 only so planar TMU blits can only work on G400. Looks like 2D blitter on G400 doesn't care
+    about BYPASS332 so planar 2D blits have a chance of working on older chips too. I doubt anyone has tested this since
+    older cards can't output planar YUV :)
+
+commit b6940c1e9dd3a9a3f87bf610a96d07b5272ebf32
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Apr 24 07:03:07 2003 +0000
+
+    Made nsc driver respect --with-gfxdrivers.
+
+commit e6d39a7ccb62c0209d9f173640c1eb713f4cd76e
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Apr 23 19:28:16 2003 +0000
+
+    Fixed G200 automatic argb-font for multi-app.
+
+commit 72b866c1787c4234126f8d8f7af62882143f402d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 22 13:49:08 2003 +0000
+
+    One more item (at the end).
+
+commit cb352b1d67e04baeaf962ee728ab6e2656ffb0d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 22 12:31:33 2003 +0000
+
+    Fix segfault in MPEG2 image provider by avoiding alloca.
+
+commit d6b18c6a61525087a6c99857c693010c763a4e5e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 22 11:46:25 2003 +0000
+
+    Do not probe graphics drivers if DirectFB is running on non fbdev systems.
+
+commit d227ffcec8a4efcb6ffaa1dfd9c1230162b4be9f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Apr 22 10:31:16 2003 +0000
+
+    extra null pointer check. fixes segfault when probing driver while using SDL.
+    
+    we really shouldnt probe gfxdrivers when using SDL.
+
+commit 959d612c0f782679aa6523410e7498a0b92fb764
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 22 08:11:01 2003 +0000
+
+    Fixed fix.
+
+commit 884b3c9c750ce4a1158ef32905e75e783b48bfc4
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Apr 21 14:32:23 2003 +0000
+
+    debianized. based on the official 0.9.17 debian packages
+
+commit 26bbf1a3805feacb8e24e7ec1b0f07711f2ccb3c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Apr 21 14:18:20 2003 +0000
+
+    build fixes if top_srcdir != top_builddir
+
+commit 51ffc9371712808a8944f93915c094393daf6f1e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 18 20:22:04 2003 +0000
+
+    Add support for running multiple multi app core instances (fusion worlds).
+
+commit 69c441c6d7533c5d727237a1c543fc57bf707922
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 18 17:54:57 2003 +0000
+
+    Fixed PNG and sys/io.h check when configuring with CFLAGS="-Werror".
+
+commit 7d08237522aea87f61ddb2e531d989fe17451ffb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 17 12:27:09 2003 +0000
+
+    Added -Werror-implicit-function-declarations.
+
+commit c1cbb1d8d3cda0683441be070df4d4a82facbdab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 17 11:14:37 2003 +0000
+
+    Removed DFB_CFLAGS, instead prepend to CFLAGS directly, much simpler.
+    
+    Prerequire autoconf 2.52.
+
+commit c65bf6a6faf6b75558a907d4725873dd16443d6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 17 10:38:52 2003 +0000
+
+    Set cmap.len before calling the fb driver.
+
+commit a50cfa843556208d74b9b2149bcb1cf88594b48b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 17 10:11:46 2003 +0000
+
+    Do dfb_gfxcard_sync() before swapping a buffer back from video to system
+    memory if the hardware wrote to it.
+
+commit 96ebec3ad895b2ba897f8f377778adf12e2a4035
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Apr 16 22:00:18 2003 +0000
+
+    fixed extremely stupid bug, which resulted in black screens with some framebuffer drivers and was presend since 0.9.16.
+
+commit 8d84339b5faa4d9ca64eeb275c3d0cbe5e8605e7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 16 16:47:26 2003 +0000
+
+    Adopted changes from Sarma Kolluru <Sarma.Kolluru@nsc.com>.
+
+commit a6251b758f5e95d73697d27483914e1cccc56b45
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 16 14:56:13 2003 +0000
+
+    Few more warnings fixed.
+
+commit 72642fc6d40042b74f0a222ad16d686b2dde476b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 16 14:50:09 2003 +0000
+
+    Be able to configure even if CFLAGS is exported containing "-Werror".
+
+commit fe0a2627fc691265c72ee03bf6a8d6dfe278e905
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 16 14:22:02 2003 +0000
+
+    Fixed tons of signed/unsigned warnings produced with -Wall and gcc 3.3.
+    
+    Made all unsigned width, height in the API signed.
+    
+    Fixed many other warnings. DirectFB compiles with gcc-3.3 -Wall -Werror.
+
+commit eef0cba18d7b17fdec8409db12b7d3860e2dd567
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 16 11:34:16 2003 +0000
+
+    The cursor is no longer enabled during DirectFBCreate().
+    
+    It gets enabled automatically when the first window is created
+    unless the cursor wasn't enabled/disabled before.
+    
+    Option "no-cursor" now forces the cursor to be disabled forever.
+    No window resource is created.
+
+commit 08a0fdb0800f065efb56e3562d383c7e9cf202fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 15 08:50:49 2003 +0000
+
+    Moved into docs/.
+
+commit dcf4dcd30cf7bf6cf9d97b20c37c4c89d768d4b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 14 13:54:56 2003 +0000
+
+    Applied license header patch from Sarma Kolluru <Sarma.Kolluru@nsc.com>.
+
+commit 46af1c988458bed7b59f64c10192cf5c28b627ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 14 12:05:58 2003 +0000
+
+    Made data pointer of memory based data buffer "const".
+
+commit 434487d86868de5ea898dfc99172cbb9e5f86d78
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 14 11:49:15 2003 +0000
+
+    Let "argb_font" override "no-argb-font" ;)
+
+commit 0ce4d7c94d0663cd83b2f8cdb0a021ee41cca3b9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 14 11:44:24 2003 +0000
+
+    Made node mutex recursive.
+
+commit 31e0780998c503356a694ec9d25f181ab21cef56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 14 11:15:42 2003 +0000
+
+    Made "no-argb-font" work for G200 (where argb-font is set after config loading).
+    
+    Reenabled the optimization in repaint_stack() which flips the layer's surface's
+    buffers if the whole screen is updated (instead of blitting the whole buffer).
+
+commit 4d049ae507fd527fb7a3fcff91d32cdccd5cf910
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Mon Apr 14 07:44:29 2003 +0000
+
+    Restore interrupts after soft reset.
+
+commit 74c27faace5513e966f4d57b21fd3b2ff0421877
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 13 23:25:29 2003 +0000
+
+    Assign the destination surface to the window stack render state each
+    time repaint_stack() is called instead of attaching a listener to the surface.
+    This saves CPU usage in each slave by not getting notifications anymore
+    (for each flip etc.).
+    
+    df_flip (slave using RPC for flipping) went from ~22000 to ~53000 FPS.
+    Running df_flip as the master (no RPC) results in ~144000 FPS.
+
+commit 9c25655a4b90fec7b99bcf4c764ebb8fb4521d46
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 13 22:44:04 2003 +0000
+
+    Do soft reset on G200 only. It trashes my screen until reboot on G550.
+
+commit f033dc226924b89e9835353a2f30175b79dad0f5
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Apr 13 10:31:58 2003 +0000
+
+    Bumped version number to 0.9.18
+
+commit 2fb1a91569915fdee79cf6de5abc4aee31ff04c7
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Apr 13 10:03:53 2003 +0000
+
+    Added DPMS support via IDirectFBDisplayLayer::SetScreenPowerMode().
+
+commit cad61261aee656c4b53554c9efb97560c4b2b240
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 12 10:59:24 2003 +0000
+
+    use AM_CFLAGS instead of CFLAGS (thanks to obi for the hint)
+
+commit c49b0d632651e338bed60f2e51b01da2c651c87d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 11 16:59:46 2003 +0000
+
+    Simplified surface manager chunk loop in dfb_surfacemanager_allocate().
+    
+    Added restriction that 'video low' surfaces are not allowed to kick out
+    'video high' surfaces.
+    
+    Create font surfaces as 'video low' instead of 'video high'.
+
+commit 2de275bae6954dab81d5c439293e6868b17180c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 11 16:17:21 2003 +0000
+
+    Added workaround for a strange TMU read offset bug on G200.
+    See matroxSetState() for more information about the bug.
+    
+    Added soft reset to driver_init_device() in case the workaround doesn't
+    work (unlikely).
+
+commit ca583b051bb496ef4c47cc7697eabcc8ce289d65
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Apr 11 00:22:50 2003 +0000
+
+    i don't believe that they belong here...
+
+commit 00b2c796e7be7bf0601effc08faf61f3d2b137bc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 10 15:39:55 2003 +0000
+
+    National Semiconductors Geode driver by Sarma Kolluru <Sarma.Kolluru@nsc.com>.
+    Great thanks to NSC for their support!!!
+
+commit 4212b252b435d12c4f680eda4557f720f81ffd6c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 13:42:07 2003 +0000
+
+    Forgot one more printf.
+
+commit 15350c5a5bb7114451d50e82cd29f8885f5c2346
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 13:36:22 2003 +0000
+
+    Create grabbing thread with default priority.
+
+commit 37431805c1a3447f2d7c31a27fd45bd4b6c38a92
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 13:30:21 2003 +0000
+
+    Removed debug printfs.
+
+commit eac7475ab3735919b927eb35aa5c88a20478f33d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 13:25:44 2003 +0000
+
+    Forgot to add the handler to the switch.
+
+commit 099812d3afd8f015300dce765346deba9cf1b3af
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 13:12:43 2003 +0000
+
+    Fixed two bugs causing video playback to system only window surfaces to fail.
+
+commit 3ca8019f2a5697a1d24769e4de5b15b8258c7f55
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 8 12:47:39 2003 +0000
+
+    Finished SDL multi app support by adding RPC palette changes.
+
+commit 16778d879dbd2db3cc77534be41c4d278f1b8dce
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Apr 8 09:22:53 2003 +0000
+
+    fixed broken --dfb:help output. vt-switch was not mentioned, others had wrong descriptions.
+
+commit 32813818554e77785a57bd26d6675a8aa51c7ad1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 7 16:58:34 2003 +0000
+
+    Added multi app support to SDL backend.
+    TODO: palette mode.
+
+commit 747d963190282ac25c3fce6f7c41e9c996b1bbdf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 7 13:21:25 2003 +0000
+
+    Added Ville to main developers (not doing drivers only).
+
+commit 2c4912a9c8d81241d3687d322928eed847d15542
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 7 13:10:47 2003 +0000
+
+    Updated 2.4 patches.
+
+commit 98ce3e4005d7f7922850e3d862de19c00db7d198
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Apr 7 12:47:20 2003 +0000
+
+    Added username <-> realname/email mapping for Ville.
+
+commit c818b97381a192ce7e0f65d59431b1ba734efe85
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Apr 6 15:55:53 2003 +0000
+
+    Fixed matroxfb 32mb patch.
+
+commit 2006e7369fee19c6fe20d8a42d3724874234350c
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Apr 6 15:41:22 2003 +0000
+
+    Added README describing Matrox TV-out functionality.
+
+commit f1a6d6cb34037d124eb994f2f88fbe70a8fa53c8
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sun Apr 6 15:14:47 2003 +0000
+
+    Made text drawing honor DSDRAW_BLEND flag.
+
+commit 959e7692f2824d8d5c8cf560b6cc3670e61327dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 6 00:22:49 2003 +0000
+
+    Updated patches.
+
+commit 83c83594df4941986eedd336cede4d2d43547160
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Sat Apr 5 21:04:23 2003 +0000
+
+    Improved matroxfb vsync patch.
+    
+    - Move wait queues to the matrox_fb_info struct. Should allow more than
+      one card to work at the same time.
+    - Enable irq only when /dev/fbX is opened. I think this should eliminate
+      XFree86 hanging on startup.
+    - Use vline interrupt on the first head simply because it's easier to
+      turn on/off than the vsync interrupt. It's programmed to trigger on
+      vblank start.
+    - Check card type before trying to use the c2vline interrupt.
+
+commit 4f5029495285e157b7ec54681167843b76f2c1a9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 5 02:52:25 2003 +0000
+
+    Small single app fix.
+
+commit dc54be529bce28d67091dc4c095452e12b3b19dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 5 02:48:27 2003 +0000
+
+    Use new FusionCall for RPC based fbdev ioctl.
+
+commit c50b8ee81e70b769c04ddb97a0666ccaf2de809d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Thu Apr 3 18:35:00 2003 +0000
+
+    Splitted DSFLIP_WAITFORSYNC into DSFLIP_WAIT and DSFLIP_ONSYNC.
+
+commit 126ffdc5f43602c167119dbb5c575f72388e996d
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Apr 2 23:17:40 2003 +0000
+
+    Fixed DSCAPS_SEPARATED with planar formats.
+
+commit ad30d652bc2d892e80b0b32c97aab2ec31595ff0
+Author: Ville Syrjala <syrjala@directfb.org>
+Date:   Wed Apr 2 17:56:47 2003 +0000
+
+    Fixed a typo.
+
+commit a15f400beedf167ff5e873999aa577366efd3c94
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 1 19:09:08 2003 +0000
+
+    Fixed cursor reference counting (inc. global, dec. local after creating),
+    now slaves enable a display layer correctly without trashing it via exit.
+    
+    Repaint window stack if the layer configuration is set in administrative mode.
+
+commit 14557ea4623d236812f7e6c6d31654f6b6c9a2a9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 27 14:19:50 2003 +0000
+
+    Allow IDirectFBSurface::SetFont() while surface is locked.
+
+commit 622103f2e74d57c41a44b93d1d16ad3a014b9209
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Mar 27 00:08:37 2003 +0000
+
+    applied patch by Antonino Daplas <adaplas at users.sourceforge.net> which improves error handling.
+
+commit e83068fef8841cfdcc5fbaccead49d4e6ffb5432
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Mar 26 17:22:29 2003 +0000
+
+    replaced dfb_system_wait_vsync() with dfb_layer_wait_vsync()
+
+commit 448408368f76bbbf77a483504ccff25edf4ee860
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Mar 26 17:10:52 2003 +0000
+
+    dont build i810 driver if <sys/io.h> is not present.
+
+commit b62c3e11cbc8a48c62ab72e7a53a4e494f2ffcfb
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Mar 26 16:51:13 2003 +0000
+
+    - added Intel i810 driver from Tony Daplas < adaplas at users.sourceforge.net >
+      please see i810fb.sf.net for more information
+
+commit 587065b4a3dd84de7e790e4f35dc852a91b5d1a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 24 13:39:09 2003 +0000
+
+    Fixed panning, division of byte offset by pitch was missing
+    (dfb_fbdev_pan() takes y offset, not byte offset).
+
+commit 7b532173a68ca94e83a8230491ff3509c5d43d6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 24 10:12:23 2003 +0000
+
+    Palette size fix from Ville Syrjala <syrjala@sci.fi>.
+
+commit ae8270db46a35f8cd4393d057f8f83a1fef35a07
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 24 01:27:11 2003 +0000
+
+    Applied patch from Ville Syrjala <syrjala@sci.fi> adding triple buffering
+    support, many many great thanks ;)
+
+commit 4a71db2190387263831c985613a7dca2730f8b8f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 20 16:35:24 2003 +0000
+
+    Applied patch from Ville Syrjala <syrjala@sci.fi> adding DSPF_ALUT44.
+    This is a new pixel format having 4 bits of alpha and 4 bits being an
+    index to a color lookup table.
+    
+    Great thanks!
+
+commit 246a265d6c16203e63e10ceec976c3c67c6d8c94
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 19 16:42:20 2003 +0000
+
+    Sop_lut8_to_Dacc() speedup, thanks to Ville Syrjala <syrjala@sci.fi>.
+
+commit e67cb29538dd8302d159080f4c27edfee4265438
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 19 14:07:10 2003 +0000
+
+    Sop_lut8_Kto_Dacc() and Sop_lut8_SKto_Dacc()
+    implemented by Ville Syrjala <syrjala@sci.fi>, thanks!
+
+commit 7fd85d37f1fe650890d3d2aeaa44643d523284aa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Mar 19 14:05:08 2003 +0000
+
+    Naming fix, thanks to Ville.
+
+commit 8ee3c737dc1114526040b36f694d891363bb934c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 14 16:16:35 2003 +0000
+
+    Fixed tiled background image bug (clip wasn't set and resulted in invisible
+    parts of overlapping transparent windows).
+
+commit 19ffe9a53ff0ae4976cb4970b655d7e60cbf57f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 14 15:27:31 2003 +0000
+
+    The window needs to be refed in GetWindow() because IDirectFBWindow_Construct
+    doesn't do that.
+
+commit 9b270f6b6e28396744a22bb880498359b14ee32b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 14 12:49:33 2003 +0000
+
+    Disable layer normally even during emergency shutdown, because the global
+    reaction of the surface has to be detached.
+
+commit 9185037f40f5ade94dec6c6b2a8edc5d94cf6d7d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 11 15:37:31 2003 +0000
+
+    Added James Su <suzhe@gnuchina.org>.
+
+commit 643babead9ee1ffa25a86a418696f628f009d130
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Mar 11 13:30:34 2003 +0000
+
+    Applied a modified version of a patch from James Su <suzhe@gnuchina.org>
+    that fixes a potential problem with PS2 mouse initialization.
+
+commit 10d488cac9448f5bb185446d787f6c194608782c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 10 12:39:09 2003 +0000
+
+    Reverted an optimization, just a guess.
+
+commit 78eae1b6f2f8db1e0d3500ec2ff2496794f78687
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Mar 7 12:00:28 2003 +0000
+
+    fixed a typo
+
+commit 4808e7b6b3f95eb211981f4c3320fbc752e1dbb1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 6 13:59:44 2003 +0000
+
+    Avoid writing to the original message data.
+
+commit 9d6a4b70c0cebc40fe60e3e11fad78e2f8b4c11d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 4 21:04:57 2003 +0000
+
+    Added DFBInputEventFlag:
+    .     DIEF_GLOBAL         = 0x200    /* Only for event buffers creates by
+    .                                       IDirectFB::CreateInputEventBuffer()
+    .                                       with global events enabled.
+    .                                       Indicates that the event would have been
+    .                                       filtered if the buffer hadn't been
+    .                                       global. */
+
+commit 89458a1bed734755336648f97a8a73daeeebf656
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 4 16:11:27 2003 +0000
+
+    Non global input event buffers now also get events if any window of the
+    application is focused.
+
+commit 6917028685c2dbc36525dacc02b614db8fd2b2d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 4 11:39:33 2003 +0000
+
+    Added extra checks for *argc and *argv being non NULL. Thanks to
+    Sebastian Ley <sebastian.ley@mmweg.rwth-aachen.de> for pointing out this bug.
+
+commit 00393231230df60d437aa865d90ca3c87d9de617
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 4 10:24:19 2003 +0000
+
+    Install directfb_version.h, too.
+
+commit 10305776ad6bbf270dda96f4a87d14bb9fed5679
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 28 20:18:55 2003 +0000
+
+    Updates for 0.9.17 release.
+    vmwarefb patch for older kernels.
+
+commit 4ebbdeb74a1fd0b7c237559eea617cef2d51664d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 28 20:11:29 2003 +0000
+
+    Fixed blitting within one buffer by using late software fallback.
+
+commit fab5042adc68b8e8188ae04b5a368b42d4a65795
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 28 19:59:24 2003 +0000
+
+    New patches.
+
+commit 708f92fdc975c27c568fec6e0f04336ec5570a50
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Feb 27 00:16:41 2003 +0000
+
+    various build fixes for non linux systems
+    - disable ppc asm on darwin and openbsd
+    - do not build dfbsummon and fusion_bench on non linux systems
+    - add -I/sw/include to CPPFLAGS on darwin (for fink)
+    - add -L/sw/lib to LDFLAGS on darwin (for fink)
+
+commit 956ba30e4c3d447d778c37a558987019f8e356f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 26 15:09:46 2003 +0000
+
+    Eliminated all strcpy, strcat and sprintf usage.
+
+commit 0344e781f46db2d4684c9fd82ea30bce94740ee5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 25 19:02:15 2003 +0000
+
+    Reject YUV modes, thanks to Jiri Svoboda for pointing out this bug.
+
+commit a4dd565b6379b4a6a6046ac383f703b4ea10cadb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 21 22:26:05 2003 +0000
+
+    Readded DSPF_RGB15 (= DSPF_ARGB1555).
+
+commit 9c364f5a1d829af73de2a294e6a25cd44bd6205d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 20 21:30:37 2003 +0000
+
+    Print GetSurface() warning only if DLSCL_SHARED is set.
+    Beautified the output of dfbdump.
+    Install dfbdump.
+
+commit f5adaad0d29d82f29f82142d9c8e666be220ac1a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Feb 19 21:53:06 2003 +0000
+
+    fix for neomagic check
+
+commit f76f6764df7c8b7b1901c02373dd41183e9206a2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Feb 19 21:43:23 2003 +0000
+
+    --with-gfxdrivers=none builds no gfxdrivers
+
+commit ae3d89678b39e31f6349ba7611a49db970e46e94
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 19 21:34:13 2003 +0000
+
+    Beautified output.
+
+commit 88a0f94dec5a6a3a6181404bfafd0039a941ee9c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Feb 19 21:15:59 2003 +0000
+
+    it is finally possible to specify which gfxdrivers should be built.
+    ./configure --with-gfxdrivers=<list>
+    
+    list is comma separated, all compiles all drivers (default)
+
+commit c14184e30fb10267c2253cb9873ec2f773b2da2b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 18 21:57:15 2003 +0000
+
+    Commented out two assertions.
+
+commit 3decb592a4da32861d973c565fa02b7a6882b306
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 18 20:49:03 2003 +0000
+
+    Added tons of assertions.
+
+commit 2709a9b4c312eb763f27912f3a2d6def112446fc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 18 17:38:21 2003 +0000
+
+    Added cooperative level restrictions to many functions.
+    In short: cursor and background changes only in ADMINISTRATIVE,
+    configuration and appearance in ADMINISTRATIVE and EXCLUSIVE.
+    SetFieldParity() is allowed with EXCLUSIVE only.
+    GetSurface() will be restricted to EXCLUSIVE soon.
+
+commit 67a157227064b428cf987ddd98ae6cdeba0b3f95
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Feb 16 13:29:18 2003 +0000
+
+    Fixed destination color keying for blended drawing.
+
+commit 0d1e5c4a8f6fa04bcc506e25cd6613721b42888f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 14 12:43:38 2003 +0000
+
+    Sorted functions a bit.
+
+commit a1a217246b4b7b4c128bbcf8d14fb02a6b048de6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 21:14:37 2003 +0000
+
+    Muted some often appearing debug messages.
+
+commit 10ad1e07b0d47dd5c9ad2719a46f09fb5b61fddc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 18:20:43 2003 +0000
+
+    Various bug fixes.
+
+commit 55d71aca197ed227be33962c1063e0a7cee6c4e8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 17:35:47 2003 +0000
+
+    Small fix from Ville.
+
+commit 50ed9d7601c1311bde2c82a28d4e0a6d2ec944d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 15:56:00 2003 +0000
+
+    Even field -> top field.
+    Odd field -> bottom field.
+
+commit a74482f2d7c7b5221a6908425e4eaf2b44aeeb93
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 15:47:56 2003 +0000
+
+    Another patch from Ville Syrjala <syrjala@sci.fi>:
+    
+    I just stumbled on DLOP_OPACITY and DLOP_ALPHACHANNEL and thought that the
+    CRTC2 sub-picture layer should honor these. So here's a patch to do just
+    that.
+
+commit 7268ed86f1f46b1fe3fa240e4c1e2027a18844ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 15:32:19 2003 +0000
+
+    Applied patch from Ville Syrjala <syrjala@sci.fi>:
+    
+    I'm sure everyone remembers Brian's CRTC2 troubles. Well I think we
+    managed to fix it off list some time ago. The problem was caused by
+    displaying the fields in the wrong order.
+    
+    Here's a patch with the solution I came up with. It adds a new method
+    IDirectFBDisplayLayer::SetFieldParity() to select which field is displayed
+    first after a Flip(). This behaviour isn't always the best choice so I
+    added {DLCAPS,DLOP}_FIELD_PARITY flags.
+
+commit 6b49e441ee9cf85dce9531fb3f6a4c8cf0189755
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 13 15:23:56 2003 +0000
+
+    Added FIXME note.
+
+commit 2e6183326b48db5c826ccb86b855473c71ba55ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 12 19:44:21 2003 +0000
+
+    Added 'bool' return values to all acceleration functions.
+    Implemented 'late software fallback' for FillRectangle, DrawRectangle,
+    Blit and StretchBlit.
+    
+    Graphics drivers are now able to return false in these functions to
+    trigger a software fallback. Useful if blitting direction cannot be
+    configured.
+
+commit b5a7d158bbe102a2b58e6f12390119b14029d12d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 12 15:53:20 2003 +0000
+
+    Moved core part handling code from core.c to core_parts.c adding four
+    new functions: dfb_core_part_(initialize|join|shutdown|leave).
+    Added some debug messages.
+
+commit 59e7e902ed86344a7b54e2f60b4101bb4581baa6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 12 14:50:11 2003 +0000
+
+    Added 'core parts' being the gladiators entering the arena.
+    Each core part has an init, join, shutdown, leave, suspend, resume
+    and information about the local and shared data size.
+    Core parts are system, input, gfxcard, layers and colorhash.
+    Moved colorhash core part to core directory.
+    Moved clipboard code from core.c into extra core part.
+
+commit fa93548698fc65b4cbe82bc7e9cfc7bee23a8127
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Feb 9 22:13:13 2003 +0000
+
+    Made memcpy benchmark more 'blitter like'.
+
+commit fc0e42031e3d86928332e401b0a285deda087f45
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 5 13:41:45 2003 +0000
+
+    Added Scott Brumbaugh <scottb.lists@verizon.net> to the ThanksTo section.
+
+commit 11c2209547ccfec0906df72e03f799373ce59588
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 4 20:11:55 2003 +0000
+
+    Commented out recently added cleanup of local reactor nodes (crashes sometimes
+    and produces a bug message).
+
+commit 661f8b7c54ea038b73ce9d0d32ecf1ee9798ea3d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 4 17:15:01 2003 +0000
+
+    Lock the node list in _reactor_free_all().
+
+commit e2882d384c598154b95e79ff358b9388f9512d5d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 3 19:23:53 2003 +0000
+
+    More cleanups and comments.
+
+commit 361190234249fa3fff3c52d0c359e23b06860539
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 3 18:19:45 2003 +0000
+
+    Completely commented.
+
+commit b8f1133c58efcc3736ef65720e30801627f49a4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 3 12:36:06 2003 +0000
+
+    Code cleanup, minor optimization in dfb_gfxcard_state_check().
+
+commit bc50cdd7e2b2bdd8dee077a1949624b85586f6f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 31 18:43:36 2003 +0000
+
+    Use dfb_layer_wait_vsync() now.
+
+commit fef80277b99d283c5bc5753ce1042ff2e84952f6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 31 18:40:29 2003 +0000
+
+    Removed dfb_system_wait_vsync().
+    IDirectFB::WaitForSync() uses the primary layer's WaitVSync().
+    The FBDev primary layer's WaitVSync() is now implemented.
+
+commit dbe698a70c7e8c03adea1f22dbdead96beca39e2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 30 20:42:41 2003 +0000
+
+    Fixed input device ID unification.
+    Added recursive helper function make_id(prefered).
+
+commit 68ab1cebbce5cca6d31a2d27dcfd50ff96cce2de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 29 18:11:11 2003 +0000
+
+    Input devices still get same IDs sometimes.
+
+commit 560d631bc151b8f89dea26e54e23a73c1fcac101
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 29 15:41:45 2003 +0000
+
+    Added "FBDev" and "SDL" to primary layer names.
+
+commit f508d8ad1247891d8c800999f48c56f011d4e9dd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 29 15:39:41 2003 +0000
+
+    Added enumeration of display layers.
+
+commit b0f9841a3a6127a0c12c19c9db7b006ad9e03c46
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 29 13:23:58 2003 +0000
+
+    Moved input device name and vendor to DFBInputDeviceDescription.
+    Added new tool "dfbinfo" which currently enumerates input devices,
+    but needs some beautified output.
+
+commit 24d8c48c898a5271d6fc942029c0a7ab1b942185
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 29 13:19:13 2003 +0000
+
+    Added special thanks for Ville.
+
+commit 8a6c41b2d87f3b41adf3ad787375817d73494477
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jan 29 12:33:53 2003 +0000
+
+    Added input driver for Microtouch serial touchscreens.
+    Since this driver has to be configured by adjusting a couple of defines
+    in the source code, it is not build by default. Enable it using the
+    --enable-mutouch configure option.
+
+commit 3138e94cd4751250eaa98a25d489567f1796d9ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 24 19:19:18 2003 +0000
+
+    Fix for planar formats by Ville Syrjala <syrjala@sci.fi>.
+
+commit 2b07efc4a20db64448dd30604720c861e2725f32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 23 21:12:53 2003 +0000
+
+    Reverted change to use FusionLink.
+
+commit 2c2b947299c5e93bebedf9a810274c57123946fd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jan 23 20:11:05 2003 +0000
+
+    Return DFB_OK from load_default_cursor() if the file was missing and
+    created an empty cursor.
+
+commit 618f381302c88f041ffc2a5e0cebf2a32b280402
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 23 17:00:16 2003 +0000
+
+    Fixed segfaulkt during shutdown.
+
+commit 45e8fac66223c3d2cf4980fa7badb15546c12e99
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jan 23 15:59:08 2003 +0000
+
+    Compile the default font into the default font provider.
+    Don't install font.data any longer.
+
+commit 17b9fd1455c76ee736b1c8527bcbc8e30e595dc4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 23 15:37:21 2003 +0000
+
+    Hold the surface manager lock during the whole dfb_back_to_front_copy() work.
+    Use FusionLink for local list of input devices.
+
+commit 646e76b9e55579caa5df8c4d81820f07e1c3b40f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jan 23 15:11:32 2003 +0000
+
+    Initialize the cursor window as empty in case the cursor file can not
+    be opened or is smaller than the expected size.
+
+commit 6615dbbed032201d181f3bae79cc774dff0ab441
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jan 21 20:04:16 2003 +0000
+
+    Check that fb_dev is not NULL before trying to release it in system_leave().
+
+commit cc8e5c008dafbf1e5668acdfba29c3e31d70e0ae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 21 15:25:33 2003 +0000
+
+    Started to write an overview of the initialization process.
+
+commit 09a908f03ef5d9ec9c3deedb16349bce9ef7d279
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 21 15:17:19 2003 +0000
+
+    Fix "could not adjust heap offset message" if the primary layer surface
+    consumes the whole video memory (thanks to Ville Syrjala).
+
+commit d8d74b686b0c3df3b192fe6250fbeba8e86327fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 21 15:15:35 2003 +0000
+
+    Don't segfault in dfb_core_get_clip() if no clip is set.
+
+commit 566eee41028bdce57dbdc86a666bbc8db7a335ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 20 19:48:20 2003 +0000
+
+    Minor code cleanup.
+
+commit 8cf9f02a926b9b9a5dd64de386379502511bf59c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 20 19:05:17 2003 +0000
+
+    Open framebuffer device before initializing the vt.
+    Don't open extra framebuffer device in vt code.
+
+commit 97f7ce3b86fd8b5984ac06afd8891d190362e103
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 20 17:42:43 2003 +0000
+
+    Removed obsolete usage of shcalloc.
+
+commit 32b074d9be0a02cbfb6c3f84113a32f8583389fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 20 17:13:54 2003 +0000
+
+    Use dfb_gfxcard_lock() in dfb_gfxcard_shutdown(). Removed workaround that
+    was needed because of lacking support for recursive locks.
+
+commit 2f7528b1a3781c307efa885ef8fec0f009afdd9a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 16 15:22:17 2003 +0000
+
+    Added minimalistic clipboard functionality via IDirectFB::Set/GetClipboardData()
+    including mime type. This is an intermediate solution that will be replaced.
+
+commit 545b308ffdf4532042740c1e87becd2817c65541
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 15 13:09:05 2003 +0000
+
+    Added PPC sources to EXTRA_DIST.
+
+commit 6fb3ca80481b63237871ac4a534335e8623f524f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 15 12:58:29 2003 +0000
+
+    Added 1280x1024 at 75 Hz.
+
+commit 4fc792524165b88b290824e02810b1ca9c43805c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 14 16:33:41 2003 +0000
+
+    Added patch.
+
+commit 86e8644dd58aed35ab3946718c9c4fe6404242fd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 14 16:31:26 2003 +0000
+
+    Updated ChangeLog and NEWS for release.
+    Added comment to arena code.
+
+commit bb37a7488ecea81235b56e27295601b8b92db24b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 14 15:16:36 2003 +0000
+
+    Updated patch.
+
+commit 45a8c42ce04fceca9d593919572fad8813f8c5bd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 13 19:29:05 2003 +0000
+
+    set data to NULL in case of error to avoid a possible crash
+
+commit 5c5d0ec9a7dba121bebf25ee029229dcd389ad3d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 13 13:18:42 2003 +0000
+
+    Updated the spec file (added dfbg and its man-page).
+
+commit f4b5e4954f4d3ad6b5283636c5e597a1207173ad
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 13 12:57:20 2003 +0000
+
+    Removed the avifile and flash video providers. They are now part of
+    the DirectFB-extra package.
+
+commit 961aef164df4770bf86f731bc09d10bde775c52c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jan 10 15:20:04 2003 +0000
+
+    Reverted my latest change since they need autoconf > 2.13.
+    Will instead move this code to DirectFB-extra and do it correctly there.
+
+commit c3294591a682cdb522a0c953876287a3840946b2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jan 9 16:46:24 2003 +0000
+
+    Fixed a typo and separated the comon from the exotic pixel formats.
+
+commit 0b568d8423ebd372f131a44b1106b835f42d6135
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jan 8 15:47:01 2003 +0000
+
+    AC_LANG_PUSH C++ before checking for libflash, AC_LANG_POP afterwards.
+
+commit 216339a89a5584fa861dbe43316ebfe7773c569a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Jan 4 21:25:20 2003 +0000
+
+    - moved ppcasm_memcpy and ppcasm_memcpy_cachable into two seperate files
+    - ppcasm_memcpy_cachable is only built on linux
+    
+    TODO: do not build ppcasm_memcpy_cachabe by defaut since this will create
+    machine specific code.
+
+commit 9e3ec006c8ddd38e6f29751d07f8f66251101e8d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Jan 4 20:46:41 2003 +0000
+
+    removed hardcoded CACHELINE_BYTES, uses values from <asm/cache.h> instead
+
+commit 5eb1521913af7efd34ea04a24b72b689c8865895
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Jan 4 20:18:40 2003 +0000
+
+    - dont call AC_PROG_CC twice
+
+commit a993647941ae448a596a4b5108365d060773c901
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Jan 4 20:10:37 2003 +0000
+
+    - fix build problems with automake 1.5 when compiling assembler source
+    - removed AM_PROG_CC_STDC macro which is obsolete, use AC_PROG_CC instead
+    
+    "This macro is a relic from the time Autoconf didn't offer such a feature.
+    AM_PROG_CC_STDC's logic has now been merged into Autoconf's AC_PROG_CC
+    macro, therefore you should use the latter instead. Chances are you are
+    already using AC_PROG_CC, so you can simply remove the AM_PROG_CC_STDC call
+    and turn all occurrences of $am_cv_prog_cc_stdc into $ac_cv_prog_cc_stdc.
+    AM_PROG_CC_STDC will be marked as obsolete (in the Autoconf sense) in
+    Automake 1.8."
+
+commit ed0bbe9cb8acc904f5b4e19cea58000f0997dc64
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Jan 4 19:58:56 2003 +0000
+
+    - bugfix for ARGB primary. someone did copy&paste from RGB16 values...
+
+commit 4d5bd2f637fd765bb1e6bb9ad412f62ac4aa0a3b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 29 17:50:03 2002 +0000
+
+    fixed fix
+
+commit 5ce552989be8de0c6af67fce53a81574c4073bbd
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 29 17:39:23 2002 +0000
+
+    fix handling of palette alpha values
+
+commit dd2c8f1708323db1c653083ef7f2b5dd9205881a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Dec 28 19:36:54 2002 +0000
+
+    bugfix for ARGB1555 pixelformat
+
+commit f05157464edb933b825d25eff19e4df03f09e5d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 21:25:35 2002 +0000
+
+    Removed some debug code.
+
+commit b4f2a5926f9260dcda3cf747d070579f7a3dba11
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 20:58:42 2002 +0000
+
+    Fixed 15bit color keyed blitting.
+
+commit afd3ce2d8f5b43400c8d972fe4b4c2bf2b1ceb14
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Dec 27 19:41:19 2002 +0000
+
+    integrated optimized ppc memcopy from xine
+    
+    this is evil and breaks at least compilation under OSX. should be disabled by default.
+
+commit 08828669d5a73fac34e427b9441e82ea25bc512a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 19:39:12 2002 +0000
+
+    Added enums for indices of global reactions, removes some FIXMEs.
+
+commit fcf9fd7ba39fe2edfcc3554b870ac08b26e8d84f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 17:50:08 2002 +0000
+
+    Changed DSPF_RGB15 to DSPF_ARGB1555, untested.
+
+commit 212f2740b401634bcd2978b9b66a615d4d0de038
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Dec 27 17:42:51 2002 +0000
+
+    small compile fix (follow changes to layer naming)
+
+commit 74c66befbe9cd47f1f5d467d1e15b267828f695d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 05:26:36 2002 +0000
+
+    SetVideoMode() resizes the window of windowed fullscreen applications, untested.
+
+commit 792c4b56cd934f6110595c6a7078389ec1a603cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 27 03:39:28 2002 +0000
+
+    Made summarize for upcoming 0.9.16 release.
+
+commit 83468fe052e2a6947507fe240a1a5a2fd10434bd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 19 20:53:37 2002 +0000
+
+    Ville Syrjala moved the layer name into the layer description and removed
+    IDirectFBDisplayLayer::GetName(). Thanks!
+
+commit 52ec3c16c3c9b704bca40ece400fcca16773aa67
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 19 19:07:02 2002 +0000
+
+    Applied patch from Ville Syrjala <syrjala@sci.fi> that adds TV-Out and
+    sub picture layer support for G450 and possibly G550, too. Thanks!
+    
+    Fixed two bugs related to (de)initialization of additional display layers
+    by slave applications.
+
+commit f2fd1fba857fed54e46d87fcc277f02c8e78b83a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 18 21:34:52 2002 +0000
+
+    Focus the window under the cursor after abandoning a window with Meta-A.
+
+commit 519361d3a02c496cc1a5098bbd59f9f33cbf85eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 18 17:53:44 2002 +0000
+
+    Don't send SIGTRAP if shared memory limit would be exceeded, return NULL.
+
+commit 8ae7ee99015471795ab02fa547937bd674e06566
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 17 20:55:14 2002 +0000
+
+    Added FusionObjectState enum and fusion_object_activate().
+
+commit 5ca7111d2859cf5fcc01c084f8960c341bc569d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 17 19:53:45 2002 +0000
+
+    Added dfb_gfxcard_lock() and dfb_gfxcard_unlock(bool invalidate_state).
+    It's used by dfb_fbdev_set_mode() to workaround accelerator register
+    writes by the framebuffer driver during FBIOPUT_VSCREENINFO.
+
+commit 65179acc9e172f98fc6edb935af9dd165ae12255
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 17 19:51:27 2002 +0000
+
+    Force SDL disabled if multi application core is enabled.
+
+commit be52dde2c9f0c058dab8b24fc9f83bd0e3bf81de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 16 14:13:56 2002 +0000
+
+    Removed unnecessary newline.
+
+commit bc67490469b502ed82a83b9524417de9eb8bf078
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 16 12:24:59 2002 +0000
+
+    Forgot to update this one, too.
+
+commit 075ab0173bb882d7fc708629e9867af321c42f8d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Dec 15 21:54:58 2002 +0000
+
+    Only check for a working C++ compiler if the avifile provider is going
+    to be built.
+
+commit 33d235cda9926c3e90ca83890514267659467f02
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 15 13:59:45 2002 +0000
+
+    if PAGE_SIZE and _SC_PAGE_SIZE (for sysconf()) are undefined, theni still guess page size.
+
+commit 3ba3594eebc2d61745ded78f73d452f8bef60df5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 13 18:36:17 2002 +0000
+
+    Added "block-all-signals".
+
+commit a5b1e845db316181528c71d391c16ca712d07be6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 13 17:57:44 2002 +0000
+
+    Don't guess page size if PAGE_SIZE is not defined, use POSIX sysconf(3).
+
+commit 76328b6d9a06540372401ac3bd03fbedfd608c5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 13 17:24:23 2002 +0000
+
+    In multi application core Ctrl-Alt-Break sends a SIGKILL to the process
+    that has exclusive access to the primary layer. No need to login from
+    network or kill everything if a fullscreen app hangs.
+
+commit fa39fbf10307ae5acef119a472abe5aecbf63b3a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 13 16:48:07 2002 +0000
+
+    Added threaded mutex and spinlock benchmark.
+
+commit be35d3eda8dd3b320ad4b343d506e54a909f5850
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 12 19:01:38 2002 +0000
+
+    Use first system found as a fallback if the requested system hasn't been found.
+
+commit 45d92cabb9b60f6425bc2cb2bd4513cadb30f1dd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 12 18:43:12 2002 +0000
+
+    Added DFB_COLOR_EQUAL macro.
+
+commit 621dd8f003f2f67b137ebb71d161a0112c7e29ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 12 16:41:14 2002 +0000
+
+    Include strings.h.
+
+commit b607f7b663bdeba2d9793fdce3fbdd5d90592390
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 11 16:50:13 2002 +0000
+
+    Added missing <linux/fb.h> includes for accelerator ids.
+    Removed ifdefs because configure already checks for the definition.
+
+commit eeb2800b84589f8ff95a397f248b2bdddfdda3aa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 11 16:45:12 2002 +0000
+
+    Added "\n" to debug message.
+
+commit 07968a837c74faad3f326178d4ab7027d06685b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 10 19:03:33 2002 +0000
+
+    Added new cshortcut.
+
+commit 704ae6c4bce276900277b5fd203f888b7eddfe9f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 10 19:02:31 2002 +0000
+
+    Added <Meta>-P shortcut that enables the cursor and sets the opacity to 0xff.
+
+commit 11b292f8c3bbb81d6d9563a4e2c5db7a66700c1c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 10 18:56:20 2002 +0000
+
+    (Temporarily) set DWET_POSITION_SIZE in window event flags to avoid endless waiting.
+
+commit b4217b59537575c21b6f469221b85b17390b0834
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 10 18:10:15 2002 +0000
+
+    Check return value of WaitForData() to avoid endless looping on unexpected EOF.
+
+commit 2ae9ee500bb7fec08f4a89b489d76d3f854b2c07
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 9 18:14:59 2002 +0000
+
+    Added a dfb_thread_testcancel().
+
+commit 6547a1a375185db87a2458efdc53f7bc9fca2092
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 9 14:57:08 2002 +0000
+
+    Always default to fbdev system.
+
+commit 9b228e9766f694246b4a30d85092394f069bc201
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Dec 6 19:17:18 2002 +0000
+
+    try to workaround a crash in the OverlayThread
+
+commit 99f157275b74fb50b17b5803673dc90cfcac6ad5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 18:22:47 2002 +0000
+
+    Don't set window->stack to NULL in window_remove().
+
+commit bf9094b4c6d056ec65bb6a4804fdde937634865d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 17:51:44 2002 +0000
+
+    Open fusion device in non-blocking mode and use select(),
+    fixes blocking in valgrind.
+
+commit 4d0565ef50e996f2c07cf8f7c0c257a7ccb9758e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Dec 5 17:48:35 2002 +0000
+
+    Added configure option --without-tools that allows to disable the build
+    of the tools. Useful for cross-compilation.
+
+commit f4a6612437b981c16fb113484a3def13e143c47e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 16:43:36 2002 +0000
+
+    Removed a bit debug.
+
+commit 68f4e63effd9a2bf73de4d561ab3d8ec0008f0d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 16:42:07 2002 +0000
+
+    Added some debug output.
+
+commit 43bb3f3ced220200b6e096d920845862de52ed1f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 12:00:52 2002 +0000
+
+    Some experimental code from Ville Syrjala to avoid tearing.
+
+commit 0dac28d8292ed1a8371c051559da86c96e931c5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 12:00:06 2002 +0000
+
+    Patch from Ville Syrjala adds IDirectFBDisplayLayer::GetName().
+
+commit bd7fd946619dad739fd3b0d4fe8a865f5d8fb01a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 5 11:57:34 2002 +0000
+
+    Added IDirectFBWindow::GrabKey() and UngrabKey() which take a key symbol
+    and a modifier mask, useful for panels etc.
+
+commit 6f271e78f27ffc314ac5159571829bd0bcfe4fce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 3 20:14:16 2002 +0000
+
+    Added all required locks that were missing
+    because recursive locks were unsupported.
+
+commit 7130b58967bfb5d6d1204a49ad6d2390860e0721
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 3 19:20:03 2002 +0000
+
+    Added configure option "--disable-text" which reduces the stripped library
+    size by ~20k on my system by removing all init, debug or error messages.
+
+commit 9b170df039e0c474cb2688ee9d59103d7c8ff29a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 3 18:06:33 2002 +0000
+
+    Removed obsolete fbdebug code.
+
+commit b9a38b67852e81519e115be1d9372e010e3b57c7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 2 18:26:24 2002 +0000
+
+    Fixed some error handling code that infinitly looped.
+    Fixed reactor related reinitialization bug.
+
+commit 0ab8188aa76c1886250ad8a0d261b2330574f844
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 2 17:05:18 2002 +0000
+
+    Fixed two reinitialization bugs.
+
+commit fde50bffa2b6bcc26f916cdf8bfbfadd63d9796b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 20:09:02 2002 +0000
+
+    Detach global reaction from layer background surface before unlinking it.
+
+commit df2b6313330bd8839c9fe5baa0fdd3992c8bdcfb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 20:02:32 2002 +0000
+
+    Slave processes on a real VT have to detach the thread going to mmap the
+    MMIO regions.
+
+commit 40b783025ffb2383bcaef36650121f7085b6f137
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 19:20:09 2002 +0000
+
+    If graphics-vt is disabled (default) at least temporarily switch to KD_GRAPHICS
+    during FBIO_PUTVSCREENINFO to avoid redraw (clear & text) of the text console
+    when fullscreen apps start.
+
+commit fd483259d0efa015afd42b97b9a66ce0b15d3eb7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 18:57:28 2002 +0000
+
+    Added RPC mechanism to let fbdev ioctls be executed by the master only.
+    DirectFB now only detaches from its tty if it's a real VT and only if
+    vt switching is enabled. This looks like a clean and working solution.
+    
+    The only limitation left is that the master must not call DirectFB
+    functions that do fbdev ioctls within a thread that was created by the
+    application, but only if the application created any thread before DirectFB
+    got initialized. And of course this only applies to master processes started
+    from a real VT.
+    
+    Added fusion_is_shared(void*) which returns true if the pointer specified
+    points to shared memory.
+
+commit a4991722c3718c8d282ef2feb10b18141be153ca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 12:40:39 2002 +0000
+
+    Updated vmwarefb patch.
+
+commit 34f6b2fe27b6a6fbcf5971c98b15628b4197cefa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 29 12:23:18 2002 +0000
+
+    Clear a layer (dfb_windowstack_repaint_all) after enabling it.
+
+commit b9b9cc4169eb5d6679168ee0ff416e10291a63eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 27 19:48:49 2002 +0000
+
+    Added setsid() call, to slave init.
+
+commit 6b77fc1c0815363a37bdb4b0e92b3f2387406114
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 27 17:20:13 2002 +0000
+
+    Added output of stacking class.
+    Window order is now the real one.
+
+commit 0a58ddd84782549459d4de0acbe1aaddb08d22aa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 27 17:19:45 2002 +0000
+
+    Fixed three bugs related to stacking class.
+
+commit 618ba23ec81a228a8c3c78fc9ff165199d3dda76
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 27 01:42:09 2002 +0000
+
+    Moved dfb_system_lookup() call to dfb_core_init(), fixes fusion_bench segfault.
+    Wait for a thread's initialization to be completed after creating it.
+
+commit 904f9d90dcec6854d8fce60686f86b0218dda495
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 27 00:12:13 2002 +0000
+
+    Detach slaves from their terminal, too. Disabling console acceleration
+    (which resulted in a kernel side card programming) in slaves is not necessary
+    anymore. Also fbdev ioctls are ensured to act directly on the global state
+    instead of the tty bound one. Not all threads get detached yet, if the
+    application created a thread before initializing DirectFB.
+
+commit 9f536f80adc619fc9f5a77482331e19c4b6ccee3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 26 22:49:39 2002 +0000
+
+    Modified the glyph surface width calculation to use 8192/font->height.
+
+commit a10827cc91a1ea395469e4266a62c128b3937467
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 25 15:23:55 2002 +0000
+
+    Made dynamic code safe for binaries with statically linked in interfaces.
+
+commit 6ce52601bc1dd44113d3ed0a772527a0876f3016
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 22 21:36:17 2002 +0000
+
+    Input device listeners installed by the windowstack construction code
+    are global reactions now. Additional layers can now be used in windowed
+    mode even after the process that enabled the layer exits.
+    Remaining TODO is to auto-disable layers via reference counting.
+
+commit 08a9fbb8ce08d8cdb91f255ec2354cc81f9e0249
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 22 21:22:51 2002 +0000
+
+    Fixed warning.
+
+commit df237a220e754751134c302251aa99600c3f7491
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 22 21:18:00 2002 +0000
+
+    Implemented the ability to attach "global reactions" to a reactor.
+    A global reaction will always be called directly by reactor_dispatch().
+    Global reactions can be attached/detached by any process. Global reactions
+    don't die if the process that attached it exits.
+    Made layer_surface_listener, layer_bgsurface_listener and
+    surface_palette_listener global reactions.
+    
+    Removed layer palette workaround removal TODO.
+
+commit 09c2b41b2c44358b8014fa1487550314b05610ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 22 18:13:56 2002 +0000
+
+    Minor updates.
+
+commit 740a730765aa01cdc84a0890f213f574135df0f1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Nov 22 11:26:13 2002 +0000
+
+    Use DFBBoolean instead of defining true and false. Updated tools README.
+
+commit 9f3fe39c806df2cfe7ba778d5ba0c051481cfc9c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 21 21:23:24 2002 +0000
+
+    Minor fix by Antonino.
+
+commit 418d6efb9c6f32f24d7e00ff64a244d44e05f173
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 21 19:06:59 2002 +0000
+
+    Color adjustment support on primary layer (via gamma ramp in direct color mode)
+    by Antonino Daplas <adaplas@pol.net>.
+
+commit a69bf2db7bd3af559781d5d9b1bce378a9c5f3d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 21 18:21:46 2002 +0000
+
+    Check for reactions != NULL, fixes default font.
+
+commit 3892db68dfcf841019e95e129e2f767e31f0034c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Nov 21 15:50:53 2002 +0000
+
+    Allow to unset a surface's font by calling SetFont() with a NULL.
+
+commit 5b28b8bedc82517f01bf563248f68db2453e0c95
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 20 20:31:39 2002 +0000
+
+    Dump windows of all layers.
+
+commit becf487f04235894673f48e46c585a1ab4b14d38
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 20 17:40:15 2002 +0000
+
+    Support direct color visual, thanks to Antonino Daplas <adaplas@pol.net>.
+
+commit 5a3d3bf783644dd81fe0419b0e363bf72cf73b52
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 20 17:38:36 2002 +0000
+
+    Forgot "-Wl,-udirectfb_fbdev".
+
+commit 519453c9e7f3e52323ca986003861e72f487be65
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 19 18:03:10 2002 +0000
+
+    Some focus behaviour fixes, especially for non-cursor mode.
+    Link layer surface to layer while layer is enabled.
+
+commit 872749aa2fd32eb735d83c9668b69722e8575103
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 19 16:41:47 2002 +0000
+
+    Default background mode of new layers is DLBM_COLOR (0, 0, 0, 0) now.
+
+commit ce62d80b1326bc3f34415ff1996134c9a50cd9b8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 18 21:59:39 2002 +0000
+
+    Allow passing NULL to unbind a shape and release its surface.
+
+commit 307dd9d9b3c266a0d88b28e68fd3d03eea12cb4b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 18 21:46:08 2002 +0000
+
+    Added IDirectFBWindow::SetCursorShape(), untested.
+
+commit be8c1e770850774d92af650a268277027a5a6aa0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 18 20:54:14 2002 +0000
+
+    Added options "--input=foo,bar", "--graphics=foo,bar" etc. that will output
+    all required flags for statically linking the specified drivers or modules.
+
+commit a9555c23398542209386bf9f3d998073959e9dcc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 18 18:42:43 2002 +0000
+
+    IDirectFBDisplayLayer::WaitForSync() added by Ville Syrjala.
+
+commit 12c71534a6a76fd5ec547f7dc3a3d8bec38a3083
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 22:36:06 2002 +0000
+
+    Added IDirectFBWindow::SetColorKeyIndex().
+    Made IDirectFBWindow::SetColorKey() lookup the index if the format is indexed.
+    Fixed warnings.
+    
+    Bumped version number to 0.9.16.
+
+commit 21ba790dc6f73367fe783f2d3f27718833e7c4ca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 22:06:05 2002 +0000
+
+    No need to do DirectFBCreate(), just DirectFBInit() and fusion_init() ;)
+
+commit c26660ce132bbab3bee21f1f2ded158d813bb7e9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 22:05:11 2002 +0000
+
+    Made memory allocation messages a HEAVYDEBUGMSG.
+
+commit 506c29cb1282ede678a634a968ae284baec73bc4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 19:56:48 2002 +0000
+
+    Patch for using the whole 32MB of Matrox G400 etc.
+
+commit 38b54fb58755215b1b2fc8edeb8944767644998a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 18:56:54 2002 +0000
+
+    Divide squared alpha diff by 16 to have it less weighted in color decision.
+
+commit d7e673e0d7376e0e648f9669d614da4417bbc24b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Nov 14 15:34:24 2002 +0000
+
+    a more reasonable algorithm to find a good color match
+
+commit 9a9eee0672f48e1907abd3a6c596ed5a66f43ffa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 03:55:01 2002 +0000
+
+    Don't do cursor magic if app is not running windowed.
+
+commit 23e39aeeb8e09ecb14aba8f1c4e9608d94d0a592
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 03:48:29 2002 +0000
+
+    Don't disable cursor on escape.
+
+commit c28cbd1eb0dea7af5a45b46f96ce134035bac92f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 03:27:30 2002 +0000
+
+    Pressing a button or a key while a windowed primary is focused
+    disables the cursor to achieve a vmware-like grabbing for fullscreen
+    apps running windowed that need raw mouse events (e.g. df_knuckles).
+    The cursor is released (shown) if Meta is pressed.
+
+commit 4a5ca7793b11fbcfafcc6706b8c393da8e7dd68f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 01:25:58 2002 +0000
+
+    Added 640x400 mode.
+
+commit cb69e068ea2d35648e411d23f44eaa23eee00491
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 01:19:41 2002 +0000
+
+    Minor speed improvement.
+
+commit ed07a3e324acdda11fc520de082354b82e527f8e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 00:56:32 2002 +0000
+
+    Added 320x200 mode, fixed 320x240 mode.
+
+commit d6825770eb79342043146f6728d0a3e9622a4566
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 14 00:28:42 2002 +0000
+
+    Pre render glyphs before rendering string to avoid a rare deadlock.
+
+commit 866ec65ff18265c23d0ff48ee74e3d7e22e63096
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 23:38:11 2002 +0000
+
+    Added dfbsummon, a surface manager debugging monitor.
+
+commit 0f7b274455becbde060a6f156f0b6ef22f35bcca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 21:22:20 2002 +0000
+
+    Added some layer palette/surface related TODOs.
+
+commit 28833e44ed8fb1edf4c07ee516d56074f5d8ea6b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 21:13:45 2002 +0000
+
+    Fixed layer palette updates in multi app core (a bit workaroundish).
+
+commit f5e340a3ed06a34e794faea629a2ec277d837552
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 19:17:26 2002 +0000
+
+    Commented out last change.
+
+commit a9605c63212e7849d3bf13dd9fec5e2069d9b656
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 16:59:31 2002 +0000
+
+    Correctly blit from LUT8 to LUT8 even if source and destination palette are
+    different.
+
+commit 6b1c7efe82d49ac4e683482c4b43af6b7b65db84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 01:26:12 2002 +0000
+
+    Added *.diff.
+
+commit 0cf3aed594dec2a25bd7b43f9997bd0fbde7d71a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 13 00:21:06 2002 +0000
+
+    regenerated
+
+commit 90285f8243765ec87c8fb25ce08deb5f7e897ee2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 23:59:01 2002 +0000
+
+    Added Fusion patch again, we don't need an extra tar ball for it.
+
+commit 4c43eb2ebde39e8ac6b7bf55ed9d6b6ea7806e88
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 23:26:20 2002 +0000
+
+    Good bye, ipc_cleanup, you've been a nice friend, but your time is over...
+
+commit 75aafdf700bb206555a160e59c4d971ae29d24ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 23:23:23 2002 +0000
+
+    Updated for 0.9.15.
+
+commit 420f489edf9876d68a94f831953f434f9e40251a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 22:56:07 2002 +0000
+
+    Moved description of Linux Fusion prior to how to build with multi app,
+    because users maybe don't read further before doing that.
+
+commit 35200ab40b90c9ef838907ede84e60dd0bbd60ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 22:46:31 2002 +0000
+
+    Vsync fix from Ville Syrjala.
+
+commit 46e4d1afbe4535331af9e2e51e69d2574c7c98db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 22:19:29 2002 +0000
+
+    Improved ioctl error handling (EINTR, EINVAL etc.).
+
+commit f45d573f7a71592bf3724f6d6564f702c75f89be
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 21:19:55 2002 +0000
+
+    Some bug fixes.
+
+commit 6b4a455c176b3be912426f38b1927e45beecfe32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 20:48:45 2002 +0000
+
+    Rewrote FusionArena code using shmalloc and linked lists.
+    
+    No remaining bit of SysV IPC! There isn't even any SysV IPC header included.
+
+commit ae6e3e9d4d125e2ff283660accb47aca7cb40b59
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 19:17:30 2002 +0000
+
+    Fixed DLBM_TILE : DLBM_IMAGE order.
+
+commit 44d52ca252ebb662ea5e589ca88f53ecd783cbdc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 18:50:54 2002 +0000
+
+    Check layer->shared->stack before repainting.
+
+commit 4c0c4366521d10c0af710512a2adccfeec34223d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Nov 12 15:11:16 2002 +0000
+
+    Added --color option to dfbg.
+
+commit 57a9fe8647ee28d49fdf292619a0474b570eb68c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Nov 12 14:22:36 2002 +0000
+
+    Added a man-page for dfbg.
+
+commit 2f50cbf1a1714d961ffb38e80de006939efad064
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Nov 12 14:08:11 2002 +0000
+
+    Added --tile command-line option to dfbg.
+
+commit b326bf1dbc57cd286f2e62a8eac1a7c2dd45940e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 12 02:42:17 2002 +0000
+
+    Added background configuration tool.
+    
+    Updated ipc_cleanup.
+
+commit f240d3714138f220f03e6d00e5477b1a19ae7225
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 11 17:33:55 2002 +0000
+
+    Updated vsync irq patch from Ville Syrjala.
+
+commit 09cbc66c3e7e8610d263999cd1a1de3b2b1c96bb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Nov 11 15:32:30 2002 +0000
+
+    check prog != NULL before calling strlen() on it
+
+commit 3fb48318ed7c8da924adcf84a9fde4d99d87a244
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 11 15:01:54 2002 +0000
+
+    Made dfb_back_to_front_copy() thread safe as skirmish is now a recursive lock.
+
+commit a95d4a3e8eab447bb2397a1d073b3e604f48ce6e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Nov 11 15:00:29 2002 +0000
+
+    Fixed some spelling errors and documented the new behaviour of 'no-hardware'.
+
+commit 325293ec542a85884bf7e4c7f44856023c35bff3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 11 05:33:09 2002 +0000
+
+    Use hardware key code for auto grabbing pressed keys (using the symbol
+    was buggy because of modifiers being changed while a key is pressed).
+
+commit 375631844924fa5395c6bfb25c9e5fe8fe201ef9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 11 05:16:41 2002 +0000
+
+    Check return value of iopl() instead of segfaulting.
+
+commit 3ac73664a0e7c5e76655ed8a8f39f885a7de3b4f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 11 03:58:51 2002 +0000
+
+    Rewrote multi app reactor code, *much* simpler and cleaner now.
+    Improved performance and stability. No message queues anymore.
+    
+    Old version via message queue:
+    
+    reactor attach/detach                 ->     8.03 k/sec
+    reactor attach/detach (2nd)           ->   323.21 k/sec
+    reactor dispatch                      ->   333.33 k/sec  (100% arrived)
+    
+    New version via Fusion Kernel Device:
+    
+    reactor attach/detach                 ->   375.09 k/sec
+    reactor attach/detach (2nd)           ->   403.88 k/sec
+    reactor dispatch                      ->   754.15 k/sec  (100% arrived)
+    
+    Now the master is the only DirectFB application with more than one
+    additional thread.
+    
+    Only one single SysV IPC resource is left (shm segment of arena).
+    Everything else is already handled by the Fusion Kernel Device.
+    
+    Support for multi app without kernel device is dropped.
+
+commit eae999f9dc3e97489484c2eb145a8bb939f0f284
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 10 19:40:05 2002 +0000
+
+    Don't block signals in DirectFB threads of slaves.
+
+commit a89f93d02ea728e3ba4519afb88168823991d4f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 9 01:20:19 2002 +0000
+
+    df_dok related bugs are fixed.
+
+commit 607229177b623f2ea434b190ce4de7096b9422f4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 9 01:18:15 2002 +0000
+
+    32 was the old value, not 16.
+
+commit b634e78a91ea36379e27e13648f8eb17ec5e7dc6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 23:15:23 2002 +0000
+
+    If multiple arguments are passed,
+    use the first one for output and others for input.
+
+commit 188b5b4956edb2e6585e78bf3f3f398491418a44
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 22:57:08 2002 +0000
+
+    Attach listener to glyph surfaces to have at least one listener attached.
+    Set glyph surface size back to the old value (maxadvance * 32).
+
+commit 2b70c8359757d7ee5bb7e29ffac7725aa4f980d4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 21:33:08 2002 +0000
+
+    Fixed off-by-one bug in image loading code (multiplication by alpha).
+    Fixes broken color keyed blits in df_dok.
+
+commit c7c12eeef97a64551aa8c4916db361ec10020721
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 21:09:01 2002 +0000
+
+    Fullscreen applications not calling SetVideoMode() and not setting the format in
+    the surface description of the primary take care of the "pixelformat=" option.
+
+commit d246298a82f99242fd0a20835678aaf6706406a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 20:16:20 2002 +0000
+
+    Fullscreen applications that are started with the "mode=" option and don't
+    call SetVideoMode() now switch to the mode specified with the option.
+
+commit 1f4080147391a9f588b5a701b4c5ecd00bbe6d46
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 8 17:41:22 2002 +0000
+
+    Implemented additional config file loading for each application.
+    
+    E.g. running "df_dok" or "/foo/bar/df_dok" will look for config files
+    "/etc/directfbrc.df_dok" and "~/.directfbrc.df_dok".
+    
+    'no-hardware' now only disables acceleration, but driver is loaded and
+    additional layers are used.
+
+commit 0e3cd6173ea63e0a9e45934c0e31b8c4a76e4fdd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 7 23:41:34 2002 +0000
+
+    Check for desc != NULL.
+
+commit 872447f29a179f361489e3cc1a237d1e8c69ae33
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 7 22:17:24 2002 +0000
+
+    Check for NULL.
+
+commit 115efd890d566c1e01629aeb9acfa2a1440bf0c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 7 22:00:58 2002 +0000
+
+    Added system hook ThreadInit() that is called at the beginning of new threads.
+    The fbdev system detaches the thread from the controlling tty.
+    Otherwise mode restoring done by input threads (if layer is orphaned) goes
+    to the tty the app has been started from. The main thread has been detached
+    eversince.
+
+commit c30f9fa5a6b4d831fcdf354f1b0d32d4e8487cf9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 7 21:40:40 2002 +0000
+
+    Fix deadlock during lease of orphaned layer.
+
+commit 98beff28a9eb3a6cf77f0f4eabc9cb2914d19934
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 5 22:57:44 2002 +0000
+
+    Show window of windowed fullscreen apps on first Flip.
+
+commit 6423f0879866238b21eb0e3cded47b598c2f4fe0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 5 22:49:04 2002 +0000
+
+    Commented out state locking in listeners to avoid a deadlock between
+    state/reactor lock (locked in different order by two threads).
+
+commit 7a964df9c394d8d90241ebf993a8e6cd7d7eed56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 5 17:10:14 2002 +0000
+
+    Interpret EINVAL like EIDRM in receiver.
+
+commit 17260aea820fecff16159b2df560b68a08049cd0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 5 14:48:56 2002 +0000
+
+    Made skirmish recursive mutex in single app core. Multi app skirmish
+    has to be made recursive, too.
+
+commit e19241a150340c1fc6c19d33e4a92cda25c28d12
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Nov 4 19:19:25 2002 +0000
+
+    check if the window has a surface before trying to access its palette
+
+commit c9c136115ce00f789bf74848f2528364aae6a1f2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 4 19:04:11 2002 +0000
+
+    devfs support
+
+commit 75b3fa0ccd7ec1f2b07762406317e6591b5c875d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 4 17:40:16 2002 +0000
+
+    Added state locking to dfb_state_set_source/destination() and the installed
+    listeners. References to the surfaces are now increased/decreased.
+    More stable now, but had to use Unix98 recursive mutex.
+
+commit 5f84191c2212d32feb8e414fa2a69ab8ac3b2eb5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 4 16:42:21 2002 +0000
+
+    Use new in-kernel fusion property.
+
+commit f2382dfb9c86c805c98def6f73aca9b648950700
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 2 05:20:21 2002 +0000
+
+    dfb_surface_attach() was called too early.
+
+commit decdaac99fda82242008b175f60db0c1f72dea34
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 2 01:44:40 2002 +0000
+
+    Use Fusion Kernel Device.
+
+commit b76ce0bb04ae3a79ae22e88bcf45b29d1d5ac66b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 1 23:06:35 2002 +0000
+
+    Added DFBBoolean.
+    
+    DFBWindowEvent fields cx, cy, buttons, locks and modifiers
+    are always set now (except for DWET_DESTROYED).
+    
+    API change
+    ----------
+    
+    IDirectFB::CreateEventBuffer() no longer attaches input devices and doesn't
+    take input capabilities.
+    
+    IDirectFB::CreateInputEventBuffer() implements the old behaviour with an
+    additional argument "global". If global is DFB_FALSE events will only be
+    delivered if this instance of IDirectFB has a focused primary (either running
+    fullscreen or running in windowed mode with the window being focused).
+    
+    Version is 0.9.15 now.
+
+commit 58dabf0cde6d5cef26e5e18dc31efb7bcecd27b2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Nov 1 22:37:42 2002 +0000
+
+    Don't write out of bounds if the default cursor is loaded into a non-ARGB
+    surface (--dfb:no-translucent-windows).
+    
+    Switch the display layer palette to the one of the focused
+    window. Added TODO item since this needs more changes.
+
+commit 263b1549e5baccfa6ca6f4dcd7fa7bf2cf0a4999
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Nov 1 21:38:20 2002 +0000
+
+    notify listeners about a palette change in dfb_surface_set_palette()
+
+commit c024e49791e449a68ba291570993d8bb6921f022
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Nov 1 21:37:44 2002 +0000
+
+    Use the size of the palette in dfb_palette_generate_rgb332_map() instead
+    of assuming 256 entries.
+
+commit 54d03df4f5000d31d01b1135b822cbf8604c6a1d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 1 17:26:09 2002 +0000
+
+    Implemented implicit grabbing of keys when they are pressed.
+    Subsequent events of this key are sent to the owner.
+    Releasing a key ungrabs it. If a window is closed while grabbing a
+    key, the window gets a pseudo release event. If fullscreen mode is
+    entered all keys are flushed (ungrabbed sending release events).
+
+commit b5b77ad5daf033e8afc32c5aa6da3fade4c305e0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 1 13:38:21 2002 +0000
+
+    Added threaded skirmish benchmark.
+
+commit fb1a3fae3aa6bc5e4f63eabae2088bb76c1159e4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 19:45:42 2002 +0000
+
+    Number of reactor_dispatch() calls depends on single/multi app config.
+
+commit 7f00497df6498388739fb5733d531d07fa97afc6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 19:40:01 2002 +0000
+
+    oops
+
+commit f81fa71a1c29a91a4b360bdf209189360b0b2d71
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 19:39:11 2002 +0000
+
+    Added reactor_dispatch() benchmark.
+
+commit 5634a44dd5f686e95cc4aeeaf037ca890cb806cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 19:17:14 2002 +0000
+
+    Added reactor attach/detach benchmark.
+
+commit 22e0df5bba69b00bc8aca3badb017d200cadbaea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 18:12:23 2002 +0000
+
+    Forgot initialisation of waiting counter.
+
+commit 8702a216f37bd91b0db2bba34621bb99355ae9f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 17:57:23 2002 +0000
+
+    Only call pthread_cond_broadcast() if someone is waiting.
+
+commit bc7223328c94a52f302d2b9da17a9cc3a1e75ff0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 17:52:38 2002 +0000
+
+    Added missing pthread_cond_init.
+
+commit e2c4accb665b8b418999f7553ec2ee42961f7713
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 17:38:42 2002 +0000
+
+    Added Fusion benchmark application.
+
+commit d5a7f93d5c22680bd11aa839f33074d8e8a978b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 30 14:25:24 2002 +0000
+
+    Use stderr for the banner, like all other messages.
+
+commit cac8cc70c0925b84539afcd6701caa2bdfe2ea6f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 29 18:39:31 2002 +0000
+
+    Don't interpret negative ref count as a negative errno until ref counter
+    bug is fixed.
+
+commit cb125aeb7f14f3a6d4f7b8e528b67dcb4178a74b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 29 15:10:46 2002 +0000
+
+    last commit before 0.9.14 release
+
+commit ff4a9571567ba135ea37ab175dbbf9d717aa0ad8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Oct 29 14:54:56 2002 +0000
+
+    added a note about dfbdump
+
+commit a6985f74f977fbee3b012a5f11c0d8bbd1672cc9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 29 14:41:18 2002 +0000
+
+    updated
+
+commit bee14a47b118b0683aa4a6c267dc13a0cbd719f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 29 14:40:45 2002 +0000
+
+    Has an extra CVS module now.
+
+commit f8f052ebf67f216bca5f99983a375bf7016896cc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Oct 29 13:57:58 2002 +0000
+
+    Added support for DFDESC_FIXEDADVANCE.
+
+commit 3ac041050e8e7edabec80b042f3959f706528615
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 29 13:42:43 2002 +0000
+
+    Added DFDESC_FIXEDADVANCE as a workaround for using proportional fonts fixed.
+    
+    Added DFFA_NONE.
+
+commit 7743e4f9d1e5048677ff5e235c2411bd06afa230
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 19:50:21 2002 +0000
+
+    Assure that glyphs with an empty bitmap are inserted into the glyph cache
+    with zero width and height. Simplifies some checks performed when rendering.
+
+commit c4c24b2fa8c940cdb2357110ac3c02d30f173bff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 19:28:48 2002 +0000
+
+    Use larger glyph surfaces to reduce expensive switching
+    (caused by reactor attach/detach).
+
+commit 04c4d41e7f2865137ac09dee0d5f03a5685ae523
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 19:22:49 2002 +0000
+
+    Use CoreThread with new type CTT_MESSAGING.
+
+commit e38d92cb96684744b3c69e9abecb5d93d31f14dc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 19:19:18 2002 +0000
+
+    indentation
+
+commit 7cd55fd06ea3e8f15e156455ecc7d9461e4209a8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 18:58:00 2002 +0000
+
+    Check x too in simple pre clipping of dfb_gfxcard_drawstring().
+
+commit 08f9ed3458ca32158a17e7b067018024495acb0d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 18:27:04 2002 +0000
+
+    Added a description of the builtin "window manager".
+
+commit bcae600e798df938ed707c84238b19f24c91ac7d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 18:23:08 2002 +0000
+
+    DFB_CFLAGS are behind CFLAGS again. Otherwise "-g -O2" may override the
+    debugging/optimization options of DirectFB's configure script.
+
+commit c7e6ec291924706f7ed314591cb0d4866b4d4e5d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 17:43:00 2002 +0000
+
+    Multi app related.
+
+commit 3b4a858beb388ee96a05e7987154a2e1ba3fe7ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 17:36:16 2002 +0000
+
+    SetOpacity() for sub picture layer fix by Ville Syrjala <syrjala@sci.fi>.
+
+commit 37f63b342a9097a61e08e3e9217587c7477150ba
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 28 17:22:21 2002 +0000
+
+    - added OpenBSD to the list of supported operating systems
+
+commit 29afc314c55bf34bbc097384249693c808a23ab7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 17:19:28 2002 +0000
+
+    The linux-fusion module doesn't only give performance, but also more stability.
+
+commit 9c03ef46e49da0fec24b0f496067da91f9d3bea9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 28 16:01:27 2002 +0000
+
+    Fixed fusion_object_destroy() for calls outside the object destructor.
+
+commit 1999736ad9e82c8701762e1716fc39b8ae2e0458
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 15:24:26 2002 +0000
+
+    Added sdl.h to SOURCES.
+
+commit 8c8b5823b00e9bd53d2ab1aec8d903542ee2ad7f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 15:12:19 2002 +0000
+
+    added more ifdefs around MMX and SSE code
+
+commit 18b9e85a2e9d84fd900780c5260e140137ffa302
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 13:31:57 2002 +0000
+
+    Updates.
+
+commit 258b63376e4b5772f45e0ffd9b8f8428a5c92c97
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 13:20:41 2002 +0000
+
+    Check if binutils support SSE assembly and compile the SSE code
+    conditionally.
+
+commit f003aa5a6ee0ebf9a6280d983cacc100f5580d4f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 12:39:41 2002 +0000
+
+    oops
+
+commit 1c21bf783d340a7f83a9743cc10c80c9ae45b59a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 12:35:53 2002 +0000
+
+    Simplified the configure tests for MMX, fbdev and sdl.
+    Set SDL_CFLAGS and SDL_LIBS using $SDL_CONFIG so that people can specify
+    which sdl-config to use.
+    Use SDL_CFLAGS and SDL_LIBS in the Makefile.
+
+commit 3ae8eb618ea4cf5fbbf87e46cc1af8ba1815eaad
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 12:07:17 2002 +0000
+
+    Corrected spelling of frame buffer.
+
+commit a16602230461339fa699e365b4e4dc6677306a53
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 11:56:52 2002 +0000
+
+    moved some lines around
+
+commit c0fc87b3421f3edb0a56c21fc2bd6ab9bb23a257
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 11:32:27 2002 +0000
+
+    Don't build MMX code if MMX was disabled by configure.
+
+commit e265759961a68b279a082770bbf8a7821327fda0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 11:13:24 2002 +0000
+
+    Reformatted some comments; no changes.
+
+commit e1a64a38820371f443ab8df8593bff476e63941e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 11:03:20 2002 +0000
+
+    Document the new pixelformat parameter in directfbrc.
+
+commit 8976c0c9c472c650cc32c999e75c8b26994a658f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Oct 28 10:37:59 2002 +0000
+
+    Fixed obvious typo which caused --dfb:depth to fail.
+
+commit 29a90abc9ded81ee43b2a0b566cf1145196f0508
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 18:17:16 2002 +0000
+
+    Improvements to the spec file by Till Adam.
+
+commit e57466f9f7b8bc1f8a3916b0687b8af2925dca59
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 16:56:26 2002 +0000
+
+    Include the generated spec file in the tarball as well to make it
+    possible to build RPMs directly from the tarball.
+
+commit a951621daa198a0b3a3e994b03addcf9c2f054f6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 13:19:44 2002 +0000
+
+    code cleanup, no changes
+
+commit 524ecb10f1bb0c2d0960acf15cedd8583ebf7b20
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 13:01:29 2002 +0000
+
+    Explain how to use the multi-application core.
+
+commit 972e1e3df8fa40b495e5f024672c52b9d50e39c9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 11:18:22 2002 +0000
+
+    Removed cflags_set hack from configure.in. We don't need it any longer
+    since we don't touch CFLAGS.
+
+commit 23179f711ba2a49249a85496037a540b1ec54ee2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 11:12:00 2002 +0000
+
+    Applied patches from Andreas Oberritter <obi@tuxbox.org>:
+    
+    Call libtoolize from autogen.sh since newer automake versions don't do
+    this for us anymore.
+    Use AM_CFLAGS instead of CFLAGS, which is a user variable.
+    Check for C++ compiler in configure.
+
+commit f517047ea3bbf6b70f02dac8a6743ebc93051019
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Oct 27 10:58:39 2002 +0000
+
+    Added directfb.spec.in based on a spec file provided
+    by Till Adam <till@adam-lilienthal.de>.
+
+commit a8ae81b36e401fd22beab07fdd14a7b29b7dbee1
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 19:21:53 2002 +0000
+
+    - dont use RTLD_GLOBAL if it is undefined (compilation fix for OpenBSD)
+
+commit 60dc872a9ac579bcb794ddc7d1b0993c6f05beb2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 19:15:58 2002 +0000
+
+    - dont use RTLD_GLOBAL if it is undefined (compilation fix for OpenBSD)
+
+commit 3351b0d9caaca1cdf5446da51c868766d361d38f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 19:10:42 2002 +0000
+
+    - fixed typo, mention OpenBSD
+    - initial OpenBSD support (incomplete)
+
+commit 28b8a259425b9ab1f8e278e72c24f4b84e3b2fc0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat Oct 26 18:20:16 2002 +0000
+
+    reformatted
+
+commit 67081316cacf6b2ba70a3038ee6f7c159a42b07b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 16:01:15 2002 +0000
+
+    - added section on supported operating systems
+
+commit 42ccf3f0defbbdffa7a0f48859fce5f5b02e0b3f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 12:58:51 2002 +0000
+
+    - NetBSD compile fix: only use ENOTSUP if it is defined (missing in NetBSD)
+
+commit 4b253770636b4c1ee26434ec2ac8920d9d3e3c37
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 26 12:53:41 2002 +0000
+
+    - added support for NetBSD (tested on NetBSD-1.6)
+
+commit cef20e49dbb89402adcdea4ad219e36f6c1232bc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 17:14:55 2002 +0000
+
+    The option "pixelformat=" does work with windowed fullscreen apps, too.
+    If ARGB is specified, the window will be alpha blended.
+
+commit 2e3ef3019acdcea1fa3798cb732eb3b6851ef8de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 16:30:04 2002 +0000
+
+    Windowed fullscreen apps can now be given a window size via the mode= option.
+
+commit 1a6fb8b5e2bf280805986de654d637e4ed0c6e8a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 14:51:53 2002 +0000
+
+    Whuuuhuuu, Cyber Pro DirectFB driver release in 0.9.14 ;)
+
+commit 55daa6697a2c11d83e4b9db00e12a0d692c3cd70
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 14:25:01 2002 +0000
+
+    Moved all static variables into instance struct to make GIF loader thread safe.
+
+commit 21cd89150883ecef5096503e034be0692286a9c8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 13:52:14 2002 +0000
+
+    Fixed evil bug: wrong parameter order to qsort resulted in unsorted color
+    map in FindColorKey. Fixes color keying of a very few GIFs.
+
+commit bc722f3b1d4756c8e1af6d0211555a14e7376c9b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 25 13:12:56 2002 +0000
+
+    Applied patch from Johannes Stezenbach <js@convergence.de> fixing some keys.
+
+commit 97693660e424e0fe94b97178ba30f5d2fc553f18
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Oct 24 11:32:30 2002 +0000
+
+    improved README
+
+commit 21efc94ad9c3f112d0e5f96043324a6650d3392f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 16:59:30 2002 +0000
+
+    updates
+
+commit ddd9be0ad6762aaf5e4825aab77b1d238c1f3ae3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 16:00:18 2002 +0000
+
+    Use thread functions for bone collector loop.
+    Added thread type CTT_CLEANUP with priority -15.
+
+commit 43afcb8e384b3f9b32ef5893842e22f92c8f0ed0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 15:59:30 2002 +0000
+
+    Update from Ville, return -EFAULT if argument is not a valid pointer.
+
+commit 273424f5ccd7110bf537a126b3a7018f94b74fae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 15:58:22 2002 +0000
+
+    YUV 4:2:0 chroma plane setup fix from Ville Syrjala <syrjala@sci.fi>.
+
+commit c27a0f5888137aee0f9ad608811a99cb8e8d9686
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 15:23:38 2002 +0000
+
+    Use 0x20000000 instead of 0x70000000 as the shared memory base address
+    to avoid collision with stack on MIPS.
+
+commit 67c32e53e6dad75b18206f86b4b894b4fab6d2c2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 14:56:19 2002 +0000
+
+    Reverted my changes regarding the primary surface for NORMAL mode.
+    The old behaviour made more sense actually.
+
+commit 353101270b380302f63ad0feae474b4bab9388de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 13:12:17 2002 +0000
+
+    Changed WM keys a bit:
+    A (abandon)  - lower focused window to bottom
+    S (show)     - raise focused window to top
+    X (eXchange) - cycle through windows (not having DWOP_KEEP_STACKING set).
+
+commit e24814f174308e07a3c989eac48cbbacd8e6f8f2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 23 12:49:59 2002 +0000
+
+    Don't try to destroy dead reference.
+    Default to graphics-vt only if vt-switch is disabled.
+
+commit b80ffa4425abf25a669e5485da28881c2e4c91e5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 12:14:18 2002 +0000
+
+    Defined THREADFLAGS=-D_REENTRANT and added it to the cflags given by
+    pkg-config and directfb-config.
+
+commit 983de2c37dbc97fcfa49c9f3dd35ced97d97f2d5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 11:10:50 2002 +0000
+
+    some cleanup
+
+commit 3fc31acf47a714fa30971a362a19307e3acf1102
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 10:55:54 2002 +0000
+
+    beautified configure output
+
+commit 8ab677b03021b1bd283b13c0f967ae0959da54a8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 10:02:41 2002 +0000
+
+    Creating a primary surface in normal mode will now result in a fullscreen
+    window with options set to KEEP_POSITION, KEEP_SIZE and INDESTRUCTIBLE
+    which is probably what people expect.
+
+commit edd7eba3955e6565ec65a74aa647ed758c2d0dfc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 23 09:50:04 2002 +0000
+
+    Initialize the primary width, height and bpp from the primary layer
+    instead of using some arbitrary values. Ignore width and height from
+    the surface description when creating a primary surface in NORMAL mode
+    since we do that for the other modes as well.
+
+commit 157efe371863ede34d0e8bc78525487efa158be5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 21:56:35 2002 +0000
+
+    Windows can now be cycled via WM-S (to front, focus).
+    Pressing WM-X puts the focused window to the back.
+
+commit 0d638b263d576dc119830123d2ac0bdc4af52fab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 20:33:20 2002 +0000
+
+    Null pad opacity.
+
+commit 280be9e01d5f314c6f978d03e5cf9e6b69cc1a57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 20:29:07 2002 +0000
+
+    Added "[no]capslock-meta" enabling mapping of CapsLock to Meta on keymap level.
+
+commit 67faba53f021b270eef1d677d1b4e66534299112
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 19:54:03 2002 +0000
+
+    Ensure a focused window in dfb_window_set_opacity() only if window disappeared.
+
+commit aa9d20bd77e2832431d98b0f2cff0b2776be6522
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 19:48:12 2002 +0000
+
+    Use base level symbol if shift level symbol is null.
+    Fixed debug message new lines.
+
+commit 9dddaa6153e64d1250345b73894b19eec089073a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 17:36:05 2002 +0000
+
+    Add "0" argument to vsync ioctl.
+
+commit 2ecb93bb3e9f1c06313a08dee8738b6d86a01ce9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 17:31:33 2002 +0000
+
+    Don't detach bg image listener manually, keep the reaction in local memory.
+
+commit d803ac00b111179d85e774c9aabb7c800b7b9deb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 16:34:37 2002 +0000
+
+    Fixed crash when a foreign reaction is removed.
+    Foreign reactions are now disabled during detach, but removed during
+    the foreigners reaction loop.
+    Relase background image surface after setting it.
+
+commit 073787201ff1a9311f8012e2e8241e19e4574a17
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 16:08:37 2002 +0000
+
+    Accidently committed signal change in DFB_ASSERT.
+
+commit dcecf047f713bb23ee1c79f94fddc768fe46cf97
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Oct 22 16:07:09 2002 +0000
+
+    some updated to the NEWS file
+
+commit c83a20bf14a2837301d4bb14a1da76a67e8fecc8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 16:00:12 2002 +0000
+
+    Reverted change that seems to break mode switching if started via suid root
+    from console.
+
+commit b82fd384bb6614f59e0b3888d57d92b5d1196e2a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 15:56:04 2002 +0000
+
+    Use LUT8 if depth is 8 (e.g. default mode or SetVideoMode()).
+
+commit 86cecb5e6e638cf5267d055583532b0c446bff21
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 22 15:34:45 2002 +0000
+
+    New vsync irq patch from Ville Syrjala <syrjala@sci.fi> with support for
+    the second head.
+
+commit 5de8f80d3a8bf20cfcf778900545c2477b11d4a0
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 22 15:21:25 2002 +0000
+
+    enable RGB332 support by default.
+
+commit cc92d4fd013877198e30867c2f2fc3a03ee9464e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Oct 22 15:12:33 2002 +0000
+
+    minor code cleanup
+
+commit 50aa6a28f8e3a6287a4363c23bdc97791f509539
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 22 15:08:18 2002 +0000
+
+    declare ModuleDirectory as extern to fix linking problems on darwin
+
+commit c7528e751c171aa5631cedbaffe1a560476d599d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Oct 22 14:37:26 2002 +0000
+
+    Fixed --dfb-help output.
+    Documented the directfbrc parameter matrox-tv-standard.
+
+commit da118317b4ebd1a45ac6d25c9faf1601ba6ec395
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 22 14:22:53 2002 +0000
+
+    - fixes for automake 1.6x on non-linux platforms
+
+commit dbc5d38f0c1c1c668221d7c32076a02bc01aed3e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 21 19:37:54 2002 +0000
+
+    Use graphics-vt by default.
+    Use no-vt-switch by default if started without root privileges.
+    Open mouse device O_EXCL.
+    DirectFB now works while gpm is still running.
+
+commit af51d4a6c01a7b84b08580029c19a5b70827e67e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 21 18:31:16 2002 +0000
+
+    Fixed crash in debug mode after shutdown.
+
+commit cd6a7c3b69ec4481942d516599ccd52ce42a9a2c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 21 15:57:15 2002 +0000
+
+    Fixed memory corruption caused by a too early free.
+    Really use fusion_get_millis() now for debug output.
+
+commit bdf40ade4c6245239c5f26eba72adf126032819d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Oct 20 13:11:22 2002 +0000
+
+    - applied patch by Till Adam <till@adam-lilienthal.de> which fixes build
+      on MDK9.
+    
+    (This also fixes problems with autoconf-2.53 and 2.54)
+
+commit 0064f922863ee6f0371581807ffb55a2048c5d5f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 18 19:27:20 2002 +0000
+
+    Fixed segfault in IDirectFBSurface_Window_Flip() if window is destroyed
+    before its surface.
+    Removed unnecessary fusion_ref_zero_lock() in reactor_free().
+
+commit e609a4b877308b57729d7418546cb16e8ab19117
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 18 17:34:03 2002 +0000
+
+    For a windowed primary surface, accept setting of width and height in the
+    surface description as a second way to set the size (first is SetVideoMode).
+
+commit c68333c1e784b3255b85e844db15be81773006d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 18 15:49:09 2002 +0000
+
+    Assertion message shows pid and milli seconds now.
+    
+    Added more safety and debug output to window destruction code.
+    
+    Added fusion_get_millis(), debug messages of all fusionees
+    have a synchronized milli second counter now.
+    
+    Added some safety and assertions to reactor code.
+
+commit 5e61fc4a42ed3e606af86c20d8bb477e2b8c35fd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Oct 17 08:55:54 2002 +0000
+
+    Set the button mask in DWET_MOTION events.
+
+commit 0291fdc6a92cd8ae54cdda6dfbaf2c1f2d4d9c90
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 16 12:48:22 2002 +0000
+
+    Added quick guide.
+
+commit bb60470edc0519ca071aad8928bab7cdbec7245c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 16 12:43:09 2002 +0000
+
+    Added experimental kernel device for a much better implementation of
+    the fusion concepts. For now FusionRef is implemented in kernel space.
+    The old implementation using semaphores doesn't work properly because
+    undo counters are hold per process id. But the reference should be valid
+    for all threads (processes with the same fusion id).
+    
+    You have to apply the patch to test it, configure checks for linux/fusion.h
+    and uses the old implementation if the header isn't found.
+    
+    The patch is here for quick testing. Will add a new cvs module with all
+    new files directly checked in and a patch for the modified.
+    
+    The new implementation should be even faster as there is only one system
+    call per fusion_ref_* user space library call.
+    
+    The undo stuff is working as supposed now (per fusion id),
+    but fusion_ref_zero_lock() is not implemented in kernel space yet.
+
+commit 5da2f4330b9fd8e8795d974c12f150c5fa656639
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 16 11:43:09 2002 +0000
+
+    No inlines if debug is enabled.
+
+commit 9737b15b1e871f2c6df87cddf0b53b757e46bd6f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 15 21:05:36 2002 +0000
+
+    Better error handling.
+
+commit 92baa32be41ec4cc7348a71778b6b0254be156fb
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 15 19:42:59 2002 +0000
+
+    include missing signal.h, fixes compilation on freebsd 4.7
+
+commit 82b18f908609d7c80a44bd8f5865ad19768d7e88
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 15 18:30:54 2002 +0000
+
+    Fixed blocking in fusion_ref_down() if reference counter is already zero.
+    Prints an error message and returns FUSION_BUG now.
+    
+    Improved debug and error output.
+
+commit bf9351e5f3c05178562c2253938fd2fb7dabe729
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 15 16:55:18 2002 +0000
+
+    Added magic value for debugging memory corruption related stuff.
+
+commit 50ee35079a508d3e7c34a6cb711c26db65d00df1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 14 20:49:28 2002 +0000
+
+    Decode first picture only.
+
+commit 4387733d8fb6b4eec8dfd76bddbc2dfa73c6bcc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 14 18:57:34 2002 +0000
+
+    Moved all global variables into instance struct.
+    Removed some more unneeded stuff, got MPEG2 code < 5000 lines of code.
+
+commit 5aae3239b2c5f6b0a7b1dc88be1b19e807e5ccab
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 12 17:19:06 2002 +0000
+
+    added filter for incoming events, much smoother now
+
+commit bd126091806f94ff89e838a8d5cd553590b82f71
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 12 15:17:05 2002 +0000
+
+    added driver for ucb1x00 based touchscreens (used in the "tuxscreen"
+    device).
+    
+    TODO:
+      - do not hardcode touchscreen config (read from config file)
+      - filter incoming events, there is too much noise
+
+commit 8d9fa5242bc5de866b9ae1d09686b113d7cdc764
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 11 18:36:10 2002 +0000
+
+    Added prefix to all non-static methods.
+
+commit 3f5ee601c25bdbb1f32175f330f28d0669c54c3b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 11 17:49:51 2002 +0000
+
+    Fix crash due to static variables.
+
+commit a6b7a26447917aac963215c0b9a42732822cceaf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 11 16:02:53 2002 +0000
+
+    Added MPEG2 I-Frame image provider derived from mpeg2decode (mpeg.org).
+    
+    Need to move global variables into instance struct.
+
+commit 5ab7e6ca2f9cfcd5f094aef528f07ad027ba69dd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 11 16:00:35 2002 +0000
+
+    Fixed keyboard handler for screen dump and sending SIGINT.
+    Fixed debug messages (newline).
+
+commit a80459a3e0b3d46bf14802dac661bd61569baf5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 11 15:59:09 2002 +0000
+
+    Added simple test if flipping (updating) a window is necessary.
+
+commit b44edec5e5ab6ea4aead2e2f5ea87837ace8b1e1
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Oct 11 01:38:59 2002 +0000
+
+    updated driver to compile again
+
+commit 80670ec105ccae04ee6e88a7dc8cd8cd5c85ca8f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Oct 10 16:27:27 2002 +0000
+
+    if the video mode was tested/set successfully, check if there is enough
+    video ram (this is for broken framebuffer drivers). maked DirectFB work of tuxscreen.
+
+commit 617ca157470464dcad0290a6fdfaa367cbe4d963
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 10 16:01:30 2002 +0000
+
+    A '|' too much.
+
+commit 12c8b2b46330d958f11c6e5fad8e82996ffcf88f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 10 16:00:39 2002 +0000
+
+    Fixed system back buffer fallback.
+
+commit ab21f925b728c4ef8db05782c75f283f17cad5f2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 10 13:40:15 2002 +0000
+
+    Minor change in focus handling. Leaving a window unfocuses it.
+
+commit 48b3b54cd5df4eb25a7ea74621e67ae4e034ce25
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 9 19:32:42 2002 +0000
+
+    Return NULL in window_at_pointer() if cursor is disabled
+    reulting in the top most window getting focus.
+
+commit 633f508e9b1f72b102fce6a91c6f84a18de36d78
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 9 18:28:47 2002 +0000
+
+    Added -lm to the linker flags for libpng.
+    Don't install dfbdump.
+
+commit b5071efa0f26623825e06ffb87678c4817c128e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 9 17:22:38 2002 +0000
+
+    Fixed RequestFocus.
+    Added window opacity to dfbdump output.
+
+commit dc65bfd87a3b23507e99e1bd15472d1c1e378529
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Oct 9 13:09:16 2002 +0000
+
+    fixed typo in a comment
+
+commit 21dc6579b799ff1f38759b0a5fb7327dbbd99d1f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 19:38:38 2002 +0000
+
+    Invisible windows are not allowed to request the focus.
+
+commit ae00cfa7b389194cf0d523096dd89d3555f6a0a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 17:38:49 2002 +0000
+
+    fixed bug message
+
+commit d268c462861674375caeb42ec4221617ec8ce050
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 16:09:32 2002 +0000
+
+    removed debug line
+
+commit 0261a9e78bb8dcf406a3fbaf05fcfaed6adcb6fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 16:02:03 2002 +0000
+
+    Fixed joining, got broken an hour ago.
+    Added assertions.
+    Lock/unlock fix in arena code.
+
+commit 41b7ab030a33b163f4cca24ccf69ba4fec9df8ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 15:02:49 2002 +0000
+
+    same for single app
+
+commit 0b1f25c4e1095de06a48fc65e7a223baed526344
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 8 15:00:21 2002 +0000
+
+    Better error handling in init code.
+
+commit ee0cb85b717770d68e8b2dc18d4ab2d201835308
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 2 19:37:23 2002 +0000
+
+    Moved layer config stuff from IDirectFBDisplayLayer_Construct to IDirectFB.
+
+commit d7f6738c5f4f18ac58b6edfe8fa380023104c34e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 2 18:37:15 2002 +0000
+
+    Cleanup of DirectFBCreate.
+
+commit a67bf6c0af13261e28361dd104270fe0c5e71569
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 2 17:42:03 2002 +0000
+
+    Speed up reactor_attach/detach by writing reaction information to a
+    provided memory location which is also passed to reactor_detach.
+    Check depth specified in the configuration.
+
+commit 286d23436e30c0f489dfb5aa51b84ac0a3b498fb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 2 14:48:22 2002 +0000
+
+    Don't detach reactor threads.
+
+commit ce761a54fc883f879bde627e5fa99bb56dbc62c7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 30 17:09:10 2002 +0000
+
+    arg, ref/unref typo
+
+commit 7c0901730957d2bdc8c3a0b63a5806f19e87de65
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 18:31:15 2002 +0000
+
+    Event buffers created by "IDirectFB::CreateEventBuffer" will discard raw input
+    events until the application is fullscreen or has a focused window (primary).
+    Buffers that always get input events can be created via IDirectFBInputDevice.
+
+commit ab05499e6350551acf23245f93a56101d648a56d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 17:23:54 2002 +0000
+
+    oops
+
+commit 925b248798fa7627ee278033710b078b9d0a6f61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 17:02:21 2002 +0000
+
+    Removed more unused stuff.
+
+commit bcc7c4c604663ec248a43d9502f5581b818d392d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 16:50:21 2002 +0000
+
+    minor optimization
+
+commit ff53e701d4fe411f5346e9d89567f35ce2cc092e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 15:52:49 2002 +0000
+
+    Fixed copy'n'paste error.
+    Don't print error message if opening /proc/... failed.
+
+commit aa0037716dbe73b529afce119f3fba732cc09165
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 14:16:27 2002 +0000
+
+    Fixed MMX test.
+
+commit d2ff259de54af8f675fc0459b8c0267ff475da29
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 14:15:02 2002 +0000
+
+    minor fix
+
+commit a3437ed8163af1d42278896800f6f039b4a25265
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 13:54:43 2002 +0000
+
+    Assembler routines converted to inline assembler,
+    thanks to Johannes Stezenbach <js@convergence.de>.
+
+commit 12013430c0a1b9ea8f8389af1b7a124f00cde2ec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 12:51:04 2002 +0000
+
+    Added Billy Biggs <vektor@dumbterm.net>.
+
+commit 444e10319e0a456a2e26bb478632cede3a679c61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 12:50:50 2002 +0000
+
+    Applied patch from Billy Biggs <vektor@dumbterm.net> adding
+    IDirectFBDisplayLayer::GetCurrentOutputField(), experimental and may change.
+
+commit b05256f758d208a246c04e4783689b45fa92a67a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 27 12:37:45 2002 +0000
+
+    Destroy windows only in IDIrectFBWindow::Destroy(), do unref otherwise.
+
+commit 1d003c191c32b7444af01724ad6dce8adf6bbb8a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 26 16:25:14 2002 +0000
+
+    Use new module handling for core systems.
+    Added fusion_ref_stat() for debugging.
+    dfbdump now displays the number of references in front.
+
+commit c755b5b071e46d2170b0297542db96f891bf1692
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 25 14:54:39 2002 +0000
+
+    Fixed multi app build.
+
+commit 2bca0eca6df894ed0738fd848ff9feb7e623a22b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 25 11:18:42 2002 +0000
+
+    Graphics drivers are handled via new module functions now.
+    Removed obsolete abi version stuff from graphics and input code.
+
+commit 6cd3eff8809dbb17f9b84c75cccca3c77b85a313
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 25 10:21:16 2002 +0000
+
+    Added the ability to change a window's opacity by holding Alt while holding
+    CapsLock or Meta moving the cursor on the x axis (for wheel less mice).
+
+commit 764a9d32fc1308f5be2ac6ca13c775921e664cb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 24 17:38:02 2002 +0000
+
+    Added another assertion.
+
+commit 0115d9cd04d3ad572063a82570a6ac3a4118d09b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 24 17:35:21 2002 +0000
+
+    Added new module management functions featuring module references/unloading.
+    Input driver modules are already handled this way.
+
+commit 96a06c05c51ac94ccc4420461c0d4602ed112d46
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 23 15:22:21 2002 +0000
+
+    Implemented Bop_a8_Kto_Aop, Bop_a8_SKto_Aop, Sop_a8_Kto_Dacc, Sop_a8_SKto_Dacc and Sacc_to_Aop_a8.
+
+commit 5d09bfa1218a4834624f91aba72ad74fd32923c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 23 14:57:11 2002 +0000
+
+    Add "-ldl" and "-lpthread" or "-lc_r" conditionally.
+
+commit a0abdc42925f10673c191765bb76f69e9970ef26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 23 13:58:09 2002 +0000
+
+    Updated static build script including support for sdl.
+    Uses pkg-config now to determine prefix and module directory.
+
+commit 57cffccd07db9f49b755a389f86839b94c4a6852
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 23 12:48:24 2002 +0000
+
+    Added required quotes for test in case CFLAGS have been set.
+
+commit f55e050dad82d7f20c46ff3b56168c4b53824f74
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Sep 23 11:47:55 2002 +0000
+
+    icheck for target host type before libdl and pthreads
+
+commit dc4e00d3462a9a33d500c5684c8413781677a860
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Sep 23 11:42:01 2002 +0000
+
+    do not check for libdl on freebsd, check for phreads in libc_r on freebsd.
+
+commit d6894a2b896630203468087a2b98baaef5bc676e
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Sep 21 22:12:43 2002 +0000
+
+    FreeBSD sync: include <sys/param.h> before <sys/user.h>
+
+commit b4ee07d00c228782a402791aa2766029cfb39378
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Sep 16 22:51:46 2002 +0000
+
+    only include asm/page.h on linux
+
+commit 08df666a07b796ec5a3b29a5e22963f5eda4bf87
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Sep 16 22:35:32 2002 +0000
+
+    do not build arena.c fusion.c lock.c util.c and fusion_shmalloc.c when
+    compiling without single application core
+
+commit a3cb2a8364949d437e326659acd8ca28b80ce5ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 13 14:26:18 2002 +0000
+
+    Fixed flag definitions.
+
+commit 520ded2cd03d47f5c174730f679839f47a7a8b08
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Sep 11 23:54:23 2002 +0000
+
+    build tools on non-linux platforms. do not use <asm/byteorder.h> in raw32toraw24.c
+
+commit 9778c03696eae28a3023634f1ec8a868532a6889
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Sep 11 23:29:51 2002 +0000
+
+    include <sys/types.h> because darwins <sys/mman.h> depends on it and doesnt include it by itself...
+
+commit 2d1242ef5fbac23888819deb83d59670f61b56d2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Sep 11 23:26:15 2002 +0000
+
+    - added extern to declaration of dfb_memcpy() to avoid problems with
+      non-gnu linkers.
+    - only include <asm/page.h> on linux, guess PAGE_SIZE = 4096 on other platforms
+      (bad)
+    - only define MIN and MAX when undefined (fixes problem on darwin)
+
+commit a3e333635ec5288e50730f8cd52b735e695a4a4b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Sep 11 23:14:59 2002 +0000
+
+    only build gfxdrivers, tools, inputdrivers and v4l provider on linux
+
+commit 09d0632730c73e25b8d439e9e92005adfd42107a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 15:58:05 2002 +0000
+
+    Avoid naming conflict of log2 with tgmath.
+
+commit c7be5e5e9e0353d74801dfd3a20a654b5ba5f15c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 13:08:32 2002 +0000
+
+    updated
+
+commit 1af2113e9e73a05d6c0b5335c92c1a3818541c32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 12:39:16 2002 +0000
+
+    Color hash is multi app ready now, palette seems broken though.
+
+commit a64ab7f3a8176a2d78bac873076ba172e48eb561
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 11:05:47 2002 +0000
+
+    Force window creation without alpha channel if "no-translucent-windows" option
+    is used.
+
+commit 61dded44f448fc905496631e591b4750cc0ce55c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 10:47:07 2002 +0000
+
+    Added debugging tool dumping information about existing windows and surfaces.
+
+commit 35886fb6038458ce6a3bcccdbfc0ed064d351c98
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 11 10:29:37 2002 +0000
+
+    Send CSNF_SIZEFORMAT notification.
+
+commit 40cbab080dc1cdc82a271d98e5c6e8ea77295cb0
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 23:37:54 2002 +0000
+
+    use AC_C_BIGENDIAN (AFAIK even works when cross-compiling with automake2.53)
+    no longer include <endian.h> which seems to be linux specific,
+    use #ifdef WORDS_BIGENDIAN instead of #if __BYTE_ORDER == __BIG_ENDIAN
+
+commit 3a8011e9fa9d7c67952598fc06218da178a89def
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 21:47:33 2002 +0000
+
+    oops
+
+commit 919cdb0e376407c0a4961bbf4d50a91c1fde5a85
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 21:42:03 2002 +0000
+
+    do not include <asm/types.h> directly. added dfb_types.h which includes <asm/types.h> on linux and <sys/types.h> on other platforms
+
+commit 96fda3c1457333c488030c69f399852233832ebd
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 20:31:35 2002 +0000
+
+    added AC_CANONICAL_HOST and AC_CANONICAL_TARGET to avoid this problem with libtool on darwin
+    
+    ltconfig: you must specify a host type if you use `--no-verify'
+    Try `ltconfig --help' for more information.
+    configure: error: libtool configure failed
+
+commit 3a41798d38f2c7ae0802ba49e522a774925e7e6a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Sep 10 18:18:13 2002 +0000
+
+    s/dfb_fbdev_wait_vsync/dfb_system_wait_vsync/
+    Include <linux/fb.h> in order to get FB_ACCEL_* defines.
+
+commit 96bf6f9ca3f3dc3dbb460409263ab1f60ad8b691
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 16:35:53 2002 +0000
+
+    no longer include malloc.h
+    (sync from my OSX tree)
+
+commit bcc976d9e6b01c6ceeea8ad81396d0cbfc5ef1a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 10 16:14:25 2002 +0000
+
+    Use high priority for video threads, detach from surface correctly.
+
+commit a736f041db97604f9d0a7b87d7ef485fdefd3f38
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Sep 10 15:41:13 2002 +0000
+
+    support for building DirectFB without fbdev support. (first sync from my OSX tree)
+
+commit f710f1c66046b74292b9deccb17f5ea9dc711d9b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Sep 10 15:22:30 2002 +0000
+
+    Assign new width, height and format before checking if a reallocation
+    is necessary in dfb_surface_reformat().
+
+commit 8bf89978ba0f5d06aadafad5f56c2e6cb26e52e4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 10 14:50:39 2002 +0000
+
+    Finished key translation.
+
+commit b2173c135469c60fb0bde12851ff2f274220221d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 10 12:51:56 2002 +0000
+
+    Two 0.9.14 TODOs.
+
+commit e331cf4233bb67c7176a36e12ff4286d95fd94ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 17:30:04 2002 +0000
+
+    color hash for multi app is broken
+
+commit 67ec8a0a4c7bce83d3457d09bf54ce37efcf493e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 17:01:23 2002 +0000
+
+    minor clarification
+
+commit 3e1bd82ffd032c2ecc02e633f08732f129bccb92
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 17:00:06 2002 +0000
+
+    update
+
+commit e72de04277ef69d5b3ff1570e8989db15edde11e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 16:43:33 2002 +0000
+
+    updated
+
+commit 638246a87dffcfe28714998de7072f198a5b3826
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 16:25:15 2002 +0000
+
+    debug output adjusted
+
+commit 9c2968f24bd1c13124bc82b93ac723e0e4b33bab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 16:15:08 2002 +0000
+
+    Added orphan detection to FusionProperty.
+    
+    The window stack and video mode are now restored even if a fullscreen
+    application simply exits or gets killed by any signal.
+
+commit afeddd49f3de304f18dac8f7329c9196ae614e9e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 14:26:50 2002 +0000
+
+    Added function for retrieving the window pool from a layer.
+
+commit 922bdddf1329438b7ce364b91e4838d44d3ff697
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 14:02:04 2002 +0000
+
+    Added fusion_object_pool_enum() for enumeration of all objects.
+
+commit 6e61a6d7145d77e4351ae2201b8d09050afa7e2d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 11:30:56 2002 +0000
+
+    Now half line, not half texture ;)
+
+commit 218e7d9bf46545b95592b928fa34a0ef2f177872
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 9 11:21:28 2002 +0000
+
+    Half line adjustment for deinterlace blits.
+
+commit c6fcfb79e8959db86c4a4525efeddaba6e805521
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 6 17:25:54 2002 +0000
+
+    Fixed CreateWindow with DWDESC_SURFACE_CAPS.
+
+commit d5a1b39097f4c4a0c37a4a4967c2ef46aae9824b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 17:41:11 2002 +0000
+
+    Made black RGB332 entry transparent for testing.
+
+commit e72f93259400b7d15c43ea3d075bbc56e51f476c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 17:29:08 2002 +0000
+
+    Reexported "dfb_fbdev" as a hot fix to have the Matrox driver compile again.
+
+commit 770d2be4f271e94721e4ad74589f53b479b2a9f4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 17:00:38 2002 +0000
+
+    Changed LED behaviour.
+
+commit 6790cbb35db0b4e4959c7e1de861a09aa2e5caa4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 15:55:59 2002 +0000
+
+    Added Meta (or Windows) key to wm hack.
+
+commit e7a587a7c2dc46af3a8d251a589e15cb35e3dd4c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 15:52:40 2002 +0000
+
+    Don't generate RGB332 entries if palette already existed.
+    Generate RGB332 entries after creation of layer palettes.
+
+commit bea25135f76724ebab6c97401dc5e663bf510327
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 13:12:11 2002 +0000
+
+    Added IDirectFB::CreatePalette().
+    Added IDirectFBSurface::SetPalette().
+    Added IDirectFBPalette::GetCapabilities().
+    Added IDirectFBPalette::CreateCopy().
+
+commit 464d69698dc88a05f75d7795bb8e081764e9a07d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 12:07:41 2002 +0000
+
+    Fixed warning in "layers.c".
+    Small fix in SDL input driver.
+
+commit ca19ddcf64082a77de4ad79b95848fa93ce40694
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 11:54:46 2002 +0000
+
+    Fixed summary (SDL support yes/no).
+
+commit 85046c9a5fa5cee34f65e7bf1af40312a0546ae1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 11:48:03 2002 +0000
+
+    Another patch from Ville Syrjala <syrjala@sci.fi> adding planar YUV blitting.
+    
+    - DoBlit2D_Old(), DoBlit2d and DoBlitTMU() initiate the blits
+    - The are called from Blit2D_Old(), Blit2D() and BlitTMU().
+    - StretchBlit() and Blit3D() simply call BlitTMU() with proper arguments.
+    - Clipping registers are updated for chroma planes also.
+    - Register programming is not done in validate_source() or
+    validate_Source() anymore. All source related programming is done from the
+    blit functions.
+    - I changed the code for all cards. Only tested on G400 as I've misplaced
+    my G200 smewhere and I don't own any other cards.
+    
+    Added him to "helping developers" in AUTHORS.
+
+commit 049818eeb139dd3be40004d9ef8ac2bc841a79f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 5 11:36:22 2002 +0000
+
+    Second head support via additional layers by Ville Syrjala <syrjala@sci.fi>.
+    New option "matrox-crtc2" to activate this.
+
+commit 9d2818c7e55378becc82458963d4bd7fa9073e35
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 4 16:12:32 2002 +0000
+
+    This patch from Ville Syrjala <syrjala@sci.fi> adds YUV rectangle filling
+    support for planar and non-planar formats.
+
+commit 0d92ecb0e0981497266c5061fdca6fd48325fa05
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 4 16:03:57 2002 +0000
+
+    Millenium -> Millennium (thanks to Ville Syrjala <syrjala@sci.fi>).
+
+commit dd9e7f1be8c679261ac82432385a37265b8f5bdd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 4 16:01:17 2002 +0000
+
+    Added Matrox CLUT as a todo item.
+    Set DSCAPS_INTERLACED in the surface description of the v4l provider.
+
+commit ed5a3c19fc16ffff7bf2ab437d07e375d1656ffd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Sep 3 11:37:19 2002 +0000
+
+    Document the new system parameter.
+
+commit 80bdc5efafe2112b63cba1986dd3e976a443e7a4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 30 19:12:12 2002 +0000
+
+    Fixed crash with debug mode (with linked in modules).
+    Fixed multi app core system init.
+
+commit f91075b320fa153ab2c36fe542ce19a051fd3dac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 30 17:49:58 2002 +0000
+
+    Started abstraction of the "core system" featuring the "fbdev" system like before
+    and a new experimental "sdl" system. Yepp, DirectFB running on SDL.
+    
+    Use "--dfb:system=sdl" to run applications under X.
+
+commit 185253fa0ad89db0a22e48399dfcfeb32f8e332e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 30 11:55:58 2002 +0000
+
+    Fixed driver, compiles again.
+
+commit a8c23dc40331d408849a3cb7cd963e49d94d0bfa
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 29 00:45:09 2002 +0000
+
+    Removed a spurious space that broke the build.
+
+commit 7bad83c881a1031968398c6df4c73d0796ab3b9f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Aug 28 21:34:58 2002 +0000
+
+    - fix for big endian hosts, driver should work now
+    - wait for 4 instead of 3 fifo slots for line drawing ( this fixes crashing
+      of df_dok on my Geforce 2MX
+
+commit cb4da84f482cc299b913e12dc700cefc77070907
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 27 17:41:18 2002 +0000
+
+    Outlined some inlines.
+
+commit 5ab3a02ac4447f3adb354c005ba8d91aa0c3a3a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 27 17:23:30 2002 +0000
+
+    Added missing call to colorhash_detach().
+
+commit a95aee429967f857320ebf3e1e7a1fa1df915e40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 27 14:03:26 2002 +0000
+
+    Added IDirectFBSurface::SetSrcColorKeyIndex() and SetDstColorKeyIndex().
+    
+    Added LUT8 and RGB332 acceleration to NeoMagic driver (now version 0.3).
+    
+    Added referencing of the window to IDirectFBSurface_Window implementation.
+    
+    Increased version number to 0.9.14.
+
+commit f91bc0287a4d1ce34a21386b3fad74be840c42e7
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 26 22:28:30 2002 +0000
+
+    Call 'libtoolize --version' instead of libtool.
+
+commit 79387cf9eb15a0a75c956cc68257ea323c819919
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 26 19:21:01 2002 +0000
+
+    DSCAPS_SEPERATED -> DSCAPS_SEPARATED
+
+commit fae6fe5a85ec5f1ecfdd10287bba2c31bebdc140
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 26 17:47:24 2002 +0000
+
+    Use DSBLIT_DEINTERLACE if window surface has DSCAPS_INTERLACED.
+
+commit 3594fdfd39c7cd05412fb2cfec8d2869975602fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 26 17:44:55 2002 +0000
+
+    Added experimental blitting flag DSBLIT_DEINTERLACE and implemented it in
+    the Matrox driver, not tested yet.
+
+commit 70af58bfedcc544f3bc7cf0cbd283b85860831a7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 26 17:13:17 2002 +0000
+
+    Added CSNF_FIELD as a notification causing the 'source modified' bit to be set.
+
+commit 24b6def8cb65fdae3bb486dd9e79a736454bb267
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 26 15:42:39 2002 +0000
+
+    minor update
+
+commit 393bf59b86600d972e4eab00946d023a78b351ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 18:26:45 2002 +0000
+
+    removed field switching todo
+
+commit 15d62cd593c9424aca239e01d7e956fc70db0baf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 18:26:14 2002 +0000
+
+    Added IDirectFBSurface::SetField() which enables applications to manually
+    control the deinterlacing of layer surfaces (with DLOP_DEINTERLACE enabled).
+
+commit 1b30e86ad024a0bbfa4b51d53c5121694859d248
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 18:00:37 2002 +0000
+
+    Keep alloc_list after debug outputting it to avoid crash by further deinits.
+
+commit 6a767de7c231201423e523c5d3cb39f5b3530539
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 15:24:50 2002 +0000
+
+    fixed init/deinit related things
+
+commit cf397cbfc473d6cbdeb3621c00569828f8b47130
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 14:06:27 2002 +0000
+
+    Fixed two mem leaks (two unreachable blocks after exit).
+    Don't reload input and graphics modules.
+
+commit 025f1e9aa100648d2a97e514537e2992140489fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 13:12:55 2002 +0000
+
+    Use shcalloc instead of shmalloc.
+
+commit 3c57dc9c6e1fff87d7da306fb58c1fefe0750901
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 12:43:49 2002 +0000
+
+    Added "-g" to non-debug mode to have line numbers in gdb without
+    enabling the DirectFB debugging code.
+
+commit 8412ba96ea13a6f9f8e9a5713769f903214da545
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 23 12:24:28 2002 +0000
+
+    Added missing closedir().
+
+commit 8021d6a6052398970beb5b8c9bff903ec0f1f622
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 22:40:23 2002 +0000
+
+    updated
+
+commit fbaa2571aeca3f609074639a70e7113f766cf217
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 22 22:20:54 2002 +0000
+
+    Updated NEWS.
+    Forced directfb.h into 80 columns.
+
+commit 1e6912e025a98cad83cc0e11f4d4913f8a0a6a41
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 22:19:51 2002 +0000
+
+    cheating ;)
+
+commit 5b8032be7084b3d73354916fc6416bd472ab5321
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 22:15:23 2002 +0000
+
+    Do a skirmish_prevail during shutdown if it's no emergency instead of the
+    skirmish_swoop loop.
+
+commit 0721c8ac02489be35c7f83da99acbb0bbdeac45a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 22:05:44 2002 +0000
+
+    Added "do { ... } while (0)" to debug macros.
+    
+    Don't print an error if message queue id is removed, but print a debug message.
+
+commit 775c31d6da41285c7adbee2d683c00c2f7139204
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 22 21:58:22 2002 +0000
+
+    Made init_modes a static function again.
+    
+    Call the original InitLayer function and modify the configuration
+    instead of doing the whole setup in savagePrimaryInitLayer().
+
+commit 7350fc81c933e9216f450042184f68f3583473d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 21:54:52 2002 +0000
+
+    Shutdown input core before anything else to stop input threads early enough.
+    
+    Don't create a palette for non indexed surfaces by default.
+    Create it on demand during surface reformation.
+    
+    Fixed missing initialization of semop flags regarding global references.
+
+commit 5e42308883cae850a859769aad3a53a58be6295f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 22 21:06:45 2002 +0000
+
+    Made the GIF provider less verbose.
+
+commit ab757525907413bc0b5907d0737b66d44ea50bb3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 22 20:42:37 2002 +0000
+
+    Added a global (per process) color hash table to speedup palette lookups.
+
+commit c034bcefff925a68b344af7d9818c2584bb4ba55
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 19:03:20 2002 +0000
+
+    Added core functions for thread management
+    to have input drivers pthread independent for easier porting.
+    
+    Input threads get a higher priority now.
+
+commit bbb5370ee7fe5f5918358f25900a2d7c9fbe7f85
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 22 17:48:40 2002 +0000
+
+    Fixed dead lock in recently implemented FusionProperty (multi app).
+
+commit abcf5116e02a4cca965b298598becfbcb30cc419
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 22 12:28:11 2002 +0000
+
+    Applied a patch from Alex Song <alexsong@comports.com> that add
+    flipping support to the secondary layer.
+    
+    Export former internal function init_modes() as dfb_fbdev_init_modes().
+
+commit ea8e281f9cfa108c94067f02cb1410134772bb30
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 19:55:00 2002 +0000
+
+    Modules are installed to ".../lib/directfb-0...-debug/" if debug is enabled
+    to avoid dynamic linker errors.
+
+commit d9c50ab9a6711c3714f78f03f00ca47db5eaee31
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 19:35:23 2002 +0000
+
+    minor update
+
+commit c03e159f4f8dd4b83724bbe3990b3b04fb31a486
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 19:10:48 2002 +0000
+
+    Added malloc/calloc/strdup debug output.
+    Beautified debug output and made fusion debug output like the core's DEBUGMSG.
+
+commit 2eea56839bceeb5b4e79c4a178b6019ab2822eef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 17:53:13 2002 +0000
+
+    Surfaces can now be created (in core) using the palette of another surface.
+    Window surfaces are now created with the layer's palette (real reference).
+
+commit 0cb47ba756fc6afdc1a9a3f1dd302424842113f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 17:24:46 2002 +0000
+
+    Removed locking recently added.
+
+commit 55d9933c1f47c29c866f88477118fc81aa8059c6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 17:15:59 2002 +0000
+
+    IDirectFBPalette is now completely independent from surfaces.
+    Added palette notification for entry modifications and palette destruction.
+    Attach a palette listener to a surface's palette to notify surface listeners.
+
+commit f7cf8de3688b55999d1f76dbf2cc7fd4eb2245ef
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 16:10:54 2002 +0000
+
+    Unref surface after linking it instead of unref during window destruction.
+
+commit c5f8f0cb485dae882dd9aee76cbcd6b1834c4a61
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 20 16:04:28 2002 +0000
+
+    CorePalette is a FusionObject now with its own pool.
+    Currently each surface creation causes the creation of a palette object,
+    it's then linked to the surface object and unref'ed.
+
+commit 39e43e392ea00ff5415b827819adc286bc6c0eeb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 19 18:21:54 2002 +0000
+
+    Indentation.
+
+commit 45ac939ffaabe063fd492c55e2da7a5d52512fe6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 19 16:23:48 2002 +0000
+
+    Provide shmalloc/shfree debugging for single app core.
+    Avoid calling shfree() with NULL.
+
+commit e53e5064410475b75c2b10514df2f1d4f34b3dee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 19 13:29:45 2002 +0000
+
+    Fixed cursor alpha blending.
+    Added 'CAUTION' messages to unimplemented cases of surface heap adjustment.
+    Added locking to window stack cursor handling.
+
+commit 7adca67032e6b45a2ef7e66036cac3a11ca66804
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 19 13:03:37 2002 +0000
+
+    removed obsolete entries, sorted entries by priority
+
+commit 637a1c2a91010da804144b984f936df427986c1c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 19 12:49:15 2002 +0000
+
+    Added DWOP_ALPHACHANNEL to enable/disable per-pixel blending after creation.
+    Only supported by windows with the capability DWCAPS_ALPHACHANNEL, which have
+    it enabled by default.
+
+commit a4ae71f2965f220dd4f3a58664a3690f8a09d834
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 19 11:35:29 2002 +0000
+
+    Removed bashism (function keyword).
+
+commit 6ba55f17c2726496cf3ec73b192ff18b63b25c0d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 18:40:19 2002 +0000
+
+    minor simplification
+
+commit cb271c77b697b8e5ae75b94c29059a9ce6a11576
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 14:14:43 2002 +0000
+
+    Added DSCAPS_STATIC_ALLOC and DWDESC_SURFACE_CAPS.
+
+commit 573c565430aaea152529f6617e76a13df5972533
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 13:15:51 2002 +0000
+
+    Fixed bug introduced last night.
+
+commit 692a4ca293f77c5559e5a9fcf0381f640abca197
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 12:15:15 2002 +0000
+
+    Don't lock/unlock buffers during surface destruction.
+
+commit 007b6cb06f50cb93cdae116c6922a22ffa9620c4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 08:32:28 2002 +0000
+
+    Framebuffer is now mapped by 'fbdev' instead of 'gfxcard'.
+    Reordered initialization/shutdown/join/leave calls in 'core'.
+
+commit 205d8a423ad8b88727f14d5dacba2b0aaf8c8545
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 03:45:06 2002 +0000
+
+    EnumVideoModes handles bpp again.
+
+commit 1cc3c5bb941d63b1a528cf7ecf756ac5af251e00
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 16 02:51:00 2002 +0000
+
+    Implemented FusionProperty in multi application mode (via three semaphores).
+    Implemented backup/restore of the layer configuration before/after excl. access.
+
+commit 0b876569e2a03127085453ca679b0df4501cf7fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 15 21:46:48 2002 +0000
+
+    A bit work on cooperative levels.
+
+commit c5b9b7a560bcdf95267f8df5da6e80eba330e7ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 15 21:00:29 2002 +0000
+
+    Avoid endless waiting during deallocation.
+
+commit 9476e636625bf940cc4abac0a6e86121c6b1afe6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 15 18:53:55 2002 +0000
+
+    DirectFBError() and DirectFBErrorFatal() return the error code now for easier
+    code (e.g. return DirectFBError(...)).
+
+commit 0a6360eca46118222722c00c5546638bf668e667
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 19:10:13 2002 +0000
+
+    Made debug message an error message (background surface vanished).
+
+commit 765824aadf41a59cc9a4185e737153f784f414d4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 17:49:42 2002 +0000
+
+    Background image is now persistent (application can exit after setting it).
+
+commit 2db3eb090023731bb02304da690a1512202c2c19
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 17:08:49 2002 +0000
+
+    Fusion debug messages are printed only if debugging is enabled at runtime.
+
+commit d00b2894c7e5cfc20187afd47e979ff6d24e835f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 13 16:43:20 2002 +0000
+
+    Updated the Makefile accordingly.
+
+commit 683b0e1dec31d9c09d4f6653e32141c327151c9d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 13 16:42:23 2002 +0000
+
+    Updated savagefb-0.4.0 patch based on a patch from Alex Song.
+
+commit 0b50ef53fed7af34cb559d40d8c5e4eea12dafb7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 16:32:12 2002 +0000
+
+    Implemented ovlFlipBuffers().
+
+commit 0819e441f1ab8742ba466f3eb52a20611930b515
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 15:15:50 2002 +0000
+
+    CardState is a local resource now, using a mutex instead of a skirmish.
+    The state for window stack updates is now located in the local layer data.
+    Added deinitialization of the surface manager.
+    
+    No resource leak by starting/exitting a small application.
+
+commit 15d59c025572010ba2b150608a59426bee4e3617
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 13 11:56:04 2002 +0000
+
+    Implemented Sop_lut8_Sto_Dacc() and Sop_a8_Sto_Dacc().
+
+commit f4c64bd77fbe45721c84d13d13b8aa88e38822f3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 13 11:01:39 2002 +0000
+
+    more compile fixes
+
+commit 21d0351157a148d08a34a91d9184e0d1f3b6ba9e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 12 23:58:50 2002 +0000
+
+    cleanup
+
+commit f3d3f9a5034c2ac644a659d9e49a6399e261777c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 20:42:25 2002 +0000
+
+    Hopefully compiles again.
+
+commit c6b0d63024ff3035c8350269872d47106a051eb5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 19:30:44 2002 +0000
+
+    Another TODO item: synchronous messages
+
+commit a224317c241dee4211c410bfd82a4cc9193fe8ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 19:27:53 2002 +0000
+
+    Added TODO item for making CardState local only.
+
+commit aa3eac47031a78975bbf88f160921641a3582355
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 19:11:33 2002 +0000
+
+    Don't install signal handler for slaves.
+
+commit 3ee5854577d2637ac153aba2d61e89865480da7f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 18:59:36 2002 +0000
+
+    Made CoreWindow a FusionObject.
+
+commit 0c132f42a0428211e79bf0b227410f8b6eaf2df9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 17:43:57 2002 +0000
+
+    Each object pool has a name now.
+    
+    Added shstrdup().
+
+commit 27cd209d227a378d111a36116351b7f2568338ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 16:41:22 2002 +0000
+
+    Added FusionObject which is currently used for surfaces and will be used for
+    windows (dynamic resource) or static resources like layers, input devices...
+    
+    Each FusionObject has a reference counter which is automatically decreased
+    if the process dies that increased it. Added bone collector thread that checks
+    for dead objects (zero reference) and calls the destructor (master only).
+    
+    Replaced dfb_surface_destroy() calls with dfb_surface_unref() calls.
+    
+    Each IDirectFBSurface instance increases the reference counter, so be careful
+    to release all sub surfaces.
+
+commit fe6adfc2f803a4e42d6043ddceaef84e478ba5ac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 12 14:44:26 2002 +0000
+
+    cleanup
+
+commit d435c45f6bd3258204b92b579a6973b05456eaa1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Aug 11 14:32:37 2002 +0000
+
+    Reverted my last change since the compiler seems to like the old code better.
+
+commit 865739f917f90a015d616ca5186af037d2d4e110
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Aug 11 14:26:15 2002 +0000
+
+    Cleaned up Bop_a8_set_alphapixel_Aop_rgb24().
+
+commit cef004a1e1012adc965bc1306badc2b1034517e9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Aug 11 13:30:45 2002 +0000
+
+    Removed unused locking code.
+
+commit e62f8d8890ed55e9e0a02bb68f68094443603c6d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Aug 11 12:52:18 2002 +0000
+
+    Aligned configure output.
+    Don't use duffs device for Bop_a8_set_alphapixel_Aop_lut8().
+
+commit 55116b98bd235597303c3eb82705e33e34f743da
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 17:35:43 2002 +0000
+
+    A better implementation of Bop_a8_set_alphapixel_Aop_lut8(). Much slower
+    but correct for AA glyphs and reasonably fast for monochrome ones.
+
+commit bbae4fac76aa45eca8a9d9e4ba9291c7b81e24b0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 14:18:34 2002 +0000
+
+    Reuse Bop_a8_set_alphapixel_Aop_lut8() for RGB332; it's the same code.
+
+commit dc0d6fb4d5a0221acbc22dc742a6b055eb442548
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 13:37:08 2002 +0000
+
+    Set the color_index in the font_state as well.
+    
+    Added a simple implementation for Bop_a8_set_alphapixel_Aop_lut8().
+
+commit b53dbe488c331539f20647af966b33a5aabbe6e8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 12:05:09 2002 +0000
+
+    Document the disable-module directfbrc option.
+
+commit 26e472e21974e588f0f9bbd4828ed881c82936b7
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 10:37:10 2002 +0000
+
+    Introduced an enum for the stage to improve code readability.
+    Check if we reached our final stage in the inner loop of
+    push_data_until_stage(). PNG images load again :-)
+
+commit dd8f99b316f90ec1b72d5a783542b6fb7895fcfc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Aug 9 09:46:34 2002 +0000
+
+    Check that png_ptr is not NULL before calling png_destroy_read_struct().
+
+commit 43ccc81580cbcd1eb2d7a65e29e125df9e51eb00
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 20:02:42 2002 +0000
+
+    Added inline function span_rgb32_to_rgb332().
+    Added support for RGB332 surfaces to directfb-csource.
+
+commit 9acbe1c2e4d6b87f980900bc09e4cee5fdeb824a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 17:28:03 2002 +0000
+
+    Added a bool "global" to fusion_ref_up/down(). A global reference is not bound
+    to any fusionee (anonymous reference) and won't be automatically decreased if
+    the fusionee that increased it dies. This will be useful for resource cleanup
+    if a core object is linked to another one (e.g. surface linked to window).
+
+commit 5bfc541847eb4acc18655fead9577879c4f61a79
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 16:56:59 2002 +0000
+
+    Removed unnecessary include of core/fbdev.h from savage3d.c.
+    Include core/fbdev/fbdev.h from savage_streams_old.c :-(
+
+commit 6cf60a8c12a1e163947ff68398473c03c607c1b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 16:41:45 2002 +0000
+
+    Moved framebuffer device specific files to "src/core/fbdev/".
+    Only "gfxcard.c" still contains a bit fbdev code.
+    
+    Other files modified depend on the fbdev code which has to be fixed.
+
+commit d451b6e9ef650b709639756cd869fcfc3f7c8c84
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 16:00:34 2002 +0000
+
+    A filename is now contained in the common private data of data buffers.
+    It is set if the databuffer is created for a file. Image providers that do
+    not support data streaming can use it as a fallback.
+
+commit 51562d51675db2919e39071d4308ebb6cb6a0d0a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 15:32:42 2002 +0000
+
+    minor cleanup
+
+commit 85970d7ad115511529a8e293bcc2aa764c14e8a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 15:14:01 2002 +0000
+
+    Abort data streaming if error is detected.
+
+commit 79d3a8429918c26e882b3926e98e666e10222d6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 15:06:21 2002 +0000
+
+    Added DFB_UNIMPLEMENTED returning methods for SetRenderCallback().
+    Forgot to add a "return" if no system memory could be allocated.
+    Started implementing the render callback for PNGs, not working yet.
+
+commit a559d31a2d2f5a54529dbf9713158fe224887bcb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 14:58:07 2002 +0000
+
+    signed/unsigned switch
+
+commit 5dad1d33a9136df54cd843c6c11b7785b16469b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 14:57:50 2002 +0000
+
+    Added WaitForData() call before peeking 32 bytes.
+
+commit 10fe1a06206d1af286f4f48df6632e5391a75715
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 14:54:22 2002 +0000
+
+    Added another format conversion by reordering the switch statement :-)
+    Put palette info into the DFBSurfaceDescription.
+
+commit ef7fa845ee1619693b8e19352db183e891b7394a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 8 14:42:42 2002 +0000
+
+    Added DSDESC_PALETTE which can be used to initialize the surface's palette.
+    
+    Added IDirectFBImageProvider::SetRenderCallback() that is not implemented yet.
+
+commit db62c19693b6244ce47b8343603966cd17b256cc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 14:20:09 2002 +0000
+
+    the final touch
+
+commit 73ba2b01f0a827d04d27c67a115f8a5a09780bff
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 12:02:35 2002 +0000
+
+    Updated NEWS and ChangeLog.
+    Mention the current problem with EnumVideoModes() in BUGS.
+
+commit 99c8913d591b49b19d55c9422c1682ffaf1a0d6d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 11:45:05 2002 +0000
+
+    Also dump the number of palette entries.
+
+commit 476d933abfa7013925a3a7a1fffdf3a1369343d6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 11:19:22 2002 +0000
+
+    Dump palette from PNG file when the destination format is LUT8.
+
+commit a67a726305bd708d751968c3779d9f50ce27b033
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 10:16:55 2002 +0000
+
+    Allow to create LUT8 surfaces from indexed PNGs (need to add a way to
+    dump the palette).
+
+commit 014977573bb22b48f2fea83205d61439c4b9cc86
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Aug 8 08:50:30 2002 +0000
+
+    Align the pitch to multiples of 4.
+
+commit 697a81750023e7b16b0a8e28959bf297eafd9f1c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 23:14:19 2002 +0000
+
+    Fixed loading of grayscale PNGs into A8 and added support
+    for loading RGB PNGs w/o alpha-channel into RGB24.
+
+commit d99866bae096916a55aa37d94a17e9f90dbc2e1c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 22:23:31 2002 +0000
+
+    Added two Makefile rules that might be useful to build only parts of
+    the DirectFB package:
+      'html' creates the HTML docs
+      'directfb-csource' compiles the directfb-csource utility
+
+commit b3d34a58c70d3429ce08a45484b7bd3ec8bb38e6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 22:00:00 2002 +0000
+
+    Added a man-page for directfb-csource.
+
+commit b1fb60939273bb8f13370ff7f9d1f16d61d17e12
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 19:07:12 2002 +0000
+
+    Added span_argb_to_a8().
+    Added Tim Janik to the list of contributors since I used some of
+    his gdk-pixbuf-csource code for directfb-csource.
+
+commit a140b2eb4cc5668e05dfa9bef341bbf6c2cc0902
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 18:57:32 2002 +0000
+
+    Allow to specify the destination format on the command-line.
+
+commit 0e22f4b9c5946ad2a0caeff533d6eaa0fd7e79aa
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Aug 7 15:48:37 2002 +0000
+
+    Added directfb-csource, a tool that creates a C header file from
+    a PNG image that can included in a DirectFB application.
+    Based on gdk-pixbuf-csource.
+
+commit 1bb6971b3b94a48e1b395d998ef8086b294cd56a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 6 19:12:05 2002 +0000
+
+    Forgot to lock/unlock during Flush().
+
+commit f6ebe1e474522ceb18d80509dfbf082882f2ce55
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 6 19:11:05 2002 +0000
+
+    Completely implemented streamed data buffer, completely untested.
+
+commit b7d1c486fb79cb161823209f83fb013061f20ea3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 6 17:14:06 2002 +0000
+
+    cleanup
+
+commit e42871e1398fd46e73242b24c262768a713da5b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 6 16:25:03 2002 +0000
+
+    Return DFB_BUFFEREMPTY in PeekData() instead of blocking forever.
+
+commit 81b53a34e438ac68937820f7fde5844e4658bc66
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 6 16:02:21 2002 +0000
+
+    Image providers now read data from an IDirectFBDataBuffer.
+    JPEG and GIF providers cannot fully handle streamed buffers yet.
+    
+    IDirectFB::CreateImageProvider() implicitly creates a data buffer now.
+    
+    Added IDirectFBDataBuffer::CreateImageProvider().
+
+commit 7cc036011c47758fb8be659619ba27337a3c920a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 6 13:27:35 2002 +0000
+
+    typo
+
+commit 4af91c64a409406da9a3cc95ddf56b9fc590917f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Aug 6 12:24:04 2002 +0000
+
+    Call AC_INIT() with a sane value.
+
+commit 43e618956375f7c456c62709f62d741023a26cc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 2 17:21:59 2002 +0000
+
+    Don't reconfig front buffer if policy stays the same.
+
+commit 88140b6dd11d5fa7f181765857e1e10a8596beae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 2 13:16:05 2002 +0000
+
+    Implemented IDirectFBDataBuffer_File::PeekData().
+    Made "offset" for PeekData() signed.
+
+commit 9ff4d2a59ae55b08030eb9d0d4effffc33326c3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 2 12:53:05 2002 +0000
+
+    Moved mode probing to primaryInitLayer().
+
+commit 118d59bd6ea364c5bbd4aed1e9bd51070d4e6f26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 1 13:48:28 2002 +0000
+
+    Reject RGB332 in IDirectFB::CreateSurface() if it's not compiled in.
+    
+    Initial work on data abstraction for image providers, etc.
+
+commit 5837463f42095d16a5f9de80267057654003eea9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 1 13:36:29 2002 +0000
+
+    Fixed typo, fixes a crash when blitting from LUT to RGB.
+
+commit 49c17ad43b1b208f35be31fcba223c4038056148
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 31 13:13:56 2002 +0000
+
+    Removed the version number from the README file for the
+    matroxfb-vsync-irq-patch.
+
+commit c4185e2f583680e5cbc97bd3064e5872b6f1baee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 29 22:47:18 2002 +0000
+
+    Added IDirectFBPalette::FindBestMatch().
+
+commit fdb4c8fd1c6f19e4f93bcb611671a45a4871286a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 29 19:24:26 2002 +0000
+
+    Removed unneeded calls to IDirectFBSurface::GetCapabilities from
+    RenderTo() functions.
+
+commit 140fbadf7729b41d0fad3106a5eeaa0c5654c87d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 29 17:24:03 2002 +0000
+
+    Typo.
+
+commit e069f47632a77d9b01bd57a0046c26a055b87c66
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 28 23:09:25 2002 +0000
+
+    Added configure option "--enable-profiling".
+    
+    Added "alpha present" bit to LUT8, because the LUT has alpha values.
+    
+    Added LUT8 support to image providers.
+    
+    Added option "pixelformat" which overrides "depth" for the default mode.
+    The value specified is e.g. "RGB332" or "LUT8".
+    
+    SetPalette() for display layers is now called by the core after setting
+    a new configuration (for LUT8 only of course).
+    
+    Added dfb_palette_search() which (really slowly) looks for the best
+    matching palette entry for a specific color.
+    
+    Generate a RGB332 like palette as default palette for LUT8.
+    
+    Allow other alpha supporting pixel formats than ARGB for alpha blended
+    windows, too.
+    
+    IDirectFBSurface::Clear(), SetColor(), SetSrcColorKey() and SetDstColorKey()
+    now lookup the right color index for indexed surfaces.
+    
+    Much more support for LUT8 in software driver.
+
+commit 8e30c980ea8da61209b28b51718bd19bd2829e71
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 26 16:28:33 2002 +0000
+
+    Fixed centering of primary surface window.
+    Converted some unsigned ints to signed ones.
+
+commit 932e6c2392867b7ded7122248e06298ddf3b3d83
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 26 15:32:58 2002 +0000
+
+    two more bugs
+
+commit 741aec12afe6989678bedfe62f5ad4f51639fa4c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 26 14:19:05 2002 +0000
+
+    Added another bit to the pixel format definition indicating an indexed format.
+    Added DFB_PIXELFORMAT_IS_INDEXED(format).
+    Added IDirectFBSurface::SetColorIndex() for indexed pixel formats.
+    Enabled drawing functions for DSPF_LUT8 in the software driver.
+
+commit d1d08d8025d498195c72a637a14372b912295bdb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jul 26 13:53:46 2002 +0000
+
+    Declared the return value of DirectFBCheckVersion() as const.
+    Assure that directfb.h fits into 80 columns.
+
+commit a441f469a8bef417043e3cc8d1d9e4d8f8fe6952
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jul 26 10:59:35 2002 +0000
+
+    some smaller README updates
+
+commit 37fc8263fca8153ab353896e2f2a332868b26612
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jul 26 10:49:19 2002 +0000
+
+    Updated ChangeLog and NEWS file.
+
+commit fd89587733a4cc8480726e67032a2e49de9bf7da
+Author: holger <holger>
+Date:   Fri Jul 26 10:32:29 2002 +0000
+
+    implemented direct glyph mapping without charmap, toggled by the DFFA_NOCHARMAP flag
+
+commit 17e2e0d43832f40fb4863cb679b3c5ba252fb192
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 26 04:10:28 2002 +0000
+
+    Forgot to increase the ABI version.
+
+commit d20bdff707cd6f4100e8c9d3df9944bb8aeb934e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 26 04:06:33 2002 +0000
+
+    Added SetField() to layer driver API, removed surface listener stuff
+    from Matrox driver and implemented SetField().
+
+commit a105b14d28c102df50ab58734eaf297cb992a02c
+Author: holger <holger>
+Date:   Thu Jul 25 15:33:02 2002 +0000
+
+    fixed nasty off-by-one bug
+
+commit 62ea6a0e9a0c8fe26b36ebfba8ee89a2f8863a35
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 25 14:54:31 2002 +0000
+
+    Added DFBDisplayLayerTypeFlags for a basic classification of the layers'
+    purpose a la DFBInputDeviceTypeFlags. Classification includes graphics,
+    video, still picture and background usage.
+    
+    Added DFBDisplayLayerDescription containing capabilities and type for now.
+    
+    Display layer enumeration callback gets the layer's description now.
+    
+    Removed IDirectFBDisplayLayer::GetCapabilities() and added GetDescription().
+
+commit 7b7f6668800158850f8f73cfca93ecac60863882
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jul 25 14:11:43 2002 +0000
+
+    small cleanup
+
+commit 08053094860209c41b56a277858c9b200d945d73
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jul 25 13:35:37 2002 +0000
+
+    Implemented input_only windows (windows w/o a surface).
+
+commit 67825aa7461002b2eb7a2889590b0f5b4547a617
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jul 25 08:24:28 2002 +0000
+
+    Declared DFBRectangle and DFBRegion as const function parameters for
+    all functions that don't change them. This documents the API better
+    and keeps us from accidentally modifying the passed structs.
+
+commit 74c46dce26053101cee895e4d46c60b17130b711
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 24 19:12:57 2002 +0000
+
+    Declared name and value parameters of DirectFBSetOption as const.
+
+commit 66f001333016e4e050b387747c42579829c3e31e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 24 11:19:25 2002 +0000
+
+    Updated email address.
+
+commit 78b7263f99f680a8d3f281a9b34fefbbc92649ad
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 23 09:56:40 2002 +0000
+
+    Applied a patch from Ville Syrjala <syrjala@sci.fi> that removes
+    the unneeded call to dfb_surfacemanager_assure_system().
+
+commit fbef7a03f099251f711b725ddb2d1ebb9822fd24
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 19 00:57:39 2002 +0000
+
+    New patch for 2.4.19,
+    thanks to Brian J. Murrell <a40e8119bbddbe7b3d281db117f19b32@interlinx.bc.ca>.
+
+commit ef2469de1d75311ce10cdf2b1d62686925936ea6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 18 17:52:28 2002 +0000
+
+    Applied patch from Ville Syrjala <syrjala@sci.fi> enabling acceleration
+    for the second head of a dual head Matrox.
+
+commit 1e7b46212c1476820dcec333b408909bfd0193b3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 17 15:17:08 2002 +0000
+
+    spell checking
+
+commit f291216fc589551996884ad28658cea415a8ffc2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 17 15:04:30 2002 +0000
+
+    Replaced '\344' in Ville's name with a plain 'a' as he requested.
+
+commit 01e7813aecbfef7689aa0252688b828fe8ff23b9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 17 14:23:51 2002 +0000
+
+    Added Alex Song <alexsong@comports.com> to "Helping Developers" (Savage driver).
+
+commit 985094acbe3df066be810f32acf0782a56121a34
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 17 14:09:13 2002 +0000
+
+    Applied a patch from Alex Song <alexsong@comports.com> that completes
+    support for the old streams engine as found in the Savage4 family.
+
+commit 091a06c2c9b251c344e079d57afc207a981ab609
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 17 14:00:00 2002 +0000
+
+    include <sys/time.h> for gettimeofday().
+
+commit b23b194e7b54485d605429a12ed2dcfee551923c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jul 17 13:52:33 2002 +0000
+
+    Made the core fill in the InputEvent's timestamp field if it hasn't
+    been set by the inputdriver.
+    
+    Reviewed all inputdrivers once more and removed some calls to
+    gettimeofday() since dfb_input_dispatch() takes care of this now.
+
+commit 8912f20a747bac1224832714cb326c158324055f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 16 14:50:42 2002 +0000
+
+    Always set the flags field of the InputEvent before dispatching it.
+    This is needed since the core modifies it, so we can't reuse the
+    flags next time we use the event struct.
+    
+    Also made sure that all inputdrivers either always or never set the
+    timestamp.
+    
+    Don't set the DIEF_BUTTONS flag in the linux_input driver, it is set
+    by the core when the buttons field is calculated by fixup_button_event().
+
+commit b828db4a9d4f620cdbb678283fea6f96bb22bef8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 16 14:46:19 2002 +0000
+
+    Also call fixup_button_event() for events of type DIET_AXISMOTION.
+    Fixes the buttonmask for motion events (needs some fixes to the input
+    drivers that I'll commit next).
+
+commit fe3b99469d84781d8826ba2b31f2afd0fa8ab07d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 16 11:31:24 2002 +0000
+
+    converted a C++ style comment to /* ... */
+
+commit afddbad65bb48e811794c2c77b0b0dbb0ede098a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 15 13:05:06 2002 +0000
+
+    Applied patch from Mike Pieper <mike@pieper-family.de> fixing locking
+    of the surface buffers.
+
+commit acc6b67a3185067d87a9a37a7e6cd0754390f007
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 15 12:28:51 2002 +0000
+
+    Applied a patch from Alex Song that changes SetSrcColorKey() to
+    accept r g b values instead of a 32bit key and sets the device pointer
+    in dfb_layers_hook_primary() and dfb_layers_replace_primary().
+
+commit 122c72f1310605c3cd2150b873ddba3e268b374e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 12 16:20:13 2002 +0000
+
+    Added support for interlaced surfaces with seperate field buffers to all
+    drawing and blitting functions.
+
+commit fdc6032b759cd10d4d7988776979718675046325
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 12 13:41:22 2002 +0000
+
+    Added DSDRAW_XOR ;)
+
+commit d490bb40569b046d37731bad267c5d8e7334876e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 10 15:10:53 2002 +0000
+
+    Added "dfb_layers_replace_primary" which acts like "dfb_layers_hook_primary",
+    but replaces the complete function table allowing drivers to use the default
+    methods for surface allocation by setting function pointers to NULL.
+
+commit 44d10c689ff7caa8b55f5d5580dfcf3d9bb8a7f7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 10 13:40:09 2002 +0000
+
+    Added DLOP_OPACITY which enables usage of the global alpha factor specified
+    by SetOpacity(). This way drivers have the chance to forbid opacity changes
+    during usage of the alpha channel or color keying.
+
+commit b17c15b5c784e8f8a7a14d7fc24b8b59addd0368
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 10 10:35:53 2002 +0000
+
+    Automatic grabbing mode for grab-only devices or flipped surfaces
+    by Mike Pieper <mike@pieper-family.de>.
+
+commit 1e7b2bc67c7d3b0dc7362fd7f6a91e7d4544cd32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 10 10:33:05 2002 +0000
+
+    Some cleanups by Ville Syrjala <syrjala@sci.fi>.
+
+commit 04324b781b494484772b3b5b0e9fb64364f96e6f
+Author: holger <holger>
+Date:   Tue Jul 9 14:33:25 2002 +0000
+
+    some more keydefinitions, use 16bit only for all keycodes
+
+commit a25f7c9ec2117e30fdebe90a8839f574df445782
+Author: holger <holger>
+Date:   Tue Jul 9 11:23:58 2002 +0000
+
+    - DIKI_XXXX are now Unicode keys in the private area
+    - fixed GetKeyState table lookup
+
+commit 51286d851119a07b5d659e433f373a0d51997467
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 8 14:53:06 2002 +0000
+
+    Reverted Holger's change, because it breaks IDirectFBInputDevice::GetKeyState()
+    and other things.
+
+commit ac06883cc9c2758cc43cbf3a4f2940012e7e14ee
+Author: holger <holger>
+Date:   Mon Jul 8 08:50:54 2002 +0000
+
+    Rewrote the linux input keyboard driver, key mapping is done
+    via table lookup now. You can distinguish DIKI_XXX codes by
+    testing (DFB_KEY_TYPE(key) == DIKT_IDENTIFIER). We still have
+    to implement keymap handling...
+
+commit a368c9884d18159094a457857912740636038a45
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jul 6 20:13:43 2002 +0000
+
+    32bit destination color keying fills fixed by Ville Syrjala <syrjala@sci.fi>.
+
+commit fd6e003ab7f80337b3f776b257b63f9c210ffe30
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 5 16:08:02 2002 +0000
+
+    Another set of patches from Ville Syrj\344l\344 <syrjala@sci.fi> adding
+    planar YUV support and some fixes to the grabbing code. Thanks.
+
+commit 8052ecceb19f713dc19976b2ae10df79922131ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 4 13:56:22 2002 +0000
+
+    Reset source surface pointer in window stack rendering state after blitting.
+
+commit 32b0fc7b32f99a56d6895ec1e828e93a02214db7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 3 19:56:32 2002 +0000
+
+    Enhanced documentation of DFBResult and DFBDisplayLayerCapabilities.
+    Renamed DLCAPS_INTERLACED_VIDEO to DLCAPS_DEINTERLACING.
+    Renamed DLOP_INTERLACED_VIDEO to DLOP_DEINTERLACING.
+
+commit 90f48fee8dc25fa5115be5e17ca6c8c87c0aa4b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 3 16:16:47 2002 +0000
+
+    Added new surface capability DSCAPS_SEPERATED for usage with DSCAPS_INTERLACED.
+    
+    Removed top level indention of directfb.h which looks strange but saves five
+    characters that can be used for documentation of enum or struct entries.
+    
+    Minor documentation beautifications, started to write complete sentences with
+    a capital letter at the beginning and a full stop at the end ;-P
+    
+    Removed "universe has collapsed..." print after "while(true)" loop.
+
+commit 739733971a78b0d0aad47d29ee16975f70b64a79
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 3 13:22:00 2002 +0000
+
+    Don't print an error message for EINTR.
+
+commit 9e4902f0957c330835cdb295a50e06c42b338d5f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 17:03:01 2002 +0000
+
+    Added macro DFB_ALLOCATE_INTERFACE_DATA saving 4-6 lines per file.
+    Added freeing "thiz->priv" to DFB_DEALLOCATE_INTERFACE saving 2 lines per file.
+
+commit 755bdad26908701dba84969652377ba79b93b296
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 16:21:10 2002 +0000
+
+    Unlink shared memory file during shutdown.
+
+commit 187e096b6f50329e7c78ac7e840cf51085a6592c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 15:22:53 2002 +0000
+
+    Debug version compile fixes.
+
+commit 6e677b80385bc75425372257413841b7220b36ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 15:13:28 2002 +0000
+
+    Small fix for compiling without rgb332.
+
+commit 4c539af7fa02bbd0f4408c87670ad2c3d3f62bf8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 15:10:45 2002 +0000
+
+    If no depth is specified use 16bit if supported or keep current.
+
+commit b4776f1c2fd413422225bf7da47152f19a2f228b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 15:05:38 2002 +0000
+
+    Added surface notification for palette updates.
+    Added display layer driver function "SetPalette" called by the surface
+    listener of the display layer core listening to the layer's surface.
+
+commit 47f01c07467cc37c6e67781ad489136b53acf1bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 14:36:55 2002 +0000
+
+    s/id/window_id/
+
+commit e5d44019d412d1795e6c6e3dfcef866411e570c3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 13:58:15 2002 +0000
+
+    Cleaned up vertical retrace handling by passing the flipping flags to the
+    driver (with DSFLIP_WAITFORSYNC eventually set).
+
+commit 53ea313fac073a01730ea38c8f7faa05700130db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 2 09:45:38 2002 +0000
+
+    More work on grabbing support by Ville Syrjala <syrjala@sci.fi>.
+
+commit b4cb5939f8233b8e2567e313c36007693a00959f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 1 16:46:16 2002 +0000
+
+    Added input_fake.h to libdirectfb_linux_input_la_SOURCES.
+
+commit e1777366e118f827fbd2a74787e8ec6cb3fddf66
+Author: holger <holger>
+Date:   Mon Jul 1 14:44:57 2002 +0000
+
+    use <input_fake.h> for definitions missing in <linux/input.h>
+
+commit 1096402a70953939d062e7bdf288095c86affa0e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 1 11:51:57 2002 +0000
+
+    updated copyright headers
+
+commit 2920f8184686b643650d60b36d9d2fee7de1a66d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 30 22:06:19 2002 +0000
+
+    Use flags instead of booleans for each state entity.
+
+commit 512c7aa5aacdeda969a144a3ed4607ab5bac84bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 29 23:40:30 2002 +0000
+
+    fixed a typo
+
+commit 578c4d1b5be71e53d39d5bdd810ebba7e3347d4d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 28 16:57:47 2002 +0000
+
+    Use one bit of DFBSurfacePixelFormat to indicate if the format has
+    an alpha channel. Added new macro DFB_PIXEL_FORMAT_HAS_ALPHA().
+    
+    Use the new macro from the GIF ImageProvider.
+
+commit 8e43429377afd90079d8dcba9599c6b48fe0f33c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 27 21:09:09 2002 +0000
+
+    An own FrameThread implementation for each capturing method, thanks again.
+
+commit 229e5b3a272c9bde22ff0d688ba7c2d51e2b98db
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 27 19:34:38 2002 +0000
+
+    Video provider now detects system only surfaces and does grabbing.
+    
+    Thanks to Ville Syrj\344l\344 <syrjala@sci.fi>
+
+commit e7f92f356d46d679ad545f4d35d377b30f182a03
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 27 14:46:14 2002 +0000
+
+    Nicer (and slightly faster) rounding code that yields the same result.
+
+commit 6f433462b372b9ca8a7e6d6187653b27ee8ab333
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 27 10:41:30 2002 +0000
+
+    A better fix for the rounding errors on scaling.
+
+commit fdff8497d30b16099577a7da465792c97f773407
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 26 23:04:03 2002 +0000
+
+    Do the right thing when rendering to surfaces with alpha channel.
+    More code cleanup.
+
+commit d26669671de7e340f3c0d39674008ec15df84804
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 26 18:34:32 2002 +0000
+
+    Initial version of color lookup table support.
+    
+    Added DSPF_LUT8.
+    
+    Added IDirectFBSurface::GetPalette().
+    
+    Added IDirectFBPalette with
+    - GetSize()
+    - SetEntries()
+    - GetEntries()
+    
+    Support by the software driver is in a very early stage.
+    
+    Played around with the method table grids of generated interface pages.
+
+commit 4c85141949cd3d15c62dec451207fc8abda594e6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 26 17:46:40 2002 +0000
+
+    Looks as if we had a rounding error in bilinear_make_fast_weights().
+    This change seems to fix it but it needs more testing.
+
+commit f9aac64e5771321b24ac463c04bcd82a9c86df01
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 26 17:09:38 2002 +0000
+
+    Added a function that searches for a color that is not in the colormap
+    and tries to pick one that is far from all used colors. Use it to find
+    a suitable colorkey to use for the transparent pixels.
+
+commit 71d7fbec1989578b603ed60b485816e9336f0d57
+Author: holger <holger>
+Date:   Wed Jun 26 15:27:16 2002 +0000
+
+    build linux_input driver only when ./configure was called with --enable-linux-input
+
+commit b78660ccc94064eec53805212ea0f7417ceb1340
+Author: holger <holger>
+Date:   Wed Jun 26 15:14:53 2002 +0000
+
+    arrgh!
+
+commit 2392285d826fa06f91812e8b9bd72e520a5904b1
+Author: holger <holger>
+Date:   Wed Jun 26 15:07:07 2002 +0000
+
+    - input driver for /dev/input/eventX devices
+    - you have to explicitly disable old keyboard and mouse input drivers
+      using the disable-module option if you don't want to get these events twice...
+
+commit f9a553be54c352df9eaef9fa168578008b0eec4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 26 14:18:59 2002 +0000
+
+    Applied patch from Daniel Mack <daniel@convergence.de> to avoid usage
+    information printed out.
+
+commit 0dc5a0d1b8048efc149296613cefdd9958df409b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 26 13:08:27 2002 +0000
+
+    reremoved
+
+commit 49e497d0396a637f9f015d21360a19cc381ce607
+Author: holger <holger>
+Date:   Wed Jun 26 12:29:41 2002 +0000
+
+    You can disable modules now by specifying disable-module=<modulename>.
+    We need this for the generic linux /dev/input/eventX driver
+
+commit f2b4974f87d3d5c6af01d796c350dfeec1a8b465
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 26 02:00:43 2002 +0000
+
+    Handling DSFLIP_BLIT now.
+
+commit 0b39a51b49d9b55ec218183d8215b93da0efea3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 24 18:50:49 2002 +0000
+
+    last try...
+
+commit f6f9e92c1c3a31ee1972b046337aa8c9276eee7f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 24 17:56:54 2002 +0000
+
+    Trying to synchronize buffer deallocation and stopping of DMA.
+
+commit cd26640af9a95ebf846e94d984f9a68715e2c30d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 24 17:36:50 2002 +0000
+
+    Removed CSNF_VIDEO from flags causing the video to stop.
+
+commit 17fe6402e7a13f523565f3f47178475afb77ad24
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 24 17:22:22 2002 +0000
+
+    Use surface listener to stop DMA when surface is destroyed or resized.
+
+commit 65c9973940884c23aba17d97a0c6e820969a2206
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 24 12:36:46 2002 +0000
+
+    Use the values yes or no for $have_x86 in order to get $have_mmx
+    defined correcly. Problem spotted by Wout Mertens <wmertens@cisco.com>.
+
+commit 797aed0042e6e1302696e2e7c7d4d317328393e9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 23 22:16:29 2002 +0000
+
+    Added sanity check to Resize().
+
+commit a6276bfc85979173a3db6783d7c4153203ede637
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 23 20:31:56 2002 +0000
+
+    Added pre/demultiplication to drawing functions.
+
+commit 041e97f65cc1b52b5dc8237ba1b9153bbb212539
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 23 18:49:46 2002 +0000
+
+    Destroy state during destruction of font, otherwise listeners will crash.
+
+commit 922a647e9c35c1dfb770becdea92a122d79d4b79
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 21 00:02:03 2002 +0000
+
+    Updated the copyright notice added by gendoc.
+
+commit f010697781b94a719bafe5c75e21d489fdfd133b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 20 15:57:30 2002 +0000
+
+    Made DirectFB-Internal require the exact same version of DirectFB.
+
+commit af1ae28608abd196151210d52b2cc32650bab56d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 20 15:30:45 2002 +0000
+
+    Added IDirectFBDisplayLayer::GetWindow() returning an interface to an existing
+    window identified by its window id.
+    
+    Increased version number to 0.9.13.
+
+commit 33e49faeee121b1126081526575e7fa5d1bd084a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 21:06:27 2002 +0000
+
+    Added savage_bci.h to SOURCES.
+
+commit db71c15f1ea76d24fe928ba47751e1d004d4bc20
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 20:58:40 2002 +0000
+
+    Updated ChangeLog and NEWS for 0.9.12 release.
+
+commit 6af05be6dabed2b29a0cbc871d56f4a1fe3dc744
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 20:26:44 2002 +0000
+
+    Slightly improved description of IDirectFBFont API.
+    
+    Create glyph surfaces with with a height of ascender - descender
+    instead of using font->height.
+    
+    Don't bail out if setting the encoding failed in the FreeType2 font
+    provider. Users might want to use symbol fonts and should be allowed
+    to do so (they just need to know what they're doing).
+
+commit 296a2e151d8caef100b8ed9c28330af39cde5458
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 19:49:34 2002 +0000
+
+    oops, one more place that needs to be adjusted
+
+commit 89f719052bf7d4e83ae427cf171af23a7cd166da
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 19:41:07 2002 +0000
+
+    Corrected my last commit: Set height to 24 (vertical offset to next line).
+    Fix descender as well (it's supposed to be a negative value).
+
+commit ffddb9426586f4034a8fd5a771c54ce749c7d40c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 19:37:36 2002 +0000
+
+    Set the font height to 24 for the default font. Font height is supposed
+    to be the vertical advance to the next line.
+
+commit a703012e1ca5e74a029baf55d262552dfab05cd9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 17:46:01 2002 +0000
+
+    Some smaller updates to the README.
+
+commit d750221af9bc1afec84c9e711b6a209b2e3ebb9a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 19 16:53:04 2002 +0000
+
+    Added Alex SONG <zzaleson@uqconnect.net>.
+
+commit 7f53f9c90050d01952356adb038d8e8b79a16bcf
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 16:40:06 2002 +0000
+
+    Removed global font_state and added state and pixel_format to the
+    CoreFont.  Both are initialized to default values by dfb_font_create()
+    but may be altered by the FontProvider. This gives the FontProviders
+    control about glyph surface format and glyph blitting. This change
+    makes it for example possible to write a FontProvider for ARGB fonts.
+
+commit 69b1c2f3ed8471cf77f0ba1cea86590be9e2aaed
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 14:20:52 2002 +0000
+
+    added DIKS_EXIT and DIKS_SETUP
+
+commit 67299bff7bc399b36d594dc9020e760a44fed83d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 12:51:50 2002 +0000
+
+    Updated ChangeLog. Started to summarize changes in 0.9.12.
+
+commit cf00f7adecd62842cf9106b4419a037a9651a8f2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 19 12:34:39 2002 +0000
+
+    Applied a patch from Alex SONG <zzaleson@uqconnect.net> that fixes
+    savage4SetState() for src colorkeying.
+
+commit 7495c15142fbc2e103c089f4e8e891aab2e34ec7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 19 03:12:46 2002 +0000
+
+    Removed two bugs ;)
+
+commit 5918c9b52046c38de5bd9cc0dbc33f8113c015e4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 19 02:34:19 2002 +0000
+
+    Use diffused alpha if source format is RGB32 to force the alpha values to 0xff.
+
+commit 93559c107b69919b8f237b2228f13f13f0aae367
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 17 23:25:21 2002 +0000
+
+    Declared some local variables in inner loops as register variables.
+    Declared local variables in SET_ALPHA_PIXEL_ARGB as __u32;
+
+commit 710c5e5d41be5b8bd63638f8ad2ecd07381e6bd3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 17 22:46:00 2002 +0000
+
+    Added macro SET_ALPHA_PIXEL_DUFFS_DEVICE() which implements Duff's
+    device with a depth of 8. Use it for all but the RGB24
+    Bop_a8_set_alphapixel_Aop_* functions.
+    
+    Undefined the SET_ALPHA_PIXEL_* macros after usage and removed lots of
+    unneeded brackets.
+
+commit 91cd40d25b1f4c28883a5ece7dd6e864c5d972dd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 17 21:54:01 2002 +0000
+
+    More work on the Bop_a8_set_alphapixel_Aop_* functions. Use Cop instead
+    of the color struct, cleanups.
+
+commit b1a6474615cadee807f8a974afb7e78d9488c852
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 17 21:32:29 2002 +0000
+
+    Cleaned up Bop_a8_set_alphapixel_Aop_rgb[15|24|32], register variables
+    locally. Gives 7% speedup in the 32bit case.
+
+commit ac1be09d195d3a657d75fec52b673d27e48e1090
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 17 19:30:40 2002 +0000
+
+    Wait for initial DWET_POSITION_SIZE event in IDirectFBWindow_Construct().
+
+commit 773d7d1720c017c6537cf6b65545cdca115b9fb2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 17 17:30:05 2002 +0000
+
+    Fixed rendering pipeline setup for blended blitting for these cases:
+    - destination blend is DSBF_ZERO, but source blend needs destination
+    - destination blend is not DSBF_ONE and source blend needs destination
+
+commit 9de43772ac66b749b8c4ed3ebf9b3f9aa49d8027
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 17 08:09:47 2002 +0000
+
+    vsync handling during flip operations needs a cleanup/rework
+
+commit 192f1a2f09f1504078e7624bb6d47de07cd41223
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 17 06:53:29 2002 +0000
+
+    Fixed a bug in ALPHACTRL blitting setup, output alpha channel was wrong when
+    blending was used with destination blend function DSPF_ZERO.
+    
+    Corrected ALPHACTRL drawing setup. Use diffused instead of texture alpha
+    and select an alpha write mode other than FCOL. Doesn't fix a known bug
+    but should be correct now for drawing with DSDRAW_BLEND to surfaces with
+    an alphachannel.
+
+commit 8afa70659ec02d87f1fefa110d8d3203529e1d45
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 15 19:55:31 2002 +0000
+
+    Added 8 bit support to IDirectFB::SetVideoMode().
+
+commit 06ed3ec73ac8d963d1bfd694d284bc281744072d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 14:49:02 2002 +0000
+
+    Brutally optimized A8 font rendering for RGB16 ;-)
+    
+    P3 800E, G450 SDRAM, no-hardware, gcc-3.1
+    
+    59 -> 67 MChars/sec (video memory)
+    275 -> 326 MChars/sec (system memory)
+    
+    
+    Can be done for other formats as well.
+
+commit 3f2880a855e3dac36df1e402bca6b2f5d291e99d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 13:32:16 2002 +0000
+
+    Added DFB_NUM_PIXELFORMATS macro.
+    Use it for the generic driver's function tables.
+
+commit 2a7887e9415ca8c88785707a524e5788b5c5d94a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 13:11:24 2002 +0000
+
+    Check source format in gAcquire().
+    Use ONCE in rgba_to_dst_format() to avoid tons of error messages during
+    image loading to unsupported destination formats.
+
+commit cdd264bf25bd8f592db2a774c4f32a23a281285d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 12:58:02 2002 +0000
+
+    Implemented planar YUV blitting support in software driver.
+    Minor code cleanup, better support checks and cleanup fixes in gAcquire.
+    "ONCE" messages are independent of debug mode now.
+
+commit bc9fb0ef465c7af28dbfa0b8c6b15c53a0e33880
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 03:48:27 2002 +0000
+
+    qsort needs an extra compare function getting two entries instead of
+    a string and an entry, works now.
+
+commit 8ae0e10070d8bdd8f1793c97e1010747639e1c8b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 14 00:31:14 2002 +0000
+
+    Don't use videoalpha mode if dst_blend is zero.
+
+commit 895c33deb178bce25f9cc2bad238114ecbade95f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 13 17:14:59 2002 +0000
+
+    Fixed off by one bug in mmx version of Xacc_blend_invsrcalpha.
+    Minor optimization in setup code.
+
+commit c931dd09959a8f8cf0d6e6ff85598c0c9cbcb376
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 13 15:45:51 2002 +0000
+
+    Fixed warnings if sighandler is disabled.
+
+commit 39107fa8d2354aaf84902a1aaf285af445134592
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 13 15:06:42 2002 +0000
+
+    Fixed concurrent destructions of windows.
+    Added some debug output.
+
+commit da9283bad05f41dca1bf08fcb8d5ef4d09ed1882
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 13 11:35:41 2002 +0000
+
+    removed the voodoo1 workaround
+
+commit aca038f4f159dd6538a5acd41ddc9ea011369d92
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 13 11:30:44 2002 +0000
+
+    removed obsolete FIXME
+
+commit fe251694a6b6c363769abc10b17adacba86a35ca
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 12 17:53:03 2002 +0000
+
+    Fixed parameters for SetConfiguration call in dfb_layers_resume().
+
+commit f5e9229723f7b930f272296c3a73c43cf7398f10
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 12 08:31:24 2002 +0000
+
+    Implemented besFlipBuffers() which should have been implemented in 0.9.11 ;(
+
+commit 4459aafac0685f25786ddd8af262049919e1406b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 11 12:18:47 2002 +0000
+
+    Include directfb_keynames.h instead of defining our own array.
+    Sort the keynames array by names on first call of lirc_parse_line(),
+    then use bsearch to lookup the name.
+
+commit 30149f3dcdd02fc495674b0b1a19016b9988d1e8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 20:18:00 2002 +0000
+
+    Replace currency sign (0xa4) by euro currency sign (0x20ac).
+
+commit 6568d964303d4ad47736b6f8cdcec1de336cc556
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 10 18:59:38 2002 +0000
+
+    Use unsigned int for Unicode glyph indices.
+    Added DSFT_BOTTOM to DFBSurfaceTextFlags.
+    Fixed bug in IDirectFBFont::GetGlyphExtents.
+    Made IDirectFBFont::GetGlyphExtents() and IDirectFBFontGetKerning() fill
+    in zero values if the glyph isn't found and return DFB_OK.
+
+commit 927f074f82a97752c2934c45c38e0978ac2fb44e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 18:12:57 2002 +0000
+
+    Added DIDID_ANY for devices not prefering a primary device id.
+
+commit 77cd6fc61a9211cf5c023278d4a846874c0b15d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 18:08:56 2002 +0000
+
+    Added DIDTF_VIRTUAL for virtual input devices.
+
+commit 040fa6cc492f273d114c0232a011c2e4a5377efa
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 10 17:43:37 2002 +0000
+
+    Added IDirectFBFont::GetKerning() and IDirectFBFont::GetGlyphExtents().
+    Added IDirectFBSurface::DrawGlyph().
+    This should enable users to implement their own simple text layout engine.
+
+commit c2a82e85ef2947e0d2e6bcdecd9ec3fa67f58ba7
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 10 13:04:14 2002 +0000
+
+    fixed typo in comment
+
+commit 3da9e67a99cfe61a13ba0c757457b1a47b03ca32
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 10 12:42:18 2002 +0000
+
+    Made configure warnings more visible. Added extra warnings if PNG, JPEG
+    or FreeType2 support is missing.
+
+commit 5fcf89a55de855f75c2e6f277f602f3aa3078c5c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 10:11:00 2002 +0000
+
+    Added cross compiling notes by Scott A McConnell <samcconn@cotw.com>.
+
+commit 48148e0fe011904df9b3c0455ef04f6f281bb292
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 09:04:16 2002 +0000
+
+    Fixed modifier mask problems that occured if the left and right version
+    of a modifier were both pressed.
+
+commit e629e4bd67d551a3a581b3c1daa23441c3b10e69
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 08:06:08 2002 +0000
+
+    Check for FUSION_FAKE instead of DFB_MULTI, could have caused problems
+    with multi application core when slaves need to fetch a keymap entry.
+
+commit cca6872f4e2b646699ea45ba3c23778db8d360a3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 10 07:13:35 2002 +0000
+
+    Added structs DFBPoint and DFBDimension that are not used yet by DirectFB
+    but are already useful for applications and libraries.
+
+commit a723ad52aa46a64c9eb6cff26532bef76e91b650
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 9 04:43:39 2002 +0000
+
+    Make sure DFB_IDNOTFOUND is returned if GetDisplayLayer() doesn't find the id.
+
+commit bc7a7ce98686305ca0a85cecad19ff61eb2f99cd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 9 02:36:34 2002 +0000
+
+    Added a mask of currently pressed buttons to input and window events.
+
+commit 69c80a7514537d51811a3a6bef193fb2e2ea87c3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 7 19:12:44 2002 +0000
+
+    oops
+
+commit 37ce6cc99310ae51fcd853b2f89ff6df8d4a7ac4
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 7 18:23:21 2002 +0000
+
+    fixed dfb_utf8_next_char() (spotted by Holger Waechtler)
+
+commit a9b803b27065a065822a646ed094570bbe7810cf
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 7 18:05:32 2002 +0000
+
+    Added inline function dfb_utf8_prev_char().
+
+commit 0be8e39b640f8b4cc08bcd434ce034eec86b97a6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 7 16:27:28 2002 +0000
+
+    Use sigaction instead of signal.
+
+commit 859145289eca4f23e8691b0b8c2d02e0c8a568cd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 7 16:26:08 2002 +0000
+
+    updated copyright
+
+commit bb0e7a67b742f848747eef265212c23e18119230
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 7 15:57:44 2002 +0000
+
+    Updated Joachim Steiger's e-mail address.
+
+commit 1ffdcdfff1f2441931b2a1a59fa22aa60275e3be
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 7 15:00:33 2002 +0000
+
+    Updated copyright notice in banner.
+
+commit 9b22b03a41e941747c8c69af4841ab36aaa0fbc3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 7 12:17:36 2002 +0000
+
+    Generate DFBKeyIdentifierNames, too.
+
+commit cbabd2d840abdfeacd4cabad14a63e7e0a79ce62
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 7 10:54:16 2002 +0000
+
+    Added experimental blitting flags DSBLIT_SRC_PREMULTIPLY, DSBLIT_DST_PREMULTIPLY
+    and DSBLIT_DEMULTIPLY which can be used for complex blending operations which
+    distinguish between premultiplied and non-premultiplied alpha channels.
+
+commit c01d8a70c829d75cac874d01c54ed1d57f48014a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 6 16:59:02 2002 +0000
+
+    Forced comments into 80 columns.
+
+commit 2b8263b1cf4789781469d0f7ab5b17fd663373b6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 6 13:38:01 2002 +0000
+
+    Improved description of IDirectFBFont::GetHeight().
+
+commit 820d160de30061ef8cbd39a73daf1ccef7933761
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 6 11:40:02 2002 +0000
+
+    Applied patch from Ville Syrjälä <syrjala@sci.fi> that fixes
+    IDirectFBInputDevice_GetXY().
+
+commit a7f1cfdc15218b6c61f8da570bc964e21017b1d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 21:52:40 2002 +0000
+
+    Added second windows key as META_R, made the menu key SUPER_R.
+
+commit 36ac057b9f16dbfa5c9986fa28c7a40f466a864f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 5 15:16:18 2002 +0000
+
+    Bumped version number to 0.9.12.
+    Added key identifiers for the remaining keys on a PC105 keyboard layout.
+
+commit 68f7d98af8c25453e902de239af3b76f2966845e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 02:37:24 2002 +0000
+
+    Once more a fresh ChangeLog
+
+commit d381a03863eb683be374ae5701b8f551bfc17181
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 5 02:33:06 2002 +0000
+
+    Added dfb_static_build_example and ipc_cleanup to EXTRA_DIST.
+    Explained their purpose in the README.
+
+commit 4a94d5c994497b0159f52c5c6e39319b6bc6a66d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 02:20:50 2002 +0000
+
+    Use hash table with predefined real names and e-mail addresses for short names.
+
+commit 0c865c1d17dd5f238c915070bc34b50d989ee1a8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 02:02:34 2002 +0000
+
+    Removed 32bit modes that were copies of the 16bit modes.
+    Fixed typo.
+
+commit 310a6dbc6ceeeb55dc26315344354ed6ad52d756
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 01:47:06 2002 +0000
+
+    - Fixed keypad decimal with NumLock active.
+    - Updated NEWS and ChangeLog.
+
+commit 43bdd1cf585bdaa1d35f7ac26d8d6c0658918fdc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 5 00:27:52 2002 +0000
+
+    'directfb_keynames.h' will be generated and installed for applications.
+    It's a mapping from a key symbol to its name.
+
+commit c7ed7abb18e8da8c4fc7b69e7798e05512d799f8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 4 22:50:20 2002 +0000
+
+    Updated README.screenshots.
+    Added ppm(5) to SEE ALSO section in directfbrc(5).
+
+commit bc098287f833cc1525c7fd0f794daf62596b5cbc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 21:51:20 2002 +0000
+
+    Added option "screenshot-dir=<directory>" that enables PPM screen dumps
+    when the <Print> key is pressed.
+
+commit 1c6439e83ac7aa4f99e20cf72f401f3f9821a109
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 4 19:30:35 2002 +0000
+
+    slightly reordered key identifiers
+
+commit 48ce588c03281884d72fcf28bf5586c8247ea29f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 19:10:05 2002 +0000
+
+    Added Meta/Super/Hyper  key_id <-> key_symbol translation.
+
+commit 22294ea18414d86f8dbbb009e794f74f69ab499d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 4 19:06:38 2002 +0000
+
+    Renamed DIKS_*LOCK to DIKS_*_LOCK and DIKI_*LOCK to DIKI_*_LOCK.
+    Renamed DIKI_CTRL_* to DIKI_CONTROL_*.
+    Added left/right versions of DIKI_ALT, DIKI_META, DIKI_SUPER, DIKI_HYPER.
+
+commit de228abbd5e6f1c3c03197585d8579e95c1e34d9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 4 18:40:22 2002 +0000
+
+    Cleaned up dfb_utf8_get_char(), make it use the dfb_utf8_skip table.
+    Declare the dfb_utf8_skip table as const.
+
+commit 704f62e0fc0b2103dda1964a036dcb4578ec4bdc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 17:58:16 2002 +0000
+
+    Added support for left/right shift/control via identifiers.
+    Added support for special pc105 keyboards (adding Meta and Super).
+    Fixed warning in v4l provider with gcc 3.1.
+    Removed commented out and finally obsolete line in generic driver.
+
+commit de854a002943ae90171402dadd2c94e6c8337107
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 4 17:28:03 2002 +0000
+
+    Added more dead keys as found in X11. Ordered dead keys alphabetically.
+
+commit 1bfa5e752f74877040fc9da4c3098dbda0a6d27b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 16:37:37 2002 +0000
+
+    some day CLUT/ALUT support would be nice
+
+commit 3c9f633f2cf3cdb60d8ed16fba624d2474736d51
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 16:35:49 2002 +0000
+
+    Removed keycode TODO.
+
+commit 9b4e55edbc80c0dac5e0f9720d84141ded707fea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 08:30:15 2002 +0000
+
+    Two minor changes that help a lot getting DirectFB running for everyone:
+    - Always 8 bit modes to the mode list, too, depth of fb.modes is ignored anyway.
+    - Default to 16 bit if no depth is specified and first mode in fb.modes is
+      8 bit while RGB332 support is not compiled in.
+    
+    The only way to have it not running now is to explicitly set "depth = 8"
+    in the configuration without support for RGB332.
+
+commit 5eb53b405bfb39ec69b9959030823b67db743473
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 07:50:59 2002 +0000
+
+    #if 0'ed old code, added 40ms sleep after shutdown vt switch, too.
+
+commit 8b416cf5b2d688768a9b93f84829d3d700e7743b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 07:16:50 2002 +0000
+
+    Commented out 'normal' errors at startup, VT rewrite after release ;(
+    Added time and date when core.c got built to initialization output.
+
+commit 7f70c92cb454da3f8e34c1db664cbe5da3b27a74
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 06:40:01 2002 +0000
+
+    Little tweak for format conversion blits (163 -> 192 MPixel/sec on G550).
+
+commit a23b23684c7327c00d80133d35c8983b9d12ff89
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 04:44:49 2002 +0000
+
+    - Added DIKS_BREAK.
+    - Ctrl+Alt+Break sends a SIGINT now (like Ctrl+Alt+BackSpace a while ago).
+
+commit f1210f3b5df058ac640c292bf6eb2196e1d3fe16
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 4 00:09:20 2002 +0000
+
+    Return DFB_UNSUPPORTED in PlayTo if destination is double buffered.
+    Increase buffer's video instance locking counter,
+    buffer is sticked to video memory then.
+
+commit c360aecb50380536650365daeda7fc94d259da86
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 3 20:04:17 2002 +0000
+
+    Store cached kerning values as 16:15:1. Shouldn't be relevant but makes
+    more sense.
+    Updated NEWS file.
+
+commit 4203c0d4c3549ecf1e82efc39a23a09a00c13cb1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 3 19:07:25 2002 +0000
+
+    Fixed alpha channel detection in GetImageDescription, libpng seems
+    to want pointers to width, height and bpp, too.
+    
+    Do some more cycles for memcpy test.
+
+commit e84e55b070e1ebd5b114ab059ca2cdc4d7a4c174
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 3 18:06:42 2002 +0000
+
+    dfb_gfxcard_state_check(): Always check front and back buffer policies and
+    set acceleration bits accordingly.
+
+commit 43fc6183f421faa71d52a3fcaaf2d851b60cc5da
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 3 11:39:22 2002 +0000
+
+    Need to set SMF_COLOR not SMF_DRAWING_FLAGS to indicate the color change
+    in IDirectFBSurface_Clear().
+
+commit 536c033b21015f815e8a52d05e302d7474c8910b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 3 10:32:20 2002 +0000
+
+    In IDirectFBSurface_Clear() pass a copy of data->area.current to
+    dfb_gfxcard_fillrectangle() since the latter modifies the rectangle.
+    
+    Added more const statements to the internal clip API to make it easier
+    to understand what the functions do.
+
+commit 781064fbbe86bac3be740e35cbf93634992f7269
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 3 09:52:15 2002 +0000
+
+    Declared parameters that are not changed as const. Might help the compiler,
+    definitely helps the developers.
+
+commit ed705564e385163d567569cca442e2c00ca51af3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Jun 2 14:41:33 2002 +0000
+
+    Check the dimensions of the rectangle passed to dfb_gfxcard_tileblit().
+    If an invalid rectangle is passed, print a BUG warning and return instead
+    of going into an endless loop.
+
+commit 6972582189162a212bf4b4c649dd22caa2ed1ef4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 1 06:07:17 2002 +0000
+
+    Added IDirectFBSurface::Clear(), see the documentation details.
+
+commit 7361a808a015ccbf4eb4d2b5311f775239b0cf93
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 31 22:09:03 2002 +0000
+
+    fixed warning
+
+commit e29329b5eb6fbce7a588638ee2de90075f807fb2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 31 00:27:32 2002 +0000
+
+    Added function by Antonino Daplas, changing the buffermode of layers may
+    work now, untested.
+
+commit 49c46156985e8a015c565c6a1404b671a53a4f16
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 30 15:06:48 2002 +0000
+
+    Sacc_to_Aop_rgb16 does aligned writes now, gives 1-3% on my Intel machine.
+    Please test "df_dok --fill-rect-blend", add "--dfb:no-mmx" on machines with MMX.
+    Also try the difference in system memory with "--system".
+
+commit d44c08e053dfc12c7b343d20ea6a516bf87b89a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 30 09:22:05 2002 +0000
+
+    argb-font is no longer required on G400 and above!
+    
+    Fixed A8 font rendering by enabling "Inverted Decal information" for A8 ;)
+    (by the time I get used to those lighting flow charts)
+    
+    If G200 is detected, argb-font is set automatically,
+    there's no reason anymore to set it manually the configuration at all!
+    
+    Set proper minify/magnify threshold, irrelevant change, but be correct ;)
+    
+    Fixed log2 for values that are a power of two, didn't change anything though.
+
+commit 1c50df52bdeacb0d4d9965ff04a1ac7dc9b8b86a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 30 05:24:19 2002 +0000
+
+    Fixed Delete on keypad.
+
+commit 0fe554fef16883121d722e0c274b02dd67701408
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 29 20:12:30 2002 +0000
+
+    Added IDirectFBInputDevice::GetKeymapEntry() which fetches a
+    DFBInputDeviceKeymapEntry for a specific hardware keycode.
+
+commit 16cd676ee88cb877ab22bdfbc40e40494bce98a6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 29 11:37:40 2002 +0000
+
+    Added autom4te.cache to .cvsignore (for automake-2.5x).
+
+commit e198b34077ecbd24774e2a477f95db1503dd69ed
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 29 11:19:17 2002 +0000
+
+    Added 0.4.0 version of savagefb that is supposed to add acceleration for
+    fills and blits. Unfortunately it doesn't yet work correctly. Don't use
+    unless you want to work on it.
+
+commit dc3ea7323b15821d90e77d435f4be204bb8bd76c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 29 03:54:58 2002 +0000
+
+    Savage driver release, untested for a long time.
+
+commit 0d0ce309854b44036308c5d13380d36ecbef6557
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 29 03:11:06 2002 +0000
+
+    Added prototypes.
+
+commit 23f977ef22cc0e18a06f331b8c3dbc9fbbacd936
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 29 03:00:12 2002 +0000
+
+    Use shcalloc() for the keymap and retrieve all entries once during
+    initialization if multi app core is used.
+
+commit 5036c688b856bebe51c489ce3536787ce0fa2ea4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 28 23:48:22 2002 +0000
+
+    Added keymap support to input core.
+    
+    Added a driver function to retrieve a complete keymap entry for a keycode.
+    
+    Keyboard driver event thread is much simpler now, it passes the hardware
+    keycode and if it has been pressed or released to the input core via
+    dfb_input_dispatch() and the input core looks up symbol and identifier and
+    handles modifier/lock masks. The keyboard driver then simply writes back
+    the lock state to the LEDs.
+    
+    Added DFBInputDeviceKeymapEntry that will soon be useful with some API calls.
+
+commit 7f745d5d895b1701c77ef11f9537273fe8555afa
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 28 17:52:36 2002 +0000
+
+    oops, we need to call aclocal of course.
+
+commit 05bd4992c6eff42b5a02579e1bb978fe32c8a58f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 28 17:46:47 2002 +0000
+
+    Cleaned up autogen.sh and improved its output in case of problems.
+
+commit f9d9d70846e12cc2a90103a7563c5e44ec736df8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 28 01:36:11 2002 +0000
+
+    Fixed directfb-config.
+    Converted debug printf to DEBUGMSG.
+
+commit 1e252e691ab04b2132e9b4ba35f59b6d5c478928
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 28 01:06:51 2002 +0000
+
+    Use the third argument of AC_DEFINE to pass descriptions for our defines.
+    Removed unneeded acconfig.h. Works without warnings with autoconf versions
+    2.13 and 2.53 now.
+
+commit 09ecf7769ee27630530fd7e857410cbc03a22c9b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 23:39:19 2002 +0000
+
+    Last commit included key_id to key_symbol translation (id_to_symbol)
+    and generic handling of modifier and lock mask.
+
+commit a5e45a13c94bb602a2c17cc82a7e3efb02f5fcd7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 23:37:46 2002 +0000
+
+    Added DIKS_BEGIN.
+    
+    Removed key pad identifiers that are physically the same key as the numbers.
+
+commit 4dde74c3ec979a5d8536f5339333719897b95159
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 19:54:31 2002 +0000
+
+    really fixed now
+
+commit e34ab408d35e1e9e225a34b6159b399e95da8513
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 19:48:56 2002 +0000
+
+    Fixed PageUp/Down, Insert, Delete.
+
+commit 3c25277fa396148619205f5ec05840f788623005
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 19:26:33 2002 +0000
+
+    Fixed backspace, why does the kernel return 0x7f for backspace?
+
+commit 999ccc88f695dc34e4c4b04389b51a990adfcc37
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 19:04:26 2002 +0000
+
+    DFB_LOWER/UPPER_CASE was wrong
+
+commit 340ad928119b29e658a188327a8a5d2333cd19d9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon May 27 17:42:13 2002 +0000
+
+    Completed the PAGE_UP, PAGE_DOWN, ... changes.
+    Removed DIKS_KP_* symbols and NUMPAD DeviceKeyType. The numpad keys
+    should return the same symbols as the 'normal' keys they respond to.
+
+commit 2c778488d3e7538d2ef76014eac21b4d962294b6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon May 27 17:10:06 2002 +0000
+
+    PAGEUP -> PAGE_UP, PAGEDOWN -> PAGE_DOWN.
+    Same for VOLUME[UP|DOWN] and CHANNEL[UP|DOWN].
+
+commit 4003e3e97b682476de5df792bafe1d9cf500d2e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 17:00:28 2002 +0000
+
+    fixed macro compilation
+
+commit 4b6073867b22b03480be3ec328dd1d0b1d7eebdf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 16:58:44 2002 +0000
+
+    Added DFB_LOWER_CASE and DFB_UPPER_CASE which can be wrapped around a symbol.
+
+commit 553b2fe5250614b5f5620a881bd1e9317456c24c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 27 15:51:54 2002 +0000
+
+    Adding sophisticated keycode/keysymbol handling to DirectFB for more
+    sophisticated applications like XDirectFB and the new keymap stuff in GDK.
+    Writing input drivers for keyboards will also be easier.
+    
+    There are to types of key mappings, a basic one (the one before) which is
+    suited for games and an advanced one for applications which need full
+    coverage of the Unicode 3.x character space and the ability to query the
+    keyboard layout.
+    
+    The DFBInputDeviceKeyIdentifier is now contained in "event.key_id" instead
+    of "event.keycode". "event.key_code" is the hardware keycode which is usually
+    not of interest.
+    
+    A new enum DFBInputDeviceKeySymbol is a super-set of the Unicode 3.x character
+    space which is compatible to Latin-1, so "key_ascii" has been removed in favor
+    of "event.key_symbol".
+    
+    DirectFB header files (which include "directfb_keyboard.h" now) are installed
+    to "$prefix/include/directfb/". Applications honoring the CFLAGS within the
+    pkg-config file should have no problem with that.
+    
+    Updated all copyright headers.
+    
+    The keymap stuff is still work in progress, but the functionality to have
+    all applications running again already exists.
+    
+    
+    Short porting instructions:
+    - Replace keycode by key_id and DIKC by DIKI
+      and/or
+      replace keycode by key_symbol and DIKC by DIKS
+    - Note that the remote control keys have been removed from the
+      basic mapping to reduce overhead
+    - Note that the cursor keys in the advanced mapping have a DIKS_CURSOR prefix
+    - Note that the letters have DIKS_SMALL and DIKS_CAPITAL prefixes
+
+commit 71562b701e1cb46b0fd4deca5ec97a3ee2c47f78
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 26 00:51:34 2002 +0000
+
+    Applied patch from Antonino Daplas <adaplas@users.sourceforge.net> checking
+    for CGA/MDA emulation before polling for the vertical retrace.
+
+commit 963818681a4bcf82832ded96555595991274f32c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 24 11:22:45 2002 +0000
+
+    More work on the man-page.
+    
+    Converted C++ style comments to classic C comments where appropriate.
+    Searching for '//' should now only show parts of the code that need to
+    be reviewed.
+
+commit e338cadea8fec47a6227819a8720a63f4509b5c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 24 08:51:58 2002 +0000
+
+    Splitted desktop-buffer-mode text moving parts of it to the different modes.
+
+commit d4d505a816aa77320def44bc7f1813d8be0eae80
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 24 08:35:25 2002 +0000
+
+    Added planar pixel format blitting bug and G550 blending to ARGB bug.
+
+commit 9ff8ad46a3969044f4e10c44b03b493ef9b1ae04
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 24 08:26:12 2002 +0000
+
+    Removed unnecessary AC_SUBST.
+    Changed z axis delta for Jogdial to 1.
+
+commit 038143ba0b5ec6939d95011ffb48920d3632a815
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 23 22:07:46 2002 +0000
+
+    Added a text to desktop-buffer-mode.
+
+commit 5a15a26f0871c2f73d92dff89029a00ee6361b48
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 23 20:27:12 2002 +0000
+
+    more work on the man-page
+
+commit b7b1565e091e9808ed025b12f55f9d8d9fb98f84
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 23 15:25:33 2002 +0000
+
+    Declare boolean config variables as bool. Renamed some no-variables to
+    their positive counterparts. Added the possibility to use no- with lots
+    of config variables.
+    
+    Changed "no-window-opacity" option to "translucent-windows".
+    
+    Changed the man-page accordingly.
+
+commit d8b5dd288f00aaa4f7c0f489edad38b1a48884dd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 23 14:22:23 2002 +0000
+
+    described more parameters
+
+commit c86f15abf1fb96aebf6d684cdd05ef0377ffb37e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 22 16:03:28 2002 +0000
+
+    Added index field to FontDescription that allows to control which face is
+    loaded from a font file that provides a collection of faces.
+
+commit d4c70094c14253342fe0156658f963c2c9189957
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 20 22:19:24 2002 +0000
+
+    Added IDirectFBWindow::EnableEvents(mask) and DisableEvents(mask).
+
+commit 3bb5277e3a26520cda181c11cfa48fea1bf2de11
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 20 19:53:47 2002 +0000
+
+    Added reallocate_surface() todo.
+
+commit bb28f1d51f9431b40cfd0a007f7ba19e468edc9a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 20 19:47:04 2002 +0000
+
+    Support DLBM_BACKVIDEO in generic allocate_surface() for layers.
+
+commit a7be4dd57e6f49811e85bd3c9d4114b3bf6d6fa0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 19 10:02:13 2002 +0000
+
+    Set event class in dfb_window_dispatch() and dfb_input_dispatch() to be sure.
+
+commit 1b5cf5acb4256aa407e0bb1623479e1fc5e36425
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 19 09:50:53 2002 +0000
+
+    Fixed IDirectFBWindow::Close() sending no event that got broken
+    during introduction of IDirectFBEventBuffer.
+
+commit 79816203f88adbd69d604be17751e007640472e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 19 01:20:41 2002 +0000
+
+    Console acceleration, fixes coexistence with X, removed VGA cruft (not needed).
+    
+    You need to add "video=vmware:noaccel" to use DirectFB and do a Power OFF,
+    it's a bug in VMware which is fixed in the VMware that is not yet released ;)
+
+commit 6bf35201295b093deb9763fc9bf2c1a542499c6a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 19 00:19:47 2002 +0000
+
+    Align system memory back buffer pitch.
+
+commit 936df5dc741669735310540b728d78f94d140b7d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 18 02:10:12 2002 +0000
+
+    documented more options
+
+commit 99ad8431b5d6047060f3c856ba6f5d28838bbbad
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 17 20:15:22 2002 +0000
+
+    Define BINARY_VERSION as the earliest version that this release has
+    binary compatibility with. Use BINARY_VERSION in MODULEDIR. Don't a
+    version number in INTERNALINCLUDEDIR.
+
+commit 4d24b43fd00f12adf32525a810c51cbc2c491d45
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 17 18:36:55 2002 +0000
+
+    First draft for a directfbrc(5) man page. Work in progress...
+
+commit 569a7c798b6734242fe2b356078a6413a6223b8a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 17 15:56:57 2002 +0000
+
+    s/gz/bz2/
+
+commit 6d9887419bccf96b5b9c4b248e2aaca063596df6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 17 15:56:13 2002 +0000
+
+    newer version
+
+commit 7824736e64c8dc311af553f807e08698adef8af5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 17 15:54:11 2002 +0000
+
+    Forgot to increase the graphics driver abi version.
+
+commit 720dbf9d69034aa244a32eec996c4b1cbac8b511
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 17 15:52:48 2002 +0000
+
+    Added IDirectFBDisplayLayer::GetLevel() and SetLevel() which can be used to
+    query/change the z order of display layers. Added DLCAPS_LEVELS.
+
+commit c0ec058507214793182246bdccb66efb558bd251
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 14 16:38:32 2002 +0000
+
+    VMware SVGA framebuffer driver to have DirectFB running under X in a window ;)
+    Or fullscreen with XDGA (nearly as fast as native).
+    
+    http://master.dyndns.tv/vmwarefb.png
+    http://master.dyndns.tv/vmwaredfb.png
+
+commit 760ed61cbdf762adb98944a653b06e6657a1c5f8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 11 22:49:42 2002 +0000
+
+    If the desktop buffer mode is backsystem, create system only window surfaces.
+
+commit 830b77cdb50465ac5c227d1b392c0ead9b8b08cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 11 22:34:20 2002 +0000
+
+    Use fix_screeninfo.line_length after setting the mode to get the byte pitch
+    instead of using the virtual resolution which may differ.
+
+commit c594073eb52a05255223d7187c0ab0c4b26627ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 10 19:03:18 2002 +0000
+
+    Append version number to directories (e.g. '/usr/local/lib/directfb-0.9.11').
+    Thanks to Fredrik Hallenberg <hallon@lysator.liu.se>,
+    the Debian package maintainer of DirectFB.
+
+commit aba286523dac3a90eab267e8f9d6717e23f24c1b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 10 18:27:34 2002 +0000
+
+    Avoid locks during emergency shutdown, just turn off layers.
+
+commit 70b29a6ef063ad1e7262294fa770403f035660f4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 9 23:06:04 2002 +0000
+
+    fixed segfault on startup when no fb device is available
+
+commit d9218192036fb2b26aef157725b8b1c54b69d097
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 8 00:29:06 2002 +0000
+
+    Added IDirectFBWindow::SetStackingClass(). The default stacking class
+    DWSC_MIDDLE. There are DWSC_LOWER and DWSC_UPPER, too. A window cannot
+    be outside of its stacking class, so DWSC_MIDDLE windows are always above
+    DWSC_LOWER windows and so on...
+
+commit 11b188756cf3763c4a3ea8664578357335361227
+Author: Andreas Kotes <count@directfb.org>
+Date:   Mon May 6 17:10:53 2002 +0000
+
+    set _BSD_SOURCE when using dietlibc - required for <linux/videodev.h>
+
+commit cec7dac163926ec54c9cc4b2339b35e5b011ef4b
+Author: Andreas Kotes <count@directfb.org>
+Date:   Mon May 6 16:36:08 2002 +0000
+
+    added missing include - required to compile with dietlibc
+
+commit dcd40a772072fc2594a659c4dcd23828046abbd3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 4 12:13:15 2002 +0000
+
+    dfb_gfxcard_drawstring() uses an extra state now instead of modifying the
+    original state. This gives more performance for hardware accelerated text.
+
+commit fb8b6ed36d26fb96bd989a6714c4f7edaecc6de2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 4 05:40:21 2002 +0000
+
+    Implemented FusionRef for single app core.
+    Fixed warnings from last checkin (when compiling with single app core).
+
+commit ce09bfd061ac17bf2aae6b767f631fdfd3e762b7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 4 04:46:36 2002 +0000
+
+    Workaround works better now, fullscreen apps are now usable with multi app core.
+
+commit 59eb109e958ac837b298a79235d434b034cf5e70
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 4 04:10:54 2002 +0000
+
+    Added "dont-catch" to usage string.
+
+commit 63d3e8eae2d749908376923dd50b01a90dba50ea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 4 04:06:16 2002 +0000
+
+    Added option "dont-catch" followed by a comma seperated list of signals
+    that won't be caught by DirectFB's signal handler.
+    
+    Removed all takeover/transfer stuff from arena.
+    
+    Added 'emergency' indicator to exit functions of arena.
+    
+    Added 'emergency' indicators to all deinit/leave functions.
+
+commit 6c3cc8dc6dbb6340abd8dbe95f6d246a973abdd6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 2 19:08:39 2002 +0000
+
+    Made all shmalloc functions internal _fusion_shmalloc functions.
+    Added new public functions locking the heap and calling the internal functions.
+    Cleaned up initialization.
+
+commit aefb2067862c7d0be509d09509ce68ffdcd4fa2f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 28 20:18:16 2002 +0000
+
+    Disable console acceleration when joining a session, the framebuffer
+    configuration of fusionees attaching from another tty is different.
+    
+    A small "dfbd" running as root but with a user's group now makes it
+    possible to run XDirectFB completely without root privileges.
+
+commit f87127297fa0cd22dec0c455f4100eb4cb84e7de
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 28 19:57:35 2002 +0000
+
+    Do chmod after creation because of umask.
+
+commit 1d8a540d86487524f9e5fefff78091b6a9ee5a01
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 28 19:31:41 2002 +0000
+
+    Create shared memory with permissions 0660 instead of 0600.
+
+commit f60bfa1cf0a6614198e86ba57cfc1171ba60f81e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 28 19:25:46 2002 +0000
+
+    Fixed thinko in recent addition.
+
+commit 5ee855da43e17e3bb69a1d8997eadbe3832cba3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 28 18:58:41 2002 +0000
+
+    New option "videoram-limit=<amount-in-kb>".
+    Moved PAGE_ALIGN macro to 'misc/mem.h'.
+
+commit f9e864fd21995fcb7a4362bd9a085cf3eb571ca0
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 27 21:31:37 2002 +0000
+
+    devfs support for libmpeg3 provider (try to open /dev/sound/dsp )
+
+commit d17caee3ec023e207da1fd7ebd62817e19009176
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat Apr 27 19:09:28 2002 +0000
+
+    Allow to disable libmpeg3 and flash providers at configure time.
+    Updated README.
+
+commit 0e9f8b46a42978ea63fe59c485d9404d5f09a8e3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 27 18:35:35 2002 +0000
+
+    added a table of all vesa modes
+
+commit 799c98f37125f45ffe25952131829f06695b462b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 27 18:22:26 2002 +0000
+
+    minor update
+
+commit c3c406ab3acb9244c51e83c12d7a188bb959056e
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 27 18:07:30 2002 +0000
+
+    bugfix: set correct audio format on big endian machines
+
+commit 81e423baa41a48f8d29ddebd188f497aa26bb6a2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 27 14:55:59 2002 +0000
+
+    removed libmpeg3 build hack, since the latest versions build a shared library.
+
+commit f0aae77e40aa1d0640da3499c21e06cf05903293
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 26 02:29:51 2002 +0000
+
+    Added 'dfb_layers_hook_primary()' that allows drivers to wrap/extend/replace
+    the implementation of the primary layer. The driver can provide an alternative
+    implementation for one or more functions of the primary layer and gets the
+    original content of the function table to use existing functionality.
+    The alternation grade ranges from "i-can-set-the-opacity" to "what-is-fbdev".
+    
+    It's now allowed to return zero in LayerDataSize(),
+    primaryLayerDataSize() does that now, it had pseudo data before.
+
+commit 21a0939b8e6956921014ef32ddb3b117232fab90
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 25 22:06:13 2002 +0000
+
+    Savage Framebuffer driver release.
+
+commit f1b161393be35153b428419c434d04863fe1e1cb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 22 16:57:32 2002 +0000
+
+    released
+
+commit d4dff8f06aecdc733e22fe66ebe198662ff32668
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 22 02:38:58 2002 +0000
+
+    Toggle sign of Z axis when converted to wheel event.
+    Multiply wheel value by 7 instead 4 when changing a window opacity.
+    
+    My wheel mouse seems to always send Z axis values between 1 and -1.
+    Is it normal? Do all wheel mice behave the same way? Is my mouse ill?
+    Why are 4 bit used (5 including sign) for this axis if it never moves
+    more than 1 or -1? This is my first day with a wheel mouse and I have
+    no clue. The mouse isn't running fast enough to have the wheel produce
+    electricity.
+
+commit bad03ce919bcc2c8518beb353abd4ff86d2dee43
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 23:09:07 2002 +0000
+
+    minor optical changes
+
+commit 1dae002829cb6f0d909f2b95ef0709079c6b3aa7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 22:49:15 2002 +0000
+
+    some more NULL pointer checks
+
+commit 7b767c7bbbc7ae6252017a6981c7a2d2040d59ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 21:31:36 2002 +0000
+
+    Finished documentational summary of IDirectFB.
+
+commit d87e54fba1addbb523315eedda359b069f85dfa4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 19:18:24 2002 +0000
+
+    Added information about the primary surface and the cooperative level.
+
+commit f25b7b02c84f555f4dcf9270bd424f73c3608c11
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 20 18:37:56 2002 +0000
+
+    align destination in color keyed blits, instead of source. this is much faster since the destination lies most likely in video ram.
+
+commit b9e1709e0b40876459c8e898d7c97f26d54df094
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 18:11:35 2002 +0000
+
+    Enhanced reference manual generation, wrote initial summary for IDirectFB.
+
+commit 93772fc4328ce274d5e7b4479fe96ab4ddb4d1e3
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 20 15:12:03 2002 +0000
+
+    tweaked recent code a bit, which further improves performance on intel with
+    mtrr, all other benchmarks showed no difference, thats why they are not listed.
+    
+    df_dok --stretch-blit --dfb:no-hardware
+    
+    old new code
+    PII-350     Matrox G400  MTRR on  : 61.46 MPixel/sec
+    
+    new new code
+    PII-350     Matrox G400  MTRR on  : 68.13 MPixel/sec
+
+commit 25a4aa160d95291d6ebb6721919fad019dbb3449
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Apr 20 14:30:49 2002 +0000
+
+    optimized 16Bit StretchBlit in generic driver, see below for results:
+    
+    df_dok --stretch-blit --dfb:no-hardware
+    
+    old code:
+    
+    PII-350     Matrox G400  MTRR on : 60.09 MPixel/sec
+    PII-350     Matrox G400  MTRR off:  9.93 MPixel/sec
+    PPC G4-500  ATI Rage 128	 : 13.20 MPixel/sec
+    
+    new code:
+    
+    PII-350     Matrox G400  MTRR on  : 61.46 MPixel/sec
+    PII-350     Matrox G400  MTRR off : 19.73 MPixel/sec
+    PPC G4-500  ATI Rage 128          : 26.33 MPixel/sec
+
+commit 72d9539448d50f6118ca7735575f022649b9255e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 07:45:33 2002 +0000
+
+    Set reaction list pointer to NULL when freeing an orphaned node.
+
+commit 1f18902bbc4ee2624e9443ebf89b479d6af65c40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 05:10:08 2002 +0000
+
+    Focus handling fixes and improvements in case a window appears/disappears.
+    More code cleanup and documentation.
+
+commit 0b45ebd3b9f36a18ecc16af52e432c5b2765ccdc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 20 03:49:11 2002 +0000
+
+    Window stack code cleanups.
+    Better stack locking.
+
+commit 4fe3c5c11e6e39d67f627dac98909dfef506e4fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 19 20:55:20 2002 +0000
+
+    Shared memory reinitialization has been done.
+
+commit ef6fb401355ec3af42cb80a6a02ed742e6af8940
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 19 17:38:44 2002 +0000
+
+    Free shared layer driver data in dfb_layers_shutdown().
+    
+    Changed fs type from "shm" to "tmpfs".
+    
+    Added temporary workaround for partly implemented FusionProperty
+    in multi application core.
+
+commit 174212f3dbd824a41acfebac25c8f5cf6d45db5d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Apr 19 12:10:03 2002 +0000
+
+    (dfb_layers_shutdown) return if no layersfield exists. Fixes the crash
+    that occured when dfb_core_deinit_emergency() is called during initialization
+    before dfb_layers_initialize() was called.
+
+commit f4dda84294528ba7cd9149ff8b09910357b9f88c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 18 23:49:46 2002 +0000
+
+    Fixed a very stupid code block moving error.
+
+commit ba258b12e17d34a6c3cd88a1f8ca191eceaed55c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 18 20:48:59 2002 +0000
+
+    Added more cleanup code, less IPC resource leakage after shutdown.
+    Commented code in some functions.
+    Added more assertions.
+
+commit 804359958fec099238fa074d1f373a8eb5327a23
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 18 17:39:48 2002 +0000
+
+    Added tmpfs mount point detection from Sebastian Klemke <packet@convergence.de>.
+    
+    The shared memory area is now reinitialized during startup if it already
+    existed, but with no DirectFB apps running.
+    
+    Removed some unused code.
+
+commit 1a2964dcdb6ef1407520e1c19220b000f567ec7c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Apr 17 11:03:14 2002 +0000
+
+    Changed internal functions dfb_copy_buffer_32() and dfb_scale_linear_32()
+    to take the destination pitch instead of the difference between width and
+    pitch.
+    
+    Added a destination rectangle to IDirectFBImageProvider::RenderTo().
+    
+    Added IDirectFBEventBuffer::HasEvent().
+
+commit 48499cf48932698cee4032998f76628e89dc2669
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 17 05:10:33 2002 +0000
+
+    Added missing incrementing of source pointer when doing alignment for
+    colorkeyed blits. Made the source pointer the preferred aligned one.
+
+commit 9c183cd594327f688b6ab8594198e75eedd2fc54
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 17 04:00:37 2002 +0000
+
+    Added details about surface manager and multi app core.
+
+commit 168c208e82b83f321a178eb0047447cf200613e2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 17 03:04:15 2002 +0000
+
+    Compilation fixes for multi application core.
+    
+    Unimplemented multi app FusionProperty is currently mapped
+    to FusionSkirmish, that is ok for non-fullscreen apps.
+
+commit bf576dd984538ced1a23f8891932292a7e1b1534
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 17 02:34:18 2002 +0000
+
+    Debug version compiles again.
+
+commit cae5a9fe7d56492b69aebfd3eb748d1927ddd8db
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Apr 16 10:06:09 2002 +0000
+
+    purely cosmetic change (indentation)
+
+commit 6862454bbe235168756aefaac5798af1d388f5d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 15 15:19:04 2002 +0000
+
+    Set width and height to zero if one of them is zero or less
+    in dfb_rectangle_intersect and dfb_rectangle_intersect_by_unsafe_region.
+    
+    Added some comments.
+
+commit e602b2eabb5c95886111a47095c1b84268c7b36d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 15 15:16:29 2002 +0000
+
+    Be more tolerant in GetSubSurface. Allow width or height to be less than
+    or equal to zero. The created sub surface will never do drawing/blitting.
+
+commit d51012be152e5259c0a48f559b09ee0e63de3e21
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Apr 15 15:14:31 2002 +0000
+
+    Let CapsLock key events through.
+
+commit 163f1ef0fb7f10284e35f60acefb717ba61e0bb9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Apr 15 10:12:45 2002 +0000
+
+    Added missing includes and changed include order.
+
+commit 9e76194b47fa3ee2cea1a63d75e82fa472a0fc51
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 22:37:25 2002 +0000
+
+    Do not flash LEDs when holding Lock keys. Toggle once the key gets down.
+
+commit 5bd7a1d5c842a58bc5004433e29d48300ac069c8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 21:22:56 2002 +0000
+
+    Forgot a bit in DWOP_ALL.
+
+commit ef6b0a2a51ed55bcbe99548786bf989d4631792f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 21:11:30 2002 +0000
+
+    Added new window options to disable moving,
+    resizing, stacking and destruction by wm hack.
+    
+    Added window option that turns the window into a passive
+    output only window (DWOP_GHOST). It will never get the focus
+    or any input events, clicks will go through. This is useful
+    for status OSDs or subtitling via transparent windows.
+    
+    Added IDirectFBWindow::GetOptions().
+
+commit ac1ec8789c0ea55def8b0058086a1578d1715a4a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 18:49:15 2002 +0000
+
+    Bye bye probe context and font module probing TODOs.
+
+commit c50ec36f8105fa6932e60a210f19cbc82347779d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 18:46:01 2002 +0000
+
+    Added probe context structs for all interfaces loaded from modules.
+    All parameters are stored in this struct giving more extendability.
+    
+    Added default probing function 'DFBProbeInterface' that can be used
+    for 'DFBGetInterface' as the 'probe' function.
+    It simply calls the implementation's Probe function with the given context.
+    
+    Reduced code size in IDirectFB, cleaned up and documented code.
+
+commit d62bcdf03adc430088ac6a083aac9693b23a7b43
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 10:16:16 2002 +0000
+
+    Added sanity checks.
+
+commit cefa79f5ab81b813face8b0aa982ca5d9c006123
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 10:11:20 2002 +0000
+
+    Added IDirectFBDisplayLayer::SetCursorAcceleration a la XChangePointerControl.
+    Removed acceleration from PS/2 driver, new acceleration is done in window stack
+    code. Reading from input devices directly will return unaccelerated movements.
+
+commit f7fde954ebb427f98238e144a4a23b10f6e273fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 09:04:47 2002 +0000
+
+    Added DIAI_LAST and DIBI_LAST.
+    Added more argument checking in IDirectFBInputDevice,
+    use new constants for array sizes.
+
+commit 3a9d6162325c744474b72313ffd74976b32b83e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 14 01:04:26 2002 +0000
+
+    Fixed debug enabled builds.
+
+commit 3edf00c03c1dd6b4de918d63d1109f243711bbb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 13 22:22:50 2002 +0000
+
+    Added DFB_DEALLOCATE_INTERFACE saving two lines of code in the
+    Destruct method of each interface.
+    
+    Cleaned up deallocation of interfaces after Construct failed.
+    Currently Construct methods have to call DFB_DEALLOCATE_INTERFACE
+    before returning an error.
+
+commit 8c70bf80dfac32f13ef6916c556e02f6d4d14c32
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 12 23:42:52 2002 +0000
+
+    Reworked display layer driver handling.
+    
+    Core structure DisplayLayer is no longer exported.
+    Added structures for driver functions and information.
+    Drivers call 'dfb_layers_register' during initialization.
+    
+    Generalized surface creation/reallocation of display layers.
+    Display layer drivers are cleaner now.
+    
+    Cleaned up layering code and added missing functions.
+    
+    Experimental mouse acceleration in PS/2 driver.
+    
+    Added options "mode=<width>x<height>" and "depth=<bpp>"
+    which select the startup mode and bit depth.
+    
+    Bit depths of fb.modes entries are ignored now when looking
+    for a requested mode. However, the default bit depth is the
+    one of the first entry.
+    
+    Added new fusion primitive 'FusionProperty' which is a lock
+    that automatically chooses between lock and try_lock behaviour.
+    Two different locking methods can be used for short locks, e.g.
+    window stack repaints, and long locks, e.g. exclusive layer access.
+    Both methods wait if the property is 'leased' and fail if the property
+    is 'purchased'. There's no implementation for the multi app core yet.
+
+commit 0f475e2974c55ea822dbeb8776a771e274d18ed4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 11 01:51:01 2002 +0000
+
+    Added missing unlocks in dfb_surface_reformat_surface().
+    
+    Return success in dfb_surface_reallocate_buffer() if video instance
+    reallocation failed but a system instance exists.
+    
+    Window resizing deadlocks seem to have gone.
+
+commit a1b4a53c699ad3950def100ff52c22f8b19d2b97
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 5 14:35:16 2002 +0000
+
+    Small fix for multi app core compiling.
+
+commit e0e69bf55dc09c73980678179b8babbf6aee5012
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 26 09:38:23 2002 +0000
+
+    Tweaked surface buffer locking again, fixes the slow software stretch blit
+    after hardware blitting the same surface. So it wasn't the missing '-O3'.
+
+commit d6d72af7cccf193a5c7578e7f9ac08f8dc41c47e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 26 04:16:31 2002 +0000
+
+    Added a 40ms sleep after switching VTs. It seems to fix mouse problems
+    when starting applications from XFree. I know it's a hack, but it should
+    go away after VT handling rewrite.
+
+commit 99fae4937ac6311951f21cdf9cd27e0cda56bdc5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 26 04:03:11 2002 +0000
+
+    Enable -O3 for debug mode, too. Stretched blits are REALLY slow without it (1-2 MPixel).
+
+commit d26ef5e654fa37f879ba9e86a3722130c8709334
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 26 03:28:18 2002 +0000
+
+    Moved a bit code from keyboard driver to vt handling where it belongs.
+
+commit 9574856de3336520e8f3faaea5209b9f99aa6720
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Mar 25 19:56:34 2002 +0000
+
+    Added support for vertical kerning.
+    Release the FreeType2 library when the last font provider is released.
+
+commit e4a333e81f9570ddc6996911517623175a040708
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 24 20:11:08 2002 +0000
+
+    Fixed software driver pixelformat tables (NULL padding).
+    
+    Commented out old code in dfb_vt_shutdown.
+
+commit 16a7aabe83d9ed0f42d1a9d65ec4941c16fd981c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 24 13:46:50 2002 +0000
+
+    Do TIOCNOTTY on /dev/tty0 instead of file descriptor 0.
+    This way XDirectFB works when started from linux console,
+    but I don't know why only XDirectFB failed. Don't know either
+    what TIOCNOTTY is, neither TIOCSCTTY. Time for a VT/TTY handling
+    rewrite in DirectFB.
+    
+    However, I added perror messages in case TIOCNOTTY or TIOCSCTTY fails.
+    
+    Strange result (df_window and XDirectFB show same behaviour now):
+    
+    from xterm:                       both ioctls fail
+    from linux console:               second ioctl fails
+    from linux console (with strace): first ioctl fails
+    
+    
+    Removed tcflush calls from PS/2 driver (inappropriate ioctl).
+
+commit 0a31512139db792d35e6765828cd6957d3eaccb8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 23 04:18:19 2002 +0000
+
+    Fixed a bug that may have caused broken pulldown menus in GTK!
+    
+    handle_enter_leave_focus() did not check if the pointer is grabbed.
+
+commit c58a746bbf93d8b123397f913cc0e4d1d65f185f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Mar 22 19:21:24 2002 +0000
+
+    Removed -disable-static from LIBADDs.
+
+commit dade4c121038d74eeee6e4d16fad611f9fbbf7ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 22 19:21:08 2002 +0000
+
+    Added Martin Mueller to "Thanks To" section.
+
+commit a534c95527a981a327069c20c7e30ee3455d9f84
+Author: mm <mm>
+Date:   Fri Mar 22 18:30:17 2002 +0000
+
+    Added brightness control to neomagic video overlay
+
+commit d8aee35c23aa4e3aa9dfd0c2a19c58cc8d723141
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 21 22:03:19 2002 +0000
+
+    added two lines
+
+commit e400747012c5327f45ea15ce65739fc429c61e3c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 21 21:59:58 2002 +0000
+
+    Fixed crashes that sometimes occur during window resizing when another
+    thread is repainting the window stack.
+    
+    Print caution message after failing video instance reallocation only
+    if there is no system instance. If there is a system instance mark it
+    as valid.
+    
+    Removed redundant macro in 'layers.c'.
+    
+    Added same debug checks to gAcquire() as in dfb_gfxcard_state_acquire().
+    
+    Added dfb_get_millis() which returns the current time in milli seconds
+    after DirectFB startup (after first call of the function actually).
+    
+    Added PID and milli seconds after DirectFB startup to debug messages.
+
+commit 69923f4fd7ab06624e25cc1305c08a200cca0ff4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 18 21:05:08 2002 +0000
+
+    Added dfb_sig_block_all() which blocks all signals and should be called
+    at the beginning of each input thread. Otherwise signals may
+    arrive at the input thread which in turn (in signal handler) cancels
+    all input threads (including itself) during emergency shutdown.
+
+commit 62774c5dc22e87c00f57c2262f21f9f468b63c19
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 06:25:52 2002 +0000
+
+    Added scrolling or panning for virtual window/layer sizes.
+
+commit 288a47c187973b802b2c283089aac20c0ac65ba0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 06:03:18 2002 +0000
+
+    Treat windows with color keying enabled as transparent, so the background
+    gets cleared.
+
+commit 68d0e053d1e62fd5ff48c37f5acdff89120c69ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 05:32:10 2002 +0000
+
+    Reading from a surface with auto video policy which is stored in video
+    memory no longer pulls it into system memory.
+    
+    Changed surface reallocation behaviour. Surfaces already in video memory
+    stay there after reallocation.
+
+commit 1fd7149444c915d94088359e9dbdfc5d0d24c693
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 01:41:05 2002 +0000
+
+    Removed color keyed window entry.
+
+commit 9add3be4545bcacca791e9f0c0a4d6d2fce1c54e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 01:40:31 2002 +0000
+
+    Added color keying for windows (e.g. for shaped windows).
+    
+    Added DFBWindowOptions having DWOP_COLORKEYING for now.
+    Added IDirectFBWindow::SetOptions and SetColorKey(r,g,b).
+
+commit 52c10bf0bdf2d586bc180a4e99591850ea9ab8e9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 01:34:05 2002 +0000
+
+    Removed debug printf I forgot.
+
+commit 8f3b8e6684d3f1818dee99aecc43d9e276c1868d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 17 01:23:27 2002 +0000
+
+    Fixed colorkeying with simultaneous blending for ARGB surfaces
+    in software and Matrox (G200+) driver.
+
+commit 6fc577b390825d9485647663764901968c7647a8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Mar 16 22:57:36 2002 +0000
+
+    - removed the paragraph from README mentioning the aty128fb and nvidia patches.
+    - removed neofb patch from Makefile.am
+
+commit c5e0f68173314f88025aa77e710d62bfe7ab8d59
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 15 17:20:15 2002 +0000
+
+    Deinitialize layers in emergency shutdown (e.g. segfault).
+
+commit 8081642950608b191a62abdac98e962212535fa1
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Mar 14 01:57:53 2002 +0000
+
+    - use lookup tables to convert rgb332 2/3bit color channels to precalculated 8bit values. now blending in rgb332 looks much better without affecting performance.
+
+commit 1bdd7d76169f8b9b717aaaf3c6f9490a0af78f33
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 11 23:54:08 2002 +0000
+
+    Finally neofb got itself into 2.4.19-pre3 ;)
+
+commit 47883aef17661928d0262d6d6d976e586d4c5726
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 11 00:28:31 2002 +0000
+
+    Sorry, the next time I will compile before committing.
+
+commit fb2a87d28215f4686b3d76fad8e792ebadabb089
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 11 00:12:20 2002 +0000
+
+    Removed to old lines that caused doubled and interlaced modes not work.
+
+commit 04294d2509468c82efdad20d6ce27155fda79bd8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 10 06:02:13 2002 +0000
+
+    Minor cleanup, converted defines to enums (CoreSurfaceHealth/Policy).
+
+commit 90a1d2c30f7d918bcf0c5b6af6f38779afd15938
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 9 01:51:53 2002 +0000
+
+    Removed one ;)
+
+commit 0186511929177764a81fe801fc729891a27741c8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 9 01:49:58 2002 +0000
+
+    Shift 8bit values to the right in RGB15 and RGB16.
+
+commit b1a998298a8bdd52271d9d65b030572b922ebf12
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 9 01:38:50 2002 +0000
+
+    Implemented destination color keying.
+
+commit a59b4e4c2a758add47f1ff0d0548c0315544761d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 9 01:38:02 2002 +0000
+
+    Changed internal parameters.
+
+commit afb409bf8987ea6e65e4fcece2b53c197845b342
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Mar 9 00:00:44 2002 +0000
+
+    Added destination colorkeying for display layers.
+    Not implemented by any driver yet.
+    
+    IDirectFBDisplayLayer::SetColorKey() is now called
+    IDirectFBDisplayLayer::SetSrcColorKey().
+    
+    Added IDirectFBDisplayLayer::SetDstColorKey().
+    
+    DLOP_COLORKEYING is DLOP_SRC_COLORKEY now.
+    DLCAPS_COLORKEYING is DLCAPS_SRC_COLORKEY now.
+    
+    Added DLOP_DST_COLORKEY and DLCAPS_DST_COLORKEY.
+
+commit 7b85900d1bc91c8115096d7107afc661ab5700b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 8 03:45:13 2002 +0000
+
+    Added some more useful things needed before feature freeze.
+    Updated ChangeLog (no, it's not a release yet ;)
+
+commit 4099c9508b19e098f5bbcea7577d7775ef9e7f09
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 8 02:59:41 2002 +0000
+
+    More important TODOs added for 1.0.
+
+commit dbc51a67ccaae66da4419a0a57dabf8f95af20d1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Mar 8 01:41:00 2002 +0000
+
+    Added window resizing wm hack, press 'CapsLock + Strg' to resize with the mouse.
+    Fixed a deadlock in dfb_surface_reformat.
+    Changed window stack update strategy when resizing,
+    great thanks to Hallvar Helleseth <hallvar@ii.uib.no>.
+
+commit 5e66812843765d9467935ace481d890b8774d297
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 7 23:18:08 2002 +0000
+
+    Disable static libraries by default again, builds twice as fast.
+    Added AM_CONDITIONAL for static library stuff in src/Makefile.am.
+
+commit 8c015d5b480ac81f0c5d3cf186b7c77e59f9f5f7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Mar 7 23:01:21 2002 +0000
+
+    Acquire locks for front and back buffer in dfb_surface_destroy before sending
+    the destroy message and destroying it.
+    
+    Removed now obsoleted Unlock from IDirectFBSurface's surface listener.
+    
+    Made dfb_surface_reallocate_buffer use free/malloc again,
+    realloc is too slow and the data will be foo anyway.
+    
+    Added 'CapsLock + D' which destroys the window under the cursor,
+    this is the force version of 'CapsLock + C' (close).
+
+commit 238d307d8f5f59dd281346a429d89d5030135ba2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 5 20:21:12 2002 +0000
+
+    Fixed CheckState, it was broken for unsupported drawing/blitting functions.
+    Reenabled workaround for blitting.
+
+commit ea1b3af46739b2a4779591c95dec70b66164307f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Mar 5 19:50:52 2002 +0000
+
+    Only check for libdl if shared libraries are enabled.
+    Show shared/static in summary.
+    Include "$LIBZ -lm" in libpng check.
+
+commit 813eb86e1c8102b5df8d3462e07f9cf843bcac9a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 4 20:03:35 2002 +0000
+
+    Check for empty region before calling update_region.
+    Empty region check at beginning of recursive update_region is a DFB_ASSERT now.
+
+commit ab8bee4afc46df015c7630119c6265cf41fb73bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Mar 4 19:37:56 2002 +0000
+
+    Added union parsing (treated like structs).
+
+commit de5f5b443311a84c66dba6d12c6373c89d1ab502
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Mar 3 05:51:31 2002 +0000
+
+    Wrote SonyPI Jogdial driver. Sony users with a Jogdial can now use their
+    jogdial as a wheel (Z axis) and middle mouse button.
+
+commit f3d93fe8b7b87eccc1b3222c108dbb625792352b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Feb 25 21:08:02 2002 +0000
+
+    removed aty128fb patch (it is included in 2.4.18)
+
+commit 0aba6c295d2faf2474516edef7d7dc8893050893
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Feb 25 14:53:09 2002 +0000
+
+    fixes for autoconf-2.5
+
+commit 5f4705cc3f8a694818d79e2162612e9c00981663
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 25 04:21:28 2002 +0000
+
+    Don't catch SIGPIPE.
+
+commit 6acb7723863d829a686dba39d0472127217e4849
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Feb 24 20:24:54 2002 +0000
+
+    Added IDirectFBWindow::PutAtop and IDirectFBWindow::PutBelow
+    that can be used to restack a window relative to another one.
+    
+    Added DFB_ASSERT which prints an error message and causes a
+    SIGTRAP if debug is enabled during configure.
+    
+    Cleaned up window restacking code in core. Reduced code size.
+    
+    Version is 0.9.10 now.
+
+commit 4e631d9ad716af9ee7e9b8d1cd86876110af4d6b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Feb 20 14:41:15 2002 +0000
+
+    only build neomagic driver on i386 platforms. (let me know if there is a neomagic chip in a non-i386 system somewhere on this planet)
+
+commit 74560c1e302af2834c7e9b1db782ad3ee14c6d80
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 20 14:39:45 2002 +0000
+
+    Updated for 0.9.9.
+
+commit a82b9e767a524b540c5d5cd0c4b44bcd547d8682
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Feb 19 20:03:20 2002 +0000
+
+    some updates, could need more
+
+commit 8ed8ab12720ba2386d933874ca551a04ada8d108
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 19 18:05:32 2002 +0000
+
+    And here the complete log entry:
+    
+    Applied patch from Enno Brehm <enno@convergence.de> that adds dlopen'ing
+    of the main library with RTLD_GLOBAL.
+
+commit 9d281a92ba7996a62ba63a9d2ffc738aa28d92e1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 19 18:03:33 2002 +0000
+
+    main library with RTLD_GLOBAL.
+
+commit c344d81d0984a7ff184647a49f5e9b1905ef7805
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Feb 19 18:02:36 2002 +0000
+
+    *** empty log message ***
+
+commit 77195a08ba0bb862cc8f9e59f42873b7f0486ef0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 18 22:03:56 2002 +0000
+
+    Reset display layer ID pool so the primary layer gets '0' even after
+    reinitialization of DirectFB.
+
+commit 72f1700276272f12d68b16c0eda9a16cc10b3b51
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 18 21:24:51 2002 +0000
+
+    Forgot to add the new event class to two switches.
+
+commit 7cf85726e390e90cc99bd54cfcde218722e76987
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 18 21:10:00 2002 +0000
+
+    Forgot to assign function pointer.
+
+commit d8c8ce289ce8d9d89227eb24cf1fe2b551611043
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 18 21:00:50 2002 +0000
+
+    Added new event class DFEC_USER and a struct DFBUserEvent containing an
+    unsigned integer and a pointer.
+    Added IDirectFBEventBuffer::PostEvent which can be used for any event class.
+
+commit ff6888be29a9f1306132d30e09ba2d8bd718fa2a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 18 14:15:20 2002 +0000
+
+    Allow IDirectFB::CreateEventBuffer with DICAPS_NONE.
+
+commit f6dae7cfc0bee23c4e819d44c68c99bf60fa65d0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Feb 15 13:35:24 2002 +0000
+
+    Even more keycodes for yet another remote control.
+
+commit 859c8b1f00a9ccb5dd605abdda844c2811b5bab9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 15 12:23:49 2002 +0000
+
+    Added NeoMagic YUV Overlay support ;)
+    
+    Added simple YUY2 -> YUY2 blitting for NeoMagic.
+
+commit 994fc80e1f041fff6cd48f5ea8370086896b7335
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 14 16:38:25 2002 +0000
+
+    More code beautification, more code documentation.
+    Simplified some parts.
+    Fixed setting primary layer's configuration that I broke last night.
+
+commit 16a2cc9ec8e2d04652a2bf40924f1e6976264fda
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 14 03:32:49 2002 +0000
+
+    Shrink SetConfiguration to 3 lines here, too.
+
+commit d9cfb0964c36175df2fc8b8d549817d83b297c90
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 14 03:27:16 2002 +0000
+
+    Added dfb_layer_set_configuration to simplify the driver's SetConfiguration.
+    Beautified code a bit. Removed all shfree/shmalloc hacks (use shrealloc now).
+
+commit d3697ac25d28f660059d96a1218f3e4fc5dffcf2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Feb 14 00:07:56 2002 +0000
+
+    Grey pad keys get through now even if NumLock is off (div, mul, etc.)
+
+commit 2a20c3ba5357725d61d8c88ab208458900f3592d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 13 16:42:46 2002 +0000
+
+    Made 'no-sighandler' and 'no-deinit-check' overrideable
+    via 'sighandler' and 'deinit-check'.
+
+commit 95d830a62bcdd9e9e5e5f678240879fcc8dca1e7
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Feb 8 17:06:39 2002 +0000
+
+    Removed special keycodes for the IPAQ and added some generic new ones.
+    Remapped IPAQ keys.
+
+commit d20df7e0c76e233a2572e59390620365231a78a4
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Feb 6 11:18:30 2002 +0000
+
+    (IDirectFBSurface_TileBlit): fixed tiled blitting for subsurfaces.
+
+commit bd19c56d83147f800999f427888539d6733d7c1b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Feb 6 06:20:53 2002 +0000
+
+    Call graphics driver deinit in signal handler again.
+    So overlays shouldn't stay visible after segfaulting now.
+
+commit aaa7273542a2f7969353ed9defc229e0a8b30098
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 4 13:54:21 2002 +0000
+
+    Wait for idle accelerator if software wants to write into a surface that
+    has been read by hardware (read access by hardware may not be completed).
+
+commit f420a5d20d1e85c139a89cdff35f2de913c30257
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Feb 4 11:51:31 2002 +0000
+
+    Removed directfb-avifile.pc and directfb-swf.pc from EXTRA_DIST.
+
+commit c38be4a889f7b7c2ac16e2bbf3c68b64323644b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Feb 4 11:45:24 2002 +0000
+
+    Applied patch from Till Adam <till@adam-lilienthal.de>.
+    - Adds DFBInputDeviceLockState (DILS_SCROLL, DILS_NUM, DILS_CAPS)
+    - Adds IDirectFBInputDevice::GetLockState()
+    - Adds locks to input and window events
+    - Keyboard driver handles locks and LEDs
+
+commit ebcbe8bee66d872b3e13c2ee535a4c50426ea1eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Feb 2 00:57:28 2002 +0000
+
+    Check pixelformat in CreateSurface.
+
+commit 5b0bc27342e51e4f447c8d6e663e818906238961
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Feb 1 03:00:00 2002 +0000
+
+    Fixed segfaults in reinitialization.
+
+commit c8ba6ba67d32902ae32022ff616f877a8ae108ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 31 15:43:56 2002 +0000
+
+    Removed shmalloc debug printf.
+
+commit e71d89c1712d75d009bed54a9893825fbdab729c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 31 15:38:58 2002 +0000
+
+    "ref_*" -> "fusion_ref_*" and code beautifications.
+
+commit f31fce3221e4c2562a9824972c304f9d311137ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 29 17:08:06 2002 +0000
+
+    Should have fixed DirectFBCreate after last IDirectFB::Release.
+
+commit d2168e782a2735b4f983450f59921c36870e0fee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 29 16:58:53 2002 +0000
+
+    Only include shmalloc sub library when building the multi app version.
+    Thanks to Till.
+
+commit 0c0299c88efad433a34a50ed3eb5024df33b8365
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 29 15:41:19 2002 +0000
+
+    Completely rewritten shmalloc stuff based on libc5's GNU malloc.
+    It now uses tmpfs (former shmfs) that needs to be mounted at /dev/shm:
+    
+    mount shm /dev/shm -tshm
+    
+    
+    It uses open/mmap and ftruncate/mremap similar to brk ;)
+
+commit e3f65da9a85fc83b26326dabbfd875fbc96b4e6d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 28 14:49:23 2002 +0000
+
+    Builds with newest version libmpeg3 (1.5).
+
+commit d1c250b20a520584c702f3e4c045577cb88d0f1f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Jan 27 20:20:58 2002 +0000
+
+    changed some comments to be (hopefully) more helpful
+
+commit 86b8ed3b2619e7f0c5ece68ef945c4fbf029308a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 27 16:31:40 2002 +0000
+
+    IPAQ button support by Ara Hacopian <ahacop@anthrotronix.com>.
+
+commit b3ce1854b1d69d599f2563200d3bd94bb71c34ac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 25 00:38:59 2002 +0000
+
+    neofb 0.3.1 is now in 2.5.3-pre4 ;)
+
+commit afb5651e6136047bc5d1187c8c010064b3f2c0f1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 24 23:03:35 2002 +0000
+
+    two variables removed
+
+commit fa92dcbd3113f5459c9f7de31183ff0567416c5b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 24 21:15:03 2002 +0000
+
+    directfb-avifile linking hack is no longer needed due to recent changes
+    in module loading.
+
+commit d03c0c2036aba94b2a6d0cd0190121c2e0a9f370
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jan 24 19:20:56 2002 +0000
+
+    use waitidle again on ppc
+
+commit bbbed9482ec086f8c6364a806c9cd297384cae2d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 23 16:09:11 2002 +0000
+
+    New version, nothing important, just added module license (GPL of course).
+
+commit 8a4df58565253899be4fafe3e8a42d9bf4ae5c7d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jan 23 15:49:16 2002 +0000
+
+    oops, forgot to remove a debugging printf
+
+commit 5d18107c984d9ce0195b826ad1f719620ae0bb08
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jan 23 15:08:38 2002 +0000
+
+    Changed DirectFB command-line parsing:
+    The only recognized options are --dfb-help and --dfb: follow by a
+    comma-separated list of DirectFB options. The format of the options
+    is the same as used in the directfbrc file.
+
+commit 676c3031ae325eb07eb57bbcfb0f272aa570ddac
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 22 15:42:09 2002 +0000
+
+    Set $PREFIX only if it's unset.
+    Take care of preset $CFLAGS.
+    Use $PREFIX consequently.
+
+commit 26f7835acdc8de0395041ef5b97bbdad130a4b82
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 22 14:48:19 2002 +0000
+
+    Applied patch from Daniel Mack <daniel@convergence.de>.
+    The environment variable "FRAMEBUFFER" is used now if set.
+
+commit 0fad3330f0fb3778e8fccf909fbfdc05395438e5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 22 14:44:42 2002 +0000
+
+    Applied patch from Topi Kanerva <topi.kanerva@eke.fi>.
+    Under certain circumstances rectangles didn't get filled or drawn.
+
+commit b5cc5f5529ad1d0e61f8ffcb4e07251b3918786b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 22 09:22:57 2002 +0000
+
+    Build libmpeg3 provider using gcc, ld did not include our constructor.
+
+commit 8085daf92b9bb080b292c99683ff5666486e414b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 21 16:59:15 2002 +0000
+
+    Try to access files before creating a video or font provider for them.
+
+commit 5bf2651c13f1153908af552f6c8658e95180b401
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 21 15:25:25 2002 +0000
+
+    No need for stdio.
+
+commit c7f8af380f1f71e9093735e4cc9c0ed2b649f7ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 21 14:36:51 2002 +0000
+
+    Replaced all "sprintf" calls with "snprintf" calls.
+
+commit d04c25e331cfb739dbdfb2d44168acb82e458a8c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 21 12:11:02 2002 +0000
+
+    Don't parse --help out of the command-line arguments in order to allow
+    applications to provide more useful help here.
+    
+    Added new function DirectFBUsageString() which returns a string
+    describing the DirectFB command-line options.
+    
+    Output DirectFB usage information and quit if --dfb-help command-line
+    option is given.
+
+commit 25c48c57661939df874fe9be445803e755a48099
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 21 10:25:06 2002 +0000
+
+    Added "static class Foo { public: Foo() {} } foo;" to have our C constructors
+    included in the library.
+
+commit b88c31d769fecc96453d7af47138d9b69c21810b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 20 22:08:36 2002 +0000
+
+    fixed segfault
+
+commit 63bff4ecb4e0311e6e9760746d896606ad520084
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 18 13:08:09 2002 +0000
+
+    Fixed initial DWET_POSITION_SIZE event.
+
+commit db8305f0dbac1d3742bba83456a00545ee5a2f35
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 17 14:46:02 2002 +0000
+
+    Added static linking support. Minor changes to driver and interface modules.
+    
+    An example of how to link static applications with choosable drivers and
+    interfaces is the script 'dfb_static_build_example'.
+
+commit 4645addcf14f928958868fb9d99eb9cf8a0af21e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 16 15:11:48 2002 +0000
+
+    updated EXTRA_DIST
+
+commit a13b94a52a9094a14afdebfcd2e980584333517a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 16 14:45:54 2002 +0000
+
+    two more includes
+
+commit 312218cac8124dca58911ed5ddbe18e52abd63b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 16 14:42:43 2002 +0000
+
+    Fixed stoned '.c' includes.
+
+commit 5c2b06603590c8e422147e4e039235729cb033c2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jan 15 21:33:48 2002 +0000
+
+    Added new background mode DLBM_TILE that works similar to DLBM_IMAGE
+    but tiles the background image instead of stretching it.
+    Added new --bg-tile command line option.
+
+commit c167d42d6413f9ebe217a205642827ea841ee16c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 15 18:08:35 2002 +0000
+
+    Use CFLAGS again.
+
+commit 38cbc362c020d521dc4d5876cf1632585350c30f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 15 18:01:25 2002 +0000
+
+    Makefile.am cleanup
+
+commit 7445357899adae42314f46403224fd2855fafa56
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 14 14:09:28 2002 +0000
+
+    Added IDirectFBSurface::TileBlit. Takes the same parameters like Blit
+    but tiles the source to the whole destination surface. Set a clipping
+    region if you want to tile only parts of the destination surface.
+
+commit 3c03ecbe552222e4562eb45519e42a0cb3bf3183
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 11:01:28 2002 +0000
+
+    once again, id is a reserved keyword in objective c
+
+commit fc12bf5a427fbd6dc69efd88ff24ae76c543c95b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 09:49:35 2002 +0000
+
+    include reactor.h
+
+commit 39268e6d9758cf1a5cbbd45ba1e2bf0c5e00a646
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 09:42:32 2002 +0000
+
+    Use another assembler source file for testing.
+
+commit 006dd38e8df6bd9a13187f1a142e7a40543ae436
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 05:53:00 2002 +0000
+
+    Do a normal shutdown in atexit handler, not just an emergency shutdown.
+
+commit 7ef4b0ba3584adc4c85a61cd9316a8127af0aa88
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 05:10:17 2002 +0000
+
+    Put device id into event structure in dfb_input_dispatch.
+
+commit f2239107da6c9e5b73dab270b18990140ad4f693
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 04:57:50 2002 +0000
+
+    not needed anymore
+
+commit d4a75319394a248f2a2b9ce53266127c7e94bdf2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 14 04:57:00 2002 +0000
+
+    Cleanup of interface functions, many functions have been made static.
+    
+    Removed intel_cpu_features by using the new dfb_mm_accel function.
+    
+    Added DFBDisplayLayerID, DFBWindowID and DFBInputDeviceID.
+    
+    Added GetID functions to IDirectFBDisplayLayer,
+    IDirectFBWindow and IDirectFBInputDevice.
+    
+    IDirectFBInputBuffer is an IDirectFBEventBuffer now.
+    It handles events from input devices and windows.
+    
+    Removed WaitForEvent, GetEvent and PeekEvent from IDirectFBWindow.
+    Added CreateEventBuffer and AttachEventBuffer to IDirectFBWindow.
+    
+    DFBInputEvent and DFBWindowEvent contain the ID of the event source.
+    
+    Added DFBEventClass to determine the specific event, i.e. input/window.
+    
+    Added DFBEvent that is a union of DFBEventClass, DFBInputEvent and
+    DFBWindowEvent. Each event structure has a DFBEventClass first.
+    
+    IDirectFBEventBuffer::GetEvent can be called with a DFBEvent pointer.
+    If a buffer is only used for one specific event class, the macro
+    DFB_EVENT(e) can be used to pass DFBInputEvent or DFBWindowEvent directly.
+
+commit 5d49fba86be7d4ec14d6bd3e9cc4b14164f3f615
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Jan 13 12:36:22 2002 +0000
+
+    Removed useless stuff from directfb-avifile.pc.
+
+commit e40b6f5fa0ca003045ea43a4a810954b70752094
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jan 12 01:48:29 2002 +0000
+
+    Added cpu detection code for MMX, 3DNOW, MMXEXT, SSE, SSE2 and ALTIVEC.
+    
+    Added fast memcpy routine 'dfb_memcpy' that uses MMX, MMXEXT or SSE.
+    
+    DICAPS_AXIS is now called DICAPS_AXES to have a plural
+    as in DICAPS_BUTTONS or DICAPS_KEYS.
+    
+    Removed bogus flag DFXL_DRAWSTRING.
+    
+    Enabled dithering for Matrox cards, looks nice.
+
+commit 5368bc9c43d9ada2ebf57711742d1c473650e130
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Jan 11 21:31:43 2002 +0000
+
+    added note that the patch is obsolete since it was merged in 2.4.18-pre3
+
+commit 634b28be3fc75ff5fe4a2c0aed6e0d4a03bf7bb7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 10 23:29:27 2002 +0000
+
+    As Hallvar pointed out, "G550" needed to be added to the device names, too.
+
+commit 137d0e7d8c04851f026102ccc9a867619e324b40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 10 21:27:17 2002 +0000
+
+    It's now possible to specify the pixelformat for a window on creation.
+    For windows with an alphachannel only DSPF_ARGB is currently allowed.
+    For opaque windows even DSPF_ARGB is allowed, but it won't get blended
+    to the background. Instead the data will just be copied or converted
+    so it can act like a root window on transparent layers.
+    
+    Optimized graphics card state changes during window stack updates.
+    
+    Added a comment to dbox2 remote driver.
+    
+    Added "G550" to matrox driver name.
+
+commit 0a4d533c844c1790bc8c648a93197aea0ef4210d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 10 15:36:57 2002 +0000
+
+    All global DirectFB symbols have the prefix "dfb_" now.
+
+commit c1a657e110d80f5e0200cabf58faf1a7eac3382d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 9 14:56:56 2002 +0000
+
+    Use "-fomit-frame-pointer" only for src/gfx/generic.
+
+commit aa4013553461f358884f029be0d305eb68a3600e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jan 8 15:52:44 2002 +0000
+
+    some code cleanup, no changes
+
+commit 1625338c3f98f903d58668dd24a43ea941b72d63
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jan 8 13:22:44 2002 +0000
+
+    us a saturating blend when compositing A8 surfaces with colorizing on
+    ARGB surfaces
+
+commit 2dcb3a47e0853d4608ce649305c6ce34442e53bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 7 17:31:19 2002 +0000
+
+    Removed a totally dumb "static int" that got increased each OpenDevice
+    and made the driver crash when OpenDevice gets called again after CloseDevice.
+    
+    Readded Suspend/Resume implementation.
+
+commit 1f7e447b5685179eb6ad2769db40db95be6940b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 7 14:23:18 2002 +0000
+
+    Pass the filename to the Probe function of image providers.
+
+commit 79fda2f2f61b9ad85ef9c6ae67738e9c5230486f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jan 7 14:07:26 2002 +0000
+
+    	* src/gfx/generic/generic.c (SET_ALPHA_PIXEL_ARGB): keep destination
+    	alpha when blending A8 with color modulation onto ARGB surfaces.
+
+commit c36da321ca2becf95a8c232435792cb0a70f884e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jan 7 12:11:08 2002 +0000
+
+    Added Hallvar Helleseth <hallvar@ii.uib.no> to Thanks To section.
+
+commit b7c8c648bfed5d6177425733171696e31dd12abd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 6 04:50:04 2002 +0000
+
+    Added YV12 and I420 support.
+
+commit 5433718aa2090c17f6cf2d21ceb18c4d464db5bd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jan 6 01:16:42 2002 +0000
+
+    Added ATI Overlay support. Only YUY2 and UYVY yet.
+    
+    Fixed mmio in/out functions. We casted the base address to a non volatile
+    pointer. That resulted in register polling loops that never returned.
+    
+    Maybe this fixes ATI idle waiting on PowerPC.
+
+commit 7287bce94e2ca9fe59082b25c9c89ac1df4e7dd5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jan 4 23:33:08 2002 +0000
+
+    Rewritten Libmpeg3 provider based on OpenQuicktime provider.
+    Supports all RGB and YUV formats and does audio playback.
+
+commit 3277e9417003432689ebb6e8b099078cc74d7a51
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 3 20:55:47 2002 +0000
+
+    fixed minor bug introduced yesterday that made RGB15 unavailable
+
+commit a7c690c26829b09f1cab1ee1d477b87cf4a7b5c0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 3 18:58:31 2002 +0000
+
+    Removed CON2FBMAP todo. Added some others.
+
+commit 0331308cb94b8191409dfdae960a1c6cb3fb49ec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jan 3 18:45:36 2002 +0000
+
+    added raw15toraw24
+
+commit b29be5e7af24a06db0a560828b0e64841cc8e81c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 2 01:52:01 2002 +0000
+
+    Fixed a width/pitch bug.
+
+commit 297d50b2542e58977710c2f642333775d20b6308
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 2 01:26:38 2002 +0000
+
+    Apply the plane multiplier to end result instead of height.
+
+commit 5d30a0e1f408ab26d2ceadb3199c08744b8d138c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jan 2 00:38:34 2002 +0000
+
+    Added "DFB_BYTES_PER_LINE(f,w)" which should be used instead of
+    "DFB_BYTES_PER_PIXEL(f)*w", it adds support for formats with bytes
+    per pixel not being a decimal, e.g. packed monochrome.
+    
+    Added support for planar pixel formats by adding more information
+    to the pixel format constants with two new macros:
+    "DFB_PLANAR_PIXELFORMAT(fmt)" and "DFB_PLANE_MULTIPLY(fmt,height)".
+    More details in the header and in the generated documentation.
+    
+    Added DSPF_I420 and DSPF_YV12, two planar YUV formats.
+    
+    I420: 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.
+    YV12: 8 bit Y plane followed by 8 bit 2x2 subsampled V and U planes.
+    
+    
+    Added I420 and YV12 support for Matrox BES.
+    
+    Enum entries in the generated documentation have the original order now.
+    
+    Increased version number, 0.9.8 and 0.9.9 are binary incompatible.
+
+commit 4abcac544a688c6d00b8fdb5eaf958927bd42a86
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 1 17:41:35 2002 +0000
+
+    Only use the full color keying mask when in 8/16 bit mode.
+
+commit 6d36abd16a30e0f42bf68652047af600c545537f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 1 13:20:12 2002 +0000
+
+    New framebuffer based debugging method.
+    When compiled with debug enabled and started with "--fbdebug=<device>" graphical
+    debugging output is done on this additional device. Currently only the surface
+    manager uses this feature to show the video memory allocations for surfaces
+    in a "defrag" like style.
+
+commit bc529165f6b24afe8a1d4439721e4e23581d7018
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jan 1 13:08:47 2002 +0000
+
+    Updated README
+
+commit 596362762803aa98d950d27e65de8e2b3c8de309
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Dec 31 11:19:28 2001 +0000
+
+    forgot to add the file.
+
+commit 671bb1c1dfca62c7db0d53d868f094c6765440b8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 30 21:55:37 2001 +0000
+
+    - do not rely on gcc to define __BIG_ENDIAN__ or __LITTLE_ENDIAN__
+      include <endian.h> and check __BYTE_ORDER. This resolves problem on
+      parisc, where gcc does not define __BIG_ENDIAN__
+    - added raw15toraw24 tool for making screenshots
+
+commit 9c17cf6f2baf8cf064238e23db7873667b4f8681
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 27 17:24:33 2001 +0000
+
+    New version of neofb, for Linux 2.4.17.
+    
+    Added console acceleration for NeoMagic 2200 and above.
+    Added checking of maximum allowed dot clock.
+    
+    Changed accelerator IDs.
+
+commit 3d638fe5dfcc6f5c5d12036e187cc40f2bb09b5e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 19 16:49:14 2001 +0000
+
+    The macro PIXEL_RGB332 should always be defined.
+
+commit 407634c694f4ea0d03c1b74c46f6e929c7d885ae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 19 01:34:08 2001 +0000
+
+    Fixed color keying on older Matrox cards.
+    
+    Added RGB332 support for all Matrox cards,
+    accelerated blended rectangles look very cool in 8bit.
+
+commit e6e5222554e926ae9e82543caeb2da675ffe8e0d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 19 00:29:46 2001 +0000
+
+    After setting the video mode check the virtual resolution (matroxfb does not
+    return an error but decreases the virtual resolution). Return an error if
+    the virtual resolution does not match the requested one. Fixes segfault of
+    double buffered fullscreen applications in high resolutions on older cards.
+    
+    Print a more descriptive error message if setting the desktop buffer mode
+    failed. Not only missing virtual resolution support but also insufficient
+    graphics memory can cause it. Also try a fallback to system memory back
+    buffer mode.
+
+commit 6ed0d0264cdd802d4be44362dee6b20d73c3cd9f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 18 19:26:28 2001 +0000
+
+    It's now possible to start single buffered applications with "--force-windowed".
+    The implicitly created window is now centered on the screen.
+
+commit b6a7fc1f25c59768aa9627e249d52066ac2abe91
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 18 17:59:38 2001 +0000
+
+    The VT is now mapped to the specified framebuffer device.
+    Thanks to Jiri Svoboda <Jiri.Svoboda@seznam.cz>.
+
+commit 253868a29ae613197a932b0e68f66f6eef9a33b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 18 12:55:51 2001 +0000
+
+    Moved all clipping functions to "src/gfx/clip.[ch]". Outlined 'sort_triangle'.
+    
+    Fixed bug when all four edges of a rectangle are outside the clip.
+    Filled rectangles got discarded instead of filled.
+
+commit 3c8c8b172c740aaa2e3787fe3d15d2b07f5676ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 18 12:03:31 2001 +0000
+
+    fuction table cleanup
+
+commit 01a115c55600f232e1aa0228512889f93ba49ba3
+Author: holger <holger>
+Date:   Tue Dec 18 10:25:58 2001 +0000
+
+    dummy initialisation for IBM notebooks
+
+commit e7a50014685ae01e5ace16045e133aa3bbe75dfb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 17 13:32:18 2001 +0000
+
+    Applied patch from "W. Michael Petullo" <mike@flyn.org> that adds support
+    for new-style device names '/dev/input/js*'.
+
+commit 340ceff6731f94979635e8c7836ff2c10a53b843
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 17 10:57:38 2001 +0000
+
+    New option "--disable-window-opacity" which forces window opacity to be 0 or 255
+
+commit 8f547c9db36b1c36f22d159639f83d70c07b51d8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 17 09:29:30 2001 +0000
+
+    Added option "--[no-]cursor" to enable/disable showing the default cursor
+    on startup. Default is to show the cursor.
+
+commit 6ef5998065df1df3cdf55c898d197326672ab5ba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 16 11:16:49 2001 +0000
+
+    Forgot to remove that preallocated surface memory thing.
+
+commit 238259a439ad306865d0b016630e33be2e6f2d76
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 16 11:13:47 2001 +0000
+
+    'IDirectFB::CreateSurface' can now be used to create surfaces using a
+    preallocated system memory buffer. Apps have to set 'DSDESC_PREALLOCATED'
+    and the appropriate fields in the surface description. The buffer won't be
+    freed if the surface gets destructed.
+    The application has to use the 'Lock' method even to access the system
+    memory buffer. Otherwise data coherency between system and video memory
+    isn't guaranteed.
+
+commit e83d5a7a943b8a0c37ef379ecee22d8fe913f35c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 16 10:23:01 2001 +0000
+
+    Optimized usage of texture cache flushs and engine syncs,
+    e.g. gfxcard_sync only gets called if the surface buffer that
+    is to be accessed by software had been written to before by hardware.
+
+commit 3f9c79f7dfa071cd9b3d51a8753c3bf1c3f0f1b9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 16 07:13:54 2001 +0000
+
+    Runs with Linux 2.2.x or higher. Linux 2.4.x is not required.
+
+commit d3c65cb0fde972883b062e8f80a5e1174ab7a567
+Author: holger <holger>
+Date:   Fri Dec 14 19:04:27 2001 +0000
+
+    changed keycode: DIKC_ESCAPE->DIKC_VENDOR
+
+commit 364e4b04c1eccae08ab0baf5c27da1e54011c495
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 14 13:15:00 2001 +0000
+
+    Removed swapping of left and right mouse button (done).
+
+commit 6b19ae09726d54afcd6cad7cb0dd58f751a1f00b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 14 11:18:57 2001 +0000
+
+    #if 0'ed the unused config_cleanup function as the config should go away
+    if the app is completely terminated. In that case the memory is freed anyway.
+
+commit 091dd4c8ff1403d33c7b2e0316db32e75e89c92a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 14 10:55:49 2001 +0000
+
+    Added new option "--lefty" that enables swapping of left and right button.
+
+commit 0bf7b607154f64f618d847fe6d6c9eda6e6d9656
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 14 09:17:21 2001 +0000
+
+    Added some TODOs. We should really use this file ;)
+
+commit 50a3d79cf048377a6c1487c9491df53c69dddeec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 12 18:14:21 2001 +0000
+
+    i admit, this null pointer change wasn't redundant ;P
+
+commit de2d61fb950cc8aa0432594cd72cc0b2fabda0bb
+Author: holger <holger>
+Date:   Wed Dec 12 17:51:34 2001 +0000
+
+    fix USB problems when no PS/2 port is present, allow multiple mice
+
+commit 8fcbc99b9da8d576404296b4086c4992a5df5ea9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 12 01:49:06 2001 +0000
+
+    more documentation on state handling
+
+commit de701b2d6cb88de9dc1ecca769fe594cbd23dd5f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 11 21:06:36 2001 +0000
+
+    more documentation
+
+commit 315a13a96e4587b1cad9bc1463b5e3dc2f2ce189
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 11 20:11:10 2001 +0000
+
+    documented gfxcard_check_state
+
+commit 63676a3a2b54ddd2b257f1068f12fa8c0275d342
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 11 18:56:13 2001 +0000
+
+    Chose this driver for a good example on writing input drivers.
+    Added comments documenting the driver API.
+
+commit ab431921e1c8f41956173ccb33576314bc7da872
+Author: holger <holger>
+Date:   Tue Dec 11 12:06:17 2001 +0000
+
+    indent cosmetic
+
+commit 3df803523e51a76b1617b196ec22fc870f64ad76
+Author: holger <holger>
+Date:   Tue Dec 11 12:04:25 2001 +0000
+
+    code compaction
+
+commit 8812cdd8b7791d9d477125a1b9f1d3efe43a33c8
+Author: holger <holger>
+Date:   Tue Dec 11 11:55:29 2001 +0000
+
+    perform full initialisation on each device, this should get USB mices working on PC's, too
+
+commit 7a9c62207a95d72ad42b0282f03b1e37bf068e6a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 10 19:01:46 2001 +0000
+
+    Updated for 0.9.8.
+
+commit b87761fb17c0b95c859a5a059362579d4c2b1195
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 10 18:55:32 2001 +0000
+
+    Removed debug output in PS/2 driver.
+    ATI fake texture[tm] for blended rectangles is available again.
+
+commit 2dd0439d87b4925fd84affecbbef1c99df7754a8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 9 23:34:37 2001 +0000
+
+    new aty128fb patch for linux 2.4.16
+
+commit 993407a9492cf517a5e30dc81eba58f38ae57974
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 9 10:55:39 2001 +0000
+
+    s/leightweight/lightweight/
+
+commit c4d2832d44b82b5f800424a5861e9723d45945e7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Dec 9 10:54:13 2001 +0000
+
+    removed rounding factor when blitting non-scaled with tmu,
+    very big fonts looked incorrect
+
+commit 4613b85d42edab09f9167717d4af18eaaf6b970c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 22:29:28 2001 +0000
+
+    Use non-debug 'free' for freeing interfaces after failing construction.
+
+commit 10903cb964de9f5f98933b398899c6d4b93efdeb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 17:49:17 2001 +0000
+
+    Use a double buffered window for a primary only if
+    the primary should be a flipping surface.
+
+commit db17e3567bd964ee069bae29d4a2a42352cd38a6
+Author: holger <holger>
+Date:   Fri Dec 7 14:24:20 2001 +0000
+
+    moved around tcflush() commands
+
+commit e5828c1ef1bc620f61934a0e5723134101f6f976
+Author: holger <holger>
+Date:   Fri Dec 7 13:19:28 2001 +0000
+
+    optimize DDA for speed
+
+commit ab864429fd0cab6bd7b9485a4d9e82d564fab2b9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 03:58:11 2001 +0000
+
+    typo in debug message
+
+commit 8e7feb6cd8191a937b4d546adfc76e35753077a1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 03:38:12 2001 +0000
+
+    compile fix
+
+commit 03f9d510675c76a40fd40d9aeeba9f1cdd0cd38f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 01:33:02 2001 +0000
+
+    Triangle rasterizer (used when hardware no triangle filling or clipping)
+    now uses hardware accelerated rectangle filling if available.
+
+commit 9bf70ee4a78d55c672658aa0ff6c656935c5b479
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Dec 7 01:04:23 2001 +0000
+
+    Moved the hw clipping check before gfxcard_state_check/acquire when
+    it comes to triangle filling. I haven't tested it before but the wrong
+    order should have caused deadlocks when hardware is able to fill triangles
+    but has no hw clipping.
+
+commit fb6aef957417b7ba433614d75e369a5b2e7c130d
+Author: holger <holger>
+Date:   Thu Dec 6 21:22:05 2001 +0000
+
+    fixed driver
+
+commit 31c90dc29643164bb566faecb312076eb0049cbc
+Author: holger <holger>
+Date:   Thu Dec 6 21:06:23 2001 +0000
+
+    new FillTriangle algorithm using DDA's
+
+commit a413a656f557d79bc3cb2cbd2817e901c08b79d5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Dec 6 16:45:57 2001 +0000
+
+    Added gfxcard_reserve_memory that can be called at init time by drivers
+    for special purposes, e.g. fake texture or command overflow buffer.
+
+commit 8df2b725bf9e00aea7354d0876ffa0092c218924
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Dec 6 16:07:49 2001 +0000
+
+    initialize GetFont field in IDirectFBSurface (spotted by king@mizi.com)
+
+commit 223ee60f46e5ca1c3027ef372adc66302d78ecbc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Dec 5 02:25:55 2001 +0000
+
+    Don't generate window events from input when an app runs fullscreen.
+
+commit 18031f5b711f7560c21cc020d9346f3e424da9d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 20:52:34 2001 +0000
+
+    Applied patch from David Wood <DWood@daedalcorp.com>.
+    Added him to AUTHORS for the Voodoo driver.
+
+commit 6e371a3d623f42ea6f6c57ff12a5cb87e1e1e0fe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 18:52:51 2001 +0000
+
+    Renamed 'BYTES_PER_PIXEL' to 'DFB_BYTES_PER_PIXEL'.
+    Renamed 'BITS_PER_PIXEL' to 'DFB_BITS_PER_PIXEL'.
+    Renamed 'PIXELFORMAT_INDEX' to 'DFB_PIXELFORMAT_INDEX'.
+    
+    Added 'DFB_DRAWING_FUNCTION(a)' that replaces the magic 'accel & 0xFFFF'.
+    Added 'DFB_BLITTING_FUNCTION(a)' that replaces the magic 'accel & 0xFFFF0000'.
+
+commit 1ef5564bbbfec9536c99c4e8c54cf4ae681f9931
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 17:43:37 2001 +0000
+
+    Division by zero fix.
+
+commit d5d5547d56bfa40eb95f9a05b602a4f848942c26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 17:42:47 2001 +0000
+
+    renamed dbg_* functions to dfb_dbg_*
+
+commit 0be7ae641e75ece7cdc2b2085fc4e7b97586f4eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 16:50:00 2001 +0000
+
+    Applied patch from Holger Waechtler, gFillTriangle is removed and triangle
+    filling/clipping is handled by 'gfxcard.c'. Triangles are filled by software
+    if hardware/driver doesn't support triangles or doesn't support clipping.
+    In the final version of this function triangles will be filled via accelerated
+    rectangles if hardware has no triangle or clipping support but filled rectangles.
+
+commit cdfcee5a0ddb3928a05f3994ae9b46b7e0bb3413
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Dec 4 16:42:25 2001 +0000
+
+    commented out a debugging signal
+
+commit 35a64af9ec15a5f17d70e38530b0a1279b74bc1c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 3 17:37:50 2001 +0000
+
+    optimized offset handling for file internal data
+
+commit f39f90c8d063938d9f381080cab66cbe1177ba92
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 3 14:04:52 2001 +0000
+
+    Finally position independent code with real code sharing.
+    No patch needed to build with dietlibc.
+
+commit 1ac75046d1f171ce147832d3481585e9ac3666d8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Dec 3 14:02:24 2001 +0000
+
+    dont set the val field of semul at all when unsing the IPC_RMID semctl()
+
+commit b66883d1d1f16d5b8680b8ecc64e4b7287e48db4
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Dec 3 04:04:44 2001 +0000
+
+    in all SETVAL semctl()s, pass a union and set the val field instead of passing the
+    value directly. this fixes multi appication core crashes on ppc. obviously
+    this is the right way, however it worked too on i386 before the change.
+
+commit c521677e48d99ebe27a6ffd9f2bfa5d0098ef26a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Dec 3 04:03:46 2001 +0000
+
+    Matrox BES works again, writing to four dac registers subsequently didn't
+    work after the base address got a local variable instead of a global.
+    Strange gcc or cache behaviour i guess.
+
+commit 74d8ab8b4ed792224076e78a6a4a4f22d91de8fe
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Dec 2 00:17:26 2001 +0000
+
+    added "wm_hack" feature:
+    press shift lock over a window and spin the mouse wheel to change the window
+    opacity.
+
+commit b87a5f31ba0ff40d3a494408b439aa1d4f482673
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Nov 30 19:03:21 2001 +0000
+
+    Made all 'Sop -> Aop' functions 'Bop -> Aop' (source aliasing removed).
+    This makes simple blitting 90% faster for very short scanlines, e.g. 2x200,
+    because the "Sop_is_Bop" function is not needed.
+
+commit d559201293793fc56d6100213df56a45d8d7e785
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 29 16:58:39 2001 +0000
+
+    Fixed segfault when rendering pipeline is empty, e.g. using DSDRAW_BLEND
+    with SrcFunc DSBF_ZERO and DstFunc DSBF_ONE.
+
+commit d36dc01cee434262f84483eb877d26e52494fa33
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 29 16:51:45 2001 +0000
+
+    Check for NULL pointer.
+
+commit 9cc0e65dfe4f1f6a01b4a8e1e778f8c4ee0dd795
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Nov 29 16:12:27 2001 +0000
+
+    Revived exit handler.
+
+commit 9be8bbbcc3602599123ed8282b9cd07ee82e42c5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Nov 29 14:28:54 2001 +0000
+
+    build fix
+
+commit d26e711dc1a68cb742f7a87a673ca2d9cc9b25c3
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Nov 29 14:19:06 2001 +0000
+
+    added remote control driver for dbox2
+
+commit 57fd6015f4812bf6f340d5d4f6ffeb32b4e639bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 28 17:56:41 2001 +0000
+
+    Removed "-O3" from default flags. It's added when debug is disabled.
+    Added "-O0" to flags when debug is enabled.
+
+commit ba61c9fb37d8f11d070266044329f8496e013b63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 28 17:06:28 2001 +0000
+
+    In RGB332:
+    Have all colors but black a bit transparent. Black is totally transparent.
+
+commit fea914d4119cb4fc9afdfb09b31b633145909201
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 28 16:43:21 2001 +0000
+
+    hmm, transp is inverted alpha ;)
+
+commit c16f34ed4e62c7bb75ceff4659f531a6aafa6892
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Nov 28 15:58:30 2001 +0000
+
+    In RGB332 mode initialize alpha values in palette.
+
+commit 4fc1c660c5c87f61167dc2d6f81d13968217d605
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 27 20:42:36 2001 +0000
+
+    Physical address is 'unsigned long' now.
+
+commit dacba42883d71bc6ba26830193ce9688554202fc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 27 13:19:42 2001 +0000
+
+    Create reactor before call to "driver->OpenDevice".
+
+commit e7560c25053c8149202109f7b1f6809b43d1569a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Nov 27 00:22:57 2001 +0000
+
+    added DWET_WHEEL window event. Focused windows now receive events if the mouse wheel is used.
+
+commit 60fa2ddf051144bfd7758d2b496c8baf8f79bad8
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Nov 27 00:15:56 2001 +0000
+
+    bugfixes:
+    when using a imps2 mice the packet array was accessed out of bounds
+    added (__s8) cast to before assigning wheel motion data to dz.
+
+commit 52972a68fb6ad4d743e60834f03d7c833bbfc94e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 12:13:56 2001 +0000
+
+    Use calloc and strdup instead of malloc/memset and malloc/strcpy.
+
+commit d18189186c74579b173b154cced54448f3b5e79e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 04:54:31 2001 +0000
+
+    Free pending events on destruction of IDirectFBWindow.
+
+commit b72a6a4c4a4f6517fded320024454a4619275362
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 04:48:19 2001 +0000
+
+    Removed "#include <config.h>" from headers that get installed.
+    "-DDFB_DEBUG" and "-DFUSION_FAKE" are now command line arguments.
+    When debug is enabled "-DDFB_DEBUG" is contained in directfb-internal.pc.
+
+commit 247dbcad4232ff271718075897125846c328e5e8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 04:30:03 2001 +0000
+
+    Use DFBCALLOC for DFB_ALLOCATE_INTERFACE only if not in debug mode,
+    because interfaces are not freed intentionally in debug mode.
+    
+    Free pending events on destruction of IDirectFBInputBuffer.
+
+commit a72d2ecc6495967577a82a3438856acf56498256
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 02:50:18 2001 +0000
+
+    Include SMF_SOURCE in SMF_ALL, could have caused blitting from the wrong
+    source recently (longer for a very few drivers) when switching to another state.
+
+commit e0a425359cbb4031ae47ce55293d27a85114e57e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 01:50:45 2001 +0000
+
+    Add "-DFUSION_FAKE" to internal CFLAGS in package config file
+    when compiling for single application core.
+
+commit 0ed598c6e86c15a3def0af551860c337d6a2ffe4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 26 00:04:18 2001 +0000
+
+    Made additional layers available again, but for single app core only yet.
+    For a strange reason the Matrox BES doesn't get visible, until the old
+    version has been used once.
+    
+    Readded 'surface_soft_lock' as a helper function
+    that behaves like the one before.
+
+commit cf1be1be7a22b9f068850300c7c9409e0e463cb2
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Nov 25 22:53:05 2001 +0000
+
+    include string.h to avoid warnings with gcc-3.0
+
+commit 6e16576996423dc602b1bc2cd6d844b015fa4d4d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 25 21:38:49 2001 +0000
+
+    When an IDirectFBInputBuffer gets destructed it now detaches from
+    all devices it was attached to. Not only the first one.
+
+commit 5982ef209e4d1150d8c6d2eab9a2089b278e1ad4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 25 18:54:50 2001 +0000
+
+    Device name is "Software Rasterizer" now, not "Generic".
+    Vendor string is "Generic" or "MMX" so it prints "MMX Software Rasterizer"
+    or "Generic Software Rasterizer".
+
+commit 965bd5328c99e5df814e7df520d78933e155f98a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 25 03:32:19 2001 +0000
+
+    Print device name & vendor instead name of driver.
+
+commit f0ec56b7f93f5d12a366dc12c0eff3d642101d3f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Nov 25 02:23:07 2001 +0000
+
+    Fixed "--fbdev=" option.
+
+commit 1c05d9bcb5227b104766c6ceb9d2fc485d28a55d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Nov 21 19:28:16 2001 +0000
+
+    #include <asm/page.h>,
+    fixes compile error on ppc (PAGE_SIZE was not defined)
+
+commit b55013fb307c9cabad8587ed2f8a9d5f075322e3
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Nov 20 22:05:01 2001 +0000
+
+    use malloc() and free() instead of alloca().
+    this fixes a crash, when loading jpeg images that are larger than the surface rendered to.
+
+commit 68ed11f3ce430d8e244e88324aec6a8cb1c93ceb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 20 20:45:50 2001 +0000
+
+    Added support for IMPS/2 by Jason Gaiser <jasno@san.rr.com>.
+
+commit 61b342d2be35310df32ed862a7b7023a345c750c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 20 14:46:15 2001 +0000
+
+    These are in fusion now.
+
+commit bd622572d9143771ba96efa479b105be266aca85
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 20 12:59:33 2001 +0000
+
+    Ok, here it comes, not yet complete and far from being finished.
+    Important things to do are resource cleanup (especially when apps get
+    killed), safety, code cleanup and so on.
+    This tree can build both the single and multi app core, you can switch
+    at configure time with "--enable-multi".
+    The single application version does not fully work like before yet,
+    missing are Suspend/Resume and therefore VT switching during running.
+    Also support for additional display layers is disabled because there
+    need to be some changes to the internal layer handling.
+    
+    There are also enhancements, e.g. abi version handling for drivers.
+    Graphics drivers are now ready for multi head support. Core code cleanup
+    is in progress. 'gfxcard.[ch]' and 'input.[ch]' already have their private
+    structures hidden.
+    
+    I am sorry for the changes to the graphics and input drivers, but it's
+    much more clean now and drivers work with single and multi app core without
+    rebuilding.
+    
+    You can checkout DirectFB at any time by specifying "-r DFB_BEFORE_MULTI".
+    
+    Any help in optimizing/finishing especially the src/core/fusion stuff is
+    appreciated. Thank you!
+
+commit 4ce740d0d1bf1d0475ba57ebb8d35668fab21a62
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 19 05:33:55 2001 +0000
+
+    Added 320x240 and 400x300 double scan modes.
+
+commit cd7549f12dd27e8015a551b149ea6e5f2446fa47
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Nov 13 07:36:03 2001 +0000
+
+    Simple blitting support for nVidia cards.
+    Thanks to Daniel Foesch <dfoesch@cs.nmsu.edu>.
+
+commit 475d3155f039fea5742f894279940971337f1ffe
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Nov 8 00:53:25 2001 +0000
+
+    fixed initialization of the RGB332 palette, white looked a bit like light coffe before (yes, dok you were right, that notebook tft was not)
+
+commit 525a2d04253905aeebb92d886f48b8a394c346f1
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 5 23:29:52 2001 +0000
+
+    - finished implementation of RGB332 support, still not optimized but complete.
+    - changed version number of generic driver to 0.5, didnt change that number
+    for a _long_ time.
+
+commit 0c1b289e6d31274142cbddae1f5a10eab1c9e2eb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Nov 5 21:01:25 2001 +0000
+
+    Restore current mode when resuming.
+
+commit e7a7709ee1f2e5f945b4fcc4418af6d05bb2c19b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Nov 5 00:52:43 2001 +0000
+
+    implemented Sacc_to_Aop_rgb332(), Sop_rgb332_to_Dacc(), Sop_rgb332_Sto_Dacc()
+    
+    now blending in 8 bit works.
+
+commit 1758deac0c70bd130aa3c276da18a51cc5b01e18
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 3 05:06:52 2001 +0000
+
+    Added includes for types used in these headers.
+
+commit f7f5ca6cf6dd84f580fc90a1ea2b68602a36ab1a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Nov 3 04:49:01 2001 +0000
+
+    Fixed includes so that each header should compile on its own.
+    Moved forward declaration of 'InputDevice' to 'coretypes.h'.
+
+commit 0925771ad452be507dd6cfecab92c2e0f34f1cc3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 31 15:53:50 2001 +0000
+
+    Default font location had changed, did also change in code.
+
+commit cfa916691655ff8a01901da733310c5d96a5c04c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 30 03:32:48 2001 +0000
+
+    removed description of the examples.
+
+commit bf28334c75e88082280dfdce781a6ead5642b426
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 30 02:18:36 2001 +0000
+
+    Added OpenGL support via the new interface "IDirectFBGL".
+    
+    Added "IDirectFBSurface::GetGL",
+    it will return the new interface if it has been installed (DirectFBGL).
+    
+    A call to "IDirectFBGL::MakeCurrent" sets the current OpenGL context.
+    
+    Added an optional "Allocate" function to interface implementations,
+    the creator of the interface no longer needs to know its content.
+    
+    Activated DWCAPS_DOUBLEBUFFER for windows that got created implicitly
+    by creating a primary surface in non-exclusive mode.
+    
+    The mouse cursor is now activated by default.
+    
+    Increased version number to "0.9.8".
+
+commit 74c82a7471aeb2ea4df7c0f43f8e5ab676dc45eb
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Oct 30 01:27:58 2001 +0000
+
+    - removed examples, moved them to DirectFB-examples.
+
+commit 86180d221182007ee6d1436e3813ccdb135f1d34
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 29 23:07:40 2001 +0000
+
+    implemented Sop_rgb332_SKto_Aop() for stretched color keyed blits.
+
+commit 8b642d324f01b9959254b86dfac7662a6f51c984
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 28 21:29:39 2001 +0000
+
+    fixed some includes
+
+commit d4a3527700ab199657c01b749d86716d27b23d5d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 28 19:06:24 2001 +0000
+
+    Fixed typo in comment.
+
+commit 71040f99b71aaf98bac7209c8758d8fd568068ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 28 19:05:38 2001 +0000
+
+    removed obsolete code
+
+commit 70ae72267dde43a78de33fc22ccc4ec698bb7343
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 27 20:54:36 2001 +0000
+
+    changed penguin's colorkey to green. now df_andi looks correct in 15 and 8
+    bit (too much of the penguin was keyed before when runnig at lower bit
+    depths)
+
+commit 58d468b13c398d4c009ab7c3595feb65cd143c71
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 26 12:39:34 2001 +0000
+
+    Updated for 0.9.7
+
+commit e87e4763dc702529796540ba6775eb891d16d2c2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 25 15:17:30 2001 +0000
+
+    Removed commented out code,
+    wrote an explanation instead why the state isn't modified.
+
+commit f2be27c5481d6346c539e553d8064154aebda0a8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Oct 25 14:47:06 2001 +0000
+
+    Adapted examples to latest API changes (surface->SetSrcColorKey).
+
+commit f360be888d6f8326201fcdac066ac73c3daabe3b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Oct 25 14:33:16 2001 +0000
+
+    Important API change:
+    
+    IDirectFBSurface::SetSrcColorKey has to be called on the source now,
+    when blitting to a surface which has source color keying enabled.
+    
+    For IDirectFBSurface::SetSrcColorKey and IDirectFBSurface::SetDstColorKey:
+    The color key is now specified by three values each 8bit: r, g and b.
+    They will be converted to the pixelformat of the surface automatically.
+
+commit e0f5c3beb39992d87ff5c5febc4540e48a61983d
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 22 17:53:48 2001 +0000
+
+    forgot to change filenames.
+
+commit d39fd0c4d5b5af82da95c9d5ffd9bd59219b7f4c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 22 17:52:32 2001 +0000
+
+    *** empty log message ***
+
+commit 17ad8ca16ec51dad79a6069a4376eb91df37bb7f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Oct 22 17:52:03 2001 +0000
+
+    updated aty128fb framebuffer driver patch.
+    
+    the patch was tested with kernel versions from 2.4.7 - 2.4.12. It may work
+    with older versions too.
+
+commit 096f45160569193fb54c2e204d377e4a1538cc20
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 21 15:50:08 2001 +0000
+
+    Added DSPF_UYVY and clarified description of both YUV formats.
+    
+    Added surface capability DSCAPS_INTERLACED which indicates that the surface
+    contains interlaced video data (two fields of half the height of the surface
+    are stored interleaved line by line). This capability will be set by drivers
+    when a layer is configured with DLOP_INTERLACED enabled. Video providers are
+    then able to notify the layer driver about field changes (for software driven
+    field changes).
+    
+    Added surface notifications CSNF_SET_EVEN and CSNF_SET_ODD (internal),
+    drivers can listen to them to support (de)interlacing with software driven
+    field changes.
+    
+    Added DVCAPS_INTERLACED to indicate that a video provider supports
+    notification of field changes if the destination has DSCAPS_INTERLACED set.
+    
+    V4L provider supports (de)interlacing and both YUV formats.
+    
+    Added support for (de)interlaced video with the Matrox Backend Scaler.
+    
+    Added support for YUY2 as a blitting source on the G200.
+    
+    Added support for YUY2 and UYVY as a blitting source on the G400.
+    
+    Made some features available on the G100, stretched blits and format conversion
+    are now available, but for 15/16 bit sources only. Colorizing is available, too.
+    Blending could be available, but only in stipple mode and no ARGB32;-(
+    
+    Added support for deinterlacing in df_layer, also demonstrating how to test
+    layer configurations. Will fallback to UYVY or even take the current format.
+    
+    AviFile provider returns an error if support for YUY2 or UYVY is not available.
+    
+    Increased version number to 0.9.7.
+
+commit c4a57ad2c754c4fe8f4facaecc9b262ce24a5ff9
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 20 23:41:46 2001 +0000
+
+    optimized RGB15 and RGB16 color keyed blit (doubled performance on some
+    cpus)
+    
+    df_dok benchmarks (MPixel/s):
+    
+    Apple PowerBook G3 400Mhz:
+    15.2  -> 30.8
+    
+    Sony Vaio PIII 700 Mhz:
+    69.5 -> 112.9
+    
+    PowerPC 823 66 Mhz:
+    2.65 -> 3.49
+
+commit 0cfcd032885edb90e9dba165e583c13a2923ebe1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 20 22:35:21 2001 +0000
+
+    5 lines added to have G100 support as well ;)
+
+commit ebc5ca5f8b2aa1367e4de649d30f6b885c8421e4
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sat Oct 20 15:01:27 2001 +0000
+
+    - dont call fbdev_set_gamma_ramp() when using RGB332
+    - allow RGB15 mode on fbdev drivers that report to use one bit for alpha
+
+commit b92f249876c108445a2bf81d4e5b9cc2795de99f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 20 08:52:42 2001 +0000
+
+    It's now possible to use the V4L Provider on YUV surfaces.
+
+commit 0fa1dcc59ee68fbb3dba671ba048c3dc79dbb0ab
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 20 08:02:16 2001 +0000
+
+    Added support for the following fb.modes options:
+    
+    'gsync true'   - Sync On Green enabled
+    'csync high'   - Composite Sync high
+    'extsync true' - External Sync
+
+commit 3ab5d3da023bc08473fe6d36c689ae240cc7a8b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 20 07:47:20 2001 +0000
+
+    When reading the first 32 byte of a file in CreateImageProvider,
+    open the file/device O_NONBLOCK! With a BTTV and DFBSee trying to create
+    an image provider for /dev/video the read never returned.
+
+commit 7334ea9cfdcbfa80a78544cf6aeed6fa54e01373
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Oct 20 06:49:50 2001 +0000
+
+    Added acceleration for older Matrox cards (Mystique and Millenium I & II).
+    Tested on a Mystique with SGRAM
+    
+    Supported are:
+    - Solid rectangle/triangle filling
+    - Solid line/rectangle drawing
+    - Blitting with or without source color keying
+    
+    Mystique seems to has a texture mapping unit, but I didn't get it working
+    correctly, scaled images looked tiled/interleaved, but it was slower than
+    software anyway, so it propably wouldn't trade off.
+    
+    
+    Fixed BCOL setting (colorkey mask), all 32 bit must be filled for these cards.
+    
+    Added second simple blitting function 'matroxBlit2D_Old',
+    because BitBlt programming is too different between new and old cards.
+    
+    Source and destination surface offset handling is totally different, too.
+    
+    Cleaned up CheckState functions, optimized invalidation rules in SetState.
+    (Don't know why source registers had been invalidated on destination changes).
+    
+    
+    Tested on a Mystique with SGRAM on an Athlon 1.33GHz:
+    - Rectangle Filling 823 MPixel/sec
+    - Blitting 46 MPixel/sec (software was about 30)
+    
+    Without "--matrox-sgram" feature:
+    - Rectangle Filling 94 MPixel/sec !
+
+commit 9526323cca3e159c24ac55545153913bbe575c63
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 19 21:12:02 2001 +0000
+
+    changed the default background color to a more "cooler" blue
+
+commit d3e49eba971a86f232e57ffba10f5663ed6977cf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 19 21:07:04 2001 +0000
+
+    Added option "--fbdev=<device>" which lets you
+    specify another device than "/dev/fb0".
+
+commit bb526019b27660f1b5084b937cd8e1035dfc6668
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 19 20:50:06 2001 +0000
+
+    Renamed global symbol "vt" to "core_vt".
+
+commit 9e2175119357828b0cdf09adfff6d5f30420410b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 19 20:30:42 2001 +0000
+
+    Each interface con now have a long description, put it above DEFINE_INTERFACE.
+    Description of structs is now put into types page.
+    
+    Added some text for IDirectFB.
+
+commit 943754f50a62b0bddd24740d8f91e1e72a0bccd9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 15 02:29:00 2001 +0000
+
+    After a window gets closed make sure another window gets the focus if any.
+
+commit 3a6db05db001a8abcab56e6170bbb9ad65f720fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 15 00:55:31 2001 +0000
+
+    Reenabled changing of controlling tty when vt switching is used.
+    This is needed, otherwise mode switching ioctls have no effect.
+
+commit b45b82d58c3239a507bb08a5c36315e0f4c54420
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 12 12:24:42 2001 +0000
+
+    Use video alpha method when modifying destinations alpha channel.
+    Text and blended blits look much better now when done on a window with alpha.
+
+commit c045162ee3d7fa0cb131ac72a6076171945c837e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 12 00:03:04 2001 +0000
+
+    Several enhancements make DirectFB now really usable with "--no-vt-switch",
+    with this option you are able to run DirectFB programs without super user
+    privileges. You need read/write access to /dev/fb and you should start it from
+    the console, i.e. not within X.
+    
+    DirectFB now restores the palette during deinitialization.
+    DirectFB now turns cursor and blanking back on.
+    DirectFB now restores the terminal attributes like local echo.
+
+commit 6a6dc0e18baded8e8f43cf7544c72885bf092384
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Oct 10 13:21:50 2001 +0000
+
+    Added checks for supported source formats.
+
+commit 0e8ba28f155e34eed93cc97dd3784198e629fa23
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 9 08:49:33 2001 +0000
+
+    Better check for supported/unsupported pixelformats.
+
+commit d518e865e5541a30a57cd91037859d8cac545ec7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Oct 8 07:08:46 2001 +0000
+
+    Source surfaces are now locked before destination surfaces.
+    Commented out error message of FreeType2 Font loader when
+    the file could not be opened.
+
+commit 885edeb232aff1529438ee82d84654fed47e1ebf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Oct 7 03:55:30 2001 +0000
+
+    Ready for 2.4.10 neofb.
+
+commit c509539543ab25dd28fd7388583e05633ce5b74f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Oct 7 03:07:11 2001 +0000
+
+    fixed warning
+
+commit bb1d8763ab4f1b81b165078a01c8a4da1d97d928
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Sun Oct 7 03:01:58 2001 +0000
+
+    added 8bit RGB332 pixelformat. This is usefull to test DirectFB on old unix
+    workstations which had 8-bit framebuffers on board (sparc,pa-risc,mips)
+    Implementation in not complete yet.
+    
+    If you want RGB332 for any reason, you have to enable it at compile time using
+     ./configure  --enable-rgb332
+
+commit 56e3728eca88eea44118f28949eee40527f968ea
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Oct 5 19:27:21 2001 +0000
+
+    fixed gcc-3.0 warnings.
+
+commit 7d225e0b498a49a5ddbb2be22a9c558df95390b5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Oct 5 13:17:22 2001 +0000
+
+    Do a more verbose error message if no supported modes were found in
+    /etc/fb.modes and the current mode is not supported, too.
+    Pixelformat of current mode is printed in this case.
+
+commit eb7bab13392acbe2d5f01acc5a0f8979aa637846
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 2 22:07:52 2001 +0000
+
+    R34D7 4 D4 R3L3453
+
+commit 6b4f98844efdf45cad3747ca72315d37ee54e4cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 2 22:04:19 2001 +0000
+
+    Added 'IDirectFBDisplayLayer::Set/GetColorAdjustment()' along with four
+    capability flags for each adjustment (brightness, contrast, hue, saturation).
+    
+    Implemented color adjustment for Matrox BES
+    (brightness and contrast supported in YUV only).
+
+commit 5d3c9095555c8b7d02fc7e6eb58931199e2193b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 2 20:10:37 2001 +0000
+
+    Fixed documentation generation according to distcheck's complains.
+
+commit 364b8b0ff20ebbde50d98e1f5328b8ac3948d8d6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 2 15:38:42 2001 +0000
+
+    Updated ChangeLog and summarized changes since 0.9.5 in NEWS.
+    Changed version number to 0.9.6 by previous commit.
+
+commit 89cc3f0689db45c9e8f81531cc9dc6fd49f54f06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Oct 2 15:35:48 2001 +0000
+
+    We now accept compatible pixelformats,
+    e.g. IPAQ's RGB format is compatible with RGB16.
+    
+    Added evil workaround for automake using non substituted @AS@ like a gcc.
+    
+    Added stamp-h1 to .cvsignore
+
+commit 19f2f467e0851252d4292e1344181b18c9a285df
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 27 03:56:13 2001 +0000
+
+    Check enter/leave and focus after ungrabbing pointer.
+
+commit 408edc2205b1049ad098898f11440ce81caf6631
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 26 18:20:46 2001 +0000
+
+    Benchmark size is automatically shrinked to fit the screen, e.g. for 320x240.
+
+commit c478fe0c659b639463cbb20eb195eb92d2ea8612
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 26 17:56:09 2001 +0000
+
+    Eek, broke button press/release, fixed ;)
+
+commit e52b138819af0abcb7f3bde75a0d989743887222
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 26 17:51:20 2001 +0000
+
+    If there is no pressure, the x/y fields seem to be invalid.
+    Check them only if there is pressure.
+
+commit 86edba4110566931eaec72c5496e433b6b3a49ff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 26 17:31:33 2001 +0000
+
+    Fixed handling of absolute axis coordinates in window stack cursor handling.
+
+commit 76ce6ead53befac36ba52ee27da30859c3464763
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Sep 26 16:47:19 2001 +0000
+
+    Added untested H3600 Touchscreen driver.
+    
+    Fixed definition of DFXL_ALL (DFXL_FILLTRIANGLE was missing).
+
+commit ac463fe40c03c9f210c7a71e9e9ee27da9a22551
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Sep 23 04:33:00 2001 +0000
+
+    Use 'DFBCALLOC' in 'DFB_ALLOCATE_INTERFACE', forgot that one.
+    
+    Fixed small event dispatching bug in window stack, a button event
+    was sent to the focused window even if it's not under the cursor
+    and doesn't grab the pointer.
+    
+    When CapsLock is hold down you can raise
+    the window under the cursor with a click.
+    
+    
+    
+    The following changes fix problems related to heavy threading,
+    e.g. more than 50 threads on my machine actively using DirectFB:
+    
+    Added 'surfacemanager_lock/unlock()' and divided surface manager functions
+    into two groups: functions doing the lock themselves and functions that can
+    only be called between lock/unlock. Functions doing the lock themself must
+    not be called between lock/unlock.
+    
+    Added 'state_lock/unlock(state)' that are called in drawing/blitting functions
+    from 'gfxcard.c'. Merged 'card->source_locked' and 'source_locked (generic.c)'
+    into new 'state->source_locked'.
+    
+    Added 'buffer->video.locked' so the surface manager does not try to kick out
+    surface buffers that are currently locked, which could end up in a dead lock.
+
+commit bdec189bdf26ca618a733c91d82ea9a94897dd26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Sep 22 21:25:01 2001 +0000
+
+    Added "-lm" for df_layer.
+
+commit ae0c3f7618819f1593e07f9c2a68b7cb12a9ab47
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 21 21:34:12 2001 +0000
+
+    Fixed "Could not disallocate VT" problem, exit handler calls normal
+    deinit function now instead of the emergency deinit. Additionally
+    input devices are deinitialized from emergency deinit.
+    
+    Fixed problem with malloc/free debugging that occured when exit handler
+    for memory leak checking was called before exit handler of the core.
+    Memory leak checking is now called at the end of the core exit
+    handler if debugging is enabled.
+
+commit 251dec9af7bdc797d2c0ab3131241408418964bc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 21 15:19:43 2001 +0000
+
+    Fixed segfault when loading big PNGs, seems that there was a problem
+    with alloca. However it works with malloc, but maybe the problem is that
+    libpng has a bug that does no harm when using malloc, because of other
+    address ranges.
+    
+    Also switched to 'png_read_image()' to have deinterlacing handled automatically.
+
+commit 0b67da2772812ecd6f0a7e47fb9ce1a75286a780
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 21 00:37:30 2001 +0000
+
+    Fixed surface manager bug. When surface gets kicked out of video memory,
+    make sure that the system memory instance of the buffer is up to date.
+    This fixes "missing font letters" for example.
+
+commit 4926a68e0d20c35d1d7c85151809ff52dfd93c98
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 18 21:54:17 2001 +0000
+
+    Added result 'DFB_DESTROYED' which is currently returned by 'IDirectFBWindow'
+    and 'IDirectFBSurface' if the window or surface has been destroyed.
+    
+    Added window event type 'DWET_DESTROYED' and changed meaning of 'DWET_CLOSE'.
+    -          DWET_CLOSE          = 0x00000004,  /* window got closed by window
+    -                                                manager or the application
+    -                                                itself */
+    +          DWET_CLOSE          = 0x00000004,  /* closing this window has been
+    +                                                requested only */
+    +          DWET_DESTROYED      = 0x00000008,  /* window got destroyed by global
+    +                                                deinitialization function or the
+    +                                                application itself */
+    
+    Added 'IDirectFBWindow::Close()' that puts a 'DWET_CLOSE' event into the
+    window's event queue. The event dispatcher thread can then decide to close it.
+    
+    Added 'IDirectFBWindow::Destroy()' which actually destroys the window after
+    sending a 'DWET_DESTROYED' event, so the event dispatcher thread can notice and
+    release any interfaces belonging to it.
+    
+    After a window has been destroyed by 'IDirectFBWindow::Destroy()' most functions
+    of 'IDirectFBWindow' will return 'DFB_DESTROYED'.
+    
+    There is no need to destroy windows explicitly with this new function if no
+    threads are doing 'WaitForEvent()'. If an 'IDirectFBWindow' has no more
+    references after 'Release()' the window gets destroyed implicitly if it hasn't
+    been destroyed before.
+    
+    
+    If you hold down 'CapsLock' over a window (as if you want to move it) and press
+    the key 'C' a 'DWET_CLOSE' will be sent to the window.
+
+commit 183bbecc2c2f07c4736160e6cffd0b5a5b0719b0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Sep 16 09:46:51 2001 +0000
+
+    Matrox Backend Scaler support added.
+    YUY2 added.
+    
+    With a matrox try: df_layer <any.avi>
+
+commit cd99ba0285874fc1ec5d554099e9aaf04d96ad60
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Sep 14 00:23:56 2001 +0000
+
+    df_layer now links against $(AVIFILE_LIBS).
+
+commit cc00d022b03213175ab0e31b9fed948cace4c15d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 13 23:49:27 2001 +0000
+
+    Forgot to set DLCAPS_SURFACE for primary layer (fbdev).
+    Just changed the name of a function parameter in 'layers.h'.
+
+commit a53b8beb1e4467742880b7b1a755e5ce7ce58467
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 13 23:39:22 2001 +0000
+
+    Added new window capability, from the header:
+    
+    DWCAPS_DOUBLEBUFFER ... /* The window's surface is double
+                               buffered. This is very useful
+                               to avoid visibility of content
+                               that is still in preparation.
+                               Normally a window's content can
+                               get visible before an update if
+                               there is another reason causing
+                               a window stack repaint. */
+    
+    
+    Use 'alloca()' in 'IDirectFB::CreateImageProvider()' instead of 'malloc()',
+    return appropriate error if file could not be opened.
+
+commit 5fde11e5f990ced53459a712d8b0756aff3c3241
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 13 22:41:40 2001 +0000
+
+    Added simple layer example which plays a video onto the second layer.
+
+commit 6aeaa1bb3d376dc2711e4f3145a0b3d75b82e23c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri Sep 7 00:04:28 2001 +0000
+
+    in driver_deinit() card is set a state, where the aty128fb driver should never
+    hang.
+
+commit 7b2e3eef289d9cc93c5a0ee2296fc7b727cd4fc7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 6 23:15:33 2001 +0000
+
+    The file descriptor of the allocated VT is now closed before deallocation.
+    Added error checking to deallocation code.
+
+commit 23d8ccf08d9e55e81076e6d95bd6a9f1fbd528ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 6 22:48:08 2001 +0000
+
+    Call 'sched_yield()' after mutex lock failed.
+    Call graphics card driver deinit in emergency deinit.
+
+commit 219c175c1cabf7890462b6433da10dde8f55ae10
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Sep 6 20:31:06 2001 +0000
+
+    Wrote a summary of changes after 0.9.4.
+
+commit d586de4e1907ceb33be948354d418965c167a330
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Sep 6 19:56:55 2001 +0000
+
+    enumeration callbacks return DFBEnuerationResult now (no more warnings)
+
+commit ee34e0dd5d8bd7c1a6a0f773eb316ae765c81846
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Sep 4 16:50:09 2001 +0000
+
+    Added a return value type for enumeration callbacks: DFBEnumerationResult.
+    There are two possible values: DFENUM_OK and DFENUM_CANCEL.
+
+commit 89b800f933c5904ab0e2877cf8ab5ec70b17359d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Sep 3 01:15:33 2001 +0000
+
+    Accept interlaced and double scan modes, 320x200 looks really cool in some way.
+    
+    Here is a 320x200 entry for fb.modes:
+    
+    mode "320x200-70"
+        geometry 320 200 320 200 16
+        timings 79440 16 16 20 4 48 1
+        double true
+    endmode
+
+commit 1ee50193f3f31e8491580b3801e063c6f16f0589
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Sep 2 22:58:05 2001 +0000
+
+    Don't use the ERRORMSG() macro in DirectFBCreate() to bail out in case of
+    dfb_config == NULL because ERRORMSG() uses dfb_config->quiet.
+
+commit ea292ae71cf8d11c9454b077cc5942a802ead56c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 30 07:28:17 2001 +0000
+
+    Added the field "video_memory" to "DFBCardCapabilities" which specifies
+    the amount of video memory in bytes.
+
+commit c076231bbb1960fdfc2b88bf60da307883b28658
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 30 07:19:57 2001 +0000
+
+    It's now possible to move the window under the cursor by holding down CapsLock.
+    Should this be optional as it renders the key useless for windowed apps?
+
+commit 7f2ac96c070eea077fc1384d5a8d2f99a645bda7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 30 06:54:12 2001 +0000
+
+    Check for "card != NULL" and "vt != NULL" in emergency shutdown
+    which can happen before these are initialized.
+
+commit 11e07d411df2cccd7e3e064ff5f6cfbe8525f60c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 27 14:48:27 2001 +0000
+
+    Added more keycodes to make the demos useable with remote controls.
+
+commit 8b8853a73d1e86c718e648f441c513c1872be067
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 27 03:04:31 2001 +0000
+
+    fill all 32 bit of FCOL
+
+commit bbfd5d4917fdbb7209ee8821c7f9bd7977212a57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 23 20:48:57 2001 +0000
+
+    Reverted last patch that disabled deinit/init during suspend/resume.
+
+commit 2f5a3381a4180a8291125c367b5479a296e4dc5b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 21 02:37:15 2001 +0000
+
+    Release destination surface in destruct method if still playing.
+
+commit ab394940984a2fc63c140633940535f3dde42f4e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 20 19:28:56 2001 +0000
+
+    dont deinit/init input drivers during suspend/resume
+
+commit 5c7b5fc3e0d1df1f9d47568934e547d2b9dfd7ca
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Aug 20 16:06:45 2001 +0000
+
+    Added DFDESC_WIDTH and the appropriate field in the description to
+    specify font widths differing from the height, e.g. for non-square pixels.
+
+commit 1f914f019fcb6fb927ebfbdeb06ab20fe26e4b72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 17 10:09:03 2001 +0000
+
+    detach from reactor AFTER 'window_remove()' so we get the DWET_CLOSE event
+
+commit 91eed47ac807b3452ef9cb226a215c2748923ba9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Aug 17 05:22:53 2001 +0000
+
+    In 'core_deinit_emergency()', e.g. when a signal is caught, try to prohibit
+    graphics hardware access by doing a 'gfxcard_sync()' and a
+    'pthread_mutex_trylock()' on 'card->lock' up to 100 times,
+    this may fail if the current thread locked it itself.
+    
+    Fixes corruption of X when moving the mouse cursor during a crash.
+
+commit 2d28f191cac6383d9808772d955e37cd3bf91e40
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 16 21:32:46 2001 +0000
+
+    When blitting with blending don't read the destination and don't add it
+    to the source if DSBF_ZERO is set as the destination blend function.
+    Some comments added in gAcquire for better getting-into-the-code-again :)
+
+commit 546bc9325eed0acd700e01cf37189d424d1e7706
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 16 00:13:01 2001 +0000
+
+    The transparent color index did not always refer to a unique color in the
+    color table, i.e. it's just the index that makes the pixels transparent.
+    Current version uses an artificial colorkey and preserves non-transparent
+    pixels from being the same color as the key, at least for RGB565.
+    Not the best solution yet though.
+
+commit 02129a00c81c5c7a9ad77c5e6f7cd798a8cc9a39
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 12 01:20:51 2001 +0000
+
+    DFBFontDescription's field 'attributes' was not of type 'DFBFontAttributes'.
+
+commit b1553f22a6d230e44ac8e36c3c5c52e8c62f1d53
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 11 20:17:13 2001 +0000
+
+    release font in deinitialization
+
+commit 425951eac14b106528f29ebc7985ec913bd7882b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 11 17:30:22 2001 +0000
+
+    Fixed segfault in 'fonts_destruct()' that occurs if no glyph
+    has been loaded at all (check for font->glyph_infos != NULL).
+    
+    Added unlocking and font releasing to destruct functions of
+    Window and Layer implementation of IDirectFBSurface, too.
+
+commit 3a53e4c3af5c570751dfcd3cd21e9c729ee28c2e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 11 02:10:25 2001 +0000
+
+    Added cleanup handler that stops capturing.
+    This handler gets called by core_deinit() and core_deinit_emergency().
+    The only way to keep it capturing is to kill it with signal 9
+    or disable signal handling.
+
+commit 8b09ee41f9079c9fc6f0acf9cc8a7ed0cf4683aa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 11 01:53:39 2001 +0000
+
+    sig_remove_handlers was an implicit declaration, added it to the header
+
+commit 94dd477280aebc815801c627ea6c875adb7d4650
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Aug 11 01:45:00 2001 +0000
+
+    remove signal handlers in deinitialization, fixes the following bug message:
+    
+    (!) --->  CAUGHT SIGNAL 2  <---
+     (!?!)  *** BUG ALERT [vt_close() multiple times] *** vt.c (77)
+
+commit c737e3042372ff952de9ffd6a5e9329063d6dea0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Aug 9 23:00:31 2001 +0000
+
+    Added 'IDirectFBImageProvider->GetImageDescription' which fills out
+    a 'DFBImageDescription', it contains a 'DFBImageCapabilities' field
+    with the flags 'DICAPS_ALPHACHANNEL' and 'DICAPS_COLORKEY' for now.
+    Additionally the Image Description contains the colorkey if
+    DICAPS_COLORKEY is set, e.g. when loading a transparent GIF.
+    
+    The GIF loader no longer generates an alphachannel from the colorkey,
+    because it turned the transparent color into black.
+    
+    If you want to have transparent GIFs,
+    use colorkeying which is way faster anyway.
+    
+    
+    TODO: Turn 'IDirectFBSurface->SetSrcColorKey()' into a pixelformat
+    independent function that is called on the source for keyed blitting
+    to a destination, currently the colorkey of the source is set at the
+    destination in the source's pixelformat.
+
+commit 14ffa404c40dde53507fb97fa8e02885cfa462dc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Aug 7 23:44:22 2001 +0000
+
+    - Major cleanup.
+    - Blending state fixes.
+
+commit 9534b0ea6a489b775fce0356e17332852b088423
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Aug 6 22:54:41 2001 +0000
+
+    added more info to the header file (and thus to the generated documentation)
+
+commit 2fe2320b4b974b2daea7cae4176941299990be2c
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Aug 6 11:58:34 2001 +0000
+
+    compile fix for mips, alpha and sparc architectures. SIGUNUSED is not
+    defined in asm/signal.h on these platforms.
+
+commit 969b9ff8664c6cebf72d3e51050fa569b85f2089
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 5 19:37:50 2001 +0000
+
+    Added character keys, only keys not in the list are F1 - F12,
+    should we add them, too?
+
+commit 192d32350e2b572a3ddc0b76679518852b4dbdfd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Aug 5 19:29:45 2001 +0000
+
+    Added fiorst version of a LIRC input driver.
+    
+    Simply name your keys (in the lirc config file) like the DirectFB keycode
+    enum does without the "DIKC_" prefix, e.g. "OK", "MENU" or "VOLUMEUP".
+
+commit e1095b423a9472206fa73feaab6dc4fc4c254a24
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Aug 1 18:39:36 2001 +0000
+
+    use surface width instead of pitch for texture width
+
+commit 2dad9c30386deb9100587b351747d9aa6cfd98c5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue Jul 31 16:24:44 2001 +0000
+
+    fixed small render bug in StretchBlit()
+
+commit ba8311a3fa9f80b24919f36a89097c65fdb597f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jul 28 19:28:22 2001 +0000
+
+    handle case where $target is not set at all (tested for "NONE" before)
+
+commit b621310ea7f1608cf14193dca61be7cba3f6da7d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jul 28 07:03:20 2001 +0000
+
+    Memory debugging is thread safe now.
+    Instead of exitting send SIGTRAP to ourself, when inconsistency is detected.
+
+commit ef06f19f99af36abc736e17655f70f849693d888
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 26 02:52:02 2001 +0000
+
+    New memory allocation debugging code that prints out a list of unfreed
+    areas with function name it was allocated in, file and line number.
+    
+    Deinitialization code cleaned up and reactivated.
+    
+    Much code cleanup (file internal functions made static and moved to the bottom).
+
+commit 898e8fa23246d8891334e2a15d0c4aaac86adc49
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 25 20:22:22 2001 +0000
+
+    If debug mode is enabled all 'malloc()', 'calloc()', 'realloc()' cause a
+    debug message with size, function name, file, and line number.
+    Replaced some 'malloc()'/'free()' pairs by 'alloca()'.
+    
+    After DirectFBInit/DirectFBCreate about 1500 bytes where allocated ;-)
+    Rest of the initial memory size relies to libc/libdl/libpthread.
+
+commit d0392b408b891e5bc4340291720e69cd6ef11561
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 25 16:36:20 2001 +0000
+
+    Return DFB_INVARG if text is NULL in DrawString.
+    Unlock the surface in IDirectFBSurface_Destruct if it's locked.
+
+commit cfbf118eeb964631b591831e0691815d54670e35
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 24 16:29:22 2001 +0000
+
+    Unified types used for key_ascii and key_unicode.
+    Please note that no inputdriver sets the unicode field at the moment.
+
+commit 1c923825655b18362fcf95d8ef6490613fbd8a80
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 24 14:43:15 2001 +0000
+
+    Added internal surface locking flag CSLF_FORCE,
+    that forces 'surface_hard_lock()' to try a video instance.
+    'gfxcard_state_acquire()' uses the flag for the destination surface
+    if the graphics operation is blitting.
+
+commit d2a79e5d877f79796c89005fa793922458b26f84
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jul 23 20:48:05 2001 +0000
+
+    bugfix: removed free()s after provider->Release() is called. This fixes segmentation fault when using a background image.
+
+commit 44d56b3306d5a9fbec4c353a6a53f941ceb19a0f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 23 18:03:37 2001 +0000
+
+    The pitch for system memory surface buffers
+    is now aligned to a multpiple of 4 bytes.
+    
+    Do not set SCHED_RR for input threads, use normal scheduling
+    now, highest priority there is ok.
+
+commit c36a7ea73f83c60fa43b1e20914318ce0b6d4768
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon Jul 23 15:20:53 2001 +0000
+
+    rewrote gamma initialization code, should work in all depths now.
+
+commit ce7b71c7a1277f439b526d0c9e0a4d84ae13e394
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 22 04:45:39 2001 +0000
+
+    New input event field "timestamp" which can be set by the driver.
+    I also added the flag "DIEF_TIMESTAMP", PS2 driver makes already usage of it.
+    I reenabled setting high priority for input threads.
+
+commit d44e1ba68359182e2ac93863172cd938894dfe89
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jul 21 04:34:18 2001 +0000
+
+    renamed global variable "display" to "fbdev"
+
+commit c59ece931784915e04b19fd2be33e9df8dd47d95
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 19 22:55:10 2001 +0000
+
+    ignore file
+
+commit 75229ecb8087977cd3a5316318586cd849825942
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 19 22:54:46 2001 +0000
+
+    First version of nVidia RIVA TNT/TNT2/GeForce driver.
+    Accelerates FillRectangle, DrawRectangle, DrawLine, FillTriangle
+    without blending, no blitting support at all.
+    
+    Tested on GeForce 256 SDRAM doing 830 MPixels/sec in FillRectangle.
+
+commit 51f1a71e6c56164d3bb043643e2c65d340aee1ed
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jul 19 12:09:46 2001 +0000
+
+    adapted Makefile to file changes
+
+commit 94ffbafe4671aeca7d1175900a31e181350b30c5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jul 18 17:22:49 2001 +0000
+
+    ok, i will compress it...
+
+commit baa50356ed313c3c47802fb1934ffcbd98a6ed50
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jul 18 17:10:32 2001 +0000
+
+    made a new aty128fb patch based on the driver in benh's tree
+
+commit 485435620c7a85781692c07db628840ac547a00f
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed Jul 18 13:19:01 2001 +0000
+
+    initialize palette/gamma during initialization. this fixes the
+    "strage-color-effect" in ati framebuffer drivers without the patch in
+    DirectFB/patches. A new patch that fixes only the remaining problems is
+    underway.
+
+commit d9e2b3c8f3a25b6eb436d6a1a8b4eb8e8b8aa0da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 18 12:18:11 2001 +0000
+
+    fixed typos
+
+commit d891d4b61527aa5251b3d5a89c9a1bd7115efdaf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 17 12:15:19 2001 +0000
+
+    only check source format if source exists
+
+commit 3f752c4886bbfa54c8f0a3a639434c43c7d4fc0f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 17 12:06:17 2001 +0000
+
+    check source and destination format in CheckState,
+    hopefully rejecting surfaces with width < 8 or height < 8 now.
+
+commit 0d9469a007457a87909508518ab8400bf4e0b8af
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 22:45:59 2001 +0000
+
+    use INTERFACE_GET_DATA macro (reduced codesize by 182 lines / 0.5%)
+
+commit 1bf83db24ce8da9b14a05f8151212796495785d6
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 22:01:13 2001 +0000
+
+    (IDirectFB[InputBuffer|Window]->WaitForEventWithTimeout)
+    Try to lock the events_mutex and check if there are events. If no events
+    are pending, get current time before locking the mutex. This way the time
+    it takes to aquire the mutex is taken into account for the timeout.
+
+commit 85c098928095b67fd985dbc55c31584dd69b2939
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 18:49:34 2001 +0000
+
+    Added IDirectFB->CreateInputBuffer() that allows to easily create input
+    buffers for specific events.
+    
+    Use the new function in a number of demos.
+    
+    Bumped version number to 0.9.5.
+
+commit 36d3c50cafd57f00f38fd561a16f63fcacfd646a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 17:20:17 2001 +0000
+
+    Added some more keys (ESC, Q, BACK, STOP) that quit the demos to make them
+    useable with remote controls.
+
+commit cecc4c565d282665493a7ac3043505230b7e29a1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 16:21:03 2001 +0000
+
+    Attach all inputdevices to the window stack, not only those of type
+    DIDTF_KEYBOARD and DIDTF_MOUSE. Let's see if this is a good idea...
+
+commit d37196de009795cc9dc69e8b4c84eeed536d0229
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 16 15:41:11 2001 +0000
+
+    do not sort struct entries alphabetically, keep them in the original order
+
+commit 3cbb42db9822b59540c8bdc8bfbf59ef69824b78
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 15 00:22:01 2001 +0000
+
+    Forced CCF_CLIPPING to 0x00000001, was 0 before (first enum value).
+    No hardware clipping has been used while this bug existed.
+
+commit 02d55298b58830428596d924dfb7f20c28e28f77
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 13 13:51:58 2001 +0000
+
+    define SI_KERNEL for glibc 2.1.x
+
+commit 77ca011935795ed5c1cd6df853220a7b4ab57546
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 11 18:45:34 2001 +0000
+
+    Fixed a bug in 'primaryFlipBuffers()' that caused windowstack updates
+    that are done on the whole windowstack not to get visible when buffer mode
+    is DLBM_BACKSYSTEM. (e.g. df_window with software driver)
+
+commit e886636e11f4eeecaea1c84fa7cae07a77892bff
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 10 23:07:33 2001 +0000
+
+    If a mode has been set by 'fbdev_set_mode()' and the detected
+    pixelformat is DSPF_RGB15, set mode->bpp to 15.
+    If mode->bpp would be 16 bit, we won't find the mode afterwards,
+    because we will search for a 15 bit mode if the current pixelformat
+    is DSPF_RGB15.
+    
+    Fixes bogus "Setting primary layer buffer mode failed!" problems.
+
+commit b00b341aa7c49a2199db2fd19a4275bd6bb91e4f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jul 10 01:05:23 2001 +0000
+
+    Added 'IDirectFBInputDevice->AttachInputBuffer()'.
+    You are now able to receive events from multiple
+    input devices with one buffer, nice with 'WaitForEvent()'.
+    
+    CAUTION: Releasing an IDirectFBInputBuffer does only detach
+    from the device it was created from, following input events
+    will cause a crash! Will be fixed soon.
+
+commit 417cb92fa8074bf332ba46b94b481df111803b26
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 8 13:47:54 2001 +0000
+
+    Call 'surface_flip_buffers()' after panning instead of before.
+    Do a 'gfxcard_sync()' before FBIO_WAITFORVSYNC, actually a hack to
+    reduce the time between vertical retrace interrupt and pan, as panning
+    does a 'gfxcard_sync()', too.
+    
+    Updated all patches for 2.4.6, made usage of new kernel macros like
+    'interruptible_sleep_on()' in Matrox patch.
+
+commit d6b1afe8b9d57e9da08cf25588db38c366c1dccc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 8 09:00:17 2001 +0000
+
+    Renamed LIBDIR to MODULEDIR and exported it in the pkgconfig file.
+    This is the base directory for installed modules
+    ("$exec_prefix/lib/directfb"). When installing a graphics driver
+    "/gfxdrivers" has to be added to that directory.
+    
+    To query: "pkg-config --variable=moduledir directfb-internal"
+
+commit 45e38fbaf1ca9fb9cf8ff279b09ab3a534bedce7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 8 07:35:35 2001 +0000
+
+    Internal headers (all except "directfb.h") are now installed to
+    "$prefix/include/directfb-internal". Files from "include", that
+    are "directfb_internals.h" and "directfb-version.h", will be
+    installed directly into this directory along with "idirectfb.h"
+    from "src". Other headers from "src" will be in the same
+    subdirectory as in the "src" tree. This way the '#include's
+    are the same whether a module is built within or outside of
+    the DirectFB source tree. First step to make it easier to write
+    third party DirectFB modules in a seperate package.
+    
+    There is a new pkgconfig file "directfb-internal.pc" which will
+    tell the third party configure script where the internal headers
+    are installed to. It will output "$prefix/include/directfb-internal"
+    when pkgconfig is called with "--cflags".
+    
+    Next thing to do is version checking on modules, because it probably
+    will crash when using a module compiled with 0.9.4 is used with 0.9.5.
+
+commit 01b9532b20ee74b9ee5d0c27a04ff3718cffc6b6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jul 6 16:13:52 2001 +0000
+
+    Added summary of changes between 0.9.3 and 0.9.4 to NEWS.
+    Generated ChangeLog, maybe Mitch can generate the better one with LDAP support.
+
+commit 5ece734794984b4f18935a7b89f32d80c7760e06
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jul 5 13:19:26 2001 +0000
+
+    Removed 'Dop' as it was always set to 'Aop', besides the two filenames above
+    all functions are called '... to_Aop()' now. Also made 'RUN_PIPELINE()' do a
+    "do { (*funcs++)(); } while (*funcs);" instead of
+    "while (*funcs) { (*funcs++)(); }".
+    
+    These gave up to 70% boost for drawing solid lines and rectangles on a P3 800.
+
+commit e64d81b0e2ab4c9e3288088341bc822d07bffc53
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jul 4 10:20:04 2001 +0000
+
+    First entry in our TODO file ;)
+
+commit 319148093bd495684147b13a6c855b977aae636f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jul 3 12:11:52 2001 +0000
+
+    reordered Cursor interface declarations to get nicer documentation
+
+commit 819547dc440f6826bbfda831a7de842e3ec983dd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jul 2 19:37:22 2001 +0000
+
+    implemented Sop_a8_set_alphapixel_Dop_a8 (untested)
+
+commit a6c6357332b89f2c636e97319d370f24b1ee70d6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 16:07:48 2001 +0000
+
+    Do not return 'DFB_INVARG' in 'SetBackgroundMode()' on success,
+    could irritate someone ;)
+
+commit 1fdfde638e9ee9d5f6bb3e1c27c0d119004714c1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 12:04:45 2001 +0000
+
+    compile, compile
+
+commit 496729959159bad4eba35dc872e2cbd69b1a75ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 11:59:45 2001 +0000
+
+    compile with recent changes to sub surface handling
+
+commit b8c816912e09ed13b5000544f9fb4b3a5b91a896
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 11:25:37 2001 +0000
+
+    killed one obsolete parameter and 4 FIXMEs regarding proper setting of it ;)
+
+commit faa4ae0454fadf496833d8ec301ac25bce134657
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 11:12:06 2001 +0000
+
+    initial support for axis motion events with absolute values
+
+commit f9593f5285bd02a3d5746e0d2f3124b4aa1ef4fa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 08:38:34 2001 +0000
+
+    Fixed a very bad bug, don't use 'realloc()' on structures containing data you
+    already installed listeners for with a pointer to it as the context ;-)
+    Interface constructors no longer use 'realloc()' for 'thiz->priv' to store their
+    extra data, they do the (bigger) 'malloc()' themselves before calling the parent
+    constructor. Each interface constructor should check for 'thiz->priv == NULL',
+    if this is the case they should do the 'malloc()' and then call the parent
+    constructor if one exists.
+    This fixes nearly every possible bug, because listener functions wrote into
+    memory where there shouldn't.
+    
+    New result code 'DFB_INVAREA' that is returned if a surface has no valid area
+    or a region or rectangle specified does not match, e.g. SetClip returns it if
+    the clipping region specified does not intersect with the current (sub) area.
+    It is also returned by the drawing and blitting functions if the source or the
+    destination has a current (sub) area of size 0x0. That can happen if the surface
+    is a sub surface, e.g. at x = 900 and y = 600, and the surface gets resized to
+    something below that.
+    
+    Enhanced sub surface handling, there are three rectangles along with an
+    IDirectFBSurface, these are "wanted", "granted" and "current". The first one is
+    the rectangle passed to 'GetSubSurface()', it doesn't matter if it's too large
+    or has negative starting coordinates as long as it intersects with the "granted"
+    rectangle of the parent. The "wanted" rectangle should be seen as the origin for
+    operations on that surface. Non sub surfaces have a "wanted" rectangle of
+    '{ 0, 0, width, height }'. The second one, "granted", is the intersection of the
+    "wanted" rectangle and the "granted" one of the parent. If they do not intersect
+    'DFB_INVAREA' is returned. For non sub surfaces its the same as the "wanted"
+    rectangle, because it's the rectangle describing the whole surface. The "wanted"
+    and "granted" are calculated just once at creation, the "current" rectangle is
+    the intersection of the "granted" rectangle and the surface extents.
+    'SetClip()' and many other functions are limited by that one.
+    This way sub surface area information is preserved during surface resizing, e.g.
+    when resizing a window. Calling 'SetClip()' with NULL causes the clipping region
+    to exactly cover the "current" rectangle, also the flag 'clip_set' is cleared
+    causing the clipping region to be set to the new "current" after resizing. If
+    'SetClip()' is called with a clipping region specified, an intersection is done
+    with the "wanted" rectangle that is then stored in 'clip_wanted' and 'clip_set'
+    is set. However, if there is no intersection 'DFB_INVARG' is returned, otherwise
+    another intersection is made with the "current" rectangle and gets applied to
+    the surface's state. Each resize, after the "current" rectangle is updated, the
+    clipping region is set to NULL or 'clip_wanted' depending on 'clip_set'.
+    This way even clipping regions are restored or extended automatically.
+    It's now possible to create a fullscreen primary and call 'SetVideoMode()' with
+    different resolutions or pixelformats several times without the need for
+    "updating" the primary surface by recreating it ;)
+    
+    So '->req_rect' is now replaced by '->area.wanted'
+    and '->clip_rect' is replaced by '->area.current' for the most cases.
+    
+    'IDirectFBSurface->Lock()' now adds the "current" rectangle's offset to the base
+    address, so applications should use 'GetVisibleRectangle()' before writing into a
+    locked sub surface to get the offset from the "wanted" rectangle and the limits.
+    If there is no "current" rectangle 'DFB_INVAREA' is returned.
+    
+    Added 'region_rectangle_intersect()' and did some minor optimizations.
+
+commit b8c69347c91bf7cfa8d0283cc1d05e7967419c07
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jul 2 02:24:43 2001 +0000
+
+    SetVideoMode keeps current buffer mode, this prevents an already created
+    flipping primary surface from turning into a non flipping one.
+    
+    Fixed 'primarySetConfiguration()' and 'primaryTestConfiguration()' for
+    15 bit modes, they were broken since layer API changes last week.
+    
+    If 'fbdev_set_mode()' no longer overwrites the primary layer's surface
+    format with DSPF_UNKNOWN in case of an error in 'fbdev_get_pixelformat()'.
+    It also restores the video mode before returning DFB_UNSUPPORTED.
+
+commit 8c89046df179d49ae3c0d38c79f2ac8c124ca93d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 1 23:31:04 2001 +0000
+
+    Added macro 'CAUTION' to "coredefs.h" that should be used when unimplemented
+    features or unsolved problems have a serious impact on further execution,
+    e.g. crashes or wrong behaviour.
+    
+    Added surface resize handling code in 'IDirectFBSurface_listener'.
+    If the surface is a sub surface it's area will become the intersection
+    of the old area and the new surface extents. Prints caution message if
+    there is no intersection or the clipping rectangle is out of bounds.
+    
+    Disabled code in 'IDirectFBWindow->Resize()' that is unneeded now, because
+    surface resizing is now handled in 'IDirectFBSurface_listener'.
+    
+    Removed 'memcmp()' in 'IDirectFBSurface->SetClip()', it's always marked as
+    modified now, I hope some benchmarking will show which way is the best,
+    but this mostly depends on how often 'SetClip()' is called with the same clip.
+    
+    Fixed typo or braino in listener attached by 'state_set_destination()'.
+    
+    Changes above not fully tested, will test GDK backend soon.
+
+commit c58427eca124b2d9715b97ab81a2f3b0ffd4fec9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 1 20:21:32 2001 +0000
+
+    VT switching by pressing Ctrl+Alt+<F?> is now disabled by default, because
+    it makes debugging impossible with only one machine (you cannot switch back to
+    the console where you started gdb until you kill the program). The code is
+    very experimental and sometimes it hangs during 'input_resume()'.
+    
+    Added option "--[no-]vt-switching" and wrote a better description for the
+    similar looking option "--no-vt-switch", maybe we should rename that old one.
+
+commit a0b6b844a7aeb667ef3fc61884f2d8ddfee602d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jul 1 20:08:01 2001 +0000
+
+    made the "nearly black" color (#020404) "nearly black" for RGB555 (#020804)
+
+commit cf8a8ff426194ada9997c0da9595ecd56d65cd57
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 30 14:05:21 2001 +0000
+
+    Added internal macro 'INTERFACE_GET_DATA(i)' which checks the 'thiz' pointer,
+    declares 'i_data *data', checks 'thiz->data' and writes it into 'data'.
+    About 200 code lines less now ;)
+    
+    Added result code 'DFB_THIZNULL' and 'DFB_IDNOTFOUND'
+    (returned by 'GetInputDevice' and 'GetDisplayLayer').
+    
+    Added 'DirectFBErrorString(result)' which returns a description string for
+    the result, internally used by 'DirectFBError(msg, result)'.
+    
+    Added some more argument checks.
+
+commit 7b2ec632463e731f0fb1a6938c46752ceb9e9135
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 30 11:11:22 2001 +0000
+
+    in CreateWindow: return DFB_INVARG if height == 0 or width == 0
+
+commit ae124c864c877e24c69a09b3f490a7b03f1e2444
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 28 21:19:59 2001 +0000
+
+    ooops, forgot to register the GetCapabilities method...
+
+commit 27fd9ff761c67a2b6d09c1e6c7493f891c97bab0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 28 10:58:54 2001 +0000
+
+    don't try to set opacity on unexistant cursor_window
+
+commit 33686cc5ac6c668c93ed5acfeaf3035dfd6284ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 28 00:50:49 2001 +0000
+
+    call window_repaint() on the cursor window in layer_cursor_load_default
+    (fixes the bug that the cursor is invisible after enable until it is moved
+    or the window stack gets repainted)
+    
+    do window_set_opacity() after window_init()
+
+commit 8ee31a44d44628a7b7e5fe778684ea70b4951474
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 28 00:01:16 2001 +0000
+
+    added option "--[no-]sync" that enables/disables a call to
+    "sync()" in "core_init()", default is no
+    
+    I will write a "sync" in my rc.
+
+commit b2f3fdb3eda23c91e2263385639cfb2c65ba0575
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 23:20:41 2001 +0000
+
+    sig.c:
+    - signal handler does a kill with the received signal instead of SIGHUP
+    
+    vt.c:
+    - if the signal source is not the kernel, call the previously installed
+      signal handler for that signal (does not seem to work for Kaffe)
+    - use other signals than SIGUSR1 and SIGUSR2 that does not collide with
+      Kaffe's garbage collector, a bit dirty (SIGUNUSED+10/11), but works
+
+commit 35130374ebf475226f5053749f11fdc9ff5df0dd
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 27 22:53:32 2001 +0000
+
+    removed a trailing comma from an enum
+
+commit e78b05ccb25a6802e11c12ce478ebb4bbf4b0535
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 20:22:38 2001 +0000
+
+    fixed description of SetSrcColorKey
+    added initial API support for streamed video providers
+
+commit 72a9fad67232b6c931863fc1d83f84140f4924ce
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 17:52:36 2001 +0000
+
+    also did the same mode checking fix for the current mode (e.g. with vesafb)
+
+commit 34ce15ba61661ade9d1a8e28c1a8f55b82607bc5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 27 17:49:32 2001 +0000
+
+    Renamed color to saturation in DFBColorAdjustment and friends.
+
+commit c0c575093b8a0d7b1c856f377d8ce9f316175a0f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 17:20:16 2001 +0000
+
+    flickering in windowstack fixed, got broken tonight
+
+commit 3543270c77bd3be3beac8f965dd078ec119b39e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 17:11:20 2001 +0000
+
+    fixed bug that caused an error "Could not set default mode!"
+    if the first entry in fb.modes doesn't have 15, 16, 24 or 32 bit
+
+commit 33aebdcfdf544f79283e399ab60a6f31c01cd54b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 17:09:59 2001 +0000
+
+    applied patch from Joachim "roh" Steiger that adds missing
+    pthread includes
+
+commit 5b8832fb67705900e1794dab7c68b728c3ff5a72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 13:59:28 2001 +0000
+
+    should be 0.9.4 after recent API changes
+
+commit 7870fa6a95b85007d073f2d75b880af02989217c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 27 13:58:30 2001 +0000
+
+    Changed Display Layer Configuration API:
+    - DFBDisplayLayerCapabilities extended now including color keying and other
+    - removed DFBDisplayLayerModeFlags, added DFBDisplayLayerOptions instead
+    - added IDirectFBDisplayLayer-> Get/Set/TestConfiguration that take the new
+      DFBDisplayLayerConfig for almost all settings like pixel resolution, pixel
+      format, DFBDisplayLayerOptions and more
+    - TestConfiguration takes an additional DFBDisplayLayerConfigFlags to
+      optionally write back the settings that failed
+    - removed GetSize, SetBufferMode and SetMode
+    - added SetColorKey and SetScreenLocation
+    
+    Followed API changes in IDirectFB, IDirectFBDislayLayer, IDirectFBSurface_Layer
+    and some demos.
+    Cleaned 'fbdev.c' (that handles the primary layer) to follow internal display
+    layer driver API changes.
+
+commit 5069d321c9844f4b4aedf41ea2164f72e6db8b93
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 27 13:32:39 2001 +0000
+
+    check return values of new ioctl calls
+
+commit 13d4b323c350647aeeaed5d13c2c22d2fd4277b2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 27 11:04:18 2001 +0000
+
+    Extended IDirectFBVideoProvider API:
+      IDirectFBVideoProvider->GetCapabilities()  retrieves info about the provider
+      IDirectFBVideoProvider->GetColorAdjustment()
+      IDirectFBVideoProvider->SetColorAdjustment()  get and set values to
+                                                    adjust the video colors
+    
+    The DFBColorAdjustment maps directly to the Video4Linux API. We might want
+    to change it to take floating point values instead of __u16 ?!
+    
+    Output useful error message if doc generator dies.
+
+commit 6eccc3037b17c3abef9a4e052c8ef87ed92efeae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 26 17:21:59 2001 +0000
+
+    don't catch SIGPOLL (a.k.a. SIGIO)
+
+commit 1e9d97eb27ac794ebab46d4ee19f38686d66a290
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 25 15:38:02 2001 +0000
+
+    Reenabled key events for windows (we lost them while adding support for
+    console switching).
+    
+    Changed cursor handling: Cursor can be enabled/disabled and opacity can
+    be set independently. Also cursor appears centered now.
+    
+    Process key events in df_window: Cursor keys move active window.
+
+commit 9c53a4df681b0b9bc915545f75dd3b17aa385a46
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun Jun 24 20:45:56 2001 +0000
+
+    fixed transparency problems for large palettes (transparent index > 127)
+
+commit a42cbd3754a5f66c1de06903815f2d5202b4a2c9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 23 13:05:28 2001 +0000
+
+    Added console switching support during runtime!!!
+    
+    Experimental but working... use Ctrl+Alt + (F1 - F12) ;)
+    Had to add much code to src/core/vt.c that does the
+    biggest part of the job (reentrant signal handler ;-)
+    Added VT_ACTIVATE code to the global keyboard handler
+    in src/directfb.c, which handled Ctrl+Alt+Backspace so far.
+    Also modified the keyboard driver, because vt switching
+    code in src/core/vt.c already had to open the target tty.
+    
+    Turn on debugging during configure if you have problems with
+    switching and mail the output to the developers list.
+    
+    
+    Other fixes and additions:
+    
+    Another 'mga_waitfifo()' call corrected (10 -> 12).
+    
+    Fixed bug in 'surfacemanager_suspend()' that broke some surfaces,
+    e.g. fonts. It did not assure a valid system memory instance.
+    It still does not care about video only surfaces.
+    
+    Fixed 'reactor_dispatch()', RS_REMOVE was not handled.
+    
+    Added RS_DROP that tells 'reactor_dispatch()' not to do
+    any further dispatching of the event.
+    
+    Do a 'kill (0, SIGHUP)' in signal handler instead of 'exit()',
+    after all our handlers are removed, of course ;-)
+
+commit c6f3478883d846d98258af0482e96f0dd4b27cc8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 23 03:49:56 2001 +0000
+
+    Require working frame buffer device, not only compiled in.
+    Fixed a typo.
+
+commit 76786fdf6920138dd7beb3f5a6e8fc399db6bbff
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 20:25:52 2001 +0000
+
+    fixed a bug in the fb switching code that made RGB32 modes fail
+
+commit 951d64bd3719130416bd4c9c35042330ff0e2573
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 19:34:31 2001 +0000
+
+    fixed another bug in copy_buffer_32().
+
+commit b2cf5f965541c9bf6ebb766ec54d6264bd128695
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 19:29:12 2001 +0000
+
+    Fixed a stupid bug in copy_buffer_32.
+    
+    The PNG provider ponly writes directly to destination surface if
+    format == ARGB, not if bpp == 4.
+    
+    The GIF provider did not take destination pitch into account.
+
+commit f05c548eb80586310e6ee637a7c14acac2bc62c2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 19:05:42 2001 +0000
+
+    optimzed copy_buffer_32()
+
+commit 940de8cf7309deb1d91982a3b3ae9f6d3cce0531
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 17:59:55 2001 +0000
+
+    Removed an unnecessary GetSurfaceDescription() call.
+
+commit a2678a2c719acf50820712b25c02bd787178304d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 22 17:44:17 2001 +0000
+
+    Added alpha transparency support to GIF ImageProvider.
+    
+    Fixed alpha handling in scale_linear_32 and copy_buffer_32:
+    If the destination format does not support alpha, blend the image data
+    over a black background since most images have undefined color values in
+    the transparent areas.
+
+commit ea2443e07ad2b9739c3c9d141b4d272c9ec1a333
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 22 03:41:58 2001 +0000
+
+    - df_dok accepts failing SetCooperativeLevel
+    - df_andi and df_dok both ask the primary surface about its size
+      and not the primary layer
+
+commit b3aa77c72a2f027213271802f65194e256a28ba8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 22 03:19:08 2001 +0000
+
+    Added option "force-windowed" which makes SetCooperativeLevel
+    return DFB_ACCESSDENIED for other levels than DFSCL_NORMAL.
+    
+    df_andi, df_particle and pss don't abort anymore
+    if setting the cooperative level fails.
+    
+    Check for 'argc <= 1' instead of 'argc == 1' in df_dok,
+    because 'main()' can be called with argc set to 0 ;-)
+    
+    Moved global variables of df_window into the main function,
+    removed layer enumeration that did not make any sense because
+    the IDirectFBDisplayLayer has only been constructed for the primary
+    layer, and that is DLID_PRIMARY just passed to GetDisplayLayer.
+
+commit c773af56feeddf8e9808ace558f685b75c1ce065
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 23:24:45 2001 +0000
+
+    initialize AVIFILE to "no"
+
+commit 862c863656bd5b90a94f6fb10ee896921bacae0f
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 21:17:08 2001 +0000
+
+    first check $target for system type, if $target == "NONE" check $host
+
+commit e2a5632383f428b8dc77568a170f37a73dc7a77b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 20:47:12 2001 +0000
+
+    hopefully fixed the alphachannel bug from gif loading
+    (internal buffer was not set to '0xFF000000 | color')
+
+commit dcc6bc2a46c0a5a977de7b7c9ccf79e36fa9d34d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 18:36:45 2001 +0000
+
+    Use mga_in32 in mga_waitfifo rather than mga_in8.
+    Added mga_waitfifo(1) in FlushTextureCache (I forgot).
+    Problems with G200@ARM are gone now.
+
+commit 560e4e7bb9d0d0015499782bc2401cc46467f8d8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 21 12:43:26 2001 +0000
+
+    forgot this one when changing the headers
+
+commit 90ae2c304a6b666ad1a212bf614bd89e62885786
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 21 12:39:02 2001 +0000
+
+    Great Header Cleanup (TM):
+    collected typedefs in core/coretypes.h
+    removed inclusion of headers from most headers
+
+commit 677c11632c6873a1020f6358a8f7fc267ab61463
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 09:02:05 2001 +0000
+
+    check for surfaces bigger than 2048x2048
+    apply mask 0x7fff to pitch before setting it
+
+commit a34eb374b5c0907e26a7382081783150e8e0a926
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 21 08:26:14 2001 +0000
+
+    DIFFUSEDALPHA for BLIT_NOFX was wrong, ALPHACTRL programmed to 1 for BLIT_NOFX
+
+commit 3c04c4996c112d4cd812797b1e3ba2f7d32b9cf8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 20 16:05:40 2001 +0000
+
+    fixed a braino and some compiler warnings
+
+commit e2a8d35c782de98af3329571f6af856676b062bf
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 20 14:50:04 2001 +0000
+
+    Removed -fexpensive-optimization from compiler flags since -O2 already
+    has this. Added -fomit-frame-pointer unless debugging is turned on.
+
+commit 3045ad9af272293736d6a8dab063e45f7e6ae4b9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 19 17:22:28 2001 +0000
+
+    optimized utf8_get_char() for the default case (7bit ASCII)
+
+commit b3750267da7369f195e37b46670a05e6c8a6cb97
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 19 17:02:08 2001 +0000
+
+    Reduced size of fast_keys array to 96 by skipping the first 32 entries
+    (not used for glyphs in 7bit ASCII).
+
+commit 1538be687788c27a7535a154f8836e45beecaa07
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 19 14:52:27 2001 +0000
+
+    fixed 'read_modes()' and 'fbdev_set_mode()' for mode testing,
+    'fbdev_get_pixelformat()' fails on some framebuffer drivers that
+    do not fill out fbdev_var_screeninfo in FB_ACTIVATE_TEST mode.
+
+commit 5dd672a897f3dddbc3664573ded896130609513e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 19 14:15:30 2001 +0000
+
+    don't process click events either (if cursor is disabled)
+
+commit b16fb855567a810b32c513275fcdd3fabe65a619
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 19 14:11:55 2001 +0000
+
+    do not process mouse events if cursor is invisible
+
+commit 8fd6e03fbbe7478080ec0f6eed95e0bc056755ed
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 18 17:24:45 2001 +0000
+
+    Install a KillHandler for AviPlay and delete the object on interface
+    destruction. Fixes the segfault in IDirectVideoProvider_AviFile_Destruct().
+
+commit 0af28fda5d9e606a163d10630de00ef4b6e2795b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 18 11:53:42 2001 +0000
+
+    forgot to remove debugging output
+
+commit 9ba126148e365a78185be4e7f0beb6d0fe25844f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 18 11:47:47 2001 +0000
+
+    Rewrote handling of CFLAGS and CXXFLAGS so we respect the values that have
+    been set before configure is run.
+
+commit 2eff15514a34b057a03b74c850456e9673719db5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 18 09:33:03 2001 +0000
+
+    Removed the utf8 optimizations (only call utf8_* funcs if c & 0x08) since
+    they give no measurable speed improvement (0.0 - 0.05 %)  and may cause
+    trouble for badly encoded strings.
+    
+    Do not insert values for fast keys into the binary tree. Free all values
+    in the fast_keys array on tree destruction.
+
+commit b7ccfbe2958c329ad0012dcccd46399bf0f43186
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 06:23:02 2001 +0000
+
+    Default font loader did not set 'data->surface'.
+    'gfxcard_draw_line()' is now 'gfxcard_draw_lines()'.
+    Added 'IDirectFBSurface->DrawLines()'.
+    df_dok uses 'DrawLines()' now for 10 lines each,
+    added 'myrand()' that speeds up the benchmarks a bit, too.
+
+commit 6893690eb092879f371dc7bfefdc60bf5c4a791e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 04:39:13 2001 +0000
+
+    Killed a modulo, a division, an array lookup and an 'if'
+    for each glyph in gfxcard_drawstring:
+    
+    CoreGlyphData->start now is the starting x coordinate within its surface.
+    Added CoreGlyphData->surface that holds the surface the glyph is in.
+    
+    Again, 395 -> 410 KChars/sec here.
+
+commit 12dda36baee042b0080d68e17fd439651aed1661
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 04:12:56 2001 +0000
+
+    Only call 'utf8_get(&c)' if 'c & 0x80'.
+    Added 128 "fast keys" to tree code,
+    it's an array of values for a faster lookup of keys 0 - 127.
+    
+    These two optimizations should increase DrawString performance on slow
+    machines (even on my Celeron 533 with Matrox G400: 374 -> 395 KChars/sec).
+
+commit 50a167da639ce7b48394fe620c16b735fb27abd7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 01:59:38 2001 +0000
+
+    Respective error message in DirectFBError for DFB_MISSINGIMAGE.
+    (did a commit on 'idirectfb.c' last time instead of 'directfb.c')
+
+commit c55b13d1631f6161b51b5289b638d714aee9521d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 01:56:41 2001 +0000
+
+    SetBackgroundMode returns DFB_MISSINGIMAGE if DLBM_IMAGE has been set
+    without a background image being set before.
+
+commit e35b6231ecd65f1a4628b596c7455e01f1c5827a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 18 01:17:42 2001 +0000
+
+    Do not use "-g" as default, add "-g3" to CXXFLAGS if in debug mode.
+    
+    Added new function GfxCard->FlushTextureCache: after the video memory
+    has been written to by the CPU (e.g. modification of a texture) make
+    sure the accelerator won't use cached texture data. This new function
+    is called each surface_unlock (we should check if it was a soft lock
+    to video memory).
+    
+    Implemented FlushTextureCache in Matrox driver, because font problems
+    are solved if any TEXORGn register is written to. Maybe this is just
+    a coincidence, but it works ;-)
+
+commit c5ac13e6d6a19d9f6af9f7fd197bd1e9722056da
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 16 17:13:28 2001 +0000
+
+    The long awaited killer feature: cursor movements are clipped by the desktop ;-)
+    
+    CoreWindowStack has a DFBRegion called "cursor_region",
+    so we can add things like window clipped cursor during grab easily.
+
+commit fa89e09909f3a361610ea7838700c7760c9d648b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 16 16:13:20 2001 +0000
+
+    Replaced all identifiers "id", for Objective C and maybe other languages.
+
+commit 6e59412338140ac131f81481c3457c0f2f34754c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 16 12:04:52 2001 +0000
+
+    Applied patch from Till Adam <till@adam-lilienthal.de> that adds
+    the IDirectFBWindow->WaitForEventWithTimeout that I forgot.
+
+commit ebd51ecfc61e4320b3b997413dc25bde07310fef
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Thu Jun 14 16:37:29 2001 +0000
+
+    Updated ChangeLog.
+
+commit f7c1e47573839d87e2323850ff1d44c64f9743ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 14 15:19:13 2001 +0000
+
+    updated
+
+commit b071df21d878fe90b681687bbebc640b2c01df61
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu Jun 14 01:40:09 2001 +0000
+
+    compile fix for big endian machines
+
+commit 2bd4ca80e54da14c984a0086c2ced8d432eec5ef
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Wed Jun 13 20:20:45 2001 +0000
+
+    Re-enabled and fixed two lines which close/reopen the input devices
+    on Suspend()/Resume().
+
+commit 844040693e3e7ff61838b607a2f8e3d13abe1703
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 13 15:26:05 2001 +0000
+
+    Added DIDID_REMOTE to the list of predefined device IDs.
+    Uniquify device IDs.
+
+commit 6e32909bbbe09eee2dcdd046ee6c80e97951b9b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 13 06:13:13 2001 +0000
+
+    - log2 had to return ret, always
+    - optimized TMU calculations, better rounding, looks always good now
+
+commit d5b31da1f6fa5f668e92274e2458a20d24a30b9f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 21:11:12 2001 +0000
+
+    include Video4Linux video provider in the configure result list
+
+commit d4ef28d42f2a5d249d0accc57725aff3dab02bc8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 21:01:46 2001 +0000
+
+    call v4l_stop() in v4l_deinit() to eventually stop the v4l thread
+
+commit 4dbcad078491aca3b5c1830009e957d3046e12d5
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 20:50:54 2001 +0000
+
+    use correct variables for configure result list
+
+commit b343ec672908f10f03523d688a22876f41c47c36
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 20:45:25 2001 +0000
+
+    describe how to configure a serial mouse for DirectFB
+
+commit 1c3da755c9df6138d39b839624b142dfd91a5558
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 20:44:29 2001 +0000
+
+    use $JPEG and $PNG
+
+commit b4383667156b0817aaf98a897ebfe6d5d2dd648c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 20:29:09 2001 +0000
+
+    do not print "on" for MMX support
+
+commit 6f6fc3ebdc19c9eae186b2acbd6acf6a07754e21
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 20:18:12 2001 +0000
+
+    Prints summary of build options and built providers/drivers.
+
+commit 4ac659a8731db4acd73d0f381ad41bddee3464fd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 18:24:30 2001 +0000
+
+    added Joachim Steiger to "thanks to"
+
+commit 16ca71f02595ef04846686242a7d102f5b527337
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 18:11:24 2001 +0000
+
+    Check for <linux/fb.h>
+    Check which gfxdrivers can be compiled by looking at <linux/fb.h>.
+
+commit 612e94f83f7dc646f4a4615f081c0a7ae4c22c99
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 18:00:57 2001 +0000
+
+    fixed typo added note about conditional build of providers
+
+commit 92e1d7a4b7f7742b88f7a8dd0d7f980a940c7c18
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 12 17:58:30 2001 +0000
+
+    updated
+
+commit d027700f2e6887e60aea0525aba1d7c5c01f0d3a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 17:24:38 2001 +0000
+
+    update
+
+commit 44935954080ff76ce61ef5365280350e71543ac3
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 17:23:57 2001 +0000
+
+    Even more remote control keycodes.
+    
+    Allow conditional build of gif, jpeg and png image providers.
+    Allow conditional build of freetype font provider.
+    We strongly suggest you don't disable the build of these modules
+    since the example code and most DirectFB apps depend on them.
+
+commit 804ff88aace436b082f76adaf0ed87c466a81a63
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 14:40:36 2001 +0000
+
+    added a few more remote control keycodes we might need
+
+commit bada3147708b91cf65eafed4e6fbebf6965d272d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 13:05:05 2001 +0000
+
+    Added tree_lock() and tree_unlock() to allow to use the tree in a thread-safe
+    way. fonts_get_glyph_data() locks and unlocks the tree so it can be called
+    from multiple threads. Unfortunately this brings down performance a little.
+
+commit 0f11fcb5a03c38bbbcac50a06e9701741302d99b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 12 11:17:08 2001 +0000
+
+    include <sys/time.h> and <sys/types.h> for select()
+
+commit 4611043d3dbb3d9856b829aa25a696529e7f13d0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 11 20:53:51 2001 +0000
+
+    fixed license, oops
+
+commit 8ce42ae9b3ecd033ae0824bade3f9990c78df243
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 11 18:36:01 2001 +0000
+
+    The old implementation of the MouseMan protocol definitely did not
+    work, this one might do the trick...
+
+commit 1119186846261558439ac128e37bb516b3b657a9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 11 18:17:26 2001 +0000
+
+    Replaced old remote control keycodes with new unified keycodes.
+    Removed special handling for remote control from keyboard driver.
+    Decreased wait cycles in initialization of serial mouse driver.
+
+commit 219e158ae0327cc934943f1593339e5f95f8a03b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 11 15:43:45 2001 +0000
+
+    split up window_create and added window_init that has to be called after
+    window_create. i split it up because the code in window_init generates
+    events, but the reactor can only be attached to after window_create.
+    this fixes the missing initial DWET_POSITION_SIZE event.
+
+commit a7ec1bfd860672f6e79805c43e31d98c38d5d90c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Jun 11 10:26:57 2001 +0000
+
+    Fixed a bug in window_request_focus() where the wrong window was emitting
+    the DWET_LOSTFOCUS event.
+    
+    Rewrote large parts of df_window to make it behave more like a windowing
+    system as you know it. You can specify a video file on the command line
+    to bring some live into the second window.
+
+commit e32b87b009dd92d79f01e0c2576d159d145de60c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 11 02:59:28 2001 +0000
+
+    ifdef for FB_ACCEL_MATROX_MGAG400
+
+commit 71f2c71ad59c40a766ba0eb0b2adb2f3b8856a34
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 11 02:57:42 2001 +0000
+
+    Removed signal handler for SIGSTKFLT as it is
+    not available on all architectures.
+
+commit b99b06f353ce516a1c28f0994e90f81f81e2dbba
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Jun 10 21:25:07 2001 +0000
+
+    Added "Thanks to" section
+
+commit 2ee12cf2ea20d4f342a8f689c56d85496c6c1e79
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 9 15:18:01 2001 +0000
+
+    Finished update_region for windowstack repaints.
+    Nothing will be drawn that is not visible after all.
+    Every further windowstack optimizations have to be made in other
+    functions like window_move (blitting within same surface, actually
+    from front to back buffer, but that is default ;-)
+    
+    Fixed segfault in surface_destroy (many demos crashed at the end),
+    df_porter did not run at all, because surface_destroy was called from
+    font managering system.
+
+commit 6646ac4952f601e071c06df8d8e1c7a9888f7514
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 9 15:03:39 2001 +0000
+
+    added ltconfig
+    
+    any volunteer to fix DirectFB for the new autotools?
+
+commit 3754a1f839118a178d0bb831817618fab7619155
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Jun 9 15:03:01 2001 +0000
+
+    df_fire: use DirectFBSetOption to force a systemonly surface for the fire
+    window (actually for all windows) instead of implicitly forcing it by
+    setting the desktop buffer mode to backsystem.
+    
+    IDirectFBWindow: detach from reactor before destroying the window,
+    return RS_REMOVE when DWET_CLOSE is received in reaction function.
+
+commit 11dc1a2144b40fb9462111cc5e76ec2f7ff1203e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 23:31:33 2001 +0000
+
+    rewrote windowstack_repaint, no performance gain yet, but this recursive
+    function is designed to just pass the rectangles that are not covered by
+    the opaque window of the iteration level (make update_region calls in all
+    16 different cases).
+
+commit 91ddd5217f3b77e39294c29029f7db3c409582e0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 22:32:44 2001 +0000
+
+    Applied patch submitted by Till Adam <till@adam-lilienthal.de>
+    with a check if DirectFBSetOption has been called before DirectFBCreate.
+    Also added function to directfb.h.
+
+commit 82579928a661c8e3f55750666233c35e93458f34
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 18:44:03 2001 +0000
+
+    Added IDirectFBInputBuffer->WaitForEventWithTimeout (secs, nano_secs).
+
+commit a75dca5d1f117bdf9b049c0317d80e912b2503db
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 8 15:48:59 2001 +0000
+
+    fixed(?) handling of middle mouse button for MS3 protocol
+
+commit 8b9b12a782fd39a8b9f5d79bf6ec6086d4fa683b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 8 13:37:17 2001 +0000
+
+    We now support the following serial mice:
+    
+      "MS"		   two buttons MS protocol
+      "MS3"		   MS with ugly 3-button extension
+      "MouseMan"       referred to as MS + Logitech extension in mouse(4)
+      "MouseSystems"   most commonly used serial mouse protocol nowadays
+    
+    All this is highly experimental and needs more testing.
+
+commit 07865ab2ca1ed2ff077b72452b36ef3cb85ed872
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 8 12:06:12 2001 +0000
+
+    Small code cleanup in ps2mouse inputdriver.
+    
+    Added support for MS 3 button mouse protocol (this protocol sucks!) to the
+    serial mouse inputdriver. Put "mouse-protocol=ms3" into your directfbrc.
+
+commit 7ea9ae0a997fc02dbe659f72d668116a109761b4
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 11:30:59 2001 +0000
+
+    typo fixed
+
+commit 64935e4ab98b69286d61dc4e6d4f2d6d610d8446
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 08:50:45 2001 +0000
+
+    Print init type message if an interface implementation is loaded.
+
+commit 2886fcb4156270979f34614649b5d4dd3f9fcf24
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Jun 8 08:28:37 2001 +0000
+
+    moved window event buffer into interface using pthread conditions
+    windowing events are dispatched through reactors now
+    (~100 lines stripped from core ;-)
+
+commit 7531cc785696a90b3d11a8389d547097ce7bcfae
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 7 21:46:07 2001 +0000
+
+    use pthread conditions
+
+commit 62922355a116185bcf529d2c62f1a2f032d0a1f9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 7 20:39:19 2001 +0000
+
+    fixed bug when blitting from 32bit without blending,
+    e.g. --blit-convert in df_dok
+
+commit 4b0433ba742f89d8977fea9ec439771d3387d0fd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 7 20:06:20 2001 +0000
+
+    follow changes
+
+commit 127efd7d2210cc4f909c8785c4f1769cd877e9f6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 7 20:04:19 2001 +0000
+
+    API Change: The Input Device ID no longer contains the type of input device.
+    
+    Added DFBInputDeviceTypeFlags to DFBInputDeviceDescription that contains
+    the type of the input device specified by one or more of the following flags:
+    
+    DIDTF_KEYBOARD      = 0x00000001,  /* can act as a keyboard */
+    DIDTF_MOUSE         = 0x00000002,  /* can be used as a mouse */
+    DIDTF_JOYSTICK      = 0x00000004,  /* can be used as a joystick */
+    DIDTF_REMOTE        = 0x00000008   /* device is a remote control */
+    
+    
+    Something like
+    
+    ...       DIDID_TYPE(id) == DIDT_MOUSE
+    
+    should be replaced by
+    
+    ...       desc.type & DIDTF_MOUSE
+
+commit 481646b9098655690241b0b41319857c1699b9d3
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Jun 7 17:01:22 2001 +0000
+
+    InputDevice info.driver_name/vendor are now pointers
+
+commit 7e20ac12b43205da944a37be24eee0095925754f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 7 16:00:20 2001 +0000
+
+    s/msmouse/serialmouse/
+
+commit 4b754161acdf13930f022b5cb6285806c0f4c892
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 7 15:17:56 2001 +0000
+
+    Renamed msmouse inputdriver to serialmouse since this beast will support
+    other more serial mouse protocols in the future.
+
+commit c9c31a29046d5806b2861d55e1acffeaef4d4437
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 7 15:06:02 2001 +0000
+
+    Added config option "mouse-protocol" (for serial mouse only). You need to
+    specify the protocol type if you want to use a serial mouse.  At the moment
+    only "ms" (2-button) is supported. I will add more serial mouse protocols
+    later.
+    
+    Check if a mouse is attached to the serial port.
+
+commit a08631348a58dd0f6c1a6e8a7e6f87d46007774f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Jun 7 11:57:11 2001 +0000
+
+    first working version of the MS Serial Mouse inputdriver
+
+commit b43ef57d8dddd7152db7f2d3a88b98dd1c5326dd
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Thu Jun 7 00:09:22 2001 +0000
+
+    Updated ChangeLog.
+
+commit 7b07b37557407b6d5432279dfb09419933d6226b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 23:49:38 2001 +0000
+
+    surface listener ported to reactors
+
+commit 808949c296c609c5d7268b4c33d9363597745ff4
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 21:40:49 2001 +0000
+
+    added MS Serial Mouse inputdevice, disabled at the moment
+
+commit 2b0c8cb41f0c2529c3f5c63b5fb3615dd3e2a677
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 19:36:13 2001 +0000
+
+    added common event dispatching code in reactor.[ch]
+    all input event listener handling and event dispatching
+    done through reactors
+    input driver code cleanup
+    removed unneeded input driver headers
+
+commit a9ba811a1c58198d11bd6fab8bd8a8b7c7353684
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 19:36:11 2001 +0000
+
+    forgot to change config -> dfb_config here
+
+commit ec6d7eb670a2522d7bcc596a80986505306a4546
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 19:27:25 2001 +0000
+
+    renamed global variable config to dfb_config
+
+commit 861cdfb7bbbcb8fe8085e90f04b1532fe90e84ab
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 18:59:32 2001 +0000
+
+    removed some unused includes
+
+commit 3e3f64a319a6d7cd05cab6fa44e1569f1e0d6b43
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 17:38:20 2001 +0000
+
+    updated NEWS
+
+commit 51881d29e17fd3d6c53efc8958bb1687bd50293a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 16:19:57 2001 +0000
+
+    restructured interfaces directory
+
+commit e0c63211a67226351de9a047b5849a6ca4c01ffa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 16:11:14 2001 +0000
+
+    purged now
+
+commit 57e9aa06c42c6cc91840ffac75f8a79b716991cc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 15:50:37 2001 +0000
+
+    Tweaked Sop_a8_set_alphapixel_Dop_rgb* functions as suggested by Fefe.
+    Speeds up DrawString by several percents.
+
+commit 8f91e830d25e257b58795ce608e8b75287b6ea04
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 15:32:38 2001 +0000
+
+    inputdrivers modularized
+
+commit 31fa5aa792912778579ce4ee2233873ff52a842b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 14:15:53 2001 +0000
+
+    use calloc() instead of malloc();memset()
+
+commit 9b14c2e93e0c9072506184431306600fcbff3529
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 14:02:45 2001 +0000
+
+    use calloc() instead of malloc();memset();
+
+commit e192bf1a7ee1ba55b49264f1da589ac1be4e22a9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 13:57:12 2001 +0000
+
+    started to begin using calloc ;-)
+    added core_load_modules( dir, callback, ctx ), a common function for
+    loading modules in a directory, callback can return one of the following
+    values: MODULE_LOADED_CONTINUE, MODULE_LOADED_STOP, MODULE_REJECTED
+    made usage of the new function in gfxcard.c for driver loading
+
+commit 7067593dbba2558a8eb9cd394133e4a4be40332f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed Jun 6 11:28:04 2001 +0000
+
+    I managed to put even more typos in here...
+
+commit 49f43f423891f86337238f8b270a3e589cedd702
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Jun 6 00:26:02 2001 +0000
+
+    s/Joachim/Johhanes/
+    
+    Sorry.
+
+commit 1344a77b354fa846127ea4c58f3d271bfe742a8a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 5 23:58:30 2001 +0000
+
+    set alpha value in state only if it's not the desired opacity
+    removed comment from surfacemanager
+    deallocate and allocate video buffers until proper reallocation
+    method is present
+
+commit 9dd587bbdb238759b570fcb9bd927019858e4f03
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 5 19:12:37 2001 +0000
+
+    enhanced the suspend/resume hack
+    added DFBAddSuspendResumeFunc and DFBRemoveSuspendResumeFunc
+    registered functions are called in IDirectFB->Suspend/Resume
+    V4l Provider closes video device in suspend and reopens it in resume
+
+commit e0ad3d1b7e3da23bf5a5d36d7b9f8d1780a427ab
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 5 18:57:27 2001 +0000
+
+    bumped version number to 0.9.3
+
+commit 61e8fc73ae4997f587a6b104f22479870009b7df
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Jun 5 18:22:09 2001 +0000
+
+    New internal function rectangle_union.
+    
+    New API function Font->GetStringExtends which allows to retrieve the
+    logical and ink extents of a given string. Refer to the documentation
+    in directfb.h.
+    
+    Modified gendoc.pl so it translates empty comment lines into paragraphs.
+
+commit 0db8053ea7c3e7e1442bb291291d797da8a287cc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 5 16:57:51 2001 +0000
+
+    disabled normal deinit code, mutex locking in exit handlers is evil!
+    we have to rewrite all this deinit shit.
+
+commit c706a4a361bc695cb705174ee65fe1360711e914
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Jun 5 15:48:36 2001 +0000
+
+    send DWET_CLOSE event before destroying window
+    how can we make sure that another thread that hangs on the mutex lock
+    gets the event BEFORE destroying the window? maybe we should tear the event buffer
+    off the window structure.
+
+commit cbd8ee4f403a10151e040355f6d005b2e60a4785
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 4 15:02:26 2001 +0000
+
+    fixed make clean ;)
+
+commit a7234414ce25637fb5a8b989778bfafcaf501db8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 4 14:41:25 2001 +0000
+
+    applied really nice patch from Sven that reenables
+    the colorizing with a better calculation, too slow for you?
+
+commit bc73a036e2fe69480502f27d59ba6778346fba25
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 4 13:39:14 2001 +0000
+
+    patched the patch, ioctl should return -EINTR and not -ERESTARTSYS
+    
+    from linux/errno.h
+    
+    #ifdef __KERNEL__
+    
+    /* Should never be seen by user programs */
+    #define ERESTARTSYS	512
+    ...
+
+commit 42ad2310d30a429732daceb82b9eb92d8310151e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 4 10:33:17 2001 +0000
+
+    The real way[tm]! With mouse to rotate and keyboard to move a la Quake!
+
+commit 6e4966a10d6b01bb141ae744e41212cd1011c1d7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon Jun 4 09:57:19 2001 +0000
+
+    check for row_width > 0 before modulo
+
+commit e2667e882f8d1b8e2889f51a8287b6a63024dd40
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat Jun 2 18:14:25 2001 +0000
+
+    applied a patch provided by Johannes Zellner <johannes@zellner.org>
+    that adds support for loading interlaced PNGs
+
+commit d12c662616ea039dea64c40756241b8b4e733b08
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Jun 1 11:51:15 2001 +0000
+
+    fixed compiler warnings in tools
+    compile (but do not install) tools
+
+commit 9a79747e472c18cb0c7dba7ef50ba1746cec16ef
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 31 16:59:32 2001 +0000
+
+    more excessive use of long long
+
+commit 04a75cf2ae602e52ab4666dd8fa1d89ef525b06c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 31 16:44:45 2001 +0000
+
+    does this fix the overflow problem ?
+
+commit 8d83f9e66363cd51f502fe0b3059b93ce134be64
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 31 15:54:46 2001 +0000
+
+    alalalalong
+
+commit 5f0e1f15ea8950f81fc142d0f785525d11278d4d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 31 15:24:23 2001 +0000
+
+    use gettimeofday() instead of clock()
+    small changes to the results page to make it fit on smaller screens
+
+commit 4422570a2025c63b4bbc061448f2cb6b53ff5ee2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 31 09:39:47 2001 +0000
+
+    added support for loading fonts w/o antialiasing (DFFA_MONOCHROME)
+    added span_a1_to_a8 and span_a1_to_argb functions
+
+commit fd7503c6d14bc24e47de021140ee939b4141fbbf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 31 06:32:35 2001 +0000
+
+    - rotation about y axis
+    - perspective drawing
+
+commit 7bce8ac6d665ebed72984ca7754e50ddb38ca2f0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 29 15:10:01 2001 +0000
+
+    turn off console blanking
+    do (w&1) instead of w -= 2 in loop
+
+commit f937f20d87261913167b0fb0afd701992255f9a4
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 29 14:20:34 2001 +0000
+
+    Allow to specify font attributes (DFFA_NOKERNING, DFFA_NOHINTING) when
+    calling FontCreate() to control how fonts are loaded and layouted.
+    
+    Added new function IDirectFBSurface->GetFont().
+
+commit 03afe0a7d29191940ebf5659e5f9e5d5d0259669
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 29 13:00:57 2001 +0000
+
+    check elapsed time more often when running stretch-blit benchmark
+
+commit acb264f87a672238209e864bef8f0cabdc0891f6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 29 12:30:58 2001 +0000
+
+    same optimizations for Sop_rgb15_to_Dacc
+
+commit bd98ebd0a0da2467c093fda5a2dca9eefd3e3b56
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 29 12:18:22 2001 +0000
+
+    Sop_rgb16_to_Dacc does aligned 32bit reads now!
+    Performance of FillRectangle(blend) went from 1.73 to 3.09 without MMX!
+    
+    Andi: Please test it on PowerPC!
+
+commit f04a9af73a8f3e8792515f669826b16c3bed6119
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 29 11:35:46 2001 +0000
+
+    print banner in DirectFBCreate instead of DirectFBInit
+
+commit bd3be591e3b407286bbe93e21f9838c10b801f4a
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 29 11:32:37 2001 +0000
+
+    renamed --blit-stretched option to --stretch-blit
+    print usage information if wrong command-line options are given
+
+commit 93b2dd6170e83606d1e8306aa2335c96b16cec45
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon May 28 23:07:44 2001 +0000
+
+    allow to specify benchmarks on the command-line,
+    no argument means all benchmarks
+
+commit 5dbab7dbbe7d79c6524c7404e0de73c64ece870e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon May 28 21:06:58 2001 +0000
+
+    Restructured code to make it easier to add new benchmarks or other
+    features. The functionality shouldn't have changed, but code size went
+    down by more than 100 lines.
+
+commit c298a55ba8fe949e4ad3bb1fa6ccea51df567950
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 28 19:21:06 2001 +0000
+
+    interface modules are now installed into subdirectories depending on the type,
+    e.g. /usr/local/lib/directfb/interfaces/IDirectFBFont/libidirectfbfont_ft2.so
+
+commit 4031b5f69d989064986e7f2d3c60e5ed305b290a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 28 19:15:59 2001 +0000
+
+    fixes for C versions of Sacc_add_to_Dacc_C() and Cacc_add_to_Dacc_C(), this
+    fixes the "falling corpse"-bug in ClanBomber on non-mmx machines.
+
+commit d4327b4b47d37b73996e56d8cdbf5405748f7638
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 28 18:04:32 2001 +0000
+
+    yet another started thing ;-)
+    
+    will be a 3d space shooter
+
+commit 701d2fe7a954b16a59c2f4dde1290bc301d507b4
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 28 16:53:49 2001 +0000
+
+    VT_ACTIVATE and VT_WAITACTIVE system calls are repeated if interrupted.
+
+commit 4190f438d5d04c8ea01eb9e12b31283f47773dc6
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 28 15:35:17 2001 +0000
+
+    added -lm for pss (compiles on ppc again)
+
+commit 5e31bea8c91ced612bb9eb5bf358abf85feff5aa
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 27 21:47:44 2001 +0000
+
+    fixed bug in gAcquire: src colorkey was not set when using src colorkeying
+    and at least one of DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_BLEND_COLORALPHA and
+    DSBLIT_COLORIZE.
+    
+    Andi: Does this fix falling corpse parts on PowerPC?
+
+commit 7e8aed2399c9747257bb6e342ce0d41ed730240a
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 27 21:31:15 2001 +0000
+
+    check for source != NULL in Blit and StretchBlit
+
+commit 56527f1a2d54f8cbb1636b3ba086853ce41b00d2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 27 20:05:50 2001 +0000
+
+    Added "idirectfbvideoprovider_libmpeg3.c" to EXTRA_DIST
+
+commit 89d43a0948268f354bad5b17346d5513cba23f02
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 27 06:23:52 2001 +0000
+
+    Added a parsing feature: The description of interface functions
+    is now split up into two parts devided by the first blank line.
+    The first part is the headline and is printed in the interface overview
+    and in the page of the funtion itself. The detailed information about
+    the parameters and possible error values is only in the functions page.
+    
+    We can now write very long and good descriptions for the functions without
+    bloating the index pages.
+
+commit 1f4cac510b74881e9e36356591209db8e6e95ab5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat May 26 15:48:59 2001 +0000
+
+    added IDirectFB->WaitForSync, blocks until next vertical retrace
+
+commit b5beada3a15f788d2a35109fd6d2790f65232554
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 25 19:24:11 2001 +0000
+
+    new demo, very early stage
+
+commit 540bb81e888f95133cf2f1ea3aa34f2d4f26f578
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 23 19:42:39 2001 +0000
+
+    grammatical clarification
+
+commit f2a800567d49d7d9469eeede0d775a71bf202cf6
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 23 19:04:25 2001 +0000
+
+    updated NEWS
+
+commit 270f25da60aca52daf38e3f4f1361f4490720f52
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 23 18:53:39 2001 +0000
+
+    updated ChangeLog and NEWS
+
+commit aed93d68b743ba8ccda1c1b5a49481c462b75055
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 23 15:17:34 2001 +0000
+
+    got it wrong last time, hopefully works now
+
+commit accdbbc104a99d79d5088d2071e8526009446c2e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 23 14:51:56 2001 +0000
+
+    Loop MPEG so it behaves like the AVI provider.
+    Timing is still badly broken if you use Stop() or SeekTo().
+
+commit e47cc9116ea396d0e35865da74143fa4f777d32d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 23 14:13:24 2001 +0000
+
+    tried to fix image loading in 24bpp (can't test)
+
+commit 33eea06ef2dd618607a160ca0e02932774221898
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 23 11:09:26 2001 +0000
+
+    support von 15bpp in jpeg provider
+
+commit 5385a67dbcfd890bc45871d8a4f8a89d71d4b89d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 23 00:49:33 2001 +0000
+
+    removed a spurious comment
+
+commit 905019ca6fb70ea509be36ce118f3ce3bd4d085c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 23:46:48 2001 +0000
+
+    tweaked Cop_to_Dop_24
+    72.78 -> 73.30
+
+commit 9bafdeb91e6543b93b9756738f00ef14c4a992bc
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 22 23:02:48 2001 +0000
+
+    added --on-crack command-line option to df_neo
+
+commit 7fd9888ff76fd486393e9910c3e5db3bc87f1828
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 22:55:18 2001 +0000
+
+    Removed #ifdef, no unroll anymore, fastest result ever seen!
+    121 MPixel/sec (Celeron 533), routine before had 119 MPixel.
+
+commit fbcdef93562b509ca5075d4571b3517f9783501f
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 22 21:50:17 2001 +0000
+
+    the rest of my optimizations that were not committed before
+
+commit 231379d68d22ce813e4efcf8816ccb68f3eb9a01
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue May 22 21:39:11 2001 +0000
+
+    added fefes code for non-i386 platforms, great improvement on my powerbook,
+    use old code on i386
+
+commit ed22e331466827f36958c186b9c2550b8e9600c5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 19:53:43 2001 +0000
+
+    Fixed bug found by Falk Berger, in function keyboard_handle_code:
+    event.flags should not set DIEF_KEYCODE only, but also DIEF_MODIFIER.
+
+commit b366c59b0316264a4fb2efdb5e72f02dd5b87223
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue May 22 19:36:51 2001 +0000
+
+    commited svens new SET_ALPHA_PIXEL_RGB16 and _RGB15 macros, performance
+    improvements in DrawString() on i386 and powerpc
+
+commit f59ac169b6f946011e17b7cd7b2fca7bf034f9c1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 22 16:19:21 2001 +0000
+
+    forgot to remove some lines we don't need here
+
+commit 6fca116f2a080f0696979a54ae66e4afcbabcfb9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 22 16:16:27 2001 +0000
+
+    allow for automake 1.4-p1 and similar version numbers
+
+commit 92bb00eb4892601c13d9611093c79dcf896f76ec
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 05:33:47 2001 +0000
+
+    Added IDirectFB->WaitIdle() that waits for the graphics card being idle.
+    
+    df_dok calls WaitIdle before and after each benchmark.
+    Now we see the real performance of the Savage3D.
+    Besides that e.g. the blitting benchmark takes 9 seconds
+    instead of 3 seconds defined in df_dok.c because it takes
+    the hardware 6 additional seconds to complete all the buffered
+    instructions. In this time (6 seconds!) the application can
+    use the CPU for other things ;-)
+
+commit 6f4b164cdbe396065efb9f004e70f58fadd95043
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 03:43:06 2001 +0000
+
+    Do gfxcard_sync() in gfxcard_deinit(),
+    fixes X crashes with Savage being busy during switch back to X.
+
+commit b3a6619092821449185007dcd963c96e03d9a3bc
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 22 00:23:27 2001 +0000
+
+    do pthread_testcancel() in input threads,
+    print die message only if errno != EINTR
+
+commit 72fd126ef45188c00ab11fcf9d3d1f3956ec20f5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 21 23:49:03 2001 +0000
+
+    follow API change
+
+commit a8c494f3eb068522f071473284c4df151d29dfd5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 21 23:48:34 2001 +0000
+
+    missed one default label in pixelformat switch
+
+commit 989a1a8fe75aa62c814ff95e49147421da683ac7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 21 23:43:42 2001 +0000
+
+    added "-f" to rm ;)
+
+commit d4b397ad1aae6f272dfc98f04ca365c61a9d80bb
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 21 23:21:04 2001 +0000
+
+    FIXME hunting:
+    - Added error code DFB_MISSINGFONT, returned by DrawString.
+    - DFBGetInterface checks filename length before checking the extension
+    - Wrote more details for FIXME about primary surface recreation.
+    - fbdev_get_pixelformat now checks all channel's length and offset
+    - gfxcard_check_state now rechecks if src/dst blend function changed
+    - do at least clip_triangle_precheck for hardware without clipping support
+    - if surface_reformat fails, restore values and already reformatted buffers
+    - replaced hardcoded "7" with blitting flags in "Dacc_modulation[7] = ..."
+    
+    Other fixes:
+    - bug messages in all drivers when an unexpected pixelformat is found
+    - made avifile provider compile again with version from download/contrib
+    - follow surface description API change in avifile and swf provider
+    - some type fixes (unsigned int was used instead of the actual type)
+    - fixed bug in gAcquire that caused DSBLIT_BLEND_COLORALPHA to be ignored
+      when the source pixelformat is DSPF_A8 and DSBLIT_BLEND_ALPHACHANNEL and/or
+      DSBLIT_COLORIZE has been set
+
+commit 0d43da766fc13d91b775e081351aee32df9a3ec5
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 21 20:12:56 2001 +0000
+
+    - API Change:
+      removed bpp field from surface description, removed DSCAPS_ALPHA,
+      added pixelformat field instead.
+    - removed window stack repaint when new window is created (makes no sense
+      since opacity for new windows is 0)
+    - added support for 15bpp in v4l provider
+    - v4l provider support for devfs (/dev/v4l/video*)
+
+commit 741a59cc397a16208ef348b49e9308b218f83ac2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Mon May 21 17:51:12 2001 +0000
+
+    You can use "Ctrl+Alt+Backspace" to exit DirectFB by killing it with SIGINT.
+
+commit 90eaeccbf3cefdb6a73381896a8f5074384c4788
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sun May 20 21:45:36 2001 +0000
+
+    After my latest optimizations, line drawing was wrong under some
+    circumstances. Fixed it without hurting the performance.
+
+commit 4a5cc1185d3b0830b2a74f9c2b7a0272c15f8dbe
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun May 20 20:12:20 2001 +0000
+
+    in CreateFont: allow desc == NULL if filename == NULL for default
+
+commit 7fe335847be532da8602586c5272d930fb78bc31
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 19 20:46:11 2001 +0000
+
+    bumped version number to 0.9.2 and updated README
+
+commit 111592354e20ebf447ad1e59cd2c761309d259e1
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 19 19:30:48 2001 +0000
+
+    updated NEWS
+
+commit e4f71edfbec933709fa7137fd5a7400396aa26a8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 19 18:44:10 2001 +0000
+
+    Changed GetStringWidth() and DrawString() methods so they take an
+    additional parameter "bytes" that specifies the number of bytes to
+    interpret from the passed string. Pass -1 if you intend to use the
+    complete NULL-terminated string.
+    
+    This has several advantages: Line-breaking algorithms can be implemented
+    without copying the string and not NULL-terminated character arrays can
+    be drawn. Unfortunately this changes the API once again.
+
+commit 199ab2f1b508480987631e1df8ea8503345ad99e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 19 17:46:51 2001 +0000
+
+    - readded src/media/Makefile.am (forgot this one on my last commit)
+    - added interfaces/idirectfbfont_default.c (this used to be the default font
+    implementation in the core)
+    - removed default font code from the core
+    - changed interface loader so you get the default font if you call
+    CreateFont() with a NULL filename
+
+commit 985849b7fde6e3805244ff4573ba0f2acc545a38
+Author: Sven Neumann <neo@directfb.org>
+Date:   Sat May 19 17:24:18 2001 +0000
+
+    - readded src/media directory to provide default font methods
+    - changed IDirectFBSurface struct to take a pointer to an IDirectFBFont
+    - made IDirectFBSurface call AddRef and Release on the font it owns
+    - made DrawString method use GetStringWidth method as provided by IDirectFBFont
+    - ditched default font completely; will add it back as a font interface
+
+commit 68559c2f73382877a3779264002ef92bc0b1dc1b
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri May 18 16:44:52 2001 +0000
+
+    renamed _noMMX functions to _C
+
+commit 4f0f373ca78fa5cbd918ba1ba3015d282a6a0849
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Fri May 18 16:19:57 2001 +0000
+
+    replaced SET_ALPHA_PIXEL_RGB32 with fefe's code. DrawString() performance in
+    32bit is more than twice as high than before (i386). no performance
+    improvement on powerpc, dont know why. other platforms not tested yet.
+
+commit 3e10d5d8e1e6a6827edf3f9f9f742d41c9146da6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 18 15:33:14 2001 +0000
+
+    Fixed SeekTo (seconds*rate, not seconds/rate).
+    Implemented GetLength and GetPos.
+
+commit f179998b473213c6106dbac1c27afe70cc6bd940
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri May 18 14:43:42 2001 +0000
+
+    #include <libmpeg3.h> instead of "libmpeg3.h"
+
+commit b61d9adfa1efe332704834be3c12ec0274c05fdc
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Thu May 17 14:11:09 2001 +0000
+
+    Cop_to_Dop_16() uses 32-bit writes to the framebuffer. Makes no difference
+    on i386, but ~30% performace increase on ppc.
+
+commit 12a6c921c1b9ef46df253556e8c0e987cfe11df6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 16 20:01:34 2001 +0000
+
+    Added libmpeg3 videoprovider, thanks to Kim JeongHoe for the source.
+    
+    To compile with libmpeg3 video provider use:
+    
+    ./configure --with-libmpeg3=<path>
+
+commit 347e59ea55e9507c27e1e46d2722ced1fffaefbb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 22:44:38 2001 +0000
+
+    removed gprint
+
+commit 74a75adc8a4bf3aa7f6baa2ad79b418a8b4d0d1a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue May 15 20:01:54 2001 +0000
+
+    allow use of kerning on non-i386 machines, seems to work on my powerpc again.
+
+commit 3329ce2a9eec81c96a640c463f97d578d7052b10
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 20:01:15 2001 +0000
+
+    forgot to remove src/media from here
+
+commit 4cc89b66d5b21264e8fee753900c96a88c91ad75
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 18:41:09 2001 +0000
+
+    Removed media/idirectfbfont.[ch] and implemented it all in the interface.
+    Call FT_Done_Face() on freetype face object on font destruction.
+
+commit f0b4f285c2e0de4814a2d431e9ef48eb1d596ccd
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 15 17:17:28 2001 +0000
+
+    simple precheck clips text examining y(+height), clip y1/y2
+
+commit d510eb73be00383f1f095b222932e30f91b9fee9
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue May 15 16:53:24 2001 +0000
+
+    set state->source to NULL before returning
+
+commit 5f9f414ca7294682f1e880915c36db0d17a15c6c
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 15:42:52 2001 +0000
+
+    avoid endless looping on invalid UTF8 strings
+
+commit 1fa5506e51fe25b67058867c9cf8aba0e66d10a8
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 14:48:57 2001 +0000
+
+    fixed braino in GetStringWidth() func
+
+commit 7e81ee96ee50bae6920267b84b0c7395278a47c9
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 14:46:11 2001 +0000
+
+    indentation
+
+commit f2609006c7f18e627c0fd1b2e61d754a9d2a18f2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 14:45:37 2001 +0000
+
+    - do not try to free NULL pointer in tree.c
+    - some minor cleanups
+
+commit e4020a17583020a033fe2276bc907c20e807430a
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Tue May 15 14:32:38 2001 +0000
+
+    - replaced ceil() calls in idirectfbsurface.c with ICEIL(), compiles on arm and ppc again. (without libm)
+    
+    - removed resolved BUGS from BUGS
+
+commit 42a9e5a43823be6b1932498e6963e9de9ddece6d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 13:42:57 2001 +0000
+
+    added sanity checks so we never draw outside the surface boundaries
+    corrected handling of face metrics
+
+commit ade1d51bfebb4ae96ca0e157fb393c48feb0831b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue May 15 01:48:19 2001 +0000
+
+    Rewrote a good part of the font code:
+    
+    - surface->DrawString() now takes UTF-8 strings.
+    - Fonts do not need to be loaded completely any longer. The core keeps
+    an array of surfaces that grows when new glyphs are loaded. Information
+    about the glyphs is kept in a balanced binary tree using the Unicode
+    index of the glyph as the key.
+    - Kerning tables are not any longer in the core font struct. We now use
+    a callback from the core to the font provider and it can choose not to
+    implement it all.
+    
+    Things left to do:
+    - Add some checks so we don't crash on very large fonts.
+    - Let the font provider specify the surface format and blitting flags.
+    - Hook into font destruction and release the FT2 face.
+    - Add DrawGlyph method to surface so we can use it from the GDK backend
+    or from a Pango module.
+
+commit cf993312956e3cb38876fc9e8bd4c6f5e15c9c61
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon May 14 21:28:06 2001 +0000
+
+    don't use -fomit-frame-pointer if compiling with --enable-debug
+
+commit e78561da12998e8dfb8ebb5fb6a73bd5a78aaceb
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 14 20:02:30 2001 +0000
+
+    - implemented ceil and floor functions IFLOOR() and ICEIL(), to get rid of
+      libm
+    - added -lm to Makefiles of examples that need libm.
+
+commit 72f9dea4cdcbc8a45f4df6d33e641ef94899ad82
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 11 19:07:21 2001 +0000
+
+    optimized gDrawLine() further  -->  5% speedup
+
+commit 5690c78b62584db8e5e169c176107f74542139fb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 11 18:46:12 2001 +0000
+
+    some optimizations on Drawline() --> about 10% faster
+
+commit 48553034e11ff8d21e948b89581ac9776ac6c85d
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri May 11 13:14:47 2001 +0000
+
+    removed leftover declaration of IDirectFBFont_Construct_TTF()
+
+commit 56bdcf0ed3ae2199c152e5a7f647d50fa5382236
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 10 12:37:47 2001 +0000
+
+    Changed help string so it mentions that these are DirectFB options and
+    not app-specific. We need to change command-line parsing somehow since
+    it can not be that DirectFBInit() exits the app if --help is found
+    without giving the application a chance to output its help.
+
+commit 86c72e08714975735bb4b9dd80b5126cbe25415e
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 9 18:26:40 2001 +0000
+
+    applied patch from <js@convergence.de>
+    
+    - videos with few IFrames no longer rewind if using fast forward in dfbsee
+
+commit f8c620570556a626f7de453b6515b72d8d5206fd
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Wed May 9 17:05:53 2001 +0000
+
+    vt.c opens /dev/tty0 or /dev/vc/0 (for devfs) instead of /dev/console,
+    this makes DirectFB work on machines with serial console.
+
+commit c41ce73ef352139667ce693af43ca463e42dce1e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed May 9 15:41:18 2001 +0000
+
+    Print error message if DirectFBInit has been forgotten.
+
+commit 85ba552609a60d5eb40fafb2e6716896bcc96496
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 7 20:07:24 2001 +0000
+
+    fixed warnings that occured when compiling with gcc-3.0
+    ("deprecated use of label at end of compound statement"
+    and "undefined reference to memset")
+
+commit 7e84ffe7a9f7d48ff2ea578233a4e4cb0789ebfe
+Author: Andreas Hundt <andi@directfb.org>
+Date:   Mon May 7 17:57:41 2001 +0000
+
+    applied patch from Johannes Stezenbach <js@convergence.de> which
+    adds the following functions.
+    
+    - IDirectFBVideoProvider::GetPos():    get current position in the stream
+    - IDirectFBVideoProvider::GetLength(): get length in seconds
+    
+    the functions are currently implemented in the avifile provider only,
+    v4l and swf providers return DFB_UNIMPLEMENTED.
+
+commit fde334dfe437bc7ad0778f8c822794d5c5e2813e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 21:47:33 2001 +0000
+
+    Made 0.9.1 release
+
+commit 92fb43b260bdd0f93490bb6f8255491758c49962
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 19:17:06 2001 +0000
+
+    Changed clip_triangle_precheck() so it drops triangles that need to
+    be clipped. This is a temporary workaround for the lack of proper
+    clipping code and keeps us from trying to draw beyond the surface
+    borders.
+    
+    Corrected scaling factor in df_knuckles.
+
+commit 64a778d308c0d474d96bae7ba1e7687b7f5cfcea
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 18:39:33 2001 +0000
+
+    allow to toggle BackfaceCulling using 'B' on your keyboard
+    default to BackfaceCulling = False
+
+commit 90ae5296c73fc90945a37b7a9a8db159143aa866
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 18:15:20 2001 +0000
+
+    added a second light source, nightblue and static
+
+commit 241f756c076c3202f69bd352333892540428b242
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Thu May 3 17:23:12 2001 +0000
+
+    Regenerated ChangeLog with a nicer script.
+
+commit 5a7d4c1f561d8ba4cfebdac287a2aad5111dfdf0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 17:04:11 2001 +0000
+
+    removed empty NOTES file
+
+commit 5c4a8ac23b751f5ea68a9b93cd7e983295ae3234
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 3 15:10:06 2001 +0000
+
+    cleared NOTES, outdated
+
+commit 0ef489c1da1f0a4a601501befebcf4fa8b831322
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 3 13:07:47 2001 +0000
+
+    Added Sven's pkg-config additions to NEWS.
+
+commit d554f27fc6089fc0a1ca813c0e2134618015de2c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 3 12:50:31 2001 +0000
+
+    Generated ChangeLog.
+    Wrote NEWS.
+    Made DFBInputEvent.key_unicode an __u32.
+
+commit 6fac0eb32e54aadc6f102bc934b1536537029c6e
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu May 3 11:57:22 2001 +0000
+
+    added pkg-config files for the interfaces that get optionally installed
+    so apps can test for their existence
+
+commit 2f738040b395392953a73fb594d4e703a1cc7cf6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 3 11:46:11 2001 +0000
+
+    Added my framebuffer driver for all NeoMagic PCI/AGP chips.
+
+commit 111f4e7604b3a16cbba052cb4236021126b9eae7
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu May 3 11:27:03 2001 +0000
+
+    Added IDirectFBInputDevice->GetButtonState() which returns the
+    state of the specified button.
+    Added DFBInputDeviceButtonState.
+
+commit d99d7460d2c5fc0c09680b0a43115db73c87e886
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 2 11:17:32 2001 +0000
+
+    allow to switch between FLAT_SHADED and WIRE_FRAME using Space
+
+commit f97a8eeeb84247bbb93570695992c7b6349e915b
+Author: Sven Neumann <neo@directfb.org>
+Date:   Wed May 2 10:53:51 2001 +0000
+
+    Introduced clip_triangle_precheck() that tests if a triangle needs to
+    be drawn at all.
+    
+    Beautified line drawing examples in df_dok.
+
+commit c7ae9484e54094ff1f65b2a3f100512f15d4b2a0
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 08:48:36 2001 +0000
+
+    Implemented triangle filling in Matrox driver.
+    Renamed utility macro SGN to SIGN.
+
+commit 39c658fa5349f6b8abd427846b7d86a82d5f5df5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 06:02:48 2001 +0000
+
+    yeah, rotating light!
+
+commit 5ad7c7d04d4327a2e62a378ce0878b21120b5338
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 05:41:38 2001 +0000
+
+    golden skull ;)
+
+commit 03fe13cdbcecec872e32b9e5cd91fdbf8fcf4dea
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 05:14:58 2001 +0000
+
+    Added new cool demo called df_knuckles, it's a port from Mark Vojkovich's
+    skull demo for DGA and a good demonstration of triangles.
+    
+    Fixed CheckState in Matrox driver, it does not support all functions any more.
+    Added rounding to fixed point triangle setup.
+
+commit 308945bb1963fb246afca5a0ba988f02823598b1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 03:37:46 2001 +0000
+
+    implemented triangle filling in generic driver
+    moved utility function sort_triangle from tdfx driver to gfx/util.h
+    added triangles to df_dok
+
+commit d12a1c2b800ddbaf7ac276a003d2ba2e79abcf44
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sun Apr 29 01:13:09 2001 +0000
+
+    compile with "-g3" if "--enable-debug" is passed to configure
+
+commit 2579d65400a613fb2427ff501f3bf2104247609d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 27 14:43:53 2001 +0000
+
+    fixed accelerator ids
+
+commit f740f41821ff65005d28d6beb4fe9679d5f03c13
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Apr 26 23:36:52 2001 +0000
+
+    Moved command-line parsing out of DirectFBCreate() into DirectFBInit().
+    This means to inititalize DirectFB() there are now two calls necessary:
+    
+      DirectFBInit( &argc, &argv );
+      DirectFBCreate( &dfb );
+    
+    This makes is possible to do further checks on the command-line before
+    switching to graphics mode on DirectFBCreate.
+
+commit fa3249dc57c0f62584039241186f1b439d6a4d1b
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Thu Apr 26 22:47:50 2001 +0000
+
+    - If we need argv[1] as video source, check for it instead of simply
+      crashing if it's not there.
+    - Release the video provider so DMA from the tuner hardware doesn't
+      trash framebuffer memory after the demo finished.
+
+commit 893ee69e897a34752f89522555ef62edf958a7ee
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 26 21:05:26 2001 +0000
+
+    FillRectangle! But only on Voodoo, yet.
+    Accepts drawing flag DSDRAW_BLEND.
+
+commit 7a42d0f386fcb4dcf7a94338a29c6b58cf675c41
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Apr 26 20:30:56 2001 +0000
+
+    forgot to remove the free's here
+
+commit 02f48e08c3890aba1d6a8d37022fbe18c7035b72
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 26 11:44:08 2001 +0000
+
+    free interfaces if reference counter reaches zero,
+    disabled in debug mode to enable the feature of DFB_DEAD
+
+commit e478aa82f9489e94c1f63f6601b37d337f16c056
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Thu Apr 26 00:11:18 2001 +0000
+
+    Fixed the check if avifile-config was found.
+
+commit 7b5b31e0a6884e22eb35136d3524b6fcf302ece1
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 25 21:10:23 2001 +0000
+
+    removed unused files
+
+commit b2a15826add6eaeb04aec49aa3bc8856174fb4c7
+Author: holger <holger>
+Date:   Wed Apr 25 20:33:59 2001 +0000
+
+    free interfaces if constuctor failed
+
+commit 0c9ee2a440c5383308bdf1eb3a7cea0f2f987918
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 25 18:01:29 2001 +0000
+
+    fixed caps passed to IDirectFBSurface_Layer_Construct
+
+commit 473b007802afce63c0843004324e09d7a8df0855
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 24 13:34:54 2001 +0000
+
+    Reset card state in suspend, some glitches still there.
+    Generated changelog.
+
+commit 305a9fee889f178bfec52bcca5727bb6ab4f05eb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Tue Apr 24 13:14:20 2001 +0000
+
+    Added Shockwave Flash videoprovider hacked by Roh.
+    
+    Uses libflash which can be found repackaged at
+    http://www.directfb.org/download/. There is no acceleration yet, we just
+    tell libflash to draw into a DirectFB surface. Sound and interaction are
+    also disabled.
+    
+    Try to build avifile videoprovider by default. Can be disabled by passing
+    --disable-avifile to configure.
+
+commit af3abf37fe1212aa72ae3ce39b00d882a7cf69cb
+Author: Sven Neumann <neo@directfb.org>
+Date:   Mon Apr 23 17:04:36 2001 +0000
+
+    Bumped version number to 0.9.1
+    
+    Added an avifile option to directfb-config that makes --libs output the
+    suitable LDFLAGS so the avifile provider can be used with the linked
+    application. Will need to figure out how to do this right in directfb.pc.
+
+commit 16d699ca8a93a3fa62f98578bda4ff263c2551ed
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 20 19:15:54 2001 +0000
+
+    Fixed the segfault that happens at exit in all applications using an
+    IDirectFBDisplayLayer.
+    
+    more signed/unsigned cleanups, we need to check all code for that
+
+commit 7c3725fa009725979049fe6a9dd08c8f1ea2eaa8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 20 18:52:18 2001 +0000
+
+    signed/unsigned int cleanup
+
+commit 70d33987eb1c84b799d19517a0d28a76caf21622
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 20 14:38:11 2001 +0000
+
+    removed bogus test lines from driver
+
+commit 3b37fd329bc2750daaf3397de00651aefafb94f0
+Author: Sven Neumann <neo@directfb.org>
+Date:   Thu Apr 19 20:57:54 2001 +0000
+
+    do not enable the cursor by default
+    explicitely enabled the cursor in df_fire
+
+commit 963b4628d5030515b115ae8177adda2a2c311745
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Sat Apr 14 22:14:36 2001 +0000
+
+    also support .asf
+
+commit 0cae91379f36096825e8898c0ba4bd343178a4bf
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Fri Apr 13 07:07:52 2001 +0000
+
+    Stop works now, actually doing a Pause (Stop crashes avifile).
+    PlayTo no more stops the video before destination setup and
+    checks if the video should be UnPaused, Started or left Playing.
+    
+    Works really fine to call PlayTo several times with different destinations.
+    (Different surfaces on the fly not tested yet. Todo: Mutex PlayTo/DrawCallback)
+
+commit 5e37db8d246b7fce6248c8c7396c33c230276a23
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 12 21:06:14 2001 +0000
+
+    V4L Videoprovider Probe now checks if the filename bgeins with "/dev/video",
+    so you have to pass e.g. "/dev/video0" to the provider and not NULL.
+    Removed video4linux from core.
+    V4L Provider still needs these:
+    1. Clean up code.
+    2. Add grabbing support.
+    3. Do proper surface listening (resize, destroy, ...).
+
+commit 6ec4cbc0d37fc983148806b9cb82595286a7406b
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 12 20:59:43 2001 +0000
+
+    compiles with newest avifile version now
+
+commit 3cb8e1410dba23f0024ed0babbfe33b122cd034e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Thu Apr 12 15:48:29 2001 +0000
+
+    oops, directfb.h said "SetColor(a,r,g,b)", it is "r, g, b, a"
+
+commit c85266af87b82531cd926758a3535071e8798d48
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 11 01:47:47 2001 +0000
+
+    -removed composed blitting flags (DECAL,MODULATE,...)
+    -precheck if destination format is supported in jpeg provider,
+    image loading needs to be cleaned up badly (src/misc/gfx_util.c, too).
+
+commit 030db92769e5951ceb91303acd379e5ea1e5d8e6
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Wed Apr 11 00:44:41 2001 +0000
+
+    implemented flipping of general purpose surfaces (no layer, no window)
+    a) that are subsurfaces
+    b) with specified flip region
+    c) with DSFLIP_BLIT flag
+
+commit e0ebe46725106cf5d3567b1a6eb1ac4154d64ee5
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 23:48:23 2001 +0000
+
+    fixed parsing of struct members and interface call parameters
+    that have a type with spaces, e.g. "unsigned int".
+    
+    improved linking within types.html for struct members, e.g. flags
+
+commit 75c058b2fd90d1f1b259bb6961132bb08ebda3b2
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 22:44:45 2001 +0000
+
+    added missing "void *callbackdata" to callbacks:
+    DFBInputDeviceCallback and DFBVideoModeCallback
+
+commit f7c86c9e818558f38c961f88a22c41e3cc137e76
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 16:32:27 2001 +0000
+
+    removed clipping from software drivers blitting functions, gfxcard.c does this
+    removed debugging sleep from df_window
+
+commit f24ad236aeb6ffb2603462862673d9f970a3c29e
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 14:04:29 2001 +0000
+
+    added note about where to place this file
+
+commit baf3d673f196c25239207117145a9e3ad442f9ad
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 13:27:36 2001 +0000
+
+    added 768x576 mode (PAL), but at 75Hz
+
+commit 779997a21584eeb8dc86ead1d8017fa68367868c
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 13:00:53 2001 +0000
+
+    added #warning to help people compile the avifile provider
+    with a newer version of avifile
+
+commit 1a7f5c48ca04e6b581062f626c72315f8fdda9c8
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 12:58:00 2001 +0000
+
+    standard files
+
+commit 7f0e73d61230440c312aa80e686daf542911a18d
+Author: Denis Oliver Kropp <dok@directfb.org>
+Date:   Tue Apr 10 12:57:11 2001 +0000
+
+    added missing files that got sorted out by .cvsignore
+
+commit 3c0c679d473211afbe859ae84def8f1525fea1f2
+Author: Sven Neumann <neo@directfb.org>
+Date:   Fri Apr 6 20:34:30 2001 +0000
+
+    Documented the release version number in the ChangeLog.
+
+commit 25ff4234b1b752098ccc6b2eefe7fc1a6e21b686
+Author: Michael Natterer <mitch@directfb.org>
+Date:   Fri Apr 6 20:18:29 2001 +0000
+
+    Initial revision
diff --git a/Source/DirectFB/INSTALL b/Source/DirectFB/INSTALL
new file mode 100755
index 0000000..d3c5b40
--- /dev/null
+++ b/Source/DirectFB/INSTALL
@@ -0,0 +1,237 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Source/DirectFB/Makefile.am b/Source/DirectFB/Makefile.am
new file mode 100755
index 0000000..0682648
--- /dev/null
+++ b/Source/DirectFB/Makefile.am
@@ -0,0 +1,60 @@
+## Makefile.am for DirectFB
+
+ACLOCAL_AMFLAGS = -I m4
+
+if HAVE_LINUX
+LINUXONLY_DIRS = inputdrivers gfxdrivers
+endif
+
+if BUILD_TOOLS
+TOOLS_DIR = tools
+endif
+
+if BUILD_TESTS
+TESTS_DIR = tests
+endif
+
+if ENABLE_VOODOO
+PROXY_DIR = proxy
+endif
+
+SUBDIRS = \
+	data			\
+	docs			\
+	include 		\
+	lib			\
+	src 			\
+	systems			\
+	$(TOOLS_DIR)		\
+	wm			\
+	interfaces 		\
+	$(PROXY_DIR)		\
+	$(LINUXONLY_DIRS)	\
+	$(TESTS_DIR)		\
+	patches			\
+	rules
+
+bin_SCRIPTS = directfb-config
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = directfb.pc directfb-internal.pc
+
+EXTRA_DIST = \
+	autogen.sh	\
+	fb.modes 		\
+	directfb.spec.in	\
+	directfb.spec
+
+
+## Some special rules that may be useful ...
+
+# Generate the HTML API documentation:
+html:
+	make -C docs/html
+
+# Compile the directfb-csource utility:
+directfb-csource:
+	make -C tools directfb-csource
+
+
+.PHONY: html directfb-csource
diff --git a/Source/DirectFB/Makefile.in b/Source/DirectFB/Makefile.in
new file mode 100755
index 0000000..5ae0afc
--- /dev/null
+++ b/Source/DirectFB/Makefile.in
@@ -0,0 +1,811 @@
+# 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@
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(srcdir)/directfb-config.in $(srcdir)/directfb-internal.pc.in \
+	$(srcdir)/directfb.pc.in $(srcdir)/directfb.spec.in \
+	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+	TODO compile config.guess config.sub depcomp install-sh \
+	ltmain.sh missing
+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)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = directfb-config directfb.pc directfb-internal.pc \
+	directfb.spec
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"
+binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(bin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+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|^.*/||'`;
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = data docs include lib src systems tools wm interfaces \
+	proxy inputdrivers gfxdrivers tests patches rules
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+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@
+ACLOCAL_AMFLAGS = -I m4
+@HAVE_LINUX_TRUE@LINUXONLY_DIRS = inputdrivers gfxdrivers
+@BUILD_TOOLS_TRUE@TOOLS_DIR = tools
+@BUILD_TESTS_TRUE@TESTS_DIR = tests
+@ENABLE_VOODOO_TRUE@PROXY_DIR = proxy
+SUBDIRS = \
+	data			\
+	docs			\
+	include 		\
+	lib			\
+	src 			\
+	systems			\
+	$(TOOLS_DIR)		\
+	wm			\
+	interfaces 		\
+	$(PROXY_DIR)		\
+	$(LINUXONLY_DIRS)	\
+	$(TESTS_DIR)		\
+	patches			\
+	rules
+
+bin_SCRIPTS = directfb-config
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = directfb.pc directfb-internal.pc
+EXTRA_DIST = \
+	autogen.sh	\
+	fb.modes 		\
+	directfb.spec.in	\
+	directfb.spec
+
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+directfb-config: $(top_builddir)/config.status $(srcdir)/directfb-config.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+directfb.pc: $(top_builddir)/config.status $(srcdir)/directfb.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+directfb-internal.pc: $(top_builddir)/config.status $(srcdir)/directfb-internal.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+directfb.spec: $(top_builddir)/config.status $(srcdir)/directfb.spec.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f $$d$$p; then \
+	    f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	    echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	    $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+install-pkgconfigDATA: $(pkgconfig_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+
+uninstall-pkgconfigDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(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: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(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)
+	$(am__remove_distdir)
+	test -d $(distdir) || mkdir $(distdir)
+	@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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(SCRIPTS) $(DATA) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgconfigDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binSCRIPTS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-generic \
+	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+	dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
+	distclean distclean-generic distclean-hdr distclean-libtool \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binSCRIPTS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-binSCRIPTS \
+	uninstall-pkgconfigDATA
+
+
+# Generate the HTML API documentation:
+html:
+	make -C docs/html
+
+# Compile the directfb-csource utility:
+directfb-csource:
+	make -C tools directfb-csource
+
+.PHONY: html directfb-csource
+# 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/NEWS b/Source/DirectFB/NEWS
new file mode 100755
index 0000000..d73ee78
--- /dev/null
+++ b/Source/DirectFB/NEWS
@@ -0,0 +1,3626 @@
+1.4.0
+-----
+
+General bugfixes, code cleanups and memory leak plugging.
+
+Core
+- fix for possible segfault when unloading non-used input/gfx modules.
+- fbdev: Allow accelerator ID to be overridden by (existing) runtime option.
+- IDirectFBScreen::GetEncoderDescriptions: add enums for NTSC443 and 30Hz + 24Hz
+- font: DFFA_NOBITMAP will inhibit loading bitmaps if we have vector fonts too.
+
+Input
+- input: Implement driver_get_axis_info() in the linux-input driver
+- vt/keyboard: Flush console input when not used; avoids kernel waking up
+
+Gfx
+- add optional dithering when loading images into RGB16 surfaces
+- surface rotation: more complete support for 16-bit formats
+- sis315: support for XGI Z series chip, STRETCHBLIT, and big endian handling
+- matrox: use of BES guarantees atomic, tear-free triple buffering
+
+Tools
+- directfb-csource: add option to dither RGB16 images
+
+Build Environment
+- add missing include path for builddir != srcdir
+- libtool for modules: use -module instead of -export-dynamic, since we only dlopen.
+
+1.3.1
+-----
+
+Fusion
+- update to use new 'unified' fusion kernel module.
+  When using multi-app, please use fusion 8.1.1 or newer.
+- fixed skirmish wait argument not taken as msec but usec
+
+Config
+- added 'include' option, to include config files.
+- added config option to override module search dir.
+- read /proc/self/cmdline if DirectFBInit() does not receive argv/argc.
+- added option to override initial screen size.
+- Fix build when srcdir != builddir.
+
+Core
+- Added IDirectFBSurface::Read and ::Write
+- better out-of-memory error handling
+- fixed alpha handling for palette SetEntriesYUV
+- rectified changes to surface policy in case a surface is allocated again, of reallocated 
+- fixed memory leak in local "System Memory" pool when deallocating due to IDirectFB::Release
+- fix software blending bug when modifying both source and destination
+- IDirectFBDisplayLayer::SetSourceRectangle for non-scalable surfaces: change dst size too.
+- surfaces: Fixed missing initialization of bridge pointer, crashing when no bridge is available.
+- surfaces: clean-up local pool on 'leave' and 'destroy'
+- gfx: added RGBA4444 support
+- default font: Support premultiplied font formats.
+
+Direct
+- include ARM memcpy routines (big endian only)
+
+Documentation
+- added documentation for blend functions and some desktop-buffer-mode options
+- directfbrc.5: Document triple and windows desktop-buffer-mode options.
+
+Gfxsystems
+- matrox: Wrong chroma plane offset was being used with deinterlace blits.
+- omap: Added omapfb.h to release zipfile.
+- SH772x: LCD parameters not obtained via fbdev ioctl
+- SH772x: improved JPEG Encode/decode performance, JPEG fixes, JPU by default disabled due to conflicts
+- SH772x: detection broadened to SH772x revisions
+- unichrome: support for accel stretchblit YUV->RGB for CX700/M/2.
+
+Input
+- Fix possible array overruns
+- added direct_modules_unregister() when unloading the module
+- linuxinput: Fix LED handling, Count KEY_M
+- font loading: Support premultiplied font formats.
+- Video4Linux: add sources to release zipfile. Conform v4l and v4l2 to new core architecture.
+- zytronic: added zytronic touch screen driver.
+- vt: Move the keyboard XLATE/MEDIUMRAW handling to the vt code, to allow concurrent input.
+- input: correctly read modifiers for load_keymap
+- keyboard: added setting/loading of keyboard keymaps via IDirectFBInputDevice
+
+Systems
+- fbdev: Fixes for pan & zoom functionality
+- fbdev: corrected ioctl error handling: now stops on error.
+- fbdev: Test non-primary layer allocations
+- fbdev: use directfbrc for initial screen size, if specified.
+- x11: fixes for glx handling, additional logging
+- x11: Remember each GLXContext's drawable and set update flag only if it changed.
+- x11: Manage second GLX context per thread via another surface accessor ID.
+
+Tools
+- dfbdump: fixed to show correct buffer allocation sizes for certain formats.
+- dfbinfo: now shows multiple encoder types correctly
+
+Window Manager
+- default: Fix DLBM_TILE clipping
+- default: Fixed advanced blending with only DSBLIT_BLEND_COLORALPHA being used.
+- default: Added Meta-R for window rotation.
+
+
+1.3.0
+-----
+
+API | IDirectFBDisplayLayer
+- Added GetRotation() to query the layer rotation.
+
+API | IDirectFBSurface
+- Added DSBLIT_ROTATE90 and DSBLIT_ROTATE270. Thanks to Young Hoon for original patch!
+- Added DFBSurfaceHintFlags for optimized allocation, format selection etc.
+- Added DSDESC_HINTS to DFBSurfaceDescriptionFlags and 'hints' to DFBSurfaceDescription.
+- Implemented DSHF_FONT by selecting the configured font format and premultiplication.
+- Added DSCAPS_ROTATED to allocate back buffers with width/height swapped (unimplemented).
+
+API | IDirectFBWindow
+- Added SetRotation() for 90, 180 and 270 degree rotation per window.
+  Thanks to Young Hoon for the original patch!
+- Added sub window support with each sub window having its own surface (one level only for DirectFB 1.4)...
+- Added DWCAPS_SUBWINDOW, DWDESC_TOPLEVEL_ID and "toplevel_id" to DFBWindowDescription.
+  Manage ref to top level window and vector of sub windows in window core, but leave scaling,
+  translation and clipping of sub window bounds based on top level bounds to the WM module.
+- Added DWOP_FOLLOW_BOUNDS to make bounds follow the parent window (only for window association, sub windows always follow).
+
+Runtime Options
+- Allow '90' and '270' for "layer-rotate" option.
+
+Graphics Core
+- Implement proper clipping for rotated blits of 90, 180 or 270 degree.
+
+Layer Core
+- Implement layer rotation using DSCAPS_ROTATED if available, otherwise using rotated window stack.
+  With just a single buffer (frontonly), it always uses rotation of the window stack.
+  Thanks to Young Hoon for the original patch!
+- Added magic value to CoreLayerContext structure, improved debug messages.
+- Fixed missing lock on surface structure around dfb_surface_allocation_update() call.
+
+Surface Core
+- Added Surface Pool Bridge[tm] technology to speed up transfer between pools.
+  New API can be implemented to do optimized transfer from one surface pool to another.
+  CheckTransfer() is called to probe each registered CoreSurfacePoolBridge.
+  CoreSurfacePoolTransfer is allocated with one or more rectangles to be transfered.
+  StartTransfer() and FinishTransfer() are used to actually execute the transfer
+  which could be queued, but is synchronous at the moment (Start+Finish).
+- Implemented dfb_surface_buffer_write() using Write() on allocation.
+- New algorithm for finding the allocation which to Write() to, using last read
+  allocation or other up to date allocation.
+- Remember last read allocation for better negotiation in case of multiple up to
+  date allocations.
+- Implemented dfb_surface_buffer_read() using Read() on allocation
+- Added dfb_surface_buffer_lock_deinit(), moved out format conversion.
+
+Window Core
+- Added magic value to CoreWindow.
+- Set magic value in CoreWindow before calling WM functions.
+- Added lock and ref around dfb_wm_close_stack() in dfb_wm_close_all_stacks(), added context magic and lock assertions everywhere!
+
+Pixel Formats
+- Added dfb_convert_to_rgb24() and dfb_convert_to_a8(), used for surface dumps to .ppm files.
+
+Software Rendering
+- Started implementation of DSBLIT_ROTATE90, DSBLIT_ROTATE180 and DSBLIT_ROTATE270 for all blitting flags...
+- Disable MMX functions not supporting rotation (Ostep/Dstep) properly.
+
+Utilities
+- Added D_UTIL_SWAP(a,b) to exchange values.
+- Added dfb_region_from_rotated(), dfb_rectangle_from_rotated() and dfb_point_from_rotated_region().
+- Replaced dfb_back_to_front_copy_180() by dfb_back_to_front_copy_rotation() with extra argument.
+  Thanks to Young Hoon for the original patch!
+
+OpenGL Driver
+- New accelerated driver using OpenGL!
+
+PNG Image Provider
+- Use dfb_surface_write_buffer() if possible.
+
+Default WM
+- Implement stack rotation and window rotation, thanks to Young Hoon for the original patch!
+- In window_at_pointer() use dfb_surface_read_buffer() with 1x1 rectangle instead of lock/unlock.
+
+UniQuE WM
+- Added experimental border event handling in test_foo program to move/raise any window :)
+- Use dfb_surface_write_buffer() instead of lock/memcpy/unlock for border images (foo).
+- Unload foo surface (border tiles) during master shutdown.
+
+X11 System
+- Full featured OpenGL based acceleration via GLX!
+- Implemented Surface Pool Bridge for fast transfer between XShmImage and GLX pool.
+- Use XShmCreatePixmap() and XCopyArea() instead of XShmGet/PutImage() allowing partial transfers in both directions!
+- Also tried to make multi application working, but it seems that for an X11 Pixmap there can
+  only be one process doing a glXCreatePixmap() which also does not allow the GLXPixmap to be shared :(
+
+dfbdump tool
+- Show layer and window rotation.
+
+dfbtest_window tool
+- Added new program for testing window and sub window features :)
+- Added more options, window destroy test and proper cleanup.
+- Added test that hides the top level window and shows it again.
+- New option to pass window caps for top or sub window.
+- Enhanced testing and logging code. Run most tests on sub window, too.
+- Added advanced window geometry tests.
+- Added options for setting window options and for window association.
+- Implemented selection of individual tests for top/sub window and added option to wait at the end.
+
+
+1.2.6
+-----
+
+Core
+- Call fusion_stop_dispatcher() before destroying pools to fix lots of shutdown issues.
+
+WM Core
+- Lots of useful debug messages.
+
+libfusion
+- Added fusion_stop_dispatcher() to be called before destroying pools etc... fixing lots of shutdown issues!
+
+libdirect
+- Added direct_thread_wait() / _notify(), _lock(), _unlock() and _terminate().
+- Added some debug messages to DirectInterface code.
+
+Utilities
+- Added dfb_updates_get_rectangles() for convenience, doing bounding box trade off etc...
+
+X11 System
+- Fixed remaining crash with expose events that ran into a NULL window.
+
+
+1.2.5
+-----
+
+Fonts
+- Fixed alignment on eight byte boundary, thanks to Nikita Egorov!
+
+Software Rendering
+- Don't switch to fill rectangle in DrawLine() if matrix is used.
+
+SH772x
+- More fixes for JPEG encoding with up/down scaling and offset.
+
+
+1.2.4
+-----
+
+API | IDirectFBInputDevice
+- Added DFBInputDeviceAxisInfo(Flags) with DIAIF_ABS_MIN/MAX flags and abs_min/max fields.
+- Added DIEF_MIN/MAX and min/max to DFBInputEvent, e.g. for axis boundaries.
+
+API | IDirectFBWindow
+- Added DWCAPS_NOFOCUS: window will never get focus or receive key events, unless it grabs them.
+
+Runtime Options
+- New option "[no-]software-trace" to show every stage of the software rendering pipeline.
+
+Build Options
+- Switch to pkg-config for SDL and FreeType2, thanks to Keith Mok!
+
+Graphics Core
+- Only have DSRO_MATRIX be mandatory for now. Other flags no longer prohibit acceleration.
+  Worst case was when DSRO_SMOOTH_UP/DOWNSCALE was turned on globally via "smooth-upscale" or "smooth-downscale"
+  runtime option which caused all operations to use software fallbacks, not only StretchBlit()!
+
+Input Core
+- Added GetAxisInfo() to InputDriverFuncs to query information about one axis.
+  Make use of it in input_driver.h only if driver has defined DFB_INPUTDRIVER_HAS_AXIS_INFO
+  to avoid having to change all input drivers.
+- Query axis information from driver and put it into events.
+
+Layer Core
+- Set background mode of new contexts to DLBM_DONTCARE.
+
+Pixel Formats
+- Rewrote YCbCr<->RGB conversion routines without lookups which are much more expensive on embedded devices.
+- Fixed many NV12, NV16 and NV21 code areas, mostly for big endian.
+
+Software Rendering
+- Rewrote Dacc_RGB_to_YCbCr_C and Dacc_YCbCr_to_RGB_C using Duff's device with macros.
+  Conversion also supports 4:4:4 by this change, not optimizing for 4:2:x cases.
+- Get rid of YUV tables saving 5k binary size!
+- Added optimized Bop_argb_blend_alphachannel_one_invsrc_Aop_argb() -> 6x speed
+
+Utilities
+- Added exported dfb_pixelformat_names[] and replaced relevant code.
+
+libdirect
+- Important fix for having multiple interface implementations in one module.
+- Added file and symbol lookup functions to trace code for external usage.
+  New functions are direct_trace_lookup_file(), direct_trace_lookup_symbol() and
+  a convenience function combining the above called direct_trace_lookup_symbol_at().
+- Fixed missing magic value in thread structure created for non-direct threads.
+
+Davinci Driver
+- In ARGB OSD dithering use task buffer and add missing locks.
+- Raise OSD surface pool priority to allocate in frame buffer rather than /dev/mem.
+- Workaround broken DSP cache invalidation function.
+
+SH7722 Driver
+- Build only for SH4.
+- Fixed missing update of rendering destination buffer.
+- Fixes for JPEG encoding with conversion, cleanups...
+- Fixed software fallback for JPEG decoding to unsupported formats.
+
+SH7723 Driver
+- Added support for SH7723 to SH7722 driver and kernel module.
+
+Default WM
+- Use min/max values from absolute axis motion events if present.
+- Implemented DWCAPS_NOFOCUS.
+
+X11 System
+- Update X11 system module with cleaned up code from 1.3.x.
+- Fixes in input driver and layer output.
+
+JPEG Image Provider
+- Fix direct decoding to NV16 (no to+from RGB) for little endian.
+
+dfbtest_blit
+- Added test program for (Stretch)Blit with an image from file.
+
+
+1.2.3
+-----
+
+X11 System
+- Fixed new bug with reopening X11 window when layer resizes.
+
+
+1.2.2
+-----
+
+API | IDirectFBSurface
+- Added missing layer context locking around dfb_wm_get_insets() in IDirectFBSurface_Window_Construct().
+
+API | IDirectFBWindow
+- Added missing locks around direct dfb_wm_... calls...
+
+API | Utilities
+- Generate name/value pairs for DFBWindowCapabilities and DFBWindowOptions.
+
+Layer Core
+- Fixed failing context lock assertion in dfb_wm_close_stack() by locking in context destructor.
+- Added debug message to print context being returned by dfb_layer_get_active_context().
+
+Window Core
+- Avoid recursive dfb_wm_close_stack() caused by SaWMan's CloseStack() unref on the layer region.
+  This issue happens only in single app build, where the layer region constructor gets called synchronously
+  and destroys the window stack structure before the dfb_wm_close_stack() has finished.
+  Fixed by calling CloseStack() at the end dfb_wm_close_stack(), moving the list removal and flag clearing
+  before the call and freeing the stack data in dfb_windowstack_destroy() or recurring dfb_wm_init_stack().
+- Fixed crash in window destructor caused by (un)locking the stack.
+- In dfb_wm_close_all_stacks() lock each context and temporarily ref it for following unlock.
+
+libdirect
+- Added DirectUnregisterInterface() and destructor to call it.
+- Added magic value to interface implementation structure and use D_CALLOC/D_FREE.
+
+libfusion
+- Fixed single app skirmish lock counting (copy'n'paste bug).
+
+Default WM
+- Avoid most of the recursive calls of wind_of_change().
+- Make sure window has a surface before restoring its size when disabling scaling.
+
+X11 System
+- Fixed race condition and X error when switching resolution quickly.
+- Implemented primaryRemoveRegion() with a new call to destroy the X11 window.
+- Improve shutdown behaviour of X11 module.
+  Certain race conditions at shutdown prevented, leading to lock or crash.
+  x11input and x11 modules combined into one.
+
+dfbmaster tool
+- Added very simple dedicated master for safety, stability or enhanced testing pleasure.
+
+
+1.2.1
+-----
+
+API | IDirectFBSurface
+- Added MakeSubSurface() to make this surface a sub surface or adjust the rectangle of this sub surface.
+- Fix Lock() on layer surfaces with system memory back buffer.
+  This reverts commit 4cc82baddbc3a9849c2ff6c4979a65bcfb6ba96b and fixes
+  GetFramebufferOffset() properly by not adding CSAF_GPU_READ in Lock(), but
+  checking if there's a physical address provided by the surface pool via the
+  buffer lock in GetFramebufferOffset().
+
+API | IDirectFBImageProvider
+- Added simple WriteBack() method for encoding surface data.
+
+Runtime Options
+- New option "warn=<event:params>" to print warnings on surface/window creation or surface buffer allocations.
+  Example: 'warn = allocate-buffer:300x300' - Prints a warning for every surface buffer allocation made with
+  both width and height of 300 or above.
+- Added "keep-accumulators = <limit>" to allow freeing of accumulators above the limit.
+  Setting -1 never frees accumulators until the state is destroyed (previous behaviour).
+  The default is 1024 which already means up to 16kB are kept!
+- Allocate palette on demand saving 16kB of the 60kB allocated until after DirectFBCreate().
+
+Layer Core
+- Fix failing assertion due to recent code cleanup.
+
+Surface Core
+- Cleanup complex assertions, no CORE_SURFACE_ALLOCATION_ASSERT within CORE_SURFACE_BUFFER_LOCK_ASSERT, only D_ASSERTs.
+- A bit more debug when locking buffers.
+- Use convenience functions where possible, e.g. dfb_surface_lock_buffer() instead of dfb_surface_get_buffer()
+  and dfb_surface_buffer_lock() etc.
+- Implemented strategy for surface allocations when pools are out of memory.
+- Extended dfb_surface_pools_negotiate() to return a list of capable pools order by priority
+  including pools out of memory at the end of the list.
+- Added MuckOut() to the surface pool API to tag all allocations for removal to free up memory
+  for a new allocation. If not provided by the pool, a fallback implementation will do the job,
+  but that's not implemented yet.
+- Added dfb_surface_pool_displace() to muck out and backup allocations and do the new allocation.
+- Moved allocate_buffer() from surface buffer to surface pool code as dfb_surface_pools_allocate()
+  with extended negotiation using a list of possible pools and with ability to muck out allocations.
+- Changed static update_allocation() to exported dfb_surface_allocation_update().
+- Added dfb_surface_trylock() for a fusion_skirmish_swoop() on the surface lock.
+- Call dfb_surface_lock() and dfb_surface_unlock() in surface_destructor().
+- Moved surface core initialization before system module to have generic pools always at
+  the same position (with the same pool IDs).
+- Keep an ordered list of surface pool IDs based on priority.
+- Have a pointer to a backup pool in every pool which is set to the shared memory surface pool by default.
+- Enhanced backup strategy when mucking out allocations.
+- First check if any of the existing allocations is up to date,
+  otherwise try to update one of the existing allocations.
+- Enforce same order of joining pools as of initializing them.
+- Fixed invalid 'buffer->written' allocation pointer when using "thrifty-surface-buffers" option.
+- Fixed wrong order of joining surface pools in slaves.
+- Fixes for mucking out multiple allocations.
+- Use fusion_ref_set_name() to show the same info as with the skirmish.
+- Cleanup buffer initialization and reset with two new convenience functions.
+- Other fixes and enhanced debugging output.
+
+Surface Manager (FBDev, DevMem, X11 Virtual Physical testing pool)
+- Enhancements to surface manager code and fixes for old behaviour (without virtual physical surface pool).
+- Extend dfb_surfacemanager_displace() to check policies, reimplement toleration code
+  and take free space before and after an occupied chunk into account.
+- Cleanup dfb_surfacemanager_allocate() to only check for free chunks.
+- Always initialize x11(Shm)Image surface pool, regardless of virtual physical surface pool being enabled.
+- Never fail in x11TestConfig() if virtual physical surface pool is not enabled,
+  but use Fusion shared memory allocations as a fallback (previous behaviour).
+- Update allocation size from chunk length which is usually bigger (at least 16 bytes of safety area).
+- Enhance surface manager to find the best matching group of allocations to muck out.
+- This is the first time multiple smaller allocations can be mucked out for a bigger one.
+  The code that determines these allocations is still O(1) and finds the best matching
+  group within all possible combinations.
+
+Window Core
+- Shutdown fixes in the window management and new flags for the state of the stack.
+- Added CoreWindowStackFlags with CWSF_INITIALIZED and CWSF_ACTIVATED to CoreWindowStack.
+- In dfb_wm_close_all_stacks() simply call dfb_wm_close_stack() for any stack with CWSF_INITIALIZED set.
+  The previous code did only half of it, just clearing context->stack pointer and clearing the magic value
+  resulting in the notification handler for the background image accessing a stack structure without magic.
+- In dfb_wm_close_stack() first deactivate the stack if CWSF_ACTIVATED is set.
+- Safe state handling in dfb_wm_set_active().
+- Moved magic value set/clear from wm.c to windowstack.c where the structure is allocated and freed.
+- Check return value of dfb_wm_init_stack().
+
+libfusion
+- Fixed dead lock with references in single app mode. fusion_ref_zero_lock() no longer leaves the mutex locked.
+  Turned 'waiting' into 'locked' to keep size for binary compatibility.
+- Print warning for FUSION_CALL_RETURN if caller could not receive result due to a signal.
+- Clear object list (pointer to NULL) after cleanup for safety.
+- Added fusion_ref_set_name(), e.g. for better debug information on object references.
+
+Conversion
+- Added conversion to RGB555 and from AYUV (added to all conversion functions).
+
+SH7722 Driver
+- Added hardware JPEG encoding support, code moved into library, JPEG lock and buffer allocation in kernel
+
+VMWare Driver
+- Fixed copy'n'paste bug in virtual driver.
+
+Keyboard Input Driver
+- Only become active if FBDev or DevMem is used to avoid grabbing keyboard from X11 for example.
+
+DevMem System
+- Partially reverted cleanup of surface manager code. The workaround for the surface manager creation happening before
+  graphics driver initialization with possible dfb_gfxcard_reserve_memory() calls is still required.
+- Update surface manager code from X11 virtual physical testing pool.
+
+FBDev System
+- Update surface manager code from X11 virtual physical testing pool.
+
+X11 System
+- Take first matching visual for each format instead of last and handle RGB32 and ARGB separately (depth 24 and 32).
+- Fixed bytes per pixel and pitch calculation for fallback XCreateImage() when no XShm is available.
+- Output ARGB when depth is 32, support AYUV input (layer format).
+- XShm fixes and new virtual physical surface pool for development and testing.
+- Specifying 'video-length = <bytes>' option will create a shared memory block of that
+  size and initialize a surface pool with a surface manager supporting the new MuckOut() call.
+- Changed x11(Shm)Image pool to only allow allocations for supported visuals (no fallback
+  shared memory allocations) when the new option is used.
+- Return accelerator ID 51 for testing with the virtual acceleration (currently called vmware).
+- Make usage of XShmQueryVersion() to check for XShm support.
+- Return accelerator as set in config.
+- Set buffer lock offset in fallback mode to satisfy assumption in surface core.
+- Other cleanups and fixes.
+
+dfbdump tool
+- Show capacity in pool info (with "-p") and only dump shared or explicitly specified surfaces to avoid crashes.
+
+dfblayer tool
+- Add testing Lock() with read/write, read only or write only.
+
+
+1.2.0
+-----
+
+Overall
+- Minor fixes and cleanups, fixed compiler warnings etc.
+- Debugging messages and utility macros have been added.
+
+API | IDirectFB
+- Added sanity limit of 20480x20480 to CreateSurface().
+- Fixed input device enumeration and event collection for devices without caps.
+
+API | IDirectFBFont
+- Bug fixes in GetStringBreak(), thanks to Keith Mok!
+
+API | IDirectFBSurface
+- Don't build hierarchy of sub surfaces internally, if start-stop is not used (speeds up sub surface construct/destruct).
+- Optimized DrawLines() to use rectangle filling if all lines are horizontal/vertical.
+  This allows hardware acceleration to be used, e.g. in GTK+ using gdk_directfb_draw_segments() a lot with
+  only horizontal and vertical lines for widgets.
+
+API | IDirectFBVideoProvider
+- Fixed copy'n'paste(?) bug in SetStreamAttributes() argument.
+  The argument was DFBStreamDescription, but obviously should be DFBStreamAttributes.
+
+Pixel Formats
+- Added BGR555 as a new pixel format, thanks to GARDET Guillaume!
+
+Runtime Options
+- Added "[no-]cursor-updates" to never show a cursor, but still handle it.
+- New runtime option "thread-priority-scale=<100th>" to apply a scaling factor on thread type based priorities.
+
+Graphics Core
+- Removed dfb_gfxcard_sync() call from slave leaving procedure.
+- Added CCF_RENDEROPTS that needs to be set by the driver to allow acceleration when != DSRO_NONE.
+
+Input Core
+- Only suspend the input core during shutdown if it has been initialized already.
+- If a device has no caps at all, let it match with any caps being requested.
+
+Layer Core
+- Added CLRCF_FREEZE for dfb_layer_region_set_configuration() to set CLRSF_FROZEN.
+  Changes are not applied until dfb_layer_region_flip_update() is called.
+- Check if region surface is system only and avoid using CSAF_GPU_READ which would fail.
+- Keep a list of window stacks, added dfb_wm_close_all_stacks() called early during core shutdown.
+
+Software fallbacks
+- Dacc_premultiply_color_alpha() also needs Cacc.a to be set, thanks to Mandy Wu for spotting!
+
+libdirect
+- Important Fix: Actual realloc() was missing in runtime-disabled debug mode (default).
+- Remove check on element in direct_list_contains_element_EXPENSIVE() used for debugging.
+  When checking for existence in a list, avoid crashes due to already freed elements being passed
+  in as a pointer and checked for existence in a list.
+
+TI Davinci driver
+- Added scaling support to video layer using the Davinci Resizer.
+- Added local task buffer for preparing a list of commands and send at once (CPU load reduced).
+- Fixed timeout detection in DAVINCI_IOCTL_WAIT_LOW.
+- Fix kernel module Makefile for newer kernels.
+- Use FBIO_GET_TIMING to query screen size.
+- Build and install a library and header files.
+- Update allocations during Lock().
+- Allow external definition of DAVINCI_C64X_IDLE_MAX for c64xdump tool.
+- Added lots of debug messages to 2D acceleration.
+- Set StretchBlit() hook statically.
+- Replaced all hard coded addressing of 32MB DSP working area by DAVINCI_C64X_MEM.
+  DAVINCI_C64X_MEM is defined in <linux/c64x.h> to be 0x8e000000 if not defined from outside.
+- Moved call to set buffer start address to videoUpdateRegion().
+  Also made videoSetRegion() very lightweight, e.g. when only the surface is changed.
+- Commented out davinci_c64x_write_back_all() in EngineSync() which is still not working properly anyhow.
+
+CirrusLogic EP9xx
+- New driver, thanks to Brian Austin!
+
+DGIFF Font
+- Revival of the DGIFF (DirectFB Glyph Image File Format). Thanks to Vaclav Slavik!
+
+FBDev System
+- Ignore panning errors as before.
+
+X11 System
+- Fixed double wheel events by discarding ButtonUps.
+- Added missing check of layer pixel format based on conversion routines available.
+- Don't use XShm for offscreen surfaces, but always use Fusion SHM.
+
+Keyboard Input driver
+- Make driver usable without fbdev/vt just for the sake of a keymap.
+
+Linux Input driver
+- Thanks to Phil Endecott for adding F13 to F24 support!
+
+directfb-config
+- Teach directfb-config about SYSROOT and removes -L/usr/X11R6/lib, thanks to Marc Kleine-Budde!
+
+
+1.2.0-rc1
+---------
+
+API | IDirectFBSurface
+- Added IDirectFBSurface::SetSourceMask() - yes, a third blitting operand :)
+- Added DSBLIT_SRC_MASK_ALPHA to modulate source alpha channel with alpha channel from source mask.
+- Added DSBLIT_SRC_MASK_COLOR to modulate source color channels with color channels from source mask.
+- Added SetSourceMask() with a surface argument plus x/y offset and flags.
+- Added DFBSurfaceMaskFlags with DSMF_STENCIL to make x/y offset absolute and always start at a
+  fixed position in the mask, otherwise x/y from the Blit() are added.
+- Allow second string (prefix) in Dump() to be NULL to dump without numbering.
+- Added FillTriangles().
+- Changed SetMatrix() to take a 3x3 matrix.
+
+API | IDirectFBEventBuffer
+- Don't allow posting of universal events bigger than DFBEvent.
+
+API | IDirectFBImageProvider
+- Don't fail if PeekData() is not supported, same behaviour as video providers...
+
+API | IDirectFBVideoProvider
+- New events and SetAudioDelay(). Thanks to Daniel J Laird!
+- Applied patch from Daniel Laird adding buffer threshold control/notifications. Thanks!
+
+Runtime Options
+- Added option "[no-]software-warn" to show warnings when doing/dropping software operations.
+  No longer print a warning when software fallbacks are disabled. Use the new option!
+- Added "[no-]fatal-break", d_debug_at() and direct_debug_at_always().
+- Added option "surface-shmpool-size=<kb>" to set the size of the shared memory pool
+  used for shared system memory surfaces.
+- Added options to set default priority, policy and stack size for threads.
+- Don't enable mouse motion compression at input drivers by default.
+- New runtime option "quiet=<type>" to disable only certain message types.
+  Thanks to Niels Roest!
+
+Build Options
+- Added "--without-software" to save 100k+ binary size if really not needed.
+- Fixed typo in X11 detection.
+
+libdirect
+- Added extensible result codes and made other fixes to ban <directfb.h> from libdirect and others.
+- Made DirectResult the primary type for result codes.
+- Added D_RESULT_TYPE_BASE, D_RESULT_TYPE_MAX and D_RESULT_TYPE_IS for extended result codes.
+- Changed most of DFB_ codes to be assigned the corresponding DR_ code.
+- Three DirectFB specific codes remain, after DFB__RESULT_OFFSET defined as D_RESULT_TYPE_BASE('D','F','B').
+- Added DirectEnumerationResult.
+- Further cleanup of debugging code. New minimal debug mode
+  to support D_DEBUG_AT, D_ASSERT and D_ASSUME when debug support is
+  disabled, but DIRECT_ENABLE_DEBUG or DIRECT_FORCE_DEBUG have been
+  defined. No domain filters, just formatted output (all or nothing).
+- Fixed 'log-file' and 'log-udp' option.
+- Strip off "lt-" at the beginning of a program name (for config file).
+- Fixed allocation debugging always being used when available.
+
+libfusion
+- Check whether mount point is writable in find_tmpfs().
+- Implemented lock counter in single app build.
+- Added fusion_world_get_fork_action() and fusion_world_set_fork_callback().
+
+Graphics Core
+- Added mask of clipped functions to internal CardCapabilities (gfx drivers).
+  Instead of providing clipping for none or for all functions (CCF_CLIPPING) a driver
+  can set individual functions to be hardware clipped, e.g. DFXL_STRETCHBLIT where
+  clipping is crucial.
+- Added minimum glyph alignment of 8 bytes.
+- Fixed state handling bug causing wrong acceleration masks.
+- Added special graphics state debug messages in domain "Core/GfxState".
+- Added dfb_line_segment_intersect().
+  Gets the intersection point between a line and segment within the given segment.
+- Implemented (real) triangle clipping.
+- Started implementing affine transformations in software.
+- Also fixed incorrect clipping when DSRO_MATRIX is set.
+- Added support for affine transformations to dfb_gfxcard_draw_string().
+  Actually this is done by using gStretchBlit.
+  Direct glyph transformation (done by the font provider) would be better.
+
+Input Core
+- Added dfb_input_event_type_name() and event debug at Core/Input/Evt.
+- Fix crashes during shutdown by suspending the input core before shutting down anything.
+
+Layer Core
+- Only sync with accelerator in dfb_layer_region_flip_update() when DSFLIP_PIPELINE is not set.
+
+Surface Core
+- Support NV16 in dfb_surface_dump() and so IDirectFBSurface::Dump().
+- Added size field to description for pools with a defined maximum.
+- Added CORE_SURFACE_BUFFER_LOCK_ASSERT(lock) and CORE_SURFACE_ALLOCATION_ASSERT(lock).
+  These two macros are consisting of assertions for all they could check.
+
+Software Renderer
+- Print blend funcs in warning caused by 'no-software'.
+- Allow DSBLIT_SRC_PREMULTIPLY while scaling from indexed to alpha formats.
+- Scaling an image which has alpha values != 255 (non-premultiplied) now produces
+  premultiplied output (smooth scaling only). Support for non-indexed sources still
+  needs to be added.
+
+nVidia driver
+- Implemented affine transformations.
+- In case of unsupported arch (NV40), skip objects and fifo setup.
+- Cleanup overlay code. Enbale using NV12 (requires NV30 or newer).
+- Fixed buggy vertices formation in TextureTriangles.
+
+Radeon driver
+- Implemented affine transformation (all cards) and source masking (R100/R200 only).
+- Implemented antialiasing (R100 and R200 only).
+- Fixed conversion+blend with A8 destination.
+- Use LINE primitive for transformed DrawRectangle.
+- Use POINT primitive for 1x1 rectangles.
+- Implemented DSPF_DSTALPHA/INVDSTALPHA for A8.
+- Implemented DSBLIT_SRC_PREMULTIPLY (R100/R200 only).
+- Emit transformed rectangle using TRIANGLE_LIST instead of TRIANGLE_FAN.
+
+SH7722 driver
+- JPEG decoding, supports NV12 and NV16 (4:2:0 and 4:2:2 images)
+- Use VEU for scaling and format conversion of JPEG decoded data (line buffer mode).
+  Supports 4:2:0 and 4:2:2 to NV12, NV16, RGB16, RGB24, RGB32.
+- Implemented LUT8 support for the third layer. Added lock for BEU code called for different layers.
+- Automatic parent input system selection and other fixes, allowing to run df_fire on third and df_dok
+  with alpha channel on first layer.
+- Implemented XOR for drawing and blitting.
+- Implemented DSBLIT_SRC_MASK_ALPHA, cleaned up and optimized state handling.
+- Fixed byte swapping issues, e.g. no more swapping between BEU and LCDC, correct swapping of BEU input
+  depending on number of bytes per pixel.
+
+TI Davinci driver
+- More acceleration (StretchBlit for ARGB, ARGB/RGB32->RGB16 conversion and FillRectangle() blending).
+- Added colorizing support to blend functions. No additional cycles in DSP :)
+- Added properly clipped (phases!) StretchBlit() for ARGB and RGB32 without any blitting flags.
+- Added ARGB/RGB32 conversion to RGB16 without any flags (currently writing alpha data to scratch area).
+- Real IRQ based synchronization, optimization for opaque filled rectangles.
+- Fixed color calculation for filling/drawing to UYVY.
+- Allow explicit driver usage without probing by setting accelerator id to 6400.
+- Suppress errors of custom ioctls for now.
+- Added small tool c64xdump for showing DSP status (queues, load).
+- Further DSP interface updates and cleanups.
+- Work around missing alpha plane pitch setting (when differing from RGB plane).
+  The DSP function needs to be extended to fix it properly.
+- Patch from Eric Nelson to support HD OSD planes.
+
+Linux Input driver
+- Set DIEF_FOLLOW on all events known not to be the last.
+
+FBDev system module
+- Don't pan at all when it's not supported by the device.
+- Important fixes for mode switching, restructuring and cleanup.
+  Still not working again is support for virtual resolutions with panning,
+  not double/triple buffering which works.
+
+SDL system module
+- Fix mode switching/surface creation, having working accelerated SDL backend again.
+
+X11 system module
+- Bring in line with 1.0 features, expose handler, format conversion, SHM, SMP 8-)
+- Fixed threading issues using XLock/UnlockDisplay().
+- Use XNextEvent() again instead of usleep() based polling after fixes.
+  Pull up to 100 events per round, i.e. until accumulated motion events
+  are flushed and thread exit status is checked.
+- Send ClientMessage to wake up thread from blocking XNextEvent().
+- Reduced invisible 16x16 cursor to 1x1, minor cleanups.
+
+Default WM
+- Combine multiple x and/or y motion events before sending events or updating the cursor.
+  This is a better way as opposed to have the driver do the work,
+  otherwise there was too much cursor acceleration in such a case.
+
+JPEG Image Provider
+- Implemented directly loading to NV16 surfaces staying in YCbCr space.
+
+dfbdump tool
+- Added option "-ds" for dumping surfaces.
+- Show buffers' lock status again.
+
+dfbinfo tool
+- Show min/max keycodes.
+
+dfbinspector tool
+- Added dfbinspector as a small C app (graphics driver capability probing).
+
+gendoc tool
+- Lots of improvements to parser and generated documentation.
+
+
+1.1.1
+-----
+
+API
+- Added 3x2 transformation for all drawing and blitting.
+- Added render option DSRO_MATRIX and IDirectFBSurface::SetMatrix().
+  The matrix consists of 3x2 fixed point 16.16 values. The order in the array is from left to right and from top to bottom.
+  All drawing and blitting will be transformed:
+  X' = X * v0 + Y * v1 + v2
+  Y' = X * v3 + Y * v4 + v5
+- Added DSRO_ANTIALIAS to enable anti-aliasing for edges, lines...
+
+API | IDirectFB
+- Added DSCAPS_SHARED for creating shared surfaces, not using local (malloced) memory pool.
+
+API | IDirectFBDisplayLayer
+- Added DFBDisplayLayerSourceCaps featuring DDLSCAPS_SURFACE.
+- Added resource_id to DFBWindowDescription and DWDESC_RESOURCE_ID to
+  specify the resource id to use for window surface creation, rather
+  than using the window id for that.
+
+API | IDirectFBFont
+- Fixed missing translation of characters to indices in GetKerning().
+
+API | IDirectFBSurface
+- Added DSBLIT_COLORKEY_PROTECT to prohibit writing the color that the destination surface uses as a source color key.
+- Fixed GetFramebufferOffset() by adding CSAF_GPU_READ when Lock() is called on a DSCAPS_VIDEOONLY surface.
+
+API | IDirectFBVideoProvider
+- Added DVPET_FINISHED, sent when playback is finished.
+- Added DVPET_SURFACECHANGE, sent when size/format change.
+
+Runtime Options
+- Added "[no-]autoflip-window" to automatically flip non-flipping windowed primary surfaces.
+  Previously, the default was to automatically Flip() in a thread. Now it's not.
+- Added "[no-]font-premult" for premultiplication in case of ARGB glyph images. Default is enabled.
+- Added "[no-]linux-input-grab" that will control whether linux_input will grab the devices. This is
+  useful in cases where multiple processes want to receive input events.
+- Added "linux-input-devices" and "tslib-devices" options.
+- Added "no-init-layer [= <id>]" option to disable initialization of layers.
+  Primary layer is initialized by default, use this option to avoid that.
+- Added "[no-]thread-block-signals".
+- Fix background color index support.
+- Fixed missing color key flags when only index is set via config file.
+- Reimplemented "thrifty-surface-buffers".
+
+Build Options
+- Added "--with-smooth-scaling", turned off by default to avoid 100k+ binary size increase.
+
+Display Core
+- Implemented defered region realization by adding CLRSF_FROZEN which is set initially on every region that is created.
+- As long as CLRSF_FROZEN is set, all SetRegion() calls to the driver (and buffer allocations due to it) are simply discarded.
+- Only when dfb_layer_region_flip_update() is called and the region is enabled and active, the flag is removed and the region
+  is either realized or the config is just set if it was already/still realized.
+- Added GetMixerState() to screen driver API and dfb_screen_get_layer_dimension() to be used
+  instead of the deprecated dfb_screen_get_screen_size().
+- Added capabilities for display layer sources. Check source capabilities if present when determining
+  whether to allocate a surface for a layer region. This allows to add layer sources in addition to DLSID_SURFACE
+  that have a surface without using DLCAPS_SURFACE which enables surfaces for all sources.
+- Deallocate layer region surface buffers if the region is being unrealized.
+- Made DisplayLayerFuncs const when being passed or used.
+- When switching to an indexed layer format, use dfb_surface_init_palette() if no palette exists already.
+
+Graphics Core
+- Added dfb_gfxcard_get_driver_data().
+- If alpha is zero, still check for RGB when looking up the best match in a palette.
+- When resetting the 'checked' flags also reset the same in 'accel' flags. Fixes accidental hw usage.
+- Skip prechecking clip in FillRectangles() if DSRO_MATRIX is used. Other functions are also affected, but not fixed yet.
+
+Surface Core
+- Fixes to CPU/GPU read/write access interlock management.
+- Added dfb_surface_buffer_dump() implementation.
+- Fixed lock+reconfig bug: fail when trying to reconfig a locked surface.
+- Added convenience functions dfb_surface_read/write_buffer() and dfb_surface_dump_buffer().
+- Moved surface palette creation from dfb_surface_create() into new dfb_surface_init_palette().
+- Added CSALF_PREALLOCATED. The "thrifty-surface-buffers" option is implemented by iterating through all allocations
+  at the end of an update_allocation() and deallocate all other allocations, unless they have the CSALF_PREALLOCATED flag.
+  In the latter case it would not be a benefit, but the disadvantage of losing an allocation that is still up to date and
+  would probably be faster (CPU read) than others. The 'preallocated' surface pool sets CSALF_PREALLOCATED upon allocation.
+- Another flag CSALF_VOLATILE has been introduced. In case of a write access to one allocation, any other
+  allocation is deallocated if it has the flag. This is independent of the "thrifty-surface-buffers" option.
+  The 'local', 'shared' and 'preallocated' surface pools set CSALF_VOLATILE upon allocation.
+
+Window Core
+- Refuse to set non-shared surfaces as a background image for a window stack.
+
+Software Render
+- Added LUT8 -> ARGB4444 smooth scaling.
+- Made smooth scaling support source rectangles not starting at 0,0.
+- Fast RGB32/ARGB to RGB16 conversion (little endian).
+
+Utilities
+- Added dfb_convert_to_a4() and added RGB32/ARGB support to dfb_convert_to_rgb16().
+- Added dfb_convert_to_uyvy() and dfb_convert_to_yuy2(), only copy supported yet.
+
+libdirect
+- Added direct_cleanup_handler_{add/remove} to install a cleanup handler called upon exit.
+- Added direct_page_align().
+- Added mutex and condition for thread initialization to eliminate sched_yield()s.
+- Improved debug messages in thread code. Added "Direct/Thread/Init" domain to watch creation, wait,
+  startup, initialization, notification ...
+- Initialize libdirect in DirectFBCreate() already.
+- Added new URI fd:/<fileno>. Used to create a DirectStream from an already opened file descriptor.
+- Added direct_log_lock()/unlock() for ensuring multiple prints are not mixed with others.
+- Use direct_log_lock()/unlock() to ensure stack traces are one contiguous block.
+- Added sanity checks in build header if debug support is disabled.
+  If DIRECT_ENABLE_DEBUG is defined, silently undefine it.
+  If DIRECT_FORCE_DEBUG is define, show a warning and undefine it.
+- Do not use PAGE_SIZE at all on Linux, thanks to Guillem Jover.
+- Do not leak private labraries for dynamic linking, thanks to Guillem Jover.
+
+libdirect (network support)
+- Join multicast group if family is AF_INET and IN_MULTICAST is true.
+- Use bind() instead of connect() for receiving UDP data.
+- Use SO_REUSEADDR in case of multicast.
+
+libfusion
+- Print an alert message when using builtin implementation of fusion.
+- Moved FUSION_ID_MASTER definition to types.h.
+- Fix missing fusion_shm_enum_pools() for single app core.
+- Added fusion_reactor_set_name() to change the name of a reactor after its creation.
+- Implemented fusion_reactor_set_dispatch_callback().
+- (Pre)Parse shmfile group in fusion_config_set().
+- Added "ramfs" to possible types during mount point probing.
+
+libfusion (builtin multi)
+- Provide a REAL implementation of fusion_skirmish_wait/notify().
+- Always free resources allocated in builtin implementation of fusion_skirmish_wait(), either if the skirmish was destroyed.
+- Check for dead local references in fusion_ref_zero_lock()/trylock().
+- Return DFB_NOSHAREDMEMORY if requested allocation exceeds the maximum address of the shm pool.
+- When fusion_skirmish_wait() gets called with a timeout value, check whether the timeout expired *before* sleeping.
+- Use fusion_skirmish_wait() instead of usleep() in fusion_ref_zerolock().
+- In fusion_ref_zerolock(): check local references before entering the loop.
+- Check for dead property purchaser.
+- Honor FCEF_ONEWAY in fusion_call_execute(). Execute ref watcher with the FCEF_ONEWAY flag.
+- Fail in fusion_skirmish_notify() if skirmish was destroyed. Sleep for at least 10ms in fusion_skirmish_prevail().
+- Enable sleeping in fusion_property_lease()/purchase().
+- Moved socket directory from "/tmp/fusion.#" to "/tmp/.fusion-#".
+- Change socket ownership according to shmfile group.
+- Speed up fusion_call_execute(FCEF_ONEWAY) by not creating a new socket.
+- chown() the sockets directory according to "shmfile-group".
+
+Voodoo
+- Implemented some more requestor/dispatcher methods.
+- Fixed alignment issues by applying VOODOO_MSG_ALIGN() on each message block.
+
+Graphics drivers
+- Port ati128, cle266, cyber5k, i810, i830, neomagic, nsc, savage, sis315, tdfx, unichrome to the new surface core. Only compile tested.
+
+Radeon driver
+- Instead of emitting vertices instantly, store them in a buffer that is submitted on EmitCommands() (this way DrawString() is about 45% faster with my 9200SE).
+- R100/R200: Dropped some blend functions when destination format is A8 ((INV)DEST alpha never worked because A8 isn't really supported as dest format).
+- R300: Implemented BLEND_COLORALPHA, COLORIZE, PREMULTCOLOR with some limitations (source must be premultiplied and COLORALPHA+ALPHABLEND isn't supported at all).
+- Sleep for 10 usec in WaitVSync loop.
+
+nVidia driver
+- Fixed texture uploading: use the current surface lock instead of locking again.
+- Replaced state->modified by state->mod_hw.
+- Disabled some features not working with the new surface core.
+- Sleep for 10 usec in WaitVSync loop.
+
+Renesas SH7722 driver
+- Added driver for SH7722 SoC from Renesas Solutions Corp.
+- Supports DrawString(), FillRectangle(), DrawRectangle(), FillTriangle(), DrawLine(), FillSpans(), Blit() and StretchBlit().
+- Supports DSDRAW_BLEND, DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_BLEND_COLORALPHA, DSBLIT_SRC_COLORKEY, DSBLIT_ROTATE180 and DSBLIT_COLORIZE.
+- Use hardware 3x2 matrix to implement DSRO_MATRIX for all blitting and most drawing.
+- Transform coordinates in driver for DrawLine() and DrawRectangle().
+- Implemented DSRO_ANTIALIAS for all drawing operations.
+- The hardware provides "anti-aliased" lines by drawing a line with doubled pixel width (minor axis). This should be drawn with
+  a transparency factor. Finally the original line is drawn on top of this.
+- For filled rectangles and triangles, only the double width line is drawn and then the shape is filled.
+
+TI Davinci
+- Added TI Davinci driver.
+- Supports OSD and Video with positioning, color key, opacity, alpha channel and vsync.
+- The driver uses the devmem system and opens all frame buffer devices itself.
+  This is required for extended ioctls like setting the OSD position, but also to
+  support alpha channels which are stored in a different frame buffer device. In
+  case of ARGB for the OSD, the alpha channel (3 bit!) is dithered during conversion.
+- Implemented surface pools for OSD and Video layer. This enables direct usage
+  of the frame buffers in case of RGB16 for OSD and UYVY for Video.
+- Added patch for davincifb to support triple buffering on OSD.
+- Hardware acceleration using the DSP with a special firmware and kernel module.
+- Driver still runs without DSP module, but unaccelerated.
+- Supports DrawString(), FillRectangle(), FillSpans() and Blit().
+- Supports DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_BLEND_COLORALPHA, DSBLIT_SRC_COLORKEY, DSBLIT_SRC_PREMULTIPLY and DSBLIT_SRC_PREMULTCOLOR.
+- Supports RGB16, RGB32 and UYVY for simple filling and blitting with color keying.
+- Supports ARGB for blending and premultiplication.
+- No support for different source and destination formats.
+- No support for color keying in conjunction with blending.
+- DrawString() is not colorized yet, but enabled for testing (all text is white).
+
+TI OMAP driver
+- Added TI OMAP gfxdriver.
+- No video layer or other fancy stuff yet. Enough to run XDirectFB on the Nokia N800 though.
+
+Unichrome driver
+- Fix a pointer buglet. The pfetch pointer was compared/set instead of the value to which it pointed.
+
+Keyboard (TTY) input driver
+- Sleep 2ms when read returns 0, to avoid CPU hogging. Thanks to Luis Mondesi lemsx1 gmail.
+
+Serial input driver
+- Fixed illness in processing read data in serial driver and fixed error path.
+
+Default WM
+- Added WM key combo <Meta>-<F12> to redraw the whole window stack.
+
+Unique WM
+- Fixed wheel direction.
+- Commented out auto center.
+
+DFIFF image provider
+- Make DFIFF fast for the standard case again (60->483 MPixel/sec).
+- Added support for sub surfaces with proper clipping/offset.
+- Check for unscaled and unclipped loading without format conversion and just use dfb_surface_write_buffer().
+
+FT2 font module
+- Optimized pixel premultiplication.
+
+FBDev system module
+- Fixed SetMode / Panning Bug, thanks to Kieran Bingham!
+- Fixed allocation size for planar formats in FBDev Surface Pool.
+- Add missing libsysfs when statically linking, thanks to Guillem Jover.
+
+DevMem system module
+- Implement surface pool using surface manager.
+- Added local/shared system data.
+- Added configure.in and Makefile.am parts.
+
+Linux Input driver
+- Ignore input devices matching the TSLIB_TSDEVICE environment variable.
+
+tslib driver
+- Check the device in $TSLIB_TSDEVICE when guessing (no option given).
+
+dfbdump tool
+- Added "-dl" or "--dumplayer" for dumping the front buffer of each active contexts' primary region.
+
+dfbfx tool
+- Based on "fx", with command line options, documented code...
+- Simulates blitting flags given a source and destination ARGB pixel.
+
+
+1.1.0
+-----
+
+API
+- Extend list of custom key definitions: DIKS_CUSTOM<0-99>
+
+API | IDirectFB
+- Fix code that controls single/double buffer window creation for primary surfaces in windowed mode. If
+  DSCAPS_FLIPPING is set, it uses one buffer which already requires a Flip due to the window. Only if
+  DOUBLE is set explicitly, create two buffers.
+
+API | IDirectFBDisplayLayer
+- Added IDirectFBDisplayLayer::SetRotation().
+
+API | IDirectFBFont
+- Added DFFA_FIXEDCLIP that can be used in addition to fixed advance
+  and cuts off glyphs if they are wider than that.
+
+API | IDirectFBImageProvider
+- Added DFB_INCOMPLETE and return it from image providers
+  if rendering has been aborted by the render callback.
+
+API | IDirectFBPalette
+- Added IDirectFBPalette::SetEntriesYUV(), GetEntriesYUV() and FindBestMatchYUV().
+
+API | IDirectFBScreen
+- HD extensions, thanks to Daniel J Laird!
+
+API | IDirectFBSurface
+- Added IDirectFBSurface::SetRenderOptions() as a new state element, but not
+  mandatory for graphics drivers. At the moment it's used by the software
+  driver to choose smooth or standard scaling.
+- Made DisableAcceleration( DFXL_DRAWSTRING ) work.
+- Each sub surface interface has a reference to its parent and a list of its children.
+- Added DSBLIT_ROTATE180 with a basic software implementation.
+- Added universal resource id (unsigned long) that belongs to each surface,
+  e.g. the layer id or window id. General purpose surfaces can be given an
+  id by using the new flag DSDESC_RESOURCE_ID and setting the resource_id field.
+
+API | IDirectFBVideoProvider
+- Thanks to Daniel J Laird for Video Provider Events!
+- Extended video provider capabilities, thanks to Daniel J Laird!
+
+API | IDirectFBWindow
+- Added IDirectFBWindow::Bind()/Unbind().
+- Added DWDESC_OPTIONS and DWDESC_STACKING to give initial values in the
+  DFBWindowDescription using the new fields 'options' and 'stacking'.
+- Added DWDESC_PARENT to DFBWindowDescriptionFlags and 'parent_id' to
+  DFBWindowDescription. This can be used to associate a window to another,
+  but it's up to the WM to implement it.
+- Added IDirectFBWindow::SetKeySelection() that selects a mode for filtering
+  keys while being focused. The selection defines whether all, none or a
+  specific set (list) of keys is selected.
+- Added DFBWindowKeySelection featuring DWKS_ALL, DWKS_NONE and DWKS_LIST.
+- Added IDirectFBWindow::GrabUnselectedKeys() and UngrabUnselectedKeys()
+  to have a key collector window receiving all keys that the focused
+  window did not select.
+- Added DFBWindowEventFlags featuring DWEF_RETURNED so far, which means that
+  the event has been returned, i.e. has not been consumed by the original
+  recipient. The DFBWindowEvent field 'flags' has also been added.
+- Added advanced window geometry for positioning and scaling of windows
+  relative to their own bounds, with ability derive from parent geometry.
+- DFBWindowGeometryMode: DWGM_DEFAULT, DWGM_FOLLOW, DWGM_RECTANGLE, DWGM_LOCATION.
+  DFBWindowGeometry: mode, rectangle, location.
+- IDirectFBWindow::SetSrcGeometry() and IDirectFBWindow::SetDstGeometry().
+- Added generic dfb_window_set_config() for simplifying core code and moving
+  config handling into interfaces.
+- Added DWOP_KEEP_ABOVE and DWOP_KEEP_UNDER.
+
+Runtime Options
+- Achtung! DirectFB is using sysconfdir now! E.g. use /usr/local/etc/directfbrc.
+- New layer configuration system, staying compatible with older options:
+- init-layer=<id> chooses layer with ID to configure (following layer- options apply)
+- layer-size=<width>x<height> sets the pixel resolution
+- layer-format=<pixelformat> sets the pixel format
+- layer-depth=<pixeldepth> sets the pixel depth
+- layer-buffer-mode=(auto|triple|backvideo|backsystem|frontonly|windows)
+- layer-bg-none disables background clear
+- layer-bg-color=AARRGGBB sets a background color (hex)
+- layer-bg-image=<filename> sets a background image
+- layer-bg-tile=<filename> sets a tiled background image
+- layer-src-key=AARRGGBB enables color keying (hex)
+- New option "surface-sentinel" to enable surface sentinels at the end of chunks in video memory.
+- Added "smooth-upscale" and "smooth-downscale" options to enable smooth scaling by default.
+- Added "[no-]madv-remove" to get around the auto detection.
+- Added layer palette initialization via "layer-palette-<n> = <hexcolor>" option.
+- Added option "layer-bg-color-index = n".
+- Added option "layer-rotate = <degree>" with 0 and 180 supported.
+- Added option "layer-src-key-index".
+
+Pixel formats
+- Added DSPF_RGB444 and DSPF_RGB555, thanks to Daniel J Laird!
+
+Core
+- Use a Skirmish to synchronize slaves with the master's post core initialization.
+  The new function dfb_core_activate() will allow other processes to join.
+- Explicit shutdown order of core parts and pools.
+
+Graphics Core
+- API break! Drivers must use "state->mod_hw" instead of "state->modified"!
+- Validate clip in dfb_state_update() also if destination
+  was just set manually, not via dfb_state_set_destination().
+- Added YUV palette support. CorePalette has a second array for YUV entries.
+  Both arrays are kept synchronized. Drivers can choose.
+- Implemented StartDrawing/StopDrawing() for states. When a surface is being rendered to, its graphics
+  state is set to DRAWING. Upon Flip() the state is flushed. The new mechanism needs to be enabled via
+  "startstop" option. StartDrawing/StopDrawing() can be implemented by the graphics driver. e.g. to keep
+  track dirty surfaces and defer flipping if it would reveal other's drawing.
+- Added multifunctional color configuration function dfb_state_set_color_or_index().
+  Always tries to set both color and index. If color index is -1, color is used and
+  searched in palette of destination surface if present. If color index is valid the
+  color is looked up in palette if present.
+- Added dfb_gfx_back_to_front_copy_180().
+- Added DFBColorKey which is binary compatible with DFBColor for RGB, but
+  has an 8 bit color index instead of the alpha value.
+
+Layer Core
+- Use DFBColorKey instead of DFBColor in the CoreLayerRegionConfig.
+- Fix potential dead lock in layer context initialization.
+- Fix potential dead lock in dfb_layer_context_get_primary_region().
+
+Surface Core
+- NEW SURFACE CORE WORK IN PROGRESS (really usable, but not everything supported yet). Check TODO!
+- dfb_surface_reformat() no longer fails immediatly if the surface is locked,
+  instead it waits for 3 loops before doing it.
+- If no alignment is specified (0), default to 8 bytes offset and pitch alignment.
+  To disable alignment, simply set to 1.
+
+Window Core
+- API break! Replaced dfb_wm_start_desktop() by dfb_wm_post_init(). Removed StartDesktop which had no
+  context pointers from WM API and added PostInit with proper context pointers.
+- Simplified internal dfb_layer_context_create_window() and dfb_window_create()
+  and replaced dfb_window_*grab*() by dfb_window_change_grab().
+
+libdirect
+- API break! Changed DirectHash's u32 key to be unsigned long. This allows to use pointers.
+- Added direct_thread_detach() and direct_thread_is_detached().
+- Use pthread cleanup to free the DirectThread structure etc.
+- Added direct_thread_get_tid().
+- Avoid "unused warning" if debug domains are declared, but not used.
+- Fix 64 bit symbol address parsing in trace code.
+- Fix missing target directory for nm-n files.
+- Readded "%.nm" as an alternative to "nm-n.%".
+- Added direct_sched_yield().
+- Open log file with mode 0664. Automatically flush stderr.
+- Added direct_list_foreach_reverse().
+- Added direct_serial_check() returning true if the target serial is not higher.
+- Flush stdout and stderr before showing the signal handler message.
+- Rearrange locks in debug message code to avoid dead locks in certain circumstances.
+
+libfusion
+- API break! Changed call handler function type. The return value defines the library's behaviour
+  after exiting from the handler. To return a value immediately, write to *ret_val and return FCHR_RETURN.
+  If you want to make a call later on to fusion_call_return() yourself, use FCHR_RETAIN.
+- The new serial value allows to have more than one call pending while calls can
+  be returned in any order. The caller is still blocked on its single call, of course.
+- API break! Added "ctx" argument to fusion_object_pool_create() and FusionObjectDestructor.
+- Close file descriptor of shared memory files and be happy with just the
+  static mmap() and the filename for using truncate() instead of ftruncate().
+- Reinitialize entries in static pool array properly.
+- Added fusion_hash_set_autofree() to enable/disable automatic freeing of values and/or keys.
+- Use FusionHash for arena fields.
+- Fix general dead lock problem with reactors by using read/write locks.
+- Fix zero FusionID in forked process by entering the world after reopening it.
+- Added fusion_dispatcher_tid().
+- Fix lock order in fusion_shm_pool_destroy().
+- Added fusion_reactor_set_lock_only() which does not lock and use it in fusion_object_set_lock()
+  as this is called during object initialization.
+- Added FUSION_SKIRMISH_ASSERT macro for debug mode
+  failing if the skirmish is not locked by the current thread.
+- Added fusion_reactor_set_dispatch_callback() with a test.
+- Added fusion_reactor_attach/dispatch_channel() with the older calls using channel zero.
+- Added fusion_skirmish_wait() and fusion_skirmish_notify(). When you hold the lock you can wait until
+  you get notified, where others can get the lock while you're waiting. At the moment it requires the
+  notifier to acquire the lock.
+- Added timeout to fusion_skirmish_wait(), 0 means unlimited.
+- Added a new Fusion/IPC implementation using standard system calls:
+- Skirmish gets implemented by using sched_yield()+usleep, exactly like linuxthreads does with pthread mutexes,
+  but it's also capable of automatically unlocking whether the owner process died without doing it.
+- Property works like Skirmish, but it doesn't sleep and it doesn't check for a dead owner.
+- Dispatching and co. make use of raw unix sockets: there is a local address specific to each fusionee
+  (/tmp/fusion.@WORLD_INDEX@/@HEX_FUSION_ID@) and each call (/tmp/fusion.@WORLD_INDEX@/call.@HEX_CALL_ID@.@HEX_CALL_SERIAL@),
+  and messages are sent directly from the generator to the socket of the listeners.
+  From a network point of view, this is similar to UDP Multicast (e.g. conference or meeting).
+- The new implementation gets build when --enable-bulti is specified but no usable linux/fusion.h was found
+  (however you can edit fusion/build.h to force building it).
+- Raise max number of shm pools to 16.
+
+Software Rendering
+- Fixed RGB24 to RGB16 conversion.
+- Fix ARGB on RGB16 blending. Use Duff's Device and optimize for 0% and 100% opaque.
+- Fix hi/lo mixup for big/little endian in 32 bit wise 16 bit color keying code.
+- Added smooth up/down scaling for different formats.
+- Fix 64bit implementations of RGB32 source and destination color keying.
+
+DFIFF Image provider
+- Use a preallocated surface to render the image
+  (this should fix support for destinations that are premultiplied, separated, and co.).
+
+PNG Image provider
+- Avoid abort() caused by libpng and return an error instead.
+- Plug a memory leak in the PNG image provider. Thanks to Eugene Everson.
+- Fixes for grayscale PNGs.
+
+Mach64 driver
+- Ported to new surface core.
+- Added RGB444 and RGB555 support.
+
+Matrox driver
+- Ported to new surface core.
+- Added RGB444 and RGB555 support.
+- Eliminate libsysfs dependency from i2c detection.
+- Reset besvcnt to 0 prior to disabling the backend scaler.
+- Sometimes the BES would not turn off with just BESCTL. It seems besvcnt
+  not being programmed to zero has something to do with it since resetting
+  BESGLOBCTL before BESCTL seems to help.
+
+nVidia driver
+- Added support for RGB555.
+- Fixed support for premultiplied surfaces.
+- Dropped down blits from system memory on the NV20 (crashes on Xbox).
+- Optimizations and cleanup.
+
+Radeon driver
+- Ported to new surface core.
+- Support RGB555 and RGB444.
+- RGB555 support on Overlay and CRTC2.
+- Removed limit of 8x8 surfaces:
+  apparently it comes from the Rage128 driver but it doesn't apply to Radeon(s).
+- Implemented DSBLIT_ROTATE180.
+
+Unichrome driver
+- Fix blitting of planar surfaces (YV12/I420) when a source rectangle is used
+  or the source and destination surfaces are different sizes.
+
+Linux Input driver
+- Fix evdev ioctl() parameters.
+- Only use FBDev system module data in linux input driver if system is built.
+- Don't bail out with other system modules if LINUX_INPUT_USE_FBDEV is not set.
+
+FBDev System module
+- Add source rectangle support to fbdev layer.
+- Check fbdev pan/wrap capabilities for double/triple buffering.
+- Fix fbdev_ioctl_call_handler() return value.
+- Fix transfer of errno from master to slaves when doing ioctls.
+- Do FBIOPAN_DISPLAY ioctls directly.
+
+DevMem System module
+- Added generic /dev/mem based system module.
+- There's no screen or layer registered, a graphics driver is required.
+- Added some new runtime options for the new system module.
+- video-phys=<hexaddress> sets the physical start of video memory.
+- video-length=<bytes> sets the length of video memory.
+- mmio-phys=<hexaddress> sets the physical start of MMIO area.
+- mmio-length=<bytes> sets the length of MMIO area.
+- accelerator=<id> sets the accelerator ID for selecting the graphics driver.
+
+SDL System module
+- Support different DirectFB formats on 32 and 16 bit displays.
+- Disable SDL backend by default.
+
+X11 System module
+- Support different DirectFB formats on 32 and 16 bit displays.
+- Use an ShmImage with twice the height of the output. Alternate between bottom and top image and
+  do XSync() BEFORE doing the next XShmPutImage(). Only call XShmPutImage() for the updated region.
+- Takes advantage of SMP now.
+- Added true keymap support to X11 input driver. Read the X11 keymap entries properly and translate to
+  identifier and symbols. Only send key code in events. X KeySym to DFBInputDeviceKeySymbol translation
+  might not be complete for everyone.
+- Provide the original timestamps from the X events.
+- Use DIEF_FOLLOW for x/y motion.
+- Added call to XFlush() after XShmPutImage() boosting df_andi from 100 to 130 FPS
+  and making window stack updates really smooth and no longer distorted.
+- Use preallocated shared memory for calls, the layer context lock allows this.
+- Support non-SHM connections.
+- Fall back to non-shm if XShmAttach() or XShmPutImage() fail after XShmQuesryExtension() returned success.
+- Handle expose events.
+- Enable X11 System Module by default.
+
+Default WM module
+- Pan the layer to follow the mouse cursor (aka. virtual resolution).
+- Actually fail if a parent window for the newly created one was specified (not supported).
+
+dfbdump tool
+- List buffers in video memory if "-s" is passed.
+
+dfblayer tool
+- Added option "-R <degree>".
+
+directfb-csource tool
+-  Add --raw option to directfb-csource to allow encoding data files in headers
+
+
+1.0.0
+-----
+
+libfusion
+- Use local memory for FusionVector (D_MALLOC instead of SHMALLOC) if pool is NULL in fusion_vector_init().
+
+SDL Input
+- Thanks to Ben Combee for adding DIEF_FOLLOW support!
+
+dfbdump tool
+- Align output of summarized surface memory again.
+
+
+1.0.0-rc5
+---------
+
+API | IDirectFBVideoProvider
+- Another (binary compatible) API change: added DVSTATE_BUFFERING.
+
+Build Options
+- This patch adds '--with-message-size=SIZE' to allow fusion messages up to SIZE bytes (default is 1024).
+
+Runtime Options
+- New option "shmfile-group=<groupname>" to set the group that owns shared memory files.
+- Added option "[no-]thrifty-surface-buffers" to free sysmem instance on xfer to video memory.
+- Don't abort if an unsupported option is found, but give a fat warning.
+- New option "vt-num=<num>" to use given VT instead of current/new one.
+
+Graphics Core
+- Added dfb_gfxcard_get_device_data().
+- This fixes unconditional access to conditionally allocated font row data, thanks to Ben Combee!
+- Surface manager always deallocates all auto video instances when suspending.
+  This has the nice side effect of free space being defragmented after resume :)
+
+Window Core
+- Don't notify WM if cursor opacity didn't actually change.
+
+Software Rendering
+- Added fast RGB24 to RGB16 conversion (little endian only).
+
+libdirect (optional part)
+- Finally found the way to embed MPEG streams within the RMF container.
+- Dropped down RTSP seekability (never worked fine).
+
+PNG Image Provider
+- Implemented 1 and 2 bit indexed PNG support.
+
+Keyboard (TTY)
+- Added keypad equal support.
+
+Linux Input
+- Added keypad equal support.
+- Fixed segfault in event thread.
+
+H3600 Touchscreen
+- Thanks to Philip Jägenstedt :philipj 0pera c0m: for fixing the H3600 check!
+
+FBDev System
+- Improved robustness of VT switching, e.g. for rapidly switching back and forth.
+- Set FD_CLOEXEC on the frame buffer device file descriptor.
+
+dfbdump tool
+- Show creator of references (of windows, surfaces, contexts etc).
+
+
+1.0.0-rc4
+---------
+
+FBDev System Module
+- Many thanks to Vaclav Slavik for fixing up VT initialization.
+  Check the ChangeLog for a detailed description.
+
+Unichrome Driver
+- Allow for improved timing of video layer flips when the FIELD_PARITY option
+  is in use.  The improvement is only possible if the kernel framebuffer
+  supports it.  If not, we do the best we can but occasional glitches may
+  occur under high processor load.
+
+Misc/minor (usually not in a summary, but due to the few changes...)
+- Distribute autogen.sh
+- Add new lines to work around nested structs being taken by the doc generator.
+- Avoid cutting away the last pixel of a planar yuv row.
+
+
+1.0.0-rc3
+---------
+
+API
+- Added IDirectFBWindow::SetBounds() to do a move and resize in one step.
+- New window option DWOP_SCALE prevents the surface from being resized when the window
+  size on screen changes, i.e. via IDirectFBWindow::Resize() or SetBounds().
+- The surface can be resized separately using IDirectFBWindow::ResizeSurface() if needed.
+- Enable DWOP_SCALE by default for windowed primary surface (IDirectFB::CreateSurface).
+- Fixed DIKT_UNICODE detection in DFB_KEY_TYPE(symbol) for values > 255.
+
+Runtime Options
+- New runtime option "scaled=<width>x<height>" scales the window to the specified size
+  for 'force-windowed' apps. The surface size will not be affected, still set via "mode=".
+- Added options "debugmem" and "debugshm" to turn on local/shared memory allocation
+  debugging separately from "debug" option.
+- Let "debugmem" option only influence output of allocations, but always track
+  them in debug enabled builds.
+- Added option "no-software" to disable software fallbacks. This is mainly for
+  debugging/profiling purpose. It will print out a warning with the operation
+  and flags each time a fallback would occur.
+- Read DIRECTFB_SESSION variable after reading all files and DFBARGS,
+  so only the command line can override the current session.
+- Added runtime option "force-slave" to always enter as a slave, waiting for
+  the master, if not already there. This feature only works with recent kernel module.
+
+Graphics Core
+- Added InvalidateState() at driver level API to notify the driver that
+  the current rendering state is no longer valid.
+
+Surface Core
+- Added ability to let only one Fusionee write to a surface,
+  set via owner field of CoreSurface.
+- Don't try to immediately allocate the new video instance when reallocating
+  a buffer (unless the policy is CSP_VIDEOONLY). Fixes corruption problems
+  in XDirectFB caused by window resize failing.
+- Dispatch surface's notifications directly (if local).
+  This change fixes an assertion failure that happens in the following case:
+  Resize (Downsize) Surface ... and immediatly after ... Blit to Surface.
+
+Layer Core
+- Support DLBM_BACKSYSTEM as a (driver) default.
+
+Window Core
+- Give the WM a chance to provide its own surface.
+  The WM may link a surface to the window in the PreConfigureWindow() call.
+- Dispatch window's notifications directly (if local).
+
+Software Rendering
+- Added Bop_argb_blend_alphachannel_src_invsrc_Aop_PFI[] as a fast path for blending
+  from ARGB with SRCALPHA / INVSRCALPHA. Implemented for RGB16 and RGB32 so far.
+- Use cpp templates for 16bpp and 32bpp code.
+- Removes duplicated code.
+- Implements some missing gfx funcs.
+- Fixes missing EXPAND() calls in some acc funcs.
+- Fixes blit direction handling in some 16bpp blit funcs.
+
+Utils
+- Added some basic update region management (DFBUpdates) with functions for adding
+  updates, keeping a maximum number of regions, merging if possible or required.
+  First version, IQ 10.
+
+libdirect
+- Autodetect clock skew.
+- Added direct_list_move_to_front( **list, *link ).
+- Added direct_snputs(s,d,n) to set a string with a maximum size including the
+  zero termination. This acts like a strncpy(d,s,n), but always terminates the
+  string like snprintf(d,n,"%s",s) which is more or less slower.
+- If trace support and shared libraries are enabled, for each library to install,
+  also generate a file containing the output of "nm -n <that library>".
+  That's the command that is used at runtime via popen().
+- Now the code first checks if it can fopen() a file with the same name as the one passed
+  to "nm -n", but with an "nm-n." prefix. This is both a performance improvement and a nice
+  solution for (embedded) targets without 'nm' being available or fast enough.
+
+libdirect (optional part)
+- Implemented seekability over RTSP.
+
+libfusion
+- Use MADV_REMOVE if possible to give memory back to the system after freeing a block
+  in the middle of the heap.
+- No more signal handler used, because no more mremap() is done, only ftruncate()
+  is called to resize the shared memory heap. The initial mmap() now covers the whole
+  address range.
+- Initialize the heap info table to serve for the maximum pool size specified
+  at creation of the pool. Previously, the initial table served for 4 MB heap.
+  If there were more allocations, the heap info table was reallocated at the
+  end of the heap, i.e. at 4 MB making it impossible to ever go back below
+  the 4 MB heap size. Next barrier was 8 MB, 16 MB ...these are gone.
+- The maximum size specified during creation of a pool is now taken as an
+  additional size after the heap info table. Previously, it could happen that
+  the size was too small to host the fixed sized heap info table.
+- Include Fusion ID of allocator and offset within heap in shm allocation debug info.
+- Print shared memory leaks on pool shutdown (debug mode and 'debugshm' option).
+- Added fusion_reactor_direct(bool) to specify whether local message handlers (reactions)
+  should be called directly, which has been the previous behaviour for years...
+- Fall back to /dev/shm if no mount point could be determined.
+- Added FCEF_NODIRECT which forces execution of the call in the Fusion
+  Dispatch thread even if it's the calling process' own call.
+- Only call fusion_sync() if the pool that is to be destroyed has objects.
+- Fixed fusion_sync() timeout during XDirectFB shutdown.
+- Fixed concurrent startup of master and slaves.
+
+Voodoo
+- Missing methods added and more implemented.
+
+PNG Image Provider
+- Support loading of indexed PNG files directly to LUT8 surface.
+- Provide palette of image via GetSurfaceDescription().
+
+FT2 Font
+- Added support for LUT2 fonts for using fast antialiased text rendering with indexed to indexed translation.
+- Thanks to Vaclav Slavik for fixing loading of mono-only fonts.
+
+Default WM
+- Added support for scaled windows.
+- Make cursor area backing store surface same format as layer.
+- Use DFBUpdates to manage an update queue and do optimizations like taking
+  the bounding box instead of multiple smaller regions if the number of pixels
+  in the bounding box is not much higher than the total of the smaller ones.
+- Even this takes the number of smaller regions into account, because of the
+  increasing overhead per region.
+- Next to performance, the visual experience is enhanced by coalesced updates.
+- Another advantage is that when multiple regions are updated, first it renders
+  all regions and then it flips all regions. Previously, each time the flip was
+  done immediately for each rendered region.
+
+Radeon Driver
+- Implemented StretchBlit, TextureTriangles, Alphablend, Deinterlacing
+  for the R300 chipset family, thanks to Timon +timon37 * interia-pl+!!!
+- Support color keying for TMU based functions on R300.
+
+Unichrome Driver
+- Implemented acceleration for blits involving the AiRGB pixel format.
+- DSPF_AiRGB is now supported as a source format for most blits and stretch blits.
+- Blits _to_ AiRGB surfaces are also accelerated provided they don't require blending.
+
+Linux Input
+- Added Touchpad support!
+
+tslib Input
+- New driver, thanks to Shane Volpe!
+
+dfbdump tool
+- Added the option "-p" to pause() dfbdump after initialization, e.g.
+  to run it as a master and look at the foot print or other things that
+  are there before any application specific stuff happens.
+- Show allocations in both DirectFB shared memory pools with option "-s".
+
+
+1.0.0-rc2
+---------
+
+API
+- Breaking API Freeze but keeping source and binary compatibility!
+- All __u8, __s16 etc. types have been changed to u8, s16 etc.
+- Compatibility is in place unless DIRECTFB_NO_CRUFT is defined.
+- Added DSPF_LUT2 being indexed 2 bit per pixel packed, i.e. four pixel in one byte.
+
+API | IDirectFBSurface
+- Added SetIndexTranslation() that sets a translation table used for
+  fast indexed to indexed pixel format conversion. Negative or undefined values in the
+  table will result in no pixel being written.
+- Added DSBLIT_INDEX_TRANSLATION to do fast indexed to indexed translation, this flag
+  is mutual exclusive with all others.
+- So far only LUT2 to LUT8 is supported, used for fast anti-aliased text rendering
+  to indexed format. The translation table contains "-1, 36, 37, 38" for example.
+  First entry makes the background transparent and the other three are shaded versions
+  of the text color.
+
+Build Options
+- Use libpng-config if present. Thanks to Gery <gxkahn-et-gmail.com>!
+
+Runtime Options
+- Added "primary-only" to tell applications only about the primary layer, pretending there are no others.
+- Fixed "tmpfs" option.
+- Fixed "pixelformat" option.
+- Don't depend on "debug" option when printing interface leakage at exit time (only debug builds).
+
+Core
+- No longer create a new process group in dfb_core_create().
+- Don't take certain locks in core shutdown functions if emergency is true.
+
+Layer Core
+- In dfb_layer_context_get_primary_region() if increasing the ref count of the
+  existing primary region fails, due it being destroyed, wait for a short time
+  and try again, probably recreating the region.
+
+Surface Core
+- Fixed bug in auto-video surface locking that could return a NULL pointer.
+
+libfusion
+- Safely cycle through hash nodes while freeing them.
+- Don't print an error if an object revived after it's ref count reached
+  zero but got increased again before the destructor is called. That applies
+  to the multi application core only. In the single application core the
+  destructor is called synchronously.
+
+libdirect
+- Use readdir_r() instead of readdir().
+- Don't include config.h in direct/types.h. Fix stdbool.h warnings.
+- No longer use pthread_kill(KILL) which doesn't only kill the specified thread, use pthread_cancel().
+- Let direct_assert() and others try raise(TRAP) first, then killpg(0,TRAP) and pthread_exit().
+- At the end of the global signal handler no longer use killpg(0,KILL) but remove all handlers,
+  raise(num), abort() and then exit( -num ). But the exit shouldn't be reached.
+- Register signal handler with empty instead of full blocking mask and use SA_NODEFER except
+  for SIGSEGV. Also no longer use SA_RESTART.
+- Use recursive mutexes in trace support if available.
+
+libdirect (optional network stuff)
+- Replaced the usage of setitimer()+recv() in net_peek() with a single call to select().
+- Fixed username/password parsing.
+
+DGIFF
+- DirectFB Glyph Image File Format
+- Purpose of DGIFF is to offload as much as possible from runtime, especially during
+  application startup when loading the default or system fonts.
+- Added a new font module and a tool called mkdgiff to generate .dgiff from .ttf or other.
+- mkdgiff uses FreeType2 to load the glyphs of the font and stores them in one or more ready
+  to use font cache rows, up to 2047 pixels wide right now.
+- The loader creates preallocated surfaces from the mmapped font file. The only copy ever
+  made would be when the surface is transfered to video memory for acceleration.
+- DGIFF supports different sizes of one face in a single file.
+
+DFIFF
+- Build mkdfiff only if PNG support is enabled.
+
+FT2 Font
+- Made DFFA_NOCHARMAP work again.
+- If Unicode/Latin1 failed, try Symbol Encoding and do some 0xf000 magic.
+
+Mach64
+- Disable dithering when doing alpha blended blits. Dithering it is applied
+  even when the source pixels are completely transparent. This change makes
+  the mouse cursor look sane.
+
+Matrox
+- Include <linux/i2c.h> and <linux/i2c-dev.h> now.
+
+SiS315
+- Include <linux/sisfb.h> now.
+- Build only if this header is found by configure.
+
+Linux Input
+- Ignore repeat events for mouse buttons.
+
+FBDev System
+- Use other signals than SIGUSR1/SIGUSR2 for vt-switching.
+
+Other fixes
+- Plugged mem leak of AttachedWindow struct when DetachEventBuffer() happens
+  after the window has been destroyed.
+- Fix Bop_a8_set_alphapixel_Aop_yuy2() for big endian.
+- Remove/relicense GPL code.
+
+
+1.0.0-rc1
+---------
+
+API
+- Added DIEF_FOLLOW to DFBInputEventFlags which indicates that another event
+  will follow immediately. In the mouse driver this is used to "link" the x/y
+  axis motion events. The window manager no longer sends two motion events (x/0, 0/y)
+  for one x/y mouse movement (x and y axis at once). Zig-zag cursor/window movement
+  and double event/update rate are gone.
+- Moved DirectFBGL header to the proper location. We need the header here since the DirectFBGL
+  interface is strongly integrated within DirectFB and we want to support external implementations.
+- More Porter/Duff rules (SRC_ATOP,DST_ATOP,ADD,XOR).
+- Added DFB_SUSPENDED error meaning "The requested object is suspended!".
+- Added 4 bit packed alpha pixel format DSPF_A4, e.g. for fonts.
+- Added support for the 18bpp format family.
+
+API | IDirectFBDisplayLayer
+- Added SwitchContext() that switches between the shared
+  and the exclusive context if present.
+- Added SetClipRegions() that, if supported by hardware, sets the clipping regions that are used to to
+  enable or disable visibility of parts of the layer. The number of regions is stated in the display layer
+  description. The layer will be shown only in these regions or except in these regions.
+
+API | IDirectFBFont
+- Added GetStringBreak() to break a text line by line. Thanks to sridewa <sridewa@gmail.com>.
+- Added EnumEncodings() enumerating all provided encodings, also see Fonts section below.
+- Added FindEncoding() to look up an encoding directly by its name.
+- Added SetEncoding() for choosing the encoding for local interface methods and as a default for the surfaces.
+
+API | IDirectFBImageProvider
+- Added DIRenderCallbackResult to DIRenderCallback to be able to abort rendering.
+
+API | IDirectFBInputDevice
+- Added DetachEventBuffer() to detach an event buffer explicitly.
+
+API | IDirectFBScreen
+- Allow connectors to be selected at the encoders without the need to define
+  outputs, add slow blanking, thanks to Daniel J Laird <danieljlaird@hotmail.com>.
+- Populating screen API a bit more, thanks to Daniel Laird <danieljlaird@hotmail.com>.
+- Added GetSize().
+
+API | IDirectFBSurface
+- Added ReleaseSource() to release a possibly attached source,
+  e.g. after blitting from it only once and from nothing else afterwards.
+- Added GetFramebufferOffset() returning the offset within
+  the graphics memory, thanks to Stefan Lucke <stefan@lucke.in-berlin.de>.
+- Added GetPosition() returning the offset of a sub surface.
+- Finally decided to catch horizontal/vertical lines in DrawLine() and optimize them using rectangle filling.
+- Added SetEncoding() to choose an encoding for the text routines, will be overwritten by SetFont() which takes
+  the default encoding of the new font, also see Fonts section below.
+
+API | IDirectFBVideoProvider
+- Removed return value from DVFrameCallback.
+- Added SetPlaybackFlags(), SetSpeed() and GetSpeed().
+- Added SetVolume() and GetVolume().
+
+API | IDirectFBWindow
+- Added DetachEventBuffer() to detach an event buffer explicitly.
+
+Build Options
+- Added option --enable-netork to enable/disable building network protocols handlers.
+
+Fonts
+- Added support for other encodings than UTF8. Encodings are (or can be) provided
+  with each font implementation. This model reduces code sharing slightly, but   
+  allows higher efficiency via optimized combination of decoding and translation.
+- Every encoding just has a name and an ID, where the name can be chosen freely,
+  except for DTEID_UTF8 which is always available and has the name "UTF8".
+- Implemented UTF8 and "Latin1" encoding in FT2 font loader. Nice demonstration how
+  different encodings can be used, while still having a single glyph cache, which is
+  no longer based on character codes, but on their raw indices.
+- See ChangeLog from 2006-05-06 for more details.
+
+Graphics Core
+- Added DFBResult return value to graphics driver's EngineSync() and WaitSerial()
+  to be able to return DFB_TIMEDOUT or other errors. In these cases the core resets
+  the accelerator via EngineReset() and takes care of state invalidation etc.
+- dfb_gfxcard_sync() and dfb_gfxcard_waitserial() also lease the graphics property,
+  i.e. there are no more concurrent calls to the driver, e.g. FillRectangle() along
+  with EngineSync().
+- Moved clipping from dfb_clip_stretchblit() to gStretchBlit() doing all clipping,
+  phase and offset calculations in place, otherwise clipping suffered from rounding
+  and off-by-one errors due to going back to integer in between.
+- In case of no hardware clipping but rectangle filling, if in DrawRectangle()
+  the whole rectangle outline was outside the clipping area, the clipping area
+  was drawn in the software fallback code.
+- In dfb_surfacemanager_deallocate() make sure no hardware read or write
+  access on the buffer is pending before freeing the chunk.
+- Added global function pointer __DFB_CoreRegisterHook with __DFB_CoreRegisterHookCtx
+  to allow application level layer (and screen) implementations building on top of existing layers.
+- New capabilities for setting destination size limit. If the rectangle is
+  too big, first try clip, then try again and eventually fall back to software.
+- Implemented font cache limit, currently hardcoded to five rows, each row stores a number of glyphs.
+  When the maximum number is reached it will reuse the least recently used row, kicking out all glyphs
+  that have been on it.
+- Before every graphics operation, i.e. in dfb_gfxcard_state_check(),
+  clip the state's clipping region to the destination surface dimension.
+
+Input Core
+- First and fully working implementation of dead key handling using static
+  tables for mapping of dead keys and following symbols to the combined symbol.
+
+Surface Core
+- Some changes that decrease system memory usage for surface buffers, especially where graphics memory
+  is available.
+- Allocate system instance of auto-video buffers on first access, not immediately during creation of the surface.
+- Deallocate system memory when buffer is written to in video memory. Reallocate it if the buffer is kicked out
+  of video memory.
+- Implemented "suspended" surface buffers, temporarily deallocated. No valid instance at all until it's resumed.
+- Added dfb_surface_buffer_suspend/resume().
+- Added SBF_SUSPENDED.
+- Align pitch of system memory buffers to be a multiple of 8 instead 4.
+- Add extra 16 bytes at the end of a buffer as a dummy area for optimized
+  routines, e.g. to avoid segfaults due to prefetching.
+
+Window Core
+- Rewritten cursor handling (software cursor) to use a surface instead of a window.
+  The window manager module gets notified about all kinds of updates regarding the cursor.
+  All window manager modules use the same code for now, using backing store for the region under
+  the cursor. This avoids revealing window content that hasn't been commited via Flip(), yet.
+  It should also be faster as it no longer depends on the windows that are covered by the cursor.
+- Check if window is destroyed and return DFB_DESTROYED in all functions
+  which would have called the WM, because a destroyed window is no longer
+  known to the WM and the WM's window data structure is deallocated.
+
+Software Renderer
+- Fix unaligned 32 bit accesses in color keying code.
+- Allocate the accumulator only if it will be used.
+- Check if palettes are equal when blitting indexed formats.
+
+Misc
+- Added dfb_rectangle_subtract() to subtract insets from rectangle.
+- Added DFB_RECTANGLE_CONTAINS_POINT and DFB_REGION_CONTAINS_POINT macros.
+- Added dfb_gfx_copy_to() as an extension of dfb_gfx_copy(). The advantages are
+  different x/y offset for source/destination and blitting from back buffer.
+  The latter was a must for the backing store based software cursor.
+
+libdirect
+- Reworked Direct/Stream to gain more efficiency, added several optional network protocols.
+- Added direct_stream_mime() that returns mime description of the stream.
+- In addition to DIRECT_FORCE_DEBUG one can use DIRECT_ENABLE_DEBUG now.
+- Only duplicate used portion of array in direct_trace_copy_buffer(), set limit from 256 to 200.
+- Added BSWAP16 and BSWAP32 macros, direct_base64_encode, direct_base64_decode and direct_md5_sum.
+- Due to increasing amount of debug messages the default is "no-debug" now. It makes more sense to
+  only enable wanted debug domains by hand, e.g. "debug=core/font". Otherwise, "debug" option still
+  works, too.
+- Replaced direct_stream_fopen() by direct_stream_fileno().
+- Added direct_stream_dup() to increase the stream's reference counter.
+- In the stack trace show base address of each file to allow offset calculation 'by hand' within
+  dynamically loaded modules, i.e. where ldd doesn't help.
+
+libfusion
+- Local 'local reactions' are no longer processed before dispatching further via the kernel device.
+  This causes all local reactions within each Fusionee to be called by the Fusion Dispatcher only,
+  in chronological order. It's a fundamental change in runtime behaviour which might break some code
+  that relies on the synchronous execution of the dispatcher's own local reactions.
+- Implemented experimental fork() handling in Fusion. Added FusionForkAction being FFA_CLOSE by default,
+  which can be changed to FFA_FORK with a call to fusion_world_set_fork_action() for each Fusionee/World.
+- Added "name" parameter to fusion_ref_init() like others already have.
+- Return DFB_LOCKED in fusion_ref_up() if EAGAIN is received (ref is zero locked).
+- New shared hash table implementation and property support for object.
+- Added fusion_skirmish_lock_count() returning the lock counter if held by the caller.
+- Added fusion_reactor_destroy() like fusion_reactor_free() but without freeing the shared structure etc.
+- No longer (need to) access the shared structure during local message processing in the Fusion dispatcher.
+
+i830 driver
+- Fixed overlay destination color keying for 8/15/16 bit primary layer formats, add
+  "i8xx_overlay_pipe_b" option, thanks to Stefan Lucke <stefan@lucke.in-berlin.de>.
+
+Matrox driver
+- Added field based blitting support.
+- Added DSCAPS_SEPARATED support to BES, CRTC2 and SPIC.
+- Fixed pixelpitch alignment for YUY2/UYVY.
+- PAL-60 support (or at least close enough for Ville's TV).
+
+nVidia driver
+- Avoid to set the overlay memory limit, it's already done by the kernel.
+- Basic acceleration for ALUT44.
+- Disable host-to-video hardware blit for simple blits without format conversion.
+- Added nvEngineReset().
+
+Radeon driver
+- R300: Support FillTriangle() and DSDRAW_BLEND.
+- RV250: Dropped YUV->RGB support.
+- Enable VC_32BIT_SWAP on big-endian machines.
+- Removed (erroneously set) flag VF_RADEON_MODE in r200DoDrawRectangle3D().
+- Added patch to radeonfb fixing support for R300 chipsets (it also adds new devices).
+- Use different settings for R300 and non-R300 when setting MC_FB_LOCATION.
+- Added the possibility to use the graphics layer as an OSD. It works exactly the same way
+  as in the unichrome driver: Set the video layer level to -1 and enable DLOP_ALPHACHANNEL
+  on the graphics layer.
+- Applied patch by Christer Palm <christer.palm@pulsen.se>: fixes word swapping on PPC.
+
+Unichrome driver
+- Disable hardware cursor in VIA_REG_CURSOR_MODE. Thanks to Michel van
+  Noorloos <michel.van.noorloos@sioux.nl>.
+- Added PCI ID for CN700.
+
+DynaPro input driver
+- New 3M DynaPro Touchscreen driver, thanks to Pär Degerman <parde@ikp.liu.se>!
+
+Keyboard input driver
+- Added support for dead keys.
+
+Linux Input input driver
+- Added support for dead keys.
+
+DFIFF image provider
+- New DirectFB Fast Image File Format with a fast image provider module and a tool to
+  convert images from PNG to DFIFF.
+
+GIF image provider
+- Dropped support for GIF87 (can't be animated).
+
+GIF video provider
+- New animated GIF video provider.
+
+V4L video provider
+- Fixed planar data copy.
+- Added more pixelformats for v4l2.
+
+FBDev System
+- Clean up error handling in system_initialize() and fix bug with shared memory (de)allocation.
+- Treat fbdev format 8/16,8/8,8/0,0/0 as ARGB when ARGB was requested
+  (that because framebuffer drivers tend to ignore the alpha channel).
+- Don't touch console blanking when using graphics-vt.
+
+SDL System
+- Better keymap emulation.
+- Fake video modes by reading fb.modes, just like the fbdev backend.
+
+directfb-csource tool
+- Added option --rgbformat which in contrast to the --format option only is effective if the image
+  doesn't require an alpha channel. That's useful e.g. with RGB16 for opaque and ARGB for blended images,
+  when the primary format will be RGB16. So far directfb-csource either used ARGB/RGB32 automatically, or
+  it always used RGB16 or whatever you specified via --format.
+- Make structs and pixel data const, helps with use in shared libs.
+
+fx tool
+- Very basic program to emulate/illustrate the pixel pipeline, blitting flags etc. No 100% guarantee that
+  itself is correct, but in the end it will serve as a verification for software/hardware driver.
+
+
+0.9.25
+------
+
+API
+- Added DSPF_AYUV, a 32bit packed AYUV format for graphics,
+  being the counterpart of ARGB in the YUV color space.
+
+API | IDirectFBSurface
+- Added GetClip().
+
+API | IDirectFBDisplayLayer
+- Allow empty flags in SetColorAdjustment().
+- Allow to control background and cursor in exclusive cooperative level.
+
+API | IDirectFBEventBuffer
+- Added DFBEventBufferStats containing various counters for the event queue,
+  e.g. total number of events, number of window events, motion events etc.
+  These reflect the current content of the queue, i.e. dequeueing decrements.
+- Added EnableStatistics() to enable/disable collection.
+- Added GetStatistics() to query current statistics.
+
+API | IDirectFBVideoProvider
+- Added SendEvent() to send a window or input event
+  to video providers that supports interactivity (DVCAPS_INTERACTIVE).
+  For cursor events, coordinates must be in the destination rectangle space.
+- Added GetStreamDescription() to query informations about the stream.
+- Added IDirectFBVideoProvider::GetStatus() to get the status of the playback;
+  this method replaces the previous end-of-playback detection method using GetPos().
+
+Runtime Options
+- Added config option unichrome-revision=<rev> to manually set the hardware
+  revision number for the unichrome driver.  This cannot be determined
+  automatically unless the process runs as root.
+- Added option [no-]dma (disabled by default).
+- Added option fatal-level=<level>:
+  Abort on NONE, ASSERT (default) or ASSUME (incl. assert)
+
+Graphics Core
+- Added FlushReadCache() to the graphics driver API.
+  Used in the matrox driver to flush the direct access read cache.
+- Pass CoreDFB to graphics drivers as a new argument to driver_init_driver().
+- Added dfb_gfxcard_surface_{enter/leave}(), called when a software access to
+  video memory begins/finishes.
+- Fix negative line width handling in fill_tri().
+
+Surface Core
+- Added support for surfaces stored in auxiliray memory (PCI/AGP/PCIE).
+- Added support for Surface Managers with a variable number of heaps.
+- In dfb_surfacemanager_allocate() do dfb_gfxcard_sync() only if hardware has
+  read from the buffer about to be kicked out. The call to
+  dfb_surfacemanager_assure_system() should already take care of the hardware
+  write case.
+- Change dfb_surfacemanager_assure_system() to call dfb_gfxcard_wait_serial()
+  instead of dfb_gfxcard_sync() since we're only interested whether the
+  hardware has written to the buffer.
+- Use a separate shared memory pool for surface buffer data.
+
+Input Core
+- Don't toggle lock states repeatedly when holding a lock key.
+- Added FusionCall to each input device for maintenance via master,
+  driver calls etc. using new CoreInputDeviceCommand enum.
+- Added dfb_input_device_reload_keymap() implemented via the new call passing
+  the CIDC_RELOAD_KEYMAP command. The master will reload the whole keymap via
+  driver API.
+- Added a new tool called "dfbinput" which features keymap dump/reload so far.
+- DIKI_ALTGR is gone. The key right to the space bar is the right alt key.
+  No matter which map is loaded, the identifiers are just named hardware keys,
+  where you really specify the physical entity on your keyboard. In this case
+  it's always DIKI_ALT_R, no matter if it's mapped to DIKS_ALTGR or DIKS_ALT.
+  On standard keyboards it's also always the same hardware key code, no matter
+  if you by a German keyboard with AltGr or a U.$. one with Alt.
+- Changed the input core logic for keeping track of modifiers. If DIKI_ALT_R
+  is pressed, also look at the symbol to decide if DIMM_ALT or DIMM_ALTGR is
+  to be added/removed.
+- Now application developers don't need to check for both DIKI_ALTGR and
+  DIKI_ALT_R if they want to check for the key right next to the space bar :)
+
+Software Rasterizer
+- Almost completed support for Planar YUV formats (lacks colorkeying).
+- Fixed Cb/Cr offset computation (height*pitch/4 is different from
+  height/2*pitch/2 if height is odd).
+
+libdirect
+- Made debug/release versions binary compatible, being able to link
+  dynamically against both or even run in the same session.
+- Added D_OOM() message if thread structure can't be allocated.
+- Added D_MAGIC_SET_ONLY which is D_MAGIC_SET without assuming that the magic
+  hasn't been set already. Useful to avoid compiler warnings when acting on
+  uninitialized structures on the stack.
+- Removed dependency on -D_GNU_SOURCE when including <direct/util.h>:
+- Made direct_util_recursive_pthread_mutex_init() non-static-inline.
+- Removed DIRECT_UTIL_RECURSIVE_PTHREAD_MUTEX_INITIALIZER and replaced all
+  of its occurences by PTHREAD_MUTEX_INITIALIZER. These didn't need to be
+  recursive. If there's a recursive mutex required, you can still use the
+  utility function direct_util_recursive_pthread_mutex_init().
+- Removed -D_GNU_SOURCE from direct.pc and directfb-config.
+- Added DIRECT_SIGNAL_ANY as a replacement for the magic -1.
+- If the debug domain being registered contains a slash, but didn't exactly match an entry
+  in directfbrc, check to see if the domain is descended from an entry in directfbrc,
+  e.g. 'ui/field/messages' matches 'ui' or 'ui/field'.
+- New D_DEBUG_ENTER and D_DEBUG_EXIT to ease debug messages for tracing function calls.
+- Added UDP support to DirectStream.
+- Added symbol resolving support for static binaries.
+- Replaced the enum based bool definition by a typedef to __u8.
+- Defined false and true via macros like stdbool.h does.
+- Allow NULL argument in direct_free().
+- Thanks to Andy Stewart for fixing the hash table reallocation which didn't
+  check for collisions during reinsertion.
+
+libfusion
+- Using the new Fusion Kernel API 2.0
+- Parallel Fusion Worlds in one process via extended API
+- Multiple Shared Memory Pools in one world via new API
+- No race condition between (potential master) processes starting in parallel
+- Fusion APIs have been extended to support different worlds and pools.
+- Added fusion_reactor_sized_dispatch() to dispatch a message to any attached
+  reaction with a given size. Instead of using the size defined by the reactor,
+  the caller can specify the size of the data.
+- Added a parameter to fusion_enter() - FusionEnterRole - to specify either
+  FER_ANY, FER_MASTER or FER_SLAVE. If the world can't be entered playing the
+  specified role, an error message is printed and DFB_UNSUPPORTED is returned.
+- Added FusionCallExecFlags parameter to fusion_call_execute().
+- Allow pending reactions (in local dispatcher queue) to be executed
+  after the shared reactor part has been destroyed. This fixes for example
+  occasionally missing DWET_DESTROYED events.
+
+libvoodoo
+- Avoid tons of warnings by using D_MAGIC_SET_ONLY instead of D_MAGIC_SET.
+- More Requester/Dispatcher method implementations.
+
+Radeon driver
+- New unified Radeon driver for R100/R200/R300+.
+- Supports smooth page flipping.
+- Supports seconday head output.
+- Supports overlay on secondary head.
+- Improved overlay RGB rendering.
+- Improved R100/R200 3d functions performance.
+- Fixed 2d/3d engines synchronization.
+- Added support for surfaces stored in AGP memory.
+- Use the POINT primitive to fill rectangles with size=1 (i.e. to draw points) [~60% faster].
+- Speed up FillRectangle, Blit and StretchBlit by using the RECTANGLE_LIST primitive
+  instead of QUAD_LIST [~15% faster]. :)
+- Reset MC_FB_LOCATION to avoid problems with X (thanks to Michel Danzer).
+- Check for integrated GPUs.
+- When AGP support is enabled, turn off pci gart and turn on bus mastering.
+- Added acceleration for AYUV, but color conversion is not supported because
+  radeon supports AVYU instead of AYUV.
+
+Matrox Driver
+- Support for DSDRAW_SRC_PREMULTIPLY.
+- Limited support for DSBLIT_SRC_PREMULTIPLY.
+- PCI device ID cleanup.
+- Fixed Mystique vs. Mystique 220 detection.
+- Allow DSPF_ARGB surface for BES.
+- Finally remove DLOP_FLICKER_FILTERING on CRTC2.
+- Don't reinitialize the whole TV encoder when changing field parity.
+- Disable BES if the destination region is completely off-screen.
+- Allow surface height up to 2048 with DLOP_DEINTERLACING (BES).
+- Limit surface width with DLOP_DEINTERLACING to guarantee BESPITCH < 4096.
+- Disable vertical filtering when surface width > 1024 (BES).
+- G200 BES doesn't support color adjustments.
+- Don't touch hardware in SetRegion() if nothing changed (SPIC).
+- Separated spic_calc_buffer() out of spic_set_buffer().
+- Fixes for G100 with SDRAM.
+- Fixed YUY2/UYVY and texture LUT state handling.
+- Fixed color keying mask, G100 doesn't have TEXCTL2 so TEXTRANS
+  must be used to disable color keying.
+- Completely untested PPC support.
+- Misc. cleanups.
+
+Mach64 driver
+- Added support for DSDRAW_SRC_PREMULTIPLY and DSBLIT_SRC_PREMULTCOLOR.
+- Don't advertise DFXL_STRETCHBLIT when it hasn't been checked.
+- Fixed scaler/texture color key for chips < 3D Rage Pro.
+- Avoid chip lockups with destination color keying.
+- Fixed surface size limits (Overlay).
+- Fixed color keying on 264VT2 (Overlay).
+- Check the chip type in ovSetColorAdjustment().
+- Enabled SCALE_Y2R_TEMP.
+- Minor cleanup.
+
+nVidia driver
+- Added support for AGP
+- Added support for DMA using AGP or Framebuffer memory.
+- Finally fixed the "random-crashes-when-blitting-from-system-memory" problem.
+
+Unichrome driver
+- Fix hardware revision number detection and allow override via new config
+  option unichrome-revision=<rev>.  The revision number can only be
+  auto-detected if the process runs as root.
+- Added simple script to determine revision number for addition to
+  directfbrc.
+- Added support for DLOP_FIELD_PARITY.  For this to work, the kernel
+  framebuffer must support an extension of the WAITFORVSYNC ioctl that
+  allows waiting for the top or bottom field.
+- YV12, I420, YUY2 and AiRGB simple blits, AiRGB 2D drawing
+- Disable broken SetColorAdjustment for the overlay and remove color keying diagnostic.
+- Round to nearest when positioning up-scaled YV12/I420 video to reduce error.
+- Fix YV12/I420 video layer corruption on revision 0x11 hardware. Also
+  fix bug setting SUBP_CONTROL_STRIDE register in uc_spic_set_buffer.  Sadly
+  subpicture layer still doesn't work.
+- ARGB4444 as source and destination pixel format for all supported operations.
+- Overhaul of LEVELS, OPACITY and primary ALPHACHANNEL features which were
+  previously only partially implemented and did not work together.
+- The video overlay and the primary layer now both support the OPACITY option
+  and either can be on top.  The order is determined by the 'level' assigned
+  to the video layer.  The primary also supports an alpha channel which is
+  useful when the video layer is positioned behind.
+- The old DFB_CLE266_UNDERLAY environment variable switch has been removed.
+
+FBDev System module
+- Added AGP support.
+
+SDL System module
+- Decoupled screen updates from Fusion Dispatcher.
+  Updates are handled in a separate thread; they're accumulated rather than
+  queued in case an update is already pending.
+- Use the flag FCEF_ONEWAY to not wait for the call being executed,
+  otherwise a deadlock could occur. The return value is meaningless anyways.
+  Queued updates will be merged on the receiving side (master) to avoid a
+  lag and improve performance.
+
+Gunze Input driver
+- Added Gunze Touchscreen driver, thanks to Nathanael D. Noblet <nathanael@gnat.ca>!
+
+PenMount Input driver
+- Added input driver for PenMount 9509 serial touchscreen.
+
+PS/2 Input driver
+- Applied patch from Christian Krause <krause.chr@gmail.com> that allows
+  usage of the option "mouse-source" without "mouse-gpm-source".
+
+dfbdump tool
+- Show "1k" again for '0 < bytes < 1024'.
+
+dfbsummon tool
+- Avoid division by zero if no video memory is available.
+
+fusion_bench tool
+- Do the shmalloc benchmark once with debug and once without.
+
+
+0.9.24
+------
+
+- Added missing source (header) files to their appropriate Makefile.am, mostly from voodoo.
+- Don't use fusion_reactor_free() too early in case of an error in init_devices().
+  Thanks to "Jakub Bogusz <qboosh@pld-linux.org>" for this and other patches.
+- IDirectFBVideoProvider::GetPos() returns DFB_EOF to notify end-of-playback.
+  After stream has reached the end, the next call to PlayTo()
+  restarts playback from the beginning.
+- No need for <linux/wm97xx.h> and <linux/sisfb.h> anymore.
+- Build all graphics drivers without checking for FB_ACCEL_* in <linux/fb.h>,
+  because we have a fallback for each of those ids.
+- Don't build cle266 by default as it's obsolete because of the unichrome driver.
+
+
+0.9.23
+------
+
+Authors
+- Added "Claudio Ciccani <klan82@cheapnet.it>" to main authors,
+  welcome number five and thanks for your appreciated work :-)
+
+API
+- Added IDirectFBSurface::DisableAcceleration( DFBAccelerationMask mask ).
+- Added DSBLIT_SRC_PREMULTCOLOR which modulates the source color with the
+  color alpha value only.
+- Replaced IDirectFB::GetCardCapabilities() by GetDeviceDescription()
+  and DFBCardCapabilities by DFBGraphicsDeviceDescription which contains
+  additional information like device and driver name, version etc.
+- Added more enums to the autogenerated directfb_strings.h.
+- Added errorcode DFB_EOF.
+- Added DSBLIT_XOR.
+- Added universal event class for custom usage with variable size. New structure DFBUniversalEvent
+  has a 'clazz' and a 'size' member. The clazz is always DFEC_UNIVERSAL and the size is at least
+  sizeof(DFBUniversalEvent). There are no other members, but any amount of additional data may
+  follow according to the specified size. Best usage would be to derive from the struct.
+- Added new input event flag DIEF_REPEAT indicating a repeated key or button press.
+- Support fractional font sizes in DFBFontDescription.
+- Added IDirectFBDataBuffer::CreateVideoProvider().
+- Added IDirectFBDataBuffer::Finish(): used to notify a streaming databuffer that the end-of-file has been reached.
+
+Runtime Options
+- Fixed pixelformat=NV21 option.
+- Added option 'busid' to specify the graphics card bus id (unused if sysfs support is enabled).
+
+Build Options
+- Allow predefinition of FREETYPE_CFLAGS and FREETYPE_LIBS outside of configure.
+- New configure option "--with-sysroot=DIR" lets you prepend a path to the runtime library/module paths.
+
+Graphics Core
+- Added support for system to video memory blits in (semi-)hardware.
+- Some 24bit big endian fixes, thanks to Mark Salter <msalter@redhat.com>!
+- Added dfb_gfxcard_invalidate_state() which sets the state pointer to NULL
+  and therefore forces a full SetState() before the next operation is executed.
+- If the destination has premultiplied alpha do real Porter/Duff SRC_OVER
+  composition for glyphs.
+- Fixed build_clipped_rectangle_outlines() to handle special cases
+  where width and/or height is/are one or two.
+- Take into consideration DSDRAW_DST_COLORKEY and DSDRAW_XOR when drawing strings.
+- Added RGB332 and LUT8 support to dfb_surface_dump().
+- Fixed artifacts produced by clipped triangles, thanks to Damian Kowalewski <damian.kowalewski@mail.mcgill.ca>!
+
+Layer & Screen Core
+- Fixed missing updates to the hardware state under some circumstances.
+- It's allowed to create and use windows in exclusive mode, showing the own windows only, of course.
+- Changed EnableCursor() to be allowed in exclusive mode, too.
+- Added dfb_screens_hook_primary() using it in some drivers instead of dfb_screen_register_primary().
+- During flip using blitting, wait for pending writes to the back buffer before issuing
+  the blit command from back to front buffer to avoid lags caused by too much queued commands.
+
+Windowing Core
+- Support windows with premultiplied alpha by checking if their surface has DSCAPS_PREMULTIPLIED.
+- Support premultiplied cursor shapes.
+- If during window creation the pixel format for windows with an alpha channel is
+  unspecified, don't always take DSPF_ARGB, but the layer's format if it has alpha.
+
+Software Rasterizer
+- Fixed inverted YV12 colors.
+- Changed Bop_a8_set_alphapixel_Aop_argb() to be a fast path for real SRC_OVER
+  DrawString() that uses DSBLIT_SRC_PREMULTIPLY and DSBLIT_BLEND_ALPHACHANNEL
+  with SrcBlend = ONE and DstBlend = INVSRCALPHA. Other formats will follow.
+- Fixed DSDRAW_SRC_PREMULTIPLY if used without blending.
+- Implemented DSBLIT_SRC_PREMULTCOLOR.
+- Added optimization for drawing blended with Src = ONE, Dst = ZERO.
+- Improved Dacc_YCbCr_to_RGB_MMX.
+- Fixed A8 to A8 font rendering.
+- Added some functions optimized for 64bit architectures.
+- Added duff's device for 8 bit color keying.
+
+Image Loading
+- Premultiply image data when loading into premultiplied alpha surfaces.
+- Limit number of weights to 64 in x and y direction for down scaling. Without this
+  limitation down scaling to 1x1 or similar could take minutes on embedded platforms.
+- If JFIF or Exif header detection failed, try detecting by filename extension.
+- For PNGs with alpha don't always suggest DSPF_ARGB, but the primary layer format if it has alpha.
+
+Font Loading
+- If the font format is ARGB, use premultiplied font surfaces.
+- Use "signed char" explicitly to fix kerning in FT2 loader on PPC, thanks to Uli <Uli.H@triple-dragon.org>!
+- Support fractional font sizes in FT2 loader.
+- Fixed segmentation fault when loading OpenType fonts with FT2 loader.
+
+libdirect
+- A lot of code is using D_DEBUG_AT, D_ASSERT, D_MAGIC_ASSERT etc. now.
+- Added D_MAGIC_ASSUME.
+- Added D_FLAGS_ASSERT(flags,f) being D_ASSERT( D_FLAGS_ARE_IN(flags,f) ).
+- Protect against bogus siginfo_t pointer by checking if it's smaller than 0x100.
+- Some changes to support KallistiOS.
+- Enable X86 memcpy()s on AMD64.
+- Added a generic memcpy() for 64bit Architectures.
+- MMX and SSE support on AMD64.
+- Fixed a bug in direct_list_remove()! If the last item is removed while other items exist,
+  the first item's "prev" pointer was not updated (pointing to the last element).
+- Added low level logging abstraction. Added runtime options "log-file = <name>"
+  and "log-udp = <host>:<port>" for configuring the default log. 
+- Added direct_thread_set_name() for setting the name of threads that haven't been created by direct_thread_create().
+- Added DirectStream, a wrapper for accessing files locally and through network (http, ftp and generic tcp).
+
+libfusion
+- Added fusion_object_get() that gets a pool and an object id and returns
+  the appropriate object with a local reference added to it. If the object
+  is not found DFB_IDNOTFOUND is returned, or any abnormal other error from
+  locking or referencing.
+- Added FusionObjectID to replace plain int usage.
+- Fixed an evil dead lock that only occured by moving a window with one of my new mice,
+  having superior precision generating lots of events, thanks for spotting this bug, Logitech :)
+- Fixed a rare crash in single application mode, thanks to Mark Adams <mark147m@gmail.com>!
+
+i830
+- Fixed multi application support, but it only works with root privileges so far.
+- Fixes for coexistence with intelfb and for color adjustments,
+  thanks to Sylvain Meyer <sylvain.meyer@worldonline.fr>!
+
+i810
+- Implemented destination color keying for overlay.
+- Merged back multi app fixed from i830 driver.
+
+Mach64
+- Cleaned up register definitions and added all known register names.
+- Improved chip type detection.
+- Made LCD register access work on 3D Rage LT.
+- Big overlay code update including support for DLOP_DEINTERLACING.
+- Scaler/3D acceleration now works on older GT chips. Tested on Rage II+ and IIC.
+- ARGB4444 support for GT chips.
+- Other minor fixes.
+
+Matrox
+- Always use alphamode = ALPHACHANNEL.
+- Implemented DSBLIT_SRC_PREMULTCOLOR using the Color ALU. If it's already
+  used for colorizing, simply modulate the color values with the alpha,
+  otherwise overwrite them.
+
+nVidia
+- Rewrite of the driver, following the structure of other drivers, e.g. Matrox.
+- Overlay and blitting supports Deinterlacing.
+- WaitForSync no longer burns the CPU (but actually requires a 2.6 kernel).
+- Decide texture buffer size according to available video memory.
+- StretchBlit() on A8,LUT8,RGB332 (>= NV20).
+- FillRectangle(),DrawRectangle(),FillTriangle(),DrawLine(),Blit() on LUT8,RGB332 and A8.
+- StretchBlit(),TextureTriangles(),[DrawString()],Alphablend and Colorize from A8 (>= NV10).
+- Alphachannel blend for ARGB1555.
+- Added support for system to video memory blits.
+- Improved TextureTriangles() performance.
+- NV30 supports StretchBlit(), blit with format conversion, alphablend and colorize.
+- Fixed NV30 initialization.
+- Made the driver work with the new nvidiafb framebuffer driver.
+- Made deinterlacing work properly with TextureTriangles().
+
+R200
+- New driver for ATI Radeon R200 based cards by Claudio Ciccani <klan82@cheapnet.it>!
+- Accelerates FillRectangle,FillTriangle,DrawRectangle,DrawLine, Blit,StretchBlit,TextureTriangles.
+- Supported Drawing Flags: Blend, Xor.
+- Supported Blitting Flags: Alphablend, Coloralpha, Colorize, SrcPremultColor, SrcColorKey, Deinterlace.
+- Supported Formats: A8, RGB332, RGB16, RGB32, ARGB, ARGB1555, ARGB2554, ARGB4444, AiRGB, LUT8, ALUT44, YUY2, UYVY, YV12, I420.
+- Overlay supports YUY2, UYVY, YV12, I420, ARGB1555, RGB16, RGB32 and ARGB,
+  color adjustments, DLOP_DEINTERLACE, DLOP_DST_COLORKEY and DLOP_OPACITY.
+
+SiS 315
+- Compatibility stuff for newer fb driver versions.
+
+Unichrome
+- Added missing flag DLCAPS_LEVEL, thanks to Stefan Lucke <stefan@lucke.in-berlin.de>!
+
+Linux Input
+- Fixed AltGr.
+- Added translation of KEY_FASTFORWARD, KEY_SOUND, KEY_QUESTION, KEY_EMAIL and KEY_CANCEL.
+- Better touchscreen/smartpad detection, thanks to Stefan Lucke <stefan@lucke.in-berlin.de>!
+- Don't abort if checking for LEDs fails.
+
+MuTouch Input
+- Improved packet reading loop, thanks to Ivan Daniluk <ivan@shvydko.ua>!
+
+PS/2 Mouse Input
+- Added GPM support. The mouse-protocol option specifies the protocol for
+  the mice or the repeater (supported values: PS/2 and IMPS/2).
+
+FBDev System
+- When restoring the video mode during shutdown, set xoffset and yoffset to 0.
+- Keep the original display offset if no mode has been set, e.g. just running "dfbinfo".
+- Added ARGB4444 support.
+
+SDL System
+- Hide the SDL cursor so DirectFB one shows.
+
+VNC Server System
+- Preliminary system module using libvncserver.
+
+X11 System
+- Preliminary native X11 support, thanks to Martin Luetken <nitram@lutken.dk>!
+
+Unique WM
+- Started work on the decoration framework, still not usable.
+
+dfbdump
+- Show 'premultiplied' surface capability.
+
+directfb-config
+- Added options "--system=" and "--wm=" for static linking.
+- Option "-s" additionally shows the shared memory file size.
+
+
+0.9.22
+------
+
+API
+- Added DLCAPS_ALPHA_RAMP: Alpha values for formats with one or two alpha
+  bits can be chosen, i.e. using ARGB1555 or ARGB2554 the user can define
+  the meaning of the two or four possibilities. In short, this feature
+  provides a lookup table for the alpha of these formats.
+- Added DLCAPS_PREMULTIPLIED indicating that a display layer
+  can display surfaces with premultiplied alpha.
+- Added DSCAPS_PREMULTIPLIED indicating that the surface has
+  premultiplied alpha data.
+- Added DLCONF_SURFACE_CAPS and field 'surface_caps' to DFBDisplayLayerConfig 
+  to specify any combination of the flags: DSCAPS_INTERLACED, DSCAPS_SEPARATED
+  or DSCAPS_PREMULTIPLIED.
+- Added DLCAPS_SCREEN_POSITION and DLCAPS_SCREEN_SIZE.
+  These are set if DLCAPS_SCREEN_LOCATION is set and vice versa.
+  Unscalable layers just have DLCAPS_SCREEN_POSITION.
+- Added DSECAPS_BRIGHTNESS, DSECAPS_CONTRAST, DSECAPS_HUE, DSECAPS_SATURATION.
+- Added DSECONF_ADJUSTMENT to DFBScreenEncoderConfigFlags.
+- Added 'DFBColorAdjustment adjustment' to DFBScreenEncoderConfig.
+
+API | IDirectFB
+- Cleaned up the way CreateSurface() determines the primary surface
+  pixelformat and size. Previously the behavior varied depending on
+  cooperative level and the force-desktop option. New behavior:
+  1. DSDESC_{WIDTH,HEIGTH,PIXELFORMAT}
+  2. SetVideoMode()
+  3. mode= and pixelformat= options
+  4. current layer config
+
+API | IDirectFBDisplayLayer
+- Added IDirectFBDisplayLayer::SetScreenPosition() which
+  sets the position of the layer on the screen specified in pixels.
+- Added IDirectFBDisplayLayer::SetScreenRectangle() which
+  sets the position and size of the layer on the screen specified in pixels.
+
+API | IDirectFBSurface
+- Added IDirectFBSurface::SetAlphaRamp(a0,a1,a2,a3): Either all four values
+  or the first and the last one are used, depending on the format.
+  Default values are: 0x00, 0x55, 0xaa, 0xff.
+- Added IDirectFBSurface::FillRectangles().
+
+Build Options
+- Added option "--with-inputdrivers=..." for selecting drivers to build,
+  thanks to Marcel Siegert <mws@twisted-brains.org>!
+
+Runtime Options
+- Replaced "argb-font" and "a1-font" with a more flexible "font-format" option.
+- Make "graphics-vt" the default.
+- Added "h3600-device", keeping the default of "/dev/ts".
+- Added "mut-device" which must be used to enable the driver.
+
+Pixel Formats
+- Added DSPF_ARGB2554.
+- Added DSPF_ARGB4444.
+- Added DSPF_NV21 (like NV12, but with swapped CbCr).
+
+Software Driver
+- Added support for YUY2/UYVY->RGB conversion (with src colorkeying).
+- Force alignment to even coordinates if blitting YUY2 or UYVY.
+- Added NV12/NV21/NV16 blitting and rectangle filling.
+- Made YV12<->I420 blitting possible.
+- Fixed YUV422 handling on big-endian architectures.
+- Optimized Bop_yuy2_Sto_Aop() and Bop_uyvy_Sto_Aop(),
+  these are used for StretchBlit() using YUY2 or UYVY.
+
+Display Layer Core
+- Keep a list of all realized (added) regions to remove them during
+  emergency shutdown, e.g. signal received or missing deinit of master app.
+- Added CLRCF_SURFACE_CAPS and field 'surface_caps' to CoreLayerRegionConfig
+  in the display layer driver API.
+- HW Windows created with DWDESC_SURFACE_CAPS and DSCAPS_PREMULTIPLIED
+  in 'desc.surface_caps' are created as premultiplied layer regions.
+- Store normalized and pixel based destination area in a layer context.
+- Added CoreLayerLayoutMode which defines incorporation of
+  configuration based size changes and destination area values.
+- Activate the most recent context instead of the primary (shared) context
+  when the current context is removed.
+- Restore color adjustment when (re)activating a context.
+
+Windowing Core
+- Create layer regions for hw windows in single buffered mode, unless
+  explicitly configured using DSCAPS_DOUBLE/TRIPLE or DWCAPS_DOUBLEBUFFER.
+  This is a preliminary solution, because by default a window surface should
+  require a Flip() to make changes visible.
+- Activate DWOP_ALPHACHANNEL for other non indexed alpha formats, too.
+- Implemented hw window resizing.
+
+libfusion
+- Take the largest one, if multiple tmpfs are found.
+
+Proxy Interface Implementations (Voodoo)
+- Implemented BatchBlit() in IDirectFBSurface_Requester and _Dispatcher.
+
+Fixes (excerpt)
+- Fixed a video memory leak in dfb_surface_reconfig() that happened if a  
+  surface with multiple buffers is configured to have less, e.g. switching
+  a layer from DLBM_TRIPLE/BACKVIDEO to DLBM_FRONTONLY.
+
+dfblayer
+- Show the layer level if supported.
+
+Intel
+- Added i830 driver (overlay support only) for Servision Ltd.
+  (http://www.servision.net/)
+- Note, due to unsolved conflicts regarding ring buffer usage
+  you have to load the "intelfb" module with the parameter "accel=0".
+
+Matrox
+- Added DSPF_ARGB4444 support.
+- Added DSPF_NV21 support.
+- Added support for G400 dual head add-on (disabled by default).
+- Alpha ramp support for CRTC2.
+- Added support for progressive chroma on CRTC2.
+- Added support for progressive half-height sub-picture.
+- Dropped I420/YV12 support for old chips.
+- NV12/NV21 Blit() for >= G200.
+- NV12/NV21 StretchBlit() for >= G400.
+- Accelerated I420/YV12/NV12/NV21 FillRectangle().
+- YUY2/UYVY FillRectangle(), Blit() and StretchBlit().
+
+NSC
+- Perform additional check (returned phys. fb base) before considering the
+  fb driver to be the one that it's expected to be.
+
+nVidia
+- Experimental alpha blending support for Riva TNT.
+- Fixed NV20 and GeForce3 Xbox support, Blit() should work on the latter now.
+- Added experimental support for NV30 chipsets.
+- Found the way to make NVScaledImageFromMemory (used for StretchBlit,
+  Alphablend, Color Conversion) work on NV20 chipset: it was another rivafb
+  bug, therefore the rivafb-nv20fix-* patch is absolutely required.
+- Added basic support for drawing with alphablend on NV20.
+- Great performance improvements: it's possible to move a translucent window
+  at 32bpp while the cpu stays idle.
+- No longer return a surface stored in system memory for YUY2 and UYVY;
+  return directly the video surface instead.
+- Added FillRectangle() and Blit() (without effects) for YUY2 and UYVY.
+- Added an hack to do StretchBlit() on YUV422 (result is almost acceptable).
+
+Joystick Input
+- Do not dispatch events if unknown or JS_EVENT_INIT are received.
+  Fixes crash upon initialization under some conditions.
+
+DreamBox Remote
+- Added dreamboxremote driver mainly based on dbox2remote,
+  thanks to Marcel Siegert <mws@twisted-brains.org>!
+
+Unique WM Module
+- Lots of changes that have been lying around for more than two months,
+  but this module is still not fully usable, yet.
+
+
+0.9.21
+------
+
+API
+- Added DFBLocation which is like DFBRectangle but has normalized coordinates.
+- Added macros to compare rectangles, regions, locations, colors etc.
+- Added diagonal cursor keys.
+- Added more types to the auto generated "directfb_strings.h".
+- Added DFBVertex containing transformed x, y, z, w, s and t coordinates.
+- Added DSCAPS_DOUBLE and changed DSCAPS_FLIPPING to be a
+  combination of DSCAPS_DOUBLE and DSCAPS_TRIPLE.
+- Added "const" to some parameters.
+- Added DFXL_DRAWSTRING for IDirectFBSurface::GetAccelerationMask().
+- Added prefix "ret_" to all output parameters.
+- Added DFBSpan containing x and width of a span.
+- When specified use the pixelformat of the surface description
+  to create a windowed primary surface.
+- Added DFB_VERSIONMISMATCH and DFB_NOSHAREDMEMORY error codes.
+- Added DFBInsets specifying a distance from each
+  edge of a rectangle: left, top, right, bottom.
+- Added DLCAPS_SOURCES which indicates that the layer supports multiple 
+  sources that can be selected, e.g. from frame buffer (surface) or from
+  hardware decoders (using buffers outside of the frame buffer).
+- Added DFBDisplayLayerSourceID with pre-defined DLSID_SURFACE.
+- Added number of supported sources to DFBDisplayLayerDescription.
+- Added DFBDisplayLayerSourceDescription containing the ID and a name.
+- Added DLCONF_SOURCE along with a field in DFBDisplayLayerConfig to
+  select the source to be used.
+
+API | IDirectFB
+- Added IDirectFB::EnumScreens() and IDirectFB::GetScreen().
+
+API | IDirectFBEventBuffer
+- Added IDirectFBEventBuffer::CreateFileDescriptor() returning a file
+  descriptor that can be read from, including support for select().
+
+API | IDirectFBDisplayLayer
+- Added IDirectFBDisplayLayer::GetScreen().
+- Moved IDirectFBDisplayLayer::SetScreenPowerMode()
+  to IDirectFBScreen, called SetPowerMode().
+- Added IDirectFBDisplayLayer::SetSourceRectangle() for source cropping etc.
+- Added IDirectFBDisplayLayer::GetSourceDescriptions().
+
+API | IDirectFBScreen
+- New interface IDirectFBScreen for mixer, encoder and output settings.
+- An output is connected to an encoder which is connected to a mixer which
+  combines selected display layers.
+- Added a lot of types for description and configuration of these components.
+  (see the API Reference Manual for more details)
+
+API | IDirectFBSurface
+- Added IDirectFBSurface::TextureTriangles() using a surface as the texture,
+  a pointer to a DFBVertex array, an optional index array, the array size and
+  the DFBTriangleFormation which can be DTTF_LIST, DTTF_STRIP or DTTF_FAN.
+- Added IDirectFBSurface::BatchBlit() which increases pixel throughput  
+  of many small blits with same source and destination, e.g. custom font
+  rendering like GTK+-DirectFB does.
+- Preliminary depth buffer support using DSCAPS_DEPTH to allocate and use it,
+  currently hard coded to 16 bit, only useful for TextureTriangles().
+- Added DSFLIP_PIPELINE for advanced synchronization with the accelerator,
+  currently implemented for Flip() on window surfaces. This feature is for
+  accelerators with a command buffer that can store more graphics operations
+  than required to render one frame.
+- Added IDirectFBSurface::FillSpans() which is passed a DFBSpan array.
+
+Runtime Options
+- Added "force-desktop" to run fullscreen applications in the background.
+- Added "a1-font" to force usage of monochrome fonts (FreeType2).
+- Added "linux-input-ir-only" which tells the linux input driver
+  to ignore all non-IR Linux Input devices.
+- Added "wm=<wm>" to select the window manager module to use.
+- Added "[no-]trace".
+- Users can enable/disable debug output separately,
+  e.g. using "no-debug,debug=direct,no-debug=direct/memcpy".
+- Added "vt-switching" which is enabled by default.
+- Added "no-vt" which disables usage of VT code completely.
+- Added "no-decorations" to disable automatic window decorations
+  of the "UniQuE" window manager implementation.
+
+Build Options
+- Allow "--enable-static" and "--enable-trace" at the same time.
+- Added "--enable-zlib" that activates gzipped screen shots etc.
+- Added "--enable-voodoo", default is no.
+- V4L2 has to be enabled explicitly via "--enable-video4linux2".
+- Detect cygwin, default to static builds and don't require libdl.
+- In static build mode, add an ".o" version of the ".a" module file.
+  Applications can link statically against the ".o" files without having
+  to specify an extra linker option for each module, e.g. "-Wl,-udirectfb_sdl".
+- Applied patch from "Oskar Liljeblad <oskar@osk.mine.nu>"   
+  which adds the configure option "--disable-sonypi-jogdial".
+- Added "--disable-wm97xx" to disable WM97xx driver.
+- With "--disable-gettid" one can enforce usage of getpid(),
+  e.g. on broken systems where gettid() simply segfaults,
+  though the system call is present in <linux/unistd.h>.
+- Added "--enable-unique", disabled by default.
+
+Pixel Formats
+- Added DSPF_AiRGB, i.e. DSPF_ARGB with inverted alpha channel.
+- Added DSPF_A1, e.g. for monochrome fonts.
+- Removed DSPF_RGB15 in the flavor of DSPF_ARGB1555.
+- Added DFB_COLOR_BITS_PER_PIXEL(format), DFB_ALPHA_BITS_PER_PIXEL(format)
+  and DFB_PIXELFORMAT_INV_ALPHA(format).
+- Added DFB_PIXELFORMAT_ALIGNMENT(format) which is non-zero if alignment
+  is required to do byte aligned access, e.g. 7 for DSPF_A1.
+- Added DSPF_NV12 (planar YUV).
+  (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane)
+- Added DSPF_NV16 (planar YUV).
+  (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane)
+
+System
+- Use gettid() instead of getpid() if available.
+
+Graphics Core
+- Minimize state changes during text drawing.
+- Drivers can choose between byte/pixel pitch alignment, or even use both.
+- Added convenience macros and inline functions for setting state members.
+- Added CoreGraphicsSerial storing the "serial" of a certain graphics operation.
+- Added GetSerial() and WaitSerial() to the graphics driver API:
+  GetSerial() returns the serial of the last queued graphics operation.
+  WaitSerial() waits until the operation with the specified serial is finished.
+- Store the serial of the most recent accelerated graphics operation that has
+  been queued for writing to a surface buffer.
+- dfb_layer_region_flip_update() is no longer waiting for an idle accelerator, 
+  if the buffer that is becoming the front has or had a write operation queued.
+  Instead it waits exactly for the last operation that is or was about to write
+  to this buffer. If WaitSerial() is not supported by the driver and/or hardware,
+  the fallback, of course, is to wait for each and every operation to finish.
+- Wait for only the last write operation queued for a buffer,
+  if the software needs to access it.
+- Speed up tiled blitting by clipping in advance.
+- Implemented software clipping for hardware accelerated DrawRectangle().
+- Use hardware accelerated FillRectangle() if DrawRectangle() is not accelerated.
+- Removed the surface listeners attached by dfb_state_set_destination() and  
+  dfb_state_set_source().
+- Added dfb_state_update() which does the work of the removed listeners
+  if direct_serial_update() returns true. Updating the source is optional.
+  Only surfaces set via dfb_state_set_*() are handled.
+- Use dfb_state_update() in dfb_gfxcard_state_acquire() and gAcquire().
+- Added parameter "write_front" to dfb_surface_flip_buffers() which is useful  
+  for triple buffering. If true, the new back buffer will be the front buffer. 
+  Drivers should detect if the current front buffer is not being shown already,
+  in which case the idle buffer might be still shown and should not be written.
+- Added "__u32 dfb_color_to_aycbcr( const DFBColor *color )".
+
+Display Layer Core
+- Refactored display layer core.
+- Added contexts along with regions allocated within them.
+- Drivers are only aware of regions. Usually a driver supports one region
+  per layer. Hardware windows are implemented via hardware regions.
+
+Input Core
+- Added dfb_input_add_global() and dfb_input_set_global() to register global 
+  reactions at run time, e.g. from another library or module in which case the   
+  static reaction table can't be initialized with the address of those functions.
+- Cleaned up input core code, e.g. by replacing the "inlined" singly linked list
+  code by using a "DirectLink" and the "direct_list_*()" functions, or by adding
+  usage of D_MAGIC_ASSERT() etc.
+
+Windowing Core
+- Pressing <Meta>-<Ctrl> + Left/Right Click generates 3rd/4th button event.
+- Switch to color keyed cursor if shape doesn't have alpha or if translucent
+  windows are disabled.
+- Changed <Meta>-'S' to raise the lowest window, e.g. to revert a <Meta>-'A'.
+- Added <Meta>-<Escape> to switch from fullscreen mode to the desktop.
+  (currently not advisable if a flipping fullscreen app is still rendering)
+- Modularized window management for different implementations on desktop
+  and embedded systems.
+- Added new experimental window manager "UniQuE" with window decorations.
+- Added a CoreWindowConfig containing position, size, opacity, stacking,
+  options, events, color key and opaque region.
+
+Software Driver
+- Added DSBLIT_DEINTERLACE support to gBlit.
+- Implemented missing blending modes.
+- Implemented lots of missing format specific code.
+- Implemented stretchblitting for YUV.
+- Fix a8 font rendering for argb1555, i.e. remove alpha pits around glyphs.
+- Replaced gDrawLine() by gFillRectangle() in rectangle outline drawing code.
+- Allocate accumulators dynamically.
+- Lots of optimizations and fixes.
+
+Debugging Support
+- Major speed up by using thread specific data instead of gettid().
+- Use popen("nm -n ...") to load symbols of any module on demand.
+- Show static symbols in stack traces.
+- Produce gdb like stack dumps (output formatting).
+- Added thread names to debug output, stack traces etc.
+- Added interface instance tracking in debug mode, showing remaining
+  instances at exit time (like it's done for allocated memory).
+- Added debug domains which can be enabled/disabled separately.
+- Added "<Meta>-<BackSpace>" debugging shortcut for
+  dumping the stack of each thread of the master process.
+- Align debug output of domains.
+- Indent debug output if trace support is enabled
+  by using direct_trace_debug_indent() which sets the flag TF_DEBUG for the
+  current frame and returns the current debug message indention level by
+  examining the stack, counting any upper frames that produced debug output.
+- Added tons of assertions and assumption, mostly to new code.
+- Added support for A8,YUY2 and UYVY surfaces in dfb_surface_dump().
+
+Fixes (excerpt)
+- No need to call SetOpacity() before RequestFocus() for input only windows.
+- Don't allow GetWindow() on the cursor window.
+- Don't wait for Fusion Dispatch Thread during emergency shutdown.
+- Fixed missing MMX initialization in slaves, only the master used MMX before.
+- Use RTLD_NOW to detect undefined symbols before the module is used at all.
+
+libdirect
+- Migrated base functionality (threads, signals, interfaces, debugging,
+  lists, modules etc.) into a separate library that can even be used by apps.
+- Added direct_clock_set_start() that is called by Fusion's initialization
+  to synchronize time stamps of debug messages.
+- Added a minimalistic hash table implementation for usage with IDs as keys.
+- Added DirectResult which is the DFBResult outside of DirectFB.
+- Added message macro D_UNIMPLEMENTED which prints a warning once.
+- Added a name argument to direct_thread_create(),
+  printed during creation and termination of threads.
+- Added direct_thread_self(), direct_thread_get_name(thread)
+  and direct_thread_self_name().
+- Added DIRECT_UTIL_RECURSIVE_PTHREAD_MUTEX_INITIALIZER.
+- Added direct_list_append() and changed the list structure to have
+  the first element's 'prev' pointing to the last element of the list.
+- Added DirectThreadInitHandler which can be installed/uninstalled using   
+  direct_thread_add_init_handler() and direct_thread_remove_init_handler().
+  The registered init handler function is called at the beginning of new threads.
+- Allow per file debug mode forcing via definition of DIRECT_FORCE_DEBUG.
+- Added D_DERROR(ret,message) which acts like D_PERROR(message), but takes
+  a DirectResult (DFBResult) instead of using errno.
+- Added D_ARRAY_SIZE(array) to calculate the size of an array.
+- Added D_FORMAT_PRINTF(n) to check the format of (debug) messages.
+- Added flag manipulation macros D_FLAGS_*.
+- Added D_CONST_FUNC to declare const functions.
+- Added DirectSerial providing a 64 bit serial number with functions
+  for initialization, increasing, copying and updating.
+- Added D_DEBUG_ENABLED which is defined depending on three other macros.
+  It's defined to be 1, if the D_DEBUG* macros produce code. Useful for
+  embracing code that is just required for the debugging output.
+- Added D_OOM() which prints the warning "out of memory" and gives
+  DFB_NOSYSTEMMEMORY if used as a (return) value.
+- Added D_OOSHM() which is the same as D_OOM() in single app build.
+  Only in multi app build it prints the warning "out of shared memory"
+  and gives DFB_NOSHAREDMEMORY if used as a (return) value.
+- Renamed direct_list_contains() to direct_list_contains_element_EXPENSIVE()
+  to ensure that developers know that they shouldn't use it in non-debug code.
+- Added direct_list_count_elements_EXPENSIVE().
+- Added direct_util_count_bits(), slow version,
+  but at least optimized for bit sets with lower bits set only.
+
+libfusion
+- Migrated Fusion into a separate library to be used without DirectFB,
+  e.g. using FusionSound without initializing DirectFB.
+- Added fusion_object_globalize() doing the often used combination of
+  fusion_object_link() and fusion_object_unref(), i.e. increasing the global
+  reference counter and decreasing the local reference counter.
+- Removed FusionResult using DirectResult instead.
+- Use new Fusion API for entering the world (including version checking).
+- Added fusion_ref_inherit() using the new ioctl FUSION_REF_INHERIT.
+- Added fusion_object_inherit() to inherit the local reference count
+  from another object of any type.
+- Added "docs/ReferenceMaps.txt" which explains references
+  and visualizes different cases of inter object referencing.
+- Heavily cleaned up code of FusionReactor and added lots of debug messages and
+  comments. You should add "no-debug = fusion/reactor" to disable these loads
+  of debug messages, while still showing other messages if "debug" is used.
+- Cleaned up FusionObject code and debug messages.
+- Added some assertions and assumptions to the shared memory code.
+- Added a parameter to fusion_skirmish_init() and fusion_reactor_init() to  
+  set the name of the skirmish or reactor using the ioctl FUSION_ENTRY_SET_INFO.
+- Don't create a skirmish for each reactor's global reactions, but use a single
+  skirmish for all reactors which is created during Fusion's initialization.
+- Added fusion_reactor_set_lock() to use another skirmish for the global
+  reactions of the reactor.
+- Added fusion_object_set_lock() to set the skirmish for the global reactions
+  of the object's reactor, while default is the skirmish used to lock the pool.
+
+libvoodoo
+- Added network transparency to DirectFB, called Voodoo.
+  (see the related news entry on the web page for more details)
+
+Reference Manual
+- Parse preceding comments within enums.
+- Fixed hyper link generation for "const" parameters.
+- Improved layout of types page.
+- Added macro definitions to types page.
+- Added callback definitions to types page.
+- Automatically generate links if comments include function names,
+  e.g.: "... IDirectFB::GetDisplayLayer() ...".
+- Show index of types and definitions on the index page.
+
+directfb-config
+- Added "--fusionsound" and "--voodoo" to generate static linking
+  parameters for FusionSound and Voodoo respectively.
+- Use new ".o" versions for all modules (static linking).
+
+directfb-csource
+- Support for combining multiple images into one surface.
+
+dfbdump
+- Dump layer contexts.
+- Option "-s" shows a list of all shared memory allocations (debug mode only).
+
+dfbinfo
+- Show all mixers, encoders and outputs.
+- Show display layer sources.
+
+dfblayer
+- Added option "-L, --level <level>" to change the level of a layer.
+
+dfbscreen
+- Added configuration tool for mixers, encoders and outputs.
+
+fusion_bench
+- Replaced getpid() reference benchmark by an flock(2) benchmark.
+- Use recursive mutexes in threaded mutex benchmark.
+- Each benchmark runs for one second now.
+- Added shmalloc/shfree benchmark.
+
+FreeType2 Font Loader
+- Added DSPF_A1 (monochrome font) support.
+- Speed up kerning cache.
+
+Video4Linux Video Provider
+- Added deinterlacing support for grabbing mode,
+  i.e. added dfb_surface_set_field() calls to grabbing thread and added   
+  second frame callback to the loop (to make 50Hz out of the 25Hz of v4l).
+- Use CSLF_FORCE, fixes failing PlayTo() on a fresh surface.
+- Some other fixes.
+
+FBDev System
+- Print error message if the given mode (via "mode=" option) is not supported.
+
+OSX System
+- Added native OSX support without using SDL.
+
+Matrox
+- Backend Scaler (BES) fixes and improvements.
+- SGRAM auto-detection via /proc/bus/pci.
+- Added sysfs support to i2c detection code. Now it works on 2.6 kernels.
+- Use better constants for black/white level calculation on G450/G550 CRTC2.
+- Implemented TextureTriangles().
+- Added texture LUT support (G200) and some other 8bpp improvements.
+- Added support for DSPF_NV12 (BES).
+- Cleanups and optimizations.
+
+VIA CLE266
+- Added video underlay mode.
+- Added DLOP_DEINTERLACING support to video layer.
+- Use fbdev to map registers, obsoletes cle266vgaio.
+  Code still works with cle266vgaio for vesafb users...
+- Implemented DSBLIT_DEINTERLACE.
+- Implemented TextureTriangles().
+- Fixed the broken fonts problem.
+- Thanks to Bryce Nichols <bryce@bnichols.org> for reducing the hardware
+  rounding errors in 16 bit mode by rendering the upper left and lower right
+  triangle pair instead of the upper right and lower left.
+- Other major improvements and fixes.
+
+VIA Unichrome
+- New driver based on the CLE266 driver.
+- Support for multiple north bridges.
+- DVD Sub Picture Layer support.
+- Destination Color Keying for the Video Layer.
+
+nVidia
+- Impressive improvements by Claudio Ciccani <klan82@cheapnet.it>.
+- Added support for ARGB1555, RGB32 and ARGB.
+- Added support for blit with conversion (ARGB1555,RGB32,ARGB to all).
+- Added support for YUY2 and UYVY on Primary Layer.
+- Added support for adjusting Brightness, Contrast, Saturation and Hue.
+- Destination Color Keying for Video Layer.
+- Implemented TextureTriangles().
+- Implemented StretchBlit().
+- Implemented alpha blended blitting and drawing.
+- Added experimental support for Colorizing.
+- Added sysfs support.
+- Added a fast Flip() function (not using ioctl).
+- Experimental WaitForSync() support.
+- Fixed ram amount detection on Xbox (thanks to Oliver Schwartz).
+- Giant cleanup and rewrite of the objects configuration routines:
+  we use runtime configuration instead of fixed tables now.
+- Cleanups and fixes.
+
+SiS 315
+- Added by Andreas Oberritter <obi@tuxbox.org>.
+- Rectangle Filling/Drawing, Line Drawing in 8, 16 and 32 bit.
+- Blitting (with Source Color Keying) in 8 and 16 bit.
+- Destination Color Keying, Clipping.
+
+ATI Mach64
+- Added by Ville Syrjala <syrjala@sci.fi>.
+- Drawing and (Stretch)Blitting with keying, blending, conversion etc.
+- Video Overlay with source and destination color keying.
+- SGRAM block write support.
+- Added texture engine blitting code using power of two textures.
+
+ATI Radeon
+- Video Overlay support by Vadim Catana <vcatana@registru.md>.
+- State handling fixes.
+
+NSC Geode
+- Improvements by Ed Millard <emillard@direcway.com>.
+- Blitting on GX1, though it is constrained by hardware to only blit
+  surfaces whose width matches the stride of the frame buffer.
+
+LibMpeg3 Video Provider
+- Added FusionSound support for audio playback.
+- Moved to DirectFB-extra package.
+
+Linux Input
+- Take Linux Input key code as hardware keycode.
+- Use EVIOCGRAB ioctl to grab the device.
+- Primary mouse is also identified as a mouse now.
+- Added keyboard LED support.
+- Copied keymap support from the keyboard driver.
+- Support more axes.
+
+LIRC Input
+- Emulate keyboard like key repeat behaviour using select() with timeout
+  and a counter to drop the first few repeats.
+
+PS/2 Mouse Input
+- Added /dev/misc/psaux.
+- Just use one of "/dev/psaux" and "/dev/misc/psaux" if both are available.
+- Don't try them at all if uname() yields release "2.5.*" or "2.6.*".
+
+Serial Mouse Input
+- GPM repeater support by Micha Nelissen <micha@neli.hopto.org>.
+
+ELO Touchscreen Input
+- Added by Brandon M. Reynolds <breynolds@comtime.com>.
+
+SDL Input
+- Wheel event support by Tom Bridgwater <genuss@gmail.com>.
+
+
+0.9.20
+------
+
+- Added CLE266 driver by Andreas Robinson <andro134 at student.liu.se>, thanks!
+  The driver supports alpha blending, color keying, video overlay etc.
+- Added WM97XX Touchscreen driver,
+  thanks to Liam Girdwood <liam.girdwood@wolfsonmicro.com>!
+- Added DWOP_SHAPED which enables shaped input handling, windows with an alpha
+  channel or a color key are ignored if the pixel under the cursor is completely
+  transparent. Thanks to Monge Maurizio <monge@sns.it>!
+- Added IDirectFBEventBuffer::WakeUp() causing any WaitForEvent() or
+  WaitForEventWithTimeout() to return with DFB_INTERRUPTED.
+- Added new display layer buffer mode DLBM_WINDOWS where the layer itself
+  has no surface, but the hardware is aware of each window and displays
+  the window stack. Added DLCAPS_WINDOWS, too.
+- Added <Meta>-<Print> hot key to make a screenshot of the focused window
+  including its alpha channel if present. Creates a ppm (RGB) and a pgm (alpha).
+  Use "pnmtopng -alpha foo.pgm foo.ppm > foo.png" to combine them.
+- Added IDirectFBSurface::Dump() similar to <Meta>-<Print>, see above.
+- Added "memcpy = <method>" option to save a lot of startup time.
+  "time dfbinfo" went from 0.080 secs to < 0.010 secs on my machine.
+- New environment variable "DFBARGS" is now parsed like the "--dfb:" parameter.
+- Added Fusion Kernel Device patch for Linux 2.6.
+- Added a patch to set proper clocks on a G400 (great performance boost).
+- Updated vmwarefb for VMware Workstation 4.0 with resolution and depth switch
+  at run time, can disable acceleration at run time. Also fixed palette mode.
+- Video4Linux 2 support by Michael Hunold <hunold@convergence.de>, thanks!
+- Send valid button events in MuTouch driver,
+  thanks to Tim Wright <tim.wright@iosystems.co.uk>.
+- Added support for color keyed PNGs (palette converted to RGB with color key).
+- Enable key repeat in SDL input driver.
+- Fixed segfault in slave processes when no graphics driver is loaded.
+- Signal handler now displays the faulting address in case of SIGSEGV.
+- Added configure option "--enable-trace" activating stack trace dumps in the
+  signal handler. Uses "-finstrument-functions" and therefor only includes
+  functions of DirectFB unless you compile your code with that option, too.
+- Optimized window stack updates by Maurizio Monge <monge@sns.it>.
+- Optimized auto-video surface handling, speeding up Create/Clear a lot.
+- Software driver optimizations for LUT8 (e.g. colorkeyed blitting).
+- Switching single/multi between builds doesn't require "make clean" anymore.
+- Improved output of dfbdump (multi app resource monitor).
+- Important bug fix in state handling (multi app only).
+- Enhanced stability and bug fixes.
+
+
+0.9.19
+------
+
+- Initial version of a Radeon DirectFB driver featuring solid drawing/filling
+  and simple blitting with or without key by Michel Dänzer <michel@daenzer.net>.
+- Added VT switching support which has to be enabled via option "vt-switching".
+  It's pretty well working already, though there are some minor issues left.
+- Added support for multiple multi application worlds with new option
+  "session=<num>" selecting the multi application world being joined or created.
+  VT switching between multiple DirectFB sessions rocks!
+- Added option "primary-layer=<id>" to swap the primary with the specified one,
+  this way all applications can be started on the second head (Matrox).
+- Added "dfblayer", a display layer configuration tool (for multi app).
+- Added IDirectFB::GetInterface() to load interface modules like "IFusionSound".
+- Added time stamp to DFBWindowEvent.
+- Quitting the master (first multi app process) sends SIGTERM to all slaves
+  and waits for them to quit (with a timeout).
+- Core systems (currently FBDev and SDL) are dynamically loaded as modules,
+  which prevents DirectFB from being linked against SDL if support is enabled.
+- Added window manager key 'E' to focus the window under the mouse cursor.
+- Moved all global variables of the software driver to a new struct resulting
+  in a major increase of primitive throughput, e.g. FillRectangle(1x1) by 16%.
+- Enhanced tmpfs detection and added option "tmpfs=<dir>" to set it explicitly.
+- Enhanced locking and safety in v4l video provider.
+- Improved graphics primitive throughput up to 100% by saving locks.
+- Added shared memory allocation tracking like for local memory.
+- Modules and drivers are now binary compatible with single/multi app library.
+- No more bone collector threads (3/master), almost instant object destruction.
+- Other bug fixes and cleanups.
+
+
+0.9.18
+------
+
+- National Semiconductors Geode driver by Sarma Kolluru <Sarma.Kolluru@nsc.com>.
+  Great thanks to NSC for their support!!!
+- nVidia Overlay support by Oliver Schwartz <Oliver.Schwartz@gmx.de>, currently
+  hard coded to XBox. For plain nVidia graphics adapter you need to change line
+  618ff of nvidia_overlay.c (uncomment line 618, comment out line 620).
+- Added multi application support to SDL backend.
+- Added triple buffering for display layers.
+- Added DPMS support via IDirectFBDisplayLayer::SetScreenPowerMode().
+- Added IDirectFB::GetClipboardTimeStamp().
+- Added optional time stamp return value to IDirectFB::SetClipboardData().
+- Added DFB_KEY_IS_ASCII for your convenience.
+- Split DSFLIP_WAITFORSYNC into DSFLIP_WAIT and DSFLIP_ONSYNC.
+- Added DSPF_ALUT44, a new pixel format having 4 bits of alpha and 4 bits
+  being an index to a color lookup table.
+- Added DIEF_GLOBAL indicating that the event was received without focus.
+- Added IDirectFBWindow::SetOpaqueRegion() which excludes one rectangle of
+  the window from alpha blending, e.g. for blended borders around fast opaque
+  content. This is especially useful if the content has no valid alpha values.
+- Added DWOP_OPAQUE_REGION which enables the opaque region.
+- Made all unsigned width, height in the API signed.
+- Made text drawing honor DSDRAW_BLEND flag to render translucent text.
+- Added Intel i810 driver from Tony Daplas < adaplas at users.sourceforge.net >.
+- New Fusion synchronous RPC mechanism speeds up fbdev layer flipping by slaves.
+  Benchmark shows that RPC flips take as long as three non-RPC flips.
+- Non global input event buffers now also get events if any window of the
+  application is focused.
+- The cursor is no longer enabled in DirectFBCreate(), but automatically when
+  the first window is created unless the cursor was enabled/disabled before.
+  Option "no-cursor" now forces the cursor to be disabled forever.
+- Implemented more software driver routines for DSPF_LUT8.
+- Always blit from top to bottom if source and destination buffers differ
+  in the software driver.
+- Fixed state handling and other bugs in the ATI driver.
+- Significantly improved speed of DrawString() with matrox driver,
+  other fixes and improvements to the matrox driver.
+- Multi application core fixes and improvements.
+- Improved graphics card locking for coexistence with DRI drivers.
+- Improved video memory management.
+- Improved matroxfb-vsync-irq and matroxfb-32mb patch.
+- Added Matrox TV output cable type selection.
+- Added README describing Matrox TV-out functionality.
+- Fixed DSCAPS_SEPARATED with planar formats in software driver.
+- Fixed tiled layer background mode.
+- Fixed bug which resulted in black screens with some framebuffer drivers.
+- Fixed segfault in MPEG2 I-Frame image provider by avoiding alloca.
+- Nicer debug output (show time in seconds with three digits after the comma).
+- Many bug fixes, gcc-3.3 fixes, build cleanups, optimizations, updated patches.
+
+
+0.9.17
+------
+
+- Added input driver for Microtouch serial touchscreens.
+- Added input device name and vendor to DFBInputDeviceDescription.
+- Added clipboard functionality via IDirectFB::Set/GetClipboardData()
+  including mime type. This is an intermediate solution that will be replaced.
+- Added new tool "dfbinfo" which currently enumerates input devices and layers.
+- Added IDirectFBDisplayLayer::SetFieldParity(), thanks to Ville.
+- Added cooperative level restrictions to many display layer functions.
+- Readded DSPF_RGB15 (= DSPF_ARGB1555).
+- Graphics drivers are now able to return false in graphics functions to
+  trigger a 'late' software fallback. Useful if blitting direction can't be set.
+- It is finally possible to specify which gfxdrivers should be built.
+        ./configure --with-gfxdrivers=<list>
+- Fix "could not adjust heap offset message" if the primary layer surface
+  consumes the whole video memory (thanks to Ville Syrjala).
+- Fix for planar formats and other fixes by Ville Syrjala <syrjala@sci.fi>.
+- Fixed "directfb-config" for static linking.
+- Fixed destination color keying for blended drawing in software driver.
+- Fixed blitting within one buffer with NeoMagic (scrolling errors).
+- Reject YUV for fbdev layer, thanks to Jiri Svoboda <Jiri.Svoboda@seznam.cz>.
+- Many bug fixes, code cleanups, comments and assertions added etc.
+
+
+0.9.16
+------
+
+- Added IDirectFBWindow::GrabKey() and UngrabKey().
+- Added IDirectFBWindow::SetColorKeyIndex().
+- Added IDirectFBWindow::SetCursorShape().
+- Added IDirectFBDisplayLayer::WaitForSync(), thanks to Ville Syrjala.
+- Made IDirectFBWindow::SetColorKey() lookup the index if the format is indexed.
+- Removed DSPF_RGB15 in favor of DSPF_ARGB1555, not completely tested yet.
+- Added DFB_COLOR_EQUAL macro to compare two DFBColor.
+- Added <Meta>-P shortcut to enable the cursor manually.
+- Added new multi app core shortcut Ctrl-Alt-Break which sends a SIGKILL to
+  fullscreen applications, useful if a fullscreen app hangs.
+- Added optimized memcpy routines for PPC (disabled in default build).
+- New automatic grabbing mechanism for fullscreen applications running windowed.
+- Added options for statically linking applications with selected modules
+  to directfb-config.
+- DirectColor visual support by Antonino Daplas <adaplas@pol.net>.
+- Color adjustment support on primary layer (via gamma ramp in direct color
+  mode) by Antonino Daplas <adaplas@pol.net>.
+- Fixed implementation of window stacking classes.
+- Fixed segfault with default font provider (non-FT2).
+- Some essiential fixes of outstanding multi app bugs related to layers.
+- Only detach slave processes from their terminal if it's really necessary.
+  Framebuffer ioctls are executed by the master only via fast RPC mechanism.
+- Avoid short single frame flicker when starting fullscreen apps by
+  temporarily switching to KD_GRAPHICS mode.
+- New configure option "--disable-text" which disables all init, debug and
+  error messages and saves about ~20k binary size (tested on i386).
+- Other minor bug fixes and improvements.
+
+
+0.9.15
+------
+
+- IDirectFB::CreateEventBuffer() no longer attaches input devices and doesn't
+  take input capabilities. It just creates an empty event buffer.
+- Added IDirectFB::CreateInputEventBuffer() which implements both the 0.9.14
+  and pre 0.9.14 behaviour of CreateEventBuffer().
+- Added DFBBoolean (with DFB_TRUE and DFB_FALSE).
+- DFBWindowEvent fields cx, cy, buttons, locks and modifiers are always valid.
+- Added implicit key grabbing while a key is held down in a window.
+  Fixes interoparability ugliness between XDirectFB and DFBTerm (e.g. Ctrl-D).
+- Great improvement of performance and stability of the multi application core
+  via new Fusion Kernel Device. SysV IPC usage completely dropped.
+- Added Fusion benchmark application (no graphics, just for testing).
+- Added desktop background configuration tool for multi app sessions.
+- Implemented additional config file loading for each application.
+  E.g. running ".../foo" loads "/etc/directfbrc.foo" and "~/.directfbrc.foo".
+- Option 'no-hardware' now only disables acceleration, but driver is loaded
+  and additional layers can still be used.
+- Options 'mode=' and 'pixelformat=' are now always fully supported.
+  Fullscreen applications forced to run windowed (with 'force-windowed' option)
+  will have a window with the size and format specified.
+- Fixed fatal bug in FreeType2 font loader that made many apps look wrong.
+- Fixed off-by-one bug in image loading code. Fixes color keyed blits in df_dok.
+- Some other bug fixes and optimizations.
+
+
+0.9.14
+------
+
+- Added IDirectFB::CreatePalette().
+- Added IDirectFBSurface::SetPalette().
+- Added IDirectFBPalette::GetCapabilities().
+- Added IDirectFBPalette::CreateCopy().
+- Added IDirectFBSurface::SetSrcColorKeyIndex() and SetDstColorKeyIndex().
+- Added experimental blitting flag DSBLIT_DEINTERLACE which is implemented
+  only in the Matrox driver for now.
+- Added DFDESC_FIXEDADVANCE forcing proportional fonts to be fixed width.
+- Added LUT8 and RGB332 acceleration to NeoMagic driver.
+- Added Meta (or Windows) key to wm hack (moving window etc.).
+- Added MPEG2 I-Frame image provider derived from mpeg2decode (mpeg.org).
+- Added driver for ucb1x00 based touchscreens.
+- Added dfbdump, a DirectFB debugging tool.
+- Renamed DSCAPS_SEPERATED to DSCAPS_SEPARATED.
+- Started abstraction of the "core system" featuring the "fbdev" system like
+  before and a new experimental "sdl" system. Yepp, DirectFB running on SDL.
+  Use "--dfb:system=sdl" to run applications under X.
+- Made the code compile on a variety of BSD flavours.
+- Enabled support for RGB332 by default.
+- Implemented YUV rectangle filling support for planar and non-planar
+  formats in software driver (Ville Syrjala <syrjala@sci.fi>).
+- Added gfxdriver for CyberPro 5xxx, a card found mainly in settop-boxes.
+- Matrox second head support via additional layers.
+  New option "matrox-crtc2" to activate this (Ville Syrjala <syrjala@sci.fi>).
+- Updated matrox vsync irq patch to support the second head.
+- Planar YUV blitting support in Matrox driver (Ville Syrjala <syrjala@sci.fi>)
+- Fixed nVidia driver for big endian hosts.
+- The window stack and video mode are now restored even if a fullscreen
+  application simply exits or gets killed by any signal (multi app core).
+- Improved multi application core stability via optional kernel device.
+- Some bug fixes, especially (de/re)initialization, multi app.
+- Added a directfb.spec file (Till Adam <till@adam-lilienthal.de>).
+
+
+0.9.13
+------
+
+- Added new interface IDirectFBDataBuffer with three implementations
+  (File, Memory and Stream).
+- Made image providers use the new IDirectFBDataBuffer.
+- Added DFBDisplayLayerTypeFlags for a basic layer classification.
+- Added DFBDisplayLayerDescription (changes DFBDisplayLayerCallback).
+- Added (yet unimplemented) IDirectFBImageProvider::SetRenderCallback().
+- Added input_only windows (windows w/o a surface).
+- Added support for interlaced surfaces with seperate field buffers to
+  all drawing and blitting functions.
+- Added new drawing flag DSDRAW_XOR.
+- Added support for color lookup tables. Added new surface type DSPF_LUT8
+  and IDirectFBSurface::GetPalette() and IDirectFBSurface::SetPalette().
+- Added DSDESC_PALETTE to IDirectFBSurfaceDescription.
+- Added DSCAPS_STATIC_ALLOC to DFBSurfaceCapabilities.
+- Added DWDESC_SURFACE_CAPS to DFBWindowDescriptionFlags.
+- Added DWOP_ALPHACHANNEL to DFBWindowOptions.
+- Added IDirectFBSurface::SetColorIndex() for indexed pixel formats.
+- Added pre/demultiplication to drawing functions.
+- Added IDirectFBDisplayLayer::GetWindow().
+- Added input driver for linux input driver (/dev/input/eventX).
+- Improved resource management with automatic cleanup (multi app core).
+- Cleaned up vertical retrace handling.
+- Added DFFA_NOCHARMAP to DFBFontAttributes to allow to access glyphs by
+  their raw indices.
+- Improved V4L video provider, added support for grabbing and planar YUV. Thanks
+  to Ville Syrjala <syrjala@sci.fi> and Mike Pieper <mike@pieper-family.de>.
+- Fixed color key handling in GIF provider.
+- Improvements to the layer driver API.
+- Renamed DLCAPS_INTERLACED_VIDEO to DLCAPS_DEINTERLACING.
+- Renamed DLOP_INTERLACED_VIDEO to DLOP_DEINTERLACING.
+- Enabled acceleration for the second head of a dual head Matrox card.
+- Updated Matrox vsync IRQ patch.
+- Improved S3 Savage drivers, thanks to Alex Song <alexsong@comports.com>.
+- Added directfb-csource, a C code generator for inline images.
+- Lots of bug-fixes, multi app core improvements.
+
+
+0.9.12
+------
+
+- Added IDirectFBSurface::DrawGlyph().
+- Added IDirectFBFont::GetKerning().
+- Added IDirectFBFont::GetGlyphExtents().
+- Added experimental blitting flags DSBLIT_SRC_PREMULTIPLY,
+  DSBLIT_DST_PREMULTIPLY and DSBLIT_DEMULTIPLY.
+- Added dfb_utf8_prev_char() and fixed dfb_utf8_next_char().
+- Added a mask of currently pressed buttons to input and window events.
+- Added structs DFBPoint and DFBDimension.
+- Added DIDTF_VIRTUAL for virtual input devices.
+- Added DSFT_BOTTOM to DFBSurfaceTextFlags.
+- Added DFB_NUM_PIXELFORMATS macro.
+- Give font providers control over pixel format and blending function.
+- Define DFBKeyIdentifierNames in directfb_keynames.h.
+- Some smaller fixes to the keyboard mapping.
+- Support all keysymbols in the lirc input driver. 
+- Implemented planar YUV blitting in software driver.
+- Optimizations in the software driver.
+- Fixed blitting and drawing to ARGB in matrox driver.
+- Implemented missing BES flipping in matrox driver.
+- Lots of bug-fixes.
+
+
+0.9.11
+------
+
+- Added IDirectFBSurface::Clear().
+- Added IDirectFBWindow::EnableEvents() and DisableEvents().
+- Added IDirectFBWindow::SetStackingClass().
+- Added IDirectFBDisplayLayer::GetLevel() and SetLevel()
+- Added IDirectFBInputDevice::GetKeymapEntry() (see below).
+- Redone keyboard handling. Each key now has a unique key_id which is mapped
+  to a Unicode-compatible key_symbol using the keymap provided by the driver.
+- Use kernel keymapping table in keyboard driver.
+- Added kernel patch for VMware SVGA frame buffer.
+- Added kernel patch for S3 Savage frame buffer (experimental).
+- Added S3 Savage driver (experimental).
+- The Print key can now be used to dump screenshots in PPM format.
+- Left and right modifiers have seperate key identifiers now.
+- Introduced kerning cache in FT2 font provider.
+- Added module probing to FT2 font provider.
+- Speed up text rendering by using a special state.
+- Allow to change the buffermode of layers.
+- Support buffermode changes for additional layers.
+- Fixed A8 font blitting bug in Matrox driver.
+- Install directfb headers in a directfb subdirectory.
+- Install and look for modules in versioned subdirectory.
+- Fixed vsync polling when MDA emulation is active.
+- Cleaned up config options (directfbrc and command-line options).
+- New option "videoram-limit=<amount-in-kb>".
+- New option "dont-catch" to disable signal handlers.
+- Added directfbrc(5) man-page.
+- Made shared memory handling thread-safe (multi-application core).
+- Optimizations in software driver.
+- Lots of bug-fixes.
+
+
+0.9.10
+------
+
+- Added options "mode=<width>x<height>" and "depth=<bpp>".
+- Added SonyPI Jogdial input driver acting as a third axis and button.
+- Added a destination rectangle to IDirectFBImageProvider::RenderTo().
+- Added IDirectFBEventBuffer::HasEvent().
+- Added IDirectFBDisplayLayer::SetCursorAcceleration().
+- Added IDirectFBWindow::PutAtop and PutBelow for restacking windows relatively.
+- Added destination colorkeying for display layers (like Xv does).
+- Added IDirectFBWindow::SetOptions() and GetOptions().
+- Added color keying option for windows (e.g. for shaped windows).
+- Added window options to disable moving, resizing, stacking and destruction by
+  wm hack. Added an option to turn a window into a passive output only window.
+- Added brightness control to neomagic video overlay (by Martin Mueller).
+- Added tmpfs mount point detection by Sebastian Klemke <packet@convergence.de>.
+- The shared memory area is now reinitialized during startup if it already
+  existed, but with no DirectFB apps running. Other multi app core fixes.
+- Added more cleanup code, less IPC resource leakage after shutdown.
+- Bit depths of fb.modes entries are ignored now when looking for a requested
+  mode. However, the default bit depth is the one of the first entry.
+- Improved RGB332 rendering using precalculated lookup tables with 4/8 entries.
+- Greatly optimized 16Bit StretchBlit in generic driver doubling performance
+  on PowerPC systems (others than Intel/PowerPC not tested).
+- Windows can now be resized and destroyed via wm hack (CapsLock shortcuts).
+- Window stack compositing optimizations.
+- Simplified and cleaned up internal layer driver API.
+- Major code cleanups in windowing and layer core.
+- Fixed NeoMagic driver, that was broken in 0.9.9.
+- Fixed doubled and interlaced video modes.
+- Enhanced reference manual including an introduction to IDirectFB.
+- Many, many bug/stability fixes. More code commented. Bigger TODO file ;)
+
+
+0.9.9
+-----
+
+- Added DSPF_I420 and DSPF_YV12, two planar YUV formats.
+- Added ATI Overlay support for all four YUV formats.
+- Added NeoMagic YUV Overlay support.
+- Added static linking support. Minor changes to driver and interface modules.
+- There's a general IDirectFBEventBuffer now that can be connected to
+  input devices and windows. Added DFBEvent union that can contain
+  any specific event class.
+- Added DFBUserEvent that can be used by developers (user of the library).
+- Added IDirectFBEventBuffer::PostEvent that can be used for any event class.
+- Each window has a unique window id now. DFBWindowEvent contains the id.
+- Added GetID functions to IDirectFB- DisplayLayer, Window and InputDevice.
+- Added IDirectFBSurface::TileBlit.
+- IPAQ buttons support by Ara Hacopian <ahacop@anthrotronix.com>.
+- Windows can now be created with a specific pixel format, e.g. YUV.
+- RGB332 acceleration on Matrox cards (including alpha blending).
+- Added fast memcpy routine that uses MMX, MMXEXT or SSE.
+- Changed DirectFB command-line parsing: The only recognized options are
+  --dfb-help and --dfb: follow by a comma-separated list of DirectFB options.
+  The format of the options is the same as used in the directfbrc file.
+- Surfaces can now be created using existing surface data.
+- New option "[no-]cursor" to enable/disable the default cursor on startup.
+- New option "disable-window-opacity" for testing/tweaking purposes.
+- New option "lefty" that enables swapping of left and right button.
+- Applied patch from Till Adam <till@adam-lilienthal.de> that adds
+  DFBInputDeviceLockState, IDirectFBInputDevice::GetLockState() and
+  LED handling in keyboard driver.
+- Rewritten Libmpeg3 provider based on OpenQuicktime provider (YUV/Sound).
+- Make usage of CON2FBMAP (by Jiri Svoboda <Jiri.Svoboda@seznam.cz>).
+- '/dev/input/js*' support by W. Michael Petullo <mike@flyn.org>.
+- Detailed documentation of dbox2 remote driver code (example driver).
+- More code documentation, especially state handling.
+- Additional frame buffer device can be used to debug the surface manager.
+- All global DirectFB symbols have the prefix "dfb_" now.
+- Enno Brehm <enno@convergence.de> added dlopen on libdirectfb with RTLD_GLOBAL.
+- Completely rewritten shmalloc stuff (used by Multi Application Core)
+  based on libc5's GNU malloc. It now uses tmpfs (former shmfs).
+- Some optimizations, Matrox colorkeying fixes.
+- ATI state fix by Topi Kanerva <topi.kanerva@eke.fi>.
+- USB and PS/2 mice fixes, endian fixes on parisc, many other bugfixes.
+
+
+0.9.8
+-----
+
+- Merged multi application core, which is currently under development. Must be
+  enabled at compile time (--enable-multi). It is *NOT* stable yet.
+- Input/Gfx driver API changes to be ready for multihead and multi application
+  core.
+- Added OpenGL support via the new interface "IDirectFBGL".
+- Added support for IMPS/2 mice including wheel support.
+- Added remote control driver for dbox2.
+- Added DWET_WHEEL window event. Focused windows now receive events if the
+  mouse wheel is use.
+- Added simple blitting support for nVidia cards <dfoesch@cs.nmsu.edu>.
+- Added "wm_hack" feature: press shift lock over a window and spin the mouse
+  wheel to change the window opacity.
+- Completed support for RGB332 (8bit mode), not fully optimized yet.
+- New triange fillig code from Holger Waechtler. Adds clipping support and
+  utilizes accelerated rectangles as a fallback if possible.
+- Removed rounding factor when blitting non-scaled with tmu,         
+  very big fonts looked incorrect (matrox driver).
+- Fixed triangle filling in tdfx driver <DWood@daedalcorp.com>
+- Fixed segfault when rendering pipeline is empty, e.g. using DSDRAW_BLEND
+  with SrcFunc DSBF_ZERO and DstFunc DSBF_ONE.
+- In RGB332 mode initialize alpha values in palette. Corrected color
+  values in palette.
+- Fixed segfault in jpeg provider with large images.
+- Fixed some small memory leaks.
+- Include SMF_SOURCE in SMF_ALL, could have caused blitting from the wrong
+  source recently (longer for a very few drivers) when switching to another
+  state.
+- Fixed "--fbdev=" option.
+- ABI version handling for all drivers.
+- Moved examples to extra package (DirectFB-examples).
+- The mouse cursor is now activated by default.
+- DirectFB can be build with dietlibc.
+- Some namespace cleanups.
+- Updated aty128fb patch for linux 2.4.16.
+
+0.9.7
+-----
+
+- Added deinterlacing for interlaced video sources to Matrox Backend Scaler.
+- Added DSPF_UYVY and clarified description of both YUV formats.
+- Added acceleration for Matrox Mystique, Millennium I&II, G100.
+- Added support for YUV in V4L video provider.
+- Added support for deinterlacing in df_layer example.
+- Added option "--fbdev=<device>" to specify another device than "/dev/fb0".
+- Added support for 'gsync true', 'csync high' and 'extsync true' in fb.modes.
+- Added 8bit RGB332 pixelformat, implementation is not complete yet.
+  If you want RGB332, you have to enable it using ./configure --enable-rgb332.
+- Optimized RGB15/RGB16 color keyed blit (doubled performance on some CPUs).
+- Allow RGB15 mode on fbdev drivers that report to use one bit for alpha.
+- Fixed blocking of CreateImageProvider when called on /dev/video with BTTV.
+- DirectFB now restores the palette during deinitialization, turns cursor and
+  blanking back on and restores the terminal attributes like local echo.
+  These fixes help a lot when using DirectFB with the option "--no-vt-switch".
+- Updated NeoMagic frame buffer driver patch for 2.4.10 and above.
+- Updated aty128fb frame buffer driver patch. The patch was tested with kernel
+  versions from 2.4.7 - 2.4.12. It may work with older versions too.
+- IDirectFBSurface::SetSrcColorKey has to be called on the source now,
+  when blitting to a surface which has source color keying enabled.
+- SetSrcColorKey and SetDstColorKey take three values now: r, g and b.
+  They will be converted to the pixelformat of the surface automatically.
+- Some minor fixes.
+
+0.9.6
+-----
+
+- Added H3600 (ipaq) Touchscreen input driver.
+- We now accept compatible pixelformats,
+  e.g. IPAQ's RGB 444 format is compatible with RGB 565.
+- Matrox Backend Scaler support as additional display layer.
+- YUY2 format added for video playback.
+- Added 'IDirectFBDisplayLayer::Set/GetColorAdjustment()'.
+- Added simple layer example which plays a video onto the second layer.
+- Added new window capability DWCAPS_DOUBLEBUFFER to create windows with
+  two back buffers. This is useful for overlapping windows which both
+  cause frequent updates of the window stack.
+- Added 'IDirectFBWindow::Close()' that puts a 'DWET_CLOSE' event into the
+  window's event queue. The event dispatcher thread can then decide to close it.
+- Added 'IDirectFBWindow::Destroy()' which actually destroys the window after
+  sending a 'DWET_DESTROYED' event, so the event dispatcher thread can notice
+  and release any interfaces belonging to it.
+- Added result 'DFB_DESTROYED' which is currently returned by 'IDirectFBWindow'
+  and 'IDirectFBSurface' if the window or surface has been destroyed.
+- Fixed surface manager bug causing inconsistency between video/system memory.
+- More changes to surface manager fixing problems when using many many threads.
+- Fixed segfault when loading big PNGs, seemed to be a problem with alloca.
+- Minor fixes to window stack code.
+- Some fixes to deinitialization code.
+
+0.9.5
+-----
+
+- Added 'IDirectFB->CreateInputBuffer()' that allows to easily
+  create input buffers for specific events.
+- Added 'IDirectFBInputDevice->AttachInputBuffer()' to
+  attach an existing input buffer to another input device.
+- Added 'IDirectFBImageProvider->GetImageDescription()' to obtain information
+  about alpha channel availability and possible color keys.
+- New LIRC input driver, name your keys (lirc config file) like the DirectFB
+  keycode enum does without the "DIKC_" prefix, e.g. "OK", "MENU" or "VOLUMEUP".
+- First version of nVidia RIVA TNT/TNT2/GeForce driver (very limited right now).
+- Updated kernel patches, improved synchronization for FBIO_WAITFORVSYNC.
+- New pkg-config file "directfb-internal.pc" for better support
+  for third party modules built outside the DirectFB source tree.
+- You can move windows with the mouse when holding down CapsLock.
+- Font width can now be set independent from height, e.g. for non-square pixels.
+- Set gamma ramp, fixes "strange-colors-effect" with some frame buffer drivers.
+- Accept interlaced or double scan modes, 320x200 looks really cool in some way.
+- Deinitialization code cleaned up and reactivated.
+- V4L capturing is now stopped by exit and signal handlers.
+- Matrox driver cleanup and blending state fixes.
+- More detailed generated API Reference (more comments in directfb.h).
+- Many bug fixes, some compile fixes.
+
+0.9.4
+------
+
+- Software driver pipeline optimization giving me 70% speed up for solid lines.
+- Several bugfixes for image loading, Matrox driver, mode handling and more.
+- Removed 'realloc()s' that caused callback functions to write into the
+  old memory location if 'realloc()' returns a new one.
+- API rewrite for IDirectFBDisplayLayer with new capabilities, e.g. flicker
+  filtering, better configuration handling by 'Get/Set/TestConfiguration()'.
+- Sub surface handling improved, especially for surface resizing.
+- More safety and sanity checks and new error codes
+  (DFB_MISSINGIMAGE, DFB_INVAREA, DFB_THIZNULL and DFB_IDNOTFOUND).
+- Additions to IDirectFBVideoProvider: 'GetCapabilities()' retrieves info about
+  the provider, 'Set/GetColorAdjustment()' set/get values like contrast etc.
+- Cursor can be enabled/disabled and opacity can be set independently.
+  Also cursor appears centered now.
+- Experimental support for VT switching during runtime ;-)
+- New command line option "--force-windowed" which already works with most of
+  the examples, levels other than DFSCL_NORMAL give DFB_ACCESSDENIED.
+- GIF loading to ARGB fixed, transparent GIFs are now supported as ARGB.
+- Several fixes to video mode list and pixelformat handling in
+  'read_modes()', 'fbdev_set_mode()' and 'fbdev_get_pixelformat()'.
+- Added IDirectFBSurface->DrawLines(), used by df_dok now.
+- Some optimizations in DrawString and core font handling.
+- Fixed font problems with Matrox cards, their texture cache is flushed
+  now after writing the glyph into the frame buffer (i.e. into the texture).
+- Mouse cursor movements are now clipped by the screen ;-)
+- Fixed 'directfb.h', identifier "id" was also a keyword in Objective C.
+- Added IDirectFBInputBuffer->WaitForEventWithTimeout,
+  was missing in last release.
+
+0.9.3
+------
+
+- All modules (drivers/providers) are built conditionally, can be
+  disabled. configure spits out a summary of all modules.
+- Some license headers were forgotten to change to LGPL.
+- New remote control keycodes and remote control input type.
+- df_window can play video files and behaves like a window manager.
+- New "thanks to" section in README.
+- Window stack repaints optimized through recursive function.
+- Added DirectFBSetOption from Till Adam <till@adam-lilienthal.de>.
+- Added IDirectFBInputBuffer->WaitForEventWithTimeout.
+- Changed to pthread conditions in waiting code.
+- Matrox driver fixed when blitting from 32bit without blending.
+- Added DFBInputDeviceTypeFlags, removed DIDID_TYPE.
+- Several cleanups in core, common code moved into helper functions.
+- Fonts can be loaded monochrome and/or without kerning.
+- Console blanking now disabled.
+- Software alpha blending performance boost for non MMX machines.
+- Added inputdriver for serial mice with config option "mouse-protocol".
+- Modularized inputdrivers.
+- Even faster DrawString() software implementations.
+- New function Font->GetStringExtents.
+- Use of antialiasing, kerning and hinting for fonts is now configurable.
+- Some fixes in the software rendering functions.
+- Support for interlaced PNGs (thanks to Johannes Zellner).
+- Two new example applications in very early stage.
+- New function IDirectFB->WaitForSync.
+
+0.9.2
+------
+
+- Fix for loading jpegs unscaled into 24bpp surfaces
+- 15bpp support for jpeg provider
+- v4l provider support for devfs (/dev/v4l/video*)
+- API change for DFBSurfaceDescription (pixelformat field instead of bpp
+  field, removed DSCAPS_ALPHA.)
+- DrawString() and GetStringWidth() support UTF-8 encoded strings now. They
+  take an additional parameter that specifies the number of bytes to use from 
+  the passed string or -1 for the complete string.
+- Fonts are no longer loaded completely, instead glyphs are loaded on demand
+  and are cached for later use.
+- Font kerning tables are no longer loaded by the core.
+- Removed default font from the core and made it a IDirectFBFont interface.
+  Pass NULL as filename to CreateFont() to get the default font.
+- Added MPEG video provider written by Kim JeongHoe based on libmpeg3.
+- Performance improvements in the software functions for DrawLine(), 16 bit
+  drawing functions and DrawString() in all depth.
+- Added GetPos() and GetLength() functions to the video provider API.
+- Use /dev/tty0 or /dev/vc/0 (for devfs) instead of /dev/console so DirectFB 
+  works on machines with serial consoles.
+- Removed dependency on libm.
+
+0.9.1
+------
+
+- pkg-config files are available for optionally installed interfaces
+  like IDirectFBVideoProvider_AviFile, so apps can test for their existence.
+- Added IDirectFBInputDevice->GetButtonState() which returns the
+  state of the specified button. GetButtons() is also still available.
+- New demo called "df_knuckles" draws a three dimensional lighted skull
+  that can be rotated by the mouse. (Port from Mark Vojkovich's DGA demo)
+- Fixed accelerator ids in neomagic driver to match the ids in the
+  current neofb kernel patch that is now included in "patches".
+- Moved command-line parsing out of DirectFBCreate() into DirectFBInit().
+  This means to inititalize DirectFB() there are now two calls necessary:
+  DirectFBInit( &argc, &argv ); DirectFBCreate( &dfb );
+- Added IDirectFBSurface->FillTriangle() for solid and blended triangles.
+  Implemented in generic driver and Voodoo, Matrox acceleration.
+- Interfaces with a reference counter of zero are automatically freed
+  unless you enabled debugging during configure. In debug mode a released
+  interface returns DFB_DEAD if a function has been called.
+- Added Shockwave Flash Video Provider written by Joachim 'Roh' Steiger.
+  You will need the libflash, that can be downloaded as a shared library
+  from our download section. No modifications of libflash code.
+- Added an option to directfb-config that makes "--libs" output
+  the suitable LDFLAGS that are needed to have AviFile symbols resolved.
+- Mouse cursor is no longer enabled by default.
+- AviFile Provider now probing for ".asf" files, too.
+- Fixed Stop in AviFile Provider, work around crashing AviFile call
+  Player->Stop by using Pause and Continue. PlayTo can now be called
+  several times without stopping to change the destination on the fly.
+- V4L Video Provider no longer gets a NULL pointer as the filename,
+  but "/dev/video0" and so on. Removed v4l code from core.
+- AviFile Provider updated to compile with newest AviFile version.
+- Implemented flipping of surfaces that are no window or layer surfaces,
+  when the surface is a subsurface, a flipping region has been specified
+  or the flipping flag DSFLIP_BLIT has been used.
+- Improved documentation generator, a few parsing fixes.
+- Added missing "void *callbackdata" to 
+  DFBInputDeviceCallback and DFBVideoModeCallback.
+- Some minor fixes and cleanups.
+
+
+0.9.0
+------
+
+Initial release.
diff --git a/Source/DirectFB/README b/Source/DirectFB/README
new file mode 100755
index 0000000..261a1b3
--- /dev/null
+++ b/Source/DirectFB/README
@@ -0,0 +1,437 @@
+DirectFB README
+---------------
+
+   DirectFB is a graphics library which was designed with embedded
+   systems in mind. It offers maximum hardware accelerated performance
+   at a minimum of resource usage and overhead. 
+
+   Check http://www.directfb.org/ for more and up to date infos.
+
+
+Supported Operating Systems
+---------------------------
+   
+   - GNU/Linux
+
+   Using SDL (without acceleration support), DirectFB also supports
+   the following operating systems:
+
+      - FreeBSD (last tested: DirectFB 0.9.21 on FreeBSD 5.2)
+      - NetBSD  (tested on NetBSD 1.6)
+      - OpenBSD (tested on OpenBSD 3.2)
+           (If you have problems, try ./configure --disable-mmx)
+   
+   Please note that SDL support is experimental and incomplete. It is
+   intended for developers to allow development of DirectFB applications
+   in various environments.
+
+   Native (non SDL) support for the following operating systems is in progress:
+
+   - Mac OS X (tested on Mac OS X 10.3.5)
+
+   We do not have the resources to ensure that every release of
+   DirectFB works on all supported platforms. If you are a user of one
+   of the operating system listed above, and have the time to test the
+   CVS or GIT version regularly, your help is greatly appreciated.
+
+
+Build Requirements
+------------------
+
+   Mandatory are
+     - libc
+     - libpthread
+     - libm
+     - libdl
+
+   For regenerating autofoo (./autogen.sh or autoreconf)
+     - autoconf
+     - automake
+     - libtool
+     - pkg-config
+
+   Optionally, depending on the configuration you want:
+
+   FBDev
+     - Linux kernel 2.2.x or newer with working frame buffer device
+       (check /proc/fb) for the fbdev system.
+
+   SDL
+     - libSDL (Simple Direct Media Layer) for the sdl system.
+
+   X11
+     - libX11 (X11 client library) for the X11 system (libx11-dev and libxext-dev packages).
+
+   The following libraries are optional, but important (Debian package names):
+
+   Fonts
+     - libfreetype6-dev for TrueType and other fonts
+
+   Images
+     - libjpeg-dev for Joint Picture Expert Group images
+     - libpng-dev for Portable Network Graphics
+
+   Extra
+     - zlib1g-dev for compressed screenshot support (also needed by libpng)
+
+   The multi application core also requires <linux/fusion.h>, see the
+   section "Running multiple DirectFB applications" for more details.
+
+   The build of the image and font providers can be disabled but we
+   strongly suggest that you don't do this since the code examples and
+   a lot of DirectFB applications depend on the functionality provided
+   by them.
+
+   The libmpeg3 video provider requires the libmpeg3 library which is
+   not commonly installed. We provide this package on our web-site at
+   http://www.directfb.org/download/contrib/.
+
+   The avifile and flash video providers that used to be shipped with
+   DirectFB have been moved to the DirectFB-extra package.
+
+   We suggest you also install pkg-config available from
+   http://www.freedesktop.org/software/pkgconfig/. It will help you
+   to compile applications based on DirectFB.
+
+
+Usage Requirements
+------------------
+
+   Depending on the DirectFB application you want to run, you need some
+   or all of these:
+
+   - A working frame buffer device (check the output of 'fbset -i').
+   - A keyboard (if it works on the console, everything should be fine).
+   - A PS/2 or serial mouse for windowing. USB and ADB mice do also work
+     via PS/2 emulation.
+
+   Using the single application core you always need access to /dev/tty0,
+   /dev/fb0 and the mouse device (/dev/psaux, /dev/mouse).
+   You can either run all DirectFB applications as root or allow users
+   to access these devices. A reasonable way to do this is to add users
+   to the group tty (or some other group) and allow this group to read
+   and write the files in /dev:
+
+       crw-rw----    1 root     tty       29,   0  /dev/fb0
+       crw-rw----    1 root     tty       10,   1  /dev/psaux
+       crw-r-----    1 root     tty        4,   0  /dev/tty0
+
+   If you are using the multi application core, only the master process needs
+   access to all of these devices. Additional processes (slaves) just need
+   access to /dev/fb0 and:
+
+       crw-rw----    1 root     fusion    29,   0  /dev/fusion/0
+   
+   Note that the master creates a shared memory file, probably
+   in '/dev/shm/fusion.0'. It's read/writeable for anyone matching
+   the master process' user or group.
+
+
+   Some applications from the DirectFB-examples package have additional
+   requirements:
+
+   - A video card supported by video4linux for df_video.
+   - A joystick for df_joystick.
+
+
+Running multiple DirectFB applications at the same time
+-------------------------------------------------------
+
+   With the default build of the DirectFB library, only one DirectFB
+   application may be running. However you have the option to use the
+   multi application core of DirectFB which allows multiple DirectFB
+   applications to run at the same time within a session.
+
+   DirectFB applications communicate through a layer we call "Fusion".
+   This layer was previously implemented completely in user space using
+   semaphores and message queues. But since 0.9.15 the Fusion Kernel
+   Device is required which implements critical parts of Fusion and thus
+   lead to better performance and decent stability. To install this kernel
+   module (only available for Linux yet), find the linux-fusion
+   module in our CVS or GIT repository or on the DirectFB website.
+   For DirectFB 1.4.x releases you should use linux-fusion 8.1.1 or newer.
+
+   Compile DirectFB with multi-application core enabled:
+
+     ./configure --enable-multi
+
+   Make sure your Linux kernel supports tmpfs. This is explained in
+   the kernel sources in Documentation/filesystems/tmpfs.txt.
+   Mount a tmpfs filesystem as /dev/shm:
+
+     mount tmpfs /dev/shm -ttmpfs
+
+   Optionally a mount point can be specified via the "tmpfs" option,
+   see directfbrc(5). The option has to be the same for all processes.
+
+   A good way to test the multi-application core is to install the lite
+   toolkit and DFBTerm, a DirectFB terminal (both available in the
+   DirectFB CVS/GIT repository). You can then start DirectFB applications
+   from dfbterm.
+
+
+Recommendations
+---------------
+
+   To take full advantage of hardware acceleration, 
+   a Matrox G200/G400/G450/G550 graphics card is recommend for this 
+   version of DirectFB. The drivers for ATI128, Voodoo 3/4/5/Banshee,
+   NeoMagic and S3 Savage cards included with this release are work in
+   progress and only yet support a subset of the possible accelerations.
+
+
+Installation
+------------
+
+   1) In the DirectFB directory type:
+
+	./configure <options>
+	make
+	make install (as superuser)
+
+      Use './configure --help' to get a list of possible configure options.
+
+      Imported options include:
+        --enable-multi   Enables the Multi Application Core
+        --enable-debug   Enables many debug messages and assertions
+        --enable-trace   Enables run time stack trace information
+
+      Debugging and especially stack trace support are a performance
+      impact. It may be noticably slower in some areas, e.g. text drawing.
+
+      You may use the options "no-debug" and "no-trace" by default, e.g.
+      in '<prefix>/etc/directfbrc', and use "--dfb:debug,trace" on the command
+      line if needed.
+
+   2) Make sure that "<prefix>/lib" is listed in your /etc/ld.so.conf.
+      The default prefix is "/usr/local". After adding it you have to
+      run 'ldconfig' as superuser.
+
+      Alternatively, you can add the path to the environment
+      variable LD_LIBRARY_PATH. This is useful for temporarily
+      switching to another installed version.
+
+   3) You might want to copy fb.modes to /etc or merge it with your
+      existing /etc/fb.modes file. The first entry will be used by
+      default - copy other entries you may need.
+
+   4) If you want to use a serial mouse, create a link called /dev/mouse
+      that points to serial device (e.g. /dev/ttyS0). Then add a line
+      describing your mouse-protocol to /etc/directfbrc or ~/.directfbrc:
+      "mouse-protocol=[ms|ms3|mouseman|mousesystems]".
+
+   5) If you are cross compiling and have installed the required libraries
+      someplace other than /usr/local/lib be sure to add the bin directory
+      for those libraries to the front of your 'PATH'.
+
+        For instance if you configured using:
+          --prefix=/dfb/usr/local
+        then be sure to
+          export PATH=/dfb/usr/local/bin:$PATH
+        before compiling and installing.
+
+
+Configuring DirectFB
+--------------------
+
+   There are lots of things that can be configured. We try to ship DirectFB
+   with reasonable defaults but you might have to tweak things. There are
+   several ways to do this. You may edit the system-wide configuration
+   file <prefix>/etc/directfbrc or the user-specific $HOME/.directfbrc.
+   There's a manual page called directfbrc(5) that documents all the settings.
+   The same manual page also explains how DirectFB application can be
+   configured via the command-line.
+
+
+Configuring the Linux frame buffer device
+-----------------------------------------
+
+   DirectFB's prefered way-of-working needs a Linux kernel
+   with frame buffer support. Check the documentation in the kernel tree
+   (/usr/src/linux/Documentation/fb/) on how to enable the frame buffer device
+   for your graphics card. 
+
+   The generic VESA frame buffer device does not support mode switching
+   and you will not get hardware acceleration. To make DirectFB work with
+   veasfb, you should add the following lines to /etc/lilo.conf:
+
+	append="video=vesa:ywrap,mtrr"
+
+   'ywrap' enables panning with wraparound.
+   'mtrr' enables setting caching type for the frame buffer to write-combining.
+
+	vga=791
+
+   This sets the mode on startup. 791 means 1024x768@16, 788 means 800x600@16.
+
+   All VESA Video Modes:
+
+   Bits    640x480 800x600 1024x768 1280x1024 1600x1200
+   8       769     771     773      775       796
+   16      785     788     791      794       798
+   32      786     789     792      795       799
+
+   Other frame buffer devices support mode switching. DirectFB will only 
+   support modes listed in your /etc/fb.modes file. By default the first 
+   entry found is used.
+
+   If you have a Matrox card you may want to try the vsync patch found in
+   the patches directory that enables applications to "idle wait" for the
+   vertical retrace.
+
+
+Using the builtin "window manager"
+----------------------------------
+
+   Since DirectFB lacks a real window manager, we added a hack to the
+   window stack to allow for basic window management. While pressing
+   the <Meta> (or Windows) key or alternatively <Caps-Lock> you can do
+   the following:
+
+     - Drag your mouse to move the focused window.
+     - Drag and press <Ctrl> to resize the focused window.
+     - Drag and press <Alt> to change the opacity of the focused window.
+     - Press C to close the focused window.
+     - Press A to lower the focused window to the bottom.
+     - Press X to cycle the focus through the windows.
+     - Press S to raise the lowest window to the top.
+     - Press P to enable and show the mouse cursor.
+     - Press R to rotate the focused window by 90 degree.
+     - Press E to focus the window currently under the mouse cursor,
+       useful in conjunction with 'X'.
+     - Press Escape to return from fullscreen mode to the desktop.
+       (currently not advisable if the fullscreen app is still flipping)
+     - Press F12 to redraw the whole window stack.
+
+   You might want to use the "capslock-meta" option (see directfbrc(5))
+   if you don't have a <Meta> key.
+
+
+Documentation
+-------------
+
+   A complete API reference documentation in HTML format is created during 
+   the build in the docs directory. You may also access the API reference
+   as well as a concepts overview, tutorials and the FAQ online at
+   http://www.directfb.org/documentation/. 
+
+
+Thanks to
+---------
+
+   Johannes Zellner <johannes@zellner.org>
+   Till Adam <till@adam-lilienthal.de>
+   Joachim Steiger <roh@hyte.de>
+   Felix von Leitner <leitner@fefe.de>
+   Johannes Stezenbach <js@convergence.de>
+   Michael Natterer <mitch@convergence.de>
+   Holger Waechtler <holger@convergence.de>
+   Kim JeongHoe <king@mizi.com>
+   Jason Gaiser <jasno@san.rr.com>
+   W. Michael Petullo <mike@flyn.org>
+   Jiri Svoboda <Jiri.Svoboda@seznam.cz>
+   Hallvar Helleseth <hallvar@ii.uib.no>
+   Topi Kanerva <topi.kanerva@eke.fi>
+   Daniel Mack <daniel@convergence.de>
+   Ara Hacopian <ahacop@anthrotronix.com>
+   Mike Haertel <mike@albert.ai.mit.edu>
+   Enno Brehm <enno@convergence.de>
+   Martin Mueller <mm@convergence.de>
+   Sebastian Klemke <packet@convergence.de>
+   Fredrik Hallenberg <hallon@lysator.liu.se>
+   Antonino Daplas <adaplas@users.sourceforge.net>
+   Scott A McConnell <samcconn@cotw.com>
+   Alex SONG <zzaleson@uqconnect.net>
+   Ville Syrjälä <syrjala@sci.fi>
+   Brian J. Murrell <a40e8119bbddbe7b3d281db117f19b32@interlinx.bc.ca>
+   Tim Janik <timj@gtk.org>
+   Billy Biggs <vektor@dumbterm.net>
+   Andreas Oberritter <obi@tuxbox.org>
+   Simon Ueng <simon@ftech.com.tw>
+   Scott Brumbaugh <scottb.lists@verizon.net>
+   Sebastian Ley <sebastian.ley@mmweg.rwth-aachen.de>
+   James Su <suzhe@turbolinux.com.cn>
+   Sarma Kolluru <Sarma.Kolluru@nsc.com>
+   Oliver Schwartz <Oliver.Schwartz@gmx.de>
+   Florian <florian.fernandez2@wanadoo.fr>
+   J.P. Delport <jpdelport@csir.co.za>
+   Michel Dänzer <michel@daenzer.net>
+   Maurizio Monge <monge@sns.it>
+   Tim Wright <tim.wright@iosystems.co.uk>
+   Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+   Andreas Robinson <andro134 at student.liu.se>
+   Michael Hunold <hunold@convergence.de>
+   Brandon M. Reynolds <breynolds@comtime.com>
+   Micha Nelissen <micha@neli.hopto.org>
+   Vadim Catana <vcatana@registru.md>
+   Henning Glawe <glaweh@physik.fu-berlin.de>
+   Ed Millard <emillard@direcway.com>
+   Claudio Ciccani <klan82@cheapnet.it>
+   Tom Bridgwater <genuss@gmail.com>
+   Oskar Liljeblad <oskar@osk.mine.nu>
+   Bryce Nichols <bryce@bnichols.org>
+   Stefan Lucke <stefan@lucke.in-berlin.de>
+   Mws <mws@twisted-brains.org>
+   Ivan Daniluk <ivan@shvydko.ua>
+   Mark Salter <msalter@redhat.com>
+   Martin Lütken <nitram@lutken.dk>
+   Sylvain Meyer <sylvain.meyer@worldonline.fr>
+   Mark Adams <mark147m@gmail.com>
+   Damian Kowalewski <damian.kowalewski@mail.mcgill.ca>
+   Jakub Bogusz <qboosh@pld-linux.org>
+   Nathanael D. Noblet <nathanael@gnat.ca>
+   Ryan Burns <rburns@mvista.com>
+   Colin Watson <cjwatson@debian.org>
+   Guillem Jover <guillem@debian.org>
+   Jeff Bailey <jbailey@ubuntu.com>
+   Andreas Jochens <aj@andaco.de>
+   Daniel J Laird <daniel.j.laird@nxp.com>
+   Marko Mäkelä <marko.makela@hut.fi>
+   Nils Magnus Larsgard <nmlarsgaard@atmel.no>
+   Pär Degerman <parde@ikp.liu.se>
+   Michel van Noorloos <michel.van.noorloos@sioux.nl>
+   Gery <gxkahn@gmail.com>
+   Shane <shanevolpe@gmail.com>
+   Paul Mackerras <paulus@samba.org>
+   Attilio Fiandrotti <attilio.fiandrotti@gmail.com>
+   Vaclav Slavik <vslavik@fastmail.fm>
+   Philip Jägenstedt <philipj@opera.com>
+   sridewa <sridewa@gmail.com>
+   Eugene Everson <eugene@tranzas.co.jp>
+   Mike Crowe <mac@mcrowe.com>
+   Kieran Bingham <kbingham@mpc-data.co.uk>
+   Luis Mondesi +lemsx1 +gmail,com
+   Keith Mok <ek9852@gmail.com>
+   GARDET Guillaume <ggardet@adeneo.adetelgroup.com>
+   Phil Endecott <spam_from_directfb_dev@chezphil.org>
+   Brian Austin <brian.austin@cirrus.com>
+   Keith Mok <ek9852@gmail.com>
+   Young Hoon <jcybha@hanmail.net>
+
+Special thanks to Ville Syrjala for his great work on the
+Matrox TV-Out support and for his several patches including
+fixes and enhancements for the whole library. He also did
+several ports like UAE or mplayer for DirectFB. Check out his
+site at 'http://www.sci.fi/~syrjala/'.
+
+
+Legal stuff
+-----------
+
+   (c) Copyright 2001-2009  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+
+   The complete text of the license is found in the file COPYING. 
diff --git a/Source/DirectFB/TODO b/Source/DirectFB/TODO
new file mode 100755
index 0000000..d0e167f
--- /dev/null
+++ b/Source/DirectFB/TODO
@@ -0,0 +1,63 @@
+Incomplete (roughly sorted by priority)
+---------------------------------------
+
+New Surface Core
+- Test DSCAPS_STATIC_ALLOC.
+- Revive depth buffers.
+- Revive CSLF_FORCE for locking buffers in(to) INTERNAL memory.
+- Revive surface setinels.
+- Fix preallocated surface acceleration.
+- Finish FBDev surface pool using the old surface manager code.
+  - Fix pool/gfxcard init order (using workaround at the moment).
+  - Defragment free space.
+  - Readd auxiliary memory pool using its own instance of the manager.
+- Get all system modules working again.
+- Probably more modules and tools need updates...
+  - v4l video provider
+- Make use of Read/Write if locks for CPU are not possible and
+  implement an OpenGL based system module with OpenGL acceleration.
+
+IDirectFBSurface::Flip() with multiple regions.
+
+Support rotated screens (180 is implemented).
+
+Support vga16, i.e. add DSPF_LUT4.
+
+Move config system to libdirect with more features and much smaller/generic code.
+
+Finish VT switching.
+ - Save/restore video only buffers.
+ - Handle(?) buffers being permanently locked in video memory.
+ - Support(?) switching during exclusive access to a layer.
+
+Write well documented driver skeletons.
+
+Finish implementation of cooperative levels.
+
+Finish module unloading (done for most cases).
+
+Convert all D_DEBUG usage to D_DEBUG_AT using some D_DEBUG_DOMAINs.
+Implement debug levels, one setting per domain.
+
+Modularize pixel formats (eventually with dynamic extension support).
+
+Run time single/multi app core selection (both enabled during build).
+
+Add core cursor component with animated shape support and better integrated
+changes caused by entering different windows.
+
+Implement CoreFont sharing between applications
+to save glyph rendering and surface allocations.
+
+Add cooperative levels to input devices, implement sharing/distinction for
+applications (e.g. PS/2 Keyboard + PS/2 Mouse driver XDirectFB on Monitor out,
+USB-Keyboard + USB-Mouse drive XDirectFB and/or other applications on TV Out,
+USB-Wacom Tablet with mouse and pen can be assigned or switched to either,
+preferrably during runtime)
+
+Virtual window resolution with scrolling/panning.
+
+Rework cursor and palette handling in the window stack.
+
+
+[...lots of things missing here...]
diff --git a/Source/DirectFB/aclocal.m4 b/Source/DirectFB/aclocal.m4
new file mode 100755
index 0000000..d1c0d75
--- /dev/null
+++ b/Source/DirectFB/aclocal.m4
@@ -0,0 +1,7776 @@
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This file 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.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61],,
+[m4_warning([this file was generated for autoconf 2.61.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 52 Debian 1.5.26-1ubuntu1 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+_LT_REQUIRED_DARWIN_CHECKS
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# --------------------------
+# Check for some things on darwin
+AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+   # By default we will add the -single_module flag. You can override
+   # by either setting the environment variable LT_MULTI_MODULE
+   # non-empty at configure time, or by adding -multi_module to the
+   # link flags.
+   echo "int foo(void){return 1;}" > conftest.c
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+     -dynamiclib ${wl}-single_module conftest.c
+   if test -f libconftest.dylib; then
+     lt_cv_apple_cc_single_mod=yes
+     rm -rf libconftest.dylib*
+   fi
+   rm conftest.c
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+   [lt_cv_ld_exported_symbols_list=yes],
+   [lt_cv_ld_exported_symbols_list=no])
+   LDFLAGS="$save_LDFLAGS"
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[0123]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*)
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+   10.[[012]]*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+   10.*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+m4_if($1,[],[
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
+[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
+[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  AC_LIBTOOL_LANG_CXX_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+	  AC_LIBTOOL_LANG_F77_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+	  AC_LIBTOOL_LANG_GCJ_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+	AC_LIBTOOL_LANG_RC_CONFIG
+	;;
+
+      *)
+	AC_MSG_ERROR([Unsupported tag name: $tagname])
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognize shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognize a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix[[4-9]]*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix[[4-9]]*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	_LT_AC_SYS_LIBPATH_AIX
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+      if test "$GXX" = yes ; then
+      output_verbose_link_cmd='echo'
+      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+      fi
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  interix[[3-9]]*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+	;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC* | pgcpp*)
+        # Portland Group C++ compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  netbsd* | netbsdelf*-gnu)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx*)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_AC_TAGVAR(predep_objects,$1)=
+  _LT_AC_TAGVAR(postdep_objects,$1)=
+  _LT_AC_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix[[4-9]]*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler.
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix[[3-9]]*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 _LT_AC_SYS_LIBPATH_AIX
+	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# ----------------
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+  as_executable_p='test -x'
+else
+  as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+		
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+			 [pkg_failed=yes])
+    fi
+else
+	pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10.1], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+
+# Figure out how to run the assembler.                      -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
+AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
+])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 13
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 4
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/as-ac-expand.m4])
diff --git a/Source/DirectFB/autogen.sh b/Source/DirectFB/autogen.sh
new file mode 100755
index 0000000..456d565
--- /dev/null
+++ b/Source/DirectFB/autogen.sh
@@ -0,0 +1,147 @@
+#!/bin/sh
+
+# This script does all the magic calls to automake/autoconf and
+# friends that are needed to configure a cvs checkout. You need a
+# couple of extra development tools to run this script successfully.
+#
+# If you are compiling from a released tarball you don't need these
+# tools and you shouldn't use this script.  Just call ./configure
+# directly.
+
+
+PROJECT="DirectFB"
+TEST_TYPE=-f
+FILE=include/directfb.h
+
+LIBTOOL_REQUIRED_VERSION=1.3.4
+AUTOCONF_REQUIRED_VERSION=2.13
+AUTOMAKE_REQUIRED_VERSION=1.4
+
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+ORIGDIR=`pwd`
+cd $srcdir
+
+make_version ()
+{
+    major=`echo $1 | cut -d '.' -f 1`
+    minor=`echo $1 | cut -d '.' -f 2`
+    micro=`echo $1 | cut -d '.' -f 3`
+
+    expr $major \* 65536 + $minor \* 256 + $micro
+}
+
+check_version ()
+{
+    ver=`make_version $1.0.0`
+    req=`make_version $2.0.0`
+
+    if test $ver -ge $req; then
+	echo "yes (version $1)"
+    else
+	echo "Too old (found version $1)!"
+	DIE=1
+    fi
+}
+
+echo
+echo "I am testing that you have the required versions of libtool, autoconf," 
+echo "and automake."
+echo
+
+DIE=0
+
+echo -n "checking for libtool >= $LIBTOOL_REQUIRED_VERSION ... "
+if (libtoolize --version) < /dev/null > /dev/null 2>&1; then
+    VER=`libtoolize --version \
+         | grep libtool | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
+    check_version $VER $LIBTOOL_REQUIRED_VERSION
+else
+    echo
+    echo "  You must have libtool installed to compile $PROJECT."
+    echo "  Install the appropriate package for your distribution,"
+    echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+    DIE=1;
+fi
+
+echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+    VER=`autoconf --version \
+         | head -n1 | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
+    check_version $VER $AUTOCONF_REQUIRED_VERSION
+else
+    echo
+    echo "  You must have autoconf installed to compile $PROJECT."
+    echo "  Download the appropriate package for your distribution,"
+    echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+    DIE=1;
+fi
+
+echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+    VER=`automake --version \
+         | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
+    check_version $VER $AUTOMAKE_REQUIRED_VERSION
+else
+    echo
+    echo "  You must have automake installed to compile $PROJECT."
+    echo "  Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.4p1.tar.gz"
+    echo "  (or a newer version if it is available)"
+    DIE=1
+fi
+
+if test "$DIE" -eq 1; then
+    echo
+    echo "Please install/upgrade the missing tools and call me again."
+    echo	
+    exit 1
+fi
+
+
+test $TEST_TYPE $FILE || {
+    echo
+    echo "You must run this script in the top-level $PROJECT directory."
+    echo
+    exit 1
+}
+
+
+if test -z "$*"; then
+    echo
+    echo "I am going to run ./configure with no arguments - if you wish "
+    echo "to pass any to it, please specify them on the $0 command line."
+    echo
+fi
+
+
+case $CC in
+    *xlc | *xlc\ * | *lcc | *lcc\ *)
+	am_opt=--include-deps
+    ;;
+esac
+
+echo
+echo
+echo Running aclocal ...
+aclocal -I m4 $ACLOCAL_FLAGS
+
+echo Running libtoolize ...
+libtoolize --automake
+
+echo Running autoconf ...
+autoconf
+
+# optionally feature autoheader
+
+(autoheader --version)  < /dev/null > /dev/null 2>&1 && echo Running autoheader... && autoheader
+
+echo Running automake ...
+automake -Wno-portability --add-missing $am_opt
+
+cd $ORIGDIR
+
+echo Running configure --enable-maintainer-mode "$@" ...
+$srcdir/configure --enable-maintainer-mode "$@" || exit 1
+
+echo "Now type 'make' to compile $PROJECT."
diff --git a/Source/DirectFB/compile b/Source/DirectFB/compile
new file mode 100755
index 0000000..1b1d232
--- /dev/null
+++ b/Source/DirectFB/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as `compile cc -o foo foo.c'.
+	# So we strip `-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Source/DirectFB/config.guess b/Source/DirectFB/config.guess
new file mode 100755
index 0000000..278f9e9
--- /dev/null
+++ b/Source/DirectFB/config.guess
@@ -0,0 +1,1516 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-07-22'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa:Linux:*:*)
+    	echo xtensa-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Source/DirectFB/config.h.in b/Source/DirectFB/config.h.in
new file mode 100755
index 0000000..e4f0fb0
--- /dev/null
+++ b/Source/DirectFB/config.h.in
@@ -0,0 +1,161 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if you are compiling for ARM. */
+#undef ARCH_ARM
+
+/* Define to 1 if you are compiling for PowerPC. */
+#undef ARCH_PPC
+
+/* Define to 1 if you are compiling for SH4. */
+#undef ARCH_SH4
+
+/* Define to 1 if you are compiling for ix86. */
+#undef ARCH_X86
+
+/* Define to 1 if you are compiling for AMD64. */
+#undef ARCH_X86_64
+
+/* Dithering to use when rendering to RGB16 surfaces */
+#undef DFB_DITHER565
+
+/* Advanced dithering, uses large dither table */
+#undef DFB_DITHER_ADVANCED
+
+/* Simple dithering, uses small dither table */
+#undef DFB_DITHER_SIMPLE
+
+/* Define to 1 if Video4Linux 2 is supported. */
+#undef DFB_HAVE_V4L2
+
+/* Define to 1 if smooth scaling code should be built. */
+#undef DFB_SMOOTH_SCALING
+
+/* The DirectFB version */
+#undef DIRECTFB_VERSION
+
+/* Define to 1 if you have the <asm/page.h> header file. */
+#undef HAVE_ASM_PAGE_H
+
+/* Define to 1 if you have the declaration of `PTHREAD_MUTEX_RECURSIVE', and
+   to 0 if you don't. */
+#undef HAVE_DECL_PTHREAD_MUTEX_RECURSIVE
+
+/* Define to 1 if you have the declaration of
+   `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP', and to 0 if you don't. */
+#undef HAVE_DECL_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if inb, outb and iopl are available. */
+#undef HAVE_INB_OUTB_IOPL
+
+/* Define to 1 if struct input_absinfo is defined in linux/input.h. */
+#undef HAVE_INPUT_ABSINFO
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `c_r' library (-lc_r). */
+#undef HAVE_LIBC_R
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the <linux/compiler.h> header file. */
+#undef HAVE_LINUX_COMPILER_H
+
+/* Define to 1 if you have the <linux/unistd.h> header file. */
+#undef HAVE_LINUX_UNISTD_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/io.h> header file. */
+#undef HAVE_SYSIO
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if Linux Input driver should use FBDev system module for
+   console keymap queries. */
+#undef LINUX_INPUT_USE_FBDEV
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if arm assembly is available. */
+#undef USE_ARMASM
+
+/* Define to 1 if GLX has been selected or detected */
+#undef USE_GLX
+
+/* Define to 1 if compiling on KallistiOS. */
+#undef USE_KOS
+
+/* Define to 1 if MMX assembly is available. */
+#undef USE_MMX
+
+/* Define to 1 if ppc assembly is available. */
+#undef USE_PPCASM
+
+/* Define to 1 if SSE assembly is available. */
+#undef USE_SSE
+
+/* Define to 1 to build with sysfs support. */
+#undef USE_SYSFS
+
+/* Define to 1 to build with zlib compression. */
+#undef USE_ZLIB
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
diff --git a/Source/DirectFB/config.sub b/Source/DirectFB/config.sub
new file mode 100755
index 0000000..1761d8b
--- /dev/null
+++ b/Source/DirectFB/config.sub
@@ -0,0 +1,1626 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-06-28'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Source/DirectFB/configure b/Source/DirectFB/configure
new file mode 100755
index 0000000..bf37751
--- /dev/null
+++ b/Source/DirectFB/configure
@@ -0,0 +1,30851 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="include/directfb.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+DIRECTFB_MAJOR_VERSION
+DIRECTFB_MINOR_VERSION
+DIRECTFB_MICRO_VERSION
+DIRECTFB_INTERFACE_AGE
+DIRECTFB_BINARY_AGE
+DIRECTFB_VERSION
+LT_RELEASE
+LT_CURRENT
+LT_BINARY
+LT_REVISION
+LT_AGE
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+target
+target_cpu
+target_vendor
+target_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+PKG_CONFIG
+MAINTAINER_MODE_TRUE
+MAINTAINER_MODE_FALSE
+MAINT
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CCAS
+CCASFLAGS
+CCASDEPMODE
+am__fastdepCCAS_TRUE
+am__fastdepCCAS_FALSE
+SED
+GREP
+EGREP
+LN_S
+ECHO
+AR
+RANLIB
+DSYMUTIL
+NMEDIT
+CPP
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+LD
+PERL
+MAN2HTML
+HAVE_MAN2HTML_TRUE
+HAVE_MAN2HTML_FALSE
+OSX_CORE_TRUE
+OSX_CORE_FALSE
+X11_CORE_TRUE
+X11_CORE_FALSE
+HAVE_LINUX_TRUE
+HAVE_LINUX_FALSE
+BUILDPPCASM_TRUE
+BUILDPPCASM_FALSE
+BUILDARMASM_TRUE
+BUILDARMASM_FALSE
+THREADFLAGS
+THREADLIB
+DYNLIB
+AS
+ASFLAGS
+ENABLE_DEBUG_TRUE
+ENABLE_DEBUG_FALSE
+DIRECT_BUILD_DEBUG
+ENABLE_DEBUGS_TRUE
+ENABLE_DEBUGS_FALSE
+DIRECT_BUILD_DEBUGS
+ENABLE_TRACE_TRUE
+ENABLE_TRACE_FALSE
+DIRECT_BUILD_TRACE
+DIRECT_BUILD_TEXT
+DIRECT_BUILD_GETTID
+DIRECT_BUILD_NETWORK
+DIRECT_BUILD_STDBOOL
+ENABLE_MULTI_TRUE
+ENABLE_MULTI_FALSE
+FUSION_BUILD_MULTI
+FUSION_BUILD_KERNEL
+ENABLE_VOODOO_TRUE
+ENABLE_VOODOO_FALSE
+ENABLE_UNIQUE_TRUE
+ENABLE_UNIQUE_FALSE
+BUILDMMX_TRUE
+BUILDMMX_FALSE
+DEVMEM_CORE_TRUE
+DEVMEM_CORE_FALSE
+FBDEV_CORE_TRUE
+FBDEV_CORE_FALSE
+SDL_CFLAGS
+SDL_LIBS
+OSX_LIBS
+SDL_CORE_TRUE
+SDL_CORE_FALSE
+VNC_CONFIG
+VNC_CORE_TRUE
+VNC_CORE_FALSE
+VNC_LIBS
+VNC_CFLAGS
+SYSFS_LIBS
+JPEG_PROVIDER_TRUE
+JPEG_PROVIDER_FALSE
+ZLIB_LIBS
+LIBPNG_CONFIG
+PNG_PROVIDER_TRUE
+PNG_PROVIDER_FALSE
+BUILD_DIRECTFB_CSOURCE_TRUE
+BUILD_DIRECTFB_CSOURCE_FALSE
+GIF_PROVIDER_TRUE
+GIF_PROVIDER_FALSE
+FREETYPE_CFLAGS
+FREETYPE_LIBS
+FREETYPE_PROVIDER_TRUE
+FREETYPE_PROVIDER_FALSE
+V4L_PROVIDER_TRUE
+V4L_PROVIDER_FALSE
+TSLIB_CFLAGS
+TSLIB_LIBS
+SOFTWARE_RENDERING_TRUE
+SOFTWARE_RENDERING_FALSE
+DFB_SMOOTH_SCALING
+FUSION_MESSAGE_SIZE
+RUNTIME_SYSROOT
+DIRECTFB_CSOURCE
+GFX_ATI128_TRUE
+GFX_ATI128_FALSE
+GFX_CLE266_TRUE
+GFX_CLE266_FALSE
+GFX_CYBER5K_TRUE
+GFX_CYBER5K_FALSE
+GFX_DAVINCI_TRUE
+GFX_DAVINCI_FALSE
+GFX_EP9X_TRUE
+GFX_EP9X_FALSE
+GFX_GL_TRUE
+GFX_GL_FALSE
+GFX_GLX_TRUE
+GFX_GLX_FALSE
+GFX_I810_TRUE
+GFX_I810_FALSE
+GFX_I830_TRUE
+GFX_I830_FALSE
+GFX_MACH64_TRUE
+GFX_MACH64_FALSE
+GFX_MATROX_TRUE
+GFX_MATROX_FALSE
+GFX_NEOMAGIC_TRUE
+GFX_NEOMAGIC_FALSE
+GFX_NSC_TRUE
+GFX_NSC_FALSE
+GFX_NVIDIA_TRUE
+GFX_NVIDIA_FALSE
+GFX_OMAP_TRUE
+GFX_OMAP_FALSE
+GFX_RADEON_TRUE
+GFX_RADEON_FALSE
+GFX_SAVAGE_TRUE
+GFX_SAVAGE_FALSE
+GFX_SH772X_TRUE
+GFX_SH772X_FALSE
+GFX_SIS315_TRUE
+GFX_SIS315_FALSE
+GFX_TDFX_TRUE
+GFX_TDFX_FALSE
+GFX_UNICHROME_TRUE
+GFX_UNICHROME_FALSE
+GFX_VMWARE_TRUE
+GFX_VMWARE_FALSE
+DBOX2REMOTE_TRUE
+DBOX2REMOTE_FALSE
+DREAMBOXREMOTE_TRUE
+DREAMBOXREMOTE_FALSE
+DYNAPRO_INPUT_TRUE
+DYNAPRO_INPUT_FALSE
+ELO_INPUT_TRUE
+ELO_INPUT_FALSE
+GUNZE_INPUT_TRUE
+GUNZE_INPUT_FALSE
+H3600_TS_TRUE
+H3600_TS_FALSE
+JOYSTICK_INPUT_TRUE
+JOYSTICK_INPUT_FALSE
+KEYBOARD_INPUT_TRUE
+KEYBOARD_INPUT_FALSE
+LINUX_INPUT_TRUE
+LINUX_INPUT_FALSE
+LIRC_INPUT_TRUE
+LIRC_INPUT_FALSE
+MUTOUCH_TS_TRUE
+MUTOUCH_TS_FALSE
+ZYTRONIC_TS_TRUE
+ZYTRONIC_TS_FALSE
+PENMOUNT_TS_TRUE
+PENMOUNT_TS_FALSE
+PS2MOUSE_INPUT_TRUE
+PS2MOUSE_INPUT_FALSE
+SERIAL_MOUSE_INPUT_TRUE
+SERIAL_MOUSE_INPUT_FALSE
+SONYPI_TRUE
+SONYPI_FALSE
+TSLIB_TRUE
+TSLIB_FALSE
+UCB1X00_TS_TRUE
+UCB1X00_TS_FALSE
+WM97XX_TS_TRUE
+WM97XX_TS_FALSE
+BUILD_TESTS_TRUE
+BUILD_TESTS_FALSE
+BUILD_TOOLS_TRUE
+BUILD_TOOLS_FALSE
+CROSS_COMPILING_TRUE
+CROSS_COMPILING_FALSE
+BUILD_SHARED_TRUE
+BUILD_SHARED_FALSE
+BUILD_STATIC_TRUE
+BUILD_STATIC_FALSE
+SOPATH
+HAVE_LINUX
+DFB_CFLAGS_OMIT_FRAME_POINTER
+DFB_LDFLAGS
+DFB_INTERNAL_CFLAGS
+X11_CFLAGS
+X11_LIBS
+GIF_PROVIDER
+JPEG_PROVIDER
+PNG_PROVIDER
+LIBJPEG
+LIBPNG
+FREETYPE_PROVIDER
+DATADIR
+MODULEDIR
+MODULEDIRNAME
+INCLUDEDIR
+INTERNALINCLUDEDIR
+SYSCONFDIR
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+PKG_CONFIG
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCAS
+CCASFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS
+SDL_CFLAGS
+SDL_LIBS
+FREETYPE_CFLAGS
+FREETYPE_LIBS
+TSLIB_CFLAGS
+TSLIB_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/PACKAGE]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer
+  --enable-static[=PKGS]  build static libraries [default=no]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-osx            build with Mac OS X support [default=auto]
+  --enable-x11            build with X11 support [default=auto]
+  --enable-extra-warnings   enable extra warnings [default=no]
+  --enable-profiling        enable profiling support [default=no]
+  --enable-debug            enable debugging [default=no]
+  --enable-debug-support    enable debugging support [default=yes]
+  --enable-trace            enable call tracing [default=no]
+  --enable-text             enable text output [default=yes]
+  --enable-gettid           enable usage of gettid() [default=yes]
+  --enable-network          enable network support [default=yes]
+  --enable-multi            enable multi application core [default=no]
+  --enable-voodoo           enable Voodoo (network support) [default=no]
+  --enable-unique           enable Unique (WM Module) [default=no]
+  --enable-mmx              enable MMX support [default=auto]
+  --enable-sse              enable SSE support [default=auto]
+  --enable-devmem           build with generic /dev/mem support [default=yes]
+  --enable-fbdev            build with linux fbdev support [default=auto]
+  --enable-sdl              build with SDL support [default=no]
+  --enable-vnc              build with VNC support [default=auto]
+  --enable-sysfs            build with sysfs support [default=auto]
+  --enable-jpeg             build JPEG image provider [default=yes]
+  --enable-zlib             use zlib, e.g. for screen shots [default=no]
+  --enable-png              build PNG image provider [default=yes]
+  --enable-gif              build GIF image/video provider [default=yes]
+  --enable-freetype         build FreeType2 font provider [default=yes]
+  --enable-video4linux      build Video4Linux video provider [default=yes]
+  --enable-video4linux2     build with Video4Linux2 support [default=no]
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-gfxdrivers=<list>   compile gfxdrivers in <list>
+                               gfxdrivers may be comma separated
+                               'all' builds all drivers (default), 'none' builds none
+                               Possible gfxdrivers are:
+                               ati128, cle266, cyber5k, davinci, ep9x, gl, i810, i830, mach64,
+                               matrox, neomagic, nsc, nvidia, omap, radeon, savage, sh772x,
+                               sis315, tdfx, unichrome, vmware
+  --with-inputdrivers=<list> compile inputdrivers in <list>
+                               inputdrivers may be comma separated
+                               'all' builds all drivers (default), 'none' builds none
+                               Possible inputdrivers are:
+                               dbox2remote, dreamboxremote, dynapro, elo-input, gunze, h3600_ts,
+                               joystick, keyboard, linuxinput, lirc, mutouch, penmount, ps2mouse,
+                               serialmouse, sonypijogdial, tslib, ucb1x00, wm97xx, zytronic
+  --without-software         build without software rendering (can decrease binary size by >100k)
+  --with-smooth-scaling      build with smooth software scaling code (can increase binary size by >100k)
+  --with-dither-rgb16=TYPE   dithering to use when loading images into RGB16 surfaces [default=none]
+                               Possible types are:
+                                 none     - no dithering
+                                 simple   - simple dithering (increases data section by 256 bytes)
+                                 advanced - advanced dithering (increases data section by 64 KBytes)
+  --with-tests               build test programs
+  --with-message-size=SIZE   allow fusion messages up to SIZE bytes [default=1024]
+  --without-tools            do not build any tools
+  --with-sysroot=DIR         search for lib/share et al within DIR at runtime
+                               (e.g. when loading modules)
+
+Some influential environment variables:
+  PKG_CONFIG  path to pkg-config utility
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CCAS        assembler compiler command (defaults to CC)
+  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+  SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
+  SDL_LIBS    linker flags for SDL, overriding pkg-config
+  FREETYPE_CFLAGS
+              C compiler flags for FREETYPE, overriding pkg-config
+  FREETYPE_LIBS
+              linker flags for FREETYPE, overriding pkg-config
+  TSLIB_CFLAGS
+              C compiler flags for TSLIB, overriding pkg-config
+  TSLIB_LIBS  linker flags for TSLIB, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+#
+# Making releases:
+#   DIRECTFB_MICRO_VERSION += 1;
+#   DIRECTFB_INTERFACE_AGE += 1;
+#   DIRECTFB_BINARY_AGE += 1;
+# if any functions have been added, set DIRECTFB_INTERFACE_AGE to 0.
+# if backwards compatibility has been broken,
+# set DIRECTFB_BINARY_AGE and DIRECTFB_INTERFACE_AGE to 0.
+#
+#
+DIRECTFB_MAJOR_VERSION=1
+DIRECTFB_MINOR_VERSION=4
+DIRECTFB_MICRO_VERSION=0
+DIRECTFB_INTERFACE_AGE=0
+DIRECTFB_BINARY_AGE=0
+DIRECTFB_VERSION=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION.$DIRECTFB_MICRO_VERSION
+
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define DIRECTFB_VERSION "$DIRECTFB_VERSION"
+_ACEOF
+
+
+# libtool versioning
+LT_RELEASE=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION
+LT_CURRENT=`expr $DIRECTFB_MICRO_VERSION - $DIRECTFB_INTERFACE_AGE`
+LT_BINARY=`expr $DIRECTFB_MICRO_VERSION - $DIRECTFB_BINARY_AGE`
+LT_REVISION=$DIRECTFB_INTERFACE_AGE
+LT_AGE=`expr $DIRECTFB_BINARY_AGE - $DIRECTFB_INTERFACE_AGE`
+
+
+
+
+
+
+
+# The earliest version that this release has binary compatibility with.
+# This is used for module locations.
+BINARY_VERSION=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION-$LT_BINARY
+
+
+VERSION=$DIRECTFB_VERSION
+PACKAGE=DirectFB
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+echo "$as_me: error: invalid value of canonical target" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+am__api_version='1.10'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+done
+IFS=$as_save_IFS
+
+fi
+
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+echo "${ECHO_T}$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=$PACKAGE
+ VERSION=$VERSION
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	else
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+		PKG_CONFIG=""
+	fi
+
+fi
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=no
+fi
+
+
+
+
+
+case x"$target" in
+  xNONE | x)
+    target_or_host="$host" ;;
+  *)
+    target_or_host="$target" ;;
+esac
+
+
+case "$target_or_host" in
+  *-cygwin)
+    ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+if test "x$CC" != xcc; then
+  { echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6; }
+fi
+set dummy $CC; ac_cc=`echo $2 |
+		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+   test -f conftest2.$ac_objext && { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+      rm -f conftest2.*
+      if { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 test -f conftest2.$ac_objext && { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); };
+      then
+	# cc works too.
+	:
+      else
+	# cc exists but doesn't like -o.
+	eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
+else
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_MINUS_C_MINUS_O 1
+_ACEOF
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+
+
+# By default we simply use the C compiler to build assembly code.
+
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+
+
+
+depcc="$CCAS"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CCAS_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CCAS_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CCAS_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CCAS_dependencies_compiler_type" >&6; }
+CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then
+  am__fastdepCCAS_TRUE=
+  am__fastdepCCAS_FALSE='#'
+else
+  am__fastdepCCAS_TRUE='#'
+  am__fastdepCCAS_FALSE=
+fi
+
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5089 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CXXFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ 	]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+  { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+echo "${ECHO_T}$DSYMUTIL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { echo "$as_me:$LINENO: result: $NMEDIT" >&5
+echo "${ECHO_T}$NMEDIT" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+
+    { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+   # By default we will add the -single_module flag. You can override
+   # by either setting the environment variable LT_MULTI_MODULE
+   # non-empty at configure time, or by adding -multi_module to the
+   # link flags.
+   echo "int foo(void){return 1;}" > conftest.c
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+     -dynamiclib ${wl}-single_module conftest.c
+   if test -f libconftest.dylib; then
+     lt_cv_apple_cc_single_mod=yes
+     rm -rf libconftest.dylib*
+   fi
+   rm conftest.c
+      fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
+    { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_ld_exported_symbols_list=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_ld_exported_symbols_list=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[0123])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*)
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+   10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+   10.[012]*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+   10.*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8141: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8145: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8431: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8435: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8535: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:8539: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+	link_all_deplibs=no
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L=yes
+  	  hardcode_libdir_flag_spec='-L$libdir'
+  	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	hardcode_direct=yes
+	export_dynamic_flag_spec='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld='+b $libdir'
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10912 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 11012 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix[4-9]*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    compiler_lib_search_dirs \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    fix_srcfile_path \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+  withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
+	  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+compiler_lib_search_dirs_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix[4-9]*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+	;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  :
+	else
+	  # We have old collect2
+	  hardcode_direct_CXX=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_CXX=yes
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  hardcode_libdir_separator_CXX=
+	fi
+	;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag_CXX="-z nodefs"
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	no_undefined_flag_CXX=' ${wl}-bernotok'
+	allow_undefined_flag_CXX=' ${wl}-berok'
+	# Exported symbols can be pulled into shared objects from archives
+	whole_archive_flag_spec_CXX='$convenience'
+	archive_cmds_need_lc_CXX=yes
+	# This is similar to how AIX traditionally builds its shared libraries.
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag_CXX=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
+      allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+      if test "$GXX" = yes ; then
+      output_verbose_link_cmd='echo'
+      archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+      module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+      module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+        archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+        archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+      fi
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      ghcx*)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC*)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_CXX=:
+
+      case $host_cpu in
+      hppa*64*|ia64*) ;;
+      *)
+	export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      aCC*)
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case $host_cpu in
+	    hppa*64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    ia64*)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    *)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  interix[3-9]*)
+    hardcode_direct_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+	# SGI C++
+	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	  else
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	link_all_deplibs_CXX=yes
+	;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc*)
+	# Intel C++
+	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
+	archive_cmds_need_lc_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      pgCC* | pgcpp*)
+        # Portland Group C++ compiler
+	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+	# Compaq C++
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  no_undefined_flag_CXX=' -zdefs'
+	  archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  netbsd* | netbsdelf*-gnu)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    if test -f /usr/libexec/ld.so; then
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+	;;
+      RCC*)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx*)
+	allow_undefined_flag_CXX=' -expect_unresolved \*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      lcc*)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
+	no_undefined_flag_CXX=' -zdefs'
+	archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-R$libdir'
+	hardcode_shlibpath_var_CXX=no
+	case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	    ;;
+	esac
+	link_all_deplibs_CXX=yes
+
+	output_verbose_link_cmd='echo'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx*)
+	# Green Hills C++ Compiler
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
+	fi
+	;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+    no_undefined_flag_CXX='${wl}-z,text'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    no_undefined_flag_CXX='${wl}-z,text'
+    allow_undefined_flag_CXX='${wl}-z,nodefs'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+    export_dynamic_flag_spec_CXX='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+	archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      *)
+	archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+compiler_lib_search_dirs_CXX=
+if test -n "$compiler_lib_search_path_CXX"; then
+  compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  icpc* | ecpc*)
+	    # Intel C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13413: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:13417: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $rm -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13517: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:13521: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs_CXX=no
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    compiler_lib_search_dirs_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    fix_srcfile_path_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+      program t
+      end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix[4-9]*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      else
+	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_F77='-qnocommon'
+         lt_prog_compiler_wl_F77='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-KPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fpic'
+	lt_prog_compiler_static_F77='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_F77='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_F77='-Kconform_pic'
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:15115: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:15119: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_static_works_F77=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_F77=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_F77=yes
+     fi
+   fi
+   $rm -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
+    :
+else
+    lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:15219: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:15223: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_F77=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_F77='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+	link_all_deplibs_F77=no
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_F77=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_F77=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_F77=yes
+  	  hardcode_libdir_flag_spec_F77='-L$libdir'
+  	  hardcode_libdir_separator_F77=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_F77="-z nodefs"
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_F77=' ${wl}-bernotok'
+	  allow_undefined_flag_F77=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_F77='$convenience'
+	  archive_cmds_need_lc_F77=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_F77=no
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77=''
+      link_all_deplibs_F77=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_F77=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	hardcode_direct_F77=yes
+	export_dynamic_flag_spec_F77='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_F77=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+	  ;;
+	*)
+	  hardcode_direct_F77=yes
+	  export_dynamic_flag_spec_F77='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_F77=yes
+	hardcode_shlibpath_var_F77=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_F77='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_F77='$CC -r -o $output$reload_objs'
+	  hardcode_direct_F77=no
+        ;;
+	motorola)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_F77=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_F77='${wl}-z,text'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_F77='${wl}-z,text'
+      allow_undefined_flag_F77='${wl}-z,nodefs'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+	pic_flag=$lt_prog_compiler_pic_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_F77=no
+        else
+	  archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var_F77" || \
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    compiler_lib_search_dirs_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    fix_srcfile_path_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17439: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17443: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | cygwin* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-KPIC'
+	lt_prog_compiler_static_GCJ='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-fpic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_GCJ='-Kconform_pic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17729: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:17733: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_static_works_GCJ=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_GCJ=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_GCJ=yes
+     fi
+   fi
+   $rm -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then
+    :
+else
+    lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:17833: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:17837: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_GCJ=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+	link_all_deplibs_GCJ=no
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_GCJ=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+	    archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+	    archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+	  else
+	    ld_shlibs_GCJ=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  :
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_GCJ=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_GCJ=yes
+  	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
+  	  hardcode_libdir_separator_GCJ=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_GCJ="-z nodefs"
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_GCJ=' ${wl}-bernotok'
+	  allow_undefined_flag_GCJ=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_GCJ='$convenience'
+	  archive_cmds_need_lc_GCJ=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_GCJ=no
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ=''
+      link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	hardcode_direct_GCJ=yes
+	export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_GCJ=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_GCJ=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+	  hardcode_direct_GCJ=no
+	  hardcode_shlibpath_var_GCJ=no
+	  ;;
+	*)
+	  hardcode_direct_GCJ=yes
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_GCJ=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_GCJ=yes
+	hardcode_shlibpath_var_GCJ=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_GCJ='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	wlarc=''
+	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+	  hardcode_direct_GCJ=no
+        ;;
+	motorola)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_GCJ=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_GCJ='${wl}-z,text'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_GCJ='${wl}-z,text'
+      allow_undefined_flag_GCJ='${wl}-z,nodefs'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+	pic_flag=$lt_prog_compiler_pic_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_GCJ=no
+        else
+	  archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    compiler_lib_search_dirs_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    fix_srcfile_path_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    compiler_lib_search_dirs_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    fix_srcfile_path_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	;;
+
+      *)
+	{ { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+{ echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; }
+if test "${ac_cv_search_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strerror ();
+int
+main ()
+{
+return strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' cposix; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_strerror=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_strerror+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_strerror+set}" = set; then
+  :
+else
+  ac_cv_search_strerror=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6; }
+ac_res=$ac_cv_search_strerror
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+	&& BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_bigendian=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long int l;
+    char c[sizeof (long int)];
+  } u;
+  u.l = 1;
+  return u.c[sizeof (long int) - 1] == 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=no
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+  yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+
+{ echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6; }
+if test "${ac_cv_type_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_int=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_int=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') if test "$ac_cv_type_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_int=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_int" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6; }
+if test "${ac_cv_type_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef long long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_long_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of long long" >&5
+echo $ECHO_N "checking size of long long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') if test "$ac_cv_type_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef long long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long_long=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long_long" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+
+
+## Work around libstuhl during cross build...
+if test "$host" != "$build"; then
+  sys_lib_dlsearch_path_spec=""
+  sys_lib_search_path_spec=""
+fi
+
+for ac_prog in perl5 perl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$PERL" && break
+done
+
+
+# Extract the first word of "man2html", so it can be a program name with args.
+set dummy man2html; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MAN2HTML+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAN2HTML in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MAN2HTML="$MAN2HTML" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_MAN2HTML="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_MAN2HTML" && ac_cv_path_MAN2HTML="no"
+  ;;
+esac
+fi
+MAN2HTML=$ac_cv_path_MAN2HTML
+if test -n "$MAN2HTML"; then
+  { echo "$as_me:$LINENO: result: $MAN2HTML" >&5
+echo "${ECHO_T}$MAN2HTML" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+ if test "$MAN2HTML" != "no"; then
+  HAVE_MAN2HTML_TRUE=
+  HAVE_MAN2HTML_FALSE='#'
+else
+  HAVE_MAN2HTML_TRUE='#'
+  HAVE_MAN2HTML_FALSE=
+fi
+
+
+
+# Check whether --enable-osx was given.
+if test "${enable_osx+set}" = set; then
+  enableval=$enable_osx;
+else
+  enable_osx=yes
+fi
+
+
+if test "$enable_osx" = "yes"; then
+  if test "${ac_cv_header_Carbon_Carbon_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for Carbon/Carbon.h" >&5
+echo $ECHO_N "checking for Carbon/Carbon.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Carbon_Carbon_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Carbon_Carbon_h" >&5
+echo "${ECHO_T}$ac_cv_header_Carbon_Carbon_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking Carbon/Carbon.h usability" >&5
+echo $ECHO_N "checking Carbon/Carbon.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <Carbon/Carbon.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking Carbon/Carbon.h presence" >&5
+echo $ECHO_N "checking Carbon/Carbon.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <Carbon/Carbon.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Carbon/Carbon.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: Carbon/Carbon.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for Carbon/Carbon.h" >&5
+echo $ECHO_N "checking for Carbon/Carbon.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Carbon_Carbon_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_Carbon_Carbon_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Carbon_Carbon_h" >&5
+echo "${ECHO_T}$ac_cv_header_Carbon_Carbon_h" >&6; }
+
+fi
+if test $ac_cv_header_Carbon_Carbon_h = yes; then
+  osx_found=yes
+else
+  osx_found=no
+fi
+
+
+  if test "$osx_found" = no; then
+    enable_osx=no
+    { echo "$as_me:$LINENO: WARNING:
+*** no Carbon/Carbon.h found -- building without Mac OS X support." >&5
+echo "$as_me: WARNING:
+*** no Carbon/Carbon.h found -- building without Mac OS X support." >&2;}
+  else
+    OSX_LIBS="-framework Carbon"
+  fi
+fi
+
+ if test "$enable_osx" = "yes"; then
+  OSX_CORE_TRUE=
+  OSX_CORE_FALSE='#'
+else
+  OSX_CORE_TRUE='#'
+  OSX_CORE_FALSE=
+fi
+
+
+# Check whether --enable-x11 was given.
+if test "${enable_x11+set}" = set; then
+  enableval=$enable_x11;
+else
+  enable_x11=yes
+fi
+
+
+if test "$enable_x11" = "yes"; then
+  CFLAGS_saved="$CFLAGS"
+  CFLAGS="$CFLAGS -I/usr/X11R6/include"
+  if test "${ac_cv_header_X11_X_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for X11/X.h" >&5
+echo $ECHO_N "checking for X11/X.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_X_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_X_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_X_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking X11/X.h usability" >&5
+echo $ECHO_N "checking X11/X.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <X11/X.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking X11/X.h presence" >&5
+echo $ECHO_N "checking X11/X.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/X.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: X11/X.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: X11/X.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: X11/X.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: X11/X.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: X11/X.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: X11/X.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: X11/X.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/X.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: X11/X.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for X11/X.h" >&5
+echo $ECHO_N "checking for X11/X.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_X_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_X11_X_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_X_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_X_h" >&6; }
+
+fi
+if test $ac_cv_header_X11_X_h = yes; then
+  x11_found=yes
+else
+  x11_found=no
+fi
+
+
+  CFLAGS="$CFLAGS_saved"
+  if test "$x11_found" = no; then
+    enable_x11=no
+    { echo "$as_me:$LINENO: WARNING:
+*** no X11/X.h found -- building without X11 support." >&5
+echo "$as_me: WARNING:
+*** no X11/X.h found -- building without X11 support." >&2;}
+  else
+    X11_LIBS="-L/usr/X11R6/lib -lX11 -lXext"
+    X11_CFLAGS="-I/usr/X11R6/include"
+  fi
+fi
+
+ if test "$enable_x11" = "yes"; then
+  X11_CORE_TRUE=
+  X11_CORE_FALSE='#'
+else
+  X11_CORE_TRUE='#'
+  X11_CORE_FALSE=
+fi
+
+
+
+
+
+
+for ac_header in linux/compiler.h linux/unistd.h asm/page.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+if test x"$CFLAGS" = x"-g -O2"; then
+  CFLAGS=
+fi
+
+CFLAGS="-O3 -ffast-math -pipe $CFLAGS"
+
+DFB_INTERNAL_CFLAGS="-D_GNU_SOURCE $DFB_INTERNAL_CFLAGS"
+
+# Check whether --enable-extra-warnings was given.
+if test "${enable_extra_warnings+set}" = set; then
+  enableval=$enable_extra_warnings;
+else
+  enable_extra_warnings=no
+fi
+
+if test "$enable_extra_warnings" = "yes"; then
+  CFLAGS="-W -Wno-sign-compare -Wno-unused-parameter -Wundef -Wcast-qual -Wcast-align -Waggregate-return -Wmissing-declarations -Winline $CFLAGS"
+fi
+
+# FIXME
+#if test "$GCC" = "yes"; then
+#  CFLAGS="-Wall -Wno-strict-aliasing $CFLAGS"
+#fi
+
+
+#
+# check target architecture
+#
+have_x86=no
+have_x86_64=no
+have_arm=no
+have_ppc=no
+have_sh4=no
+
+case "$target_or_host" in
+  i*86-*-*)
+    have_x86=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ARCH_X86 1
+_ACEOF
+
+    ;;
+
+  x86_64-*)
+    have_x86=yes
+    have_x86_64=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ARCH_X86_64 1
+_ACEOF
+
+    ;;
+
+  *arm*)
+    have_arm=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ARCH_ARM 1
+_ACEOF
+
+    ;;
+
+  ppc-*-linux* | powerpc-*)
+    have_ppc=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ARCH_PPC 1
+_ACEOF
+
+    ;;
+
+  sh4-* | sh3-*)
+    have_sh4=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ARCH_SH4 1
+_ACEOF
+
+    ;;
+
+  *)
+    ;;
+esac
+
+
+have_linux=no
+have_cygwin=no
+have_kos=no
+need_libc_r=no
+need_libdl=yes
+want_ppcasm=yes
+want_armasm=yes
+
+case "$target_or_host" in
+  *-linux*)
+    have_linux=yes
+    ;;
+
+  *-cygwin)
+    have_cygwin=yes
+    need_libdl=no
+    ;;
+
+  *-freebsd*)
+    need_libc_r=yes
+    need_libdl=no
+    want_ppcasm=yes
+	want_armasm=yes
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+    ;;
+
+  *-openbsd*)
+    need_libc_r=yes
+    need_libdl=no
+    want_ppcasm=no
+	want_armasm=no
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+    ;;
+
+  *-netbsd*)
+    need_libc_r=no
+    need_libdl=no
+    want_ppcasm=yes
+	want_armasm=yes
+    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
+    LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
+    ;;
+
+  *-darwin*)
+    need_libc_r=no
+    need_libdl=yes
+    want_ppcasm=no
+	want_armasm=no
+    CPPFLAGS="$CPPFLAGS -I/sw/include"
+    LDFLAGS="$LDFLAGS -L/sw/lib"
+    ;;
+
+  sh-*-elf)
+    if test "$CC" = "kos-cc"; then
+      need_libc_r=no
+      need_libdl=no
+      have_kos=yes
+    fi
+    ;;
+esac
+
+ if test "$have_linux" = "yes"; then
+  HAVE_LINUX_TRUE=
+  HAVE_LINUX_FALSE='#'
+else
+  HAVE_LINUX_TRUE='#'
+  HAVE_LINUX_FALSE=
+fi
+
+
+ if test "$have_ppc" = "yes" && test "$want_ppcasm" = "yes"; then
+  BUILDPPCASM_TRUE=
+  BUILDPPCASM_FALSE='#'
+else
+  BUILDPPCASM_TRUE='#'
+  BUILDPPCASM_FALSE=
+fi
+
+
+if test "$have_ppc" = "yes" && test "$want_ppcasm" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_PPCASM 1
+_ACEOF
+
+fi
+
+
+ if test "$have_arm" = "yes" && test "$want_armasm" = "yes"; then
+  BUILDARMASM_TRUE=
+  BUILDARMASM_FALSE='#'
+else
+  BUILDARMASM_TRUE='#'
+  BUILDARMASM_FALSE=
+fi
+
+
+if test "$have_arm" = "yes" && test "$want_armasm" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_ARMASM 1
+_ACEOF
+
+fi
+
+if test "$have_kos" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_KOS 1
+_ACEOF
+
+fi
+
+
+THREADFLAGS="-D_REENTRANT"
+
+if test "$have_kos" = "no"; then
+  if test "$need_libc_r" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking for pthread_attr_init in -lc_r" >&5
+echo $ECHO_N "checking for pthread_attr_init in -lc_r... $ECHO_C" >&6; }
+if test "${ac_cv_lib_c_r_pthread_attr_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc_r  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_attr_init ();
+int
+main ()
+{
+return pthread_attr_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_c_r_pthread_attr_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_c_r_pthread_attr_init=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_attr_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_r_pthread_attr_init" >&6; }
+if test $ac_cv_lib_c_r_pthread_attr_init = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBC_R 1
+_ACEOF
+
+  LIBS="-lc_r $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error:
+*** DirectFB requires phtreads in libc_r." >&5
+echo "$as_me: error:
+*** DirectFB requires phtreads in libc_r." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+    THREADLIB="-lc_r"
+  else
+
+{ echo "$as_me:$LINENO: checking for pthread_attr_init in -lpthread" >&5
+echo $ECHO_N "checking for pthread_attr_init in -lpthread... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pthread_pthread_attr_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_attr_init ();
+int
+main ()
+{
+return pthread_attr_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_pthread_pthread_attr_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_pthread_pthread_attr_init=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_attr_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_attr_init" >&6; }
+if test $ac_cv_lib_pthread_pthread_attr_init = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+  LIBS="-lpthread $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error:
+*** DirectFB requires libpthread." >&5
+echo "$as_me: error:
+*** DirectFB requires libpthread." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+    THREADLIB="-lpthread"
+  fi
+fi
+
+{ echo "$as_me:$LINENO: checking whether PTHREAD_MUTEX_RECURSIVE is declared" >&5
+echo $ECHO_N "checking whether PTHREAD_MUTEX_RECURSIVE is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#define _GNU_SOURCE
+#include <pthread.h>
+
+int
+main ()
+{
+#ifndef PTHREAD_MUTEX_RECURSIVE
+  (void) PTHREAD_MUTEX_RECURSIVE;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE" >&5
+echo "${ECHO_T}$ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE" >&6; }
+if test $ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTHREAD_MUTEX_RECURSIVE 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTHREAD_MUTEX_RECURSIVE 0
+_ACEOF
+
+{ echo "$as_me:$LINENO: WARNING:
+*** PTHREAD_MUTEX_RECURSIVE is not defined! Dead locks might occur!" >&5
+echo "$as_me: WARNING:
+*** PTHREAD_MUTEX_RECURSIVE is not defined! Dead locks might occur!" >&2;}
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking whether PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is declared" >&5
+echo $ECHO_N "checking whether PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#define _GNU_SOURCE
+#include <pthread.h>
+
+int
+main ()
+{
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+  (void) PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP" >&5
+echo "${ECHO_T}$ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP" >&6; }
+if test $ac_cv_have_decl_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 0
+_ACEOF
+
+{ echo "$as_me:$LINENO: WARNING:
+*** PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined! Dead locks might occur!" >&5
+echo "$as_me: WARNING:
+*** PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined! Dead locks might occur!" >&2;}
+fi
+
+
+
+
+
+
+CPPFLAGS="$THREADFLAGS $CPPFLAGS"
+
+
+DYNLIB=""
+if test "$need_libdl" = "yes"; then
+  if test "$enable_shared" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+  LIBS="-ldl $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error:
+*** DirectFB requires libdl." >&5
+echo "$as_me: error:
+*** DirectFB requires libdl." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+    DYNLIB="-ldl"
+  fi
+fi
+
+
+
+
+if test "$have_x86" = "yes"; then
+##
+## HACK HACK HACK automake uses @AS@ like a gcc
+##
+  AS=$CC
+  ASFLAGS=$CFLAGS
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INB_OUTB_IOPL 1
+_ACEOF
+
+  { echo "$as_me:$LINENO: checking for sys/io.h" >&5
+echo $ECHO_N "checking for sys/io.h... $ECHO_C" >&6; }
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/io.h>
+int
+main ()
+{
+char x = inb(0); (void)x;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYSIO 1
+_ACEOF
+
+    have_sysio=yes
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  have_sysio=no
+fi
+
+
+# Check whether --enable-profiling was given.
+if test "${enable_profiling+set}" = set; then
+  enableval=$enable_profiling;
+else
+  enable_profiling=no
+fi
+
+if test "$enable_profiling" = "yes"; then
+    CFLAGS="$CFLAGS -pg -g3"
+else
+    DFB_CFLAGS_OMIT_FRAME_POINTER="-fomit-frame-pointer"
+fi
+
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+  enableval=$enable_debug;
+else
+  enable_debug=no
+fi
+
+if test "$enable_debug" = "yes"; then
+    CFLAGS="$CFLAGS -g3 -fno-inline -Wno-inline"
+    DIRECT_BUILD_DEBUG=1
+else
+    DIRECT_BUILD_DEBUG=0
+fi
+ if test "$enable_debug" = "yes"; then
+  ENABLE_DEBUG_TRUE=
+  ENABLE_DEBUG_FALSE='#'
+else
+  ENABLE_DEBUG_TRUE='#'
+  ENABLE_DEBUG_FALSE=
+fi
+
+
+
+
+
+# Check whether --enable-debug-support was given.
+if test "${enable_debug_support+set}" = set; then
+  enableval=$enable_debug_support;
+else
+  enable_debug_support=yes
+fi
+
+if test "$enable_debug_support" = "yes" || test "$enable_debug" = "yes"; then
+    enable_debug_support=yes
+    DIRECT_BUILD_DEBUGS=1
+else
+    DIRECT_BUILD_DEBUGS=0
+fi
+ if test "$enable_debug_support" = "yes"; then
+  ENABLE_DEBUGS_TRUE=
+  ENABLE_DEBUGS_FALSE='#'
+else
+  ENABLE_DEBUGS_TRUE='#'
+  ENABLE_DEBUGS_FALSE=
+fi
+
+
+
+
+
+# Check whether --enable-trace was given.
+if test "${enable_trace+set}" = set; then
+  enableval=$enable_trace;
+else
+  enable_trace=no
+fi
+
+if test "$enable_trace" = "yes"; then
+    DFB_INTERNAL_CFLAGS="$DFB_INTERNAL_CFLAGS -finstrument-functions"
+    DIRECT_BUILD_TRACE=1
+else
+    DIRECT_BUILD_TRACE=0
+fi
+ if test "$enable_trace" = "yes"; then
+  ENABLE_TRACE_TRUE=
+  ENABLE_TRACE_FALSE='#'
+else
+  ENABLE_TRACE_TRUE='#'
+  ENABLE_TRACE_FALSE=
+fi
+
+
+
+
+
+# Check whether --enable-text was given.
+if test "${enable_text+set}" = set; then
+  enableval=$enable_text;
+else
+  enable_text=yes
+fi
+
+if test "$enable_text" = "no"; then
+    DIRECT_BUILD_TEXT=0
+else
+    DIRECT_BUILD_TEXT=1
+fi
+
+
+
+
+# Check whether --enable-gettid was given.
+if test "${enable_gettid+set}" = set; then
+  enableval=$enable_gettid;
+else
+  enable_gettid=yes
+fi
+
+if test "$enable_gettid" = "no"; then
+    DIRECT_BUILD_GETTID=0
+else
+    DIRECT_BUILD_GETTID=1
+fi
+
+
+
+
+# Check whether --enable-network was given.
+if test "${enable_network+set}" = set; then
+  enableval=$enable_network;
+else
+  enable_network=yes
+fi
+
+if test "$enable_network" = "no"; then
+    DIRECT_BUILD_NETWORK=0
+else
+    DIRECT_BUILD_NETWORK=1
+fi
+
+
+
+
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for stdbool.h" >&5
+echo $ECHO_N "checking for stdbool.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking stdbool.h usability" >&5
+echo $ECHO_N "checking stdbool.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <stdbool.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking stdbool.h presence" >&5
+echo $ECHO_N "checking stdbool.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdbool.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdbool.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stdbool.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stdbool.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stdbool.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: stdbool.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: stdbool.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdbool.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdbool.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: stdbool.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for stdbool.h" >&5
+echo $ECHO_N "checking for stdbool.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_stdbool_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
+
+fi
+if test $ac_cv_header_stdbool_h = yes; then
+  DIRECT_BUILD_STDBOOL=1
+else
+  DIRECT_BUILD_STDBOOL=0
+fi
+
+
+
+
+
+
+linux_fusion="N/A"
+# Check whether --enable-multi was given.
+if test "${enable_multi+set}" = set; then
+  enableval=$enable_multi;
+else
+  enable_multi=no
+fi
+
+if test "$enable_multi" = "yes"; then
+    linux_fusion=yes
+  if test "${ac_cv_header_linux_fusion_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/fusion.h" >&5
+echo $ECHO_N "checking for linux/fusion.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_fusion_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_fusion_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_fusion_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/fusion.h usability" >&5
+echo $ECHO_N "checking linux/fusion.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/fusion.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/fusion.h presence" >&5
+echo $ECHO_N "checking linux/fusion.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/fusion.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/fusion.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/fusion.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/fusion.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/fusion.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/fusion.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/fusion.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/fusion.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/fusion.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/fusion.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/fusion.h" >&5
+echo $ECHO_N "checking for linux/fusion.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_fusion_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_fusion_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_fusion_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_fusion_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_fusion_h = yes; then
+  :
+else
+  linux_fusion=no
+fi
+
+
+  if test "$linux_fusion" = "yes"; then
+     FUSION_BUILD_KERNEL=1
+  else
+     fusion_warning="
+Linux-Fusion header not found. Using EXPERIMENTAL Builtin Multi application core!"
+     { echo "$as_me:$LINENO: WARNING: *** $fusion_warning *** " >&5
+echo "$as_me: WARNING: *** $fusion_warning *** " >&2;}
+     FUSION_BUILD_KERNEL=0
+  fi
+  FUSION_BUILD_MULTI=1
+else
+  FUSION_BUILD_MULTI=0
+  FUSION_BUILD_KERNEL=0
+fi
+
+ if test "$enable_multi" = "yes"; then
+  ENABLE_MULTI_TRUE=
+  ENABLE_MULTI_FALSE='#'
+else
+  ENABLE_MULTI_TRUE='#'
+  ENABLE_MULTI_FALSE=
+fi
+
+
+
+
+
+
+# Check whether --enable-voodoo was given.
+if test "${enable_voodoo+set}" = set; then
+  enableval=$enable_voodoo;
+else
+  enable_voodoo=no
+fi
+
+
+ if test "$enable_voodoo" = "yes"; then
+  ENABLE_VOODOO_TRUE=
+  ENABLE_VOODOO_FALSE='#'
+else
+  ENABLE_VOODOO_TRUE='#'
+  ENABLE_VOODOO_FALSE=
+fi
+
+
+
+# Check whether --enable-unique was given.
+if test "${enable_unique+set}" = set; then
+  enableval=$enable_unique;
+else
+  enable_unique=no
+fi
+
+
+ if test "$enable_unique" = "yes"; then
+  ENABLE_UNIQUE_TRUE=
+  ENABLE_UNIQUE_FALSE='#'
+else
+  ENABLE_UNIQUE_TRUE='#'
+  ENABLE_UNIQUE_FALSE=
+fi
+
+
+
+# Check whether --enable-mmx was given.
+if test "${enable_mmx+set}" = set; then
+  enableval=$enable_mmx;
+else
+  enable_mmx=$have_x86
+fi
+
+
+# Check whether --enable-sse was given.
+if test "${enable_sse+set}" = set; then
+  enableval=$enable_sse;
+else
+  enable_sse=$have_x86
+fi
+
+
+if test "$enable_mmx" = "yes"; then
+
+    save_ac_ext="$ac_ext"
+  ac_ext=S
+
+  { echo "$as_me:$LINENO: checking whether the binutils support MMX" >&5
+echo $ECHO_N "checking whether the binutils support MMX... $ECHO_C" >&6; }
+
+  echo "       movq 0, %mm0" > conftest.S
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_MMX 1
+_ACEOF
+
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+    if test "$enable_sse" = "yes"; then
+
+      { echo "$as_me:$LINENO: checking whether the binutils support SSE" >&5
+echo $ECHO_N "checking whether the binutils support SSE... $ECHO_C" >&6; }
+
+      echo "       movntps %xmm0, 0" > conftest.S
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_SSE 1
+_ACEOF
+
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+      else
+        enable_sse=no
+        { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+        { echo "$as_me:$LINENO: WARNING:
+****************************************************************
+ The installed assembler does not supports the SSE command set.
+ Update your binutils package, if you want to compile SSE code.
+****************************************************************" >&5
+echo "$as_me: WARNING:
+****************************************************************
+ The installed assembler does not supports the SSE command set.
+ Update your binutils package, if you want to compile SSE code.
+****************************************************************" >&2;}
+      fi
+
+    fi
+
+  else
+    enable_mmx=no
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    { echo "$as_me:$LINENO: WARNING:
+****************************************************************
+ The installed assembler does not supports the MMX command set.
+ Update your binutils package, if you want to compile MMX code.
+****************************************************************" >&5
+echo "$as_me: WARNING:
+****************************************************************
+ The installed assembler does not supports the MMX command set.
+ Update your binutils package, if you want to compile MMX code.
+****************************************************************" >&2;}
+  fi
+
+  rm conftest*
+  ac_ext="$save_ac_ext"
+
+else
+  enable_sse=no
+fi
+
+ if test "$enable_mmx" = "yes"; then
+  BUILDMMX_TRUE=
+  BUILDMMX_FALSE='#'
+else
+  BUILDMMX_TRUE='#'
+  BUILDMMX_FALSE=
+fi
+
+
+
+# Check whether --enable-devmem was given.
+if test "${enable_devmem+set}" = set; then
+  enableval=$enable_devmem;
+else
+  enable_devmem=yes
+fi
+
+
+ if test "$enable_devmem" = "yes"; then
+  DEVMEM_CORE_TRUE=
+  DEVMEM_CORE_FALSE='#'
+else
+  DEVMEM_CORE_TRUE='#'
+  DEVMEM_CORE_FALSE=
+fi
+
+
+
+
+# Check whether --enable-fbdev was given.
+if test "${enable_fbdev+set}" = set; then
+  enableval=$enable_fbdev;
+else
+  enable_fbdev=yes
+fi
+
+
+if test "$have_linux" = "no"; then
+  enable_fbdev=no
+  { echo "$as_me:$LINENO: WARNING:
+*** no linux kernel -- building without linux fbdev support." >&5
+echo "$as_me: WARNING:
+*** no linux kernel -- building without linux fbdev support." >&2;}
+fi
+
+if test "$enable_fbdev" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX_INPUT_USE_FBDEV 1
+_ACEOF
+
+fi
+
+ if test "$enable_fbdev" = "yes"; then
+  FBDEV_CORE_TRUE=
+  FBDEV_CORE_FALSE='#'
+else
+  FBDEV_CORE_TRUE='#'
+  FBDEV_CORE_FALSE=
+fi
+
+
+
+
+# Check whether --enable-sdl was given.
+if test "${enable_sdl+set}" = set; then
+  enableval=$enable_sdl;
+else
+  enable_sdl=no
+fi
+
+
+if test "$enable_sdl" = "yes"; then
+  if test "$enable_osx" = "yes"; then
+    { echo "$as_me:$LINENO: WARNING:
+*** SDL is now unsupported on OSX." >&5
+echo "$as_me: WARNING:
+*** SDL is now unsupported on OSX." >&2;}
+    enable_sdl=no
+ else
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for SDL" >&5
+echo $ECHO_N "checking for SDL... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SDL_CFLAGS"; then
+        pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&5
+  ($PKG_CONFIG --exists --print-errors "sdl") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SDL_LIBS"; then
+        pkg_cv_SDL_LIBS="$SDL_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&5
+  ($PKG_CONFIG --exists --print-errors "sdl") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sdl"`
+        else
+	        SDL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sdl"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$SDL_PKG_ERRORS" >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+                enable_sdl=no,
+      { echo "$as_me:$LINENO: WARNING: *** no sdl -- building without SDL support." >&5
+echo "$as_me: WARNING: *** no sdl -- building without SDL support." >&2;}
+elif test $pkg_failed = untried; then
+	enable_sdl=no,
+      { echo "$as_me:$LINENO: WARNING: *** no sdl -- building without SDL support." >&5
+echo "$as_me: WARNING: *** no sdl -- building without SDL support." >&2;}
+else
+	SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
+	SDL_LIBS=$pkg_cv_SDL_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	enable_sdl=yes
+fi
+  fi
+fi
+
+
+ if test "$enable_sdl" = "yes"; then
+  SDL_CORE_TRUE=
+  SDL_CORE_FALSE='#'
+else
+  SDL_CORE_TRUE='#'
+  SDL_CORE_FALSE=
+fi
+
+
+# Check whether --enable-vnc was given.
+if test "${enable_vnc+set}" = set; then
+  enableval=$enable_vnc;
+else
+  enable_vnc=yes
+fi
+
+
+
+
+if test "$enable_vnc" = "yes"; then
+  # Extract the first word of "libvncserver-config", so it can be a program name with args.
+set dummy libvncserver-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_VNC_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $VNC_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_VNC_CONFIG="$VNC_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_VNC_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_VNC_CONFIG" && ac_cv_path_VNC_CONFIG="no"
+  ;;
+esac
+fi
+VNC_CONFIG=$ac_cv_path_VNC_CONFIG
+if test -n "$VNC_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $VNC_CONFIG" >&5
+echo "${ECHO_T}$VNC_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  if test "$VNC_CONFIG" = "no"; then
+    enable_vnc=no
+    { echo "$as_me:$LINENO: WARNING:
+*** libvncserver-config not found -- building without VNC support. See http://libvncserver.sourceforge.net" >&5
+echo "$as_me: WARNING:
+*** libvncserver-config not found -- building without VNC support. See http://libvncserver.sourceforge.net" >&2;}
+  else
+    VNC_CFLAGS=`$VNC_CONFIG --cflags`
+    VNC_LIBS=`$VNC_CONFIG --libs`
+  fi
+fi
+
+
+
+
+ if test "$enable_vnc" = "yes"; then
+  VNC_CORE_TRUE=
+  VNC_CORE_FALSE='#'
+else
+  VNC_CORE_TRUE='#'
+  VNC_CORE_FALSE=
+fi
+
+
+
+
+# Check whether --enable-sysfs was given.
+if test "${enable_sysfs+set}" = set; then
+  enableval=$enable_sysfs;
+else
+  enable_sysfs=yes
+fi
+
+
+use_sysfs=no
+SYSFS_LIBS=
+
+if test "$enable_sysfs" = "yes"; then
+  { echo "$as_me:$LINENO: checking for sysfs_get_mnt_path in -lsysfs" >&5
+echo $ECHO_N "checking for sysfs_get_mnt_path in -lsysfs... $ECHO_C" >&6; }
+if test "${ac_cv_lib_sysfs_sysfs_get_mnt_path+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsysfs  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sysfs_get_mnt_path ();
+int
+main ()
+{
+return sysfs_get_mnt_path ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_sysfs_sysfs_get_mnt_path=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_sysfs_sysfs_get_mnt_path=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_sysfs_sysfs_get_mnt_path" >&5
+echo "${ECHO_T}$ac_cv_lib_sysfs_sysfs_get_mnt_path" >&6; }
+if test $ac_cv_lib_sysfs_sysfs_get_mnt_path = yes; then
+
+	if test "${ac_cv_header_sysfs_libsysfs_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sysfs/libsysfs.h" >&5
+echo $ECHO_N "checking for sysfs/libsysfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sysfs_libsysfs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sysfs_libsysfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sysfs_libsysfs_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sysfs/libsysfs.h usability" >&5
+echo $ECHO_N "checking sysfs/libsysfs.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <sysfs/libsysfs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sysfs/libsysfs.h presence" >&5
+echo $ECHO_N "checking sysfs/libsysfs.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sysfs/libsysfs.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sysfs/libsysfs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sysfs/libsysfs.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for sysfs/libsysfs.h" >&5
+echo $ECHO_N "checking for sysfs/libsysfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sysfs_libsysfs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_sysfs_libsysfs_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sysfs_libsysfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sysfs_libsysfs_h" >&6; }
+
+fi
+if test $ac_cv_header_sysfs_libsysfs_h = yes; then
+  use_sysfs=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_SYSFS 1
+_ACEOF
+
+	SYSFS_LIBS='-lsysfs'
+else
+  { echo "$as_me:$LINENO: WARNING:
+*** libsysfs header files not found -- Building without sysfs support." >&5
+echo "$as_me: WARNING:
+*** libsysfs header files not found -- Building without sysfs support." >&2;}
+fi
+
+
+
+else
+
+	{ echo "$as_me:$LINENO: WARNING:  *** libsysfs not found -- Building without sysfs support." >&5
+echo "$as_me: WARNING:  *** libsysfs not found -- Building without sysfs support." >&2;}
+
+fi
+
+fi
+
+
+
+
+JPEG=no
+
+# Check whether --enable-jpeg was given.
+if test "${enable_jpeg+set}" = set; then
+  enableval=$enable_jpeg; enable_jpeg="$enableval"
+else
+  enable_jpeg=yes
+fi
+
+
+if test "$enable_jpeg" = "yes"; then
+  if test -z "$LIBJPEG"; then
+    { echo "$as_me:$LINENO: checking for jpeg_destroy_decompress in -ljpeg" >&5
+echo $ECHO_N "checking for jpeg_destroy_decompress in -ljpeg... $ECHO_C" >&6; }
+if test "${ac_cv_lib_jpeg_jpeg_destroy_decompress+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_destroy_decompress ();
+int
+main ()
+{
+return jpeg_destroy_decompress ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_jpeg_jpeg_destroy_decompress=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_jpeg_jpeg_destroy_decompress=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_destroy_decompress" >&5
+echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_destroy_decompress" >&6; }
+if test $ac_cv_lib_jpeg_jpeg_destroy_decompress = yes; then
+  jpeg_ok=yes
+else
+  jpeg_ok=no
+fi
+
+    if test "$jpeg_ok" = yes; then
+      if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for jpeglib.h" >&5
+echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
+echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking jpeglib.h usability" >&5
+echo $ECHO_N "checking jpeglib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <jpeglib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking jpeglib.h presence" >&5
+echo $ECHO_N "checking jpeglib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <jpeglib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: jpeglib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: jpeglib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: jpeglib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: jpeglib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: jpeglib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: jpeglib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: jpeglib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: jpeglib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for jpeglib.h" >&5
+echo $ECHO_N "checking for jpeglib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_jpeglib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_jpeglib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_jpeglib_h" >&5
+echo "${ECHO_T}$ac_cv_header_jpeglib_h" >&6; }
+
+fi
+if test $ac_cv_header_jpeglib_h = yes; then
+  jpeg_ok=yes
+else
+  jpeg_ok=no
+fi
+
+
+      if test "$jpeg_ok" = yes; then
+	JPEG=yes
+	LIBJPEG='-ljpeg'
+      else
+	JPEG=no
+	{ echo "$as_me:$LINENO: WARNING:
+*** JPEG header files not found. JPEG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** JPEG header files not found. JPEG image provider will not be built." >&2;}
+      fi
+    else
+      JPEG=no
+      { echo "$as_me:$LINENO: WARNING:
+*** JPEG library not found. JPEG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** JPEG library not found. JPEG image provider will not be built." >&2;}
+    fi
+  fi
+fi
+
+ if test "$JPEG" = "yes"; then
+  JPEG_PROVIDER_TRUE=
+  JPEG_PROVIDER_FALSE='#'
+else
+  JPEG_PROVIDER_TRUE='#'
+  JPEG_PROVIDER_FALSE=
+fi
+
+
+if test "$enable_jpeg" != "no" && test "$JPEG" != "yes"; then
+  jpeg_warning="
+JPEG support is missing - many applications won't work correctly!"
+fi
+
+
+# Check whether --enable-zlib was given.
+if test "${enable_zlib+set}" = set; then
+  enableval=$enable_zlib; enable_zlib="$enableval"
+else
+  enable_zlib=no
+fi
+
+
+use_zlib=no
+ZLIB_LIBS=
+
+if test "$enable_zlib" = "yes"; then
+    { echo "$as_me:$LINENO: checking for gzsetparams in -lz" >&5
+echo $ECHO_N "checking for gzsetparams in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_gzsetparams+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gzsetparams ();
+int
+main ()
+{
+return gzsetparams ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_gzsetparams=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_z_gzsetparams=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzsetparams" >&5
+echo "${ECHO_T}$ac_cv_lib_z_gzsetparams" >&6; }
+if test $ac_cv_lib_z_gzsetparams = yes; then
+
+	if test "${ac_cv_header_zlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <zlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  use_zlib=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_ZLIB 1
+_ACEOF
+
+	ZLIB_LIBS='-lz'
+else
+  { { echo "$as_me:$LINENO: error:
+*** libz header files not found." >&5
+echo "$as_me: error:
+*** libz header files not found." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+else
+
+	{ { echo "$as_me:$LINENO: error:  *** libz not found." >&5
+echo "$as_me: error:  *** libz not found." >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+fi
+
+
+
+
+PNG=no
+
+# Check whether --enable-png was given.
+if test "${enable_png+set}" = set; then
+  enableval=$enable_png; enable_png="$enableval"
+else
+  enable_png=yes
+fi
+
+
+if test "$enable_png" = "yes"; then
+    if test -z "$ZLIB_LIBS"; then
+    { echo "$as_me:$LINENO: checking for gzsetparams in -lz" >&5
+echo $ECHO_N "checking for gzsetparams in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_gzsetparams+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gzsetparams ();
+int
+main ()
+{
+return gzsetparams ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_gzsetparams=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_z_gzsetparams=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzsetparams" >&5
+echo "${ECHO_T}$ac_cv_lib_z_gzsetparams" >&6; }
+if test $ac_cv_lib_z_gzsetparams = yes; then
+
+	if test "${ac_cv_header_zlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <zlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  ZLIB_LIBS='-lz'
+else
+  { echo "$as_me:$LINENO: WARNING:
+*** libz header files not found. PNG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** libz header files not found. PNG image provider will not be built." >&2;}
+fi
+
+
+
+else
+
+        { echo "$as_me:$LINENO: WARNING:  *** libz not found. PNG image provider will not be built." >&5
+echo "$as_me: WARNING:  *** libz not found. PNG image provider will not be built." >&2;}
+
+fi
+
+  fi
+
+  # Extract the first word of "libpng-config", so it can be a program name with args.
+set dummy libpng-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_LIBPNG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $LIBPNG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIBPNG_CONFIG="$LIBPNG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_LIBPNG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_LIBPNG_CONFIG" && ac_cv_path_LIBPNG_CONFIG="no"
+  ;;
+esac
+fi
+LIBPNG_CONFIG=$ac_cv_path_LIBPNG_CONFIG
+if test -n "$LIBPNG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $LIBPNG_CONFIG" >&5
+echo "${ECHO_T}$LIBPNG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  if test "$LIBPNG_CONFIG" = no; then
+      PNG=no
+      { echo "$as_me:$LINENO: WARNING:
+*** libpng-config not found " >&5
+echo "$as_me: WARNING:
+*** libpng-config not found " >&2;}
+  else
+      PNG=yes
+      LIBPNG=`$LIBPNG_CONFIG --libs`
+  fi
+
+    if test -z "$LIBPNG" && test -n "$ZLIB_LIBS"; then
+    { echo "$as_me:$LINENO: checking for png_read_info in -lpng" >&5
+echo $ECHO_N "checking for png_read_info in -lpng... $ECHO_C" >&6; }
+if test "${ac_cv_lib_png_png_read_info+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng $ZLIB_LIBS -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_read_info ();
+int
+main ()
+{
+return png_read_info ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_png_png_read_info=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_png_png_read_info=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_read_info" >&5
+echo "${ECHO_T}$ac_cv_lib_png_png_read_info" >&6; }
+if test $ac_cv_lib_png_png_read_info = yes; then
+
+	if test "${ac_cv_header_png_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking png.h usability" >&5
+echo $ECHO_N "checking png.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <png.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking png.h presence" >&5
+echo $ECHO_N "checking png.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <png.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: png.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: png.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: png.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: png.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: png.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_png_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+
+fi
+if test $ac_cv_header_png_h = yes; then
+  png_ok=yes
+else
+  { echo "$as_me:$LINENO: WARNING:
+*** PNG header files not found. PNG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** PNG header files not found. PNG image provider will not be built." >&2;}
+fi
+
+
+
+else
+
+        { echo "$as_me:$LINENO: WARNING:
+*** PNG library not found. PNG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** PNG library not found. PNG image provider will not be built." >&2;}
+
+fi
+
+    if test "$png_ok" = yes; then
+      { echo "$as_me:$LINENO: checking for png_structp in png.h" >&5
+echo $ECHO_N "checking for png_structp in png.h... $ECHO_C" >&6; }
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <png.h>
+int
+main ()
+{
+png_structp pp;
+	 png_infop info;
+	 png_colorp cmap;
+	 (void)png_create_read_struct; (void)pp; (void)info; (void)cmap;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  png_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	png_ok=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      { echo "$as_me:$LINENO: result: $png_ok" >&5
+echo "${ECHO_T}$png_ok" >&6; }
+      if test "$png_ok" = yes; then
+	PNG=yes
+        LIBPNG="-lpng $ZLIB_LIBS -lm"
+      else
+	PNG=no
+        { echo "$as_me:$LINENO: WARNING:
+*** PNG library is too old. PNG image provider will not be built." >&5
+echo "$as_me: WARNING:
+*** PNG library is too old. PNG image provider will not be built." >&2;}
+      fi
+    else
+      PNG=no
+    fi
+  fi
+fi
+
+ if test "$PNG" = "yes"; then
+  PNG_PROVIDER_TRUE=
+  PNG_PROVIDER_FALSE='#'
+else
+  PNG_PROVIDER_TRUE='#'
+  PNG_PROVIDER_FALSE=
+fi
+
+ if test "$PNG" = "yes"; then
+  BUILD_DIRECTFB_CSOURCE_TRUE=
+  BUILD_DIRECTFB_CSOURCE_FALSE='#'
+else
+  BUILD_DIRECTFB_CSOURCE_TRUE='#'
+  BUILD_DIRECTFB_CSOURCE_FALSE=
+fi
+
+
+if test "$enable_png" != "no" && test "$PNG" != "yes"; then
+  png_warning="
+PNG support is missing - many applications won't work correctly!"
+fi
+
+
+# Check whether --enable-gif was given.
+if test "${enable_gif+set}" = set; then
+  enableval=$enable_gif; enable_gif="$enableval"
+else
+  enable_gif=yes
+fi
+
+
+ if test "$enable_gif" = "yes"; then
+  GIF_PROVIDER_TRUE=
+  GIF_PROVIDER_FALSE='#'
+else
+  GIF_PROVIDER_TRUE='#'
+  GIF_PROVIDER_FALSE=
+fi
+
+
+
+# Check whether --enable-freetype was given.
+if test "${enable_freetype+set}" = set; then
+  enableval=$enable_freetype; enable_freetype="$enableval"
+else
+  enable_freetype=yes
+fi
+
+
+if test "$enable_freetype" = "yes"; then
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for FREETYPE" >&5
+echo $ECHO_N "checking for FREETYPE... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$FREETYPE_CFLAGS"; then
+        pkg_cv_FREETYPE_CFLAGS="$FREETYPE_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"freetype2\"") >&5
+  ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_FREETYPE_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$FREETYPE_LIBS"; then
+        pkg_cv_FREETYPE_LIBS="$FREETYPE_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"freetype2\"") >&5
+  ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_FREETYPE_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        FREETYPE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "freetype2"`
+        else
+	        FREETYPE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$FREETYPE_PKG_ERRORS" >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+                FREETYPE="no",
+    { echo "$as_me:$LINENO: WARNING: *** no freetype -- FreeType font provider will not be built." >&5
+echo "$as_me: WARNING: *** no freetype -- FreeType font provider will not be built." >&2;}
+elif test $pkg_failed = untried; then
+	FREETYPE="no",
+    { echo "$as_me:$LINENO: WARNING: *** no freetype -- FreeType font provider will not be built." >&5
+echo "$as_me: WARNING: *** no freetype -- FreeType font provider will not be built." >&2;}
+else
+	FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
+	FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	FREETYPE="yes"
+fi
+fi
+
+ if test "$FREETYPE" = "yes"; then
+  FREETYPE_PROVIDER_TRUE=
+  FREETYPE_PROVIDER_FALSE='#'
+else
+  FREETYPE_PROVIDER_TRUE='#'
+  FREETYPE_PROVIDER_FALSE=
+fi
+
+
+if test "$enable_freetype" != "no" && test "$FREETYPE" != "yes"; then
+  freetype_warning="
+FreeType2 support is missing - many applications won't work correctly!"
+fi
+
+V4L=no
+
+if test "$have_linux" = "yes"; then
+  # Check whether --enable-video4linux was given.
+if test "${enable_video4linux+set}" = set; then
+  enableval=$enable_video4linux; enable_v4l="$enableval"
+else
+  enable_v4l=yes
+fi
+
+
+  if test "$enable_v4l" = "yes"; then
+    V4L=yes
+  fi
+fi
+
+ if test "$V4L" = "yes"; then
+  V4L_PROVIDER_TRUE=
+  V4L_PROVIDER_FALSE='#'
+else
+  V4L_PROVIDER_TRUE='#'
+  V4L_PROVIDER_FALSE=
+fi
+
+
+
+V4L2=no
+
+if test "$V4L" = "yes"; then
+  # Check whether --enable-video4linux2 was given.
+if test "${enable_video4linux2+set}" = set; then
+  enableval=$enable_video4linux2; enable_v4l2="$enableval"
+else
+  enable_v4l2=no
+fi
+
+
+  if test "$enable_v4l2" = "yes"; then
+    V4L2=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_HAVE_V4L2 1
+_ACEOF
+
+  fi
+fi
+
+
+ati128=no
+cle266=no
+cyber5k=no
+davinci=no
+ep9x=no
+gl=no
+glx=no
+i810=no
+i830=no
+mach64=no
+matrox=no
+neomagic=no
+nsc=no
+nvidia=no
+omap=no
+radeon=no
+savage=no
+sh772x=no
+sis315=no
+tdfx=no
+unichrome=no
+vmware=no
+
+if test "$have_linux" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking which gfxdrivers should be built" >&5
+echo $ECHO_N "checking which gfxdrivers should be built... $ECHO_C" >&6; }
+
+# Check whether --with-gfxdrivers was given.
+if test "${with_gfxdrivers+set}" = set; then
+  withval=$with_gfxdrivers; gfxdrivers="$withval"
+else
+  gfxdrivers="all"
+fi
+
+
+if test "$gfxdrivers" = "all"; then
+  checkfor_ati128=yes
+  checkfor_cle266=no
+  checkfor_cyber5k=yes
+  checkfor_davinci="$have_arm"
+  checkfor_ep9x=yes
+  checkfor_gl=yes
+  checkfor_i810=yes
+  checkfor_i830=yes
+  checkfor_mach64=yes
+  checkfor_matrox=yes
+  checkfor_neomagic=yes
+  checkfor_nsc=yes
+  checkfor_nvidia=yes
+  checkfor_omap="$have_arm"
+  checkfor_radeon=yes
+  checkfor_savage=yes
+  checkfor_sh772x=yes
+  checkfor_sis315=yes
+  checkfor_tdfx=yes
+  checkfor_unichrome=yes
+  checkfor_vmware=yes
+
+  { echo "$as_me:$LINENO: result: all" >&5
+echo "${ECHO_T}all" >&6; }
+else
+  if test "$gfxdrivers" != "none"; then
+    gfxdrivers=`echo $gfxdrivers | sed 's/,/ /g'`
+    for gfxdriver in $gfxdrivers
+    do
+      case "$gfxdriver" in
+          ati128)
+                  checkfor_ati128=yes
+                  ;;
+          cle266)
+                  checkfor_cle266=yes
+                  ;;
+          cyber5k)
+                  checkfor_cyber5k=yes
+                  ;;
+          davinci)
+                  checkfor_davinci=yes
+                  ;;
+          ep9x)
+                  checkfor_ep9x=yes
+                  ;;
+          gl)
+                  checkfor_gl=yes
+                  ;;
+          i810)
+                  checkfor_i810=yes
+                  ;;
+          i830)
+                  checkfor_i830=yes
+                  ;;
+          mach64)
+                  checkfor_mach64=yes
+                  ;;
+          matrox)
+                  checkfor_matrox=yes
+                  ;;
+          neomagic)
+                  checkfor_neomagic=yes
+                  ;;
+          nsc)
+                  checkfor_nsc=yes
+                  ;;
+          nvidia)
+                  checkfor_nvidia=yes
+                  ;;
+          omap)
+                  checkfor_omap=yes
+                  ;;
+          radeon)
+                  checkfor_radeon=yes
+                  ;;
+          savage)
+                  checkfor_savage=yes
+                  ;;
+          sh772x)
+                  checkfor_sh772x=yes
+                  ;;
+          sis315)
+                  checkfor_sis315=yes
+                  ;;
+          tdfx)
+                  checkfor_tdfx=yes
+                  ;;
+          unichrome)
+                  checkfor_unichrome=yes
+                  ;;
+          vmware)
+                  checkfor_vmware=yes
+                  ;;
+          *)
+                  echo "Unknown gfxdriver $gfxdriver, exiting!"
+                  exit 1
+                  ;;
+      esac
+    done
+    { echo "$as_me:$LINENO: result: $gfxdrivers" >&5
+echo "${ECHO_T}$gfxdrivers" >&6; }
+  fi
+fi
+
+if test "$checkfor_ati128" = "yes"; then
+  ati128=yes
+fi
+
+if test "$checkfor_cle266" = "yes" && test "$have_sysio" = "yes"; then
+  cle266=yes
+fi
+
+if test "$checkfor_cyber5k" = "yes"; then
+  cyber5k=yes
+fi
+
+if test "$checkfor_davinci" = "yes"; then
+  davinci=yes
+fi
+
+if test "$checkfor_ep9x" = "yes"; then
+  ep9x=yes
+fi
+
+if test "$checkfor_gl" = "yes"; then
+  if test "${ac_cv_header_GL_gl_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for GL/gl.h" >&5
+echo $ECHO_N "checking for GL/gl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_GL_gl_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_gl_h" >&5
+echo "${ECHO_T}$ac_cv_header_GL_gl_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking GL/gl.h usability" >&5
+echo $ECHO_N "checking GL/gl.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <GL/gl.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking GL/gl.h presence" >&5
+echo $ECHO_N "checking GL/gl.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <GL/gl.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: GL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: GL/gl.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: GL/gl.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: GL/gl.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: GL/gl.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: GL/gl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: GL/gl.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/gl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: GL/gl.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for GL/gl.h" >&5
+echo $ECHO_N "checking for GL/gl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_GL_gl_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_GL_gl_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_gl_h" >&5
+echo "${ECHO_T}$ac_cv_header_GL_gl_h" >&6; }
+
+fi
+if test $ac_cv_header_GL_gl_h = yes; then
+  gl=yes
+fi
+
+
+  if test "${ac_cv_header_GL_glx_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for GL/glx.h" >&5
+echo $ECHO_N "checking for GL/glx.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_GL_glx_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_glx_h" >&5
+echo "${ECHO_T}$ac_cv_header_GL_glx_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking GL/glx.h usability" >&5
+echo $ECHO_N "checking GL/glx.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <GL/glx.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking GL/glx.h presence" >&5
+echo $ECHO_N "checking GL/glx.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <GL/glx.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: GL/glx.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: GL/glx.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: GL/glx.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: GL/glx.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: GL/glx.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: GL/glx.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: GL/glx.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: GL/glx.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: GL/glx.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for GL/glx.h" >&5
+echo $ECHO_N "checking for GL/glx.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_GL_glx_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_GL_glx_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_glx_h" >&5
+echo "${ECHO_T}$ac_cv_header_GL_glx_h" >&6; }
+
+fi
+if test $ac_cv_header_GL_glx_h = yes; then
+
+                  glx=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_GLX 1
+_ACEOF
+
+
+fi
+
+
+fi
+
+if test "$checkfor_i810" = "yes" && test "$have_sysio" = "yes"; then
+  i810=yes
+fi
+
+if test "$checkfor_i830" = "yes" && test "$have_sysio" = "yes"; then
+  i830=yes
+fi
+
+if test "$checkfor_mach64" = "yes"; then
+  mach64=yes
+fi
+
+if test "$checkfor_matrox" = "yes"; then
+  matrox=yes
+fi
+
+if test "$checkfor_neomagic" = "yes" && test "$have_sysio" = "yes"; then
+  neomagic=yes
+fi
+
+if test "$checkfor_nsc" = "yes"; then
+  nsc=yes
+fi
+
+if test "$checkfor_nvidia" = "yes"; then
+  nvidia=yes
+fi
+
+if test "$checkfor_omap" = "yes"; then
+  omap=yes
+fi
+
+if test "$checkfor_radeon" = "yes"; then
+  radeon=yes
+fi
+
+if test "$checkfor_savage" = "yes" && test "$have_sysio" = "yes"; then
+  savage=yes
+fi
+
+if test "$checkfor_sh772x" = "yes" && test "$have_sh4" = "yes"; then
+  sh772x=yes
+fi
+
+if test "$checkfor_sis315" = "yes"; then
+  sis315=yes
+fi
+
+if test "$checkfor_tdfx" = "yes"; then
+  tdfx=yes
+fi
+
+if test "$checkfor_unichrome" = "yes" && test "$have_sysio" = "yes"; then
+  unichrome=yes
+fi
+
+if test "$checkfor_vmware" = "yes"; then
+  vmware=yes
+fi
+
+# lets check for input driver
+
+checkfor_dbox2remote=no
+checkfor_dreamboxremote=no
+checkfor_dynapro=no
+checkfor_elo=no
+checkfor_gunze=no
+checkfor_h3600ts=no
+checkfor_joystick=no
+checkfor_keyboard=no
+checkfor_linux_input=no
+checkfor_lirc=no
+checkfor_mutouch=no
+checkfor_zytronic=no
+checkfor_penmount=no
+checkfor_ps2mouse=no
+checkfor_serialmouse=no
+checkfor_sonypijogdial=no
+checkfor_tslib=no
+checkfor_ucb1x00=no
+checkfor_wm97xx=no
+
+{ echo "$as_me:$LINENO: checking which inputdrivers should be built" >&5
+echo $ECHO_N "checking which inputdrivers should be built... $ECHO_C" >&6; }
+
+# Check whether --with-inputdrivers was given.
+if test "${with_inputdrivers+set}" = set; then
+  withval=$with_inputdrivers; inputdrivers="$withval"
+else
+  inputdrivers="all"
+fi
+
+
+if test "$inputdrivers" = "all"; then
+  checkfor_dbox2remote=yes
+  checkfor_dreamboxremote=yes
+  checkfor_dynapro=no
+  checkfor_elo=no
+  checkfor_gunze=no
+  checkfor_h3600ts=yes
+  checkfor_joystick=yes
+  checkfor_keyboard=yes
+  checkfor_linux_input=yes
+  checkfor_lirc=yes
+  checkfor_mutouch=yes
+  checkfor_zytronic=yes
+  checkfor_penmount=yes
+  checkfor_ps2mouse=yes
+  checkfor_serialmouse=yes
+  checkfor_sonypijogdial=yes
+  checkfor_tslib=yes
+  checkfor_ucb1x00="$have_arm"
+  checkfor_wm97xx=yes
+  { echo "$as_me:$LINENO: result: all" >&5
+echo "${ECHO_T}all" >&6; }
+else
+  if test "$inputdrivers" != "none"; then
+    inputdrivers=`echo $inputdrivers | sed 's/,/ /g'`
+    for inputdriver in $inputdrivers
+    do
+      case "$inputdriver" in
+          dbox2remote)
+                  checkfor_dbox2remote=yes
+                  ;;
+          dreamboxremote)
+                  checkfor_dreamboxremote=yes
+                  ;;
+          dynapro)
+                  checkfor_dynapro=yes
+                  ;;
+          elo-input)
+                  checkfor_elo=yes
+                  ;;
+          gunze)
+                  checkfor_gunze=yes
+                  ;;
+          h3600_ts)
+                  checkfor_h3600ts=yes
+                  ;;
+          joystick)
+                  checkfor_joystick=yes
+                  ;;
+          keyboard)
+                  checkfor_keyboard=yes
+                  ;;
+          linuxinput)
+                  checkfor_linux_input=yes
+                  ;;
+          lirc)
+                  checkfor_lirc=yes
+                  ;;
+          mutouch)
+                  checkfor_mutouch=yes
+                  ;;
+          zytronic)
+                  checkfor_zytronic=yes
+                  ;;
+          penmount)
+                  checkfor_penmount=yes
+                  ;;
+          ps2mouse)
+                  checkfor_ps2mouse=yes
+                  ;;
+          serialmouse)
+                  checkfor_serialmouse=yes
+                  ;;
+          sonypijogdial)
+                  checkfor_sonypijogdial=yes
+                  ;;
+          tslib)
+                  checkfor_tslib=yes
+                  ;;
+          ucb1x00)
+                  checkfor_ucb1x00=yes
+                  ;;
+          wm97xx)
+                  checkfor_wm97xx=yes
+                  ;;
+          *)
+                  echo "Unknown inputdriver $inputdriver, exiting!"
+                  exit 1
+                  ;;
+      esac
+    done
+    { echo "$as_me:$LINENO: result: $inputdrivers" >&5
+echo "${ECHO_T}$inputdrivers" >&6; }
+  fi
+fi
+
+enable_dbox2remote=no
+if test "$checkfor_dbox2remote" = "yes"; then
+      if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for dbox/fp.h" >&5
+echo $ECHO_N "checking for dbox/fp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dbox_fp_h" >&5
+echo "${ECHO_T}$ac_cv_header_dbox_fp_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking dbox/fp.h usability" >&5
+echo $ECHO_N "checking dbox/fp.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <dbox/fp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking dbox/fp.h presence" >&5
+echo $ECHO_N "checking dbox/fp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <dbox/fp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: dbox/fp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: dbox/fp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: dbox/fp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: dbox/fp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: dbox/fp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: dbox/fp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: dbox/fp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: dbox/fp.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for dbox/fp.h" >&5
+echo $ECHO_N "checking for dbox/fp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_dbox_fp_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dbox_fp_h" >&5
+echo "${ECHO_T}$ac_cv_header_dbox_fp_h" >&6; }
+
+fi
+if test $ac_cv_header_dbox_fp_h = yes; then
+  enable_dbox2remote=yes
+else
+  enable_dbox2remote=no
+    { echo "$as_me:$LINENO: WARNING: *** DBox2 Remote input driver will not be built." >&5
+echo "$as_me: WARNING: *** DBox2 Remote input driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_dreamboxremote=no
+if test "$checkfor_dreamboxremote" = "yes"; then
+      if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for dbox/fp.h" >&5
+echo $ECHO_N "checking for dbox/fp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dbox_fp_h" >&5
+echo "${ECHO_T}$ac_cv_header_dbox_fp_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking dbox/fp.h usability" >&5
+echo $ECHO_N "checking dbox/fp.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <dbox/fp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking dbox/fp.h presence" >&5
+echo $ECHO_N "checking dbox/fp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <dbox/fp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: dbox/fp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: dbox/fp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: dbox/fp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: dbox/fp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: dbox/fp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: dbox/fp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: dbox/fp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: dbox/fp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: dbox/fp.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for dbox/fp.h" >&5
+echo $ECHO_N "checking for dbox/fp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_dbox_fp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_dbox_fp_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_dbox_fp_h" >&5
+echo "${ECHO_T}$ac_cv_header_dbox_fp_h" >&6; }
+
+fi
+if test $ac_cv_header_dbox_fp_h = yes; then
+  enable_dreamboxremote=yes
+else
+  enable_dreamboxremote=no
+    { echo "$as_me:$LINENO: WARNING: *** DreamBox Remote input driver will not be built." >&5
+echo "$as_me: WARNING: *** DreamBox Remote input driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_dynapro_ts=no
+if test "$checkfor_dynapro" = "yes"; then
+    enable_dynapro_ts=yes
+fi
+
+enable_elo_input=no
+if test "$checkfor_elo" = "yes"; then
+    enable_elo_input=yes
+fi
+
+enable_gunze_input=no
+if test "$checkfor_gunze" = "yes"; then
+    enable_gunze_input=yes
+fi
+
+enable_h3600_ts=no
+if test "$checkfor_h3600ts" = "yes"; then
+    if test "${ac_cv_header_linux_h3600_ts_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/h3600_ts.h" >&5
+echo $ECHO_N "checking for linux/h3600_ts.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_h3600_ts_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_h3600_ts_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_h3600_ts_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/h3600_ts.h usability" >&5
+echo $ECHO_N "checking linux/h3600_ts.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/h3600_ts.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/h3600_ts.h presence" >&5
+echo $ECHO_N "checking linux/h3600_ts.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/h3600_ts.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/h3600_ts.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/h3600_ts.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/h3600_ts.h" >&5
+echo $ECHO_N "checking for linux/h3600_ts.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_h3600_ts_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_h3600_ts_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_h3600_ts_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_h3600_ts_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_h3600_ts_h = yes; then
+  enable_h3600_ts=yes
+else
+  enable_h3600_ts=no
+    { echo "$as_me:$LINENO: WARNING: *** H3600 Touchscreen driver will not be built." >&5
+echo "$as_me: WARNING: *** H3600 Touchscreen driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_joystick=no
+if test "$checkfor_joystick" = "yes"; then
+
+  if test "${ac_cv_header_linux_joystick_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/joystick.h" >&5
+echo $ECHO_N "checking for linux/joystick.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_joystick_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_joystick_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_joystick_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/joystick.h usability" >&5
+echo $ECHO_N "checking linux/joystick.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/joystick.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/joystick.h presence" >&5
+echo $ECHO_N "checking linux/joystick.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/joystick.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/joystick.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/joystick.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/joystick.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/joystick.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/joystick.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/joystick.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/joystick.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/joystick.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/joystick.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/joystick.h" >&5
+echo $ECHO_N "checking for linux/joystick.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_joystick_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_joystick_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_joystick_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_joystick_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_joystick_h = yes; then
+  enable_joystick=yes
+else
+  enable_joystick=no
+     { echo "$as_me:$LINENO: WARNING: *** no linux/joystick.h -- Joystick driver will not be built." >&5
+echo "$as_me: WARNING: *** no linux/joystick.h -- Joystick driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_keyboard=no
+if test "$checkfor_keyboard" = "yes"; then
+    enable_keyboard=yes
+fi
+
+enable_linux_input=no
+if test "$checkfor_linux_input" = "yes"; then
+  if test "${ac_cv_header_linux_input_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/input.h" >&5
+echo $ECHO_N "checking for linux/input.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_input_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_input_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_input_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/input.h usability" >&5
+echo $ECHO_N "checking linux/input.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/input.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/input.h presence" >&5
+echo $ECHO_N "checking linux/input.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/input.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/input.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/input.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/input.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/input.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/input.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/input.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/input.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/input.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/input.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/input.h" >&5
+echo $ECHO_N "checking for linux/input.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_input_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_input_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_input_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_input_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_input_h = yes; then
+  enable_linux_input=yes
+else
+  enable_linux_input=no
+    { echo "$as_me:$LINENO: WARNING: *** no linux/input.h -- Linux Input driver will not be built." >&5
+echo "$as_me: WARNING: *** no linux/input.h -- Linux Input driver will not be built." >&2;}
+fi
+
+
+
+  if test "$enable_linux_input" = "yes"; then
+    { echo "$as_me:$LINENO: checking for struct input_absinfo in linux/input.h" >&5
+echo $ECHO_N "checking for struct input_absinfo in linux/input.h... $ECHO_C" >&6; }
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/input.h>
+int
+main ()
+{
+struct input_absinfo x; (void)x;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INPUT_ABSINFO 1
+_ACEOF
+
+       { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  fi
+fi
+
+enable_lirc=no
+if test "$checkfor_lirc" = "yes"; then
+    enable_lirc=yes
+fi
+
+enable_mutouch=no
+if test "$checkfor_mutouch" = "yes"; then
+          enable_mutouch=yes
+fi
+
+enable_zytronic=no
+if test "$checkfor_zytronic" = "yes"; then
+    enable_zytronic=yes
+fi
+
+enable_penmount=no
+if test "$checkfor_penmount" = "yes"; then
+    enable_penmount=yes
+fi
+
+enable_ps2mouse=no
+if test "$checkfor_ps2mouse" = "yes"; then
+    enable_ps2mouse=yes
+fi
+
+enable_serial_mouse=no
+if test "$checkfor_serialmouse" = "yes"; then
+    if test "${ac_cv_header_linux_serial_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/serial.h" >&5
+echo $ECHO_N "checking for linux/serial.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_serial_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_serial_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_serial_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/serial.h usability" >&5
+echo $ECHO_N "checking linux/serial.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/serial.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/serial.h presence" >&5
+echo $ECHO_N "checking linux/serial.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/serial.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/serial.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/serial.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/serial.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/serial.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/serial.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/serial.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/serial.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/serial.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/serial.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/serial.h" >&5
+echo $ECHO_N "checking for linux/serial.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_serial_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_serial_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_serial_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_serial_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_serial_h = yes; then
+  enable_serial_mouse=yes
+else
+  enable_serial_mouse=no
+     { echo "$as_me:$LINENO: WARNING: *** no linux/serial.h -- serial mouse driver will not be built." >&5
+echo "$as_me: WARNING: *** no linux/serial.h -- serial mouse driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_sonypi_jogdial=no
+if test "$checkfor_sonypijogdial" = "yes"; then
+    if test "${ac_cv_header_linux_sonypi_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/sonypi.h" >&5
+echo $ECHO_N "checking for linux/sonypi.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_sonypi_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_sonypi_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_sonypi_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/sonypi.h usability" >&5
+echo $ECHO_N "checking linux/sonypi.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <linux/sonypi.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking linux/sonypi.h presence" >&5
+echo $ECHO_N "checking linux/sonypi.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <linux/sonypi.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/sonypi.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/sonypi.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/sonypi.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/sonypi.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/sonypi.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/sonypi.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/sonypi.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/sonypi.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/sonypi.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for linux/sonypi.h" >&5
+echo $ECHO_N "checking for linux/sonypi.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_sonypi_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_linux_sonypi_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_sonypi_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_sonypi_h" >&6; }
+
+fi
+if test $ac_cv_header_linux_sonypi_h = yes; then
+  enable_sonypi_jogdial=yes
+else
+  enable_sonypi_jogdial=no
+    { echo "$as_me:$LINENO: WARNING: *** no linux/sonypi.h -- SonyPI Jogdial driver will not be built." >&5
+echo "$as_me: WARNING: *** no linux/sonypi.h -- SonyPI Jogdial driver will not be built." >&2;}
+fi
+
+
+fi
+
+enable_tslib=no
+if test "$checkfor_tslib" = "yes"; then
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for TSLIB" >&5
+echo $ECHO_N "checking for TSLIB... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$TSLIB_CFLAGS"; then
+        pkg_cv_TSLIB_CFLAGS="$TSLIB_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"tslib-0.0\"") >&5
+  ($PKG_CONFIG --exists --print-errors "tslib-0.0") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_TSLIB_CFLAGS=`$PKG_CONFIG --cflags "tslib-0.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$TSLIB_LIBS"; then
+        pkg_cv_TSLIB_LIBS="$TSLIB_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"tslib-0.0\"") >&5
+  ($PKG_CONFIG --exists --print-errors "tslib-0.0") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_TSLIB_LIBS=`$PKG_CONFIG --libs "tslib-0.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        TSLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "tslib-0.0"`
+        else
+	        TSLIB_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "tslib-0.0"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$TSLIB_PKG_ERRORS" >&5
+
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+                enable_tslib=no
+    { echo "$as_me:$LINENO: WARNING: *** no tslib -- tslib driver will not be built." >&5
+echo "$as_me: WARNING: *** no tslib -- tslib driver will not be built." >&2;}
+elif test $pkg_failed = untried; then
+	enable_tslib=no
+    { echo "$as_me:$LINENO: WARNING: *** no tslib -- tslib driver will not be built." >&5
+echo "$as_me: WARNING: *** no tslib -- tslib driver will not be built." >&2;}
+else
+	TSLIB_CFLAGS=$pkg_cv_TSLIB_CFLAGS
+	TSLIB_LIBS=$pkg_cv_TSLIB_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	enable_tslib=yes
+fi
+fi
+
+enable_ucb1x00_ts=no
+if test "$checkfor_ucb1x00" = "yes"; then
+    enable_ucb1x00_ts=yes
+fi
+
+enable_wm97xx_ts=no
+if test "$checkfor_wm97xx" = "yes"; then
+    enable_wm97xx_ts=yes
+fi
+
+ fi
+
+
+
+# Check whether --with-software was given.
+if test "${with_software+set}" = set; then
+  withval=$with_software;
+fi
+
+if test "$with_software" != "no"; then
+  with_software=yes
+fi
+
+ if test "$with_software" != "no"; then
+  SOFTWARE_RENDERING_TRUE=
+  SOFTWARE_RENDERING_FALSE='#'
+else
+  SOFTWARE_RENDERING_TRUE='#'
+  SOFTWARE_RENDERING_FALSE=
+fi
+
+
+
+
+# Check whether --with-smooth-scaling was given.
+if test "${with_smooth_scaling+set}" = set; then
+  withval=$with_smooth_scaling;
+fi
+
+if test "$with_smooth_scaling" != "yes" -o "$with_software" != "yes"; then
+  with_smooth_scaling=no
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_SMOOTH_SCALING 1
+_ACEOF
+
+fi
+
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_DITHER_SIMPLE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_DITHER_ADVANCED 2
+_ACEOF
+
+
+
+# Check whether --with-dither-rgb16 was given.
+if test "${with_dither_rgb16+set}" = set; then
+  withval=$with_dither_rgb16;
+fi
+
+
+case x"$with_dither_rgb16" in
+     x | xnone)
+          with_dither_rgb16=none
+          ;;
+     xsimple)
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_DITHER565 DFB_DITHER_SIMPLE
+_ACEOF
+
+          ;;
+     xadvanced)
+
+cat >>confdefs.h <<\_ACEOF
+#define DFB_DITHER565 DFB_DITHER_ADVANCED
+_ACEOF
+
+          ;;
+     *)
+          echo "Unknown dithering type $with_dither_rgb16, exiting!"
+          exit 1
+          ;;
+esac
+
+
+
+# Check whether --with-tests was given.
+if test "${with_tests+set}" = set; then
+  withval=$with_tests;
+fi
+
+if test "$with_tests" != "yes"; then
+  with_tests=no
+fi
+
+
+# How big of a buffer fusion uses to read messages from the fusion device
+
+# Check whether --with-message-size was given.
+if test "${with_message_size+set}" = set; then
+  withval=$with_message_size;
+else
+  with_message_size=no
+fi
+
+test x"$with_message_size" = x"no" && with_message_size=1024
+FUSION_MESSAGE_SIZE=$with_message_size
+
+
+
+# Build tools?
+
+# Check whether --with-tools was given.
+if test "${with_tools+set}" = set; then
+  withval=$with_tools;
+fi
+
+if test "$with_tools" != "no"; then
+  with_tools=yes
+fi
+
+
+# Sysroot used for runtime module loading, etc.
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then
+  withval=$with_sysroot;  RUNTIME_SYSROOT="$withval"
+else
+   RUNTIME_SYSROOT=
+fi
+
+test x"$RUNTIME_SYSROOT" = x"no" && RUNTIME_SYSROOT=
+
+
+
+
+if test "$enable_unique" = "yes"; then
+  if test "$cross_compiling" = "yes" || test "$with_tools" = "no"; then
+    # Extract the first word of "directfb-csource", so it can be a program name with args.
+set dummy directfb-csource; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_DIRECTFB_CSOURCE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $DIRECTFB_CSOURCE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DIRECTFB_CSOURCE="$DIRECTFB_CSOURCE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DIRECTFB_CSOURCE="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_DIRECTFB_CSOURCE" && ac_cv_path_DIRECTFB_CSOURCE="no"
+  ;;
+esac
+fi
+DIRECTFB_CSOURCE=$ac_cv_path_DIRECTFB_CSOURCE
+if test -n "$DIRECTFB_CSOURCE"; then
+  { echo "$as_me:$LINENO: result: $DIRECTFB_CSOURCE" >&5
+echo "${ECHO_T}$DIRECTFB_CSOURCE" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    if test "x$DIRECTFB_CSOURCE" = "xno"; then
+      { { echo "$as_me:$LINENO: error: Could not find a directfb-csource in your PATH" >&5
+echo "$as_me: error: Could not find a directfb-csource in your PATH" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+
+
+ if test "$ati128" = "yes"; then
+  GFX_ATI128_TRUE=
+  GFX_ATI128_FALSE='#'
+else
+  GFX_ATI128_TRUE='#'
+  GFX_ATI128_FALSE=
+fi
+
+ if test "$cle266" = "yes"; then
+  GFX_CLE266_TRUE=
+  GFX_CLE266_FALSE='#'
+else
+  GFX_CLE266_TRUE='#'
+  GFX_CLE266_FALSE=
+fi
+
+ if test "$cyber5k" = "yes"; then
+  GFX_CYBER5K_TRUE=
+  GFX_CYBER5K_FALSE='#'
+else
+  GFX_CYBER5K_TRUE='#'
+  GFX_CYBER5K_FALSE=
+fi
+
+ if test "$davinci" = "yes"; then
+  GFX_DAVINCI_TRUE=
+  GFX_DAVINCI_FALSE='#'
+else
+  GFX_DAVINCI_TRUE='#'
+  GFX_DAVINCI_FALSE=
+fi
+
+ if test "$ep9x" = "yes"; then
+  GFX_EP9X_TRUE=
+  GFX_EP9X_FALSE='#'
+else
+  GFX_EP9X_TRUE='#'
+  GFX_EP9X_FALSE=
+fi
+
+ if test "$gl" = "yes"; then
+  GFX_GL_TRUE=
+  GFX_GL_FALSE='#'
+else
+  GFX_GL_TRUE='#'
+  GFX_GL_FALSE=
+fi
+
+ if test "$glx" = "yes"; then
+  GFX_GLX_TRUE=
+  GFX_GLX_FALSE='#'
+else
+  GFX_GLX_TRUE='#'
+  GFX_GLX_FALSE=
+fi
+
+ if test "$i810" = "yes"; then
+  GFX_I810_TRUE=
+  GFX_I810_FALSE='#'
+else
+  GFX_I810_TRUE='#'
+  GFX_I810_FALSE=
+fi
+
+ if test "$i830" = "yes"; then
+  GFX_I830_TRUE=
+  GFX_I830_FALSE='#'
+else
+  GFX_I830_TRUE='#'
+  GFX_I830_FALSE=
+fi
+
+ if test "$mach64" = "yes"; then
+  GFX_MACH64_TRUE=
+  GFX_MACH64_FALSE='#'
+else
+  GFX_MACH64_TRUE='#'
+  GFX_MACH64_FALSE=
+fi
+
+ if test "$matrox" = "yes"; then
+  GFX_MATROX_TRUE=
+  GFX_MATROX_FALSE='#'
+else
+  GFX_MATROX_TRUE='#'
+  GFX_MATROX_FALSE=
+fi
+
+ if test "$neomagic" = "yes"; then
+  GFX_NEOMAGIC_TRUE=
+  GFX_NEOMAGIC_FALSE='#'
+else
+  GFX_NEOMAGIC_TRUE='#'
+  GFX_NEOMAGIC_FALSE=
+fi
+
+ if test "$nsc" = "yes"; then
+  GFX_NSC_TRUE=
+  GFX_NSC_FALSE='#'
+else
+  GFX_NSC_TRUE='#'
+  GFX_NSC_FALSE=
+fi
+
+ if test "$nvidia" = "yes"; then
+  GFX_NVIDIA_TRUE=
+  GFX_NVIDIA_FALSE='#'
+else
+  GFX_NVIDIA_TRUE='#'
+  GFX_NVIDIA_FALSE=
+fi
+
+ if test "$omap" = "yes"; then
+  GFX_OMAP_TRUE=
+  GFX_OMAP_FALSE='#'
+else
+  GFX_OMAP_TRUE='#'
+  GFX_OMAP_FALSE=
+fi
+
+ if test "$radeon" = "yes"; then
+  GFX_RADEON_TRUE=
+  GFX_RADEON_FALSE='#'
+else
+  GFX_RADEON_TRUE='#'
+  GFX_RADEON_FALSE=
+fi
+
+ if test "$savage" = "yes"; then
+  GFX_SAVAGE_TRUE=
+  GFX_SAVAGE_FALSE='#'
+else
+  GFX_SAVAGE_TRUE='#'
+  GFX_SAVAGE_FALSE=
+fi
+
+ if test "$sh772x" = "yes"; then
+  GFX_SH772X_TRUE=
+  GFX_SH772X_FALSE='#'
+else
+  GFX_SH772X_TRUE='#'
+  GFX_SH772X_FALSE=
+fi
+
+ if test "$sis315" = "yes"; then
+  GFX_SIS315_TRUE=
+  GFX_SIS315_FALSE='#'
+else
+  GFX_SIS315_TRUE='#'
+  GFX_SIS315_FALSE=
+fi
+
+ if test "$tdfx" = "yes"; then
+  GFX_TDFX_TRUE=
+  GFX_TDFX_FALSE='#'
+else
+  GFX_TDFX_TRUE='#'
+  GFX_TDFX_FALSE=
+fi
+
+ if test "$unichrome" = "yes"; then
+  GFX_UNICHROME_TRUE=
+  GFX_UNICHROME_FALSE='#'
+else
+  GFX_UNICHROME_TRUE='#'
+  GFX_UNICHROME_FALSE=
+fi
+
+ if test "$vmware" = "yes"; then
+  GFX_VMWARE_TRUE=
+  GFX_VMWARE_FALSE='#'
+else
+  GFX_VMWARE_TRUE='#'
+  GFX_VMWARE_FALSE=
+fi
+
+
+ if test "$enable_dbox2remote" = "yes"; then
+  DBOX2REMOTE_TRUE=
+  DBOX2REMOTE_FALSE='#'
+else
+  DBOX2REMOTE_TRUE='#'
+  DBOX2REMOTE_FALSE=
+fi
+
+ if test "$enable_dreamboxremote" = "yes"; then
+  DREAMBOXREMOTE_TRUE=
+  DREAMBOXREMOTE_FALSE='#'
+else
+  DREAMBOXREMOTE_TRUE='#'
+  DREAMBOXREMOTE_FALSE=
+fi
+
+ if test "$enable_dynapro_ts" = "yes"; then
+  DYNAPRO_INPUT_TRUE=
+  DYNAPRO_INPUT_FALSE='#'
+else
+  DYNAPRO_INPUT_TRUE='#'
+  DYNAPRO_INPUT_FALSE=
+fi
+
+ if test "$enable_elo_input" = "yes"; then
+  ELO_INPUT_TRUE=
+  ELO_INPUT_FALSE='#'
+else
+  ELO_INPUT_TRUE='#'
+  ELO_INPUT_FALSE=
+fi
+
+ if test "$enable_gunze_input" = "yes"; then
+  GUNZE_INPUT_TRUE=
+  GUNZE_INPUT_FALSE='#'
+else
+  GUNZE_INPUT_TRUE='#'
+  GUNZE_INPUT_FALSE=
+fi
+
+ if test "$enable_h3600_ts" = "yes"; then
+  H3600_TS_TRUE=
+  H3600_TS_FALSE='#'
+else
+  H3600_TS_TRUE='#'
+  H3600_TS_FALSE=
+fi
+
+ if test "$enable_joystick" = "yes"; then
+  JOYSTICK_INPUT_TRUE=
+  JOYSTICK_INPUT_FALSE='#'
+else
+  JOYSTICK_INPUT_TRUE='#'
+  JOYSTICK_INPUT_FALSE=
+fi
+
+ if test "$enable_keyboard" = "yes"; then
+  KEYBOARD_INPUT_TRUE=
+  KEYBOARD_INPUT_FALSE='#'
+else
+  KEYBOARD_INPUT_TRUE='#'
+  KEYBOARD_INPUT_FALSE=
+fi
+
+ if test "$enable_linux_input" = "yes"; then
+  LINUX_INPUT_TRUE=
+  LINUX_INPUT_FALSE='#'
+else
+  LINUX_INPUT_TRUE='#'
+  LINUX_INPUT_FALSE=
+fi
+
+ if test "$enable_lirc" = "yes"; then
+  LIRC_INPUT_TRUE=
+  LIRC_INPUT_FALSE='#'
+else
+  LIRC_INPUT_TRUE='#'
+  LIRC_INPUT_FALSE=
+fi
+
+ if test "$enable_mutouch" = "yes"; then
+  MUTOUCH_TS_TRUE=
+  MUTOUCH_TS_FALSE='#'
+else
+  MUTOUCH_TS_TRUE='#'
+  MUTOUCH_TS_FALSE=
+fi
+
+ if test "$enable_zytronic" = "yes"; then
+  ZYTRONIC_TS_TRUE=
+  ZYTRONIC_TS_FALSE='#'
+else
+  ZYTRONIC_TS_TRUE='#'
+  ZYTRONIC_TS_FALSE=
+fi
+
+ if test "$enable_penmount" = "yes" ; then
+  PENMOUNT_TS_TRUE=
+  PENMOUNT_TS_FALSE='#'
+else
+  PENMOUNT_TS_TRUE='#'
+  PENMOUNT_TS_FALSE=
+fi
+
+ if test "$enable_ps2mouse" = "yes"; then
+  PS2MOUSE_INPUT_TRUE=
+  PS2MOUSE_INPUT_FALSE='#'
+else
+  PS2MOUSE_INPUT_TRUE='#'
+  PS2MOUSE_INPUT_FALSE=
+fi
+
+ if test "$enable_serial_mouse" = "yes"; then
+  SERIAL_MOUSE_INPUT_TRUE=
+  SERIAL_MOUSE_INPUT_FALSE='#'
+else
+  SERIAL_MOUSE_INPUT_TRUE='#'
+  SERIAL_MOUSE_INPUT_FALSE=
+fi
+
+ if test "$enable_sonypi_jogdial" = "yes"; then
+  SONYPI_TRUE=
+  SONYPI_FALSE='#'
+else
+  SONYPI_TRUE='#'
+  SONYPI_FALSE=
+fi
+
+ if test "$enable_tslib" = "yes"; then
+  TSLIB_TRUE=
+  TSLIB_FALSE='#'
+else
+  TSLIB_TRUE='#'
+  TSLIB_FALSE=
+fi
+
+ if test "$enable_ucb1x00_ts" = "yes"; then
+  UCB1X00_TS_TRUE=
+  UCB1X00_TS_FALSE='#'
+else
+  UCB1X00_TS_TRUE='#'
+  UCB1X00_TS_FALSE=
+fi
+
+ if test "$enable_wm97xx_ts" = "yes"; then
+  WM97XX_TS_TRUE=
+  WM97XX_TS_FALSE='#'
+else
+  WM97XX_TS_TRUE='#'
+  WM97XX_TS_FALSE=
+fi
+
+
+ if test "$with_tests" = "yes"; then
+  BUILD_TESTS_TRUE=
+  BUILD_TESTS_FALSE='#'
+else
+  BUILD_TESTS_TRUE='#'
+  BUILD_TESTS_FALSE=
+fi
+
+ if test "$with_tools" = "yes"; then
+  BUILD_TOOLS_TRUE=
+  BUILD_TOOLS_FALSE='#'
+else
+  BUILD_TOOLS_TRUE='#'
+  BUILD_TOOLS_FALSE=
+fi
+
+ if test "$cross_compiling" = "yes"; then
+  CROSS_COMPILING_TRUE=
+  CROSS_COMPILING_FALSE='#'
+else
+  CROSS_COMPILING_TRUE='#'
+  CROSS_COMPILING_FALSE=
+fi
+
+
+CFLAGS="$CFLAGS $DFB_INTERNAL_CFLAGS"
+DFB_LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+
+
+
+# Honor aclocal flags
+ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+
+ if test "$enable_shared" = "yes"; then
+  BUILD_SHARED_TRUE=
+  BUILD_SHARED_FALSE='#'
+else
+  BUILD_SHARED_TRUE='#'
+  BUILD_SHARED_FALSE=
+fi
+
+ if test "$enable_static" = "yes"; then
+  BUILD_STATIC_TRUE=
+  BUILD_STATIC_FALSE='#'
+else
+  BUILD_STATIC_TRUE='#'
+  BUILD_STATIC_FALSE=
+fi
+
+
+
+# Change the module directory only for builds that don't *support* debug
+if test "$enable_debug_support" = "no"; then
+  MODULEDIRNAME=directfb-$BINARY_VERSION-pure
+else
+  MODULEDIRNAME=directfb-$BINARY_VERSION
+fi
+
+MODULEDIR=$libdir/$MODULEDIRNAME
+DATADIR=$datadir/directfb-$VERSION
+INCLUDEDIR=$includedir/directfb
+INTERNALINCLUDEDIR=$includedir/directfb-internal
+
+SOPATH=$libdir/libdirectfb-$LT_RELEASE.so.$LT_CURRENT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  EXP_VAR=SYSCONFDIR
+  FROM_VAR=$sysconfdir
+
+    prefix_save=$prefix
+  exec_prefix_save=$exec_prefix
+
+    if test "x$prefix" = "xNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+    if test "x$exec_prefix" = "xNONE"; then
+    exec_prefix=$prefix
+  fi
+
+  full_var="$FROM_VAR"
+    while true; do
+    new_full_var="`eval echo $full_var`"
+    if test "x$new_full_var" = "x$full_var"; then break; fi
+    full_var=$new_full_var
+  done
+
+    full_var=$new_full_var
+  SYSCONFDIR="$full_var"
+
+
+    prefix=$prefix_save
+  exec_prefix=$exec_prefix_save
+
+
+CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+
+
+ac_config_files="$ac_config_files directfb-config directfb.pc directfb-internal.pc directfb.spec Makefile include/Makefile include/directfb_version.h lib/Makefile lib/direct/Makefile lib/direct/build.h lib/direct/direct.pc lib/fusion/Makefile lib/fusion/build.h lib/fusion/fusion.pc lib/fusion/shm/Makefile lib/voodoo/Makefile lib/voodoo/build.h lib/voodoo/voodoo.pc patches/Makefile proxy/Makefile proxy/dispatcher/Makefile proxy/requestor/Makefile rules/Makefile src/Makefile src/core/Makefile src/display/Makefile src/gfx/Makefile src/gfx/generic/Makefile src/input/Makefile src/media/Makefile src/misc/Makefile src/windows/Makefile systems/Makefile systems/devmem/Makefile systems/fbdev/Makefile systems/x11/Makefile systems/osx/Makefile systems/sdl/Makefile systems/vnc/Makefile wm/Makefile wm/default/Makefile wm/unique/Makefile wm/unique/classes/Makefile wm/unique/data/Makefile wm/unique/devices/Makefile gfxdrivers/Makefile gfxdrivers/ati128/Makefile gfxdrivers/cle266/Makefile gfxdrivers/cyber5k/Makefile gfxdrivers/davinci/Makefile gfxdrivers/ep9x/Makefile gfxdrivers/gl/Makefile gfxdrivers/i810/Makefile gfxdrivers/i830/Makefile gfxdrivers/mach64/Makefile gfxdrivers/matrox/Makefile gfxdrivers/neomagic/Makefile gfxdrivers/nsc/Makefile gfxdrivers/nsc/include/Makefile gfxdrivers/nvidia/Makefile gfxdrivers/omap/Makefile gfxdrivers/radeon/Makefile gfxdrivers/savage/Makefile gfxdrivers/sh772x/Makefile gfxdrivers/sis315/Makefile gfxdrivers/tdfx/Makefile gfxdrivers/unichrome/Makefile gfxdrivers/vmware/Makefile inputdrivers/Makefile inputdrivers/dbox2remote/Makefile inputdrivers/dreamboxremote/Makefile inputdrivers/dynapro/Makefile inputdrivers/elo/Makefile inputdrivers/gunze/Makefile inputdrivers/h3600_ts/Makefile inputdrivers/joystick/Makefile inputdrivers/keyboard/Makefile inputdrivers/linux_input/Makefile inputdrivers/lirc/Makefile inputdrivers/mutouch/Makefile inputdrivers/zytronic/Makefile inputdrivers/penmount/Makefile inputdrivers/ps2mouse/Makefile inputdrivers/serialmouse/Makefile inputdrivers/sonypi/Makefile inputdrivers/tslib/Makefile inputdrivers/ucb1x00_ts/Makefile inputdrivers/wm97xx_ts/Makefile interfaces/Makefile interfaces/IDirectFBFont/Makefile interfaces/IDirectFBImageProvider/Makefile interfaces/IDirectFBVideoProvider/Makefile data/Makefile tests/Makefile tools/Makefile docs/Makefile docs/dfbg.1 docs/directfb-csource.1 docs/directfbrc.5 docs/html/Makefile"
+
+ac_config_commands="$ac_config_commands default"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_MAN2HTML_TRUE}" && test -z "${HAVE_MAN2HTML_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_MAN2HTML\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_MAN2HTML\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${OSX_CORE_TRUE}" && test -z "${OSX_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"OSX_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"OSX_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${X11_CORE_TRUE}" && test -z "${X11_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"X11_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"X11_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_LINUX_TRUE}" && test -z "${HAVE_LINUX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_LINUX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_LINUX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILDPPCASM_TRUE}" && test -z "${BUILDPPCASM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILDPPCASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILDPPCASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILDARMASM_TRUE}" && test -z "${BUILDARMASM_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILDARMASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILDARMASM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_DEBUG_TRUE}" && test -z "${ENABLE_DEBUG_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_DEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_DEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_DEBUGS_TRUE}" && test -z "${ENABLE_DEBUGS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_DEBUGS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_DEBUGS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_TRACE_TRUE}" && test -z "${ENABLE_TRACE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_TRACE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_TRACE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_MULTI_TRUE}" && test -z "${ENABLE_MULTI_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MULTI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_MULTI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_VOODOO_TRUE}" && test -z "${ENABLE_VOODOO_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_VOODOO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_VOODOO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_UNIQUE_TRUE}" && test -z "${ENABLE_UNIQUE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_UNIQUE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_UNIQUE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILDMMX_TRUE}" && test -z "${BUILDMMX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILDMMX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILDMMX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${DEVMEM_CORE_TRUE}" && test -z "${DEVMEM_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"DEVMEM_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DEVMEM_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${FBDEV_CORE_TRUE}" && test -z "${FBDEV_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"FBDEV_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"FBDEV_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${SDL_CORE_TRUE}" && test -z "${SDL_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"SDL_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SDL_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${VNC_CORE_TRUE}" && test -z "${VNC_CORE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"VNC_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"VNC_CORE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${JPEG_PROVIDER_TRUE}" && test -z "${JPEG_PROVIDER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"JPEG_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"JPEG_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${PNG_PROVIDER_TRUE}" && test -z "${PNG_PROVIDER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"PNG_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"PNG_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_DIRECTFB_CSOURCE_TRUE}" && test -z "${BUILD_DIRECTFB_CSOURCE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_DIRECTFB_CSOURCE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_DIRECTFB_CSOURCE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GIF_PROVIDER_TRUE}" && test -z "${GIF_PROVIDER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GIF_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GIF_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${FREETYPE_PROVIDER_TRUE}" && test -z "${FREETYPE_PROVIDER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"FREETYPE_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"FREETYPE_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${V4L_PROVIDER_TRUE}" && test -z "${V4L_PROVIDER_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"V4L_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"V4L_PROVIDER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${SOFTWARE_RENDERING_TRUE}" && test -z "${SOFTWARE_RENDERING_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"SOFTWARE_RENDERING\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SOFTWARE_RENDERING\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_ATI128_TRUE}" && test -z "${GFX_ATI128_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_ATI128\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_ATI128\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_CLE266_TRUE}" && test -z "${GFX_CLE266_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_CLE266\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_CLE266\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_CYBER5K_TRUE}" && test -z "${GFX_CYBER5K_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_CYBER5K\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_CYBER5K\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_DAVINCI_TRUE}" && test -z "${GFX_DAVINCI_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_DAVINCI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_DAVINCI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_EP9X_TRUE}" && test -z "${GFX_EP9X_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_EP9X\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_EP9X\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_GL_TRUE}" && test -z "${GFX_GL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_GL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_GL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_GLX_TRUE}" && test -z "${GFX_GLX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_GLX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_GLX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_I810_TRUE}" && test -z "${GFX_I810_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_I810\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_I810\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_I830_TRUE}" && test -z "${GFX_I830_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_I830\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_I830\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_MACH64_TRUE}" && test -z "${GFX_MACH64_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_MACH64\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_MACH64\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_MATROX_TRUE}" && test -z "${GFX_MATROX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_MATROX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_MATROX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_NEOMAGIC_TRUE}" && test -z "${GFX_NEOMAGIC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_NEOMAGIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_NEOMAGIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_NSC_TRUE}" && test -z "${GFX_NSC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_NSC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_NSC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_NVIDIA_TRUE}" && test -z "${GFX_NVIDIA_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_NVIDIA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_NVIDIA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_OMAP_TRUE}" && test -z "${GFX_OMAP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_OMAP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_OMAP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_RADEON_TRUE}" && test -z "${GFX_RADEON_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_RADEON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_RADEON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_SAVAGE_TRUE}" && test -z "${GFX_SAVAGE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_SAVAGE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_SAVAGE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_SH772X_TRUE}" && test -z "${GFX_SH772X_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_SH772X\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_SH772X\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_SIS315_TRUE}" && test -z "${GFX_SIS315_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_SIS315\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_SIS315\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_TDFX_TRUE}" && test -z "${GFX_TDFX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_TDFX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_TDFX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_UNICHROME_TRUE}" && test -z "${GFX_UNICHROME_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_UNICHROME\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_UNICHROME\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GFX_VMWARE_TRUE}" && test -z "${GFX_VMWARE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GFX_VMWARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GFX_VMWARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${DBOX2REMOTE_TRUE}" && test -z "${DBOX2REMOTE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"DBOX2REMOTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DBOX2REMOTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${DREAMBOXREMOTE_TRUE}" && test -z "${DREAMBOXREMOTE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"DREAMBOXREMOTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DREAMBOXREMOTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${DYNAPRO_INPUT_TRUE}" && test -z "${DYNAPRO_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"DYNAPRO_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DYNAPRO_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ELO_INPUT_TRUE}" && test -z "${ELO_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ELO_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ELO_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${GUNZE_INPUT_TRUE}" && test -z "${GUNZE_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"GUNZE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GUNZE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${H3600_TS_TRUE}" && test -z "${H3600_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"H3600_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"H3600_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${JOYSTICK_INPUT_TRUE}" && test -z "${JOYSTICK_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"JOYSTICK_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"JOYSTICK_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${KEYBOARD_INPUT_TRUE}" && test -z "${KEYBOARD_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"KEYBOARD_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"KEYBOARD_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${LINUX_INPUT_TRUE}" && test -z "${LINUX_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"LINUX_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"LINUX_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${LIRC_INPUT_TRUE}" && test -z "${LIRC_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"LIRC_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"LIRC_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${MUTOUCH_TS_TRUE}" && test -z "${MUTOUCH_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"MUTOUCH_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MUTOUCH_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ZYTRONIC_TS_TRUE}" && test -z "${ZYTRONIC_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ZYTRONIC_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ZYTRONIC_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${PENMOUNT_TS_TRUE}" && test -z "${PENMOUNT_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"PENMOUNT_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"PENMOUNT_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${PS2MOUSE_INPUT_TRUE}" && test -z "${PS2MOUSE_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"PS2MOUSE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"PS2MOUSE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${SERIAL_MOUSE_INPUT_TRUE}" && test -z "${SERIAL_MOUSE_INPUT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"SERIAL_MOUSE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SERIAL_MOUSE_INPUT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${SONYPI_TRUE}" && test -z "${SONYPI_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"SONYPI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SONYPI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${TSLIB_TRUE}" && test -z "${TSLIB_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"TSLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"TSLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${UCB1X00_TS_TRUE}" && test -z "${UCB1X00_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"UCB1X00_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"UCB1X00_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${WM97XX_TS_TRUE}" && test -z "${WM97XX_TS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"WM97XX_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WM97XX_TS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_TESTS_TRUE}" && test -z "${BUILD_TESTS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_TOOLS_TRUE}" && test -z "${BUILD_TOOLS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_TOOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_TOOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${CROSS_COMPILING_TRUE}" && test -z "${CROSS_COMPILING_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"CROSS_COMPILING\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CROSS_COMPILING\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_SHARED_TRUE}" && test -z "${BUILD_SHARED_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_SHARED\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_SHARED\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_STATIC_TRUE}" && test -z "${BUILD_STATIC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_STATIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_STATIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "directfb-config") CONFIG_FILES="$CONFIG_FILES directfb-config" ;;
+    "directfb.pc") CONFIG_FILES="$CONFIG_FILES directfb.pc" ;;
+    "directfb-internal.pc") CONFIG_FILES="$CONFIG_FILES directfb-internal.pc" ;;
+    "directfb.spec") CONFIG_FILES="$CONFIG_FILES directfb.spec" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+    "include/directfb_version.h") CONFIG_FILES="$CONFIG_FILES include/directfb_version.h" ;;
+    "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
+    "lib/direct/Makefile") CONFIG_FILES="$CONFIG_FILES lib/direct/Makefile" ;;
+    "lib/direct/build.h") CONFIG_FILES="$CONFIG_FILES lib/direct/build.h" ;;
+    "lib/direct/direct.pc") CONFIG_FILES="$CONFIG_FILES lib/direct/direct.pc" ;;
+    "lib/fusion/Makefile") CONFIG_FILES="$CONFIG_FILES lib/fusion/Makefile" ;;
+    "lib/fusion/build.h") CONFIG_FILES="$CONFIG_FILES lib/fusion/build.h" ;;
+    "lib/fusion/fusion.pc") CONFIG_FILES="$CONFIG_FILES lib/fusion/fusion.pc" ;;
+    "lib/fusion/shm/Makefile") CONFIG_FILES="$CONFIG_FILES lib/fusion/shm/Makefile" ;;
+    "lib/voodoo/Makefile") CONFIG_FILES="$CONFIG_FILES lib/voodoo/Makefile" ;;
+    "lib/voodoo/build.h") CONFIG_FILES="$CONFIG_FILES lib/voodoo/build.h" ;;
+    "lib/voodoo/voodoo.pc") CONFIG_FILES="$CONFIG_FILES lib/voodoo/voodoo.pc" ;;
+    "patches/Makefile") CONFIG_FILES="$CONFIG_FILES patches/Makefile" ;;
+    "proxy/Makefile") CONFIG_FILES="$CONFIG_FILES proxy/Makefile" ;;
+    "proxy/dispatcher/Makefile") CONFIG_FILES="$CONFIG_FILES proxy/dispatcher/Makefile" ;;
+    "proxy/requestor/Makefile") CONFIG_FILES="$CONFIG_FILES proxy/requestor/Makefile" ;;
+    "rules/Makefile") CONFIG_FILES="$CONFIG_FILES rules/Makefile" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "src/core/Makefile") CONFIG_FILES="$CONFIG_FILES src/core/Makefile" ;;
+    "src/display/Makefile") CONFIG_FILES="$CONFIG_FILES src/display/Makefile" ;;
+    "src/gfx/Makefile") CONFIG_FILES="$CONFIG_FILES src/gfx/Makefile" ;;
+    "src/gfx/generic/Makefile") CONFIG_FILES="$CONFIG_FILES src/gfx/generic/Makefile" ;;
+    "src/input/Makefile") CONFIG_FILES="$CONFIG_FILES src/input/Makefile" ;;
+    "src/media/Makefile") CONFIG_FILES="$CONFIG_FILES src/media/Makefile" ;;
+    "src/misc/Makefile") CONFIG_FILES="$CONFIG_FILES src/misc/Makefile" ;;
+    "src/windows/Makefile") CONFIG_FILES="$CONFIG_FILES src/windows/Makefile" ;;
+    "systems/Makefile") CONFIG_FILES="$CONFIG_FILES systems/Makefile" ;;
+    "systems/devmem/Makefile") CONFIG_FILES="$CONFIG_FILES systems/devmem/Makefile" ;;
+    "systems/fbdev/Makefile") CONFIG_FILES="$CONFIG_FILES systems/fbdev/Makefile" ;;
+    "systems/x11/Makefile") CONFIG_FILES="$CONFIG_FILES systems/x11/Makefile" ;;
+    "systems/osx/Makefile") CONFIG_FILES="$CONFIG_FILES systems/osx/Makefile" ;;
+    "systems/sdl/Makefile") CONFIG_FILES="$CONFIG_FILES systems/sdl/Makefile" ;;
+    "systems/vnc/Makefile") CONFIG_FILES="$CONFIG_FILES systems/vnc/Makefile" ;;
+    "wm/Makefile") CONFIG_FILES="$CONFIG_FILES wm/Makefile" ;;
+    "wm/default/Makefile") CONFIG_FILES="$CONFIG_FILES wm/default/Makefile" ;;
+    "wm/unique/Makefile") CONFIG_FILES="$CONFIG_FILES wm/unique/Makefile" ;;
+    "wm/unique/classes/Makefile") CONFIG_FILES="$CONFIG_FILES wm/unique/classes/Makefile" ;;
+    "wm/unique/data/Makefile") CONFIG_FILES="$CONFIG_FILES wm/unique/data/Makefile" ;;
+    "wm/unique/devices/Makefile") CONFIG_FILES="$CONFIG_FILES wm/unique/devices/Makefile" ;;
+    "gfxdrivers/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/Makefile" ;;
+    "gfxdrivers/ati128/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/ati128/Makefile" ;;
+    "gfxdrivers/cle266/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/cle266/Makefile" ;;
+    "gfxdrivers/cyber5k/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/cyber5k/Makefile" ;;
+    "gfxdrivers/davinci/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/davinci/Makefile" ;;
+    "gfxdrivers/ep9x/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/ep9x/Makefile" ;;
+    "gfxdrivers/gl/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/gl/Makefile" ;;
+    "gfxdrivers/i810/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/i810/Makefile" ;;
+    "gfxdrivers/i830/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/i830/Makefile" ;;
+    "gfxdrivers/mach64/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/mach64/Makefile" ;;
+    "gfxdrivers/matrox/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/matrox/Makefile" ;;
+    "gfxdrivers/neomagic/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/neomagic/Makefile" ;;
+    "gfxdrivers/nsc/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/nsc/Makefile" ;;
+    "gfxdrivers/nsc/include/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/nsc/include/Makefile" ;;
+    "gfxdrivers/nvidia/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/nvidia/Makefile" ;;
+    "gfxdrivers/omap/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/omap/Makefile" ;;
+    "gfxdrivers/radeon/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/radeon/Makefile" ;;
+    "gfxdrivers/savage/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/savage/Makefile" ;;
+    "gfxdrivers/sh772x/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/sh772x/Makefile" ;;
+    "gfxdrivers/sis315/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/sis315/Makefile" ;;
+    "gfxdrivers/tdfx/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/tdfx/Makefile" ;;
+    "gfxdrivers/unichrome/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/unichrome/Makefile" ;;
+    "gfxdrivers/vmware/Makefile") CONFIG_FILES="$CONFIG_FILES gfxdrivers/vmware/Makefile" ;;
+    "inputdrivers/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/Makefile" ;;
+    "inputdrivers/dbox2remote/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/dbox2remote/Makefile" ;;
+    "inputdrivers/dreamboxremote/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/dreamboxremote/Makefile" ;;
+    "inputdrivers/dynapro/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/dynapro/Makefile" ;;
+    "inputdrivers/elo/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/elo/Makefile" ;;
+    "inputdrivers/gunze/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/gunze/Makefile" ;;
+    "inputdrivers/h3600_ts/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/h3600_ts/Makefile" ;;
+    "inputdrivers/joystick/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/joystick/Makefile" ;;
+    "inputdrivers/keyboard/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/keyboard/Makefile" ;;
+    "inputdrivers/linux_input/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/linux_input/Makefile" ;;
+    "inputdrivers/lirc/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/lirc/Makefile" ;;
+    "inputdrivers/mutouch/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/mutouch/Makefile" ;;
+    "inputdrivers/zytronic/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/zytronic/Makefile" ;;
+    "inputdrivers/penmount/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/penmount/Makefile" ;;
+    "inputdrivers/ps2mouse/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/ps2mouse/Makefile" ;;
+    "inputdrivers/serialmouse/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/serialmouse/Makefile" ;;
+    "inputdrivers/sonypi/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/sonypi/Makefile" ;;
+    "inputdrivers/tslib/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/tslib/Makefile" ;;
+    "inputdrivers/ucb1x00_ts/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/ucb1x00_ts/Makefile" ;;
+    "inputdrivers/wm97xx_ts/Makefile") CONFIG_FILES="$CONFIG_FILES inputdrivers/wm97xx_ts/Makefile" ;;
+    "interfaces/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/Makefile" ;;
+    "interfaces/IDirectFBFont/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/IDirectFBFont/Makefile" ;;
+    "interfaces/IDirectFBImageProvider/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/IDirectFBImageProvider/Makefile" ;;
+    "interfaces/IDirectFBVideoProvider/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/IDirectFBVideoProvider/Makefile" ;;
+    "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;;
+    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+    "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
+    "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;;
+    "docs/dfbg.1") CONFIG_FILES="$CONFIG_FILES docs/dfbg.1" ;;
+    "docs/directfb-csource.1") CONFIG_FILES="$CONFIG_FILES docs/directfb-csource.1" ;;
+    "docs/directfbrc.5") CONFIG_FILES="$CONFIG_FILES docs/directfbrc.5" ;;
+    "docs/html/Makefile") CONFIG_FILES="$CONFIG_FILES docs/html/Makefile" ;;
+    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+DIRECTFB_MAJOR_VERSION!$DIRECTFB_MAJOR_VERSION$ac_delim
+DIRECTFB_MINOR_VERSION!$DIRECTFB_MINOR_VERSION$ac_delim
+DIRECTFB_MICRO_VERSION!$DIRECTFB_MICRO_VERSION$ac_delim
+DIRECTFB_INTERFACE_AGE!$DIRECTFB_INTERFACE_AGE$ac_delim
+DIRECTFB_BINARY_AGE!$DIRECTFB_BINARY_AGE$ac_delim
+DIRECTFB_VERSION!$DIRECTFB_VERSION$ac_delim
+LT_RELEASE!$LT_RELEASE$ac_delim
+LT_CURRENT!$LT_CURRENT$ac_delim
+LT_BINARY!$LT_BINARY$ac_delim
+LT_REVISION!$LT_REVISION$ac_delim
+LT_AGE!$LT_AGE$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+target!$target$ac_delim
+target_cpu!$target_cpu$ac_delim
+target_vendor!$target_vendor$ac_delim
+target_os!$target_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+PKG_CONFIG!$PKG_CONFIG$ac_delim
+MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
+MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
+MAINT!$MAINT$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CCAS!$CCAS$ac_delim
+CCASFLAGS!$CCASFLAGS$ac_delim
+CCASDEPMODE!$CCASDEPMODE$ac_delim
+am__fastdepCCAS_TRUE!$am__fastdepCCAS_TRUE$ac_delim
+am__fastdepCCAS_FALSE!$am__fastdepCCAS_FALSE$ac_delim
+SED!$SED$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+DSYMUTIL!$DSYMUTIL$ac_delim
+NMEDIT!$NMEDIT$ac_delim
+CPP!$CPP$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+LD!$LD$ac_delim
+PERL!$PERL$ac_delim
+MAN2HTML!$MAN2HTML$ac_delim
+HAVE_MAN2HTML_TRUE!$HAVE_MAN2HTML_TRUE$ac_delim
+HAVE_MAN2HTML_FALSE!$HAVE_MAN2HTML_FALSE$ac_delim
+OSX_CORE_TRUE!$OSX_CORE_TRUE$ac_delim
+OSX_CORE_FALSE!$OSX_CORE_FALSE$ac_delim
+X11_CORE_TRUE!$X11_CORE_TRUE$ac_delim
+X11_CORE_FALSE!$X11_CORE_FALSE$ac_delim
+HAVE_LINUX_TRUE!$HAVE_LINUX_TRUE$ac_delim
+HAVE_LINUX_FALSE!$HAVE_LINUX_FALSE$ac_delim
+BUILDPPCASM_TRUE!$BUILDPPCASM_TRUE$ac_delim
+BUILDPPCASM_FALSE!$BUILDPPCASM_FALSE$ac_delim
+BUILDARMASM_TRUE!$BUILDARMASM_TRUE$ac_delim
+BUILDARMASM_FALSE!$BUILDARMASM_FALSE$ac_delim
+THREADFLAGS!$THREADFLAGS$ac_delim
+THREADLIB!$THREADLIB$ac_delim
+DYNLIB!$DYNLIB$ac_delim
+AS!$AS$ac_delim
+ASFLAGS!$ASFLAGS$ac_delim
+ENABLE_DEBUG_TRUE!$ENABLE_DEBUG_TRUE$ac_delim
+ENABLE_DEBUG_FALSE!$ENABLE_DEBUG_FALSE$ac_delim
+DIRECT_BUILD_DEBUG!$DIRECT_BUILD_DEBUG$ac_delim
+ENABLE_DEBUGS_TRUE!$ENABLE_DEBUGS_TRUE$ac_delim
+ENABLE_DEBUGS_FALSE!$ENABLE_DEBUGS_FALSE$ac_delim
+DIRECT_BUILD_DEBUGS!$DIRECT_BUILD_DEBUGS$ac_delim
+ENABLE_TRACE_TRUE!$ENABLE_TRACE_TRUE$ac_delim
+ENABLE_TRACE_FALSE!$ENABLE_TRACE_FALSE$ac_delim
+DIRECT_BUILD_TRACE!$DIRECT_BUILD_TRACE$ac_delim
+DIRECT_BUILD_TEXT!$DIRECT_BUILD_TEXT$ac_delim
+DIRECT_BUILD_GETTID!$DIRECT_BUILD_GETTID$ac_delim
+DIRECT_BUILD_NETWORK!$DIRECT_BUILD_NETWORK$ac_delim
+DIRECT_BUILD_STDBOOL!$DIRECT_BUILD_STDBOOL$ac_delim
+ENABLE_MULTI_TRUE!$ENABLE_MULTI_TRUE$ac_delim
+ENABLE_MULTI_FALSE!$ENABLE_MULTI_FALSE$ac_delim
+FUSION_BUILD_MULTI!$FUSION_BUILD_MULTI$ac_delim
+FUSION_BUILD_KERNEL!$FUSION_BUILD_KERNEL$ac_delim
+ENABLE_VOODOO_TRUE!$ENABLE_VOODOO_TRUE$ac_delim
+ENABLE_VOODOO_FALSE!$ENABLE_VOODOO_FALSE$ac_delim
+ENABLE_UNIQUE_TRUE!$ENABLE_UNIQUE_TRUE$ac_delim
+ENABLE_UNIQUE_FALSE!$ENABLE_UNIQUE_FALSE$ac_delim
+BUILDMMX_TRUE!$BUILDMMX_TRUE$ac_delim
+BUILDMMX_FALSE!$BUILDMMX_FALSE$ac_delim
+DEVMEM_CORE_TRUE!$DEVMEM_CORE_TRUE$ac_delim
+DEVMEM_CORE_FALSE!$DEVMEM_CORE_FALSE$ac_delim
+FBDEV_CORE_TRUE!$FBDEV_CORE_TRUE$ac_delim
+FBDEV_CORE_FALSE!$FBDEV_CORE_FALSE$ac_delim
+SDL_CFLAGS!$SDL_CFLAGS$ac_delim
+SDL_LIBS!$SDL_LIBS$ac_delim
+OSX_LIBS!$OSX_LIBS$ac_delim
+SDL_CORE_TRUE!$SDL_CORE_TRUE$ac_delim
+SDL_CORE_FALSE!$SDL_CORE_FALSE$ac_delim
+VNC_CONFIG!$VNC_CONFIG$ac_delim
+VNC_CORE_TRUE!$VNC_CORE_TRUE$ac_delim
+VNC_CORE_FALSE!$VNC_CORE_FALSE$ac_delim
+VNC_LIBS!$VNC_LIBS$ac_delim
+VNC_CFLAGS!$VNC_CFLAGS$ac_delim
+SYSFS_LIBS!$SYSFS_LIBS$ac_delim
+JPEG_PROVIDER_TRUE!$JPEG_PROVIDER_TRUE$ac_delim
+JPEG_PROVIDER_FALSE!$JPEG_PROVIDER_FALSE$ac_delim
+ZLIB_LIBS!$ZLIB_LIBS$ac_delim
+LIBPNG_CONFIG!$LIBPNG_CONFIG$ac_delim
+PNG_PROVIDER_TRUE!$PNG_PROVIDER_TRUE$ac_delim
+PNG_PROVIDER_FALSE!$PNG_PROVIDER_FALSE$ac_delim
+BUILD_DIRECTFB_CSOURCE_TRUE!$BUILD_DIRECTFB_CSOURCE_TRUE$ac_delim
+BUILD_DIRECTFB_CSOURCE_FALSE!$BUILD_DIRECTFB_CSOURCE_FALSE$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+GIF_PROVIDER_TRUE!$GIF_PROVIDER_TRUE$ac_delim
+GIF_PROVIDER_FALSE!$GIF_PROVIDER_FALSE$ac_delim
+FREETYPE_CFLAGS!$FREETYPE_CFLAGS$ac_delim
+FREETYPE_LIBS!$FREETYPE_LIBS$ac_delim
+FREETYPE_PROVIDER_TRUE!$FREETYPE_PROVIDER_TRUE$ac_delim
+FREETYPE_PROVIDER_FALSE!$FREETYPE_PROVIDER_FALSE$ac_delim
+V4L_PROVIDER_TRUE!$V4L_PROVIDER_TRUE$ac_delim
+V4L_PROVIDER_FALSE!$V4L_PROVIDER_FALSE$ac_delim
+TSLIB_CFLAGS!$TSLIB_CFLAGS$ac_delim
+TSLIB_LIBS!$TSLIB_LIBS$ac_delim
+SOFTWARE_RENDERING_TRUE!$SOFTWARE_RENDERING_TRUE$ac_delim
+SOFTWARE_RENDERING_FALSE!$SOFTWARE_RENDERING_FALSE$ac_delim
+DFB_SMOOTH_SCALING!$DFB_SMOOTH_SCALING$ac_delim
+FUSION_MESSAGE_SIZE!$FUSION_MESSAGE_SIZE$ac_delim
+RUNTIME_SYSROOT!$RUNTIME_SYSROOT$ac_delim
+DIRECTFB_CSOURCE!$DIRECTFB_CSOURCE$ac_delim
+GFX_ATI128_TRUE!$GFX_ATI128_TRUE$ac_delim
+GFX_ATI128_FALSE!$GFX_ATI128_FALSE$ac_delim
+GFX_CLE266_TRUE!$GFX_CLE266_TRUE$ac_delim
+GFX_CLE266_FALSE!$GFX_CLE266_FALSE$ac_delim
+GFX_CYBER5K_TRUE!$GFX_CYBER5K_TRUE$ac_delim
+GFX_CYBER5K_FALSE!$GFX_CYBER5K_FALSE$ac_delim
+GFX_DAVINCI_TRUE!$GFX_DAVINCI_TRUE$ac_delim
+GFX_DAVINCI_FALSE!$GFX_DAVINCI_FALSE$ac_delim
+GFX_EP9X_TRUE!$GFX_EP9X_TRUE$ac_delim
+GFX_EP9X_FALSE!$GFX_EP9X_FALSE$ac_delim
+GFX_GL_TRUE!$GFX_GL_TRUE$ac_delim
+GFX_GL_FALSE!$GFX_GL_FALSE$ac_delim
+GFX_GLX_TRUE!$GFX_GLX_TRUE$ac_delim
+GFX_GLX_FALSE!$GFX_GLX_FALSE$ac_delim
+GFX_I810_TRUE!$GFX_I810_TRUE$ac_delim
+GFX_I810_FALSE!$GFX_I810_FALSE$ac_delim
+GFX_I830_TRUE!$GFX_I830_TRUE$ac_delim
+GFX_I830_FALSE!$GFX_I830_FALSE$ac_delim
+GFX_MACH64_TRUE!$GFX_MACH64_TRUE$ac_delim
+GFX_MACH64_FALSE!$GFX_MACH64_FALSE$ac_delim
+GFX_MATROX_TRUE!$GFX_MATROX_TRUE$ac_delim
+GFX_MATROX_FALSE!$GFX_MATROX_FALSE$ac_delim
+GFX_NEOMAGIC_TRUE!$GFX_NEOMAGIC_TRUE$ac_delim
+GFX_NEOMAGIC_FALSE!$GFX_NEOMAGIC_FALSE$ac_delim
+GFX_NSC_TRUE!$GFX_NSC_TRUE$ac_delim
+GFX_NSC_FALSE!$GFX_NSC_FALSE$ac_delim
+GFX_NVIDIA_TRUE!$GFX_NVIDIA_TRUE$ac_delim
+GFX_NVIDIA_FALSE!$GFX_NVIDIA_FALSE$ac_delim
+GFX_OMAP_TRUE!$GFX_OMAP_TRUE$ac_delim
+GFX_OMAP_FALSE!$GFX_OMAP_FALSE$ac_delim
+GFX_RADEON_TRUE!$GFX_RADEON_TRUE$ac_delim
+GFX_RADEON_FALSE!$GFX_RADEON_FALSE$ac_delim
+GFX_SAVAGE_TRUE!$GFX_SAVAGE_TRUE$ac_delim
+GFX_SAVAGE_FALSE!$GFX_SAVAGE_FALSE$ac_delim
+GFX_SH772X_TRUE!$GFX_SH772X_TRUE$ac_delim
+GFX_SH772X_FALSE!$GFX_SH772X_FALSE$ac_delim
+GFX_SIS315_TRUE!$GFX_SIS315_TRUE$ac_delim
+GFX_SIS315_FALSE!$GFX_SIS315_FALSE$ac_delim
+GFX_TDFX_TRUE!$GFX_TDFX_TRUE$ac_delim
+GFX_TDFX_FALSE!$GFX_TDFX_FALSE$ac_delim
+GFX_UNICHROME_TRUE!$GFX_UNICHROME_TRUE$ac_delim
+GFX_UNICHROME_FALSE!$GFX_UNICHROME_FALSE$ac_delim
+GFX_VMWARE_TRUE!$GFX_VMWARE_TRUE$ac_delim
+GFX_VMWARE_FALSE!$GFX_VMWARE_FALSE$ac_delim
+DBOX2REMOTE_TRUE!$DBOX2REMOTE_TRUE$ac_delim
+DBOX2REMOTE_FALSE!$DBOX2REMOTE_FALSE$ac_delim
+DREAMBOXREMOTE_TRUE!$DREAMBOXREMOTE_TRUE$ac_delim
+DREAMBOXREMOTE_FALSE!$DREAMBOXREMOTE_FALSE$ac_delim
+DYNAPRO_INPUT_TRUE!$DYNAPRO_INPUT_TRUE$ac_delim
+DYNAPRO_INPUT_FALSE!$DYNAPRO_INPUT_FALSE$ac_delim
+ELO_INPUT_TRUE!$ELO_INPUT_TRUE$ac_delim
+ELO_INPUT_FALSE!$ELO_INPUT_FALSE$ac_delim
+GUNZE_INPUT_TRUE!$GUNZE_INPUT_TRUE$ac_delim
+GUNZE_INPUT_FALSE!$GUNZE_INPUT_FALSE$ac_delim
+H3600_TS_TRUE!$H3600_TS_TRUE$ac_delim
+H3600_TS_FALSE!$H3600_TS_FALSE$ac_delim
+JOYSTICK_INPUT_TRUE!$JOYSTICK_INPUT_TRUE$ac_delim
+JOYSTICK_INPUT_FALSE!$JOYSTICK_INPUT_FALSE$ac_delim
+KEYBOARD_INPUT_TRUE!$KEYBOARD_INPUT_TRUE$ac_delim
+KEYBOARD_INPUT_FALSE!$KEYBOARD_INPUT_FALSE$ac_delim
+LINUX_INPUT_TRUE!$LINUX_INPUT_TRUE$ac_delim
+LINUX_INPUT_FALSE!$LINUX_INPUT_FALSE$ac_delim
+LIRC_INPUT_TRUE!$LIRC_INPUT_TRUE$ac_delim
+LIRC_INPUT_FALSE!$LIRC_INPUT_FALSE$ac_delim
+MUTOUCH_TS_TRUE!$MUTOUCH_TS_TRUE$ac_delim
+MUTOUCH_TS_FALSE!$MUTOUCH_TS_FALSE$ac_delim
+ZYTRONIC_TS_TRUE!$ZYTRONIC_TS_TRUE$ac_delim
+ZYTRONIC_TS_FALSE!$ZYTRONIC_TS_FALSE$ac_delim
+PENMOUNT_TS_TRUE!$PENMOUNT_TS_TRUE$ac_delim
+PENMOUNT_TS_FALSE!$PENMOUNT_TS_FALSE$ac_delim
+PS2MOUSE_INPUT_TRUE!$PS2MOUSE_INPUT_TRUE$ac_delim
+PS2MOUSE_INPUT_FALSE!$PS2MOUSE_INPUT_FALSE$ac_delim
+SERIAL_MOUSE_INPUT_TRUE!$SERIAL_MOUSE_INPUT_TRUE$ac_delim
+SERIAL_MOUSE_INPUT_FALSE!$SERIAL_MOUSE_INPUT_FALSE$ac_delim
+SONYPI_TRUE!$SONYPI_TRUE$ac_delim
+SONYPI_FALSE!$SONYPI_FALSE$ac_delim
+TSLIB_TRUE!$TSLIB_TRUE$ac_delim
+TSLIB_FALSE!$TSLIB_FALSE$ac_delim
+UCB1X00_TS_TRUE!$UCB1X00_TS_TRUE$ac_delim
+UCB1X00_TS_FALSE!$UCB1X00_TS_FALSE$ac_delim
+WM97XX_TS_TRUE!$WM97XX_TS_TRUE$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+WM97XX_TS_FALSE!$WM97XX_TS_FALSE$ac_delim
+BUILD_TESTS_TRUE!$BUILD_TESTS_TRUE$ac_delim
+BUILD_TESTS_FALSE!$BUILD_TESTS_FALSE$ac_delim
+BUILD_TOOLS_TRUE!$BUILD_TOOLS_TRUE$ac_delim
+BUILD_TOOLS_FALSE!$BUILD_TOOLS_FALSE$ac_delim
+CROSS_COMPILING_TRUE!$CROSS_COMPILING_TRUE$ac_delim
+CROSS_COMPILING_FALSE!$CROSS_COMPILING_FALSE$ac_delim
+BUILD_SHARED_TRUE!$BUILD_SHARED_TRUE$ac_delim
+BUILD_SHARED_FALSE!$BUILD_SHARED_FALSE$ac_delim
+BUILD_STATIC_TRUE!$BUILD_STATIC_TRUE$ac_delim
+BUILD_STATIC_FALSE!$BUILD_STATIC_FALSE$ac_delim
+SOPATH!$SOPATH$ac_delim
+HAVE_LINUX!$HAVE_LINUX$ac_delim
+DFB_CFLAGS_OMIT_FRAME_POINTER!$DFB_CFLAGS_OMIT_FRAME_POINTER$ac_delim
+DFB_LDFLAGS!$DFB_LDFLAGS$ac_delim
+DFB_INTERNAL_CFLAGS!$DFB_INTERNAL_CFLAGS$ac_delim
+X11_CFLAGS!$X11_CFLAGS$ac_delim
+X11_LIBS!$X11_LIBS$ac_delim
+GIF_PROVIDER!$GIF_PROVIDER$ac_delim
+JPEG_PROVIDER!$JPEG_PROVIDER$ac_delim
+PNG_PROVIDER!$PNG_PROVIDER$ac_delim
+LIBJPEG!$LIBJPEG$ac_delim
+LIBPNG!$LIBPNG$ac_delim
+FREETYPE_PROVIDER!$FREETYPE_PROVIDER$ac_delim
+DATADIR!$DATADIR$ac_delim
+MODULEDIR!$MODULEDIR$ac_delim
+MODULEDIRNAME!$MODULEDIRNAME$ac_delim
+INCLUDEDIR!$INCLUDEDIR$ac_delim
+INTERNALINCLUDEDIR!$INTERNALINCLUDEDIR$ac_delim
+SYSCONFDIR!$SYSCONFDIR$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 32; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-4.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" | sed -f "$tmp/subs-4.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
+ac_dB='\\)[	 (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+	t rset
+	:rset
+	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
+	t ok
+	d
+	:ok
+	s/[\\&,]/\\&/g
+	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[	 #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_arg=$ac_file
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$_am_arg" : 'X\(//\)[^/]' \| \
+	 X"$_am_arg" : 'X\(//\)$' \| \
+	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+    "default":C) chmod +x directfb-config ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+
+
+{ echo "$as_me:$LINENO: result:
+Build options:
+  Version                   $VERSION
+  Linux powered             $have_linux
+  Install prefix            $prefix
+  Config files in           $SYSCONFDIR
+  Build shared libs         $enable_shared
+  Build static libs         $enable_static
+  Module directory          $MODULEDIR
+  CPPFLAGS                  $CPPFLAGS
+  CFLAGS                    $CFLAGS
+  LDFLAGS                   $LDFLAGS
+  LIBS                      $LIBS
+  DYNLIB                    $DYNLIB
+  THREADFLAGS               $THREADFLAGS
+  THREADLIBS                $THREADLIBS
+
+Misc options:
+  Multi Application Core    $enable_multi
+  Fusion Kernel Device      $linux_fusion
+  Fusion message size       $with_message_size
+  Voodoo (network support)  $enable_voodoo
+  Debug supported           $enable_debug_support
+  Debug enabled             $enable_debug
+  Trace support             $enable_trace
+  MMX support               $enable_mmx
+  SSE support               $enable_sse
+  Network support           $enable_network
+  Include all strings       $enable_text
+  Software Rendering        $with_software
+  Smooth SW Scaling         $with_smooth_scaling
+  16bit Dithering           $with_dither_rgb16
+  zlib compression          $use_zlib                 $ZLIB_LIBS
+  sysfs support             $use_sysfs                 $SYSFS_LIBS
+
+Building Tests              $with_tests
+Building Tools              $with_tools
+
+Building System Modules:
+  Linux FBDev support       $enable_fbdev
+  Generic /dev/mem support  $enable_devmem
+  X11 support               $enable_x11                 $X11_CFLAGS    $X11_LIBS
+  OSX support               $enable_osx                 $OSX_CFLAGS    $OSX_LIBS
+  SDL support               $enable_sdl                 $SDL_CFLAGS    $SDL_LIBS
+  VNC support               $enable_vnc                 $VNC_CFLAGS    $VNC_LIBS
+
+Building Window Manager Modules:
+  Default                   yes
+  UniQuE                    $enable_unique
+
+Building Image Provider Modules:
+  GIF                       $enable_gif
+  JPEG                      $JPEG                 $LIBJPEG
+  PNG                       $PNG                 $LIBPNG
+
+Building Video Provider Modules:
+  GIF                       $enable_gif
+  Video4Linux               $V4L (v2: $V4L2)
+
+Building Font Modules:
+  FreeType2                 $FREETYPE                 $FREETYPE_CFLAGS    $FREETYPE_LIBS
+  Default font              yes" >&5
+echo "${ECHO_T}
+Build options:
+  Version                   $VERSION
+  Linux powered             $have_linux
+  Install prefix            $prefix
+  Config files in           $SYSCONFDIR
+  Build shared libs         $enable_shared
+  Build static libs         $enable_static
+  Module directory          $MODULEDIR
+  CPPFLAGS                  $CPPFLAGS
+  CFLAGS                    $CFLAGS
+  LDFLAGS                   $LDFLAGS
+  LIBS                      $LIBS
+  DYNLIB                    $DYNLIB
+  THREADFLAGS               $THREADFLAGS
+  THREADLIBS                $THREADLIBS
+
+Misc options:
+  Multi Application Core    $enable_multi
+  Fusion Kernel Device      $linux_fusion
+  Fusion message size       $with_message_size
+  Voodoo (network support)  $enable_voodoo
+  Debug supported           $enable_debug_support
+  Debug enabled             $enable_debug
+  Trace support             $enable_trace
+  MMX support               $enable_mmx
+  SSE support               $enable_sse
+  Network support           $enable_network
+  Include all strings       $enable_text
+  Software Rendering        $with_software
+  Smooth SW Scaling         $with_smooth_scaling
+  16bit Dithering           $with_dither_rgb16
+  zlib compression          $use_zlib                 $ZLIB_LIBS
+  sysfs support             $use_sysfs                 $SYSFS_LIBS
+
+Building Tests              $with_tests
+Building Tools              $with_tools
+
+Building System Modules:
+  Linux FBDev support       $enable_fbdev
+  Generic /dev/mem support  $enable_devmem
+  X11 support               $enable_x11                 $X11_CFLAGS    $X11_LIBS
+  OSX support               $enable_osx                 $OSX_CFLAGS    $OSX_LIBS
+  SDL support               $enable_sdl                 $SDL_CFLAGS    $SDL_LIBS
+  VNC support               $enable_vnc                 $VNC_CFLAGS    $VNC_LIBS
+
+Building Window Manager Modules:
+  Default                   yes
+  UniQuE                    $enable_unique
+
+Building Image Provider Modules:
+  GIF                       $enable_gif
+  JPEG                      $JPEG                 $LIBJPEG
+  PNG                       $PNG                 $LIBPNG
+
+Building Video Provider Modules:
+  GIF                       $enable_gif
+  Video4Linux               $V4L (v2: $V4L2)
+
+Building Font Modules:
+  FreeType2                 $FREETYPE                 $FREETYPE_CFLAGS    $FREETYPE_LIBS
+  Default font              yes" >&6; };
+
+if test "$have_linux" = "yes"; then
+{ echo "$as_me:$LINENO: result:
+Building Graphics Drivers:
+  3Dfx Voodoo               $tdfx
+  ATI Mach64                $mach64
+  ATI Rage 128              $ati128
+  ATI Radeon                $radeon
+  Cirrus EP9X               $ep9x
+  Intel i810                $i810
+  Intel i830                $i830
+  Matrox                    $matrox
+  NeoMagic                  $neomagic
+  NSC Geode                 $nsc
+  nVidia                    $nvidia
+  Renesas SH7722/SH7723     $sh772x
+  S3 Savage                 $savage
+  SiS 315                   $sis315
+  TI Davinci                $davinci
+  TI OMAP                   $omap
+  TVIA CyberPro             $cyber5k
+  VIA CLE266                $cle266
+  VIA UniChrome             $unichrome
+  VMWare                    $vmware
+  --
+  OpenGL                    $gl (GLX: $glx)
+
+Building Input Drivers:
+  DBox2 Remote              $enable_dbox2remote
+  DreamBox Remote           $enable_dreamboxremote
+  Dynapro Touchscreen       $enable_dynapro_ts
+  ELO Touchscreen           $enable_elo_input
+  Gunze Touchscreen         $enable_gunze_input
+  H3600 Touchscreen         $enable_h3600_ts
+  Joystick                  $enable_joystick
+  Keyboard                  $enable_keyboard
+  Linux Input               $enable_linux_input
+  LiRC                      $enable_lirc
+  MuTouch touchscreen       $enable_mutouch
+  Zytronic touchscreen      $enable_zytronic
+  PS/2 Mouse                $enable_ps2mouse
+  Serial Mouse              $enable_serial_mouse
+  SonyPI Jogdial            $enable_sonypi_jogdial
+  tslib                     $enable_tslib                  $TSLIB_CFLAGS    $TSLIB_LIBS
+  ucb1x00 Touchscreen       $enable_ucb1x00_ts
+  WM97xx Touchscreen        $enable_wm97xx_ts" >&5
+echo "${ECHO_T}
+Building Graphics Drivers:
+  3Dfx Voodoo               $tdfx
+  ATI Mach64                $mach64
+  ATI Rage 128              $ati128
+  ATI Radeon                $radeon
+  Cirrus EP9X               $ep9x
+  Intel i810                $i810
+  Intel i830                $i830
+  Matrox                    $matrox
+  NeoMagic                  $neomagic
+  NSC Geode                 $nsc
+  nVidia                    $nvidia
+  Renesas SH7722/SH7723     $sh772x
+  S3 Savage                 $savage
+  SiS 315                   $sis315
+  TI Davinci                $davinci
+  TI OMAP                   $omap
+  TVIA CyberPro             $cyber5k
+  VIA CLE266                $cle266
+  VIA UniChrome             $unichrome
+  VMWare                    $vmware
+  --
+  OpenGL                    $gl (GLX: $glx)
+
+Building Input Drivers:
+  DBox2 Remote              $enable_dbox2remote
+  DreamBox Remote           $enable_dreamboxremote
+  Dynapro Touchscreen       $enable_dynapro_ts
+  ELO Touchscreen           $enable_elo_input
+  Gunze Touchscreen         $enable_gunze_input
+  H3600 Touchscreen         $enable_h3600_ts
+  Joystick                  $enable_joystick
+  Keyboard                  $enable_keyboard
+  Linux Input               $enable_linux_input
+  LiRC                      $enable_lirc
+  MuTouch touchscreen       $enable_mutouch
+  Zytronic touchscreen      $enable_zytronic
+  PS/2 Mouse                $enable_ps2mouse
+  Serial Mouse              $enable_serial_mouse
+  SonyPI Jogdial            $enable_sonypi_jogdial
+  tslib                     $enable_tslib                  $TSLIB_CFLAGS    $TSLIB_LIBS
+  ucb1x00 Touchscreen       $enable_ucb1x00_ts
+  WM97xx Touchscreen        $enable_wm97xx_ts" >&6; };
+fi
+
+{ echo "$as_me:$LINENO: result: $fusion_warning $png_warning $jpeg_warning $freetype_warning
+" >&5
+echo "${ECHO_T}$fusion_warning $png_warning $jpeg_warning $freetype_warning
+" >&6; };
diff --git a/Source/DirectFB/configure.in b/Source/DirectFB/configure.in
new file mode 100755
index 0000000..68ac944
--- /dev/null
+++ b/Source/DirectFB/configure.in
@@ -0,0 +1,1797 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(include/directfb.h)
+
+AC_PREREQ(2.52)
+
+#
+# Making releases:
+#   DIRECTFB_MICRO_VERSION += 1;
+#   DIRECTFB_INTERFACE_AGE += 1;
+#   DIRECTFB_BINARY_AGE += 1;
+# if any functions have been added, set DIRECTFB_INTERFACE_AGE to 0.
+# if backwards compatibility has been broken,
+# set DIRECTFB_BINARY_AGE and DIRECTFB_INTERFACE_AGE to 0.
+#
+#
+DIRECTFB_MAJOR_VERSION=1
+DIRECTFB_MINOR_VERSION=4
+DIRECTFB_MICRO_VERSION=0
+DIRECTFB_INTERFACE_AGE=0
+DIRECTFB_BINARY_AGE=0
+DIRECTFB_VERSION=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION.$DIRECTFB_MICRO_VERSION
+
+AC_SUBST(DIRECTFB_MAJOR_VERSION)
+AC_SUBST(DIRECTFB_MINOR_VERSION)
+AC_SUBST(DIRECTFB_MICRO_VERSION)
+AC_SUBST(DIRECTFB_INTERFACE_AGE)
+AC_SUBST(DIRECTFB_BINARY_AGE)
+AC_SUBST(DIRECTFB_VERSION)
+
+AC_DEFINE_UNQUOTED(DIRECTFB_VERSION,"$DIRECTFB_VERSION",[The DirectFB version])
+
+# libtool versioning
+LT_RELEASE=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION
+LT_CURRENT=`expr $DIRECTFB_MICRO_VERSION - $DIRECTFB_INTERFACE_AGE`
+LT_BINARY=`expr $DIRECTFB_MICRO_VERSION - $DIRECTFB_BINARY_AGE`
+LT_REVISION=$DIRECTFB_INTERFACE_AGE
+LT_AGE=`expr $DIRECTFB_BINARY_AGE - $DIRECTFB_INTERFACE_AGE`
+
+AC_SUBST(LT_RELEASE)
+AC_SUBST(LT_CURRENT)
+AC_SUBST(LT_BINARY)
+AC_SUBST(LT_REVISION)
+AC_SUBST(LT_AGE)
+
+# The earliest version that this release has binary compatibility with.
+# This is used for module locations.
+BINARY_VERSION=$DIRECTFB_MAJOR_VERSION.$DIRECTFB_MINOR_VERSION-$LT_BINARY
+
+
+VERSION=$DIRECTFB_VERSION
+PACKAGE=DirectFB
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
+PKG_PROG_PKG_CONFIG
+
+
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+AC_DISABLE_STATIC
+
+
+case x"$target" in
+  xNONE | x)
+    target_or_host="$host" ;;
+  *)
+    target_or_host="$target" ;;
+esac
+
+
+case "$target_or_host" in
+  *-cygwin)
+dnl    AC_ENABLE_STATIC
+dnl    AC_DISABLE_SHARED
+    ;;
+esac
+
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+ifdef([AM_PROG_AS],[AM_PROG_AS],[])
+AM_PROG_LIBTOOL
+AM_SANITY_CHECK
+AC_SUBST(LD)
+AC_ISC_POSIX
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_HEADER_STDC
+AC_C_BIGENDIAN
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+
+
+## Work around libstuhl during cross build...
+if test "$host" != "$build"; then
+  sys_lib_dlsearch_path_spec=""
+  sys_lib_search_path_spec=""
+fi
+
+AC_PATH_PROGS(PERL, perl5 perl)
+
+AC_PATH_PROG(MAN2HTML, man2html, no)
+AC_SUBST(MAN2HTML)
+AM_CONDITIONAL(HAVE_MAN2HTML, test "$MAN2HTML" != "no")
+
+
+dnl Test for OSX
+AC_ARG_ENABLE(osx,
+  [  --enable-osx            build with Mac OS X support [[default=auto]]],,
+  enable_osx=yes)
+
+if test "$enable_osx" = "yes"; then
+  AC_CHECK_HEADER(Carbon/Carbon.h, osx_found=yes, osx_found=no)
+  if test "$osx_found" = no; then
+    enable_osx=no
+    AC_MSG_WARN([
+*** no Carbon/Carbon.h found -- building without Mac OS X support.])
+  else
+    OSX_LIBS="-framework Carbon"
+  fi
+fi
+
+AM_CONDITIONAL(OSX_CORE, test "$enable_osx" = "yes")
+
+dnl Test for X11
+AC_ARG_ENABLE(x11,
+  [  --enable-x11            build with X11 support [[default=auto]]],,
+  enable_x11=yes)
+
+if test "$enable_x11" = "yes"; then
+  CFLAGS_saved="$CFLAGS"
+  CFLAGS="$CFLAGS -I/usr/X11R6/include"
+  AC_CHECK_HEADER(X11/X.h, x11_found=yes, x11_found=no)
+  CFLAGS="$CFLAGS_saved"
+  if test "$x11_found" = no; then
+    enable_x11=no
+    AC_MSG_WARN([
+*** no X11/X.h found -- building without X11 support.])
+  else
+    X11_LIBS="-L/usr/X11R6/lib -lX11 -lXext"
+    X11_CFLAGS="-I/usr/X11R6/include"
+  fi
+fi
+
+AM_CONDITIONAL(X11_CORE, test "$enable_x11" = "yes")
+
+
+AC_CHECK_HEADERS(linux/compiler.h linux/unistd.h asm/page.h signal.h)
+
+
+dnl Clear default CFLAGS
+if test x"$CFLAGS" = x"-g -O2"; then
+  CFLAGS=
+fi
+
+CFLAGS="-O3 -ffast-math -pipe $CFLAGS"
+
+DFB_INTERNAL_CFLAGS="-D_GNU_SOURCE $DFB_INTERNAL_CFLAGS"
+
+AC_ARG_ENABLE(extra-warnings,
+  [  --enable-extra-warnings   enable extra warnings [[default=no]]],,
+  enable_extra_warnings=no)
+if test "$enable_extra_warnings" = "yes"; then
+  CFLAGS="-W -Wno-sign-compare -Wno-unused-parameter -Wundef -Wcast-qual -Wcast-align -Waggregate-return -Wmissing-declarations -Winline $CFLAGS"
+fi
+
+# FIXME
+#if test "$GCC" = "yes"; then
+#  CFLAGS="-Wall -Wno-strict-aliasing $CFLAGS"
+#fi
+
+
+#
+# check target architecture
+#
+have_x86=no
+have_x86_64=no
+have_arm=no
+have_ppc=no
+have_sh4=no
+
+case "$target_or_host" in
+  i*86-*-*)
+    have_x86=yes
+    AC_DEFINE(ARCH_X86,1,[Define to 1 if you are compiling for ix86.])
+    ;;
+    
+  x86_64-*)
+    have_x86=yes
+    have_x86_64=yes
+    AC_DEFINE(ARCH_X86_64,1,[Define to 1 if you are compiling for AMD64.])
+    ;;
+
+  *arm*)
+    have_arm=yes
+	AC_DEFINE(ARCH_ARM,1,[Define to 1 if you are compiling for ARM.])
+    ;;
+
+  ppc-*-linux* | powerpc-*)
+    have_ppc=yes
+    AC_DEFINE(ARCH_PPC,1,[Define to 1 if you are compiling for PowerPC.])
+    ;;
+
+  sh4-* | sh3-*)
+    have_sh4=yes
+    AC_DEFINE(ARCH_SH4,1,[Define to 1 if you are compiling for SH4.])
+    ;;
+
+  *)
+    ;;
+esac
+
+
+have_linux=no
+have_cygwin=no
+have_kos=no
+need_libc_r=no
+need_libdl=yes
+want_ppcasm=yes
+want_armasm=yes
+
+case "$target_or_host" in
+  *-linux*)
+    have_linux=yes
+    ;;
+
+  *-cygwin)
+    have_cygwin=yes
+    need_libdl=no
+    ;;
+
+  *-freebsd*)
+    need_libc_r=yes
+    need_libdl=no
+    want_ppcasm=yes
+	want_armasm=yes
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+    ;;
+
+  *-openbsd*)
+    need_libc_r=yes
+    need_libdl=no
+    want_ppcasm=no
+	want_armasm=no
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+    ;;
+
+  *-netbsd*)
+    need_libc_r=no
+    need_libdl=no
+    want_ppcasm=yes
+	want_armasm=yes
+    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
+    LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
+    ;;    
+
+  *-darwin*)
+    need_libc_r=no
+    need_libdl=yes
+    want_ppcasm=no
+	want_armasm=no
+    CPPFLAGS="$CPPFLAGS -I/sw/include"
+    LDFLAGS="$LDFLAGS -L/sw/lib"
+    ;;
+
+  sh-*-elf)
+    if test "$CC" = "kos-cc"; then
+      need_libc_r=no
+      need_libdl=no
+      have_kos=yes
+    fi
+    ;;
+esac
+
+AM_CONDITIONAL(HAVE_LINUX, test "$have_linux" = "yes")    
+
+AM_CONDITIONAL(BUILDPPCASM, test "$have_ppc" = "yes" && test "$want_ppcasm" = "yes")
+
+if test "$have_ppc" = "yes" && test "$want_ppcasm" = "yes"; then
+    AC_DEFINE(USE_PPCASM,1,[Define to 1 if ppc assembly is available.])
+fi
+
+
+AM_CONDITIONAL(BUILDARMASM, test "$have_arm" = "yes" && test "$want_armasm" = "yes")
+
+if test "$have_arm" = "yes" && test "$want_armasm" = "yes"; then
+    AC_DEFINE(USE_ARMASM,1,[Define to 1 if arm assembly is available.])
+fi
+
+if test "$have_kos" = "yes"; then
+    AC_DEFINE(USE_KOS,1,[Define to 1 if compiling on KallistiOS.])
+fi
+
+dnl Threads
+
+THREADFLAGS="-D_REENTRANT"
+
+if test "$have_kos" = "no"; then
+  if test "$need_libc_r" = "yes"; then
+    AC_CHECK_LIB(c_r, pthread_attr_init, ,
+      AC_MSG_ERROR([
+*** DirectFB requires phtreads in libc_r.]))
+    THREADLIB="-lc_r"
+  else
+    AC_CHECK_LIB(pthread, pthread_attr_init, ,
+      AC_MSG_ERROR([
+*** DirectFB requires libpthread.]))
+    THREADLIB="-lpthread"
+  fi
+fi
+
+AC_CHECK_DECLS(PTHREAD_MUTEX_RECURSIVE,,
+  AC_MSG_WARN([
+*** PTHREAD_MUTEX_RECURSIVE is not defined! Dead locks might occur!]), [
+#define _GNU_SOURCE
+#include <pthread.h>])
+
+AC_CHECK_DECLS(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,,
+  AC_MSG_WARN([
+*** PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined! Dead locks might occur!]), [
+#define _GNU_SOURCE
+#include <pthread.h>])
+
+AC_SUBST(THREADFLAGS)
+AC_SUBST(THREADLIB)
+
+CPPFLAGS="$THREADFLAGS $CPPFLAGS"
+
+
+dnl Dynamic Linker
+DYNLIB=""
+if test "$need_libdl" = "yes"; then
+  if test "$enable_shared" = "yes"; then
+    AC_CHECK_LIB(dl, dlopen, ,
+      AC_MSG_ERROR([
+*** DirectFB requires libdl.]))
+    DYNLIB="-ldl"
+  fi
+fi
+
+AC_SUBST(DYNLIB)
+
+
+if test "$have_x86" = "yes"; then
+##
+## HACK HACK HACK automake uses @AS@ like a gcc
+##
+  AS=$CC
+  ASFLAGS=$CFLAGS
+  AC_SUBST(AS)
+  AC_SUBST(ASFLAGS)
+
+  AC_DEFINE(HAVE_INB_OUTB_IOPL,1,
+            [Define to 1 if inb, outb and iopl are available.])
+  AC_MSG_CHECKING([for sys/io.h])
+  AC_TRY_COMPILE([#include <sys/io.h>], [char x = inb(0); (void)x;], 
+    AC_DEFINE(HAVE_SYSIO,1,
+              [Define to 1 if you have the <sys/io.h> header file.])
+    have_sysio=yes
+    AC_MSG_RESULT(yes),
+    AC_MSG_RESULT(no))
+else
+  have_sysio=no
+fi
+
+
+AC_ARG_ENABLE(profiling,
+  [  --enable-profiling        enable profiling support [[default=no]]],,
+  enable_profiling=no)
+if test "$enable_profiling" = "yes"; then
+    CFLAGS="$CFLAGS -pg -g3"
+else
+    DFB_CFLAGS_OMIT_FRAME_POINTER="-fomit-frame-pointer"
+fi
+
+
+AC_ARG_ENABLE(debug,
+  [  --enable-debug            enable debugging [[default=no]]],,
+  enable_debug=no)
+if test "$enable_debug" = "yes"; then
+    CFLAGS="$CFLAGS -g3 -fno-inline -Wno-inline"
+    DIRECT_BUILD_DEBUG=1
+else
+    DIRECT_BUILD_DEBUG=0
+fi
+AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes")
+
+AC_SUBST(DIRECT_BUILD_DEBUG)
+
+
+AC_ARG_ENABLE(debug-support,
+  [  --enable-debug-support    enable debugging support [[default=yes]]],, enable_debug_support=yes)
+if test "$enable_debug_support" = "yes" || test "$enable_debug" = "yes"; then
+    enable_debug_support=yes
+    DIRECT_BUILD_DEBUGS=1
+else
+    DIRECT_BUILD_DEBUGS=0
+fi
+AM_CONDITIONAL(ENABLE_DEBUGS, test "$enable_debug_support" = "yes")
+
+AC_SUBST(DIRECT_BUILD_DEBUGS)
+
+
+AC_ARG_ENABLE(trace,
+  [  --enable-trace            enable call tracing [[default=no]]],,
+  enable_trace=no)
+if test "$enable_trace" = "yes"; then
+    DFB_INTERNAL_CFLAGS="$DFB_INTERNAL_CFLAGS -finstrument-functions"
+    DIRECT_BUILD_TRACE=1
+else
+    DIRECT_BUILD_TRACE=0
+fi
+AM_CONDITIONAL(ENABLE_TRACE, test "$enable_trace" = "yes")
+
+AC_SUBST(DIRECT_BUILD_TRACE)
+
+
+AC_ARG_ENABLE(text,
+  [  --enable-text             enable text output [[default=yes]]],,
+  enable_text=yes)
+if test "$enable_text" = "no"; then
+    DIRECT_BUILD_TEXT=0
+else
+    DIRECT_BUILD_TEXT=1
+fi
+
+AC_SUBST(DIRECT_BUILD_TEXT)
+
+
+AC_ARG_ENABLE(gettid,
+  [  --enable-gettid           enable usage of gettid() [[default=yes]]],,
+  enable_gettid=yes)
+if test "$enable_gettid" = "no"; then
+    DIRECT_BUILD_GETTID=0
+else
+    DIRECT_BUILD_GETTID=1
+fi
+
+AC_SUBST(DIRECT_BUILD_GETTID)
+
+
+AC_ARG_ENABLE(network,
+  [  --enable-network          enable network support [[default=yes]]],,
+  enable_network=yes)
+if test "$enable_network" = "no"; then
+    DIRECT_BUILD_NETWORK=0
+else
+    DIRECT_BUILD_NETWORK=1
+fi
+
+AC_SUBST(DIRECT_BUILD_NETWORK)
+
+
+AC_CHECK_HEADER(stdbool.h, DIRECT_BUILD_STDBOOL=1, DIRECT_BUILD_STDBOOL=0)
+
+AC_SUBST(DIRECT_BUILD_STDBOOL)
+
+
+linux_fusion="N/A"
+AC_ARG_ENABLE(multi,
+  [  --enable-multi            enable multi application core [[default=no]]],,
+  enable_multi=no)
+if test "$enable_multi" = "yes"; then
+  dnl Test for Fusion Kernel Device
+  linux_fusion=yes
+  AC_CHECK_HEADER( [linux/fusion.h],, linux_fusion=no)
+  if test "$linux_fusion" = "yes"; then
+     FUSION_BUILD_KERNEL=1
+  else
+     fusion_warning="
+Linux-Fusion header not found. Using EXPERIMENTAL Builtin Multi application core!"
+     AC_MSG_WARN([*** $fusion_warning *** ])
+     FUSION_BUILD_KERNEL=0
+  fi
+  FUSION_BUILD_MULTI=1
+else
+  FUSION_BUILD_MULTI=0
+  FUSION_BUILD_KERNEL=0
+fi
+
+AM_CONDITIONAL(ENABLE_MULTI, test "$enable_multi" = "yes")
+
+AC_SUBST(FUSION_BUILD_MULTI)
+AC_SUBST(FUSION_BUILD_KERNEL)
+
+
+AC_ARG_ENABLE(voodoo,
+  [  --enable-voodoo           enable Voodoo (network support) [[default=no]]],,
+  enable_voodoo=no)
+
+AM_CONDITIONAL(ENABLE_VOODOO, test "$enable_voodoo" = "yes")
+
+
+AC_ARG_ENABLE(unique,
+  [  --enable-unique           enable Unique (WM Module) [[default=no]]],,
+  enable_unique=no)
+
+AM_CONDITIONAL(ENABLE_UNIQUE, test "$enable_unique" = "yes")
+
+
+AC_ARG_ENABLE(mmx,
+  [  --enable-mmx              enable MMX support [[default=auto]]],,
+  enable_mmx=$have_x86)
+
+AC_ARG_ENABLE(sse,
+  [  --enable-sse              enable SSE support [[default=auto]]],,
+  enable_sse=$have_x86)
+
+if test "$enable_mmx" = "yes"; then
+
+  dnl Necessary for assembler sources
+  save_ac_ext="$ac_ext"
+  ac_ext=S
+
+  AC_MSG_CHECKING(whether the binutils support MMX)
+
+  echo "       movq 0, %mm0" > conftest.S
+  if AC_TRY_EVAL(ac_compile); then
+    AC_DEFINE(USE_MMX,1,[Define to 1 if MMX assembly is available.])
+    AC_MSG_RESULT(yes)
+
+    if test "$enable_sse" = "yes"; then
+
+      AC_MSG_CHECKING(whether the binutils support SSE)
+
+      echo "       movntps %xmm0, 0" > conftest.S
+      if AC_TRY_EVAL(ac_compile); then
+        AC_DEFINE(USE_SSE,1,[Define to 1 if SSE assembly is available.])
+        AC_MSG_RESULT(yes)
+      else
+        enable_sse=no
+        AC_MSG_RESULT(no)
+        AC_MSG_WARN([
+****************************************************************
+ The installed assembler does not supports the SSE command set. 
+ Update your binutils package, if you want to compile SSE code. 
+****************************************************************])
+      fi
+
+    fi
+
+  else
+    enable_mmx=no
+    AC_MSG_RESULT(no)
+    AC_MSG_WARN([
+****************************************************************
+ The installed assembler does not supports the MMX command set. 
+ Update your binutils package, if you want to compile MMX code. 
+****************************************************************])
+  fi
+
+  rm conftest*
+  ac_ext="$save_ac_ext"
+
+else
+  enable_sse=no
+fi
+
+AM_CONDITIONAL(BUILDMMX, test "$enable_mmx" = "yes")
+
+
+dnl Test for DevMem system
+AC_ARG_ENABLE(devmem,
+  [  --enable-devmem           build with generic /dev/mem support [[default=yes]]],,
+  enable_devmem=yes)
+
+AM_CONDITIONAL(DEVMEM_CORE, test "$enable_devmem" = "yes")
+
+
+
+dnl Test for Linux frame buffer device
+AC_ARG_ENABLE(fbdev,
+  [  --enable-fbdev            build with linux fbdev support [[default=auto]]],,
+  enable_fbdev=yes)
+
+if test "$have_linux" = "no"; then
+  enable_fbdev=no
+  AC_MSG_WARN([
+*** no linux kernel -- building without linux fbdev support.])
+fi
+
+if test "$enable_fbdev" = "yes"; then
+  AC_DEFINE(LINUX_INPUT_USE_FBDEV,1,[Define to 1 if Linux Input driver should use FBDev system module for console keymap queries.])
+fi
+
+AM_CONDITIONAL(FBDEV_CORE, test "$enable_fbdev" = "yes")
+
+
+
+dnl Test for SDL
+AC_ARG_ENABLE(sdl,
+  [  --enable-sdl              build with SDL support [[default=no]]],,
+  enable_sdl=no)
+
+if test "$enable_sdl" = "yes"; then
+  if test "$enable_osx" = "yes"; then
+    AC_MSG_WARN([
+*** SDL is now unsupported on OSX.])
+    enable_sdl=no
+ else
+  PKG_CHECK_MODULES([SDL], [sdl], enable_sdl=yes, [enable_sdl=no,
+      AC_MSG_WARN([*** no sdl -- building without SDL support.])])
+  fi
+fi
+
+AC_SUBST(OSX_LIBS)
+AM_CONDITIONAL(SDL_CORE, test "$enable_sdl" = "yes")
+
+dnl Test for VNC
+AC_ARG_ENABLE(vnc,
+  [  --enable-vnc              build with VNC support [[default=auto]]],,
+  enable_vnc=yes)
+                                                                     
+                                                                     
+                                                                     
+if test "$enable_vnc" = "yes"; then
+  AC_PATH_PROG(VNC_CONFIG, libvncserver-config, no)
+  if test "$VNC_CONFIG" = "no"; then
+    enable_vnc=no
+    AC_MSG_WARN([
+*** libvncserver-config not found -- building without VNC support. See http://libvncserver.sourceforge.net])
+  else
+    VNC_CFLAGS=`$VNC_CONFIG --cflags`
+    VNC_LIBS=`$VNC_CONFIG --libs`
+  fi
+fi
+                                                                     
+                                                                     
+                                                                     
+                                                                     
+AM_CONDITIONAL(VNC_CORE, test "$enable_vnc" = "yes")
+AC_SUBST(VNC_LIBS)
+AC_SUBST(VNC_CFLAGS)
+
+dnl Test for libsysfs
+AC_ARG_ENABLE(sysfs,
+  [  --enable-sysfs            build with sysfs support [[default=auto]]],,
+  enable_sysfs=yes)
+
+use_sysfs=no
+SYSFS_LIBS=
+
+if test "$enable_sysfs" = "yes"; then
+  AC_CHECK_LIB(sysfs, sysfs_get_mnt_path,
+    [
+	AC_CHECK_HEADER(sysfs/libsysfs.h,
+	use_sysfs=yes
+        AC_DEFINE(USE_SYSFS,1,[Define to 1 to build with sysfs support.])
+	SYSFS_LIBS='-lsysfs',
+	AC_MSG_WARN([
+*** libsysfs header files not found -- Building without sysfs support.]))
+    ],[
+	AC_MSG_WARN([ *** libsysfs not found -- Building without sysfs support.])
+    ])
+fi
+
+AC_SUBST(SYSFS_LIBS)
+
+
+dnl Test for libjpeg
+JPEG=no
+
+AC_ARG_ENABLE(jpeg,
+  [  --enable-jpeg             build JPEG image provider [[default=yes]]],
+  enable_jpeg="$enableval", enable_jpeg=yes)
+
+if test "$enable_jpeg" = "yes"; then
+  if test -z "$LIBJPEG"; then
+    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
+      jpeg_ok=yes,
+      jpeg_ok=no)
+    if test "$jpeg_ok" = yes; then
+      AC_CHECK_HEADER(jpeglib.h,
+        jpeg_ok=yes,
+        jpeg_ok=no)
+      if test "$jpeg_ok" = yes; then
+	JPEG=yes
+	LIBJPEG='-ljpeg'
+      else
+	JPEG=no
+	AC_MSG_WARN([
+*** JPEG header files not found. JPEG image provider will not be built.])
+      fi
+    else
+      JPEG=no
+      AC_MSG_WARN([
+*** JPEG library not found. JPEG image provider will not be built.])
+    fi
+  fi
+fi
+
+AM_CONDITIONAL(JPEG_PROVIDER, test "$JPEG" = "yes")
+
+if test "$enable_jpeg" != "no" && test "$JPEG" != "yes"; then
+  jpeg_warning="
+JPEG support is missing - many applications won't work correctly!"
+fi
+
+
+AC_ARG_ENABLE(zlib,
+  [  --enable-zlib             use zlib, e.g. for screen shots [[default=no]]],
+  enable_zlib="$enableval", enable_zlib=no)
+
+use_zlib=no
+ZLIB_LIBS=
+
+if test "$enable_zlib" = "yes"; then
+  dnl Test for libz
+  AC_CHECK_LIB(z, gzsetparams,
+    [
+	AC_CHECK_HEADER(zlib.h,
+	use_zlib=yes
+        AC_DEFINE(USE_ZLIB,1,[Define to 1 to build with zlib compression.])
+	ZLIB_LIBS='-lz',
+	AC_MSG_ERROR([
+*** libz header files not found.]))
+    ],[
+	AC_MSG_ERROR([ *** libz not found.])
+    ])
+fi
+
+AC_SUBST(ZLIB_LIBS)
+
+
+dnl Test for libpng and libz
+PNG=no
+
+AC_ARG_ENABLE(png,
+  [  --enable-png              build PNG image provider [[default=yes]]],
+  enable_png="$enableval", enable_png=yes)
+
+if test "$enable_png" = "yes"; then
+  dnl Test for libz
+  if test -z "$ZLIB_LIBS"; then
+    AC_CHECK_LIB(z, gzsetparams,
+      [
+	AC_CHECK_HEADER(zlib.h,
+	  ZLIB_LIBS='-lz',
+	  AC_MSG_WARN([
+*** libz header files not found. PNG image provider will not be built.]))
+      ],[
+        AC_MSG_WARN([ *** libz not found. PNG image provider will not be built.])
+      ])
+  fi
+
+  AC_PATH_PROG(LIBPNG_CONFIG, libpng-config, no)
+  if test "$LIBPNG_CONFIG" = no; then
+      PNG=no
+      AC_MSG_WARN([
+*** libpng-config not found ])
+  else
+      PNG=yes
+      LIBPNG=`$LIBPNG_CONFIG --libs`
+  fi
+
+  dnl Test for libpng
+  if test -z "$LIBPNG" && test -n "$ZLIB_LIBS"; then
+    AC_CHECK_LIB(png, png_read_info,
+      [
+	AC_CHECK_HEADER(png.h,
+	  png_ok=yes,
+	  AC_MSG_WARN([
+*** PNG header files not found. PNG image provider will not be built.]))
+      ],[
+        AC_MSG_WARN([
+*** PNG library not found. PNG image provider will not be built.])
+	],
+      $ZLIB_LIBS -lm)
+    if test "$png_ok" = yes; then
+      AC_MSG_CHECKING([for png_structp in png.h])
+      AC_TRY_COMPILE([#include <png.h>],
+        [png_structp pp;
+	 png_infop info;
+	 png_colorp cmap;
+	 (void)png_create_read_struct; (void)pp; (void)info; (void)cmap;],
+        png_ok=yes, png_ok=no)
+      AC_MSG_RESULT($png_ok)
+      if test "$png_ok" = yes; then
+	PNG=yes
+        LIBPNG="-lpng $ZLIB_LIBS -lm"
+      else
+	PNG=no
+        AC_MSG_WARN([
+*** PNG library is too old. PNG image provider will not be built.])
+      fi
+    else
+      PNG=no
+    fi
+  fi
+fi
+
+AM_CONDITIONAL(PNG_PROVIDER, test "$PNG" = "yes")
+AM_CONDITIONAL(BUILD_DIRECTFB_CSOURCE, test "$PNG" = "yes")
+
+if test "$enable_png" != "no" && test "$PNG" != "yes"; then
+  png_warning="
+PNG support is missing - many applications won't work correctly!"
+fi
+
+
+dnl Allow to disable GIF support
+AC_ARG_ENABLE(gif,
+  [  --enable-gif              build GIF image/video provider [[default=yes]]],
+  enable_gif="$enableval", enable_gif=yes)
+ 
+AM_CONDITIONAL(GIF_PROVIDER, test "$enable_gif" = "yes")
+
+
+dnl Test for freetype
+AC_ARG_ENABLE(freetype,
+  [  --enable-freetype         build FreeType2 font provider [[default=yes]]],
+  enable_freetype="$enableval", enable_freetype=yes)
+
+if test "$enable_freetype" = "yes"; then
+  PKG_CHECK_MODULES(FREETYPE, freetype2, FREETYPE="yes", [FREETYPE="no",
+    AC_MSG_WARN([*** no freetype -- FreeType font provider will not be built.])])
+fi
+
+AM_CONDITIONAL(FREETYPE_PROVIDER, test "$FREETYPE" = "yes")
+
+if test "$enable_freetype" != "no" && test "$FREETYPE" != "yes"; then
+  freetype_warning="
+FreeType2 support is missing - many applications won't work correctly!"
+fi
+
+
+dnl Test for linotype
+AC_ARG_ENABLE(linotype,
+  [  --enable-linotype         build LinoType font provider [[default=yes]]],
+  enable_linotype="$enableval", enable_linotype=yes)
+
+if test "$enable_linotype" = "yes"; then
+  PKG_CHECK_MODULES(LINOTYPE, linotype, LINOTYPE="yes", [LINOTYPE="no",
+    AC_MSG_WARN([*** no linotype -- LinoType font provider will not be built.])])
+fi
+
+AM_CONDITIONAL(LINOTYPE_PROVIDER, test "$LINOTYPE" = "yes")
+
+
+dnl Test for video4linux
+V4L=no
+
+if test "$have_linux" = "yes"; then
+  AC_ARG_ENABLE(video4linux,
+    [  --enable-video4linux      build Video4Linux video provider [[default=yes]]],
+    enable_v4l="$enableval", enable_v4l=yes)
+
+  if test "$enable_v4l" = "yes"; then
+    V4L=yes
+  fi
+fi
+
+AM_CONDITIONAL(V4L_PROVIDER, test "$V4L" = "yes")
+
+
+dnl Test for video4linux
+V4L2=no
+
+if test "$V4L" = "yes"; then
+  AC_ARG_ENABLE(video4linux2,
+    [  --enable-video4linux2     build with Video4Linux2 support [[default=no]]],
+    enable_v4l2="$enableval", enable_v4l2=no)
+
+  if test "$enable_v4l2" = "yes"; then
+    V4L2=yes
+    AC_DEFINE( DFB_HAVE_V4L2, 1, [Define to 1 if Video4Linux 2 is supported.] )
+  fi
+fi
+
+
+dnl check which gfxdrivers to build
+ati128=no
+cle266=no
+cyber5k=no
+davinci=no
+ep9x=no
+gl=no
+glx=no
+i810=no
+i830=no
+mach64=no
+matrox=no
+neomagic=no
+nsc=no
+nvidia=no
+omap=no
+radeon=no
+savage=no
+sh772x=no
+sis315=no
+tdfx=no
+unichrome=no
+vmware=no
+
+if test "$have_linux" = "yes"; then
+
+AC_MSG_CHECKING(which gfxdrivers should be built)
+AC_ARG_WITH(gfxdrivers,
+[  --with-gfxdrivers=<list>   compile gfxdrivers in <list> ]
+[                               gfxdrivers may be comma separated ]
+[                               'all' builds all drivers (default), 'none' builds none ]
+[                               Possible gfxdrivers are: ]
+[                               ati128, cle266, cyber5k, davinci, ep9x, gl, i810, i830, mach64,]
+[                               matrox, neomagic, nsc, nvidia, omap, radeon, savage, sh772x,]
+[                               sis315, tdfx, unichrome, vmware], gfxdrivers="$withval",[gfxdrivers="all"])
+
+if test "$gfxdrivers" = "all"; then
+  checkfor_ati128=yes
+  checkfor_cle266=no
+  checkfor_cyber5k=yes
+  checkfor_davinci="$have_arm"
+  checkfor_ep9x=yes
+  checkfor_gl=yes
+  checkfor_i810=yes
+  checkfor_i830=yes
+  checkfor_mach64=yes
+  checkfor_matrox=yes
+  checkfor_neomagic=yes
+  checkfor_nsc=yes
+  checkfor_nvidia=yes
+  checkfor_omap="$have_arm"
+  checkfor_radeon=yes
+  checkfor_savage=yes
+  checkfor_sh772x=yes
+  checkfor_sis315=yes
+  checkfor_tdfx=yes
+  checkfor_unichrome=yes
+  checkfor_vmware=yes
+
+  AC_MSG_RESULT(all)
+else 
+  if test "$gfxdrivers" != "none"; then
+    gfxdrivers=`echo $gfxdrivers | sed 's/,/ /g'`
+    for gfxdriver in $gfxdrivers
+    do
+      case "$gfxdriver" in
+          ati128)
+                  checkfor_ati128=yes
+                  ;;
+          cle266)
+                  checkfor_cle266=yes
+                  ;;
+          cyber5k)
+                  checkfor_cyber5k=yes
+                  ;;
+          davinci)
+                  checkfor_davinci=yes
+                  ;;
+          ep9x)
+                  checkfor_ep9x=yes
+                  ;;
+          gl)
+                  checkfor_gl=yes
+                  ;;
+          i810)
+                  checkfor_i810=yes
+                  ;;
+          i830)
+                  checkfor_i830=yes
+                  ;;
+          mach64)
+                  checkfor_mach64=yes
+                  ;;
+          matrox)
+                  checkfor_matrox=yes
+                  ;;
+          neomagic)
+                  checkfor_neomagic=yes
+                  ;;
+          nsc)
+                  checkfor_nsc=yes
+                  ;;
+          nvidia)
+                  checkfor_nvidia=yes
+                  ;;
+          omap)
+                  checkfor_omap=yes
+                  ;;
+          radeon)
+                  checkfor_radeon=yes
+                  ;;
+          savage)
+                  checkfor_savage=yes
+                  ;;
+          sh772x)
+                  checkfor_sh772x=yes
+                  ;;
+          sis315)
+                  checkfor_sis315=yes
+                  ;;
+          tdfx)
+                  checkfor_tdfx=yes
+                  ;;
+          unichrome)
+                  checkfor_unichrome=yes
+                  ;;
+          vmware)
+                  checkfor_vmware=yes
+                  ;;
+          *)
+                  echo "Unknown gfxdriver $gfxdriver, exiting!"
+                  exit 1
+                  ;;
+      esac
+    done
+    AC_MSG_RESULT($gfxdrivers)
+  fi
+fi
+
+if test "$checkfor_ati128" = "yes"; then
+  ati128=yes
+fi
+
+if test "$checkfor_cle266" = "yes" && test "$have_sysio" = "yes"; then
+  cle266=yes
+fi
+
+if test "$checkfor_cyber5k" = "yes"; then
+  cyber5k=yes
+fi
+
+if test "$checkfor_davinci" = "yes"; then
+  davinci=yes
+fi
+
+if test "$checkfor_ep9x" = "yes"; then
+  ep9x=yes
+fi
+
+if test "$checkfor_gl" = "yes"; then
+  AC_CHECK_HEADER(GL/gl.h, gl=yes)
+  AC_CHECK_HEADER(GL/glx.h, [
+                  glx=yes
+                  AC_DEFINE(USE_GLX,1,[Define to 1 if GLX has been selected or detected])
+                  ])
+fi
+
+if test "$checkfor_i810" = "yes" && test "$have_sysio" = "yes"; then
+  i810=yes
+fi
+
+if test "$checkfor_i830" = "yes" && test "$have_sysio" = "yes"; then
+  i830=yes
+fi
+
+if test "$checkfor_mach64" = "yes"; then
+  mach64=yes
+fi
+
+if test "$checkfor_matrox" = "yes"; then
+  matrox=yes
+fi
+
+if test "$checkfor_neomagic" = "yes" && test "$have_sysio" = "yes"; then
+  neomagic=yes
+fi
+
+if test "$checkfor_nsc" = "yes"; then
+  nsc=yes
+fi
+
+if test "$checkfor_nvidia" = "yes"; then
+  nvidia=yes
+fi
+
+if test "$checkfor_omap" = "yes"; then
+  omap=yes
+fi
+
+if test "$checkfor_radeon" = "yes"; then
+  radeon=yes
+fi
+
+if test "$checkfor_savage" = "yes" && test "$have_sysio" = "yes"; then
+  savage=yes
+fi
+
+if test "$checkfor_sh772x" = "yes" && test "$have_sh4" = "yes"; then
+  sh772x=yes
+fi
+
+if test "$checkfor_sis315" = "yes"; then
+  sis315=yes
+fi
+
+if test "$checkfor_tdfx" = "yes"; then
+  tdfx=yes
+fi
+
+if test "$checkfor_unichrome" = "yes" && test "$have_sysio" = "yes"; then
+  unichrome=yes
+fi
+
+if test "$checkfor_vmware" = "yes"; then
+  vmware=yes
+fi
+
+# lets check for input driver
+
+checkfor_dbox2remote=no
+checkfor_dreamboxremote=no
+checkfor_dynapro=no
+checkfor_elo=no
+checkfor_gunze=no
+checkfor_h3600ts=no
+checkfor_joystick=no
+checkfor_keyboard=no
+checkfor_linux_input=no
+checkfor_lirc=no
+checkfor_mutouch=no
+checkfor_zytronic=no
+checkfor_penmount=no
+checkfor_ps2mouse=no
+checkfor_serialmouse=no
+checkfor_sonypijogdial=no
+checkfor_tslib=no
+checkfor_ucb1x00=no
+checkfor_wm97xx=no
+
+AC_MSG_CHECKING(which inputdrivers should be built)
+AC_ARG_WITH(inputdrivers,
+[  --with-inputdrivers=<list> compile inputdrivers in <list> ]
+[                               inputdrivers may be comma separated ]
+[                               'all' builds all drivers (default), 'none' builds none ]
+[                               Possible inputdrivers are: ]
+[                               dbox2remote, dreamboxremote, dynapro, elo-input, gunze, h3600_ts, ]
+[                               joystick, keyboard, linuxinput, lirc, mutouch, penmount, ps2mouse, ]
+[                               serialmouse, sonypijogdial, tslib, ucb1x00, wm97xx, zytronic],
+inputdrivers="$withval",[inputdrivers="all"])
+
+if test "$inputdrivers" = "all"; then
+  checkfor_dbox2remote=yes
+  checkfor_dreamboxremote=yes
+  checkfor_dynapro=no
+  checkfor_elo=no
+  checkfor_gunze=no
+  checkfor_h3600ts=yes
+  checkfor_joystick=yes
+  checkfor_keyboard=yes
+  checkfor_linux_input=yes
+  checkfor_lirc=yes
+  checkfor_mutouch=yes
+  checkfor_zytronic=yes
+  checkfor_penmount=yes
+  checkfor_ps2mouse=yes
+  checkfor_serialmouse=yes
+  checkfor_sonypijogdial=yes
+  checkfor_tslib=yes
+  checkfor_ucb1x00="$have_arm"
+  checkfor_wm97xx=yes
+  AC_MSG_RESULT(all)
+else 
+  if test "$inputdrivers" != "none"; then
+    inputdrivers=`echo $inputdrivers | sed 's/,/ /g'`
+    for inputdriver in $inputdrivers
+    do
+      case "$inputdriver" in
+          dbox2remote)
+                  checkfor_dbox2remote=yes
+                  ;;
+          dreamboxremote)
+                  checkfor_dreamboxremote=yes
+                  ;;
+          dynapro)
+                  checkfor_dynapro=yes
+                  ;;
+          elo-input)
+                  checkfor_elo=yes
+                  ;;
+          gunze)
+                  checkfor_gunze=yes
+                  ;;
+          h3600_ts)
+                  checkfor_h3600ts=yes
+                  ;;
+          joystick)
+                  checkfor_joystick=yes
+                  ;;
+          keyboard)
+                  checkfor_keyboard=yes
+                  ;;
+          linuxinput)
+                  checkfor_linux_input=yes
+                  ;;
+          lirc)
+                  checkfor_lirc=yes
+                  ;;
+          mutouch)
+                  checkfor_mutouch=yes
+                  ;;
+          zytronic)
+                  checkfor_zytronic=yes
+                  ;;
+          penmount)
+                  checkfor_penmount=yes
+                  ;;
+          ps2mouse)
+                  checkfor_ps2mouse=yes
+                  ;;
+          serialmouse)
+                  checkfor_serialmouse=yes
+                  ;;
+          sonypijogdial)
+                  checkfor_sonypijogdial=yes
+                  ;;
+          tslib)
+                  checkfor_tslib=yes
+                  ;;
+          ucb1x00)
+                  checkfor_ucb1x00=yes
+                  ;;
+          wm97xx)
+                  checkfor_wm97xx=yes
+                  ;;
+          *)
+                  echo "Unknown inputdriver $inputdriver, exiting!"
+                  exit 1
+                  ;;
+      esac
+    done
+    AC_MSG_RESULT($inputdrivers)
+  fi
+fi
+
+enable_dbox2remote=no
+if test "$checkfor_dbox2remote" = "yes"; then
+  dnl Test for dbox2 remote support in the kernel
+    AC_CHECK_HEADER( [dbox/fp.h], enable_dbox2remote=yes, enable_dbox2remote=no
+    AC_MSG_WARN([*** DBox2 Remote input driver will not be built.]))
+fi
+
+enable_dreamboxremote=no
+if test "$checkfor_dreamboxremote" = "yes"; then
+  dnl Test for dreambox remote support in the kernel
+    AC_CHECK_HEADER( [dbox/fp.h], enable_dreamboxremote=yes, enable_dreamboxremote=no
+    AC_MSG_WARN([*** DreamBox Remote input driver will not be built.]))
+fi
+
+enable_dynapro_ts=no
+if test "$checkfor_dynapro" = "yes"; then
+  dnl Test for Dynapro Touchscreen support
+  enable_dynapro_ts=yes
+fi
+
+enable_elo_input=no
+if test "$checkfor_elo" = "yes"; then
+  dnl Test for ELO Touchscreen support
+  enable_elo_input=yes
+fi
+
+enable_gunze_input=no
+if test "$checkfor_gunze" = "yes"; then
+  dnl Test for Gunze Touchscreen support
+  enable_gunze_input=yes
+fi
+
+enable_h3600_ts=no
+if test "$checkfor_h3600ts" = "yes"; then
+  dnl Test for H3600 Touchscreen support
+  AC_CHECK_HEADER( [linux/h3600_ts.h], enable_h3600_ts=yes, enable_h3600_ts=no  
+    AC_MSG_WARN([*** H3600 Touchscreen driver will not be built.]))
+fi
+
+enable_joystick=no
+if test "$checkfor_joystick" = "yes"; then
+  dnl Test for linux/joystick.h in the kernel
+  
+  AC_CHECK_HEADER([linux/joystick.h], enable_joystick=yes, enable_joystick=no 
+     AC_MSG_WARN([*** no linux/joystick.h -- Joystick driver will not be built.]))
+fi
+
+enable_keyboard=no
+if test "$checkfor_keyboard" = "yes"; then
+    enable_keyboard=yes
+fi
+    
+enable_linux_input=no
+if test "$checkfor_linux_input" = "yes"; then
+  AC_CHECK_HEADER([linux/input.h], enable_linux_input=yes, enable_linux_input=no
+    AC_MSG_WARN([*** no linux/input.h -- Linux Input driver will not be built.]))
+
+  if test "$enable_linux_input" = "yes"; then
+    AC_MSG_CHECKING([for struct input_absinfo in linux/input.h])
+    AC_TRY_COMPILE([#include <linux/input.h>], [struct input_absinfo x; (void)x;],
+       AC_DEFINE(HAVE_INPUT_ABSINFO,1,
+         [Define to 1 if struct input_absinfo is defined in linux/input.h.])
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no))
+  fi
+fi
+
+enable_lirc=no
+if test "$checkfor_lirc" = "yes"; then
+    enable_lirc=yes
+fi
+
+enable_mutouch=no
+if test "$checkfor_mutouch" = "yes"; then  
+  dnl Allow to enable driver for Microtouch serial touchscreen
+  dnl This driver is not built by default since it needs to be configured
+  dnl by changing some defines in the source.
+    enable_mutouch=yes
+fi
+
+enable_zytronic=no
+if test "$checkfor_zytronic" = "yes"; then
+    enable_zytronic=yes
+fi
+
+enable_penmount=no
+if test "$checkfor_penmount" = "yes"; then
+    enable_penmount=yes
+fi
+
+enable_ps2mouse=no
+if test "$checkfor_ps2mouse" = "yes"; then
+    enable_ps2mouse=yes
+fi
+
+enable_serial_mouse=no
+if test "$checkfor_serialmouse" = "yes"; then
+  dnl Test for linux/serial.h in the kernel
+  AC_CHECK_HEADER([linux/serial.h], enable_serial_mouse=yes, enable_serial_mouse=no 
+     AC_MSG_WARN([*** no linux/serial.h -- serial mouse driver will not be built.]))
+fi
+
+enable_sonypi_jogdial=no
+if test "$checkfor_sonypijogdial" = "yes"; then
+  dnl Test for SonyPI Jogdial support
+  AC_CHECK_HEADER([linux/sonypi.h], enable_sonypi_jogdial=yes, enable_sonypi_jogdial=no 
+    AC_MSG_WARN([*** no linux/sonypi.h -- SonyPI Jogdial driver will not be built.]))
+fi
+
+enable_tslib=no
+if test "$checkfor_tslib" = "yes"; then
+  PKG_CHECK_MODULES([TSLIB], [tslib-0.0], enable_tslib=yes, enable_tslib=no 
+    AC_MSG_WARN([*** no tslib -- tslib driver will not be built.]))
+fi
+
+enable_ucb1x00_ts=no
+if test "$checkfor_ucb1x00" = "yes"; then
+  dnl Test for UCB1x00 Touchscreen support
+  enable_ucb1x00_ts=yes
+fi
+
+enable_wm97xx_ts=no
+if test "$checkfor_wm97xx" = "yes"; then
+  dnl Test for WM97xx Touchscreen support
+  enable_wm97xx_ts=yes
+fi
+ 
+ dnl *** end of if $testlinux ***
+fi
+
+
+AC_ARG_WITH(software,
+  [  --without-software         build without software rendering (can decrease binary size by >100k)])
+if test "$with_software" != "no"; then
+  with_software=yes
+fi
+
+AM_CONDITIONAL(SOFTWARE_RENDERING, test "$with_software" != "no")
+
+
+AC_ARG_WITH(smooth-scaling,
+  [  --with-smooth-scaling      build with smooth software scaling code (can increase binary size by >100k)])
+if test "$with_smooth_scaling" != "yes" -o "$with_software" != "yes"; then
+  with_smooth_scaling=no
+else
+  AC_DEFINE(DFB_SMOOTH_SCALING,1,[Define to 1 if smooth scaling code should be built.])
+fi
+
+AC_SUBST(DFB_SMOOTH_SCALING)
+
+
+AC_DEFINE(DFB_DITHER_SIMPLE,1,[Simple dithering, uses small dither table])
+AC_DEFINE(DFB_DITHER_ADVANCED,2,[Advanced dithering, uses large dither table])
+
+AC_ARG_WITH(dither-rgb16,
+  [  --with-dither-rgb16=TYPE   dithering to use when loading images into RGB16 surfaces [[default=none]]]
+  [                             Possible types are: ]
+  [                               none     - no dithering ]
+  [                               simple   - simple dithering (increases data section by 256 bytes) ]
+  [                               advanced - advanced dithering (increases data section by 64 KBytes) ])
+
+case x"$with_dither_rgb16" in
+     x | xnone)
+          with_dither_rgb16=none
+          ;;
+     xsimple)
+          AC_DEFINE(DFB_DITHER565,DFB_DITHER_SIMPLE,[Dithering to use when rendering to RGB16 surfaces])
+          ;;
+     xadvanced)
+          AC_DEFINE(DFB_DITHER565,DFB_DITHER_ADVANCED,[Dithering to use when rendering to RGB16 surfaces])
+          ;;
+     *)
+          echo "Unknown dithering type $with_dither_rgb16, exiting!"
+          exit 1
+          ;;
+esac
+
+
+AC_ARG_WITH(tests,
+  [  --with-tests               build test programs])
+if test "$with_tests" != "yes"; then
+  with_tests=no
+fi
+
+
+# How big of a buffer fusion uses to read messages from the fusion device
+AC_ARG_WITH(message-size,
+[  --with-message-size=SIZE   allow fusion messages up to SIZE bytes [[default=1024]]],
+[ ], [with_message_size=no])
+test x"$with_message_size" = x"no" && with_message_size=1024
+FUSION_MESSAGE_SIZE=$with_message_size
+AC_SUBST(FUSION_MESSAGE_SIZE)
+
+
+# Build tools?
+AC_ARG_WITH(tools,
+  [  --without-tools            do not build any tools])
+if test "$with_tools" != "no"; then
+  with_tools=yes
+fi
+
+
+# Sysroot used for runtime module loading, etc.
+AC_ARG_WITH(sysroot,
+[  --with-sysroot=DIR         search for lib/share et al within DIR at runtime]
+[                               (e.g. when loading modules)],
+[ RUNTIME_SYSROOT="$withval" ], [ RUNTIME_SYSROOT= ] )
+test x"$RUNTIME_SYSROOT" = x"no" && RUNTIME_SYSROOT=
+AC_SUBST(RUNTIME_SYSROOT)
+
+
+dnl *** Look for directfb-csource in PATH if we are cross-compiling ***
+
+if test "$enable_unique" = "yes"; then
+  if test "$cross_compiling" = "yes" || test "$with_tools" = "no"; then
+    AC_PATH_PROG(DIRECTFB_CSOURCE, directfb-csource, no)
+    if test "x$DIRECTFB_CSOURCE" = "xno"; then
+      AC_MSG_ERROR(Could not find a directfb-csource in your PATH)
+    fi
+  fi
+fi
+
+
+AM_CONDITIONAL(GFX_ATI128, test "$ati128" = "yes")
+AM_CONDITIONAL(GFX_CLE266, test "$cle266" = "yes")
+AM_CONDITIONAL(GFX_CYBER5K, test "$cyber5k" = "yes")
+AM_CONDITIONAL(GFX_DAVINCI, test "$davinci" = "yes")
+AM_CONDITIONAL(GFX_EP9X, test "$ep9x" = "yes")
+AM_CONDITIONAL(GFX_GL, test "$gl" = "yes")
+AM_CONDITIONAL(GFX_GLX, test "$glx" = "yes")
+AM_CONDITIONAL(GFX_I810, test "$i810" = "yes")
+AM_CONDITIONAL(GFX_I830, test "$i830" = "yes")
+AM_CONDITIONAL(GFX_MACH64, test "$mach64" = "yes")
+AM_CONDITIONAL(GFX_MATROX, test "$matrox" = "yes")
+AM_CONDITIONAL(GFX_NEOMAGIC, test "$neomagic" = "yes")
+AM_CONDITIONAL(GFX_NSC, test "$nsc" = "yes")
+AM_CONDITIONAL(GFX_NVIDIA, test "$nvidia" = "yes")
+AM_CONDITIONAL(GFX_OMAP, test "$omap" = "yes")
+AM_CONDITIONAL(GFX_RADEON, test "$radeon" = "yes")
+AM_CONDITIONAL(GFX_SAVAGE, test "$savage" = "yes")
+AM_CONDITIONAL(GFX_SH772X, test "$sh772x" = "yes")
+AM_CONDITIONAL(GFX_SIS315, test "$sis315" = "yes")
+AM_CONDITIONAL(GFX_TDFX, test "$tdfx" = "yes")
+AM_CONDITIONAL(GFX_UNICHROME, test "$unichrome" = "yes")
+AM_CONDITIONAL(GFX_VMWARE, test "$vmware" = "yes")
+
+AM_CONDITIONAL(DBOX2REMOTE, test "$enable_dbox2remote" = "yes")
+AM_CONDITIONAL(DREAMBOXREMOTE, test "$enable_dreamboxremote" = "yes")
+AM_CONDITIONAL(DYNAPRO_INPUT, test "$enable_dynapro_ts" = "yes")
+AM_CONDITIONAL(ELO_INPUT, test "$enable_elo_input" = "yes")
+AM_CONDITIONAL(GUNZE_INPUT, test "$enable_gunze_input" = "yes")
+AM_CONDITIONAL(H3600_TS, test "$enable_h3600_ts" = "yes")
+AM_CONDITIONAL(JOYSTICK_INPUT, test "$enable_joystick" = "yes")
+AM_CONDITIONAL(KEYBOARD_INPUT, test "$enable_keyboard" = "yes")
+AM_CONDITIONAL(LINUX_INPUT, test "$enable_linux_input" = "yes")
+AM_CONDITIONAL(LIRC_INPUT, test "$enable_lirc" = "yes")
+AM_CONDITIONAL(MUTOUCH_TS, test "$enable_mutouch" = "yes")
+AM_CONDITIONAL(ZYTRONIC_TS, test "$enable_zytronic" = "yes")
+AM_CONDITIONAL(PENMOUNT_TS, test "$enable_penmount" = "yes" )
+AM_CONDITIONAL(PS2MOUSE_INPUT, test "$enable_ps2mouse" = "yes")
+AM_CONDITIONAL(SERIAL_MOUSE_INPUT, test "$enable_serial_mouse" = "yes")
+AM_CONDITIONAL(SONYPI, test "$enable_sonypi_jogdial" = "yes")
+AM_CONDITIONAL(TSLIB, test "$enable_tslib" = "yes")
+AM_CONDITIONAL(UCB1X00_TS, test "$enable_ucb1x00_ts" = "yes")
+AM_CONDITIONAL(WM97XX_TS, test "$enable_wm97xx_ts" = "yes")
+
+AM_CONDITIONAL(BUILD_TESTS, test "$with_tests" = "yes")
+AM_CONDITIONAL(BUILD_TOOLS, test "$with_tools" = "yes")
+AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
+
+CFLAGS="$CFLAGS $DFB_INTERNAL_CFLAGS"
+DFB_LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+
+
+
+# Honor aclocal flags
+ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+
+AM_CONDITIONAL(BUILD_SHARED, test "$enable_shared" = "yes")
+AM_CONDITIONAL(BUILD_STATIC, test "$enable_static" = "yes")
+
+
+# Change the module directory only for builds that don't *support* debug
+if test "$enable_debug_support" = "no"; then
+  MODULEDIRNAME=directfb-$BINARY_VERSION-pure
+else
+  MODULEDIRNAME=directfb-$BINARY_VERSION
+fi
+
+MODULEDIR=$libdir/$MODULEDIRNAME
+DATADIR=$datadir/directfb-$VERSION
+INCLUDEDIR=$includedir/directfb
+INTERNALINCLUDEDIR=$includedir/directfb-internal
+
+SOPATH=$libdir/libdirectfb-$LT_RELEASE.so.$LT_CURRENT
+AC_SUBST(SOPATH)
+
+AC_SUBST(HAVE_LINUX)
+AC_SUBST(DFB_CFLAGS_OMIT_FRAME_POINTER)
+AC_SUBST(DFB_LDFLAGS)
+AC_SUBST(DFB_INTERNAL_CFLAGS)
+AC_SUBST(X11_CFLAGS)
+AC_SUBST(X11_LIBS)
+AC_SUBST(SDL_CFLAGS)
+AC_SUBST(SDL_LIBS)
+AC_SUBST(TSLIB_CFLAGS)
+AC_SUBST(TSLIB_LIBS)
+AC_SUBST(ZLIB_LIBS)
+AC_SUBST(GIF_PROVIDER)
+AC_SUBST(JPEG_PROVIDER)
+AC_SUBST(PNG_PROVIDER)
+AC_SUBST(LIBJPEG)
+AC_SUBST(LIBPNG)
+AC_SUBST(FREETYPE_PROVIDER)
+AC_SUBST(FREETYPE_CFLAGS)
+AC_SUBST(FREETYPE_LIBS)
+
+AC_SUBST(DATADIR)
+AC_SUBST(MODULEDIR)
+AC_SUBST(MODULEDIRNAME)
+AC_SUBST(INCLUDEDIR)
+AC_SUBST(INTERNALINCLUDEDIR)
+AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+
+CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+
+
+AC_OUTPUT([
+
+directfb-config
+directfb.pc
+directfb-internal.pc
+directfb.spec
+
+Makefile
+
+include/Makefile
+include/directfb_version.h
+
+lib/Makefile
+
+lib/direct/Makefile
+lib/direct/build.h
+lib/direct/direct.pc
+
+lib/fusion/Makefile
+lib/fusion/build.h
+lib/fusion/fusion.pc
+lib/fusion/shm/Makefile
+
+lib/voodoo/Makefile
+lib/voodoo/build.h
+lib/voodoo/voodoo.pc
+
+patches/Makefile
+
+proxy/Makefile
+proxy/dispatcher/Makefile
+proxy/requestor/Makefile
+
+rules/Makefile
+
+src/Makefile
+src/core/Makefile
+src/display/Makefile
+src/gfx/Makefile
+src/gfx/generic/Makefile
+src/input/Makefile
+src/media/Makefile
+src/misc/Makefile
+src/windows/Makefile
+
+systems/Makefile
+systems/devmem/Makefile
+systems/fbdev/Makefile
+systems/x11/Makefile
+systems/osx/Makefile
+systems/sdl/Makefile
+systems/vnc/Makefile
+
+wm/Makefile
+wm/default/Makefile
+wm/unique/Makefile
+wm/unique/classes/Makefile
+wm/unique/data/Makefile
+wm/unique/devices/Makefile
+
+gfxdrivers/Makefile
+gfxdrivers/ati128/Makefile
+gfxdrivers/cle266/Makefile
+gfxdrivers/cyber5k/Makefile
+gfxdrivers/davinci/Makefile
+gfxdrivers/ep9x/Makefile
+gfxdrivers/gl/Makefile
+gfxdrivers/i810/Makefile
+gfxdrivers/i830/Makefile
+gfxdrivers/mach64/Makefile
+gfxdrivers/matrox/Makefile
+gfxdrivers/neomagic/Makefile
+gfxdrivers/nsc/Makefile
+gfxdrivers/nsc/include/Makefile
+gfxdrivers/nvidia/Makefile
+gfxdrivers/omap/Makefile
+gfxdrivers/radeon/Makefile
+gfxdrivers/savage/Makefile
+gfxdrivers/sh772x/Makefile
+gfxdrivers/sis315/Makefile
+gfxdrivers/tdfx/Makefile
+gfxdrivers/unichrome/Makefile
+gfxdrivers/vmware/Makefile
+
+inputdrivers/Makefile
+inputdrivers/dbox2remote/Makefile
+inputdrivers/dreamboxremote/Makefile
+inputdrivers/dynapro/Makefile
+inputdrivers/elo/Makefile
+inputdrivers/gunze/Makefile
+inputdrivers/h3600_ts/Makefile
+inputdrivers/joystick/Makefile
+inputdrivers/keyboard/Makefile
+inputdrivers/linux_input/Makefile
+inputdrivers/lirc/Makefile
+inputdrivers/mutouch/Makefile
+inputdrivers/zytronic/Makefile
+inputdrivers/penmount/Makefile
+inputdrivers/ps2mouse/Makefile
+inputdrivers/serialmouse/Makefile
+inputdrivers/sonypi/Makefile
+inputdrivers/tslib/Makefile
+inputdrivers/ucb1x00_ts/Makefile
+inputdrivers/wm97xx_ts/Makefile
+
+interfaces/Makefile
+interfaces/IDirectFBFont/Makefile
+interfaces/IDirectFBImageProvider/Makefile
+interfaces/IDirectFBVideoProvider/Makefile
+
+data/Makefile
+
+tests/Makefile
+tools/Makefile
+
+docs/Makefile
+docs/dfbg.1
+docs/directfb-csource.1
+docs/directfbrc.5
+docs/html/Makefile
+
+], [chmod +x directfb-config])
+
+
+
+AC_MSG_RESULT([
+Build options:
+  Version                   $VERSION
+  Linux powered             $have_linux
+  Install prefix            $prefix
+  Config files in           $SYSCONFDIR
+  Build shared libs         $enable_shared
+  Build static libs         $enable_static
+  Module directory          $MODULEDIR
+  CPPFLAGS                  $CPPFLAGS
+  CFLAGS                    $CFLAGS
+  LDFLAGS                   $LDFLAGS
+  LIBS                      $LIBS
+  DYNLIB                    $DYNLIB
+  THREADFLAGS               $THREADFLAGS
+  THREADLIBS                $THREADLIBS
+
+Misc options:
+  Multi Application Core    $enable_multi
+  Fusion Kernel Device      $linux_fusion
+  Fusion message size       $with_message_size
+  Voodoo (network support)  $enable_voodoo
+  Debug supported           $enable_debug_support
+  Debug enabled             $enable_debug
+  Trace support             $enable_trace
+  MMX support               $enable_mmx
+  SSE support               $enable_sse
+  Network support           $enable_network
+  Include all strings       $enable_text
+  Software Rendering        $with_software
+  Smooth SW Scaling         $with_smooth_scaling
+  16bit Dithering           $with_dither_rgb16
+  zlib compression          $use_zlib                 $ZLIB_LIBS
+  sysfs support             $use_sysfs                 $SYSFS_LIBS
+
+Building Tests              $with_tests
+Building Tools              $with_tools
+
+Building System Modules:
+  Linux FBDev support       $enable_fbdev
+  Generic /dev/mem support  $enable_devmem
+  X11 support               $enable_x11                 $X11_CFLAGS    $X11_LIBS
+  OSX support               $enable_osx                 $OSX_CFLAGS    $OSX_LIBS
+  SDL support               $enable_sdl                 $SDL_CFLAGS    $SDL_LIBS
+  VNC support               $enable_vnc                 $VNC_CFLAGS    $VNC_LIBS
+
+Building Window Manager Modules:
+  Default                   yes
+  UniQuE                    $enable_unique
+
+Building Image Provider Modules:
+  GIF                       $enable_gif 
+  JPEG                      $JPEG                 $LIBJPEG
+  PNG                       $PNG                 $LIBPNG
+
+Building Video Provider Modules:
+  GIF                       $enable_gif
+  Video4Linux               $V4L (v2: $V4L2)
+
+Building Font Modules:
+  FreeType2                 $FREETYPE                 $FREETYPE_CFLAGS    $FREETYPE_LIBS
+  LinoType                  $LINOTYPE                 $LINOTYPE_CFLAGS    $LINOTYPE_LIBS
+  Default font              yes]);
+
+if test "$have_linux" = "yes"; then
+AC_MSG_RESULT([
+Building Graphics Drivers:
+  3Dfx Voodoo               $tdfx
+  ATI Mach64                $mach64 
+  ATI Rage 128              $ati128
+  ATI Radeon                $radeon
+  Cirrus EP9X               $ep9x
+  Intel i810                $i810
+  Intel i830                $i830
+  Matrox                    $matrox
+  NeoMagic                  $neomagic
+  NSC Geode                 $nsc
+  nVidia                    $nvidia
+  Renesas SH7722/SH7723     $sh772x
+  S3 Savage                 $savage
+  SiS 315                   $sis315
+  TI Davinci                $davinci
+  TI OMAP                   $omap
+  TVIA CyberPro             $cyber5k
+  VIA CLE266                $cle266
+  VIA UniChrome             $unichrome
+  VMWare                    $vmware
+  --
+  OpenGL                    $gl (GLX: $glx)
+
+Building Input Drivers:
+  DBox2 Remote              $enable_dbox2remote
+  DreamBox Remote           $enable_dreamboxremote
+  Dynapro Touchscreen       $enable_dynapro_ts
+  ELO Touchscreen           $enable_elo_input
+  Gunze Touchscreen         $enable_gunze_input
+  H3600 Touchscreen         $enable_h3600_ts
+  Joystick                  $enable_joystick
+  Keyboard                  $enable_keyboard
+  Linux Input               $enable_linux_input
+  LiRC                      $enable_lirc
+  MuTouch touchscreen       $enable_mutouch
+  Zytronic touchscreen      $enable_zytronic
+  PS/2 Mouse                $enable_ps2mouse
+  Serial Mouse              $enable_serial_mouse
+  SonyPI Jogdial            $enable_sonypi_jogdial
+  tslib                     $enable_tslib                  $TSLIB_CFLAGS    $TSLIB_LIBS
+  ucb1x00 Touchscreen       $enable_ucb1x00_ts
+  WM97xx Touchscreen        $enable_wm97xx_ts]);
+fi
+
+AC_MSG_RESULT([$fusion_warning $png_warning $jpeg_warning $freetype_warning
+]);
diff --git a/Source/DirectFB/data/Makefile.am b/Source/DirectFB/data/Makefile.am
new file mode 100755
index 0000000..fb8a71e
--- /dev/null
+++ b/Source/DirectFB/data/Makefile.am
@@ -0,0 +1,7 @@
+## Makefile.am for DirectFB/data
+
+miscdatadir = $(DATADIR)
+
+miscdata_DATA = cursor.dat
+
+EXTRA_DIST = $(miscdata_DATA)
diff --git a/Source/DirectFB/data/Makefile.in b/Source/DirectFB/data/Makefile.in
new file mode 100755
index 0000000..d1d1239
--- /dev/null
+++ b/Source/DirectFB/data/Makefile.in
@@ -0,0 +1,431 @@
+# 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@
+subdir = data
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+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)$(miscdatadir)"
+miscdataDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(miscdata_DATA)
+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@
+miscdatadir = $(DATADIR)
+miscdata_DATA = cursor.dat
+EXTRA_DIST = $(miscdata_DATA)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  data/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  data/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-miscdataDATA: $(miscdata_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(miscdatadir)" || $(MKDIR_P) "$(DESTDIR)$(miscdatadir)"
+	@list='$(miscdata_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(miscdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(miscdatadir)/$$f'"; \
+	  $(miscdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(miscdatadir)/$$f"; \
+	done
+
+uninstall-miscdataDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(miscdata_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(miscdatadir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(miscdatadir)/$$f"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(miscdatadir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-miscdataDATA
+
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-miscdataDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-miscdataDATA \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-miscdataDATA
+
+# 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/data/cursor.dat b/Source/DirectFB/data/cursor.dat
new file mode 100755
index 0000000..2da6181
Binary files /dev/null and b/Source/DirectFB/data/cursor.dat differ
diff --git a/Source/DirectFB/depcomp b/Source/DirectFB/depcomp
new file mode 100755
index 0000000..e5f9736
--- /dev/null
+++ b/Source/DirectFB/depcomp
@@ -0,0 +1,589 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Source/DirectFB/directfb-config.in b/Source/DirectFB/directfb-config.in
new file mode 100755
index 0000000..212675c
--- /dev/null
+++ b/Source/DirectFB/directfb-config.in
@@ -0,0 +1,315 @@
+#!/bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+moduledir=@MODULEDIR@
+
+usage()
+{
+	cat <<EOF
+Usage: directfb-config [OPTIONS] [LIBRARIES]
+Options:
+	[--prefix[=DIR]]
+	[--exec-prefix[=DIR]]
+	[--version]
+	[--libs]
+	[--cflags]
+	
+For static linking:
+	[--input=<driver>[,<driver>]...]	(default: none)
+	[--graphics=<driver>[,<driver>]...]	(default: none)
+	[--system=<system>[,<system>]...]	(default: 'fbdev')
+	[--wm=<wm>[,<wm>]...]			(default: 'default')
+	[--font=<impl>[,<impl>]...]		(default: none)
+	[--imageprovider=<impl>[,<impl>]...]	(default: none)
+	[--videoprovider=<impl>[,<impl>]...]	(default: none)
+	[--fusionsound]
+	[--voodoo]
+	
+Example for static linking:
+	directfb-config --libs --graphics=matrox,r200
+			--input=linux_input --font=ft2
+			--imageprovider=jpeg,png,gif
+EOF
+	exit $1
+}
+
+if test $# -eq 0; then
+	usage 1 1>&2
+fi
+
+lib_directfb=yes
+lib_avifile=no
+
+while test $# -gt 0; do
+  case "$1" in
+    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+    *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      prefix=$optarg
+      if test $exec_prefix_set = no ; then
+        exec_prefix=$optarg
+      fi
+      ;;
+    --prefix)
+      echo_prefix=yes
+      ;;
+    --exec-prefix=*)
+      exec_prefix=$optarg
+      exec_prefix_set=yes
+      ;;
+    --exec-prefix)
+      echo_exec_prefix=yes
+      ;;
+    --version)
+      echo @DIRECTFB_MAJOR_VERSION@.@DIRECTFB_MINOR_VERSION@.@DIRECTFB_MICRO_VERSION@
+      ;;
+    --cflags)
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    directfb)
+      lib_directfb=yes
+      ;;
+    avifile)
+      lib_avifile=yes
+      ;;
+    --input=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_input="$echo_input $moduledir/inputdrivers/libdirectfb_$i.o"
+      done
+
+      echo_static=yes
+      ;;
+    --graphics=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_graphics="$echo_graphics $moduledir/gfxdrivers/libdirectfb_$i.o"
+      done
+
+      echo_static=yes
+      ;;
+    --font=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_font="$echo_font $moduledir/interfaces/IDirectFBFont/libidirectfbfont_$i.o"
+        case $i in
+          ft2)
+            echo_font="$echo_font -lfreetype"
+            ;;
+        esac
+      done
+
+      echo_static=yes
+      ;;
+    --system=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_system="$echo_system $moduledir/systems/libdirectfb_$i.o"
+        case $i in
+          fbdev)
+            echo_system="$echo_system @SYSFS_LIBS@"
+            ;;
+          sdl)
+            echo_system="$echo_system @SDL_LIBS@"
+            ;;
+        esac
+      done
+
+      echo_static=yes
+      ;;
+    --wm=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_wm="$echo_wm $moduledir/wm/libidirectfb_$i.o"
+        case $i in
+          unique)
+            echo_wm="$echo_wm -luniquewm"
+            ;;
+        esac
+      done
+
+      echo_static=yes
+      ;;
+    --imageprovider=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_imageprovider="$echo_imageprovider $moduledir/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_$i.o"
+        case $i in
+          imlib2)
+            echo_imageprovider="$echo_imageprovider -lImlib2 -lttf -lm -lXext -lX11"
+            ;;
+          jpeg)
+            echo_imageprovider="$echo_imageprovider -ljpeg"
+            ;;
+          png)
+            echo_imageprovider="$echo_imageprovider -lpng -lz -lm"
+            ;;
+          gif)
+            ;;
+        esac
+      done
+
+      echo_static=yes
+      ;;
+    --videoprovider=*)
+      if test -z "$optarg"; then
+        usage 2 1>&2
+      fi
+        
+      for i in `echo $optarg | sed 's/,/ /g'`; do
+        echo_videoprovider="$echo_videoprovider $moduledir/interfaces/IDirectFBVideoProvider/libidirectfbvideoprovider_$i.o"
+        case $i in
+          libmpeg3)
+            echo_videoprovider="$echo_videoprovider -lmpeg3"
+            ;;
+          swf)
+            echo_videoprovider="$echo_videoprovider -ljpeg -lz"
+            ;;
+          openquicktime)
+            echo_videoprovider="$echo_videoprovider -lopenquicktime -lz -lglib -lm"
+            ;;
+        esac
+      done
+
+      echo_static=yes
+      ;;
+    --fusionsound)
+      echo_fusionsound="-Wl,-uIFusionSound_default -lifusionsound"
+      echo_static=yes
+      ;;
+    --voodoo)
+      echo_voodoo=yes
+      echo_static=yes
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+if test "$echo_prefix" = "yes"; then
+	echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+	echo $exec_prefix
+fi
+
+if test "$echo_cflags" = "yes"; then
+      if test @INCLUDEDIR@ != /usr/include ; then
+        cflags="-I${SYSROOT}@INCLUDEDIR@"
+      fi
+      echo $cflags @THREADFLAGS@
+fi
+
+if test -n "$echo_static"; then
+	echo -static
+
+	if test -z "$echo_system"; then
+		echo $moduledir/systems/libdirectfb_fbdev.o @SYSFS_LIBS@
+	fi
+
+	if test -z "$echo_wm"; then
+		echo $moduledir/wm/libdirectfbwm_default.o
+	fi
+fi
+
+
+if test -n "$echo_font"; then
+	echo $echo_font
+fi
+
+if test -n "$echo_imageprovider"; then
+	echo $echo_imageprovider
+fi
+
+if test -n "$echo_videoprovider"; then
+	echo $echo_videoprovider
+fi
+
+
+if test -n "$echo_input"; then
+	echo $echo_input
+fi
+
+if test -n "$echo_graphics"; then
+	echo $echo_graphics
+fi
+
+if test -n "$echo_system"; then
+	echo $echo_system
+fi
+
+if test -n "$echo_wm"; then
+	echo $echo_wm
+fi
+
+if test -n "$echo_fusionsound"; then
+	echo -L${SYSROOT}$moduledir/interfaces/IFusionSound $echo_fusionsound
+fi
+
+
+print_voodoo ()
+{
+	echo $moduledir/interfaces/$1/lib$2_dispatcher.o $moduledir/interfaces/$1/lib$2_requestor.o
+}
+
+if test -n "$echo_voodoo"; then
+	print_voodoo  IDirectFB              idirectfb
+	print_voodoo  IDirectFBDataBuffer    idirectfbdatabuffer
+	print_voodoo  IDirectFBDisplayLayer  idirectfbdisplaylayer
+	print_voodoo  IDirectFBEventBuffer   idirectfbeventbuffer
+	print_voodoo  IDirectFBFont          idirectfbfont
+	print_voodoo  IDirectFBImageProvider idirectfbimageprovider
+	print_voodoo  IDirectFBInputDevice   idirectfbinputdevice
+	print_voodoo  IDirectFBPalette       idirectfbpalette
+	print_voodoo  IDirectFBScreen        idirectfbscreen
+	print_voodoo  IDirectFBSurface       idirectfbsurface
+	print_voodoo  IDirectFBWindow        idirectfbwindow
+	echo -lvoodoo
+fi
+
+if test "$echo_libs" = "yes"; then
+      libs=-L${SYSROOT}@libdir@
+
+      if test "$lib_directfb" = "yes"; then
+	 libs="$libs -ldirectfb -lfusion -ldirect @THREADLIB@"
+
+	 if test -n "$echo_static"; then
+	    libs="$libs @DYNLIB@ @ZLIB_LIBS@"
+	 fi
+      fi
+
+      if test "$lib_avifile" = "yes"; then
+	 libs="$libs @AVIFILE_LIBS@"
+      fi
+
+      echo $libs
+fi      
diff --git a/Source/DirectFB/directfb-internal.pc.in b/Source/DirectFB/directfb-internal.pc.in
new file mode 100755
index 0000000..4a27755
--- /dev/null
+++ b/Source/DirectFB/directfb-internal.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+moduledir=@MODULEDIR@
+moduledirname=@MODULEDIRNAME@
+includedir=@INTERNALINCLUDEDIR@
+
+Name: DirectFB-Internal
+Description: Third party module support package for DirectFB.
+Version: @VERSION@
+Requires: directfb = @VERSION@
+Cflags: @DFB_INTERNAL_CFLAGS@ -I@INTERNALINCLUDEDIR@
diff --git a/Source/DirectFB/directfb.pc.in b/Source/DirectFB/directfb.pc.in
new file mode 100755
index 0000000..dcaa676
--- /dev/null
+++ b/Source/DirectFB/directfb.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: DirectFB
+Description: Graphics and windowing library for the Linux frame buffer device
+Version: @VERSION@
+Requires: fusion direct voodoo
+Libs: -L${libdir} -ldirectfb @THREADLIB@ @OSX_LIBS@
+Libs.private: -L${libdir} @DYNLIB@ @ZLIB_LIBS@
+Cflags: @THREADFLAGS@ -I@INCLUDEDIR@
diff --git a/Source/DirectFB/directfb.spec b/Source/DirectFB/directfb.spec
new file mode 100755
index 0000000..1865a2f
--- /dev/null
+++ b/Source/DirectFB/directfb.spec
@@ -0,0 +1,118 @@
+%define name directfb
+%define version 1.4.0
+%define oname DirectFB
+%define libname lib%name
+
+Summary:	Hardware graphics acceleration library
+Name:		%name
+Version:	%version
+Release:	1
+License:	LGPL
+Group:		System/Libraries
+Source0:        http://www.directfb.org/download/%{name}/%{oname}-%{version}.tar.gz
+URL:		http://www.directfb.org/
+BuildRequires:	libpng-devel >= 1.2.0
+BuildRequires:	zlib-devel >= 1.1.3
+BuildRequires:	libjpeg-devel >= 6b
+BuildRequires:	freetype2-devel >= 2.0.2
+BuildRoot:	%{_tmppath}/%{name}-%{version}
+
+%description
+%oname - A hardware-accelerated graphics library on top of the Linux frame buffer device.
+
+%package -n %libname
+Summary:        Shared library part of %oname
+Group:		System/Libraries
+
+%description -n %libname
+%oname - A hardware-accelerated graphics library on top of the Linux frame buffer device.
+
+%oname is a thin library that provides developers with hardware graphics
+acceleration, input device handling and abstraction, an integrated windowing
+system with support for translucent windows and multiple display layers on top
+of the Linux frame buffer device. It is a complete hardware abstraction layer
+with software fallbacks for every graphics operation that is not supported by
+the underlying hardware.
+
+%package -n %libname-devel
+Group:		Development/C
+Summary:	Header files for compiling %oname applications
+Requires:	%{libname} = %{version}-%release
+Provides:	lib%name-devel = %version-%release
+Provides:	%oname-devel = %version-%release
+
+%description -n %libname-devel
+%oname header files needed for building applications based on %oname. 
+
+%package doc
+Summary:	%oname documentation
+Group:		Development/Other
+
+%description doc
+%oname documentation in html format.
+
+%prep
+%setup  -q -n %oname-%version
+
+%build
+%configure \
+        --enable-fbdev \
+	--disable-maintainer-mode \
+	--enable-shared \
+	--disable-fast-install \
+	--disable-debug \
+	--program-transform-name=""  # is this hack needed?
+
+%make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%makeinstall_std
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -n %libname -p /sbin/ldconfig
+%postun -n %libname -p /sbin/ldconfig
+
+%files -n %libname
+%defattr(644,root,root,755)
+%doc README* AUTHORS ChangeLog NEWS TODO
+%attr(755,root,root) %{_libdir}/lib*.so.*
+%{_libdir}/directfb-%version
+%{_datadir}/directfb-%version
+%{_mandir}/man5/*directfbrc.5*
+
+%files -n %libname-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/*directfb-config
+%attr(755,root,root) %{_bindir}/*directfb-csource
+%attr(755,root,root) %{_bindir}/*dfbg
+%{_includedir}/directfb
+%{_includedir}/directfb-internal
+%{_mandir}/man1/*directfb-csource.1*
+%{_mandir}/man1/*dfbg.1*
+%{_libdir}/pkgconfig/*
+%{_libdir}/*.la
+%{_libdir}/*.so
+
+%files doc
+%defattr(644,root,root,755)
+%doc docs/html/*
+
+%changelog
+* Mon Jan 13 2003 Sven Neumann <neo@directfb.org> 0.9.16
+- removed reference to avifile
+- added rules for dfbg and its man-page
+
+%changelog
+* Sun Oct 27 2002 Sven Neumann <neo@directfb.org> 0.9.14
+- added this file as directfb.spec.in to the DirectFB source tree
+- moved directfbrc manpage to the main package
+
+* Fri Aug 23 2002 Götz Waschk <waschk@linux-mandrake.com> 0.9.13-1mdk
+- add directfb-csource and man page
+- 0.9.13
+
+* Thu Jul 11 2002 Götz Waschk <waschk@linux-mandrake.com> 0.9.12-1mdk
+- initial package based on PLD effort
diff --git a/Source/DirectFB/directfb.spec.in b/Source/DirectFB/directfb.spec.in
new file mode 100755
index 0000000..5fea5e2
--- /dev/null
+++ b/Source/DirectFB/directfb.spec.in
@@ -0,0 +1,118 @@
+%define name directfb
+%define version @VERSION@
+%define oname DirectFB
+%define libname lib%name
+
+Summary:	Hardware graphics acceleration library
+Name:		%name
+Version:	%version
+Release:	1
+License:	LGPL
+Group:		System/Libraries
+Source0:        http://www.directfb.org/download/%{name}/%{oname}-%{version}.tar.gz
+URL:		http://www.directfb.org/
+BuildRequires:	libpng-devel >= 1.2.0
+BuildRequires:	zlib-devel >= 1.1.3
+BuildRequires:	libjpeg-devel >= 6b
+BuildRequires:	freetype2-devel >= 2.0.2
+BuildRoot:	%{_tmppath}/%{name}-%{version}
+
+%description
+%oname - A hardware-accelerated graphics library on top of the Linux frame buffer device.
+
+%package -n %libname
+Summary:        Shared library part of %oname
+Group:		System/Libraries
+
+%description -n %libname
+%oname - A hardware-accelerated graphics library on top of the Linux frame buffer device.
+
+%oname is a thin library that provides developers with hardware graphics
+acceleration, input device handling and abstraction, an integrated windowing
+system with support for translucent windows and multiple display layers on top
+of the Linux frame buffer device. It is a complete hardware abstraction layer
+with software fallbacks for every graphics operation that is not supported by
+the underlying hardware.
+
+%package -n %libname-devel
+Group:		Development/C
+Summary:	Header files for compiling %oname applications
+Requires:	%{libname} = %{version}-%release
+Provides:	lib%name-devel = %version-%release
+Provides:	%oname-devel = %version-%release
+
+%description -n %libname-devel
+%oname header files needed for building applications based on %oname. 
+
+%package doc
+Summary:	%oname documentation
+Group:		Development/Other
+
+%description doc
+%oname documentation in html format.
+
+%prep
+%setup  -q -n %oname-%version
+
+%build
+%configure \
+        --enable-fbdev \
+	--disable-maintainer-mode \
+	--enable-shared \
+	--disable-fast-install \
+	--disable-debug \
+	--program-transform-name=""  # is this hack needed?
+
+%make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%makeinstall_std
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -n %libname -p /sbin/ldconfig
+%postun -n %libname -p /sbin/ldconfig
+
+%files -n %libname
+%defattr(644,root,root,755)
+%doc README* AUTHORS ChangeLog NEWS TODO
+%attr(755,root,root) %{_libdir}/lib*.so.*
+%{_libdir}/directfb-%version
+%{_datadir}/directfb-%version
+%{_mandir}/man5/*directfbrc.5*
+
+%files -n %libname-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/*directfb-config
+%attr(755,root,root) %{_bindir}/*directfb-csource
+%attr(755,root,root) %{_bindir}/*dfbg
+%{_includedir}/directfb
+%{_includedir}/directfb-internal
+%{_mandir}/man1/*directfb-csource.1*
+%{_mandir}/man1/*dfbg.1*
+%{_libdir}/pkgconfig/*
+%{_libdir}/*.la
+%{_libdir}/*.so
+
+%files doc
+%defattr(644,root,root,755)
+%doc docs/html/*
+
+%changelog
+* Mon Jan 13 2003 Sven Neumann <neo@directfb.org> 0.9.16
+- removed reference to avifile
+- added rules for dfbg and its man-page
+
+%changelog
+* Sun Oct 27 2002 Sven Neumann <neo@directfb.org> 0.9.14
+- added this file as directfb.spec.in to the DirectFB source tree
+- moved directfbrc manpage to the main package
+
+* Fri Aug 23 2002 Götz Waschk <waschk@linux-mandrake.com> 0.9.13-1mdk
+- add directfb-csource and man page
+- 0.9.13
+
+* Thu Jul 11 2002 Götz Waschk <waschk@linux-mandrake.com> 0.9.12-1mdk
+- initial package based on PLD effort
diff --git a/Source/DirectFB/docs/Makefile.am b/Source/DirectFB/docs/Makefile.am
new file mode 100755
index 0000000..df6c89b
--- /dev/null
+++ b/Source/DirectFB/docs/Makefile.am
@@ -0,0 +1,40 @@
+## Makefile.am for DirectFB/docs
+
+SUBDIRS = html
+
+if BUILD_DIRECTFB_CSOURCE
+csource_mans = directfb-csource.1
+endif
+
+man_MANS = \
+	$(csource_mans)	\
+	dfbg.1		\
+	directfbrc.5
+
+HTMLMANS = $(patsubst %,%.html,$(man_MANS))
+
+
+if HAVE_MAN2HTML
+
+all-local: $(HTMLMANS)
+
+clean-local:
+	rm -f $(HTMLMANS)
+
+%.html: %
+	$(MAN2HTML) $* > $@
+
+else
+
+all-local:
+
+clean-local:
+
+endif
+
+
+EXTRA_DIST = \
+	README.screenshots	\
+	dfbg.1.in		\
+	directfbrc.5.in		\
+	directfb-csource.1.in
diff --git a/Source/DirectFB/docs/Makefile.in b/Source/DirectFB/docs/Makefile.in
new file mode 100755
index 0000000..e139797
--- /dev/null
+++ b/Source/DirectFB/docs/Makefile.in
@@ -0,0 +1,691 @@
+# 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@
+subdir = docs
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/dfbg.1.in $(srcdir)/directfb-csource.1.in \
+	$(srcdir)/directfbrc.5.in
+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 = dfbg.1 directfb-csource.1 directfbrc.5
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"
+man5dir = $(mandir)/man5
+NROFF = nroff
+MANS = $(man_MANS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = html
+@BUILD_DIRECTFB_CSOURCE_TRUE@csource_mans = directfb-csource.1
+man_MANS = \
+	$(csource_mans)	\
+	dfbg.1		\
+	directfbrc.5
+
+HTMLMANS = $(patsubst %,%.html,$(man_MANS))
+EXTRA_DIST = \
+	README.screenshots	\
+	dfbg.1.in		\
+	directfbrc.5.in		\
+	directfb-csource.1.in
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  docs/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  docs/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
+dfbg.1: $(top_builddir)/config.status $(srcdir)/dfbg.1.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+directfb-csource.1: $(top_builddir)/config.status $(srcdir)/directfb-csource.1.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+directfbrc.5: $(top_builddir)/config.status $(srcdir)/directfbrc.5.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+install-man5: $(man5_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
+	done
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(MANS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man5
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man5
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am all-local check check-am clean clean-generic \
+	clean-libtool clean-local ctags ctags-recursive distclean \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-man5 install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-man uninstall-man1 \
+	uninstall-man5
+
+
+@HAVE_MAN2HTML_TRUE@all-local: $(HTMLMANS)
+
+@HAVE_MAN2HTML_TRUE@clean-local:
+@HAVE_MAN2HTML_TRUE@	rm -f $(HTMLMANS)
+
+@HAVE_MAN2HTML_TRUE@%.html: %
+@HAVE_MAN2HTML_TRUE@	$(MAN2HTML) $* > $@
+
+@HAVE_MAN2HTML_FALSE@all-local:
+
+@HAVE_MAN2HTML_FALSE@clean-local:
+# 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/docs/README.screenshots b/Source/DirectFB/docs/README.screenshots
new file mode 100755
index 0000000..7df9595
--- /dev/null
+++ b/Source/DirectFB/docs/README.screenshots
@@ -0,0 +1,58 @@
+How to make DirectFB screenshots
+--------------------------------
+
+There are two ways to generate DirectFB screenshots. The easy way is
+to set the "screenshot-dir" parameter in the DirectFB configuration
+file directfbrc or to pass it as a command-line option. See the
+directfbrc man-page for more details. You can then generate screen
+dumps in the PPM format by pressing the PrintScreen key.  The PPM
+files can easily be converted to others formats using for example the
+netpbm tools.
+
+The hard way to do screenshots is to read directly from the frame
+buffer device. This works for all applications that use the frame
+buffer device, not only for DirectFB applications.
+
+The resulting data is then converted to a more convenient format using
+the netpbm graphics conversion tools.  If the frame buffer is not
+running at 24 bit depth, the data has to be propagated to 24bit RGB
+before netpbm can handle it. The tools directory contains the source
+for two small utilities that do just this:
+
+  raw16toraw24 is a small tool that reads 16bit RGB565 data from stdin,
+  converts to 24bit RGB888 data and writes it to stdout.
+
+  raw15toraw24 is a small tool that reads 15bit RGB555 data from stdin,
+  converts to 24bit RGB888 data and writes it to stdout.
+
+  raw32toraw24 is a small tool that reads 32bit ARGB data from stdin, 
+  converts to 24bit RGB888 data and writes it to stdout.
+
+
+The following steps have to be performed to take screenshots:
+
+Step 1 - Log in from another computer using ssh or telnet. Start your 
+         application and stop it by pressing Ctrl+C in the remote
+	 terminal.
+
+Step 2 - Read data from /dev/fb0 and write it to a file.
+
+ examples:
+  [15bit]  raw15toraw24 < /dev/fb0 > raw24.tmp
+  [16bit]  raw16toraw24 < /dev/fb0 > raw24.tmp
+  [24bit]  cat /dev/fb0 > raw24.tmp
+  [32bit]  raw32toraw24 < /dev/fb0 > raw24.tmp
+
+Step 2 - Convert data to ppm using rawtoppm and specify the resolution of
+         the frame buffer.
+
+ example:  rawtoppm 800 600 raw24.tmp > ppm24.tmp
+
+Step 3 - Convert ppm to png using pnmtopng.
+
+ example : pnmtopng <ppm24.tmp >screenshot.png
+
+
+Thats it!
+
+
diff --git a/Source/DirectFB/docs/dfbg.1.in b/Source/DirectFB/docs/dfbg.1.in
new file mode 100755
index 0000000..04e893a
--- /dev/null
+++ b/Source/DirectFB/docs/dfbg.1.in
@@ -0,0 +1,54 @@
+.\" Hey Emacs! This file is -*- nroff -*- source.
+.\"
+.\" This man page is Copyright (C) 2002-2003 Sven Neumann <neo@directfb.org>
+
+.TH DFBG 1 "9 Jul 2003" "Version @DIRECTFB_VERSION@" "DirectFB Manual Pages"
+
+.SH NAME
+dfbg \- DirectFB background configuration tool
+
+.SH SYNOPSIS
+\fBdfbg\fP [\fIoptions\fP] <\fIfilename\fP>|<color>
+
+.SH DESCRIPTION
+\fBdfbg\fP is a small utility to configure the background of the DirectFB
+desktop. It loads the specified image and sets it as background image.
+
+\fBdfbg\fP requires DirectFB with the multi-application core enabled.
+
+.SH OPTIONS
+.TP
+.B -c, --color
+Set color fill mode using <color> in AARRGGBB format (hexadecimal).
+The alpha component can be omitted in most configurations.
+
+.TP
+.B -t, --tile
+Set tiled mode instead of scaling the image to fit the screen size.
+
+.TP
+.B -v, --version
+Output version information.
+
+.TP
+.B -h, --help
+Print brief help and exit.
+
+.SH EXAMPLES
+
+Set background color to DirectFB's default color
+
+	dfbg -c ff107ce8
+
+Set image stretched to fit the screen
+
+	dfbg bg.png
+
+Set image tiled
+
+	dfbg -t bg.png
+
+
+.SH OTHER INFO
+The canonical place to find informations about DirectFB is at
+http://www.directfb.org/.
diff --git a/Source/DirectFB/docs/directfb-csource.1.in b/Source/DirectFB/docs/directfb-csource.1.in
new file mode 100755
index 0000000..814d55e
--- /dev/null
+++ b/Source/DirectFB/docs/directfb-csource.1.in
@@ -0,0 +1,79 @@
+.\" Hey Emacs! This file is -*- nroff -*- source.
+.\"
+.\" This manual page is Copyright (C) 2002-2003 Sven Neumann <neo@directfb.org>
+
+.TH DIRECTFB-CSOURCE 1 "14 May 2009" "Version @DIRECTFB_VERSION@" "DirectFB Manual Pages"
+
+.SH NAME
+directfb-csource \- C code generation utility for DirectFB surfaces
+
+.SH SYNOPSIS
+\fBdirectfb-csource\fP [\fIoptions\fP] <\fIimagefiles\fP>
+
+.SH DESCRIPTION
+\fBdirectfb-csource\fP is a small utility that reads PNG (Portable
+Network Graphics) image files and generates C code that can be used to
+compile an image into a DirectFB application.  Below is a simple
+example to illustrate this.
+
+If multiple PNG image files are passed to \fBdirectfb-csource\fP, they
+are combined into a single surface. The different images can then be
+blitted from this surface using the array of rectangles that is also
+dumped. This can be useful for example for icons or sprites.
+
+
+.SH OPTIONS
+.TP
+.B --name=identifier
+Specifies the identifier name (prefix) for the generated variables.
+If this option is not used, the identifier is generated from the
+filename. You have to specify an identifer name when processing
+multiple images.
+
+.TP
+.B --format=pixelformat
+Specifies the pixel-format of the generated inline surface. Possible
+values are ARGB, RGB32, RGB24, RGB16, RGB15, RGB332, A8 and LUT8.
+By default the format is ARGB if the PNG image has an alpha channel
+or RGB32 otherwise.
+
+.TP
+.B --dither-rgb16
+If specified, images rendered to RGB16 surfaces are dithered. This
+reduces banding caused by the limited colorspace. This option has no
+effect for other pixel-formats than RGB16.
+
+.TP
+.B --version
+Output version information.
+
+.TP
+.B --help
+Print brief help and exit.
+
+
+.SH EXAMPLE
+Generate a header file from a PNG image file:
+
+	directfb-csource --name=foo foo.png > foo.h
+
+Include the generated header in your application and create a
+surface using the surface description from the header file:
+
+  #include <directfb.h>
+  #include "foo.h"
+
+  IDirectFB        *dfb;
+  IDirectFBSurface *surface;
+
+  ...
+
+  dfb->CreateSurface( dfb, &foo_desc, &surface );
+
+
+.SH OTHER INFO
+\fBdirectfb-csource\fP was inspired by and uses code from
+\fBgdk-pixbuf-csource\fP, a similar program written by Tim Janik.
+
+The canonical place to find informations about DirectFB is at
+http://www.directfb.org/.
diff --git a/Source/DirectFB/docs/directfbrc.5.in b/Source/DirectFB/docs/directfbrc.5.in
new file mode 100755
index 0000000..ed8e879
--- /dev/null
+++ b/Source/DirectFB/docs/directfbrc.5.in
@@ -0,0 +1,583 @@
+.\" Hey Emacs! This file is -*- nroff -*- source.
+.\"
+.\" This man page is Copyright (C) 2002 Sven Neumann <neo@directfb.org>
+
+.TH DIRECTFBRC 5 "03 Mar 2007" "Version @DIRECTFB_VERSION@" "DirectFB Manual Pages"
+
+.SH NAME
+directfbrc \- DirectFB configuration file
+
+
+.SH DESCRIPTION
+
+The
+.B directfbrc
+file is a configuration file read by all DirectFB applications on startup.
+There are two of these: a system-wide one stored in
+.I @SYSCONFDIR@/directfbrc
+and a per-user
+.I
+\fB$HOME\fP/.directfbrc
+which may override system settings.
+
+Further customization is available per executable (basename of argv[0]):
+.I @SYSCONFDIR@/directfbrc.$0
+and a per-user
+.I
+\fB$HOME\fP/.directfbrc.$0
+
+After config files, the environment variable DFBARGS is parsed.
+
+The same parameters that can be used in the
+.B directfbrc
+file can be passed via this variable or on the command-line
+by prefixing them with 
+.BR --dfb:
+separated each with a comma.
+
+.SH SYNTAX
+
+The
+.B directfbrc
+file contains one parameter per line. Comments are introduced by a
+hash sign (#), and continue until the end of the line.  Blank lines
+are ignored.
+
+Most parameters are switches that turn certain features on or off.
+These switches have a no- variant that disables the feature. This
+man-page describes the positive variant and will also note which
+setting is the compiled-in default.
+
+
+.SH PARAMETERS
+
+The following parameters may be specified in the
+.B directfbrc
+file:
+
+.TP
+.BI system=<system>
+Specifies the graphics system to use. The default is to use the Linux
+frame buffer (fbdev) but you can also run DirectFB applications on
+SDL (sdl). Other systems might be added in the future.
+
+.TP
+.BI fbdev=<device>
+Opens the given frame buffer device instead of /dev/fb0.
+
+.TP
+.BI busid=<id>
+Specify the bus location of the card. The option is only used if DirectFB
+doesn't have sysfs support and if unspecified 1:0:0 will be assumed.
+Use this option if the driver fails to detect (or incorrectly detects) your card.
+
+.TP
+.BI mode=<width>x<height>
+Sets the default screen resolution. If unspecified DirectFB will use
+the first mode from
+.I /etc/fb.modes
+Some frame buffer devices (namely vesafb) don't support mode switches
+and can only be used in the resolution that is set on boot time.
+
+.TP
+.BI scaled=<width>x<height>
+Scale the window to this size for 'force-windowed' apps.
+
+.TP
+.BI depth=<pixeldepth>
+Sets the default pixel depth in bits per pixel. If unspecified
+DirectFB will use the depth specified in the first mode from
+.I /etc/fb.modes
+DirectFB supports color depths of 8, 15, 16, 24 and 32. Which values
+are available depends on the frame buffer device you are using. Some
+frame buffer devices (namely vesafb) don't support mode switches at
+all and can only be used in the pixel depth that is set at boot time.
+
+.TP
+.BI pixelformat=<pixelformat>
+Sets the default pixel format. This is similar to the depth parameter
+described above but allows more fine-grained control. Possible values
+for pixelformat are LUT8, RGB332, RGB16, RGB24 and RGB32. Some drivers
+may also support the more exotic pixel formats A8, ALUT44, ARGB, ARGB1555,
+I420, UYVY, YUY2 and YV12.
+
+.TP
+.BI session=<num>
+Selects the multi application world which is joined or created.
+Starting with zero, negative values force creation of a new
+world using the lowest unused session number. This will override
+the environment variable "DIRECTFB_SESSION".
+
+.TP
+.BI force-slave
+Always enter as a slave, waiting for the master, if not there.
+
+.TP
+.BI remote=<host>[:<session>]
+Select the remote session to connect to.
+
+.TP
+.BI tmpfs=<directory>
+Uses the given directory (tmpfs mount point) for creation of the
+shared memory file in multi application mode. This option is only
+useful if the automatic detection fails or if non-tmpfs storage
+is desired.
+
+.TP
+.BI shmfile-group=<groupname>
+Group that owns shared memory files.
+
+.TP
+.BI memcpy=<method>
+With this option the probing of memcpy() routines can be skipped,
+saving a lot of startup time. Pass "help" for a list of possible
+values.
+
+.TP
+.BI primary-layer=<id>
+Selects which layer is the "primary layer", default is the first.
+Check 'dfbinfo' for a list of layers supported by your hardware.
+
+.TP
+.BI primary-only
+Tell application only about the primary layer.
+
+.TP
+.BI quiet
+Suppresses console output from DirectFB. Only error messages will be
+displayed.
+
+.TP
+.BI [no-]banner
+Enables the output of the DirectFB banner at startup. This is on by
+default.
+
+.TP
+.BI [no-]debug
+Enables debug output. This is on by default but you won't see any
+debug output unless you compiled DirectFB with debugging support.
+
+.TP
+.BI [no-]debugmem
+Enable memory allocation tracking.
+
+.TP
+.BI [no-]debugshm
+Enable shared memory allocation tracking.
+
+.TP
+.BI [no-]trace
+Enable stack trace support. This is on by default but you won't see any
+trcae output unless you compiled DirectFB with trace support.
+
+.TP
+.BI log-file=<name>
+Write all messages to the specified file.
+
+.TP
+.BI log-udp=<host>:<port>
+Send all messages via UDP to the specified host and port.
+
+.TP
+.BI fatal-level=<level>
+Abort on NONE, ASSERT (default) or ASSUME (incl. assert)
+
+.TP
+.BI force-windowed
+Forces the primary surface to be a window. This allows to run
+applications that were written to do full-screen access in a window.
+
+.TP
+.BI force-desktop
+Forces the primary surface to be the background surface of the desktop.
+
+.TP
+.BI [no-]hardware
+Turns hardware acceleration on. By default hardware acceleration is
+auto-detected. If you disable hardware acceleration, the driver for
+your graphics card will still be loaded and used to access additional
+display layers (if there are any), but all graphics operations will
+be performed by the software renderer.
+
+.TP
+.BI [no-]software
+This option allows to disable software fallbacks.
+
+.TP
+.BI [no-]dma
+Turns DMA acceleration on, if supported by the driver. By default 
+DMA acceleration is off.
+
+.TP
+.BI [no-]sync
+Flushes all disk buffers before initializing DirectFB. This can be
+useful if you working with experimental device drivers and expect
+crashes. The default is not to sync.
+
+.TP
+.BI [no-]mmx
+The no-mmx options allows to disable the use of MMX routines even if
+support for MMX was detected. By default MMX is used if is available
+and support for MMX was compiled in.
+
+.TP
+.BI [no-]agp[=mode]
+Turns AGP memory support on. The option enables DirectFB using the AGP
+memory to extend the amount of video memory available. You can specify
+the AGP mode to use (e.g. 1, 2, 4, 8 or 0 to disable agp). By default
+AGP memory support is off.
+
+.TP
+.BI [no-]thrifty-surface-buffers
+Free sysmem instance on xfer to video memory.
+
+.TP
+.BI font-format=<format>
+Specify the font format to use. Possible values are A1, A8, ARGB, ARGB1555, 
+ARGB2554, ARGB4444, AiRGB. The default font format is A8 because it is the 
+only format that ensures high quality, fast rendering and low memory consumption
+at the same time. Use this option only if your fonts looks strange or if 
+font rendering is too slow.
+
+.TP
+.BI [no-]sighandler
+By default DirectFB installs a signal handler for a number of signals
+that cause an application to exit. This signal handler tries to
+deinitialize the DirectFB engine before quitting the application.
+Use this option to enable/disable this feature.
+
+.TP
+.BI dont-catch=<num>[[,<num>]...]
+As described with the
+.B
+sighandler
+option, DirectFB installs a signal handler for a number of signals.
+By using this option you may specify a list of signals that shouldn't
+be handled this way.
+
+.TP
+.BI [no-]deinit-check
+By default DirectFB checks if the application has released all allocated
+resources on exit. If it didn't, it will clean up after the application.
+This option allows to switch this feature on or off.
+
+.TP
+.BI block-all-signals
+This option activates blocking of all signals, useful for DirectFB daemons
+(a DirectFB master application that does nothing except being the master).
+
+.TP
+.BI [no-]vt-switch
+By default DirectFB allocates a new virtual terminal and switches to
+it.
+
+.TP
+.BI vt-num=<num>
+Use given VT instead of current/new one.
+
+.TP
+.BI [no-]vt-switching
+Allow to switch virtual terminals using <Ctrl>+<Alt>+<F?>. This is an
+experimental feature that is usually disabled; use at your own risk.
+
+.TP
+.BI [no-]graphics-vt
+Puts the virtual terminal into graphics mode. This has the advantage
+that kernel messages won't show up on your screen while the DirectFB
+application is running.
+
+.TP
+.BI [no-]vt
+Use VT handling code at all?
+
+.TP
+.BI mouse-source=<device>
+Specify the serial mouse device.
+
+.TP
+.BI [no-]mouse-gpm-source
+Enables using GPM as mouse input repeater.
+
+.TP
+.BI [no-]motion-compression
+Usually DirectFB compresses mouse motion events. This means that
+subsequent mouse motions are delivered to the application as a single
+mouse motion event. This leads to a more responsive but less exact
+mouse handling.
+
+.TP
+.BI mouse-protocol=<protocol>
+Specifies the mouse protocol to use. The following
+protocols are supported: 
+
+.BI MS
+Two button mouse using the Microsoft mouse protocol.
+
+.BI MS3
+Three button mouse using an extended Microsoft mouse protocol.
+
+.BI MouseMan
+Three button mouse using a different extension to the Microsoft mouse
+protocol introduced by Logitech.
+
+.BI MouseSystems
+The most commonly used protocol for three button mice.
+
+.BI PS/2
+Two/three button mice of the PS/2 series.
+
+.BI IMPS/2
+Two/three button USB mice with scrolling wheel using the 
+Microsoft Intellimouse protocol.
+
+The different protocols for serial mice are described in more detail
+in mouse(4).
+
+.TP
+.BI [no-]lefty
+Swaps left and right mouse buttons. Useful for left-handers.
+
+.TP
+.BI [no-]capslock-meta
+Map the CapsLock key to Meta. Useful for users of the builtin WM
+without a Meta key on the keyboard (e.g. Window key).
+
+.TP
+.BI linux-input-ir-only
+Ignore all non-IR Linux Input devices.
+
+.TP
+.BI [no-]linux-input-grab
+Grab Linux Input devices. When a device is grabbed only DirectFB
+will receive events from it. The default is to not grab.
+
+.TP
+.BI [no-]cursor
+By default DirectFB shows a mouse cursor when an application makes use
+of windows. This option allows to switch the cursor off permanently.
+Applications cannot enable it explicitly.
+
+.TP
+.BI wm=<wm>
+Specify the window manager to use.
+
+.TP
+.BI bg-none
+Completely disables background handling. Doesn't make much sense since
+the mouse and moving windows will leave ugly traces on the background.
+
+.TP
+.BI bg-color=AARRGGBB
+Controls the color of the background. The color is specified in
+hexadecimal notation. The alpha value defaults to full opacity and may
+be omitted. For example to choose a bright magenta background, you'd
+use bg-color=FF00FF.
+
+.TP
+.BI bg-image=<filename>
+Fills the background with the given image from file. The image is stretched
+to fit to the screen dimensions.
+
+.TP
+.BI bg-tile=<filename>
+Like
+.B bg-image
+but tiles the image to fit to the screen dimensions instead of
+stretching it.
+
+.TP
+.BI [no-]translucent-windows
+By default DirectFB windows may be translucent. If you disable this
+feature, windows are forced to be either fully opaque or fully
+transparent. This is useful if your graphics card doesn't support
+alpha-transparent blits.
+
+.TP
+.BI [no-]decorations
+Enables window decorations if supported by the window manager.
+
+.TP
+.BI videoram-limit=<amount>
+Limits the amount of Video RAM used by DirectFB. The amount of Video
+RAM is specified in Kilobytes.
+
+.TP
+.BI agpmem-limit=<amount>
+Limits the amount if AGP memory used by DirectFB. The amount of AGP
+memory is specified in Kilobytes.
+
+.TP
+.BI screenshot-dir=<directory>
+If specified DirectFB will dump the screen contents in PPM format
+into this directory when the <Print> key gets pressed.
+
+.TP
+.BI disable-module=<modulename>
+Suppress loading of this module. The module name is the filename
+without the \fBlibdirectfb_\fP prefix and without extension (for
+example \fBkeyboard\fP to disable loading of the keyboard input
+module).
+
+.TP
+.BI [no-]matrox-sgram
+Some older Matrox G400 cards have SGRAM and a number of graphics
+operations are considerably faster on these cards if this feature
+is enabled. Don't try to enable it if your card doesn't have SGRAM!
+Otherwise you'd have to reboot.
+
+.TP
+.BI [no-]matrox-crtc2
+If you have a dual head G400/G450/G550 you can use this option to
+enable additional layers using the second head.
+
+.TP
+.BI matrox-tv-standard=[pal|ntsc]
+Controls the signal produced by the TV output of Matrox cards.
+
+.TP
+.BI matrox-cable-type=(composite|scart-rgb|scart-composite)
+Matrox cable type (default=composite).
+
+.TP
+.BI h3600-device=<device>
+Use this device for the H3600 TS driver.
+
+.TP
+.BI mut-device=<device>
+Use this device for the MuTouch driver.
+
+.TP
+.BI penmount-device=<device>
+Use this device for the PenMount driver.
+
+.TP
+.BI linux-input-devices=<device>[[,<device>]...]
+Use these devices for the Linux Input driver.
+
+.TP
+.BI tslib-devices=<device>[[,<device>]...]
+Use these devices for the tslib driver.
+
+.TP
+.BI unichrome-revision=<revision>
+Override the hardware revision number used by the Unichrome driver.
+
+.TP
+.BI i8xx_overlay_pipe_b
+Redirect videolayer to pixelpipe B.
+
+.TP
+.BI window-surface-policy=<policy>
+Allows to control where window surfaces are stored. Supported values
+for <policy> are:
+
+.BI auto
+DirectFB decides depending on hardware capabilities. This is the
+default.
+
+.BI videohigh
+Swapping system/video with high priority.
+
+.BI videolow
+Swapping system/video with low priority.
+
+.BI systemonly
+Window surfaces are stored in system memory.
+
+.BI videoonly
+Window surfaces are stored in video memory.
+
+.TP
+.BI desktop-buffer-mode=<mode>
+Allows to control the desktop buffer mode. Whenever a window is moved,
+opened, closed, resized or its contents change DirectFB recomposites
+the window stack at the affected region. This is done by blitting the
+windows together that are visible within that region. Opaque windows
+are blitted directly while translucent windows are blitted using alpha
+blending or color keying. If there's a back buffer the recomposition is
+not visible since only the final result is copied into the front
+buffer. Without a back buffer each step of the recomposition is visible.
+This causes noticeable flicker unless all windows are opaque.
+
+Supported values for <mode> are:
+
+.BI auto
+DirectFB decides depending on hardware capabilities. This is the
+default. DirectFB chooses a back buffer in video memory if the hardware
+supports simple blitting (copying from back to front buffer). If
+there's no acceleration at all the back buffer is allocated in system
+memory since that gives much better performance for alpha blended
+recomposition in software and avoids reading from the video memory
+when the result is copied to the front buffer.
+
+.BI backsystem
+The back buffer is allocated in system memory. This is the recommend
+choice if your hardware supports simple blitting but no alpha blending
+and you are going to have many alpha blended windows.
+
+.BI backvideo
+Front and back buffer are allocated in video memory. It's not required
+to set this mode explicitly because the 'auto' mode chooses it if
+blits are accelerated. Without accelerated blits this mode is not
+recommended.
+
+.BI triple
+Like backvideo except the surface is triple buffered.
+
+.BI frontonly
+There is no back buffer. This is the best choice if you are using
+opaque windows only and don't use any color keying.
+
+.BI windows
+Special mode with window buffers directly displayed. This mode
+requires special hardware support.
+
+.TP
+.BI vsync-after
+Wait for the vertical retrace after flipping. The default is to wait
+before doing the flip.
+
+.TP
+.BI vsync-none
+Disables polling for vertical retrace.
+
+
+.SH EXAMPLES
+
+Here are some examples that demonstrates how the parameters described
+above are passed to DirectFB application on the command-line.
+
+.TP
+.B df_neo --dfb:no-hardware
+Starts df_neo without hardware acceleration.
+.TP
+.B df_neo --dfb:help
+Lists the DirectFB options that can be passed to df_neo.
+
+
+.SH OTHER INFO
+
+The canonical place to find informations about DirectFB is at
+http://www.directfb.org/.  Here you can find the FAQ, tutorials,
+mailing list archives, the CVS tree and can download the latest
+version of the DirectFB library as well as a number of applications.
+
+
+.SH FILES
+
+.TP
+.I @SYSCONFDIR@/directfbrc
+system-wide DirectFB configuration file
+.TP
+.I $HOME/.directfbrc
+per-user DirectFB configuration file
+.TP
+.I /etc/fb.modes
+frame buffer modes file
+
+
+.SH SEE ALSO
+.BR fb.modes (5),
+.BR fbset (8),
+.BR mouse (4),
+.BR ppm (5)
diff --git a/Source/DirectFB/docs/html/Makefile.am b/Source/DirectFB/docs/html/Makefile.am
new file mode 100755
index 0000000..a248e4c
--- /dev/null
+++ b/Source/DirectFB/docs/html/Makefile.am
@@ -0,0 +1,16 @@
+EXTRA_DIST = dfb_logo-alpha.png
+
+docs_headers = \
+	$(top_srcdir)/include/directfb.h \
+	$(top_srcdir)/include/directfb_keyboard.h \
+	$(top_srcdir)/include/directfbgl.h
+
+all-local: stamp-docs
+
+stamp-docs: $(top_srcdir)/tools/gendoc.pl $(docs_headers) Makefile.am
+	rootme=`pwd`; \
+	$(PERL) $(top_srcdir)/tools/gendoc.pl DirectFB $(DIRECTFB_VERSION) $(docs_headers) \
+	&& echo timestamp > $$rootme/stamp-docs
+
+distclean-local:
+	rm -f *.html stamp-docs
diff --git a/Source/DirectFB/docs/html/Makefile.in b/Source/DirectFB/docs/html/Makefile.in
new file mode 100755
index 0000000..e6ec491
--- /dev/null
+++ b/Source/DirectFB/docs/html/Makefile.in
@@ -0,0 +1,414 @@
+# 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@
+subdir = docs/html
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+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@
+EXTRA_DIST = dfb_logo-alpha.png
+docs_headers = \
+	$(top_srcdir)/include/directfb.h \
+	$(top_srcdir)/include/directfb_keyboard.h \
+	$(top_srcdir)/include/directfbgl.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  docs/html/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  docs/html/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+	clean-libtool distclean distclean-generic distclean-libtool \
+	distclean-local distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am
+
+
+all-local: stamp-docs
+
+stamp-docs: $(top_srcdir)/tools/gendoc.pl $(docs_headers) Makefile.am
+	rootme=`pwd`; \
+	$(PERL) $(top_srcdir)/tools/gendoc.pl DirectFB $(DIRECTFB_VERSION) $(docs_headers) \
+	&& echo timestamp > $$rootme/stamp-docs
+
+distclean-local:
+	rm -f *.html stamp-docs
+# 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/docs/html/dfb_logo-alpha.png b/Source/DirectFB/docs/html/dfb_logo-alpha.png
new file mode 100755
index 0000000..7df3835
Binary files /dev/null and b/Source/DirectFB/docs/html/dfb_logo-alpha.png differ
diff --git a/Source/DirectFB/fb.modes b/Source/DirectFB/fb.modes
new file mode 100755
index 0000000..01a239d
--- /dev/null
+++ b/Source/DirectFB/fb.modes
@@ -0,0 +1,90 @@
+#
+#   DirectFB video modes, should be placed into "/etc"
+# 
+
+mode "640x480 75Hz 16bit"
+    # D: 31.50 MHz, H: 37.500 kHz, V: 75.00 Hz
+    geometry 640 480 640 480 16
+    timings 31747 120 16 16 1 64 3
+endmode
+ 
+mode "720x576 50Hz 16bit"
+    geometry 720 576 720 576 16
+    timings 31208 144 40 32 10 128 3
+endmode
+
+mode "768x576 75Hz 16bit"
+    # D: 49.188 MHz, H: 46.580 kHz, V: 75.008 Hz
+    geometry 768 576 768 576 16
+    timings 20330 128 32 32 8 128 5
+endmode
+
+
+mode "800x600 75Hz 16bit"
+    # D: 49.50 MHz, H: 46.875 kHz, V: 75.00 Hz
+    geometry 800 600 800 600 16
+    timings 20203 160 16 21 1 80 3
+    hsync high
+    vsync high
+endmode
+ 
+
+mode "1024x768 72Hz 16bit"
+    # D: 75.00 MHz, H: 58.230 kHz, V: 72.245 Hz
+    geometry 1024 768 1024 768 16
+    timings 13334 104 24 29 3 136 6
+endmode
+ 
+
+mode "1280x1024-75"
+    # D: 134.880 MHz, H: 79.905 kHz, V: 74.958 Hz
+    geometry 1280 1024 1280 3264 16
+    timings 7414 232 64 38 1 112 3
+    hsync high
+    vsync high
+endmode
+
+mode "1280x1024 60Hz 16bit"
+    # D: 108.00 MHz, H: 63.981 kHz, V: 60.02 Hz
+    geometry 1280 1024 1280 1024 16
+    timings 9260 248 48 38 1 112 3
+    hsync high
+    vsync high
+endmode
+ 
+
+mode "1600x1200 60Hz 16bit"
+    # D: 156.00 MHz, H: 76.200 kHz, V: 60.00 Hz
+    geometry 1600 1200 1600 1200 16
+    timings 6411 256 32 52 10 160 8
+endmode
+
+
+mode "640x400 93Hz 16bit"
+    geometry 640 400 640 400 16
+    timings 28272 48 32 17 22 128 12
+endmode
+
+mode "400x300 100Hz 16bit"
+    geometry 400 300 400 300 16
+    timings 31747 40 16 16 1 40 3
+    double true
+endmode
+
+
+mode "320x240 85Hz 16bit"
+    geometry 320 240 320 240 16
+    timings 51383 32 32 20 4 48 1
+    double true
+endmode
+
+mode "320x200 85Hz 16bit"
+    geometry 320 200 320 200 16
+    timings 60440 32 32 20 4 48 1
+    double true
+endmode
+
+mode "2048x480 60Hz 16bit"
+    geometry 2048 480 2048 480 16
+    timings 6411 256 32 52 10 160 8
+endmode
diff --git a/Source/DirectFB/gfxdrivers/Makefile.am b/Source/DirectFB/gfxdrivers/Makefile.am
new file mode 100755
index 0000000..270cf31
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/Makefile.am
@@ -0,0 +1,151 @@
+## Makefile.am for DirectFB/gfxdrivers
+
+if GFX_ATI128
+ATI128_DIR = ati128
+else
+ATI128_DIR =
+endif
+
+if GFX_CLE266
+CLE266_DIR = cle266
+else
+CLE266_DIR =
+endif
+
+if GFX_CYBER5K
+CYBER5K_DIR = cyber5k
+else
+CYBER5K_DIR =
+endif
+
+if GFX_DAVINCI
+DAVINCI_DIR = davinci
+else
+DAVINCI_DIR =
+endif
+
+if GFX_GL
+GL_DIR = gl
+else
+GL_DIR =
+endif
+
+if GFX_I810
+I810_DIR = i810
+else
+I810_DIR =
+endif
+
+if GFX_I830
+I830_DIR = i830
+else
+I830_DIR =
+endif
+
+if GFX_MACH64
+MACH64_DIR = mach64
+else
+MACH64_DIR =
+endif
+
+if GFX_MATROX
+MATROX_DIR = matrox
+else
+MATROX_DIR =
+endif
+
+if GFX_NEOMAGIC
+NEOMAGIC_DIR = neomagic
+else
+NEOMAGIC_DIR =
+endif
+
+if GFX_NSC
+NSC_DIR = nsc
+else
+NSC_DIR =
+endif
+
+if GFX_NVIDIA
+NVIDIA_DIR = nvidia
+else
+NVIDIA_DIR =
+endif
+
+if GFX_OMAP
+OMAP_DIR = omap
+else
+OMAP_DIR =
+endif
+
+if GFX_RADEON
+RADEON_DIR = radeon
+else
+RADEON_DIR =
+endif
+
+if GFX_SAVAGE
+SAVAGE_DIR = savage
+else
+SAVAGE_DIR =
+endif
+
+if GFX_SH772X
+SH772X_DIR = sh772x
+else
+SH772X_DIR =
+endif
+
+if GFX_SIS315
+SIS315_DIR = sis315
+else
+SIS315_DIR =
+endif
+
+if GFX_TDFX
+TDFX_DIR = tdfx
+else
+TDFX_DIR =
+endif
+
+if GFX_UNICHROME
+UNICHROME_DIR = unichrome
+else
+UNICHROME_DIR =
+endif
+
+if GFX_VMWARE
+VMWARE_DIR = vmware
+else
+VMWARE_DIR =
+endif
+
+if GFX_EP9X
+EP9X_DIR = ep9x
+else
+EP9X_DIR =
+endif
+
+
+SUBDIRS = \
+	$(ATI128_DIR)	\
+	$(CLE266_DIR)	\
+	$(CYBER5K_DIR)	\
+	$(DAVINCI_DIR)	\
+	$(EP9X_DIR)	\
+	$(GL_DIR)	\
+	$(I810_DIR)	\
+	$(I830_DIR)	\
+	$(MACH64_DIR)	\
+	$(MATROX_DIR)	\
+	$(NEOMAGIC_DIR)	\
+	$(NSC_DIR)	\
+	$(NVIDIA_DIR)	\
+	$(OMAP_DIR)	\
+	$(RADEON_DIR)	\
+	$(SAVAGE_DIR)	\
+	$(SH772X_DIR)	\
+	$(SIS315_DIR)	\
+	$(TDFX_DIR)	\
+	$(UNICHROME_DIR) \
+	$(VMWARE_DIR)
diff --git a/Source/DirectFB/gfxdrivers/Makefile.in b/Source/DirectFB/gfxdrivers/Makefile.in
new file mode 100755
index 0000000..b9a2671
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/Makefile.in
@@ -0,0 +1,622 @@
+# 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@
+subdir = gfxdrivers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = ati128 cle266 cyber5k davinci ep9x gl i810 i830 mach64 \
+	matrox neomagic nsc nvidia omap radeon savage sh772x sis315 \
+	tdfx unichrome vmware
+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@
+@GFX_ATI128_FALSE@ATI128_DIR = 
+@GFX_ATI128_TRUE@ATI128_DIR = ati128
+@GFX_CLE266_FALSE@CLE266_DIR = 
+@GFX_CLE266_TRUE@CLE266_DIR = cle266
+@GFX_CYBER5K_FALSE@CYBER5K_DIR = 
+@GFX_CYBER5K_TRUE@CYBER5K_DIR = cyber5k
+@GFX_DAVINCI_FALSE@DAVINCI_DIR = 
+@GFX_DAVINCI_TRUE@DAVINCI_DIR = davinci
+@GFX_GL_FALSE@GL_DIR = 
+@GFX_GL_TRUE@GL_DIR = gl
+@GFX_I810_FALSE@I810_DIR = 
+@GFX_I810_TRUE@I810_DIR = i810
+@GFX_I830_FALSE@I830_DIR = 
+@GFX_I830_TRUE@I830_DIR = i830
+@GFX_MACH64_FALSE@MACH64_DIR = 
+@GFX_MACH64_TRUE@MACH64_DIR = mach64
+@GFX_MATROX_FALSE@MATROX_DIR = 
+@GFX_MATROX_TRUE@MATROX_DIR = matrox
+@GFX_NEOMAGIC_FALSE@NEOMAGIC_DIR = 
+@GFX_NEOMAGIC_TRUE@NEOMAGIC_DIR = neomagic
+@GFX_NSC_FALSE@NSC_DIR = 
+@GFX_NSC_TRUE@NSC_DIR = nsc
+@GFX_NVIDIA_FALSE@NVIDIA_DIR = 
+@GFX_NVIDIA_TRUE@NVIDIA_DIR = nvidia
+@GFX_OMAP_FALSE@OMAP_DIR = 
+@GFX_OMAP_TRUE@OMAP_DIR = omap
+@GFX_RADEON_FALSE@RADEON_DIR = 
+@GFX_RADEON_TRUE@RADEON_DIR = radeon
+@GFX_SAVAGE_FALSE@SAVAGE_DIR = 
+@GFX_SAVAGE_TRUE@SAVAGE_DIR = savage
+@GFX_SH772X_FALSE@SH772X_DIR = 
+@GFX_SH772X_TRUE@SH772X_DIR = sh772x
+@GFX_SIS315_FALSE@SIS315_DIR = 
+@GFX_SIS315_TRUE@SIS315_DIR = sis315
+@GFX_TDFX_FALSE@TDFX_DIR = 
+@GFX_TDFX_TRUE@TDFX_DIR = tdfx
+@GFX_UNICHROME_FALSE@UNICHROME_DIR = 
+@GFX_UNICHROME_TRUE@UNICHROME_DIR = unichrome
+@GFX_VMWARE_FALSE@VMWARE_DIR = 
+@GFX_VMWARE_TRUE@VMWARE_DIR = vmware
+@GFX_EP9X_FALSE@EP9X_DIR = 
+@GFX_EP9X_TRUE@EP9X_DIR = ep9x
+SUBDIRS = \
+	$(ATI128_DIR)	\
+	$(CLE266_DIR)	\
+	$(CYBER5K_DIR)	\
+	$(DAVINCI_DIR)	\
+	$(EP9X_DIR)	\
+	$(GL_DIR)	\
+	$(I810_DIR)	\
+	$(I830_DIR)	\
+	$(MACH64_DIR)	\
+	$(MATROX_DIR)	\
+	$(NEOMAGIC_DIR)	\
+	$(NSC_DIR)	\
+	$(NVIDIA_DIR)	\
+	$(OMAP_DIR)	\
+	$(RADEON_DIR)	\
+	$(SAVAGE_DIR)	\
+	$(SH772X_DIR)	\
+	$(SIS315_DIR)	\
+	$(TDFX_DIR)	\
+	$(UNICHROME_DIR) \
+	$(VMWARE_DIR)
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  gfxdrivers/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/ati128/Makefile.am b/Source/DirectFB/gfxdrivers/ati128/Makefile.am
new file mode 100755
index 0000000..aaa6b04
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/Makefile.am
@@ -0,0 +1,41 @@
+## Makefile.am for DirectFB/src/core/gfxcards/ati128
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+
+ati128dir = $(MODULEDIR)/gfxdrivers
+
+ati128_LTLIBRARIES = libdirectfb_ati128.la
+
+if BUILD_STATIC
+ati128_DATA = $(ati128_LTLIBRARIES:.la=.o)
+endif
+
+
+libdirectfb_ati128_la_SOURCES =	\
+	ati128.c		\
+	ati128.h		\
+	ati128_overlay.c	\
+	ati128_state.c		\
+	ati128_state.h		\
+	regs.h			\
+	mmio.h
+
+libdirectfb_ati128_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ati128_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/ati128/Makefile.in b/Source/DirectFB/gfxdrivers/ati128/Makefile.in
new file mode 100755
index 0000000..a1c01ee
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/Makefile.in
@@ -0,0 +1,603 @@
+# 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/ati128
+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)$(ati128dir)" "$(DESTDIR)$(ati128dir)"
+ati128LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(ati128_LTLIBRARIES)
+libdirectfb_ati128_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_ati128_la_OBJECTS = ati128.lo ati128_overlay.lo \
+	ati128_state.lo
+libdirectfb_ati128_la_OBJECTS = $(am_libdirectfb_ati128_la_OBJECTS)
+libdirectfb_ati128_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_ati128_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_ati128_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_ati128_la_SOURCES)
+ati128DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(ati128_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+ati128dir = $(MODULEDIR)/gfxdrivers
+ati128_LTLIBRARIES = libdirectfb_ati128.la
+@BUILD_STATIC_TRUE@ati128_DATA = $(ati128_LTLIBRARIES:.la=.o)
+libdirectfb_ati128_la_SOURCES = \
+	ati128.c		\
+	ati128.h		\
+	ati128_overlay.c	\
+	ati128_state.c		\
+	ati128_state.h		\
+	regs.h			\
+	mmio.h
+
+libdirectfb_ati128_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ati128_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/ati128/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/ati128/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-ati128LTLIBRARIES: $(ati128_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(ati128dir)" || $(MKDIR_P) "$(DESTDIR)$(ati128dir)"
+	@list='$(ati128_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ati128LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(ati128dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ati128LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(ati128dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-ati128LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ati128_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(ati128dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(ati128dir)/$$p"; \
+	done
+
+clean-ati128LTLIBRARIES:
+	-test -z "$(ati128_LTLIBRARIES)" || rm -f $(ati128_LTLIBRARIES)
+	@list='$(ati128_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_ati128.la: $(libdirectfb_ati128_la_OBJECTS) $(libdirectfb_ati128_la_DEPENDENCIES) 
+	$(libdirectfb_ati128_la_LINK) -rpath $(ati128dir) $(libdirectfb_ati128_la_OBJECTS) $(libdirectfb_ati128_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati128.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati128_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati128_state.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-ati128DATA: $(ati128_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(ati128dir)" || $(MKDIR_P) "$(DESTDIR)$(ati128dir)"
+	@list='$(ati128_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(ati128DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ati128dir)/$$f'"; \
+	  $(ati128DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ati128dir)/$$f"; \
+	done
+
+uninstall-ati128DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ati128_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(ati128dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(ati128dir)/$$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)$(ati128dir)" "$(DESTDIR)$(ati128dir)"; 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-ati128LTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-ati128DATA install-ati128LTLIBRARIES
+
+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-ati128DATA uninstall-ati128LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-ati128LTLIBRARIES clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-ati128DATA \
+	install-ati128LTLIBRARIES install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-ati128DATA uninstall-ati128LTLIBRARIES
+
+%.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/ati128/ati128.c b/Source/DirectFB/gfxdrivers/ati128/ati128.c
new file mode 100755
index 0000000..4ae34c6
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/ati128.c
@@ -0,0 +1,842 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.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>
+
+#include <gfx/convert.h>
+
+#include <core/graphics_driver.h>
+
+
+DFB_GRAPHICS_DRIVER( ati128 )
+
+
+#include "regs.h"
+#include "mmio.h"
+#include "ati128_state.h"
+#include "ati128.h"
+
+
+/* driver capability flags */
+
+
+#ifndef __powerpc__
+#define ATI128_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+#else
+#define ATI128_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_NOFX)
+#endif
+
+#define ATI128_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE)
+
+#define ATI128_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_SRC_COLORKEY | DSBLIT_BLEND_ALPHACHANNEL)
+
+#define ATI128_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT)
+
+
+/* macro for S12.0 and S14.0 format */
+#define S12(val) (((u16)((s16)(val)))&0x3fff)
+#define S14(val) (((u16)((s16)(val)))&0x3fff)
+
+/** CARD FUNCTIONS **/
+static bool ati128FillRectangle( void *drv, void *dev, DFBRectangle *rect );
+static bool ati128FillBlendRectangle( void *drv, void *dev, DFBRectangle *rect );
+static bool ati128DrawRectangle( void *drv, void *dev, DFBRectangle *rect );
+static bool ati128DrawBlendRectangle( void *drv, void *dev, DFBRectangle *rect );
+
+/* required implementations */
+
+static DFBResult ati128EngineSync( void *drv, void *dev )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+
+     ati128_waitidle( adrv, adev );
+
+     return DFB_OK;
+}
+
+static bool ati128_check_blend( CardState *state )
+{
+   if (state->dst_blend == DSBF_SRCALPHASAT)
+      return false;
+
+   return true;
+}
+
+static void ati128CheckState( void *drv, void *dev,
+                              CardState *state, DFBAccelerationMask accel )
+{
+     switch (state->destination->config.format) {
+          case DSPF_RGB332:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     /* check for the special drawing function that does not support
+        the usually supported drawingflags */
+     if (accel == DFXL_DRAWLINE  &&  state->drawingflags != DSDRAW_NOFX)
+          return;
+
+     /* if there are no other drawing flags than the supported */
+     if (!(accel & ~ATI128_SUPPORTED_DRAWINGFUNCTIONS) &&
+         !(state->drawingflags & ~ATI128_SUPPORTED_DRAWINGFLAGS)) {
+          if (state->drawingflags & DSDRAW_BLEND &&
+              !ati128_check_blend( state ))
+               return;
+
+          state->accel |= ATI128_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+
+     /* if there are no other blitting flags than the supported
+        and the source has the minimum size */
+     if (!(accel & ~ATI128_SUPPORTED_BLITTINGFUNCTIONS) &&
+         !(state->blittingflags & ~ATI128_SUPPORTED_BLITTINGFLAGS)  &&
+         state->source &&
+         state->source->config.size.w >= 8 &&
+         state->source->config.size.h >= 8 )
+     {
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL &&
+              !ati128_check_blend( state ))
+               return;
+
+          switch (state->source->config.format) {
+               case DSPF_RGB332:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB24:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    state->accel |= ATI128_SUPPORTED_BLITTINGFUNCTIONS;
+               default:
+                    ;
+          }
+     }
+}
+
+
+static void ati128SetState( void *drv, void *dev,
+                            GraphicsDeviceFuncs *funcs,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+
+     if (state->mod_hw & SMF_SOURCE)
+         adev->v_source = 0;
+
+     if (state->mod_hw & SMF_DESTINATION)
+          adev->v_destination = adev->v_color = 0;
+
+     if (state->mod_hw & SMF_COLOR)
+          adev->v_color = 0;
+
+     if (state->mod_hw & SMF_SRC_COLORKEY)
+          adev->v_src_colorkey = 0;
+
+     if (state->mod_hw & SMF_BLITTING_FLAGS)
+          adev->v_blittingflags = 0;
+
+     if (state->mod_hw & (SMF_SRC_BLEND | SMF_DST_BLEND))
+          adev->v_blending_function = 0;
+
+     ati128_set_destination( adrv, adev, state);
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+               if (state->drawingflags & DSDRAW_BLEND) {
+                    ati128_set_blending_function( adrv, adev, state );
+                    funcs->FillRectangle = ati128FillBlendRectangle;
+                    funcs->DrawRectangle = ati128DrawBlendRectangle;
+               }
+               else {
+                    funcs->FillRectangle = ati128FillRectangle;
+                    funcs->DrawRectangle = ati128DrawRectangle;
+               }
+          case DFXL_DRAWLINE:
+               ati128_set_color( adrv, adev, state );
+               state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWLINE | DFXL_DRAWRECTANGLE ;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               ati128_set_source( adrv, adev, state );
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    ati128_set_blending_function( adrv, adev, state );
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    ati128_set_src_colorkey( adrv, adev, state );
+               ati128_set_blittingflags( adrv, adev, state );
+               state->set |= DFXL_BLIT | DFXL_STRETCHBLIT;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     if (state->mod_hw & SMF_CLIP)
+          ati128_set_clip( adrv, adev, state);
+
+     state->mod_hw = 0;
+}
+
+static bool ati128FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     ati128_waitfifo( adrv, adev, 5 );
+     /* set the destination datatype */
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | BRUSH_SOLIDCOLOR );
+     /* set direction */
+     ati128_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
+     /* set the drawing command */
+     ati128_out32( mmio, DP_MIX, ROP3_PATCOPY | DP_SRC_RECT );
+     /* set parameters */
+     ati128_out32( mmio, DST_Y_X, (S14(rect->y) << 16) | S12(rect->x) );
+     /* this executes the drawing command */
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) | rect->w );
+
+     return true;
+}
+
+static bool ati128FillBlendRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     u32 fts = adev->ATI_fake_texture_src + (adev->fake_texture_number & 7)*4;
+     ati128_waitidle( adrv, adev );
+     *((u32*)  dfb_gfxcard_memory_virtual(NULL,fts)  ) = adev->fake_texture_color;
+     ati128_waitidle( adrv, adev );
+
+     ati128_out32( mmio, SCALE_3D_DATATYPE, DST_32BPP );
+     ati128_out32( mmio, SCALE_PITCH,  1 );
+     /* enable scaling with filtering */
+     ati128_out32( mmio, SCALE_3D_CNTL, adev->ATI_blend_function );
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | SRC_DSTCOLOR );
+     ati128_out32( mmio, DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT );
+     /* flush the texture cache */
+     ati128_out32( mmio, TEX_CNTL, TEX_CNTL_ALPHA_EN_ON | TEX_CNTL_TEX_CACHE_FLUSH_ON);
+     /* set source offset */
+     ati128_out32( mmio, SCALE_OFFSET_0, fts ) ;
+     /* set height and width of the source */
+     ati128_out32( mmio, SCALE_SRC_HEIGHT_WIDTH, (8 << 16) | 8);
+     /* set the scaling increment registers */
+     ati128_out32( mmio, SCALE_X_INC, 0 );
+     ati128_out32( mmio, SCALE_Y_INC, 0 );
+     /* reset accumulator regs */
+     ati128_out32( mmio, SCALE_HACC, 0x00000000 );
+     ati128_out32( mmio, SCALE_VACC, 0x00000000 );
+     /* set the destination coordinates */
+     ati128_out32( mmio, SCALE_DST_X_Y, (S12(rect->x) << 16) | S14(rect->y) );
+     /* set destination height and width and perform the blit */
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, (rect->h << 16) | rect->w );
+     /*reset scaling and texture control register */
+     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
+     ati128_out32( mmio, TEX_CNTL,  0);
+     adev->fake_texture_number++;
+
+     return true;
+}
+
+static bool ati128DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     ati128_waitfifo( adrv, adev, 3 );
+     /* set the destination datatype */
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | BRUSH_SOLIDCOLOR );
+     /* set direction */
+     ati128_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
+     /* set the drawing command */
+     ati128_out32( mmio, DP_MIX, ROP3_PATCOPY | DP_SRC_RECT );
+
+     ati128_waitfifo( adrv, adev, 7 );
+     /* first line */
+     ati128_out32( mmio, DST_Y_X, (S14(rect->y) << 16) | S12(rect->x));
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) | 1);
+     /* second line */
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | rect->w );
+     /* third line */
+     ati128_out32( mmio, DST_Y_X, (S14(rect->y+rect->h-1) << 16) | S12(rect->x));
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | rect->w );
+     /* fourth line */
+     ati128_out32( mmio, DST_Y_X, (S14(rect->y) << 16) | S12(rect->x+rect->w-1));
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, rect->h << 16 | 1);
+
+     return true;
+}
+
+static bool ati128DrawBlendRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     u32 fts = adev->ATI_fake_texture_src + (adev->fake_texture_number & 7)*4;
+
+     ati128_waitidle( adrv, adev );
+     *((u32*)  dfb_gfxcard_memory_virtual(NULL,fts)  ) = adev->fake_texture_color;
+     ati128_waitidle( adrv, adev );
+
+     ati128_out32( mmio, SCALE_3D_DATATYPE, DST_32BPP );
+     ati128_out32( mmio, SCALE_PITCH,  1 );
+
+     /* enable scaling with filtering */
+     ati128_out32( mmio, SCALE_3D_CNTL, adev->ATI_blend_function );
+     ati128_out32( mmio, TEX_CNTL, TEX_CNTL_ALPHA_EN_ON | TEX_CNTL_TEX_CACHE_FLUSH_ON);
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | SRC_DSTCOLOR );
+     ati128_out32( mmio, DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT );
+     /* set source offset */
+     ati128_out32( mmio, SCALE_OFFSET_0, adev->ATI_fake_texture_src );
+     /* set height and width of the source */
+     ati128_out32( mmio, SCALE_SRC_HEIGHT_WIDTH, (8 << 16) | 8);
+     /* set the scaling increment registers */
+     ati128_out32( mmio, SCALE_X_INC, 0 );
+     ati128_out32( mmio, SCALE_Y_INC, 0 );
+     /* reset accumulator regs */
+     ati128_out32( mmio, SCALE_HACC, 0x00000000 );
+     ati128_out32( mmio, SCALE_VACC, 0x00000000 );
+     /* set the destination coordinates */
+
+     /*-----------------------*/
+     /* first line */
+     ati128_out32( mmio, SCALE_DST_X_Y, (S12(rect->x) << 16) | S14(rect->y) );
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, (rect->h << 16) | 1);
+     /* second line */
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, (1 << 16) | rect->w );
+     /* third line */
+     ati128_out32( mmio, SCALE_DST_X_Y, (S12(rect->x) << 16) | S14(rect->y+rect->h-1));
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, (1 << 16) | rect->w );
+     /* fourth line */
+     ati128_out32( mmio, SCALE_DST_X_Y, (S12(rect->x+rect->w-1) << 16) | S14(rect->y));
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, rect->h << 16 | 1);
+     /*-----------------------*/
+
+     /* reset scaling and texture control register */
+     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
+     ati128_out32( mmio, TEX_CNTL, 0 );
+     adev->fake_texture_number++;
+
+     return true;
+}
+
+
+static bool ati128DrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     int dx, dy;
+     int small, large;
+     int x_dir, y_dir, y_major;
+     int err, inc, dec;
+
+     /* Determine x & y deltas and x & y direction bits. */
+     if (line->x1 < line->x2) {
+          dx = line->x2 - line->x1;
+          x_dir = 1 << 31;
+     }
+     else {
+          dx = line->x1 - line->x2;
+          x_dir = 0 << 31;
+     }
+
+     if (line->y1 < line->y2) {
+          dy = line->y2 - line->y1;
+          y_dir = 1 << 15;
+     }
+     else {
+          dy = line->y1 - line->y2;
+          y_dir = 0 << 15;
+     }
+
+     /* Determine x & y min and max values; also determine y major bit. */
+     if (dx < dy) {
+          small = dx;
+          large = dy;
+          y_major = 1 << 2;
+     }
+     else {
+          small = dy;
+          large = dx;
+          y_major = 0 << 2;
+     }
+
+     /* Calculate Bresenham parameters and draw line. */
+     err = -large;
+     inc = small * 2;
+     dec = large *(-2);
+
+     ati128_waitfifo( adrv, adev, 8 );
+     /* set the destination datatype */
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | BRUSH_SOLIDCOLOR | ROP3_SRCCOPY );
+     ati128_out32( mmio, DP_MIX, ROP3_PATCOPY );
+
+     /* set start coorinates */
+     ati128_out32( mmio, DST_Y_X, (S14(line->y1) << 16) | S12(line->x1));
+     /* allow setting of last pel bit and polygon
+        outline bit for line drawing */
+     ati128_out32( mmio, DP_CNTL_XDIR_YDIR_YMAJOR,
+                   y_major | y_dir | x_dir );
+     /* set bresenham registers and start drawing */
+     ati128_out32( mmio, DST_BRES_ERR, err );
+     ati128_out32( mmio, DST_BRES_INC, inc );
+     ati128_out32( mmio, DST_BRES_DEC, dec );
+     ati128_out32( mmio, DST_BRES_LNTH, large + 1 );
+
+     return true;
+}
+
+static bool ati128StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     u32 src = 0;
+
+     u32 scalex = (u32)(((double)sr->w/(double)dr->w) * 65536);
+     u32 scaley = (u32)(((double)sr->h/(double)dr->h) * 65536);
+
+     ati128_waitfifo( adrv, adev, 9 );
+
+     /* make sure that color compare register is restored to last state */
+
+     ati128_out32( mmio, CLR_CMP_CNTL, adev->ATI_color_compare );
+
+     switch (adev->source->config.format) {
+          case DSPF_RGB332:
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_8BPP_RGB332 );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>3);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x;
+
+               ati128_out32( mmio, TEX_CNTL, 0);
+
+               break;
+          case DSPF_ARGB1555: /* FIXME: alpha channel will be zero ;( */
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_15BPP );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>4);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x*2;
+
+               ati128_out32( mmio, TEX_CNTL, 0);
+
+               break;
+          case DSPF_RGB16:
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_16BPP );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>4);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x*2;
+
+               ati128_out32( mmio, TEX_CNTL, 0);
+
+               break;
+          case DSPF_RGB24:
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_24BPP );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>3);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x*3;
+
+               ati128_out32( mmio, TEX_CNTL, 0);
+
+               break;
+          case DSPF_RGB32:
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_32BPP );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>5);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x*4;
+
+               ati128_out32( mmio, TEX_CNTL, 0);
+
+               break;
+          case DSPF_ARGB:
+               ati128_out32( mmio, SCALE_3D_DATATYPE, DST_32BPP );
+
+               ati128_out32( mmio, SCALE_PITCH,
+                             adev->src->pitch >>5);
+
+               src = adev->src->offset +
+                     sr->y *
+                     adev->src->pitch + sr->x*4;
+
+               if (adev->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    ati128_out32( mmio, TEX_CNTL, TEX_CNTL_ALPHA_EN_ON );
+               else
+                    ati128_out32( mmio, TEX_CNTL, 0 );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return false;
+     }
+
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | SRC_DSTCOLOR );
+
+     /* set the blend function */
+     if (adev->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+          ati128_out32( mmio, SCALE_3D_CNTL, adev->ATI_blend_function );
+     else
+          ati128_out32( mmio, SCALE_3D_CNTL, SCALE_3D_CNTL_SCALE_3D_FN_SCALE );
+
+     /* set up source data and copy type */
+     ati128_out32( mmio, DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT );
+     /* set source offset */
+     ati128_out32( mmio, SCALE_OFFSET_0, src);
+     /* set height and width of the source */
+     ati128_out32( mmio, SCALE_SRC_HEIGHT_WIDTH, (sr->h << 16) | sr->w);
+
+     ati128_waitfifo( adrv, adev, 9 );
+     /* set the scaling increment registers */
+     ati128_out32( mmio, SCALE_X_INC, scalex );
+     ati128_out32( mmio, SCALE_Y_INC, scaley );
+     /* reset accumulator regs */
+     ati128_out32( mmio, SCALE_HACC, 0x00000000 );
+     ati128_out32( mmio, SCALE_VACC, 0x00000000 );
+     /* set the destination coordinates */
+     ati128_out32( mmio, SCALE_DST_X_Y, (S12(dr->x) << 16) | S14(dr->y) );
+     /* set destination height and width and perform the blit */
+     ati128_out32( mmio, SCALE_DST_HEIGHT_WIDTH, (dr->h << 16) | dr->w );
+     /*reset scaling and texture control register */
+     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
+     ati128_out32( mmio, TEX_CNTL, 0x00000000 );
+
+     /* set CLR_CMP_CNTL to zero, to insure that drawing funcions work corrently */
+     if (adev->ATI_color_compare)
+          ati128_out32( mmio, CLR_CMP_CNTL, 0 );
+
+     return true;
+}
+
+static bool ati128Blit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) drv;
+     ATI128DeviceData *adev = (ATI128DeviceData*) dev;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     u32 dir_cmd = 0;
+
+     if ((adev->source->config.format != adev->destination->config.format) ||
+         (adev->blittingflags & DSBLIT_BLEND_ALPHACHANNEL))
+     {
+          DFBRectangle sr = { rect->x, rect->y, rect->w, rect->h };
+          DFBRectangle dr = { dx, dy, rect->w, rect->h };
+          ati128StretchBlit( adrv, adev, &sr, &dr );
+          return true;
+     }
+
+     /* check which blitting direction should be used */
+     if (rect->x <= dx) {
+          dir_cmd |= DST_X_RIGHT_TO_LEFT;
+          rect->x += rect->w-1;
+          dx += rect->w-1;
+     }
+     else {
+          dir_cmd |= DST_X_LEFT_TO_RIGHT;
+     }
+     if (rect->y <= dy) {
+          dir_cmd |= DST_Y_BOTTOM_TO_TOP;
+          rect->y += rect->h-1;
+          dy += rect->h-1;
+     }
+     else {
+          dir_cmd |= DST_Y_TOP_TO_BOTTOM;
+     }
+
+     ati128_waitfifo( adrv, adev, 9 );
+
+     /* make sure that color compare register is restored to last state */
+     ati128_out32( mmio, CLR_CMP_CNTL, adev->ATI_color_compare );
+
+     /* set blitting direction */
+     ati128_out32( mmio, DP_CNTL, dir_cmd );
+
+     ati128_out32( mmio, DP_DATATYPE, adev->ATI_dst_bpp | SRC_DSTCOLOR );
+     ati128_out32( mmio, DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT );
+
+     ati128_out32( mmio, SRC_Y_X, (rect->y << 16) | rect->x);
+     ati128_out32( mmio, DST_Y_X, (S14(dy) << 16) | S12(dx) );
+     ati128_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) | rect->w);
+
+     /* set CLR_CMP_CNTL to zero, to insure that drawing funcions work corrently */
+     if (adev->ATI_color_compare)
+          ati128_out32( mmio, CLR_CMP_CNTL, 0 );
+
+     if (dir_cmd != (DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT)) {
+          ati128_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT |
+                                       DST_Y_TOP_TO_BOTTOM );
+     }
+
+     return true;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_ATI_RAGE128:          /* ATI Rage 128 */
+               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,
+               "ATI Rage 128 Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 2;
+
+     info->driver_data_size = sizeof (ATI128DriverData);
+     info->device_data_size = sizeof (ATI128DeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
+
+     adrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!adrv->mmio_base)
+          return DFB_IO;
+
+     funcs->CheckState    = ati128CheckState;
+     funcs->SetState      = ati128SetState;
+     funcs->EngineSync    = ati128EngineSync;
+
+     funcs->FillRectangle = ati128FillRectangle;
+     funcs->DrawRectangle = ati128DrawRectangle;
+     funcs->DrawLine      = ati128DrawLine;
+     funcs->Blit          = ati128Blit;
+     funcs->StretchBlit   = ati128StretchBlit;
+
+     /* overlay support */
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                          driver_data, &atiOverlayFuncs );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
+     ATI128DeviceData *adev = (ATI128DeviceData*) device_data;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Rage 128" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "ATI" );
+
+
+     device_info->caps.flags    = CCF_CLIPPING;
+     device_info->caps.accel    = ATI128_SUPPORTED_DRAWINGFUNCTIONS |
+                                  ATI128_SUPPORTED_BLITTINGFUNCTIONS;
+     device_info->caps.drawing  = ATI128_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = ATI128_SUPPORTED_BLITTINGFLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 32 * 4;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+
+     /* initialize card */
+     ati128_waitfifo( adrv, adev, 6 );
+
+     ati128_out32( mmio, DP_GUI_MASTER_CNTL,
+                         GMC_SRC_PITCH_OFFSET_DEFAULT |
+                         GMC_DST_PITCH_OFFSET_DEFAULT |
+                         GMC_SRC_CLIP_DEFAULT         |
+                         GMC_DST_CLIP_DEFAULT         |
+                         GMC_BRUSH_SOLIDCOLOR         |
+                         GMC_SRC_DSTCOLOR             |
+                         GMC_BYTE_ORDER_MSB_TO_LSB    |
+                         GMC_DP_CONVERSION_TEMP_6500  |
+                         ROP3_PATCOPY                 |
+                         GMC_DP_SRC_RECT              |
+                         GMC_3D_FCN_EN_CLR            |
+                         GMC_DST_CLR_CMP_FCN_CLEAR    |
+                         GMC_AUX_CLIP_CLEAR           |
+                         GMC_WRITE_MASK_SET);
+
+     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
+     ati128_out32( mmio, TEX_CNTL, 0x00000000 );
+
+     /* reserve 32bit pixel for fake texture at end of framebuffer */
+     adev->ATI_fake_texture_src = dfb_gfxcard_reserve_memory( device, 4*32 );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     ATI128DeviceData *adev = (ATI128DeviceData*) device_data;
+     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     D_DEBUG( "DirectFB/ATI128: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/ATI128:  %9d ati128_waitfifo calls\n",
+               adev->waitfifo_calls );
+     D_DEBUG( "DirectFB/ATI128:  %9d register writes (ati128_waitfifo sum)\n",
+               adev->waitfifo_sum );
+     D_DEBUG( "DirectFB/ATI128:  %9d FIFO wait cycles (depends on CPU)\n",
+               adev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/ATI128:  %9d IDLE wait cycles (depends on CPU)\n",
+               adev->idle_waitcycles );
+     D_DEBUG( "DirectFB/ATI128:  %9d FIFO space cache hits(depends on CPU)\n",
+               adev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/ATI128: Conclusion:\n" );
+     D_DEBUG( "DirectFB/ATI128:  Average register writes/ati128_waitfifo"
+               "call:%.2f\n",
+               adev->waitfifo_sum/(float)(adev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/ATI128:  Average wait cycles/ati128_waitfifo call:"
+               " %.2f\n",
+               adev->fifo_waitcycles/(float)(adev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/ATI128:  Average fifo space cache hits: %02d%%\n",
+               (int)(100 * adev->fifo_cache_hits/
+               (float)(adev->waitfifo_calls)) );
+
+     /* clean up, make sure that aty128fb does not hang in kernel space
+        afterwards  */
+     ati128_waitfifo( adrv, adev, 3 );
+
+     ati128_out32( mmio, DP_GUI_MASTER_CNTL,
+                         GMC_SRC_PITCH_OFFSET_DEFAULT |
+                         GMC_DST_PITCH_OFFSET_DEFAULT |
+                         GMC_SRC_CLIP_DEFAULT         |
+                         GMC_DST_CLIP_DEFAULT         |
+                         GMC_BRUSH_SOLIDCOLOR         |
+                         GMC_SRC_DSTCOLOR             |
+                         GMC_BYTE_ORDER_MSB_TO_LSB    |
+                         GMC_DP_CONVERSION_TEMP_6500  |
+                         ROP3_PATCOPY                 |
+                         GMC_DP_SRC_RECT              |
+                         GMC_3D_FCN_EN_CLR            |
+                         GMC_DST_CLR_CMP_FCN_CLEAR    |
+                         GMC_AUX_CLIP_CLEAR           |
+                         GMC_WRITE_MASK_SET);
+
+     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
+     ati128_out32( mmio, TEX_CNTL, 0x00000000 );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
+
+     dfb_gfxcard_unmap_mmio( device, adrv->mmio_base, -1 );
+}
diff --git a/Source/DirectFB/gfxdrivers/ati128/ati128.h b/Source/DirectFB/gfxdrivers/ati128/ati128.h
new file mode 100755
index 0000000..9b6d149
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/ati128.h
@@ -0,0 +1,76 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___ATI128_H__
+#define ___ATI128_H__
+
+#include <dfb_types.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+typedef struct {
+     volatile u8 *mmio_base;
+} ATI128DriverData;
+
+typedef struct {
+     CoreSurface *source;
+     CoreSurface *destination;
+     CoreSurfaceBufferLock *src;
+     DFBSurfaceBlittingFlags blittingflags;
+
+     /* store some ATI register values in native format */
+     u32 ATI_dst_bpp;
+     u32 ATI_color_compare;
+     u32 ATI_blend_function;
+
+     /* used for the fake texture hack */
+     u32 ATI_fake_texture_src;
+     u32 fake_texture_color;
+     unsigned int fake_texture_number;
+
+     /* state validation */
+     int v_destination;
+     int v_color;
+     int v_blending_function;
+     int v_source;
+     int v_src_colorkey;
+     int v_blittingflags;
+
+     /* for fifo/performance monitoring */
+     unsigned int fifo_space;
+
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+} ATI128DeviceData;
+
+extern DisplayLayerFuncs atiOverlayFuncs;
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/ati128/ati128_overlay.c b/Source/DirectFB/gfxdrivers/ati128/ati128_overlay.c
new file mode 100755
index 0000000..0a96f7c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/ati128_overlay.c
@@ -0,0 +1,447 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/layers.h>
+#include <core/surface.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "ati128.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+
+     /* overlay registers */
+     struct {
+          u32 H_INC;
+          u32 STEP_BY;
+          u32 Y_X_START;
+          u32 Y_X_END;
+          u32 V_INC;
+          u32 P1_BLANK_LINES_AT_TOP;
+          u32 P23_BLANK_LINES_AT_TOP;
+          u32 VID_BUF_PITCH0_VALUE;
+          u32 VID_BUF_PITCH1_VALUE;
+          u32 P1_X_START_END;
+          u32 P2_X_START_END;
+          u32 P3_X_START_END;
+          u32 VID_BUF0_BASE_ADRS;
+          u32 VID_BUF1_BASE_ADRS;
+          u32 VID_BUF2_BASE_ADRS;
+          u32 P1_V_ACCUM_INIT;
+          u32 P23_V_ACCUM_INIT;
+          u32 P1_H_ACCUM_INIT;
+          u32 P23_H_ACCUM_INIT;
+          u32 SCALE_CNTL;
+     } regs;
+} ATIOverlayLayerData;
+
+static void ov0_set_regs( ATI128DriverData *adrv, ATIOverlayLayerData *aov0 );
+static void ov0_calc_regs( ATI128DriverData *adrv, ATIOverlayLayerData *aov0,
+                           CoreLayerRegionConfig *config, CoreSurface *surface,
+                           CoreSurfaceBufferLock *lock );
+
+#define OV0_SUPPORTED_OPTIONS   (DLOP_NONE)
+
+/**********************/
+
+static int
+ov0LayerDataSize( void )
+{
+     return sizeof(ATIOverlayLayerData);
+}
+
+static DFBResult
+ov0InitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
+     volatile u8      *mmio = adrv->mmio_base;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SCREEN_LOCATION | DLCAPS_SURFACE;
+     description->type = DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "ATI128 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_NONE;
+
+     /* reset overlay */
+     ati128_out32( mmio, OV0_SCALE_CNTL, 0x80000000 );
+     ati128_out32( mmio, OV0_EXCLUSIVE_HORZ, 0 );
+     ati128_out32( mmio, OV0_AUTO_FLIP_CNTL, 0 );
+     ati128_out32( mmio, OV0_FILTER_CNTL, 0x0000000f );
+     ati128_out32( mmio, OV0_COLOR_CNTL, 0x00101000 );
+     ati128_out32( mmio, OV0_KEY_CNTL, 0x10 );
+     ati128_out32( mmio, OV0_TEST, 0 );
+
+     return DFB_OK;
+}
+
+
+static void
+ov0OnOff( ATI128DriverData    *adrv,
+          ATIOverlayLayerData *aov0,
+          int                  on )
+{
+     /* set/clear enable bit */
+     if (on)
+          aov0->regs.SCALE_CNTL |= R128_SCALER_ENABLE;
+     else
+          aov0->regs.SCALE_CNTL &= ~R128_SCALER_ENABLE;
+
+     /* write back to card */
+     ati128_out32( adrv->mmio_base, OV0_SCALE_CNTL, aov0->regs.SCALE_CNTL );
+}
+
+static DFBResult
+ov0TestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     /* check for unsupported options */
+     if (config->options & ~OV0_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     /* check width */
+     if (config->width > 2048 || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 1024 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0SetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     ATI128DriverData    *adrv = (ATI128DriverData*) driver_data;
+     ATIOverlayLayerData *aov0 = (ATIOverlayLayerData*) layer_data;
+
+     /* remember configuration */
+     aov0->config = *config;
+
+     ov0_calc_regs( adrv, aov0, config, surface, lock );
+     ov0_set_regs( adrv, aov0 );
+
+     /* enable overlay */
+     ov0OnOff( adrv, aov0, 1 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0RemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     ATI128DriverData    *adrv = (ATI128DriverData*) driver_data;
+     ATIOverlayLayerData *aov0 = (ATIOverlayLayerData*) layer_data;
+
+     /* disable overlay */
+     ov0OnOff( adrv, aov0, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0FlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     ATI128DriverData    *adrv = (ATI128DriverData*) driver_data;
+     ATIOverlayLayerData *aov0 = (ATIOverlayLayerData*) layer_data;
+
+     dfb_surface_flip( surface, false );
+
+     ov0_calc_regs( adrv, aov0, &aov0->config, surface, lock );
+     ov0_set_regs( adrv, aov0 );
+
+     return DFB_OK;
+}
+
+
+DisplayLayerFuncs atiOverlayFuncs = {
+     .LayerDataSize = ov0LayerDataSize,
+     .InitLayer     = ov0InitLayer,
+
+     .TestRegion    = ov0TestRegion,
+     .SetRegion     = ov0SetRegion,
+     .RemoveRegion  = ov0RemoveRegion,
+     .FlipRegion    = ov0FlipRegion,
+};
+
+/* internal */
+
+static void ov0_set_regs( ATI128DriverData *adrv, ATIOverlayLayerData *aov0 )
+{
+     volatile u8 *mmio = adrv->mmio_base;
+
+     ati128_out32( mmio, OV0_REG_LOAD_CNTL, 1 );
+     while (!(ati128_in32( mmio, OV0_REG_LOAD_CNTL ) & (1 << 3)));
+
+     ati128_out32( mmio, OV0_H_INC,
+                   aov0->regs.H_INC );
+
+     ati128_out32( mmio, OV0_STEP_BY,
+                   aov0->regs.STEP_BY );
+
+     ati128_out32( mmio, OV0_Y_X_START,
+                   aov0->regs.Y_X_START );
+
+     ati128_out32( mmio, OV0_Y_X_END,
+                   aov0->regs.Y_X_END );
+
+     ati128_out32( mmio, OV0_V_INC,
+                   aov0->regs.V_INC );
+
+     ati128_out32( mmio, OV0_P1_BLANK_LINES_AT_TOP,
+                   aov0->regs.P1_BLANK_LINES_AT_TOP );
+
+     ati128_out32( mmio, OV0_P23_BLANK_LINES_AT_TOP,
+                   aov0->regs.P23_BLANK_LINES_AT_TOP );
+
+     ati128_out32( mmio, OV0_VID_BUF_PITCH0_VALUE,
+                   aov0->regs.VID_BUF_PITCH0_VALUE );
+
+     ati128_out32( mmio, OV0_VID_BUF_PITCH1_VALUE,
+                   aov0->regs.VID_BUF_PITCH1_VALUE );
+
+     ati128_out32( mmio, OV0_P1_X_START_END,
+                   aov0->regs.P1_X_START_END );
+
+     ati128_out32( mmio, OV0_P2_X_START_END,
+                   aov0->regs.P2_X_START_END );
+
+     ati128_out32( mmio, OV0_P3_X_START_END,
+                   aov0->regs.P3_X_START_END );
+
+     ati128_out32( mmio, OV0_VID_BUF0_BASE_ADRS,
+                   aov0->regs.VID_BUF0_BASE_ADRS );
+
+     ati128_out32( mmio, OV0_VID_BUF1_BASE_ADRS,
+                   aov0->regs.VID_BUF1_BASE_ADRS );
+
+     ati128_out32( mmio, OV0_VID_BUF2_BASE_ADRS,
+                   aov0->regs.VID_BUF2_BASE_ADRS );
+
+     ati128_out32( mmio, OV0_P1_V_ACCUM_INIT,
+                   aov0->regs.P1_V_ACCUM_INIT );
+
+     ati128_out32( mmio, OV0_P23_V_ACCUM_INIT,
+                   aov0->regs.P23_V_ACCUM_INIT );
+
+     ati128_out32( mmio, OV0_P1_H_ACCUM_INIT,
+                   aov0->regs.P1_H_ACCUM_INIT );
+
+     ati128_out32( mmio, OV0_P23_H_ACCUM_INIT,
+                   aov0->regs.P23_H_ACCUM_INIT );
+
+     ati128_out32( mmio, OV0_SCALE_CNTL,
+                   aov0->regs.SCALE_CNTL );
+
+     ati128_out32( mmio, OV0_REG_LOAD_CNTL, 0 );
+}
+
+static void ov0_calc_regs( ATI128DriverData      *adrv,
+                           ATIOverlayLayerData   *aov0,
+                           CoreLayerRegionConfig *config,
+                           CoreSurface           *surface,
+                           CoreSurfaceBufferLock *lock )
+{
+     int h_inc, v_inc, step_by, tmp;
+     int p1_h_accum_init, p23_h_accum_init;
+     int p1_v_accum_init, p23_v_accum_init;
+
+     DFBRegion      dstBox;
+     int            dst_w;
+     int            dst_h;
+     u32            offset_u = 0, offset_v = 0;
+
+     /* destination box */
+     dstBox.x1 = config->dest.x;
+     dstBox.y1 = config->dest.y;
+     dstBox.x2 = config->dest.x + config->dest.w;
+     dstBox.y2 = config->dest.y + config->dest.h;
+
+     /* destination size */
+     dst_w = config->dest.w;
+     dst_h = config->dest.h;
+
+     /* clear everything but the enable bit that may be set*/
+     aov0->regs.SCALE_CNTL &= R128_SCALER_ENABLE;
+
+
+     /* calculate incrementors */
+     h_inc   = (surface->config.size.w  << 12) / dst_w;
+     v_inc   = (surface->config.size.h << 20) / dst_h;
+     step_by = 1;
+
+     while (h_inc >= (2 << 12)) {
+          step_by++;
+          h_inc >>= 1;
+     }
+
+     /* calculate values for horizontal accumulators */
+     tmp = 0x00028000 + (h_inc << 3);
+     p1_h_accum_init = ((tmp <<  4) & 0x000f8000) | ((tmp << 12) & 0xf0000000);
+
+     tmp = 0x00028000 + (h_inc << 2);
+     p23_h_accum_init = ((tmp <<  4) & 0x000f8000) | ((tmp << 12) & 0x70000000);
+
+     /* calculate values for vertical accumulators */
+     tmp = 0x00018000;
+     p1_v_accum_init = ((tmp << 4) & 0x03ff8000) | 0x00000001;
+
+     tmp = 0x00018000;
+     p23_v_accum_init = ((tmp << 4) & 0x01ff8000) | 0x00000001;
+
+     /* choose pixel format and calculate buffer offsets for planar modes */
+     switch (surface->config.format) {
+          case DSPF_UYVY:
+               aov0->regs.SCALE_CNTL = R128_SCALER_SOURCE_YVYU422;
+               break;
+
+          case DSPF_YUY2:
+               aov0->regs.SCALE_CNTL = R128_SCALER_SOURCE_VYUY422;
+               break;
+
+          case DSPF_I420:
+               aov0->regs.SCALE_CNTL = R128_SCALER_SOURCE_YUV12;
+
+               offset_u = lock->offset +
+                          surface->config.size.h * lock->pitch;
+               offset_v = offset_u +
+                          (surface->config.size.h >> 1) * (lock->pitch >> 1);
+               break;
+
+          case DSPF_YV12:
+               aov0->regs.SCALE_CNTL = R128_SCALER_SOURCE_YUV12;
+
+               offset_v = lock->offset +
+                          surface->config.size.h * lock->pitch;
+               offset_u = offset_v +
+                          (surface->config.size.h >> 1) * (lock->pitch >> 1);
+               break;
+
+          default:
+               D_BUG("unexpected pixelformat");
+               aov0->regs.SCALE_CNTL = 0;
+               return;
+     }
+
+     aov0->regs.SCALE_CNTL            |= R128_SCALER_DOUBLE_BUFFER |
+                                         R128_SCALER_BURST_PER_PLANE |
+                                         R128_SCALER_Y2R_TEMP |
+                                         R128_SCALER_PIX_EXPAND;
+
+     aov0->regs.H_INC                  = h_inc | ((h_inc >> 1) << 16);
+     aov0->regs.V_INC                  = v_inc;
+     aov0->regs.STEP_BY                = step_by | (step_by << 8);
+     aov0->regs.Y_X_START              = dstBox.x1 | (dstBox.y1 << 16);
+     aov0->regs.Y_X_END                = dstBox.x2 | (dstBox.y2 << 16);
+     aov0->regs.P1_BLANK_LINES_AT_TOP  = 0x00000fff | ((surface->config.size.h - 1) << 16);
+     aov0->regs.P23_BLANK_LINES_AT_TOP = 0x000007ff | ((((surface->config.size.h + 1) >> 1) - 1) << 16);
+     aov0->regs.VID_BUF_PITCH0_VALUE   = lock->pitch;
+     aov0->regs.VID_BUF_PITCH1_VALUE   = lock->pitch >> 1;
+     aov0->regs.P1_X_START_END         = surface->config.size.w - 1;
+     aov0->regs.P2_X_START_END         = (surface->config.size.w >> 1) - 1;
+     aov0->regs.P3_X_START_END         = (surface->config.size.w >> 1) - 1;
+     aov0->regs.VID_BUF0_BASE_ADRS     = lock->offset & 0x03fffff0;
+     aov0->regs.VID_BUF1_BASE_ADRS     = (offset_u & 0x03fffff0) | 1;
+     aov0->regs.VID_BUF2_BASE_ADRS     = (offset_v & 0x03fffff0) | 1;
+     aov0->regs.P1_H_ACCUM_INIT        = p1_h_accum_init;
+     aov0->regs.P23_H_ACCUM_INIT       = p23_h_accum_init;
+     aov0->regs.P1_V_ACCUM_INIT        = p1_v_accum_init;
+     aov0->regs.P23_V_ACCUM_INIT       = p23_v_accum_init;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/ati128/ati128_state.c b/Source/DirectFB/gfxdrivers/ati128/ati128_state.c
new file mode 100755
index 0000000..ebe52d7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/ati128_state.c
@@ -0,0 +1,314 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "ati128.h"
+
+#include "ati128_state.h"
+
+
+static u32 ati128SourceBlend[] = {
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_ZERO,        /* DSBF_ZERO         */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_ONE,         /* DSBF_ONE          */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_SRCCOLOR,    /* DSBF_SRCCOLOR     */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVSRCCOLOR, /* DSBF_INVSRCCOLOR  */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_SRCALPHA,    /* DSBF_SRCALPHA     */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVSRCALPHA, /* DSBF_INVSRCALPHA  */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_DSTALPHA,    /* DSBF_DESTALPHA    */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVDSTALPHA, /* DSBF_INVDESTALPHA */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_DSTCOLOR,    /* DSBF_DESTCOLOR    */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVDSTCOLOR, /* DSBF_INVDESTCOLOR */
+     SCALE_3D_CNTL_ALPHA_BLEND_SRC_SAT          /* DSBF_SRCALPHASAT  */
+};
+
+static u32 ati128DestBlend[] = {
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_ZERO,        /* DSBF_ZERO         */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_ONE,         /* DSBF_ONE          */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_SRCCOLOR,    /* DSBF_SRCCOLOR     */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_INVSRCCOLOR, /* DSBF_INVSRCCOLOR  */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_SRCALPHA,    /* DSBF_SRCALPHA     */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_INVSRCALPHA, /* DSBF_INVSRCALPHA  */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_DSTALPHA,    /* DSBF_DESTALPHA    */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_INVDSTALPHA, /* DSBF_INVDESTALPHA */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_DSTCOLOR,    /* DSBF_DESTCOLOR    */
+     SCALE_3D_CNTL_ALPHA_BLEND_DST_INVDSTCOLOR, /* DSBF_INVDESTCOLOR */
+     0                                          /* DSBF_SRCALPHASAT  */
+};
+
+void ati128_set_destination( ATI128DriverData *adrv,
+                             ATI128DeviceData *adev,
+                             CardState        *state )
+{
+     CoreSurface *destination = state->destination;
+
+     if (adev->v_destination)
+          return;
+
+     ati128_waitfifo( adrv, adev, 1 );
+
+     switch (destination->config.format) {
+          case DSPF_RGB332:
+               ati128_out32( adrv->mmio_base, DST_PITCH_OFFSET,
+                             ((state->dst.pitch >> 3) << 21) |
+                             (state->dst.offset >> 5));
+
+               adev->ATI_dst_bpp = DST_8BPP_RGB332;
+               break;
+          case DSPF_ARGB1555:
+               ati128_out32( adrv->mmio_base, DST_PITCH_OFFSET,
+                             ((state->dst.pitch >> 4) << 21) |
+                             (state->dst.offset >> 5));
+
+               adev->ATI_dst_bpp = DST_15BPP;
+               break;
+          case DSPF_RGB16:
+               ati128_out32( adrv->mmio_base, DST_PITCH_OFFSET,
+                             ((state->dst.pitch >> 4) << 21) |
+                             (state->dst.offset >> 5));
+
+               adev->ATI_dst_bpp = DST_16BPP;
+               break;
+          case DSPF_RGB24:
+               ati128_out32( adrv->mmio_base, DST_PITCH_OFFSET,
+                             ((state->dst.pitch >> 3) << 21) |
+                             (state->dst.offset >> 5));
+
+               adev->ATI_dst_bpp = DST_24BPP;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               ati128_out32( adrv->mmio_base, DST_PITCH_OFFSET,
+                             ((state->dst.pitch >> 5) << 21) |
+                             (state->dst.offset >> 5));
+
+               adev->ATI_dst_bpp = DST_32BPP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+     adev->destination = destination;
+
+     adev->v_destination = 1;
+}
+
+void ati128_set_source( ATI128DriverData *adrv,
+                        ATI128DeviceData *adev,
+                        CardState        *state )
+{
+
+     if (adev->v_source)
+          return;
+
+     ati128_waitfifo( adrv, adev, 3 );
+
+     switch (state->source->config.format) {
+          case DSPF_RGB332:
+               ati128_out32( adrv->mmio_base, SRC_PITCH,
+                             state->src.pitch >> 3);
+
+               ati128_out32( adrv->mmio_base, CLR_CMP_MASK, 0x000000FF );
+               break;
+          case DSPF_ARGB1555:
+               ati128_out32( adrv->mmio_base, SRC_PITCH,
+                             state->src.pitch >> 4);
+
+               ati128_out32( adrv->mmio_base, CLR_CMP_MASK, 0x00007FFF );
+               break;
+          case DSPF_RGB16:
+               ati128_out32( adrv->mmio_base, SRC_PITCH,
+                             state->src.pitch >> 4);
+
+               ati128_out32( adrv->mmio_base, CLR_CMP_MASK, 0x0000FFFF );
+               break;
+          case DSPF_RGB24:
+               ati128_out32( adrv->mmio_base, SRC_PITCH,
+                             state->src.pitch >> 3);
+
+               ati128_out32( adrv->mmio_base, CLR_CMP_MASK, 0x00FFFFFF );
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               ati128_out32( adrv->mmio_base, SRC_PITCH,
+                             state->src.pitch >> 5);
+
+               ati128_out32( adrv->mmio_base, CLR_CMP_MASK, 0x00FFFFFF );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     ati128_out32( adrv->mmio_base, SRC_OFFSET,
+                   state->src.offset );
+
+     adev->source = state->source;
+     adev->src = &state->src;
+     adev->v_source = 1;
+}
+
+void ati128_set_clip( ATI128DriverData *adrv,
+                      ATI128DeviceData *adev,
+                      CardState        *state )
+{
+
+     ati128_waitfifo( adrv, adev, 2 );
+
+     /* 24bpp needs special treatment */
+     if (state->destination->config.format == DSPF_RGB24) {
+          ati128_out32( adrv->mmio_base, SC_TOP_LEFT,
+                        (state->clip.y1 << 16) | (state->clip.x1*3) );
+
+          ati128_out32( adrv->mmio_base, SC_BOTTOM_RIGHT,
+                        (state->clip.y2 << 16) | ((state->clip.x2*3) + 3));
+     }
+     else {
+          ati128_out32( adrv->mmio_base, SC_TOP_LEFT,
+                        (state->clip.y1 << 16) | state->clip.x1 );
+
+          ati128_out32( adrv->mmio_base, SC_BOTTOM_RIGHT,
+                        (state->clip.y2 << 16) | state->clip.x2 );
+     }
+}
+
+void ati128_set_color( ATI128DriverData *adrv,
+                       ATI128DeviceData *adev,
+                       CardState        *state )
+{
+     u32 fill_color = 0;
+
+     if (adev->v_color)
+          return;
+
+     switch (state->destination->config.format) {
+          case DSPF_RGB332:
+               fill_color = PIXEL_RGB332( state->color.r,
+                                          state->color.g,
+                                          state->color.b );
+               break;
+          case DSPF_ARGB1555:
+               fill_color = PIXEL_ARGB1555( state->color.a,
+                                            state->color.r,
+                                            state->color.g,
+                                            state->color.b );
+               break;
+          case DSPF_RGB16:
+               fill_color = PIXEL_RGB16( state->color.r,
+                                         state->color.g,
+                                         state->color.b );
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               fill_color = PIXEL_RGB32( state->color.r,
+                                         state->color.g,
+                                         state->color.b );
+               break;
+          case DSPF_ARGB:
+               fill_color = PIXEL_ARGB( state->color.a,
+                                        state->color.r,
+                                        state->color.g,
+                                        state->color.b );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     ati128_waitfifo( adrv, adev, 1 );
+     ati128_out32( adrv->mmio_base, DP_BRUSH_FRGD_CLR, fill_color);
+
+
+     adev->fake_texture_color = PIXEL_ARGB( state->color.a,
+                                            state->color.r,
+                                            state->color.g,
+                                            state->color.b );
+
+     adev->v_color = 1;
+}
+
+void ati128_set_src_colorkey( ATI128DriverData *adrv,
+                              ATI128DeviceData *adev,
+                              CardState        *state )
+{
+     if (adev->v_src_colorkey)
+          return;
+
+     ati128_waitfifo( adrv, adev, 1 );
+     ati128_out32( adrv->mmio_base, CLR_CMP_CLR_SRC, state->src_colorkey );
+
+     adev->v_src_colorkey = 1;
+}
+
+void ati128_set_blittingflags( ATI128DriverData *adrv,
+                               ATI128DeviceData *adev,
+                               CardState        *state )
+{
+     if (adev->v_blittingflags)
+          return;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          adev->ATI_color_compare = (1 << 24) | 5;
+     }
+     else {
+          adev->ATI_color_compare = 0;
+     }
+
+     adev->blittingflags = state->blittingflags;
+     adev->v_blittingflags = 1;
+}
+
+void ati128_set_blending_function( ATI128DriverData *adrv,
+                                   ATI128DeviceData *adev,
+                                   CardState        *state )
+{
+     if (adev->v_blending_function)
+          return;
+
+     adev->ATI_blend_function = SCALE_3D_CNTL_SCALE_3D_FN_SCALE |
+                                ati128SourceBlend[state->src_blend - 1] |
+                                ati128DestBlend  [state->dst_blend - 1] |
+                                SCALE_3D_CNTL_TEX_MAP_AEN_ON;
+
+     adev->v_blending_function = 1;
+}
diff --git a/Source/DirectFB/gfxdrivers/ati128/ati128_state.h b/Source/DirectFB/gfxdrivers/ati128/ati128_state.h
new file mode 100755
index 0000000..4cee1cf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/ati128_state.h
@@ -0,0 +1,62 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___ATI128_STATE_H__
+#define ___ATI128_STATE_H__
+
+#include "ati128.h"
+
+void ati128_set_destination( ATI128DriverData *adrv,
+                             ATI128DeviceData *adev,
+                             CardState        *state );
+void ati128_set_source( ATI128DriverData *adrv,
+                        ATI128DeviceData *adev,
+                        CardState        *state );
+
+void ati128_set_blittingflags( ATI128DriverData *adrv,
+                               ATI128DeviceData *adev,
+                               CardState        *state );
+
+void ati128_set_clip( ATI128DriverData *adrv,
+                      ATI128DeviceData *adev,
+                      CardState        *state );
+
+void ati128_set_color( ATI128DriverData *adrv,
+                       ATI128DeviceData *adev,
+                       CardState        *state );
+
+void ati128_set_src_colorkey( ATI128DriverData *adrv,
+                              ATI128DeviceData *adev,
+                              CardState        *state );
+
+void ati128_set_blending_function( ATI128DriverData *adrv,
+                                   ATI128DeviceData *adev,
+                                   CardState        *state );
+
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/ati128/mmio.h b/Source/DirectFB/gfxdrivers/ati128/mmio.h
new file mode 100755
index 0000000..d2df943
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/mmio.h
@@ -0,0 +1,121 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___ATI128_MMIO_H__
+#define ___ATI128_MMIO_H__
+
+#include <dfb_types.h>
+
+#include "ati128.h"
+
+static inline void
+ati128_out32(volatile u8 *mmioaddr, u32 reg, u32 value)
+{
+#ifdef __powerpc__
+       asm volatile("stwbrx %0,%1,%2;eieio" : : "r"(value), "b"(reg),
+                       "r"(mmioaddr) : "memory");
+
+#else
+     *((volatile u32*)(mmioaddr+reg)) = value;
+#endif
+}
+
+static inline u32
+ati128_in32(volatile u8 *mmioaddr, u32 reg)
+{
+#ifdef __powerpc__
+     u32 value;
+
+     asm volatile("lwbrx %0,%1,%2;eieio" : "=r"(value) : "b"(reg), "r"(mmioaddr));
+
+     return value;
+#else
+     return *((volatile u32*)(mmioaddr+reg));
+#endif
+}
+
+static inline void ati128_waitidle( ATI128DriverData *adrv,
+                                    ATI128DeviceData *adev )
+{
+     int timeout = 1000000;
+
+     while (timeout--) {
+          if ((ati128_in32( adrv->mmio_base, GUI_STAT) & 0x00000FFF) == 64)
+               break;
+
+          adev->idle_waitcycles++;
+     }
+
+     timeout = 1000000;
+
+     while (timeout--) {
+          if ((ati128_in32( adrv->mmio_base, GUI_STAT) & (GUI_ACTIVE | ENG_3D_BUSY)) == ENGINE_IDLE)
+               break;
+
+          adev->idle_waitcycles++;
+     }
+
+     ati128_out32( adrv->mmio_base, PC_NGUI_CTLSTAT,
+                   ati128_in32( adrv->mmio_base, PC_NGUI_CTLSTAT) | 0x000000ff);
+
+     timeout = 1000000;
+     while (timeout--) {
+          if ((ati128_in32( adrv->mmio_base, PC_NGUI_CTLSTAT) & PC_BUSY) != PC_BUSY)
+               break;
+
+          adev->idle_waitcycles++;
+     }
+     adev->fifo_space = 60;
+}
+
+static inline void ati128_waitfifo( ATI128DriverData *adrv,
+                                    ATI128DeviceData *adev,
+                                    unsigned int requested_fifo_space)
+{
+     int timeout = 1000000;
+
+     adev->waitfifo_sum += requested_fifo_space;
+     adev->waitfifo_calls++;
+
+     if (adev->fifo_space < requested_fifo_space) {
+          while (timeout--) {
+               adev->fifo_waitcycles++;
+
+               adev->fifo_space = ati128_in32( adrv->mmio_base, GUI_STAT) & 0x00000FFF;
+               if (adev->fifo_space >= requested_fifo_space)
+                    break;
+          }
+     }
+     else {
+          adev->fifo_cache_hits++;
+     }
+     adev->fifo_space -= requested_fifo_space;
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/ati128/regs.h b/Source/DirectFB/gfxdrivers/ati128/regs.h
new file mode 100755
index 0000000..168eeb0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ati128/regs.h
@@ -0,0 +1,919 @@
+#ifndef REG_RAGE128_H
+#define REG_RAGE128_H
+
+#define CLOCK_CNTL_INDEX                0x0008
+#define CLOCK_CNTL_DATA                 0x000c
+#define BIOS_0_SCRATCH                  0x0010
+#define BUS_CNTL                        0x0030
+#define GEN_INT_CNTL                    0x0040
+#define CRTC_GEN_CNTL                   0x0050
+#define CRTC_EXT_CNTL                   0x0054
+#define DAC_CNTL                        0x0058
+#define I2C_CNTL_1                      0x0094
+#define PALETTE_INDEX                   0x00b0
+#define PALETTE_DATA                    0x00b4
+#define CONFIG_CNTL                     0x00e0
+#define GEN_RESET_CNTL                  0x00f0
+#define CONFIG_MEMSIZE                  0x00f8
+#define MEM_CNTL                        0x0140
+#define AGP_BASE                        0x0170
+#define AGP_CNTL                        0x0174
+#define AGP_APER_OFFSET                 0x0178
+#define PCI_GART_PAGE                   0x017c
+#define PC_NGUI_MODE                    0x0180
+#define PC_NGUI_CTLSTAT                 0x0184
+#define MPP_TB_CONFIG                   0x01C0
+#define MPP_GP_CONFIG                   0x01C8
+#define VIPH_CONTROL                    0x01D0
+#define CRTC_H_TOTAL_DISP               0x0200
+#define CRTC_H_SYNC_STRT_WID            0x0204
+#define CRTC_V_TOTAL_DISP               0x0208
+#define CRTC_V_SYNC_STRT_WID            0x020c
+#define CRTC_OFFSET                     0x0224
+#define CRTC_OFFSET_CNTL                0x0228
+#define CRTC_PITCH                      0x022c
+#define OVR_CLR                         0x0230
+#define OVR_WID_LEFT_RIGHT              0x0234
+#define OVR_WID_TOP_BOTTOM              0x0238
+#define LVDS_GEN_CNTL                   0x02d0
+#define DDA_CONFIG                      0x02e0
+#define DDA_ON_OFF                      0x02e4
+#define VGA_DDA_CONFIG                  0x02e8
+#define VGA_DDA_ON_OFF                  0x02ec
+#define OV0_SCALE_CNTL                  0x0420
+#define SUBPIC_CNTL                     0x0540
+#define PM4_BUFFER_OFFSET               0x0700
+#define PM4_BUFFER_CNTL                 0x0704
+#define PM4_BUFFER_WM_CNTL              0x0708
+#define PM4_BUFFER_DL_RPTR_ADDR         0x070c
+#define PM4_BUFFER_DL_RPTR              0x0710
+#define PM4_BUFFER_DL_WPTR              0x0714
+#define PM4_VC_FPU_SETUP                0x071c
+#define PM4_FPU_CNTL                    0x0720
+#define PM4_VC_FORMAT                   0x0724
+#define PM4_VC_CNTL                     0x0728
+#define PM4_VC_I01                      0x072c
+#define PM4_VC_VLOFF                    0x0730
+#define PM4_VC_VLSIZE                   0x0734
+#define PM4_IW_INDOFF                   0x0738
+#define PM4_IW_INDSIZE                  0x073c
+#define PM4_FPU_FPX0                    0x0740
+#define PM4_FPU_FPY0                    0x0744
+#define PM4_FPU_FPX1                    0x0748
+#define PM4_FPU_FPY1                    0x074c
+#define PM4_FPU_FPX2                    0x0750
+#define PM4_FPU_FPY2                    0x0754
+#define PM4_FPU_FPY3                    0x0758
+#define PM4_FPU_FPY4                    0x075c
+#define PM4_FPU_FPY5                    0x0760
+#define PM4_FPU_FPY6                    0x0764
+#define PM4_FPU_FPR                     0x0768
+#define PM4_FPU_FPG                     0x076c
+#define PM4_FPU_FPB                     0x0770
+#define PM4_FPU_FPA                     0x0774
+#define PM4_FPU_INTXY0                  0x0780
+#define PM4_FPU_INTXY1                  0x0784
+#define PM4_FPU_INTXY2                  0x0788
+#define PM4_FPU_INTARGB                 0x078c
+#define PM4_FPU_FPTWICEAREA             0x0790
+#define PM4_FPU_DMAJOR01                0x0794
+#define PM4_FPU_DMAJOR12                0x0798
+#define PM4_FPU_DMAJOR02                0x079c
+#define PM4_FPU_STAT                    0x07a0
+#define PM4_STAT                        0x07b8
+#define PM4_TEST_CNTL                   0x07d0
+#define PM4_MICROCODE_ADDR              0x07d4
+#define PM4_MICROCODE_RADDR             0x07d8
+#define PM4_MICROCODE_DATAH             0x07dc
+#define PM4_MICROCODE_DATAL             0x07e0
+#define PM4_CMDFIFO_ADDR                0x07e4
+#define PM4_CMDFIFO_DATAH               0x07e8
+#define PM4_CMDFIFO_DATAL               0x07ec
+#define PM4_BUFFER_ADDR                 0x07f0
+#define PM4_BUFFER_DATAH                0x07f4
+#define PM4_BUFFER_DATAL                0x07f8
+#define PM4_MICRO_CNTL                  0x07fc
+#define CAP0_TRIG_CNTL                  0x0950
+#define CAP1_TRIG_CNTL                  0x09c0
+
+/******************************************************************************
+ *                  GUI Block Memory Mapped Registers                         *
+ *                     These registers are FIFOed.                            *
+ *****************************************************************************/
+#define PM4_FIFO_DATA_EVEN              0x1000
+#define PM4_FIFO_DATA_ODD               0x1004
+
+#define DST_OFFSET                      0x1404
+#define DST_PITCH                       0x1408
+#define DST_WIDTH                       0x140c
+#define DST_HEIGHT                      0x1410
+#define SRC_X                           0x1414
+#define SRC_Y                           0x1418
+#define DST_X                           0x141c
+#define DST_Y                           0x1420
+#define SRC_PITCH_OFFSET                0x1428
+#define DST_PITCH_OFFSET                0x142c
+#define SRC_Y_X                         0x1434
+#define DST_Y_X                         0x1438
+#define DST_HEIGHT_WIDTH                0x143c
+#define DP_GUI_MASTER_CNTL              0x146c
+#define BRUSH_SCALE                     0x1470
+#define BRUSH_Y_X                       0x1474
+#define DP_BRUSH_BKGD_CLR               0x1478
+#define DP_BRUSH_FRGD_CLR               0x147c
+#define DST_WIDTH_X                     0x1588
+#define DST_HEIGHT_WIDTH_8              0x158c
+#define SRC_X_Y                         0x1590
+#define DST_X_Y                         0x1594
+#define DST_WIDTH_HEIGHT                0x1598
+#define DST_WIDTH_X_INCY                0x159c
+#define DST_HEIGHT_Y                    0x15a0
+#define DST_X_SUB                       0x15a4
+#define DST_Y_SUB                       0x15a8
+#define SRC_OFFSET                      0x15ac
+#define SRC_PITCH                       0x15b0
+#define DST_HEIGHT_WIDTH_BW             0x15b4
+#define CLR_CMP_CNTL                    0x15c0
+#define CLR_CMP_CLR_SRC                 0x15c4
+#define CLR_CMP_CLR_DST                 0x15c8
+#define CLR_CMP_MASK                    0x15cc
+#define DP_SRC_FRGD_CLR                 0x15d8
+#define DP_SRC_BKGD_CLR                 0x15dc
+#define DST_BRES_ERR                    0x1628
+#define DST_BRES_INC                    0x162c
+#define DST_BRES_DEC                    0x1630
+#define DST_BRES_LNTH                   0x1634
+#define DST_BRES_LNTH_SUB               0x1638
+#define SC_LEFT                         0x1640
+#define SC_RIGHT                        0x1644
+#define SC_TOP                          0x1648
+#define SC_BOTTOM                       0x164c
+#define SRC_SC_RIGHT                    0x1654
+#define SRC_SC_BOTTOM                   0x165c
+#define GUI_DEBUG0                      0x16a0
+#define GUI_DEBUG1                      0x16a4
+#define GUI_TIMEOUT                     0x16b0
+#define GUI_TIMEOUT0                    0x16b4
+#define GUI_TIMEOUT1                    0x16b8
+#define GUI_PROBE                       0x16bc
+#define DP_CNTL                         0x16c0
+#define DP_DATATYPE                     0x16c4
+#define DP_MIX                          0x16c8
+#define DP_WRITE_MASK                   0x16cc
+#define DP_CNTL_XDIR_YDIR_YMAJOR        0x16d0
+#define DEFAULT_OFFSET                  0x16e0
+#define DEFAULT_PITCH                   0x16e4
+#define DEFAULT_SC_BOTTOM_RIGHT         0x16e8
+#define SC_TOP_LEFT                     0x16ec
+#define SC_BOTTOM_RIGHT                 0x16f0
+#define SRC_SC_BOTTOM_RIGHT             0x16f4
+#define WAIT_UNTIL                      0x1720
+#define CACHE_CNTL                      0x1724
+#define GUI_STAT                        0x1740
+#define PC_GUI_MODE                     0x1744
+#define PC_GUI_CTLSTAT                  0x1748
+#define PC_DEBUG_MODE                   0x1760
+#define BRES_DST_ERR_DEC                0x1780
+#define TRAIL_BRES_T12_ERR_DEC          0x1784
+#define TRAIL_BRES_T12_INC              0x1788
+#define DP_T12_CNTL                     0x178c
+#define DST_BRES_T1_LNTH                0x1790
+#define DST_BRES_T2_LNTH                0x1794
+#define SCALE_SRC_HEIGHT_WIDTH          0x1994
+#define SCALE_OFFSET_0                  0x1998
+#define SCALE_PITCH                     0x199c
+#define SCALE_X_INC                     0x19a0
+#define SCALE_Y_INC                     0x19a4
+#define SCALE_HACC                      0x19a8
+#define SCALE_VACC                      0x19ac
+#define SCALE_DST_X_Y                   0x19b0
+#define SCALE_DST_HEIGHT_WIDTH          0x19b4
+#define SCALE_3D_CNTL                   0x1a00
+#define SCALE_3D_DATATYPE               0x1a20
+#define SETUP_CNTL                      0x1bc4
+#define SOLID_COLOR                     0x1bc8
+#define WINDOW_XY_OFFSET                0x1bcc
+#define DRAW_LINE_POINT                 0x1bd0
+#define SETUP_CNTL_PM4                  0x1bd4
+#define DST_PITCH_OFFSET_C              0x1c80
+#define DP_GUI_MASTER_CNTL_C            0x1c84
+#define SC_TOP_LEFT_C                   0x1c88
+#define SC_BOTTOM_RIGHT_C               0x1c8c
+
+#define CLR_CMP_MASK_3D                 0x1A28
+#define MISC_3D_STATE_CNTL_REG          0x1CA0
+#define MC_SRC1_CNTL                    0x19D8
+#define TEX_CNTL                        0x1800
+
+/* CONSTANTS */
+#define ENG_3D_BUSY                     0x02000000
+#define GUI_ACTIVE                      0x80000000
+
+
+#define ENGINE_IDLE                     0x0
+
+#define PLL_WR_EN                       0x00000080
+
+#define CLK_PIN_CNTL                    0x0001
+#define PPLL_CNTL                       0x0002
+#define PPLL_REF_DIV                    0x0003
+#define PPLL_DIV_0                      0x0004
+#define PPLL_DIV_1                      0x0005
+#define PPLL_DIV_2                      0x0006
+#define PPLL_DIV_3                      0x0007
+#define VCLK_ECP_CNTL                   0x0008
+#define HTOTAL_CNTL                     0x0009
+#define X_MPLL_REF_FB_DIV               0x000a
+#define XPLL_CNTL                       0x000b
+#define XDLL_CNTL                       0x000c
+#define XCLK_CNTL                       0x000d
+#define MPLL_CNTL                       0x000e
+#define MCLK_CNTL                       0x000f
+#define AGP_PLL_CNTL                    0x0010
+#define FCP_CNTL                        0x0012
+#define PLL_TEST_CNTL                   0x0013
+
+#define PPLL_RESET                      0x01
+#define PPLL_ATOMIC_UPDATE_EN           0x10000
+#define PPLL_VGA_ATOMIC_UPDATE_EN       0x20000
+#define PPLL_REF_DIV_MASK               0x3FF
+#define PPLL_FB3_DIV_MASK               0x7FF
+#define PPLL_POST3_DIV_MASK             0x70000
+#define PPLL_ATOMIC_UPDATE_R            0x8000
+#define PPLL_ATOMIC_UPDATE_W            0x8000
+#define MEM_CFG_TYPE_MASK               0x3
+#define XCLK_SRC_SEL_MASK               0x7
+#define XPLL_FB_DIV_MASK                0xFF00
+#define X_MPLL_REF_DIV_MASK             0xFF
+
+/* CRTC control values (CRTC_GEN_CNTL) */
+#define CRTC_CSYNC_EN                   0x00000010
+
+#define CRTC_PIX_WIDTH_MASK             0x00000700
+#define CRTC_PIX_WIDTH_4BPP             0x00000100
+#define CRTC_PIX_WIDTH_8BPP             0x00000200
+#define CRTC_PIX_WIDTH_15BPP            0x00000300
+#define CRTC_PIX_WIDTH_16BPP            0x00000400
+#define CRTC_PIX_WIDTH_24BPP            0x00000500
+#define CRTC_PIX_WIDTH_32BPP            0x00000600
+
+/* DAC_CNTL bit constants */
+#define DAC_8BIT_EN                     0x00000100
+#define DAC_MASK                        0xFF000000
+#define DAC_BLANKING                    0x00000004
+#define DAC_RANGE_CNTL                  0x00000003
+#define DAC_RANGE_CNTL                  0x00000003
+#define DAC_PALETTE_ACCESS_CNTL         0x00000020
+#define DAC_PDWN                        0x00008000
+
+/* GEN_RESET_CNTL bit constants */
+#define SOFT_RESET_GUI                  0x00000001
+#define SOFT_RESET_VCLK                 0x00000100
+#define SOFT_RESET_PCLK                 0x00000200
+#define SOFT_RESET_ECP                  0x00000400
+#define SOFT_RESET_DISPENG_XCLK         0x00000800
+
+/* PC_GUI_CTLSTAT bit constants */
+#define PC_BUSY_INIT                    0x10000000
+#define PC_BUSY_GUI                     0x20000000
+#define PC_BUSY_NGUI                    0x40000000
+#define PC_BUSY                         0x80000000
+
+#define BUS_MASTER_DIS                  0x00000040
+#define PM4_BUFFER_CNTL_NONPM4          0x00000000
+
+/* DP_DATATYPE bit constants */
+#define DST_8BPP                        0x00000002
+#define DST_15BPP                       0x00000003
+#define DST_16BPP                       0x00000004
+#define DST_24BPP                       0x00000005
+#define DST_32BPP                       0x00000006
+#define DST_8BPP_RGB332                 0x00000007
+#define DST_8BPP_Y8                     0x00000008
+#define DST_8BPP_RGB8                   0x00000009
+#define DST_16BPP_VYUY422               0x0000000b
+#define DST_16BPP_YVYU422               0x0000000c
+#define DST_32BPP_AYUV444               0x0000000e
+#define DST_16BPP_ARGB4444              0x0000000f
+#define BRUSH_8x8MONO                   0x00000000
+#define BRUSH_8x8MONO_LBKGD             0x00000100
+#define BRUSH_8x1MONO                   0x00000200
+#define BRUSH_8x1MONO_LBKGD             0x00000300
+#define BRUSH_1x8MONO                   0x00000400
+#define BRUSH_1x8MONO_LBKGD             0x00000500
+#define BRUSH_32x1MONO                  0x00000600
+#define BRUSH_32x1MONO_LBKGD            0x00000700
+#define BRUSH_32x32MONO                 0x00000800
+#define BRUSH_32x32MONO_LBKGD           0x00000900
+#define BRUSH_8x8COLOR                  0x00000a00
+#define BRUSH_8x1COLOR                  0x00000b00
+#define BRUSH_1x8COLOR                  0x00000c00
+#define BRUSH_SOLIDCOLOR                0x00000d00
+#define SRC_MONO                        0x00000000
+#define SRC_MONO_LBKGD                  0x00010000
+#define SRC_DSTCOLOR                    0x00030000
+#define BYTE_ORDER_MSB_TO_LSB           0x00000000
+#define BYTE_ORDER_LSB_TO_MSB           0x40000000
+#define DP_CONVERSION_TEMP              0x80000000
+
+/* DP_GUI_MASTER_CNTL bit constants */
+#define GMC_SRC_PITCH_OFFSET_DEFAULT    0x00000000
+#define GMC_DST_PITCH_OFFSET_DEFAULT    0x00000000
+#define GMC_SRC_CLIP_DEFAULT            0x00000000
+#define GMC_DST_CLIP_DEFAULT            0x00000000
+#define GMC_BRUSH_SOLIDCOLOR            0x000000d0
+#define GMC_SRC_DSTCOLOR                0x00003000
+#define GMC_BYTE_ORDER_MSB_TO_LSB       0x00000000
+#define GMC_DP_SRC_RECT                 0x02000000
+#define GMC_3D_FCN_EN_CLR               0x00000000
+#define GMC_AUX_CLIP_CLEAR              0x20000000
+#define GMC_DST_CLR_CMP_FCN_CLEAR       0x10000000
+#define GMC_WRITE_MASK_SET              0x40000000
+#define GMC_DP_CONVERSION_TEMP_6500     0x00000000
+
+/* DP_GUI_MASTER_CNTL ROP3 named constants */
+#define ROP3_PATCOPY                    0x00f00000
+#define ROP3_SRCCOPY                    0x00cc0000
+
+#define SRC_DSTCOLOR                    0x00030000
+
+/* DP_CNTL bit constants */
+#define DST_X_RIGHT_TO_LEFT             0x00000000
+#define DST_X_LEFT_TO_RIGHT             0x00000001
+#define DST_Y_BOTTOM_TO_TOP             0x00000000
+#define DST_Y_TOP_TO_BOTTOM             0x00000002
+#define DST_X_MAJOR                     0x00000000
+#define DST_Y_MAJOR                     0x00000004
+#define DST_X_TILE                      0x00000008
+#define DST_Y_TILE                      0x00000010
+#define DST_LAST_PEL                    0x00000020
+#define DST_TRAIL_X_RIGHT_TO_LEFT       0x00000000
+#define DST_TRAIL_X_LEFT_TO_RIGHT       0x00000040
+#define DST_TRAP_FILL_RIGHT_TO_LEFT     0x00000000
+#define DST_TRAP_FILL_LEFT_TO_RIGHT     0x00000080
+#define DST_BRES_SIGN                   0x00000100
+#define DST_HOST_BIG_ENDIAN_EN          0x00000200
+#define DST_POLYLINE_NONLAST            0x00008000
+#define DST_RASTER_STALL                0x00010000
+#define DST_POLY_EDGE                   0x00040000
+
+/* DP_MIX bit constants */
+#define DP_SRC_RECT                     0x00000200
+#define DP_SRC_HOST                     0x00000300
+#define DP_SRC_HOST_BYTEALIGN           0x00000400
+
+/* LVDS_GEN_CNTL constants */
+#define LVDS_BL_MOD_LEVEL_MASK          0x0000ff00
+#define LVDS_BL_MOD_LEVEL_SHIFT         0x8
+#define LVDS_BL_MOD_EN                  0x00010000
+#define LVDS_DIGION                     0x00040000
+#define LVDS_BLON                       0x00080000
+
+
+/* from the ati128ddk */
+
+#define FOG_3D_TABLE_START              0x1810
+#define FOG_3D_TABLE_END                0x1814
+#define FOG_3D_TABLE_DENSITY            0x181c
+
+#define FOG_TABLE_INDEX                 0x1a14
+#define FOG_TABLE_DATA                  0x1a18
+
+/* MISC_3D_STATE */
+#define MISC_3D_STATE_SCALE_3D_FN_NOP                         (0x00000000 << 8)
+#define MISC_3D_STATE_SCALE_3D_FN_SCALE                       (0x00000001 << 8)
+#define MISC_3D_STATE_SCALE_3D_FN_TMAP_SHADE                  (0x00000002 << 8)
+#define MISC_3D_STATE_SCALE_PIX_REP_BLEND                     (0x00000000 << 10)
+#define MISC_3D_STATE_SCALE_PIX_REP_REPLICATE                 (0x00000001 << 10)
+#define MISC_3D_STATE_ALPHA_COMB_FNC_ADD_CLAMP                (0x00000000 << 12)
+#define MISC_3D_STATE_ALPHA_COMB_FNC_ADD_NO_CLAMP             (0x00000001 << 12)
+#define MISC_3D_STATE_ALPHA_COMB_FNC_SUB_SRC_DST_CLAMP        (0x00000002 << 12)
+#define MISC_3D_STATE_ALPHA_COMB_FNC_SUB_SRC_DST_NO_CLAMP     (0x00000003 << 12)
+#define MISC_3D_STATE_FOG_TABLE_EN_VERTEX_FOG                 (0x00000000 << 14)
+#define MISC_3D_STATE_FOG_TABLE_EN_TABLE_FOG                  (0x00000001 << 14)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_ZERO                    (0x00000000 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_ONE                     (0x00000001 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_SRCCOLOR                (0x00000002 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_INVSRCCOLOR             (0x00000003 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_SRCALPHA                (0x00000004 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_INVSRCALPHA             (0x00000005 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_DESTALPHA               (0x00000006 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_INVDESTALPHA            (0x00000007 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_DESTCOLOR               (0x00000008 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_INVDESTCOLOR            (0x00000009 << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_SRCALPHASAT             (0x0000000a << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_BOTHSRCALPHA            (0x0000000b << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_SRC_BOTHINVSRCALPHA         (0x0000000c << 16)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_ZERO                    (0x00000000 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_ONE                     (0x00000001 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_SRCCOLOR                (0x00000002 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_INVSRCCOLOR             (0x00000003 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_SRCALPHA                (0x00000004 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_INVSRCALPHA             (0x00000005 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_DESTALPHA               (0x00000006 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_INVDESTALPHA            (0x00000007 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_DESTCOLOR               (0x00000008 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_INVDESTCOLOR            (0x00000009 << 20)
+#define MISC_3D_STATE_ALPHA_BLEND_DST_SRCALPHASAT             (0x0000000a << 20)
+#define MISC_3D_STATE_ALPHA_TEST_OP_NEVER                     (0x00000000 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_LESS                      (0x00000001 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_LESSEQUAL                 (0x00000002 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_EQUAL                     (0x00000003 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_GREATEREQUAL              (0x00000004 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_GREATER                   (0x00000005 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_NEQUAL                    (0x00000006 << 24)
+#define MISC_3D_STATE_ALPHA_TEST_OP_ALWAYS                    (0x00000007 << 24)
+
+
+
+/* Z_STEN_CNTL */
+#define Z_STEN_CNTL_Z_PIX_WIDTH_16                            (0x00000000 <<  1)
+#define Z_STEN_CNTL_Z_PIX_WIDTH_24                            (0x00000001 <<  1)
+#define Z_STEN_CNTL_Z_PIX_WIDTH_32                            (0x00000002 <<  1)
+#define Z_STEN_CNTL_Z_TEST_NEVER                              (0x00000000 <<  4)
+#define Z_STEN_CNTL_Z_TEST_LESS                               (0x00000001 <<  4)
+#define Z_STEN_CNTL_Z_TEST_LESSEQUAL                          (0x00000002 <<  4)
+#define Z_STEN_CNTL_Z_TEST_EQUAL                              (0x00000003 <<  4)
+#define Z_STEN_CNTL_Z_TEST_GREATEREQUAL                       (0x00000004 <<  4)
+#define Z_STEN_CNTL_Z_TEST_GREATER                            (0x00000005 <<  4)
+#define Z_STEN_CNTL_Z_TEST_NEQUAL                             (0x00000006 <<  4)
+#define Z_STEN_CNTL_Z_TEST_ALWAYS                             (0x00000007 <<  4)
+#define Z_STEN_CNTL_STENCIL_TEST_NEVER                        (0x00000000 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_LESS                         (0x00000001 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_LESSEQUAL                    (0x00000002 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_EQUAL                        (0x00000003 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_GREATEREQUAL                 (0x00000004 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_GREATER                      (0x00000005 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_NEQUAL                       (0x00000006 << 12)
+#define Z_STEN_CNTL_STENCIL_TEST_ALWAYS                       (0x00000007 << 12)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_KEEP                    (0x00000000 << 16)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_ZERO                    (0x00000001 << 16)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_REPLACE                 (0x00000002 << 16)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_INC                     (0x00000003 << 16)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_DEC                     (0x00000004 << 16)
+#define Z_STEN_CNTL_STENCIL_S_FAIL_OP_INV                     (0x00000005 << 16)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_KEEP                     (0x00000000 << 20)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_ZERO                     (0x00000001 << 20)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_REPLACE                  (0x00000002 << 20)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_INC                      (0x00000003 << 20)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_DEC                      (0x00000004 << 20)
+#define Z_STEN_CNTL_STENCIL_ZPASS_OP_INV                      (0x00000005 << 20)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_KEEP                     (0x00000000 << 24)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_ZERO                     (0x00000001 << 24)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_REPLACE                  (0x00000002 << 24)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_INC                      (0x00000003 << 24)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_DEC                      (0x00000004 << 24)
+#define Z_STEN_CNTL_STENCIL_ZFAIL_OP_INV                      (0x00000005 << 24)
+
+/* TEX_CNTL */
+#define TEX_CNTL_Z_EN_OFF                                     (0x00000000 <<  0)
+#define TEX_CNTL_Z_EN_ON                                      (0x00000001 <<  0)
+#define TEX_CNTL_Z_MASK_DIS                                   (0x00000000 <<  1)
+#define TEX_CNTL_Z_MASK_EN                                    (0x00000001 <<  1)
+#define TEX_CNTL_STENCIL_EN_OFF                               (0x00000000 <<  3)
+#define TEX_CNTL_STENCIL_EN_ON                                (0x00000001 <<  3)
+#define TEX_CNTL_TEX_EN_SHADE                                 (0x00000000 <<  4)
+#define TEX_CNTL_TEX_EN_TMAP                                  (0x00000001 <<  4)
+#define TEX_CNTL_SECONDARY_TEX_EN_OFF                         (0x00000000 <<  5)
+#define TEX_CNTL_SECONDARY_TEX_EN_ON                          (0x00000001 <<  5)
+#define TEX_CNTL_FOG_EN_OFF                                   (0x00000000 <<  7)
+#define TEX_CNTL_FOG_EN_ON                                    (0x00000001 <<  7)
+#define TEX_CNTL_DITHRE_EN_OFF                                (0x00000000 <<  8)
+#define TEX_CNTL_DITHRE_EN_ON                                 (0x00000001 <<  8)
+#define TEX_CNTL_ALPHA_EN_OFF                                 (0x00000000 <<  9)
+#define TEX_CNTL_ALPHA_EN_ON                                  (0x00000001 <<  9)
+#define TEX_CNTL_ALPHA_TEST_EN_OFF                            (0x00000000 << 10)
+#define TEX_CNTL_ALPHA_TEST_EN_ON                             (0x00000001 << 10)
+#define TEX_CNTL_SPEC_LIGHT_EN_OFF                            (0x00000000 << 11)
+#define TEX_CNTL_SPEC_LIGHT_EN_ON                             (0x00000001 << 11)
+#define TEX_CNTL_TEX_CHROMA_KEY_EN_OFF                        (0x00000000 << 12)
+#define TEX_CNTL_TEX_CHROMA_KEY_EN_ON                         (0x00000001 << 12)
+#define TEX_CNTL_AMASK_EN_OFF                                 (0x00000000 << 13)
+#define TEX_CNTL_AMASK_EN_ON                                  (0x00000001 << 13)
+#define TEX_CNTL_LIGHT_FN_DIS                                 (0x00000000 << 14)
+#define TEX_CNTL_LIGHT_FN_COPY                                (0x00000001 << 14)
+#define TEX_CNTL_LIGHT_FN_MODULATE                            (0x00000002 << 14)
+#define TEX_CNTL_LIGHT_FN_ADD                                 (0x00000003 << 14)
+#define TEX_CNTL_LIGHT_FN_BLEND_CONSTANT                      (0x00000004 << 14)
+#define TEX_CNTL_LIGHT_FN_BLEND_TEXTURE                       (0x00000005 << 14)
+#define TEX_CNTL_LIGHT_FN_BLEND_VERTEX                        (0x00000006 << 14)
+#define TEX_CNTL_LIGHT_FN_BLEND_CONST_COLOR                   (0x00000007 << 14)
+#define TEX_CNTL_ALPHA_LIGHT_FN_DIS                           (0x00000000 << 18)
+#define TEX_CNTL_ALPHA_LIGHT_FN_COPY                          (0x00000001 << 18)
+#define TEX_CNTL_ALPHA_LIGHT_FN_MODULATE                      (0x00000002 << 18)
+#define TEX_CNTL_ALPHA_LIGHT_FN_ADD                           (0x00000003 << 18)
+//#define TEX_CNTL_ANTI_ALIAS_FN
+#define TEX_CNTL_TEX_CACHE_FLUSH_OFF                          (0x00000000 << 23)
+#define TEX_CNTL_TEX_CACHE_FLUSH_ON                           (0x00000001 << 23)
+//#define TEX_CNTL_LOD_BIAS
+
+
+/* PRIM_TEX_CNTL */
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_NEAREST               (0x00000000 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_LINEAR                (0x00000001 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_MIPNEAREST            (0x00000002 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_MIPLINEAR             (0x00000003 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_LINEARMIPNEAREST      (0x00000004 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MIN_BLEND_FN_LINEARMIPLINEAR       (0x00000005 <<  0)
+#define PRIM_TEX_CNTL_PRIM_MAG_BLEND_FN_NEAREST               (0x00000000 <<  4)
+#define PRIM_TEX_CNTL_PRIM_MAG_BLEND_FN_LINEAR                (0x00000001 <<  4)
+#define PRIM_TEX_CNTL_MIP_MAP_DIS_OFF                         (0x00000000 <<  7)
+#define PRIM_TEX_CNTL_MIP_MAP_DIS_ON                          (0x00000001 <<  7)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_S_WRAP              (0x00000000 <<  8)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_S_MIRROR            (0x00000001 <<  8)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_S_CLAMP             (0x00000002 <<  8)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_S_BORDER_COLOR      (0x00000003 <<  8)
+#define PRIM_TEX_CNTL_PRIM_TEX_WRAP_S_OFF                     (0x00000000 << 10)
+#define PRIM_TEX_CNTL_PRIM_TEX_WRAP_S_ON                      (0x00000001 << 10)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_T_WRAP              (0x00000000 << 11)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_T_MIRROR            (0x00000001 << 11)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_T_CLAMP             (0x00000002 << 11)
+#define PRIM_TEX_CNTL_PRIM_TEX_CLAMP_MODE_T_BORDER_COLOR      (0x00000003 << 11)
+#define PRIM_TEX_CNTL_PRIM_TEX_WRAP_T_OFF                     (0x00000000 << 13)
+#define PRIM_TEX_CNTL_PRIM_TEX_WRAP_T_ON                      (0x00000001 << 13)
+#define PRIM_TEX_CNTL_PRIM_TEX_PERSPECTIVE_DIS_OFF            (0x00000000 << 14)
+#define PRIM_TEX_CNTL_PRIM_TEX_PERSPECTIVE_DIS_ON             (0x00000001 << 14)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_VQ                        (0x00000000 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_CI4                       (0x00000001 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_CI8                       (0x00000002 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_ARGB1555                  (0x00000003 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_RGB565                    (0x00000004 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_RGB888                    (0x00000005 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_ARGB8888                  (0x00000006 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_RGB332                    (0x00000007 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_Y8                        (0x00000008 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_RGB8                      (0x00000009 << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_CI16                      (0x0000000a << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_YUV422                    (0x0000000b << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_YUV422_2                  (0x0000000c << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_AYUV444                   (0x0000000d << 16)
+#define PRIM_TEX_CNTL_PRIM_DATATYPE_ARGB4444                  (0x0000000e << 16)
+//#define PRIM_TEX_CNTL_PRIM_PALETTE_OFF_
+//#define PRIM_TEX_CNTL_PRIM_PSEUDOCOLOR_DATATYPE_
+
+
+/* SETP_CNTL */
+#define SETUP_CNTL_DONT_START_TRI_OFF                         (0x00000000 <<  0)
+#define SETUP_CNTL_DONT_START_TRI_ON                          (0x00000001 <<  0)
+#define SETUP_CNTL_Z_BIAS                                     (0x00000000 <<  1)
+#define SETUP_CNTL_DONT_START_ANY_OFF                         (0x00000000 <<  2)
+#define SETUP_CNTL_DONT_START_ANY_ON                          (0x00000001 <<  2)
+#define SETUP_CNTL_COLOR_FNC_SOLID_COLOR                      (0x00000000 <<  3)
+#define SETUP_CNTL_COLOR_FNC_FLAT_VERT_1                      (0x00000001 <<  3)
+#define SETUP_CNTL_COLOR_FNC_FLAT_VERT_2                      (0x00000002 <<  3)
+#define SETUP_CNTL_COLOR_FNC_FLAT_VERT_3                      (0x00000003 <<  3)
+#define SETUP_CNTL_COLOR_FNC_GOURAUD                          (0x00000004 <<  3)
+#define SETUP_CNTL_PRIM_TYPE_SELECT_TRI                       (0x00000000 <<  7)
+#define SETUP_CNTL_PRIM_TYPE_SELECT_LINE                      (0x00000001 <<  7)
+#define SETUP_CNTL_PRIM_TYPE_SELECT_POINT                     (0x00000002 <<  7)
+#define SETUP_CNTL_PRIM_TYPE_SELECT_POLY_EDGE                 (0x00000003 <<  7)
+#define SETUP_CNTL_TEXTURE_ST_FORMAT_MULT_W                   (0x00000000 <<  9)
+#define SETUP_CNTL_TEXTURE_ST_FORMAT_DIRECT                   (0x00000001 <<  9)
+#define SETUP_CNTL_STARTING_VERTEX_SELECT_1                   (0x00000001 << 14)
+#define SETUP_CNTL_STARTING_VERTEX_SELECT_2                   (0x00000002 << 14)
+#define SETUP_CNTL_STARTING_VERTEX_SELECT_3                   (0x00000003 << 14)
+#define SETUP_CNTL_ENDING_VERTEX_SELECT_1                     (0x00000001 << 16)
+#define SETUP_CNTL_ENDING_VERTEX_SELECT_2                     (0x00000002 << 16)
+#define SETUP_CNTL_ENDING_VERTEX_SELECT_3                     (0x00000003 << 16)
+#define SETUP_CNTL_SU_POLY_LINE_LAST                          (0x00000000 << 18)
+#define SETUP_CNTL_SU_POLY_LINE_NOT_LAST                      (0x00000001 << 18)
+#define SETUP_CNTL_SUB_PIX_AMOUNT_2BITS                       (0x00000000 << 19)
+#define SETUP_CNTL_SUB_PIX_AMOUNT_4BITS                       (0x00000001 << 19)
+//#define SETUP_CNTL_SU_POLY_EDGE
+//#define SETUP_CNTL_SU_EDGE_DST_Y_MAJOR
+//#define SETUP_CNTL_SU_STATE
+#define SETUP_CNTL_SET_UP_CONTINUE                            (0x00000001 << 31)
+
+/* PM4_VC_FPU_SETUP */
+#define PM4_VC_FPU_SETUP_FRONT_DIR_CW                         (0x00000000 <<  0)
+#define PM4_VC_FPU_SETUP_FRONT_DIR_CCW                        (0x00000001 <<  0)
+#define PM4_VC_FPU_SETUP_BACKFACE_CULLING_FN_CULL             (0x00000000 <<  1)
+#define PM4_VC_FPU_SETUP_BACKFACE_CULLING_FN_POINT            (0x00000001 <<  1)
+#define PM4_VC_FPU_SETUP_BACKFACE_CULLING_FN_LINE             (0x00000002 <<  1)
+#define PM4_VC_FPU_SETUP_BACKFACE_CULLING_FN_REV_SOLID        (0x00000003 <<  1)
+#define PM4_VC_FPU_SETUP_FRONTFACE_CULLING_FN_CULL            (0x00000000 <<  3)
+#define PM4_VC_FPU_SETUP_FRONTFACE_CULLING_FN_POINT           (0x00000001 <<  3)
+#define PM4_VC_FPU_SETUP_FRONTFACE_CULLING_FN_LINE            (0x00000002 <<  3)
+#define PM4_VC_FPU_SETUP_FRONTFACE_CULLING_FN_REV_SOLID       (0x00000003 <<  3)
+#define PM4_VC_FPU_SETUP_PM4_COLOR_FCN_SOLID                  (0x00000000 <<  5)
+#define PM4_VC_FPU_SETUP_PM4_COLOR_FCN_FLAT                   (0x00000001 <<  5)
+#define PM4_VC_FPU_SETUP_PM4_COLOR_FCN_GOURAUD                (0x00000002 <<  5)
+#define PM4_VC_FPU_SETUP_PM4_COLOR_FCN_GOURAUD2               (0x00000003 <<  5)
+#define PM4_VC_FPU_SETUP_PM4_SUB_PIX_AMOUNT_2BITS             (0x00000000 <<  7)
+#define PM4_VC_FPU_SETUP_PM4_SUB_PIX_AMOUNT_4BITS             (0x00000001 <<  7)
+#define PM4_VC_FPU_SETUP_FPU_MODE_2D                          (0x00000000 <<  8)
+#define PM4_VC_FPU_SETUP_FPU_MODE_3D                          (0x00000001 <<  8)
+#define PM4_VC_FPU_SETUP_TRAP_DISABLE_OFF                     (0x00000000 <<  9)
+#define PM4_VC_FPU_SETUP_TRAP_DISABLE_ON                      (0x00000001 <<  9)
+#define PM4_VC_FPU_SETUP_EDGE_ANTIALIAS_OFF                   (0x00000000 << 10)
+#define PM4_VC_FPU_SETUP_EDGE_ANTIALIAS_ON                    (0x00000001 << 10)
+#define PM4_VC_FPU_SETUP_SUPERSAMPLE_OFF                      (0x00000000 << 11)
+#define PM4_VC_FPU_SETUP_SUPERSAMPLE_ON                       (0x00000001 << 11)
+#define PM4_VC_FPU_SETUP_XFACTOR_2                            (0x00000000 << 12)
+#define PM4_VC_FPU_SETUP_XFACTOR_4                            (0x00000001 << 12)
+#define PM4_VC_FPU_SETUP_YFACTOR_2                            (0x00000000 << 13)
+#define PM4_VC_FPU_SETUP_YFACTOR_4                            (0x00000001 << 13)
+#define PM4_VC_FPU_SETUP_FLAT_SHADE_VERTEX_D3D                (0x00000000 << 14)
+#define PM4_VC_FPU_SETUP_FLAT_SHADE_VERTEX_OPENGL             (0x00000001 << 14)
+#define PM4_VC_FPU_SETUP_FPU_ROUND_EN_OFF                     (0x00000000 << 15)
+#define PM4_VC_FPU_SETUP_FPU_ROUND_EN_ON                      (0x00000001 << 15)
+#define PM4_VC_FPU_SETUP_VC_WM_SEL_8DW                        (0x00000000 << 16)
+#define PM4_VC_FPU_SETUP_VC_WM_SEL_16DW                       (0x00000001 << 16)
+#define PM4_VC_FPU_SETUP_VC_WM_SEL_32DW                       (0x00000002 << 16)
+
+/* SEC_TEX_CNTL */
+#define SEC_TEX_CNTL_SEC_SRC_SEL_ST_0                         (0x00000000 <<  0)
+#define SEC_TEX_CNTL_SEC_SRC_SEL_ST_1                         (0x00000001 <<  0)
+
+/* [PRIM_ | SEC_] SEC_TEX_COMBINE_CNTL */
+#define TEX_COMBINE_CNTL_COMB_FNC_DIS                         (0x00000000 << 0)
+#define TEX_COMBINE_CNTL_COMB_FNC_COPY                        (0x00000001 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_COPY_INP                    (0x00000002 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_MODULATE                    (0x00000003 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_MODULATE2X                  (0x00000004 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_MODULATE4X                  (0x00000005 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_ADD                         (0x00000006 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_ADD_SIGNED                  (0x00000007 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_VERTEX                (0x00000008 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_TEXTURE               (0x00000009 <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_CONST                 (0x0000000a <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_PREMULT               (0x0000000b <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_PREV                  (0x0000000c <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_PREMULT_INV           (0x0000000d <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_ADD_SIGNED2X                (0x0000000e <<  0)
+#define TEX_COMBINE_CNTL_COMB_FNC_BLEND_CONST_COLOR           (0x0000000f <<  0)
+#define TEX_COMBINE_CNTL_COLOR_FACTOR_TEX                     (0x00000004 <<  4)
+#define TEX_COMBINE_CNTL_COLOR_FACTOR_NTEX                    (0x00000005 <<  4)
+#define TEX_COMBINE_CNTL_COLOR_FACTOR_ALPHA                   (0x00000006 <<  4)
+#define TEX_COMBINE_CNTL_COLOR_FACTOR_NALPHA                  (0x00000007 <<  4)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_CONST_COLOR             (0x00000002 << 10)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_CONST_ALPHA             (0x00000003 << 10)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_INT_COLOR               (0x00000004 << 10)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_INT_ALPHA               (0x00000005 << 10)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_PREV_COLOR              (0x00000008 << 10)
+#define TEX_COMBINE_CNTL_INPUT_FACTOR_PREV_ALPHA              (0x00000009 << 10)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_DIS                   (0x00000000 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_COPY                  (0x00000001 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_COPY_INP              (0x00000002 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_MODULATE              (0x00000003 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_MODULATE2X            (0x00000004 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_MODULATE4X            (0x00000005 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_ADD                   (0x00000006 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_ADD_SIGNED            (0x00000007 << 14)
+#define TEX_COMBINE_CNTL_COMB_FNC_ALPHA_ADD_SIGNED2X          (0x0000000e << 14)
+#define TEX_COMBINE_CNTL_ALPHA_FACTOR_TEX_ALPHA               (0x00000006 << 18)
+#define TEX_COMBINE_CNTL_ALPHA_FACTOR_NTEX_ALPHA              (0x00000007 << 18)
+#define TEX_COMBINE_CNTL_INP_FACTOR_ALPHA_CONST_ALPHA         (0x00000001 << 25)
+#define TEX_COMBINE_CNTL_INP_FACTOR_ALPHA_INT_ALPHA           (0x00000002 << 25)
+#define TEX_COMBINE_CNTL_INP_FACTOR_ALPHA_PREV_ALPHA          (0x00000004 << 25)
+
+
+/* SCALE_3D_CNTL */
+#define SCALE_3D_CNTL_SCALE_DITHER_ERR_DIFF                   (0x00000000 <<  1)
+#define SCALE_3D_CNTL_SCALE_DITHER_TABLE                      (0x00000001 <<  1)
+#define SCALE_3D_CNTL_TEX_CACHE_SIZE_FULL                     (0x00000000 <<  2)
+#define SCALE_3D_CNTL_TEX_CACHE_SIZE_HALF                     (0x00000001 <<  2)
+#define SCALE_3D_CNTL_DITHER_INIT_CURR                        (0x00000000 <<  3)
+#define SCALE_3D_CNTL_DITHER_INIT_RESET                       (0x00000001 <<  3)
+#define SCALE_3D_CNTL_ROUND_EN_OFF                            (0x00000000 <<  4)
+#define SCALE_3D_CNTL_ROUND_EN_ON                             (0x00000001 <<  4)
+#define SCALE_3D_CNTL_TEX_CACHE_DIS_OFF                       (0x00000000 <<  5)
+#define SCALE_3D_CNTL_TEX_CACHE_DIS_ON                        (0x00000001 <<  5)
+#define SCALE_3D_CNTL_SCALE_3D_FN_NONE                        (0x00000000 <<  6)
+#define SCALE_3D_CNTL_SCALE_3D_FN_SCALE                       (0x00000001 <<  6)
+#define SCALE_3D_CNTL_SCALE_3D_FN_TMAP_SHADE                  (0x00000002 <<  6)
+#define SCALE_3D_CNTL_SCALE_PIX_REP_BLEND                     (0x00000000 <<  8)
+#define SCALE_3D_CNTL_SCALE_PIX_REP_REP                       (0x00000001 <<  8)
+#define SCALE_3D_CNTL_TEX_CACHE_SPLIT_OFF                     (0x00000000 <<  9)
+#define SCALE_3D_CNTL_TEX_CACHE_SPLIT_ON                      (0x00000001 <<  9)
+#define SCALE_3D_CNTL_APPLE_YUV_MODE_OFF                      (0x00000000 << 10)
+#define SCALE_3D_CNTL_APPLE_YUV_MODE_ON                       (0x00000001 << 10)
+#define SCALE_3D_CNTL_TEX_CACHE_PAL_MODE_OFF                  (0x00000000 << 11)
+#define SCALE_3D_CNTL_TEX_CACHE_PAL_MODE_ON                   (0x00000001 << 11)
+#define SCALE_3D_CNTL_ALPHA_COMB_FNC_ADD_CLAMP                (0x00000000 << 12)
+#define SCALE_3D_CNTL_ALPHA_COMB_FNC_ADD_NCLAMP               (0x00000001 << 12)
+#define SCALE_3D_CNTL_ALPHA_COMB_FNC_SUB_DST_SRC_CLAMP        (0x00000002 << 12)
+#define SCALE_3D_CNTL_ALPHA_COMB_FNC_SUB_DST_SRC_NCLAMP       (0x00000003 << 12)
+#define SCALE_3D_CNTL_FOG_TABLE_EN_OFF                        (0x00000000 << 14)
+#define SCALE_3D_CNTL_FOG_TABLE_EN_ON                         (0x00000001 << 14)
+#define SCALE_3D_CNTL_SIGNED_DST_CLAMP_OFF                    (0x00000000 << 15)
+#define SCALE_3D_CNTL_SIGNED_DST_CLAMP_ON                     (0x00000001 << 15)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_ZERO                    (0x00000000 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_ONE                     (0x00000001 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_SRCCOLOR                (0x00000002 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVSRCCOLOR             (0x00000003 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_SRCALPHA                (0x00000004 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVSRCALPHA             (0x00000005 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_DSTALPHA                (0x00000006 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVDSTALPHA             (0x00000007 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_DSTCOLOR                (0x00000008 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVDSTCOLOR             (0x00000009 << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_SAT                     (0x0000000a << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_BLEND                   (0x0000000b << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_SRC_INVBLEND                (0x0000000c << 16)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_ZERO                    (0x00000000 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_ONE                     (0x00000001 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_SRCCOLOR                (0x00000002 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_INVSRCCOLOR             (0x00000003 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_SRCALPHA                (0x00000004 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_INVSRCALPHA             (0x00000005 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_DSTALPHA                (0x00000006 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_INVDSTALPHA             (0x00000007 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_DSTCOLOR                (0x00000008 << 20)
+#define SCALE_3D_CNTL_ALPHA_BLEND_DST_INVDSTCOLOR             (0x00000009 << 20)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_NEVER                     (0x00000000 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_LESS                      (0x00000001 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_LESSEQUAL                 (0x00000002 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_EQUAL                     (0x00000003 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_GREATEREQUAL              (0x00000004 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_GREATER                   (0x00000005 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_NEQUAL                    (0x00000006 << 24)
+#define SCALE_3D_CNTL_ALPHA_TEST_OP_ALWAYS                    (0x00000007 << 24)
+#define SCALE_3D_CNTL_COMPOSITE_SHADOW_CMP_EQUAL              (0x00000000 << 28)
+#define SCALE_3D_CNTL_COMPOSITE_SHADOW_CMP_NEQUAL             (0x00000001 << 28)
+#define SCALE_3D_CNTL_COMPOSITE_SHADOW_EN_OFF                 (0x00000000 << 29)
+#define SCALE_3D_CNTL_COMPOSITE_SHADOW_EN_ON                  (0x00000001 << 29)
+#define SCALE_3D_CNTL_TEX_MAP_AEN_OFF                         (0x00000000 << 30)
+#define SCALE_3D_CNTL_TEX_MAP_AEN_ON                          (0x00000001 << 30)
+#define SCALE_3D_CNTL_TEX_CACHE_LINE_SIZE_8QW                 (0x00000000 << 31)
+#define SCALE_3D_CNTL_TEX_CACHE_LINE_SIZE_4QW                 (0x00000001 << 31)
+
+
+
+
+#define SCALE_3D_DATATYPE                          0x1a20
+#define SETUP_CNTL                                 0x1bc4
+#define SOLID_COLOR                                0x1bc8
+#define WINDOW_XY_OFFSET                           0x1bcc
+#define DRAW_LINE_POINT                            0x1bd0
+#define SETUP_CNTL_PM4                             0x1bd4
+#define DST_PITCH_OFFSET_C                         0x1c80
+#define DP_GUI_MASTER_CNTL_C                       0x1c84
+#define SC_TOP_LEFT_C                              0x1c88
+#define SC_BOTTOM_RIGHT_C                          0x1c8c
+
+#define Z_OFFSET_C                                 0x1c90
+#define Z_PITCH_C                                  0x1c94
+#define Z_STEN_CNTL_C                              0x1c98
+#define TEX_CNTL_C                                 0x1c9c
+#define TEXTURE_CLR_CMP_CLR_C                      0x1CA4
+#define TEXTURE_CLR_CMP_MSK_C                      0x1CA8
+#define FOG_COLOR_C                                0x1CAC
+#define PRIM_TEX_CNTL_C                            0x1CB0
+#define PRIM_TEX_COMBINE_CNTL_C                    0x1CB4
+#define TEX_SIZE_PITCH_C                           0x1CB8
+#define PRIM_TEX_0_OFFSET_C                        0x1CBC
+#define PRIM_TEX_1_OFFSET_C                        0x1CC0
+#define PRIM_TEX_2_OFFSET_C                        0x1CC4
+#define PRIM_TEX_3_OFFSET_C                        0x1CC8
+#define PRIM_TEX_4_OFFSET_C                        0x1CCC
+#define PRIM_TEX_5_OFFSET_C                        0x1CD0
+#define PRIM_TEX_6_OFFSET_C                        0x1CD4
+#define PRIM_TEX_7_OFFSET_C                        0x1CD8
+#define PRIM_TEX_8_OFFSET_C                        0x1CDC
+#define PRIM_TEX_9_OFFSET_C                        0x1CE0
+#define PRIM_TEX_10_OFFSET_C                       0x1CE4
+#define SEC_TEX_CNTL_C                             0x1D00
+#define SEC_TEX_COMBINE_CNTL_C                     0x1D04
+#define SEC_TEX_0_OFFSET_C                         0x1D08
+#define SEC_TEX_1_OFFSET_C                         0x1D0C
+#define SEC_TEX_2_OFFSET_C                         0x1D10
+#define SEC_TEX_3_OFFSET_C                         0x1D14
+#define SEC_TEX_4_OFFSET_C                         0x1D18
+#define SEC_TEX_5_OFFSET_C                         0x1D1C
+#define SEC_TEX_6_OFFSET_C                         0x1D20
+#define SEC_TEX_7_OFFSET_C                         0x1D24
+#define SEC_TEX_8_OFFSET_C                         0x1D28
+#define SEC_TEX_9_OFFSET_C                         0x1D2C
+#define SEC_TEX_10_OFFSET_C                        0x1D30
+#define CONSTANT_COLOR_C                           0x1D34
+#define PRIM_TEXTURE_BORDER_COLOR_C                0x1D38
+#define SEC_TEXTURE_BORDER_COLOR_C                 0x1D3C
+#define STEN_REF_MASK_C                            0x1D40
+#define PLANE_3D_MASK_C                            0x1D44
+
+#define CLR_CMP_MASK_3D                            0x1A28
+#define MC_SRC1_CNTL                               0x19D8
+#define TEX_CNTL                                   0x1800
+#define CLR_CMP_CLR_3D 0x1A24
+
+
+/* first overlay unit (there is only one) */
+
+#define OV0_Y_X_START                0x0400
+#define OV0_Y_X_END                  0x0404
+#define OV0_EXCLUSIVE_HORZ           0x0408
+#       define  R128_EXCL_HORZ_START_MASK        0x000000ff
+#       define  R128_EXCL_HORZ_END_MASK          0x0000ff00
+#       define  R128_EXCL_HORZ_BACK_PORCH_MASK   0x00ff0000
+#       define  R128_EXCL_HORZ_EXCLUSIVE_EN      0x80000000
+#define OV0_EXCLUSIVE_VERT           0x040C
+#       define  R128_EXCL_VERT_START_MASK        0x000003ff
+#       define  R128_EXCL_VERT_END_MASK          0x03ff0000
+#define OV0_REG_LOAD_CNTL            0x0410
+#       define  R128_REG_LD_CTL_LOCK                 0x00000001L
+#       define  R128_REG_LD_CTL_VBLANK_DURING_LOCK   0x00000002L
+#       define  R128_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
+#       define  R128_REG_LD_CTL_LOCK_READBACK        0x00000008L
+#define OV0_SCALE_CNTL               0x0420
+#       define  R128_SCALER_PIX_EXPAND           0x00000001L
+#       define  R128_SCALER_Y2R_TEMP             0x00000002L
+#       define  R128_SCALER_HORZ_PICK_NEAREST    0x00000003L
+#       define  R128_SCALER_VERT_PICK_NEAREST    0x00000004L
+#       define  R128_SCALER_SIGNED_UV            0x00000010L
+#       define  R128_SCALER_GAMMA_SEL_MASK       0x00000060L
+#       define  R128_SCALER_GAMMA_SEL_BRIGHT     0x00000000L
+#       define  R128_SCALER_GAMMA_SEL_G22        0x00000020L
+#       define  R128_SCALER_GAMMA_SEL_G18        0x00000040L
+#       define  R128_SCALER_GAMMA_SEL_G14        0x00000060L
+#       define  R128_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
+#       define  R128_SCALER_SURFAC_FORMAT        0x00000f00L
+#       define  R128_SCALER_SOURCE_15BPP         0x00000300L
+#       define  R128_SCALER_SOURCE_16BPP         0x00000400L
+#       define  R128_SCALER_SOURCE_32BPP         0x00000600L
+#       define  R128_SCALER_SOURCE_YUV9          0x00000900L
+#       define  R128_SCALER_SOURCE_YUV12         0x00000A00L
+#       define  R128_SCALER_SOURCE_VYUY422       0x00000B00L
+#       define  R128_SCALER_SOURCE_YVYU422       0x00000C00L
+#       define  R128_SCALER_SMART_SWITCH         0x00008000L
+#       define  R128_SCALER_BURST_PER_PLANE      0x00ff0000L
+#       define  R128_SCALER_DOUBLE_BUFFER        0x01000000L
+#       define  R128_SCALER_DIS_LIMIT            0x08000000L
+#       define  R128_SCALER_PRG_LOAD_START       0x10000000L
+#       define  R128_SCALER_INT_EMU              0x20000000L
+#       define  R128_SCALER_ENABLE               0x40000000L
+#       define  R128_SCALER_SOFT_RESET           0x80000000L
+#define OV0_V_INC                    0x0424
+#define OV0_P1_V_ACCUM_INIT          0x0428
+#       define  OV0_P1_MAX_LN_IN_PER_LN_OUT        0x00000003L
+#       define  OV0_P1_V_ACCUM_INIT_MASK           0x01ff8000L
+#define OV0_P23_V_ACCUM_INIT         0x042C
+#define OV0_P1_BLANK_LINES_AT_TOP    0x0430
+#       define  R128_P1_BLNK_LN_AT_TOP_M1_MASK   0x00000fffL
+#       define  R128_P1_ACTIVE_LINES_M1          0x0fff0000L
+#define OV0_P23_BLANK_LINES_AT_TOP   0x0434
+#       define  R128_P23_BLNK_LN_AT_TOP_M1_MASK  0x000007ffL
+#       define  R128_P23_ACTIVE_LINES_M1         0x07ff0000L
+#define OV0_VID_BUF0_BASE_ADRS       0x0440
+#       define  R128_VIF_BUF0_PITCH_SEL          0x00000001L
+#       define  R128_VIF_BUF0_TILE_ADRS          0x00000002L
+#       define  R128_VIF_BUF0_BASE_ADRS_MASK     0x03fffff0L
+#       define  R128_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
+#define OV0_VID_BUF1_BASE_ADRS       0x0444
+#       define  R128_VIF_BUF1_PITCH_SEL          0x00000001L
+#       define  R128_VIF_BUF1_TILE_ADRS          0x00000002L
+#       define  R128_VIF_BUF1_BASE_ADRS_MASK     0x03fffff0L
+#       define  R128_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
+#define OV0_VID_BUF2_BASE_ADRS       0x0448
+#       define  R128_VIF_BUF2_PITCH_SEL          0x00000001L
+#       define  R128_VIF_BUF2_TILE_ADRS          0x00000002L
+#       define  R128_VIF_BUF2_BASE_ADRS_MASK     0x03fffff0L
+#       define  R128_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
+#define OV0_VID_BUF3_BASE_ADRS       0x044C
+#define OV0_VID_BUF4_BASE_ADRS       0x0450
+#define OV0_VID_BUF5_BASE_ADRS       0x0454
+#define OV0_VID_BUF_PITCH0_VALUE     0x0460
+#define OV0_VID_BUF_PITCH1_VALUE     0x0464
+#define OV0_AUTO_FLIP_CNTL           0x0470
+#define OV0_DEINTERLACE_PATTERN      0x0474
+#define OV0_H_INC                    0x0480
+#define OV0_STEP_BY                  0x0484
+#define OV0_P1_H_ACCUM_INIT          0x0488
+#define OV0_P23_H_ACCUM_INIT         0x048C
+#define OV0_P1_X_START_END           0x0494
+#define OV0_P2_X_START_END           0x0498
+#define OV0_P3_X_START_END           0x049C
+#define OV0_FILTER_CNTL              0x04A0
+#define OV0_FOUR_TAP_COEF_0          0x04B0
+#define OV0_FOUR_TAP_COEF_1          0x04B4
+#define OV0_FOUR_TAP_COEF_2          0x04B8
+#define OV0_FOUR_TAP_COEF_3          0x04BC
+#define OV0_FOUR_TAP_COEF_4          0x04C0
+#define OV0_COLOR_CNTL               0x04E0
+#define OV0_VIDEO_KEY_CLR            0x04E4
+#define OV0_VIDEO_KEY_MSK            0x04E8
+#define OV0_GRAPHICS_KEY_CLR         0x04EC
+#define OV0_GRAPHICS_KEY_MSK         0x04F0
+#define OV0_KEY_CNTL                 0x04F4
+#       define  R128_VIDEO_KEY_FN_MASK           0x00000007L
+#       define  R128_VIDEO_KEY_FN_FALSE          0x00000000L
+#       define  R128_VIDEO_KEY_FN_TRUE           0x00000001L
+#       define  R128_VIDEO_KEY_FN_EQ             0x00000004L
+#       define  R128_VIDEO_KEY_FN_NE             0x00000005L
+#       define  R128_GRAPHIC_KEY_FN_MASK         0x00000070L
+#       define  R128_GRAPHIC_KEY_FN_FALSE        0x00000000L
+#       define  R128_GRAPHIC_KEY_FN_TRUE         0x00000010L
+#       define  R128_GRAPHIC_KEY_FN_EQ           0x00000040L
+#       define  R128_GRAPHIC_KEY_FN_NE           0x00000050L
+#       define  R128_CMP_MIX_MASK                0x00000100L
+#       define  R128_CMP_MIX_OR                  0x00000000L
+#       define  R128_CMP_MIX_AND                 0x00000100L
+#define OV0_TEST                     0x04F8
+
+
+/* added by DirectFB programmers */
+#define CRTC_OFFSET_FLIP_CNTL                      0x00010000
+#define MEM_ADDR_CONFIG                            0x0148
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/Makefile.am b/Source/DirectFB/gfxdrivers/cle266/Makefile.am
new file mode 100755
index 0000000..fff4976
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/Makefile.am
@@ -0,0 +1,47 @@
+## Makefile.am for DirectFB/gfxdrivers/cle266
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+AM_CFLAGS = $(DFB_CFLAGS)
+
+cle266_LTLIBRARIES = libdirectfb_cle266.la
+
+if BUILD_STATIC
+cle266_DATA = $(cle266_LTLIBRARIES:.la=.o)
+endif
+
+cle266dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_cle266_la_SOURCES =     \
+	unichrome.c     unichrome.h     \
+	uc_accel.c      uc_accel.h      \
+	uc_hw.h                         \
+	uc_hwset.c      uc_hwmap.c      \
+	uc_state.c      uc_state.h      \
+	uc_fifo.c       uc_fifo.h       \
+	uc_overlay.c    uc_overlay.h    \
+	uc_ovl_hwmap.c  uc_ovl_hwset.c  \
+	uc_primary.c			\
+	mmio.h          vidregs.h       \
+	regs2d.h        regs3d.h
+
+libdirectfb_cle266_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_cle266_la_LIBADD = \
+	-lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/gfxdrivers/cle266/Makefile.in b/Source/DirectFB/gfxdrivers/cle266/Makefile.in
new file mode 100755
index 0000000..0c7ee2b
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/Makefile.in
@@ -0,0 +1,619 @@
+# 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/cle266
+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)$(cle266dir)" "$(DESTDIR)$(cle266dir)"
+cle266LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(cle266_LTLIBRARIES)
+libdirectfb_cle266_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_cle266_la_OBJECTS = unichrome.lo uc_accel.lo \
+	uc_hwset.lo uc_hwmap.lo uc_state.lo uc_fifo.lo uc_overlay.lo \
+	uc_ovl_hwmap.lo uc_ovl_hwset.lo uc_primary.lo
+libdirectfb_cle266_la_OBJECTS = $(am_libdirectfb_cle266_la_OBJECTS)
+libdirectfb_cle266_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_cle266_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_cle266_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_cle266_la_SOURCES)
+cle266DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(cle266_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+AM_CFLAGS = $(DFB_CFLAGS)
+cle266_LTLIBRARIES = libdirectfb_cle266.la
+@BUILD_STATIC_TRUE@cle266_DATA = $(cle266_LTLIBRARIES:.la=.o)
+cle266dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_cle266_la_SOURCES = \
+	unichrome.c     unichrome.h     \
+	uc_accel.c      uc_accel.h      \
+	uc_hw.h                         \
+	uc_hwset.c      uc_hwmap.c      \
+	uc_state.c      uc_state.h      \
+	uc_fifo.c       uc_fifo.h       \
+	uc_overlay.c    uc_overlay.h    \
+	uc_ovl_hwmap.c  uc_ovl_hwset.c  \
+	uc_primary.c			\
+	mmio.h          vidregs.h       \
+	regs2d.h        regs3d.h
+
+libdirectfb_cle266_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_cle266_la_LIBADD = \
+	-lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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/cle266/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/cle266/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-cle266LTLIBRARIES: $(cle266_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(cle266dir)" || $(MKDIR_P) "$(DESTDIR)$(cle266dir)"
+	@list='$(cle266_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cle266LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(cle266dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cle266LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(cle266dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-cle266LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(cle266_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(cle266dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(cle266dir)/$$p"; \
+	done
+
+clean-cle266LTLIBRARIES:
+	-test -z "$(cle266_LTLIBRARIES)" || rm -f $(cle266_LTLIBRARIES)
+	@list='$(cle266_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_cle266.la: $(libdirectfb_cle266_la_OBJECTS) $(libdirectfb_cle266_la_DEPENDENCIES) 
+	$(libdirectfb_cle266_la_LINK) -rpath $(cle266dir) $(libdirectfb_cle266_la_OBJECTS) $(libdirectfb_cle266_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_accel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_fifo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_hwmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_hwset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_ovl_hwmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_ovl_hwset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unichrome.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-cle266DATA: $(cle266_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(cle266dir)" || $(MKDIR_P) "$(DESTDIR)$(cle266dir)"
+	@list='$(cle266_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(cle266DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(cle266dir)/$$f'"; \
+	  $(cle266DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(cle266dir)/$$f"; \
+	done
+
+uninstall-cle266DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(cle266_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(cle266dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(cle266dir)/$$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)$(cle266dir)" "$(DESTDIR)$(cle266dir)"; 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-cle266LTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-cle266DATA install-cle266LTLIBRARIES
+
+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-cle266DATA uninstall-cle266LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-cle266LTLIBRARIES clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-cle266DATA \
+	install-cle266LTLIBRARIES install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-cle266DATA uninstall-cle266LTLIBRARIES
+
+%.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/cle266/mmio.h b/Source/DirectFB/gfxdrivers/cle266/mmio.h
new file mode 100755
index 0000000..757445a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/mmio.h
@@ -0,0 +1,43 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef _VIA_MMIO_H
+#define _VIA_MMIO_H
+
+#define TRACE_ENTER() printf("Entering %s\n", __PRETTY_FUNCTION__)
+#define TRACE_LEAVE() printf("Leaving %s\n", __PRETTY_FUNCTION__)
+
+#ifdef KERNEL
+
+#define VIA_OUT(hwregs, reg, val) *(volatile u32 *)((hwregs) + (reg)) = (val)
+#define VIA_IN(hwregs, reg)       *(volatile u32 *)((hwregs) + (reg))
+#define VGA_OUT8(hwregs, reg, val) *(volatile u8 *)((hwregs) + (reg) + 0x8000) = (val)
+#define VGA_IN8(hwregs, reg)       *(volatile u8 *)((hwregs) + (reg) + 0x8000)
+#define RS16(val)               ((u16)((s16)(val)))
+#define RS12(val)               (((u16)((s16)(val))) & 0xfff)
+
+
+#else // !KERNEL
+
+#define VIA_OUT(hwregs, reg, val)   *(volatile u32 *)((hwregs) + (reg)) = (val)
+#define VIA_IN(hwregs, reg)         *(volatile u32 *)((hwregs) + (reg))
+#define VGA_OUT8(hwregs, reg, val)  *(volatile u8 *)((hwregs) + (reg) + 0x8000) = (val)
+#define VGA_IN8(hwregs, reg)        *(volatile u8 *)((hwregs) + (reg) + 0x8000)
+
+#define RS16(val)               ((u16)((s16)(val)))
+#define RS12(val)               (((u16)((s16)(val))) & 0xfff)
+
+#endif // KERNEL
+
+#define VIDEO_OUT(hwregs, reg, val) VIA_OUT((hwregs)+0x200, reg, val)
+#define VIDEO_IN(hwregs, reg)       VIA_IN((hwregs)+0x200, reg)
+
+#define MAXLOOP                 0xffffff
+
+#endif /* _VIA_MMIO_H */
diff --git a/Source/DirectFB/gfxdrivers/cle266/regs2d.h b/Source/DirectFB/gfxdrivers/cle266/regs2d.h
new file mode 100755
index 0000000..33c7951
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/regs2d.h
@@ -0,0 +1,197 @@
+// Note: This is a modified version of via_regs.h from the XFree86 CVS tree.
+
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIA_REGS_2D_H__
+#define __VIA_REGS_2D_H__
+
+/* Selected 2D engine raster operations.
+ * See xc/programs/Xserver/hw/xfree86/xaa/xaarop.h
+ * in the XFree86 project for the full list.
+ */
+#define VIA_ROP_DPx             (0x5A << 24)
+#define VIA_ROP_DSx             (0x66 << 24)
+#define VIA_ROP_S               (0xCC << 24)
+#define VIA_ROP_P			    (0xF0 << 24)
+
+/* My own reverse-engineered bit definitions */
+
+// Use the following definitions with VIA_KEY_CONTROL
+
+/// When set, red channel is not drawn
+#define VIA_KEY_MASK_RED		0x40000000
+/// When set, green channel is not drawn
+#define VIA_KEY_MASK_GREEN		0x20000000
+/// When set, blue channel is not drawn
+#define VIA_KEY_MASK_BLUE		0x10000000
+
+/** When set, destination keying is enabled.
+ * Caveat: VIA's destination key is the opposite of DirectFB's:
+ * It draws where there is no match in the destination surface.
+ */
+#define VIA_KEY_ENABLE_DSTKEY	0x8000
+/** When set, source keying is enabled
+ * It draws the pixels in the source that do not match the color key.
+ */
+#define VIA_KEY_ENABLE_SRCKEY	0x4000
+/** Inverts the behaviour of the color keys:
+ * Dst key: draw where the destination matches the key
+ * Src key: draw where the source matches the key
+ * Problem: Since this bit affects both keys, you can not do
+ * combined source and destination keying with DirectFB.
+ * The inverted source key is all but useless since it will
+ * only draw the source pixels that match the key! 
+ * It must be a design error...
+ */
+#define VIA_KEY_INVERT_KEY		0x2000
+
+/* 2D engine registers and bit definitions */
+
+#define VIA_MMIO_REGSIZE        0x9000
+#define VIA_MMIO_REGBASE        0x0
+#define VIA_MMIO_VGABASE        0x8000
+#define VIA_MMIO_BLTBASE        0x200000
+#define VIA_MMIO_BLTSIZE        0x10000
+
+#define VIA_VQ_SIZE             (256*1024)
+
+/* defines for VIA 2D registers */
+#define VIA_REG_GECMD           0x000
+#define VIA_REG_GEMODE          0x004
+#define VIA_REG_GESTATUS        0x004       /* as same as VIA_REG_GEMODE */
+#define VIA_REG_SRCPOS          0x008
+#define VIA_REG_DSTPOS          0x00C
+#define VIA_REG_LINE_K1K2       0x008
+#define VIA_REG_LINE_XY         0x00C
+#define VIA_REG_DIMENSION       0x010       /* width and height */
+#define VIA_REG_PATADDR         0x014
+#define VIA_REG_FGCOLOR         0x018
+#define VIA_REG_DSTCOLORKEY     0x018       /* as same as VIA_REG_FG */
+#define VIA_REG_BGCOLOR         0x01C
+#define VIA_REG_SRCCOLORKEY     0x01C       /* as same as VIA_REG_BG */
+#define VIA_REG_CLIPTL          0x020       /* top and left of clipping */
+#define VIA_REG_CLIPBR          0x024       /* bottom and right of clipping */
+#define VIA_REG_OFFSET          0x028
+#define VIA_REG_LINE_ERROR      0x028
+#define VIA_REG_KEYCONTROL      0x02C       /* color key control */
+#define VIA_REG_SRCBASE         0x030
+#define VIA_REG_DSTBASE         0x034
+#define VIA_REG_PITCH           0x038       /* pitch of src and dst */
+#define VIA_REG_MONOPAT0        0x03C
+#define VIA_REG_MONOPAT1        0x040
+#define VIA_REG_COLORPAT        0x100       /* from 0x100 to 0x1ff */
+
+
+/* defines for VIA video registers */
+#define VIA_REG_INTERRUPT       0x200
+#define VIA_REG_CRTCSTART       0x214
+
+
+/* defines for VIA HW cursor registers */
+#define VIA_REG_CURSOR_MODE     0x2D0
+#define VIA_REG_CURSOR_POS      0x2D4
+#define VIA_REG_CURSOR_ORG      0x2D8
+#define VIA_REG_CURSOR_BG       0x2DC
+#define VIA_REG_CURSOR_FG       0x2E0
+
+
+/* defines for VIA 3D registers */
+#define VIA_REG_STATUS          0x400
+#define VIA_REG_TRANSET         0x43C
+#define VIA_REG_TRANSPACE       0x440
+
+/* VIA_REG_STATUS(0x400): Engine Status */
+#define VIA_CMD_RGTR_BUSY       0x00000080  /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY         0x00000001  /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY         0x00000002  /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY       0x00020000 /* Virtual Queue is busy */
+
+
+/* VIA_REG_GECMD(0x00): 2D Engine Command  */
+#define VIA_GEC_NOOP            0x00000000
+#define VIA_GEC_BLT             0x00000001
+#define VIA_GEC_LINE            0x00000005
+
+#define VIA_GEC_SRC_XY          0x00000000
+#define VIA_GEC_SRC_LINEAR      0x00000010
+#define VIA_GEC_DST_XY          0x00000000
+#define VIA_GEC_DST_LINRAT      0x00000020
+
+#define VIA_GEC_SRC_FB          0x00000000
+#define VIA_GEC_SRC_SYS         0x00000040
+#define VIA_GEC_DST_FB          0x00000000
+#define VIA_GEC_DST_SYS         0x00000080
+
+#define VIA_GEC_SRC_MONO        0x00000100  /* source is mono */
+#define VIA_GEC_PAT_MONO        0x00000200  /* pattern is mono */
+
+#define VIA_GEC_MSRC_OPAQUE     0x00000000  /* mono src is opaque */
+#define VIA_GEC_MSRC_TRANS      0x00000400  /* mono src is transparent */
+
+#define VIA_GEC_PAT_FB          0x00000000  /* pattern is in frame buffer */
+#define VIA_GEC_PAT_REG         0x00000800  /* pattern is from reg setting */
+
+#define VIA_GEC_CLIP_DISABLE    0x00000000
+#define VIA_GEC_CLIP_ENABLE     0x00001000
+
+#define VIA_GEC_FIXCOLOR_PAT    0x00002000
+
+#define VIA_GEC_INCX            0x00000000
+#define VIA_GEC_DECY            0x00004000
+#define VIA_GEC_INCY            0x00000000
+#define VIA_GEC_DECX            0x00008000
+
+#define VIA_GEC_MPAT_OPAQUE     0x00000000  /* mono pattern is opaque */
+#define VIA_GEC_MPAT_TRANS      0x00010000  /* mono pattern is transparent */
+
+#define VIA_GEC_MONO_UNPACK     0x00000000
+#define VIA_GEC_MONO_PACK       0x00020000
+#define VIA_GEC_MONO_DWORD      0x00000000
+#define VIA_GEC_MONO_WORD       0x00040000
+#define VIA_GEC_MONO_BYTE       0x00080000
+
+#define VIA_GEC_LASTPIXEL_ON    0x00000000
+#define VIA_GEC_LASTPIXEL_OFF   0x00100000
+#define VIA_GEC_X_MAJOR         0x00000000
+#define VIA_GEC_Y_MAJOR         0x00200000
+#define VIA_GEC_QUICK_START     0x00800000
+
+
+/* VIA_REG_GEMODE(0x04): GE mode */
+#define VIA_GEM_8bpp            0x00000000
+#define VIA_GEM_16bpp           0x00000100
+#define VIA_GEM_32bpp           0x00000300
+
+#define VIA_GEM_640             0x00000000   /* 640*480 */
+#define VIA_GEM_800             0x00000400   /* 800*600 */
+#define VIA_GEM_1024            0x00000800   /* 1024*768 */
+#define VIA_GEM_1280            0x00000C00   /* 1280*1024 */
+#define VIA_GEM_1600            0x00001000   /* 1600*1200 */
+#define VIA_GEM_2048            0x00001400   /* 2048*1536 */
+
+/* VIA_REG_PITCH(0x38): Pitch Setting */
+#define VIA_PITCH_ENABLE        0x80000000
+
+#endif // __VIA_REGS_2D_H__
diff --git a/Source/DirectFB/gfxdrivers/cle266/regs3d.h b/Source/DirectFB/gfxdrivers/cle266/regs3d.h
new file mode 100755
index 0000000..ebc6a0d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/regs3d.h
@@ -0,0 +1,1641 @@
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIA_REGS_3D_H__
+#define __VIA_REGS_3D_H__
+
+#define HC_REG_BASE             0x0400
+
+#define HC_ParaN_MASK           0xffffffff
+#define HC_Para_MASK            0x00ffffff
+#define HC_SubA_MASK            0xff000000
+#define HC_SubA_SHIFT           24
+/* Transmission Setting
+ */
+#define HC_REG_TRANS_SET        0x003c
+#define HC_ParaSubType_MASK     0xff000000
+#define HC_ParaType_MASK        0x00ff0000
+#define HC_ParaOS_MASK          0x0000ff00
+#define HC_ParaAdr_MASK         0x000000ff
+#define HC_ParaSubType_SHIFT    24
+#define HC_ParaType_SHIFT       16
+#define HC_ParaOS_SHIFT         8
+#define HC_ParaAdr_SHIFT        0
+
+#define HC_ParaType_CmdVdata    0x0000
+#define HC_ParaType_NotTex      0x0001
+#define HC_ParaType_Tex         0x0002
+#define HC_ParaType_Palette     0x0003
+#define HC_ParaType_PreCR       0x0010
+#define HC_ParaType_Auto        0x00fe
+
+/* Transmission Space
+ */
+#define HC_REG_Hpara0           0x0040
+#define HC_REG_HpataAF          0x02fc
+
+/* Read
+ */
+#define HC_REG_HREngSt          0x0000
+#define HC_REG_HRFIFOempty      0x0004
+#define HC_REG_HRFIFOfull       0x0008
+#define HC_REG_HRErr            0x000c
+#define HC_REG_FIFOstatus       0x0010
+/* HC_REG_HREngSt          0x0000
+ */
+#define HC_HDASZC_MASK          0x00010000
+#define HC_HSGEMI_MASK          0x0000f000
+#define HC_HLGEMISt_MASK        0x00000f00
+#define HC_HCRSt_MASK           0x00000080
+#define HC_HSE0St_MASK          0x00000040
+#define HC_HSE1St_MASK          0x00000020
+#define HC_HPESt_MASK           0x00000010
+#define HC_HXESt_MASK           0x00000008
+#define HC_HBESt_MASK           0x00000004
+#define HC_HE2St_MASK           0x00000002
+#define HC_HE3St_MASK           0x00000001
+/* HC_REG_HRFIFOempty      0x0004
+ */
+#define HC_HRZDempty_MASK       0x00000010
+#define HC_HRTXAempty_MASK      0x00000008
+#define HC_HRTXDempty_MASK      0x00000004
+#define HC_HWZDempty_MASK       0x00000002
+#define HC_HWCDempty_MASK       0x00000001
+/* HC_REG_HRFIFOfull       0x0008
+ */
+#define HC_HRZDfull_MASK        0x00000010
+#define HC_HRTXAfull_MASK       0x00000008
+#define HC_HRTXDfull_MASK       0x00000004
+#define HC_HWZDfull_MASK        0x00000002
+#define HC_HWCDfull_MASK        0x00000001
+/* HC_REG_HRErr            0x000c
+ */
+#define HC_HAGPCMErr_MASK       0x80000000
+#define HC_HAGPCMErrC_MASK      0x70000000
+/* HC_REG_FIFOstatus       0x0010
+ */
+#define HC_HRFIFOATall_MASK     0x80000000
+#define HC_HRFIFOATbusy_MASK    0x40000000
+#define HC_HRATFGMDo_MASK       0x00000100
+#define HC_HRATFGMDi_MASK       0x00000080
+#define HC_HRATFRZD_MASK        0x00000040
+#define HC_HRATFRTXA_MASK       0x00000020
+#define HC_HRATFRTXD_MASK       0x00000010
+#define HC_HRATFWZD_MASK        0x00000008
+#define HC_HRATFWCD_MASK        0x00000004
+#define HC_HRATTXTAG_MASK       0x00000002
+#define HC_HRATTXCH_MASK        0x00000001
+
+/* AGP Command Setting
+ */
+#define HC_SubA_HAGPBstL        0x0060
+#define HC_SubA_HAGPBendL       0x0061
+#define HC_SubA_HAGPCMNT        0x0062
+#define HC_SubA_HAGPBpL         0x0063
+#define HC_SubA_HAGPBpH         0x0064
+/* HC_SubA_HAGPCMNT        0x0062
+ */
+#define HC_HAGPCMNT_MASK        0x00800000
+#define HC_HCmdErrClr_MASK      0x00400000
+#define HC_HAGPBendH_MASK       0x0000ff00
+#define HC_HAGPBstH_MASK        0x000000ff
+#define HC_HAGPBendH_SHIFT      8
+#define HC_HAGPBstH_SHIFT       0
+/* HC_SubA_HAGPBpL         0x0063
+ */
+#define HC_HAGPBpL_MASK         0x00fffffc
+#define HC_HAGPBpID_MASK        0x00000003
+#define HC_HAGPBpID_PAUSE       0x00000000
+#define HC_HAGPBpID_JUMP        0x00000001
+#define HC_HAGPBpID_STOP        0x00000002
+/* HC_SubA_HAGPBpH         0x0064
+ */
+#define HC_HAGPBpH_MASK         0x00ffffff
+
+/* Miscellaneous Settings
+ */
+#define HC_SubA_HClipTB         0x0070
+#define HC_SubA_HClipLR         0x0071
+#define HC_SubA_HFPClipTL       0x0072
+#define HC_SubA_HFPClipBL       0x0073
+#define HC_SubA_HFPClipLL       0x0074
+#define HC_SubA_HFPClipRL       0x0075
+#define HC_SubA_HFPClipTBH      0x0076
+#define HC_SubA_HFPClipLRH      0x0077
+#define HC_SubA_HLP             0x0078
+#define HC_SubA_HLPRF           0x0079
+#define HC_SubA_HSolidCL        0x007a
+#define HC_SubA_HPixGC          0x007b
+#define HC_SubA_HSPXYOS         0x007c
+#define HC_SubA_HVertexCNT      0x007d
+
+#define HC_HClipT_MASK          0x00fff000
+#define HC_HClipT_SHIFT         12
+#define HC_HClipB_MASK          0x00000fff
+#define HC_HClipB_SHIFT         0
+#define HC_HClipL_MASK          0x00fff000
+#define HC_HClipL_SHIFT         12
+#define HC_HClipR_MASK          0x00000fff
+#define HC_HClipR_SHIFT         0
+#define HC_HFPClipBH_MASK       0x0000ff00
+#define HC_HFPClipBH_SHIFT      8
+#define HC_HFPClipTH_MASK       0x000000ff
+#define HC_HFPClipTH_SHIFT      0
+#define HC_HFPClipRH_MASK       0x0000ff00
+#define HC_HFPClipRH_SHIFT      8
+#define HC_HFPClipLH_MASK       0x000000ff
+#define HC_HFPClipLH_SHIFT      0
+#define HC_HSolidCH_MASK        0x000000ff
+#define HC_HPixGC_MASK          0x00800000
+#define HC_HSPXOS_MASK          0x00fff000
+#define HC_HSPXOS_SHIFT         12
+#define HC_HSPYOS_MASK          0x00000fff
+
+/* Command
+ * Command A
+ */
+#define HC_HCmdHeader_MASK      0xfe000000  /*0xffe00000*/
+#define HC_HE3Fire_MASK         0x00100000
+#define HC_HPMType_MASK         0x000f0000
+#define HC_HEFlag_MASK          0x0000e000
+#define HC_HShading_MASK        0x00001c00
+#define HC_HPMValidN_MASK       0x00000200
+#define HC_HPLEND_MASK          0x00000100
+#define HC_HVCycle_MASK         0x000000ff
+#define HC_HVCycle_Style_MASK   0x000000c0
+#define HC_HVCycle_ChgA_MASK    0x00000030
+#define HC_HVCycle_ChgB_MASK    0x0000000c
+#define HC_HVCycle_ChgC_MASK    0x00000003
+#define HC_HPMType_Point        0x00000000
+#define HC_HPMType_Line         0x00010000
+#define HC_HPMType_Tri          0x00020000
+#define HC_HPMType_TriWF        0x00040000
+#define HC_HEFlag_NoAA          0x00000000
+#define HC_HEFlag_ab            0x00008000
+#define HC_HEFlag_bc            0x00004000
+#define HC_HEFlag_ca            0x00002000
+#define HC_HShading_Solid       0x00000000
+#define HC_HShading_FlatA       0x00000400
+#define HC_HShading_FlatB       0x00000800
+#define HC_HShading_FlatC       0x00000c00
+#define HC_HShading_Gouraud     0x00001000
+#define HC_HVCycle_Full         0x00000000
+#define HC_HVCycle_AFP          0x00000040
+#define HC_HVCycle_One          0x000000c0
+#define HC_HVCycle_NewA         0x00000000
+#define HC_HVCycle_AA           0x00000010
+#define HC_HVCycle_AB           0x00000020
+#define HC_HVCycle_AC           0x00000030
+#define HC_HVCycle_NewB         0x00000000
+#define HC_HVCycle_BA           0x00000004
+#define HC_HVCycle_BB           0x00000008
+#define HC_HVCycle_BC           0x0000000c
+#define HC_HVCycle_NewC         0x00000000
+#define HC_HVCycle_CA           0x00000001
+#define HC_HVCycle_CB           0x00000002
+#define HC_HVCycle_CC           0x00000003
+
+/* Command B
+ */
+#define HC_HLPrst_MASK          0x00010000
+#define HC_HLLastP_MASK         0x00008000
+#define HC_HVPMSK_MASK          0x00007f80
+#define HC_HBFace_MASK          0x00000040
+#define HC_H2nd1VT_MASK         0x0000003f
+#define HC_HVPMSK_X             0x00004000
+#define HC_HVPMSK_Y             0x00002000
+#define HC_HVPMSK_Z             0x00001000
+#define HC_HVPMSK_W             0x00000800
+#define HC_HVPMSK_Cd            0x00000400
+#define HC_HVPMSK_Cs            0x00000200
+#define HC_HVPMSK_S             0x00000100
+#define HC_HVPMSK_T             0x00000080
+
+/* Enable Setting
+ */
+#define HC_SubA_HEnable         0x0000
+#define HC_HenTXEnvMap_MASK     0x00200000  /* environment mapping?? */
+#define HC_HenVertexCNT_MASK    0x00100000  /* vertex counter?? */
+#define HC_HenCPUDAZ_MASK       0x00080000  /* ???? */
+#define HC_HenDASZWC_MASK       0x00040000  /* ???? */
+#define HC_HenFBCull_MASK       0x00020000  /* culling? */
+#define HC_HenCW_MASK           0x00010000  /* color write? */
+#define HC_HenAA_MASK           0x00008000  /* anti aliasing??? */
+#define HC_HenST_MASK           0x00004000  /* stencil?? */
+#define HC_HenZT_MASK           0x00002000  /* z test?? */
+#define HC_HenZW_MASK           0x00001000  /* z write?? */
+#define HC_HenAT_MASK           0x00000800  /* alpha test?? */
+#define HC_HenAW_MASK           0x00000400  /* alpha write?? */
+#define HC_HenSP_MASK           0x00000200  /* specular?? */
+#define HC_HenLP_MASK           0x00000100  /* ???? */
+#define HC_HenTXCH_MASK         0x00000080  /* cache? half speed, right fonts */
+#define HC_HenTXMP_MASK         0x00000040  /* texture mapping */
+#define HC_HenTXPP_MASK         0x00000020  /* perspective correction?? */
+#define HC_HenTXTR_MASK         0x00000010  /* ???? */
+#define HC_HenCS_MASK           0x00000008  /* color space?? looks weird */
+#define HC_HenFOG_MASK          0x00000004  /* obviously fogging */
+#define HC_HenABL_MASK          0x00000002  /* alpha blending */
+#define HC_HenDT_MASK           0x00000001  /* dithering */
+
+/* Z Setting
+ */
+#define HC_SubA_HZWBBasL        0x0010
+#define HC_SubA_HZWBBasH        0x0011
+#define HC_SubA_HZWBType        0x0012
+#define HC_SubA_HZBiasL         0x0013
+#define HC_SubA_HZWBend         0x0014
+#define HC_SubA_HZWTMD          0x0015
+#define HC_SubA_HZWCDL          0x0016
+#define HC_SubA_HZWCTAGnum      0x0017
+#define HC_SubA_HZCYNum         0x0018
+#define HC_SubA_HZWCFire        0x0019
+/* HC_SubA_HZWBType
+ */
+#define HC_HZWBType_MASK        0x00800000
+#define HC_HZBiasedWB_MASK      0x00400000
+#define HC_HZONEasFF_MASK       0x00200000
+#define HC_HZOONEasFF_MASK      0x00100000
+#define HC_HZWBFM_MASK          0x00030000
+#define HC_HZWBLoc_MASK         0x0000c000
+#define HC_HZWBPit_MASK         0x00003fff
+#define HC_HZWBFM_16            0x00000000
+#define HC_HZWBFM_32            0x00020000
+#define HC_HZWBFM_24            0x00030000
+#define HC_HZWBLoc_Local        0x00000000
+#define HC_HZWBLoc_SyS          0x00004000
+/* HC_SubA_HZWBend
+ */
+#define HC_HZWBend_MASK         0x00ffe000
+#define HC_HZBiasH_MASK         0x000000ff
+#define HC_HZWBend_SHIFT        10
+/* HC_SubA_HZWTMD
+ */
+#define HC_HZWTMD_MASK          0x00070000
+#define HC_HEBEBias_MASK        0x00007f00
+#define HC_HZNF_MASK            0x000000ff
+#define HC_HZWTMD_NeverPass     0x00000000
+#define HC_HZWTMD_LT            0x00010000
+#define HC_HZWTMD_EQ            0x00020000
+#define HC_HZWTMD_LE            0x00030000
+#define HC_HZWTMD_GT            0x00040000
+#define HC_HZWTMD_NE            0x00050000
+#define HC_HZWTMD_GE            0x00060000
+#define HC_HZWTMD_AllPass       0x00070000
+#define HC_HEBEBias_SHIFT       8
+/* HC_SubA_HZWCDL          0x0016
+ */
+#define HC_HZWCDL_MASK          0x00ffffff
+/* HC_SubA_HZWCTAGnum      0x0017
+ */
+#define HC_HZWCTAGnum_MASK      0x00ff0000
+#define HC_HZWCTAGnum_SHIFT     16
+#define HC_HZWCDH_MASK          0x000000ff
+#define HC_HZWCDH_SHIFT         0
+/* HC_SubA_HZCYNum         0x0018
+ */
+#define HC_HZCYNum_MASK         0x00030000
+#define HC_HZCYNum_SHIFT        16
+#define HC_HZWCQWnum_MASK       0x00003fff
+#define HC_HZWCQWnum_SHIFT      0
+/* HC_SubA_HZWCFire        0x0019
+ */
+#define HC_ZWCFire_MASK         0x00010000
+#define HC_HZWCQWnumLast_MASK   0x00003fff
+#define HC_HZWCQWnumLast_SHIFT  0
+
+/* Stencil Setting
+ */
+#define HC_SubA_HSTREF          0x0023
+#define HC_SubA_HSTMD           0x0024
+/* HC_SubA_HSBFM
+ */
+#define HC_HSBFM_MASK           0x00030000
+#define HC_HSBLoc_MASK          0x0000c000
+#define HC_HSBPit_MASK          0x00003fff
+/* HC_SubA_HSTREF
+ */
+#define HC_HSTREF_MASK          0x00ff0000
+#define HC_HSTOPMSK_MASK        0x0000ff00
+#define HC_HSTBMSK_MASK         0x000000ff
+#define HC_HSTREF_SHIFT         16
+#define HC_HSTOPMSK_SHIFT       8
+/* HC_SubA_HSTMD
+ */
+#define HC_HSTMD_MASK           0x00070000
+#define HC_HSTOPSF_MASK         0x000001c0
+#define HC_HSTOPSPZF_MASK       0x00000038
+#define HC_HSTOPSPZP_MASK       0x00000007
+#define HC_HSTMD_NeverPass      0x00000000
+#define HC_HSTMD_LT             0x00010000
+#define HC_HSTMD_EQ             0x00020000
+#define HC_HSTMD_LE             0x00030000
+#define HC_HSTMD_GT             0x00040000
+#define HC_HSTMD_NE             0x00050000
+#define HC_HSTMD_GE             0x00060000
+#define HC_HSTMD_AllPass        0x00070000
+#define HC_HSTOPSF_KEEP         0x00000000
+#define HC_HSTOPSF_ZERO         0x00000040
+#define HC_HSTOPSF_REPLACE      0x00000080
+#define HC_HSTOPSF_INCRSAT      0x000000c0
+#define HC_HSTOPSF_DECRSAT      0x00000100
+#define HC_HSTOPSF_INVERT       0x00000140
+#define HC_HSTOPSF_INCR         0x00000180
+#define HC_HSTOPSF_DECR         0x000001c0
+#define HC_HSTOPSPZF_KEEP       0x00000000
+#define HC_HSTOPSPZF_ZERO       0x00000008
+#define HC_HSTOPSPZF_REPLACE    0x00000010
+#define HC_HSTOPSPZF_INCRSAT    0x00000018
+#define HC_HSTOPSPZF_DECRSAT    0x00000020
+#define HC_HSTOPSPZF_INVERT     0x00000028
+#define HC_HSTOPSPZF_INCR       0x00000030
+#define HC_HSTOPSPZF_DECR       0x00000038
+#define HC_HSTOPSPZP_KEEP       0x00000000
+#define HC_HSTOPSPZP_ZERO       0x00000001
+#define HC_HSTOPSPZP_REPLACE    0x00000002
+#define HC_HSTOPSPZP_INCRSAT    0x00000003
+#define HC_HSTOPSPZP_DECRSAT    0x00000004
+#define HC_HSTOPSPZP_INVERT     0x00000005
+#define HC_HSTOPSPZP_INCR       0x00000006
+#define HC_HSTOPSPZP_DECR       0x00000007
+
+/* Alpha Setting
+ */
+#define HC_SubA_HABBasL         0x0030
+#define HC_SubA_HABBasH         0x0031
+#define HC_SubA_HABFM           0x0032
+#define HC_SubA_HATMD           0x0033
+#define HC_SubA_HABLCsat        0x0034
+#define HC_SubA_HABLCop         0x0035
+#define HC_SubA_HABLAsat        0x0036
+#define HC_SubA_HABLAop         0x0037
+#define HC_SubA_HABLRCa         0x0038
+#define HC_SubA_HABLRFCa        0x0039
+#define HC_SubA_HABLRCbias      0x003a
+#define HC_SubA_HABLRCb         0x003b
+#define HC_SubA_HABLRFCb        0x003c
+#define HC_SubA_HABLRAa         0x003d
+#define HC_SubA_HABLRAb         0x003e
+/* HC_SubA_HABFM
+ */
+#define HC_HABFM_MASK           0x00030000
+#define HC_HABLoc_MASK          0x0000c000
+#define HC_HABPit_MASK          0x000007ff
+/* HC_SubA_HATMD
+ */
+#define HC_HATMD_MASK           0x00000700
+#define HC_HATREF_MASK          0x000000ff
+#define HC_HATMD_NeverPass      0x00000000
+#define HC_HATMD_LT             0x00000100
+#define HC_HATMD_EQ             0x00000200
+#define HC_HATMD_LE             0x00000300
+#define HC_HATMD_GT             0x00000400
+#define HC_HATMD_NE             0x00000500
+#define HC_HATMD_GE             0x00000600
+#define HC_HATMD_AllPass        0x00000700
+/* HC_SubA_HABLCsat
+ */
+#define HC_HABLCsat_MASK        0x00010000
+#define HC_HABLCa_MASK          0x0000fc00
+#define HC_HABLCa_C_MASK        0x0000c000
+#define HC_HABLCa_OPC_MASK      0x00003c00
+#define HC_HABLFCa_MASK         0x000003f0
+#define HC_HABLFCa_C_MASK       0x00000300
+#define HC_HABLFCa_OPC_MASK     0x000000f0
+#define HC_HABLCbias_MASK       0x0000000f
+#define HC_HABLCbias_C_MASK     0x00000008
+#define HC_HABLCbias_OPC_MASK   0x00000007
+/*-- Define the input color.
+ */
+#define HC_XC_Csrc              0x00000000
+#define HC_XC_Cdst              0x00000001
+#define HC_XC_Asrc              0x00000002
+#define HC_XC_Adst              0x00000003
+#define HC_XC_Fog               0x00000004
+#define HC_XC_HABLRC            0x00000005
+#define HC_XC_minSrcDst         0x00000006
+#define HC_XC_maxSrcDst         0x00000007
+#define HC_XC_mimAsrcInvAdst    0x00000008
+#define HC_XC_OPC               0x00000000
+#define HC_XC_InvOPC            0x00000010
+#define HC_XC_OPCp5             0x00000020
+/*-- Define the input Alpha
+ */
+#define HC_XA_OPA               0x00000000
+#define HC_XA_InvOPA            0x00000010
+#define HC_XA_OPAp5             0x00000020
+#define HC_XA_0                 0x00000000
+#define HC_XA_Asrc              0x00000001
+#define HC_XA_Adst              0x00000002
+#define HC_XA_Fog               0x00000003
+#define HC_XA_minAsrcFog        0x00000004
+#define HC_XA_minAsrcAdst       0x00000005
+#define HC_XA_maxAsrcFog        0x00000006
+#define HC_XA_maxAsrcAdst       0x00000007
+#define HC_XA_HABLRA            0x00000008
+#define HC_XA_minAsrcInvAdst    0x00000008
+#define HC_XA_HABLFRA           0x00000009
+/*--
+ */
+#define HC_HABLCa_OPC           (HC_XC_OPC << 10)
+#define HC_HABLCa_InvOPC        (HC_XC_InvOPC << 10)
+#define HC_HABLCa_OPCp5         (HC_XC_OPCp5 << 10)
+#define HC_HABLCa_Csrc          (HC_XC_Csrc << 10)
+#define HC_HABLCa_Cdst          (HC_XC_Cdst << 10)
+#define HC_HABLCa_Asrc          (HC_XC_Asrc << 10)
+#define HC_HABLCa_Adst          (HC_XC_Adst << 10)
+#define HC_HABLCa_Fog           (HC_XC_Fog << 10)
+#define HC_HABLCa_HABLRCa       (HC_XC_HABLRC << 10)
+#define HC_HABLCa_minSrcDst     (HC_XC_minSrcDst << 10)
+#define HC_HABLCa_maxSrcDst     (HC_XC_maxSrcDst << 10)
+#define HC_HABLFCa_OPC              (HC_XC_OPC << 4)
+#define HC_HABLFCa_InvOPC           (HC_XC_InvOPC << 4)
+#define HC_HABLFCa_OPCp5            (HC_XC_OPCp5 << 4)
+#define HC_HABLFCa_Csrc             (HC_XC_Csrc << 4)
+#define HC_HABLFCa_Cdst             (HC_XC_Cdst << 4)
+#define HC_HABLFCa_Asrc             (HC_XC_Asrc << 4)
+#define HC_HABLFCa_Adst             (HC_XC_Adst << 4)
+#define HC_HABLFCa_Fog              (HC_XC_Fog << 4)
+#define HC_HABLFCa_HABLRCa          (HC_XC_HABLRC << 4)
+#define HC_HABLFCa_minSrcDst        (HC_XC_minSrcDst << 4)
+#define HC_HABLFCa_maxSrcDst        (HC_XC_maxSrcDst << 4)
+#define HC_HABLFCa_mimAsrcInvAdst   (HC_XC_mimAsrcInvAdst << 4)
+#define HC_HABLCbias_HABLRCbias 0x00000000
+#define HC_HABLCbias_Asrc       0x00000001
+#define HC_HABLCbias_Adst       0x00000002
+#define HC_HABLCbias_Fog        0x00000003
+#define HC_HABLCbias_Cin        0x00000004
+/* HC_SubA_HABLCop         0x0035
+ */
+#define HC_HABLdot_MASK         0x00010000
+#define HC_HABLCop_MASK         0x00004000
+#define HC_HABLCb_MASK          0x00003f00
+#define HC_HABLCb_C_MASK        0x00003000
+#define HC_HABLCb_OPC_MASK      0x00000f00
+#define HC_HABLFCb_MASK         0x000000fc
+#define HC_HABLFCb_C_MASK       0x000000c0
+#define HC_HABLFCb_OPC_MASK     0x0000003c
+#define HC_HABLCshift_MASK      0x00000003
+#define HC_HABLCb_OPC           (HC_XC_OPC << 8)
+#define HC_HABLCb_InvOPC        (HC_XC_InvOPC << 8)
+#define HC_HABLCb_OPCp5         (HC_XC_OPCp5 << 8)
+#define HC_HABLCb_Csrc          (HC_XC_Csrc << 8)
+#define HC_HABLCb_Cdst          (HC_XC_Cdst << 8)
+#define HC_HABLCb_Asrc          (HC_XC_Asrc << 8)
+#define HC_HABLCb_Adst          (HC_XC_Adst << 8)
+#define HC_HABLCb_Fog           (HC_XC_Fog << 8)
+#define HC_HABLCb_HABLRCa       (HC_XC_HABLRC << 8)
+#define HC_HABLCb_minSrcDst     (HC_XC_minSrcDst << 8)
+#define HC_HABLCb_maxSrcDst     (HC_XC_maxSrcDst << 8)
+#define HC_HABLFCb_OPC              (HC_XC_OPC << 2)
+#define HC_HABLFCb_InvOPC           (HC_XC_InvOPC << 2)
+#define HC_HABLFCb_OPCp5            (HC_XC_OPCp5 << 2)
+#define HC_HABLFCb_Csrc             (HC_XC_Csrc << 2)
+#define HC_HABLFCb_Cdst             (HC_XC_Cdst << 2)
+#define HC_HABLFCb_Asrc             (HC_XC_Asrc << 2)
+#define HC_HABLFCb_Adst             (HC_XC_Adst << 2)
+#define HC_HABLFCb_Fog              (HC_XC_Fog << 2)
+#define HC_HABLFCb_HABLRCb          (HC_XC_HABLRC << 2)
+#define HC_HABLFCb_minSrcDst        (HC_XC_minSrcDst << 2)
+#define HC_HABLFCb_maxSrcDst        (HC_XC_maxSrcDst << 2)
+#define HC_HABLFCb_mimAsrcInvAdst   (HC_XC_mimAsrcInvAdst << 2)
+/* HC_SubA_HABLAsat        0x0036
+ */
+#define HC_HABLAsat_MASK        0x00010000
+#define HC_HABLAa_MASK          0x0000fc00
+#define HC_HABLAa_A_MASK        0x0000c000
+#define HC_HABLAa_OPA_MASK      0x00003c00
+#define HC_HABLFAa_MASK         0x000003f0
+#define HC_HABLFAa_A_MASK       0x00000300
+#define HC_HABLFAa_OPA_MASK     0x000000f0
+#define HC_HABLAbias_MASK       0x0000000f
+#define HC_HABLAbias_A_MASK     0x00000008
+#define HC_HABLAbias_OPA_MASK   0x00000007
+#define HC_HABLAa_OPA           (HC_XA_OPA << 10)
+#define HC_HABLAa_InvOPA        (HC_XA_InvOPA << 10)
+#define HC_HABLAa_OPAp5         (HC_XA_OPAp5 << 10)
+#define HC_HABLAa_0             (HC_XA_0 << 10)
+#define HC_HABLAa_Asrc          (HC_XA_Asrc << 10)
+#define HC_HABLAa_Adst          (HC_XA_Adst << 10)
+#define HC_HABLAa_Fog           (HC_XA_Fog << 10)
+#define HC_HABLAa_minAsrcFog    (HC_XA_minAsrcFog << 10)
+#define HC_HABLAa_minAsrcAdst   (HC_XA_minAsrcAdst << 10)
+#define HC_HABLAa_maxAsrcFog    (HC_XA_maxAsrcFog << 10)
+#define HC_HABLAa_maxAsrcAdst   (HC_XA_maxAsrcAdst << 10)
+#define HC_HABLAa_HABLRA        (HC_XA_HABLRA << 10)
+#define HC_HABLFAa_OPA          (HC_XA_OPA << 4)
+#define HC_HABLFAa_InvOPA       (HC_XA_InvOPA << 4)
+#define HC_HABLFAa_OPAp5        (HC_XA_OPAp5 << 4)
+#define HC_HABLFAa_0            (HC_XA_0 << 4)
+#define HC_HABLFAa_Asrc         (HC_XA_Asrc << 4)
+#define HC_HABLFAa_Adst         (HC_XA_Adst << 4)
+#define HC_HABLFAa_Fog          (HC_XA_Fog << 4)
+#define HC_HABLFAa_minAsrcFog   (HC_XA_minAsrcFog << 4)
+#define HC_HABLFAa_minAsrcAdst  (HC_XA_minAsrcAdst << 4)
+#define HC_HABLFAa_maxAsrcFog   (HC_XA_maxAsrcFog << 4)
+#define HC_HABLFAa_maxAsrcAdst  (HC_XA_maxAsrcAdst << 4)
+#define HC_HABLFAa_minAsrcInvAdst   (HC_XA_minAsrcInvAdst << 4)
+#define HC_HABLFAa_HABLFRA          (HC_XA_HABLFRA << 4)
+#define HC_HABLAbias_HABLRAbias 0x00000000
+#define HC_HABLAbias_Asrc       0x00000001
+#define HC_HABLAbias_Adst       0x00000002
+#define HC_HABLAbias_Fog        0x00000003
+#define HC_HABLAbias_Aaa        0x00000004
+/* HC_SubA_HABLAop         0x0037
+ */
+#define HC_HABLAop_MASK         0x00004000
+#define HC_HABLAb_MASK          0x00003f00
+#define HC_HABLAb_OPA_MASK      0x00000f00
+#define HC_HABLFAb_MASK         0x000000fc
+#define HC_HABLFAb_OPA_MASK     0x0000003c
+#define HC_HABLAshift_MASK      0x00000003
+#define HC_HABLAb_OPA           (HC_XA_OPA << 8)
+#define HC_HABLAb_InvOPA        (HC_XA_InvOPA << 8)
+#define HC_HABLAb_OPAp5         (HC_XA_OPAp5 << 8)
+#define HC_HABLAb_0             (HC_XA_0 << 8)
+#define HC_HABLAb_Asrc          (HC_XA_Asrc << 8)
+#define HC_HABLAb_Adst          (HC_XA_Adst << 8)
+#define HC_HABLAb_Fog           (HC_XA_Fog << 8)
+#define HC_HABLAb_minAsrcFog    (HC_XA_minAsrcFog << 8)
+#define HC_HABLAb_minAsrcAdst   (HC_XA_minAsrcAdst << 8)
+#define HC_HABLAb_maxAsrcFog    (HC_XA_maxAsrcFog << 8)
+#define HC_HABLAb_maxAsrcAdst   (HC_XA_maxAsrcAdst << 8)
+#define HC_HABLAb_HABLRA        (HC_XA_HABLRA << 8)
+#define HC_HABLFAb_OPA          (HC_XA_OPA << 2)
+#define HC_HABLFAb_InvOPA       (HC_XA_InvOPA << 2)
+#define HC_HABLFAb_OPAp5        (HC_XA_OPAp5 << 2)
+#define HC_HABLFAb_0            (HC_XA_0 << 2)
+#define HC_HABLFAb_Asrc         (HC_XA_Asrc << 2)
+#define HC_HABLFAb_Adst         (HC_XA_Adst << 2)
+#define HC_HABLFAb_Fog          (HC_XA_Fog << 2)
+#define HC_HABLFAb_minAsrcFog   (HC_XA_minAsrcFog << 2)
+#define HC_HABLFAb_minAsrcAdst  (HC_XA_minAsrcAdst << 2)
+#define HC_HABLFAb_maxAsrcFog   (HC_XA_maxAsrcFog << 2)
+#define HC_HABLFAb_maxAsrcAdst  (HC_XA_maxAsrcAdst << 2)
+#define HC_HABLFAb_minAsrcInvAdst   (HC_XA_minAsrcInvAdst << 2)
+#define HC_HABLFAb_HABLFRA          (HC_XA_HABLFRA << 2)
+/* HC_SubA_HABLRAa         0x003d
+ */
+#define HC_HABLRAa_MASK         0x00ff0000
+#define HC_HABLRFAa_MASK        0x0000ff00
+#define HC_HABLRAbias_MASK      0x000000ff
+#define HC_HABLRAa_SHIFT        16
+#define HC_HABLRFAa_SHIFT       8
+/* HC_SubA_HABLRAb         0x003e
+ */
+#define HC_HABLRAb_MASK         0x0000ff00
+#define HC_HABLRFAb_MASK        0x000000ff
+#define HC_HABLRAb_SHIFT        8
+
+/* Destination Setting
+ */
+#define HC_SubA_HDBBasL         0x0040
+#define HC_SubA_HDBBasH         0x0041
+#define HC_SubA_HDBFM           0x0042
+#define HC_SubA_HFBBMSKL        0x0043
+#define HC_SubA_HROP            0x0044
+/* HC_SubA_HDBFM           0x0042
+ */
+#define HC_HDBFM_MASK           0x001f0000
+#define HC_HDBLoc_MASK          0x0000c000
+#define HC_HDBPit_MASK          0x00003fff
+#define HC_HDBFM_RGB555         0x00000000
+#define HC_HDBFM_RGB565         0x00010000
+#define HC_HDBFM_ARGB4444       0x00020000
+#define HC_HDBFM_ARGB1555       0x00030000
+#define HC_HDBFM_BGR555         0x00040000
+#define HC_HDBFM_BGR565         0x00050000
+#define HC_HDBFM_ABGR4444       0x00060000
+#define HC_HDBFM_ABGR1555       0x00070000
+#define HC_HDBFM_ARGB0888       0x00080000
+#define HC_HDBFM_ARGB8888       0x00090000
+#define HC_HDBFM_ABGR0888       0x000a0000
+#define HC_HDBFM_ABGR8888       0x000b0000
+#define HC_HDBLoc_Local         0x00000000
+#define HC_HDBLoc_Sys           0x00004000
+/* HC_SubA_HROP            0x0044
+ */
+#define HC_HROP_MASK            0x00000f00
+#define HC_HFBBMSKH_MASK        0x000000ff
+#define HC_HROP_BLACK           0x00000000
+#define HC_HROP_DPon            0x00000100
+#define HC_HROP_DPna            0x00000200
+#define HC_HROP_Pn              0x00000300
+#define HC_HROP_PDna            0x00000400
+#define HC_HROP_Dn              0x00000500
+#define HC_HROP_DPx             0x00000600
+#define HC_HROP_DPan            0x00000700
+#define HC_HROP_DPa             0x00000800
+#define HC_HROP_DPxn            0x00000900
+#define HC_HROP_D               0x00000a00
+#define HC_HROP_DPno            0x00000b00
+#define HC_HROP_P               0x00000c00
+#define HC_HROP_PDno            0x00000d00
+#define HC_HROP_DPo             0x00000e00
+#define HC_HROP_WHITE           0x00000f00
+
+/* Fog Setting
+ */
+#define HC_SubA_HFogLF          0x0050
+#define HC_SubA_HFogCL          0x0051
+#define HC_SubA_HFogCH          0x0052
+#define HC_SubA_HFogStL         0x0053
+#define HC_SubA_HFogStH         0x0054
+#define HC_SubA_HFogOOdMF       0x0055
+#define HC_SubA_HFogOOdEF       0x0056
+#define HC_SubA_HFogEndL        0x0057
+#define HC_SubA_HFogDenst       0x0058
+/* HC_SubA_FogLF           0x0050
+ */
+#define HC_FogLF_MASK           0x00000010
+#define HC_FogEq_MASK           0x00000008
+#define HC_FogMD_MASK           0x00000007
+#define HC_FogMD_LocalFog        0x00000000
+#define HC_FogMD_LinearFog       0x00000002
+#define HC_FogMD_ExponentialFog  0x00000004
+#define HC_FogMD_Exponential2Fog 0x00000005
+/* #define HC_FogMD_FogTable       0x00000003 */
+
+/* HC_SubA_HFogDenst        0x0058
+ */
+#define HC_FogDenst_MASK        0x001fff00
+#define HC_FogEndL_MASK         0x000000ff
+
+/* Texture subtype definitions
+ */
+#define HC_SubType_Tex0         0x00000000
+#define HC_SubType_Tex1         0x00000001
+#define HC_SubType_TexGeneral   0x000000fe
+
+/* Attribute of texture n
+ */
+#define HC_SubA_HTXnL0BasL      0x0000
+#define HC_SubA_HTXnL1BasL      0x0001
+#define HC_SubA_HTXnL2BasL      0x0002
+#define HC_SubA_HTXnL3BasL      0x0003
+#define HC_SubA_HTXnL4BasL      0x0004
+#define HC_SubA_HTXnL5BasL      0x0005
+#define HC_SubA_HTXnL6BasL      0x0006
+#define HC_SubA_HTXnL7BasL      0x0007
+#define HC_SubA_HTXnL8BasL      0x0008
+#define HC_SubA_HTXnL9BasL      0x0009
+#define HC_SubA_HTXnLaBasL      0x000a
+#define HC_SubA_HTXnLbBasL      0x000b
+#define HC_SubA_HTXnLcBasL      0x000c
+#define HC_SubA_HTXnLdBasL      0x000d
+#define HC_SubA_HTXnLeBasL      0x000e
+#define HC_SubA_HTXnLfBasL      0x000f
+#define HC_SubA_HTXnL10BasL     0x0010
+#define HC_SubA_HTXnL11BasL     0x0011
+#define HC_SubA_HTXnL012BasH    0x0020
+#define HC_SubA_HTXnL345BasH    0x0021
+#define HC_SubA_HTXnL678BasH    0x0022
+#define HC_SubA_HTXnL9abBasH    0x0023
+#define HC_SubA_HTXnLcdeBasH    0x0024
+#define HC_SubA_HTXnLf1011BasH  0x0025
+#define HC_SubA_HTXnL0Pit       0x002b
+#define HC_SubA_HTXnL1Pit       0x002c
+#define HC_SubA_HTXnL2Pit       0x002d
+#define HC_SubA_HTXnL3Pit       0x002e
+#define HC_SubA_HTXnL4Pit       0x002f
+#define HC_SubA_HTXnL5Pit       0x0030
+#define HC_SubA_HTXnL6Pit       0x0031
+#define HC_SubA_HTXnL7Pit       0x0032
+#define HC_SubA_HTXnL8Pit       0x0033
+#define HC_SubA_HTXnL9Pit       0x0034
+#define HC_SubA_HTXnLaPit       0x0035
+#define HC_SubA_HTXnLbPit       0x0036
+#define HC_SubA_HTXnLcPit       0x0037
+#define HC_SubA_HTXnLdPit       0x0038
+#define HC_SubA_HTXnLePit       0x0039
+#define HC_SubA_HTXnLfPit       0x003a
+#define HC_SubA_HTXnL10Pit      0x003b
+#define HC_SubA_HTXnL11Pit      0x003c
+#define HC_SubA_HTXnL0_5WE      0x004b
+#define HC_SubA_HTXnL6_bWE      0x004c
+#define HC_SubA_HTXnLc_11WE     0x004d
+#define HC_SubA_HTXnL0_5HE      0x0051
+#define HC_SubA_HTXnL6_bHE      0x0052
+#define HC_SubA_HTXnLc_11HE     0x0053
+#define HC_SubA_HTXnL0OS        0x0077
+#define HC_SubA_HTXnTB          0x0078
+#define HC_SubA_HTXnMPMD        0x0079
+#define HC_SubA_HTXnCLODu       0x007a
+#define HC_SubA_HTXnFM          0x007b
+#define HC_SubA_HTXnTRCH        0x007c
+#define HC_SubA_HTXnTRCL        0x007d
+#define HC_SubA_HTXnTBC         0x007e
+#define HC_SubA_HTXnTRAH        0x007f
+#define HC_SubA_HTXnTBLCsat     0x0080
+#define HC_SubA_HTXnTBLCop      0x0081
+#define HC_SubA_HTXnTBLMPfog    0x0082
+#define HC_SubA_HTXnTBLAsat     0x0083
+#define HC_SubA_HTXnTBLRCa      0x0085
+#define HC_SubA_HTXnTBLRCb      0x0086
+#define HC_SubA_HTXnTBLRCc      0x0087
+#define HC_SubA_HTXnTBLRCbias   0x0088
+#define HC_SubA_HTXnTBLRAa      0x0089
+#define HC_SubA_HTXnTBLRFog     0x008a
+#define HC_SubA_HTXnBumpM00     0x0090
+#define HC_SubA_HTXnBumpM01     0x0091
+#define HC_SubA_HTXnBumpM10     0x0092
+#define HC_SubA_HTXnBumpM11     0x0093
+#define HC_SubA_HTXnLScale      0x0094
+#define HC_SubA_HTXSMD          0x0000
+/* HC_SubA_HTXnL012BasH    0x0020
+ */
+#define HC_HTXnL0BasH_MASK      0x000000ff
+#define HC_HTXnL1BasH_MASK      0x0000ff00
+#define HC_HTXnL2BasH_MASK      0x00ff0000
+#define HC_HTXnL1BasH_SHIFT     8
+#define HC_HTXnL2BasH_SHIFT     16
+/* HC_SubA_HTXnL345BasH    0x0021
+ */
+#define HC_HTXnL3BasH_MASK      0x000000ff
+#define HC_HTXnL4BasH_MASK      0x0000ff00
+#define HC_HTXnL5BasH_MASK      0x00ff0000
+#define HC_HTXnL4BasH_SHIFT     8
+#define HC_HTXnL5BasH_SHIFT     16
+/* HC_SubA_HTXnL678BasH    0x0022
+ */
+#define HC_HTXnL6BasH_MASK      0x000000ff
+#define HC_HTXnL7BasH_MASK      0x0000ff00
+#define HC_HTXnL8BasH_MASK      0x00ff0000
+#define HC_HTXnL7BasH_SHIFT     8
+#define HC_HTXnL8BasH_SHIFT     16
+/* HC_SubA_HTXnL9abBasH    0x0023
+ */
+#define HC_HTXnL9BasH_MASK      0x000000ff
+#define HC_HTXnLaBasH_MASK      0x0000ff00
+#define HC_HTXnLbBasH_MASK      0x00ff0000
+#define HC_HTXnLaBasH_SHIFT     8
+#define HC_HTXnLbBasH_SHIFT     16
+/* HC_SubA_HTXnLcdeBasH    0x0024
+ */
+#define HC_HTXnLcBasH_MASK      0x000000ff
+#define HC_HTXnLdBasH_MASK      0x0000ff00
+#define HC_HTXnLeBasH_MASK      0x00ff0000
+#define HC_HTXnLdBasH_SHIFT     8
+#define HC_HTXnLeBasH_SHIFT     16
+/* HC_SubA_HTXnLcdeBasH    0x0025
+ */
+#define HC_HTXnLfBasH_MASK      0x000000ff
+#define HC_HTXnL10BasH_MASK      0x0000ff00
+#define HC_HTXnL11BasH_MASK      0x00ff0000
+#define HC_HTXnL10BasH_SHIFT     8
+#define HC_HTXnL11BasH_SHIFT     16
+/* HC_SubA_HTXnL0Pit       0x002b
+ */
+#define HC_HTXnLnPit_MASK       0x00003fff
+#define HC_HTXnEnPit_MASK       0x00080000
+#define HC_HTXnLnPitE_MASK      0x00f00000
+#define HC_HTXnLnPitE_SHIFT     20
+/* HC_SubA_HTXnL0_5WE      0x004b
+ */
+#define HC_HTXnL0WE_MASK        0x0000000f
+#define HC_HTXnL1WE_MASK        0x000000f0
+#define HC_HTXnL2WE_MASK        0x00000f00
+#define HC_HTXnL3WE_MASK        0x0000f000
+#define HC_HTXnL4WE_MASK        0x000f0000
+#define HC_HTXnL5WE_MASK        0x00f00000
+#define HC_HTXnL1WE_SHIFT       4
+#define HC_HTXnL2WE_SHIFT       8
+#define HC_HTXnL3WE_SHIFT       12
+#define HC_HTXnL4WE_SHIFT       16
+#define HC_HTXnL5WE_SHIFT       20
+/* HC_SubA_HTXnL6_bWE      0x004c
+ */
+#define HC_HTXnL6WE_MASK        0x0000000f
+#define HC_HTXnL7WE_MASK        0x000000f0
+#define HC_HTXnL8WE_MASK        0x00000f00
+#define HC_HTXnL9WE_MASK        0x0000f000
+#define HC_HTXnLaWE_MASK        0x000f0000
+#define HC_HTXnLbWE_MASK        0x00f00000
+#define HC_HTXnL7WE_SHIFT       4
+#define HC_HTXnL8WE_SHIFT       8
+#define HC_HTXnL9WE_SHIFT       12
+#define HC_HTXnLaWE_SHIFT       16
+#define HC_HTXnLbWE_SHIFT       20
+/* HC_SubA_HTXnLc_11WE      0x004d
+ */
+#define HC_HTXnLcWE_MASK        0x0000000f
+#define HC_HTXnLdWE_MASK        0x000000f0
+#define HC_HTXnLeWE_MASK        0x00000f00
+#define HC_HTXnLfWE_MASK        0x0000f000
+#define HC_HTXnL10WE_MASK       0x000f0000
+#define HC_HTXnL11WE_MASK       0x00f00000
+#define HC_HTXnLdWE_SHIFT       4
+#define HC_HTXnLeWE_SHIFT       8
+#define HC_HTXnLfWE_SHIFT       12
+#define HC_HTXnL10WE_SHIFT      16
+#define HC_HTXnL11WE_SHIFT      20
+/* HC_SubA_HTXnL0_5HE      0x0051
+ */
+#define HC_HTXnL0HE_MASK        0x0000000f
+#define HC_HTXnL1HE_MASK        0x000000f0
+#define HC_HTXnL2HE_MASK        0x00000f00
+#define HC_HTXnL3HE_MASK        0x0000f000
+#define HC_HTXnL4HE_MASK        0x000f0000
+#define HC_HTXnL5HE_MASK        0x00f00000
+#define HC_HTXnL1HE_SHIFT       4
+#define HC_HTXnL2HE_SHIFT       8
+#define HC_HTXnL3HE_SHIFT       12
+#define HC_HTXnL4HE_SHIFT       16
+#define HC_HTXnL5HE_SHIFT       20
+/* HC_SubA_HTXnL6_bHE      0x0052
+ */
+#define HC_HTXnL6HE_MASK        0x0000000f
+#define HC_HTXnL7HE_MASK        0x000000f0
+#define HC_HTXnL8HE_MASK        0x00000f00
+#define HC_HTXnL9HE_MASK        0x0000f000
+#define HC_HTXnLaHE_MASK        0x000f0000
+#define HC_HTXnLbHE_MASK        0x00f00000
+#define HC_HTXnL7HE_SHIFT       4
+#define HC_HTXnL8HE_SHIFT       8
+#define HC_HTXnL9HE_SHIFT       12
+#define HC_HTXnLaHE_SHIFT       16
+#define HC_HTXnLbHE_SHIFT       20
+/* HC_SubA_HTXnLc_11HE      0x0053
+ */
+#define HC_HTXnLcHE_MASK        0x0000000f
+#define HC_HTXnLdHE_MASK        0x000000f0
+#define HC_HTXnLeHE_MASK        0x00000f00
+#define HC_HTXnLfHE_MASK        0x0000f000
+#define HC_HTXnL10HE_MASK       0x000f0000
+#define HC_HTXnL11HE_MASK       0x00f00000
+#define HC_HTXnLdHE_SHIFT       4
+#define HC_HTXnLeHE_SHIFT       8
+#define HC_HTXnLfHE_SHIFT       12
+#define HC_HTXnL10HE_SHIFT      16
+#define HC_HTXnL11HE_SHIFT      20
+/* HC_SubA_HTXnL0OS        0x0077
+ */
+#define HC_HTXnL0OS_MASK        0x003ff000
+#define HC_HTXnLVmax_MASK       0x00000fc0
+#define HC_HTXnLVmin_MASK       0x0000003f
+#define HC_HTXnL0OS_SHIFT       12
+#define HC_HTXnLVmax_SHIFT      6
+/* HC_SubA_HTXnTB          0x0078
+ */
+#define HC_HTXnTB_MASK          0x00f00000
+#define HC_HTXnFLSe_MASK        0x0000e000
+#define HC_HTXnFLSs_MASK        0x00001c00
+#define HC_HTXnFLTe_MASK        0x00000380
+#define HC_HTXnFLTs_MASK        0x00000070
+#define HC_HTXnFLDs_MASK        0x0000000f
+#define HC_HTXnTB_NoTB          0x00000000
+#define HC_HTXnTB_TBC_S         0x00100000
+#define HC_HTXnTB_TBC_T         0x00200000
+#define HC_HTXnTB_TB_S          0x00400000
+#define HC_HTXnTB_TB_T          0x00800000
+#define HC_HTXnFLSe_Nearest     0x00000000
+#define HC_HTXnFLSe_Linear      0x00002000
+#define HC_HTXnFLSe_NonLinear   0x00004000
+#define HC_HTXnFLSe_Sharp       0x00008000
+#define HC_HTXnFLSe_Flat_Gaussian_Cubic 0x0000c000
+#define HC_HTXnFLSs_Nearest     0x00000000
+#define HC_HTXnFLSs_Linear      0x00000400
+#define HC_HTXnFLSs_NonLinear   0x00000800
+#define HC_HTXnFLSs_Flat_Gaussian_Cubic 0x00001800
+#define HC_HTXnFLTe_Nearest     0x00000000
+#define HC_HTXnFLTe_Linear      0x00000080
+#define HC_HTXnFLTe_NonLinear   0x00000100
+#define HC_HTXnFLTe_Sharp       0x00000180
+#define HC_HTXnFLTe_Flat_Gaussian_Cubic 0x00000300
+#define HC_HTXnFLTs_Nearest     0x00000000
+#define HC_HTXnFLTs_Linear      0x00000010
+#define HC_HTXnFLTs_NonLinear   0x00000020
+#define HC_HTXnFLTs_Flat_Gaussian_Cubic 0x00000060
+#define HC_HTXnFLDs_Tex0        0x00000000
+#define HC_HTXnFLDs_Nearest     0x00000001
+#define HC_HTXnFLDs_Linear      0x00000002
+#define HC_HTXnFLDs_NonLinear   0x00000003
+#define HC_HTXnFLDs_Dither      0x00000004
+#define HC_HTXnFLDs_ConstLOD    0x00000005
+#define HC_HTXnFLDs_Ani         0x00000006
+#define HC_HTXnFLDs_AniDither   0x00000007
+/* HC_SubA_HTXnMPMD        0x0079
+ */
+#define HC_HTXnMPMD_SMASK       0x00070000
+#define HC_HTXnMPMD_TMASK       0x00380000
+#define HC_HTXnLODDTf_MASK      0x00000007
+#define HC_HTXnXY2ST_MASK       0x00000008
+#define HC_HTXnMPMD_Tsingle     0x00000000
+#define HC_HTXnMPMD_Tclamp      0x00080000
+#define HC_HTXnMPMD_Trepeat     0x00100000
+#define HC_HTXnMPMD_Tmirror     0x00180000
+#define HC_HTXnMPMD_Twrap       0x00200000
+#define HC_HTXnMPMD_Ssingle     0x00000000
+#define HC_HTXnMPMD_Sclamp      0x00010000
+#define HC_HTXnMPMD_Srepeat     0x00020000
+#define HC_HTXnMPMD_Smirror     0x00030000
+#define HC_HTXnMPMD_Swrap       0x00040000
+/* HC_SubA_HTXnCLODu       0x007a
+ */
+#define HC_HTXnCLODu_MASK       0x000ffc00
+#define HC_HTXnCLODd_MASK       0x000003ff
+#define HC_HTXnCLODu_SHIFT      10
+/* HC_SubA_HTXnFM          0x007b
+ */
+#define HC_HTXnFM_MASK          0x00ff0000
+#define HC_HTXnLoc_MASK         0x00000003
+#define HC_HTXnFM_INDEX         0x00000000
+#define HC_HTXnFM_Intensity     0x00080000
+#define HC_HTXnFM_Lum           0x00100000
+#define HC_HTXnFM_Alpha         0x00180000
+#define HC_HTXnFM_DX            0x00280000
+#define HC_HTXnFM_ARGB16        0x00880000
+#define HC_HTXnFM_ARGB32        0x00980000
+#define HC_HTXnFM_ABGR16        0x00a80000
+#define HC_HTXnFM_ABGR32        0x00b80000
+#define HC_HTXnFM_RGBA16        0x00c80000
+#define HC_HTXnFM_RGBA32        0x00d80000
+#define HC_HTXnFM_BGRA16        0x00e80000
+#define HC_HTXnFM_BGRA32        0x00f80000
+#define HC_HTXnFM_BUMPMAP       0x00380000
+#define HC_HTXnFM_Index1        (HC_HTXnFM_INDEX     | 0x00000000)
+#define HC_HTXnFM_Index2        (HC_HTXnFM_INDEX     | 0x00010000)
+#define HC_HTXnFM_Index4        (HC_HTXnFM_INDEX     | 0x00020000)
+#define HC_HTXnFM_Index8        (HC_HTXnFM_INDEX     | 0x00030000)
+#define HC_HTXnFM_T1            (HC_HTXnFM_Intensity | 0x00000000)
+#define HC_HTXnFM_T2            (HC_HTXnFM_Intensity | 0x00010000)
+#define HC_HTXnFM_T4            (HC_HTXnFM_Intensity | 0x00020000)
+#define HC_HTXnFM_T8            (HC_HTXnFM_Intensity | 0x00030000)
+#define HC_HTXnFM_L1            (HC_HTXnFM_Lum       | 0x00000000)
+#define HC_HTXnFM_L2            (HC_HTXnFM_Lum       | 0x00010000)
+#define HC_HTXnFM_L4            (HC_HTXnFM_Lum       | 0x00020000)
+#define HC_HTXnFM_L8            (HC_HTXnFM_Lum       | 0x00030000)
+#define HC_HTXnFM_AL44          (HC_HTXnFM_Lum       | 0x00040000)
+#define HC_HTXnFM_AL88          (HC_HTXnFM_Lum       | 0x00050000)
+#define HC_HTXnFM_A1            (HC_HTXnFM_Alpha     | 0x00000000)
+#define HC_HTXnFM_A2            (HC_HTXnFM_Alpha     | 0x00010000)
+#define HC_HTXnFM_A4            (HC_HTXnFM_Alpha     | 0x00020000)
+#define HC_HTXnFM_A8            (HC_HTXnFM_Alpha     | 0x00030000)
+#define HC_HTXnFM_DX1           (HC_HTXnFM_DX        | 0x00010000)
+#define HC_HTXnFM_DX23          (HC_HTXnFM_DX        | 0x00020000)
+#define HC_HTXnFM_DX45          (HC_HTXnFM_DX        | 0x00030000)
+#define HC_HTXnFM_RGB555        (HC_HTXnFM_ARGB16    | 0x00000000)
+#define HC_HTXnFM_RGB565        (HC_HTXnFM_ARGB16    | 0x00010000)
+#define HC_HTXnFM_ARGB1555      (HC_HTXnFM_ARGB16    | 0x00020000)
+#define HC_HTXnFM_ARGB4444      (HC_HTXnFM_ARGB16    | 0x00030000)
+#define HC_HTXnFM_ARGB0888      (HC_HTXnFM_ARGB32    | 0x00000000)
+#define HC_HTXnFM_ARGB8888      (HC_HTXnFM_ARGB32    | 0x00010000)
+#define HC_HTXnFM_BGR555        (HC_HTXnFM_ABGR16    | 0x00000000)
+#define HC_HTXnFM_BGR565        (HC_HTXnFM_ABGR16    | 0x00010000)
+#define HC_HTXnFM_ABGR1555      (HC_HTXnFM_ABGR16    | 0x00020000)
+#define HC_HTXnFM_ABGR4444      (HC_HTXnFM_ABGR16    | 0x00030000)
+#define HC_HTXnFM_ABGR0888      (HC_HTXnFM_ABGR32    | 0x00000000)
+#define HC_HTXnFM_ABGR8888      (HC_HTXnFM_ABGR32    | 0x00010000)
+#define HC_HTXnFM_RGBA5550      (HC_HTXnFM_RGBA16    | 0x00000000)
+#define HC_HTXnFM_RGBA5551      (HC_HTXnFM_RGBA16    | 0x00020000)
+#define HC_HTXnFM_RGBA4444      (HC_HTXnFM_RGBA16    | 0x00030000)
+#define HC_HTXnFM_RGBA8880      (HC_HTXnFM_RGBA32    | 0x00000000)
+#define HC_HTXnFM_RGBA8888      (HC_HTXnFM_RGBA32    | 0x00010000)
+#define HC_HTXnFM_BGRA5550      (HC_HTXnFM_BGRA16    | 0x00000000)
+#define HC_HTXnFM_BGRA5551      (HC_HTXnFM_BGRA16    | 0x00020000)
+#define HC_HTXnFM_BGRA4444      (HC_HTXnFM_BGRA16    | 0x00030000)
+#define HC_HTXnFM_BGRA8880      (HC_HTXnFM_BGRA32    | 0x00000000)
+#define HC_HTXnFM_BGRA8888      (HC_HTXnFM_BGRA32    | 0x00010000)
+#define HC_HTXnFM_VU88          (HC_HTXnFM_BUMPMAP   | 0x00000000)
+#define HC_HTXnFM_LVU655        (HC_HTXnFM_BUMPMAP   | 0x00010000)
+#define HC_HTXnFM_LVU888        (HC_HTXnFM_BUMPMAP   | 0x00020000)
+#define HC_HTXnLoc_Local        0x00000000
+#define HC_HTXnLoc_Sys          0x00000002
+#define HC_HTXnLoc_AGP          0x00000003
+/* HC_SubA_HTXnTRAH        0x007f
+ */
+#define HC_HTXnTRAH_MASK        0x00ff0000
+#define HC_HTXnTRAL_MASK        0x0000ff00
+#define HC_HTXnTBA_MASK         0x000000ff
+#define HC_HTXnTRAH_SHIFT       16
+#define HC_HTXnTRAL_SHIFT       8
+/* HC_SubA_HTXnTBLCsat     0x0080
+ *-- Define the input texture.
+ */
+#define HC_XTC_TOPC             0x00000000
+#define HC_XTC_InvTOPC          0x00000010
+#define HC_XTC_TOPCp5           0x00000020
+#define HC_XTC_Cbias            0x00000000
+#define HC_XTC_InvCbias         0x00000010
+#define HC_XTC_0                0x00000000
+#define HC_XTC_Dif              0x00000001
+#define HC_XTC_Spec             0x00000002
+#define HC_XTC_Tex              0x00000003
+#define HC_XTC_Cur              0x00000004
+#define HC_XTC_Adif             0x00000005
+#define HC_XTC_Fog              0x00000006
+#define HC_XTC_Atex             0x00000007
+#define HC_XTC_Acur             0x00000008
+#define HC_XTC_HTXnTBLRC        0x00000009
+#define HC_XTC_Ctexnext         0x0000000a
+/*--
+ */
+#define HC_HTXnTBLCsat_MASK     0x00800000
+#define HC_HTXnTBLCa_MASK       0x000fc000
+#define HC_HTXnTBLCb_MASK       0x00001f80
+#define HC_HTXnTBLCc_MASK       0x0000003f
+#define HC_HTXnTBLCa_TOPC       (HC_XTC_TOPC << 14)
+#define HC_HTXnTBLCa_InvTOPC    (HC_XTC_InvTOPC << 14)
+#define HC_HTXnTBLCa_TOPCp5     (HC_XTC_TOPCp5 << 14)
+#define HC_HTXnTBLCa_0          (HC_XTC_0 << 14)
+#define HC_HTXnTBLCa_Dif        (HC_XTC_Dif << 14)
+#define HC_HTXnTBLCa_Spec       (HC_XTC_Spec << 14)
+#define HC_HTXnTBLCa_Tex        (HC_XTC_Tex << 14)
+#define HC_HTXnTBLCa_Cur        (HC_XTC_Cur << 14)
+#define HC_HTXnTBLCa_Adif       (HC_XTC_Adif << 14)
+#define HC_HTXnTBLCa_Fog        (HC_XTC_Fog << 14)
+#define HC_HTXnTBLCa_Atex       (HC_XTC_Atex << 14)
+#define HC_HTXnTBLCa_Acur       (HC_XTC_Acur << 14)
+#define HC_HTXnTBLCa_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 14)
+#define HC_HTXnTBLCa_Ctexnext   (HC_XTC_Ctexnext << 14)
+#define HC_HTXnTBLCb_TOPC       (HC_XTC_TOPC << 7)
+#define HC_HTXnTBLCb_InvTOPC    (HC_XTC_InvTOPC << 7)
+#define HC_HTXnTBLCb_TOPCp5     (HC_XTC_TOPCp5 << 7)
+#define HC_HTXnTBLCb_0          (HC_XTC_0 << 7)
+#define HC_HTXnTBLCb_Dif        (HC_XTC_Dif << 7)
+#define HC_HTXnTBLCb_Spec       (HC_XTC_Spec << 7)
+#define HC_HTXnTBLCb_Tex        (HC_XTC_Tex << 7)
+#define HC_HTXnTBLCb_Cur        (HC_XTC_Cur << 7)
+#define HC_HTXnTBLCb_Adif       (HC_XTC_Adif << 7)
+#define HC_HTXnTBLCb_Fog        (HC_XTC_Fog << 7)
+#define HC_HTXnTBLCb_Atex       (HC_XTC_Atex << 7)
+#define HC_HTXnTBLCb_Acur       (HC_XTC_Acur << 7)
+#define HC_HTXnTBLCb_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 7)
+#define HC_HTXnTBLCb_Ctexnext   (HC_XTC_Ctexnext << 7)
+#define HC_HTXnTBLCc_TOPC       (HC_XTC_TOPC << 0)
+#define HC_HTXnTBLCc_InvTOPC    (HC_XTC_InvTOPC << 0)
+#define HC_HTXnTBLCc_TOPCp5     (HC_XTC_TOPCp5 << 0)
+#define HC_HTXnTBLCc_0          (HC_XTC_0 << 0)
+#define HC_HTXnTBLCc_Dif        (HC_XTC_Dif << 0)
+#define HC_HTXnTBLCc_Spec       (HC_XTC_Spec << 0)
+#define HC_HTXnTBLCc_Tex        (HC_XTC_Tex << 0)
+#define HC_HTXnTBLCc_Cur        (HC_XTC_Cur << 0)
+#define HC_HTXnTBLCc_Adif       (HC_XTC_Adif << 0)
+#define HC_HTXnTBLCc_Fog        (HC_XTC_Fog << 0)
+#define HC_HTXnTBLCc_Atex       (HC_XTC_Atex << 0)
+#define HC_HTXnTBLCc_Acur       (HC_XTC_Acur << 0)
+#define HC_HTXnTBLCc_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 0)
+#define HC_HTXnTBLCc_Ctexnext   (HC_XTC_Ctexnext << 0)
+/* HC_SubA_HTXnTBLCop      0x0081
+ */
+#define HC_HTXnTBLdot_MASK      0x00c00000
+#define HC_HTXnTBLCop_MASK      0x00380000
+#define HC_HTXnTBLCbias_MASK    0x0007c000
+#define HC_HTXnTBLCshift_MASK   0x00001800
+#define HC_HTXnTBLAop_MASK      0x00000380
+#define HC_HTXnTBLAbias_MASK    0x00000078
+#define HC_HTXnTBLAshift_MASK   0x00000003
+#define HC_HTXnTBLCop_Add       0x00000000
+#define HC_HTXnTBLCop_Sub       0x00080000
+#define HC_HTXnTBLCop_Min       0x00100000
+#define HC_HTXnTBLCop_Max       0x00180000
+#define HC_HTXnTBLCop_Mask      0x00200000
+#define HC_HTXnTBLCbias_Cbias           (HC_XTC_Cbias << 14)
+#define HC_HTXnTBLCbias_InvCbias        (HC_XTC_InvCbias << 14)
+#define HC_HTXnTBLCbias_0               (HC_XTC_0 << 14)
+#define HC_HTXnTBLCbias_Dif             (HC_XTC_Dif << 14)
+#define HC_HTXnTBLCbias_Spec            (HC_XTC_Spec << 14)
+#define HC_HTXnTBLCbias_Tex             (HC_XTC_Tex << 14)
+#define HC_HTXnTBLCbias_Cur             (HC_XTC_Cur << 14)
+#define HC_HTXnTBLCbias_Adif            (HC_XTC_Adif << 14)
+#define HC_HTXnTBLCbias_Fog             (HC_XTC_Fog << 14)
+#define HC_HTXnTBLCbias_Atex            (HC_XTC_Atex << 14)
+#define HC_HTXnTBLCbias_Acur            (HC_XTC_Acur << 14)
+#define HC_HTXnTBLCbias_HTXnTBLRC       (HC_XTC_HTXnTBLRC << 14)
+#define HC_HTXnTBLCshift_1      0x00000000
+#define HC_HTXnTBLCshift_2      0x00000800
+#define HC_HTXnTBLCshift_No     0x00001000
+#define HC_HTXnTBLCshift_DotP   0x00001800
+#define HC_HTXnTBLAop_Add       0x00000000
+#define HC_HTXnTBLAop_Sub       0x00000080
+#define HC_HTXnTBLAop_Min       0x00000100
+#define HC_HTXnTBLAop_Max       0x00000180
+#define HC_HTXnTBLAop_Mask      0x00000200
+#define HC_HTXnTBLAbias_Inv             0x00000040
+#define HC_HTXnTBLAbias_Adif            0x00000000
+#define HC_HTXnTBLAbias_Fog             0x00000008
+#define HC_HTXnTBLAbias_Acur            0x00000010
+#define HC_HTXnTBLAbias_HTXnTBLRAbias   0x00000018
+#define HC_HTXnTBLAbias_Atex            0x00000020
+#define HC_HTXnTBLAshift_1      0x00000000
+#define HC_HTXnTBLAshift_2      0x00000001
+#define HC_HTXnTBLAshift_No     0x00000002
+/* #define HC_HTXnTBLAshift_DotP   0x00000003 */
+/* HC_SubA_HTXnTBLMPFog    0x0082
+ */
+#define HC_HTXnTBLMPfog_MASK    0x00e00000
+#define HC_HTXnTBLMPfog_0       0x00000000
+#define HC_HTXnTBLMPfog_Adif    0x00200000
+#define HC_HTXnTBLMPfog_Fog     0x00400000
+#define HC_HTXnTBLMPfog_Atex    0x00600000
+#define HC_HTXnTBLMPfog_Acur    0x00800000
+#define HC_HTXnTBLMPfog_GHTXnTBLRFog    0x00a00000
+/* HC_SubA_HTXnTBLAsat     0x0083
+ *-- Define the texture alpha input.
+ */
+#define HC_XTA_TOPA             0x00000000
+#define HC_XTA_InvTOPA          0x00000008
+#define HC_XTA_TOPAp5           0x00000010
+#define HC_XTA_Adif             0x00000000
+#define HC_XTA_Fog              0x00000001
+#define HC_XTA_Acur             0x00000002
+#define HC_XTA_HTXnTBLRA        0x00000003
+#define HC_XTA_Atex             0x00000004
+#define HC_XTA_Atexnext         0x00000005
+/*--
+ */
+#define HC_HTXnTBLAsat_MASK     0x00800000
+#define HC_HTXnTBLAMB_MASK      0x00700000
+#define HC_HTXnTBLAa_MASK       0x0007c000
+#define HC_HTXnTBLAb_MASK       0x00000f80
+#define HC_HTXnTBLAc_MASK       0x0000001f
+#define HC_HTXnTBLAMB_SHIFT     20
+#define HC_HTXnTBLAa_TOPA       (HC_XTA_TOPA << 14)
+#define HC_HTXnTBLAa_InvTOPA    (HC_XTA_InvTOPA << 14)
+#define HC_HTXnTBLAa_TOPAp5     (HC_XTA_TOPAp5 << 14)
+#define HC_HTXnTBLAa_Adif       (HC_XTA_Adif << 14)
+#define HC_HTXnTBLAa_Fog        (HC_XTA_Fog << 14)
+#define HC_HTXnTBLAa_Acur       (HC_XTA_Acur << 14)
+#define HC_HTXnTBLAa_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 14)
+#define HC_HTXnTBLAa_Atex       (HC_XTA_Atex << 14)
+#define HC_HTXnTBLAa_Atexnext   (HC_XTA_Atexnext << 14)
+#define HC_HTXnTBLAb_TOPA       (HC_XTA_TOPA << 7)
+#define HC_HTXnTBLAb_InvTOPA    (HC_XTA_InvTOPA << 7)
+#define HC_HTXnTBLAb_TOPAp5     (HC_XTA_TOPAp5 << 7)
+#define HC_HTXnTBLAb_Adif       (HC_XTA_Adif << 7)
+#define HC_HTXnTBLAb_Fog        (HC_XTA_Fog << 7)
+#define HC_HTXnTBLAb_Acur       (HC_XTA_Acur << 7)
+#define HC_HTXnTBLAb_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 7)
+#define HC_HTXnTBLAb_Atex       (HC_XTA_Atex << 7)
+#define HC_HTXnTBLAb_Atexnext   (HC_XTA_Atexnext << 7)
+#define HC_HTXnTBLAc_TOPA       (HC_XTA_TOPA << 0)
+#define HC_HTXnTBLAc_InvTOPA    (HC_XTA_InvTOPA << 0)
+#define HC_HTXnTBLAc_TOPAp5     (HC_XTA_TOPAp5 << 0)
+#define HC_HTXnTBLAc_Adif       (HC_XTA_Adif << 0)
+#define HC_HTXnTBLAc_Fog        (HC_XTA_Fog << 0)
+#define HC_HTXnTBLAc_Acur       (HC_XTA_Acur << 0)
+#define HC_HTXnTBLAc_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 0)
+#define HC_HTXnTBLAc_Atex       (HC_XTA_Atex << 0)
+#define HC_HTXnTBLAc_Atexnext   (HC_XTA_Atexnext << 0)
+/* HC_SubA_HTXnTBLRAa      0x0089
+ */
+#define HC_HTXnTBLRAa_MASK      0x00ff0000
+#define HC_HTXnTBLRAb_MASK      0x0000ff00
+#define HC_HTXnTBLRAc_MASK      0x000000ff
+#define HC_HTXnTBLRAa_SHIFT     16
+#define HC_HTXnTBLRAb_SHIFT     8
+#define HC_HTXnTBLRAc_SHIFT     0
+/* HC_SubA_HTXnTBLRFog     0x008a
+ */
+#define HC_HTXnTBLRFog_MASK     0x0000ff00
+#define HC_HTXnTBLRAbias_MASK   0x000000ff
+#define HC_HTXnTBLRFog_SHIFT    8
+#define HC_HTXnTBLRAbias_SHIFT  0
+/* HC_SubA_HTXnLScale      0x0094
+ */
+#define HC_HTXnLScale_MASK      0x0007fc00
+#define HC_HTXnLOff_MASK        0x000001ff
+#define HC_HTXnLScale_SHIFT     10
+/* HC_SubA_HTXSMD          0x0000
+ */
+#define HC_HTXSMD_MASK          0x00000080
+#define HC_HTXTMD_MASK          0x00000040
+#define HC_HTXNum_MASK          0x00000038
+#define HC_HTXTRMD_MASK         0x00000006
+#define HC_HTXCHCLR_MASK        0x00000001
+#define HC_HTXNum_SHIFT         3
+
+/* Texture Palette n
+ */
+#define HC_SubType_TexPalette0  0x00000000
+#define HC_SubType_TexPalette1  0x00000001
+#define HC_SubType_FogTable     0x00000010
+#define HC_SubType_Stipple      0x00000014
+/* HC_SubA_TexPalette0     0x0000
+ */
+#define HC_HTPnA_MASK           0xff000000
+#define HC_HTPnR_MASK           0x00ff0000
+#define HC_HTPnG_MASK           0x0000ff00
+#define HC_HTPnB_MASK           0x000000ff
+/* HC_SubA_FogTable        0x0010
+ */
+#define HC_HFPn3_MASK           0xff000000
+#define HC_HFPn2_MASK           0x00ff0000
+#define HC_HFPn1_MASK           0x0000ff00
+#define HC_HFPn_MASK            0x000000ff
+#define HC_HFPn3_SHIFT          24
+#define HC_HFPn2_SHIFT          16
+#define HC_HFPn1_SHIFT          8
+
+/* Auto Testing & Security
+ */
+#define HC_SubA_HenFIFOAT       0x0000
+#define HC_SubA_HFBDrawFirst    0x0004
+#define HC_SubA_HFBBasL         0x0005
+#define HC_SubA_HFBDst          0x0006
+/* HC_SubA_HenFIFOAT       0x0000
+ */
+#define HC_HenFIFOAT_MASK       0x00000020
+#define HC_HenGEMILock_MASK     0x00000010
+#define HC_HenFBASwap_MASK      0x00000008
+#define HC_HenOT_MASK           0x00000004
+#define HC_HenCMDQ_MASK         0x00000002
+#define HC_HenTXCTSU_MASK       0x00000001
+/* HC_SubA_HFBDrawFirst    0x0004
+ */
+#define HC_HFBDrawFirst_MASK    0x00000800
+#define HC_HFBQueue_MASK        0x00000400
+#define HC_HFBLock_MASK         0x00000200
+#define HC_HEOF_MASK            0x00000100
+#define HC_HFBBasH_MASK         0x000000ff
+
+/* GEMI Setting
+ */
+#define HC_SubA_HTArbRCM        0x0008
+#define HC_SubA_HTArbRZ         0x000a
+#define HC_SubA_HTArbWZ         0x000b
+#define HC_SubA_HTArbRTX        0x000c
+#define HC_SubA_HTArbRCW        0x000d
+#define HC_SubA_HTArbE2         0x000e
+#define HC_SubA_HArbRQCM        0x0010
+#define HC_SubA_HArbWQCM        0x0011
+#define HC_SubA_HGEMITout       0x0020
+#define HC_SubA_HFthRTXD        0x0040
+#define HC_SubA_HFthRTXA        0x0044
+#define HC_SubA_HCMDQstL        0x0050
+#define HC_SubA_HCMDQendL       0x0051
+#define HC_SubA_HCMDQLen        0x0052
+/* HC_SubA_HTArbRCM        0x0008
+ */
+#define HC_HTArbRCM_MASK        0x0000ffff
+/* HC_SubA_HTArbRZ         0x000a
+ */
+#define HC_HTArbRZ_MASK         0x0000ffff
+/* HC_SubA_HTArbWZ         0x000b
+ */
+#define HC_HTArbWZ_MASK         0x0000ffff
+/* HC_SubA_HTArbRTX        0x000c
+ */
+#define HC_HTArbRTX_MASK        0x0000ffff
+/* HC_SubA_HTArbRCW        0x000d
+ */
+#define HC_HTArbRCW_MASK        0x0000ffff
+/* HC_SubA_HTArbE2         0x000e
+ */
+#define HC_HTArbE2_MASK         0x0000ffff
+/* HC_SubA_HArbRQCM        0x0010
+ */
+#define HC_HTArbRQCM_MASK       0x0000ffff
+/* HC_SubA_HArbWQCM        0x0011
+ */
+#define HC_HArbWQCM_MASK        0x0000ffff
+/* HC_SubA_HGEMITout       0x0020
+ */
+#define HC_HGEMITout_MASK       0x000f0000
+#define HC_HNPArbZC_MASK        0x0000ffff
+#define HC_HGEMITout_SHIFT      16
+/* HC_SubA_HFthRTXD        0x0040
+ */
+#define HC_HFthRTXD_MASK        0x00ff0000
+#define HC_HFthRZD_MASK         0x0000ff00
+#define HC_HFthWZD_MASK         0x000000ff
+#define HC_HFthRTXD_SHIFT       16
+#define HC_HFthRZD_SHIFT        8
+/* HC_SubA_HFthRTXA        0x0044
+ */
+#define HC_HFthRTXA_MASK        0x000000ff
+
+/******************************************************************************
+** Define the Halcyon Internal register access constants. For simulator only.
+******************************************************************************/
+#define HC_SIMA_HAGPBstL        0x0000
+#define HC_SIMA_HAGPBendL       0x0001
+#define HC_SIMA_HAGPCMNT        0x0002
+#define HC_SIMA_HAGPBpL         0x0003
+#define HC_SIMA_HAGPBpH         0x0004
+#define HC_SIMA_HClipTB         0x0005
+#define HC_SIMA_HClipLR         0x0006
+#define HC_SIMA_HFPClipTL       0x0007
+#define HC_SIMA_HFPClipBL       0x0008
+#define HC_SIMA_HFPClipLL       0x0009
+#define HC_SIMA_HFPClipRL       0x000a
+#define HC_SIMA_HFPClipTBH      0x000b
+#define HC_SIMA_HFPClipLRH      0x000c
+#define HC_SIMA_HLP             0x000d
+#define HC_SIMA_HLPRF           0x000e
+#define HC_SIMA_HSolidCL        0x000f
+#define HC_SIMA_HPixGC          0x0010
+#define HC_SIMA_HSPXYOS         0x0011
+#define HC_SIMA_HCmdA           0x0012
+#define HC_SIMA_HCmdB           0x0013
+#define HC_SIMA_HEnable         0x0014
+#define HC_SIMA_HZWBBasL        0x0015
+#define HC_SIMA_HZWBBasH        0x0016
+#define HC_SIMA_HZWBType        0x0017
+#define HC_SIMA_HZBiasL         0x0018
+#define HC_SIMA_HZWBend         0x0019
+#define HC_SIMA_HZWTMD          0x001a
+#define HC_SIMA_HZWCDL          0x001b
+#define HC_SIMA_HZWCTAGnum      0x001c
+#define HC_SIMA_HZCYNum         0x001d
+#define HC_SIMA_HZWCFire        0x001e
+/* #define HC_SIMA_HSBBasL         0x001d */
+/* #define HC_SIMA_HSBBasH         0x001e */
+/* #define HC_SIMA_HSBFM           0x001f */
+#define HC_SIMA_HSTREF          0x0020
+#define HC_SIMA_HSTMD           0x0021
+#define HC_SIMA_HABBasL         0x0022
+#define HC_SIMA_HABBasH         0x0023
+#define HC_SIMA_HABFM           0x0024
+#define HC_SIMA_HATMD           0x0025
+#define HC_SIMA_HABLCsat        0x0026
+#define HC_SIMA_HABLCop         0x0027
+#define HC_SIMA_HABLAsat        0x0028
+#define HC_SIMA_HABLAop         0x0029
+#define HC_SIMA_HABLRCa         0x002a
+#define HC_SIMA_HABLRFCa        0x002b
+#define HC_SIMA_HABLRCbias      0x002c
+#define HC_SIMA_HABLRCb         0x002d
+#define HC_SIMA_HABLRFCb        0x002e
+#define HC_SIMA_HABLRAa         0x002f
+#define HC_SIMA_HABLRAb         0x0030
+#define HC_SIMA_HDBBasL         0x0031
+#define HC_SIMA_HDBBasH         0x0032
+#define HC_SIMA_HDBFM           0x0033
+#define HC_SIMA_HFBBMSKL        0x0034
+#define HC_SIMA_HROP            0x0035
+#define HC_SIMA_HFogLF          0x0036
+#define HC_SIMA_HFogCL          0x0037
+#define HC_SIMA_HFogCH          0x0038
+#define HC_SIMA_HFogStL         0x0039
+#define HC_SIMA_HFogStH         0x003a
+#define HC_SIMA_HFogOOdMF       0x003b
+#define HC_SIMA_HFogOOdEF       0x003c
+#define HC_SIMA_HFogEndL        0x003d
+#define HC_SIMA_HFogDenst       0x003e
+/*---- start of texture 0 setting ----
+ */
+#define HC_SIMA_HTX0L0BasL      0x0040
+#define HC_SIMA_HTX0L1BasL      0x0041
+#define HC_SIMA_HTX0L2BasL      0x0042
+#define HC_SIMA_HTX0L3BasL      0x0043
+#define HC_SIMA_HTX0L4BasL      0x0044
+#define HC_SIMA_HTX0L5BasL      0x0045
+#define HC_SIMA_HTX0L6BasL      0x0046
+#define HC_SIMA_HTX0L7BasL      0x0047
+#define HC_SIMA_HTX0L8BasL      0x0048
+#define HC_SIMA_HTX0L9BasL      0x0049
+#define HC_SIMA_HTX0LaBasL      0x004a
+#define HC_SIMA_HTX0LbBasL      0x004b
+#define HC_SIMA_HTX0LcBasL      0x004c
+#define HC_SIMA_HTX0LdBasL      0x004d
+#define HC_SIMA_HTX0LeBasL      0x004e
+#define HC_SIMA_HTX0LfBasL      0x004f
+#define HC_SIMA_HTX0L10BasL     0x0050
+#define HC_SIMA_HTX0L11BasL     0x0051
+#define HC_SIMA_HTX0L012BasH    0x0052
+#define HC_SIMA_HTX0L345BasH    0x0053
+#define HC_SIMA_HTX0L678BasH    0x0054
+#define HC_SIMA_HTX0L9abBasH    0x0055
+#define HC_SIMA_HTX0LcdeBasH    0x0056
+#define HC_SIMA_HTX0Lf1011BasH  0x0057
+#define HC_SIMA_HTX0L0Pit       0x0058
+#define HC_SIMA_HTX0L1Pit       0x0059
+#define HC_SIMA_HTX0L2Pit       0x005a
+#define HC_SIMA_HTX0L3Pit       0x005b
+#define HC_SIMA_HTX0L4Pit       0x005c
+#define HC_SIMA_HTX0L5Pit       0x005d
+#define HC_SIMA_HTX0L6Pit       0x005e
+#define HC_SIMA_HTX0L7Pit       0x005f
+#define HC_SIMA_HTX0L8Pit       0x0060
+#define HC_SIMA_HTX0L9Pit       0x0061
+#define HC_SIMA_HTX0LaPit       0x0062
+#define HC_SIMA_HTX0LbPit       0x0063
+#define HC_SIMA_HTX0LcPit       0x0064
+#define HC_SIMA_HTX0LdPit       0x0065
+#define HC_SIMA_HTX0LePit       0x0066
+#define HC_SIMA_HTX0LfPit       0x0067
+#define HC_SIMA_HTX0L10Pit      0x0068
+#define HC_SIMA_HTX0L11Pit      0x0069
+#define HC_SIMA_HTX0L0_5WE      0x006a
+#define HC_SIMA_HTX0L6_bWE      0x006b
+#define HC_SIMA_HTX0Lc_11WE     0x006c
+#define HC_SIMA_HTX0L0_5HE      0x006d
+#define HC_SIMA_HTX0L6_bHE      0x006e
+#define HC_SIMA_HTX0Lc_11HE     0x006f
+#define HC_SIMA_HTX0L0OS        0x0070
+#define HC_SIMA_HTX0TB          0x0071
+#define HC_SIMA_HTX0MPMD        0x0072
+#define HC_SIMA_HTX0CLODu       0x0073
+#define HC_SIMA_HTX0FM          0x0074
+#define HC_SIMA_HTX0TRCH        0x0075
+#define HC_SIMA_HTX0TRCL        0x0076
+#define HC_SIMA_HTX0TBC         0x0077
+#define HC_SIMA_HTX0TRAH        0x0078
+#define HC_SIMA_HTX0TBLCsat     0x0079
+#define HC_SIMA_HTX0TBLCop      0x007a
+#define HC_SIMA_HTX0TBLMPfog    0x007b
+#define HC_SIMA_HTX0TBLAsat     0x007c
+#define HC_SIMA_HTX0TBLRCa      0x007d
+#define HC_SIMA_HTX0TBLRCb      0x007e
+#define HC_SIMA_HTX0TBLRCc      0x007f
+#define HC_SIMA_HTX0TBLRCbias   0x0080
+#define HC_SIMA_HTX0TBLRAa      0x0081
+#define HC_SIMA_HTX0TBLRFog     0x0082
+#define HC_SIMA_HTX0BumpM00     0x0083
+#define HC_SIMA_HTX0BumpM01     0x0084
+#define HC_SIMA_HTX0BumpM10     0x0085
+#define HC_SIMA_HTX0BumpM11     0x0086
+#define HC_SIMA_HTX0LScale      0x0087
+/*---- end of texture 0 setting ----      0x008f
+ */
+#define HC_SIMA_TX0TX1_OFF      0x0050
+/*---- start of texture 1 setting ----
+ */
+#define HC_SIMA_HTX1L0BasL      (HC_SIMA_HTX0L0BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L1BasL      (HC_SIMA_HTX0L1BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L2BasL      (HC_SIMA_HTX0L2BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L3BasL      (HC_SIMA_HTX0L3BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L4BasL      (HC_SIMA_HTX0L4BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L5BasL      (HC_SIMA_HTX0L5BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6BasL      (HC_SIMA_HTX0L6BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L7BasL      (HC_SIMA_HTX0L7BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L8BasL      (HC_SIMA_HTX0L8BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9BasL      (HC_SIMA_HTX0L9BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LaBasL      (HC_SIMA_HTX0LaBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LbBasL      (HC_SIMA_HTX0LbBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcBasL      (HC_SIMA_HTX0LcBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LdBasL      (HC_SIMA_HTX0LdBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LeBasL      (HC_SIMA_HTX0LeBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LfBasL      (HC_SIMA_HTX0LfBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L10BasL     (HC_SIMA_HTX0L10BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L11BasL     (HC_SIMA_HTX0L11BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L012BasH    (HC_SIMA_HTX0L012BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L345BasH    (HC_SIMA_HTX0L345BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L678BasH    (HC_SIMA_HTX0L678BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9abBasH    (HC_SIMA_HTX0L9abBasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcdeBasH    (HC_SIMA_HTX0LcdeBasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lf1011BasH  (HC_SIMA_HTX0Lf1011BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0Pit       (HC_SIMA_HTX0L0Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L1Pit       (HC_SIMA_HTX0L1Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L2Pit       (HC_SIMA_HTX0L2Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L3Pit       (HC_SIMA_HTX0L3Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L4Pit       (HC_SIMA_HTX0L4Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L5Pit       (HC_SIMA_HTX0L5Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6Pit       (HC_SIMA_HTX0L6Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L7Pit       (HC_SIMA_HTX0L7Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L8Pit       (HC_SIMA_HTX0L8Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9Pit       (HC_SIMA_HTX0L9Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LaPit       (HC_SIMA_HTX0LaPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LbPit       (HC_SIMA_HTX0LbPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcPit       (HC_SIMA_HTX0LcPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LdPit       (HC_SIMA_HTX0LdPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LePit       (HC_SIMA_HTX0LePit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LfPit       (HC_SIMA_HTX0LfPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L10Pit      (HC_SIMA_HTX0L10Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L11Pit      (HC_SIMA_HTX0L11Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0_5WE      (HC_SIMA_HTX0L0_5WE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6_bWE      (HC_SIMA_HTX0L6_bWE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lc_11WE     (HC_SIMA_HTX0Lc_11WE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0_5HE      (HC_SIMA_HTX0L0_5HE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6_bHE      (HC_SIMA_HTX0L6_bHE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lc_11HE      (HC_SIMA_HTX0Lc_11HE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0OS        (HC_SIMA_HTX0L0OS + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TB          (HC_SIMA_HTX0TB + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1MPMD        (HC_SIMA_HTX0MPMD + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1CLODu       (HC_SIMA_HTX0CLODu + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1FM          (HC_SIMA_HTX0FM + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRCH        (HC_SIMA_HTX0TRCH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRCL        (HC_SIMA_HTX0TRCL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBC         (HC_SIMA_HTX0TBC + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRAH        (HC_SIMA_HTX0TRAH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LTC         (HC_SIMA_HTX0LTC + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LTA         (HC_SIMA_HTX0LTA + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLCsat     (HC_SIMA_HTX0TBLCsat + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLCop      (HC_SIMA_HTX0TBLCop + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLMPfog    (HC_SIMA_HTX0TBLMPfog + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLAsat     (HC_SIMA_HTX0TBLAsat + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCa      (HC_SIMA_HTX0TBLRCa + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCb      (HC_SIMA_HTX0TBLRCb + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCc      (HC_SIMA_HTX0TBLRCc + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCbias   (HC_SIMA_HTX0TBLRCbias + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRAa      (HC_SIMA_HTX0TBLRAa + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRFog     (HC_SIMA_HTX0TBLRFog + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM00     (HC_SIMA_HTX0BumpM00 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM01     (HC_SIMA_HTX0BumpM01 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM10     (HC_SIMA_HTX0BumpM10 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM11     (HC_SIMA_HTX0BumpM11 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LScale      (HC_SIMA_HTX0LScale + HC_SIMA_TX0TX1_OFF)
+/*---- end of texture 1 setting ---- 0xaf
+ */
+#define HC_SIMA_HTXSMD          0x00b0
+#define HC_SIMA_HenFIFOAT       0x00b1
+#define HC_SIMA_HFBDrawFirst    0x00b2
+#define HC_SIMA_HFBBasL         0x00b3
+#define HC_SIMA_HTArbRCM        0x00b4
+#define HC_SIMA_HTArbRZ         0x00b5
+#define HC_SIMA_HTArbWZ         0x00b6
+#define HC_SIMA_HTArbRTX        0x00b7
+#define HC_SIMA_HTArbRCW        0x00b8
+#define HC_SIMA_HTArbE2         0x00b9
+#define HC_SIMA_HGEMITout       0x00ba
+#define HC_SIMA_HFthRTXD        0x00bb
+#define HC_SIMA_HFthRTXA        0x00bc
+/* Define the texture palette 0
+ */
+#define HC_SIMA_HTP0            0x0100
+#define HC_SIMA_HTP1            0x0200
+#define HC_SIMA_FOGTABLE        0x0300
+#define HC_SIMA_STIPPLE         0x0400
+#define HC_SIMA_HE3Fire         0x0440
+#define HC_SIMA_TRANS_SET       0x0441
+#define HC_SIMA_HREngSt         0x0442
+#define HC_SIMA_HRFIFOempty     0x0443
+#define HC_SIMA_HRFIFOfull      0x0444
+#define HC_SIMA_HRErr           0x0445
+#define HC_SIMA_FIFOstatus      0x0446
+
+/******************************************************************************
+** Define the AGP command header.
+******************************************************************************/
+#define HC_ACMD_MASK            0xfe000000
+#define HC_ACMD_SUB_MASK        0x0c000000
+#define HC_ACMD_HCmdA           0xee000000
+#define HC_ACMD_HCmdB           0xec000000
+#define HC_ACMD_HCmdC           0xea000000
+#define HC_ACMD_H1              0xf0000000
+#define HC_ACMD_H2              0xf2000000
+#define HC_ACMD_H3              0xf4000000
+#define HC_ACMD_H4              0xf6000000
+
+#define HC_ACMD_H1IO_MASK       0x000001ff
+#define HC_ACMD_H2IO1_MASK      0x001ff000
+#define HC_ACMD_H2IO2_MASK      0x000001ff
+#define HC_ACMD_H2IO1_SHIFT     12
+#define HC_ACMD_H2IO2_SHIFT     0
+#define HC_ACMD_H3IO_MASK       0x000001ff
+#define HC_ACMD_H3COUNT_MASK    0x01fff000
+#define HC_ACMD_H3COUNT_SHIFT   12
+#define HC_ACMD_H4ID_MASK       0x000001ff
+#define HC_ACMD_H4COUNT_MASK    0x01fffe00
+#define HC_ACMD_H4COUNT_SHIFT   9
+
+/********************************************************************************
+** Define Header
+********************************************************************************/
+#define HC_HEADER2              0xF210F110
+
+/********************************************************************************
+** Define Dummy Value
+********************************************************************************/
+#define HC_DUMMY                0xCCCCCCCC
+/********************************************************************************
+** Define for DMA use
+********************************************************************************/
+#define HALCYON_HEADER2     0XF210F110
+#define HALCYON_FIRECMD     0XEE100000
+#define HALCYON_FIREMASK    0XFFF00000
+#define HALCYON_CMDB        0XEC000000
+#define HALCYON_CMDBMASK    0XFFFE0000
+#define HALCYON_SUB_ADDR0   0X00000000
+#define HALCYON_HEADER1MASK 0XFFFFFF00
+#define HALCYON_HEADER1     0XF0000000
+#define HC_SubA_HAGPBstL        0x0060
+#define HC_SubA_HAGPBendL       0x0061
+#define HC_SubA_HAGPCMNT        0x0062
+#define HC_SubA_HAGPBpL         0x0063
+#define HC_SubA_HAGPBpH         0x0064
+#define HC_HAGPCMNT_MASK        0x00800000
+#define HC_HCmdErrClr_MASK      0x00400000
+#define HC_HAGPBendH_MASK       0x0000ff00
+#define HC_HAGPBstH_MASK        0x000000ff
+#define HC_HAGPBendH_SHIFT      8
+#define HC_HAGPBstH_SHIFT       0
+#define HC_HAGPBpL_MASK         0x00fffffc
+#define HC_HAGPBpID_MASK        0x00000003
+#define HC_HAGPBpID_PAUSE       0x00000000
+#define HC_HAGPBpID_JUMP        0x00000001
+#define HC_HAGPBpID_STOP        0x00000002
+#define HC_HAGPBpH_MASK         0x00ffffff
+
+#endif // __VIA_REGS_3D_H__
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_accel.c b/Source/DirectFB/gfxdrivers/cle266/uc_accel.c
new file mode 100755
index 0000000..caad848
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_accel.c
@@ -0,0 +1,504 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+
+#include <gfx/convert.h>
+
+#include "unichrome.h"
+#include "uc_accel.h"
+#include "uc_fifo.h"
+#include "mmio.h"
+
+#define UC_ACCEL_BEGIN()                        \
+    UcDriverData *ucdrv = (UcDriverData*) drv;  \
+    UcDeviceData *ucdev = (UcDeviceData*) dev;  \
+    struct uc_fifo *fifo = ucdrv->fifo;         \
+    /*printf("entering %s\n", __PRETTY_FUNCTION__)*/
+
+#define UC_ACCEL_END()                                      \
+    UC_FIFO_CHECK(fifo);                                    \
+    /*printf("leaving %s\n", __PRETTY_FUNCTION__)*/
+
+// Private functions ---------------------------------------------------------
+
+/** Wait until a new command can be set up. */
+
+static inline void uc_waitcmd(UcDriverData* ucdrv, UcDeviceData* ucdev)
+{
+    int loop = 0;
+
+    if (!ucdev->must_wait)
+        return;
+
+    //printf("waitcmd ");
+
+    while (VIA_IN(ucdrv->hwregs, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY) {
+        if (++loop > MAXLOOP) {
+            D_ERROR("DirectFB/VIA: Timeout waiting for idle command regulator!\n");
+            break;
+        }
+    }
+
+    //printf("waited for %d (0x%x) cycles.\n", loop, loop);
+
+    ucdev->cmd_waitcycles += loop;
+    ucdev->must_wait = 0;
+}
+
+/** Send commands to 2D/3D engine. */
+
+void uc_emit_commands(void* drv, void* dev)
+{
+    UC_ACCEL_BEGIN()
+
+    uc_waitcmd(ucdrv, ucdev);
+
+    UC_FIFO_FLUSH(fifo);
+
+    ucdev->must_wait = 1;
+}
+
+void uc_flush_texture_cache(void* drv, void* dev)
+{
+    UC_ACCEL_BEGIN()
+
+    (void) ucdev;
+
+    UC_FIFO_PREPARE(fifo, 4);
+
+    UC_FIFO_ADD_HDR(fifo, (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24));
+    UC_FIFO_ADD_3D(fifo, HC_SubA_HTXSMD, HC_HTXCHCLR_MASK);
+    UC_FIFO_ADD_3D(fifo, HC_SubA_HTXSMD, 0);
+
+    UC_FIFO_CHECK(fifo);
+}
+
+/**
+ * Draw a horizontal or vertical line.
+ *
+ * @param fifo          command FIFO
+ *
+ * @param x             start x position
+ * @param y             start y position
+ * @param len           length
+ * @param hv            if zero: draw from left to right
+ *                      if nonzero: draw from top to bottom.
+ *
+ * @note This is actually a 1-pixel high or wide rectangular color fill.
+ */
+
+static inline void uc_draw_hv_line(struct uc_fifo* fifo,
+                                   int x, int y, int len, int hv, int rop)
+{
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, ((RS16(y) << 16) | RS16(x)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, len << (hv ? 16 : 0));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT
+        | rop | VIA_GEC_CLIP_ENABLE);
+}
+
+// DirectFB interfacing functions --------------------------------------------
+
+// Functions using the 2D engine ---
+
+bool uc_fill_rectangle(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color);
+
+    if (r->w == 0 || r->h == 0) return true;
+
+    UC_FIFO_PREPARE(fifo, 8);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, ((RS16(r->y) << 16) | RS16(r->x)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION,
+        (((RS16(r->h - 1)) << 16) | RS16((r->w - 1))));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT
+        | ucdev->draw_rop2d | VIA_GEC_CLIP_ENABLE);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_rectangle(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color);
+
+    int rop = ucdev->draw_rop2d;
+
+    // Draw lines, in this order: top, bottom, left, right
+
+    UC_FIFO_PREPARE(fifo, 26);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    uc_draw_hv_line(fifo, r->x, r->y, r->w - 1, 0, rop);
+    uc_draw_hv_line(fifo, r->x, r->y + r->h - 1, r->w - 1, 0, rop);
+    uc_draw_hv_line(fifo, r->x, r->y, r->h - 1, 1, rop);
+    uc_draw_hv_line(fifo, r->x + r->w - 1, r->y, r->h - 1, 1, rop);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_line(void* drv, void* dev, DFBRegion* line)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: l = (%d, %d) - (%d, %d), c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  line->x1, line->y1, line->x2, line->y2, ucdev->color);
+
+    int cmd;
+    int dx, dy, tmp, error;
+
+    error = 1;
+
+    cmd = VIA_GEC_LINE | VIA_GEC_FIXCOLOR_PAT | ucdev->draw_rop2d
+        | VIA_GEC_CLIP_ENABLE;
+
+    dx = line->x2 - line->x1;
+    if (dx < 0)
+    {
+        dx = -dx;
+        cmd |= VIA_GEC_DECX;        // line will be drawn from right
+        error = 0;
+    }
+
+    dy = line->y2 - line->y1;
+    if (dy < 0)
+    {
+        dy = -dy;
+        cmd |= VIA_GEC_DECY;        // line will be drawn from bottom
+    }
+
+    if (dy > dx)
+    {
+        tmp  = dy;
+        dy = dx;
+        dx = tmp;                   // Swap 'dx' and 'dy'
+        cmd |= VIA_GEC_Y_MAJOR;     // Y major line
+    }
+
+    UC_FIFO_PREPARE(fifo, 12);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_K1K2,
+        ((((dy << 1) & 0x3fff) << 16)| (((dy - dx) << 1) & 0x3fff)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_XY,
+        ((RS16(line->y1) << 16) | RS16(line->x1)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, dx);
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_ERROR,
+        (((dy << 1) - dx - error) & 0x3fff));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, cmd);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_blit(void* drv, void* dev, DFBRectangle* rect, int dx, int dy)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = (%d, %d, %d, %d) -> (%d, %d)\n", __PRETTY_FUNCTION__,
+    //  rect->x, rect->y, rect->h, rect->w, dx, dy);
+
+    int cmd = VIA_GEC_BLT | VIA_ROP_S | VIA_GEC_CLIP_ENABLE;
+
+    int sx = rect->x;
+    int sy = rect->y;
+    int w = rect->w;
+    int h = rect->h;
+
+    if (!w || !h) return true;
+
+    (void) ucdev; // Kill 'unused variable' compiler warning.
+
+    if (sx < dx) {
+        cmd |= VIA_GEC_DECX;
+        sx += w - 1;
+        dx += w - 1;
+    }
+
+    if (sy < dy) {
+        cmd |= VIA_GEC_DECY;
+        sy += h - 1;
+        dy += h - 1;
+    }
+
+    UC_FIFO_PREPARE(fifo, 10);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_SRCPOS, (RS16(sy) << 16) | RS16(sx));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, (RS16(dy) << 16) | RS16(dx));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, (RS16(h - 1) << 16) | RS16(w - 1));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, cmd);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+// Functions using the 3D engine ---
+
+bool uc_fill_rectangle_3d(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color3d);
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HVCycle_AFP |
+        HC_HVCycle_AA | HC_HVCycle_BB | HC_HVCycle_NewC | HC_HShading_FlatC;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    if (r->w == 0 || r->h == 0) return true;
+
+    UC_FIFO_PREPARE(fifo, 18);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, 0);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w, r->y + r->h, 0);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y + r->h, ucdev->color3d);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_rectangle_3d(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Line | HC_HVCycle_AFP | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 20);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w - 1, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w - 1, r->y + r->h - 1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y + r->h - 1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, ucdev->color3d);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_line_3d(void* drv, void* dev, DFBRegion* line)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Line | HC_HVCycle_Full | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 12);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, line->x1, line->y1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, line->x2, line->y2, 0);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_fill_triangle(void* drv, void* dev, DFBTriangle* tri)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HVCycle_Full | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 14);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, tri->x1, tri->y1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, tri->x2, tri->y2, 0);
+    UC_FIFO_ADD_XYC(fifo, tri->x3, tri->y3, 0);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_blit_3d(void* drv, void* dev,
+                DFBRectangle* rect, int dx, int dy)
+{
+    // TODO: Write separate blit function to save some overhead.
+
+    // Hmm, I don't think we can save anything beyond a few CPU cycles. -- dok
+
+    DFBRectangle dest = {dx, dy, rect->w, rect->h};
+    return uc_stretch_blit(drv, dev, rect, &dest);
+}
+
+bool uc_stretch_blit(void* drv, void* dev,
+                     DFBRectangle* sr, DFBRectangle* dr)
+{
+    UC_ACCEL_BEGIN()
+
+    float w = ucdev->hwtex.l2w;
+    float h = ucdev->hwtex.l2h;
+
+    float dy = dr->y;
+
+    float s1 = (sr->x        ) / w;
+    float t1 = (sr->y        ) / h;
+    float s2 = (sr->x + sr->w) / w;
+    float t2 = (sr->y + sr->h) / h;
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_W |
+               HC_HVPMSK_Cd  | HC_HVPMSK_S | HC_HVPMSK_T;
+
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HShading_FlatC |
+               HC_HVCycle_AFP | HC_HVCycle_AA | HC_HVCycle_BB | HC_HVCycle_NewC;
+
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    if (ucdev->bflags & DSBLIT_DEINTERLACE) {
+         t1 *= 0.5f;
+         t2 *= 0.5f;
+
+         if (ucdev->field)
+             dy += 0.5f;
+         else
+             dy -= 0.5f;
+    }
+
+    UC_FIFO_PREPARE(fifo, 30);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYWCST(fifo, dr->x+dr->w, dy,       1, 0,              s2, t1);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x,       dy+dr->h, 1, 0,              s1, t2);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x,       dy,       1, ucdev->color3d, s1, t1);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x+dr->w, dy+dr->h, 1, ucdev->color3d, s2, t2);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+
+    return true;
+}
+
+#define DFBCOLOR_TO_ARGB(c)   PIXEL_ARGB( (c).a, (c).r, (c).g, (c).b )
+
+bool uc_texture_triangles( void *drv, void *dev,
+                           DFBVertex *vertices, int num,
+                           DFBTriangleFormation formation )
+{
+     UC_ACCEL_BEGIN()
+
+     int i;
+
+     int cmdB = HC_ACMD_HCmdB |
+                HC_HVPMSK_X   | HC_HVPMSK_Y | HC_HVPMSK_Z | HC_HVPMSK_W |
+                HC_HVPMSK_Cd  | HC_HVPMSK_S | HC_HVPMSK_T;
+
+     int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HShading_Gouraud |
+                HC_HVCycle_Full;
+
+     int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+
+     switch (formation) {
+          case DTTF_LIST:
+               cmdA |= HC_HVCycle_NewA | HC_HVCycle_NewB | HC_HVCycle_NewC;
+               break;
+          case DTTF_STRIP:
+               cmdA |= HC_HVCycle_AB | HC_HVCycle_BC | HC_HVCycle_NewC;
+               break;
+          case DTTF_FAN:
+               cmdA |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
+               break;
+          default:
+               D_ONCE( "unknown triangle formation" );
+               return false;
+     }
+
+     UC_FIFO_PREPARE(fifo, 6 + num * 7);
+
+     UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+     UC_FIFO_ADD(fifo, cmdB);
+     UC_FIFO_ADD(fifo, cmdA);
+
+     for (i=0; i<num; i++) {
+          UC_FIFO_ADD_XYZWCST(fifo,
+                              vertices[i].x, vertices[i].y,
+                              vertices[i].z, vertices[i].w, ucdev->color3d,
+                              vertices[i].s, vertices[i].t);
+     }
+
+     UC_FIFO_ADD(fifo, cmdA_End);
+
+     UC_FIFO_PAD_EVEN(fifo);
+
+     UC_ACCEL_END();
+
+     return true;
+}
+
+    // Blit profiling
+
+    //struct timeval tv_start, tv_stop;
+    //gettimeofday(&tv_start, NULL);
+
+    // Run test here
+
+    //gettimeofday(&tv_stop, NULL);
+
+    //tv_stop.tv_sec -= tv_start.tv_sec;
+    //tv_stop.tv_usec -= tv_start.tv_usec;
+    //if (tv_stop.tv_usec < 0) {
+    //  tv_stop.tv_sec--;
+    //  tv_stop.tv_usec += 1000000;
+    //}
+
+    //printf("elapsed time: %d us\n", tv_stop.tv_usec);
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_accel.h b/Source/DirectFB/gfxdrivers/cle266/uc_accel.h
new file mode 100755
index 0000000..fb6e111
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_accel.h
@@ -0,0 +1,119 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_ACCEL_H__
+#define __UC_ACCEL_H__
+
+#include "unichrome.h"
+
+
+// 2D accelerator capabilites
+
+#define UC_DRAWING_FLAGS_2D        (DSDRAW_XOR)
+
+#define UC_BLITTING_FLAGS_2D       (DSBLIT_SRC_COLORKEY | DSBLIT_DST_COLORKEY)
+
+#define UC_DRAWING_FUNCTIONS_2D    (DFXL_DRAWLINE      | \
+                                    DFXL_DRAWRECTANGLE | \
+                                    DFXL_FILLRECTANGLE)
+
+#define UC_BLITTING_FUNCTIONS_2D   (DFXL_BLIT)
+
+
+// 3D accelerator capabilites
+
+#ifdef UC_ENABLE_3D
+
+#define UC_DRAWING_FLAGS_3D        (DSDRAW_BLEND | DSDRAW_XOR)
+
+#define UC_BLITTING_FLAGS_3D       (DSBLIT_BLEND_ALPHACHANNEL | \
+                                    DSBLIT_BLEND_COLORALPHA   | \
+                                    DSBLIT_COLORIZE           | \
+                                    DSBLIT_DEINTERLACE)
+
+#define UC_DRAWING_FUNCTIONS_3D    (DFXL_DRAWLINE      | \
+                                    DFXL_DRAWRECTANGLE | \
+                                    DFXL_FILLRECTANGLE | \
+                                    DFXL_FILLTRIANGLE)
+
+#define UC_BLITTING_FUNCTIONS_3D   (DFXL_BLIT        | \
+                                    DFXL_STRETCHBLIT | \
+                                    DFXL_TEXTRIANGLES)
+
+#else
+
+#define UC_DRAWING_FLAGS_3D        0
+#define UC_BLITTING_FLAGS_3D       0
+#define UC_DRAWING_FUNCTIONS_3D    0
+#define UC_BLITTING_FUNCTIONS_3D   0
+
+#endif // UC_ENABLE_3D
+
+
+// Functions
+
+void uc_emit_commands      ( void         *drv,
+                             void         *dev );
+
+void uc_flush_texture_cache( void         *drv,
+                             void         *dev );
+
+bool uc_fill_rectangle     ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_rectangle     ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_line          ( void         *drv,
+                             void         *dev,
+                             DFBRegion    *line );
+
+bool uc_blit               ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect,
+                             int           dx,
+                             int           dy );
+
+bool uc_fill_rectangle_3d  ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_rectangle_3d  ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_line_3d       ( void         *drv,
+                             void         *dev,
+                             DFBRegion    *line );
+
+bool uc_fill_triangle      ( void         *drv,
+                             void         *dev,
+                             DFBTriangle  *tri );
+
+bool uc_blit_3d            ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect,
+                             int           dx,
+                             int           dy );
+
+bool uc_stretch_blit       ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *srect,
+                             DFBRectangle *drect );
+
+bool uc_texture_triangles  ( void         *drv,
+                             void         *dev,
+                             DFBVertex    *vertices,
+                             int           num,
+                             DFBTriangleFormation formation );
+
+#endif // __UC_ACCEL_H__
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_fifo.c b/Source/DirectFB/gfxdrivers/cle266/uc_fifo.c
new file mode 100755
index 0000000..cc13433
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_fifo.c
@@ -0,0 +1,198 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <fusion/shmalloc.h>
+
+#include "uc_fifo.h"
+
+//#define UC_FIFO_DUMP_DATA
+
+// Private functions ---------------------------------------------------------
+
+/**
+ * Pad the FIFO buffer to a 32 byte boundary. Used by uc_flush_agp().
+ * @note Equivalent DRI code is in via_ioctl::viaFlushPrimsLocked()
+ */
+
+static void uc_fifo_pad(struct uc_fifo* fifo)
+{
+    switch (fifo->used & 0x7)
+    {
+    case 0:
+        break;
+    case 2:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    case 4:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    case 6:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    default:
+        break;
+    }
+}
+
+/**
+ * Manually write the FIFO buffer to the hardware.
+ * @note Equivalent DRI code is in via_ioctl::flush_sys()
+ */
+
+void uc_fifo_flush_sys(struct uc_fifo* fifo, volatile void *regs)
+{
+    u32* p;
+    u32* q;
+
+    volatile u32* hwregs     = regs;
+    volatile u32* reg_tset   = regs + VIA_REG_TRANSET;
+    volatile u32* reg_tspace = regs + VIA_REG_TRANSPACE;
+
+    int check2Dcmd;
+    u32 addr;
+
+    p = fifo->buf;
+    q = fifo->head;
+    check2Dcmd = 0;
+
+    uc_fifo_pad(fifo);
+
+#ifdef UC_FIFO_DUMP_DATA
+    printf("Flushing FIFO ... \n");
+#endif
+
+    while (p != q) {
+
+        if (*p == HALCYON_HEADER2) {
+            p++;
+            check2Dcmd = !(*p == HALCYON_SUB_ADDR0);
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tset = 0x%08x\n", *p);
+#endif
+            *reg_tset = *p;
+            p++;
+        }
+        else if (check2Dcmd && ((*p & HALCYON_HEADER1MASK) == HALCYON_HEADER1)) {
+            addr = (*p) & 0x0000001f;
+            p++;
+#ifdef UC_FIFO_DUMP_DATA
+            printf("2D (0x%02x) = 0x%x\n", addr << 2, *p);
+#endif
+            *(hwregs + addr) = *p;
+            p++;
+        }
+        else if ((*p & HALCYON_FIREMASK) == HALCYON_FIRECMD) {
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tspace = 0x%08x\n", *p);
+#endif
+            *reg_tspace = *p;
+            p++;
+
+            if ((p != q) && ((*p & HALCYON_FIREMASK) == HALCYON_FIRECMD))
+                p++;
+
+            if ((*p & HALCYON_CMDBMASK) != HC_ACMD_HCmdB)
+                check2Dcmd = 1;
+        }
+        else {
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tspace = 0x%08x\n", *p);
+#endif
+            *reg_tspace = *p;
+            p++;
+        }
+    }
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->prep = 0;
+}
+
+/** Use an AGP transfer to write the FIFO buffer to the hardware. Not implemented. */
+#if 0
+static void uc_fifo_flush_agp(struct uc_fifo* fifo)
+{
+    // TODO - however, there is no point in doing this, because
+    // an AGP transfer can require more register writes than
+    // needed for drawing a single primitive. DirectFB needs to
+    // adopt a begin/end architecture first, like OpenGL has.
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->prep = 0;
+}
+#endif
+
+// Public functions ----------------------------------------------------------
+
+/** Create a FIFO. Returns NULL on failure. */
+
+struct uc_fifo* uc_fifo_create(FusionSHMPoolShared *pool, size_t size)
+{
+    struct uc_fifo* fifo;
+
+    size += 32;     // Needed for padding.
+
+    fifo = SHCALLOC(pool, 1, sizeof(struct uc_fifo));
+    if (!fifo) return NULL;
+
+    // Note: malloc won't work for DMA buffers...
+
+    fifo->buf = SHMALLOC(pool, sizeof(u32) * size);
+    if (!(fifo->buf)) {
+        SHFREE(pool, fifo);
+        return NULL;
+    }
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->size = (unsigned int) size;
+    fifo->prep = 0;
+
+    //fifo->flush_sys = uc_fifo_flush_sys;
+
+    //fifo->flush = uc_fifo_flush_sys;
+
+    return fifo;
+}
+
+/** Destroy a FIFO */
+
+void uc_fifo_destroy(FusionSHMPoolShared *pool, struct uc_fifo* fifo)
+{
+    if (fifo) {
+        if (fifo->buf) {
+            SHFREE(pool, fifo->buf);
+            fifo->buf = NULL;
+        }
+        SHFREE(pool, fifo);
+    }
+}
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_fifo.h b/Source/DirectFB/gfxdrivers/cle266/uc_fifo.h
new file mode 100755
index 0000000..c7e2fe3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_fifo.h
@@ -0,0 +1,268 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_FIFO_H__
+#define __UC_FIFO_H__
+
+// Note to self: remove when added to makefile as -DUC_DEBUG.
+#define UC_DEBUG 1
+
+#include <dfb_types.h>
+
+#include "regs2d.h"
+#include "regs3d.h"
+#include "mmio.h"
+
+/**
+ * uc_fifo - GPU data queue.
+ *
+ * buf:         buffer start (userspace address)
+ * head:        pointer to first unused entry.
+ *
+ * size:        maximum number of entries in the fifo.
+ * prep:        number of entries allocated to be used.
+ * used:        number of entries currently in use.
+ *
+ * hwregs:      GPU register base address
+ * reg_tset:    address to GPU TRANSET register
+ * reg_tspace:  address to GPU TRANSPACE register
+ *
+ * flush:       function pointer to flush function (DMA or CPU)
+ * flush_sys:   function pointer to flush_sys (non-DMA) function
+ */
+
+struct uc_fifo
+{
+    u32* buf;
+    u32* head;
+
+    unsigned int size;
+    unsigned int prep;
+    unsigned int used;
+
+    //void (*flush)(struct uc_fifo* fifo, volatile void *hwregs);
+    //void (*flush_sys)(struct uc_fifo* fifo, volatile void *hwregs);
+};
+
+// Help macros ---------------------------------------------------------------
+
+// For the record: Macros suck maintenance- and debugging-wise,
+// but provide guaranteed inlining of the code.
+
+/**
+ * Send the contents of the FIFO buffer to the hardware, and clear
+ * the buffer. The transfer may be performed by the CPU or by DMA.
+ */
+
+//#define UC_FIFO_FLUSH(fifo) (fifo)->flush(fifo,ucdrv->hwregs)
+
+/**
+ * Same as UC_FIFO_FLUSH(), but always uses the CPU to transfer data.
+ */
+
+//#define UC_FIFO_FLUSH_SYS(fifo) (fifo)->flush_sys(fifo,ucdrv->hwregs)
+
+#define UC_FIFO_FLUSH(fifo)     uc_fifo_flush_sys(fifo,ucdrv->hwregs)
+#define UC_FIFO_FLUSH_SYS(fifo) uc_fifo_flush_sys(fifo,ucdrv->hwregs)
+
+/**
+ * Make sure there is room for dwsize double words in the FIFO.
+ * If necessary, the FIFO is flushed first.
+ *
+ * @param fifo      the fifo
+ * @param dwsize    number of double words to allocate
+ *
+ * @note It is ok to request more space than you will actually
+ * be using. This is useful when you don't know exactly beforehand
+ * how many entries you need.
+ *
+ * @note equivalent DRI code is in via_ioctl.c::viaCheckDma()
+ */
+
+#ifdef UC_DEBUG
+
+#define UC_FIFO_PREPARE(fifo, dwsize)                       \
+    do {                                                    \
+        if ((fifo)->used + dwsize + 32 > (fifo)->size) {    \
+            D_DEBUG("CLE266: FIFO full - flushing it.");   \
+            UC_FIFO_FLUSH(fifo);                            \
+        }                                                   \
+        if (dwsize + (fifo)->prep + 32 > (fifo)->size) {    \
+            D_BUG("CLE266: FIFO too small for allocation.");  \
+        }                                                   \
+        (fifo)->prep += dwsize;                             \
+    } while(0)
+
+#else
+
+#define UC_FIFO_PREPARE(fifo, dwsize)                       \
+    do {                                                    \
+        if ((fifo)->used + dwsize + 32 > (fifo)->size) {    \
+            UC_FIFO_FLUSH(fifo);                            \
+        }                                                   \
+        (fifo)->prep += dwsize;                             \
+    } while(0)
+
+#endif // UC_FIFO_DEBUG
+
+/**
+ * Add a 32-bit data word to the FIFO.
+ * Takes one entry in the FIFO.
+ */
+
+#define UC_FIFO_ADD(fifo, data)     \
+    do {                            \
+        *((fifo)->head) = (data);   \
+        (fifo)->head++;             \
+        (fifo)->used++;             \
+    } while(0)
+
+/**
+ * Add a command header. (HC_HEADER2 + parameter selection)
+ * Takes two entries in the fifo.
+ */
+
+#define UC_FIFO_ADD_HDR(fifo, param)    \
+    do {                                \
+        UC_FIFO_ADD(fifo, HC_HEADER2);  \
+        UC_FIFO_ADD(fifo, param);       \
+    } while(0);
+
+/**
+ * Add a floating point value to the FIFO.
+ * Non-floats (e.g integers) are converted first.
+ * Takes one entry in the FIFO.
+ */
+
+#define UC_FIFO_ADD_FLOAT(fifo, val)        \
+    do {                                    \
+        union {float f; u32 i;} v;          \
+        v.f = (float) (val);                \
+        UC_FIFO_ADD(fifo, v.i);             \
+    } while(0)
+
+/**
+ * Add a vertex on the form (x, y, color) to the FIFO.
+ * Takes three entries in the FIFO.
+ * The color format is 0xAARRGGBB.
+ */
+
+#define UC_FIFO_ADD_XYC(fifo, x, y, color)  \
+    do {                                    \
+        UC_FIFO_ADD_FLOAT(fifo, x);         \
+        UC_FIFO_ADD_FLOAT(fifo, y);         \
+        UC_FIFO_ADD(fifo, color);           \
+    } while(0)
+
+/**
+ * Add a vertex on the form (x, y, w, color, s, t) to the FIFO.
+ * Takes six entries in the FIFO.
+ * The color format is 0xAARRGGBB.
+ */
+
+#define UC_FIFO_ADD_XYWCST(fifo, x, y, w, color, s, t)  \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD_FLOAT(fifo, w);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+#define UC_FIFO_ADD_XYZWCST(fifo, x, y, z, w, color, s, t)  \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD_FLOAT(fifo, z);                     \
+        UC_FIFO_ADD_FLOAT(fifo, w);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+#define UC_FIFO_ADD_XYCST(fifo, x, y, color, s, t)      \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+
+/**
+ * Add data specifically for the 2D controller, to the fifo.
+ * Takes two entries in the FIFO.
+ *
+ * @param reg   2D register index
+ * @param data  32-bit data to add
+ */
+
+#define UC_FIFO_ADD_2D(fifo, reg, data)                     \
+    do {                                                    \
+        UC_FIFO_ADD(fifo, ((reg) >> 2) | HALCYON_HEADER1);  \
+        UC_FIFO_ADD(fifo, (data));                          \
+    } while (0)
+
+/**
+ * Add data specifically for a 3D controller register, to the fifo.
+ * Takes one entry in the FIFO.
+ *
+ * @param reg   3D register index (8 bit)
+ * @param data  24-bit data to add (make sure bits 24 - 31 are cleared!)
+ */
+
+#define UC_FIFO_ADD_3D(fifo, reg, data) \
+    UC_FIFO_ADD(fifo, ((reg) << 24) | (data))
+
+/**
+ * Pad the FIFO to an even number of entries.
+ * Takes zero or one entries in the FIFO.
+ */
+#define UC_FIFO_PAD_EVEN(fifo)  \
+        if (fifo->used & 1) UC_FIFO_ADD(fifo, HC_DUMMY)
+
+/**
+ * Check for buffer overruns.
+ * Can be redefined to nothing in release builds.
+ */
+
+#ifdef UC_DEBUG
+
+#define UC_FIFO_CHECK(fifo)                         \
+    do {                                            \
+        if ((fifo)->used > ((fifo)->size) - 32) {   \
+            D_BUG("CLE266: FIFO overrun.");           \
+        }                                           \
+        if ((fifo)->used > (fifo)->prep) {          \
+            D_BUG("CLE266: FIFO allocation error.");  \
+        }                                           \
+    } while(0)
+
+#else
+
+#define UC_FIFO_CHECK(fifo) do { } while(0)
+
+#endif // UC_DEBUG
+
+
+// FIFO functions ------------------------------------------------------------
+
+/** Create a FIFO. Returns NULL on failure. */
+
+struct uc_fifo* uc_fifo_create(FusionSHMPoolShared *pool, size_t size);
+
+/** Destroy a FIFO */
+
+void uc_fifo_destroy(FusionSHMPoolShared *pool, struct uc_fifo* fifo);
+
+void uc_fifo_flush_sys(struct uc_fifo* fifo, volatile void *regs);
+
+#endif // __UC_FIFO_H__
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_hw.h b/Source/DirectFB/gfxdrivers/cle266/uc_hw.h
new file mode 100755
index 0000000..83e3085
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_hw.h
@@ -0,0 +1,93 @@
+// Shared header file for uc_hwmap.c and uc_hwset.c.
+
+#ifndef __UC_HW_H__
+#define __UC_HW_H__
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+
+#include "unichrome.h"
+#include "uc_fifo.h"
+
+// GPU - mapping functions (uc_hwmap.c)
+
+/// Map a DirectFB destination surface pixel format to the hw. (3D)
+static inline int uc_map_dst_format( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555: return HC_HDBFM_ARGB1555;
+          case DSPF_RGB16:    return HC_HDBFM_RGB565;
+          case DSPF_RGB32:    return HC_HDBFM_ARGB0888;
+          case DSPF_ARGB:     return HC_HDBFM_ARGB8888;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+     return 0;
+}
+
+/// Map a DirectFB source surface pixel format to the hw. (3D)
+static inline int uc_map_src_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555: return HC_HTXnFM_ARGB1555;
+          case DSPF_RGB16:    return HC_HTXnFM_RGB565;
+          case DSPF_RGB32:    return HC_HTXnFM_ARGB0888;
+          case DSPF_ARGB:     return HC_HTXnFM_ARGB8888;
+          case DSPF_A8:       return HC_HTXnFM_A8;
+          case DSPF_LUT8:     return HC_HTXnFM_Index8;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+     return 0;
+}
+
+void uc_map_blending_fn( struct uc_hw_alpha      *hwalpha,
+                         DFBSurfaceBlendFunction  sblend,
+                         DFBSurfaceBlendFunction  dblend,
+                         DFBSurfacePixelFormat    dformat );
+
+void uc_map_blitflags  ( struct uc_hw_texture    *tex,
+                         DFBSurfaceBlittingFlags  bflags,
+                         DFBSurfacePixelFormat    sformat );
+
+// GPU - setting functions (uc_hwset.c)
+
+void uc_set_blending_fn( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_texenv     ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_clip       ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_destination( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_source_2d  ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_source_3d  ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_color_2d   ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_colorkey_2d( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+#endif // __UC_HW_H__
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_hwmap.c b/Source/DirectFB/gfxdrivers/cle266/uc_hwmap.c
new file mode 100755
index 0000000..4c2d8a0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_hwmap.c
@@ -0,0 +1,357 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+// Hardware mapping functions ------------------------------------------------
+
+#include <config.h>
+
+#include "uc_hw.h"
+#include <gfx/convert.h>
+
+/// Map DirectFB blending functions to hardware
+void
+uc_map_blending_fn( struct uc_hw_alpha      *hwalpha,
+                    DFBSurfaceBlendFunction  sblend,
+                    DFBSurfaceBlendFunction  dblend,
+                    DFBSurfacePixelFormat    dst_format )
+{
+     bool dst_alpha = DFB_PIXELFORMAT_HAS_ALPHA(dst_format);
+
+     // The HW's blending equation is:
+     // (Ca * FCa + Cbias + Cb * FCb) << Cshift
+
+     // Set source blending function
+
+     // Ca  -- always from source color.
+     hwalpha->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | HC_HABLCa_Csrc;
+     // Aa  -- always from source alpha.
+     hwalpha->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | HC_HABLAa_Asrc;
+
+     // FCa and FAa depend on the following condition.
+     switch (sblend) {
+          case DSBF_ZERO:
+               // GL_ZERO -- (0, 0, 0, 0)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
+               hwalpha->regHABLRFCa = 0x0;
+               hwalpha->regHABLRAa = 0x0;
+               break;
+
+          case DSBF_ONE:
+               // GL_ONE -- (1, 1, 1, 1)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+               hwalpha->regHABLRFCa = 0x0;
+               hwalpha->regHABLRAa = 0x0;
+               break;
+
+          case DSBF_SRCCOLOR:
+               // GL_SRC_COLOR -- (Rs, Gs, Bs, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Csrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_INVSRCCOLOR:
+               // GL_ONE_MINUS_SRC_COLOR -- (1, 1, 1, 1) - (Rs, Gs, Bs, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Csrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_SRCALPHA:
+               // GL_SRC_ALPHA -- (As, As, As, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Asrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_INVSRCALPHA:
+               // GL_ONE_MINUS_SRC_ALPHA -- (1, 1, 1, 1) - (As, As, As, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Asrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_DESTALPHA:
+               // GL_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else { // (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Adst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
+               }
+               break;
+
+          case DSBF_INVDESTALPHA:
+               // GL_ONE_MINUS_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else { // (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Adst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
+               }
+               break;
+
+          case DSBF_DESTCOLOR:
+               // GL_DST_COLOR -- (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Cdst;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
+               break;
+
+          case DSBF_INVDESTCOLOR:
+               // GL_ONE_MINUS_DST_COLOR -- (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Cdst;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
+               break;
+
+          case DSBF_SRCALPHASAT:
+               // GL_SRC_ALPHA_SATURATE
+               if (!dst_alpha) {
+                    // (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0
+                    // So (f, f, f, 1) = (0, 0, 0, 1)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else {
+                    // (f, f, f, 1), f = min(As, 1 - Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_mimAsrcInvAdst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               break;
+          default:
+               D_BUG("Unsupported blending function!");
+               break;
+     }
+
+     // Set destination blending function
+
+     // Op is add.
+     // bias is 0.
+
+     hwalpha->regHABLCsat |= HC_HABLCbias_HABLRCbias;
+     hwalpha->regHABLAsat |= HC_HABLAbias_HABLRAbias;
+
+     // Cb  -- always from destination color.
+     hwalpha->regHABLCop = HC_HABLCb_OPC | HC_HABLCb_Cdst;
+     // Ab  -- always from destination alpha.
+     hwalpha->regHABLAop = HC_HABLAb_OPA | HC_HABLAb_Adst;
+
+     // FCb -- depends on the following condition.
+     switch (dblend) {
+          case DSBF_ZERO:
+               // GL_ZERO -- (0, 0, 0, 0)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+
+          case DSBF_ONE:
+               // GL_ONE -- (1, 1, 1, 1)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+
+          case DSBF_SRCCOLOR:
+               // GL_SRC_COLOR -- (Rs, Gs, Bs, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Csrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_INVSRCCOLOR:
+               // GL_ONE_MINUS_SRC_COLOR -- (1, 1, 1, 1) - (Rs, Gs, Bs, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Csrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_SRCALPHA:
+               // GL_SRC_ALPHA -- (As, As, As, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Asrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_INVSRCALPHA:
+               // GL_ONE_MINUS_SRC_ALPHA -- (1, 1, 1, 1) - (As, As, As, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Asrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_0;
+               break;
+
+          case DSBF_DESTALPHA:
+               // GL_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1)
+                    hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
+                    hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
+                    hwalpha->regHABLRFCb = 0x0;
+                    hwalpha->regHABLRAb = 0x0;
+               }
+               else { // (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Adst;
+                    hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
+               }
+               break;
+
+          case DSBF_INVDESTALPHA:
+               // GL_ONE_MINUS_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
+                    hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+                    hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+                    hwalpha->regHABLRFCb = 0x0;
+                    hwalpha->regHABLRAb = 0x0;
+               }
+               else { // (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Adst;
+                    hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
+               }
+               break;
+
+          case DSBF_DESTCOLOR:
+               // GL_DST_COLOR -- (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Cdst;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
+               break;
+
+          case DSBF_INVDESTCOLOR:
+               // GL_ONE_MINUS_DST_COLOR -- (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Cdst;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
+               break;
+
+          case DSBF_SRCALPHASAT:
+               // Unsupported?
+
+          default:
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+     }
+}
+
+/// Map DFBSurfaceBlittingFlags to the hardware
+void
+uc_map_blitflags( struct uc_hw_texture    *tex,
+                  DFBSurfaceBlittingFlags  bflags,
+                  DFBSurfacePixelFormat    sformat )
+{
+     bool gotalpha = DFB_PIXELFORMAT_HAS_ALPHA(sformat);
+
+     if (bflags & DSBLIT_COLORIZE) {
+          // Cv0 = Ct*Cf
+
+          // Hw setting:
+          // Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
+
+          tex->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+                                  HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
+                                  HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Dif |
+                                  HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+          tex->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
+                                 HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
+                                 HC_HTXnTBLCshift_No;
+          tex->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_0;
+     }
+     else {
+          // Cv0 = Ct
+
+          // Hw setting:
+          // Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
+
+          tex->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+                                  HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
+                                  HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
+                                  HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+          tex->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
+                                 HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
+                                 HC_HTXnTBLCshift_No;
+          tex->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_0;
+     }
+
+     if (bflags & DSBLIT_BLEND_COLORALPHA) {
+          if ((bflags & DSBLIT_BLEND_ALPHACHANNEL) && gotalpha) {
+               // Av0 = At*Af
+
+               // Hw setting:
+               // Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+          else {
+               // (!(bflags & DSBLIT_BLEND_ALPHACHANNEL) && gotalpha) || !gotalpha
+               // Av0 = Af
+
+               // Hw setting:
+               // Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+     }
+     else {  // !(bflags & DSBLIT_BLEND_COLORALPHA)
+          if ((bflags & DSBLIT_BLEND_ALPHACHANNEL) && gotalpha) {
+               // Av0 = At
+
+               // Hw setting:
+               // Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+          else { // !gotalpha
+               // Av0 = 1.0
+
+               // D_BUG warning: I'm guessing where values should go,
+               // and how big (0xff = 1.0 ?) it should be.
+
+               // Hw setting:
+               // Aa = 1.0, Ab = 1.0, Cop = -, Ac = 1.0, Abias = 1.0, Ashift = No.
+               // => Av = Aa*(Ab-Ac) + Abias = 1*(1-1)+1 = 1
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+     }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_hwset.c b/Source/DirectFB/gfxdrivers/cle266/uc_hwset.c
new file mode 100755
index 0000000..8ba9d09
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_hwset.c
@@ -0,0 +1,419 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+// Hardware setting functions ------------------------------------------------
+
+#include <config.h>
+
+#include "uc_hw.h"
+#include <core/state.h>
+#include <core/palette.h>
+#include <gfx/convert.h>
+
+/// Integer 2-logarithm, y = log2(x), where x and y are integers.
+#define ILOG2(x,y) ILOG2_PORTABLE(x,y)
+
+#define ILOG2_PORTABLE(x,y) \
+    do {                    \
+        unsigned int i = 0; \
+        y = x;              \
+        while (y != 0) {    \
+            i++;            \
+            y = y >> 1;     \
+        }                   \
+        y = i-1;            \
+    } while (0)
+
+#define ILOG2_X86(x,y)  // TODO - use BSR (bit scan reverse) instruction
+
+/// Set alpha blending function (3D)
+void
+uc_set_blending_fn( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo     *fifo    = ucdrv->fifo;
+     struct uc_hw_alpha *hwalpha = &ucdev->hwalpha;
+
+     if (UC_IS_VALID( uc_blending_fn ))
+          return;
+
+     uc_map_blending_fn( hwalpha, state->src_blend, state->dst_blend,
+                         state->destination->config.format );
+
+     UC_FIFO_PREPARE( fifo, 14 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLCsat,   hwalpha->regHABLCsat   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLCop,    hwalpha->regHABLCop    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLAsat,   hwalpha->regHABLAsat   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLAop,    hwalpha->regHABLAop    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCa,    hwalpha->regHABLRCa    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRFCa,   hwalpha->regHABLRFCa   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCbias, hwalpha->regHABLRCbias );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCb,    hwalpha->regHABLRCb    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRFCb,   hwalpha->regHABLRFCb   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRAa,    hwalpha->regHABLRAa    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRAb,    hwalpha->regHABLRAb    );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_blending_fn );
+}
+
+/// Set texture environment (3D)
+void
+uc_set_texenv( UcDriverData *ucdrv,
+               UcDeviceData *ucdev,
+               CardState    *state )
+{
+     struct uc_fifo       *fifo  = ucdrv->fifo;
+     struct uc_hw_texture *hwtex = &ucdev->hwtex;
+
+     if (UC_IS_VALID( uc_texenv ))
+          return;
+
+     uc_map_blitflags( hwtex, state->blittingflags, state->source->config.format );
+
+     // Texture mapping method
+     hwtex->regHTXnTB   = HC_HTXnFLSs_Linear | HC_HTXnFLTs_Linear |
+                          HC_HTXnFLSe_Linear | HC_HTXnFLTe_Linear;
+
+     hwtex->regHTXnMPMD = HC_HTXnMPMD_Sclamp | HC_HTXnMPMD_Tclamp;
+
+     UC_FIFO_PREPARE( fifo, 12 );
+     UC_FIFO_ADD_HDR( fifo, (HC_ParaType_Tex << 16) | (HC_SubType_Tex0 << 24) );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTB,       hwtex->regHTXnTB         );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnMPMD,     hwtex->regHTXnMPMD       );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLCsat,  hwtex->regHTXnTBLCsat_0  );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLCop,   hwtex->regHTXnTBLCop_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLMPfog, hwtex->regHTXnTBLMPfog_0 );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLAsat,  hwtex->regHTXnTBLAsat_0  );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRCb,   hwtex->regHTXnTBLRCb_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRAa,   hwtex->regHTXnTBLRAa_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRFog,  hwtex->regHTXnTBLRFog_0  );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_texenv );
+}
+
+/// Set clipping rectangle (2D and 3D)
+void
+uc_set_clip( UcDriverData *ucdrv,
+             UcDeviceData *ucdev,
+             CardState    *state )
+{
+     struct uc_fifo *fifo = ucdrv->fifo;
+
+     if (DFB_REGION_EQUAL( ucdev->clip, state->clip ))
+          return;
+
+     UC_FIFO_PREPARE( fifo, 8 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+#ifdef UC_ENABLE_3D
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HClipTB,
+                      (RS12(state->clip.y1) << 12) | RS12(state->clip.y2+1) );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HClipLR,
+                      (RS12(state->clip.x1) << 12) | RS12(state->clip.x2+1) );
+
+#endif
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPTL,
+                      (RS16(state->clip.y1) << 16) | RS16(state->clip.x1) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPBR,
+                      (RS16(state->clip.y2) << 16) | RS16(state->clip.x2) );
+
+     UC_FIFO_CHECK( fifo );
+
+     ucdev->clip = state->clip;
+}
+
+/// Set destination (2D and 3D)
+void
+uc_set_destination( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo        *fifo        = ucdrv->fifo;
+
+     CoreSurface           *destination = state->destination;
+
+     DFBSurfacePixelFormat  dst_format  = destination->config.format;
+     int                    dst_offset  = state->dst.offset;
+     int                    dst_pitch   = state->dst.pitch;
+     int                    dst_bpp     = DFB_BYTES_PER_PIXEL( dst_format );
+
+
+     /* Save FIFO space and CPU cycles. */
+     if (ucdev->dst_format == dst_format &&
+         ucdev->dst_offset == dst_offset &&
+         ucdev->dst_pitch  == dst_pitch)
+          return;
+
+     // 2D engine setting
+
+     ucdev->pitch = (ucdev->pitch & 0x7fff) | (((dst_pitch >> 3) & 0x7fff) << 16);
+
+     UC_FIFO_PREPARE( fifo, 12 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH,   (VIA_PITCH_ENABLE | ucdev->pitch) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_DSTBASE, (dst_offset >> 3) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_GEMODE,  (dst_bpp - 1) << 8 );
+
+#ifdef UC_ENABLE_3D
+     // 3D engine setting
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBBasL, dst_offset & 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBBasH, dst_offset >> 24 );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBFM,   (uc_map_dst_format( dst_format ) |
+                                              (dst_pitch & HC_HDBPit_MASK)    |
+                                              HC_HDBLoc_Local) );
+
+     UC_FIFO_PAD_EVEN(fifo);
+#endif
+
+     UC_FIFO_CHECK( fifo );
+
+     ucdev->dst_format = dst_format;
+     ucdev->dst_offset = dst_offset;
+     ucdev->dst_pitch  = dst_pitch;
+}
+
+/// Set new source (2D)
+void
+uc_set_source_2d( UcDriverData *ucdrv,
+                  UcDeviceData *ucdev,
+                  CardState    *state )
+{
+     struct uc_fifo *fifo   = ucdrv->fifo;
+
+     if (UC_IS_VALID( uc_source2d ))
+          return;
+
+     ucdev->pitch &= 0x7fff0000;
+     ucdev->pitch |= (state->src.pitch >> 3) & 0x7fff;
+
+     UC_FIFO_PREPARE( fifo, 6 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_SRCBASE, state->src.offset >> 3 );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH,   VIA_PITCH_ENABLE | ucdev->pitch );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_source2d );
+}
+
+/// Set new source (3D)
+void
+uc_set_source_3d( UcDriverData *ucdrv,
+                  UcDeviceData *ucdev,
+                  CardState    *state )
+{
+     struct uc_fifo       *fifo   = ucdrv->fifo;
+     struct uc_hw_texture *hwtex  = &ucdev->hwtex;
+
+     CoreSurface          *source = state->source;
+
+     int src_height, src_offset, src_pitch;
+
+     if (UC_IS_VALID( uc_source3d ))
+          return;
+
+     src_height = source->config.size.h;
+     src_offset = state->src.offset;
+     src_pitch  = state->src.pitch;
+
+     /*
+      * TODO: Check if we can set the odd/even field as L1/L2 texture and select
+      * between L0/L1/L2 upon blit. Otherwise we depend on SMF_BLITTINGFLAGS ;(
+      */
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) {
+          if (source->field)
+               src_offset += src_pitch;
+
+          src_height >>= 1;
+          src_pitch  <<= 1;
+     }
+
+     ucdev->field = source->field;
+
+     // Round texture size up to nearest
+     // value evenly divisible by 2^n
+
+     ILOG2(source->config.size.w, hwtex->we);
+     hwtex->l2w = 1 << hwtex->we;
+     if (hwtex->l2w < source->config.size.w) {
+          hwtex->we++;
+          hwtex->l2w <<= 1;
+     }
+
+     ILOG2(src_height, hwtex->he);
+     hwtex->l2h = 1 << hwtex->he;
+     if (hwtex->l2h < src_height) {
+          hwtex->he++;
+          hwtex->l2h <<= 1;
+     }
+
+     hwtex->format = uc_map_src_format_3d( source->config.format );
+
+     UC_FIFO_PREPARE( fifo, 10);
+
+     UC_FIFO_ADD_HDR( fifo, (HC_ParaType_Tex << 16) | (HC_SubType_Tex0 << 24));
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnFM,       HC_HTXnLoc_Local | hwtex->format );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0OS,     (0 << HC_HTXnLVmax_SHIFT) );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0_5WE,   hwtex->we );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0_5HE,   hwtex->he );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL012BasH, (src_offset >> 24) & 0xff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0BasL,   (src_offset      ) & 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0Pit,    (HC_HTXnEnPit_MASK | src_pitch) );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     // Upload the palette of a 256 color texture.
+
+     if (hwtex->format == HC_HTXnFM_Index8) {
+          int       i, num;
+          DFBColor *colors;
+
+          UC_FIFO_PREPARE( fifo, 258 );
+
+          UC_FIFO_ADD_HDR( fifo, ((HC_ParaType_Palette    << 16) |
+                                  (HC_SubType_TexPalette0 << 24)) );
+
+          colors = source->palette->entries;
+          num    = source->palette->num_entries;
+
+          if (num > 256)
+               num = 256;
+
+          /* What about the last entry? -- dok */
+          for (i = 0; i < num; i++)
+               UC_FIFO_ADD( fifo, PIXEL_ARGB(colors[i].a, colors[i].r,
+                                             colors[i].g, colors[i].b) );
+
+          for (; i < 256; i++)
+               UC_FIFO_ADD( fifo, 0 );
+
+          UC_FIFO_CHECK( fifo );
+     }
+
+     UC_VALIDATE( uc_source3d );
+}
+
+/// Set either destination color key, or fill color, as needed. (2D)
+void
+uc_set_color_2d( UcDriverData *ucdrv,
+                 UcDeviceData *ucdev,
+                 CardState    *state )
+{
+     struct uc_fifo *fifo  = ucdrv->fifo;
+     u32             color = 0;
+
+     if (UC_IS_VALID( uc_color2d ))
+          return;
+
+     switch (state->destination->config.format) {
+          case DSPF_ARGB1555:
+               color = PIXEL_ARGB1555( state->color.a,
+                                       state->color.r,
+                                       state->color.g,
+                                       state->color.b );
+               color |= color << 16;
+               break;
+
+          case DSPF_RGB16:
+               color = PIXEL_RGB16( state->color.r,
+                                    state->color.g,
+                                    state->color.b);
+               color |= color << 16;
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               color = PIXEL_ARGB( state->color.a,
+                                   state->color.r,
+                                   state->color.g,
+                                   state->color.b );
+               break;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+
+     UC_FIFO_PREPARE( fifo, 8 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     // Opaque line drawing needs this
+     UC_FIFO_ADD_2D( fifo, VIA_REG_MONOPAT0,   0xff );
+
+     UC_FIFO_ADD_2D( fifo, VIA_REG_KEYCONTROL, 0 );
+     UC_FIFO_ADD_2D( fifo, VIA_REG_FGCOLOR,    color );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_color2d );
+     UC_INVALIDATE( uc_colorkey2d );
+}
+
+void
+uc_set_colorkey_2d( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo *fifo = ucdrv->fifo;
+
+     if (UC_IS_VALID( uc_colorkey2d ))
+          return;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          UC_FIFO_PREPARE( fifo, 6 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL, VIA_KEY_ENABLE_SRCKEY );
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_BGCOLOR, state->src_colorkey );
+     }
+     else if (state->blittingflags & DSBLIT_DST_COLORKEY) {
+          UC_FIFO_PREPARE( fifo, 6 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL,
+                           VIA_KEY_ENABLE_DSTKEY | VIA_KEY_INVERT_KEY );
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_FGCOLOR, state->dst_colorkey );
+     }
+     else {
+          UC_FIFO_PREPARE( fifo, 4 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL, 0 );
+     }
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_colorkey2d );
+     UC_INVALIDATE( uc_color2d );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_overlay.c b/Source/DirectFB/gfxdrivers/cle266/uc_overlay.c
new file mode 100755
index 0000000..2c50476
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_overlay.c
@@ -0,0 +1,320 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+#include <direct/messages.h>
+
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+// Forward declaration
+static DFBResult
+uc_ovl_remove(CoreLayer *layer,
+              void      *driver_data,
+              void      *layer_data,
+              void      *region_data);
+
+
+static int uc_ovl_datasize( void )
+{
+    return sizeof(UcOverlayData);
+}
+
+
+static DFBResult
+uc_ovl_init_layer( CoreLayer                   *layer,
+                   void                        *driver_data,
+                   void                        *layer_data,
+                   DFBDisplayLayerDescription  *description,
+                   DFBDisplayLayerConfig       *config,
+                   DFBColorAdjustment          *adjustment )
+{
+    UcDriverData* ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+
+    // Set layer type, capabilities and name
+
+    description->caps = UC_OVL_CAPS;
+    description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+    snprintf(description->name,
+        DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VIA CLE266 Video");
+
+    adjustment->flags = DCAF_NONE;
+
+    // Fill out the default configuration
+
+    config->flags  = DLCONF_WIDTH | DLCONF_HEIGHT |
+                     DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+
+    ucovl->v1.win.w = 720;
+    ucovl->v1.win.h = 576;
+    ucovl->v1.win.x = 0;
+    ucovl->v1.win.y = 0;
+
+    config->width  = 720;
+    config->height = 576;
+
+    config->pixelformat = DSPF_YV12;
+    config->buffermode  = DLBM_FRONTONLY;
+    config->options     = DLOP_NONE;
+
+    // Reset overlay
+
+    ucovl->extfifo_on = false;
+    ucovl->hwrev = ucdrv->hwrev;
+    ucovl->scrwidth = ucovl->v1.win.w;
+
+    ucovl->v1.isenabled = false;
+    ucovl->v1.cfg = *config;
+    ucovl->v1.ox = 0;
+    ucovl->v1.oy = 0;
+
+//    adjustment->flags = DCAF_BRIGHTNESS | DCAF_CONTRAST |
+//        DCAF_HUE | DCAF_SATURATION;
+    adjustment->brightness = 0x8000;
+    adjustment->contrast = 0x8000;
+    adjustment->saturation = 0x8000;
+    adjustment->hue = 0x8000;
+    ucovl->v1.adj = *adjustment;
+
+    uc_ovl_remove(layer, driver_data, layer_data, NULL);
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_set_region( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   void                       *region_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags  updated,
+                   CoreSurface                *surface,
+                   CorePalette                *palette,
+                   CoreSurfaceBufferLock      *lock )
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+
+    /* get new destination rectangle */
+    DFBRectangle win = config->dest;;
+
+    // Bounds checking
+    if ((win.x < -8192) || (win.x > 8192) ||
+        (win.y < -8192) || (win.y > 8192) ||
+        (win.w < 32) || (win.w > 4096) ||
+        (win.h < 32) || (win.h > 4096))
+    {
+        D_DEBUG("Layer size or position is out of bounds.");
+        return DFB_INVAREA;
+    }
+
+    ucovl->v1.isenabled = true;
+    ucovl->v1.win = win;
+
+    ucovl->deinterlace = config->options & DLOP_DEINTERLACING;
+    ucovl->surface     = surface;
+    ucovl->lock        = lock;
+
+    return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface, lock);
+}
+
+
+static DFBResult
+uc_ovl_remove(CoreLayer *layer,
+              void      *driver_data,
+              void      *layer_data,
+              void      *region_data)
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    volatile u8*   vio   = ucdrv->hwregs;
+
+    ucovl->v1.isenabled = false;
+
+    uc_ovl_vcmd_wait(vio);
+
+    VIDEO_OUT(vio, V_FIFO_CONTROL, UC_MAP_V1_FIFO_CONTROL(16,12,8));
+    //  VIDEO_OUT(vio, ALPHA_V3_FIFO_CONTROL, 0x0407181f);
+
+    if (ucovl->hwrev == 0x10) {
+        VIDEO_OUT(vio, V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
+        VIDEO_OUT(vio, V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
+    }
+    else {
+        VIDEO_OUT(vio, V1_ColorSpaceReg_1, ColorSpaceValue_1);
+        VIDEO_OUT(vio, V1_ColorSpaceReg_2, ColorSpaceValue_2);
+    }
+
+    VIDEO_OUT(vio, HQV_CONTROL, VIDEO_IN(vio, HQV_CONTROL) & ~HQV_ENABLE);
+    VIDEO_OUT(vio, V1_CONTROL, VIDEO_IN(vio, V1_CONTROL) & ~V1_ENABLE);
+    //  VIDEO_OUT(vio, V3_CONTROL, VIDEO_IN(vio, V3_CONTROL) & ~V3_ENABLE);
+
+    VIDEO_OUT(vio, V_COMPOSE_MODE,
+        VIDEO_IN(vio, V_COMPOSE_MODE) | V1_COMMAND_FIRE);
+
+    ucovl->surface = NULL;
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_test_region(CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed)
+{
+    CoreLayerRegionConfigFlags fail = 0;
+
+    // Check layer options
+
+    if (config->options & ~UC_OVL_OPTIONS)
+        fail |= CLRCF_OPTIONS;
+
+    // Check pixelformats
+
+    switch (config->format) {
+          case DSPF_YUY2:
+              break;
+          case DSPF_UYVY:
+              fail |= CLRCF_FORMAT;   // Nope...  doesn't work.
+              break;
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+              break;
+          default:
+              fail |= CLRCF_FORMAT;
+    }
+
+    // Check width and height
+
+    if (config->width > 4096 || config->width < 32)
+        fail |= CLRCF_WIDTH;
+
+    if (config->height > 4096 || config->height < 32)
+        fail |= CLRCF_HEIGHT;
+
+    if (failed) *failed = fail;
+    if (fail) return DFB_UNSUPPORTED;
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_flip_region( CoreLayer             *layer,
+                    void                  *driver_data,
+                    void                  *layer_data,
+                    void                  *region_data,
+                    CoreSurface           *surface,
+                    DFBSurfaceFlipFlags    flags,
+                    CoreSurfaceBufferLock *lock)
+{
+    //printf("Entering %s ... \n", __PRETTY_FUNCTION__);
+
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    DFBResult    ret;
+
+    if (((flags & DSFLIP_WAITFORSYNC) == DSFLIP_WAITFORSYNC) &&
+        !dfb_config->pollvsync_after)
+        dfb_layer_wait_vsync( layer );
+
+    dfb_surface_flip(surface, false);
+
+    ucovl->field = 0;
+    ucovl->lock = lock;
+
+    ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface, lock);
+    if (ret)
+        return ret;
+
+    if ((flags & DSFLIP_WAIT) &&
+        (dfb_config->pollvsync_after || !(flags & DSFLIP_ONSYNC)))
+        dfb_layer_wait_vsync(layer);
+
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_get_level(CoreLayer    *layer,
+                 void         *driver_data,
+                 void         *layer_data,
+                 int          *level)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    *level = ucovl->v1.level;
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_set_level(CoreLayer    *layer,
+                 void         *driver_data,
+                 void         *layer_data,
+                 int          level)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+    if (level == 0) return DFB_INVARG;
+    if (level > 0) {
+        // Enable underlay mode.
+        VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL, uc_ovl_map_alpha(-1));
+    }
+    else {
+        // Enable overlay mode (default)
+        VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL,
+            uc_ovl_map_alpha(ucovl->v1.opacity));
+    }
+
+    ucovl->v1.level = level;
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_set_input_field( CoreLayer *layer,
+                        void      *driver_data,
+                        void      *layer_data,
+                        void      *region_data,
+                        int        field )
+{
+     UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+     UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+     ucovl->field = field;
+
+     return uc_ovl_update(ucdrv, ucovl, UC_OVL_FIELD, ucovl->surface, ucovl->lock);
+}
+
+DisplayLayerFuncs ucOverlayFuncs = {
+    .LayerDataSize      = uc_ovl_datasize,
+    .InitLayer          = uc_ovl_init_layer,
+    .SetRegion          = uc_ovl_set_region,
+    .RemoveRegion       = uc_ovl_remove,
+    .TestRegion         = uc_ovl_test_region,
+    .FlipRegion         = uc_ovl_flip_region,
+    .GetLevel           = uc_ovl_get_level,
+    .SetLevel           = uc_ovl_set_level,
+    .SetInputField      = uc_ovl_set_input_field,
+    .SetColorAdjustment = uc_ovl_set_adjustment,
+};
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_overlay.h b/Source/DirectFB/gfxdrivers/cle266/uc_overlay.h
new file mode 100755
index 0000000..e687980
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_overlay.h
@@ -0,0 +1,85 @@
+#ifndef __UC_OVERLAY_H__
+#define __UC_OVERLAY_H__
+
+#define UC_OVL_CAPS (DLCAPS_SURFACE | DLCAPS_OPACITY | DLCAPS_SCREEN_LOCATION \
+    | DLCAPS_DEINTERLACING | DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST              \
+    | DLCAPS_SATURATION | DLCAPS_HUE)
+#define UC_OVL_OPTIONS (DLOP_DEINTERLACING)
+
+#define ALIGN_TO(v, n) (((v) + (n-1)) & ~(n-1))
+#define UC_MAP_V1_FIFO_CONTROL(depth, pre_thr, thr) \
+    (((depth)-1) | ((thr) << 8) | ((pre_thr) << 24))
+
+// Actions for uc_ovl_update()
+
+#define UC_OVL_FLIP     1
+#define UC_OVL_CHANGE   2
+#define UC_OVL_FIELD    4
+
+/** Overlay layer data. */
+struct uc_ovl_vinfo {
+    bool isenabled;                 // True when visible
+    DFBRectangle win;               // Layer screen rectangle.
+    DFBDisplayLayerConfig cfg;      // Layer configuration
+    int ox, oy;                     // Top-left visible corner (the offset)
+                                    // in the source surface
+    u8 opacity;                     // Layer opacity
+    int level;                      // Position in the DirectFB layer stack
+                                    // < 0 = underlay mode, > 0 = overlay mode
+    DFBColorAdjustment adj;         // Color adjustment (brightness etc)
+};
+
+typedef struct _UcOverlayData {
+
+    // TODO: initialize the variables!!!
+
+    u8                  hwrev;       // CLE266 revision
+    int                 scrwidth;    // Current screen width
+
+    bool                extfifo_on;  // True when we're using the extended fifo.
+    u8                  mclk_save[3];
+
+    struct uc_ovl_vinfo v1;          // Video overlay V1
+
+    bool                deinterlace;
+    int                 field;
+
+    CoreSurface        *surface;
+
+    CoreSurfaceBufferLock *lock;
+} UcOverlayData;
+
+
+// Video engine - mapping functions (uc_ovl_hwmap.c)
+
+bool uc_ovl_map_vzoom(int sh, int dh, u32* zoom, u32* mini);
+bool uc_ovl_map_hzoom(int sw, int dw,  u32* zoom, u32* mini,
+                      u32* falign, u32* dcount);
+u32 uc_ovl_map_qwpitch(int falign, DFBSurfacePixelFormat format, int sw);
+u32 uc_ovl_map_format(DFBSurfacePixelFormat format);
+void uc_ovl_map_window(int scrw, int scrh, DFBRectangle* win, int sw, int sh,
+                       u32* win_start, u32* win_end, int* ox, int* oy);
+void uc_ovl_map_buffer(DFBSurfacePixelFormat format, u32 buf,
+                       int x, int y, int w, int h, int pitch, int field,
+                       u32* y_start, u32* u_start, u32* v_start);
+u32 uc_ovl_map_alpha(int opacity);
+void uc_ovl_map_v1_control(DFBSurfacePixelFormat format, int sw,
+                           int hwrev, bool extfifo_on,
+                           u32* control, u32* fifo);
+u32 uc_ovl_map_fifo(u8 depth, u8 pre_thr, u8 thr);
+void uc_ovl_map_adjustment(DFBColorAdjustment* adj, u32* a1, u32* a2);
+
+// Video engine - setting functions (uc_ovl_hwset.c)
+
+void uc_ovl_setup_fifo(UcOverlayData* ucovl, int scrwidth);
+void uc_ovl_vcmd_wait(volatile u8* vio);
+DFBResult uc_ovl_update(UcDriverData* ucdrv,
+                        UcOverlayData* ucovl, int action,
+                        CoreSurface* surface,
+                        CoreSurfaceBufferLock* lock);
+DFBResult uc_ovl_set_adjustment(CoreLayer *layer,
+                                void *driver_data,
+                                void *layer_data,
+                                DFBColorAdjustment *adj);
+
+#endif // __UC_OVERLAY_H__
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwmap.c b/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwmap.c
new file mode 100755
index 0000000..890b9bc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwmap.c
@@ -0,0 +1,560 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+#include <math.h>
+
+/**
+ * Map hw settings for vertical scaling.
+ *
+ * @param sh        source height
+ * @param dh        destination height
+ * @param zoom      will hold vertical setting of zoom register.
+ * @param mini      will hold vertical setting of mini register.
+ *
+ * @returns true if successful.
+ *          false if the zooming factor is too large or small.
+ *
+ * @note Derived from VIA's V4L driver.
+ *       See ddover.c, DDOVER_HQVCalcZoomHeight()
+ */
+
+bool uc_ovl_map_vzoom(int sh, int dh, u32* zoom, u32* mini)
+{
+    u32 sh1, tmp, d;
+    bool zoom_ok = true;
+
+    if (sh == dh) { // No zoom
+        // Do nothing
+    }
+    else if (sh < dh) { // Zoom in
+
+        tmp = (sh * 0x0400) / dh;
+        zoom_ok = !(tmp > 0x3ff);
+
+        *zoom |= (tmp & 0x3ff) | V1_Y_ZOOM_ENABLE;
+        *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
+    }
+    else { // sw > dh - Zoom out
+
+        // Find a suitable divider (1 << d) = {2, 4, 8 or 16}
+
+        sh1 = sh;
+        for (d = 1; d < 5; d++) {
+            sh1 >>= 1;
+            if (sh1 <= dh) break;
+        }
+        if (d == 5) { // Too small.
+            d = 4;
+            zoom_ok = false;
+        }
+
+        *mini |= ((d<<1)-1) << 16;  // <= {1,3,5,7} << 16
+
+        // Add scaling
+
+        if (sh1 < dh)  {
+            tmp = (sh1 * 0x400) / dh;
+            *zoom |= ((tmp & 0x3ff) | V1_Y_ZOOM_ENABLE);
+            *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
+        }
+    }
+
+    return zoom_ok;
+}
+
+
+/**
+ * Map hw settings for horizontal scaling.
+ *
+ * @param sw        source width
+ * @param dw        destination width
+ *
+ * @param zoom      will hold horizontal setting of zoom register.
+ * @param mini      will hold horizontal setting of mini register.
+ * @param falign    will hold fetch aligment
+ * @param dcount    will hold display count
+ *
+ * @returns true if successful.
+ *          false if the zooming factor is too large or small.
+ *
+ * @note Derived from VIA's V4L driver.
+ *       See ddover.c, DDOVER_HQVCalcZoomWidth() and DDOver_GetDisplayCount()
+ */
+bool uc_ovl_map_hzoom(int sw, int dw,  u32* zoom, u32* mini,
+                      u32* falign, u32* dcount)
+{
+    u32 tmp, sw1, d;
+    int md; // Minify-divider
+    bool zoom_ok = true;
+
+    md = 1;
+    *falign = 0;
+
+    if (sw == dw) { // No zoom
+        // Do nothing
+    }
+    else if (sw < dw) { // Zoom in
+
+        tmp = (sw * 0x0800) / dw;
+        zoom_ok = !(tmp > 0x7ff);
+
+        *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
+        *mini |= V1_X_INTERPOLY;
+    }
+    else { // sw > dw - Zoom out
+
+        // Find a suitable divider (1 << d) = {2, 4, 8 or 16}
+
+        sw1 = sw;
+        for (d = 1; d < 5; d++) {
+            sw1 >>= 1;
+            if (sw1 <= dw) break;
+        }
+        if (d == 5) { // Too small.
+            d = 4;
+            zoom_ok = false;
+        }
+
+        md = 1 << d;                    // <= {2,4,8,16}
+        *falign = ((md<<1)-1) & 0xf;    // <= {3,7,15,15}
+        *mini |= V1_X_INTERPOLY;
+        *mini |= ((d<<1)-1) << 24;      // <= {1,3,5,7} << 24
+
+        // Add scaling
+
+        if (sw1 < dw) {
+            //CLE bug
+            //tmp = sw1*0x0800 / dw;
+            tmp = (sw1 - 2) * 0x0800 / dw;
+            *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
+        }
+    }
+
+    *dcount = sw - md;
+
+    return zoom_ok;
+}
+
+
+/**
+ * @param falign    fetch alignment
+ * @param format    overlay pixel format
+ * @param sw        source width
+ *
+ * @returns qword pitch register setting
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetFetch()
+ * @note Only call after uc_ovl_map_hzoom()
+ */
+u32 uc_ovl_map_qwpitch(int falign, DFBSurfacePixelFormat format, int sw)
+{
+    int fetch = 0;
+
+    switch (format) {
+    case DSPF_YV12:
+        fetch = ALIGN_TO(sw, 32) >> 4;
+        break;
+    case DSPF_I420:
+        fetch = (ALIGN_TO(sw, 16) >> 4) + 1;
+        break;
+    case DSPF_UYVY:
+    case DSPF_YUY2:
+        fetch = (ALIGN_TO(sw << 1, 16) >> 4) + 1;
+        break;
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+        fetch = (ALIGN_TO(sw << 1, 16) >> 4) + 1;
+        break;
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        fetch = (ALIGN_TO(sw << 2, 16) >> 4) + 1;
+        break;
+    default:
+        D_BUG("Unexpected pixelformat!");
+        break;
+    }
+
+    if (fetch < 4) fetch = 4;
+
+    // Note: Unsure if alignment is needed or is in the way.
+    fetch = ALIGN_TO(fetch, falign + 1);
+    return fetch << 20; // V12_QWORD_PER_LINE
+}
+
+
+/**
+ * Map pixel format.
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetV1Format()
+ */
+u32 uc_ovl_map_format(DFBSurfacePixelFormat format)
+{
+    switch (format) {
+    case DSPF_YV12:
+    case DSPF_I420:
+        return V1_COLORSPACE_SIGN | V1_YUV420;
+    case DSPF_UYVY:
+    case DSPF_YUY2:
+        return V1_COLORSPACE_SIGN | V1_YUV422;
+    case DSPF_ARGB1555:
+        return V1_RGB15;
+    case DSPF_RGB16:
+        return V1_RGB16;
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        return V1_RGB32;
+    default :
+        D_BUG("Unexpected pixelformat!");
+        return V1_YUV422;
+    }
+}
+
+
+/**
+ * Map overlay window.
+ *
+ * @param scrw      screen width (eg. 800)
+ * @param scrh      screen height (eg. 600)
+ * @param win       destination window
+ * @param sw        source surface width
+ * @param sh        source surface height
+ *
+ * @param win_start will hold window start register setting
+ * @param win_end   will hold window end register setting
+ *
+ * @parm ox         will hold new leftmost coordinate in source surface
+ * @parm oy         will hold new topmost coordinate in source surface
+ */
+void uc_ovl_map_window(int scrw, int scrh, DFBRectangle* win, int sw, int sh,
+                       u32* win_start, u32* win_end, int* ox, int* oy)
+{
+    int x1, y1, x2, y2;
+    int x,y,dw,dh;      // These help making the code readable...
+
+    *ox = 0;
+    *oy = 0;
+    *win_start = 0;
+    *win_end = 0;
+
+    x = win->x;
+    y = win->y;
+    dw = win->w;
+    dh = win->h;
+
+    // For testing the clipping
+    //scrw -= 100;
+    //scrh -= 100;
+
+    // Handle invisible case.
+    if ((x > scrw) || (y > scrh) || (x+dw < 0) || (y+dh < 0)) return;
+
+    // Vertical clipping
+
+    if ((y >= 0) && (y+dh < scrh)) {
+        // No clipping
+        y1 = y;
+        y2 = y+dh-1;
+    }
+    else if ((y < 0) && (y+dh < scrh)) {
+        // Top clip
+        y1 = 0;
+        y2 = y+dh-1;
+        *oy = (int) (((float) (sh * -y)) / ((float) dh) + 0.5);
+    }
+    else if ((y >= 0) && (y+dh >= scrh)) {
+        // Bottom clip
+        y1 = y;
+        y2 = scrh-1;
+    }
+    else { // if (y < 0) && (y+dh >= scrh)
+        // Top and bottom clip
+        y1 = 0;
+        y2 = scrh-1;
+        *oy = (int) (((float) (sh * -y)) / ((float) dh) + 0.5);
+    }
+
+    // Horizontal clipping
+
+    if ((x >= 0) && (x+dw < scrw)) {
+        // No clipping
+        x1 = x;
+        x2 = x+dw-1;
+    }
+    else if ((x < 0) && (x+dw < scrw)) {
+        // Left clip
+        x1 = 0;
+        x2 = x+dw-1;
+        *ox = (int) (((float) (sw * -x)) / ((float) dw) + 0.5);
+    }
+    else if ((x >= 0) && (x+dw >= scrw)) {
+        // Right clip
+        x1 = x;
+        x2 = scrw-1;
+    }
+    else { // if (x < 0) && (x+dw >= scrw)
+        // Left and right clip
+        x1 = 0;
+        x2 = scrw-1;
+        *ox = (int) (((float) (sw * -x)) / ((float) dw) + 0.5);
+    }
+
+    *win_start = (x1 << 16) | y1;
+    *win_end = (x2 << 16) | y2;
+
+    // For testing the clipping
+    //*win_start = ((x1+50) << 16) | (y1+50);
+    //*win_end = ((x2+50) << 16) | (y2+50);
+}
+
+
+/**
+ * Map overlay buffer address.
+ *
+ * @param format    pixel format
+ * @param buf       Framebuffer address of surface (0 = start of framebuffer)
+ * @param ox        leftmost pixel to show (used when clipping, else set to zero)
+ * @param oy        topmost pixel to show (used when clipping, else set to zero)
+ * @param w         total surface width (does *not* depend on the x parameter)
+ * @param h         total surface height (does *not* depend on the y parameter)
+ * @param pitch     source surface pitch (bytes per pixel)
+ *
+ * @param y_start   will hold start address of Y(UV) or RGB buffer
+ * @param u_start   will hold start address of Cb buffer (planar modes only)
+ * @param v_start   will hold start address of Cr buffer (planar modes only)
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c,
+ *       DDOver_GetSrcStartAddress() and DDOVer_GetYCbCrStartAddress()
+ */
+void uc_ovl_map_buffer(DFBSurfacePixelFormat format, u32 buf,
+                       int ox, int oy, int sw, int sh, int sp, int field,
+                       u32* y_start, u32* u_start, u32* v_start)
+{
+    int swap_cb_cr = 0;
+
+    u32 tmp;
+    u32 y_offset, uv_offset = 0;
+
+    switch (format) {
+
+    case DSPF_YUY2:
+    case DSPF_UYVY:
+        y_offset = ((oy * sp) + ((ox << 1) & ~15));
+        break;
+
+    case DSPF_YV12:
+        swap_cb_cr = 1;
+    case DSPF_I420:
+        y_offset = ((((oy & ~3) * sp) + ox) & ~31) ;
+        if (oy > 0)
+            uv_offset = (((((oy & ~3) >> 1) * sp) + ox) & ~31) >> 1;
+        else
+            uv_offset = y_offset >> 1;
+        break;
+
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+        y_offset = (oy * sp) + ((ox * 16) >> 3);
+        break;
+
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        y_offset = (oy * sp) + ((ox * 32) >> 3);
+        break;
+
+    default:
+        y_offset = 0;
+        uv_offset = 0;
+        D_BUG("Unexpected pixelformat!");
+    }
+
+    if (field) {
+         y_offset  += sp;
+         uv_offset += sp >> 1;
+    }
+
+    *y_start = buf + y_offset;
+
+    if (u_start && v_start) {
+        *u_start = buf + sp * sh + uv_offset;
+        *v_start = buf + sp * sh + sp * (sh >> 2) + uv_offset;
+
+        if (swap_cb_cr) {
+            tmp = *u_start;
+            *u_start = *v_start;
+            *v_start = tmp;
+        }
+    }
+}
+
+
+/**
+ * Map alpha mode and opacity.
+ *
+ * @param opacity   Alpha opacity: 0 = transparent, 255 = opaque.
+ *                  -1 = Use alpha from underlying graphics.
+ *
+ * @returns alpha control register setting.
+ *
+ * @note: Unfortunately, if using alpha from underlying graphics,
+ *        the video is opaque if alpha = 255 and transparent if = 0.
+ *        The inverse would have made more sense ...
+ *
+ * @note: The hardware supports a separate alpha plane as well,
+ *        but it is not implemented here.
+ *
+ * @note: Derived from ddmpeg.c, VIAAlphaWin()
+ */
+
+u32 uc_ovl_map_alpha(int opacity)
+{
+    u32 ctrl = 0x00080000;      // Not sure what this number is, supposedly
+                                // it is the "expire number divided by 4".
+
+    if (opacity > 255) opacity = 255;
+
+    if (opacity < 0) {
+        ctrl |= ALPHA_WIN_BLENDING_GRAPHIC;
+    }
+    else {
+        opacity = opacity >> 4; // Throw away bits 0 - 3
+        ctrl |= (opacity << 12) | ALPHA_WIN_BLENDING_CONSTANT;
+    }
+
+    return ctrl; // V_ALPHA_CONTROL
+}
+
+/**
+ * Calculate V1 control and fifo-control register values
+ * @param format        pixel format
+ * @param sw            source width
+ * @param hwrev         CLE266 hardware revision
+ * @param extfifo_on    set this true if the extended FIFO is enabled
+ * @param control       will hold value for V1_CONTROL
+ * @param fifo          will hold value for V1_FIFO_CONTROL
+ */
+void uc_ovl_map_v1_control(DFBSurfacePixelFormat format, int sw,
+                           int hwrev, bool extfifo_on,
+                           u32* control, u32* fifo)
+{
+    *control = V1_BOB_ENABLE | V1_ENABLE | uc_ovl_map_format(format);
+
+    if (hwrev == 0x10) {
+        *control |= V1_EXPIRE_NUM_F;
+    }
+    else {
+        if (extfifo_on) {
+            *control |= V1_EXPIRE_NUM_A | V1_FIFO_EXTENDED;
+        }
+        else {
+            *control |= V1_EXPIRE_NUM;
+        }
+    }
+
+    if ((format == DSPF_YV12) || (format == DSPF_I420)) {
+        //Minified video will be skewed without this workaround.
+        if (sw <= 80) { //Fetch count <= 5
+            *fifo = UC_MAP_V1_FIFO_CONTROL(16,0,0);
+        }
+        else {
+            if (hwrev == 0x10)
+                *fifo = UC_MAP_V1_FIFO_CONTROL(64,56,56);
+            else
+                *fifo = UC_MAP_V1_FIFO_CONTROL(16,12,8);
+        }
+    }
+    else {
+        if (hwrev == 0x10) {
+            *fifo = UC_MAP_V1_FIFO_CONTROL(64,56,56);   // Default rev 0x10
+        }
+        else {
+            if (extfifo_on)
+                *fifo = UC_MAP_V1_FIFO_CONTROL(48,40,40);
+            else
+                *fifo = UC_MAP_V1_FIFO_CONTROL(32,29,16);   // Default
+        }
+    }
+}
+
+/** uc_ovl_map_adjustment() helper - clamp x to [lo, hi] */
+static float clamp(float x, float lo, float hi)
+{
+    return (x < lo) ? lo : ((x > hi) ? hi : x); /* 2 nested if's. */
+}
+
+/**
+ * uc_ovl_map_adjustment() helper - format x for the hardware.
+ *
+ * @param x     The value to format.
+ * @param ndec  Number of binary decimals.
+ * @param sbit  sign bit position.
+ *              =0: use two's complement representation
+ *              >0: use a sign bit + positive value.
+ * @param mask  Bitmask
+ * @param shift Position in hardware register.
+ */
+static int fmt(float x, int ndec, int sbit, u32 mask, int shift)
+{
+    int y = (x * (1 << ndec));
+    if (sbit && (y < 0)) y = -y | (1 << sbit);
+    return (((u32) y) & mask) << shift;
+}
+
+/**
+ * Map color adjustment to CLE266 hardware.
+ *
+ * @param adj   DirectFB color adjustment. All fields are assumed valid.
+ * @param a1    Will hold value for V1_ColorSpaceReg_1
+ * @param a2    Will hold value for V1_ColorSpaceReg_2
+ */
+void uc_ovl_map_adjustment(DFBColorAdjustment* adj, u32* a1, u32* a2)
+{
+    float con, sat, bri, hue;
+    float c, s;
+    float A, B1, C1, D, B2, C2, B3, C3;
+
+    // Map contrast to [0, 2.0] (preferred: [0, 1.66]), default: 1.0.
+    con = (float) adj->contrast / 32768.0;
+    // Map saturation to [0, 2.0], default: 1.0.
+    sat = (float) adj->saturation / 32768.0;
+    // Map brightness to [-121, 125], (preferred: [-94, 125.1]), default: 3.97.
+    bri = (float) (adj->brightness - 31696) / 270.48;
+    // Map hue to [-pi, pi], default is 0.0.
+    hue = (float) (adj->hue - 32768) / 10430.378;
+    // Note: The limits are estimates that need testing.
+
+    // Map parameters to hw registers.
+
+    s = sin(hue) * con * sat;
+    c = cos(hue) * con * sat;
+
+    A = clamp(1.164*con, 0, 1.9375);
+    B1 = clamp(-1.596*s, -0.75, 0.75);
+    C1 = clamp(1.596*c, 1, 2.875);
+    B2 = clamp( (0.813*s - 0.391*c), 0, -0.875);
+    C2 = clamp(-(0.813*c + 0.391*s), 0, -1.875);
+    B3 = clamp(2.018*c, 0, 3.75);
+    C3 = clamp(2.018*s, -1.25, 1.25);
+    D = clamp(1.164*(bri-16), -128, 127);
+
+    *a1 =
+        fmt(A,  4, 0, 0x1f, 24) | fmt(B1, 2, 2, 0x07, 18) |
+        fmt(C1, 3, 0, 0x1f,  9) | fmt(D,  0, 0, 0xff,  0);
+
+    *a2 =
+        fmt(B2, 3, 4, 0x7, 25) | fmt(C2, 3, 4, 0xf, 17) |
+        fmt(B3, 2, 0, 0xf, 10) | fmt(C3, 2, 3, 0xf,  2);
+}
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwset.c b/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwset.c
new file mode 100755
index 0000000..e8ba755
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_ovl_hwset.c
@@ -0,0 +1,266 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <sys/io.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+#include <direct/messages.h>
+
+#include <core/system.h>
+
+/**
+ * Set up the extended video FIFO.
+ * @note It will be turned on if ucovl->scrwidth > 1024.
+ */
+
+void uc_ovl_setup_fifo(UcOverlayData* ucovl, int scrwidth)
+{
+     u8* mclk_save = ucovl->mclk_save;
+
+     if (!iopl(3)) {
+          if (scrwidth <= 1024) { // Disable
+               if (ucovl->extfifo_on) {
+
+                    dfb_layer_wait_vsync(dfb_layer_at(DLID_PRIMARY));
+
+                    outb(0x16, 0x3c4); outb(mclk_save[0], 0x3c5);
+                    outb(0x17, 0x3c4); outb(mclk_save[1], 0x3c5);
+                    outb(0x18, 0x3c4); outb(mclk_save[2], 0x3c5);
+                    ucovl->extfifo_on = false;
+               }
+          }
+          else { // Enable
+               if (!ucovl->extfifo_on) {
+
+                    dfb_layer_wait_vsync(dfb_layer_at(DLID_PRIMARY));
+
+                    // Save current setting
+                    outb(0x16, 0x3c4); mclk_save[0] = inb(0x3c5);
+                    outb(0x17, 0x3c4); mclk_save[1] = inb(0x3c5);
+                    outb(0x18, 0x3c4); mclk_save[2] = inb(0x3c5);
+                    // Enable extended FIFO
+                    outb(0x17, 0x3c4); outb(0x2f, 0x3c5);
+                    outb(0x16, 0x3c4); outb((mclk_save[0] & 0xf0) | 0x14, 0x3c5);
+                    outb(0x18, 0x3c4); outb(0x56, 0x3c5);
+                    ucovl->extfifo_on = true;
+               }
+          }
+     }
+     else {
+          printf("cle266: could set io perissons\n");
+     }
+     ucovl->scrwidth = scrwidth;
+}
+
+void uc_ovl_vcmd_wait(volatile u8* vio)
+{
+     while ((VIDEO_IN(vio, V_COMPOSE_MODE)
+             & (V1_COMMAND_FIRE | V3_COMMAND_FIRE)));
+}
+
+/**
+ * Update the video overlay.
+ *
+ * @param action        = UC_OVL_CHANGE: update everything
+ *                      = UC_OVL_FLIP: only flip to the front surface buffer.
+ * @param surface       source surface
+ *
+ * @note: Derived from ddmpeg.c, Upd_Video()
+ */
+
+DFBResult uc_ovl_update(UcDriverData* ucdrv,
+                        UcOverlayData* ucovl,
+                        int action,
+                        CoreSurface* surface,
+                        CoreSurfaceBufferLock* lock)
+{
+     int sw, sh, sp, sfmt;   // Source width, height, pitch and format
+     int dx, dy;             // Destination position
+     int dw, dh;             // Destination width and height
+     VideoMode *videomode;
+     DFBRectangle scr;       // Screen size
+
+     bool write_buffers = false;
+     bool write_settings = false;
+
+     volatile u8* vio = ucdrv->hwregs;
+
+     u32 win_start, win_end;     // Overlay register settings
+     u32 zoom, mini;
+     u32 dcount, falign, qwpitch;
+     u32 y_start, u_start, v_start;
+     u32 v_ctrl, fifo_ctrl;
+
+     int offset = lock->offset;
+
+
+     if (!ucovl->v1.isenabled) return DFB_OK;
+
+     qwpitch = 0;
+
+     // Get screen size
+     videomode = dfb_system_current_mode();
+     scr.w = videomode ? videomode->xres : 720;
+     scr.h = videomode ? videomode->yres : 576;
+     scr.x = 0;
+     scr.y = 0;
+
+     if (ucovl->scrwidth != scr.w) {
+          // FIXME: fix uc_ovl_setup_fifo()
+          //    uc_ovl_setup_fifo(ucovl, scr.w);
+          action |= UC_OVL_CHANGE;
+     }
+
+     D_ASSERT(surface);
+
+     sw = surface->config.size.w;
+     sh = surface->config.size.h;
+     sp = lock->pitch;
+     sfmt = surface->config.format;
+
+     if (ucovl->deinterlace) {
+          /*if (ucovl->field)
+               offset += sp;*/
+
+          sh /= 2;
+          //sp *= 2;
+     }
+
+     if (action & UC_OVL_CHANGE) {
+
+          if ((sw > 4096) || (sh > 4096) ||
+              (sw < 32) || (sh < 1) || (sp > 0x1fff)) {
+               D_DEBUG("Layer surface size is out of bounds.");
+               return DFB_INVAREA;
+          }
+
+          dx = ucovl->v1.win.x;
+          dy = ucovl->v1.win.y;
+          dw = ucovl->v1.win.w;
+          dh = ucovl->v1.win.h;
+
+          // Get image format, FIFO size, etc.
+
+          uc_ovl_map_v1_control(sfmt, sw, ucovl->hwrev, ucovl->extfifo_on,
+                                &v_ctrl, &fifo_ctrl);
+
+          if (ucovl->deinterlace) {
+               v_ctrl |= /*V1_BOB_ENABLE |*/ V1_FRAME_BASE;
+          }
+
+          // Get layer window.
+          // The parts that fall outside the screen are clipped.
+
+          uc_ovl_map_window(scr.w, scr.h, &(ucovl->v1.win), sw, sh,
+                            &win_start, &win_end, &ucovl->v1.ox, &ucovl->v1.oy);
+
+          // Get scaling and data-fetch parameters
+
+          // Note: the *_map_?zoom() functions return false if the scaling
+          // is out of bounds. We don't act on it for now, because it only
+          // makes the display look strange.
+
+          zoom = 0;
+          mini = 0;
+
+          uc_ovl_map_vzoom(sh, dh, &zoom, &mini);
+          uc_ovl_map_hzoom(sw, dw, &zoom, &mini, &falign, &dcount);
+          qwpitch = uc_ovl_map_qwpitch(falign, sfmt, sw);
+
+          write_settings = true;
+     }
+
+     if (action & (UC_OVL_FIELD | UC_OVL_FLIP | UC_OVL_CHANGE)) {
+          int field = 0;
+          // Update the buffer pointers
+
+          if (ucovl->deinterlace) {
+               field = ucovl->field;
+          }
+
+          uc_ovl_map_buffer(sfmt, offset,
+                            ucovl->v1.ox, ucovl->v1.oy, sw, surface->config.size.h, sp, 0/*field*/, &y_start,
+                            &u_start, &v_start);
+
+          if (field) {
+               y_start |= 0x08000000;
+          }
+
+          write_buffers = true;
+     }
+
+     // Write to the hardware
+
+/*    if (write_settings || write_buffers)
+        uc_ovl_vcmd_wait(vio);*/
+
+     if (write_settings) {
+
+          VIDEO_OUT(vio, V1_CONTROL, v_ctrl);
+          VIDEO_OUT(vio, V_FIFO_CONTROL, fifo_ctrl);
+
+          VIDEO_OUT(vio, V1_WIN_START_Y, win_start);
+          VIDEO_OUT(vio, V1_WIN_END_Y, win_end);
+
+          VIDEO_OUT(vio, V1_SOURCE_HEIGHT, (sh << 16) | dcount);
+          VIDEO_OUT(vio, V12_QWORD_PER_LINE, qwpitch);
+          VIDEO_OUT(vio, V1_STRIDE, sp | ((sp >> 1) << 16));
+
+          VIDEO_OUT(vio, V1_MINI_CONTROL, mini);
+          VIDEO_OUT(vio, V1_ZOOM_CONTROL, zoom);
+     }
+
+     if (write_buffers) {
+
+          VIDEO_OUT(vio, V1_STARTADDR_0, y_start);
+          VIDEO_OUT(vio, V1_STARTADDR_CB0, u_start);
+          VIDEO_OUT(vio, V1_STARTADDR_CR0, v_start);
+     }
+
+     if (write_settings || write_buffers) {
+          VIDEO_OUT(vio, V_COMPOSE_MODE, V1_COMMAND_FIRE);
+     }
+
+     return DFB_OK;
+}
+
+DFBResult uc_ovl_set_adjustment(CoreLayer            *layer,
+                                void                 *driver_data,
+                                void                 *layer_data,
+                                DFBColorAdjustment   *adj)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    DFBColorAdjustment* ucadj;
+    u32 a1, a2;
+
+    ucadj = &ucovl->v1.adj;
+
+    if (adj->flags & DCAF_BRIGHTNESS)
+        ucadj->brightness = adj->brightness;
+    if (adj->flags & DCAF_CONTRAST)
+        ucadj->contrast = adj->contrast;
+    if (adj->flags & DCAF_HUE)
+        ucadj->hue = adj->hue;
+    if (adj->flags & DCAF_SATURATION)
+        ucadj->saturation = adj->saturation;
+
+    uc_ovl_map_adjustment(ucadj, &a1, &a2);
+
+    VIDEO_OUT(ucdrv->hwregs, V1_ColorSpaceReg_1, a1);
+    VIDEO_OUT(ucdrv->hwregs, V1_ColorSpaceReg_2, a2);
+
+    return DFB_OK;
+}
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_primary.c b/Source/DirectFB/gfxdrivers/cle266/uc_primary.c
new file mode 100755
index 0000000..d0d0fe9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_primary.c
@@ -0,0 +1,176 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <stdio.h>
+
+#include <directfb.h>
+
+#include <core/layers.h>
+
+#include <misc/conf.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+/* primary layer hooks */
+
+#define OSD_OPTIONS      (DLOP_ALPHACHANNEL | DLOP_SRC_COLORKEY | DLOP_OPACITY)
+
+DisplayLayerFuncs  ucOldPrimaryFuncs;
+void              *ucOldPrimaryDriverData;
+
+static DFBResult
+osdInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     DFBResult ret;
+
+     /* call the original initialization function first */
+     ret = ucOldPrimaryFuncs.InitLayer( layer,
+                                        ucOldPrimaryDriverData,
+                                        layer_data, description,
+                                        config, adjustment );
+     if (ret)
+          return ret;
+
+     /* set name */
+     snprintf(description->name,
+              DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VIA CLE266 Graphics");
+
+     /* add support for options */
+     config->flags |= DLCONF_OPTIONS;
+
+     config->pixelformat = dfb_config->mode.format ?
+                           dfb_config->mode.format : DSPF_ARGB;
+     config->options = DLOP_ALPHACHANNEL;
+
+     /* add some capabilities */
+     description->caps |= DLCAPS_ALPHACHANNEL |
+                          DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY;
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     DFBResult                  ret;
+     CoreLayerRegionConfigFlags fail = 0;
+     DFBDisplayLayerOptions     options = config->options;
+
+     /* remove options before calling the original function */
+     config->options = DLOP_NONE;
+
+     /* call the original function */
+     ret = ucOldPrimaryFuncs.TestRegion( layer, ucOldPrimaryDriverData,
+                                         layer_data, config, &fail );
+
+     /* check options if specified */
+     if (options) {
+          /* any unsupported option wanted? */
+          if (options & ~OSD_OPTIONS)
+               fail |= CLRCF_OPTIONS;
+
+          /* opacity and alpha channel cannot be used at once */
+          if ((options & (DLOP_OPACITY | DLOP_ALPHACHANNEL)) ==
+              (DLOP_OPACITY | DLOP_ALPHACHANNEL))
+          {
+               fail |= CLRCF_OPTIONS;
+          }
+     }
+
+     /* restore options */
+     config->options = options;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return ret;
+}
+
+static DFBResult
+osdSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     DFBResult     ret;
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+
+     /* call the original function */
+     ret = ucOldPrimaryFuncs.SetRegion( layer, ucOldPrimaryDriverData,
+                                        layer_data, region_data,
+                                        config, updated, surface,
+                                        palette, lock );
+     if (ret)
+          return ret;
+
+     uc_ovl_vcmd_wait(ucdrv->hwregs);
+
+     /* select pixel based or global alpha */
+
+     if (config->options & DLOP_ALPHACHANNEL)
+          VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL, uc_ovl_map_alpha(-1));
+     else if (config->options & DLOP_OPACITY)
+          VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL, uc_ovl_map_alpha(config->opacity));
+     else
+          VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL, uc_ovl_map_alpha(0xff));
+
+     VIDEO_OUT(ucdrv->hwregs, V_COMPOSE_MODE, V1_COMMAND_FIRE);
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs ucPrimaryFuncs = {
+     .InitLayer  = osdInitLayer,
+
+     .TestRegion = osdTestRegion,
+     .SetRegion  = osdSetRegion,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_state.c b/Source/DirectFB/gfxdrivers/cle266/uc_state.c
new file mode 100755
index 0000000..7ac74e9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_state.c
@@ -0,0 +1,269 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <gfx/convert.h>
+#include "unichrome.h"
+#include "uc_state.h"
+#include "uc_accel.h"
+#include "uc_hw.h"
+
+enum uc_state_type {
+     UC_TYPE_UNSUPPORTED,
+     UC_TYPE_2D,
+     UC_TYPE_3D
+};
+
+/// GPU selecting functions --------------------------------------------------
+
+static inline bool
+uc_has_dst_format( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_has_src_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_A8:
+          case DSPF_LUT8:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline enum uc_state_type
+uc_select_drawtype( CardState* state,
+                    DFBAccelerationMask accel )
+{
+     if (!(state->drawingflags & ~UC_DRAWING_FLAGS_2D) &&
+         !(accel & DFXL_FILLTRIANGLE))
+          return UC_TYPE_2D;
+
+     if (!(state->drawingflags & ~UC_DRAWING_FLAGS_3D))
+          return UC_TYPE_3D;
+
+     return UC_TYPE_UNSUPPORTED;
+}
+
+static inline enum uc_state_type
+uc_select_blittype( CardState* state,
+                    DFBAccelerationMask accel )
+{
+     if (!(state->blittingflags & ~UC_BLITTING_FLAGS_2D)) {
+          if ((state->source->config.format == state->destination->config.format) &&
+              !((state->blittingflags & DSBLIT_SRC_COLORKEY) &&
+                (state->blittingflags & DSBLIT_DST_COLORKEY)) &&
+              !(accel & (DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES)))
+               return UC_TYPE_2D;
+     }
+
+     if (!(state->blittingflags & ~UC_BLITTING_FLAGS_3D)) {
+          if (uc_has_src_format_3d( state->source->config.format ))
+               return UC_TYPE_3D;
+     }
+
+     return UC_TYPE_UNSUPPORTED;
+}
+
+// DirectFB interfacing functions --------------------------------------------
+
+void uc_check_state(void *drv, void *dev,
+                    CardState *state, DFBAccelerationMask accel)
+{
+     /* Check destination format. */
+     if (!uc_has_dst_format( state->destination->config.format ))
+          return;
+
+     if (DFB_DRAWING_FUNCTION(accel)) {
+          /* Check drawing parameters. */
+          switch (uc_select_drawtype(state, accel)) {
+               case UC_TYPE_2D:
+                    state->accel |= UC_DRAWING_FUNCTIONS_2D;
+                    break;
+               case UC_TYPE_3D:
+                    state->accel |= UC_DRAWING_FUNCTIONS_3D;
+                    break;
+               default:
+                    return;
+          }
+     }
+     else {
+          /* Check blitting parameters. */
+          switch (uc_select_blittype(state, accel)) {
+               case UC_TYPE_2D:
+                    state->accel |= UC_BLITTING_FUNCTIONS_2D;
+                    break;
+               case UC_TYPE_3D:
+                    state->accel |= UC_BLITTING_FUNCTIONS_3D;
+                    break;
+               default:
+                    return;
+          }
+     }
+}
+
+void uc_set_state(void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                  CardState *state, DFBAccelerationMask accel)
+{
+     UcDriverData   *ucdrv = (UcDriverData*) drv;
+     UcDeviceData   *ucdev = (UcDeviceData*) dev;
+     struct uc_fifo *fifo  = ucdrv->fifo;
+
+     u32 rop3d     = HC_HROP_P;
+     u32 regEnable = HC_HenCW_MASK | HC_HenAW_MASK;
+
+     StateModificationFlags modified = state->mod_hw;
+
+     // Check modified states and update hw
+
+     if (modified & SMF_SOURCE)
+          UC_INVALIDATE( uc_source2d );
+
+     if (modified & (SMF_BLITTING_FLAGS | SMF_SOURCE))
+          UC_INVALIDATE( uc_source3d | uc_texenv );
+
+     if (modified & (SMF_BLITTING_FLAGS | SMF_SRC_COLORKEY | SMF_DST_COLORKEY))
+          UC_INVALIDATE( uc_colorkey2d );
+
+     if (modified & (SMF_COLOR | SMF_DESTINATION | SMF_DRAWING_FLAGS))
+          UC_INVALIDATE( uc_color2d );
+
+     if (modified & (SMF_SRC_BLEND | SMF_DST_BLEND))
+          UC_INVALIDATE( uc_blending_fn );
+
+
+     if (modified & SMF_COLOR)
+          ucdev->color3d = PIXEL_ARGB( state->color.a, state->color.r,
+                                       state->color.g, state->color.b );
+
+     if (modified & SMF_DRAWING_FLAGS) {
+          if (state->drawingflags & DSDRAW_XOR) {
+               ucdev->draw_rop3d = HC_HROP_DPx;
+               ucdev->draw_rop2d = VIA_ROP_DPx;
+          }
+          else {
+               ucdev->draw_rop3d = HC_HROP_P;
+               ucdev->draw_rop2d = VIA_ROP_P;
+          }
+     }
+
+     ucdev->bflags = state->blittingflags;
+
+     if (modified & SMF_DESTINATION)
+          uc_set_destination(ucdrv, ucdev, state);
+
+     if (modified & SMF_CLIP)
+          uc_set_clip(ucdrv, ucdev, state);
+
+
+     // Select GPU and check remaining states
+
+     if (DFB_DRAWING_FUNCTION(accel)) {
+
+          switch (uc_select_drawtype(state, accel)) {
+               case UC_TYPE_2D:
+                    funcs->FillRectangle = uc_fill_rectangle;
+                    funcs->DrawRectangle = uc_draw_rectangle;
+                    funcs->DrawLine = uc_draw_line;
+
+                    uc_set_color_2d(ucdrv, ucdev, state);
+
+                    state->set = UC_DRAWING_FUNCTIONS_2D;
+                    break;
+
+               case UC_TYPE_3D:
+                    funcs->FillRectangle = uc_fill_rectangle_3d;
+                    funcs->DrawRectangle = uc_draw_rectangle_3d;
+                    funcs->DrawLine = uc_draw_line_3d;
+
+                    if (state->drawingflags & DSDRAW_BLEND) {
+                         uc_set_blending_fn(ucdrv, ucdev, state);
+                         regEnable |= HC_HenABL_MASK;
+                    }
+
+                    rop3d = ucdev->draw_rop3d;
+
+                    state->set = UC_DRAWING_FUNCTIONS_3D;
+                    break;
+
+               case UC_TYPE_UNSUPPORTED:
+                    D_BUG("Unsupported drawing function!");
+                    break;
+          }
+     }
+     else { // DFB_BLITTING_FUNCTION(accel)
+          switch (uc_select_blittype(state, accel)) {
+               case UC_TYPE_2D:
+                    uc_set_source_2d(ucdrv, ucdev, state);
+                    funcs->Blit = uc_blit;
+
+                    uc_set_colorkey_2d(ucdrv, ucdev, state);
+                    state->set = UC_BLITTING_FUNCTIONS_2D;
+                    break;
+
+               case UC_TYPE_3D:
+                    funcs->Blit = uc_blit_3d;
+                    uc_set_source_3d(ucdrv, ucdev, state);
+                    uc_set_texenv(ucdrv, ucdev, state);
+                    uc_set_blending_fn(ucdrv, ucdev, state);
+
+                    regEnable |= HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK | HC_HenDT_MASK;
+
+                    if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                                DSBLIT_BLEND_COLORALPHA))
+                         regEnable |= HC_HenABL_MASK;
+
+                    state->set = UC_BLITTING_FUNCTIONS_3D;
+                    break;
+
+               case UC_TYPE_UNSUPPORTED:
+                    D_BUG("Unsupported drawing function!");
+                    break;
+          }
+     }
+
+#ifdef UC_ENABLE_3D
+     UC_FIFO_PREPARE( fifo, 6 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     /* Don't know what this does. DRI code always clears it. */
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HPixGC,   0 );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HEnable,  regEnable );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HFBBMSKL, 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HROP,     rop3d | 0xff );
+#endif
+
+     UC_FIFO_CHECK(fifo);
+
+     state->mod_hw = 0;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/cle266/uc_state.h b/Source/DirectFB/gfxdrivers/cle266/uc_state.h
new file mode 100755
index 0000000..a3e7484
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/uc_state.h
@@ -0,0 +1,68 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_STATE__
+#define __UC_STATE__
+
+#include <directfb.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+void uc_set_state(void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                  CardState *state, DFBAccelerationMask accel);
+void uc_check_state(void *drv, void *dev,
+                    CardState *state, DFBAccelerationMask accel);
+
+
+
+/*
+struct uc_hw_misc
+{
+    // These control clipping...
+
+    u32 regHClipTB;
+    u32 regHClipLR;
+    u32 regHFPClipTL;
+    u32 regHFPClipBL;
+    u32 regHFPClipLL;
+    u32 regHFPClipRL;
+    u32 regHFPClipTBH;
+    u32 regHFPClipLRH;
+
+    // Other functions
+
+    u32 regHLP;             // Line stipple pattern
+    u32 regHLPRF;           // Line stipple factor
+    u32 regHSolidCL;        // --- Don't know. Unused in DRI.
+    u32 regHPixGC;          // Don't know. Is kept cleared in DRI.
+    //u32 regHSPXYOS;       // Polygon stipple x and y offsets. Unused here.
+    u32 regHVertexCNT;      // --- Don't know. Unused in DRI.
+
+    u8 ps_xos;              // Polygon stipple x-offset. => regHSPXYOS
+    u8 ps_yos;              // Polygon stipple y-offset. => regHSPXYOS
+    u32 ps_pat[32];         // Polygon stipple pattern buffer.
+                            // These are not registers...
+};
+
+
+/// Stencil control.
+
+struct uc_hw_stencil
+{
+    //u32 regHSBBasL;       // These aren't in regs3d.h, but they should exist...
+    //u32 regHSBBasH;
+    //u32 regHSBFM;
+
+    u32 regHSTREF;          // Stencil reference value and plane mask
+    u32 regHSTMD;           // Stencil test function and fail operation and
+                            // zpass/zfail operations.
+};
+*/
+
+#endif // __UC_STATE__
diff --git a/Source/DirectFB/gfxdrivers/cle266/unichrome.c b/Source/DirectFB/gfxdrivers/cle266/unichrome.c
new file mode 100755
index 0000000..7dbb8bc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/unichrome.c
@@ -0,0 +1,548 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+
+/*
+
+EPIA-M benchmarks (df_dok)
+
+                              SW    v0.0.1  v0.1.0 v0.2.0     v0.3
+
+Anti-aliased Text            98.97    -       -       -     280.80  KChars/sec
+Anti-aliased Text (blend)    28.85    -       -       -     280.61  KChars/sec
+Fill Rectangles              25.21  443.46  437.05  432.39  435.60  Mpixel/sec
+Fill Rectangles (blend)       5.54    -     130.12  128.42  127.82  MPixel/sec
+Fill Triangles               24.84  173.44  129.76  127.86  128.63  MPixel/sec
+Fill Triangles (blend)        5.46    -     129.81  127.86  128.67  MPixel/sec
+Draw Rectangles              11.82  58.98    59.07   52.48   55.10  KRects/sec
+Draw Rectangles (blend)       1.98    -      32.13   22.76   23.50  KRects/sec
+Draw Lines                   42.67  283.81  292.33  193.87  203.20  KLines/sec
+Draw Lines (blend)            8.54    -     142.62  101.23  102.80  KLines/sec
+Blit                         21.48    -     117.38  114.26  114.41  MPixel/sec
+Blit colorkeyed              22.54    -     117.34  114.26  114.41  MPixel/sec
+Blit w/ format conversion    16.22    -       -     103.41  103.00  MPixel/sec
+Blit from 32bit (blend)       4.19    -       -      87.72   87.32  MPixel/sec
+Blit from 8bit palette       11.02    -       -     110.13  113.37  MPixel/sec
+Blit from 8bit pal. (blend)   3.78    -       -     110.20  113.40  MPixel/sec
+Stretch Blit                 23.19    -       -      99.53   99.32  MPixel/sec
+Stretch Blit colorkeyed      25.04    -       -       5.00   38.00  MPixel/sec
+
+
+Comparing M9000 and M10000
+
+v0.2.0                         M9000  M10000
+
+Anti-aliased Text               -       -     KChars/sec
+Anti-aliased Text (blend)       -       -     KChars/sec
+Fill Rectangles               401.82  432.39  Mpixel/sec
+Fill Rectangles (blend)       129.05  128.42  MPixel/sec
+Fill Triangles                128.46  127.86  MPixel/sec
+Fill Triangles (blend)        128.46  127.86  MPixel/sec
+Draw Rectangles                55.51   52.48  KRects/sec
+Draw Rectangles (blend)        26.90   22.76  KRects/sec
+Draw Lines                    225.00  193.87  KLines/sec
+Draw Lines (blend)            121.29  101.23  KLines/sec
+Blit                          112.36  114.26  MPixel/sec
+Blit colorkeyed               112.28  114.26  MPixel/sec
+Blit w/ format conversion     103.92  103.41  MPixel/sec
+Blit from 32bit (blend)        87.89   87.72  MPixel/sec
+Blit from 8bit palette        110.56  110.13  MPixel/sec
+Blit from 8bit pal. (blend)   110.56  110.20  MPixel/sec
+Stretch Blit                  108.67   99.53  MPixel/sec
+Stretch Blit colorkeyed         4.79    5.00  MPixel/sec
+
+
+v0.0.1 and v0.1.0 are tested on an EPIA-M9000,
+later versions on an EPIA-M10000.
+
+*/
+
+// DirectFB headers
+
+#include <config.h>
+
+#include <directfb.h>
+
+#include <fusion/shmalloc.h>
+
+#include <direct/messages.h>
+
+#include <core/coretypes.h>
+#include <core/core.h>
+#include <core/gfxcard.h>
+#include <core/graphics_driver.h>
+#include <core/system.h>
+#include <core/screens.h>
+
+#include <fbdev/fb.h>
+
+// System headers
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <string.h>
+
+// Driver headers
+
+#include "unichrome.h"
+#include "uc_state.h"
+#include "uc_accel.h"
+#include "uc_fifo.h"
+#include "mmio.h"
+
+#ifndef FB_ACCEL_VIA_UNICHROME
+#define FB_ACCEL_VIA_UNICHROME 77
+#endif
+
+extern DisplayLayerFuncs ucOverlayFuncs;
+extern DisplayLayerFuncs ucPrimaryFuncs;
+
+extern DisplayLayerFuncs  ucOldPrimaryFuncs;
+extern void              *ucOldPrimaryDriverData;
+
+DFB_GRAPHICS_DRIVER(cle266)
+
+//----------
+
+
+/**
+ * Dump beginning of virtual queue.
+ * Use it to check that the VQ actually is in use. */
+#if 0
+static void uc_dump_vq(UcDeviceData *ucdev)
+{
+     int i;
+     u8* vq;
+
+     if (!ucdev->vq_start) return;
+     vq = dfb_system_video_memory_virtual(ucdev->vq_start);
+
+     for (i = 0; i < 128; i++) {
+          printf("%02x ", *(vq+i));
+          if ((i+1) % 16 == 0) printf("\n");
+     }
+}
+#endif
+
+/** Allocate memory for the virtual queue. */
+
+static DFBResult uc_alloc_vq(CoreGraphicsDevice *device, UcDeviceData *ucdev)
+{
+     if (ucdev->vq_start) return DFB_OK;
+
+     ucdev->vq_size = 256*1024; // 256kb
+     ucdev->vq_start = dfb_gfxcard_reserve_memory( device, ucdev->vq_size );
+
+     if (!ucdev->vq_start)
+          return DFB_INIT;
+
+     ucdev->vq_end = ucdev->vq_start + ucdev->vq_size - 1;
+
+     // Debug: clear buffer
+     memset((void *) dfb_system_video_memory_virtual(ucdev->vq_start),
+            0xcc, ucdev->vq_size);
+
+     // uc_dump_vq(ucdev);
+
+     return DFB_OK;
+}
+
+/**
+ * Initialize the hardware.
+ * @param enable    enable VQ if true (else disable it.)
+ */
+
+static DFBResult uc_init_2d_engine(CoreGraphicsDevice *device, UcDeviceData *ucdev, UcDriverData *ucdrv, bool enable)
+{
+     DFBResult result = DFB_OK;
+     volatile u8* hwregs = ucdrv->hwregs;
+
+     // Init 2D engine registers to reset 2D engine
+
+     VIA_OUT(hwregs, 0x04, 0x0);
+     VIA_OUT(hwregs, 0x08, 0x0);
+     VIA_OUT(hwregs, 0x0c, 0x0);
+     VIA_OUT(hwregs, 0x10, 0x0);
+     VIA_OUT(hwregs, 0x14, 0x0);
+     VIA_OUT(hwregs, 0x18, 0x0);
+     VIA_OUT(hwregs, 0x1c, 0x0);
+     VIA_OUT(hwregs, 0x20, 0x0);
+     VIA_OUT(hwregs, 0x24, 0x0);
+     VIA_OUT(hwregs, 0x28, 0x0);
+     VIA_OUT(hwregs, 0x2c, 0x0);
+     VIA_OUT(hwregs, 0x30, 0x0);
+     VIA_OUT(hwregs, 0x34, 0x0);
+     VIA_OUT(hwregs, 0x38, 0x0);
+     VIA_OUT(hwregs, 0x3c, 0x0);
+     VIA_OUT(hwregs, 0x40, 0x0);
+
+     // Init AGP and VQ registers
+
+     VIA_OUT(hwregs, 0x43c, 0x00100000);
+     VIA_OUT(hwregs, 0x440, 0x00000000);
+     VIA_OUT(hwregs, 0x440, 0x00333004);
+     VIA_OUT(hwregs, 0x440, 0x60000000);
+     VIA_OUT(hwregs, 0x440, 0x61000000);
+     VIA_OUT(hwregs, 0x440, 0x62000000);
+     VIA_OUT(hwregs, 0x440, 0x63000000);
+     VIA_OUT(hwregs, 0x440, 0x64000000);
+     VIA_OUT(hwregs, 0x440, 0x7D000000);
+
+     VIA_OUT(hwregs, 0x43c, 0xfe020000);
+     VIA_OUT(hwregs, 0x440, 0x00000000);
+
+     if (enable) {
+          result = uc_alloc_vq(device,ucdev);
+          enable = (result == DFB_OK);
+     }
+
+     if (enable) { // Enable VQ
+
+          VIA_OUT(hwregs, 0x43c, 0x00fe0000);
+          VIA_OUT(hwregs, 0x440, 0x080003fe);
+          VIA_OUT(hwregs, 0x440, 0x0a00027c);
+          VIA_OUT(hwregs, 0x440, 0x0b000260);
+          VIA_OUT(hwregs, 0x440, 0x0c000274);
+          VIA_OUT(hwregs, 0x440, 0x0d000264);
+          VIA_OUT(hwregs, 0x440, 0x0e000000);
+          VIA_OUT(hwregs, 0x440, 0x0f000020);
+          VIA_OUT(hwregs, 0x440, 0x1000027e);
+          VIA_OUT(hwregs, 0x440, 0x110002fe);
+          VIA_OUT(hwregs, 0x440, 0x200f0060);
+
+          VIA_OUT(hwregs, 0x440, 0x00000006);
+          VIA_OUT(hwregs, 0x440, 0x40008c0f);
+          VIA_OUT(hwregs, 0x440, 0x44000000);
+          VIA_OUT(hwregs, 0x440, 0x45080c04);
+          VIA_OUT(hwregs, 0x440, 0x46800408);
+
+          VIA_OUT(hwregs, 0x440, 0x52000000 |
+                  ((ucdev->vq_start & 0xFF000000) >> 24) |
+                  ((ucdev->vq_end & 0xFF000000) >> 16));
+          VIA_OUT(hwregs, 0x440, 0x50000000 | (ucdev->vq_start & 0xFFFFFF));
+          VIA_OUT(hwregs, 0x440, 0x51000000 | (ucdev->vq_end & 0xFFFFFF));
+          VIA_OUT(hwregs, 0x440, 0x53000000 | (ucdev->vq_size >> 3));
+     }
+     else { // Disable VQ
+
+          VIA_OUT(hwregs, 0x43c, 0x00fe0000);
+          VIA_OUT(hwregs, 0x440, 0x00000004);
+          VIA_OUT(hwregs, 0x440, 0x40008c0f);
+          VIA_OUT(hwregs, 0x440, 0x44000000);
+          VIA_OUT(hwregs, 0x440, 0x45080c04);
+          VIA_OUT(hwregs, 0x440, 0x46800408);
+     }
+
+     return result;
+}
+
+static void uc_init_3d_engine(volatile u8* hwregs, int hwrev, bool init_all)
+{
+     u32 i;
+
+     if (init_all) {
+
+          // Clear NotTex registers (?)
+
+          VIA_OUT(hwregs, 0x43C, 0x00010000);
+          for (i = 0; i <= 0x7d; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+
+          // Clear texture unit 0 (?)
+
+          VIA_OUT(hwregs, 0x43C, 0x00020000);
+          for (i = 0; i <= 0x94; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+          VIA_OUT(hwregs, 0x440, 0x82400000);
+
+          // Clear texture unit 1 (?)
+
+          VIA_OUT(hwregs, 0x43C, 0x01020000);
+          for (i = 0; i <= 0x94; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+          VIA_OUT(hwregs, 0x440, 0x82400000);
+
+          // Clear general texture settings (?)
+
+          VIA_OUT(hwregs, 0x43C, 0xfe020000);
+          for (i = 0; i <= 0x03; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+
+          // Clear palette settings (?)
+
+          VIA_OUT(hwregs, 0x43C, 0x00030000);
+          for (i = 0; i <= 0xff; i++)
+               VIA_OUT(hwregs, 0x440, 0);
+
+          VIA_OUT(hwregs, 0x43C, 0x00100000);
+          VIA_OUT(hwregs, 0x440, 0x00333004);
+          VIA_OUT(hwregs, 0x440, 0x10000002);
+          VIA_OUT(hwregs, 0x440, 0x60000000);
+          VIA_OUT(hwregs, 0x440, 0x61000000);
+          VIA_OUT(hwregs, 0x440, 0x62000000);
+          VIA_OUT(hwregs, 0x440, 0x63000000);
+          VIA_OUT(hwregs, 0x440, 0x64000000);
+
+          VIA_OUT(hwregs, 0x43C, 0x00fe0000);
+
+          if (hwrev >= 3)
+               VIA_OUT(hwregs, 0x440,0x40008c0f);
+          else
+               VIA_OUT(hwregs, 0x440,0x4000800f);
+
+          VIA_OUT(hwregs, 0x440,0x44000000);
+          VIA_OUT(hwregs, 0x440,0x45080C04);
+          VIA_OUT(hwregs, 0x440,0x46800408);
+          VIA_OUT(hwregs, 0x440,0x50000000);
+          VIA_OUT(hwregs, 0x440,0x51000000);
+          VIA_OUT(hwregs, 0x440,0x52000000);
+          VIA_OUT(hwregs, 0x440,0x53000000);
+
+     }
+
+     VIA_OUT(hwregs, 0x43C,0x00fe0000);
+     VIA_OUT(hwregs, 0x440,0x08000001);
+     VIA_OUT(hwregs, 0x440,0x0A000183);
+     VIA_OUT(hwregs, 0x440,0x0B00019F);
+     VIA_OUT(hwregs, 0x440,0x0C00018B);
+     VIA_OUT(hwregs, 0x440,0x0D00019B);
+     VIA_OUT(hwregs, 0x440,0x0E000000);
+     VIA_OUT(hwregs, 0x440,0x0F000000);
+     VIA_OUT(hwregs, 0x440,0x10000000);
+     VIA_OUT(hwregs, 0x440,0x11000000);
+     VIA_OUT(hwregs, 0x440,0x20000000);
+}
+
+/** */
+
+static void uc_after_set_var(void* drv, void* dev)
+{
+     UcDriverData* ucdrv = (UcDriverData*) drv;
+
+     VGA_OUT8(ucdrv->hwregs, 0x3c4, 0x1a);
+     // Clear bit 6 in extended VGA register 0x1a to prevent system lockup.
+     VGA_OUT8(ucdrv->hwregs, 0x3c5, VGA_IN8(ucdrv->hwregs, 0x3c5) & 0xbf);
+     // Set bit 2, it might make a difference.
+     VGA_OUT8(ucdrv->hwregs, 0x3c5, VGA_IN8(ucdrv->hwregs, 0x3c5) | 0x4);
+}
+
+/** Wait until the engine is idle. */
+
+static DFBResult uc_engine_sync(void* drv, void* dev)
+{
+     UcDriverData* ucdrv = (UcDriverData*) drv;
+     UcDeviceData* ucdev = (UcDeviceData*) dev;
+
+     int loop = 0;
+
+/*    printf("Entering uc_engine_sync(), status is 0x%08x\n",
+        VIA_IN(ucdrv->hwregs, VIA_REG_STATUS));
+*/
+
+     while ((VIA_IN(ucdrv->hwregs, VIA_REG_STATUS) & 0xfffeffff) != 0x00020000) {
+          if (++loop > MAXLOOP) {
+               D_ERROR("DirectFB/VIA: Timeout waiting for idle engine!\n");
+               break;
+          }
+     }
+
+     /* printf("Leaving uc_engine_sync(), status is 0x%08x, "
+         "waiting for %d (0x%x) cycles.\n",
+         VIA_IN(ucdrv->hwregs, VIA_REG_STATUS), loop, loop);
+      */
+
+     ucdev->idle_waitcycles += loop;
+     ucdev->must_wait = 0;
+
+     return DFB_OK;
+}
+
+
+// DirectFB interfacing functions --------------------------------------------
+
+static int driver_probe(CoreGraphicsDevice *device)
+{
+     struct stat s;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_VIA_UNICHROME:
+               return 1;
+     }
+
+     return stat(UNICHROME_DEVICE, &s) + 1;
+}
+
+static void driver_get_info(CoreGraphicsDevice* device,
+                            GraphicsDriverInfo* info)
+{
+     // Fill in driver info structure.
+
+     snprintf(info->name,
+              DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+              "VIA UniChrome Driver");
+
+     snprintf(info->vendor,
+              DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+              "-");
+
+     snprintf(info->url,
+              DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+              "http://www.directfb.org");
+
+     snprintf(info->license,
+              DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+              "LGPL");
+
+     info->version.major = 0;
+     info->version.minor = 3;
+
+     info->driver_data_size = sizeof (UcDriverData);
+     info->device_data_size = sizeof (UcDeviceData);
+}
+
+
+static DFBResult driver_init_driver(CoreGraphicsDevice* device,
+                                    GraphicsDeviceFuncs* funcs,
+                                    void* driver_data,
+                                    void* device_data,
+                                    CoreDFB *core)
+{
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+
+     //printf("Entering %s\n", __PRETTY_FUNCTION__);
+
+     ucdrv->file = -1;
+     ucdrv->pool = dfb_core_shmpool( core );
+
+     ucdrv->hwregs = dfb_gfxcard_map_mmio( device, 0, 0 );
+     if (!ucdrv->hwregs) {
+          int fd;
+
+          fd = open(UNICHROME_DEVICE, O_RDWR | O_SYNC, 0);
+          if (fd < 0) {
+               D_ERROR("Could not access %s. "
+                        "Is the cle266vgaio module installed?\n", UNICHROME_DEVICE);
+               return DFB_IO;
+          }
+
+          ucdrv->file = fd;
+
+          ucdrv->hwregs = mmap(NULL, 0x1000000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+          if (ucdrv->hwregs == MAP_FAILED)
+               return DFB_IO;
+     }
+
+     /* FIXME: this belongs to device_data! */
+     ucdrv->fifo = uc_fifo_create(ucdrv->pool, UC_FIFO_SIZE);
+     if (!ucdrv->fifo)
+          return D_OOSHM();
+
+     uc_after_set_var(driver_data, device_data);
+
+     ucdrv->hwrev = 3;   // FIXME: Get the real hardware revision number!!!
+
+     // Driver specific initialization
+
+     funcs->CheckState        = uc_check_state;
+     funcs->SetState          = uc_set_state;
+     funcs->EngineSync        = uc_engine_sync;
+     funcs->EmitCommands      = uc_emit_commands;
+     funcs->FlushTextureCache = uc_flush_texture_cache;
+     funcs->AfterSetVar       = uc_after_set_var;
+
+     funcs->FillRectangle     = uc_fill_rectangle;
+     funcs->DrawRectangle     = uc_draw_rectangle;
+     funcs->DrawLine          = uc_draw_line;
+     funcs->FillTriangle      = uc_fill_triangle;
+     funcs->Blit              = uc_blit;
+     funcs->StretchBlit       = uc_stretch_blit;
+     funcs->TextureTriangles  = uc_texture_triangles;
+
+
+     /* install primary layer hooks */
+     if ( getenv("DFB_CLE266_UNDERLAY"))
+          dfb_layers_hook_primary( device, driver_data, &ucPrimaryFuncs,
+                                    &ucOldPrimaryFuncs, &ucOldPrimaryDriverData );
+
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                          driver_data, &ucOverlayFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult driver_init_device(CoreGraphicsDevice* device,
+                                    GraphicsDeviceInfo* device_info,
+                                    void* driver_data,
+                                    void* device_data)
+{
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+     UcDeviceData *ucdev = (UcDeviceData*) device_data;
+
+     //printf("Entering %s\n", __PRETTY_FUNCTION__);
+
+     snprintf(device_info->name,
+              DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "UniChrome");
+     snprintf(device_info->vendor,
+              DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "VIA/S3G");
+
+     device_info->caps.flags = CCF_CLIPPING;
+     device_info->caps.accel =
+     UC_DRAWING_FUNCTIONS_2D | UC_DRAWING_FUNCTIONS_3D |
+     UC_BLITTING_FUNCTIONS_2D | UC_BLITTING_FUNCTIONS_3D;
+
+     device_info->caps.drawing  = UC_DRAWING_FLAGS_2D | UC_DRAWING_FLAGS_3D;
+     device_info->caps.blitting = UC_BLITTING_FLAGS_2D | UC_BLITTING_FLAGS_3D;
+
+     device_info->limits.surface_byteoffset_alignment = 32;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     ucdev->pitch = 0;
+     ucdev->draw_rop2d = VIA_ROP_P;
+     ucdev->draw_rop3d = HC_HROP_P;
+     ucdev->color = 0;
+     ucdev->bflags = 0;
+
+     ucdev->must_wait = 0;
+     ucdev->cmd_waitcycles = 0;
+     ucdev->idle_waitcycles = 0;
+
+     uc_init_2d_engine(device, ucdev, ucdrv, false); // VQ disabled - can't make it work.
+     uc_init_3d_engine(ucdrv->hwregs, ucdrv->hwrev, 1);
+
+     return DFB_OK;
+}
+
+static void driver_close_device(CoreGraphicsDevice *device,
+                                void *driver_data, void *device_data)
+{
+     UcDriverData* ucdrv = (UcDriverData*) driver_data;
+     UcDeviceData* ucdev = (UcDeviceData*) device_data;
+
+     // uc_dump_vq(ucdev);
+
+     uc_engine_sync(driver_data, device_data);
+     uc_init_2d_engine(device, ucdev, ucdrv, false);
+}
+
+static void driver_close_driver(CoreGraphicsDevice* device, void* driver_data)
+{
+     UcDriverData* ucdrv = (UcDriverData*) driver_data;
+
+     if (ucdrv->fifo)
+          uc_fifo_destroy( ucdrv->pool, ucdrv->fifo );
+
+     if (ucdrv->file != -1)
+          close( ucdrv->file );
+}
diff --git a/Source/DirectFB/gfxdrivers/cle266/unichrome.h b/Source/DirectFB/gfxdrivers/cle266/unichrome.h
new file mode 100755
index 0000000..801216b
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/unichrome.h
@@ -0,0 +1,140 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UNICHROME_H__
+#define __UNICHROME_H__
+
+#include <core/coredefs.h>
+#include <core/surface.h>
+#include <core/layers.h>
+#include <core/layer_control.h>
+
+#include <directfb.h>
+
+#define UNICHROME_DEVICE "/dev/cle266vgaio"
+#define UC_FIFO_SIZE 4096
+
+/** If defined - the driver will use the 3D engine. */
+#define UC_ENABLE_3D
+//#undef UC_ENABLE_3D
+
+
+/** Register settings for the current source surface. (3D) */
+struct uc_hw_texture {
+     DFBSurfaceBlittingFlags bltflags;
+
+     u32 l2w;        //width, rounded up to nearest 2^m, eg 600 => 1024
+     u32 l2h;        //height, rounded up, e.g 480 => 512
+     u32 we;         //width exponent, i.e m in the number 2^m
+     u32 he;         //height exponent
+
+     u32 format;     // HW pixel format
+
+     // 3d engine texture environment, texture unit 0
+
+     // Used for the DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_BLEND_COLORALPHA
+     // and DSBLIT_COLORIZE blitting flags.
+
+     u32 regHTXnTB;
+     u32 regHTXnMPMD;
+
+     u32 regHTXnTBLCsat_0;
+     u32 regHTXnTBLCop_0;
+     u32 regHTXnTBLMPfog_0;
+     u32 regHTXnTBLAsat_0;
+     u32 regHTXnTBLRCb_0;
+     u32 regHTXnTBLRAa_0;
+     u32 regHTXnTBLRFog_0;
+};
+
+
+/** Hardware source-destination blending registers. */
+struct uc_hw_alpha {
+/*
+    u32 regHABBasL;         // Alpha buffer, low 24 bits.
+    u32 regHABBasH;         // Alpha buffer, high 8 bits.
+    u32 regHABFM;           // Alpha pixel format, memory type and pitch.
+    u32 regHATMD;           // Alpha test function and reference value.
+
+    // Blending function
+*/
+     u32 regHABLCsat;
+     u32 regHABLCop;
+     u32 regHABLAsat;
+     u32 regHABLAop;
+     u32 regHABLRCa;
+     u32 regHABLRFCa;
+     u32 regHABLRCbias;
+     u32 regHABLRCb;
+     u32 regHABLRFCb;
+     u32 regHABLRAa;
+     u32 regHABLRAb;
+};
+
+typedef enum {
+     uc_source2d    = 0x00000001,
+     uc_source3d    = 0x00000002,
+     uc_texenv      = 0x00000004,
+     uc_blending_fn = 0x00000008,
+     uc_color2d     = 0x00000010,
+     uc_colorkey2d  = 0x00000020
+} UcStateBits;
+
+#define UC_VALIDATE(b)       (ucdev->valid |= (b))
+#define UC_INVALIDATE(b)     (ucdev->valid &= ~(b))
+#define UC_IS_VALID(b)       (ucdev->valid & (b))
+
+typedef struct _UcDeviceData {
+
+     /* State validation */
+     UcStateBits valid;
+
+     /* Current state settings */
+     u32                     pitch;      // combined src/dst pitch (2D)
+     u32                     color;      // 2D fill color
+     u32                     color3d;    // color for 3D operations
+     u32                     draw_rop2d; // logical drawing ROP (2D)
+     u32                     draw_rop3d; // logical drawing ROP (3D)
+
+     DFBSurfaceBlittingFlags bflags;     // blitting flags
+     DFBRegion               clip;       // clipping region
+
+     DFBSurfacePixelFormat   dst_format; // destination pixel format
+     int                     dst_offset; // destination buffer byte offset
+     int                     dst_pitch;  // destination buffer byte pitch
+
+     int                     field;      // source field
+
+     /* Hardware settings */
+     struct uc_hw_alpha      hwalpha;    // alpha blending setting (3D)
+     struct uc_hw_texture    hwtex;      // hardware settings for blitting (3D)
+
+
+     /// Set directly after a 2D/3D engine command is sent.
+     int must_wait;
+     unsigned int cmd_waitcycles;
+     unsigned int idle_waitcycles;
+
+     u32             vq_start;   // VQ related
+     u32             vq_size;
+     u32             vq_end;
+
+} UcDeviceData;
+
+
+typedef struct _UcDriverData {
+     int             file;       // File handle to mmapped IO region.
+     int             hwrev;      // Hardware revision
+     volatile void*  hwregs;     // Hardware register base
+     struct uc_fifo* fifo;       // Data FIFO.
+     FusionSHMPoolShared *pool;
+} UcDriverData;
+
+
+#endif // __UNICHROME_H__
diff --git a/Source/DirectFB/gfxdrivers/cle266/vidregs.h b/Source/DirectFB/gfxdrivers/cle266/vidregs.h
new file mode 100755
index 0000000..5331fc1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cle266/vidregs.h
@@ -0,0 +1,498 @@
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIDREGS_H__
+#define __VIDREGS_H__
+
+
+/* Video registers */
+#define V_FLAGS                         0x00
+#define V_CAP_STATUS                    0x04
+#define V_FLIP_STATUS                   0x04
+#define V_ALPHA_WIN_START               0x08
+#define V_ALPHA_WIN_END                 0x0C
+#define V_ALPHA_CONTROL                 0x10
+#define V_CRT_STARTADDR                 0x14
+#define V_CRT_STARTADDR_2               0x18
+#define V_ALPHA_STRIDE                  0x1C
+#define V_COLOR_KEY                     0x20
+#define V_ALPHA_STARTADDR               0x24
+#define V_CHROMAKEY_LOW                 0x28
+#define V_CHROMAKEY_HIGH                0x2C
+
+#define V1_CONTROL                      0x30
+#define V12_QWORD_PER_LINE              0x34
+#define V1_STARTADDR_1                  0x38
+#define V1_STARTADDR_Y1                 V1_STARTADDR_1  /* added by Kevin 3/30/2002 */
+#define V1_STRIDE                       0x3C
+#define V1_WIN_START_Y                  0x40
+#define V1_WIN_START_X                  0x42
+#define V1_WIN_END_Y                    0x44
+#define V1_WIN_END_X                    0x46
+#define V1_STARTADDR_2                  0x48
+#define V1_STARTADDR_Y2                 V1_STARTADDR_2  /* added by Kevin 3/30/2002 */
+#define V1_ZOOM_CONTROL                 0x4C
+#define V1_MINI_CONTROL                 0x50
+#define V1_STARTADDR_0                  0x54
+#define V1_STARTADDR_Y0                 V1_STARTADDR_0  /* added by Kevin 3/30/2002 */
+#define V_FIFO_CONTROL                  0x58
+#define V1_STARTADDR_3                  0x5C
+#define V1_STARTADDR_Y3                 V1_STARTADDR_3  /* added by Kevin 3/30/2002 */
+
+#define HI_CONTROL                      0x60
+#define SND_COLOR_KEY                   0x64
+#define ALPHA_V3_PREFIFO_CONTROL        0x68
+#define V1_SOURCE_HEIGHT                0x6C
+#define HI_TRANSPARENT_COLOR            0x70
+#define V_DISPLAY_TEMP                  0x74  /* No use */
+#define ALPHA_V3_FIFO_CONTROL           0x78
+#define V3_SOURCE_WIDTH                 0x7C
+#define V3_COLOR_KEY                    0x80
+#define V1_ColorSpaceReg_1              0x84
+#define V1_ColorSpaceReg_2              0x88
+#define V1_STARTADDR_CB0                0x8C
+#define V1_OPAQUE_CONTROL               0x90  /* To be deleted */
+#define V3_OPAQUE_CONTROL               0x94  /* To be deleted */
+#define V_COMPOSE_MODE                  0x98
+
+#define V3_STARTADDR_2                  0x9C
+#define V3_CONTROL                      0xA0
+#define V3_STARTADDR_0                  0xA4
+#define V3_STARTADDR_1                  0xA8
+#define V3_STRIDE                       0xAC
+#define V3_WIN_START_Y                  0xB0
+#define V3_WIN_START_X                  0xB2
+#define V3_WIN_END_Y                    0xB4
+#define V3_WIN_END_X                    0xB6
+#define V3_ALPHA_QWORD_PER_LINE         0xB8
+#define V3_ZOOM_CONTROL                 0xBC
+#define V3_MINI_CONTROL                 0xC0
+#define V3_ColorSpaceReg_1              0xC4
+#define V3_ColorSpaceReg_2              0xC8
+#define V3_DISPLAY_TEMP                 0xCC  /* No use */
+
+#define V1_STARTADDR_CB1                0xE4
+#define V1_STARTADDR_CB2                0xE8
+#define V1_STARTADDR_CB3                0xEC
+#define V1_STARTADDR_CR0                0xF0
+#define V1_STARTADDR_CR1                0xF4
+#define V1_STARTADDR_CR2                0xF8
+#define V1_STARTADDR_CR3                0xFC
+
+/* Video Capture Engine Registers - port 1 */
+#define CAP0_MASKS                      0x100
+#define CAP1_MASKS                      0x104
+#define CAP0_CONTROL                    0x110
+#define CAP0_H_RANGE                    0x114
+#define CAP0_V_RANGE                    0x118
+#define CAP0_SCAL_CONTROL               0x11C
+#define CAP0_VBI_H_RANGE                0x120
+#define CAP0_VBI_V_RANGE                0x124
+#define CAP0_VBI_STARTADDR              0x128
+#define CAP0_VBI_STRIDE                 0x12C
+#define CAP0_ANCIL_COUNT                0x130
+#define CAP0_MAXCOUNT                   0x134
+#define CAP0_VBIMAX_COUNT               0x138
+#define CAP0_DATA_COUNT                 0x13C
+#define CAP0_FB_STARTADDR0              0x140
+#define CAP0_FB_STARTADDR1              0x144
+#define CAP0_FB_STARTADDR2              0x148
+#define CAP0_STRIDE                     0x150
+
+/* Video Capture Engine Registers - port 2 */
+#define CAP1_CONTROL                    0x154
+#define CAP1_SCAL_CONTROL               0x160
+#define CAP1_VBI_H_RANGE                0x164 /*To be deleted*/
+#define CAP1_VBI_V_RANGE                0x168 /*To be deleted*/
+#define CAP1_VBI_STARTADDR              0x16C /*To be deleted*/
+#define CAP1_VBI_STRIDE                 0x170 /*To be deleted*/
+#define CAP1_ANCIL_COUNT                0x174 /*To be deleted*/
+#define CAP1_MAXCOUNT                   0x178
+#define CAP1_VBIMAX_COUNT               0x17C /*To be deleted*/
+#define CAP1_DATA_COUNT                 0x180
+#define CAP1_FB_STARTADDR0              0x184
+#define CAP1_FB_STARTADDR1              0x188
+#define CAP1_STRIDE                     0x18C
+
+/* SUBPICTURE Registers */
+#define SUBP_CONTROL_STRIDE             0x1C0
+#define SUBP_STARTADDR                  0x1C4
+#define RAM_TABLE_CONTROL               0x1C8
+#define RAM_TABLE_READ                  0x1CC
+
+/* HQV Registers */
+#define HQV_CONTROL                     0x1D0
+#define HQV_SRC_STARTADDR_Y             0x1D4
+#define HQV_SRC_STARTADDR_U             0x1D8
+#define HQV_SRC_STARTADDR_V             0x1DC
+#define HQV_SRC_FETCH_LINE              0x1E0
+#define HQV_FILTER_CONTROL              0x1E4
+#define HQV_MINIFY_CONTROL              0x1E8
+#define HQV_DST_STARTADDR0              0x1EC
+#define HQV_DST_STARTADDR1              0x1F0
+#define HQV_DST_STARTADDR2              0x1FC
+#define HQV_DST_STRIDE                  0x1F4
+#define HQV_SRC_STRIDE                  0x1F8
+
+
+
+/* Video command definitions */
+
+/* #define V_ALPHA_CONTROL - 0x210 */
+#define ALPHA_WIN_EXPIRENUMBER_4        0x00040000
+#define ALPHA_WIN_CONSTANT_FACTOR_4     0x00004000
+#define ALPHA_WIN_CONSTANT_FACTOR_12    0x0000c000
+#define ALPHA_WIN_BLENDING_CONSTANT     0x00000000
+#define ALPHA_WIN_BLENDING_ALPHA        0x00000001
+#define ALPHA_WIN_BLENDING_GRAPHIC      0x00000002
+#define ALPHA_WIN_PREFIFO_THRESHOLD_12  0x000c0000
+#define ALPHA_WIN_FIFO_THRESHOLD_8      0x000c0000
+#define ALPHA_WIN_FIFO_DEPTH_16         0x00100000
+
+/* V_CHROMAKEY_LOW - 0x228 */
+#define V_CHROMAKEY_V3                  0x80000000
+
+/* V1_CONTROL - 0x230 */
+#define V1_ENABLE                       0x00000001
+#define V1_FULL_SCREEN                  0x00000002
+#define V1_YUV422                       0x00000000
+#define V1_RGB32                        0x00000004
+#define V1_RGB15                        0x00000008
+#define V1_RGB16                        0x0000000C
+#define V1_YUV420                       0x00000010
+#define V1_COLORSPACE_SIGN              0x00000080
+#define V1_SRC_IS_FRAME_PIC             0x00000200
+#define V1_SRC_IS_FIELD_PIC             0x00000000
+#define V1_BOB_ENABLE                   0x00400000
+#define V1_FIELD_BASE                   0x00000000
+#define V1_FRAME_BASE                   0x01000000
+#define V1_SWAP_SW                      0x00000000
+#define V1_SWAP_HW_HQV                  0x02000000
+#define V1_SWAP_HW_CAPTURE              0x04000000
+#define V1_SWAP_HW_MC                   0x06000000
+/* #define V1_DOUBLE_BUFFERS            0x00000000 */
+/* #define V1_QUADRUPLE_BUFFERS         0x18000000 */
+#define V1_EXPIRE_NUM                   0x00050000
+#define V1_EXPIRE_NUM_A                 0x000a0000
+#define V1_EXPIRE_NUM_F                 0x000f0000 /* jason */
+#define V1_FIFO_EXTENDED                0x00200000
+#define V1_ON_CRT                       0x00000000
+#define V1_ON_SND_DISPLAY               0x80000000
+#define V1_FIFO_32V1_32V2               0x00000000
+#define V1_FIFO_48V1_32V2               0x00200000
+
+/* V12_QWORD_PER_LINE - 0x234 */
+#define V1_FETCH_COUNT                  0x3ff00000
+#define V1_FETCHCOUNT_ALIGNMENT         0x0000000f
+#define V1_FETCHCOUNT_UNIT              0x00000004   /* Doubld QWORD */
+
+/* V1_STRIDE */
+#define V1_STRIDE_YMASK                 0x00001fff
+#define V1_STRIDE_UVMASK                0x1ff00000
+
+/* V1_ZOOM_CONTROL - 0x24C */
+#define V1_X_ZOOM_ENABLE                0x80000000
+#define V1_Y_ZOOM_ENABLE                0x00008000
+
+/* V1_MINI_CONTROL - 0x250 */
+#define V1_X_INTERPOLY                  0x00000002  /* X interpolation */
+#define V1_Y_INTERPOLY                  0x00000001  /* Y interpolation */
+#define V1_YCBCR_INTERPOLY              0x00000004  /* Y, Cb, Cr all interpolation */
+#define V1_X_DIV_2                      0x01000000
+#define V1_X_DIV_4                      0x03000000
+#define V1_X_DIV_8                      0x05000000
+#define V1_X_DIV_16                     0x07000000
+#define V1_Y_DIV_2                      0x00010000
+#define V1_Y_DIV_4                      0x00030000
+#define V1_Y_DIV_8                      0x00050000
+#define V1_Y_DIV_16                     0x00070000
+
+/* V1_STARTADDR0 - 0x254 */
+#define SW_FLIP_ODD                     0x08000000
+
+/* V_FIFO_CONTROL - 0x258
+ * IA2 has 32 level FIFO for packet mode video format
+ *         32 level FIFO for planar mode video YV12.
+ *              with extension reg 230 bit 21 enable
+ *         16 level FIFO for planar mode video YV12.
+ *              with extension reg 230 bit 21 disable
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V1_FIFO_DEPTH12                 0x0000000B
+#define V1_FIFO_DEPTH16                 0x0000000F
+#define V1_FIFO_DEPTH32                 0x0000001F
+#define V1_FIFO_DEPTH48                 0x0000002F
+#define V1_FIFO_DEPTH64                 0x0000003F
+#define V1_FIFO_THRESHOLD6              0x00000600
+#define V1_FIFO_THRESHOLD8              0x00000800
+#define V1_FIFO_THRESHOLD12             0x00000C00
+#define V1_FIFO_THRESHOLD16             0x00001000
+#define V1_FIFO_THRESHOLD24             0x00001800
+#define V1_FIFO_THRESHOLD32             0x00002000
+#define V1_FIFO_THRESHOLD40             0x00002800
+#define V1_FIFO_THRESHOLD48             0x00003000
+#define V1_FIFO_THRESHOLD56             0x00003800
+#define V1_FIFO_THRESHOLD61             0x00003D00
+#define V1_FIFO_PRETHRESHOLD10          0x0A000000
+#define V1_FIFO_PRETHRESHOLD12          0x0C000000
+#define V1_FIFO_PRETHRESHOLD29          0x1d000000
+#define V1_FIFO_PRETHRESHOLD40          0x28000000
+#define V1_FIFO_PRETHRESHOLD44          0x2c000000
+#define V1_FIFO_PRETHRESHOLD56          0x38000000
+#define V1_FIFO_PRETHRESHOLD61          0x3D000000
+
+/* ALPHA_V3_FIFO_CONTROL - 0x278
+ * IA2 has 32 level FIFO for packet mode video format
+ *         32 level FIFO for planar mode video YV12.
+ *             with extension reg 230 bit 21 enable
+ *         16 level FIFO for planar mode video YV12.
+ *             with extension reg 230 bit 21 disable
+ *          8 level FIFO for ALPHA
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V3_FIFO_DEPTH16                 0x0000000F
+#define V3_FIFO_DEPTH24                 0x00000017
+#define V3_FIFO_DEPTH32                 0x0000001F
+#define V3_FIFO_DEPTH48                 0x0000002F
+#define V3_FIFO_DEPTH64                 0x0000003F
+#define V3_FIFO_THRESHOLD8              0x00000800
+#define V3_FIFO_THRESHOLD12             0x00000C00
+#define V3_FIFO_THRESHOLD16             0x00001000
+#define V3_FIFO_THRESHOLD24             0x00001800
+#define V3_FIFO_THRESHOLD32             0x00002000
+#define V3_FIFO_THRESHOLD40             0x00002800
+#define V3_FIFO_THRESHOLD48             0x00003000
+#define V3_FIFO_THRESHOLD61             0x00003D00
+#define V3_FIFO_PRETHRESHOLD10          0x0000000A
+#define V3_FIFO_PRETHRESHOLD12          0x0000000C
+#define V3_FIFO_PRETHRESHOLD29          0x0000001d
+#define V3_FIFO_PRETHRESHOLD40          0x00000028
+#define V3_FIFO_PRETHRESHOLD44          0x0000002c
+#define V3_FIFO_PRETHRESHOLD56          0x00000038
+#define V3_FIFO_PRETHRESHOLD61          0x0000003D
+#define V3_FIFO_MASK                    0x0000007F
+#define ALPHA_FIFO_DEPTH8               0x00070000
+#define ALPHA_FIFO_THRESHOLD4           0x04000000
+#define ALPHA_FIFO_MASK                 0xffff0000
+#define ALPHA_FIFO_PRETHRESHOLD4        0x00040000
+
+/* IA2 */
+#define ColorSpaceValue_1               0x140020f2
+#define ColorSpaceValue_2               0x0a0a2c00
+
+#define ColorSpaceValue_1_3123C0        0x13000DED
+#define ColorSpaceValue_2_3123C0        0x13171000
+
+/* For TV setting */
+#define ColorSpaceValue_1TV             0x140020f2
+#define ColorSpaceValue_2TV             0x0a0a2c00
+
+/* V_COMPOSE_MODE - 0x298 */
+#define SELECT_VIDEO_IF_COLOR_KEY       0x00000001  /* select video if (color key),otherwise select graphics */
+#define SELECT_VIDEO3_IF_COLOR_KEY      0x00000020  /* For 3123C0, select video3 if (color key),otherwise select graphics */
+#define SELECT_VIDEO_IF_CHROMA_KEY      0x00000002  /* 0x0000000a  //select video if (chroma key ),otherwise select graphics */
+#define ALWAYS_SELECT_VIDEO             0x00000000  /* always select video,Chroma key and Color key disable */
+#define COMPOSE_V1_V3                   0x00000000  /* V1 on top of V3 */
+#define COMPOSE_V3_V1                   0x00100000  /* V3 on top of V1 */
+#define COMPOSE_V1_TOP                  0x00000000
+#define COMPOSE_V3_TOP                  0x00100000
+#define V1_COMMAND_FIRE                 0x80000000  /* V1 commands fire */
+#define V3_COMMAND_FIRE                 0x40000000  /* V3 commands fire */
+#define V_COMMAND_LOAD                  0x20000000  /* Video register always loaded */
+#define V_COMMAND_LOAD_VBI              0x10000000  /* Video register always loaded at vbi without waiting source flip */
+#define V3_COMMAND_LOAD                 0x08000000  /* CLE_C0 Video3 register always loaded */
+#define V3_COMMAND_LOAD_VBI             0x00000100  /* CLE_C0 Video3 register always loaded at vbi without waiting source flip */
+#define SECOND_DISPLAY_COLOR_KEY_ENABLE 0x00010000
+
+/* V3_ZOOM_CONTROL - 0x2bc */
+#define V3_X_ZOOM_ENABLE                0x80000000
+#define V3_Y_ZOOM_ENABLE                0x00008000
+
+/* V3_MINI_CONTROL - 0x2c0 */
+#define V3_X_INTERPOLY                  0x00000002  /* X interpolation */
+#define V3_Y_INTERPOLY                  0x00000001  /* Y interpolation */
+#define V3_YCBCR_INTERPOLY              0x00000004  /* Y, Cb, Cr all interpolation */
+#define V3_X_DIV_2                      0x01000000
+#define V3_X_DIV_4                      0x03000000
+#define V3_X_DIV_8                      0x05000000
+#define V3_X_DIV_16                     0x07000000
+#define V3_Y_DIV_2                      0x00010000
+#define V3_Y_DIV_4                      0x00030000
+#define V3_Y_DIV_8                      0x00050000
+#define V3_Y_DIV_16                     0x00070000
+
+/* SUBP_CONTROL_STRIDE - 0x3c0 */
+#define SUBP_HQV_ENABLE                 0x00010000
+#define SUBP_IA44                       0x00020000
+#define SUBP_AI44                       0x00000000
+#define SUBP_STRIDE_MASK                0x00001fff
+#define SUBP_CONTROL_MASK               0x00070000
+
+/* RAM_TABLE_CONTROL - 0x3c8 */
+#define RAM_TABLE_RGB_ENABLE            0x00000007
+
+/* CAPTURE0_CONTROL - 0x310 */
+#define C0_ENABLE                       0x00000001
+#define BUFFER_2_MODE                   0x00000000
+#define BUFFER_3_MODE                   0x00000004
+#define BUFFER_4_MODE                   0x00000006
+#define SWAP_YUYV                       0x00000000
+#define SWAP_UYVY                       0x00000100
+#define SWAP_YVYU                       0x00000200
+#define SWAP_VYUY                       0x00000300
+#define IN_601_8                        0x00000000
+#define IN_656_8                        0x00000010
+#define IN_601_16                       0x00000020
+#define IN_656_16                       0x00000030
+#define DEINTER_ODD                     0x00000000
+#define DEINTER_EVEN                    0x00001000
+#define DEINTER_ODD_EVEN                0x00002000
+#define DEINTER_FRAME                   0x00003000
+#define VIP_1                           0x00000000
+#define VIP_2                           0x00000400
+#define H_FILTER_2                      0x00010000
+#define H_FILTER_4                      0x00020000
+#define H_FILTER_8_1331                 0x00030000
+#define H_FILTER_8_12221                0x00040000
+#define VIP_ENABLE                      0x00000008
+#define EN_FIELD_SIG                    0x00000800
+#define VREF_INVERT                     0x00100000
+#define FIELD_INPUT_INVERSE             0x00400000
+#define FIELD_INVERSE                   0x40000000
+
+#define C1_H_MINI_EN                    0x00000800
+#define C0_H_MINI_EN                    0x00000800
+#define C1_V_MINI_EN                    0x04000000
+#define C0_V_MINI_EN                    0x04000000
+#define C1_H_MINI_2                     0x00000400
+
+/* CAPTURE1_CONTROL - 0x354 */
+#define C1_ENABLE                       0x00000001
+
+/* V3_CONTROL - 0x2A0 */
+#define V3_ENABLE                       0x00000001
+#define V3_FULL_SCREEN                  0x00000002
+#define V3_YUV422                       0x00000000
+#define V3_RGB32                        0x00000004
+#define V3_RGB15                        0x00000008
+#define V3_RGB16                        0x0000000C
+#define V3_COLORSPACE_SIGN              0x00000080
+#define V3_EXPIRE_NUM                   0x00040000
+#define V3_EXPIRE_NUM_F                 0x000f0000
+#define V3_BOB_ENABLE                   0x00400000
+#define V3_FIELD_BASE                   0x00000000
+#define V3_FRAME_BASE                   0x01000000
+#define V3_SWAP_SW                      0x00000000
+#define V3_SWAP_HW_HQV                  0x02000000
+#define V3_FLIP_HW_CAPTURE0             0x04000000
+#define V3_FLIP_HW_CAPTURE1             0x06000000
+
+/* V3_ALPHA_FETCH_COUNT - 0x2B8 */
+#define V3_FETCH_COUNT                  0x3ff00000
+#define ALPHA_FETCH_COUNT               0x000003ff
+
+/* HQV_CONTROL - 0x3D0 */
+#define HQV_RGB32                       0x00000000
+#define HQV_RGB16                       0x20000000
+#define HQV_RGB15                       0x30000000
+#define HQV_YUV422                      0x80000000
+#define HQV_YUV420                      0xC0000000
+#define HQV_ENABLE                      0x08000000
+#define HQV_SRC_SW                      0x00000000
+#define HQV_SRC_MC                      0x01000000
+#define HQV_SRC_CAPTURE0                0x02000000
+#define HQV_SRC_CAPTURE1                0x03000000
+#define HQV_FLIP_EVEN                   0x00000000
+#define HQV_FLIP_ODD                    0x00000020
+#define HQV_SW_FLIP                     0x00000010   /* Write 1 to flip HQV buffer */
+#define HQV_DEINTERLACE                 0x00010000   /* First line of odd field will be repeated 3 times */
+#define HQV_FIELD_2_FRAME               0x00020000   /* Src is field. Display each line 2 times */
+#define HQV_FRAME_2_FIELD               0x00040000   /* Src is field. Display field */
+#define HQV_FRAME_UV                    0x00000000   /* Src is Non-interleaved */
+#define HQV_FIELD_UV                    0x00100000   /* Src is interleaved */
+#define HQV_IDLE                        0x00000008
+#define HQV_FLIP_STATUS                 0x00000001
+#define HQV_DOUBLE_BUFF                 0x00000000
+#define HQV_TRIPLE_BUFF                 0x04000000
+#define HQV_SUBPIC_FLIP                 0x00008000
+#define HQV_FIFO_STATUS                 0x00001000
+
+/* HQV_FILTER_CONTROL - 0x3E4 */
+#define HQV_H_LOWPASS_2TAP              0x00000001
+#define HQV_H_LOWPASS_4TAP              0x00000002
+#define HQV_H_LOWPASS_8TAP1             0x00000003   /* To be deleted */
+#define HQV_H_LOWPASS_8TAP2             0x00000004   /* To be deleted */
+#define HQV_H_HIGH_PASS                 0x00000008
+#define HQV_H_LOW_PASS                  0x00000000
+#define HQV_V_LOWPASS_2TAP              0x00010000
+#define HQV_V_LOWPASS_4TAP              0x00020000
+#define HQV_V_LOWPASS_8TAP1             0x00030000
+#define HQV_V_LOWPASS_8TAP2             0x00040000
+#define HQV_V_HIGH_PASS                 0x00080000
+#define HQV_V_LOW_PASS                  0x00000000
+#define HQV_H_HIPASS_F1_DEFAULT         0x00000040
+#define HQV_H_HIPASS_F2_DEFAULT         0x00000000
+#define HQV_V_HIPASS_F1_DEFAULT         0x00400000
+#define HQV_V_HIPASS_F2_DEFAULT         0x00000000
+#define HQV_H_HIPASS_F1_2TAP            0x00000050
+#define HQV_H_HIPASS_F2_2TAP            0x00000100
+#define HQV_V_HIPASS_F1_2TAP            0x00500000
+#define HQV_V_HIPASS_F2_2TAP            0x01000000
+#define HQV_H_HIPASS_F1_4TAP            0x00000060
+#define HQV_H_HIPASS_F2_4TAP            0x00000200
+#define HQV_V_HIPASS_F1_4TAP            0x00600000
+#define HQV_V_HIPASS_F2_4TAP            0x02000000
+#define HQV_H_HIPASS_F1_8TAP            0x00000080
+#define HQV_H_HIPASS_F2_8TAP            0x00000400
+#define HQV_V_HIPASS_F1_8TAP            0x00800000
+#define HQV_V_HIPASS_F2_8TAP            0x04000000
+/* IA2 NEW */
+#define HQV_V_FILTER2                   0x00080000
+#define HQV_H_FILTER2                   0x00000008
+#define HQV_H_TAP2_11                   0x00000041
+#define HQV_H_TAP4_121                  0x00000042
+#define HQV_H_TAP4_1111                 0x00000401
+#define HQV_H_TAP8_1331                 0x00000221
+#define HQV_H_TAP8_12221                0x00000402
+#define HQV_H_TAP16_1991                0x00000159
+#define HQV_H_TAP16_141041              0x0000026A
+#define HQV_H_TAP32                     0x0000015A
+#define HQV_V_TAP2_11                   0x00410000
+#define HQV_V_TAP4_121                  0x00420000
+#define HQV_V_TAP4_1111                 0x04010000
+#define HQV_V_TAP8_1331                 0x02210000
+#define HQV_V_TAP8_12221                0x04020000
+#define HQV_V_TAP16_1991                0x01590000
+#define HQV_V_TAP16_141041              0x026A0000
+#define HQV_V_TAP32                     0x015A0000
+#define HQV_V_FILTER_DEFAULT            0x00420000
+#define HQV_H_FILTER_DEFAULT            0x00000040
+
+/* HQV_MINI_CONTROL - 0x3E8 */
+#define HQV_H_MINIFY_ENABLE             0x00000800
+#define HQV_V_MINIFY_ENABLE             0x08000000
+#define HQV_VDEBLOCK_FILTER             0x80000000
+#define HQV_HDEBLOCK_FILTER             0x00008000
+
+#endif // __VIDREGS_H__
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am
new file mode 100755
index 0000000..6112a8d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am
@@ -0,0 +1,41 @@
+## Makefile.am for DirectFB/gfxdrivers/cyber5k
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+cyber5k_LTLIBRARIES = libdirectfb_cyber5k.la
+
+if BUILD_STATIC
+cyber5k_DATA = $(cyber5k_LTLIBRARIES:.la=.o)
+endif
+
+cyber5kdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_cyber5k_la_SOURCES = \
+	cyber5k.c	\
+	cyber5k.h	\
+	cyber5k_overlay.h \
+	cyber5k_overlay.c \
+	cyber5k_underlay.c \
+	cyber5k_alpha.c \
+	cyber5k_alpha.h \
+	regs.h		\
+	mmio.h
+
+libdirectfb_cyber5k_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_cyber5k_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in
new file mode 100755
index 0000000..9861ceb
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in
@@ -0,0 +1,607 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = gfxdrivers/cyber5k
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(cyber5kdir)" "$(DESTDIR)$(cyber5kdir)"
+cyber5kLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(cyber5k_LTLIBRARIES)
+libdirectfb_cyber5k_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_cyber5k_la_OBJECTS = cyber5k.lo cyber5k_overlay.lo \
+	cyber5k_underlay.lo cyber5k_alpha.lo
+libdirectfb_cyber5k_la_OBJECTS = $(am_libdirectfb_cyber5k_la_OBJECTS)
+libdirectfb_cyber5k_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_cyber5k_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libdirectfb_cyber5k_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_cyber5k_la_SOURCES)
+cyber5kDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(cyber5k_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+cyber5k_LTLIBRARIES = libdirectfb_cyber5k.la
+@BUILD_STATIC_TRUE@cyber5k_DATA = $(cyber5k_LTLIBRARIES:.la=.o)
+cyber5kdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_cyber5k_la_SOURCES = \
+	cyber5k.c	\
+	cyber5k.h	\
+	cyber5k_overlay.h \
+	cyber5k_overlay.c \
+	cyber5k_underlay.c \
+	cyber5k_alpha.c \
+	cyber5k_alpha.h \
+	regs.h		\
+	mmio.h
+
+libdirectfb_cyber5k_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_cyber5k_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/libobject.make $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  gfxdrivers/cyber5k/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/cyber5k/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-cyber5kLTLIBRARIES: $(cyber5k_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(cyber5kdir)" || $(MKDIR_P) "$(DESTDIR)$(cyber5kdir)"
+	@list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cyber5kLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(cyber5kdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cyber5kLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(cyber5kdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-cyber5kLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(cyber5kdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(cyber5kdir)/$$p"; \
+	done
+
+clean-cyber5kLTLIBRARIES:
+	-test -z "$(cyber5k_LTLIBRARIES)" || rm -f $(cyber5k_LTLIBRARIES)
+	@list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libdirectfb_cyber5k.la: $(libdirectfb_cyber5k_la_OBJECTS) $(libdirectfb_cyber5k_la_DEPENDENCIES) 
+	$(libdirectfb_cyber5k_la_LINK) -rpath $(cyber5kdir) $(libdirectfb_cyber5k_la_OBJECTS) $(libdirectfb_cyber5k_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_alpha.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_underlay.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-cyber5kDATA: $(cyber5k_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(cyber5kdir)" || $(MKDIR_P) "$(DESTDIR)$(cyber5kdir)"
+	@list='$(cyber5k_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(cyber5kDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(cyber5kdir)/$$f'"; \
+	  $(cyber5kDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(cyber5kdir)/$$f"; \
+	done
+
+uninstall-cyber5kDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(cyber5k_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(cyber5kdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(cyber5kdir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(cyber5kdir)" "$(DESTDIR)$(cyber5kdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-cyber5kLTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-cyber5kDATA install-cyber5kLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-cyber5kDATA uninstall-cyber5kLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-cyber5kLTLIBRARIES clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-cyber5kDATA \
+	install-cyber5kLTLIBRARIES install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-cyber5kDATA \
+	uninstall-cyber5kLTLIBRARIES
+
+%.o: .libs/%.a %.la
+	rm -f $<.tmp/*.o
+	if test -d $<.tmp; then rmdir $<.tmp; fi
+	mkdir $<.tmp
+	(cd $<.tmp && $(AR) x ../../$<)
+	$(LD) -o $@ -r $<.tmp/*.o
+	rm -f $<.tmp/*.o && rmdir $<.tmp
+
+.PHONY: $(LTLIBRARIES:%.la=.libs/%.a)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c
new file mode 100755
index 0000000..e04ad28
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c
@@ -0,0 +1,824 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <fbdev/fb.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/windows.h>
+#include <core/layers.h>
+#include <core/screens.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( cyber5k )
+
+#include "regs.h"
+#include "mmio.h"
+#include "cyber5k.h"
+#include "cyber5k_alpha.h"
+
+
+/* HACK */
+volatile u8 *cyber_mmio = NULL;
+
+
+/* FIXME: support for destination color keying */
+
+#define CYBER5K_DRAWING_FLAGS \
+               (DSDRAW_NOFX)
+
+#define CYBER5K_DRAWING_FUNCTIONS \
+               (DFXL_DRAWLINE | DFXL_DRAWRECTANGLE | DFXL_FILLRECTANGLE)
+
+#define CYBER5K_BLITTING_FLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define CYBER5K_BLITTING_FUNCTIONS \
+               (DFXL_BLIT)
+
+static bool cyber5kFillRectangle( void *drv, void *dev, DFBRectangle *rect );
+static bool cyber5kFillRectangle24( void *drv, void *dev, DFBRectangle *rect );
+static bool cyber5kDrawRectangle( void *drv, void *dev, DFBRectangle *rect );
+static bool cyber5kDrawRectangle24( void *drv, void *dev, DFBRectangle *rect );
+static bool cyber5kBlit( void *drv, void *dev,
+                         DFBRectangle *rect, int dx, int dy );
+static bool cyber5kBlit24( void *drv, void *dev,
+                           DFBRectangle *rect, int dx, int dy );
+
+static DFBResult cyber5kEngineSync( void *drv, void *dev )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+
+     cyber_waitidle( cdrv, cdev );
+
+     return DFB_OK;
+}
+
+static void cyber5kCheckState( void *drv, void *dev,
+                               CardState *state, DFBAccelerationMask accel )
+{
+     /* check destination format first */
+     switch (state->destination->config.format) {
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* if there are no other drawing flags than the supported */
+          if (state->drawingflags & ~CYBER5K_DRAWING_FLAGS)
+               return;
+
+          state->accel |= CYBER5K_DRAWING_FUNCTIONS;
+
+          /* no line drawing in 24bit mode */
+          if (state->destination->config.format == DSPF_RGB24)
+               state->accel &= ~DFXL_DRAWLINE;
+     }
+     else {
+          /* if there are no other blitting flags than the supported
+             and the source and destination formats are the same */
+          if (state->blittingflags & ~CYBER5K_BLITTING_FLAGS)
+               return;
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          state->accel |= CYBER5K_BLITTING_FUNCTIONS;
+     }
+}
+
+static inline void
+cyber5k_validate_dst( CyberDriverData *cdrv, CyberDeviceData *cdev,
+                      CardState *state, GraphicsDeviceFuncs *funcs )
+{
+     CoreSurface   *dest   = state->destination;
+
+     if (cdev->v_dst)
+          return;
+
+     cdev->dst_pixeloffset = state->dst.offset /
+                             DFB_BYTES_PER_PIXEL(dest->config.format);
+     cdev->dst_pixelpitch  = state->dst.pitch /
+                             DFB_BYTES_PER_PIXEL(dest->config.format);
+
+     switch (dest->config.format) {
+          case DSPF_RGB16:
+               funcs->FillRectangle = cyber5kFillRectangle;
+               funcs->DrawRectangle = cyber5kDrawRectangle;
+               funcs->Blit          = cyber5kBlit;
+               cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch - 1 );
+               cyber_out8( cdrv->mmio_base, COPFMT, 1 );
+               break;
+          case DSPF_RGB24:
+               funcs->FillRectangle = cyber5kFillRectangle24;
+               funcs->DrawRectangle = cyber5kDrawRectangle24;
+               funcs->Blit          = cyber5kBlit24;
+               cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch*3 -1);
+               cyber_out8( cdrv->mmio_base, COPFMT, 2 );
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               funcs->FillRectangle = cyber5kFillRectangle;
+               funcs->DrawRectangle = cyber5kDrawRectangle;
+               funcs->Blit          = cyber5kBlit;
+               cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch - 1 );
+               cyber_out8( cdrv->mmio_base, COPFMT, 3 );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     cdev->v_dst = 1;
+}
+
+static inline void
+cyber5k_validate_src( CyberDriverData *cdrv,
+                      CyberDeviceData *cdev, CardState *state )
+{
+     CoreSurface   *source = state->source;
+
+     if (cdev->v_src)
+          return;
+
+     cdev->src_pixeloffset = state->src.offset /
+                             DFB_BYTES_PER_PIXEL(source->config.format);
+     cdev->src_pixelpitch  = state->src.pitch /
+                             DFB_BYTES_PER_PIXEL(source->config.format);
+
+     cyber_out16( cdrv->mmio_base, SRC1WIDTH,
+                  state->src.pitch /DFB_BYTES_PER_PIXEL(source->config.format) - 1);
+
+     cdev->v_src = 1;
+}
+
+static inline void
+cyber5k_validate_color( CyberDriverData *cdrv,
+                        CyberDeviceData *cdev, CardState *state )
+{
+     u32 fill_color = 0;
+
+     if (cdev->v_color)
+          return;
+
+     switch (state->destination->config.format) {
+          case DSPF_RGB16:
+               fill_color = PIXEL_RGB16( state->color.r,
+                                         state->color.g,
+                                         state->color.b );
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               fill_color = PIXEL_RGB32( state->color.r,
+                                         state->color.g,
+                                         state->color.b );
+               break;
+          case DSPF_ARGB:
+               fill_color = PIXEL_ARGB( state->color.a,
+                                        state->color.r,
+                                        state->color.g,
+                                        state->color.b );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     cyber_out32( cdrv->mmio_base, FCOLOR, fill_color );
+
+     cdev->v_src_colorkey = 0;
+
+     cdev->v_color = 1;
+}
+
+static inline void
+cyber5k_validate_src_colorkey( CyberDriverData *cdrv,
+                               CyberDeviceData *cdev, CardState *state )
+{
+     if (cdev->v_src_colorkey)
+          return;
+
+     cyber_out32( cdrv->mmio_base, FCOLOR, state->src_colorkey );
+     cyber_out32( cdrv->mmio_base, BCOLOR, state->src_colorkey );
+
+     cdev->v_color = 0;
+
+     cdev->v_src_colorkey = 1;
+}
+
+static inline void
+cyber5k_validate_blitting_cmd( CyberDriverData *cdrv,
+                               CyberDeviceData *cdev, CardState *state )
+{
+     if (cdev->v_blitting_cmd)
+          return;
+
+     cdev->blitting_cmd = COP_PXBLT | PAT_FIXFGD | FGD_IS_SRC1;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          cdev->blitting_cmd |= TRANS_ENABLE | TRANS_IS_SRC1 | TRANS_INVERT;
+
+     cdev->v_blitting_cmd = 1;
+}
+
+static void cyber5kSetState( void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                             CardState *state, DFBAccelerationMask accel )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+
+     if (state->mod_hw) {
+          if (state->mod_hw & SMF_DESTINATION)
+               cdev->v_dst = cdev->v_color = 0;
+          else if (state->mod_hw & SMF_COLOR)
+               cdev->v_color = 0;
+
+          if (state->mod_hw & SMF_SOURCE)
+               cdev->v_src = cdev->v_src_colorkey = 0;
+          else if (state->mod_hw & SMF_SRC_COLORKEY)
+               cdev->v_src_colorkey = 0;
+
+          if (state->mod_hw & SMF_BLITTING_FLAGS)
+               cdev->v_blitting_cmd = 0;
+     }
+
+     cyber5k_validate_dst( cdrv, cdev, state, funcs );
+
+     switch (accel) {
+          case DFXL_DRAWLINE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_FILLRECTANGLE:
+               cyber5k_validate_color( cdrv, cdev, state );
+
+               state->set = CYBER5K_DRAWING_FUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+               cyber5k_validate_src( cdrv, cdev, state );
+               cyber5k_validate_blitting_cmd( cdrv, cdev, state );
+
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    cyber5k_validate_src_colorkey( cdrv, cdev, state );
+
+               state->set = CYBER5K_BLITTING_FUNCTIONS;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function!" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static bool cyber5kFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     cyber_waitidle( cdrv, cdev );
+
+     cyber_out32( mmio, DSTPTR, cdev->dst_pixeloffset +
+                  rect->y * cdev->dst_pixelpitch +
+                  rect->x );
+
+     cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     return true;
+}
+
+static bool cyber5kFillRectangle24( void *drv, void *dev, DFBRectangle *rect )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     cyber_waitidle( cdrv, cdev );
+
+     cyber_out32( mmio, DSTPTR, (cdev->dst_pixeloffset +
+                                 rect->y * cdev->dst_pixelpitch +
+                                 rect->x) * 3 );
+     cyber_out8( mmio, DSTXROT, rect->x & 7 );
+
+     cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     return true;
+}
+
+static bool cyber5kDrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     u32 dst = cdev->dst_pixeloffset +
+               rect->y * cdev->dst_pixelpitch + rect->x;
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst );
+     cyber_out32( mmio, DIMW, 0 );
+     cyber_out32( mmio, DIMH, rect->h - 1 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst + rect->w - 1);
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst );
+     cyber_out32( mmio, DIMW, rect->w - 1 );
+     cyber_out32( mmio, DIMH, 0 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst + cdev->dst_pixelpitch * (rect->h - 1) );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     return true;
+}
+
+static bool cyber5kDrawRectangle24( void *drv, void *dev, DFBRectangle *rect )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     u32 dst = cdev->dst_pixeloffset +
+               (rect->y * cdev->dst_pixelpitch + rect->x) * 3;
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out8( mmio, DSTXROT, rect->x & 7 );
+     cyber_out32( mmio, DSTPTR, dst );
+     cyber_out32( mmio, DIMW, rect->w - 1 );
+     cyber_out32( mmio, DIMH, 0 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst + cdev->dst_pixelpitch * (rect->h-1) * 3 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR, dst );
+     cyber_out32( mmio, DIMW, 0 );
+     cyber_out32( mmio, DIMH, rect->h - 1 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out8( mmio, DSTXROT, (rect->x + rect->w - 1) & 7 );
+     cyber_out32( mmio, DSTPTR, dst + (rect->w-1) * 3 );
+     cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD );
+
+     return true;
+}
+
+static bool cyber5kDrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     u32 cmd = COP_LINE_DRAW | PAT_FIXFGD;
+
+     int dx;
+     int dy;
+
+     dx = line->x2 - line->x1;
+     dy = line->y2 - line->y1;
+
+     if (dx < 0) {
+          dx = -dx;
+          cmd |= DX_NEG;
+     }
+     if (dy < 0) {
+          dy = -dy;
+          cmd |= DY_NEG;
+     }
+     if (dx < dy) {
+          int tmp;
+          cmd |= YMAJOR;
+          tmp = dx;
+          dx = dy;
+          dy = tmp;
+     }
+
+     cyber_waitidle( cdrv, cdev );
+     cyber_out32( mmio, DSTPTR,
+                  cdev->dst_pixeloffset +
+                  line->y1 * cdev->dst_pixelpitch + line->x1);
+
+     cyber_out16( mmio, DIMW          , dx);
+     cyber_out16( mmio, K1          , 2*dy);
+     cyber_out16( mmio, ERRORTERM, 2*dy-dx);
+     cyber_out32( mmio, K2      ,2*(dy-dx));
+     cyber_out32( mmio, PIXOP        , cmd);
+
+     return true;
+}
+
+static bool cyber5kBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     u32 cmd = cdev->blitting_cmd;
+
+     cyber_waitidle( cdrv, cdev );
+
+     if (rect->x < dx) {
+          cmd |= DEC_X;
+
+          rect->x += rect->w - 1;
+          dx      += rect->w - 1;
+     }
+
+     if (rect->y < dy) {
+          cmd |= DEC_Y;
+
+          rect->y += rect->h - 1;
+          dy      += rect->h - 1;
+     }
+
+     cyber_out32( mmio, DSTPTR,
+                  cdev->dst_pixeloffset + dy * cdev->dst_pixelpitch + dx );
+     cyber_out32( mmio, SRC1PTR,
+                  cdev->src_pixeloffset +
+                  rect->y * cdev->src_pixelpitch + rect->x );
+     cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) );
+     cyber_out32( mmio, PIXOP      , cmd);
+
+     return true;
+}
+
+static bool cyber5kBlit24( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) drv;
+     CyberDeviceData *cdev = (CyberDeviceData*) dev;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     u32 cmd = cdev->blitting_cmd;
+     u32 src = 0;
+     u32 dst = 0;
+
+     cyber_waitidle( cdrv, cdev );
+
+     if (rect->x < dx) {
+          cmd |= DEC_X;
+
+          rect->x += rect->w - 1;
+          dx      += rect->w - 1;
+
+          src += 2;
+          dst += 2;
+     }
+
+     if (rect->y < dy) {
+          cmd |= DEC_Y;
+
+          rect->y += rect->h - 1;
+          dy      += rect->h - 1;
+     }
+
+     src += cdev->src_pixeloffset + rect->y * cdev->dst_pixelpitch + rect->x;
+     dst += cdev->dst_pixeloffset + dy * cdev->dst_pixelpitch + dx;
+
+     cyber_out32( mmio, DSTPTR     , src );
+     cyber_out32( mmio, SRC1PTR    , dst );
+     cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) );
+     cyber_out32( mmio, PIXOP      , cmd );
+
+     return true;
+}
+
+/* primary layer hooks */
+
+#define OSD_OPTIONS      (DLOP_ALPHACHANNEL | DLOP_SRC_COLORKEY | DLOP_OPACITY)
+
+DisplayLayerFuncs  oldPrimaryFuncs;
+void              *oldPrimaryDriverData;
+
+static DFBResult
+osdInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     DFBResult ret;
+
+     /* call the original initialization function first */
+     ret = oldPrimaryFuncs.InitLayer( layer,
+                                      oldPrimaryDriverData,
+                                      layer_data, description,
+                                      config, adjustment );
+     if (ret)
+          return ret;
+
+     /* set name */
+     snprintf(description->name,
+              DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "CyberPro OSD");
+
+     /* add support for options */
+     config->flags |= DLCONF_OPTIONS;
+
+     /* add some capabilities */
+     description->caps |= DLCAPS_ALPHACHANNEL |
+                          DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY;
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     DFBResult                  ret;
+     CoreLayerRegionConfigFlags fail = 0;
+     DFBDisplayLayerOptions     options = config->options;
+
+     /* remove options before calling the original function */
+     config->options = DLOP_NONE;
+
+     /* call the original function */
+     ret = oldPrimaryFuncs.TestRegion( layer, oldPrimaryDriverData,
+                                       layer_data, config, &fail );
+
+     /* check options if specified */
+     if (options) {
+          /* any unsupported option wanted? */
+          if (options & ~OSD_OPTIONS)
+               fail |= CLRCF_OPTIONS;
+
+          /* opacity and alpha channel cannot be used at once */
+          if ((options & (DLOP_OPACITY | DLOP_ALPHACHANNEL)) ==
+              (DLOP_OPACITY | DLOP_ALPHACHANNEL))
+          {
+               fail |= CLRCF_OPTIONS;
+          }
+     }
+
+     /* restore options */
+     config->options = options;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return ret;
+}
+
+static DFBResult
+osdSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     DFBResult ret;
+
+     /* call the original function */
+     ret = oldPrimaryFuncs.SetRegion( layer, oldPrimaryDriverData,
+                                      layer_data, region_data,
+                                      config, updated, surface,
+                                      palette, lock );
+     if (ret)
+          return ret;
+
+     /* select pixel based or global alpha */
+     if (config->options & DLOP_ALPHACHANNEL)
+          cyber_select_alpha_src( ALPHA_GRAPHICS );
+     else
+          cyber_select_alpha_src( ALPHA_REGISTER );
+
+     cyber_set_alpha_reg( config->opacity,
+                          config->opacity,
+                          config->opacity );
+
+     /* source color keying */
+     cyber_select_RAM_addr( RAM_CPU );
+     cyber_set_alpha_RAM_reg( 0, 0x00, 0x00, 0x00 );
+     cyber_select_magic_alpha_src( ALPHA_LOOKUP );
+     cyber_enable_magic_alpha_blend( config->options & DLOP_SRC_COLORKEY );
+
+     /* FIXME: hardcoded black color key */
+     cyber_set_magic_match_reg( 0, 0, 0 );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs newPrimaryFuncs = {
+     .InitLayer  = osdInitLayer,
+
+     .TestRegion = osdTestRegion,
+     .SetRegion  = osdSetRegion,
+};
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_IGS_CYBER2000:
+          case FB_ACCEL_IGS_CYBER2010:
+          case FB_ACCEL_IGS_CYBER5000:
+#ifdef FB_ACCEL_IGS_CYBER5K
+          case FB_ACCEL_IGS_CYBER5K:          /* CyberPro 5xxx */
+#endif
+               return 1;
+     }
+
+     return 0;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+               "Cyber Pro Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 4;
+
+     info->driver_data_size = sizeof (CyberDriverData);
+     info->device_data_size = sizeof (CyberDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) driver_data;
+
+     /* gain access to memory mapped registers */
+     cdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!cdrv->mmio_base)
+          return DFB_IO;
+
+     /* HACK */
+     cyber_mmio = cdrv->mmio_base;
+
+     /* fill acceleration function table */
+     funcs->EngineSync    = cyber5kEngineSync;
+     funcs->CheckState    = cyber5kCheckState;
+     funcs->SetState      = cyber5kSetState;
+
+     funcs->FillRectangle = cyber5kFillRectangle;
+     funcs->DrawRectangle = cyber5kDrawRectangle;
+     funcs->DrawLine      = cyber5kDrawLine;
+     funcs->Blit          = cyber5kBlit;
+
+     /* install primary layer hooks */
+     dfb_layers_hook_primary( device, driver_data, &newPrimaryFuncs,
+                              &oldPrimaryFuncs, &oldPrimaryDriverData );
+
+     /* add the video underlay */
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_IGS_CYBER5000:
+#ifdef FB_ACCEL_IGS_CYBER5K
+          case FB_ACCEL_IGS_CYBER5K:          /* CyberPro 5xxx */
+#endif
+               dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                                    driver_data, &cyberUnderlayFuncs );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) driver_data;
+     volatile u8     *mmio = cdrv->mmio_base;
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Cyber Pro" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "TVIA" );
+
+
+     device_info->caps.flags    = 0;
+     device_info->caps.accel    = CYBER5K_DRAWING_FUNCTIONS |
+                                  CYBER5K_BLITTING_FUNCTIONS;
+     device_info->caps.drawing  = CYBER5K_DRAWING_FLAGS;
+     device_info->caps.blitting = CYBER5K_BLITTING_FLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 16;
+     device_info->limits.surface_pixelpitch_alignment = 4;
+
+
+     /* set fifo policy at startup */
+     cyber_grphw(0x74, 0x1b);
+     cyber_grphw(0x75, 0x1e);
+
+     cyber_grphw(0xD9, 0x0f);
+     cyber_grphw(0xDA, 0x1b);
+     cyber_grphw(0xDD, 0x00);
+
+     cyber_seqw(0xD9, 0x0f);
+     cyber_seqw(0xDA, 0x1b);
+     cyber_seqw(0xDD, 0x00);
+
+
+
+     cyber_out8 (mmio, COPFLAGS, 1);
+     cyber_out8 (mmio, FMIX , 0x03);
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     CyberDriverData *cdrv = (CyberDriverData*) driver_data;
+
+     dfb_gfxcard_unmap_mmio( device, cdrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h
new file mode 100755
index 0000000..82aaabf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h
@@ -0,0 +1,63 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___CYBER5K_H__
+#define ___CYBER5K_H__
+
+#include <dfb_types.h>
+#include <core/layers.h>
+
+/* HACK */
+extern volatile u8 *cyber_mmio;
+
+
+typedef struct {
+     volatile u8 *mmio_base;
+} CyberDriverData;
+
+typedef struct {
+     /* state validation */
+     int v_dst;
+     int v_src;
+     int v_color;
+     int v_src_colorkey;
+     int v_blitting_cmd;
+
+     /* stored values */
+     u32 dst_pixeloffset;
+     u32 dst_pixelpitch;
+     u32 src_pixeloffset;
+     u32 src_pixelpitch;
+
+     u32 blitting_cmd;
+} CyberDeviceData;
+
+
+extern DisplayLayerFuncs cyberUnderlayFuncs;
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c
new file mode 100755
index 0000000..4862293
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c
@@ -0,0 +1,260 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 "cyber5k.h"
+#include "cyber5k_alpha.h"
+#include "regs.h"
+
+void cyber_cleanup_alpha(void)
+{
+	int i;
+
+	cyber_grphw(0xfa, 0);
+	for (i=0; i<16; i++) {
+		if (i == 0x0A) {/*Don't clean up SyncLock video path if there is one*/
+			cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+			cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x08);
+		}
+		else {
+			cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+			cyber_out8(cyber_mmio, SEQDATA, 0x00);
+		}
+	}
+
+	cyber_grphw(0xfa, 8);
+	for (i=0; i<16; i++) {
+		if(i==0x0F) {/*Just in case there is a SyncLock video*/
+			cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+			cyber_out8(cyber_mmio, SEQDATA, 0x00);
+			cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0xC0);
+		}
+		else {
+			cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+			cyber_out8(cyber_mmio, SEQDATA, 0x00);
+		}
+	}
+
+	cyber_grphw(0xfa, 0x10);
+	for (i=0; i<16; i++) {
+		cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+		cyber_out8(cyber_mmio, SEQDATA, 0x00);
+	}
+
+	cyber_grphw(0xfa, 0x18);
+	for (i=0; i<16; i++) {
+		cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+		cyber_out8(cyber_mmio, SEQDATA, 0x00);
+	}
+
+	cyber_grphw(0xfa, 0x20);
+	for (i=0; i<16; i++) {
+		cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i);
+		cyber_out8(cyber_mmio, SEQDATA, 0x00);
+	}
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0xA6);
+	/*for video capture*/
+	cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0xF0);
+
+#if 0
+	/*for 8-bit Index mode*/
+	if(bEnabled8Bit) /*if we are in 8-bit alpha-blending mode, remember to disable it*/
+		EnablePaletteMode(0);
+#endif
+	
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 0x80);
+	cyber_out8(cyber_mmio, GRAINDEX, 0xe0);
+	cyber_out8(cyber_mmio, GRADATA, cyber_in8(cyber_mmio, 0x03cf) | 0x04);
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 0x00);
+}
+
+void cyber_enable_alpha(int enable)
+{
+	cyber_grphw(0xfa, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4b);
+	if (enable)
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x80));
+     else
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0x7F));
+}
+
+void cyber_enable_fullscreen_alpha(int enable)
+{
+	cyber_grphw(0xfa, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4b);
+	if (enable)
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x40));
+     else
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0xBF));
+}
+
+void cyber_select_blend_src1(int src)
+{
+	cyber_grphw(0xfa, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x49);
+	cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x03) | src);
+}
+
+void cyber_select_blend_src2(int src)
+{
+	cyber_grphw(0xfa, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4d);
+	cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x30) | (src << 4));
+	if(src == SRC2_OVERLAY1) { /*if source is Overlay one only, disable Overlay 2*/
+		cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+		cyber_out8(cyber_mmio, GRADATA, 0x08);
+		cyber_out8(cyber_mmio, SEQINDEX, 0x4f);
+		cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x08);
+		cyber_out8(cyber_mmio, GRADATA, 0x00);
+	}
+}
+
+void cyber_select_alpha_src(int src)
+{
+	cyber_grphw(0xfa, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x49);
+	cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x60) | (src << 5));
+	/*if alpha source comes form Overlay2, we need to disable Overlay2 color key function*/
+	if(src == ALPHA_OVERLAY2) {
+		/*Disable Overlay 2 in Source B path*/
+		cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+		cyber_out8(cyber_mmio, GRADATA, 0x08);
+		cyber_out8(cyber_mmio, SEQINDEX, 0x4f);
+		cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x08);
+		/*Disable V2 generally      */
+		cyber_out8(cyber_mmio, GRADATA, 0x20);
+		cyber_out8(cyber_mmio, SEQINDEX, 0x47);
+		cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x02);
+		cyber_out8(cyber_mmio, GRADATA, 0x00);
+	}
+}
+
+void cyber_set_alpha_reg(unsigned char r, unsigned char g, unsigned char b)
+{
+	cyber_grphw(0xfa, 0);
+	
+	cyber_seqw(0x46, r);
+	cyber_seqw(0x47, g);
+	cyber_seqw(0x48, b);
+}
+
+
+void cyber_set_magic_match_reg( unsigned char bR, unsigned char bG, unsigned char bB )
+{
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 8);
+	/*Disable range feature first*/
+	cyber_out8(cyber_mmio, SEQINDEX, 0x46);
+	cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x7F);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x40);
+	cyber_out8(cyber_mmio, SEQDATA, bR);
+	cyber_out8(cyber_mmio, SEQINDEX, 0x41);
+	cyber_out8(cyber_mmio, SEQDATA, bG);
+	cyber_out8(cyber_mmio, SEQINDEX, 0x42);
+	cyber_out8(cyber_mmio, SEQDATA, bB);
+}
+
+void cyber_set_alpha_RAM_reg( unsigned char bIndex, unsigned char bR, unsigned char bG, unsigned char bB)
+{
+	unsigned char bData;
+	
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x49);
+	bData = cyber_in8(cyber_mmio, SEQDATA);
+	cyber_out8(cyber_mmio, SEQDATA, 0x18);   /*select CPU to write*/
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4e);   /*enable index of alpha RAM R*/
+	cyber_out8(cyber_mmio, SEQDATA, 0x20+bIndex);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4f);   /*RAM data port*/
+	cyber_out8(cyber_mmio, SEQDATA, bR);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4e);   /*enable index of alpha RAM G*/
+	cyber_out8(cyber_mmio, SEQDATA, 0x40+bIndex);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4f);   /*RAM data port*/
+	cyber_out8(cyber_mmio, SEQDATA, bG);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4e);   /*enable index of alpha RAM B*/
+	cyber_out8(cyber_mmio, SEQDATA, 0x80+bIndex);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4f);   /*RAM data port*/
+	cyber_out8(cyber_mmio, SEQDATA, bB);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x49);
+	cyber_out8(cyber_mmio, SEQDATA, bData);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x4e);   /*Set index of alpha RAM */
+	cyber_out8(cyber_mmio, SEQDATA, bIndex);
+}
+
+void cyber_select_RAM_addr( unsigned char bRAMAddrSel )
+{
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 0);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x49);
+	cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x18) | (bRAMAddrSel << 3));
+}
+
+void cyber_enable_magic_alpha_blend( unsigned char enable )
+{
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 8);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x46);
+	if (enable)
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x01));
+	else
+		cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0xFE));
+		
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 0x20);
+	cyber_out8(cyber_mmio, SEQINDEX, 0x47);
+	cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x7F);
+	cyber_out8(cyber_mmio, GRADATA, 0x00);
+}
+
+void cyber_select_magic_alpha_src( unsigned char bAlphaSrc )
+{
+	cyber_out8(cyber_mmio, GRAINDEX, 0xfa);
+	cyber_out8(cyber_mmio, GRADATA, 8);
+
+	cyber_out8(cyber_mmio, SEQINDEX, 0x46);
+	cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x0C) | (bAlphaSrc << 2));
+}
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h
new file mode 100755
index 0000000..f3f635c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h
@@ -0,0 +1,64 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 CYBER5KFB_ALPHA_H
+#define CYBER5KFB_ALPHA_H
+
+#include "mmio.h"
+
+#define SRC1_GRAPHICS	0
+#define SRC1_OVERLAY1	1
+#define SRC1_OVERLAY2	2
+
+#define SRC2_OVERLAY1	0
+#define SRC2_OVERLAY2	1
+#define SRC2_GRAPHICS	2
+
+#define ALPHA_GRAPHICS	0
+#define ALPHA_OVERLAY2	1
+#define ALPHA_LOOKUP	2
+#define ALPHA_REGISTER	3
+
+#define RAM_CPU			3
+
+void cyber_cleanup_alpha(void);
+void cyber_enable_alpha(int enable);
+void cyber_enable_fullscreen_alpha(int enable);
+void cyber_cleanup_alpha(void);
+void cyber_select_blend_src1(int src);
+void cyber_select_blend_src2(int src);
+void cyber_select_alpha_src(int src);
+void cyber_set_alpha_reg(unsigned char r, unsigned char g, unsigned char b);
+
+void cyber_select_RAM_addr( unsigned char bRAMAddrSel );
+void cyber_set_alpha_RAM_reg( unsigned char bIndex, unsigned char bR, unsigned char bG, unsigned char bB);
+void cyber_select_magic_alpha_src( unsigned char bAlphaSrc );
+void cyber_enable_magic_alpha_blend( unsigned char enable );
+void cyber_set_magic_match_reg( unsigned char bR, unsigned char bG, unsigned char bB );
+
+#endif /* CYBER5KFB_ALPHA_H */
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c
new file mode 100755
index 0000000..b4638df
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c
@@ -0,0 +1,376 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <core/coredefs.h>
+
+#include "cyber5k.h"
+#include "cyber5k_overlay.h"
+#include "regs.h"
+#include "mmio.h"
+
+static int overlay_byte_per_pixel = 2;
+static int overlay_init = 0;
+
+static unsigned char savedReg74, savedReg75; /*FIFO control registers for 2D Graphics*/
+static unsigned char savedRegD9[2], savedRegDA[2], savedRegDD[2]; /*FIFO control registers for Overlay*/
+/*Following is our FIFO policy number, should be programmed to
+0x3CE/0x74, 0x3CE/0x75, 0x3CE(0x3C4)/0xD9, 0x3CE(0x3C4)/0xDA,
+0x3CE(0x3c4)/0xDD respectively in order to get a best memory bandwidth.
+Current value is a group of experence value based on 70MHZ EDO/SG RAM.*/
+static unsigned char bFIFOPolicyNum[5] = {0x10, 0x10, 0x1C, 0x1C, 0x06};
+
+
+static void
+cyber_videoreg_mask( unsigned char index, unsigned char value, unsigned char mask )
+{
+     unsigned char tmp;
+
+     cyber_out8( cyber_mmio, GRAINDEX, index );
+     tmp = cyber_in8( cyber_mmio, GRADATA );
+     tmp &= mask;
+     tmp |= value;
+     cyber_out8( cyber_mmio, GRADATA, tmp );
+}
+
+static void
+cyber_seqreg_mask( unsigned char index, unsigned char value, unsigned char mask )
+{
+     unsigned char tmp;
+
+     cyber_out8( cyber_mmio, SEQINDEX, index );
+     tmp = cyber_in8( cyber_mmio, SEQDATA );
+
+     tmp &= mask;
+     tmp |= value;
+     cyber_out8( cyber_mmio, SEQDATA, tmp );
+}
+
+static void
+cyber_overlayreg_mask( unsigned char index, unsigned char value, unsigned char mask ) {
+     unsigned char tmp;
+
+     cyber_out8( cyber_mmio, GRAINDEX, index );
+     tmp = cyber_in8( cyber_mmio, GRADATA );
+
+     tmp &= mask;
+     tmp |= value;
+     cyber_out8(cyber_mmio, GRADATA, tmp);
+}
+
+void cyber_cleanup_overlay(void)
+{
+     /*restore FIFO control regs*/
+     cyber_seqreg_mask(0xA7, 0x0, ~0x5);
+
+
+     if (!overlay_init)
+          return;
+     overlay_init = 0;
+
+
+     cyber_grphw(0x74, savedReg74);
+     cyber_grphw(0x75, savedReg75);
+
+     cyber_grphw(0xD9, savedRegD9[0]);
+     cyber_grphw(0xDA, savedRegDA[0]);
+     cyber_grphw(0xDD, savedRegDD[0]);
+
+     cyber_seqw(0xD9, savedRegD9[1]);
+     cyber_seqw(0xDA, savedRegDA[1]);
+     cyber_seqw(0xDD, savedRegDD[1]);
+}
+
+void cyber_init_overlay(void)
+{
+     /*Clear Overlay path first*/
+     cyber_grphw(DISP_CTL_I, 0x00);
+
+     /* Video Display Vertical Starting Line (may not need initiate here)*/
+     cyber_grphw(DEST_RECT_TOP_L, 0x00);
+     cyber_grphw(DEST_RECT_TOP_H, 0x00);
+
+     /* Overlay Vertical DDA Increment Value*/
+     cyber_grphw(DDA_Y_INC_L, 0x00);
+     cyber_grphw(DDA_Y_INC_H, 0x10);
+
+     /* Video Memory Starting Address*/
+     cyber_grphw(MEMORY_START_L, 0x00);
+     cyber_grphw(MEMORY_START_M, 0x0f);
+     cyber_grphw(MEMORY_START_H, 0x03);  /* Temporary fixed to 0x30f00 = 0xc3c00 >> 2*/
+     /* 0x3c00 = 0x300*0x14 = 768*20*/
+
+     /* Video Display Horizontal Starting Pixel -- may not need init here*/
+     cyber_grphw(DEST_RECT_LEFT_L, 0x20);
+     cyber_grphw(DEST_RECT_LEFT_H, 0x00);
+
+     /* Video Display Horizontal Ending Pixel -- may not need init here*/
+     cyber_grphw(DEST_RECT_RIGHT_L, 0x60);
+     cyber_grphw(DEST_RECT_RIGHT_H, 0x01);
+
+     /* Video Display Vertical Ending Line -- may not need init here*/
+     cyber_grphw(DEST_RECT_BOTTOM_L, 0xe0);
+     cyber_grphw(DEST_RECT_BOTTOM_H, 0x00);
+
+     /* Video Color Compare Register*/
+     cyber_grphw(COLOR_CMP_RED,  0x00);
+     cyber_grphw(COLOR_CMP_GREEN,0x00);
+     cyber_grphw(COLOR_CMP_BLUE, 0x00);
+
+     /* Video Horizontal DDA Increment Value*/
+     cyber_grphw(DDA_X_INC_L, 0x00);
+     cyber_grphw(DDA_X_INC_H, 0x10);
+
+     /* Video Format Control*/
+     cyber_grphw(VIDEO_FORMAT, 0x00);
+
+     /* Video Misc Control*/
+     cyber_grphw(MISC_CTL_I, 0x00);
+
+     cyber_grphw(MISC_CTL_I, 0x01); /* Video Misc Control*/
+
+     /*default to colorkey*/
+     cyber_grphw(DISP_CTL_I, 0x04 );
+
+#ifdef NTSCTVOUT /*if your TV output mode is NTSC*/
+     cyber_seqreg_mask(0xA6, 0x20, ~0x30);
+#else  /*if your TV output mode is PAL*/
+     cyber_seqreg_mask(0xA6, 0x30, ~0x30);
+#endif
+
+
+     if (overlay_init)
+          return;
+     overlay_init = 1;
+
+
+
+/* the following code is commented out, since saved values are not clean if */
+/* DirectFB crashed while underlay was enabled, hardcoded bootup            */
+/* values instead (see below)                                               */
+
+/*
+     cyber_out8(cyber_mmio, GRAINDEX, 0x74);
+     savedReg74 = cyber_in8(cyber_mmio, GRADATA);
+     cyber_out8(cyber_mmio, GRAINDEX, 0x75);
+     savedReg75 = cyber_in8(cyber_mmio, GRADATA);
+
+     cyber_out8(cyber_mmio, GRAINDEX, 0xD9);
+     savedRegD9[0] = cyber_in8(cyber_mmio, GRADATA);
+     cyber_out8(cyber_mmio, GRAINDEX, 0xDA);
+     savedRegDA[0] = cyber_in8(cyber_mmio, GRADATA);
+     cyber_out8(cyber_mmio, GRAINDEX, 0xDD);
+     savedRegDD[0] = cyber_in8(cyber_mmio, GRADATA);
+
+     cyber_out8(cyber_mmio, SEQINDEX, 0xD9);
+     savedRegD9[1] = cyber_in8(cyber_mmio, SEQDATA);
+     cyber_out8(cyber_mmio, SEQINDEX, 0xDA);
+     savedRegDA[1] = cyber_in8(cyber_mmio, SEQDATA);
+     cyber_out8(cyber_mmio, SEQINDEX, 0xDD);
+     savedRegDD[1] = cyber_in8(cyber_mmio, SEQDATA);
+     */
+
+
+     savedReg74    = 0x1b;
+     savedReg74    = 0x1e;
+
+     savedRegD9[0] = 0x0f;
+     savedRegDA[0] = 0x1b;
+     savedRegDD[0] = 0x00;
+
+     savedRegD9[1] = 0x0f;
+     savedRegDA[1] = 0x1b;
+     savedRegDD[1] = 0x00;
+}
+
+void cyber_change_overlay_fifo(void)
+{
+     cyber_grphw(0x74, bFIFOPolicyNum[0]);
+     cyber_grphw(0x75, bFIFOPolicyNum[1]);
+     cyber_grphw(0xD9, bFIFOPolicyNum[2]);
+     cyber_grphw(0xDA, bFIFOPolicyNum[3]);
+
+     cyber_videoreg_mask(0xA6, 0x08, ~0x08);
+     cyber_videoreg_mask(0xF1, 0x40, (unsigned char)(~0xC0));
+     cyber_overlayreg_mask(FIFO_CTL_I, bFIFOPolicyNum[4] & 0x05, ~0x05);
+     cyber_overlayreg_mask(FIFO_CTL_I, 0x2, ~0x02);
+}
+
+void cyber_set_overlay_format(int format) {
+     switch (format) {
+          case OVERLAY_YUV422:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x00, 0xF8 );
+               overlay_byte_per_pixel = 2;
+               break;
+          case OVERLAY_RGB555:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x01, 0xF8 );
+               overlay_byte_per_pixel = 2;
+               break;
+          case OVERLAY_RGB565:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x02, 0xF8 );
+               overlay_byte_per_pixel = 2;
+               break;
+          case OVERLAY_RGB888:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x03, 0xF8 );
+               overlay_byte_per_pixel = 3;
+               break;
+          case OVERLAY_RGB8888:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x04, 0xF8 );
+               overlay_byte_per_pixel = 4;
+               break;
+          case OVERLAY_RGB8:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x05, 0xF8 );
+               overlay_byte_per_pixel = 1;
+               break;
+          case OVERLAY_RGB4444:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x06, 0xF8 );
+               overlay_byte_per_pixel = 2;
+               break;
+          case OVERLAY_RGB8T:
+               cyber_overlayreg_mask( VIDEO_FORMAT, 0x07, 0xF8 );
+               overlay_byte_per_pixel = 1;
+               break;
+     }
+}
+
+void cyber_set_overlay_mode(int mode)
+{
+     switch (mode) {
+          case OVERLAY_COLORKEY:
+               cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0xFD );
+               break;
+          case OVERLAY_WINDOWKEY:
+          default:
+               cyber_overlayreg_mask( DISP_CTL_I, 0x02, 0xFD );
+               break;
+     }
+}
+
+void cyber_set_overlay_srcaddr(int addr, int x, int y, int width, int pitch)
+{
+     unsigned char bHigh;
+     int wByteFetch;
+
+     addr += y * pitch  +  x * overlay_byte_per_pixel;
+     addr >>= 2;
+
+     /*playback start addr*/
+     cyber_grphw( MEMORY_START_L, (unsigned char)( addr & 0x0000FF) );
+     cyber_grphw( MEMORY_START_M, (unsigned char)((addr & 0x00FF00) >> 8) );
+     cyber_grphw( MEMORY_START_H, (unsigned char)((addr & 0xFF0000) >> 16) );
+
+     /* pitch is a multiple of 64 bits*/
+     pitch >>= 3; /* 64 bit address field*/
+     wByteFetch = (width * overlay_byte_per_pixel + 7) >> 3;
+
+     bHigh = (unsigned char)(pitch >> 8) & 0x0F;
+     bHigh = bHigh | (((unsigned char)(wByteFetch >> 8)) << 4 );
+
+     cyber_grphw( MEMORY_PITCH_L, (unsigned char)(pitch) );
+     cyber_grphw( MEMORY_PITCH_H, bHigh );
+
+     cyber_grphw( MEMORY_OFFSET_PHASE, (unsigned char)(wByteFetch) );
+
+     if (width > 720)  /*Turn off interpolation*/
+          cyber_overlayreg_mask( DISP_CTL_I, 0x20, 0xDF );
+     else { /*Turn off interpolation*/
+          if (width > 360) { /* Y Only*/
+               cyber_seqreg_mask(0xA6, 0x40, ~0x40);
+          }
+          else {
+               cyber_seqreg_mask(0xA6, 0x00, ~0x40);
+          }
+
+          cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0xDF );
+     }
+}
+
+void cyber_set_overlay_window(int left, int top, int right, int bottom)
+{
+     cyber_grphw( DEST_RECT_LEFT_L,  (unsigned char)(left      ) );
+     cyber_grphw( DEST_RECT_LEFT_H,  (unsigned char)(left  >> 8) );
+     cyber_grphw( DEST_RECT_RIGHT_L, (unsigned char)(right     ) );
+     cyber_grphw( DEST_RECT_RIGHT_H, (unsigned char)(right >> 8) );
+
+     cyber_grphw( DEST_RECT_TOP_L,    (unsigned char)(top        ) );
+     cyber_grphw( DEST_RECT_TOP_H,    (unsigned char)(top    >> 8) );
+     cyber_grphw( DEST_RECT_BOTTOM_L, (unsigned char)(bottom     ) );
+     cyber_grphw( DEST_RECT_BOTTOM_H, (unsigned char)(bottom >> 8) );
+}
+
+void cyber_set_overlay_scale( unsigned char bEnableBob, int wSrcXExt, int wDstXExt, int wSrcYExt, int wDstYExt )
+{
+     int dwScale;
+
+     cyber_grphw( DDA_X_INIT_L, 0x0 );     /* set to 0x800;*/
+     cyber_grphw( DDA_X_INIT_H, 0x8 );
+     if ( wSrcXExt == wDstXExt )
+          dwScale = 0x1000;
+     else
+          dwScale = ( wSrcXExt * 0x1000 ) / wDstXExt;
+     cyber_grphw( DDA_X_INC_L, (unsigned char)( dwScale & 0x00FF) );
+     cyber_grphw( DDA_X_INC_H, (unsigned char)((dwScale & 0xFF00) >> 8) );
+
+     cyber_grphw( DDA_Y_INIT_L, 0x0 );     /* set to 0x800;*/
+     cyber_grphw( DDA_Y_INIT_H, 0x8 );
+
+     if ( wSrcYExt == wDstYExt )
+          dwScale = 0x1000;
+     else
+          dwScale = ( wSrcYExt * 0x1000 ) / wDstYExt;
+
+
+     if (bEnableBob == 0) {/*Disable Bob mode*/
+          cyber_seqreg_mask(0xA7, 0x0, ~0x5); /*Bob/Weave disable*/
+     }
+     else {/*Enable Bob mode*/
+          wSrcYExt = wSrcYExt / 2;
+	     if (wSrcYExt == wDstYExt)
+	          dwScale = 0x1000;
+	     else
+	          dwScale = ( wSrcYExt * 0x1000 ) / wDstYExt;
+	     if (dwScale <= 0x815 && dwScale >= 0x7eb) {
+	          cyber_seqreg_mask(0xA7, 0x5, ~0x5); /*Bob/Weave enable*/
+	     }
+	     else {
+	          cyber_seqreg_mask(0xA7, 0x4, ~0x5); /*Bob/Weave enable*/
+	     }
+	}
+
+     cyber_grphw( DDA_Y_INC_L, (unsigned char)( dwScale & 0x00FF) );
+     cyber_grphw( DDA_Y_INC_H, (unsigned char)((dwScale & 0xFF00) >> 8) );
+}
+
+void cyber_enable_overlay(int enable)
+{
+     if (enable)
+          cyber_overlayreg_mask( DISP_CTL_I, 0x84, (unsigned char)(~0x84) );
+     else
+          cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0x7F );  /* Disable Vafc !!!*/
+}
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h
new file mode 100755
index 0000000..bb24499
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h
@@ -0,0 +1,92 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 CYBER5KFB_OVERLAY_H
+#define CYBER5KFB_OVERLAY_H
+
+#include "regs.h"
+
+#define OVERLAY_YUV422		0	   /*captured data is YUV 422 format*/
+#define OVERLAY_RGB555		1
+#define OVERLAY_RGB565		2
+#define OVERLAY_RGB888		3
+#define OVERLAY_RGB8888		4
+#define OVERLAY_RGB8		5
+#define OVERLAY_RGB4444		6
+#define OVERLAY_RGB8T		7
+
+#define OVERLAY_COLORKEY	0	   /*Overlayed window is of color keying*/
+#define OVERLAY_WINDOWKEY	1	   /*Overlayed window is of window keying*/
+
+#define OVERLAY_WEAVEMODE	0
+#define OVERLAY_BOBMODE		1
+
+
+#define MEMORY_START_L			0xC0
+#define MEMORY_START_M			0xC1
+#define MEMORY_START_H			0xC2
+#define MEMORY_PITCH_L			0xC3
+#define MEMORY_PITCH_H			0xC4
+#define DEST_RECT_LEFT_L		0xC5
+#define DEST_RECT_LEFT_H		0xC6
+#define DEST_RECT_RIGHT_L		0xC7
+#define DEST_RECT_RIGHT_H		0xC8
+#define DEST_RECT_TOP_L			0xC9
+#define DEST_RECT_TOP_H			0xCA
+#define DEST_RECT_BOTTOM_L		0xCB
+#define DEST_RECT_BOTTOM_H		0xCC
+#define MEMORY_OFFSET_PHASE		0xCD
+#define COLOR_CMP_RED			0xCE
+#define COLOR_CMP_GREEN			0xCF
+#define COLOR_CMP_BLUE			0xD0
+#define DDA_X_INIT_L			0xD1
+#define DDA_X_INIT_H			0xD2
+#define DDA_X_INC_L				0xD3
+#define DDA_X_INC_H				0xD4
+#define DDA_Y_INIT_L			0xD5
+#define DDA_Y_INIT_H			0xD6
+#define DDA_Y_INC_L				0xD7
+#define DDA_Y_INC_H				0xD8
+#define FIFO_TIMING_CTL_L		0xD9
+#define FIFO_TIMING_CTL_H		0xDA
+#define VIDEO_FORMAT			0xDB
+#define DISP_CTL_I				0xDC
+#define FIFO_CTL_I				0xDD
+#define MISC_CTL_I				0xDE
+
+void cyber_cleanup_overlay(void);
+void cyber_init_overlay(void);
+void cyber_enable_overlay(int enable);
+void cyber_change_overlay_fifo(void);
+void cyber_set_overlay_format(int format);
+void cyber_set_overlay_mode(int mode);
+void cyber_set_overlay_srcaddr(int addr, int x, int y, int width, int pitch);
+void cyber_set_overlay_window(int left, int top, int right, int bottom);
+void cyber_set_overlay_scale( unsigned char bEnableBob, int wSrcXExt, int wDstXExt, int wSrcYExt, int wDstYExt );
+
+#endif /* CYBER5KFB_OVERLAY_H */
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c
new file mode 100755
index 0000000..588f111
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c
@@ -0,0 +1,301 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/surface.h>
+
+#include "cyber5k.h"
+#include "cyber5k_alpha.h"
+#include "cyber5k_overlay.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+} CyberUnderlayLayerData;
+
+static void udl_set_all     ( CyberDriverData        *cdrv,
+                              CyberUnderlayLayerData *cudl,
+                              CoreLayerRegionConfig  *config,
+                              CoreSurface            *surface,
+                              CoreSurfaceBufferLock  *lock );
+static void udl_set_location( CyberDriverData        *cdrv,
+                              CyberUnderlayLayerData *cudl,
+                              CoreLayerRegionConfig  *config,
+                              CoreSurface            *surface );
+
+#define CYBER_UNDERLAY_SUPPORTED_OPTIONS     (DLOP_NONE)
+
+/**********************/
+
+static int
+udlLayerDataSize( void )
+{
+     return sizeof(CyberUnderlayLayerData);
+}
+
+static DFBResult
+udlInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *default_config,
+              DFBColorAdjustment         *default_adj )
+{
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL |
+                         DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY |
+                         DLCAPS_SCREEN_LOCATION;
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE |
+                         DLTF_BACKGROUND;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "CyberPro Underlay" );
+
+     /* fill out the default configuration */
+     default_config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT |
+                                   DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                                   DLCONF_OPTIONS;
+     default_config->width       = 768;
+     default_config->height      = 576;
+     default_config->pixelformat = DSPF_RGB16;
+     default_config->buffermode  = DLBM_FRONTONLY;
+     default_config->options     = DLOP_NONE;
+
+     /* initialize registers */
+     cyber_init_overlay();
+
+     /* workaround */
+     cyber_change_overlay_fifo();
+     cyber_cleanup_overlay();
+     cyber_init_overlay();
+
+     return DFB_OK;
+}
+
+static DFBResult
+udlTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     /* check for unsupported options */
+     if (config->options & ~CYBER_UNDERLAY_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_RGB332:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_YUY2:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     /* check width */
+     if (config->width > 1024 || config->width < 4)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 1024 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+udlSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     CyberDriverData        *cdrv = (CyberDriverData*) driver_data;
+     CyberUnderlayLayerData *cudl = (CyberUnderlayLayerData*) layer_data;
+
+     /* remember configuration */
+     cudl->config = *config;
+
+     /* set up layer */
+     udl_set_all( cdrv, cudl, config, surface, lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+udlRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     /* disable and clean up */
+     cyber_enable_overlay(0);
+     cyber_cleanup_alpha();
+     cyber_cleanup_overlay();
+
+     return DFB_OK;
+}
+
+static DFBResult
+udlFlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     CyberDriverData        *cdrv = (CyberDriverData*) driver_data;
+     CyberUnderlayLayerData *cudl = (CyberUnderlayLayerData*) layer_data;
+
+     dfb_surface_flip( surface, false );
+
+     udl_set_all( cdrv, cudl, &cudl->config, surface, lock );
+
+     return DFB_OK;
+}
+
+
+DisplayLayerFuncs cyberUnderlayFuncs = {
+     .LayerDataSize = udlLayerDataSize,
+     .InitLayer     = udlInitLayer,
+
+     .TestRegion    = udlTestRegion,
+     .SetRegion     = udlSetRegion,
+     .RemoveRegion  = udlRemoveRegion,
+     .FlipRegion    = udlFlipRegion,
+};
+
+
+/* internal */
+
+static void udl_set_all( CyberDriverData        *cdrv,
+                         CyberUnderlayLayerData *cudl,
+                         CoreLayerRegionConfig  *config,
+                         CoreSurface            *surface,
+                         CoreSurfaceBufferLock  *lock )
+{
+     /* set the pixel format */
+     switch (surface->config.format) {
+          case DSPF_RGB332:
+               cyber_set_overlay_format (OVERLAY_RGB8);
+               break;
+
+          case DSPF_ARGB1555:
+               cyber_set_overlay_format (OVERLAY_RGB555);
+               break;
+
+          case DSPF_RGB16:
+               cyber_set_overlay_format (OVERLAY_RGB565);
+               break;
+
+          case DSPF_RGB24:
+               cyber_set_overlay_format (OVERLAY_RGB888);
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               cyber_set_overlay_format (OVERLAY_RGB8888);
+               break;
+
+          case DSPF_YUY2:
+               cyber_set_overlay_format (OVERLAY_YUV422);
+               break;
+
+          default:
+               D_BUG("unexpected pixelformat");
+               break;
+     }
+
+     cyber_set_overlay_mode( OVERLAY_WINDOWKEY );
+
+     /* set address */
+     cyber_set_overlay_srcaddr( lock->offset, 0, 0,
+                                surface->config.size.w, lock->pitch );
+
+     /* set location and scaling */
+     udl_set_location( cdrv, cudl, config, surface );
+
+     /* tune fifo */
+     cyber_change_overlay_fifo();
+
+     /* set up alpha blending */
+     cyber_enable_alpha( 1 );
+     cyber_enable_fullscreen_alpha( 1 );
+     cyber_select_blend_src1( SRC1_GRAPHICS );
+     cyber_select_blend_src2( SRC2_OVERLAY1 );
+
+     /* FIXME: find out why the opacity can't be set outside of this function */
+     cyber_set_alpha_reg( 0xcc, 0xcc, 0xcc );
+		
+     /* turn it on */
+     cyber_enable_overlay(1);
+}
+
+static void udl_set_location( CyberDriverData        *cdrv,
+                              CyberUnderlayLayerData *cudl,
+                              CoreLayerRegionConfig  *config,
+                              CoreSurface            *surface )
+{
+     /* set location */
+     cyber_set_overlay_window( config->dest.x, config->dest.y,
+                               config->dest.x + config->dest.w - 1,
+                               config->dest.y + config->dest.h - 1 );
+
+     /* set scaling */
+     cyber_set_overlay_scale( surface->config.size.h == 576 ? /* HACK: support interlaced video */
+                              OVERLAY_BOBMODE : OVERLAY_WEAVEMODE,
+                              surface->config.size.w, config->dest.w,
+                              surface->config.size.h, config->dest.h );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/mmio.h b/Source/DirectFB/gfxdrivers/cyber5k/mmio.h
new file mode 100755
index 0000000..59f9a8d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/mmio.h
@@ -0,0 +1,126 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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  __CYBER5K_MMIO__
+#define  __CYBER5K_MMIO__
+
+#include <dfb_types.h>
+#include "cyber5k.h"
+#include "regs.h"
+
+static inline void
+cyber_out8(volatile u8 *mmioaddr, u32 reg, u8 value)
+{
+     *((volatile u8*)(mmioaddr+reg)) = value;
+}
+
+static inline void
+cyber_out16(volatile u8 *mmioaddr, u32 reg, u16 value)
+{
+     *((volatile u16*)(mmioaddr+reg)) = value;
+}
+
+static inline void
+cyber_out32(volatile u8 *mmioaddr, u32 reg, u32 value)
+{
+     *((volatile u32*)(mmioaddr+reg)) = value;
+}
+
+static inline u8
+cyber_in8(volatile u8 *mmioaddr, u32 reg)
+{
+     return *((volatile u8*)(mmioaddr+reg));
+}
+
+static inline u16
+cyber_in16(volatile u8 *mmioaddr, u32 reg)
+{
+     return *((volatile u16*)(mmioaddr+reg));
+}
+
+static inline u32
+cyber_in32(volatile u8 *mmioaddr, u32 reg)
+{
+     return *((volatile u32*)(mmioaddr+reg));
+}
+
+/* Wait for idle accelerator */
+static inline void
+cyber_waitidle( CyberDriverData *cdrv, CyberDeviceData *cdev )
+{
+/*     while (cyber_in8(mmioaddr, COP_STAT) & (CMDFF_FULL | HOSTFF_NOTEMPTY)) {
+          grodis = 0;
+     }*/
+     while ( cyber_in8(cdrv->mmio_base, COP_STAT) & (COP_BUSY|CMDFF_FULL|HOSTFF_NOTEMPTY) );
+}
+
+/* ------------------------------------------------------------------------ */
+
+static inline void cyber_crtcw(int reg, int val)
+{
+     cyber_out8( cyber_mmio, CRTINDEX, reg );
+     cyber_out8( cyber_mmio, CRTDATA, val );
+}
+
+static inline void cyber_grphw(int reg, int val)
+{
+     cyber_out8( cyber_mmio, GRAINDEX, reg );
+     cyber_out8( cyber_mmio, GRADATA, val );
+}
+
+static inline unsigned int cyber_grphr(int reg)
+{
+     cyber_out8( cyber_mmio, GRAINDEX, reg );
+     return cyber_in8( cyber_mmio, GRADATA );
+}
+
+static inline void cyber_attrw(int reg, int val)
+{
+     cyber_in8( cyber_mmio, ATTRRESET );
+     cyber_out8( cyber_mmio, ATTRINDEX, reg );
+     cyber_in8( cyber_mmio, ATTRDATAR );
+     cyber_out8( cyber_mmio, ATTRDATAW, val );
+}
+
+static inline void cyber_seqw(int reg, int val)
+{
+     cyber_out8( cyber_mmio, SEQINDEX, reg );
+     cyber_out8( cyber_mmio, SEQDATA, val );
+}
+
+static inline void cyber_tvw(int reg, int val)
+{
+     cyber_out8( cyber_mmio, 0xb0000 + reg, val );
+}
+
+static inline unsigned int cyber_tvr(int reg)
+{
+     return cyber_in8( cyber_mmio, 0xb0000 + reg );
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/cyber5k/regs.h b/Source/DirectFB/gfxdrivers/cyber5k/regs.h
new file mode 100755
index 0000000..7ae038a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/cyber5k/regs.h
@@ -0,0 +1,387 @@
+#ifndef REGS_H
+#define REGS_H
+
+/*
+ *  COP MMIO definition
+ *
+ */
+
+#define OPAQUE          0
+#define TRANSPARENT     1
+
+#define TRANSPARENT_SRC         1
+#define TRANSPARENT_DST         2
+#define SRC_FROM_SYS            4
+#define PAT_IS_MONO             8
+
+#define  R2_ZERO        0x00
+#define  R2_S_AND_D     0x01
+#define  R2_S_AND_ND    0x02
+#define  R2_S           0x03
+#define  R2_NS_AND_D    0x04
+#define  R2_D           0x05
+#define  R2_S_XOR_D     0x06
+#define  R2_S_OR_D      0x07
+#define  R2_NS_AND_ND   0x08
+#define  R2_S_XOR_ND    0x09
+#define  R2_ND          0x0A
+#define  R2_S_OR_ND     0x0B
+#define  R2_NS          0x0C
+#define  R2_NS_OR_D     0x0D
+#define  R2_NS_OR_ND    0x0E
+#define  R2_ONE         0x0F
+
+#define  R3_S           0xF0
+#define  R3_P           0xCC
+
+
+#define COP_BASE        0xBF000
+#define COP_STAT        0x11 + COP_BASE
+    #define HBLTW_NOTREADY      0x01
+    #define HOSTFF_NOTEMPTY     0x02
+    #define CMDFF_FULL          0x04
+    #define SUSPEND_COP         0x08
+    #define COP_STOPPED         0x10
+    #define TERMINATE_COP       0x20
+    #define HBLT_NOTACKZ        0x40
+    #define COP_BUSY            0x80
+
+#define SRC1WIDTH               0x18 + COP_BASE
+#define COPFMT                  0x1C + COP_BASE
+#define ERRORTERM               0x20 + COP_BASE
+#define K1                      0x24 + COP_BASE
+#define K2                      0x28 + COP_BASE
+#define FMIX                    0x48 + COP_BASE
+#define BMIX                    0x49 + COP_BASE
+#define FCOLOR                  0x58 + COP_BASE
+#define BCOLOR                  0x5C + COP_BASE
+#define HEIGHTWIDTH             0x60 + COP_BASE
+#define DIMW                    0x60 + COP_BASE
+#define DIMH                    0x62 + COP_BASE
+#define SRC1BASE                0x70 + COP_BASE
+#define DSTXROT                 0x78 + COP_BASE
+#define DSTYROT                 0x7A + COP_BASE
+#define PATYROT                 0x7A + COP_BASE
+#define PIXOP                   0x7C + COP_BASE
+#define PIXOP_LO                0x7C + COP_BASE
+#define PIXOP_HI                0x7E + COP_BASE
+
+    /* Direction */
+    #define YMAJOR                      0x1
+    #define DEC_Y                       0x2
+    #define DY_NEG                      0x2
+    #define DEC_X                       0x4
+    #define DX_NEG                      0x4
+    #define ERRORTERM_POS               0x8
+
+    /* Draw mode */
+    #define DRAW_1ST_PIXEL_NULL         0x10
+    #define DRAW_LAST_PIXEL_NULL        0x20
+    #define DRAW_AREA_BOUND             0x30
+
+    /* transparent mode */
+    #define TRANS_IS_SRC1               0x0000
+    #define TRANS_IS_SRC2               0x0100
+    #define TRANS_IS_DST                0x0200
+    #define TRANS_INVERT                0x0400
+    #define TRANS_ENABLE                0x0800
+
+    /* Cop Operation */
+    #define PAT_OPAQUE_TEXTOUT          0x1000
+    #define PAT_OPAQUE_TILE             0x2000
+    #define PAT_OPAQUE_LINE             0x3000
+    #define PAT_TRANS_TEXTOUT           0x5000
+    #define PAT_TRANS_TILE              0x6000
+    #define PAT_TRANS_LINE              0x7000
+    #define PAT_FIXFGD                  0x8000
+    #define PAT_COLOR_TILE              0x9000
+
+    /* Host-Mem Direction */
+    #define HOST_READ_SRC1              0x10000
+    #define HOST_WRITE_SRC1             0x20000
+    #define HOST_WRITE_SRC2             0x30000
+
+    /* Source2 Select */
+    #define SRC2_IS_COLOR               0x000000
+    #define SRC2_IS_OPAQUE_MONO         0x100000
+    #define SRC2_IS_FGDCOLOR            0x200000
+    #define SRC2_IS_TRANS_MONO          0x500000
+
+    /* Cop Command */
+    #define COP_STEP_DRAW               0x4000000
+    #define COP_LINE_DRAW               0x5000000
+    #define COP_PXBLT                   0x8000000
+    #define COP_INVERT_PXBLT            0x9000000
+    #define COP_PXBLT256                0xB000000
+
+    /* Fore&Back */
+    #define FGD_IS_SRC1                 0x20000000
+    #define FGD_IS_COLOR                0x00000000
+    #define BGD_IS_SRC1                 0x80000000
+    #define BGD_IS_COLOR                0x00000000
+
+#define SRC2WIDTH               0x118 + COP_BASE
+#define COPFLAGS                0x130 + COP_BASE
+    #define FMONO_ENABLE        0x10
+    #define FMONO_DISABLE       0xEF
+    #define COP_1WS             0x4
+
+#define FASTMONOSIZE            0x13C + COP_BASE
+#define PATXROT                 0x150 + COP_BASE
+#define SRC1PTR                 0x170 + COP_BASE
+#define SRC2PTR                 0x174 + COP_BASE
+#define DSTPTR                  0x178 + COP_BASE
+#define DSTWIDTH                0x218 + COP_BASE
+
+/* ---------------------------------------------------------------------- */
+
+#define   PORT46E8     0x46E8 /* R   */
+#define   PORT102      0x102  /* R/W */
+#define   MISCREAD     0x3CC  /* R   */
+#define   MISCWRITE    0x3C2  /* W   */
+#define   SEQINDEX     0x3C4  /* R/W */
+#define   SEQDATA      0x3C5  /* R/W */
+#define   CRTINDEX     0x3D4  /* R/W */
+#define   CRTDATA      0x3D5  /* R/W */
+#define   ATTRRESET    0x3DA  /* R/W */
+#define   ATTRINDEX    0x3C0  /* R/W */
+#define   ATTRDATAW    0x3C0  /* W, Attrib write data port */
+#define   ATTRDATAR    0x3C1  /* R, Attrib read data port  */
+#define   GRAINDEX     0x3CE  /* R/W */
+#define   GRADATA      0x3CF  /* R/W */
+#define   RAMDACMASK   0x3C6  /* R/W, Mask register */
+#define   RAMDACINDEXR 0x3C7  /* R/W, RAM read index port  */
+#define   RAMDACINDEXW 0x3C8  /* R/W, RAM write index port */
+#define   RAMDACDATA   0x3C9  /* R/W, RAM Date port */
+#define   IGS3CEINDEX  0x3CE  /* R/W */
+#define   IGS3CFDATA   0x3CF  /* R/W */
+#define   IGS3D4INDEX  0x3D4  /* R/W */
+#define   IGS3D5DATA   0x3D5  /* R/W */
+#define   IGS3C4INDEX  0x3C4  /* R/W */
+#define   IGS3C5DATA   0x3C5  /* R/W */
+
+#define   SEQCOUNT  0x05
+#define   MISCCOUNT 0x01
+#define   CRTCOUNT  0x19
+#define   ATTRCOUNT 0x15
+#define   GRACOUNT  0x09
+#define   EXTPARTIALCOUNT 8  /* define 8 extended regs for color depth change */
+
+#define   SREGCOUNT SEQCOUNT+MISCCOUNT+CRTCOUNT+ATTRCOUNT+GRACOUNT
+#define   EREGCOUNT EXTPARTIALCOUNT * 2 + 1
+
+
+#define PIXFORMAT_8BPP		0
+#define PIXFORMAT_16BPP		1
+#define PIXFORMAT_24BPP		2
+
+#define VISUALID_256		1
+#define VISUALID_64K		2
+#define VISUALID_16M		4
+#define VISUALID_32K		6
+
+#define FUNC_CTL		0x3c
+#define FUNC_CTL_EXTREGENBL		0x80	/* enable access to 0xbcxxx		*/
+
+#define BIU_BM_CONTROL		0x3e
+#define BIU_BM_CONTROL_ENABLE		0x01	/* enable bus-master			*/
+#define BIU_BM_CONTROL_BURST		0x02	/* enable burst				*/
+#define BIU_BM_CONTROL_BACK2BACK	0x04	/* enable back to back			*/
+
+#define X_V2_VID_MEM_START	0x40
+#define X_V2_VID_SRC_WIDTH	0x43
+#define X_V2_X_START		0x45
+#define X_V2_X_END		0x47
+#define X_V2_Y_START		0x49
+#define X_V2_Y_END		0x4b
+#define X_V2_VID_SRC_WIN_WIDTH	0x4d
+
+#define Y_V2_DDA_X_INC		0x43
+#define Y_V2_DDA_Y_INC		0x47
+#define Y_V2_VID_FIFO_CTL	0x49
+#define Y_V2_VID_FMT		0x4b
+#define Y_V2_VID_DISP_CTL1	0x4c
+#define Y_V2_VID_FIFO_CTL1	0x4d
+
+#define J_X2_VID_MEM_START	0x40
+#define J_X2_VID_SRC_WIDTH	0x43
+#define J_X2_X_START		0x47
+#define J_X2_X_END		0x49
+#define J_X2_Y_START		0x4b
+#define J_X2_Y_END		0x4d
+#define J_X2_VID_SRC_WIN_WIDTH	0x4f
+
+#define K_X2_DDA_X_INIT		0x40
+#define K_X2_DDA_X_INC		0x42
+#define K_X2_DDA_Y_INIT		0x44
+#define K_X2_DDA_Y_INC		0x46
+#define K_X2_VID_FMT		0x48
+#define K_X2_VID_DISP_CTL1	0x49
+
+#define K_CAP_X2_CTL1		0x49
+
+#define CAP_X_START		0x60
+#define CAP_X_END		0x62
+#define CAP_Y_START		0x64
+#define CAP_Y_END		0x66
+#define CAP_DDA_X_INIT		0x68
+#define CAP_DDA_X_INC		0x6a
+#define CAP_DDA_Y_INIT		0x6c
+#define CAP_DDA_Y_INC		0x6e
+
+#define MEM_CTL2		0x72
+#define MEM_CTL2_SIZE_2MB		0x01
+#define MEM_CTL2_SIZE_4MB		0x02
+#define MEM_CTL2_SIZE_MASK		0x03
+#define MEM_CTL2_64BIT			0x04
+
+#define EXT_FIFO_CTL		0x74
+
+#define CAP_PIP_X_START		0x80
+#define CAP_PIP_X_END		0x82
+#define CAP_PIP_Y_START		0x84
+#define CAP_PIP_Y_END		0x86
+
+#define CAP_NEW_CTL1		0x88
+
+#define CAP_NEW_CTL2		0x89
+
+#define BM_CTRL0		0x9c
+#define BM_CTRL1		0x9d
+
+#define CAP_MODE1		0xa4
+#define CAP_MODE1_8BIT			0x01	/* enable 8bit capture mode		*/
+#define CAP_MODE1_CCIR656		0x02	/* CCIR656 mode				*/
+#define CAP_MODE1_IGNOREVGT		0x04	/* ignore VGT				*/
+#define CAP_MODE1_ALTFIFO		0x10	/* use alternate FIFO for capture	*/
+#define CAP_MODE1_SWAPUV		0x20	/* swap UV bytes			*/
+#define CAP_MODE1_MIRRORY		0x40	/* mirror vertically			*/
+#define CAP_MODE1_MIRRORX		0x80	/* mirror horizontally			*/
+
+#define CAP_MODE2		0xa5
+
+#define Y_TV_CTL		0xae
+
+#define EXT_MEM_START		0xc0		/* ext start address 21 bits		*/
+#define HOR_PHASE_SHIFT		0xc2		/* high 3 bits				*/
+#define EXT_SRC_WIDTH		0xc3		/* ext offset phase  10 bits		*/
+#define EXT_SRC_HEIGHT		0xc4		/* high 6 bits				*/
+#define EXT_X_START		0xc5		/* ext->screen, 16 bits			*/
+#define EXT_X_END		0xc7		/* ext->screen, 16 bits			*/
+#define EXT_Y_START		0xc9		/* ext->screen, 16 bits			*/
+#define EXT_Y_END		0xcb		/* ext->screen, 16 bits			*/
+#define EXT_SRC_WIN_WIDTH	0xcd		/* 8 bits				*/
+#define EXT_COLOUR_COMPARE	0xce		/* 24 bits				*/
+#define EXT_DDA_X_INIT		0xd1		/* ext->screen 16 bits			*/
+#define EXT_DDA_X_INC		0xd3		/* ext->screen 16 bits			*/
+#define EXT_DDA_Y_INIT		0xd5		/* ext->screen 16 bits			*/
+#define EXT_DDA_Y_INC		0xd7		/* ext->screen 16 bits			*/
+
+#define EXT_VID_FIFO_CTL	0xd9
+
+#define EXT_VID_FMT		0xdb
+#define EXT_VID_FMT_YUV422		0x00	/* formats - does this cause conversion? */
+#define EXT_VID_FMT_RGB555		0x01
+#define EXT_VID_FMT_RGB565		0x02
+#define EXT_VID_FMT_RGB888_24		0x03
+#define EXT_VID_FMT_RGB888_32		0x04
+#define EXT_VID_FMT_DUP_PIX_ZOON	0x08	/* duplicate pixel zoom			*/
+#define EXT_VID_FMT_MOD_3RD_PIX		0x20	/* modify 3rd duplicated pixel		*/
+#define EXT_VID_FMT_DBL_H_PIX		0x40	/* double horiz pixels			*/
+#define EXT_VID_FMT_UV128		0x80	/* UV data offset by 128		*/
+
+#define EXT_VID_DISP_CTL1	0xdc
+#define EXT_VID_DISP_CTL1_INTRAM	0x01	/* video pixels go to internal RAM	*/
+#define EXT_VID_DISP_CTL1_IGNORE_CCOMP	0x02	/* ignore colour compare registers	*/
+#define EXT_VID_DISP_CTL1_NOCLIP	0x04	/* do not clip to 16235,16240		*/
+#define EXT_VID_DISP_CTL1_UV_AVG	0x08	/* U/V data is averaged			*/
+#define EXT_VID_DISP_CTL1_Y128		0x10	/* Y data offset by 128			*/
+#define EXT_VID_DISP_CTL1_VINTERPOL_OFF	0x20	/* vertical interpolation off		*/
+#define EXT_VID_DISP_CTL1_FULL_WIN	0x40	/* video out window full		*/
+#define EXT_VID_DISP_CTL1_ENABLE_WINDOW	0x80	/* enable video window			*/
+
+#define EXT_VID_FIFO_CTL1	0xdd
+
+#define VFAC_CTL1		0xe8
+#define VFAC_CTL1_CAPTURE		0x01	/* capture enable			*/
+#define VFAC_CTL1_VFAC_ENABLE		0x02	/* vfac enable				*/
+#define VFAC_CTL1_FREEZE_CAPTURE	0x04	/* freeze capture			*/
+#define VFAC_CTL1_FREEZE_CAPTURE_SYNC	0x08	/* sync freeze capture			*/
+#define VFAC_CTL1_VALIDFRAME_SRC	0x10	/* select valid frame source		*/
+#define VFAC_CTL1_PHILIPS		0x40	/* select Philips mode			*/
+#define VFAC_CTL1_MODVINTERPOLCLK	0x80	/* modify vertical interpolation clocl	*/
+
+#define VFAC_CTL2		0xe9
+#define VFAC_CTL2_INVERT_VIDDATAVALID	0x01	/* invert video data valid		*/
+#define VFAC_CTL2_INVERT_GRAPHREADY	0x02	/* invert graphic ready output sig	*/
+#define VFAC_CTL2_INVERT_DATACLK	0x04	/* invert data clock signal		*/
+#define VFAC_CTL2_INVERT_HSYNC		0x08	/* invert hsync input			*/
+#define VFAC_CTL2_INVERT_VSYNC		0x10	/* invert vsync input			*/
+#define VFAC_CTL2_INVERT_FRAME		0x20	/* invert frame odd/even input		*/
+#define VFAC_CTL2_INVERT_BLANK		0x40	/* invert blank output			*/
+#define VFAC_CTL2_INVERT_OVSYNC		0x80	/* invert other vsync input		*/
+
+#define VFAC_CTL3		0xea
+#define VFAC_CTL3_CAP_IRQ		0x40	/* enable capture interrupt		*/
+
+#define CAP_MEM_START		0xeb		/* 18 bits				*/
+#define CAP_MAP_WIDTH		0xed		/* high 6 bits				*/
+#define CAP_PITCH		0xee		/* 8 bits				*/
+
+#define CAP_CTL_MISC		0xef
+#define CAP_CTL_MISC_HDIV		0x01
+#define CAP_CTL_MISC_HDIV4		0x02
+#define CAP_CTL_MISC_ODDEVEN		0x04
+#define CAP_CTL_MISC_HSYNCDIV2		0x08
+#define CAP_CTL_MISC_SYNCTZHIGH		0x10
+#define CAP_CTL_MISC_SYNCTZOR		0x20
+#define CAP_CTL_MISC_DISPUSED		0x80
+
+#define REG_BANK		0xfa
+#define REG_BANK_X			0x00
+#define REG_BANK_Y			0x01
+#define REG_BANK_W			0x02
+#define REG_BANK_T			0x03
+#define REG_BANK_J			0x04
+#define REG_BANK_K			0x05
+
+/*
+ * Bus-master
+ */
+#define BM_VID_ADDR_LOW		0xbc040
+#define BM_VID_ADDR_HIGH	0xbc044
+#define BM_ADDRESS_LOW		0xbc080
+#define BM_ADDRESS_HIGH		0xbc084
+#define BM_LENGTH		0xbc088
+#define BM_CONTROL		0xbc08c
+#define BM_CONTROL_ENABLE		0x01	/* enable transfer			*/
+#define BM_CONTROL_IRQEN		0x02	/* enable IRQ at end of transfer	*/
+#define BM_CONTROL_INIT			0x04	/* initialise status & count		*/
+#define BM_COUNT		0xbc090		/* read-only				*/
+
+/*
+ * Graphics Co-processor
+ */
+#define CO_CMD_L_PATTERN_FGCOL	0x8000
+#define CO_CMD_L_INC_LEFT	0x0004
+#define CO_CMD_L_INC_UP		0x0002
+
+#define CO_CMD_H_SRC_PIXMAP	0x2000
+#define CO_CMD_H_BLITTER	0x0800
+
+#define CO_REG_CONTROL		0xbf011
+#define CO_REG_SRC_WIDTH	0xbf018
+#define CO_REG_PIX_FORMAT	0xbf01c
+#define CO_REG_FORE_MIX		0xbf048
+#define CO_REG_FOREGROUND	0xbf058
+#define CO_REG_WIDTH		0xbf060
+#define CO_REG_HEIGHT		0xbf062
+#define CO_REG_X_PHASE		0xbf078
+#define CO_REG_CMD_L		0xbf07c
+#define CO_REG_CMD_H		0xbf07e
+#define CO_REG_SRC_PTR		0xbf170
+#define CO_REG_DEST_PTR		0xbf178
+#define CO_REG_DEST_WIDTH	0xbf218
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/Makefile.am b/Source/DirectFB/gfxdrivers/davinci/Makefile.am
new file mode 100755
index 0000000..d291092
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/Makefile.am
@@ -0,0 +1,77 @@
+## Makefile.am for DirectFB/src/core/gfxcards/davinci
+
+EXTRA_DIST = \
+	directfbrc				\
+	Makefile.kernel				\
+	kernel-module/c64x/Makefile		\
+	kernel-module/c64x/c64x.c		\
+	kernel-module/Makefile			\
+	kernel-module/include/linux/c64x.h	\
+	patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch
+
+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	\
+	-I$(srcdir)/kernel-module/include
+
+bin_PROGRAMS = c64xdump
+
+lib_LTLIBRARIES = libdavinci_c64x.la
+
+davinci_LTLIBRARIES = libdirectfb_davinci.la
+
+if BUILD_STATIC
+davinci_DATA = $(davinci_LTLIBRARIES:.la=.o)
+endif
+
+davincidir = $(MODULEDIR)/gfxdrivers
+includedir = @INCLUDEDIR@
+includelinuxdir = @INCLUDEDIR@/linux
+
+include_HEADERS = \
+	davincifb.h		\
+	davinci_c64x.h		\
+	davinci_gfxdriver.h
+
+includelinux_HEADERS = \
+	kernel-module/include/linux/c64x.h
+
+libdavinci_c64x_la_SOURCES =	\
+	davinci_c64x.c
+
+libdavinci_c64x_la_LIBADD =	\
+	$(top_builddir)/lib/direct/libdirect.la
+
+libdirectfb_davinci_la_SOURCES =	\
+	davinci_2d.c		\
+	davinci_2d.h		\
+	davinci_gfxdriver.c	\
+	davinci_osd.c		\
+	davinci_osd.h		\
+	davinci_osd_pool.c	\
+	davinci_osd_pool.h	\
+	davinci_screen.c	\
+	davinci_screen.h	\
+	davinci_video.c		\
+	davinci_video.h		\
+	davinci_video_pool.c	\
+	davinci_video_pool.h
+
+libdirectfb_davinci_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_davinci_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(builddir)/libdavinci_c64x.la
+
+c64xdump_SOURCES = c64xdump.c
+c64xdump_LDADD   = $(top_builddir)/lib/direct/libdirect.la
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/gfxdrivers/davinci/Makefile.in b/Source/DirectFB/gfxdrivers/davinci/Makefile.in
new file mode 100755
index 0000000..9e46327
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/Makefile.in
@@ -0,0 +1,771 @@
+# 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@
+bin_PROGRAMS = c64xdump$(EXEEXT)
+DIST_COMMON = $(include_HEADERS) $(includelinux_HEADERS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = gfxdrivers/davinci
+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)$(davincidir)" "$(DESTDIR)$(libdir)" \
+	"$(DESTDIR)$(bindir)" "$(DESTDIR)$(davincidir)" \
+	"$(DESTDIR)$(includedir)" "$(DESTDIR)$(includelinuxdir)"
+davinciLTLIBRARIES_INSTALL = $(INSTALL)
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(davinci_LTLIBRARIES) $(lib_LTLIBRARIES)
+libdavinci_c64x_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la
+am_libdavinci_c64x_la_OBJECTS = davinci_c64x.lo
+libdavinci_c64x_la_OBJECTS = $(am_libdavinci_c64x_la_OBJECTS)
+libdirectfb_davinci_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(builddir)/libdavinci_c64x.la
+am_libdirectfb_davinci_la_OBJECTS = davinci_2d.lo davinci_gfxdriver.lo \
+	davinci_osd.lo davinci_osd_pool.lo davinci_screen.lo \
+	davinci_video.lo davinci_video_pool.lo
+libdirectfb_davinci_la_OBJECTS = $(am_libdirectfb_davinci_la_OBJECTS)
+libdirectfb_davinci_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_davinci_la_LDFLAGS) $(LDFLAGS) -o $@
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_c64xdump_OBJECTS = c64xdump.$(OBJEXT)
+c64xdump_OBJECTS = $(am_c64xdump_OBJECTS)
+c64xdump_DEPENDENCIES = $(top_builddir)/lib/direct/libdirect.la
+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 = $(libdavinci_c64x_la_SOURCES) \
+	$(libdirectfb_davinci_la_SOURCES) $(c64xdump_SOURCES)
+DIST_SOURCES = $(libdavinci_c64x_la_SOURCES) \
+	$(libdirectfb_davinci_la_SOURCES) $(c64xdump_SOURCES)
+davinciDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(davinci_DATA)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+includelinuxHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(includelinux_HEADERS)
+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@
+EXTRA_DIST = \
+	directfbrc				\
+	Makefile.kernel				\
+	kernel-module/c64x/Makefile		\
+	kernel-module/c64x/c64x.c		\
+	kernel-module/Makefile			\
+	kernel-module/include/linux/c64x.h	\
+	patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch
+
+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	\
+	-I$(srcdir)/kernel-module/include
+
+lib_LTLIBRARIES = libdavinci_c64x.la
+davinci_LTLIBRARIES = libdirectfb_davinci.la
+@BUILD_STATIC_TRUE@davinci_DATA = $(davinci_LTLIBRARIES:.la=.o)
+davincidir = $(MODULEDIR)/gfxdrivers
+includelinuxdir = @INCLUDEDIR@/linux
+include_HEADERS = \
+	davincifb.h		\
+	davinci_c64x.h		\
+	davinci_gfxdriver.h
+
+includelinux_HEADERS = \
+	kernel-module/include/linux/c64x.h
+
+libdavinci_c64x_la_SOURCES = \
+	davinci_c64x.c
+
+libdavinci_c64x_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la
+
+libdirectfb_davinci_la_SOURCES = \
+	davinci_2d.c		\
+	davinci_2d.h		\
+	davinci_gfxdriver.c	\
+	davinci_osd.c		\
+	davinci_osd.h		\
+	davinci_osd_pool.c	\
+	davinci_osd_pool.h	\
+	davinci_screen.c	\
+	davinci_screen.h	\
+	davinci_video.c		\
+	davinci_video.h		\
+	davinci_video_pool.c	\
+	davinci_video_pool.h
+
+libdirectfb_davinci_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_davinci_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(builddir)/libdavinci_c64x.la
+
+c64xdump_SOURCES = c64xdump.c
+c64xdump_LDADD = $(top_builddir)/lib/direct/libdirect.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/davinci/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/davinci/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-davinciLTLIBRARIES: $(davinci_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(davincidir)" || $(MKDIR_P) "$(DESTDIR)$(davincidir)"
+	@list='$(davinci_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(davinciLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(davincidir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(davinciLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(davincidir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-davinciLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(davinci_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(davincidir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(davincidir)/$$p"; \
+	done
+
+clean-davinciLTLIBRARIES:
+	-test -z "$(davinci_LTLIBRARIES)" || rm -f $(davinci_LTLIBRARIES)
+	@list='$(davinci_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
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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
+libdavinci_c64x.la: $(libdavinci_c64x_la_OBJECTS) $(libdavinci_c64x_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libdavinci_c64x_la_OBJECTS) $(libdavinci_c64x_la_LIBADD) $(LIBS)
+libdirectfb_davinci.la: $(libdirectfb_davinci_la_OBJECTS) $(libdirectfb_davinci_la_DEPENDENCIES) 
+	$(libdirectfb_davinci_la_LINK) -rpath $(davincidir) $(libdirectfb_davinci_la_OBJECTS) $(libdirectfb_davinci_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+c64xdump$(EXEEXT): $(c64xdump_OBJECTS) $(c64xdump_DEPENDENCIES) 
+	@rm -f c64xdump$(EXEEXT)
+	$(LINK) $(c64xdump_OBJECTS) $(c64xdump_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c64xdump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_2d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_c64x.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_gfxdriver.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_osd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_osd_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_screen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/davinci_video_pool.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-davinciDATA: $(davinci_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(davincidir)" || $(MKDIR_P) "$(DESTDIR)$(davincidir)"
+	@list='$(davinci_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(davinciDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(davincidir)/$$f'"; \
+	  $(davinciDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(davincidir)/$$f"; \
+	done
+
+uninstall-davinciDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(davinci_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(davincidir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(davincidir)/$$f"; \
+	done
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
+	done
+install-includelinuxHEADERS: $(includelinux_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includelinuxdir)" || $(MKDIR_P) "$(DESTDIR)$(includelinuxdir)"
+	@list='$(includelinux_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includelinuxHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includelinuxdir)/$$f'"; \
+	  $(includelinuxHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includelinuxdir)/$$f"; \
+	done
+
+uninstall-includelinuxHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(includelinux_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includelinuxdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includelinuxdir)/$$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) $(PROGRAMS) $(DATA) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+	for dir in "$(DESTDIR)$(davincidir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(davincidir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includelinuxdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-davinciLTLIBRARIES clean-generic \
+	clean-libLTLIBRARIES 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-davinciDATA install-davinciLTLIBRARIES \
+	install-includeHEADERS install-includelinuxHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-davinciDATA \
+	uninstall-davinciLTLIBRARIES uninstall-includeHEADERS \
+	uninstall-includelinuxHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-davinciLTLIBRARIES clean-generic clean-libLTLIBRARIES \
+	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-binPROGRAMS install-data install-data-am \
+	install-davinciDATA install-davinciLTLIBRARIES install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-includeHEADERS \
+	install-includelinuxHEADERS install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-davinciDATA uninstall-davinciLTLIBRARIES \
+	uninstall-includeHEADERS uninstall-includelinuxHEADERS \
+	uninstall-libLTLIBRARIES
+
+%.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/davinci/Makefile.kernel b/Source/DirectFB/gfxdrivers/davinci/Makefile.kernel
new file mode 100755
index 0000000..f58d56e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/Makefile.kernel
@@ -0,0 +1,6 @@
+CROSS_COMPILE = arm-v4t-linux-gnueabi-
+KERNEL_SOURCE = $(shell pwd)/../../../linux-davinci-2.6
+KERNEL_BUILD  = $(KERNEL_SOURCE)
+
+all:
+	$(MAKE) -C kernel-module KERNEL_SOURCE=$(KERNEL_SOURCE) KERNEL_BUILD=$(KERNEL_BUILD)
diff --git a/Source/DirectFB/gfxdrivers/davinci/c64xdump.c b/Source/DirectFB/gfxdrivers/davinci/c64xdump.c
new file mode 100755
index 0000000..f70c8e0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/c64xdump.c
@@ -0,0 +1,117 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#include <linux/c64x.h>
+
+#include <direct/clock.h>
+#include <direct/messages.h>
+#include <direct/system.h>
+#include <direct/util.h>
+
+#define C64X_DEVICE  "/dev/c64x"
+#define C64X_DEVICE0 "/dev/c64x0"
+#define C64X_QLEN   direct_page_align( sizeof(c64xTaskControl) )
+#define C64X_MLEN   direct_page_align( 0x2000000 )
+
+static const char *state_names[] = { "DONE", "ERROR", "TODO", "RUNNING" };
+
+// manual (examples)
+//#define DAVINCI_C64X_IDLE_MAX    (567087584/10)
+//#define DAVINCI_C64X_IDLE_MAX    (59457217)
+
+// auto
+#ifndef DAVINCI_C64X_IDLE_MAX
+#define DAVINCI_C64X_IDLE_MAX    (0)
+#endif
+
+int main (int argc, char *argv[])
+{
+     int              fd;
+     void            *mem;
+     c64xTaskControl *ctl;
+     c64xTask        *queue;
+     int              idle_max   = DAVINCI_C64X_IDLE_MAX;
+     uint32_t         idle_last  = 0;
+     long long        stamp_last = 0;
+
+     fd = direct_try_open( C64X_DEVICE, C64X_DEVICE0, O_RDONLY, true );
+     if (fd < 0)
+          return -1;
+
+     ctl = mmap( NULL, C64X_QLEN, PROT_READ, MAP_SHARED, fd, 0 );
+     if (ctl == MAP_FAILED) {
+          D_PERROR( "C64XDump: Mapping %lu bytes at %lu via '%s' failed!\n", C64X_QLEN, 0UL, C64X_DEVICE );
+          close( fd );
+          return -2;
+     }
+
+     mem = mmap( NULL, C64X_MLEN, PROT_READ, MAP_SHARED, fd, C64X_QLEN );
+     if (mem == MAP_FAILED) {
+          D_PERROR( "C64XDump: Mapping %lu bytes at %lu via '%s' failed!\n", C64X_MLEN, C64X_QLEN, C64X_DEVICE );
+          munmap( (void*)ctl, C64X_QLEN );
+          close( fd );
+          return -2;
+     }
+
+     queue = mem + (0x8fe00000 - 0x8e000000);
+
+     while (1) {
+          usleep( 250000 );
+
+          int       loadx   = 1000;
+          uint32_t  counter = ctl->idlecounter;
+          long long stamp   = direct_clock_get_abs_micros();
+          uint32_t  ql_dsp  = ctl->QL_dsp;
+          uint32_t  ql_arm  = ctl->QL_arm;
+          uint32_t  qh_dsp  = ctl->QH_dsp;
+          uint32_t  qh_arm  = ctl->QH_arm;
+          uint32_t  task    = queue[ql_dsp & C64X_QUEUE_MASK].c64x_function;
+          int       dl, dh;
+
+          dl = ql_arm - ql_dsp;
+          if (dl < 0)
+               dl += C64X_QUEUE_LENGTH;
+
+          dh = qh_arm - qh_dsp;
+          if (dh < 0)
+               dh += C64X_QUEUE_LENGTH;
+
+          printf( "\e[H\e[J" );
+          printf( "High Q:  arm %5d - dsp %5d = %d\n", qh_arm, qh_dsp, dh );
+          printf( "Low  Q:  arm %5d - dsp %5d = %d\n", ql_arm, ql_dsp, dl );
+
+          printf( "                      (%08x: func %d - %s)\n", 
+                  task, (task >> 2) & 0x3fff, state_names[task & 3] );
+
+          printf( "Counter: %u\n", counter );
+
+          if (counter >= idle_last && idle_last) {
+               long long int cdiff = counter - idle_last;
+               long long int tdiff = stamp   - stamp_last;
+
+               long long int  diff = cdiff * 1200000 / tdiff;
+
+#if !DAVINCI_C64X_IDLE_MAX
+               if (diff > idle_max)
+                    idle_max = diff;
+#endif
+
+               loadx = (idle_max - diff) * 1000 / idle_max;
+          }
+
+          if (idle_max)
+               printf( "Load: %d.%d%%  (idle_max %d)\n", loadx / 10, loadx % 10, idle_max );
+
+          idle_last  = counter;
+          stamp_last = stamp;
+     }
+
+
+     munmap( (void*)mem, C64X_MLEN );
+     munmap( (void*)ctl, C64X_QLEN );
+     close( fd );
+
+     return 0;
+}
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_2d.c b/Source/DirectFB/gfxdrivers/davinci/davinci_2d.c
new file mode 100755
index 0000000..7b97fb7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_2d.c
@@ -0,0 +1,1050 @@
+/*
+   TI Davinci driver - 2D Acceleration
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 <config.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "davinci_2d.h"
+#include "davinci_gfxdriver.h"
+
+
+D_DEBUG_DOMAIN( Davinci_2D, "Davinci/2D", "Davinci 2D Acceleration" );
+
+/*
+ * State validation flags.
+ *
+ * There's no prefix because of the macros below.
+ */
+enum {
+     DESTINATION    = 0x00000001,
+     FILLCOLOR      = 0x00000002,
+
+     SOURCE         = 0x00000010,
+     SOURCE_MULT    = 0x00000020,
+
+     BLIT_BLEND_SUB = 0x00010000,
+     DRAW_BLEND_SUB = 0x00020000,
+
+     ALL            = 0x00030033
+};
+
+/*
+ * State handling macros.
+ */
+
+#define DAVINCI_VALIDATE(flags)        do { ddev->v_flags |=  (flags); } while (0)
+#define DAVINCI_INVALIDATE(flags)      do { ddev->v_flags &= ~(flags); } while (0)
+
+#define DAVINCI_CHECK_VALIDATE(flag)   do {                                               \
+                                            if (! (ddev->v_flags & flag))                 \
+                                                davinci_validate_##flag( ddev, state );   \
+                                       } while (0)
+
+/**************************************************************************************************/
+
+static bool davinciFillRectangle16( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *rect );
+
+static bool davinciFillRectangle32( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *rect );
+
+static bool davinciFillRectangleBlend32( void                *drv,
+                                         void                *dev,
+                                         DFBRectangle        *rect );
+
+static bool davinciBlit16         ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+static bool davinciBlit32to16     ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+static bool davinciBlit32         ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+static bool davinciBlitKeyed16    ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+static bool davinciBlitKeyed32    ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+static bool davinciBlitBlend32    ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    int                  dx,
+                                    int                  dy );
+
+/**************************************************************************************************/
+
+static inline int
+get_blit_blend_sub_function( const CardState *state )
+{
+     DFBSurfaceBlittingFlags flags = state->blittingflags & ~DSBLIT_COLORIZE;
+
+     if (state->dst_blend == DSBF_INVSRCALPHA) {
+          switch (state->src_blend) {
+               case DSBF_SRCALPHA:
+                    if (flags == DSBLIT_BLEND_ALPHACHANNEL)
+                         return C64X_BLEND_SRC_INVSRC;
+                    break;
+
+               case DSBF_ONE:
+                    switch (flags) {
+                         case DSBLIT_BLEND_ALPHACHANNEL:
+                              return C64X_BLEND_ONE_INVSRC;
+
+                         case DSBLIT_BLEND_ALPHACHANNEL |
+                              DSBLIT_SRC_PREMULTIPLY:
+                              return C64X_BLEND_ONE_INVSRC_PREMULT_SRC;
+
+                         case DSBLIT_BLEND_ALPHACHANNEL |
+                              DSBLIT_BLEND_COLORALPHA |
+                              DSBLIT_SRC_PREMULTCOLOR:
+                              return C64X_BLEND_ONE_INVSRC_PREMULT_ALPHA;
+
+                         default:
+                              break;
+                    }
+                    break;
+
+               default:
+                    break;
+          }
+     }
+
+     return -1;
+}
+
+static inline int
+get_draw_blend_sub_function( const CardState *state )
+{
+     DFBSurfaceDrawingFlags flags = state->drawingflags;
+
+     if (state->dst_blend == DSBF_INVSRCALPHA) {
+          switch (state->src_blend) {
+               case DSBF_SRCALPHA:
+                    if (flags == DSDRAW_BLEND)
+                         return C64X_BLEND_SRC_INVSRC;
+                    break;
+
+               case DSBF_ONE:
+                    switch (flags) {
+                         case DSDRAW_BLEND:
+                              return C64X_BLEND_ONE_INVSRC;
+
+                         case DSDRAW_BLEND |
+                              DSDRAW_SRC_PREMULTIPLY:
+                              return C64X_BLEND_ONE_INVSRC_PREMULT_SRC;
+
+                         default:
+                              break;
+                    }
+                    break;
+
+               default:
+                    break;
+          }
+     }
+
+     return -1;
+}
+
+/**************************************************************************************************/
+
+/*
+ * Called by davinciSetState() to ensure that the destination registers are properly set
+ * for execution of rendering functions.
+ */
+static inline void
+davinci_validate_DESTINATION( DavinciDeviceData *ddev,
+                              CardState         *state )
+{
+     /* Remember destination parameters for usage in rendering functions. */
+     ddev->dst_addr   = state->dst.addr;
+     ddev->dst_phys   = state->dst.phys;
+     ddev->dst_size   = state->dst.allocation->size;
+     ddev->dst_pitch  = state->dst.pitch;
+     ddev->dst_format = state->dst.buffer->format;
+     ddev->dst_bpp    = DFB_BYTES_PER_PIXEL( ddev->dst_format );
+
+     D_DEBUG_AT( Davinci_2D, "  => DESTINATION: 0x%08lx\n", ddev->dst_phys );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( DESTINATION );
+}
+
+/*
+ * Called by davinciSetState() to ensure that the color register is properly set
+ * for execution of rendering functions.
+ */
+static inline void
+davinci_validate_FILLCOLOR( DavinciDeviceData *ddev,
+                            CardState         *state )
+{
+     switch (ddev->dst_format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               ddev->fillcolor = ddev->color_argb;
+               break;
+
+          case DSPF_RGB16:
+               ddev->fillcolor = PIXEL_RGB16( state->color.r,
+                                              state->color.g,
+                                              state->color.b );
+
+               ddev->fillcolor |= ddev->fillcolor << 16;
+               break;
+
+          case DSPF_UYVY: {
+               int y, u, v;
+
+               RGB_TO_YCBCR( state->color.r, state->color.g, state->color.b, y, u, v );
+
+               ddev->fillcolor = PIXEL_UYVY( y, u, v );
+               break;
+          }
+
+          default:
+               D_BUG( "unexpected format %s", dfb_pixelformat_name(ddev->dst_format) );
+               return;
+     }
+
+     D_DEBUG_AT( Davinci_2D, "  => FILLCOLOR: 0x%08lx\n", ddev->fillcolor );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( FILLCOLOR );
+}
+
+/*
+ * Called by davinciSetState() to ensure that the source registers are properly set
+ * for execution of blitting functions.
+ */
+static inline void
+davinci_validate_SOURCE( DavinciDeviceData *ddev,
+                         CardState         *state )
+{
+     /* Remember source parameters for usage in rendering functions. */
+     ddev->src_addr   = state->src.addr;
+     ddev->src_phys   = state->src.phys;
+     ddev->src_pitch  = state->src.pitch;
+     ddev->src_format = state->src.buffer->format;
+     ddev->src_bpp    = DFB_BYTES_PER_PIXEL( ddev->src_format );
+
+     D_DEBUG_AT( Davinci_2D, "  => SOURCE: 0x%08lx\n", ddev->src_phys );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( SOURCE );
+}
+
+/*
+ * Called by davinciSetState() to ensure that the source ARGB modulation is properly set
+ * for execution of blitting functions.
+ */
+static inline void
+davinci_validate_SOURCE_MULT( DavinciDeviceData *ddev,
+                              CardState         *state )
+{
+     switch (ddev->dst_format) {
+          case DSPF_ARGB:
+               if (state->blittingflags & DSBLIT_COLORIZE)
+                    ddev->source_mult = 0xff000000 | ddev->color_argb;
+               else
+                    ddev->source_mult = 0xffffffff;
+               break;
+
+          default:
+               D_BUG( "unexpected format %s", dfb_pixelformat_name(ddev->dst_format) );
+               return;
+     }
+
+     D_DEBUG_AT( Davinci_2D, "  => SOURCE_MULT: 0x%08lx\n", ddev->source_mult );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( SOURCE_MULT );
+}
+
+/*
+ * Called by davinciSetState() to ensure that the blend sub function index is valid
+ * for execution of blitting functions.
+ */
+static inline void
+davinci_validate_BLIT_BLEND_SUB( DavinciDeviceData *ddev,
+                                 CardState         *state )
+{
+     int index = get_blit_blend_sub_function( state );
+
+     if (index < 0) {
+          D_BUG( "unexpected state" );
+          return;
+     }
+
+     /* Set blend sub function index. */
+     ddev->blit_blend_sub_function = index;
+
+     D_DEBUG_AT( Davinci_2D, "  => BLIT_BLEND_SUB: %d\n", index );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( BLIT_BLEND_SUB );
+}
+
+/*
+ * Called by davinciSetState() to ensure that the blend sub function index is valid
+ * for execution of drawing functions.
+ */
+static inline void
+davinci_validate_DRAW_BLEND_SUB( DavinciDeviceData *ddev,
+                                 CardState         *state )
+{
+     int index = get_draw_blend_sub_function( state );
+
+     if (index < 0) {
+          D_BUG( "unexpected state" );
+          return;
+     }
+
+     /* Set blend sub function index. */
+     ddev->draw_blend_sub_function = index;
+
+     D_DEBUG_AT( Davinci_2D, "  => DRAW_BLEND_SUB: %d\n", index );
+
+     /* Set the flag. */
+     DAVINCI_VALIDATE( DRAW_BLEND_SUB );
+}
+
+/**************************************************************************************************/
+
+/*
+ * 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
+davinciEngineSync( void *drv, void *dev )
+{
+     DFBResult          ret;
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s()\n", __FUNCTION__ );
+
+     if (!ddev->synced) {
+          D_DEBUG_AT( Davinci_2D, "  -> syncing...\n" );
+
+          ret = davinci_c64x_wait_low( &ddrv->c64x );
+          if (ret) {
+               D_DEBUG_AT( Davinci_2D, "  -> ERROR (%s)\n", DirectFBErrorString(ret) );
+               return ret;
+          }
+
+          D_DEBUG_AT( Davinci_2D, "  => syncing done.\n" );
+
+          ddev->synced = true;
+     }
+     else
+          D_DEBUG_AT( Davinci_2D, "  => already synced!\n" );
+
+     return DFB_OK;
+}
+
+/*
+ * Reset the graphics engine.
+ */
+void
+davinciEngineReset( void *drv, void *dev )
+{
+     D_DEBUG_AT( Davinci_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
+davinciEmitCommands( void *drv, void *dev )
+{
+     DFBResult          ret;
+     DavinciDeviceData *ddev = dev;
+     DavinciDriverData *ddrv = drv;
+
+     D_DEBUG_AT( Davinci_2D, "%s()\n", __FUNCTION__ );
+
+     ret = davinci_c64x_emit_tasks( &ddrv->c64x, &ddrv->tasks, C64X_TEF_RESET );
+     if (ret)
+          D_DERROR( ret, "Davinci/Driver: Error emitting local task buffer!\n" );
+
+     ddev->synced = false;
+}
+
+/*
+ * Invalidate the DSP's read cache.
+ */
+void
+davinciFlushTextureCache( void *drv, void *dev )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s()\n", __FUNCTION__ );
+
+     /* Bad workaround */
+     davinci_c64x_blit_32( &ddrv->c64x, dfb_config->video_phys, 1024, dfb_config->video_phys, 1024, 256, 64 );
+
+     /* These don't work */
+//     davinci_c64x_wb_inv_range( &ddrv->c64x, dfb_config->video_phys,
+//                                             dfb_config->video_length, 2 );
+
+//     davinci_c64x_wb_inv_range( &ddrv->c64x, ddev->fix[OSD0].smem_start,
+//                                             ddev->fix[OSD0].smem_len, 2 );
+}
+
+/*
+ * Check for acceleration of 'accel' using the given 'state'.
+ */
+void
+davinciCheckState( void                *drv,
+                   void                *dev,
+                   CardState           *state,
+                   DFBAccelerationMask  accel )
+{
+     D_DEBUG_AT( Davinci_2D, "%s( state %p, accel 0x%08x ) <- dest %p\n",
+                 __FUNCTION__, state, accel, state->destination );
+
+     /* Return if the desired function is not supported at all. */
+     if (accel & ~(DAVINCI_SUPPORTED_DRAWINGFUNCTIONS | DAVINCI_SUPPORTED_BLITTINGFUNCTIONS))
+          return;
+
+     /* Return if the destination format is not supported. */
+     switch (state->destination->config.format) {
+          case DSPF_UYVY:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          default:
+               return;
+     }
+
+     /* Check if drawing or blitting is requested. */
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* Return if unsupported drawing flags are set. */
+          if (state->drawingflags & ~DAVINCI_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          /* Limited blending support. */
+          if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY)) {
+               if (state->destination->config.format != DSPF_ARGB)
+                    return;
+
+               if (get_draw_blend_sub_function( state ) < 0)
+                    return;
+          }
+     }
+     else {
+          /* Return if unsupported blitting flags are set. */
+          if (state->blittingflags & ~DAVINCI_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          /* No other flags supported when color keying is used. */
+          if ((state->blittingflags & DSBLIT_SRC_COLORKEY) && state->blittingflags != DSBLIT_SRC_COLORKEY)
+               return;
+
+          /* Return if the source format is not supported. */
+          switch (state->source->config.format) {
+               case DSPF_UYVY:
+               case DSPF_RGB16:
+                    /* Only color keying for these formats. */
+                    if (state->blittingflags & ~DSBLIT_SRC_COLORKEY)
+                         return;
+                    /* No format conversion supported. */
+                    if (state->source->config.format != state->destination->config.format)
+                         return;
+                    break;
+
+               case DSPF_RGB32:
+                    /* Only color keying for these formats. */
+                    if (state->blittingflags & ~DSBLIT_SRC_COLORKEY)
+                         return;
+                    /* fall through */
+               case DSPF_ARGB:
+                    /* Only few blending combinations are valid. */
+                    if ((state->blittingflags & ~DSBLIT_SRC_COLORKEY) && get_blit_blend_sub_function( state ) < 0)
+                         return;
+                    /* Only ARGB/RGB32 -> RGB16 conversion (without any flag). */
+                    if (state->source->config.format != state->destination->config.format &&
+                        (state->destination->config.format != DSPF_RGB16 || state->blittingflags))
+                         return;
+                    break;
+
+               default:
+                    return;
+          }
+
+          /* Checks per function. */
+          switch (accel) {
+               case DFXL_STRETCHBLIT:
+                    /* No flags supported with StretchBlit(). */
+                    if (state->blittingflags)
+                         return;
+
+                    /* Only (A)RGB at 32 bit supported. */
+                    if (state->source->config.format != DSPF_ARGB && state->source->config.format != DSPF_RGB32)
+                         return;
+
+                    break;
+
+               default:
+                    break;
+          }
+     }
+
+     /* Enable acceleration of the function. */
+     state->accel |= accel;
+
+     D_DEBUG_AT( Davinci_2D, "  => accel 0x%08x\n", state->accel );
+}
+
+/*
+ * Make sure that the hardware is programmed for execution of 'accel' according to the 'state'.
+ */
+void
+davinciSetState( void                *drv,
+                 void                *dev,
+                 GraphicsDeviceFuncs *funcs,
+                 CardState           *state,
+                 DFBAccelerationMask  accel )
+{
+     DavinciDeviceData      *ddev     = dev;
+     StateModificationFlags  modified = state->mod_hw;
+
+     D_DEBUG_AT( Davinci_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) {
+          D_DEBUG_AT( Davinci_2D, "  <- ALL\n" );
+
+          DAVINCI_INVALIDATE( ALL );
+     }
+     else if (modified) {
+          /* Invalidate destination settings. */
+          if (modified & SMF_DESTINATION) {
+               D_DEBUG_AT( Davinci_2D, "  <- DESTINATION | FILLCOLOR\n" );
+
+               DAVINCI_INVALIDATE( DESTINATION | FILLCOLOR );
+          }
+          else if (modified & SMF_COLOR) {
+               D_DEBUG_AT( Davinci_2D, "  <- FILLCOLOR\n" );
+
+               DAVINCI_INVALIDATE( FILLCOLOR );
+          }
+
+          /* Invalidate source settings. */
+          if (modified & SMF_SOURCE) {
+               D_DEBUG_AT( Davinci_2D, "  <- SOURCE\n" );
+
+               DAVINCI_INVALIDATE( SOURCE );
+          }
+
+          /* Invalidate source color(ize) settings. */
+          if (modified & (SMF_BLITTING_FLAGS | SMF_COLOR)) {
+               D_DEBUG_AT( Davinci_2D, "  <- SOURCE_MULT\n" );
+
+               DAVINCI_INVALIDATE( SOURCE_MULT );
+          }
+
+          /* Invalidate blend function for blitting. */
+          if (modified & (SMF_BLITTING_FLAGS | SMF_SRC_BLEND | SMF_DST_BLEND)) {
+               D_DEBUG_AT( Davinci_2D, "  <- BLIT_BLEND_SUB\n" );
+
+               DAVINCI_INVALIDATE( BLIT_BLEND_SUB );
+          }
+
+          /* Invalidate blend function for drawing. */
+          if (modified & (SMF_DRAWING_FLAGS | SMF_SRC_BLEND | SMF_DST_BLEND)) {
+               D_DEBUG_AT( Davinci_2D, "  <- DRAW_BLEND_SUB\n" );
+
+               DAVINCI_INVALIDATE( DRAW_BLEND_SUB );
+          }
+     }
+
+     /*
+      * Just keep these values, no computations needed here.
+      * Values used by state validation or rendering functions.
+      */
+     ddev->blitting_flags = state->blittingflags;
+     ddev->clip           = state->clip;
+     ddev->color          = state->color;
+     ddev->colorkey       = state->src_colorkey;
+     ddev->color_argb     = PIXEL_ARGB( state->color.a,
+                                        state->color.r,
+                                        state->color.g,
+                                        state->color.b );
+
+     /*
+      * 2) Validate hardware states
+      *
+      * Each function has its own set of states that need to be validated.
+      */
+
+     /* Always requiring valid destination... */
+     DAVINCI_CHECK_VALIDATE( DESTINATION );
+
+     /* Depending on the function... */
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+               D_DEBUG_AT( Davinci_2D, "  -> FILLRECTANGLE\n" );
+
+               /* Validate blend sub function index for drawing... */
+               if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY))
+                    DAVINCI_CHECK_VALIDATE( DRAW_BLEND_SUB );
+               else
+                    /* ...or just validate fill color. */
+                    DAVINCI_CHECK_VALIDATE( FILLCOLOR );
+
+               /* Choose function. */
+               switch (DFB_BYTES_PER_PIXEL( state->destination->config.format )) {
+                    case 2:
+                         funcs->FillRectangle = davinciFillRectangle16;
+                         break;
+
+                    case 4:
+                         if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY))
+                              funcs->FillRectangle = davinciFillRectangleBlend32;
+                         else
+                              funcs->FillRectangle = davinciFillRectangle32;
+                         break;
+
+                    default:
+                         D_BUG( "unexpected destination bpp %d",
+                                DFB_BYTES_PER_PIXEL( state->destination->config.format ) );
+                         break;
+               }
+
+               /*
+                * 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 |= DAVINCI_SUPPORTED_DRAWINGFUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+               D_DEBUG_AT( Davinci_2D, "  -> BLIT\n" );
+
+               /* ...require valid source. */
+               DAVINCI_CHECK_VALIDATE( SOURCE );
+
+               /* Validate blend sub function index for blitting. */
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+                    DAVINCI_CHECK_VALIDATE( BLIT_BLEND_SUB );
+
+                    /* Validate ARGB source modulator. */
+                    DAVINCI_CHECK_VALIDATE( SOURCE_MULT );
+               }
+
+               /* Choose function. */
+               switch (DFB_BYTES_PER_PIXEL( state->destination->config.format )) {
+                    case 2:
+                         if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                              funcs->Blit = davinciBlitKeyed16;
+                         else if (state->source->config.format == DSPF_ARGB ||
+                                  state->source->config.format == DSPF_RGB32)
+                              funcs->Blit = davinciBlit32to16;
+                         else
+                              funcs->Blit = davinciBlit16;
+                         break;
+
+                    case 4:
+                         if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                              funcs->Blit = davinciBlitKeyed32;
+                         else if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                              funcs->Blit = davinciBlitBlend32;
+                         else
+                              funcs->Blit = davinciBlit32;
+                         break;
+
+                    default:
+                         D_BUG( "unexpected destination bpp %d",
+                                DFB_BYTES_PER_PIXEL( state->destination->config.format ) );
+                         break;
+               }
+
+               /*
+                * 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 |= DFXL_BLIT;
+               break;
+
+          case DFXL_STRETCHBLIT:
+               D_DEBUG_AT( Davinci_2D, "  -> STRETCHBLIT\n" );
+
+               /* ...require valid source. */
+               DAVINCI_CHECK_VALIDATE( SOURCE );
+
+               /* Choose function. */
+#if 0 // only 32bit, statically set in driver_init_driver()
+               switch (state->destination->config.format) {
+                    case DSPF_ARGB:
+                    case DSPF_RGB32:
+                         funcs->StretchBlit = davinciStretchBlit32;
+                         break;
+
+                    default:
+                         D_BUG( "unexpected destination format %s",
+                                dfb_pixelformat_name( state->destination->config.format ) );
+                         break;
+               }
+#endif
+
+               /*
+                * 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 |= DFXL_STRETCHBLIT;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     /*
+      * 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.
+ */
+static bool
+davinciFillRectangle16( void *drv, void *dev, DFBRectangle *rect )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS(rect) );
+
+     /* FIXME: Optimize in DSP. */
+     if ((rect->x | rect->w) & 1)
+          davinci_c64x_fill_16__L( &ddrv->tasks,
+                                   ddev->dst_phys + ddev->dst_pitch * rect->y + ddev->dst_bpp * rect->x,
+                                   ddev->dst_pitch,
+                                   rect->w, rect->h,
+                                   ddev->fillcolor );
+     else
+          davinci_c64x_fill_32__L( &ddrv->tasks,
+                                   ddev->dst_phys + ddev->dst_pitch * rect->y + ddev->dst_bpp * rect->x,
+                                   ddev->dst_pitch,
+                                   rect->w/2, rect->h,
+                                   ddev->fillcolor );
+
+     return true;
+}
+
+static bool
+davinciFillRectangle32( void *drv, void *dev, DFBRectangle *rect )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS(rect) );
+
+     if (ddev->dst_format == DSPF_ARGB && ddev->color.a == 0xff)
+          davinci_c64x_blit_blend_32__L( &ddrv->tasks,
+                                         C64X_BLEND_ONE_INVSRC,
+                                         ddev->dst_phys + ddev->dst_pitch * rect->y + ddev->dst_bpp * rect->x,
+                                         ddev->dst_pitch,
+                                         0,
+                                         0,
+                                         rect->w, rect->h,
+                                         ddev->color_argb,
+                                         0xff );
+     else
+          davinci_c64x_fill_32__L( &ddrv->tasks,
+                                   ddev->dst_phys + ddev->dst_pitch * rect->y + ddev->dst_bpp * rect->x,
+                                   ddev->dst_pitch,
+                                   rect->w, rect->h,
+                                   ddev->fillcolor );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+static bool
+davinciFillRectangleBlend32( void *drv, void *dev, DFBRectangle *rect )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS(rect) );
+
+     davinci_c64x_blit_blend_32__L( &ddrv->tasks,
+                                    ddev->draw_blend_sub_function,
+                                    ddev->dst_phys + ddev->dst_pitch * rect->y + ddev->dst_bpp * rect->x,
+                                    ddev->dst_pitch,
+                                    0,
+                                    0,
+                                    rect->w, rect->h,
+                                    ddev->color_argb,
+                                    0xff );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+/*
+ * Blit a rectangle using the current hardware state.
+ */
+static bool
+davinciBlit16( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d )\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y );
+
+     /* FIXME: Optimize in DSP. */
+     if ((dx | rect->x | rect->w) & 1)
+          davinci_c64x_blit_16__L( &ddrv->tasks,
+                                   ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                   ddev->dst_pitch,
+                                   ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                   ddev->src_pitch,
+                                   rect->w, rect->h );
+     else
+          davinci_c64x_blit_32__L( &ddrv->tasks,
+                                   ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                   ddev->dst_pitch,
+                                   ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                   ddev->src_pitch,
+                                   rect->w/2, rect->h );
+
+     return true;
+}
+
+static bool
+davinciBlit32( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d )\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y );
+
+     davinci_c64x_blit_32__L( &ddrv->tasks,
+                              ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                              ddev->dst_pitch,
+                              ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                              ddev->src_pitch,
+                              rect->w, rect->h );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+static bool
+davinciBlit32to16( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d )\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y );
+
+     davinci_c64x_dither_argb__L( &ddrv->tasks,
+                                  ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                  DAVINCI_C64X_MEM,
+                                  ddev->dst_pitch,
+                                  ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                  ddev->src_pitch,
+                                  rect->w, rect->h );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+static bool
+davinciBlitKeyed16( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d ) <- key 0x%04lx\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y, ddev->colorkey );
+
+     davinci_c64x_blit_keyed_16__L( &ddrv->tasks,
+                                    ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                    ddev->dst_pitch,
+                                    ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                    ddev->src_pitch,
+                                    rect->w, rect->h,
+                                    ddev->colorkey,
+                                    (1 << DFB_COLOR_BITS_PER_PIXEL( ddev->dst_format )) - 1 );
+
+     return true;
+}
+
+static bool
+davinciBlitKeyed32( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d ) <- key 0x%08lx\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y, ddev->colorkey );
+
+     davinci_c64x_blit_keyed_32__L( &ddrv->tasks,
+                                    ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                    ddev->dst_pitch,
+                                    ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                    ddev->src_pitch,
+                                    rect->w, rect->h,
+                                    ddev->colorkey,
+                                    (1 << DFB_COLOR_BITS_PER_PIXEL( ddev->dst_format )) - 1 );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+static bool
+davinciBlitBlend32( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d )\n",
+                 __FUNCTION__, dx, dy, rect->w, rect->h, rect->x, rect->y );
+
+     davinci_c64x_blit_blend_32__L( &ddrv->tasks,
+                                    ddev->blit_blend_sub_function,
+                                    ddev->dst_phys + ddev->dst_pitch * dy      + ddev->dst_bpp * dx,
+                                    ddev->dst_pitch,
+                                    ddev->src_phys + ddev->src_pitch * rect->y + ddev->src_bpp * rect->x,
+                                    ddev->src_pitch,
+                                    rect->w, rect->h,
+                                    ddev->source_mult,
+                                    ddev->color.a );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+bool
+davinciStretchBlit32( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect )
+{
+     DavinciDriverData *ddrv = drv;
+     DavinciDeviceData *ddev = dev;
+
+     DFBRegion clip = DFB_REGION_INIT_FROM_RECTANGLE( drect );
+
+     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d-%4dx%4d )\n",
+                 __FUNCTION__, DFB_RECTANGLE_VALS(drect), DFB_RECTANGLE_VALS(srect) );
+
+     if (!dfb_region_region_intersect( &clip, &ddev->clip ))
+          return true;
+
+     dfb_region_translate( &clip, -drect->x, -drect->y );
+
+     davinci_c64x_stretch_32__L( &ddrv->tasks,
+                                 ddev->dst_phys + ddev->dst_pitch * drect->y + ddev->dst_bpp * drect->x,
+                                 ddev->dst_pitch,
+                                 ddev->src_phys + ddev->src_pitch * srect->y + ddev->src_bpp * srect->x,
+                                 ddev->src_pitch,
+                                 drect->w, drect->h,
+                                 srect->w, srect->h,
+                                 &clip );
+
+     return true;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_2d.h b/Source/DirectFB/gfxdrivers/davinci/davinci_2d.h
new file mode 100755
index 0000000..881c179
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_2d.h
@@ -0,0 +1,79 @@
+/*
+   TI Davinci driver - 2D Acceleration
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_2D_H__
+#define __DAVINCI_2D_H__
+
+
+#define DAVINCI_SUPPORTED_DRAWINGFLAGS      (DSDRAW_BLEND |\
+                                             DSDRAW_SRC_PREMULTIPLY)
+
+#define DAVINCI_SUPPORTED_DRAWINGFUNCTIONS  (DFXL_FILLRECTANGLE)
+
+#define DAVINCI_SUPPORTED_BLITTINGFLAGS     (DSBLIT_BLEND_ALPHACHANNEL |\
+                                             DSBLIT_BLEND_COLORALPHA   |\
+                                             DSBLIT_COLORIZE           |\
+                                             DSBLIT_SRC_COLORKEY       |\
+                                             DSBLIT_SRC_PREMULTIPLY    |\
+                                             DSBLIT_SRC_PREMULTCOLOR)
+
+#define DAVINCI_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT | DFXL_STRETCHBLIT)
+
+
+DFBResult davinciEngineSync       ( void                *drv,
+                                    void                *dev );
+                                  
+void      davinciEngineReset      ( void                *drv,
+                                    void                *dev );
+                                  
+void      davinciEmitCommands     ( void                *drv,
+                                    void                *dev );
+
+void      davinciFlushTextureCache( void                *drv,
+                                    void                *dev );
+
+void      davinciCheckState       ( void                *drv,
+                                    void                *dev,
+                                    CardState           *state,
+                                    DFBAccelerationMask  accel );
+                                  
+void      davinciSetState         ( void                *drv,
+                                    void                *dev,
+                                    GraphicsDeviceFuncs *funcs,
+                                    CardState           *state,
+                                    DFBAccelerationMask  accel );
+
+bool      davinciStretchBlit32    ( void                *drv,
+                                    void                *dev,
+                                    DFBRectangle        *srect,
+                                    DFBRectangle        *drect );
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.c b/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.c
new file mode 100755
index 0000000..431ffdd
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.c
@@ -0,0 +1,2053 @@
+/*
+   TI Davinci driver - C64X+ DSP Library
+
+   (c) Copyright 2008  directfb.org
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org> and
+              Olaf Dreesen <olaf@directfb.org>.
+
+   All rights reserved.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   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
+   General Public License for more details.
+
+   You should have received a copy of the GNU 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 <config.h>
+
+#include <asm/types.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <directfb_util.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include "davinci_c64x.h"
+
+
+/**********************************************************************************************************************/
+
+#define C64X_DEVICE  "/dev/c64x"
+#define C64X_DEVICE0 "/dev/c64x0"
+#define C64X_QLEN    direct_page_align( sizeof(c64xTaskControl) )
+#define C64X_MLEN    direct_page_align( 0x2000000 )
+
+__attribute__((noinline))
+static void
+davinci_c64x_queue_error( DavinciC64x *c64x, const char *msg )
+{
+     c64xTaskControl *ctl       = c64x->ctl;
+     uint32_t         dsp       = ctl->QL_dsp;
+     uint32_t         arm       = ctl->QL_arm;
+     uint32_t         armp      = (arm-1) & C64X_QUEUE_MASK;
+     c64xTask        *dsp_task  = &c64x->QueueL[dsp];
+     c64xTask        *arm_task  = &c64x->QueueL[arm];
+     c64xTask        *armp_task = &c64x->QueueL[armp];
+
+     D_PERROR( "Davinci/C64X+: %s [DSP %d / %d (%s), ARM %d / %d (%s) <- %d / %d (%s)]\n",
+               msg,
+               dsp,
+               (dsp_task->c64x_function >> 2) & 0x3fff,
+               state_names[dsp_task->c64x_function & 3],
+               arm,
+               (arm_task->c64x_function >> 2) & 0x3fff,
+               state_names[arm_task->c64x_function & 3],
+               armp,
+               (armp_task->c64x_function >> 2) & 0x3fff,
+               state_names[armp_task->c64x_function & 3] );
+}
+
+/*
+
+1. Idle Case
+
+     ARM                                        ARM
+     DSP                                        DSP
+   |  .  .  .  .  .  .  .  .  |      |  .  .  .  .  .  .  .  .  |          free = length-1
+
+
+2. Busy Case (ARM after)
+
+        ARM                                     ARM
+     DSP                                  DSP
+   |  o  .  .  .  .  .  .  .  |      |  .  o  o  .  .  .  .  .  |          free = length-1 - arm + dsp
+
+
+3. Busy Case (ARM before)
+
+     ARM                                     ARM
+                    DSP                                     DSP
+   |  .  .  .  .  .  o  o  o  |      |  o  o  .  .  .  .  .  o  |          free = dsp - arm - 1
+
+
+4. Full Case (ARM after)
+
+                          ARM
+     DSP
+   |  o  o  o  o  o  o  o  .  |                                            free = 0
+
+
+5. Full Case (ARM before)
+
+                    ARM                ARM
+                       DSP                DSP
+   |  o  o  o  o  o  .  o  o  |      |  .  o  o  o  o  o  o  o  |          free = 0
+
+*/
+
+DFBResult
+davinci_c64x_emit_tasks( DavinciC64x          *c64x,
+                         DavinciC64xTasks     *tasks,
+                         DavinciC64xEmitFlags  flags )
+{
+     c64xTaskControl *ctl     = c64x->ctl;
+     uint32_t         arm     = ctl->QL_arm;
+     unsigned int     emitted = 0;
+     unsigned int     timeout = 23;
+
+     D_MAGIC_ASSERT( tasks, DavinciC64xTasks );
+
+     while (emitted < tasks->num_tasks) {
+          uint32_t dsp = ctl->QL_dsp;
+          int      free;
+
+          if (arm == dsp)
+               free = C64X_QUEUE_LENGTH - 1;
+          else if (arm > dsp)
+               free = C64X_QUEUE_LENGTH - 1 - arm + dsp;
+          else
+               free = dsp - arm - 1;
+
+          if (free) {
+               int emit = MIN( free, tasks->num_tasks - emitted );
+               int copy = MIN( emit, C64X_QUEUE_LENGTH - arm );
+
+               memcpy( (void*) &c64x->QueueL[arm], (void*) &tasks->tasks[emitted], sizeof(c64xTask) * copy );
+
+               if (copy < emit) {
+                    memcpy( (void*) &c64x->QueueL[0], (void*) &tasks->tasks[emitted+copy], sizeof(c64xTask) * (emit - copy) );
+
+                    arm = (emit - copy);
+               }
+               else
+                    arm = (arm + copy) & C64X_QUEUE_MASK;
+
+               mb();
+
+               ctl->QL_arm = arm;
+
+               mb();
+
+               emitted += emit;
+
+               timeout = 23;
+          }
+          else {
+               if (!timeout--) {
+                    davinci_c64x_queue_error( c64x, "Emit Timeout!" );
+                    return DFB_TIMEOUT;
+               }
+                    
+               usleep( 7000 );
+          }
+     }
+
+     if (flags & C64X_TEF_RESET)
+          tasks->num_tasks = 0;
+
+     return DFB_OK;
+}
+
+DFBResult
+davinci_c64x_tasks_init( DavinciC64xTasks *tasks,
+                         unsigned int      size )
+{
+     tasks->tasks = D_MALLOC( sizeof(c64xTask) * size );
+     if (!tasks->tasks)
+          return D_OOM();
+
+     tasks->max_tasks = size;
+     tasks->num_tasks = 0;
+
+     D_MAGIC_SET( tasks, DavinciC64xTasks );
+
+     return DFB_OK;
+}
+
+DFBResult
+davinci_c64x_tasks_destroy( DavinciC64xTasks *tasks )
+{
+     D_MAGIC_ASSERT( tasks, DavinciC64xTasks );
+     D_ASSERT( tasks->tasks != NULL );
+
+     D_FREE( (void*) tasks->tasks );
+
+     tasks->tasks = NULL;
+
+     D_MAGIC_CLEAR( tasks );
+
+     return DFB_OK;
+}
+
+DFBResult
+davinci_c64x_wait_low( DavinciC64x *c64x )
+{
+     DFBResult        ret;
+     c64xTaskControl *ctl = c64x->ctl;
+
+     while (ctl->QL_dsp != ctl->QL_arm) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_FLAG_TODO | C64X_FLAG_INTERRUPT;
+
+          c64x_submit_task( c64x, task );
+
+          if (ioctl( c64x->fd, C64X_IOCTL_WAIT_LOW )) {
+               c64xTask *dsp_task = &c64x->QueueL[ctl->QL_dsp];
+
+               ret = errno2result( errno );
+               D_PERROR( "Davinci/C64X+: C64X_IOCTL_WAIT_LOW failed! [DSP %d / %d (%s), ARM %d / %d (%s)]\n",
+                         ctl->QL_dsp,
+                         (dsp_task->c64x_function >> 2) & 0x3fff,
+                         state_names[dsp_task->c64x_function & 3],
+                         ctl->QL_arm,
+                         (task->c64x_function >> 2) & 0x3fff,
+                         state_names[task->c64x_function & 3] );
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+/*   Benchmarking or Testing                                                                                          */
+/**********************************************************************************************************************/
+
+#if 1
+#define BRINTF(x...)     do { direct_log_printf( NULL, x ); } while (0)
+#else
+#define BRINTF(x...)     printf( x )
+#endif
+
+static void
+bench_mem( const char *name,
+           void       *ptr,
+           int         length,
+           bool        copy,
+           bool        from )
+{
+     int       i, num;
+     long long t1, t2, dt, total;
+     char      buf[0x100];
+
+     if (length > sizeof(buf))
+          length = sizeof(buf);
+
+     num = 0x2000000 / length;
+
+     t1 = direct_clock_get_abs_micros();
+
+     if (copy) {
+          if (from)
+               for (i=0; i<num; i++)
+                    memcpy( buf, ptr, length );
+          else
+               for (i=0; i<num; i++)
+                    memcpy( ptr, buf, length );
+     }
+     else
+          for (i=0; i<num; i++)
+               memset( ptr, 0, length );
+
+     t2 = direct_clock_get_abs_micros();
+
+     dt    = t2 - t1;
+     total = i * length;
+
+     D_INFO( "Davinci/C64X: MEMORY BENCHMARK on %-7s - %-15s   %lld.%03lld MB/sec\n",
+             name, copy ? from ? "memcpy() from" : "memcpy() to" : "memset()",
+             total / dt, (total * 1000 / dt) % 1000 );
+}
+
+
+/* insert idct code for testing here */
+
+
+#define DVA_BLOCK_WORD( val, index, EOB )    (((val) << 16) | (((index)&0x3f) << 1) | ((EOB) ? 1 : 0))
+
+static inline void
+test_load_block( DavinciC64x *c64x, bool dct_type_interlaced )
+{
+     int    i;
+     int    num = 0;
+     short *dst = c64x->mem + 0x01000000;
+     int   *src = c64x->mem + 0x01100000;
+
+
+#if 0
+     src[num++] = DVA_BLOCK_WORD( 100, 0, 1 );
+     src[num++] = DVA_BLOCK_WORD( 200, 0, 0 );
+     src[num++] = DVA_BLOCK_WORD( 210, 1, 0 );
+     src[num++] = DVA_BLOCK_WORD( 220, 2, 1 );
+     src[num++] = DVA_BLOCK_WORD( 300, 0, 1 );
+     src[num++] = DVA_BLOCK_WORD( 400, 0, 0 );
+     src[num++] = DVA_BLOCK_WORD( 410, 1, 1 );
+     src[num++] = DVA_BLOCK_WORD( 500, 0, 0 );
+     src[num++] = DVA_BLOCK_WORD( 510, 63, 1 );
+     src[num++] = DVA_BLOCK_WORD( 600, 63, 1 );
+#else
+     src[num++] = DVA_BLOCK_WORD(136, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(-12, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(7, 16, 0);
+     src[num++] = DVA_BLOCK_WORD(-2, 24, 1);
+
+     src[num++] = DVA_BLOCK_WORD(136, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(-12, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(7, 16, 0);
+     src[num++] = DVA_BLOCK_WORD(-2, 24, 1);
+
+
+     src[num++] = DVA_BLOCK_WORD(1076, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(-204, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(-168, 16, 0);
+     src[num++] = DVA_BLOCK_WORD(-129, 24, 0);
+     src[num++] = DVA_BLOCK_WORD(-100, 32, 0);
+     src[num++] = DVA_BLOCK_WORD(-40, 40, 0);
+     src[num++] = DVA_BLOCK_WORD(-14, 48, 1);
+#if 1
+     src[num++] = DVA_BLOCK_WORD(1068, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(2, 1, 0);
+     src[num++] = DVA_BLOCK_WORD(-202, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(-168, 16, 0);
+     src[num++] = DVA_BLOCK_WORD(-2, 9, 0);
+     src[num++] = DVA_BLOCK_WORD(-129, 24, 0);
+     src[num++] = DVA_BLOCK_WORD(-97, 32, 0);
+     src[num++] = DVA_BLOCK_WORD(-40, 40, 0);
+     src[num++] = DVA_BLOCK_WORD(-13, 48, 1);
+#else
+     src[num++] = DVA_BLOCK_WORD(1068, 0, 0);
+//     src[num++] = DVA_BLOCK_WORD(2, 1, 0);
+     src[num++] = DVA_BLOCK_WORD(-202, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(-1, 16, 0);
+//     src[num++] = DVA_BLOCK_WORD(-2, 9, 0);
+     src[num++] = DVA_BLOCK_WORD(-1, 24, 0);
+     src[num++] = DVA_BLOCK_WORD(-97, 32, 1);
+//     src[num++] = DVA_BLOCK_WORD(-40, 40, 0);
+//     src[num++] = DVA_BLOCK_WORD(-13, 48, 1);
+#endif
+
+     src[num++] = DVA_BLOCK_WORD(1048, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(-26, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(4, 16, 0);
+     src[num++] = DVA_BLOCK_WORD(5, 24, 0);
+     src[num++] = DVA_BLOCK_WORD(-4, 32, 1);
+
+     src[num++] = DVA_BLOCK_WORD(996, 0, 0);
+     src[num++] = DVA_BLOCK_WORD(24, 8, 0);
+     src[num++] = DVA_BLOCK_WORD(-2, 24, 0);
+     src[num++] = DVA_BLOCK_WORD(3, 32, 0);
+     src[num++] = DVA_BLOCK_WORD(-4, 48, 1);
+#endif
+
+     BRINTF("\n");
+     BRINTF("\n\n.======================== Testing load_block (dct_type_interlaced: %s) ========================.\n",
+            dct_type_interlaced ? "yes" : "no");
+     BRINTF("\n");
+     BRINTF( "SOURCE (DVABlockWords)\n" );
+     BRINTF("\n");
+
+     for (i=0; i<num; i++)
+          BRINTF("0x%08x  (%d, %d, %d)\n", (u32)src[i], src[i] >> 16, (src[i] >> 1) & 0x3f, src[i] & 1);
+
+     BRINTF("\n\n");
+
+
+     memset( dst, 0x55, 0x100000 );
+
+
+     // test routine
+     davinci_c64x_load_block( c64x, DAVINCI_C64X_MEM+0x01100000, 10, dct_type_interlaced ? 0x7f : 0x3f );
+
+     // copy idct buffer to memory where we can read it
+     davinci_c64x_blit_16( c64x, DAVINCI_C64X_MEM+0x01000000, 0, 0xf065c0, 0, 16 * 24, 1 );
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+
+     BRINTF( "-> IDCT BUFFER (16x16 + [ 8x8 8x8 ] shorts)\n" );
+     BRINTF("\n");
+
+     for (i=0; i<16*24; i++) {
+          BRINTF("%5d ", dst[i] );
+          if ((i&15)==15) {
+               BRINTF("\n");
+          }
+          if ((i&255)==255) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+
+#if 1
+     s16 *blocks = c64x->mem + 0x01200000;
+     int offset  = 0;
+
+     memset( blocks, 0, 1024 );
+
+     for (i=0; i<num; i++) {
+          blocks[offset + ((src[i] >> 1) & 0x3f)] = src[i] >> 16;
+
+          if (src[i] & 1)
+               offset += 64;
+     }
+
+	memset( dst, 0x55, 0x100000 );
+
+	// test routine
+	for (i=0; i<6; i++)
+		davinci_c64x_dva_idct( c64x, DAVINCI_C64X_MEM+0x01000000 + i*128, 16, DAVINCI_C64X_MEM+0x01200000 + i*128 );
+
+	davinci_c64x_write_back_all( c64x );
+	davinci_c64x_write_back_all( c64x );
+	davinci_c64x_wait_low( c64x );
+
+
+     BRINTF( "-> SINGLE IDCT (59) BLOCKS (6x 8x8 shorts)\n" );
+     BRINTF("\n");
+
+     for (i=0; i<6*64; i++) {
+          BRINTF("%5d ", dst[i] );
+          if ((i&7)==7) {
+               BRINTF("\n");
+          }
+          if ((i&63)==63) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+#endif
+
+#if 0
+//     s16 blocks[384];
+//     int offset = 0;
+     offset = 0;
+
+     memset( blocks, 0, 1024 );
+
+     for (i=0; i<num; i++) {
+          blocks[offset + ((src[i] >> 1) & 0x3f)] = src[i] >> 16;
+
+          if (src[i] & 1) {
+               int n;
+
+               for (n = 0; n < 8; n++)
+                    idct_row (blocks + offset + 8 * n);
+
+               for (n = 0; n < 8; n++)
+                    idct_col (blocks + offset + n);
+
+               offset += 64;
+          }
+     }
+
+     BRINTF( "-> REFERENCE IDCT BLOCKS (6x 8x8 shorts)\n" );
+     BRINTF("\n");
+
+     for (i=0; i<6*64; i++) {
+          BRINTF("%5d ", blocks[i] );
+          if ((i&7)==7) {
+               BRINTF("\n");
+          }
+          if ((i&63)==63) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+#endif
+}
+
+static inline void
+bench_dezigzag( DavinciC64x *c64x )
+{
+     int       i, num;
+     long long t1, t2, dt, total;
+     //int       length = 0x10000;
+
+     num = 0x200000;// / length;
+
+     short *p = c64x->mem + 0x1000000;
+
+     for (i=0; i<64; i++) {
+          p[i] = i;
+          BRINTF("%3d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_DEZIGZAG | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x200000;
+          task->c64x_arg[1] = (DAVINCI_C64X_MEM+0x01000000)+0x000000;
+          //task->c64x_arg[2] = length/4;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     p = c64x->mem + 0x1200000;
+     for (i=0; i<64; i++) {
+          BRINTF("%3d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     dt    = t2 - t1;
+     total = num;// * length;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "de_zigzag()", total * 1000000ULL / dt );
+}
+
+#define DUMP_PIXELS 1
+
+static inline void
+bench_blend_argb( DavinciC64x *c64x, int sub )
+{
+     int       i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//0x20000;
+
+     u32 *src = c64x->mem + 0x1000000;
+     u32 *dst = c64x->mem + 0x1200000;
+
+     BRINTF( "\nTESTING BLEND_32 SUB %d\n", sub );
+
+     BRINTF( "\nSOURCE               " );
+
+     for (i=0; i<DUMP_PIXELS; i++) {
+          src[i] = (i << 26) | ((i & 0x30) << 20) | (i * 0x010204 + 3);
+
+          if (!i)
+               src[i] = 0xc0c08001;
+
+          BRINTF("%02x %02x %02x %02x  ", src[i] >> 24, (src[i] >> 16) & 0xff, (src[i] >> 8) & 0xff, src[i] & 0xff);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF( "\nDESTINATION          " );
+
+     for (i=0; i<DUMP_PIXELS; i++) {
+          dst[i] = i * 0x04040404;
+
+          if (!i)
+               dst[i] = 0xe0e0e0e0;
+
+          BRINTF("%02x %02x %02x %02x  ", dst[i] >> 24, (dst[i] >> 16) & 0xff, (dst[i] >> 8) & 0xff, dst[i] & 0xff);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_BLEND_32 | C64X_FLAG_TODO | (sub << 16);
+
+          task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x200000;
+          task->c64x_arg[1] = 32;
+          task->c64x_arg[2] = (DAVINCI_C64X_MEM+0x01000000)+0x000000;
+          task->c64x_arg[3] = 32;
+          task->c64x_arg[4] = 8;
+          task->c64x_arg[5] = 8;
+          task->c64x_arg[6] = 0x80;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     BRINTF( "\n\nDESTINATION (AFTER)  " );
+
+     for (i=0; i<DUMP_PIXELS; i++) {
+          BRINTF("%02x %02x %02x %02x  ", dst[i] >> 24, (dst[i] >> 16) & 0xff, (dst[i] >> 8) & 0xff, dst[i] & 0xff);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "blend_32(8x8)", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_fetch_uyvy( DavinciC64x *c64x, bool interleave, int xoff, int yoff ) {
+  int       i, x, y, num=1;
+  long long t1, t2, dt, total;
+  u8 *yuv = c64x->mem + 0x1000000;
+  u8 *src = c64x->mem + 0x1200000;
+
+  BRINTF("\n\n\n.======================== Testing fetch_uyvy (inter %d, xoff %d, yoff %d) ========================.\n\n",
+	interleave, xoff, yoff);
+
+  for (y=0; y<20; y++) {
+    for (x=0; x<40; x++) {
+      int val = (y*40)+x;
+      src[y*1440 + x] = val;
+      BRINTF("%02x ", val&0xff);
+    }
+    BRINTF("\n");
+  }
+  BRINTF("\n");
+
+  memset( yuv, 0xAA, 0x100000 );
+
+  t1 = direct_clock_get_abs_micros();
+
+  for (i=0; i<num; i++) {
+    c64xTask *task = c64x_get_task( c64x );
+
+    task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x000000;
+    task->c64x_arg[1] = (DAVINCI_C64X_MEM+0x01000000)+0x200000 + yoff*1440 + xoff * 2;
+    task->c64x_arg[2] = 1440;
+
+    task->c64x_function = (21 << 2) | C64X_FLAG_TODO;
+
+    c64x_submit_task( c64x, task );
+  }
+
+  davinci_c64x_write_back_all( c64x );
+  davinci_c64x_write_back_all( c64x );
+  davinci_c64x_wait_low( c64x );
+
+  t2 = direct_clock_get_abs_micros();
+
+  BRINTF( "\n\nDESTINATION\n\nY:\n" );
+  for (y=0;y<27;y++) {
+    if (y==18) BRINTF("\nUV:\n");
+    for (x=0;x<32;x++) {
+      BRINTF("%02x ",yuv[y*32+x]);
+    }
+    BRINTF("\n");
+  }
+
+  dt    = t2 - t1;
+  total = num;
+
+  D_INFO("\n\nDavinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+	"blend_fetch_uyvy(16x16)", total * 1000000ULL / dt );
+}
+#if 0
+static inline void
+bench_fetch_uyvy( DavinciC64x *c64x, bool interleave, int xoff, int yoff )
+{
+     int       i, x, y, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//0x20000;
+
+     u8 *yuv = c64x->mem + 0x1000000;
+     u8 *src = c64x->mem + 0x1200000;
+
+     BRINTF("\n");
+     BRINTF("\n\n.======================== Testing fetch_uyvy (inter %d, xoff %d, yoff %d) ========================.\n",
+            interleave, xoff, yoff);
+     BRINTF("\n");
+     BRINTF( "SOURCE (20x20)\n" );
+
+     for (y=0; y<20; y++) {
+          for (x=0; x<40; x++) {
+               int val = (x & 1) ? (x * 4 + y*0x10) : (x/4 + 0x40 + (x&2) * 0x10 + y*0x08);
+
+               src[y*1440 + x] = val;
+
+               BRINTF("%02x ", val&0xff);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     memset( yuv, 0x55, 0x100000 );
+
+
+     t1 = direct_clock_get_abs_micros();
+
+    for (i=0; i<num; i++) {
+	c64xTask *task = c64x_get_task( c64x );
+
+	task->c64x_function = (19 << 2) | C64X_FLAG_TODO;
+
+	task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x000000;
+	task->c64x_arg[1] = (DAVINCI_C64X_MEM+0x01000000)+0x200000 + yoff*1440 + xoff * 2;
+	task->c64x_arg[2] = 1440;
+	task->c64x_arg[3] = 16;
+	task->c64x_arg[4] = interleave ? 1 : 0;
+
+	c64x_submit_task( c64x, task );
+    }
+
+    davinci_c64x_write_back_all( c64x );
+    davinci_c64x_wait_low( c64x );
+
+    t2 = direct_clock_get_abs_micros();
+
+
+     BRINTF( "\n\nDESTINATION (17x18 / [9x9 9x9])\n" );
+
+     for (y=0; y<18; y++) {
+          for (x=0; x<17; x++) {
+               BRINTF("%02x ", yuv[y*32 + x]);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<9; y++) {
+          for (x=0; x<9; x++) {
+               BRINTF("%02x ", yuv[y*32 + x + 32*18]);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<9; y++) {
+          for (x=0; x<9; x++) {
+               BRINTF("%02x ", yuv[y*32 + x + 32*18+16]);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     BRINTF("\n\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "blend_fetch_uyvy(16x16)", total * 1000000ULL / dt );
+}
+#endif
+
+#if 0
+static inline void
+bench_put_idct( DavinciC64x *c64x, int dct_type )
+{
+     int       i, num;
+     long long t1, t2, dt, total;
+     //int       length = 0x10000;
+
+     num = 0x10000;// / length;
+
+     u8  *dst = c64x->mem + 0x01000000;
+     int *src = c64x->mem + 0x01200000;
+
+     src[0] = DVA_BLOCK_WORD( 100, 0, 1 );
+     src[1] = DVA_BLOCK_WORD( 200, 0, 0 );
+     src[2] = DVA_BLOCK_WORD( 210, 1, 0 );
+     src[3] = DVA_BLOCK_WORD( 220, 2, 1 );
+     src[4] = DVA_BLOCK_WORD( 300, 0, 1 );
+     src[5] = DVA_BLOCK_WORD( 400, 0, 0 );
+     src[6] = DVA_BLOCK_WORD( 410, 1, 1 );
+     src[7] = DVA_BLOCK_WORD( 500, 0, 0 );
+     src[8] = DVA_BLOCK_WORD( 510, 63, 1 );
+     src[9] = DVA_BLOCK_WORD( 600, 63, 1 );
+
+     BRINTF("\n");
+     BRINTF("\n\n.======================== Testing put_idct (%d) ========================.\n", dct_type);
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+
+     for (i=0; i<10; i++) {
+          BRINTF("0x%08x  (%d, %d, %d)\n", (u32)src[i], src[i] >> 16, (src[i] >> 1) & 0x3f, src[i] & 1);
+     }
+
+     BRINTF("\n");
+
+     t1 = direct_clock_get_abs_micros();
+
+     {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x1200000;
+          task->c64x_arg[1] = 10;
+          task->c64x_arg[2] = 0x3f;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_blit_16( c64x, (DAVINCI_C64X_MEM+0x01000000), 0, 0xf06180, 0, 384, 1 );
+     davinci_c64x_blit_16( c64x, (DAVINCI_C64X_MEM+0x01100000), 0, 0xf06480, 0, 384/2, 1 );
+
+     davinci_c64x_put_uyvy_16x16( c64x, (DAVINCI_C64X_MEM+0x01300000), 32, 0xf06180, 0 );
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+
+     for (i=0; i<384; i++) {
+          BRINTF("%5d ", dst[i] );
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+          if (i%64==63) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+
+
+     for (i=0; i<384; i++) {
+          BRINTF("%3d ", duv[i] );
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+          if (i%64==63) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n\n");
+
+     for (i=0; i<16*16*2; i++) {
+          BRINTF("%02x ", duy[i]);
+
+          if (i%32==31) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;// * length;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "block_load()", total * 1000000ULL / dt );
+}
+#endif
+
+static inline void
+bench_put_mc( DavinciC64x *c64x, bool interleave )
+{
+     int       x, y, i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//720/16*576/16;
+
+     u8 *dst = c64x->mem + 0x1000000;
+     u8 *src = c64x->mem + 0x1200000;
+
+     BRINTF("\n");
+     BRINTF("\n\n.======================== Testing put_mc (%d) ========================.\n", interleave);
+     BRINTF("\n");
+     BRINTF("SOURCE (16x16 / [8x8 8x8]\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<16; x++) {
+               u8 val = (x << 4) + y;
+               src[y*16 + x] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16 + 8] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+
+     davinci_c64x_blit_32( c64x, C64X_MC_BUFFER_Y, 16, DAVINCI_C64X_MEM+0x1200000, 16, 4, 24 );
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x1000000;
+          task->c64x_arg[1] = 1440;
+          task->c64x_arg[2] = interleave ? 1 : 0;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+
+     BRINTF("\n");
+     BRINTF("DESTINATION (16x16 UYVY)\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<32; x++)
+               BRINTF("%02x ", dst[y*1440 + x]);
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "put_mc_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_put_sum( DavinciC64x *c64x, bool interleave )
+{
+     int       x, y, i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//720/16*576/16;
+
+     u8  *dst   = c64x->mem + 0x1000000;
+     u8  *src   = c64x->mem + 0x1200000;
+     u32 *words = c64x->mem + 0x1100000;
+
+     BRINTF("\n");
+     BRINTF("\n\n.======================== Testing put_sum (%d) ========================.\n", interleave);
+     BRINTF("\n");
+     BRINTF("WORDS (6x IDCT with one value)\n");
+
+     words[0] = DVA_BLOCK_WORD(   0, 0, 1 );
+     words[1] = DVA_BLOCK_WORD(  50, 0, 1 );
+     words[2] = DVA_BLOCK_WORD( 100, 0, 1 );
+     words[3] = DVA_BLOCK_WORD( 150, 0, 1 );
+     words[4] = DVA_BLOCK_WORD( 200, 0, 1 );
+     words[5] = DVA_BLOCK_WORD( 250, 0, 1 );
+
+     BRINTF("\n");
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+
+     for (i=0; i<6; i++) {
+          BRINTF("0x%08x  (%d, %d, %d)\n", (u32)words[i], words[i] >> 16, (words[i] >> 1) & 0x3f, words[i] & 1);
+     }
+
+     {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x1100000;
+          task->c64x_arg[1] = 6;
+          task->c64x_arg[2] = 0x3f;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     BRINTF("\n");
+     BRINTF("SOURCE (16x16 / [8x8 8x8]\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<16; x++) {
+               u8 val = (x << 4) + y;
+               src[y*16 + x] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16 + 8] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+
+     davinci_c64x_blit_32( c64x, C64X_MC_BUFFER_Y, 16, DAVINCI_C64X_MEM+0x1200000, 16, 4, 24 );
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x1000000;
+          task->c64x_arg[1] = 1440;
+          task->c64x_arg[2] = interleave ? 1 : 0;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+
+     BRINTF("\n");
+     BRINTF("DESTINATION (16x16 UYVY)\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<32; x++)
+               BRINTF("%02x ", dst[y*1440 + x]);
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "put_sum_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_sat_mc( DavinciC64x *c64x )
+{
+     int       x, y, i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//720/16*576/16;
+
+     u8 *dst = c64x->mem + 0x1000000;
+     u8 *src = c64x->mem + 0x1200000;
+
+     BRINTF("\n\n.======================== Testing sat_mc ========================.\n");
+     BRINTF("\n");
+     BRINTF("SOURCE (16x16 / [8x8 8x8]\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<16; x++) {
+               u8 val = (x << 4) + y;
+               src[y*16 + x] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++) {
+               u8 val = (x << 4) + y*2;
+               src[y*16 + x + 16*16 + 8] = val;
+               BRINTF("%02x ", val);
+          }
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = (57 << 2) | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x1000000;
+          task->c64x_arg[1] = DAVINCI_C64X_MEM+0x1200000;
+          task->c64x_arg[2] = 16;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+
+     BRINTF("\n");
+     BRINTF("DESTINATION (16x16 / [8x8 8x8]\n");
+
+     for (y=0; y<16; y++) {
+          for (x=0; x<16; x++)
+               BRINTF("%02x ", dst[y*16 + x]);
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++)
+               BRINTF("%02x ", dst[y*16 + x + 16*16]);
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     for (y=0; y<8; y++) {
+          for (x=0; x<8; x++)
+               BRINTF("%02x ", dst[y*16 + x + 16*16 + 8]);
+
+          BRINTF("\n");
+     }
+
+     BRINTF("\n\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "sat_mc_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_uyvy_1( DavinciC64x *c64x, bool progressive )
+{
+     c64xTask *task;
+     int       i, num;
+     long long t1, t2, dt, total;
+
+     num = 720/16*576/16;
+
+     u8 *u = c64x->mem + 0x1200000;
+     u8 *p = c64x->mem + 0x1000000;
+
+     BRINTF("\n\n\n.======================== Testing put_uyvy (%s) ========================.\n\n",
+            progressive ? "progressive" : "interlaced");
+
+     for (i=0; i<256; i++) {
+          p[i] = i - 128;
+          BRINTF("Y%-3d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[256+i] = i-32;
+          BRINTF("U%-3d ", p[256+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[320+i] = i-32;
+          BRINTF("V%-3d ", p[320+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     for (i=0; i<384; i++) {
+          BRINTF("%4d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     memset( u, 0x55, 720*576*2 );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          davinci_c64x_dva_begin_frame( c64x, 720 * 2, (DAVINCI_C64X_MEM+0x01000000)+0x200000+i*16*16*2, 0, 0, progressive ? 0x100 : 0 );
+
+          task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x200000+i*16*16*2;
+          task->c64x_arg[1] = 720 * 2;
+          task->c64x_arg[2] = (DAVINCI_C64X_MEM+0x01000000);
+          task->c64x_arg[3] = 0;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     BRINTF("\n");
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     for (i=0; i<16*16*2; i++) {
+          BRINTF("%02x ", u[i/32*720*2 + i%32]);
+
+          if (i%32==31) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "put_uyvy_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_uyvy_2( DavinciC64x *c64x, bool progressive )
+{
+     c64xTask *task;
+     int       i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//720/16*576/16;
+
+     u8 *u = c64x->mem + 0x0200000;
+     u8 *p = c64x->mem + 0x0000000;
+
+     BRINTF("\n\n\n.======================== Testing put_uyvy (%s) ========================.\n\n",
+            progressive ? "progressive" : "interlaced");
+
+     for (i=0; i<256; i++) {
+          p[i] = i/8;
+          BRINTF("Y%-3d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[256+i] = i/8 + 128;
+          BRINTF("U%-3d ", p[256+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[320+i] = i/8 + 240;
+          BRINTF("V%-3d ", p[320+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     for (i=0; i<384; i++) {
+          BRINTF("%4d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     memset( u, 0x55, 720*576*2 );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          davinci_c64x_dva_begin_frame( c64x, 720 * 2, (DAVINCI_C64X_MEM+0x01000000)+0x200000+i*16*16*2, 0, 0, progressive ? 0x100 : 0 );
+
+          task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM+0x200000+i*16*16*2;
+          task->c64x_arg[1] = 720 * 2;
+          task->c64x_arg[2] = DAVINCI_C64X_MEM;
+          task->c64x_arg[3] = 0;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     BRINTF("\n");
+
+     davinci_c64x_write_back_all( c64x );
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     for (i=0; i<16*16*2; i++) {
+          BRINTF("%02x ", u[i/32*720*2 + i%32]);
+
+          if (i%32==31) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "put_uyvy_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_uyvy_3( DavinciC64x *c64x, bool progressive )
+{
+     c64xTask *task;
+     int       i, num;
+     long long t1, t2, dt, total;
+
+     num = 1;//720/16*576/16;
+
+     u8 *u = c64x->mem + 0x1200000;
+     u8 *p = c64x->mem + 0x1000000;
+
+     BRINTF("\n\n\n.======================== Testing put_uyvy (%s) ========================.\n\n",
+            progressive ? "progressive" : "interlaced");
+
+     for (i=0; i<256; i++) {
+          p[i] = i%8;
+          BRINTF("Y%-3d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[256+i] = i%8 + 128;
+          BRINTF("U%-3d ", p[256+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     for (i=0; i<64; i++) {
+          p[320+i] = i%8 + 240;
+          BRINTF("V%-3d ", p[320+i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     for (i=0; i<384; i++) {
+          BRINTF("%4d ", p[i]);
+          if (i%8==7) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     memset( u, 0x55, 720*576*2 );
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          davinci_c64x_dva_begin_frame( c64x, 720 * 2, (DAVINCI_C64X_MEM+0x01000000)+0x200000+i*16*16*2, 0, 0, progressive ? 0x100 : 0 );
+
+          task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = (DAVINCI_C64X_MEM+0x01000000)+0x200000+i*16*16*2;
+          task->c64x_arg[1] = 720 * 2;
+          task->c64x_arg[2] = (DAVINCI_C64X_MEM+0x01000000);
+          task->c64x_arg[3] = 0;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     BRINTF("\n");
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     for (i=0; i<16*16*2; i++) {
+          BRINTF("%02x ", u[i/32*720*2 + i%32]);
+
+          if (i%32==31) {
+               BRINTF("\n");
+          }
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     D_INFO( "Davinci/C64X: BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "put_uyvy_16x16()", total * 1000000ULL / dt );
+}
+
+static inline void
+bench_mc( DavinciC64x *c64x, int func, int w, int h, bool avg, const char *name )
+{
+     int       i, x, y, num;
+     long long t1, t2, dt, total;
+
+     num = 0x1;//0000;
+
+     u8 *dst = c64x->mem + 0x1200000;
+     u8 *dsr = c64x->mem + 0x1100000;
+     u8 *src = c64x->mem + 0x1000000;
+
+     BRINTF("\n\n.============ Testing %s ============.\n", name);
+     BRINTF("\n");
+     BRINTF("SRC REF\n");
+
+     for (y=0; y<h+1; y++) {
+          for (x=0; x<w+1; x++) {
+               src[x+y*32] = x*y;
+               BRINTF("%-3d ", src[x+y*32]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     BRINTF("DST REF\n");
+
+     for (y=0; y<h; y++) {
+          for (x=0; x<w; x++) {
+               dsr[x+y*32] = w*h-1-x*y;
+               BRINTF("%-3d ", dsr[x+y*32]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+
+     for (i=0; i<0x100000; i++) {
+          dst[i] = i;
+     }
+
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = (func << 2) | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM + 0x01200000;
+          task->c64x_arg[1] = 32;
+          task->c64x_arg[2] = DAVINCI_C64X_MEM + 0x01000000;
+          task->c64x_arg[3] = DAVINCI_C64X_MEM + 0x01100000;
+          task->c64x_arg[4] = 32;
+          task->c64x_arg[5] = h;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     BRINTF("-> DST\n");
+
+     for (y=0; y<h; y++) {
+          for (x=0; x<w; x++) {
+               BRINTF("%-3d ", dst[x+y*32]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     BRINTF( "BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             name, total * 1000000ULL / dt );
+}
+
+static inline void
+bench_div( DavinciC64x *c64x, u32 nom, u32 den )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     BRINTF("\n\n.============ Testing div ============.\n");
+     BRINTF("\n");
+
+     task->c64x_function = (63 << 2) | C64X_FLAG_TODO;
+
+     task->c64x_arg[0] = nom;
+     task->c64x_arg[1] = den;
+
+     c64x_submit_task( c64x, task );
+
+     davinci_c64x_wait_low( c64x );
+
+     BRINTF("%x / %x = %x\n\n\n", nom, den, task->c64x_return);
+}
+
+static inline void
+bench_dither_argb( DavinciC64x *c64x )
+{
+     int       i, x, y, num, w = 8, h = 17;
+     long long t1, t2, dt, total;
+
+     num = 0x10000;
+
+     u16 *dr  = c64x->mem + 0x1200000;
+     u8  *da  = c64x->mem + 0x1100000;
+     u32 *src = c64x->mem + 0x1000000;
+
+     BRINTF("\n\n.======================== Testing dither_argb ========================.\n");
+     BRINTF("\n");
+     BRINTF("SOURCE ARGB\n");
+
+     for (y=0; y<h-1; y++) {
+          for (x=0; x<w; x++) {
+               src[x+y*32] = 0x10101010 * y + 0x888888 * x;
+               BRINTF("%08x ", src[x+y*32]);
+          }
+          BRINTF("\n");
+     }
+     for (x=0; x<w; x++) {
+          src[x+(h-1)*32] = 0xffffffff;
+          BRINTF("%08x ", src[x+y*32]);
+     }
+
+     BRINTF("\n");
+     BRINTF("\n");
+
+     memset( dr, 0x55, 0x100000 );
+     memset( da, 0x55, 0x100000 );
+
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM + 0x01200000;
+          task->c64x_arg[1] = DAVINCI_C64X_MEM + 0x01100000;
+          task->c64x_arg[2] = 64;
+          task->c64x_arg[3] = DAVINCI_C64X_MEM + 0x01000000;
+          task->c64x_arg[4] = 128;
+          task->c64x_arg[5] = w;
+          task->c64x_arg[6] = h;
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+     BRINTF("-> DST RGB\n");
+
+     for (y=0; y<h; y++) {
+          for (x=0; x<w; x++) {
+               BRINTF("    %04x ", dr[x+y*32]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     BRINTF("-> DST ALPHA\n");
+
+     for (y=0; y<h; y++) {
+          for (x=0; x<w; x++) {
+               if (x&1)
+                    BRINTF(" %x       ", da[x/2+y*64] & 0xF);
+               else
+                    BRINTF(" %x       ", da[x/2+y*64] >> 4);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+     dt    = t2 - t1;
+     total = num;
+
+     BRINTF( "BENCHMARK on DSP - %-15s   %lld Calls/sec\n",
+             "dither_argb", total * 1000000ULL / dt );
+}
+
+
+
+
+/**********************************************************************************************************************/
+/*** 32 bit scaler ****************************************************************************************************/
+/**********************************************************************************************************************/
+
+typedef struct {
+     DFBRegion   clip;
+     const void *colors;
+     ulong       protect;
+     ulong       key;
+} StretchCtx;
+
+typedef void (*StretchHVx)( void             *dst,
+                            int               dpitch,
+                            const void       *src,
+                            int               spitch,
+                            int               width,
+                            int               height,
+                            int               dst_width,
+                            int               dst_height,
+                            const StretchCtx *ctx );
+
+#define STRETCH_NONE           0
+#define STRETCH_SRCKEY         1
+#define STRETCH_PROTECT        2
+#define STRETCH_SRCKEY_PROTECT 3
+#define STRETCH_NUM            4
+
+typedef struct {
+     struct {
+          StretchHVx     up[STRETCH_NUM];
+          StretchHVx     down[STRETCH_NUM];
+     } f[DFB_NUM_PIXELFORMATS];
+} StretchFunctionTable;
+
+
+#define DST_FORMAT              DSPF_ARGB
+#define TABLE_NAME              stretch_32
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_32_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R8                8
+#define SHIFT_L8                8
+#define X_00FF00FF              0x00ff00ff
+#define X_FF00FF00              0xff00ff00
+#define MASK_RGB                0x00ffffff
+#define HAS_ALPHA
+
+#include <gfx/generic/stretch_up_down_32.h>
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R8
+#undef SHIFT_L8
+#undef X_00FF00FF
+#undef X_FF00FF00
+#undef MASK_RGB
+#undef HAS_ALPHA
+
+
+static inline void
+bench_stretch_32( DavinciC64x *c64x, int sw, int sh, int dw, int dh )
+{
+     int       i, x, y, num;
+     long long t1, t2, dt, total;
+     bool      down = (dw < sw) && (dh < sh);
+
+#if 0
+     int SW = (sw + 5) & ~3;
+     int SH = (sh + 5) & ~3;
+     int DW = (dw + 5) & ~3;
+     int DH = (dh + 5) & ~3;
+#else
+     int SW = sw;
+     int SH = sh;
+     int DW = dw;
+     int DH = dh;
+#endif
+
+     num = 1;//0x10000;
+
+     u32  cpu[DW * DH];
+     u32 *dst = c64x->mem + 0x1200000;
+     u32 *src = c64x->mem + 0x1000000;
+
+     memset( src, 0x55, 0x100000 );
+
+     for (y=0; y<sh; y++) {
+          for (x=0; x<sw; x++) {
+               src[x + y*SW] = 0xffffffff * x;//  0x10010203 * x + 0x04202020 * (y + 1);
+          }
+     }
+
+
+     BRINTF("\n\n.======================== Testing stretch_32( %dx%d -> %dx%d ) ========================.\n", sw, sh, dw, dh);
+     BRINTF("\n");
+     BRINTF("SOURCE IMAGE (%dx%d) [%dx%d]\n", sw, sh, SW, SH);
+
+     for (y=0; y<SH; y++) {
+          for (x=0; x<SW; x++) {
+               BRINTF("%08x ", src[x + y*SW]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+     BRINTF("\n");
+
+     memset( dst, 0x55, 0x100000 );
+     memset( cpu, 0x55, sizeof(cpu) );
+
+
+     t1 = direct_clock_get_abs_micros();
+
+     for (i=0; i<num; i++) {
+          c64xTask *task = c64x_get_task( c64x );
+
+          task->c64x_function = (down ?
+                                 C64X_STRETCH_32_down :
+                                 C64X_STRETCH_32_up ) | C64X_FLAG_TODO;
+
+          task->c64x_arg[0] = DAVINCI_C64X_MEM + 0x1200000;
+          task->c64x_arg[1] = DAVINCI_C64X_MEM + 0x1000000;
+          task->c64x_arg[2] = (DW * 4) | ((SW * 4) << 16);
+          task->c64x_arg[3] = dh       | (dw       << 16);
+          task->c64x_arg[4] = sh       | (sw       << 16);
+          task->c64x_arg[5] = (dw - 1) | ((dh - 1) << 16);
+          task->c64x_arg[6] = 0        | (0        << 16);
+
+          c64x_submit_task( c64x, task );
+     }
+
+     davinci_c64x_write_back_all( c64x );
+
+     davinci_c64x_wait_low( c64x );
+
+     t2 = direct_clock_get_abs_micros();
+
+
+     BRINTF("-> DSP RESULT (%dx%d) [%dx%d]\n", dw, dh, DW, DH);
+
+     for (y=0; y<DH; y++) {
+          for (x=0; x<DW; x++) {
+               BRINTF("%08x ", dst[x + y*DW]);
+          }
+          BRINTF("\n");
+     }
+
+     BRINTF("\n");
+
+
+     {
+          StretchHVx func = (down ?
+                              stretch_32.f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)].down[STRETCH_NONE] :
+                              stretch_32.f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)].up[STRETCH_NONE]);
+          StretchCtx ctx  = { .clip = DFB_REGION_INIT_FROM_RECTANGLE_VALS( 0, 0, dw, dh ) };
+     
+          func( cpu, DW * 4, src, SW * 4, sw, sh, dw, dh, &ctx );
+     
+          BRINTF("-> CPU RESULT (%dx%d) [%dx%d]\n", dw, dh, DW, DH);
+     
+          for (y=0; y<DH; y++) {
+               for (x=0; x<DW; x++) {
+                    BRINTF("%08x ", cpu[x + y*DW]);
+               }
+               BRINTF("\n");
+          }
+     
+          BRINTF("\n");
+     }
+
+     dt    = t2 - t1;
+     total = num;
+
+     BRINTF( "BENCHMARK on DSP - stretch_32_up   %lld Calls/sec\n", total * 1000000ULL / dt );
+}
+
+static inline void
+run_benchmarks( const char *name,
+                void       *ptr,
+                int         length )
+{
+     bench_mem( name, ptr, length, false, false );
+     bench_mem( name, ptr, length, true,  false );
+     bench_mem( name, ptr, length, true,  true  );
+}
+
+/**********************************************************************************************************************/
+/*   Public Functions                                                                                                 */
+/**********************************************************************************************************************/
+
+DFBResult
+davinci_c64x_open( DavinciC64x *c64x )
+{
+     DFBResult  ret;
+     int        fd;
+     void      *map_m;
+     void      *map_q = NULL;
+
+     mknod( C64X_DEVICE, 0666 | S_IFCHR, makedev( 400, 0 ) );
+
+     fd = direct_try_open( C64X_DEVICE, C64X_DEVICE0, O_RDWR, true );
+     if (fd < 0)
+          return DFB_IO;
+
+     map_q = mmap( NULL, C64X_QLEN, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
+     if (map_q == MAP_FAILED) {
+          ret = errno2result( errno );
+          D_PERROR( "Davinci/C64X: Mapping %lu bytes at %lu via '%s' failed!\n", C64X_QLEN, 0UL, C64X_DEVICE );
+          goto error;
+     }
+
+//     run_benchmarks( "Queue", map_q, C64X_QLEN );
+
+     map_m = mmap( NULL, C64X_MLEN, PROT_READ | PROT_WRITE, MAP_SHARED, fd, C64X_QLEN );
+     if (map_m == MAP_FAILED) {
+          ret = errno2result( errno );
+          D_PERROR( "Davinci/C64X: Mapping %lu bytes at %lu via '%s' failed!\n", C64X_MLEN, C64X_QLEN, C64X_DEVICE );
+          goto error;
+     }
+
+//     run_benchmarks( "Memory", map_m, C64X_MLEN );
+
+     c64x->fd  = fd;
+     c64x->ctl = map_q;
+     c64x->mem = map_m;
+     c64x->QueueL = map_m + 0x01e00000;
+
+     D_INFO( "Davinci/C64X: Low ARM %d / DSP %d, High ARM %d / DSP %d\n",
+             c64x->ctl->QL_arm, c64x->ctl->QL_dsp, c64x->ctl->QH_arm, c64x->ctl->QH_dsp );
+
+     D_MAGIC_SET( c64x, DavinciC64x );
+
+if (getenv("C64X_TEST")) {
+//     test_load_block( c64x, false );
+
+//     test_load_block( c64x, true );
+
+//     bench_dither_argb( c64x );
+
+#if 0
+     bench_uyvy_1( c64x, true );
+     bench_uyvy_1( c64x, false );
+     bench_uyvy_2( c64x, true );
+     bench_uyvy_2( c64x, false );
+     bench_uyvy_3( c64x, true );
+     bench_uyvy_3( c64x, false );
+#endif
+
+#if 0
+     bench_blend_argb( c64x, 0 );
+     bench_blend_argb( c64x, 1 );
+     bench_blend_argb( c64x, 2 );
+     bench_blend_argb( c64x, 3 );
+#endif
+
+#if 0
+     bench_stretch_32( c64x, 2, 1, 16, 1 );
+     bench_stretch_32( c64x, 2, 2, 16, 2 );
+
+     bench_stretch_32( c64x, 2, 1,  3, 1 );
+     bench_stretch_32( c64x, 4, 1,  6, 1 );
+
+     bench_stretch_32( c64x, 3, 1,  2, 1 );
+     bench_stretch_32( c64x, 6, 1,  4, 1 );
+#endif
+
+#if 1
+     bench_fetch_uyvy( c64x, false, 0, 0 );
+     bench_fetch_uyvy( c64x, false, 1, 0 );
+     bench_fetch_uyvy( c64x, false, 0, 1 );
+     bench_fetch_uyvy( c64x, false, 1, 1 );
+     bench_fetch_uyvy( c64x, true, 0, 0 );
+     bench_fetch_uyvy( c64x, true, 1, 0 );
+     bench_fetch_uyvy( c64x, true, 0, 1 );
+     bench_fetch_uyvy( c64x, true, 1, 1 );
+#endif
+
+#if 0
+     bench_put_mc( c64x, false );
+     bench_put_mc( c64x, true );
+
+     bench_put_sum( c64x, false );
+     bench_put_sum( c64x, true );
+
+     bench_sat_mc( c64x );
+#endif
+
+#if 0
+     bench_mc( c64x, 32, 8, 8, false, "mc_put_o_8" );
+     bench_mc( c64x, 33, 8, 8, false, "mc_put_x_8" );
+     bench_mc( c64x, 34, 8, 8, false, "mc_put_y_8" );
+     bench_mc( c64x, 35, 8, 8, false, "mc_put_xy_8" );
+     bench_mc( c64x, 36, 16, 16, false, "mc_put_o_16" );
+     bench_mc( c64x, 37, 16, 16, false, "mc_put_x_16" );
+     bench_mc( c64x, 38, 16, 16, false, "mc_put_y_16" );
+     bench_mc( c64x, 39, 16, 16, false, "mc_put_xy_16" );
+#endif
+
+#if 0
+     bench_mc( c64x, 40, 8, 8, true, "mc_avg_o_8" );
+     bench_mc( c64x, 41, 8, 8, true, "mc_avg_x_8" );
+     bench_mc( c64x, 42, 8, 8, true, "mc_avg_y_8" );
+     bench_mc( c64x, 43, 8, 8, true, "mc_avg_xy_8" );
+     bench_mc( c64x, 44, 16, 16, true, "mc_avg_o_16" );
+     bench_mc( c64x, 45, 16, 16, true, "mc_avg_x_16" );
+     bench_mc( c64x, 46, 16, 16, true, "mc_avg_y_16" );
+     bench_mc( c64x, 47, 16, 16, true, "mc_avg_xy_16" );
+#endif
+
+#if 0
+     bench_div( c64x, 1, 3 );
+     bench_div( c64x, 1000, 333 );
+     bench_div( c64x, 1000, 334 );
+     bench_div( c64x, 6666, 2222 );
+     bench_div( c64x, 1234, 1234 );
+     bench_div( c64x, 4000, 0 );
+     bench_div( c64x, 5000, 0 );
+     bench_div( c64x, 10000, 3 );
+     bench_div( c64x, 14, 3 );
+     bench_div( c64x, 0x10000, 0x1000 );
+     bench_div( c64x, 0x1000, 0x100 );
+     bench_div( c64x, 0x100000, 2 );
+#endif
+}
+
+     return DFB_OK;
+
+
+error:
+     if (map_q)
+          munmap( map_q, C64X_QLEN );
+
+     close( fd );
+
+     return ret;
+}
+
+DFBResult
+davinci_c64x_close( DavinciC64x *c64x )
+{
+     D_MAGIC_ASSERT( c64x, DavinciC64x );
+
+     munmap( (void*) c64x->mem, C64X_MLEN );
+     munmap( (void*) c64x->ctl, C64X_QLEN );
+
+     close( c64x->fd );
+
+     D_MAGIC_CLEAR( c64x );
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.h b/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.h
new file mode 100755
index 0000000..682da22
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_c64x.h
@@ -0,0 +1,935 @@
+/*
+   TI Davinci driver - C64X+ DSP Library
+
+   (c) Copyright 2008  directfb.org
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org> and
+              Olaf Dreesen <olaf@directfb.org>.
+
+   All rights reserved.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   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
+   General Public License for more details.
+
+   You should have received a copy of the GNU 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 __DAVINCI_C64X_H__
+#define __DAVINCI_C64X_H__
+
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/trace.h>
+
+#include <linux/c64x.h>
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                 magic;
+
+     int                 fd;
+     c64xTaskControl    *ctl;
+     void               *mem;
+
+     c64xTask           *QueueL;
+} DavinciC64x;
+
+typedef struct {
+     int                 magic;
+     unsigned int        max_tasks;
+     unsigned int        num_tasks;
+     c64xTask           *tasks;
+} DavinciC64xTasks;
+
+typedef enum {
+     C64X_TEF_NONE       = 0x0000,
+     C64X_TEF_RESET      = 0x0001
+} DavinciC64xEmitFlags;
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_open    ( DavinciC64x *c64x );
+
+DFBResult davinci_c64x_close   ( DavinciC64x *c64x );
+
+DFBResult davinci_c64x_wait_low( DavinciC64x *c64x );
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_tasks_init   ( DavinciC64xTasks *tasks,
+                                      unsigned int      size );
+
+DFBResult davinci_c64x_tasks_destroy( DavinciC64xTasks *tasks );
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_emit_tasks( DavinciC64x          *c64x,
+                                   DavinciC64xTasks     *tasks,
+                                   DavinciC64xEmitFlags  flags );
+
+/**********************************************************************************************************************/
+
+static const char *state_names[] = { "DONE", "ERROR", "TODO", "RUNNING" };
+
+static inline c64xTask *
+c64x_get_task( DavinciC64x *c64x )
+{
+     c64xTaskControl *ctl   = c64x->ctl;
+     uint32_t         idx   = ctl->QL_arm;
+     uint32_t         next  = (idx + 1) & C64X_QUEUE_MASK;
+     c64xTask        *task  = &c64x->QueueL[idx];
+     int              loops = 0;
+     uint32_t         idle  = 0;
+
+     /* Wait for the entry (and next) to be processed by the DSP (rare case). */
+     while (task->c64x_flags & C64X_FLAG_TODO || ctl->QL_dsp == next) {
+          if (loops > 666 || (idle && ctl->idlecounter - idle > 666)) {
+               c64xTask *dsp_task = &c64x->QueueL[ctl->QL_dsp];
+
+               D_PERROR( "Davinci/C64X+: Blocked! [DSP %d / %d (%s), ARM %d / %d (%s)]\n",
+                         ctl->QL_dsp,
+                         (dsp_task->c64x_function >> 2) & 0x3fff,
+                         state_names[dsp_task->c64x_function & 3],
+                         ctl->QL_arm,
+                         (task->c64x_function >> 2) & 0x3fff,
+                         state_names[task->c64x_function & 3] );
+
+               break;
+          }
+
+          idle = ctl->idlecounter;
+
+          /* Queue is full, waiting 10-20ms should not be too bad. */
+          if (loops++ > 10)
+               usleep( 5000 );
+     }
+
+     return task;
+}
+
+static inline void
+c64x_submit_task( DavinciC64x *c64x, c64xTask *task )
+{
+     c64xTaskControl *ctl  = c64x->ctl;
+     uint32_t         idx  = ctl->QL_arm;
+     uint32_t         next = (idx + 1) & C64X_QUEUE_MASK;
+
+     mb();
+
+     ctl->QL_arm = next;
+
+     mb();
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_wb_inv_range( DavinciC64x   *c64x,
+                           unsigned long  start,
+                           u32            length,
+                           u32            func )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = start;
+     task->c64x_arg[1] = length;
+     task->c64x_arg[2] = func;
+
+     task->c64x_function = C64X_WB_INV_RANGE | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_write_back_all( DavinciC64x *c64x )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_function = C64X_WRITE_BACK_ALL | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_load_block__L( DavinciC64xTasks *tasks,
+                            unsigned long     words,
+                            u32               num,
+                            u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = words;
+     task->c64x_arg[1] = num;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_load_block( DavinciC64x   *c64x,
+                         unsigned long  words,
+                         u32            num,
+                         u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = words;
+     task->c64x_arg[1] = num;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fetch_uyvy( DavinciC64x   *c64x,
+                         unsigned long  dest,
+                         unsigned long  source,
+                         u32            pitch,
+                         u32            height,
+                         u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = source;
+     task->c64x_arg[2] = pitch;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_FETCH_UYVY | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_mc( DavinciC64x   *c64x,
+                 unsigned long  dest,
+                 u32            dpitch,
+                 unsigned long  source0,
+                 unsigned long  source1,
+                 u32            spitch,
+                 u32            height,
+                 int            func )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = source0;
+     task->c64x_arg[3] = source1;
+     task->c64x_arg[4] = spitch;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = func | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_idct_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                     unsigned long     dest,
+                                     u32               pitch,
+                                     u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_idct_uyvy_16x16( DavinciC64x   *c64x,
+                                  unsigned long  dest,
+                                  u32            pitch,
+                                  u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_mc_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                   unsigned long     dest,
+                                   u32               pitch,
+                                   u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_mc_uyvy_16x16( DavinciC64x   *c64x,
+                                unsigned long  dest,
+                                u32            pitch,
+                                u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_sum_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                    unsigned long     dest,
+                                    u32               pitch,
+                                    u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_sum_uyvy_16x16( DavinciC64x   *c64x,
+                                 unsigned long  dest,
+                                 u32            pitch,
+                                 u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dva_begin_frame__L( DavinciC64xTasks *tasks,
+                                 u32               pitch,
+                                 unsigned long     current,
+                                 unsigned long     past,
+                                 unsigned long     future,
+                                 u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = pitch;
+     task->c64x_arg[1] = current;
+     task->c64x_arg[2] = past;
+     task->c64x_arg[3] = future;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dva_begin_frame( DavinciC64x   *c64x,
+                              u32            pitch,
+                              unsigned long  current,
+                              unsigned long  past,
+                              unsigned long  future,
+                              u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = pitch;
+     task->c64x_arg[1] = current;
+     task->c64x_arg[2] = past;
+     task->c64x_arg[3] = future;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dva_motion_block__L( DavinciC64xTasks *tasks,
+                                  unsigned long     macroblock )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = macroblock;
+
+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dva_motion_block( DavinciC64x   *c64x,
+                               unsigned long  macroblock )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = macroblock;
+
+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_dva_idct( DavinciC64x   *c64x,
+				   unsigned long  dest,
+				   u32            pitch,
+				   unsigned long  source )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = source;
+
+     task->c64x_function = C64X_DVA_IDCT | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_put_uyvy_16x16( DavinciC64x   *c64x,
+                             unsigned long  dest,
+                             u32            pitch,
+                             unsigned long  source,
+                             u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = source;
+     task->c64x_arg[3] = flags;
+
+     task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dither_argb__L( DavinciC64xTasks *tasks,
+                             unsigned long     dst_rgb,
+                             unsigned long     dst_alpha,
+                             u32               dst_pitch,
+                             unsigned long     source,
+                             u32               src_pitch,
+                             u32               width,
+                             u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dst_rgb;
+     task->c64x_arg[1] = dst_alpha;
+     task->c64x_arg[2] = dst_pitch;
+     task->c64x_arg[3] = source;
+     task->c64x_arg[4] = src_pitch;
+     task->c64x_arg[5] = width;
+     task->c64x_arg[6] = height;
+
+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dither_argb( DavinciC64x   *c64x,
+                          unsigned long  dst_rgb,
+                          unsigned long  dst_alpha,
+                          u32            dst_pitch,
+                          unsigned long  source,
+                          u32            src_pitch,
+                          u32            width,
+                          u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dst_rgb;
+     task->c64x_arg[1] = dst_alpha;
+     task->c64x_arg[2] = dst_pitch;
+     task->c64x_arg[3] = source;
+     task->c64x_arg[4] = src_pitch;
+     task->c64x_arg[5] = width;
+     task->c64x_arg[6] = height;
+
+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fill_16__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               pitch,
+                         u32               width,
+                         u32               height,
+                         u32               value )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_fill_16( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            pitch,
+                      u32            width,
+                      u32            height,
+                      u32            value )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fill_32__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               pitch,
+                         u32               width,
+                         u32               height,
+                         u32               value )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_fill_32( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            pitch,
+                      u32            width,
+                      u32            height,
+                      u32            value )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_16__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               dpitch,
+                         unsigned long     src,
+                         u32               spitch,
+                         u32               width,
+                         u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_16( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            dpitch,
+                      unsigned long  src,
+                      u32            spitch,
+                      u32            width,
+                      u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_32__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               dpitch,
+                         unsigned long     src,
+                         u32               spitch,
+                         u32               width,
+                         u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_32( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            dpitch,
+                      unsigned long  src,
+                      u32            spitch,
+                      u32            width,
+                      u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_stretch_32__L( DavinciC64xTasks *tasks,
+                            unsigned long     dest,
+                            u32               dpitch,
+                            unsigned long     src,
+                            u32               spitch,
+                            u32               dw,
+                            u32               dh,
+                            u32               sw,
+                            u32               sh,
+                            const DFBRegion  *clip )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = src;
+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
+     task->c64x_arg[3] = dh       | (dw       << 16);
+     task->c64x_arg[4] = sh       | (sw       << 16);
+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
+
+     if (sw > dw && sh > dh)
+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
+     else
+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_stretch_32( DavinciC64x     *c64x,
+                         unsigned long    dest,
+                         u32              dpitch,
+                         unsigned long    src,
+                         u32              spitch,
+                         u32              dw,
+                         u32              dh,
+                         u32              sw,
+                         u32              sh,
+                         const DFBRegion *clip )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = src;
+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
+     task->c64x_arg[3] = dh       | (dw       << 16);
+     task->c64x_arg[4] = sh       | (sw       << 16);
+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
+
+     if (sw > dw && sh > dh)
+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
+     else
+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_blend_32__L( DavinciC64xTasks *tasks,
+                               u32               sub_func,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               argb,
+                               u8                alpha )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width | (height << 16);
+     task->c64x_arg[5] = argb;
+     task->c64x_arg[6] = alpha;
+
+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_blend_32( DavinciC64x   *c64x,
+                            u32            sub_func,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            argb,
+                            u8             alpha )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width | (height << 16);
+     task->c64x_arg[5] = argb;
+     task->c64x_arg[6] = alpha;
+
+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_keyed_16__L( DavinciC64xTasks *tasks,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               key,
+                               u32               mask )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_keyed_16( DavinciC64x   *c64x,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            key,
+                            u32            mask )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_keyed_32__L( DavinciC64xTasks *tasks,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               key,
+                               u32               mask )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_keyed_32( DavinciC64x   *c64x,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            key,
+                            u32            mask )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.c b/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.c
new file mode 100755
index 0000000..eef72d1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.c
@@ -0,0 +1,343 @@
+/*
+   TI Davinci driver - Graphics Driver
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 <config.h>
+
+#include <asm/types.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+#include <core/core.h>
+#include <core/gfxcard.h>
+#include <core/surface_pool.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include "davincifb.h"
+
+#include "davinci_2d.h"
+#include "davinci_gfxdriver.h"
+#include "davinci_osd.h"
+#include "davinci_osd_pool.h"
+#include "davinci_screen.h"
+#include "davinci_video.h"
+#include "davinci_video_pool.h"
+
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( davinci )
+
+/**********************************************************************************************************************/
+
+static DFBResult
+open_fb( DavinciDriverData *ddrv,
+         DavinciDeviceData *ddev,
+         unsigned int       fbnum )
+{
+     int                       ret;
+     char                      buf1[16];
+     char                      buf2[16];
+     DavinciFB                *fb;
+     struct fb_var_screeninfo  var;
+
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+     D_ASSERT( fbnum < D_ARRAY_SIZE(ddrv->fb) );
+     D_ASSERT( fbnum < D_ARRAY_SIZE(ddev->fix) );
+
+     fb = &ddrv->fb[fbnum];
+
+     fb->num = fbnum;
+
+     snprintf( buf1, sizeof(buf1), "/dev/fb%u", fbnum );
+     snprintf( buf2, sizeof(buf2), "/dev/fb/%u", fbnum );
+
+     fb->fd = direct_try_open( buf1, buf2, O_RDWR, true );
+     if (fb->fd < 0)
+          return DFB_INIT;
+
+     ret = ioctl( fb->fd, FBIOGET_VSCREENINFO, &var );
+     if (ret) {
+          D_PERROR( "Davinci/Driver: FBIOGET_VSCREENINFO (fb%d) failed!\n", fbnum );
+          close( fb->fd );
+          return DFB_INIT;
+     }
+
+     ret = ioctl( fb->fd, FBIOGET_FSCREENINFO, &ddev->fix[fbnum] );
+     if (ret) {
+          D_PERROR( "Davinci/Driver: FBIOGET_FSCREENINFO (fb%d) failed!\n", fbnum );
+          close( fb->fd );
+          return DFB_INIT;
+     }
+
+     fb->size = ddev->fix[fbnum].smem_len;
+
+     fb->mem = mmap( NULL, fb->size, PROT_READ | PROT_WRITE, MAP_SHARED, fb->fd, 0 );
+     if (fb->mem == MAP_FAILED) {
+          D_PERROR( "Davinci/Driver: mmap (fb%d, length %d) failed!\n", fbnum, fb->size );
+          close( fb->fd );
+          return DFB_INIT;
+     }
+
+     D_INFO( "Davinci/Driver: Mapped fb%d with length %u at %p to %p\n",
+             fbnum, fb->size, (void*)ddev->fix[fbnum].smem_start, fb->mem );
+
+     return DFB_OK;
+}
+
+static void
+close_fb( DavinciFB *fb )
+{
+     munmap( fb->mem, fb->size );
+     close( fb->fd );
+}
+
+/**********************************************************************************************************************/
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     int                 ret;
+     int                 fd;
+     vpbe_fb_videomode_t videomode;
+
+     switch (dfb_system_type()) {
+          case CORE_DEVMEM:
+          case CORE_TI_CMEM:
+               if (dfb_config->accelerator == 6400)
+                    return 1;
+               break;
+
+          default:
+               return 0;
+     }
+
+     fd = direct_try_open( "/dev/fb0", "/dev/fb/0", O_RDWR, true );
+     if (fd < 0)
+          return 0;
+
+     ret = ioctl( fd, FBIO_GET_TIMING, &videomode);
+
+     close( fd );
+
+     if (ret) {
+          D_PERROR( "Davinci/Driver: FBIO_GET_TIMING failed!\n" );
+          return 0;
+     }
+
+     if (videomode.xres > 768 || videomode.yres > 576 || videomode.fps > 60) {
+          D_ERROR( "Davinci/Driver: Invalid mode %dx%d @%d!\n", videomode.xres, videomode.yres, videomode.fps );
+          return 0;
+     }
+
+     if (strncmp( (char*)videomode.name, "PAL", 3 ) &&
+         strncmp( (char*)videomode.name, "NTSC", 4 ))
+     {
+          D_ERROR( "Davinci/Driver: Unknown mode name '%s'!\n", videomode.name );
+          return 0;
+     }
+
+     return 1;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+               "TI Davinci Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Telio AG" );
+
+     info->version.major = 0;
+     info->version.minor = 4;
+
+     info->driver_data_size = sizeof(DavinciDriverData);
+     info->device_data_size = sizeof(DavinciDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     DFBResult          ret;
+     DavinciDriverData *ddrv   = driver_data;
+     DavinciDeviceData *ddev   = device_data;
+     bool               master = dfb_core_is_master( core );
+
+     ddrv->ddev = ddev;
+     ddrv->core = core;
+
+     ret = open_fb( ddrv, ddev, OSD0 );
+     if (ret)
+          return ret;
+
+     ret = open_fb( ddrv, ddev, VID0 );
+     if (ret)
+          goto error_fb1;
+
+     ret = open_fb( ddrv, ddev, OSD1 );
+     if (ret)
+          goto error_fb2;
+
+     ret = open_fb( ddrv, ddev, VID1 );
+     if (ret)
+          goto error_fb3;
+
+     ret = davinci_c64x_open( &ddrv->c64x );
+     if (ret)
+          D_WARN( "running without DSP acceleration" );
+     else {
+          ret = davinci_c64x_tasks_init( &ddrv->tasks, 2048 );
+          if (ret) {
+               D_DERROR( ret, "Davinci/Driver: Error initializing local task buffer!\n" );
+               return ret;
+          }
+
+          ddrv->c64x_present = true;
+
+          /* initialize function pointers */
+          funcs->EngineSync        = davinciEngineSync;
+          funcs->EngineReset       = davinciEngineReset;
+          funcs->EmitCommands      = davinciEmitCommands;
+          funcs->FlushTextureCache = davinciFlushTextureCache;
+          funcs->CheckState        = davinciCheckState;
+          funcs->SetState          = davinciSetState;
+          funcs->StretchBlit       = davinciStretchBlit32;
+     }
+
+     ddrv->screen = dfb_screens_register( device, driver_data, &davinciScreenFuncs );
+
+     ddrv->osd   = dfb_layers_register( ddrv->screen, driver_data, &davinciOSDLayerFuncs );
+     ddrv->video = dfb_layers_register( ddrv->screen, driver_data, &davinciVideoLayerFuncs );
+
+     if (!master) {
+          dfb_surface_pool_join( core, ddev->osd_pool, &davinciOSDSurfacePoolFuncs );
+//          dfb_surface_pool_join( core, ddev->video_pool, &davinciVideoSurfacePoolFuncs );
+     }
+
+     if (!dfb_config->software_only && funcs->CheckState) {
+          dfb_config->font_format  = DSPF_ARGB;
+          dfb_config->font_premult = true;
+     }
+
+     return DFB_OK;
+
+error_fb3:
+     close_fb( &ddrv->fb[OSD1] );
+
+error_fb2:
+     close_fb( &ddrv->fb[VID0] );
+
+error_fb1:
+     close_fb( &ddrv->fb[OSD0] );
+
+     return DFB_INIT;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     DavinciDriverData *ddrv = driver_data;
+     DavinciDeviceData *ddev = device_data;
+
+     /* fill device info */
+     snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Texas Instruments" );
+     snprintf( device_info->name,   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,   "Davinci" );
+
+     /* device limitations */
+     device_info->limits.surface_byteoffset_alignment = 64;
+     device_info->limits.surface_bytepitch_alignment  = 32;
+
+     if (ddrv->c64x_present) {
+          device_info->caps.flags    = 0;
+          device_info->caps.accel    = DAVINCI_SUPPORTED_DRAWINGFUNCTIONS |
+                                       DAVINCI_SUPPORTED_BLITTINGFUNCTIONS;
+          device_info->caps.drawing  = DAVINCI_SUPPORTED_DRAWINGFLAGS;
+          device_info->caps.blitting = DAVINCI_SUPPORTED_BLITTINGFLAGS;
+          device_info->caps.clip     = DFXL_STRETCHBLIT;
+     }
+
+     dfb_surface_pool_initialize( ddrv->core, &davinciOSDSurfacePoolFuncs, &ddev->osd_pool );
+//     dfb_surface_pool_initialize( ddrv->core, &davinciVideoSurfacePoolFuncs, &ddev->video_pool );
+
+     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 )
+{
+     DavinciDriverData *ddrv = driver_data;
+
+     if (ddrv->c64x_present) {
+          davinci_c64x_tasks_destroy( &ddrv->tasks );
+
+          davinci_c64x_close( &ddrv->c64x );
+     }
+
+     close_fb( &ddrv->fb[VID1] );
+     close_fb( &ddrv->fb[OSD1] );
+     close_fb( &ddrv->fb[VID0] );
+     close_fb( &ddrv->fb[OSD0] );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.h b/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.h
new file mode 100755
index 0000000..4ca79b3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_gfxdriver.h
@@ -0,0 +1,169 @@
+/*
+   TI Davinci driver - Graphics Driver
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_GFXDRIVER_H__
+#define __DAVINCI_GFXDRIVER_H__
+
+#include <sys/ioctl.h>
+#include <davincifb.h>
+
+#include <core/surface_buffer.h>
+
+#include "davincifb.h"
+
+#include "davinci_c64x.h"
+
+
+typedef struct {
+     /* validation flags */
+     int                       v_flags;
+
+     /* cached/computed values */
+     void                     *dst_addr;
+     unsigned long             dst_phys;
+     unsigned int              dst_size;
+     unsigned long             dst_pitch;
+     DFBSurfacePixelFormat     dst_format;
+     unsigned long             dst_bpp;
+
+     void                     *src_addr;
+     unsigned long             src_phys;
+     unsigned long             src_pitch;
+     DFBSurfacePixelFormat     src_format;
+     unsigned long             src_bpp;
+
+     unsigned long             source_mult;
+
+     unsigned long             fillcolor;
+
+     int                       blit_blend_sub_function;
+     int                       draw_blend_sub_function;
+
+     DFBColor                  color;
+     unsigned long             color_argb;
+     unsigned long             colorkey;
+
+     DFBSurfaceBlittingFlags   blitting_flags;
+
+     DFBRegion                 clip;
+
+     /** Add shared data here... **/
+     struct fb_fix_screeninfo  fix[4];
+
+     CoreSurfacePool          *osd_pool;
+     CoreSurfacePool          *video_pool;
+
+     bool                      synced;
+} DavinciDeviceData;
+
+
+typedef struct {
+     int                       num;
+     int                       fd;
+     void                     *mem;
+     int                       size;
+} DavinciFB;
+
+typedef struct {
+     DavinciDeviceData        *ddev;
+
+     CoreDFB                  *core;
+
+     CoreScreen               *screen;
+     CoreLayer                *osd;
+     CoreLayer                *video;
+
+     DavinciFB                 fb[4];
+
+     DavinciC64x               c64x;
+     bool                      c64x_present;
+
+     DavinciC64xTasks          tasks;
+} DavinciDriverData;
+
+
+static inline DFBResult
+davincifb_pan_display( const DavinciFB             *fb,
+                       struct fb_var_screeninfo    *var,
+                       const CoreSurfaceBufferLock *lock,
+                       DFBSurfaceFlipFlags          flags,
+                       int                          x,
+                       int                          y )
+{
+     int ret;
+
+     if (lock) {
+#ifdef FBIO_SET_START
+          CoreSurfaceBuffer   *buffer = lock->buffer;
+          struct fb_set_start  set_start;
+
+          /* physical mode */
+          set_start.offset   = -1;
+          set_start.sync     = (flags & DSFLIP_ONSYNC) ? 1 : 0;
+
+          /* life's so easy */
+          set_start.physical = lock->phys + DFB_BYTES_PER_LINE( buffer->format, x ) + y * lock->pitch;
+
+          ret = ioctl( fb->fd, FBIO_SET_START, &set_start );
+          if (ret < 0)
+               D_DEBUG( "FBIO_SET_START (0x%08lx, sync %llu) failed!\n",
+                         set_start.physical, set_start.sync );
+
+          if (ret == 0) {
+               if (flags & DSFLIP_WAIT)
+                    ioctl( fb->fd, FBIO_WAITFORVSYNC );
+
+               return DFB_OK;
+          }
+
+          /* fallback */
+#endif
+          var->xoffset = x;                  /* poor version */
+          var->yoffset = y + lock->offset / lock->pitch;
+     }
+     else {
+          var->xoffset = x;
+          var->yoffset = y;
+     }
+
+     var->activate = /*(flags & DSFLIP_ONSYNC) ? FB_ACTIVATE_VBL :*/ FB_ACTIVATE_NOW;
+
+     ret = ioctl( fb->fd, FBIOPAN_DISPLAY, var );
+     if (ret)
+          D_PERROR( "Davinci/FB: FBIOPAN_DISPLAY (fb%d - %d,%d) failed!\n",
+                    fb->num, var->xoffset, var->yoffset );
+
+     if (flags & DSFLIP_WAIT)
+          ioctl( fb->fd, FBIO_WAITFORVSYNC );
+
+     return DFB_OK;
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_osd.c b/Source/DirectFB/gfxdrivers/davinci/davinci_osd.c
new file mode 100755
index 0000000..2effb2e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_osd.c
@@ -0,0 +1,681 @@
+/*
+   TI Davinci driver - Graphics Layer
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 <config.h>
+
+#include <asm/types.h>
+
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include "davincifb.h"
+
+#include "davinci_gfxdriver.h"
+#include "davinci_osd.h"
+
+
+#define D_OSDERROR(x...) do {} while (0)
+
+
+D_DEBUG_DOMAIN( Davinci_OSD, "Davinci/OSD", "TI Davinci OSD" );
+
+/**********************************************************************************************************************/
+
+static int
+osdLayerDataSize( void )
+{
+     return sizeof(DavinciOSDLayerData);
+}
+
+static DFBResult
+osdInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     int                  ret;
+     DavinciDriverData   *ddrv = driver_data;
+     DavinciOSDLayerData *dosd = layer_data;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIOGET_VSCREENINFO, &dosd->var0 );
+     if (ret) {
+          D_PERROR( "Davinci/OSD: FBIOGET_VSCREENINFO (fb%d) failed!\n", OSD0 );
+          return DFB_INIT;
+     }
+
+     ret = ioctl( ddrv->fb[OSD1].fd, FBIOGET_VSCREENINFO, &dosd->var1 );
+     if (ret) {
+          D_PERROR( "Davinci/OSD: FBIOGET_VSCREENINFO (fb%d) failed!\n", OSD1 );
+          return DFB_INIT;
+     }
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 0 );
+
+     ret = ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, 0 );
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY | DLCAPS_SCREEN_POSITION |
+                         DLCAPS_SRC_COLORKEY;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "TI Davinci OSD" );
+
+     /* 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_RGB16;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_ALPHACHANNEL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     if (config->options & ~DAVINCI_OSD_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     switch (config->format) {
+          case DSPF_RGB444:
+          case DSPF_RGB555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB4444:
+          case DSPF_ARGB1555:
+          case DSPF_ARGB:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     if (config->width  < 8 || config->width  > 1920)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height < 8 || config->height > 1080)
+          fail |= CLRCF_HEIGHT;
+
+     if (config->dest.x < 0 || config->dest.y < 0)
+          fail |= CLRCF_DEST;
+
+     if (config->dest.x + config->dest.w > 1920)
+          fail |= CLRCF_DEST;
+
+     if (config->dest.y + config->dest.h > 1080)
+          fail |= CLRCF_DEST;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     int                  ret;
+     DavinciDriverData   *ddrv = driver_data;
+     DavinciDeviceData   *ddev = ddrv->ddev;
+     DavinciOSDLayerData *dosd = layer_data;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+     D_ASSERT( dosd != NULL );
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 0 );
+
+     ret = ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, 0 );
+
+     ioctl( ddrv->fb[OSD0].fd, FBIO_WAITFORVSYNC );
+
+     /* Update blend parameters? */
+     if (updated & (CLRCF_OPTIONS | CLRCF_OPACITY | CLRCF_SRCKEY | CLRCF_FORMAT)) {
+          vpbe_blink_option_t        blink = {0};
+          vpbe_bitmap_blend_params_t blend = {0};
+
+          D_DEBUG_AT( Davinci_OSD, "  -> %s\n", dfb_pixelformat_name( config->format ) );
+
+          if (config->options & DLOP_SRC_COLORKEY) {
+               blend.enable_colorkeying = 1;
+               blend.colorkey           = dfb_color_to_pixel( DSPF_RGB16,
+                                                              config->src_key.r,
+                                                              config->src_key.g,
+                                                              config->src_key.b );
+
+               D_DEBUG_AT( Davinci_OSD, "  -> color key 0x%02x (%02x %02x %02x)\n",
+                           blend.colorkey, config->src_key.r, config->src_key.g, config->src_key.b );
+          }
+          else if (config->options & DLOP_OPACITY) {
+               blend.bf = config->opacity >> 5;
+
+               D_DEBUG_AT( Davinci_OSD, "  -> opacity %d/7\n", blend.bf );
+          }
+          else
+               blend.bf = 7;
+
+          ret = ioctl( ddrv->fb[OSD0].fd, FBIO_SET_BITMAP_BLEND_FACTOR, &blend );
+          if (ret)
+               D_PERROR( "Davinci/OSD: FBIO_SET_BITMAP_BLEND_FACTOR (fb%d)!\n", OSD0 );
+
+          if (config->options & DLOP_ALPHACHANNEL)
+               dosd->alpha = DFB_PIXELFORMAT_HAS_ALPHA( config->format );
+          else
+               dosd->alpha = 0;
+
+          D_DEBUG_AT( Davinci_OSD, "  -> %salpha channel\n", dosd->alpha ? "" : "no " );
+
+          if (dosd->alpha) {
+               if (ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN, dosd->alpha ))
+                    D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN (fb%d - %d)!\n", OSD0, dosd->alpha );
+          }
+
+          if (ioctl( ddrv->fb[OSD1].fd, FBIO_SET_BLINK_INTERVAL, &blink ))
+               D_OSDERROR( "Davinci/OSD: FBIO_SET_BLINK_INTERVAL (fb%d - disable)!\n", OSD1 );
+     }
+
+     /* Update size? */
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_BUFFERMODE)) {
+          vpbe_window_position_t win_pos;
+
+          D_DEBUG_AT( Davinci_OSD, "  -> %dx%d\n", config->width, config->height );
+
+/*********************************** Start workaround ***********************************/
+          win_pos.xpos = 0;
+          win_pos.ypos = 0;
+
+          ret = ioctl( ddrv->fb[OSD0].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_OSDERROR( "Davinci/OSD: FBIO_SETPOS (fb%d - %d,%d) failed!\n", OSD0, win_pos.xpos, win_pos.ypos );
+
+          ret = ioctl( ddrv->fb[OSD1].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_OSDERROR( "Davinci/OSD: FBIO_SETPOS (fb%d - %d,%d) failed!\n", OSD1, win_pos.xpos, win_pos.ypos );
+
+          updated |= CLRCF_DEST;
+
+          dosd->var0.yoffset = dosd->var1.yoffset = 0;
+/*********************************** End workaround ***********************************/
+
+          /* Set width and height. */
+          dosd->var0.xres = config->width;
+          dosd->var0.yres = config->height;
+          dosd->var1.xres = config->width;
+          dosd->var1.yres = config->height;
+
+          dosd->var0.yres_virtual = ddrv->fb[OSD0].size / ddev->fix[OSD0].line_length;
+
+          ret = ioctl( ddrv->fb[OSD0].fd, FBIOPUT_VSCREENINFO, &dosd->var0 );
+          if (ret)
+               D_PERROR( "Davinci/OSD: FBIOPUT_VSCREENINFO (fb%d) failed!\n", OSD0 );
+
+          ret = ioctl( ddrv->fb[OSD1].fd, FBIOPUT_VSCREENINFO, &dosd->var1 );
+          if (ret)
+               D_PERROR( "Davinci/OSD: FBIOPUT_VSCREENINFO (fb%d) failed!\n", OSD1 );
+     }
+
+     /* Update position? */
+     if (updated & CLRCF_DEST) {
+          vpbe_window_position_t win_pos;
+
+          D_DEBUG_AT( Davinci_OSD, "  -> %d, %d\n", config->dest.x, config->dest.y );
+
+          /* Set horizontal and vertical offset. */
+          win_pos.xpos = config->dest.x;
+          win_pos.ypos = config->dest.y;
+
+          ret = ioctl( ddrv->fb[OSD0].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_OSDERROR( "Davinci/OSD: FBIO_SETPOS (fb%d - %d,%d) failed!\n", OSD0, config->dest.x, config->dest.y );
+
+          ret = ioctl( ddrv->fb[OSD1].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_OSDERROR( "Davinci/OSD: FBIO_SETPOS (fb%d - %d,%d) failed!\n", OSD1, config->dest.x, config->dest.y );
+     }
+
+     davincifb_pan_display( &ddrv->fb[OSD0], &dosd->var0,
+                            (config->format == DSPF_RGB16) ? lock : NULL, DSFLIP_NONE, 0, 0 );
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIOGET_FSCREENINFO, &ddev->fix[OSD0] );
+     if (ret)
+          D_PERROR( "Davinci/OSD: FBIOGET_FSCREENINFO (fb%d) failed!\n", OSD0 );
+
+     ret = ioctl( ddrv->fb[OSD1].fd, FBIOGET_FSCREENINFO, &ddev->fix[OSD1] );
+     if (ret)
+          D_PERROR( "Davinci/OSD: FBIOGET_FSCREENINFO (fb%d) failed!\n", OSD1 );
+
+     dosd->enable = true;
+
+     if (ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN, 0 ))
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN (fb%d - %d)!\n", OSD0, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     int                  ret;
+     DavinciDriverData   *ddrv = driver_data;
+     DavinciOSDLayerData *dosd = layer_data;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( ddrv != NULL );
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 0 );
+
+     ret = ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, 0 );
+
+     dosd->enable = false;
+
+     return DFB_OK;
+}
+
+static void
+update_buffers( DavinciDriverData     *ddrv,
+                DavinciDeviceData     *ddev,
+                CoreSurface           *surface,
+                CoreSurfaceBufferLock *lock,
+                const DFBRegion       *update )
+{
+     DFBRectangle       rect;
+     CoreSurfaceBuffer *buffer;
+
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     DFB_REGION_ASSERT_IF( update );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     if (update) {
+          rect = DFB_RECTANGLE_INIT_FROM_REGION( update );
+
+          if (rect.x & 1) {
+               rect.x &= ~1;
+               rect.w++;
+          }
+
+          if (rect.w & 1)
+               rect.w++;
+     }
+     else {
+          rect.x = 0;
+          rect.y = 0;
+          rect.w = surface->config.size.w;
+          rect.h = surface->config.size.h;
+     }
+
+     /* Can we use the DSP? */
+     if (ddrv->c64x_present) {
+          int           i;
+          int           lines = ddev->fix[OSD0].line_length == ddev->fix[OSD1].line_length ? rect.h : 1;
+          unsigned long rgb   = ddev->fix[OSD0].smem_start + rect.x * 2 + rect.y * ddev->fix[OSD0].line_length;
+          unsigned long alpha = ddev->fix[OSD1].smem_start + rect.x / 2 + rect.y * ddev->fix[OSD1].line_length;
+          unsigned long src   = lock->phys                 + rect.x * 4 + rect.y * lock->pitch;
+
+          //D_ASSUME( ddev->fix[OSD0].line_length == ddev->fix[OSD1].line_length );
+
+          dfb_gfxcard_lock( GDLF_NONE );
+
+          /* Dither ARGB to RGB16+A3 using the DSP. */
+          for (i=0; i<rect.h; i+=lines) {
+               if (lines > rect.h - i)
+                    lines = rect.h - i;
+               
+               davinci_c64x_dither_argb__L( &ddrv->tasks, rgb, alpha,
+                                         ddev->fix[OSD0].line_length, src, lock->pitch, rect.w, lines );
+
+               if (ddev->fix[OSD0].line_length != ddev->fix[OSD1].line_length && lines > 1) {
+                    davinci_c64x_blit_32__L( &ddrv->tasks,
+                                          alpha + ddev->fix[OSD1].line_length, ddev->fix[OSD1].line_length,
+                                          alpha + ddev->fix[OSD0].line_length, ddev->fix[OSD0].line_length,
+                                          rect.w/2, lines - 1 );
+               }
+
+               rgb   += lines * ddev->fix[OSD0].line_length;
+               alpha += lines * ddev->fix[OSD1].line_length;
+               src   += lines * lock->pitch;
+          }
+
+          /* Flush the write cache. */
+          davinci_c64x_write_back_all( &ddrv->c64x );
+
+
+          davinci_c64x_emit_tasks( &ddrv->c64x, &ddrv->tasks, C64X_TEF_RESET );
+
+
+          dfb_gfxcard_unlock();
+     }
+     else {
+          u32  *src32 = lock->addr + rect.y * lock->pitch + DFB_BYTES_PER_LINE( buffer->format, rect.x );
+          int   sp4   = lock->pitch / 4;
+          u32  *dst32 = ddrv->fb[OSD0].mem + rect.y * ddev->fix[OSD0].line_length + rect.x * 2;
+          int   dp4   = ddev->fix[OSD0].line_length / 4;
+          u8   *dst8  = ddrv->fb[OSD1].mem + rect.y * ddev->fix[OSD1].line_length + rect.x / 2;
+          int   dp    = ddev->fix[OSD1].line_length;
+          int   w2    = rect.w / 2;
+          u32   z     = 0;
+
+          switch (buffer->format) {
+               case DSPF_ARGB4444:
+                    while (rect.h--) {
+                         int x;
+
+                         for (x=0; x<w2; x++) {
+                              dst32[x] = ((src32[x] & 0x0f000f00) << 4) | ((src32[x] & 0x08000800)     ) |
+                                         ((src32[x] & 0x00f000f0) << 3) | ((src32[x] & 0x00c000c0) >> 1) |
+                                         ((src32[x] & 0x000f000f) << 1) | ((src32[x] & 0x00080008) >> 3);
+
+                              dst8[x] = ((src32[x] & 0xe0000000) >> 29) | ((src32[x] & 0x0000e000) >> 9);
+                         }
+
+                         src32 += sp4;
+                         dst32 += dp4;
+                         dst8  += dp;
+                    }
+                    break;
+
+               case DSPF_ARGB1555:
+                    while (rect.h--) {
+                         int x;
+
+                         for (x=0; x<w2; x++) {
+                              dst32[x] = ((src32[x] & 0x7c007c00) << 1) |
+                                         ((src32[x] & 0x03e003e0) << 1) |
+                                          (src32[x] & 0x003f003f);
+
+                              dst8[x] = ((src32[x] & 0x80000000) ? 0x70 : 0x00) |
+                                        ((src32[x] & 0x00008000) ? 0x07 : 0x00);
+                         }
+
+                         src32 += sp4;
+                         dst32 += dp4;
+                         dst8  += dp;
+                    }
+                    break;
+
+               case DSPF_ARGB:
+                    while (rect.h--) {
+                         int x;
+
+                         for (x=0; x<w2; x++) {
+                              register u32 s0 = src32[(x<<1)+0];
+                              register u32 s1 = src32[(x<<1)+1];
+
+                              dst32[x] = ((s0 & 0x00f80000) >>  8) |
+                                         ((s0 & 0x0000fc00) >>  5) |
+                                         ((s0 & 0x000000f8) >>  3) |
+                                         ((s1 & 0x00f80000) <<  8) |
+                                         ((s1 & 0x0000fc00) << 11) |
+                                         ((s1 & 0x000000f8) << 13) ;
+
+#ifndef DAVINCI_NO_DITHER
+                              if ((s0 & s1) >> 24 == 0xff)
+                                   dst8[x] = 0x77;
+                              else {
+                                   register int pt, da;
+
+                                   z ^= ((z << 13) | (z >> 19));
+                                   z += 0x87654321;
+                                   pt = s0 - ((s0 & 0xf8000000) >> 3);
+                                   da = (((pt >> 29) & 0x07)  + ( ((z&0x1f) - ((pt >> 24) & 0x1f))>>31 )) << 4;
+
+                                   z ^= ((z << 13) | (z >> 19));
+                                   z += 0x87654321;
+                                   pt = s1 - ((s1 & 0xf8000000) >> 3);
+                                   da |= (((pt >> 29) & 0x07) + ( ((z&0x1f) - ((pt >> 24) & 0x1f))>>31 ));
+
+
+                                   dst8[x] = da;
+                              }
+#else
+                              dst8[x] = ((s0 & 0xe0000000) >> 25) |
+                                        ((s1 & 0xe0000000) >> 29) ;
+#endif
+                         }
+
+                         src32 += sp4;
+                         dst32 += dp4;
+                         dst8  += dp;
+                    }
+                    break;
+
+               default:
+                    D_ONCE( "unsupported format" );
+          }
+     }
+}
+
+static void
+update_rgb( DavinciDriverData     *ddrv,
+            DavinciDeviceData     *ddev,
+            CoreSurface           *surface,
+            CoreSurfaceBufferLock *lock,
+            const DFBRegion       *update )
+{
+     DFBRectangle       rect;
+     CoreSurfaceBuffer *buffer;
+
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     DFB_REGION_ASSERT_IF( update );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     if (update)
+          rect = DFB_RECTANGLE_INIT_FROM_REGION( update );
+     else {
+          rect.x = 0;
+          rect.y = 0;
+          rect.w = surface->config.size.w;
+          rect.h = surface->config.size.h;
+     }
+
+     dfb_convert_to_rgb16( buffer->format,
+                           lock->addr + rect.y * lock->pitch + DFB_BYTES_PER_LINE( buffer->format, rect.x ),
+                           lock->pitch,
+                           surface->config.size.h,
+                           ddrv->fb[OSD0].mem + rect.y * ddev->fix[OSD0].line_length + rect.x * 2,
+                           ddev->fix[OSD0].line_length,
+                           rect.w, rect.h );
+}
+
+static void
+enable_osd( DavinciDriverData   *ddrv,
+            DavinciOSDLayerData *dosd )
+{
+     if (!dosd->enable)
+          return;
+
+     ioctl( ddrv->fb[OSD0].fd, FBIO_WAITFORVSYNC );
+
+     if (ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN, dosd->alpha ))
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN (fb%d - %d)!\n", OSD0, dosd->alpha );
+
+     if (ioctl( ddrv->fb[OSD0].fd, FBIO_ENABLE_DISABLE_WIN, 1 ))
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD0, 1 );
+
+     if (ioctl( ddrv->fb[OSD1].fd, FBIO_ENABLE_DISABLE_WIN, dosd->alpha ))
+          D_OSDERROR( "Davinci/OSD: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", OSD1, dosd->alpha );
+
+     dosd->enable = false;
+}
+
+static DFBResult
+osdFlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     CoreSurfaceBuffer   *buffer;
+     DavinciDriverData   *ddrv = driver_data;
+     DavinciDeviceData   *ddev = ddrv->ddev;
+     DavinciOSDLayerData *dosd = layer_data;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     if (buffer->format != DSPF_RGB16) {
+          if (DFB_PIXELFORMAT_HAS_ALPHA( buffer->format ))
+               update_buffers( ddrv, ddev, surface, lock, NULL );
+          else
+               update_rgb( ddrv, ddev, surface, lock, NULL );
+     }
+     else
+          davincifb_pan_display( &ddrv->fb[OSD0], &dosd->var0, lock, flags, 0, 0 );
+
+     dfb_surface_flip( surface, false );
+
+     enable_osd( ddrv, dosd );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdUpdateRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreSurface           *surface,
+                 const DFBRegion       *update,
+                 CoreSurfaceBufferLock *lock )
+{
+     CoreSurfaceBuffer   *buffer;
+     DavinciDriverData   *ddrv = driver_data;
+     DavinciDeviceData   *ddev = ddrv->ddev;
+     DavinciOSDLayerData *dosd = layer_data;
+
+     D_DEBUG_AT( Davinci_OSD, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     if (buffer->format != DSPF_RGB16) {
+          if (DFB_PIXELFORMAT_HAS_ALPHA( buffer->format ))
+               update_buffers( ddrv, ddev, surface, lock, update );
+          else
+               update_rgb( ddrv, ddev, surface, lock, update );
+     }
+
+     enable_osd( ddrv, dosd );
+
+     return DFB_OK;
+}
+
+const DisplayLayerFuncs davinciOSDLayerFuncs = {
+     .LayerDataSize = osdLayerDataSize,
+     .InitLayer     = osdInitLayer,
+
+     .TestRegion    = osdTestRegion,
+     .SetRegion     = osdSetRegion,
+     .RemoveRegion  = osdRemoveRegion,
+     .FlipRegion    = osdFlipRegion,
+     .UpdateRegion  = osdUpdateRegion,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_osd.h b/Source/DirectFB/gfxdrivers/davinci/davinci_osd.h
new file mode 100755
index 0000000..4487b7f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_osd.h
@@ -0,0 +1,53 @@
+/*
+   TI Davinci driver - Graphics Layer
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_OSD_H__
+#define __DAVINCI_OSD_H__
+
+#include <linux/fb.h>
+
+#include <core/layers.h>
+
+#define DAVINCI_OSD_SUPPORTED_OPTIONS  (DLOP_ALPHACHANNEL | DLOP_OPACITY | DLOP_SRC_COLORKEY)
+
+
+typedef struct {
+     struct fb_var_screeninfo var0;
+     struct fb_var_screeninfo var1;
+
+     bool                     alpha;
+     bool                     enable;
+} DavinciOSDLayerData;
+
+
+extern const DisplayLayerFuncs davinciOSDLayerFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.c b/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.c
new file mode 100755
index 0000000..6744adb
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.c
@@ -0,0 +1,394 @@
+/*
+   TI Davinci driver - OSD0 FB Memory for direct RGB16 mode
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/gfxcard.h>
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include "davincifb.h"
+
+#include "davinci_gfxdriver.h"
+
+D_DEBUG_DOMAIN( OSD_Surfaces, "OSD/Surfaces", "OSD Framebuffer Surface Pool" );
+D_DEBUG_DOMAIN( OSD_SurfLock, "OSD/SurfLock", "OSD Framebuffer Surface Pool Locks" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int             magic;
+} OSDPoolData;
+
+typedef struct {
+     int             magic;
+
+     CoreDFB        *core;
+     void           *mem;
+     unsigned long   phys;
+} OSDPoolLocalData;
+
+typedef struct {
+     int   magic;
+
+     int   offset;
+     int   pitch;
+     int   size;
+} OSDAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+osdPoolDataSize( void )
+{
+     return sizeof(OSDPoolData);
+}
+
+static int
+osdPoolLocalDataSize( void )
+{
+     return sizeof(OSDPoolLocalData);
+}
+
+static int
+osdAllocationDataSize( void )
+{
+     return sizeof(OSDAllocationData);
+}
+
+static DFBResult
+osdInitPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data,
+             CoreSurfacePoolDescription *ret_desc )
+{
+     OSDPoolData       *data  = pool_data;
+     OSDPoolLocalData  *local = pool_local;
+     DavinciDriverData *ddrv  = dfb_gfxcard_get_driver_data();
+     DavinciDeviceData *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( OSD_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( data != NULL );
+     D_ASSERT( local != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps     = CSPCAPS_NONE;
+     ret_desc->types    = CSTF_LAYER | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority = CSPP_PREFERED;
+
+     ret_desc->access[CSAID_CPU]    = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_GPU]    = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "OSD Pool" );
+
+     local->core = core;
+     local->mem  = ddrv->fb[OSD0].mem;
+     local->phys = ddev->fix[OSD0].smem_start;
+
+     D_MAGIC_SET( data, OSDPoolData );
+     D_MAGIC_SET( local, OSDPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdJoinPool( CoreDFB         *core,
+             CoreSurfacePool *pool,
+             void            *pool_data,
+             void            *pool_local,
+             void            *system_data )
+{
+     OSDPoolData       *data  = pool_data;
+     OSDPoolLocalData  *local = pool_local;
+     DavinciDriverData *ddrv  = dfb_gfxcard_get_driver_data();
+     DavinciDeviceData *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( OSD_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_ASSERT( local != NULL );
+
+     (void) data;
+
+     local->core = core;
+     local->mem  = ddrv->fb[OSD0].mem;
+     local->phys = ddev->fix[OSD0].smem_start;
+
+     D_MAGIC_SET( local, OSDPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdDestroyPool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     OSDPoolData      *data  = pool_data;
+     OSDPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( OSD_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_MAGIC_ASSERT( local, OSDPoolLocalData );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdLeavePool( CoreSurfacePool *pool,
+              void            *pool_data,
+              void            *pool_local )
+{
+     OSDPoolData      *data  = pool_data;
+     OSDPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( OSD_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_MAGIC_ASSERT( local, OSDPoolLocalData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdTestConfig( CoreSurfacePool         *pool,
+               void                    *pool_data,
+               void                    *pool_local,
+               CoreSurfaceBuffer       *buffer,
+               const CoreSurfaceConfig *config )
+{
+     CoreSurface      *surface;
+     OSDPoolData      *data  = pool_data;
+     OSDPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( OSD_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_MAGIC_ASSERT( local, OSDPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     (void) data;
+     (void) local;
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == DLID_PRIMARY && surface->config.format == DSPF_RGB16)
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+osdAllocateBuffer( CoreSurfacePool       *pool,
+                   void                  *pool_data,
+                   void                  *pool_local,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation,
+                   void                  *alloc_data )
+{
+     CoreSurface       *surface;
+     OSDPoolData       *data  = pool_data;
+     OSDPoolLocalData  *local = pool_local;
+     OSDAllocationData *alloc = alloc_data;
+     DavinciDeviceData *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( OSD_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_MAGIC_ASSERT( local, OSDPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     (void) data;
+     (void) local;
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == DLID_PRIMARY && surface->config.format == DSPF_RGB16) {
+          int index = dfb_surface_buffer_index( buffer );
+
+          alloc->pitch  = ddev->fix[OSD0].line_length;
+          alloc->size   = surface->config.size.h * alloc->pitch;
+          alloc->offset = index * alloc->size;
+
+          D_DEBUG_AT( OSD_Surfaces, "  -> index %d, offset %d, pitch %d, size %d\n",
+                      index, alloc->offset, alloc->pitch, alloc->size );
+
+          allocation->size   = alloc->size;
+          allocation->offset = alloc->offset;
+
+          D_MAGIC_SET( alloc, OSDAllocationData );
+
+          return DFB_OK;
+     }
+
+     return DFB_BUG;
+}
+
+static DFBResult
+osdDeallocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     OSDPoolData       *data  = pool_data;
+     OSDAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( OSD_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, OSDPoolData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, OSDAllocationData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdLock( CoreSurfacePool       *pool,
+         void                  *pool_data,
+         void                  *pool_local,
+         CoreSurfaceAllocation *allocation,
+         void                  *alloc_data,
+         CoreSurfaceBufferLock *lock )
+{
+     OSDPoolLocalData  *local = pool_local;
+     OSDAllocationData *alloc = alloc_data;
+     DavinciDeviceData *ddev  = dfb_gfxcard_get_device_data();
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, OSDAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( OSD_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     int index  = alloc->offset / alloc->size;
+     int height = alloc->size   / alloc->pitch;
+
+     alloc->pitch  = ddev->fix[OSD0].line_length;
+     alloc->size   = height * alloc->pitch;
+     alloc->offset = index * alloc->size;
+
+     allocation->size   = alloc->size;
+     allocation->offset = alloc->offset;
+
+     lock->pitch  = alloc->pitch;
+     lock->offset = alloc->offset;
+     lock->addr   = local->mem  + alloc->offset;
+     lock->phys   = local->phys + alloc->offset;
+
+     D_DEBUG_AT( OSD_SurfLock, "  -> offset %lu, pitch %d, addr %p, phys 0x%08lx\n",
+                 lock->offset, lock->pitch, lock->addr, lock->phys );
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdUnlock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     OSDAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, OSDAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( OSD_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs davinciOSDSurfacePoolFuncs = {
+     .PoolDataSize       = osdPoolDataSize,
+     .PoolLocalDataSize  = osdPoolLocalDataSize,
+     .AllocationDataSize = osdAllocationDataSize,
+
+     .InitPool           = osdInitPool,
+     .JoinPool           = osdJoinPool,
+     .DestroyPool        = osdDestroyPool,
+     .LeavePool          = osdLeavePool,
+
+     .TestConfig         = osdTestConfig,
+     .AllocateBuffer     = osdAllocateBuffer,
+     .DeallocateBuffer   = osdDeallocateBuffer,
+
+     .Lock               = osdLock,
+     .Unlock             = osdUnlock,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.h b/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.h
new file mode 100755
index 0000000..05316db
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_osd_pool.h
@@ -0,0 +1,39 @@
+/*
+   TI Davinci driver - OSD0 FB Memory for direct RGB16 mode
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_OSD_POOL_H__
+#define __DAVINCI_OSD_POOL_H__
+
+#include <core/surface_pool.h>
+
+extern const SurfacePoolFuncs davinciOSDSurfacePoolFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_screen.c b/Source/DirectFB/gfxdrivers/davinci/davinci_screen.c
new file mode 100755
index 0000000..65fd751
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_screen.c
@@ -0,0 +1,124 @@
+/*
+   TI Davinci driver - Primary Screen
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 <config.h>
+
+#include <asm/types.h>
+
+#include <stdio.h>
+#include <sys/mman.h>
+
+#include <directfb.h>
+
+#include <core/screens.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+#include <sys/ioctl.h>
+
+#include "davincifb.h"
+
+#include "davinci_gfxdriver.h"
+#include "davinci_screen.h"
+
+
+D_DEBUG_DOMAIN( Davinci_Screen, "Davinci/Screen", "TI Davinci Screen" );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+davinciInitScreen( CoreScreen           *screen,
+                   CoreGraphicsDevice   *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     D_DEBUG_AT( Davinci_Screen, "%s()\n", __FUNCTION__ );
+
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_VSYNC;
+
+     /* Set the screen name. */
+     snprintf( description->name, DFB_SCREEN_DESC_NAME_LENGTH, "TI Davinci Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+davinciGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     int                  ret;
+     vpbe_fb_videomode_t  mode;
+     DavinciDriverData   *ddrv = driver_data;
+
+     D_DEBUG_AT( Davinci_Screen, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( ret_width != NULL );
+     D_ASSERT( ret_height != NULL );
+
+     ret = ioctl( ddrv->fb[OSD0].fd, FBIO_GET_TIMING, &mode );
+     if (ret) {
+          D_PERROR( "%s: FBIO_GET_TIMING (fb%d, OSD0) failed!\n", __func__, OSD0 );
+          return DFB_INIT;
+     }
+
+     *ret_width  = mode.xres;
+     *ret_height = mode.yres;
+
+     return DFB_OK;
+}
+
+static DFBResult
+davinciWaitVSync( CoreScreen *screen,
+                  void       *driver_data,
+                  void       *screen_data )
+{
+     DavinciDriverData *ddrv = driver_data;
+
+     D_DEBUG_AT( Davinci_Screen, "%s()\n", __FUNCTION__ );
+
+     ioctl( ddrv->fb[OSD0].fd, FBIO_WAITFORVSYNC );
+
+     return DFB_OK;
+}
+
+ScreenFuncs davinciScreenFuncs = {
+     .InitScreen    = davinciInitScreen,
+     .GetScreenSize = davinciGetScreenSize,
+     .WaitVSync     = davinciWaitVSync,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_screen.h b/Source/DirectFB/gfxdrivers/davinci/davinci_screen.h
new file mode 100755
index 0000000..1aa2494
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_screen.h
@@ -0,0 +1,39 @@
+/*
+   TI Davinci driver - Primary Screen
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_SCREEN_H__
+#define __DAVINCI_SCREEN_H__
+
+#include <core/screens.h>
+
+extern ScreenFuncs davinciScreenFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_video.c b/Source/DirectFB/gfxdrivers/davinci/davinci_video.c
new file mode 100755
index 0000000..1a284a0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_video.c
@@ -0,0 +1,744 @@
+/*
+   TI Davinci driver - Video Layer
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 <config.h>
+
+#include <asm/types.h>
+
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include "davincifb.h"
+
+#include "davinci_gfxdriver.h"
+#include "davinci_video.h"
+
+
+#define D_VIDERROR(x...) do {} while (0)
+
+
+D_DEBUG_DOMAIN( Davinci_Video, "Davinci/Video", "TI Davinci Video" );
+
+/**********************************************************************************************************************/
+
+static DFBResult ShowBuffer( DavinciDriverData     *ddrv,
+                             DavinciVideoLayerData *dvid,
+                             CoreSurfaceBufferLock *lock,
+                             const DFBRectangle    *area,
+                             DFBSurfaceFlipFlags    flags );
+
+static void SetupResizerParams( vpfe_resizer_params_t *params,
+                                int srcWidth, int srcHeight,
+                                int outWidth, int outHeight,
+                                int *ret_outWidth,
+                                int *ret_outHeight );
+
+/**********************************************************************************************************************/
+
+static int
+videoLayerDataSize( void )
+{
+     return sizeof(DavinciVideoLayerData);
+}
+
+static DFBResult
+videoInitLayer( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                DFBDisplayLayerDescription *description,
+                DFBDisplayLayerConfig      *config,
+                DFBColorAdjustment         *adjustment )
+{
+     int                    ret;
+     DavinciDriverData     *ddrv = driver_data;
+     DavinciVideoLayerData *dvid = layer_data;
+
+     D_DEBUG_AT( Davinci_Video, "%s()\n", __FUNCTION__ );
+
+     /* Initialize with configuration from VID0 to start with a fullscreen (unscaled) layer */
+     ret = ioctl( ddrv->fb[VID0].fd, FBIOGET_VSCREENINFO, &dvid->var );
+     if (ret) {
+          D_PERROR( "Davinci/Video: FBIOGET_VSCREENINFO (fb%d) failed!\n", VID0 );
+          return DFB_INIT;
+     }
+
+     /* Disable VID0 (unused) */
+     ret = ioctl( ddrv->fb[VID0].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_VIDERROR( "Davinci/Video: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", VID0, 0 );
+
+     /* Disable VID1 (our layer) */
+     ret = ioctl( ddrv->fb[VID1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_VIDERROR( "Davinci/Video: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", VID1, 0 );
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION;
+     description->type = DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "TI Davinci Video" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+     config->width       = dvid->var.xres;
+     config->height      = dvid->var.yres;
+     config->pixelformat = DSPF_UYVY;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_NONE;
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoTestRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     D_DEBUG_AT( Davinci_Video, "%s()\n", __FUNCTION__ );
+
+     DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( Davinci_Video, config );
+
+     if (config->options & ~DAVINCI_VIDEO_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     switch (config->format) {
+          case DSPF_UYVY:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     if (config->width  < 8 || config->width  > 1920)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height < 8 || config->height > 1080)
+          fail |= CLRCF_HEIGHT;
+
+     if (config->dest.x < 0 || config->dest.y < 0)
+          fail |= CLRCF_DEST;
+
+     if (config->dest.x + config->dest.w > 1920)
+          fail |= CLRCF_DEST;
+
+     if (config->dest.y + config->dest.h > 1080)
+          fail |= CLRCF_DEST;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail) {
+          D_DEBUG_AT( Davinci_Video, "  -> FAILED (0x%08x)\n", fail );
+          return DFB_UNSUPPORTED;
+     }
+
+     D_DEBUG_AT( Davinci_Video, "  -> OK\n" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoSetRegion( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                void                       *region_data,
+                CoreLayerRegionConfig      *config,
+                CoreLayerRegionConfigFlags  updated,
+                CoreSurface                *surface,
+                CorePalette                *palette,
+                CoreSurfaceBufferLock      *lock )
+{
+     int                    ret;
+     DavinciDriverData     *ddrv = driver_data;
+     DavinciDeviceData     *ddev = ddrv->ddev;
+     DavinciVideoLayerData *dvid = layer_data;
+     CoreLayerRegionConfig *old  = &dvid->config;
+
+     D_DEBUG_AT( Davinci_Video, "%s( updated 0x%08x, surface %p )\n", __FUNCTION__, updated, surface );
+
+     DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( Davinci_Video, config );
+
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( ddev != NULL );
+     D_ASSERT( dvid != NULL );
+
+     /* Update output size? */
+     if ((updated & CLRCF_DEST) && (config->dest.w != old->dest.w || config->dest.h != old->dest.h)) {
+          vpbe_window_position_t win_pos;
+
+          D_DEBUG_AT( Davinci_Video, "  => dest    %4dx%4d\n", config->dest.w, config->dest.h );
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+          if (ret)
+               D_VIDERROR( "Davinci/Video: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", VID1, 0 );
+
+          dvid->enabled = false;
+
+/*********************************** Start workaround ***********************************/
+          win_pos.xpos = 0;
+          win_pos.ypos = 0;
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_VIDERROR( "Davinci/Video: FBIO_SETPOS (fb%d - %d,%d) failed!\n", VID1, win_pos.xpos, win_pos.ypos );
+
+          dvid->var.yoffset = 0;
+/*********************************** End workaround ***********************************/
+
+          /* Set output width and height. */
+          dvid->var.xres = config->dest.w;
+          dvid->var.yres = config->dest.h;
+
+          dvid->var.yres_virtual = ddrv->fb[VID1].size / lock->pitch;
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIOPUT_VSCREENINFO, &dvid->var );
+          if (ret)
+               D_PERROR( "Davinci/Video: FBIOPUT_VSCREENINFO (fb%d) failed!\n", VID1 );
+
+          /* Read back new pitch etc. */
+          ret = ioctl( ddrv->fb[VID1].fd, FBIOGET_FSCREENINFO, &ddev->fix[VID1] );
+          if (ret)
+               D_PERROR( "Davinci/Video: FBIOGET_FSCREENINFO (fb%d) failed!\n", VID1 );
+     }
+
+     /* Update output position? */
+     if (updated & CLRCF_DEST) {
+          vpbe_window_position_t win_pos;
+
+          D_DEBUG_AT( Davinci_Video, "  => dest    %4d,%4d\n", config->dest.x, config->dest.y );
+
+          if (dvid->enabled)
+               ioctl( ddrv->fb[VID1].fd, FBIO_WAITFORVSYNC );
+
+          /* Set horizontal and vertical offset. */
+          win_pos.xpos = config->dest.x;
+          win_pos.ypos = config->dest.y;
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIO_SETPOS, &win_pos );
+          if (ret)
+               D_VIDERROR( "Davinci/Video: FBIO_SETPOS (fb%d - %d,%d) failed!\n", VID1, config->dest.x, config->dest.y );
+     }
+
+     /* Update format? */
+     if (updated & CLRCF_FORMAT) {
+          vpbe_video_config_params_t params;
+
+          params.cb_cr_order = (config->format == DSPF_YUY2) ? 1 : 0;
+
+          params.exp_info.horizontal = VPBE_DISABLE;
+          params.exp_info.vertical   = VPBE_DISABLE;
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIO_SET_VIDEO_CONFIG_PARAMS, ¶ms );
+          if (ret)
+               D_VIDERROR( "Davinci/Video: FBIO_SET_VIDEO_CONFIG_PARAMS (fb%d - %s) failed!\n",
+                         VID1, params.cb_cr_order ? "CrCb" : "CbCr" );
+     }
+
+     /* Update scaling parameters? */
+     if ((updated & (CLRCF_SOURCE | CLRCF_DEST)) &&
+         (config->source.w != old->source.w || config->source.h != old->source.h ||
+          config->dest.w   != old->dest.w   || config->dest.h   != old->dest.h) &&
+         (config->dest.w != config->source.w || config->dest.h != config->source.h))
+     {
+          D_DEBUG_AT( Davinci_Video, "  => scaling %4dx%4d -> %4dx%4d\n",
+                      config->source.w, config->source.h, config->dest.w, config->dest.h );
+
+          SetupResizerParams( &dvid->resizer, config->source.w, config->source.h,
+                              config->dest.w, config->dest.h, &dvid->resized.w, &dvid->resized.h );
+
+          dvid->offset.x = (config->dest.w - dvid->resized.w) / 2;
+          dvid->offset.y = (config->dest.h - dvid->resized.h) / 2;
+
+          D_DEBUG_AT( Davinci_Video, "  => resized %4dx%4d, centered %d,%d\n",
+                      dvid->resized.w, dvid->resized.h, dvid->offset.x, dvid->offset.y );
+
+          dvid->offset.x += dvid->offset.x & 1; /* Round up to multiple of two */
+
+          D_DEBUG_AT( Davinci_Video, "  => offset  %4d,%4d\n", dvid->offset.x, dvid->offset.y );
+
+          davincifb_pan_display( &ddrv->fb[VID1], &dvid->var, NULL, DSFLIP_NONE, 0, 0 );
+     }
+
+     dvid->enable = true;
+     dvid->config = *config;
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoRemoveRegion( CoreLayer *layer,
+                   void      *driver_data,
+                   void      *layer_data,
+                   void      *region_data )
+{
+     int                    ret;
+     DavinciDriverData     *ddrv = driver_data;
+     DavinciVideoLayerData *dvid = layer_data;
+
+     D_DEBUG_AT( Davinci_Video, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( ddrv != NULL );
+
+     ret = ioctl( ddrv->fb[VID1].fd, FBIO_ENABLE_DISABLE_WIN, 0 );
+     if (ret)
+          D_VIDERROR( "Davinci/Video: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", VID1, 0 );
+
+     dvid->enabled = false;
+     dvid->enable  = false;
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoFlipRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreSurface           *surface,
+                 DFBSurfaceFlipFlags    flags,
+                 CoreSurfaceBufferLock *lock )
+{
+     DFBResult              ret;
+     DavinciDriverData     *ddrv = driver_data;
+     DavinciVideoLayerData *dvid = layer_data;
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( dvid != NULL );
+
+     D_DEBUG_AT( Davinci_Video, "%s( 0x%08lx [%d] 0x%04x [%4dx%4d] )\n", __FUNCTION__,
+                 lock->phys, lock->pitch, flags, dvid->config.width, dvid->config.height );
+
+     ret = ShowBuffer( ddrv, dvid, lock, NULL, flags );
+     if (ret)
+          return ret;
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoUpdateRegion( CoreLayer             *layer,
+                   void                  *driver_data,
+                   void                  *layer_data,
+                   void                  *region_data,
+                   CoreSurface           *surface,
+                   const DFBRegion       *update,
+                   CoreSurfaceBufferLock *lock )
+{
+     DavinciDriverData     *ddrv = driver_data;
+     DavinciVideoLayerData *dvid = layer_data;
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( lock != NULL );
+     D_ASSERT( ddrv != NULL );
+     D_ASSERT( dvid != NULL );
+
+     if (update) {
+          DFBRectangle area = DFB_RECTANGLE_INIT_FROM_REGION( update );
+
+          D_DEBUG_AT( Davinci_Video, "%s( 0x%08lx [%d], %4d,%4d-%4dx%4d )\n", __FUNCTION__,
+                      lock->phys, lock->pitch, DFB_RECTANGLE_VALS( &area ) );
+
+          if (!dfb_rectangle_intersect( &area, &dvid->config.source )) {
+               D_DEBUG_AT( Davinci_Video, "  -> NO INTERSECTION with %4d,%4d-%4dx%4d\n",
+                           DFB_RECTANGLE_VALS( &dvid->config.source ) );
+
+               return DFB_OK;
+          }
+
+          if (!DFB_RECTANGLE_EQUAL( area, dvid->config.source ))
+               return ShowBuffer( ddrv, dvid, lock, &area, DSFLIP_NONE );
+     }
+     else
+          D_DEBUG_AT( Davinci_Video, "%s( 0x%08lx [%d], %4dx%4d )\n", __FUNCTION__,
+                      lock->phys, lock->pitch, dvid->config.width, dvid->config.height );
+
+     return ShowBuffer( ddrv, dvid, lock, NULL, DSFLIP_NONE );
+}
+
+const DisplayLayerFuncs davinciVideoLayerFuncs = {
+     .LayerDataSize = videoLayerDataSize,
+     .InitLayer     = videoInitLayer,
+
+     .TestRegion    = videoTestRegion,
+     .SetRegion     = videoSetRegion,
+     .RemoveRegion  = videoRemoveRegion,
+     .FlipRegion    = videoFlipRegion,
+     .UpdateRegion  = videoUpdateRegion,
+};
+
+/***********************************************************************************************************************
+** Frame Output
+*/
+
+static void
+enable_video( DavinciDriverData     *ddrv,
+              DavinciVideoLayerData *dvid )
+{
+     if (dvid->enable && !dvid->enabled) {
+          ioctl( ddrv->fb[VID1].fd, FBIO_WAITFORVSYNC );
+
+          if (ioctl( ddrv->fb[VID1].fd, FBIO_ENABLE_DISABLE_WIN, 1 ))
+               D_VIDERROR( "Davinci/Video: FBIO_ENABLE_DISABLE_WIN (fb%d - %d)!\n", VID1, 1 );
+
+          dvid->enabled = true;
+     }
+}
+
+static DFBResult
+ShowBuffer( DavinciDriverData     *ddrv,
+            DavinciVideoLayerData *dvid,
+            CoreSurfaceBufferLock *lock,
+            const DFBRectangle    *area,
+            DFBSurfaceFlipFlags    flags )
+{
+     const CoreLayerRegionConfig *config = &dvid->config;
+
+     if (area)
+          D_DEBUG_AT( Davinci_Video, "%s( 0x%08lx [%d], %4d,%4d-%4dx%4d )\n", __FUNCTION__,
+                      lock->phys, lock->pitch, DFB_RECTANGLE_VALS( area ) );
+     else
+          D_DEBUG_AT( Davinci_Video, "%s( 0x%08lx [%d] )\n", __FUNCTION__, lock->phys, lock->pitch );
+
+     if (config->dest.w == config->source.w && config->dest.h == config->source.h) {
+          /*
+           * Unscaled video, buffer displayed directly
+           */
+          D_DEBUG_AT( Davinci_Video, "  -> unscaled %4dx%4d <- %4d,%4d [%4dx%4d]\n",
+                      config->source.w, config->source.h, config->source.x, config->source.y,
+                      config->width, config->height );
+
+          /* Partial update, assuming proper buffer is shown, saving system calls */
+          if (area && dvid->enabled)
+               return DFB_OK;
+               
+          davincifb_pan_display( &ddrv->fb[VID1], &dvid->var, lock, flags, config->source.x, config->source.y );
+     }
+     else {
+          int                    ret;
+          DavinciDeviceData     *ddev   = ddrv->ddev;
+          CoreSurfaceBuffer     *buffer = lock->buffer;
+          vpfe_resizer_params_t *params = &dvid->resizer;
+
+          /*
+           * Scaled video, buffer scaled to output buffer by resizer
+           */
+          D_DEBUG_AT( Davinci_Video, "  -> scaled %4dx%4d -> %4dx%4d <- %4d,%4d [%4dx%4d]\n",
+                      config->source.w, config->source.h, config->dest.w, config->dest.h,
+                      config->source.x, config->source.y, config->width, config->height );
+
+          /* FIXME: Implement scaled partial updates! */
+          if (area)
+               D_UNIMPLEMENTED();
+
+          params->sdr_inoff = lock->pitch;
+          params->sdr_inadd = lock->phys + DFB_BYTES_PER_LINE( buffer->format, config->source.x )
+                                         + config->source.y * params->sdr_inoff;
+
+          params->sdr_outoff = ddev->fix[VID1].line_length;
+          params->sdr_outadd = ddev->fix[VID1].smem_start + dvid->offset.x * 2
+                                                          + dvid->offset.y * params->sdr_outoff;
+
+          params->in_start    = (params->sdr_outadd & 0x1f) / 2;
+          params->sdr_outadd &= ~0x1f;
+
+          D_DEBUG_AT( Davinci_Video, "  -> FBIO_RESIZER running...\n" );
+
+          ret = ioctl( ddrv->fb[VID1].fd, FBIO_RESIZER, params );
+          if (ret)
+               D_VIDERROR( "Davinci/Video: FBIO_RESIZER (fb%d)!\n", VID1 );
+
+          D_DEBUG_AT( Davinci_Video, "  => FBIO_RESIZER returned %d\n", ret );
+     }
+
+     enable_video( ddrv, dvid );
+
+     return DFB_OK;
+}
+
+/***********************************************************************************************************************
+** Scaling Setup
+*/
+
+static int
+limitInput(int rsz,int inSize,int outSize,int* pInSize)
+{
+     int phases;
+     int phaseShift;
+     int taps;
+     int phaseMask;
+     int coarseShift;
+     int halfCoarse;
+     int tmp;
+
+     do {
+          if (rsz<=512) {
+               //1/2x to 4x resize uses 8 phase, 4 taps
+               phaseShift = 3;
+               taps = 4;
+          }
+          else {
+               //4-phase, 7 taps
+               phaseShift = 2;
+               taps = 7;
+          }
+          phases = 1<<phaseShift;
+          phaseMask = phases-1;
+          coarseShift = (8-phaseShift);
+          halfCoarse = (1<<(coarseShift-1));
+          tmp = (((outSize-1)* rsz + halfCoarse)>>8) + taps;
+          if (tmp <= inSize) break;
+          rsz--;
+     } while (1);
+
+     *pInSize = tmp;
+
+     return rsz;
+}
+
+static void
+SetupCoef(unsigned int* pCoef,int rsz)
+{
+     int startCoef;
+     int highCoef;
+     int c;
+     int phases;
+     int taps;
+     if (rsz<=512) {
+          //1/2x to 4x resize uses 8 phase, 4 taps
+          highCoef = 0x100;
+          c=1;
+          phases=8;
+          taps=4;
+     }
+     else {
+          //4-phase, 7 taps
+          if (rsz<=(256*3)) {
+               highCoef = 0x100/2; c=2;
+          }
+          else {
+               highCoef = 0x100/4; c=1;
+          }
+          phases=4;
+          taps=7;
+     }
+     startCoef = highCoef>>1;
+     while (phases) {
+          int prev = startCoef;
+          int tapNum=0;
+          int rem=256 - startCoef;
+          while ( tapNum < (c-1)) {
+               *pCoef++ = 0;
+               tapNum+=2;
+          }
+          if (c&1) {
+               *pCoef++ = prev<<16;
+               tapNum+=2;
+          }
+          else {
+               tapNum++;
+          }
+          while ( tapNum < taps) {
+               int min = (rem<highCoef)? rem : highCoef;
+               if (tapNum&1) *pCoef++ = (min<<16)+prev;
+               else prev = min;
+               rem -= min;
+               tapNum++;
+          }
+          if (tapNum&1) {
+               *pCoef++ = prev;
+               tapNum++;
+          }
+          while ( tapNum < taps) {
+               *pCoef++ = 0;
+               tapNum+=2;
+          }
+          if (startCoef > (highCoef>>3)) startCoef -= (highCoef>>3);
+          else {
+               startCoef = highCoef; c++;
+          }
+          phases--;
+     }
+}
+
+#define SDRAM_SRC (1<<28)
+#define BILINEAR (1<<29)
+
+static void
+SetupResizerParams( vpfe_resizer_params_t *params,
+                    int srcWidth, int srcHeight,
+                    int outWidth, int outHeight,
+                    int *ret_outWidth,
+                    int *ret_outHeight )
+{
+     int rsz;
+     int hrsz;
+     int vrsz;
+     int tmp;
+
+     D_DEBUG_AT( Davinci_Video, "%s( %4dx%4d->%4dx%4d )\n", __FUNCTION__, srcWidth, srcHeight, outWidth, outHeight );
+
+     params->sdr_inadd = 0;
+     params->sdr_inoff = 0;
+
+     params->sdr_outadd = 0;
+     params->sdr_outoff = 0;
+
+     params->in_start = (0<<16)|(0);
+     params->yenh = 0;
+
+     params->rsz_cnt = SDRAM_SRC;
+
+
+
+
+     //find scale factor
+     rsz = (srcWidth<<8)/outWidth;
+     if (rsz<64) {
+          //too much upscaling, reduce destination size
+          rsz = 64;
+     }
+     else if (rsz>1024) {
+          //too much down scaling, reduce source size
+          rsz=1024;
+          srcWidth  = (outWidth * rsz)>>8;
+     }
+
+     tmp = ((srcWidth<<8)+255)/rsz;
+     if (tmp > outWidth) tmp = outWidth;
+     tmp &= ~1;  //force even
+     if (rsz>256) {
+          //upsize in vertical direction requires a multiple of 16 bytes (8 pixels)
+          tmp &= ~0x7;
+     }
+     do {
+          int t;
+          hrsz = limitInput(rsz,srcWidth,tmp,&t);
+          if (hrsz>=64) {
+               srcWidth = t;
+               break;
+          }
+          tmp-=2;
+     } while (1);
+     outWidth = tmp;
+
+     if (srcWidth==outWidth) {
+          int i=0;
+          params->rsz_cnt |= ((256-1)<<0);    //1 to 1
+          params->in_size = (srcWidth+3);  //4 taps
+          while (i<16) {
+               params->hfilt[i] = i? 0 : 0x100; //2 coefficient written at a time
+               i++;
+          }
+     }
+     else {
+          SetupCoef(¶ms->hfilt[0],hrsz);
+          params->rsz_cnt |= ((hrsz-1)<<0) | ((hrsz<256)? BILINEAR : 0);
+          params->in_size = (srcWidth);
+     }
+
+
+
+
+     //find scale factor
+     rsz = (srcHeight<<8)/outHeight;
+     if (rsz<64) {
+          //too much upscaling, reduce destination size
+          rsz = 64;
+     }
+     else if (rsz>1024) {
+          //too much down scaling, reduce source size
+          rsz=1024;
+          srcHeight = (outHeight * rsz)>>8;
+     }
+
+     tmp = ((srcHeight<<8)+255)/rsz;
+     if (tmp > outHeight) tmp = outHeight;
+     do {
+          int t;
+          vrsz = limitInput(rsz,srcHeight,tmp,&t);
+          if (vrsz>=64) {
+               srcHeight = t;
+               break;
+          }
+          tmp--;
+     } while (1);
+     outHeight = tmp;
+
+     if (srcHeight==outHeight) {
+          int i=0;
+          params->rsz_cnt |= ((256-1)<<10);   //1 to 1
+          params->in_size |= ((srcHeight+3)<<16);   //4 taps
+          while (i<16) {
+               params->vfilt[i] = i? 0 : 0x100; //2 coefficient written at a time
+               i++;
+          }
+     }
+     else {
+          SetupCoef(¶ms->vfilt[0],vrsz);
+          params->rsz_cnt |= ((vrsz-1)<<10);
+          params->in_size |= (srcHeight<<16);
+     }
+
+
+     params->out_size = (outHeight<<16)|(outWidth);
+
+     D_DEBUG_AT( Davinci_Video, "  => %4dx%4d->%4dx%4d\n", srcWidth, srcHeight, outWidth, outHeight );
+
+     if (ret_outWidth)
+          *ret_outWidth = outWidth;
+          
+     if (ret_outHeight)
+          *ret_outHeight = outHeight;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_video.h b/Source/DirectFB/gfxdrivers/davinci/davinci_video.h
new file mode 100755
index 0000000..7d6e206
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_video.h
@@ -0,0 +1,58 @@
+/*
+   TI Davinci driver - Video Layer
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_VIDEO_H__
+#define __DAVINCI_VIDEO_H__
+
+#include <linux/fb.h>
+
+#include <core/layers.h>
+
+#define DAVINCI_VIDEO_SUPPORTED_OPTIONS  (DLOP_NONE)
+
+
+typedef struct {
+     struct fb_var_screeninfo var;
+
+     bool                     enable;
+     bool                     enabled;
+
+     CoreLayerRegionConfig    config;
+
+     vpfe_resizer_params_t    resizer;
+     DFBDimension             resized;
+     DFBPoint                 offset;
+} DavinciVideoLayerData;
+
+
+extern const DisplayLayerFuncs davinciVideoLayerFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.c b/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.c
new file mode 100755
index 0000000..f0f45b5
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.c
@@ -0,0 +1,393 @@
+/*
+   TI Davinci driver - VID1 FB Memory for direct UYVY mode
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/gfxcard.h>
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include "davincifb.h"
+
+#include "davinci_gfxdriver.h"
+
+D_DEBUG_DOMAIN( Video_Surfaces, "Video/Surfaces", "Video Framebuffer Surface Pool" );
+D_DEBUG_DOMAIN( Video_SurfLock, "Video/SurfLock", "Video Framebuffer Surface Pool Locks" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int             magic;
+} VideoPoolData;
+
+typedef struct {
+     int             magic;
+
+     CoreDFB        *core;
+     void           *mem;
+     unsigned long   phys;
+} VideoPoolLocalData;
+
+typedef struct {
+     int   magic;
+
+     int   offset;
+     int   pitch;
+     int   size;
+} VideoAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+videoPoolDataSize( void )
+{
+     return sizeof(VideoPoolData);
+}
+
+static int
+videoPoolLocalDataSize( void )
+{
+     return sizeof(VideoPoolLocalData);
+}
+
+static int
+videoAllocationDataSize( void )
+{
+     return sizeof(VideoAllocationData);
+}
+
+static DFBResult
+videoInitPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data,
+               CoreSurfacePoolDescription *ret_desc )
+{
+     VideoPoolData      *data  = pool_data;
+     VideoPoolLocalData *local = pool_local;
+     DavinciDriverData  *ddrv  = dfb_gfxcard_get_driver_data();
+     DavinciDeviceData  *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( Video_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( data != NULL );
+     D_ASSERT( local != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps     = CSPCAPS_NONE;
+     ret_desc->types    = CSTF_LAYER | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority = CSPP_DEFAULT;
+
+     ret_desc->access[CSAID_CPU]    = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_GPU]    = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_LAYER1] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Video Pool" );
+
+     local->core = core;
+     local->mem  = ddrv->fb[VID1].mem;
+     local->phys = ddev->fix[VID1].smem_start;
+
+     D_MAGIC_SET( data, VideoPoolData );
+     D_MAGIC_SET( local, VideoPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoJoinPool( CoreDFB         *core,
+               CoreSurfacePool *pool,
+               void            *pool_data,
+               void            *pool_local,
+               void            *system_data )
+{
+     VideoPoolData      *data  = pool_data;
+     VideoPoolLocalData *local = pool_local;
+     DavinciDriverData  *ddrv  = dfb_gfxcard_get_driver_data();
+     DavinciDeviceData  *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( Video_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_ASSERT( local != NULL );
+
+     (void) data;
+
+     local->core = core;
+     local->mem  = ddrv->fb[VID1].mem;
+     local->phys = ddev->fix[VID1].smem_start;
+
+     D_MAGIC_SET( local, VideoPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoDestroyPool( CoreSurfacePool *pool,
+                  void            *pool_data,
+                  void            *pool_local )
+{
+     VideoPoolData      *data  = pool_data;
+     VideoPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( Video_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_MAGIC_ASSERT( local, VideoPoolLocalData );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoLeavePool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     VideoPoolData      *data  = pool_data;
+     VideoPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( Video_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_MAGIC_ASSERT( local, VideoPoolLocalData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoTestConfig( CoreSurfacePool         *pool,
+                 void                    *pool_data,
+                 void                    *pool_local,
+                 CoreSurfaceBuffer       *buffer,
+                 const CoreSurfaceConfig *config )
+{
+     CoreSurface        *surface;
+     VideoPoolData      *data  = pool_data;
+     VideoPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( Video_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_MAGIC_ASSERT( local, VideoPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     (void) data;
+     (void) local;
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == 1)
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+videoAllocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     CoreSurface         *surface;
+     VideoPoolData       *data  = pool_data;
+     VideoPoolLocalData  *local = pool_local;
+     VideoAllocationData *alloc = alloc_data;
+     DavinciDeviceData   *ddev  = dfb_gfxcard_get_device_data();
+
+     D_DEBUG_AT( Video_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_MAGIC_ASSERT( local, VideoPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     (void) data;
+     (void) local;
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == 1) {
+          int index = dfb_surface_buffer_index( buffer );
+
+          alloc->pitch  = ddev->fix[VID1].line_length;
+          alloc->size   = surface->config.size.h * alloc->pitch;
+          alloc->offset = index * alloc->size;
+
+          D_DEBUG_AT( Video_Surfaces, "  -> offset %d, pitch %d, size %d\n", alloc->offset, alloc->pitch, alloc->size );
+
+          allocation->size   = alloc->size;
+          allocation->offset = alloc->offset;
+
+          D_MAGIC_SET( alloc, VideoAllocationData );
+
+          return DFB_OK;
+     }
+
+     return DFB_BUG;
+}
+
+static DFBResult
+videoDeallocateBuffer( CoreSurfacePool       *pool,
+                       void                  *pool_data,
+                       void                  *pool_local,
+                       CoreSurfaceBuffer     *buffer,
+                       CoreSurfaceAllocation *allocation,
+                       void                  *alloc_data )
+{
+     VideoPoolData       *data  = pool_data;
+     VideoAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( Video_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VideoPoolData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, VideoAllocationData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoLock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     VideoPoolLocalData  *local = pool_local;
+     VideoAllocationData *alloc = alloc_data;
+     DavinciDeviceData   *ddev  = dfb_gfxcard_get_device_data();
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, VideoAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( Video_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     int index  = alloc->offset / alloc->size;
+     int height = alloc->size   / alloc->pitch;
+
+     alloc->pitch  = ddev->fix[VID1].line_length;
+     alloc->size   = height * alloc->pitch;
+     alloc->offset = index * alloc->size;
+
+     allocation->size   = alloc->size;
+     allocation->offset = alloc->offset;
+
+     lock->pitch  = alloc->pitch;
+     lock->offset = alloc->offset;
+     lock->addr   = local->mem  + alloc->offset;
+     lock->phys   = local->phys + alloc->offset;
+
+     D_DEBUG_AT( Video_SurfLock, "  -> offset %lu, pitch %d, addr %p, phys 0x%08lx\n",
+                 lock->offset, lock->pitch, lock->addr, lock->phys );
+
+     return DFB_OK;
+}
+
+static DFBResult
+videoUnlock( CoreSurfacePool       *pool,
+             void                  *pool_data,
+             void                  *pool_local,
+             CoreSurfaceAllocation *allocation,
+             void                  *alloc_data,
+             CoreSurfaceBufferLock *lock )
+{
+     VideoAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, VideoAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( Video_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs davinciVideoSurfacePoolFuncs = {
+     .PoolDataSize       = videoPoolDataSize,
+     .PoolLocalDataSize  = videoPoolLocalDataSize,
+     .AllocationDataSize = videoAllocationDataSize,
+
+     .InitPool           = videoInitPool,
+     .JoinPool           = videoJoinPool,
+     .DestroyPool        = videoDestroyPool,
+     .LeavePool          = videoLeavePool,
+
+     .TestConfig         = videoTestConfig,
+     .AllocateBuffer     = videoAllocateBuffer,
+     .DeallocateBuffer   = videoDeallocateBuffer,
+
+     .Lock               = videoLock,
+     .Unlock             = videoUnlock,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.h b/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.h
new file mode 100755
index 0000000..dd60b12
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davinci_video_pool.h
@@ -0,0 +1,39 @@
+/*
+   TI Davinci driver - VID1 FB Memory for direct UYVY mode
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (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 __DAVINCI_VIDEO_POOL_H__
+#define __DAVINCI_VIDEO_POOL_H__
+
+#include <core/surface_pool.h>
+
+extern const SurfacePoolFuncs davinciVideoSurfacePoolFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/davincifb.h b/Source/DirectFB/gfxdrivers/davinci/davincifb.h
new file mode 100755
index 0000000..35eb169
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/davincifb.h
@@ -0,0 +1,581 @@
+/* 
+ * Copyright (C) 2006 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option)any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * File: davincifb.h	
+ */
+
+#ifndef DAVINVI_VPBE_H
+#define DAVINVI_VPBE_H
+
+/* include Linux files */
+#include <linux/fb.h>
+
+/* define the custom FBIO_WAITFORVSYNC ioctl */
+#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, u_int32_t)
+#define FBIO_SETATTRIBUTE       _IOW('F', 0x21, struct fb_fillrect)
+
+/* Backported IOCTLS. */
+#define FBIO_SETPOSX                            _IOW('F', 0x22, u_int32_t)
+#define FBIO_SETPOSY                            _IOW('F', 0x23, u_int32_t)
+#define FBIO_SETZOOM            		_IOW('F', 0x24, struct zoom_params)
+#define FBIO_GETSTD                             _IOR('F', 0x25, u_int32_t)
+#define FBIO_RESIZER		                _IOW('F', 0x26, struct vpfe_resizer_params)
+#define FBIO_SYNC		                _IOW('F', 0x27, u_int32_t)
+
+typedef struct zoom_params {
+	u_int32_t window_id;
+	u_int32_t zoom_h;
+	u_int32_t zoom_v;
+} zoom_params_t;
+
+typedef struct vpfe_resizer_params
+{
+	u_int32_t rsz_cnt;	//busy-lock
+	u_int32_t out_size;	//busy-lock
+	u_int32_t in_start;	//busy-lock
+	u_int32_t in_size;	//busy-lock
+	u_int32_t sdr_inadd;	//shadowed
+	u_int32_t sdr_inoff;	//shadowed
+	u_int32_t sdr_outadd;	//shadowed
+	u_int32_t sdr_outoff;	//shadowed
+	u_int32_t hfilt[16];	//busy-lock
+	u_int32_t vfilt[16];	//busy-lock
+	u_int32_t yenh;		//busy-lock
+} vpfe_resizer_params_t;
+
+typedef struct fb_set_start {
+	int		offset;		/* offset from smem_start */
+	unsigned long	physical;	/* absolute physical address when offset < 0 */
+
+	u_int64_t	sync;		/* input:  target sync counter for change or 0 for no sync at all,
+					   output: sync counter of actual change or 0 if still pending */
+} fb_set_start_t;
+
+
+#ifdef _IOC_TYPECHECK
+#undef _IOC_TYPECHECK
+#define _IOC_TYPECHECK(x)     (sizeof(x))
+#endif
+
+#define	RAM_CLUT_SIZE	256*3
+#define FBIO_ENABLE_DISABLE_WIN		\
+	_IOW('F', 0x30, unsigned char)
+#define FBIO_SET_BITMAP_BLEND_FACTOR	\
+	_IOW('F', 0x31, vpbe_bitmap_blend_params_t)
+#define FBIO_SET_BITMAP_WIN_RAM_CLUT    \
+	_IOW('F', 0x32, unsigned char)*RAM_CLUT_SIZE)
+#define FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN \
+	_IOW('F', 0x33, unsigned int)
+#define FBIO_GET_BLINK_INTERVAL		\
+	_IOR('F', 0x34, vpbe_blink_option_t)
+#define FBIO_SET_BLINK_INTERVAL         \
+	_IOW('F', 0x35, vpbe_blink_option_t)
+#define FBIO_GET_VIDEO_CONFIG_PARAMS    \
+	_IOR('F', 0x36, vpbe_video_config_params_t)
+#define FBIO_SET_VIDEO_CONFIG_PARAMS    \
+	_IOW('F', 0x37, vpbe_video_config_params_t)
+#define FBIO_GET_BITMAP_CONFIG_PARAMS   \
+	_IOR('F', 0x38, vpbe_bitmap_config_params_t)
+#define FBIO_SET_BITMAP_CONFIG_PARAMS   \
+	_IOW('F', 0x39, vpbe_bitmap_config_params_t)
+#define FBIO_SET_DCLK                   \
+	_IOW('F', 0x40, vpbe_dclk_t)
+#define FBIO_SET_INTERFACE		\
+	_IOW('F', 0x41, unsigned char)
+#define FBIO_GET_INTERFACE		\
+	_IOR('F', 0x42, unsigned char)
+#define FBIO_QUERY_TIMING		\
+	_IOWR('F', 0x43, struct vpbe_mode_info)
+#define FBIO_SET_TIMING			\
+	_IOW('F', 0x44, struct vpbe_fb_videomode)
+#define FBIO_GET_TIMING                 \
+	_IOR('F', 0x45, struct vpbe_fb_videomode)
+#define FBIO_SET_VENC_CLK_SOURCE	\
+	_IOW('F', 0x46, unsigned char)
+#define FBIO_SET_BACKG_COLOR            \
+	_IOW('F', 0x47, vpbe_backg_color_t)
+#define FBIO_ENABLE_DISPLAY		\
+	_IOW('F', 0x48, unsigned char)
+#define FBIO_SETPOS            		\
+	_IOW('F', 0x49, u_int32_t)
+#define FBIO_SET_CURSOR         	\
+	_IOW('F', 0x50, struct fb_cursor)
+#define FBIO_SET_START     		\
+	_IOW('F', 0x66, struct fb_set_start)
+
+/* 
+ * Defines and Constants
+ */
+#ifdef __KERNEL__
+#define DAVINCIFB_DEVICE "davincifb"
+#define DAVINCIFB_DRIVER "davincifb"
+
+#define MULTIPLE_BUFFERING      1
+
+#ifdef MULTIPLE_BUFFERING
+#define DOUBLE_BUF      2
+#define TRIPLE_BUF      3
+#else
+#define DOUBLE_BUF      1
+#define TRIPLE_BUF      1
+#endif
+
+/* usage:	if (is_win(info->fix.id, OSD0)) ... */
+#define is_win(name, x) ((strcmp(name, x ## _FBNAME) == 0) ? 1 : 0)
+
+/*
+ * display controller register I/O routines
+ */
+u32 dispc_reg_in(u32 offset);
+u32 dispc_reg_out(u32 offset, u32 val);
+u32 dispc_reg_merge(u32 offset, u32 val, u32 mask);
+
+#endif				/*__KERNEL__*/
+
+/*  Error return codes  */
+#define VPBE_INVALID_PARA_VALUE         700
+#define VPBE_WRONG_WINDOW_ID            701
+#define VPBE_CURRENTLY_IN_REQUIRED_MODE 702
+#define VPBE_INSUFFICIENT_CLUT_VALUES   703
+#define VPBE_CLUT_WRITE_TIMEOUT         704
+#define VPBE_VID0_BUF_ADR_NULL          705
+#define VPBE_WINDOW_NOT_DISABLED        706
+#define VPBE_WINDOW_NOT_ENABLED         707
+
+#ifndef __KERNEL__
+/*  Window ID definations */
+#define OSD0      0
+#define VID0      1
+#define OSD1      2
+#define VID1      3
+#endif
+
+/* There are 4 framebuffers, each represented by an fb_info and
+ * a dm_win_info structure */
+#define OSD0_FBNAME "dm_osd0_fb"
+#define OSD1_FBNAME "dm_osd1_fb"
+#define VID0_FBNAME "dm_vid0_fb"
+#define VID1_FBNAME "dm_vid1_fb"
+
+/*  FIXME: Digital LCD RGB matrix coefficients */
+#define DLCD_DGY_VAL    0
+#define DLCD_DRV_VAL    0
+#define DLCD_DGU_VAL    0
+#define DLCD_DBU_VAL		0
+
+/* Defines for bitmap format */
+#define VPBE_BITMAP_BIT_1	1
+#define VPBE_BITMAP_BIT_2	2
+#define VPBE_BITMAP_BIT_4	4
+#define VPBE_BITMAP_BIT_8	8
+#define VPBE_BITMAP_RGB565	16
+#define VPBE_VIDEO_YUV422 	16
+#define VPBE_VIDEO_RGB888 	24
+
+/* Defines foe cursor parameter validation*/
+#define MAX_CURSOR_WIDTH	0x3FF
+#define MAX_CURSOR_HEIGHT	0x1FF
+#define MAX_CURSOR_LINEWIDTH    7
+
+#define BASEX		0x80
+#define BASEY		0x12
+#define BASEX_DLCD		0x59
+#define BASEY_DLCD		0x22
+
+/*
+ * Enumerations 
+ */
+/*  Enum for blending factor  */
+typedef enum vpbe_blend_factor {
+	OSD_CONTRIBUTION_ZERO = 0,
+	OSD_CONTRIBUTION_1_BY_8 = 1,
+	OSD_CONTRIBUTION_2_BY_8 = 2,
+	OSD_CONTRIBUTION_3_BY_8 = 3,
+	OSD_CONTRIBUTION_4_BY_8 = 4,
+	OSD_CONTRIBUTION_5_BY_8 = 5,
+	OSD_CONTRIBUTION_6_BY_8 = 6,
+	OSD_CONTRIBUTION_ONE = 7
+} vpbe_blend_factor_t;
+
+/*  Enum for Boolean variables  */
+typedef enum {
+	SET_0 = 0,
+	SET_1 = 1
+} CB_CR_ORDER, ATTRIBUTE, ROM_RAM_CLUT;
+
+/*  Defines for Display Interface */
+#define  PRGB		0
+#define  COMPOSITE      1
+#define  SVIDEO    	2
+#define  COMPONENT 	3
+#define  RGB       	4
+#define  YCC16     	5
+#define  YCC8      	6
+#define  SRGB      	7
+#define  EPSON     	8
+#define  CASIO1G   	9
+#define  UDISP     	10
+#define  STN       	11
+#define VPBE_MAX_INTERFACES	12
+
+/*  Defines for Display Mode */
+#define  LCD    0
+#define  NTSC	1
+#define  PAL    2
+#define  P525   3
+#define  P625   4
+
+#define DEFAULT_MODE 0
+#define  P480   0
+#define  P400   1
+#define  P350   2
+#define NON_EXISTING_MODE 255
+/*  Enable/Disable enum */
+typedef enum {
+	VPBE_DISABLE = 0,
+	VPBE_ENABLE = 1
+} ATTENUATION, TRANSPARENCY, EXPANSION, BLINKING;
+
+typedef enum clk_source {
+	CLK_SOURCE_CLK27 = 0,
+	CLK_SOURCE_CLK54 = 1,
+	CLK_SOURCE_VPBECLK = 2
+} CLK_SOURCE;
+
+/*
+ * Structures and Union Definitions
+ */
+
+/*  Structure for transparency and the blending factor for the bitmap window  */
+typedef struct vpbe_bitmap_blend_params {
+	unsigned int colorkey;	/* color key to be blend */
+	unsigned int enable_colorkeying;	/* enable color keying */
+	unsigned int bf;	/* valid range from 0 to 7 only. */
+} vpbe_bitmap_blend_params_t;
+
+/*  Structure for window expansion  */
+typedef struct vpbe_win_expansion {
+	EXPANSION horizontal;
+	EXPANSION vertical;	/* 1: Enable 0:disable */
+} vpbe_win_expansion_t;
+
+/*  Structure for OSD window blinking options */
+typedef struct vpbe_blink_option {
+	BLINKING blinking;	/* 1: Enable blinking 0: Disable */
+	unsigned int interval;	/* Valid only if blinking is 1 */
+} vpbe_blink_option_t;
+
+/*  Structure for DCLK parameters */
+typedef struct vpbe_dclk {
+	unsigned char dclk_pattern_width;
+	unsigned int dclk_pattern0;
+	unsigned int dclk_pattern1;
+	unsigned int dclk_pattern2;
+	unsigned int dclk_pattern3;
+} vpbe_dclk_t;
+
+/*  Structure for display format  */
+typedef struct vpbe_display_format {
+	unsigned char interface;	/* Output interface type */
+	unsigned char mode;	/* output mode */
+} vpbe_display_format_t;
+
+/*  Structure for background color  */
+typedef struct vpbe_backg_color {
+	unsigned char clut_select;	/* 2: RAM CLUT 1:ROM1 CLUT 0:ROM0 CLUT */
+	unsigned char color_offset;	/* index of color */
+} vpbe_backg_color_t;
+
+/*  Structure for Video window configurable parameters  */
+typedef struct vpbe_video_config_params {
+	CB_CR_ORDER cb_cr_order;	/*Cb/Cr order in input data for a pixel. */
+	/*    0: cb cr  1:  cr cb */
+	vpbe_win_expansion_t exp_info;	/* HZ/VT Expansion enable disable */
+} vpbe_video_config_params_t;
+
+/*Union of structures giving the CLUT index for the 1, 2, 4 bit bitmap values.*/
+typedef union vpbe_clut_idx {
+	struct _for_4bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char bitmap_val_1;
+		unsigned char bitmap_val_2;
+		unsigned char bitmap_val_3;
+		unsigned char bitmap_val_4;
+		unsigned char bitmap_val_5;
+		unsigned char bitmap_val_6;
+		unsigned char bitmap_val_7;
+		unsigned char bitmap_val_8;
+		unsigned char bitmap_val_9;
+		unsigned char bitmap_val_10;
+		unsigned char bitmap_val_11;
+		unsigned char bitmap_val_12;
+		unsigned char bitmap_val_13;
+		unsigned char bitmap_val_14;
+		unsigned char bitmap_val_15;
+	} for_4bit_bimap;
+	struct _for_2bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char dummy0[4];
+		unsigned char bitmap_val_1;
+		unsigned char dummy1[4];
+		unsigned char bitmap_val_2;
+		unsigned char dummy2[4];
+		unsigned char bitmap_val_3;
+	} for_2bit_bimap;
+	struct _for_1bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char dummy0[14];
+		unsigned char bitmap_val_1;
+	} for_1bit_bimap;
+} vpbe_clut_idx_t;
+
+/*  Structure for bitmap window configurable parameters */
+typedef struct vpbe_bitmap_config_params {
+	/* Only for bitmap width = 1,2,4 bits */
+	vpbe_clut_idx_t clut_idx;
+	/* Attenuation value for YUV o/p for bitmap window */
+	unsigned char attenuation_enable;
+	/* 0: ROM DM270, 1:ROM DM320, 2:RAM CLUT */
+	unsigned char clut_select;
+} vpbe_bitmap_config_params_t;
+
+/*  Unioun for video/OSD configuration parameters  */
+typedef union vpbe_conf_params {
+
+	struct vpbe_video_params {
+		CB_CR_ORDER cb_cr_order;
+		/* HZ/VT Expansion enable disable */
+		vpbe_win_expansion_t exp_info;
+	} video_params;
+
+	struct vpbe_bitmap_params {
+		/* Attenuation value for YUV o/p */
+		ATTENUATION attenuation_enable;
+		/* 0: ROM DM270, 1: ROM DM320, 2:RAM CLUT */
+		unsigned char clut_select;
+		/* Only for bitmap width = 1,2,4 bits */
+		vpbe_clut_idx_t clut_idx;
+		/* 0: OSD window is bitmap window */
+		/* 1: OSD window is attribute window */
+		ATTRIBUTE enable_attribute;
+		/* To hold bps value. 
+		   Used to switch back from attribute to bitmap. */
+		unsigned int stored_bits_per_pixel;
+		/* Blending information */
+		vpbe_bitmap_blend_params_t blend_info;
+		/* OSD Blinking information */
+		vpbe_blink_option_t blink_info;
+	} bitmap_params;
+
+} vpbe_conf_params_t;
+
+typedef struct vpbe_video_params vpbe_video_params_t;
+typedef struct vpbe_bitmap_params vpbe_bitmap_params_t;
+
+/* Structure to hold window position */
+typedef struct vpbe_window_position {
+	unsigned int xpos;	/* X position of the window */
+	unsigned int ypos;	/* Y position of the window */
+} vpbe_window_position_t;
+
+#ifdef __KERNEL__
+/*  Structure for each window */
+typedef struct vpbe_dm_win_info {
+	struct fb_info info;
+	vpbe_window_position_t win_pos;	/* X,Y position of window */
+	/* Size of window is already there in var_info structure. */
+
+	dma_addr_t fb_base_phys;	/*framebuffer area */
+	unsigned int fb_base;	/*window memory pointer */
+	unsigned int fb_size;	/*memory size */
+	unsigned int pseudo_palette[17];
+	int alloc_fb_mem;
+	/*flag to identify if framebuffer area is fixed or not */
+	unsigned long sdram_address;
+	struct vpbe_dm_info *dm;
+	unsigned char window_enable;	/*Additions for all windows */
+	zoom_params_t zoom;	/*Zooming parameters */
+	unsigned char field_frame_select;	/*To select Field or frame */
+	unsigned char numbufs;	/*Number of buffers valid 2 or 3 */
+	vpbe_conf_params_t conf_params;
+	/*window configuration parameter union pointer */
+} vpbe_dm_win_info_t;
+#endif				/*__KERNEL__*/
+
+/*
+ *  Videmode structure for display interface and mode settings
+ */
+typedef struct vpbe_fb_videomode {
+	unsigned char name[10];	/* Mode name ( NTSC , PAL) */
+	unsigned int vmode;	/* FB_MODE_INTERLACED or FB_MODE_NON_INTERLACED */
+	unsigned int xres;	/* X Resolution of the display */
+	unsigned int yres;	/* Y Resolution of the display */
+	unsigned int fps;	/* frames per second */
+	/* Timing Parameters applicable for std = 0 only */
+	unsigned int left_margin;
+	unsigned int right_margin;
+	unsigned int upper_margin;
+	unsigned int lower_margin;
+	unsigned int hsync_len;
+	unsigned int vsync_len;
+	unsigned int sync;	/* 0: hsync -ve/vsync -ve */
+	/*1: hsync -ve/vsync +ve */
+	/*2: hsync +ve/vsync -ve */
+	/*3: hsync +ve/vsync +ve */
+	unsigned int basepx;	/* Display x,y start position */
+	unsigned int basepy;
+/*  1= Mode s available in modelist 0=Mode is not available in modelist */
+	unsigned int std;
+} vpbe_fb_videomode_t;
+
+/* Structure to interface videomode to application*/
+typedef struct vpbe_mode_info {
+	vpbe_fb_videomode_t vid_mode;
+	unsigned char interface;
+	unsigned char mode_idx;
+} vpbe_mode_info_t;
+
+#ifdef __KERNEL__
+/* 
+ * Structure for the driver holding information of windows, 
+ *  memory base addresses etc.
+ */
+typedef struct vpbe_dm_info {
+	vpbe_dm_win_info_t *osd0;
+	vpbe_dm_win_info_t *osd1;
+	vpbe_dm_win_info_t *vid0;
+	vpbe_dm_win_info_t *vid1;
+
+/* to map the registers */
+	dma_addr_t mmio_base_phys;
+	unsigned int mmio_base;
+	unsigned int mmio_size;
+
+	wait_queue_head_t vsync_wait;
+	unsigned int vsync_cnt;
+	int timeout;
+
+	/* this is the function that configures the output device (NTSC/PAL/LCD)
+	 * for the required output format (composite/s-video/component/rgb)
+	 */
+	void (*output_device_config) (void);
+
+	struct device *dev;
+
+	vpbe_backg_color_t backg;	/* background color */
+	vpbe_dclk_t dclk;	/*DCLK parameters */
+	vpbe_display_format_t display;	/*Display interface and mode */
+	vpbe_fb_videomode_t videomode;	/*Cuurent videomode */
+	char ram_clut[256][3];	/*RAM CLUT array */
+	struct fb_cursor cursor;	/* cursor config params from fb.h */
+/*Flag that indicates whether any of the display is enabled or not*/
+	int display_enable;
+} vpbe_dm_info_t;
+
+/*
+ * Functions Definitions for 'davincifb' module
+ */
+int vpbe_mem_alloc_window_buf(vpbe_dm_win_info_t *);
+int vpbe_mem_release_window_buf(vpbe_dm_win_info_t *);
+void init_display_function(vpbe_display_format_t *);
+int vpbe_mem_alloc_struct(vpbe_dm_win_info_t **);
+void set_vid0_default_conf(void);
+void set_vid1_default_conf(void);
+void set_osd0_default_conf(void);
+void set_osd1_default_conf(void);
+void set_cursor_default_conf(void);
+void set_dm_default_conf(void);
+void set_win_enable(char *, unsigned int);
+int within_vid0_limits(u32, u32, u32, u32);
+void vpbe_set_display_default(void);
+#ifdef __KERNEL__
+void set_win_position(char *, u32, u32, u32, u32);
+void change_win_param(int);
+void set_interlaced(char *, unsigned int);
+#endif /* __KERNEL__ */
+
+/*
+ *	Function definations for 'osd' module
+ */
+
+int vpbe_enable_window(vpbe_dm_win_info_t *);
+int vpbe_disable_window(vpbe_dm_win_info_t *);
+int vpbe_vid_osd_select_field_frame(u8 *, u8);
+int vpbe_bitmap_set_blend_factor(u8 *, vpbe_bitmap_blend_params_t *);
+int vpbe_bitmap_set_ram_clut(void);
+int vpbe_enable_disable_attribute_window(u32);
+int vpbe_get_blinking(u8 *, vpbe_blink_option_t *);
+int vpbe_set_blinking(u8 *, vpbe_blink_option_t *);
+int vpbe_set_vid_params(u8 *, vpbe_video_config_params_t *);
+int vpbe_get_vid_params(u8 *, vpbe_video_config_params_t *);
+int vpbe_bitmap_get_params(u8 *, vpbe_bitmap_config_params_t *);
+int vpbe_bitmap_set_params(u8 *, vpbe_bitmap_config_params_t *);
+int vpbe_set_cursor_params(struct fb_cursor *);
+int vpbe_set_vid_expansion(vpbe_win_expansion_t *);
+int vpbe_set_dclk(vpbe_dclk_t *);
+int vpbe_set_display_format(vpbe_display_format_t *);
+int vpbe_set_backg_color(vpbe_backg_color_t *);
+int vpbe_set_interface(u8);
+int vpbe_query_mode(vpbe_mode_info_t *);
+int vpbe_set_mode(struct vpbe_fb_videomode *);
+int vpbe_set_venc_clk_source(u8);
+void set_vid0_default_conf(void);
+void set_osd0_default_conf(void);
+void set_vid1_default_conf(void);
+void set_osd1_default_conf(void);
+void set_cursor_default_conf(void);
+void set_dm_default_conf(void);
+/*
+ * Function definations for 'venc' module
+ */
+
+void davincifb_ntsc_composite_config(void);
+void davincifb_ntsc_svideo_config(void);
+void davincifb_ntsc_component_config(void);
+void davincifb_pal_composite_config(void);
+void davincifb_pal_svideo_config(void);
+void davincifb_pal_component_config(void);
+
+void vpbe_davincifb_ntsc_rgb_config(void);
+void vpbe_davincifb_pal_rgb_config(void);
+void vpbe_davincifb_525p_component_config(void);
+void vpbe_davincifb_625p_component_config(void);
+
+void vpbe_enable_venc(int);
+void vpbe_enable_dacs(int);
+/*
+ * Function definations for 'dlcd' module
+ */
+void vpbe_davincifb_480p_prgb_config(void);
+void vpbe_davincifb_400p_prgb_config(void);
+void vpbe_davincifb_350p_prgb_config(void);
+void vpbe_set_display_timing(struct vpbe_fb_videomode *);
+
+void vpbe_enable_lcd(int);
+/*
+ * Following functions are not implemented
+ */
+void vpbe_davincifb_default_ycc16_config(void);
+void vpbe_davincifb_default_ycc8_config(void);
+void vpbe_davincifb_default_srgb_config(void);
+void vpbe_davincifb_default_epson_config(void);
+void vpbe_davincifb_default_casio_config(void);
+void vpbe_davincifb_default_UDISP_config(void);
+void vpbe_davincifb_default_STN_config(void);
+#endif				/*__KERNEL__*/
+
+#endif				/* End of #ifndef DAVINCI_VPBE_H */
diff --git a/Source/DirectFB/gfxdrivers/davinci/directfbrc b/Source/DirectFB/gfxdrivers/davinci/directfbrc
new file mode 100755
index 0000000..4025926
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/directfbrc
@@ -0,0 +1,56 @@
+#
+# WM/System
+wm           = sawman
+system       = devmem
+video-phys   = 87000000
+video-length = 16777216
+
+#
+# Use 640x480 by default (all visible)
+mode = 640x480
+
+#
+# Shared Memory Mount Point
+tmpfs = /tmp
+
+#
+# Disable Cursor
+no-cursor
+
+#
+# Disable Layer Initialization
+no-init-layer = 0
+
+#
+# Graphics Layer
+#init-layer        = 0
+#layer-size        = 720x576
+#layer-format      = RGB16
+#layer-stacking    = middle,upper
+#layer-bg-color    = 000000
+#layer-src-key     = 000000
+#layer-buffer-mode = backvideo
+
+#
+# Video Layer
+#init-layer        = 1
+#layer-size        = 720x576
+#layer-format      = UYVY
+#layer-stacking    = lower
+#layer-bg-color    = 0000ff
+#layer-buffer-mode = frontonly
+#layer-bg-image    = /usr/local/share/images/bg_flower.jpg
+
+#
+# Scaling
+smooth-upscale
+smooth-downscale
+
+#
+# Debug domains
+#debug = Davinci/OSD
+#debug = LiTE/Window
+#debug = SaWMan/Auto
+#debug = Core/GraphicsOps
+#debug = Core/Layers
+#debug = Core/Surface
diff --git a/Source/DirectFB/gfxdrivers/davinci/kernel-module/Makefile b/Source/DirectFB/gfxdrivers/davinci/kernel-module/Makefile
new file mode 100755
index 0000000..cb2965a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/kernel-module/Makefile
@@ -0,0 +1,34 @@
+KERNEL_VERSION = $(shell uname -r)
+KERNEL_MODLIB  = /lib/modules/$(KERNEL_VERSION)
+KERNEL_BUILD   = $(KERNEL_MODLIB)/build
+KERNEL_SOURCE  = $(KERNEL_MODLIB)/source
+
+SUB=c64x
+
+export CONFIG_DAVINCI_C64X=m
+
+ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/autoconf.h && echo yes),yes)
+  AUTOCONF_H = -include $(KERNEL_BUILD)/include/linux/autoconf.h
+endif
+
+ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/config.h && echo yes),yes)
+  CPPFLAGS += -DHAVE_LINUX_CONFIG_H
+endif
+
+CPPFLAGS += -DMODULE
+
+.PHONY: all install clean
+
+it all:
+	$(MAKE) -C $(KERNEL_BUILD) \
+		KCPPFLAGS="$(CPPFLAGS) -I$(shell pwd)/include -I$(KERNEL_BUILD)/include" \
+		SUBDIRS=$(shell pwd)/$(SUB) ARCH=arm CROSS_COMPILE=arm-v4t-linux-gnueabi- modules
+
+install: all
+
+clean:
+	$(RM) -r $(SUB)/.tmp_versions $(SUB)/Module.symvers
+	find $(SUB) -name *.o -o -name *.ko -o -name .*.cmd -o -name *.mod.* | xargs rm -f
+
+so: it
+	find $(SUB) -name "*.ko" | xargs strip -x -R .comment -R .note
diff --git a/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/Makefile b/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/Makefile
new file mode 100755
index 0000000..8d211a5
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_DAVINCI_C64X) += c64x.o
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/c64x.c b/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/c64x.c
new file mode 100755
index 0000000..bbbbfe9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/kernel-module/c64x/c64x.c
@@ -0,0 +1,507 @@
+/*
+   TI Davinci driver - C64X+ DSP Kernel Module
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Olaf Dreesen <dreesen@qarx.de>.
+
+   All rights reserved.
+
+   This module is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   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
+   General Public License for more details.
+
+   You should have received a copy of the GNU 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 <linux/version.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/fcntl.h>
+#include <linux/firmware.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+#include <linux/mm.h>
+#include <linux/page-flags.h>
+#include <linux/poll.h>
+#include <linux/proc_fs.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+#include <asm/uaccess.h>
+
+#include <linux/c64x.h>
+
+#define C64X_IRQ
+
+MODULE_LICENSE("GPL v2");
+//MODULE_LICENSE("Propietary");
+MODULE_AUTHOR("Olaf Dreesen <dreesen@qarx.de>");
+MODULE_DESCRIPTION("A little c64+ handling module.");
+
+#define C_MOD_MAJOR	400
+#define C_MOD_NUM_DEV	1
+#define C_MOD_NAME	"c64x"
+#define F_NAME		"c64x_drv.bin"
+
+#define CODE_BASE	0x00800000
+
+/* DDR2:
+ *
+ * transfer buffer
+ */
+#define R_BASE		DAVINCI_C64X_MEM
+#define R_LEN		0x02000000
+
+/* L2RAM:
+ *
+ * 0x00800000 - 0x0080FFFF C64x+
+ * 0x11800000 - 0x1180FFFF ARM
+ */
+#define D_BASE		0x11800000
+#define D_LEN		0x00010000
+
+/* L1DRAM:
+ *
+ * 0x00F04000 - 0x00F0FFFF C64x+
+ * 0x11F04000 - 0x11F0FFFF ARM
+ *
+ * Queue controls	@ 0x00F04000	(4096 Bytes)
+ */
+#define Q_BASE		0x11F04000
+#define Q_LEN		0x00001000
+
+#define HQueueDSP	(l1dram[0x00>>2])
+#define HQueueARM	(l1dram[0x04>>2])
+#define LQueueDSP	(l1dram[0x08>>2])
+#define LQueueARM	(l1dram[0x0C>>2])
+#define DSPidle		(l1dram[0x10>>2])
+
+/* IO Register needed:
+ *
+ *	0x01C40008	DSPBOOTADDR		DSP Boot Address
+ *	0x01C40010	INTGEN			Interrupt Generator
+ *	0x01C40038	CHP_SHRTSW		DSP Power
+ *	0x01C4169C	MDCFG39			DSP Module config
+ *	0x01C41A9C	MDCTL39			DSP Module control
+ */
+#define IO_BASE		0x01c40000
+#define IO_LEN		0x00010000
+
+#define DSPBOOTADDR	(mmr[0x0008>>2])
+#define INTGEN		(mmr[0x0010>>2])
+#define CHP_SHRTSW	(mmr[0x0038>>2])
+#define MDCFG39		(mmr[0x169C>>2])
+#define MDCTL39		(mmr[0x1A9C>>2])
+
+MODULE_FIRMWARE(F_NAME);
+
+static dev_t dev_major;
+static struct cdev*dev_cdev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
+static struct class*dev_class;
+#else
+static struct class_simple*dev_class;
+#endif
+
+static volatile unsigned int*mmr=0;
+static unsigned char*l2ram=0;
+static volatile unsigned int*l1dram=0;
+static volatile void*dram=0;
+static volatile c64xTaskControl*c64xctl=0;
+static volatile c64xTask*queue_l=0;
+
+#ifdef C64X_IRQ
+static int dev_irq=46;
+static DECLARE_WAIT_QUEUE_HEAD( wait_irq );
+
+/* IRQ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21)
+static irqreturn_t dev_irq_handler(int irq,void*dev_id) {
+#else
+static irqreturn_t dev_irq_handler(int irq,void*dev_id,struct pt_regs*regs) {
+#endif
+  wake_up_all( &wait_irq );
+  return IRQ_HANDLED;
+}
+#endif
+
+static u32 opencnt=0;
+
+/* char-dev */
+static int dev_open(struct inode*inode,struct file*filp) {
+  if (opencnt++==0) {
+    DSPidle=0;
+    MDCTL39=0x00000103;		/* Go! Go, go Go! */
+    while(DSPidle==0);
+  }
+  return 0;
+}
+static int dev_release(struct inode*inode,struct file*filp) {
+  if (--opencnt==0) {
+    MDCTL39=0x00000000;		/* local reset */
+  }
+  return 0;
+}
+
+static ssize_t dev_write(struct file*filp,const char __user*buffer,size_t len,loff_t*off) {
+  long ret=0;
+  unsigned long offset=*off;
+  if (offset<D_LEN) {
+    if ((offset+len)>=D_LEN) { len=D_LEN-offset; }
+//    printk(KERN_INFO "c64x+ : read got offset %08lx %08lx\n",offset,(long)len);
+    ret=len;
+    *off+=len;
+  }
+  return ret;
+}
+static ssize_t dev_read(struct file*filp,char __user*buffer,size_t len,loff_t*off) {
+  long ret=0;
+  unsigned long offset=*off;
+  if (offset<D_LEN) {
+    if ((offset+len)>=D_LEN) { len=D_LEN-offset; }
+//    printk(KERN_INFO "c64x+ : read got offset %08lx %08lx\n",offset,(long)len);
+    ret=len;
+    ret-=copy_to_user(buffer,(l2ram+offset),len);
+    *off+=len;
+  }
+  return ret;
+}
+
+static int dev_mmap(struct file * file, struct vm_area_struct * vma) {
+  size_t size=vma->vm_end-vma->vm_start;
+  if (vma->vm_pgoff) {
+    if (size!=R_LEN) return -EINVAL;
+#if defined(pgprot_writecombine)
+    vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+#else
+    vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+#endif
+    if (remap_pfn_range(vma,
+			  vma->vm_start,
+			  R_BASE>>PAGE_SHIFT,
+			  size,
+			  vma->vm_page_prot))
+      return -EAGAIN;
+  }
+  else {
+    if (size!=Q_LEN) return -EINVAL;
+    vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+    if (remap_pfn_range(vma,
+			  vma->vm_start,
+			  Q_BASE>>PAGE_SHIFT,
+			  size,
+			  vma->vm_page_prot))
+      return -EAGAIN;
+  }
+  return 0;
+}
+
+static void
+c64x_dump( const char *condition )
+{
+  static const char *state_names[] = { "DONE", "ERROR", "TODO", "RUNNING" };
+
+  uint32_t  ql_dsp = c64xctl->QL_dsp;
+  uint32_t  ql_arm = c64xctl->QL_arm;
+  uint32_t  tl_dsp = queue_l[ql_dsp & C64X_QUEUE_MASK].c64x_function;
+  uint32_t  tl_arm = queue_l[ql_arm & C64X_QUEUE_MASK].c64x_function;
+  int       dl;
+
+  dl = ql_arm - ql_dsp;
+  if (dl < 0)
+    dl += C64X_QUEUE_LENGTH;
+
+  printk( "C64X+ Queue: %s\n"
+          "   [DSP %d / %d (%s), ARM %d / %d (%s)] <- %d pending\n",
+          condition,
+          ql_dsp, (tl_dsp >> 2) & 0x3fff, state_names[tl_dsp & 3],
+          ql_arm, (tl_arm >> 2) & 0x3fff, state_names[tl_arm & 3],
+          dl );
+}
+
+static int
+c64x_wait_low( void )
+{
+  int ret;
+  int num  = 0;
+  /* Keep reference values for comparison. */
+  u32 idle = c64xctl->idlecounter;
+  u32 dsp  = c64xctl->QL_dsp;
+
+  /* Wait for equal pointers... */
+  while (dsp != c64xctl->QL_arm) {
+    /* ...each time for a 1/50 second... */
+    ret = wait_event_interruptible_timeout( wait_irq, c64xctl->QL_dsp == c64xctl->QL_arm, HZ/50 );
+    if (ret < 0)
+      return ret;
+
+    /* ...if after that 1/50 second still the same command is running... */
+    if (!ret && c64xctl->QL_dsp == dsp) {
+      /* ...and almost one second elapsed in total, or the DSP felt idle... */
+      if (++num > 42 || c64xctl->idlecounter != idle) {
+        /* ...timeout! */
+        printk( KERN_ERR "c64x+ : timeout waiting for idle queue\n" );
+        c64x_dump( "TIMEOUT!!!" );
+        return -ETIMEDOUT;
+      }
+    }
+    else {
+      /* Different command running, reset total elapsed time. */
+      num = 0;
+    }
+
+    /* Update reference values. */
+    idle = c64xctl->idlecounter;
+    dsp  = c64xctl->QL_dsp;
+  }
+
+  return 0;
+}
+
+static int dev_ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned long arg) {
+  switch (cmd) {
+  case C64X_IOCTL_RESET:
+    MDCTL39=0x00000000;		/* local reset */
+    mdelay(10);
+    DSPidle=0;
+    MDCTL39=0x00000103;
+    break;
+  case C64X_IOCTL_WAIT_LOW:
+    return c64x_wait_low();
+  default:
+    printk(KERN_INFO "c64x+ : unknown ioctl : cmd=%08x\n",cmd);
+    return -EAGAIN;
+    break;
+  }
+  return 0;
+}
+static struct file_operations dev_file_ops={
+  .owner	= THIS_MODULE,
+  .open 	= dev_open,
+  .release	= dev_release,
+  .read 	= dev_read,
+  .write	= dev_write,
+  .mmap		= dev_mmap,
+  .ioctl	= dev_ioctl,
+};
+
+/* INIT */
+static __initdata struct device dev_device = {
+  .bus_id = "c64x0",
+};
+static int __init dev_init(void) {
+  int ret=-EIO;
+  u8 *at;
+  const struct firmware*fw = NULL;
+
+  printk(KERN_INFO "c64x+ : module load\n");
+
+  if ((dram=ioremap(R_BASE,R_LEN))==0) {
+    printk(KERN_ERR "c64x+ : module couldn't get memory\n");
+    goto err0;
+  }
+  printk(KERN_INFO "c64x+ : module got memory @ %p\n",dram);
+  queue_l = dram + 0x01e00000;
+
+  /* get the 'device' memory */
+  if ((mmr=ioremap(IO_BASE,IO_LEN))==0) {
+    printk(KERN_ERR "c64x+ : module couldn't get IO-MMR\n");
+    goto err0;
+  }
+  printk(KERN_INFO "c64x+ : DSP bootaddr: %08x\n",DSPBOOTADDR);
+  printk(KERN_INFO "c64x+ : got mmr %p %08x %08x\n",mmr,MDCTL39,MDCFG39);
+
+  printk(KERN_INFO "c64x+ : switch state: %08x\n",CHP_SHRTSW);
+
+  MDCTL39=0x00000000;		/* local reset */
+  mdelay(10);
+  DSPBOOTADDR=CODE_BASE;	/* set DSP base address */
+
+//  printk(KERN_INFO "c64x+ : check0: %p %08x %08x\n",mmr,MDCTL39,MDCFG39);
+
+  /* get the 'device' memory */
+  if ((l1dram=ioremap(Q_BASE,Q_LEN))==0) {
+    printk(KERN_ERR "c64x+ : module couldn't get L1 dsp-memory\n");
+    goto err1;
+  }
+  printk(KERN_INFO "c64x+ : module got L1D @ %p\n",l1dram);
+  c64xctl = (volatile void*)l1dram;
+
+  if ((l2ram=ioremap(D_BASE,D_LEN))==0) {
+    printk(KERN_ERR "c64x+ : module couldn't get L2 dsp-memory\n");
+    goto err2;
+  }
+  printk(KERN_INFO "c64x+ : module got L2 @ %p\n",l2ram);
+
+  /* request firmware */
+  device_initialize(&dev_device);
+  ret=device_add(&dev_device);
+  if (ret) {
+       printk(KERN_ERR "c64x+ : device_add failed\n");
+       goto err3;
+  }
+  printk(KERN_INFO "c64x+ : module requesting firmware '%s'\n",F_NAME);
+  ret=request_firmware(&fw,F_NAME,&dev_device);
+  printk(KERN_INFO "c64x+ : module got fw %p\n",fw);
+  if (ret) {
+    printk(KERN_ERR "c64x+ : no firmware upload (timeout or file not found?)\n");
+    device_del(&dev_device);
+    goto err3;
+  }
+  printk(KERN_INFO "c64x+ : firmware upload %p %zd\n",fw->data,fw->size);
+  if (fw->size>32767) {
+    printk(KERN_ERR "c64x+ : firmware too big! 32767 is maximum (for now)\n");
+    release_firmware(fw);
+    device_del(&dev_device);
+    goto err3;
+  }
+  if (memcmp(fw->data+8,"C64x+DV",8)) {
+    printk(KERN_ERR "c64x+ : firmware signature missing\n");
+    release_firmware(fw);
+    device_del(&dev_device);
+    goto err3;
+  }
+  at = fw->data + fw->size;
+  while ((ulong)--at > (ulong)fw->data) {
+       if (*at == '@')
+            break;
+  }
+  if (at == fw->data) {
+    printk(KERN_ERR "c64x+ : firmware tag missing\n");
+    release_firmware(fw);
+    device_del(&dev_device);
+    goto err3;
+  }
+  printk(KERN_NOTICE "c64x+ : got firmware of length %d at %p with tag '%*s' of length %d at %p+1\n",
+         fw->size, fw->data,
+         (int)((ulong)(fw->data + fw->size) - (ulong)at - 1), at + 1,
+         (int)((ulong)(fw->data + fw->size) - (ulong)at - 1), at );
+  /* move firmware into the hardware buffer here. */
+  memcpy(l2ram,fw->data,fw->size);
+  release_firmware(fw);
+  device_del(&dev_device);
+
+#if 0
+  /* release DSP */
+  printk(KERN_INFO "c64x+ : check1: %p %08x %08x\n",mmr,MDCTL39,MDCFG39);
+  MDCTL39=0x00000103;		/* Hopefully run... */
+  printk(KERN_INFO "c64x+ : check2: %p %08x %08x\n",mmr,MDCTL39,MDCFG39);
+  printk(KERN_INFO "c64x+ : check3: %08x\n",DSPBOOTADDR);
+#endif
+
+  /* register char-dev */
+  dev_major=MKDEV(C_MOD_MAJOR,0);
+  ret=register_chrdev_region(dev_major,C_MOD_NUM_DEV,C_MOD_NAME);
+  if (ret) {
+    printk(KERN_ERR "c64x+ : can't get chrdev %d\n",C_MOD_MAJOR);
+    goto err3;
+  }
+
+  /* allocate cdev */
+  dev_cdev=cdev_alloc();
+  dev_cdev->ops=&dev_file_ops;
+  	/* cdev_init(&dev_data.cdev,&dev_file_ops); */
+  ret=cdev_add(dev_cdev,dev_major,1);
+  if (ret) {
+    printk(KERN_ERR "c64x+ : can't allocate cdev\n");
+    goto err4;
+  }
+
+#ifdef C64X_IRQ
+  /* allocate interrupt slot */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21)
+  ret=request_irq(dev_irq,dev_irq_handler,IRQF_DISABLED,C_MOD_NAME,NULL);
+#else
+  ret=request_irq(dev_irq,dev_irq_handler,SA_INTERRUPT ,C_MOD_NAME,NULL);
+#endif
+  if (ret) {
+    printk(KERN_ERR "c64x+ : can't get IRQ %d\n",dev_irq);
+    goto err5;
+  }
+#endif
+
+  /* tell sysfs/udev */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
+  dev_class=class_create(THIS_MODULE,C_MOD_NAME);
+#else
+  dev_class=class_simple_create(THIS_MODULE,C_MOD_NAME);
+#endif
+  if (IS_ERR(dev_class)) {
+    ret=PTR_ERR(dev_class);
+    printk(KERN_ERR "c64x+ : can't allocate class\n");
+    goto err6;
+  }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
+  class_device_create(dev_class,NULL,dev_major,NULL,C_MOD_NAME"%d",0);
+#else
+  class_simple_device_add(dev_class,dev_major,NULL,C_MOD_NAME"%d",0);
+#endif
+
+  printk(KERN_INFO "c64x+ : module load finished\n");
+  return 0;
+  /* error out */
+err6:
+#ifdef C64X_IRQ
+  free_irq(dev_irq,0);
+err5:
+#endif
+  cdev_del(dev_cdev);
+err4:
+  unregister_chrdev_region(dev_major,1);
+err3:
+  iounmap(l2ram);
+err2:
+  iounmap((void*)l1dram);
+err1:
+  iounmap((void*)mmr);
+err0:
+  if (dram)
+    iounmap((void*)dram);
+  return ret;
+}
+module_init(dev_init);
+
+/* EXIT */
+static void __exit dev_exit(void) {
+  /* Put the DSP into Reset */
+  MDCTL39=0x00000000;
+  /* release the DSP memory */
+  iounmap((void*)mmr);
+  iounmap((void*)l1dram);
+  iounmap(l2ram);
+  /* release all the other resources */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
+  class_device_destroy(dev_class,dev_major);
+  class_destroy(dev_class);
+#else
+  class_simple_device_remove(dev_major);
+  class_simple_destroy(dev_class);
+#endif
+#ifdef C64X_IRQ
+  free_irq(dev_irq,0);
+#endif
+  cdev_del(dev_cdev);
+  unregister_chrdev_region(dev_major,C_MOD_NUM_DEV);
+}
+module_exit(dev_exit);
+
diff --git a/Source/DirectFB/gfxdrivers/davinci/kernel-module/include/linux/c64x.h b/Source/DirectFB/gfxdrivers/davinci/kernel-module/include/linux/c64x.h
new file mode 100755
index 0000000..6117404
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/kernel-module/include/linux/c64x.h
@@ -0,0 +1,281 @@
+/*
+   TI Davinci driver - C64X+ DSP Firmware Interface
+
+   (c) Copyright 2008  directfb.org
+   (c) Copyright 2007  Telio AG
+
+   Written by Olaf Dreesen <olaf@directfb.org> and
+              Denis Oliver Kropp <dok@directfb.org>.
+
+   All rights reserved.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   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
+   General Public License for more details.
+
+   You should have received a copy of the GNU 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 __C64X_H__
+#define __C64X_H__
+
+#ifndef __KERNEL__
+#include <stdint.h>
+#endif
+
+
+#ifndef DAVINCI_C64X_MEM
+#define DAVINCI_C64X_MEM 0x8e000000
+#endif
+
+
+typedef volatile struct {
+     uint32_t  c64x_function;
+     uint32_t  c64x_arg[7];
+} c64xTask;
+
+
+#define c64x_return	c64x_arg[0]
+#define c64x_errno	c64x_arg[1]
+
+#define c64x_flags	c64x_function
+
+typedef enum {
+     C64X_STATE_DONE     = 0,
+     C64X_STATE_ERROR    = 1,
+     C64X_STATE_TODO     = 2,
+     C64X_STATE_RUNNING  = 3
+} C64XTaskState;
+
+typedef enum {
+     C64X_FLAG_RUN       = 1,
+     C64X_FLAG_TODO      = 2,
+     C64X_FLAG_INTERRUPT = 0x80000000
+} C64XTaskFlags;
+
+#define C64X_TASK_STATE(task) ((task)->c64x_flags & 3)
+
+typedef volatile struct {
+     uint32_t  QH_dsp;
+     uint32_t  QH_arm;
+     uint32_t  QL_dsp;
+     uint32_t  QL_arm;
+     uint32_t  idlecounter;
+} c64xTaskControl;
+
+#define C64X_QUEUE_LENGTH     0x4000
+#define C64X_QUEUE_MASK       0x3fff
+
+
+typedef enum {
+     C64X_BLEND_SRC_INVSRC               = 2,  /* old school fader on all channels including alpha on itself */
+     C64X_BLEND_ONE_INVSRC               = 1,  /* SrcOver using premultiplied alpha channel */
+     C64X_BLEND_ONE_INVSRC_PREMULT_SRC   = 0,  /* SrcOver doing premultiplication of source S[rgb] with S[a] */
+     C64X_BLEND_ONE_INVSRC_PREMULT_ALPHA = 3,  /* SrcOver with Alpha using premultiplied alpha channel,
+                                                  but doing premultiplication of S[rgb] with Alpha */
+} C64XBlendSubFunction;
+
+typedef enum {
+     C64X_FLUSH_WRITE_BACK,
+     C64X_FLUSH_WB_INVALIDATE,
+     C64X_FLUSH_INVALIDATE
+} C64XFlushFunction;
+
+#define C64X_IOCTL_RESET      _IO( 'c', 0 )
+#define C64X_IOCTL_WAIT_LOW   _IO( 'c', 1 )
+
+
+/* function macro */
+#define _C64XFUNC(val)             (((val)&0x3fff)<<2)
+
+
+#define C64X_NOP	                _C64XFUNC(0)
+
+/*
+void c64x_dither_argb(u32*dst_rgb, u8*dst_alpha, u32 dst_pitch, u32*src, u32 src_pitch, u32 width, u32 height);
+*/
+#define C64X_DITHER_ARGB	        _C64XFUNC(1)
+
+/*
+void c64x_fill_16(u16*dst, u32 pitch, u32 width, u32 height, u16 val);
+void c64x_fill_32(u32*dst, u32 pitch, u32 width, u32 height, u32 val);
+*/
+#define C64X_FILL_16	                _C64XFUNC(2)
+#define C64X_FILL_32	                _C64XFUNC(3)
+
+/*
+void c64x_copy_16(u16*dst, u32 dst_pitch, u16*src, u32 src_pitch, u32 width, u32 height);
+void c64x_copy_32(u32*dst, u32 dst_pitch, u32*src, u32 src_pitch, u32 width, u32 height);
+*/
+#define C64X_COPY_16	                _C64XFUNC(4)
+#define C64X_COPY_32	                _C64XFUNC(5)
+
+/*
+void c64x_blend_32(u32*dst, u32 dst_pitch, u32*src, u32 src_pitch, u32 width, u32 height, u8 alpha);
+*/
+//#define C64X_BLEND_16	                  _C64XFUNC(6)
+#define C64X_BLEND_32	                _C64XFUNC(7)
+
+/*
+void c64x_copy_keyed_16(u16*dst, u32 pitches, u16*src, u32 width, u32 height, u16 key, u16 mask);
+void c64x_copy_keyed_32(u32*dst, u32 pitches, u32*src, u32 width, u32 height, u32 key, u32 mask);
+*/
+#define C64X_COPY_KEYED_16	        _C64XFUNC(8)
+#define C64X_COPY_KEYED_32	        _C64XFUNC(9)
+
+/*
+void c64x_stretch_32(u32 *dst, u32 *src, u32 pitches, u32 dsize, u32 ssize, u32 clip2, u32 clip1);
+*/
+#define C64X_STRETCH_32_up              _C64XFUNC(10)
+#define C64X_STRETCH_32_down            _C64XFUNC(11)
+
+
+/*
+void c64x_wb_inv_range(u32 *start, u32 len, C64XFlushFunction func);
+*/
+#define C64X_WB_INV_RANGE	        _C64XFUNC(14)
+
+
+/*
+void c64x_write_back_all(void);
+*/
+#define C64X_WRITE_BACK_ALL	        _C64XFUNC(15)
+
+
+
+/*
+void c64x_load_block(s32*blockwords, u32 num_words, u32 cbp);
+*/
+#define C64X_LOAD_BLOCK                 _C64XFUNC(48)
+
+/*
+void c64x_put_idct_uyvy_16x16(u16*dst, u32 pitch, u32 flags);
+*/
+#define C64X_PUT_IDCT_UYVY_16x16        _C64XFUNC(49)
+
+/*
+void c64x_put_mc_uyvy_16x16(u16*dst, u32 pitch, u32 flags);
+*/
+#define C64X_PUT_MC_UYVY_16x16          _C64XFUNC(50)
+
+/*
+void c64x_put_sum_uyvy_16x16(u16*dst, u32 pitch, u32 flags);
+*/
+#define C64X_PUT_SUM_UYVY_16x16         _C64XFUNC(51)
+
+/*
+void c64x_dva_begin_frame(u32 pitch, u16 *current, u16 *past, u16 *future, u32 flags);
+*/
+#define C64X_DVA_BEGIN_FRAME            _C64XFUNC(52)
+
+/*
+void c64x_dva_motion(DVAMacroBlock *macroblock);
+*/
+#define C64X_DVA_MOTION_BLOCK           _C64XFUNC(53)
+
+/*
+void c64x_dva_idct(u16* dst, u32 pitch, u16* src);
+*/
+#define C64X_DVA_IDCT                   _C64XFUNC(59)
+
+
+
+/*
+ * INTERNAL - for testing
+ */
+#define C64X_FETCH_BUFFER_PITCH    32
+#define C64X_TEMP_BUFFER_PITCH     32
+#define C64X_MC_BUFFER_PITCH       16
+#define C64X_IDCT_BUFFER_PITCH     32
+
+#define C64X_FETCH_BUFFER_Y(n)     (0xf05840 + ((n) << 10))
+#define C64X_FETCH_BUFFER_U(n)     (C64X_FETCH_BUFFER_Y(n) + 18*C64X_FETCH_BUFFER_PITCH)
+#define C64X_FETCH_BUFFER_V(n)     (C64X_FETCH_BUFFER_U(n) + 16)
+
+#define C64X_FETCH_BUFFER0_Y       C64X_FETCH_BUFFER_Y(0)
+#define C64X_FETCH_BUFFER0_U       C64X_FETCH_BUFFER_U(0)
+#define C64X_FETCH_BUFFER0_V       C64X_FETCH_BUFFER_V(0)
+
+#define C64X_FETCH_BUFFER1_Y       C64X_FETCH_BUFFER_Y(1)
+#define C64X_FETCH_BUFFER1_U       C64X_FETCH_BUFFER_U(1)
+#define C64X_FETCH_BUFFER1_V       C64X_FETCH_BUFFER_V(1)
+
+#define C64X_TEMP_BUFFER_Y         0xf06040
+#define C64X_TEMP_BUFFER_U         (C64X_TEMP_BUFFER_Y + 16*C64X_TEMP_BUFFER_PITCH)
+#define C64X_TEMP_BUFFER_V         (C64X_TEMP_BUFFER_U + 8)
+
+#define C64X_MC_BUFFER_Y           0xf06440
+#define C64X_MC_BUFFER_U           (C64X_MC_BUFFER_Y + 16*C64X_MC_BUFFER_PITCH)
+#define C64X_MC_BUFFER_V           (C64X_MC_BUFFER_U + 8)
+
+#define C64X_MC_BUFFER_Y_          (C64X_MC_BUFFER_Y + C64X_MC_BUFFER_PITCH)
+#define C64X_MC_BUFFER_U_          (C64X_MC_BUFFER_U + C64X_MC_BUFFER_PITCH)
+#define C64X_MC_BUFFER_V_          (C64X_MC_BUFFER_V + C64X_MC_BUFFER_PITCH)
+
+#define C64X_IDCT_BUFFER_Y         0xf06a40
+#define C64X_IDCT_BUFFER_U         (C64X_IDCT_BUFFER_Y + 16*C64X_IDCT_BUFFER_PITCH)
+#define C64X_IDCT_BUFFER_V         (C64X_IDCT_BUFFER_U + 8)
+
+
+/*  OBSOLETE
+void c64x_dezigzag(u16*dst, u16*src);
+*/
+#define C64X_DEZIGZAG              _C64XFUNC(16)
+
+/*  OBSOLETE
+void c64x_dealternate(u16*dst, u16*src);
+*/
+#define C64X_DEALTERNATE           _C64XFUNC(17)
+
+/*
+void c64x_put_uyvy_16x16(u16*dst, u32 pitch, u8*src, u32 flags);
+*/
+#define C64X_PUT_UYVY_16x16        _C64XFUNC(18)
+
+/*
+void c64x_fetch_uyvy(u8 *dst, u8 *src, u32 spitch, u32 height);
+*/
+#define C64X_FETCH_UYVY            _C64XFUNC(19)
+
+/*
+void mc_put_o_8  (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_x_8  (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_y_8  (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_xy_8 (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+*/
+#define C64X_MC_PUT_8(avgX,avgY)   _C64XFUNC(32+(avgX)+(avgY)+(avgY))
+
+/*
+void mc_put_o_16 (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_x_16 (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_y_16 (u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+void mc_put_xy_16(u8*dst, u32 dstride, u8*ref_src, u8*ignored, u32 rstride, u32 height);
+*/
+#define C64X_MC_PUT_16(avgX,avgY)  _C64XFUNC(36+(avgX)+(avgY)+(avgY))
+
+/*
+void mc_avg_o_8  (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_x_8  (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_y_8  (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_xy_8 (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+*/
+#define C64X_MC_AVG_8(avgX,avgY)   _C64XFUNC(40+(avgX)+(avgY)+(avgY))
+
+/*
+void mc_avg_o_16 (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_x_16 (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_y_16 (u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+void mc_avg_xy_16(u8*dst, u32 dstride, u8*ref_src, u8*ref_dst, u32 rstride, u32 height);
+*/
+#define C64X_MC_AVG_16(avgX,avgY)  _C64XFUNC(44+(avgX)+(avgY)+(avgY))
+
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/davinci/patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch b/Source/DirectFB/gfxdrivers/davinci/patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch
new file mode 100755
index 0000000..60c2730
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/davinci/patches/ti-davinci-2.6.10-mvl401-fbio_set_start.patch
@@ -0,0 +1,123 @@
+Index: include/video/davincifb.h
+===================================================================
+--- include/video/davincifb.h	(revision 765)
++++ include/video/davincifb.h	(working copy)
+@@ -40,6 +40,21 @@
+ 	u_int32_t zoom_v;
+ } zoom_params_t;
+ 
++
++typedef struct fb_set_start {
++	int		offset;		/* offset from smem_start */
++	unsigned long	physical;	/* absolute physical address when offset < 0 */
++
++	u_int64_t	sync;		/* input:  target sync counter for change or 0 for no sync at all,
++					   output: sync counter of actual change or 0 if still pending */
++} fb_set_start_t;
++
++
++#ifdef _IOC_TYPECHECK
++#undef _IOC_TYPECHECK
++#define _IOC_TYPECHECK(x)     (sizeof(x))
++#endif
++
+ #define	RAM_CLUT_SIZE	256*3
+ #define FBIO_ENABLE_DISABLE_WIN		\
+ 	_IOW('F', 0x30, unsigned char)
+@@ -83,6 +98,8 @@
+ 	_IOW('F', 0x49, u_int32_t)
+ #define FBIO_SET_CURSOR         	\
+ 	_IOW('F', 0x50, struct fb_cursor)
++#define FBIO_SET_START     		\
++	_IOW('F', 0x66, struct fb_set_start)
+ 
+ /* 
+  * Defines and Constants
+Index: drivers/video/davincifb.c
+===================================================================
+--- drivers/video/davincifb.c	(revision 765)
++++ drivers/video/davincifb.c	(working copy)
+@@ -1095,6 +1095,58 @@
+ 	return 0;
+ }
+ 
++static int
++davincifb_set_start( struct fb_set_start *set, struct fb_info *info )
++{
++	struct vpbe_dm_win_info *win   = (struct vpbe_dm_win_info *) info->par;
++	unsigned long            start = 0;
++
++	/* Physical mode (absolute address)? */
++	if (set->offset < 0) {
++		start = set->physical;
++
++		/* FIXME: address checks */
++	}
++	else {
++		/* Offset mode (from frame buffer device base). */
++		if (set->offset + info->var.yres * info->fix.line_length >= win->fb_size)
++			return -EFAULT;
++
++		start = win->fb_base_phys + set->offset;
++	}
++
++	/* Set on explicit sync count? */
++	if (set->sync > 1) {
++		if (set->sync <= dm->vsync_cnt) {
++			set_sdram_params( info->fix.id, start, info->fix.line_length );
++			win->sdram_address = start;
++
++			set->sync = dm->vsync_cnt;
++		}
++		else {
++			/* FIXME: No queue yet. */
++			win->sdram_address = start;
++
++			set->sync = 0;
++		}
++	}
++	/* Set on next sync? */
++	else if (set->sync) {
++		win->sdram_address = start;
++
++		set->sync = 0;
++	}
++	/* Set now! */
++	else {
++		set_sdram_params( info->fix.id, start, info->fix.line_length );
++		win->sdram_address = start;
++
++		set->sync = dm->vsync_cnt;
++	}
++
++	return 0;
++}
++
+ /*
+  * davincifb_ioctl - handler for private ioctls.
+  */
+@@ -1105,6 +1157,7 @@
+ 	struct vpbe_dm_win_info *w = (struct vpbe_dm_win_info *)info->par;
+ 	void __user *argp = (void __user *)arg;
+ 	struct fb_fillrect rect;
++	struct fb_set_start set_start;
+ 	zoom_params_t zoom;
+ 	int retval = 0;
+ 	long std = 0;
+@@ -1414,6 +1467,16 @@
+ 			return -EINVAL;
+ 		break;
+ 
++	case FBIO_SET_START:
++		if (copy_from_user(&set_start, argp, sizeof(set_start)))
++			return -EFAULT;
++		retval = davincifb_set_start( &set_start, &w->info );
++		if (retval)
++			return retval;
++		if (copy_to_user(argp, &set_start, sizeof(set_start)))
++			return -EFAULT;
++		break;
++
+ 	default:
+ 		retval = -EINVAL;
+ 		break;
diff --git a/Source/DirectFB/gfxdrivers/ep9x/Makefile.am b/Source/DirectFB/gfxdrivers/ep9x/Makefile.am
new file mode 100755
index 0000000..afbdfb1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ep9x/Makefile.am
@@ -0,0 +1,33 @@
+## Makefile.am for DirectFB/src/core/gfxcards/ep9x
+
+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
+
+ep9xdir = $(MODULEDIR)/gfxdrivers
+ep9x_LTLIBRARIES = libdirectfb_ep9x.la
+
+if BUILD_STATIC
+ep9x_DATA = $(e9x_LTLIBRARIES:.la=.o)
+endif
+
+libdirectfb_ep9x_la_SOURCES =   \
+        ep9x.c  \
+        ep9x.h 
+
+libdirectfb_ep9x_la_LDFLAGS = \
+        -module	                \
+        -avoid-version          \
+        $(DFB_LDFLAGS)
+
+libdirectfb_ep9x_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/ep9x/Makefile.in b/Source/DirectFB/gfxdrivers/ep9x/Makefile.in
new file mode 100755
index 0000000..9ea0945
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ep9x/Makefile.in
@@ -0,0 +1,595 @@
+# 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/ep9x
+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)$(ep9xdir)" "$(DESTDIR)$(ep9xdir)"
+ep9xLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(ep9x_LTLIBRARIES)
+libdirectfb_ep9x_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_ep9x_la_OBJECTS = ep9x.lo
+libdirectfb_ep9x_la_OBJECTS = $(am_libdirectfb_ep9x_la_OBJECTS)
+libdirectfb_ep9x_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_ep9x_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_ep9x_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_ep9x_la_SOURCES)
+ep9xDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(ep9x_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
+
+ep9xdir = $(MODULEDIR)/gfxdrivers
+ep9x_LTLIBRARIES = libdirectfb_ep9x.la
+@BUILD_STATIC_TRUE@ep9x_DATA = $(e9x_LTLIBRARIES:.la=.o)
+libdirectfb_ep9x_la_SOURCES = \
+        ep9x.c  \
+        ep9x.h 
+
+libdirectfb_ep9x_la_LDFLAGS = \
+        -module	                \
+        -avoid-version          \
+        $(DFB_LDFLAGS)
+
+libdirectfb_ep9x_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/ep9x/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/ep9x/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-ep9xLTLIBRARIES: $(ep9x_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(ep9xdir)" || $(MKDIR_P) "$(DESTDIR)$(ep9xdir)"
+	@list='$(ep9x_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ep9xLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(ep9xdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ep9xLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(ep9xdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-ep9xLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ep9x_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(ep9xdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(ep9xdir)/$$p"; \
+	done
+
+clean-ep9xLTLIBRARIES:
+	-test -z "$(ep9x_LTLIBRARIES)" || rm -f $(ep9x_LTLIBRARIES)
+	@list='$(ep9x_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_ep9x.la: $(libdirectfb_ep9x_la_OBJECTS) $(libdirectfb_ep9x_la_DEPENDENCIES) 
+	$(libdirectfb_ep9x_la_LINK) -rpath $(ep9xdir) $(libdirectfb_ep9x_la_OBJECTS) $(libdirectfb_ep9x_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ep9x.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-ep9xDATA: $(ep9x_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(ep9xdir)" || $(MKDIR_P) "$(DESTDIR)$(ep9xdir)"
+	@list='$(ep9x_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(ep9xDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ep9xdir)/$$f'"; \
+	  $(ep9xDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ep9xdir)/$$f"; \
+	done
+
+uninstall-ep9xDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ep9x_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(ep9xdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(ep9xdir)/$$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)$(ep9xdir)" "$(DESTDIR)$(ep9xdir)"; 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-ep9xLTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-ep9xDATA install-ep9xLTLIBRARIES
+
+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-ep9xDATA uninstall-ep9xLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-ep9xLTLIBRARIES clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-ep9xDATA \
+	install-ep9xLTLIBRARIES install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-ep9xDATA uninstall-ep9xLTLIBRARIES
+
+%.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/ep9x/ep9x.c b/Source/DirectFB/gfxdrivers/ep9x/ep9x.c
new file mode 100755
index 0000000..3fcfade
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ep9x/ep9x.c
@@ -0,0 +1,474 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   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 <dfb_types.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_buffer.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( ep9x )
+
+#include "ep9x.h"
+
+
+D_DEBUG_DOMAIN( ep9x, "ep9x", "Cirrus Logic EP9xx" );
+
+
+#define EP9X_SUPPORTED_DRAWINGFLAGS (DSDRAW_NOFX)
+
+
+#define EP9X_SUPPORTED_DRAWINGFUNCTIONS (DFXL_FILLRECTANGLE | DFXL_DRAWLINE)
+
+#define EP9X_SUPPORTED_BLITTINGFLAGS (DSBLIT_NOFX)
+
+#define EP9X_SUPPORTED_BLITTINGFUNCTIONS  (DFXL_NONE)
+
+
+static inline void 
+ep9x_set_destination( EP9XDriverData *ep9xdrv,
+                      EP9XDeviceData *ep9xdev,
+                      CardState        *state )
+{
+     CoreSurfaceBuffer *buffer = state->dst.buffer;
+
+     if (ep9xdev->smf_destination)
+          return;
+
+     ep9xdev->destaddr =  state->dst.offset;
+
+     ep9xdev->destpitch = state->dst.pitch;
+
+     switch (buffer->format) {
+          case DSPF_RGB16:
+               ep9xdev->pixeldepth = 2;
+               ep9xdev->pixelformat = DSPF_RGB16;
+               break;
+          case DSPF_RGB24:
+               ep9xdev->pixeldepth = 3;
+               ep9xdev->pixelformat = DSPF_RGB24;
+               break;
+          case DSPF_RGB32:
+               ep9xdev->pixeldepth = 3;
+               ep9xdev->pixelformat = DSPF_RGB32;
+               break;
+          default:
+               D_BUG("unexpected pixelformat~");
+     }
+
+     ep9xdev->smf_destination = 1;
+}
+
+static inline void
+ep9x_set_src(EP9XDriverData *ep9xdrv,
+             EP9XDeviceData *ep9xdev,
+             CardState      *state)
+{
+
+     if (ep9xdev->smf_source)
+          return;
+
+     if ( state->src.phys ) {
+          D_DEBUG_AT(ep9x,"%s:video data is stored in fb and offset is %lx\n",__FUNCTION__,state->src.offset);
+          ep9xdev->srcaddr = state->src.offset;
+          ep9xdev->fb_store = true;
+     }
+     else if ( state->src.addr ) {
+          D_DEBUG_AT( ep9x,"%s:video data is stored in system\n",__FUNCTION__);
+          ep9xdev->srcaddr = (unsigned long) state->src.addr;
+          ep9xdev->fb_store = false;
+     }
+     else
+          D_ERROR("NOT vaild addr\n");
+
+     ep9xdev->srcpitch = state->src.pitch;
+
+     ep9xdev->smf_source = 1;
+
+}
+
+static inline void ep9x_set_color( EP9XDriverData *ep9xdrv,
+                                   EP9XDeviceData *ep9xdev,
+                                   CardState        *state )
+{
+     CoreSurfaceBuffer *buffer = state->dst.buffer;
+
+     if (ep9xdev->smf_color)
+          return;
+
+     switch (buffer->format) {
+          case DSPF_RGB16:
+               ep9xdev->fill_color = PIXEL_RGB16( state->color.r,
+                                                  state->color.g,
+                                                  state->color.b );
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               ep9xdev->fill_color = PIXEL_RGB32( state->color.r,
+                                                  state->color.g,
+                                                  state->color.b );
+               break;
+
+          default:
+               D_ERROR( "unexpected pixelformat!" );
+     }
+
+     ep9xdev->smf_color = 1;
+
+}
+
+static inline void ep9x_set_clip( EP9XDriverData *ep9xdrv,
+                                  EP9XDeviceData *ep9xdev,
+                                  DFBRegion      *clip )
+{
+     if (ep9xdev->smf_clip)
+          return;
+
+     ep9xdev->clip.x1 = clip->x1;
+     ep9xdev->clip.y1 = clip->y1;
+     ep9xdev->clip.x2 = clip->x2 + 1;
+     ep9xdev->clip.y2 = clip->y2 + 1;
+
+     ep9xdev->smf_clip = 1;
+}
+
+
+static void
+ep9xCheckState(void *drv, void *dev,
+               CardState *state, DFBAccelerationMask accel )
+{
+     switch (state->destination->config.format) {
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               break;
+          default:
+               return;
+     }
+
+     if (!(accel & ~EP9X_SUPPORTED_DRAWINGFUNCTIONS) &&
+         !(state->drawingflags & ~EP9X_SUPPORTED_DRAWINGFLAGS))
+          state->accel |= EP9X_SUPPORTED_DRAWINGFUNCTIONS;
+
+
+     if (!(accel & ~EP9X_SUPPORTED_BLITTINGFUNCTIONS) &&
+         !(state->blittingflags & ~EP9X_SUPPORTED_BLITTINGFLAGS)) {
+          if (state->source->config.format == state->destination->config.format)
+               state->accel |= EP9X_SUPPORTED_BLITTINGFUNCTIONS;
+     }
+
+}
+
+static void
+ep9xSetState( void *drv, void *dev,
+              GraphicsDeviceFuncs *funcs,
+              CardState *state, DFBAccelerationMask accel )
+{
+     EP9XDriverData *ep9xdrv = (EP9XDriverData *) drv;
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData *) dev;
+
+     if (state->modified & SMF_SOURCE && state->source )
+          ep9xdev->smf_source = 0;
+
+     if (state->modified & SMF_DESTINATION)
+          ep9xdev->smf_destination = ep9xdev->smf_color = 0;
+
+     if (state->modified & SMF_COLOR)
+          ep9xdev->smf_color = 0;
+
+     if (state->modified & SMF_CLIP)
+          ep9xdev->smf_clip = 0;
+
+     ep9x_set_destination( ep9xdrv, ep9xdev, state);
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+               ep9x_set_color( ep9xdrv, ep9xdev, state );
+               state->set |= DFXL_FILLRECTANGLE;
+               break;
+          case DFXL_DRAWLINE:
+               ep9x_set_color( ep9xdrv, ep9xdev, state );
+               state->set |= DFXL_DRAWLINE ;
+               break;
+
+          case DFXL_BLIT:
+               ep9x_set_src( ep9xdrv, ep9xdev, state );
+               state->set |= DFXL_BLIT;
+               break;
+          default:
+               D_ERROR( "unexpected drawing/blitting function" );
+               break;
+
+     }
+
+     if (state->modified & SMF_CLIP)
+          ep9x_set_clip( ep9xdrv, ep9xdev, &state->clip);
+
+     state->modified = 0;
+
+}
+
+static void
+ep9xFlushTextureCache(void *drv, void *dev)
+{
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData *) dev;
+
+     ep9xdev->srcaddr = ep9xdev->destaddr = 0;
+     ep9xdev->srcpitch = ep9xdev->destpitch = 0;
+     ep9xdev->fb_store = false;
+
+}
+
+static DFBResult
+ep9xEngineSync(void *drv, void *dev)
+{
+
+     return DFB_OK;
+}
+
+static void
+ep9xEngineReset(void *drv, void *dev)
+{
+     memset((void*)dfb_system_video_memory_virtual(0),0,dfb_gfxcard_memory_length());
+}
+
+
+static bool ep9xFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     EP9XDriverData *ep9xdrv = (EP9XDriverData *) drv;
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData *) dev;
+     struct ep9x_fill fill;
+     D_DEBUG_AT(ep9x,"%s:enter\n",__FUNCTION__);
+
+     fill.dx = rect->x;
+     fill.dy = rect->y;
+     fill.width = rect->w;
+     fill.height = rect->h;
+     fill.color = ep9xdev->fill_color;
+     ioctl(ep9xdrv->dfb_fbdev->fd,FBIO_EP9X_FILL, &fill);
+     D_DEBUG_AT(ep9x,"%s:exit\n",__FUNCTION__);
+     return true;
+}
+
+static bool ep9xDrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     EP9XDriverData *ep9xdrv = (EP9XDriverData *) drv;
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData *) dev;
+
+     struct ep9x_line drawline;
+     D_DEBUG_AT(ep9x,"%s:enter\n",__FUNCTION__);
+     drawline.flags = 0;
+     drawline.x1 = line->x1;
+     drawline.x2 = line->x2;
+     drawline.y1 = line->y1;
+     drawline.y2 = line->y2;
+     drawline.fgcolor = ep9xdev->fill_color;
+     drawline.bgcolor = 0;
+     drawline.pattern = 0;
+
+     ioctl(ep9xdrv->dfb_fbdev->fd,FBIO_EP9X_LINE, &drawline);
+     D_DEBUG_AT(ep9x,"%s:exit\n",__FUNCTION__);
+     return true;
+}
+
+
+static bool
+ep9xBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+
+     EP9XDriverData *ep9xdrv = (EP9XDriverData *) drv;
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData *) dev;
+     struct fb_image image;
+
+     D_DEBUG_AT(ep9x,"%s:enter\n",__FUNCTION__);
+
+     if (!(ep9xdev->clip.x1 <= dx) || !(ep9xdev->clip.y1 <= dy) || 
+         !( ep9xdev->clip.x2 >= (dx + rect->w - 1) ) || !( ep9xdev->clip.y2 >= (dy + rect->h - 1) )) {
+          D_ERROR("the blit region is not vaild\n");
+          return false;
+     }
+
+     image.dx = ep9xdev->destaddr + dx;
+     image.dy = dy;
+     image.width = rect->w; 
+     image.height = rect->h;
+     image.depth = ep9xdev->pixeldepth;
+     if ( ep9xdev->fb_store == true )
+          image.data = (void*)ep9xdev->fb_addr + ep9xdev->srcaddr + DFB_BYTES_PER_LINE( ep9xdev->pixelformat,rect->x ) + (rect->y * ep9xdev->srcpitch );
+     else
+          image.data = (void*)ep9xdev->srcaddr + DFB_BYTES_PER_LINE( ep9xdev->pixelformat, rect->x ) + (rect->y * ep9xdev->srcpitch );
+
+     ioctl(ep9xdrv->dfb_fbdev->fd,FBIO_EP9X_BLIT,&image);
+
+     D_DEBUG_AT(ep9x,"%s:exit\n",__FUNCTION__);
+
+     return true;   
+}
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_EP9X:          /* cirrus ep93xx serials */
+               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,
+               "ep9x 07/07A/12/15/15A Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "cirruslogic" );
+
+     snprintf( info->url,
+               DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+               "http://arm.cirrus.com" );
+
+     snprintf( info->license,
+               DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+               "LGPL" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+
+     info->driver_data_size = sizeof (EP9XDriverData);
+     info->device_data_size = sizeof (EP9XDeviceData);
+
+
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+
+     EP9XDriverData *ep9xdrv = (EP9XDriverData*) driver_data;    
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData*) device_data;
+
+     ep9xdrv->dfb_fbdev = dfb_system_data();
+
+     ioctl(ep9xdrv->dfb_fbdev->fd,FBIO_EP9X_GET_ADDR,&(ep9xdev->fb_addr));
+
+     funcs->CheckState    = ep9xCheckState;
+     funcs->SetState      = ep9xSetState;
+     funcs->EngineSync    = ep9xEngineSync;
+     funcs->EngineReset   = ep9xEngineReset;
+     funcs->FlushTextureCache  = ep9xFlushTextureCache;
+
+     funcs->FillRectangle = ep9xFillRectangle;
+     funcs->DrawLine          = ep9xDrawLine;
+     funcs->Blit          = ep9xBlit;
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+
+     EP9XDeviceData *ep9xdev = (EP9XDeviceData*) device_data;
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "ep9x" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "cirruslogic" );
+
+     device_info->caps.flags    = 0;
+     device_info->caps.accel    = EP9X_SUPPORTED_DRAWINGFUNCTIONS |
+                                  EP9X_SUPPORTED_BLITTINGFUNCTIONS;
+
+     device_info->caps.drawing  = EP9X_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = EP9X_SUPPORTED_BLITTINGFLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 32 * 4;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     ep9xdev->fb_store = false;
+
+
+     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 )
+{
+
+     EP9XDriverData *ep9xdrv = (EP9XDriverData*) driver_data;
+
+     ep9xdrv->dfb_fbdev = NULL;
+}
diff --git a/Source/DirectFB/gfxdrivers/ep9x/ep9x.h b/Source/DirectFB/gfxdrivers/ep9x/ep9x.h
new file mode 100755
index 0000000..0857240
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/ep9x/ep9x.h
@@ -0,0 +1,87 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by BoLiu <Bo@cirrus.com>
+
+   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 __EP9X_H__
+#define __EP9X_H__
+#include <dfb_types.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+/*
+ * The following are the IOCTLs that can be sent to the EP93xx frame buffer
+ * device.
+ */
+#define FBIO_EP9X_GET_CAPS    0x000046c0
+#define FBIO_EP9X_CURSOR      0x000046c1
+#define FBIO_EP9X_LINE        0x000046c2
+#define FBIO_EP9X_FILL        0x000046c3
+#define FBIO_EP9X_BLIT        0x000046c4
+#define FBIO_EP9X_COPY        0x000046c5
+#define FBIO_EP9X_GET_ADDR    0x000046c6
+
+struct ep9x_line {
+    __u32 flags;
+    __s32 x1;
+    __s32 y1;
+    __s32 x2;
+    __s32 y2;
+    __u32 fgcolor;
+    __u32 bgcolor;      // Only used if LINE_BACKGROUND is set
+    __u32 pattern;      // Only used if LINE_PATTERN is set
+};
+
+/*
+ * ioctl(fd, FBIO_EP93XX_FILL, ep93xx_fill *)
+ *
+ * Fills from dx to (dx + width - 1), and from dy to (dy + height - 1).
+ */
+struct ep9x_fill {
+    __u32 dx;
+    __u32 dy;
+    __u32 width;
+    __u32 height;
+    __u32 color;
+};
+
+
+typedef struct {
+     FBDev	*dfb_fbdev;
+} EP9XDriverData;
+
+typedef struct {
+	unsigned long fb_addr;
+	u32 fill_color;
+	u32 pixelformat;
+	u8  pixeldepth;
+	bool fb_store;
+	unsigned long srcaddr,destaddr,srcpitch,destpitch;
+	DFBRegion clip;
+     /* state validation */
+        int smf_source;
+        int smf_destination;
+        int smf_color;
+	int smf_clip;
+} EP9XDeviceData;
+
+
+#endif /*__EDB93XX_H__*/
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 <config.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#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 <stdio.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+#include <core/gfxcard.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <GL/glx.h>
+
+#include <x11/x11.h>
+
+#include "gl_2d.h"
+#include "gl_gfxdriver.h"
+
+D_DEBUG_DOMAIN( GL_Driver, "GL/Driver", "GL graphics driver for X11" );
+
+#include <core/graphics_driver.h>
+
+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 <GL/glx.h>
+
+
+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
diff --git a/Source/DirectFB/gfxdrivers/i810/Makefile.am b/Source/DirectFB/gfxdrivers/i810/Makefile.am
new file mode 100755
index 0000000..76e3d95
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i810/Makefile.am
@@ -0,0 +1,35 @@
+## Makefile.am for DirectFB/src/core/gfxcards/i810
+
+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
+
+i810_LTLIBRARIES = libdirectfb_i810.la
+
+if BUILD_STATIC
+i810_DATA = $(i810_LTLIBRARIES:.la=.o)
+endif
+
+i810dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_i810_la_SOURCES =	\
+	i810.c	\
+	i810.h \
+	i810_overlay.c
+
+libdirectfb_i810_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_i810_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/i810/Makefile.in b/Source/DirectFB/gfxdrivers/i810/Makefile.in
new file mode 100755
index 0000000..f118862
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i810/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/i810
+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)$(i810dir)" "$(DESTDIR)$(i810dir)"
+i810LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(i810_LTLIBRARIES)
+libdirectfb_i810_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_i810_la_OBJECTS = i810.lo i810_overlay.lo
+libdirectfb_i810_la_OBJECTS = $(am_libdirectfb_i810_la_OBJECTS)
+libdirectfb_i810_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_i810_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_i810_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_i810_la_SOURCES)
+i810DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(i810_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
+
+i810_LTLIBRARIES = libdirectfb_i810.la
+@BUILD_STATIC_TRUE@i810_DATA = $(i810_LTLIBRARIES:.la=.o)
+i810dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_i810_la_SOURCES = \
+	i810.c	\
+	i810.h \
+	i810_overlay.c
+
+libdirectfb_i810_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_i810_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/i810/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/i810/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-i810LTLIBRARIES: $(i810_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(i810dir)" || $(MKDIR_P) "$(DESTDIR)$(i810dir)"
+	@list='$(i810_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(i810LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(i810dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(i810LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(i810dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-i810LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(i810_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(i810dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(i810dir)/$$p"; \
+	done
+
+clean-i810LTLIBRARIES:
+	-test -z "$(i810_LTLIBRARIES)" || rm -f $(i810_LTLIBRARIES)
+	@list='$(i810_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_i810.la: $(libdirectfb_i810_la_OBJECTS) $(libdirectfb_i810_la_DEPENDENCIES) 
+	$(libdirectfb_i810_la_LINK) -rpath $(i810dir) $(libdirectfb_i810_la_OBJECTS) $(libdirectfb_i810_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810_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-i810DATA: $(i810_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(i810dir)" || $(MKDIR_P) "$(DESTDIR)$(i810dir)"
+	@list='$(i810_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(i810DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(i810dir)/$$f'"; \
+	  $(i810DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(i810dir)/$$f"; \
+	done
+
+uninstall-i810DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(i810_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(i810dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(i810dir)/$$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)$(i810dir)" "$(DESTDIR)$(i810dir)"; 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-i810LTLIBRARIES 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-i810DATA install-i810LTLIBRARIES
+
+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-i810DATA uninstall-i810LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-i810LTLIBRARIES 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-i810DATA install-i810LTLIBRARIES \
+	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-i810DATA \
+	uninstall-i810LTLIBRARIES
+
+%.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/i810/i810.c b/Source/DirectFB/gfxdrivers/i810/i810.c
new file mode 100755
index 0000000..0c3d0ff
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i810/i810.c
@@ -0,0 +1,1044 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by 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 <dfb_types.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 i810 is useless */
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( i810 )
+
+#include "i810.h"
+
+
+#define TIMER_LOOP     1000000000
+#define BUFFER_PADDING 2
+#define MMIO_SIZE      512 * 1024
+
+#define I810_SUPPORTED_DRAWINGFLAGS (DSDRAW_NOFX)
+
+#define I810_SUPPORTED_DRAWINGFUNCTIONS   \
+                 (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_FILLTRIANGLE)
+
+#define I810_SUPPORTED_BLITTINGFLAGS   \
+                 (DSBLIT_SRC_COLORKEY | DSBLIT_DST_COLORKEY)
+
+#define I810_SUPPORTED_BLITTINGFUNCTIONS  \
+                 (DFXL_BLIT)
+
+static void
+i810_lring_enable(I810DriverData *i810drv, u32 mode)
+{
+	u32 tmp;
+
+	tmp = i810_readl(i810drv->mmio_base, LRING + 12);
+	tmp = (!mode) ? tmp & ~1 : tmp | 1;
+
+	i810_writel(i810drv->mmio_base, LRING + 12, tmp);
+}
+
+
+static inline void
+i810_wait_for_blit_idle(I810DriverData *i810drv,
+			I810DeviceData *i810dev )
+{
+	u32 count = 0;
+		
+	if (i810dev != NULL)
+		i810dev->idle_calls++;
+	
+	while ((i810_readw(i810drv->mmio_base, INSTDONE) & 0x7b) != 0x7b &&
+	       count++ < TIMER_LOOP) {
+		if (i810dev != NULL)
+			i810dev->idle_waitcycles++;
+	}
+	
+	if (count >= TIMER_LOOP) {
+		if (i810dev != NULL)
+			i810dev->idle_timeoutsum++;
+		D_BUG("warning: idle timeout exceeded");
+	}
+}
+
+static void
+i810_init_ringbuffer(I810DriverData *i810drv,
+		     I810DeviceData *i810dev )
+{
+	u32 tmp1, tmp2;
+	
+	i810_wait_for_blit_idle(i810drv, i810dev);
+	i810_lring_enable(i810drv, 0);
+
+	i810_writel(i810drv->mmio_base, LRING, 0);
+	i810_writel(i810drv->mmio_base, LRING + 4, 0);
+	i810dev->cur_tail = 0;
+
+	tmp2 = i810_readl(i810drv->mmio_base, LRING + 8) & ~RBUFFER_START_MASK;
+	tmp1 = i810dev->lring_bind.pg_start * 4096;
+	i810_writel(i810drv->mmio_base, LRING + 8, tmp2 | tmp1);
+
+	tmp1 = i810_readl(i810drv->mmio_base, LRING + 12);
+	tmp1 &= ~RBUFFER_SIZE_MASK;
+	tmp2 = (RINGBUFFER_SIZE - 4096) & RBUFFER_SIZE_MASK;
+	i810_writel(i810drv->mmio_base, LRING + 12, tmp1 | tmp2);
+	i810_lring_enable(i810drv, 1);
+}
+
+static inline int
+i810_wait_for_space(I810DriverData *i810drv,
+		    I810DeviceData *i810dev,
+		    u32             space   )
+{
+	u32 head, count = TIMER_LOOP, tail, tries = 0;
+
+	i810dev->waitfifo_calls++;
+
+	tail = i810dev->cur_tail;
+
+	space += BUFFER_PADDING;
+	space <<= 2;
+	i810dev->waitfifo_sum += space;
+
+	while (count--) {
+		i810dev->fifo_waitcycles++;
+		head = i810_readl(i810drv->mmio_base, LRING + 4) & RBUFFER_HEAD_MASK;	
+		if ((tail == head) ||
+		    (tail > head && (RINGBUFFER_SIZE - tail + head) >= space) ||
+		    (tail < head && (head - tail) >= space)) {
+			if (!tries)
+				i810dev->fifo_cache_hits++;
+			return 0;	
+		}
+		tries++;
+	}
+	D_BUG("warning: buffer space timout error");
+	return 1;
+}
+
+
+static void
+i810FlushTextureCache(void *drv, void *dev)
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+
+	if (BEGIN_LRING(i810drv, i810dev, 2)) return;
+
+	PUT_LRING(PARSER | FLUSH);
+	PUT_LRING(NOP);
+
+	END_LRING(i810drv);
+}
+
+static DFBResult
+i810EngineSync(void *drv, void *dev)
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+
+	i810_wait_for_blit_idle(i810drv, i810dev);
+
+    return DFB_OK;
+}
+
+/*
+ * Set State routines
+ */
+static inline void
+i810_set_src(I810DriverData *i810drv,
+	     I810DeviceData *i810dev,
+	     CardState      *state)
+{
+	if (i810dev->i_src)
+		return;
+	i810dev->srcaddr = dfb_gfxcard_memory_physical((CoreGraphicsDevice *) i810dev,
+						       state->src.offset);
+	i810dev->srcpitch = state->src.pitch;
+
+	i810dev->i_src = 1;
+}
+
+static inline void
+i810_set_dest(I810DriverData *i810drv,
+	      I810DeviceData *i810dev,
+	      CardState      *state)
+{
+	CoreSurface   *destination = state->destination;
+	
+	if (i810dev->i_dst)
+		return;
+	i810dev->destaddr = dfb_gfxcard_memory_physical((CoreGraphicsDevice *) i810dev,
+							state->dst.offset);
+	i810dev->destpitch = state->dst.pitch;
+	
+	switch (destination->config.format) {
+	case DSPF_LUT8:
+		i810dev->pixeldepth = 1;
+		i810dev->blit_color = BPP8;
+		break;
+	case DSPF_ARGB1555:
+		i810dev->pixeldepth = 2;
+		i810dev->blit_color = BPP16;
+		break;
+	case DSPF_RGB16:
+		i810dev->pixeldepth = 2;
+		i810dev->blit_color = BPP16;
+		break;
+	case DSPF_RGB24:
+		i810dev->pixeldepth = 3;
+		i810dev->blit_color = BPP24;
+		break;
+	default:
+		D_BUG("unexpected pixelformat~");
+	}
+	i810dev->i_dst = 1;
+}
+					
+static inline void
+i810_set_colorkey(I810DriverData *i810drv,
+		  I810DeviceData *i810dev,
+		  CardState      *state)
+{
+	if (i810dev->i_colorkey)
+		return;
+
+	i810dev->colorkey_bit = 0;
+	if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+		i810dev->colorkey_bit = 1 << 8;
+		i810dev->colorkey = state->src_colorkey;
+	}
+	else {
+		i810dev->colorkey_bit = 7 << 8;
+		i810dev->colorkey = state->dst_colorkey;
+	}
+	
+	i810dev->i_colorkey = 1;
+}
+
+static inline void
+i810_set_color(I810DriverData *i810drv,
+	       I810DeviceData *i810dev,
+	       CardState      *state)
+{
+	if (i810dev->i_color)
+		return;
+
+	switch (state->destination->config.format) {
+	case DSPF_LUT8:
+		i810dev->color_value = state->color_index;
+		break;
+	case DSPF_ARGB1555:
+		i810dev->color_value = PIXEL_ARGB1555(state->color.a,
+                                                      state->color.r,
+						      state->color.g,
+						      state->color.b);
+		break;
+	case DSPF_RGB16:
+		i810dev->color_value = PIXEL_RGB16(state->color.r,
+						   state->color.g,
+						   state->color.b);
+		break;
+	case DSPF_RGB24:
+		i810dev->color_value = PIXEL_RGB32(state->color.r,
+						   state->color.g,
+						   state->color.b);
+		break;
+	default:
+		D_BUG("unexpected pixelformat~");
+	}
+	i810dev->i_color = 1;
+}
+
+static inline void
+i810_set_clip(I810DriverData *i810drv,
+	      I810DeviceData *i810dev,
+	      DFBRegion      *clip     )
+{
+	if (i810dev->i_clip)
+		return;
+
+	i810dev->clip_x1 = clip->x1;
+	i810dev->clip_x2 = clip->x2 + 1;
+	i810dev->clip_y1 = clip->y1;
+	i810dev->clip_y2 = clip->y2 + 1;
+
+	i810dev->i_clip = 1;
+}
+	
+static void
+i810CheckState(void *drv, void *dev,
+	       CardState *state, DFBAccelerationMask accel )
+{
+	switch (state->destination->config.format) {
+	case DSPF_LUT8:
+	case DSPF_ARGB1555:
+	case DSPF_RGB16:
+	case DSPF_RGB24:
+		break;
+	default:
+		return;
+	}
+
+	if (!(accel & ~I810_SUPPORTED_DRAWINGFUNCTIONS) &&
+	    !(state->drawingflags & ~I810_SUPPORTED_DRAWINGFLAGS))
+		state->accel |= I810_SUPPORTED_DRAWINGFUNCTIONS;
+	
+	if (!(accel & ~I810_SUPPORTED_BLITTINGFUNCTIONS) &&
+	    !(state->blittingflags & ~I810_SUPPORTED_BLITTINGFLAGS)) {
+		if (state->source->config.format == state->destination->config.format)
+			state->accel |= I810_SUPPORTED_BLITTINGFUNCTIONS;
+	}
+}
+
+static void
+i810SetState( void *drv, void *dev,
+	      GraphicsDeviceFuncs *funcs,
+	      CardState *state, DFBAccelerationMask accel )
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+
+	if (state->mod_hw) {
+		if ((state->mod_hw & SMF_SOURCE) && state->source)
+			i810dev->i_src = 0;
+		if (state->mod_hw & SMF_DESTINATION)
+			i810dev->i_dst = 0;
+		if (state->mod_hw & SMF_COLOR)
+			i810dev->i_color = 0;
+		if (state->mod_hw & SMF_CLIP)
+			i810dev->i_clip = 0;
+		if (state->mod_hw & SMF_SRC_COLORKEY ||
+		    state->mod_hw & SMF_DST_COLORKEY) {
+			i810dev->i_colorkey = 0;
+		}
+	}
+
+	switch (accel) {
+	case DFXL_DRAWRECTANGLE:
+	case DFXL_FILLRECTANGLE:
+	case DFXL_FILLTRIANGLE:
+		i810_set_dest(i810drv, i810dev, state);
+		i810_set_color(i810drv, i810dev, state);
+		i810_set_clip(i810drv, i810dev, &state->clip);
+		state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE;
+		break;
+	case DFXL_BLIT:
+		i810_set_src( i810drv, i810dev, state);
+		i810_set_dest(i810drv, i810dev, state);
+		i810_set_color(i810drv, i810dev, state);
+		i810_set_clip(i810drv, i810dev, &state->clip);
+		if (state->blittingflags & DSBLIT_SRC_COLORKEY ||
+		    state->blittingflags & DSBLIT_DST_COLORKEY)
+			i810_set_colorkey(i810drv, i810dev, state);
+		state->set |= DFXL_BLIT;
+		break;
+	default:
+		D_BUG("unexpected drawing/blitting function");
+	}
+	state->mod_hw = 0;
+}
+
+static bool
+i810FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+	u32 dest;
+
+	
+	if (rect->x < i810dev->clip_x1)
+		rect->x = i810dev->clip_x1;
+	if (i810dev->clip_x2 < rect->x + rect->w)
+		rect->w = i810dev->clip_x2 - rect->x;
+	if (rect->y < i810dev->clip_y1)
+		rect->y = i810dev->clip_y1;
+	if (i810dev->clip_y2 < rect->y + rect->h)
+		rect->h = i810dev->clip_y2 - rect->y;
+
+	rect->x *= i810dev->pixeldepth;
+	rect->w *= i810dev->pixeldepth;
+	dest = i810dev->destaddr + rect->x + (rect->y * i810dev->destpitch);
+	
+	if (BEGIN_LRING(i810drv, i810dev, 6)) return false;
+
+	PUT_LRING(BLIT | COLOR_BLT | 3);
+	PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch | SOLIDPATTERN |
+		  DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING(rect->h << 16 | rect->w);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->color_value);
+	PUT_LRING(NOP);
+
+	END_LRING(i810drv);
+	
+	return true;
+}
+
+static bool
+i810DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+	u32 dest;
+
+
+	if (rect->x < i810dev->clip_x1)
+		rect->x = i810dev->clip_x1;
+	if (i810dev->clip_x2 < rect->x + rect->w)
+		rect->w = i810dev->clip_x2 - rect->x;
+	if (rect->y < i810dev->clip_y1)
+		rect->y = i810dev->clip_y1;
+	if (i810dev->clip_y2 < rect->y + rect->h)
+		rect->h = i810dev->clip_y2 - rect->y;
+
+
+
+	rect->x *= i810dev->pixeldepth;
+	rect->w *= i810dev->pixeldepth;
+
+	if (BEGIN_LRING(i810drv, i810dev, 20)) return false;
+
+	/* horizontal line 1 */
+	dest = i810dev->destaddr + rect->x + (rect->y * i810dev->destpitch);
+	PUT_LRING(BLIT | COLOR_BLT | 3);
+	PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch | SOLIDPATTERN |
+		  DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING(1 << 16 | rect->w);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->color_value);
+
+	/* vertical line 1 */
+	PUT_LRING(BLIT | COLOR_BLT | 3);
+	PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch | SOLIDPATTERN |
+		  DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING(rect->h << 16 | i810dev->pixeldepth);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->color_value);
+
+	/* vertical line 2 */
+	dest += rect->w;
+	PUT_LRING(BLIT | COLOR_BLT | 3);
+	PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch | SOLIDPATTERN |
+                              DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING(rect->h << 16 | i810dev->pixeldepth);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->color_value);
+
+	/* horizontal line 2 */
+	dest -= rect->w;
+	dest += rect->h * i810dev->destpitch;
+	PUT_LRING(BLIT | COLOR_BLT | 3);
+	PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch | SOLIDPATTERN |
+		  DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING(1 << 16 | rect->w);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->color_value);
+
+	END_LRING(i810drv);
+	
+	return true;
+}
+
+static bool
+i810Blit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+	int xdir = INCREMENT, spitch = 0, dpitch = 0, src, dest;
+
+	if (dx < i810dev->clip_x1) {
+		rect->w = MIN((i810dev->clip_x2 - i810dev->clip_x1),
+			      (dx + rect->w) - i810dev->clip_x1);
+		rect->x += i810dev->clip_x1 - dx;
+		dx = i810dev->clip_x1;
+	}
+	if (i810dev->clip_x2 < dx + rect->w)
+		rect->w = i810dev->clip_x2 - dx;
+
+	if (dy < i810dev->clip_y1) {
+		rect->h = MIN((i810dev->clip_y2 - i810dev->clip_y1),
+			      (dy + rect->h) - i810dev->clip_y1);
+		rect->y += i810dev->clip_y1 - dy;
+		dy = i810dev->clip_y1;
+	}
+	if (i810dev->clip_y2 < dy + rect->h)
+		rect->h = i810dev->clip_y2 - dy;
+
+	rect->x *= i810dev->pixeldepth;
+	dx *= i810dev->pixeldepth;
+	rect->w *= i810dev->pixeldepth;
+
+	spitch = i810dev->srcpitch;
+	dpitch = i810dev->destpitch;
+
+	if (i810dev->srcaddr == i810dev->destaddr) {
+		if (dx > rect->x && dx < rect->x + rect->w) {
+			xdir = DECREMENT;
+			rect->x += rect->w - 1;
+			dx += rect->w - 1;
+		}
+		if (dy > rect->y && dy < rect->y + rect->h) {
+			i810dev->srcpitch = (-(i810dev->srcpitch)) & 0xFFFF;
+			i810dev->destpitch = (-(i810dev->destpitch)) & 0xFFFF;
+			rect->y += rect->h - 1;
+			dy += rect->h - 1;
+		}
+	}
+
+	src = i810dev->srcaddr + rect->x + (rect->y * spitch);
+	dest = i810dev->destaddr + dx + (dy * dpitch);
+
+	BEGIN_LRING(i810drv, i810dev, 8);
+
+	PUT_LRING(BLIT | FULL_BLIT | 0x6 | i810dev->colorkey_bit);
+	PUT_LRING(xdir | PAT_COPY_ROP << 16 | i810dev->destpitch |
+		  DYN_COLOR_EN | i810dev->blit_color);
+	PUT_LRING((rect->h << 16) | rect->w);
+	PUT_LRING(dest);
+	PUT_LRING(i810dev->srcpitch);
+	PUT_LRING(src);
+	PUT_LRING(i810dev->colorkey);
+	PUT_LRING((u32)(unsigned long) i810drv->pattern_base);
+
+	END_LRING(i810drv);
+	
+	return true;
+}
+
+/*
+ * The software rasterizer when rendering non-axis aligned
+ * edges uses line spanning.  In our case, it will use
+ * FillRect to render a 1 pixel-high rectangle.  However,
+ * this would be slow in the i810 since for each rectangle,
+ * an ioctl has to be done which is very slow.  As a temporary
+ * replacement, I'll include a SpanLine function that will
+ * not do an ioctl for every line.  This should be
+ * significantly faster.
+ */
+
+/* borrowed heavily and shamelessly from gfxcard.c */
+
+typedef struct {
+   int xi;
+   int xf;
+   int mi;
+   int mf;
+   int _2dy;
+} DDA;
+
+#define SETUP_DDA(xs,ys,xe,ye,dda)         \
+     do {                                  \
+          int dx = xe - xs;                \
+          int dy = ye - ys;                \
+          dda.xi = xs;                     \
+          if (dy != 0) {                   \
+               dda.mi = dx / dy;           \
+               dda.mf = 2*(dx % dy);       \
+               dda.xf = -dy;               \
+               dda._2dy = 2*dy;            \
+               if (dda.mf < 0) {           \
+                    dda.mf += ABS(dy)*2;   \
+                    dda.mi--;              \
+               }                           \
+          }                                \
+          else {                           \
+               dda.mi   = 0;               \
+               dda.mf   = 0;               \
+               dda.xf   = 0;               \
+               dda._2dy = 0;               \
+          }                                \
+     } while (0)
+
+
+#define INC_DDA(dda)                       \
+     do {                                  \
+          dda.xi += dda.mi;                \
+          dda.xf += dda.mf;                \
+          if (dda.xf > 0) {                \
+               dda.xi++;                   \
+               dda.xf -= dda._2dy;         \
+          }                                \
+     } while (0)
+
+
+
+/*
+ * The i810fill_tri function takes advantage of the buffer.
+ * It will fill up the buffer until it's done  rendering the
+ * triangle.
+ */
+static inline bool
+i810fill_tri( DFBTriangle    *tri,
+	      I810DriverData *i810drv,
+	      I810DeviceData *i810dev )
+{
+	int y, yend;
+
+	DDA dda1, dda2;
+	u32 total, dest = 0;
+
+	y = tri->y1;
+	yend = tri->y3;
+
+	if (y < i810dev->clip_y1)
+		y = i810dev->clip_y1;
+	if (yend > i810dev->clip_y2)
+		yend = i810dev->clip_y2;
+
+
+	SETUP_DDA(tri->x1, tri->y1, tri->x3, tri->y3, dda1);
+	SETUP_DDA(tri->x1, tri->y1, tri->x2, tri->y2, dda2);
+	
+	total = (yend - y) * 5;
+	if (total + BUFFER_PADDING > RINGBUFFER_SIZE/4) {
+		D_BUG("fill_triangle: buffer size is too small\n");
+		return false;
+	}
+	
+	BEGIN_LRING(i810drv, i810dev, total);
+
+	while (y < yend) {
+		DFBRectangle rect;
+
+		if (y == tri->y2) {
+			if (tri->y2 == tri->y3)
+				return true;
+			SETUP_DDA(tri->x2, tri->y2, tri->x3, tri->y3, dda2);
+		}
+		
+		rect.w = ABS(dda1.xi - dda2.xi);
+		rect.x = MIN(dda1.xi, dda2.xi);
+		
+		if (rect.w > 0) {
+			rect.y = y;
+			dest = i810dev->destaddr + (y * i810dev->destpitch) + (rect.x * i810dev->pixeldepth);
+			PUT_LRING(BLIT | COLOR_BLT | 3);
+			PUT_LRING(COLOR_COPY_ROP << 16 | i810dev->destpitch |
+				  SOLIDPATTERN | DYN_COLOR_EN | i810dev->blit_color);
+			PUT_LRING(1 << 16 | rect.w * i810dev->pixeldepth);
+			PUT_LRING(dest);
+			PUT_LRING(i810dev->color_value);
+		}
+
+		INC_DDA(dda1);
+		INC_DDA(dda2);
+		
+		y++;
+	}
+	END_LRING(i810drv);
+	return true;
+}
+
+static bool
+i810FillTriangle( void *drv, void *dev, DFBTriangle *tri)
+{
+	I810DriverData *i810drv = (I810DriverData *) drv;
+	I810DeviceData *i810dev = (I810DeviceData *) dev;
+	bool err = true;
+
+	dfb_sort_triangle(tri);
+	
+	if (tri->y3 - tri->y1 > 0)
+		err = i810fill_tri(tri, i810drv, i810dev);
+
+	return err;
+}
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_I810:          /* Intel 810 */
+		  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 810/810E/810-DC100/815 Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Tony Daplas" );
+
+     snprintf( info->url,
+               DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+               "http://i810fb.sourceforge.net" );
+
+     snprintf( info->license,
+               DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+               "LGPL" );
+
+     info->version.major = 0;
+     info->version.minor = 5;
+
+     info->driver_data_size = sizeof (I810DriverData);
+     info->device_data_size = sizeof (I810DeviceData);
+}
+
+static void
+i810_release_resource( I810DriverData *idrv, I810DeviceData *idev )
+{
+     agp_unbind unbind;
+
+     if (idrv->flags & I810RES_STATE_SAVE) {
+          i810_writel( idrv->mmio_base, LP_RING, idev->lring1 );
+          i810_writel( idrv->mmio_base, LP_RING + RING_HEAD, idev->lring2 );
+          i810_writel( idrv->mmio_base, LP_RING + RING_START, idev->lring3 );
+          i810_writel( idrv->mmio_base, LP_RING + RING_LEN, idev->lring4 );
+     }
+
+     if (idrv->flags & I810RES_MMAP) {
+          munmap((void *) idrv->aper_base, idev->info.aper_size * 1024 * 1024);
+          idrv->flags &= ~I810RES_MMAP;
+     }
+
+     if (idrv->flags & I810RES_LRING_BIND) {
+          unbind.key = idev->lring_bind.key;
+          ioctl(idrv->agpgart, AGPIOC_UNBIND, &unbind);
+     }
+
+     if (idrv->flags & I810RES_LRING_ACQ)
+          ioctl(idrv->agpgart, AGPIOC_DEALLOCATE, idev->lring_mem.key);
+
+     if (idrv->flags & I810RES_OVL_BIND) {
+          unbind.key = idev->ovl_bind.key;
+          ioctl(idrv->agpgart, AGPIOC_UNBIND, &unbind);
+     }
+
+     if (idrv->flags & I810RES_OVL_ACQ)
+          ioctl(idrv->agpgart, AGPIOC_DEALLOCATE, idev->ovl_mem.key);
+
+     if (idrv->flags & I810RES_GART_ACQ) {
+          ioctl(idrv->agpgart, AGPIOC_RELEASE);
+          idrv->flags &= ~I810RES_GART_ACQ;
+     }
+
+     if (idrv->flags & I810RES_GART) {
+          close(idrv->agpgart);
+          idrv->flags &= ~I810RES_GART;
+     }
+}
+
+static DFBResult
+i810_agp_setup( CoreGraphicsDevice *device,
+                I810DriverData *idrv,
+                I810DeviceData *idev )
+{
+     idrv->agpgart = open("/dev/agpgart", O_RDWR);
+     if (idrv->agpgart == -1)
+          return DFB_IO;
+     D_FLAGS_SET( idrv->flags, I810RES_GART );
+
+
+     if (ioctl(idrv->agpgart, AGPIOC_ACQUIRE)) {
+          D_PERROR( "I810/AGP: AGPIOC_ACQUIRE failed!\n" );
+          return DFB_IO;
+     }
+     D_FLAGS_SET( idrv->flags, I810RES_GART_ACQ );
+
+
+     if (!idev->initialized) {
+          agp_setup setup;
+
+          setup.agp_mode = 0;
+          if (ioctl(idrv->agpgart, AGPIOC_SETUP, &setup)) {
+               D_PERROR( "I810/AGP: AGPIOC_SETUP failed!\n" );
+               return DFB_IO;
+          }
+     
+          if (ioctl(idrv->agpgart, AGPIOC_INFO, &idev->info)) {
+               D_PERROR( "I810/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( "I810/AGP: mmap() failed!\n" );
+          i810_release_resource( idrv, idev );
+          return DFB_IO;
+     }
+     D_FLAGS_SET( idrv->flags, I810RES_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( "I810/AGP: AGPIOC_ALLOCATE failed!\n" );
+               i810_release_resource( idrv, idev );
+               return DFB_IO;
+          }
+          D_FLAGS_SET( idrv->flags, I810RES_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( "I810/AGP: AGPIOC_BIND failed!\n" );
+               i810_release_resource( idrv, idev );
+               return DFB_IO;
+          }
+          D_FLAGS_SET( idrv->flags, I810RES_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( "I810/AGP: AGPIOC_ALLOCATE failed!\n" );
+               i810_release_resource( idrv, idev );
+               return DFB_IO;
+          }
+          D_FLAGS_SET( idrv->flags, I810RES_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( "I810/AGP: AGPIOC_BIND failed!\n" );
+               i810_release_resource( idrv, idev );
+               return DFB_IO;
+          }
+          D_FLAGS_SET( idrv->flags, I810RES_OVL_BIND );
+     }
+
+
+     if (idrv->flags & I810RES_GART_ACQ) {
+          ioctl(idrv->agpgart, AGPIOC_RELEASE);
+          idrv->flags &= ~I810RES_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->ovl_base, 0xff, 1024);
+          memset((void *) idrv->pattern_base, 0xff, 4096 - 1024);
+
+          idev->lring1 = 0;//i810_readl(idrv->mmio_base, LP_RING);
+          idev->lring2 = 0;//i810_readl(idrv->mmio_base, LP_RING + RING_HEAD);
+          idev->lring3 = 0;//i810_readl(idrv->mmio_base, LP_RING + RING_START);
+          idev->lring4 = 0;//i810_readl(idrv->mmio_base, LP_RING + RING_LEN);
+
+          D_FLAGS_SET( idrv->flags, I810RES_STATE_SAVE );
+     }
+
+     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;
+     I810DriverData *idrv = driver_data;
+     I810DeviceData *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 = i810_agp_setup( device, idrv, idev );
+     if (ret) {
+          dfb_gfxcard_unmap_mmio( device, idrv->mmio_base, -1 );
+          return ret;
+     }
+
+     idrv->info = idev->info;
+
+
+     funcs->CheckState         = i810CheckState;
+     funcs->SetState           = i810SetState;
+     funcs->EngineSync         = i810EngineSync;
+     funcs->FlushTextureCache  = i810FlushTextureCache;
+
+     funcs->FillRectangle      = i810FillRectangle;
+     funcs->DrawRectangle      = i810DrawRectangle;
+     funcs->Blit               = i810Blit;
+     funcs->FillTriangle       = i810FillTriangle;
+
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY), driver_data, &i810OverlayFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     I810DriverData *idrv = driver_data;
+     I810DeviceData *idev = device_data;
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "810/810E/810-DC100/815" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Intel" );
+
+     device_info->caps.flags    = CCF_CLIPPING;
+     device_info->caps.accel    = I810_SUPPORTED_DRAWINGFUNCTIONS |
+                                  I810_SUPPORTED_BLITTINGFUNCTIONS;
+     device_info->caps.drawing  = I810_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = I810_SUPPORTED_BLITTINGFLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 32 * 4;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     dfb_config->pollvsync_after = 1;
+
+     i810_init_ringbuffer( idrv, idev );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+		     void               *driver_data,
+		     void               *device_data )
+{
+	I810DeviceData *i810dev = (I810DeviceData *) device_data;
+	I810DriverData *i810drv = (I810DriverData *) driver_data;
+
+    i810ovlOnOff( i810drv, i810dev, false );
+
+    i810_wait_for_blit_idle( i810drv, i810dev );
+    i810_lring_enable( i810drv, 0 );
+
+    i810_release_resource( i810drv, i810dev );
+
+
+	D_DEBUG( "DirectFB/I810: DMA Buffer Performance Monitoring:\n");
+	D_DEBUG( "DirectFB/I810:  %9d DMA buffer size in KB\n",
+		  RINGBUFFER_SIZE/1024 );
+	D_DEBUG( "DirectFB/I810:  %9d i810_wait_for_blit_idle calls\n",
+		  i810dev->idle_calls );
+	D_DEBUG( "DirectFB/I810:  %9d i810_wait_for_space calls\n",
+		  i810dev->waitfifo_calls );
+	D_DEBUG( "DirectFB/I810:  %9d BUFFER transfers (i810_wait_for_space sum)\n",
+		  i810dev->waitfifo_sum );
+	D_DEBUG( "DirectFB/I810:  %9d BUFFER wait cycles (depends on GPU/CPU)\n",
+		  i810dev->fifo_waitcycles );
+	D_DEBUG( "DirectFB/I810:  %9d IDLE wait cycles (depends on GPU/CPU)\n",
+		  i810dev->idle_waitcycles );
+	D_DEBUG( "DirectFB/I810:  %9d BUFFER space cache hits(depends on BUFFER size)\n",
+		  i810dev->fifo_cache_hits );
+	D_DEBUG( "DirectFB/I810:  %9d BUFFER timeout sum (possible hardware crash)\n",
+		  i810dev->fifo_timeoutsum );
+	D_DEBUG( "DirectFB/I810:  %9d IDLE timeout sum (possible hardware crash)\n",
+		  i810dev->idle_timeoutsum );
+	D_DEBUG( "DirectFB/I810: Conclusion:\n" );
+	D_DEBUG( "DirectFB/I810:  Average buffer transfers per i810_wait_for_space "
+		  "call: %.2f\n",
+		  i810dev->waitfifo_sum/(float)(i810dev->waitfifo_calls) );
+	D_DEBUG( "DirectFB/I810:  Average wait cycles per i810_wait_for_space call:"
+		  " %.2f\n",
+		  i810dev->fifo_waitcycles/(float)(i810dev->waitfifo_calls) );
+	D_DEBUG( "DirectFB/I810:  Average wait cycles per i810_wait_for_blit_idle call:"	
+		  " %.2f\n",
+		  i810dev->idle_waitcycles/(float)(i810dev->idle_calls) );
+	D_DEBUG( "DirectFB/I810:  Average buffer space cache hits: %02d%%\n",
+		  (int)(100 * i810dev->fifo_cache_hits/
+			(float)(i810dev->waitfifo_calls)) );
+
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+	I810DriverData *idrv = (I810DriverData *) driver_data;
+
+	dfb_gfxcard_unmap_mmio( device, idrv->mmio_base, -1);
+
+    if (idrv->flags & I810RES_MMAP) {
+         munmap((void *) idrv->aper_base, idrv->info.aper_size * 1024 * 1024);
+         idrv->flags &= ~I810RES_MMAP;
+    }
+
+    if (idrv->flags & I810RES_GART_ACQ) {
+         ioctl(idrv->agpgart, AGPIOC_RELEASE);
+         idrv->flags &= ~I810RES_GART_ACQ;
+    }
+
+    if (idrv->flags & I810RES_GART) {
+         close(idrv->agpgart);
+         idrv->flags &= ~I810RES_GART;
+    }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/i810/i810.h b/Source/DirectFB/gfxdrivers/i810/i810.h
new file mode 100755
index 0000000..444c7c2
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i810/i810.h
@@ -0,0 +1,832 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by 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.
+*/
+
+/*
+ * Intel 810 Chipset Family PRM 15 3.1 
+ * GC Register Memory Address Map 
+ *
+ * Based on:
+ * Intel (R) 810 Chipset Family 
+ * Programmer s Reference Manual 
+ * November 1999 
+ * Revision 1.0 
+ * Order Number: 298026-001 R
+ *
+ * All GC registers are memory-mapped. In addition, the VGA and extended VGA registers 
+ * are I/O mapped. 
+ */
+ 
+#ifndef __I810_H__
+#define __I810_H__
+
+#include <dfb_types.h>
+#include <sys/io.h>
+#include <linux/agpgart.h>
+
+#include <core/gfxcard.h>
+#include <core/layers.h>
+
+
+#define LP_RING     0x2030
+#define HP_RING     0x2040
+
+#define RING_TAIL      0x00
+#define RING_HEAD      0x04
+#define RING_START     0x08
+#define RING_LEN       0x0C
+
+
+/*  Instruction and Interrupt Control Registers (01000h 02FFFh) */
+#define FENCE                 0x02000                
+#define PGTBL_CTL             0x02020                
+#define PGTBL_ER              0x02024
+#define RINGBUFFER            0x02030
+#define    LRING              0x02030
+#define    IRING              0x02040
+#define HWS_PGA               0x02080 
+#define IPEIR                 0x02088
+#define IPEHR                 0x0208C 
+#define INSTDONE              0x02090 
+#define NOPID                 0x02094
+#define HWSTAM                0x02098 
+#define IER                   0x020A0
+#define IIR                   0x020A4
+#define IMR                   0x020A8 
+#define ISR                   0x020AC 
+#define EIR                   0x020B0 
+#define EMR                   0x020B4 
+#define ESR                   0x020B8 
+#define INSTPM                0x020C0
+#define INSTPS                0x020C4 
+#define BBP_PTR               0x020C8 
+#define ABB_SRT               0x020CC
+#define ABB_END               0x020D0
+#define DMA_FADD              0x020D4 
+#define FW_BLC                0x020D8
+#define MEM_MODE              0x020DC        
+
+/*  Memory Control Registers (03000h 03FFFh) */
+#define DRT                   0x03000
+#define DRAMCL                0x03001
+#define DRAMCH                0x03002
+ 
+
+/* Span Cursor Registers (04000h 04FFFh) */
+#define UI_SC_CTL             0x04008 
+
+/* I/O Control Registers (05000h 05FFFh) */
+#define HVSYNC                0x05000 
+#define GPIOA                 0x05010
+#define GPIOB                 0x05014 
+
+/* Clock Control and Power Management Registers (06000h 06FFFh) */
+#define DCLK_0D               0x06000
+#define DCLK_1D               0x06004
+#define DCLK_2D               0x06008
+#define LCD_CLKD              0x0600C
+#define DCLK_0DS              0x06010
+#define PWR_CLKC              0x06014
+
+/* Graphics Translation Table Range Definition (10000h 1FFFFh) */
+#define GTT                   0x10000  
+
+/*  Overlay Registers (30000h 03FFFFh) */
+#define OV0ADDR               0x30000
+#define DOV0STA               0x30008
+#define GAMMA                 0x30010
+#define OBUF_0Y               0x30100
+#define OBUF_1Y               0x30104
+#define OBUF_0U               0x30108
+#define OBUF_0V               0x3010C
+#define OBUF_1U               0x30110
+#define OBUF_1V               0x30114 
+#define OV0STRIDE             0x30118
+#define YRGB_VPH              0x3011C
+#define UV_VPH                0x30120
+#define HORZ_PH               0x30124
+#define INIT_PH               0x30128
+#define DWINPOS               0x3012C 
+#define DWINSZ                0x30130
+#define SWID                  0x30134
+#define SWIDQW                0x30138
+#define SHEIGHT               0x3013C
+#define YRGBSCALE             0x30140 
+#define UVSCALE               0x30144
+#define OV0CLRCO              0x30148
+#define OV0CLRC1              0x3014C
+#define DCLRKV                0x30150
+#define DLCRKM                0x30154
+#define SCLRKVH               0x30158
+#define SCLRKVL               0x3015C
+#define SCLRKM                0x30160
+#define OV0CONF               0x30164
+#define OV0CMD                0x30168
+#define AWINPOS               0x30170
+#define AWINZ                 0x30174
+
+/*  BLT Engine Status (40000h 4FFFFh) (Software Debug) */
+#define BR00                  0x40000
+#define BRO1                  0x40004
+#define BR02                  0x40008
+#define BR03                  0x4000C
+#define BR04                  0x40010
+#define BR05                  0x40014
+#define BR06                  0x40018
+#define BR07                  0x4001C
+#define BR08                  0x40020
+#define BR09                  0x40024
+#define BR10                  0x40028
+#define BR11                  0x4002C
+#define BR12                  0x40030
+#define BR13                  0x40034
+#define BR14                  0x40038
+#define BR15                  0x4003C
+#define BR16                  0x40040
+#define BR17                  0x40044
+#define BR18                  0x40048
+#define BR19                  0x4004C
+#define SSLADD                0x40074
+#define DSLH                  0x40078
+#define DSLRADD               0x4007C
+
+
+/* LCD/TV-Out and HW DVD Registers (60000h 6FFFFh) */
+/* LCD/TV-Out */
+#define HTOTAL                0x60000
+#define HBLANK                0x60004
+#define HSYNC                 0x60008
+#define VTOTAL                0x6000C
+#define VBLANK                0x60010
+#define VSYNC                 0x60014
+#define LCDTV_C               0x60018
+#define OVRACT                0x6001C
+#define BCLRPAT               0x60020
+
+/*  Display and Cursor Control Registers (70000h 7FFFFh) */
+#define DISP_SL               0x70000
+#define DISP_SLC              0x70004
+#define PIXCONF               0x70008
+#define PIXCONF1              0x70009
+#define BLTCNTL               0x7000C
+#define SWF                   0x70014
+#define DPLYBASE              0x70020
+#define DPLYSTAS              0x70024
+#define CURCNTR               0x70080
+#define CURBASE               0x70084
+#define CURPOS                0x70088
+
+
+/* VGA Registers */
+
+/* SMRAM Registers */
+#define SMRAM                 0x10
+
+/* Graphics Control Registers */
+#define GR_INDEX              0x3CE
+#define GR_DATA               0x3CF
+
+#define GR10                  0x10
+#define GR11                  0x11
+
+/* CRT Controller Registers */
+#define CR_INDEX_MDA          0x3B4
+#define CR_INDEX_CGA          0x3D4
+#define CR_DATA_MDA           0x3B5
+#define CR_DATA_CGA           0x3D5
+
+#define CR30                  0x30
+#define CR31                  0x31
+#define CR32                  0x32
+#define CR33                  0x33
+#define CR35                  0x35
+#define CR39                  0x39
+#define CR40                  0x40
+#define CR41                  0x41
+#define CR42                  0x42
+#define CR70                  0x70
+#define CR80                  0x80 
+#define CR81                  0x82
+
+/* Extended VGA Registers */
+
+/* General Control and Status Registers */
+#define ST00                  0x3C2
+#define ST01_MDA              0x3BA
+#define ST01_CGA              0x3DA
+#define FRC_READ              0x3CA
+#define FRC_WRITE_MDA         0x3BA
+#define FRC_WRITE_CGA         0x3DA
+#define MSR_READ              0x3CC
+#define MSR_WRITE             0x3C2
+
+/* Sequencer Registers */
+#define SR_INDEX              0x3C4
+#define SR_DATA               0x3C5
+
+#define SR01                  0x01
+#define SR02                  0x02
+#define SR03                  0x03
+#define SR04                  0x04
+#define SR07                  0x07
+
+/* Graphics Controller Registers */
+#define GR00                  0x00   
+#define GR01                  0x01
+#define GR02                  0x02
+#define GR03                  0x03
+#define GR04                  0x04
+#define GR05                  0x05
+#define GR06                  0x06
+#define GR07                  0x07
+#define GR08                  0x08  
+
+/* Attribute Controller Registers */
+#define ATTR_WRITE              0x3C0
+#define ATTR_READ               0x3C1
+
+/* VGA Color Palette Registers */
+
+/* CLUT */
+#define CLUT_DATA             0x3C9        /* DACDATA */
+#define CLUT_INDEX_READ       0x3C7        /* DACRX */
+#define CLUT_INDEX_WRITE      0x3C8        /* DACWX */
+#define DACMASK               0x3C6
+
+/* CRT Controller Registers */
+#define CR00                  0x00
+#define CR01                  0x01
+#define CR02                  0x02
+#define CR03                  0x03
+#define CR04                  0x04
+#define CR05                  0x05
+#define CR06                  0x06
+#define CR07                  0x07
+#define CR08                  0x08
+#define CR09                  0x09
+#define CR0A                  0x0A
+#define CR0B                  0x0B
+#define CR0C                  0x0C
+#define CR0D                  0x0D
+#define CR0E                  0x0E
+#define CR0F                  0x0F
+#define CR10                  0x10
+#define CR11                  0x11
+#define CR12                  0x12
+#define CR13                  0x13
+#define CR14                  0x14
+#define CR15                  0x15
+#define CR16                  0x16
+#define CR17                  0x17
+#define CR18                  0x18
+
+
+/* Raster ops */
+#define COLOR_COPY_ROP        0xF0
+#define PAT_COPY_ROP          0xCC
+#define CLEAR_ROP             0x00
+#define WHITE_ROP             0xFF
+#define INVERT_ROP            0x55
+
+/* 2D Engine definitions */
+#define SOLIDPATTERN          0x80000000
+#define NONSOLID              0x00000000
+#define BPP8                  0x00000000
+#define BPP16                 0x01 << 24
+#define BPP24                 0x02 << 24
+#define DYN_COLOR_EN          0x00400000
+#define DYN_COLOR_DIS         0x00000000
+#define INCREMENT             0x00000000
+#define DECREMENT             0x01 << 30
+#define ARB_ON                0x00000001
+#define ARB_OFF               0x00000000
+#define SYNC_FLIP             0x00000000
+#define ASYNC_FLIP            0x00000040
+#define OPTYPE_MASK           0xE0000000
+#define PARSER_MASK           0x001F8000 
+#define D2_MASK               0x001FC000         /* 2D mask */
+
+/* Instruction type */
+/* There are more but pertains to 3D */
+#define PARSER                0x00000000
+#define BLIT                  0x02 << 29
+#define RENDER                0x03 << 29
+            
+/* Parser */
+#define NOP                   0x00               /* No operation, padding */
+#define BP_INT                0x01 << 23         /* Breakpoint interrupt */
+#define USR_INT               0x02 << 23         /* User interrupt */
+#define WAIT_FOR_EVNT         0x03 << 23         /* Wait for event */
+#define FLUSH                 0x04 << 23              
+#define CONTEXT_SEL           0x05 << 23
+#define REPORT_HEAD           0x07 << 23
+#define ARB_ON_OFF            0x08 << 23
+#define OVERLAY_FLIP          0x11 << 23
+#define LOAD_SCAN_INC         0x12 << 23
+#define LOAD_SCAN_EX          0x13 << 23
+#define FRONT_BUFFER          0x14 << 23
+#define DEST_BUFFER           0x15 << 23
+#define Z_BUFFER              0x16 << 23              /* we won't need this */
+#define STORE_DWORD_IMM       0x20 << 23
+#define STORE_DWORD_IDX       0x21 << 23
+#define BATCH_BUFFER          0x30 << 23
+
+/* Blit */
+#define SETUP_BLIT                      0x00
+#define SETUP_MONO_PATTERN_SL_BLT       0x10 << 22
+#define PIXEL_BLT                       0x20 << 22
+#define SCANLINE_BLT                    0x21 << 22 
+#define TEXT_BLT                        0x22 << 22
+#define TEXT_IMM_BLT                    0x30 << 22
+#define COLOR_BLT                       0x40 << 22
+#define MONO_PAT_BLIT                   0x42 << 22
+#define SOURCE_COPY_BLIT                0x43 << 22
+#define FULL_BLIT                       0x45 << 22
+
+/* Primitive */
+#define TRILIST                         0
+#define TRISTRIP                        1 << 18
+#define TRISTRIP_REV                    2 << 18
+#define TRIFAN                          3 << 18
+#define POLYGON                         4 << 18
+#define LINELIST                        5 << 18
+#define LINESTRIP                       6 << 18
+#define RECTANGLE                       7 << 18 
+#define V0_ENABLE                       1
+#define V1_ENABLE                       2
+#define V2_ENABLE                       4
+
+/* Vertex Flags */
+#define COORD_1                         0
+#define COORD_2                         1 << 8
+#define COORD_3                         2 << 8
+#define FOG_ENABLE                      1 << 7
+#define ARGB_ENABLE                     1 << 6
+#define Z_OFFSET_PRESENT                1 << 5
+#define XYZ                             0x01 << 1
+#define XYZW                            0x02 << 1
+#define XY                              0x03 << 1
+#define XYW                             0x04 << 1               
+
+/* Antialiasing */
+#define AA_UPDATE_EDGEFLAG	 (1<<13)
+#define AA_ENABLE_EDGEFLAG	 (1<<12)
+#define AA_UPDATE_POLYWIDTH      (1<<11)
+#define AA_POLYWIDTH_05		 (1<<9)
+#define AA_POLYWIDTH_10		 (2<<9)
+#define AA_POLYWIDTH_20 	 (3<<9)
+#define AA_POLYWIDTH_40          (4<<9)
+#define AA_UPDATE_LINEWIDTH	 (1<<8)
+#define AA_LINEWIDTH_05  	 (1<<6)
+#define AA_LINEWIDTH_10          (2<<6)
+#define AA_LINEWIDTH_20 	 (3<<6)
+#define AA_LINEWIDTH_40		  (4<<6)
+#define AA_UPDATE_BB_EXPANSION   (1<<5)
+#define AA_BB_EXPANSION_SHIFT    2
+#define AA_UPDATE_AA_ENABLE	 (1<<1)
+#define AA_ENABLE    		 (1<<0)
+
+/* Pixelization Rule */
+#define PVK_SMALL_TRI_UPDATE            1 << 12          
+#define PVK_SMALL_TRI                   1 << 11
+#define PVK_PIX_RULE_UPDATE             1 << 10 
+#define PVK_PIX_RULE                    1 << 9
+#define PVK_LINE_UPDATE                 1 << 8
+#define PVK_LINE_V0                     0 
+#define PVK_LINE_V1                     1 << 6
+#define PVK_TRIFAN_UPDATE               1 << 5
+#define PVK_TRIFAN_V0                   0
+#define PVK_TRIFAN_V1                   1 << 3
+#define PVK_TRIFAN_V2                   2 << 3
+#define PVK_TRISTRIP_UPDATE             1 << 2
+#define PVK_TRISTRIP_V0                 0
+#define PVK_TRISTRIP_V1                 1 
+#define PVK_TRISTRIP_V2                 2 
+
+/* Boolean Enable 1 */
+#define B1_ALPHA_SETUP_ENABLE_UPDATE    1 << 17
+#define B1_ALPHA_SETUP_ENABLE           1 << 16
+#define B1_FOG_ENABLE_UPDATE            1 << 7
+#define B1_FOG_ENABLE                   1 << 6
+#define B1_ALPHA_STATE_ENABLE_UPDATE    1 << 5
+#define B1_ALPHA_STATE_ENABLE           1 << 4
+#define B1_BLEND_ENABLE_UPDATE          1 << 3
+#define B1_BLEND_ENABLE                 1 << 2
+#define B1_Z_ENABLE_UPDATE              1 << 1 
+#define B1_Z_ENABLE                     1 
+
+/* Boolean Enable 2 */
+#define B2_MCE_UPDATE                   1 << 17
+#define B2_MCE                          1 << 16
+#define B2_ALPHA_DITHER_UPDATE          1 << 15
+#define B2_ALPHA_DITHER                 1 << 14
+#define B2_FOG_DITHER_UPDATE            1 << 13
+#define B2_FOG_DITHER                   1 << 12
+#define B2_SPEC_DITHER_UPDATE           1 << 11 
+#define B2_SPEC_DITHER                  1 << 10
+#define B2_COLOR_DITHER_UPDATE          1 << 9
+#define B2_COLOR_DITHER                 1 << 8
+#define B2_FB_WRITE_UPDATE              1 << 3
+#define B2_FB_WRITE                     1 << 2
+#define B2_ZB_WRITE_UPDATE              1 << 1
+#define B2_ZB_WRITE                     1
+
+/* Cull Shade Mode */
+#define CULL_Z_UPDATE                   1 << 20                 
+#define CULL_Z_ALWAYS                   0
+#define CULL_Z_NEVER                    1 << 16
+#define CULL_Z_LESS                     2 << 16
+#define CULL_Z_EQUAL                    3 << 16
+#define CULL_Z_LEQUAL                   4 << 16
+#define CULL_Z_GREATER                  5 << 16
+#define CULL_Z_NOTEQUAL                 6 << 16
+#define CULL_Z_GEQUAL                   7 << 16
+#define CULL_LINE_WIDTH_UPDATE          1 << 15
+#define CULL_LINE_WIDTH_MASK            7 << 12
+#define CULL_ALPHA_SHADE_UPDATE         1 << 11
+#define CULL_ALPHA_SHADE                1 << 10
+#define CULL_FOG_SHADE_UPDATE           1 << 9
+#define CULL_FOG_SHADE                  1 << 8
+#define CULL_SPEC_SHADE_UPDATE          1 << 7
+#define CULL_SPEC_SHADE                 1 << 6
+#define CULL_COLOR_SHADE_UPDATE         1 << 5
+#define CULL_COLOR_SHADE                1 << 4
+#define CULL_MODE_UPDATE                1 << 3
+#define CULL_NONE                       1 << 2
+#define CULL_CW                         2 << 2 
+#define CULL_CCW                        3 << 2
+#define CULL_BOTH                       4 << 2
+
+/* texel map */
+#define UPDATE_TEXEL1                   1 << 15
+#define UPDATE_TEXEL0                   1 << 7
+#define ENABLE_TEXEL1                   1 << 14
+#define ENABLE_TEXEL0                   1 << 6
+#define TEXEL1_COORD_IDX                1 << 11
+#define TEXEL0_COORD_IDX                1 << 3
+#define TEXEL1_MAP_IDX                  1 << 8
+#define TEXEL0_MAP_IDX                  1
+
+/* color blend stage */                 
+#define COLOR_STAGE0                    0
+#define COLOR_STAGE1                    1 << 20
+#define COLOR_STAGE2                    2 << 20
+#define UPDATE_COLOR_SELECT_MASK        1 << 19
+#define SELECT_COLOR_ACC                1 << 18
+#define SELECT_COLOR_CURRENT            0
+#define UPDATE_COLOR_ARG1               1 << 17
+#define ARG1_COLOR_FACTOR               1 << 14
+#define ARG1_COLOR_ACC                  2 << 14
+#define ARG1_COLOR_ITERATED             3 << 14
+#define ARG1_COLOR_SPEC                 4 << 14
+#define ARG1_COLOR_CURRENT              5 << 14
+#define ARG1_COLOR_TEXEL0               6 << 14
+#define ARG1_COLOR_TEXEL1               7 << 14
+#define ARG1_REPLICATE_ALPHA_TO_COLOR   1 << 13
+#define ARG1_COLOR_INVERT               1 << 12
+#define UPDATE_COLOR_ARG2               1 << 11
+#define ARG2_COLOR_FACTOR               1 << 8
+#define ARG2_COLOR_ACC                  2 << 8
+#define ARG2_COLOR_ITERATED             3 << 8
+#define ARG2_COLOR_SPEC                 4 << 8
+#define ARG2_COLOR_CURRENT              5 << 8
+#define ARG2_COLOR_TEXEL0               6 << 8
+#define ARG2_COLOR_TEXEL1               7 << 8
+#define ARG2_REPLICATE_ALPHA_TO_COLOR   1 << 7
+#define ARG2_COLORINVERT                1 << 6
+#define UPDATE_COLOR_OP                 1 << 5
+#define DISABLE_COLOR_OP                0
+#define SELECT_COLOR_ARG1_OP            1
+#define SELECT_COLOR_ARG2_OP            2
+#define MODULATE_COLOR_OP               3
+#define MODULATE2X_COLOR_OP             4
+#define MODULATE4X_COLOR_OP             5
+#define ADD_COLOR_OP                    6
+#define ADD_SIGNED_COLOR_OP             7
+#define LINEAR_ALPHA_ITER_OP            8
+#define LINEAR_ALPHA_FACTOR_OP          0x0a
+#define LINEAR_TEXEL0_ALPHA_OP          0x10
+#define LINEAR_TEXEL1_ALPHA_OP          0x11
+#define LINEAR_TEXEL0_COLOR_OP          0x12
+#define LINEAR_TEXEL1_COLOR_OP          0x13
+#define SUBTRACT_COLOR_OP               0x14
+
+/* alpha blend stage */                 
+#define ALPHA_STAGE0                    0
+#define ALPHA_STAGE1                    1 << 20
+#define ALPHA_STAGE2                    2 << 20
+#define UPDATE_ALPHA_SELECT_MASK        1 << 19
+#define UPDATE_ALPHA_ARG1               1 << 18
+#define ARG1_ALPHA_FACTOR               1 << 15
+#define ARG1_ALPHA_ITERATED             3 << 15
+#define ARG1_ALPHA_CURRENT              5 << 15
+#define ARG1_ALPHA_TEXEL0               6 << 15
+#define ARG1_ALPHA_TEXEL1               7 << 15
+#define ARG1_ALPHA_INVERT               1 << 13
+#define UPDATE_ALPHA_ARG2               1 << 12
+#define ARG2_ALPHA_FACTOR               1 << 8
+#define ARG2_ALPHA_ITERATED             3 << 8
+#define ARG2_ALPHA_CURRENT              5 << 8
+#define ARG2_ALPHA_TEXEL0               6 << 8
+#define ARG2_ALPHA_TEXEL1               7 << 8
+#define ARG2_ALPHAINVERT                1 << 6
+#define UPDATE_ALPHA_OP                 1 << 5
+#define DISABLE_ALPHA_OP                0
+#define SELECT_ALPHA_ARG1_OP            1
+#define SELECT_ALPHA_ARG2_OP            2
+#define MODULATE_ALPHA_OP               3
+#define MODULATE2X_ALPHA_OP             4
+#define MODULATE4X_ALPHA_OP             5
+#define ADD_ALPHA_OP                    6
+#define ADD_SIGNED_ALPHA_OP             7
+#define LINEAR_ALPHA_ITER_OP            8
+#define LINEAR_ALPHA_FACTOR_OP          0x0a
+#define LINEAR_TEXEL0_ALPHA_OP          0x10
+#define LINEAR_TEXEL1_ALPHA_OP          0x11
+
+/* Source-Dest Blend Mono */
+#define UPDATE_MONO                     1 << 13
+#define ENABLE_MONO                     1 << 12
+#define DISABLE_MONO                    0
+#define UPDATE_SRC_MONO_BLEND           1 << 11
+#define UPDATE_DEST_MONO_BLEND          1 << 5
+
+#define SRC_ZERO                        1 >>6
+#define SRC_ONE                         2 << 6
+#define SRC_SRC_COLOR                   3 << 6
+#define SRC_INV_SRC_COLOR               4 << 6
+#define SRC_SRC_ALPHA                   5 << 6
+#define SRC_INV_SRC_ALPHA               6 << 6
+#define SRC_DST_COLOR                   9 << 6
+#define SRC_INV_DST_COLOR               0x0a << 6
+#define SRC_BOTH_SRC_ALPHA              0x0c << 6
+#define SRC_BOTH_INV_SRC_ALPHA          0x0d << 6    
+
+#define DEST_ZERO                       1 
+#define DEST_ONE                        2
+#define DEST_SRC_COLOR                  3
+#define DEST_INV_SRC_COLOR              4
+#define DEST_SRC_ALPHA                  5
+#define DEST_INV_SRC_ALPHA              6
+#define DEST_DST_COLOR                  9
+#define DEST_INV_DST_COLOR              0x0a
+#define DEST_BOTH_SRC_ALPHA             0x0c
+#define DEST_BOTH_INV_SRC_ALPHA         0x0d    
+
+/* Destination Render Buffer */
+#define RENDER_RGB8                     0
+#define RENDER_RGB15                    1 << 8
+#define RENDER_RGB16                    2 << 8
+#define YUV_YSWAP                       4 << 8
+#define YUV_NORMAL                      5 << 8
+#define YUV_UVSWAP                      6 << 8
+#define YUV_YUVSWAP                     7 << 8
+
+#define ORG_XBIASMASK                   0x0F << 20
+#define ORG_YBIASMASK                   0x0F << 16
+#define VSTRIDE                         2
+#define VSTRIDE_OFFSET                  1
+
+/* Alpha Z-bias */
+#define UPDATE_ZBIAS                    1 << 22
+#define UPDATE_ALPHA_FX                 1 << 13
+#define UPDATE_ALPHA_REFERENCE          1 << 8
+
+#define ALPHAFX_NEVER                  1 << 9
+#define ALPHAFX_LESS                    2 << 9
+#define ALPHAFX_EQUAL                   3 << 9
+#define ALPHAFX_LEQUAL                  4 << 9
+#define ALPHAFX_GREATER                   5 << 9
+#define ALPHAFX_NOTEQUAL                  6 << 9
+#define ALPHAFX_GEQUAL                    7 << 9
+#define ALPHAFX_ALWAYS                    8 << 9               
+
+/* Scissor */
+#define SCISSOR_ENABLE_UPDATE          1 << 1
+#define SCISSOR_ENABLE                 1
+
+/* Stipple */
+#define STIPPLE_ENABLE                 1 << 16
+
+/* Rendering Packets */
+/* state pipelined */
+#define COLOR_BLEND_STAGE               RENDER | 0x00 << 24
+#define ALPHA_BLEND_STAGE               RENDER | 0x01 << 24
+#define LINE_WIDTH_CULL_SHADE           RENDER | 0x02 << 24
+#define BOOL_ENABLE_1                   RENDER | 0x03 << 24
+#define BOOL_ENABLE_2                   RENDER | 0x04 << 24
+#define VERTEX_FORMAT                   RENDER | 0x05 << 24
+#define ANTIALIAS                       RENDER | 0x06 << 24
+#define PVK_PIXEL_RULE                  RENDER | 0x07 << 24
+#define SRC_DEST_BLEND_MONO             RENDER | 0x08 << 24
+#define MAP_TEXEL                       RENDER | 0x1C << 24 
+#define PRIMITIVE                       RENDER | 0x1F << 24
+
+/* multiple dwords */
+#define COLOR_FACTOR                    RENDER | 0x1D << 24 | 0x01 << 16 | 0
+#define COLOR_CHROMA_KEY                RENDER | 0x1D << 24 | 0x02 << 16 | 1
+#define DRAWING_RECT_INFO               RENDER | 0x1D << 24 | 0x80 << 16 | 3
+#define RENDER_BUF_DEST                 RENDER | 0x1D << 24 | 0x85 << 16 | 0
+#define SCISSOR_INFO                    RENDER | 0x1D << 24 | 0x81 << 16 | 1 
+#define STIPPLE                         RENDER | 0x1D << 24 | 0x83 << 16 | 0
+
+/* non-pipelined */
+#define ALPHA_Z_BIAS                    RENDER | 0x14 << 24  
+#define FOG_COLOR                       RENDER | 0x15 << 24
+#define SCISSOR                         RENDER | 0x1C << 24 | 0x10 << 19
+
+
+#define RBUFFER_START_MASK          0xFFFFF000
+#define RBUFFER_SIZE_MASK           0x001FF000
+#define RBUFFER_HEAD_MASK           0x001FFFFC
+#define RBUFFER_TAIL_MASK           0x001FFFF8
+#define RINGBUFFER_SIZE             (128 * 1024)
+#define RING_SIZE_MASK              (RINGBUFFER_SIZE - 1)
+
+#define I810RES_GART                1
+#define I810RES_LRING_ACQ           2
+#define I810RES_LRING_BIND          4
+#define I810RES_OVL_ACQ             8
+#define I810RES_OVL_BIND           16
+#define I810RES_GART_ACQ           32
+#define I810RES_MMAP               64
+#define I810RES_STATE_SAVE        128
+
+#ifndef AGP_NORMAL_MEMORY
+#define AGP_NORMAL_MEMORY 0
+#endif
+
+#ifndef AGP_PHYSICAL_MEMORY
+#define AGP_PHYSICAL_MEMORY 2
+#endif
+
+struct i810_ovl_regs {
+	u32 obuf_0y;
+	u32 obuf_1y;
+	u32 obuf_0u;
+	u32 obuf_0v;
+	u32 obuf_1u;
+	u32 obuf_1v;
+	u32 ov0stride;
+	u32 yrgb_vph;
+	u32 uv_vph;
+	u32 horz_ph;
+	u32 init_ph;
+	u32 dwinpos;
+	u32 dwinsz;
+	u32 swid;
+	u32 swidqw;
+	u32 sheight;
+	u32 yrgbscale;
+	u32 uvscale;
+	u32 ov0clrc0;
+	u32 ov0clrc1;
+	u32 dclrkv;
+	u32 dclrkm;
+	u32 sclrkvh;
+	u32 sclrkvl;
+	u32 sclrkm;
+	u32 ov0conf;
+	u32 ov0cmd;
+	u32 reserved;
+	u32 awinpos;
+	u32 awinsz;
+};
+
+typedef struct {
+	CoreLayerRegionConfig config;
+	int                   planar_bug;
+} I810OverlayLayerData;
+
+
+typedef struct {
+     unsigned int   tail_mask;
+
+     int            size;
+     int            head;
+     int            tail;
+     int            space;
+} I810RingBuffer;
+
+typedef struct {
+     volatile void *virt;
+     unsigned int   tail_mask;
+     unsigned int   outring;
+} I810RingBlock;
+
+
+typedef struct {
+    bool                  initialized;
+
+    I810RingBuffer        lp_ring;
+
+    bool                  overlayOn;
+    I810OverlayLayerData *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;
+
+    u32 i810fb_version;
+    u32 cur_tail;
+    int srcaddr, destaddr, srcpitch, destpitch;
+    int color_value, color_value3d, pixeldepth, blit_color;
+    int colorkey_bit, colorkey, render_color;
+    int clip_x1, clip_x2, clip_y1, clip_y2;
+
+    /* state validation */
+	int i_src;
+	int i_dst;
+	int i_color;
+	int i_colorkey;
+	int i_clip;
+        /* 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;
+} I810DeviceData;
+
+typedef struct {
+    I810DeviceData       *idev;
+
+    volatile struct i810_ovl_regs *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;
+} I810DriverData;
+
+extern DisplayLayerFuncs i810OverlayFuncs;
+
+void i810ovlOnOff( I810DriverData       *idrv,
+                   I810DeviceData       *idev,
+                   bool                  on );
+
+
+#define i810_readb(mmio_base, where)                     \
+        *((volatile u8 *) (mmio_base + where))           \
+
+#define i810_readw(mmio_base, where)                     \
+       *((volatile u16 *) (mmio_base + where))           \
+
+#define i810_readl(mmio_base, where)                     \
+       *((volatile u32 *) (mmio_base + where))           \
+
+#define i810_writeb(mmio_base, where, val)                              \
+	*((volatile u8 *) (mmio_base + where)) = (volatile u8) val      \
+
+#define i810_writew(mmio_base, where, val)                              \
+	*((volatile u16 *) (mmio_base + where)) = (volatile u16) val    \
+
+#define i810_writel(mmio_base, where, val)                              \
+	*((volatile u32 *) (mmio_base + where)) = (volatile u32) val    \
+
+#define PUT_LRING(val) {                                          \
+        i810_writel(i810drv->lring_base, i810dev->cur_tail, val); \
+	i810dev->cur_tail += 4;                                   \
+	i810dev->cur_tail &= RING_SIZE_MASK;                      \
+}
+
+#define BEGIN_LRING i810_wait_for_space
+
+#define END_LRING(i810drv) i810_writel(LRING, i810drv->mmio_base, i810dev->cur_tail)
+
+#endif /* __I810_H__ */
diff --git a/Source/DirectFB/gfxdrivers/i810/i810_overlay.c b/Source/DirectFB/gfxdrivers/i810/i810_overlay.c
new file mode 100755
index 0000000..ccb0ffc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i810/i810_overlay.c
@@ -0,0 +1,598 @@
+/*
+   i810_overlay.c -- Video Overlay Support (based partly from
+                     XFree86 i810_video.c)
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by 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 <sys/ioctl.h>
+
+#include <string.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 <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 "i810.h"
+
+
+/*
+ * OV0CMD - Overlay Command Register
+ */
+#define	VERTICAL_CHROMINANCE_FILTER 	0x70000000
+#define VC_SCALING_OFF		0x00000000
+#define VC_LINE_REPLICATION	0x10000000
+#define VC_UP_INTERPOLATION	0x20000000
+#define VC_PIXEL_DROPPING	0x50000000
+#define VC_DOWN_INTERPOLATION	0x60000000
+#define VERTICAL_LUMINANCE_FILTER	0x0E000000
+#define VL_SCALING_OFF		0x00000000
+#define VL_LINE_REPLICATION	0x02000000
+#define VL_UP_INTERPOLATION	0x04000000
+#define VL_PIXEL_DROPPING	0x0A000000
+#define VL_DOWN_INTERPOLATION	0x0C000000
+#define	HORIZONTAL_CHROMINANCE_FILTER 	0x01C00000
+#define HC_SCALING_OFF		0x00000000
+#define HC_LINE_REPLICATION	0x00400000
+#define HC_UP_INTERPOLATION	0x00800000
+#define HC_PIXEL_DROPPING	0x01400000
+#define HC_DOWN_INTERPOLATION	0x01800000
+#define HORIZONTAL_LUMINANCE_FILTER	0x00380000
+#define HL_SCALING_OFF		0x00000000
+#define HL_LINE_REPLICATION	0x00080000
+#define HL_UP_INTERPOLATION	0x00100000
+#define HL_PIXEL_DROPPING	0x00280000
+#define HL_DOWN_INTERPOLATION	0x00300000
+
+#define Y_ADJUST		0x00010000	
+#define OV_BYTE_ORDER		0x0000C000
+#define UV_SWAP			0x00004000
+#define Y_SWAP			0x00008000
+#define Y_AND_UV_SWAP		0x0000C000
+#define SOURCE_FORMAT		0x00003C00
+#define	RGB_555			0x00000800
+#define	RGB_565			0x00000C00
+#define	YUV_422			0x00002000
+#define	YUV_411			0x00002400
+#define	YUV_420			0x00003000
+#define	YUV_410			0x00003800
+#define FIELD_MODE              0x00000020
+#define FRAME_MODE              0x00000000
+#define BUFFER_AND_FIELD	0x00000006
+#define	BUFFER0_FIELD0		0x00000000
+#define	BUFFER1_FIELD0		0x00000004
+#define OVERLAY_ENABLE		0x00000001
+
+#define UV_VERT_BUF1 		0x02
+#define UV_VERT_BUF0 		0x04
+
+#define SRC_CONSTANT_ALPHA_BLEND  1 << 31
+#define MINUV_SCALE	        0x1
+
+#define I810FB_IOC_UPDATEOVERLAY       _IOW ('F', 0xF7, struct i810_ovl_regs)
+#define I810FB_IOC_UPDATEOVERLAYCMD    _IOW ('F', 0xF6, int)
+
+extern u32 i810_wait_for_space(I810DriverData *i810drv,
+			       I810DeviceData *i810dev,
+			       u32             space   );
+
+#define I810_OVERLAY_SUPPORTED_OPTIONS (DLOP_DST_COLORKEY | DLOP_DEINTERLACING)
+
+static void ovl_calc_regs (I810DriverData        *i810drv,
+                           I810OverlayLayerData  *i810ovl,
+                           CoreLayer             *layer,
+                           CoreSurface           *surface,
+                           CoreLayerRegionConfig *config,
+                           CoreSurfaceBufferLock *lock );
+
+static void update_overlay(I810DriverData       *i810drv,
+                           I810DeviceData       *i810dev)
+{
+	i810_writel(i810drv->mmio_base, OV0ADDR, i810dev->ovl_mem.physical);
+}
+	
+void
+i810ovlOnOff( I810DriverData *idrv,
+              I810DeviceData *idev,
+              bool            on )
+{
+     if (on)
+          idrv->oregs->ov0cmd |= 1;
+     else
+          idrv->oregs->ov0cmd &= ~1;
+
+     update_overlay( idrv, idev );
+}
+
+static int
+ovlLayerDataSize( void )
+{
+	return sizeof(I810OverlayLayerData);
+}
+
+static DFBResult
+ovlInitLayer(
+              CoreLayer                  *layer,
+	      void                       *driver_data,
+	      void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+	I810OverlayLayerData *i810ovl = (I810OverlayLayerData *) layer_data;
+	I810DriverData *idrv = driver_data;
+    I810DeviceData *idev = idrv->idev;
+	
+    idev->iovl = i810ovl;
+
+    idrv->oregs = (volatile struct i810_ovl_regs*) idrv->ovl_base;
+
+    memset( (void*) idrv->oregs, 0, sizeof(struct i810_ovl_regs) );
+
+	/* set_capabilities */
+	description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION |
+		DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST | DLCAPS_SATURATION |
+		DLCAPS_DST_COLORKEY | DLCAPS_OPACITY | DLCAPS_DEINTERLACING;
+
+	description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+	/* set name */
+	snprintf( description->name,
+		  DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Intel 810/815 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->yrgb_vph  = 0;
+	idrv->oregs->uv_vph    = 0;
+	idrv->oregs->horz_ph   = 0;
+	idrv->oregs->init_ph   = 0;
+	idrv->oregs->dwinpos   = 0;
+	idrv->oregs->dwinsz    = (640 << 16) | 480;
+	idrv->oregs->swid      = 640 | (640 << 15);
+	idrv->oregs->swidqw    = (640 >> 3) | (640 << 12);
+	idrv->oregs->sheight   = 480 | (480 << 15);
+	idrv->oregs->yrgbscale = 0x80004000; /* scale factor 1 */
+	idrv->oregs->uvscale   = 0x80004000; /* scale factor 1 */
+	idrv->oregs->ov0clrc0  = 0x4000; /* brightness: 0 contrast: 1.0 */
+	idrv->oregs->ov0clrc1  = 0x80; /* saturation: bypass */
+	
+	idrv->oregs->sclrkvh = 0;
+	idrv->oregs->sclrkvl = 0;
+	idrv->oregs->sclrkm  = 0; /* source color key disable */
+	idrv->oregs->ov0conf = 0; /* two 720 pixel line buffers */
+	
+	idrv->oregs->ov0cmd = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | YUV_420;
+	
+	update_overlay( idrv, idev );
+	
+	/*
+	 * FIXME: If the fence registers are enabled, then the buffer pointers
+	 *        require specific alignment.  This is a problem with planar formats
+	 *        which have separate pointers for each of the U and V planes.  Packed
+	 *        formats should not be a problem.
+	 */
+	i810ovl->planar_bug = 0;
+	if (i810_readl(idrv->mmio_base, FENCE) & 1)
+		i810ovl->planar_bug = 1;
+
+	return DFB_OK;
+}
+
+static DFBResult
+ovlTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+	DFBDisplayLayerConfigFlags fail = 0;
+	I810OverlayLayerData *i810ovl = (I810OverlayLayerData *) layer_data;
+
+	if (config->options & ~I810_OVERLAY_SUPPORTED_OPTIONS)
+		fail |= DLCONF_OPTIONS;
+
+	switch (config->format) {
+	case DSPF_I420:
+	case DSPF_YV12:
+	case DSPF_YUY2:
+	case DSPF_UYVY:
+		break;
+	default:
+		fail |= DLCONF_PIXELFORMAT;
+	}
+	if (i810ovl->planar_bug && (config->format == DSPF_I420 ||
+				    config->format == DSPF_YV12    )) {
+		D_DEBUG("Sorry, planar formats will not work when memory tiling "
+			 "is enabled\n");
+		fail |= DLCONF_PIXELFORMAT;
+	}
+
+	if (config->width > 1440 || config->width < 1)
+		fail |= DLCONF_WIDTH;
+
+	if (config->height > 1023 || config->height < 1)
+		fail |= DLCONF_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)
+{
+	I810DriverData       *i810drv = (I810DriverData *) driver_data;
+	I810OverlayLayerData *i810ovl = (I810OverlayLayerData *) layer_data;
+
+	i810ovl->config = *config;
+
+	ovl_calc_regs (i810drv, i810ovl, layer, surface, config, lock);
+	update_overlay(i810drv, i810drv->idev);
+
+	i810ovlOnOff(i810drv, i810drv->idev, 1);
+
+	return DFB_OK;
+}
+
+static DFBResult
+ovlRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+	I810DriverData *i810drv = (I810DriverData *) driver_data;
+
+	/* disable overlay */
+	i810ovlOnOff( i810drv, i810drv->idev, 0 );
+
+	return DFB_OK;
+}
+
+static DFBResult
+ovlFlipRegion(  CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreSurface           *surface,
+                DFBSurfaceFlipFlags    flags,
+                CoreSurfaceBufferLock *lock )
+{
+	I810DriverData       *i810drv = (I810DriverData *) driver_data;
+	I810OverlayLayerData *i810ovl = (I810OverlayLayerData *) layer_data;
+	u32 current_buffer;
+
+	dfb_surface_flip( surface, false );
+
+	/* select buffer */
+	current_buffer =  (i810drv->oregs->ov0cmd & 4) >> 2;
+
+	if (current_buffer) {
+		i810drv->oregs->ov0cmd &= ~4;
+	}
+	else {
+		i810drv->oregs->ov0cmd |= 4;
+	}
+
+	ovl_calc_regs (i810drv, i810ovl, layer, surface, &i810ovl->config, lock);
+	update_overlay(i810drv, i810drv->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 )
+{
+	I810DriverData *i810drv = (I810DriverData*) driver_data;
+	
+	i810drv->oregs->ov0clrc0 = (((adj->brightness >> 8) - 128) & 0xFF) |
+		                  ((adj->contrast >> 9) << 8);
+	i810drv->oregs->ov0clrc1 = (adj->saturation >> 8) & 0xFF;
+
+	update_overlay(i810drv, i810drv->idev);
+	return DFB_OK;
+}
+	
+static DFBResult
+ovlSetInputField( CoreLayer *layer,
+		  void      *driver_data,
+		  void      *layer_data,
+		  void      *region_data,
+		  int        field )
+{
+	I810DriverData *i810drv = (I810DriverData*) driver_data;
+	
+	i810drv->oregs->ov0cmd &= ~2;
+	i810drv->oregs->ov0cmd |= (field) ? 2 : 0;
+	
+	update_overlay(i810drv, i810drv->idev);
+	return DFB_OK;
+}
+
+DisplayLayerFuncs i810OverlayFuncs = {
+     .LayerDataSize      = ovlLayerDataSize,
+     .InitLayer          = ovlInitLayer,
+     .TestRegion         = ovlTestRegion,
+     .SetRegion          = ovlSetRegion,
+     .RemoveRegion       = ovlRemoveRegion,
+     .FlipRegion         = ovlFlipRegion,
+     .SetColorAdjustment = ovlSetColorAdjustment,
+     .SetInputField      = ovlSetInputField,
+};
+
+
+static void ovl_calc_regs (I810DriverData        *i810drv,
+			   I810OverlayLayerData  *i810ovl,
+			   CoreLayer             *layer,
+			   CoreSurface           *surface,
+			   CoreLayerRegionConfig *config,
+			   CoreSurfaceBufferLock *lock )
+{
+	u32 swidth = 0, y_offset, v_offset = 0, u_offset = 0;
+	u32 drw_w, src_w, drw_h, src_h, xscaleInt, xscaleFract, yscaleInt;
+	u32 xscaleFractUV = 0, xscaleIntUV, yscaleIntUV = 0, yscaleFract, yscaleFractUV = 0;
+
+        DFBSurfacePixelFormat primary_format;
+
+	drw_w = config->dest.w;
+	drw_h = config->dest.h;
+	src_w = surface->config.size.w;
+	src_h = surface->config.size.h;
+
+	if (config->options & DLOP_DEINTERLACING)
+		src_h >>= 1;
+
+        /* reset command register except the enable bit and buffer select bits */
+	i810drv->oregs->ov0cmd &= 7;
+
+	/* Set source dimension in bytes */
+	switch (surface->config.format) {
+	case DSPF_I420:
+	case DSPF_YV12:
+		swidth = (src_w + 7) & ~7;
+		i810drv->oregs->swid = (swidth << 15) | swidth;
+		i810drv->oregs->swidqw = (swidth << 12) | (swidth >> 3);
+		break;
+	case DSPF_UYVY:
+	case DSPF_YUY2:
+		swidth = ((src_w + 3) & ~3) << 1;
+		i810drv->oregs->swid = swidth;
+		i810drv->oregs->swidqw = swidth >> 3;
+		break;
+	default:
+		break;
+	}
+	i810drv->oregs->sheight = src_h | (src_h << 15);
+
+	/* select buffer size */
+	if (swidth > 720)
+		i810drv->oregs->ov0conf = 1;
+	else
+		i810drv->oregs->ov0conf = 0;
+
+	/* set dest window position and dimension */
+	i810drv->oregs->dwinpos = (config->dest.y << 16) | config->dest.x;
+	i810drv->oregs->dwinsz = (drw_h << 16) | drw_w;
+
+	/* Set buffer pointers */
+	y_offset = (dfb_gfxcard_memory_physical(NULL, lock->offset));
+
+	switch (surface->config.format) {
+	case DSPF_I420:
+		u_offset = y_offset + surface->config.size.h * lock->pitch;
+		v_offset = u_offset + ((surface->config.size.h >> 1) * (lock->pitch >> 1));
+		break;
+	case DSPF_YV12:
+		v_offset = y_offset + surface->config.size.h * lock->pitch;
+		u_offset = v_offset + ((surface->config.size.h >> 1) * (lock->pitch >> 1));
+		break;
+	default:
+		break;
+	}
+
+	if (i810drv->oregs->ov0cmd & 4) {
+		i810drv->oregs->obuf_1y = y_offset;
+		i810drv->oregs->obuf_1v = v_offset;
+		i810drv->oregs->obuf_1u = u_offset;
+	}
+	else {
+		i810drv->oregs->obuf_0y = y_offset;
+		i810drv->oregs->obuf_0v = v_offset;
+		i810drv->oregs->obuf_0u = u_offset;
+	}
+
+	/* set scaling */
+	i810drv->oregs->yrgbscale = 0x80004000;
+	i810drv->oregs->uvscale = 0x80004000;
+
+	i810drv->oregs->ov0cmd |= VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | FRAME_MODE;
+
+	if (config->options & DLOP_DEINTERLACING)
+		i810drv->oregs->ov0cmd |= FIELD_MODE;
+
+	if ((drw_w != src_w) || (drw_h != src_h))
+	{
+		xscaleInt = (src_w / drw_w) & 0x3;
+		xscaleFract = (src_w << 12) / drw_w;
+		yscaleInt = (src_h / drw_h) & 0x3;
+		yscaleFract = (src_h << 12) / drw_h;
+
+		i810drv->oregs->yrgbscale = (xscaleInt << 15) |
+			((xscaleFract & 0xFFF) << 3) |
+			(yscaleInt) |
+			((yscaleFract & 0xFFF) << 20);
+
+		if (drw_w > src_w)
+		{
+			i810drv->oregs->ov0cmd &= ~HORIZONTAL_CHROMINANCE_FILTER;
+			i810drv->oregs->ov0cmd &= ~HORIZONTAL_LUMINANCE_FILTER;
+			i810drv->oregs->ov0cmd |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION);
+		}
+
+		if (drw_h > src_h)
+		{
+			i810drv->oregs->ov0cmd &= ~VERTICAL_CHROMINANCE_FILTER;
+			i810drv->oregs->ov0cmd &= ~VERTICAL_LUMINANCE_FILTER;
+			i810drv->oregs->ov0cmd |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION);
+		}
+
+		if (drw_w < src_w)
+		{
+			i810drv->oregs->ov0cmd &= ~HORIZONTAL_CHROMINANCE_FILTER;
+			i810drv->oregs->ov0cmd &= ~HORIZONTAL_LUMINANCE_FILTER;
+			i810drv->oregs->ov0cmd |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION);
+		}
+		
+		if (drw_h < src_h)
+		{
+			i810drv->oregs->ov0cmd &= ~VERTICAL_CHROMINANCE_FILTER;
+			i810drv->oregs->ov0cmd &= ~VERTICAL_LUMINANCE_FILTER;
+			i810drv->oregs->ov0cmd |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION);
+		}
+
+		if (xscaleFract)
+		{
+			xscaleFractUV = xscaleFract >> MINUV_SCALE;
+			i810drv->oregs->ov0cmd &= ~HC_DOWN_INTERPOLATION;
+			i810drv->oregs->ov0cmd |= HC_UP_INTERPOLATION;
+		}
+		
+		if (xscaleInt)
+		{
+			xscaleIntUV = xscaleInt >> MINUV_SCALE;
+			if (xscaleIntUV)
+			{
+				i810drv->oregs->ov0cmd &= ~HC_UP_INTERPOLATION;
+			}
+		}
+		
+		if (yscaleFract)
+		{
+			yscaleFractUV = yscaleFract >> MINUV_SCALE;
+			i810drv->oregs->ov0cmd &= ~VC_DOWN_INTERPOLATION;
+			i810drv->oregs->ov0cmd |= VC_UP_INTERPOLATION;
+		}
+		
+		if (yscaleInt)
+		{
+			yscaleIntUV = yscaleInt >> MINUV_SCALE;
+			if (yscaleIntUV)
+			{
+				i810drv->oregs->ov0cmd &= ~VC_UP_INTERPOLATION;
+				i810drv->oregs->ov0cmd |= VC_DOWN_INTERPOLATION;
+			}
+		}
+		
+		i810drv->oregs->uvscale = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) |
+	                   ((yscaleFractUV & 0xFFF) << 20);
+	}
+	
+	switch(surface->config.format) {
+	case DSPF_YV12:
+	case DSPF_I420:
+		/* set UV vertical phase to -0.25 */
+		i810drv->oregs->uv_vph = 0x30003000;
+		i810drv->oregs->init_ph = UV_VERT_BUF0 | UV_VERT_BUF1;
+		i810drv->oregs->ov0stride = (lock->pitch) | (lock->pitch << 15);
+		i810drv->oregs->ov0cmd &= ~SOURCE_FORMAT;
+		i810drv->oregs->ov0cmd |= YUV_420;
+		break;
+	case DSPF_UYVY:
+	case DSPF_YUY2:
+		i810drv->oregs->uv_vph = 0;
+		i810drv->oregs->init_ph = 0;
+		i810drv->oregs->ov0stride = lock->pitch;
+		i810drv->oregs->ov0cmd &= ~SOURCE_FORMAT;
+		i810drv->oregs->ov0cmd |= YUV_422;
+		i810drv->oregs->ov0cmd &= ~OV_BYTE_ORDER;
+		if (surface->config.format == DSPF_UYVY)
+			i810drv->oregs->ov0cmd |= Y_SWAP;
+		break;
+	default:
+		D_BUG("unexpected pixelformat");
+		break;
+	}
+
+	/* Set alpha window */
+	i810drv->oregs->awinpos = i810drv->oregs->dwinpos;
+	i810drv->oregs->awinsz = i810drv->oregs->dwinsz;
+
+
+    /*
+     * Destination color keying.
+     */
+
+    primary_format = dfb_primary_layer_pixelformat();
+
+    i810drv->oregs->dclrkv = dfb_color_to_pixel( primary_format,
+                                                 config->dst_key.r,
+                                                 config->dst_key.g,
+                                                 config->dst_key.b );
+
+    i810drv->oregs->dclrkm = (1 << DFB_COLOR_BITS_PER_PIXEL( primary_format )) - 1;
+
+    if (config->options & DLOP_DST_COLORKEY)
+         i810drv->oregs->dclrkm |= 0x80000000;
+}
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);
+}
+
diff --git a/Source/DirectFB/gfxdrivers/mach64/Makefile.am b/Source/DirectFB/gfxdrivers/mach64/Makefile.am
new file mode 100755
index 0000000..89b9a0e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/Makefile.am
@@ -0,0 +1,39 @@
+## Makefile.am for DirectFB/gfxdrivers/mach64
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+mach64_LTLIBRARIES = libdirectfb_mach64.la
+
+if BUILD_STATIC
+mach64_DATA = $(mach64_LTLIBRARIES:.la=.o)
+endif
+
+mach64dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_mach64_la_SOURCES =	\
+	mach64.c		\
+	mach64.h		\
+	mach64_state.c		\
+	mach64_state.h		\
+	mach64_overlay.c	\
+	regs.h			\
+	mmio.h
+
+libdirectfb_mach64_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_mach64_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/mach64/Makefile.in b/Source/DirectFB/gfxdrivers/mach64/Makefile.in
new file mode 100755
index 0000000..edcb305
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/Makefile.in
@@ -0,0 +1,603 @@
+# 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/mach64
+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)$(mach64dir)" "$(DESTDIR)$(mach64dir)"
+mach64LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(mach64_LTLIBRARIES)
+libdirectfb_mach64_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_mach64_la_OBJECTS = mach64.lo mach64_state.lo \
+	mach64_overlay.lo
+libdirectfb_mach64_la_OBJECTS = $(am_libdirectfb_mach64_la_OBJECTS)
+libdirectfb_mach64_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_mach64_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_mach64_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_mach64_la_SOURCES)
+mach64DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(mach64_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+mach64_LTLIBRARIES = libdirectfb_mach64.la
+@BUILD_STATIC_TRUE@mach64_DATA = $(mach64_LTLIBRARIES:.la=.o)
+mach64dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_mach64_la_SOURCES = \
+	mach64.c		\
+	mach64.h		\
+	mach64_state.c		\
+	mach64_state.h		\
+	mach64_overlay.c	\
+	regs.h			\
+	mmio.h
+
+libdirectfb_mach64_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_mach64_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/mach64/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/mach64/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-mach64LTLIBRARIES: $(mach64_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(mach64dir)" || $(MKDIR_P) "$(DESTDIR)$(mach64dir)"
+	@list='$(mach64_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(mach64LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(mach64dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(mach64LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(mach64dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-mach64LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(mach64_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(mach64dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(mach64dir)/$$p"; \
+	done
+
+clean-mach64LTLIBRARIES:
+	-test -z "$(mach64_LTLIBRARIES)" || rm -f $(mach64_LTLIBRARIES)
+	@list='$(mach64_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_mach64.la: $(libdirectfb_mach64_la_OBJECTS) $(libdirectfb_mach64_la_DEPENDENCIES) 
+	$(libdirectfb_mach64_la_LINK) -rpath $(mach64dir) $(libdirectfb_mach64_la_OBJECTS) $(libdirectfb_mach64_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64_state.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-mach64DATA: $(mach64_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(mach64dir)" || $(MKDIR_P) "$(DESTDIR)$(mach64dir)"
+	@list='$(mach64_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(mach64DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(mach64dir)/$$f'"; \
+	  $(mach64DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(mach64dir)/$$f"; \
+	done
+
+uninstall-mach64DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(mach64_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(mach64dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(mach64dir)/$$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)$(mach64dir)" "$(DESTDIR)$(mach64dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-mach64LTLIBRARIES \
+	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-mach64DATA install-mach64LTLIBRARIES
+
+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-mach64DATA uninstall-mach64LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-mach64LTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-mach64DATA install-mach64LTLIBRARIES 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-mach64DATA uninstall-mach64LTLIBRARIES
+
+%.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/mach64/mach64.c b/Source/DirectFB/gfxdrivers/mach64/mach64.c
new file mode 100755
index 0000000..84fd571
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mach64.c
@@ -0,0 +1,1640 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.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>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+
+#include <core/graphics_driver.h>
+
+
+DFB_GRAPHICS_DRIVER( mach64 )
+
+
+#include "regs.h"
+#include "mmio.h"
+#include "mach64_state.h"
+#include "mach64.h"
+
+
+/* driver capability flags */
+
+
+#define MACH64_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_DST_COLORKEY | DSDRAW_SRC_PREMULTIPLY)
+
+#define MACH64_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_SRC_COLORKEY | DSBLIT_DST_COLORKEY)
+
+#define MACH64_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE)
+
+#define MACH64_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT)
+
+
+#define MACH64GT_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_DST_COLORKEY | DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY)
+
+#define MACH64GT_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_SRC_COLORKEY | DSBLIT_DST_COLORKEY | DSBLIT_BLEND_COLORALPHA | \
+                DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE | DSBLIT_DEINTERLACE | \
+                DSBLIT_SRC_PREMULTCOLOR)
+
+#define MACH64GT_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE | DFXL_FILLTRIANGLE)
+
+#define MACH64GT_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT)
+
+
+static bool mach64DrawLine2D( void *drv, void *dev, DFBRegion *line );
+static bool mach64DrawLine3D( void *drv, void *dev, DFBRegion *line );
+
+static bool mach64Blit2D( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+
+static bool mach64BlitScaleOld( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+static bool mach64StretchBlitScaleOld( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect );
+
+static bool mach64BlitScale( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+static bool mach64StretchBlitScale( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect );
+
+static bool mach64BlitTexOld( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+static bool mach64StretchBlitTexOld( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect );
+
+static bool mach64BlitTex( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+static bool mach64StretchBlitTex( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect );
+
+/* required implementations */
+
+static void mach64EngineReset( void *drv, void *dev )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitidle( mdrv, mdev );
+
+     mach64_waitfifo( mdrv, mdev, 2 );
+
+     mach64_out32( mmio, DP_WRITE_MSK, 0xFFFFFFFF );
+     mach64_out32( mmio, DP_MIX, FRGD_MIX_SRC | BKGD_MIX_DST );
+
+     if (mdrv->accelerator == FB_ACCEL_ATI_MACH64GT) {
+          mach64_waitfifo( mdrv, mdev, 12 );
+
+          /* Some 3D registers aren't accessible without this. */
+          mach64_out32( mmio, SCALE_3D_CNTL, SCALE_3D_FCN_SHADE );
+
+          mach64_out32( mmio, SRC_CNTL, 0 );
+          mach64_out32( mmio, Z_CNTL, 0 );
+
+          mach64_out32( mmio, RED_X_INC, 0 );
+          mach64_out32( mmio, RED_Y_INC, 0 );
+          mach64_out32( mmio, GREEN_X_INC, 0 );
+          mach64_out32( mmio, GREEN_Y_INC, 0 );
+          mach64_out32( mmio, BLUE_X_INC, 0 );
+          mach64_out32( mmio, BLUE_Y_INC, 0 );
+          mach64_out32( mmio, ALPHA_X_INC, 0 );
+          mach64_out32( mmio, ALPHA_Y_INC, 0 );
+
+          mach64_out32( mmio, SCALE_3D_CNTL, 0 );
+     }
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO)
+          mach64_out32( mmio, HW_DEBUG, mdev->hw_debug );
+}
+
+static DFBResult mach64EngineSync( void *drv, void *dev )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64_waitidle( mdrv, mdev );
+
+     return DFB_OK;
+}
+
+static void mach64FlushTextureCache( void *drv, void *dev )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          mach64_waitfifo( mdrv, mdev, 1 );
+          mach64_out32( mmio, TEX_CNTL, TEX_CACHE_FLUSH );
+     }
+}
+
+static bool mach64_use_scaler( Mach64DeviceData *mdev,
+                               CardState *state, DFBAccelerationMask accel )
+{
+     if (accel & DFXL_STRETCHBLIT ||
+         state->source->config.format != state->destination->config.format ||
+         state->blittingflags & (DSBLIT_BLEND_COLORALPHA | DSBLIT_DEINTERLACE))
+          return true;
+
+     return false;
+}
+
+static bool mach64_use_tex( Mach64DeviceData *mdev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                 DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+          return true;
+
+     /*
+      * 3D Rage II chips lock up if the scaler is used with destination
+      * color keying. Using the texture engine works however.
+      */
+     if (mdev->chip < CHIP_3D_RAGE_PRO &&
+         mach64_use_scaler( mdev, state, accel ) &&
+         state->blittingflags & DSBLIT_DST_COLORKEY)
+          return true;
+
+     return false;
+}
+
+static bool mach64_use_scaler_3d( Mach64DeviceData *mdev,
+                                  CardState *state, DFBAccelerationMask accel )
+{
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & DSDRAW_BLEND)
+               return true;
+     } else {
+          if (accel & DFXL_STRETCHBLIT ||
+              state->source->config.format != state->destination->config.format ||
+              state->blittingflags & (DSBLIT_BLEND_COLORALPHA | DSBLIT_DEINTERLACE |
+                                      DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE |
+                                      DSBLIT_SRC_PREMULTCOLOR))
+               return true;
+     }
+
+     return false;
+}
+
+static bool mach64_check_blend( Mach64DeviceData *mdev, CardState *state )
+{
+     switch (state->src_blend) {
+          case DSBF_SRCCOLOR:
+          case DSBF_INVSRCCOLOR:
+               return false;
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+          case DSBF_SRCALPHASAT:
+               if (mdev->chip < CHIP_3D_RAGE_PRO)
+                    return false;
+          default:
+               break;
+     }
+
+     switch (state->dst_blend) {
+          case DSBF_DESTCOLOR:
+          case DSBF_INVDESTCOLOR:
+          case DSBF_SRCALPHASAT:
+               return false;
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+               if (mdev->chip < CHIP_3D_RAGE_PRO)
+                    return false;
+          default:
+               break;
+     }
+
+     return true;
+}
+
+static void mach64CheckState( void *drv, void *dev,
+                              CardState *state, DFBAccelerationMask accel )
+{
+     switch (state->destination->config.format) {
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MACH64_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          state->accel |= MACH64_SUPPORTED_DRAWINGFUNCTIONS;
+     } else {
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          if (state->blittingflags & ~MACH64_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          /* Can't do source and destination color keying at the same time. */
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY &&
+              state->blittingflags & DSBLIT_DST_COLORKEY)
+               return;
+
+          state->accel |= MACH64_SUPPORTED_BLITTINGFUNCTIONS;
+     }
+}
+
+static void mach64GTCheckState( void *drv, void *dev,
+                                CardState *state, DFBAccelerationMask accel )
+{
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     switch (state->destination->config.format) {
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               /* Not supported. */
+               if (mdev->chip < CHIP_3D_RAGE_PRO)
+                    return;
+
+               /* Causes the chip to lock up. */
+               if (mdev->chip < CHIP_3D_RAGE_XLXC &&
+                   mach64_use_scaler_3d( mdev, state, accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MACH64GT_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              !mach64_check_blend( mdev, state ))
+               return;
+
+          /* Causes the chip to lock up. */
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->drawingflags & DSDRAW_DST_COLORKEY)
+               return;
+
+          state->accel |= MACH64GT_SUPPORTED_DRAWINGFUNCTIONS;
+     } else {
+          CoreSurface *source = state->source;
+
+          switch (source->config.format) {
+               case DSPF_RGB332:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    break;
+               default:
+                    return;
+          }
+
+          if (state->blittingflags & ~MACH64GT_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA) &&
+              !mach64_check_blend( mdev, state ))
+               return;
+
+          /* Can't do alpha modulation. */
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL &&
+              state->blittingflags & DSBLIT_BLEND_COLORALPHA)
+               return;
+
+          /* Can't do source and destination color keying at the same time. */
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY &&
+              state->blittingflags & DSBLIT_DST_COLORKEY)
+               return;
+
+          /* Causes the chip to lock up. */
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA) &&
+              state->blittingflags & DSBLIT_DST_COLORKEY)
+               return;
+
+          if (mach64_use_tex( mdev, state, accel )) {
+               /* Max texture size is 1024x1024. */
+               if (source->config.size.w > 1024 || source->config.size.h > 1024)
+                    return;
+
+               state->accel |= MACH64GT_SUPPORTED_BLITTINGFUNCTIONS;
+          } else if (mach64_use_scaler( mdev, state, accel )) {
+               /* Max scaler source size depends on the chip type. */
+               if (mdev->chip < CHIP_3D_RAGE_PRO) {
+                    /* Tested on 3D Rage II+ and IIC. */
+                    if (source->config.size.w > 4095 || source->config.size.h > 4095)
+                         return;
+               } else {
+                    /* Tested on 3D Rage LT Pro, XL and Mobility. */
+                    if (source->config.size.w > 4096 || source->config.size.h > 16384)
+                         return;
+               }
+
+               state->accel |= MACH64GT_SUPPORTED_BLITTINGFUNCTIONS;
+          } else
+               state->accel |= accel;
+     }
+}
+
+static void mach64SetState( void *drv, void *dev,
+                            GraphicsDeviceFuncs *funcs,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     if (state->mod_hw == SMF_ALL) {
+          mdev->valid = 0;
+     } else if (state->mod_hw) {
+          if (state->mod_hw & SMF_SOURCE)
+               MACH64_INVALIDATE( m_source | m_srckey );
+
+          if (state->mod_hw & SMF_SRC_COLORKEY)
+               MACH64_INVALIDATE( m_srckey );
+
+          if (state->mod_hw & SMF_DESTINATION)
+               MACH64_INVALIDATE( m_color | m_dstkey );
+
+          if (state->mod_hw & SMF_COLOR)
+               MACH64_INVALIDATE( m_color );
+
+          if (state->mod_hw & SMF_DST_COLORKEY)
+               MACH64_INVALIDATE( m_dstkey );
+
+          if (state->mod_hw & SMF_BLITTING_FLAGS)
+               MACH64_INVALIDATE( m_srckey | m_dstkey | m_disable_key );
+
+          if (state->mod_hw & SMF_DRAWING_FLAGS)
+               MACH64_INVALIDATE( m_color | m_dstkey | m_disable_key );
+     }
+
+     if (state->mod_hw & SMF_DESTINATION)
+          mach64_set_destination( mdrv, mdev, state );
+
+     switch (accel) {
+     case DFXL_FILLRECTANGLE:
+     case DFXL_DRAWRECTANGLE:
+     case DFXL_DRAWLINE:
+          mach64_waitfifo( mdrv, mdev, 2 );
+          mach64_out32( mmio, DP_SRC, FRGD_SRC_FRGD_CLR );
+          mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+          mach64_set_color( mdrv, mdev, state );
+
+          if (state->drawingflags & DSDRAW_DST_COLORKEY)
+               mach64_set_dst_colorkey( mdrv, mdev, state );
+          else
+               mach64_disable_colorkey( mdrv, mdev );
+
+          funcs->DrawLine = mach64DrawLine2D;
+
+          state->set = DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE;
+          break;
+     case DFXL_BLIT:
+          mach64_set_source( mdrv, mdev, state );
+
+          mach64_waitfifo( mdrv, mdev, 2 );
+          mach64_out32( mmio, DP_SRC, FRGD_SRC_BLIT );
+          mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+          if (state->blittingflags & DSBLIT_DST_COLORKEY)
+               mach64_set_dst_colorkey( mdrv, mdev, state );
+          else if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+               mach64_set_src_colorkey( mdrv, mdev, state );
+          else
+               mach64_disable_colorkey( mdrv, mdev );
+
+          funcs->Blit = mach64Blit2D;
+
+          state->set = DFXL_BLIT;
+          break;
+     default:
+          D_BUG( "unexpected drawing/blitting function" );
+          break;
+     }
+
+     if (state->mod_hw & SMF_CLIP) {
+          mach64_set_clip( mdrv, mdev, state );
+          mdev->clip = state->clip;
+     }
+
+     state->mod_hw = 0;
+}
+
+static void mach64GTSetState( void *drv, void *dev,
+                              GraphicsDeviceFuncs *funcs,
+                              CardState *state, DFBAccelerationMask accel )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     bool use_scaler_3d;
+
+     if (state->mod_hw == SMF_ALL) {
+          mdev->valid = 0;
+     } else if (state->mod_hw) {
+          if (state->mod_hw & SMF_SOURCE)
+               MACH64_INVALIDATE( m_source | m_source_scale | m_srckey | m_srckey_scale | m_blit_blend );
+
+          if (state->mod_hw & SMF_SRC_COLORKEY)
+               MACH64_INVALIDATE( m_srckey | m_srckey_scale );
+
+          if (state->mod_hw & SMF_DESTINATION)
+               MACH64_INVALIDATE( m_color | m_dstkey );
+
+          if (state->mod_hw & SMF_COLOR)
+               MACH64_INVALIDATE( m_color | m_color_3d | m_color_tex );
+
+          if (state->mod_hw & SMF_DST_COLORKEY)
+               MACH64_INVALIDATE( m_dstkey );
+
+          if (state->mod_hw & SMF_BLITTING_FLAGS)
+               MACH64_INVALIDATE( m_color_tex | m_source_scale | m_srckey | m_srckey_scale | m_dstkey | m_disable_key | m_blit_blend );
+
+          if (state->mod_hw & SMF_DRAWING_FLAGS)
+               MACH64_INVALIDATE( m_color | m_color_3d | m_dstkey | m_disable_key | m_draw_blend );
+
+          if (state->mod_hw & (SMF_SRC_BLEND | SMF_DST_BLEND))
+               MACH64_INVALIDATE( m_draw_blend | m_blit_blend );
+     }
+
+     use_scaler_3d = mach64_use_scaler_3d( mdev, state, accel );
+
+     /* At least 3D Rage II+ and IIC chips _will_ lock up without this. */
+     if (mdev->chip < CHIP_3D_RAGE_PRO && use_scaler_3d != mdev->use_scaler_3d)
+          mach64_waitidle( mdrv, mdev );
+
+     mdev->use_scaler_3d = use_scaler_3d;
+
+     if (state->mod_hw & SMF_DESTINATION)
+          mach64gt_set_destination( mdrv, mdev, state );
+
+     switch (accel) {
+     case DFXL_FILLRECTANGLE:
+     case DFXL_DRAWRECTANGLE:
+     case DFXL_DRAWLINE:
+     case DFXL_FILLTRIANGLE:
+          if (use_scaler_3d) {
+               mach64_waitfifo( mdrv, mdev, 3 );
+               /* Some 3D registers aren't accessible without this. */
+               mach64_out32( mmio, SCALE_3D_CNTL, SCALE_3D_FCN_SHADE );
+
+               mach64_out32( mmio, DP_SRC, FRGD_SRC_SCALE );
+               mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+               mach64_set_color_3d( mdrv, mdev, state );
+
+               mach64_set_draw_blend( mdrv, mdev, state );
+
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, SCALE_3D_CNTL, SCALE_3D_FCN_SHADE | mdev->draw_blend );
+
+               funcs->DrawLine = mach64DrawLine3D;
+          } else {
+               mach64_waitfifo( mdrv, mdev, 3 );
+               mach64_out32( mmio, SCALE_3D_CNTL, 0 );
+
+               mach64_out32( mmio, DP_SRC, FRGD_SRC_FRGD_CLR );
+               mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+               mach64_set_color( mdrv, mdev, state );
+
+               funcs->DrawLine = mach64DrawLine2D;
+          }
+
+          if (state->drawingflags & DSDRAW_DST_COLORKEY)
+               mach64_set_dst_colorkey( mdrv, mdev, state );
+          else
+               mach64_disable_colorkey( mdrv, mdev );
+
+          state->set = DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE | DFXL_FILLTRIANGLE;
+          break;
+     case DFXL_BLIT:
+     case DFXL_STRETCHBLIT:
+          mdev->blit_deinterlace = state->blittingflags & DSBLIT_DEINTERLACE;
+
+          if (use_scaler_3d) {
+               mach64_waitfifo( mdrv, mdev, 1 );
+               /* Some 3D registers aren't accessible without this. */
+               mach64_out32( mmio, SCALE_3D_CNTL, SCALE_3D_FCN_SHADE );
+
+               mach64gt_set_source_scale( mdrv, mdev, state );
+
+               mach64_waitfifo( mdrv, mdev, 2 );
+               mach64_out32( mmio, DP_SRC, FRGD_SRC_SCALE );
+               mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+               if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                           DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+                    mach64_set_color_tex( mdrv, mdev, state );
+
+               mach64_set_blit_blend( mdrv, mdev, state );
+
+               if (state->blittingflags & DSBLIT_DST_COLORKEY)
+                    mach64_set_dst_colorkey( mdrv, mdev, state );
+               else if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    mach64_set_src_colorkey_scale( mdrv, mdev, state );
+               else
+                    mach64_disable_colorkey( mdrv, mdev );
+
+               if (mdev->chip < CHIP_3D_RAGE_PRO) {
+                    if (mach64_use_tex( mdev, state, accel )) {
+                         funcs->Blit        = mach64BlitTexOld;
+                         funcs->StretchBlit = mach64StretchBlitTexOld;
+                    } else {
+                         funcs->Blit        = mach64BlitScaleOld;
+                         funcs->StretchBlit = mach64StretchBlitScaleOld;
+                    }
+               } else {
+                    if (mach64_use_tex( mdev, state, accel )) {
+                         funcs->Blit        = mach64BlitTex;
+                         funcs->StretchBlit = mach64StretchBlitTex;
+                    } else {
+                         funcs->Blit        = mach64BlitScale;
+                         funcs->StretchBlit = mach64StretchBlitScale;
+                    }
+               }
+
+               state->set = DFXL_BLIT | DFXL_STRETCHBLIT;
+          } else {
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, SCALE_3D_CNTL, 0 );
+
+               mach64gt_set_source( mdrv, mdev, state );
+
+               mach64_waitfifo( mdrv, mdev, 2 );
+               mach64_out32( mmio, DP_SRC, FRGD_SRC_BLIT );
+               mach64_out32( mmio, DP_PIX_WIDTH, mdev->pix_width );
+
+               if (state->blittingflags & DSBLIT_DST_COLORKEY)
+                    mach64_set_dst_colorkey( mdrv, mdev, state );
+               else if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    mach64_set_src_colorkey( mdrv, mdev, state );
+               else
+                    mach64_disable_colorkey( mdrv, mdev );
+
+               funcs->Blit = mach64Blit2D;
+
+               state->set = DFXL_BLIT;
+          }
+          break;
+     default:
+          D_BUG( "unexpected drawing/blitting function" );
+          break;
+     }
+
+     if (state->mod_hw & SMF_CLIP) {
+          mach64_set_clip( mdrv, mdev, state );
+          mdev->clip = state->clip;
+     }
+
+     state->mod_hw = 0;
+}
+
+/* */
+
+static bool mach64FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( rect->x ) << 16) | S14( rect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (rect->w << 16) | rect->h );
+
+     return true;
+}
+
+static bool mach64DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     int x2 = rect->x + rect->w - 1;
+     int y2 = rect->y + rect->h - 1;
+
+     mach64_waitfifo( mdrv, mdev, 8 );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( rect->x ) << 16) | S14( rect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | rect->h );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (rect->w << 16) | 1 );
+
+     mach64_out32( mmio, DST_CNTL, 0 );
+     mach64_out32( mmio, DST_Y_X, (S13( x2 ) << 16) | S14( y2 ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | rect->h );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (rect->w << 16) | 1 );
+
+     return true;
+}
+
+static void mach64_draw_line( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev,
+                              int x1, int y1,
+                              int x2, int y2,
+                              bool draw_3d )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 dst_cntl = 0;
+     int   dx, dy;
+
+     dx = x2 - x1;
+     dy = y2 - y1;
+
+     if (dx < 0)
+          dx = -dx;
+     else
+          dst_cntl |= DST_X_DIR;
+
+     if (dy < 0)
+          dy = -dy;
+     else
+          dst_cntl |= DST_Y_DIR;
+
+     if (!dx || !dy) {
+          /* horizontal / vertical line */
+          mach64_waitfifo( mdrv, mdev, 3 );
+
+          mach64_out32( mmio, DST_CNTL, dst_cntl);
+          mach64_out32( mmio, DST_Y_X, (S13( x1 ) << 16) | S14( y1 ) );
+          mach64_out32( mmio, DST_HEIGHT_WIDTH, ((dx+1) << 16) | (dy+1) );
+
+          return;
+     }
+
+     if (dx < dy) {
+          int tmp = dx;
+          dx = dy;
+          dy = tmp;
+          dst_cntl |= DST_Y_MAJOR;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 6 );
+
+     mach64_out32( mmio, DST_CNTL, DST_LAST_PEL | dst_cntl );
+     mach64_out32( mmio, DST_Y_X, (S13( x1 ) << 16) | S14( y1 ) );
+
+     /* Bresenham parameters must be calculated differently
+      * for the 2D and 3D engines.
+      */
+     if (draw_3d) {
+          mach64_out32( mmio, DST_BRES_ERR, -dx );
+          mach64_out32( mmio, DST_BRES_INC, 2*dy );
+          mach64_out32( mmio, DST_BRES_DEC, -2*dx );
+          mach64_out32( mmio, DST_BRES_LNTH, dx+1 );
+     } else {
+          mach64_out32( mmio, DST_BRES_ERR, 2*dy-dx );
+          mach64_out32( mmio, DST_BRES_INC, 2*dy );
+          mach64_out32( mmio, DST_BRES_DEC, 2*dy-2*dx );
+          mach64_out32( mmio, DST_BRES_LNTH, dx+1 );
+     }
+}
+
+static bool mach64DrawLine2D( void *drv, void *dev, DFBRegion *line )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64_draw_line( mdrv, mdev,
+                       line->x1, line->y1,
+                       line->x2, line->y2,
+                       false );
+
+     return true;
+}
+
+static bool mach64DrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64_draw_line( mdrv, mdev,
+                       line->x1, line->y1,
+                       line->x2, line->y2,
+                       true );
+
+     return true;
+}
+
+static void mach64_fill_trapezoid( Mach64DriverData *mdrv,
+                                   Mach64DeviceData *mdev,
+                                   int X1l, int X1r,
+                                   int X2l, int X2r,
+                                   int Y, int dY )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 dst_cntl;
+     int   dXl, dXr;
+
+     X1r++; X2r++;
+
+     dst_cntl = DST_Y_DIR | TRAP_FILL_DIR;
+
+     dXl = X2l - X1l;
+     if (dXl < 0)
+          dXl = -dXl;
+     else
+          dst_cntl |= DST_X_DIR;
+
+     dXr = X2r - X1r;
+     if (dXr < 0)
+          dXr = -dXr;
+     else
+          dst_cntl |= TRAIL_X_DIR;
+
+     mach64_waitfifo( mdrv, mdev, 9 );
+
+     mach64_out32( mmio, DST_CNTL, dst_cntl );
+     mach64_out32( mmio, DST_Y_X, (S13( X1l ) << 16) | S14( Y ) );
+
+     mach64_out32( mmio, LEAD_BRES_ERR, -dY );
+     mach64_out32( mmio, LEAD_BRES_INC,  2*dXl );
+     mach64_out32( mmio, LEAD_BRES_DEC, -2*dY );
+
+     mach64_out32( mmio, TRAIL_BRES_ERR, -dY );
+     mach64_out32( mmio, TRAIL_BRES_INC,  2*dXr );
+     mach64_out32( mmio, TRAIL_BRES_DEC, -2*dY );
+
+     mach64_out32( mmio, LEAD_BRES_LNTH, (S14( X1r ) << 16) | (dY+1) | DRAW_TRAP | LINE_DIS );
+}
+
+static bool mach64FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     dfb_sort_triangle( tri );
+
+     if (tri->y2 == tri->y3) {
+          mach64_fill_trapezoid( mdrv, mdev,
+                                 tri->x1, tri->x1,
+                                 MIN( tri->x2, tri->x3), MAX( tri->x2, tri->x3 ),
+                                 tri->y1, tri->y3 - tri->y1 );
+     } else if (tri->y1 == tri->y2) {
+          mach64_fill_trapezoid( mdrv, mdev,
+                                 MIN( tri->x1, tri->x2), MAX( tri->x1, tri->x2 ),
+                                 tri->x3, tri->x3,
+                                 tri->y1, tri->y3 - tri->y1 );
+     } else {
+          int majDx = tri->x3 - tri->x1;
+          int majDy = tri->y3 - tri->y1;
+          int topDx = tri->x2 - tri->x1;
+          int topDy = tri->y2 - tri->y1;
+          int botDy = tri->y3 - tri->y2;
+
+          int topXperY = (topDx << 20) / topDy;
+          int X2a = tri->x1 + (((topXperY * topDy) + (1<<19)) >> 20);
+
+          int majXperY = (majDx << 20) / majDy;
+          int majX2  = tri->x1 + (((majXperY * topDy) + (1<<19)) >> 20);
+          int majX2a = majX2 - ((majXperY + (1<<19)) >> 20);
+
+          mach64_fill_trapezoid( mdrv, mdev,
+                                 tri->x1, tri->x1,
+                                 MIN( X2a, majX2a ), MAX( X2a, majX2a ),
+                                 tri->y1, topDy - 1 );
+          mach64_fill_trapezoid( mdrv, mdev,
+                                 MIN( tri->x2, majX2 ), MAX( tri->x2, majX2 ),
+                                 tri->x3, tri->x3,
+                                 tri->y2, botDy );
+     }
+
+     return true;
+}
+
+static void mach64DoBlit2D( Mach64DriverData *mdrv,
+                            Mach64DeviceData *mdev,
+                            DFBRectangle *srect,
+                            DFBRectangle *drect )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 dst_cntl = 0;
+
+     if (srect->x <= drect->x) {
+          srect->x += srect->w - 1;
+          drect->x += drect->w - 1;
+     } else
+          dst_cntl |= DST_X_DIR;
+
+     if (srect->y <= drect->y) {
+          srect->y += srect->h - 1;
+          drect->y += drect->h - 1;
+     } else
+          dst_cntl |= DST_Y_DIR;
+
+     mach64_waitfifo( mdrv, mdev, 5 );
+
+     mach64_out32( mmio, SRC_Y_X, (S13( srect->x ) << 16) | S14( srect->y ) );
+     mach64_out32( mmio, SRC_HEIGHT1_WIDTH1, (srect->w << 16) | srect->h );
+
+     mach64_out32( mmio, DST_CNTL, dst_cntl );
+     mach64_out32( mmio, DST_Y_X, (S13( drect->x ) << 16) | S14( drect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (drect->w << 16) | drect->h );
+}
+
+static void mach64DoBlitScaleOld( Mach64DriverData *mdrv,
+                                  Mach64DeviceData *mdev,
+                                  DFBRectangle     *srect,
+                                  DFBRectangle     *drect,
+                                  bool              filter )
+{
+     volatile u8 *mmio     = mdrv->mmio_base;
+     CoreSurface   *source = mdev->source;
+
+     u32 scale_3d_cntl = SCALE_3D_FCN_SCALE | mdev->blit_blend;
+     int   hacc, vacc;
+
+     if (!filter)
+          scale_3d_cntl |= SCALE_PIX_REP;
+
+     if (mdev->blit_deinterlace) {
+          srect->y /= 2;
+          srect->h /= 2;
+     }
+
+     srect->x <<= 16;
+     srect->y <<= 16;
+     srect->w <<= 16;
+     srect->h <<= 16;
+
+     /*
+      * SCALE_HACC and SCALE_VACC have limited scale so we need to change
+      * SCALE_Y_OFF in order to handle the full range of source coordinates.
+      */
+     hacc = srect->x & 0xFFFF0; /* s4.12 */
+     vacc = srect->y & 0xFFFF0; /* s4.12 */
+     srect->x &= ~0xFFFFF;
+     srect->y &= ~0xFFFFF;
+
+     mach64_waitfifo( mdrv, mdev, 14 );
+
+     mach64_out32( mmio, SCALE_3D_CNTL, scale_3d_cntl );
+     mach64_out32( mmio, SCALE_Y_OFF, mdev->scale_offset +
+                   (srect->y >> 16) * mdev->scale_pitch +
+                   (srect->x >> 16) * DFB_BYTES_PER_PIXEL( source->config.format ) );
+
+
+     mach64_out32( mmio, SCALE_WIDTH, (srect->w + hacc) >> 16 );
+     mach64_out32( mmio, SCALE_HEIGHT, (srect->h + vacc) >> 16 );
+
+     mach64_out32( mmio, SCALE_Y_PITCH, mdev->scale_pitch / DFB_BYTES_PER_PIXEL( source->config.format ) );
+
+     mach64_out32( mmio, SCALE_X_INC, srect->w / drect->w );
+     mach64_out32( mmio, SCALE_Y_INC, srect->h / drect->h );
+
+     if (mdev->blit_deinterlace && mdev->field)
+          vacc += 0x8000;
+
+     mach64_out32( mmio, SCALE_VACC, vacc );
+     mach64_out32( mmio, SCALE_HACC, hacc );
+     mach64_out32( mmio, SCALE_XUV_INC, (srect->w/2) / (drect->w/2) );
+     mach64_out32( mmio, SCALE_UV_HACC, hacc >> 1 );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( drect->x ) << 16) | S14( drect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (drect->w << 16) | drect->h );
+
+     /* Some scaler and 3D color registers are shared. */
+     MACH64_INVALIDATE( m_color_3d | m_color_tex );
+}
+
+static void mach64DoBlitScale( Mach64DriverData *mdrv,
+                               Mach64DeviceData *mdev,
+                               DFBRectangle     *srect,
+                               DFBRectangle     *drect,
+                               bool              filter )
+{
+     volatile u8 *mmio     = mdrv->mmio_base;
+     CoreSurface   *source = mdev->source;
+
+     u32 scale_3d_cntl = SCALE_3D_FCN_SCALE | mdev->blit_blend;
+     int   hacc, vacc;
+
+     if (!filter)
+          scale_3d_cntl |= SCALE_PIX_REP;
+
+     if (mdev->blit_deinterlace) {
+          srect->y /= 2;
+          srect->h /= 2;
+     }
+
+     srect->x <<= 16;
+     srect->y <<= 16;
+     srect->w <<= 16;
+     srect->h <<= 16;
+
+     /* Hardware bug: Hitting SC_TOP results in incorrect rendering. */
+     if (drect->y < mdev->clip.y1) {
+          int sy, dy;
+          dy = mdev->clip.y1 - drect->y;
+          sy = (u64) srect->h * dy / drect->h;
+          srect->y += sy;
+          srect->h -= sy;
+          drect->y += dy;
+          drect->h -= dy;
+     }
+
+     /*
+      * SCALE_HACC and SCALE_VACC have limited scale so we need to change
+      * SCALE_OFF in order to handle the full range of source coordinates.
+      */
+     hacc = srect->x & 0xFFFFF0; /* s8.12 */
+     vacc = srect->y & 0xFFFF0; /* s4.12 */
+     srect->x &= ~0xFFFFFF;
+     srect->y &= ~0xFFFFF;
+
+     mach64_waitfifo( mdrv, mdev, 12 );
+
+     mach64_out32( mmio, SCALE_3D_CNTL, scale_3d_cntl );
+     mach64_out32( mmio, SCALE_OFF, mdev->scale_offset +
+                   (srect->y >> 16) * mdev->scale_pitch +
+                   (srect->x >> 16) * DFB_BYTES_PER_PIXEL( source->config.format ) );
+
+     mach64_out32( mmio, SCALE_WIDTH, (srect->w + hacc) >> 16 );
+     mach64_out32( mmio, SCALE_HEIGHT, (srect->h + vacc) >> 16 );
+
+     mach64_out32( mmio, SCALE_PITCH, mdev->scale_pitch / DFB_BYTES_PER_PIXEL( source->config.format ) );
+
+     mach64_out32( mmio, SCALE_X_INC, srect->w / drect->w );
+     mach64_out32( mmio, SCALE_Y_INC, srect->h / drect->h );
+
+     if (mdev->blit_deinterlace && mdev->field)
+          vacc += 0x8000;
+
+     mach64_out32( mmio, SCALE_VACC, vacc );
+     mach64_out32( mmio, SCALE_HACC, hacc );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( drect->x ) << 16) | S14( drect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (drect->w << 16) | drect->h );
+
+     /* Some scaler and 3D color registers are shared. */
+     MACH64_INVALIDATE( m_color_3d | m_color_tex );
+}
+
+static void mach64DoBlitTexOld( Mach64DriverData *mdrv,
+                                Mach64DeviceData *mdev,
+                                DFBRectangle     *srect,
+                                DFBRectangle     *drect,
+                                bool              filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 scale_3d_cntl = SCALE_3D_FCN_TEXTURE | MIP_MAP_DISABLE | mdev->blit_blend;
+
+     if (mdev->blit_deinterlace) {
+          srect->y /= 2;
+          srect->h /= 2;
+     }
+
+     srect->x <<= 1;
+     srect->y <<= 1;
+     srect->w <<= 1;
+     srect->h <<= 1;
+
+     /* Must add 0.5 to get correct rendering. */
+     srect->x += 0x1;
+     srect->y += 0x1;
+
+     if (filter) {
+          /* Avoid using texels outside of texture. */
+          srect->w -= 0x2;
+          srect->h -= 0x2;
+
+          scale_3d_cntl |= BILINEAR_TEX_EN | TEX_BLEND_FCN_LINEAR_MIPMAP_NEAREST;
+     }
+
+     if (mdev->blit_deinterlace && mdev->field)
+          srect->y += 0x1;
+
+     mach64_waitfifo( mdrv, mdev, 14 );
+
+     mach64_out32( mmio, SCALE_3D_CNTL, scale_3d_cntl );
+     mach64_out32( mmio, TEX_0_OFF + (mdev->tex_size << 2), mdev->tex_offset );
+
+     mach64_out32( mmio, S_X_INC2, 0 );
+     mach64_out32( mmio, S_Y_INC2, 0 );
+     mach64_out32( mmio, S_XY_INC2, 0 );
+     mach64_out32( mmio, S_X_INC_START, (srect->w << (25 - mdev->tex_size)) / drect->w );
+     mach64_out32( mmio, S_Y_INC, 0 );
+     mach64_out32( mmio, S_START, (srect->x << (25 - mdev->tex_size)) );
+
+     mach64_out32( mmio, T_X_INC2, 0 );
+     mach64_out32( mmio, T_Y_INC2, 0 );
+     mach64_out32( mmio, T_XY_INC2, 0 );
+     mach64_out32( mmio, T_X_INC_START, 0 );
+     mach64_out32( mmio, T_Y_INC, (srect->h << (25 - mdev->tex_size)) / drect->h );
+     mach64_out32( mmio, T_START, (srect->y << (25 - mdev->tex_size)) );
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( drect->x ) << 16) | S14( drect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (drect->w << 16) | drect->h );
+}
+
+static void mach64DoBlitTex( Mach64DriverData *mdrv,
+                             Mach64DeviceData *mdev,
+                             DFBRectangle     *srect,
+                             DFBRectangle     *drect,
+                             bool              filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 scale_3d_cntl = SCALE_3D_FCN_TEXTURE | MIP_MAP_DISABLE | mdev->blit_blend;
+
+     if (mdev->blit_deinterlace) {
+          srect->y /= 2;
+          srect->h /= 2;
+     }
+
+     srect->x <<= 1;
+     srect->y <<= 1;
+     srect->w <<= 1;
+     srect->h <<= 1;
+
+     /* Must add 0.5 to get correct rendering. */
+     srect->x += 0x1;
+     srect->y += 0x1;
+
+     if (filter) {
+          /* Avoid using texels outside of texture. */
+          srect->w -= 0x2;
+          srect->h -= 0x2;
+
+          scale_3d_cntl |= BILINEAR_TEX_EN | TEX_BLEND_FCN_LINEAR_MIPMAP_NEAREST;
+     }
+
+     if (mdev->blit_deinterlace && mdev->field)
+          srect->y += 0x1;
+
+     mach64_waitfifo( mdrv, mdev, 13 );
+
+     mach64_out32( mmio, SCALE_3D_CNTL, scale_3d_cntl );
+     mach64_out32( mmio, TEX_0_OFF + (mdev->tex_size << 2), mdev->tex_offset );
+
+     mach64_out32( mmio, STW_EXP, (1 << 16) | (0 << 8) | (0 << 0) );
+
+     /* This register doesn't seem to have any effect on the result. */
+     mach64_out32( mmio, LOG_MAX_INC, 0 );
+
+     mach64_out32( mmio, S_X_INC, (srect->w << (23 - mdev->tex_pitch)) / drect->w );
+     mach64_out32( mmio, S_Y_INC, 0 );
+     mach64_out32( mmio, S_START, (srect->x << (23 - mdev->tex_pitch)) );
+
+     mach64_out32( mmio, W_X_INC, 0 );
+     mach64_out32( mmio, W_Y_INC, 0 );
+     mach64_out32( mmio, W_START, 1 << 23 );
+
+     mach64_out32( mmio, T_X_INC, 0 );
+     mach64_out32( mmio, T_Y_INC, (srect->h << (23 - mdev->tex_height)) / drect->h );
+     mach64_out32( mmio, T_START, (srect->y << (23 - mdev->tex_height)) );
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+
+     mach64_out32( mmio, DST_CNTL, DST_X_DIR | DST_Y_DIR );
+     mach64_out32( mmio, DST_Y_X, (S13( drect->x ) << 16) | S14( drect->y ) );
+     mach64_out32( mmio, DST_HEIGHT_WIDTH, (drect->w << 16) | drect->h );
+}
+
+static bool mach64Blit2D( void *drv, void *dev,
+                          DFBRectangle *rect, int dx, int dy )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     mach64DoBlit2D( mdrv, mdev, rect, &drect );
+
+     return true;
+}
+
+static bool mach64BlitScaleOld( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     mach64DoBlitScaleOld( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool mach64StretchBlitScaleOld( void *drv, void *dev,
+                                       DFBRectangle *srect, DFBRectangle *drect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64DoBlitScaleOld( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool mach64BlitScale( void *drv, void *dev,
+                             DFBRectangle *rect, int dx, int dy )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     mach64DoBlitScale( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool mach64StretchBlitScale( void *drv, void *dev,
+                                    DFBRectangle *srect, DFBRectangle *drect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64DoBlitScale( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool mach64BlitTexOld( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     mach64DoBlitTexOld( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool mach64StretchBlitTexOld( void *drv, void *dev,
+                                     DFBRectangle *srect, DFBRectangle *drect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64DoBlitTexOld( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool mach64BlitTex( void *drv, void *dev,
+                           DFBRectangle *rect, int dx, int dy )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     mach64DoBlitTex( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool mach64StretchBlitTex( void *drv, void *dev,
+                                  DFBRectangle *srect, DFBRectangle *drect )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) drv;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) dev;
+
+     mach64DoBlitTex( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+/* */
+
+#define MACH64_CFG_CHIP_TYPE( a, b ) (((a) << 8) | (b))
+
+static Mach64ChipType
+mach64_chip_type_vt( Mach64DriverData   *mdrv,
+                     GraphicsDeviceInfo *device_info )
+{
+     u32 config_chip_id = mach64_in32( mdrv->mmio_base, CONFIG_CHIP_ID );
+     u32 cfg_chip_type = config_chip_id & CFG_CHIP_TYPE;
+
+     switch (cfg_chip_type) {
+     case MACH64_CFG_CHIP_TYPE( 'V', 'T' ):
+          switch ((config_chip_id & CFG_CHIP_MAJOR) >> 24) {
+          case 0:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,
+                         (config_chip_id & CFG_CHIP_MINOR) ? "ATI-264VT2 (%c%c)" : "ATI-264VT (%c%c)",
+                         cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+               return CHIP_264VT;
+          case 1:
+          case 2:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "ATI-264VT3 (%c%c)",
+                         cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+               return CHIP_264VT3;
+          }
+          break;
+     case MACH64_CFG_CHIP_TYPE( 'V', 'U' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "ATI-264VT3 (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_264VT3;
+     case MACH64_CFG_CHIP_TYPE( 'V', 'V' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "ATI-264VT4 (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_264VT4;
+     }
+     D_WARN( "DirectFB/Mach64: Unknown VT chip type %c%c (0x%08x)",
+             cfg_chip_type >> 8, cfg_chip_type & 0xFF, config_chip_id );
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Mach64 VT" );
+     return CHIP_UNKNOWN;
+}
+
+static Mach64ChipType
+mach64_chip_type_gt( Mach64DriverData   *mdrv,
+                     GraphicsDeviceInfo *device_info )
+{
+     u32 config_chip_id = mach64_in32( mdrv->mmio_base, CONFIG_CHIP_ID );
+     u32 cfg_chip_type = config_chip_id & CFG_CHIP_TYPE;
+
+     switch (cfg_chip_type) {
+     case MACH64_CFG_CHIP_TYPE( 'G', 'T' ):
+          switch ((config_chip_id & CFG_CHIP_MAJOR) >> 24) {
+          case 0:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage (%c%c)",
+                         cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+               return CHIP_3D_RAGE;
+          case 1:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage II (%c%c)",
+                         cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+               return CHIP_3D_RAGE_II;
+          case 2:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage II+ (%c%c)",
+                         cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+               return CHIP_3D_RAGE_IIPLUS;
+          }
+          break;
+     case MACH64_CFG_CHIP_TYPE( 'G', 'U' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage II+ (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_IIPLUS;
+     case MACH64_CFG_CHIP_TYPE( 'L', 'G' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage LT (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_LT;
+     case MACH64_CFG_CHIP_TYPE( 'G', 'V' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'W' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'Y' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'Z' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage IIC (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_IIC;
+     case MACH64_CFG_CHIP_TYPE( 'G', 'B' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'D' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'I' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'P' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'Q' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage Pro (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_PRO;
+     case MACH64_CFG_CHIP_TYPE( 'L', 'B' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'D' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'I' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'P' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'Q' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage LT Pro (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_LT_PRO;
+     case MACH64_CFG_CHIP_TYPE( 'G', 'M' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'O' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'R' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage XL (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_XLXC;
+     case MACH64_CFG_CHIP_TYPE( 'G', 'L' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'N' ):
+     case MACH64_CFG_CHIP_TYPE( 'G', 'S' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage XC (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_XLXC;
+     case MACH64_CFG_CHIP_TYPE( 'L', 'M' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'N' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'R' ):
+     case MACH64_CFG_CHIP_TYPE( 'L', 'S' ):
+          snprintf( device_info->name,
+                    DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "3D Rage Mobility (%c%c)",
+                    cfg_chip_type >> 8, cfg_chip_type & 0xFF );
+          return CHIP_3D_RAGE_MOBILITY;
+     }
+     D_WARN( "DirectFB/Mach64: Unknown GT chip type %c%c (0x%08x)",
+             cfg_chip_type >> 8, cfg_chip_type & 0xFF, config_chip_id );
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Mach64 GT" );
+     return CHIP_UNKNOWN;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_ATI_MACH64GX:
+          case FB_ACCEL_ATI_MACH64CT:
+          case FB_ACCEL_ATI_MACH64VT:
+          case FB_ACCEL_ATI_MACH64GT:
+               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,
+               "ATI Mach64 Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Ville Syrjala" );
+
+     info->version.major = 0;
+     info->version.minor = 13;
+
+     info->driver_data_size = sizeof (Mach64DriverData);
+     info->device_data_size = sizeof (Mach64DeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+
+     mdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!mdrv->mmio_base)
+          return DFB_IO;
+
+     mdrv->device_data = (Mach64DeviceData*) device_data;
+
+     mdrv->accelerator = dfb_gfxcard_get_accelerator( device );
+
+     funcs->EngineReset   = mach64EngineReset;
+     funcs->EngineSync    = mach64EngineSync;
+     funcs->CheckState    = mach64CheckState;
+     funcs->SetState      = mach64SetState;
+     funcs->FillRectangle = mach64FillRectangle;
+     funcs->DrawRectangle = mach64DrawRectangle;
+
+     /* Set dynamically: funcs->DrawLine, funcs->Blit, funcs->StretchBlit */
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_ATI_MACH64GT:
+               if (!dfb_config->font_format)
+                    dfb_config->font_format = DSPF_ARGB;
+               funcs->FlushTextureCache = mach64FlushTextureCache;
+               funcs->CheckState        = mach64GTCheckState;
+               funcs->SetState          = mach64GTSetState;
+               funcs->FillTriangle      = mach64FillTriangle;
+          case FB_ACCEL_ATI_MACH64VT:
+               mdrv->mmio_base += 0x400;
+
+               dfb_layers_register( dfb_screens_at( DSCID_PRIMARY ),
+                                    driver_data, &mach64OverlayFuncs );
+               break;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     /* fill device info */
+     device_info->caps.flags = CCF_CLIPPING;
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_ATI_MACH64GT:
+               device_info->caps.drawing  = MACH64GT_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = MACH64GT_SUPPORTED_BLITTINGFLAGS;
+               device_info->caps.accel    = MACH64GT_SUPPORTED_DRAWINGFUNCTIONS |
+                                            MACH64GT_SUPPORTED_BLITTINGFUNCTIONS;
+               break;
+          default:
+               device_info->caps.drawing  = MACH64_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = MACH64_SUPPORTED_BLITTINGFLAGS;
+               device_info->caps.accel    = MACH64_SUPPORTED_DRAWINGFUNCTIONS |
+                                            MACH64_SUPPORTED_BLITTINGFUNCTIONS;
+               break;
+     }
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_ATI_MACH64GX:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Mach64 GX" );
+               break;
+          case FB_ACCEL_ATI_MACH64CT:
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Mach64 CT" );
+               break;
+          case FB_ACCEL_ATI_MACH64VT:
+               mdev->chip = mach64_chip_type_vt( mdrv, device_info );
+               break;
+          case FB_ACCEL_ATI_MACH64GT:
+               mdev->chip = mach64_chip_type_gt( mdrv, device_info );
+
+               /* Max texture size is 1024x1024 */
+               device_info->limits.surface_max_power_of_two_pixelpitch = 1024;
+               device_info->limits.surface_max_power_of_two_height     = 1024;
+               break;
+     }
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "ATI" );
+
+     device_info->limits.surface_byteoffset_alignment = 8;
+     device_info->limits.surface_bytepitch_alignment  = 16;
+     device_info->limits.surface_pixelpitch_alignment = 8;
+
+     /* 3D Rage Pro is the first chip that supports auto fast fill/block write. */
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          mdev->hw_debug = mach64_in32( mmio, HW_DEBUG );
+
+          /* Save original HW_DEBUG. */
+          mdev->hw_debug_orig = mdev->hw_debug;
+
+          /* Enable auto fast fill and fast fill/block write scissoring. */
+          mdev->hw_debug &= ~(AUTO_FF_DIS | INTER_PRIM_DIS);
+
+          if ((mach64_in32( mmio, CONFIG_STAT0 ) & CFG_MEM_TYPE) == CFG_MEM_TYPE_SGRAM) {
+               /* Enable auto block write and auto color register updates. */
+               mdev->hw_debug &= ~(AUTO_BLKWRT_DIS | AUTO_BLKWRT_COLOR_DIS);
+
+               device_info->limits.surface_byteoffset_alignment = 64;
+               device_info->limits.surface_bytepitch_alignment  = 64;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = (Mach64DeviceData*) device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     D_DEBUG( "DirectFB/Mach64: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/Mach64:  %9d mach64_waitfifo calls\n",
+               mdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/Mach64:  %9d register writes (mach64_waitfifo sum)\n",
+               mdev->waitfifo_sum );
+     D_DEBUG( "DirectFB/Mach64:  %9d FIFO wait cycles (depends on CPU)\n",
+               mdev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/Mach64:  %9d IDLE wait cycles (depends on CPU)\n",
+               mdev->idle_waitcycles );
+     D_DEBUG( "DirectFB/Mach64:  %9d FIFO space cache hits(depends on CPU)\n",
+               mdev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/Mach64: Conclusion:\n" );
+     D_DEBUG( "DirectFB/Mach64:  Average register writes/mach64_waitfifo"
+               "call:%.2f\n",
+               mdev->waitfifo_sum/(float)(mdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/Mach64:  Average wait cycles/mach64_waitfifo call:"
+               " %.2f\n",
+               mdev->fifo_waitcycles/(float)(mdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/Mach64:  Average fifo space cache hits: %02d%%\n",
+               (int)(100 * mdev->fifo_cache_hits/
+               (float)(mdev->waitfifo_calls)) );
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_ATI_MACH64GT:
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, SCALE_3D_CNTL, 0 );
+          case FB_ACCEL_ATI_MACH64VT:
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, OVERLAY_SCALE_CNTL, 0 );
+               break;
+     }
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          /* Restore original HW_DEBUG. */
+          mach64_out32( mmio, HW_DEBUG, mdev->hw_debug_orig );
+     }
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_ATI_MACH64VT:
+          case FB_ACCEL_ATI_MACH64GT:
+               mdrv->mmio_base -= 0x400;
+               break;
+     }
+
+     dfb_gfxcard_unmap_mmio( device, mdrv->mmio_base, -1 );
+}
diff --git a/Source/DirectFB/gfxdrivers/mach64/mach64.h b/Source/DirectFB/gfxdrivers/mach64/mach64.h
new file mode 100755
index 0000000..86e4b68
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mach64.h
@@ -0,0 +1,120 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MACH64_H__
+#define ___MACH64_H__
+
+#include <dfb_types.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+#define S13( val ) ((val) & 0x3FFF)
+#define S14( val ) ((val) & 0x7FFF)
+
+typedef enum {
+     m_source       = 0x001,
+     m_source_scale = 0x002,
+     m_color        = 0x004,
+     m_color_3d     = 0x008,
+     m_color_tex    = 0x010,
+     m_srckey       = 0x020,
+     m_srckey_scale = 0x040,
+     m_dstkey       = 0x080,
+     m_disable_key  = 0x100,
+     m_draw_blend   = 0x200,
+     m_blit_blend   = 0x400,
+} Mach64StateBits;
+
+#define MACH64_VALIDATE(b)      (mdev->valid |= (b))
+#define MACH64_INVALIDATE(b)    (mdev->valid &= ~(b))
+#define MACH64_IS_VALID(b)      (mdev->valid & (b))
+
+typedef enum {
+     CHIP_UNKNOWN = 0,
+     CHIP_264VT,
+     CHIP_3D_RAGE,
+     CHIP_264VT3,
+     CHIP_3D_RAGE_II,
+     CHIP_3D_RAGE_IIPLUS,
+     CHIP_3D_RAGE_LT,
+     CHIP_264VT4,
+     CHIP_3D_RAGE_IIC,
+     CHIP_3D_RAGE_PRO,
+     CHIP_3D_RAGE_LT_PRO,
+     CHIP_3D_RAGE_XLXC,
+     CHIP_3D_RAGE_MOBILITY,
+} Mach64ChipType;
+
+typedef struct {
+     Mach64ChipType chip;
+
+     /* for fifo/performance monitoring */
+     unsigned int fifo_space;
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+
+     Mach64StateBits valid;
+
+     u32 hw_debug;
+     u32 hw_debug_orig;
+
+     u32 pix_width;
+
+     u32 draw_blend;
+     u32 blit_blend;
+
+     int tex_offset;
+     int tex_pitch;
+     int tex_height;
+     int tex_size;
+
+     int scale_offset;
+     int scale_pitch;
+
+     CoreSurface *source;
+
+     bool blit_deinterlace;
+     int field;
+
+     DFBRegion clip;
+
+     bool use_scaler_3d;
+} Mach64DeviceData;
+
+typedef struct {
+     int accelerator;
+     volatile u8 *mmio_base;
+     Mach64DeviceData *device_data;
+} Mach64DriverData;
+
+extern DisplayLayerFuncs mach64OverlayFuncs;
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/mach64/mach64_overlay.c b/Source/DirectFB/gfxdrivers/mach64/mach64_overlay.c
new file mode 100755
index 0000000..11cff28
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mach64_overlay.c
@@ -0,0 +1,724 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/util.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "mach64.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+     bool                  visible;
+
+     /* overlay registers */
+     struct {
+          u32 overlay_Y_X_START;
+          u32 overlay_Y_X_END;
+          u32 overlay_GRAPHICS_KEY_CLR;
+          u32 overlay_GRAPHICS_KEY_MSK;
+          u32 overlay_VIDEO_KEY_CLR;
+          u32 overlay_VIDEO_KEY_MSK;
+          u32 overlay_KEY_CNTL;
+          u32 overlay_SCALE_INC;
+          u32 overlay_SCALE_CNTL;
+          u32 scaler_HEIGHT_WIDTH;
+          u32 scaler_BUF_PITCH;
+          u32 scaler_BUF0_OFFSET;
+          u32 scaler_BUF1_OFFSET;
+          u32 scaler_BUF0_OFFSET_U;
+          u32 scaler_BUF0_OFFSET_V;
+          u32 scaler_BUF1_OFFSET_U;
+          u32 scaler_BUF1_OFFSET_V;
+          u32 video_FORMAT;
+          u32 capture_CONFIG;
+     } regs;
+} Mach64OverlayLayerData;
+
+static void ov_reset( Mach64DriverData *mdrv );
+static void ov_set_regs( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov );
+static void ov_calc_regs( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov,
+                          CoreLayerRegionConfig *config, CoreSurface *surface,
+                          CoreSurfaceBufferLock  *lock );
+static void ov_set_buffer( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov );
+static void ov_calc_buffer( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov,
+                            CoreLayerRegionConfig *config, CoreSurface *surface,
+                            CoreSurfaceBufferLock  *lock );
+static void ov_set_colorkey( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov );
+static void ov_calc_colorkey( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov,
+                              CoreLayerRegionConfig *config );
+static void ov_set_opacity( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov );
+static void ov_calc_opacity( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov,
+                             CoreLayerRegionConfig *config );
+static void ov_set_field( Mach64DriverData *mdrv, Mach64OverlayLayerData *mov );
+
+#define OV_SUPPORTED_OPTIONS   (DLOP_SRC_COLORKEY | DLOP_DST_COLORKEY | DLOP_DEINTERLACING)
+
+/**********************/
+
+static int
+ovLayerDataSize( void )
+{
+     return sizeof(Mach64OverlayLayerData);
+}
+
+static DFBResult
+ovInitLayer( CoreLayer                  *layer,
+             void                       *driver_data,
+             void                       *layer_data,
+             DFBDisplayLayerDescription *description,
+             DFBDisplayLayerConfig      *config,
+             DFBColorAdjustment         *adjustment )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = mdrv->device_data;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SCREEN_LOCATION | DLCAPS_SURFACE |
+                         DLCAPS_DST_COLORKEY | DLCAPS_DEINTERLACING;
+
+     if (mdev->chip >= CHIP_264VT3)
+          description->caps |= DLCAPS_SRC_COLORKEY;
+
+     description->type = DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Mach64 Overlay" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                           DLCONF_OPTIONS;
+     config->width       = (mdev->chip >= CHIP_264VT3) ? 640 : 320;
+     config->height      = (mdev->chip >= CHIP_264VT3) ? 480 : 240;
+     config->pixelformat = DSPF_YUY2;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_NONE;
+
+     adjustment->flags   = DCAF_NONE;
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          description->caps      |= DLCAPS_BRIGHTNESS | DLCAPS_SATURATION;
+
+          /* fill out default color adjustment,
+             only fields set in flags will be accepted from applications */
+          adjustment->flags      |= DCAF_BRIGHTNESS | DCAF_SATURATION;
+          adjustment->brightness  = 0x8000;
+          adjustment->saturation  = 0x8000;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovTestRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags *failed )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = mdrv->device_data;
+     CoreLayerRegionConfigFlags fail = 0;
+     int max_width, max_height = 1024;
+
+     switch (mdev->chip) {
+          case CHIP_264VT: /* 264VT2 verified */
+          case CHIP_3D_RAGE: /* not verified */
+               max_width = 384;
+               break;
+          case CHIP_264VT3: /* not verified */
+          case CHIP_3D_RAGE_II: /* not verified */
+          case CHIP_3D_RAGE_IIPLUS:
+          case CHIP_264VT4: /* not verified */
+          case CHIP_3D_RAGE_IIC:
+          case CHIP_3D_RAGE_XLXC:
+          case CHIP_3D_RAGE_MOBILITY:
+               max_width = 720;
+               break;
+          case CHIP_3D_RAGE_PRO: /* not verified */
+          case CHIP_3D_RAGE_LT_PRO:
+               max_width = 768;
+               break;
+          default:
+               D_BUG( "unknown chip" );
+               return DFB_UNSUPPORTED;
+     }
+
+     if (config->options & DLOP_DEINTERLACING)
+          max_height = 2048;
+
+     /* check for unsupported options */
+     if (config->options & ~OV_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /*
+      * Video keying doesn't work the same way on 264VT2 as it does
+      * on later chips. If enabled the overlay goes completely black
+      * so clearly it does something but not what we want.
+      */
+     if (mdev->chip < CHIP_264VT3 && config->options & DLOP_SRC_COLORKEY)
+          fail |= CLRCF_OPTIONS;
+
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               if (mdev->chip >= CHIP_3D_RAGE_PRO)
+                    break;
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     switch (config->format) {
+          case DSPF_I420:
+          case DSPF_YV12:
+               if (config->height & 1)
+                    fail |= CLRCF_HEIGHT;
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (config->width & 1)
+                    fail |= CLRCF_WIDTH;
+          default:
+               break;
+     }
+
+     /* check width */
+     if (config->width > max_width || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > max_height || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovSetRegion( CoreLayer                  *layer,
+             void                       *driver_data,
+             void                       *layer_data,
+             void                       *region_data,
+             CoreLayerRegionConfig      *config,
+             CoreLayerRegionConfigFlags  updated,
+             CoreSurface                *surface,
+             CorePalette                *palette,
+             CoreSurfaceBufferLock      *lock )
+{
+     Mach64DriverData       *mdrv = (Mach64DriverData*) driver_data;
+     Mach64OverlayLayerData *mov  = (Mach64OverlayLayerData*) layer_data;
+
+     /* remember configuration */
+     mov->config = *config;
+
+     if (updated == CLRCF_ALL)
+          ov_reset( mdrv );
+
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT | CLRCF_SOURCE | CLRCF_DEST | CLRCF_OPTIONS)) {
+          ov_calc_buffer( mdrv, mov, config, surface, lock );
+          ov_calc_regs( mdrv, mov, config, surface, lock );
+          ov_set_buffer( mdrv, mov );
+          ov_set_regs( mdrv, mov );
+     }
+
+     if (updated & (CLRCF_OPTIONS | CLRCF_SRCKEY | CLRCF_DSTKEY)) {
+          ov_calc_colorkey( mdrv, mov, config );
+          ov_set_colorkey( mdrv, mov );
+     }
+
+     if (updated & CLRCF_OPTIONS)
+          ov_set_field( mdrv, mov );
+
+     if (updated & (CLRCF_DEST | CLRCF_OPACITY)) {
+          ov_calc_opacity( mdrv, mov, config );
+          ov_set_opacity( mdrv, mov );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovRemoveRegion( CoreLayer *layer,
+                void      *driver_data,
+                void      *layer_data,
+                void      *region_data )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 2 );
+
+     /*
+      * On 264VT2 the keyer sometimes remains active
+      * even after the overlay has been disabled.
+      */
+     mach64_out32( mmio, OVERLAY_KEY_CNTL,
+                   VIDEO_KEY_FN_FALSE | GRAPHICS_KEY_FN_FALSE | OVERLAY_CMP_MIX_OR );
+
+     mach64_out32( mmio, OVERLAY_SCALE_CNTL, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovFlipRegion( CoreLayer             *layer,
+              void                  *driver_data,
+              void                  *layer_data,
+              void                  *region_data,
+              CoreSurface           *surface,
+              DFBSurfaceFlipFlags    flags,
+              CoreSurfaceBufferLock *lock )
+{
+     Mach64DriverData       *mdrv = (Mach64DriverData*) driver_data;
+     Mach64OverlayLayerData *mov  = (Mach64OverlayLayerData*) layer_data;
+
+     ov_calc_buffer( mdrv, mov, &mov->config, surface, lock );
+     ov_set_buffer( mdrv, mov );
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovSetColorAdjustment( CoreLayer          *layer,
+                      void               *driver_data,
+                      void               *layer_data,
+                      DFBColorAdjustment *adj )
+{
+     Mach64DriverData *mdrv = (Mach64DriverData*) driver_data;
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     if (mdev->chip < CHIP_3D_RAGE_PRO)
+          return DFB_UNSUPPORTED;
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+
+     mach64_out32( mmio, SCALER_COLOUR_CNTL,
+                   (((adj->brightness >> 9) - 64) & 0x0000007F) |
+                   ((adj->saturation >> 3)  & 0x00001F00) |
+                   ((adj->saturation << 5)  & 0x001F0000) );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovSetInputField( CoreLayer          *layer,
+                 void               *driver_data,
+                 void               *layer_data,
+                 void               *region_data,
+                 int                 field )
+{
+     Mach64DriverData       *mdrv = (Mach64DriverData*) driver_data;
+     Mach64OverlayLayerData *mov  = (Mach64OverlayLayerData*) layer_data;
+
+     mov->regs.capture_CONFIG = OVL_BUF_MODE_SINGLE | (field ? OVL_BUF_NEXT_BUF1 : OVL_BUF_NEXT_BUF0);
+
+     ov_set_field( mdrv, mov );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs mach64OverlayFuncs = {
+     .LayerDataSize      = ovLayerDataSize,
+     .InitLayer          = ovInitLayer,
+
+     .TestRegion         = ovTestRegion,
+     .SetRegion          = ovSetRegion,
+     .RemoveRegion       = ovRemoveRegion,
+     .FlipRegion         = ovFlipRegion,
+     .SetColorAdjustment = ovSetColorAdjustment,
+     .SetInputField      = ovSetInputField,
+};
+
+/* internal */
+
+static void ov_reset( Mach64DriverData *mdrv )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          mach64_waitfifo( mdrv, mdev, 6 );
+
+          mach64_out32( mmio, SCALER_H_COEFF0, 0x00002000 );
+          mach64_out32( mmio, SCALER_H_COEFF1, 0x0D06200D );
+          mach64_out32( mmio, SCALER_H_COEFF2, 0x0D0A1C0D );
+          mach64_out32( mmio, SCALER_H_COEFF3, 0x0C0E1A0C );
+          mach64_out32( mmio, SCALER_H_COEFF4, 0x0C14140C );
+          mach64_out32( mmio, SCALER_COLOUR_CNTL, 0x00101000 );
+     }
+
+     if (mdev->chip >= CHIP_264VT3) {
+          mach64_waitfifo( mdrv, mdev, 2 );
+
+          mach64_out32( mmio, OVERLAY_EXCLUSIVE_HORZ, 0 );
+          mach64_out32( mmio, OVERLAY_EXCLUSIVE_VERT, 0 );
+     }
+
+     mach64_waitfifo( mdrv, mdev, 2 );
+
+     mach64_out32( mmio, OVERLAY_SCALE_CNTL, 0 );
+     mach64_out32( mmio, SCALER_TEST, 0 );
+}
+
+static void ov_set_regs( Mach64DriverData       *mdrv,
+                         Mach64OverlayLayerData *mov )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, (mdev->chip >= CHIP_264VT3) ? 6 : 7 );
+
+     mach64_out32( mmio, VIDEO_FORMAT,          mov->regs.video_FORMAT );
+     mach64_out32( mmio, OVERLAY_Y_X_START,     mov->regs.overlay_Y_X_START );
+     mach64_out32( mmio, OVERLAY_Y_X_END,       mov->regs.overlay_Y_X_END );
+     mach64_out32( mmio, OVERLAY_SCALE_INC,     mov->regs.overlay_SCALE_INC );
+     mach64_out32( mmio, SCALER_HEIGHT_WIDTH,   mov->regs.scaler_HEIGHT_WIDTH );
+
+     if (mdev->chip >= CHIP_264VT3) {
+          mach64_out32( mmio, SCALER_BUF_PITCH, mov->regs.scaler_BUF_PITCH );
+     } else {
+          mach64_out32( mmio, BUF0_PITCH,       mov->regs.scaler_BUF_PITCH );
+          mach64_out32( mmio, BUF1_PITCH,       mov->regs.scaler_BUF_PITCH );
+     }
+}
+
+static void ov_set_buffer( Mach64DriverData       *mdrv,
+                           Mach64OverlayLayerData *mov )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, (mdev->chip >= CHIP_3D_RAGE_PRO) ? 6 : 2 );
+
+     if (mdev->chip >= CHIP_264VT3) {
+          mach64_out32( mmio, SCALER_BUF0_OFFSET,   mov->regs.scaler_BUF0_OFFSET );
+          mach64_out32( mmio, SCALER_BUF1_OFFSET,   mov->regs.scaler_BUF1_OFFSET );
+     } else {
+          mach64_out32( mmio, BUF0_OFFSET,          mov->regs.scaler_BUF0_OFFSET );
+          mach64_out32( mmio, BUF1_OFFSET,          mov->regs.scaler_BUF1_OFFSET );
+     }
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          mach64_out32( mmio, SCALER_BUF0_OFFSET_U, mov->regs.scaler_BUF0_OFFSET_U );
+          mach64_out32( mmio, SCALER_BUF0_OFFSET_V, mov->regs.scaler_BUF0_OFFSET_V );
+          mach64_out32( mmio, SCALER_BUF1_OFFSET_U, mov->regs.scaler_BUF1_OFFSET_U );
+          mach64_out32( mmio, SCALER_BUF1_OFFSET_V, mov->regs.scaler_BUF1_OFFSET_V );
+     }
+}
+
+static void ov_set_colorkey( Mach64DriverData       *mdrv,
+                             Mach64OverlayLayerData *mov )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 5 );
+
+     mach64_out32( mmio, OVERLAY_GRAPHICS_KEY_CLR, mov->regs.overlay_GRAPHICS_KEY_CLR );
+     mach64_out32( mmio, OVERLAY_GRAPHICS_KEY_MSK, mov->regs.overlay_GRAPHICS_KEY_MSK );
+     mach64_out32( mmio, OVERLAY_VIDEO_KEY_CLR,    mov->regs.overlay_VIDEO_KEY_CLR );
+     mach64_out32( mmio, OVERLAY_VIDEO_KEY_MSK,    mov->regs.overlay_VIDEO_KEY_MSK );
+     mach64_out32( mmio, OVERLAY_KEY_CNTL,         mov->regs.overlay_KEY_CNTL );
+}
+
+static void ov_set_opacity( Mach64DriverData       *mdrv,
+                            Mach64OverlayLayerData *mov )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+
+     mach64_out32( mmio, OVERLAY_SCALE_CNTL, mov->regs.overlay_SCALE_CNTL );
+}
+
+static void ov_set_field( Mach64DriverData       *mdrv,
+                          Mach64OverlayLayerData *mov )
+{
+     Mach64DeviceData *mdev = mdrv->device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+
+     mach64_out32( mmio, CAPTURE_CONFIG, mov->regs.capture_CONFIG );
+}
+
+static void ov_calc_regs( Mach64DriverData       *mdrv,
+                          Mach64OverlayLayerData *mov,
+                          CoreLayerRegionConfig  *config,
+                          CoreSurface            *surface,
+                          CoreSurfaceBufferLock  *lock )
+{
+     Mach64DeviceData *mdev   = mdrv->device_data;
+     volatile u8      *mmio   = mdrv->mmio_base;
+     VideoMode        *mode   = dfb_system_current_mode();
+     int               yres   = mode->yres;
+     unsigned int      pitch  = lock->pitch / DFB_BYTES_PER_PIXEL( surface->config.format );
+     DFBRectangle      source = config->source;
+     DFBRectangle      dest   = config->dest;
+
+     DFBRegion dst;
+     int h_inc, v_inc;
+     u32 lcd_gen_ctrl, vert_stretching;
+     u8 ecp_div;
+
+     if (mode->doubled) {
+          dest.y *= 2;
+          dest.h *= 2;
+          yres   *= 2;
+     }
+
+     if (config->options & DLOP_DEINTERLACING) {
+          source.y /= 2;
+          source.h /= 2;
+          pitch    *= 2;
+     } else
+          mov->regs.capture_CONFIG = OVL_BUF_MODE_SINGLE | OVL_BUF_NEXT_BUF0;
+
+     dst.x1 = dest.x;
+     dst.y1 = dest.y;
+     dst.x2 = dest.x + dest.w - 1;
+     dst.y2 = dest.y + dest.h - 1;
+
+     mov->visible = dfb_region_intersect( &dst, 0, 0, mode->xres - 1, yres - 1 );
+
+     if (mode->laced) {
+          dest.y /= 2;
+          dest.h /= 2;
+     }
+
+     ecp_div = (mach64_in_pll( mmio, PLL_VCLK_CNTL ) & ECP_DIV) >> 4;
+     h_inc = (source.w << (12 + ecp_div)) / dest.w;
+
+     lcd_gen_ctrl = mach64_in_lcd( mdev, mmio, LCD_GEN_CTRL );
+     vert_stretching = mach64_in_lcd( mdev, mmio, VERT_STRETCHING );
+     if ((lcd_gen_ctrl & LCD_ON) && (vert_stretching & VERT_STRETCH_EN))
+          v_inc = (source.h << 2) * (vert_stretching & VERT_STRETCH_RATIO0) / dest.h;
+     else
+          v_inc = (source.h << 12) / dest.h;
+
+     switch (surface->config.format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mov->regs.video_FORMAT = SCALER_IN_RGB15;
+               break;
+          case DSPF_RGB16:
+               mov->regs.video_FORMAT = SCALER_IN_RGB16;
+               break;
+          case DSPF_RGB32:
+               mov->regs.video_FORMAT = SCALER_IN_RGB32;
+               break;
+          case DSPF_UYVY:
+               mov->regs.video_FORMAT = SCALER_IN_YVYU422;
+               break;
+          case DSPF_YUY2:
+               mov->regs.video_FORMAT = SCALER_IN_VYUY422;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               mov->regs.video_FORMAT = SCALER_IN_YUV12;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+     }
+
+     mov->regs.scaler_HEIGHT_WIDTH = (source.w << 16) | source.h;
+     mov->regs.scaler_BUF_PITCH    = pitch;
+
+     mov->regs.overlay_Y_X_START   = (dst.x1 << 16) | dst.y1 | OVERLAY_LOCK_START;
+     mov->regs.overlay_Y_X_END     = (dst.x2 << 16) | dst.y2;
+     mov->regs.overlay_SCALE_INC   = (h_inc << 16) | v_inc;
+}
+
+static void ov_calc_buffer( Mach64DriverData       *mdrv,
+                            Mach64OverlayLayerData *mov,
+                            CoreLayerRegionConfig  *config,
+                            CoreSurface            *surface,
+                            CoreSurfaceBufferLock  *lock )
+{
+     unsigned int   pitch  = lock->pitch;
+     DFBRectangle   source = config->source;
+
+     u32 offset, offset_u, offset_v;
+     int cropleft, croptop;
+
+     if (config->options & DLOP_DEINTERLACING) {
+          source.y /= 2;
+          source.h /= 2;
+          pitch    *= 2;
+     }
+
+     /* Source cropping */
+     cropleft = source.x;
+     croptop  = source.y;
+
+     /* Add destination cropping */
+     if (config->dest.x < 0)
+          cropleft += -config->dest.x * source.w / config->dest.w;
+     if (config->dest.y < 0)
+          croptop  += -config->dest.y * source.h / config->dest.h;
+
+     switch (surface->config.format) {
+          case DSPF_I420:
+               cropleft &= ~15;
+               croptop  &= ~1;
+
+               offset_u  = lock->offset + surface->config.size.h * lock->pitch;
+               offset_v  = offset_u + surface->config.size.h/2 * lock->pitch/2;
+               offset_u += croptop/2 * pitch/2 + cropleft/2;
+               offset_v += croptop/2 * pitch/2 + cropleft/2;
+               break;
+
+          case DSPF_YV12:
+               cropleft &= ~15;
+               croptop  &= ~1;
+
+               offset_v  = lock->offset + surface->config.size.h * lock->pitch;
+               offset_u  = offset_v + surface->config.size.h/2 * lock->pitch/2;
+               offset_v += croptop/2 * pitch/2 + cropleft/2;
+               offset_u += croptop/2 * pitch/2 + cropleft/2;
+               break;
+
+          default:
+               offset_u = 0;
+               offset_v = 0;
+               break;
+     }
+
+     offset  = lock->offset;
+     offset += croptop * pitch + cropleft * DFB_BYTES_PER_PIXEL( surface->config.format );
+
+     mov->regs.scaler_BUF0_OFFSET   = offset;
+     mov->regs.scaler_BUF0_OFFSET_U = offset_u;
+     mov->regs.scaler_BUF0_OFFSET_V = offset_v;
+
+     mov->regs.scaler_BUF1_OFFSET   = offset   + lock->pitch;
+     mov->regs.scaler_BUF1_OFFSET_U = offset_u + lock->pitch/2;
+     mov->regs.scaler_BUF1_OFFSET_V = offset_v + lock->pitch/2;
+}
+
+static u32 ovColorKey[] = {
+     VIDEO_KEY_FN_TRUE      | GRAPHICS_KEY_FN_TRUE  | OVERLAY_CMP_MIX_OR, /* 0 */
+     VIDEO_KEY_FN_NOT_EQUAL | GRAPHICS_KEY_FN_FALSE | OVERLAY_CMP_MIX_OR, /* DLOP_SRC_COLORKEY */
+     VIDEO_KEY_FN_FALSE     | GRAPHICS_KEY_FN_EQUAL | OVERLAY_CMP_MIX_OR, /* DLOP_DST_COLORKEY */
+     VIDEO_KEY_FN_NOT_EQUAL | GRAPHICS_KEY_FN_EQUAL | OVERLAY_CMP_MIX_AND /* DLOP_SRC_COLORKEY |
+                                                                             DLOP_DST_COLORKEY */
+};
+
+static void ov_calc_colorkey( Mach64DriverData       *mdrv,
+                              Mach64OverlayLayerData *mov,
+                              CoreLayerRegionConfig  *config )
+{
+     DFBSurfacePixelFormat primary_format = dfb_primary_layer_pixelformat();
+
+     /* Video key is always RGB24 */
+     mov->regs.overlay_VIDEO_KEY_CLR = PIXEL_RGB32( config->src_key.r,
+                                                    config->src_key.g,
+                                                    config->src_key.b );
+
+     /* The same mask is used for all three components */
+     mov->regs.overlay_VIDEO_KEY_MSK = 0xFF;
+
+     switch (primary_format) {
+          case DSPF_RGB332:
+               mov->regs.overlay_GRAPHICS_KEY_CLR = PIXEL_RGB332( config->dst_key.r,
+                                                                  config->dst_key.g,
+                                                                  config->dst_key.b );
+               break;
+          case DSPF_RGB555:
+               mov->regs.overlay_GRAPHICS_KEY_CLR = PIXEL_RGB555( config->dst_key.r,
+                                                                  config->dst_key.g,
+                                                                  config->dst_key.b );
+               break;
+          case DSPF_ARGB1555:
+               mov->regs.overlay_GRAPHICS_KEY_CLR = PIXEL_RGB555( config->dst_key.r,
+                                                                  config->dst_key.g,
+                                                                  config->dst_key.b );
+               break;
+          case DSPF_RGB16:
+               mov->regs.overlay_GRAPHICS_KEY_CLR = PIXEL_RGB16( config->dst_key.r,
+                                                                 config->dst_key.g,
+                                                                 config->dst_key.b );
+               break;
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               mov->regs.overlay_GRAPHICS_KEY_CLR = PIXEL_RGB32( config->dst_key.r,
+                                                                 config->dst_key.g,
+                                                                 config->dst_key.b );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+     }
+
+     mov->regs.overlay_GRAPHICS_KEY_MSK = (1 << DFB_COLOR_BITS_PER_PIXEL( primary_format )) - 1;
+
+     mov->regs.overlay_KEY_CNTL = ovColorKey[(config->options >> 3) & 3];
+}
+
+static void ov_calc_opacity( Mach64DriverData       *mdrv,
+                             Mach64OverlayLayerData *mov,
+                             CoreLayerRegionConfig  *config )
+{
+     mov->regs.overlay_SCALE_CNTL = SCALE_PIX_EXPAND | SCALE_Y2R_TEMP;
+
+     if (config->opacity && mov->visible)
+          mov->regs.overlay_SCALE_CNTL |= OVERLAY_EN | SCALE_EN;
+}
diff --git a/Source/DirectFB/gfxdrivers/mach64/mach64_state.c b/Source/DirectFB/gfxdrivers/mach64/mach64_state.c
new file mode 100755
index 0000000..8e798cc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mach64_state.c
@@ -0,0 +1,654 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "mach64.h"
+
+#include "mach64_state.h"
+
+
+void mach64_set_destination( Mach64DriverData *mdrv,
+                             Mach64DeviceData *mdev,
+                             CardState        *state )
+{
+     volatile u8 *mmio          = mdrv->mmio_base;
+     CoreSurface   *destination = state->destination;
+     unsigned int   pitch       = state->dst.pitch / DFB_BYTES_PER_PIXEL( destination->config.format );
+
+     mdev->pix_width &= ~DST_PIX_WIDTH;
+     switch (destination->config.format) {
+          case DSPF_RGB332:
+               mdev->pix_width |= DST_PIX_WIDTH_8BPP;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mdev->pix_width |= DST_PIX_WIDTH_15BPP;
+               break;
+          case DSPF_RGB16:
+               mdev->pix_width |= DST_PIX_WIDTH_16BPP;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mdev->pix_width |= DST_PIX_WIDTH_32BPP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, DST_OFF_PITCH, (state->dst.offset/8) | ((pitch/8) << 22) );
+}
+
+void mach64gt_set_destination( Mach64DriverData *mdrv,
+                               Mach64DeviceData *mdev,
+                               CardState        *state )
+{
+     volatile u8 *mmio         = mdrv->mmio_base;
+     CoreSurface  *destination = state->destination;
+     unsigned int  pitch       = state->dst.pitch / DFB_BYTES_PER_PIXEL( destination->config.format );
+
+     mdev->pix_width &= ~DST_PIX_WIDTH;
+     switch (destination->config.format) {
+          case DSPF_RGB332:
+               mdev->pix_width |= DST_PIX_WIDTH_RGB332;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mdev->pix_width |= DST_PIX_WIDTH_ARGB1555;
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               mdev->pix_width |= DST_PIX_WIDTH_ARGB4444;
+               break;
+          case DSPF_RGB16:
+               mdev->pix_width |= DST_PIX_WIDTH_RGB565;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mdev->pix_width |= DST_PIX_WIDTH_ARGB8888;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mdev->draw_blend &= ~DITHER_EN;
+     mdev->blit_blend &= ~DITHER_EN;
+     if (DFB_COLOR_BITS_PER_PIXEL( destination->config.format ) < 24) {
+          mdev->draw_blend |= DITHER_EN;
+          mdev->blit_blend |= DITHER_EN;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, DST_OFF_PITCH, (state->dst.offset/8) | ((pitch/8) << 22) );
+}
+
+void mach64_set_source( Mach64DriverData *mdrv,
+                        Mach64DeviceData *mdev,
+                        CardState        *state )
+{
+     volatile u8 *mmio     = mdrv->mmio_base;
+     CoreSurface   *source = state->source;
+     unsigned int   pitch  = state->src.pitch / DFB_BYTES_PER_PIXEL( source->config.format );
+
+     if (MACH64_IS_VALID( m_source ))
+          return;
+
+     mdev->pix_width &= ~SRC_PIX_WIDTH;
+     switch (source->config.format) {
+          case DSPF_RGB332:
+               mdev->pix_width |= SRC_PIX_WIDTH_8BPP;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mdev->pix_width |= SRC_PIX_WIDTH_15BPP;
+               break;
+          case DSPF_RGB16:
+               mdev->pix_width |= SRC_PIX_WIDTH_16BPP;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mdev->pix_width |= SRC_PIX_WIDTH_32BPP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, SRC_OFF_PITCH, (state->src.offset/8) | ((pitch/8) << 22) );
+
+     MACH64_VALIDATE( m_source );
+}
+
+void mach64gt_set_source( Mach64DriverData *mdrv,
+                          Mach64DeviceData *mdev,
+                          CardState        *state )
+{
+     volatile u8 *mmio     = mdrv->mmio_base;
+     CoreSurface   *source = state->source;
+     unsigned int   pitch  = state->src.pitch / DFB_BYTES_PER_PIXEL( source->config.format );
+
+     if (MACH64_IS_VALID( m_source ))
+          return;
+
+     mdev->pix_width &= ~SRC_PIX_WIDTH;
+     switch (source->config.format) {
+          case DSPF_RGB332:
+               mdev->pix_width |= SRC_PIX_WIDTH_RGB332;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mdev->pix_width |= SRC_PIX_WIDTH_ARGB1555;
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               mdev->pix_width |= SRC_PIX_WIDTH_ARGB4444;
+               break;
+          case DSPF_RGB16:
+               mdev->pix_width |= SRC_PIX_WIDTH_RGB565;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mdev->pix_width |= SRC_PIX_WIDTH_ARGB8888;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, SRC_OFF_PITCH, (state->src.offset/8) | ((pitch/8) << 22) );
+
+     MACH64_VALIDATE( m_source );
+}
+
+void mach64gt_set_source_scale( Mach64DriverData *mdrv,
+                                Mach64DeviceData *mdev,
+                                CardState        *state )
+{
+     volatile u8 *mmio     = mdrv->mmio_base;
+     CoreSurface   *source = state->source;
+     unsigned int   offset = state->src.offset;
+     unsigned int   pitch  = state->src.pitch;
+     int            height = source->config.size.h;
+
+     if (MACH64_IS_VALID( m_source_scale ))
+          return;
+
+     mdev->pix_width &= ~SCALE_PIX_WIDTH;
+     switch (source->config.format) {
+          case DSPF_RGB332:
+               mdev->pix_width |= SCALE_PIX_WIDTH_RGB332;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mdev->pix_width |= SCALE_PIX_WIDTH_ARGB1555;
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               mdev->pix_width |= SCALE_PIX_WIDTH_ARGB4444;
+               break;
+          case DSPF_RGB16:
+               mdev->pix_width |= SCALE_PIX_WIDTH_RGB565;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mdev->pix_width |= SCALE_PIX_WIDTH_ARGB8888;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mdev->blit_blend &= ~SCALE_PIX_EXPAND;
+     if (DFB_COLOR_BITS_PER_PIXEL( source->config.format ) < 24)
+          mdev->blit_blend |= SCALE_PIX_EXPAND;
+
+     mdev->field = source->field;
+     if (mdev->blit_deinterlace) {
+          if (mdev->field) {
+               if (source->config.caps & DSCAPS_SEPARATED) {
+                    offset += height/2 * pitch;
+               } else {
+                    offset += pitch;
+                    pitch  *= 2;
+               }
+          }
+          height /= 2;
+     }
+
+     mdev->source = source;
+
+     mdev->scale_offset = offset;
+     mdev->scale_pitch  = pitch;
+
+     mdev->tex_offset = offset;
+     mdev->tex_pitch  = direct_log2( pitch / DFB_BYTES_PER_PIXEL( source->config.format ) );
+     mdev->tex_height = direct_log2( height );
+     mdev->tex_size   = MAX( mdev->tex_pitch, mdev->tex_height );
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, TEX_SIZE_PITCH, (mdev->tex_pitch  << 0) |
+                                         (mdev->tex_size   << 4) |
+                                         (mdev->tex_height << 8) );
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          mach64_waitfifo( mdrv, mdev, 1 );
+          mach64_out32( mmio, TEX_CNTL, TEX_CACHE_FLUSH );
+     }
+
+     MACH64_VALIDATE( m_source_scale );
+}
+
+void mach64_set_clip( Mach64DriverData *mdrv,
+                      Mach64DeviceData *mdev,
+                      CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     mach64_waitfifo( mdrv, mdev, 2 );
+     mach64_out32( mmio, SC_LEFT_RIGHT, (S13( state->clip.x2 ) << 16) | S13( state->clip.x1 ) );
+     mach64_out32( mmio, SC_TOP_BOTTOM, (S14( state->clip.y2 ) << 16) | S14( state->clip.y1 ) );
+}
+
+void mach64_set_color( Mach64DriverData *mdrv,
+                       Mach64DeviceData *mdev,
+                       CardState        *state )
+{
+     volatile u8 *mmio    = mdrv->mmio_base;
+     DFBColor       color = state->color;
+     u32            clr;
+
+     if (MACH64_IS_VALID( m_color ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = (color.r * (color.a + 1)) >> 8;
+          color.g = (color.g * (color.a + 1)) >> 8;
+          color.b = (color.b * (color.a + 1)) >> 8;
+     }
+
+     switch (state->destination->config.format) {
+          case DSPF_RGB332:
+               clr = PIXEL_RGB332( color.r,
+                                   color.g,
+                                   color.b );
+               break;
+          case DSPF_RGB555:
+               clr = PIXEL_RGB555( color.r,
+                                   color.g,
+                                   color.b );
+               break;
+          case DSPF_ARGB1555:
+               clr = PIXEL_ARGB1555( color.a,
+                                     color.r,
+                                     color.g,
+                                     color.b );
+               break;
+          case DSPF_RGB444:
+               clr = PIXEL_RGB444( color.r,
+                                   color.g,
+                                   color.b );
+               break;
+          case DSPF_ARGB4444:
+               clr = PIXEL_ARGB4444( color.a,
+                                     color.r,
+                                     color.g,
+                                     color.b );
+               break;
+          case DSPF_RGB16:
+               clr = PIXEL_RGB16( color.r,
+                                  color.g,
+                                  color.b );
+               break;
+          case DSPF_RGB32:
+               clr = PIXEL_RGB32( color.r,
+                                  color.g,
+                                  color.b );
+               break;
+          case DSPF_ARGB:
+               clr = PIXEL_ARGB( color.a,
+                                 color.r,
+                                 color.g,
+                                 color.b );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, DP_FRGD_CLR, clr );
+
+     MACH64_VALIDATE( m_color );
+}
+
+void mach64_set_color_3d( Mach64DriverData *mdrv,
+                          Mach64DeviceData *mdev,
+                          CardState        *state )
+{
+     volatile u8 *mmio    = mdrv->mmio_base;
+     DFBColor       color = state->color;
+
+     if (MACH64_IS_VALID( m_color_3d ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = (color.r * (color.a + 1)) >> 8;
+          color.g = (color.g * (color.a + 1)) >> 8;
+          color.b = (color.b * (color.a + 1)) >> 8;
+     }
+
+     /* Some 3D color registers scaler registers are shared. */
+     mach64_waitfifo( mdrv, mdev, 7 );
+     mach64_out32( mmio, RED_X_INC, 0 );
+     mach64_out32( mmio, RED_START, color.r << 16 );
+     mach64_out32( mmio, GREEN_X_INC, 0 );
+     mach64_out32( mmio, GREEN_START, color.g << 16 );
+     mach64_out32( mmio, BLUE_X_INC, 0 );
+     mach64_out32( mmio, BLUE_START, color.b << 16 );
+     mach64_out32( mmio, ALPHA_START, color.a << 16 );
+
+     MACH64_INVALIDATE( m_color_tex | m_blit_blend );
+     MACH64_VALIDATE( m_color_3d );
+}
+
+void mach64_set_color_tex( Mach64DriverData *mdrv,
+                           Mach64DeviceData *mdev,
+                           CardState        *state )
+{
+     volatile u8 *mmio    = mdrv->mmio_base;
+     DFBColor       color = state->color;
+
+     if (MACH64_IS_VALID( m_color_tex ))
+          return;
+
+     if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+          if (state->blittingflags & DSBLIT_COLORIZE) {
+               color.r = (color.r * (color.a + 1)) >> 8;
+               color.g = (color.g * (color.a + 1)) >> 8;
+               color.b = (color.b * (color.a + 1)) >> 8;
+          } else {
+               color.r = color.g = color.b = color.a;
+          }
+     }
+
+     /* Some 3D color registers scaler registers are shared. */
+     mach64_waitfifo( mdrv, mdev, 7 );
+     mach64_out32( mmio, RED_X_INC, 0 );
+     mach64_out32( mmio, RED_START, color.r << 16 );
+     mach64_out32( mmio, GREEN_X_INC, 0 );
+     mach64_out32( mmio, GREEN_START, color.g << 16 );
+     mach64_out32( mmio, BLUE_X_INC, 0 );
+     mach64_out32( mmio, BLUE_START, color.b << 16 );
+     mach64_out32( mmio, ALPHA_START, color.a << 16 );
+
+     MACH64_INVALIDATE( m_color_3d | m_blit_blend );
+     MACH64_VALIDATE( m_color_tex );
+}
+
+void mach64_set_src_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev,
+                              CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (MACH64_IS_VALID( m_srckey ))
+          return;
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+     mach64_out32( mmio, CLR_CMP_MSK,
+                   (1 << DFB_COLOR_BITS_PER_PIXEL( state->source->config.format )) - 1 );
+     mach64_out32( mmio, CLR_CMP_CLR, state->src_colorkey );
+     mach64_out32( mmio, CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D );
+
+     MACH64_VALIDATE( m_srckey );
+     MACH64_INVALIDATE( m_srckey_scale | m_dstkey | m_disable_key );
+}
+
+void mach64_set_src_colorkey_scale( Mach64DriverData *mdrv,
+                                    Mach64DeviceData *mdev,
+                                    CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+     u32          clr, msk;
+
+     if (MACH64_IS_VALID( m_srckey_scale ))
+          return;
+
+     if (mdev->chip < CHIP_3D_RAGE_PRO) {
+          switch (state->source->config.format) {
+               case DSPF_RGB332:
+                    clr = ((state->src_colorkey & 0xE0) << 16) |
+                          ((state->src_colorkey & 0x1C) << 11) |
+                          ((state->src_colorkey & 0x03) <<  6);
+                    msk = 0xE0E0C0;
+                    break;
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+                    clr = ((state->src_colorkey & 0x0F00) << 12) |
+                          ((state->src_colorkey & 0x00F0) <<  8) |
+                          ((state->src_colorkey & 0x000F) <<  4);
+                    msk = 0xF0F0F0;
+                    break;
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+                    clr = ((state->src_colorkey & 0x7C00) << 9) |
+                          ((state->src_colorkey & 0x03E0) << 6) |
+                          ((state->src_colorkey & 0x001F) << 3);
+                    msk = 0xF8F8F8;
+                    break;
+               case DSPF_RGB16:
+                    clr = ((state->src_colorkey & 0xF800) << 8) |
+                          ((state->src_colorkey & 0x07E0) << 5) |
+                          ((state->src_colorkey & 0x001F) << 3);
+                    msk = 0xF8FCF8;
+                    break;
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    clr = state->src_colorkey;
+                    msk = 0xFFFFFF;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat!" );
+                    return;
+          }
+     } else {
+          clr = state->src_colorkey;
+          msk = (1 << DFB_COLOR_BITS_PER_PIXEL( state->source->config.format )) - 1;
+     }
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+     mach64_out32( mmio, CLR_CMP_MSK, msk );
+     mach64_out32( mmio, CLR_CMP_CLR, clr );
+     mach64_out32( mmio, CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_SCALE );
+
+     MACH64_VALIDATE( m_srckey_scale );
+     MACH64_INVALIDATE( m_srckey | m_dstkey | m_disable_key );
+}
+
+void mach64_set_dst_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev,
+                              CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (MACH64_IS_VALID( m_dstkey ))
+          return;
+
+     mach64_waitfifo( mdrv, mdev, 3 );
+     mach64_out32( mmio, CLR_CMP_MSK,
+                   (1 << DFB_COLOR_BITS_PER_PIXEL( state->destination->config.format )) - 1 );
+     mach64_out32( mmio, CLR_CMP_CLR, state->dst_colorkey );
+     mach64_out32( mmio, CLR_CMP_CNTL, CLR_CMP_FN_NOT_EQUAL | CLR_CMP_SRC_DEST );
+
+     MACH64_VALIDATE( m_dstkey );
+     MACH64_INVALIDATE( m_srckey | m_srckey_scale | m_disable_key );
+}
+
+void mach64_disable_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (MACH64_IS_VALID( m_disable_key ))
+          return;
+
+     mach64_waitfifo( mdrv, mdev, 1 );
+     mach64_out32( mmio, CLR_CMP_CNTL, CLR_CMP_FN_FALSE );
+
+     MACH64_VALIDATE( m_disable_key );
+     MACH64_INVALIDATE( m_srckey | m_srckey_scale | m_dstkey );
+}
+
+static u32 mach64SourceBlend[] = {
+     ALPHA_BLND_SRC_ZERO,
+     ALPHA_BLND_SRC_ONE,
+     0,
+     0,
+     ALPHA_BLND_SRC_SRCALPHA,
+     ALPHA_BLND_SRC_INVSRCALPHA,
+     ALPHA_BLND_SRC_DSTALPHA,
+     ALPHA_BLND_SRC_INVDSTALPHA,
+     ALPHA_BLND_SRC_DSTCOLOR,
+     ALPHA_BLND_SRC_INVDSTCOLOR,
+     ALPHA_BLND_SAT
+};
+
+static u32 mach64DestBlend[] = {
+     ALPHA_BLND_DST_ZERO,
+     ALPHA_BLND_DST_ONE,
+     ALPHA_BLND_DST_SRCCOLOR,
+     ALPHA_BLND_DST_INVSRCCOLOR,
+     ALPHA_BLND_DST_SRCALPHA,
+     ALPHA_BLND_DST_INVSRCALPHA,
+     ALPHA_BLND_DST_DSTALPHA,
+     ALPHA_BLND_DST_INVDSTALPHA,
+     0,
+     0,
+     0
+};
+
+void mach64_set_draw_blend( Mach64DriverData *mdrv,
+                            Mach64DeviceData *mdev,
+                            CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (MACH64_IS_VALID( m_draw_blend ))
+          return;
+
+     mdev->draw_blend &= DITHER_EN;
+     mdev->draw_blend |= ALPHA_FOG_EN_ALPHA |
+                         mach64SourceBlend[state->src_blend - 1] |
+                         mach64DestBlend  [state->dst_blend - 1];
+
+     if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+          /* FIXME: This is wrong. */
+          mach64_waitfifo( mdrv, mdev, 1 );
+          mach64_out32( mmio, ALPHA_TST_CNTL, ALPHA_DST_SEL_DSTALPHA );
+     }
+
+     MACH64_VALIDATE( m_draw_blend );
+}
+
+void mach64_set_blit_blend( Mach64DriverData *mdrv,
+                            Mach64DeviceData *mdev,
+                            CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (MACH64_IS_VALID( m_blit_blend ))
+          return;
+
+     mdev->blit_blend &= SCALE_PIX_EXPAND | DITHER_EN;
+
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+          /* Disable dithering because it is applied even when
+           * the source pixels are completely transparent.
+           */
+          if (DFB_PIXELFORMAT_HAS_ALPHA( state->source->config.format ))
+               mdev->blit_blend &= ~DITHER_EN;
+
+          mdev->blit_blend |= ALPHA_FOG_EN_ALPHA |
+                              mach64SourceBlend[state->src_blend - 1] |
+                              mach64DestBlend  [state->dst_blend - 1];
+
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+               if (DFB_PIXELFORMAT_HAS_ALPHA( state->source->config.format )) {
+                    mdev->blit_blend |= TEX_MAP_AEN;
+               } else {
+                    mach64_waitfifo( mdrv, mdev, 1 );
+                    mach64_out32( mmio, ALPHA_START, 0xFF << 16 );
+                    MACH64_INVALIDATE( m_color_3d | m_color_tex );
+               }
+          }
+
+          if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+               /* FIXME: This is wrong. */
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, ALPHA_TST_CNTL, ALPHA_DST_SEL_DSTALPHA );
+          }
+     } else {
+          /* This needs to be set even without alpha blending.
+           * Otherwise alpha channel won't get copied.
+           */
+          if (DFB_PIXELFORMAT_HAS_ALPHA( state->source->config.format ))
+               mdev->blit_blend |= TEX_MAP_AEN;
+
+          if (mdev->chip >= CHIP_3D_RAGE_PRO) {
+               /* FIXME: This is wrong. */
+               mach64_waitfifo( mdrv, mdev, 1 );
+               mach64_out32( mmio, ALPHA_TST_CNTL, ALPHA_DST_SEL_SRCALPHA );
+          }
+     }
+
+     if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+          mdev->blit_blend |= TEX_LIGHT_FCN_MODULATE;
+
+     MACH64_VALIDATE( m_blit_blend );
+}
diff --git a/Source/DirectFB/gfxdrivers/mach64/mach64_state.h b/Source/DirectFB/gfxdrivers/mach64/mach64_state.h
new file mode 100755
index 0000000..8957d8a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mach64_state.h
@@ -0,0 +1,90 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MACH64_STATE_H__
+#define ___MACH64_STATE_H__
+
+#include "mach64.h"
+
+void mach64_set_destination( Mach64DriverData *mdrv,
+                             Mach64DeviceData *mdev,
+                             CardState        *state );
+void mach64gt_set_destination( Mach64DriverData *mdrv,
+                               Mach64DeviceData *mdev,
+                               CardState        *state );
+
+void mach64_set_source( Mach64DriverData *mdrv,
+                        Mach64DeviceData *mdev,
+                        CardState        *state );
+void mach64gt_set_source( Mach64DriverData *mdrv,
+                          Mach64DeviceData *mdev,
+                          CardState        *state );
+void mach64gt_set_source_scale( Mach64DriverData *mdrv,
+                                Mach64DeviceData *mdev,
+                                CardState        *state );
+
+void mach64_set_clip( Mach64DriverData *mdrv,
+                      Mach64DeviceData *mdev,
+                      CardState        *state );
+
+void mach64_set_color( Mach64DriverData *mdrv,
+                       Mach64DeviceData *mdev,
+                       CardState        *state );
+
+void mach64_set_color_3d( Mach64DriverData *mdrv,
+                          Mach64DeviceData *mdev,
+                          CardState        *state );
+
+void mach64_set_color_tex( Mach64DriverData *mdrv,
+                           Mach64DeviceData *mdev,
+                           CardState        *state );
+
+void mach64_set_src_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev,
+                              CardState        *state );
+
+void mach64_set_src_colorkey_scale( Mach64DriverData *mdrv,
+                                    Mach64DeviceData *mdev,
+                                    CardState        *state );
+
+void mach64_set_dst_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev,
+                              CardState        *state );
+
+void mach64_disable_colorkey( Mach64DriverData *mdrv,
+                              Mach64DeviceData *mdev );
+
+void mach64_set_draw_blend( Mach64DriverData *mdrv,
+                            Mach64DeviceData *mdev,
+                            CardState        *state );
+
+void mach64_set_blit_blend( Mach64DriverData *mdrv,
+                            Mach64DeviceData *mdev,
+                            CardState        *state );
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/mach64/mmio.h b/Source/DirectFB/gfxdrivers/mach64/mmio.h
new file mode 100755
index 0000000..c8aed85
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/mmio.h
@@ -0,0 +1,198 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MACH64_MMIO_H__
+#define ___MACH64_MMIO_H__
+
+#include <dfb_types.h>
+
+#include "mach64.h"
+
+static inline void
+mach64_out8( volatile u8 *mmioaddr, u32 reg, u8 value )
+{
+     *((volatile u8*)(mmioaddr+reg)) = value;
+}
+
+static inline u8
+mach64_in8( volatile u8 *mmioaddr, u32 reg )
+{
+     return *((volatile u8*)(mmioaddr+reg));
+}
+
+static inline void
+mach64_out32( volatile u8 *mmioaddr, u32 reg, u32 value )
+{
+#ifdef __powerpc__
+     if (reg >= 0x400)
+          asm volatile("stwbrx %0,%1,%2;eieio" : : "r"(value), "b"(reg-0x800),
+                              "r"(mmioaddr) : "memory");
+     else
+          asm volatile("stwbrx %0,%1,%2;eieio" : : "r"(value), "b"(reg),
+                              "r"(mmioaddr) : "memory");
+#else
+     if (reg >= 0x400)
+          *((volatile u32*)(mmioaddr+reg-0x800)) = value;
+     else
+          *((volatile u32*)(mmioaddr+reg)) = value;
+#endif
+}
+
+static inline u32
+mach64_in32( volatile u8 *mmioaddr, u32 reg )
+{
+#ifdef __powerpc__
+     u32 value;
+
+     if (reg >= 0x400)
+          asm volatile("lwbrx %0,%1,%2;eieio" : "=r"(value) : "b"(reg-0x800), "r"(mmioaddr));
+     else
+          asm volatile("lwbrx %0,%1,%2;eieio" : "=r"(value) : "b"(reg), "r"(mmioaddr));
+
+     return value;
+#else
+     if (reg >= 0x400)
+          return *((volatile u32*)(mmioaddr+reg-0x800));
+     else
+          return *((volatile u32*)(mmioaddr+reg));
+#endif
+}
+
+static const u32 lt_lcd_regs[] = {
+     CONFIG_PANEL_LT,
+     LCD_GEN_CTRL_LT,
+     DSTN_CONTROL_LT,
+     HFB_PITCH_ADDR_LT,
+     HORZ_STRETCHING_LT,
+     VERT_STRETCHING_LT,
+     0, /* EXT_VERT_STRETCH */
+     LT_GIO_LT,
+     POWER_MANAGEMENT_LT
+};
+
+#if 0
+static inline void
+mach64_in_lcd( Mach64DeviceData *mdev,
+               volatile u8      *mmioaddr, u8 reg, u32 value )
+{
+     if (mdev->chip == CHIP_3D_RAGE_LT) {
+          mach64_out32( mmioaddr, lt_lcd_regs[reg], value );
+     } else if (mdev->chip >= CHIP_3D_RAGE_LT_PRO) {
+          mach64_out8( mmioaddr, LCD_INDEX, reg );
+          mach64_out32( mmioaddr, LCD_DATA, value );
+     }
+}
+#endif
+
+static inline u32
+mach64_in_lcd( Mach64DeviceData *mdev,
+               volatile u8      *mmioaddr, u8 reg )
+{
+     if (mdev->chip == CHIP_3D_RAGE_LT) {
+          return mach64_in32( mmioaddr, lt_lcd_regs[reg] );
+     } else if (mdev->chip >= CHIP_3D_RAGE_LT_PRO) {
+          mach64_out8( mmioaddr, LCD_INDEX, reg );
+          return mach64_in32( mmioaddr, LCD_DATA );
+     } else {
+          return 0;
+     }
+}
+
+#if 0
+static inline void
+mach64_out_pll( volatile u8 *mmioaddr, u8 reg, u8 value )
+{
+     mach64_out8( mmioaddr, CLOCK_CNTL1, (reg << 2) | PLL_WR_EN );
+     mach64_out8( mmioaddr, CLOCK_CNTL2, value );
+}
+#endif
+
+static inline u8
+mach64_in_pll( volatile u8 *mmioaddr, u8 reg )
+{
+     mach64_out8( mmioaddr, CLOCK_CNTL1, reg << 2 );
+     return mach64_in8( mmioaddr, CLOCK_CNTL2 );
+}
+
+static inline void mach64_waitidle( Mach64DriverData *mdrv,
+                                    Mach64DeviceData *mdev )
+{
+     int timeout = 1000000;
+
+     while (timeout--) {
+          if ((mach64_in32( mdrv->mmio_base, FIFO_STAT ) & 0x0000FFFF) == 0)
+               break;
+
+          mdev->idle_waitcycles++;
+     }
+
+     timeout = 1000000;
+
+     while (timeout--) {
+          if ((mach64_in32( mdrv->mmio_base, GUI_STAT ) & GUI_ACTIVE) == 0)
+               break;
+
+          mdev->idle_waitcycles++;
+     }
+
+     mdev->fifo_space = 16;
+}
+
+static inline void mach64_waitfifo( Mach64DriverData *mdrv,
+                                    Mach64DeviceData *mdev,
+                                    unsigned int requested_fifo_space )
+{
+     u32 fifo_stat;
+     int timeout = 1000000;
+
+     mdev->waitfifo_sum += requested_fifo_space;
+     mdev->waitfifo_calls++;
+
+     if (mdev->fifo_space < requested_fifo_space) {
+          while (timeout--) {
+               mdev->fifo_waitcycles++;
+
+               fifo_stat = mach64_in32( mdrv->mmio_base, FIFO_STAT ) & 0x0000FFFF;
+               mdev->fifo_space = 16;
+               while (fifo_stat) {
+                    mdev->fifo_space--;
+                    fifo_stat >>= 1;
+               }
+
+               if (mdev->fifo_space >= requested_fifo_space)
+                    break;
+          }
+     }
+     else {
+          mdev->fifo_cache_hits++;
+     }
+     mdev->fifo_space -= requested_fifo_space;
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/mach64/regs.h b/Source/DirectFB/gfxdrivers/mach64/regs.h
new file mode 100755
index 0000000..d764fea
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/mach64/regs.h
@@ -0,0 +1,883 @@
+#ifndef __MACH64_REGS_H__
+#define __MACH64_REGS_H__
+
+/* LCD Panel registers */
+#define CONFIG_PANEL            0x00
+#define LCD_GEN_CTRL            0x01
+#define DSTN_CONTROL            0x02
+#define HFB_PITCH_ADDR          0x03
+#define HORZ_STRETCHING         0x04
+#define VERT_STRETCHING         0x05
+#define EXT_VERT_STRETCH        0x06
+#define LT_GIO                  0x07
+#define POWER_MANAGEMENT        0x08
+#define ZVGPIO                  0x09
+#define ICON_CLR0               0x0A
+#define ICON_CLR1               0x0B
+#define ICON_OFFSET             0x0C
+#define ICON_HORZ_VERT_POSN     0x0D
+#define ICON_HORZ_VERT_OFF      0x0E
+#define ICON2_CLR0              0x0F
+#define ICON2_CLR1              0x10
+#define ICON2_OFFSET            0x11
+#define ICON2_HORZ_VERT_POSN    0x12
+#define ICON2_HORZ_VERT_OFF     0x13
+#define LCD_MISC_CNTL           0x14
+#define TMDS_CNTL               0x15
+#define SCRATCH_PAD_4           0x15
+#define TMDS_SYNC_CHAR_SETA     0x16
+#define SCRATCH_PAD_5           0x16
+#define TMDS_SYNC_CHAR_SETB     0x17
+#define SCRATCH_PAD_6           0x17
+#define TMDS_CRC                0x18
+#define SCRATCH_PAD_7           0x18
+#define PLTSTBLK_GEN_SEED       0x19
+#define SCRATCH_PAD_8           0x19
+#define SYNC_GEN_CNTL           0x1A
+#define PATTERN_GEN_SEED        0x1B
+#define APC_CNTL                0x1C
+#define POWER_MANAGEMENT_2      0x1D
+#define PRI_ERR_PATTERN         0x1E
+#define CUR_ERR_PATTERN         0x1F
+#define PLTSTBLK_RPT            0x20
+#define SYNC_RPT                0x21
+#define CRC_PATTERN_RPT         0x22
+#define PL_TRANSMITTER_CNTL     0x23
+#define PL_PLL_CNTL             0x24
+#define ALPHA_BLENDING          0x25
+#define PORTRAIT_GEN_CNTL       0x26
+#define APC_CTRL_IO             0x27
+#define TEST_IO                 0x28
+#define TEST_OUTPUTS            0x29
+#define DP1_MEM_ACCESS          0x2A
+#define DP0_MEM_ACCESS          0x2B
+#define DP0_DEBUG_A             0x2C
+#define DP0_DEBUG_B             0x2D
+#define DP1_DEBUG_A             0x2E
+#define DP1_DEBUG_B             0x2F
+#define DPCTRL_DEBUG_A          0x30
+#define DPCTRL_DEBUG_B          0x31
+#define MEMBLK_DEBUG            0x32
+/* #define SCRATCH_PAD_4           0x33 */
+#define APC_LUT_AB              0x33
+/* #define SCRATCH_PAD_5           0x34 */
+#define APC_LUT_CD              0x34
+/* #define SCRATCH_PAD_6           0x35 */
+#define APC_LUT_EF              0x25
+/* #define SCRATCH_PAD_7           0x36 */
+#define APC_LUT_GH              0x36
+/* #define SCRATCH_PAD_8           0x37 */
+#define APC_LUT_IJ              0x37
+#define APC_LUT_KL              0x38
+#define APC_LUT_MN              0x39
+#define APC_LUT_OP              0x3A
+
+/* LCD_GEN_CTRL */
+#define LCD_ON                          0x00000002
+
+/* VERT_STRETCHING */
+#define VERT_STRETCH_RATIO0             0x000003FF
+#define VERT_STRETCH_EN                 0x80000000
+
+
+/* PLL registers */
+#define MPLL_CNTL               0x00
+#define VPLL_CNTL               0x01
+#define PLL_REF_DIV             0x02
+#define PLL_GEN_CNTL            0x03
+#define MCLK_FB_DIV             0x04
+#define PLL_VCLK_CNTL           0x05
+#define VCLK_POST_DIV           0x06
+#define VCLK0_FB_DIV            0x07
+#define VCLK1_FB_DIV            0x08
+#define VCLK2_FB_DIV            0x09
+#define VCLK3_FB_DIV            0x0A
+#define PLL_EXT_CNTL            0x0B
+#define DLL_CNTL                0x0C
+#define DLL1_CNTL               0x0C
+#define VFC_CNTL                0x0D
+#define PLL_TEST_CNTL           0x0E
+#define PLL_TEST_COUNT          0x0F
+#define LVDSPLL_CNTL0           0x10
+#define LVDS_CNTL0              0x10
+#define LVDSPLL_CNTL1           0x11
+#define LVDS_CNTL1              0x11
+#define AGP1_CNTL               0x12
+#define AGP2_CNTL               0x13
+#define DLL2_CNTL               0x14
+#define SCLK_FB_DIV             0x15
+#define SPLL_CNTL1              0x16
+#define SPLL_CNTL2              0x17
+#define APLL_STRAPS             0x18
+#define EXT_VPLL_CNTL           0x19
+#define EXT_VPLL_REF_DIV        0x1A
+#define EXT_VPLL_FB_DIV         0x1B
+#define EXT_VPLL_MSB            0x1C
+#define HTOTAL_CNTL             0x1D
+#define BYTE_CLK_CNTL           0x1E
+#define TV_PLL_CNTL1            0x1F
+#define TV_PLL_CNTL2            0x20
+#define TV_PLL_CNTL             0x21
+#define EXT_TV_PLL              0x22
+#define V2PLL_CNTL              0x23
+#define PLL_V2CLK_CNTL          0x24
+#define EXT_V2PLL_REF_DIV       0x25
+#define EXT_V2PLL_FB_DIV        0x26
+#define EXT_V2PLL_MSB           0x27
+#define HTOTAL2_CNTL            0x28
+#define PLL_YCLK_CNTL           0x29
+#define PM_DYN_CLK_CNTL         0x2A
+
+/* PLL_VCLK_CNTL */
+#define ECP_DIV                         0x30
+
+
+/* TV Out registers */
+/* 0x00 - 0x0F */
+#define TV_MASTER_CNTL          0x10
+/* 0x11 */
+#define TV_RGB_CNTL             0x12
+/* 0x13 */
+#define TV_SYNC_CNTL            0x14
+/* 0x15 - 1F */
+#define TV_HTOTAL               0x20
+#define TV_HDISP                0x21
+#define TV_HSIZE                0x22
+#define TV_HSTART               0x23
+#define TV_HCOUNT               0x24
+#define TV_VTOTAL               0x25
+#define TV_VDISP                0x26
+#define TV_VCOUNT               0x27
+#define TV_FTOTAL               0x28
+#define TV_FCOUNT               0x29
+#define TV_FRESTART             0x2A
+#define TV_HRESTART             0x2B
+#define TV_VRESTART             0x2C
+/* 0x2D - 0x5F */
+#define TV_HOST_READ_DATA       0x60
+#define TV_HOST_WRITE_DATA      0x61
+#define TV_HOST_RD_WT_CNTL      0x62
+/* 0x63 - 0x6F */
+#define TV_VSCALER_CNTL         0x70
+#define TV_TIMING_CNTL          0x71
+#define TV_GAMMA_CNTL           0x72
+#define TV_Y_FALL_CNTL          0x73
+#define TV_Y_RISE_CNTL          0x74
+#define TV_Y_SAW_TOOTH_CNTL     0x75
+/* 0x76 - 0x7F */
+#define TV_MODULATOR_CNTL1      0x80
+#define TV_MODULATOR_CNTL2      0x81
+/* 0x82 - 0x8F */
+#define TV_PRE_DAC_MUX_CNTL     0x90
+/* 0x91 - 0x9F */
+#define TV_DAC_CNTL             0xA0
+/* 0xA1 - 0xAF */
+#define TV_CRC_CNTL             0xB0
+#define TV_VIDEO_PORT_SIG       0xB1
+/* 0xB2 - 0xB7 */
+#define TV_VBI_CC_CNTL          0xB8
+#define TV_VBI_EDS_CNTL         0xB9
+#define TV_VBI_20BIT_CNTL       0xBA
+/* 0xBB - 0xBC */
+#define TV_VBI_DTO_CNTL         0xBD
+#define TV_VBI_LEVEL_CNTL       0xBE
+/* 0xBF */
+#define TV_UV_ADR               0xC0
+#define TV_FIFO_TEST_CNTL       0xC1
+/* 0xC2 - 0xFF */
+
+
+/* Main registers */
+#define CRTC_H_TOTAL_DISP       0x000
+#define CRTC2_H_TOTAL_DISP      0x000
+#define CRTC_H_SYNC_STRT_WID    0x004
+#define CRTC2_H_SYNC_STRT_WID   0x004
+#define CRTC_V_TOTAL_DISP       0x008
+#define CRTC2_V_TOTAL_DISP      0x008
+#define CRTC_V_SYNC_STRT_WID    0x00C
+#define CRTC2_V_SYNC_STRT_WID   0x00C
+#define CRTC_VLINE_CRNT_VLINE   0x010
+#define CRTC2_VLINE_CRNT_VLINE  0x010
+#define CRTC_OFF_PITCH          0x014
+#define CRTC_INT_CNTL           0x018
+#define CRTC_GEN_CNTL           0x01C
+#define TV_OUT_INDEX            0x01D
+#define DSP_CONFIG              0x020
+#define PM_DSP_CONFIG           0x020
+#define DSP_ON_OFF              0x024
+#define PM_DSP_ON_OFF           0x024
+#define TV_OUT_DATA             0x01D
+#define TIMER_CONFIG            0x028
+#define MEM_BUF_CNTL            0x02C
+#define SHARED_CNTL             0x030
+#define SHARED_MEM_CONFIG       0x034
+#define MEM_ADDR_CONFIG         0x034
+#define CRT_TRAP                0x038
+#define I2C_CNTL_0              0x03C
+#define DSTN_CONTROL_LT         0x03C
+#define OVR_CLR                 0x040
+#define OVR2_CLR                0x040
+#define OVR_WID_LEFT_RIGHT      0x044
+#define OVR2_WID_LEFT_RIGHT     0x044
+#define OVR_WID_TOP_BOTTOM      0x048
+#define OVR2_WID_TOP_BOTTOM     0x048
+#define VGA_DSP_CONFIG          0x04C
+#define PM_VGA_DSP_CONFIG       0x04C
+#define VGA_DSP_ON_OFF          0x050
+#define PM_VGA_DSP_ON_OFF       0x050
+#define DSP2_CONFIG             0x054
+#define PM_DSP2_CONFIG          0x054
+#define DSP2_ON_OFF             0x058
+#define PM_DSP2_ON_OFF          0x058
+#define CRTC2_OFF_PITCH         0x05C
+#define CUR_CLR0                0x060
+#define CUR2_CLR0               0x060
+#define CUR_CLR1                0x064
+#define CUR2_CLR1               0x064
+#define CUR_OFFSET              0x068
+#define CUR2_OFFSET             0x068
+#define CUR_HORZ_VERT_POSN      0x06C
+#define CUR2_HORZ_VERT_POSN     0x06C
+#define CUR_HORZ_VERT_OFF       0x070
+#define CUR2_HORZ_VERT_OFF      0x070
+#define CONFIG_PANEL_LT         0x074
+#define GP_IO                   0x078
+#define HW_DEBUG                0x07C
+#define SCRATCH_REG0            0x080
+#define SCRATCH_REG1            0x084
+#define SCRATCH_REG2            0x088
+#define SCRATCH_REG3            0x08C
+#define CLOCK_CNTL              0x090
+#define CLOCK_CNTL0             0x090
+#define CLOCK_CNTL1             0x091
+#define CLOCK_CNTL2             0x092
+#define CLOCK_CNTL3             0x093
+#define CONFIG_STAT1            0x094
+#define CONFIG_STAT2            0x098
+/* 0x09C */
+#define BUS_CNTL                0x0A0
+#define LCD_INDEX               0x0A4
+#define LCD_DATA                0x0A8
+#define HFB_PITCH_ADDR_LT       0x0A8
+#define EXT_MEM_CNTL            0x0AC
+#define MEM_CNTL                0x0B0
+#define MEM_VGA_WP_SEL          0x0B4
+#define MEM_VGA_RP_SEL          0x0B8
+#define I2C_CNTL_1              0x0BC
+#define LT_GIO_LT               0x0BC
+#define DAC_REGS                0x0C0
+#define DAC_CNTL                0x0C4
+#define EXT_DAC_REGS            0x0C8
+#define HORZ_STRETCHING_LT      0x0C8
+#define VERT_STRETCHING_LT      0x0CC
+#define GEN_TEST_CNTL           0x0D0
+#define CUSTOM_MACRO_CNTL       0x0D4
+#define LCD_GEN_CTRL_LT         0x0D4
+#define POWER_MANAGEMENT_LT     0x0D8
+#define CONFIG_CNTL             0x0DC
+#define CONFIG_CHIP_ID          0x0E0
+#define CONFIG_STAT0            0x0E4
+#define CRC_SIG                 0x0E8
+#define CRC2_SIG                0x0E8
+/* 0x0EC - 0x0FC */
+#define DST_OFF_PITCH           0x100
+#define DST_X                   0x104
+#define DST_Y                   0x108
+#define DST_Y_X                 0x10C
+#define DST_WIDTH               0x110
+#define DST_HEIGHT              0x114
+#define DST_HEIGHT_WIDTH        0x118
+#define DST_X_WIDTH             0x11C
+#define DST_BRES_LNTH           0x120
+/* #define LEAD_BRES_LNTH          0x120 */
+#define DST_BRES_ERR            0x124
+#define LEAD_BRES_ERR           0x124
+#define DST_BRES_INC            0x128
+#define LEAD_BRES_INC           0x128
+#define DST_BRES_DEC            0x12C
+#define LEAD_BRES_DEC           0x12C
+#define DST_CNTL                0x130
+/* #define DST_Y_X                 0x134 */
+#define TRAIL_BRES_ERR          0x138
+#define TRAIL_BRES_INC          0x13C
+#define TRAIL_BRES_DEC          0x140
+#define LEAD_BRES_LNTH          0x144
+#define Z_OFF_PITCH             0x148
+#define Z_CNTL                  0x14C
+#define ALPHA_TST_CNTL          0x150
+/* 0x154 */
+#define SECONDARY_STW_EXP       0x158
+#define SECONDARY_S_X_INC       0x15C
+#define SECONDARY_S_Y_INC       0x160
+#define SECONDARY_S_START       0x164
+#define SECONDARY_W_X_INC       0x168
+#define SECONDARY_W_Y_INC       0x16C
+#define SECONDARY_W_START       0x170
+#define SECONDARY_T_X_INC       0x174
+#define SECONDARY_T_Y_INC       0x178
+#define SECONDARY_T_START       0x17C
+#define SRC_OFF_PITCH           0x180
+#define SRC_X                   0x184
+#define SRC_Y                   0x188
+#define SRC_Y_X                 0x18C
+#define SRC_WIDTH1              0x190
+#define SRC_HEIGHT1             0x194
+#define SRC_HEIGHT1_WIDTH1      0x198
+#define SRC_X_START             0x19C
+#define SRC_Y_START             0x1A0
+#define SRC_Y_X_START           0x1A4
+#define SRC_WIDTH2              0x1A8
+#define SRC_HEIGHT2             0x1AC
+#define SRC_HEIGHT2_WIDTH2      0x1B0
+#define SRC_CNTL                0x1B4
+/* 0x1B8 - 0x1BC */
+#define SCALE_Y_OFF             0x1C0
+#define SCALE_OFF               0x1C0
+#define TEX_0_OFF               0x1C0
+#define SECONDARY_SCALE_OFF     0x1C4
+#define TEX_1_OFF               0x1C4
+#define TEX_2_OFF               0x1C8
+#define TEX_3_OFF               0x1CC
+#define TEX_4_OFF               0x1D0
+#define TEX_5_OFF               0x1D4
+#define TEX_6_OFF               0x1D8
+#define SCALE_WIDTH             0x1DC
+#define TEX_7_OFF               0x1DC
+#define SCALE_HEIGHT            0x1E0
+#define TEX_8_OFF               0x1E0
+#define TEX_9_OFF               0x1E4
+#define TEX_10_OFF              0x1E8
+#define SCALE_Y_PITCH           0x1EC
+#define SCALE_PITCH             0x1EC
+/* #define S_Y_INC                 0x1EC */
+#define SCALE_X_INC             0x1F0
+/* #define RED_X_INC               0x1F0 */
+#define SCALE_Y_INC             0x1F4
+/* #define GREEN_X_INC             0x1F4 */
+#define SCALE_VACC              0x1F8
+#define SCALE_3D_CNTL           0x1FC
+#define HOST_DATA0              0x200
+#define HOST_DATA1              0x204
+#define HOST_DATA2              0x208
+#define HOST_DATA3              0x20C
+#define HOST_DATA4              0x210
+#define HOST_DATA5              0x214
+#define HOST_DATA6              0x218
+#define HOST_DATA7              0x21C
+#define HOST_DATA8              0x220
+#define HOST_DATA9              0x224
+#define HOST_DATAA              0x228
+#define HOST_DATAB              0x22C
+#define HOST_DATAC              0x230
+#define HOST_DATAD              0x234
+#define HOST_DATAE              0x238
+#define HOST_DATAF              0x23C
+#define HOST_CNTL               0x240
+#define BM_HOSTDATA             0x244
+#define BM_ADDR                 0x248
+#define BM_DATA                 0x248
+#define BM_GUI_TABLE_CMD        0x24C
+/* 0x250 - 0x27C */
+#define PAT_REG0                0x280
+#define PAT_REG1                0x284
+#define PAT_CNTL                0x288
+/* 0x28C - 0x29C */
+#define SC_LEFT                 0x2A0
+#define SC_RIGHT                0x2A4
+#define SC_LEFT_RIGHT           0x2A8
+#define SC_TOP                  0x2AC
+#define SC_BOTTOM               0x2B0
+#define SC_TOP_BOTTOM           0x2B4
+#define USR1_DST_OFF_PITCH      0x2B8
+#define USR2_DST_OFF_PITCH      0x2BC
+#define DP_BKGD_CLR             0x2C0
+#define DP_FRGD_CLR             0x2C4
+#define DP_FOG_CLR              0x2C4
+#define DP_WRITE_MSK            0x2C8
+#define DP_CHAIN_MSK            0x2CC
+#define DP_PIX_WIDTH            0x2D0
+#define DP_MIX                  0x2D4
+#define DP_SRC                  0x2D8
+#define DP_FRGD_CLR_MIX         0x2DC
+#define DP_FRGD_BKGD_CLR        0x2E0
+/* 0x2E4 */
+#define DST_X_Y                 0x2E8
+#define DST_WIDTH_HEIGHT        0x2EC
+#define USR_DST_PITCH           0x2F0
+/* 0x2F4 */
+#define DP_SET_GUI_ENGINE2      0x2F8
+#define DP_SET_GUI_ENGINE       0x2FC
+#define CLR_CMP_CLR             0x300
+#define CLR_CMP_MSK             0x304
+#define CLR_CMP_CNTL            0x308
+/* 0x30C */
+#define FIFO_STAT               0x310
+/* 0x314 - 0x31C */
+#define CONTEXT_MSK             0x320
+/* 0x324 */
+/* 0x328 */
+#define CONTEXT_LOAD_CNTL       0x32C
+#define GUI_TRAJ_CNTL           0x330
+/* 0x334 */
+#define GUI_STAT                0x338
+/* 0x33C */
+#define S_X_INC2                0x340
+#define TEX_PALETTE_INDEX       0x340
+#define S_Y_INC2                0x344
+#define STW_EXP                 0x344
+#define S_XY_INC2               0x348
+#define LOG_MAX_INC             0x348
+#define S_X_INC_START           0x34C
+#define S_X_INC                 0x34C
+#define S_Y_INC                 0x350
+/* #define SCALE_Y_PITCH           0x350 */
+/* #define SCALE_PITCH             0x350 */
+#define S_START                 0x354
+#define T_X_INC2                0x358
+#define W_X_INC                 0x358
+#define T_Y_INC2                0x35C
+#define W_Y_INC                 0x35C
+#define T_XY_INC2               0x360
+#define W_START                 0x360
+#define T_X_INC_START           0x364
+#define T_X_INC                 0x364
+#define SECONDARY_SCALE_PITCH   0x368
+#define T_Y_INC                 0x368
+#define T_START                 0x36C
+#define TEX_SIZE_PITCH          0x370
+#define TEX_CNTL                0x374
+#define SECONDARY_TEX_OFFSET    0x378
+#define TEX_PAL_WR              0x37C
+#define TEX_PALETTE             0x37C
+#define SCALE_PITCH_BOTH        0x380
+#define SECONDARY_SCALE_OFF_ACC 0x384
+#define SCALE_OFF_ACC           0x388
+#define SCALE_DST_Y_X           0x38C
+/* 0x390 - 0x394 */
+#define COMPOSITE_SHADOW_ID     0x398
+#define SECONDARY_SCALE_X_INC   0x39C
+#define SPECULAR_RED_X_INC      0x39C
+#define SPECULAR_RED_Y_INC      0x3A0
+#define SECONDARY_SCALE_HACC    0x3A4
+#define SPECULAR_RED_START      0x3A4
+#define SPECULAR_GREEN_X_INC    0x3A8
+#define SPECULAR_GREEN_Y_INC    0x3AC
+#define SPECULAR_GREEN_START    0x3B0
+#define SPECULAR_BLUE_X_INC     0x3B4
+#define SPECULAR_BLUE_Y_INC     0x3B8
+#define SPECULAR_BLUE_START     0x3BC
+/* #define SCALE_X_INC             0x3C0 */
+#define RED_X_INC               0x3C0
+#define RED_Y_INC               0x3C4
+#define SCALE_HACC              0x3C8
+#define RED_START               0x3C8
+/* #define SCALE_Y_INC             0x3CC */
+#define GREEN_X_INC             0x3CC
+#define SECONDARY_SCALE_Y_INC   0x3D0
+#define GREEN_Y_INC             0x3D0
+#define SECONDARY_SCALE_VACC    0x3D4
+#define GREEN_START             0x3D4
+#define SCALE_XUV_INC           0x3D8
+#define BLUE_X_INC              0x3D8
+#define BLUE_Y_INC              0x3DC
+#define SCALE_UV_HACC           0x3E0
+#define BLUE_START              0x3E0
+#define Z_X_INC                 0x3E4
+#define Z_Y_INC                 0x3E8
+#define Z_START                 0x3EC
+#define ALPHA_X_INC             0x3F0
+#define FOG_X_INC               0x3F0
+#define ALPHA_Y_INC             0x3F4
+#define FOG_Y_INC               0x3F4
+#define ALPHA_START             0x3F8
+#define FOG_START               0x3F8
+/* 0x3FC */
+#define OVERLAY_Y_X_START       0x400
+#define OVERLAY_Y_X_END         0x404
+#define OVERLAY_VIDEO_KEY_CLR   0x408
+#define OVERLAY_VIDEO_KEY_MSK   0x40C
+#define OVERLAY_GRAPHICS_KEY_CLR        0x410
+#define OVERLAY_GRAPHICS_KEY_MSK        0x414
+#define OVERLAY_KEY_CNTL        0x418
+/* 0x41C */
+#define OVERLAY_SCALE_INC       0x420
+#define OVERLAY_SCALE_CNTL      0x424
+#define SCALER_HEIGHT_WIDTH     0x428
+#define SCALER_TEST             0x42C
+/* 0x430 */
+#define SCALER_BUF0_OFFSET      0x434
+#define SCALER_BUF1_OFFSET      0x438
+#define SCALER_BUF_PITCH        0x43C
+#define CAPTURE_START_END       0x440
+#define CAPTURE_X_WIDTH         0x444
+#define VIDEO_FORMAT            0x448
+#define VBI_START_END           0x44C
+#define CAPTURE_CONFIG          0x450
+#define TRIG_CNTL               0x454
+#define OVERLAY_EXCLUSIVE_HORZ  0x458
+#define OVERLAY_EXCLUSIVE_VERT  0x45C
+#define VBI_WIDTH               0x460
+#define CAPTURE_DEBUG           0x464
+#define VIDEO_SYNC_TEST         0x468
+/* 0x46C */
+#define SNAPSHOT_VH_COUNTS      0x470
+#define SNAPSHOT_F_COUNT        0x474
+#define N_VIF_COUNT             0x478
+#define SNAPSHOT_VIF_COUNT      0x47C
+#define BUF0_OFFSET             0x480
+#define CAPTURE_BUF0_OFFSET     0x480
+#define CAPTURE_BUF1_OFFSET     0x484
+#define ONESHOT_BUF_OFFSET      0x488
+#define CAPTURE_BUF_PITCH       0x488
+#define BUF0_PITCH              0x48C
+/* 0x490 - 0x494 */
+#define BUF1_OFFSET             0x498
+/* 0x49C - 0x4A0 */
+#define BUF1_PITCH              0x4A4
+/* 0x4A8 */
+#define BUF0_CAP_OFFSET         0x4AC
+#define BUF1_CAP_OFFSET         0x4B0
+#define SNAPSHOT2_VH_COUNTS     0x4B0
+#define SNAPSHOT2_F_COUNT       0x4B4
+#define N_VIF2_COUNT            0x4B8
+#define SNAPSHOT2_VIF_COUNT     0x4BC
+#define MPP_CONFIG              0x4C0
+#define MPP_STROBE_SEQ          0x4C4
+#define MPP_ADDR                0x4C8
+#define MPP_DATA                0x4CC
+#define TVO_CNTL                0x500
+/* 0x504 - 0x540 */
+#define CRT_HORZ_VERT_LOAD      0x544
+#define AGP_BASE                0x548
+#define AGP_CNTL                0x54C
+#define SCALER_COLOUR_CNTL      0x550
+#define SCALER_H_COEFF0         0x554
+#define SCALER_H_COEFF1         0x558
+#define SCALER_H_COEFF2         0x55C
+#define SCALER_H_COEFF3         0x560
+#define SCALER_H_COEFF4         0x564
+/* 0x568 - 0x56C */
+#define GUI_CMDFIFO_DEBUG       0x570
+#define GUI_CMDFIFO_DATA        0x574
+#define GUI_CNTL                0x578
+/* 0x57C */
+#define BM_FRAME_BUF_OFFSET     0x580
+#define BM_SYSTEM_MEM_ADDR      0x584
+#define BM_COMMAND              0x588
+#define BM_STATUS               0x58C
+/* 0x590 - 0x5B4 */
+#define BM_GUI_TABLE            0x5B8
+#define BM_SYSTEM_TABLE         0x5BC
+/* 0x5D0 */
+#define SCALER_BUF0_OFFSET_U    0x5D4
+#define SCALER_BUF0_OFFSET_V    0x5D8
+#define SCALER_BUF1_OFFSET_U    0x5DC
+#define SCALER_BUF1_OFFSET_V    0x5E0
+/* 0x5E4 - 0x63C */
+#define VERTEX_1_S              0x640
+#define VERTEX_1_T              0x644
+#define VERTEX_1_W              0x648
+#define VERTEX_1_SPEC_ARGB      0x64C
+#define VERTEX_1_Z              0x650
+#define VERTEX_1_ARGB           0x654
+#define VERTEX_1_X_Y            0x658
+/* #define ONE_OVER_AREA           0x65C */
+#define VERTEX_2_S              0x660
+#define VERTEX_2_T              0x664
+#define VERTEX_2_W              0x668
+#define VERTEX_2_SPEC_ARGB      0x66C
+#define VERTEX_2_Z              0x670
+#define VERTEX_2_ARGB           0x674
+#define VERTEX_2_X_Y            0x678
+/* #define ONE_OVER_AREA           0x67C */
+#define VERTEX_3_S              0x680
+#define VERTEX_3_T              0x684
+#define VERTEX_3_W              0x688
+#define VERTEX_3_SPEC_ARGB      0x68C
+#define VERTEX_3_Z              0x690
+#define VERTEX_3_ARGB           0x694
+#define VERTEX_3_X_Y            0x698
+#define ONE_OVER_AREA           0x69C
+#define VERTEX_3_SECONDARY_S    0x6A0
+#define VERTEX_3_SECONDARY_T    0x6A4
+#define VERTEX_3_SECONDARY_W    0x6A8
+/* #define VERTEX_1_S              0x6AC */
+/* #define VERTEX_1_T              0x6B0 */
+/* #define VERTEX_1_W              0x6B4 */
+/* #define VERTEX_2_S              0x6B8 */
+/* #define VERTEX_2_T              0x6BC */
+/* #define VERTEX_2_W              0x6C0 */
+/* #define VERTEX_3_S              0x6C4 */
+/* #define VERTEX_3_T              0x6C8 */
+/* #define VERTEX_3_W              0x6CC */
+/* #define VERTEX_1_SPEC_ARGB      0x6D0 */
+/* #define VERTEX_2_SPEC_ARGB      0x6D4 */
+/* #define VERTEX_3_SPEC_ARGB      0x6D8 */
+/* #define VERTEX_1_Z              0x6DC */
+/* #define VERTEX_2_Z              0x6E0 */
+/* #define VERTEX_3_Z              0x6E4 */
+/* #define VERTEX_1_ARGB           0x6E8 */
+/* #define VERTEX_2_ARGB           0x6EC */
+/* #define VERTEX_3_ARGB           0x6F0 */
+/* #define VERTEX_1_X_Y            0x6F4 */
+/* #define VERTEX_2_X_Y            0x6F8 */
+/* #define VERTEX_3_X_Y            0x6FC */
+#define ONE_OVER_AREA_UC        0x700
+#define SETUP_CNTL              0x704
+/* 0x708 - 0x724 */
+#define VERTEX_1_SECONDARY_S    0x728
+#define VERTEX_1_SECONDARY_T    0x72C
+#define VERTEX_1_SECONDARY_W    0x730
+#define VERTEX_2_SECONDARY_S    0x734
+#define VERTEX_2_SECONDARY_T    0x738
+#define VERTEX_2_SECONDARY_W    0x73C
+/* 0x740 - 0x7FC */
+
+
+/* HW_DEBUG */
+#define INTER_PRIM_DIS                  0x00000040
+#define AUTO_BLKWRT_COLOR_DIS           0x00000100
+#define AUTO_FF_DIS                     0x00001000
+#define AUTO_BLKWRT_DIS                 0x00002000
+
+/* CLOCK_CNTL1 */
+#define PLL_WR_EN                       0x02
+
+/* CONFIG_CHIP_ID */
+#define CFG_CHIP_TYPE                   0x0000FFFF
+#define CFG_CHIP_CLASS                  0x00FF0000
+#define CFG_CHIP_MAJOR                  0x07000000
+#define CFG_CHIP_FND_ID                 0x38000000
+#define CFG_CHIP_MINOR                  0xC0000000
+
+/* CONFIG_STAT0 */
+#define CFG_MEM_TYPE                    0x00000007
+#define CFG_MEM_TYPE_SGRAM              0x00000005
+
+/* DST_BRES_LNTH */
+#define DRAW_TRAP                       0x00008000
+#define LINE_DIS                        0x80000000
+
+/* DST_CNTL */
+#define DST_X_DIR                       0x00000001
+#define DST_Y_DIR                       0x00000002
+#define DST_Y_MAJOR                     0x00000004
+#define DST_X_TILE                      0x00000008
+#define DST_Y_TILE                      0x00000010
+#define DST_LAST_PEL                    0x00000020
+#define DST_POLYGON_EN                  0x00000040
+#define DST_24_ROTATION_EN              0x00000080
+#define TRAIL_X_DIR                     0x00002000
+#define TRAP_FILL_DIR                   0x00004000
+
+/* ALPHA_TST_CNTL */
+#define ALPHA_DST_SEL_ZERO              0x00000000
+#define ALPHA_DST_SEL_ONE               0x00000100
+#define ALPHA_DST_SEL_SRCALPHA          0x00000400
+#define ALPHA_DST_SEL_INVSRCALPHA       0x00000500
+#define ALPHA_DST_SEL_DSTALPHA          0x00000600
+#define ALPHA_DST_SEL_INVDSTALPHA       0x00000700
+
+/* SRC_CNTL */
+#define SRC_PATTERN_EN                  0x00000001
+#define SRC_ROTATION_EN                 0x00000002
+#define SRC_LINEAR_EN                   0x00000004
+#define SRC_BYTE_ALIGN                  0x00000008
+#define SRC_LINE_X_DIR                  0x00000010
+#define FAST_FILL_EN                    0x00000040
+#define COLOR_REG_WRITE_EN              0x00002000
+#define BLOCK_WRITE_EN                  0x00004000
+
+/* DP_PIX_WIDTH (GT) */
+#define DST_PIX_WIDTH_MONO              0x00000000
+#define DST_PIX_WIDTH_CI8               0x00000002
+#define DST_PIX_WIDTH_ARGB1555          0x00000003
+#define DST_PIX_WIDTH_RGB565            0x00000004
+#define DST_PIX_WIDTH_RGB888            0x00000005
+#define DST_PIX_WIDTH_ARGB8888          0x00000006
+#define DST_PIX_WIDTH_RGB332            0x00000007
+#define DST_PIX_WIDTH_Y8                0x00000008
+#define DST_PIX_WIDTH_RGB8              0x00000009
+#define DST_PIX_WIDTH_VYUY              0x0000000B
+#define DST_PIX_WIDTH_YVYU              0x0000000C
+#define DST_PIX_WIDTH_AYUV8888          0x0000000E
+#define DST_PIX_WIDTH_ARGB4444          0x0000000F
+#define SRC_PIX_WIDTH_MONO              0x00000000
+#define SRC_PIX_WIDTH_CI8               0x00000200
+#define SRC_PIX_WIDTH_ARGB1555          0x00000300
+#define SRC_PIX_WIDTH_RGB565            0x00000400
+#define SRC_PIX_WIDTH_ARGB8888          0x00000600
+#define SRC_PIX_WIDTH_RGB332            0x00000700
+#define SRC_PIX_WIDTH_Y8                0x00000800
+#define SRC_PIX_WIDTH_VYUY              0x00000B00
+#define SRC_PIX_WIDTH_YVYU              0x00000C00
+#define SRC_PIX_WIDTH_AYUV8888          0x00000E00
+#define SRC_PIX_WIDTH_ARGB4444          0x00000F00
+#define SCALE_PIX_WIDTH_CI8             0x20000000
+#define SCALE_PIX_WIDTH_ARGB1555        0x30000000
+#define SCALE_PIX_WIDTH_RGB565          0x40000000
+#define SCALE_PIX_WIDTH_ARGB8888        0x60000000
+#define SCALE_PIX_WIDTH_RGB332          0x70000000
+#define SCALE_PIX_WIDTH_Y8              0x80000000
+#define SCALE_PIX_WIDTH_RGB8            0x90000000
+#define SCALE_PIX_WIDTH_VYUY            0xB0000000
+#define SCALE_PIX_WIDTH_YVYU            0xC0000000
+#define SCALE_PIX_WIDTH_AYUV8888        0xE0000000
+#define SCALE_PIX_WIDTH_ARGB4444        0xF0000000
+
+/* DP_PIX_WIDTH (GX/CT/VT) */
+#define DST_PIX_WIDTH_8BPP              0x00000002
+#define DST_PIX_WIDTH_15BPP             0x00000003
+#define DST_PIX_WIDTH_16BPP             0x00000004
+#define DST_PIX_WIDTH_32BPP             0x00000006
+#define SRC_PIX_WIDTH_8BPP              0x00000200
+#define SRC_PIX_WIDTH_15BPP             0x00000300
+#define SRC_PIX_WIDTH_16BPP             0x00000400
+#define SRC_PIX_WIDTH_32BPP             0x00000600
+
+/* DP_PIX_WIDTH masks */
+#define DST_PIX_WIDTH                   0x0000000F
+#define SRC_PIX_WIDTH                   0x00000F00
+#define SCALE_PIX_WIDTH                 0xF0000000
+
+/* DP_MIX */
+#define BKGD_MIX_DST                    0x00000003
+#define BKGD_MIX_SRC                    0x00000007
+#define FRGD_MIX_DST                    0x00030000
+#define FRGD_MIX_SRC                    0x00070000
+
+/* DP_SRC */
+#define BKGD_SRC_BKGD_CLR               0x00000000
+#define BKGD_SRC_FRGD_CLR               0x00000001
+#define BKGD_SRC_HOST                   0x00000002
+#define BKGD_SRC_BLIT                   0x00000003
+#define BKGD_SRC_PATTERN                0x00000004
+#define BKGD_SRC_SCALE                  0x00000005
+#define FRGD_SRC_BKGD_CLR               0x00000000
+#define FRGD_SRC_FRGD_CLR               0x00000100
+#define FRGD_SRC_HOST                   0x00000200
+#define FRGD_SRC_BLIT                   0x00000300
+#define FRGD_SRC_PATTERN                0x00000400
+#define FRGD_SRC_SCALE                  0x00000500
+#define MONO_SRC_ONE                    0x00000000
+#define MONO_SRC_PATTERN                0x00010000
+#define MONO_SRC_HOST                   0x00020000
+#define MONO_SRC_BLIT                   0x00030000
+
+/* CLR_CMP_CNTL */
+#define CLR_CMP_FN_FALSE                0x00000000
+#define CLR_CMP_FN_TRUE                 0x00000001
+#define CLR_CMP_FN_NOT_EQUAL            0x00000004
+#define CLR_CMP_FN_EQUAL                0x00000005
+#define CLR_CMP_SRC_DEST                0x00000000
+#define CLR_CMP_SRC_2D                  0x01000000
+#define CLR_CMP_SRC_SCALE               0x02000000
+
+/* GUI_STAT */
+#define GUI_ACTIVE                      0x00000001
+
+/* SCALE_3D_CNTL */
+#define SCALE_PIX_EXPAND                0x00000001
+#define SCALE_DITHER                    0x00000002
+#define DITHER_EN                       0x00000004
+#define DITHER_INIT                     0x00000008
+#define ROUND_EN                        0x00000010
+#define TEX_CACHE_DIS                   0x00000020
+#define SCALE_3D_FCN_NOP                0x00000000
+#define SCALE_3D_FCN_SCALE              0x00000040
+#define SCALE_3D_FCN_TEXTURE            0x00000080
+#define SCALE_3D_FCN_SHADE              0x000000C0
+#define SCALE_PIX_REP                   0x00000100
+#define NEAREST_TEX_VIS                 0x00000200
+#define TEX_CACHE_SPLIT                 0x00000200
+#define APPLE_YUV_MODE                  0x00000400
+#define ALPHA_FOG_EN_DIS                0x00000000
+#define ALPHA_FOG_EN_ALPHA              0x00000800
+#define ALPHA_FOG_EN_FOG                0x00001000
+#define COLOR_OVERRIDE                  0x00002000
+#define ALPHA_BLND_SAT                  0x00002000
+#define RED_DITHER_MAX                  0x00004000
+#define SIGNED_DST_CLAMP                0x00008000
+#define ALPHA_BLND_SRC_ZERO             0x00000000
+#define ALPHA_BLND_SRC_ONE              0x00010000
+#define ALPHA_BLND_SRC_DSTCOLOR         0x00020000
+#define ALPHA_BLND_SRC_INVDSTCOLOR      0x00030000
+#define ALPHA_BLND_SRC_SRCALPHA         0x00040000
+#define ALPHA_BLND_SRC_INVSRCALPHA      0x00050000
+#define ALPHA_BLND_SRC_DSTALPHA         0x00060000
+#define ALPHA_BLND_SRC_INVDSTALPHA      0x00070000
+#define ALPHA_BLND_DST_ZERO             0x00000000
+#define ALPHA_BLND_DST_ONE              0x00080000
+#define ALPHA_BLND_DST_SRCCOLOR         0x00100000
+#define ALPHA_BLND_DST_INVSRCCOLOR      0x00180000
+#define ALPHA_BLND_DST_SRCALPHA         0x00200000
+#define ALPHA_BLND_DST_INVSRCALPHA      0x00280000
+#define ALPHA_BLND_DST_DSTALPHA         0x00300000
+#define ALPHA_BLND_DST_INVDSTALPHA      0x00380000
+#define TEX_LIGHT_FCN_REPLACE           0x00000000
+#define TEX_LIGHT_FCN_MODULATE          0x00400000
+#define TEX_LIGHT_FCN_ALPHA_DECAL       0x00800000
+#define MIP_MAP_DISABLE                 0x01000000
+#define BILINEAR_TEX_EN                 0x02000000
+#define TEX_BLEND_FCN_NEAREST_MIPMAP_NEAREST    0x00000000
+#define TEX_BLEND_FCN_NEAREST_MIPMAP_LINEAR     0x04000000
+#define TEX_BLEND_FCN_LINEAR_MIPMAP_NEAREST     0x08000000
+#define TEX_BLEND_FCN_LINEAR_MIPMAP_LINEAR      0x0C000000
+#define TEX_AMASK_AEN                   0x10000000
+#define TEX_AMASK_MODE                  0x20000000
+#define TEX_MAP_AEN                     0x40000000
+#define SRC_3D_SEL                      0x80000000
+
+/* TEX_CNTL */
+#define TEX_CACHE_FLUSH                 0x00800000
+
+/* OVERLAY_Y_X_START */
+#define OVERLAY_LOCK_START              0x80000000
+
+/* OVERLAY_Y_X_END */
+#define OVERLAY_LOCK_END                0x80000000
+
+/* OVERLAY_KEY_CNTL */
+#define VIDEO_KEY_FN_FALSE              0x00000000
+#define VIDEO_KEY_FN_TRUE               0x00000001
+#define VIDEO_KEY_FN_NOT_EQUAL          0x00000004
+#define VIDEO_KEY_FN_EQUAL              0x00000005
+#define GRAPHICS_KEY_FN_FALSE           0x00000000
+#define GRAPHICS_KEY_FN_TRUE            0x00000010
+#define GRAPHICS_KEY_FN_NOT_EQUAL       0x00000040
+#define GRAPHICS_KEY_FN_EQUAL           0x00000050
+#define OVERLAY_CMP_MIX_OR              0x00000000
+#define OVERLAY_CMP_MIX_AND             0x00000100
+
+/* OVERLAY_SCALE_CNTL */
+/* #define SCALE_PIX_EXPAND                0x00000001 */
+#define SCALE_Y2R_TEMP                  0x00000002
+#define SCALE_HORZ_MODE                 0x00000004
+#define SCALE_VERT_MODE                 0x00000008
+#define SCALE_SIGNED_UV                 0x00000010
+#define SCALE_GAMMA_SEL                 0x00000060
+#define SCALE_BANDWITH                  0x04000000
+#define SCALE_DIS_LIMIT                 0x08000000
+#define SCALE_CLK_FORCE_ON              0x20000000
+#define OVERLAY_EN                      0x40000000
+#define SCALE_EN                        0x80000000
+
+/* VIDEO_FORMAT */
+#define VIDEO_IN_VYUY422                0x0000000B
+#define VIDEO_IN_YVYU422                0x0000000C
+#define VIDEO_SIGNED_UV                 0x00000010
+#define SCALER_IN_RGB15                 0x00030000
+#define SCALER_IN_RGB16                 0x00040000
+#define SCALER_IN_RGB32                 0x00060000
+#define SCALER_IN_YUV9                  0x00090000
+#define SCALER_IN_YUV12                 0x000A0000
+#define SCALER_IN_VYUY422               0x000B0000
+#define SCALER_IN_YVYU422               0x000C0000
+
+/* CAPTURE_CONFIG */
+#define OVL_BUF_MODE_SINGLE             0x00000000
+#define OVL_BUF_MODE_DOUBLE             0x10000000
+#define OVL_BUF_NEXT_BUF0               0x00000000
+#define OVL_BUF_NEXT_BUF1               0x20000000
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/matrox/Makefile.am b/Source/DirectFB/gfxdrivers/matrox/Makefile.am
new file mode 100755
index 0000000..ca445ba
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/Makefile.am
@@ -0,0 +1,47 @@
+## Makefile.am for DirectFB/src/core/gfxcards/matrox
+
+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
+
+matrox_LTLIBRARIES = libdirectfb_matrox.la
+
+if BUILD_STATIC
+matrox_DATA = $(matrox_LTLIBRARIES:.la=.o)
+endif
+
+matroxdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_matrox_la_SOURCES =	\
+	matrox.c		\
+	matrox.h		\
+	matrox_3d.c		\
+	matrox_3d.h		\
+	matrox_bes.c		\
+	matrox_crtc2.c		\
+	matrox_maven.c		\
+	matrox_maven.h		\
+	matrox_screen_crtc2.c	\
+	matrox_spic.c		\
+	matrox_state.c		\
+	matrox_state.h		\
+	regs.h			\
+	mmio.h
+
+libdirectfb_matrox_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_matrox_la_LIBADD = -lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/Makefile.in b/Source/DirectFB/gfxdrivers/matrox/Makefile.in
new file mode 100755
index 0000000..f9a3608
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/Makefile.in
@@ -0,0 +1,618 @@
+# 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/matrox
+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)$(matroxdir)" "$(DESTDIR)$(matroxdir)"
+matroxLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(matrox_LTLIBRARIES)
+libdirectfb_matrox_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_matrox_la_OBJECTS = matrox.lo matrox_3d.lo \
+	matrox_bes.lo matrox_crtc2.lo matrox_maven.lo \
+	matrox_screen_crtc2.lo matrox_spic.lo matrox_state.lo
+libdirectfb_matrox_la_OBJECTS = $(am_libdirectfb_matrox_la_OBJECTS)
+libdirectfb_matrox_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_matrox_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_matrox_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_matrox_la_SOURCES)
+matroxDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(matrox_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
+
+matrox_LTLIBRARIES = libdirectfb_matrox.la
+@BUILD_STATIC_TRUE@matrox_DATA = $(matrox_LTLIBRARIES:.la=.o)
+matroxdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_matrox_la_SOURCES = \
+	matrox.c		\
+	matrox.h		\
+	matrox_3d.c		\
+	matrox_3d.h		\
+	matrox_bes.c		\
+	matrox_crtc2.c		\
+	matrox_maven.c		\
+	matrox_maven.h		\
+	matrox_screen_crtc2.c	\
+	matrox_spic.c		\
+	matrox_state.c		\
+	matrox_state.h		\
+	regs.h			\
+	mmio.h
+
+libdirectfb_matrox_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_matrox_la_LIBADD = -lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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/matrox/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/matrox/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-matroxLTLIBRARIES: $(matrox_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(matroxdir)" || $(MKDIR_P) "$(DESTDIR)$(matroxdir)"
+	@list='$(matrox_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(matroxLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(matroxdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(matroxLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(matroxdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-matroxLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(matrox_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(matroxdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(matroxdir)/$$p"; \
+	done
+
+clean-matroxLTLIBRARIES:
+	-test -z "$(matrox_LTLIBRARIES)" || rm -f $(matrox_LTLIBRARIES)
+	@list='$(matrox_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_matrox.la: $(libdirectfb_matrox_la_OBJECTS) $(libdirectfb_matrox_la_DEPENDENCIES) 
+	$(libdirectfb_matrox_la_LINK) -rpath $(matroxdir) $(libdirectfb_matrox_la_OBJECTS) $(libdirectfb_matrox_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_bes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_crtc2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_maven.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_screen_crtc2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_spic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrox_state.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-matroxDATA: $(matrox_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(matroxdir)" || $(MKDIR_P) "$(DESTDIR)$(matroxdir)"
+	@list='$(matrox_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(matroxDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(matroxdir)/$$f'"; \
+	  $(matroxDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(matroxdir)/$$f"; \
+	done
+
+uninstall-matroxDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(matrox_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(matroxdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(matroxdir)/$$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)$(matroxdir)" "$(DESTDIR)$(matroxdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-matroxLTLIBRARIES \
+	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-matroxDATA install-matroxLTLIBRARIES
+
+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-matroxDATA uninstall-matroxLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-matroxLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-matroxDATA install-matroxLTLIBRARIES 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-matroxDATA \
+	uninstall-matroxLTLIBRARIES
+
+%.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/matrox/matrox.c b/Source/DirectFB/gfxdrivers/matrox/matrox.c
new file mode 100755
index 0000000..d797251
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox.c
@@ -0,0 +1,2930 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/palette.h>
+
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+
+#include <core/graphics_driver.h>
+
+
+DFB_GRAPHICS_DRIVER( matrox )
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+#include "matrox_3d.h"
+#include "matrox_state.h"
+
+
+static bool matroxFillRectangle    ( void *drv, void *dev, DFBRectangle *rect );
+static bool matroxFillRectangle_2P ( void *drv, void *dev, DFBRectangle *rect );
+static bool matroxFillRectangle_3P ( void *drv, void *dev, DFBRectangle *rect );
+static bool matroxFillRectangle_422( void *drv, void *dev, DFBRectangle *rect );
+
+static bool matroxBlit2D    ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_2P ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_3P ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_422( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_Old( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+
+static bool matroxBlit3D    ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit3D_2P ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit3D_3P ( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit3D_422( void *drv, void *dev,
+                              DFBRectangle *rect, int dx, int dy );
+
+static bool matroxStretchBlit    ( void *drv, void *dev,
+                                   DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_2P ( void *drv, void *dev,
+                                   DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_3P ( void *drv, void *dev,
+                                   DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_422( void *drv, void *dev,
+                                   DFBRectangle *srect, DFBRectangle *drect );
+
+
+static bool matroxBlit2D_F    ( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_2P_F ( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_3P_F ( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_422_F( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy );
+static bool matroxBlit2D_Old_F( void *drv, void *dev,
+                                DFBRectangle *rect, int dx, int dy );
+
+static bool matroxBlit3D_F         ( void *drv, void *dev,
+                                     DFBRectangle *rect, int dx, int dy );
+
+static bool matroxStretchBlit_F    ( void *drv, void *dev,
+                                     DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_2P_F ( void *drv, void *dev,
+                                     DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_3P_F ( void *drv, void *dev,
+                                     DFBRectangle *srect, DFBRectangle *drect );
+static bool matroxStretchBlit_422_F( void *drv, void *dev,
+                                     DFBRectangle *srect, DFBRectangle *drect );
+
+
+
+
+/* Millennium */
+
+#define MATROX_2064W_DRAWING_FLAGS          (DSDRAW_SRC_PREMULTIPLY)
+
+#define MATROX_2064W_BLITTING_FLAGS         (DSBLIT_NOFX)
+
+#define MATROX_2064W_DRAWING_FUNCTIONS      (DFXL_FILLRECTANGLE | \
+                                             DFXL_DRAWRECTANGLE | \
+                                             DFXL_DRAWLINE      | \
+                                             DFXL_FILLTRIANGLE)
+
+#define MATROX_2064W_BLITTING_FUNCTIONS     (DFXL_BLIT)
+
+
+/* Old cards (Mystique, Millennium II) */
+
+#define MATROX_OLD_DRAWING_FLAGS            (DSDRAW_SRC_PREMULTIPLY)
+
+#define MATROX_OLD_BLITTING_FLAGS           (DSBLIT_SRC_COLORKEY)
+
+#define MATROX_OLD_DRAWING_FUNCTIONS        (DFXL_FILLRECTANGLE | \
+                                             DFXL_DRAWRECTANGLE | \
+                                             DFXL_DRAWLINE      | \
+                                             DFXL_FILLTRIANGLE)
+
+#define MATROX_OLD_BLITTING_FUNCTIONS       (DFXL_BLIT)
+
+
+/* G100 */
+
+#define MATROX_G100_DRAWING_FLAGS           (DSDRAW_SRC_PREMULTIPLY)
+
+#define MATROX_G100_BLITTING_FLAGS          (DSBLIT_SRC_COLORKEY | \
+                                           /*DSBLIT_BLEND_ALPHACHANNEL |*/ \
+                                           /*DSBLIT_BLEND_COLORALPHA |*/ \
+                                             DSBLIT_COLORIZE | \
+                                             DSBLIT_SRC_PREMULTCOLOR)
+
+#define MATROX_G100_DRAWING_FUNCTIONS       (DFXL_FILLRECTANGLE | \
+                                             DFXL_DRAWRECTANGLE | \
+                                             DFXL_DRAWLINE      | \
+                                             DFXL_FILLTRIANGLE)
+
+#define MATROX_G100_BLITTING_FUNCTIONS      (DFXL_BLIT          | \
+                                             DFXL_STRETCHBLIT)
+
+
+/* G200/G400 */
+
+#define MATROX_G200G400_DRAWING_FLAGS       (DSDRAW_BLEND | \
+                                             DSDRAW_SRC_PREMULTIPLY)
+
+#define MATROX_G200G400_BLITTING_FLAGS      (DSBLIT_SRC_COLORKEY | \
+                                             DSBLIT_BLEND_ALPHACHANNEL | \
+                                             DSBLIT_BLEND_COLORALPHA | \
+                                             DSBLIT_COLORIZE | \
+                                             DSBLIT_DEINTERLACE | \
+                                             DSBLIT_SRC_PREMULTIPLY | \
+                                             DSBLIT_SRC_PREMULTCOLOR)
+
+#define MATROX_G200G400_DRAWING_FUNCTIONS   (DFXL_FILLRECTANGLE | \
+                                             DFXL_DRAWRECTANGLE | \
+                                             DFXL_DRAWLINE      | \
+                                             DFXL_FILLTRIANGLE)
+
+#define MATROX_G200G400_BLITTING_FUNCTIONS  (DFXL_BLIT          | \
+                                             DFXL_STRETCHBLIT   | \
+                                             DFXL_TEXTRIANGLES)
+
+
+#define MATROX_USE_TMU(state, accel)                                     \
+     ((state)->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |              \
+                                DSBLIT_BLEND_COLORALPHA   |              \
+                                DSBLIT_COLORIZE           |              \
+                                DSBLIT_DEINTERLACE        |              \
+                                DSBLIT_SRC_PREMULTIPLY    |              \
+                                DSBLIT_SRC_PREMULTCOLOR)       ||        \
+      ((state)->destination->config.format != (state)->source->config.format && \
+       (state)->destination->config.format != DSPF_I420                      && \
+       (state)->destination->config.format != DSPF_YV12)       ||               \
+      (accel) & (DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES))
+
+#define MATROX_USE_3D(state, accel)                                                     \
+     ((DFB_DRAWING_FUNCTION( accel ) && ((state)->drawingflags & DSDRAW_BLEND)) ||      \
+      (DFB_BLITTING_FUNCTION( accel ) && MATROX_USE_TMU( state, accel )))
+
+static void
+matroxEngineReset( void *drv, void *dev )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mga_waitidle( mdrv, mdev );
+
+     mga_waitfifo( mdrv, mdev, 11 );
+     mga_out32( mmio, 0, TDUALSTAGE0 );   /* multi texture registers */
+     mga_out32( mmio, 0, TDUALSTAGE1 );
+     mga_out32( mmio, 0, ALPHAXINC );     /* alpha increments        */
+     mga_out32( mmio, 0, ALPHAYINC );
+     mga_out32( mmio, 0, DR6 );           /* red increments          */
+     mga_out32( mmio, 0, DR7 );
+     mga_out32( mmio, 0, DR10 );          /* green increments        */
+     mga_out32( mmio, 0, DR11 );
+     mga_out32( mmio, 0, DR14 );          /* blue increments         */
+     mga_out32( mmio, 0, DR15 );
+     mga_out32( mmio, 0, BCOL );
+
+     mga_waitfifo( mdrv, mdev, 5 );
+     mga_out32( mmio, 0, TMR1 );
+     mga_out32( mmio, 0, TMR2 );
+     mga_out32( mmio, 0, TMR4 );
+     mga_out32( mmio, 0, TMR5 );
+     mga_out32( mmio, 0x100000, TMR8 );
+
+     /*
+      * Plane write mask is not supported on G100 with SDRAM.
+      * The chip goes crazy if PLNWT is written.
+      */
+     if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG100) {
+          mga_waitfifo( mdrv, mdev, 1 );
+          mga_out32( mmio, 0xFFFFFFFF, PLNWT );
+     }
+}
+
+static DFBResult
+matroxEngineSync( void *drv, void *dev )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     mga_waitidle( mdrv, mdev );
+
+     return DFB_OK;
+}
+
+static void
+matroxFlushTextureCache( void *drv, void *dev )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mdrv->mmio_base, 0, TEXORG1 );
+}
+
+static void
+matroxFlushReadCache( void *drv, void *dev )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+
+     mga_out8( mdrv->mmio_base, 0, CACHEFLUSH );
+}
+
+static bool
+matrox_check_blend( MatroxDeviceData *mdev,
+                    CardState        *state )
+{
+     switch (state->src_blend) {
+          case DSBF_SRCCOLOR:
+          case DSBF_INVSRCCOLOR:
+               return false;
+          case DSBF_SRCALPHASAT:
+               if (!mdev->g550_matrox && state->dst_blend == DSBF_ZERO)
+                    return false;
+          default:
+               break;
+     }
+
+     switch (state->dst_blend) {
+          case DSBF_DESTCOLOR:
+          case DSBF_INVDESTCOLOR:
+          case DSBF_SRCALPHASAT:
+               return false;
+          default:
+               break;
+     }
+
+     return true;
+}
+
+static void
+matrox2064WCheckState( void *drv, void *dev,
+                       CardState *state, DFBAccelerationMask accel )
+{
+     /* FIXME: 24bit support */
+     switch (state->destination->config.format) {
+          case DSPF_LUT8:
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_A8:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MATROX_2064W_DRAWING_FLAGS)
+               return;
+
+          state->accel |= MATROX_2064W_DRAWING_FUNCTIONS;
+     }
+     else {
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          if (state->blittingflags & ~MATROX_2064W_BLITTING_FLAGS)
+               return;
+
+          state->accel |= MATROX_2064W_BLITTING_FUNCTIONS;
+     }
+}
+
+static void
+matroxOldCheckState( void *drv, void *dev,
+                     CardState *state, DFBAccelerationMask accel )
+{
+     /* FIXME: 24bit support */
+     switch (state->destination->config.format) {
+          case DSPF_LUT8:
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_A8:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MATROX_OLD_DRAWING_FLAGS)
+               return;
+
+          state->accel |= MATROX_OLD_DRAWING_FUNCTIONS;
+     }
+     else {
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          if (state->blittingflags & ~MATROX_OLD_BLITTING_FLAGS)
+               return;
+
+          state->accel |= MATROX_OLD_BLITTING_FUNCTIONS;
+     }
+}
+
+static void
+matroxG100CheckState( void *drv, void *dev,
+                      CardState *state, DFBAccelerationMask accel )
+{
+     /* FIXME: 24bit support */
+     switch (state->destination->config.format) {
+          case DSPF_LUT8:
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    return;
+          case DSPF_A8:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               if (DFB_BLITTING_FUNCTION( accel ) && MATROX_USE_TMU( state, accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MATROX_G100_DRAWING_FLAGS)
+               return;
+
+          state->accel |= MATROX_G100_DRAWING_FUNCTIONS;
+     }
+     else {
+          if (state->blittingflags & ~MATROX_G100_BLITTING_FLAGS)
+               return;
+
+          /* using the texture mapping unit? */
+          if (MATROX_USE_TMU( state, accel )) {
+               int max_width = 2048;
+
+               /* TMU has no 32bit support */
+               switch (state->source->config.format) {
+                    case DSPF_LUT8:
+                    case DSPF_RGB332:
+                    case DSPF_RGB444:
+                    case DSPF_ARGB4444:
+                    case DSPF_RGB555:
+                    case DSPF_ARGB1555:
+                    case DSPF_RGB16:
+                         break;
+                    default:
+                         return;
+               }
+
+               /* Interleaved source -> pitch must be doubled */
+               if ((state->source->config.caps & (DSCAPS_INTERLACED |
+                                                  DSCAPS_SEPARATED)) == DSCAPS_INTERLACED &&
+                   (state->destination->config.caps & DSCAPS_INTERLACED ||
+                    state->blittingflags & DSBLIT_DEINTERLACE))
+                    max_width = 1024;
+
+               /* TMU limits */
+               if (state->source->config.size.w < 8 ||
+                   state->source->config.size.h < 8 ||
+                   state->source->config.size.w > max_width ||
+                   state->source->config.size.h > 2048)
+                    return;
+
+               state->accel |= MATROX_G100_BLITTING_FUNCTIONS;
+          }
+          else {
+               /* source and destination formats equal, no stretching is done */
+               state->accel |= accel;
+          }
+     }
+}
+
+static void
+matroxG200CheckState( void *drv, void *dev,
+                      CardState *state, DFBAccelerationMask accel )
+{
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     /* FIXME: 24bit support */
+     switch (state->destination->config.format) {
+          case DSPF_NV12:
+          case DSPF_NV21:
+               if ((accel & DFXL_FILLRECTANGLE && !state->drawingflags) ||
+                   (accel & DFXL_BLIT && !state->blittingflags &&
+                    state->source->config.format == state->destination->config.format))
+                    break;
+               return;
+          case DSPF_YUY2:
+               if ((accel & DFXL_FILLRECTANGLE && !state->drawingflags) ||
+                   (accel & (DFXL_BLIT | DFXL_STRETCHBLIT) &&
+                    !(state->blittingflags & ~DSBLIT_DEINTERLACE) &&
+                    state->source->config.format == state->destination->config.format))
+                    break;
+               return;
+          case DSPF_LUT8:
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    return;
+          case DSPF_A8:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               if (MATROX_USE_3D( state, accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MATROX_G200G400_DRAWING_FLAGS)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              !matrox_check_blend( mdev, state ))
+               return;
+
+          state->accel |= MATROX_G200G400_DRAWING_FUNCTIONS;
+     }
+     else {
+          bool use_tmu = MATROX_USE_TMU( state, accel );
+
+          switch (state->source->config.format) {
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    if (state->destination->config.format != state->source->config.format)
+                         return;
+                    break;
+               case DSPF_A8:
+                    if (use_tmu)
+                         return;
+               case DSPF_LUT8:
+               case DSPF_RGB332:
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_YUY2:
+                    break;
+               default:
+                    return;
+          }
+
+          if (state->blittingflags & ~MATROX_G200G400_BLITTING_FLAGS)
+               return;
+
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               if (!matrox_check_blend( mdev, state ))
+                    return;
+
+               if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY &&
+                   (state->src_blend != DSBF_ONE ||
+                    (state->dst_blend != DSBF_INVSRCALPHA &&
+                     state->dst_blend != DSBF_INVSRCCOLOR)))
+                    return;
+          } else {
+               if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                    return;
+          }
+
+          if (use_tmu) {
+               int max_width = 2048;
+
+               /* Interleaved source -> pitch must be doubled */
+               if ((state->source->config.caps & (DSCAPS_INTERLACED |
+                                                  DSCAPS_SEPARATED)) == DSCAPS_INTERLACED &&
+                   (state->destination->config.caps & DSCAPS_INTERLACED ||
+                    state->blittingflags & DSBLIT_DEINTERLACE) &&
+                   state->destination->config.format != DSPF_YUY2)
+                    max_width = 1024;
+
+               if (state->source->config.size.w < 8 ||
+                   state->source->config.size.h < 8 ||
+                   state->source->config.size.w > max_width ||
+                   state->source->config.size.h > 2048)
+                    return;
+
+               state->accel |= MATROX_G200G400_BLITTING_FUNCTIONS;
+          }
+          else {
+               /* source and destination formats equal, no stretching is done */
+               state->accel |= accel;
+          }
+     }
+}
+
+static void
+matroxG400CheckState( void *drv, void *dev,
+                      CardState *state, DFBAccelerationMask accel )
+{
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     /* FIXME: 24bit support */
+     switch (state->destination->config.format) {
+          case DSPF_I420:
+          case DSPF_YV12:
+               if ((accel & DFXL_FILLRECTANGLE && !state->drawingflags) ||
+                   (accel & (DFXL_BLIT | DFXL_STRETCHBLIT) &&
+                    !(state->blittingflags & ~DSBLIT_DEINTERLACE) &&
+                    (state->source->config.format == DSPF_I420 ||
+                     state->source->config.format == DSPF_YV12)))
+                    break;
+               return;
+          case DSPF_NV12:
+          case DSPF_NV21:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if ((accel & DFXL_FILLRECTANGLE && !state->drawingflags) ||
+                   (accel & (DFXL_BLIT | DFXL_STRETCHBLIT) &&
+                    !(state->blittingflags & ~DSBLIT_DEINTERLACE) &&
+                    state->source->config.format == state->destination->config.format))
+                    break;
+               return;
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    return;
+          case DSPF_A8:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               if (MATROX_USE_3D( state, accel ))
+                    return;
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~MATROX_G200G400_DRAWING_FLAGS)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              !matrox_check_blend( mdev, state ))
+               return;
+
+          state->accel |= MATROX_G200G400_DRAWING_FUNCTIONS;
+     }
+     else {
+          bool use_tmu = MATROX_USE_TMU( state, accel );
+
+          switch (state->source->config.format) {
+               case DSPF_I420:
+               case DSPF_YV12:
+                    if (state->destination->config.format != DSPF_I420 &&
+                        state->destination->config.format != DSPF_YV12)
+                         return;
+                    break;
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    if (state->destination->config.format != state->source->config.format)
+                         return;
+                    break;
+               case DSPF_RGB332:
+                    if (use_tmu)
+                         return;
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_A8:
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    break;
+               default:
+                    return;
+          }
+
+          if (state->blittingflags & ~MATROX_G200G400_BLITTING_FLAGS)
+               return;
+
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               if (!matrox_check_blend( mdev, state ))
+                    return;
+
+               if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY &&
+                   (state->src_blend != DSBF_ONE ||
+                    (state->dst_blend != DSBF_INVSRCALPHA &&
+                     state->dst_blend != DSBF_INVSRCCOLOR)))
+                    return;
+          } else {
+               if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                    return;
+          }
+
+          if (use_tmu) {
+               int max_width = 2048;
+
+               /* Interleaved source -> pitch must be doubled */
+               if ((state->source->config.caps & (DSCAPS_INTERLACED |
+                                                  DSCAPS_SEPARATED)) == DSCAPS_INTERLACED &&
+                   (state->destination->config.caps & DSCAPS_INTERLACED ||
+                    state->blittingflags & DSBLIT_DEINTERLACE) &&
+                   state->destination->config.format != DSPF_YUY2 &&
+                   state->destination->config.format != DSPF_UYVY)
+                    max_width = 1024;
+
+               if (state->source->config.size.w < 8 ||
+                   state->source->config.size.h < 8 ||
+                   state->source->config.size.w > max_width ||
+                   state->source->config.size.h > 2048)
+                    return;
+
+               state->accel |= MATROX_G200G400_BLITTING_FUNCTIONS;
+          }
+          else {
+               /* source and destination formats equal, no stretching is done */
+               state->accel |= accel;
+          }
+     }
+}
+
+static void
+matroxSetState( void *drv, void *dev,
+                GraphicsDeviceFuncs *funcs,
+                CardState *state, DFBAccelerationMask accel )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     bool              prev_blit_fields = mdev->blit_fields;
+
+     if (state->mod_hw == SMF_ALL) {
+          mdev->valid = 0;
+
+          /*
+           * Work around TMU bug(?), under some unclear circumstances
+           * the TMU's read address (src & dst) gets corrupted (negative offset
+           * applied to written values) until soft reset occured.
+           */
+          if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG200)
+               mga_waitidle( mdrv, mdev );
+     }
+     else if (state->mod_hw) {
+          if (state->mod_hw & SMF_COLOR)
+               MGA_INVALIDATE( m_drawColor | m_blitColor | m_color );
+
+          if (state->mod_hw & SMF_CLIP)
+               MGA_INVALIDATE( m_clip );
+
+          if (state->mod_hw & SMF_DESTINATION)
+               MGA_INVALIDATE( m_destination | m_clip | m_color | m_Source | m_source );
+
+          if (state->mod_hw & SMF_SOURCE)
+               MGA_INVALIDATE( m_Source | m_source | m_SrcKey | m_srckey | m_blitBlend );
+          else if (state->mod_hw & SMF_SRC_COLORKEY)
+               MGA_INVALIDATE( m_SrcKey | m_srckey );
+
+          if (state->mod_hw & SMF_DRAWING_FLAGS)
+               MGA_INVALIDATE( m_drawColor | m_color );
+
+          if (state->mod_hw & SMF_BLITTING_FLAGS)
+               MGA_INVALIDATE( m_Source | m_SrcKey | m_blitBlend | m_blitColor );
+
+          if (state->mod_hw & (SMF_DST_BLEND | SMF_SRC_BLEND))
+               MGA_INVALIDATE( m_blitBlend | m_drawBlend );
+     }
+
+     switch (accel) {
+          case DFXL_BLIT:
+               mdev->blit_deinterlace = state->blittingflags & DSBLIT_DEINTERLACE;
+               mdev->blit_fields      = !mdev->blit_deinterlace &&
+                                        state->source->config.caps & DSCAPS_INTERLACED &&
+                                        state->destination->config.caps & DSCAPS_INTERLACED &&
+                                        (state->source->config.caps & DSCAPS_SEPARATED ||
+                                         state->destination->config.caps & DSCAPS_SEPARATED);
+               break;
+          case DFXL_STRETCHBLIT:
+               mdev->blit_deinterlace = state->blittingflags & DSBLIT_DEINTERLACE;
+               mdev->blit_fields      = !mdev->blit_deinterlace &&
+                                        state->source->config.caps & DSCAPS_INTERLACED &&
+                                        state->destination->config.caps & DSCAPS_INTERLACED;
+               break;
+          default:
+               mdev->blit_deinterlace = 0;
+               mdev->blit_fields      = 0;
+     }
+
+     if (prev_blit_fields != mdev->blit_fields)
+          MGA_INVALIDATE( m_destination | m_source | m_Source );
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+          case DFXL_FILLTRIANGLE:
+               if (state->drawingflags & DSDRAW_BLEND) {
+                    mdev->draw_blend = 1;
+                    matrox_validate_drawColor( mdrv, mdev, state );
+                    matrox_validate_drawBlend( mdrv, mdev, state );
+               }
+               else {
+                    mdev->draw_blend = 0;
+                    matrox_validate_color( mdrv, mdev, state );
+               }
+
+               switch (state->destination->config.format) {
+                    case DSPF_YUY2:
+                    case DSPF_UYVY:
+                         funcs->FillRectangle = matroxFillRectangle_422;
+                         state->set = DFXL_FILLRECTANGLE;
+                         break;
+                    case DSPF_I420:
+                    case DSPF_YV12:
+                         funcs->FillRectangle = matroxFillRectangle_3P;
+                         state->set = DFXL_FILLRECTANGLE;
+                         break;
+                    case DSPF_NV12:
+                    case DSPF_NV21:
+                         funcs->FillRectangle = matroxFillRectangle_2P;
+                         state->set = DFXL_FILLRECTANGLE;
+                         break;
+                    default:
+                         funcs->FillRectangle = matroxFillRectangle;
+                         state->set = DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE |
+                                      DFXL_DRAWLINE | DFXL_FILLTRIANGLE;
+               }
+               break;
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:
+               mdev->blit_src_colorkey = state->blittingflags & DSBLIT_SRC_COLORKEY;
+
+               if (MATROX_USE_TMU( state, accel )) {
+                    if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                                DSBLIT_COLORIZE |
+                                                DSBLIT_SRC_PREMULTCOLOR))
+                         matrox_validate_blitColor( mdrv, mdev, state );
+
+                    switch (state->destination->config.format) {
+                         case DSPF_YUY2:
+                         case DSPF_UYVY:
+                              if (mdev->blit_fields) {
+                                   funcs->Blit        = NULL;
+                                   funcs->StretchBlit = matroxStretchBlit_422_F;
+                              } else {
+                                   funcs->Blit        = matroxBlit3D_422;
+                                   funcs->StretchBlit = matroxStretchBlit_422;
+                              }
+                              state->set = DFXL_BLIT | DFXL_STRETCHBLIT;
+                              break;
+                         case DSPF_I420:
+                         case DSPF_YV12:
+                              if (mdev->blit_fields) {
+                                   funcs->Blit        = NULL;
+                                   funcs->StretchBlit = matroxStretchBlit_3P_F;
+                              } else {
+                                   funcs->Blit        = matroxBlit3D_3P;
+                                   funcs->StretchBlit = matroxStretchBlit_3P;
+                              }
+                              state->set = DFXL_BLIT | DFXL_STRETCHBLIT;
+                              break;
+                         case DSPF_NV12:
+                         case DSPF_NV21:
+                              if (mdev->blit_fields) {
+                                   funcs->Blit        = NULL;
+                                   funcs->StretchBlit = matroxStretchBlit_2P_F;
+                              } else {
+                                   funcs->Blit        = matroxBlit3D_2P;
+                                   funcs->StretchBlit = matroxStretchBlit_2P;
+                              }
+                              state->set = DFXL_BLIT | DFXL_STRETCHBLIT;
+                              break;
+                         default:
+                              if (mdev->blit_fields) {
+                                   funcs->Blit        = matroxBlit3D_F;
+                                   funcs->StretchBlit = matroxStretchBlit_F;
+                              } else {
+                                   funcs->Blit        = matroxBlit3D;
+                                   funcs->StretchBlit = matroxStretchBlit;
+                              }
+                              state->set = DFXL_BLIT | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES;
+                    }
+
+                    matrox_validate_blitBlend( mdrv, mdev, state );
+                    matrox_validate_Source( mdrv, mdev, state );
+
+                    matrox_validate_SrcKey( mdrv, mdev, state );
+               }
+               else {
+                    switch (state->destination->config.format) {
+                         case DSPF_YUY2:
+                         case DSPF_UYVY:
+                              funcs->Blit = mdev->blit_fields ?
+                                            matroxBlit2D_422_F : matroxBlit2D_422;
+                              break;
+                         case DSPF_I420:
+                         case DSPF_YV12:
+                              funcs->Blit = mdev->blit_fields ?
+                                            matroxBlit2D_3P_F : matroxBlit2D_3P;
+                              break;
+                         case DSPF_NV12:
+                         case DSPF_NV21:
+                              funcs->Blit = mdev->blit_fields ?
+                                            matroxBlit2D_2P_F : matroxBlit2D_2P;
+                              break;
+                         default:
+                              if (mdev->old_matrox)
+                                   funcs->Blit = mdev->blit_fields ?
+                                                 matroxBlit2D_Old_F : matroxBlit2D_Old;
+                              else
+                                   funcs->Blit = mdev->blit_fields ?
+                                                 matroxBlit2D_F : matroxBlit2D;
+                    }
+
+                    matrox_validate_source( mdrv, mdev, state );
+
+                    if (mdev->blit_src_colorkey)
+                         matrox_validate_srckey( mdrv, mdev, state );
+
+                    state->set = DFXL_BLIT;
+               }
+               break;
+          default:
+               D_BUG( "unexpected drawing/blitting function!" );
+               break;
+     }
+
+     matrox_validate_destination( mdrv, mdev, state );
+
+     if (!MGA_IS_VALID( m_clip )) {
+          mdev->clip = state->clip;
+          if (state->destination->config.format == DSPF_YUY2 ||
+              state->destination->config.format == DSPF_UYVY) {
+               mdev->clip.x1 /= 2;
+               mdev->clip.x2 /= 2;
+          }
+          if (mdev->blit_fields) {
+               mdev->clip.y1 /= 2;
+               mdev->clip.y2 /= 2;
+          }
+          matrox_set_clip( mdrv, mdev, &mdev->clip );
+          MGA_VALIDATE( m_clip );
+     }
+
+     state->mod_hw = 0;
+}
+
+/******************************************************************************/
+
+static void
+matrox_fill_rectangle( MatroxDriverData *mdrv,
+                       MatroxDeviceData *mdev,
+                       DFBRectangle *rect )
+{
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mga_waitfifo( mdrv, mdev, 3 );
+
+     if (mdev->draw_blend)
+          mga_out32( mmio, BOP_COPY | SHFTZERO | SGNZERO |
+                           ARZERO | ATYPE_I | OP_TRAP, DWGCTL );
+     else
+          mga_out32( mmio, TRANSC | BOP_COPY | SHFTZERO | SGNZERO | ARZERO |
+                           SOLID | mdev->atype_blk_rstr | OP_TRAP, DWGCTL );
+
+     mga_out32( mmio, (RS16(rect->x + rect->w) << 16) | RS16(rect->x), FXBNDRY );
+     mga_out32( mmio, (RS16(rect->y) << 16) | RS16(rect->h), YDSTLEN | EXECUTE );
+}
+
+static bool
+matroxFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     return true;
+}
+
+static bool
+matroxFillRectangle_2P( void *drv, void *dev, DFBRectangle *rect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     rect->x /= 2;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) / 2;
+     rect->h = (rect->h + 1) / 2;
+
+     /* CbCr plane */
+     mga_waitfifo( mdrv, mdev, 7 );
+     mga_out32( mmio, PW16 | NODITHER, MACCESS );
+     mga_out32( mmio, mdev->color[1], FCOL );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 4) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 4) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 4 );
+     mga_out32( mmio, PW8 | BYPASS332 | NODITHER, MACCESS );
+     mga_out32( mmio, mdev->color[0], FCOL );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+static bool
+matroxFillRectangle_3P( void *drv, void *dev, DFBRectangle *rect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     rect->x /= 2;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) / 2;
+     rect->h = (rect->h + 1) / 2;
+
+     /* Cb plane */
+     mga_waitfifo( mdrv, mdev, 6 );
+     mga_out32( mmio, mdev->color[1], FCOL );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 4) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 4) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     /* Cr plane */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->color[2], FCOL );
+     mga_out32( mmio, mdev->dst_offset[0][2], DSTORG );
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 3 );
+     mga_out32( mmio, mdev->color[0], FCOL );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+static bool
+matroxFillRectangle_422( void *drv, void *dev, DFBRectangle *rect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     rect->x /= 2;
+     rect->w = (rect->w + 1) / 2;
+
+     matrox_fill_rectangle( mdrv, mdev, rect );
+
+     return true;
+}
+
+static bool
+matroxDrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mga_waitfifo( mdrv, mdev, 6 );
+
+     if (mdev->draw_blend)
+          mga_out32( mmio, BLTMOD_BFCOL | BOP_COPY | ATYPE_I |
+                           OP_AUTOLINE_OPEN, DWGCTL );
+     else
+          mga_out32( mmio, BLTMOD_BFCOL | BOP_COPY | SHFTZERO | SOLID |
+                           ATYPE_RSTR | OP_AUTOLINE_OPEN, DWGCTL );
+
+     mga_out32(mmio, RS16(rect->x) |
+                    (RS16(rect->y) << 16),
+                     XYSTRT);
+
+     mga_out32(mmio, RS16(rect->x + rect->w-1) | (RS16(rect->y) << 16),
+                     XYEND | EXECUTE);
+
+     mga_out32(mmio, RS16(rect->x + rect->w-1) |
+                    (RS16(rect->y + rect->h-1) << 16),
+                     XYEND | EXECUTE);
+
+     mga_out32(mmio, RS16(rect->x) |
+                    (RS16(rect->y + rect->h-1) << 16),
+                     XYEND | EXECUTE);
+
+     mga_out32(mmio, RS16(rect->x) |
+                    (RS16(rect->y) << 16),
+                     XYEND | EXECUTE);
+
+     return true;
+}
+
+static bool
+matroxDrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mga_waitfifo( mdrv, mdev, 3 );
+
+     if (mdev->draw_blend)
+          mga_out32( mmio, BLTMOD_BFCOL | BOP_COPY | ATYPE_I |
+                           OP_AUTOLINE_CLOSE,
+                     DWGCTL );
+     else
+          mga_out32( mmio, BLTMOD_BFCOL | BOP_COPY | SHFTZERO | SOLID |
+                           ATYPE_RSTR | OP_AUTOLINE_CLOSE,
+                     DWGCTL );
+
+     mga_out32( mmio, RS16(line->x1) | (RS16(line->y1) << 16),
+                      XYSTRT );
+
+     mga_out32( mmio, RS16(line->x2) | (RS16(line->y2) << 16),
+                      XYEND | EXECUTE );
+
+     return true;
+}
+
+/******************************************************************************/
+
+static void
+matrox_fill_trapezoid( MatroxDriverData *mdrv,
+                       MatroxDeviceData *mdev,
+                       int Xl, int Xr, int X2l,
+                       int X2r, int Y, int dY )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     int dxl = X2l - Xl;
+     int dxr = ++X2r - ++Xr;
+
+     int dXl = ABS(dxl);
+     int dXr = ABS(dxr);
+
+     u32 sgn = 0;
+
+     mga_waitfifo( mdrv, mdev, 6 );
+
+     mga_out32( mmio, dY, AR0 );
+     mga_out32( mmio, - dXl, AR1 );
+     mga_out32( mmio, - dXl, AR2 );
+     mga_out32( mmio, - dXr, AR4 );
+     mga_out32( mmio, - dXr, AR5 );
+     mga_out32( mmio, dY, AR6 );
+
+     if (dxl < 0)
+          sgn |= SDXL;
+     if (dxr < 0)
+          sgn |= SDXR;
+
+     mga_waitfifo( mdrv, mdev, 3 );
+
+     mga_out32( mmio, sgn, SGN );
+     mga_out32( mmio, (RS16(Xr) << 16) | RS16(Xl), FXBNDRY );
+     mga_out32( mmio, (RS16(Y) << 16) | RS16(dY), YDSTLEN | EXECUTE );
+}
+
+static bool
+matroxFillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     mga_waitfifo( mdrv, mdev, 1 );
+
+     if (mdev->draw_blend)
+          mga_out32( mmio, BOP_COPY | SHFTZERO | ATYPE_I | OP_TRAP,
+                     DWGCTL );
+     else
+          mga_out32( mmio, TRANSC | BOP_COPY | SHFTZERO |
+                           SOLID | mdev->atype_blk_rstr | OP_TRAP,
+                     DWGCTL );
+
+     dfb_sort_triangle( tri );
+
+     if (tri->y2 == tri->y3) {
+       matrox_fill_trapezoid( mdrv, mdev, tri->x1, tri->x1,
+                MIN( tri->x2, tri->x3 ), MAX( tri->x2, tri->x3 ),
+                tri->y1, tri->y3 - tri->y1 + 1 );
+     } else
+     if (tri->y1 == tri->y2) {
+       matrox_fill_trapezoid( mdrv, mdev,
+                MIN( tri->x1, tri->x2 ), MAX( tri->x1, tri->x2 ),
+                tri->x3, tri->x3, tri->y1, tri->y3 - tri->y1 + 1 );
+     }
+     else {
+       int majDx = tri->x3 - tri->x1;
+       int majDy = tri->y3 - tri->y1;
+       int topDx = tri->x2 - tri->x1;
+       int topDy = tri->y2 - tri->y1;
+       int botDy = tri->y3 - tri->y2;
+
+       int topXperY = (topDx << 20) / topDy;
+       int X2a = tri->x1 + (((topXperY * topDy) + (1<<19)) >> 20);
+
+       int majXperY = (majDx << 20) / majDy;
+       int majX2  = tri->x1 + (((majXperY * topDy) + (1<<19)) >> 20);
+       int majX2a = majX2 - ((majXperY + (1<<19)) >> 20);
+
+       matrox_fill_trapezoid( mdrv, mdev, tri->x1, tri->x1,
+                MIN( X2a, majX2a ), MAX( X2a, majX2a ),
+                tri->y1, topDy );
+       matrox_fill_trapezoid( mdrv, mdev,
+                MIN( tri->x2, majX2 ), MAX( tri->x2, majX2 ),
+                tri->x3, tri->x3, tri->y2, botDy + 1 );
+     }
+
+     return true;
+}
+
+/******************************************************************************/
+
+static void
+matroxDoBlit2D_Old( MatroxDriverData *mdrv,
+                    MatroxDeviceData *mdev,
+                    int sx, int sy,
+                    int dx, int dy,
+                    int w,  int h,
+                    int pitch, int offset )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 dwgctl = BLTMOD_BFCOL | BOP_COPY | SHFTZERO | ATYPE_RSTR | OP_BITBLT;
+     u32 start, end;
+     u32 sgn = 0;
+     s32 pixelpitch = pitch;
+
+     if (sx < dx)
+          sgn |= BLIT_LEFT;
+     if (sy < dy)
+          sgn |= BLIT_UP;
+
+     if (sgn & BLIT_UP) {
+          sy += h - 1;
+          dy += h - 1;
+     }
+
+     start = sy * pixelpitch + sx + offset;
+
+     w--;
+
+     end = w;
+
+     if (sgn & BLIT_LEFT) {
+          start += w;
+          end = -end;
+     }
+
+     if (sgn & BLIT_UP)
+          pixelpitch = -pixelpitch;
+
+     if (mdev->blit_src_colorkey)
+          dwgctl |= TRANSC;
+
+     mga_waitfifo( mdrv, mdev, 7 );
+     mga_out32( mmio, dwgctl, DWGCTL );
+     mga_out32( mmio, pixelpitch & 0x3FFFFF, AR5 );
+     mga_out32( mmio, start & 0xFFFFFF, AR3 );
+     mga_out32( mmio, end & 0x3FFFF, AR0 );
+     mga_out32( mmio, sgn, SGN );
+     mga_out32( mmio, (RS16(dx+w) << 16) | RS16(dx), FXBNDRY );
+     mga_out32( mmio, (RS16(dy) << 16) | RS16(h), YDSTLEN | EXECUTE );
+}
+
+static bool
+matroxBlit2D_Old( void *drv, void *dev,
+                  DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxDoBlit2D_Old( mdrv, mdev,
+                         rect->x, rect->y,
+                         dx, dy,
+                         rect->w, rect->h,
+                         mdev->src_pitch,
+                         mdev->src_offset[0][0] );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_Old_F( void *drv, void *dev,
+                    DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+
+     src_field = rect->y & 1;
+     dst_field = dy & 1;
+
+     /* fisrt field */
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlit2D_Old( mdrv, mdev,
+                         rect->x, rect->y/2,
+                         dx, dy/2,
+                         rect->w, (rect->h+1)/2,
+                         mdev->src_pitch,
+                         mdev->src_offset[src_field][0] );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlit2D_Old( mdrv, mdev,
+                         rect->x, (rect->y+1)/2,
+                         dx, (dy+1)/2,
+                         rect->w, rect->h/2,
+                         mdev->src_pitch,
+                         mdev->src_offset[!src_field][0] );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     return true;
+}
+
+/******************************************************************************/
+
+static void
+matroxDoBlit2D( MatroxDriverData *mdrv,
+                MatroxDeviceData *mdev,
+                int sx, int sy,
+                int dx, int dy,
+                int w,  int h,
+                int pitch )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 dwgctl = BLTMOD_BFCOL | BOP_COPY | SHFTZERO | ATYPE_RSTR | OP_BITBLT;
+     u32 start, end;
+     u32 sgn = 0;
+     s32 pixelpitch = pitch;
+
+     if (sx < dx)
+          sgn |= BLIT_LEFT;
+     if (sy < dy)
+          sgn |= BLIT_UP;
+
+     if (sgn & BLIT_UP) {
+          sy += h - 1;
+          dy += h - 1;
+     }
+
+     start = end = sy * pixelpitch + sx;
+
+     w--;
+
+     if (sgn & BLIT_LEFT)
+          start += w;
+     else
+          end += w;
+
+     if (sgn & BLIT_UP)
+          pixelpitch = -pixelpitch;
+
+     if (mdev->blit_src_colorkey)
+          dwgctl |= TRANSC;
+
+     mga_waitfifo( mdrv, mdev, 7 );
+     mga_out32( mmio, dwgctl, DWGCTL );
+     mga_out32( mmio, pixelpitch & 0x3FFFFF, AR5 );
+     mga_out32( mmio, start & 0xFFFFFF, AR3 );
+     mga_out32( mmio, end & 0x3FFFFF, AR0 );
+     mga_out32( mmio, sgn, SGN );
+     mga_out32( mmio, (RS16(dx+w) << 16) | RS16(dx), FXBNDRY );
+     mga_out32( mmio, (RS16(dy) << 16) | RS16(h), YDSTLEN | EXECUTE );
+}
+
+static bool
+matroxBlit2D( void *drv, void *dev,
+              DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_2P( void *drv, void *dev,
+                 DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch );
+
+     rect->x &= ~1;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) & ~1;
+     rect->h = (rect->h + 1) / 2;
+     dx &= ~1;
+     dy /= 2;
+
+     /* CbCr plane */
+     mga_waitfifo( mdrv, mdev, 4 );
+     mga_out32( mmio, mdev->src_offset[0][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 2) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 2) & 0xFFFFFF, YBOT );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 4 );
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2) & 0xFFFFFF, YBOT );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_3P( void *drv, void *dev,
+                 DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch );
+
+     rect->x /= 2;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) / 2;
+     rect->h = (rect->h + 1) / 2;
+     dx /= 2;
+     dy /= 2;
+
+     /* Cb plane */
+     mga_waitfifo( mdrv, mdev, 6 );
+     mga_out32( mmio, mdev->src_offset[0][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 4) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 4) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch/2 );
+
+     /* Cr plane */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[0][2], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][2], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch/2 );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 3 );
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_422( void *drv, void *dev,
+                  DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     dx /= 2;
+     rect->x /= 2;
+     rect->w = (rect->w + 1) / 2;
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y,
+                     dx, dy,
+                     rect->w, rect->h,
+                     mdev->src_pitch );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_F( void *drv, void *dev,
+                DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+
+     src_field = rect->y & 1;
+     dst_field = dy & 1;
+
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_2P_F( void *drv, void *dev,
+                   DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+
+     src_field = rect->y & 1;
+     dst_field = dy & 1;
+
+     /* Y plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch );
+
+     /* Subsampling */
+     rect->x &= ~1;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) & ~1;
+     rect->h = (rect->h + 1) / 2;
+     dx &= ~1;
+     dy /= 2;
+
+     mga_waitfifo( mdrv, mdev, 4 );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1/2) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2/2) & 0xFFFFFF, YBOT );
+
+     /* CbCr plane */
+     /* First field */
+     mga_out32( mmio, mdev->src_offset[src_field][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][1], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][1], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 4 );
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2) & 0xFFFFFF, YBOT );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_3P_F( void *drv, void *dev,
+                   DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+
+     src_field = rect->y & 1;
+     dst_field = dy & 1;
+
+     /* Y plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch );
+
+     /* Subsampling */
+     rect->x /= 2;
+     rect->y /= 2;
+     rect->w = (rect->w + 1) / 2;
+     rect->h = (rect->h + 1) / 2;
+     dx /= 2;
+     dy /= 2;
+
+     mga_waitfifo( mdrv, mdev, 6 );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y1/2) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y2/2) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     /* Cb plane */
+     /* First field */
+     mga_out32( mmio, mdev->src_offset[src_field][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][1], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch/2 );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][1], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][1], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch/2 );
+
+     /* Cr plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][2], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][2], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch/2 );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][2], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][2], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch/2 );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 3 );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+static bool
+matroxBlit2D_422_F( void *drv, void *dev,
+                    DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+
+     src_field = rect->y & 1;
+     dst_field = dy & 1;
+
+     dx /= 2;
+     rect->x /= 2;
+     rect->w = (rect->w + 1) / 2;
+
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, rect->y/2,
+                     dx, dy/2,
+                     rect->w, (rect->h+1)/2,
+                     mdev->src_pitch );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlit2D( mdrv, mdev,
+                     rect->x, (rect->y+1)/2,
+                     dx, (dy+1)/2,
+                     rect->w, rect->h/2,
+                     mdev->src_pitch );
+
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     return true;
+}
+
+/******************************************************************************/
+
+static inline void
+matroxDoBlitTMU( MatroxDriverData *mdrv,
+                 MatroxDeviceData *mdev,
+                 int sx, int sy,
+                 int dx, int dy,
+                 int sw, int sh,
+                 int dw, int dh,
+                 int w2, int h2,
+                 bool filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     s32 startx, starty, incx, incy;
+
+     if (mdev->blit_deinterlace) {
+          sy /= 2;
+          sh /= 2;
+     }
+
+     incx = (sw << (20 - w2))  /  dw;
+     incy = (sh << (20 - h2))  /  dh;
+
+     startx = sx << (20 - w2);
+     starty = sy << (20 - h2);
+
+     if (mdev->blit_deinterlace && !mdev->field)
+          starty += (0x80000 >> h2);
+
+     mga_waitfifo( mdrv, mdev, 8);
+
+     mga_out32( mmio, BOP_COPY | SHFTZERO | SGNZERO | ARZERO | ATYPE_I | OP_TEXTURE_TRAP, DWGCTL );
+
+     if (filter)
+          mga_out32( mmio, (0x10<<21) | MAG_BILIN | MIN_BILIN, TEXFILTER );
+     else
+          mga_out32( mmio, (0x10<<21) | MAG_NRST  | MIN_NRST,  TEXFILTER );
+
+     mga_out32( mmio, incx, TMR0 );
+     mga_out32( mmio, incy, TMR3 );
+     mga_out32( mmio, startx, TMR6 );
+     mga_out32( mmio, starty, TMR7 );
+     mga_out32( mmio, (RS16(dx+dw) << 16) | RS16(dx), FXBNDRY );
+     mga_out32( mmio, (RS16(dy) << 16) | RS16(dh), YDSTLEN | EXECUTE );
+}
+
+static inline void
+matroxBlitTMU( MatroxDriverData *mdrv,
+               MatroxDeviceData *mdev,
+               DFBRectangle *srect,
+               DFBRectangle *drect,
+               bool filter )
+{
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2, mdev->h2,
+                      filter );
+}
+
+static inline void
+matroxBlitTMU_2P( MatroxDriverData *mdrv,
+                  MatroxDeviceData *mdev,
+                  DFBRectangle *srect,
+                  DFBRectangle *drect,
+                  bool filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+     u32          texctl;
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2, mdev->h2,
+                      filter );
+
+     srect->x /= 2;
+     srect->y /= 2;
+     srect->w = (srect->w + 1) / 2;
+     srect->h = (srect->h + 1) / 2;
+     drect->x /= 2;
+     drect->y /= 2;
+     drect->w = (drect->w + 1) / 2;
+     drect->h = (drect->h + 1) / 2;
+
+     texctl  = mdev->texctl & ~(TPITCHEXT | TFORMAT);
+     texctl |= (((mdev->src_pitch/2) << 9) & TPITCHEXT) | TW16;
+
+     /* CbCr plane */
+     mga_waitfifo( mdrv, mdev, 10 );
+     mga_out32( mmio, texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 3) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 3) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->src_offset[0][1], TEXORG );
+
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, PW16 | NODITHER, MACCESS );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 4) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 4) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     /* No filtering since we're not using real RGB16 data */
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2-1, mdev->h2-1,
+                      false );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 7 );
+     mga_out32( mmio, mdev->texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 4) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 4) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+     mga_out32( mmio, PW8 | BYPASS332 | NODITHER, MACCESS );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+}
+
+static inline void
+matroxBlitTMU_3P( MatroxDriverData *mdrv,
+                  MatroxDeviceData *mdev,
+                  DFBRectangle *srect,
+                  DFBRectangle *drect,
+                  bool filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+     u32          texctl;
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2, mdev->h2,
+                      filter );
+
+     srect->x /= 2;
+     srect->y /= 2;
+     srect->w = (srect->w + 1) / 2;
+     srect->h = (srect->h + 1) / 2;
+     drect->x /= 2;
+     drect->y /= 2;
+     drect->w = (drect->w + 1) / 2;
+     drect->h = (drect->h + 1) / 2;
+
+     texctl  = mdev->texctl & ~TPITCHEXT;
+     texctl |= ((mdev->src_pitch/2) << 9) & TPITCHEXT;
+
+     /* Cb plane */
+     mga_waitfifo( mdrv, mdev, 9 );
+     mga_out32( mmio, texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 3) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 3) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->src_offset[0][1], TEXORG );
+
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][1], DSTORG );
+
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y1 / 4) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch * mdev->clip.y2 / 4) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2-1, mdev->h2-1,
+                      filter );
+
+     /* Cr plane */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[0][2], TEXORG );
+
+     mga_out32( mmio, mdev->dst_offset[0][2], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y,
+                      drect->x, drect->y,
+                      srect->w, srect->h,
+                      drect->w, drect->h,
+                      mdev->w2-1, mdev->h2-1,
+                      filter );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 6 );
+     mga_out32( mmio, mdev->texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 4) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 4) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+}
+
+static bool
+matroxStretchBlit( void *drv, void *dev,
+                   DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxBlitTMU( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_2P( void *drv, void *dev,
+                      DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxBlitTMU_2P( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_3P( void *drv, void *dev,
+                      DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxBlitTMU_3P( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_422( void *drv, void *dev,
+                       DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     srect->x /= 2;
+     srect->w = (srect->w + 1) / 2;
+     drect->x /= 2;
+     drect->w = (drect->w + 1) / 2;
+
+     matroxBlitTMU( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxBlit3D( void *drv, void *dev,
+              DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv  = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev  = (MatroxDeviceData*) dev;
+
+     DFBRectangle      drect = { dx, dy, rect->w, rect->h };
+
+     matroxBlitTMU( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool
+matroxBlit3D_2P( void *drv, void *dev,
+                 DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv  = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev  = (MatroxDeviceData*) dev;
+
+     DFBRectangle      drect = { dx, dy, rect->w, rect->h };
+
+     matroxBlitTMU_2P( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool
+matroxBlit3D_3P( void *drv, void *dev,
+                 DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv  = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev  = (MatroxDeviceData*) dev;
+
+     DFBRectangle      drect = { dx, dy, rect->w, rect->h };
+
+     matroxBlitTMU_3P( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static bool
+matroxBlit3D_422( void *drv, void *dev,
+                  DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv  = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev  = (MatroxDeviceData*) dev;
+
+     DFBRectangle      drect= { dx, dy, rect->w, rect->h };
+
+     rect->x /= 2;
+     rect->w = (rect->w + 1) / 2;
+     drect.x /= 2;
+     drect.w = (drect.w + 1) / 2;
+
+     matroxBlitTMU( mdrv, mdev, rect, &drect, mdev->blit_deinterlace );
+
+     return true;
+}
+
+static void
+matroxBlitTMU_F( MatroxDriverData *mdrv,
+                 MatroxDeviceData *mdev,
+                 DFBRectangle *srect,
+                 DFBRectangle *drect,
+                 bool filter )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+     int          src_field, dst_field;
+
+     src_field = srect->y & 1;
+     dst_field = drect->y & 1;
+
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2, mdev->h2, filter );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2, mdev->h2, filter );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+}
+
+static bool
+matroxBlit3D_F( void *drv, void *dev,
+                DFBRectangle *rect, int dx, int dy )
+{
+     MatroxDriverData *mdrv  = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev  = (MatroxDeviceData*) dev;
+     DFBRectangle      drect = { dx, dy, rect->w, rect->h };
+
+     matroxBlitTMU_F( mdrv, mdev, rect, &drect, false );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_F( void *drv, void *dev,
+                     DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     matroxBlitTMU_F( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_422_F( void *drv, void *dev,
+                         DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+
+     srect->x /= 2;
+     srect->w = (srect->w + 1) / 2;
+     drect->x /= 2;
+     drect->w = (drect->w + 1) / 2;
+
+     matroxBlitTMU_F( mdrv, mdev, srect, drect, true );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_2P_F( void *drv, void *dev,
+                        DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+     u32               texctl;
+
+     src_field = srect->y & 1;
+     dst_field = drect->y & 1;
+
+     /* Y plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2, mdev->h2, true );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2, mdev->h2, true );
+
+     /* Subsampling */
+     srect->x /= 2;
+     srect->y /= 2;
+     srect->w = (srect->w + 1) / 2;
+     srect->h = (srect->h + 1) / 2;
+     drect->x /= 2;
+     drect->y /= 2;
+     drect->w = (drect->w + 1) / 2;
+     drect->h = (drect->h + 1) / 2;
+
+     texctl  = mdev->texctl & ~(TPITCHEXT | TFORMAT);
+     texctl |= (((mdev->src_pitch/2) << 9) & TPITCHEXT) | TW16;
+
+     mga_waitfifo( mdrv, mdev, 10 );
+     mga_out32( mmio, texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 3) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 3) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, PW16 | NODITHER, MACCESS );
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y1/2) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y2/2) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     /* CbCr plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][1], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][1], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][1], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][1], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 7 );
+     mga_out32( mmio, mdev->texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 4) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 4) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+     mga_out32( mmio, PW8 | BYPASS332 | NODITHER, MACCESS );
+
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+static bool
+matroxStretchBlit_3P_F( void *drv, void *dev,
+                        DFBRectangle *srect, DFBRectangle *drect )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     int               src_field, dst_field;
+     u32               texctl;
+
+     src_field = srect->y & 1;
+     dst_field = drect->y & 1;
+
+     /* Y plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2, mdev->h2, true );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][0], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2, mdev->h2, true );
+
+     /* Subsampling */
+     srect->x /= 2;
+     srect->y /= 2;
+     srect->w = (srect->w + 1) / 2;
+     srect->h = (srect->h + 1) / 2;
+     drect->x /= 2;
+     drect->y /= 2;
+     drect->w = (drect->w + 1) / 2;
+     drect->h = (drect->h + 1) / 2;
+
+     texctl  = mdev->texctl & ~TPITCHEXT;
+     texctl |= ((mdev->src_pitch/2) << 9) & TPITCHEXT;
+
+     mga_waitfifo( mdrv, mdev, 9 );
+     mga_out32( mmio, texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 3) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h/2 - 1) & 0x7ff) << 18) |
+                        (((u32)(3 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 3) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->dst_pitch/2, PITCH );
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y1/2) & 0xFFFFFF, YTOP );
+     mga_out32( mmio, (mdev->dst_pitch/2 * mdev->clip.y2/2) & 0xFFFFFF, YBOT );
+     mga_out32( mmio, ((mdev->clip.x2/2 & 0x0FFF) << 16) | (mdev->clip.x1/2 & 0x0FFF), CXBNDRY );
+
+     /* Cb plane */
+     /* First field */
+     mga_out32( mmio, mdev->src_offset[src_field][1], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][1], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][1], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][1], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Cr plane */
+     /* First field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[src_field][2], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[dst_field][2], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, srect->y/2,
+                      drect->x, drect->y/2,
+                      srect->w, (srect->h+1)/2,
+                      drect->w, (drect->h+1)/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Second field */
+     mga_waitfifo( mdrv, mdev, 2 );
+     mga_out32( mmio, mdev->src_offset[!src_field][2], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[!dst_field][2], DSTORG );
+
+     matroxDoBlitTMU( mdrv, mdev,
+                      srect->x, (srect->y+1)/2,
+                      drect->x, (drect->y+1)/2,
+                      srect->w, srect->h/2,
+                      drect->w, drect->h/2,
+                      mdev->w2-1, mdev->h2-1, true );
+
+     /* Restore registers */
+     mga_waitfifo( mdrv, mdev, 6 );
+     mga_out32( mmio, mdev->texctl, TEXCTL );
+     mga_out32( mmio, ( (((u32)(mdev->w - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 4) & 0x3f)      )  ), TEXWIDTH );
+     mga_out32( mmio, ( (((u32)(mdev->h - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 4) & 0x3f)      )  ), TEXHEIGHT );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+     mga_out32( mmio, mdev->dst_offset[0][0], DSTORG );
+
+     matrox_set_clip( mdrv, mdev, &mdev->clip );
+
+     return true;
+}
+
+/******************************************************************************/
+
+static u32 pci_config_in32( unsigned int bus,
+                            unsigned int slot,
+                            unsigned int func,
+                            u8 reg )
+{
+     char  filename[512];
+     int   fd;
+     u32 val;
+
+     snprintf( filename, 512,
+               "/proc/bus/pci/%02x/%02x.%x",
+               bus, slot, func );
+
+     fd = open( filename, O_RDONLY );
+     if (fd < 0)
+          return 0;
+
+     if (lseek( fd, reg, SEEK_SET ) != reg) {
+          close( fd );
+          return 0;
+     }
+
+     if (read( fd, &val, 4 ) != 4) {
+          close( fd );
+          return 0;
+     }
+
+     close( fd );
+
+#ifdef WORDS_BIGENDIAN
+     return ((val & 0xff000000) >> 24) |
+            ((val & 0x00ff0000) >>  8) |
+            ((val & 0x0000ff00) <<  8) |
+            ((val & 0x000000ff) << 24);
+#else
+     return val;
+#endif
+}
+
+static DFBResult matrox_find_pci_device( MatroxDeviceData *mdev,
+                                         unsigned int     *bus,
+                                         unsigned int     *slot,
+                                         unsigned int     *func )
+{
+     unsigned int   vendor, device, devfn;
+     unsigned long  addr0, addr1;
+     char           line[512];
+     FILE          *file;
+
+     file = fopen( "/proc/bus/pci/devices", "r" );
+     if (!file) {
+          D_PERROR( "DirectFB/Matrox: "
+                     "Error opening `/proc/bus/pci/devices'!\n" );
+          return errno2result( errno );
+     }
+
+     while (fgets( line, 512, file )) {
+          if (sscanf( line, "%02x%02x\t%04x%04x\t%*x\t%lx\t%lx",
+                      bus, &devfn, &vendor, &device, &addr0, &addr1 ) != 6)
+               continue;
+
+          if (vendor != PCI_VENDOR_ID_MATROX)
+               continue;
+
+          *slot = (devfn >> 3) & 0x1F;
+          *func = devfn & 0x07;
+
+          addr0 &= ~0xFUL;
+          addr1 &= ~0xFUL;
+
+          switch (device) {
+          case PCI_DEVICE_ID_MATROX_G550_AGP:
+          case PCI_DEVICE_ID_MATROX_G400_AGP:
+               if (addr0 == (mdev->fb.physical & ~0x1FFFFFF)) {
+                    fclose( file );
+                    return DFB_OK;
+               }
+               break;
+
+          case PCI_DEVICE_ID_MATROX_G200_PCI:
+          case PCI_DEVICE_ID_MATROX_G200_AGP:
+          case PCI_DEVICE_ID_MATROX_G100_PCI:
+          case PCI_DEVICE_ID_MATROX_G100_AGP:
+          case PCI_DEVICE_ID_MATROX_2164W_PCI:
+          case PCI_DEVICE_ID_MATROX_2164W_AGP:
+               if (addr0 == mdev->fb.physical) {
+                    fclose( file );
+                    return DFB_OK;
+               }
+               break;
+
+          case PCI_DEVICE_ID_MATROX_1064SG_PCI:
+          case PCI_DEVICE_ID_MATROX_1064SG_AGP:
+               if ((pci_config_in32( *bus, *slot, *func, 0x08 ) & 0xFF) > 0x02) {
+                    /* Mystique 220 (1164SG) */
+                    if (addr0 == mdev->fb.physical) {
+                         fclose( file );
+                         return DFB_OK;
+                    }
+               } else {
+                    /* Mystique (1064SG) */
+                    if (addr1 == mdev->fb.physical) {
+                         fclose( file );
+                         return DFB_OK;
+                    }
+               }
+               break;
+
+          case PCI_DEVICE_ID_MATROX_2064W_PCI:
+               if (addr1 == mdev->fb.physical) {
+                    fclose( file );
+                    return DFB_OK;
+               }
+               break;
+          }
+     }
+
+     D_ERROR( "DirectFB/Matrox: Can't find device in `/proc/bus/pci'!\n" );
+
+     fclose( file );
+     return DFB_INIT;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_MATROX_MGA2064W:     /* Matrox 2064W (Millennium)       */
+          case FB_ACCEL_MATROX_MGA1064SG:    /* Matrox 1064SG/1164SG (Mystique) */
+          case FB_ACCEL_MATROX_MGA2164W:     /* Matrox 2164W (Millennium II)    */
+          case FB_ACCEL_MATROX_MGA2164W_AGP: /* Matrox 2164W (Millennium II)    */
+          case FB_ACCEL_MATROX_MGAG100:      /* Matrox G100                     */
+          case FB_ACCEL_MATROX_MGAG200:      /* Matrox G200                     */
+          case FB_ACCEL_MATROX_MGAG400:      /* Matrox G400/G450/G550           */
+               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,
+               "Matrox G-Series/Millennium/Mystique" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 7;
+
+     info->driver_data_size = sizeof (MatroxDriverData);
+     info->device_data_size = sizeof (MatroxDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     MatroxDriverData *mdrv = driver_data;
+
+     mdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!mdrv->mmio_base)
+          return DFB_IO;
+
+     mdrv->device_data = device_data;
+     mdrv->maven_fd    = -1;
+     mdrv->accelerator = dfb_gfxcard_get_accelerator( device );
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_MATROX_MGAG400:
+               funcs->CheckState = matroxG400CheckState;
+               break;
+
+          case FB_ACCEL_MATROX_MGAG200:
+               if (!dfb_config->font_format)
+                    dfb_config->font_format = DSPF_ARGB;
+               funcs->CheckState = matroxG200CheckState;
+               break;
+
+          case FB_ACCEL_MATROX_MGAG100:
+               funcs->CheckState = matroxG100CheckState;
+               break;
+
+          case FB_ACCEL_MATROX_MGA1064SG:
+          case FB_ACCEL_MATROX_MGA2164W:
+          case FB_ACCEL_MATROX_MGA2164W_AGP:
+               funcs->CheckState = matroxOldCheckState;
+               break;
+
+          case FB_ACCEL_MATROX_MGA2064W:
+               funcs->CheckState = matrox2064WCheckState;
+               break;
+     }
+
+     funcs->SetState          = matroxSetState;
+     funcs->EngineReset       = matroxEngineReset;
+     funcs->EngineSync        = matroxEngineSync;
+     funcs->FlushTextureCache = matroxFlushTextureCache;
+     funcs->FlushReadCache    = matroxFlushReadCache;
+
+     funcs->DrawRectangle     = matroxDrawRectangle;
+     funcs->DrawLine          = matroxDrawLine;
+     funcs->FillTriangle      = matroxFillTriangle;
+     funcs->TextureTriangles  = matroxTextureTriangles;
+
+     /* will be set dynamically: funcs->FillRectangle, funcs->Blit, funcs->StretchBlit */
+
+     /* Generic CRTC1 support */
+     mdrv->primary = dfb_screens_at( DSCID_PRIMARY );
+
+     /* G200/G400/G450/G550 Backend Scaler Support */
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG200 ||
+         mdrv->accelerator == FB_ACCEL_MATROX_MGAG400)
+          dfb_layers_register( mdrv->primary, driver_data, &matroxBesFuncs );
+
+     /* G400/G450/G550 CRTC2 support */
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG400 &&
+         dfb_config->matrox_crtc2)
+     {
+          mdrv->secondary = dfb_screens_register( device, driver_data,
+                                                  &matroxCrtc2ScreenFuncs );
+
+          dfb_layers_register( mdrv->secondary, driver_data, &matroxCrtc2Funcs );
+          dfb_layers_register( mdrv->secondary, driver_data, &matroxSpicFuncs );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) driver_data;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) device_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+     unsigned int      bus, slot, func;
+     bool              g450, g550, sgram = false;
+     DFBResult         ret;
+
+     mdev->fb.physical = dfb_gfxcard_memory_physical( device, 0 );
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_MATROX_MGAG400:
+               if ((ret = matrox_find_pci_device( mdev, &bus, &slot, &func )))
+                    return ret;
+
+               g550  = ((pci_config_in32( bus, slot, func, 0x00 ) >> 16) == PCI_DEVICE_ID_MATROX_G550_AGP);
+               g450  = ((pci_config_in32( bus, slot, func, 0x08 ) & 0xFF) >= 0x80);
+               sgram = ((pci_config_in32( bus, slot, func, 0x40 ) & 0x4000) == 0x4000);
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "%s",
+                         g550 ? "G550" : g450 ? "G450" : "G400" );
+               mdev->g450_matrox = g450 || g550;
+               mdev->g550_matrox = g550;
+
+               mdev->fb.offset = mdev->fb.physical & 0x1FFFFFF;
+               break;
+          case FB_ACCEL_MATROX_MGAG200:
+               if ((ret = matrox_find_pci_device( mdev, &bus, &slot, &func )))
+                    return ret;
+
+               sgram = ((pci_config_in32( bus, slot, func, 0x40 ) & 0x4000) == 0x4000);
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "G200" );
+               break;
+          case FB_ACCEL_MATROX_MGAG100:
+               mdev->old_matrox = true;
+               sgram            = false; /* FIXME: can we detect this? */
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "G100" );
+               break;
+          case FB_ACCEL_MATROX_MGA2064W:
+               mdev->old_matrox = true;
+               sgram            = true;
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Millennium (2064W)" );
+               break;
+          case FB_ACCEL_MATROX_MGA1064SG:
+               if ((ret = matrox_find_pci_device( mdev, &bus, &slot, &func )))
+                    return ret;
+
+               mdev->old_matrox = true;
+               sgram            = ((pci_config_in32( bus, slot, func, 0x40 ) & 0x4000) == 0x4000);
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "%s",
+                         ((pci_config_in32( bus, slot, func, 0x08 ) & 0xFF) > 0x02) ?
+                         "Mystique 220 (1164SG)" : "Mystique (1064SG)" );
+               break;
+          case FB_ACCEL_MATROX_MGA2164W:
+          case FB_ACCEL_MATROX_MGA2164W_AGP:
+               mdev->old_matrox = true;
+               sgram            = true;
+               snprintf( device_info->name,
+                         DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Millennium II (2164W)" );
+               break;
+     }
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Matrox" );
+
+
+     /* set hardware capabilities */
+     device_info->caps.flags = CCF_CLIPPING;
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_MATROX_MGAG400:
+               device_info->caps.accel    = MATROX_G200G400_DRAWING_FUNCTIONS |
+                                            MATROX_G200G400_BLITTING_FUNCTIONS;
+               device_info->caps.drawing  = MATROX_G200G400_DRAWING_FLAGS;
+               device_info->caps.blitting = MATROX_G200G400_BLITTING_FLAGS;
+               break;
+
+          case FB_ACCEL_MATROX_MGAG200:
+               device_info->caps.accel    = MATROX_G200G400_DRAWING_FUNCTIONS |
+                                            MATROX_G200G400_BLITTING_FUNCTIONS;
+               device_info->caps.drawing  = MATROX_G200G400_DRAWING_FLAGS;
+               device_info->caps.blitting = MATROX_G200G400_BLITTING_FLAGS;
+               break;
+
+          case FB_ACCEL_MATROX_MGAG100:
+               device_info->caps.accel    = MATROX_G100_DRAWING_FUNCTIONS |
+                                            MATROX_G100_BLITTING_FUNCTIONS;
+               device_info->caps.drawing  = MATROX_G100_DRAWING_FLAGS;
+               device_info->caps.blitting = MATROX_G100_BLITTING_FLAGS;
+               break;
+
+          case FB_ACCEL_MATROX_MGA1064SG:
+          case FB_ACCEL_MATROX_MGA2164W:
+          case FB_ACCEL_MATROX_MGA2164W_AGP:
+               device_info->caps.accel    = MATROX_OLD_DRAWING_FUNCTIONS |
+                                            MATROX_OLD_BLITTING_FUNCTIONS;
+               device_info->caps.drawing  = MATROX_OLD_DRAWING_FLAGS;
+               device_info->caps.blitting = MATROX_OLD_BLITTING_FLAGS;
+               break;
+
+          case FB_ACCEL_MATROX_MGA2064W:
+               device_info->caps.accel    = MATROX_2064W_DRAWING_FUNCTIONS |
+                                            MATROX_2064W_BLITTING_FUNCTIONS;
+               device_info->caps.drawing  = MATROX_2064W_DRAWING_FLAGS;
+               device_info->caps.blitting = MATROX_2064W_BLITTING_FLAGS;
+               break;
+     }
+
+     /* set hardware limitations */
+     device_info->limits.surface_byteoffset_alignment = 128;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+     device_info->limits.surface_bytepitch_alignment  = 64;
+
+     /* YUY2 / UYVY is handled as 32bit so pixelpitch alignment must be doubled. */
+     device_info->limits.surface_pixelpitch_alignment = 64;
+
+     mdev->atype_blk_rstr = (sgram || dfb_config->matrox_sgram) ? ATYPE_BLK : ATYPE_RSTR;
+     /*
+      * Pitch must be a multiple of 64 bytes for block write to work.
+      * SRCORG/DSTORG must be a multiple of 64.
+      * I420/YV12 subsampling makes the actual requirement 128 bytes.
+      */
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG400)
+          device_info->limits.surface_bytepitch_alignment = 128;
+
+     /* soft reset to fix eventually corrupted TMU read offset on G200 */
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG200) {
+          u32 ien = mga_in32( mmio, IEN );
+          mga_out32( mmio, 1, RST );
+          usleep(10);
+          mga_out32( mmio, 0, RST );
+          mga_out32( mmio, ien, IEN );
+     }
+
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGA2064W)
+          mdev->idle_status = 0;
+     else
+          mdev->idle_status = ENDPRDMASTS;
+
+     switch (mdrv->accelerator) {
+          case FB_ACCEL_MATROX_MGAG100:
+          case FB_ACCEL_MATROX_MGAG200:
+               if ((ret = dfb_palette_create( NULL, 256, &mdev->rgb332_palette )) != DFB_OK)
+                    return ret;
+               dfb_palette_generate_rgb332_map( mdev->rgb332_palette );
+
+               mdev->tlut_offset = dfb_gfxcard_reserve_memory( device, 2 * 256 );
+     }
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) driver_data;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) device_data;
+
+     if (mdev->rgb332_palette)
+          dfb_palette_unref( mdev->rgb332_palette );
+
+     /* reset DSTORG as matroxfb does not */
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mdrv->mmio_base, 0, DSTORG );
+
+     /* make sure BES registers get updated (besvcnt) */
+     mga_out32( mdrv->mmio_base, 0, BESGLOBCTL );
+     /* make sure overlay is off */
+     mga_out32( mdrv->mmio_base, 0, BESCTL );
+
+
+     D_DEBUG( "DirectFB/Matrox: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/Matrox:  %9d matrox_waitfifo calls\n",
+               mdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/Matrox:  %9d register writes (matrox_waitfifo sum)\n",
+               mdev->waitfifo_sum );
+     D_DEBUG( "DirectFB/Matrox:  %9d FIFO wait cycles (depends on CPU)\n",
+               mdev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/Matrox:  %9d IDLE wait cycles (depends on CPU)\n",
+               mdev->idle_waitcycles );
+     D_DEBUG( "DirectFB/Matrox:  %9d FIFO space cache hits (depends on CPU)\n",
+               mdev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/Matrox: Conclusion:\n" );
+     D_DEBUG( "DirectFB/Matrox:  Average register writes/matrox_waitfifo call: %.2f\n",
+               mdev->waitfifo_sum/(float)(mdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/Matrox:  Average wait cycles/matrox_waitfifo call:     %.2f\n",
+               mdev->fifo_waitcycles/(float)(mdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/Matrox:  Average fifo space cache hits:                %02d%%\n",
+               (int)(100 * mdev->fifo_cache_hits/(float)(mdev->waitfifo_calls)) );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) driver_data;
+
+     dfb_gfxcard_unmap_mmio( device, mdrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox.h b/Source/DirectFB/gfxdrivers/matrox/matrox.h
new file mode 100755
index 0000000..70062bf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox.h
@@ -0,0 +1,157 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MATROX_H__
+#define ___MATROX_H__
+
+#include <dfb_types.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+#define PCI_VENDOR_ID_MATROX            0x102B
+#define PCI_DEVICE_ID_MATROX_2064W_PCI  0x0519
+#define PCI_DEVICE_ID_MATROX_1064SG_PCI 0x051A
+#define PCI_DEVICE_ID_MATROX_2164W_PCI  0x051B
+#define PCI_DEVICE_ID_MATROX_1064SG_AGP 0x051E
+#define PCI_DEVICE_ID_MATROX_2164W_AGP  0x051F
+#define PCI_DEVICE_ID_MATROX_G100_PCI   0x1000
+#define PCI_DEVICE_ID_MATROX_G100_AGP   0x1001
+#define PCI_DEVICE_ID_MATROX_G200_PCI   0x0520
+#define PCI_DEVICE_ID_MATROX_G200_AGP   0x0521
+#define PCI_DEVICE_ID_MATROX_G400_AGP   0x0525
+#define PCI_DEVICE_ID_MATROX_G550_AGP   0x2527
+
+typedef enum {
+     m_Source       = 0x0001,
+     m_source       = 0x0002,
+
+     m_drawColor    = 0x0010,
+     m_blitColor    = 0x0020,
+     m_color        = 0x0040,
+
+     m_SrcKey       = 0x0100,
+     m_srckey       = 0x0200,
+
+     m_drawBlend    = 0x1000,
+     m_blitBlend    = 0x2000,
+
+     m_destination  = 0x4000,
+     m_clip         = 0x8000,
+} MatroxStateBits;
+
+#define MGA_VALIDATE(b)       (mdev->valid |= (b))
+#define MGA_INVALIDATE(b)     (mdev->valid &= ~(b))
+#define MGA_IS_VALID(b)       (mdev->valid & (b))
+
+typedef struct {
+     /* Old cards are older than G200/G400, e.g. Mystique or Millennium */
+     bool old_matrox;
+     /* G450/G550  */
+     bool g450_matrox;
+     /* G550  */
+     bool g550_matrox;
+
+     /* FIFO Monitoring */
+     unsigned int fifo_space;
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+
+     /* ATYPE_BLK or ATYPE_RSTR, depending on SGRAM setting */
+     u32 atype_blk_rstr;
+
+     /* State handling */
+     MatroxStateBits valid;
+
+     /* Stored values */
+     int dst_pitch;
+     int dst_offset[2][3];
+     int src_pitch;
+     int src_offset[2][3];
+     int w, h, w2, h2;
+     u32 color[3];
+
+     bool draw_blend;
+     bool blit_src_colorkey;
+
+     bool blit_deinterlace;
+     bool blit_fields;
+     int field;
+
+     bool depth_buffer;
+
+     u32 texctl;
+
+     u32 idle_status;
+
+     DFBRegion clip;
+
+     struct {
+          unsigned long offset;
+          unsigned long physical;
+     } fb;
+     unsigned int tlut_offset;
+     CorePalette *rgb332_palette;
+
+     bool crtc2_separated;
+} MatroxDeviceData;
+
+typedef struct {
+     int            accelerator;
+     int            maven_fd;
+     volatile u8   *mmio_base;
+
+     CoreScreen    *primary;
+     CoreScreen    *secondary;
+
+     MatroxDeviceData *device_data;
+} MatroxDriverData;
+
+
+extern DisplayLayerFuncs matroxBesFuncs;
+extern DisplayLayerFuncs matroxCrtc2Funcs;
+extern DisplayLayerFuncs matroxSpicFuncs;
+
+extern ScreenFuncs matroxCrtc2ScreenFuncs;
+
+static inline int mga_log2( int val )
+{
+     register int ret = 0;
+
+     while (val >> ++ret);
+
+     if ((1 << --ret) < val)
+          ret++;
+
+     return ret;
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_3d.c b/Source/DirectFB/gfxdrivers/matrox/matrox_3d.c
new file mode 100755
index 0000000..f3753b0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_3d.c
@@ -0,0 +1,627 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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/fb.h>
+
+#include <math.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/types.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+#include "matrox_3d.h"
+
+
+#ifdef ARCH_X86
+#define RINT(x) my_rint(x)
+#define CEIL(x) my_ceil(x)
+#define FLOOR(x) my_floor(x)
+#else
+#define RINT(x) ((s32)(x))
+#define CEIL(x) ((s32)ceil(x))
+#define FLOOR(x) ((s32)floor(x))
+#endif
+
+#ifdef ARCH_X86
+static inline long
+my_rint(const float x)
+{
+     register float arg = x;
+     long result;
+     __asm__ ("fistl %0" : "=m" (result) : "t" (arg));
+     return result;
+}
+
+static inline long
+my_ceil(const float x)
+{
+     register float arg = x;
+     volatile long value;
+     volatile short cw, cwtmp;
+
+     __asm__ volatile ("fnstcw %0" : "=m" (cw) : );
+     cwtmp = (cw & 0xf3ff) | 0x0800; /* rounding up */
+     __asm__ volatile ("fldcw %1\n"
+                       "fistl %0\n"
+                       "fldcw %2"
+                       : "=m" (value)
+                       : "m" (cwtmp), "m" (cw), "t" (arg));
+     return value;
+}
+
+static inline long
+my_floor(const float x)
+{
+     register float arg = x;
+     volatile long value;
+     volatile short cw, cwtmp;
+
+     __asm__ volatile ("fnstcw %0" : "=m" (cw) : );
+     cwtmp = (cw & 0xf3ff) | 0x0400;
+     __asm__ volatile ("fldcw %1\n"
+                       "fistl %0\n"
+                       "fldcw %2"
+                       : "=m" (value)
+                       : "m" (cwtmp), "m" (cw), "t" (arg));
+     return value;
+}
+#endif
+
+#define F2COL(x) (RINT(x) & 0x00ffffff)
+
+#define mgaF1800(x) (((s32) (x)) & 0x0003ffff)
+#define mgaF2400(x) (((s32) (x)) & 0x00ffffff)
+#define mgaF2200(x) (((s32) (x)) & 0x003fffff)
+
+#define OUTREG(r,d)  do { mga_out32( mmio, d, r ); } while (0)
+
+#define MGA_S(start,xinc,yinc)                                        \
+     do {                                                             \
+          mga_out32( mmio, start, TMR6 );                             \
+          mga_out32( mmio, xinc, TMR0 );                              \
+          mga_out32( mmio, yinc, TMR1 );                              \
+     } while (0)
+
+#define MGA_T(start,xinc,yinc)                                        \
+     do {                                                             \
+          mga_out32( mmio, start, TMR7 );                             \
+          mga_out32( mmio, xinc, TMR2 );                              \
+          mga_out32( mmio, yinc, TMR3 );                              \
+     } while (0)
+
+#define MGA_Q(start,xinc,yinc)                                        \
+     do {                                                             \
+          mga_out32( mmio, start, TMR8 );                             \
+          mga_out32( mmio, xinc, TMR4 );                              \
+          mga_out32( mmio, yinc, TMR5 );                              \
+     } while (0)
+
+
+#define MGA_LSLOPE(dx,dy,sgn,err)                                     \
+     do {                                                             \
+          mga_out32( mmio, mgaF1800(dy), AR0 );                       \
+          if ((dx) >= 0) {                                            \
+               mga_out32( mmio, mgaF2400(-(dx)+(err)), AR1 );         \
+               mga_out32( mmio, mgaF1800(-(dx)), AR2 );               \
+               sgn &= ~SDXL;                                          \
+          }                                                           \
+          else {                                                      \
+               mga_out32( mmio, mgaF2400((dx)+(dy)-(err)-1), AR1 );   \
+               mga_out32( mmio, mgaF1800(dx), AR2 );                  \
+               sgn |= SDXL;                                           \
+          }                                                           \
+     } while(0)
+
+
+#define MGA_G400_LSLOPE(dx,dy,sgn,err)                                \
+     do {                                                             \
+          mga_out32( mmio, mgaF2200(dy), AR0 );                       \
+          if ((dx) >= 0) {                                            \
+               mga_out32( mmio, mgaF2400(-(dx)+(err)), AR1 );         \
+               mga_out32( mmio, mgaF2200(-(dx)), AR2);                \
+               sgn &= ~SDXL;                                          \
+          }                                                           \
+          else {                                                      \
+               mga_out32( mmio, mgaF2400((dx)+(dy)-(err)-1), AR1 );   \
+               mga_out32( mmio, mgaF2200(dx), AR2 );                  \
+               sgn |= SDXL;                                           \
+          }                                                           \
+     } while(0)
+
+
+#define MGA_RSLOPE(dx,dy,sgn,err)                                     \
+     do {                                                             \
+          mga_out32( mmio, mgaF1800(dy), AR6);                        \
+          if ((dx) >= 0) {                                            \
+               mga_out32( mmio, mgaF1800(-(dx)+(err)), AR4 );         \
+               mga_out32( mmio, mgaF1800(-(dx)), AR5 );               \
+               sgn &= ~SDXR;                                          \
+          }                                                           \
+          else {                                                      \
+               mga_out32( mmio, mgaF1800((dx)+(dy)-(err)-1), AR4 );   \
+               mga_out32( mmio, mgaF1800(dx), AR5 );                  \
+               sgn |= SDXR;                                           \
+          }                                                           \
+     } while(0)
+
+
+#define MGA_G400_RSLOPE(dx,dy,sgn,err)                                \
+     do {                                                             \
+          mga_out32( mmio, mgaF2200(dy), AR6 );                       \
+          if ((dx) >= 0) {                                            \
+               mga_out32( mmio, mgaF2200(-(dx)+(err)), AR4 );         \
+               mga_out32( mmio, mgaF2200(-(dx)), AR5 );               \
+               sgn &= ~SDXR;                                          \
+          }                                                           \
+          else {                                                      \
+               mga_out32( mmio, mgaF2200((dx)+(dy)-(err)-1), AR4 );   \
+               mga_out32( mmio, mgaF2200(dx), AR5);                   \
+               sgn |= SDXR;                                           \
+          }                                                           \
+     } while(0)
+
+
+typedef struct {
+     DFBVertex *v0, *v1;  /* Y(v0) < Y(v1) */
+     float      dx;          /* X(v1) - X(v0) */
+     float      dy;          /* Y(v1) - Y(v0) */
+     float      dxOOA;          /* dx * oneOverArea */
+     float      dyOOA;          /* dy * oneOverArea */
+
+     float      adjx,adjy; /* subpixel offset after rounding to integer */
+     int        err;        /* error term ready for hardware */
+     int        idx,idy;    /* delta-x & delta-y ready for hardware */
+     int        sx,sy;          /* first sample point x,y coord */
+     int        lines;      /* number of lines to be sampled on this edge */
+} EdgeT;
+
+
+static void
+texture_triangle( MatroxDriverData *mdrv, MatroxDeviceData *mdev,
+                  DFBVertex *v0, DFBVertex *v1, DFBVertex *v2 )
+{
+     EdgeT       eMaj, eTop, eBot;
+     float       oneOverArea;
+     DFBVertex  *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
+     int         Shape; /* 1 = Top half, 2 = bottom half, 3 = top+bottom */
+//     float       bf = mga_bf_sign;
+
+     volatile u8 *mmio = mdrv->mmio_base;
+
+/* find the order of the 3 vertices along the Y axis */
+     {
+          float y0 = v0->y;
+          float y1 = v1->y;
+          float y2 = v2->y;
+
+          if (y0<=y1) {
+               if (y1<=y2) {
+                    vMin = v0;   vMid = v1;   vMax = v2;   /* y0<=y1<=y2 */
+               }
+               else if (y2<=y0) {
+                    vMin = v2;   vMid = v0;   vMax = v1;   /* y2<=y0<=y1 */
+               }
+               else {
+                    vMin = v0;   vMid = v2;   vMax = v1; /*bf = -bf;*/  /* y0<=y2<=y1 */
+               }
+          }
+          else {
+               if (y0<=y2) {
+                    vMin = v1;   vMid = v0;   vMax = v2; /*bf = -bf;*/  /* y1<=y0<=y2 */
+               }
+               else if (y2<=y1) {
+                    vMin = v2;   vMid = v1;   vMax = v0; /*bf = -bf;*/  /* y2<=y1<=y0 */
+               }
+               else {
+                    vMin = v1;   vMid = v2;   vMax = v0;   /* y1<=y2<=y0 */
+               }
+          }
+     }
+
+/* vertex/edge relationship */
+     eMaj.v0 = vMin;   eMaj.v1 = vMax;
+     eTop.v0 = vMin;   eTop.v1 = vMid;
+     eBot.v0 = vMid;   eBot.v1 = vMax;
+
+/* compute deltas for each edge:  vertex[v1] - vertex[v0] */
+     eMaj.dx = vMax->x - vMin->x;
+     eMaj.dy = vMax->y - vMin->y;
+     eTop.dx = vMid->x - vMin->x;
+     eTop.dy = vMid->y - vMin->y;
+     eBot.dx = vMax->x - vMid->x;
+     eBot.dy = vMax->y - vMid->y;
+
+
+/* compute oneOverArea */
+     {
+          float area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
+
+          /* Do backface culling
+           */
+          //if ( area * bf < 0 || area == 0 )
+          //return;
+
+          oneOverArea = 1.0F / area;
+     }
+
+/* Edge setup.  For a triangle strip these could be reused... */
+     {
+
+#define DELTASCALE 16 /* Scaling factor for idx and idy. Note that idx and
+                         idy are 18 bits signed, so don't choose too big
+                         value. */
+
+          int   ivMax_y;
+          float temp;
+
+          ivMax_y = CEIL(vMax->y);
+          eTop.sy = eMaj.sy = CEIL(vMin->y);
+          eBot.sy = CEIL(vMid->y);
+
+          eMaj.lines = ivMax_y - eMaj.sy;
+          if (eMaj.lines > 0) {
+               float dxdy = eMaj.dx / eMaj.dy;
+               eMaj.adjy = (float) eMaj.sy - vMin->y;
+               temp = vMin->x + eMaj.adjy*dxdy;
+               eMaj.sx = CEIL(temp);
+               eMaj.adjx = (float) eMaj.sx - vMin->x;
+               if (eMaj.lines == 1) {
+                    eMaj.idy = 1;
+                    eMaj.idx = 0;
+                    eMaj.err = 0;
+               }
+               else {
+                    eMaj.idy = RINT(eMaj.dy * DELTASCALE);
+                    eMaj.idx = FLOOR(eMaj.idy * dxdy);
+                    eMaj.err = RINT(((float) eMaj.sx - temp) * (float)eMaj.idy);
+               }
+          }
+          else {
+               return; /* CULLED */
+          }
+
+          Shape = 3;
+
+          eBot.lines = ivMax_y - eBot.sy;
+          if (eBot.lines > 0) {
+               float dxdy = eBot.dx / eBot.dy;
+               eBot.adjy = (float) eBot.sy - vMid->y;
+               temp = vMid->x + eBot.adjy*dxdy;
+               eBot.sx = CEIL(temp);
+               eBot.adjx = (float) eBot.sx - vMid->x;
+               if (eBot.lines == 1) {
+                    eBot.idy = 1;
+                    eBot.idx = 0;
+                    eBot.err = 0;
+               }
+               else {
+                    eBot.idy = RINT(eBot.dy * DELTASCALE);
+                    eBot.idx = FLOOR(eBot.idy * dxdy);
+                    eBot.err = RINT(((float) eBot.sx - temp) * (float)eBot.idy);
+               }
+          }
+          else {
+               Shape = 1;
+          }
+
+          eTop.lines = eBot.sy - eTop.sy;
+          if (eTop.lines > 0) {
+               float dxdy = eTop.dx / eTop.dy;
+               eTop.adjy = eMaj.adjy;
+               temp = vMin->x + eTop.adjy*dxdy;
+               eTop.sx = CEIL(temp);
+               eTop.adjx = (float) eTop.sx - vMin->x;
+               if (eTop.lines == 1) {
+                    eTop.idy = 1;
+                    if (eBot.lines > 0) {
+                         eTop.idx = eBot.sx - eTop.sx; /* needed for bottom half */
+                    }
+                    else {
+                         eTop.idx = 0;
+                    }
+                    eTop.err = 0;
+               }
+               else {
+                    eTop.idy = RINT(eTop.dy * DELTASCALE);
+                    eTop.idx = FLOOR(eTop.idy * dxdy);
+                    eTop.err = RINT(((float) eTop.sx - temp) * (float)eTop.idy);
+               }
+          }
+          else {
+               Shape = 2;
+          }
+     }
+
+     {
+          int ltor;        /* true if scanning left-to-right */
+          EdgeT *eLeft, *eRight;
+          int lines;
+          DFBVertex *vTL;      /* Top left vertex */
+          float adjx, adjy;
+
+          /*
+           * Execute user-supplied setup code
+           */
+#ifdef SETUP_CODE
+          SETUP_CODE
+#endif
+
+          ltor = (oneOverArea > 0.0F);
+
+          if (Shape == 2) {
+               /* bottom half triangle */
+               if (ltor) {
+                    eLeft = &eMaj;
+                    eRight = &eBot;
+               }
+               else {
+                    eLeft = &eBot;
+                    eRight = &eMaj;
+               }
+               lines = eBot.lines;
+          }
+          else {
+               /* top half triangle */
+               if (ltor) {
+                    eLeft = &eMaj;
+                    eRight = &eTop;
+               }
+               else {
+                    eLeft = &eTop;
+                    eRight = &eMaj;
+               }
+               lines = eTop.lines;
+          }
+
+          vTL = eLeft->v0;
+          adjx = eLeft->adjx; adjy = eLeft->adjy;
+
+
+          /* setup derivatives */
+/* compute d?/dx and d?/dy derivatives */
+          eBot.dxOOA = eBot.dx * oneOverArea;
+          eBot.dyOOA = eBot.dy * oneOverArea;
+          eMaj.dxOOA = eMaj.dx * oneOverArea;
+          eMaj.dyOOA = eMaj.dy * oneOverArea;
+
+#define DERIV( DZ, COMP) \
+  { \
+    float eMaj_DZ, eBot_DZ; \
+    eMaj_DZ = vMax->COMP - vMin->COMP; \
+    eBot_DZ = vMax->COMP - vMid->COMP; \
+    DZ ## dx = eMaj_DZ * eBot.dyOOA - eMaj.dyOOA * eBot_DZ;    \
+    DZ ## dy = eMaj.dxOOA * eBot_DZ - eMaj_DZ * eBot.dxOOA;    \
+  }
+
+          if (mdev->depth_buffer) {
+               float Zstart;
+               float dzdx, dzdy;
+
+               DERIV(dz, z);
+
+               if (dzdx>65535.0f*(1<<15) || dzdx<-65535.0f*(1<<15)) {
+                    /* probably a sliver triangle */
+                    dzdx = 0.0;
+                    dzdy = 0.0;
+               }
+
+               Zstart = vTL->z + dzdx*adjx + dzdy*adjy;
+
+               /* FIXME: 16 bit assumed */
+               if (Zstart > 65535.0f*(1 << 15)) {
+                    Zstart = 65535.0f*(1 << 15);
+                    dzdx = 0.0F;
+                    dzdy = 0.0F;
+               }
+
+               mga_waitfifo( mdrv, mdev, 3 );
+
+               mga_out32( mmio, RINT(Zstart), DR0 );
+               mga_out32( mmio, RINT(dzdx), DR2 );
+               mga_out32( mmio, RINT(dzdy), DR3 );
+          }
+
+          {
+               float dsdx, dsdy;
+               float dtdx, dtdy;
+               float dvdx, dvdy;
+
+               mga_waitfifo( mdrv, mdev, 9 );
+
+               DERIV(ds,s);
+
+               MGA_S(RINT( (vTL->s+dsdx*adjx+dsdy*adjy) ),
+                     RINT( dsdx ), RINT( dsdy ));
+
+               DERIV(dt,t);
+
+               MGA_T(RINT( (vTL->t+dtdx*adjx+dtdy*adjy) ),
+                     RINT( dtdx ), RINT( dtdy ));
+
+               DERIV(dv,w);
+               {
+                    int sq = RINT( (vTL->w+dvdx*adjx+dvdy*adjy) );
+                    MGA_Q((sq == 0) ? 1 : sq,RINT(dvdx),RINT(dvdy));
+               }
+          }
+
+          {
+               u32 sgn = 0;
+
+               mga_waitfifo( mdrv, mdev, 9 );
+
+               /* Draw part #1 */
+               if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG400) {
+                    MGA_G400_LSLOPE(eLeft->idx,eLeft->idy,sgn,eLeft->err);
+                    MGA_G400_RSLOPE(eRight->idx,eRight->idy,sgn,eRight->err);
+               }
+               else {
+                    MGA_LSLOPE(eLeft->idx,eLeft->idy,sgn,eLeft->err);
+                    MGA_RSLOPE(eRight->idx,eRight->idy,sgn,eRight->err);
+               }
+
+               mga_out32( mmio, sgn,                            SGN );
+               mga_out32( mmio, ((u32)(eLeft->sx) & 0xFFFF) | ((u32)(eRight->sx) << 16), FXBNDRY );
+               mga_out32( mmio, lines     | ((u32)(eLeft->sy)  << 16), YDSTLEN | EXECUTE );
+
+               if (Shape != 3) { /* has only one half? */
+                    return;
+               }
+
+               mga_waitfifo( mdrv, mdev, 6 );
+
+               /* Draw part #2 */
+               if (ltor) {
+                    if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG400)
+                         MGA_G400_RSLOPE(eBot.idx,eBot.idy,sgn,eBot.err);
+                    else
+                         MGA_RSLOPE(eBot.idx,eBot.idy,sgn,eBot.err);
+
+                    mga_out32( mmio, eBot.sx, FXRIGHT );
+               }
+               else {
+                    sgn |= SGN_BRKLEFT;
+                    mga_out32( mmio, eBot.sx, FXLEFT );
+                    if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG400)
+                         MGA_G400_LSLOPE(eBot.idx,eBot.idy,sgn,eBot.err);
+                    else
+                         MGA_LSLOPE(eBot.idx,eBot.idy,sgn,eBot.err);
+
+               }
+
+               mga_out32( mmio, sgn,        SGN );
+               mga_out32( mmio, eBot.lines, LEN | EXECUTE );
+          }
+     }
+}
+
+#define INVWMAX 128.0F
+
+bool
+matroxTextureTriangles( void *drv, void *dev,
+                        DFBVertex *vertices, int num,
+                        DFBTriangleFormation formation )
+{
+     int               i;
+     MatroxDriverData *mdrv = (MatroxDriverData*) drv;
+     MatroxDeviceData *mdev = (MatroxDeviceData*) dev;
+     volatile u8      *mmio = mdrv->mmio_base;
+     u32               dwgctl;
+
+     float wScale;
+
+#if 0
+     float InvWScale = 1.0f;
+     float nearVal   = 1.0f;
+
+     if (nearVal > 0) {
+          /* limit InvWScale/wMin in (0,INVWMAX] to avoid over- and underflow.
+             InvWScale is used by texture setup in mga_tritemp.h */
+          int exp2;
+
+          if (frexp(INVWMAX * nearVal,&exp2) != 0) {
+               if (exp2 >= 2) {
+                    InvWScale = 1 << (exp2-1);
+               }
+               else if (exp2 <= 0) {
+                    InvWScale = 1.0 / (1 << (-exp2+1));
+               }
+          }
+     }
+#else
+#define InvWScale 128.0f
+#endif
+
+     wScale = InvWScale * (float) (1 << 20);
+
+     for (i=0; i<num; i++) {
+          DFBVertex *v = &vertices[i];
+
+          v->x -= 0.5f;
+          v->y -= 0.5f;
+          v->z *= (float) (1 << 15) * 65535.0f;
+          v->w *= wScale;
+
+          v->s *= v->w * (float) mdev->w / (float) (1 << mdev->w2);
+          v->t *= v->w * (float) mdev->h / (float) (1 << mdev->h2);
+     }
+
+     if (mdev->depth_buffer)
+          dwgctl = ATYPE_ZI | ZMODE_ZLTE;
+     else
+          dwgctl = ATYPE_I  | ZMODE_NOZCMP;
+
+     mga_waitfifo( mdrv, mdev, 2 );
+
+     mga_out32( mmio, dwgctl | BOP_COPY | SHFTZERO | OP_TEXTURE_TRAP, DWGCTL );
+     mga_out32( mmio, (0x10<<21) | MAG_BILIN | MIN_ANISO | FILTER_ALPHA, TEXFILTER );
+
+     switch (formation) {
+          case DTTF_LIST:
+               for (i=0; i<num; i+=3)
+                    texture_triangle( mdrv, mdev, &vertices[i], &vertices[i+1], &vertices[i+2] );
+
+               break;
+
+          case DTTF_STRIP:
+               texture_triangle( mdrv, mdev, &vertices[0], &vertices[1], &vertices[2] );
+
+               for (i=3; i<num; i++)
+                    texture_triangle( mdrv, mdev, &vertices[i-2], &vertices[i-1], &vertices[i] );
+
+               break;
+
+          case DTTF_FAN:
+               texture_triangle( mdrv, mdev, &vertices[0], &vertices[1], &vertices[2] );
+
+               for (i=3; i<num; i++)
+                    texture_triangle( mdrv, mdev, &vertices[0], &vertices[i-1], &vertices[i] );
+
+               break;
+
+          default:
+               D_ONCE( "unknown formation" );
+               return false;
+     }
+
+     mga_waitfifo( mdrv, mdev, 5 );
+     mga_out32( mmio, 0, TMR1 );
+     mga_out32( mmio, 0, TMR2 );
+     mga_out32( mmio, 0, TMR4 );
+     mga_out32( mmio, 0, TMR5 );
+     mga_out32( mmio, 0x100000, TMR8 );
+
+     return true;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_3d.h b/Source/DirectFB/gfxdrivers/matrox/matrox_3d.h
new file mode 100755
index 0000000..8a1181e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_3d.h
@@ -0,0 +1,36 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MATROX_3D_H__
+#define ___MATROX_3D_H__
+
+bool matroxTextureTriangles( void *drv, void *dev,
+                             DFBVertex *vertices, int num,
+                             DFBTriangleFormation formation );
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_bes.c b/Source/DirectFB/gfxdrivers/matrox/matrox_bes.c
new file mode 100755
index 0000000..df1d4ab
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_bes.c
@@ -0,0 +1,783 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/screen.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <misc/util.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+
+     /* Stored registers */
+     struct {
+          /* BES */
+          u32 besGLOBCTL;
+          u32 besA1ORG;
+          u32 besA2ORG;
+          u32 besA1CORG;
+          u32 besA2CORG;
+          u32 besA1C3ORG;
+          u32 besA2C3ORG;
+          u32 besCTL;
+
+          u32 besCTL_field;
+
+          u32 besHCOORD;
+          u32 besVCOORD;
+
+          u32 besHSRCST;
+          u32 besHSRCEND;
+          u32 besHSRCLST;
+
+          u32 besPITCH;
+
+          u32 besV1WGHT;
+          u32 besV2WGHT;
+
+          u32 besV1SRCLST;
+          u32 besV2SRCLST;
+
+          u32 besVISCAL;
+          u32 besHISCAL;
+
+          u8    xKEYOPMODE;
+     } regs;
+} MatroxBesLayerData;
+
+static bool bes_set_buffer( MatroxDriverData *mdrv, MatroxBesLayerData *mbes,
+                            bool onsync );
+static void bes_set_regs( MatroxDriverData *mdrv, MatroxBesLayerData *mbes );
+static void bes_calc_regs( MatroxDriverData *mdrv, MatroxBesLayerData *mbes,
+                           CoreLayerRegionConfig *config, CoreSurface *surface,
+                           CoreSurfaceBufferLock *lock );
+
+#define BES_SUPPORTED_OPTIONS   (DLOP_DEINTERLACING | DLOP_DST_COLORKEY)
+
+
+/**********************/
+
+static int
+besLayerDataSize( void )
+{
+     return sizeof(MatroxBesLayerData);
+}
+
+static DFBResult
+besInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     MatroxDriverData   *mdrv = (MatroxDriverData*) driver_data;
+     volatile u8        *mmio = mdrv->mmio_base;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SCREEN_LOCATION | DLCAPS_SURFACE |
+                         DLCAPS_DEINTERLACING | DLCAPS_DST_COLORKEY;
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Matrox Backend Scaler" );
+
+     /* 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;
+
+     adjustment->flags   = DCAF_NONE;
+
+     if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200) {
+          description->caps      |= DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST;
+
+          /* fill out default color adjustment,
+             only fields set in flags will be accepted from applications */
+          adjustment->flags      |= DCAF_BRIGHTNESS | DCAF_CONTRAST;
+          adjustment->brightness  = 0x8000;
+          adjustment->contrast    = 0x8000;
+
+          mga_out32( mmio, 0x80, BESLUMACTL );
+     }
+
+     /* make sure BES registers get updated (besvcnt) */
+     mga_out32( mmio, 0, BESGLOBCTL );
+     /* disable backend scaler */
+     mga_out32( mmio, 0, BESCTL );
+
+     /* set defaults */
+     mga_out_dac( mmio, XKEYOPMODE, 0x00 ); /* keying off */
+
+     mga_out_dac( mmio, XCOLMSK0RED,   0xFF ); /* full mask */
+     mga_out_dac( mmio, XCOLMSK0GREEN, 0xFF );
+     mga_out_dac( mmio, XCOLMSK0BLUE,  0xFF );
+
+     mga_out_dac( mmio, XCOLKEY0RED,   0x00 ); /* default to black */
+     mga_out_dac( mmio, XCOLKEY0GREEN, 0x00 );
+     mga_out_dac( mmio, XCOLKEY0BLUE,  0x00 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+besTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     MatroxDriverData           *mdrv       = (MatroxDriverData*) driver_data;
+     MatroxDeviceData           *mdev       = mdrv->device_data;
+     int                         max_width  = mdev->g450_matrox ? 2048 : 1024;
+     int                         max_height = 1024;
+     CoreLayerRegionConfigFlags  fail       = 0;
+
+     if (config->options & ~BES_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     if (config->surface_caps & ~(DSCAPS_INTERLACED | DSCAPS_SEPARATED))
+          fail |= CLRCF_SURFACE_CAPS;
+
+     if (config->options & DLOP_DEINTERLACING) {
+          /* make sure BESPITCH < 4096 */
+          if (mdev->g450_matrox && !(config->surface_caps & DSCAPS_SEPARATED))
+               max_width = 2048 - 128;
+          max_height = 2048;
+     } else {
+          if (config->surface_caps & DSCAPS_SEPARATED)
+               fail |= CLRCF_SURFACE_CAPS;
+     }
+
+     switch (config->format) {
+          case DSPF_YUY2:
+          case DSPF_NV12:
+          case DSPF_NV21:
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               if (!mdev->g450_matrox)
+                    max_width = 512;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               /* these formats are not supported by G200 */
+               if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200)
+                    break;
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     switch (config->format) {
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_NV12:
+          case DSPF_NV21:
+               if (config->height & 1)
+                    fail |= CLRCF_HEIGHT;
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (config->width & 1)
+                    fail |= CLRCF_WIDTH;
+          default:
+               break;
+     }
+
+     if (config->width > max_width || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height > max_height || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+besSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     MatroxDriverData   *mdrv = (MatroxDriverData*) driver_data;
+     MatroxBesLayerData *mbes = (MatroxBesLayerData*) layer_data;
+     volatile u8        *mmio = mdrv->mmio_base;
+
+     /* remember configuration */
+     mbes->config = *config;
+
+     /* set main configuration */
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT |
+                    CLRCF_OPTIONS | CLRCF_DEST | CLRCF_OPACITY | CLRCF_SOURCE))
+     {
+          bes_calc_regs( mdrv, mbes, config, surface, lock );
+          bes_set_regs( mdrv, mbes );
+     }
+
+     /* set color key */
+     if (updated & CLRCF_DSTKEY) {
+          DFBColorKey key = config->dst_key;
+
+          switch (dfb_primary_layer_pixelformat()) {
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+                    key.r >>= 3;
+                    key.g >>= 3;
+                    key.b >>= 3;
+                    break;
+
+               case DSPF_RGB16:
+                    key.r >>= 3;
+                    key.g >>= 2;
+                    key.b >>= 3;
+                    break;
+
+               default:
+                    ;
+          }
+
+          mga_out_dac( mmio, XCOLKEY0RED,   key.r );
+          mga_out_dac( mmio, XCOLKEY0GREEN, key.g );
+          mga_out_dac( mmio, XCOLKEY0BLUE,  key.b );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+besRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     MatroxDriverData   *mdrv = (MatroxDriverData*) driver_data;
+     volatile u8        *mmio = mdrv->mmio_base;
+
+     /* make sure BES registers get updated (besvcnt) */
+     mga_out32( mmio, 0, BESGLOBCTL );
+     /* disable backend scaler */
+     mga_out32( mmio, 0, BESCTL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+besFlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     MatroxDriverData   *mdrv = (MatroxDriverData*) driver_data;
+     MatroxBesLayerData *mbes = (MatroxBesLayerData*) layer_data;
+     bool                swap;
+
+     bes_calc_regs( mdrv, mbes, &mbes->config, surface, lock );
+     swap = bes_set_buffer( mdrv, mbes, flags & DSFLIP_ONSYNC );
+
+     dfb_surface_flip( surface, swap );
+
+     if (flags & DSFLIP_WAIT)
+          dfb_screen_wait_vsync( mdrv->primary );
+
+     return DFB_OK;
+}
+
+static DFBResult
+besSetColorAdjustment( CoreLayer          *layer,
+                       void               *driver_data,
+                       void               *layer_data,
+                       DFBColorAdjustment *adj )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) driver_data;
+     volatile u8      *mmio = mdrv->mmio_base;
+
+     if (mdrv->accelerator == FB_ACCEL_MATROX_MGAG200)
+          return DFB_UNSUPPORTED;
+
+     mga_out32( mmio, (adj->contrast >> 8) |
+                      ((u8)(((int)adj->brightness >> 8) - 128)) << 16,
+                BESLUMACTL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+besSetInputField( CoreLayer *layer,
+                  void      *driver_data,
+                  void      *layer_data,
+                  void      *region_data,
+                  int        field )
+{
+     MatroxDriverData   *mdrv = (MatroxDriverData*) driver_data;
+     MatroxBesLayerData *mbes = (MatroxBesLayerData*) layer_data;
+
+     mbes->regs.besCTL_field = field ? 0x2000000 : 0;
+
+     mga_out32( mdrv->mmio_base,
+                mbes->regs.besCTL | mbes->regs.besCTL_field, BESCTL );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs matroxBesFuncs = {
+     .LayerDataSize      = besLayerDataSize,
+     .InitLayer          = besInitLayer,
+
+     .TestRegion         = besTestRegion,
+     .SetRegion          = besSetRegion,
+     .RemoveRegion       = besRemoveRegion,
+     .FlipRegion         = besFlipRegion,
+
+     .SetColorAdjustment = besSetColorAdjustment,
+     .SetInputField      = besSetInputField,
+};
+
+
+/* internal */
+
+static void bes_set_regs( MatroxDriverData *mdrv, MatroxBesLayerData *mbes )
+{
+     int            line = 0;
+     volatile u8   *mmio = mdrv->mmio_base;
+     VideoMode     *mode = dfb_system_current_mode();
+
+     if (!mode) {
+          mode = dfb_system_modes();
+          if (!mode)
+               return;
+     }
+
+     /* prevent updates */
+     line = 0xfff;
+     mga_out32( mmio, mbes->regs.besGLOBCTL | (line << 16), BESGLOBCTL);
+
+     if (!(mbes->regs.besCTL & 0x4000000)) {
+          mga_out32( mmio, mbes->regs.besA1ORG, BESA1ORG );
+          mga_out32( mmio, mbes->regs.besA2ORG, BESA2ORG );
+          mga_out32( mmio, mbes->regs.besA1CORG, BESA1CORG );
+          mga_out32( mmio, mbes->regs.besA2CORG, BESA2CORG );
+
+          if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200) {
+               mga_out32( mmio, mbes->regs.besA1C3ORG, BESA1C3ORG );
+               mga_out32( mmio, mbes->regs.besA2C3ORG, BESA2C3ORG );
+          }
+     } else {
+          mga_out32( mmio, mbes->regs.besA1ORG, BESB1ORG );
+          mga_out32( mmio, mbes->regs.besA2ORG, BESB2ORG );
+          mga_out32( mmio, mbes->regs.besA1CORG, BESB1CORG );
+          mga_out32( mmio, mbes->regs.besA2CORG, BESB2CORG );
+
+          if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200) {
+               mga_out32( mmio, mbes->regs.besA1C3ORG, BESB1C3ORG );
+               mga_out32( mmio, mbes->regs.besA2C3ORG, BESB2C3ORG );
+          }
+     }
+
+     mga_out32( mmio, mbes->regs.besCTL | mbes->regs.besCTL_field, BESCTL );
+
+     mga_out32( mmio, mbes->regs.besHCOORD, BESHCOORD );
+     mga_out32( mmio, mbes->regs.besVCOORD, BESVCOORD );
+
+     mga_out32( mmio, mbes->regs.besHSRCST, BESHSRCST );
+     mga_out32( mmio, mbes->regs.besHSRCEND, BESHSRCEND );
+     mga_out32( mmio, mbes->regs.besHSRCLST, BESHSRCLST );
+
+     mga_out32( mmio, mbes->regs.besPITCH, BESPITCH );
+
+     mga_out32( mmio, mbes->regs.besV1WGHT, BESV1WGHT );
+     mga_out32( mmio, mbes->regs.besV2WGHT, BESV2WGHT );
+
+     mga_out32( mmio, mbes->regs.besV1SRCLST, BESV1SRCLST );
+     mga_out32( mmio, mbes->regs.besV2SRCLST, BESV2SRCLST );
+
+     mga_out32( mmio, mbes->regs.besVISCAL, BESVISCAL );
+     mga_out32( mmio, mbes->regs.besHISCAL, BESHISCAL );
+
+     /* allow updates again */
+     line = mode->yres;
+     mga_out32( mmio, mbes->regs.besGLOBCTL | (line << 16), BESGLOBCTL);
+
+     mga_out_dac( mmio, XKEYOPMODE, mbes->regs.xKEYOPMODE );
+}
+
+static bool bes_set_buffer( MatroxDriverData *mdrv, MatroxBesLayerData *mbes, bool onsync )
+{
+     bool           ret;
+     u32            status;
+     int            line;
+     volatile u8   *mmio = mdrv->mmio_base;
+     VideoMode     *mode = dfb_system_current_mode();
+
+     if (!mode) {
+          mode = dfb_system_modes();
+          if (!mode)
+               return false;
+     }
+
+     /* prevent updates */
+     line = 0xfff;
+     mga_out32( mmio, mbes->regs.besGLOBCTL | (line << 16), BESGLOBCTL);
+
+     status = mga_in32( mmio, BESSTATUS );
+
+     /* Had the previous flip actually occured? */
+     ret = !(status & 0x2) != !(mbes->regs.besCTL & 0x4000000);
+
+     /*
+      * Pick the next buffer based on what's being displayed right now
+      * so that it's possible to detect if the flip actually occured
+      * regardless of how many times the buffers are flipped during one
+      * displayed frame.
+      */
+     if (status & 0x2) {
+          mga_out32( mmio, mbes->regs.besA1ORG, BESA1ORG );
+          mga_out32( mmio, mbes->regs.besA2ORG, BESA2ORG );
+          mga_out32( mmio, mbes->regs.besA1CORG, BESA1CORG );
+          mga_out32( mmio, mbes->regs.besA2CORG, BESA2CORG );
+
+          if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200) {
+               mga_out32( mmio, mbes->regs.besA1C3ORG, BESA1C3ORG );
+               mga_out32( mmio, mbes->regs.besA2C3ORG, BESA2C3ORG );
+          }
+
+          mbes->regs.besCTL &= ~0x4000000;
+     } else {
+          mga_out32( mmio, mbes->regs.besA1ORG, BESB1ORG );
+          mga_out32( mmio, mbes->regs.besA2ORG, BESB2ORG );
+          mga_out32( mmio, mbes->regs.besA1CORG, BESB1CORG );
+          mga_out32( mmio, mbes->regs.besA2CORG, BESB2CORG );
+
+          if (mdrv->accelerator != FB_ACCEL_MATROX_MGAG200) {
+               mga_out32( mmio, mbes->regs.besA1C3ORG, BESB1C3ORG );
+               mga_out32( mmio, mbes->regs.besA2C3ORG, BESB2C3ORG );
+          }
+
+          mbes->regs.besCTL |= 0x4000000;
+     }
+
+     mga_out32( mmio, mbes->regs.besCTL | mbes->regs.besCTL_field, BESCTL );
+
+     /* allow updates again */
+     if (onsync)
+          line = mode->yres;
+     else
+          line = mga_in32( mmio, MGAREG_VCOUNT ) + 48;
+     mga_out32( mmio, mbes->regs.besGLOBCTL | (line << 16), BESGLOBCTL);
+
+     return ret;
+}
+
+static void bes_calc_regs( MatroxDriverData      *mdrv,
+                           MatroxBesLayerData    *mbes,
+                           CoreLayerRegionConfig *config,
+                           CoreSurface           *surface,
+                           CoreSurfaceBufferLock *lock )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     int cropleft, cropright, croptop, cropbot, croptop_uv;
+     int pitch, tmp, hzoom, intrep, field_height, field_offset;
+     DFBRectangle   source, dest;
+     DFBRegion      dst;
+     bool           visible;
+     VideoMode     *mode   = dfb_system_current_mode();
+
+     if (!mode) {
+          mode = dfb_system_modes();
+          if (!mode) {
+               D_BUG( "No current and no default mode" );
+               return;
+          }
+     }
+
+     source = config->source;
+     dest   = config->dest;
+
+     if (!mdev->g450_matrox && (surface->config.format == DSPF_RGB32 || surface->config.format == DSPF_ARGB))
+          dest.w = source.w;
+
+     pitch = lock->pitch;
+
+     field_height = surface->config.size.h;
+
+     if (config->options & DLOP_DEINTERLACING) {
+          field_height /= 2;
+          source.y /= 2;
+          source.h /= 2;
+          if (!(surface->config.caps & DSCAPS_SEPARATED))
+               pitch *= 2;
+     } else
+          mbes->regs.besCTL_field = 0;
+
+     /* destination region */
+     dst.x1 = dest.x;
+     dst.y1 = dest.y;
+     dst.x2 = dest.x + dest.w - 1;
+     dst.y2 = dest.y + dest.h - 1;
+
+     visible = dfb_region_intersect( &dst, 0, 0, mode->xres - 1, mode->yres - 1 );
+
+     /* calculate destination cropping */
+     cropleft  = -dest.x;
+     croptop   = -dest.y;
+     cropright = dest.x + dest.w - mode->xres;
+     cropbot   = dest.y + dest.h - mode->yres;
+
+     cropleft   = cropleft > 0 ? cropleft : 0;
+     croptop    = croptop > 0 ? croptop : 0;
+     cropright  = cropright > 0 ? cropright : 0;
+     cropbot    = cropbot > 0 ? cropbot : 0;
+     croptop_uv = croptop;
+
+     /* scale crop values to source dimensions */
+     if (cropleft)
+          cropleft = ((u64) (source.w << 16) * cropleft / dest.w) & ~0x3;
+     if (croptop)
+          croptop = ((u64) (source.h << 16) * croptop / dest.h) & ~0x3;
+     if (cropright)
+          cropright = ((u64) (source.w << 16) * cropright / dest.w) & ~0x3;
+     if (cropbot)
+          cropbot = ((u64) (source.h << 16) * cropbot / dest.h) & ~0x3;
+     if (croptop_uv)
+          croptop_uv = ((u64) ((source.h/2) << 16) * croptop_uv / dest.h) & ~0x3;
+
+     /* should horizontal zoom be used? */
+     if (mdev->g450_matrox)
+          hzoom = (1000000/mode->pixclock >= 234) ? 1 : 0;
+     else
+          hzoom = (1000000/mode->pixclock >= 135) ? 1 : 0;
+
+     /* initialize */
+     mbes->regs.besGLOBCTL = 0;
+
+     /* preserve buffer */
+     mbes->regs.besCTL &= 0x4000000;
+
+     /* enable/disable depending on opacity */
+     if (config->opacity && visible)
+          mbes->regs.besCTL |= BESEN;
+
+     /* pixel format settings */
+     switch (surface->config.format) {
+          case DSPF_YV12:
+               mbes->regs.besGLOBCTL |= BESCORDER;
+               /* fall through */
+
+          case DSPF_I420:
+               mbes->regs.besGLOBCTL |= BESPROCAMP | BES3PLANE;
+               mbes->regs.besCTL     |= BESHFEN | BESVFEN | BESCUPS | BES420PL;
+               break;
+
+          case DSPF_NV21:
+               mbes->regs.besGLOBCTL |= BESCORDER;
+               /* fall through */
+
+          case DSPF_NV12:
+               mbes->regs.besGLOBCTL |= BESPROCAMP;
+               mbes->regs.besCTL     |= BESHFEN | BESVFEN | BESCUPS | BES420PL;
+               break;
+
+          case DSPF_UYVY:
+               mbes->regs.besGLOBCTL |= BESUYVYFMT;
+               /* fall through */
+
+          case DSPF_YUY2:
+               mbes->regs.besGLOBCTL |= BESPROCAMP;
+               mbes->regs.besCTL     |= BESHFEN | BESVFEN | BESCUPS;
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mbes->regs.besGLOBCTL |= BESRGB15;
+               break;
+
+          case DSPF_RGB16:
+               mbes->regs.besGLOBCTL |= BESRGB16;
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               mbes->regs.besGLOBCTL |= BESRGB32;
+               break;
+
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (surface->config.size.w > 1024)
+          mbes->regs.besCTL &= ~BESVFEN;
+
+     mbes->regs.besGLOBCTL |= 3*hzoom;
+
+     mbes->regs.besPITCH = pitch / DFB_BYTES_PER_PIXEL(surface->config.format);
+
+     /* buffer offsets */
+
+     field_offset = lock->pitch;
+     if (surface->config.caps & DSCAPS_SEPARATED)
+          field_offset *= surface->config.size.h / 2;
+
+     mbes->regs.besA1ORG = lock->offset +
+                           pitch * (source.y + (croptop >> 16));
+     mbes->regs.besA2ORG = mbes->regs.besA1ORG +
+                           field_offset;
+
+     switch (surface->config.format) {
+          case DSPF_NV12:
+          case DSPF_NV21:
+               field_offset = lock->pitch;
+               if (surface->config.caps & DSCAPS_SEPARATED)
+                    field_offset *= surface->config.size.h / 4;
+
+               mbes->regs.besA1CORG  = lock->offset +
+                                       surface->config.size.h * lock->pitch +
+                                       pitch * (source.y/2 + (croptop_uv >> 16));
+               mbes->regs.besA2CORG  = mbes->regs.besA1CORG +
+                                       field_offset;
+               break;
+
+          case DSPF_I420:
+          case DSPF_YV12:
+               field_offset = lock->pitch / 2;
+               if (surface->config.caps & DSCAPS_SEPARATED)
+                    field_offset *= surface->config.size.h / 4;
+
+               mbes->regs.besA1CORG  = lock->offset +
+                                       surface->config.size.h * lock->pitch +
+                                       pitch/2 * (source.y/2 + (croptop_uv >> 16));
+               mbes->regs.besA2CORG  = mbes->regs.besA1CORG +
+                                       field_offset;
+
+               mbes->regs.besA1C3ORG = mbes->regs.besA1CORG +
+                                       surface->config.size.h/2 * lock->pitch/2;
+               mbes->regs.besA2C3ORG = mbes->regs.besA1C3ORG +
+                                       field_offset;
+               break;
+
+          default:
+               ;
+     }
+
+     mbes->regs.besHCOORD   = (dst.x1 << 16) | dst.x2;
+     mbes->regs.besVCOORD   = (dst.y1 << 16) | dst.y2;
+
+     mbes->regs.besHSRCST   = (source.x << 16) + cropleft;
+     mbes->regs.besHSRCEND  = ((source.x + source.w - 1) << 16) - cropright;
+     mbes->regs.besHSRCLST  = (surface->config.size.w - 1) << 16;
+
+     /* vertical starting weights */
+     tmp = croptop & 0xfffc;
+     mbes->regs.besV1WGHT = tmp;
+     if (tmp >= 0x8000) {
+          tmp = tmp - 0x8000;
+          /* fields start on the same line */
+          if ((source.y + (croptop >> 16)) & 1)
+               mbes->regs.besCTL |= BESV1SRCSTP | BESV2SRCSTP;
+     } else {
+          tmp = 0x10000 | (0x8000 - tmp);
+          /* fields start on alternate lines */
+          if ((source.y + (croptop >> 16)) & 1)
+               mbes->regs.besCTL |= BESV1SRCSTP;
+          else
+               mbes->regs.besCTL |= BESV2SRCSTP;
+     }
+     mbes->regs.besV2WGHT = tmp;
+
+     mbes->regs.besV1SRCLST = mbes->regs.besV2SRCLST =
+          field_height - 1 - source.y - (croptop >> 16);
+
+     /* horizontal scaling */
+     if (!mdev->g450_matrox && (surface->config.format == DSPF_RGB32 || surface->config.format == DSPF_ARGB)) {
+          mbes->regs.besHISCAL   = 0x20000 << hzoom;
+          mbes->regs.besHSRCST  *= 2;
+          mbes->regs.besHSRCEND *= 2;
+          mbes->regs.besHSRCLST *= 2;
+          mbes->regs.besPITCH   *= 2;
+     } else {
+          intrep = ((mbes->regs.besCTL & BESHFEN) || (source.w > dest.w)) ? 1 : 0;
+          if ((dest.w == source.w) || (dest.w < 2))
+               intrep = 0;
+          tmp = (((source.w - intrep) << 16) / (dest.w - intrep)) << hzoom;
+          if (tmp >= (32 << 16))
+               tmp = (32 << 16) - 1;
+          mbes->regs.besHISCAL = tmp & 0x001ffffc;
+     }
+
+     /* vertical scaling */
+     intrep = ((mbes->regs.besCTL & BESVFEN) || (source.h > dest.h)) ? 1 : 0;
+     if ((dest.h == source.h) || (dest.h < 2))
+          intrep = 0;
+     tmp = ((source.h - intrep) << 16) / (dest.h - intrep);
+     if(tmp >= (32 << 16))
+          tmp = (32 << 16) - 1;
+     mbes->regs.besVISCAL = tmp & 0x001ffffc;
+
+     /* enable color keying? */
+     mbes->regs.xKEYOPMODE = (config->options & DLOP_DST_COLORKEY) ? 1 : 0;
+}
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_crtc2.c b/Source/DirectFB/gfxdrivers/matrox/matrox_crtc2.c
new file mode 100755
index 0000000..36c83a3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_crtc2.c
@@ -0,0 +1,751 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/screen.h>
+#include <core/surface.h>
+
+#include <misc/conf.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+#include "matrox_maven.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+     DFBColorAdjustment    adj;
+     int                   field;
+
+     /* Stored registers */
+     struct {
+          /* CRTC2 */
+          u32 c2CTL;
+          u32 c2DATACTL;
+          u32 c2MISC;
+          u32 c2OFFSET;
+
+          u32 c2HPARAM;
+          u32 c2VPARAM;
+
+          u32 c2STARTADD0;
+          u32 c2STARTADD1;
+          u32 c2PL2STARTADD0;
+          u32 c2PL2STARTADD1;
+          u32 c2PL3STARTADD0;
+          u32 c2PL3STARTADD1;
+     } regs;
+
+     MatroxMavenData mav;
+} MatroxCrtc2LayerData;
+
+static void crtc2_set_regs           ( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2 );
+
+static void crtc2_calc_regs          ( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2,
+                                       CoreLayerRegionConfig *config,
+                                       CoreSurface           *surface,
+                                       CoreSurfaceBufferLock *lock );
+
+static void crtc2_calc_buffer        ( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2,
+                                       CoreSurface           *surface,
+                                       CoreSurfaceBufferLock *lock );
+
+static void crtc2_set_buffer         ( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2 );
+
+static DFBResult crtc2_disable_output( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2 );
+
+static DFBResult crtc2_enable_output ( MatroxDriverData      *mdrv,
+                                       MatroxCrtc2LayerData  *mcrtc2 );
+
+#define CRTC2_SUPPORTED_OPTIONS   (DLOP_FIELD_PARITY)
+
+/**********************/
+
+static int
+crtc2LayerDataSize( void )
+{
+     return sizeof(MatroxCrtc2LayerData);
+}
+
+static const DFBColorAdjustment adjustments[2][2] = {
+     /* G400 */
+     {
+          /* PAL / PAL-60 */
+          {
+               .flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_HUE | DCAF_SATURATION,
+               .brightness = 0xA800,
+               .saturation = 0x9500,
+               .contrast   = 0xFF00,
+               .hue        = 0x0000,
+          },
+          /* NTSC */
+          {
+               .flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_HUE | DCAF_SATURATION,
+               .brightness = 0xB500,
+               .saturation = 0x8E00,
+               .contrast   = 0xEA00,
+               .hue        = 0x0000,
+          }
+     },
+     /* G450 / G550 */
+     {
+          /* PAL / PAL-60 */
+          {
+               .flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_HUE | DCAF_SATURATION,
+               .brightness = 0x9E00,
+               .saturation = 0xBB00,
+               .contrast   = 0xFF00,
+               .hue        = 0x0000,
+          },
+          /* NTSC */
+          {
+               .flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_HUE | DCAF_SATURATION,
+               .brightness = 0xAA00,
+               .saturation = 0xAE00,
+               .contrast   = 0xEA00,
+               .hue        = 0x0000,
+          }
+     }
+};
+
+static DFBResult
+crtc2InitLayer( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                DFBDisplayLayerDescription *description,
+                DFBDisplayLayerConfig      *config,
+                DFBColorAdjustment         *adjustment )
+{
+     MatroxDriverData     *mdrv   = (MatroxDriverData*) driver_data;
+     MatroxCrtc2LayerData *mcrtc2 = (MatroxCrtc2LayerData*) layer_data;
+     MatroxDeviceData     *mdev   = mdrv->device_data;
+     MatroxMavenData      *mav    = &mcrtc2->mav;
+     DFBResult             res;
+
+     if ((res = maven_init( mav, mdrv )) != DFB_OK)
+          return res;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_FIELD_PARITY |
+                         DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST |
+                         DLCAPS_HUE | DLCAPS_SATURATION | DLCAPS_ALPHA_RAMP;
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Matrox CRTC2 Layer" );
+
+     /* fill out the default configuration */
+     config->flags        = DLCONF_WIDTH | DLCONF_HEIGHT |
+                            DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                            DLCONF_OPTIONS | DLCONF_SURFACE_CAPS;
+     config->width        = 720;
+     config->height       = (dfb_config->matrox_tv_std != DSETV_PAL) ? 480 : 576;
+     config->pixelformat  = DSPF_YUY2;
+     config->buffermode   = DLBM_FRONTONLY;
+     config->options      = DLOP_NONE;
+     config->surface_caps = DSCAPS_INTERLACED;
+
+     /* fill out default color adjustment,
+        only fields set in flags will be accepted from applications */
+     *adjustment = adjustments[mdev->g450_matrox][dfb_config->matrox_tv_std == DSETV_NTSC];
+
+     /* remember color adjustment */
+     mcrtc2->adj = *adjustment;
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2TestRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     if (config->options & ~CRTC2_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     if (config->surface_caps & ~(DSCAPS_INTERLACED | DSCAPS_SEPARATED))
+          fail |= CLRCF_SURFACE_CAPS;
+
+     switch (config->format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               break;
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     if (config->width != 720)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height != ((dfb_config->matrox_tv_std != DSETV_PAL) ? 480 : 576))
+          fail |= CLRCF_HEIGHT;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2AddRegion( CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2SetRegion( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                void                       *region_data,
+                CoreLayerRegionConfig      *config,
+                CoreLayerRegionConfigFlags  updated,
+                CoreSurface                *surface,
+                CorePalette                *palette,
+                CoreSurfaceBufferLock      *lock )
+{
+     DFBResult             ret;
+     MatroxDriverData     *mdrv   = (MatroxDriverData*) driver_data;
+     MatroxCrtc2LayerData *mcrtc2 = (MatroxCrtc2LayerData*) layer_data;
+     MatroxDeviceData     *mdev   = mdrv->device_data;
+
+     /* remember configuration */
+     mcrtc2->config = *config;
+
+     if (updated & CLRCF_PARITY)
+          mcrtc2->field = !config->parity;
+
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT |
+                    CLRCF_SURFACE_CAPS | CLRCF_ALPHA_RAMP | CLRCF_SURFACE)) {
+          crtc2_calc_regs( mdrv, mcrtc2, config, surface, lock );
+          crtc2_calc_buffer( mdrv, mcrtc2, surface, lock );
+
+          ret = crtc2_enable_output( mdrv, mcrtc2 );
+          if (ret)
+               return ret;
+
+          mdev->crtc2_separated = !!(surface->config.caps & DSCAPS_SEPARATED);
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2RemoveRegion( CoreLayer *layer,
+                   void      *driver_data,
+                   void      *layer_data,
+                   void      *region_data )
+{
+     MatroxDriverData     *mdrv   = (MatroxDriverData*) driver_data;
+     MatroxCrtc2LayerData *mcrtc2 = (MatroxCrtc2LayerData*) layer_data;
+
+     crtc2_disable_output( mdrv, mcrtc2 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2FlipRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreSurface           *surface,
+                 DFBSurfaceFlipFlags    flags,
+                 CoreSurfaceBufferLock *lock )
+{
+     MatroxDriverData     *mdrv    = (MatroxDriverData*) driver_data;
+     MatroxCrtc2LayerData *mcrtc2  = (MatroxCrtc2LayerData*) layer_data;
+     volatile u8          *mmio    = mdrv->mmio_base;
+
+     crtc2_calc_buffer( mdrv, mcrtc2, surface, lock );
+
+     if (mcrtc2->config.options & DLOP_FIELD_PARITY) {
+          int field = (mga_in32( mmio, C2VCOUNT ) & C2FIELD) ? 1 : 0;
+
+          while (field == mcrtc2->field) {
+               dfb_screen_wait_vsync( mdrv->secondary );
+
+               field = (mga_in32( mmio, C2VCOUNT ) & C2FIELD) ? 1 : 0;
+          }
+     }
+     crtc2_set_buffer( mdrv, mcrtc2 );
+
+     dfb_surface_flip( surface, false );
+
+     if (flags & DSFLIP_WAIT)
+          dfb_screen_wait_vsync( mdrv->secondary );
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2SetColorAdjustment( CoreLayer          *layer,
+                         void               *driver_data,
+                         void               *layer_data,
+                         DFBColorAdjustment *adj )
+{
+     MatroxDriverData     *mdrv   = (MatroxDriverData*) driver_data;
+     MatroxCrtc2LayerData *mcrtc2 = (MatroxCrtc2LayerData*) layer_data;
+     MatroxMavenData      *mav    = &mcrtc2->mav;
+     DFBResult             res;
+
+     if ((res = maven_open( mav, mdrv )) != DFB_OK)
+          return res;
+
+     if (adj->flags & DCAF_HUE)
+          maven_set_hue( mav, mdrv,
+                         adj->hue >> 8 );
+     if (adj->flags & DCAF_SATURATION)
+          maven_set_saturation( mav, mdrv,
+                                adj->saturation >> 8 );
+     if (adj->flags & DCAF_BRIGHTNESS ||
+         adj->flags & DCAF_CONTRAST)
+          maven_set_bwlevel( mav, mdrv,
+                             adj->brightness >> 8,
+                             adj->contrast >> 8 );
+
+     maven_close( mav, mdrv );
+
+     /* remember color adjustment */
+     mcrtc2->adj = *adj;
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2GetCurrentOutputField( CoreLayer *layer,
+                            void      *driver_data,
+                            void      *layer_data,
+                            int       *field )
+{
+     MatroxDriverData *mdrv = (MatroxDriverData*) driver_data;
+
+     if (!field)
+          return DFB_INVARG;
+
+     *field = (mga_in32( mdrv->mmio_base, C2VCOUNT ) & C2FIELD) ? 1 : 0;
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs matroxCrtc2Funcs = {
+     .LayerDataSize         = crtc2LayerDataSize,
+     .InitLayer             = crtc2InitLayer,
+
+     .TestRegion            = crtc2TestRegion,
+     .AddRegion             = crtc2AddRegion,
+     .SetRegion             = crtc2SetRegion,
+     .RemoveRegion          = crtc2RemoveRegion,
+     .FlipRegion            = crtc2FlipRegion,
+
+     .SetColorAdjustment    = crtc2SetColorAdjustment,
+     .GetCurrentOutputField = crtc2GetCurrentOutputField,
+};
+
+/* internal */
+
+static void crtc2_set_regs( MatroxDriverData     *mdrv,
+                            MatroxCrtc2LayerData *mcrtc2 )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     mga_out32( mmio, mcrtc2->regs.c2CTL,     C2CTL );
+     mga_out32( mmio, mcrtc2->regs.c2DATACTL, C2DATACTL );
+     mga_out32( mmio, mcrtc2->regs.c2HPARAM,  C2HPARAM );
+     mga_out32( mmio, 0,                      C2HSYNC );
+     mga_out32( mmio, mcrtc2->regs.c2VPARAM,  C2VPARAM );
+     mga_out32( mmio, 0,                      C2VSYNC );
+     mga_out32( mmio, mcrtc2->regs.c2OFFSET,  C2OFFSET );
+     mga_out32( mmio, mcrtc2->regs.c2MISC,    C2MISC );
+     mga_out32( mmio, 0,                      C2PRELOAD );
+}
+
+static void crtc2_calc_regs( MatroxDriverData      *mdrv,
+                             MatroxCrtc2LayerData  *mcrtc2,
+                             CoreLayerRegionConfig *config,
+                             CoreSurface           *surface,
+                             CoreSurfaceBufferLock *lock )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     mcrtc2->regs.c2CTL = 0;
+
+     /* Don't touch sub-picture bits. */
+     mcrtc2->regs.c2DATACTL  = mga_in32( mdrv->mmio_base, C2DATACTL );
+     mcrtc2->regs.c2DATACTL &= C2STATICKEY | C2OFFSETDIVEN | C2STATICKEYEN | C2SUBPICEN;
+
+     if (mdev->g450_matrox)
+          mcrtc2->regs.c2CTL |= C2PIXCLKSEL_CRISTAL;
+     else
+          mcrtc2->regs.c2CTL |= C2PIXCLKSEL_VDOCLK;
+
+     /*
+      * High priority request level.
+      * According to G400 specs these values should
+      * be fixed when CRTC2 is in YUV mode.
+      */
+     /* c2hiprilvl */
+     mcrtc2->regs.c2CTL |= 2 << 4;
+     /* c2maxhipri */
+     mcrtc2->regs.c2CTL |= 1 << 8;
+
+     switch (surface->config.format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mcrtc2->regs.c2DATACTL |= C2DITHEN | C2YFILTEN | C2CBCRFILTEN;
+               break;
+          default:
+               break;
+     }
+
+     if (dfb_config->matrox_tv_std != DSETV_PAL)
+          mcrtc2->regs.c2DATACTL |= C2NTSCEN;
+
+     /* pixel format settings */
+     switch (surface->config.format) {
+          case DSPF_I420:
+          case DSPF_YV12:
+               mcrtc2->regs.c2CTL |= C2DEPTH_YCBCR420;
+               break;
+
+          case DSPF_UYVY:
+               mcrtc2->regs.c2DATACTL |= C2UYVYFMT;
+               /* fall through */
+
+          case DSPF_YUY2:
+               mcrtc2->regs.c2CTL |= C2DEPTH_YCBCR422;
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mcrtc2->regs.c2CTL |= C2DEPTH_15BPP;
+               break;
+
+          case DSPF_RGB16:
+               mcrtc2->regs.c2CTL |= C2DEPTH_16BPP;
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mcrtc2->regs.c2CTL |= C2DEPTH_32BPP;
+               break;
+
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (!(surface->config.caps & DSCAPS_INTERLACED))
+          mcrtc2->regs.c2CTL |= C2VCBCRSINGLE;
+
+     mcrtc2->regs.c2OFFSET = lock->pitch;
+     if (!(surface->config.caps & DSCAPS_SEPARATED))
+          mcrtc2->regs.c2OFFSET *= 2;
+
+     {
+          int hdisplay, htotal, vdisplay, vtotal;
+
+          if (dfb_config->matrox_tv_std != DSETV_PAL) {
+               hdisplay = 720;
+               htotal = 858;
+               vdisplay = 480 / 2;
+               vtotal = 525 / 2;
+          } else {
+               hdisplay = 720;
+               htotal = 864;
+               vdisplay = 576 / 2;
+               vtotal = 625 / 2;
+          }
+
+          mcrtc2->regs.c2HPARAM = ((hdisplay - 8) << 16) | (htotal - 8);
+          mcrtc2->regs.c2VPARAM = ((vdisplay - 1) << 16) | (vtotal - 1);
+
+          mcrtc2->regs.c2MISC = 0;
+          /* c2vlinecomp */
+          mcrtc2->regs.c2MISC |= (vdisplay + 1) << 16;
+     }
+
+     /* c2bpp15halpha */
+     mcrtc2->regs.c2DATACTL |= config->alpha_ramp[3] << 8;
+
+     /* c2bpp15lalpha */
+     mcrtc2->regs.c2DATACTL |= config->alpha_ramp[0] << 16;
+}
+
+static void crtc2_calc_buffer( MatroxDriverData      *mdrv,
+                               MatroxCrtc2LayerData  *mcrtc2,
+                               CoreSurface           *surface,
+                               CoreSurfaceBufferLock *lock )
+{
+     unsigned int field_offset = lock->pitch;
+
+     if (surface->config.caps & DSCAPS_SEPARATED)
+          field_offset *= surface->config.size.h / 2;
+
+     mcrtc2->regs.c2STARTADD1 = lock->offset;
+     mcrtc2->regs.c2STARTADD0 = mcrtc2->regs.c2STARTADD1 + field_offset;
+
+     if (surface->config.caps & DSCAPS_INTERLACED)
+          field_offset = lock->pitch / 2;
+     else
+          field_offset = 0;
+
+     if (surface->config.caps & DSCAPS_SEPARATED)
+          field_offset *= surface->config.size.h / 4;
+
+     switch (surface->config.format) {
+          case DSPF_I420:
+               mcrtc2->regs.c2PL2STARTADD1 = mcrtc2->regs.c2STARTADD1 + surface->config.size.h * lock->pitch;
+               mcrtc2->regs.c2PL2STARTADD0 = mcrtc2->regs.c2PL2STARTADD1 + field_offset;
+
+               mcrtc2->regs.c2PL3STARTADD1 = mcrtc2->regs.c2PL2STARTADD1 + surface->config.size.h/2 * lock->pitch/2;
+               mcrtc2->regs.c2PL3STARTADD0 = mcrtc2->regs.c2PL3STARTADD1 + field_offset;
+               break;
+          case DSPF_YV12:
+               mcrtc2->regs.c2PL3STARTADD1 = mcrtc2->regs.c2STARTADD1 + surface->config.size.h * lock->pitch;
+               mcrtc2->regs.c2PL3STARTADD0 = mcrtc2->regs.c2PL3STARTADD1 + field_offset;
+
+               mcrtc2->regs.c2PL2STARTADD1 = mcrtc2->regs.c2PL3STARTADD1 + surface->config.size.h/2 * lock->pitch/2;
+               mcrtc2->regs.c2PL2STARTADD0 = mcrtc2->regs.c2PL2STARTADD1 + field_offset;
+               break;
+          default:
+               break;
+     }
+}
+
+static void crtc2_set_buffer( MatroxDriverData     *mdrv,
+                              MatroxCrtc2LayerData *mcrtc2 )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     mga_out32( mmio, mcrtc2->regs.c2STARTADD0, C2STARTADD0 );
+     mga_out32( mmio, mcrtc2->regs.c2STARTADD1, C2STARTADD1 );
+     mga_out32( mmio, mcrtc2->regs.c2PL2STARTADD0, C2PL2STARTADD0 );
+     mga_out32( mmio, mcrtc2->regs.c2PL2STARTADD1, C2PL2STARTADD1 );
+     mga_out32( mmio, mcrtc2->regs.c2PL3STARTADD0, C2PL3STARTADD0 );
+     mga_out32( mmio, mcrtc2->regs.c2PL3STARTADD1, C2PL3STARTADD1 );
+}
+
+static void
+crtc2OnOff( MatroxDriverData     *mdrv,
+            MatroxCrtc2LayerData *mcrtc2,
+            int                   on )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     if (on)
+          mcrtc2->regs.c2CTL |= C2EN;
+     else
+          mcrtc2->regs.c2CTL &= ~C2EN;
+     mga_out32( mmio, mcrtc2->regs.c2CTL, C2CTL );
+
+     if (on)
+          mcrtc2->regs.c2CTL &= ~C2PIXCLKDIS;
+     else
+          mcrtc2->regs.c2CTL |= C2PIXCLKDIS;
+     mga_out32( mmio, mcrtc2->regs.c2CTL, C2CTL );
+
+     if (!on) {
+          mcrtc2->regs.c2CTL &= ~C2INTERLACE;
+          mga_out32( mmio, mcrtc2->regs.c2CTL, C2CTL );
+     }
+}
+
+static void crtc2_set_mafc( MatroxDriverData     *mdrv,
+                            int                   on )
+{
+     volatile u8   *mmio = mdrv->mmio_base;
+     u8             val;
+
+     val = mga_in_dac( mmio, XMISCCTRL );
+     if (on) {
+          val &= ~(MFCSEL_MASK | VDOUTSEL_MASK);
+          val |= MFCSEL_MAFC | VDOUTSEL_CRTC2656;
+     } else {
+          val &= ~MFCSEL_MASK;
+          val |= MFCSEL_DIS;
+     }
+     mga_out_dac( mmio, XMISCCTRL, val );
+}
+
+static DFBResult
+crtc2_disable_output( MatroxDriverData     *mdrv,
+                      MatroxCrtc2LayerData *mcrtc2 )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     MatroxMavenData  *mav  = &mcrtc2->mav;
+     DFBResult         res;
+
+     if ((res = maven_open( mav, mdrv )) != DFB_OK)
+          return res;
+
+     maven_disable( mav, mdrv );
+     if (!mdev->g450_matrox)
+          crtc2_set_mafc( mdrv, 0 );
+     crtc2OnOff( mdrv, mcrtc2, 0 );
+
+     maven_close( mav, mdrv );
+
+     if (mdev->g450_matrox) {
+          volatile u8   *mmio = mdrv->mmio_base;
+          u8             val;
+
+          /* Set Rset to 0.7 V */
+          val = mga_in_dac( mmio, XGENIOCTRL );
+          val &= ~0x40;
+          mga_out_dac( mmio, XGENIOCTRL, val );
+          val = mga_in_dac( mmio, XGENIODATA );
+          val &= ~0x40;
+          mga_out_dac( mmio, XGENIODATA, val );
+
+          val = mga_in_dac( mmio, XPWRCTRL );
+          val &= ~(DAC2PDN | CFIFOPDN);
+          mga_out_dac( mmio, XPWRCTRL, val );
+
+          val = mga_in_dac( mmio, XDISPCTRL );
+          val &= ~DAC2OUTSEL_MASK;
+          val |= DAC2OUTSEL_DIS;
+          mga_out_dac( mmio, XDISPCTRL, val );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2_enable_output( MatroxDriverData      *mdrv,
+                     MatroxCrtc2LayerData  *mcrtc2 )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     MatroxMavenData  *mav  = &mcrtc2->mav;
+     volatile u8      *mmio = mdrv->mmio_base;
+     DFBResult         res;
+
+     if ((res = maven_open( mav, mdrv )) != DFB_OK)
+          return res;
+
+     if (mdev->g450_matrox) {
+          volatile u8   *mmio = mdrv->mmio_base;
+          u8             val;
+
+          /* Set Rset to 1.0 V */
+          val = mga_in_dac( mmio, XGENIOCTRL );
+          val |= 0x40;
+          mga_out_dac( mmio, XGENIOCTRL, val );
+          val = mga_in_dac( mmio, XGENIODATA );
+          val &= ~0x40;
+          mga_out_dac( mmio, XGENIODATA, val );
+
+          val = mga_in_dac( mmio, XPWRCTRL );
+          val |= DAC2PDN | CFIFOPDN;
+          mga_out_dac( mmio, XPWRCTRL, val );
+
+          val = mga_in_dac( mmio, XDISPCTRL );
+          val &= ~DAC2OUTSEL_MASK;
+          val |= DAC2OUTSEL_TVE;
+          mga_out_dac( mmio, XDISPCTRL, val );
+
+          if (dfb_config->matrox_cable == 1) {
+               val = mga_in_dac( mmio, XSYNCCTRL );
+               val &= ~(DAC2HSOFF | DAC2VSOFF | DAC2HSPOL | DAC2VSPOL);
+               mga_out_dac( mmio, XSYNCCTRL, val );
+          }
+     }
+
+     maven_disable( mav, mdrv );
+     if (!mdev->g450_matrox)
+          crtc2_set_mafc( mdrv, 0 );
+     crtc2OnOff( mdrv, mcrtc2, 0 );
+
+     crtc2_set_regs( mdrv, mcrtc2 );
+     crtc2_set_buffer( mdrv, mcrtc2 );
+
+     if (!mdev->g450_matrox)
+          crtc2_set_mafc( mdrv, 1 );
+     crtc2OnOff( mdrv, mcrtc2, 1 );
+
+     maven_set_regs( mav, mdrv, &mcrtc2->config, &mcrtc2->adj );
+
+     mcrtc2->regs.c2CTL |= C2INTERLACE;
+     if (mdev->g450_matrox)
+          mcrtc2->regs.c2CTL |= 0x1000; /* Undocumented bit */
+     while ((mga_in32( mmio, C2VCOUNT ) & 0x00000FFF) != 1)
+          ;
+     while ((mga_in32( mmio, C2VCOUNT ) & 0x00000FFF) != 0)
+          ;
+     mga_out32( mmio, mcrtc2->regs.c2CTL, C2CTL );
+
+     maven_enable( mav, mdrv );
+
+     if (!mdev->g450_matrox) {
+          while ((mga_in32( mmio, C2VCOUNT ) & 0x00000FFF) != 1)
+               ;
+          while ((mga_in32( mmio, C2VCOUNT ) & 0x00000FFF) != 0)
+               ;
+          maven_sync( mav, mdrv );
+     }
+
+     maven_close( mav, mdrv );
+
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_maven.c b/Source/DirectFB/gfxdrivers/matrox/matrox_maven.c
new file mode 100755
index 0000000..e263864
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_maven.c
@@ -0,0 +1,785 @@
+/*
+   (c) 1998-2001 Petr Vandrovec <vandrove@vc.cvut.cz>
+
+   This code originally comes from matroxfb.
+   Relicensed under the LGPL with the authors permission.
+   Adapted for CRTC2 ITU-R 656 mode by Ville Syrjala <syrjala@sci.fi>
+
+   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 <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <dirent.h>
+
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+
+#include <directfb.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+
+#include "matrox.h"
+#include "regs.h"
+#include "mmio.h"
+#include "matrox_maven.h"
+
+#define SYS_CLASS_I2C_DEV "/sys/class/i2c-dev"
+
+static void
+maven_write_byte( MatroxMavenData  *mav,
+                  MatroxDriverData *mdrv,
+                  u8                reg,
+                  u8                val )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     if (mdev->g450_matrox) {
+          volatile u8 *mmio = mdrv->mmio_base;
+
+          mga_out_dac( mmio, 0x87, reg );
+          mga_out_dac( mmio, 0x88, val );
+     } else {
+          union  i2c_smbus_data       data;
+          struct i2c_smbus_ioctl_data args;
+
+          data.byte = val;
+
+          args.read_write = I2C_SMBUS_WRITE;
+          args.command    = reg;
+          args.size       = I2C_SMBUS_BYTE_DATA;
+          args.data       = &data;
+
+          ioctl( mdrv->maven_fd, I2C_SMBUS, &args );
+     }
+}
+
+static void
+maven_write_word( MatroxMavenData  *mav,
+                  MatroxDriverData *mdrv,
+                  u8                reg,
+                  u16               val )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     if (mdev->g450_matrox) {
+          volatile u8 *mmio = mdrv->mmio_base;
+
+          mga_out_dac( mmio, 0x87, reg );
+          mga_out_dac( mmio, 0x88, val );
+          mga_out_dac( mmio, 0x87, reg + 1 );
+          mga_out_dac( mmio, 0x88, val >> 8 );
+     } else {
+          union  i2c_smbus_data       data;
+          struct i2c_smbus_ioctl_data args;
+
+          data.word = val;
+
+          args.read_write = I2C_SMBUS_WRITE;
+          args.command    = reg;
+          args.size       = I2C_SMBUS_WORD_DATA;
+          args.data       = &data;
+
+          ioctl( mdrv->maven_fd, I2C_SMBUS, &args );
+     }
+}
+
+#if 0
+/* i2c_smbus_read_byte_data() doesn't work with maven. */
+static int
+i2c_read_byte( int fd, u8 addr, u8 reg )
+{
+     int ret;
+     u8 val;
+     struct i2c_msg msgs[] = {
+          { addr, I2C_M_REV_DIR_ADDR, sizeof(reg), ® },
+          { addr, I2C_M_RD | I2C_M_NOSTART, sizeof(val), &val }
+     };
+     struct i2c_rdwr_ioctl_data data = {
+          msgs, 2
+     };
+
+     ret = ioctl( fd, I2C_RDWR, &data );
+     if (ret < 0)
+          return ret;
+
+     return val;
+}
+#endif
+
+void
+maven_disable( MatroxMavenData  *mav,
+               MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     maven_write_byte( mav, mdrv, 0x3E, 0x01 );
+
+     if (mdev->g450_matrox) {
+          maven_write_byte( mav, mdrv, 0x80, 0x00 );
+          return;
+     }
+
+     maven_write_byte( mav, mdrv, 0x82, 0x80 );
+     maven_write_byte( mav, mdrv, 0x8C, 0x00 );
+     maven_write_byte( mav, mdrv, 0x94, 0xA2 );
+     maven_write_word( mav, mdrv, 0x8E, 0x1EFF );
+     maven_write_byte( mav, mdrv, 0xC6, 0x01 );
+}
+
+void
+maven_enable( MatroxMavenData  *mav,
+              MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     bool              ntsc = dfb_config->matrox_tv_std != DSETV_PAL;
+
+     if (mdev->g450_matrox) {
+          if (dfb_config->matrox_cable == 1)
+               /* SCART RGB */
+               maven_write_byte( mav, mdrv, 0x80, ntsc ? 0x43 : 0x41 );
+          else
+               /* Composite / S-Video */
+               maven_write_byte( mav, mdrv, 0x80, ntsc ? 0x03 : 0x01 );
+     }
+     else
+          maven_write_byte( mav, mdrv, 0x82, 0x20 );
+
+     maven_write_byte( mav, mdrv, 0x3E, 0x00 );
+}
+
+void
+maven_sync( MatroxMavenData  *mav,
+            MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     if (mdev->g450_matrox)
+          return;
+
+     maven_write_byte( mav, mdrv, 0xD4, 0x01 );
+     maven_write_byte( mav, mdrv, 0xD4, 0x00 );
+}
+
+#define LR(x)  maven_write_byte( mav, mdrv, (x), mav->regs[(x)] )
+#define LRP(x) maven_write_word( mav, mdrv, (x), mav->regs[(x)] | (mav->regs[(x)+1] << 8) )
+
+void
+maven_set_regs( MatroxMavenData       *mav,
+                MatroxDriverData      *mdrv,
+                CoreLayerRegionConfig *config,
+                DFBColorAdjustment    *adj )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     bool              ntsc = dfb_config->matrox_tv_std != DSETV_PAL;
+
+     LR(0x00);
+     LR(0x01);
+     LR(0x02);
+     LR(0x03);
+     LR(0x04);
+     LR(0x2C);
+     LR(0x08);
+     LR(0x0A);
+     LR(0x09);
+     LR(0x29);
+     LRP(0x31);
+     LRP(0x17);
+     LR(0x0B);
+     LR(0x0C);
+     LR(0x35);
+     LRP(0x10);
+     LRP(0x0E);
+     LRP(0x1E);
+     LR(0x20);
+     LR(0x22);
+     LR(0x25);
+     LR(0x34);
+
+     LR(0x33);
+     LR(0x19);
+     LR(0x12);
+     LR(0x3B);
+     LR(0x13);
+     LR(0x39);
+     LR(0x1D);
+     LR(0x3A);
+     LR(0x24);
+     LR(0x14);
+     LR(0x15);
+     LR(0x16);
+     LRP(0x2D);
+     LRP(0x2F);
+     LR(0x1A);
+     LR(0x1B);
+     LR(0x1C);
+     LR(0x23);
+     LR(0x26);
+     LR(0x28);
+     LR(0x27);
+     LR(0x21);
+     LRP(0x2A);
+     LR(0x35);
+     LRP(0x3C);
+     LR(0x37);
+     LR(0x38);
+
+     if (mdev->g450_matrox) {
+          maven_write_word( mav, mdrv, 0x82, ntsc ? 0x0014 : 0x0017 );
+          maven_write_word( mav, mdrv, 0x84, 0x0001 );
+     } else {
+          maven_write_byte( mav, mdrv, 0xB3, 0x01 );
+          maven_write_byte( mav, mdrv, 0x82, 0xA0 );
+          maven_write_byte( mav, mdrv, 0xD3, 0x01 );
+          maven_write_byte( mav, mdrv, 0x8C, 0x10 );
+          maven_write_byte( mav, mdrv, 0x94, 0xA2 );
+          maven_write_byte( mav, mdrv, 0x8D, 0x03 );
+          maven_write_byte( mav, mdrv, 0xB9, 0x78 );
+          maven_write_byte( mav, mdrv, 0xBF, 0x02 );
+
+          /*
+           * Deflicker: 0x00, 0xB1, 0xA2
+           * Doesn't work due to:
+           * - ITU-R BT.656 mode?
+           * - scaler is not used?
+           * - something else?
+           */
+          maven_write_byte( mav, mdrv, 0x93, 0x00 );
+     }
+
+     maven_set_saturation( mav, mdrv, adj->saturation >> 8 );
+     maven_set_hue( mav, mdrv, adj->hue >> 8 );
+     maven_set_bwlevel( mav, mdrv, adj->brightness >> 8,
+                        adj->contrast >> 8 );
+
+     if (!mdev->g450_matrox) {
+          LR(0x83);
+          LR(0x84);
+          LR(0x85);
+          LR(0x86);
+          LR(0x87);
+          LR(0x88);
+          LR(0x89);
+          LR(0x8A);
+          LR(0x8B);
+
+          switch (dfb_config->matrox_cable) {
+               case 1:
+                    /* SCART RGB */
+                    maven_write_byte( mav, mdrv, 0xB0, 0x85 );
+                    break;
+               case 2:
+                    /* SCART Composite */
+                    maven_write_byte( mav, mdrv, 0xB0, 0x81 );
+                    break;
+               default:
+                    /* Composite / S-Video */
+                    maven_write_byte( mav, mdrv, 0xB0, 0x80 );
+                    break;
+          }
+     }
+}
+
+void
+maven_set_hue( MatroxMavenData  *mav,
+               MatroxDriverData *mdrv,
+               u8                hue )
+{
+     maven_write_byte( mav, mdrv, 0x25, hue );
+}
+
+void
+maven_set_saturation( MatroxMavenData  *mav,
+                      MatroxDriverData *mdrv,
+                      u8                saturation )
+{
+     maven_write_byte( mav, mdrv, 0x20, saturation );
+     maven_write_byte( mav, mdrv, 0x22, saturation );
+}
+
+void
+maven_set_bwlevel( MatroxMavenData  *mav,
+                   MatroxDriverData *mdrv,
+                   u8                brightness,
+                   u8                contrast )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     int b, c, bl, wl, wlmax, blmin, range;
+     bool ntsc = dfb_config->matrox_tv_std == DSETV_NTSC;
+
+     if (mdev->g450_matrox) {
+          wlmax = ntsc ? 936 : 938;
+          blmin = ntsc ? 267 : 281;
+     } else {
+          wlmax = 786;
+          blmin = ntsc ? 242 : 255;
+     }
+     range = wlmax - blmin - 128;
+
+     b = brightness * range / 255 + blmin;
+     c = contrast * range / 2 / 255 + 64;
+
+     bl = MAX( b - c, blmin );
+     wl = MIN( b + c, wlmax );
+
+     blmin = ((blmin << 8) & 0x0300) | ((blmin >> 2) & 0x00FF);
+     bl    = ((bl    << 8) & 0x0300) | ((bl    >> 2) & 0x00FF);
+     wl    = ((wl    << 8) & 0x0300) | ((wl    >> 2) & 0x00FF);
+
+     maven_write_word( mav, mdrv, 0x10, blmin );
+     maven_write_word( mav, mdrv, 0x0E, bl );
+     maven_write_word( mav, mdrv, 0x1E, wl );
+}
+
+DFBResult
+maven_open( MatroxMavenData  *mav,
+            MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     if (mdev->g450_matrox)
+          return DFB_OK;
+
+     if (mdrv->maven_fd != -1)
+          D_BUG( "DirectFB/Matrox/Maven: Device already open!\n" );
+
+     if ((mdrv->maven_fd = open( mav->dev, O_RDWR )) < 0) {
+          D_PERROR( "DirectFB/Matrox/Maven: Error opening `%s'!\n",
+                     mav->dev );
+          mdrv->maven_fd = -1;
+          return errno2result( errno );
+     }
+
+     if (ioctl( mdrv->maven_fd, I2C_SLAVE, mav->address ) < 0) {
+          D_PERROR( "DirectFB/Matrox/Maven: Error controlling `%s'!\n",
+                     mav->dev );
+          close( mdrv->maven_fd );
+          mdrv->maven_fd = -1;
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+void
+maven_close( MatroxMavenData  *mav,
+             MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+
+     if (mdev->g450_matrox)
+          return;
+
+     if (mdrv->maven_fd == -1)
+          D_BUG( "DirectFB/Matrox/Maven: Device not open!\n" );
+
+     close( mdrv->maven_fd );
+     mdrv->maven_fd = -1;
+}
+
+DFBResult maven_init( MatroxMavenData  *mav,
+                      MatroxDriverData *mdrv )
+{
+     MatroxDeviceData *mdev = mdrv->device_data;
+     char  line[512];
+     int   fd;
+     FILE *file;
+     bool  found = false;
+     DIR  *dir;
+
+     /* Locate G400 maven /dev/i2c file */
+
+     /* Try sysfs */
+     if (!mdev->g450_matrox && (dir = opendir( SYS_CLASS_I2C_DEV )) != NULL) {
+          char path[PATH_MAX];
+          struct dirent *ent;
+
+          while ((ent = readdir( dir )) != NULL) {
+               FILE *fp;
+
+               if (!strcmp( ent->d_name, "." ))
+                    continue;
+               if (!strcmp( ent->d_name, ".." ))
+                    continue;
+
+               snprintf( path, sizeof(path), "%s/%s/name", SYS_CLASS_I2C_DEV, ent->d_name );
+
+               fp = fopen( path, "r" );
+               if (!fp) {
+                    D_PERROR( "DirectFB/Matrox/Maven: Error opening `%s'!\n", path );
+                    continue;
+               }
+
+               memset( line, 0, 6 );
+
+               fread( line, 1, 5, fp );
+               if (ferror( fp )) {
+                    D_PERROR( "DirectFB/Matrox/Maven: Error reading `%s'!\n", path );
+                    fclose( fp );
+                    continue;
+               }
+
+               fclose( fp );
+
+               if (strcmp( line, "MAVEN" ))
+                    continue;
+
+               snprintf( mav->dev, sizeof(mav->dev), "/dev/%s", ent->d_name );
+               found = true;
+               break;
+          }
+          if (!ent && errno)
+               D_PERROR( "DirectFB/Matrox/Maven: Error reading `%s'!\n", SYS_CLASS_I2C_DEV );
+
+          closedir( dir );
+     }
+
+     /* Try /proc/bus/i2c */
+     if (!mdev->g450_matrox && !found) {
+          file = fopen( "/proc/bus/i2c", "r" );
+          if (!file) {
+               D_PERROR( "DirectFB/Matrox/Maven: "
+                          "Error opening `/proc/bus/i2c'!\n" );
+               return errno2result( errno );
+          }
+          while (fgets( line, 512, file )) {
+               if (strstr( line, "MAVEN" )) {
+                    char *p = line;
+                    while (!isspace( *p ))
+                         p++;
+                    *p = '\0';
+                    direct_snputs( mav->dev, "/dev/", 6 );
+                    strncat( mav->dev, line, 250 );
+                    found = true;
+                    break;
+               }
+          }
+          fclose( file );
+     }
+
+     if (!mdev->g450_matrox) {
+          if (!found) {
+               D_ERROR( "DirectFB/Matrox/Maven: "
+                         "Can't find MAVEN i2c device file!\n" );
+               return DFB_UNSUPPORTED;
+          }
+
+          /* Try to use it */
+          if ((fd = open( mav->dev, O_RDWR )) < 0) {
+               D_PERROR( "DirectFB/Matrox/Maven: Error opening `%s'!\n",
+                          mav->dev );
+               return errno2result( errno );
+          }
+
+#if 0
+          /* FIXME: This fails for some people */
+          /* Check if maven is at address 0x1B (DH board) or 0x1A (DH add-on) */
+          if (i2c_read_byte( fd, 0x1B, 0xB2 ) < 0) {
+               if (i2c_read_byte( fd, 0x1A, 0xB2 ) < 0) {
+                    D_ERROR( "DirectFB/Matrox/Maven: Error reading from maven chip!\n" );
+                    close( fd );
+                    return errno2result( errno );
+               } else
+                    mav->address = 0x1A;
+          } else
+               mav->address = 0x1B;
+#else
+          mav->address = 0x1B;
+#endif
+
+          close( fd );
+     }
+
+     /* Maven registers */
+     {
+          static const u8 ntscregs[2][0x40] = {
+          /* G400 */
+          {
+               0x21, 0xF0, 0x7C, 0x1F, /* 00-03 */
+               0x00, /* 04 */
+               0x00,
+               0x00,
+               0x00,
+               0x7E, /* 08 */
+               0x43, /* 09 */
+               0x7E, /* 0A */
+               0x3D, /* 0B */
+               0x00, /* 0C */
+               0x00,
+               0x46, 0x03, /* 0E-0F */
+               0x3C, 0x02, /* 10-11 */
+               0x17, /* 12 */
+               0x21, /* 13 */
+               0x1B, /* 14 */
+               0x1B, /* 15 */
+               0x24, /* 16 */
+               0x83, 0x01, /* 17-18 */
+               0x00, /* 19 */
+               0x0F, /* 1A */
+               0x0F, /* 1B */
+               0x60, /* 1C */
+               0x05, /* 1D */
+               0xC4, 0x02, /* 1E-1F */
+               0x8E, /* 20 */
+               0x04, /* 21 */
+               0x8E, /* 22 */
+               0x01, /* 23 */
+               0x02, /* 24 */
+               0x00, /* 25 */
+               0x0A, /* 26 */
+               0x05, /* 27 */
+               0x00, /* 28 */
+               0x10, /* 29 */
+               0xFF, 0x03, /* 2A-2B */
+               0x18, /* 2C */
+               0x0F, 0x78, /* 2D-2E */
+               0x00, 0x00, /* 2F-30 */
+               0xB4, 0x00, /* 31-32 */
+               0x14, /* 33 */
+               0x02, /* 34 */
+               0x1C, /* 35 */
+               0x00,
+               0xA3, /* 37 */
+               0xC8, /* 38 */
+               0x15, /* 39 */
+               0x05, /* 3A */
+               0x15, /* 3B */
+               0x3C, 0x00, /* 3C-3D */
+               0x00, /* 3E */
+               0x00
+          },
+          /* G450 / G550 */
+          {
+               0x21, 0xF0, 0x7C, 0x1F, /* 00-03 */
+               0x00, /* 04 */
+               0x00,
+               0x00,
+               0x00,
+               0x7E, /* 08 */
+               0x44, /* 09 */
+               0x76, /* 0A */
+               0x49, /* 0B */
+               0x00, /* 0C */
+               0x00,
+               0x4E, 0x03, /* 0E-0F */
+               0x42, 0x03, /* 10-11 */
+               0x17, /* 12 */
+               0x21, /* 13 */
+               0x1B, /* 14 */
+               0x1B, /* 15 */
+               0x24, /* 16 */
+               0x83, 0x01, /* 17-18 */
+               0x00, /* 19 */
+               0x0F, /* 1A */
+               0x0F, /* 1B */
+               0x60, /* 1C */
+               0x05, /* 1D */
+               0xEA, 0x00, /* 1E-1F */
+               0xAE, /* 20 */
+               0x04, /* 21 */
+               0xAE, /* 22 */
+               0x01, /* 23 */
+               0x02, /* 24 */
+               0x00, /* 25 */
+               0x0A, /* 26 */
+               0x05, /* 27 */
+               0x00, /* 28 */
+               0x11, /* 29 */
+               0xFF, 0x03, /* 2A-2B */
+               0x20, /* 2C */
+               0x0F, 0x78, /* 2D-2E */
+               0x00, 0x00, /* 2F-30 */
+               0xB4, 0x00, /* 31-32 */
+               0x14, /* 33 */
+               0x02, /* 34 */
+               0x00, /* 35 */
+               0x00,
+               0xBD, /* 37 */
+               0xDA, /* 38 */
+               0x15, /* 39 */
+               0x05, /* 3A */
+               0x15, /* 3B */
+               0x42, 0x03, /* 3C-3D */
+               0x00, /* 3E */
+               0x00
+          }
+          };
+          static const u8 palregs[2][0x40] = {
+          /* G400 */
+          {
+               0x2A, 0x09, 0x8A, 0xCB, /* 00-03 */
+               0x00, /* 04 */
+               0x00,
+               0x00,
+               0x00,
+               0x7E, /* 08 */
+               0x3C, /* 09 */
+               0x82, /* 0A */
+               0x2E, /* 0B */
+               0x21, /* 0C */
+               0x00,
+               0x3F, 0x03, /* 0E-0F */
+               0x3F, 0x03, /* 10-11 */
+               0x1A, /* 12 */
+               0x2A, /* 13 */
+               0x1C, /* 14 */
+               0x3D, /* 15 */
+               0x14, /* 16 */
+               0x9C, 0x01, /* 17-18 */
+               0x00, /* 19 */
+               0xFE, /* 1A */
+               0x7E, /* 1B */
+               0x60, /* 1C */
+               0x05, /* 1D */
+               0xC4, 0x01, /* 1E-1F */
+               0x95, /* 20 */
+               0x07, /* 21 */
+               0x95, /* 22 */
+               0x00, /* 23 */
+               0x00, /* 24 */
+               0x00, /* 25 */
+               0x08, /* 26 */
+               0x04, /* 27 */
+               0x00, /* 28 */
+               0x1A, /* 29 */
+               0x55, 0x01, /* 2A-2B */
+               0x20, /* 2C */
+               0x07, 0x7E, /* 2D-2E */
+               0x02, 0x54, /* 2F-30 */
+               0xB4, 0x00, /* 31-32 */
+               0x14, /* 33 */
+               0x49, /* 34 */
+               0x1D, /* 35 */
+               0x00,
+               0xA3, /* 37 */
+               0xC8, /* 38 */
+               0x22, /* 39 */
+               0x02, /* 3A */
+               0x22, /* 3B */
+               0x3F, 0x03, /* 3C-3D */
+               0x00, /* 3E */
+               0x00,
+          },
+          /* G450 / G550 */
+          {
+               0x2A, 0x09, 0x8A, 0xCB, /* 00-03 */
+               0x00, /* 04 */
+               0x00,
+               0x00,
+               0x00,
+               0x7E, /* 08 */
+               0x3A, /* 09 */
+               0x8A, /* 0A */
+               0x38, /* 0B */
+               0x28, /* 0C */
+               0x00,
+               0x46, 0x01, /* 0E-0F */
+               0x46, 0x01, /* 10-11 */
+               0x1A, /* 12 */
+               0x2A, /* 13 */
+               0x1C, /* 14 */
+               0x3D, /* 15 */
+               0x14, /* 16 */
+               0x9C, 0x01, /* 17-18 */
+               0x00, /* 19 */
+               0xFE, /* 1A */
+               0x7E, /* 1B */
+               0x60, /* 1C */
+               0x05, /* 1D */
+               0xEA, 0x00, /* 1E-1F */
+               0xBB, /* 20 */
+               0x07, /* 21 */
+               0xBB, /* 22 */
+               0x00, /* 23 */
+               0x00, /* 24 */
+               0x00, /* 25 */
+               0x08, /* 26 */
+               0x04, /* 27 */
+               0x00, /* 28 */
+               0x1A, /* 29 */
+               0x55, 0x01, /* 2A-2B */
+               0x18, /* 2C */
+               0x07, 0x7E, /* 2D-2E */
+               0x02, 0x54, /* 2F-30 */
+               0xB4, 0x00, /* 31-32 */
+               0x16, /* 33 */
+               0x49, /* 34 */
+               0x00, /* 35 */
+               0x00,
+               0xB9, /* 37 */
+               0xDD, /* 38 */
+               0x22, /* 39 */
+               0x02, /* 3A */
+               0x22, /* 3B */
+               0x46, 0x00, /* 3C-3D */
+               0x00, /* 3E */
+               0x00,
+          }
+          };
+
+          if (dfb_config->matrox_tv_std != DSETV_PAL)
+               direct_memcpy( mav->regs, ntscregs[mdev->g450_matrox], 64 );
+          else
+               direct_memcpy( mav->regs, palregs[mdev->g450_matrox], 64 );
+
+          if (dfb_config->matrox_tv_std == DSETV_PAL_60) {
+               mav->regs[0x00] = palregs[mdev->g450_matrox][0x00];
+               mav->regs[0x01] = palregs[mdev->g450_matrox][0x01];
+               mav->regs[0x02] = palregs[mdev->g450_matrox][0x02];
+               mav->regs[0x03] = palregs[mdev->g450_matrox][0x03];
+               mav->regs[0x0B] = palregs[mdev->g450_matrox][0x0B];
+               mav->regs[0x0C] = palregs[mdev->g450_matrox][0x0C];
+               mav->regs[0x0E] = palregs[mdev->g450_matrox][0x0E];
+               mav->regs[0x0F] = palregs[mdev->g450_matrox][0x0F];
+               mav->regs[0x10] = palregs[mdev->g450_matrox][0x10];
+               mav->regs[0x11] = palregs[mdev->g450_matrox][0x11];
+               mav->regs[0x1E] = palregs[mdev->g450_matrox][0x1E];
+               mav->regs[0x1F] = palregs[mdev->g450_matrox][0x1F];
+               mav->regs[0x20] = palregs[mdev->g450_matrox][0x20];
+               mav->regs[0x22] = palregs[mdev->g450_matrox][0x22];
+               mav->regs[0x25] = palregs[mdev->g450_matrox][0x25];
+               mav->regs[0x34] = palregs[mdev->g450_matrox][0x34];
+          }
+
+          if (!mdev->g450_matrox) {
+               /* gamma */
+               mav->regs[0x83] = 0x00;
+               mav->regs[0x84] = 0x00;
+               mav->regs[0x85] = 0x00;
+               mav->regs[0x86] = 0x1F;
+               mav->regs[0x87] = 0x10;
+               mav->regs[0x88] = 0x10;
+               mav->regs[0x89] = 0x10;
+               mav->regs[0x8A] = 0x64;
+               mav->regs[0x8B] = 0xC8;
+          }
+     }
+
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_maven.h b/Source/DirectFB/gfxdrivers/matrox/matrox_maven.h
new file mode 100755
index 0000000..eeeb32d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_maven.h
@@ -0,0 +1,64 @@
+/*
+   (c) 1998-2001 Petr Vandrovec <vandrove@vc.cvut.cz>
+
+   This code originally comes from matroxfb.
+   Relicensed under the LGPL with the authors permission.
+   Adapted for CRTC2 ITU-R 656 mode by Ville Syrjala <syrjala@sci.fi>
+
+   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 __MATROX_MAVEN_H__
+#define __MATROX_MAVEN_H__
+
+typedef struct {
+     char dev[256];
+     u8 regs[256];
+     u8 address;
+} MatroxMavenData;
+
+DFBResult maven_init( MatroxMavenData  *mav,
+                      MatroxDriverData *mdrv );
+
+DFBResult maven_open( MatroxMavenData  *mav,
+                      MatroxDriverData *mdrv );
+void maven_close( MatroxMavenData  *mav,
+                  MatroxDriverData *mdrv );
+
+void maven_enable( MatroxMavenData  *mav,
+                   MatroxDriverData *mdrv );
+void maven_disable( MatroxMavenData  *mav,
+                    MatroxDriverData *mdrv );
+void maven_sync( MatroxMavenData  *mav,
+                 MatroxDriverData *mdrv );
+
+void maven_set_regs( MatroxMavenData       *mav,
+                     MatroxDriverData      *mdrv,
+                     CoreLayerRegionConfig *config,
+                     DFBColorAdjustment    *adj );
+
+void maven_set_hue( MatroxMavenData  *mav,
+                    MatroxDriverData *mdrv,
+                    u8                hue );
+void maven_set_saturation( MatroxMavenData  *mav,
+                           MatroxDriverData *mdrv,
+                           u8                saturation );
+void maven_set_bwlevel( MatroxMavenData  *mav,
+                        MatroxDriverData *mdrv,
+                        u8                brightness,
+                        u8                contrast );
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_screen_crtc2.c b/Source/DirectFB/gfxdrivers/matrox/matrox_screen_crtc2.c
new file mode 100755
index 0000000..f08a58f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_screen_crtc2.c
@@ -0,0 +1,279 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <sys/ioctl.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 <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/screens.h>
+#include <core/system.h>
+
+#include <fbdev/fbdev.h>
+
+#include <misc/conf.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+
+
+typedef struct {
+     DFBScreenPowerMode power_mode;
+} MatroxCrtc2ScreenData;
+
+static void crtc2_wait_vsync( MatroxDriverData *mdrv );
+
+/**************************************************************************************************/
+
+static int
+crtc2ScreenDataSize( void )
+{
+     return sizeof(MatroxCrtc2ScreenData);
+}
+
+static DFBResult
+crtc2InitScreen( CoreScreen           *screen,
+                 CoreGraphicsDevice   *device,
+                 void                 *driver_data,
+                 void                 *screen_data,
+                 DFBScreenDescription *description )
+{
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_VSYNC | DSCCAPS_ENCODERS | DSCCAPS_OUTPUTS;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "Matrox CRTC2 Screen" );
+
+     /* Set number of encoders and outputs. */
+     description->encoders = 1;
+     description->outputs  = 1;
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+crtc2InitEncoder( CoreScreen                  *screen,
+                  void                        *driver_data,
+                  void                        *screen_data,
+                  int                          encoder,
+                  DFBScreenEncoderDescription *description,
+                  DFBScreenEncoderConfig      *config )
+{
+     /* Set the encoder capabilities & type. */
+     description->caps = DSECAPS_TV_STANDARDS;
+     description->type = DSET_TV;
+
+     /* Set supported TV standards. */
+     description->tv_standards = DSETV_PAL | DSETV_NTSC | DSETV_PAL_60;
+
+     /* Set default configuration. */
+     config->flags       = DSECONF_TV_STANDARD;
+     config->tv_standard = dfb_config->matrox_tv_std;
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2InitOutput( CoreScreen                 *screen,
+                 void                       *driver_data,
+                 void                       *screen_data,
+                 int                         output,
+                 DFBScreenOutputDescription *description,
+                 DFBScreenOutputConfig      *config )
+{
+     /* Set the output capabilities. */
+     description->caps = DSOCAPS_CONNECTORS |
+                         DSOCAPS_SIGNAL_SEL | DSOCAPS_CONNECTOR_SEL;
+
+     /* Set supported output connectors and signals. */
+     description->all_connectors = DSOC_CVBS | DSOC_YC | DSOC_SCART;
+     description->all_signals    = DSOS_CVBS | DSOS_YC | DSOS_RGB;
+
+     /* Set default configuration. */
+     config->flags = DSOCONF_SIGNALS | DSOCONF_CONNECTORS;
+
+     switch (dfb_config->matrox_cable) {
+          case 1:
+               /* SCART RGB */
+               config->out_signals    = DSOS_RGB;
+               config->out_connectors = DSOC_SCART;
+               break;
+          case 2:
+               /* SCART Composite */
+               config->out_signals    = DSOS_CVBS;
+               config->out_connectors = DSOC_SCART;
+               break;
+          default:
+               /* Composite / S-Video */
+               config->out_signals    = DSOS_CVBS | DSOS_YC;
+               config->out_connectors = DSOC_CVBS | DSOC_YC;
+               break;
+     }
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+crtc2SetPowerMode( CoreScreen         *screen,
+                   void               *driver_data,
+                   void               *screen_data,
+                   DFBScreenPowerMode  mode )
+{
+     MatroxCrtc2ScreenData *msc2 = (MatroxCrtc2ScreenData*) screen_data;
+
+     msc2->power_mode = mode;
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2WaitVSync( CoreScreen *screen,
+                void       *driver_data,
+                void       *screen_data )
+{
+     MatroxDriverData      *mdrv = (MatroxDriverData*) driver_data;
+     MatroxCrtc2ScreenData *msc2 = (MatroxCrtc2ScreenData*) screen_data;
+
+     if (msc2->power_mode == DSPM_ON)
+          crtc2_wait_vsync( mdrv );
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+crtc2TestEncoderConfig( CoreScreen                   *screen,
+                        void                         *driver_data,
+                        void                         *screen_data,
+                        int                           encoder,
+                        const DFBScreenEncoderConfig *config,
+                        DFBScreenEncoderConfigFlags  *failed )
+{
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+crtc2SetEncoderConfig( CoreScreen                   *screen,
+                       void                         *driver_data,
+                       void                         *screen_data,
+                       int                           encoder,
+                       const DFBScreenEncoderConfig *config )
+{
+//     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+crtc2TestOutputConfig( CoreScreen                  *screen,
+                       void                        *driver_data,
+                       void                        *screen_data,
+                       int                          output,
+                       const DFBScreenOutputConfig *config,
+                       DFBScreenOutputConfigFlags  *failed )
+{
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+crtc2SetOutputConfig( CoreScreen                  *screen,
+                      void                        *driver_data,
+                      void                        *screen_data,
+                      int                          output,
+                      const DFBScreenOutputConfig *config )
+{
+//     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+crtc2GetScreenSize( CoreScreen *screen,
+                    void       *driver_data,
+                    void       *screen_data,
+                    int        *ret_width,
+                    int        *ret_height )
+{
+     *ret_width  = 720;
+     *ret_height = (dfb_config->matrox_tv_std != DSETV_PAL) ? 480 : 576;
+
+     return DFB_OK;
+}
+
+ScreenFuncs matroxCrtc2ScreenFuncs = {
+     .ScreenDataSize    = crtc2ScreenDataSize,
+     .InitScreen        = crtc2InitScreen,
+     .InitEncoder       = crtc2InitEncoder,
+     .InitOutput        = crtc2InitOutput,
+     .SetPowerMode      = crtc2SetPowerMode,
+     .WaitVSync         = crtc2WaitVSync,
+     .TestEncoderConfig = crtc2TestEncoderConfig,
+     .SetEncoderConfig  = crtc2SetEncoderConfig,
+     .TestOutputConfig  = crtc2TestOutputConfig,
+     .SetOutputConfig   = crtc2SetOutputConfig,
+     .GetScreenSize     = crtc2GetScreenSize,
+};
+
+/**************************************************************************************************/
+
+static void crtc2_wait_vsync( MatroxDriverData *mdrv )
+{
+     int vdisplay = ((dfb_config->matrox_tv_std != DSETV_PAL) ? 480/2 : 576/2) + 1;
+
+#ifdef FBIO_WAITFORVSYNC
+     static const int one = 1;
+     FBDev *dfb_fbdev = dfb_system_data();
+     if (ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, &one ))
+#endif
+          while ((int)(mga_in32( mdrv->mmio_base, C2VCOUNT ) & 0x00000FFF) != vdisplay)
+               ;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_spic.c b/Source/DirectFB/gfxdrivers/matrox/matrox_spic.c
new file mode 100755
index 0000000..cca8392
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_spic.c
@@ -0,0 +1,314 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+
+     /* Stored registers */
+     struct {
+          /* CRTC2 sub picture */
+          u32 c2DATACTL;
+
+          u32 c2SPICSTARTADD0;
+          u32 c2SPICSTARTADD1;
+          u32 c2SUBPICLUT;
+     } regs;
+} MatroxSpicLayerData;
+
+static void spic_calc_buffer( MatroxDriverData      *mdrv,
+                              MatroxSpicLayerData   *mspic,
+                              CoreSurface           *surface,
+                              CoreSurfaceBufferLock *lock );
+
+static void spic_set_buffer( MatroxDriverData    *mdrv,
+                             MatroxSpicLayerData *mspic );
+
+#define SPIC_SUPPORTED_OPTIONS   (DLOP_ALPHACHANNEL | DLOP_OPACITY)
+
+/**********************/
+
+static int
+spicLayerDataSize( void )
+{
+     return sizeof(MatroxSpicLayerData);
+}
+
+static DFBResult
+spicInitLayer( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               DFBDisplayLayerDescription *description,
+               DFBDisplayLayerConfig      *config,
+               DFBColorAdjustment         *adjustment )
+{
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY;
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Matrox CRTC2 Sub-Picture" );
+
+     /* fill out the default configuration */
+     config->flags        = DLCONF_WIDTH | DLCONF_HEIGHT |
+                            DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                            DLCONF_OPTIONS | DLCONF_SURFACE_CAPS;
+
+     config->width        = 720;
+     config->height       = (dfb_config->matrox_tv_std != DSETV_PAL) ? 480 : 576;
+     config->pixelformat  = DSPF_ALUT44;
+     config->buffermode   = DLBM_FRONTONLY;
+     config->options      = DLOP_NONE;
+     config->surface_caps = DSCAPS_INTERLACED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+spicTestRegion( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                CoreLayerRegionConfig      *config,
+                CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     if (config->options & ~SPIC_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /* Can't have both at the same time */
+     if (config->options & DLOP_ALPHACHANNEL && config->options & DLOP_OPACITY)
+          fail |= CLRCF_OPTIONS;
+
+     switch (config->opacity) {
+          case 0x00:
+          case 0xFF:
+               break;
+          default:
+               if (!(config->options & DLOP_OPACITY))
+                    fail |= CLRCF_OPACITY;
+     }
+
+     if (config->surface_caps & ~(DSCAPS_INTERLACED | DSCAPS_SEPARATED))
+          fail |= CLRCF_SURFACE_CAPS;
+
+     if (config->format != DSPF_ALUT44)
+          fail |= CLRCF_FORMAT;
+
+     if (config->width != 720)
+          fail |= CLRCF_WIDTH;
+
+     if (config->surface_caps & DSCAPS_INTERLACED) {
+          if (config->height != ((dfb_config->matrox_tv_std != DSETV_PAL) ? 480 : 576))
+               fail |= CLRCF_HEIGHT;
+     } else {
+          if (config->height != ((dfb_config->matrox_tv_std != DSETV_PAL) ? 240 : 288))
+               fail |= CLRCF_HEIGHT;
+     }
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+spicAddRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+spicSetRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               void                       *region_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags  updated,
+               CoreSurface                *surface,
+               CorePalette                *palette,
+               CoreSurfaceBufferLock      *lock )
+{
+     MatroxDriverData    *mdrv  = (MatroxDriverData*) driver_data;
+     MatroxSpicLayerData *mspic = (MatroxSpicLayerData*) layer_data;
+     MatroxDeviceData    *mdev  = mdrv->device_data;
+     volatile u8         *mmio  = mdrv->mmio_base;
+
+     /* remember configuration */
+     mspic->config = *config;
+
+     if (updated & CLRCF_PALETTE) {
+          u8 y, cb, cr;
+          int  i;
+
+          for (i = 0; i < 16; i++) {
+               RGB_TO_YCBCR( palette->entries[i].r,
+                             palette->entries[i].g,
+                             palette->entries[i].b,
+                             y, cb, cr );
+
+               mspic->regs.c2SUBPICLUT = (cr << 24) | (cb << 16) | (y << 8) | i;
+               mga_out32( mmio, mspic->regs.c2SUBPICLUT, C2SUBPICLUT );
+          }
+     }
+
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT | CLRCF_SURFACE_CAPS |
+                    CLRCF_OPTIONS | CLRCF_OPACITY | CLRCF_SURFACE)) {
+          spic_calc_buffer( mdrv, mspic, surface, lock );
+          spic_set_buffer( mdrv, mspic );
+
+          mspic->regs.c2DATACTL = mga_in32( mmio, C2DATACTL );
+
+          if (surface->config.caps & DSCAPS_INTERLACED || mdev->crtc2_separated)
+               mspic->regs.c2DATACTL &= ~C2OFFSETDIVEN;
+          else
+               mspic->regs.c2DATACTL |= C2OFFSETDIVEN;
+
+          if (config->opacity)
+               mspic->regs.c2DATACTL |= C2SUBPICEN;
+          else
+               mspic->regs.c2DATACTL &= ~C2SUBPICEN;
+
+          if (config->options & DLOP_ALPHACHANNEL)
+               mspic->regs.c2DATACTL &= ~C2STATICKEYEN;
+          else
+               mspic->regs.c2DATACTL |= C2STATICKEYEN;
+
+          mspic->regs.c2DATACTL &= ~C2STATICKEY;
+          mspic->regs.c2DATACTL |= ((config->opacity + 1) << 20) & C2STATICKEY;
+
+          mga_out32( mmio, mspic->regs.c2DATACTL, C2DATACTL);
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+spicRemoveRegion( CoreLayer *layer,
+                  void      *driver_data,
+                  void      *layer_data,
+                  void      *region_data )
+{
+     MatroxDriverData    *mdrv  = (MatroxDriverData*) driver_data;
+     MatroxSpicLayerData *mspic = (MatroxSpicLayerData*) layer_data;
+     volatile u8         *mmio  = mdrv->mmio_base;
+
+     mspic->regs.c2DATACTL = mga_in32( mmio, C2DATACTL );
+
+     mspic->regs.c2DATACTL &= ~C2SUBPICEN;
+
+     mga_out32( mmio, mspic->regs.c2DATACTL, C2DATACTL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+spicFlipRegion( CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreSurface           *surface,
+                DFBSurfaceFlipFlags    flags,
+                CoreSurfaceBufferLock *lock )
+{
+     MatroxDriverData    *mdrv  = (MatroxDriverData*) driver_data;
+     MatroxSpicLayerData *mspic = (MatroxSpicLayerData*) layer_data;
+
+     spic_calc_buffer( mdrv, mspic, surface, lock );
+     spic_set_buffer( mdrv, mspic );
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs matroxSpicFuncs = {
+     .LayerDataSize = spicLayerDataSize,
+     .InitLayer     = spicInitLayer,
+
+     .TestRegion    = spicTestRegion,
+     .AddRegion     = spicAddRegion,
+     .SetRegion     = spicSetRegion,
+     .RemoveRegion  = spicRemoveRegion,
+     .FlipRegion    = spicFlipRegion,
+};
+
+/* internal */
+
+static void spic_calc_buffer( MatroxDriverData      *mdrv,
+                              MatroxSpicLayerData   *mspic,
+                              CoreSurface           *surface,
+                              CoreSurfaceBufferLock *lock )
+{
+     unsigned int field_offset = lock->pitch;
+
+     mspic->regs.c2SPICSTARTADD1 = lock->offset;
+     mspic->regs.c2SPICSTARTADD0 = lock->offset;
+
+     if (surface->config.caps & DSCAPS_SEPARATED)
+          field_offset *= surface->config.size.h / 2;
+
+     if (surface->config.caps & DSCAPS_INTERLACED)
+          mspic->regs.c2SPICSTARTADD0 += field_offset;
+}
+
+static void spic_set_buffer( MatroxDriverData    *mdrv,
+                             MatroxSpicLayerData *mspic )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     mga_out32( mmio, mspic->regs.c2SPICSTARTADD0, C2SPICSTARTADD0 );
+     mga_out32( mmio, mspic->regs.c2SPICSTARTADD1, C2SPICSTARTADD1 );
+}
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_state.c b/Source/DirectFB/gfxdrivers/matrox/matrox_state.c
new file mode 100755
index 0000000..ceeffa5
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_state.c
@@ -0,0 +1,810 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/palette.h>
+
+#include <gfx/convert.h>
+
+#include "regs.h"
+#include "mmio.h"
+#include "matrox.h"
+
+#include "matrox_state.h"
+
+#define MGA_KEYMASK(format)   ((1 << DFB_COLOR_BITS_PER_PIXEL(format)) - 1)
+
+static void matrox_calc_offsets( MatroxDeviceData      *mdev,
+                                 CoreSurface           *surface,
+                                 CoreSurfaceBufferLock *lock,
+                                 bool                   unit_pixel,
+                                 int                    offset[2][3] )
+{
+     int bytes_per_pixel = DFB_BYTES_PER_PIXEL( surface->config.format );
+     int pitch;
+
+     if (unit_pixel) {
+          offset[0][0] = lock->offset / bytes_per_pixel;
+          pitch        = lock->pitch / bytes_per_pixel;
+     } else {
+          offset[0][0] = mdev->fb.offset + lock->offset;
+          pitch        = lock->pitch;
+     }
+
+     switch (surface->config.format) {
+     case DSPF_NV12:
+     case DSPF_NV21:
+          offset[0][1] = offset[0][0] + surface->config.size.h * pitch;
+          offset[0][2] = 0;
+          break;
+     case DSPF_I420:
+          offset[0][1] = offset[0][0] + surface->config.size.h * pitch;
+          offset[0][2] = offset[0][1] + surface->config.size.h/2 * pitch/2;
+          break;
+     case DSPF_YV12:
+          offset[0][2] = offset[0][0] + surface->config.size.h * pitch;
+          offset[0][1] = offset[0][2] + surface->config.size.h/2 * pitch/2;
+          break;
+     default:
+          offset[0][1] = 0;
+          offset[0][2] = 0;
+     }
+
+     D_ASSERT( offset[0][0] % 64 == 0 );
+     D_ASSERT( offset[0][1] % 64 == 0 );
+     D_ASSERT( offset[0][2] % 64 == 0 );
+
+     if (mdev->blit_fields || mdev->blit_deinterlace) {
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               offset[1][0] = offset[0][0] + surface->config.size.h/2 * pitch;
+               switch (surface->config.format) {
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    offset[1][1] = offset[0][1] + surface->config.size.h/4 * pitch;
+                    offset[1][2] = 0;
+                    break;
+               case DSPF_I420:
+               case DSPF_YV12:
+                    offset[1][1] = offset[0][1] + surface->config.size.h/4 * pitch/2;
+                    offset[1][2] = offset[0][2] + surface->config.size.h/4 * pitch/2;
+                    break;
+               default:
+                    offset[1][1] = 0;
+                    offset[1][2] = 0;
+               }
+          } else {
+               offset[1][0] = offset[0][0] + pitch;
+               switch (surface->config.format) {
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    offset[1][1] = offset[0][1] + pitch;
+                    offset[1][2] = 0;
+                    break;
+               case DSPF_I420:
+               case DSPF_YV12:
+                    offset[1][1] = offset[0][1] + pitch/2;
+                    offset[1][2] = offset[0][2] + pitch/2;
+                    break;
+               default:
+                    offset[1][1] = 0;
+                    offset[1][2] = 0;
+               }
+          }
+
+          D_ASSERT( offset[1][0] % 64 == 0 );
+          D_ASSERT( offset[1][1] % 64 == 0 );
+          D_ASSERT( offset[1][2] % 64 == 0 );
+     }
+}
+
+void matrox_validate_destination( MatroxDriverData *mdrv,
+                                  MatroxDeviceData *mdev,
+                                  CardState        *state )
+{
+     volatile u8   *mmio            = mdrv->mmio_base;
+     CoreSurface   *destination     = state->destination;
+     CoreSurfaceBuffer *depth_buffer    = NULL;//destination->depth_buffer;
+     int            bytes_per_pixel = DFB_BYTES_PER_PIXEL( destination->config.format );
+
+     if (MGA_IS_VALID( m_destination ))
+          return;
+
+     mdev->dst_pitch = state->dst.pitch / bytes_per_pixel;
+
+     mdev->depth_buffer = depth_buffer != NULL;
+
+     if (destination->config.format == DSPF_YUY2 || destination->config.format == DSPF_UYVY)
+          mdev->dst_pitch /= 2;
+
+     if (mdev->blit_fields && !(destination->config.caps & DSCAPS_SEPARATED))
+          mdev->dst_pitch *= 2;
+
+     D_ASSERT( mdev->dst_pitch % 32 == 0 );
+
+     matrox_calc_offsets( mdev, destination, &state->dst, mdev->old_matrox, mdev->dst_offset );
+
+     mga_waitfifo( mdrv, mdev, depth_buffer ? 4 : 3 );
+
+     mga_out32( mmio, mdev->dst_offset[0][0], mdev->old_matrox ? YDSTORG : DSTORG );
+     mga_out32( mmio, mdev->dst_pitch, PITCH );
+
+#if 0
+     if (depth_buffer)
+          mga_out32( mmio, depth_buffer->video.offset, ZORG );
+#endif
+
+     switch (destination->config.format) {
+          case DSPF_A8:
+          case DSPF_ALUT44:
+          case DSPF_LUT8:
+          case DSPF_RGB332:
+               mga_out32( mmio, PW8, MACCESS );
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               mga_out32( mmio, PW16 | DIT555, MACCESS );
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGB16:
+               mga_out32( mmio, PW16, MACCESS );
+               break;
+          case DSPF_RGB24:
+               mga_out32( mmio, PW24, MACCESS );
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               mga_out32( mmio, PW32, MACCESS );
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_NV12:
+          case DSPF_NV21:
+               mga_out32( mmio, PW8 | BYPASS332 | NODITHER, MACCESS );
+               break;
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               mga_out32( mmio, PW32 | NODITHER, MACCESS );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     MGA_VALIDATE( m_destination );
+}
+
+void matrox_set_clip( MatroxDriverData *mdrv,
+                      MatroxDeviceData *mdev,
+                      DFBRegion        *clip )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     mga_waitfifo( mdrv, mdev, 3 );
+
+     if (mdev->old_matrox) {
+          mga_out32( mmio, (mdev->dst_offset[0][0] +
+                            mdev->dst_pitch * clip->y1) & 0xFFFFFF, YTOP );
+          mga_out32( mmio, (mdev->dst_offset[0][0] +
+                            mdev->dst_pitch * clip->y2) & 0xFFFFFF, YBOT );
+     }
+     else {
+          mga_out32( mmio, (mdev->dst_pitch * clip->y1) & 0xFFFFFF, YTOP );
+          mga_out32( mmio, (mdev->dst_pitch * clip->y2) & 0xFFFFFF, YBOT );
+     }
+
+     mga_out32( mmio, ((clip->x2 & 0x0FFF) << 16) | (clip->x1 & 0x0FFF), CXBNDRY );
+}
+
+void matrox_validate_drawColor( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state )
+{
+     DFBColor       color = state->color;
+     volatile u8   *mmio  = mdrv->mmio_base;
+
+     if (MGA_IS_VALID( m_drawColor ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = (color.r * (color.a + 1)) >> 8;
+          color.g = (color.g * (color.a + 1)) >> 8;
+          color.b = (color.b * (color.a + 1)) >> 8;
+     }
+
+     mga_waitfifo( mdrv, mdev, 4 );
+
+     mga_out32( mmio, U8_TO_F0915(color.a), ALPHASTART );
+     mga_out32( mmio, U8_TO_F0915(color.r), DR4 );
+     mga_out32( mmio, U8_TO_F0915(color.g), DR8 );
+     mga_out32( mmio, U8_TO_F0915(color.b), DR12 );
+
+     MGA_VALIDATE( m_drawColor );
+     MGA_INVALIDATE( m_blitColor );
+     MGA_INVALIDATE( m_blitBlend );
+}
+
+void matrox_validate_blitColor( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state )
+{
+     DFBColor       color = state->color;
+     volatile u8   *mmio  = mdrv->mmio_base;
+
+     if (MGA_IS_VALID( m_blitColor ))
+          return;
+
+     if (state->blittingflags & DSBLIT_COLORIZE) {
+          if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+               color.r = (color.r * (color.a + 1)) >> 8;
+               color.g = (color.g * (color.a + 1)) >> 8;
+               color.b = (color.b * (color.a + 1)) >> 8;
+          }
+     }
+     else {
+          if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR)
+               color.r = color.g = color.b = color.a;
+          else
+               color.r = color.g = color.b = 0xff;
+     }
+
+     mga_waitfifo( mdrv, mdev, 4 );
+
+     mga_out32( mmio, U8_TO_F0915(color.a), ALPHASTART );
+     mga_out32( mmio, U8_TO_F0915(color.r), DR4 );
+     mga_out32( mmio, U8_TO_F0915(color.g), DR8 );
+     mga_out32( mmio, U8_TO_F0915(color.b), DR12 );
+
+     MGA_VALIDATE( m_blitColor );
+     MGA_INVALIDATE( m_drawColor );
+     MGA_INVALIDATE( m_blitBlend );
+}
+
+void matrox_validate_color( MatroxDriverData *mdrv,
+                            MatroxDeviceData *mdev,
+                            CardState        *state )
+{
+     DFBColor       color = state->color;
+     volatile u8   *mmio  = mdrv->mmio_base;
+
+     u32 fcol;
+     u8  cb, cr;
+
+     if (MGA_IS_VALID( m_color ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = (color.r * (color.a + 1)) >> 8;
+          color.g = (color.g * (color.a + 1)) >> 8;
+          color.b = (color.b * (color.a + 1)) >> 8;
+     }
+
+     switch (state->destination->config.format) {
+          case DSPF_ALUT44:
+               fcol = (color.a & 0xF0) | state->color_index;
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               break;
+          case DSPF_LUT8:
+               fcol = state->color_index;
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               break;
+          case DSPF_RGB332:
+               fcol = PIXEL_RGB332( color.r,
+                                    color.g,
+                                    color.b );
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               break;
+          case DSPF_RGB444:
+               fcol = PIXEL_RGB444( color.r,
+                                    color.g,
+                                    color.b );
+               fcol |= fcol << 16;
+               break;
+          case DSPF_ARGB4444:
+               fcol = PIXEL_ARGB4444( color.a,
+                                      color.r,
+                                      color.g,
+                                      color.b );
+               fcol |= fcol << 16;
+               break;
+          case DSPF_RGB555:
+               fcol = PIXEL_RGB555( color.r,
+                                    color.g,
+                                    color.b );
+               fcol |= fcol << 16;
+               break;
+          case DSPF_ARGB1555:
+               fcol = PIXEL_ARGB1555( color.a,
+                                      color.r,
+                                      color.g,
+                                      color.b );
+               fcol |= fcol << 16;
+               break;
+          case DSPF_RGB16:
+               fcol = PIXEL_RGB16( color.r,
+                                   color.g,
+                                   color.b );
+               fcol |= fcol << 16;
+               break;
+          case DSPF_RGB24:
+               fcol = PIXEL_RGB32( color.r,
+                                   color.g,
+                                   color.b );
+               fcol |= fcol << 24;
+               break;
+          case DSPF_RGB32:
+               fcol = PIXEL_RGB32( color.r,
+                                   color.g,
+                                   color.b );
+               break;
+          case DSPF_ARGB:
+               fcol = PIXEL_ARGB( color.a,
+                                  color.r,
+                                  color.g,
+                                  color.b );
+               break;
+          case DSPF_A8:
+               fcol = color.a;
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               RGB_TO_YCBCR( color.r,
+                             color.g,
+                             color.b,
+                             fcol, cb, cr );
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               mdev->color[0] = fcol;
+               mdev->color[1] = (cb << 24) | (cb << 16) | (cb << 8) | cb;
+               mdev->color[2] = (cr << 24) | (cr << 16) | (cr << 8) | cr;
+               break;
+          case DSPF_NV12:
+               RGB_TO_YCBCR( color.r,
+                             color.g,
+                             color.b,
+                             fcol, cb, cr );
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               mdev->color[0] = fcol;
+               mdev->color[1] = (cr << 24) | (cb << 16) | (cr << 8) | cb;
+               break;
+          case DSPF_NV21:
+               RGB_TO_YCBCR( color.r,
+                             color.g,
+                             color.b,
+                             fcol, cb, cr );
+               fcol |= fcol << 8;
+               fcol |= fcol << 16;
+               mdev->color[0] = fcol;
+               mdev->color[1] = (cb << 24) | (cr << 16) | (cb << 8) | cr;
+               break;
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r,
+                             color.g,
+                             color.b,
+                             fcol, cb, cr );
+               fcol = PIXEL_YUY2( fcol, cb, cr );
+               break;
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r,
+                             color.g,
+                             color.b,
+                             fcol, cb, cr );
+               fcol = PIXEL_UYVY( fcol, cb, cr );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               return;
+     }
+
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, fcol, FCOL );
+
+     MGA_VALIDATE( m_color );
+     MGA_INVALIDATE( m_srckey );
+}
+
+static u32 matroxSourceBlend[] = {
+     SRC_ZERO,                /* DSBF_ZERO         */
+     SRC_ONE,                 /* DSBF_ONE          */
+     0,                       /* DSBF_SRCCOLOR     */
+     0,                       /* DSBF_INVSRCCOLOR  */
+     SRC_ALPHA,               /* DSBF_SRCALPHA     */
+     SRC_ONE_MINUS_SRC_ALPHA, /* DSBF_INVSRCALPHA  */
+     SRC_DST_ALPHA,           /* DSBF_DESTALPHA    */
+     SRC_ONE_MINUS_DST_ALPHA, /* DSBF_INVDESTALPHA */
+     SRC_DST_COLOR,           /* DSBF_DESTCOLOR    */
+     SRC_ONE_MINUS_DST_COLOR, /* DSBF_INVDESTCOLOR */
+     SRC_SRC_ALPHA_SATURATE   /* DSBF_SRCALPHASAT  */
+};
+
+static u32 matroxDestBlend[] = {
+     DST_ZERO,                /* DSBF_ZERO         */
+     DST_ONE,                 /* DSBF_ONE          */
+     DST_SRC_COLOR,           /* DSBF_SRCCOLOR     */
+     DST_ONE_MINUS_SRC_COLOR, /* DSBF_INVSRCCOLOR  */
+     DST_SRC_ALPHA,           /* DSBF_SRCALPHA     */
+     DST_ONE_MINUS_SRC_ALPHA, /* DSBF_INVSRCALPHA  */
+     DST_DST_ALPHA,           /* DSBF_DESTALPHA    */
+     DST_ONE_MINUS_DST_ALPHA, /* DSBF_INVDESTALPHA */
+     0,                       /* DSBF_DESTCOLOR    */
+     0,                       /* DSBF_INVDESTCOLOR */
+     0                        /* DSBF_SRCALPHASAT  */
+};
+
+void matrox_validate_drawBlend( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 alphactrl;
+
+     if (MGA_IS_VALID( m_drawBlend ))
+          return;
+
+     alphactrl = matroxSourceBlend[state->src_blend - 1] |
+                 matroxDestBlend  [state->dst_blend - 1] |
+                 ALPHACHANNEL | DIFFUSEDALPHA;
+
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, alphactrl, ALPHACTRL );
+
+     MGA_VALIDATE( m_drawBlend );
+     MGA_INVALIDATE( m_blitBlend );
+}
+
+static u32 matroxAlphaSelect[] = {
+     0,
+     0,
+     DIFFUSEDALPHA,
+     MODULATEDALPHA
+};
+
+void matrox_validate_blitBlend( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state )
+{
+     volatile u8 *mmio = mdrv->mmio_base;
+
+     u32 alphactrl;
+
+     if (MGA_IS_VALID( m_blitBlend ))
+          return;
+
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                 DSBLIT_BLEND_COLORALPHA))
+     {
+          if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+               /* src_blend == ONE and dst_blend == INVSRCALPHA/INVSRCCOLOR */
+               alphactrl = matroxSourceBlend[DSBF_SRCALPHA    - 1] |
+                           matroxDestBlend  [state->dst_blend - 1] |
+                           VIDEOALPHA;
+          else
+               alphactrl = matroxSourceBlend[state->src_blend - 1] |
+                           matroxDestBlend  [state->dst_blend - 1] |
+                           ALPHACHANNEL;
+
+          if (state->source->config.format == DSPF_RGB32) {
+               alphactrl |= DIFFUSEDALPHA;
+
+               if (! (state->blittingflags & DSBLIT_BLEND_COLORALPHA)) {
+                    mga_out32( mmio, U8_TO_F0915(0xff), ALPHASTART );
+                    MGA_INVALIDATE( m_drawColor | m_blitColor );
+               }
+          }
+          else
+               alphactrl |= matroxAlphaSelect [state->blittingflags & 3];
+     }
+     else {
+          alphactrl = SRC_ONE | DST_ZERO | ALPHACHANNEL;
+
+          if (state->source->config.format == DSPF_RGB32) {
+               alphactrl |= DIFFUSEDALPHA;
+
+               mga_out32( mmio, U8_TO_F0915(0xff), ALPHASTART );
+               MGA_INVALIDATE( m_drawColor | m_blitColor );
+          }
+     }
+
+     mga_waitfifo( mdrv, mdev, 1 );
+     mga_out32( mmio, alphactrl, ALPHACTRL );
+
+     MGA_VALIDATE( m_blitBlend );
+     MGA_INVALIDATE( m_drawBlend );
+}
+
+static void matrox_tlutload( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CorePalette      *palette )
+{
+     volatile u8  *mmio = mdrv->mmio_base;
+     volatile u16 *dst  = dfb_gfxcard_memory_virtual( NULL, mdev->tlut_offset );
+     unsigned int  i;
+
+     for (i = 0; i < palette->num_entries; i++)
+          *dst++ = PIXEL_RGB16( palette->entries[i].r,
+                                palette->entries[i].g,
+                                palette->entries[i].b );
+
+     mga_waitfifo( mdrv, mdev, mdev->old_matrox ? 8 : 9 );
+     mga_out32( mmio, BLTMOD_BU32RGB | BOP_COPY | SHFTZERO |
+                SGNZERO | LINEAR | ATYPE_RSTR | OP_BITBLT, DWGCTL );
+     mga_out32( mmio, 1024, PITCH );
+     if (mdev->old_matrox) {
+          mga_out32( mmio, mdev->tlut_offset / 2, AR3 );
+          mga_out32( mmio, palette->num_entries, AR0 );
+          mga_out32( mmio, 0, YDSTORG );
+     }
+     else {
+          mga_out32( mmio, 0, AR3 );
+          mga_out32( mmio, palette->num_entries, AR0 );
+          mga_out32( mmio, mdev->fb.offset + mdev->tlut_offset, SRCORG );
+          mga_out32( mmio, 0, DSTORG );
+
+          MGA_INVALIDATE( m_source );
+     }
+     mga_out32( mmio, 0, FXBNDRY );
+     mga_out32( mmio, PW16 | TLUTLOAD, MACCESS );
+     mga_out32( mmio, palette->num_entries, YDSTLEN | EXECUTE );
+
+     MGA_INVALIDATE( m_destination );
+}
+
+void matrox_validate_Source( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio            = mdrv->mmio_base;
+     CoreSurface   *surface         = state->source;
+     int            bytes_per_pixel = DFB_BYTES_PER_PIXEL(surface->config.format);
+     u32            texctl = 0, texctl2 = 0;
+
+     if (MGA_IS_VALID( m_Source ))
+          return;
+
+     mdev->src_pitch = state->src.pitch / bytes_per_pixel;
+     mdev->field     = surface->field;
+     mdev->w         = surface->config.size.w;
+     mdev->h         = surface->config.size.h;
+
+     if (state->destination->config.format == DSPF_YUY2 || state->destination->config.format == DSPF_UYVY) {
+          mdev->w /= 2;
+          mdev->src_pitch /= 2;
+     }
+
+     if (mdev->blit_deinterlace || mdev->blit_fields) {
+          mdev->h /= 2;
+          if (!(surface->config.caps & DSCAPS_SEPARATED))
+               mdev->src_pitch *= 2;
+     }
+
+     D_ASSERT( mdev->src_pitch % 32 == 0 );
+
+     matrox_calc_offsets( mdev, surface, &state->src, false, mdev->src_offset );
+
+     if (mdev->blit_deinterlace && mdev->field) {
+          mdev->src_offset[0][0] = mdev->src_offset[1][0];
+          mdev->src_offset[0][1] = mdev->src_offset[1][1];
+          mdev->src_offset[0][2] = mdev->src_offset[1][2];
+     }
+
+     mdev->w2 = mga_log2( mdev->w );
+     mdev->h2 = mga_log2( mdev->h );
+
+     if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+          texctl = TAMASK;
+     else
+          texctl = TAKEY;
+
+     switch (surface->config.format) {
+          case DSPF_YUY2:
+               texctl |= (state->destination->config.format == DSPF_YUY2) ? TW32 : TW422;
+               break;
+          case DSPF_UYVY:
+               texctl |= (state->destination->config.format == DSPF_UYVY) ? TW32 : TW422UYVY;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_NV12:
+          case DSPF_NV21:
+          case DSPF_A8:
+               texctl |= TW8A;
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               texctl |= TW12;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               texctl |= TW15;
+               break;
+          case DSPF_RGB16:
+               texctl |= TW16;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               texctl |= TW32;
+               break;
+          case DSPF_LUT8:
+               matrox_tlutload( mdrv, mdev, surface->palette );
+               texctl |= TW8;
+               break;
+          case DSPF_RGB332:
+               matrox_tlutload( mdrv, mdev, mdev->rgb332_palette );
+               texctl |= TW8;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     texctl |= ((mdev->src_pitch << 9) & TPITCHEXT) | TPITCHLIN;
+
+     if (1 << mdev->w2 != mdev->w  ||  1 << mdev->h2 != mdev->h)
+          texctl |= CLAMPUV;
+
+     if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+          texctl |= TMODULATE;
+     else
+          texctl2 |= DECALDIS;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          texctl |= DECALCKEY | STRANS;
+     else
+          texctl2 |= CKSTRANSDIS;
+
+     if (surface->config.format == DSPF_A8)
+          texctl2 |= IDECAL | DECALDIS;
+
+     mdev->texctl = texctl;
+
+     mga_waitfifo( mdrv, mdev, 5 );
+     mga_out32( mmio, texctl,  TEXCTL );
+     mga_out32( mmio, texctl2, TEXCTL2 );
+
+     mga_out32( mmio, ( (((u32)(mdev->w - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->w2) & 0x3f) <<  9) |
+                        (((u32)(mdev->w2 + 4) & 0x3f)      )  ), TEXWIDTH );
+
+     mga_out32( mmio, ( (((u32)(mdev->h - 1) & 0x7ff) << 18) |
+                        (((u32)(4 - mdev->h2) & 0x3f) <<  9) |
+                        (((u32)(mdev->h2 + 4) & 0x3f)      )  ), TEXHEIGHT );
+
+     mga_out32( mmio, mdev->src_offset[0][0], TEXORG );
+
+     MGA_VALIDATE( m_Source );
+}
+
+void matrox_validate_source( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio            = mdrv->mmio_base;
+     CoreSurface   *surface         = state->source;
+     int            bytes_per_pixel = DFB_BYTES_PER_PIXEL(surface->config.format);
+
+     if (MGA_IS_VALID( m_source ))
+          return;
+
+     mdev->src_pitch = state->src.pitch / bytes_per_pixel;
+
+     if (state->destination->config.format == DSPF_YUY2 || state->destination->config.format == DSPF_UYVY)
+          mdev->src_pitch /= 2;
+
+     if (mdev->blit_fields && !(surface->config.caps & DSCAPS_SEPARATED))
+          mdev->src_pitch *= 2;
+
+     D_ASSERT( mdev->src_pitch % 32 == 0 );
+
+     matrox_calc_offsets( mdev, surface, &state->src, mdev->old_matrox, mdev->src_offset );
+
+     if (!mdev->old_matrox) {
+          mga_waitfifo( mdrv, mdev, 1 );
+          mga_out32( mmio, mdev->src_offset[0][0], SRCORG );
+     }
+
+     MGA_VALIDATE( m_source );
+}
+
+void matrox_validate_SrcKey( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio    = mdrv->mmio_base;
+     CoreSurface   *surface = state->source;
+     u32            key;
+     u32            mask;
+
+     if (MGA_IS_VALID( m_SrcKey ))
+          return;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          mask = MGA_KEYMASK(surface->config.format);
+          key  = state->src_colorkey & mask;
+     } else {
+          mask = 0;
+          key  = 0xFFFF;
+     }
+
+     mga_waitfifo( mdrv, mdev, 2);
+
+     mga_out32( mmio, ((mask & 0xFFFF) << 16) | (key & 0xFFFF), TEXTRANS );
+     mga_out32( mmio, (mask & 0xFFFF0000) | (key >> 16), TEXTRANSHIGH );
+
+     MGA_VALIDATE( m_SrcKey );
+}
+
+void matrox_validate_srckey( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio    = mdrv->mmio_base;
+     CoreSurface   *surface = state->source;
+     u32            key;
+     u32            mask;
+
+     if (MGA_IS_VALID( m_srckey ))
+          return;
+
+     mask = MGA_KEYMASK(surface->config.format);
+     key  = state->src_colorkey & mask;
+
+     switch (DFB_BYTES_PER_PIXEL(state->source->config.format)) {
+          case 1:
+               mask |= mask << 8;
+               key  |= key  << 8;
+          case 2:
+               mask |= mask << 16;
+               key  |= key  << 16;
+     }
+
+     mga_waitfifo( mdrv, mdev, 2);
+     mga_out32( mmio, mask, BCOL );
+     mga_out32( mmio, key, FCOL );
+
+     MGA_VALIDATE( m_srckey );
+     MGA_INVALIDATE( m_color );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/matrox_state.h b/Source/DirectFB/gfxdrivers/matrox/matrox_state.h
new file mode 100755
index 0000000..160efe0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/matrox_state.h
@@ -0,0 +1,70 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 ___MATROX_STATE_H__
+#define ___MATROX_STATE_H__
+
+void matrox_validate_destination( MatroxDriverData *mdrv,
+                                  MatroxDeviceData *mdev,
+                                  CardState        *state );
+void matrox_set_clip( MatroxDriverData *mdrv,
+                      MatroxDeviceData *mdev,
+                      DFBRegion        *clip );
+
+void matrox_validate_drawColor( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state );
+void matrox_validate_blitColor( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state );
+void matrox_validate_color( MatroxDriverData *mdrv,
+                            MatroxDeviceData *mdev,
+                            CardState        *state );
+
+void matrox_validate_drawBlend( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state );
+void matrox_validate_blitBlend( MatroxDriverData *mdrv,
+                                MatroxDeviceData *mdev,
+                                CardState        *state );
+
+void matrox_validate_Source( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state );
+void matrox_validate_source( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state );
+
+void matrox_validate_SrcKey( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state );
+void matrox_validate_srckey( MatroxDriverData *mdrv,
+                             MatroxDeviceData *mdev,
+                             CardState        *state );
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/matrox/mmio.h b/Source/DirectFB/gfxdrivers/matrox/mmio.h
new file mode 100755
index 0000000..d897db6
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/mmio.h
@@ -0,0 +1,118 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __MATROX_MMIO_H__
+#define __MATROX_MMIO_H__
+
+#include <dfb_types.h>
+
+#include "matrox.h"
+
+static inline void
+mga_out8(volatile u8 *mmioaddr, u8 value, u32 reg)
+{
+     *((volatile u8*)(mmioaddr+reg)) = value;
+}
+
+static inline void
+mga_out32(volatile u8 *mmioaddr, u32 value, u32 reg)
+{
+#ifdef __powerpc__
+     asm volatile("stwbrx %0,%1,%2;eieio" : : "r"(value), "b"(reg), "r"(mmioaddr) : "memory");
+#else
+     *((volatile u32*)(mmioaddr+reg)) = value;
+#endif
+}
+
+static inline u8
+mga_in8(volatile u8 *mmioaddr, u32 reg)
+{
+     return *((volatile u8*)(mmioaddr+reg));
+}
+
+static inline u32
+mga_in32(volatile u8 *mmioaddr, u32 reg)
+{
+#ifdef __powerpc__
+     u32 value;
+
+     asm volatile("lwbrx %0,%1,%2;eieio" : "=r"(value) : "b"(reg), "r"(mmioaddr));
+
+     return value;
+#else
+     return *((volatile u32*)(mmioaddr+reg));
+#endif
+}
+
+/* Wait for idle accelerator and DMA */
+static inline void
+mga_waitidle(MatroxDriverData *mdrv, MatroxDeviceData *mdev)
+{
+     while ((mga_in32(mdrv->mmio_base, STATUS) & (DWGENGSTS | ENDPRDMASTS)) != mdev->idle_status) {
+          mdev->idle_waitcycles++;
+     }
+}
+
+/* Wait for fifo space */
+static inline void
+mga_waitfifo(MatroxDriverData *mdrv, MatroxDeviceData *mdev, unsigned int space)
+{
+     mdev->waitfifo_sum += space;
+     mdev->waitfifo_calls++;
+
+     if (mdev->fifo_space < space) {
+          do { /* not needed on a G400,
+                  hardware does retries on writing if FIFO is full,
+                  but results in DMA problems */
+               mdev->fifo_space = mga_in32(mdrv->mmio_base, FIFOSTATUS) & 0xff;
+               mdev->fifo_waitcycles++;
+          } while (mdev->fifo_space < space);
+     }
+     else {
+          mdev->fifo_cache_hits++;
+     }
+
+     mdev->fifo_space -= space;
+}
+
+static inline void
+mga_out_dac( volatile u8 *mmioaddr, u8 reg, u8 val )
+{
+     mga_out8( mmioaddr, reg, DAC_INDEX );
+     mga_out8( mmioaddr, val, DAC_DATA );
+}
+
+static inline u8
+mga_in_dac( volatile u8 *mmioaddr, u8 reg )
+{
+     mga_out8( mmioaddr, reg, DAC_INDEX );
+     return mga_in8( mmioaddr, DAC_DATA );
+}
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/matrox/regs.h b/Source/DirectFB/gfxdrivers/matrox/regs.h
new file mode 100755
index 0000000..a419b83
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/matrox/regs.h
@@ -0,0 +1,454 @@
+#ifndef __MATROX__REGS_H__
+#define __MATROX__REGS_H__
+
+#define U8_TO_F0915(x)          (((u32) ((x+1) << 15)) & 0x00FFFFFF)
+
+#define RS16(val)               ( (u16)((s16)(val)))
+#define RS18(val)               (((u32)((s32)(val)))&0x003ffff)
+#define RS24(val)               (((u32)((s32)(val)))&0x0ffffff)
+#define RS27(val)               (((u32)((s32)(val)))&0x7ffffff)
+
+#define DWGSYNC          0x2C4C
+#define SYNC_DMA_BUSY    0x8325340              /* just a random number */
+
+#define RST              0x1E40
+#define OPMODE           0x1E54
+
+#define CACHEFLUSH       0x1FFF
+
+/* CRTC2 registers */
+#define C2CTL            0x3C10
+#    define C2EN                0x00000001
+#    define C2PIXCLKSEL_PCICLK  0x00000000
+#    define C2PIXCLKSEL_VDOCLK  0x00000002
+#    define C2PIXCLKSEL_PIXPLL  0x00000004
+#    define C2PIXCLKSEL_VIDPLL  0x00000006 /* SYSPLL on G400 */
+#    define C2PIXCLKSEL_VDCLK   0x00004000 /* G450/G550 only */
+#    define C2PIXCLKSEL_CRISTAL 0x00004002 /* G450/G550 only */
+#    define C2PIXCLKSEL_SYSPLL  0x00004004 /* G450/G550 only */
+#    define C2PIXCLKDIS         0x00000008
+#    define CRTCDACSEL          0x00100000
+#    define C2DEPTH_15BPP       0x00200000
+#    define C2DEPTH_16BPP       0x00400000
+#    define C2DEPTH_32BPP       0x00800000
+#    define C2DEPTH_YCBCR422    0x00A00000
+#    define C2DEPTH_YCBCR420    0x00E00000
+#    define C2VCBCRSINGLE       0x01000000
+#    define C2INTERLACE         0x02000000
+#    define C2FIELDLENGTH       0x04000000
+#    define C2FIELDPOL          0x08000000
+#    define C2VIDRSTMOD_FALLING 0x00000000
+#    define C2VIDRSTMOD_RISING  0x10000000
+#    define C2VIDRSTMOD_BOTH    0x20000000
+#    define C2HPLOADEN          0x40000000
+#    define C2VPLOADEN          0x80000000
+#define C2HPARAM         0x3C14
+#define C2HSYNC          0x3C18
+#define C2VPARAM         0x3C1C
+#define C2VSYNC          0x3C20
+#define C2PRELOAD        0x3C24
+#define C2STARTADD0      0x3C28
+#define C2STARTADD1      0x3C2C
+#define C2PL2STARTADD0   0x3C30
+#define C2PL2STARTADD1   0x3C34
+#define C2PL3STARTADD0   0x3C38
+#define C2PL3STARTADD1   0x3C3C
+#define C2OFFSET         0x3C40
+#define C2MISC           0x3C44
+#    define C2HSYNCPOL          0x00000100
+#    define C2VSYNCPOL          0x00000200
+#define C2VCOUNT         0x3C48
+#    define C2FIELD             0x01000000
+#define C2DATACTL        0x3C4C
+#    define C2DITHEN            0x00000001
+#    define C2YFILTEN           0x00000002
+#    define C2CBCRFILTEN        0x00000004
+#    define C2SUBPICEN          0x00000008
+#    define C2NTSCEN            0x00000010
+#    define C2STATICKEYEN       0x00000020
+#    define C2OFFSETDIVEN       0x00000040
+#    define C2UYVYFMT           0x00000080
+#    define C2STATICKEY         0x1F000000
+#define C2SUBPICLUT      0x3C50
+#define C2SPICSTARTADD0  0x3C54
+#define C2SPICSTARTADD1  0x3C58
+
+/* Backend scaler registers */
+#define BESA1ORG         0x3D00
+#define BESA2ORG         0x3D04
+#define BESB1ORG         0x3D08
+#define BESB2ORG         0x3D0C
+#define BESA1CORG        0x3D10
+#define BESA2CORG        0x3D14
+#define BESB1CORG        0x3D18
+#define BESB2CORG        0x3D1C
+#define BESA1C3ORG       0x3D60
+#define BESA2C3ORG       0x3D64
+#define BESB1C3ORG       0x3D68
+#define BESB2C3ORG       0x3D6C
+
+#define BESCTL           0x3D20
+#    define BESEN             0x00000001
+#    define BESV1SRCSTP       0x00000040
+#    define BESV2SRCSTP       0x00000080
+#    define BESHFEN           0x00000400
+#    define BESVFEN           0x00000800
+#    define BESCUPS           0x00010000
+#    define BES420PL          0x00020000
+
+#define BESGLOBCTL       0x3DC0
+#    define BESCORDER         0x00000008
+#    define BES3PLANE         0x00000020
+#    define BESUYVYFMT        0x00000040
+#    define BESPROCAMP        0x00000080
+#    define BESRGB15          0x00000100
+#    define BESRGB16          0x00000200
+#    define BESRGB32          0x00000300
+
+#define BESHCOORD        0x3D28
+#define BESHISCAL        0x3D30
+#define BESHSRCEND       0x3D3C
+#define BESHSRCLST       0x3D50
+#define BESHSRCST        0x3D38
+#define BESLUMACTL       0x3D40
+#define BESPITCH         0x3D24
+#define BESSTATUS        0x3DC4
+#define BESV1SRCLST      0x3D54
+#define BESV2SRCLST      0x3D58
+#define BESV1WGHT        0x3D48
+#define BESV2WGHT        0x3D4C
+#define BESVCOORD        0x3D2C
+#define BESVISCAL        0x3D34
+
+/* DAC Registers */
+#define DAC_INDEX        0x3C00
+#define DAC_DATA         0x3C0A
+
+#define MGAREG_VCOUNT    0x1e20
+
+/* Alpha registers */
+
+#define ALPHASTART       0x2C70
+#define ALPHAXINC        0x2C74
+#define ALPHAYINC        0x2C78
+
+#define ALPHACTRL        0x2C7C
+#define      SRC_ZERO                    0x00000000
+#define      SRC_ONE                     0x00000001
+#define      SRC_DST_COLOR               0x00000002
+#define      SRC_ONE_MINUS_DST_COLOR     0x00000003
+#define      SRC_ALPHA                   0x00000004
+#define      SRC_ONE_MINUS_SRC_ALPHA     0x00000005
+#define      SRC_DST_ALPHA               0x00000006
+#define      SRC_ONE_MINUS_DST_ALPHA     0x00000007
+#define      SRC_SRC_ALPHA_SATURATE      0x00000008
+
+#define      DST_ZERO                    0x00000000
+#define      DST_ONE                     0x00000010
+#define      DST_SRC_COLOR               0x00000020
+#define      DST_ONE_MINUS_SRC_COLOR     0x00000030
+#define      DST_SRC_ALPHA               0x00000040
+#define      DST_ONE_MINUS_SRC_ALPHA     0x00000050
+#define      DST_DST_ALPHA               0x00000060
+#define      DST_ONE_MINUS_DST_ALPHA     0x00000070
+
+#define      ALPHACHANNEL                0x00000100
+#define      VIDEOALPHA                  0x00000200
+
+#define      DIFFUSEDALPHA               0x01000000
+#define      MODULATEDALPHA              0x02000000
+
+/* Texture registers */
+
+#define TEXCTL        0x2C30
+#define TEXCTL2       0x2C3C
+#define TEXFILTER     0x2C58
+#define TEXWIDTH      0x2C28
+#define TEXHEIGHT     0x2C2C
+#define TEXORG        0x2C24
+#define TEXORG1       0x2CA4
+#define TEXORG2       0x2CA8
+#define TEXORG3       0x2CAC
+#define TEXORG4       0x2CB0
+#define TEXTRANS      0x2C34
+#define TEXTRANSHIGH  0x2C38
+#define TDUALSTAGE0   0x2CF8
+#define TDUALSTAGE1   0x2CFC
+
+#define TMR0          0x2C00
+#define TMR1          0x2C04
+#define TMR2          0x2C08
+#define TMR3          0x2C0C
+#define TMR4          0x2C10
+#define TMR5          0x2C14
+#define TMR6          0x2C18
+#define TMR7          0x2C1C
+#define TMR8          0x2C20
+
+#define CUR_XWINDOWS    0x03
+
+/* TEXCTL */
+#define TW4           0x00000000
+#define TW8           0x00000001
+#define TW15          0x00000002
+#define TW16          0x00000003
+#define TW12          0x00000004
+
+#define TW32          0x00000006
+#define TW8A          0x00000007
+#define TW8AL         0x00000008
+#define TW422         0x0000000A
+#define TW422UYVY     0x0000000B
+
+#define TFORMAT       0x0000000F
+#define TPITCHLIN     0x00000100
+#define TPITCHEXT     0x000FFE00
+
+#define NOPERSPECTIVE 0x00200000
+#define TAKEY         0x02000000
+#define TAMASK        0x04000000
+#define CLAMPUV       0x18000000
+
+#define DECALCKEY     0x01000000
+#define TMODULATE     0x20000000
+#define STRANS        0x40000000
+
+
+/* TEXTCTL2 */
+#define IDECAL        0x00000002
+#define DECALDIS      0x00000004
+#define CKSTRANSDIS   0x00000010
+
+
+/* TEXFILTER */
+#define MIN_NRST      0x00000000
+#define MIN_BILIN     0x00000002
+#define MIN_ANISO     0x0000000D
+#define MAG_NRST      0x00000000
+#define MAG_BILIN     0x00000020
+#define FILTER_ALPHA  0x00100000
+
+/* SGN */
+#define SGN_BRKLEFT   0x00000100
+
+#define DSTORG        0x2cb8
+#define SRCORG        0x2cb4
+
+#define MACCESS        0x1C04
+#     define PW8       0x00000000
+#     define PW16      0x00000001
+#     define PW32      0x00000002
+#     define PW24      0x00000003
+#     define ZW16      0x00000000
+#     define ZW32      0x00000008
+#     define ZW15      0x00000010
+#     define ZW24      0x00000018
+#     define BYPASS332 0x10000000
+#     define TLUTLOAD  0x20000000
+#     define NODITHER  0x40000000
+#     define DIT555    0x80000000
+
+
+#define EXECUTE       0x100      /* or with register to execute a programmed
+                                    accel command */
+
+#define DWGCTL        0x1C00     /* Drawing control */
+     /* opcod - Operation code */
+#     define OP_LINE_OPEN      0x00
+#     define OP_AUTOLINE_OPEN  0x01
+#     define OP_LINE_CLOSE     0x02
+#     define OP_AUTOLINE_CLOSE 0x03
+#     define OP_TRAP           0x04
+#     define OP_TRAP_ILOAD     0x05
+#     define OP_TEXTURE_TRAP   0x06
+#     define OP_ILOAD_HIQH     0x07
+#     define OP_BITBLT         0x08
+#     define OP_ILOAD          0x09
+#     define OP_IDUMP          0x0A
+#     define OP_FBITBLT        0x0C
+#     define OP_ILOAD_SCALE    0x0D
+#     define OP_ILOAD_HIQHV    0x0E
+#     define OP_ILOAD_FILTER   0x0F
+
+     /* atype - Access type */
+#     define ATYPE_RPL         0x00
+#     define ATYPE_RSTR        0x10
+#     define ATYPE_ZI          0x30
+#     define ATYPE_BLK         0x40
+#     define ATYPE_I           0x70
+
+     /* Flag */
+#     define LINEAR            0x80
+#     define NOCLIP          (1<<31)
+#     define TRANSC          (1<<30)
+
+     /* zmode - Z drawing mode */
+#     define ZMODE_NOZCMP      0x000
+#     define ZMODE_ZE          0x200
+#     define ZMODE_ZNE         0x300
+#     define ZMODE_ZLT         0x400
+#     define ZMODE_ZLTE        0x500
+#     define ZMODE_ZGT         0x600
+#     define ZMODE_ZGTE        0x700
+
+     /* Flags */
+#     define SOLID             0x0800
+#     define ARZERO            0x1000
+#     define SGNZERO           0x2000
+#     define SHFTZERO          0x4000
+
+     /* bop - Boolean operation */
+#     define BOP_CLEAR         0x00000
+#     define BOP_NOR           0x10000
+#     define BOP_COPYINV       0x30000
+#     define BOP_INVERT        0x50000
+#     define BOP_XOR           0x60000
+#     define BOP_NAND          0x70000
+#     define BOP_AND           0x80000
+#     define BOP_EQUIV         0x90000
+#     define BOP_NOOP          0xA0000
+#     define BOP_IMP           0xB0000
+#     define BOP_COPY          0xC0000
+#     define BOP_OR            0xE0000
+#     define BOP_SET           0xF0000
+
+     /* bltmod - Blit mode selection */
+#     define BLTMOD_BMONOLEF   0x00000000
+#     define BLTMOD_BMONOWF    0x08000000
+#     define BLTMOD_BPLAN      0x02000000
+#     define BLTMOD_BFCOL      0x04000000
+#     define BLTMOD_BUYUV      0x1C000000
+#     define BLTMOD_BU32BGR    0x06000000
+#     define BLTMOD_BU32RGB    0x0E000000
+#     define BLTMOD_BU24BGR    0x16000000
+#     define BLTMOD_BU24RGB    0x1E000000
+
+#define ZORG          0x1C0C
+#define PAT0          0x1C10
+#define PAT1          0x1C14
+#define PLNWT         0x1C1C
+#define BCOL          0x1C20
+#define FCOL          0x1C24
+#define SRC0          0x1C30
+#define SRC1          0x1C34
+#define SRC2          0x1C38
+#define SRC3          0x1C3C
+#define XYSTRT        0x1C40
+#define XYEND         0x1C44
+#define SHIFT         0x1C50
+#define DMAPAD        0x1C54
+#define SGN           0x1C58
+#define LEN           0x1C5C
+#define AR0           0x1C60
+#define AR1           0x1C64
+#define AR2           0x1C68
+#define AR3           0x1C6C
+#define AR4           0x1C70
+#define AR5           0x1C74
+#define AR6           0x1C78
+#define CXBNDRY       0x1C80
+#define FXBNDRY       0x1C84
+#define YDSTLEN       0x1C88
+#define PITCH         0x1C8C
+#define YDST          0x1C90
+#define YDSTORG       0x1C94
+#define YTOP          0x1C98
+#define YBOT          0x1C9C
+#define CXLEFT        0x1CA0
+#define CXRIGHT       0x1CA4
+#define FXLEFT        0x1CA8
+#define FXRIGHT       0x1CAC
+#define XDST          0x1CB0
+#define DR0           0x1CC0
+#define DR2           0x1CC8
+#define DR3           0x1CCC
+#define DR4           0x1CD0
+#define DR6           0x1CD8
+#define DR7           0x1CDC
+#define DR8           0x1CE0
+#define WO            0x1CE4
+#define DR10          0x1CE8
+#define DR11          0x1CEC
+#define DR12          0x1CF0
+#define DR14          0x1CF8
+#define DR15          0x1CFC
+
+#define FIFOSTATUS    0x1E10
+
+#define STATUS        0x1E14
+#     define DWGENGSTS   0x10000
+#     define ENDPRDMASTS 0x20000
+
+#define IEN           0x1E1C
+
+#define BLIT_LEFT     1
+#define BLIT_UP       4
+
+
+#define SDXL          0x0002
+#define SDXR          0x0020
+
+
+/* DAC registers */
+
+#define XMISCCTRL      0x1E
+#     define DACPDN             0x01
+#     define MFCSEL_MAFC        0x02
+#     define MFCSEL_PANELLINK   0x04
+#     define MFCSEL_DIS         0x06
+#     define MFCSEL_MASK        0x06
+#     define VGA8DAC            0x08
+#     define RAMCS              0x10
+#     define VDOUTSEL_MAFC12    0x00
+#     define VDOUTSEL_BYPASS656 0x40
+#     define VDOUTSEL_CRTC2RGB  0x80
+#     define VDOUTSEL_CRTC2656  0xC0
+#     define VDOUTSEL_MASK      0xE0
+
+#define XGENIOCTRL     0x2A
+#define XGENIODATA     0x2B
+
+#define XKEYOPMODE     0x51
+
+#define XCOLMSK0RED    0x52
+#define XCOLMSK0GREEN  0x53
+#define XCOLMSK0BLUE   0x54
+
+#define XCOLKEY0RED    0x55
+#define XCOLKEY0GREEN  0x56
+#define XCOLKEY0BLUE   0x57
+
+#define XDISPCTRL      0x8A
+#     define DAC1OUTSEL_DIS     0x00
+#     define DAC1OUTSEL_EN      0x01
+#     define DAC1OUTSEL_MASK    0x01
+#     define DAC2OUTSEL_DIS     0x00
+#     define DAC2OUTSEL_CRTC1   0x04
+#     define DAC2OUTSEL_CRTC2   0x08
+#     define DAC2OUTSEL_TVE     0x0C
+#     define DAC2OUTSEL_MASK    0x0C
+#     define PANOUTSEL_DIS      0x00
+#     define PANOUTSEL_CRTC1    0x20
+#     define PANOUTSEL_CRTC2RGB 0x40
+#     define PANOUTSEL_CRTC2656 0x60
+#     define PANOUTSEL_MASK     0x60
+
+#define XSYNCCTRL      0x8B
+#     define DAC1HSOFF          0x01
+#     define DAC1VSOFF          0x02
+#     define DAC1HSPOL          0x04
+#     define DAC1VSPOL          0x08
+#     define DAC2HSOFF          0x10
+#     define DAC2VSOFF          0x20
+#     define DAC2HSPOL          0x40
+#     define DAC2VSPOL          0x80
+
+#define XPWRCTRL       0xA0
+#     define DAC2PDN            0x01
+#     define VIDPLLPDN          0x02
+#     define PANPDN             0x04
+#     define RFIFOPDN           0x08
+#     define CFIFOPDN           0x10
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/neomagic/Makefile.am b/Source/DirectFB/gfxdrivers/neomagic/Makefile.am
new file mode 100755
index 0000000..24a850f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/Makefile.am
@@ -0,0 +1,35 @@
+## Makefile.am for DirectFB/gfxdrivers/neomagic
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+neomagic_LTLIBRARIES = libdirectfb_neomagic.la
+
+if BUILD_STATIC
+neomagic_DATA = $(neomagic_LTLIBRARIES:.la=.o)
+endif
+
+neomagicdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_neomagic_la_SOURCES =	\
+	neomagic.c	\
+	neomagic.h	\
+	neo_overlay.c	\
+	neo2200.c
+
+libdirectfb_neomagic_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_neomagic_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/gfxdrivers/neomagic/Makefile.in b/Source/DirectFB/gfxdrivers/neomagic/Makefile.in
new file mode 100755
index 0000000..1613ab6
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/Makefile.in
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = gfxdrivers/neomagic
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(neomagicdir)" \
+	"$(DESTDIR)$(neomagicdir)"
+neomagicLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(neomagic_LTLIBRARIES)
+libdirectfb_neomagic_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_neomagic_la_OBJECTS = neomagic.lo neo_overlay.lo \
+	neo2200.lo
+libdirectfb_neomagic_la_OBJECTS =  \
+	$(am_libdirectfb_neomagic_la_OBJECTS)
+libdirectfb_neomagic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_neomagic_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libdirectfb_neomagic_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_neomagic_la_SOURCES)
+neomagicDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(neomagic_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+neomagic_LTLIBRARIES = libdirectfb_neomagic.la
+@BUILD_STATIC_TRUE@neomagic_DATA = $(neomagic_LTLIBRARIES:.la=.o)
+neomagicdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_neomagic_la_SOURCES = \
+	neomagic.c	\
+	neomagic.h	\
+	neo_overlay.c	\
+	neo2200.c
+
+libdirectfb_neomagic_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_neomagic_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/libobject.make $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  gfxdrivers/neomagic/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/neomagic/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-neomagicLTLIBRARIES: $(neomagic_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(neomagicdir)" || $(MKDIR_P) "$(DESTDIR)$(neomagicdir)"
+	@list='$(neomagic_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(neomagicLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(neomagicdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(neomagicLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(neomagicdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-neomagicLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(neomagic_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(neomagicdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(neomagicdir)/$$p"; \
+	done
+
+clean-neomagicLTLIBRARIES:
+	-test -z "$(neomagic_LTLIBRARIES)" || rm -f $(neomagic_LTLIBRARIES)
+	@list='$(neomagic_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libdirectfb_neomagic.la: $(libdirectfb_neomagic_la_OBJECTS) $(libdirectfb_neomagic_la_DEPENDENCIES) 
+	$(libdirectfb_neomagic_la_LINK) -rpath $(neomagicdir) $(libdirectfb_neomagic_la_OBJECTS) $(libdirectfb_neomagic_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neo2200.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neo_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neomagic.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-neomagicDATA: $(neomagic_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(neomagicdir)" || $(MKDIR_P) "$(DESTDIR)$(neomagicdir)"
+	@list='$(neomagic_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(neomagicDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(neomagicdir)/$$f'"; \
+	  $(neomagicDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(neomagicdir)/$$f"; \
+	done
+
+uninstall-neomagicDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(neomagic_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(neomagicdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(neomagicdir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(neomagicdir)" "$(DESTDIR)$(neomagicdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-neomagicLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-neomagicDATA install-neomagicLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-neomagicDATA uninstall-neomagicLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-neomagicLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-neomagicDATA install-neomagicLTLIBRARIES install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-neomagicDATA \
+	uninstall-neomagicLTLIBRARIES
+
+%.o: .libs/%.a %.la
+	rm -f $<.tmp/*.o
+	if test -d $<.tmp; then rmdir $<.tmp; fi
+	mkdir $<.tmp
+	(cd $<.tmp && $(AR) x ../../$<)
+	$(LD) -o $@ -r $<.tmp/*.o
+	rm -f $<.tmp/*.o && rmdir $<.tmp
+
+.PHONY: $(LTLIBRARIES:%.la=.libs/%.a)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Source/DirectFB/gfxdrivers/neomagic/neo2200.c b/Source/DirectFB/gfxdrivers/neomagic/neo2200.c
new file mode 100755
index 0000000..4ac54ac
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/neo2200.c
@@ -0,0 +1,570 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.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 <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/screens.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "neomagic.h"
+
+typedef volatile struct {
+  u32 bltStat;
+  u32 bltCntl;
+  u32 xpColor;
+  u32 fgColor;
+  u32 bgColor;
+  u32 pitch;
+  u32 clipLT;
+  u32 clipRB;
+  u32 srcBitOffset;
+  u32 srcStart;
+  u32 reserved0;
+  u32 dstStart;
+  u32 xyExt;
+
+  u32 reserved1[19];
+
+  u32 pageCntl;
+  u32 pageBase;
+  u32 postBase;
+  u32 postPtr;
+  u32 dataPtr;
+} Neo2200;
+
+typedef struct {
+     NeoDeviceData neo;
+
+     int dstOrg;
+     int dstPitch;
+     int dstPixelWidth;
+
+     int srcOrg;
+     int srcPitch;
+     int srcPixelWidth;
+
+     u32 bltCntl;
+
+     bool src_dst_equal;
+
+     /* state validation */
+     int n_bltMode_dst;
+     int n_src;
+     int n_fgColor;
+     int n_xpColor;
+} Neo2200DeviceData;
+
+typedef struct {
+     NeoDriverData neo;
+
+     Neo2200 *neo2200;
+} Neo2200DriverData;
+
+
+static inline void neo2200_waitidle( Neo2200DriverData *ndrv,
+                                     Neo2200DeviceData *ndev )
+{
+     while (ndrv->neo2200->bltStat & 1)
+          ndev->neo.idle_waitcycles++;
+}
+
+static inline void neo2200_waitfifo( Neo2200DriverData *ndrv,
+                                     Neo2200DeviceData *ndev,
+                                     int requested_fifo_space )
+{
+  ndev->neo.waitfifo_calls++;
+  ndev->neo.waitfifo_sum += requested_fifo_space;
+
+  /* FIXME: does not work
+  if (neo_fifo_space < requested_fifo_space)
+    {
+      neo_fifo_waitcycles++;
+
+      while (1)
+    {
+      neo_fifo_space = (neo2200->bltStat >> 8);
+      if (neo_fifo_space >= requested_fifo_space)
+        break;
+    }
+    }
+  else
+    {
+      neo_fifo_cache_hits++;
+    }
+
+  neo_fifo_space -= requested_fifo_space;
+  */
+
+  neo2200_waitidle( ndrv, ndev );
+}
+
+
+
+static inline void neo2200_validate_bltMode_dst( Neo2200DriverData     *ndrv,
+                                                 Neo2200DeviceData     *ndev,
+                                                 CoreSurface           *dst,
+                                                 CoreSurfaceBufferLock *lock )
+{
+  int bltMode = 0;
+
+  if (ndev->n_bltMode_dst)
+    return;
+
+  switch (dst->config.format)
+    {
+    case DSPF_A8:
+    case DSPF_LUT8:
+    case DSPF_RGB332:
+      bltMode |= NEO_MODE1_DEPTH8;
+      break;
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+    case DSPF_YUY2:
+      bltMode |= NEO_MODE1_DEPTH16;
+      break;
+    default:
+      D_BUG( "unexpected pixelformat!" );
+      break;
+    }
+
+  ndev->dstOrg = lock->offset;
+  ndev->dstPitch = lock->pitch;
+  ndev->dstPixelWidth = DFB_BYTES_PER_PIXEL(dst->config.format);
+
+
+  neo2200_waitfifo( ndrv, ndev, 2 );
+
+  ndrv->neo2200->bltStat = bltMode << 16;
+  ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff);
+
+
+  ndev->n_bltMode_dst = 1;
+}
+
+static inline void neo2200_validate_src( Neo2200DriverData     *ndrv,
+                                         Neo2200DeviceData     *ndev,
+                                         CoreSurface           *src,
+                                         CoreSurfaceBufferLock *lock )
+{
+  if (ndev->n_src)
+    return;
+
+  ndev->srcOrg = lock->offset;
+  ndev->srcPitch = lock->pitch;
+  ndev->srcPixelWidth = DFB_BYTES_PER_PIXEL(src->config.format);
+
+  neo2200_waitfifo( ndrv, ndev, 1 );
+  ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff);
+
+  ndev->n_src = 1;
+}
+
+static inline void neo2200_validate_fgColor( Neo2200DriverData *ndrv,
+                                             Neo2200DeviceData *ndev,
+                                             CardState         *state )
+{
+  if (ndev->n_fgColor)
+    return;
+
+  neo2200_waitfifo( ndrv, ndev, 1 );
+
+  switch (state->destination->config.format)
+    {
+    case DSPF_A8:
+      ndrv->neo2200->fgColor = state->color.a;
+      break;
+    case DSPF_LUT8:
+      ndrv->neo2200->fgColor = state->color_index;
+      break;
+    case DSPF_RGB332:
+      ndrv->neo2200->fgColor = PIXEL_RGB332( state->color.r,
+                                             state->color.g,
+                                             state->color.b );
+      break;
+    case DSPF_ARGB1555:
+      ndrv->neo2200->fgColor = PIXEL_ARGB1555( state->color.a,
+                                               state->color.r,
+                                               state->color.g,
+                                               state->color.b );
+      break;
+    case DSPF_RGB16:
+      ndrv->neo2200->fgColor = PIXEL_RGB16( state->color.r,
+                                            state->color.g,
+                                            state->color.b );
+      break;
+    default:
+      D_BUG( "unexpected pixelformat!" );
+      break;
+    }
+
+  ndev->n_fgColor = 1;
+}
+
+static inline void neo2200_validate_xpColor( Neo2200DriverData *ndrv,
+                                             Neo2200DeviceData *ndev,
+                                             CardState         *state )
+{
+  if (ndev->n_xpColor)
+    return;
+
+  neo2200_waitfifo( ndrv, ndev, 1 );
+
+  ndrv->neo2200->xpColor = state->src_colorkey;
+
+  ndev->n_xpColor = 1;
+}
+
+
+/* required implementations */
+
+static DFBResult neo2200EngineSync( void *drv, void *dev )
+{
+     Neo2200DriverData *ndrv = (Neo2200DriverData*) drv;
+     Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev;
+
+     neo2200_waitidle( ndrv, ndev );
+
+     return DFB_OK;
+}
+
+#define NEO_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_NOFX)
+
+#define NEO_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE)
+
+#define NEO_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define NEO_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT)
+
+static void neo2200CheckState( void *drv, void *dev,
+                               CardState *state, DFBAccelerationMask accel )
+{
+  switch (state->destination->config.format)
+    {
+    case DSPF_A8:
+    case DSPF_LUT8:
+    case DSPF_RGB332:
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+      break;
+    case DSPF_YUY2:
+      if (accel == DFXL_BLIT)
+        break;
+    default:
+      return;
+    }
+
+  if (DFB_DRAWING_FUNCTION(accel))
+    {
+      /* if the function is supported and there are no other
+         drawing flags than the supported */
+      if (!(accel & ~NEO_SUPPORTED_DRAWINGFUNCTIONS) &&
+          !(state->drawingflags & ~NEO_SUPPORTED_DRAWINGFLAGS))
+        state->accel |= accel;
+    }
+  else
+    {
+      /* if the function is supported, there are no other
+         blitting flags than the supported, the source and
+         destination formats are the same and the source and dest.
+         are different due to a blitting bug */
+      if (!(accel & ~NEO_SUPPORTED_BLITTINGFUNCTIONS)             &&
+          !(state->blittingflags & ~NEO_SUPPORTED_BLITTINGFLAGS)  &&
+          state->source->config.format == state->destination->config.format)
+        state->accel |= accel;
+    }
+}
+
+static void neo2200SetState( void *drv, void *dev,
+                             GraphicsDeviceFuncs *funcs,
+                             CardState *state, DFBAccelerationMask accel )
+{
+     Neo2200DriverData *ndrv = (Neo2200DriverData*) drv;
+     Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev;
+
+     if (state->mod_hw & SMF_DESTINATION)
+          ndev->n_fgColor = ndev->n_bltMode_dst = 0;
+     else if (state->mod_hw & SMF_COLOR)
+          ndev->n_fgColor = 0;
+
+     if (state->mod_hw & SMF_SOURCE)
+          ndev->n_src = 0;
+
+     if (state->mod_hw & SMF_SRC_COLORKEY)
+          ndev->n_xpColor = 0;
+
+     neo2200_validate_bltMode_dst( ndrv, ndev, state->destination, &state->dst );
+
+     switch (accel) {
+          case DFXL_BLIT:
+               neo2200_validate_src( ndrv, ndev, state->source, &state->src );
+
+               ndev->src_dst_equal = (state->src.buffer ==
+                                      state->dst.buffer);
+
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+                    ndev->bltCntl = NEO_BC0_SRC_TRANS;
+                    neo2200_validate_xpColor( ndrv, ndev, state );
+               }
+               else
+                    ndev->bltCntl = 0;
+
+               state->set |= DFXL_BLIT;
+               break;
+
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+               neo2200_validate_fgColor( ndrv, ndev, state );
+
+               state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function!" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static bool neo2200FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Neo2200DriverData *ndrv    = (Neo2200DriverData*) drv;
+     Neo2200DeviceData *ndev    = (Neo2200DeviceData*) dev;
+     Neo2200           *neo2200 = ndrv->neo2200;
+
+     neo2200_waitfifo( ndrv, ndev, 3 );
+
+     /* set blt control */
+     neo2200->bltCntl = NEO_BC3_FIFO_EN      |
+                     NEO_BC0_SRC_IS_FG    |
+                     NEO_BC3_SKIP_MAPPING |  0x0c0000;
+
+     neo2200->dstStart = ndev->dstOrg +
+           (rect->y * ndev->dstPitch) +
+           (rect->x * ndev->dstPixelWidth);
+
+     neo2200->xyExt    = (rect->h << 16) | (rect->w & 0xffff);
+
+     return true;
+}
+
+static bool neo2200DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Neo2200DriverData *ndrv    = (Neo2200DriverData*) drv;
+     Neo2200DeviceData *ndev    = (Neo2200DeviceData*) dev;
+     Neo2200           *neo2200 = ndrv->neo2200;
+
+     u32 dst = ndev->dstOrg +
+              (rect->y * ndev->dstPitch) +
+              (rect->x * ndev->dstPixelWidth);
+
+     neo2200_waitfifo( ndrv, ndev, 3 );
+
+     /* set blt control */
+     neo2200->bltCntl = NEO_BC3_FIFO_EN      |
+                        NEO_BC0_SRC_IS_FG    |
+                        NEO_BC3_SKIP_MAPPING | 0x0c0000;
+
+     neo2200->dstStart = dst;
+     neo2200->xyExt    = (1 << 16) | (rect->w & 0xffff);
+
+
+     dst += (rect->h - 1) * ndev->dstPitch;
+     neo2200_waitfifo( ndrv, ndev, 2 );
+     neo2200->dstStart = dst;
+     neo2200->xyExt    = (1 << 16) | (rect->w & 0xffff);
+
+
+     dst -= (rect->h - 2) * ndev->dstPitch;
+     neo2200_waitfifo( ndrv, ndev, 2 );
+     neo2200->dstStart = dst;
+     neo2200->xyExt    = ((rect->h - 2) << 16) | 1;
+
+
+     dst += (rect->w - 1) * ndev->dstPixelWidth;
+     neo2200_waitfifo( ndrv, ndev, 2 );
+     neo2200->dstStart = dst;
+     neo2200->xyExt    = ((rect->h - 2) << 16) | 1;
+
+     return true;
+}
+
+static bool neo2200Blit( void *drv, void *dev,
+                         DFBRectangle *rect, int dx, int dy )
+{
+     Neo2200DriverData *ndrv    = (Neo2200DriverData*) drv;
+     Neo2200DeviceData *ndev    = (Neo2200DeviceData*) dev;
+     Neo2200           *neo2200 = ndrv->neo2200;
+
+     u32 src_start, dst_start;
+     u32 bltCntl = ndev->bltCntl;
+
+//     fprintf(stderr, "blit: %d, %d (%dx%d) -> %d, %d\n",
+//             rect->x, rect->y, rect->w, rect->h, dx, dy);
+
+/*     if (rect->x < dx) {
+          //rect->x += rect->w - 1;
+          //dx      += rect->w - 1;
+
+          bltCntl |= NEO_BC0_X_DEC;
+     }
+
+     if (rect->y < dy) {
+          //rect->y += rect->h - 1;
+          //dy      += rect->h - 1;
+
+          bltCntl |= NEO_BC0_DST_Y_DEC | NEO_BC0_SRC_Y_DEC;
+     }
+*/
+     /* ARGH, the above code for the blitting direction doesn't work. */
+     if (ndev->src_dst_equal && (rect->x < dx || rect->y < dy))
+          return false;
+
+     src_start = rect->y * ndev->srcPitch + rect->x * ndev->srcPixelWidth;
+     dst_start = dy * ndev->dstPitch + dx * ndev->dstPixelWidth;
+
+     neo2200_waitfifo( ndrv, ndev, 4 );
+
+     /* set blt control */
+     neo2200->bltCntl  = bltCntl |
+                         NEO_BC3_FIFO_EN      |
+                         NEO_BC3_SKIP_MAPPING |  0x0c0000;
+
+     /* set start addresses */
+     neo2200->srcStart = ndev->srcOrg + src_start;
+     neo2200->dstStart = ndev->dstOrg + dst_start;
+
+     /* set size */
+     neo2200->xyExt    = (rect->h << 16) | (rect->w & 0xffff);
+
+     return true;
+}
+
+
+
+void
+neo2200_get_info( CoreGraphicsDevice *device,
+                  GraphicsDriverInfo *info )
+{
+     info->version.major = 0;
+     info->version.minor = 3;
+
+     info->driver_data_size = sizeof (Neo2200DriverData);
+     info->device_data_size = sizeof (Neo2200DeviceData);
+}
+
+DFBResult
+neo2200_init_driver( CoreGraphicsDevice  *device,
+                     GraphicsDeviceFuncs *funcs,
+                     void                *driver_data )
+{
+     Neo2200DriverData *ndrv = (Neo2200DriverData*) driver_data;
+
+     ndrv->neo2200 = (Neo2200*) ndrv->neo.mmio_base;
+
+     funcs->CheckState = neo2200CheckState;
+     funcs->SetState = neo2200SetState;
+     funcs->EngineSync = neo2200EngineSync;
+
+     funcs->FillRectangle = neo2200FillRectangle;
+     funcs->DrawRectangle = neo2200DrawRectangle;
+     //     funcs->DrawLine = neoDrawLine2D;
+     funcs->Blit = neo2200Blit;
+     //     funcs->StretchBlit = neoStretchBlit;
+
+     /* overlay support */
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                          driver_data, &neoOverlayFuncs );
+     return DFB_OK;
+}
+
+DFBResult
+neo2200_init_device( CoreGraphicsDevice *device,
+                     GraphicsDeviceInfo *device_info,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "2200/2230/2360/2380" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "NeoMagic" );
+
+
+     device_info->caps.flags    = 0;
+     device_info->caps.accel    = NEO_SUPPORTED_DRAWINGFUNCTIONS |
+                                  NEO_SUPPORTED_BLITTINGFUNCTIONS;
+     device_info->caps.drawing  = NEO_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = NEO_SUPPORTED_BLITTINGFLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 32 * 4;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     return DFB_OK;
+}
+
+void
+neo2200_close_device( CoreGraphicsDevice *device,
+                      void               *driver_data,
+                      void               *device_data )
+{
+}
+
+void
+neo2200_close_driver( CoreGraphicsDevice *device,
+                      void               *driver_data )
+{
+}
+
diff --git a/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c b/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c
new file mode 100755
index 0000000..b0d4c42
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c
@@ -0,0 +1,349 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <sys/io.h>
+
+#include <core/coredefs.h>
+#include <core/layers.h>
+#include <core/surface.h>
+
+#include "neomagic.h"
+
+typedef struct {
+     CoreLayerRegionConfig config;
+
+     /* overlay registers */
+     struct {
+          u32 OFFSET;
+          u16 PITCH;
+          u16 X1;
+          u16 X2;
+          u16 Y1;
+          u16 Y2;
+          u16 HSCALE;
+          u16 VSCALE;
+          u8  CONTROL;
+     } regs;
+} NeoOverlayLayerData;
+
+static void ovl_set_regs ( NeoDriverData         *ndrv,
+                           NeoOverlayLayerData   *novl );
+static void ovl_calc_regs( NeoDriverData         *ndrv,
+                           NeoOverlayLayerData   *novl,
+                           CoreLayerRegionConfig *config,
+                           CoreSurface           *surface,
+                           CoreSurfaceBufferLock *lock );
+
+#define NEO_OVERLAY_SUPPORTED_OPTIONS   (DLOP_NONE)
+
+/**********************/
+
+static int
+ovlLayerDataSize( void )
+{
+     return sizeof(NeoOverlayLayerData);
+}
+
+static DFBResult
+ovlInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *default_config,
+              DFBColorAdjustment         *default_adj )
+{
+     /* set capabilities and type */
+     description->caps = DLCAPS_SCREEN_LOCATION | DLCAPS_SURFACE |
+                         DLCAPS_BRIGHTNESS;
+     description->type = DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "NeoMagic Overlay" );
+
+     /* fill out the default configuration */
+     default_config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT |
+                                   DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                                   DLCONF_OPTIONS;
+     default_config->width       = 640;
+     default_config->height      = 480;
+     default_config->pixelformat = DSPF_YUY2;
+     default_config->buffermode  = DLBM_FRONTONLY;
+     default_config->options     = DLOP_NONE;
+
+     /* fill out default color adjustment,
+        only fields set in flags will be accepted from applications */
+     default_adj->flags      = DCAF_BRIGHTNESS;
+     default_adj->brightness = 0x8000;
+
+     /* FIXME: use mmio */
+     if (iopl(3) < 0) {
+          D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" );
+          return DFB_UNSUPPORTED;
+     }
+
+     neo_unlock();
+
+     /* reset overlay */
+     OUTGR(0xb0, 0x00);
+
+     /* reset brightness */
+     OUTGR(0xc4, 0x00);
+
+     /* disable capture */
+     OUTGR(0x0a, 0x21);
+     OUTSR(0x08, 0xa0);
+     OUTGR(0x0a, 0x01);
+
+     neo_lock();
+     
+     return DFB_OK;
+}
+
+
+static void
+ovlOnOff( NeoDriverData       *ndrv,
+          NeoOverlayLayerData *novl,
+          int                  on )
+{
+     /* set/clear enable bit */
+     if (on)
+          novl->regs.CONTROL = 0x01;
+     else
+          novl->regs.CONTROL = 0x00;
+
+     /* FIXME: use mmio */
+     if (iopl(3) < 0) {
+          D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" );
+          return;
+     }
+
+     /* write back to card */
+     neo_unlock();
+     OUTGR(0xb0, novl->regs.CONTROL);
+     neo_lock();
+}
+
+static DFBResult
+ovlTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     /* check for unsupported options */
+     if (config->options & ~NEO_OVERLAY_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_YUY2:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     /* check width */
+     if (config->width > 1024 || config->width < 160)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 1024 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     NeoDriverData       *ndrv = (NeoDriverData*) driver_data;
+     NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data;
+
+     /* remember configuration */
+     novl->config = *config;
+
+     ovl_calc_regs( ndrv, novl, config, surface, lock );
+     ovl_set_regs( ndrv, novl );
+
+     /* enable overlay */
+     ovlOnOff( ndrv, novl, config->opacity );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     NeoDriverData       *ndrv = (NeoDriverData*) driver_data;
+     NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data;
+
+     /* disable overlay */
+     ovlOnOff( ndrv, novl, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlFlipRegion(  CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreSurface           *surface,
+                DFBSurfaceFlipFlags    flags,
+                CoreSurfaceBufferLock *lock )
+{
+     NeoDriverData       *ndrv = (NeoDriverData*) driver_data;
+     NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data;
+#if 0
+     bool                 onsync  = (flags & DSFLIP_WAITFORSYNC);
+
+     if (onsync)
+          dfb_fbdev_wait_vsync();
+#endif
+
+     dfb_surface_flip( surface, false );
+
+     ovl_calc_regs( ndrv, novl, &novl->config, surface, lock );
+     ovl_set_regs( ndrv, novl );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlSetColorAdjustment( CoreLayer          *layer,
+                       void               *driver_data,
+                       void               *layer_data,
+                       DFBColorAdjustment *adj )
+{
+     /* FIXME: use mmio */
+     if (iopl(3) < 0) {
+          D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" );
+          return DFB_UNSUPPORTED;
+     }
+
+     neo_unlock();
+     OUTGR(0xc4, (signed char)((adj->brightness >> 8) -128));
+     neo_lock();
+
+     return DFB_OK;
+}
+
+
+DisplayLayerFuncs neoOverlayFuncs = {
+     .LayerDataSize      = ovlLayerDataSize,
+     .InitLayer          = ovlInitLayer,
+     .SetRegion          = ovlSetRegion,
+     .RemoveRegion       = ovlRemoveRegion,
+     .TestRegion         = ovlTestRegion,
+     .FlipRegion         = ovlFlipRegion,
+     .SetColorAdjustment = ovlSetColorAdjustment,
+};
+
+
+/* internal */
+
+static void ovl_set_regs( NeoDriverData *ndrv, NeoOverlayLayerData *novl )
+{
+     /* FIXME: use mmio */
+     if (iopl(3) < 0) {
+          D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" );
+          return;
+     }
+
+     neo_unlock();
+
+     OUTGR(0xb1, ((novl->regs.X2 >> 4) & 0xf0) | (novl->regs.X1 >> 8));
+     OUTGR(0xb2, novl->regs.X1);
+     OUTGR(0xb3, novl->regs.X2);
+     OUTGR(0xb4, ((novl->regs.Y2 >> 4) & 0xf0) | (novl->regs.Y1 >> 8));
+     OUTGR(0xb5, novl->regs.Y1);
+     OUTGR(0xb6, novl->regs.Y2);
+     OUTGR(0xb7, novl->regs.OFFSET >> 16);
+     OUTGR(0xb8, novl->regs.OFFSET >>  8);
+     OUTGR(0xb9, novl->regs.OFFSET);
+     OUTGR(0xba, novl->regs.PITCH >> 8);
+     OUTGR(0xbb, novl->regs.PITCH);
+     OUTGR(0xbc, 0x2e);  /* Neo2160: 0x4f */
+     OUTGR(0xbd, 0x02);
+     OUTGR(0xbe, 0x00);
+     OUTGR(0xbf, 0x02);
+
+     OUTGR(0xc0, novl->regs.HSCALE >> 8);
+     OUTGR(0xc1, novl->regs.HSCALE);
+     OUTGR(0xc2, novl->regs.VSCALE >> 8);
+     OUTGR(0xc3, novl->regs.VSCALE);
+
+     neo_lock();
+}
+
+static void ovl_calc_regs( NeoDriverData         *ndrv,
+                           NeoOverlayLayerData   *novl,
+                           CoreLayerRegionConfig *config,
+                           CoreSurface           *surface,
+                           CoreSurfaceBufferLock *lock )
+{
+     /* fill register struct */
+     novl->regs.X1     = config->dest.x;
+     novl->regs.X2     = config->dest.x + config->dest.w - 1;
+
+     novl->regs.Y1     = config->dest.y;
+     novl->regs.Y2     = config->dest.y + config->dest.h - 1;
+
+     novl->regs.OFFSET = lock->offset;
+     novl->regs.PITCH  = lock->pitch;
+
+     novl->regs.HSCALE = (surface->config.size.w  << 12) / (config->dest.w + 1);
+     novl->regs.VSCALE = (surface->config.size.h << 12) / (config->dest.h + 1);
+}
+
diff --git a/Source/DirectFB/gfxdrivers/neomagic/neomagic.c b/Source/DirectFB/gfxdrivers/neomagic/neomagic.c
new file mode 100755
index 0000000..7eee15f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/neomagic.c
@@ -0,0 +1,223 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <core/graphics_driver.h>
+
+
+DFB_GRAPHICS_DRIVER( neomagic )
+
+#include "neomagic.h"
+
+/* for fifo/performance monitoring */
+//unsigned int neo_fifo_space = 0;
+
+
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               return 1;
+     }
+
+     return 0;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+               "NeoMagic Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 0;
+
+     info->driver_data_size = sizeof (NeoDriverData);
+     info->device_data_size = sizeof (NeoDeviceData);
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               neo2200_get_info( device, info );
+               break;
+     }
+}
+
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     NeoDriverData *ndrv = (NeoDriverData*) driver_data;
+
+     ndrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!ndrv->mmio_base)
+          return DFB_IO;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               return neo2200_init_driver( device, funcs, driver_data );
+     }
+
+     return DFB_BUG;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     /* use polling for syncing, artefacts occur otherwise */
+     dfb_config->pollvsync_after = 1;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               return neo2200_init_device( device, device_info,
+                                           driver_data, device_data );
+     }
+
+     return DFB_BUG;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     NeoDeviceData *ndev = (NeoDeviceData*) device_data;
+
+     (void) ndev;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               neo2200_close_device( device, driver_data, device_data );
+     }
+
+     D_DEBUG( "DirectFB/NEO: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/NEO:  %9d neo_waitfifo calls\n",
+               ndev->waitfifo_calls );
+     D_DEBUG( "DirectFB/NEO:  %9d register writes (neo_waitfifo sum)\n",
+               ndev->waitfifo_sum );
+     D_DEBUG( "DirectFB/NEO:  %9d FIFO wait cycles (depends on CPU)\n",
+               ndev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/NEO:  %9d IDLE wait cycles (depends on CPU)\n",
+               ndev->idle_waitcycles );
+     D_DEBUG( "DirectFB/NEO:  %9d FIFO space cache hits(depends on CPU)\n",
+               ndev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/NEO: Conclusion:\n" );
+     D_DEBUG( "DirectFB/NEO:  Average register writes/neo_waitfifo"
+               "call:%.2f\n",
+               ndev->waitfifo_sum/(float)(ndev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/NEO:  Average wait cycles/neo_waitfifo call:"
+               " %.2f\n",
+               ndev->fifo_waitcycles/(float)(ndev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/NEO:  Average fifo space cache hits: %02d%%\n",
+               (int)(100 * ndev->fifo_cache_hits/
+               (float)(ndev->waitfifo_calls)) );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     NeoDriverData *ndrv = (NeoDriverData*) driver_data;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          /* no support for other NeoMagic cards yet */
+          case 95:        /* NM2200 */
+          case 96:        /* NM2230 */
+          case 97:        /* NM2360 */
+          case 98:        /* NM2380 */
+               neo2200_close_driver( device, driver_data );
+     }
+
+     dfb_gfxcard_unmap_mmio( device, ndrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/neomagic/neomagic.h b/Source/DirectFB/gfxdrivers/neomagic/neomagic.h
new file mode 100755
index 0000000..d388faf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/neomagic/neomagic.h
@@ -0,0 +1,147 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NEOMAGIC_H__
+#define __NEOMAGIC_H__
+
+#include <dfb_types.h>
+#include <sys/io.h>
+
+#include <core/gfxcard.h>
+#include <core/layers.h>
+
+typedef struct {
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+} NeoDeviceData;
+
+typedef struct {
+     volatile u8 *mmio_base;
+} NeoDriverData;
+
+extern DisplayLayerFuncs neoOverlayFuncs;
+
+void
+neo2200_get_info( CoreGraphicsDevice *device,
+                  GraphicsDriverInfo *info );
+
+DFBResult
+neo2200_init_driver( CoreGraphicsDevice  *device,
+                     GraphicsDeviceFuncs *funcs,
+                     void                *driver_data );
+
+DFBResult
+neo2200_init_device( CoreGraphicsDevice *device,
+                     GraphicsDeviceInfo *device_info,
+                     void               *driver_data,
+                     void               *device_data );
+
+void
+neo2200_close_device( CoreGraphicsDevice *device,
+                      void               *driver_data,
+                      void               *device_data );
+
+void
+neo2200_close_driver( CoreGraphicsDevice *device,
+                      void               *driver_data );
+
+
+#define NEO_BS0_BLT_BUSY        0x00000001
+#define NEO_BS0_FIFO_AVAIL      0x00000002
+#define NEO_BS0_FIFO_PEND       0x00000004
+
+#define NEO_BC0_DST_Y_DEC       0x00000001
+#define NEO_BC0_X_DEC           0x00000002
+#define NEO_BC0_SRC_TRANS       0x00000004
+#define NEO_BC0_SRC_IS_FG       0x00000008
+#define NEO_BC0_SRC_Y_DEC       0x00000010
+#define NEO_BC0_FILL_PAT        0x00000020
+#define NEO_BC0_SRC_MONO        0x00000040
+#define NEO_BC0_SYS_TO_VID      0x00000080
+
+#define NEO_BC1_DEPTH8          0x00000100
+#define NEO_BC1_DEPTH16         0x00000200
+#define NEO_BC1_X_320           0x00000400
+#define NEO_BC1_X_640           0x00000800
+#define NEO_BC1_X_800           0x00000c00
+#define NEO_BC1_X_1024          0x00001000
+#define NEO_BC1_X_1152          0x00001400
+#define NEO_BC1_X_1280          0x00001800
+#define NEO_BC1_X_1600          0x00001c00
+#define NEO_BC1_DST_TRANS       0x00002000
+#define NEO_BC1_MSTR_BLT        0x00004000
+#define NEO_BC1_FILTER_Z        0x00008000
+
+#define NEO_BC2_WR_TR_DST       0x00800000
+
+#define NEO_BC3_SRC_XY_ADDR     0x01000000
+#define NEO_BC3_DST_XY_ADDR     0x02000000
+#define NEO_BC3_CLIP_ON         0x04000000
+#define NEO_BC3_FIFO_EN         0x08000000
+#define NEO_BC3_BLT_ON_ADDR     0x10000000
+#define NEO_BC3_SKIP_MAPPING    0x80000000
+
+#define NEO_MODE1_DEPTH8        0x0100
+#define NEO_MODE1_DEPTH16       0x0200
+#define NEO_MODE1_DEPTH24       0x0300
+#define NEO_MODE1_X_320         0x0400
+#define NEO_MODE1_X_640         0x0800
+#define NEO_MODE1_X_800         0x0c00
+#define NEO_MODE1_X_1024        0x1000
+#define NEO_MODE1_X_1152        0x1400
+#define NEO_MODE1_X_1280        0x1800
+#define NEO_MODE1_X_1600        0x1c00
+#define NEO_MODE1_BLT_ON_ADDR   0x2000
+
+
+static inline void OUTGR (u8 index, u8 data)
+{
+     outb (index, 0x3ce);
+     outb (data, 0x3cf);
+}
+
+static inline void OUTSR (u8 index, u8 data)
+{
+     outb (index, 0x3c4);
+     outb (data, 0x3c5);
+}
+
+static inline void neo_lock( void )
+{
+     OUTGR(0x09, 0x00);
+}
+
+static inline void neo_unlock( void )
+{
+     OUTGR(0x09, 0x26);
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/nsc/Makefile.am b/Source/DirectFB/gfxdrivers/nsc/Makefile.am
new file mode 100755
index 0000000..95b0d7d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/Makefile.am
@@ -0,0 +1,40 @@
+## Makefile.am for DirectFB/gfxdrivers/nsc
+
+SUBDIRS = include
+
+INCLUDES = \
+	-I/usr/src/linux/drivers/video/nsc \
+	-I/usr/src/linux/drivers/video/nsc/gfx \
+	-I/usr/src/linux/drivers/video/nsc/panel \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/systems \
+	-I$(top_srcdir)/gfxdrivers/nsc/include
+
+nsc_LTLIBRARIES = libdirectfb_nsc.la
+
+if BUILD_STATIC
+nsc_DATA = $(nsc_LTLIBRARIES:.la=.o)
+endif
+
+nscdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_nsc_la_SOURCES =	\
+	nsc.c	\
+	nsc_galfns.c
+
+libdirectfb_nsc_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_nsc_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/nsc/Makefile.in b/Source/DirectFB/gfxdrivers/nsc/Makefile.in
new file mode 100755
index 0000000..c4ab622
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/Makefile.in
@@ -0,0 +1,714 @@
+# 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/nsc
+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)$(nscdir)" "$(DESTDIR)$(nscdir)"
+nscLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nsc_LTLIBRARIES)
+libdirectfb_nsc_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_nsc_la_OBJECTS = nsc.lo nsc_galfns.lo
+libdirectfb_nsc_la_OBJECTS = $(am_libdirectfb_nsc_la_OBJECTS)
+libdirectfb_nsc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_nsc_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_nsc_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_nsc_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+nscDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(nsc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = include
+INCLUDES = \
+	-I/usr/src/linux/drivers/video/nsc \
+	-I/usr/src/linux/drivers/video/nsc/gfx \
+	-I/usr/src/linux/drivers/video/nsc/panel \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/systems \
+	-I$(top_srcdir)/gfxdrivers/nsc/include
+
+nsc_LTLIBRARIES = libdirectfb_nsc.la
+@BUILD_STATIC_TRUE@nsc_DATA = $(nsc_LTLIBRARIES:.la=.o)
+nscdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_nsc_la_SOURCES = \
+	nsc.c	\
+	nsc_galfns.c
+
+libdirectfb_nsc_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_nsc_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+all: all-recursive
+
+.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/nsc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/nsc/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-nscLTLIBRARIES: $(nsc_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nscdir)" || $(MKDIR_P) "$(DESTDIR)$(nscdir)"
+	@list='$(nsc_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(nscLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nscdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(nscLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nscdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nscLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nsc_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(nscdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(nscdir)/$$p"; \
+	done
+
+clean-nscLTLIBRARIES:
+	-test -z "$(nsc_LTLIBRARIES)" || rm -f $(nsc_LTLIBRARIES)
+	@list='$(nsc_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_nsc.la: $(libdirectfb_nsc_la_OBJECTS) $(libdirectfb_nsc_la_DEPENDENCIES) 
+	$(libdirectfb_nsc_la_LINK) -rpath $(nscdir) $(libdirectfb_nsc_la_OBJECTS) $(libdirectfb_nsc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nsc_galfns.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-nscDATA: $(nsc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(nscdir)" || $(MKDIR_P) "$(DESTDIR)$(nscdir)"
+	@list='$(nsc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(nscDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(nscdir)/$$f'"; \
+	  $(nscDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(nscdir)/$$f"; \
+	done
+
+uninstall-nscDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nsc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(nscdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(nscdir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(nscdir)" "$(DESTDIR)$(nscdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool clean-nscLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-nscDATA install-nscLTLIBRARIES
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-nscDATA uninstall-nscLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	clean-nscLTLIBRARIES ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-nscDATA install-nscLTLIBRARIES install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-nscDATA uninstall-nscLTLIBRARIES
+
+%.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/nsc/include/Makefile.am b/Source/DirectFB/gfxdrivers/nsc/include/Makefile.am
new file mode 100755
index 0000000..dac0046
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/Makefile.am
@@ -0,0 +1,5 @@
+EXTRA_DIST = \
+	gfx_regs.h	\
+	gfx_type.h	\
+	nsc_galproto.h	\
+	pnl_defs.h
diff --git a/Source/DirectFB/gfxdrivers/nsc/include/Makefile.in b/Source/DirectFB/gfxdrivers/nsc/include/Makefile.in
new file mode 100755
index 0000000..b91603a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/Makefile.in
@@ -0,0 +1,403 @@
+# 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@
+subdir = gfxdrivers/nsc/include
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+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@
+EXTRA_DIST = \
+	gfx_regs.h	\
+	gfx_type.h	\
+	nsc_galproto.h	\
+	pnl_defs.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  gfxdrivers/nsc/include/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/nsc/include/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# 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/nsc/include/gfx_regs.h b/Source/DirectFB/gfxdrivers/nsc/include/gfx_regs.h
new file mode 100755
index 0000000..059ce47
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/gfx_regs.h
@@ -0,0 +1,1733 @@
+/*
+ * $Workfile: gfx_regs.h $
+ *
+ * This header file contains the graphics register definitions.
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software 
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the 
+ * Software is received by the Licensee.
+ * 
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated 
+ * NSC_LIC_GPL applies to this Software; in all other circumstances 
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ *
+ *   * Redistributions of source code must retain the above copyright 
+ *     notice, this list of conditions and the following disclaimer. 
+ *
+ *   * Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the following 
+ *     disclaimer in the documentation and/or other materials provided 
+ *     with the distribution. 
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor 
+ *     the names of its contributors may be used to endorse or promote 
+ *     products derived from this software without specific prior 
+ *     written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted under the terms of the GNU General 
+ * Public License as published by the Free Software Foundation; either 
+ * version 2 of the License, or (at your option) any later version  
+ *
+ * In addition to the terms of the GNU General Public License, neither 
+ * the name of the National Semiconductor Corporation nor the names of 
+ * its contributors may be used to endorse or promote products derived 
+ * from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE. See the GNU General Public License for more details. 
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * You should have received a copy of the GNU General Public License 
+ * along with this file; if not, write to the Free Software Foundation, 
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *
+ * END_NSC_LIC_GPL */
+
+
+/*----------------------------------*/
+/*  FIRST GENERATION GRAPHICS UNIT  */
+/*----------------------------------*/
+
+#define GP_DST_XCOOR			0x8100		/* x destination origin		*/
+#define GP_DST_YCOOR			0x8102		/* y destination origin		*/
+#define GP_WIDTH				0x8104		/* pixel width				*/
+#define GP_HEIGHT				0x8106		/* pixel height				*/
+#define GP_SRC_XCOOR			0x8108		/* x source origin			*/
+#define GP_SRC_YCOOR			0x810A		/* y source origin			*/
+
+#define GP_VECTOR_LENGTH		0x8104		/* vector length			*/
+#define GP_INIT_ERROR			0x8106		/* vector initial error		*/
+#define GP_AXIAL_ERROR			0x8108		/* axial error increment	*/
+#define GP_DIAG_ERROR			0x810A		/* diagonal error increment */
+
+#define GP_SRC_COLOR_0			0x810C		/* source color 0			*/
+#define GP_SRC_COLOR_1			0x810E		/* source color 1			*/
+#define GP_PAT_COLOR_0			0x8110		/* pattern color 0          */
+#define GP_PAT_COLOR_1			0x8112		/* pattern color 1          */
+#define GP_PAT_COLOR_2			0x8114		/* pattern color 2          */
+#define GP_PAT_COLOR_3			0x8116		/* pattern color 3          */
+#define GP_PAT_DATA_0			0x8120		/* bits 31:0 of pattern		*/
+#define GP_PAT_DATA_1			0x8124		/* bits 63:32 of pattern	*/
+#define GP_PAT_DATA_2			0x8128		/* bits 95:64 of pattern	*/
+#define GP_PAT_DATA_3			0x812C		/* bits 127:96 of pattern	*/
+
+#define GP_VGA_WRITE			0x8140		/* VGA write path control   */
+#define GP_VGA_READ				0x8144		/* VGA read path control    */
+
+#define GP_RASTER_MODE			0x8200		/* raster operation			*/
+#define GP_VECTOR_MODE			0x8204		/* vector mode register		*/
+#define GP_BLIT_MODE			0x8208		/* blit mode register		*/
+#define GP_BLIT_STATUS			0x820C		/* blit status register		*/
+
+#define GP_VGA_BASE				0x8210		/* VGA memory offset (x64K) */
+#define GP_VGA_LATCH			0x8214		/* VGA display latch        */
+
+/* "GP_VECTOR_MODE" BIT DEFINITIONS */
+
+#define VM_X_MAJOR				0x0000		/* X major vector			*/
+#define VM_Y_MAJOR				0x0001		/* Y major vector			*/
+#define VM_MAJOR_INC			0x0002		/* positive major axis step */
+#define VM_MINOR_INC			0x0004		/* positive minor axis step */
+#define VM_READ_DST_FB			0x0008		/* read destination data	*/
+
+/* "GP_RASTER_MODE" BIT DEFINITIONS */
+
+#define RM_PAT_DISABLE			0x0000		/* pattern is disabled		*/
+#define RM_PAT_MONO				0x0100		/* 1BPP pattern expansion	*/
+#define RM_PAT_DITHER			0x0200		/* 2BPP pattern expansion	*/
+#define RM_PAT_COLOR			0x0300		/* 8BPP or 16BPP pattern	*/
+#define RM_PAT_MASK				0x0300		/* mask for pattern mode	*/
+#define RM_PAT_TRANSPARENT		0x0400		/* transparent 1BPP pattern	*/
+#define RM_SRC_TRANSPARENT		0x0800		/* transparent 1BPP source	*/
+
+/* "GP_BLIT_STATUS" BIT DEFINITIONS */
+
+#define BS_BLIT_BUSY			0x0001		/* blit engine is busy		*/
+#define BS_PIPELINE_BUSY		0x0002		/* graphics pipeline is busy*/
+#define BS_BLIT_PENDING			0x0004		/* blit pending				*/
+#define BC_FLUSH				0x0080		/* flush pipeline requests  */
+#define BC_8BPP					0x0000		/* 8BPP mode				*/
+#define BC_16BPP				0x0100		/* 16BPP mode				*/
+#define BC_FB_WIDTH_1024		0x0000		/* framebuffer width = 1024 */
+#define BC_FB_WIDTH_2048		0x0200		/* framebuffer width = 2048 */
+#define BC_FB_WIDTH_4096		0x0400		/* framebuffer width = 4096	*/
+
+/* "GP_BLIT_MODE" BIT DEFINITIONS */
+
+#define	BM_READ_SRC_NONE		0x0000		/* source foreground color	*/
+#define BM_READ_SRC_FB			0x0001		/* read source from FB		*/
+#define BM_READ_SRC_BB0			0x0002		/* read source from BB0		*/
+#define BM_READ_SRC_BB1			0x0003		/* read source from BB1		*/
+#define BM_READ_SRC_MASK		0x0003		/* read source mask			*/
+
+#define	BM_READ_DST_NONE		0x0000		/* no destination data		*/
+#define BM_READ_DST_BB0			0x0008		/* destination from BB0		*/
+#define BM_READ_DST_BB1			0x000C		/* destination from BB1		*/
+#define BM_READ_DST_FB0			0x0010		/* dest from FB (store BB0) */
+#define BM_READ_DST_FB1			0x0014		/* dest from FB (store BB1) */
+#define BM_READ_DST_MASK		0x001C		/* read destination mask	*/
+
+#define BM_WRITE_FB				0x0000		/* write to framebuffer		*/
+#define	BM_WRITE_MEM			0x0020		/* write to memory			*/
+#define BM_WRITE_MASK			0x0020		/* write mask				*/
+
+#define	BM_SOURCE_COLOR			0x0000		/* source is 8BPP or 16BPP	*/
+#define BM_SOURCE_EXPAND		0x0040		/* source is 1BPP			*/
+#define BM_SOURCE_TEXT			0x00C0		/* source is 1BPP text		*/
+#define BM_SOURCE_MASK			0x00C0		/* source mask				*/
+
+#define BM_REVERSE_Y			0x0100		/* reverse Y direction		*/
+
+/*---------------------------------------*/
+/*  FIRST GENERATION DISPLAY CONTROLLER  */
+/*---------------------------------------*/
+
+#define DC_UNLOCK				0x8300		/* lock register			*/
+#define DC_GENERAL_CFG			0x8304		/* config registers...		*/
+#define DC_TIMING_CFG			0x8308
+#define DC_OUTPUT_CFG			0x830C
+
+#define DC_FB_ST_OFFSET			0x8310		/* framebuffer start offset */
+#define DC_CB_ST_OFFSET			0x8314		/* compression start offset */
+#define DC_CURS_ST_OFFSET		0x8318		/* cursor start offset		*/
+#define DC_ICON_ST_OFFSET		0x831C		/* icon start offset		*/
+#define DC_VID_ST_OFFSET		0x8320		/* video start offset		*/
+#define DC_LINE_DELTA			0x8324		/* fb and cb skip counts	*/
+#define DC_BUF_SIZE				0x8328		/* fb and cb line size		*/
+
+#define DC_H_TIMING_1			0x8330		/* horizontal timing...		*/
+#define DC_H_TIMING_2			0x8334
+#define DC_H_TIMING_3			0x8338
+#define DC_FP_H_TIMING			0x833C
+
+#define DC_V_TIMING_1			0x8340		/* vertical timing...		*/
+#define DC_V_TIMING_2			0x8344
+#define DC_V_TIMING_3			0x8348
+#define DC_FP_V_TIMING			0x834C
+
+#define DC_CURSOR_X				0x8350		/* cursor x position		*/
+#define DC_ICON_X				0x8354		/* HACK - 1.3 definition	*/
+#define DC_V_LINE_CNT			0x8354		/* vertical line counter	*/
+#define DC_CURSOR_Y				0x8358		/* cursor y position		*/
+#define DC_ICON_Y				0x835C		/* HACK - 1.3 definition	*/
+#define DC_SS_LINE_CMP			0x835C		/* line compare value		*/
+#define DC_CURSOR_COLOR			0x8360		/* cursor colors			*/
+#define DC_ICON_COLOR			0x8364		/* icon colors				*/
+#define DC_BORDER_COLOR			0x8368		/* border color				*/
+#define DC_PAL_ADDRESS			0x8370		/* palette address			*/
+#define DC_PAL_DATA				0x8374		/* palette data				*/
+#define DC_DFIFO_DIAG			0x8378		/* display FIFO diagnostic	*/
+#define DC_CFIFO_DIAG			0x837C		/* compression FIF0 diagnostic	*/
+
+/* PALETTE LOCATIONS */
+
+#define PAL_CURSOR_COLOR_0		0x100
+#define PAL_CURSOR_COLOR_1		0x101
+#define PAL_ICON_COLOR_0		0x102
+#define PAL_ICON_COLOR_1		0x103
+#define PAL_OVERSCAN_COLOR		0x104
+
+/* UNLOCK VALUE */
+
+#define DC_UNLOCK_VALUE		0x00004758		/* used to unlock DC regs	*/
+
+/* "DC_GENERAL_CFG" BIT DEFINITIONS */
+
+#define DC_GCFG_DFLE		0x00000001		/* display FIFO load enable */
+#define DC_GCFG_CURE		0x00000002		/* cursor enable			*/
+#define DC_GCFG_VCLK_DIV	0x00000004		/* vid clock divisor		*/
+#define DC_GCFG_PLNO		0x00000004		/* planar offset LSB		*/
+#define DC_GCFG_PPC			0x00000008		/* pixel pan compatibility  */
+#define DC_GCFG_CMPE		0x00000010		/* compression enable       */
+#define DC_GCFG_DECE		0x00000020		/* decompression enable     */
+#define DC_GCFG_DCLK_MASK	0x000000C0		/* dotclock multiplier      */
+#define DC_GCFG_DCLK_POS	6				/* dotclock multiplier      */
+#define DC_GCFG_DFHPSL_MASK	0x00000F00		/* FIFO high-priority start */
+#define DC_GCFG_DFHPSL_POS	8				/* FIFO high-priority start */
+#define DC_GCFG_DFHPEL_MASK	0x0000F000		/* FIFO high-priority end   */
+#define DC_GCFG_DFHPEL_POS	12				/* FIFO high-priority end   */
+#define DC_GCFG_CIM_MASK	0x00030000		/* compressor insert mode   */
+#define DC_GCFG_CIM_POS		16				/* compressor insert mode   */
+#define DC_GCFG_FDTY		0x00040000		/* frame dirty mode         */
+#define DC_GCFG_RTPM		0x00080000		/* real-time perf. monitor  */
+#define DC_GCFG_DAC_RS_MASK	0x00700000		/* DAC register selects     */
+#define DC_GCFG_DAC_RS_POS	20				/* DAC register selects     */
+#define DC_GCFG_CKWR		0x00800000		/* clock write              */
+#define DC_GCFG_LDBL		0x01000000		/* line double              */
+#define DC_GCFG_DIAG		0x02000000		/* FIFO diagnostic mode     */
+#define DC_GCFG_CH4S		0x04000000      /* sparse refresh mode		*/
+#define DC_GCFG_SSLC		0x08000000		/* enable line compare		*/
+#define DC_GCFG_VIDE		0x10000000		/* video enable			    */
+#define DC_GCFG_DFCK		0x20000000		/* divide flat-panel clock - rev 2.3 down */
+#define DC_GCFG_VRDY		0x20000000		/* video port speed - rev 2.4 up  */
+#define DC_GCFG_DPCK		0x40000000		/* divide pixel clock       */
+#define DC_GCFG_DDCK		0x80000000		/* divide dot clock         */
+
+/* "DC_TIMING_CFG" BIT DEFINITIONS */
+
+#define DC_TCFG_FPPE		0x00000001		/* flat-panel power enable  */
+#define DC_TCFG_HSYE		0x00000002		/* horizontal sync enable   */
+#define DC_TCFG_VSYE		0x00000004		/* vertical sync enable     */
+#define DC_TCFG_BLKE		0x00000008		/* blank enable				*/
+#define DC_TCFG_DDCK		0x00000010		/* DDC clock                */
+#define DC_TCFG_TGEN		0x00000020		/* timing generator enable  */
+#define DC_TCFG_VIEN		0x00000040		/* vertical interrupt enable*/
+#define DC_TCFG_BLNK		0x00000080		/* blink enable             */
+#define DC_TCFG_CHSP		0x00000100		/* horizontal sync polarity */
+#define DC_TCFG_CVSP		0x00000200		/* vertical sync polarity   */
+#define DC_TCFG_FHSP		0x00000400		/* panel horz sync polarity */
+#define DC_TCFG_FVSP		0x00000800		/* panel vert sync polarity */
+#define DC_TCFG_FCEN		0x00001000		/* flat-panel centering     */
+#define DC_TCFG_CDCE		0x00002000		/* HACK - 1.3 definition	*/
+#define DC_TCFG_PLNR		0x00002000		/* planar mode enable		*/
+#define DC_TCFG_INTL		0x00004000		/* interlace scan           */
+#define DC_TCFG_PXDB		0x00008000		/* pixel double             */
+#define DC_TCFG_BKRT		0x00010000		/* blink rate               */
+#define DC_TCFG_PSD_MASK	0x000E0000		/* power sequence delay     */
+#define DC_TCFG_PSD_POS		17				/* power sequence delay     */
+#define DC_TCFG_DDCI		0x08000000		/* DDC input (RO)           */
+#define DC_TCFG_SENS		0x10000000		/* monitor sense (RO)       */
+#define DC_TCFG_DNA			0x20000000		/* display not active (RO)  */
+#define DC_TCFG_VNA			0x40000000		/* vertical not active (RO) */
+#define DC_TCFG_VINT		0x80000000		/* vertical interrupt (RO)  */
+
+/* "DC_OUTPUT_CFG" BIT DEFINITIONS */
+
+#define DC_OCFG_8BPP		0x00000001		/* 8/16 bpp select          */
+#define DC_OCFG_555			0x00000002		/* 16 bpp format            */
+#define DC_OCFG_PCKE		0x00000004		/* PCLK enable              */
+#define DC_OCFG_FRME		0x00000008		/* frame rate mod enable    */
+#define DC_OCFG_DITE		0x00000010		/* dither enable            */
+#define DC_OCFG_2PXE		0x00000020		/* 2 pixel enable           */
+#define DC_OCFG_2XCK		0x00000040		/* 2 x pixel clock          */
+#define DC_OCFG_2IND		0x00000080		/* 2 index enable           */
+#define DC_OCFG_34ADD		0x00000100		/* 3- or 4-bit add          */
+#define DC_OCFG_FRMS		0x00000200		/* frame rate mod select    */
+#define DC_OCFG_CKSL		0x00000400		/* clock select             */
+#define DC_OCFG_PRMP		0x00000800		/* palette re-map           */
+#define DC_OCFG_PDEL		0x00001000		/* panel data enable low    */
+#define DC_OCFG_PDEH		0x00002000		/* panel data enable high   */
+#define DC_OCFG_CFRW		0x00004000		/* comp line buffer r/w sel */
+#define DC_OCFG_DIAG		0x00008000		/* comp line buffer diag    */
+
+#define MC_MEM_CNTRL1       0x00008400
+#define MC_DR_ADD			0x00008418
+#define MC_DR_ACC			0x0000841C
+
+/* MC_MEM_CNTRL1 BIT DEFINITIONS */
+
+#define MC_XBUSARB          0x00000008      /* 0 = GP priority < CPU priority */
+											/* 1 = GP priority = CPU priority */
+											/* GXm databook V2.0 is wrong ! */
+/*----------*/
+/*  CS5530  */
+/*----------*/
+
+/* CS5530 REGISTER DEFINITIONS */
+
+#define CS5530_VIDEO_CONFIG 		0x0000
+#define CS5530_DISPLAY_CONFIG       0x0004
+#define CS5530_VIDEO_X_POS          0x0008
+#define CS5530_VIDEO_Y_POS          0x000C
+#define CS5530_VIDEO_SCALE          0x0010
+#define CS5530_VIDEO_COLOR_KEY		0x0014
+#define CS5530_VIDEO_COLOR_MASK		0x0018
+#define CS5530_PALETTE_ADDRESS 		0x001C
+#define CS5530_PALETTE_DATA	 		0x0020
+#define CS5530_DOT_CLK_CONFIG       0x0024
+#define CS5530_CRCSIG_TFT_TV        0x0028
+
+/* "CS5530_VIDEO_CONFIG" BIT DEFINITIONS */
+
+#define CS5530_VCFG_VID_EN					0x00000001	
+#define CS5530_VCFG_VID_REG_UPDATE			0x00000002	
+#define CS5530_VCFG_VID_INP_FORMAT			0x0000000C	
+#define CS5530_VCFG_8_BIT_4_2_0				0x00000004
+#define CS5530_VCFG_16_BIT_4_2_0			0x00000008
+#define CS5530_VCFG_GV_SEL					0x00000010	
+#define CS5530_VCFG_CSC_BYPASS				0x00000020	
+#define CS5530_VCFG_X_FILTER_EN				0x00000040	
+#define CS5530_VCFG_Y_FILTER_EN				0x00000080	
+#define CS5530_VCFG_LINE_SIZE_LOWER_MASK	0x0000FF00	
+#define CS5530_VCFG_INIT_READ_MASK			0x01FF0000	
+#define CS5530_VCFG_EARLY_VID_RDY  			0x02000000	
+#define CS5530_VCFG_LINE_SIZE_UPPER			0x08000000	
+#define CS5530_VCFG_4_2_0_MODE				0x10000000	
+#define CS5530_VCFG_16_BIT_EN				0x20000000
+#define CS5530_VCFG_HIGH_SPD_INT			0x40000000
+
+/* "CS5530_DISPLAY_CONFIG" BIT DEFINITIONS */
+
+#define CS5530_DCFG_DIS_EN					0x00000001	
+#define CS5530_DCFG_HSYNC_EN				0x00000002	
+#define CS5530_DCFG_VSYNC_EN				0x00000004	
+#define CS5530_DCFG_DAC_BL_EN				0x00000008	
+#define CS5530_DCFG_DAC_PWDNX				0x00000020	
+#define CS5530_DCFG_FP_PWR_EN				0x00000040	
+#define CS5530_DCFG_FP_DATA_EN				0x00000080	
+#define CS5530_DCFG_CRT_HSYNC_POL 			0x00000100	
+#define CS5530_DCFG_CRT_VSYNC_POL 			0x00000200	
+#define CS5530_DCFG_FP_HSYNC_POL  			0x00000400	
+#define CS5530_DCFG_FP_VSYNC_POL  			0x00000800	
+#define CS5530_DCFG_XGA_FP		  			0x00001000	
+#define CS5530_DCFG_FP_DITH_EN				0x00002000	
+#define CS5530_DCFG_CRT_SYNC_SKW_MASK		0x0001C000
+#define CS5530_DCFG_CRT_SYNC_SKW_INIT		0x00010000
+#define CS5530_DCFG_PWR_SEQ_DLY_MASK		0x000E0000
+#define CS5530_DCFG_PWR_SEQ_DLY_INIT		0x00080000
+#define CS5530_DCFG_VG_CK					0x00100000
+#define CS5530_DCFG_GV_PAL_BYP				0x00200000
+#define CS5530_DCFG_DDC_SCL					0x00400000
+#define CS5530_DCFG_DDC_SDA					0x00800000
+#define CS5530_DCFG_DDC_OE					0x01000000
+#define CS5530_DCFG_16_BIT_EN				0x02000000
+
+
+/*----------*/
+/*  SC1200  */
+/*----------*/
+
+/* SC1200 VIDEO REGISTER DEFINITIONS */
+
+#define SC1200_VIDEO_CONFIG 				0x000
+#define SC1200_DISPLAY_CONFIG				0x004
+#define SC1200_VIDEO_X_POS					0x008
+#define SC1200_VIDEO_Y_POS					0x00C
+#define SC1200_VIDEO_UPSCALE				0x010
+#define SC1200_VIDEO_COLOR_KEY				0x014
+#define SC1200_VIDEO_COLOR_MASK				0x018
+#define SC1200_PALETTE_ADDRESS 				0x01C
+#define SC1200_PALETTE_DATA	 				0x020
+#define SC1200_VID_MISC						0x028
+#define SC1200_VID_CLOCK_SELECT				0x02C
+#define SC1200_VIDEO_DOWNSCALER_CONTROL     0x03C 
+#define SC1200_VIDEO_DOWNSCALER_COEFFICIENTS 0x40  
+#define SC1200_VID_CRC						0x044
+#define SC1200_DEVICE_ID					0x048
+#define SC1200_VID_ALPHA_CONTROL			0x04C
+#define SC1200_CURSOR_COLOR_KEY				0x050
+#define SC1200_CURSOR_COLOR_MASK			0x054
+#define SC1200_CURSOR_COLOR_1				0x058
+#define SC1200_CURSOR_COLOR_2				0x05C
+#define SC1200_ALPHA_XPOS_1					0x060
+#define SC1200_ALPHA_YPOS_1					0x064
+#define SC1200_ALPHA_COLOR_1				0x068
+#define SC1200_ALPHA_CONTROL_1				0x06C
+#define SC1200_ALPHA_XPOS_2					0x070
+#define SC1200_ALPHA_YPOS_2					0x074
+#define SC1200_ALPHA_COLOR_2				0x078
+#define SC1200_ALPHA_CONTROL_2				0x07C
+#define SC1200_ALPHA_XPOS_3					0x080
+#define SC1200_ALPHA_YPOS_3					0x084
+#define SC1200_ALPHA_COLOR_3				0x088
+#define SC1200_ALPHA_CONTROL_3				0x08C
+#define SC1200_VIDEO_REQUEST                0x090
+#define SC1200_ALPHA_WATCH 					0x094
+#define SC1200_VIDEO_DISPLAY_MODE           0x400
+#define SC1200_VIDEO_ODD_VBI_LINE_ENABLE    0x40C
+#define SC1200_VIDEO_EVEN_VBI_LINE_ENABLE   0x410
+#define SC1200_VIDEO_VBI_HORIZ_CONTROL      0x414
+#define SC1200_VIDEO_ODD_VBI_TOTAL_COUNT    0x418
+#define SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT   0x41C
+#define SC1200_GENLOCK                      0x420
+#define SC1200_GENLOCK_DELAY                0x424
+#define SC1200_TVOUT_HORZ_TIM				0x800
+#define SC1200_TVOUT_HORZ_SYNC				0x804
+#define SC1200_TVOUT_VERT_SYNC				0x808
+#define SC1200_TVOUT_LINE_END				0x80C
+#define SC1200_TVOUT_VERT_DOWNSCALE			0x810 /* REV. A & B */
+#define SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE 0x810 /* REV. C */
+#define SC1200_TVOUT_HORZ_SCALING			0x814
+#define SC1200_TVOUT_DEBUG                  0x818
+#define SC1200_TVENC_TIM_CTRL_1				0xC00
+#define SC1200_TVENC_TIM_CTRL_2				0xC04
+#define SC1200_TVENC_TIM_CTRL_3				0xC08
+#define SC1200_TVENC_SUB_FREQ				0xC0C
+#define SC1200_TVENC_DISP_POS				0xC10
+#define SC1200_TVENC_DISP_SIZE				0xC14
+#define SC1200_TVENC_CC_DATA				0xC18
+#define SC1200_TVENC_EDS_DATA				0xC1C
+#define SC1200_TVENC_CGMS_DATA				0xC20
+#define SC1200_TVENC_WSS_DATA				0xC24
+#define SC1200_TVENC_CC_CONTROL				0xC28
+#define SC1200_TVENC_DAC_CONTROL			0xC2C
+#define SC1200_TVENC_MV_CONTROL             0xC30
+
+/* "SC1200_VIDEO_CONFIG" BIT DEFINITIONS */
+
+#define SC1200_VCFG_VID_EN					0x00000001	
+#define SC1200_VCFG_VID_INP_FORMAT			0x0000000C	
+#define SC1200_VCFG_UYVY_FORMAT				0x00000000
+#define SC1200_VCFG_Y2YU_FORMAT				0x00000004
+#define SC1200_VCFG_YUYV_FORMAT				0x00000008
+#define SC1200_VCFG_YVYU_FORMAT				0x0000000C
+#define SC1200_VCFG_X_FILTER_EN				0x00000040	
+#define SC1200_VCFG_Y_FILTER_EN				0x00000080	
+#define SC1200_VCFG_LINE_SIZE_LOWER_MASK	0x0000FF00	
+#define SC1200_VCFG_INIT_READ_MASK			0x01FF0000	
+#define SC1200_VCFG_LINE_SIZE_UPPER			0x08000000	
+#define SC1200_VCFG_4_2_0_MODE				0x10000000	
+
+/* "SC1200_DISPLAY_CONFIG" BIT DEFINITIONS */
+
+#define SC1200_DCFG_DIS_EN					0x00000001	
+#define SC1200_DCFG_HSYNC_EN				0x00000002	
+#define SC1200_DCFG_VSYNC_EN				0x00000004	
+#define SC1200_DCFG_DAC_BL_EN				0x00000008	
+#define SC1200_DCFG_FP_PWR_EN				0x00000040
+#define SC1200_DCFG_FP_DATA_EN				0x00000080	
+#define SC1200_DCFG_CRT_HSYNC_POL 			0x00000100	
+#define SC1200_DCFG_CRT_VSYNC_POL 			0x00000200	
+#define SC1200_DCFG_CRT_SYNC_SKW_MASK		0x0001C000
+#define SC1200_DCFG_CRT_SYNC_SKW_INIT		0x00010000
+#define SC1200_DCFG_PWR_SEQ_DLY_MASK		0x000E0000
+#define SC1200_DCFG_PWR_SEQ_DLY_INIT		0x00080000
+#define SC1200_DCFG_VG_CK					0x00100000
+#define SC1200_DCFG_GV_PAL_BYP				0x00200000
+#define SC1200_DCFG_DDC_SCL					0x00400000
+#define SC1200_DCFG_DDC_SDA					0x00800000
+#define SC1200_DCFG_DDC_OE					0x01000000
+
+/* "SC1200_VID_MISC" BIT DEFINITIONS */
+
+#define SC1200_GAMMA_BYPASS_BOTH            0x00000001
+#define SC1200_DAC_POWER_DOWN               0x00000400
+#define SC1200_ANALOG_POWER_DOWN            0x00000800
+#define SC1200_PLL_POWER_NORMAL             0x00001000
+
+/* "SC1200_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */
+
+#define SC1200_VIDEO_DOWNSCALE_ENABLE       0x00000001
+#define SC1200_VIDEO_DOWNSCALE_FACTOR_POS   1
+#define SC1200_VIDEO_DOWNSCALE_FACTOR_MASK  0x0000001E
+#define SC1200_VIDEO_DOWNSCALE_TYPE_A       0x00000000
+#define SC1200_VIDEO_DOWNSCALE_TYPE_B       0x00000040
+#define SC1200_VIDEO_DOWNSCALE_TYPE_MASK    0x00000040
+
+/* "SC1200_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */
+
+#define SC1200_VIDEO_DOWNSCALER_COEF1_POS   0
+#define SC1200_VIDEO_DOWNSCALER_COEF2_POS   8
+#define SC1200_VIDEO_DOWNSCALER_COEF3_POS   16
+#define SC1200_VIDEO_DOWNSCALER_COEF4_POS   24
+#define SC1200_VIDEO_DOWNSCALER_COEF_MASK   0xF
+
+/* VIDEO DE-INTERLACING AND ALPHA CONTROL (REGISTER 0x4C) */
+
+#define SC1200_VERTICAL_SCALER_SHIFT_MASK   0x00000007
+#define SC1200_VERTICAL_SCALER_SHIFT_INIT   0x00000004
+#define SC1200_VERTICAL_SCALER_SHIFT_EN     0x00000010
+#define SC1200_TOP_LINE_IN_ODD              0x00000040
+#define SC1200_NO_CK_OUTSIDE_ALPHA          0x00000100
+#define SC1200_VIDEO_IS_INTERLACED          0x00000200
+#define SC1200_CSC_VIDEO_YUV_TO_RGB         0x00000400
+#define SC1200_CSC_GFX_RGB_TO_YUV           0x00000800
+#define SC1200_VIDEO_INPUT_IS_RGB           0x00002000
+#define SC1200_VIDEO_LINE_OFFSET_ODD        0x00001000
+#define SC1200_ALPHA1_PRIORITY_POS			16
+#define SC1200_ALPHA1_PRIORITY_MASK			0x00030000
+#define SC1200_ALPHA2_PRIORITY_POS			18
+#define SC1200_ALPHA2_PRIORITY_MASK			0x000C0000
+#define SC1200_ALPHA3_PRIORITY_POS			20
+#define SC1200_ALPHA3_PRIORITY_MASK			0x00300000
+
+/* VIDEO CURSOR COLOR KEY DEFINITIONS (REGISTER 0x50) */
+
+#define SC1200_CURSOR_COLOR_KEY_OFFSET_POS  24
+#define SC1200_CURSOR_COLOR_BITS            23
+#define SC1200_COLOR_MASK                   0x00FFFFFF /* 24 significant bits */
+
+/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */
+
+#define SC1200_ALPHA_COLOR_ENABLE           0x01000000
+
+/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */
+
+#define SC1200_ACTRL_WIN_ENABLE				0x00010000
+#define SC1200_ACTRL_LOAD_ALPHA				0x00020000
+
+/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */
+
+#define SC1200_VIDEO_Y_REQUEST_POS          0
+#define SC1200_VIDEO_X_REQUEST_POS          16
+#define SC1200_VIDEO_REQUEST_MASK           0x00000FFF
+
+/* VIDEO DISPLAY MODE (REGISTER 0x400) */
+
+#define SC1200_VIDEO_SOURCE_MASK            0x00000003
+#define SC1200_VIDEO_SOURCE_GX1             0x00000000
+#define SC1200_VIDEO_SOURCE_DVIP            0x00000002
+#define SC1200_VBI_SOURCE_MASK              0x00000004
+#define SC1200_VBI_SOURCE_DVIP              0x00000000
+#define SC1200_VBI_SOURCE_GX1               0x00000004
+
+/* ODD/EVEN VBI LINE ENABLE (REGISTERS 0x40C, 0x410) */
+
+#define SC1200_VIDEO_VBI_LINE_ENABLE_MASK   0x00FFFFFC
+#define SC1200_VIDEO_ALL_ACTIVE_IS_VBI      0x01000000
+#define SC1200_VIDEO_VBI_LINE_OFFSET_POS    25
+#define SC1200_VIDEO_VBI_LINE_OFFSET_MASK   0x3E000000
+
+/* ODD/EVEN VBI TOTAL COUNT (REGISTERS 0x418, 0x41C) */
+
+#define SC1200_VIDEO_VBI_TOTAL_COUNT_MASK   0x000FFFFF
+
+/* GENLOCK BIT DEFINITIONS */
+
+#define SC1200_GENLOCK_SINGLE_ENABLE              0x00000001
+#define SC1200_GENLOCK_FIELD_SYNC_ENABLE          0x00000001
+#define SC1200_GENLOCK_CONTINUOUS_ENABLE          0x00000002
+#define SC1200_GENLOCK_GX_VSYNC_FALLING_EDGE      0x00000004
+#define SC1200_GENLOCK_VIP_VSYNC_FALLING_EDGE     0x00000008
+#define SC1200_GENLOCK_TIMEOUT_ENABLE             0x00000010
+#define SC1200_GENLOCK_TVENC_RESET_EVEN_FIELD     0x00000020
+#define SC1200_GENLOCK_TVENC_RESET_BEFORE_DELAY   0x00000040
+#define SC1200_GENLOCK_TVENC_RESET_ENABLE         0x00000080
+#define SC1200_GENLOCK_SYNC_TO_TVENC              0x00000100
+#define SC1200_GENLOCK_DELAY_MASK                 0x001FFFFF
+
+/* TVOUT HORIZONTAL PRE ENCODER SCALE BIT DEFINITIONS */
+
+#define SC1200_TVOUT_YC_DELAY_MASK                0x00C00000
+#define SC1200_TVOUT_YC_DELAY_NONE                0x00000000
+#define SC1200_TVOUT_Y_DELAY_ONE_PIXEL            0x00400000
+#define SC1200_TVOUT_C_DELAY_ONE_PIXEL            0x00800000
+#define SC1200_TVOUT_C_DELAY_TWO_PIXELS           0x00C00000
+
+/* TVOUT HORIZONTAL SCALING/CONTROL BIT DEFINITIONS */
+
+#define SC1200_TVOUT_FLICKER_FILTER_MASK               0x60000000
+#define SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH 0x00000000
+#define SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF      0x20000000
+#define SC1200_TVOUT_FLICKER_FILTER_DISABLED           0x40000000
+#define SC1200_TVENC_EXTERNAL_RESET_INTERVAL_MASK      0x0F000000
+#define SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD    0x00000000
+#define SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD   0x02000000
+#define SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD     0x05000000
+#define SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD    0x07000000
+#define SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD        0x0E000000
+#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_ODD_FIELDS  0x08000000
+#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_EVEN_FIELDS 0x0A000000
+
+/* TVOUT DEBUG BIT DEFINITIONS */
+
+#define SC1200_TVOUT_FIELD_STATUS_EVEN         0x00000040
+#define SC1200_TVOUT_FIELD_STATUS_TV           0x00000080
+#define SC1200_TVOUT_CRT_VSYNC_STATUS_TRAILING 0x00000100
+#define SC1200_TVOUT_FIELD_STATUS_INVERT      0x00000200
+#define SC1200_TVOUT_CONVERTER_INTERPOLATION   0x00000400
+
+/* TVENC TIMING/CONTROL 1 BIT DEFINITIONS (REGISTER 0xC00) */
+
+#define SC1200_TVENC_VPHASE_MASK                          0x001FF800
+#define SC1200_TVENC_VPHASE_POS                           11
+#define SC1200_TVENC_SUB_CARRIER_RESET_MASK               0x30000000
+#define SC1200_TVENC_SUB_CARRIER_RESET_NEVER              0x00000000
+#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES    0x10000000
+#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES   0x20000000
+#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES  0x30000000
+#define SC1200_TVENC_VIDEO_TIMING_ENABLE                  0x80000000
+
+/* TVENC TIMING/CONTROL 2 BIT DEFINITIONS (REGISTER 0xC04) */
+
+#define SC1200_TVENC_OUTPUT_YCBCR                         0x40000000
+#define SC1200_TVENC_CFS_MASK                             0x00030000
+#define SC1200_TVENC_CFS_BYPASS                           0x00000000
+#define SC1200_TVENC_CFS_CVBS                             0x00020000
+#define SC1200_TVENC_CFS_SVIDEO                           0x00030000
+
+/* TVENC TIMING/CONTROL 3 BIT DEFINITIONS (REGISTER 0xC08) */
+
+#define SC1200_TVENC_CS                                   0x00000001
+#define SC1200_TVENC_SYNCMODE_MASK                        0x00000006
+#define SC1200_TVENC_SYNC_ON_GREEN                        0x00000002
+#define SC1200_TVENC_SYNC_ON_CVBS                         0x00000004
+#define SC1200_TVENC_CM                                   0x00000008
+
+/* TVENC DAC CONTROL BIT DEFINITIONS (REGISTER 0xC2C) */
+#define SC1200_TVENC_TRIM_MASK	               0x00000007
+#define SC1200_TVENC_POWER_DOWN	               0x00000020
+
+/* TVENC MV CONTROL BIT DEFINITIONS (REGISTER 0xC30) */
+#define SC1200_TVENC_MV_ENABLE                 0xBE
+
+/* SC1200 VIP REGISTER DEFINITIONS */
+
+#define SC1200_VIP_CONFIG					0x00000000
+#define SC1200_VIP_CONTROL					0x00000004
+#define SC1200_VIP_STATUS					0x00000008
+#define SC1200_VIP_CURRENT_LINE				0x00000010
+#define SC1200_VIP_LINE_TARGET				0x00000014
+#define SC1200_ODD_DIRECT_VBI_LINE_ENABLE   0x00000018
+#define SC1200_EVEN_DIRECT_VBI_LINE_ENABLE  0x0000001C
+#define SC1200_VIP_ODD_BASE					0x00000020
+#define SC1200_VIP_EVEN_BASE				0x00000024
+#define SC1200_VIP_PITCH					0x00000028
+#define SC1200_VBI_ODD_BASE					0x00000040
+#define SC1200_VBI_EVEN_BASE				0x00000044
+#define SC1200_VBI_PITCH					0x00000048
+
+/* "SC1200_VIP_CONFIG" BIT DEFINITIONS */
+
+#define SC1200_VIP_MODE_MASK                0x00000003
+#define	SC1200_VIP_MODE_C       			0x00000002
+#define SC1200_VBI_ANCILLARY_TO_MEMORY      0x000C0000
+#define SC1200_VBI_TASK_A_TO_MEMORY         0x00140000
+#define SC1200_VBI_TASK_B_TO_MEMORY         0x00240000
+#define SC1200_VIP_BUS_REQUEST_THRESHOLD    0x00400000
+
+/* "SC1200_VIP_CONTROL" BIT DEFINITIONS */
+
+#define SC1200_CAPTURE_RUN_MODE_MASK        0x00000003
+#define SC1200_CAPTURE_RUN_MODE_STOP_LINE   0x00000000
+#define SC1200_CAPTURE_RUN_MODE_STOP_FIELD  0x00000001
+#define SC1200_CAPTURE_RUN_MODE_START       0x00000003
+#define	SC1200_VIP_DATA_CAPTURE_EN			0x00000100
+#define	SC1200_VIP_VBI_CAPTURE_EN			0x00000200
+#define	SC1200_VIP_VBI_FIELD_INTERRUPT_EN	0x00010000
+
+/* "SC1200_VIP_STATUS" BIT DEFINITIONS */
+
+#define	SC1200_VIP_CURRENT_FIELD_ODD		0x01000000
+#define SC1200_VIP_BASE_NOT_UPDATED         0x00200000
+#define	SC1200_VIP_FIFO_OVERFLOW			0x00100000
+#define	SC1200_VIP_CLEAR_LINE_INT			0x00020000
+#define	SC1200_VIP_CLEAR_FIELD_INT			0x00010000
+#define	SC1200_VBI_DATA_CAPTURE_ACTIVE		0x00000200
+#define	SC1200_VIDEO_DATA_CAPTURE_ACTIVE	0x00000100
+
+/* "SC1200_VIP_CURRENT_LINE" BIT DEFINITIONS */
+
+#define SC1200_VIP_CURRENT_LINE_MASK	    0x000003FF
+
+/* "SC1200_VIP_LINE_TARGET" BIT DEFINITIONS */
+
+#define SC1200_VIP_LAST_LINE_MASK	        0x03FF0000
+
+/* "SC1200_VIP_PITCH" BIT DEFINITION */
+
+#define SC1200_VIP_PITCH_MASK               0x0000FFFC
+
+/* "SC1200_VBI_PITCH" BIT DEFINITION */
+
+#define SC1200_VBI_PITCH_MASK               0x0000FFFC
+
+/* SC1200 DIRECT VBI LINE ENABLE BIT DEFINITION */
+
+#define SC1200_DIRECT_VBI_LINE_ENABLE_MASK  0x00FFFFFF
+
+/* SC1200 CONFIGURATION BLOCK */
+
+#define SC1200_CB_BASE_ADDR                 0x9000
+#define SC1200_CB_WDTO                      0x0000
+#define SC1200_CB_WDCNFG                    0x0002
+#define SC1200_CB_WDSTS                     0x0004
+#define SC1200_CB_TMVALUE                   0x0008
+#define SC1200_CB_TMCNFG                    0x000D
+#define SC1200_CB_PMR                       0x0030
+#define SC1200_CB_MCR                       0x0034
+#define SC1200_CB_INTSEL                    0x0038
+#define SC1200_CB_PID                       0x003C
+#define SC1200_CB_REV                       0x003D
+
+/* SC1200 HIGH RESOLUTION TIMER CONFIGURATION REGISTER BITS */
+
+#define SC1200_TMCLKSEL_27MHZ               0x2
+
+/*---------------------------------*/
+/*  PHILIPS SAA7114 VIDEO DECODER  */
+/*---------------------------------*/
+
+#define SAA7114_CHIPADDR					0x42
+
+/* VIDEO DECODER REGISTER DEFINITIONS */
+
+#define SAA7114_ANALOG_INPUT_CTRL1			0x02
+#define SAA7114_LUMINANCE_CONTROL           0x09
+#define SAA7114_BRIGHTNESS					0x0A
+#define SAA7114_CONTRAST					0x0B
+#define SAA7114_SATURATION					0x0C
+#define SAA7114_HUE							0x0D
+#define SAA7114_STATUS						0x1F
+#define SAA7114_IPORT_CONTROL				0x86
+
+/* TASK A REGISTER DEFINITIONS */
+
+#define SAA7114_TASK_A_HORZ_OUTPUT_LO		0x9C
+#define SAA7114_TASK_A_HORZ_OUTPUT_HI		0x9D
+#define SAA7114_TASK_A_HSCALE_LUMA_LO		0xA8
+#define SAA7114_TASK_A_HSCALE_LUMA_HI		0xA9
+#define SAA7114_TASK_A_HSCALE_CHROMA_LO		0xAC
+#define SAA7114_TASK_A_HSCALE_CHROMA_HI		0xAD
+
+/* TASK B REGISTER DEFINITIONS */
+
+#define SAA7114_HORZ_OFFSET_LO				0xC4
+#define SAA7114_HORZ_OFFSET_HI				0xC5
+#define SAA7114_HORZ_INPUT_LO				0xC6
+#define SAA7114_HORZ_INPUT_HI				0xC7
+#define SAA7114_VERT_OFFSET_LO				0xC8
+#define SAA7114_VERT_OFFSET_HI				0xC9
+#define SAA7114_VERT_INPUT_LO				0xCA
+#define SAA7114_VERT_INPUT_HI				0xCB
+#define SAA7114_HORZ_OUTPUT_LO				0xCC
+#define SAA7114_HORZ_OUTPUT_HI				0xCD
+#define SAA7114_VERT_OUTPUT_LO				0xCE
+#define SAA7114_VERT_OUTPUT_HI				0xCF
+#define SAA7114_HORZ_PRESCALER				0xD0
+#define SAA7114_HORZ_ACL					0xD1
+#define SAA7114_HORZ_FIR_PREFILTER			0xD2
+#define SAA7114_FILTER_CONTRAST				0xD5
+#define SAA7114_FILTER_SATURATION			0xD6
+#define SAA7114_HSCALE_LUMA_LO				0xD8
+#define SAA7114_HSCALE_LUMA_HI				0xD9
+#define SAA7114_HSCALE_CHROMA_LO			0xDC
+#define SAA7114_HSCALE_CHROMA_HI			0xDD
+#define SAA7114_VSCALE_LUMA_LO				0xE0
+#define SAA7114_VSCALE_LUMA_HI				0xE1
+#define SAA7114_VSCALE_CHROMA_LO			0xE2
+#define SAA7114_VSCALE_CHROMA_HI			0xE3
+#define SAA7114_VSCALE_CONTROL				0xE4
+#define SAA7114_VSCALE_CHROMA_OFFS0			0xE8
+#define SAA7114_VSCALE_CHROMA_OFFS1			0xE9
+#define SAA7114_VSCALE_CHROMA_OFFS2			0xEA
+#define SAA7114_VSCALE_CHROMA_OFFS3			0xEB
+#define SAA7114_VSCALE_LUMINA_OFFS0			0xEC
+#define SAA7114_VSCALE_LUMINA_OFFS1			0xED
+#define SAA7114_VSCALE_LUMINA_OFFS2			0xEE
+#define SAA7114_VSCALE_LUMINA_OFFS3			0xEF
+
+
+/* Still need to determine PHO value (common phase offset) */
+#define SAA7114_VSCALE_PHO					0x00
+
+
+/*----------------------------------------------*/
+/*  SECOND GENERATION GRAPHICS UNIT (REDCLOUD)  */
+/*----------------------------------------------*/
+
+#define MGP_DST_OFFSET			0x0000		/* dst address				*/
+#define MGP_SRC_OFFSET			0x0004		/* src address				*/
+#define MGP_VEC_ERR				0x0004		/* vector diag/axial errors	*/
+#define MGP_STRIDE				0x0008		/* src and dst strides		*/
+#define MGP_WID_HEIGHT			0x000C		/* width and height of BLT	*/
+#define MGP_VEC_LEN				0x000C		/* vector length/init error */
+#define MGP_SRC_COLOR_FG		0x0010		/* src mono data fgcolor 	*/
+#define MGP_SRC_COLOR_BG		0x0014		/* src mono data bkcolor 	*/
+#define MGP_PAT_COLOR_0			0x0018		/* pattern color 0			*/
+#define MGP_PAT_COLOR_1			0x001C		/* pattern color 1			*/
+#define MGP_PAT_COLOR_2			0x0020		/* pattern color 2			*/
+#define MGP_PAT_COLOR_3			0x0024		/* pattern color 3			*/
+#define MGP_PAT_COLOR_4			0x0028		/* pattern color 4			*/
+#define MGP_PAT_COLOR_5			0x002C		/* pattern color 5			*/
+#define MGP_PAT_DATA_0			0x0030		/* pattern data 0			*/
+#define MGP_PAT_DATA_1			0x0034		/* pattern data 1			*/
+#define MGP_RASTER_MODE			0x0038		/* raster operation			*/
+#define MGP_VECTOR_MODE			0x003C		/* render vector			*/
+#define MGP_BLT_MODE			0x0040		/* render BLT				*/
+#define MGP_BLT_STATUS			0x0044		/* BLT status register		*/
+#define MGP_RESET				0x0044		/* reset register (write)	*/
+#define MGP_HST_SOURCE			0x0048		/* host src data (bitmap)	*/
+#define MGP_BASE_OFFSET			0x004C		/* base render offset		*/
+
+/* MGP_RASTER_MODE DEFINITIONS */
+
+#define MGP_RM_BPPFMT_332		    0x00000000	/* 8 BPP, 3:3:2				*/
+#define MGP_RM_BPPFMT_4444		    0x40000000	/* 16 BPP, 4:4:4:4			*/
+#define MGP_RM_BPPFMT_1555		    0x50000000	/* 16 BPP, 1:5:5:5			*/
+#define MGP_RM_BPPFMT_565		    0x60000000	/* 16 BPP, 5:6:5			*/
+#define MGP_RM_BPPFMT_8888		    0x80000000	/* 32 BPP, 8:8:8:8			*/
+#define MGP_RM_ALPHA_EN_MASK        0x00C00000  /* Alpha enable             */
+#define MGP_RM_ALPHA_TO_RGB         0x00400000  /* Alpha applies to RGB     */
+#define MGP_RM_ALPHA_TO_ALPHA       0x00800000  /* Alpha applies to alpha   */
+#define MGP_RM_ALPHA_OP_MASK        0x00300000  /* Alpha operation          */
+#define MGP_RM_ALPHA_TIMES_A        0x00000000  /* Alpha * A                */
+#define MGP_RM_BETA_TIMES_B         0x00100000  /* (1-alpha) * B            */
+#define MGP_RM_A_PLUS_BETA_B        0x00200000  /* A + (1-alpha) * B        */
+#define MGP_RM_ALPHA_A_PLUS_BETA_B  0x00300000  /* alpha * A + (1 - alpha)B */
+#define MGP_RM_ALPHA_SELECT         0x000E0000  /* Alpha Select             */
+#define MGP_RM_SELECT_ALPHA_A       0x00000000  /* Alpha from channel A     */
+#define MGP_RM_SELECT_ALPHA_B       0x00020000  /* Alpha from channel B     */
+#define MGP_RM_SELECT_ALPHA_R       0x00040000  /* Registered alpha         */
+#define MGP_RM_SELECT_ALPHA_1       0x00060000  /* Constant 1               */
+#define MGP_RM_SELECT_ALPHA_CHAN_A  0x00080000  /* RGB Values from A        */
+#define MGP_RM_SELECT_ALPHA_CHAN_B  0x000A0000  /* RGB Values from B        */
+#define MGP_RM_DEST_FROM_CHAN_A     0x00010000  /* Alpha channel select     */
+#define MGP_RM_PAT_FLAGS		    0x00000700  /* pattern related bits		*/
+#define MGP_RM_PAT_MONO			    0x00000100  /* monochrome pattern		*/
+#define MGP_RM_PAT_COLOR		    0x00000200  /* color pattern			*/
+#define MGP_RM_PAT_TRANS		    0x00000400	/* pattern transparency		*/
+#define MGP_RM_SRC_TRANS		    0x00000800	/* source transparency		*/
+
+/* MGP_VECTOR_MODE DEFINITIONS */
+
+#define MGP_VM_DST_REQ			0x00000008	/* dst data required		*/
+#define MGP_VM_THROTTLE			0x00000010  /* sync to VBLANK			*/
+
+/* MGP_BLT_MODE DEFINITIONS */
+
+#define MGP_BM_SRC_FB			0x00000001  /* src = frame buffer		*/
+#define MGP_BM_SRC_HOST			0x00000002  /* src = host register		*/
+#define MGP_BM_DST_REQ			0x00000004  /* dst data required		*/
+#define MGP_BM_SRC_MONO			0x00000040  /* monochrome source data   */
+#define MGP_BM_SRC_BP_MONO      0x00000080  /* Byte-packed monochrome   */
+#define MGP_BM_NEG_YDIR			0x00000100  /* negative Y direction		*/
+#define MGP_BM_NEG_XDIR			0x00000200  /* negative X direction		*/
+#define MGP_BM_THROTTLE			0x00000400  /* sync to VBLANK			*/
+
+/* MGP_BLT_STATUS DEFINITIONS */
+
+#define MGP_BS_BLT_BUSY			0x00000001  /* GP is not idle			*/
+#define MGP_BS_BLT_PENDING		0x00000004	/* second BLT is pending	*/
+#define MGP_BS_HALF_EMPTY		0x00000008  /* src FIFO half empty		*/
+
+/* ALPHA BLENDING MODES       */
+
+#define ALPHA_MODE_BLEND        0x00000000
+
+/*---------------------------------------------------*/
+/*  SECOND GENERATION DISPLAY CONTROLLER (REDCLOUD)  */
+/*---------------------------------------------------*/
+
+#define MDC_UNLOCK              0x00000000  /* Unlock register               */
+#define MDC_GENERAL_CFG         0x00000004  /* Config registers              */
+#define MDC_DISPLAY_CFG         0x00000008  
+#define MDC_GFX_SCL             0x0000000C  /* Graphics scaling              */
+
+#define MDC_FB_ST_OFFSET        0x00000010  /* Frame buffer start offset     */
+#define MDC_CB_ST_OFFSET        0x00000014  /* Compression start offset      */
+#define MDC_CURS_ST_OFFSET      0x00000018  /* Cursor buffer start offset    */
+#define MDC_ICON_ST_OFFSET      0x0000001C  /* Icon buffer start offset      */
+#define MDC_VID_Y_ST_OFFSET     0x00000020  /* Video Y Buffer start offset   */
+#define MDC_VID_U_ST_OFFSET     0x00000024  /* Video U Buffer start offset   */
+#define MDC_VID_V_ST_OFFSET     0x00000028  /* Video V Buffer start offset   */
+#define MDC_LINE_SIZE           0x00000030  /* Video, CB, and FB line sizes  */
+#define MDC_GFX_PITCH           0x00000034  /* FB and DB skip counts         */
+#define MDC_VID_YUV_PITCH       0x00000038  /* Y, U and V buffer skip counts */
+
+#define MDC_H_ACTIVE_TIMING     0x00000040  /* Horizontal timings            */
+#define MDC_H_BLANK_TIMING      0x00000044
+#define MDC_H_SYNC_TIMING       0x00000048
+#define MDC_V_ACTIVE_TIMING     0x00000050  /* Vertical Timings              */
+#define MDC_V_BLANK_TIMING      0x00000054
+#define MDC_V_SYNC_TIMING       0x00000058
+
+#define MDC_CURSOR_X            0x00000060  /* Cursor X position             */
+#define MDC_CURSOR_Y            0x00000064  /* Cursor Y Position             */
+#define MDC_ICON_X              0x00000068  /* Icon X Position               */
+#define MDC_LINE_CNT_STATUS     0x0000006C  /* Icon Y Position               */
+
+#define MDC_PAL_ADDRESS         0x00000070  /* Palette Address               */
+#define MDC_PAL_DATA            0x00000074  /* Palette Data                  */
+#define MDC_DFIFO_DIAG          0x00000078  /* Display FIFO diagnostic       */
+#define MDC_CFIFO_DIAG          0x0000007C  /* Compression FIFO diagnostic   */
+
+#define MDC_VID_DS_DELTA        0x00000080  /* Vertical Downscaling fraction */
+
+#define MDC_PHY_MEM_OFFSET      0x00000084  /* VG Base Address Register      */
+#define MDC_DV_CTL              0x00000088  /* Dirty-Valid Control Register  */
+#define MDC_DV_ACC              0x0000008C  /* Dirty-Valid RAM Access        */
+
+/* UNLOCK VALUE */
+
+#define MDC_UNLOCK_VALUE		0x00004758		/* used to unlock DC regs	*/
+
+/* VG MBUS DEVICE SMI MSR FIELDS */
+
+#define MDC_VG_BL_MASK            0x00000001
+#define MDC_MISC_MASK             0x00000002
+#define MDC_ISR0_MASK             0x00000004
+#define MDC_VGA_BL_MASK           0x00000008
+#define MDC_CRTCIO_MSK            0x00000010
+#define MDC_VG_BLANK_SMI          0x00000001
+#define MDC_MISC_SMI              0x00000002
+#define MDC_ISR0_SMI              0x00000004
+#define MDC_VGA_BLANK_SMI         0x00000008
+#define MDC_CRTCIO_SMI            0x00000010
+
+/* MDC_GENERAL_CFG BIT FIELDS */
+
+#define MDC_GCFG_DBUG             0x80000000
+#define MDC_GCFG_DBSL             0x40000000
+#define MDC_GCFG_CFRW             0x20000000
+#define MDC_GCFG_DIAG             0x10000000
+#define MDC_GCFG_GXRFS4           0x08000000
+#define MDC_GCFG_SGFR             0x04000000
+#define MDC_GCFG_SGRE             0x02000000
+#define MDC_GCFG_SIGE             0x01000000
+#define MDC_GCFG_YUVM             0x00100000
+#define MDC_GCFG_VDSE             0x00080000
+#define MDC_GCFG_VGAFT            0x00040000
+#define MDC_GCFG_FDTY             0x00020000
+#define MDC_GCFG_STFM             0x00010000
+#define MDC_GCFG_DFHPEL_MASK      0x0000F000
+#define MDC_GCFG_DFHPSL_MASK      0x00000F00
+#define MDC_GCFG_VGAE             0x00000080
+#define MDC_GCFG_DECE             0x00000040
+#define MDC_GCFG_CMPE             0x00000020
+#define MDC_GCFG_VIDE             0x00000008
+#define MDC_GCFG_ICNE             0x00000004
+#define MDC_GCFG_CURE             0x00000002
+#define MDC_GCFG_DFLE             0x00000001
+
+/* MDC_DISPLAY_CFG BIT FIELDS */
+
+#define MDC_DCFG_A20M             0x80000000
+#define MDC_DCFG_A18M             0x40000000
+#define MDC_DCFG_VISL             0x08000000
+#define MDC_DCFG_FRLK             0x04000000
+#define MDC_DCFG_PALB             0x02000000
+#define MDC_DCFG_PIX_PAN_MASK     0x00F00000
+#define MDC_DCFG_DCEN             0x00080000
+#define MDC_DCFG_16BPP_MODE_MASK  0x00000C00
+#define MDC_DCFG_16BPP            0x00000000        
+#define MDC_DCFG_15BPP            0x00000400
+#define MDC_DCFG_12BPP            0x00000800
+#define MDC_DCFG_DISP_MODE_MASK   0x00000300
+#define MDC_DCFG_DISP_MODE_8BPP   0x00000000
+#define MDC_DCFG_DISP_MODE_16BPP  0x00000100
+#define MDC_DCFG_DISP_MODE_24BPP  0x00000200
+#define MDC_DCFG_SCLE             0x00000080
+#define MDC_DCFG_TRUP             0x00000040
+#define MDC_DCFG_VIEN             0x00000020
+#define MDC_DCFG_VDEN             0x00000010
+#define MDC_DCFG_GDEN             0x00000008
+#define MDC_DCFG_VCKE             0x00000004
+#define MDC_DCFG_PCKE             0x00000002
+#define MDC_DCFG_TGEN             0x00000001
+
+/* MDC_LINE_CNT BIT FIELDS     */
+
+#define MDC_LNCNT_DNA             0x80000000
+#define MDC_LNCNT_VNA             0x40000000
+#define MDC_LNCNT_VSA             0x20000000
+#define MDC_LNCNT_VINT            0x10000000
+#define MDC_LNCNT_FLIP            0x08000000
+#define MDC_LNCNT_V_LINE_CNT      0x07FF0000
+#define MDC_LNCNT_VFLIP           0x00008000
+#define MDC_LNCNT_SIGC            0x00004000
+#define MDC_LNCNT_SS_LINE_CMP     0x000007FF
+
+/* MDC_FB_ST_OFFSET BIT FIELDS */
+
+#define MDC_FB_ST_OFFSET_MASK     0x0FFFFFFF
+
+/* MDC_CB_ST_OFFSET BIT FIELDS */
+
+#define MDC_CB_ST_OFFSET_MASK     0x0FFFFFFF
+
+/* MDC_CURS_ST_OFFSET BIT FIELDS */
+
+#define MDC_CURS_ST_OFFSET_MASK   0x0FFFFFFF
+
+/* MDC_ICON_ST_OFFSET BIT FIELDS */
+
+#define MDC_ICON_ST_OFFSET_MASK   0x0FFFFFFF
+
+/* MDC_VID_Y_ST_OFFSET BIT FIELDS */
+
+#define MDC_VID_Y_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* MDC_VID_U_ST_OFFSET BIT FIELDS */
+
+#define MDC_VID_U_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* MDC_VID_V_ST_OFFSET BIT FIELDS */
+
+#define MDC_VID_V_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* MDC_LINE_SIZE BIT FIELDS */
+
+#define MDC_LINE_SIZE_VLS_MASK    0xFF000000
+#define MDC_LINE_SIZE_CBLS_MASK   0x007F0000
+#define MDC_LINE_SIZE_FBLS_MASK   0x000007FF
+
+/* MDC_GFX_PITCH BIT FIELDS */
+
+#define MDC_GFX_PITCH_CBP_MASK    0xFFFF0000
+#define MDC_GFX_PITCH_FBP_MASK    0x0000FFFF
+
+/* MDC_VID_YUV_PITCH BIT FIELDS */
+
+#define MDC_YUV_PITCH_UVP_MASK    0xFFFF0000
+#define MDC_YUV_PITCH_YBP_MASK    0x0000FFFF
+
+/* MDC_H_ACTIVE_TIMING BIT FIELDS */
+
+#define MDC_HAT_HT_MASK           0x0FF80000
+#define MDC_HAT_HA_MASK           0x00000FF8
+
+/* MDC_H_BLANK_TIMING BIT FIELDS */
+
+#define MDC_HBT_HBE_MASK          0x0FF80000
+#define MDC_HBT_HBS_MASK          0x00000FF8
+
+/* MDC_H_SYNC_TIMING BIT FIELDS */
+
+#define MDC_HST_HSE_MASK          0x0FF80000
+#define MDC_HST_HSS_MASK          0x00000FF8 
+
+/* MDC_V_ACTIVE_TIMING BIT FIELDS */
+
+#define MDC_VAT_VT_MASK           0x07FF0000
+#define MDC_VAT_VA_MASK           0x000007FF
+
+/* MDC_V_BLANK_TIMING BIT FIELDS */
+
+#define MDC_VBT_VBE_MASK          0x07FF0000
+#define MDC_VBT_VBS_MASK          0x000007FF
+
+/* MDC_V_SYNC_TIMING BIT FIELDS */
+
+#define MDC_VST_VSE_MASK          0x07FF0000
+#define MDC_VST_VSS_MASK          0x000007FF 
+
+/* MDC_DV_CTL BIT DEFINITIONS */
+
+#define MDC_DV_LINE_SIZE_MASK     0x00000C00
+#define MDC_DV_LINE_SIZE_1024     0x00000000
+#define MDC_DV_LINE_SIZE_2048     0x00000400
+#define MDC_DV_LINE_SIZE_4096     0x00000800
+#define MDC_DV_LINE_SIZE_8192     0x00000C00
+
+/* VGA DEFINITIONS */
+
+#define MDC_SEQUENCER_INDEX       0x03C4
+#define MDC_SEQUENCER_DATA        0x03C5
+#define MDC_SEQUENCER_RESET       0x00
+#define MDC_SEQUENCER_CLK_MODE    0x01
+
+#define MDC_RESET_VGA_DISP_ENABLE 0x03
+#define MDC_CLK_MODE_SCREEN_OFF   0x20
+
+
+/*---------------------------------------------------*/
+/*  REDCLOUD DISPLAY FILTER                          */
+/*---------------------------------------------------*/
+
+/* RCDF VIDEO REGISTER DEFINITIONS */
+
+#define RCDF_VIDEO_CONFIG 				    0x000
+#define RCDF_DISPLAY_CONFIG				    0x008
+#define RCDF_VIDEO_X_POS					0x010
+#define RCDF_VIDEO_Y_POS					0x018
+#define RCDF_VIDEO_SCALE					0x020
+#define RCDF_VIDEO_COLOR_KEY				0x028
+#define RCDF_VIDEO_COLOR_MASK				0x030
+#define RCDF_PALETTE_ADDRESS 				0x038
+#define RCDF_PALETTE_DATA	 				0x040
+#define RCDF_VID_MISC						0x050
+#define RCDF_VID_CLOCK_SELECT				0x058
+#define RCDF_VIDEO_DOWNSCALER_CONTROL       0x078 
+#define RCDF_VIDEO_DOWNSCALER_COEFFICIENTS  0x080  
+#define RCDF_VID_CRC						0x088
+#define RCDF_VID_CRC32						0x090
+#define RCDF_VID_ALPHA_CONTROL			    0x098
+#define RCDF_CURSOR_COLOR_KEY				0x0A0
+#define RCDF_CURSOR_COLOR_MASK			    0x0A8
+#define RCDF_CURSOR_COLOR_1				    0x0B0
+#define RCDF_CURSOR_COLOR_2				    0x0B8
+#define RCDF_ALPHA_XPOS_1					0x0C0
+#define RCDF_ALPHA_YPOS_1					0x0C8
+#define RCDF_ALPHA_COLOR_1				    0x0D0
+#define RCDF_ALPHA_CONTROL_1				0x0D8
+#define RCDF_ALPHA_XPOS_2					0x0E0
+#define RCDF_ALPHA_YPOS_2					0x0E8
+#define RCDF_ALPHA_COLOR_2				    0x0F0
+#define RCDF_ALPHA_CONTROL_2				0x0F8
+#define RCDF_ALPHA_XPOS_3					0x100
+#define RCDF_ALPHA_YPOS_3					0x108
+#define RCDF_ALPHA_COLOR_3				    0x110
+#define RCDF_ALPHA_CONTROL_3				0x118
+#define RCDF_VIDEO_REQUEST                  0x120
+#define RCDF_ALPHA_WATCH                    0x128
+#define RCDF_VIDEO_TEST_MODE                0x210
+#define RCDF_POWER_MANAGEMENT               0x410
+
+/* DISPLAY FILTER POWER MANAGEMENT DEFINITIONS */
+
+#define RCDF_PM_PANEL_POWER_ON              0x01000000
+
+/* DISPLAY FILTER MSRS */
+
+#define RCDF_MBD_MSR_DIAG_DF				0x2010
+#define RCDF_DIAG_32BIT_CRC					0x80000000
+
+/* "RCDF_VIDEO_CONFIG" BIT DEFINITIONS */
+
+#define RCDF_VCFG_VID_EN					0x00000001	
+#define RCDF_VCFG_VID_INP_FORMAT			0x0000000C	
+#define RCDF_VCFG_X_FILTER_EN				0x00000040	
+#define RCDF_VCFG_Y_FILTER_EN				0x00000080	
+#define RCDF_VCFG_LINE_SIZE_LOWER_MASK	    0x0000FF00	
+#define RCDF_VCFG_INIT_READ_MASK			0x01FF0000	
+#define RCDF_VCFG_LINE_SIZE_UPPER			0x08000000	
+#define RCDF_VCFG_4_2_0_MODE				0x10000000	
+#define RCDF_VCFG_UYVY_FORMAT				0x00000000
+#define RCDF_VCFG_Y2YU_FORMAT				0x00000004
+#define RCDF_VCFG_YUYV_FORMAT				0x00000008
+#define RCDF_VCFG_YVYU_FORMAT				0x0000000C
+
+/* "RCDF_DISPLAY_CONFIG" BIT DEFINITIONS */
+
+#define RCDF_DCFG_DIS_EN				    0x00000001	
+#define RCDF_DCFG_HSYNC_EN				    0x00000002	
+#define RCDF_DCFG_VSYNC_EN				    0x00000004	
+#define RCDF_DCFG_DAC_BL_EN				    0x00000008	
+#define RCDF_DCFG_FP_PWR_EN				    0x00000040
+#define RCDF_DCFG_FP_DATA_EN				0x00000080	
+#define RCDF_DCFG_CRT_HSYNC_POL 			0x00000100	
+#define RCDF_DCFG_CRT_VSYNC_POL 			0x00000200		
+#define RCDF_DCFG_CRT_SYNC_SKW_MASK		    0x0001C000
+#define RCDF_DCFG_CRT_SYNC_SKW_INIT		    0x00010000
+#define RCDF_DCFG_PWR_SEQ_DLY_MASK		    0x000E0000
+#define RCDF_DCFG_PWR_SEQ_DLY_INIT		    0x00080000
+#define RCDF_DCFG_VG_CK					    0x00100000
+#define RCDF_DCFG_GV_PAL_BYP				0x00200000
+#define RCDF_DAC_VREF                       0x04000000
+#define RCDF_FP_ON_STATUS                   0x08000000
+
+/* "RCDF_VID_MISC" BIT DEFINITIONS */
+
+#define RCDF_GAMMA_BYPASS_BOTH              0x00000001
+#define RCDF_DAC_POWER_DOWN                 0x00000400
+#define RCDF_ANALOG_POWER_DOWN              0x00000800
+
+/* "RCDF_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */
+
+#define RCDF_VIDEO_DOWNSCALE_ENABLE         0x00000001
+#define RCDF_VIDEO_DOWNSCALE_FACTOR_POS     1
+#define RCDF_VIDEO_DOWNSCALE_FACTOR_MASK    0x0000001E
+#define RCDF_VIDEO_DOWNSCALE_TYPE_A         0x00000000
+#define RCDF_VIDEO_DOWNSCALE_TYPE_B         0x00000040
+#define RCDF_VIDEO_DOWNSCALE_TYPE_MASK      0x00000040
+
+/* "RCDF_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */
+
+#define RCDF_VIDEO_DOWNSCALER_COEF1_POS     0
+#define RCDF_VIDEO_DOWNSCALER_COEF2_POS     8
+#define RCDF_VIDEO_DOWNSCALER_COEF3_POS     16
+#define RCDF_VIDEO_DOWNSCALER_COEF4_POS     24
+#define RCDF_VIDEO_DOWNSCALER_COEF_MASK     0xF
+
+/* VIDEO DE-INTERLACING AND ALPHA CONTROL */
+
+#define RCDF_NO_CK_OUTSIDE_ALPHA            0x00000100
+#define RCDF_CSC_VIDEO_YUV_TO_RGB           0x00000400
+#define RCDF_VIDEO_INPUT_IS_RGB             0x00002000
+#define RCDF_ALPHA1_PRIORITY_POS			16
+#define RCDF_ALPHA1_PRIORITY_MASK			0x00030000
+#define RCDF_ALPHA2_PRIORITY_POS			18
+#define RCDF_ALPHA2_PRIORITY_MASK			0x000C0000
+#define RCDF_ALPHA3_PRIORITY_POS			20
+#define RCDF_ALPHA3_PRIORITY_MASK			0x00300000
+
+/* VIDEO CURSOR COLOR KEY DEFINITIONS */
+
+#define RCDF_CURSOR_COLOR_KEY_ENABLE      0x20000000
+#define RCDF_CURSOR_COLOR_KEY_OFFSET_POS  24
+#define RCDF_CURSOR_COLOR_BITS            23
+#define RCDF_COLOR_MASK                   0x00FFFFFF /* 24 significant bits */
+
+/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */
+
+#define RCDF_ALPHA_COLOR_ENABLE           0x01000000
+
+/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */
+
+#define RCDF_ACTRL_WIN_ENABLE				0x00010000
+#define RCDF_ACTRL_LOAD_ALPHA				0x00020000
+
+/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */
+
+#define RCDF_VIDEO_Y_REQUEST_POS          0
+#define RCDF_VIDEO_X_REQUEST_POS          16
+#define RCDF_VIDEO_REQUEST_MASK           0x000007FF
+
+/* GEODELINK DEVICE MSR REGISTER SUMMARY */
+
+#define MBD_MSR_CAP         0x2000   /* Device Capabilities                   */
+#define MBD_MSR_CONFIG      0x2001   /* Device Master Configuration Register  */
+#define MBD_MSR_SMI         0x2002   /* MBus Device SMI Register              */
+#define MBD_MSR_ERROR       0x2003   /* MBus Device Error                     */
+#define MBD_MSR_PM          0x2004   /* MBus Device Power Management Register */
+#define MBD_MSR_DIAG        0x2005   /* Mbus Device Diagnostic Register       */
+
+/* DISPLAY FILTER MBD_MSR_DIAG DEFINITIONS */
+
+#define RCDF_MBD_DIAG_SEL0        0x00007FFF /* Lower 32-bits of Diag Bus Select     */
+#define RCDF_MBD_DIAG_EN0         0x00008000 /* Enable for lower 32-bits of diag bus */
+#define RCDF_MBD_DIAG_SEL1        0x7FFF0000 /* Upper 32-bits of Diag Bus Select     */
+#define RCDF_MBD_DIAG_EN1         0x80000000 /* Enable for upper 32-bits of diag bus */
+
+/* DISPLAY FILTER MBD_MSR_CONFIG DEFINITIONS */
+
+#define RCDF_CONFIG_FMT_MASK      0x00000038 /* Output Format */
+#define RCDF_CONFIG_FMT_CRT       0x00000000
+#define RCDF_CONFIG_FMT_FP        0x00000008 
+
+/* MCP MSR DEFINITIONS */
+
+#define MCP_CLKOFF                0x0010
+#define MCP_CLKACTIVE             0x0011
+#define MCP_CLKDISABLE            0x0012
+#define MCP_CLK4ACK               0x0013
+#define MCP_SYS_RSTPLL            0x0014
+#define MCP_DOTPLL                0x0015
+#define MCP_DBGCLKCTL             0x0016
+#define MCP_RC_REVID              0x0017
+#define MCP_SETM0CTL              0x0040
+#define MCP_SETN0CTL              0x0048
+#define MCP_CMPVAL0               0x0050
+#define MCP_CMPMASK0              0x0051
+#define MCP_REGA                  0x0058
+#define MCP_REGB                  0x0059
+#define MCP_REGAMASK              0x005A
+#define MCP_REGAVAL               0x005B
+#define MCP_REGBMASK              0x005C
+#define MCP_REGBVAL               0x005D
+#define MCP_FIFOCTL               0x005E
+#define MCP_DIAGCTL               0x005F
+#define MCP_H0CTL                 0x0060
+#define MCP_XSTATE                0x0066
+#define MCP_YSTATE                0x0067
+#define MCP_ACTION0               0x0068
+
+/* MCP_SYS_RSTPLL DEFINITIONS */
+
+#define MCP_DOTPOSTDIV3           0x00000008
+#define MCP_DOTPREMULT2           0x00000004
+#define MCP_DOTPREDIV2            0x00000002
+
+/* MCP MBD_MSR_DIAG DEFINITIONS */
+
+#define MCP_MBD_DIAG_SEL0         0x00000007
+#define MCP_MBD_DIAG_EN0          0x00008000
+#define MCP_MBD_DIAG_SEL1         0x00070000
+#define MCP_MBD_DIAG_EN1          0x80000000
+
+/* MCP_DOTPLL DEFINITIONS */
+
+#define MCP_DOTPLL_P              0x00000003
+#define MCP_DOTPLL_N              0x000001FC
+#define MCP_DOTPLL_M              0x00001E00
+#define MCP_DOTPLL_LOCK           0x02000000
+#define MCP_DOTPLL_BYPASS         0x00008000
+
+
+/*---------------------------------------------------*/
+/*  THIRD GENERATION DISPLAY CONTROLLER (CASTLE)     */
+/*---------------------------------------------------*/
+
+#define DC3_UNLOCK              0x00000000  /* Unlock register               */
+#define DC3_GENERAL_CFG         0x00000004  /* Config registers              */
+#define DC3_DISPLAY_CFG         0x00000008  
+
+#define DC3_FB_ST_OFFSET        0x00000010  /* Frame buffer start offset     */
+#define DC3_CB_ST_OFFSET        0x00000014  /* Compression start offset      */
+#define DC3_CURS_ST_OFFSET      0x00000018  /* Cursor buffer start offset    */
+#define DC3_VID_Y_ST_OFFSET     0x00000020  /* Video Y Buffer start offset   */
+#define DC3_VID_U_ST_OFFSET     0x00000024  /* Video U Buffer start offset   */
+#define DC3_VID_V_ST_OFFSET     0x00000028  /* Video V Buffer start offset   */
+#define DC3_LINE_SIZE           0x00000030  /* Video, CB, and FB line sizes  */
+#define DC3_GFX_PITCH           0x00000034  /* FB and DB skip counts         */
+#define DC3_VID_YUV_PITCH       0x00000038  /* Y, U and V buffer skip counts */
+
+#define DC3_H_ACTIVE_TIMING     0x00000040  /* Horizontal timings            */
+#define DC3_H_BLANK_TIMING      0x00000044
+#define DC3_H_SYNC_TIMING       0x00000048
+#define DC3_V_ACTIVE_TIMING     0x00000050  /* Vertical Timings              */
+#define DC3_V_BLANK_TIMING      0x00000054
+#define DC3_V_SYNC_TIMING       0x00000058
+
+#define DC3_CURSOR_X            0x00000060  /* Cursor X position             */
+#define DC3_CURSOR_Y            0x00000064  /* Cursor Y Position             */
+#define DC3_LINE_CNT_STATUS     0x0000006C  /* Icon Y Position               */
+
+#define DC3_PAL_ADDRESS         0x00000070  /* Palette Address               */
+#define DC3_PAL_DATA            0x00000074  /* Palette Data                  */
+#define DC3_DFIFO_DIAG          0x00000078  /* Display FIFO diagnostic       */
+#define DC3_CFIFO_DIAG          0x0000007C  /* Compression FIFO diagnostic   */
+
+#define DC3_VID_DS_DELTA        0x00000080  /* Vertical Downscaling fraction */
+
+#define DC3_PHY_MEM_OFFSET      0x00000084  /* VG Base Address Register      */
+#define DC3_DV_CTL              0x00000088  /* Dirty-Valid Control Register  */
+#define DC3_DV_ACC              0x0000008C  /* Dirty-Valid RAM Access        */
+
+#define DC3_COLOR_KEY           0x000000B8  /* Graphics color key            */
+#define DC3_COLOR_MASK          0x000000BC  /* Graphics color key mask       */
+
+/* UNLOCK VALUE */
+
+#define DC3_UNLOCK_VALUE		0x00004758		/* used to unlock DC regs	*/
+
+/* VG MBUS DEVICE SMI MSR FIELDS */
+
+#define DC3_VG_BL_MASK            0x00000001
+#define DC3_MISC_MASK             0x00000002
+#define DC3_ISR0_MASK             0x00000004
+#define DC3_VGA_BL_MASK           0x00000008
+#define DC3_CRTCIO_MSK            0x00000010
+#define DC3_VG_BLANK_SMI          0x00000001
+#define DC3_MISC_SMI              0x00000002
+#define DC3_ISR0_SMI              0x00000004
+#define DC3_VGA_BLANK_SMI         0x00000008
+#define DC3_CRTCIO_SMI            0x00000010
+
+/* DC3_GENERAL_CFG BIT FIELDS */
+
+#define DC3_GCFG_DBUG             0x80000000
+#define DC3_GCFG_DBSL             0x40000000
+#define DC3_GCFG_CFRW             0x20000000
+#define DC3_GCFG_DIAG             0x10000000
+#define DC3_GCFG_GXRFS4           0x08000000
+#define DC3_GCFG_SGFR             0x04000000
+#define DC3_GCFG_SGRE             0x02000000
+#define DC3_GCFG_SIGE             0x01000000
+#define DC3_GCFG_YUVM             0x00100000
+#define DC3_GCFG_VDSE             0x00080000
+#define DC3_GCFG_VGAFT            0x00040000
+#define DC3_GCFG_FDTY             0x00020000
+#define DC3_GCFG_STFM             0x00010000
+#define DC3_GCFG_DFHPEL_MASK      0x0000F000
+#define DC3_GCFG_DFHPSL_MASK      0x00000F00
+#define DC3_GCFG_VGAE             0x00000080
+#define DC3_GCFG_DECE             0x00000040
+#define DC3_GCFG_CMPE             0x00000020
+#define DC3_GCFG_VIDE             0x00000008
+#define DC3_GCFG_ICNE             0x00000004
+#define DC3_GCFG_CURE             0x00000002
+#define DC3_GCFG_DFLE             0x00000001
+
+/* DC3_DISPLAY_CFG BIT FIELDS */
+
+#define DC3_DCFG_A20M             0x80000000
+#define DC3_DCFG_A18M             0x40000000
+#define DC3_DCFG_VISL             0x08000000
+#define DC3_DCFG_FRLK             0x04000000
+#define DC3_DCFG_PALB             0x02000000
+#define DC3_DCFG_PIX_PAN_MASK     0x00F00000
+#define DC3_DCFG_DCEN             0x00080000
+#define DC3_DCFG_16BPP_MODE_MASK  0x00000C00
+#define DC3_DCFG_16BPP            0x00000000        
+#define DC3_DCFG_15BPP            0x00000400
+#define DC3_DCFG_12BPP            0x00000800
+#define DC3_DCFG_DISP_MODE_MASK   0x00000300
+#define DC3_DCFG_DISP_MODE_8BPP   0x00000000
+#define DC3_DCFG_DISP_MODE_16BPP  0x00000100
+#define DC3_DCFG_DISP_MODE_24BPP  0x00000200
+#define DC3_DCFG_SCLE             0x00000080
+#define DC3_DCFG_TRUP             0x00000040
+#define DC3_DCFG_VIEN             0x00000020
+#define DC3_DCFG_VDEN             0x00000010
+#define DC3_DCFG_GDEN             0x00000008
+#define DC3_DCFG_VCKE             0x00000004
+#define DC3_DCFG_PCKE             0x00000002
+#define DC3_DCFG_TGEN             0x00000001
+
+/* DC3_LINE_CNT BIT FIELDS     */
+
+#define DC3_LNCNT_DNA             0x80000000
+#define DC3_LNCNT_VNA             0x40000000
+#define DC3_LNCNT_VSA             0x20000000
+#define DC3_LNCNT_VINT            0x10000000
+#define DC3_LNCNT_FLIP            0x08000000
+#define DC3_LNCNT_V_LINE_CNT      0x07FF0000
+#define DC3_LNCNT_VFLIP           0x00008000
+#define DC3_LNCNT_SIGC            0x00004000
+#define DC3_LNCNT_SS_LINE_CMP     0x000007FF
+
+/* DC3_FB_ST_OFFSET BIT FIELDS */
+
+#define DC3_FB_ST_OFFSET_MASK     0x0FFFFFFF
+
+/* DC3_CB_ST_OFFSET BIT FIELDS */
+
+#define DC3_CB_ST_OFFSET_MASK     0x0FFFFFFF
+
+/* DC3_CURS_ST_OFFSET BIT FIELDS */
+
+#define DC3_CURS_ST_OFFSET_MASK   0x0FFFFFFF
+
+/* DC3_ICON_ST_OFFSET BIT FIELDS */
+
+#define DC3_ICON_ST_OFFSET_MASK   0x0FFFFFFF
+
+/* DC3_VID_Y_ST_OFFSET BIT FIELDS */
+
+#define DC3_VID_Y_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* DC3_VID_U_ST_OFFSET BIT FIELDS */
+
+#define DC3_VID_U_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* DC3_VID_V_ST_OFFSET BIT FIELDS */
+
+#define DC3_VID_V_ST_OFFSET_MASK  0x0FFFFFFF
+
+/* DC3_LINE_SIZE BIT FIELDS */
+
+#define DC3_LINE_SIZE_VLS_MASK    0x3FF00000
+#define DC3_LINE_SIZE_CBLS_MASK   0x0007F000
+#define DC3_LINE_SIZE_FBLS_MASK   0x000003FF
+#define DC3_LINE_SIZE_CB_SHIFT    12
+#define DC3_LINE_SIZE_VB_SHIFT    20
+
+/* DC3_GFX_PITCH BIT FIELDS */
+
+#define DC3_GFX_PITCH_CBP_MASK    0xFFFF0000
+#define DC3_GFX_PITCH_FBP_MASK    0x0000FFFF
+
+/* DC3_VID_YUV_PITCH BIT FIELDS */
+
+#define DC3_YUV_PITCH_UVP_MASK    0xFFFF0000
+#define DC3_YUV_PITCH_YBP_MASK    0x0000FFFF
+
+/* DC3_H_ACTIVE_TIMING BIT FIELDS */
+
+#define DC3_HAT_HT_MASK           0x0FF80000
+#define DC3_HAT_HA_MASK           0x00000FF8
+
+/* DC3_H_BLANK_TIMING BIT FIELDS */
+
+#define DC3_HBT_HBE_MASK          0x0FF80000
+#define DC3_HBT_HBS_MASK          0x00000FF8
+
+/* DC3_H_SYNC_TIMING BIT FIELDS */
+
+#define DC3_HST_HSE_MASK          0x0FF80000
+#define DC3_HST_HSS_MASK          0x00000FF8 
+
+/* DC3_V_ACTIVE_TIMING BIT FIELDS */
+
+#define DC3_VAT_VT_MASK           0x07FF0000
+#define DC3_VAT_VA_MASK           0x000007FF
+
+/* DC3_V_BLANK_TIMING BIT FIELDS */
+
+#define DC3_VBT_VBE_MASK          0x07FF0000
+#define DC3_VBT_VBS_MASK          0x000007FF
+
+/* DC3_V_SYNC_TIMING BIT FIELDS */
+
+#define DC3_VST_VSE_MASK          0x07FF0000
+#define DC3_VST_VSS_MASK          0x000007FF 
+
+/* DC3_DV_CTL BIT DEFINITIONS */
+
+#define DC3_DV_LINE_SIZE_MASK     0x00000C00
+#define DC3_DV_LINE_SIZE_1024     0x00000000
+#define DC3_DV_LINE_SIZE_2048     0x00000400
+#define DC3_DV_LINE_SIZE_4096     0x00000800
+#define DC3_DV_LINE_SIZE_8192     0x00000C00
+
+#define DC3_CLR_KEY_DATA_MASK     0x00FFFFFF
+#define DC3_CLR_KEY_ENABLE        0x01000000
+#define DC3_CLR_KEY_INVERT        0x02000000
+
+/* VGA DEFINITIONS */
+
+#define DC3_SEQUENCER_INDEX       0x03C4
+#define DC3_SEQUENCER_DATA        0x03C5
+#define DC3_SEQUENCER_RESET       0x00
+#define DC3_SEQUENCER_CLK_MODE    0x01
+
+#define DC3_RESET_VGA_DISP_ENABLE 0x03
+#define DC3_CLK_MODE_SCREEN_OFF   0x20
+
+/*---------------------------------------------------*/
+/*  CASTLE DISPLAY FILTER                          */
+/*---------------------------------------------------*/
+
+/* CASTLE VIDEO REGISTER DEFINITIONS */
+
+#define CASTLE_VIDEO_CONFIG 				    0x000
+#define CASTLE_DISPLAY_CONFIG				    0x008
+#define CASTLE_VIDEO_X_POS						0x010
+#define CASTLE_VIDEO_Y_POS						0x018
+#define CASTLE_VIDEO_COLOR_KEY					0x028
+#define CASTLE_VIDEO_COLOR_MASK					0x030
+#define CASTLE_PALETTE_ADDRESS 					0x038
+#define CASTLE_PALETTE_DATA	 					0x040
+#define CASTLE_VID_MISC							0x050
+#define CASTLE_VID_CLOCK_SELECT					0x058
+#define CASTLE_VIDEO_YSCALE                     0x060
+#define CASTLE_VIDEO_XSCALE                     0x068
+#define CASTLE_VIDEO_DOWNSCALER_CONTROL			0x078 
+#define CASTLE_VID_CRC							0x088
+#define CASTLE_VID_CRC32						0x090
+#define CASTLE_VID_ALPHA_CONTROL			    0x098
+#define CASTLE_CURSOR_COLOR_KEY					0x0A0
+#define CASTLE_CURSOR_COLOR_MASK			    0x0A8
+#define CASTLE_CURSOR_COLOR_1				    0x0B0
+#define CASTLE_CURSOR_COLOR_2				    0x0B8
+#define CASTLE_ALPHA_XPOS_1						0x0C0
+#define CASTLE_ALPHA_YPOS_1						0x0C8
+#define CASTLE_ALPHA_COLOR_1				    0x0D0
+#define CASTLE_ALPHA_CONTROL_1					0x0D8
+#define CASTLE_ALPHA_XPOS_2						0x0E0
+#define CASTLE_ALPHA_YPOS_2						0x0E8
+#define CASTLE_ALPHA_COLOR_2				    0x0F0
+#define CASTLE_ALPHA_CONTROL_2					0x0F8
+#define CASTLE_ALPHA_XPOS_3						0x100
+#define CASTLE_ALPHA_YPOS_3						0x108
+#define CASTLE_ALPHA_COLOR_3				    0x110
+#define CASTLE_ALPHA_CONTROL_3					0x118
+#define CASTLE_VIDEO_REQUEST					0x120
+#define CASTLE_ALPHA_WATCH						0x128
+#define CASTLE_VIDEO_TEST_MODE					0x210
+#define CASTLE_POWER_MANAGEMENT					0x410
+
+/* DISPLAY FILTER POWER MANAGEMENT DEFINITIONS */
+
+#define CASTLE_PM_PANEL_POWER_ON				0x01000000
+
+/* DISPLAY FILTER MSRS */
+
+#define CASTLE_MBD_MSR_DIAG_DF					0x2010
+#define CASTLE_DIAG_32BIT_CRC					0x80000000
+
+/* "CASTLE_VIDEO_CONFIG" BIT DEFINITIONS */
+
+#define CASTLE_VCFG_VID_EN						0x00000001	
+#define CASTLE_VCFG_VID_INP_FORMAT				0x0000000C
+#define CASTLE_VCFG_SCALER_BYPASS               0x00000020	
+#define CASTLE_VCFG_X_FILTER_EN					0x00000040	
+#define CASTLE_VCFG_Y_FILTER_EN					0x00000080	
+#define CASTLE_VCFG_LINE_SIZE_LOWER_MASK	    0x0000FF00	
+#define CASTLE_VCFG_INIT_READ_MASK				0x01FF0000	
+#define CASTLE_VCFG_LINE_SIZE_UPPER				0x08000000	
+#define CASTLE_VCFG_4_2_0_MODE					0x10000000	
+#define CASTLE_VCFG_UYVY_FORMAT					0x00000000
+#define CASTLE_VCFG_Y2YU_FORMAT					0x00000004
+#define CASTLE_VCFG_YUYV_FORMAT					0x00000008
+#define CASTLE_VCFG_YVYU_FORMAT					0x0000000C
+
+/* "CASTLE_DISPLAY_CONFIG" BIT DEFINITIONS */
+
+#define CASTLE_DCFG_DIS_EN						0x00000001	
+#define CASTLE_DCFG_HSYNC_EN				    0x00000002	
+#define CASTLE_DCFG_VSYNC_EN				    0x00000004	
+#define CASTLE_DCFG_DAC_BL_EN				    0x00000008	
+#define CASTLE_DCFG_FP_PWR_EN				    0x00000040
+#define CASTLE_DCFG_FP_DATA_EN					0x00000080	
+#define CASTLE_DCFG_CRT_HSYNC_POL 				0x00000100	
+#define CASTLE_DCFG_CRT_VSYNC_POL 				0x00000200		
+#define CASTLE_DCFG_CRT_SYNC_SKW_MASK		    0x0001C000
+#define CASTLE_DCFG_CRT_SYNC_SKW_INIT		    0x00010000
+#define CASTLE_DCFG_PWR_SEQ_DLY_MASK		    0x000E0000
+#define CASTLE_DCFG_PWR_SEQ_DLY_INIT		    0x00080000
+#define CASTLE_DCFG_VG_CK					    0x00100000
+#define CASTLE_DCFG_GV_PAL_BYP					0x00200000
+#define CASTLE_DAC_VREF							0x04000000
+#define CASTLE_FP_ON_STATUS						0x08000000
+
+/* "CASTLE_VID_MISC" BIT DEFINITIONS */
+
+#define CASTLE_GAMMA_BYPASS_BOTH				0x00000001
+#define CASTLE_DAC_POWER_DOWN					0x00000400
+#define CASTLE_ANALOG_POWER_DOWN				0x00000800
+
+/* "CASTLE_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */
+
+#define CASTLE_VIDEO_DOWNSCALE_ENABLE			0x00000001
+#define CASTLE_VIDEO_DOWNSCALE_FACTOR_POS		1
+#define CASTLE_VIDEO_DOWNSCALE_FACTOR_MASK		0x0000001E
+#define CASTLE_VIDEO_DOWNSCALE_TYPE_A			0x00000000
+#define CASTLE_VIDEO_DOWNSCALE_TYPE_B			0x00000040
+#define CASTLE_VIDEO_DOWNSCALE_TYPE_MASK		0x00000040
+
+/* "CASTLE_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */
+
+#define CASTLE_VIDEO_DOWNSCALER_COEF1_POS		0
+#define CASTLE_VIDEO_DOWNSCALER_COEF2_POS		8
+#define CASTLE_VIDEO_DOWNSCALER_COEF3_POS		16
+#define CASTLE_VIDEO_DOWNSCALER_COEF4_POS		24
+#define CASTLE_VIDEO_DOWNSCALER_COEF_MASK		0xF
+
+/* VIDEO DE-INTERLACING AND ALPHA CONTROL */
+
+#define CASTLE_NO_CK_OUTSIDE_ALPHA				0x00000100
+#define CASTLE_CSC_VIDEO_YUV_TO_RGB				0x00000400
+#define CASTLE_VIDEO_INPUT_IS_RGB				0x00002000
+#define CASTLE_ALPHA1_PRIORITY_POS				16
+#define CASTLE_ALPHA1_PRIORITY_MASK				0x00030000
+#define CASTLE_ALPHA2_PRIORITY_POS				18
+#define CASTLE_ALPHA2_PRIORITY_MASK				0x000C0000
+#define CASTLE_ALPHA3_PRIORITY_POS				20
+#define CASTLE_ALPHA3_PRIORITY_MASK				0x00300000
+
+/* VIDEO CURSOR COLOR KEY DEFINITIONS */
+
+#define CASTLE_CURSOR_COLOR_KEY_ENABLE			0x20000000
+#define CASTLE_CURSOR_COLOR_KEY_OFFSET_POS		24
+#define CASTLE_CURSOR_COLOR_BITS				23
+#define CASTLE_COLOR_MASK						0x00FFFFFF /* 24 significant bits */
+
+/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */
+
+#define CASTLE_ALPHA_COLOR_ENABLE				0x01000000
+
+/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */
+
+#define CASTLE_ACTRL_WIN_ENABLE					0x00010000
+#define CASTLE_ACTRL_LOAD_ALPHA					0x00020000
+
+/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */
+
+#define CASTLE_VIDEO_Y_REQUEST_POS				0
+#define CASTLE_VIDEO_X_REQUEST_POS				16
+#define CASTLE_VIDEO_REQUEST_MASK				0x000007FF
+
+/* END OF FILE */
+
diff --git a/Source/DirectFB/gfxdrivers/nsc/include/gfx_type.h b/Source/DirectFB/gfxdrivers/nsc/include/gfx_type.h
new file mode 100755
index 0000000..71be2d9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/gfx_type.h
@@ -0,0 +1,426 @@
+/*
+ * $Workfile: gfx_type.h $
+ *
+ * This header file defines the pneumonics used when calling Durango routines. 
+ * This file is automatically included by gfx_rtns.h
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software 
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the 
+ * Software is received by the Licensee.
+ * 
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated 
+ * NSC_LIC_GPL applies to this Software; in all other circumstances 
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ *
+ *   * Redistributions of source code must retain the above copyright 
+ *     notice, this list of conditions and the following disclaimer. 
+ *
+ *   * Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the following 
+ *     disclaimer in the documentation and/or other materials provided 
+ *     with the distribution. 
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor 
+ *     the names of its contributors may be used to endorse or promote 
+ *     products derived from this software without specific prior 
+ *     written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted under the terms of the GNU General 
+ * Public License as published by the Free Software Foundation; either 
+ * version 2 of the License, or (at your option) any later version  
+ *
+ * In addition to the terms of the GNU General Public License, neither 
+ * the name of the National Semiconductor Corporation nor the names of 
+ * its contributors may be used to endorse or promote products derived 
+ * from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE. See the GNU General Public License for more details. 
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * You should have received a copy of the GNU General Public License 
+ * along with this file; if not, write to the Free Software Foundation, 
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *
+ * END_NSC_LIC_GPL */
+
+
+#ifndef _gfx_type_h
+#define _gfx_type_h
+
+/* MSR DEFINITIONS */
+
+typedef enum DevStatus { FOUND, NOT_KNOWN, REQ_NOT_FOUND, REQ_NOT_INSTALLED } DEV_STATUS;
+
+typedef struct msr {
+	DEV_STATUS Present;		   /* Node enumeration status                              */
+	unsigned char Id;		   /* Device ID (from MSR specs)                           */
+	unsigned long Address;	   /* Address - 32-bit MBus address at which 'Id' is found */
+} MSR;
+
+typedef struct mValue {
+	unsigned long high;
+	unsigned long low;
+} Q_WORD;
+
+typedef struct mbusNode {
+	unsigned long address;
+	unsigned int  deviceId;
+	unsigned int  claimed;
+} MBUS_NODE;
+
+/* MSR ARRAY INDEXES */
+/* These are indexes into the array of MBus devices. These     */
+/* should not be confused with the class codes at MSR register */
+/* 0x2000.                                                     */
+
+#define RC_ID_MBIU0 0x00
+#define RC_ID_MBIU1 0x01
+#define RC_ID_MCP   0x02
+#define RC_ID_MPCI  0x03
+#define RC_ID_MC    0x04
+#define RC_ID_GP    0x05
+#define RC_ID_VG    0x06
+#define RC_ID_DF    0x07
+#define RC_ID_FG    0x08
+#define RC_ID_VA    0x09
+#define CP_ID_MBIU	0x0A
+#define CP_ID_MPCI	0x0B
+#define CP_ID_USB2	0x0C
+#define CP_ID_ATAC	0x0D
+#define CP_ID_MDD 	0x0E
+#define CP_ID_ACC 	0x0F
+#define CP_ID_USB1	0x10
+#define CP_ID_MCP 	0x11
+ 
+/* MBUS DEVICE CLASS CODES */
+/* These are the device ids for the known Redcloud MBus devices. */
+
+#define RC_CC_MBIU  0x01
+#define RC_CC_MCP   0x02
+#define RC_CC_MPCI  0x05
+#define RC_CC_MC    0x20
+#define RC_CC_GP    0x3D
+#define RC_CC_VG    0x3E
+#define RC_CC_DF    0x3F
+#define RC_CC_FG    0xF0
+#define RC_CC_VA    0x86
+#define CP_CC_MBIU	0x01
+#define CP_CC_MPCI	0x05
+#define CP_CC_USB2	0x42
+#define CP_CC_ATAC	0x47
+#define CP_CC_MDD 	0xDF
+#define CP_CC_ACC 	0x33
+#define CP_CC_USB1	0x42
+#define CP_CC_MCP 	0x02
+
+/* VAIL AND MBIUS ARE AT KNOWN ADDRESSES */
+/* We can initialize the addresses of these devices in advance,  */
+/* as their location should never change.                        */
+
+#define RC_MB0_MBIU0	0x10000000
+#define RC_MB0_MBIU1	0x40000000
+#define CP_MB0_MBIU0	0x51010000
+#define RC_MB0_CPU 	  	0x00000000
+#define FAKE_ADDRESS    0xFFFFFFFF
+
+/* MSR PORT DESCRIPTORS */
+
+#define NOT_POPULATED 	0
+#define NOT_INSTALLED   0xFFFE
+#define REFLECTIVE		0xFFFF
+
+/* CRC DATA SOURCES */
+
+#define CRC_SOURCE_GFX_DATA  0x00
+#define CRC_SOURCE_CRT_RGB   0x01
+#define CRC_SOURCE_FP_DATA   0x02
+
+
+/* TV DEFINITIONS */
+
+typedef enum TVStandardType {
+	TV_STANDARD_NTSC = 1,
+    TV_STANDARD_PAL
+} TVStandardType;
+
+typedef enum GfxOnTVType {
+	GFX_ON_TV_SQUARE_PIXELS = 1,
+	GFX_ON_TV_NO_SCALING
+} GfxOnTVType;
+
+#define CRT_DISABLE 0x00
+#define CRT_ENABLE  0x01
+#define CRT_STANDBY 0x02
+#define CRT_SUSPEND 0x03
+
+#define TV_OUTPUT_COMPOSITE	0x01
+#define TV_OUTPUT_S_VIDEO	0x02
+#define TV_OUTPUT_YUV   	0x03
+#define TV_OUTPUT_SCART   	0x04
+
+#define TV_FLICKER_FILTER_NONE	      0x01
+#define TV_FLICKER_FILTER_NORMAL      0x02
+#define TV_FLICKER_FILTER_INTERLACED  0x03
+
+#define TV_YC_DELAY_NONE	          0x01
+#define TV_Y_DELAY_ONE_PIXEL          0x02
+#define TV_C_DELAY_ONE_PIXEL          0x03
+#define TV_C_DELAY_TWO_PIXELS         0x04
+
+#define TV_SUB_CARRIER_RESET_NEVER              0x01
+#define TV_SUB_CARRIER_RESET_EVERY_TWO_LINES    0x02
+#define TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES   0x03
+#define TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES  0x04
+
+#define TVENC_RESET_EVERY_ODD_FIELD     0x01
+#define TVENC_RESET_EVERY_EVEN_FIELD    0x02
+#define TVENC_RESET_NEXT_ODD_FIELD      0x03
+#define TVENC_RESET_NEXT_EVEN_FIELD     0x04
+#define TVENC_RESET_EVERY_FIELD         0x05
+#define TVENC_RESET_EVERY_X_ODD_FIELDS  0x06
+#define TVENC_RESET_EVERY_X_EVEN_FIELDS 0x07
+
+/* VBI FORMATS */
+
+#define VBI_FORMAT_VIDEO	0x1
+#define VBI_FORMAT_RAW		0x2
+#define VBI_FORMAT_CC		0x4
+#define VBI_FORMAT_NABTS	0x8
+
+/* VIDEO DEFINITIONS */
+
+#define VIDEO_FORMAT_UYVY            0x0
+#define VIDEO_FORMAT_Y2YU            0x1
+#define VIDEO_FORMAT_YUYV            0x2
+#define VIDEO_FORMAT_YVYU            0x3
+#define VIDEO_FORMAT_Y0Y1Y2Y3        0x4
+#define VIDEO_FORMAT_Y3Y2Y1Y0        0x5
+#define VIDEO_FORMAT_Y1Y0Y3Y2        0x6
+#define VIDEO_FORMAT_Y1Y2Y3Y0        0x7
+#define VIDEO_FORMAT_RGB             0x8
+#define VIDEO_FORMAT_P2M_P2L_P1M_P1L 0x9
+#define VIDEO_FORMAT_P1M_P1L_P2M_P2L 0xA
+#define VIDEO_FORMAT_P1M_P2L_P2M_P1L 0xB
+
+#define VIDEO_DOWNSCALE_KEEP_1_OF 0x1
+#define VIDEO_DOWNSCALE_DROP_1_OF 0x2
+
+typedef enum VideoSourceType { /* The source from which the video processor shows full screen video */
+	VIDEO_SOURCE_MEMORY = 1,
+	VIDEO_SOURCE_DVIP
+} VideoSourceType;
+
+typedef enum VbiSourceType { /* The source from which the video processor takes VBI */
+	VBI_SOURCE_MEMORY = 1,
+	VBI_SOURCE_DVIP
+} VbiSourceType;
+
+/* GENLOCK DEFINITIONS */
+
+#define GENLOCK_SINGLE                     0x001
+#define GENLOCK_FIELD_SYNC                 0x001
+#define GENLOCK_CONTINUOUS                 0x002
+#define GENLOCK_SYNCED_EDGE_FALLING        0x004
+#define GENLOCK_SYNCING_EDGE_FALLING       0x008
+#define GENLOCK_TIMEOUT                    0x010
+#define GENLOCK_TVENC_RESET_EVEN_FIELD     0x020
+#define GENLOCK_TVENC_RESET_BEFORE_DELAY   0x040
+#define GENLOCK_TVENC_RESET                0x080
+#define GENLOCK_SYNC_TO_TVENC              0x100
+
+/* VIP DEFINITIONS */
+
+#define VIP_MODE_C          0x1
+
+#define VIP_CAPTURE_STOP_LINE	0x1
+#define VIP_CAPTURE_STOP_FIELD	0x2
+#define VIP_CAPTURE_START_FIELD	0x4
+
+#define VBI_ANCILLARY       0x1
+#define VBI_TASK_A          0x2
+#define VBI_TASK_B          0x4
+
+/* VGA STRUCTURE */
+
+#define GFX_STD_CRTC_REGS 25
+#define GFX_EXT_CRTC_REGS 16
+
+#define GFX_VGA_FLAG_MISC_OUTPUT	0x00000001
+#define GFX_VGA_FLAG_STD_CRTC		0x00000002
+#define GFX_VGA_FLAG_EXT_CRTC		0x00000004
+
+/* FS450 TV Standard flags */
+
+#define GFX_TV_STANDARD_NTSC_M 0x0001
+#define GFX_TV_STANDARD_NTSC_M_J 0x0002
+#define GFX_TV_STANDARD_PAL_B 0x0004
+#define GFX_TV_STANDARD_PAL_D 0x0008
+#define GFX_TV_STANDARD_PAL_H 0x0010
+#define GFX_TV_STANDARD_PAL_I 0x0020
+#define GFX_TV_STANDARD_PAL_M 0x0040
+#define GFX_TV_STANDARD_PAL_N 0x0080
+#define GFX_TV_STANDARD_PAL_G 0x0100
+
+/* FS450 VGA Mode flags */
+
+#define GFX_VGA_MODE_UNKNOWN 0
+#define GFX_VGA_MODE_640X480 0x0001
+#define GFX_VGA_MODE_720X487 0x0002
+#define GFX_VGA_MODE_720X576 0x0004
+#define GFX_VGA_MODE_800X600 0x0008
+#define GFX_VGA_MODE_1024X768 0x0010
+
+/* FS450 TVout mode flags */
+
+#define GFX_TVOUT_MODE_CVBS 0x0001
+#define GFX_TVOUT_MODE_YC 0x0002
+#define GFX_TVOUT_MODE_RGB 0x0004
+#define GFX_TVOUT_MODE_CVBS_YC (GFX_TVOUT_MODE_CVBS | GFX_TVOUT_MODE_YC)
+
+/* FS450 Luma and Chroma Filters */
+
+#define GFX_LUMA_FILTER 0x0001
+#define GFX_CHROMA_FILTER 0x0002
+
+/* APS Trigger Bits */
+
+#define GFX_APS_TRIGGER_OFF 0
+#define GFX_APS_TRIGGER_AGC_ONLY 1
+#define GFX_APS_TRIGGER_AGC_2_LINE 2
+#define GFX_APS_TRIGGER_AGC_4_LINE 3
+
+typedef struct {
+	int xsize;
+	int ysize;
+	int hz;
+	int clock;
+	unsigned char miscOutput;
+	unsigned char stdCRTCregs[GFX_STD_CRTC_REGS];
+	unsigned char extCRTCregs[GFX_EXT_CRTC_REGS];
+} gfx_vga_struct;
+
+/* POSSIBLE STATUS VALUES */
+
+#define GFX_STATUS_UNSUPPORTED		(-3)
+#define GFX_STATUS_BAD_PARAMETER	(-2)
+#define GFX_STATUS_ERROR            (-1)
+#define GFX_STATUS_OK				0
+
+/* CPU AND VIDEO TYPES */
+
+#define GFX_CPU_GXLV		1
+#define GFX_CPU_SC1200		2
+#define GFX_CPU_REDCLOUD    3
+#define GFX_CPU_PYRAMID		0x20801	
+	
+
+#define GFX_VID_CS5530		1
+#define GFX_VID_SC1200		2
+#define GFX_VID_REDCLOUD    3
+
+/* CHIP NAME AND REVISION */
+
+typedef enum ChipType {
+	CHIP_NOT_DETECTED,
+	SC1200_REV_A,
+	SC1200_REV_B1_B2,
+	SC1200_REV_B3,
+	SC1200_REV_C1,
+	SC1200_REV_D1,
+	SC1200_REV_D1_1,
+	SC1200_REV_D2_MVD,	/* Macrovision disabled */
+	SC1200_REV_D2_MVE,	/* Macrovision enabled  */
+	SC1200_FUTURE_REV
+} ChipType;
+
+#endif /* !_gfx_type_h */
diff --git a/Source/DirectFB/gfxdrivers/nsc/include/nsc_galproto.h b/Source/DirectFB/gfxdrivers/nsc/include/nsc_galproto.h
new file mode 100755
index 0000000..67266cc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/nsc_galproto.h
@@ -0,0 +1,1987 @@
+/*
+ * $Workfile: nsc_galproto.h $
+ * $Revision: 1.3 $
+ *
+ * File Contents: This file contains the main functions of the Geode 
+ *                frame buffer device drivers GAL function prototypes and  
+ *                data structures.
+ *
+ * Project:       Geode Frame buffer device driver
+ *
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software 
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the 
+ * Software is received by the Licensee.
+ * 
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated 
+ * NSC_LIC_GPL applies to this Software; in all other circumstances 
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ *
+ *   * Redistributions of source code must retain the above copyright 
+ *     notice, this list of conditions and the following disclaimer. 
+ *
+ *   * Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the following 
+ *     disclaimer in the documentation and/or other materials provided 
+ *     with the distribution. 
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor 
+ *     the names of its contributors may be used to endorse or promote 
+ *     products derived from this software without specific prior 
+ *     written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted under the terms of the GNU General 
+ * Public License as published by the Free Software Foundation; either 
+ * version 2 of the License, or (at your option) any later version  
+ *
+ * In addition to the terms of the GNU General Public License, neither 
+ * the name of the National Semiconductor Corporation nor the names of 
+ * its contributors may be used to endorse or promote products derived 
+ * from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE. See the GNU General Public License for more details. 
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * You should have received a copy of the GNU General Public License 
+ * along with this file; if not, write to the Free Software Foundation, 
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *
+ * END_NSC_LIC_GPL */
+
+#ifndef __GALPROTO_SEP_20_2000
+#define __GALPROTO_SEP_20_2000
+
+/* durango reg definitions and type's */
+#include <gfx_type.h>
+#include <gfx_regs.h>
+
+/* Panel related definition */
+#include <pnl_defs.h>
+
+typedef int SWORD;
+typedef unsigned int DWORD;
+typedef unsigned short WORD;
+typedef unsigned char CHAR;
+typedef unsigned char BOOLEAN;
+typedef unsigned int *PDWORD;
+
+/***************************************/
+/* Applications/User mode drivers use this ioctl to
+ * send a graphics device request to the frame buffer
+ * driver
+ */
+#define FBIOGAL_API      0x4700
+
+/*
+ * Applications must sign the I/O packet with this value
+ */
+
+#define FBGAL_SIGNATURE 0xC0C0BABE
+
+/*
+ * Version is a 16:16 fixed value
+ * Current version is 1.0000
+ */
+
+#define FBGAL_VERSION 0x10000
+
+/*
+ * Definitions for Graphics Subfunctions
+ *
+ */
+
+typedef enum GALFN_CODES
+{
+/* General Adapter level functions */
+   GALFN_GETADAPTERINFO = 0,
+   GALFN_SETSOFTVGASTATE,
+   GALFN_GETSOFTVGASTATE,
+   GALFN_WAITUNTILIDLE,
+   GALFN_WAITVERTICALBLANK,
+   GALFN_SETCRTENABLE,
+   GALFN_WRITEREG,
+   GALFN_READREG,
+
+/* Change/Get Display hardware state */
+
+   GALFN_ISDISPLAYMODESUPPORTED,
+   GALFN_SETDISPLAYMODE,
+   GALFN_GETDISPLAYMODE,
+   GALFN_SETBPP,
+   GALFN_SETDISPLAYBPP,
+   GALFN_GETDISPLAYBPP,
+   GALFN_SETDISPLAYPITCH,
+   GALFN_GETDISPLAYPITCH,
+   GALFN_SETDISPLAYOFFSET,
+   GALFN_GETDISPLAYOFFSET,
+   GALFN_DOTCLKTOREFRESH,
+   GALFN_GETDISPLAYTIMINGS,
+   GALFN_SETDISPLAYTIMINGS,
+   GALFN_SETPALETTE,
+   GALFN_GETPALETTE,
+   GALFN_SETPALETTE_ENTRY,
+   GALFN_GETPALETTE_ENTRY,
+   GALFN_SETFIXEDTIMINGS,
+
+/* Hardware cursor funtions */
+
+   GALFN_SETCURSORENABLE,
+   GALFN_GETCURSORENABLE,
+   GALFN_SETCURSORPOSITION,
+   GALFN_GETCURSORPOSITION,
+   GALFN_SETCURSORCOLORS,
+   GALFN_GETCURSORCOLORS,
+   GALFN_SETCURSORSHAPE,
+   GALFN_SETCURSORSHAPE_RCLD,
+
+/* grafix rendering funtions */
+   GALFN_SETSOLIDPATTERN,
+   GALFN_SETRASTEROPERATION,
+   GALFN_SETSOLIDSOURCE,
+   GALFN_PATTERNFILL,
+   GALFN_SETMONOSOURCE,
+   GALFN_SETMONOPATTERN,
+   GALFN_SCREENTOSCREENBLT,
+   GALFN_SCREENTOSCREENXBLT,
+   GALFN_BRESENHAMLINE,
+   GALFN_COLOR_PATTERNFILL,
+   GALFN_COLOR_BITMAP_TO_SCREEN_BLT,
+   GALFN_COLOR_BITMAP_TO_SCREEN_XBLT,
+   GALFN_MONO_BITMAP_TO_SCREEN_BLT,
+   GALFN_TEXT_BLT,
+
+/* VGA Support functions */
+
+   GALFN_VGAMODESWITCH,
+   GALFN_VGACLEARCRTEXT,
+   GALFN_VGASETPITCH,
+   GALFN_VGARESTORE,
+   GALFN_VGASAVE,
+   GALFN_VGASETMODE,
+
+/* Compression functions */
+   GALFN_SETCOMPRESSIONSTATE,
+   GALFN_GETCOMPRESSIONSTATE,
+   GALFN_SETCOMPRESSIONPARAMS,
+   GALFN_GETCOMPRESSIONPARAMS,
+
+/* Panel Support functions */
+
+   GALFN_PNLSETPARAMS,
+   GALFN_PNLGETPARAMS,
+   GALFN_PNLINITPANEL,
+   GALFN_PNLSAVESTATE,
+   GALFN_PNLRESTORESTATE,
+   GALFN_PNLPOWERUP,
+   GALFN_PNLPOWERDOWN,
+   GALFN_PNLBIOSENABLE,
+   GALFN_PNLBIOSINFO,
+   GALFN_ENABLEPANNING,
+
+/* TV Support functions */
+
+   GALFN_SETTVPARAMS,
+   GALFN_GETTVPARAMS,
+   GALFN_SETTVTIMING,
+   GALFN_GETTVTIMING,
+   GALFN_SETENABLE,
+   GALFN_GETENABLE,
+   GALFN_ISTVMODESUPPORTED,
+
+/* Video Support functions */
+
+   GALFN_SETVIDEOENABLE,
+   GALFN_SETVIDEOFORMAT,
+   GALFN_SETVIDEOSIZE,
+   GALFN_SETVIDEOOFFSET,
+   GALFN_SETVIDEOWINDOW,
+   GALFN_SETVIDEOSCALE,
+   GALFN_SETVIDEOFILTER,
+   GALFN_SETVIDEOCOLORKEY,
+   GALFN_SETVIDEODOWNSCALEENABLE,
+   GALFN_SETVIDEODOWNSCALECONFIG,
+   GALFN_SETVIDEODOWNSCALECOEFF,
+   GALFN_SETVIDEOSOURCE,
+   GALFN_SETVIDEOINTERLACED,
+   GALFN_SETVIDEOCURSOR,
+   GALFN_SETVIDEOREQUEST,
+   GALFN_SETALPHAENABLE,
+   GALFN_SETALPHAWINDOW,
+   GALFN_SETALPHAVALUE,
+   GALFN_SETALPHAPRIORITY,
+   GALFN_SETALPHACOLOR,
+   GALFN_SETALPHAREGION,
+   GALFN_SETVIDEOOUTSIDEALPHA,
+   GALFN_SETVIDEOPALETTE,
+   GALFN_GETVIDEOINFO,
+   GALFN_SETVIDEOCOLORSPACE,
+
+/* VIP Supported functions */
+
+   GALFN_SETVIPENABLE,
+   GALFN_SETVIPCAPTURERUNMODE,
+   GALFN_SETVIPBASE,
+   GALFN_SETVIPPITCH,
+   GALFN_SETVIPMODE,
+   GALFN_SETVIPBRTH,
+   GALFN_SETVIPLASTLINE,
+   GALFN_TESTVIPODDFIELD,
+   GALFN_TESTVIPBASESUPDATED,
+   GALFN_SETVBIENABLE,
+   GALFN_SETVBIMODE,
+   GALFN_SETVBIBASE,
+   GALFN_SETVBIPITCH,
+   GALFN_SETVBIDIRECT,
+   GALFN_SETVBIINTERRUPT,
+   GALFN_SETGENLOCKENABLE,
+   GALFN_SETTOPLINEINODD,
+   GALFN_SETGENLOCKDELAY,
+   GALFN_SETMACROVISIONENABLE,
+
+   GALFN_GETVIPENABLE,
+   GALFN_GETVIPBASE,
+   GALFN_GETVIPPITCH,
+   GALFN_GETVIPMODE,
+   GALFN_GETVIPBRTH,
+   GALFN_GETVIPLINE,
+   GALFN_GETVBIENABLE,
+   GALFN_GETVBIBASE,
+   GALFN_GETVBIPITCH,
+   GALFN_GETVBIMODE,
+   GALFN_GETVBIDIRECT,
+   GALFN_GETVBIINTERRUPT,
+   GALFN_TESTVIPFIFOOVERFLOW,
+
+/* Second generation rendering routines */
+
+   GALFN_SETICONENABLE,
+   GALFN_SETICONCOLORS,
+   GALFN_SETICONPOSITION,
+   GALFN_SETICONSHAPE64,
+
+   GALFN_SETSOURCESTRIDE,
+   GALFN_SETDESTINATIONSTRIDE,
+   GALFN_SETSOURCETRANSPARENCY,
+   GALFN_SETPATTERNORIGIN,
+   GALFN_GFX2SETALPHAMODE,
+   GALFN_GFX2SETALPHAVALUE,
+   GALFN_GFX2PATTERNFILL,
+   GALFN_GFX2COLORPATTERNFILL,
+   GALFN_GFX2SCREENTOSCREENBLT,
+   GALFN_GFX2MONOEXPANDBLT,
+   GALFN_GFX2COLORBMPTOSCRBLT,
+   GALFN_GFX2MONOBMPTOSCRBLT,
+   GALFN_GFX2TEXTBLT,
+   GALFN_GFX2BRESENHAMLINE,
+   GALFN_GFX2SYNCTOVBLANK,
+
+/* Change/Get Video routines */
+
+   GALFN_SETCOLORSPACEYUV,
+   GALFN_SETVIDEOYUVPITCH,
+   GALFN_SETVIDEOYUVOFFSETS,
+   GALFN_SETVIDEOLEFTCROP,
+   GALFN_SETVIDEOVERTICALDOWNSCALE,
+   GALFN_SETVBISOURCE,
+   GALFN_SETVBILINES,
+   GALFN_SETVBITOTAL,
+   GALFN_SETVSCALEROFFSET,
+
+   GALFN_GETVBISOURCE,
+   GALFN_GETVBILINES,
+   GALFN_GETVBITOTAL,
+   GALFN_GETVSCALEROFFSET,
+   GALFN_GETVIDEOINTERLACED,
+   GALFN_GETCOLORSPACEYUV,
+   GALFN_GETGENLOCKENABLE,
+   GALFN_GETGENLOCKDELAY,
+   GALFN_GETVIDEOCURSOR,
+   GALFN_READCRC,
+   GALFN_READWINDOWCRC,
+   GALFN_GETMACROVISIONENABLE,
+   GALFN_GETALPHAENABLE,
+   GALFN_GETALPHASIZE,
+   GALFN_GETALPHAVALUE,
+   GALFN_GETALPHAPRIORITY,
+   GALFN_GETALPHACOLOR,
+   GALFN_GETVIDEOYUVPITCH,
+   GALFN_GETVIDEOYUVOFFSETS,
+
+/* Additional VGA Support functions */
+
+   GALFN_VGATESTPCI,
+   GALFN_VGAGETPCICOMMAND,
+   GALFN_VGASEQRESET,
+   GALFN_VGASETGRAPHICSBITS,
+
+/* This is last function supported.
+ * If you want to define ioctl function. 
+ * You should define before this function.
+ * Update that the lastfunction supported to new value.
+ */
+   GALFN_LASTFUNCTION_SUPPORTED
+}
+GALFN_CODES;
+
+/* end of GAL function list */
+
+#define GAL_HEADER\
+        DWORD  dwSignature;    /* Sign all structs with FBGAL_SIGNATURE    */\
+        DWORD  dwSize;         /* Size of struct for that subfunction      */\
+        DWORD  dwVersion;      /* Current version of the API               */\
+        DWORD  dwSubfunction;  /* GAL subfunction                          */\
+        DWORD  dwReturnValue;           /* Return value from subfunction */
+
+/*
+ * #define GALFN_PNLPOWERUP
+ * #define GALFN_PNLPOWERDOWN
+ */
+typedef struct __GAL_BASE
+{
+GAL_HEADER}
+GAL_BASE, *PGAL_BASE;
+
+/*
+ * #define GALFN_GETADAPTERINFO
+ */
+typedef struct __GAL_GETADAPTERINFO
+{
+   GAL_HEADER DWORD dwCPUVersion;
+   DWORD dwCPUType;
+   DWORD dwFrameBufferBase;
+   DWORD dwFrameBufferSize;
+   DWORD dwGfxRegisterBase;
+   DWORD dwGpsRegisterBase;
+   DWORD dwVidRegisterBase;
+   DWORD dwVipRegisterBase;
+   DWORD dwVideoVersion;
+   DWORD dwMaxSupportedPixelClock;
+
+}
+GAL_ADAPTERINFO, *PGAL_ADAPTERINFO;
+
+#define GAL_SOFTVGASTATE_ENABLE   1
+#define GAL_SOFTVGASTATE_DISABLE  0
+/*
+ * #define GALFN_SOFTVGASTATE
+ */
+typedef struct __GAL_SOFTVGASTATE
+{
+   GAL_HEADER BOOLEAN bSoftVgaEnable;
+
+}
+GAL_SOFTVGASTATE, *PGAL_SOFTVGASTATE;
+
+/*
+ * #define GALFN_WAITUNTILIDLE
+ */
+typedef struct __GAL_WAITUNTILIDLE
+{
+GAL_HEADER}
+GAL_WAITUNTILIDLE, *PGAL_WAITUNTILIDLE;
+
+/*
+ * #define GALFN_WAITVERTICALBLANK
+ */
+typedef struct __GAL_WAITVERTICALBLANK
+{
+GAL_HEADER}
+GAL_WAITVERTICALBLANK, *PGAL_WAITVERTICALBLANK;
+
+#define GAL_REG 0x1
+#define GAL_VID 0x2
+#define GAL_VIP 0x4
+/*
+ * #define GALFN_WRITEREG
+ * #define GALFN_READREG
+ */
+typedef struct __GAL_HWACCESS
+{
+   GAL_HEADER DWORD dwType;
+   DWORD dwOffset;
+   DWORD dwValue;
+   DWORD dwByteCount;
+
+}
+GAL_HWACCESS, *PGAL_HWACCESS;
+
+/*
+ * #define GALFN_ISDISPLAYMODESUPPORTED
+ * #define GALFN_SETDISPLAYMODE
+ * #define GALFN_GETDISPLAYMODE
+ */
+typedef struct __GAL_DISPLAYMODE
+{
+   GAL_HEADER WORD wXres;
+   WORD wYres;
+   WORD wBpp;
+   WORD wRefresh;
+   DWORD dwSupported;
+
+}
+GAL_DISPLAYMODE, *PGAL_DISPLAYMODE;
+
+/*
+ * #define GALFN_SETBPP
+ * #define GALFN_GETBPP
+ * #define GALFN_SETPITCH                  
+ * #define GALFN_GETPITCH                  
+ * #define GALFN_SETOFFSET                 
+ * #define GALFN_GETOFFSET                 
+ */
+typedef struct __GAL_DISPLAYPARAMS
+{
+   GAL_HEADER DWORD dwOffset;
+   WORD wBpp;
+   WORD wPitch;
+
+}
+GAL_DISPLAYPARAMS, *PGAL_DISPLAYPARAMS;
+
+/*
+ * #define GALFN_DOTCLKTOREFRESH
+ */
+typedef struct __GAL_DOTCLKTOREFRESH
+{
+   GAL_HEADER DWORD dwDotClock;
+   WORD wXres;
+   WORD wYres;
+   WORD wBpp;
+   WORD wRefreshRate;
+
+}
+GAL_DOTCLKTOREFRESH, *PGAL_DOTCLKTOREFRESH;
+
+/*
+ * #define GALFN_GETDISPLAYTIMINGS
+ * #define GALFN_SETDISPLAYTIMINGS
+ */
+typedef struct __GAL_DISPLAYTIMING
+{
+   GAL_HEADER DWORD dwDotClock;
+   WORD wPitch;
+   WORD wBpp;
+   WORD wHTotal;
+   WORD wHActive;
+   WORD wHSyncStart;
+   WORD wHSyncEnd;
+   WORD wHBlankStart;
+   WORD wHBlankEnd;
+   WORD wVTotal;
+   WORD wVActive;
+   WORD wVSyncStart;
+   WORD wVSyncEnd;
+   WORD wVBlankStart;
+   WORD wVBlankEnd;
+   WORD wPolarity;
+
+}
+GAL_DISPLAYTIMING, *PGAL_DISPLAYTIMING;
+
+/*
+ * #define GALFN_SETPALETTE_ENTRY
+ * #define GALFN_GETPALETTE_ENTRY
+ */
+typedef struct __GAL_PALETTE_ENTRY
+{
+   GAL_HEADER DWORD dwIndex;
+   DWORD dwPalette;
+}
+GAL_PALETTE_ENTRY, *PGAL_PALETTE_ENTRY;
+
+/*
+ * #define GALFN_SETPALETTE
+ * #define GALFN_GETPALETTE
+ */
+typedef struct __GAL_PALETTE
+{
+   GAL_HEADER DWORD dwColors[256];
+}
+GAL_PALETTE, *PGAL_PALETTE;
+
+/*
+ * #define GALFN_COMPRESSIONSTATE  
+ */
+typedef struct __GAL_COMPRESSIONSTATE
+{
+   GAL_HEADER BOOLEAN bCompressionState;
+}
+GAL_COMPRESSIONSTATE, *PGAL_COMPRESSIONSTATE;
+
+#define GAL_COMPRESSION_ENABLE   1
+#define GAL_COMPRESSION_DISABLE  0
+
+#define GAL_COMPRESSION_OFFSET  1
+#define GAL_COMPRESSION_PITCH   2
+#define GAL_COMPRESSION_SIZE    4
+#define GAL_COMPRESSION_ALL     7
+
+/*
+ * #define GALFN_COMPRESSIONPARAMS
+ */
+typedef struct __GAL_COMPRESSIONPARAMS
+{
+   GAL_HEADER DWORD dwFlags;
+   DWORD dwCompOffset;
+   WORD dwCompPitch;
+   WORD dwCompSize;
+}
+GAL_COMPRESSIONPARAMS, *PGAL_COMPRESSIONPARAMS;
+
+#define GAL_SETCURSORENABLE_ENABLE    1
+#define GAL_SETCURSORENABLE_DISABLE   0
+/*
+ * #define GALFN_CURSORENABLE
+ */
+typedef struct __GAL_CURSORENABLE
+{
+   GAL_HEADER BOOLEAN bCursorEnable;
+}
+GAL_CURSORENABLE, *PGAL_CURSORENABLE;
+
+/*
+ * #define GALFN_CURSORPOSITION
+ */
+typedef struct __GAL_CURSORPOSITION
+{
+   GAL_HEADER DWORD dwMemOffset;
+   WORD wXPos;
+   WORD wYPos;
+   WORD wXHot;
+   WORD wYHot;
+}
+GAL_CURSORPOSITION, *PGAL_CURSORPOSITION;
+
+/*
+ * #define GALFN_SETCURSORSHAPE
+ */
+typedef struct __GAL_SETCURSORSHAPE
+{
+   GAL_HEADER DWORD dwMemOffset;
+   DWORD dwAndMask[32];                 /* Most gfx hardware support only 32x32 */
+   DWORD dwXorMask[32];
+}
+GAL_SETCURSORSHAPE, *PGAL_SETCURSORSHAPE;
+
+/*
+ * #define GALFN_SETCURSORCOLORS
+ */
+typedef struct __GAL_CURSORCOLORS
+{
+   GAL_HEADER DWORD dwBgColor;
+   DWORD dwFgColor;
+}
+GAL_CURSORCOLORS, *PGAL_CURSORCOLORS;
+
+/*
+ * #define GALFN_SETSOLIDPATTERN
+ */
+typedef struct __GAL_SETSOLIDPATTERN
+{
+   GAL_HEADER DWORD dwColor;
+}
+GAL_SETSOLIDPATTERN, *PGAL_SETSOLIDPATTERN;
+
+/*
+ * #define GALFN_SETRASTEROPERATION
+ */
+typedef struct __GAL_SETRASTEROPERATION
+{
+   GAL_HEADER CHAR cRop;
+}
+GAL_RASTEROPERATION, *PGAL_RASTEROPERATION;
+
+/*
+ * #define GALFN_SETSOLIDSOURCE
+ */
+typedef struct __GAL_SETSOLIDSOURCE
+{
+   GAL_HEADER DWORD dwColor;
+}
+GAL_SETSOLIDSOURCE, *PGAL_SETSOLIDSOURCE;
+
+/*
+ * #define GALFN_PATTERNFILL
+ */
+typedef struct __GAL_PATTERNFILL
+{
+   GAL_HEADER WORD wXPos;
+   WORD wYPos;
+   WORD wWidth;
+   WORD wHeight;
+}
+GAL_PATTERNFILL, *PGAL_PATTERNFILL;
+
+/*
+ * #define GALFN_SETMONOSOURCE
+ */
+typedef struct __GAL_SETMONOSOURCE
+{
+   GAL_HEADER DWORD dwBgColor;
+   DWORD dwFgColor;
+   CHAR cTransparency;
+}
+GAL_SETMONOSOURCE, *PGAL_SETMONOSOURCE;
+
+/*
+ * #define GALFN_SETMONOPATTERN
+ */
+typedef struct __GAL_SETMONOPATTERN
+{
+   GAL_HEADER DWORD dwBgColor;
+   DWORD dwFgColor;
+   DWORD dwData0;
+   DWORD dwData1;
+   CHAR cTransparency;
+}
+GAL_SETMONOPATTERN, *PGAL_SETMONOPATTERN;
+
+/*
+ * #define GALFN_SCREENTOSCREENBLT
+ */
+typedef struct __GAL_SCREENTOSCREENBLT
+{
+   GAL_HEADER WORD wXStart;
+   WORD wYStart;
+   WORD wXEnd;
+   WORD wYEnd;
+   WORD wWidth;
+   WORD wHeight;
+}
+GAL_SCREENTOSCREENBLT, *PGAL_SCREENTOSCREENBLT;
+
+/*
+ * #define GALFN_SCREENTOSCREENXBLT
+ */
+typedef struct __GAL_SCREENTOSCREENXBLT
+{
+   GAL_HEADER WORD wXStart;
+   WORD wYStart;
+   WORD wXEnd;
+   WORD wYEnd;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwColor;
+}
+GAL_SCREENTOSCREENXBLT, *PGAL_SCREENTOSCREENXBLT;
+
+/*
+ * #define GALFN_BRESENHAMLINE
+ */
+typedef struct __GAL_BRESENHAMLINE
+{
+   GAL_HEADER WORD wX1;
+   WORD wY1;
+   WORD wLength;
+   WORD wErr;
+   WORD wE1;
+   WORD wE2;
+   WORD wFlags;
+}
+GAL_BRESENHAMLINE, *PGAL_BRESENHAMLINE;
+
+/*
+ * #define GALFN_COLOR_PATTERNFILL
+ */
+typedef struct __GAL_COLOR_PATTERNFILL
+{
+   GAL_HEADER WORD wDsty;
+   WORD wDstx;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwPattern;
+}
+GAL_COLOR_PATTERNFILL, *PGAL_COLOR_PATTERNFILL;
+
+/*
+ * #define GALFN_COLOR_BITMAP_TO_SCREEN_BLT
+ */
+typedef struct __GAL_COLOR_BITMAP_TO_SCREEN_BLT
+{
+   GAL_HEADER WORD wSrcx;
+   WORD wSrcy;
+   WORD wDstx;
+   WORD wDsty;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwData;
+   WORD wPitch;
+}
+GAL_COLOR_BITMAP_TO_SCREEN_BLT, *PGAL_COLOR_BITMAP_TO_SCREEN_BLT;
+
+/*
+ * #define GALFN_COLOR_BITMAP_TO_SCREEN_XBLT
+ */
+typedef struct __GAL_COLOR_BITMAP_TO_SCREEN_XBLT
+{
+   GAL_HEADER WORD wSrcx;
+   WORD wSrcy;
+   WORD wDstx;
+   WORD wDsty;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwData;
+   WORD wPitch;
+   DWORD dwColor;
+}
+GAL_COLOR_BITMAP_TO_SCREEN_XBLT, *PGAL_COLOR_BITMAP_TO_SCREEN_XBLT;
+
+/*
+ * #define GALFN_MONO_BITMAP_TO_SCREEN_BLT
+ */
+typedef struct __GAL_MONO_BITMAP_TO_SCREEN_BLT
+{
+   GAL_HEADER WORD wSrcx;
+   WORD wSrcy;
+   WORD wDstx;
+   WORD wDsty;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwData;
+   WORD wPitch;
+}
+GAL_MONO_BITMAP_TO_SCREEN_BLT, *PGAL_MONO_BITMAP_TO_SCREEN_BLT;
+
+/*
+ * #define GALFN_TEXT_BLT
+ */
+typedef struct __GAL_TEXT_BLT
+{
+   GAL_HEADER WORD wDstx;
+   WORD wDsty;
+   WORD wWidth;
+   WORD wHeight;
+   DWORD dwData;
+}
+GAL_TEXT_BLT, *PGAL_TEXT_BLT;
+
+ /*
+  * * #define GALFN_VGAMODESWITCH 
+  * * #define GALFN_VGACLEARCRTEXT
+  * * #define GALFN_VGASETPITCH   
+  * * #define GALFN_VGARESTORE
+  * * #define GALFN_VGASAVE   
+  * * #define GALFN_VGASETMODE
+  */
+
+typedef struct __GAL_VGAREGS
+{
+   int xsize;
+   int ysize;
+   int hz;
+   int clock;
+   unsigned char miscOutput;
+   unsigned char stdCRTCregs[GFX_STD_CRTC_REGS];
+   unsigned char extCRTCregs[GFX_EXT_CRTC_REGS];
+}
+GAL_VGAREGS, *PGAL_VGAREGS;
+
+typedef struct __GAL_VGAMODEDATA
+{
+   GAL_HEADER DWORD dwFlags;            /* Flags for this subfunction */
+   GAL_VGAREGS sVgaRegs;                /* CRT+SEQ+SEQ register data block */
+   WORD wXres;
+   WORD wYres;
+   WORD wBpp;
+   WORD wRefresh;
+}
+GAL_VGAMODEDATA, *PGAL_VGAMODEDATA;
+
+typedef struct __GAL_VGATESTPCI
+{
+   GAL_HEADER SWORD softvga;
+}
+GAL_VGATESTPCI, *PGAL_VGATESTPCI;
+
+typedef struct __GAL_VGAGETPCICOMMAND
+{
+   GAL_HEADER unsigned char value;
+}
+GAL_VGAGETPCICOMMAND, *PGAL_VGAGETPCICOMMAND;
+
+typedef struct __GAL_VGASEQRESET
+{
+   GAL_HEADER SWORD reset;
+   SWORD statusok;
+}
+GAL_VGASEQRESET, *PGAL_VGASEQRESET;
+
+typedef struct __GAL_VGASETGRAPHICSBITS
+{
+   GAL_HEADER SWORD statusok;
+}
+GAL_VGASETGRAPHICSBITS, *PGAL_VGASETGRAPHICSBITS;
+
+/******** Panel Support functions *********************/
+/*
+* #define GALFN_PNLSETPARAMS
+* #define GALFN_PNLGETPARAMS
+* #define GALFN_PNLINITPANEL
+* #define GALFN_PNLSAVESTATE
+* #define GALFN_PNLRESTORESTATE
+*/
+typedef struct __GAL_PNLPARAMS
+{
+   GAL_HEADER Pnl_PanelParams PanelParams;
+}
+GAL_PNLPARAMS, *PGAL_PNLPARAMS;
+
+/*
+* #define GALFN_PNLBIOSENABLE
+* #define GALFN_PNLBIOSINFO
+*/
+typedef struct __GAL_PNLBIOS
+{
+   GAL_HEADER int state;
+   int XRes;
+   int YRes;
+   int Bpp;
+   int Freq;
+}
+GAL_PNLBIOS, *PGAL_PNLBIOS;
+
+typedef struct __GAL_ENABLEPANNING
+{
+   GAL_HEADER int x;
+   int y;
+}
+GAL_ENABLEPANNING, *PGAL_ENABLEPANNING;
+
+/*
+ * #define GALFN_SETCRTENABLE
+ * #define GALFN_GETCRTENABLE
+ */
+typedef struct __GAL_CRTENABLE
+{
+   GAL_HEADER WORD wCrtEnable;
+}
+GAL_CRTENABLE, *PGAL_CRTENABLE;
+
+#define GAL_TVSTATE       0x01
+#define GAL_TVOUTPUT      0x02
+#define GAL_TVFORMAT      0x04
+#define GAL_TVRESOLUTION  0x08
+#define GAL_TVALL         0x0F
+/*
+ * #define GALFN_SETTVPARAMS
+ * #define GALFN_GETTVPARAMS
+ * #define GALFN_SETENABLE
+ * #define GALFN_GETENABLE
+ * #define GALFN_ISTVMODESUPPORTED
+ */
+typedef struct __GAL_TVPARAMS
+{
+   GAL_HEADER DWORD dwFlags;
+   WORD wWidth;
+   WORD wHeight;
+   WORD wStandard;
+   WORD wType;
+   WORD wOutput;
+   WORD wResolution;
+   BOOLEAN bState;
+
+}
+GAL_TVPARAMS, *PGAL_TVPARAMS;
+
+/*
+ * #define GALFN_SETTVTIMING
+ * #define GALFN_GETTVTIMING
+ */
+typedef struct __GAL_TVTIMING
+{
+   GAL_HEADER DWORD dwFlags;            /* not used currently */
+   unsigned long HorzTim;
+   unsigned long HorzSync;
+   unsigned long VertSync;
+   unsigned long LineEnd;
+   unsigned long VertDownscale;
+   unsigned long HorzScaling;
+   unsigned long TimCtrl1;
+   unsigned long TimCtrl2;
+   unsigned long Subfreq;
+   unsigned long DispPos;
+   unsigned long DispSize;
+   unsigned long Debug;
+   unsigned long DacCtrl;
+   unsigned long DotClock;
+}
+GAL_TVTIMING, *PGAL_TVTIMING;
+
+/******** Video Support functions *********************/
+
+typedef struct __GAL_SETVIDEOENABLE
+{
+   GAL_HEADER BOOLEAN enable;
+}
+GAL_VIDEOENABLE, *PGAL_VIDEOENABLE;
+
+typedef struct __GAL_SETVIDEOFORMAT
+{
+   GAL_HEADER int format;
+}
+GAL_VIDEOFORMAT, *PGAL_VIDEOFORMAT;
+
+typedef struct __GAL_SETVIDEOSIZE
+{
+   GAL_HEADER unsigned short width;
+   unsigned short height;
+}
+GAL_VIDEOSIZE, *PGAL_VIDEOSIZE;
+
+typedef struct __GAL_SETVIDEOOFFSET
+{
+   GAL_HEADER unsigned long offset;
+}
+GAL_VIDEOOFFSET, *PGAL_VIDEOOFFSET;
+
+typedef struct __GAL_SETVIDEOWINDOW
+{
+   GAL_HEADER short x;
+   short y;
+   short w;
+   short h;
+}
+GAL_VIDEOWINDOW, *PGAL_VIDEOWINDOW;
+
+typedef struct __GAL_SETVIDEOSCALE
+{
+   GAL_HEADER unsigned short srcw;
+   unsigned short srch;
+   unsigned short dstw;
+   unsigned short dsth;
+}
+GAL_VIDEOSCALE, *PGAL_VIDEOSCALE;
+
+typedef struct __GAL_SETVIDEOFILTER
+{
+   GAL_HEADER int xfilter;
+   int yfilter;
+}
+GAL_VIDEOFILTER, *PGAL_VIDEOFILTER;
+
+typedef struct __GAL_SETVIDEOCOLORKEY
+{
+   GAL_HEADER unsigned long key;
+   unsigned long mask;
+   int bluescreen;
+}
+GAL_VIDEOCOLORKEY, *PGAL_VIDEOCOLORKEY;
+
+typedef struct __GAL_SETVIDEODOWNSCALEENABLE
+{
+   GAL_HEADER int enable;
+}
+GAL_VIDEODOWNSCALEENABLE, *PGAL_VIDEODOWNSCALEENABLE;
+
+typedef struct __GAL_SETVIDEODOWNSCALECONFIG
+{
+   GAL_HEADER unsigned short type;
+   unsigned short m;
+}
+GAL_VIDEODOWNSCALECONFIG, *PGAL_VIDEODOWNSCALECONFIG;
+
+typedef struct __GAL_SETVIDEODOWNSCALECOEFF
+{
+   GAL_HEADER unsigned short coef1;
+   unsigned short coef2;
+   unsigned short coef3;
+   unsigned short coef4;
+}
+GAL_VIDEODOWNSCALECOEFF, *PGAL_VIDEODOWNSCALECOEFF;
+
+#define GAL_VIDEO_SOURCE_MEMORY 0x0
+#define GAL_VIDEO_SOURCE_DVIP   0x1
+typedef struct __GAL_SETVIDEOSOURCE
+{
+   GAL_HEADER int source;
+}
+GAL_VIDEOSOURCE, *PGAL_VIDEOSOURCE;
+
+typedef struct __GAL_SETVIDEOINTERLACED
+{
+   GAL_HEADER int enable;
+}
+GAL_SETVIDEOINTERLACED, *PGAL_SETVIDEOINTERLACED;
+
+typedef struct __GAL_GETVIDEOINTERLACED
+{
+   GAL_HEADER int interlaced;
+}
+GAL_GETVIDEOINTERLACED, *PGAL_GETVIDEOINTERLACED;
+
+typedef struct __GAL_COLORSPACEYUV
+{
+   GAL_HEADER int colorspace;
+}
+GAL_COLORSPACEYUV, *PGAL_COLORSPACEYUV;
+
+typedef struct __GAL_SETGENLOCKENABLE
+{
+   GAL_HEADER int enable;
+}
+GAL_GENLOCKENABLE, *PGAL_GENLOCKENABLE;
+
+typedef struct __GAL_SETGENLOCKDELAY
+{
+   GAL_HEADER int delay;
+}
+GAL_GENLOCKDELAY, *PGAL_GENLOCKDELAY;
+
+typedef struct __GAL_SETTOPLINEINODD
+{
+   GAL_HEADER int enable;
+}
+GAL_TOPLINEINODD, *PGAL_TOPLINEINODD;
+
+typedef struct __GAL_SETVIDEOCURSOR
+{
+   GAL_HEADER unsigned long key;
+   unsigned long mask;
+   unsigned short select_color2;
+   unsigned long color1;
+   unsigned long color2;
+}
+GAL_VIDEOCURSOR, *PGAL_VIDEOCURSOR;
+
+typedef struct __GAL_READCRC
+{
+   GAL_HEADER DWORD crc;
+}
+GAL_READCRC, *PGAL_READCRC;
+
+typedef struct __GAL_READWINDOWCRC
+{
+   GAL_HEADER SWORD source;
+   WORD x;
+   WORD y;
+   WORD width;
+   WORD height;
+   SWORD crc32;
+   DWORD crc;
+}
+GAL_READWINDOWCRC, *PGAL_READWINDOWCRC;
+
+typedef struct __GAL_GETALPHASIZE
+{
+   GAL_HEADER WORD * x;
+   WORD *y;
+   WORD *width;
+   WORD *height;
+}
+GAL_ALPHASIZE, *PGAL_ALPHASIZE;
+
+typedef struct __GAL_SETMACROVISIONENABLE
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_MACROVISIONENABLE, *PGAL_MACROVISIONENABLE;
+
+typedef struct __GAL_SETVIDEOREQUEST
+{
+   GAL_HEADER short x;
+   short y;
+}
+GAL_VIDEOREQUEST, *PGAL_VIDEOREQUEST;
+
+typedef struct __GAL_ALPHAENABLE
+{
+   GAL_HEADER int enable;
+}
+GAL_ALPHAENABLE, *PGAL_ALPHAENABLE;
+
+typedef struct __GAL_SETALPHAWINDOW
+{
+   GAL_HEADER short x;
+   short y;
+   unsigned short width;
+   unsigned short height;
+}
+GAL_ALPHAWINDOW, *PGAL_ALPHAWINDOW;
+
+typedef struct __GAL_ALPHAVALUE
+{
+   GAL_HEADER unsigned char alpha;
+   char delta;
+}
+GAL_ALPHAVALUE, *PGAL_ALPHAVALUE;
+
+typedef struct __GAL_ALPHAPRIORITY
+{
+   GAL_HEADER int priority;
+}
+GAL_ALPHAPRIORITY, *PGAL_ALPHAPRIORITY;
+
+typedef struct __GAL_ALPHACOLOR
+{
+   GAL_HEADER unsigned long color;
+}
+GAL_ALPHACOLOR, *PGAL_ALPHACOLOR;
+
+typedef struct __GAL_SETALPHAREGION
+{
+   GAL_HEADER int region;
+}
+GAL_ALPHAREGION, *PGAL_ALPHAREGION;
+
+typedef struct __GAL_SETVIDEOOUTSIDEALPHA
+{
+   GAL_HEADER int enable;
+}
+GAL_VIDEOOUTSIDEALPHA, *PGAL_VIDEOOUTSIDEALPHA;
+
+typedef struct __GAL_SETVIDEOPALETTE
+{
+   GAL_HEADER int identity;
+   unsigned long palette[256];
+}
+GAL_VIDEOPALETTE, *PGAL_VIDEOPALETTE;
+
+typedef struct __GAL_VIDEOINFO
+{
+   GAL_HEADER int enable;
+   int format;
+   int filter;
+
+   unsigned long src_size;
+   unsigned long dst_size;
+   unsigned long line_size;
+   unsigned long xclip;
+   unsigned long offset;
+   unsigned long scale;
+   unsigned long position;
+
+   int color_key_src;
+   unsigned long color_key;
+   unsigned long color_key_mask;
+
+   int downscale_enable;
+
+   unsigned short downscale_type;
+
+   unsigned short downscale_mask;
+   unsigned short downscale_coef1;
+   unsigned short downscale_coef2;
+   unsigned short downscale_coef3;
+   unsigned short downscale_coef4;
+}
+GAL_VIDEOINFO, *PGAL_VIDEOINFO;
+
+/* ICON related data strucures */
+typedef struct __GAL_SETICONENABLE
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_ICONENABLE, *PGAL_ICONENABLE;
+
+typedef struct __GAL_SETICONCOLORS
+{
+   GAL_HEADER DWORD color0;
+   DWORD color1;
+   DWORD color2;
+}
+GAL_ICONCOLORS, *PGAL_ICONCOLORS;
+
+typedef struct __GAL_SETICONPOSITION
+{
+   GAL_HEADER DWORD memoffset;
+   WORD xpos;
+}
+GAL_ICONPOSITION, *PGAL_ICONPOSITION;
+
+typedef struct __GAL_SETICONSHAPE64
+{
+   GAL_HEADER DWORD memoffset;
+   DWORD *andmask;
+   DWORD *xormask;
+   DWORD lines;
+}
+GAL_ICONSHAPE64, *PGAL_ICONSHAPE64;
+
+/* VIP related data strucures */
+
+typedef struct __GAL_SETVIPENABLE
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_VIPENABLE, *PGAL_VIPENABLE;
+
+typedef struct __GAL_SETVIPCAPTURERUNMODE
+{
+   GAL_HEADER SWORD mode;
+}
+GAL_VIPCAPTURERUNMODE, *PGAL_VIPCAPTURERUNMODE;
+
+typedef struct __GAL_SETVIPBASE
+{
+   GAL_HEADER DWORD even;
+   DWORD odd;
+   DWORD address;
+}
+GAL_VIPBASE, *PGAL_VIPBASE;
+
+typedef struct __GAL_SETVIPPITCH
+{
+   GAL_HEADER DWORD pitch;
+}
+GAL_VIPPITCH, *PGAL_VIPPITCH;
+
+typedef struct __GAL_SETVIPMODE
+{
+   GAL_HEADER SWORD mode;
+}
+GAL_VIPMODE, *PGAL_VIPMODE;
+
+typedef struct __GAL_SETVIPBUS_RTH
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_VIPBUS_RTH, *PGAL_VIPBUS_RTH;
+
+typedef struct __GAL_SETVIPLASTLINE
+{
+   GAL_HEADER SWORD last_line;
+}
+GAL_VIPLASTLINE, *PGAL_VIPLASTLINE;
+
+typedef struct __GAL_TESTVIPODDFIELD
+{
+   GAL_HEADER SWORD status;
+}
+GAL_TESTVIPODDFIELD, *PGAL_TESTVIPODDFIELD;
+
+typedef struct __GAL_TESTVIPBASESUPDATED
+{
+   GAL_HEADER SWORD status;
+}
+GAL_TESTVIPBASESUPDATED, *PGAL_TESTVIPBASESUPDATED;
+
+typedef struct __GAL_TESTVIPFIFOOVERFLOW
+{
+   GAL_HEADER SWORD status;
+}
+GAL_TESTVIPOVERFLOW, *PGAL_TESTVIPOVERFLOW;
+
+typedef struct __GAL_GETVIPLINE
+{
+   GAL_HEADER SWORD status;
+}
+GAL_VIPLINE, *PGAL_VIPLINE;
+
+/* VBI related data strucures */
+
+typedef struct __GAL_VBIENABLE
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_VBIENABLE, *PGAL_VBIENABLE;
+
+typedef struct __GAL_VBIBASE
+{
+   GAL_HEADER DWORD even;
+   DWORD odd;
+   DWORD address;
+}
+GAL_VBIBASE, *PGAL_VBIBASE;
+
+typedef struct __GAL_VBIPITCH
+{
+   GAL_HEADER DWORD pitch;
+}
+GAL_VBIPITCH, *PGAL_VBIPITCH;
+
+typedef struct __GAL_VBIMODE
+{
+   GAL_HEADER SWORD mode;
+}
+GAL_VBIMODE, *PGAL_VBIMODE;
+
+typedef struct __GAL_SETVBIDIRECT
+{
+   GAL_HEADER DWORD even_lines;
+   DWORD odd_lines;
+}
+GAL_SETVBIDIRECT, *PGAL_SETVBIDIRECT;
+
+typedef struct __GAL_GETVBIDIRECT
+{
+   GAL_HEADER SWORD odd;
+   DWORD direct_lines;
+}
+GAL_GETVBIDIRECT, *PGAL_GETVBIDIRECT;
+
+typedef struct __GAL_VBIINTERRUPT
+{
+   GAL_HEADER SWORD enable;
+}
+GAL_VBIINTERRUPT, *PGAL_VBIINTERRUPT;
+
+/* Second generation rendering routines data structures */
+
+typedef struct __GAL_SETSTRIDE
+{
+   GAL_HEADER WORD stride;
+}
+GAL_STRIDE, *PGAL_STRIDE;
+
+typedef struct __GAL_SETPATTERNORIGIN
+{
+   GAL_HEADER int x;
+   int y;
+}
+GAL_PATTERNORIGIN, *PGAL_PATTERNORIGIN;
+
+typedef struct __GAL_SETSOURCETRANSPARENCY
+{
+   GAL_HEADER DWORD color;
+   DWORD mask;
+}
+GAL_SOURCETRANSPARENCY, *PGAL_SOURCETRANSPARENCY;
+
+typedef struct __GAL_GFX2SETALPHAMODE
+{
+   GAL_HEADER SWORD mode;
+}
+GAL_GFX2ALPHAMODE, *PGAL_GFX2ALPHAMODE;
+
+typedef struct __GAL_GFX2SETALPHAVALUE
+{
+   GAL_HEADER CHAR value;
+}
+GAL_GFX2ALPHAVALUE, *PGAL_GFX2ALPHAVALUE;
+
+typedef struct __GAL_GFX2PATTERNFILL
+{
+   GAL_HEADER DWORD dstoffset;
+   WORD width;
+   WORD height;
+}
+GAL_GFX2PATTERNFILL, *PGAL_GFX2PATTERNFILL;
+
+typedef struct __GAL_GFX2COLORPATTERNFILL
+{
+   GAL_HEADER DWORD dstoffset;
+   WORD width;
+   WORD height;
+   DWORD pattern;
+}
+GAL_GFX2COLORPATTERNFILL, *PGAL_GFX2COLORPATTERNFILL;
+
+typedef struct __GAL_GFX2SCREENTOSCREENBLT
+{
+   GAL_HEADER DWORD srcoffset;
+   DWORD dstoffset;
+   WORD width;
+   WORD height;
+   SWORD flags;
+}
+GAL_GFX2SCREENTOSCREENBLT, *PGAL_GFX2SCREENTOSCREENBLT;
+
+typedef struct __GAL_GFX2MONOEXPANDBLT
+{
+   GAL_HEADER unsigned long srcbase;
+   WORD srcx;
+   WORD srcy;
+   DWORD dstoffset;
+   WORD width;
+   WORD height;
+   WORD byte_packed;
+}
+GAL_GFX2MONOEXPANDBLT, *PGAL_GFX2MONOEXPANDBLT;
+
+typedef struct __GAL_GFX2COLORBMPTOSCRBLT
+{
+   GAL_HEADER WORD srcx;
+   WORD srcy;
+   DWORD dstoffset;
+   WORD width;
+   WORD height;
+   DWORD data;
+   WORD pitch;
+}
+GAL_GFX2COLORBMPTOSCRBLT, *PGAL_GFX2COLORBMPTOSCRBLT;
+
+typedef struct __GAL_GFX2MONOBMPTOSCRBLT
+{
+   GAL_HEADER WORD srcbase;
+   WORD srcx;
+   WORD srcy;
+   DWORD dstoffset;
+   WORD width;
+   WORD height;
+   DWORD data;
+   WORD pitch;
+}
+GAL_GFX2MONOBMPTOSCRBLT, *PGAL_GFX2MONOBMPTOSCRBLT;
+
+typedef struct __GAL_GFX2TEXTBLT
+{
+   GAL_HEADER DWORD dstoffset;
+   WORD width;
+   WORD height;
+   DWORD data;
+}
+GAL_GFX2TEXTBLT, *PGAL_GFX2TEXTBLT;
+
+typedef struct __GAL_GFX2BRESENHAMLINE
+{
+   GAL_HEADER DWORD dstoffset;
+   WORD length;
+   WORD initerr;
+   WORD axialerr;
+   WORD diagerr;
+   WORD flags;
+}
+GAL_GFX2BRESENHAMLINE, *PGAL_GFX2BRESENHAMLINE;
+
+typedef struct __GAL_GFX2SYNCTOVBLANK
+{
+GAL_HEADER}
+GAL_GFX2SYNCTOVBLANK, *PGAL_GFX2SYNCTOVBLANK;
+
+/*
+ GALFN_SETVIDEOYUVPITCH
+ */
+typedef struct _GAL_SETVIDEOYUVPITCH
+{
+   GAL_HEADER unsigned long y_pitch;
+   unsigned long uv_pitch;
+}
+GAL_VIDEOYUVPITCH, *PGAL_VIDEOYUVPITCH;
+
+/*
+  GALFN_SETVIDEOYUVOFFSETS
+*/
+typedef struct _GAL_VIDEOYUVOFFSETS
+{
+   GAL_HEADER unsigned long dwYoffset;
+   unsigned long dwUoffset;
+   unsigned long dwVoffset;
+}
+GAL_VIDEOYUVOFFSETS, *PGAL_VIDEOYUVOFFSETS;
+
+typedef struct __GAL_SETVIDEOLEFTCROP
+{
+   GAL_HEADER WORD x;
+   SWORD status;
+}
+GAL_VIDEOLEFTCROP, *PGAL_VIDEOLEFTCROP;
+
+typedef struct __GAL_SETVIDEOVERTICALDOWNSCALE
+{
+   GAL_HEADER WORD srch;
+   WORD dsth;
+   SWORD status;
+}
+GAL_VIDEOVERTICALDOWNSCALE, *PGAL_VIDEOVERTICALDOWNSCALE;
+
+typedef struct __GAL_VBISOURCE
+{
+   GAL_HEADER VideoSourceType source;
+   SWORD status;
+}
+GAL_VBISOURCE, *PGAL_VBISOURCE;
+
+typedef struct __GAL_VBILINES
+{
+   GAL_HEADER DWORD even;
+   DWORD odd;
+   SWORD status;
+   DWORD lines;
+}
+GAL_VBILINES, *PGAL_VBILINES;
+
+typedef struct __GAL_VBITOTAL
+{
+   GAL_HEADER DWORD even;
+   DWORD odd;
+   SWORD status;
+   DWORD total;
+}
+GAL_VBITOTAL, *PGAL_VBITOTAL;
+
+typedef struct __GAL_VSCALEROFFSET
+{
+   GAL_HEADER char offset;
+   SWORD status;
+}
+GAL_VSCALEROFFSET, *PGAL_VSCALEROFFSET;
+
+/* MSR  data strucures */
+
+typedef struct __GAL_IDMSRDEVICE
+{
+   GAL_HEADER MSR * pDev;
+   DWORD address;
+   DEV_STATUS dev_status;
+}
+GAL_IDMSRDEVICE, *PGAL_IDMSRDEVICE;
+
+typedef struct __GAL_GETMSRDEVADDRESS
+{
+   GAL_HEADER WORD device;
+   unsigned long address;
+   DEV_STATUS dev_status;
+}
+GAL_GETMSRDEVADDRESS, *PGAL_GETMSRDEVADDRESS;
+
+typedef struct __GAL_GETMBUSIDATADDRESS
+{
+   GAL_HEADER unsigned int device;
+   unsigned long address;
+   DEV_STATUS dev_status;
+}
+GAL_GETMBUSIDATADDRESS, *PGAL_GETMBUSIDATADDRESS;
+
+/* Gal device function's prototye declarations */
+
+/** Init **********************************************************/
+BOOLEAN Gal_initialize_interface(void);
+BOOLEAN Gal_cleanup_interface(void);
+BOOLEAN Gal_get_adapter_info(PGAL_ADAPTERINFO pAdapterInfo);
+BOOLEAN Gal_set_softvga_state(BOOLEAN);
+BOOLEAN Gal_get_softvga_state(int *bState);
+BOOLEAN Gal_set_crt_enable(int);
+BOOLEAN Gal_wait_until_idle(void);
+BOOLEAN Gal_wait_vertical_blank(void);
+BOOLEAN Gal_write_register(int type, unsigned long offset,
+                           unsigned long value, int size);
+
+BOOLEAN Gal_read_register(int type, unsigned long offset,
+                          unsigned long *value, int size);
+/** Display Engine ******************************************************/
+BOOLEAN Gal_is_display_mode_supported(int xres, int yres, int bpp, int hz,
+                                      int *supported);
+BOOLEAN Gal_set_display_mode(int xres, int yres, int bpp, int hz);
+BOOLEAN Gal_get_display_mode(int *xres, int *yres, int *bpp, int *hz);
+BOOLEAN Gal_set_bpp(unsigned short bpp);
+BOOLEAN Gal_set_display_bpp(unsigned short bpp);
+BOOLEAN Gal_get_display_bpp(unsigned short *bpp);
+BOOLEAN Gal_set_display_pitch(unsigned short pitch);
+BOOLEAN Gal_get_display_pitch(unsigned short *pitch);
+BOOLEAN Gal_set_display_offset(unsigned long offset);
+BOOLEAN Gal_get_display_offset(unsigned long *offset);
+BOOLEAN Gal_get_refreshrate_from_dotclock(int xres, int yres, int bpp,
+                                          int *hz, unsigned long frequency);
+BOOLEAN Gal_get_display_timing(PGAL_DISPLAYTIMING pDisplayTiming);
+BOOLEAN Gal_set_display_timing(PGAL_DISPLAYTIMING pDisplayTiming);
+BOOLEAN Gal_set_fixed_timings(int pnlXres, int pnlYres, int totXres,
+                              int totYres, int bpp);
+BOOLEAN Gal_set_display_palette_entry(unsigned long index,
+                                      unsigned long palette);
+BOOLEAN Gal_get_display_palette_entry(unsigned long index,
+                                      unsigned long *palette);
+BOOLEAN Gal_set_display_palette(PGAL_PALETTE);
+BOOLEAN Gal_get_display_palette(PGAL_PALETTE);
+BOOLEAN Gal_set_cursor_enable(int enable);
+BOOLEAN Gal_get_cursor_enable(int *enable);
+BOOLEAN Gal_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor);
+BOOLEAN Gal_get_cursor_colors(unsigned long *bkcolor, unsigned long *fgcolor);
+BOOLEAN Gal_set_cursor_position(unsigned long memoffset,
+                                unsigned short xpos, unsigned short ypos,
+                                unsigned short xhotspot,
+                                unsigned short yhotspot);
+BOOLEAN Gal_get_cursor_position(unsigned long *memoffset,
+                                unsigned short *xpos, unsigned short *ypos,
+                                unsigned short *xhotspot,
+                                unsigned short *yhotspot);
+BOOLEAN Gal_set_cursor_shape32(unsigned long memoffset,
+                               unsigned long *andmask,
+                               unsigned long *xormask);
+
+BOOLEAN Gal_set_cursor_shape64(unsigned long memoffset,
+                               unsigned long *andmask,
+                               unsigned long *xormask);
+
+/** Render ********************************************************/
+BOOLEAN Gal_set_solid_pattern(unsigned long color);
+
+BOOLEAN Gal_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
+                            unsigned char transparency);
+BOOLEAN Gal_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
+                             unsigned long data0, unsigned long data1,
+                             unsigned char transparency);
+
+BOOLEAN Gal_set_raster_operation(unsigned char rop);
+
+BOOLEAN Gal_pattern_fill(unsigned short x, unsigned short y,
+                         unsigned short width, unsigned short height);
+
+BOOLEAN Gal_set_solid_source(unsigned long color);
+
+BOOLEAN Gal_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
+                                 unsigned short dstx, unsigned short dsty,
+                                 unsigned short width, unsigned short height);
+
+BOOLEAN Gal_screen_to_screen_xblt(unsigned short srcx,
+                                  unsigned short srcy,
+                                  unsigned short dstx,
+                                  unsigned short dsty,
+                                  unsigned short width,
+                                  unsigned short height, unsigned long color);
+
+BOOLEAN Gal_bresenham_line(unsigned short x, unsigned short y,
+                           unsigned short length, unsigned short initerr,
+                           unsigned short axialerr, unsigned short diagerr,
+                           unsigned short flags);
+
+BOOLEAN Gal_color_pattern_fill(unsigned short x, unsigned short y,
+                               unsigned short width, unsigned short height,
+                               unsigned long pattern);
+
+BOOLEAN Gal_color_bitmap_to_screen_blt(unsigned short srcx,
+                                       unsigned short srcy,
+                                       unsigned short dstx,
+                                       unsigned short dsty,
+                                       unsigned short width,
+                                       unsigned short height,
+                                       unsigned long data, long pitch);
+
+BOOLEAN Gal_color_bitmap_to_screen_xblt(unsigned short srcx,
+                                        unsigned short srcy,
+                                        unsigned short dstx,
+                                        unsigned short dsty,
+                                        unsigned short width,
+                                        unsigned short height,
+                                        unsigned long data, long pitch,
+                                        unsigned long color);
+
+BOOLEAN Gal_mono_bitmap_to_screen_blt(unsigned short srcx,
+                                      unsigned short srcy,
+                                      unsigned short dstx,
+                                      unsigned short dsty,
+                                      unsigned short width,
+                                      unsigned short height,
+                                      unsigned long data, short pitch);
+
+BOOLEAN Gal_text_blt(unsigned short dstx, unsigned short dsty,
+                     unsigned short width, unsigned short height,
+                     unsigned long data);
+
+/** Compression*******************************************************/
+BOOLEAN Gal_set_compression_enable(BOOLEAN);
+BOOLEAN Gal_get_compression_enable(int *flag);
+BOOLEAN Gal_set_compression_parameters(unsigned long flags,
+                                       unsigned long offset,
+                                       unsigned short pitch,
+                                       unsigned short size);
+BOOLEAN Gal_get_compression_parameters(unsigned long flags,
+                                       unsigned long *offset,
+                                       unsigned short *pitch,
+                                       unsigned short *size);
+
+/** VGA **********************************************************/
+BOOLEAN Gal_vga_mode_switch(int active);
+BOOLEAN Gal_vga_clear_extended(void);
+BOOLEAN Gal_vga_pitch(PGAL_VGAMODEDATA pvregs, unsigned short pitch);
+BOOLEAN Gal_vga_restore(PGAL_VGAMODEDATA pvregs);
+BOOLEAN Gal_vga_save(PGAL_VGAMODEDATA pvregs);
+BOOLEAN Gal_vga_mode(PGAL_VGAMODEDATA pvregs);
+BOOLEAN Gal_vga_test_pci(int *softvga);
+BOOLEAN Gal_vga_get_pci_command(unsigned char *value);
+BOOLEAN Gal_vga_seq_reset(int reset);
+BOOLEAN Gal_vga_set_graphics_bits(void);
+
+/** Panel **********************************************************/
+BOOLEAN Gal_pnl_set_params(unsigned long flags, PPnl_PanelParams pParam);
+BOOLEAN Gal_pnl_get_params(unsigned long flags, PPnl_PanelParams pParam);
+BOOLEAN Gal_pnl_init(PPnl_PanelParams pParam);
+BOOLEAN Gal_pnl_save(void);
+BOOLEAN Gal_pnl_restore(void);
+BOOLEAN Gal_pnl_powerup(void);
+BOOLEAN Gal_pnl_powerdown(void);
+BOOLEAN Gal_enable_panning(int x, int y);
+BOOLEAN Gal_pnl_enabled_in_bios(int *state);
+BOOLEAN Gal_pnl_info_from_bios(int *xres, int *yres, int *bpp, int *hz);
+
+/** TV **********************************************************/
+BOOLEAN Gal_tv_set_params(unsigned long flags, PGAL_TVPARAMS pTV);
+BOOLEAN Gal_tv_get_params(unsigned long flags, PGAL_TVPARAMS pTV);
+BOOLEAN Gal_tv_set_timings(unsigned long flags, PGAL_TVTIMING pTV);
+BOOLEAN Gal_tv_get_timings(unsigned long flags, PGAL_TVTIMING pTV);
+BOOLEAN Gal_set_tv_enable(int bState);
+BOOLEAN Gal_get_tv_enable(unsigned int *bState);
+BOOLEAN Gal_is_tv_mode_supported(unsigned long flags, PGAL_TVPARAMS pTV,
+                                 int *bState);
+
+/** Video **********************************************************/
+BOOLEAN Gal_set_video_enable(int enable);
+BOOLEAN Gal_set_video_format(int format);
+BOOLEAN Gal_set_video_size(unsigned short width, unsigned short height);
+BOOLEAN Gal_set_video_offset(unsigned long offset);
+BOOLEAN Gal_set_video_yuv_offsets(unsigned long yoffset,
+                                  unsigned long uoffset,
+                                  unsigned long voffset);
+BOOLEAN Gal_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch);
+
+BOOLEAN Gal_set_video_window(short x, short y, short w, short h);
+BOOLEAN Gal_set_video_scale(unsigned short srcw, unsigned short srch,
+                            unsigned short dstw, unsigned short dsth);
+BOOLEAN Gal_set_video_filter(int xfilter, int yfilter);
+BOOLEAN Gal_set_video_color_key(unsigned long key,
+                                unsigned long mask, int bluescreen);
+BOOLEAN Gal_set_video_downscale_enable(int enable);
+BOOLEAN Gal_set_video_downscale_config(unsigned short type, unsigned short m);
+BOOLEAN Gal_set_video_downscale_coefficients(unsigned short coef1,
+                                             unsigned short coef2,
+                                             unsigned short coef3,
+                                             unsigned short coef4);
+BOOLEAN Gal_set_video_source(int source);
+BOOLEAN Gal_set_video_interlaced(int enable);
+BOOLEAN Gal_get_video_interlaced(int *interlaced);
+BOOLEAN Gal_set_color_space_YUV(int enable);
+BOOLEAN Gal_get_color_space_YUV(int *colorspace);
+BOOLEAN Gal_set_video_cursor(unsigned long key,
+                             unsigned long mask,
+                             unsigned short select_color2,
+                             unsigned long color1, unsigned long color2);
+BOOLEAN Gal_get_video_cursor(unsigned long *key,
+                             unsigned long *mask,
+                             unsigned short *select_color2,
+                             unsigned long *color1, unsigned long *color2);
+BOOLEAN Gal_set_video_request(short x, short y);
+BOOLEAN Gal_set_alpha_enable(int enable);
+BOOLEAN Gal_get_alpha_enable(int *enable);
+BOOLEAN Gal_get_alpha_size(unsigned short *x, unsigned short *y,
+                           unsigned short *width, unsigned short *height);
+
+BOOLEAN Gal_set_video_request(short x, short y);
+BOOLEAN Gal_set_alpha_window(short x, short y,
+                             unsigned short width, unsigned short height);
+BOOLEAN Gal_set_alpha_value(unsigned char alpha, char delta);
+BOOLEAN Gal_get_alpha_value(unsigned char *alpha, char *delta);
+BOOLEAN Gal_set_alpha_priority(int priority);
+BOOLEAN Gal_get_alpha_priority(int *priority);
+BOOLEAN Gal_set_alpha_color(unsigned long color);
+BOOLEAN Gal_get_alpha_color(unsigned long *color);
+BOOLEAN Gal_select_alpha_region(int region);
+BOOLEAN Gal_set_video_outside_alpha(int enable);
+BOOLEAN Gal_set_video_palette(unsigned long *palette);
+
+/* Icon related prototypes */
+
+BOOLEAN Gal_set_icon_enable(int enable);
+BOOLEAN Gal_set_icon_colors(unsigned long color0, unsigned long color1,
+                            unsigned long color2);
+
+BOOLEAN Gal_set_icon_position(unsigned long memoffset, unsigned short xpos);
+BOOLEAN Gal_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
+                             unsigned long *xormask, unsigned int lines);
+
+/* Icon related prototypes */
+
+BOOLEAN Gal_set_vip_enable(int enable);
+BOOLEAN Gal_get_vip_enable(int *enable);
+BOOLEAN Gal_set_vip_capture_run_mode(int mode);
+BOOLEAN Gal_set_vip_base(unsigned long even, unsigned long odd);
+BOOLEAN Gal_get_vip_base(unsigned long *address, int odd);
+BOOLEAN Gal_set_vip_pitch(unsigned long pitch);
+BOOLEAN Gal_get_vip_pitch(unsigned long *pitch);
+BOOLEAN Gal_set_vip_mode(int mode);
+BOOLEAN Gal_get_vip_mode(int *mode);
+BOOLEAN Gal_set_vbi_enable(int enable);
+BOOLEAN Gal_get_vbi_enable(int *enable);
+BOOLEAN Gal_set_vbi_mode(int mode);
+BOOLEAN Gal_get_vbi_mode(int *mode);
+BOOLEAN Gal_set_vbi_base(unsigned long even, unsigned long odd);
+BOOLEAN Gal_get_vbi_base(unsigned long *address, int odd);
+BOOLEAN Gal_set_vbi_pitch(unsigned long pitch);
+BOOLEAN Gal_get_vbi_pitch(unsigned long *pitch);
+BOOLEAN Gal_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines);
+BOOLEAN Gal_get_vbi_direct(int odd, unsigned long *vbi_direct);
+BOOLEAN Gal_set_vbi_interrupt(int enable);
+BOOLEAN Gal_get_vbi_interrupt(int *enable);
+BOOLEAN Gal_set_vip_bus_request_threshold_high(int enable);
+BOOLEAN Gal_get_vip_bus_request_threshold_high(int *enable);
+BOOLEAN Gal_set_vip_last_line(int last_line);
+BOOLEAN Gal_test_vip_odd_field(int *status);
+BOOLEAN Gal_test_vip_bases_updated(int *status);
+BOOLEAN Gal_test_vip_fifo_overflow(int *status);
+BOOLEAN Gal_get_vip_line(int *status);
+
+/* Second generation rendering routines  */
+
+BOOLEAN Gal_set_source_stride(unsigned short stride);
+BOOLEAN Gal_set_destination_stride(unsigned short stride);
+BOOLEAN Gal_set_source_transparency(unsigned long color, unsigned long mask);
+BOOLEAN Gal2_set_source_transparency(unsigned long color, unsigned long mask);
+BOOLEAN Gal2_set_source_stride(unsigned short stride);
+BOOLEAN Gal2_set_destination_stride(unsigned short stride);
+BOOLEAN Gal2_set_pattern_origin(int x, int y);
+BOOLEAN Gal2_set_alpha_mode(int mode);
+BOOLEAN Gal2_set_alpha_value(unsigned char value);
+BOOLEAN Gal2_pattern_fill(unsigned long dstoffset, unsigned short width,
+                          unsigned short height);
+BOOLEAN Gal2_color_pattern_fill(unsigned long dstoffset, unsigned short width,
+                                unsigned short height, unsigned long pattern);
+BOOLEAN Gal2_screen_to_screen_blt(unsigned long srcoffset,
+                                  unsigned long dstoffset,
+                                  unsigned short width, unsigned short height,
+                                  int flags);
+
+BOOLEAN Gal2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
+                             unsigned short srcy, unsigned long dstoffset,
+                             unsigned short width, unsigned short height,
+                             int byte_packed);
+
+BOOLEAN Gal2_color_bitmap_to_screen_blt(unsigned short srcx,
+                                        unsigned short srcy,
+                                        unsigned long dstoffset,
+                                        unsigned short width,
+                                        unsigned short height,
+                                        unsigned char *data,
+                                        unsigned short pitch);
+BOOLEAN Gal2_mono_bitmap_to_screen_blt(unsigned short srcx,
+                                       unsigned short srcy,
+                                       unsigned long dstoffset,
+                                       unsigned short width,
+                                       unsigned short height,
+                                       unsigned char *data,
+                                       unsigned short pitch);
+
+BOOLEAN Gal2_text_blt(unsigned long dstoffset,
+                      unsigned short width,
+                      unsigned short height, unsigned long data);
+BOOLEAN Gal2_bresenham_line(unsigned long dstoffset,
+                            unsigned short length, unsigned short initerr,
+                            unsigned short axialerr, unsigned short diagerr,
+                            unsigned short flags);
+BOOLEAN Gal2_sync_to_vblank(void);
+
+/* Video routines */
+
+BOOLEAN Gal_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch);
+BOOLEAN Gal_get_video_yuv_pitch(unsigned long *ypitch,
+                                unsigned long *uvpitch);
+
+BOOLEAN Gal_set_video_yuv_offsets(unsigned long yoffset,
+                                  unsigned long uoffset,
+                                  unsigned long voffset);
+BOOLEAN Gal_get_video_yuv_offsets(unsigned long *yoffset,
+                                  unsigned long *uoffset,
+                                  unsigned long *voffset);
+
+BOOLEAN Gal_set_video_left_crop(unsigned short x);
+BOOLEAN Gal_set_video_vertical_downscale(unsigned short srch,
+                                         unsigned short dsth);
+
+BOOLEAN Gal_set_vbi_source(VbiSourceType source);
+BOOLEAN Gal_get_vbi_source(VbiSourceType * source);
+
+BOOLEAN Gal_set_vbi_lines(unsigned long even, unsigned long odd);
+BOOLEAN Gal_get_vbi_lines(int odd, unsigned long *lines);
+
+BOOLEAN Gal_set_vbi_total(unsigned long even, unsigned long odd);
+BOOLEAN Gal_get_vbi_total(int odd, unsigned long *total);
+
+BOOLEAN Gal_set_vertical_scaler_offset(char offset);
+BOOLEAN Gal_get_vertical_scaler_offset(char *offset);
+BOOLEAN Gal_get_genlock_enable(int *enable);
+BOOLEAN Gal_set_genlock_enable(int flags);
+BOOLEAN Gal_get_genlock_delay(unsigned long *delay);
+BOOLEAN Gal_set_genlock_delay(unsigned long delay);
+BOOLEAN Gal_set_top_line_in_odd(int enable);
+
+BOOLEAN Gal_read_crc(unsigned long *crc);
+BOOLEAN Gal_read_window_crc(int source, unsigned short x, unsigned short y,
+                            unsigned short width, unsigned short height,
+                            int crc32, unsigned long *crc);
+
+BOOLEAN Gal_set_macrovision_enable(int enable);
+BOOLEAN Gal_get_macrovision_enable(int *enable);
+
+/* MSR routines */
+
+BOOLEAN Gal_id_msr_dev_address(MSR * pDev, unsigned long address);
+BOOLEAN Gal_get_msr_dev_address(unsigned int device, unsigned long *address);
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/nsc/include/pnl_defs.h b/Source/DirectFB/gfxdrivers/nsc/include/pnl_defs.h
new file mode 100755
index 0000000..62de7bb
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/include/pnl_defs.h
@@ -0,0 +1,201 @@
+/*
+ * $Workfile: pnl_defs.h $
+ *
+ * File Contents:   This file contains definitions of the Geode 
+ *                  frame buffer panel data structures.
+ *
+ * SubModule:       Geode FlatPanel library
+ *
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software 
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the 
+ * Software is received by the Licensee.
+ * 
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated 
+ * NSC_LIC_GPL applies to this Software; in all other circumstances 
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ *
+ *   * Redistributions of source code must retain the above copyright 
+ *     notice, this list of conditions and the following disclaimer. 
+ *
+ *   * Redistributions in binary form must reproduce the above 
+ *     copyright notice, this list of conditions and the following 
+ *     disclaimer in the documentation and/or other materials provided 
+ *     with the distribution. 
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor 
+ *     the names of its contributors may be used to endorse or promote 
+ *     products derived from this software without specific prior 
+ *     written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for 
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted under the terms of the GNU General 
+ * Public License as published by the Free Software Foundation; either 
+ * version 2 of the License, or (at your option) any later version  
+ *
+ * In addition to the terms of the GNU General Public License, neither 
+ * the name of the National Semiconductor Corporation nor the names of 
+ * its contributors may be used to endorse or promote products derived 
+ * from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE. See the GNU General Public License for more details. 
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with 
+ * any export regulations applicable in licensee's jurisdiction. Under 
+ * CURRENT (2001) U.S. export regulations this software 
+ * is eligible for export from the U.S. and can be downloaded by or 
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
+ * Syria, Sudan, Afghanistan and any other country to which the U.S. 
+ * has embargoed goods and services. 
+ *
+ * You should have received a copy of the GNU General Public License 
+ * along with this file; if not, write to the Free Software Foundation, 
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *
+ * END_NSC_LIC_GPL */
+
+#ifndef _pnl_defs_h
+#define _pnl_defs_h
+
+typedef enum
+{
+   MARMOT_PLATFORM = 0,
+   UNICORN_PLATFORM,
+   CENTAURUS_PLATFORM,
+   ARIES_PLATFORM,
+   CARMEL_PLATFORM,
+   HYDRA_PLATFORM,
+   DORADO_PLATFORM,
+   DRACO_PLATFORM,
+   REDCLOUD_PLATFORM,
+   OTHER_PLATFORM
+}
+SYS_BOARD;
+
+#define PNL_9210             0x01
+#define PNL_9211_A           0x02
+#define PNL_9211_C           0x04
+#define PNL_UNKNOWN_CHIP     0x08
+
+#define PNL_TFT              0x01
+#define PNL_SSTN             0x02
+#define PNL_DSTN             0x04
+#define PNL_TWOP             0x08
+#define PNL_UNKNOWN_PANEL    0x10
+
+#define PNL_MONO_PANEL       0x01
+#define PNL_COLOR_PANEL      0x02
+#define PNL_UNKNOWN_COLOR    0x08
+
+#define PNL_PANELPRESENT     0x01
+#define PNL_PLATFORM         0x02
+#define PNL_PANELCHIP        0x04
+#define PNL_PANELSTAT        0x08
+#define PNL_OVERRIDE_STAT    0x10
+#define PNL_OVERRIDE_ALL     0x1F
+
+typedef struct _Pnl_PanelStat_
+{
+   int Type;
+   int XRes;
+   int YRes;
+   int Depth;
+   int MonoColor;
+}
+Pnl_PanelStat;
+
+typedef struct _Pnl_Params_
+{
+   unsigned long Flags;
+   int PanelPresent;
+   int Platform;
+   int PanelChip;
+   Pnl_PanelStat PanelStat;
+}
+Pnl_PanelParams, *PPnl_PanelParams;
+
+#endif /* _pnl_defs_h */
+
+/* END OF FILE */
diff --git a/Source/DirectFB/gfxdrivers/nsc/nsc.c b/Source/DirectFB/gfxdrivers/nsc/nsc.c
new file mode 100755
index 0000000..f0a0d72
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/nsc.c
@@ -0,0 +1,592 @@
+/*
+ * $Workfile: $
+ * $Revision: 1.16 $
+ *
+ * File Contents: This file contains the main functions of the NSC DFB.
+ *
+ * Project:       NSC Direct Frame buffer device driver
+ *
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the
+ * Software is received by the Licensee.
+ *
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated
+ * NSC_LIC_GPL applies to this Software; in all other circumstances
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor
+ *     the names of its contributors may be used to endorse or promote
+ *     products derived from this software without specific prior
+ *     written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with
+ * any export regulations applicable in licensee's jurisdiction. Under
+ * CURRENT (2001) U.S. export regulations this software
+ * is eligible for export from the U.S. and can be downloaded by or
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
+ * Syria, Sudan, Afghanistan and any other country to which the U.S.
+ * has embargoed goods and services.
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version
+ *
+ * In addition to the terms of the GNU General Public License, neither
+ * the name of the National Semiconductor Corporation nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE. See the GNU General Public License for more details.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with
+ * any export regulations applicable in licensee's jurisdiction. Under
+ * CURRENT (2001) U.S. export regulations this software
+ * is eligible for export from the U.S. and can be downloaded by or
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
+ * Syria, Sudan, Afghanistan and any other country to which the U.S.
+ * has embargoed goods and services.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this file; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * END_NSC_LIC_GPL */
+
+#include <config.h>
+
+#include <dfb_types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.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/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+#include <misc/util.h>
+#include <core/graphics_driver.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include "nsc_galproto.h"
+
+#define NSC_ACCEL 1
+
+#define GP_VECTOR_DEST_DATA       0x8
+#define GP_VECTOR_MINOR_AXIS_POS  0x4
+#define GP_VECTOR_MAJOR_AXIS_POS  0x2
+#define GP_VECTOR_Y_MAJOR         0x1
+
+#define  GFX_CPU_REDCLOUD 3
+
+#define GX_SUPPORTED_DRAWINGFLAGS DSDRAW_NOFX
+
+#define GX_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | \
+                DFXL_DRAWRECTANGLE | \
+                DFXL_DRAWLINE)
+
+#define GX_SUPPORTED_BLITTINGFUNCTIONS DFXL_BLIT
+
+#define GX_SUPPORTED_BLITTINGFLAGS DSBLIT_SRC_COLORKEY
+
+DFB_GRAPHICS_DRIVER(nsc)
+
+typedef struct
+{
+  unsigned long Color;
+  unsigned long src_offset;
+  unsigned long dst_offset;
+  unsigned long src_pitch;
+  unsigned long dst_pitch;
+  unsigned long src_colorkey;
+  int v_srcColorkey;
+}NSCDeviceData;
+
+typedef struct
+{
+  unsigned int cpu_version;
+  int cpu;
+}NSCDriverData;
+
+static GAL_ADAPTERINFO sAdapterInfo;
+
+static bool nscDrawLine(void *drv, void *dev, DFBRegion *line);
+static bool nscFillRectangle(void *drv, void *dev, DFBRectangle *rect);
+static bool nscDrawRectangle(void *drv, void *dev, DFBRectangle *rect);
+static bool nscBlit(void *drv, void *dev, DFBRectangle *rect, int dx, int dy);
+static bool nscBlitGu1(void *drv, void *dev, DFBRectangle *rect, int dx, int dy);
+
+static DFBResult gxEngineSync(void *drv, void *dev)
+{
+   Gal_wait_until_idle();
+
+   return DFB_OK;
+}
+
+static inline void
+nsc_validate_srcColorkey(NSCDriverData *gxdrv,
+                         NSCDeviceData *gxdev, CardState *state)
+{
+   if (gxdev->v_srcColorkey)
+      return;
+   gxdev->src_colorkey = state->src_colorkey;
+   gxdev->v_srcColorkey = 1;
+}
+
+static void
+gxCheckState(void *drv,
+             void *dev, CardState *state, DFBAccelerationMask accel)
+{
+#if NSC_ACCEL
+   NSCDriverData *gxdrv = (NSCDriverData *) drv;
+   NSCDeviceData *gxdev = (NSCDeviceData *) dev;
+
+   if(state->destination->config.format != DSPF_RGB16)
+      return;
+
+   if (DFB_BLITTING_FUNCTION(accel)) {
+
+	   if(state->source->config.format != DSPF_RGB16)
+		  return;
+      if (gxdrv->cpu) {
+         /* GU2 - if there are no other blitting flags than the supported
+          * and the source and destination formats are the same 
+          */
+         if (!(state->blittingflags & ~GX_SUPPORTED_BLITTINGFLAGS) &&
+             state->source && state->source->config.format != DSPF_RGB24) {
+            state->accel |= GX_SUPPORTED_BLITTINGFUNCTIONS;
+         }
+      } else{
+         /* GU1 - source width must match frame buffer strid
+          */
+         if(state->source) {
+            int src_pitch = 0;
+            int dst_pitch = 0;
+
+            if(state->source) {
+               src_pitch = state->source->config.size.w * DFB_BYTES_PER_PIXEL(state->source->config.format);
+            }
+
+            if (state->modified & SMF_DESTINATION) {
+               if(state->destination && state->dst.buffer)
+                  dst_pitch = state->dst.pitch;
+            }
+            if(dst_pitch == 0) {
+               dst_pitch = gxdev->dst_pitch;
+            }
+       
+            if(src_pitch == dst_pitch && state->source) {
+               state->accel |= GX_SUPPORTED_BLITTINGFUNCTIONS;
+            }
+         }
+      }
+   } else {
+      /* if there are no other drawing flags than the supported */
+      if (!(state->drawingflags & ~GX_SUPPORTED_DRAWINGFLAGS)) {
+         state->accel |= GX_SUPPORTED_DRAWINGFUNCTIONS;
+      }
+   }
+#endif /* NSC_ACCEL */
+}
+
+static void
+gxSetState(void *drv, void *dev,
+           GraphicsDeviceFuncs *funcs,
+           CardState *state, DFBAccelerationMask accel)
+{
+   NSCDriverData *gxdrv = (NSCDriverData *) drv;
+   NSCDeviceData *gxdev = (NSCDeviceData *) dev;
+
+   if (state->mod_hw & SMF_SRC_COLORKEY)
+      gxdev->v_srcColorkey = 0;
+
+   switch (accel) {
+   case DFXL_BLIT:
+         state->set |= DFXL_BLIT;
+         if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+            nsc_validate_srcColorkey(gxdrv, gxdev, state);
+         break;
+
+   case DFXL_FILLRECTANGLE:
+   case DFXL_DRAWRECTANGLE:
+   case DFXL_DRAWLINE:
+      state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWLINE | DFXL_DRAWRECTANGLE;
+      break;
+
+   default:
+      D_BUG("unexpected drawing/blitting function");
+      break;
+   }
+
+   if (state->mod_hw & SMF_DESTINATION) {
+
+      /* set offset & pitch */
+
+      gxdev->dst_offset = state->dst.offset;
+      gxdev->dst_pitch = state->dst.pitch;
+   }
+
+   if (state->mod_hw & SMF_SOURCE && state->source) {
+
+      gxdev->src_offset = state->src.offset;
+      gxdev->src_pitch = state->src.pitch;
+   }
+
+   if (state->mod_hw & (SMF_DESTINATION | SMF_COLOR)) {
+      switch (state->destination->config.format) {
+      case DSPF_A8:
+         gxdev->Color = state->color.a;
+         break;
+      case DSPF_ARGB1555:
+         gxdev->Color =
+               PIXEL_ARGB1555(state->color.a, state->color.r,
+                              state->color.g, state->color.b);
+         break;
+      case DSPF_RGB16:
+         gxdev->Color =
+               PIXEL_RGB16(state->color.r, state->color.g, state->color.b);
+         break;
+
+      default:
+         D_BUG("unexpected pixelformat");
+         break;
+      }
+   }
+
+   state->mod_hw = 0;
+}
+
+static bool
+nscDrawLine(void *drv, void *dev, DFBRegion *line)
+{
+   long dx, dy, adx, ady;
+   short majorErr;
+   unsigned short destData;
+   NSCDeviceData *gxdev = (NSCDeviceData *) dev;
+   int yoffset;
+
+   destData = 0;                        /*  Value will be 0x8 (or) 0 */
+   dx = line->x2 - line->x1;            /*  delta values */
+   dy = line->y2 - line->y1;
+   adx = ABS(dx);
+   ady = ABS(dy);
+   yoffset = gxdev->dst_offset / gxdev->dst_pitch;
+
+   /* Canonical Bresenham stepper.
+    * * We use hardware to draw the pixels to take care of alu modes 
+    * * and whatnot.
+    */
+   Gal_set_raster_operation(0xF0);
+   Gal_set_solid_pattern(gxdev->Color);
+   if (adx >= ady) {
+      unsigned short vectorMode;
+
+      vectorMode = destData;
+      if (dy >= 0)
+         vectorMode |= GP_VECTOR_MINOR_AXIS_POS;
+      if (dx >= 0)
+         vectorMode |= GP_VECTOR_MAJOR_AXIS_POS;
+      majorErr = (short)(ady << 1);
+
+      Gal_bresenham_line((short)line->x1,
+                         (short)line->y1 + yoffset,
+                         (short)adx,
+                         (short)(majorErr - adx),
+                         (short)majorErr,
+                         (short)(majorErr - (adx << 1)), vectorMode);
+   } else {
+      unsigned short vectorMode;
+
+      vectorMode = destData | GP_VECTOR_Y_MAJOR;
+
+      if (dx >= 0)
+         vectorMode |= GP_VECTOR_MINOR_AXIS_POS;
+      if (dy >= 0)
+         vectorMode |= GP_VECTOR_MAJOR_AXIS_POS;
+      majorErr = (short)(adx << 1);
+      Gal_bresenham_line((short)line->x1,
+                         (short)line->y1 + yoffset,
+                         (short)ady,
+                         (short)(majorErr - ady),
+                         (short)majorErr,
+                         (short)(majorErr - (ady << 1)), vectorMode);
+   }
+
+   return true;
+}
+
+static bool
+nscFillRectangle(void *drv, void *dev, DFBRectangle *rect)
+{
+   NSCDeviceData *gxdev = (NSCDeviceData *) dev;
+   int yoffset;
+
+   Gal_set_raster_operation(0xF0);
+   Gal_set_solid_pattern(gxdev->Color);
+
+   yoffset = gxdev->dst_offset / gxdev->dst_pitch;
+   Gal_pattern_fill(rect->x, rect->y + yoffset, rect->w, rect->h);
+
+   return true;
+}
+
+static bool
+nscDrawRectangle(void *drv, void *dev, DFBRectangle *rect)
+{
+   NSCDeviceData *gxdev = (NSCDeviceData *) dev;
+   int yoffset;
+
+   Gal_set_raster_operation(0xF0);
+   Gal_set_solid_pattern(gxdev->Color);
+
+   yoffset = gxdev->dst_offset / gxdev->dst_pitch;
+
+   Gal_pattern_fill(rect->x, rect->y + yoffset, rect->w, 1);
+   Gal_pattern_fill(rect->x, ((rect->y + yoffset + rect->h) - 1), rect->w, 1);
+   Gal_pattern_fill(rect->x, (rect->y + yoffset + 1), 1, (rect->h - 2));
+   Gal_pattern_fill(((rect->x + rect->w) - 1),
+                    (rect->y + yoffset + 1), 1, (rect->h - 2));
+
+   return true;
+}
+
+static bool
+nscBlit(void *drv, void *dev, DFBRectangle * rect, int dx, int dy)
+{
+   NSCDeviceData *nscdev = (NSCDeviceData *) dev;
+   unsigned long soffset = (rect->x * nscdev->src_pitch) + (rect->y * 2);
+   unsigned long doffset = (dy * nscdev->dst_pitch) + (dx * 2);
+
+   Gal_set_solid_pattern(nscdev->Color);
+   if (nscdev->v_srcColorkey) {
+      Gal2_set_source_transparency(nscdev->src_colorkey, 0xFFFF);
+   }
+   Gal_set_raster_operation(0xCC);
+   Gal2_set_source_stride((unsigned short)nscdev->src_pitch);
+   Gal2_set_destination_stride(nscdev->dst_pitch);
+   Gal2_screen_to_screen_blt(nscdev->src_offset + soffset,
+                             nscdev->dst_offset + doffset,
+                             (unsigned short)rect->w,
+                             (unsigned short)rect->h, 1);
+
+   return true;
+}
+
+static bool
+nscBlitGu1(void *drv, void *dev, DFBRectangle * rect, int dx, int dy)
+{ 
+   int result, yoff;
+
+   NSCDeviceData *nscdev = (NSCDeviceData *) dev;
+
+   Gal_set_solid_pattern(nscdev->Color);
+   if (nscdev->v_srcColorkey) {
+//FIXME     Gal_set_source_transparency(nscdev->src_colorkey, 0xFFFF);
+   }
+#if 0
+   printf("rect x %d y %d w %d h %d dx %d dy %d src_off %x dst_off %x src pitch %x dst pitch %x\n",
+		rect->x, rect->y, rect->w, rect->h, dx, dy,
+		nscdev->src_offset, nscdev->dst_offset,
+		nscdev->src_pitch, nscdev->dst_pitch);
+#endif
+
+   Gal_set_raster_operation(0xCC);
+   
+   yoff = nscdev->src_offset / nscdev->src_pitch;
+   result = Gal_screen_to_screen_blt(rect->x, rect->y + yoff, dx, dy,
+                             (unsigned short)rect->w,
+                             (unsigned short)rect->h);
+
+   return true;
+}
+
+/* exported symbols */
+
+static int
+driver_probe(CoreGraphicsDevice *device)
+{
+   Gal_initialize_interface();
+   if(!Gal_get_adapter_info(&sAdapterInfo))
+      return 0;
+      
+   return sAdapterInfo.dwFrameBufferBase == dfb_gfxcard_memory_physical( device, 0 );
+}
+
+static void
+driver_get_info(CoreGraphicsDevice *device, GraphicsDriverInfo *info)
+{
+   /* fill driver info structure */
+   snprintf(info->name,
+            DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, "NSC GX1 and GX2 Driver");
+   snprintf(info->vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, "NSC");
+
+   info->version.major = 1;
+   info->version.minor = 1;
+   info->driver_data_size = sizeof(NSCDriverData);
+   info->device_data_size = sizeof(NSCDeviceData);
+}
+
+static DFBResult
+driver_init_driver(CoreGraphicsDevice  *device,
+                   GraphicsDeviceFuncs *funcs,
+                   void                *driver_data,
+                   void                *device_data,
+                   CoreDFB             *core)
+{
+   NSCDriverData *gxdrv = (NSCDriverData *) driver_data;
+
+   Gal_set_compression_enable(0);
+
+   gxdrv->cpu_version = sAdapterInfo.dwCPUVersion;
+   gxdrv->cpu = 0;
+   if ((gxdrv->cpu_version & 0xFF) == GFX_CPU_REDCLOUD) {
+      gxdrv->cpu = 1;
+   }
+   D_DEBUG("CPU is GX%d", gxdrv->cpu);
+
+#if NSC_ACCEL
+   funcs->CheckState = gxCheckState;
+   funcs->SetState = gxSetState;
+   funcs->EngineSync = gxEngineSync;
+   funcs->FillRectangle = nscFillRectangle;
+   funcs->DrawLine = nscDrawLine;
+   funcs->DrawRectangle = nscDrawRectangle;
+   funcs->DrawLine = nscDrawLine;
+   if (gxdrv->cpu) {
+      funcs->Blit = nscBlit;
+   } else {
+      funcs->Blit = nscBlitGu1;
+   }
+#endif /* NSC_ACCEL */
+
+    /*dfb_config->pollvsync_after = 1;*/
+
+   return DFB_OK;
+}
+
+static DFBResult
+driver_init_device(CoreGraphicsDevice *device,
+                   GraphicsDeviceInfo *device_info,
+                   void *driver_data, void *device_data)
+{
+   snprintf(device_info->name,
+            DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "NSC GX1/GX2 driver version");
+   snprintf(device_info->vendor,
+            DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "nsc");
+   printf("Dependent NSC Kernel FrameBuffer driver version is 2.7.7 or later\n");
+   device_info->caps.flags = CCF_NOTRIEMU;
+   device_info->caps.accel = GX_SUPPORTED_DRAWINGFUNCTIONS;
+   device_info->caps.drawing = GX_SUPPORTED_DRAWINGFLAGS;
+   device_info->caps.accel |= GX_SUPPORTED_BLITTINGFUNCTIONS;
+   device_info->caps.blitting = GX_SUPPORTED_BLITTINGFLAGS;
+   return DFB_OK;
+}
+
+static void
+driver_close_device(CoreGraphicsDevice * device,
+                    void *driver_data, void *device_data)
+{
+   NSCDeviceData *gxdev = (NSCDeviceData *) device_data;
+
+   (void)gxdev;
+   D_DEBUG("DirectFB/nsc: 5");
+}
+
+static void
+driver_close_driver(CoreGraphicsDevice *device, void *driver_data)
+{
+   D_DEBUG("DirectFB/nsc: 6");
+}
diff --git a/Source/DirectFB/gfxdrivers/nsc/nsc_galfns.c b/Source/DirectFB/gfxdrivers/nsc/nsc_galfns.c
new file mode 100755
index 0000000..42a9b44
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nsc/nsc_galfns.c
@@ -0,0 +1,4905 @@
+/*
+ * $Workfile: nsc_galfns.c $
+ * $Revision: 1.13 $
+ * $Author: dok $
+ *
+ * File Contents: This file contains the main functions of the Geode
+ *                frame buffer device drivers GAL function definitions.
+ *
+ * Project:       Geode Frame buffer device driver
+ *
+ */
+
+/* NSC_LIC_ALTERNATIVE_PREAMBLE
+ *
+ * Revision 1.0
+ *
+ * National Semiconductor Alternative GPL-BSD License
+ *
+ * National Semiconductor Corporation licenses this software
+ * ("Software"):
+ *
+ * National Xfree frame buffer driver
+ *
+ * under one of the two following licenses, depending on how the
+ * Software is received by the Licensee.
+ *
+ * If this Software is received as part of the Linux Framebuffer or
+ * other GPL licensed software, then the GPL license designated
+ * NSC_LIC_GPL applies to this Software; in all other circumstances
+ * then the BSD-style license designated NSC_LIC_BSD shall apply.
+ *
+ * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
+
+/* NSC_LIC_BSD
+ *
+ * National Semiconductor Corporation Open Source License for
+ *
+ * National Xfree frame buffer driver
+ *
+ * (BSD License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *   * Neither the name of the National Semiconductor Corporation nor
+ *     the names of its contributors may be used to endorse or promote
+ *     products derived from this software without specific prior
+ *     written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with
+ * any export regulations applicable in licensee's jurisdiction. Under
+ * CURRENT (2001) U.S. export regulations this software
+ * is eligible for export from the U.S. and can be downloaded by or
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
+ * Syria, Sudan, Afghanistan and any other country to which the U.S.
+ * has embargoed goods and services.
+ *
+ * END_NSC_LIC_BSD */
+
+/* NSC_LIC_GPL
+ *
+ * National Semiconductor Corporation Gnu General Public License for
+ *
+ * National Xfree frame buffer driver
+ *
+ * (GPL License with Export Notice)
+ *
+ * Copyright (c) 1999-2001
+ * National Semiconductor Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version
+ *
+ * In addition to the terms of the GNU General Public License, neither
+ * the name of the National Semiconductor Corporation nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
+ * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE. See the GNU General Public License for more details.
+ *
+ * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
+ * YOUR JURISDICTION. It is licensee's responsibility to comply with
+ * any export regulations applicable in licensee's jurisdiction. Under
+ * CURRENT (2001) U.S. export regulations this software
+ * is eligible for export from the U.S. and can be downloaded by or
+ * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
+ * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
+ * Syria, Sudan, Afghanistan and any other country to which the U.S.
+ * has embargoed goods and services.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this file; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * END_NSC_LIC_GPL */
+
+#include <config.h>
+
+#ifndef XFree86LOADER
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#endif
+
+#include <fbdev/fbdev.h>  /* FIXME: Needs to be included before dfb_types.h to work around a type clash with asm/types.h */
+
+#include <direct/memcpy.h>
+
+static FBDev *dfb_fbdev = NULL;
+
+#include "nsc_galproto.h"
+
+/*
+ * Compile time constants
+ */
+#define FBDEV_NAME  "/dev/nscgal"
+
+/*
+ * Cool Macros to access the structures
+ */
+#define INIT_GAL(x) \
+		(x)->dwSignature = FBGAL_SIGNATURE;\
+		(x)->dwSize = sizeof(*x);\
+		(x)->dwVersion = FBGAL_VERSION;
+
+#if 0
+/*------------------------------------------------------------------------
+ * create_devicenode
+ *
+ * Description:	This function creates nscgal device node in the device
+ *					directory.
+ * parameters :	none
+ *	
+ *	return:	'0' was return on creating the galdevice node.
+ *----------------------------------------------------------------------*/
+static int
+create_devicenode(void)
+{
+
+#if 1
+   FILE *pfdevices;
+   char line[200], devname[200];
+   int majdev;
+
+   /* remove fails if device is open */
+   remove("/dev/nscgal");
+
+   if ((pfdevices = fopen("/proc/devices", "r"))) {
+      while (fgets(line, sizeof(line), pfdevices)) {
+	 if (sscanf(line, "%d%*[ \t]%s", &majdev, devname) == 2) {
+	    if (strstr(devname, "nscgal"))
+	       mknod("/dev/nscgal", S_IFCHR | S_IRUSR | S_IWUSR,
+		     makedev(majdev, 0));
+	 }
+      }
+      fclose(pfdevices);
+   }
+   return 1;
+#endif
+
+}
+#endif
+
+/*------------------------------------------------------------------------
+ * Gal_initialize_interface
+ *
+ * Description:	This function intializes the  nscgal device .
+ * parameters :	none
+ *	
+ *	return:	 '1' was returned on intialization of the galdevice
+ *					otherwise '0' was returned on failure.
+ *----------------------------------------------------------------------*/
+BOOLEAN
+Gal_initialize_interface(void)
+{
+/*	create_devicenode();  */
+     dfb_fbdev = dfb_system_data();
+
+   return 1;
+}
+
+/*------------------------------------------------------------------------
+ * Gal_cleanup_interface
+ *
+ * Description:	This function closes the  nscgal device .
+ * parameters :	none
+ *	
+ *	return:	 '1' was returned on closing the galdevice.
+ *----------------------------------------------------------------------*/
+BOOLEAN
+Gal_cleanup_interface(void)
+{
+   return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_write_register
+ *
+ * Description:	This function writes the data to the hardware register
+ *					of the nscgal device .
+ *  parameters:	
+ *        type:	It specifies the hardware access type.
+ *      offset: It specifies the offset address the register to be accessed.
+ *       value:	It specifies the data value to be written into the register.
+ *        size: It specifies the size of the data to be written.
+ *	
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_write_register(int type, unsigned long offset, unsigned long value,
+		   int size)
+{
+   GAL_HWACCESS hwAccess;
+
+   INIT_GAL(&hwAccess);
+   hwAccess.dwSubfunction = GALFN_WRITEREG;
+   hwAccess.dwType = type;
+   hwAccess.dwOffset = offset;
+   hwAccess.dwValue = value;
+   hwAccess.dwByteCount = size;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &hwAccess))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_read_register
+ *
+ * Description:	This function reads the data from the hardware register
+ *					of the nscgal device .
+ *  parameters:	
+ *        type:	It specifies the hardware access type.
+ *      offset: It specifies the offset address of the register to be accessed.
+ *       value:	It specifies the pointer to hold the data  to be read from
+ *					the gal hardware register.
+ *        size: It specifies the size of the data to be read
+ *	
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_read_register(int type, unsigned long offset, unsigned long *value,
+		  int size)
+{
+   GAL_HWACCESS hwAccess;
+
+   INIT_GAL(&hwAccess);
+   hwAccess.dwSubfunction = GALFN_READREG;
+   hwAccess.dwType = type;
+   hwAccess.dwOffset = offset;
+   hwAccess.dwByteCount = size;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &hwAccess))
+      return 0;
+   else {
+      *value = hwAccess.dwValue;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_adapter_info
+ *
+ * Description:	This function gets the adapter information of the
+ *					nscgal device .
+ *  parameters:	
+ *pAdapterInfo: It specifies the adapter information structure.
+ *	
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_adapter_info(PGAL_ADAPTERINFO pAdapterInfo)
+{
+   INIT_GAL(pAdapterInfo);
+
+   pAdapterInfo->dwSubfunction = GALFN_GETADAPTERINFO;
+
+   if (!dfb_fbdev || ioctl(dfb_fbdev->fd, FBIOGAL_API, pAdapterInfo))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_softvga_state
+ *
+ * Description:	This function sets the softvga state of the platform device .
+ *  parameters:	
+ *     bEnable:	It specifies the softvga state enable state.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_softvga_state(BOOLEAN bEnable)
+{
+   GAL_SOFTVGASTATE sSoftVgaState;
+
+   INIT_GAL(&sSoftVgaState);
+   sSoftVgaState.dwSubfunction = GALFN_SETSOFTVGASTATE;
+   sSoftVgaState.bSoftVgaEnable = bEnable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSoftVgaState))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_softvga_state
+ *
+ * Description:	This function gets the softvga state of the platform device .
+ *  parameters:	
+ *     bEnable:	get the softvga state.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_softvga_state(int *bState)
+{
+   GAL_SOFTVGASTATE sSoftVgaState;
+
+   INIT_GAL(&sSoftVgaState);
+   sSoftVgaState.dwSubfunction = GALFN_GETSOFTVGASTATE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSoftVgaState))
+      return 0;
+   else {
+      *bState = sSoftVgaState.bSoftVgaEnable;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_vga_test_pci
+ *
+ * Description:	This function tests the vga pci.
+ *  parameters:	
+ *     softvga:	It is pointer to the softvga state.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_test_pci(int *softvga)
+{
+   GAL_VGATESTPCI sVgatestpci;
+
+   INIT_GAL(&sVgatestpci);
+   sVgatestpci.dwSubfunction = GALFN_GETSOFTVGASTATE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgatestpci))
+      return 0;
+   else {
+      *softvga = sVgatestpci.softvga;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_vga_get_pci_command
+ *
+ * Description:	This function gets the vga pci command.
+ *  parameters:	
+ *       value:	It is pointer to pci command value.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_get_pci_command(unsigned char *value)
+{
+   GAL_VGAGETPCICOMMAND sVgagetpcicommand;
+
+   INIT_GAL(&sVgagetpcicommand);
+   sVgagetpcicommand.dwSubfunction = GALFN_VGAGETPCICOMMAND;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgagetpcicommand))
+      return 0;
+   else {
+      *value = sVgagetpcicommand.value;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_vga_seq_reset
+ *
+ * Description:	This function resets the vga seq.
+ *  parameters:	
+ *       reset:	It gives the reset value.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_seq_reset(int reset)
+{
+   GAL_VGASEQRESET sVgaseqreset;
+
+   INIT_GAL(&sVgaseqreset);
+   sVgaseqreset.dwSubfunction = GALFN_VGASEQRESET;
+   sVgaseqreset.reset = reset;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaseqreset))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_vga_set_graphics_bits
+ *
+ * Description:	This function resets the vga seq.
+ *  parameters:	None.
+ *
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_set_graphics_bits(void)
+{
+   GAL_VGASETGRAPHICSBITS sVgasetgraphics;
+
+   INIT_GAL(&sVgasetgraphics);
+   sVgasetgraphics.dwSubfunction = GALFN_VGASETGRAPHICSBITS;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgasetgraphics))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_crt_enable
+ *
+ * Description:	This function sets the crt state of the device .
+ *  parameters:	
+ *    crtState:	It specifies the crt state of the galdevice.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_crt_enable(int crtEnable)
+{
+   GAL_CRTENABLE sCrtEnable;
+
+   INIT_GAL(&sCrtEnable);
+   sCrtEnable.dwSubfunction = GALFN_SETCRTENABLE;
+   sCrtEnable.wCrtEnable = crtEnable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCrtEnable))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_is_display_mode_supported
+ *
+ * Description:	This function checks the display mode is supported or not.
+ *  parameters:	
+ *        xres:	It specifies x co-ordinate resolution.
+ *        Yres:	It specifies y co-ordinate resolution.
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	    hz:	It specifies the frequency of the display mode.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_is_display_mode_supported(int xres, int yres, int bpp, int hz,
+			      int *supported)
+{
+   GAL_DISPLAYMODE sDisplayMode;
+
+   *supported = 0;
+   INIT_GAL(&sDisplayMode);
+   sDisplayMode.dwSubfunction = GALFN_ISDISPLAYMODESUPPORTED;
+   sDisplayMode.wXres = xres;
+   sDisplayMode.wYres = yres;
+   sDisplayMode.wBpp = bpp;
+   sDisplayMode.wRefresh = hz;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
+      return 0;
+   else {
+      *supported = sDisplayMode.dwSupported;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_mode
+ *
+ * Description:	This function sets the display mode of the galdevice.
+ *  parameters:	
+ *        xres:	It specifies x co-ordinate resolution.
+ *        Yres:	It specifies y co-ordinate resolution.
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	    hz:	It specifies the frequency of the display mode.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_mode(int xres, int yres, int bpp, int hz)
+{
+   GAL_DISPLAYMODE sDisplayMode;
+
+   INIT_GAL(&sDisplayMode);
+   sDisplayMode.dwSubfunction = GALFN_SETDISPLAYMODE;
+   sDisplayMode.wXres = xres;
+   sDisplayMode.wYres = yres;
+   sDisplayMode.wBpp = bpp;
+   sDisplayMode.wRefresh = hz;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_mode
+ *
+ * Description:	This function gets the display mode of the galdevice.
+ *  parameters:	
+ *        xres:	It specifies x co-ordinate resolution.
+ *        Yres:	It specifies y co-ordinate resolution.
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	    hz:	It specifies the frequency of the display mode.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_mode(int *xres, int *yres, int *bpp, int *hz)
+{
+   GAL_DISPLAYMODE sDisplayMode;
+
+   INIT_GAL(&sDisplayMode);
+   sDisplayMode.dwSubfunction = GALFN_GETDISPLAYMODE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
+      return 0;
+   else {
+      *xres = sDisplayMode.wXres;
+      *yres = sDisplayMode.wYres;
+      *bpp = sDisplayMode.wBpp;
+      *hz = sDisplayMode.wRefresh;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_bpp
+ *
+ * Description:	This function sets the number bits per pixel in the display
+ *					mode of the galdevice.
+ *  parameters:	
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_bpp(unsigned short bpp)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_SETDISPLAYBPP;
+   sDisplayParams.wBpp = bpp;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_bpp
+ *
+ * Description:	This function sets the number bits per pixel in the display
+ *					mode of the galdevice.
+ *  parameters:	
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_bpp(unsigned short bpp)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_SETBPP;
+   sDisplayParams.wBpp = bpp;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_bpp
+ *
+ * Description:	This function gets the number bits per pixel in the display
+ *					mode of the galdevice.
+ *  parameters:	
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_bpp(unsigned short *bpp)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_GETDISPLAYBPP;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else {
+      *bpp = sDisplayParams.wBpp;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_pitch
+ *
+ * Description:	This function sets the display pitch of the galdevice.
+ *  parameters:	
+ *       pitch:	It specifies pitch of the display mode.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_pitch(unsigned short pitch)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_SETDISPLAYPITCH;
+   sDisplayParams.wPitch = pitch;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_pitch
+ *
+ * Description:	This function gets the display pitch of the galdevice.
+ *  parameters:	
+ *       pitch:	It specifies pitch of the display mode.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_pitch(unsigned short *pitch)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_GETDISPLAYPITCH;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else {
+      *pitch = sDisplayParams.wPitch;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_offset
+ *
+ * Description:	This function sets the offset of display parameters.
+ *  parameters:	
+ *      offset:	It specifies the offset address of display parameters.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_offset(unsigned long offset)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_SETDISPLAYOFFSET;
+   sDisplayParams.dwOffset = offset;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_offset
+ *
+ * Description:	This function gets the offset of display parameters.
+ *  parameters:	
+ *      offset:	It specifies the offset address of display parameters.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_offset(unsigned long *offset)
+{
+   GAL_DISPLAYPARAMS sDisplayParams;
+
+   INIT_GAL(&sDisplayParams);
+   sDisplayParams.dwSubfunction = GALFN_GETDISPLAYOFFSET;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
+      return 0;
+   else {
+      *offset = sDisplayParams.dwOffset;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_refreshrate_from_dotclock
+ *
+ * Description:	This function gets the refreshrate from dotclock.
+ *  parameters:	
+ *        xres:	It specifies x co-ordinate resolution.
+ *        Yres:	It specifies y co-ordinate resolution.
+ *	   bpp:	It specifies the bits per pixel (8/16 bits).
+ *	    hz:	It is a pointer which holds the refresh rate of the display.
+ *   frequency:	It spcifies the frequency of the dotclock.
+ *	return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_refreshrate_from_dotclock(int xres, int yres, int bpp, int *hz,
+				  unsigned long frequency)
+{
+   GAL_DOTCLKTOREFRESH sDclkToRefresh;
+
+   INIT_GAL(&sDclkToRefresh);
+   sDclkToRefresh.dwSubfunction = GALFN_DOTCLKTOREFRESH;
+   sDclkToRefresh.wXres = xres;
+   sDclkToRefresh.wYres = yres;
+   sDclkToRefresh.wBpp = bpp;
+   sDclkToRefresh.dwDotClock = frequency;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDclkToRefresh))
+      return 0;
+   else {
+      *hz = sDclkToRefresh.wRefreshRate;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_timing
+ *
+ *    Description:	This function gets the display timing from galdevice.
+ *     parameters:	
+ * pDisplayTiming:	It specifies the display timing of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)
+{
+   INIT_GAL(pDisplayTiming);
+   pDisplayTiming->dwSubfunction = GALFN_GETDISPLAYTIMINGS;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pDisplayTiming))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_timing
+ *
+ *    Description:	This function sets the display timing of the galdevice.
+ *     parameters:	
+ * pDisplayTiming:	It specifies the display timing of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)
+{
+   INIT_GAL(pDisplayTiming);
+   pDisplayTiming->dwSubfunction = GALFN_SETDISPLAYTIMINGS;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pDisplayTiming))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_fixed_timings
+ *
+ *    Description:	This function sets the fixed display timings of the
+ *						galdevice.
+ *     parameters:
+ *	  pnlXres:	It specifies the panel X resolution.
+ *	  pnlYres:	It specifies the panel Y resolution.
+ *        totXres:  It specifies the total X resolution.
+ *        totYres:  It specifies the total Y resolution.
+ *	      bpp:	It specifies the bits per pixel (8/16 bits).
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_fixed_timings(int pnlXres, int pnlYres, int totXres,
+		      int totYres, int bpp)
+{
+   GAL_DISPLAYTIMING DisplayTiming;
+
+   INIT_GAL(&DisplayTiming);
+   DisplayTiming.dwSubfunction = GALFN_SETFIXEDTIMINGS;
+   DisplayTiming.wHActive = pnlXres;	/* panel Xres */
+   DisplayTiming.wVActive = pnlYres;	/* panel Yres */
+   DisplayTiming.wHTotal = totXres;	/* Total Xres */
+   DisplayTiming.wVTotal = totYres;	/* Total Yres */
+   DisplayTiming.wBpp = bpp;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &DisplayTiming))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_palette_entry
+ *
+ *    Description:	This function sets the display palette entry of the
+ *						galdevice.
+ *     parameters:
+ *	    index:	It specifies the palette index,
+ *        palette:	It specifies the palette of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_palette_entry(unsigned long index, unsigned long palette)
+{
+   GAL_PALETTE_ENTRY sPalette;
+
+   INIT_GAL(&sPalette);
+   sPalette.dwSubfunction = GALFN_SETPALETTE_ENTRY;
+   sPalette.dwIndex = index;
+   sPalette.dwPalette = palette;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPalette))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_palette_entry
+ *
+ *    Description:	This function gets the display palette entry of the
+ *						galdevice.
+ *     parameters:
+ *          index:	It specifies the palette index,
+ *        palette:	It is a pointer to the palette of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_palette_entry(unsigned long index, unsigned long *palette)
+{
+   GAL_PALETTE_ENTRY sPalette;
+
+   INIT_GAL(&sPalette);
+   sPalette.dwSubfunction = GALFN_GETPALETTE_ENTRY;
+   sPalette.dwIndex = index;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPalette))
+      return 0;
+   else {
+      *palette = sPalette.dwPalette;
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_set_display_palette_entry
+ *
+ *    Description:	This function sets the display palette entry of the
+ *						galdevice.
+ *     parameters:
+ *       pPalette:	It specifies the palette structure of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_display_palette(PGAL_PALETTE pPalette)
+{
+   INIT_GAL(pPalette);
+   pPalette->dwSubfunction = GALFN_SETPALETTE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pPalette))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_get_display_palette_entry
+ *
+ *    Description:	This function gets the display palette entry of the
+ *						galdevice.
+ *     parameters:
+ *       pPalette:	It specifies the palette structure of the galdevice.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_display_palette(PGAL_PALETTE pPalette)
+{
+   INIT_GAL(pPalette);
+   pPalette->dwSubfunction = GALFN_GETPALETTE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pPalette))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_wait_until_idle
+ *
+ *    Description:	This function waits until the graphics engine is idle.
+ *     parameters:	none.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_wait_until_idle(void)
+{
+   GAL_WAITUNTILIDLE sWaitIdle;
+
+   INIT_GAL(&sWaitIdle);
+   sWaitIdle.dwSubfunction = GALFN_WAITUNTILIDLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sWaitIdle))
+      return 0;
+   else
+      return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Gal_wait_vertical_blank
+ *
+ *    Description:	This function wait until start of vertical blank.
+ *     parameters:	none.
+ *	   return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_wait_vertical_blank(void)
+{
+   GAL_WAITVERTICALBLANK sWaitVerticalBlank;
+
+   INIT_GAL(&sWaitVerticalBlank);
+   sWaitVerticalBlank.dwSubfunction = GALFN_WAITVERTICALBLANK;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sWaitVerticalBlank))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_cursor_enable
+ *
+ * Description:	This function enable or disable the hardware cursor.
+ *  parameters:
+ *      enable:	This specifies the enable value of the cursor.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_cursor_enable(int enable)
+{
+   GAL_CURSORENABLE sCursorEnable;
+
+   INIT_GAL(&sCursorEnable);
+   sCursorEnable.dwSubfunction = GALFN_SETCURSORENABLE;
+   sCursorEnable.bCursorEnable = enable ? 1 : 0;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorEnable))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_cursor_position
+ *
+ * Description:	This function sets the position of the cursor.
+ *  parameters:
+ *   memoffset:	It specifies the memory offset of the cursor position.
+ *        xpos: It specifies the X co-ordinate position of the cursor.
+ *        ypos: It specifies the Y co-ordinate position of the cursor.
+ *    xhotspot: It specifies the X hotspot location for current cursor shape.
+ *    yhotspot: It specifies the Y hotspot location for current cursor shape.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_cursor_position(unsigned long memoffset,
+			unsigned short xpos, unsigned short ypos,
+			unsigned short xhotspot, unsigned short yhotspot)
+{
+   GAL_CURSORPOSITION sCursorPos;
+
+   INIT_GAL(&sCursorPos);
+   sCursorPos.dwSubfunction = GALFN_SETCURSORPOSITION;
+   sCursorPos.dwMemOffset = memoffset;
+   sCursorPos.wXPos = xpos;
+   sCursorPos.wYPos = ypos;
+   sCursorPos.wXHot = xhotspot;
+   sCursorPos.wYHot = yhotspot;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorPos))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_cursor_position
+ *
+ * Description:	This function gets the cursor position.
+ *  parameters:
+ *   memoffset:	It points the memory offset of the cursor position.
+ *        xpos: It points the X co-ordinate position of the cursor.
+ *        ypos: It points  the Y co-ordinate position of the cursor.
+ *    xhotspot: It points the X hotspot location for current cursor shape.
+ *    yhotspot: It points  the Y hotspot location for current cursor shape.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_cursor_position(unsigned long *memoffset,
+			unsigned short *xpos, unsigned short *ypos,
+			unsigned short *xhotspot, unsigned short *yhotspot)
+{
+   GAL_CURSORPOSITION sCursorPos;
+
+   INIT_GAL(&sCursorPos);
+   sCursorPos.dwSubfunction = GALFN_GETCURSORPOSITION;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorPos))
+      return 0;
+   else {
+      *memoffset = sCursorPos.dwMemOffset;
+      *xpos = sCursorPos.wXPos;
+      *ypos = sCursorPos.wYPos;
+      *xhotspot = sCursorPos.wXHot;
+      *yhotspot = sCursorPos.wYHot;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_cursor_shape32
+ *
+ * Description:	This function loads 32x32 cursor pattern.
+ *  parameters:
+ *   memoffset:	It specifies the graphics memory offset for cursor shape.
+ *     andmask:	It is a pointer to 32 DWORD of AND data.
+ *     xormask:	It is a pointer to 32 DWORD of XOR data.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_cursor_shape32(unsigned long memoffset,
+		       unsigned long *andmask, unsigned long *xormask)
+{
+   GAL_SETCURSORSHAPE sCursorShape;
+
+   INIT_GAL(&sCursorShape);
+   sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE;
+   sCursorShape.dwMemOffset = memoffset;
+
+   direct_memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask));
+
+   direct_memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask));
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorShape))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_cursor_shape64
+ *
+ * Description:	This function loads 64x64 cursor pattern.
+ *  parameters:
+ *   memoffset:	It specifies the graphics memory offset for cursor shape.
+ *     andmask:	It is a pointer to 64 DWORD of AND data.
+ *     xormask:	It is a pointer to 64 DWORD of XOR data.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/ BOOLEAN
+Gal_set_cursor_shape64(unsigned long memoffset,
+		       unsigned long *andmask, unsigned long *xormask)
+{
+   GAL_SETCURSORSHAPE sCursorShape;
+
+   INIT_GAL(&sCursorShape);
+   sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE_RCLD;
+   sCursorShape.dwMemOffset = memoffset;
+
+   direct_memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask));
+
+   direct_memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask));
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorShape))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_cursor_colors
+ *
+ * Description:	This function sets the colors of the hardware cursor.
+ *  parameters:
+ *     bkcolor:It specifies the RGB value for the background color.
+ *     fgcolor:It specifies the RGB value for the foreground color.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor)
+{
+   GAL_CURSORCOLORS sCursorColor;
+
+   INIT_GAL(&sCursorColor);
+   sCursorColor.dwSubfunction = GALFN_SETCURSORCOLORS;
+   sCursorColor.dwBgColor = bkcolor;
+   sCursorColor.dwFgColor = fgcolor;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorColor))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_cursor_colors
+ *
+ * Description:	This function gets the colors of the hardware cursor.
+ *  parameters:
+ *     bkcolor:It points the RGB value for the background color.
+ *     fgcolor:It points the RGB value for the foreground color.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_cursor_colors(unsigned long *bkcolor, unsigned long *fgcolor)
+{
+   GAL_CURSORCOLORS sCursorColor;
+
+   INIT_GAL(&sCursorColor);
+   sCursorColor.dwSubfunction = GALFN_GETCURSORCOLORS;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorColor))
+      return 0;
+   else {
+      *bkcolor = sCursorColor.dwBgColor;
+      *fgcolor = sCursorColor.dwFgColor;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_solid_pattern
+ *
+ * Description:	This function sets a solid pattern color for future rendering.
+ *  parameters:
+ *       color:	It specifies the pattern color in proper format for current
+ *					display mode.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_solid_pattern(unsigned long color)
+{
+   GAL_SETSOLIDPATTERN sSetSoildPat;
+
+   INIT_GAL(&sSetSoildPat);
+   sSetSoildPat.dwSubfunction = GALFN_SETSOLIDPATTERN;
+   sSetSoildPat.dwColor = color;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetSoildPat))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_solid_source
+ *
+ * Description:	This function specifies a constant source data value for
+ *				raster operations that use both pattern
+ *				and source data.
+ *  parameters:
+ *       color:	It specifies the source color.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *-------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_solid_source(unsigned long color)
+{
+   GAL_SETSOLIDSOURCE sSetSolidSrc;
+
+   INIT_GAL(&sSetSolidSrc);
+   sSetSolidSrc.dwSubfunction = GALFN_SETSOLIDSOURCE;
+   sSetSolidSrc.dwColor = color;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetSolidSrc))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_mono_source
+ *
+ * Description:	
+ *  parameters:
+ *     bkcolor: It specifies the background color.
+ *     fgcolor: It specifies the foreground color.
+ *transparency:	It specifies the transparency flag.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
+		    unsigned char transparency)
+{
+   GAL_SETMONOSOURCE sSetMonoSrc;
+
+   INIT_GAL(&sSetMonoSrc);
+   sSetMonoSrc.dwSubfunction = GALFN_SETMONOSOURCE;
+   sSetMonoSrc.dwFgColor = fgcolor;
+   sSetMonoSrc.dwBgColor = bgcolor;
+   sSetMonoSrc.cTransparency = transparency;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetMonoSrc))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_mono_pattern
+ *
+ * Description:	This function specifies an 8x8 monochrome pattern
+ *				used in future rendering operations.
+ *  parameters:
+ *     bkcolor: It specifies the background color.
+ *     fgcolor: It specifies the foreground color.
+ *		 data0: It specifies the bits of 8x8 monochrome pattern.
+ *       data1: It specifies the bits of 8x8 monochrome pattern.
+ *transparency:	It specifies the transparency flag.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
+		     unsigned long data0, unsigned long data1,
+		     unsigned char transparency)
+{
+   GAL_SETMONOPATTERN sSetMonoPat;
+
+   INIT_GAL(&sSetMonoPat);
+   sSetMonoPat.dwSubfunction = GALFN_SETMONOPATTERN;
+   sSetMonoPat.dwFgColor = fgcolor;
+   sSetMonoPat.dwBgColor = bgcolor;
+   sSetMonoPat.dwData0 = data0;
+   sSetMonoPat.dwData1 = data1;
+   sSetMonoPat.cTransparency = transparency;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetMonoPat))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_raster_operation
+ *
+ * Description:	This function specifies the raster operation for
+ *					future rendering.
+ *  parameters:
+ *         rop: It specifies the ternary raster operation
+ *					(pattern/source/destination).
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_raster_operation(unsigned char rop)
+{
+   GAL_RASTEROPERATION sSetRop;
+
+   INIT_GAL(&sSetRop);
+   sSetRop.dwSubfunction = GALFN_SETRASTEROPERATION;
+   sSetRop.cRop = rop;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetRop))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pattern_fill
+ *
+ * Description:	This function renders pattern data to a rectangular
+ *					region.
+ *  parameters:
+ *           x:	It specifies the screen X position, in pixels.
+ *           y:	It specifies the screen Y position, in pixels.
+ *       width:	It specifies the width of rectangle, in pixels.
+ *      height:	It specifies the height of rectangle, in pixels.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pattern_fill(unsigned short x, unsigned short y,
+		 unsigned short width, unsigned short height)
+{
+   GAL_PATTERNFILL sPatternFill;
+
+   INIT_GAL(&sPatternFill);
+   sPatternFill.dwSubfunction = GALFN_PATTERNFILL;
+   sPatternFill.wXPos = x;
+   sPatternFill.wYPos = y;
+   sPatternFill.wWidth = width;
+   sPatternFill.wHeight = height;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPatternFill))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_screen_to_screen_blt
+ *
+ * Description:	This function is used to perform a screen to screen
+ *				BLT operation.
+ *  parameters:
+ *        srcx:	It specifies the source X position.
+ *        srcy:	It specifies the source Y position.
+ *        dstx:	It specifies the destination X position.
+ *        dsty:	It specifies the destination Y position.
+ *       width: It specifies the width of BLT, in pixels.
+ *      height: It specifies the height of BLT, in pixels.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
+			 unsigned short dstx, unsigned short dsty,
+			 unsigned short width, unsigned short height)
+{
+   GAL_SCREENTOSCREENBLT sScreenBlt;
+
+   INIT_GAL(&sScreenBlt);
+   sScreenBlt.dwSubfunction = GALFN_SCREENTOSCREENBLT;
+   sScreenBlt.wXStart = srcx;
+   sScreenBlt.wYStart = srcy;
+   sScreenBlt.wXEnd = dstx;
+   sScreenBlt.wYEnd = dsty;
+   sScreenBlt.wWidth = width;
+   sScreenBlt.wHeight = height;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreenBlt))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_screen_to_screen_xblt
+ *
+ * Description:	This function is used to perform a screen to screen
+ *				BLT operation using a transparency color.
+ *  parameters:
+ *        srcx:	It specifies the source X position.
+ *        srcy:	It specifies the source Y position.
+ *        dstx:	It specifies the destination X position.
+ *        dsty:	It specifies the destination Y position.
+ *       width: It specifies the width of BLT, in pixels.
+ *      height: It specifies the height of BLT, in pixels.
+ *       color: It specifies the transparency color.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
+			  unsigned short dstx, unsigned short dsty,
+			  unsigned short width, unsigned short height,
+			  unsigned long color)
+{
+   GAL_SCREENTOSCREENXBLT sScreenXBlt;
+
+   INIT_GAL(&sScreenXBlt);
+   sScreenXBlt.dwSubfunction = GALFN_SCREENTOSCREENXBLT;
+   sScreenXBlt.wXStart = srcx;
+   sScreenXBlt.wYStart = srcy;
+   sScreenXBlt.wXEnd = dstx;
+   sScreenXBlt.wYEnd = dsty;
+   sScreenXBlt.wWidth = width;
+   sScreenXBlt.wHeight = height;
+   sScreenXBlt.dwColor = color;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreenXBlt))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_bresenham_line
+ *
+ * Description:	This function is used to draw a single pixel line
+ *					using the specified Bresenham parameters.
+ *  parameters:
+ *           x:	It specifies the starting X position.
+ *           y:	It specifies the starting Y position.
+ *      length:	It specifies the length of the vector, in pixels.
+ *     initerr:	It specifies the Bresenham initial error term.
+ *    axialerr:	It specifies the Bresenham axial error term
+ *					(moving in major direction only).
+ *     diagerr: It specifies Bresenham diagonal error term
+ *					(moving in major and minor direction.
+ *       flags: It specifies the flag.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_bresenham_line(unsigned short x, unsigned short y,
+		   unsigned short length, unsigned short initerr,
+		   unsigned short axialerr, unsigned short diagerr,
+		   unsigned short flags)
+{
+   GAL_BRESENHAMLINE sBresenhamLine;
+
+   INIT_GAL(&sBresenhamLine);
+   sBresenhamLine.dwSubfunction = GALFN_BRESENHAMLINE;
+   sBresenhamLine.wX1 = x;
+   sBresenhamLine.wY1 = y;
+   sBresenhamLine.wLength = length;
+   sBresenhamLine.wErr = initerr;
+   sBresenhamLine.wE1 = axialerr;
+   sBresenhamLine.wE2 = diagerr;
+   sBresenhamLine.wFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBresenhamLine))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal_color_pattern_fill(unsigned short x, unsigned short y,
+		       unsigned short width, unsigned short height,
+		       unsigned long pattern)
+{
+   GAL_COLOR_PATTERNFILL sColorPat;
+
+   INIT_GAL(&sColorPat);
+   sColorPat.dwSubfunction = GALFN_COLOR_PATTERNFILL;
+   sColorPat.wDstx = x;
+   sColorPat.wDsty = y;
+   sColorPat.wWidth = width;
+   sColorPat.wHeight = height;
+   sColorPat.dwPattern = pattern;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sColorPat))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
+			       unsigned short dstx, unsigned short dsty,
+			       unsigned short width, unsigned short height,
+			       unsigned long data, long pitch)
+{
+   GAL_COLOR_BITMAP_TO_SCREEN_BLT sBmp2Scr;
+
+   INIT_GAL(&sBmp2Scr);
+   sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_BLT;
+   sBmp2Scr.wSrcx = srcx;
+   sBmp2Scr.wSrcy = srcy;
+   sBmp2Scr.wDstx = dstx;
+   sBmp2Scr.wDsty = dsty;
+   sBmp2Scr.wWidth = width;
+   sBmp2Scr.wHeight = height;
+   sBmp2Scr.dwData = data;
+   sBmp2Scr.wPitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy,
+				unsigned short dstx, unsigned short dsty,
+				unsigned short width, unsigned short height,
+				unsigned long data, long pitch,
+				unsigned long color)
+{
+   GAL_COLOR_BITMAP_TO_SCREEN_XBLT sBmp2Scr;
+
+   INIT_GAL(&sBmp2Scr);
+   sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_XBLT;
+   sBmp2Scr.wSrcx = srcx;
+   sBmp2Scr.wSrcy = srcy;
+   sBmp2Scr.wDstx = dstx;
+   sBmp2Scr.wDsty = dsty;
+   sBmp2Scr.wWidth = width;
+   sBmp2Scr.wHeight = height;
+   sBmp2Scr.dwData = data;
+   sBmp2Scr.wPitch = pitch;
+   sBmp2Scr.dwColor = color;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
+			      unsigned short dstx, unsigned short dsty,
+			      unsigned short width, unsigned short height,
+			      unsigned long data, short pitch)
+{
+   GAL_MONO_BITMAP_TO_SCREEN_BLT sBmp2Scr;
+
+   INIT_GAL(&sBmp2Scr);
+   sBmp2Scr.dwSubfunction = GALFN_MONO_BITMAP_TO_SCREEN_BLT;
+   sBmp2Scr.wSrcx = srcx;
+   sBmp2Scr.wSrcy = srcy;
+   sBmp2Scr.wDstx = dstx;
+   sBmp2Scr.wDsty = dsty;
+   sBmp2Scr.wWidth = width;
+   sBmp2Scr.wHeight = height;
+   sBmp2Scr.dwData = data;
+   sBmp2Scr.wPitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width,
+	     unsigned short height, unsigned long data)
+{
+   GAL_TEXT_BLT sTextBlt;
+
+   INIT_GAL(&sTextBlt);
+   sTextBlt.dwSubfunction = GALFN_TEXT_BLT;
+   sTextBlt.wDstx = dstx;
+   sTextBlt.wDsty = dsty;
+   sTextBlt.wWidth = width;
+   sTextBlt.wHeight = height;
+   sTextBlt.dwData = data;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTextBlt))
+      return 0;
+   else
+      return 1;
+}
+
+/*------------------------------------------------------------------------
+ * Gal_set_compression_enable
+ *
+ *       Description:	This function enables or disables display
+ * 			compression.
+ *	  parameters:
+ * bCompressionState:	It specifies the display compression state.
+ *  	      return:	'1' was returned on success otherwise
+ *			'0' was returned.
+ *----------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_compression_enable(BOOLEAN bCompressionState)
+{
+   GAL_COMPRESSIONSTATE sCompState;
+
+   INIT_GAL(&sCompState);
+   sCompState.dwSubfunction = GALFN_SETCOMPRESSIONSTATE;
+   sCompState.bCompressionState = bCompressionState;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompState))
+      return 0;
+   else
+      return 1;
+}
+
+/*------------------------------------------------------------------------
+ * Gal_get_compression_enable
+ *
+ * 	Description:	This function gets the compression state.
+ *
+ *	  parameters:
+ * bCompressionState:	gets the display compression state.
+ *	      return:	'1' was returned on success otherwise
+ *			'0' was returned.
+ *----------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_compression_enable(int *bCompressionState)
+{
+   GAL_COMPRESSIONSTATE sCompState;
+
+   INIT_GAL(&sCompState);
+   sCompState.dwSubfunction = GALFN_GETCOMPRESSIONSTATE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompState))
+      return 0;
+   else {
+      *bCompressionState = sCompState.bCompressionState;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_compression_parameters
+ *
+ * Description:	This function sets the compression parameters of the
+ * 			frame buffer device.
+ *  parameters:
+ *       flags:	It specifies the flag.
+ *      offset:	It specifies the base offset in graphics memory for the
+ *			compression buffer.
+ *	 pitch:	It specifies the pitch of compression buffer, in bytes.
+ *        size:	It specifies the maximum line size of the compression buffer
+ *			in bytes.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_compression_parameters(unsigned long flags,
+			       unsigned long offset, unsigned short pitch,
+			       unsigned short size)
+{
+   GAL_COMPRESSIONPARAMS sCompParams;
+
+   INIT_GAL(&sCompParams);
+   sCompParams.dwSubfunction = GALFN_SETCOMPRESSIONPARAMS;
+   sCompParams.dwFlags = flags;
+   sCompParams.dwCompOffset = offset;
+   sCompParams.dwCompPitch = pitch;
+   sCompParams.dwCompSize = size;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompParams))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_compression_parameters
+ *
+ * Description:	This function gets the compression parameters of the
+ *				frame buffer device.
+ *  parameters:
+ *       flags:	It specifies the flag.
+ *      offset:	gets the base offset in graphics memory for the
+ *					compression buffer.
+ *		 pitch:	gets the pitch of compression buffer, in bytes.
+ *        size:	gets the maximum line size of the compression buffer
+ *					in bytes.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_compression_parameters(unsigned long flags,
+			       unsigned long *offset,
+			       unsigned short *pitch, unsigned short *size)
+{
+   GAL_COMPRESSIONPARAMS sCompParams;
+
+   INIT_GAL(&sCompParams);
+   sCompParams.dwSubfunction = GALFN_GETCOMPRESSIONPARAMS;
+   sCompParams.dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompParams))
+      return 0;
+   else {
+      *offset = sCompParams.dwCompOffset;
+      *pitch = sCompParams.dwCompPitch;
+      *size = sCompParams.dwCompSize;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_mode_switch
+ *
+ * Description:This function signals the beginning or end of a
+ *				mode switch.
+ *  parameters:
+ *      active:	It specifies the mode switch.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_mode_switch(int active)
+{
+   GAL_VGAMODEDATA sVgaData;
+
+   INIT_GAL(&sVgaData);
+   sVgaData.dwSubfunction = GALFN_VGAMODESWITCH;
+   sVgaData.dwFlags = active;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaData))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_clear_extended
+ *
+ * Description:	This will clear the Svga data.
+ *  parameters:	none.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_clear_extended(void)
+{
+   GAL_VGAMODEDATA sVgaData;
+
+   INIT_GAL(&sVgaData);
+   sVgaData.dwSubfunction = GALFN_VGACLEARCRTEXT;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaData))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_pitch
+ *
+ * Description:	This function sets VGA register values in VGA
+ *					structure for specified pitch.
+ *  parameters:
+ *    pVgaData: It specifies the vga structure.
+ *		 pitch:	It specifies the number of bytes between scanlines.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_pitch(PGAL_VGAMODEDATA pVgaData, unsigned short pitch)
+{
+   INIT_GAL(pVgaData);
+   pVgaData->dwSubfunction = GALFN_VGASETPITCH;
+   pVgaData->dwFlags = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_restore
+ *
+ * Description:	This function sets the VGA state to the values in the
+ *				VGA structure.
+ *  parameters:
+ *    pVgaData: It specifies the vga structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_restore(PGAL_VGAMODEDATA pVgaData)
+{
+   INIT_GAL(pVgaData);
+   pVgaData->dwSubfunction = GALFN_VGARESTORE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_save
+ *
+ * Description:	This function saves the current VGA state in the
+ *					VGA structure.
+ *  parameters:
+ *    pVgaData: It specifies the vga structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_save(PGAL_VGAMODEDATA pVgaData)
+{
+   INIT_GAL(pVgaData);
+   pVgaData->dwSubfunction = GALFN_VGASAVE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_vga_mode
+ *
+ * Description:	This function sets VGA register values in VGA
+ *					structure for specified mode.
+ *  parameters:
+ *    pVgaData: It specifies the vga structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_vga_mode(PGAL_VGAMODEDATA pVgaData)
+{
+   INIT_GAL(pVgaData);
+   pVgaData->dwSubfunction = GALFN_VGASETMODE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_enabled_in_bios
+ *
+ * Description:	This function gets the status of the FP in BIOS.
+ *  parameters:
+ *       status: returns the state of FP in Bios.
+ *	pParam:	It specifies the panel parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_enabled_in_bios(int *state)
+{
+   GAL_PNLBIOS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLBIOSENABLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      *state = pStat.state;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_info_from_bios
+ *
+ * Description:	This function gets the parameters of the FP in BIOS.
+ *  parameters:
+ *       status: returns the state of FP in Bios.
+ *	pParam:	It specifies the panel parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_info_from_bios(int *xres, int *yres, int *bpp, int *hz)
+{
+   GAL_PNLBIOS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLBIOSINFO;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      *xres = pStat.XRes;
+      *yres = pStat.YRes;
+      *bpp = pStat.Bpp;
+      *hz = pStat.Freq;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_set_params
+ *
+ * Description:	This function sets the panel parameters.
+ *  parameters:
+ *       flags:
+ *	pParam:	It specifies the panel parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_set_params(unsigned long flags, PPnl_PanelParams pParam)
+{
+   GAL_PNLPARAMS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLSETPARAMS;
+   pParam->Flags = flags;
+   direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_get_params
+ *
+ * Description:	This function gets the panel parameters.
+ *  parameters:
+ *       flags:
+ *	pParam:	It specifies the panel parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_get_params(unsigned long flags, PPnl_PanelParams pParam)
+{
+   GAL_PNLPARAMS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLGETPARAMS;
+   direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
+   pStat.PanelParams.Flags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      direct_memcpy(pParam, &(pStat.PanelParams), sizeof(Pnl_PanelParams));
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_init
+ *
+ * Description:	This function initializes the panel parameters.
+ *  parameters:
+ *	pParam:	It specifies the panel parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_init(PPnl_PanelParams pParam)
+{
+   GAL_PNLPARAMS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLINITPANEL;
+   direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else
+      return 1;
+
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_save
+ *
+ * Description:	This function saves the current panel parameters.
+ *  parameters:	none.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_save(void)
+{
+   GAL_PNLPARAMS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLSAVESTATE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_restore
+ *
+ * Description:	This function restores the current panel parameters.
+ *  parameters:	none.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_restore(void)
+{
+   GAL_PNLPARAMS pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLRESTORESTATE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_powerup
+ *
+ * Description:	This function powers up the panel.
+ *  parameters:	none.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_powerup(void)
+{
+   GAL_BASE pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLPOWERUP;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_pnl_powerdown
+ *
+ * Description:	This function powers down the panel.
+ *  parameters:	none.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_pnl_powerdown(void)
+{
+   GAL_BASE pStat;
+
+   INIT_GAL(&pStat);
+   pStat.dwSubfunction = GALFN_PNLPOWERDOWN;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_enable_panning
+ *
+ * Description: This routine  enables the panning when the Mode
+ *              is bigger than the panel size.
+ *  parameters:
+ *           x: x-positon of the screen.
+ *           y: y-positon of the screen.
+ *
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_enable_panning(int x, int y)
+{
+   GAL_ENABLEPANNING pEnablePanning;
+
+   INIT_GAL(&pEnablePanning);
+   pEnablePanning.dwSubfunction = GALFN_ENABLEPANNING;
+   pEnablePanning.x = x;
+   pEnablePanning.y = y;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pEnablePanning))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+
+/*--------------------------------------------------------------------------
+ * Gal_tv_set_params
+ *
+ * Description:	This function sets the tv parameters of
+ *					tvparameters structure.
+ *  parameters:
+ *       flags:
+ *	   pTV:	It specifies the tv parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_tv_set_params(unsigned long flags, PGAL_TVPARAMS pTV)
+{
+   INIT_GAL(pTV);
+   pTV->dwSubfunction = GALFN_SETTVPARAMS;
+   pTV->dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_tv_get_params
+ *
+ * Description:	This function gets the tv parameters of
+ *					tvparameters structure.
+ *  parameters:
+ *       flags: Dummy flag
+ *	   pTV:	It specifies the tv parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_tv_get_params(unsigned long flags, PGAL_TVPARAMS pTV)
+{
+   INIT_GAL(pTV);
+   pTV->dwSubfunction = GALFN_GETTVPARAMS;
+   pTV->dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
+      return 0;
+   else
+      return 1;
+
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_tv_set_timings
+ *
+ * Description:	This function sets the tv timing registers.
+ *  parameters:
+ *       flags:	Dummy flag.
+ *	   pTV:	It specifies the tv parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_tv_set_timings(unsigned long flags, PGAL_TVTIMING pTV)
+{
+   INIT_GAL(pTV);
+   pTV->dwSubfunction = GALFN_SETTVTIMING;
+   pTV->dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_tv_get_timings
+ *
+ * Description:	This function gets the tv timing registers.
+ *  parameters:
+ *       flags:	Dummy flag.
+ *	   pTV:	It specifies the tv parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_tv_get_timings(unsigned long flags, PGAL_TVTIMING pTV)
+{
+   INIT_GAL(pTV);
+   pTV->dwSubfunction = GALFN_GETTVTIMING;
+   pTV->dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_tv_enable
+ *
+ * Description:	This function sets the tv state of the device .
+ *  parameters:
+ *     bState : set the tv state.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_tv_enable(int bState)
+{
+   GAL_TVPARAMS pTV;
+
+   INIT_GAL(&pTV);
+   pTV.dwSubfunction = GALFN_SETENABLE;
+   pTV.bState = bState;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pTV))
+      return 0;
+   else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_tv_enable
+ *
+ * Description:	This function gets the tv state of the device .
+ *  parameters:
+ *     bState : get the tv state.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_tv_enable(unsigned int *bState)
+{
+   GAL_TVPARAMS pTV;
+
+   INIT_GAL(&pTV);
+   pTV.dwSubfunction = GALFN_GETENABLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pTV)) {
+      *bState = 0;
+      return 0;
+   } else {
+      *bState = pTV.bState;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_is_tv_mode_supported
+ *
+ * Description:	This function checks the tv mode is supported or not.
+ *  parameters:
+ *       flags: Dummy flag
+ *	   pTV:	It specifies the tv parameters structure.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_is_tv_mode_supported(unsigned long flags, PGAL_TVPARAMS pTV, int *bState)
+{
+   INIT_GAL(pTV);
+   pTV->dwSubfunction = GALFN_ISTVMODESUPPORTED;
+   pTV->dwFlags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV)) {
+      return 0;
+   } else {
+      *bState = pTV->bState;
+      return 1;
+   }
+}
+
+/** Video **********************************************************/
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_enable
+ *
+ * Description:	This function sets the video enable state.
+ *  parameters:
+ *      enable: Its value is '1' to enable video and '0' to disable video.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_enable(int enable)
+{
+   GAL_VIDEOENABLE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOENABLE;
+   sSetVideo.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_format
+ *
+ * Description:	This function sets the video format.
+ *  parameters:
+ *      format: Its video format value.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_format(int format)
+{
+   GAL_VIDEOFORMAT sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOFORMAT;
+   sSetVideo.format = format;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_size
+ *
+ * Description:	This function sets the video size.
+ *  parameters:
+ *       width: Width of the video.
+ *      height: Height of the video.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_size(unsigned short width, unsigned short height)
+{
+   GAL_VIDEOSIZE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOSIZE;
+   sSetVideo.width = width;
+   sSetVideo.height = height;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_offset
+ *
+ * Description:	This function sets the video size.
+ *  parameters:
+ *      offset: Offset of the video.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_offset(unsigned long offset)
+{
+   GAL_VIDEOOFFSET sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOOFFSET;
+   sSetVideo.offset = offset;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_window
+ *
+ * Description:	This function sets the video window.
+ *  parameters:
+ *			 x: X co-ordinate of the Video screen.
+ *			 y: Y co-ordinate of the Video screen.
+ *			 w: Width of the Video screen.
+ *           h: Height of the Video screen.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_window(short x, short y, short w, short h)
+{
+   GAL_VIDEOWINDOW sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOWINDOW;
+   sSetVideo.x = x;
+   sSetVideo.y = y;
+   sSetVideo.w = w;
+   sSetVideo.h = h;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_scale
+ *
+ * Description:	This function sets the video scale.
+ *  parameters:
+ *		  srcw: Source width.
+ *		  srch: Source height.
+ *		  dstw: Destination width.
+ *        dsth: Destination height.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_scale(unsigned short srcw, unsigned short srch,
+		    unsigned short dstw, unsigned short dsth)
+{
+   GAL_VIDEOSCALE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOSCALE;
+   sSetVideo.srcw = srcw;
+   sSetVideo.srch = srch;
+   sSetVideo.dstw = dstw;
+   sSetVideo.dsth = dsth;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_filter.
+ *
+ * Description:	This function sets the video filter.
+ *  parameters:
+ *	   xfilter: X-co-ordinate filter.
+ *	   yfilter: Y-co-ordinate filter.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_filter(int xfilter, int yfilter)
+{
+   GAL_VIDEOFILTER sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOFILTER;
+   sSetVideo.xfilter = xfilter;
+   sSetVideo.yfilter = yfilter;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_color_key.
+ *
+ * Description:	This function sets the video color key.
+ *  parameters:
+ *	       key: Color key.
+ *	      mask: Color mask.
+ *  bluescreen: Value for bluescreen.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_color_key(unsigned long key, unsigned long mask, int bluescreen)
+{
+   GAL_VIDEOCOLORKEY sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORKEY;
+   sSetVideo.key = key;
+   sSetVideo.mask = mask;
+   sSetVideo.bluescreen = bluescreen;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_downscale_enable.
+ *
+ * Description:	This function sets the video downscale enable state.
+ *  parameters:
+ *	    enable: Value for enable or disable the video downscale.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_downscale_enable(int enable)
+{
+   GAL_VIDEODOWNSCALEENABLE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALEENABLE;
+   sSetVideo.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_downscale_config.
+ *
+ * Description:	This function sets the video downscale configuration.
+ *  parameters:
+ *	      type: Video down scale type.
+ *			 m: Factor for the Video overlay window.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_downscale_config(unsigned short type, unsigned short m)
+{
+   GAL_VIDEODOWNSCALECONFIG sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECONFIG;
+   sSetVideo.type = type;
+   sSetVideo.m = m;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_downscale_coefficients.
+ *
+ * Description:	This function sets the video downscale coefficients.
+ *  parameters:
+ *	     coef1: Video downscale filter coefficient.
+ *	     coef2: Video downscale filter coefficient.
+ *	     coef3: Video downscale filter coefficient.
+ *	     coef4: Video downscale filter coefficient.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_downscale_coefficients(unsigned short coef1,
+				     unsigned short coef2,
+				     unsigned short coef3,
+				     unsigned short coef4)
+{
+   GAL_VIDEODOWNSCALECOEFF sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECOEFF;
+   sSetVideo.coef1 = coef1;
+   sSetVideo.coef2 = coef2;
+   sSetVideo.coef3 = coef3;
+   sSetVideo.coef4 = coef4;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_source.
+ *
+ * Description:	This function sets the video source to either memory or Direct
+ *				VIP
+ *  parameters:
+ *	    source: Video source.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_source(int source)
+{
+   GAL_VIDEOSOURCE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOSOURCE;
+   sSetVideo.source = source;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_interlaced
+ *
+ * Description:	This function configures the Video processor video overlay mode
+ *				to be interlaced YUV.
+ *  parameters:
+ *	    enable: Value used to enable or disalbe the Video interlaced.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+
+BOOLEAN
+Gal_set_video_interlaced(int enable)
+{
+   GAL_SETVIDEOINTERLACED sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOINTERLACED;
+   sSetVideo.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_color_space
+ *
+ * Description:	This function configures the Video processor to prcoess
+ *				graphics and video in either YUV or RGB color space.
+ *				
+ *  parameters:
+ *	    enable: Value used to enable or disalbe the Video color space.
+ *      return:	'1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_color_space_YUV(int colorspace)
+{
+   GAL_COLORSPACEYUV sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORSPACE;
+   sSetVideo.colorspace = colorspace;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_cursor.
+ *
+ *  Description: This function configures the Video Hardware cursor.
+ *	     		
+ *				
+ *   parameters:
+ *          key: color key.
+ *		   mask: color mask.
+ *select_color2: selected for color2.
+ *		 color1: color1 value.
+ *		 color2: color2 value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_cursor(unsigned long key,
+		     unsigned long mask,
+		     unsigned short select_color2,
+		     unsigned long color1, unsigned long color2)
+{
+   GAL_VIDEOCURSOR sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOCURSOR;
+   sSetVideo.key = key;
+   sSetVideo.mask = mask;
+   sSetVideo.select_color2 = select_color2;
+   sSetVideo.color1 = color1;
+   sSetVideo.color2 = color2;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_request.
+ *
+ *  Description: This function sets the horizontal(pixel) and vertical(line)
+ *				 video request values.
+ *	     		
+ *   parameters:
+ *            x: X video request value.
+ *		      y: Y video request value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_request(short x, short y)
+{
+   GAL_VIDEOREQUEST sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOREQUEST;
+   sSetVideo.x = x;
+   sSetVideo.y = y;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_enable.
+ *
+ *  Description: This function enables or disables the currently selected
+ *				 alpha region.
+ *	     		
+ *   parameters:
+ *       enable: Value to enalbe or disable alha region.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_alpha_enable(int enable)
+{
+   GAL_ALPHAENABLE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHAENABLE;
+   sSetVideo.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_alpha_enable.
+ *
+ *  Description: This function gets the alpha enable state.
+ *	     		
+ *   parameters:
+ *       enable: Pointer to get the enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_alpha_enable(int *enable)
+{
+   GAL_ALPHAENABLE sGetalphaenable;
+
+   INIT_GAL(&sGetalphaenable);
+   sGetalphaenable.dwSubfunction = GALFN_GETALPHAENABLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphaenable))
+      return 0;
+   else
+
+      *enable = sGetalphaenable.enable;
+   return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_window
+ *
+ *  Description: This function sets the size of the currently selected
+ *				 alpha region.  		
+ *   parameters:
+ *			  x: X co-ordinate of the alpha region.
+ *			  y: Y co-ordinate of the alpha region.
+ *	      width: Width of the alpha region.
+ *		 height: Height of the alpha region.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_alpha_window(short x, short y,
+		     unsigned short width, unsigned short height)
+{
+   GAL_ALPHAWINDOW sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHAWINDOW;
+   sSetVideo.x = x;
+   sSetVideo.y = y;
+   sSetVideo.width = width;
+   sSetVideo.height = height;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_alpha_size
+ *
+ *  Description: This function gets the size of the currently selected
+ *				 alpha region.  		
+ *   parameters:
+ *			  x: X co-ordinate of the alpha region.
+ *			  y: Y co-ordinate of the alpha region.
+ *	      width: Width of the alpha region.
+ *		 height: Height of the alpha region.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_alpha_size(unsigned short *x, unsigned short *y,
+		   unsigned short *width, unsigned short *height)
+{
+   GAL_ALPHASIZE sGetalphasize;
+
+   INIT_GAL(&sGetalphasize);
+   sGetalphasize.dwSubfunction = GALFN_GETALPHASIZE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphasize))
+      return 0;
+   else {
+      *x = *(sGetalphasize.x);
+      *y = *(sGetalphasize.y);
+      *width = *(sGetalphasize.width);
+      *height = *(sGetalphasize.height);
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_value
+ *
+ *  Description: This function sets the alpha value for the selected alpha
+ *				 region. It also specifies an increment/decrement value for
+ *				 fading.
+ *   parameters:
+ *		  alpha: Alpha value for the currently selected alpha region.
+ *		  delta: Gives the increment/decrement fading value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_alpha_value(unsigned char alpha, char delta)
+{
+   GAL_ALPHAVALUE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHAVALUE;
+   sSetVideo.alpha = alpha;
+   sSetVideo.delta = delta;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_alpha_value
+ *
+ *  Description: This function gets the alpha value for the selected alpha
+ *				 region. It also gets increment/decrement value for
+ *				 fading.
+ *   parameters:
+ *		  alpha: Alpha value for the currently selected alpha region.
+ *		  delta: Gives the increment/decrement fading value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_alpha_value(unsigned char *alpha, char *delta)
+{
+   GAL_ALPHAVALUE sGetalphavalue;
+
+   INIT_GAL(&sGetalphavalue);
+   sGetalphavalue.dwSubfunction = GALFN_GETALPHAVALUE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphavalue))
+      return 0;
+   else {
+      *alpha = sGetalphavalue.alpha;
+      *delta = sGetalphavalue.delta;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_priority
+ *
+ *  Description: This function sets the priority of the selected alpha
+ *				 region.
+ *   parameters:
+ *	   priority: Gives the priority value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_alpha_priority(int priority)
+{
+   GAL_ALPHAPRIORITY sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHAPRIORITY;
+   sSetVideo.priority = priority;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_alpha_priority
+ *
+ *  Description: This function gets the priority of the selected alpha
+ *				 region.
+ *   parameters:
+ *	   priority: Gives the priority value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_alpha_priority(int *priority)
+{
+   GAL_ALPHAPRIORITY sGetalphapriority;
+
+   INIT_GAL(&sGetalphapriority);
+   sGetalphapriority.dwSubfunction = GALFN_GETALPHAPRIORITY;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphapriority))
+      return 0;
+   else {
+      *priority = sGetalphapriority.priority;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_color
+ *
+ *  Description: This function sets the color to be displayed inside the
+ *				 currently of the selected alpha window.
+ *   parameters:
+ *	      color: Gives the color value to be displayed.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_alpha_color(unsigned long color)
+{
+   GAL_ALPHACOLOR sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHACOLOR;
+   sSetVideo.color = color;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_alpha_color
+ *
+ *  Description: This function gets the color to be displayed inside the
+ *				 currently of the selected alpha window.
+ *   parameters:
+ *	      color: Gives the color value to be displayed.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_alpha_color(unsigned long *color)
+{
+   GAL_ALPHACOLOR sGetalphacolor;
+
+   INIT_GAL(&sGetalphacolor);
+   sGetalphacolor.dwSubfunction = GALFN_GETALPHACOLOR;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphacolor))
+      return 0;
+   else {
+      *color = sGetalphacolor.color;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_select_alpha_region
+ *
+ *  Description: This function selects the alpha region should be used for
+ *				 future updates.
+ *   parameters:
+ *	     region: Gives the alpha window number.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_select_alpha_region(int region)
+{
+   GAL_ALPHAREGION sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETALPHAREGION;
+   sSetVideo.region = region;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_outside_alpha
+ *
+ *  Description: This function enable/disable the video outside alpha region.
+ *   parameters:
+ *	     enable: Gives the value for enable/disable.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_outside_alpha(int enable)
+{
+   GAL_VIDEOOUTSIDEALPHA sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOOUTSIDEALPHA;
+   sSetVideo.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_palette
+ *
+ *  Description: This function loads the video hardware palette.
+ *   parameters:
+ *	     palette: Gives value for hardware palette.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_palette(unsigned long *palette)
+{
+   GAL_VIDEOPALETTE sSetVideo;
+
+   INIT_GAL(&sSetVideo);
+   sSetVideo.dwSubfunction = GALFN_SETVIDEOPALETTE;
+
+   if (palette == NULL) {
+      sSetVideo.identity = 1;
+   } else {
+      sSetVideo.identity = 0;
+      direct_memcpy(sSetVideo.palette, palette, 256 * sizeof(*palette));
+   }
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
+      return 0;
+   else
+      return 1;
+}
+
+/** Video **********************************************************/
+
+/*--------------------------------------------------------------------------
+ * Gal_set_icon_enable
+ *
+ *  Description: This function enable/disables the hardware icon. The icon
+ *				 position and colors should be programmed prior to calling
+ *				 this routine.
+ *   parameters:
+ *	     enable: Gives value for enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_icon_enable(int enable)
+{
+   GAL_ICONENABLE sSetIconenable;
+
+   INIT_GAL(&sSetIconenable);
+   sSetIconenable.dwSubfunction = GALFN_SETICONENABLE;
+   sSetIconenable.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconenable)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_icon_colors
+ *
+ *  Description: This function sets the three hardware icon colors.
+ *   parameters:
+ *	     color0: Gives first color value.
+ *	     color1: Gives second color value.
+ *	     color2: Gives third color value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_icon_colors(unsigned long color0, unsigned long color1,
+		    unsigned long color2)
+{
+   GAL_ICONCOLORS sSetIconcolors;
+
+   INIT_GAL(&sSetIconcolors);
+   sSetIconcolors.dwSubfunction = GALFN_SETICONCOLORS;
+   sSetIconcolors.color0 = color0;
+   sSetIconcolors.color1 = color1;
+   sSetIconcolors.color2 = color2;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconcolors)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_icon_position.
+ *
+ *  Description: This function sets the hardware icon position.
+ *   parameters:
+ *	  memoffset: Memory offset of the icon buffer.
+ *	       xpos: Starting X co-ordinate for the hardware icon.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_icon_position(unsigned long memoffset, unsigned short xpos)
+{
+   GAL_ICONPOSITION sSetIconposi;
+
+   INIT_GAL(&sSetIconposi);
+   sSetIconposi.dwSubfunction = GALFN_SETICONPOSITION;
+   sSetIconposi.memoffset = memoffset;
+   sSetIconposi.xpos = xpos;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconposi)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_icon_shape64.
+ *
+ *  Description: This function initializes the icon buffer according to
+ *				  the current mode.
+ *	 parameters:
+ *	  memoffset: Memory offset of the icon buffer.
+ *	    andmask: Andmask of the icon buffer.
+ *	    xormask: Xormask of the icon buffer.
+ *		  lines: Lines of the icon buffer.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
+		     unsigned long *xormask, unsigned int lines)
+{
+   GAL_ICONSHAPE64 sSetIconshape64;
+
+   INIT_GAL(&sSetIconshape64);
+   sSetIconshape64.dwSubfunction = GALFN_SETICONSHAPE64;
+   sSetIconshape64.memoffset = memoffset;
+   *(sSetIconshape64.andmask) = *andmask;
+   *(sSetIconshape64.xormask) = *xormask;
+   sSetIconshape64.lines = lines;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconshape64)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*  VIP Functions */
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_enable
+ *
+ *  Description: This function enable/disables the writes to memory from the
+ *				 video port.
+ *				 position and colors should be programmed prior to calling
+ *				 this routine.
+ *   parameters:
+ *	     enable: Gives value for enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_enable(int enable)
+{
+   GAL_VIPENABLE sSetVipenable;
+
+   INIT_GAL(&sSetVipenable);
+   sSetVipenable.dwSubfunction = GALFN_SETVIPENABLE;
+   sSetVipenable.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipenable)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_enable
+ *
+ *  Description: This function gets the enable state of the
+ *				 video port.
+ *   parameters:
+ *	     enable: Gives value for enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_enable(int *enable)
+{
+   GAL_VIPENABLE sGetVipenable;
+
+   INIT_GAL(&sGetVipenable);
+   sGetVipenable.dwSubfunction = GALFN_GETVIPENABLE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipenable)) {
+      return 0;
+   } else {
+
+      *enable = sGetVipenable.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_capture_run_mode
+ *
+ *  Description: This function selects the VIP capture run mode.
+ *
+ *   parameters:
+ *	       mode: VIP capture run mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_capture_run_mode(int mode)
+{
+   GAL_VIPCAPTURERUNMODE sSetVipcapturerunmode;
+
+   INIT_GAL(&sSetVipcapturerunmode);
+   sSetVipcapturerunmode.dwSubfunction = GALFN_SETVIPCAPTURERUNMODE;
+   sSetVipcapturerunmode.mode = mode;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipcapturerunmode)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_base
+ *
+ *  Description: This routine sets the odd and even base address values for
+ *				 the VIP memory buffer.
+ *   parameters:
+ *	       even: Even base address.
+ *	        odd: odd base address.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_base(unsigned long even, unsigned long odd)
+{
+   GAL_VIPBASE sSetVipBase;
+
+   INIT_GAL(&sSetVipBase);
+   sSetVipBase.dwSubfunction = GALFN_SETVIPBASE;
+   sSetVipBase.even = even;
+   sSetVipBase.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipBase)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_base
+ *
+ *  Description: This routine gets the  base address value for
+ *				 the VIP memory buffer.
+ *   parameters:
+ *	    address: VIP base address.
+ *	        odd: odd base address.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_base(unsigned long *address, int odd)
+{
+   GAL_VIPBASE sGetVipBase;
+
+   INIT_GAL(&sGetVipBase);
+   sGetVipBase.dwSubfunction = GALFN_GETVIPBASE;
+   sGetVipBase.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipBase)) {
+      return 0;
+   } else {
+      *address = sGetVipBase.address;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_pitch
+ *
+ *  Description: This routine sets the  number of bytes between scanlines
+ *				 for the VIP data.
+ *   parameters:
+ *	      pitch: VIP pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_pitch(unsigned long pitch)
+{
+   GAL_VIPPITCH sSetVipPitch;
+
+   INIT_GAL(&sSetVipPitch);
+   sSetVipPitch.dwSubfunction = GALFN_SETVIPPITCH;
+   sSetVipPitch.pitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipPitch)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_pitch
+ *
+ *  Description: This routine gets the  number of bytes between scanlines
+ *				 for the VIP data.
+ *   parameters:
+ *	      pitch: VIP pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_pitch(unsigned long *pitch)
+{
+   GAL_VIPPITCH sGetVipPitch;
+
+   INIT_GAL(&sGetVipPitch);
+   sGetVipPitch.dwSubfunction = GALFN_GETVIPPITCH;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipPitch)) {
+      return 0;
+   } else {
+      *pitch = sGetVipPitch.pitch;
+      return 1;
+
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_mode
+ *
+ *  Description: This routine sets the  VIP operating mode.
+ *   parameters:
+ *	       mode: VIP operating mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_mode(int mode)
+{
+   GAL_VIPMODE sSetVipMode;
+
+   INIT_GAL(&sSetVipMode);
+   sSetVipMode.dwSubfunction = GALFN_SETVIPMODE;
+   sSetVipMode.mode = mode;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipMode)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_mode
+ *
+ *  Description: This routine gets the  VIP operating mode.
+ *   parameters:
+ *	       mode: VIP operating mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_mode(int *mode)
+{
+   GAL_VIPMODE sGetVipMode;
+
+   INIT_GAL(&sGetVipMode);
+   sGetVipMode.dwSubfunction = GALFN_GETVIPMODE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipMode)) {
+      return 0;
+   } else {
+
+      *mode = sGetVipMode.mode;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_bus_request_threshold_high
+ *
+ *  Description: This function sets the VIP FIFO bus request threshold.
+ *	     		
+ *   parameters:
+ *       enable: Enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_bus_request_threshold_high(int enable)
+{
+   GAL_VIPBUS_RTH sSetVipBRTH;
+
+   INIT_GAL(&sSetVipBRTH);
+   sSetVipBRTH.dwSubfunction = GALFN_SETVIPBRTH;
+   sSetVipBRTH.enable = enable;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipBRTH)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_bus_request_threshold_high
+ *
+ *  Description: This function gets the VIP FIFO bus request threshold.
+ *	     		
+ *   parameters:
+ *       enable: Enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_bus_request_threshold_high(int *enable)
+{
+   GAL_VIPBUS_RTH sGetVipBRTH;
+
+   INIT_GAL(&sGetVipBRTH);
+   sGetVipBRTH.dwSubfunction = GALFN_GETVIPBRTH;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipBRTH)) {
+      return 0;
+   } else {
+
+      *enable = sGetVipBRTH.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vip_last_line
+ *
+ *  Description: This function sets the maximum number of lines captured
+ *				 in each field.
+ *	     		
+ *   parameters:
+ *    last_line: Maximum number of lines captured in each field.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vip_last_line(int last_line)
+{
+   GAL_VIPLASTLINE sSetViplastline;
+
+   INIT_GAL(&sSetViplastline);
+   sSetViplastline.dwSubfunction = GALFN_SETVIPLASTLINE;
+   sSetViplastline.last_line = last_line;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetViplastline)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vip_line
+ *
+ *  Description: This function gets the number of the current video line being
+ *				 recieved by the VIP interface.
+ *	     		
+ *   parameters:
+ *     vip_line: Number of the current video line.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vip_line(int *vip_line)
+{
+   GAL_VIPLINE sGetVipline;
+
+   INIT_GAL(&sGetVipline);
+   sGetVipline.dwSubfunction = GALFN_GETVIPLINE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipline)) {
+      return 0;
+   } else {
+      *vip_line = sGetVipline.status;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_test_vip_odd_field
+ *
+ *  Description: This function tests the VIP odd field.
+ *	     		
+ *   parameters:
+ *       status: Status of the odd field.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_test_vip_odd_field(int *status)
+{
+   GAL_TESTVIPODDFIELD sTestVipoddfield;
+
+   INIT_GAL(&sTestVipoddfield);
+   sTestVipoddfield.dwSubfunction = GALFN_TESTVIPODDFIELD;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipoddfield)) {
+      return 0;
+   } else {
+      *status = sTestVipoddfield.status;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_test_vip_bases_updated
+ *
+ *  Description: This function tests the VIP bases updated.
+ *	     		
+ *   parameters:
+ *       status: Status of the VIP bases updated.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_test_vip_bases_updated(int *status)
+{
+   GAL_TESTVIPBASESUPDATED sTestVipbasesupdated;
+
+   INIT_GAL(&sTestVipbasesupdated);
+   sTestVipbasesupdated.dwSubfunction = GALFN_TESTVIPBASESUPDATED;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipbasesupdated)) {
+      return 0;
+   } else {
+      *status = sTestVipbasesupdated.status;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_test_vip_fifo_overflow
+ *
+ *  Description: This function tests the VIP FIFO overflow.
+ *	     		
+ *   parameters:
+ *       status: Status of the VIP FIFO overflow.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_test_vip_fifo_overflow(int *status)
+{
+   GAL_TESTVIPOVERFLOW sTestVipoverflow;
+
+   INIT_GAL(&sTestVipoverflow);
+   sTestVipoverflow.dwSubfunction = GALFN_TESTVIPFIFOOVERFLOW;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipoverflow)) {
+      return 0;
+   } else {
+      *status = sTestVipoverflow.status;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_enable
+ *
+ *  Description: This function enable/disables the VBI data capture.
+ *	     		
+ *   parameters:
+ *       enable: VBI enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_enable(int enable)
+{
+   GAL_VBIENABLE sSetVbienable;
+
+   INIT_GAL(&sSetVbienable);
+   sSetVbienable.dwSubfunction = GALFN_SETVBIENABLE;
+   sSetVbienable.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbienable)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_enable
+ *
+ *  Description: This function gets the enable state of the VBI data capture.
+ *	     		
+ *   parameters:
+ *       enable: VBI enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_enable(int *enable)
+{
+   GAL_VBIENABLE sGetVbienable;
+
+   INIT_GAL(&sGetVbienable);
+   sGetVbienable.dwSubfunction = GALFN_GETVBIENABLE;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbienable)) {
+      return 0;
+   } else {
+
+      *enable = sGetVbienable.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_base
+ *
+ *  Description: This function sets the VBI base addresses.
+ *	     		
+ *   parameters:
+ *         even: Even base address.
+ *          odd: Odd base address.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_base(unsigned long even, unsigned long odd)
+{
+   GAL_VBIBASE sSetVbiBase;
+
+   INIT_GAL(&sSetVbiBase);
+   sSetVbiBase.dwSubfunction = GALFN_SETVBIBASE;
+   sSetVbiBase.even = even;
+   sSetVbiBase.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiBase)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_base
+ *
+ *  Description: This function gets the VBI base address.
+ *	     		
+ *   parameters:
+ *      address: VBI base address.
+ *          odd: Odd base address.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_base(unsigned long *address, int odd)
+{
+   GAL_VBIBASE sGetVbiBase;
+
+   INIT_GAL(&sGetVbiBase);
+   sGetVbiBase.dwSubfunction = GALFN_GETVBIBASE;
+   sGetVbiBase.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiBase)) {
+      return 0;
+   } else {
+      *address = sGetVbiBase.address;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_pitch
+ *
+ *  Description: This function sets the number of bytes between scanlines for
+ *				 VBI capture.
+ *	     		
+ *   parameters:
+ *        pitch: VBI pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_pitch(unsigned long pitch)
+{
+   GAL_VBIPITCH sSetVbiPitch;
+
+   INIT_GAL(&sSetVbiPitch);
+   sSetVbiPitch.dwSubfunction = GALFN_SETVBIPITCH;
+   sSetVbiPitch.pitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiPitch)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_pitch
+ *
+ *  Description: This function gets the number of bytes between scanlines for
+ *				 VBI capture.
+ *	     		
+ *   parameters:
+ *        pitch: VBI pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_pitch(unsigned long *pitch)
+{
+   GAL_VBIPITCH sGetVbiPitch;
+
+   INIT_GAL(&sGetVbiPitch);
+   sGetVbiPitch.dwSubfunction = GALFN_GETVBIPITCH;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiPitch)) {
+      return 0;
+   } else {
+      *pitch = sGetVbiPitch.pitch;
+      return 1;
+
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_mode
+ *
+ *  Description: This function sets the VBI data types captured to memory.
+ *	     		
+ *   parameters:
+ *         mode: VBI mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_mode(int mode)
+{
+   GAL_VBIMODE sSetVbiMode;
+
+   INIT_GAL(&sSetVbiMode);
+   sSetVbiMode.dwSubfunction = GALFN_SETVBIMODE;
+   sSetVbiMode.mode = mode;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiMode)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_mode
+ *
+ *  Description: This function gets the VBI data types captured to memory.
+ *	     		
+ *   parameters:
+ *         mode: VBI mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_mode(int *mode)
+{
+   GAL_VBIMODE sGetVbiMode;
+
+   INIT_GAL(&sGetVbiMode);
+   sGetVbiMode.dwSubfunction = GALFN_GETVBIMODE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiMode)) {
+      return 0;
+   } else {
+
+      *mode = sGetVbiMode.mode;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_direct
+ *
+ *  Description: This function sets the VBI lines to be passed to the
+ *				 Direct VIP.
+ *	     		
+ *   parameters:
+ *   even_lines: VBI even lines.
+ *    odd_lines: VBI odd lines.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines)
+{
+   GAL_SETVBIDIRECT sSetVbidirect;
+
+   INIT_GAL(&sSetVbidirect);
+   sSetVbidirect.dwSubfunction = GALFN_SETVBIDIRECT;
+   sSetVbidirect.even_lines = even_lines;
+   sSetVbidirect.odd_lines = odd_lines;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbidirect)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+BOOLEAN
+Gal2_set_destination_stride(unsigned short stride)
+{
+   GAL_STRIDE sSetStride;
+
+   INIT_GAL(&sSetStride);
+   sSetStride.dwSubfunction = GALFN_SETDESTINATIONSTRIDE;
+
+   sSetStride.stride = stride;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetStride))
+      return 0;
+   else
+      return 1;
+}
+
+BOOLEAN
+Gal2_set_pattern_origin(int x, int y)
+{
+   GAL_PATTERNORIGIN sSetPatOrigin;
+
+   INIT_GAL(&sSetPatOrigin);
+   sSetPatOrigin.dwSubfunction = GALFN_SETPATTERNORIGIN;
+
+   sSetPatOrigin.x = x;
+   sSetPatOrigin.y = y;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetPatOrigin))
+      return 0;
+   else
+      return 1;
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_direct
+ *
+ *  Description: This function gets the VBI lines to be passed to the
+ *				 Direct VIP.
+ *	     		
+ *   parameters:
+ *          odd: VBI odd lines.
+ * direct_lines: VBI direct lines.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_direct(int odd, unsigned long *direct_lines)
+{
+   GAL_GETVBIDIRECT sGetVbidirect;
+
+   INIT_GAL(&sGetVbidirect);
+   sGetVbidirect.dwSubfunction = GALFN_GETVBIDIRECT;
+   sGetVbidirect.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbidirect)) {
+      return 0;
+   } else {
+      *direct_lines = sGetVbidirect.direct_lines;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_interrupt
+ *
+ *  Description: This function enable/disables the VBI field interrupt.
+ *	     		
+ *   parameters:
+ *       enable: Value to enable/disable VBI interrupt.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_interrupt(int enable)
+{
+   GAL_VBIINTERRUPT sSetVbiinterrupt;
+
+   INIT_GAL(&sSetVbiinterrupt);
+   sSetVbiinterrupt.dwSubfunction = GALFN_SETVBIINTERRUPT;
+   sSetVbiinterrupt.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiinterrupt)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_interrupt
+ *
+ *  Description: This function gets the VBI field interrupt.
+ *	     		
+ *   parameters:
+ *       enable: Value of enable/disable VBI interrupt.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_interrupt(int *enable)
+{
+   GAL_VBIINTERRUPT sGetVbiinterrupt;
+
+   INIT_GAL(&sGetVbiinterrupt);
+   sGetVbiinterrupt.dwSubfunction = GALFN_GETVBIINTERRUPT;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiinterrupt)) {
+      return 0;
+   } else {
+      *enable = sGetVbiinterrupt.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_source_stride
+ *
+ *  Description: This function sets the stride to be used in successive screen
+ *				 to screen BLTs.
+ *	     		
+ *   parameters:
+ *       enable: Value of enable/disable VBI interrupt.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_set_source_stride(unsigned short stride)
+{
+   GAL_STRIDE sSetsourcestride;
+
+   INIT_GAL(&sSetsourcestride);
+   sSetsourcestride.dwSubfunction = GALFN_SETSOURCESTRIDE;
+
+   sSetsourcestride.stride = stride;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetsourcestride)) {
+      return 0;
+   } else {
+
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_source_transparency
+ *
+ *  Description: This function sets the source transparency color and
+ *				 mask to be used in future rendering routines.
+ *				 to screen BLTs.
+ *	     		
+ *   parameters:
+ *        color: Source color.
+ *		   mask: Source mask.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_set_source_transparency(unsigned long color, unsigned long mask)
+{
+   GAL_SOURCETRANSPARENCY sSetsourcetransparency;
+
+   INIT_GAL(&sSetsourcetransparency);
+   sSetsourcetransparency.dwSubfunction = GALFN_SETSOURCETRANSPARENCY;
+
+   sSetsourcetransparency.color = color;
+   sSetsourcetransparency.mask = mask;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetsourcetransparency)) {
+      return 0;
+   } else {
+
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_alpha_mode
+ *
+ *  Description: This function sets the alpha blending mode.
+ *   parameters:
+ *         mode: Alpha blending mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_set_alpha_mode(int mode)
+{
+   GAL_GFX2ALPHAMODE sSetalphamode;
+
+   INIT_GAL(&sSetalphamode);
+   sSetalphamode.dwSubfunction = GALFN_GFX2SETALPHAMODE;
+
+   sSetalphamode.mode = mode;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetalphamode)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_gfx2_set_alpha_value
+ *
+ *  Description: This function sets the alpha value to be used with certain
+ *				 alpha blending modes.
+ *   parameters:
+ *        value: Alpha blending value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_set_alpha_value(unsigned char value)
+{
+   GAL_GFX2ALPHAVALUE sSetalphavalue;
+
+   INIT_GAL(&sSetalphavalue);
+   sSetalphavalue.dwSubfunction = GALFN_GFX2SETALPHAVALUE;
+
+   sSetalphavalue.value = value;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetalphavalue)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_pattern_fill
+ *
+ *  Description: This function used to fill the pattern of GX2.
+ *				 It allows the arbitary destination stride. The rendering
+ *				 position is also specified as an offset instead of (x,y)
+ *				 position.
+ *   parameters:
+ *    dstoffset: Rendering offset.
+ *		  width: Width of the pattern.
+ *       height: Height of the pattern.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_pattern_fill(unsigned long dstoffset, unsigned short width,
+                  unsigned short height)
+{
+   GAL_GFX2PATTERNFILL sPatternfill;
+
+   INIT_GAL(&sPatternfill);
+   sPatternfill.dwSubfunction = GALFN_GFX2PATTERNFILL;
+
+   sPatternfill.dstoffset = dstoffset;
+   sPatternfill.width = width;
+   sPatternfill.height = height;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPatternfill)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_gfx2_screen_to_screen_blt
+ *
+ *  Description: This function used for screen to screen BLTs of GX2.
+ *				 It allows the arbitary source and destination strides and
+ *				 alpha blending.
+ *   parameters:
+ *    srcoffset: Source Rendering offset.
+ *    dstoffset: Destination Rendering offset.
+ *		  width: Width of the screen.
+ *       height: Height of the screen.
+ *		  flags: Flags of the screen to screen BLT.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_screen_to_screen_blt(unsigned long srcoffset,
+			  unsigned long dstoffset, unsigned short width,
+			  unsigned short height, int flags)
+{
+   GAL_GFX2SCREENTOSCREENBLT sScreentoScreenblt;
+
+   INIT_GAL(&sScreentoScreenblt);
+   sScreentoScreenblt.dwSubfunction = GALFN_GFX2SCREENTOSCREENBLT;
+
+   sScreentoScreenblt.srcoffset = srcoffset;
+   sScreentoScreenblt.dstoffset = dstoffset;
+   sScreentoScreenblt.width = width;
+   sScreentoScreenblt.height = height;
+   sScreentoScreenblt.flags = flags;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreentoScreenblt)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_mono_expand_blt
+ *
+ *  Description: This function used to expand monochrome data stored in
+ *				 graphics memory for screen to screen BLTs.
+ *   parameters:
+ *      srcbase: Source Rendering base address.
+ *         srcx: Source X offset.
+ *         srcy: Source Y offset.
+ *    dstoffset: Destination Rendering offset.
+ *		  width: Width of the screen.
+ *       height: Height of the screen.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
+		     unsigned short srcy, unsigned long dstoffset,
+		     unsigned short width, unsigned short height,
+		     int byte_packed)
+{
+   GAL_GFX2MONOEXPANDBLT sMonoexpandblt;
+
+   INIT_GAL(&sMonoexpandblt);
+   sMonoexpandblt.dwSubfunction = GALFN_GFX2MONOEXPANDBLT;
+   sMonoexpandblt.srcbase = srcbase;
+   sMonoexpandblt.srcx = srcx;
+   sMonoexpandblt.srcy = srcy;
+   sMonoexpandblt.dstoffset = dstoffset;
+   sMonoexpandblt.width = width;
+   sMonoexpandblt.height = height;
+   sMonoexpandblt.byte_packed = byte_packed;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sMonoexpandblt)) {
+      return 0;
+   } else {
+      return 1;
+
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_color_bitmap_to_screen_blt
+ *
+ *  Description: This function used for color bmp to screen BLTs.
+ *   parameters:
+ *         srcx: Source X offset.
+ *         srcy: Source Y offset.
+ *    dstoffset: Destination Rendering offset.
+ *		  width: Width of the screen.
+ *       height: Height of the screen.
+ *		  *data: Color bmp data.
+ *	      pitch: Pitch of the dispaly mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_color_bitmap_to_screen_blt(unsigned short srcx,
+				unsigned short srcy,
+				unsigned long dstoffset,
+				unsigned short width,
+				unsigned short height,
+				unsigned char *data, unsigned short pitch)
+{
+   GAL_GFX2COLORBMPTOSCRBLT sColorbmptoscrblt;
+
+   INIT_GAL(&sColorbmptoscrblt);
+   sColorbmptoscrblt.dwSubfunction = GALFN_GFX2COLORBMPTOSCRBLT;
+   sColorbmptoscrblt.srcx = srcx;
+   sColorbmptoscrblt.srcy = srcy;
+   sColorbmptoscrblt.dstoffset = dstoffset;
+   sColorbmptoscrblt.width = width;
+   sColorbmptoscrblt.height = height;
+   sColorbmptoscrblt.data = *data;
+   sColorbmptoscrblt.pitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sColorbmptoscrblt)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_mono_bitmap_to_screen_blt
+ *
+ *  Description: This function used for mono bmp to screen BLTs.
+ *   parameters:
+ *         srcx: Source X offset.
+ *         srcy: Source Y offset.
+ *    dstoffset: Destination Rendering offset.
+ *		  width: Width of the screen.
+ *       height: Height of the screen.
+ *		  *data: mono bmp data.
+ *	      pitch: Pitch of the display mode.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_mono_bitmap_to_screen_blt(unsigned short srcx,
+			       unsigned short srcy,
+			       unsigned long dstoffset,
+			       unsigned short width,
+			       unsigned short height,
+			       unsigned char *data, unsigned short pitch)
+{
+   GAL_GFX2MONOBMPTOSCRBLT sMonobmptoscrblt;
+
+   INIT_GAL(&sMonobmptoscrblt);
+   sMonobmptoscrblt.dwSubfunction = GALFN_GFX2MONOBMPTOSCRBLT;
+   sMonobmptoscrblt.srcx = srcx;
+   sMonobmptoscrblt.srcy = srcy;
+   sMonobmptoscrblt.dstoffset = dstoffset;
+   sMonobmptoscrblt.width = width;
+   sMonobmptoscrblt.height = height;
+   sMonobmptoscrblt.data = *data;
+   sMonobmptoscrblt.pitch = pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sMonobmptoscrblt)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_bresenham_line
+ *
+ *  Description: This function used to draw bresenham line. It allows the
+ *				 arbitary destination stride.
+ *   parameters:
+ *    dstoffset: Destination  offset.
+ *		 length: Length of the line.
+ *      initerr: Intial error.
+ *	   axialerr:
+ *	    diagerr:
+ *		  flags:
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_bresenham_line(unsigned long dstoffset, unsigned short length,
+		    unsigned short initerr, unsigned short axialerr,
+		    unsigned short diagerr, unsigned short flags)
+{
+   GAL_GFX2BRESENHAMLINE sBresenhamline;
+
+   INIT_GAL(&sBresenhamline);
+   sBresenhamline.dwSubfunction = GALFN_GFX2BRESENHAMLINE;
+   sBresenhamline.dstoffset = dstoffset;
+   sBresenhamline.length = length;
+   sBresenhamline.initerr = initerr;
+   sBresenhamline.axialerr = axialerr;
+   sBresenhamline.diagerr = diagerr;
+   sBresenhamline.flags = flags;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBresenhamline)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal2_sync_to_vblank
+ *
+ *  Description: This function sets the a flag to synchronize the next
+ *				 rendering routine to VBLANK.
+ *   parameters: none.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal2_sync_to_vblank(void)
+{
+   GAL_GFX2SYNCTOVBLANK sSynctovblank;
+
+   INIT_GAL(&sSynctovblank);
+   sSynctovblank.dwSubfunction = GALFN_GFX2SYNCTOVBLANK;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSynctovblank)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/* Video routines */
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_yuv_pitch
+ *
+ *  Description: This function sets the Video YUV pitch.
+ *				
+ *   parameters:
+ *       y_pitch: Y pitch.
+ *	    uv_pitch: UV pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_yuv_pitch(unsigned long y_pitch, unsigned long uv_pitch)
+{
+   GAL_VIDEOYUVPITCH sSetVideoyuvpitch;
+
+   INIT_GAL(&sSetVideoyuvpitch);
+   sSetVideoyuvpitch.dwSubfunction = GALFN_SETVIDEOYUVPITCH;
+   sSetVideoyuvpitch.y_pitch = y_pitch;
+   sSetVideoyuvpitch.uv_pitch = uv_pitch;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoyuvpitch)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_video_yuv_pitch
+ *
+ *  Description: This function gets the Video YUV pitch.
+ *				
+ *   parameters:
+ *       y_pitch: Y pitch.
+ *	    uv_pitch: UV pitch.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_video_yuv_pitch(unsigned long *y_pitch, unsigned long *uv_pitch)
+{
+   GAL_VIDEOYUVPITCH sGetVideoyuvpitch;
+
+   INIT_GAL(&sGetVideoyuvpitch);
+   sGetVideoyuvpitch.dwSubfunction = GALFN_GETVIDEOYUVPITCH;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVideoyuvpitch)) {
+      return 0;
+   } else {
+      *y_pitch = sGetVideoyuvpitch.y_pitch;
+      *uv_pitch = sGetVideoyuvpitch.uv_pitch;
+
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_yuv_offsets
+ *
+ *  Description: This function sets the Video YUV offsets.
+ *				
+ *   parameters:
+ *      y_offset: Y offset.
+ *		u_offset: U offset.
+ *		v_offset: V offset.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_video_yuv_offsets(unsigned long y_offset, unsigned long u_offset,
+			  unsigned long v_offset)
+{
+   GAL_VIDEOYUVOFFSETS sSetVideoyuvoffsets;
+
+   INIT_GAL(&sSetVideoyuvoffsets);
+   sSetVideoyuvoffsets.dwSubfunction = GALFN_SETVIDEOYUVOFFSETS;
+   sSetVideoyuvoffsets.dwYoffset = y_offset;
+   sSetVideoyuvoffsets.dwUoffset = u_offset;
+   sSetVideoyuvoffsets.dwVoffset = v_offset;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoyuvoffsets)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_video_yuv_offsets
+ *
+ *  Description: This function gets the Video YUV offsets.
+ *				
+ *   parameters:
+ *      y_offset: Y offset.
+ *		u_offset: U offset.
+ *		v_offset: V offset.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_get_video_yuv_offsets(unsigned long *y_offset,
+			  unsigned long *u_offset, unsigned long *v_offset)
+{
+   GAL_VIDEOYUVOFFSETS sGetVideoyuvoffsets;
+
+   INIT_GAL(&sGetVideoyuvoffsets);
+   sGetVideoyuvoffsets.dwSubfunction = GALFN_GETVIDEOYUVOFFSETS;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVideoyuvoffsets)) {
+      return 0;
+   } else {
+      *y_offset = sGetVideoyuvoffsets.dwYoffset;
+      *u_offset = sGetVideoyuvoffsets.dwUoffset;
+      *v_offset = sGetVideoyuvoffsets.dwVoffset;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_left_crop
+ *
+ *  Description: This function sets the number of pixels which will be cropped
+ *				 from the beginning of each video line.
+ *				
+ *   parameters:
+ *			  x:
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_set_video_left_crop(unsigned short x)
+{
+   GAL_VIDEOLEFTCROP sSetVideoleftcrop;;
+
+   INIT_GAL(&sSetVideoleftcrop);
+   sSetVideoleftcrop.dwSubfunction = GALFN_SETVIDEOLEFTCROP;
+   sSetVideoleftcrop.x = x;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoleftcrop)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_video_vertical_downscale
+ *
+ *  Description: This function sets the vertical downscale factor for the video
+ *				 overlay window.	
+ *				
+ *   parameters:
+ *		   srch: Height of the source.
+ *		   dsth: Height of the destination.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_set_video_vertical_downscale(unsigned short srch, unsigned short dsth)
+{
+   GAL_VIDEOVERTICALDOWNSCALE sSetVideoverticaldownscale;
+
+   INIT_GAL(&sSetVideoverticaldownscale);
+   sSetVideoverticaldownscale.dwSubfunction = GALFN_SETVIDEOVERTICALDOWNSCALE;
+   sSetVideoverticaldownscale.srch = srch;
+   sSetVideoverticaldownscale.dsth = dsth;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoverticaldownscale)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_source
+ *
+ *  Description: This function sets the VBI source.	
+ *				
+ *   parameters:
+ *		 source: VBI Source type.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_set_vbi_source(VbiSourceType source)
+{
+   GAL_VBISOURCE sSetVbisource;
+
+   INIT_GAL(&sSetVbisource);
+   sSetVbisource.dwSubfunction = GALFN_SETVBISOURCE;
+   sSetVbisource.source = source;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbisource)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_source
+ *
+ *  Description: This function gets the VBI source.	
+ *				
+ *   parameters:
+ *		 source: VBI Source type.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_vbi_source(VbiSourceType * source)
+{
+   GAL_VBISOURCE sGetVbisource;
+
+   INIT_GAL(&sGetVbisource);
+   sGetVbisource.dwSubfunction = GALFN_GETVBISOURCE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbisource)) {
+      return 0;
+   } else {
+
+      *source = sGetVbisource.source;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_lines
+ *
+ *  Description: This function sets the VBI lines.	
+ *				
+ *   parameters:
+ *		   even: VBI even lines.
+ *			odd: VBI odd lines.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_lines(unsigned long even, unsigned long odd)
+{
+   GAL_VBILINES sSetVbilines;
+
+   INIT_GAL(&sSetVbilines);
+   sSetVbilines.dwSubfunction = GALFN_SETVBILINES;
+   sSetVbilines.even = even;
+   sSetVbilines.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbilines)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vbi_lines
+ *
+ *  Description: This function gets the VBI lines.	
+ *				
+ *   parameters:
+ *	      lines: VBI lines.
+ *			odd: VBI odd lines.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_get_vbi_lines(int odd, unsigned long *lines)
+{
+   GAL_VBILINES sGetVbilines;
+
+   INIT_GAL(&sGetVbilines);
+   sGetVbilines.dwSubfunction = GALFN_GETVBILINES;
+   sGetVbilines.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbilines)) {
+      return 0;
+   } else {
+      *lines = sGetVbilines.lines;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_total
+ *
+ *  Description: This function sets the total number of VBI bytes for each
+ *				 field.	
+ *				
+ *   parameters:
+ *	       even:
+ *			odd:
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_vbi_total(unsigned long even, unsigned long odd)
+{
+   GAL_VBITOTAL sSetVbitotal;
+
+   INIT_GAL(&sSetVbitotal);
+   sSetVbitotal.dwSubfunction = GALFN_SETVBITOTAL;
+   sSetVbitotal.even = even;
+   sSetVbitotal.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbitotal)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vbi_total
+ *
+ *  Description: This function gets the total number of VBI bytes in the
+ *				 field.	
+ *				
+ *   parameters:
+ *	       even:
+ *			odd:
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_get_vbi_total(int odd, unsigned long *total)
+{
+   GAL_VBITOTAL sGetVbitotal;
+
+   INIT_GAL(&sGetVbitotal);
+   sGetVbitotal.dwSubfunction = GALFN_GETVBITOTAL;
+   sGetVbitotal.odd = odd;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbitotal)) {
+      return 0;
+   } else {
+      *total = sGetVbitotal.total;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_vertical_scaler_offset
+ *
+ *  Description: This function sets the Video vertical scaler offset.	
+ *				
+ *   parameters:
+ *	     offset: Vertical Scaler offset.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_set_vertical_scaler_offset(char offset)
+{
+   GAL_VSCALEROFFSET sSetVscaleroffset;
+
+   INIT_GAL(&sSetVscaleroffset);
+   sSetVscaleroffset.dwSubfunction = GALFN_SETVSCALEROFFSET;
+   sSetVscaleroffset.offset = offset;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVscaleroffset)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_vertical_scaler_offset
+ *
+ *  Description: This function gets the Video vertical scaler offset.	
+ *				
+ *   parameters:
+ *	     offset: Vertical Scaler offset.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/ BOOLEAN
+Gal_get_vertical_scaler_offset(char *offset)
+{
+   GAL_VSCALEROFFSET sGetVscaleroffset;
+
+   INIT_GAL(&sGetVscaleroffset);
+   sGetVscaleroffset.dwSubfunction = GALFN_GETVSCALEROFFSET;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVscaleroffset)) {
+      return 0;
+   } else {
+
+      *offset = sGetVscaleroffset.offset;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_video_interlaced
+ *
+ *  Description: This function gets the video interlaced mode.
+ *   parameters:
+ *   interlaced: ptr to the interlaced status.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_video_interlaced(int *interlaced)
+{
+   GAL_GETVIDEOINTERLACED sGetvideointerlaced;
+
+   INIT_GAL(&sGetvideointerlaced);
+   sGetvideointerlaced.dwSubfunction = GALFN_GETVIDEOINTERLACED;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetvideointerlaced)) {
+      return 0;
+   } else {
+      *interlaced = sGetvideointerlaced.interlaced;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_color_space_YUV
+ *
+ *  Description: This function gets the video color space YUV.
+ *   parameters:
+ *   colorspace: ptr to the color space.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_color_space_YUV(int *colorspace)
+{
+   GAL_COLORSPACEYUV sGetcolorspaceyuv;
+
+   INIT_GAL(&sGetcolorspaceyuv);
+   sGetcolorspaceyuv.dwSubfunction = GALFN_GETCOLORSPACEYUV;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetcolorspaceyuv)) {
+      return 0;
+   } else {
+      *colorspace = sGetcolorspaceyuv.colorspace;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_genlock_enable
+ *
+ *  Description: This function gets the enable state of the genlock.
+ *   parameters:
+ *       enable: ptr to the enable state of the genlock.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_genlock_enable(int *enable)
+{
+   GAL_GENLOCKENABLE sGetgenlockenable;
+
+   INIT_GAL(&sGetgenlockenable);
+   sGetgenlockenable.dwSubfunction = GALFN_GETGENLOCKENABLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetgenlockenable)) {
+      return 0;
+   } else {
+      *enable = sGetgenlockenable.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_genlock_enable
+ *
+ *  Description: This function enable/disables and configure the genlock
+ *				 according to the parameters.
+ *   parameters:
+ *       enable:  enable state of the genlock.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_genlock_enable(int enable)
+{
+   GAL_GENLOCKENABLE sSetgenlockenable;
+
+   INIT_GAL(&sSetgenlockenable);
+   sSetgenlockenable.dwSubfunction = GALFN_SETGENLOCKENABLE;
+
+   sSetgenlockenable.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetgenlockenable)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_genlock_delay
+ *
+ *  Description: This function gets the genlock delay.
+ *   parameters:
+ *        delay:  Ptr to the genlock delay.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_genlock_delay(unsigned long *delay)
+{
+   GAL_GENLOCKDELAY sGetgenlockdelay;
+
+   INIT_GAL(&sGetgenlockdelay);
+   sGetgenlockdelay.dwSubfunction = GALFN_GETGENLOCKDELAY;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetgenlockdelay)) {
+      return 0;
+   } else {
+      *delay = sGetgenlockdelay.delay;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_genlock_delay
+ *
+ *  Description: This function sets the genlock delay.
+ *   parameters:
+ *        delay:  genlock delay.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_genlock_delay(unsigned long delay)
+{
+   GAL_GENLOCKDELAY sSetgenlockdelay;
+
+   INIT_GAL(&sSetgenlockdelay);
+   sSetgenlockdelay.dwSubfunction = GALFN_SETGENLOCKDELAY;
+
+   sSetgenlockdelay.delay = delay;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetgenlockdelay)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+BOOLEAN
+Gal_set_top_line_in_odd(int enable)
+{
+   GAL_TOPLINEINODD sSettoplineinodd;
+
+   INIT_GAL(&sSettoplineinodd);
+   sSettoplineinodd.dwSubfunction = GALFN_SETTOPLINEINODD;
+
+   sSettoplineinodd.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSettoplineinodd)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_video_cursor.
+ *
+ *  Description: This function gets configuration of the Video Hardware
+ *				 cursor.
+ *   parameters:
+ *          key: color key.
+ *		   mask: color mask.
+ *select_color2: selected for color2.
+ *		 color1: color1 value.
+ *		 color2: color2 value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_video_cursor(unsigned long *key,
+		     unsigned long *mask,
+		     unsigned short *select_color2,
+		     unsigned long *color1, unsigned long *color2)
+{
+   GAL_VIDEOCURSOR sGetvideocursor;
+
+   INIT_GAL(&sGetvideocursor);
+   sGetvideocursor.dwSubfunction = GALFN_GETVIDEOCURSOR;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetvideocursor)) {
+      return 0;
+   } else {
+      *key = sGetvideocursor.key;
+      *mask = sGetvideocursor.mask;
+      *select_color2 = sGetvideocursor.select_color2;
+      *color1 = sGetvideocursor.color1;
+      *color2 = sGetvideocursor.color2;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_read_crc.
+ *
+ *  Description: This function reads the hardware CRC value, which is used for
+ *				 automated testing.
+ *   parameters:
+ *          crc: Holds the crc value.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_read_crc(unsigned long *crc)
+{
+   GAL_READCRC sReadcrc;
+
+   INIT_GAL(&sReadcrc);
+   sReadcrc.dwSubfunction = GALFN_READCRC;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sReadcrc)) {
+      return 0;
+   } else {
+      *crc = sReadcrc.crc;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_read_window_crc.
+ *
+ *  Description: This function reads the hardware CRC value for a subsection
+ *				 of the display.
+ *				
+ *   parameters:
+ *       source:
+ *			  x:
+ *			  y:
+ *	      width:
+ *		 height:
+ *			crc:
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_read_window_crc(int source, unsigned short x, unsigned short y,
+		    unsigned short width, unsigned short height,
+		    int crc32, unsigned long *crc)
+{
+   GAL_READWINDOWCRC sReadwindowcrc;
+
+   INIT_GAL(&sReadwindowcrc);
+   sReadwindowcrc.dwSubfunction = GALFN_READWINDOWCRC;
+   sReadwindowcrc.source = source;
+   sReadwindowcrc.x = x;
+   sReadwindowcrc.y = y;
+   sReadwindowcrc.width = width;
+   sReadwindowcrc.height = height;
+   sReadwindowcrc.crc32 = crc32;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sReadwindowcrc)) {
+      return 0;
+   } else {
+      *crc = sReadwindowcrc.crc;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_get_macrovision_enable.
+ *
+ *  Description: This function gets the enable state of the macrovision.
+ *				
+ *   parameters:
+ *       enable: ptr holds the macrovision enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_get_macrovision_enable(int *enable)
+{
+   GAL_MACROVISIONENABLE sGetmacrovisionenable;
+
+   INIT_GAL(&sGetmacrovisionenable);
+   sGetmacrovisionenable.dwSubfunction = GALFN_GETMACROVISIONENABLE;
+
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetmacrovisionenable)) {
+      return 0;
+   } else {
+      *enable = sGetmacrovisionenable.enable;
+      return 1;
+   }
+}
+
+/*--------------------------------------------------------------------------
+ * Gal_set_macrovision_enable.
+ *
+ *  Description: This function gets the enable state of the macrovision.
+ *				
+ *   parameters:
+ *       enable: macrovision enable state.
+ *       return: '1' was returned on success otherwise '0' was returned.
+ *------------------------------------------------------------------------*/
+BOOLEAN
+Gal_set_macrovision_enable(int enable)
+{
+   GAL_MACROVISIONENABLE sSetmacrovisionenable;
+
+   INIT_GAL(&sSetmacrovisionenable);
+   sSetmacrovisionenable.dwSubfunction = GALFN_SETMACROVISIONENABLE;
+
+   sSetmacrovisionenable.enable = enable;
+   if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetmacrovisionenable)) {
+      return 0;
+   } else {
+      return 1;
+   }
+}
diff --git a/Source/DirectFB/gfxdrivers/nvidia/Makefile.am b/Source/DirectFB/gfxdrivers/nvidia/Makefile.am
new file mode 100755
index 0000000..8b495e9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/Makefile.am
@@ -0,0 +1,45 @@
+## Makefile.am for DirectFB/src/core/gfxcards/nvidia
+
+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
+
+nvidia_LTLIBRARIES = libdirectfb_nvidia.la
+
+if BUILD_STATIC
+nvidia_DATA = $(nvidia_LTLIBRARIES:.la=.o)
+endif
+
+nvidiadir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_nvidia_la_SOURCES = \
+	nvidia.c			\
+	nvidia_state.c		\
+	nvidia_2d.c		\
+	nvidia_3d.c		\
+	nvidia_primary.c	\
+	nvidia_overlay.c	\
+	nvidia.h			\
+	nvidia_regs.h		\
+	nvidia_accel.h		\
+	nvidia_objects.h	\
+	nvidia_state.h		\
+	nvidia_2d.h		\
+	nvidia_3d.h
+
+libdirectfb_nvidia_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_nvidia_la_LIBADD = -lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/gfxdrivers/nvidia/Makefile.in b/Source/DirectFB/gfxdrivers/nvidia/Makefile.in
new file mode 100755
index 0000000..472373c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/Makefile.in
@@ -0,0 +1,614 @@
+# 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/nvidia
+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)$(nvidiadir)" "$(DESTDIR)$(nvidiadir)"
+nvidiaLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nvidia_LTLIBRARIES)
+libdirectfb_nvidia_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_nvidia_la_OBJECTS = nvidia.lo nvidia_state.lo \
+	nvidia_2d.lo nvidia_3d.lo nvidia_primary.lo nvidia_overlay.lo
+libdirectfb_nvidia_la_OBJECTS = $(am_libdirectfb_nvidia_la_OBJECTS)
+libdirectfb_nvidia_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_nvidia_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_nvidia_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_nvidia_la_SOURCES)
+nvidiaDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(nvidia_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
+
+nvidia_LTLIBRARIES = libdirectfb_nvidia.la
+@BUILD_STATIC_TRUE@nvidia_DATA = $(nvidia_LTLIBRARIES:.la=.o)
+nvidiadir = $(MODULEDIR)/gfxdrivers
+libdirectfb_nvidia_la_SOURCES = \
+	nvidia.c			\
+	nvidia_state.c		\
+	nvidia_2d.c		\
+	nvidia_3d.c		\
+	nvidia_primary.c	\
+	nvidia_overlay.c	\
+	nvidia.h			\
+	nvidia_regs.h		\
+	nvidia_accel.h		\
+	nvidia_objects.h	\
+	nvidia_state.h		\
+	nvidia_2d.h		\
+	nvidia_3d.h
+
+libdirectfb_nvidia_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_nvidia_la_LIBADD = -lm \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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/nvidia/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/nvidia/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-nvidiaLTLIBRARIES: $(nvidia_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nvidiadir)" || $(MKDIR_P) "$(DESTDIR)$(nvidiadir)"
+	@list='$(nvidia_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(nvidiaLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nvidiadir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(nvidiaLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nvidiadir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nvidiaLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nvidia_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(nvidiadir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(nvidiadir)/$$p"; \
+	done
+
+clean-nvidiaLTLIBRARIES:
+	-test -z "$(nvidia_LTLIBRARIES)" || rm -f $(nvidia_LTLIBRARIES)
+	@list='$(nvidia_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_nvidia.la: $(libdirectfb_nvidia_la_OBJECTS) $(libdirectfb_nvidia_la_DEPENDENCIES) 
+	$(libdirectfb_nvidia_la_LINK) -rpath $(nvidiadir) $(libdirectfb_nvidia_la_OBJECTS) $(libdirectfb_nvidia_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia_2d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia_3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia_primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia_state.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-nvidiaDATA: $(nvidia_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(nvidiadir)" || $(MKDIR_P) "$(DESTDIR)$(nvidiadir)"
+	@list='$(nvidia_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(nvidiaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(nvidiadir)/$$f'"; \
+	  $(nvidiaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(nvidiadir)/$$f"; \
+	done
+
+uninstall-nvidiaDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nvidia_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(nvidiadir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(nvidiadir)/$$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)$(nvidiadir)" "$(DESTDIR)$(nvidiadir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nvidiaLTLIBRARIES \
+	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-nvidiaDATA install-nvidiaLTLIBRARIES
+
+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-nvidiaDATA uninstall-nvidiaLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nvidiaLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-nvidiaDATA install-nvidiaLTLIBRARIES 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-nvidiaDATA \
+	uninstall-nvidiaLTLIBRARIES
+
+%.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/nvidia/nvidia.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia.c
new file mode 100755
index 0000000..6ecb17f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia.c
@@ -0,0 +1,2046 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/system.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/palette.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( nvidia )
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+#include "nvidia_objects.h"
+#include "nvidia_state.h"
+#include "nvidia_2d.h"
+#include "nvidia_3d.h"
+
+
+/* Riva TNT */
+#define NV4_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define NV4_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | \
+                DFXL_FILLTRIANGLE  | DFXL_DRAWLINE)
+
+#define NV4_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL | \
+                DSBLIT_DEINTERLACE)
+
+#define NV4_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES)
+
+/* Riva TNT2 */
+#define NV5_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define NV5_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | \
+                DFXL_FILLTRIANGLE  | DFXL_DRAWLINE)
+
+#define NV5_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL | \
+                DSBLIT_COLORIZE         | DSBLIT_DEINTERLACE)
+
+#define NV5_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES)
+
+/* GeForce1/GeForce2/GeForce4 */
+#define NV10_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define NV10_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | \
+                DFXL_FILLTRIANGLE  | DFXL_DRAWLINE)
+
+#define NV10_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL | \
+                DSBLIT_COLORIZE         | DSBLIT_SRC_PREMULTCOLOR   | \
+                DSBLIT_DEINTERLACE)
+
+#define NV10_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES)
+
+/* GeForce3/GeForce4Ti */
+#define NV20_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define NV20_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | \
+                DFXL_FILLTRIANGLE  | DFXL_DRAWLINE)
+
+#define NV20_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL | \
+                DSBLIT_COLORIZE         | DSBLIT_SRC_PREMULTCOLOR   | \
+                DSBLIT_DEINTERLACE)
+
+#define NV20_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT)
+               
+/* GeForceFX */
+#define NV30_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define NV30_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | \
+                DFXL_FILLTRIANGLE  | DFXL_DRAWLINE)
+
+#define NV30_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_NOFX)
+
+#define NV30_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT)
+
+
+#define DSBLIT_MODULATE_ALPHA \
+     (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL)
+
+#define DSBLIT_MODULATE_COLOR \
+     (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR)
+
+#define DSBLIT_MODULATE       \
+     (DSBLIT_MODULATE_ALPHA | DSBLIT_MODULATE_COLOR)
+
+
+
+
+static void nvAfterSetVar( void *driver_data,
+                           void *device_data )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) device_data;
+     volatile u8      *mmio  = nvdrv->mmio_base;
+     int               i;
+
+     nv_waitidle( nvdrv, nvdev );
+     
+     /* reconfigure PFIFO for selected mode (DMA/PIO) */
+     nv_out32( mmio, PFIFO_CACHES, PFIFO_CACHES_REASSIGN_DISABLED );
+     if (nvdev->use_dma) {
+          nv_out32( mmio, PFIFO_MODE, PFIFO_MODE_CHANNEL_0_DMA );
+          nv_out32( mmio, PFIFO_NEXT_CHANNEL, PFIFO_NEXT_CHANNEL_MODE_DMA );
+     } else {
+          nv_out32( mmio, PFIFO_MODE, PFIFO_MODE_CHANNEL_0_PIO );
+          nv_out32( mmio, PFIFO_NEXT_CHANNEL, PFIFO_NEXT_CHANNEL_MODE_PIO );
+     }
+     nv_out32( mmio, PFIFO_CACHE1_PUSH0, PFIFO_CACHE1_PULL1_ENGINE_SW );
+     nv_out32( mmio, PFIFO_CACHE1_PULL0, PFIFO_CACHE1_PULL0_ACCESS_DISABLED );
+     if (nvdev->use_dma) {
+          nv_out32( mmio, PFIFO_CACHE1_PUSH1, PFIFO_CACHE1_PUSH1_MODE_DMA );
+     } else {
+          nv_out32( mmio, PFIFO_CACHE1_PUSH1, PFIFO_CACHE1_PUSH1_MODE_PIO );
+     }
+     nv_out32( mmio, PFIFO_CACHE1_DMA_PUT, 0 );
+     nv_out32( mmio, PFIFO_CACHE1_DMA_GET, 0 );
+     if (nvdev->use_dma) {
+          nv_out32( mmio, PFIFO_CACHE1_DMA_INSTANCE, ADDR_DMA_OUT );
+     } else {
+          nv_out32( mmio, PFIFO_CACHE1_DMA_INSTANCE, 0 );
+     }
+     nv_out32( mmio, PFIFO_CACHE0_PUSH0, PFIFO_CACHE0_PUSH0_ACCESS_DISABLED );
+     nv_out32( mmio, PFIFO_CACHE0_PULL0, PFIFO_CACHE0_PULL0_ACCESS_DISABLED );
+     nv_out32( mmio, PFIFO_RAMHT, 0x00000100             |
+                                  PFIFO_RAMHT_SIZE_4K    |
+                                  PFIFO_RAMHT_SEARCH_128 );
+     nv_out32( mmio, PFIFO_RAMFC, 0x00000110 );
+     nv_out32( mmio, PFIFO_RAMRO, 0x00000112 | PFIFO_RAMRO_SIZE_512 );
+     nv_out32( mmio, PFIFO_SIZE, 0x0000FFFF );
+     nv_out32( mmio, PFIFO_CACHE1_HASH, 0x0000FFFF );
+     nv_out32( mmio, PFIFO_INTR_EN, PFIFO_INTR_EN_DISABLED );
+     nv_out32( mmio, PFIFO_INTR, PFIFO_INTR_RESET );
+     nv_out32( mmio, PFIFO_CACHE0_PULL1, PFIFO_CACHE0_PULL1_ENGINE_GRAPHICS );
+     if (nvdev->use_dma) {
+          if (nvdev->use_agp) {
+               nv_out32( mmio, PFIFO_CACHE1_DMA_CTL, 
+                                        PFIFO_CACHE1_DMA_CTL_PAGE_TABLE_PRESENT |
+                                        PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY_LINEAR  |
+                                        PFIFO_CACHE1_DMA_CTL_TARGET_NODE_AGP );
+          } else {
+               nv_out32( mmio, PFIFO_CACHE1_DMA_CTL,
+                                        PFIFO_CACHE1_DMA_CTL_PAGE_TABLE_PRESENT |
+                                        PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY_LINEAR  |
+                                        PFIFO_CACHE1_DMA_CTL_TARGET_NODE_NVM );
+          }
+          nv_out32( mmio, PFIFO_CACHE1_DMA_LIMIT, nvdev->dma_size - 4 );
+          nv_out32( mmio, PFIFO_CACHE1_ENGINE, PFIFO_CACHE1_ENGINE_0_SW );
+#ifdef WORDS_BIGENDIAN
+          nv_out32( mmio, PFIFO_CACHE1_DMA_FETCH,
+                                        PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
+                                        PFIFO_CACHE1_DMA_FETCH_MAX_REQS_15    |
+                                        PFIFO_CACHE1_BIG_ENDIAN );
+#else
+          nv_out32( mmio, PFIFO_CACHE1_DMA_FETCH,
+                                        PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
+                                        PFIFO_CACHE1_DMA_FETCH_MAX_REQS_15    |
+                                        PFIFO_CACHE1_LITTLE_ENDIAN );
+#endif
+          nv_out32( mmio, PFIFO_CACHE1_DMA_PUSH, 
+                                        PFIFO_CACHE1_DMA_PUSH_ACCESS_ENABLED );
+     } else {
+          nv_out32( mmio, PFIFO_CACHE1_DMA_PUSH, 
+                                        PFIFO_CACHE1_DMA_PUSH_ACCESS_DISABLED );
+     }
+     nv_out32( mmio, PFIFO_CACHE1_PUSH0, PFIFO_CACHE1_PUSH0_ACCESS_ENABLED );
+     nv_out32( mmio, PFIFO_CACHE1_PULL0, PFIFO_CACHE1_PULL0_ACCESS_ENABLED );
+     nv_out32( mmio, PFIFO_CACHE1_PULL1, PFIFO_CACHE1_PULL1_ENGINE_GRAPHICS );
+     nv_out32( mmio, PFIFO_CACHES, PFIFO_CACHES_REASSIGN_ENABLED );
+     nv_out32( mmio, PFIFO_INTR_EN, PFIFO_INTR_EN_CACHE_ERROR_ENABLED );
+
+     if (nvdev->arch == NV_ARCH_10) {
+          nv_out32( mmio, PGRAPH_DEBUG_1, 0x00118701 );
+          nv_out32( mmio, PGRAPH_DEBUG_2, 0x24F82AD9 );
+
+          for (i = 0; i < 8; i++) {
+               nv_out32( mmio, NV10_PGRAPH_WINDOWCLIP_HORIZONTAL+i*4, 0x07FF0800 );
+               nv_out32( mmio, NV10_PGRAPH_WINDOWCLIP_VERTICAL  +i*4, 0x07FF0800 );
+          }
+
+          nv_out32( mmio, NV10_PGRAPH_XFMODE0, 0x10000000 );
+          nv_out32( mmio, NV10_PGRAPH_XFMODE1, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006740 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006750 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x40000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x40000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x40000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x40000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006760 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006770 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006780 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x000067A0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006AB0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006AC0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006C10 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xBF800000 );
+
+          for (i = 0; i < 8; i++) {
+               nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x7030+i*16 );
+               nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x7149F2CA );
+          }
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006A80 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006AA0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00000040 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000005 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006400 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x4B7FFFFF );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006410 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006420 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x00006430 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x000064C0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x477FFFFF );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x3F800000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x000064D0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC5000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x000064E0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC4FFF000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0xC4FFF000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_PIPE_ADDRESS, 0x000064F0 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+          nv_out32( mmio, NV10_PGRAPH_PIPE_DATA, 0x00000000 );
+
+          nv_out32( mmio, NV10_PGRAPH_XFMODE0, 0x30000000 );
+          nv_out32( mmio, NV10_PGRAPH_XFMODE1, 0x00000004 );
+          nv_out32( mmio, NV10_PGRAPH_GLOBALSTATE0, 0x10000000 );
+          nv_out32( mmio, NV10_PGRAPH_GLOBALSTATE1, 0x00000000 );
+     }
+     
+     nvdev->dma_max   = nvdev->dma_size/4 - 1;
+     nvdev->dma_cur   = 0;
+     nvdev->dma_free  = nvdev->dma_max;
+     nvdev->dma_put   = 0;
+     nvdev->dma_get   = 0;
+     nvdev->fifo_free = 0;
+}
+
+static void nvEngineReset( void *drv, void *dev )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     int               i;
+
+     /* reput objects into subchannels */
+     for (i = 0; i < 8; i++) {
+          nv_assign_object( nvdrv, nvdev, i, 
+                            nvdev->subchannel_object[i], true );
+     }
+
+     nvdev->set        = 0;
+     nvdev->dst_format = DSPF_UNKNOWN;
+     nvdev->dst_pitch  = 0;
+     nvdev->src_pitch  = 0;
+     nvdev->beta1_set  = false;
+     nvdev->beta4_set  = false;
+}
+
+static DFBResult nvEngineSync( void *drv, void *dev )
+{
+     nv_waitidle( (NVidiaDriverData*)drv, (NVidiaDeviceData*)dev );
+
+     return DFB_OK;
+}
+
+static void nvFlushTextureCache( void *drv, void *dev )
+{
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+
+     /* invalidate source texture */
+     nvdev->set &= ~SMF_SOURCE_TEXTURE;
+}
+
+static void nvEmitCommands( void *drv, void *dev )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     
+     if (nvdev->use_dma)
+          nv_emitdma( nvdrv, nvdev );
+}
+
+static void nv4CheckState( void *drv, void *dev,
+                           CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDeviceData *nvdev       = (NVidiaDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+
+     switch (destination->config.format) { 
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB332:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel != DFXL_BLIT || state->blittingflags ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) ||
+                        state->blittingflags != DSBLIT_NOFX     ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (accel & (DFXL_FILLTRIANGLE | DFXL_DRAWLINE) ||
+                        state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* check unsupported blitting flags */
+          if (accel & ~NV4_SUPPORTED_BLITTINGFUNCTIONS ||
+              state->blittingflags & ~NV4_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          if (accel == DFXL_TEXTRIANGLES) {
+               u32 size = 1 << (direct_log2(source->config.size.w) +
+                                direct_log2(source->config.size.h));
+               
+               if (size > nvdev->max_texture_size)
+                    return;
+          } 
+          else {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+                    if (state->src_blend != DSBF_SRCALPHA   ||
+                        state->dst_blend != DSBF_INVSRCALPHA)
+                         return;
+               }
+               if (state->render_options & DSRO_MATRIX &&
+                  (state->matrix[0] < 0 || state->matrix[1] ||
+                   state->matrix[3] || state->matrix[4] < 0))
+                    return;
+          }
+
+          switch (source->config.format) { 
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (destination->config.format != source->config.format ||
+                        !dfb_palette_equal( source->palette,
+                                            destination->palette ))
+                         return;
+                    break;
+                    
+               case DSPF_A8:
+               case DSPF_RGB332:
+                    if (destination->config.format != source->config.format)
+                         return;
+                    break;
+               
+               case DSPF_RGB555:     
+               case DSPF_ARGB1555:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    break;
+
+               case DSPF_RGB16:
+                    switch (accel) {
+                         case DFXL_BLIT:
+                              if (state->blittingflags != DSBLIT_NOFX ||
+                                  destination->config.format  != DSPF_RGB16)
+                                   return;
+                              break;
+                         case DFXL_STRETCHBLIT:
+                              return;
+                         default:
+                              break;
+                    }
+                    break;
+
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (accel == DFXL_TEXTRIANGLES)
+                         return;
+                    break;
+
+               default:
+                    return;
+          }
+
+          state->accel |= accel;
+     }
+     else {
+          /* check unsupported drawing flags */
+          if (accel & ~NV4_SUPPORTED_DRAWINGFUNCTIONS ||
+              state->drawingflags & ~NV4_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          state->accel |= NV4_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+}
+
+static void nv5CheckState( void *drv, void *dev,
+                           CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDeviceData *nvdev       = (NVidiaDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+
+     switch (destination->config.format) {
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB332:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel != DFXL_BLIT || state->blittingflags ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) ||
+                        state->blittingflags != DSBLIT_NOFX     ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (accel & (DFXL_FILLTRIANGLE | DFXL_DRAWLINE) ||
+                        state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* check unsupported blitting flags */
+          if (accel & ~NV5_SUPPORTED_BLITTINGFUNCTIONS ||
+              state->blittingflags & ~NV5_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          if (accel == DFXL_TEXTRIANGLES) {
+               u32 size = 1 << (direct_log2(source->config.size.w) +
+                                direct_log2(source->config.size.h));
+               
+               if (size > nvdev->max_texture_size)
+                    return;
+          }
+          else {
+               if (state->blittingflags & DSBLIT_MODULATE) {
+                    if (state->blittingflags & DSBLIT_MODULATE_ALPHA &&
+                        state->blittingflags & DSBLIT_MODULATE_COLOR)
+                         return;
+               
+                    if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+                         if (state->src_blend != DSBF_SRCALPHA  || 
+                             state->dst_blend != DSBF_INVSRCALPHA)
+                              return;
+                    }
+               }
+               if (state->render_options & DSRO_MATRIX &&
+                  (state->matrix[0] < 0 || state->matrix[1] ||
+                   state->matrix[3] || state->matrix[4] < 0))
+                    return;
+          }
+
+          switch (source->config.format) {
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (destination->config.format != source->config.format ||
+                        /*state->src.buffer->policy == CSP_SYSTEMONLY ||*/
+                        !dfb_palette_equal( source->palette,
+                                            destination->palette ))
+                         return;
+                    break;
+                    
+               case DSPF_A8:
+               case DSPF_RGB332:
+                    if (destination->config.format != source->config.format /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    /* disable host-to-video blit for simple blits */
+                    /*if (state->src.buffer->policy == CSP_SYSTEMONLY &&
+                        accel == DFXL_BLIT && !state->blittingflags &&
+                        source->config.format == destination->config.format)
+                         return;*/
+                    break;
+
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               default:
+                    return;
+          }
+
+          state->accel |= accel;
+     }
+     else {
+          /* check unsupported drawing flags */
+          if (accel & ~NV5_SUPPORTED_DRAWINGFUNCTIONS ||
+              state->drawingflags & ~NV5_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          state->accel |= NV5_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+}
+
+static void nv10CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDeviceData *nvdev       = (NVidiaDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+
+     switch (destination->config.format) {
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB332:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel != DFXL_BLIT || state->blittingflags ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) ||
+                        state->blittingflags != DSBLIT_NOFX     ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (accel & (DFXL_FILLTRIANGLE | DFXL_DRAWLINE) ||
+                        state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* check unsupported blitting flags */
+          if (accel & ~NV10_SUPPORTED_BLITTINGFUNCTIONS ||
+              state->blittingflags & ~NV10_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          if (accel == DFXL_TEXTRIANGLES) {
+               u32 size = 1 << (direct_log2(source->config.size.w) + 
+                                direct_log2(source->config.size.h));
+               
+               if (size > nvdev->max_texture_size)
+                    return;
+          } 
+          else {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+                    if (state->blittingflags & DSBLIT_MODULATE_COLOR) {
+                         if (source->config.format == DSPF_ARGB &&
+                             state->src_blend != DSBF_ONE)
+                              return;
+                    }
+
+                    if (state->src_blend != DSBF_ONE &&
+                        state->src_blend != DSBF_SRCALPHA)
+                         return;
+
+                    if (state->dst_blend != DSBF_INVSRCALPHA)
+                         return;
+               }
+               
+               if (state->render_options & DSRO_MATRIX &&
+                  (state->matrix[0] < 0 || state->matrix[1] ||
+                   state->matrix[3] || state->matrix[4] < 0))
+                    return;
+          }
+
+          switch (source->config.format) {
+               case DSPF_A8:
+                    if (DFB_BYTES_PER_PIXEL(destination->config.format) != 4 /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (destination->config.format != source->config.format ||
+                        /*state->src.buffer->policy == CSP_SYSTEMONLY ||*/
+                        !dfb_palette_equal( source->palette,
+                                            destination->palette ))
+                         return;
+                    break;
+                    
+               case DSPF_RGB332:
+                    if (destination->config.format != source->config.format /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    /* disable host-to-video blit for simple blits */
+                    /*if (state->src.buffer->policy == CSP_SYSTEMONLY &&
+                        accel == DFXL_BLIT && !state->blittingflags &&
+                        source->config.format == destination->config.format)
+                         return;*/
+                    break;
+
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               default:
+                    return;
+          }
+
+          state->accel |= accel;
+     }
+     else {
+          /* check unsupported drawing flags */
+          if (accel & ~NV10_SUPPORTED_DRAWINGFUNCTIONS ||
+              state->drawingflags & ~NV10_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          state->accel |= NV10_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+}
+
+static void nv20CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     CoreSurface *destination = state->destination;
+     CoreSurface *source      = state->source;
+
+     switch (destination->config.format) {
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB332:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (state->blittingflags != DSBLIT_NOFX  ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (accel & ~(DFXL_BLIT | DFXL_STRETCHBLIT) ||
+                        state->blittingflags != DSBLIT_NOFX     ||
+                        source->config.format != destination->config.format)
+                         return;
+               } else {
+                    if (accel & (DFXL_FILLTRIANGLE | DFXL_DRAWLINE) ||
+                        state->drawingflags != DSDRAW_NOFX)
+                         return;
+               }
+               break;
+
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* check unsupported blitting functions/flags */
+          if (accel & ~NV20_SUPPORTED_BLITTINGFUNCTIONS ||
+              state->blittingflags & ~NV20_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) { 
+               if (state->blittingflags & DSBLIT_MODULATE_COLOR) {
+                    if (source->config.format == DSPF_ARGB && state->src_blend != DSBF_ONE)
+                         return;
+               }
+
+               if (state->src_blend != DSBF_ONE &&
+                   state->src_blend != DSBF_SRCALPHA)
+                    return;
+                    
+               if (state->dst_blend != DSBF_INVSRCALPHA)
+                    return;
+          }
+          
+          if (state->render_options & DSRO_MATRIX &&
+             (state->matrix[0] < 0 || state->matrix[1] ||
+              state->matrix[3] || state->matrix[4] < 0))
+                    return;
+
+          switch (source->config.format) {
+               case DSPF_A8:
+                    /*if (state->src.buffer->policy == CSP_SYSTEMONLY)
+                         return;*/
+                    break;
+
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (destination->config.format != source->config.format ||
+                        /*state->src.buffer->policy == CSP_SYSTEMONLY ||*/
+                        !dfb_palette_equal( source->palette,
+                                            destination->palette ))
+                         return;
+                    break;
+                    
+               case DSPF_RGB332:
+                    if (destination->config.format != source->config.format /*||
+                        state->src.buffer->policy == CSP_SYSTEMONLY*/)
+                         return;
+                    break;
+
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    /* disable host-to-video blit for simple blits */
+                    /*if (state->src.buffer->policy == CSP_SYSTEMONLY &&
+                        accel == DFXL_BLIT && !state->blittingflags &&
+                        source->config.format == destination->config.format)
+                         return;*/
+                    break;
+
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    /*if (state->src.buffer->policy == CSP_SYSTEMONLY)
+                         return;*/
+                    break;
+
+               default:
+                    return;
+          }
+
+          state->accel |= accel;
+     }
+     else {
+          /* check unsupported drawing flags */
+          if (accel & ~NV20_SUPPORTED_DRAWINGFUNCTIONS ||
+              state->drawingflags & ~NV20_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->src_blend != DSBF_SRCALPHA  &&
+              state->dst_blend != DSBF_INVSRCALPHA)
+               return;
+
+          state->accel |= NV20_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+}
+
+static void nv30CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     CoreSurface *destination = state->destination;
+     CoreSurface *source      = state->source;
+
+     switch (destination->config.format) {
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB332:
+               if (DFB_DRAWING_FUNCTION( accel ) &&
+                   state->drawingflags != DSDRAW_NOFX)
+                    return;
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (accel & (DFXL_FILLTRIANGLE | DFXL_DRAWLINE) ||
+                   state->drawingflags != DSDRAW_NOFX)
+                    return;
+               break;
+
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* check unsupported blitting functions/flags */
+          if (accel & ~NV30_SUPPORTED_BLITTINGFUNCTIONS ||
+              state->blittingflags & ~NV30_SUPPORTED_BLITTINGFLAGS)
+               return;
+               
+          if (state->render_options & DSRO_MATRIX &&
+             (state->matrix[0] != 0x10000 || state->matrix[1] ||
+              state->matrix[3] || state->matrix[4] != 0x10000))
+               return;
+
+          switch (source->config.format) {
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (!dfb_palette_equal( source->palette,
+                                            destination->palette ))
+                         return;
+               case DSPF_A8:
+               case DSPF_RGB332:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (/*state->src.buffer->policy == CSP_SYSTEMONLY ||*/
+                        source->config.format != destination->config.format)
+                         return;
+                    break;
+
+               default:
+                    return;
+          }
+
+          state->accel |= accel;
+     }
+     else {
+          /* check unsupported drawing flags */
+          if (accel & ~NV30_SUPPORTED_DRAWINGFUNCTIONS ||
+              state->drawingflags & ~NV30_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->src_blend != DSBF_SRCALPHA  &&
+              state->dst_blend != DSBF_INVSRCALPHA)
+               return;
+
+          state->accel |= NV30_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+}
+
+#define M_IDENTITY(m) ((m)[0] == 0x10000 && (m)[1] == 0 && (m)[2] == 0 && \
+                       (m)[3] == 0 && (m)[4] == 0x10000 && (m)[5] == 0)
+
+static void nv4SetState( void *drv, void *dev,
+                         GraphicsDeviceFuncs *funcs,
+                         CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+
+     nvdev->set &= ~state->mod_hw;
+     if (state->mod_hw & SMF_COLOR)
+          nvdev->set &= ~(SMF_DRAWING_COLOR | SMF_BLITTING_COLOR);
+
+     nv_set_destination( nvdrv, nvdev, state );
+     nv_set_clip( nvdrv, nvdev, state );
+     
+     if (state->render_options & DSRO_MATRIX && !M_IDENTITY(state->matrix))
+          nvdev->matrix = state->matrix;
+     else
+          nvdev->matrix = NULL;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               nv_set_drawing_color( nvdrv, nvdev, state );
+               if (state->drawingflags & DSDRAW_BLEND)
+                    nv_set_blend_function( nvdrv, nvdev, state );
+               nv_set_drawingflags( nvdrv, nvdev, state );
+               
+               if ((state->drawingflags & DSDRAW_BLEND || nvdev->matrix) && nvdev->enabled_3d) {
+                    nvdev->state3d[0].modified = true;
+
+                    funcs->FillRectangle = nvFillRectangle3D;
+                    funcs->FillTriangle  = nvFillTriangle3D;
+                    funcs->DrawRectangle = nvDrawRectangle3D;
+                    funcs->DrawLine      = nvDrawLine3D;
+               } else {
+                    funcs->FillRectangle = nvFillRectangle2D;
+                    funcs->FillTriangle  = nvFillTriangle2D;
+                    funcs->DrawRectangle = nvDrawRectangle2D;
+                    funcs->DrawLine      = nvDrawLine2D;
+               }
+
+               state->set = DFXL_FILLRECTANGLE |
+                            DFXL_FILLTRIANGLE  |
+                            DFXL_DRAWRECTANGLE |
+                            DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:
+               nv_set_source( nvdrv, nvdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_ALPHA) {
+                    nv_set_blend_function( nvdrv, nvdev, state );
+                    nv_set_blitting_color( nvdrv, nvdev, state );
+               }
+
+               nv_set_blittingflags( nvdrv, nvdev, state );
+               
+               if (accel == DFXL_TEXTRIANGLES) {
+                    if (nvdev->src_texture != state->src.buffer)
+                         nvdev->set &= ~SMF_SOURCE_TEXTURE;
+                    
+                    nvdev->src_texture = state->src.buffer; 
+                    nvdev->state3d[1].modified = true;
+                    
+                    state->set = DFXL_TEXTRIANGLES;
+               } else {
+                    state->set = DFXL_BLIT |
+                                 DFXL_STRETCHBLIT;
+               }
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static void nv5SetState( void *drv, void *dev,
+                         GraphicsDeviceFuncs *funcs,
+                         CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+     
+     nvdev->set &= ~state->mod_hw;
+     if (state->mod_hw & SMF_COLOR)
+          nvdev->set &= ~(SMF_DRAWING_COLOR | SMF_BLITTING_COLOR);
+
+     nv_set_destination( nvdrv, nvdev, state );
+     nv_set_clip( nvdrv, nvdev, state );
+     
+     if (state->render_options & DSRO_MATRIX && !M_IDENTITY(state->matrix))
+          nvdev->matrix = state->matrix;
+     else
+          nvdev->matrix = NULL;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               nv_set_drawing_color( nvdrv, nvdev, state ); 
+               if (state->drawingflags & DSDRAW_BLEND)
+                    nv_set_blend_function( nvdrv, nvdev, state );
+               nv_set_drawingflags( nvdrv, nvdev, state );
+               
+               if ((state->drawingflags & DSDRAW_BLEND || nvdev->matrix) && nvdev->enabled_3d) {
+                    nvdev->state3d[0].modified = true;
+
+                    funcs->FillRectangle = nvFillRectangle3D;
+                    funcs->FillTriangle  = nvFillTriangle3D;
+                    funcs->DrawRectangle = nvDrawRectangle3D;
+                    funcs->DrawLine      = nvDrawLine3D;
+               } else {
+                    funcs->FillRectangle = nvFillRectangle2D;
+                    funcs->FillTriangle  = nvFillTriangle2D;
+                    funcs->DrawRectangle = nvDrawRectangle2D;
+                    funcs->DrawLine      = nvDrawLine2D;
+               }
+
+               state->set = DFXL_FILLRECTANGLE |
+                            DFXL_FILLTRIANGLE  |
+                            DFXL_DRAWRECTANGLE |
+                            DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:
+               nv_set_source( nvdrv, nvdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE) {
+                    nv_set_blend_function( nvdrv, nvdev, state );
+                    nv_set_blitting_color( nvdrv, nvdev, state );
+               }
+
+               nv_set_blittingflags( nvdrv, nvdev, state );
+               
+               if (accel == DFXL_TEXTRIANGLES) {
+                    if (nvdev->src_texture != state->src.buffer)
+                         nvdev->set &= ~SMF_SOURCE_TEXTURE;
+                    
+                    nvdev->src_texture = state->src.buffer; 
+                    nvdev->state3d[1].modified = true;
+                    
+                    state->set = DFXL_TEXTRIANGLES;
+               } else {
+                    if (nvdev->src_system) {
+                         funcs->Blit        = nvBlitFromCPU;
+                         funcs->StretchBlit = nvStretchBlitFromCPU;
+                    } else {
+                         funcs->Blit        = nvBlit;
+                         funcs->StretchBlit = nvStretchBlit;
+                    }
+                    
+                    state->set = DFXL_BLIT |
+                                 DFXL_STRETCHBLIT;
+               }
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static void nv10SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+
+     nvdev->set &= ~state->mod_hw;
+     if (state->mod_hw & SMF_COLOR)
+          nvdev->set &= ~(SMF_DRAWING_COLOR | SMF_BLITTING_COLOR);
+
+     nv_set_destination( nvdrv, nvdev, state );
+     nv_set_clip( nvdrv, nvdev, state );
+     
+     if (state->render_options & DSRO_MATRIX && !M_IDENTITY(state->matrix))
+          nvdev->matrix = state->matrix;
+     else
+          nvdev->matrix = NULL;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               nv_set_drawing_color( nvdrv, nvdev, state );
+               if (state->drawingflags & DSDRAW_BLEND)
+                    nv_set_blend_function( nvdrv, nvdev, state );
+               nv_set_drawingflags( nvdrv, nvdev, state );
+               
+               if ((state->drawingflags & DSDRAW_BLEND || nvdev->matrix) && nvdev->enabled_3d) { 
+                    nvdev->state3d[0].modified = true;
+
+                    funcs->FillRectangle = nvFillRectangle3D;
+                    funcs->FillTriangle  = nvFillTriangle3D;
+                    funcs->DrawRectangle = nvDrawRectangle3D;
+                    funcs->DrawLine      = nvDrawLine3D;
+               } else {
+                    funcs->FillRectangle = nvFillRectangle2D;
+                    funcs->FillTriangle  = nvFillTriangle2D;
+                    funcs->DrawRectangle = nvDrawRectangle2D;
+                    funcs->DrawLine      = nvDrawLine2D;
+               }
+
+               state->set = DFXL_FILLRECTANGLE |
+                            DFXL_FILLTRIANGLE  |
+                            DFXL_DRAWRECTANGLE |
+                            DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:
+               nv_set_source( nvdrv, nvdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE) {
+                    nv_set_blend_function( nvdrv, nvdev, state );
+                    nv_set_blitting_color( nvdrv, nvdev, state );
+               }
+
+               nv_set_blittingflags( nvdrv, nvdev, state );
+               
+               if (accel == DFXL_TEXTRIANGLES) { 
+                    if (nvdev->src_texture != state->src.buffer)
+                         nvdev->set &= ~SMF_SOURCE_TEXTURE;
+                    
+                    nvdev->src_texture = state->src.buffer; 
+                    nvdev->state3d[1].modified = true;
+                    
+                    state->set = DFXL_TEXTRIANGLES;
+               } else {
+                    if (nvdev->src_system) {
+                         funcs->Blit        = nvBlitFromCPU;
+                         funcs->StretchBlit = nvStretchBlitFromCPU;
+                    } else {
+                         funcs->Blit        = nvBlit;
+                         funcs->StretchBlit = nvStretchBlit;
+                    }
+                    
+                    state->set = DFXL_BLIT |
+                                 DFXL_STRETCHBLIT;
+               }
+               break;
+          
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static void nv20SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+
+     nvdev->set &= ~state->mod_hw;
+     if (state->mod_hw & SMF_COLOR)
+          nvdev->set &= ~(SMF_DRAWING_COLOR | SMF_BLITTING_COLOR);
+
+     nv_set_destination( nvdrv, nvdev, state );
+     nv_set_clip( nvdrv, nvdev, state );
+     
+     if (state->render_options & DSRO_MATRIX && !M_IDENTITY(state->matrix))
+          nvdev->matrix = state->matrix;
+     else
+          nvdev->matrix = NULL;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               nv_set_drawing_color( nvdrv, nvdev, state );
+               nv_set_drawingflags( nvdrv, nvdev, state );
+
+               state->set = DFXL_FILLRECTANGLE |
+                            DFXL_FILLTRIANGLE  |
+                            DFXL_DRAWRECTANGLE |
+                            DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               nv_set_source( nvdrv, nvdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE) {
+                    if (state->modified & SMF_SRC_BLEND)
+                         nvdev->set &= ~SMF_BLITTING_FLAGS;
+                    nv_set_blitting_color( nvdrv, nvdev, state );
+               }
+
+               nv_set_blittingflags( nvdrv, nvdev, state );
+
+               if (nvdev->src_system) {
+                    funcs->Blit        = nvBlitFromCPU;
+                    funcs->StretchBlit = nvStretchBlitFromCPU;
+               }
+               else {
+                    if (DFB_BITS_PER_PIXEL(nvdev->dst_format) == 8)
+                         nvdev->scaler_filter = SCALER_IN_FORMAT_ORIGIN_CORNER |
+                                                SCALER_IN_FORMAT_FILTER_NEAREST;
+                    else
+                         nvdev->scaler_filter = SCALER_IN_FORMAT_ORIGIN_CENTER |
+                                                SCALER_IN_FORMAT_FILTER_LINEAR;
+
+                    funcs->Blit        = nvBlit;
+                    funcs->StretchBlit = nvStretchBlit;
+               }
+
+               state->set = DFXL_BLIT |
+                            DFXL_STRETCHBLIT;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static void nv30SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+
+     nvdev->set &= ~state->mod_hw;
+     if (state->mod_hw & SMF_COLOR)
+          nvdev->set &= ~(SMF_DRAWING_COLOR | SMF_BLITTING_COLOR);
+
+     nv_set_destination( nvdrv, nvdev, state );
+     nv_set_clip( nvdrv, nvdev, state );
+
+     if (state->render_options & DSRO_MATRIX && !M_IDENTITY(state->matrix))
+          nvdev->matrix = state->matrix;
+     else
+          nvdev->matrix = NULL;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               nv_set_drawing_color( nvdrv, nvdev, state );
+               nv_set_drawingflags( nvdrv, nvdev, state );
+
+               state->set = DFXL_FILLRECTANGLE |
+                            DFXL_FILLTRIANGLE  |
+                            DFXL_DRAWRECTANGLE |
+                            DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+               nv_set_source( nvdrv, nvdev, state );
+
+               state->set = DFXL_BLIT;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_NV4:
+          case FB_ACCEL_NV5:
+          case FB_ACCEL_NV_10:
+          case FB_ACCEL_NV_20:
+          case FB_ACCEL_NV_30:
+          case FB_ACCEL_NV_40:
+               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,
+               "nVidia NV4/NV5/NV10/NV20/NV30 Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+               
+     snprintf( info->url,
+               DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+               "http://www.directfb.org" );
+               
+     snprintf( info->license,
+               DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+               "LGPL" );
+
+     info->version.major = 0;
+     info->version.minor = 6;
+
+     info->driver_data_size = sizeof(NVidiaDriverData);
+     info->device_data_size = sizeof(NVidiaDeviceData);
+}
+
+static void
+nv_find_architecture( NVidiaDriverData *nvdrv, u32 *ret_chip, u32 *ret_arch )
+{
+     unsigned int vendor_id;
+     unsigned int device_id;
+     unsigned int arch = 0;
+    
+     device_id = nv_in32( nvdrv->mmio_base, 0x00 ) >> 16; /* id:rev */
+     if (!device_id) {
+          dfb_system_get_deviceid( &vendor_id, &device_id );
+          if (vendor_id != 0x10DE) {
+               D_ERROR( "DirectFB/NVidia: Could not detect device id!\n"
+                        "     -> Please, specify the bus location of"
+                        "        the card by using the 'busid' option.\n" );
+               vendor_id = device_id = 0;
+          }
+     }
+     
+     switch (device_id & 0xFFF0) {
+          case 0x0020: /* Riva TNT/TNT2 */
+               arch = (device_id == 0x0020) ? NV_ARCH_04 : NV_ARCH_05;
+               break;
+          case 0x0100: /* GeForce */
+          case 0x0110: /* GeForce2 MX */
+          case 0x0150: /* GeForce2 GTS/Ti/Ultra */
+          case 0x0170: /* GeForce4 MX/Go */
+          case 0x0180: /* GeForce4 MX/Go AGP8X */
+          //case 0x01A0: /* GeForce2 Integrated GPU */
+          //case 0x01F0: /* GeForce4 MX Integrated GPU */
+               arch = NV_ARCH_10;
+               break;
+          case 0x0200: /* GeForce3 */
+          case 0x0250: /* GeForce4 Ti */
+          case 0x0280: /* GeForce4 Ti AGP8X */
+          case 0x02A0: /* GeForce3 Integrated GPU (XBox) */
+               arch = NV_ARCH_20;
+               break;
+          case 0x0300: /* GeForce FX 5800 */
+          case 0x0310: /* GeForce FX 5600 */
+          case 0x0320: /* GeForce FX 5200 */
+          case 0x0330: /* GeForce FX 5900 */
+          case 0x0340: /* GeForce FX 5700 */
+               arch = NV_ARCH_30;
+               break;
+          default:
+                break;
+     }
+
+     if (ret_chip)
+          *ret_chip = device_id;
+     if (ret_arch)
+          *ret_arch = arch;
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) device_data;
+     u32               arch  = 0;
+    
+     nvdrv->device      = device;
+     nvdrv->device_data = device_data;
+     
+     nvdrv->fb_base = (volatile void*) dfb_gfxcard_memory_virtual( device, 0 );
+     nvdrv->agp_base = (volatile void*) dfb_gfxcard_auxmemory_virtual( device, 0 );
+
+     nvdrv->mmio_base = (volatile void*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!nvdrv->mmio_base)
+          return DFB_IO;
+   
+     if (nvdev->use_dma) {
+          nvdrv->dma_base = nvdev->use_agp ? nvdrv->agp_base : nvdrv->fb_base;
+          nvdrv->dma_base += nvdev->dma_offset;
+     }
+
+     funcs->AfterSetVar   = nvAfterSetVar;
+     funcs->EngineReset   = nvEngineReset;
+     funcs->EngineSync    = nvEngineSync;
+     funcs->EmitCommands  = nvEmitCommands;
+     funcs->FillRectangle = nvFillRectangle2D; // dynamic
+     funcs->FillTriangle  = nvFillTriangle2D;  // dynamic
+     funcs->DrawRectangle = nvDrawRectangle2D; // dynamic
+     funcs->DrawLine      = nvDrawLine2D;      // dynamic
+     funcs->Blit          = nvBlit;            // dynamic
+
+     nv_find_architecture( nvdrv, NULL, &arch );
+
+     switch (arch) {
+          case NV_ARCH_04: 
+               funcs->FlushTextureCache = nvFlushTextureCache;
+               funcs->CheckState        = nv4CheckState;
+               funcs->SetState          = nv4SetState;
+               funcs->StretchBlit       = nvStretchBlit;
+               funcs->TextureTriangles  = nvTextureTriangles;
+               break;
+          case NV_ARCH_05:
+               funcs->FlushTextureCache = nvFlushTextureCache;
+               funcs->CheckState        = nv5CheckState;
+               funcs->SetState          = nv5SetState;
+               funcs->StretchBlit       = nvStretchBlit;
+               funcs->TextureTriangles  = nvTextureTriangles;
+               break;
+          case NV_ARCH_10:
+               funcs->FlushTextureCache = nvFlushTextureCache;
+               funcs->CheckState        = nv10CheckState;
+               funcs->SetState          = nv10SetState;
+               funcs->StretchBlit       = nvStretchBlit;
+               funcs->TextureTriangles  = nvTextureTriangles;
+               break;
+          case NV_ARCH_20:
+               funcs->CheckState        = nv20CheckState;
+               funcs->SetState          = nv20SetState;
+               funcs->StretchBlit       = nvStretchBlit;
+               break;
+          case NV_ARCH_30:
+               funcs->CheckState        = nv30CheckState;
+               funcs->SetState          = nv30SetState;
+               break;
+          default:
+               funcs->AfterSetVar       = NULL;
+               funcs->EngineReset       = NULL;
+               break;
+     }
+
+     dfb_screens_hook_primary( device, driver_data,
+                               &nvidiaPrimaryScreenFuncs,
+                               &OldPrimaryScreenFuncs,
+                               &OldPrimaryScreenDriverData );
+
+     dfb_layers_hook_primary( device, driver_data,
+                              &nvidiaPrimaryLayerFuncs,
+                              &OldPrimaryLayerFuncs,
+                              &OldPrimaryLayerDriverData );
+
+     dfb_layers_register( dfb_screens_at( DSCID_PRIMARY ),
+                          driver_data, &nvidiaOverlayFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     NVidiaDriverData *nvdrv     = (NVidiaDriverData*) driver_data;
+     NVidiaDeviceData *nvdev     = (NVidiaDeviceData*) device_data;
+     int               ram_total = dfb_system_videoram_length();
+     int               ram_used  = dfb_gfxcard_memory_length();
+     
+     nv_find_architecture( nvdrv, &nvdev->chip, &nvdev->arch );
+
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,
+               "NV%02X (%04x)", (nvdev->chip >> 4) & 0xFF, nvdev->chip );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "nVidia" );
+
+     switch (nvdev->arch) {
+          case NV_ARCH_04:
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS;
+               device_info->caps.accel    = NV4_SUPPORTED_DRAWINGFUNCTIONS |
+                                            NV4_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = NV4_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = NV4_SUPPORTED_BLITTINGFLAGS;
+               break;
+          case NV_ARCH_05:
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS /*| CCF_READSYSMEM*/;
+               device_info->caps.accel    = NV5_SUPPORTED_DRAWINGFUNCTIONS |
+                                            NV5_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = NV5_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = NV5_SUPPORTED_BLITTINGFLAGS;
+               break;
+          case NV_ARCH_10:
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS /*| CCF_READSYSMEM*/;
+               device_info->caps.accel    = NV10_SUPPORTED_DRAWINGFUNCTIONS |
+                                            NV10_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = NV10_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = NV10_SUPPORTED_BLITTINGFLAGS;
+               break;
+          case NV_ARCH_20:
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS /* | CCF_READSYSMEM*/; /* Crash reported when the flag is on. */
+               device_info->caps.accel    = NV20_SUPPORTED_DRAWINGFUNCTIONS |
+                                            NV20_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = NV20_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = NV20_SUPPORTED_BLITTINGFLAGS;
+               break;
+          case NV_ARCH_30:
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS;
+               device_info->caps.accel    = NV30_SUPPORTED_DRAWINGFUNCTIONS |
+                                            NV30_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = NV30_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = NV30_SUPPORTED_BLITTINGFLAGS;
+               break;
+          default:
+               device_info->caps.flags    = 0;
+               device_info->caps.accel    = 0;
+               device_info->caps.drawing  = 0;
+               device_info->caps.blitting = 0;
+               break;
+     }
+
+     device_info->limits.surface_byteoffset_alignment = 64;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     dfb_config->pollvsync_after = 1;
+     
+     /* GeForce3 Intergrated GPU (XBox) */
+     if (nvdev->chip == 0x02A0) {
+          nvdev->fb_offset  = (long)nvdrv->fb_base & 0x0FFFFFFF;
+          ram_total        += nvdev->fb_offset;
+     }
+     
+     nvdev->fb_size = 1 << direct_log2( ram_total );
+
+     /* skip if unsupported arch (NV40) */
+     if (!nvdev->arch)
+          return DFB_OK;
+
+     nvdev->agp_offset = dfb_gfxcard_auxmemory_physical( nvdrv->device, 0 );
+
+     if (dfb_config->dma) {
+          int offset = -1;
+          
+          if (dfb_gfxcard_auxmemory_length() >= 64*1024) {
+               offset = dfb_gfxcard_reserve_auxmemory( nvdrv->device, 64*1024 );
+               if (offset < 0) {
+                    D_ERROR( "DirectFB/NVidia: "
+                             "couldn't reserve 64Kb of agp memory!\n" );
+               }
+               else {
+                    nvdev->use_agp    = true;
+                    nvdev->use_dma    = true;
+                    nvdev->dma_size   = 64*1024;
+                    nvdev->dma_offset = offset;
+                    nvdrv->dma_base   = nvdrv->agp_base + offset; 
+               }
+          }
+          
+          if (offset < 0) {
+               int len;
+               
+               len    = 32*1024 + ((ram_used - 32*1024) & 0x1FFFF);
+               offset = dfb_gfxcard_reserve_memory( nvdrv->device, len );
+               if (offset < 0) {
+                    D_ERROR( "DirectFB/NVidia: "
+                             "couldn't reserve %d bytes of video memory!\n", len );
+               }
+               else {
+                    nvdev->use_dma    = true;
+                    nvdev->dma_size   = 32*1024;
+                    nvdev->dma_offset = offset;
+                    nvdrv->dma_base   = nvdrv->fb_base + offset;
+          
+                    ram_used -= len;
+               }
+          }
+
+          D_INFO ( "DirectFB/NVidia: DMA acceleration %s.\n",
+                   nvdev->use_dma ? "enabled" : "disabled" );
+          D_DEBUG( "DirectFB/NVidia: DMA target is %s.\n",
+                   nvdev->use_agp ? "AGP" : "NVM" );
+     }
+
+     /* reserve memory for textures/color buffers */
+     if (device_info->caps.accel & DFXL_TEXTRIANGLES) {
+          unsigned tex_size;
+          int      len, offset;
+
+          /* if we have more than 32MB of video memory, use a 1024x1024 texture */
+          if (ram_used > (32 << 20))
+               tex_size = 1024*1024;
+          /* if we have more than 16MB of video memory, use a 1024x512 texture */
+          else if (ram_used > (16 << 20))
+               tex_size = 1024*512;
+          /* otherwise use a 512x512 texture */
+          else
+               tex_size = 512*512;
+
+          len    = tex_size*2 + 8;
+          len   += (ram_used - len) & 0xFF;
+          offset = dfb_gfxcard_reserve_memory( nvdrv->device, len );
+          
+          if (offset < 0) {
+               /* if video memory allocation failed, disable 3d acceleration */
+               D_ERROR( "DirectFB/NVidia: "
+                        "couldn't reserve %d bytes of video memory!\n", len );
+               D_INFO(  "DirectFB/NVidia: 3D acceleration disabled.\n" );
+               device_info->caps.accel &= ~DFXL_TEXTRIANGLES;
+          }
+          else {
+               D_DEBUG( "DirectFB/NVidia: "
+                        "reserved %d bytes for 3D buffers at offset 0x%08x.\n",
+                         len, offset );
+               
+               nvdev->enabled_3d = true;
+               nvdev->buf_offset[0] = offset + tex_size*2; // color
+               nvdev->buf_offset[1] = offset;              // texture
+               nvdev->max_texture_size = tex_size;
+          }
+     }
+          
+     if (nvdev->enabled_3d) {
+          /* set default 3d state for drawing functions */
+          nvdev->state3d[0].modified = true;
+          nvdev->state3d[0].colorkey = 0;
+          nvdev->state3d[0].offset   = nvdev->fb_offset + nvdev->buf_offset[0];
+          nvdev->state3d[0].format   = TXTRI_FORMAT_CONTEXT_DMA_A     |
+                                       TXTRI_FORMAT_ORIGIN_ZOH_CORNER |
+                                       TXTRI_FORMAT_ORIGIN_FOH_CORNER |
+                                       TXTRI_FORMAT_COLOR_R5G6B5      |
+                                       TXTRI_FORMAT_U_WRAP            |
+                                       TXTRI_FORMAT_V_WRAP            |
+                                       0x00111000; // 2x2
+          nvdev->state3d[0].filter   = TXTRI_FILTER_TEXTUREMIN_NEAREST |
+                                       TXTRI_FILTER_TEXTUREMAG_NEAREST;
+          nvdev->state3d[0].blend    = TXTRI_BLEND_TEXTUREMAPBLEND_MODULATEALPHA |
+                                       TXTRI_BLEND_OPERATION_MUX_TALPHAMSB       |
+                                       TXTRI_BLEND_SHADEMODE_FLAT                |
+                                       TXTRI_BLEND_SRCBLEND_ONE                  |
+                                       TXTRI_BLEND_DESTBLEND_ZERO;
+          nvdev->state3d[0].control  = TXTRI_CONTROL_ALPHAFUNC_ALWAYS |
+                                       TXTRI_CONTROL_ORIGIN_CORNER    |
+                                       TXTRI_CONTROL_ZFUNC_ALWAYS     |
+                                       TXTRI_CONTROL_CULLMODE_NONE    |
+                                       TXTRI_CONTROL_Z_FORMAT_FIXED;
+          nvdev->state3d[0].fog      = 0;
+          
+          /* set default 3d state for blitting functions */
+          nvdev->state3d[1].modified = true;
+          nvdev->state3d[1].colorkey = 0;
+          nvdev->state3d[1].offset   = nvdev->fb_offset + nvdev->buf_offset[1];
+          nvdev->state3d[1].format   = TXTRI_FORMAT_CONTEXT_DMA_A     |
+                                       TXTRI_FORMAT_ORIGIN_ZOH_CORNER |
+                                       TXTRI_FORMAT_ORIGIN_FOH_CORNER |
+                                       TXTRI_FORMAT_COLOR_R5G6B5      |
+                                       TXTRI_FORMAT_U_CLAMP           |
+                                       TXTRI_FORMAT_V_CLAMP           |
+                                       0x00001000;
+          nvdev->state3d[1].filter   = TXTRI_FILTER_TEXTUREMIN_LINEAR |
+                                       TXTRI_FILTER_TEXTUREMAG_LINEAR;
+          nvdev->state3d[1].blend    = TXTRI_BLEND_TEXTUREMAPBLEND_COPY      |
+                                       TXTRI_BLEND_OPERATION_MUX_TALPHAMSB   |
+                                       TXTRI_BLEND_SHADEMODE_GOURAUD         |
+                                       TXTRI_BLEND_TEXTUREPERSPECTIVE_ENABLE |
+                                       TXTRI_BLEND_SRCBLEND_ONE              |
+                                       TXTRI_BLEND_DESTBLEND_ZERO;
+          nvdev->state3d[1].control  = TXTRI_CONTROL_ALPHAFUNC_ALWAYS |
+                                       TXTRI_CONTROL_ORIGIN_CENTER    |
+                                       TXTRI_CONTROL_ZFUNC_ALWAYS     |
+                                       TXTRI_CONTROL_CULLMODE_NONE    |
+                                       TXTRI_CONTROL_DITHER_ENABLE    |
+                                       TXTRI_CONTROL_Z_FORMAT_FIXED;
+          nvdev->state3d[1].fog      = 0;
+
+          /* clear color buffer */
+          memset( dfb_gfxcard_memory_virtual( device,
+                                              nvdev->buf_offset[0] ), 0xFF, 8 );
+     }
+
+     /* write dma objects configuration */
+     nv_store_dma( nvdrv, OBJ_DMA_IN, ADDR_DMA_IN, 0x00,
+                   DMA_FLAG_PAGE_TABLE  | DMA_FLAG_PAGE_ENTRY_LINEAR |
+                   DMA_FLAG_ACCESS_RDWR | DMA_FLAG_TARGET_NVM,
+                   nvdev->fb_size, 0x00000000, DMA_FRAME_ACCESS_RDWR );
+     
+     if (nvdev->use_dma) {
+          if (nvdev->use_agp) {
+               nv_store_dma( nvdrv, OBJ_DMA_OUT, ADDR_DMA_OUT, 0x02,
+                             DMA_FLAG_PAGE_TABLE  | DMA_FLAG_PAGE_ENTRY_LINEAR |
+                             DMA_FLAG_ACCESS_RDWR | DMA_FLAG_TARGET_AGP,
+                             nvdev->dma_size, nvdev->agp_offset+nvdev->dma_offset,
+                             DMA_FRAME_ACCESS_RDWR );
+          }
+          else {
+               nv_store_dma( nvdrv, OBJ_DMA_OUT, ADDR_DMA_OUT, 0x02,
+                             DMA_FLAG_PAGE_TABLE  | DMA_FLAG_PAGE_ENTRY_LINEAR |
+                             DMA_FLAG_ACCESS_RDWR | DMA_FLAG_TARGET_NVM,
+                             nvdev->dma_size, nvdev->fb_offset+nvdev->dma_offset,
+                             DMA_FRAME_ACCESS_RDWR );
+          }
+     }
+
+     /* write graphics objects configuration */
+     nv_store_object( nvdrv, OBJ_SURFACES2D, ADDR_SURFACES2D, 0x42, 0, 0, 0 );
+     nv_store_object( nvdrv, OBJ_CLIP, ADDR_CLIP, 0x19, 0, 0, 0 );
+     nv_store_object( nvdrv, OBJ_BETA1, ADDR_BETA1, 0x12, 0, 0, 0 );
+     nv_store_object( nvdrv, OBJ_BETA4, ADDR_BETA4, 0x72, 0, 0, 0 );
+
+     nv_store_object( nvdrv, OBJ_RECTANGLE, ADDR_RECTANGLE, 0x5E,
+                      CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY | 
+                      CTX_FLAG_PATCH, ADDR_DMA_IN, ADDR_DMA_IN );
+     nv_store_object( nvdrv, OBJ_TRIANGLE, ADDR_TRIANGLE, 0x5D,
+                      CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                      CTX_FLAG_PATCH, ADDR_DMA_IN, ADDR_DMA_IN );
+     nv_store_object( nvdrv, OBJ_LINE, ADDR_LINE, 0x5C,
+                      CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                      CTX_FLAG_PATCH, ADDR_DMA_IN, ADDR_DMA_IN );
+
+     switch (nvdev->arch)  {
+          case NV_ARCH_04:
+               nv_store_object( nvdrv, OBJ_SCREENBLT, ADDR_SCREENBLT, 0x1F,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SCALEDIMAGE, ADDR_SCALEDIMAGE, 0x37,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_COPY        | 
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_TEXTRIANGLE, ADDR_TEXTRIANGLE, 0x54,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_COPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SURFACES3D, ADDR_SURFACES3D, 0x53, 0, 0, 0 );
+               break;
+
+          case NV_ARCH_05:
+               nv_store_object( nvdrv, OBJ_SCREENBLT, ADDR_SCREENBLT, 0x5F,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_IMAGEBLT, ADDR_IMAGEBLT, 0x65,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SCALEDIMAGE, ADDR_SCALEDIMAGE, 0x63,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_STRETCHEDIMAGE, ADDR_STRETCHEDIMAGE, 0x66,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_TEXTRIANGLE, ADDR_TEXTRIANGLE, 0x54,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SURFACES3D, ADDR_SURFACES3D, 0x53, 0, 0, 0 );
+               break;
+
+          case NV_ARCH_10:
+               nv_store_object( nvdrv, OBJ_SCREENBLT, ADDR_SCREENBLT, 0x5F,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_IMAGEBLT, ADDR_IMAGEBLT, 0x65,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SCALEDIMAGE, ADDR_SCALEDIMAGE, 0x89,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_STRETCHEDIMAGE, ADDR_STRETCHEDIMAGE, 0x66,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_TEXTRIANGLE, ADDR_TEXTRIANGLE, 0x94,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SURFACES3D, ADDR_SURFACES3D, 0x93, 0, 0, 0 );
+               break;
+
+          case NV_ARCH_20:
+          case NV_ARCH_30:
+          default:
+               nv_store_object( nvdrv, OBJ_SCREENBLT, ADDR_SCREENBLT, 0x9F,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_IMAGEBLT, ADDR_IMAGEBLT, 0x65,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SCALEDIMAGE, ADDR_SCALEDIMAGE, 0x89,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_STRETCHEDIMAGE, ADDR_STRETCHEDIMAGE, 0x66,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY     |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CONVERSION_DITHER |
+                                CTX_FLAG_CTX_SURFACE0, ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_TEXTRIANGLE, ADDR_TEXTRIANGLE, 0x94,
+                                CTX_FLAG_USER_CLIP | CTX_FLAG_PATCH_SRCCOPY |
+                                CTX_FLAG_PATCH     | CTX_FLAG_CTX_SURFACE0,
+                                ADDR_DMA_IN, ADDR_DMA_IN );
+               nv_store_object( nvdrv, OBJ_SURFACES3D, ADDR_SURFACES3D, 0x93, 0, 0, 0 );
+               break;
+     }
+
+     /* assign default objects to subchannels */
+     nvdev->subchannel_object[SUBC_SURFACES2D]  = OBJ_SURFACES2D;
+     nvdev->subchannel_object[SUBC_CLIP]        = OBJ_CLIP;
+     nvdev->subchannel_object[SUBC_RECTANGLE]   = OBJ_RECTANGLE;
+     nvdev->subchannel_object[SUBC_TRIANGLE]    = OBJ_TRIANGLE;
+     nvdev->subchannel_object[SUBC_LINE]        = OBJ_LINE;
+     nvdev->subchannel_object[SUBC_SCREENBLT]   = OBJ_SCREENBLT;
+     nvdev->subchannel_object[SUBC_SCALEDIMAGE] = OBJ_SCALEDIMAGE;
+     nvdev->subchannel_object[SUBC_TEXTRIANGLE] = OBJ_TEXTRIANGLE;
+    
+     if (nvdev->arch == NV_ARCH_04) {
+          nvdev->drawing_operation = OPERATION_COPY;
+          nvdev->scaler_operation  = OPERATION_COPY;
+          nvdev->scaler_filter     = 0;
+          nvdev->system_operation  = OPERATION_COPY;
+     } else {
+          nvdev->drawing_operation = OPERATION_SRCCOPY;
+          nvdev->scaler_operation  = OPERATION_SRCCOPY;
+          nvdev->scaler_filter     = SCALER_IN_FORMAT_ORIGIN_CENTER |
+                                     SCALER_IN_FORMAT_FILTER_LINEAR;
+          nvdev->system_operation  = OPERATION_SRCCOPY;
+     }
+
+     nvAfterSetVar( driver_data, device_data );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) device_data;
+
+     D_DEBUG( "DirectFB/NVidia: Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/NVidia:  %9d nv_wait* calls\n",
+               nvdev->waitfree_calls );
+     D_DEBUG( "DirectFB/NVidia:  %9d register writes\n",
+               nvdev->waitfree_sum );
+     D_DEBUG( "DirectFB/NVidia:  %9d FIFO/DMA wait cycles (depends on CPU)\n",
+               nvdev->free_waitcycles );
+     D_DEBUG( "DirectFB/NVidia:  %9d IDLE wait cycles (depends on CPU)\n",
+               nvdev->idle_waitcycles );
+     D_DEBUG( "DirectFB/NVidia:  %9d FIFO/DMA space cache hits (depends on CPU)\n",
+               nvdev->cache_hits );
+     D_DEBUG( "DirectFB/NVidia: Conclusion:\n" );
+     D_DEBUG( "DirectFB/NVidia:  Average register writes/nv_wait* call:%.2f\n",
+               nvdev->waitfree_sum/(float)(nvdev->waitfree_calls ? : 1) );
+     D_DEBUG( "DirectFB/NVidia:  Average wait cycles/nv_wait* call: %.2f\n",
+               nvdev->free_waitcycles/(float)(nvdev->waitfree_calls ? : 1) );
+     D_DEBUG( "DirectFB/NVidia:  Average FIFO/DMA space cache hits: %02d%%\n",
+               (int)(100 * nvdev->cache_hits/
+               (float)(nvdev->waitfree_calls ? : 1)) );
+     
+     /* reset channel mode to PIO to avoid crash in rivafb */
+     if (nvdev->use_dma) {
+          nvdev->use_dma = false;
+          nvAfterSetVar( driver_data, device_data );
+     }
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+
+     dfb_gfxcard_unmap_mmio( device, nvdrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia.h
new file mode 100755
index 0000000..9b9062c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia.h
@@ -0,0 +1,238 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NVIDIA_H__
+#define __NVIDIA_H__
+
+#include <dfb_types.h>
+
+#include <core/state.h>
+#include <core/screens.h>
+#include <core/layers.h>
+
+
+/*
+ * Object's identifier
+ */
+enum {
+     OBJ_DMA_IN         = 0x00800000,
+     OBJ_SURFACES2D     = 0x00800001,
+     OBJ_SURFACES3D     = 0x00800002,
+     OBJ_CLIP           = 0x00800003,
+     OBJ_BETA1          = 0x00800004,
+     OBJ_BETA4          = 0x00800005,
+     OBJ_RECTANGLE      = 0x00800010,
+     OBJ_TRIANGLE       = 0x00800011,
+     OBJ_LINE           = 0x00800012,
+     OBJ_SCREENBLT      = 0x00800013,
+     OBJ_IMAGEBLT       = 0x00800014,
+     OBJ_SCALEDIMAGE    = 0x00800015,
+     OBJ_STRETCHEDIMAGE = 0x00800016,
+     OBJ_TEXTRIANGLE    = 0x00800017,
+     OBJ_DMA_OUT        = 0x00800018
+};
+
+/*
+ * Object's offset into context table [PRAMIN + (address)*16]
+ */
+enum {
+     ADDR_DMA_IN         = 0x1160,
+     ADDR_SURFACES2D     = 0x1162,
+     ADDR_SURFACES3D     = 0x1163,
+     ADDR_CLIP           = 0x1164,
+     ADDR_BETA1          = 0x1165,
+     ADDR_BETA4          = 0x1166,
+     ADDR_RECTANGLE      = 0x1167,
+     ADDR_TRIANGLE       = 0x1168,
+     ADDR_LINE           = 0x1169,
+     ADDR_SCREENBLT      = 0x116A,
+     ADDR_IMAGEBLT       = 0x116B,
+     ADDR_SCALEDIMAGE    = 0x116C,
+     ADDR_STRETCHEDIMAGE = 0x116D,
+     ADDR_TEXTRIANGLE    = 0x116E,
+     ADDR_DMA_OUT        = 0x116F
+};
+
+/*
+ * Object's subchannel
+ */
+enum {
+     SUBC_SURFACES2D     = 0,
+     SUBC_SURFACES3D     = 0,
+     SUBC_BETA1          = 0,
+     SUBC_BETA4          = 0,
+     SUBC_CLIP           = 1,
+     SUBC_RECTANGLE      = 2,
+     SUBC_TRIANGLE       = 3,
+     SUBC_LINE           = 4,
+     SUBC_SCREENBLT      = 5,
+     SUBC_IMAGEBLT       = 5,
+     SUBC_SCALEDIMAGE    = 6,
+     SUBC_STRETCHEDIMAGE = 6,
+     SUBC_TEXTRIANGLE    = 7
+};
+     
+
+#define SMF_DRAWING_COLOR  (SMF_COLOR << 16)
+#define SMF_BLITTING_COLOR (SMF_COLOR << 17)
+#define SMF_SOURCE_TEXTURE (SMF_SOURCE << 1) 
+
+typedef struct {
+     StateModificationFlags  set;
+     
+     u32                     fb_offset;
+     u32                     fb_size;
+     u32                     agp_offset;
+     
+     DFBSurfacePixelFormat   dst_format;
+     u32                     dst_offset;
+     u32                     dst_pitch;
+     bool                    dst_422;
+
+     DFBSurfacePixelFormat   src_format;
+     u32                     src_offset;
+     u8                     *src_address;
+     u32                     src_pitch;
+     u32                     src_width;
+     u32                     src_height;
+     bool                    src_system;
+     bool                    src_interlaced;
+     CoreSurfaceBufferLock  *src_lock;
+
+     DFBRectangle            clip;
+
+     u32                     color2d;
+     u32                     color3d;
+     
+     DFBSurfaceDrawingFlags  drawingflags;
+     DFBSurfaceBlittingFlags blittingflags;
+     
+     const s32              *matrix;
+     
+     /* NVRectangle/NVTriangle/NVLine registers */
+     u32                     drawing_operation; // SetOperation
+     
+     /* NVScaledImage registers */
+     u32                     scaler_operation;  // SetOperation
+     u32                     scaler_format;     // SetColorFormat
+     u32                     scaler_filter;     // SetImageInFormat
+     
+     /* NVImageBlt/NVStretchedImage registers */
+     u32                     system_operation;  // SetOperation
+     u32                     system_format;     // SetColorFormat
+
+     /* Remember value of NVBeta1 & NVBeta4 */
+     bool                    beta1_set;
+     u32                     beta1_val;
+     bool                    beta4_set;
+     u32                     beta4_val;
+
+     /* 3D stuff */
+     bool                    enabled_3d;       // 3d engine enabled
+     u32                     buf_offset[2];    // reserved buffers
+     CoreSurfaceBuffer      *src_texture;      // current source for TextureTriangles
+     u32                     max_texture_size;
+     
+     struct {
+          bool               modified;
+          u32                colorkey;
+          u32                offset;
+          u32                format;
+          u32                filter;
+          u32                blend;
+          u32                control;
+          u32                fog;
+     } state3d[2]; // 0 => drawing | 1 => blitting
+
+     /* Remember subchannels configuration */
+     u32                     subchannel_object[8];
+     
+     /* Chipsets informations */
+     u32                     chip;
+     u32                     arch;
+     
+     /* AGP control */
+     bool                    use_agp;
+     int                     agp_key;
+     unsigned int            agp_aper_base;
+     unsigned int            agp_aper_size;
+     
+     /* DMA control */
+     bool                    use_dma;
+     unsigned int            dma_size;
+     unsigned int            dma_offset;
+     unsigned int            dma_max;
+     unsigned int            dma_cur;
+     unsigned int            dma_free;
+     unsigned int            dma_put;
+     unsigned int            dma_get;
+     volatile u32           *cmd_ptr;
+
+     /* FIFO control */
+     unsigned int            fifo_free;
+
+     /* for performance monitoring */
+     unsigned int            waitfree_sum;
+     unsigned int            waitfree_calls;
+     unsigned int            free_waitcycles;
+     unsigned int            idle_waitcycles;
+     unsigned int            cache_hits;
+} NVidiaDeviceData;
+
+
+enum {
+     NV_ARCH_04 = 0x04,
+     NV_ARCH_05 = 0x05,
+     NV_ARCH_10 = 0x10,
+     NV_ARCH_20 = 0x20,
+     NV_ARCH_30 = 0x30
+};
+
+typedef struct {
+     CoreGraphicsDevice     *device;
+     NVidiaDeviceData       *device_data;
+
+     volatile void          *fb_base;
+     volatile void          *agp_base;
+     volatile void          *mmio_base; 
+     volatile void          *dma_base;
+} NVidiaDriverData;
+
+
+extern ScreenFuncs        nvidiaPrimaryScreenFuncs;
+extern ScreenFuncs        OldPrimaryScreenFuncs;
+extern void              *OldPrimaryScreenDriverData;
+
+extern DisplayLayerFuncs  nvidiaPrimaryLayerFuncs;
+extern DisplayLayerFuncs  OldPrimaryLayerFuncs;
+extern void              *OldPrimaryLayerDriverData;
+
+extern DisplayLayerFuncs  nvidiaOverlayFuncs;
+
+
+#endif /* __NVIDIA_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.c
new file mode 100755
index 0000000..63e1728
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.c
@@ -0,0 +1,549 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+#include "nvidia_2d.h"
+
+
+static void
+nv_copy32( volatile u32 *dst, u8 *src, int n )
+{
+     u32 *D = (u32*) dst;
+     u32 *S = (u32*) src;
+     
+#ifdef ARCH_X86
+     __asm__ __volatile__(
+          "rep; movsl"
+          : "=&D" (D), "=&S" (S)
+          : "c" (n), "0" (D), "1" (S)
+          : "memory" );
+#else
+     do {
+          *D++ = *S++;
+     } while (--n);
+#endif
+}
+
+static void
+nv_copy16( volatile u32 *dst, u8 *src, int n )
+{
+     u32 *D = (u32*) dst;
+     u16 *S = (u16*) src;
+
+#ifdef ARCH_X86
+     __asm__ __volatile__(
+          "rep; movsl"
+          : "=&D" (D), "=&S" (S)
+          : "c" (n/2), "0" (D), "1" (S)
+          : "memory" );
+#else
+     for (; n > 1; n -= 2) {
+          *D++ = *((u32*)S);
+          S += 2;
+     }
+#endif
+
+     if (n & 1)
+          *D = *S;
+}
+
+static inline bool
+nv_clip_source( DFBRectangle *rect, u32 width, u32 height )
+{
+     if (rect->x >= width || rect->y >= height)
+          return false;
+          
+     if (rect->x < 0) {
+          rect->w += rect->x;
+          rect->x  = 0;
+     }
+     if (rect->y < 0) {
+          rect->h += rect->y;
+          rect->y  = 0;
+     }
+               
+     rect->w = MIN( rect->w, width  - rect->x );
+     rect->h = MIN( rect->h, height - rect->y );
+     
+     return (rect->w > 0 && rect->h > 0);
+}
+
+
+#define M_TRANSFORM(x, y, retx, rety, m) { \
+     s32 _x, _y; \
+     _x = ((s64)(x) * (m)[0] + (y) * (m)[1] + (m)[2] + 0x8000) >> 16; \
+     _y = ((s64)(x) * (m)[3] + (y) * (m)[4] + (m)[5] + 0x8000) >> 16; \
+     retx = _x; \
+     rety = _y; \
+}
+
+
+bool nvFillRectangle2D( void *drv, void *dev, DFBRectangle *rect )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     
+     if (nvdev->dst_422) {
+          rect->x /= 2;
+          rect->w = (rect->w+1) >> 1;
+     }      
+     
+     if (nvdev->matrix) {
+          int x1 = rect->x, x2 = rect->x+rect->w;
+          int y1 = rect->y, y2 = rect->y+rect->h;
+          int x, y;
+          
+          nv_begin( SUBC_TRIANGLE, TRI_COLOR, 1 );
+          nv_outr( nvdev->color2d );
+          
+          nv_begin( SUBC_TRIANGLE, TRI_POINT0, 3 );
+          M_TRANSFORM( x1, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x2, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x1, y2, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          
+          nv_begin( SUBC_TRIANGLE, TRI_POINT0, 3 );
+          M_TRANSFORM( x2, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x2, y2, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x1, y2, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+     }
+     else {
+          nv_begin( SUBC_RECTANGLE, RECT_COLOR, 1 );
+          nv_outr( nvdev->color2d );
+     
+          nv_begin( SUBC_RECTANGLE, RECT_TOP_LEFT, 2 );
+          nv_outr( (rect->y << 16) | (rect->x & 0xFFFF) );
+          nv_outr( (rect->h << 16) | (rect->w & 0xFFFF) );
+     }
+
+     return true;
+}
+
+bool nvFillTriangle2D( void *drv, void *dev, DFBTriangle *tri )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     
+     if (nvdev->matrix) {
+          M_TRANSFORM( tri->x1, tri->y1, tri->x1, tri->y1, nvdev->matrix );
+          M_TRANSFORM( tri->x2, tri->y3, tri->x2, tri->y2, nvdev->matrix );
+          M_TRANSFORM( tri->x3, tri->y3, tri->x3, tri->y3, nvdev->matrix );
+     }
+     
+     nv_begin( SUBC_TRIANGLE, TRI_COLOR, 1 );
+     nv_outr( nvdev->color2d );
+     
+     nv_begin( SUBC_TRIANGLE, TRI_POINT0, 3 );
+     nv_outr( (tri->y1 << 16) | (tri->x1 & 0xFFFF) );
+     nv_outr( (tri->y2 << 16) | (tri->x2 & 0xFFFF) );
+     nv_outr( (tri->y3 << 16) | (tri->x3 & 0xFFFF) );
+
+     return true;
+}
+
+bool nvDrawRectangle2D( void *drv, void *dev, DFBRectangle *rect )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     
+     if (nvdev->dst_422) {
+          rect->x /= 2;
+          rect->w = (rect->w+1) >> 1;
+     }
+     
+     if (nvdev->matrix) {
+          int x1 = rect->x, x2 = rect->x+rect->w;
+          int y1 = rect->y, y2 = rect->y+rect->h;
+          int x, y;
+          
+          nv_begin( SUBC_LINE, LINE_COLOR, 1 );
+          nv_outr( nvdev->color2d );
+          
+          nv_begin( SUBC_LINE, LINE_POINT0, 8 );
+          /* top */
+          M_TRANSFORM( x1, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x2, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          /* right */
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x2, y2, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          /* bottom */
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x1, y2, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          /* left */
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+          M_TRANSFORM( x1, y1, x, y, nvdev->matrix );
+          nv_outr( (y << 16) | (x & 0xFFFF) );
+     }
+     else {
+          nv_begin( SUBC_RECTANGLE, RECT_COLOR, 1 );
+          nv_outr( nvdev->color2d );
+          
+          nv_begin( SUBC_RECTANGLE, RECT_TOP_LEFT, 8 );
+          /* top */
+          nv_outr( (rect->y << 16) | (rect->x & 0xFFFF) );
+          nv_outr( (1       << 16) | (rect->w & 0xFFFF) );
+          /* bottom */
+          nv_outr( ((rect->y + rect->h - 1) << 16) | (rect->x & 0xFFFF) );
+          nv_outr( (1                       << 16) | (rect->w & 0xFFFF) );
+          /* left */
+          nv_outr( ((rect->y + 1) << 16) | (rect->x & 0xFFFF) );
+          nv_outr( ((rect->h - 2) << 16) | 1 );
+          /* right */
+          nv_outr( ((rect->y + 1) << 16) | ((rect->x + rect->w - 1) & 0xFFFF) );
+          nv_outr( ((rect->h - 2) << 16) | 1 );
+     }
+
+     return true;
+}
+
+bool nvDrawLine2D( void *drv, void *dev, DFBRegion *line )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     
+     if (nvdev->matrix) {
+          M_TRANSFORM( line->x1, line->y1, line->x1, line->y1, nvdev->matrix );
+          M_TRANSFORM( line->x2, line->y2, line->x2, line->y2, nvdev->matrix );
+     }
+     
+     nv_begin( SUBC_LINE, LINE_COLOR, 1 );
+     nv_outr( nvdev->color2d );
+     
+     nv_begin( SUBC_LINE, LINE_POINT0, 2 );
+     nv_outr( (line->y1 << 16) | (line->x1 & 0xFFFF) );
+     nv_outr( (line->y2 << 16) | (line->x2 & 0xFFFF) );
+
+     return true;
+}
+
+bool nvBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+
+     if (nvdev->blittingflags & DSBLIT_DEINTERLACE || nvdev->matrix) {
+          DFBRectangle dr = { dx, dy, rect->w, rect->h };
+          return nvStretchBlit( drv, dev, rect, &dr );
+     }
+ 
+     if (nvdev->dst_422) {
+          dx      /= 2;
+          rect->x /= 2;
+          rect->w  = (rect->w+1) >> 1;
+     }
+     
+     if (nvdev->blittingflags || nvdev->src_format != nvdev->dst_format) {
+          DFBRectangle  *clip       = &nvdev->clip;
+          u32            src_width  = (nvdev->src_width  + 1) & ~1;
+          u32            src_height = (nvdev->src_height + 1) & ~1;
+          u32            filter     = 0;
+
+          if (nvdev->dst_422)
+               src_width >>= 1; 
+
+          if (nvdev->arch > NV_ARCH_04)
+               filter = SCALER_IN_FORMAT_ORIGIN_CORNER |
+                        SCALER_IN_FORMAT_FILTER_NEAREST;
+
+          nv_begin( SUBC_SCALEDIMAGE, SCALER_COLOR_FORMAT, 1 );
+          nv_outr( nvdev->scaler_format );
+          
+          nv_begin( SUBC_SCALEDIMAGE, SCALER_CLIP_POINT, 6 );
+          nv_outr( (clip->y << 16) | (clip->x & 0xFFFF) );
+          nv_outr( (clip->h << 16) | (clip->w & 0xFFFF) );
+          nv_outr( (dy      << 16) | (dx      & 0xFFFF) );
+          nv_outr( (rect->h << 16) | (rect->w & 0xFFFF) );
+          nv_outr( 0x100000 );
+          nv_outr( 0x100000 );
+
+          nv_begin( SUBC_SCALEDIMAGE, SCALER_IN_SIZE, 4 );
+          nv_outr( (src_height << 16) | (src_width & 0xFFFF) );
+          nv_outr( (nvdev->src_pitch & 0xFFFF) | filter );
+          nv_outr( nvdev->src_offset );
+          nv_outr( (rect->y << 20) | ((rect->x<<4) & 0xFFFF) );
+     }
+     else {
+          nv_begin( SUBC_SCREENBLT, BLIT_TOP_LEFT_SRC, 3 );
+          nv_outr( (rect->y << 16) | (rect->x & 0xFFFF) );
+          nv_outr( (dy      << 16) | (dx      & 0xFFFF) );
+          nv_outr( (rect->h << 16) | (rect->w & 0xFFFF) );
+     }
+
+     return true;
+}   
+
+bool nvBlitFromCPU( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     u8               *src   = nvdev->src_address;
+     u32               src_w;
+     u32               src_h;
+     int               w, h, n;
+     
+     if (nvdev->blittingflags & DSBLIT_DEINTERLACE || nvdev->matrix) {
+          DFBRectangle dr = { dx, dy, rect->x, rect->y };
+          return nvStretchBlitFromCPU( drv, dev, rect, &dr );
+     }
+     
+     if (!nv_clip_source( rect, nvdev->src_width, nvdev->src_height ))
+          return true;
+
+     src_w = (DFB_BYTES_PER_PIXEL(nvdev->src_format) == 2)
+             ? ((rect->w + 1) & ~1) : rect->w;
+     src_h = rect->h;
+
+     nv_begin( SUBC_IMAGEBLT, IBLIT_COLOR_FORMAT, 1 );
+     nv_outr( nvdev->system_format );
+     
+     nv_begin( SUBC_IMAGEBLT, IBLIT_POINT, 3 );
+     nv_outr( (dy      << 16) | (dx      & 0xFFFF) );
+     nv_outr( (rect->h << 16) | (rect->w & 0xFFFF) );
+     nv_outr( (src_h   << 16) | (src_w   & 0xFFFF) );
+
+     n = nvdev->use_dma ? 256 : 128;
+     
+     switch (nvdev->src_format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+               src += rect->y * nvdev->src_pitch + rect->x * 2;
+               for (h = rect->h; h--;) {
+                    u8 *s = src;
+                    
+                    for (w = rect->w; w >= n*2; w -= n*2) {
+                         nv_begin( SUBC_IMAGEBLT, IBLIT_PIXEL0, n );
+                         direct_memcpy( (void*)nvdev->cmd_ptr, s, n*4 );
+                         s += n*4;
+                    }
+                    if (w > 0) {
+                         nv_begin( SUBC_IMAGEBLT, IBLIT_PIXEL0, (w+1)>>1 );
+                         nv_copy16( nvdev->cmd_ptr, s, w );
+                    }
+                    
+                    src += nvdev->src_pitch;
+               }
+               break;
+               
+          default:
+               src += rect->y * nvdev->src_pitch + rect->x * 4;
+               for (h = rect->h; h--;) {
+                    u8 *s = src;
+                    
+                    for (w = rect->w; w >= n; w -= n) {
+                         nv_begin( SUBC_IMAGEBLT, IBLIT_PIXEL0, n );
+                         direct_memcpy( (void*)nvdev->cmd_ptr, s, n*4 );
+                         s += n*4;
+                    }
+                    if (w > 0) {
+                         nv_begin( SUBC_IMAGEBLT, IBLIT_PIXEL0, w );
+                         nv_copy32( nvdev->cmd_ptr, s, w );
+                    }
+                    
+                    src += nvdev->src_pitch;
+               }
+               break;
+     }
+     
+     return true;
+}
+
+bool nvStretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     NVidiaDriverData *nvdrv      = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev      = (NVidiaDeviceData*) dev;
+     DFBRectangle     *cr         = &nvdev->clip;
+     u32               src_width  = (nvdev->src_width  + 1) & ~1;
+     u32               src_height = (nvdev->src_height + 1) & ~1;
+     
+     if (nvdev->dst_422) {
+          sr->x /= 2;
+          sr->w  = (sr->w+1) >> 1;
+          dr->x /= 2;
+          dr->w  = (dr->w+1) >> 1;
+          src_width >>= 1;
+     }
+
+     if (nvdev->blittingflags & DSBLIT_DEINTERLACE) {
+          sr->y /= 2;
+          sr->h  = (sr->h+1) / 2;
+     }
+     
+     if (nvdev->matrix) {
+          int x1, y1, x2, y2;
+          
+          if (!nvdev->matrix[0] || !nvdev->matrix[4])
+               return true;
+          
+          M_TRANSFORM( dr->x, dr->y, x1, y1, nvdev->matrix );
+          M_TRANSFORM( dr->x+dr->w, dr->y+dr->h, x2, y2, nvdev->matrix );
+          
+          dr->x = x1; dr->w = x2-x1;
+          dr->y = y1; dr->h = y2-y1;
+     }
+
+     nv_begin( SUBC_SCALEDIMAGE, SCALER_COLOR_FORMAT, 1 );
+     nv_outr( nvdev->scaler_format );
+     
+     nv_begin( SUBC_SCALEDIMAGE, SCALER_CLIP_POINT, 6 );
+     nv_outr( (cr->y << 16) | (cr->x & 0xFFFF) );
+     nv_outr( (cr->h << 16) | (cr->w & 0xFFFF) );
+     nv_outr( (dr->y << 16) | (dr->x & 0xFFFF) );
+     nv_outr( (dr->h << 16) | (dr->w & 0xFFFF) );
+     nv_outr( (sr->w << 20) /  dr->w );
+     nv_outr( (sr->h << 20) /  dr->h );
+
+     nv_begin( SUBC_SCALEDIMAGE, SCALER_IN_SIZE, 4 );
+     nv_outr( (src_height << 16) | (src_width & 0xFFFF) );
+     nv_outr( (nvdev->src_pitch & 0xFFFF) | nvdev->scaler_filter );
+     nv_outr( nvdev->src_offset );
+     nv_outr( (sr->y << 20) | ((sr->x << 4) & 0xFFFF) );
+     
+     return true;
+}
+
+bool nvStretchBlitFromCPU( void *drv, void *dev, 
+                           DFBRectangle *sr, DFBRectangle *dr )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev  = (NVidiaDeviceData*) dev;
+     DFBRectangle     *cr     = &nvdev->clip; 
+     u8               *src    = nvdev->src_address;
+     u32               src_w;
+     u32               src_h;
+     int               w, h, n;
+
+     if (!nv_clip_source( sr, nvdev->src_width, nvdev->src_height ))
+          return true;
+
+     if (nvdev->blittingflags & DSBLIT_DEINTERLACE) {
+          sr->y /= 2;
+          sr->h /= 2;
+     }
+     
+     if (nvdev->matrix) {
+          int x1, y1, x2, y2;
+          
+          if (!nvdev->matrix[0] || !nvdev->matrix[4])
+               return true;
+          
+          M_TRANSFORM( dr->x, dr->y, x1, y1, nvdev->matrix );
+          M_TRANSFORM( dr->x+dr->w, dr->y+dr->h, x2, y2, nvdev->matrix );
+          
+          dr->x = x1; dr->w = x2-x1;
+          dr->y = y1; dr->h = y2-y1;
+     }
+     
+     src_w = (DFB_BYTES_PER_PIXEL(nvdev->src_format) == 2)
+             ? ((sr->w + 1) & ~1) : sr->w;
+     src_h = sr->h;
+
+     nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_COLOR_FORMAT, 1 );
+     nv_outr( nvdev->system_format );
+     
+     nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_IN_SIZE, 6 );
+     nv_outr( (src_h << 16) | (src_w & 0xFFFF) );
+     nv_outr( (dr->w << 20) /  src_w );
+     nv_outr( (dr->h << 20) /  src_h );
+     nv_outr( (cr->y << 16) | (cr->x & 0xFFFF) );
+     nv_outr( (cr->h << 16) | (cr->w & 0xFFFF) );
+     nv_outr( (dr->y << 20) | ((dr->x<<4) & 0xFFFF) );
+
+     n = nvdev->use_dma ? 256 : 128;
+
+     switch (nvdev->src_format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+               src += sr->y * nvdev->src_pitch + sr->x * 2;
+               for (h = sr->h; h--;) {
+                    u8 *s = src;
+                    
+                    for (w = sr->w; w >= n*2; w -= n*2) {
+                         nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_PIXEL0, n );
+                         direct_memcpy( (void*)nvdev->cmd_ptr, s, n*4 );
+                         s += n*4;
+                    }
+                    if (w > 0) {
+                         nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_PIXEL0, (w+1)>>1 );
+                         nv_copy16( nvdev->cmd_ptr, s, w );
+                    }
+
+                    src += nvdev->src_pitch;
+               }
+               break;
+               
+          default:
+               src += sr->y * nvdev->src_pitch + sr->x * 4;
+               for (h = sr->h; h--;) {
+                    u8 *s= src;
+                    
+                    for (w = sr->w; w >= n; w -= n) {
+                         nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_PIXEL0, n );
+                         direct_memcpy( (void*)nvdev->cmd_ptr, s, n*4 );
+                         s += n*4;
+                    }
+                    if (w > 0) {
+                         nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_PIXEL0, w );
+                         nv_copy32( nvdev->cmd_ptr, s, w );
+                    }
+
+                    src += nvdev->src_pitch;
+               }
+               break;
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.h
new file mode 100755
index 0000000..b195aef
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_2d.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NVIDIA_2D_H__
+#define __NVIDIA_2D_H__
+
+bool nvFillRectangle2D( void *drv, void *dev, DFBRectangle *rect );
+
+bool nvFillTriangle2D( void *drv, void *dev, DFBTriangle *tri );
+
+bool nvDrawRectangle2D( void *drv, void *dev, DFBRectangle *rect );
+
+bool nvDrawLine2D( void *drv, void *dev, DFBRegion *line );
+
+bool nvBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+
+bool nvBlitFromCPU( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+
+bool nvStretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr );
+
+bool nvStretchBlitFromCPU( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr );
+
+#endif /* __NVIDIA_2D_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.c
new file mode 100755
index 0000000..ae8dffc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.c
@@ -0,0 +1,522 @@
+/*
+   Copyright (C) 2004-2006 Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+#include "nvidia_3d.h"
+
+
+static __inline__ u32
+f2d( float f ) {
+     union {
+          float f;
+          u32 d;
+     } t;
+     t.f = f;
+     return t.d;
+}
+
+#define nv_setstate3d( state3d ) {                              \
+     if ((state3d)->modified) {                                 \
+          nv_begin( SUBC_TEXTRIANGLE, TXTRI_COLOR_KEY, 7 );     \
+          nv_outr( (state3d)->colorkey );                       \
+          nv_outr( (state3d)->offset   );                       \
+          nv_outr( (state3d)->format   );                       \
+          nv_outr( (state3d)->filter   );                       \
+          nv_outr( (state3d)->blend    );                       \
+          nv_outr( (state3d)->control  );                       \
+          nv_outr( (state3d)->fog      );                       \
+                                                                \
+          (state3d)->modified = false;                          \
+     }                                                          \
+}
+
+#define nv_putvertex( i, x, y, z, w, col, spc, s, t ) {         \
+     nv_begin( SUBC_TEXTRIANGLE, TXTRI_VERTEX0+(i)*32, 8 );     \
+     nv_outr( f2d( x ) );                                       \
+     nv_outr( f2d( y ) );                                       \
+     nv_outr( f2d( z ) );                                       \
+     nv_outr( f2d( w ) );                                       \
+     nv_outr( col      );                                       \
+     nv_outr( spc      );                                       \
+     nv_outr( f2d( s ) );                                       \
+     nv_outr( f2d( t ) );                                       \
+}
+
+#define nv_emit_vertices( i, v0, v1, v2, v3, v4, v5, v6, v7 ) { \
+     nv_begin( SUBC_TEXTRIANGLE, TXTRI_PRIMITIVE0+(i)*4, 1 );   \
+     nv_outr( ((v7) << 28) | ((v6) << 24) |                     \
+              ((v5) << 20) | ((v4) << 16) |                     \
+              ((v3) << 12) | ((v2) <<  8) |                     \
+              ((v1) <<  4) |  (v0)          );                  \
+}
+
+
+static void nv_load_texture( NVidiaDriverData *nvdrv, NVidiaDeviceData *nvdev );
+                             
+                             
+#define M_TRANSFORM(x, y, retx, rety, m) { \
+     float _x, _y; \
+     _x = ((x) * (m)[0] + (y) * (m)[1] + (m)[2]) / 65536.f; \
+     _y = ((x) * (m)[3] + (y) * (m)[4] + (m)[5]) / 65536.f; \
+     retx = _x; \
+     rety = _y; \
+}
+
+
+bool nvFillRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     
+     x1 = rect->x; x2 = rect->x+rect->w;
+     y1 = rect->y; y2 = rect->y+rect->h;
+
+     nv_setstate3d( &nvdev->state3d[0] );
+
+     if (nvdev->matrix) {
+          float x, y;
+          
+          M_TRANSFORM( x1, y1, x, y, nvdev->matrix );
+          nv_putvertex( 0, x, y, 0, 1, nvdev->color3d, 0, 0, 0 );
+          M_TRANSFORM( x2, y1, x, y, nvdev->matrix );
+          nv_putvertex( 1, x, y, 0, 1, nvdev->color3d, 0, 0, 0 );
+          M_TRANSFORM( x2, y2, x, y, nvdev->matrix );
+          nv_putvertex( 2, x, y, 0, 1, nvdev->color3d, 0, 0, 0 );
+          M_TRANSFORM( x1, y2, x, y, nvdev->matrix );
+          nv_putvertex( 3, x, y, 0, 1, nvdev->color3d, 0, 0, 0 );
+     }
+     else {    
+          nv_putvertex( 0, x1, y1, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 1, x2, y1, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 2, x2, y2, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 3, x1, y2, 0, 1, nvdev->color3d, 0, 0, 0 );
+     }
+     
+     nv_emit_vertices( 0, 0, 1, 2, 0, 2, 3, 0, 0 );
+
+     return true;
+}
+
+bool nvFillTriangle3D( void *drv, void *dev, DFBTriangle *tri )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             x3, y3;
+     
+     x1 = tri->x1; x2 = tri->x2; x3 = tri->x3;
+     y1 = tri->y1; y2 = tri->y2; y3 = tri->y3;     
+     if (nvdev->matrix) {
+          M_TRANSFORM( x1, y1, x1, y1, nvdev->matrix );
+          M_TRANSFORM( x2, y2, x2, y2, nvdev->matrix );
+          M_TRANSFORM( x3, y3, x3, y3, nvdev->matrix );
+     }
+
+     nv_setstate3d( &nvdev->state3d[0] );
+
+     nv_putvertex( 0, x1, y1, 0, 1, nvdev->color3d, 0, 0, 0 );
+     nv_putvertex( 1, x2, y2, 0, 1, nvdev->color3d, 0, 0, 0 );
+     nv_putvertex( 2, x3, y3, 0, 1, nvdev->color3d, 0, 0, 0 );
+
+     nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+
+     return true;
+}
+
+bool nvDrawRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     DFBRegion         r[4];
+     int               i;
+
+     if (nvdev->matrix) {
+          DFBRegion line;
+
+          /* top */
+          line = (DFBRegion) { rect->x, rect->y, rect->x+rect->w, rect->y };
+          nvDrawLine3D( drv, dev, &line );
+          /* right */
+          line = (DFBRegion) { rect->x+rect->w, rect->y, rect->x+rect->w, rect->y+rect->h };
+          nvDrawLine3D( drv, dev, &line );
+          /* bottom */
+          line = (DFBRegion) { rect->x, rect->y+rect->h, rect->x+rect->w, rect->y+rect->h };
+          nvDrawLine3D( drv, dev, &line );
+          /* left */
+          line = (DFBRegion) { rect->x, rect->y, rect->x, rect->y+rect->h };
+          nvDrawLine3D( drv, dev, &line );
+
+          return true;
+     }
+    
+     /* top */
+     r[0].x1 = rect->x;
+     r[0].y1 = rect->y;
+     r[0].x2 = rect->x + rect->w;
+     r[0].y2 = rect->y + 1;
+
+     /* right */
+     r[1].x1 = rect->x + rect->w - 1;
+     r[1].y1 = rect->y + 1;
+     r[1].x2 = rect->x + rect->w;
+     r[1].y2 = rect->y + rect->h - 1;
+
+     /* bottom */
+     r[2].x1 = rect->x;
+     r[2].y1 = rect->y + rect->h - 1;
+     r[2].x2 = rect->x + rect->w;
+     r[2].y2 = rect->y + rect->h;
+
+     /* left */
+     r[3].x1 = rect->x;
+     r[3].y1 = rect->y + 1;
+     r[3].x2 = rect->x + 1;
+     r[3].y2 = rect->y + rect->h - 1;
+     
+     nv_setstate3d( &nvdev->state3d[0] );
+
+     for (i = 0; i < 4; i++) {
+          nv_putvertex( 0, r[i].x1, r[i].y1, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 1, r[i].x2, r[i].y1, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 2, r[i].x2, r[i].y2, 0, 1, nvdev->color3d, 0, 0, 0 );
+          nv_putvertex( 3, r[i].x1, r[i].y2, 0, 1, nvdev->color3d, 0, 0, 0 );
+
+          nv_emit_vertices( 0, 0, 1, 2, 0, 2, 3, 0, 0 );
+     }
+
+     return true;
+}
+
+bool nvDrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev = (NVidiaDeviceData*) dev;
+     float             xinc, yinc;
+     float             x1, y1;
+     float             x2, y2;
+     float             dx, dy;
+     
+     x1 = line->x1; x2 = line->x2;
+     y1 = line->y1; y2 = line->y2;
+     if (nvdev->matrix) {
+          M_TRANSFORM( x1, y1, x1, y1, nvdev->matrix );
+          M_TRANSFORM( x2, y2, x2, y2, nvdev->matrix );
+          
+          dx = fabs(x2 - x1);
+          dy = fabs(y2 - y1);
+     }
+     else {
+          dx = abs(line->x2 - line->x1);
+          dy = abs(line->y2 - line->y1);
+     }
+
+     if (dx > dy) { /* more horizontal */
+          xinc = 0.0;
+          yinc = 0.5;
+     } else {       /* more vertical */
+          xinc = 0.5;
+          yinc = 0.0;
+     }
+
+     nv_setstate3d( &nvdev->state3d[0] );
+
+     nv_putvertex( 0, x1 - xinc, y1 - yinc, 0, 1, nvdev->color3d, 0, 0, 0 );
+     nv_putvertex( 1, x1 + xinc, y1 + yinc, 0, 1, nvdev->color3d, 0, 0, 0 );
+     nv_putvertex( 2, x2 + xinc, y2 + yinc, 0, 1, nvdev->color3d, 0, 0, 0 );
+     nv_putvertex( 3, x2 - xinc, y2 - yinc, 0, 1, nvdev->color3d, 0, 0, 0 );
+
+     nv_emit_vertices( 0, 2, 0, 1, 3, 0, 2, 0, 0 );
+
+     return true;
+}
+
+bool nvTextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                         int num, DFBTriangleFormation formation )
+{
+     NVidiaDriverData *nvdrv   = (NVidiaDriverData*) drv;
+     NVidiaDeviceData *nvdev   = (NVidiaDeviceData*) dev;
+     float             s_scale;
+     float             t_scale;
+     int               i;
+
+     /* load source texture into texture buffer */
+     nv_load_texture( nvdrv, nvdev );
+     
+     s_scale = (float)nvdev->src_width  /
+               (float)(1 << ((nvdev->state3d[1].format >> 16) & 0xF));
+     t_scale = (float)nvdev->src_height /
+               (float)(1 << ((nvdev->state3d[1].format >> 20) & 0xF));
+
+     for (i = 0; i < num; i++) {
+          if (nvdev->matrix)
+               M_TRANSFORM( ve[i].x, ve[i].y, ve[i].x, ve[i].y, nvdev->matrix );
+          ve[i].x += 0.5;
+          ve[i].y += 0.5;
+          ve[i].s *= s_scale;
+          ve[i].t *= t_scale;
+     }
+
+     nv_setstate3d( &nvdev->state3d[1] );
+
+     switch (formation) {
+          case DTTF_LIST:
+               for (i = 0; i < num; i += 3) {
+                    nv_putvertex( 0, ve[i].x, ve[i].y, ve[i].z, ve[i].w,
+                                  nvdev->color3d, 0, ve[i].s, ve[i].t );
+                    nv_putvertex( 1, ve[i+1].x, ve[i+1].y, ve[i+1].z, ve[i+1].w,
+                                  nvdev->color3d, 0, ve[i+1].s, ve[i+1].t );
+                    nv_putvertex( 2, ve[i+2].x, ve[i+2].y, ve[i+2].z, ve[i+2].w,
+                                  nvdev->color3d, 0, ve[i+2].s, ve[i+2].t );
+                    nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+               }
+               break;
+
+          case DTTF_STRIP:
+               nv_putvertex( 0, ve[0].x, ve[0].y, ve[0].z, ve[0].w,
+                             nvdev->color3d, 0, ve[0].s, ve[0].t );
+               nv_putvertex( 1, ve[1].x, ve[1].y, ve[1].z, ve[1].w,
+                             nvdev->color3d, 0, ve[1].s, ve[1].t );
+               nv_putvertex( 2, ve[2].x, ve[2].y, ve[2].z, ve[2].w,
+                             nvdev->color3d, 0, ve[2].s, ve[2].t );
+               nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+               
+               for (i = 3; i < num; i++) {
+                    nv_putvertex( 0, ve[i-2].x, ve[i-2].y, ve[i-2].z, ve[i-2].w,
+                                  nvdev->color3d, 0, ve[i-2].s, ve[i-2].t );
+                    nv_putvertex( 1, ve[i-1].x, ve[i-1].y, ve[i-1].z, ve[i-1].w,
+                                  nvdev->color3d, 0, ve[i-1].s, ve[i-1].t );
+                    nv_putvertex( 2, ve[i].x, ve[i].y, ve[i].z, ve[i].w,
+                                  nvdev->color3d, 0, ve[i].s, ve[i].t );
+                    nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+               }
+               break;
+
+          case DTTF_FAN:
+               nv_putvertex( 0, ve[0].x, ve[0].y, ve[0].z, ve[0].w,
+                             nvdev->color3d, 0, ve[0].s, ve[0].t );
+               nv_putvertex( 1, ve[1].x, ve[1].y, ve[1].z, ve[1].w,
+                             nvdev->color3d, 0, ve[1].s, ve[1].t );
+               nv_putvertex( 2, ve[2].x, ve[2].y, ve[2].z, ve[2].w,
+                             nvdev->color3d, 0, ve[2].s, ve[2].t );
+               nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+
+               for (i = 3; i < num; i++) {
+                    nv_putvertex( 0, ve[0].x, ve[0].y, ve[0].z, ve[0].w,
+                                  nvdev->color3d, 0, ve[0].s, ve[0].t );
+                    nv_putvertex( 1, ve[i-1].x, ve[i-1].y, ve[i-1].z, ve[i-1].w,
+                                  nvdev->color3d, 0, ve[i-1].s, ve[i-1].t );
+                    nv_putvertex( 2, ve[i].x, ve[i].y, ve[i].z, ve[i].w,
+                                  nvdev->color3d, 0, ve[i].s, ve[i].t );
+                    nv_emit_vertices( 0, 0, 1, 2, 0, 0, 0, 0, 0 );
+               }
+               break;
+
+          default:
+               D_BUG( "unexpected triangle formation" );
+               return false;
+     }
+
+     return true;
+}
+
+/*
+ * Surface to Texture conversion routines.
+ */
+
+#define VINC  0xAAAAAAAC
+#define VMASK 0x55555555
+#define UINC  0x55555558
+#define UMASK 0xAAAAAAAA
+
+static inline void
+a8_to_tex( u32 *dst, u8 *src, int pitch, int width, int height )
+{
+     u32 u, v;
+     int   i;
+
+     for (v = 0; height--; v = (v + VINC) & VMASK) {
+          for (i = 0, u = 0; i < width; i += 2, u = (u + UINC) & UMASK) {
+#ifdef WORDS_BIGENDIAN
+               dst[(u|v)/4] = ((src[i+0] & 0xF0) << 24) |
+                              ((src[i+1] & 0xF0) <<  8) |
+                              0x0FFF0FFF;
+#else
+               dst[(u|v)/4] = ((src[i+0] & 0xF0) <<  8) |
+                              ((src[i+1] & 0xF0) << 24) |
+                              0x0FFF0FFF;
+#endif
+          }
+          
+          if (width & 1) {
+               u = (u + UINC) & UMASK;
+               dst[(u|v)/4] = ((src[width-1] & 0xF0) << 8) | 0x0FFF;
+          }             
+               
+          src += pitch;
+     }
+}
+
+static inline void
+rgb16_to_tex( u32 *dst, u8 *src, int pitch, int width, int height )
+{
+     u32 u, v;
+     int   i;
+
+     for (v = 0; height--; v = (v + VINC) & VMASK) {
+          for (i = 0, u = 0; i < width/2; i++, u = (u + UINC) & UMASK)
+               dst[(u|v)/4] = ((u32*) src)[i];
+          
+          if (width & 1) {
+               u = (u + UINC) & UMASK;
+               dst[(u|v)/4] = ((u16*) src)[width-1];
+          }             
+               
+          src += pitch;
+     }
+}
+
+static inline void
+rgb32_to_tex( u32 *dst, u8 *src, int pitch, int width, int height )
+{
+     u32 u, v;
+     int   i;
+
+     for (v = 0; height--; v = (v + VINC) & VMASK) {
+          for (i = 0, u = 0; i < width; i += 2, u = (u + UINC) & UMASK) {
+               register u32 pix0, pix1;
+               pix0 = ((u32*) src)[i];
+               pix0 = RGB32_TO_RGB16( pix0 );
+               pix1 = ((u32*) src)[i+1];
+               pix1 = RGB32_TO_RGB16( pix1 );
+#ifdef WORDS_BIGENDIAN
+               dst[(u|v)/4] = (pix0 << 16) | pix1;
+#else
+               dst[(u|v)/4] = pix0 | (pix1 << 16);
+#endif
+          }
+          
+          if (width & 1) {
+               u = (u + UINC) & UMASK;
+               dst[(u|v)/4] = RGB32_TO_RGB16( ((u32*) src)[width-1] );
+          }             
+               
+          src += pitch;
+     }
+}
+
+static inline void
+argb_to_tex( u32 *dst, u8 *src, int pitch, int width, int height )
+{
+     u32 u, v;
+     int   i;
+
+     for (v = 0; height--; v = (v + VINC) & VMASK) {
+          for (i = 0, u = 0; i < width; i += 2, u = (u + UINC) & UMASK) {
+               register u32 pix0, pix1;
+               pix0 = ((u32*) src)[i];
+               pix0 = ARGB_TO_ARGB4444( pix0 );
+               pix1 = ((u32*) src)[i+1];
+               pix1 = ARGB_TO_ARGB4444( pix1 );
+#ifdef WORDS_BIGENDIAN
+               dst[(u|v)/4] = (pix0 << 16) | pix1;
+#else
+               dst[(u|v)/4] = pix0 | (pix1 << 16);
+#endif
+          }
+
+          if (width & 1) {
+               u = (u + UINC) & UMASK;
+               dst[(u|v)/4] = ARGB_TO_ARGB4444( ((u32*) src)[width-1] );
+          }
+
+          src += pitch;
+     }
+}
+
+static void nv_load_texture( NVidiaDriverData *nvdrv,
+                             NVidiaDeviceData *nvdev )
+{
+     CoreSurfaceBuffer *buffer = nvdev->src_texture;
+     u32               *dst;
+     
+     dst = dfb_gfxcard_memory_virtual( nvdrv->device, nvdev->buf_offset[1] );
+     
+#if 0
+     if (nvdev->src_interlaced) {
+          if (surface->caps & DSCAPS_SEPARATED) {
+               if (surface->field)
+                    field_offset = nvdev->src_height * src_pitch;
+          } else {
+               if (surface->field)
+                    field_offset = src_pitch;
+               src_pitch *= 2;
+          }
+     }
+#endif
+
+     switch (buffer->format) {
+          case DSPF_A8:
+               a8_to_tex( dst, nvdev->src_lock->addr, nvdev->src_lock->pitch,
+                          nvdev->src_width, nvdev->src_height );
+               break;
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+               rgb16_to_tex( dst, nvdev->src_lock->addr, nvdev->src_lock->pitch,
+                             nvdev->src_width, nvdev->src_height );
+               break;
+          case DSPF_RGB32:
+               rgb32_to_tex( dst, nvdev->src_lock->addr, nvdev->src_lock->pitch,
+                             nvdev->src_width, nvdev->src_height );
+               break;
+          case DSPF_ARGB:
+               argb_to_tex( dst, nvdev->src_lock->addr, nvdev->src_lock->pitch,
+                            nvdev->src_width, nvdev->src_height );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               break;
+     }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.h
new file mode 100755
index 0000000..ade71f7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_3d.h
@@ -0,0 +1,36 @@
+/*
+   Copyright (C) 2004-2006 Claudio Ciccani <klan@users.sf.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 __NVIDIA_3D_H__
+#define __NVIDIA_3D_H__
+
+
+bool nvFillRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool nvFillTriangle3D( void *drv, void *dev, DFBTriangle *tri );
+
+bool nvDrawRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool nvDrawLine3D( void *drv, void *dev, DFBRegion *line );
+
+bool nvTextureTriangles( void *drv, void *dev, DFBVertex *vertices,
+                         int num, DFBTriangleFormation formation );
+
+
+#endif /* __NVIDIA_3D_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_accel.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_accel.h
new file mode 100755
index 0000000..2858947
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_accel.h
@@ -0,0 +1,246 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NVIDIA_ACCEL_H__
+#define __NVIDIA_ACCEL_H__
+
+#include <unistd.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+
+
+static __inline__ void
+nv_out8( volatile void *mmioaddr, u32 reg, u8 value )
+{
+     *((volatile u8*)(mmioaddr+reg)) = value;
+}
+
+static __inline__ void
+nv_out16( volatile void *mmioaddr, u32 reg, u16 value )
+{
+     *((volatile u16*)(mmioaddr+reg)) = value;
+}
+
+static __inline__ void
+nv_out32( volatile void *mmioaddr, u32 reg, u32 value )
+{
+    *((volatile u32*)(mmioaddr+reg)) = value;
+}
+
+static __inline__ u8
+nv_in8( volatile void *mmioaddr, u32 reg )
+{
+     return *((volatile u8*)(mmioaddr+reg));
+}
+
+static __inline__ u16
+nv_in16( volatile void *mmioaddr, u32 reg )
+{
+     return *((volatile u16*)(mmioaddr+reg));
+}
+
+static __inline__ u32
+nv_in32( volatile void *mmioaddr, u32 reg )
+{
+    return *((volatile u32*)(mmioaddr+reg));
+}
+
+static __inline__ void
+nv_outcrtc( volatile void *mmioaddr, u8 reg, u8 value )
+{
+     nv_out8( mmioaddr, PCIO_CRTC_INDEX, reg );
+     nv_out8( mmioaddr, PCIO_CRTC_DATA, value );
+}
+
+static __inline__ u8
+nv_incrtc( volatile void *mmioaddr, u8 reg )
+{
+     nv_out8( mmioaddr, PCIO_CRTC_INDEX, reg );
+     return nv_in8( mmioaddr, PCIO_CRTC_DATA );
+}
+
+#define WAIT_MAX 10000000
+
+static inline void
+nv_waitidle( NVidiaDriverData *nvdrv, NVidiaDeviceData *nvdev )
+{
+     u32 status;
+     int   waitcycles = 0;
+     
+     do {
+          status = nv_in32( nvdrv->mmio_base, PGRAPH_STATUS );
+          if (++waitcycles > WAIT_MAX) {
+               D_BREAK( "Engine timed out" );
+               /* avoid card crash */
+               _exit(-1);
+          }
+     } while (status & PGRAPH_STATUS_STATE_BUSY);
+      
+     nvdev->idle_waitcycles += waitcycles;
+}
+
+/*
+ * FIFO control
+ */
+
+static inline void
+nv_waitfifo( NVidiaDriverData *nvdrv, 
+             NVidiaDeviceData *nvdev, 
+             unsigned int      space )
+{
+     volatile void *mmio       = nvdrv->mmio_base;
+     int            waitcycles = 0;
+     
+     nvdev->waitfree_sum += (space);
+     nvdev->waitfree_calls++;
+
+     if (nvdev->fifo_free < space) {
+          do {
+#ifdef WORDS_BIGENDIAN
+               nvdev->fifo_free = nv_in16( mmio, FIFO_FREE ) >> 2;
+#else
+               nvdev->fifo_free = nv_in32( mmio, FIFO_FREE ) >> 2;
+#endif
+               if (++waitcycles > WAIT_MAX) {
+                    D_BREAK( "FIFO timed out" );
+                    /* avoid card crash */
+                    _exit(-1);
+               }
+          } while (nvdev->fifo_free < space);
+          
+          nvdev->free_waitcycles += waitcycles;
+     } else
+          nvdev->cache_hits++;
+          
+     nvdev->fifo_free -= space;
+}
+
+/*
+ * DMA control
+ */
+
+static inline void
+nv_emitdma( NVidiaDriverData *nvdrv, NVidiaDeviceData *nvdev )
+{
+     if (nvdev->dma_put != nvdev->dma_cur) {
+          volatile u8 scratch;
+          
+          /* flush MTRR buffers */
+          scratch = nv_in8( nvdrv->fb_base, 0 );
+          nv_out32( nvdrv->mmio_base, DMA_PUT, nvdev->dma_cur << 2 );
+          
+          nvdev->dma_put = nvdev->dma_cur;
+     }
+}
+
+static inline void
+nv_waitdma( NVidiaDriverData *nvdrv, 
+            NVidiaDeviceData *nvdev, 
+            unsigned int      space )
+{
+     volatile void *mmio       = nvdrv->mmio_base;
+     volatile void *ring       = nvdrv->dma_base;
+     int            waitcycles = 0;
+
+     nvdev->waitfree_sum += (space);
+     nvdev->waitfree_calls++;
+
+     if (nvdev->dma_free < space) {
+          do {
+               nvdev->dma_get = nv_in32( mmio, DMA_GET ) >> 2;
+               
+               if (nvdev->dma_put >= nvdev->dma_get) {
+                    nvdev->dma_free = nvdev->dma_max - nvdev->dma_cur;
+                         
+                    if (nvdev->dma_free < space) {
+                         /* rewind ring */
+                         nv_out32( ring, nvdev->dma_cur << 2, 0x20000000 );
+
+                         if (!nvdev->dma_get) {
+                              if (!nvdev->dma_put) {
+                                   nvdev->dma_cur = 1;
+                                   nv_emitdma( nvdrv, nvdev );
+                              }
+                              
+                              do {
+                                   nvdev->dma_get = nv_in32( mmio, DMA_GET ) >> 2;
+                                   if (++waitcycles > WAIT_MAX) {
+                                        D_BREAK( "DMA timed out" );
+                                        /* avoid card crash */
+                                        _exit(-1);
+                                   }
+                              } while (!nvdev->dma_get);
+                         }
+                        
+                         nvdev->dma_cur = 0;
+                         nv_emitdma( nvdrv, nvdev );
+                         
+                         nvdev->dma_free = nvdev->dma_get - 1;
+                    }
+               }
+               else {
+                    nvdev->dma_free = nvdev->dma_get - nvdev->dma_cur - 1;
+               }
+                    
+               if (++waitcycles > WAIT_MAX) {
+                    D_BREAK( "DMA timed out" );
+                    /* avoid card crash */
+                    _exit(-1);
+               }
+          } while (nvdev->dma_free < space);
+
+          nvdev->free_waitcycles += waitcycles;
+     } else
+          nvdev->cache_hits++;
+
+     nvdev->dma_free -= space;
+}
+
+/* Begin writing into ring/fifo */
+#define nv_begin( subc, start, size ) {                          \
+     if (nvdev->use_dma) {                                       \
+          nv_waitdma( nvdrv, nvdev, (size)+1 );                  \
+          nv_out32( nvdrv->dma_base, nvdev->dma_cur << 2,        \
+                   ((size) << 18) | ((subc)*0x2000 + (start)) ); \
+          nvdev->cmd_ptr = nvdrv->dma_base;                      \
+          nvdev->cmd_ptr += nvdev->dma_cur + 1;                  \
+          nvdev->dma_cur += (size) + 1;                          \
+          D_ASSERT( nvdev->dma_cur <= nvdev->dma_max );          \
+     } else {                                                    \
+          nv_waitfifo( nvdrv, nvdev, size );                     \
+          nvdev->cmd_ptr = (nvdrv->mmio_base + FIFO_ADDRESS +    \
+                            (subc)*0x2000 + (start));            \
+     }                                                           \
+}
+
+/* Output to ring/register */
+#define nv_outr( value )  *nvdev->cmd_ptr++ = (value)
+
+
+#endif /* __NVIDIA_ACCEL_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_objects.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_objects.h
new file mode 100755
index 0000000..a0e329f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_objects.h
@@ -0,0 +1,160 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NVIDIA_OBJECTS_H__
+#define __NVIDIA_OBJECTS_H__
+
+#include "nvidia.h"
+#include "nvidia_accel.h"
+
+/* Engine */
+#define ENGINE_SW        0
+#define ENGINE_GRAPHICS  1
+#define ENGINE_DVD       2
+
+
+static __inline__ u32
+nv_hashkey( u32 obj )
+{
+     return ((obj >>  0) & 0x000001FF) ^
+            ((obj >>  9) & 0x000001FF) ^
+            ((obj >> 18) & 0x000001FF) ^
+            ((obj >> 27) & 0x000001FF) ^ (0 << 5); /* channel 0 */
+}
+
+
+/* DMA flags */
+#define DMA_FLAG_PAGE_TABLE        (1 << 12) /* valid */
+#define DMA_FLAG_PAGE_ENTRY_NONLIN (0 << 13)
+#define DMA_FLAG_PAGE_ENTRY_LINEAR (1 << 13) 
+#define DMA_FLAG_ACCESS_RDWR       (0 << 14)
+#define DMA_FLAG_ACCESS_RDONLY     (1 << 14) 
+#define DMA_FLAG_ACCESS_WRONLY     (2 << 14)
+#define DMA_FLAG_TARGET_NVM        (0 << 16) 
+#define DMA_FLAG_TARGET_NVM_TILED  (1 << 16)
+#define DMA_FLAG_TARGET_PCI        (2 << 16)
+#define DMA_FLAG_TARGET_AGP        (3 << 16)
+
+/* DMA frame access */
+#define DMA_FRAME_UNKNOWN_FLAG     (1 << 0)
+#define DMA_FRAME_ACCESS_RDONLY    (0 << 1)
+#define DMA_FRAME_ACCESS_RDWR      (1 << 1)
+
+static inline void
+nv_store_dma( NVidiaDriverData *nvdrv, u32 obj,
+              u32 addr, u32 class, u32 flags,
+              u32 size, u32 frame, u32 access )
+{
+     volatile void *mmio = nvdrv->mmio_base;
+     u32            key  = nv_hashkey( obj );
+     u32            ctx  = addr | (ENGINE_SW << 16) | (1 << 31);
+     
+     /* NV_PRAMIN_RAMRO_0 */
+     nv_out32( mmio, PRAMIN + (addr << 4) +  0, class | flags );
+     nv_out32( mmio, PRAMIN + (addr << 4) +  4, size - 1 );
+     nv_out32( mmio, PRAMIN + (addr << 4) +  8, (frame & 0xFFFFF000) | access );
+     nv_out32( mmio, PRAMIN + (addr << 4) + 12, (frame & 0xFFFFF000) | access );
+
+     /* store object id and context */
+     nv_out32( mmio, PRAMHT + (key << 3) + 0, obj );
+     nv_out32( mmio, PRAMHT + (key << 3) + 4, ctx );
+}
+
+
+/* Context flags */
+#define CTX_FLAG_CHROMA_KEY                 (1 << 12)
+#define CTX_FLAG_USER_CLIP                  (1 << 13)
+#define CTX_FLAG_SWIZZLE                    (1 << 14)
+#define CTX_FLAG_PATCH_COPY                 (0 << 15)
+#define CTX_FLAG_PATCH_ROP                  (1 << 15)
+#define CTX_FLAG_PATCH_BLEND                (2 << 15)
+#define CTX_FLAG_PATCH_SRCCOPY              (3 << 15)
+#define CTX_FLAG_PATCH_COLOR_MULTIPLY       (4 << 15)
+#define CTX_FLAG_PATCH_BLEND_PREMULTIPLIED  (5 << 15)
+#define CTX_FLAG_SYNCHRONIZE                (1 << 18)
+#define CTX_FLAG_ENDIAN_LITTLE              (0 << 19)
+#define CTX_FLAG_ENDIAN_BIG                 (1 << 19)
+#define CTX_FLAG_CONVERSION_COMPAT          (0 << 20)
+#define CTX_FLAG_CONVERSION_DITHER          (1 << 20)
+#define CTX_FLAG_CONVERSION_TRUNC           (2 << 20)
+#define CTX_FLAG_CONVERSION_SUB_TRUNC       (3 << 20)
+#define CTX_FLAG_SINGLE_STEP                (1 << 23)
+#define CTX_FLAG_PATCH                      (1 << 24) /* valid */
+#define CTX_FLAG_CTX_SURFACE0               (1 << 25) /* valid */
+#define CTX_FLAG_CTX_SURFACE1               (1 << 26) /* valid */
+#define CTX_FLAG_CTX_PATTERN                (1 << 27) /* valid */
+#define CTX_FLAG_CTX_ROP                    (1 << 28) /* valid */
+#define CTX_FLAG_CTX_BETA1                  (1 << 29) /* valid */
+#define CTX_FLAG_CTX_BETA4                  (1 << 30) /* valid */
+
+
+static inline void
+nv_store_object( NVidiaDriverData *nvdrv, 
+                 u32 obj,   u32 addr,
+                 u32 class, u32 flags,
+                 u32 dma0,  u32 dma1 )
+{
+     volatile void *mmio = nvdrv->mmio_base;
+     u32            key  = nv_hashkey( obj );
+     u32            ctx  = addr | (ENGINE_GRAPHICS << 16) | (1 << 31);
+     
+     /* set the endian flag here, for simplicity */
+#ifdef WORDS_BIGENDIAN
+     flags |= CTX_FLAG_ENDIAN_BIG;
+#endif
+     /* NV_PRAMIN_CTX_0 */
+     nv_out32( mmio, PRAMIN + (addr << 4) +  0, class | flags );
+     /* NV_PRAMIN_CTX_1 */
+     nv_out32( mmio, PRAMIN + (addr << 4) +  4, 0x00000000 ); /* color */
+     /* NV_PRAMIN_CTX_2 */
+     nv_out32( mmio, PRAMIN + (addr << 4) +  8, dma0 | (dma1 << 16) );
+     /* NV_PRAMIN_CTX_3 */
+     nv_out32( mmio, PRAMIN + (addr << 4) + 12, 0x00000000 ); /* traps */
+
+     /* store object id and context */
+     nv_out32( mmio, PRAMHT + (key << 3) + 0, obj );
+     nv_out32( mmio, PRAMHT + (key << 3) + 4, ctx );
+}
+
+
+static inline void
+nv_assign_object( NVidiaDriverData *nvdrv,
+                  NVidiaDeviceData *nvdev,
+                  int               subc,
+                  u32               object,
+                  bool              reset )
+{
+     if (reset || nvdev->subchannel_object[subc] != object) {
+          nv_begin( subc, SET_OBJECT, 1 );
+          nv_outr( object );
+
+          nvdev->subchannel_object[subc] = object;
+     }
+}
+
+#endif /* __NVIDIA_OBJECTS_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_overlay.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia_overlay.c
new file mode 100755
index 0000000..747f14c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_overlay.c
@@ -0,0 +1,566 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Oliver Schwartz <Oliver.Schwartz@gmx.de> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+
+#include <core/coredefs.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+
+#include <core/layers.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers_internal.h>
+
+#include <gfx/convert.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+
+
+typedef struct {
+     CoreLayerRegionConfig  config;
+     CoreSurface           *videoSurface;
+     CoreSurfaceBufferLock *lock;
+     
+     short                  brightness;
+     short                  contrast;
+     short                  hue;
+     short                  saturation;
+     int                    field;
+
+     struct {
+          u32 BUFFER;
+          u32 STOP;
+          u32 UVBASE_0;
+          u32 UVBASE_1;
+          u32 UVOFFSET_0;
+          u32 UVOFFSET_1;
+          u32 BASE_0;
+          u32 BASE_1;
+          u32 OFFSET_0;
+          u32 OFFSET_1;
+          u32 SIZE_IN_0;
+          u32 SIZE_IN_1;
+          u32 POINT_IN_0;
+          u32 POINT_IN_1;
+          u32 DS_DX_0;
+          u32 DS_DX_1;
+          u32 DT_DY_0;
+          u32 DT_DY_1;
+          u32 POINT_OUT_0;
+          u32 POINT_OUT_1;
+          u32 SIZE_OUT_0;
+          u32 SIZE_OUT_1;
+          u32 FORMAT_0;
+          u32 FORMAT_1;
+     } regs;
+} NVidiaOverlayLayerData;
+
+static void ov0_set_regs    ( NVidiaDriverData           *nvdrv,
+                              NVidiaOverlayLayerData     *nvov0,
+                              CoreLayerRegionConfigFlags  flags );
+static void ov0_calc_regs   ( NVidiaDriverData           *nvdrv,
+                              NVidiaOverlayLayerData     *nvov0,
+                              CoreLayerRegionConfig      *config,
+                              CoreLayerRegionConfigFlags  flags );
+static void ov0_set_colorkey( NVidiaDriverData       *nvdrv,
+                              NVidiaOverlayLayerData *nvov0,
+                              CoreLayerRegionConfig  *config );
+static void ov0_set_csc     ( NVidiaDriverData       *nvdrv,
+                              NVidiaOverlayLayerData *nvov0 );
+
+#define OV0_SUPPORTED_OPTIONS \
+     ( DLOP_DST_COLORKEY | DLOP_DEINTERLACING )
+
+/**********************/
+
+
+
+static int
+ov0LayerDataSize( void )
+{
+     return sizeof(NVidiaOverlayLayerData);
+}
+
+static DFBResult
+ov0InitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     NVidiaDriverData       *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaOverlayLayerData *nvov0 = (NVidiaOverlayLayerData*) layer_data;
+     
+     /* set capabilities and type */
+     description->caps =  DLCAPS_SURFACE      | DLCAPS_SCREEN_LOCATION |
+                          DLCAPS_BRIGHTNESS   | DLCAPS_CONTRAST        |
+                          DLCAPS_SATURATION   | DLCAPS_HUE             |
+                          DLCAPS_DST_COLORKEY | DLCAPS_DEINTERLACING;
+     description->type = DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "NVidia 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 | DCAF_HUE;
+     adjustment->brightness = 0x8000;
+     adjustment->contrast   = 0x8000;
+     adjustment->saturation = 0x8000;
+     adjustment->hue        = 0x8000;
+ 
+     /* reset overlay */
+     nvov0->brightness = 0;
+     nvov0->contrast   = 4096;
+     nvov0->hue        = 0;
+     nvov0->saturation = 4096;
+     ov0_set_csc( nvdrv, nvov0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0Remove( CoreLayer *layer,
+           void      *driver_data,
+           void      *layer_data,
+           void      *region_data )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     volatile u8      *mmio  = nvdrv->mmio_base;
+     
+     /* disable overlay */
+     nv_out32( mmio, PVIDEO_STOP, PVIDEO_STOP_OVERLAY_ACTIVE | 
+                                  PVIDEO_STOP_METHOD_IMMEDIATELY );
+     nv_out32( mmio, PVIDEO_BUFFER, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0TestRegion(CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags *failed )
+{
+     NVidiaDriverData           *nvdrv = driver_data;
+     NVidiaDeviceData           *nvdev = nvdrv->device_data;
+     CoreLayerRegionConfigFlags  fail  = CLRCF_NONE;
+
+
+     /* check for unsupported options */
+     if (config->options & ~OV0_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     /* check buffermode */
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+          case DLBM_TRIPLE:
+               break;
+
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+
+     /* check pixel format */
+     switch (config->format) { 
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               break;
+
+          case DSPF_NV12:
+          /*case DSPF_NV21:*/
+               if (nvdev->arch < NV_ARCH_30)
+                    fail |= CLRCF_FORMAT;
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+               break;
+     }
+
+     /* check width */
+     if (config->width > 2046 || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 2046 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0SetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     NVidiaDriverData       *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaOverlayLayerData *nvov0 = (NVidiaOverlayLayerData*) layer_data;
+     
+     /* remember configuration */
+     nvov0->config = *config;
+     
+     nvov0->videoSurface = surface;
+     nvov0->lock = lock;
+
+     /* set configuration */
+     if (updated & (CLRCF_WIDTH  | CLRCF_HEIGHT | CLRCF_FORMAT  |
+                    CLRCF_SOURCE | CLRCF_DEST   | CLRCF_OPTIONS | CLRCF_OPACITY))
+     {
+          ov0_calc_regs( nvdrv, nvov0, config, updated );
+          ov0_set_regs( nvdrv, nvov0, updated );
+     }
+
+     /* set destination colorkey */
+     if (updated & CLRCF_DSTKEY)
+          ov0_set_colorkey( nvdrv, nvov0, config );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0FlipRegion ( CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreSurface           *surface,
+                DFBSurfaceFlipFlags    flags,
+                CoreSurfaceBufferLock *lock )
+{
+     NVidiaDriverData       *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaOverlayLayerData *nvov0 = (NVidiaOverlayLayerData*) layer_data;
+    
+     nvov0->videoSurface = surface;
+     nvov0->lock = lock;
+
+     dfb_surface_flip( nvov0->videoSurface, false );
+
+     ov0_calc_regs( nvdrv, nvov0, &nvov0->config, CLRCF_SURFACE );
+     ov0_set_regs( nvdrv, nvov0, CLRCF_SURFACE );
+
+     if (flags & DSFLIP_WAIT)
+          dfb_layer_wait_vsync( layer );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+ov0SetColorAdjustment( CoreLayer          *layer,
+                       void               *driver_data,
+                       void               *layer_data,
+                       DFBColorAdjustment *adj )
+{
+     NVidiaDriverData       *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaOverlayLayerData *nvov0 = (NVidiaOverlayLayerData*) layer_data;
+
+     if (adj->flags & DCAF_BRIGHTNESS) {
+          nvov0->brightness = (adj->brightness >> 8) - 128;
+          D_DEBUG( "DirectFB/NVidia/Overlay: brightness=%i\n", nvov0->brightness );
+     }
+
+     if (adj->flags & DCAF_CONTRAST) {
+          nvov0->contrast   = 8191 - (adj->contrast >> 3); /* contrast inverted ?! */
+          D_DEBUG( "DirectFB/NVidia/Overlay: contrast=%i\n", nvov0->contrast );
+     }
+
+     if (adj->flags & DCAF_SATURATION) {
+          nvov0->saturation = adj->saturation >> 3;
+          D_DEBUG( "DirectFB/NVidia/Overlay: saturation=%i\n", nvov0->saturation );
+     }
+
+     if (adj->flags & DCAF_HUE) {
+          nvov0->hue        = (adj->hue / 182 - 180) % 360;
+          D_DEBUG( "DirectFB/NVidia/Overlay: hue=%i\n", nvov0->hue );
+     }
+
+     ov0_set_csc( nvdrv, nvov0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ov0SetInputField( CoreLayer *layer,
+                  void      *driver_data,
+                  void      *layer_data,
+                  void      *region_data,
+                  int        field )
+{
+     NVidiaDriverData       *nvdrv = (NVidiaDriverData*) driver_data;
+     NVidiaOverlayLayerData *nvov0 = (NVidiaOverlayLayerData*) layer_data;
+    
+     nvov0->field = field;
+     nvov0->regs.BUFFER = 1 << (field << 2);
+     
+     nv_out32( nvdrv->mmio_base, PVIDEO_BUFFER, nvov0->regs.BUFFER );
+     
+     return DFB_OK;
+}
+
+DisplayLayerFuncs nvidiaOverlayFuncs = {
+     .LayerDataSize      = ov0LayerDataSize,
+     .InitLayer          = ov0InitLayer,
+     .SetRegion          = ov0SetRegion,
+     .RemoveRegion       = ov0Remove,
+     .TestRegion         = ov0TestRegion,
+     .FlipRegion         = ov0FlipRegion,
+     .SetColorAdjustment = ov0SetColorAdjustment,
+     .SetInputField      = ov0SetInputField,
+};
+
+
+/* internal */
+
+static void ov0_set_regs( NVidiaDriverData           *nvdrv, 
+                          NVidiaOverlayLayerData     *nvov0,
+                          CoreLayerRegionConfigFlags  flags )
+{
+     volatile u8 *mmio = nvdrv->mmio_base;
+     
+     if (flags & CLRCF_SURFACE) {
+          if (DFB_PLANAR_PIXELFORMAT(nvov0->config.format)) { 
+               nv_out32( mmio, PVIDEO_UVBASE_0, nvov0->regs.UVBASE_0 );
+               nv_out32( mmio, PVIDEO_UVBASE_1, nvov0->regs.UVBASE_1 );
+               nv_out32( mmio, PVIDEO_UVOFFSET_0, nvov0->regs.UVOFFSET_0 );
+               nv_out32( mmio, PVIDEO_UVOFFSET_1, nvov0->regs.UVOFFSET_1 );
+          }
+          nv_out32( mmio, PVIDEO_BASE_0, nvov0->regs.BASE_0 );
+          nv_out32( mmio, PVIDEO_BASE_1, nvov0->regs.BASE_1 );
+          nv_out32( mmio, PVIDEO_OFFSET_0, nvov0->regs.OFFSET_0 );
+          nv_out32( mmio, PVIDEO_OFFSET_1, nvov0->regs.OFFSET_1 );
+     }
+     if (flags & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_OPTIONS)) {
+          nv_out32( mmio, PVIDEO_SIZE_IN_0, nvov0->regs.SIZE_IN_0 );
+          nv_out32( mmio, PVIDEO_SIZE_IN_1, nvov0->regs.SIZE_IN_1 );
+     }
+     if (flags & (CLRCF_SOURCE | CLRCF_DEST | CLRCF_OPTIONS)) {
+          nv_out32( mmio, PVIDEO_POINT_IN_0, nvov0->regs.POINT_IN_0 );
+          nv_out32( mmio, PVIDEO_POINT_IN_1, nvov0->regs.POINT_IN_1 );
+          nv_out32( mmio, PVIDEO_DS_DX_0,    nvov0->regs.DS_DX_0 );
+          nv_out32( mmio, PVIDEO_DS_DX_1,    nvov0->regs.DS_DX_1 );
+          nv_out32( mmio, PVIDEO_DT_DY_0,    nvov0->regs.DT_DY_0 );
+          nv_out32( mmio, PVIDEO_DT_DY_1,    nvov0->regs.DT_DY_1 );
+     }
+     if (flags & CLRCF_DEST) {
+          nv_out32( mmio, PVIDEO_POINT_OUT_0, nvov0->regs.POINT_OUT_0 );
+          nv_out32( mmio, PVIDEO_POINT_OUT_1, nvov0->regs.POINT_OUT_1 );
+          nv_out32( mmio, PVIDEO_SIZE_OUT_0,  nvov0->regs.SIZE_OUT_0 );
+          nv_out32( mmio, PVIDEO_SIZE_OUT_1,  nvov0->regs.SIZE_OUT_1 );
+     }
+     if (flags & (CLRCF_FORMAT | CLRCF_SURFACE | CLRCF_OPTIONS)) {
+          nv_out32( mmio, PVIDEO_FORMAT_0, nvov0->regs.FORMAT_0 );
+          nv_out32( mmio, PVIDEO_FORMAT_1, nvov0->regs.FORMAT_1 );
+     }
+     nv_out32( mmio, PVIDEO_BUFFER, nvov0->regs.BUFFER );
+     nv_out32( mmio, PVIDEO_STOP,   nvov0->regs.STOP );
+}
+
+static void
+ov0_calc_regs( NVidiaDriverData           *nvdrv,
+               NVidiaOverlayLayerData     *nvov0,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags  flags )
+{
+     NVidiaDeviceData *nvdev = nvdrv->device_data;
+ 
+     if (flags & (CLRCF_WIDTH  | CLRCF_HEIGHT | 
+                  CLRCF_SOURCE | CLRCF_DEST   | CLRCF_OPTIONS)) {
+          int          width  = config->width;
+          int          height = config->height;
+          DFBRectangle source = config->source;
+          DFBRectangle dest   = config->dest;
+     
+          source.x <<= 4;
+          source.y <<= 4;
+     
+          if (dest.x < 0) {
+               source.x -= (dest.x * source.w << 4) / dest.w;
+               source.w += dest.x * source.w / dest.w;
+               dest.w   += dest.x;
+               dest.x    = 0;
+          }
+
+          if (dest.y < 0) {
+               source.y -= (dest.y * source.h << 4) / dest.h;
+               source.h += dest.y * source.h / dest.h;
+               dest.h   += dest.y;
+               dest.y    = 0;
+          }
+
+          if (config->options & DLOP_DEINTERLACING) {
+               height   /= 2;
+               source.y /= 2;
+               source.h /= 2;
+          }
+
+          if (source.w < 1 || source.h < 1 || dest.w < 1 || dest.h < 1) {
+               nvov0->regs.STOP = PVIDEO_STOP_OVERLAY_ACTIVE |
+                                  PVIDEO_STOP_METHOD_NORMALLY;
+               return;
+          }
+          
+          nvov0->regs.SIZE_IN_0   = 
+          nvov0->regs.SIZE_IN_1   = ((height << 16) & PVIDEO_SIZE_IN_HEIGHT_MSK) |
+                                    ( width         & PVIDEO_SIZE_IN_WIDTH_MSK);
+          nvov0->regs.POINT_IN_0  =
+          nvov0->regs.POINT_IN_1  = ((source.y << 16) & PVIDEO_POINT_IN_T_MSK) |
+                                    ( source.x        & PVIDEO_POINT_IN_S_MSK);
+          nvov0->regs.DS_DX_0     =
+          nvov0->regs.DS_DX_1     = (source.w << 20) / dest.w;
+          nvov0->regs.DT_DY_0     =
+          nvov0->regs.DT_DY_1     = (source.h << 20) / dest.h;
+          nvov0->regs.POINT_OUT_0 =
+          nvov0->regs.POINT_OUT_1 = ((dest.y << 16) & PVIDEO_POINT_OUT_Y_MSK) |
+                                    ( dest.x        & PVIDEO_POINT_OUT_X_MSK);
+          nvov0->regs.SIZE_OUT_0  =
+          nvov0->regs.SIZE_OUT_1  = ((dest.h << 16) & PVIDEO_SIZE_OUT_HEIGHT_MSK) |
+                                    ( dest.w        & PVIDEO_SIZE_OUT_WIDTH_MSK);
+     }
+     
+     if (flags & (CLRCF_SURFACE | CLRCF_FORMAT | CLRCF_OPTIONS)) {
+          CoreSurfaceBufferLock *lock = nvov0->lock;
+          u32                    format;
+          
+          if (config->options & DLOP_DEINTERLACING)
+               format = (lock->pitch*2) & PVIDEO_FORMAT_PITCH_MSK;
+          else
+               format =  lock->pitch    & PVIDEO_FORMAT_PITCH_MSK;
+               
+          if (DFB_PLANAR_PIXELFORMAT(config->format))
+               format |= PVIDEO_FORMAT_PLANAR_NV;
+    
+          if (config->format == DSPF_UYVY)
+               format |= PVIDEO_FORMAT_COLOR_YB8CR8YA8CB8;
+          else
+               format |= PVIDEO_FORMAT_COLOR_CR8YB8CB8YA8;
+
+          if (config->options & DLOP_DST_COLORKEY)
+               format |= PVIDEO_FORMAT_DISPLAY_COLOR_KEY_EQUAL;
+               
+          /* Use Buffer 0 for Odd field */
+          nvov0->regs.OFFSET_0   = (nvdev->fb_offset + lock->offset) & PVIDEO_OFFSET_MSK;
+          /* Use Buffer 1 for Even field */
+          nvov0->regs.OFFSET_1   = nvov0->regs.OFFSET_0 + lock->pitch;
+          if (DFB_PLANAR_PIXELFORMAT(config->format)) {
+               CoreSurface *surface = nvov0->videoSurface;
+               nvov0->regs.UVOFFSET_0 = (nvov0->regs.OFFSET_0 + 
+                                         lock->pitch * surface->config.size.h) & PVIDEO_UVOFFSET_MSK;
+               nvov0->regs.UVOFFSET_1 = nvov0->regs.UVOFFSET_0 + lock->pitch;
+          }
+          nvov0->regs.FORMAT_0 = 
+          nvov0->regs.FORMAT_1 = format;
+     }
+ 
+     nvov0->regs.BUFFER = 1 << (nvov0->field << 2);
+     nvov0->regs.STOP   = (config->opacity)
+                          ? PVIDEO_STOP_OVERLAY_INACTIVE
+                          : PVIDEO_STOP_OVERLAY_ACTIVE;
+     nvov0->regs.STOP  |= PVIDEO_STOP_METHOD_NORMALLY;
+}
+
+static void
+ov0_set_colorkey( NVidiaDriverData       *nvdrv,
+                  NVidiaOverlayLayerData *nvov0,
+                  CoreLayerRegionConfig  *config )
+{
+     u32 key;
+     
+     key = dfb_color_to_pixel( dfb_primary_layer_pixelformat(),
+                               config->dst_key.r,
+                               config->dst_key.g,
+                               config->dst_key.b );
+   
+     nv_out32( nvdrv->mmio_base, PVIDEO_COLOR_KEY, key );
+}
+
+static void
+ov0_set_csc( NVidiaDriverData       *nvdrv,
+             NVidiaOverlayLayerData *nvov0 )
+{
+     volatile u8 *mmio = nvdrv->mmio_base;
+     s32          satSine;
+     s32          satCosine;
+     double       angle;
+
+     angle = (double) nvov0->hue * M_PI / 180.0;
+     satSine = nvov0->saturation * sin(angle);
+     if (satSine < -1024)
+          satSine = -1024;
+     satCosine = nvov0->saturation * cos(angle);
+     if (satCosine < -1024)
+          satCosine = -1024;
+
+     nv_out32( mmio, PVIDEO_LUMINANCE_0, (nvov0->brightness << 16) |
+                                         (nvov0->contrast & 0xffff) );
+     nv_out32( mmio, PVIDEO_LUMINANCE_1, (nvov0->brightness << 16) |
+                                         (nvov0->contrast & 0xffff) );
+     nv_out32( mmio, PVIDEO_CHROMINANCE_0, (satSine << 16) |
+                                           (satCosine & 0xffff) );
+     nv_out32( mmio, PVIDEO_CHROMINANCE_1, (satSine << 16) |
+                                           (satCosine & 0xffff) );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_primary.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia_primary.c
new file mode 100755
index 0000000..50bde37
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_primary.c
@@ -0,0 +1,189 @@
+/*
+   Copyright (C) 2005-2006 Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+#include <core/system.h>
+#include <core/screen.h>
+#include <core/layer_control.h>
+
+#include <misc/conf.h>
+
+#include <direct/messages.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+
+
+/************************** Primary Screen functions **************************/
+
+static DFBResult
+crtc1InitScreen( CoreScreen           *screen,
+                 CoreGraphicsDevice   *device,
+                 void                 *driver_data,
+                 void                 *screen_data,
+                 DFBScreenDescription *description )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     volatile u8      *mmio  = nvdrv->mmio_base;
+
+     if (OldPrimaryScreenFuncs.InitScreen)
+          OldPrimaryScreenFuncs.InitScreen( screen, device, 
+                                            OldPrimaryScreenDriverData,
+                                            screen_data, description );
+     
+     description->caps |= DSCCAPS_VSYNC;
+
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "NVidia Primary Screen" );
+
+     nv_out32( mmio, PCRTC_INTR_EN, PCRTC_INTR_EN_VBLANK_DISABLED );
+#ifdef WORDS_BIGENDIAN
+     nv_out32( mmio, PCRTC_CONFIG, PCRTC_CONFIG_SIGNAL_HSYNC |
+                                   PCRTC_CONFIG_ENDIAN_BIG );
+#else
+     nv_out32( mmio, PCRTC_CONFIG, PCRTC_CONFIG_SIGNAL_HSYNC |
+                                   PCRTC_CONFIG_ENDIAN_LITTLE );
+#endif
+     nv_out32( mmio, PCRTC_INTR, PCRTC_INTR_VBLANK_RESET );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+crtc1WaitVSync( CoreScreen *screen,
+                void       *driver_data,
+                void       *screen_data )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     volatile u8      *mmio  = nvdrv->mmio_base;
+
+     if (!dfb_config->pollvsync_none) {
+          int i;
+          
+          for (i = 0; i < 2000000; i++) {
+               if (!(nv_in8( mmio, PCIO_CRTC_STATUS ) & 8))
+                    break;
+          }
+
+          for (i = 0; i < 2000000;) {
+               if (nv_in8( mmio, PCIO_CRTC_STATUS ) & 8)
+                    break;
+               
+               i++;
+               if ((i % 2000) == 0) {
+                    struct timespec ts = { 0, 10000 }; 
+                    nanosleep( &ts, NULL );
+               }
+          }
+     }
+
+     return DFB_OK;
+}
+
+#if 0
+static DFBResult
+crtc1GetScreenSize( CoreScreen *screen,
+                    void       *driver_data,
+                    void       *screen_data,
+                    int        *ret_width,
+                    int        *ret_height )
+{
+     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
+     volatile u8      *mmio  = nvdrv->mmio_base;
+     int               w, h;
+     int               val;
+
+     /* stolen from RivaTV */
+     
+	w   = nv_incrtc( mmio, CRTC_HORIZ_DISPLAY_END );
+	w  |= (nv_incrtc( mmio, CRTC_HORIZ_EXTRA ) & 0x02) << 7;
+	w   = (w + 1) << 3;
+	
+	h   = nv_incrtc( mmio, CRTC_VERT_DISPLAY_END );
+	val = nv_incrtc( mmio, CRTC_OVERFLOW );
+	h  |= (val & 0x02) << 7;
+	h  |= (val & 0x40) << 3;
+	h++;
+	h  |= nv_incrtc( mmio, CRTC_EXTRA ) << 9;
+	h  |= nv_incrtc( mmio, 0x41 ) << 9;
+	h >>= (nv_incrtc( mmio, CRTC_MAX_SCAN_LINE ) & 0x80) >> 7;
+	
+     D_DEBUG( "DirectFB/NVidia/Crtc1: "
+              "detected screen resolution %dx%d.\n", w, h );
+
+     *ret_width  = w;
+     *ret_height = h;
+     
+     return DFB_OK;
+}
+#endif
+
+ScreenFuncs nvidiaPrimaryScreenFuncs = {
+     .InitScreen     = crtc1InitScreen,
+     .WaitVSync      = crtc1WaitVSync,
+     //.GetScreenSize  = crtc1GetScreenSize
+};
+
+ScreenFuncs  OldPrimaryScreenFuncs;
+void        *OldPrimaryScreenDriverData;
+
+/*************************** Primary Layer hooks ******************************/
+
+static DFBResult
+fb0FlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     NVidiaDriverData *nvdrv  = (NVidiaDriverData*) driver_data;
+     NVidiaDeviceData *nvdev  = nvdrv->device_data;
+     u32               offset;
+
+     dfb_surface_flip( surface, false );
+     
+     offset = (lock->offset + nvdev->fb_offset) & ~3;
+     nv_out32( nvdrv->mmio_base, PCRTC_START, offset );
+
+     if (flags & DSFLIP_WAIT)
+          dfb_layer_wait_vsync( layer );
+
+     return DFB_OK;
+}
+
+
+DisplayLayerFuncs nvidiaPrimaryLayerFuncs = {
+     .FlipRegion     = fb0FlipRegion
+};
+
+DisplayLayerFuncs  OldPrimaryLayerFuncs;
+void              *OldPrimaryLayerDriverData;
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_regs.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_regs.h
new file mode 100755
index 0000000..64257cc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_regs.h
@@ -0,0 +1,1636 @@
+#ifndef __NVIDIA_REGS_H__
+#define __NVIDIA_REGS_H__
+
+
+/* PMC */
+#define PMC              0x00000000
+
+
+
+/* PBUS */
+#define PBUS             0x00001000
+
+
+
+/* PFIFO */
+#define PFIFO            0x00002000
+
+#define PFIFO_DELAY_0                        0x00002040
+#define   PFIFO_DELAY_0_WAIT_RETRY_MSK                 0x000003FF
+
+#define PFIFO_DMA_TIMESLICE                  0x00002044
+#define   PFIFO_DMA_TIMESLICE_SELECT_MSK               0x0001FFFF
+#define   PFIFO_DMA_TIMESLICE_SELECT_1                 0x00000000
+#define   PFIFO_DMA_TIMESLICE_SELECT_16K               0x00003FFF
+#define   PFIFO_DMA_TIMESLICE_SELECT_32K               0x00007FFF
+#define   PFIFO_DMA_TIMESLICE_SELECT_64K               0x0000FFFF
+#define   PFIFO_DMA_TIMESLICE_SELECT_128K              0x0001FFFF
+#define   PFIFO_DMA_TIMESLICE_TIMEOUT_DISABLED         0x00000000
+#define   PFIFO_DMA_TIMESLICE_TIMEOUT_ENABLED          0x01000000
+
+#define PFIFO_PIO_TIMESLICE                  0x00002048
+#define   PFIFO_PIO_TIMESLICE_SELECT_MSK               0x0001FFFF
+#define   PFIFO_PIO_TIMESLICE_SELECT_1                 0x00000000
+#define   PFIFO_PIO_TIMESLICE_SELECT_16K               0x00003FFF
+#define   PFIFO_PIO_TIMESLICE_SELECT_32K               0x00007FFF
+#define   PFIFO_PIO_TIMESLICE_SELECT_64K               0x0000FFFF
+#define   PFIFO_PIO_TIMESLICE_SELECT_128K              0x0001FFFF
+#define   PFIFO_PIO_TIMESLICE_TIMEOUT_DISABLED         0x00000000
+#define   PFIFO_PIO_TIMESLICE_TIMEOUT_ENABLED          0x01000000
+
+#define PFIFO_TIMESLICE                      0x0000204C
+#define   PFIFO_TIMESLICE_TIMER_MSK                    0x0003FFFF
+
+#define PFIFO_NEXT_CHANNEL                   0x00002050
+#define   PFIFO_NEXT_CHANNEL_CHID_MSK                  0x0000001F
+#define   PFIFO_NEXT_CHANNEL_MODE_PIO                  0x00000000
+#define   PFIFO_NEXT_CHANNEL_MODE_DMA                  0x00000100
+#define   PFIFO_NEXT_CHANNEL_SWITCH_NOT_PENDING        0x00000000
+#define   PFIFO_NEXT_CHANNEL_SWITCH_PENDING            0x00001000
+
+#define PFIFO_DEBUG_0                        0x00002080
+#define   PFIFO_DEBUG_0_CACHE_ERROR0_NOT_PENDING       0x00000000
+#define   PFIFO_DEBUG_0_CACHE_ERROR0_PENDING           0x00000001
+#define   PFIFO_DEBUG_0_CACHE_ERROR1_NOT_PENDING       0x00000000
+#define   PFIFO_DEBUG_0_CACHE_ERROR1_PENDING           0x00000010
+
+#define PFIFO_INTR                           0x00002100
+#define   PFIFO_INTR_RESET                             0xFFFFFFFF
+#define   PFIFO_INTR_CACHE_ERROR_NOT_PENDING           0x00000000
+#define   PFIFO_INTR_CACHE_ERROR_PENDING               0x00000001
+#define   PFIFO_INTR_CACHE_ERROR_RESET                 0x00000001
+#define   PFIFO_INTR_RUNOUT_NOT_PENDING                0x00000000
+#define   PFIFO_INTR_RUNOUT_PENDING                    0x00000010
+#define   PFIFO_INTR_RUNOUT_RESET                      0x00000010
+#define   PFIFO_INTR_RUNOUT_OVERFLOW_NOT_PENDING       0x00000000
+#define   PFIFO_INTR_RUNOUT_OVERFLOW_PENDING           0x00000100
+#define   PFIFO_INTR_RUNOUT_OVERFLOW_RESET             0x00000100
+#define   PFIFO_INTR_DMA_PUSHER_NOT_PENDING            0x00000000
+#define   PFIFO_INTR_DMA_PUSHER_PENDING                0x00001000
+#define   PFIFO_INTR_DMA_PUSHER_RESET                  0x00001000
+#define   PFIFO_INTR_DMA_PT_NOT_PENDING                0x00000000
+#define   PFIFO_INTR_DMA_PT_PENDING                    0x00010000
+#define   PFIFO_INTR_DMA_PT_RESET                      0x00010000
+#define   PFIFO_INTR_SEMAPHORE_NOT_PENDING             0x00000000
+#define   PFIFO_INTR_SEMAPHORE_PENDING                 0x00100000
+#define   PFIFO_INTR_SEMAPHORE_RESET                   0x00100000
+#define   PFIFO_INTR_ACQUIRE_TIMEOUT_NOT_PENDING       0x00000000
+#define   PFIFO_INTR_ACQUIRE_TIMEOUT_PENDING           0x01000000
+#define   PFIFO_INTR_ACQUIRE_TIMEOUT_RESET             0x01000000
+
+#define PFIFO_INTR_EN                        0x00002140
+#define   PFIFO_INTR_EN_DISABLED                       0x00000000
+#define   PFIFO_INTR_EN_CACHE_ERROR_DISABLED           0x00000000
+#define   PFIFO_INTR_EN_CACHE_ERROR_ENABLED            0x00000001
+#define   PFIFO_INTR_EN_RUNOUT_DISABLED                0x00000000
+#define   PFIFO_INTR_EN_RUNOUT_ENABLED                 0x00000010
+#define   PFIFO_INTR_EN_RUNOUT_OVERFLOW_DISABLED       0x00000000
+#define   PFIFO_INTR_EN_RUNOUT_OVERFLOW_ENABLED        0x00000100
+#define   PFIFO_INTR_EN_DMA_PUSHER_DISABLED            0x00000000
+#define   PFIFO_INTR_EN_DMA_PUSHER_ENABLED             0x00001000
+#define   PFIFO_INTR_EN_DMA_PT_DISABLED                0x00000000
+#define   PFIFO_INTR_EN_DMA_PT_ENABLED                 0x00010000
+#define   PFIFO_INTR_EN_SEMAPHORE_DISABLED             0x00000000
+#define   PFIFO_INTR_EN_SEMAPHORE_ENABLED              0x00100000
+#define   PFIFO_INTR_EN_ACQUIRE_TIMEOUT_DISABLED       0x00000000
+#define   PFIFO_INTR_EN_ACQUIRE_TIMEOUT_ENABLED        0x01000000
+
+#define PFIFO_RAMHT                          0x00002210
+#define   PFIFO_RAMHT_BASE_ADDRESS_MSK                 0x000001F0
+#define   PFIFO_RAMHT_SIZE_4K	                         0x00000000
+#define   PFIFO_RAMHT_SIZE_8K	                         0x00010000
+#define   PFIFO_RAMHT_SIZE_16K                         0x00020000
+#define   PFIFO_RAMHT_SIZE_32K                         0x00030000
+#define   PFIFO_RAMHT_SEARCH_16                        0x00000000
+#define   PFIFO_RAMHT_SEARCH_32                        0x01000000
+#define   PFIFO_RAMHT_SEARCH_64                        0x02000000
+#define   PFIFO_RAMHT_SEARCH_128                       0x03000000
+
+#define PFIFO_RAMFC                          0x00002214
+#define   PFIFO_RAMFC_BASE_ADDRESS_MSK                 0x000001F8
+
+#define PFIFO_RAMRO	                         0x00002218
+#define   PFIFO_RAMRO_BASE_ADDRESS_MSK                 0x000001FE
+#define   PFIFO_RAMRO_BASE_ADDRESS_11800               0x00000118
+#define   PFIFO_RAMRO_BASE_ADDRESS_11400               0x00000114
+#define   PFIFO_RAMRO_BASE_ADDRESS_11200               0x00000112
+#define   PFIFO_RAMRO_BASE_ADDRESS_12000               0x00000120
+#define   PFIFO_RAMRO_SIZE_512                         0x00000000
+#define   PFIFO_RAMRO_SIZE_8K                          0x00010000
+
+#define PFIFO_CACHES                         0x00002500
+#define   PFIFO_CACHES_REASSIGN_DISABLED               0x00000000
+#define   PFIFO_CACHES_REASSIGN_ENABLED                0x00000001
+#define   PFIFO_CACHES_DMA_SUSPEND_IDLE                0x00000000
+#define   PFIFO_CACHES_DMA_SUSPEND_BUSY                0x00000010
+
+#define PFIFO_MODE                           0x00002504
+#define   PFIFO_MODE_CHANNEL_0_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_0_DMA                     0x00000001
+#define   PFIFO_MODE_CHANNEL_1_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_1_DMA	                    0x00000002
+#define   PFIFO_MODE_CHANNEL_2_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_2_DMA                     0x00000004
+#define   PFIFO_MODE_CHANNEL_3_PIO	                    0x00000000
+#define   PFIFO_MODE_CHANNEL_3_DMA                     0x00000008
+#define   PFIFO_MODE_CHANNEL_4_PIO	                    0x00000000
+#define   PFIFO_MODE_CHANNEL_4_DMA	                    0x00000010
+#define   PFIFO_MODE_CHANNEL_5_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_5_DMA                     0x00000020
+#define   PFIFO_MODE_CHANNEL_6_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_6_DMA	                    0x00000040
+#define   PFIFO_MODE_CHANNEL_7_PIO                     0x00000000
+#define   PFIFO_MODE_CHANNEL_7_DMA                     0x00000080
+
+#define PFIFO_DMA                            0x00002508
+#define   PFIFO_DMA_CHANNEL_0_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_0_PENDING                  0x00000001
+#define   PFIFO_DMA_CHANNEL_1_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_1_PENDING                  0x00000002
+#define   PFIFO_DMA_CHANNEL_2_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_2_PENDING                  0x00000004
+#define   PFIFO_DMA_CHANNEL_3_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_3_PENDING                  0x00000008
+#define   PFIFO_DMA_CHANNEL_4_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_4_PENDING                  0x00000010
+#define   PFIFO_DMA_CHANNEL_5_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_5_PENDING                  0x00000020
+#define   PFIFO_DMA_CHANNEL_6_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_6_PENDING                  0x00000040
+#define   PFIFO_DMA_CHANNEL_7_NOT_PENDING              0x00000000
+#define   PFIFO_DMA_CHANNEL_7_PENDING                  0x00000080
+
+#define PFIFO_SIZE                           0x0000250C
+#define   PFIFO_SIZE_CHANNEL_0_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_0_512_BYTES               0x00000001
+#define   PFIFO_SIZE_CHANNEL_1_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_1_512_BYTES               0x00000002
+#define   PFIFO_SIZE_CHANNEL_2_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_2_512_BYTES               0x00000004
+#define   PFIFO_SIZE_CHANNEL_3_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_3_512_BYTES               0x00000008
+#define   PFIFO_SIZE_CHANNEL_4_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_4_512_BYTES               0x00000010
+#define   PFIFO_SIZE_CHANNEL_5_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_5_512_BYTES               0x00000020
+#define   PFIFO_SIZE_CHANNEL_6_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_6_512_BYTES               0x00000040
+#define   PFIFO_SIZE_CHANNEL_7_124_BYTES               0x00000000
+#define   PFIFO_SIZE_CHANNEL_7_512_BYTES               0x00000080
+
+#define PFIFO_CACHE0_PUSH0                   0x00003000
+#define   PFIFO_CACHE0_PUSH0_ACCESS_DISABLED	          0x00000000
+#define   PFIFO_CACHE0_PUSH0_ACCESS_ENABLED            0x00000001
+
+#define PFIFO_CACHE1_PUSH0                   0x00003200
+#define   PFIFO_CACHE1_PUSH0_ACCESS_DISABLED	          0x00000000
+#define   PFIFO_CACHE1_PUSH0_ACCESS_ENABLED            0x00000001
+
+#define PFIFO_CACHE0_PUSH1                   0x00003004
+#define   PFIFO_CACHE0_PUSH1_CHID_MSK                  0x0000001F
+
+#define PFIFO_CACHE1_PUSH1                   0x00003204
+#define   PFIFO_CACHE1_PUSH1_CHID_MSK                  0x0000001F
+#define   PFIFO_CACHE1_PUSH1_MODE_PIO                  0x00000000
+#define   PFIFO_CACHE1_PUSH1_MODE_DMA                  0x00000100
+
+#define PFIFO_CACHE1_DMA_PUSH                0x00003220
+#define   PFIFO_CACHE1_DMA_PUSH_ACCESS_DISABLED        0x00000000
+#define   PFIFO_CACHE1_DMA_PUSH_ACCESS_ENABLED         0x00000001
+#define   PFIFO_CACHE1_DMA_PUSH_STATE_IDLE             0x00000000
+#define   PFIFO_CACHE1_DMA_PUSH_STATE_BUSY             0x00000010
+#define   PFIFO_CACHE1_DMA_PUSH_BUFFER_NOT_EMPTY       0x00000000
+#define   PFIFO_CACHE1_DMA_PUSH_BUFFER_EMPTY           0x00000100
+#define   PFIFO_CACHE1_DMA_PUSH_STATUS_RUNNING         0x00000000
+#define   PFIFO_CACHE1_DMA_PUSH_STATUS_SUSPENDED       0x00001000
+
+#define PFIFO_CACHE1_DMA_FETCH               0x00003224
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_8_BYTES          0x00000000
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_16_BYTES         0x00000008
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_24_BYTES         0x00000010
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_32_BYTES         0x00000018
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_40_BYTES         0x00000020
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_48_BYTES         0x00000028
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_56_BYTES         0x00000030
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_64_BYTES         0x00000038
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_72_BYTES         0x00000040
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_80_BYTES         0x00000048
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_88_BYTES         0x00000050
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_96_BYTES         0x00000058
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_104_BYTES        0x00000060
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_112_BYTES        0x00000068
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_120_BYTES        0x00000070
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES        0x00000078
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_136_BYTES        0x00000080
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_144_BYTES        0x00000088
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_152_BYTES        0x00000090
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_160_BYTES        0x00000098
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_168_BYTES        0x000000A0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_176_BYTES        0x000000A8
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_184_BYTES        0x000000B0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_192_BYTES        0x000000B8
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_200_BYTES        0x000000C0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_208_BYTES        0x000000C8
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_216_BYTES        0x000000D0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_224_BYTES        0x000000D8
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_232_BYTES        0x000000E0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_240_BYTES        0x000000E8
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_248_BYTES        0x000000F0
+#define   PFIFO_CACHE1_DMA_FETCH_TRIG_256_BYTES        0x000000F8
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_32_BYTES         0x00000000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_64_BYTES         0x00002000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_96_BYTES         0x00004000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES        0x00006000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_160_BYTES        0x00008000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_192_BYTES        0x0000A000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_224_BYTES        0x0000C000
+#define   PFIFO_CACHE1_DMA_FETCH_SIZE_256_BYTES        0x0000E000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_0            0x00000000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_1            0x00010000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_2            0x00020000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_3            0x00030000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_4            0x00040000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_5            0x00050000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_6            0x00060000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_7            0x00070000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8            0x00080000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_9            0x00090000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_10           0x000A0000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_11           0x000B0000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_12	          0x000C0000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_13	          0x000D0000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_14	          0x000E0000
+#define   PFIFO_CACHE1_DMA_FETCH_MAX_REQS_15           0x000F0000
+#define   PFIFO_CACHE1_LITTLE_ENDIAN                   0x00000000
+#define   PFIFO_CACHE1_BIG_ENDIAN                      0x80000000
+
+#define PFIFO_CACHE1_DMA_PUT                 0x00003240
+
+#define PFIFO_CACHE1_DMA_GET                 0x00003244
+
+#define PFIFO_CACHE1_REF	                    0x00003248
+
+#define PFIFO_CACHE1_DMA_SUBROUTINE          0x0000324C
+#define   PFIFO_CACHE1_DMA_SUBROUTINE_OFFSET_MSK       0x1FFFFFFC
+#define   PFIFO_CACHE1_DMA_SUBROUTINE_STATE_INACTIVE   0x00000000
+#define   PFIFO_CACHE1_DMA_SUBROUTINE_STATE_ACTIVE     0x00000001
+
+#define PFIFO_CACHE1_DMA_DCOUNT              0x000032A0
+#define   PFIFO_CACHE1_DMA_DCOUNT_VALUE_MSK            0x00001FFC
+
+#define PFIFO_CACHE1_DMA_GET_JMP_SHADOW      0x000032A4
+
+#define PFIFO_CACHE1_DMA_RSVD_SHADOW         0x000032A8
+
+#define PFIFO_CACHE1_DMA_DATA_SHADOW         0x000032AC
+
+#define PFIFO_CACHE1_DMA_STATE               0x00003228
+#define   PFIFO_CACHE1_DMA_STATE_METHOD_TYPE_INC       0x00000000
+#define   PFIFO_CACHE1_DMA_STATE_METHOD_TYPE_NON_INC   0x00000001
+#define   PFIFO_CACHE1_DMA_STATE_METHOD_MSK            0x00001FFC
+#define   PFIFO_CACHE1_DMA_STATE_SUBCHANNEL            0x0000E000
+#define   PFIFO_CACHE1_DMA_STATE_METHOD_COUNT_MSK      0x1FFC0000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_NONE            0x00000000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_CALL            0x20000000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_NON_CACHE       0x40000000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_RETURN          0x60000000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_RESERVED_CMD    0x80000000
+#define   PFIFO_CACHE1_DMA_STATE_ERROR_PROTECTION	     0xC0000000
+
+#define PFIFO_CACHE1_DMA_INSTANCE            0x0000322C
+
+#define PFIFO_CACHE1_DMA_CTL                 0x00003230
+#define   PFIFO_CACHE1_DMA_CTL_ADJUST_MSK              0x00000FFC
+#define   PFIFO_CACHE1_DMA_CTL_PAGE_TABLE_PRESENT 	0x00001000
+#define   PFIFO_CACHE1_DMA_CTL_PAGE_ENTRY_LINEAR       0x00002000
+#define   PFIFO_CACHE1_DMA_CTL_TARGET_NODE_NVM         0x00000000
+#define   PFIFO_CACHE1_DMA_CTL_TARGET_NODE_PCI         0x00020000
+#define   PFIFO_CACHE1_DMA_CTL_TARGET_NODE_AGP         0x00030000
+#define   PFIFO_CACHE1_DMA_CTL_AT_INFO_INVALID         0x00000000
+#define   PFIFO_CACHE1_DMA_CTL_AT_INFO_VALID           0x80000000
+
+#define PFIFO_CACHE1_DMA_LIMIT               0x00003234
+
+#define PFIFO_CACHE1_DMA_TLB_TAG             0x00003238
+#define   PFIFO_CACHE1_DMA_TLB_TAG_ADDRESS_MSK         0x1FFFF000
+#define   PFIFO_CACHE1_DMA_TLB_TAG_STATE_INVALID       0x00000000
+#define   PFIFO_CACHE1_DMA_TLB_TAG_STATE_VALID         0x00000001
+
+#define PFIFO_CACHE1_DMA_TLB_PTE             0x0000323C
+#define   PFIFO_CACHE1_DMA_TLB_PTE_ADDRESS_MSK         0xFFFFF000
+
+#define PFIFO_CACHE0_PULL0                   0x00003050
+#define   PFIFO_CACHE0_PULL0_ACCESS_DISABLED	          0x00000000
+#define   PFIFO_CACHE0_PULL0_ACCESS_ENABLED            0x00000001
+#define   PFIFO_CACHE0_PULL0_HASH_SUCCEEDED            0x00000000
+#define   PFIFO_CACHE0_PULL0_HASH_FAILED               0x00000010
+#define   PFIFO_CACHE0_PULL0_DEVICE_HARDWARE	          0x00000000
+#define   PFIFO_CACHE0_PULL0_DEVICE_SOFTWARE	          0x00000100
+#define   PFIFO_CACHE0_PULL0_HASH_STATE_IDLE	          0x00000000
+#define   PFIFO_CACHE0_PULL0_HASH_STATE_BUSY	          0x00001000
+
+#define PFIFO_CACHE1_PULL0                   0x00003250
+#define   PFIFO_CACHE1_PULL0_ACCESS_DISABLED	          0x00000000
+#define   PFIFO_CACHE1_PULL0_ACCESS_ENABLED            0x00000001
+#define   PFIFO_CACHE1_PULL0_HASH_SUCCEEDED            0x00000000
+#define   PFIFO_CACHE1_PULL0_HASH_FAILED               0x00000010
+#define   PFIFO_CACHE1_PULL0_DEVICE_HARDWARE	          0x00000000
+#define   PFIFO_CACHE1_PULL0_DEVICE_SOFTWARE           0x00000100
+#define   PFIFO_CACHE1_PULL0_HASH_STATE_IDLE           0x00000000
+#define   PFIFO_CACHE1_PULL0_HASH_STATE_BUSY           0x00001000
+#define   PFIFO_CACHE1_PULL0_ACQUIRE_STATE_IDLE        0x00000000
+#define   PFIFO_CACHE1_PULL0_ACQUIRE_STATE_BUSY        0x00010000
+#define   PFIFO_CACHE1_PULL0_SEMAPHORE_NO_ERROR        0x00000000
+#define   PFIFO_CACHE1_PULL0_SEMAPHORE_BAD_ARG         0x00100000
+#define   PFIFO_CACHE1_PULL0_SEMAPHORE_ISTATE          0x00200000
+
+#define PFIFO_CACHE0_PULL1                   0x00003054
+#define   PFIFO_CACHE0_PULL1_ENGINE_SW                 0x00000000
+#define   PFIFO_CACHE0_PULL1_ENGINE_GRAPHICS	          0x00000001
+#define   PFIFO_CACHE0_PULL1_ENGINE_DVD	               0x00000002
+
+#define PFIFO_CACHE1_PULL1                   0x00003254
+#define   PFIFO_CACHE1_PULL1_ENGINE_SW                 0x00000000
+#define   PFIFO_CACHE1_PULL1_ENGINE_GRAPHICS	          0x00000001
+#define   PFIFO_CACHE1_PULL1_ENGINE_DVD	               0x00000002
+
+#define PFIFO_CACHE1_PULL1_ACQUIRE           0x00000010
+#define   PFIFO_CACHE1_PULL1_ACQUIRE_INACTIVE          0x00000000
+#define   PFIFO_CACHE1_PULL1_ACQUIRE_ACTIVE            0x00000010
+
+#define PFIFO_CACHE1_PULL1_SEM_TARGET_NODE   0x00030000
+#define   PFIFO_CACHE1_PULL1_SEM_TARGET_NODE_NVM       0x00000000
+#define   PFIFO_CACHE1_PULL1_SEM_TARGET_NODE_PCI       0x00020000
+#define   PFIFO_CACHE1_PULL1_SEM_TARGET_NODE_AGP       0x00030000
+
+#define PFIFO_CACHE0_HASH                    0x00003058
+#define   PFIFO_CACHE0_HASH_INSTANCE_MSK               0x0000FFFF
+
+#define PFIFO_CACHE1_HASH                    0x00003258
+#define   PFIFO_CACHE1_HASH_INSTANCE_MSK               0x0000FFFF
+
+#define PFIFO_CACHE1_ACQUIRE_0               0x00003260
+
+#define PFIFO_CACHE1_ACQUIRE_1               0x00003264
+
+#define PFIFO_CACHE1_ACQUIRE_2               0x00003268
+
+#define PFIFO_CACHE1_SEMAPHORE               0x0000326C
+#define   PFIFO_CACHE1_SEMAPHORE_CTXDMA_INVALID        0x00000000
+#define   PFIFO_CACHE1_SEMAPHORE_CTXDMA_VALID          0x00000001
+#define   PFIFO_CACHE1_SEMAPHORE_OFFSET_MSK            0x00000FFC
+#define   PFIFO_CACHE1_SEMAPHORE_PAGE_ADDRESS_MSK      0xFFFFF000
+
+#define PFIFO_CACHE0_STATUS                  0x00003014
+#define   PFIFO_CACHE0_STATUS_LOW_MARK_NOT_EMPTY       0x00000000
+#define   PFIFO_CACHE0_STATUS_LOW_MARK_EMPTY	          0x00000010
+#define   PFIFO_CACHE0_STATUS_HIGH_MARK_NOT_FULL       0x00000000
+#define   PFIFO_CACHE0_STATUS_HIGH_MARK_FULL           0x00000100
+
+#define PFIFO_CACHE1_STATUS                  0x00003214
+#define   PFIFO_CACHE1_STATUS_LOW_MARK_NOT_EMPTY       0x00000000
+#define   PFIFO_CACHE1_STATUS_LOW_MARK_EMPTY           0x00000010
+#define   PFIFO_CACHE1_STATUS_HIGH_MARK_NOT_FULL       0x00000000
+#define   PFIFO_CACHE1_STATUS_HIGH_MARK_FULL           0x00000100
+
+#define PFIFO_CACHE1_STATUS1                 0x00003218
+#define   PFIFO_CACHE1_STATUS1_RANOUT_FALSE            0x00000000
+#define   PFIFO_CACHE1_STATUS1_RANOUT_TRUE             0x00000001
+
+#define PFIFO_CACHE0_PUT	                    0x00003010
+
+#define PFIFO_CACHE1_PUT	                    0x00003210
+
+#define PFIFO_CACHE0_GET                     0x00003070
+
+#define PFIFO_CACHE1_GET					0x00003270
+
+#define PFIFO_CACHE0_ENGINE                  0x00003080
+#define   PFIFO_CACHE0_ENGINE_0_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_0_GRAPHICS               0x00000001
+#define   PFIFO_CACHE0_ENGINE_0_DVD                    0x00000002
+#define   PFIFO_CACHE0_ENGINE_1_SW	                    0x00000000
+#define   PFIFO_CACHE0_ENGINE_1_GRAPHICS               0x00000010
+#define   PFIFO_CACHE0_ENGINE_1_DVD                    0x00000020
+#define   PFIFO_CACHE0_ENGINE_2_SW	                    0x00000000
+#define   PFIFO_CACHE0_ENGINE_2_GRAPHICS               0x00000100
+#define   PFIFO_CACHE0_ENGINE_2_DVD                    0x00000200
+#define   PFIFO_CACHE0_ENGINE_3_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_3_GRAPHICS               0x00001000
+#define   PFIFO_CACHE0_ENGINE_3_DVD                    0x00002000
+#define   PFIFO_CACHE0_ENGINE_4_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_4_GRAPHICS               0x00010000
+#define   PFIFO_CACHE0_ENGINE_4_DVD                    0x00020000
+#define   PFIFO_CACHE0_ENGINE_5_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_5_GRAPHICS               0x00100000
+#define   PFIFO_CACHE0_ENGINE_5_DVD                    0x00200000
+#define   PFIFO_CACHE0_ENGINE_6_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_6_GRAPHICS               0x01000000
+#define   PFIFO_CACHE0_ENGINE_6_DVD                    0x02000000
+#define   PFIFO_CACHE0_ENGINE_7_SW                     0x00000000
+#define   PFIFO_CACHE0_ENGINE_7_GRAPHICS               0x10000000
+#define   PFIFO_CACHE0_ENGINE_7_DVD                    0x20000000
+
+#define PFIFO_CACHE1_ENGINE                  0x00003280
+#define   PFIFO_CACHE1_ENGINE_0_SW	                    0x00000000
+#define   PFIFO_CACHE1_ENGINE_0_GRAPHICS               0x00000001
+#define   PFIFO_CACHE1_ENGINE_0_DVD                    0x00000002
+#define   PFIFO_CACHE1_ENGINE_1_SW	                    0x00000000
+#define   PFIFO_CACHE1_ENGINE_1_GRAPHICS               0x00000010
+#define   PFIFO_CACHE1_ENGINE_1_DVD                    0x00000020
+#define   PFIFO_CACHE1_ENGINE_2_SW	                    0x00000000
+#define   PFIFO_CACHE1_ENGINE_2_GRAPHICS               0x00000100
+#define   PFIFO_CACHE1_ENGINE_2_DVD                    0x00000200
+#define   PFIFO_CACHE1_ENGINE_3_SW                     0x00000000
+#define   PFIFO_CACHE1_ENGINE_3_GRAPHICS               0x00001000
+#define   PFIFO_CACHE1_ENGINE_3_DVD                    0x00002000
+#define   PFIFO_CACHE1_ENGINE_4_SW                     0x00000000
+#define   PFIFO_CACHE1_ENGINE_4_GRAPHICS               0x00010000
+#define   PFIFO_CACHE1_ENGINE_4_DVD                    0x00020000
+#define   PFIFO_CACHE1_ENGINE_5_SW                     0x00000000
+#define   PFIFO_CACHE1_ENGINE_5_GRAPHICS               0x00100000
+#define   PFIFO_CACHE1_ENGINE_5_DVD                    0x00200000
+#define   PFIFO_CACHE1_ENGINE_6_SW	                    0x00000000
+#define   PFIFO_CACHE1_ENGINE_6_GRAPHICS               0x01000000
+#define   PFIFO_CACHE1_ENGINE_6_DVD                    0x02000000
+#define   PFIFO_CACHE1_ENGINE_7_SW                     0x00000000
+#define   PFIFO_CACHE1_ENGINE_7_GRAPHICS               0x10000000
+#define   PFIFO_CACHE1_ENGINE_7_DVD                    0x20000000
+
+#define PFIFO_CACHE0_METHOD                  0x00003100
+#define   PFIFO_CACHE0_METHOD_ADDRESS_MSK              0x00001FFC
+#define   PFIFO_CACHE0_METHOD_SUBCHANNEL_MSK	          0x0000E000
+
+#define PFIFO_CACHE1_METHOD                  0x00003800
+#define   PFIFO_CACHE1_METHOD_ADDRESS_MSK              0x00001FFC
+#define   PFIFO_CACHE1_METHOD_SUBCHANNEL_MSK	          0x0000E000
+
+#define PFIFO_CACHE1_METHOD_ALIAS            0x00003C00
+
+#define PFIFO_CACHE0_DATA                    0x00003104
+
+#define PFIFO_CACHE1_DATA                    0x00003804
+
+#define PFIFO_CACHE1_DATA_ALIAS              0x00003C04
+
+#define PFIFO_DEVICE                         0x00002800
+#define   PFIFO_DEVICE_CHID_MSK                        0x0000001F
+#define   PFIFO_DEVICE_SWITCH	                         0x01000000
+#define   PFIFO_DEVICE_SWITCH_UNAVAILABLE              0x00000000
+#define   PFIFO_DEVICE_SWITCH_AVAILABLE                0x01000000
+
+#define PFIFO_RUNOUT_STATUS                  0x00002400
+#define   PFIFO_RUNOUT_STATUS_RANOUT_FALSE             0x00000000
+#define   PFIFO_RUNOUT_STATUS_RANOUT_TRUE              0x00000001
+#define   PFIFO_RUNOUT_STATUS_LOW_MARK_NOT_EMPTY       0x00000000
+#define   PFIFO_RUNOUT_STATUS_LOW_MARK_EMPTY           0x00000010
+#define   PFIFO_RUNOUT_STATUS_HIGH_MARK_NOT_FULL       0x00000000
+#define   PFIFO_RUNOUT_STATUS_HIGH_MARK_FULL           0x00000100
+
+#define PFIFO_RUNOUT_PUT	                    0x00002410
+#define   PFIFO_RUNOUT_PUT_ADDRES_MSK                  0x00001FF8
+
+#define PFIFO_RUNOUT_GET                     0x00002420
+#define   PFIFO_RUNOUT_GET_ADDRESS_MSK                 0x00003FF8
+
+
+
+/* PVIDEO */
+#define PVIDEO           0x00008000
+
+#define PVIDEO_DEBUG_0                       0x00008080
+#define   PVIDEO_DEBUG_0_HLF_RATE_ROW_RD_DISABLED      0x00000000
+#define   PVIDEO_DEBUG_0_HLF_RATE_ROW_RD_ENABLED       0x00000001
+#define   PVIDEO_DEBUG_0_LIMIT_CHECK_DISABLED          0x00000000
+#define   PVIDEO_DEBUG_0_LIMIT_CHECK_ENABLED           0x00000010
+#define   PVIDEO_DEBUG_0_HUE_FOLD_DISABLED             0x00000000
+#define   PVIDEO_DEBUG_0_HUE_FOLD_ENABLED              0x00000100
+
+#define PVIDEO_DEBUG_1                       0x00008084
+#define   PVIDEO_DEBUG_1_REQ_DELAY_MSK                 0x000007FF
+#define   PVIDEO_DEBUG_1_REQ_DELAY_DEFAULT             0x00000064
+#define   PVIDEO_DEBUG_1_REQ_DELAY_INIT                0x00000050
+
+#define PVIDEO_DEBUG_2                       0x00008088
+#define   PVIDEO_DEBUG_2_BURST1_MSK                    0x000007E0
+#define   PVIDEO_DEBUG_2_BURST1_DEFAULT                0x00000100
+#define   PVIDEO_DEBUG_2_BURST1_INIT                   0x00000200
+#define   PVIDEO_DEBUG_2_BURST2_MSK                    0x07E00000
+#define   PVIDEO_DEBUG_2_BURST2_DEFAULT                0x02000000
+
+#define PVIDEO_DEBUG_3                       0x0000808C
+#define   PVIDEO_DEBUG_3_WATER_MARK1_MSK               0x000007F0
+#define   PVIDEO_DEBUG_3_WATER_MARK1_DEFAULT           0x000004B0
+#define   PVIDEO_DEBUG_3_WATER_MARK1_INIT              0x00000400
+#define   PVIDEO_DEBUG_3_WATER_MARK2_MSK               0x07F00000
+#define   PVIDEO_DEBUG_3_WATER_MARK2_DEFAULT           0x03B00000
+#define   PVIDEO_DEBUG_3_WATER_MARK2_INIT              0x04000000
+
+#define PVIDEO_DEBUG_4                       0x00008090
+#define   PVIDEO_DEBUG_4_V_COEFF_B_MSK                 0x00FFFFE0
+#define   PVIDEO_DEBUG_4_V_COEFF_B_DEFAULT             0x0016A0A0
+#define   PVIDEO_DEBUG_4_V_COEFF_B_ALWAYS              0x00000000
+#define   PVIDEO_DEBUG_4_V_COEFF_B_NEVER               0x00FFFFE0
+
+#define PVIDEO_DEBUG_5                       0x00008094
+#define   PVIDEO_DEBUG_5_H_L_COEFF_D_MSK               0x003FFFF0
+#define   PVIDEO_DEBUG_5_H_L_COEFF_D_DEFAULT           0x00188160
+#define   PVIDEO_DEBUG_5_H_L_COEFF_D_ALWAYS            0x00000000
+#define   PVIDEO_DEBUG_5_H_L_COEFF_D_NEVER             0x003FFFF0
+
+#define PVIDEO_DEBUG_6                       0x00008098
+#define   PVIDEO_DEBUG_6_H_L_COEFF_C_MSK               0x003FFFF0
+#define   PVIDEO_DEBUG_6_H_L_COEFF_C_DEFAULT           0x0012C730
+#define   PVIDEO_DEBUG_6_H_L_COEFF_C_ALWAYS            0x00000000
+#define   PVIDEO_DEBUG_6_H_L_COEFF_C_NEVER             0x003FFFF0
+
+#define PVIDEO_DEBUG_7                       0x0000809C
+#define   PVIDEO_DEBUG_7_H_L_COEFF_B_MSK               0x003FFFF0
+#define   PVIDEO_DEBUG_7_H_L_COEFF_B_DEFAULT	          0x00000000
+#define   PVIDEO_DEBUG_7_H_L_COEFF_B_ALWAYS            0x00000000
+#define   PVIDEO_DEBUG_7_H_L_COEFF_B_NEVER             0x003FFFF0
+
+#define PVIDEO_DEBUG_8                       0x000080A0
+#define   PVIDEO_DEBUG_8_PIPE_FILL_MSK                 0x000007F0
+#define   PVIDEO_DEBUG_8_PIPE_FILL_DEFAULT             0x000000B0
+
+#define PVIDEO_DEBUG_9                       0x000080A4
+#define   PVIDEO_DEBUG_9_FIFO_A_UNDERFLOW_FALSE        0x00000000
+#define   PVIDEO_DEBUG_9_FIFO_A_UNDERFLOW_TRUE         0x00000001
+#define   PVIDEO_DEBUG_9_FIFO_A_UNDERFLOW_RESET        0x00000001
+#define   PVIDEO_DEBUG_9_FIFO_A_OVERFLOW_FALSE         0x00000000
+#define   PVIDEO_DEBUG_9_FIFO_A_OVERFLOW_TRUE	     0x00000010
+#define   PVIDEO_DEBUG_9_FIFO_A_OVERFLOW_RESET         0x00000010
+#define   PVIDEO_DEBUG_9_FIFO_B_UNDERFLOW_FALSE        0x00000000
+#define   PVIDEO_DEBUG_9_FIFO_B_UNDERFLOW_TRUE         0x00000100
+#define   PVIDEO_DEBUG_9_FIFO_B_UNDERFLOW_RESET        0x00000100
+#define   PVIDEO_DEBUG_9_FIFO_B_OVERFLOW_FALSE         0x00000000
+#define   PVIDEO_DEBUG_9_FIFO_B_OVERFLOW_TRUE          0x00001000
+#define   PVIDEO_DEBUG_9_FIFO_B_OVERFLOW_RESET         0x00001000
+
+#define PVIDEO_DEBUG_10                      0x000080A8
+#define   PVIDEO_DEBUG_10_SCREEN_LINE_MSK              0x00001FFF
+#define   PVIDEO_DEBUG_10_SCREEN_LINE_FIRST            0x00000000
+#define   PVIDEO_DEBUG_10_SCAN_COUNT_MSK               0x001F0000
+#define   PVIDEO_DEBUG_10_SCAN_COUNT_FIRST             0x00000000
+#define   PVIDEO_DEBUG_10_SCAN_COUNT_OVERFLOW          0x00100000
+#define   PVIDEO_DEBUG_10_SCANNING_NEITHER             0x00000000
+#define   PVIDEO_DEBUG_10_SCANNING_BUFFER_0            0x02000000
+#define   PVIDEO_DEBUG_10_SCANNING_BUFFER_1            0x03000000
+
+#define PVIDEO_INTR                          0x00008100
+#define   PVIDEO_INTR_BUFFER_0_NOT_PENDING             0x00000000
+#define   PVIDEO_INTR_BUFFER_0_PENDING                 0x00000001
+#define   PVIDEO_INTR_BUFFER_0_RESET                   0x00000001
+#define   PVIDEO_INTR_BUFFER_1_NOT_PENDING             0x00000000
+#define   PVIDEO_INTR_BUFFER_1_PENDING                 0x00000010
+#define   PVIDEO_INTR_BUFFER_1_RESET                   0x00000010
+
+#define PVIDEO_INTR_REASON                   0x00008104
+#define   PVIDEO_INTR_REASON_BUFFER_0_NOTIFICATION     0x00000000
+#define   PVIDEO_INTR_REASON_BUFFER_0_PROTECTION_FAULT 0x00000001
+#define   PVIDEO_INTR_REASON_BUFFER_1_NOTIFICATION     0x00000000
+#define   PVIDEO_INTR_REASON_BUFFER_1_PROTECTION_FAULT 0x00000010
+
+#define PVIDEO_INTR_EN                       0x00008140
+#define   PVIDEO_INTR_EN_BUFFER_0_DISABLED             0x00000000
+#define   PVIDEO_INTR_EN_BUFFER_0_ENABLED              0x00000001
+#define   PVIDEO_INTR_EN_BUFFER_1_DISABLED             0x00000000
+#define   PVIDEO_INTR_EN_BUFFER_1_ENABLED              0x00000010
+
+#define PVIDEO_BUFFER                        0x00008700
+#define   PVIDEO_BUFFER_0_USE_NOT_PENDING              0x00000000
+#define   PVIDEO_BUFFER_0_USE_PENDING                  0x00000001
+#define   PVIDEO_BUFFER_0_USE_SET                      0x00000001
+#define   PVIDEO_BUFFER_1_USE_NOT_PENDING              0x00000000
+#define   PVIDEO_BUFFER_1_USE_PENDING                  0x00000010
+#define   PVIDEO_BUFFER_1_USE_SET                      0x00000010
+
+#define PVIDEO_STOP                          0x00008704
+#define   PVIDEO_STOP_OVERLAY_INACTIVE                 0x00000000
+#define   PVIDEO_STOP_OVERLAY_ACTIVE                   0x00000001
+#define   PVIDEO_STOP_METHOD_IMMEDIATELY               0x00000000
+#define   PVIDEO_STOP_METHOD_NORMALLY                  0x00000010
+
+#define PVIDEO_UVBASE_0                      0x00008800
+#define PVIDEO_UVBASE_1                      0x00008804
+#define   PVIDEO_UVBASE_MSK                  0xFFFFFFC0
+
+#define PVIDEO_UVLIMIT_0                     0x00008808
+#define PVIDEO_UVLIMIT_1                     0x0000880C
+
+#define PVIDEO_UVOFFSET_0                    0x00008820
+#define PVIDEO_UVOFFSET_1                    0x00008824
+#define   PVIDEO_UVOFFSET_MSK                0xFFFFFFC0
+
+#define PVIDEO_BASE_0                        0x00008900
+#define PVIDEO_BASE_1                        0x00008904
+#define   PVIDEO_BASE_MSK                    0xFFFFFFC0
+
+#define PVIDEO_LIMIT_0                       0x00008908
+#define PVIDEO_LIMIT_1                       0x0000890C
+
+#define PVIDEO_LUMINANCE_0                   0x00008910
+#define PVIDEO_LUMINANCE_1                   0x00008914
+
+#define PVIDEO_CHROMINANCE_0                 0x00008918
+#define PVIDEO_CHROMINANCE_1                 0x0000891C
+
+#define PVIDEO_OFFSET_0                      0x00008920
+#define PVIDEO_OFFSET_1                      0x00008924
+#define   PVIDEO_OFFSET_MSK                  0xFFFFFFC0
+
+#define PVIDEO_SIZE_IN_0                     0x00008928
+#define PVIDEO_SIZE_IN_1                     0x0000892C
+#define   PVIDEO_SIZE_IN_WIDTH_MSK           0x000007FF
+#define   PVIDEO_SIZE_IN_HEIGHT_MSK          0x07FF0000
+
+#define PVIDEO_POINT_IN_0                    0x00008930
+#define PVIDEO_POINT_IN_1                    0x00008934
+#define   PVIDEO_POINT_IN_S_MSK              0x00007FFF
+#define   PVIDEO_POINT_IN_T_MSK              0xFFFE0000
+
+#define PVIDEO_DS_DX_0                       0x00008938
+#define PVIDEO_DS_DX_1                       0x0000893C
+
+#define PVIDEO_DT_DY_0                       0x00008940
+#define PVIDEO_DT_DY_1                       0x00008944
+
+#define PVIDEO_POINT_OUT_0                   0x00008948
+#define PVIDEO_POINT_OUT_1                   0x0000894C
+#define   PVIDEO_POINT_OUT_X_MSK             0x00000FFF
+#define   PVIDEO_POINT_OUT_Y_MSK             0x0FFF0000
+
+#define PVIDEO_SIZE_OUT_0                    0x00008950
+#define PVIDEO_SIZE_OUT_1                    0x00008954
+#define   PVIDEO_SIZE_OUT_WIDTH_MSK          0x00000FFF
+#define   PVIDEO_SIZE_OUT_HEIGHT_MSK         0x0FFF0000
+
+#define PVIDEO_FORMAT_0                      0x00008958
+#define PVIDEO_FORMAT_1                      0x0000895C
+#define   PVIDEO_FORMAT_PLANAR_NV                      0x00000001
+#define   PVIDEO_FORMAT_PITCH_MSK                      0x00001FC0
+#define   PVIDEO_FORMAT_COLOR_YB8CR8YA8CB8             0x00000000
+#define   PVIDEO_FORMAT_COLOR_CR8YB8CB8YA8             0x00010000
+#define   PVIDEO_FORMAT_COLOR_ECR8EYB8ECB8EYA8         0x00110000
+#define   PVIDEO_FORMAT_DISPLAY_ALWAYS                 0x00000000
+#define   PVIDEO_FORMAT_DISPLAY_COLOR_KEY_EQUAL        0x00100000
+#define   PVIDEO_FORMAT_MATRIX_ITURBT601               0x00000000
+#define   PVIDEO_FORMAT_MATRIX_ITURBT709               0x01000000
+
+#define PVIDEO_COLOR_KEY                     0x00008B00
+
+#define PVIDEO_TEST                          0x00008D00
+#define   PVIDEO_TEST_MODE_DISABLE                     0x00000000
+#define   PVIDEO_TEST_MODE_ENABLE                      0x00000001
+#define   PVIDEO_TEST_ADDRESS_MSK                      0x00007F00
+
+/* Array [0...11] */
+#define PVIDEO_TST_WRITE                     0x00008D10
+
+/* Array [0...11] */
+#define PVIDEO_TST_READ                      0x00008D40
+
+
+
+/* PTIMER */
+#define PTIMER           0x00009000
+
+
+
+/* PVIO */
+#define PVIO             0x000C0000
+
+#define PVIO_SEQ_INDEX                       0x000C03C4
+
+#define PVIO_SEQ_DATA                        0x000C03C5
+
+#define PVIO_GRA_INDEX                       0x000C03CE
+
+#define PCIO_GRA_DATA                        0x000C03CF
+
+
+
+/* PVGA */
+#define PVGA             0x000A0000
+
+
+
+/* PFB */
+#define PFB              0x00100000
+
+#define PFB_BOOT_0                           0x00100000
+#define   PFB_BOOT_0_RAM_AMOUNT_32MB                   0x00000000
+#define   PFB_BOOT_0_RAM_AMOUNT_4MB                    0x00000001
+#define   PFB_BOOT_0_RAM_AMOUNT_8MB                    0x00000002
+#define   PFB_BOOT_0_RAM_AMOUNT_16MB                   0x00000003
+#define   PFB_BOOT_0_RAM_WIDTH_128                     0x00000004
+#define   PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT              0x00000000
+#define   PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT             0x00000008
+#define   PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK       0x00000010
+#define   PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT             0x00000018
+#define   PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT             0x00000020
+#define   PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16          0x00000028
+
+
+
+/* PEXTDEV */
+#define PEXTDEV          0x00101000
+
+
+
+/* PGRAPH */
+#define PGRAPH           0x00400000
+
+#define PGRAPH_DEBUG_0                       0x00400080
+
+#define PGRAPH_DEBUG_1                       0x00400084
+
+#define PGRAPH_DEBUG_2                       0x00400088
+
+#define PGRAPH_DEBUG_3                       0x0040008C
+
+#define PGRAPH_DEBUG_4                       0x00400090
+
+#define PGRAPH_DEBUG_5                       0x00400094
+
+#define PGRAPH_DEBUG_6                       0x00400820
+
+#define PGRAPH_INTR                          0x00400100
+
+#define PGRAPH_NSTATUS                       0x00400104
+
+#define PGRAPH_NSOURCE                       0x00400108
+
+#define PGRAPH_INTR_EN                       0x00400140
+
+#define PGRAPH_FIFO						0x00400720
+#define   PGRAPH_FIFO_ACCESS_DISABLED                  0x00000000
+#define   PGRAPH_FIFO_ACCESS_ENABLED                   0x00000001
+
+#define PGRAPH_STATUS                        0x00400700
+#define   PGRAPH_STATUS_STATE_IDLE                     0x00000000
+#define   PGRAPH_STATUS_STATE_BUSY                     0x00000001
+#define   PGRAPH_STATUS_FINE_RASTERIZER_IDLE           0x00000000
+#define   PGRAPH_STATUS_FINE_RASTERIZER_BUSY           0x00000002
+#define   PGRAPH_STATUS_COARSE_RASTERIZER_IDLE         0x00000000
+#define   PGRAPH_STATUS_COARSE_RASTERIZER_BUSY         0x00000004
+#define   PGRAPH_STATUS_FE_3D_IDLE                     0x00000000
+#define   PGRAPH_STATUS_FE_3D_BUSY                     0x00000008
+#define   PGRAPH_STATUS_FE_2D_IDLE                     0x00000000
+#define   PGRAPH_STATUS_FE_2D_BUSY                     0x00000010
+#define   PGRAPH_STATUS_XY_LOGIC_IDLE                  0x00000000
+#define   PGRAPH_STATUS_XY_LOGIC_BUSY                  0x00000020
+#define   PGRAPH_STATUS_RASTERIZER_2D_IDLE             0x00000000
+#define   PGRAPH_STATUS_RASTERIZER_2D_BUSY             0x00000080
+#define   PGRAPH_STATUS_IDX_IDLE                       0x00000000
+#define   PGRAPH_STATUS_IDX_BUSY                       0x00000100
+#define   PGRAPH_STATUS_XF_IDLE                        0x00000000
+#define   PGRAPH_STATUS_XF_BUSY                        0x00000200
+#define   PGRAPH_STATUS_VTX_IDLE                       0x00000000
+#define   PGRAPH_STATUS_VTX_BUSY                       0x00000400
+#define   PGRAPH_STATUS_CAS_IDLE                       0x00000000
+#define   PGRAPH_STATUS_CAS_BUSY                       0x00000800
+#define   PGRAPH_STATUS_PORT_NOTIFY_IDLE               0x00000000
+#define   PGRAPH_STATUS_PORT_NOTIFY_BUSY               0x00001000
+#define   PGRAPH_STATUS_SHADER_IDLE                    0x00000000
+#define   PGRAPH_STATUS_SHADER_BUSY                    0x00002000
+#define   PGRAPH_STATUS_SHADER_BE_IDLE                 0x00000000
+#define   PGRAPH_STATUS_SHADER_BE_BUSY                 0x00004000
+#define   PGRAPH_STATUS_PORT_DMA_IDLE                  0x00000000
+#define   PGRAPH_STATUS_PORT_DMA_BUSY                  0x00010000
+#define   PGRAPH_STATUS_DMA_ENGINE_IDLE                0x00000000
+#define   PGRAPH_STATUS_DMA_ENGINE_BUSY                0x00020000
+#define   PGRAPH_STATUS_DMA_NOTIFY_IDLE                0x00000000
+#define   PGRAPH_STATUS_DMA_NOTIFY_BUSY                0x00100000
+#define   PGRAPH_STATUS_DMA_BUFFER_NOTIFY_IDLE         0x00000000
+#define   PGRAPH_STATUS_DMA_BUFFER_NOTIFY_BUSY         0x00200000
+#define   PGRAPH_STATUS_DMA_WARNING_NOTIFY_IDLE        0x00000000
+#define   PGRAPH_STATUS_DMA_WARNING_NOTIFY_BUSY        0x00400000
+#define   PGRAPH_STATUS_ZCULL_IDLE                     0x00000000
+#define   PGRAPH_STATUS_ZCULL_BUSY                     0x00800000
+#define   PGRAPH_STATUS_FDIFF_IDLE                     0x00000000
+#define   PGRAPH_STATUS_FDIFF_BUSY                     0x01000000
+#define   PGRAPH_STATUS_SETUP_IDLE                     0x00000000
+#define   PGRAPH_STATUS_SETUP_BUSY                     0x02000000
+#define   PGRAPH_STATUS_CACHE_IDLE                     0x00000000
+#define   PGRAPH_STATUS_CACHE_BUSY                     0x04000000
+#define   PGRAPH_STATUS_COMBINER_IDLE                  0x00000000
+#define   PGRAPH_STATUS_COMBINER_BUSY                  0x08000000
+#define   PGRAPH_STATUS_PREROP_IDLE                    0x00000000
+#define   PGRAPH_STATUS_PREROP_BUSY                    0x10000000
+#define   PGRAPH_STATUS_ROP_IDLE                       0x00000000
+#define   PGRAPH_STATUS_ROP_BUSY                       0x20000000
+#define   PGRAPH_STATUS_PORT_USER_IDLE                 0x00000000
+#define   PGRAPH_STATUS_PORT_USER_BUSY                 0x40000000
+#define   PGRAPH_STATUS_PORT_FB_IDLE                   0x00000000
+#define   PGRAPH_STATUS_PORT_FB_BUSY                   0x80000000
+
+#define NV10_PGRAPH_WINDOWCLIP_HORIZONTAL    0x00400F00
+
+#define NV10_PGRAPH_WINDOWCLIP_VERTICAL      0x00400F20
+
+#define NV10_PGRAPH_XFMODE0                  0x00400F40
+
+#define NV10_PGRAPH_XFMODE1                  0x00400F44
+
+#define NV10_PGRAPH_GLOBALSTATE0             0x00400F48
+
+#define NV10_PGRAPH_GLOBALSTATE1             0x00400F4C
+
+#define NV10_PGRAPH_PIPE_ADDRESS             0x00400F50
+
+#define NV10_PGRAPH_PIPE_DATA                0x00400F54
+
+
+
+/* PCRTC */
+#define PCRTC            0x00600000
+
+#define PCRTC_INTR                           0x00600100
+#define   PCRTC_INTR_VBLANK_RESET                      0x00000001
+
+#define PCRTC_INTR_EN                        0x00600140
+#define   PCRTC_INTR_EN_VBLANK_DISABLED                0x00000000
+#define   PCRTC_INTR_EN_VBLANK_ENABLED                 0x00000001
+
+#define PCRTC_START                          0x00600800
+
+#define PCRTC_CONFIG                         0x00600804
+#define   PCRTC_CONFIG_SIGNAL_VGA                      0x00000000
+#define   PCRTC_CONFIG_SIGNAL_NON_VGA                  0x00000001
+#define   PCRTC_CONFIG_SIGNAL_HSYNC                    0x00000002
+#define   PCRTC_CONFIG_ENDIAN                          0x80000000
+#define   PCRTC_CONFIG_ENDIAN_LITTLE                   0x00000000
+#define   PCRTC_CONFIG_ENDIAN_BIG                      0x80000000
+
+#define PCRTC_RASTER                         0x00600808
+#define   PCRTC_RASTER_POSITION_MSK                    0x000007FF
+#define   PCRTC_RASTER_SA_LOAD_DISPLAY                 0x00000000
+#define   PCRTC_RASTER_SA_LOAD_BEFORE                  0x00001000
+#define   PCRTC_RASTER_SA_LOAD_AFTER                   0x00002000
+#define   PCRTC_RASTER_VERT_BLANK_ACTIVE               0x00010000
+#define   PCRTC_RASTER_VERT_BLANK_INACTIVE             0x00000000
+#define   PCRTC_RASTER_FIELD_EVEN                      0x00000000
+#define   PCRTC_RASTER_FIELD_ODD                       0x00100000
+#define   PCRTC_RASTER_STEREO_LEFT                     0x00000000
+#define   PCRTC_RASTER_STEREO_RIGHT                    0x01000000
+
+
+
+/* PCRTC2 */
+#define PCRTC2           0x00600800
+
+#define PCRTC2_INTR                          0x00600900
+#define   PCRTC2_INTR_VBLANK_RESET                     0x00000001
+
+#define PCRTC2_INTR_EN                       0x00600940
+#define   PCRTC2_INTR_EN_VBLANK_DISABLED               0x00000000
+#define   PCRTC2_INTR_EN_VBLANK_ENABLED                0x00000001
+
+#define PCRTC2_START                         0x00601000
+
+#define PCRTC2_CONFIG                        0x00601004
+#define   PCRTC2_CONFIG_SIGNAL_VGA                     0x00000000
+#define   PCRTC2_CONFIG_SIGNAL_NON_VGA                 0x00000001
+#define   PCRTC2_CONFIG_SIGNAL_HSYNC                   0x00000002
+#define   PCRTC2_CONFIG_ENDIAN                         0x80000000
+#define   PCRTC2_CONFIG_ENDIAN_LITTLE                  0x00000000
+#define   PCRTC2_CONFIG_ENDIAN_BIG                     0x80000000
+
+#define PCRTC2_RASTER                        0x00601008
+#define   PCRTC2_RASTER_POSITION_MSK                   0x000007FF
+#define   PCRTC2_RASTER_SA_LOAD_DISPLAY                0x00000000
+#define   PCRTC2_RASTER_SA_LOAD_BEFORE                 0x00001000
+#define   PCRTC2_RASTER_SA_LOAD_AFTER                  0x00002000
+#define   PCRTC2_RASTER_VERT_BLANK_ACTIVE              0x00010000
+#define   PCRTC2_RASTER_VERT_BLANK_INACTIVE            0x00000000
+#define   PCRTC2_RASTER_FIELD_EVEN                     0x00000000
+#define   PCRTC2_RASTER_FIELD_ODD                      0x00100000
+#define   PCRTC2_RASTER_STEREO_LEFT                    0x00000000
+#define   PCRTC2_RASTER_STEREO_RIGHT                   0x01000000
+
+
+
+/* PCIO */
+#define PCIO             0x00601000
+
+#define PCIO_ATTR_INDEX                      0x006013C0
+
+#define PCIO_ATTR_DATA                       0x006013C1
+
+#define PCIO_CRTC_INDEX                      0x006013D4
+
+#define PCIO_CRTC_DATA                       0x006013D5
+
+/* CRTC Registers */
+#define CRTC_HORIZ_TOTAL                     0x00
+#define CRTC_HORIZ_DISPLAY_END               0x01
+#define CRTC_HORIZ_BLANK_START               0x02
+#define CRTC_HORIZ_BLANK_END                 0x03
+#define CRTC_HORIZ_RETRACE_START             0x04
+#define CRTC_HORIZ_RETRACE_END               0x05
+#define CRTC_VERT_TOTAL                      0x06
+#define CRTC_OVERFLOW                        0x07
+#define CRTC_PRESET_ROW_SCAN                 0x08
+#define CRTC_MAX_SCAN_LINE                   0x09
+#define CRTC_CURSOR_START                    0x0A
+#define CRTC_CURSOR_END                      0x0B
+#define CRTC_START_ADDR_HIGH                 0x0C
+#define CRTC_START_ADDR_LOW                  0x0D
+#define CRTC_CURSOR_LOCATION_HIGH            0x0E
+#define CRTC_CURSOR_LOCATION_LOW             0x0F
+#define CRTC_VERT_RETRACE_START              0x10
+#define CRTC_VERT_RETRACE_END                0x11
+#define CRTC_VERT_DISPLAY_END                0x12
+#define CRTC_OFFSET                          0x13
+#define CRTC_UNDERLINE_LOCATION              0x14
+#define CRTC_VERT_BLANK_START                0x15
+#define CRTC_VERT_BLANK_END                  0x16
+#define CRTC_MODE_CONTROL                    0x17
+#define CRTC_LINE_COMPARE                    0x18
+#define CRTC_REPAINT0                        0x19
+#define CRTC_HORIZ_EXTRA                     0x2d
+#define CRTC_EXTRA                           0x25
+#define CRTC_FIFO_CONTROL                    0x1b
+#define CRTC_FIFO                            0x20
+#define CRTC_REPAINT1                        0x1a
+#define CRTC_GRCURSOR0                       0x30
+#define CRTC_GRCURSOR1                       0x31
+#define CRTC_PIXEL                           0x28
+
+#define PCIO_CRTC_STATUS                     0x006013DA
+
+
+
+/* PRAMDAC */
+#define PRAMDAC          0x00680000
+
+
+
+/* PDIO */
+#define PDIO             0x00681000
+
+
+
+/* PRAMIN */
+#define PRAMIN           0x00700000
+
+
+
+/* PRAMHT */
+#define PRAMHT           0x00710000
+
+
+
+/*************************** FIFO Registers ******************************/
+
+
+#define FIFO_ADDRESS     0x00800000
+
+#define FIFO_FREE        0x00800010
+
+#define DMA_PUT          0x00800040
+
+#define DMA_GET          0x00800044
+
+
+/*
+ * Generic subchannel registers
+ */
+#define SET_OBJECT       0x00000000
+
+       
+/*
+ * 2D surfaces
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextDmaSource;      /* 0184-0187 */
+     u32 SetContextDmaDestin;      /* 0188-018B */
+     u32 Reserved01[0x05D];
+     u32 Format;                   /* 0300-0303 */
+     u32 Pitch;                    /* 0304-0307 */
+     u32 SourceOffset;             /* 0308-030B */
+     u32 DestOffset;               /* 030C-030F */
+     u32 Reserved02[0x73C];
+} NVSurfaces2D;
+#define SURFACES2D_FORMAT                    0x00000300
+#define   SURFACES2D_FORMAT_Y8                         0x00000001
+#define   SURFACES2D_FORMAT_X1R5G5B5                   0x00000002
+#define   SURFACES2D_FORMAT_A1R5G5B5                   0x00000003
+#define   SURFACES2D_FORMAT_R5G6B5                     0x00000004
+#define   SURFACES2D_FORMAT_Y16                        0x00000005
+#define   SURFACES2D_FORMAT_X8R8G8B8                   0x00000006
+#define   SURFACES2D_FORMAT_A8R8G8B8                   0x0000000A
+#define   SURFACES2D_FORMAT_Y32                        0x0000000B
+#define SURFACES2D_PITCH                     0x00000304
+#define SURFACES2D_SRC_OFFSET                0x00000308
+#define SURFACES2D_DST_OFFSET                0x0000030C
+
+/*
+ * 3D surfaces
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextDmaColor;       /* 0184-0187 */
+     u32 SetContextDmaZeta;        /* 0188-018B */
+     u32 Reserved01[0x05B];
+     u32 ClipHorizontal;           /* 02F8-02FB */
+     u32 ClipVertical;             /* 02FC-02FF */
+     u32 Format;                   /* 0300-0303 */
+     u32 ClipSize;                 /* 0304-0307 */
+     u32 Pitch;                    /* 0308-030B */
+     u32 RenderOffset;             /* 030C-030F */
+     u32 DepthOffset;              /* 0310-0313 */
+     u32 Reserved02[0x73B];
+} NVSurfaces3D;
+#define SURFACES3D_CLIP_HORIZONTAL           0x000002F8
+#define SURFACES3D_CLIP_VERTICAL             0x000002FC
+#define SURFACES3D_FORMAT                    0x00000300
+#define   SURFACES3D_FORMAT_COLOR_A1R5G5B5             0x00000001
+#define   SURFACES3D_FORMAT_COLOR_X1R5G5B5             0x00000002
+#define   SURFACES3D_FORMAT_COLOR_R5G6B5               0x00000003
+#define   SURAFCES3D_FORMAT_COLOR_X8R8G8B8             0x00000006
+#define   SURFACES3D_FORMAT_COLOR_A8R8G8B8             0x00000008
+#define   SURFACES3D_FORMAT_TYPE_PITCH                 0x00000100
+#define   SURFACES3D_FORMAT_TYPE_SWIZZLE               0x00000200
+#define SURFACES3D_CLIP_SIZE                 0x00000304
+#define SURFACES3D_PITCH                     0x00000308
+#define SURFACES3D_RENDER_OFFSET             0x0000030C
+#define SURFACES3D_DEPTH_OFFSET              0x00000310
+
+/*
+ * Scissor clip rectangle
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextDmaImage;       /* 0184-0187 */
+     u32 Reserved01[0x05E];
+     u32 TopLeft;                  /* 0300-0303 */
+     u32 WidthHeight;              /* 0304-0307 */
+     u32 Reserved02[0x73E];
+} NVClip;
+#define CLIP_TOP_LEFT                        0x00000300
+#define CLIP_WIDTH_HEIGHT                    0x00000304
+
+/*
+ * Global alpha factor
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 Reserved01[0x05F];
+     u32 SetBeta1D31;              /* 0300-0303 */
+     u32 Reserved02[0x73F];
+} NVBeta1;
+#define BETA1_FACTOR                         0x00000300
+
+/*
+ * Global ARGB factor
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 Reserved01[0x05F];
+     u32 SetBetaFactor;            /* 0300-0303 */
+     u32 Reserved02[0x73F];
+} NVBeta4;
+#define BETA4_FACTOR                         0x00000300
+
+/* 
+ * Generic Flags
+ */
+/* Operation */
+#define OPERATION_COPY                   0
+#define OPERATION_ROP                    1
+#define OPERATION_BLEND                  2
+#define OPERATION_SRCCOPY                3
+#define OPERATION_COLOR_MULTIPLY         4
+#define OPERATION_BLEND_PREMULTIPLIED    5
+/* ColorConversion */
+#define COLOR_CONVERSION_DITHER          0
+#define COLOR_CONVERSION_TRUNCATE        1
+#define COLOR_CONVERSION_SUBTR_TRUNCATE  2   
+
+/*
+ * 2D solid rectangle
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextClip;           /* 0184-0187 */
+     u32 SetContextPattern;        /* 0188-018B */
+     u32 SetContextRop;            /* 018C-018F */
+     u32 SetContextBeta1;          /* 0190-0193 */
+     u32 SetContextSurface;        /* 0194-0197 */
+     u32 Reserved01[0x059];
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 Color;                    /* 0304-0307 */
+     u32 Reserved02[0x03E];
+     u32 TopLeft;                  /* 0400-0403 */
+     u32 WidthHeight;              /* 0404-0407 */
+     u32 Reserved03[0x6FE];
+} NVRectangle;
+#define RECT_OPERATION                       0x000002FC
+#define RECT_COLOR_FORMAT                    0x00000300
+#define   RECT_COLOR_FORMAT_Y16                        0x00000001
+#define   RECT_COLOR_FORMAT_A1Y15                      0x00000002
+#define   RECT_COLOR_FORMAT_Y32                        0x00000003
+#define RECT_COLOR                           0x00000304
+#define RECT_TOP_LEFT                        0x00000400
+#define RECT_WIDTH_HEIGHT                    0x00000404
+
+/*
+ * 2D solid triangle
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextClip;           /* 0184-0187 */
+     u32 SetContextPattern;        /* 0188-018B */
+     u32 SetContextRop;            /* 018C-018F */
+     u32 SetContextBeta1;          /* 0190-0193 */
+     u32 SetContextSurface;        /* 0194-0197 */
+     u32 Reserved01[0x059];
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 Color;                    /* 0304-0307 */
+     u32 Reserved02[0x002];
+     u32 TrianglePoint0;           /* 0310-0313 */
+     u32 TrianglePoint1;           /* 0314-0317 */
+     u32 TrianglePoint2;           /* 0318-031B */
+     u32 Reserved03[0x001];
+     s32 Triangle32Point0X;        /* 0320-0323 */
+     s32 Triangle32Point0Y;        /* 0324-0327 */
+     s32 Triangle32Point1X;        /* 0328-032B */
+     s32 Triangle32Point1Y;        /* 032C-032F */
+     s32 Triangle32Point2X;        /* 0330-0333 */
+     s32 Triangle32Point2Y;        /* 0334-0337 */
+     u32 Reserved04[0x032];
+     u32 Trimesh[32];              /* 0400-047F */
+     struct {                      /* 0480-     */
+          s32 x;                   /*    0-   3 */
+          s32 y;                   /*    4-   7 */
+     } Trimesh32[16];              /*     -04FF */
+     struct {                      /* 0500-     */
+          u32 color;               /*    0-   3 */
+          u32 point0;              /*    4-   7 */
+          u32 point1;              /*    8-   B */
+          u32 point2;              /*    C-   F */
+     } ColorTriangle[8];           /*     -057F */
+     struct {                      /* 0580-     */
+          u32 color;               /*    0-   3 */
+          u32 point;               /*    4-   7 */
+     } ColorTrimesh[16];           /*     -05FF */
+     u32 Reserved05[0x680];
+} NVTriangle;
+#define TRI_OPERATION                        0x000002FC
+#define TRI_COLOR_FORMAT                     0x00000300
+#define   TRI_COLOR_FORMAT_Y16                         0x00000001
+#define   TRI_COLOR_FORMAT_A1Y15                       0x00000002
+#define   TRI_COLOR_FORMAT_Y32                         0x00000003
+#define TRI_COLOR                            0x00000304
+#define TRI_POINT0                           0x00000310
+#define TRI_POINT1                           0x00000314
+#define TRI_POINT2                           0x00000318
+
+/*
+ * 2D solid 
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextClip;           /* 0184-0187 */
+     u32 SetContextPattern;        /* 0188-018B */
+     u32 SetContextRop;            /* 018C-018F */
+     u32 SetContextBeta1;          /* 0190-0193 */
+     u32 SetContextSurface;        /* 0194-0197 */
+     u32 Reserved01[0x059];
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 Color;                    /* 0304-0307 */
+     u32 Reserved02[0x03E];
+     struct {                      /* 0400-     */
+          u32 point0;              /*    0-   3 */
+          u32 point1;              /*    4-   7 */
+     } Lin[16];                    /*     -047F */
+     struct {                      /* 0480-     */
+          u32 point0X;             /*    0-   3 */
+          u32 point0Y;             /*    4-   7 */
+          u32 point1X;             /*    8-   B */
+          u32 point1Y;             /*    C-   F */
+     } Lin32[8];                   /*     -04FF */
+     u32 PolyLin[32];              /* 0500-057F */
+     struct {                      /* 0580-     */
+          u32 x;                   /*    0-   3 */
+          u32 y;                   /*    4-   7 */
+     } PolyLin32[16];              /*     -05FF */
+     struct {                      /* 0600-     */
+          u32 color;               /*    0-   3 */
+          u32 point;               /*    4-   7 */
+     } ColorPolyLin[16];           /*     -067F */
+     u32 Reserved03[0x660];
+} NVLine;
+#define LINE_OPERATION                       0x000002FC
+#define LINE_COLOR_FORMAT                    0x00000300
+#define   LINE_COLOR_FORMAT_Y16                        0x00000001
+#define   LINE_COLOR_FORMAT_A1Y15                      0x00000002
+#define   LINE_COLOR_FORMAT_Y32                        0x00000003
+#define LINE_COLOR                           0x00000304
+#define LINE_POINT0                          0x00000400
+#define LINE_POINT1                          0x00000404
+
+/*
+ * 2D screen-screen BLT
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 WaitForIdle;              /* 0108-010B (09F_WAIT_FOR_IDLE) */
+     u32 WaitForSync;              /* 010C-010F (09F_WAIT_FOR_CRTC) */
+     u32 Reserved00[0x01C];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextColorKey;       /* 0184-0187 */
+     u32 SetContextClip;           /* 0188-018B */
+     u32 SetContextPattern;        /* 018C-018F */
+     u32 SetContextRop;            /* 0190-0193 */
+     u32 SetContextBeta1;          /* 0194-0197 */
+     u32 SetContextBeta4;          /* 0198-019B */
+     u32 SetContextSurface;        /* 019C-019F */
+     u32 Reserved01[0x057];
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 TopLeftSrc;               /* 0300-0303 */
+     u32 TopLeftDst;               /* 0304-0307 */
+     u32 WidthHeight;              /* 0308-030B */
+     u32 Reserved02[0x73D];
+} NVScreenBlt;
+#define BLIT_OPERATION                       0x000002FC
+#define BLIT_TOP_LEFT_SRC                    0x00000300
+#define BLIT_TOP_LEFT_DST                    0x00000304
+#define BLIT_WIDTH_HEIGHT                    0x00000308
+
+/*
+ * 2D CPU to screen BLT
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextColorKey;       /* 0184-0187 */
+     u32 SetContextClip;           /* 0188-018B */
+     u32 SetContextPattern;        /* 018C-018F */
+     u32 SetContextRop;            /* 0190-0193 */
+     u32 SetContextBeta1;          /* 0194-0197 */
+     u32 SetContextBeta4;          /* 0198-019B */
+     u32 SetContextSurface;        /* 019C-019F */
+     u32 Reserved01[0x056];
+     u32 SetColorConversion;       /* 02F8-02FB */
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 Point;                    /* 0304-0307 */
+     u32 SizeOut;                  /* 0308-030B */
+     u32 SizeIn;                   /* 030C-030F */
+     u32 Reserved02[0x03C];
+     u32 Pixel[1792];              /* 0400-     */
+} NVImageBlt;
+#define IBLIT_COLOR_CONVERSION               0x000002F8
+#define IBLIT_OPERATION                      0x000002FC
+#define IBLIT_COLOR_FORMAT                   0x00000300
+#define   IBLIT_COLOR_FORMAT_R5G6B5                    0x00000001
+#define   IBLIT_COLOR_FORMAT_A1R5G5B5                  0x00000002
+#define   IBLIT_COLOR_FORMAT_X1R5G5B5                  0x00000003
+#define   IBLIT_COLOR_FORMAT_A8R8G8B8                  0x00000004
+#define   IBLIT_COLOR_FORMAT_X8R8G8B8                  0x00000005
+#define IBLIT_POINT                          0x00000304
+#define IBLIT_SIZE_OUT                       0x00000308
+#define IBLIT_SIZE_IN                        0x0000030C
+#define IBLIT_PIXEL0                         0x00000400
+
+/*
+ * 2D scaled image BLT
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextDmaImage;       /* 0184-0187 */
+     u32 SetContextPattern;        /* 0188-018B */
+     u32 SetContextRop;            /* 018C-018F */
+     u32 SetContextBeta1;          /* 0190-0193 */
+     u32 SetContextBeta4;          /* 0194-0197 */
+     u32 SetContextSurface;        /* 0198-019C */
+     u32 Reserved01[0x058];
+     u32 SetColorConversion;       /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 SetOperation;             /* 0304-0307 */
+     u32 ClipPoint;                /* 0308-030B */
+     u32 ClipSize;                 /* 030C-030F */
+     u32 ImageOutPoint;            /* 0310-0313 */
+     u32 ImageOutSize;             /* 0314-0317 */
+     u32 DuDx;                     /* 0318-031B */
+     u32 DvDy;                     /* 031C-031F */
+     u32 Reserved02[0x038];
+     u32 ImageInSize;              /* 0400-0403 */
+     u32 ImageInFormat;            /* 0404-0407 */
+     u32 ImageInOffset;            /* 0408-040B */
+     u32 ImageInPoint;             /* 040C-040F */
+     u32 Reserved03[0x6FC];
+} NVScaledImage;
+#define SCALER_COLOR_CONVERSION              0x000002FC
+#define SCALER_COLOR_FORMAT                  0x00000300
+#define   SCALER_COLOR_FORMAT_A1R5G5B5                 0x00000001
+#define   SCALER_COLOR_FORMAT_X1R5G5B5                 0x00000002
+#define   SCALER_COLOR_FORMAT_A8R8G8B8                 0x00000003
+#define   SCALER_COLOR_FORMAT_X8R8G8B8                 0x00000004
+#define   SCALER_COLOR_FORMAT_V8YB8U8YA8               0x00000005
+#define   SCALER_COLOR_FORMAT_YB8V8YA8U8               0x00000006
+#define   SCALER_COLOR_FORMAT_R5G6B5                   0x00000007
+#define   SCALER_COLOR_FORMAT_Y8                       0x00000008
+#define   SCALER_COLOR_FORMAT_AY8                      0x00000009
+#define SCALER_OPERATION                     0x00000304
+#define SCALER_CLIP_POINT                    0x00000308
+#define SCALER_CLIP_SIZE                     0x0000030C
+#define SCALER_OUT_POINT                     0x00000310
+#define SCALER_OUT_SIZE                      0x00000314
+#define SCALER_DU_DX                         0x00000318
+#define SCALER_DV_DY                         0x0000031C
+#define SCALER_IN_SIZE                       0x00000400
+#define SCALER_IN_FORMAT                     0x00000404
+#define   SCALER_IN_FORMAT_ORIGIN_CENTER               0x00010000
+#define   SCALER_IN_FORMAT_ORIGIN_CORNER               0x00020000
+#define   SCALER_IN_FORMAT_FILTER_NEAREST              0x00000000
+#define   SCALER_IN_FORMAT_FILTER_LINEAR               0x01000000
+#define SCALER_IN_OFFSET                     0x00000408
+#define SCALER_IN_POINT                      0x0000040C
+
+/*
+ * 2D stretched image from CPU BLT
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextColorKey;       /* 0184-0187 */
+     u32 SetContextPattern;        /* 0188-018B */
+     u32 SetContextRop;            /* 018C-018F */
+     u32 SetContextBeta1;          /* 0190-0193 */
+     u32 SetContextBeta4;          /* 0194-0197 */
+     u32 SetContextSurface;        /* 0198-019C */
+     u32 Reserved01[0x057];
+     u32 SetColorConversion;       /* 02F8-02FB */
+     u32 SetOperation;             /* 02FC-02FF */
+     u32 SetColorFormat;           /* 0300-0303 */
+     u32 ImageInSize;              /* 0304-0307 */
+     u32 DxDu;                     /* 0308-030B */
+     u32 DyDv;                     /* 030C-030F */
+     u32 ClipPoint;                /* 0310-0313 */
+     u32 ClipSize;                 /* 0314-0317 */
+     u32 ImageOutPoint;            /* 0318-031B */
+     u32 Reserved02[0x039];
+     u32 Pixel[1792];              /* 0400-     */
+} NVStretchedImage;
+#define ISTRETCH_COLOR_CONVERSION            0x000002F8
+#define ISTRETCH_OPERATION                   0x000002FC
+#define ISTRETCH_COLOR_FORMAT                0x00000300
+#define   ISTRETCH_COLOR_FORMAT_R5G6B5                 0x00000001
+#define   ISTRETCH_COLOR_FORMAT_A1R5G5B5               0x00000002
+#define   ISTRETCH_COLOR_FORMAT_X1R5G5B5               0x00000003
+#define   ISTRETCH_COLOR_FORMAT_A8R8G8B8               0x00000004
+#define   ISTRETCH_COLOR_FORMAT_X8R8G8B8               0x00000005
+#define ISTRETCH_IN_SIZE                     0x00000304
+#define ISTRETCH_DX_DU                       0x00000308
+#define ISTRETCH_DY_DV                       0x0000030C
+#define ISTRETCH_CLIP_POINT                  0x00000310
+#define ISTRETCH_CLIP_SIZE                   0x00000314
+#define ISTRETCH_OUT_POINT                   0x00000318
+#define ISTRETCH_PIXEL0                      0x00000400
+
+/*
+ * 3D textured, Z buffered triangle
+ */
+typedef volatile struct {
+     u32 NoOperation;              /* 0100-0103 */
+     u32 Notify;                   /* 0104-0107 */
+     u32 Reserved00[0x01E];
+     u32 SetContextDmaNotify;      /* 0180-0183 */
+     u32 SetContextDmaA;           /* 0184-0187 */
+     u32 SetContextDmaB;           /* 0188-018B */
+     u32 SetContextSurfaces;       /* 018C-018F */
+     u32 Reserved01[0x05C];
+     u32 ColorKey;                 /* 0300-0303 */
+     u32 TextureOffset;            /* 0304-0307 */
+     u32 TextureFormat;            /* 0308-030B */
+     u32 TextureFilter;            /* 030C-030F */
+     u32 Blend;                    /* 0310-0313 */
+     u32 Control;                  /* 0314-0317 */
+     u32 FogColor;                 /* 0318-031B */
+     u32 Reserved02[0x039];
+     struct {                      /* 0400-     */
+          float sx;                /*   00-  03 */
+          float sy;                /*   04-  07 */
+          float sz;                /*   08-  0B */
+          float rhw;               /*   0C-  0F */
+          u32 color;               /*   10-  13 */
+          u32 specular;            /*   14-  17 */
+          float ts;                /*   18-  1B */
+          float tt;                /*   1C-  1F */
+     } Tlvertex[16];               /*     -05FF */
+     u32 DrawPrimitives[64];       /* 0600-063F */
+     u32 Reserved03[0x640];
+} NVTexturedTriangleDx5;
+#define TXTRI_COLOR_KEY                      0x00000300
+#define TXTRI_OFFSET                         0x00000304
+#define TXTRI_FORMAT                         0x00000308
+#define   TXTRI_FORMAT_CONTEXT_DMA_A                   0x00000001
+#define   TXTRI_FORMAT_CONTEXT_DMA_B                   0x00000002
+#define   TXTRI_FORMAT_COLORKEYENABLE                  0x00000004
+#define   TXTRI_FORMAT_ORIGIN_ZOH_CENTER               0x00000010
+#define   TXTRI_FORMAT_ORIGIN_ZOH_CORNER               0x00000020
+#define   TXTRI_FORMAT_ORIGIN_FOH_CENTER               0x00000040
+#define   TXTRI_FORMAT_ORIGIN_FOH_CORNER               0x00000080
+#define   TXTRI_FORMAT_COLOR_Y8                        0x00000100
+#define   TXTRI_FORMAT_COLOR_A1R5G5B5                  0x00000200
+#define   TXTRI_FORMAT_COLOR_X1R5G5B5                  0x00000300
+#define   TXTRI_FORMAT_COLOR_A4R4G4B4                  0x00000400
+#define   TXTRI_FORMAT_COLOR_R5G6B5                    0x00000500
+#define   TXTRI_FORMAT_COLOR_A8R8G8B8                  0x00000600
+#define   TXTRI_FORMAT_COLOR_X8R8G8B8                  0x00000700
+#define   TXTRI_FORMAT_MIPMAP_LEVELS_MSK               0x0000F000
+#define   TXTRI_FORMAT_BASE_SIZE_U_MSK                 0x000F0000
+#define   TXTRI_FORMAT_BASE_SIZE_V_MSK                 0x00F00000
+#define   TXTRI_FORMAT_U_WRAP                          0x01000000
+#define   TXTRI_FORMAT_U_MIRROR                        0x02000000
+#define   TXTRI_FORMAT_U_CLAMP                         0x03000000
+#define   TXTRI_FORMAT_U_CLAMP_BORDER                  0x04000000
+#define   TXTRI_FORMAT_WRAPU_ENABLE                    0x08000000
+#define   TXTRI_FORMAT_V_WRAP                          0x10000000
+#define   TXTRI_FORMAT_V_MIRROR                        0x20000000
+#define   TXTRI_FORMAT_V_CLAMP                         0x30000000
+#define   TXTRI_FORMAT_V_CLAMP_BORDER                  0x40000000
+#define   TXTRI_FORMAT_WRAPV_ENABLE                    0x80000000
+#define TXTRI_FILTER                         0x0000030C
+#define   TXTRI_FILTER_KERNEL_SIZE_X_MSK               0x000000FF
+#define   TXTRI_FILTER_KERNEL_SIZE_Y_MSK               0x00007F00
+#define   TXTRI_FILTER_MIPMAP_DITHER_ENABLE            0x00008000
+#define   TXTRI_FILTER_MIPMAPLODBIAS_MSK               0x00FF0000
+#define   TXTRI_FILTER_TEXTUREMIN_NEAREST              0x01000000
+#define   TXTRI_FILTER_TEXTUREMIN_LINEAR               0x02000000
+#define   TXTRI_FILTER_TEXTUREMIN_MIPNEAREST           0x03000000
+#define   TXTRI_FILTER_TEXTUREMIN_MIPLINEAR            0x04000000
+#define   TXTRI_FILTER_TEXTUREMIN_LINEARMIPNEAREST     0x05000000
+#define   TXTRI_FILTER_TEXTUREMIN_LINEARMIPLINEAR      0x06000000
+#define   TXTRI_FILTER_ANISOTROPIC_MIN_ENABLE          0x08000000
+#define   TXTRI_FILTER_TEXTUREMAG_NEAREST              0x10000000
+#define   TXTRI_FILTER_TEXTUREMAG_LINEAR               0x20000000
+#define   TXTRI_FILTER_TEXTUREMAG_MIPNEAREST           0x30000000
+#define   TXTRI_FILTER_TEXTUREMAG_MIPLINEAR            0x40000000
+#define   TXTRI_FILTER_TEXTUREMAG_LINEARMIPNEAREST     0x50000000
+#define   TXTRI_FILTER_TEXTUREMAG_LINEARMIPLINEAR      0x60000000
+#define   TXTRI_FILTER_ANISOTROPIC_MAG_ENABLE          0x80000000
+#define TXTRI_BLEND                          0x00000310
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_DECAL            0x00000001
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_MODULATE         0x00000002
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_DECALALPHA       0x00000003
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_MODULATEALPHA    0x00000004
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_DECALMASK        0x00000005
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_MODULATEMASK     0x00000006
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_COPY             0x00000007
+#define   TXTRI_BLEND_TEXTUREMAPBLEND_ADD              0x00000008
+#define   TXTRI_BLEND_OPERATION_MUX_TALPHALSB          0x00000010
+#define   TXTRI_BLEND_OPERATION_MUX_TALPHAMSB          0x00000020
+#define   TXTRI_BLEND_SHADEMODE_FLAT                   0x00000040
+#define   TXTRI_BLEND_SHADEMODE_GOURAUD                0x00000080
+#define   TXTRI_BLEND_SHADEMODE_PHONG                  0x000000C0
+#define   TXTRI_BLEND_TEXTUREPERSPECTIVE_ENABLE        0x00000100
+#define   TXTRI_BLEND_SPECULAR_ENABLE                  0x00001000
+#define   TXTRI_BLEND_FOG_ENABLE                       0x00010000
+#define   TXTRI_BLEND_ALPHABLEND_ENABLE                0x00100000
+#define   TXTRI_BLEND_SRCBLEND_ZERO                    0x01000000
+#define   TXTRI_BLEND_SRCBLEND_ONE                     0x02000000
+#define   TXTRI_BLEND_SRCBLEND_SRCCOLOR                0x03000000
+#define   TXTRI_BLEND_SRCBLEND_INVSRCCOLOR             0x04000000
+#define   TXTRI_BLEND_SRCBLEND_SRCALPHA                0x05000000
+#define   TXTRI_BLEND_SRCBLEND_INVSRCALPHA             0x06000000
+#define   TXTRI_BLEND_SRCBLEND_DESTALPHA               0x07000000
+#define   TXTRI_BLEND_SRCBLEND_INVDESTALPHA            0x08000000
+#define   TXTRI_BLEND_SRCBLEND_DESTCOLOR               0x09000000
+#define   TXTRI_BLEND_SRCBLEND_INVDESTCOLOR            0x0A000000
+#define   TXTRI_BLEND_SRCBLEND_SRCALPHASAT             0x0B000000
+#define   TXTRI_BLEND_DESTBLEND_ZERO                   0x10000000
+#define   TXTRI_BLEND_DESTBLEND_ONE                    0x20000000
+#define   TXTRI_BLEND_DESTBLEND_SRCCOLOR               0x30000000
+#define   TXTRI_BLEND_DESTBLEND_INVSRCCOLOR            0x40000000
+#define   TXTRI_BLEND_DESTBLEND_SRCALPHA               0x50000000
+#define   TXTRI_BLEND_DESTBLEND_INVSRCALPHA            0x60000000
+#define   TXTRI_BLEND_DESTBLEND_DESTALPHA              0x70000000
+#define   TXTRI_BLEND_DESTBLEND_INVDESTALPHA           0x80000000
+#define   TXTRI_BLEND_DESTBLEND_DESTCOLOR              0x90000000
+#define   TXTRI_BLEND_DESTBLEND_INVDESTCOLOR           0xA0000000
+#define   TXTRI_BLEND_DESTBLEND_SRCALPHASAT            0xB0000000
+#define TXTRI_CONTROL                        0x00000314
+#define   TXTRI_CONTROL_ALPHAREF_MSK                   0x000000FF
+#define   TXTRI_CONTROL_ALPHAFUNC_NEVER                0x00000100
+#define   TXTRI_CONTROL_ALPHAFUNC_LESS                 0x00000200
+#define   TXTRI_CONTROL_ALPHAFUNC_EQUAL                0x00000300
+#define   TXTRI_CONTROL_ALPHAFUNC_LESSEQUAL            0x00000400
+#define   TXTRI_CONTROL_ALPHAFUNC_GREATER              0x00000500
+#define   TXTRI_CONTROL_ALPHAFUNC_NOTEQUAL             0x00000600
+#define   TXTRI_CONTROL_ALPHAFUNC_GREATEREQUAL         0x00000700
+#define   TXTRI_CONTROL_ALPHAFUNC_ALWAYS               0x00000800
+#define   TXTRI_CONTROL_ALPHATEST_ENABLE               0x00001000
+#define   TXTRI_CONTROL_ORIGIN_CENTER                  0x00000000
+#define   TXTRI_CONTROL_ORIGIN_CORNER                  0x00002000
+#define   TXTRI_CONTROL_Z_ENABLE                       0x00004000
+#define   TXTRI_CONTROL_ZFUNC_NEVER                    0x00010000
+#define   TXTRI_CONTROL_ZFUNC_LESS                     0x00020000
+#define   TXTRI_CONTROL_ZFUNC_EQUAL                    0x00030000
+#define   TXTRI_CONTROL_ZFUNC_LESSEQUAL                0x00040000
+#define   TXTRI_CONTROL_ZFUNC_GREATER                  0x00050000
+#define   TXTRI_CONTROL_ZFUNC_NOTEQUAL                 0x00060000
+#define   TXTRI_CONTROL_ZFUNC_GREATEREQUAL             0x00070000
+#define   TXTRI_CONTROL_ZFUNC_ALWAYS                   0x00080000
+#define   TXTRI_CONTROL_CULLMODE_NONE                  0x00100000
+#define   TXTRI_CONTROL_CULLMODE_CW                    0x00200000
+#define   TXTRI_CONTROL_CULLMODE_CCW                   0x00300000
+#define   TXTRI_CONTROL_DITHER_ENABLE                  0x00400000
+#define   TXTRI_CONTROL_Z_PERSPECTIVE_ENABLE           0x00800000
+#define   TXTRI_CONTROL_ZWRITE_ENABLE                  0x01000000
+#define   TXTRI_CONTROL_Z_FORMAT_FIXED                 0x40000000
+#define   TXTRI_CONTROL_Z_FORMAT_FLOAT                 0x80000000
+#define TXTRI_FOG_COLOR                      0x00000318
+#define TXTRI_VERTEX0                        0x00000400
+#define TXTRI_VERTEX0_X                      0x00000400
+#define TXTRI_VERTEX0_Y                      0x00000404
+#define TXTRI_VERTEX0_Z                      0x00000408
+#define TXTRI_VERTEX0_W                      0x0000040C
+#define TXTRI_VERTEX0_COLOR                  0x00000410
+#define TXTRI_VERTEX0_SPECULAR               0x00000414
+#define TXTRI_VERTEX0_S                      0x00000418
+#define TXTRI_VERTEX0_T                      0x0000041C
+#define TXTRI_PRIMITIVE0                     0x00000600
+
+
+
+
+typedef volatile struct {
+     u32 SetObject;                /* 0000-0003 */
+     u32 Reserved00[0x003];
+#ifdef WORDS_BIGENDIAN
+     u32 Free;                     /* 0010-0013 */
+#else
+     u16 Free;                     /* 0010-0011 */
+     u16 Nop;                      /* 0012-0013 */
+#endif
+     u32 Reserved01[0x00B];
+     u32 DmaPut;                   /* 0040-0043 */
+     u32 DmaGet;                   /* 0044-0047 */
+     u32 Reserved02[0x02E];
+     union {
+          NVSurfaces2D          Surfaces2D;
+          NVSurfaces3D          Surfaces3D;
+          NVClip                Clip;
+          NVBeta1               Beta1;
+          NVBeta4               Beta4;
+          NVRectangle           Rectangle;
+          NVTriangle            Triangle;
+          NVLine                Line;
+          NVScreenBlt           ScreenBlt;
+          NVImageBlt            ImageBlt;
+          NVScaledImage         ScaledImage;
+          NVStretchedImage      StretchedImage;
+          NVTexturedTriangleDx5 TexTriangle;
+     } o;
+} NVDmaSubChannel;
+
+
+typedef volatile struct {
+     NVDmaSubChannel sub[8];
+} NVDmaChannel;
+
+
+
+#endif /* __NVIDIA_REGS_H__ */
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.c b/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.c
new file mode 100755
index 0000000..70645f2
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.c
@@ -0,0 +1,730 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/system.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include "nvidia.h"
+#include "nvidia_regs.h"
+#include "nvidia_accel.h"
+#include "nvidia_objects.h"
+#include "nvidia_state.h"
+
+
+#define NVIDIA_IS_SET( flag )  ((nvdev->set & SMF_##flag) == SMF_##flag)
+
+#define NVIDIA_SET( flag )      nvdev->set |= SMF_##flag
+
+#define NVIDIA_UNSET( flag )    nvdev->set &= ~SMF_##flag
+
+
+
+void nv_set_destination( NVidiaDriverData *nvdrv,
+                         NVidiaDeviceData *nvdev,
+                         CardState        *state )
+{
+     CoreSurface   *surface = state->destination;
+     volatile u8   *mmio    = nvdrv->mmio_base;
+     u32            dst_offset;
+     u32            dst_pitch;
+     u32            src_pitch;
+     
+     if (NVIDIA_IS_SET( DESTINATION ))
+          return;
+          
+     dst_offset = (state->dst.offset + nvdev->fb_offset) & ~63;
+     dst_pitch  = state->dst.pitch & ~31;
+     src_pitch  = (nvdev->src_pitch & ~31) ? : 32; // align to 32, maybe system buffer pitch
+
+     if (nvdev->dst_format != surface->config.format) {
+          u32   sformat2D = 0;
+          u32   sformat3D = 0;
+          u32   cformat   = 0;
+          bool  dst_422 = false;
+
+          switch (surface->config.format) {
+               case DSPF_A8:
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_RGB332:
+                    sformat2D = SURFACES2D_FORMAT_Y8;
+                    cformat   = RECT_COLOR_FORMAT_Y32;
+                    break;
+               case DSPF_RGB555:
+                    sformat2D = SURFACES2D_FORMAT_X1R5G5B5;
+                    sformat3D = SURFACES3D_FORMAT_COLOR_X1R5G5B5;
+                    cformat   = RECT_COLOR_FORMAT_A1Y15;
+                    break;
+               case DSPF_ARGB1555:
+                    sformat2D = SURFACES2D_FORMAT_A1R5G5B5;
+                    sformat3D = SURFACES3D_FORMAT_COLOR_A1R5G5B5;
+                    cformat   = RECT_COLOR_FORMAT_A1Y15;
+                    break;
+               case DSPF_RGB16:
+                    sformat2D = SURFACES2D_FORMAT_R5G6B5;
+                    sformat3D = SURFACES3D_FORMAT_COLOR_R5G6B5;
+                    cformat   = RECT_COLOR_FORMAT_Y16;
+                    break;
+               case DSPF_RGB32:
+                    sformat2D = SURFACES2D_FORMAT_X8R8G8B8;
+                    sformat3D = SURAFCES3D_FORMAT_COLOR_X8R8G8B8;
+                    cformat   = RECT_COLOR_FORMAT_Y32;
+                    break;
+               case DSPF_ARGB:
+                    sformat2D = SURFACES2D_FORMAT_A8R8G8B8;
+                    sformat3D = SURFACES3D_FORMAT_COLOR_A8R8G8B8;
+                    cformat   = 0x0D;
+                    break;
+               case DSPF_YUY2:
+                    sformat2D = SURFACES2D_FORMAT_A8R8G8B8;
+                    cformat   = 0x12;
+                    dst_422 = true;
+                    break;
+               case DSPF_UYVY:
+                    sformat2D = SURFACES2D_FORMAT_A8R8G8B8;
+                    cformat   = 0x13;
+                    dst_422 = true;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    return;
+          }
+
+          if (sformat2D == SURFACES2D_FORMAT_A8R8G8B8) {     
+               /* need to set color format manually */
+               nv_waitidle( nvdrv, nvdev );
+
+               nv_out32( mmio, PRAMIN + (ADDR_RECTANGLE << 4) + 4, cformat << 8 );
+               nv_out32( mmio, PRAMIN + (ADDR_TRIANGLE  << 4) + 4, cformat << 8 );
+               nv_out32( mmio, PRAMIN + (ADDR_LINE      << 4) + 4, cformat << 8 );
+
+               nv_assign_object( nvdrv, nvdev, 
+                                 SUBC_RECTANGLE, OBJ_RECTANGLE, true );
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_TRIANGLE, OBJ_TRIANGLE, true );
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_LINE, OBJ_LINE, true );
+          } else {
+               nv_begin( SUBC_RECTANGLE, RECT_COLOR_FORMAT, 1 );
+               nv_outr( cformat );
+               
+               nv_begin( SUBC_TRIANGLE, TRI_COLOR_FORMAT, 1 );
+               nv_outr( cformat );
+               
+               nv_begin( SUBC_LINE, LINE_COLOR_FORMAT, 1 );
+               nv_outr( cformat );
+          }
+
+          nv_assign_object( nvdrv, nvdev, 
+                            SUBC_SURFACES2D, OBJ_SURFACES2D, false );
+
+          nv_begin( SUBC_SURFACES2D, SURFACES2D_FORMAT, 2 );
+          nv_outr( sformat2D );
+          nv_outr( (dst_pitch << 16) | (src_pitch & 0xFFFF) );
+          nv_begin( SUBC_SURFACES2D, SURFACES2D_DST_OFFSET, 1 );
+          nv_outr( dst_offset );
+
+          if (nvdev->enabled_3d && sformat3D) {
+               nv_assign_object( nvdrv, nvdev, 
+                                 SUBC_SURFACES3D, OBJ_SURFACES3D, false );
+               
+               nv_begin( SUBC_SURFACES3D, SURFACES3D_FORMAT, 1 );
+               nv_outr( sformat3D | SURFACES3D_FORMAT_TYPE_PITCH );
+               nv_begin( SUBC_SURFACES3D, SURFACES3D_PITCH, 2 );
+               nv_outr( (64 << 16) | (dst_pitch & 0xFFFF) );
+               nv_outr( dst_offset );
+          }
+          
+          if (nvdev->dst_422 != dst_422) {
+               NVIDIA_UNSET( CLIP );
+               NVIDIA_UNSET( BLITTING_FLAGS );
+               nvdev->dst_422 = dst_422;
+          }
+          
+          NVIDIA_UNSET( COLOR );
+          NVIDIA_UNSET( DST_BLEND );
+     }
+     else if (nvdev->dst_offset != dst_offset ||
+              nvdev->dst_pitch  != dst_pitch) {
+          nv_assign_object( nvdrv, nvdev,
+                            SUBC_SURFACES2D, OBJ_SURFACES2D, false );
+
+          nv_begin( SUBC_SURFACES2D, SURFACES2D_PITCH, 1 );
+          nv_outr( (dst_pitch << 16) | (src_pitch & 0xFFFF) );
+          nv_begin( SUBC_SURFACES2D, SURFACES2D_DST_OFFSET, 1 );
+          nv_outr( dst_offset );
+
+          if (nvdev->enabled_3d) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_SURFACES3D, OBJ_SURFACES3D, false );
+               
+               nv_begin( SUBC_SURFACES3D, SURFACES3D_PITCH, 2 );
+               nv_outr( (64 << 16) | (dst_pitch & 0xFFFF) );
+               nv_outr( dst_offset );
+          }
+     }
+     
+     nvdev->dst_format = surface->config.format;
+     nvdev->dst_offset = dst_offset;
+     nvdev->dst_pitch  = dst_pitch;
+     
+     NVIDIA_SET( DESTINATION );
+}
+
+void nv_set_source( NVidiaDriverData *nvdrv,
+                    NVidiaDeviceData *nvdev,
+                    CardState        *state )
+{
+     CoreSurface *surface = state->source;
+    
+     nvdev->src_lock = &state->src;
+    
+     if (NVIDIA_IS_SET( SOURCE )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (nvdev->blittingflags & DSBLIT_DEINTERLACE))
+               return;
+     }
+          
+     if (state->src.buffer->policy == CSP_SYSTEMONLY) { 
+          if (!nvdev->src_system) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_IMAGEBLT, OBJ_IMAGEBLT, false );
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_STRETCHEDIMAGE, OBJ_STRETCHEDIMAGE, false );
+               
+               NVIDIA_UNSET( BLITTING_FLAGS );
+          }
+
+          nvdev->src_address = state->src.addr;
+          nvdev->src_pitch   = state->src.pitch;
+          nvdev->src_system  = true;
+     }
+     else {
+          u32 src_offset = (state->src.offset + nvdev->fb_offset) & ~63;
+          u32 src_pitch  = state->src.pitch & ~31;
+
+          if (nvdev->src_offset != src_offset ||
+              nvdev->src_pitch  != src_pitch) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_SURFACES2D, OBJ_SURFACES2D, false );
+          
+               nv_begin( SUBC_SURFACES2D, SURFACES2D_PITCH, 2 );
+               nv_outr( (nvdev->dst_pitch << 16) | (src_pitch & 0xFFFF) );
+               nv_outr( src_offset );
+          }
+
+          if (nvdev->src_system) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_SCREENBLT, OBJ_SCREENBLT, false );
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_SCALEDIMAGE, OBJ_SCALEDIMAGE, false );
+                          
+               NVIDIA_UNSET( BLITTING_FLAGS );
+          }
+               
+          nvdev->src_offset = src_offset;
+          nvdev->src_pitch  = src_pitch;
+          nvdev->src_system = false;
+     }
+
+     nvdev->src_width  = surface->config.size.w;
+     nvdev->src_height = surface->config.size.h;
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) {
+          nvdev->src_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field) {
+                    nvdev->src_address += nvdev->src_height * nvdev->src_pitch;
+                    nvdev->src_offset  += nvdev->src_height * nvdev->src_pitch;
+               }
+          } else {
+               if (surface->field) {
+                    nvdev->src_address += nvdev->src_pitch;
+                    nvdev->src_offset  += nvdev->src_pitch;
+               }
+               nvdev->src_pitch *= 2;
+          }
+          nvdev->src_interlaced = true;
+     } else
+          nvdev->src_interlaced = false;
+     
+     if (nvdev->enabled_3d) {
+          u32 size_u = direct_log2(surface->config.size.w) & 0xF;
+          u32 size_v = direct_log2(surface->config.size.h) & 0xF;
+
+          nvdev->state3d[1].offset  = nvdev->fb_offset + nvdev->buf_offset[1];
+          nvdev->state3d[1].format &= 0xFF00FFFF;
+          nvdev->state3d[1].format |= (size_u << 16) | (size_v << 20);
+     }
+
+     if (nvdev->src_format != surface->config.format) {
+          NVIDIA_UNSET( SRC_BLEND );
+          NVIDIA_UNSET( BLITTING_FLAGS );
+          nvdev->src_format = surface->config.format;
+     }
+     
+     NVIDIA_SET( SOURCE );
+}
+
+void nv_set_clip( NVidiaDriverData *nvdrv,
+                  NVidiaDeviceData *nvdev,
+                  CardState        *state )
+{
+     DFBRectangle *cr = &nvdev->clip;
+     
+     if (NVIDIA_IS_SET( CLIP ))
+          return;
+
+     cr->x = state->clip.x1;
+     cr->y = state->clip.y1;
+     cr->w = state->clip.x2 - state->clip.x1 + 1;
+     cr->h = state->clip.y2 - state->clip.y1 + 1;
+
+     if (nvdev->dst_422) {
+          cr->x =  cr->x / 2;
+          cr->w = (cr->w / 2) ? : 1;
+     }
+
+     nv_begin( SUBC_CLIP, CLIP_TOP_LEFT, 2 );
+     nv_outr( (cr->y << 16) | (cr->x & 0xFFFF) );
+     nv_outr( (cr->h << 16) | (cr->w & 0xFFFF) );
+
+     NVIDIA_SET( CLIP );
+}
+
+void nv_set_drawing_color( NVidiaDriverData *nvdrv,
+                           NVidiaDeviceData *nvdev,
+                           CardState        *state )
+{
+     DFBColor color   = state->color;
+     int      y, u, v;
+     
+     if (NVIDIA_IS_SET( DRAWING_COLOR ) && NVIDIA_IS_SET( DRAWING_FLAGS ))
+          return;
+     
+     switch (nvdev->dst_format) {
+          case DSPF_A8:
+               nvdev->color2d = color.a;
+               break;
+          case DSPF_LUT8:
+               nvdev->color2d = state->color_index;
+               break;
+          case DSPF_ALUT44:
+               nvdev->color2d = (state->color_index & 0x0F) |
+                                (state->color.a     & 0xF0);
+               break;
+          case DSPF_RGB332:
+               nvdev->color2d = PIXEL_RGB332( color.r,
+                                              color.g,
+                                              color.b );
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               nvdev->color2d = PIXEL_ARGB1555( color.a,
+                                                color.r,
+                                                color.g,
+                                                color.b );
+               break;
+          case DSPF_RGB16:
+               nvdev->color2d = PIXEL_RGB16( color.r,
+                                             color.g,
+                                             color.b );
+               break;
+          case DSPF_RGB32:
+               nvdev->color2d = PIXEL_RGB32( color.r,
+                                             color.g,
+                                             color.b );
+               break;
+          case DSPF_ARGB:
+               nvdev->color2d = PIXEL_ARGB( color.a,
+                                            color.r,
+                                            color.g,
+                                            color.b );
+               break;
+
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               nvdev->color2d = PIXEL_YUY2( y, u, v );
+               break;
+
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               nvdev->color2d = PIXEL_UYVY( y, u, v );
+               break;
+
+          default:
+               D_BUG( "unexpected pixelformat" );
+               break;
+     }
+
+     nvdev->color3d = PIXEL_ARGB(color.a, color.r, color.g, color.b);
+     
+     if (nvdev->dst_format == DSPF_ARGB1555) {
+          nv_assign_object( nvdrv, nvdev,
+                            SUBC_SURFACES2D, OBJ_SURFACES2D, false );
+          
+          nv_begin( SUBC_SURFACES2D, SURFACES2D_FORMAT, 1 );
+          nv_outr( (nvdev->color2d & 0x8000) 
+                   ? SURFACES2D_FORMAT_A1R5G5B5
+                   : SURFACES2D_FORMAT_X1R5G5B5 );
+     }
+  
+     if (state->drawingflags & DSDRAW_BLEND && !nvdev->enabled_3d) {
+          if (!nvdev->beta1_set || nvdev->beta1_val != (color.a << 23)) {
+               nv_assign_object( nvdrv, nvdev, SUBC_BETA1, OBJ_BETA1, false );
+                    
+               nv_begin( SUBC_BETA1, BETA1_FACTOR, 1 );
+               nv_outr( color.a << 23 );
+
+               nvdev->beta1_val = color.a << 23;
+               nvdev->beta1_set = true;
+          }
+     }
+     
+     NVIDIA_SET  ( DRAWING_COLOR );
+     NVIDIA_UNSET( BLITTING_COLOR );
+}
+
+void nv_set_blitting_color( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state )
+{
+     DFBColor color = state->color;
+     
+     if (NVIDIA_IS_SET( BLITTING_COLOR ) && NVIDIA_IS_SET( BLITTING_FLAGS ))
+          return;
+                    
+     if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR) ||
+        (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL && state->src_blend == DSBF_ONE)) {       
+          nvdev->color3d = (state->blittingflags & DSBLIT_BLEND_COLORALPHA)
+                           ? (color.a << 24) : 0xFF000000;
+          
+          if (state->blittingflags & DSBLIT_COLORIZE &&
+              state->blittingflags & (DSBLIT_SRC_PREMULTCOLOR | DSBLIT_BLEND_COLORALPHA)) {
+               nvdev->color3d |= PIXEL_RGB32( color.r * color.a / 0xFF,
+                                              color.g * color.a / 0xFF,
+                                              color.b * color.a / 0xFF );
+          }
+          else if (state->blittingflags & DSBLIT_COLORIZE) {
+               nvdev->color3d |= PIXEL_RGB32( color.r, color.g, color.b );
+          }
+          else if (state->blittingflags & (DSBLIT_SRC_PREMULTCOLOR | DSBLIT_BLEND_COLORALPHA)) {
+               nvdev->color3d |= PIXEL_RGB32( color.a, color.a, color.a );
+          }
+          else {
+               nvdev->color3d |= 0x00FFFFFF;
+          }
+
+          if (!nvdev->beta4_set || nvdev->beta4_val != nvdev->color3d) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_BETA4, OBJ_BETA4, false );
+                                 
+               nv_begin( SUBC_BETA4, BETA4_FACTOR, 1 );
+               nv_outr( nvdev->color3d );
+
+               nvdev->beta4_val = nvdev->color3d;
+               nvdev->beta4_set = true;
+          }
+     }
+     else if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                      DSBLIT_BLEND_ALPHACHANNEL)) {
+          u32 beta1;
+          
+          if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               nvdev->color3d = (color.a << 24) | 0x00FFFFFF;
+               beta1          =  color.a << 23;
+          } else {
+               nvdev->color3d = 0xFFFFFFFF;
+               beta1          = 0x7F800000;
+          }
+          
+          if (!nvdev->beta1_set || nvdev->beta1_val != beta1) {
+               nv_assign_object( nvdrv, nvdev,
+                                 SUBC_BETA1, OBJ_BETA1, false );
+
+               nv_begin( SUBC_BETA1, BETA1_FACTOR, 1 );
+               nv_outr( beta1 );
+
+               nvdev->beta1_val = beta1;
+               nvdev->beta1_set = true;
+          }
+     }
+     
+     NVIDIA_SET  ( BLITTING_COLOR );
+     NVIDIA_UNSET( DRAWING_COLOR );
+}
+
+void nv_set_blend_function( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state )
+{
+     DFBSurfaceBlendFunction sblend, dblend;
+     
+     if (NVIDIA_IS_SET( SRC_BLEND ) && NVIDIA_IS_SET( DST_BLEND ))
+          return;
+       
+     sblend = state->src_blend;
+     dblend = state->dst_blend;
+     
+     if (!DFB_PIXELFORMAT_HAS_ALPHA(nvdev->dst_format)) {
+          if (sblend == DSBF_DESTALPHA)
+               sblend = DSBF_ONE;
+          else if (sblend == DSBF_INVDESTALPHA)
+               sblend = DSBF_ZERO;
+               
+          if (dblend == DSBF_DESTALPHA)
+               dblend = DSBF_ONE;
+          else if (dblend == DSBF_INVDESTALPHA)
+               dblend = DSBF_ZERO;
+     }
+          
+     nvdev->state3d[0].blend &= 0x00FFFFFF;
+     nvdev->state3d[0].blend |= (sblend << 24) | (dblend << 28);
+     nvdev->state3d[1].blend &= 0x00FFFFFF;
+     nvdev->state3d[1].blend |= (sblend << 24) | (dblend << 28);
+         
+     if (!NVIDIA_IS_SET( SRC_BLEND ))
+          NVIDIA_UNSET( BLITTING_FLAGS );
+     NVIDIA_SET( SRC_BLEND );
+     NVIDIA_SET( DST_BLEND );
+}
+
+void nv_set_drawingflags( NVidiaDriverData *nvdrv,
+                          NVidiaDeviceData *nvdev,
+                          CardState        *state )
+{
+     if (NVIDIA_IS_SET( DRAWING_FLAGS ))
+          return;
+          
+     if (!nvdev->enabled_3d) {
+          u32 operation;
+          
+          if (state->drawingflags & DSDRAW_BLEND)
+               operation = OPERATION_BLEND;
+          else
+               operation = OPERATION_SRCCOPY;
+          
+          if (nvdev->drawing_operation != operation) {
+               nv_begin( SUBC_RECTANGLE, RECT_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nv_begin( SUBC_TRIANGLE, TRI_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nv_begin( SUBC_LINE, LINE_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nvdev->drawing_operation = operation;
+          }
+     }
+     else {
+          if (state->drawingflags & DSDRAW_BLEND)
+               nvdev->state3d[0].blend |= TXTRI_BLEND_ALPHABLEND_ENABLE;
+          else
+               nvdev->state3d[0].blend &= ~TXTRI_BLEND_ALPHABLEND_ENABLE;
+     }
+
+     nvdev->drawingflags = state->drawingflags;
+     
+     NVIDIA_SET( DRAWING_FLAGS );
+}
+
+void nv_set_blittingflags( NVidiaDriverData *nvdrv,
+                           NVidiaDeviceData *nvdev,
+                           CardState        *state )
+{
+     u32  operation;
+     bool src_alpha;
+     
+     if (NVIDIA_IS_SET( BLITTING_FLAGS ))
+          return;
+          
+     operation = (nvdev->arch > NV_ARCH_04) ? OPERATION_SRCCOPY : OPERATION_COPY;
+     src_alpha = true;
+     
+     if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                 DSBLIT_BLEND_ALPHACHANNEL)) {
+          if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR) ||
+             (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL && state->src_blend == DSBF_ONE)) {
+               operation = OPERATION_BLEND_PREMULTIPLIED;
+          }
+          else {
+               operation = OPERATION_BLEND;
+               src_alpha = !!(state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL);
+          }
+     }
+     else if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR)) {
+          operation = OPERATION_COLOR_MULTIPLY;
+     }
+
+     if (nvdev->src_system) {
+          switch (nvdev->src_format) {
+               case DSPF_RGB555:
+                    nvdev->system_format = IBLIT_COLOR_FORMAT_X1R5G5B5;
+                    break;
+               case DSPF_ARGB1555:
+                    nvdev->system_format = src_alpha
+                                           ? IBLIT_COLOR_FORMAT_A1R5G5B5 
+                                           : IBLIT_COLOR_FORMAT_X1R5G5B5;
+                    break;
+               case DSPF_RGB16:
+                    nvdev->system_format = IBLIT_COLOR_FORMAT_R5G6B5;
+                    break;
+               case DSPF_RGB32:
+                    nvdev->system_format = IBLIT_COLOR_FORMAT_X8R8G8B8;
+                    break;
+               case DSPF_ARGB:
+                    nvdev->system_format = src_alpha 
+                                           ? IBLIT_COLOR_FORMAT_A8R8G8B8 
+                                           : IBLIT_COLOR_FORMAT_X8R8G8B8;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    break;
+          }
+ 
+          if (nvdev->system_operation != operation) {
+               nv_begin( SUBC_IMAGEBLT, IBLIT_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nv_begin( SUBC_STRETCHEDIMAGE, ISTRETCH_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nvdev->system_operation = operation;
+          }
+     }
+     else {
+          switch (nvdev->src_format) {
+               case DSPF_A8:
+                    nvdev->scaler_format = SCALER_COLOR_FORMAT_AY8;
+                    break;
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_RGB332:
+                    nvdev->scaler_format = SCALER_COLOR_FORMAT_Y8;
+                    break;
+               case DSPF_RGB555:
+                    nvdev->scaler_format = SCALER_COLOR_FORMAT_X1R5G5B5;
+                    break;
+               case DSPF_ARGB1555:
+                    nvdev->scaler_format = src_alpha
+                                           ? SCALER_COLOR_FORMAT_A1R5G5B5
+                                           : SCALER_COLOR_FORMAT_X1R5G5B5;
+                    break;
+               case DSPF_RGB16:
+                    nvdev->scaler_format = SCALER_COLOR_FORMAT_R5G6B5;
+                    break;
+               case DSPF_RGB32:
+                    nvdev->scaler_format = SCALER_COLOR_FORMAT_X8R8G8B8;
+                    break;
+               case DSPF_ARGB:
+                    nvdev->scaler_format = src_alpha
+                                           ? SCALER_COLOR_FORMAT_A8R8G8B8
+                                           : SCALER_COLOR_FORMAT_X8R8G8B8;
+                    break;
+               case DSPF_YUY2:
+                    nvdev->scaler_format = nvdev->dst_422
+                                           ? SCALER_COLOR_FORMAT_A8R8G8B8
+                                           : SCALER_COLOR_FORMAT_V8YB8U8YA8;
+                    break;
+               case DSPF_UYVY:
+                    nvdev->scaler_format = nvdev->dst_422
+                                           ? SCALER_COLOR_FORMAT_A8R8G8B8
+                                           : SCALER_COLOR_FORMAT_YB8V8YA8U8;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat 0x%08x", nvdev->src_format );
+                    break;
+          }
+          
+          if (nvdev->scaler_operation != operation) {
+               nv_begin( SUBC_SCALEDIMAGE, SCALER_OPERATION, 1 );
+               nv_outr( operation );
+               
+               nvdev->scaler_operation = operation;
+          }
+     }
+     
+     if (nvdev->enabled_3d) {
+          nvdev->state3d[1].format &= 0xFFFFF0FF;
+          nvdev->state3d[1].blend  &= 0xFF00FFF0;
+
+          switch (nvdev->src_format) {
+               case DSPF_RGB555:
+                    nvdev->state3d[1].format |= TXTRI_FORMAT_COLOR_X1R5G5B5;
+                    break;
+               case DSPF_ARGB1555:
+                    nvdev->state3d[1].format |= TXTRI_FORMAT_COLOR_A1R5G5B5;
+                    break;
+               case DSPF_A8:
+               case DSPF_ARGB:
+                    nvdev->state3d[1].format |= TXTRI_FORMAT_COLOR_A4R4G4B4;
+                    break;
+               default:
+                    nvdev->state3d[1].format |= TXTRI_FORMAT_COLOR_R5G6B5;
+                    break;
+          }
+          
+          if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA | DSBLIT_COLORIZE | 
+                                      DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_SRC_PREMULTCOLOR)) {                         
+               if (state->blittingflags & DSBLIT_BLEND_COLORALPHA)
+                    nvdev->state3d[1].blend |= 
+                         TXTRI_BLEND_TEXTUREMAPBLEND_MODULATEALPHA;
+               else
+                    nvdev->state3d[1].blend |= 
+                         TXTRI_BLEND_TEXTUREMAPBLEND_MODULATE;
+
+               if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                           DSBLIT_BLEND_ALPHACHANNEL))
+                    nvdev->state3d[1].blend |= TXTRI_BLEND_ALPHABLEND_ENABLE;
+          } else
+               nvdev->state3d[1].blend |= TXTRI_BLEND_TEXTUREMAPBLEND_COPY;
+     }
+ 
+     nvdev->blittingflags = state->blittingflags;
+     
+     NVIDIA_SET( BLITTING_FLAGS );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.h b/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.h
new file mode 100755
index 0000000..5bfc8f1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/nvidia/nvidia_state.h
@@ -0,0 +1,58 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __NVIDIA_STATE_H__
+#define __NVIDIA_STATE_H__
+
+
+void nv_set_destination   ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_source        ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_clip          ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_drawing_color ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_blitting_color( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_blend_function( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_drawingflags  ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+void nv_set_blittingflags ( NVidiaDriverData *nvdrv,
+                            NVidiaDeviceData *nvdev,
+                            CardState        *state );
+
+#endif /* __NVIDIA_STATE_H__ */
diff --git a/Source/DirectFB/gfxdrivers/omap/Makefile.am b/Source/DirectFB/gfxdrivers/omap/Makefile.am
new file mode 100755
index 0000000..2132563
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/Makefile.am
@@ -0,0 +1,34 @@
+## Makefile.am for DirectFB/gfxdrivers/omap
+
+INCLUDES = \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib \
+	-I$(top_srcdir)/lib \
+	-I$(top_srcdir)/systems \
+	-I$(top_srcdir)/src
+
+omap_LTLIBRARIES = libdirectfb_omap.la
+
+if BUILD_STATIC
+omap_DATA = $(omap_LTLIBRARIES:.la=.o)
+endif
+
+omapdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_omap_la_SOURCES = \
+	omap.c \
+	omap.h \
+	omapfb.h \
+	omap_primary.c
+
+libdirectfb_omap_la_LDFLAGS = \
+	-module \
+	-avoid-version \
+	$(DFB_LDFLAGS)
+
+libdirectfb_omap_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/omap/Makefile.in b/Source/DirectFB/gfxdrivers/omap/Makefile.in
new file mode 100755
index 0000000..ba95bd1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/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/omap
+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)$(omapdir)" "$(DESTDIR)$(omapdir)"
+omapLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(omap_LTLIBRARIES)
+libdirectfb_omap_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_omap_la_OBJECTS = omap.lo omap_primary.lo
+libdirectfb_omap_la_OBJECTS = $(am_libdirectfb_omap_la_OBJECTS)
+libdirectfb_omap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_omap_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_omap_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_omap_la_SOURCES)
+omapDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(omap_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib \
+	-I$(top_srcdir)/lib \
+	-I$(top_srcdir)/systems \
+	-I$(top_srcdir)/src
+
+omap_LTLIBRARIES = libdirectfb_omap.la
+@BUILD_STATIC_TRUE@omap_DATA = $(omap_LTLIBRARIES:.la=.o)
+omapdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_omap_la_SOURCES = \
+	omap.c \
+	omap.h \
+	omapfb.h \
+	omap_primary.c
+
+libdirectfb_omap_la_LDFLAGS = \
+	-module \
+	-avoid-version \
+	$(DFB_LDFLAGS)
+
+libdirectfb_omap_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/omap/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/omap/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-omapLTLIBRARIES: $(omap_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(omapdir)" || $(MKDIR_P) "$(DESTDIR)$(omapdir)"
+	@list='$(omap_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(omapLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(omapdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(omapLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(omapdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-omapLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(omap_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(omapdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(omapdir)/$$p"; \
+	done
+
+clean-omapLTLIBRARIES:
+	-test -z "$(omap_LTLIBRARIES)" || rm -f $(omap_LTLIBRARIES)
+	@list='$(omap_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_omap.la: $(libdirectfb_omap_la_OBJECTS) $(libdirectfb_omap_la_DEPENDENCIES) 
+	$(libdirectfb_omap_la_LINK) -rpath $(omapdir) $(libdirectfb_omap_la_OBJECTS) $(libdirectfb_omap_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omap_primary.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-omapDATA: $(omap_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(omapdir)" || $(MKDIR_P) "$(DESTDIR)$(omapdir)"
+	@list='$(omap_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(omapDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(omapdir)/$$f'"; \
+	  $(omapDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(omapdir)/$$f"; \
+	done
+
+uninstall-omapDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(omap_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(omapdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(omapdir)/$$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)$(omapdir)" "$(DESTDIR)$(omapdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-omapLTLIBRARIES \
+	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-omapDATA install-omapLTLIBRARIES
+
+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-omapDATA uninstall-omapLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-omapLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-omapDATA install-omapLTLIBRARIES 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-omapDATA \
+	uninstall-omapLTLIBRARIES
+
+%.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/omap/omap.c b/Source/DirectFB/gfxdrivers/omap/omap.c
new file mode 100755
index 0000000..6cb208f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/omap.c
@@ -0,0 +1,142 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <sys/ioctl.h>
+
+#include <dfb_types.h>
+
+#include <fbdev/fb.h>
+#include "omapfb.h"
+
+#include <directfb.h>
+
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+#include <fbdev/fbdev.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( omap )
+
+#include "omap.h"
+
+/* */
+
+static DFBResult
+omapEngineSync( void *drv, void *dev )
+{
+     FBDev *dfb_fbdev = dfb_system_data();
+
+     /* FIXME needed? */
+     ioctl( dfb_fbdev->fd, OMAPFB_SYNC_GFX );
+
+     return DFB_OK;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     FBDev *dfb_fbdev = dfb_system_data();
+     struct omapfb_caps caps;
+
+     if (ioctl( dfb_fbdev->fd, OMAPFB_GET_CAPS, &caps))
+          return 0;
+
+     return 1;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *driver_info )
+{
+     driver_info->version.major = 0;
+     driver_info->version.minor = 1;
+
+     direct_snputs( driver_info->name,
+                    "TI OMAP Driver", DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH );
+     direct_snputs( driver_info->vendor,
+                    "Ville Syrjala", DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH );
+     direct_snputs( driver_info->url,
+                    "http://www.directfb.org", DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH );
+     direct_snputs( driver_info->license,
+                    "LGPL", DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH );
+
+#if 0
+     driver_info->driver_data_size = sizeof (OmapDriverData);
+     driver_info->device_data_size = sizeof (OmapDeviceData);
+#endif
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     funcs->EngineSync = omapEngineSync;
+
+     dfb_layers_hook_primary( device, driver_data, &omapPrimaryLayerFuncs, NULL, NULL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     direct_snputs( device_info->name,
+                    "OMAP", DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH );
+     direct_snputs( device_info->vendor,
+                    "TI", DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH );
+
+     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/omap/omap.h b/Source/DirectFB/gfxdrivers/omap/omap.h
new file mode 100755
index 0000000..3eeaa7a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/omap.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 OMAP_H
+#define OMAP_H
+
+#include <direct/debug.h>
+
+#include <core/layers.h>
+
+D_DEBUG_DOMAIN( omap, "OMAP", "TI OMAP gfx driver" );
+
+#if 0
+typedef struct {
+} OmapDeviceData;
+
+typedef struct {
+} OmapDriverData;
+#endif
+
+extern DisplayLayerFuncs omapPrimaryLayerFuncs;
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/omap/omap_primary.c b/Source/DirectFB/gfxdrivers/omap/omap_primary.c
new file mode 100755
index 0000000..8bdfc61
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/omap_primary.c
@@ -0,0 +1,102 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <sys/ioctl.h>
+
+#include <dfb_types.h>
+
+#include <fbdev/fb.h>
+#include "omapfb.h"
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+#include <fbdev/fbdev.h>
+
+#include "omap.h"
+
+/* */
+
+static DFBResult
+omapUpdateRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreSurface           *surface,
+                  const DFBRegion       *update,
+                  CoreSurfaceBufferLock *lock )
+{
+     FBDev *dfb_fbdev = dfb_system_data();
+     struct omapfb_update_window window;
+     DFBRectangle rect;
+
+     dfb_rectangle_from_region( &rect, update );
+
+     D_DEBUG_AT( omap, "Update rectangle %d %d %dx%d\n",
+                 rect.x, rect.y, rect.w, rect.h );
+
+     if (rect.x & 1)
+          rect.w++;
+     if (rect.y & 1)
+          rect.h++;
+
+     window.x = rect.x & ~1;
+     window.y = rect.y & ~1;
+
+     window.width  = (rect.w + 1) & ~1;
+     window.height = (rect.h + 1) & ~1;
+
+     window.out_x = window.x;
+     window.out_y = window.y;
+
+     window.out_width  = window.width;
+     window.out_height = window.height;
+
+     window.format = 0;
+
+     D_DEBUG_AT( omap, "Update window %d %d %dx%d\n",
+                 window.x, window.y, window.width, window.height );
+
+     if (ioctl( dfb_fbdev->fd, OMAPFB_UPDATE_WINDOW, &window ))
+          D_DEBUG_AT( omap, "Can't update window -> %s\n", strerror( errno ) );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs omapPrimaryLayerFuncs = {
+     .UpdateRegion = omapUpdateRegion,
+};
diff --git a/Source/DirectFB/gfxdrivers/omap/omapfb.h b/Source/DirectFB/gfxdrivers/omap/omapfb.h
new file mode 100755
index 0000000..5d511b9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/omap/omapfb.h
@@ -0,0 +1,163 @@
+/*
+ * File: include/asm-arm/arch-omap/omapfb.h
+ *
+ * Framebuffer driver for TI OMAP boards
+ *
+ * Copyright (C) 2004 Nokia Corporation
+ * Author: Imre Deak <imre.deak@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef __OMAPFB_H
+#define __OMAPFB_H
+
+#include <asm/ioctl.h>
+#include <asm/types.h>
+
+/* IOCTL commands. */
+
+#define OMAP_IOW(num, dtype)	_IOW('O', num, dtype)
+#define OMAP_IOR(num, dtype)	_IOR('O', num, dtype)
+#define OMAP_IOWR(num, dtype)	_IOWR('O', num, dtype)
+#define OMAP_IO(num)		_IO('O', num)
+
+#define OMAPFB_MIRROR		OMAP_IOW(31, int)
+#define OMAPFB_SYNC_GFX		OMAP_IO(37)
+#define OMAPFB_VSYNC		OMAP_IO(38)
+#define OMAPFB_SET_UPDATE_MODE	OMAP_IOW(40, int)
+#define OMAPFB_GET_CAPS		OMAP_IOR(42, struct omapfb_caps)
+#define OMAPFB_GET_UPDATE_MODE	OMAP_IOW(43, int)
+#define OMAPFB_LCD_TEST		OMAP_IOW(45, int)
+#define OMAPFB_CTRL_TEST	OMAP_IOW(46, int)
+#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
+#define OMAPFB_SET_COLOR_KEY	OMAP_IOW(50, struct omapfb_color_key)
+#define OMAPFB_GET_COLOR_KEY	OMAP_IOW(51, struct omapfb_color_key)
+#define OMAPFB_SETUP_PLANE	OMAP_IOW(52, struct omapfb_plane_info)
+#define OMAPFB_QUERY_PLANE	OMAP_IOW(53, struct omapfb_plane_info)
+#define OMAPFB_UPDATE_WINDOW	OMAP_IOW(54, struct omapfb_update_window)
+#define OMAPFB_SETUP_MEM	OMAP_IOW(55, struct omapfb_mem_info)
+#define OMAPFB_QUERY_MEM	OMAP_IOW(56, struct omapfb_mem_info)
+
+#define OMAPFB_CAPS_GENERIC_MASK	0x00000fff
+#define OMAPFB_CAPS_LCDC_MASK		0x00fff000
+#define OMAPFB_CAPS_PANEL_MASK		0xff000000
+
+#define OMAPFB_CAPS_MANUAL_UPDATE	0x00001000
+#define OMAPFB_CAPS_TEARSYNC		0x00002000
+#define OMAPFB_CAPS_PLANE_RELOCATE_MEM	0x00004000
+#define OMAPFB_CAPS_PLANE_SCALE		0x00008000
+#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE	0x00010000
+#define OMAPFB_CAPS_WINDOW_SCALE	0x00020000
+#define OMAPFB_CAPS_WINDOW_OVERLAY	0x00040000
+#define OMAPFB_CAPS_SET_BACKLIGHT	0x01000000
+
+/* Values from DSP must map to lower 16-bits */
+#define OMAPFB_FORMAT_MASK		0x00ff
+#define OMAPFB_FORMAT_FLAG_DOUBLE	0x0100
+#define OMAPFB_FORMAT_FLAG_TEARSYNC	0x0200
+#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC	0x0400
+#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY	0x0800
+#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY	0x1000
+
+#define OMAPFB_EVENT_READY	1
+#define OMAPFB_EVENT_DISABLED	2
+
+#define OMAPFB_MEMTYPE_SDRAM		0
+#define OMAPFB_MEMTYPE_SRAM		1
+#define OMAPFB_MEMTYPE_MAX		1
+
+enum omapfb_color_format {
+	OMAPFB_COLOR_RGB565 = 0,
+	OMAPFB_COLOR_YUV422,
+	OMAPFB_COLOR_YUV420,
+	OMAPFB_COLOR_CLUT_8BPP,
+	OMAPFB_COLOR_CLUT_4BPP,
+	OMAPFB_COLOR_CLUT_2BPP,
+	OMAPFB_COLOR_CLUT_1BPP,
+	OMAPFB_COLOR_RGB444,
+	OMAPFB_COLOR_YUY422,
+};
+
+struct omapfb_update_window {
+	u32 x, y;
+	u32 width, height;
+	u32 format;
+	u32 out_x, out_y;
+	u32 out_width, out_height;
+	u32 reserved[8];
+};
+
+struct omapfb_update_window_old {
+	u32 x, y;
+	u32 width, height;
+	u32 format;
+};
+
+enum omapfb_plane {
+	OMAPFB_PLANE_GFX = 0,
+	OMAPFB_PLANE_VID1,
+	OMAPFB_PLANE_VID2,
+};
+
+enum omapfb_channel_out {
+	OMAPFB_CHANNEL_OUT_LCD = 0,
+	OMAPFB_CHANNEL_OUT_DIGIT,
+};
+
+struct omapfb_plane_info {
+	u32 pos_x;
+	u32 pos_y;
+	u8  enabled;
+	u8  channel_out;
+	u8  mirror;
+	u8  reserved1;
+	u32 out_width;
+	u32 out_height;
+	u32 reserved2[12];
+};
+
+struct omapfb_mem_info {
+	u32 size;
+	u8  type;
+	u8  reserved[3];
+};
+
+struct omapfb_caps {
+	u32 ctrl;
+	u32 plane_color;
+	u32 wnd_color;
+};
+
+enum omapfb_color_key_type {
+	OMAPFB_COLOR_KEY_DISABLED = 0,
+	OMAPFB_COLOR_KEY_GFX_DST,
+	OMAPFB_COLOR_KEY_VID_SRC,
+};
+
+struct omapfb_color_key {
+	u8  channel_out;
+	u32 background;
+	u32 trans_key;
+	u8  key_type;
+};
+
+enum omapfb_update_mode {
+	OMAPFB_UPDATE_DISABLED = 0,
+	OMAPFB_AUTO_UPDATE,
+	OMAPFB_MANUAL_UPDATE
+};
+
+#endif /* __OMAPFB_H */
diff --git a/Source/DirectFB/gfxdrivers/radeon/Makefile.am b/Source/DirectFB/gfxdrivers/radeon/Makefile.am
new file mode 100755
index 0000000..322ae30
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/Makefile.am
@@ -0,0 +1,52 @@
+## Makefile.am for DirectFB/src/core/gfxcards/radeon
+
+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
+
+radeon_LTLIBRARIES = libdirectfb_radeon.la
+
+if BUILD_STATIC
+radeon_DATA = $(radeon_LTLIBRARIES:.la=.o)
+endif
+
+radeondir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_radeon_la_SOURCES =	\
+	radeon.c			\
+	r100_state.c		\
+	r200_state.c		\
+	r300_state.c		\
+	radeon_2d.c		\
+	r100_3d.c			\
+	r200_3d.c			\
+	r300_3d.c			\
+	radeon_overlay.c	\
+	radeon_crtc1.c		\
+	radeon_crtc2.c		\
+	radeon.h			\
+	radeon_chipsets.h	\
+	radeon_regs.h		\
+	r300_program.h		\
+	radeon_mmio.h		\
+	radeon_state.h		\
+	radeon_2d.h		\
+	radeon_3d.h		\
+	vertex_shader.h
+
+libdirectfb_radeon_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS) -lm
+
+libdirectfb_radeon_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/radeon/Makefile.in b/Source/DirectFB/gfxdrivers/radeon/Makefile.in
new file mode 100755
index 0000000..50e9cb1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/Makefile.in
@@ -0,0 +1,625 @@
+# 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/radeon
+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)$(radeondir)" "$(DESTDIR)$(radeondir)"
+radeonLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(radeon_LTLIBRARIES)
+libdirectfb_radeon_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_radeon_la_OBJECTS = radeon.lo r100_state.lo \
+	r200_state.lo r300_state.lo radeon_2d.lo r100_3d.lo r200_3d.lo \
+	r300_3d.lo radeon_overlay.lo radeon_crtc1.lo radeon_crtc2.lo
+libdirectfb_radeon_la_OBJECTS = $(am_libdirectfb_radeon_la_OBJECTS)
+libdirectfb_radeon_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_radeon_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_radeon_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_radeon_la_SOURCES)
+radeonDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(radeon_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
+
+radeon_LTLIBRARIES = libdirectfb_radeon.la
+@BUILD_STATIC_TRUE@radeon_DATA = $(radeon_LTLIBRARIES:.la=.o)
+radeondir = $(MODULEDIR)/gfxdrivers
+libdirectfb_radeon_la_SOURCES = \
+	radeon.c			\
+	r100_state.c		\
+	r200_state.c		\
+	r300_state.c		\
+	radeon_2d.c		\
+	r100_3d.c			\
+	r200_3d.c			\
+	r300_3d.c			\
+	radeon_overlay.c	\
+	radeon_crtc1.c		\
+	radeon_crtc2.c		\
+	radeon.h			\
+	radeon_chipsets.h	\
+	radeon_regs.h		\
+	r300_program.h		\
+	radeon_mmio.h		\
+	radeon_state.h		\
+	radeon_2d.h		\
+	radeon_3d.h		\
+	vertex_shader.h
+
+libdirectfb_radeon_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS) -lm
+
+libdirectfb_radeon_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/radeon/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/radeon/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-radeonLTLIBRARIES: $(radeon_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(radeondir)" || $(MKDIR_P) "$(DESTDIR)$(radeondir)"
+	@list='$(radeon_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(radeonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(radeondir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(radeonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(radeondir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-radeonLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(radeon_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(radeondir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(radeondir)/$$p"; \
+	done
+
+clean-radeonLTLIBRARIES:
+	-test -z "$(radeon_LTLIBRARIES)" || rm -f $(radeon_LTLIBRARIES)
+	@list='$(radeon_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_radeon.la: $(libdirectfb_radeon_la_OBJECTS) $(libdirectfb_radeon_la_DEPENDENCIES) 
+	$(libdirectfb_radeon_la_LINK) -rpath $(radeondir) $(libdirectfb_radeon_la_OBJECTS) $(libdirectfb_radeon_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r100_3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r100_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r200_3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r200_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r300_3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r300_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon_2d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon_crtc1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon_crtc2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon_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-radeonDATA: $(radeon_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(radeondir)" || $(MKDIR_P) "$(DESTDIR)$(radeondir)"
+	@list='$(radeon_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(radeonDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(radeondir)/$$f'"; \
+	  $(radeonDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(radeondir)/$$f"; \
+	done
+
+uninstall-radeonDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(radeon_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(radeondir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(radeondir)/$$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)$(radeondir)" "$(DESTDIR)$(radeondir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-radeonLTLIBRARIES \
+	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-radeonDATA install-radeonLTLIBRARIES
+
+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-radeonDATA uninstall-radeonLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-radeonLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-radeonDATA install-radeonLTLIBRARIES 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-radeonDATA \
+	uninstall-radeonLTLIBRARIES
+
+%.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/radeon/r100_3d.c b/Source/DirectFB/gfxdrivers/radeon/r100_3d.c
new file mode 100755
index 0000000..c647b55
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r100_3d.c
@@ -0,0 +1,523 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <dfb_types.h>
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_3d.h"
+
+
+#define EMIT_VERTICES( rdrv, rdev, mmio ) { \
+     u32 *_v = (rdev)->vb; \
+     u32  _s = (rdev)->vb_size; \
+     radeon_waitfifo( rdrv, rdev, 1 ); \
+     radeon_out32( mmio, SE_VF_CNTL, rdev->vb_type | VF_PRIM_WALK_DATA | VF_RADEON_MODE | \
+                                    (rdev->vb_count << VF_NUM_VERTICES_SHIFT) ); \
+     do { \
+          u32 _n = MIN(_s, 64); \
+          _s -= _n; \
+          radeon_waitfifo( rdrv, rdev, _n ); \
+          while (_n--) \
+               radeon_out32( mmio, SE_PORT_DATA0, *_v++ ); \
+     } while (_s); \
+}
+
+static void
+r100_flush_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+    
+     EMIT_VERTICES( rdrv, rdev, mmio );
+
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          DFBRegion *clip = &rdev->clip;
+          bool       s420 = DFB_PLANAR_PIXELFORMAT(rdev->src_format);
+          int        i;
+          
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               for (i = 0; i < rdev->vb_size; i += 4) {
+                    rdev->vb[i+0] = f2d(d2f(rdev->vb[i+0])*0.5f);
+                    rdev->vb[i+1] = f2d(d2f(rdev->vb[i+1])*0.5f);
+                    if (s420) {
+                         rdev->vb[i+2] = f2d(d2f(rdev->vb[i+2])*0.5f);
+                         rdev->vb[i+3] = f2d(d2f(rdev->vb[i+3])*0.5f);
+                    }
+               }
+          } else {
+               for (i = 0; i < rdev->vb_size; i += 2) {
+                    rdev->vb[i+0] = f2d(d2f(rdev->vb[i+0])*0.5f);
+                    rdev->vb[i+1] = f2d(d2f(rdev->vb[i+1])*0.5f);
+               }
+          }
+
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cb );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch/2 );
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1/2 << 16) |
+                                           (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2/2 << 16) |
+                                               (clip->x2/2 & 0xffff) );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, PP_TFACTOR_0, rdev->cb_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 3 );
+                    radeon_out32( mmio, PP_TEX_SIZE_0, ((rdev->src_height/2-1) << 16) |
+                                                       ((rdev->src_width/2-1) & 0xffff) );
+                    radeon_out32( mmio, PP_TEX_PITCH_0, rdev->src_pitch/2 - 32 );
+                    radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset_cb );
+               }
+          } else {
+               radeon_out32( mmio, PP_TFACTOR_1, rdev->cb_cop );
+          }
+
+          /* Fill Cb plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cr );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, PP_TFACTOR_0, rdev->cr_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 1 );
+                    radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset_cr );
+               }
+          } else {
+               radeon_out32( mmio, PP_TFACTOR_1, rdev->cr_cop );
+          }
+
+          /* Fill Cr plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch );
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1 << 16) |
+                                           (clip->x1 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2 << 16) |
+                                               (clip->x2 & 0xffff) );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, PP_TFACTOR_0, rdev->y_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 3 );
+                    radeon_out32( mmio, PP_TEX_SIZE_0, ((rdev->src_height-1) << 16) |
+                                                       ((rdev->src_width-1) & 0xffff) );
+                    radeon_out32( mmio, PP_TEX_PITCH_0, rdev->src_pitch - 32 );
+                    radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset );
+               }
+          } else {
+               radeon_out32( mmio, PP_TFACTOR_1, rdev->y_cop );
+          }
+     }
+    
+     rdev->vb_size  = 0;
+     rdev->vb_count = 0;
+}
+
+static inline u32*
+r100_init_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev, u32 type, u32 count, u32 size )
+{
+     u32 *vb;
+    
+     if ((rdev->vb_size && rdev->vb_type != type) ||
+          rdev->vb_size+size > D_ARRAY_SIZE(rdev->vb))
+          r100_flush_vb( rdrv, rdev );
+        
+     vb = &rdev->vb[rdev->vb_size];
+     rdev->vb_type   = type;
+     rdev->vb_size  += size;
+     rdev->vb_count += count;
+    
+     return vb;
+}
+
+
+bool r100FillRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+    
+     if (rect->w == 1 && rect->h == 1) {
+          x1 = rect->x+1; y1 = rect->y+1;
+          if (rdev->matrix)
+               RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_POINT_LIST, 1, 2 );
+          *v++ = f2d(x1); *v++ = f2d(y1);
+
+          return true;
+     }
+
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float X1, Y1, X2, Y2, X3, Y3, X4, Y4;
+
+          RADEON_TRANSFORM( x1, y1, X1, Y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y1, X2, Y2, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, X3, Y3, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x1, y2, X4, Y4, rdev->matrix, rdev->affine_matrix );
+          
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_TRIANGLE_LIST, 6, 12 );
+          *v++ = f2d(X1); *v++ = f2d(Y1);
+          *v++ = f2d(X2); *v++ = f2d(Y2);
+          *v++ = f2d(X3); *v++ = f2d(Y3);
+          *v++ = f2d(X1); *v++ = f2d(Y1);
+          *v++ = f2d(X3); *v++ = f2d(Y3);
+          *v++ = f2d(X4); *v++ = f2d(Y4);
+     }
+     else {
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 3, 6 );
+          *v++ = f2d(x1); *v++ = f2d(y1);
+          *v++ = f2d(x2); *v++ = f2d(y1);
+          *v++ = f2d(x2); *v++ = f2d(y2);
+     }
+     
+     return true;
+}
+
+bool r100FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             x3, y3;
+     u32              *v;
+
+     x1 = tri->x1; y1 = tri->y1;
+     x2 = tri->x2; y2 = tri->y2;
+     x3 = tri->x3; y3 = tri->y3;
+     if (rdev->matrix) {
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x3, y3, x3, y3, rdev->matrix, rdev->affine_matrix );
+     }
+
+     v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_TRIANGLE_LIST, 3, 6 );
+     *v++ = f2d(x1); *v++ = f2d(y1);
+     *v++ = f2d(x2); *v++ = f2d(y2);
+     *v++ = f2d(x3); *v++ = f2d(y3);
+     
+     return true;
+}
+
+bool r100DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+     
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          /* XXX: better LINE_STRIP?! */
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LIST, 8, 16 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+     }
+     else {
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 12, 24 );
+          /* top line */
+          *v++ = f2d(x1);   *v++ = f2d(y1);
+          *v++ = f2d(x2);   *v++ = f2d(y1);
+          *v++ = f2d(x2);   *v++ = f2d(y1+1);
+          /* right line */
+          *v++ = f2d(x2-1); *v++ = f2d(y1+1);
+          *v++ = f2d(x2);   *v++ = f2d(y1+1);
+          *v++ = f2d(x2);   *v++ = f2d(y2-1);
+          /* bottom line */
+          *v++ = f2d(x1);   *v++ = f2d(y2-1);
+          *v++ = f2d(x2);   *v++ = f2d(y2-1);
+          *v++ = f2d(x2);   *v++ = f2d(y2);
+          /* left line */
+          *v++ = f2d(x1);   *v++ = f2d(y1+1);
+          *v++ = f2d(x1+1); *v++ = f2d(y1+1);
+          *v++ = f2d(x1+1); *v++ = f2d(y2-1);
+     }
+     
+     return true;
+}
+
+bool r100DrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+
+     x1 = line->x1; y1 = line->y1;
+     x2 = line->x2; y2 = line->y2;
+     if (rdev->matrix) { 
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+     }
+
+     v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LIST, 2, 4 );
+     *v++ = f2d(x1); *v++ = f2d(y1);
+     *v++ = f2d(x2); *v++ = f2d(y2);
+
+     return true;
+}
+
+bool r100Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy )
+{
+     DFBRectangle dr = { dx, dy, sr->w, sr->h };
+     
+     return r100StretchBlit( drv, dev, sr, &dr );
+}
+
+bool r100StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             s1, t1;
+     float             s2, t2;
+     u32              *v;
+    
+     if (rdev->blittingflags & DSBLIT_DEINTERLACE) {
+          sr->y /= 2;
+          sr->h /= 2;
+     }
+     
+     s1 = sr->x;       t1 = sr->y;
+     s2 = sr->x+sr->w; t2 = sr->y+sr->h;
+     if (rdev->blittingflags & DSBLIT_ROTATE180) {
+          float tmp;
+          tmp = s2; s2 = s1; s1 = tmp;
+          tmp = t2; t2 = t1; t1 = tmp;
+     }
+     
+     x1 = dr->x;       y1 = dr->y;
+     x2 = dr->x+dr->w; y2 = dr->y+dr->h;
+     if (rdev->matrix) {
+          float X1, Y1, X2, Y2, X3, Y3, X4, Y4;
+
+          RADEON_TRANSFORM( x1, y1, X1, Y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y1, X2, Y2, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, X3, Y3, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x1, y2, X4, Y4, rdev->matrix, rdev->affine_matrix );
+          
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_TRIANGLE_LIST, 6, 24 );
+          *v++ = f2d(X1); *v++ = f2d(Y1); *v++ = f2d(s1); *v++ = f2d(t1);
+          *v++ = f2d(X2); *v++ = f2d(Y2); *v++ = f2d(s2); *v++ = f2d(t1);
+          *v++ = f2d(X3); *v++ = f2d(Y3); *v++ = f2d(s2); *v++ = f2d(t2);
+          *v++ = f2d(X1); *v++ = f2d(Y1); *v++ = f2d(s1); *v++ = f2d(t1);
+          *v++ = f2d(X3); *v++ = f2d(Y3); *v++ = f2d(s2); *v++ = f2d(t2);
+          *v++ = f2d(X4); *v++ = f2d(Y4); *v++ = f2d(s1); *v++ = f2d(t2);
+     }
+     else {
+          v = r100_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 3, 12 );
+          *v++ = f2d(x1); *v++ = f2d(y1); *v++ = f2d(s1); *v++ = f2d(t1);
+          *v++ = f2d(x2); *v++ = f2d(y1); *v++ = f2d(s2); *v++ = f2d(t1);
+          *v++ = f2d(x2); *v++ = f2d(y2); *v++ = f2d(s2); *v++ = f2d(t2);
+     }
+     
+     return true;
+}
+
+static void
+r100DoTextureTriangles( RadeonDriverData *rdrv, RadeonDeviceData *rdev,
+                        DFBVertex *ve, int num, u32 primitive )
+{
+     volatile u8   *mmio = rdrv->mmio_base;
+     int            i;
+ 
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     
+     radeon_out32( mmio, SE_VF_CNTL, primitive         | 
+                                     VF_PRIM_WALK_DATA |
+                                     VF_RADEON_MODE    |
+                                     (num << VF_NUM_VERTICES_SHIFT) );
+
+     for (; num >= 10; num -= 10) {
+          radeon_waitfifo( rdrv, rdev, 60 );
+          for (i = 0; i < 10; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].w) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+          }
+          ve += 10;
+     }
+
+     if (num > 0) {
+          radeon_waitfifo( rdrv, rdev, num*6 );
+          for (i = 0; i < num; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].w) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+          }
+     }
+}
+
+bool r100TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation )
+{ 
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     u32               prim = 0;
+     int               i;
+
+     if (num > 65535) {
+          D_WARN( "R100 supports maximum 65535 vertices" );
+          return false;
+     }
+
+     switch (formation) {
+          case DTTF_LIST:
+               prim = VF_PRIM_TYPE_TRIANGLE_LIST;
+               break;
+          case DTTF_STRIP:
+               prim = VF_PRIM_TYPE_TRIANGLE_STRIP;
+               break;
+          case DTTF_FAN:
+               prim = VF_PRIM_TYPE_TRIANGLE_FAN;
+               break;
+          default:
+               D_BUG( "unexpected triangle formation" );
+               return false;
+     }
+     
+     if (rdev->matrix) {
+          for (i = 0; i < num; i++)
+               RADEON_TRANSFORM( ve[i].x, ve[i].y, ve[i].x, ve[i].y, rdev->matrix, rdev->affine_matrix );
+     }
+     
+     r100DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          DFBRegion   *clip = &rdev->clip;
+          volatile u8 *mmio = rdrv->mmio_base;
+          bool         s420 = DFB_PLANAR_PIXELFORMAT(rdev->src_format);
+          int          i;
+          
+          /* Scale coordinates */
+          for (i = 0; i < num; i++) {
+               ve[i].x *= 0.5;
+               ve[i].y *= 0.5;
+          }
+
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, s420 ? 8 : 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cb );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch/2 );
+          if (s420) {
+               radeon_out32( mmio, PP_TEX_SIZE_0, ((rdev->src_height/2-1) << 16) |
+                                                  ((rdev->src_width/2-1) & 0xffff) );
+               radeon_out32( mmio, PP_TEX_PITCH_0, rdev->src_pitch/2 - 32 );
+               radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset_cb );
+          }
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1/2 << 16) |
+                                           (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2/2 << 16) | 
+                                          (clip->x2/2 & 0xffff) );
+          radeon_out32( mmio, PP_TFACTOR_0, rdev->cb_cop );
+     
+          /* Map Cb plane */
+          r100DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, s420 ? 3 : 2 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cr );
+          if (s420)
+               radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset_cr );
+          radeon_out32( mmio, PP_TFACTOR_0, rdev->cr_cop );
+
+          /* Map Cr plane */
+          r100DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, s420 ? 8 : 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch );
+          if (s420) {
+               radeon_out32( mmio, PP_TEX_SIZE_0, ((rdev->src_height-1) << 16) |
+                                                  ((rdev->src_width-1) & 0xffff) );
+               radeon_out32( mmio, PP_TEX_PITCH_0, rdev->src_pitch - 32 );
+               radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset );
+          }
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1 << 16) |
+                                           (clip->x1 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2 << 16) |
+                                               (clip->x2 & 0xffff) );
+          radeon_out32( mmio, PP_TFACTOR_0, rdev->y_cop );
+     }
+
+     return true;
+}
+
+void r100EmitCommands3D( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     
+     if (rdev->vb_count)
+          r100_flush_vb( rdrv, rdev );
+}
diff --git a/Source/DirectFB/gfxdrivers/radeon/r100_state.c b/Source/DirectFB/gfxdrivers/radeon/r100_state.c
new file mode 100755
index 0000000..8985733
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r100_state.c
@@ -0,0 +1,954 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_state.h"
+
+
+static const u32 r100SrcBlend[] = {
+     SRC_BLEND_GL_ZERO,                 // DSBF_ZERO
+     SRC_BLEND_GL_ONE,                  // DSBF_ONE
+     SRC_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     SRC_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     SRC_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     SRC_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     SRC_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     SRC_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     SRC_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     SRC_BLEND_GL_SRC_ALPHA_SATURATE    // DSBF_SRCALPHASAT
+};
+
+static const u32 r100DstBlend[] = {
+     DST_BLEND_GL_ZERO,                 // DSBF_ZERO
+     DST_BLEND_GL_ONE,                  // DSBF_ONE
+     DST_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     DST_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     DST_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     DST_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     DST_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     DST_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     DST_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     DST_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     DST_BLEND_GL_ZERO                  // DSBF_SRCALPHASAT
+};
+
+
+void r100_restore( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     radeon_waitfifo( rdrv, rdev, 8 );
+     /* enable caches */
+     radeon_out32( mmio, RB2D_DSTCACHE_MODE, RB2D_DC_2D_CACHE_AUTOFLUSH |
+                                             RB2D_DC_3D_CACHE_AUTOFLUSH );
+     radeon_out32( mmio, RB3D_DSTCACHE_MODE, RB3D_DC_2D_CACHE_AUTOFLUSH |
+                                             RB3D_DC_3D_CACHE_AUTOFLUSH );            
+     /* restore 3d engine state */ 
+     radeon_out32( mmio, SE_COORD_FMT, VTX_XY_PRE_MULT_1_OVER_W0 |
+                                       TEX1_W_ROUTING_USE_W0 );
+     radeon_out32( mmio, SE_LINE_WIDTH, 0x10 );
+#ifdef WORDS_BIGENDIAN
+     radeon_out32( mmio, SE_CNTL_STATUS, TCL_BYPASS | VC_32BIT_SWAP );
+#else
+     radeon_out32( mmio, SE_CNTL_STATUS, TCL_BYPASS );
+#endif
+     radeon_out32( mmio, PP_MISC, ALPHA_TEST_PASS );
+     radeon_out32( mmio, RB3D_ZSTENCILCNTL, Z_TEST_ALWAYS );
+     radeon_out32( mmio, RB3D_ROPCNTL, ROP_XOR );
+}
+
+void r100_set_destination( RadeonDriverData *rdrv,
+                           RadeonDeviceData *rdev,
+                           CardState        *state )
+{
+     CoreSurface       *surface = state->destination;
+     CoreSurfaceBuffer *buffer  = state->dst.buffer;
+     volatile u8       *mmio    = rdrv->mmio_base;
+     u32                offset;
+     u32                pitch;
+    
+     if (RADEON_IS_SET( DESTINATION ))
+          return;
+
+     D_ASSERT( (state->dst.offset % 32) == 0 );
+     D_ASSERT( (state->dst.pitch % 32) == 0 );
+
+     offset = radeon_buffer_offset( rdev, &state->dst );
+     pitch  = state->dst.pitch;
+    
+     if (rdev->dst_offset != offset        ||
+         rdev->dst_pitch  != pitch         ||
+         rdev->dst_format != buffer->format)
+     {
+          bool dst_422 = false;
+          
+          switch (buffer->format) {
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_A8:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    break;
+               case DSPF_RGB332:          
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB332 | DITHER_ENABLE;
+                    break;
+               case DSPF_ARGB2554:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB565;
+                    break;
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB4444 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:          
+                    rdev->gui_master_cntl = GMC_DST_15BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB1555 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB16:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB565 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_AiRGB:
+               case DSPF_AYUV:
+                    rdev->gui_master_cntl = GMC_DST_32BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB8888;
+                    break;
+               case DSPF_UYVY:
+                    rdev->gui_master_cntl = GMC_DST_YVYU;
+                    rdev->rb3d_cntl = COLOR_FORMAT_YUV422_YVYU;
+                    dst_422 = true;
+                    break;
+               case DSPF_YUY2:
+                    rdev->gui_master_cntl = GMC_DST_VYUY;
+                    rdev->rb3d_cntl = COLOR_FORMAT_YUV422_VYUY;
+                    dst_422 = true;
+                    break;
+               case DSPF_I420:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    rdev->dst_offset_cb = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cr = rdev->dst_offset_cb + 
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               case DSPF_YV12:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    rdev->dst_offset_cr = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cb = rdev->dst_offset_cr +
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    return;
+          }
+
+          rdev->gui_master_cntl |= GMC_DP_SRC_SOURCE_MEMORY  |
+                                   GMC_WR_MSK_DIS            |
+                                   GMC_SRC_PITCH_OFFSET_CNTL |
+                                   GMC_DST_PITCH_OFFSET_CNTL |
+                                   GMC_DST_CLIPPING;
+          
+          radeon_waitfifo( rdrv, rdev, 4 );
+          radeon_out32( mmio, DST_OFFSET, offset );
+          radeon_out32( mmio, DST_PITCH, pitch );
+          radeon_out32( mmio, RB3D_COLOROFFSET, offset );
+          radeon_out32( mmio, RB3D_COLORPITCH,  
+                              pitch / DFB_BYTES_PER_PIXEL(buffer->format) );
+          
+          if (rdev->dst_format != buffer->format) {
+               if (dst_422 && !rdev->dst_422) {
+                    RADEON_UNSET( SOURCE );
+                    RADEON_UNSET( CLIP );
+               }
+               
+               RADEON_UNSET( COLOR );
+               RADEON_UNSET( DST_BLEND );
+          }
+          
+          rdev->dst_format = buffer->format;
+          rdev->dst_offset = offset;
+          rdev->dst_pitch  = pitch;
+          rdev->dst_422    = dst_422;
+     }
+
+     RADEON_SET( DESTINATION );
+}
+
+void r100_set_source( RadeonDriverData *rdrv,
+                      RadeonDeviceData *rdev,
+                      CardState        *state )
+{
+     CoreSurface       *surface  = state->source;
+     CoreSurfaceBuffer *buffer   = state->src.buffer;
+     volatile u8       *mmio     = rdrv->mmio_base;
+     u32                txformat = TXFORMAT_NON_POWER2;
+     u32                txfilter = MAG_FILTER_LINEAR  |
+                                   MIN_FILTER_LINEAR  |
+                                   CLAMP_S_CLAMP_LAST |
+                                   CLAMP_T_CLAMP_LAST;
+
+     if (RADEON_IS_SET( SOURCE )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (rdev->blittingflags  & DSBLIT_DEINTERLACE))
+               return;
+     }
+
+     D_ASSERT( (state->src.offset % 32) == 0 );
+     D_ASSERT( (state->src.pitch % 32) == 0 );
+     
+     rdev->src_offset = radeon_buffer_offset( rdev, &state->src );
+     rdev->src_pitch  = state->src.pitch;
+     rdev->src_width  = surface->config.size.w;
+     rdev->src_height = surface->config.size.h;
+     
+     switch (buffer->format) {
+          case DSPF_LUT8:
+               txformat |= TXFORMAT_I8;
+               txfilter &= ~(MAG_FILTER_LINEAR |
+                             MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ALUT44:
+               txformat |= TXFORMAT_I8;
+               txfilter &= ~(MAG_FILTER_LINEAR |
+                             MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x0000000f;
+               break;
+          case DSPF_A8:
+               txformat |= TXFORMAT_I8 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0;
+               break;
+          case DSPF_RGB332:
+               txformat |= TXFORMAT_RGB332;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ARGB2554:
+               txformat |= TXFORMAT_RGB565;
+               txfilter &= ~(MAG_FILTER_LINEAR |
+                             MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x00003fff;
+               break;
+          case DSPF_RGB444:
+               txformat |= TXFORMAT_ARGB4444;
+               rdev->src_mask = 0x00000fff;
+               break;
+          case DSPF_ARGB4444:
+               txformat |= TXFORMAT_ARGB4444 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00000fff;
+               break;
+          case DSPF_RGB555:
+               txformat |= TXFORMAT_ARGB1555;
+               rdev->src_mask = 0x00007fff;
+               break;
+          case DSPF_ARGB1555:
+               txformat |= TXFORMAT_ARGB1555 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00007fff;
+               break;
+          case DSPF_RGB16:
+               txformat |= TXFORMAT_RGB565;
+               rdev->src_mask = 0x0000ffff;
+               break;
+          case DSPF_RGB32:
+               txformat |= TXFORMAT_ARGB8888;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_AYUV:
+               txformat |= TXFORMAT_ARGB8888 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_UYVY:
+               txformat |= TXFORMAT_YVYU422;
+               if (!rdev->dst_422)
+                    txfilter |= YUV_TO_RGB;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_YUY2:
+               txformat |= TXFORMAT_VYUY422;
+               if (!rdev->dst_422)
+                    txfilter |= YUV_TO_RGB;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_I420:
+               txformat |= TXFORMAT_I8;
+               rdev->src_offset_cb = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cr = rdev->src_offset_cb +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_YV12:
+               txformat |= TXFORMAT_I8;
+               rdev->src_offset_cr = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cb = rdev->src_offset_cr +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) { 
+          rdev->src_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_height * rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_height * rdev->src_pitch/4;
+                    rdev->src_offset_cb += rdev->src_height * rdev->src_pitch/4;
+               }
+          } else {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_pitch/2;
+                    rdev->src_offset_cb += rdev->src_pitch/2;
+               }
+               rdev->src_pitch *= 2;
+          }
+     }
+ 
+     radeon_waitfifo( rdrv, rdev, 7 );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset );
+     radeon_out32( mmio, SRC_PITCH, rdev->src_pitch );
+     radeon_out32( mmio, PP_TXFILTER_0, txfilter );
+     radeon_out32( mmio, PP_TXFORMAT_0, txformat );
+     radeon_out32( mmio, PP_TEX_SIZE_0, ((rdev->src_height-1) << 16) |
+                                        ((rdev->src_width-1) & 0xffff) );
+     radeon_out32( mmio, PP_TEX_PITCH_0, rdev->src_pitch - 32 );
+     radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset );
+     
+     if (rdev->src_format != buffer->format)
+          RADEON_UNSET( BLITTING_FLAGS );
+     rdev->src_format = buffer->format;
+
+     RADEON_SET( SOURCE );
+}
+
+void r100_set_source_mask( RadeonDriverData *rdrv,
+                           RadeonDeviceData *rdev,
+                           CardState        *state )
+{
+     CoreSurface       *surface  = state->source_mask;
+     CoreSurfaceBuffer *buffer   = state->src_mask.buffer;
+     volatile u8       *mmio     = rdrv->mmio_base;
+     u32                txformat = TXFORMAT_NON_POWER2;
+     u32                txfilter = MAG_FILTER_LINEAR  |
+                                   MIN_FILTER_LINEAR  |
+                                   CLAMP_S_CLAMP_LAST |
+                                   CLAMP_T_CLAMP_LAST;
+
+     if (RADEON_IS_SET( SOURCE_MASK )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (rdev->blittingflags  & DSBLIT_DEINTERLACE))
+               return;
+     }
+
+     D_ASSERT( (state->src_mask.offset % 32) == 0 );
+     D_ASSERT( (state->src_mask.pitch % 32) == 0 );
+     
+     rdev->msk_format = buffer->format;
+     rdev->msk_offset = radeon_buffer_offset( rdev, &state->src_mask );
+     rdev->msk_pitch  = state->src_mask.pitch;
+     rdev->msk_width  = surface->config.size.w;
+     rdev->msk_height = surface->config.size.h;
+     
+     switch (buffer->format) {
+          case DSPF_A8:
+               txformat |= TXFORMAT_I8 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB332:
+               txformat |= TXFORMAT_RGB332;
+               break;
+          case DSPF_RGB444:
+               txformat |= TXFORMAT_ARGB4444;
+               break;
+          case DSPF_ARGB4444:
+               txformat |= TXFORMAT_ARGB4444 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB555:
+               txformat |= TXFORMAT_ARGB1555;
+               break;
+          case DSPF_ARGB1555:
+               txformat |= TXFORMAT_ARGB1555 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB16:
+               txformat |= TXFORMAT_RGB565;
+               break;
+          case DSPF_RGB32:
+               txformat |= TXFORMAT_ARGB8888;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+               txformat |= TXFORMAT_ARGB8888 |
+                           TXFORMAT_ALPHA_IN_MAP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) { 
+          rdev->msk_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field)
+                    rdev->msk_offset += rdev->msk_height * rdev->msk_pitch;
+          } else {
+               if (surface->field)
+                    rdev->msk_offset += rdev->msk_pitch;
+               rdev->msk_pitch *= 2;
+          }
+     }
+ 
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, PP_TXFILTER_1, txfilter );
+     radeon_out32( mmio, PP_TXFORMAT_1, txformat );
+     radeon_out32( mmio, PP_TEX_SIZE_1, ((rdev->msk_height-1) << 16) |
+                                        ((rdev->msk_width-1) & 0xffff) );
+     radeon_out32( mmio, PP_TEX_PITCH_1, rdev->msk_pitch - 32 );
+     radeon_out32( mmio, PP_TXOFFSET_1, rdev->msk_offset );
+
+     RADEON_SET( SOURCE_MASK );
+}
+
+void r100_set_clip( RadeonDriverData *rdrv,
+                    RadeonDeviceData *rdev,
+                    CardState        *state )
+{
+     DFBRegion     *clip = &state->clip;
+     volatile u8   *mmio = rdrv->mmio_base;
+     
+     if (RADEON_IS_SET( CLIP ))
+          return;
+  
+     /* 2d clip */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     if (rdev->dst_422) {
+          radeon_out32( mmio, SC_TOP_LEFT,
+                      (clip->y1 << 16) | (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1)/2 & 0xffff) );
+     } else {     
+          radeon_out32( mmio, SC_TOP_LEFT, 
+                      (clip->y1 << 16) | (clip->x1 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1) & 0xffff) );
+     }
+      
+     /* 3d clip */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, RE_TOP_LEFT, 
+                 (clip->y1 << 16) | (clip->x1 & 0xffff) );
+     radeon_out32( mmio, RE_BOTTOM_RIGHT,
+                 (clip->y2 << 16) | (clip->x2 & 0xffff) );
+     
+     rdev->clip = state->clip;
+     
+     RADEON_SET( CLIP );
+}
+
+#define R100_SET_YUV422_COLOR( rdrv, rdev, y, u, v ) {                   \
+     radeon_out32( (rdrv)->fb_base, (rdev)->yuv422_buffer,               \
+                   PIXEL_YUY2( y, u, v ) );                              \
+     radeon_in8( (rdrv)->fb_base, (rdev)->yuv422_buffer );               \
+     radeon_waitfifo( rdrv, rdev, 3 );                                   \
+     radeon_out32( (rdrv)->mmio_base, PP_TXFILTER_1, 0 );                \
+     radeon_out32( (rdrv)->mmio_base, PP_TXFORMAT_1, TXFORMAT_VYUY422 ); \
+     radeon_out32( (rdrv)->mmio_base, PP_TXOFFSET_1,                     \
+                   (rdev)->fb_offset + (rdev)->yuv422_buffer );          \
+}
+
+void r100_set_drawing_color( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState        *state )
+{
+     DFBColor color   = state->color;
+     int      index   = state->color_index;
+     u32      color2d;
+     u32      color3d;
+     int      y, u, v;
+
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = color.r * color.a / 255;
+          color.g = color.g * color.a / 255;
+          color.b = color.b * color.a / 255;
+     }
+
+     color3d = PIXEL_ARGB( color.a, color.r,
+                           color.g, color.b );
+ 
+     switch (rdev->dst_format) {
+          case DSPF_ALUT44:
+               index |= (color.a & 0xf0);
+          case DSPF_LUT8:
+               color2d = index;
+               color3d = PIXEL_RGB32( index, index, index );
+               break;
+          case DSPF_A8:
+               color2d = color.a;
+               color3d = (color.a << 24) | 0x00ffffff;
+               break;
+          case DSPF_RGB332:
+               color2d = PIXEL_RGB332( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB2554:
+               color2d = PIXEL_ARGB2554( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               color2d = PIXEL_ARGB4444( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               color2d = PIXEL_ARGB1555( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB16:
+               color2d = PIXEL_RGB16( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB32:
+               color2d = PIXEL_RGB32( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB:
+               color2d = PIXEL_ARGB( color.a, color.r,
+                                     color.g, color.b );
+               break;
+          case DSPF_AiRGB:
+               color2d = PIXEL_AiRGB( color.a, color.r,
+                                      color.g, color.b );
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color3d = color2d = PIXEL_AYUV( color.a, y, u, v );
+               break;
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_UYVY( y, u, v );
+               R100_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_YUY2( y, u, v );
+               R100_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               color3d = color2d = rdev->y_cop;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               color2d = 0;
+               break;
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( rdrv->mmio_base, DP_BRUSH_FRGD_CLR, color2d );
+     radeon_out32( rdrv->mmio_base, PP_TFACTOR_1, color3d );
+
+     RADEON_SET( COLOR );
+}
+
+void r100_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     DFBColor color   = state->color;
+     u32      color3d;
+     int      y, u, v;
+     
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+
+     if (state->blittingflags & DSBLIT_COLORIZE &&
+         state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+          color.r = ((long) color.r * color.a / 255L);
+          color.g = ((long) color.g * color.a / 255L);
+          color.b = ((long) color.b * color.a / 255L);
+     }
+
+     switch (rdev->dst_format) {
+          case DSPF_A8:
+               color3d = (color.a << 24) | 0x00ffffff;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12: 
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               color3d = rdev->y_cop;
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color3d = PIXEL_AYUV( color.a, y, u, v );
+               break;
+          case DSPF_UYVY:
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               R100_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+          default:
+               color3d = PIXEL_ARGB( color.a, color.r,
+                                     color.g, color.b );
+               break;
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( rdrv->mmio_base, PP_TFACTOR_0, color3d );
+     
+     RADEON_SET( COLOR );
+}
+
+void r100_set_src_colorkey( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     if (RADEON_IS_SET( SRC_COLORKEY ))
+          return;
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, CLR_CMP_CLR_SRC, state->src_colorkey ); 
+     radeon_out32( mmio, CLR_CMP_MASK, rdev->src_mask );    
+     
+     RADEON_SET( SRC_COLORKEY );
+}
+
+void r100_set_blend_function( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     u32          sblend;
+     u32          dblend;
+     
+     if (RADEON_IS_SET( SRC_BLEND ) && RADEON_IS_SET( DST_BLEND ))
+          return;
+
+     sblend = r100SrcBlend[state->src_blend-1];
+     dblend = r100DstBlend[state->dst_blend-1];
+             
+     if (!DFB_PIXELFORMAT_HAS_ALPHA(rdev->dst_format)) {
+          if (sblend == SRC_BLEND_GL_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ONE;
+          else if (sblend == SRC_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ZERO;
+                    
+          if (dblend == DST_BLEND_GL_DST_ALPHA)
+               dblend = DST_BLEND_GL_ONE;
+          else if (dblend == DST_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               dblend = DST_BLEND_GL_ZERO;
+     }
+     else if (rdev->dst_format == DSPF_A8) {
+          if (sblend == SRC_BLEND_GL_DST_ALPHA)
+               sblend = SRC_BLEND_GL_DST_COLOR;
+          else if (sblend == SRC_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ONE_MINUS_DST_COLOR;
+
+          if (dblend == DST_BLEND_GL_DST_ALPHA)
+               dblend = DST_BLEND_GL_DST_COLOR;
+          else if (dblend == DST_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               dblend = DST_BLEND_GL_ONE_MINUS_DST_COLOR;
+     }
+
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     radeon_out32( mmio, RB3D_BLENDCNTL, sblend | dblend );
+     
+     RADEON_SET( SRC_BLEND );
+     RADEON_SET( DST_BLEND );
+}
+
+void r100_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     if (RADEON_IS_SET( RENDER_OPTIONS ))
+          return;
+          
+     if (state->render_options & DSRO_MATRIX &&
+        (!state->affine_matrix ||
+          state->matrix[0] != (1<<16) || state->matrix[1] != 0 || state->matrix[2] != 0 ||
+          state->matrix[3] != 0 || state->matrix[4] != (1<<16) || state->matrix[5] != 0)) {
+          rdev->matrix = state->matrix;
+          rdev->affine_matrix = state->affine_matrix;
+     }
+     else {
+          rdev->matrix = NULL;
+     }
+     
+     if ((rdev->render_options & DSRO_ANTIALIAS) != (state->render_options & DSRO_ANTIALIAS)) {
+          RADEON_UNSET( DRAWING_FLAGS );
+          RADEON_UNSET( BLITTING_FLAGS );
+     }     
+     rdev->render_options = state->render_options;
+     
+     RADEON_SET( RENDER_OPTIONS );
+}
+
+/* NOTES:
+ * - We use texture unit 0 for blitting functions,
+ *          texture unit 1 for drawing functions
+ * - Default blend equation is ADD_CLAMP (A * B + C)
+ */
+
+void r100_set_drawingflags( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl       |
+                                  GMC_SRC_DATATYPE_MONO_FG_LA |
+                                  GMC_BRUSH_SOLID_COLOR       |
+                                  GMC_CLR_CMP_CNTL_DIS;
+     u32            rb3d_cntl   = rdev->rb3d_cntl & ~DITHER_ENABLE;
+     u32            pp_cntl     = SCISSOR_ENABLE | TEX_BLEND_1_ENABLE;
+     u32            cblend      = COLOR_ARG_C_TFACTOR_COLOR;
+     
+     if (RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+
+     if (rdev->dst_422) {
+          pp_cntl |= TEX_1_ENABLE;
+          cblend   = COLOR_ARG_C_T1_COLOR;
+     }
+     else if (rdev->dst_format == DSPF_A8) {
+          cblend = COLOR_ARG_C_TFACTOR_ALPHA;
+     }
+     
+     if (state->drawingflags & DSDRAW_BLEND)
+          rb3d_cntl |= ALPHA_BLEND_ENABLE;
+
+     if (state->drawingflags & DSDRAW_XOR) {
+          rb3d_cntl   |= ROP_ENABLE;
+          master_cntl |= GMC_ROP3_PATXOR;
+     }
+     else {
+          master_cntl |= GMC_ROP3_PATCOPY;
+     }
+
+     if (state->render_options & DSRO_ANTIALIAS)
+          pp_cntl |= ANTI_ALIAS_LINE_POLY;
+
+     radeon_waitfifo( rdrv, rdev, 8 );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     radeon_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM );
+     radeon_out32( mmio, RB3D_CNTL, rb3d_cntl );
+     radeon_out32( mmio, SE_CNTL, DIFFUSE_SHADE_FLAT  |
+                                  ALPHA_SHADE_FLAT    |
+                                  BFACE_SOLID         |
+                                  FFACE_SOLID         |
+                                  VTX_PIX_CENTER_OGL  |
+                                  ROUND_MODE_ROUND    |
+				              ROUND_PREC_4TH_PIX );
+     radeon_out32( mmio, PP_CNTL, pp_cntl );
+     radeon_out32( mmio, PP_TXCBLEND_1, cblend );
+     radeon_out32( mmio, PP_TXABLEND_1, ALPHA_ARG_C_TFACTOR_ALPHA );
+     radeon_out32( mmio, SE_VTX_FMT, SE_VTX_FMT_XY );
+     
+     rdev->drawingflags = state->drawingflags;
+
+     RADEON_SET  ( DRAWING_FLAGS );
+     RADEON_UNSET( BLITTING_FLAGS );
+}
+
+void r100_set_blittingflags( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl |
+                                  GMC_BRUSH_NONE        |
+                                  GMC_SRC_DATATYPE_COLOR;
+     u32            cmp_cntl    = 0;
+     u32            rb3d_cntl   = rdev->rb3d_cntl;
+     u32            se_cntl     = BFACE_SOLID        |
+                                  FFACE_SOLID        |
+                                  VTX_PIX_CENTER_OGL |
+                                  ROUND_MODE_ROUND;
+     u32            pp_cntl     = SCISSOR_ENABLE    | 
+                                  TEX_0_ENABLE      |
+                                  TEX_BLEND_0_ENABLE;
+     u32            cblend      = COLOR_ARG_C_T0_COLOR;
+     u32            ablend      = ALPHA_ARG_C_T0_ALPHA;
+     u32            vtx_fmt     = SE_VTX_FMT_XY | SE_VTX_FMT_ST0;
+     u32            coord_fmt   = VTX_XY_PRE_MULT_1_OVER_W0 | 
+                                  TEX1_W_ROUTING_USE_W0;
+     
+     if (RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+           
+     if (rdev->accel == DFXL_TEXTRIANGLES) {
+          se_cntl   |= DIFFUSE_SHADE_GOURAUD  |
+                       ALPHA_SHADE_GOURAUD    |
+                       SPECULAR_SHADE_GOURAUD |
+                       FLAT_SHADE_VTX_LAST    |
+                       ROUND_PREC_8TH_PIX;
+          vtx_fmt   |= SE_VTX_FMT_W0 | SE_VTX_FMT_Z;
+     }
+     else {
+          se_cntl   |= DIFFUSE_SHADE_FLAT |
+                       ALPHA_SHADE_FLAT   |
+                       ROUND_PREC_4TH_PIX;
+          coord_fmt |= VTX_ST0_NONPARAMETRIC |
+                       VTX_ST1_NONPARAMETRIC;
+     }
+    
+     if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                 DSBLIT_BLEND_ALPHACHANNEL)) {
+          if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    ablend = ALPHA_ARG_A_T0_ALPHA | ALPHA_ARG_B_TFACTOR_ALPHA;
+               else
+                    ablend = ALPHA_ARG_C_TFACTOR_ALPHA;
+          }
+          
+          rb3d_cntl |= ALPHA_BLEND_ENABLE;
+     }
+
+     if (rdev->dst_format != DSPF_A8) {
+          if (state->blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR)) {
+               if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA)
+                    ablend = ALPHA_ARG_A_T0_ALPHA | ALPHA_ARG_B_T1_ALPHA;
+               
+               if (state->blittingflags & DSBLIT_SRC_MASK_COLOR)
+                    cblend = COLOR_ARG_A_T0_COLOR | COLOR_ARG_B_T1_COLOR;
+                    
+               pp_cntl |= TEX_1_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_COLORIZE) {
+               if (rdev->dst_422) {
+                    cblend = (rdev->src_format == DSPF_A8)
+                             ? (COLOR_ARG_C_T1_COLOR)
+                             : (COLOR_ARG_A_T0_COLOR | COLOR_ARG_B_T1_COLOR);
+
+                    pp_cntl |= TEX_1_ENABLE;
+               }
+               else {
+                    cblend = (rdev->src_format == DSPF_A8)
+                             ? (COLOR_ARG_C_TFACTOR_COLOR)
+                             : (COLOR_ARG_A_T0_COLOR | COLOR_ARG_B_TFACTOR_COLOR);
+               }
+          }
+          else if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+               cblend = (rdev->src_format == DSPF_A8)
+                        ? (COLOR_ARG_C_T0_ALPHA)
+                        : (COLOR_ARG_A_T0_COLOR | COLOR_ARG_B_TFACTOR_ALPHA);
+          }
+          else if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+               cblend = (rdev->src_format == DSPF_A8)
+                        ? (COLOR_ARG_C_T0_ALPHA)
+                        : (COLOR_ARG_A_T0_COLOR | COLOR_ARG_B_T0_ALPHA);
+          }
+     } /* DSPF_A8 */
+     else {
+          if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA) {
+               ablend = ALPHA_ARG_A_T0_ALPHA | ALPHA_ARG_B_T1_ALPHA;
+               cblend = COLOR_ARG_A_T0_ALPHA | COLOR_ARG_B_T1_ALPHA;
+               pp_cntl |= TEX_1_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    cblend = COLOR_ARG_A_T0_ALPHA | COLOR_ARG_B_TFACTOR_ALPHA;
+               else
+                    cblend = COLOR_ARG_C_TFACTOR_ALPHA;
+          }
+          else {
+               cblend = COLOR_ARG_C_T0_ALPHA;
+          }
+     }
+ 
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          cmp_cntl = SRC_CMP_EQ_COLOR | CLR_CMP_SRC_SOURCE;
+     else
+          master_cntl |= GMC_CLR_CMP_CNTL_DIS;
+
+     if (state->blittingflags & DSBLIT_XOR) {
+          master_cntl |= GMC_ROP3_XOR;
+          rb3d_cntl   |= ROP_ENABLE; 
+     } 
+     else {
+          master_cntl |= GMC_ROP3_SRCCOPY;
+     }
+
+     if (state->render_options & DSRO_ANTIALIAS)
+          pp_cntl |= ANTI_ALIAS_POLY;
+
+     radeon_waitfifo( rdrv, rdev, 9 );
+     radeon_out32( mmio, CLR_CMP_CNTL, cmp_cntl );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     radeon_out32( mmio, RB3D_CNTL, rb3d_cntl );
+     radeon_out32( mmio, SE_CNTL, se_cntl );
+     radeon_out32( mmio, PP_CNTL, pp_cntl );
+     radeon_out32( mmio, PP_TXCBLEND_0, cblend );
+     radeon_out32( mmio, PP_TXABLEND_0, ablend );
+     radeon_out32( mmio, SE_VTX_FMT, vtx_fmt );
+     radeon_out32( mmio, SE_COORD_FMT, coord_fmt );
+     
+     rdev->blittingflags = state->blittingflags;
+     
+     RADEON_SET  ( BLITTING_FLAGS );
+     RADEON_UNSET( DRAWING_FLAGS );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/r200_3d.c b/Source/DirectFB/gfxdrivers/radeon/r200_3d.c
new file mode 100755
index 0000000..2521c68
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r200_3d.c
@@ -0,0 +1,508 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <dfb_types.h>
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_3d.h"
+
+
+#define EMIT_VERTICES( rdrv, rdev, mmio ) { \
+     u32 *_v = (rdev)->vb; \
+     u32  _s = (rdev)->vb_size; \
+     radeon_waitfifo( rdrv, rdev, 1 ); \
+     radeon_out32( mmio, SE_VF_CNTL, rdev->vb_type | VF_PRIM_WALK_DATA | \
+                                    (rdev->vb_count << VF_NUM_VERTICES_SHIFT) ); \
+     do { \
+          u32 _n = MIN(_s, 64); \
+          _s -= _n; \
+          radeon_waitfifo( rdrv, rdev, _n ); \
+          while (_n--) \
+               radeon_out32( mmio, SE_PORT_DATA0, *_v++ ); \
+     } while (_s); \
+}
+
+static void
+r200_flush_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+    
+     EMIT_VERTICES( rdrv, rdev, mmio );
+
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          DFBRegion *clip = &rdev->clip;
+          bool       s420 = DFB_PLANAR_PIXELFORMAT(rdev->src_format);
+          int        i;
+          
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               for (i = 0; i < rdev->vb_size; i += 4) {
+                    rdev->vb[i+0] = f2d(d2f(rdev->vb[i+0])*0.5f);
+                    rdev->vb[i+1] = f2d(d2f(rdev->vb[i+1])*0.5f);
+                    if (s420) {
+                         rdev->vb[i+2] = f2d(d2f(rdev->vb[i+2])*0.5f);
+                         rdev->vb[i+3] = f2d(d2f(rdev->vb[i+3])*0.5f);
+                    }
+               }
+          } else {
+               for (i = 0; i < rdev->vb_size; i += 2) {
+                    rdev->vb[i+0] = f2d(d2f(rdev->vb[i+0])*0.5f);
+                    rdev->vb[i+1] = f2d(d2f(rdev->vb[i+1])*0.5f);
+               }
+          }
+
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cb );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch/2 );
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1/2 << 16) |
+                                           (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2/2 << 16) |
+                                               (clip->x2/2 & 0xffff) );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->cb_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 3 );
+                    radeon_out32( mmio, R200_PP_TXSIZE_0, ((rdev->src_height/2-1) << 16) |
+                                                          ((rdev->src_width/2-1) & 0xffff) );
+                    radeon_out32( mmio, R200_PP_TXPITCH_0, rdev->src_pitch/2 - 32 );
+                    radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset_cb );
+               }
+          } else {
+               radeon_out32( mmio, R200_PP_TFACTOR_1, rdev->cb_cop );
+          }
+
+          /* Fill Cb plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cr );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->cr_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 1 );
+                    radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset_cr );
+               }
+          } else {
+               radeon_out32( mmio, R200_PP_TFACTOR_1, rdev->cr_cop );
+          }
+
+          /* Fill Cr plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch );
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1 << 16) |
+                                           (clip->x1 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2 << 16) |
+                                               (clip->x2 & 0xffff) );
+          if (DFB_BLITTING_FUNCTION(rdev->accel)) {
+               radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->y_cop );
+               if (s420) {
+                    radeon_waitfifo( rdrv, rdev, 3 );
+                    radeon_out32( mmio, R200_PP_TXSIZE_0, ((rdev->src_height-1) << 16) |
+                                                          ((rdev->src_width-1) & 0xffff) );
+                    radeon_out32( mmio, R200_PP_TXPITCH_0, rdev->src_pitch - 32 );
+                    radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset );
+               }
+          } else {
+               radeon_out32( mmio, R200_PP_TFACTOR_1, rdev->y_cop );
+          }
+     }
+    
+     rdev->vb_size  = 0;
+     rdev->vb_count = 0;
+}
+
+static inline u32*
+r200_init_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev, u32 type, u32 count, u32 size )
+{
+     u32 *vb;
+    
+     if ((rdev->vb_size && rdev->vb_type != type) ||
+          rdev->vb_size+size > D_ARRAY_SIZE(rdev->vb))
+          r200_flush_vb( rdrv, rdev );
+        
+     vb = &rdev->vb[rdev->vb_size];
+     rdev->vb_type   = type;
+     rdev->vb_size  += size;
+     rdev->vb_count += count;
+    
+     return vb;
+}
+
+
+bool r200FillRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+
+     if (rect->w == 1 && rect->h == 1) {
+          x1 = rect->x+1; y1 = rect->y+1;
+          if (rdev->matrix)
+               RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_POINT_LIST, 1, 2 );
+          *v++ = f2d(x1); *v++ = f2d(y1);
+
+          return true;
+     }
+     
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 8 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);     
+     }
+     else {
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 3, 6 );
+          *v++ = f2d(x1); *v++ = f2d(y1);
+          *v++ = f2d(x2); *v++ = f2d(y1);
+          *v++ = f2d(x2); *v++ = f2d(y2);
+     }
+
+     return true;
+}
+
+bool r200FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             x3, y3;
+     u32              *v;
+
+     x1 = tri->x1; y1 = tri->y1;
+     x2 = tri->x2; y2 = tri->y2;
+     x3 = tri->x3; y3 = tri->y3;
+     if (rdev->matrix) {
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x3, y3, x3, y3, rdev->matrix, rdev->affine_matrix );
+     }
+
+     v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_TRIANGLE_LIST, 3, 6 );
+     *v++ = f2d(x1); *v++ = f2d(y1);
+     *v++ = f2d(x2); *v++ = f2d(y2);
+     *v++ = f2d(x3); *v++ = f2d(y3);
+     
+     return true;
+}
+
+bool r200DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+     
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LOOP, 4, 8 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y);
+     }
+     else {
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 12, 24 );
+          /* top line */
+          *v++ = f2d(x1);   *v++ = f2d(y1);
+          *v++ = f2d(x2);   *v++ = f2d(y1);
+          *v++ = f2d(x2);   *v++ = f2d(y1+1);
+          /* right line */
+          *v++ = f2d(x2-1); *v++ = f2d(y1+1);
+          *v++ = f2d(x2);   *v++ = f2d(y1+1);
+          *v++ = f2d(x2);   *v++ = f2d(y2-1);
+          /* bottom line */
+          *v++ = f2d(x1);   *v++ = f2d(y2-1);
+          *v++ = f2d(x2);   *v++ = f2d(y2-1);
+          *v++ = f2d(x2);   *v++ = f2d(y2);
+          /* left line */
+          *v++ = f2d(x1);   *v++ = f2d(y1+1);
+          *v++ = f2d(x1+1); *v++ = f2d(y1+1);
+          *v++ = f2d(x1+1); *v++ = f2d(y2-1);
+     }
+
+     return true;
+}
+
+bool r200DrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+
+     x1 = line->x1; y1 = line->y1;
+     x2 = line->x2; y2 = line->y2;
+     if (rdev->matrix) {
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+     }
+
+     v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LIST, 2, 4 );
+     *v++ = f2d(x1); *v++ = f2d(y1);
+     *v++ = f2d(x2); *v++ = f2d(y2);
+
+     return true;
+}
+
+bool r200Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy )
+{
+     DFBRectangle dr = { dx, dy, sr->w, sr->h };
+     
+     return r200StretchBlit( drv, dev, sr, &dr );
+}
+
+bool r200StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             s1, t1;
+     float             s2, t2;
+     u32              *v;
+    
+     if (rdev->blittingflags & DSBLIT_DEINTERLACE) {
+          sr->y /= 2;
+          sr->h /= 2;
+     }
+
+     s1 = sr->x;       t1 = sr->y;
+     s2 = sr->x+sr->w; t2 = sr->y+sr->h;
+     if (rdev->blittingflags & DSBLIT_ROTATE180) {
+          float tmp;
+          tmp = s2; s2 = s1; s1 = tmp;
+          tmp = t2; t2 = t1; t1 = tmp;
+     }
+
+     x1 = dr->x;       y1 = dr->y;
+     x2 = dr->x+dr->w; y2 = dr->y+dr->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 16 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y); *v++ = f2d(s1); *v++ = f2d(t1);
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y); *v++ = f2d(s2); *v++ = f2d(t1);
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y); *v++ = f2d(s2); *v++ = f2d(t2);
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          *v++ = f2d(x); *v++ = f2d(y); *v++ = f2d(s1); *v++ = f2d(t2);
+     }
+     else {
+          v = r200_init_vb( rdrv, rdev, VF_PRIM_TYPE_RECTANGLE_LIST, 3, 12 );
+          *v++ = f2d(x1); *v++ = f2d(y1); *v++ = f2d(s1); *v++ = f2d(t1);
+          *v++ = f2d(x2); *v++ = f2d(y1); *v++ = f2d(s2); *v++ = f2d(t1);
+          *v++ = f2d(x2); *v++ = f2d(y2); *v++ = f2d(s2); *v++ = f2d(t2);
+     }
+
+     return true;
+}
+
+static void
+r200DoTextureTriangles( RadeonDriverData *rdrv, RadeonDeviceData *rdev,
+                        DFBVertex *ve, int num, u32 primitive )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     int          i;
+ 
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     
+     radeon_out32( mmio, SE_VF_CNTL, primitive | VF_PRIM_WALK_DATA |
+                                     (num << VF_NUM_VERTICES_SHIFT) );
+
+     for (; num >= 10; num -= 10) {
+          radeon_waitfifo( rdrv, rdev, 60 );
+          for (i = 0; i < 10; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].w) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+          }
+          ve += 10;
+     }
+
+     if (num > 0) {
+          radeon_waitfifo( rdrv, rdev, num*6 );
+          for (i = 0; i < num; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].w) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+          }
+     }
+}
+
+bool r200TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation )
+{ 
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     u32               prim = 0;
+     int               i;
+
+     if (num > 65535) {
+          D_WARN( "R200 supports maximum 65535 vertices" );
+          return false;
+     }
+
+     switch (formation) {
+          case DTTF_LIST:
+               prim = VF_PRIM_TYPE_TRIANGLE_LIST;
+               break;
+          case DTTF_STRIP:
+               prim = VF_PRIM_TYPE_TRIANGLE_STRIP;
+               break;
+          case DTTF_FAN:
+               prim = VF_PRIM_TYPE_TRIANGLE_FAN;
+               break;
+          default:
+               D_BUG( "unexpected triangle formation" );
+               return false;
+     }
+
+     if (rdev->matrix) {
+          for (i = 0; i < num; i++)
+               RADEON_TRANSFORM( ve[i].x, ve[i].y, ve[i].x, ve[i].y, rdev->matrix, rdev->affine_matrix );
+     }
+
+     r200DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          DFBRegion   *clip = &rdev->clip;
+          volatile u8 *mmio = rdrv->mmio_base;
+          bool         s420 = DFB_PLANAR_PIXELFORMAT(rdev->src_format);
+          
+          /* Scale coordinates */
+          for (i = 0; i < num; i++) {
+               ve[i].x *= 0.5;
+               ve[i].y *= 0.5;
+          }
+
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, s420 ? 8 : 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cb );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch/2 );
+          if (s420) {
+               radeon_out32( mmio, R200_PP_TXSIZE_0, ((rdev->src_height/2-1) << 16) |
+                                                     ((rdev->src_width/2-1) & 0xffff) );
+               radeon_out32( mmio, R200_PP_TXPITCH_0, rdev->src_pitch/2 - 32 );
+               radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset_cb );
+          }
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1/2 << 16) |
+                                           (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2/2 << 16) | 
+                                               (clip->x2/2 & 0xffff) );
+          radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->cb_cop );
+     
+          /* Map Cb plane */
+          r200DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, s420 ? 3 : 2 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset_cr );
+          if (s420)
+               radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset_cr );
+          radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->cr_cop );
+
+          /* Map Cr plane */
+          r200DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, s420 ? 8 : 5 );
+          radeon_out32( mmio, RB3D_COLOROFFSET, rdev->dst_offset );
+          radeon_out32( mmio, RB3D_COLORPITCH, rdev->dst_pitch );
+          if (s420) {
+               radeon_out32( mmio, R200_PP_TXSIZE_0, ((rdev->src_height-1) << 16) |
+                                                     ((rdev->src_width-1) & 0xffff) );
+               radeon_out32( mmio, R200_PP_TXPITCH_0, rdev->src_pitch - 32 );
+               radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset );
+          }
+          radeon_out32( mmio, RE_TOP_LEFT, (clip->y1 << 16) |
+                                           (clip->x1 & 0xffff) );
+          radeon_out32( mmio, RE_BOTTOM_RIGHT, (clip->y2 << 16) |
+                                               (clip->x2 & 0xffff) );
+          radeon_out32( mmio, R200_PP_TFACTOR_0, rdev->y_cop );
+     }
+     
+     return true;
+}
+
+void r200EmitCommands3D( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     
+     if (rdev->vb_count)
+          r200_flush_vb( rdrv, rdev );
+}
diff --git a/Source/DirectFB/gfxdrivers/radeon/r200_state.c b/Source/DirectFB/gfxdrivers/radeon/r200_state.c
new file mode 100755
index 0000000..c3bf768
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r200_state.c
@@ -0,0 +1,985 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_state.h"
+
+
+static const u32 r200SrcBlend[] = {
+     SRC_BLEND_GL_ZERO,                 // DSBF_ZERO
+     SRC_BLEND_GL_ONE,                  // DSBF_ONE
+     SRC_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     SRC_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     SRC_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     SRC_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     SRC_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     SRC_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     SRC_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     SRC_BLEND_GL_SRC_ALPHA_SATURATE    // DSBF_SRCALPHASAT
+};
+
+static const u32 r200DstBlend[] = {
+     DST_BLEND_GL_ZERO,                 // DSBF_ZERO
+     DST_BLEND_GL_ONE,                  // DSBF_ONE
+     DST_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     DST_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     DST_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     DST_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     DST_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     DST_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     DST_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     DST_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     DST_BLEND_GL_ZERO                  // DSBF_SRCALPHASAT
+};
+
+
+void r200_restore( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     radeon_waitfifo( rdrv, rdev, 15 );
+     /* enable caches */
+     radeon_out32( mmio, RB2D_DSTCACHE_MODE, RB2D_DC_2D_CACHE_AUTOFLUSH     |
+                                             RB2D_DC_3D_CACHE_AUTOFLUSH     |
+                                             R200_RB2D_DC_2D_CACHE_AUTOFREE |
+                                             R200_RB2D_DC_3D_CACHE_AUTOFREE );
+     radeon_out32( mmio, RB3D_DSTCACHE_MODE, RB3D_DC_2D_CACHE_AUTOFLUSH     |
+                                             RB3D_DC_3D_CACHE_AUTOFLUSH     |
+                                             R200_RB3D_DC_2D_CACHE_AUTOFREE |
+                                             R200_RB3D_DC_3D_CACHE_AUTOFREE );          
+     /* restore 3d engine state */
+     radeon_out32( mmio, SE_LINE_WIDTH, 0x10 );
+     radeon_out32( mmio, RE_POINTSIZE, 0x10 );
+     radeon_out32( mmio, PP_MISC, ALPHA_TEST_PASS ); 
+     radeon_out32( mmio, R200_PP_CNTL_X, 0 );
+     radeon_out32( mmio, R200_PP_TXMULTI_CTL_0, 0 ); 
+     radeon_out32( mmio, R200_RE_CNTL, R200_SCISSOR_ENABLE );
+     radeon_out32( mmio, R200_SE_VTX_STATE_CNTL, 0 );
+     radeon_out32( mmio, R200_SE_VAP_CNTL, R200_VAP_VF_MAX_VTX_NUM |
+                                           R200_VAP_FORCE_W_TO_ONE );
+#ifdef WORDS_BIGENDIAN
+     radeon_out32( mmio, R200_SE_VAP_CNTL_STATUS, R200_TCL_BYPASS | R200_VC_32BIT_SWAP );
+#else
+     radeon_out32( mmio, R200_SE_VAP_CNTL_STATUS, R200_TCL_BYPASS );
+#endif
+     radeon_out32( mmio, RB3D_ZSTENCILCNTL, Z_TEST_ALWAYS );
+     radeon_out32( mmio, RB3D_ROPCNTL, ROP_XOR );
+     radeon_out32( mmio, R200_PP_TXFORMAT_X_0, 0 );
+     radeon_out32( mmio, R200_PP_TXFORMAT_X_1, 0 );
+}
+
+void r200_set_destination( RadeonDriverData *rdrv,
+                           RadeonDeviceData *rdev,
+                           CardState        *state )
+{
+     CoreSurface       *surface = state->destination;
+     CoreSurfaceBuffer *buffer  = state->dst.buffer;
+     volatile u8       *mmio    = rdrv->mmio_base;
+     u32                offset;
+     u32                pitch;
+    
+     if (RADEON_IS_SET( DESTINATION ))
+          return;
+     
+     D_ASSERT( (state->dst.offset % 32) == 0 );
+     D_ASSERT( (state->dst.pitch % 32) == 0 );
+
+     offset = radeon_buffer_offset( rdev, &state->dst );
+     pitch  = state->dst.pitch;
+    
+     if (rdev->dst_offset != offset        ||
+         rdev->dst_pitch  != pitch         ||
+         rdev->dst_format != buffer->format)
+     {
+          bool dst_422 = false;
+          
+          switch (buffer->format) {
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_A8:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    break;
+               case DSPF_RGB332:          
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB332 | DITHER_ENABLE;
+                    break;
+               case DSPF_ARGB2554:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB565;
+                    break;
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB4444 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:          
+                    rdev->gui_master_cntl = GMC_DST_15BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB1555 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB16:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB565 | DITHER_ENABLE;
+                    break;
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_AiRGB:
+               case DSPF_AYUV:
+                    rdev->gui_master_cntl = GMC_DST_32BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_ARGB8888;
+                    break;
+               case DSPF_UYVY:
+                    rdev->gui_master_cntl = GMC_DST_YVYU;
+                    rdev->rb3d_cntl = COLOR_FORMAT_YUV422_YVYU;
+                    dst_422 = true;
+                    break;
+               case DSPF_YUY2:
+                    rdev->gui_master_cntl = GMC_DST_VYUY;
+                    rdev->rb3d_cntl = COLOR_FORMAT_YUV422_VYUY;
+                    dst_422 = true;
+                    break;
+               case DSPF_I420:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    rdev->dst_offset_cb = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cr = rdev->dst_offset_cb + 
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               case DSPF_YV12:
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->rb3d_cntl = COLOR_FORMAT_RGB8;
+                    rdev->dst_offset_cr = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cb = rdev->dst_offset_cr +
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    return;
+          }
+
+          rdev->gui_master_cntl |= GMC_DP_SRC_SOURCE_MEMORY  |
+                                   GMC_WR_MSK_DIS            |
+                                   GMC_SRC_PITCH_OFFSET_CNTL |
+                                   GMC_DST_PITCH_OFFSET_CNTL |
+                                   GMC_DST_CLIPPING;
+          
+          radeon_waitfifo( rdrv, rdev, 4 ); 
+          radeon_out32( mmio, DST_OFFSET, offset );
+          radeon_out32( mmio, DST_PITCH, pitch );
+          radeon_out32( mmio, RB3D_COLOROFFSET, offset );
+          radeon_out32( mmio, RB3D_COLORPITCH,  
+                              pitch / DFB_BYTES_PER_PIXEL(buffer->format) );
+          
+          if (rdev->dst_format != buffer->format) {
+               if (dst_422 && !rdev->dst_422) {
+                    RADEON_UNSET( SOURCE );
+                    RADEON_UNSET( CLIP );
+               }
+               
+               RADEON_UNSET( COLOR );
+               RADEON_UNSET( DST_BLEND );
+          }
+          
+          rdev->dst_format = buffer->format;
+          rdev->dst_offset = offset;
+          rdev->dst_pitch  = pitch;
+          rdev->dst_422    = dst_422;
+     }
+
+     RADEON_SET( DESTINATION );
+}
+
+void r200_set_source( RadeonDriverData *rdrv,
+                      RadeonDeviceData *rdev,
+                      CardState        *state )
+{
+     CoreSurface       *surface  = state->source;
+     CoreSurfaceBuffer *buffer   = state->src.buffer;
+     volatile u8       *mmio     = rdrv->mmio_base;
+     u32                txformat = R200_TXFORMAT_NON_POWER2;
+     u32                txfilter = R200_MAG_FILTER_LINEAR  |
+                                   R200_MIN_FILTER_LINEAR  |
+                                   R200_CLAMP_S_CLAMP_LAST |
+                                   R200_CLAMP_T_CLAMP_LAST;
+     
+     if (RADEON_IS_SET( SOURCE )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (rdev->blittingflags  & DSBLIT_DEINTERLACE))
+               return;
+     }
+
+     D_ASSERT( (state->src.offset % 32) == 0 );
+     D_ASSERT( (state->src.pitch % 32) == 0 );
+     
+     rdev->src_offset = radeon_buffer_offset( rdev, &state->src );
+     rdev->src_pitch  = state->src.pitch;
+     rdev->src_width  = surface->config.size.w;
+     rdev->src_height = surface->config.size.h;
+
+     switch (buffer->format) {
+          case DSPF_LUT8:
+               txformat |= R200_TXFORMAT_I8;
+               txfilter &= ~(R200_MAG_FILTER_LINEAR |
+                             R200_MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ALUT44:
+               txformat |= R200_TXFORMAT_I8;
+               txfilter &= ~(R200_MAG_FILTER_LINEAR |
+                             R200_MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x0000000f;
+               break;
+          case DSPF_A8:
+               txformat |= R200_TXFORMAT_I8 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0;
+               break;
+          case DSPF_RGB332:
+               txformat |= R200_TXFORMAT_RGB332;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ARGB2554:
+               txformat |= R200_TXFORMAT_RGB565;
+               txfilter &= ~(R200_MAG_FILTER_LINEAR |
+                             R200_MIN_FILTER_LINEAR);
+               rdev->src_mask = 0x00003fff;
+               break;
+          case DSPF_RGB444:
+               txformat |= R200_TXFORMAT_ARGB4444;
+               rdev->src_mask = 0x00000fff;
+               break;     
+          case DSPF_ARGB4444:
+               txformat |= R200_TXFORMAT_ARGB4444 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00000fff;
+               break;
+          case DSPF_RGB555:
+               txformat |= R200_TXFORMAT_ARGB1555;
+               rdev->src_mask = 0x00007fff;
+               break; 
+          case DSPF_ARGB1555:
+               txformat |= R200_TXFORMAT_ARGB1555 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00007fff;
+               break;
+          case DSPF_RGB16:
+               txformat |= R200_TXFORMAT_RGB565;
+               rdev->src_mask = 0x0000ffff;
+               break;
+          case DSPF_RGB32:
+               txformat |= R200_TXFORMAT_ARGB8888;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_AYUV:
+               txformat |= R200_TXFORMAT_ARGB8888 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_UYVY:
+               txformat |= R200_TXFORMAT_YVYU422;
+               if (!rdev->dst_422)
+                    txfilter |= R200_YUV_TO_RGB;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_YUY2:
+               txformat |= R200_TXFORMAT_VYUY422;
+               if (!rdev->dst_422)
+                    txfilter |= R200_YUV_TO_RGB;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_I420:
+               txformat |= R200_TXFORMAT_I8;
+               rdev->src_offset_cb = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cr = rdev->src_offset_cb +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_YV12:
+               txformat |= R200_TXFORMAT_I8;
+               rdev->src_offset_cr = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cb = rdev->src_offset_cr +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) { 
+          rdev->src_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_height * rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_height * rdev->src_pitch/4;
+                    rdev->src_offset_cb += rdev->src_height * rdev->src_pitch/4;
+               }
+          } else {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_pitch/2;
+                    rdev->src_offset_cb += rdev->src_pitch/2;
+               }
+               rdev->src_pitch *= 2;
+          }
+     }
+
+     radeon_waitfifo( rdrv, rdev, 7 );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset );
+     radeon_out32( mmio, SRC_PITCH, rdev->src_pitch );
+     radeon_out32( mmio, R200_PP_TXFILTER_0, txfilter );
+     radeon_out32( mmio, R200_PP_TXFORMAT_0, txformat );
+     radeon_out32( mmio, R200_PP_TXSIZE_0, ((rdev->src_height-1) << 16) | 
+                                           ((rdev->src_width-1) & 0xffff) );
+     radeon_out32( mmio, R200_PP_TXPITCH_0, rdev->src_pitch - 32 );
+     radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset );
+
+     if (rdev->src_format != buffer->format)
+          RADEON_UNSET( BLITTING_FLAGS );
+     rdev->src_format = buffer->format;
+
+     RADEON_SET( SOURCE );
+}
+
+void r200_set_source_mask( RadeonDriverData *rdrv,
+                           RadeonDeviceData *rdev,
+                           CardState        *state )
+{
+     CoreSurface       *surface  = state->source_mask;
+     CoreSurfaceBuffer *buffer   = state->src_mask.buffer;
+     volatile u8       *mmio     = rdrv->mmio_base;
+     u32                txformat = R200_TXFORMAT_NON_POWER2;
+     u32                txfilter = R200_MAG_FILTER_LINEAR  |
+                                   R200_MIN_FILTER_LINEAR  |
+                                   R200_CLAMP_S_CLAMP_LAST |
+                                   R200_CLAMP_T_CLAMP_LAST;
+     
+     if (RADEON_IS_SET( SOURCE_MASK )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (rdev->blittingflags  & DSBLIT_DEINTERLACE))
+               return;
+     }
+
+     D_ASSERT( (state->src_mask.offset % 32) == 0 );
+     D_ASSERT( (state->src_mask.pitch % 32) == 0 );
+     
+     rdev->msk_format = buffer->format;
+     rdev->msk_offset = radeon_buffer_offset( rdev, &state->src_mask );
+     rdev->msk_pitch  = state->src_mask.pitch;
+     rdev->msk_width  = surface->config.size.w;
+     rdev->msk_height = surface->config.size.h;
+
+     switch (buffer->format) {
+          case DSPF_A8:
+               txformat |= R200_TXFORMAT_I8 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB332:
+               txformat |= R200_TXFORMAT_RGB332;
+               break;
+          case DSPF_RGB444:
+               txformat |= R200_TXFORMAT_ARGB4444;
+               break;     
+          case DSPF_ARGB4444:
+               txformat |= R200_TXFORMAT_ARGB4444 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB555:
+               txformat |= R200_TXFORMAT_ARGB1555;
+               break; 
+          case DSPF_ARGB1555:
+               txformat |= R200_TXFORMAT_ARGB1555 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               break;
+          case DSPF_RGB16:
+               txformat |= R200_TXFORMAT_RGB565;
+               break;
+          case DSPF_RGB32:
+               txformat |= R200_TXFORMAT_ARGB8888;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+               txformat |= R200_TXFORMAT_ARGB8888 |
+                           R200_TXFORMAT_ALPHA_IN_MAP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return;
+     }
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) { 
+          rdev->msk_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field)
+                    rdev->msk_offset += rdev->msk_height * rdev->msk_pitch;
+          } else {
+               if (surface->field)
+                    rdev->msk_offset += rdev->msk_pitch;
+               rdev->msk_pitch *= 2;
+          }
+     }
+
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, R200_PP_TXFILTER_1, txfilter );
+     radeon_out32( mmio, R200_PP_TXFORMAT_1, txformat );
+     radeon_out32( mmio, R200_PP_TXSIZE_1, ((rdev->msk_height-1) << 16) | 
+                                           ((rdev->msk_width-1) & 0xffff) );
+     radeon_out32( mmio, R200_PP_TXPITCH_1, rdev->msk_pitch - 32 );
+     radeon_out32( mmio, R200_PP_TXOFFSET_1, rdev->msk_offset );
+
+     RADEON_SET( SOURCE_MASK );
+}
+
+void r200_set_clip( RadeonDriverData *rdrv,
+                    RadeonDeviceData *rdev,
+                    CardState        *state )
+{
+     DFBRegion   *clip = &state->clip;
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     if (RADEON_IS_SET( CLIP ))
+          return;
+  
+     /* 2d clip */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     if (rdev->dst_422) {
+          radeon_out32( mmio, SC_TOP_LEFT,
+                      (clip->y1 << 16) | (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1)/2 & 0xffff) );
+     } else {     
+          radeon_out32( mmio, SC_TOP_LEFT, 
+                      (clip->y1 << 16) | (clip->x1 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1) & 0xffff) );
+     }
+      
+     /* 3d clip */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, RE_TOP_LEFT, 
+                 (clip->y1 << 16) | (clip->x1 & 0xffff) );
+     radeon_out32( mmio, RE_BOTTOM_RIGHT,
+                 (clip->y2 << 16) | (clip->x2 & 0xffff) );
+     
+     rdev->clip = state->clip;
+     
+     RADEON_SET( CLIP );
+}
+
+#define R200_SET_YUV422_COLOR( rdrv, rdev, y, u, v ) {          \
+     radeon_out32( (rdrv)->fb_base, (rdev)->yuv422_buffer,      \
+                   PIXEL_YUY2( y, u, v ) );                     \
+     radeon_in8( (rdrv)->fb_base, (rdev)->yuv422_buffer );      \
+     radeon_waitfifo( rdrv, rdev, 3 );                          \
+     radeon_out32( (rdrv)->mmio_base, R200_PP_TXOFFSET_1,       \
+                   (rdev)->fb_offset + (rdev)->yuv422_buffer ); \
+     radeon_out32( (rdrv)->mmio_base, R200_PP_TXFORMAT_1,       \
+                   R200_TXFORMAT_VYUY422 );                     \
+     radeon_out32( (rdrv)->mmio_base, R200_PP_TXFILTER_1, 0 );  \
+}
+
+void r200_set_drawing_color( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState        *state )
+{
+     DFBColor color   = state->color;
+     int      index   = state->color_index;
+     u32      color2d;
+     u32      color3d;
+     int      y, u, v;
+
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = ((long) color.r * color.a / 255L);
+          color.g = ((long) color.g * color.a / 255L);
+          color.b = ((long) color.b * color.a / 255L);
+     }
+
+     color3d = PIXEL_ARGB( color.a, color.r,
+                           color.g, color.b );
+ 
+     switch (rdev->dst_format) {
+          case DSPF_ALUT44:
+               index |= (color.a & 0xf0);
+          case DSPF_LUT8:
+               color2d = index;
+               color3d = PIXEL_RGB32( index, index, index );
+               break;
+          case DSPF_A8:
+               color2d = color.a;
+               color3d = (color.a << 24) | 0x00ffffff;              
+               break;
+          case DSPF_RGB332:
+               color2d = PIXEL_RGB332( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB2554:
+               color2d = PIXEL_ARGB2554( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               color2d = PIXEL_ARGB4444( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               color2d = PIXEL_ARGB1555( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB16:
+               color2d = PIXEL_RGB16( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB32:
+               color2d = PIXEL_RGB32( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB:
+               color2d = PIXEL_ARGB( color.a, color.r,
+                                     color.g, color.b );
+               break;
+          case DSPF_AiRGB:
+               color2d = PIXEL_AiRGB( color.a, color.r,
+                                      color.g, color.b );
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color3d = color2d = PIXEL_AYUV( color.a, y, u, v );
+               break;
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_UYVY( y, u, v );
+               R200_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_YUY2( y, u, v );
+               R200_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               color3d = color2d = rdev->y_cop;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               color2d = 0;
+               break;
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( rdrv->mmio_base, DP_BRUSH_FRGD_CLR, color2d );
+     radeon_out32( rdrv->mmio_base, R200_PP_TFACTOR_1, color3d );
+
+     RADEON_SET( COLOR );
+}
+
+void r200_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     DFBColor color   = state->color;
+     u32      color3d;
+     int      y, u, v;
+     
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+
+     if (state->blittingflags & DSBLIT_COLORIZE &&
+         state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+          color.r = color.r * color.a / 255;
+          color.g = color.g * color.a / 255;
+          color.b = color.b * color.a / 255;
+     }
+
+     switch (rdev->dst_format) {
+          case DSPF_A8:
+               color3d = (color.a << 24) | 0x00ffffff;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12: 
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               color3d = rdev->y_cop;
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color3d = PIXEL_AYUV( color.a, y, u, v );
+               break;
+          case DSPF_UYVY:
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               R200_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+          default:
+               color3d = PIXEL_ARGB( color.a, color.r,
+                                     color.g, color.b );
+               break;
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( rdrv->mmio_base, R200_PP_TFACTOR_0, color3d );
+     
+     RADEON_SET( COLOR );
+}
+
+void r200_set_src_colorkey( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     if (RADEON_IS_SET( SRC_COLORKEY ))
+          return;
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, CLR_CMP_CLR_SRC, state->src_colorkey ); 
+     radeon_out32( mmio, CLR_CMP_MASK, rdev->src_mask );    
+     
+     RADEON_SET( SRC_COLORKEY );
+}
+
+void r200_set_blend_function( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     volatile u8   *mmio   = rdrv->mmio_base;
+     u32            sblend;
+     u32            dblend;
+     
+     if (RADEON_IS_SET( SRC_BLEND ) && RADEON_IS_SET( DST_BLEND ))
+          return;
+
+     sblend = r200SrcBlend[state->src_blend-1];
+     dblend = r200DstBlend[state->dst_blend-1];
+
+     if (!DFB_PIXELFORMAT_HAS_ALPHA(rdev->dst_format)) {
+          if (sblend == SRC_BLEND_GL_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ONE;
+          else if (sblend == SRC_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ZERO;
+                    
+          if (dblend == DST_BLEND_GL_DST_ALPHA)
+               dblend = DST_BLEND_GL_ONE;
+          else if (dblend == DST_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               dblend = DST_BLEND_GL_ZERO;
+     }
+     else if (rdev->dst_format == DSPF_A8) {
+          if (sblend == SRC_BLEND_GL_DST_ALPHA)
+               sblend = SRC_BLEND_GL_DST_COLOR;
+          else if (sblend == SRC_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ONE_MINUS_DST_COLOR;
+
+          if (dblend == DST_BLEND_GL_DST_ALPHA)
+               dblend = DST_BLEND_GL_DST_COLOR;
+          else if (dblend == DST_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               dblend = DST_BLEND_GL_ONE_MINUS_DST_COLOR;
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     radeon_out32( mmio, RB3D_BLENDCNTL, sblend | dblend );
+     
+     RADEON_SET( SRC_BLEND );
+     RADEON_SET( DST_BLEND );
+}
+
+void r200_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     if (RADEON_IS_SET( RENDER_OPTIONS ))
+          return;
+          
+     if (state->render_options & DSRO_MATRIX &&
+        (!state->affine_matrix ||
+          state->matrix[0] != (1<<16) || state->matrix[1] != 0 || state->matrix[2] != 0 ||
+          state->matrix[3] != 0 || state->matrix[4] != (1<<16) || state->matrix[5] != 0)) {
+          rdev->matrix = state->matrix;
+          rdev->affine_matrix = state->affine_matrix;
+     }
+     else {
+          rdev->matrix = NULL;
+     }
+     
+     if ((rdev->render_options & DSRO_ANTIALIAS) != (state->render_options & DSRO_ANTIALIAS)) {
+          RADEON_UNSET( DRAWING_FLAGS );
+          RADEON_UNSET( BLITTING_FLAGS );
+     }     
+     rdev->render_options = state->render_options;
+     
+     RADEON_SET( RENDER_OPTIONS );
+}
+
+/* NOTES:
+ * - We use texture unit 0 for blitting functions,
+ *          texture unit 1 for drawing functions
+ * - Default blend equation is ADD_CLAMP (A * B + C)
+ */
+
+void r200_set_drawingflags( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl       |
+                                  GMC_SRC_DATATYPE_MONO_FG_LA | 
+                                  GMC_BRUSH_SOLID_COLOR       |
+                                  GMC_CLR_CMP_CNTL_DIS;
+     u32            rb3d_cntl   = rdev->rb3d_cntl & ~DITHER_ENABLE;
+     u32            pp_cntl     = TEX_BLEND_1_ENABLE;
+     u32            cblend      = R200_TXC_ARG_C_TFACTOR_COLOR;
+     
+     if (RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+
+     if (rdev->dst_422) {
+          pp_cntl |= TEX_1_ENABLE;
+          cblend   = R200_TXC_ARG_C_R1_COLOR;
+     }
+     else if (rdev->dst_format == DSPF_A8) {
+          cblend = R200_TXC_ARG_C_TFACTOR_ALPHA;
+     }
+     
+     if (state->drawingflags & DSDRAW_BLEND)
+          rb3d_cntl |= ALPHA_BLEND_ENABLE;
+     
+     if (state->drawingflags & DSDRAW_XOR) {
+          rb3d_cntl   |= ROP_ENABLE;
+          master_cntl |= GMC_ROP3_PATXOR;
+     }
+     else {
+          master_cntl |= GMC_ROP3_PATCOPY;
+     }
+     
+     if (state->render_options & DSRO_ANTIALIAS)
+          pp_cntl |= ANTI_ALIAS_LINE_POLY;
+     
+     radeon_waitfifo( rdrv, rdev, 11 );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     radeon_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM );
+     radeon_out32( mmio, RB3D_CNTL, rb3d_cntl );
+     radeon_out32( mmio, SE_CNTL, DIFFUSE_SHADE_FLAT  |
+                                  ALPHA_SHADE_FLAT    |
+                                  BFACE_SOLID         |
+                                  FFACE_SOLID         |
+                                  VTX_PIX_CENTER_OGL  |
+                                  ROUND_MODE_ROUND    |
+				              ROUND_PREC_4TH_PIX );
+     radeon_out32( mmio, PP_CNTL, pp_cntl );
+     radeon_out32( mmio, R200_PP_TXCBLEND_1, cblend );
+     radeon_out32( mmio, R200_PP_TXCBLEND2_1, (1 << R200_TXC_TFACTOR_SEL_SHIFT) |
+                                              R200_TXC_OUTPUT_REG_R0            |
+                                              R200_TXC_CLAMP_0_1 );
+     radeon_out32( mmio, R200_PP_TXABLEND_1, R200_TXA_ARG_C_TFACTOR_ALPHA );
+     radeon_out32( mmio, R200_PP_TXABLEND2_1, (1 << R200_TXA_TFACTOR_SEL_SHIFT) |
+                                              R200_TXA_OUTPUT_REG_R0            |
+                                              R200_TXA_CLAMP_0_1 );
+     radeon_out32( mmio, R200_SE_VTX_FMT_0, R200_VTX_XY );
+     radeon_out32( mmio, R200_SE_VTX_FMT_1, 0 );
+     
+     rdev->drawingflags = state->drawingflags;
+
+     RADEON_SET  ( DRAWING_FLAGS );
+     RADEON_UNSET( BLITTING_FLAGS );
+}
+
+void r200_set_blittingflags( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState        *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl |
+                                  GMC_BRUSH_NONE        |
+                                  GMC_SRC_DATATYPE_COLOR;
+     u32            cmp_cntl    = 0;
+     u32            rb3d_cntl   = rdev->rb3d_cntl;
+     u32            se_cntl     = BFACE_SOLID        |
+                                  FFACE_SOLID        |
+                                  VTX_PIX_CENTER_OGL |
+                                  ROUND_MODE_ROUND;
+     u32            pp_cntl     = TEX_0_ENABLE;
+     u32            cblend      = R200_TXC_ARG_C_R0_COLOR;
+     u32            ablend      = R200_TXA_ARG_C_R0_ALPHA;
+     u32            vtx_fmt     = R200_VTX_XY;
+     u32            vte_cntl;
+     
+     if (RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+ 
+     if (rdev->accel == DFXL_TEXTRIANGLES) {
+          se_cntl  |= DIFFUSE_SHADE_GOURAUD  |
+                      ALPHA_SHADE_GOURAUD    |
+                      SPECULAR_SHADE_GOURAUD |
+                      FLAT_SHADE_VTX_LAST    |
+                      ROUND_PREC_8TH_PIX;
+          vtx_fmt  |= R200_VTX_Z0 | R200_VTX_W0;
+          vte_cntl  = 0;
+     }
+     else {
+          se_cntl  |= DIFFUSE_SHADE_FLAT |
+                      ALPHA_SHADE_FLAT   |
+                      ROUND_PREC_4TH_PIX; 
+          vte_cntl  = R200_VTX_ST_DENORMALIZED;
+     }
+    
+     if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                 DSBLIT_BLEND_ALPHACHANNEL)) {
+          if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    ablend = R200_TXA_ARG_A_R0_ALPHA | R200_TXA_ARG_B_TFACTOR_ALPHA;
+               else
+                    ablend = R200_TXA_ARG_C_TFACTOR_ALPHA;
+
+               pp_cntl |= TEX_BLEND_0_ENABLE;
+          }
+          
+          rb3d_cntl |= ALPHA_BLEND_ENABLE;
+     }
+
+     if (rdev->dst_format != DSPF_A8) {
+          if (state->blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR)) {
+               if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA)
+                    ablend = R200_TXA_ARG_A_R0_ALPHA | R200_TXA_ARG_B_R1_ALPHA;
+               
+               if (state->blittingflags & DSBLIT_SRC_MASK_COLOR)
+                    cblend = R200_TXC_ARG_A_R0_COLOR | R200_TXC_ARG_B_R1_COLOR;
+                    
+               pp_cntl |= TEX_1_ENABLE | TEX_BLEND_0_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_COLORIZE) {
+               if (rdev->dst_422) {
+                    cblend = (rdev->src_format == DSPF_A8)
+                             ? (R200_TXC_ARG_C_R1_COLOR)
+                             : (R200_TXC_ARG_A_R0_COLOR | R200_TXC_ARG_B_R1_COLOR);
+
+                    pp_cntl |= TEX_1_ENABLE;
+               }
+               else {
+                    cblend = (rdev->src_format == DSPF_A8)
+                             ? (R200_TXC_ARG_C_TFACTOR_COLOR)
+                             : (R200_TXC_ARG_A_R0_COLOR | R200_TXC_ARG_B_TFACTOR_COLOR);
+               }
+          
+               pp_cntl |= TEX_BLEND_0_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+               cblend = (rdev->src_format == DSPF_A8)
+                        ? (R200_TXC_ARG_C_R0_ALPHA)
+                        : (R200_TXC_ARG_A_R0_COLOR | R200_TXC_ARG_B_TFACTOR_ALPHA);
+            
+               pp_cntl |= TEX_BLEND_0_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+               cblend = (rdev->src_format == DSPF_A8)
+                        ? (R200_TXC_ARG_C_R0_ALPHA)
+                        : (R200_TXC_ARG_A_R0_COLOR | R200_TXC_ARG_B_R0_ALPHA);
+            
+               pp_cntl |= TEX_BLEND_0_ENABLE;
+          }
+     } /* DSPF_A8 */
+     else {
+          if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA) {
+               ablend = R200_TXA_ARG_A_R0_ALPHA | R200_TXA_ARG_B_R1_ALPHA;
+               cblend = R200_TXC_ARG_A_R0_ALPHA | R200_TXC_ARG_B_R1_ALPHA;
+               pp_cntl |= TEX_1_ENABLE;
+          }
+          else if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+                    cblend = R200_TXC_ARG_A_R0_ALPHA | R200_TXC_ARG_B_TFACTOR_ALPHA;
+               else
+                    cblend = R200_TXC_ARG_C_TFACTOR_ALPHA;
+          }
+          else {
+               cblend = R200_TXC_ARG_C_R0_ALPHA;
+          }
+
+          pp_cntl |= TEX_BLEND_0_ENABLE;
+     }
+ 
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          cmp_cntl = SRC_CMP_EQ_COLOR | CLR_CMP_SRC_SOURCE;
+     else
+          master_cntl |= GMC_CLR_CMP_CNTL_DIS;
+
+     if (state->blittingflags & DSBLIT_XOR) {
+          master_cntl |= GMC_ROP3_XOR;
+          rb3d_cntl   |= ROP_ENABLE; 
+     } 
+     else {
+          master_cntl |= GMC_ROP3_SRCCOPY;
+     }
+     
+     if (state->render_options & DSRO_ANTIALIAS)
+          pp_cntl |= ANTI_ALIAS_POLY;
+
+     radeon_waitfifo( rdrv, rdev, 12 );
+     radeon_out32( mmio, CLR_CMP_CNTL, cmp_cntl );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     radeon_out32( mmio, RB3D_CNTL, rb3d_cntl );
+     radeon_out32( mmio, SE_CNTL, se_cntl );
+     radeon_out32( mmio, PP_CNTL, pp_cntl );
+     radeon_out32( mmio, R200_PP_TXCBLEND_0, cblend );
+     radeon_out32( mmio, R200_PP_TXCBLEND2_0, R200_TXC_OUTPUT_REG_R0 |
+                                              R200_TXC_CLAMP_0_1 );
+     radeon_out32( mmio, R200_PP_TXABLEND_0, ablend );
+     radeon_out32( mmio, R200_PP_TXABLEND2_0, R200_TXA_OUTPUT_REG_R0 |
+                                              R200_TXA_CLAMP_0_1 );
+     radeon_out32( mmio, R200_SE_VTX_FMT_0, vtx_fmt );
+     radeon_out32( mmio, R200_SE_VTX_FMT_1, 2 << R200_VTX_TEX0_COMP_CNT_SHIFT );
+     radeon_out32( mmio, R200_SE_VTE_CNTL, vte_cntl );
+     
+     rdev->blittingflags = state->blittingflags;
+     
+     RADEON_SET  ( BLITTING_FLAGS );
+     RADEON_UNSET( DRAWING_FLAGS );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/r300_3d.c b/Source/DirectFB/gfxdrivers/radeon/r300_3d.c
new file mode 100755
index 0000000..c8a1b8c
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r300_3d.c
@@ -0,0 +1,492 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <dfb_types.h>
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_state.h"
+#include "radeon_3d.h"
+
+
+#define EMIT_VERTICES( rdrv, rdev, mmio ) { \
+     u32 *_v = (rdev)->vb; \
+     u32  _s = (rdev)->vb_size; \
+     radeon_waitfifo( rdrv, rdev, 1 ); \
+     radeon_out32( mmio, SE_VF_CNTL, rdev->vb_type | VF_PRIM_WALK_DATA | \
+                                    (rdev->vb_count << VF_NUM_VERTICES_SHIFT) ); \
+     do { \
+          u32 _n = MIN(_s, 64); \
+          _s -= _n; \
+          radeon_waitfifo( rdrv, rdev, _n ); \
+          while (_n--) \
+               radeon_out32( mmio, SE_PORT_DATA0, *_v++ ); \
+     } while (_s); \
+     radeon_waitfifo( rdrv, rdev, 2 ); \
+     radeon_out32( mmio, R300_RB3D_DSTCACHE_CTLSTAT, 0xa ); \
+     radeon_out32( mmio, 0x4f18, 0x3 ); \
+}
+
+static void
+r300_flush_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+    
+     EMIT_VERTICES( rdrv, rdev, mmio );
+     
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          DFBRegion clip;
+          int       i;
+          
+          for (i = 0; i < rdev->vb_size; i += 8) {
+               rdev->vb[i+0] = f2d(d2f(rdev->vb[i+0])*0.5f);
+               rdev->vb[i+1] = f2d(d2f(rdev->vb[i+1])*0.5f);
+          }
+          
+          clip.x1 = rdev->clip.x1 >> 1;
+          clip.y1 = rdev->clip.y1 >> 1;
+          clip.x2 = rdev->clip.x2 >> 1;
+          clip.y2 = rdev->clip.y2 >> 1;
+     
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset_cb );
+          radeon_out32( mmio, R300_RB3D_COLORPITCH0, (rdev->dst_pitch>>1) | 
+                                                     R300_COLOR_FORMAT_RGB8 );
+          radeon_out32( mmio, R300_TX_SIZE_0, ((rdev->src_width/2 -1) << R300_TX_WIDTH_SHIFT)  |
+                                              ((rdev->src_height/2-1) << R300_TX_HEIGHT_SHIFT) |
+                                              R300_TX_SIZE_TXPITCH_EN );
+          radeon_out32( mmio, R300_TX_PITCH_0, (rdev->src_pitch>>1) - 8 );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset_cb ); 
+          r300_set_clip3d( rdrv, rdev, &clip );
+     
+          /* Fill Cb plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+     
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset_cr );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset_cr );
+     
+          /* Fill Cr plane */
+          EMIT_VERTICES( rdrv, rdev, mmio );
+     
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset );
+          radeon_out32( mmio, R300_RB3D_COLORPITCH0, rdev->dst_pitch | 
+                                                     R300_COLOR_FORMAT_RGB8 );
+          radeon_out32( mmio, R300_TX_SIZE_0, ((rdev->src_width -1) << R300_TX_WIDTH_SHIFT)  |
+                                              ((rdev->src_height-1) << R300_TX_HEIGHT_SHIFT) |
+                                         R300_TX_SIZE_TXPITCH_EN );
+          radeon_out32( mmio, R300_TX_PITCH_0, rdev->src_pitch - 8 );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset ); 
+          r300_set_clip3d( rdrv, rdev, &rdev->clip );
+     }
+    
+     rdev->vb_size  = 0;
+     rdev->vb_count = 0;
+}
+
+static inline u32*
+r300_init_vb( RadeonDriverData *rdrv, RadeonDeviceData *rdev, u32 type, u32 count, u32 size )
+{
+     u32 *vb;
+    
+     if ((rdev->vb_size && rdev->vb_type != type) ||
+          rdev->vb_size+size > D_ARRAY_SIZE(rdev->vb))
+          r300_flush_vb( rdrv, rdev );
+        
+     vb = &rdev->vb[rdev->vb_size];
+     rdev->vb_type   = type;
+     rdev->vb_size  += size;
+     rdev->vb_count += count;
+    
+     return vb;
+}
+
+
+#define VTX(v, x, y, c)   \
+     *(v)++ = f2d(x);     \
+     *(v)++ = f2d(y);     \
+     *(v)++ = f2d(0);     \
+     *(v)++ = f2d(1);     \
+     *(v)++ = f2d(c[0]);  \
+     *(v)++ = f2d(c[1]);  \
+     *(v)++ = f2d(c[2]);  \
+     *(v)++ = f2d(c[3])
+
+bool r300FillRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+    
+     if (rect->w == 1 && rect->h == 1) {
+          x1 = rect->x+1; y1 = rect->y+1;
+          if (rdev->matrix)
+               RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_POINT_LIST, 1, 8 );
+          VTX( v, x1, y1, rdev->color );
+
+          return true;
+     }
+
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 32 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+     }
+     else { 
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 32 );
+          VTX( v, x1, y1, rdev->color );
+          VTX( v, x2, y1, rdev->color );
+          VTX( v, x2, y2, rdev->color );
+          VTX( v, x1, y2, rdev->color );
+     }
+
+     return true;
+}
+
+bool r300FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             x3, y3;
+     u32              *v;
+
+     x1 = tri->x1; y1 = tri->y1;
+     x2 = tri->x2; y2 = tri->y2;
+     x3 = tri->x3; y3 = tri->y3;
+     if (rdev->matrix) {
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x3, y3, x3, y3, rdev->matrix, rdev->affine_matrix );
+     }
+
+     v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_TRIANGLE_LIST, 3, 24 );
+     VTX( v, x1, y1, rdev->color );
+     VTX( v, x2, y2, rdev->color );
+     VTX( v, x3, y3, rdev->color );
+     
+     return true;
+}
+
+bool r300DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+     
+     x1 = rect->x;         y1 = rect->y;
+     x2 = rect->x+rect->w; y2 = rect->y+rect->h;
+     if (rdev->matrix) {
+          float x, y;
+          
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LOOP, 4, 32 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, rdev->color );
+     }
+     else {
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LOOP, 4, 32 );
+          VTX( v, x1, y1, rdev->color );
+          VTX( v, x2, y1, rdev->color );
+          VTX( v, x2, y2, rdev->color );
+          VTX( v, x1, y2, rdev->color );
+     }
+     
+     return true;
+}
+
+bool r300DrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     u32              *v;
+
+     x1 = line->x1; y1 = line->y1;
+     x2 = line->x2; y2 = line->y2;
+     if (rdev->matrix) {
+          RADEON_TRANSFORM( x1, y1, x1, y1, rdev->matrix, rdev->affine_matrix );
+          RADEON_TRANSFORM( x2, y2, x2, y2, rdev->matrix, rdev->affine_matrix );
+     }
+     
+     v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_LINE_LIST, 2, 16 );
+     VTX( v, x1, y1, rdev->color );
+     VTX( v, x2, y2, rdev->color );
+
+     return true;
+}
+
+#undef VTX
+#define VTX( v, x, y, s, t ) \
+     *(v)++ = f2d(x);        \
+     *(v)++ = f2d(y);        \
+     *(v)++ = f2d(0);        \
+     *(v)++ = f2d(1);        \
+     *(v)++ = f2d(s);        \
+     *(v)++ = f2d(t);        \
+     *(v)++ = f2d(0);        \
+     *(v)++ = f2d(1) 
+
+bool r300Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy )
+{
+     DFBRectangle dr = { dx, dy, sr->w, sr->h };
+
+     return r300StretchBlit( drv, dev, sr, &dr );
+}
+
+bool r300StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     float             x1, y1;
+     float             x2, y2;
+     float             s1, t1;
+     float             s2, t2;
+     u32              *v;
+     
+     if (rdev->blittingflags & DSBLIT_DEINTERLACE) {
+          sr->y /= 2;
+          sr->h /= 2;
+     }
+   
+     s1 = (float)sr->x / rdev->src_width;         t1 = (float)sr->y / rdev->src_height;
+     s2 = (float)(sr->x+sr->w) / rdev->src_width; t2 = (float)(sr->y+sr->h) / rdev->src_height;
+     if (rdev->blittingflags & DSBLIT_ROTATE180) {
+          float tmp;
+          tmp = s2; s2 = s1; s1 = tmp;
+          tmp = t2; t2 = t1; t1 = tmp;
+     }
+
+     x1 = dr->x;       y1 = dr->y;
+     x2 = dr->x+dr->w; y2 = dr->y+dr->h;
+     if (rdev->matrix) {
+          float x, y;
+
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 32 );
+          RADEON_TRANSFORM( x1, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, s1, t1 );
+          RADEON_TRANSFORM( x2, y1, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, s2, t1 );
+          RADEON_TRANSFORM( x2, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, s2, t2 );
+          RADEON_TRANSFORM( x1, y2, x, y, rdev->matrix, rdev->affine_matrix );
+          VTX( v, x, y, s1, t2 );
+     }
+     else {
+          v = r300_init_vb( rdrv, rdev, VF_PRIM_TYPE_QUAD_LIST, 4, 32 );
+          VTX( v, x1, y1, s1, t1 );
+          VTX( v, x2, y1, s2, t1 );
+          VTX( v, x2, y2, s2, t2 );
+          VTX( v, x1, y2, s1, t2 );
+     }
+     
+     return true;
+}
+
+static void
+r300DoTextureTriangles( RadeonDriverData *rdrv, RadeonDeviceData *rdev,
+                        DFBVertex *ve, int num, u32 primitive )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     int          i;
+ 
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     
+     radeon_out32( mmio, SE_VF_CNTL, primitive | VF_PRIM_WALK_DATA |
+                                     (num << VF_NUM_VERTICES_SHIFT) );
+
+     for (; num >= 8; num -= 8) {
+          radeon_waitfifo( rdrv, rdev, 64 );
+          for (i = 0; i < 8; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(1) ); // FIXME 
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(0) ); // r
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(1) ); // q
+          }
+          ve += 8;
+     }
+
+     if (num > 0) {
+          radeon_waitfifo( rdrv, rdev, num*8 );
+          for (i = 0; i < num; i++) {
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].x) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].y) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].z) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(1) ); // FIXME 
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].s) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(ve[i].t) );
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(0) ); // r
+               radeon_out32( mmio, SE_PORT_DATA0, f2d(1) ); // q
+          }
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, R300_RB3D_DSTCACHE_CTLSTAT, 0xa );
+     radeon_out32( mmio, 0x4f18, 0x3 );
+}
+
+bool r300TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation )
+{ 
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     u32               prim = 0;
+     int               i;
+
+     if (num > 65535) {
+          D_WARN( "R300 supports maximum 65535 vertices" );
+          return false;
+     }
+
+     switch (formation) {
+          case DTTF_LIST:
+               prim = VF_PRIM_TYPE_TRIANGLE_LIST;
+               break;
+          case DTTF_STRIP:
+               prim = VF_PRIM_TYPE_TRIANGLE_STRIP;
+               break;
+          case DTTF_FAN:
+               prim = VF_PRIM_TYPE_TRIANGLE_FAN;
+               break;
+          default:
+               D_BUG( "unexpected triangle formation" );
+               return false;
+     }
+     
+     if (rdev->matrix) {
+          for (i = 0; i < num; i++)
+               RADEON_TRANSFORM( ve[i].x, ve[i].y, ve[i].x, ve[i].y, rdev->matrix, rdev->affine_matrix );
+     }
+     
+     r300DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+     if (DFB_PLANAR_PIXELFORMAT(rdev->dst_format)) {
+          volatile u8 *mmio = rdrv->mmio_base;
+          DFBRegion    clip;
+          int          i;
+          
+          /* Scale coordinates */
+          for (i = 0; i < num; i++) {
+               ve[i].x *= 0.5;
+               ve[i].y *= 0.5;
+          }
+          clip.x1 = rdev->clip.x1 >> 1;
+          clip.y1 = rdev->clip.y1 >> 1;
+          clip.x2 = rdev->clip.x2 >> 1;
+          clip.y2 = rdev->clip.y2 >> 1;
+          
+          /* Prepare Cb plane */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset_cb );
+          radeon_out32( mmio, R300_RB3D_COLORPITCH0, (rdev->dst_pitch>>1) | 
+                                                     R300_COLOR_FORMAT_RGB8 );
+          radeon_out32( mmio, R300_TX_SIZE_0, ((rdev->src_width/2 -1) << R300_TX_WIDTH_SHIFT)  |
+                                              ((rdev->src_height/2-1) << R300_TX_HEIGHT_SHIFT) |
+                                              R300_TX_SIZE_TXPITCH_EN );
+          radeon_out32( mmio, R300_TX_PITCH_0, (rdev->src_pitch>>1) - 8 );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset_cb ); 
+          r300_set_clip3d( rdrv, rdev, &clip );
+     
+          /* Blit Cb plane */
+          r300DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Prepare Cr plane */
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset_cr );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset_cr );
+     
+          /* Blit Cr plane */
+          r300DoTextureTriangles( rdrv, rdev, ve, num, prim );
+     
+          /* Reset */
+          radeon_waitfifo( rdrv, rdev, 5 );
+          radeon_out32( mmio, R300_RB3D_COLOROFFSET0, rdev->dst_offset );
+          radeon_out32( mmio, R300_RB3D_COLORPITCH0, rdev->dst_pitch | 
+                                                     R300_COLOR_FORMAT_RGB8 );
+          radeon_out32( mmio, R300_TX_SIZE_0, ((rdev->src_width -1) << R300_TX_WIDTH_SHIFT)  |
+                                              ((rdev->src_height-1) << R300_TX_HEIGHT_SHIFT) |
+                                              R300_TX_SIZE_TXPITCH_EN );
+          radeon_out32( mmio, R300_TX_PITCH_0, rdev->src_pitch - 8 );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset ); 
+          r300_set_clip3d( rdrv, rdev, &rdev->clip );
+     }
+     
+     return true;
+}
+
+void r300EmitCommands3D( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+
+     if (rdev->vb_count)
+          r300_flush_vb( rdrv, rdev );
+} 
diff --git a/Source/DirectFB/gfxdrivers/radeon/r300_program.h b/Source/DirectFB/gfxdrivers/radeon/r300_program.h
new file mode 100755
index 0000000..b2bc0dd
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r300_program.h
@@ -0,0 +1,151 @@
+/*
+Copyright (C) 2004 Nicolai Haehnle.  All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Nicolai Haehnle <prefect_@gmx.net>
+ */
+
+#ifndef __R300_PROGRAM_H__
+#define __R300_PROGRAM_H__
+
+#include "radeon_regs.h"
+
+/**
+ * Vertex program helper macros
+ */
+
+/* Produce out dword */
+#define VP_OUTCLASS_TMP		R300_VPI_OUT_REG_CLASS_TEMPORARY
+#define VP_OUTCLASS_OUT		R300_VPI_OUT_REG_CLASS_RESULT
+
+#define VP_OUTMASK_X	R300_VPI_OUT_WRITE_X
+#define VP_OUTMASK_Y	R300_VPI_OUT_WRITE_Y
+#define VP_OUTMASK_Z	R300_VPI_OUT_WRITE_Z
+#define VP_OUTMASK_W	R300_VPI_OUT_WRITE_W
+#define VP_OUTMASK_XY	(VP_OUTMASK_X|VP_OUTMASK_Y)
+#define VP_OUTMASK_XZ	(VP_OUTMASK_X|VP_OUTMASK_Z)
+#define VP_OUTMASK_XW	(VP_OUTMASK_X|VP_OUTMASK_W)
+#define VP_OUTMASK_XYZ	(VP_OUTMASK_XY|VP_OUTMASK_Z)
+#define VP_OUTMASK_XYW	(VP_OUTMASK_XY|VP_OUTMASK_W)
+#define VP_OUTMASK_XZW	(VP_OUTMASK_XZ|VP_OUTMASK_W)
+#define VP_OUTMASK_XYZW	(VP_OUTMASK_XYZ|VP_OUTMASK_W)
+#define VP_OUTMASK_YZ	(VP_OUTMASK_Y|VP_OUTMASK_Z)
+#define VP_OUTMASK_YW	(VP_OUTMASK_Y|VP_OUTMASK_W)
+#define VP_OUTMASK_YZW	(VP_OUTMASK_YZ|VP_OUTMASK_W)
+#define VP_OUTMASK_ZW	(VP_OUTMASK_Z|VP_OUTMASK_W)
+
+#define VP_OUT(instr,outclass,outidx,outmask) \
+	(R300_VPI_OUT_OP_##instr |				\
+	((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) |		\
+	VP_OUTCLASS_##outclass |				\
+	VP_OUTMASK_##outmask)
+
+/* Produce in dword */
+#define VP_INCLASS_TMP		R300_VPI_IN_REG_CLASS_TEMPORARY
+#define VP_INCLASS_IN		R300_VPI_IN_REG_CLASS_ATTRIBUTE
+#define VP_INCLASS_CONST	R300_VPI_IN_REG_CLASS_PARAMETER
+
+#define VP_IN(class,idx) \
+	(((idx) << R300_VPI_IN_REG_INDEX_SHIFT) |		\
+	VP_INCLASS_##class |					\
+	(R300_VPI_IN_SELECT_X << R300_VPI_IN_X_SHIFT) |		\
+	(R300_VPI_IN_SELECT_Y << R300_VPI_IN_Y_SHIFT) |		\
+	(R300_VPI_IN_SELECT_Z << R300_VPI_IN_Z_SHIFT) |		\
+	(R300_VPI_IN_SELECT_W << R300_VPI_IN_W_SHIFT))
+#define VP_ZERO() \
+	((R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_X_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Y_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Z_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_W_SHIFT))
+#define VP_ONE() \
+	((R300_VPI_IN_SELECT_ONE << R300_VPI_IN_X_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Y_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Z_SHIFT) |	\
+	(R300_VPI_IN_SELECT_ONE << R300_VPI_IN_W_SHIFT))
+
+#define VP_NEG(in,comp)		((in) ^ (R300_VPI_IN_NEG_##comp))
+#define VP_NEGALL(in,comp)	VP_NEG(VP_NEG(VP_NEG(VP_NEG((in),X),Y),Z),W)
+
+/**
+ * Fragment program helper macros
+ */
+
+/* Produce unshifted source selectors */
+#define FP_TMP(idx) (idx)
+#define FP_CONST(idx) ((idx) | (1 << 5))
+
+/* Produce source/dest selector dword */
+#define FP_SELC_MASK_NO		0
+#define FP_SELC_MASK_X		1
+#define FP_SELC_MASK_Y		2
+#define FP_SELC_MASK_XY		3
+#define FP_SELC_MASK_Z		4
+#define FP_SELC_MASK_XZ		5
+#define FP_SELC_MASK_YZ		6
+#define FP_SELC_MASK_XYZ	7
+
+#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \
+	(((destidx) << R300_FPI1_DSTC_SHIFT) |		\
+	 (FP_SELC_MASK_##regmask << 23) |		\
+	 (FP_SELC_MASK_##outmask << 26) |		\
+	 ((src0) << R300_FPI1_SRC0C_SHIFT) |		\
+	 ((src1) << R300_FPI1_SRC1C_SHIFT) |		\
+	 ((src2) << R300_FPI1_SRC2C_SHIFT))
+
+#define FP_SELA_MASK_NO		0
+#define FP_SELA_MASK_W		1
+
+#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \
+	(((destidx) << R300_FPI3_DSTA_SHIFT) |		\
+	 (FP_SELA_MASK_##regmask << 23) |		\
+	 (FP_SELA_MASK_##outmask << 24) |		\
+	 ((src0) << R300_FPI3_SRC0A_SHIFT) |		\
+	 ((src1) << R300_FPI3_SRC1A_SHIFT) |		\
+	 ((src2) << R300_FPI3_SRC2A_SHIFT))
+
+/* Produce unshifted argument selectors */
+#define FP_ARGC(source)	R300_FPI0_ARGC_##source
+#define FP_ARGA(source) R300_FPI2_ARGA_##source
+#define FP_ABS(arg) ((arg) | (1 << 6))
+#define FP_NEG(arg) ((arg) ^ (1 << 5))
+
+/* Produce instruction dword */
+#define FP_INSTRC(opcode,arg0,arg1,arg2) \
+	(R300_FPI0_OUTC_##opcode | 		\
+	((arg0) << R300_FPI0_ARG0C_SHIFT) |	\
+	((arg1) << R300_FPI0_ARG1C_SHIFT) |	\
+	((arg2) << R300_FPI0_ARG2C_SHIFT))
+
+#define FP_INSTRA(opcode,arg0,arg1,arg2) \
+	(R300_FPI2_OUTA_##opcode | 		\
+	((arg0) << R300_FPI2_ARG0A_SHIFT) |	\
+	((arg1) << R300_FPI2_ARG1A_SHIFT) |	\
+	((arg2) << R300_FPI2_ARG2A_SHIFT))
+
+
+#include "vertex_shader.h"
+	
+#endif /* __R300_PROGRAM_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/r300_state.c b/Source/DirectFB/gfxdrivers/radeon/r300_state.c
new file mode 100755
index 0000000..97bfd6a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/r300_state.c
@@ -0,0 +1,1103 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_state.h"
+
+#include "r300_program.h"
+
+
+#define R300_HAS_3DREGS()  (rdrv->mmio_size > 0x4000)
+
+
+static const u32 r300SrcBlend[] = {
+     SRC_BLEND_GL_ZERO,                 // DSBF_ZERO
+     SRC_BLEND_GL_ONE,                  // DSBF_ONE
+     SRC_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     SRC_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     SRC_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     SRC_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     SRC_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     SRC_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     SRC_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     SRC_BLEND_GL_SRC_ALPHA_SATURATE    // DSBF_SRCALPHASAT
+};
+
+static const u32 r300DstBlend[] = {
+     DST_BLEND_GL_ZERO,                 // DSBF_ZERO
+     DST_BLEND_GL_ONE,                  // DSBF_ONE
+     DST_BLEND_GL_SRC_COLOR,            // DSBF_SRCCOLOR
+     DST_BLEND_GL_ONE_MINUS_SRC_COLOR,  // DSBF_INVSRCCOLOR
+     DST_BLEND_GL_SRC_ALPHA,            // DSBF_SRCALPHA
+     DST_BLEND_GL_ONE_MINUS_SRC_ALPHA,  // DSBF_INVSRCALPHA
+     DST_BLEND_GL_DST_ALPHA,            // DSBF_DSTALPHA
+     DST_BLEND_GL_ONE_MINUS_DST_ALPHA,  // DSBF_INVDSTALPHA
+     DST_BLEND_GL_DST_COLOR,            // DSBF_DSTCOLOR
+     DST_BLEND_GL_ONE_MINUS_DST_COLOR,  // DSBF_INVDSTCOLOR
+     DST_BLEND_GL_ZERO                  // DSBF_SRCALPHASAT
+};
+
+
+void r300_restore( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     const u32    rs_magic[8] = { 0x00, 0x44, 0x84, 0xc4,
+                                  0x04, 0x04, 0x04, 0x04 };
+     volatile u8 *mmio = rdrv->mmio_base;
+     int          i;
+     
+     /* enable caches */
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( mmio, RB2D_DSTCACHE_MODE, RB2D_DC_2D_CACHE_AUTOFLUSH |
+                                             R300_RB2D_DC_ENABLE );
+    
+     if (!R300_HAS_3DREGS())
+          return;
+    
+     /* restore 3d engine state */
+     radeon_waitfifo( rdrv, rdev, 50 );
+     radeon_out32( mmio, 0x2080, 0x0030045a );
+     radeon_out32( mmio, R300_SE_VTE_CNTL, R300_VTX_W0_FMT );
+     radeon_out32( mmio, R300_SE_VTE_CNTL+4, 0x00000008 );
+     radeon_out32( mmio, 0x2134, 0x00FFFFFF );
+     radeon_out32( mmio, 0x2138, 0x00000000 );
+#ifdef WORDS_BIGENDIAN
+     radeon_out32( mmio, 0x2140, 0x00000002 );
+#else
+     radeon_out32( mmio, 0x2140, 0x00000000 );
+#endif
+     radeon_out32( mmio, 0x21dc, 0xaaaaaaaa );
+     radeon_out32( mmio, 0x2220, f2d(1.0) );
+     radeon_out32( mmio, 0x2224, f2d(1.0) );
+     radeon_out32( mmio, 0x2228, f2d(1.0) );
+     radeon_out32( mmio, 0x222c, f2d(1.0) );
+     if (rdev->chipset >= CHIP_RV350)
+          radeon_out32( mmio, R300_VAP_UNKNOWN_2288, R300_2288_RV350 );
+     else
+          radeon_out32( mmio, R300_VAP_UNKNOWN_2288, R300_2288_R300 );
+     radeon_out32( mmio, R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
+                                         R300_GB_LINE_STUFF_ENABLE  |
+                                         R300_GB_TRIANGLE_STUFF_ENABLE );
+     radeon_out32( mmio, R300_GB_MSPOS0, 0x66666666 );
+     radeon_out32( mmio, R300_GB_MSPOS1, 0x06666666 );
+     if (rdev->chipset == CHIP_R300 || rdev->chipset == CHIP_R350 || rdev->chipset == CHIP_RV410) {
+          radeon_out32( mmio, R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE          |
+                                                   R300_GB_TILE_PIPE_COUNT_R300 |
+                                                   R300_GB_TILE_SIZE_16 );
+     }
+     else if (rdev->chipset == CHIP_R420) {
+          radeon_out32( mmio, R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE          |
+                                                   R300_GB_TILE_PIPE_COUNT_R420 |
+                                                   R300_GB_TILE_SIZE_16 );
+     }
+     else {
+          radeon_out32( mmio, R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE           |
+                                                   R300_GB_TILE_PIPE_COUNT_RV300 |
+                                                   R300_GB_TILE_SIZE_16 );
+     }
+     radeon_out32( mmio, R300_GB_SELECT, 0 );
+     radeon_out32( mmio, R300_GB_AA_CONFIG, 0 );
+     radeon_out32( mmio, 0x4200, f2d(0.0) );
+     radeon_out32( mmio, 0x4204, f2d(0.0) );
+     radeon_out32( mmio, 0x4208, f2d(1.0) );
+     radeon_out32( mmio, 0x420c, f2d(1.0) );
+     radeon_out32( mmio, 0x4214, 0x00050005 );
+     radeon_out32( mmio, R300_RE_POINTSIZE, (6 << R300_POINTSIZE_X_SHIFT) |
+                                            (6 << R300_POINTSIZE_Y_SHIFT) );
+     radeon_out32( mmio, 0x4230, 0x18000006 );
+     radeon_out32( mmio, R300_RE_LINE_CNT, (6 << R300_LINESIZE_SHIFT) |
+                                            R300_LINE_CNT_VE );
+     radeon_out32( mmio, R300_RE_UNK4238, f2d(1.0/192.0) );
+     radeon_out32( mmio, 0x4260, 0x00000000 );
+     radeon_out32( mmio, 0x4264, f2d(0.0) );
+     radeon_out32( mmio, 0x4268, f2d(1.0) );
+     radeon_out32( mmio, 0x4274, 0x00000002 );
+     radeon_out32( mmio, 0x427c, 0x00000000 );
+     radeon_out32( mmio, 0x4280, 0x00000000 );
+     radeon_out32( mmio, R300_RE_POLYGON_MODE, 0 );
+     radeon_out32( mmio, 0x428c, 0x00000001 );
+     radeon_out32( mmio, 0x4290, 0x00000000 );
+     radeon_out32( mmio, 0x4294, 0x00000000 );
+     radeon_out32( mmio, 0x4298, 0x00000000 );
+     radeon_out32( mmio, 0x42a0, 0x00000000 );
+     radeon_out32( mmio, R300_RE_ZBIAS_T_FACTOR, 0 );
+     radeon_out32( mmio, R300_RE_ZBIAS_T_CONSTANT, 0 );
+     radeon_out32( mmio, R300_RE_ZBIAS_W_FACTOR, 0 );
+     radeon_out32( mmio, R300_RE_ZBIAS_W_CONSTANT, 0 );
+     radeon_out32( mmio, R300_RE_OCCLUSION_CNTL, 0 );
+     radeon_out32( mmio, R300_RE_CULL_CNTL, 0 );
+     radeon_out32( mmio, 0x42c0, 0x4b7fffff );
+     radeon_out32( mmio, 0x42c4, 0x00000000 ); 
+
+     radeon_waitfifo( rdrv, rdev, 16 );
+     for (i = 0; i < 8; i++) {
+          radeon_out32( mmio, R300_RS_INTERP_0+i*4, R300_RS_INTERP_USED | rs_magic[i] );
+          //radeon_out32( mmio, R300_RS_ROUTE_0+i*4, 0 );
+     }
+     
+     radeon_waitfifo( rdrv, rdev, 43 );
+     radeon_out32( mmio, 0x43a4, 0x0000001c );
+     radeon_out32( mmio, 0x43a8, 0x2da49525 );
+     radeon_out32( mmio, 0x43e8, 0x00ffffff );
+     radeon_out32( mmio, 0x46a4, 0x00001b01 );
+     radeon_out32( mmio, 0x46a8, 0x00001b0f );
+     radeon_out32( mmio, 0x46ac, 0x00001b0f );
+     radeon_out32( mmio, 0x46b0, 0x00001b0f );
+     radeon_out32( mmio, 0x46b4, 0x00000001 );
+     radeon_out32( mmio, 0x4bc0, 0x00000000 );
+     radeon_out32( mmio, 0x4bc8, 0x00000000 );
+     radeon_out32( mmio, 0x4bcc, 0x00000000 );
+     radeon_out32( mmio, 0x4bd0, 0x00000000 );
+     radeon_out32( mmio, R300_PP_ALPHA_TEST, R300_ALPHA_TEST_PASS );
+     radeon_out32( mmio, 0x4bd8, 0x00000000 );
+     radeon_out32( mmio, 0x4e00, 0x00000000 );
+     radeon_out32( mmio, R300_RB3D_COLORMASK, R300_COLORMASK0_B | 
+                                              R300_COLORMASK0_G |
+                                              R300_COLORMASK0_R |
+                                              R300_COLORMASK0_A );
+     radeon_out32( mmio, R300_RB3D_BLENDCOLOR, 0xffffffff );
+     radeon_out32( mmio, 0x4e14, 0x00000000 );
+     radeon_out32( mmio, 0x4e18, 0x00000000 );
+     radeon_out32( mmio, 0x4e50, 0x00000000 );
+     radeon_out32( mmio, 0x4e54, 0x00000000 );
+     radeon_out32( mmio, 0x4e58, 0x00000000 );
+     radeon_out32( mmio, 0x4e5c, 0x00000000 );
+     radeon_out32( mmio, 0x4e60, 0x00000000 );
+     radeon_out32( mmio, 0x4e64, 0x00000000 );
+     radeon_out32( mmio, 0x4e68, 0x00000000 );
+     radeon_out32( mmio, 0x4e6c, 0x00000000 );
+     radeon_out32( mmio, 0x4e70, 0x00000000 );
+     radeon_out32( mmio, 0x4e88, 0x00000000 );
+     radeon_out32( mmio, 0x4ea0, 0x00000000 );
+     radeon_out32( mmio, 0x4ea4, 0xffffffff );  
+     radeon_out32( mmio, R300_RB3D_ZSTENCIL_CNTL_0, R300_RB3D_Z_DISABLED_1 );
+     radeon_out32( mmio, R300_RB3D_ZSTENCIL_CNTL_1, R300_ZS_ALWAYS );
+     radeon_out32( mmio, R300_RB3D_ZSTENCIL_CNTL_2, 0xffffff00 );
+     radeon_out32( mmio, R300_RB3D_ZSTENCIL_FORMAT, R300_DEPTH_FORMAT_16BIT_INT_Z );
+     radeon_out32( mmio, 0x4f14, 0x00000000 );
+     radeon_out32( mmio, 0x4f18, 0x00000003 );
+     radeon_out32( mmio, 0x4f1c, 0x00000000 );
+     radeon_out32( mmio, 0x4f28, 0x00000000 );
+     radeon_out32( mmio, 0x4f30, 0x00000000 );
+     radeon_out32( mmio, 0x4f34, 0x00000000 );
+     radeon_out32( mmio, 0x4f44, 0x00000000 );
+     radeon_out32( mmio, 0x4f54, 0x00000000 );
+                             
+     /* upload vertex program */ 
+     radeon_waitfifo( rdrv, rdev, 50 );
+     radeon_out32( mmio, R300_VAP_PVS_CNTL_1,
+                        (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
+                        (4 << R300_PVS_CNTL_1_POS_END_SHIFT)       |
+                        (4 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT) );
+     radeon_out32( mmio, R300_VAP_PVS_CNTL_2, 
+                        (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
+                        (4 << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT) );
+     radeon_out32( mmio, R300_VAP_PVS_CNTL_3, 
+                        (4 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) |
+                        (4 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT) );
+     radeon_out32( mmio, R300_VAP_PVS_WAITIDLE, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_ADDRESS, R300_PVS_UPLOAD_POINTSIZE );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, f2d(1.0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_WAITIDLE, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_ADDRESS, R300_PVS_UPLOAD_PROGRAM );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_OP(MAD, 0, ALL, TMP) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_ATTR_X(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_PARAM(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_SOURCE(0, ZERO, ZERO, ZERO, ZERO, PARAM, NONE) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_OP(MAD, 0, ALL, TMP) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_ATTR_Y(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_PARAM(1) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_TMP(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_OP(MAD, 0, ALL, TMP) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_ATTR_Z(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_PARAM(2) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_TMP(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_OP(MAD, 0, ALL, RESULT) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_ATTR_W(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_PARAM(3) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_TMP(0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_OP(ADD, 1, ALL, RESULT) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, VSF_REG(1) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_SOURCE(1, ZERO, ZERO, ZERO, ZERO, ATTR, NONE) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, EASY_VSF_SOURCE(1, ZERO, ZERO, ZERO, ZERO, ATTR, NONE) );
+     radeon_out32( mmio, R300_VAP_PVS_WAITIDLE, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_ADDRESS, R300_PVS_UPLOAD_PARAMETERS );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, f2d(1.0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, f2d(1.0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, f2d(1.0) );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, 0 );
+     radeon_out32( mmio, R300_VAP_PVS_UPLOAD_DATA, f2d(1.0) );
+     
+#if 0  
+     /* set YUV422 color buffer */
+     radeon_waitfifo( rdrv, rdev, 4 );
+     radeon_out32( mmio, R300_TX_FILTER_1, R300_TX_MAG_FILTER_NEAREST |
+                                           R300_TX_MIN_FILTER_NEAREST );
+     radeon_out32( mmio, R300_TX_FILTER1_0, 0 );
+     radeon_out32( mmio, R300_TX_SIZE_1, (1 << R300_TX_WIDTHMASK_SHIFT) |
+                                         (1 << R300_TX_HEIGHTMASK_SHIFT) );
+     radeon_out32( mmio, R300_TX_FORMAT_1, R300_TXFORMAT_VYUY422 );
+#endif
+} 
+
+void r300_set_destination( RadeonDriverData *rdrv,
+                           RadeonDeviceData *rdev,
+                           CardState        *state )
+{
+     CoreSurface       *surface = state->destination;
+     CoreSurfaceBuffer *buffer  = state->dst.buffer;
+     volatile u8       *mmio    = rdrv->mmio_base;
+     u32                offset;
+     u32                pitch;
+     u32                format  = 0;
+     bool               dst_422 = false;
+    
+     if (RADEON_IS_SET( DESTINATION ))
+          return;
+     
+     D_ASSERT( (state->dst.offset % 32) == 0 );
+     D_ASSERT( (state->dst.pitch % 64) == 0 );
+
+     offset = radeon_buffer_offset( rdev, &state->dst );
+     pitch  = state->dst.pitch;
+     
+     if (rdev->dst_offset != offset        ||
+         rdev->dst_pitch  != pitch         ||
+         rdev->dst_format != buffer->format)
+     {         
+          switch (buffer->format) {
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_A8: 
+               case DSPF_RGB332:
+                    format = R300_COLOR_FORMAT_RGB8;
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    break;
+               case DSPF_ARGB2554:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    break;
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    break;
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:          
+                    rdev->gui_master_cntl = GMC_DST_15BPP;
+                    break;
+               case DSPF_RGB16: 
+                    format = R300_COLOR_FORMAT_RGB565;
+                    rdev->gui_master_cntl = GMC_DST_16BPP;
+                    break;
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_AiRGB:
+               case DSPF_AYUV: 
+                    format = R300_COLOR_FORMAT_ARGB8888;
+                    rdev->gui_master_cntl = GMC_DST_32BPP;
+                    break;
+               case DSPF_UYVY:
+                    rdev->gui_master_cntl = GMC_DST_YVYU;
+                    dst_422 = true;
+                    break;
+               case DSPF_YUY2:
+                    rdev->gui_master_cntl = GMC_DST_VYUY;
+                    dst_422 = true;
+                    break;
+               case DSPF_I420:
+                    format = R300_COLOR_FORMAT_RGB8;
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->dst_offset_cb = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cr = rdev->dst_offset_cb + 
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               case DSPF_YV12:
+                    format = R300_COLOR_FORMAT_RGB8;
+                    rdev->gui_master_cntl = GMC_DST_8BPP;
+                    rdev->dst_offset_cr = offset + pitch * surface->config.size.h;
+                    rdev->dst_offset_cb = rdev->dst_offset_cr +
+                                          pitch/2 * surface->config.size.h/2;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    break;
+          }
+
+          rdev->gui_master_cntl |= GMC_DP_SRC_SOURCE_MEMORY  |
+                                   GMC_WR_MSK_DIS            |
+                                   GMC_SRC_PITCH_OFFSET_CNTL |
+                                   GMC_DST_PITCH_OFFSET_CNTL |
+                                   GMC_DST_CLIPPING;
+          
+          radeon_waitfifo( rdrv, rdev, 2 ); 
+          radeon_out32( mmio, DST_OFFSET, offset );
+          radeon_out32( mmio, DST_PITCH,  pitch );
+         
+          if (R300_HAS_3DREGS() && format) {
+               radeon_waitfifo( rdrv, rdev, 2 );
+               radeon_out32( mmio, R300_RB3D_COLOROFFSET0, offset );
+               radeon_out32( mmio, R300_RB3D_COLORPITCH0, 
+                           ((pitch / DFB_BYTES_PER_PIXEL(buffer->format))
+                                   & R300_COLORPITCH_MASK) | format );
+          }
+          
+          if (rdev->dst_format != buffer->format) {
+               if (dst_422 && !rdev->dst_422) {
+                    RADEON_UNSET( CLIP );
+                    RADEON_UNSET( SOURCE );
+                    rdev->src_format = DSPF_UNKNOWN;
+               }
+               
+               RADEON_UNSET( COLOR );
+               RADEON_UNSET( DST_BLEND );
+          }
+          
+          rdev->dst_format = buffer->format;
+          rdev->dst_offset = offset;
+          rdev->dst_pitch  = pitch;
+          rdev->dst_422    = dst_422;
+     }
+
+     RADEON_SET( DESTINATION );
+}
+
+void r300_set_source( RadeonDriverData *rdrv,
+                      RadeonDeviceData *rdev,
+                      CardState        *state )
+{
+     CoreSurface       *surface  = state->source;
+     CoreSurfaceBuffer *buffer   = state->src.buffer;
+     volatile u8       *mmio     = rdrv->mmio_base;
+     u32                txformat = 0;
+     u32                txfilter = (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_S_SHIFT) |
+                                   (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_T_SHIFT) |
+                                   (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_Q_SHIFT) |
+                                    R300_TX_MAG_FILTER_LINEAR                      |
+                                    R300_TX_MIN_FILTER_LINEAR;
+
+     if (RADEON_IS_SET( SOURCE )) {
+          if ((state->blittingflags & DSBLIT_DEINTERLACE) ==
+              (rdev->blittingflags  & DSBLIT_DEINTERLACE))
+               return;
+     }
+
+     D_ASSERT( (state->src.offset % 32) == 0 );
+     D_ASSERT( (state->src.pitch % 64) == 0 );
+     
+     rdev->src_offset = radeon_buffer_offset( rdev, &state->src );
+     rdev->src_pitch  = state->src.pitch;
+     rdev->src_width  = surface->config.size.w;
+     rdev->src_height = surface->config.size.h;
+
+     switch (buffer->format) {
+          case DSPF_LUT8:
+               txformat  = R300_TXFORMAT_I8;
+               txfilter &= ~(R300_TX_MAG_FILTER_LINEAR |
+                             R300_TX_MIN_FILTER_LINEAR);
+               txfilter |= R300_TX_MAG_FILTER_NEAREST |
+                           R300_TX_MIN_FILTER_NEAREST;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ALUT44:
+               txformat  = R300_TXFORMAT_I8;
+               txfilter &= ~(R300_TX_MAG_FILTER_LINEAR |
+                             R300_TX_MIN_FILTER_LINEAR);
+               txfilter |= R300_TX_MAG_FILTER_NEAREST |
+                           R300_TX_MIN_FILTER_NEAREST;
+               rdev->src_mask = 0x0000000f;
+               break;
+          case DSPF_A8:
+               txformat = R300_TXFORMAT_A8;
+               rdev->src_mask = 0;
+               break;
+          case DSPF_RGB332:
+               txformat = R300_TXFORMAT_RGB332;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_ARGB2554:
+               txformat = R300_TXFORMAT_RGB565;
+               txfilter &= ~(R300_TX_MAG_FILTER_LINEAR |
+                             R300_TX_MIN_FILTER_LINEAR);
+               txfilter |= R300_TX_MAG_FILTER_NEAREST |
+                           R300_TX_MIN_FILTER_NEAREST;
+               rdev->src_mask = 0x00003fff;
+               break;
+          case DSPF_RGB444:
+               txformat = R300_TXFORMAT_RGB444;
+               rdev->src_mask = 0x00000fff;
+               break;  
+          case DSPF_ARGB4444:
+               txformat = R300_TXFORMAT_ARGB4444;
+               rdev->src_mask = 0x00000fff;
+               break;
+          case DSPF_RGB555:
+               txformat = R300_TXFORMAT_RGB555;
+               rdev->src_mask = 0x00007fff;
+               break;
+          case DSPF_ARGB1555:
+               txformat = R300_TXFORMAT_ARGB1555;
+               rdev->src_mask = 0x00007fff;
+               break;
+          case DSPF_RGB16:
+               txformat = R300_TXFORMAT_RGB565;
+               rdev->src_mask = 0x0000ffff;
+               break;
+          case DSPF_RGB32:
+               txformat = R300_TXFORMAT_XRGB8888;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_AYUV:
+               txformat = R300_TXFORMAT_ARGB8888;
+               rdev->src_mask = 0x00ffffff;
+               break;
+          case DSPF_UYVY:
+               txformat = R300_TXFORMAT_YVYU422;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_YUY2:
+               txformat = R300_TXFORMAT_VYUY422;
+               rdev->src_mask = 0xffffffff;
+               break;
+          case DSPF_I420:
+               txformat = R300_TXFORMAT_I8;
+               rdev->src_offset_cb = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cr = rdev->src_offset_cb +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          case DSPF_YV12:
+               txformat = R300_TXFORMAT_I8;
+               rdev->src_offset_cr = rdev->src_offset +
+                                     rdev->src_pitch * rdev->src_height;
+               rdev->src_offset_cb = rdev->src_offset_cr +
+                                     rdev->src_pitch/2 * rdev->src_height/2;
+               rdev->src_mask = 0x000000ff;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               break;
+     }
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) { 
+          rdev->src_height /= 2;
+          if (surface->config.caps & DSCAPS_SEPARATED) {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_height * rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_height * rdev->src_pitch/4;
+                    rdev->src_offset_cb += rdev->src_height * rdev->src_pitch/4;
+               }
+          } else {
+               if (surface->field) {
+                    rdev->src_offset    += rdev->src_pitch;
+                    rdev->src_offset_cr += rdev->src_pitch/2;
+                    rdev->src_offset_cb += rdev->src_pitch/2;
+               }
+               rdev->src_pitch *= 2;
+          }
+     }
+ 
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset );
+     radeon_out32( mmio, SRC_PITCH,  rdev->src_pitch );
+     
+     if (R300_HAS_3DREGS()) {
+          radeon_waitfifo( rdrv, rdev, 6 );
+          radeon_out32( mmio, R300_TX_CNTL, 0 );
+          radeon_out32( mmio, R300_TX_FILTER_0, txfilter );
+          radeon_out32( mmio, R300_TX_FORMAT_0, txformat );
+          radeon_out32( mmio, R300_TX_SIZE_0, ((rdev->src_width -1) << R300_TX_WIDTH_SHIFT)  |
+                                              ((rdev->src_height-1) << R300_TX_HEIGHT_SHIFT) |
+                                              R300_TX_SIZE_TXPITCH_EN );
+          radeon_out32( mmio, R300_TX_PITCH_0, rdev->src_pitch / 
+                                               DFB_BYTES_PER_PIXEL(buffer->format) - 8 );
+          radeon_out32( mmio, R300_TX_OFFSET_0, rdev->src_offset ); 
+     }
+
+     if (rdev->src_format != buffer->format)
+          RADEON_UNSET( BLITTING_FLAGS );
+     rdev->src_format = buffer->format;
+
+     RADEON_SET( SOURCE );
+}
+
+void r300_set_clip3d( RadeonDriverData *rdrv,
+                      RadeonDeviceData *rdev,
+                      const DFBRegion  *clip )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     int          x1, y1, x2, y2;
+     
+     x1 = clip->x1 + R300_CLIPRECT_OFFSET;
+     y1 = clip->y1 + R300_CLIPRECT_OFFSET;
+     x2 = clip->x2 + R300_CLIPRECT_OFFSET;
+     y2 = clip->y2 + R300_CLIPRECT_OFFSET;
+          
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, R300_RE_CLIPRECT_TL_0, 
+                  ((y1 << R300_CLIPRECT_Y_SHIFT) & R300_CLIPRECT_Y_MASK) |
+                  ((x1 << R300_CLIPRECT_X_SHIFT) & R300_CLIPRECT_X_MASK) );
+     radeon_out32( mmio, R300_RE_CLIPRECT_BR_0, 
+                  ((y2 << R300_CLIPRECT_Y_SHIFT) & R300_CLIPRECT_Y_MASK) |
+                  ((x2 << R300_CLIPRECT_X_SHIFT) & R300_CLIPRECT_X_MASK) );
+     radeon_out32( mmio, R300_RE_CLIPRECT_CNTL, 0x0000aaaa );
+     radeon_out32( mmio, R300_RE_SCISSORS_TL,
+                  ((y1 << R300_SCISSORS_Y_SHIFT) & R300_SCISSORS_Y_MASK) |
+                  ((x1 << R300_SCISSORS_X_SHIFT) & R300_SCISSORS_X_MASK) );
+     radeon_out32( mmio, R300_RE_SCISSORS_BR,
+                  ((y2 << R300_SCISSORS_Y_SHIFT) & R300_SCISSORS_Y_MASK) |
+                  ((x2 << R300_SCISSORS_X_SHIFT) & R300_SCISSORS_X_MASK) );
+}     
+
+void r300_set_clip( RadeonDriverData *rdrv,
+                    RadeonDeviceData *rdev,
+                    CardState        *state )
+{
+     DFBRegion   *clip = &state->clip;
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     if (RADEON_IS_SET( CLIP ))
+          return;
+  
+     /* 2d clip */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     if (rdev->dst_422) {
+          radeon_out32( mmio, SC_TOP_LEFT,
+                      (clip->y1 << 16) | (clip->x1/2 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1)/2 & 0xffff) );
+     } else {     
+          radeon_out32( mmio, SC_TOP_LEFT, 
+                      (clip->y1 << 16) | (clip->x1 & 0xffff) );
+          radeon_out32( mmio, SC_BOTTOM_RIGHT,
+                      ((clip->y2+1) << 16) | ((clip->x2+1) & 0xffff) );
+     }
+
+     /* 3d clip */
+     if (R300_HAS_3DREGS())
+          r300_set_clip3d( rdrv, rdev, clip );
+
+     rdev->clip = state->clip;
+     
+     RADEON_SET( CLIP );
+}
+
+#define R300_SET_YUV422_COLOR( rdrv, rdev, y, u, v ) \
+     if (R300_HAS_3DREGS()) { \
+          radeon_out32( (rdrv)->fb_base, \
+                        (rdev)->yuv422_buffer, PIXEL_YUY2( y, u, v ) ); \
+          radeon_in8( (rdrv)->fb_base, (rdev)->yuv422_buffer ); \
+          radeon_waitfifo( rdrv, rdev, 1 ); \
+          radeon_out32( (rdrv)->mmio_base, R300_TX_OFFSET_1, \
+                        ((rdev)->fb_offset + (rdev)->yuv422_buffer) ); \
+     }
+
+void r300_set_drawing_color( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState        *state )
+{
+     DFBColor color   = state->color;
+     int      index   = state->color_index;
+     u32      color2d;
+     int      y, u, v;
+
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+
+     if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+          color.r = ((long) color.r * color.a / 255L);
+          color.g = ((long) color.g * color.a / 255L);
+          color.b = ((long) color.b * color.a / 255L);
+     }
+ 
+     switch (rdev->dst_format) {
+          case DSPF_ALUT44:
+               index |= (color.a & 0xf0);
+          case DSPF_LUT8:
+               color2d = index;
+               break;
+          case DSPF_A8:
+               color2d = color.a;
+               break;
+          case DSPF_RGB332:
+               color2d = PIXEL_RGB332( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB2554:
+               color2d = PIXEL_ARGB2554( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               color2d = PIXEL_ARGB4444( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               color2d = PIXEL_ARGB1555( color.a, color.r,
+                                         color.g, color.b );
+               break;
+          case DSPF_RGB16:
+               color2d = PIXEL_RGB16( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB32:
+               color2d = PIXEL_RGB32( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB:
+               color2d = PIXEL_ARGB( color.a, color.r,
+                                     color.g, color.b );
+               break;
+          case DSPF_AiRGB:
+               color2d = PIXEL_AiRGB( color.a, color.r,
+                                      color.g, color.b );
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_AYUV( color.a, y, u, v );
+               break;
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_UYVY( y, u, v );
+               //R300_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color2d = PIXEL_YUY2( y, u, v );
+               //R300_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               color2d = rdev->y_cop;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               color2d = 0;
+               break;
+     }
+     
+     rdev->color[0] = (float)color.r/255.0;
+     rdev->color[1] = (float)color.g/255.0;
+     rdev->color[2] = (float)color.b/255.0;
+     rdev->color[3] = (float)color.a/255.0;
+     
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( rdrv->mmio_base, DP_BRUSH_FRGD_CLR, color2d ); 
+
+     RADEON_SET( COLOR );
+}
+
+void r300_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     DFBColor color = state->color;
+     int      y, u, v;
+     
+     if (RADEON_IS_SET( COLOR ) && RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+
+     switch (rdev->dst_format) {
+          case DSPF_A8:
+               color.r = color.g = color.b = 0xff;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12: 
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               rdev->y_cop  = PIXEL_ARGB( color.a, y, y, y );
+               rdev->cb_cop = PIXEL_ARGB( color.a, u, u, u );
+               rdev->cr_cop = PIXEL_ARGB( color.a, v, v, v );
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               color.r = y;
+               color.g = u;
+               color.b = v;
+               break;
+          case DSPF_UYVY:
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b, y, u, v );
+               //R300_SET_YUV422_COLOR( rdrv, rdev, y, u, v );
+          default:
+               break;
+     }
+     
+     /*rdev->color[0] = (float)color.r/255.0;
+     rdev->color[1] = (float)color.g/255.0;
+     rdev->color[2] = (float)color.b/255.0;
+     rdev->color[3] = (float)color.a/255.0;*/
+
+     if (R300_HAS_3DREGS()) {
+          u32 argb;
+
+          argb = (state->blittingflags & DSBLIT_BLEND_COLORALPHA) ? (color.a << 24) : 0xff000000;
+          if (state->blittingflags & DSBLIT_COLORIZE &&
+              state->blittingflags & (DSBLIT_SRC_PREMULTCOLOR | DSBLIT_BLEND_COLORALPHA)) {
+               argb |= PIXEL_RGB32( (long)color.r * color.a / 255L,
+                                    (long)color.g * color.a / 255L,
+                                    (long)color.b * color.a / 255L );
+          }
+          else {
+               argb |= (state->blittingflags & DSBLIT_COLORIZE)
+                       ? PIXEL_RGB32( color.r, color.g, color.b )
+                       : PIXEL_RGB32( color.a, color.a, color.a );
+          }
+
+          radeon_waitfifo( rdrv, rdev, 1 );
+          radeon_out32( rdrv->mmio_base, R300_RB3D_BLENDCOLOR, argb );
+     }     
+     
+     RADEON_SET( COLOR );
+}
+
+void r300_set_src_colorkey( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     u32          key  = state->src_colorkey;
+     
+     if (RADEON_IS_SET( SRC_COLORKEY ))
+          return;
+     
+     switch (rdev->src_format) {
+          case DSPF_ARGB4444:
+               key |= 0xf000;
+               break;
+          case DSPF_ARGB2554:
+               key |= 0xc000;
+               break;
+          case DSPF_ARGB1555:
+               key |= 0x8000;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AYUV:
+               key |= 0xff000000;
+               break;
+          default:
+               break;
+     }
+    
+     radeon_waitfifo( rdrv, rdev, 3 );
+     radeon_out32( mmio, CLR_CMP_CLR_SRC, key );
+     /* XXX: R300 seems to ignore CLR_CMP_MASK. */
+     radeon_out32( mmio, CLR_CMP_MASK, rdev->src_mask );
+     if (R300_HAS_3DREGS())
+          radeon_out32( mmio, R300_TX_CHROMA_KEY_0, state->src_colorkey );
+     
+     RADEON_SET( SRC_COLORKEY );
+}
+
+void
+r300_set_blend_function( RadeonDriverData *rdrv,
+                         RadeonDeviceData *rdev,
+                         CardState        *state )
+{
+     u32 sblend, dblend;
+     
+     if (RADEON_IS_SET( SRC_BLEND ) && RADEON_IS_SET( DST_BLEND ))
+          return;
+
+     sblend = r300SrcBlend[state->src_blend-1];
+     dblend = r300DstBlend[state->dst_blend-1];
+
+     if (!DFB_PIXELFORMAT_HAS_ALPHA(rdev->dst_format)) {
+          if (sblend == SRC_BLEND_GL_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ONE;
+          else if (sblend == SRC_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               sblend = SRC_BLEND_GL_ZERO;
+                    
+          if (dblend == DST_BLEND_GL_DST_ALPHA)
+               dblend = DST_BLEND_GL_ONE;
+          else if (dblend == DST_BLEND_GL_ONE_MINUS_DST_ALPHA)
+               dblend = DST_BLEND_GL_ZERO;
+     }
+     
+     rdev->rb3d_blend = sblend | dblend;
+     
+     RADEON_UNSET( DRAWING_FLAGS );
+     RADEON_UNSET( BLITTING_FLAGS );
+     RADEON_SET( SRC_BLEND );
+     RADEON_SET( DST_BLEND );
+}
+
+void r300_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state )
+{
+     if (RADEON_IS_SET( RENDER_OPTIONS ))
+          return;
+          
+     if (state->render_options & DSRO_MATRIX &&
+        (!state->affine_matrix ||
+          state->matrix[0] != (1<<16) || state->matrix[1] != 0 || state->matrix[2] != 0 ||
+          state->matrix[3] != 0 || state->matrix[4] != (1<<16) || state->matrix[5] != 0)) {
+          rdev->matrix = state->matrix;
+          rdev->affine_matrix = state->affine_matrix;
+     }
+     else {
+          rdev->matrix = NULL;
+     }
+     
+     /* TODO: antialiasing */
+#if 0
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( rdrv->mmio_base, R300_GB_AA_CONFIG, 
+                   (state->render_options & DSRO_ANTIALIAS) ? R300_AA_ENABLE : 0 );
+#endif
+     rdev->render_options = state->render_options & ~DSRO_ANTIALIAS;
+     
+     RADEON_SET( RENDER_OPTIONS );
+}
+
+void r300_set_drawingflags( RadeonDriverData *rdrv,
+                            RadeonDeviceData *rdev,
+                            CardState        *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl       |
+                                  GMC_SRC_DATATYPE_MONO_FG_LA |
+                                  GMC_BRUSH_SOLID_COLOR       |
+                                  GMC_CLR_CMP_CNTL_DIS;
+     u32            rb3d_blend;
+     
+     if (RADEON_IS_SET( DRAWING_FLAGS ))
+          return;
+     
+     if (state->drawingflags & DSDRAW_BLEND) {
+          rb3d_blend = R300_BLEND_ENABLE      | R300_BLEND_UNKNOWN | 
+                       R300_BLEND_NO_SEPARATE | rdev->rb3d_blend;
+     }
+     else {
+          rb3d_blend = R300_SRC_BLEND_GL_ONE | R300_DST_BLEND_GL_ZERO;
+     }
+
+     if (state->drawingflags & DSDRAW_XOR)
+          master_cntl |= GMC_ROP3_PATXOR;
+     else
+          master_cntl |= GMC_ROP3_PATCOPY;
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     radeon_out32( mmio, DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM );
+     
+     if (R300_HAS_3DREGS()) {
+          radeon_waitfifo( rdrv, rdev, 27 ); 
+          radeon_out32( mmio, R300_TX_ENABLE, 0 );
+          radeon_out32( mmio, R300_RE_SHADE_MODEL, R300_RE_SHADE_MODEL_FLAT );
+          /* fragment program */
+          radeon_out32( mmio, R300_PFS_CNTL_0, 0 );
+          radeon_out32( mmio, R300_PFS_CNTL_1, 0 );
+          radeon_out32( mmio, R300_PFS_CNTL_2, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_0, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_1, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_2, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_3, R300_PFS_NODE_OUTPUT_COLOR );
+          radeon_out32( mmio, R300_PFS_INSTR0_0,
+                              FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)) );
+          radeon_out32( mmio, R300_PFS_INSTR1_0,
+                              FP_SELC(0,NO,XYZ,FP_TMP(0),FP_TMP(2),FP_TMP(2)) );
+          radeon_out32( mmio, R300_PFS_INSTR2_0,
+                              FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)) );
+          radeon_out32( mmio, R300_PFS_INSTR3_0,
+                              FP_SELA(0,NO,W,FP_TMP(0),FP_TMP(2),FP_TMP(2)) );
+          /* blend functions */
+          radeon_out32( mmio, R300_RB3D_CBLEND, rb3d_blend );
+          radeon_out32( mmio, R300_RB3D_ABLEND, rb3d_blend & 0xfffffff0 );
+          /* routing */
+          radeon_out32( mmio, R300_RS_CNTL_0, (0 << R300_RS_CNTL_TC_CNT_SHIFT) | 
+                                              (1 << R300_RS_CNTL_CI_CNT_SHIFT) |
+                                               R300_RS_CNTL_0_UNKNOWN_18 );
+          radeon_out32( mmio, R300_RS_CNTL_1, 0x000000c0 );
+          radeon_out32( mmio, R300_RS_ROUTE_0, R300_RS_ROUTE_0_COLOR );
+          /* input */
+          radeon_out32( mmio, R300_VAP_INPUT_ROUTE_0_0, 0x21030003 );
+          radeon_out32( mmio, R300_VAP_INPUT_ROUTE_1_0, 0xf688f688 );
+          radeon_out32( mmio, R300_VAP_INPUT_CNTL_0, R300_INPUT_CNTL_0_COLOR );
+          radeon_out32( mmio, R300_VAP_INPUT_CNTL_1, R300_INPUT_CNTL_POS |
+                                                     R300_INPUT_CNTL_COLOR );
+          /* output */
+          radeon_out32( mmio, R300_VAP_OUTPUT_VTX_FMT_0,
+                              R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT |
+                              R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT );
+          radeon_out32( mmio, R300_VAP_OUTPUT_VTX_FMT_1, 0 );
+          radeon_out32( mmio, R300_GB_VAP_RASTER_VTX_FMT_0, 
+                              R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT |
+                              R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT );
+          radeon_out32( mmio, R300_GB_VAP_RASTER_VTX_FMT_1, 0 );
+          radeon_out32( mmio, R300_VAP_UNKNOWN_221C, R300_221C_CLEAR );
+     }     
+
+     rdev->drawingflags = state->drawingflags;
+
+     RADEON_SET  ( DRAWING_FLAGS );
+     RADEON_UNSET( BLITTING_FLAGS );
+}
+
+void r300_set_blittingflags( RadeonDriverData *rdrv,
+                             RadeonDeviceData *rdev,
+                             CardState      *state )
+{
+     volatile u8   *mmio        = rdrv->mmio_base;
+     u32            master_cntl = rdev->gui_master_cntl |
+                                  GMC_BRUSH_NONE        |
+                                  GMC_SRC_DATATYPE_COLOR; 
+     u32            txfilter1   = R300_TX_TRI_PERF_0_8;
+     u32            cmp_cntl    = 0;
+     u32            rb3d_blend;
+     
+     if (RADEON_IS_SET( BLITTING_FLAGS ))
+          return;
+     
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA | 
+                                 DSBLIT_COLORIZE           | DSBLIT_SRC_PREMULTCOLOR)) {
+          rb3d_blend = R300_BLEND_ENABLE | R300_BLEND_UNKNOWN | R300_BLEND_NO_SEPARATE;
+          
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+               rb3d_blend |= rdev->rb3d_blend;
+          else
+               rb3d_blend |= R300_SRC_BLEND_GL_ONE | R300_DST_BLEND_GL_ZERO;
+
+          if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+               rb3d_blend &= ~(R300_SRC_BLEND_MASK | R300_DST_BLEND_MASK);
+               rb3d_blend |= R300_SRC_BLEND_GL_CONST_ALPHA |
+                             R300_DST_BLEND_GL_ONE_MINUS_CONST_ALPHA;
+          }
+          if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR)) {
+               rb3d_blend &= ~R300_SRC_BLEND_MASK;
+               rb3d_blend |= R300_SRC_BLEND_GL_CONST_COLOR;
+          }
+     }
+     else {
+          rb3d_blend = R300_SRC_BLEND_GL_ONE | R300_DST_BLEND_GL_ZERO;
+     }
+     
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          txfilter1 |= R300_CHROMA_KEY_FORCE;
+          cmp_cntl   = SRC_CMP_EQ_COLOR | CLR_CMP_SRC_SOURCE;
+     }
+     else {
+          master_cntl |= GMC_CLR_CMP_CNTL_DIS;
+     }
+
+     if (state->blittingflags & DSBLIT_XOR)
+          master_cntl |= GMC_ROP3_XOR;
+     else
+          master_cntl |= GMC_ROP3_SRCCOPY;
+
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, CLR_CMP_CNTL, cmp_cntl );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, master_cntl );
+     
+     if (R300_HAS_3DREGS()) {
+          radeon_waitfifo( rdrv, rdev, 29 );
+          radeon_out32( mmio, R300_TX_FILTER1_0, txfilter1 );
+          radeon_out32( mmio, R300_TX_ENABLE, R300_TX_ENABLE_0 );
+          if (rdev->accel == DFXL_TEXTRIANGLES)
+               radeon_out32( mmio, R300_RE_SHADE_MODEL, R300_RE_SHADE_MODEL_SMOOTH );
+          else
+               radeon_out32( mmio, R300_RE_SHADE_MODEL, R300_RE_SHADE_MODEL_FLAT );
+          /* fragment program */
+          radeon_out32( mmio, R300_PFS_CNTL_0, R300_PFS_CNTL_FIRST_NODE_HAS_TEX );
+          radeon_out32( mmio, R300_PFS_CNTL_1, 0 );
+          radeon_out32( mmio, R300_PFS_CNTL_2, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_0, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_1, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_2, 0 );
+          radeon_out32( mmio, R300_PFS_NODE_3, R300_PFS_NODE_OUTPUT_COLOR ); 
+          radeon_out32( mmio, R300_PFS_TEXI_0, R300_FPITX_OP_TXP );
+          radeon_out32( mmio, R300_PFS_INSTR0_0,
+                              FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)) );
+          radeon_out32( mmio, R300_PFS_INSTR1_0,
+                              FP_SELC(0,NO,XYZ,FP_TMP(0),FP_TMP(2),FP_TMP(2)) );
+          radeon_out32( mmio, R300_PFS_INSTR2_0,
+                              FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)) );
+          radeon_out32( mmio, R300_PFS_INSTR3_0,
+                              FP_SELA(0,NO,W,FP_TMP(0),FP_TMP(2),FP_TMP(2)) );
+          /* blend functions */
+          radeon_out32( mmio, R300_RB3D_CBLEND, rb3d_blend );
+          radeon_out32( mmio, R300_RB3D_ABLEND, rb3d_blend & 0xfffffff0 );
+          /* routing */
+          radeon_out32( mmio, R300_RS_CNTL_0, (1 << R300_RS_CNTL_TC_CNT_SHIFT) | 
+                                              (0 << R300_RS_CNTL_CI_CNT_SHIFT) |
+                                               R300_RS_CNTL_0_UNKNOWN_18 );
+          radeon_out32( mmio, R300_RS_CNTL_1, 0x000000c0 );
+          radeon_out32( mmio, R300_RS_ROUTE_0, R300_RS_ROUTE_ENABLE );
+          /* input routing */
+          radeon_out32( mmio, R300_VAP_INPUT_ROUTE_0_0, 0x21030003 );
+          radeon_out32( mmio, R300_VAP_INPUT_ROUTE_1_0, 0xf688f688 );
+          radeon_out32( mmio, R300_VAP_INPUT_CNTL_0, 0x5555 );
+          radeon_out32( mmio, R300_VAP_INPUT_CNTL_1, R300_INPUT_CNTL_POS |
+                                                     R300_INPUT_CNTL_TC0 );
+          /* output routing */
+          radeon_out32( mmio, R300_VAP_OUTPUT_VTX_FMT_0,
+                              R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT );
+          radeon_out32( mmio, R300_VAP_OUTPUT_VTX_FMT_1, 4 );
+          radeon_out32( mmio, R300_GB_VAP_RASTER_VTX_FMT_0, 
+                              R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT );
+          radeon_out32( mmio, R300_GB_VAP_RASTER_VTX_FMT_1, 4 );
+          radeon_out32( mmio, R300_VAP_UNKNOWN_221C, R300_221C_CLEAR );
+     }
+     
+     rdev->blittingflags = state->blittingflags;
+     
+     RADEON_SET  ( BLITTING_FLAGS );
+     RADEON_UNSET( DRAWING_FLAGS );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon.c b/Source/DirectFB/gfxdrivers/radeon/radeon.c
new file mode 100755
index 0000000..19f8c49
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon.c
@@ -0,0 +1,1753 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <dfb_types.h>
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/screens.h>
+#include <core/surface.h>
+#include <core/palette.h>
+#include <core/system.h>
+
+#include <fbdev/fb.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( radeon )
+
+
+#include "radeon.h"
+#include "radeon_chipsets.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_state.h"
+#include "radeon_2d.h"
+#include "radeon_3d.h"
+
+
+/* Enable the following option if you see strange behaviours */
+#define RESET_AFTER_SETVAR  0
+
+
+/* Driver capability flags */
+#define RADEON_SUPPORTED_2D_DRAWINGFLAGS \
+     ( DSDRAW_XOR )
+
+#define RADEON_SUPPORTED_2D_DRAWINGFUNCS \
+     ( DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE )
+
+#define RADEON_SUPPORTED_2D_BLITTINGFLAGS \
+     ( DSBLIT_XOR | DSBLIT_SRC_COLORKEY )
+
+#define RADEON_SUPPORTED_2D_BLITTINGFUNCS \
+     ( DFXL_BLIT )
+
+
+#define R100_SUPPORTED_DRAWINGFLAGS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFLAGS | DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY )
+
+#define R100_SUPPORTED_DRAWINGFUNCS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFUNCS | DFXL_FILLTRIANGLE )
+
+#define R100_SUPPORTED_BLITTINGFLAGS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFLAGS                   | \
+       DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA | \
+       DSBLIT_COLORIZE           | DSBLIT_SRC_PREMULTCOLOR | \
+       DSBLIT_DEINTERLACE        | DSBLIT_ROTATE180        | \
+       DSBLIT_SRC_MASK_ALPHA     | DSBLIT_SRC_MASK_COLOR   | \
+       DSBLIT_SRC_PREMULTIPLY )
+
+#define R100_SUPPORTED_BLITTINGFUNCS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFUNCS | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES )
+
+
+#define R200_SUPPORTED_DRAWINGFLAGS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFLAGS | DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY )
+
+#define R200_SUPPORTED_DRAWINGFUNCS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFUNCS | DFXL_FILLTRIANGLE )
+
+#define R200_SUPPORTED_BLITTINGFLAGS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFLAGS                   | \
+       DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA | \
+       DSBLIT_COLORIZE           | DSBLIT_SRC_PREMULTCOLOR | \
+       DSBLIT_DEINTERLACE        | DSBLIT_ROTATE180        | \
+       DSBLIT_SRC_MASK_ALPHA     | DSBLIT_SRC_MASK_COLOR   | \
+       DSBLIT_SRC_PREMULTIPLY )
+
+#define R200_SUPPORTED_BLITTINGFUNCS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFUNCS | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES )
+
+
+#define R300_SUPPORTED_DRAWINGFLAGS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFLAGS | DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY )
+
+#define R300_SUPPORTED_DRAWINGFUNCS \
+     ( RADEON_SUPPORTED_2D_DRAWINGFUNCS | DFXL_FILLTRIANGLE )
+
+#define R300_SUPPORTED_BLITTINGFLAGS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFLAGS                   | \
+       DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA | \
+       DSBLIT_COLORIZE           | DSBLIT_SRC_PREMULTCOLOR | \
+       DSBLIT_DEINTERLACE        | DSBLIT_ROTATE180 )
+     
+#define R300_SUPPORTED_BLITTINGFUNCS \
+     ( RADEON_SUPPORTED_2D_BLITTINGFUNCS | DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES )
+
+
+#define DSBLIT_MODULATE_ALPHA ( DSBLIT_BLEND_ALPHACHANNEL | \
+                                DSBLIT_BLEND_COLORALPHA )
+#define DSBLIT_MODULATE_COLOR ( DSBLIT_BLEND_COLORALPHA   | \
+                                DSBLIT_COLORIZE           | \
+                                DSBLIT_SRC_PREMULTCOLOR )
+#define DSBLIT_MODULATE       ( DSBLIT_MODULATE_ALPHA     | \
+                                DSBLIT_MODULATE_COLOR     | \
+                                DSBLIT_SRC_PREMULTIPLY )
+#define DSBLIT_MASK           ( DSBLIT_SRC_MASK_ALPHA     | \
+                                DSBLIT_SRC_MASK_COLOR )
+
+#define RADEON_DRAW_3D()      ( rdev->accel & DFXL_FILLTRIANGLE  || \
+                                rdev->drawingflags & ~DSDRAW_XOR || \
+                                rdev->matrix != NULL             || \
+                               (rdev->render_options & DSRO_ANTIALIAS && \
+                                rdev->accel & DFXL_DRAWLINE) )
+
+#define RADEON_BLIT_3D()      ( rdev->accel & ~DFXL_BLIT                     ||\
+                                rdev->blittingflags & ~(DSBLIT_XOR |            \
+                                                        DSBLIT_SRC_COLORKEY) || \
+                                rdev->matrix != NULL                         || \
+                               (rdev->dst_format != rdev->src_format        &&  \
+                                !(DFB_PLANAR_PIXELFORMAT(rdev->dst_format) &&   \
+                                  DFB_PLANAR_PIXELFORMAT(rdev->src_format)  )))
+                                
+#define RADEON_FUNC( f ) DFB_PLANAR_PIXELFORMAT(rdev->dst_format) ? f##_420 : f
+
+
+static inline bool
+radeon_compatible_format( RadeonDriverData *rdrv, DFBSurfacePixelFormat format )
+{
+#ifdef WORDS_BIGENDIAN
+     u32 tmp, bpp;
+
+     bpp = DFB_BYTES_PER_PIXEL( format );
+     tmp = radeon_in32( rdrv->mmio_base, CRTC_GEN_CNTL );
+     switch ((tmp >> 8) & 0xf) {
+          case DST_8BPP:
+          case DST_24BPP:
+               if (bpp == 2 || bpp == 4)
+                    return false;
+               break;
+          case DST_15BPP:
+          case DST_16BPP:
+               if (bpp != 2)
+                    return false;
+               break;
+          default:
+               if (bpp != 4)
+                    return false;
+               break;
+     }
+#endif
+     return true;
+}
+
+static void
+radeon_get_monitors( RadeonDriverData  *rdrv,
+                     RadeonDeviceData  *rdev,
+                     RadeonMonitorType *ret_monitor1,
+                     RadeonMonitorType *ret_monitor2 )
+{
+     RadeonMonitorType  dvimon = MT_NONE;
+     RadeonMonitorType  vgamon = MT_NONE;
+#if D_DEBUG_ENABLED
+     const char        *name[] = { "NONE", "CRT", "DFP", 
+                                   "LCD",  "CTV", "STV" }; 
+#endif
+     u32                tmp;
+      
+     if (rdev->chipset != CHIP_R100) {        
+          if (rdev->chipset >= CHIP_R300 ||
+              rdev->chipset == CHIP_UNKNOWN)
+               tmp = radeon_in32( rdrv->mmio_base, BIOS_0_SCRATCH );
+          else
+               tmp = radeon_in32( rdrv->mmio_base, BIOS_4_SCRATCH );
+     
+          /* DVI/TVO port */
+		if (tmp & 0x08)
+			dvimon = MT_DFP;
+		else if (tmp & 0x4)
+			dvimon = MT_LCD;
+		else if (tmp & 0x200)
+			dvimon = MT_CRT;
+		else if (tmp & 0x10)
+			dvimon = MT_CTV;
+		else if (tmp & 0x20)
+			dvimon = MT_STV;
+		
+          /* VGA port */
+		if (tmp & 0x2)
+			vgamon = MT_CRT;
+		else if (tmp & 0x800)
+			vgamon = MT_DFP;
+		else if (tmp & 0x400)
+			vgamon = MT_LCD;
+		else if (tmp & 0x1000)
+			vgamon = MT_CTV;
+		else if (tmp & 0x2000)
+			vgamon = MT_STV;
+     }
+     else {
+          tmp = radeon_in32( rdrv->mmio_base, FP_GEN_CNTL );
+          
+          if (tmp & FP_EN_TMDS)
+               vgamon = MT_DFP;
+          else
+               vgamon = MT_CRT;
+     }
+
+     D_DEBUG( "DirectFB/Radeon: "
+              "DVI/TVO Port -> %s, VGA Port -> %s.\n", 
+              name[dvimon], name[vgamon] );
+     
+     if (dvimon) {
+          /* If DVI port is connected, then
+           * DVI port is the primary head and 
+           * CRT port is the secondary head.
+           */
+          if (ret_monitor1)
+               *ret_monitor1 = dvimon;
+          if (ret_monitor2)
+               *ret_monitor2 = vgamon;
+     } 
+     else {
+          if (ret_monitor1)
+               *ret_monitor1 = vgamon;
+          if (ret_monitor2)
+               *ret_monitor2 = MT_NONE;
+     }     
+}
+
+void
+radeon_reset( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     volatile u8   *mmio = rdrv->mmio_base;
+     u32            clock_cntl_index;
+     u32            mclk_cntl;
+     u32            rbbm_soft_reset;
+     u32            host_path_cntl;
+     
+     clock_cntl_index = radeon_in32( mmio, CLOCK_CNTL_INDEX );
+     
+     mclk_cntl  = radeon_inpll( mmio, MCLK_CNTL );
+     radeon_outpll( mmio, MCLK_CNTL, mclk_cntl     |
+                                     FORCEON_MCLKA |
+                                     FORCEON_MCLKB |
+                                     FORCEON_YCLKA |
+                                     FORCEON_YCLKB |
+                                     FORCEON_MC    |
+                                     FORCEON_AIC );
+
+     host_path_cntl  = radeon_in32( mmio, HOST_PATH_CNTL );
+     rbbm_soft_reset = radeon_in32( mmio, RBBM_SOFT_RESET );
+   
+     radeon_out32( mmio, RBBM_SOFT_RESET, rbbm_soft_reset |
+                                        SOFT_RESET_CP | SOFT_RESET_HI |
+                                        SOFT_RESET_SE | SOFT_RESET_RE |
+                                        SOFT_RESET_PP | SOFT_RESET_E2 |
+                                        SOFT_RESET_RB );
+     radeon_in32( mmio, RBBM_SOFT_RESET );
+     
+     radeon_out32( mmio, RBBM_SOFT_RESET, rbbm_soft_reset &
+                                       ~(SOFT_RESET_CP | SOFT_RESET_HI |
+                                         SOFT_RESET_SE | SOFT_RESET_RE |
+                                         SOFT_RESET_PP | SOFT_RESET_E2 |
+                                         SOFT_RESET_RB) );
+     radeon_in32( mmio, RBBM_SOFT_RESET );
+     
+     radeon_out32( mmio, HOST_PATH_CNTL, host_path_cntl | HDP_SOFT_RESET );
+     radeon_in32( mmio, HOST_PATH_CNTL );
+     radeon_out32( mmio, HOST_PATH_CNTL, host_path_cntl );
+
+     radeon_out32( mmio, RBBM_SOFT_RESET, rbbm_soft_reset );
+
+     radeon_out32( mmio, CLOCK_CNTL_INDEX, clock_cntl_index );
+     radeon_outpll( mmio, MCLK_CNTL, mclk_cntl );
+     
+     rdev->set = 0;
+     rdev->src_format = DSPF_UNKNOWN;
+     rdev->dst_format = DSPF_UNKNOWN;
+     rdev->fifo_space = 0;
+}
+     
+static void radeonAfterSetVar( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     volatile u8      *mmio = rdrv->mmio_base;
+    
+     rdev->surface_cntl   =
+     rdev->surface_cntl_c =
+     rdev->surface_cntl_p = radeon_in32( mmio, SURFACE_CNTL );
+
+     radeon_out32( mmio, CRTC_OFFSET_CNTL, 
+                  (radeon_in32( mmio, CRTC_OFFSET_CNTL ) & ~CRTC_TILE_EN) | CRTC_HSYNC_EN );
+
+#if RESET_AFTER_SETVAR
+     radeon_waitidle( rdrv, rdev );
+     radeon_reset( rdrv, rdev );
+#endif
+}
+
+static void radeonEngineReset( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     volatile u8      *mmio = rdrv->mmio_base;
+
+     rdev->fifo_space = 0;
+
+     radeon_out32( mmio, SURFACE_CNTL, rdev->surface_cntl_c );
+     
+     radeon_waitfifo( rdrv, rdev, 3 );
+#ifdef WORDS_BIGENDIAN
+     radeon_out32( mmio, DP_DATATYPE, 
+                   radeon_in32( mmio, DP_DATATYPE ) | HOST_BIG_ENDIAN_EN );
+#else
+     radeon_out32( mmio, DP_DATATYPE, 
+                   radeon_in32( mmio, DP_DATATYPE ) & ~HOST_BIG_ENDIAN_EN );
+#endif
+     radeon_out32( mmio, DEFAULT_SC_BOTTOM_RIGHT, DEFAULT_SC_RIGHT_MAX |
+                                                  DEFAULT_SC_BOTTOM_MAX );
+     radeon_out32( mmio, AUX_SC_CNTL, 0 );
+    
+     if (rdev->chipset >= CHIP_R300) {
+          r300_restore( rdrv, rdev );
+     }
+     else if (rdev->chipset >= CHIP_R200) {
+          r200_restore( rdrv, rdev );
+     }
+     else if (rdev->chipset >= CHIP_R100) {
+          r100_restore( rdrv, rdev );
+     }
+     
+     /* sync 2d and 3d engines */
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( mmio, ISYNC_CNTL, ISYNC_ANY2D_IDLE3D |
+                                     ISYNC_ANY3D_IDLE2D ); 
+}
+
+static DFBResult radeonEngineSync( void *drv, void *dev )
+{
+     if (!radeon_waitidle( (RadeonDriverData*)drv, (RadeonDeviceData*)dev ))
+     	return DFB_IO; /* DFB_TIMEOUT !? */
+
+     return DFB_OK;
+}
+
+static void radeonInvalidateState( void *drv, void *dev )
+{
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+ 
+     rdev->set = 0;
+     rdev->dst_format = DSPF_UNKNOWN;
+     rdev->src_format = DSPF_UNKNOWN;
+     rdev->msk_format = DSPF_UNKNOWN;
+}
+
+static void radeonFlushTextureCache( void *drv, void *dev )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     volatile u8      *mmio = rdrv->mmio_base;
+     
+     if (rdev->chipset >= CHIP_R300) {
+          if (rdrv->mmio_size > 0x4000) {     
+               radeon_waitfifo( rdrv, rdev, 1 );
+               radeon_out32( mmio, R300_TX_CNTL, 0 );
+          }
+     }
+     else if (rdev->chipset >= CHIP_R200) {
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, R200_PP_TXOFFSET_0, rdev->src_offset );
+          radeon_out32( mmio, R200_PP_TXOFFSET_1, rdev->msk_offset );
+     }
+     else if (rdev->chipset >= CHIP_R100) {     
+          radeon_waitfifo( rdrv, rdev, 2 );
+          radeon_out32( mmio, PP_TXOFFSET_0, rdev->src_offset );
+          radeon_out32( mmio, PP_TXOFFSET_1, rdev->msk_offset );
+     }
+}
+
+#ifdef WORDS_BIGENDIAN
+static void radeonSurfaceEnter( void *drv, void *dev, 
+                                CoreSurfaceBuffer *buffer, DFBSurfaceLockFlags flags )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     volatile u8      *mmio = rdrv->mmio_base;
+     u32               tmp;
+
+     if (!(flags & DSLF_WRITE))
+          return;
+
+     rdev->surface_cntl_p = radeon_in32( mmio, SURFACE_CNTL );
+     
+     tmp = rdev->surface_cntl_p & ~SURF_TRANSLATION_DIS;
+     tmp &= ~(NONSURF_AP0_SWP_16BPP | NONSURF_AP1_SWP_16BPP |
+              NONSURF_AP0_SWP_32BPP | NONSURF_AP1_SWP_32BPP);
+              
+     switch (DFB_BITS_PER_PIXEL( buffer->format )) {
+          case 16:
+               tmp |= NONSURF_AP0_SWP_16BPP | NONSURF_AP1_SWP_16BPP;
+               break;
+          case 32:
+               tmp |= NONSURF_AP0_SWP_32BPP | NONSURF_AP1_SWP_32BPP;
+               break;
+          default:
+               break;
+     }
+
+     radeon_out32( mmio, SURFACE_CNTL, tmp );
+     rdev->surface_cntl_c = tmp;
+}
+
+static void radeonSurfaceLeave( void *drv, void *dev, CoreSurfaceBuffer *buffer )
+{ 
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     volatile u8      *mmio = rdrv->mmio_base;
+     
+     if (rdev->surface_cntl_p != rdev->surface_cntl_c) {
+          radeon_out32( mmio, SURFACE_CNTL, rdev->surface_cntl_p );
+          rdev->surface_cntl_c = rdev->surface_cntl_p;
+     }
+}
+#endif
+          
+static void r100CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDeviceData *rdev        = (RadeonDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+     
+     int supported_drawingfuncs  = R100_SUPPORTED_DRAWINGFUNCS; 
+     int supported_drawingflags  = R100_SUPPORTED_DRAWINGFLAGS;
+     int supported_blittingfuncs = R100_SUPPORTED_BLITTINGFUNCS;
+     int supported_blittingflags = R100_SUPPORTED_BLITTINGFLAGS;
+   
+     if (!radeon_compatible_format( drv, destination->config.format ))
+          return;
+
+     switch (destination->config.format) {               
+          case DSPF_A8:
+               if (state->src_blend == DSBF_SRCALPHASAT) {
+                    supported_drawingflags  &= ~DSDRAW_BLEND;
+                    supported_blittingflags &= ~DSBLIT_MODULATE_ALPHA;
+               }
+               break;
+               
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+               
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+               if (DFB_BLITTING_FUNCTION( accel ) &&
+                   source->config.format != destination->config.format)
+                    return;
+               supported_drawingflags   =  DSDRAW_NOFX;
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               supported_blittingflags  = ~(DSBLIT_MODULATE | DSBLIT_MASK);
+               break;
+
+          case DSPF_ARGB2554:
+               if (DFB_BLITTING_FUNCTION( accel ) &&
+                   source->config.format != destination->config.format)
+                    return;
+               supported_drawingfuncs  &= ~DFXL_FILLTRIANGLE;
+               supported_drawingflags   =  DSDRAW_XOR;
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               supported_blittingflags &= ~(DSBLIT_MODULATE | DSBLIT_MASK);
+               break;
+               
+          case DSPF_AiRGB:
+               supported_drawingflags  &= ~DSDRAW_BLEND;
+               supported_blittingflags &= ~DSBLIT_MODULATE_ALPHA;
+               break;
+
+          case DSPF_I420:
+          case DSPF_YV12:
+               if (DFB_BLITTING_FUNCTION( accel )     &&
+                   source->config.format != DSPF_A8   &&
+                   source->config.format != DSPF_I420 &&
+                   source->config.format != DSPF_YV12)
+                    return;
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (source && source->config.format != DSPF_A8)
+                   supported_blittingflags &= ~(DSBLIT_COLORIZE | DSBLIT_SRC_COLORKEY | DSBLIT_MASK);
+               break;
+
+          case DSPF_AYUV:
+               if (DFB_BLITTING_FUNCTION( accel ) && source->config.format != DSPF_A8) {
+                    if (source->config.format != DSPF_AYUV)
+                         return;
+                    supported_blittingflags &= ~(DSBLIT_COLORIZE | DSBLIT_MASK);
+               }
+               break;
+               
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) { 
+          if (state->blittingflags & DSBLIT_MASK ||
+              state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+               if (state->blittingflags & DSBLIT_MASK &&
+                   state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                    return;
+               if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+                    return;
+          }
+
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+               if (destination->config.format != source->config.format)
+                    return;
+               supported_blittingfuncs  = DFXL_BLIT;
+               supported_blittingflags &= DSBLIT_SRC_COLORKEY | DSBLIT_XOR;
+          }
+          
+          if (state->blittingflags & DSBLIT_ROTATE180)
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               
+          if (accel & ~supported_blittingfuncs ||
+              state->blittingflags & ~supported_blittingflags)
+               return;
+          
+          if (source->config.size.w > 2048 || source->config.size.h > 2048)
+               return;
+
+          if (state->blittingflags & DSBLIT_MODULATE_ALPHA &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+               
+          if (!radeon_compatible_format( drv, source->config.format ))
+               return;
+
+          switch (source->config.format) {           
+               case DSPF_RGB332:
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    if (destination->config.format == DSPF_UYVY ||
+                        destination->config.format == DSPF_YUY2)
+                         return;
+               case DSPF_A8:
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    break;
+
+               case DSPF_AiRGB:
+                    if (destination->config.format != source->config.format &&
+                        (DFB_PIXELFORMAT_HAS_ALPHA(destination->config.format) ||
+                         destination->config.format == DSPF_UYVY ||
+                         destination->config.format == DSPF_YUY2))
+                         return;
+                    if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                         return;
+                    break;
+               
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_ARGB2554:
+               case DSPF_AYUV:
+                    if (destination->config.format != source->config.format)
+                         return;
+                    break;
+
+               case DSPF_I420:
+               case DSPF_YV12:
+                    if (source->config.size.w < 2 || source->config.size.h < 2)
+                         return;
+                    if (destination->config.format != DSPF_I420 &&
+                        destination->config.format != DSPF_YV12)
+                         return;
+                    break;
+               
+               default:
+                    return;
+          }
+
+          if (state->blittingflags & DSBLIT_MASK) {
+               CoreSurface *mask = state->source_mask;
+               
+               if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                           DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+                    return;
+               
+               if (state->src_mask_flags & DSMF_STENCIL ||
+                   state->src_mask_offset.x || state->src_mask_offset.y)
+                    return;
+                    
+               if (mask->config.size.w > 2048 || mask->config.size.h > 2048)
+                    return;
+                    
+               if (!radeon_compatible_format( drv, mask->config.format ))
+                    return;
+                    
+               switch (mask->config.format) {
+                    case DSPF_A8:
+                    case DSPF_RGB332:
+                    case DSPF_RGB444:
+                    case DSPF_ARGB4444:
+                    case DSPF_RGB555:
+                    case DSPF_ARGB1555:
+                    case DSPF_RGB16:
+                    case DSPF_RGB32:
+                    case DSPF_ARGB:
+                         break;
+
+                    case DSPF_AiRGB:
+                         if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA &&
+                             DFB_PIXELFORMAT_HAS_ALPHA(source->config.format) &&
+                             source->config.format != DSPF_AiRGB)
+                              return;
+                         break;
+                    
+                    default:
+                         return; 
+               }
+          }
+
+          state->accel |= supported_blittingfuncs;
+          rdev->blitting_mask = supported_blittingfuncs;
+     } 
+     else {
+          if (accel & ~supported_drawingfuncs ||
+              state->drawingflags & ~supported_drawingflags)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+               
+          state->accel |= supported_drawingfuncs;
+          rdev->drawing_mask = supported_drawingfuncs;
+     }
+}
+
+static void r200CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDeviceData *rdev        = (RadeonDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+     
+     int supported_drawingfuncs  = R200_SUPPORTED_DRAWINGFUNCS; 
+     int supported_drawingflags  = R200_SUPPORTED_DRAWINGFLAGS;
+     int supported_blittingfuncs = R200_SUPPORTED_BLITTINGFUNCS;
+     int supported_blittingflags = R200_SUPPORTED_BLITTINGFLAGS;
+     
+     if (!radeon_compatible_format( drv, destination->config.format ))
+          return;
+     
+     switch (destination->config.format) {               
+          case DSPF_A8:
+               if (state->src_blend == DSBF_SRCALPHASAT) {
+                    supported_drawingflags  &= ~DSDRAW_BLEND;
+                    supported_blittingflags &= ~DSBLIT_MODULATE_ALPHA;
+               }
+               break;
+                   
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+               
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+               if (DFB_BLITTING_FUNCTION( accel ) &&
+                   source->config.format != destination->config.format)
+                    return;
+               supported_drawingflags   =  DSDRAW_NOFX;
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               supported_blittingflags &= ~(DSBLIT_MODULATE | DSBLIT_MASK);
+               break;
+
+          case DSPF_ARGB2554:
+               if (DFB_BLITTING_FUNCTION( accel ) &&
+                   source->config.format != destination->config.format)
+                    return;
+               supported_drawingfuncs  &= ~DFXL_FILLTRIANGLE;
+               supported_drawingflags   =  DSDRAW_XOR;
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               supported_blittingflags &= ~(DSBLIT_MODULATE | DSBLIT_MASK);
+               break;
+               
+          case DSPF_AiRGB:
+               supported_drawingflags  &= ~DSDRAW_BLEND;
+               supported_blittingflags &= ~DSBLIT_MODULATE_ALPHA;
+               break;
+
+          case DSPF_I420:
+          case DSPF_YV12:
+               if (DFB_BLITTING_FUNCTION( accel ) &&
+                   source->config.format != DSPF_A8      &&
+                   source->config.format != DSPF_I420    &&
+                   source->config.format != DSPF_YV12)
+                    return;
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (source && source->config.format != DSPF_A8)
+                    supported_blittingflags &= ~(DSBLIT_COLORIZE | DSBLIT_SRC_COLORKEY | DSBLIT_MASK);
+               break;
+               
+          case DSPF_AYUV:
+               if (DFB_BLITTING_FUNCTION( accel ) && source->config.format != DSPF_A8) {
+                    if (source->config.format != DSPF_AYUV)
+                         return;
+                    supported_blittingflags &= ~(DSBLIT_COLORIZE | DSBLIT_MASK);
+               }
+               break;
+          
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if (state->blittingflags & DSBLIT_MASK ||
+              state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+               if (state->blittingflags & DSBLIT_MASK &&
+                   state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                    return;
+               if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+                    return;
+          }
+              
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+               if (destination->config.format != source->config.format)
+                    return;
+               supported_blittingfuncs  = DFXL_BLIT;
+               supported_blittingflags &= DSBLIT_SRC_COLORKEY | DSBLIT_XOR;
+          }
+          
+          if (state->blittingflags & DSBLIT_ROTATE180)
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+               
+          if (accel & ~supported_blittingfuncs ||
+              state->blittingflags & ~supported_blittingflags)
+               return;
+          
+          if (source->config.size.w > 2048 || source->config.size.h > 2048)
+               return;
+
+          if (state->blittingflags & DSBLIT_MODULATE_ALPHA &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+         
+          if (!radeon_compatible_format( drv, source->config.format ))
+               return;
+         
+          switch (source->config.format) {                    
+               case DSPF_RGB332:
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    if (destination->config.format == DSPF_UYVY ||
+                        destination->config.format == DSPF_YUY2)
+                         return;
+               case DSPF_A8:
+                    break;
+
+               case DSPF_AiRGB:
+                    if (destination->config.format != source->config.format &&
+                        (DFB_PIXELFORMAT_HAS_ALPHA(destination->config.format) ||
+                         destination->config.format == DSPF_UYVY ||
+                         destination->config.format == DSPF_YUY2))
+                         return;
+                    if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                         return;
+                    break;
+               
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+               case DSPF_ARGB2554:
+               case DSPF_AYUV:
+                    if (destination->config.format != source->config.format)
+                         return;
+                    break;
+                
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (rdev->chipset == CHIP_RV250             &&
+                        destination->config.format != DSPF_YUY2 &&
+                        destination->config.format != DSPF_UYVY)
+                         return;
+                    break;
+
+               case DSPF_I420:
+               case DSPF_YV12:
+                    if (source->config.size.w < 2 || source->config.size.h < 2)
+                         return;
+                    if (destination->config.format != DSPF_I420 &&
+                        destination->config.format != DSPF_YV12)
+                         return;
+                    break;
+               
+               default:
+                    return;
+          }
+          
+          if (state->blittingflags & DSBLIT_MASK) {
+               CoreSurface *mask = state->source_mask;
+               
+               if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA |
+                                           DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR))
+                    return;
+               
+               if (state->src_mask_flags & DSMF_STENCIL ||
+                   state->src_mask_offset.x || state->src_mask_offset.y)
+                    return;
+                    
+               if (mask->config.size.w > 2048 || mask->config.size.h > 2048)
+                    return;
+                    
+               if (!radeon_compatible_format( drv, mask->config.format ))
+                    return;
+                    
+               switch (mask->config.format) {
+                    case DSPF_A8:
+                    case DSPF_RGB332:
+                    case DSPF_RGB444:
+                    case DSPF_ARGB4444:
+                    case DSPF_RGB555:
+                    case DSPF_ARGB1555:
+                    case DSPF_RGB16:
+                    case DSPF_RGB32:
+                    case DSPF_ARGB:
+                         break;
+               
+                    case DSPF_AiRGB:
+                         if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA &&
+                             DFB_PIXELFORMAT_HAS_ALPHA(source->config.format) &&
+                             source->config.format != DSPF_AiRGB)
+                              return;
+                         break;
+
+                    default:
+                         return; 
+               }
+          }
+
+          state->accel |= supported_blittingfuncs;
+          rdev->blitting_mask = supported_blittingfuncs;
+     } 
+     else {
+          if (accel & ~supported_drawingfuncs ||
+              state->drawingflags & ~supported_drawingflags)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+               
+          state->accel |= supported_drawingfuncs;
+          rdev->drawing_mask = supported_drawingfuncs;
+     }
+}
+
+static void r300CheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDriverData *rdrv        = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev        = (RadeonDeviceData*) dev;
+     CoreSurface      *destination = state->destination;
+     CoreSurface      *source      = state->source;
+     bool              can_convert = true;
+    
+     int supported_drawingfuncs  = R300_SUPPORTED_DRAWINGFUNCS; 
+     int supported_drawingflags  = R300_SUPPORTED_DRAWINGFLAGS;
+     int supported_blittingfuncs = R300_SUPPORTED_BLITTINGFUNCS;
+     int supported_blittingflags = R300_SUPPORTED_BLITTINGFLAGS;
+     if (rdrv->mmio_size <= 0x4000) {
+          supported_drawingfuncs = RADEON_SUPPORTED_2D_DRAWINGFUNCS;
+          supported_drawingflags = RADEON_SUPPORTED_2D_DRAWINGFLAGS;
+          supported_blittingfuncs = RADEON_SUPPORTED_2D_BLITTINGFUNCS;
+          supported_blittingflags = RADEON_SUPPORTED_2D_BLITTINGFLAGS;
+          can_convert = false;
+     }
+
+     if (!radeon_compatible_format( drv, destination->config.format ))
+          return;
+     
+     switch (destination->config.format) {
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+               
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_A8:
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_ARGB2554:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_AiRGB:
+          case DSPF_AYUV:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (source->config.format != destination->config.format)
+                         return;
+               }
+               supported_drawingfuncs  &= ~DFXL_FILLTRIANGLE;
+               supported_drawingflags   =  DSDRAW_NOFX; 
+               supported_blittingfuncs  =  DFXL_BLIT;
+               supported_blittingflags  =  DSBLIT_NOFX;
+               break;
+ 
+          case DSPF_I420:
+          case DSPF_YV12:
+               if (DFB_BLITTING_FUNCTION( accel )) {
+                    if (source->config.format != DSPF_I420 &&
+                        source->config.format != DSPF_YV12)
+                         return;
+               }
+               supported_drawingfuncs  &= ~DFXL_FILLTRIANGLE;
+               supported_drawingflags   =  DSDRAW_XOR;
+               supported_blittingflags  =  DSBLIT_DEINTERLACE;
+               break;
+               
+          default:
+               return;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if (state->blittingflags & DSBLIT_XOR) {
+			can_convert = false;
+               supported_blittingfuncs  = DFXL_BLIT;
+               supported_blittingflags &= DSBLIT_SRC_COLORKEY | DSBLIT_XOR;
+          }
+          
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) {
+               if (state->blittingflags & DSBLIT_BLEND_COLORALPHA)
+                    return;
+               if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR)) {
+                    if (state->src_blend != DSBF_ONE)
+                         return;
+               }
+          }
+          
+          if (state->blittingflags & DSBLIT_ROTATE180)
+               supported_blittingfuncs &= ~DFXL_TEXTRIANGLES;
+          
+          if (accel & ~supported_blittingfuncs ||
+              state->blittingflags & ~supported_blittingflags)
+               return;
+          
+          if (source->config.size.w > 2048 || source->config.size.h > 2048)
+               return;
+
+          if (state->blittingflags & DSBLIT_MODULATE_ALPHA &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+               
+          if (!radeon_compatible_format( drv, source->config.format ))
+               return;
+               
+          switch (source->config.format) {
+               case DSPF_A8:                   
+               case DSPF_RGB332:
+               case DSPF_RGB444:
+               case DSPF_ARGB4444:
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    if (!can_convert &&
+                        destination->config.format != source->config.format)
+                         return;
+                    break;
+               
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    if (destination->config.format != source->config.format)
+                         return;
+                    break;
+
+               case DSPF_ARGB2554:
+               case DSPF_AiRGB:
+               case DSPF_AYUV:
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+                    if (destination->config.format != source->config.format)
+                         return;
+                    break;
+                    
+               case DSPF_I420:
+               case DSPF_YV12:
+                    if (source->config.size.w < 2 || source->config.size.h < 2)
+                         return;
+                    if (destination->config.format != DSPF_I420 &&
+                        destination->config.format != DSPF_YV12)
+                         return;
+                    break;
+               
+               default:
+                    return;
+          }
+          
+          state->accel |= supported_blittingfuncs;
+          rdev->blitting_mask = supported_blittingfuncs;
+     } 
+     else {
+          if (state->drawingflags & DSDRAW_XOR) {
+               supported_drawingfuncs &= ~DFXL_FILLTRIANGLE;
+               supported_drawingflags &= DSDRAW_XOR;
+          }
+          
+          if (accel & ~supported_drawingfuncs ||
+              state->drawingflags & ~supported_drawingflags)
+               return;
+
+          if (state->drawingflags & DSDRAW_BLEND &&
+              state->dst_blend == DSBF_SRCALPHASAT)
+               return;
+               
+          state->accel |= supported_drawingfuncs;
+          rdev->drawing_mask = supported_drawingfuncs;
+     }
+}
+
+static void r100SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+ 
+     rdev->set &= ~state->mod_hw;
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if ((rdev->accel ^ accel) & DFXL_TEXTRIANGLES)
+               rdev->set &= ~SMF_BLITTING_FLAGS;
+     }
+     
+     rdev->accel = accel;
+     
+     r100_set_destination( rdrv, rdev, state );
+     r100_set_clip( rdrv, rdev, state );
+     r100_set_render_options( rdrv, rdev, state );
+    
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               r100_set_drawing_color( rdrv, rdev, state );
+               
+               if (state->drawingflags & DSDRAW_BLEND)
+                    r100_set_blend_function( rdrv, rdev, state );
+               
+               r100_set_drawingflags( rdrv, rdev, state );
+
+               if (RADEON_DRAW_3D()) {
+                    funcs->FillRectangle = r100FillRectangle3D;
+                    funcs->FillTriangle  = r100FillTriangle;
+                    funcs->DrawRectangle = r100DrawRectangle3D;
+                    funcs->DrawLine      = r100DrawLine3D;
+                    funcs->EmitCommands  = r100EmitCommands3D;
+               } else {
+                    funcs->FillRectangle = RADEON_FUNC(radeonFillRectangle2D);
+                    funcs->FillTriangle  = NULL;
+                    funcs->DrawRectangle = RADEON_FUNC(radeonDrawRectangle2D);
+                    funcs->DrawLine      = RADEON_FUNC(radeonDrawLine2D);
+                    funcs->EmitCommands  = NULL;
+               }
+
+               state->set = rdev->drawing_mask;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:     
+               r100_set_source( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MASK)
+                    r100_set_source_mask( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_ALPHA)
+                    r100_set_blend_function( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_COLOR)
+                    r100_set_blitting_color( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    r100_set_src_colorkey( rdrv, rdev, state );
+               
+               r100_set_blittingflags( rdrv, rdev, state );
+
+               if (RADEON_BLIT_3D()) {
+                    funcs->Blit             = r100Blit3D;
+                    funcs->StretchBlit      = r100StretchBlit;
+                    funcs->TextureTriangles = r100TextureTriangles;
+                    funcs->EmitCommands     = r100EmitCommands3D;
+               } else {
+                    funcs->Blit             = RADEON_FUNC(radeonBlit2D);
+                    funcs->StretchBlit      = NULL;
+                    funcs->TextureTriangles = NULL;
+                    funcs->EmitCommands     = NULL;
+               }
+               
+               state->set = (accel & DFXL_TEXTRIANGLES) 
+                            ? : (rdev->blitting_mask & ~DFXL_TEXTRIANGLES);
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+     
+     state->mod_hw = 0;
+}
+
+static void r200SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+ 
+     rdev->set &= ~state->mod_hw;
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if ((rdev->accel ^ accel) & DFXL_TEXTRIANGLES)
+               rdev->set &= ~SMF_BLITTING_FLAGS;
+     }
+     
+     rdev->accel = accel;
+     
+     r200_set_destination( rdrv, rdev, state );
+     r200_set_clip( rdrv, rdev, state );
+     r200_set_render_options( rdrv, rdev, state );
+    
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               r200_set_drawing_color( rdrv, rdev, state );
+               
+               if (state->drawingflags & DSDRAW_BLEND)
+                    r200_set_blend_function( rdrv, rdev, state );
+               
+               r200_set_drawingflags( rdrv, rdev, state );
+
+               if (RADEON_DRAW_3D()) {
+                    funcs->FillRectangle = r200FillRectangle3D;
+                    funcs->FillTriangle  = r200FillTriangle;
+                    funcs->DrawRectangle = r200DrawRectangle3D;
+                    funcs->DrawLine      = r200DrawLine3D;
+                    funcs->EmitCommands  = r200EmitCommands3D;
+               } else {
+                    funcs->FillRectangle = RADEON_FUNC(radeonFillRectangle2D);
+                    funcs->FillTriangle  = NULL;
+                    funcs->DrawRectangle = RADEON_FUNC(radeonDrawRectangle2D);
+                    funcs->DrawLine      = RADEON_FUNC(radeonDrawLine2D);
+                    funcs->EmitCommands  = NULL;
+               }
+
+               state->set = rdev->drawing_mask;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:     
+               r200_set_source( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MASK)
+                    r200_set_source_mask( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_ALPHA)
+                    r200_set_blend_function( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_COLOR)
+                    r200_set_blitting_color( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    r200_set_src_colorkey( rdrv, rdev, state );
+               
+               r200_set_blittingflags( rdrv, rdev, state );
+               
+               if (RADEON_BLIT_3D()) {
+                    funcs->Blit             = r200Blit3D;
+                    funcs->StretchBlit      = r200StretchBlit;
+                    funcs->TextureTriangles = r200TextureTriangles;
+                    funcs->EmitCommands     = r200EmitCommands3D;
+               } else {
+                    funcs->Blit             = RADEON_FUNC(radeonBlit2D);
+                    funcs->StretchBlit      = NULL;
+                    funcs->TextureTriangles = NULL;
+                    funcs->EmitCommands     = NULL;
+               }
+               
+               state->set = (accel & DFXL_TEXTRIANGLES) 
+                            ? : (rdev->blitting_mask & ~DFXL_TEXTRIANGLES);
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+     
+     state->mod_hw = 0;
+}
+
+static void r300SetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+ 
+     rdev->set &= ~state->mod_hw;
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if ((rdev->accel ^ accel) & DFXL_TEXTRIANGLES)
+               rdev->set &= ~SMF_BLITTING_FLAGS;
+     }
+     
+     rdev->accel = accel;
+     
+     r300_set_destination( rdrv, rdev, state );
+     r300_set_clip( rdrv, rdev, state );
+     r300_set_render_options( rdrv, rdev, state );
+    
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               r300_set_drawing_color( rdrv, rdev, state );
+               
+               if (state->drawingflags & DSDRAW_BLEND)
+                    r300_set_blend_function( rdrv, rdev, state );
+               
+               r300_set_drawingflags( rdrv, rdev, state );
+
+               if (RADEON_DRAW_3D()) {  
+                    funcs->FillRectangle = r300FillRectangle3D;
+                    funcs->FillTriangle  = r300FillTriangle;
+                    funcs->DrawRectangle = r300DrawRectangle3D;
+                    funcs->DrawLine      = r300DrawLine3D;
+                    funcs->EmitCommands  = r300EmitCommands3D;
+               } else {
+                    funcs->FillRectangle = RADEON_FUNC(radeonFillRectangle2D);
+                    funcs->FillTriangle  = NULL;
+                    funcs->DrawRectangle = RADEON_FUNC(radeonDrawRectangle2D);
+                    funcs->DrawLine      = RADEON_FUNC(radeonDrawLine2D);
+                    funcs->EmitCommands  = NULL;
+               }
+
+               state->set = rdev->drawing_mask;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+          case DFXL_TEXTRIANGLES:
+               r300_set_source( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_ALPHA)
+                    r300_set_blend_function( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_MODULATE_COLOR)
+                    r300_set_blitting_color( rdrv, rdev, state );
+               
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    r300_set_src_colorkey( rdrv, rdev, state );
+               
+               r300_set_blittingflags( rdrv, rdev, state );
+
+               if (RADEON_BLIT_3D()) {
+                    funcs->Blit             = r300Blit3D;
+                    funcs->StretchBlit      = r300StretchBlit;
+                    funcs->TextureTriangles = r300TextureTriangles;
+                    funcs->EmitCommands     = r300EmitCommands3D;
+               } else { 
+                    funcs->Blit             = RADEON_FUNC(radeonBlit2D);
+                    funcs->StretchBlit      = NULL;
+                    funcs->TextureTriangles = NULL;
+                    funcs->EmitCommands     = NULL;
+               }
+               
+               state->set = (accel & DFXL_TEXTRIANGLES) 
+                            ? : (rdev->blitting_mask & ~DFXL_TEXTRIANGLES);
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+     
+     state->mod_hw = 0;
+}
+
+
+/* chipset detection */
+
+static int 
+radeon_find_chipset( RadeonDriverData *rdrv, int *ret_devid, int *ret_index )
+{
+     volatile u8   *mmio = rdrv->mmio_base;
+     unsigned int   vendor_id;
+     unsigned int   device_id;
+     int            i;
+
+     vendor_id = radeon_in16( mmio, CONFIG_VENDOR_ID );
+     device_id = radeon_in16( mmio, CONFIG_DEVICE_ID );
+     if (vendor_id != 0x1002 || !device_id)
+          dfb_system_get_deviceid( &vendor_id, &device_id );
+        
+     if (vendor_id == 0x1002) {
+          if (ret_devid)
+               *ret_devid = device_id;        
+          
+          for (i = 0; i < D_ARRAY_SIZE( dev_table ); i++) {
+               if ((unsigned int)dev_table[i].id == device_id) {
+                    if (ret_index)
+                         *ret_index = i;
+                    return 1;
+               }
+          }
+     }
+     
+     return 0;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_ATI_RADEON:
+               return 1;
+          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,
+               "ATI Radeon Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Claudio Ciccani" );
+
+     snprintf( info->license,
+               DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+               "LGPL" );
+
+     snprintf( info->url,
+               DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+               "http://www.directfb.org" );
+
+     info->version.major = 1;
+     info->version.minor = 2;
+
+     info->driver_data_size = sizeof(RadeonDriverData);
+     info->device_data_size = sizeof(RadeonDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     RadeonDriverData    *rdrv = (RadeonDriverData*) driver_data;
+     RadeonChipsetFamily  chip = CHIP_UNKNOWN;
+     int                  idx;
+     
+     rdrv->device_data = (RadeonDeviceData*) device_data;
+     
+     /* gain access to memory mapped registers */
+     rdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, 0x4000 );
+     if (!rdrv->mmio_base)
+          return DFB_IO;
+     rdrv->mmio_size = 0x4000;
+     
+     rdrv->fb_base = dfb_gfxcard_memory_virtual( device, 0 );
+
+     if (radeon_find_chipset( rdrv, NULL, &idx ))
+          chip = dev_table[idx].chip;
+
+     if (chip >= CHIP_R300 && !getenv( "R300_DISABLE_3D" )) {
+          volatile void *base;
+          /* increase amount of memory mapped registers */
+          base = dfb_gfxcard_map_mmio( device, 0, 0x8000 );
+          if (!base) {
+               D_ERROR( "DirectFB/Radeon: You are running a buggy version of radeonfb!\n"
+                        "     -> Please, apply the kernel patch named radeonfb-r300fix.\n" );
+               D_INFO( "DirectFB/Radeon: 3D Acceleration will be disabled.\n" );
+          }
+          else {
+               rdrv->mmio_base = base;
+               rdrv->mmio_size = 0x8000;
+          }
+     }
+
+     /* fill function table */
+     funcs->AfterSetVar       = radeonAfterSetVar;
+     funcs->EngineReset       = radeonEngineReset;
+     funcs->EngineSync        = radeonEngineSync;
+     funcs->InvalidateState   = radeonInvalidateState;
+     funcs->FlushTextureCache = radeonFlushTextureCache;
+#ifdef WORDS_BIGENDIAN
+     funcs->SurfaceEnter      = radeonSurfaceEnter;
+     funcs->SurfaceLeave      = radeonSurfaceLeave;
+#endif
+     
+     if (chip >= CHIP_R300) {
+          funcs->CheckState   = r300CheckState;
+          funcs->SetState     = r300SetState;
+     }
+     else if (chip >= CHIP_R200) {
+          funcs->CheckState   = r200CheckState;
+          funcs->SetState     = r200SetState;
+     }
+     else if (chip >= CHIP_R100) {
+          funcs->CheckState   = r100CheckState;
+          funcs->SetState     = r100SetState;
+     }
+     
+     /* primary screen */
+     dfb_screens_hook_primary( device, driver_data, 
+                               &RadeonCrtc1ScreenFuncs,
+                               &OldPrimaryScreenFuncs,
+                               &OldPrimaryScreenDriverData );
+                               
+     /* primary layer */
+     dfb_layers_hook_primary( device, driver_data,
+                              &RadeonCrtc1LayerFuncs,
+                              &OldPrimaryLayerFuncs,
+                              &OldPrimaryLayerDriverData );
+                              
+     /* overlay support */
+     dfb_layers_register( dfb_screens_at( DSCID_PRIMARY ),
+                          driver_data, &RadeonOverlayFuncs );
+                          
+     if (chip != CHIP_R100) {
+          CoreScreen *screen;
+
+          /* secondary screen support */
+          screen = dfb_screens_register( device, driver_data,
+                                         &RadeonCrtc2ScreenFuncs );
+     
+          /* secondary underlay support */     
+          dfb_layers_register( screen, driver_data,
+                               &RadeonCrtc2LayerFuncs );
+         
+          /* secondary overlay support */
+          dfb_layers_register( screen, driver_data,
+                               &RadeonOverlayFuncs );
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) device_data;
+     volatile void    *mmio = rdrv->mmio_base;
+     int               dev  = 0;
+     int               idx  = 0;
+     const char       *name = "Unknown";
+     
+     if (radeon_find_chipset( rdrv, &dev, &idx )) {
+          rdev->chipset = dev_table[idx].chip;
+          rdev->igp     = dev_table[idx].igp;
+          name          = dev_table[idx].name;
+     }
+     else {
+          if (!dev) {
+               D_ERROR( "DirectFB/Radeon: Could not detect device id!\n"
+                        "     -> Please, specify the bus location of"
+                        "        the card by using the 'busid' option.\n" );
+          }         
+          D_INFO( "DirectFB/Radeon: "
+                  "Unknown chipset, disabling acceleration!\n" );
+     }
+     
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, 
+               "%s (%04x)", name, dev );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "ATI" );
+
+     device_info->caps.flags = CCF_CLIPPING | CCF_AUXMEMORY | CCF_RENDEROPTS;
+     
+     if (rdev->chipset >= CHIP_R300) {
+          if (rdrv->mmio_size > 0x4000) {
+               device_info->caps.accel    = R300_SUPPORTED_DRAWINGFUNCS |
+                                            R300_SUPPORTED_BLITTINGFUNCS;
+               device_info->caps.drawing  = R300_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = R300_SUPPORTED_BLITTINGFLAGS;
+          } else {
+               device_info->caps.accel    = RADEON_SUPPORTED_2D_DRAWINGFUNCS |
+                                            RADEON_SUPPORTED_2D_BLITTINGFUNCS;
+               device_info->caps.drawing  = RADEON_SUPPORTED_2D_DRAWINGFLAGS;
+               device_info->caps.blitting = RADEON_SUPPORTED_2D_BLITTINGFLAGS;
+          }
+     }
+     else if (rdev->chipset >= CHIP_R200) {
+          device_info->caps.accel    = R200_SUPPORTED_DRAWINGFUNCS |
+                                       R200_SUPPORTED_BLITTINGFUNCS;
+          device_info->caps.drawing  = R200_SUPPORTED_DRAWINGFLAGS;
+          device_info->caps.blitting = R200_SUPPORTED_BLITTINGFLAGS;
+     }
+     else if (rdev->chipset >= CHIP_R100) {
+          device_info->caps.accel    = R100_SUPPORTED_DRAWINGFUNCS |
+                                       R100_SUPPORTED_BLITTINGFUNCS;
+          device_info->caps.drawing  = R100_SUPPORTED_DRAWINGFLAGS;
+          device_info->caps.blitting = R100_SUPPORTED_BLITTINGFLAGS;
+     }
+
+     device_info->limits.surface_byteoffset_alignment = 32;
+     device_info->limits.surface_pixelpitch_alignment = 64;
+     device_info->limits.surface_bytepitch_alignment  = 128;
+
+     dfb_config->pollvsync_after = 1;
+
+     /* reserve memory for YUV422 color buffer */
+     rdev->yuv422_buffer = dfb_gfxcard_reserve_memory( device, 128 );
+     if (rdev->yuv422_buffer == (u32)-1) {
+          D_ERROR( "DirectFB/Radeon: "
+                   "couldn't reserve 128 bytes of video memory!\n" );
+          return DFB_NOVIDEOMEMORY;
+     }
+
+     rdev->fb_phys = dfb_gfxcard_memory_physical( device, 0 );
+
+     radeon_waitidle( rdrv, rdev );
+
+     /* get connected monitors */
+     radeon_get_monitors( rdrv, rdev, &rdev->monitor1, &rdev->monitor2 );
+
+     /* save the following regs */
+     rdev->mc_fb_location = radeon_in32( mmio, MC_FB_LOCATION );
+     rdev->mc_agp_location = radeon_in32( mmio, MC_AGP_LOCATION );  
+     rdev->crtc_base_addr = radeon_in32( mmio, CRTC_BASE_ADDR );
+     rdev->crtc2_base_addr = radeon_in32( mmio, CRTC2_BASE_ADDR );
+     rdev->agp_base = radeon_in32( mmio, AGP_BASE );
+     rdev->agp_cntl = radeon_in32( mmio, AGP_CNTL );
+     rdev->aic_cntl = radeon_in32( mmio, AIC_CNTL );
+     rdev->bus_cntl = radeon_in32( mmio, BUS_CNTL );
+     rdev->fcp_cntl = radeon_in32( mmio, FCP_CNTL );
+     rdev->cap0_trig_cntl = radeon_in32( mmio, CAP0_TRIG_CNTL );
+     rdev->vid_buffer_control = radeon_in32( mmio, VID_BUFFER_CONTROL );
+     rdev->display_test_debug_cntl = radeon_in32( mmio, DISPLAY_TEST_DEBUG_CNTL );
+     rdev->surface_cntl = radeon_in32( mmio, SURFACE_CNTL ); 
+     rdev->dp_gui_master_cntl = radeon_in32( mmio, DP_GUI_MASTER_CNTL );   
+     
+     rdev->surface_cntl_p = 
+     rdev->surface_cntl_c = rdev->surface_cntl;
+     
+     if (rdev->igp) {
+          u32 tom;
+          /* force MC_FB_LOCATION to NB_TOM */
+          tom = radeon_in32( mmio, NB_TOM );
+          rdev->fb_offset = tom << 16;
+          rdev->fb_size   = ((tom >> 16) - (tom & 0xffff) + 1) << 16;
+     } 
+     else {
+          if (rdev->chipset >= CHIP_R300) {
+               rdev->fb_offset = 0;
+               rdev->fb_size   = radeon_in32( mmio, CONFIG_MEMSIZE );
+          } else {
+               rdev->fb_offset = radeon_in32( mmio, CONFIG_APER_0_BASE ); 
+               rdev->fb_size   = radeon_in32( mmio, CONFIG_APER_SIZE );
+          }
+     }
+     
+     radeon_out32( mmio, MC_FB_LOCATION, (rdev->fb_offset>>16) |
+                        ((rdev->fb_offset + rdev->fb_size - 1) & 0xffff0000) ); 
+
+     D_DEBUG( "DirectFB/Radeon: "
+              "Framebuffer located at 0x%08x:0x%08x.\n",
+              rdev->fb_offset, rdev->fb_offset + rdev->fb_size - 1 );
+ 
+     if (dfb_system_auxram_length()) { 
+          rdev->agp_offset = (rdev->fb_offset + rdev->fb_size) & 0xffc00000;
+          rdev->agp_size   = dfb_system_auxram_length();
+          
+          /* enable AGP support */ 
+          radeon_out32( mmio, AIC_CNTL, rdev->aic_cntl & ~PCIGART_TRANSLATE_EN );
+          radeon_out32( mmio, AGP_BASE, dfb_system_aux_memory_physical( 0 ) );
+          radeon_out32( mmio, AGP_CNTL, rdev->agp_cntl | 0x000e0000 );
+          radeon_out32( mmio, BUS_CNTL, rdev->bus_cntl & ~BUS_MASTER_DIS );
+
+          radeon_out32( mmio, MC_AGP_LOCATION, (rdev->agp_offset>>16) |
+                        ((rdev->agp_offset + rdev->agp_size - 1) & 0xffff0000) );
+          
+          D_DEBUG( "DirectFB/Radeon: "
+                   "AGP Aperture located at 0x%08x:0x%08x.\n",
+                   rdev->agp_offset, rdev->agp_offset + rdev->agp_size - 1 );
+     }
+
+     radeon_out32( mmio, CRTC_BASE_ADDR, rdev->fb_offset );
+     radeon_out32( mmio, DISP_MERGE_CNTL, 0xffff0000 );
+     if (rdev->chipset != CHIP_R100) {
+          radeon_out32( mmio, CRTC2_BASE_ADDR, rdev->fb_offset );
+          radeon_out32( mmio, DISP2_MERGE_CNTL, 0xffff0000 );
+     }
+
+     radeon_out32( mmio, FCP_CNTL, FCP0_SRC_GND );
+     radeon_out32( mmio, CAP0_TRIG_CNTL, 0 );
+     radeon_out32( mmio, VID_BUFFER_CONTROL, 0x00010001 );
+     radeon_out32( mmio, DISPLAY_TEST_DEBUG_CNTL, 0 );
+ 
+     radeon_reset( rdrv, rdev );
+         
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) device_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+    
+     D_DEBUG( "DirectFB/Radeon: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/Radeon:  %9d radeon_waitfifo calls\n",
+              rdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/Radeon:  %9d register writes (radeon_waitfifo sum)\n",
+              rdev->waitfifo_sum );
+     D_DEBUG( "DirectFB/Radeon:  %9d FIFO wait cycles (depends on CPU)\n",
+              rdev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/Radeon:  %9d IDLE wait cycles (depends on CPU)\n",
+              rdev->idle_waitcycles );
+     D_DEBUG( "DirectFB/Radeon:  %9d FIFO space cache hits(depends on CPU)\n",
+              rdev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/Radeon: Conclusion:\n" );
+     D_DEBUG( "DirectFB/Radeon:  Average register writes/radeon_waitfifo call:%.2f\n",
+              rdev->waitfifo_sum / (float)rdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/Radeon:  Average wait cycles/radeon_waitfifo call: %.2f\n",
+              rdev->fifo_waitcycles / (float)rdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/Radeon:  Average fifo space cache hits: %02d%%\n",
+              (int)(100 * rdev->fifo_cache_hits / (float)rdev->waitfifo_calls) );
+
+     radeon_reset( rdrv, rdev );
+
+     /* restore previously saved regs */
+     radeon_out32( mmio, MC_FB_LOCATION, rdev->mc_fb_location );
+     radeon_out32( mmio, MC_AGP_LOCATION, rdev->mc_agp_location ); 
+     radeon_out32( mmio, CRTC_BASE_ADDR, rdev->crtc_base_addr );
+     radeon_out32( mmio, CRTC2_BASE_ADDR, rdev->crtc2_base_addr );
+     radeon_out32( mmio, AGP_CNTL, rdev->agp_cntl );
+     radeon_out32( mmio, AGP_BASE, rdev->agp_base );
+     radeon_out32( mmio, AIC_CNTL, rdev->aic_cntl );
+     radeon_out32( mmio, BUS_CNTL, rdev->bus_cntl );
+     radeon_out32( mmio, FCP_CNTL, rdev->fcp_cntl );
+     radeon_out32( mmio, CAP0_TRIG_CNTL, rdev->cap0_trig_cntl );
+     radeon_out32( mmio, VID_BUFFER_CONTROL, rdev->vid_buffer_control );
+     radeon_out32( mmio, DISPLAY_TEST_DEBUG_CNTL, rdev->display_test_debug_cntl );
+     radeon_out32( mmio, SURFACE_CNTL, rdev->surface_cntl );
+     
+     radeon_waitfifo( rdrv, rdev, 3 );
+     radeon_out32( mmio, SC_TOP_LEFT, 0 );
+     radeon_out32( mmio, DEFAULT_SC_BOTTOM_RIGHT, DEFAULT_SC_RIGHT_MAX |
+                                                  DEFAULT_SC_BOTTOM_MAX );
+     radeon_out32( mmio, DP_GUI_MASTER_CNTL, rdev->dp_gui_master_cntl );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+    RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+
+    dfb_gfxcard_unmap_mmio( device, rdrv->mmio_base, rdrv->mmio_size );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon.h b/Source/DirectFB/gfxdrivers/radeon/radeon.h
new file mode 100755
index 0000000..037c892
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon.h
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_H__
+#define __RADEON_H__
+
+#include <dfb_types.h>
+
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/screens.h>
+#include <core/layers.h>
+
+
+typedef enum {
+     CHIP_UNKNOWN = 0,
+     CHIP_R100,
+     CHIP_RV100,
+     CHIP_RS100,
+     CHIP_RV200,
+     CHIP_RS200,
+     CHIP_RS250,
+     CHIP_R200,
+     CHIP_RV250,
+     CHIP_RV280,
+     CHIP_RS300,
+     CHIP_RS350,
+     CHIP_R300,
+     CHIP_R350,
+     CHIP_RV350,
+     CHIP_RV380,
+     CHIP_R420,
+     CHIP_RV410,
+     CHIP_RS400,
+} RadeonChipsetFamily;
+
+typedef enum {
+     MT_NONE = 0,
+     MT_CRT  = 1,
+     MT_DFP  = 2,
+     MT_LCD  = 3,
+     MT_CTV  = 4,
+     MT_STV  = 5
+} RadeonMonitorType;
+
+typedef struct { 
+     /* validated flags */
+     StateModificationFlags  set;
+     /* current function */
+     DFBAccelerationMask     accel;
+     /* mask of currently supported drawing functions */
+     DFBAccelerationMask     drawing_mask;
+     /* mask of currently supported blitting functions */
+     DFBAccelerationMask     blitting_mask;
+
+     unsigned long           fb_phys;
+     u32                     fb_offset;
+     u32                     fb_size;
+     u32                     agp_offset;
+     u32                     agp_size;
+     
+     DFBSurfacePixelFormat   dst_format;
+     u32                     dst_offset;
+     u32                     dst_offset_cb;
+     u32                     dst_offset_cr;
+     u32                     dst_pitch;
+     DFBBoolean              dst_422;
+     
+     DFBSurfacePixelFormat   src_format;
+     u32                     src_offset;
+     u32                     src_offset_cb;
+     u32                     src_offset_cr;
+     u32                     src_pitch;
+     u32                     src_width;
+     u32                     src_height;
+     u32                     src_mask;
+     
+     DFBSurfacePixelFormat   msk_format;
+     u32                     msk_offset;
+     u32                     msk_pitch;
+     u32                     msk_width;
+     u32                     msk_height;
+
+     DFBRegion               clip;
+
+     float                   color[4];
+     u32                     y_cop;
+     u32                     cb_cop;
+     u32                     cr_cop;
+
+     DFBSurfaceRenderOptions render_options;
+     DFBSurfaceDrawingFlags  drawingflags;
+     DFBSurfaceBlittingFlags blittingflags;
+     
+     const s32              *matrix;
+     DFBBoolean              affine_matrix;
+     
+     /* chipset identified */
+     RadeonChipsetFamily     chipset;
+     DFBBoolean              igp;
+     
+     /* connected monitors */
+     RadeonMonitorType       monitor1;
+     RadeonMonitorType       monitor2;
+ 
+     /* saved registers */
+     u32                     mc_fb_location;
+     u32                     mc_agp_location;
+     u32                     crtc_base_addr;
+     u32                     crtc2_base_addr;
+     u32                     agp_base;
+     u32                     agp_cntl;
+     u32                     aic_cntl;
+     u32                     bus_cntl;
+     u32                     fcp_cntl;
+     u32                     cap0_trig_cntl;
+     u32                     vid_buffer_control;
+     u32                     display_test_debug_cntl;
+     u32                     surface_cntl;
+     u32                     dp_gui_master_cntl;
+
+     /* recorded registers */
+     u32                     surface_cntl_p;
+     u32                     surface_cntl_c;
+     u32                     gui_master_cntl;
+     u32                     rb3d_cntl;
+     u32                     rb3d_blend;
+
+     /* faked texture for YUV422 drawing functions */
+     u32                     yuv422_buffer;
+     
+     /* vertex buffer */
+     u32                     vb[1024];
+     u32                     vb_size;
+     u32                     vb_count;
+     u32                     vb_type;
+     
+     /* for fifo/performance monitoring */
+     unsigned int            fifo_space;
+     
+     unsigned int            waitfifo_sum;
+     unsigned int            waitfifo_calls;
+     unsigned int            fifo_waitcycles;
+     unsigned int            idle_waitcycles;
+     unsigned int            fifo_cache_hits;
+} RadeonDeviceData;
+
+typedef struct {
+     RadeonDeviceData       *device_data; 
+     
+     u8                     *fb_base;
+     volatile u8            *mmio_base;
+     unsigned int            mmio_size;
+} RadeonDriverData;
+
+
+extern void radeon_reset( RadeonDriverData *rdrv, RadeonDeviceData *rdev );
+
+extern ScreenFuncs        RadeonCrtc1ScreenFuncs;
+extern ScreenFuncs        OldPrimaryScreenFuncs;
+extern void              *OldPrimaryScreenDriverData;
+
+extern DisplayLayerFuncs  RadeonCrtc1LayerFuncs;
+extern DisplayLayerFuncs  OldPrimaryLayerFuncs;
+extern void              *OldPrimaryLayerDriverData;
+
+extern DisplayLayerFuncs  RadeonOverlayFuncs;
+
+extern ScreenFuncs        RadeonCrtc2ScreenFuncs;
+
+extern DisplayLayerFuncs  RadeonCrtc2LayerFuncs;
+
+
+/* utility function */
+static __inline__ u32 f2d( float f )
+{
+     union { float f; u32 d; } tmp;
+     tmp.f = f;
+     return tmp.d;
+}
+
+static __inline__ float d2f( u32 d )
+{
+     union { float f; u32 d; } tmp;
+     tmp.d = d;
+     return tmp.f;
+}
+
+#define RADEON_TRANSFORM(x, y, retx, rety, m, affine) \
+ do { \
+     float _x, _y, _w; \
+     if (affine) { \
+          _x = ((x) * m[0] + (y) * m[1] + m[2]) / 65536.f; \
+          _y = ((x) * m[3] + (y) * m[4] + m[5]) / 65536.f; \
+     } \
+     else { \
+          _w = ((x) * m[6] + (y) * m[7] + m[8]); \
+          _x = ((x) * m[0] + (y) * m[1] + m[2]) / _w; \
+          _y = ((x) * m[3] + (y) * m[4] + m[5]) / _w; \
+     } \
+     retx = _x; rety = _y; \
+ } while(0)
+
+
+#endif /* __RADEON_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_2d.c b/Source/DirectFB/gfxdrivers/radeon/radeon_2d.c
new file mode 100755
index 0000000..acee7aa
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_2d.c
@@ -0,0 +1,397 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <dfb_types.h>
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+#include "radeon_2d.h"
+
+
+static void
+radeonDoFillRectangle2D( RadeonDriverData *rdrv,
+                         RadeonDeviceData *rdev,
+                         DFBRectangle     *rect )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     radeon_waitfifo( rdrv, rdev, 2 );
+     
+     radeon_out32( mmio, DST_Y_X, (rect->y << 16) |
+                                (rect->x & 0x3fff) );
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) |
+                                         (rect->w & 0x3fff) );
+}
+
+bool radeonFillRectangle2D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+
+     if (rdev->dst_422) {
+          rect->x /= 2;
+          rect->w  = (rect->w+1) >> 1;
+     }
+
+     radeonDoFillRectangle2D( rdrv, rdev, rect );
+
+     return true;
+}
+
+bool radeonFillRectangle2D_420( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     DFBRegion        *clip = &rdev->clip;
+     volatile u8      *mmio = rdrv->mmio_base;
+
+     /* Fill Luma plane */
+     radeonDoFillRectangle2D( rdrv, rdev, rect );
+
+     /* Scale coordinates */
+     rect->x /= 2;
+     rect->y /= 2;
+     rect->w  = (rect->w+1) >> 1;
+     rect->h  = (rect->h+1) >> 1;
+
+     /* Prepare Cb plane */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cb );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch/2 );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1/2 << 16) |
+                                      (clip->x1/2 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1)/2 << 16) |
+                                          ((clip->x2+1)/2 & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cb_cop );
+
+     /* Fill Cb plane */
+     radeonDoFillRectangle2D( rdrv, rdev, rect );
+     
+     /* Prepare Cr plane */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cr );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cr_cop );
+
+     /* Fill Cr plane */
+     radeonDoFillRectangle2D( rdrv, rdev, rect );
+
+     /* Reset */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1 << 16) |
+                                      (clip->x1 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1) << 16) |
+                                          ((clip->x2+1) & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->y_cop );
+          
+     return true;
+}
+
+static void
+radeonDoDrawRectangle2D( RadeonDriverData *rdrv,
+                         RadeonDeviceData *rdev,
+                         DFBRectangle     *rect )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     
+     radeon_waitfifo( rdrv, rdev, 7 );
+     
+     /* left line */
+     radeon_out32( mmio, DST_Y_X, (rect->y << 16) | (rect->x & 0x3fff) );
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) | 1 );
+     /* top line */
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | (rect->w & 0xffff) );
+     /* bottom line */
+     radeon_out32( mmio, DST_Y_X, ((rect->y+rect->h-1) << 16) | (rect->x & 0x3fff) );
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (1 << 16) | (rect->w & 0xffff) );
+     /* right line */
+     radeon_out32( mmio, DST_Y_X, (rect->y << 16) | ((rect->x+rect->w-1) & 0x3fff) );
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (rect->h << 16) | 1 );
+}
+
+bool radeonDrawRectangle2D( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+
+     if (rdev->dst_422) {
+          rect->x /= 2;
+          rect->w  = (rect->w+1) >> 1;
+     }
+
+     radeonDoDrawRectangle2D( rdrv, rdev, rect );
+
+     return true;
+}
+
+bool radeonDrawRectangle2D_420( void *drv, void *dev, DFBRectangle *rect )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     DFBRegion        *clip = &rdev->clip;
+     volatile u8      *mmio = rdrv->mmio_base;
+
+     /* Fill Luma plane */
+     radeonDoDrawRectangle2D( rdrv, rdev, rect );
+
+     /* Scale coordinates */
+     rect->x  /= 2;
+     rect->y  /= 2;
+     rect->w >>= 1;
+     rect->h >>= 1;
+
+     /* Prepare Cb plane */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cb );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch/2 );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1/2 << 16) |
+                                      (clip->x1/2 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1)/2 << 16) |
+                                          ((clip->x2+1)/2 & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cb_cop );
+
+     /* Fill Cb plane */
+     radeonDoDrawRectangle2D( rdrv, rdev, rect );
+     
+     /* Prepare Cr plane */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cr );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cr_cop );
+
+     /* Fill Cr plane */
+     radeonDoDrawRectangle2D( rdrv, rdev, rect );
+
+     /* Reset */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1 << 16) |
+                                      (clip->x1 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1) << 16) |
+                                          ((clip->x2+1) & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->y_cop );
+     
+     return true;
+}
+
+static void
+radeonDoDrawLine2D( RadeonDriverData *rdrv,
+                    RadeonDeviceData *rdev,
+                    DFBRegion        *line )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+
+     radeon_waitfifo( rdrv, rdev, 2 );
+     
+     radeon_out32( mmio, DST_LINE_START, (line->y1 << 16) | 
+                                       (line->x1 & 0xffff) );
+     radeon_out32( mmio, DST_LINE_END, (line->y2 << 16) |
+                                     (line->x2 & 0xffff) );
+}
+
+bool radeonDrawLine2D( void *drv, void *dev, DFBRegion *line )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+
+     if (rdev->dst_422) {
+          line->x1 /= 2;
+          line->x2  = (line->x2+1) / 2;
+     }
+     
+     radeonDoDrawLine2D( rdrv, rdev, line );
+
+     return true;
+}
+
+bool radeonDrawLine2D_420( void *drv, void *dev, DFBRegion *line )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+     DFBRegion        *clip = &rdev->clip;
+     volatile u8      *mmio = rdrv->mmio_base;
+     
+     line->x1 &= ~1;
+     line->y1 &= ~1;
+     line->x2 &= ~1;
+     line->y2 &= ~1;
+
+     /* Fill Luma plane */
+     radeonDoDrawLine2D( rdrv, rdev, line );
+
+     /* Scale coordinates */
+     line->x1 /= 2;
+     line->y1 /= 2;
+     line->x2 /= 2;
+     line->y2 /= 2;
+          
+     /* Prepare Cb plane */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cb );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch/2 );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1/2 << 16) |
+                                      (clip->x1/2 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1)/2 << 16) |
+                                          ((clip->x2+1)/2 & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cb_cop );
+
+     /* Fill Cb plane */
+     radeonDoDrawLine2D( rdrv, rdev, line );
+     
+     /* Prepare Cr plane */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cr );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->cr_cop );
+
+     /* Fill Cr plane */
+     radeonDoDrawLine2D( rdrv, rdev, line );
+
+     /* Reset */
+     radeon_waitfifo( rdrv, rdev, 5 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1 << 16) |
+                                      (clip->x1 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1) << 16) |
+                                          ((clip->x2+1) & 0xffff) );
+     radeon_out32( mmio, DP_BRUSH_FRGD_CLR, rdev->y_cop );
+          
+     return true;
+}
+
+static void 
+radeonDoBlit2D( RadeonDriverData *rdrv, RadeonDeviceData *rdev,
+                int sx, int sy, int dx, int dy, int w, int h )
+{
+     volatile u8   *mmio = rdrv->mmio_base;
+     u32            dir  = 0;
+     
+     /* check which blitting direction should be used */
+     if (sx <= dx) {
+          sx += w-1;
+          dx += w-1;
+     } else
+          dir |= DST_X_LEFT_TO_RIGHT;
+
+     if (sy <= dy) {
+          sy += h-1;
+          dy += h-1;
+     } else
+          dir |= DST_Y_TOP_TO_BOTTOM;
+
+     radeon_waitfifo( rdrv, rdev, 4 ); 
+     
+     radeon_out32( mmio, DP_CNTL, dir ); 
+     radeon_out32( mmio, SRC_Y_X,          (sy << 16) | (sx & 0x3fff) );
+     radeon_out32( mmio, DST_Y_X,          (dy << 16) | (dx & 0x3fff) );
+     radeon_out32( mmio, DST_HEIGHT_WIDTH, (h  << 16) | (w  & 0x3fff) );
+}
+
+bool radeonBlit2D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;
+
+     if (rdev->dst_422) {
+          sr->x /= 2;
+          sr->w  = (sr->w+1) >> 1;
+          dx    /= 2;
+     }
+
+     radeonDoBlit2D( rdrv, rdev, sr->x, sr->y, dx, dy, sr->w, sr->h );
+
+     return true;
+}
+
+bool radeonBlit2D_420( void *drv, void *dev, DFBRectangle *sr, int dx, int dy )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) drv;
+     RadeonDeviceData *rdev = (RadeonDeviceData*) dev;  
+     DFBRegion        *clip = &rdev->clip;
+     volatile u8      *mmio = rdrv->mmio_base;
+
+     /* Blit Luma plane */
+     radeonDoBlit2D( rdrv, rdev, sr->x, sr->y, dx, dy, sr->w, sr->h );
+
+     /* Scale coordinates */
+     sr->x /= 2;
+     sr->y /= 2;
+     sr->w  = (sr->w+1) >> 1;
+     sr->h  = (sr->h+1) >> 1;
+     dx    /= 2;
+     dy    /= 2;
+     
+     /* Prepare Cb plane */
+     radeon_waitfifo( rdrv, rdev, 6 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cb );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch/2 );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset_cb );
+     radeon_out32( mmio, SRC_PITCH, rdev->src_pitch/2 );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1/2 << 16) |
+                                    (clip->x1/2 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1/2) << 16) |
+                                        ((clip->x2+1/2) & 0xffff) );
+
+     /* Blit Cb plane */
+     radeonDoBlit2D( rdrv, rdev, sr->x, sr->y, dx, dy, sr->w, sr->h );
+     
+     /* Prepare Cr plane */
+     radeon_waitfifo( rdrv, rdev, 2 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset_cr );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset_cr );
+
+     /* Blit Cr plane */
+     radeonDoBlit2D( rdrv, rdev, sr->x, sr->y, dx, dy, sr->w, sr->h );
+     
+     /* Reset */
+     radeon_waitfifo( rdrv, rdev, 6 );
+     radeon_out32( mmio, DST_OFFSET, rdev->dst_offset );
+     radeon_out32( mmio, DST_PITCH, rdev->dst_pitch );
+     radeon_out32( mmio, SRC_OFFSET, rdev->src_offset );
+     radeon_out32( mmio, SRC_PITCH, rdev->src_pitch );
+     radeon_out32( mmio, SC_TOP_LEFT, (clip->y1 << 16) |
+                                    (clip->x1 & 0xffff) );
+     radeon_out32( mmio, SC_BOTTOM_RIGHT, ((clip->y2+1) << 16) |
+                                        ((clip->x2+1) & 0xffff) );
+
+     return true;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_2d.h b/Source/DirectFB/gfxdrivers/radeon/radeon_2d.h
new file mode 100755
index 0000000..9277f85
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_2d.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_2D_H__
+#define __RADEON_2D_H__
+
+bool radeonFillRectangle2D( void *drv, void *dev, DFBRectangle *rect );
+bool radeonFillRectangle2D_420( void *drv, void *dev, DFBRectangle *rect );
+
+bool radeonDrawRectangle2D( void *drv, void *dev, DFBRectangle *rect );
+bool radeonDrawRectangle2D_420( void *drv, void *dev, DFBRectangle *rect );
+
+bool radeonDrawLine2D( void *drv, void *dev, DFBRegion *line );
+bool radeonDrawLine2D_420( void *drv, void *dev, DFBRegion *line );
+
+bool radeonBlit2D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy );
+bool radeonBlit2D_420( void *drv, void *dev, DFBRectangle *sr, int dx, int dy );
+
+#endif /* __RADEON_2D_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_3d.h b/Source/DirectFB/gfxdrivers/radeon/radeon_3d.h
new file mode 100755
index 0000000..0504dbc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_3d.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_3D_H__
+#define __RADEON_3D_H__
+
+/* R100 Functions */
+bool r100FillRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r100FillTriangle( void *drv, void *dev, DFBTriangle *tri );
+
+bool r100DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r100DrawLine3D( void *drv, void *dev, DFBRegion *line );
+
+bool r100Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy );
+
+bool r100StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr );
+
+bool r100TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation );
+          
+void r100EmitCommands3D( void *drv, void *dev );
+                                                                  
+/* R200 Functions */
+bool r200FillRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r200FillTriangle( void *drv, void *dev, DFBTriangle *tri );
+
+bool r200DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r200DrawLine3D( void *drv, void *dev, DFBRegion *line );
+
+bool r200Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy );
+
+bool r200StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr );
+
+bool r200TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation );
+
+void r200EmitCommands3D( void *drv, void *dev );
+
+/* R300 Functions */
+bool r300FillRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r300FillTriangle( void *drv, void *dev, DFBTriangle *tri );
+
+bool r300DrawRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+
+bool r300DrawLine3D( void *drv, void *dev, DFBRegion *line );
+
+bool r300Blit3D( void *drv, void *dev, DFBRectangle *sr, int dx, int dy );
+
+bool r300StretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr );
+
+bool r300TextureTriangles( void *drv, void *dev, DFBVertex *ve,
+                           int num, DFBTriangleFormation formation );
+
+void r300EmitCommands3D( void *drv, void *dev );
+                               
+
+#endif /* __RADEON_3D_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_chipsets.h b/Source/DirectFB/gfxdrivers/radeon/radeon_chipsets.h
new file mode 100755
index 0000000..52f38f1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_chipsets.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_CHIPSETS_H__
+#define __RADEON_CHIPSETS_H__
+
+static const struct {
+     u16         id;
+     u16         chip;
+     bool        igp;
+     const char *name;
+} dev_table[] = {
+     { 0x5144, CHIP_R100 , false, "Radeon" },
+     { 0x5145, CHIP_R100 , false, "Radeon" },
+     { 0x5146, CHIP_R100 , false, "Radeon" },
+     { 0x5147, CHIP_R100 , false, "Radeon" },
+     { 0x5159, CHIP_RV100, false, "Radeon VE/7000" },
+     { 0x515a, CHIP_RV100, false, "Radeon VE/7000" },
+     { 0x4c59, CHIP_RV100, false, "Radeon Mobility M6" },
+     { 0x4c5a, CHIP_RV100, false, "Radeon Mobility M6" },
+     { 0x4c57, CHIP_RV200, false, "Radeon Mobility M7" },
+     { 0x4c58, CHIP_RV200, false, "FireGL Mobility 7800 M7" },
+     { 0x5157, CHIP_RV200, false, "Radeon 7500" },
+     { 0x5158, CHIP_RV200, false, "Radeon 7500" },
+     { 0x4136, CHIP_RS100, true , "Radeon IGP320" },
+     { 0x4336, CHIP_RS100, true , "Radeon IGP320M" },
+     { 0x4137, CHIP_RS200, true , "Radeon IGP330/340/350" },
+     { 0x4337, CHIP_RS200, true , "Radeon IGP330M/340M/350M" },
+     { 0x4237, CHIP_RS250, true , "Radeon 7000 IGP" },
+     { 0x4437, CHIP_RS250, true , "Radeon Mobility 7000 IGP" },
+     { 0x514c, CHIP_R200 , false, "Radeon 8500" },
+     { 0x4242, CHIP_R200 , false, "Radeon 8500 AIW" },
+     { 0x4243, CHIP_R200 , false, "Radeon 8500 AIW" },
+     { 0x514d, CHIP_R200 , false, "Radeon 9100" },
+     { 0x5148, CHIP_R200 , false, "FireGL 8700/8800" },
+     { 0x4966, CHIP_RV250, false, "Radeon 9000 PRO" },
+     { 0x4967, CHIP_RV250, false, "Radeon 9000" },
+     { 0x4c66, CHIP_RV250, false, "Radeon Mobility 9000 M9" },
+     { 0x4c67, CHIP_RV250, false, "Radeon Mobility 9000 M9" },
+     { 0x4c64, CHIP_RV250, false, "FireGL Mobility 9000 M9" },
+     { 0x5960, CHIP_RV280, false, "Radeon 9200 PRO" },
+     { 0x5961, CHIP_RV280, false, "Radeon 9200" },
+     { 0x5962, CHIP_RV280, false, "Radeon 9200" },
+     { 0x5964, CHIP_RV280, false, "Radeon 9200 SE" },
+     { 0x5c61, CHIP_RV280, false, "Radeon Mobility 9200 M9+" },
+     { 0x5c63, CHIP_RV280, false, "Radeon Mobility 9200 M9+" },
+     { 0x5834, CHIP_RS300, true , "Radeon 9100 IGP" },
+     { 0x5835, CHIP_RS300, true , "Radeon Mobility 9100 IGP" },
+     { 0x7834, CHIP_RS350, true , "Radeon 9100 PRO IGP" },
+     { 0x7835, CHIP_RS350, true , "Radeon Mobility 9200 IGP" }, 
+     { 0x4144, CHIP_R300 , false, "Radeon 9500" },
+     { 0x4145, CHIP_R300 , false, "Radeon 9500" },
+     { 0x4146, CHIP_R300 , false, "Radeon 9600 TX" },
+     { 0x4147, CHIP_R300 , false, "FireGL Z1" },
+     { 0x4e44, CHIP_R300 , false, "Radeon 9700 PRO" },
+     { 0x4e45, CHIP_R300 , false, "Radeon 9700/9500PRO" },
+     { 0x4e46, CHIP_R300 , false, "Radeon 9600 TX" },
+     { 0x4e47, CHIP_R300 , false, "FireGL X1" },
+     { 0x4150, CHIP_RV350, false, "Radeon 9600" },
+     { 0x4151, CHIP_RV350, false, "Radeon 9600 SE" },
+     { 0x4152, CHIP_RV350, false, "Radeon 9600 XT" },
+     { 0x4153, CHIP_RV350, false, "Radeon 9600" },
+     { 0x4154, CHIP_RV350, false, "FireGL T2" },
+     { 0x4156, CHIP_RV350, false, "FireGL RV360" },
+     { 0x4e50, CHIP_RV350, false, "Radeon Mobility 9600/9700 M10/M11" },
+     { 0x4e51, CHIP_RV350, false, "Radeon Mobility 9600 M10" },
+     { 0x4e52, CHIP_RV350, false, "Radeon Mobility 9600 M11" },
+     { 0x4e53, CHIP_RV350, false, "Radeon Mobility 9600 M10" },
+     { 0x4e54, CHIP_RV350, false, "FireGL Mobility T2 M10" },
+     { 0x4e56, CHIP_RV350, false, "FireGL Mobility T2e M11" },
+     { 0x4155, CHIP_RV350, false, "Radeon 9650" },
+     { 0x4148, CHIP_R350 , false, "Radeon 9800 SE" },
+     { 0x4149, CHIP_R350 , false, "Radeon 9800" },
+     { 0x414a, CHIP_R350 , false, "Radeon 9800" },
+     { 0x414b, CHIP_R350 , false, "FireGL X2" },
+     { 0x4e48, CHIP_R350 , false, "Radeon 9800 PRO" },
+     { 0x4e49, CHIP_R350 , false, "Radeon 9800" },
+     { 0x4e4b, CHIP_R350 , false, "FireGL X2" },
+     { 0x4e4a, CHIP_R350 , false, "Radeon 9800 XT" },
+     { 0x3e50, CHIP_RV380, false, "Radeon X600" },
+     { 0x3e54, CHIP_RV380, false, "FireGL V3200" },
+     { 0x3150, CHIP_RV380, false, "Radeon Mobility X600 M24" },
+     { 0x3152, CHIP_RV380, false, "Radeon Mobility X300 M24" },
+     { 0x3154, CHIP_RV380, false, "FireGL M24 GL" },
+     { 0x5b60, CHIP_RV380, false, "Radeon X300" },
+     { 0x5b62, CHIP_RV380, false, "Radeon X600" },
+     { 0x5b63, CHIP_RV380, false, "Radeon X550" },
+     { 0x5b64, CHIP_RV380, false, "FireGL V3100" },
+     { 0x5b65, CHIP_RV380, false, "FireMV 2200 PCIE" },
+     { 0x5460, CHIP_RV380, false, "Radeon Mobility X300 M22" },
+     { 0x5462, CHIP_RV380, false, "Radeon Mobility X600 SE M24C" },
+     { 0x5464, CHIP_RV380, false, "FireGL M22 GL" },
+     { 0x5a41, CHIP_RS400, false, "Radeon XPRESS 200" },
+     { 0x5a42, CHIP_RS400, false, "Radeon XPRESS 200M" },
+     { 0x5a61, CHIP_RS400, false, "Radeon XPRESS 200" },
+     { 0x5a62, CHIP_RS400, false, "Radeon XPRESS 200M" },
+     { 0x5954, CHIP_RS400, false, "Radeon XPRESS 200" },
+     { 0x5955, CHIP_RS400, false, "Radeon XPRESS 200M" },
+     { 0x5974, CHIP_RS400, false, "Radeon XPRESS 200" },
+     { 0x5975, CHIP_RS400, false, "Radeon XPRESS 200M" },
+     { 0x5e48, CHIP_RV410, false, "FireGL V5000" },
+     { 0x564a, CHIP_RV410, false, "Mobility FireGL V5000 M26" },
+     { 0x564b, CHIP_RV410, false, "Mobility FireGL V5000 M26" },
+     { 0x564f, CHIP_RV410, false, "Mobility Radeon X700 XL M26" },
+     { 0x5652, CHIP_RV410, false, "Mobility Radeon X700 M26" },
+     { 0x5653, CHIP_RV410, false, "Mobility Radeon X700 M26" },
+     { 0x5e4b, CHIP_RV410, false, "Radeon X700 PRO" },
+     { 0x5e4a, CHIP_RV410, false, "Radeon X700 XT" },
+     { 0x5e4d, CHIP_RV410, false, "Radeon X700" },
+     { 0x5e4c, CHIP_RV410, false, "Radeon X700 SE" },
+     { 0x5e4f, CHIP_RV410, false, "Radeon X700 SE" },
+     { 0x4a48, CHIP_R420 , false, "Radeon X800" },
+     { 0x4a49, CHIP_R420 , false, "Radeon X800 PRO" },
+     { 0x4a4a, CHIP_R420 , false, "Radeon X800 SE" },
+     { 0x4a4b, CHIP_R420 , false, "Radeon X800" },
+     { 0x4a4c, CHIP_R420 , false, "Radeon X800" },
+     { 0x4a4d, CHIP_R420 , false, "FireGL X3" },
+     { 0x4a4e, CHIP_R420 , false, "Radeon Mobility 9800 M18" },
+     { 0x4a50, CHIP_R420 , false, "Radeon X800 XT" },
+     { 0x4a4f, CHIP_R420 , false, "Radeon X800 SE" },
+     { 0x4a54, CHIP_R420 , false, "Radeon AIW X800" },
+     { 0x5548, CHIP_R420 , false, "Radeon X800" },
+     { 0x5549, CHIP_R420 , false, "Radeon X800 PRO" },
+     { 0x554a, CHIP_R420 , false, "Radeon X800 LE" },
+     { 0x554b, CHIP_R420 , false, "Radeon X800 SE" },
+     { 0x5551, CHIP_R420 , false, "FireGL V5100" },
+     { 0x5552, CHIP_R420 , false, "FireGL Unknown" },
+     { 0x5554, CHIP_R420 , false, "FireGL Unknown" },
+     { 0x5d57, CHIP_R420 , false, "Radeon X800 XT" },
+     { 0x5550, CHIP_R420 , false, "FireGL V7100" },
+     { 0x5d49, CHIP_R420 , false, "Mobility FireGL V5100 M28" },
+     { 0x5d4a, CHIP_R420 , false, "Mobility Radeon X800 M28" },
+     { 0x5d48, CHIP_R420 , false, "Mobility Radeon X800 XT M28" },
+     { 0x554f, CHIP_R420 , false, "Radeon X800" },
+     { 0x554d, CHIP_R420 , false, "Radeon X800 XL" },
+     { 0x554e, CHIP_R420 , false, "Radeon X800 SE" },
+     { 0x554c, CHIP_R420 , false, "Radeon X800 XTP" },
+     { 0x5d4c, CHIP_R420 , false, "Radeon X850" },
+     { 0x5d50, CHIP_R420 , false, "Radeon Unknown R480" },
+     { 0x5d4e, CHIP_R420 , false, "Radeon X850 SE" },
+     { 0x5d4f, CHIP_R420 , false, "Radeon X850 PRO" },
+     { 0x5d52, CHIP_R420 , false, "Radeon X850 XT" },
+     { 0x5d4d, CHIP_R420 , false, "Radeon X850 XT PE" },
+     { 0x4b4b, CHIP_R420 , false, "Radeon X850 PRO" },
+     { 0x4b4a, CHIP_R420 , false, "Radeon X850 SE" },
+     { 0x4b49, CHIP_R420 , false, "Radeon X850 XT" },
+     { 0x4b4c, CHIP_R420 , false, "Radeon X850 XT PE" }
+};
+
+#endif /* __RADEON_CHIPSETS_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_crtc1.c b/Source/DirectFB/gfxdrivers/radeon/radeon_crtc1.c
new file mode 100755
index 0000000..c4b1610
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_crtc1.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/layers.h>
+#include <core/layer_context.h>
+#include <core/layer_region.h>
+#include <core/layer_control.h>
+#include <core/layers_internal.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+
+
+
+/*************************** CRTC1 Screen functions **************************/
+
+static DFBResult
+crtc1WaitVSync( CoreScreen *screen,
+                void       *driver_data,
+                void       *screen_data )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+     int               i;
+     
+     if (dfb_config->pollvsync_none)
+          return DFB_OK;
+          
+     radeon_out32( mmio, GEN_INT_STATUS, 
+          (radeon_in32( mmio, GEN_INT_STATUS ) & ~VSYNC_INT) | VSYNC_INT_AK );
+     
+     for (i = 0; i < 2000000; i++) {
+          struct timespec t = { 0, 10000 };     
+          
+          if (radeon_in32( mmio, GEN_INT_STATUS ) & VSYNC_INT)
+               break;
+          nanosleep( &t, NULL );
+     }
+
+     return DFB_OK;
+}
+
+ScreenFuncs RadeonCrtc1ScreenFuncs = {
+     .WaitVSync = crtc1WaitVSync
+};
+
+ScreenFuncs  OldPrimaryScreenFuncs;
+void        *OldPrimaryScreenDriverData;
+
+
+/*************************** CRTC1 Layer functions **************************/
+
+#define CRTC1_SUPPORTED_OPTIONS ( DLOP_ALPHACHANNEL )
+
+static DFBResult
+crtc1InitLayer( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                DFBDisplayLayerDescription *description,
+                DFBDisplayLayerConfig      *config,
+                DFBColorAdjustment         *adjustment )
+{
+     DFBResult ret;
+     
+     ret = OldPrimaryLayerFuncs.InitLayer( layer,
+                                           OldPrimaryLayerDriverData,
+                                           layer_data, description,
+                                           config, adjustment );
+                                          
+     description->caps |= DLCAPS_ALPHACHANNEL;
+     
+     return ret;
+}
+
+static DFBResult
+crtc1TestRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfig      layer_config;
+     CoreLayerRegionConfigFlags fail = 0;
+     DFBResult                  ret;
+         
+     layer_config = *config;
+     layer_config.options &= ~CRTC1_SUPPORTED_OPTIONS;
+     
+     ret = OldPrimaryLayerFuncs.TestRegion( layer,
+                                            OldPrimaryLayerDriverData,
+                                            layer_data, &layer_config, &fail );
+      
+     if (config->options & ~CRTC1_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+          
+     if (config->options & DLOP_ALPHACHANNEL && config->format != DSPF_ARGB)
+          fail |= CLRCF_OPTIONS;
+     
+     if (failed)
+          *failed = fail;
+          
+     return fail ? DFB_UNSUPPORTED : DFB_OK;
+}
+
+static DFBResult
+crtc1SetRegion( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                void                       *region_data,
+                CoreLayerRegionConfig      *config,
+                CoreLayerRegionConfigFlags  updated,
+                CoreSurface                *surface,
+                CorePalette                *palette,
+                CoreSurfaceBufferLock      *lock )
+{
+     
+     if (updated & ~CLRCF_OPTIONS) {
+          return OldPrimaryLayerFuncs.SetRegion( layer,
+                                                 OldPrimaryLayerDriverData,
+                                                 layer_data, region_data,
+                                                 config, updated, surface, palette, lock );
+     }
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs RadeonCrtc1LayerFuncs = {
+     .InitLayer  = crtc1InitLayer,
+     .TestRegion = crtc1TestRegion,
+     .SetRegion  = crtc1SetRegion
+};
+
+DisplayLayerFuncs  OldPrimaryLayerFuncs;
+void              *OldPrimaryLayerDriverData;
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_crtc2.c b/Source/DirectFB/gfxdrivers/radeon/radeon_crtc2.c
new file mode 100755
index 0000000..bcae981
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_crtc2.c
@@ -0,0 +1,1011 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/gfxcard.h>
+#include <core/screens.h>
+#include <core/layers.h>
+#include <core/layer_context.h>
+#include <core/layer_region.h>
+#include <core/layer_control.h>
+#include <core/layers_internal.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <gfx/convert.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+
+
+typedef struct {
+     CoreLayerRegionConfig  config;
+     CorePalette           *palette; 
+     DFBColorAdjustment     adjustment;
+     
+     unsigned int           pll_max_freq;
+     unsigned int           pll_min_freq;
+     unsigned int           pll_ref_div;
+     unsigned int           pll_ref_clk;
+
+     struct {
+          unsigned int      size;
+          u8                r[256];
+          u8                g[256];
+          u8                b[256];
+     } lut;
+
+     struct { 
+          u32 rCRTC2_GEN_CNTL;
+          u32 rFP2_GEN_CNTL;
+          u32 rDAC_CNTL2;
+          u32 rTV_DAC_CNTL;
+          u32 rDISP_OUTPUT_CNTL;
+          u32 rDISP_HW_DEBUG;
+          u32 rCRTC2_OFFSET_CNTL;
+     } save;
+     
+     struct {
+          u32 rCRTC2_GEN_CNTL;
+          u32 rDAC_CNTL2;
+          u32 rTV_DAC_CNTL;
+          u32 rDISP_OUTPUT_CNTL;
+          u32 rDISP_HW_DEBUG;
+          u32 rCRTC2_H_TOTAL_DISP;
+          u32 rCRTC2_H_SYNC_STRT_WID;
+          u32 rCRTC2_V_TOTAL_DISP;
+          u32 rCRTC2_V_SYNC_STRT_WID;
+          u32 rCRTC2_BASE_ADDR;
+          u32 rCRTC2_OFFSET;
+          u32 rCRTC2_OFFSET_CNTL;
+          u32 rCRTC2_PITCH;
+          u32 rFP2_GEN_CNTL;
+          u32 rFP2_H_SYNC_STRT_WID;
+          u32 rFP2_V_SYNC_STRT_WID;
+          u32 rP2PLL_REF_DIV;
+          u32 rP2PLL_DIV_0;
+          u32 rHTOTAL2_CNTL;
+     } regs;
+} RadeonCrtc2LayerData;
+
+static VideoMode*  crtc2_find_mode    ( RadeonDriverData     *drv,
+                                        int                   xres,
+                                        int                   yres );
+static bool        crtc2_calc_regs    ( RadeonDriverData      *rdrv, 
+                                        RadeonCrtc2LayerData  *rcrtc2,
+                                        CoreLayerRegionConfig *config,
+                                        CoreSurface           *surface,
+                                        CoreSurfaceBufferLock *lock );
+static void        crtc2_set_regs     ( RadeonDriverData      *rdrv,
+                                        RadeonCrtc2LayerData  *rcrtc2 );
+static void        crtc2_calc_palette ( RadeonDriverData      *rdrv,
+                                        RadeonCrtc2LayerData  *rcrtc2,
+                                        CoreLayerRegionConfig *config,
+                                        DFBColorAdjustment    *adjustment,
+                                        CorePalette           *palette );
+static void        crtc2_set_palette  ( RadeonDriverData      *rdrv,
+                                        RadeonCrtc2LayerData  *rcrtc2 );
+
+/*************************** CRTC2 Screen functions **************************/
+
+static DFBResult
+crtc2InitScreen( CoreScreen           *screen,
+                 CoreGraphicsDevice   *device,
+                 void                 *driver_data,
+                 void                 *screen_data,
+                 DFBScreenDescription *description )
+{
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_VSYNC | DSCCAPS_POWER_MANAGEMENT;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "Radeon CRTC2" );
+               
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2SetPowerMode( CoreScreen         *screen,
+                   void               *driver_data,
+                   void               *screen_data,
+                   DFBScreenPowerMode  mode )
+{
+     RadeonDriverData *rdrv          = (RadeonDriverData*) driver_data;
+     volatile u8      *mmio          = rdrv->mmio_base;
+     u32               crtc2_gen_cntl;
+     
+     crtc2_gen_cntl  = radeon_in32( mmio, CRTC2_GEN_CNTL );
+     crtc2_gen_cntl &= ~(CRTC2_HSYNC_DIS | CRTC2_VSYNC_DIS | CRTC2_DISP_DIS);
+     
+     switch (mode) {
+          case DSPM_OFF:
+               crtc2_gen_cntl |= CRTC2_HSYNC_DIS | 
+                                 CRTC2_VSYNC_DIS | 
+                                 CRTC2_DISP_DIS;
+               break;
+          case DSPM_SUSPEND:
+               crtc2_gen_cntl |= CRTC2_VSYNC_DIS |
+                                 CRTC2_DISP_DIS;
+               break;
+          case DSPM_STANDBY:
+               crtc2_gen_cntl |= CRTC2_HSYNC_DIS |
+                                 CRTC2_DISP_DIS;
+               break;
+          case DSPM_ON:
+               break;
+          default:
+               D_DEBUG( "unknown power mode" );
+               return DFB_INVARG;
+     }
+     
+     radeon_out32( mmio, CRTC2_GEN_CNTL, crtc2_gen_cntl );
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2WaitVSync( CoreScreen *screen,
+                void       *driver_data,
+                void       *screen_data )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+     int               i;
+     
+     if (dfb_config->pollvsync_none)
+          return DFB_OK;
+          
+     radeon_out32( mmio, GEN_INT_STATUS, 
+          (radeon_in32( mmio, GEN_INT_STATUS ) & ~VSYNC2_INT) | VSYNC2_INT_AK );
+     
+     for (i = 0; i < 2000000; i++) {
+          struct timespec t = { 0, 10000 };     
+          
+          if (radeon_in32( mmio, GEN_INT_STATUS ) & VSYNC2_INT)
+               break;
+          nanosleep( &t, NULL );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2GetScreenSize( CoreScreen *screen,
+                    void       *driver_data,
+                    void       *screen_data,
+                    int        *ret_width,
+                    int        *ret_height )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+     unsigned int      xres;
+     unsigned int      yres;
+    
+     xres = ((radeon_in32( mmio, CRTC2_H_TOTAL_DISP ) >> 16) + 1) * 8;
+     yres = ((radeon_in32( mmio, CRTC2_V_TOTAL_DISP ) >> 16) + 1);
+     
+     D_DEBUG( "DirectFB/Radeon/CRTC2: "
+              "detected screen size %dx%d.\n", xres, yres );
+     
+     if (xres <= 1 || yres <= 1) {
+          VideoMode *mode = dfb_system_modes();
+          
+          if (!mode) {
+               D_WARN( "no default video mode" );
+               return DFB_UNSUPPORTED;
+          }
+          xres = mode->xres;
+          yres = mode->yres;
+     }
+     
+     *ret_width  = xres;
+     *ret_height = yres;
+     
+     return DFB_OK;
+}
+
+ScreenFuncs RadeonCrtc2ScreenFuncs = {
+     .InitScreen    = crtc2InitScreen,
+     .SetPowerMode  = crtc2SetPowerMode,
+     .WaitVSync     = crtc2WaitVSync,
+     .GetScreenSize = crtc2GetScreenSize
+};
+          
+/**************************** CRTC2 Layer functions **************************/
+
+#define CRTC2_SUPPORTED_OPTIONS ( DLOP_ALPHACHANNEL )
+
+static int
+crtc2LayerDataSize( void )
+{
+     return sizeof(RadeonCrtc2LayerData);
+}
+
+static DFBResult
+crtc2InitLayer( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                DFBDisplayLayerDescription *description,
+                DFBDisplayLayerConfig      *config,
+                DFBColorAdjustment         *adjustment )
+{
+     RadeonDriverData     *rdrv   = (RadeonDriverData*) driver_data;
+     RadeonCrtc2LayerData *rcrtc2 = (RadeonCrtc2LayerData*) layer_data;
+     volatile u8          *mmio   = rdrv->mmio_base;
+     VideoMode            *mode;
+     
+     mode = dfb_system_modes();
+     if (!mode) {
+          D_BUG( "no default video mode" );
+          return DFB_FAILURE;
+     }
+     
+     /* Fill layer description. */
+     description->caps = DLCAPS_SURFACE     | DLCAPS_BRIGHTNESS |
+                         DLCAPS_CONTRAST    | DLCAPS_SATURATION |
+                         DLCAPS_ALPHACHANNEL;
+     
+     description->type = DLTF_GRAPHICS;
+     
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Radeon CRTC2's Underlay" );
+               
+     /* Set default configuration. */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT     |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                           DLCONF_OPTIONS;
+     config->width       = mode->xres;
+     config->height      = mode->yres;
+     config->pixelformat = DSPF_RGB16;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_NONE;
+ 
+     /* Set default color adjustment. */ 
+     adjustment->flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST |
+                              DCAF_SATURATION;
+     adjustment->brightness = 0x8000;
+     adjustment->contrast   = 0x8000;
+     adjustment->saturation = 0x8000;
+     
+     /* Set PLL coefficients (should be done by reading the BIOS). */
+     rcrtc2->pll_max_freq = 35000;
+     rcrtc2->pll_min_freq = 12000;
+     rcrtc2->pll_ref_div  = 60;
+     rcrtc2->pll_ref_clk  = 2700;
+
+     /* Save common registers. */
+     rcrtc2->save.rCRTC2_GEN_CNTL = radeon_in32( mmio, CRTC2_GEN_CNTL );
+     rcrtc2->save.rFP2_GEN_CNTL = radeon_in32( mmio, FP2_GEN_CNTL );
+     rcrtc2->save.rDAC_CNTL2 = radeon_in32( mmio, DAC_CNTL2 );
+     rcrtc2->save.rTV_DAC_CNTL = radeon_in32( mmio, TV_DAC_CNTL );
+     rcrtc2->save.rDISP_OUTPUT_CNTL = radeon_in32( mmio, DISP_OUTPUT_CNTL );
+     rcrtc2->save.rDISP_HW_DEBUG = radeon_in32( mmio, DISP_HW_DEBUG );
+     rcrtc2->save.rCRTC2_OFFSET_CNTL = radeon_in32( mmio, CRTC2_OFFSET_CNTL );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2TestRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags *failed )
+{
+     RadeonDriverData           *rdrv = (RadeonDriverData*) driver_data;
+     CoreLayerRegionConfigFlags  fail = 0;
+
+     /* check for unsupported options */
+     if (config->options & ~CRTC2_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+          
+     if (config->options & DLOP_ALPHACHANNEL && config->format != DSPF_ARGB)
+          fail |= CLRCF_OPTIONS;
+          
+     /* check for unsupported buffermode */
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+          case DLBM_TRIPLE:
+               break;
+               
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+     
+     /* check for unsupported pixelformat */
+     switch (config->format) {
+          case DSPF_LUT8:
+          case DSPF_RGB332:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+               
+          default:
+               fail |= CLRCF_FORMAT;
+               break;
+     }
+     
+     /* check for unsupported size */
+     if (!crtc2_find_mode( rdrv, config->width, config->height ))
+          fail |= CLRCF_WIDTH | CLRCF_HEIGHT;
+          
+     if (failed)
+          *failed = fail;
+          
+     return fail ? DFB_UNSUPPORTED : DFB_OK;
+}
+
+static DFBResult
+crtc2AddRegion( CoreLayer             *layer,
+                void                  *driver_data,
+                void                  *layer_data,
+                void                  *region_data,
+                CoreLayerRegionConfig *config )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     RadeonDeviceData *rdev = rdrv->device_data;
+
+     if (!rdev->monitor2) {
+          D_ERROR( "DirectFB/Radeon/CRTC2: "
+                   "no secondary monitor connected!\n" );
+          return DFB_IO;
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2SetRegion( CoreLayer                  *layer,
+                void                       *driver_data,
+                void                       *layer_data,
+                void                       *region_data,
+                CoreLayerRegionConfig      *config,
+                CoreLayerRegionConfigFlags  updated,
+                CoreSurface                *surface,
+                CorePalette                *palette,
+                CoreSurfaceBufferLock      *lock )
+{
+     RadeonDriverData     *rdrv   = (RadeonDriverData*) driver_data;
+     RadeonCrtc2LayerData *rcrtc2 = (RadeonCrtc2LayerData*) layer_data;
+    
+     rcrtc2->config  = *config;
+     rcrtc2->palette = palette;
+    
+     updated &= CLRCF_WIDTH  | CLRCF_HEIGHT  | 
+                CLRCF_FORMAT | CLRCF_SURFACE | CLRCF_PALETTE;
+                
+     if (updated & ~CLRCF_PALETTE) {
+          if (!crtc2_calc_regs( rdrv, rcrtc2, &rcrtc2->config, surface, lock ))
+               return DFB_UNSUPPORTED;
+          
+          crtc2_set_regs( rdrv, rcrtc2 );
+     }
+
+     if (updated) {
+          crtc2_calc_palette( rdrv, rcrtc2, &rcrtc2->config,
+                              &rcrtc2->adjustment, rcrtc2->palette );
+          crtc2_set_palette( rdrv, rcrtc2 );
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2RemoveRegion( CoreLayer *layer,
+                   void      *driver_data,
+                   void      *layer_data,
+                   void      *region_data )
+{
+     RadeonDriverData     *rdrv   = (RadeonDriverData*) driver_data;
+     RadeonCrtc2LayerData *rcrtc2 = (RadeonCrtc2LayerData*) layer_data;
+     volatile u8          *mmio   = rdrv->mmio_base;
+    
+     radeon_waitidle( rdrv, rdrv->device_data );
+    
+     radeon_out32( mmio, CRTC2_GEN_CNTL, rcrtc2->save.rCRTC2_GEN_CNTL );
+     radeon_out32( mmio, FP2_GEN_CNTL, rcrtc2->save.rFP2_GEN_CNTL );
+     radeon_out32( mmio, DAC_CNTL2, rcrtc2->save.rDAC_CNTL2 );
+     radeon_out32( mmio, TV_DAC_CNTL, rcrtc2->save.rTV_DAC_CNTL );
+     radeon_out32( mmio, DISP_OUTPUT_CNTL, rcrtc2->save.rDISP_OUTPUT_CNTL );
+     radeon_out32( mmio, DISP_HW_DEBUG, rcrtc2->save.rDISP_HW_DEBUG ); 
+     radeon_out32( mmio, CRTC2_OFFSET_CNTL, rcrtc2->save.rCRTC2_OFFSET_CNTL );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2FlipRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreSurface           *surface,
+                 DFBSurfaceFlipFlags    flags,
+                 CoreSurfaceBufferLock *lock )
+{
+     RadeonDriverData     *rdrv   = (RadeonDriverData*) driver_data;
+     RadeonDeviceData     *rdev   = rdrv->device_data;
+     RadeonCrtc2LayerData *rcrtc2 = (RadeonCrtc2LayerData*) layer_data;
+     volatile u8          *mmio   = rdrv->mmio_base;
+     
+     if (lock->phys - lock->offset == rdev->fb_phys)
+          rcrtc2->regs.rCRTC2_BASE_ADDR = rdev->fb_offset;
+     else
+          rcrtc2->regs.rCRTC2_BASE_ADDR = rdev->agp_offset;
+     
+     rcrtc2->regs.rCRTC2_OFFSET = lock->offset;
+     
+     radeon_waitidle( rdrv, rdrv->device_data );
+     
+     radeon_out32( mmio, CRTC2_BASE_ADDR, rcrtc2->regs.rCRTC2_BASE_ADDR );
+     radeon_out32( mmio, CRTC2_OFFSET, rcrtc2->regs.rCRTC2_OFFSET );
+     
+     dfb_surface_flip( surface, false );
+     
+     if (flags & DSFLIP_WAIT)
+          dfb_layer_wait_vsync( layer );
+          
+     return DFB_OK;
+}
+
+static DFBResult
+crtc2SetColorAdjustment( CoreLayer          *layer,
+                         void               *driver_data,
+                         void               *layer_data,
+                         DFBColorAdjustment *adj )
+{
+     RadeonDriverData     *rdrv   = (RadeonDriverData*) driver_data;
+     RadeonCrtc2LayerData *rcrtc2 = (RadeonCrtc2LayerData*) layer_data;
+
+     if (adj->flags & DCAF_BRIGHTNESS) {
+          if (adj->brightness == 0x8000) {
+               rcrtc2->adjustment.flags &= ~DCAF_BRIGHTNESS;
+          } else {
+               rcrtc2->adjustment.flags |= DCAF_BRIGHTNESS; 
+               rcrtc2->adjustment.brightness = adj->brightness;
+          }
+     }
+     if (adj->flags & DCAF_CONTRAST) {
+          if (adj->contrast == 0x8000) {
+               rcrtc2->adjustment.flags &= ~DCAF_CONTRAST;
+          } else {
+               rcrtc2->adjustment.flags |= DCAF_CONTRAST;
+               rcrtc2->adjustment.contrast = adj->contrast;
+          }
+     }
+     if (adj->flags & DCAF_SATURATION) {
+          if (adj->saturation == 0x8000) {
+               rcrtc2->adjustment.flags &= ~DCAF_SATURATION;
+          } else {
+               rcrtc2->adjustment.flags |= DCAF_SATURATION;
+               rcrtc2->adjustment.saturation = adj->saturation;
+          }
+     }
+
+     crtc2_calc_palette( rdrv, rcrtc2, &rcrtc2->config, 
+                         &rcrtc2->adjustment, rcrtc2->palette );
+     crtc2_set_palette( rdrv, rcrtc2 );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs RadeonCrtc2LayerFuncs = {
+     .LayerDataSize      = crtc2LayerDataSize,
+     .InitLayer          = crtc2InitLayer,
+     .TestRegion         = crtc2TestRegion,
+     .AddRegion          = crtc2AddRegion,
+     .SetRegion          = crtc2SetRegion,
+     .RemoveRegion       = crtc2RemoveRegion,
+     .FlipRegion         = crtc2FlipRegion,
+     .SetColorAdjustment = crtc2SetColorAdjustment
+};
+
+/************************** CRTC2 internal functions *************************/
+
+static VideoMode* 
+crtc2_find_mode( RadeonDriverData *rdrv,
+                 int               xres,
+                 int               yres )
+{
+     VideoMode *modes = dfb_system_modes();
+     VideoMode *mode;
+     
+     for (mode = modes; mode; mode = mode->next) {
+          if (mode->xres == xres && mode->yres == yres)
+               return mode;
+     }
+     
+     return NULL;
+}
+
+static void
+crtc2_calc_pllregs( RadeonDriverData     *rdrv,
+                    RadeonCrtc2LayerData *rcrtc2,
+                    unsigned int          freq )
+{ 
+     struct {
+          int divider;
+          int bitvalue;
+     } *post_div, post_divs[] = {
+          {  1, 0 }, /* VCLK_SRC    */
+          {  2, 1 }, /* VCLK_SRC/2  */
+          {  4, 2 }, /* VCLK_SRC/4  */
+          {  8, 3 }, /* VCLK_SRC/8  */
+          {  3, 4 }, /* VCLK_SRC/3  */
+          {  6, 6 }, /* VCLK_SRC/6  */
+          { 12, 7 }, /* VCLK_SRC/12 */
+          {  0, 0 }
+     };
+     u32 pll_output_freq_2 = 0;
+     u32 feedback_div_2;
+
+     if (freq > rcrtc2->pll_max_freq)
+          freq = rcrtc2->pll_max_freq;
+     if (freq*12 < rcrtc2->pll_min_freq)
+          freq = rcrtc2->pll_min_freq/12;
+          
+     for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
+          pll_output_freq_2 = post_div->divider * freq;
+          if (pll_output_freq_2 >= rcrtc2->pll_min_freq &&
+              pll_output_freq_2 <= rcrtc2->pll_max_freq)
+               break;
+     }
+     
+     if (!post_div->divider) {
+          pll_output_freq_2 = freq;
+          post_div = &post_divs[0];
+     }
+    
+     feedback_div_2  = rcrtc2->pll_ref_div * pll_output_freq_2;
+     feedback_div_2 += rcrtc2->pll_ref_clk/2;
+     feedback_div_2 /= rcrtc2->pll_ref_clk;
+     
+     D_DEBUG( "DirectFB/Radeon/CRTC2: "
+              "DotCLock=%d OutputFreq=%d FeedbackDiv=%d PostDiv=%d.\n",
+              freq, pll_output_freq_2, feedback_div_2, post_div->divider );
+
+     rcrtc2->regs.rP2PLL_REF_DIV = rcrtc2->pll_ref_div;
+     rcrtc2->regs.rP2PLL_DIV_0   = feedback_div_2 | (post_div->bitvalue << 16); 
+     rcrtc2->regs.rHTOTAL2_CNTL  = 0;
+}     
+
+static bool 
+crtc2_calc_regs( RadeonDriverData      *rdrv, 
+                 RadeonCrtc2LayerData  *rcrtc2,
+                 CoreLayerRegionConfig *config,
+                 CoreSurface           *surface,
+                 CoreSurfaceBufferLock *lock )
+{
+     RadeonDeviceData  *rdev   = rdrv->device_data;
+     VideoMode         *mode; 
+     u32                format = 0;
+    
+     int   h_total, h_sync_start, h_sync_end, h_sync_wid;
+     int   v_total, v_sync_start, v_sync_end, v_sync_wid;
+           
+     
+     mode = crtc2_find_mode( rdrv, config->width, config->height );
+     if (!mode) {
+          D_BUG( "unexpected error while searching video mode" );
+          return false;
+     }
+
+     switch (config->format) {
+          case DSPF_LUT8:
+          case DSPF_RGB332:
+               format = DST_8BPP;
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               format = DST_15BPP;
+               break;
+          case DSPF_RGB16:
+               format = DST_16BPP;
+               break;
+          case DSPF_RGB24:
+               format = DST_24BPP;
+               break;
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               format = DST_32BPP;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat" );
+               return false;
+     }
+     
+     h_sync_start = mode->xres + mode->right_margin;
+     h_sync_end   = h_sync_start + mode->hsync_len;
+     h_total      = h_sync_end + mode->left_margin;
+     h_sync_wid   = (h_sync_end - h_sync_start) / 8;
+     h_sync_wid   = CLAMP( h_sync_wid, 1, 0x3f );
+     h_sync_start = h_sync_start - 8;
+     
+     v_sync_start = mode->yres + mode->lower_margin;
+     v_sync_end   = v_sync_start + mode->vsync_len;
+     v_total      = v_sync_end + mode->upper_margin;
+     v_sync_wid   = v_sync_end - v_sync_start;
+     v_sync_wid   = CLAMP( v_sync_wid, 1, 0x1f );
+      
+     D_DEBUG( "DirectFB/Radeon/CRTC2: \n"
+              "\t\thSyncStart:%d hSyncEnd:%d hTotal:%d hSyncWid:%d\n"
+              "\t\tvSyncStart:%d vSyncEnd:%d vTotal:%d vSyncWid:%d\n",
+              h_sync_start, h_sync_end, h_total, h_sync_wid,
+              v_sync_start, v_sync_end, v_total, v_sync_wid );
+     
+     rcrtc2->regs.rCRTC2_GEN_CNTL = CRTC2_EN | CRTC2_CRT2_ON | (format << 8);
+     if (mode->laced)
+          rcrtc2->regs.rCRTC2_GEN_CNTL |= CRTC2_INTERLACE_EN;
+     if (mode->doubled)
+          rcrtc2->regs.rCRTC2_GEN_CNTL |= CRTC2_DBL_SCAN_EN;
+     if (mode->sync_on_green)
+          rcrtc2->regs.rCRTC2_GEN_CNTL |= CRTC2_CSYNC_EN;
+          
+     rcrtc2->regs.rDAC_CNTL2 = rcrtc2->save.rDAC_CNTL2 | DAC2_DAC2_CLK_SEL;
+     rcrtc2->regs.rTV_DAC_CNTL = 0x00280203;
+     rcrtc2->regs.rDISP_OUTPUT_CNTL = rcrtc2->save.rDISP_OUTPUT_CNTL;
+     rcrtc2->regs.rDISP_HW_DEBUG = rcrtc2->save.rDISP_HW_DEBUG;
+     
+     if (rdev->chipset == CHIP_UNKNOWN ||
+         rdev->chipset == CHIP_R200    ||
+         rdev->chipset >= CHIP_R300)
+     {
+          rcrtc2->regs.rDISP_OUTPUT_CNTL &= ~(DISP_DAC_SOURCE_MASK |
+                                              DISP_DAC2_SOURCE_MASK);
+          
+          /* If primary monitor is a TV monitor, 
+           * reverse the DAC source to control it using the CRTC2. */
+          if (rdev->monitor1 == MT_CTV || rdev->monitor1 == MT_STV)
+               rcrtc2->regs.rDISP_OUTPUT_CNTL |= DISP_DAC2_SOURCE_CRTC2;
+          else
+               rcrtc2->regs.rDISP_OUTPUT_CNTL |= DISP_DAC_SOURCE_CRTC2;
+     }
+     else {
+          if (rdev->monitor1 == MT_CTV || rdev->monitor1 == MT_STV) {
+               rcrtc2->regs.rDISP_HW_DEBUG &= ~CRT2_DISP1_SEL;
+               rcrtc2->regs.rDAC_CNTL2     &= ~DAC2_DAC_CLK_SEL;
+          }
+          else {        
+               rcrtc2->regs.rDISP_HW_DEBUG |= CRT2_DISP1_SEL;
+               rcrtc2->regs.rDAC_CNTL2     |= DAC2_DAC_CLK_SEL;
+          }
+     }
+     
+     rcrtc2->regs.rCRTC2_H_TOTAL_DISP = ((h_total/8 - 1) & 0x3ff) | 
+                                        ((mode->xres/8 - 1) << 16);
+     rcrtc2->regs.rCRTC2_H_SYNC_STRT_WID = (h_sync_start & 0x1fff) |
+                                           ((h_sync_wid & 0x3f) << 16);
+     if (!mode->hsync_high)
+          rcrtc2->regs.rCRTC2_H_SYNC_STRT_WID |= CRTC2_H_SYNC_POL;
+          
+     rcrtc2->regs.rCRTC2_V_TOTAL_DISP = ((v_total - 1) & 0xffff) |
+                                        ((mode->yres - 1) << 16);
+     rcrtc2->regs.rCRTC2_V_SYNC_STRT_WID = ((v_sync_start - 1) & 0xfff) |
+                                           ((v_sync_wid & 0x1f) << 16);
+     if (!mode->vsync_high)
+          rcrtc2->regs.rCRTC2_V_SYNC_STRT_WID |= CRTC2_V_SYNC_POL;
+          
+     if (lock->phys - lock->offset == rdev->fb_phys)
+          rcrtc2->regs.rCRTC2_BASE_ADDR = rdev->fb_offset;
+     else
+          rcrtc2->regs.rCRTC2_BASE_ADDR = rdev->agp_offset;
+     
+     rcrtc2->regs.rCRTC2_OFFSET = lock->offset;
+     
+     rcrtc2->regs.rCRTC2_OFFSET_CNTL = rcrtc2->save.rCRTC2_OFFSET_CNTL;
+     rcrtc2->regs.rCRTC2_OFFSET_CNTL &= ~CRTC_TILE_EN;
+     rcrtc2->regs.rCRTC2_OFFSET_CNTL |= CRTC_HSYNC_EN;
+     
+     rcrtc2->regs.rCRTC2_PITCH  = (lock->pitch / 
+                                   DFB_BYTES_PER_PIXEL(surface->config.format)) >> 3;
+     rcrtc2->regs.rCRTC2_PITCH |= rcrtc2->regs.rCRTC2_PITCH << 16;
+
+     if (rdev->monitor2 == MT_DFP) {
+          rcrtc2->regs.rCRTC2_GEN_CNTL &= ~CRTC2_CRT2_ON;
+          rcrtc2->regs.rFP2_GEN_CNTL    = rcrtc2->save.rFP2_GEN_CNTL | FP2_ON;
+           
+          if (rdev->chipset == CHIP_UNKNOWN ||
+              rdev->chipset == CHIP_R200    ||
+              rdev->chipset >= CHIP_R300)
+          {
+               rcrtc2->regs.rFP2_GEN_CNTL &= ~(R200_FP2_SOURCE_SEL_MASK |
+                                               FP2_DVO_RATE_SEL_SDR);
+               rcrtc2->regs.rFP2_GEN_CNTL |= R200_FP2_SOURCE_SEL_CRTC2 | FP2_DVO_EN;
+          }
+          else {
+               rcrtc2->regs.rFP2_GEN_CNTL &= ~FP2_SRC_SEL_MASK;
+               rcrtc2->regs.rFP2_GEN_CNTL |= FP2_SRC_SEL_CRTC2;
+          }
+
+          rcrtc2->regs.rFP2_H_SYNC_STRT_WID = rcrtc2->regs.rCRTC2_H_SYNC_STRT_WID;
+          rcrtc2->regs.rFP2_V_SYNC_STRT_WID = rcrtc2->regs.rCRTC2_V_SYNC_STRT_WID;
+     }
+     else {
+          rcrtc2->regs.rFP2_GEN_CNTL = rcrtc2->save.rFP2_GEN_CNTL;
+          rcrtc2->regs.rFP2_H_SYNC_STRT_WID = 0;
+          rcrtc2->regs.rFP2_V_SYNC_STRT_WID = 0;
+     }
+
+     crtc2_calc_pllregs( rdrv, rcrtc2, 100000000 / mode->pixclock );
+ 
+     return true;
+}
+
+static void
+crtc2_set_regs ( RadeonDriverData     *rdrv,
+                 RadeonCrtc2LayerData *rcrtc2 )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     u32          tmp;
+     
+     /* Lock the card during mode switching. */
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC );
+     
+     radeon_out32( mmio, CRTC2_GEN_CNTL, 
+                         rcrtc2->regs.rCRTC2_GEN_CNTL | CRTC2_DISP_DIS );
+   
+     radeon_out32( mmio, DAC_CNTL2, rcrtc2->regs.rDAC_CNTL2 );
+     radeon_out32( mmio, TV_DAC_CNTL, rcrtc2->regs.rTV_DAC_CNTL );
+     radeon_out32( mmio, DISP_OUTPUT_CNTL, rcrtc2->regs.rDISP_OUTPUT_CNTL );
+     radeon_out32( mmio, DISP_HW_DEBUG, rcrtc2->regs.rDISP_HW_DEBUG );
+     
+     radeon_out32( mmio, CRTC2_H_TOTAL_DISP, rcrtc2->regs.rCRTC2_H_TOTAL_DISP );
+     radeon_out32( mmio, CRTC2_H_SYNC_STRT_WID, rcrtc2->regs.rCRTC2_H_SYNC_STRT_WID );
+     
+     radeon_out32( mmio, CRTC2_V_TOTAL_DISP, rcrtc2->regs.rCRTC2_V_TOTAL_DISP );
+     radeon_out32( mmio, CRTC2_V_SYNC_STRT_WID, rcrtc2->regs.rCRTC2_V_SYNC_STRT_WID );
+    
+     radeon_out32( mmio, CRTC2_BASE_ADDR, rcrtc2->regs.rCRTC2_BASE_ADDR );
+     radeon_out32( mmio, CRTC2_OFFSET, rcrtc2->regs.rCRTC2_OFFSET );
+     radeon_out32( mmio, CRTC2_OFFSET_CNTL, rcrtc2->regs.rCRTC2_OFFSET_CNTL );
+     radeon_out32( mmio, CRTC2_PITCH, rcrtc2->regs.rCRTC2_PITCH );                      
+
+     radeon_out32( mmio, FP2_GEN_CNTL, rcrtc2->regs.rFP2_GEN_CNTL );
+     radeon_out32( mmio, FP2_H_SYNC_STRT_WID, rcrtc2->regs.rFP2_H_SYNC_STRT_WID );
+     radeon_out32( mmio, FP2_V_SYNC_STRT_WID, rcrtc2->regs.rFP2_V_SYNC_STRT_WID );
+
+     tmp = radeon_inpll( mmio, PIXCLKS_CNTL) & ~PIX2CLK_SRC_SEL_MASK;
+     radeon_outpll( mmio, PIXCLKS_CNTL, tmp | PIX2CLK_SRC_SEL_CPUCLK );
+     
+     tmp = radeon_inpll( mmio, P2PLL_CNTL );
+     radeon_outpll( mmio, P2PLL_CNTL, tmp | P2PLL_RESET |
+                                      P2PLL_ATOMIC_UPDATE_EN |
+                                      P2PLL_VGA_ATOMIC_UPDATE_EN );
+     
+     tmp = radeon_inpll( mmio, P2PLL_REF_DIV ) & ~P2PLL_REF_DIV_MASK;
+     radeon_outpll( mmio, P2PLL_REF_DIV, tmp | rcrtc2->regs.rP2PLL_REF_DIV );
+     
+     tmp = radeon_inpll( mmio, P2PLL_DIV_0 ) & ~P2PLL_FB0_DIV_MASK; 
+     radeon_outpll( mmio, P2PLL_DIV_0, tmp | rcrtc2->regs.rP2PLL_DIV_0 );
+     
+     tmp = radeon_inpll( mmio, P2PLL_DIV_0 ) & ~P2PLL_POST0_DIV_MASK;     
+     radeon_outpll( mmio, P2PLL_DIV_0, tmp | rcrtc2->regs.rP2PLL_DIV_0 );
+           
+     while (radeon_inpll( mmio, P2PLL_REF_DIV ) & P2PLL_ATOMIC_UPDATE_R);
+     
+     radeon_outpll( mmio, P2PLL_REF_DIV,
+                    radeon_inpll( mmio, P2PLL_REF_DIV ) | P2PLL_ATOMIC_UPDATE_W );
+     
+     for (tmp = 0; tmp < 1000; tmp++) {
+          if (!(radeon_inpll( mmio, P2PLL_REF_DIV ) & P2PLL_ATOMIC_UPDATE_R))
+               break;
+     }
+     
+     radeon_outpll( mmio, HTOTAL2_CNTL, rcrtc2->regs.rHTOTAL2_CNTL );
+     
+     tmp = radeon_inpll( mmio, P2PLL_CNTL );
+     radeon_outpll( mmio, P2PLL_CNTL, tmp & ~(P2PLL_RESET | P2PLL_SLEEP |
+                                              P2PLL_ATOMIC_UPDATE_EN |
+                                              P2PLL_VGA_ATOMIC_UPDATE_EN) );
+                                           
+     usleep( 5000 );
+     
+     tmp = radeon_inpll( mmio, PIXCLKS_CNTL ) & ~PIX2CLK_SRC_SEL_MASK;
+     radeon_outpll( mmio, PIXCLKS_CNTL, tmp | PIX2CLK_SRC_SEL_P2PLLCLK );
+     
+     radeon_out32( mmio, CRTC2_GEN_CNTL, rcrtc2->regs.rCRTC2_GEN_CNTL );
+
+     dfb_gfxcard_unlock();
+}
+
+static inline u8
+calc_gamma( float n, float d )
+{
+     int ret;
+     
+     ret = 255.0 * n / d + 0.5;
+     if (ret > 255)
+          ret = 255;
+     else if (ret < 0)
+          ret = 0;
+
+     return ret;
+}
+
+static void
+crtc2_calc_palette( RadeonDriverData      *rdrv,
+                    RadeonCrtc2LayerData  *rcrtc2,
+                    CoreLayerRegionConfig *config,
+                    DFBColorAdjustment    *adjustment,
+                    CorePalette           *palette )
+{
+     unsigned int i;
+     int          r, g, b;
+     
+     switch (config->format) {
+          case DSPF_LUT8:
+               rcrtc2->lut.size = MAX( palette->num_entries, 256 );
+               for (i = 0; i < rcrtc2->lut.size; i++) {
+                    rcrtc2->lut.r[i] = palette->entries[i].r;
+                    rcrtc2->lut.g[i] = palette->entries[i].g;
+                    rcrtc2->lut.b[i] = palette->entries[i].b;
+               }
+               break;
+          case DSPF_RGB332:
+               rcrtc2->lut.size = 256;
+               for (i = 0, r = 0; r < 8; r++) {
+                    for (g = 0; g < 8; g++) {
+                         for (b = 0; b < 4; b++) {
+                              rcrtc2->lut.r[i] = calc_gamma( r, 7 );
+                              rcrtc2->lut.g[i] = calc_gamma( g, 7 );
+                              rcrtc2->lut.b[i] = calc_gamma( b, 3 );
+                              i++;
+                         }
+                    }
+               }
+               break;
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               rcrtc2->lut.size = 32;
+               for (i = 0; i < 32; i++) {
+                    rcrtc2->lut.r[i] =
+                    rcrtc2->lut.g[i] =
+                    rcrtc2->lut.b[i] = calc_gamma( i, 31 );
+               }
+               break;
+          case DSPF_RGB16:
+               rcrtc2->lut.size = 64;
+               for (i = 0; i < 64; i++) {
+                    rcrtc2->lut.r[i] =
+                    rcrtc2->lut.b[i] = calc_gamma( i/2, 31 );
+                    rcrtc2->lut.g[i] = calc_gamma( i, 63 );
+               }
+               break;
+          default:
+               rcrtc2->lut.size = 256;
+               for (i = 0; i < 256; i++) {
+                    rcrtc2->lut.r[i] =
+                    rcrtc2->lut.b[i] =
+                    rcrtc2->lut.g[i] = i;
+               }
+               break;
+     }
+
+     if (adjustment->flags & DCAF_BRIGHTNESS) {
+          int brightness = (adjustment->brightness >> 8) - 128;
+
+          for (i = 0; i < rcrtc2->lut.size; i++) {
+               r = rcrtc2->lut.r[i] + brightness;
+               g = rcrtc2->lut.g[i] + brightness;
+               b = rcrtc2->lut.b[i] + brightness;
+               rcrtc2->lut.r[i] = CLAMP( r, 0, 255 );
+               rcrtc2->lut.g[i] = CLAMP( g, 0, 255 );
+               rcrtc2->lut.b[i] = CLAMP( b, 0, 255 );
+          }
+     }
+
+     if (adjustment->flags & DCAF_CONTRAST) {
+          int contrast = adjustment->contrast;
+
+          for (i = 0; i < rcrtc2->lut.size; i++) {
+               r = rcrtc2->lut.r[i] * contrast / 0x8000;
+               g = rcrtc2->lut.g[i] * contrast / 0x8000;
+               b = rcrtc2->lut.b[i] * contrast / 0x8000;
+               rcrtc2->lut.r[i] = CLAMP( r, 0, 255 );
+               rcrtc2->lut.g[i] = CLAMP( g, 0, 255 );
+               rcrtc2->lut.b[i] = CLAMP( b, 0, 255 );
+          }
+     }
+
+     if (adjustment->flags & DCAF_SATURATION) {
+          int saturation = adjustment->saturation >> 8;
+
+          for (i = 0; i < rcrtc2->lut.size; i++) {
+               if (saturation > 128) {
+                    float gray  = ((float)saturation - 128.0)/128.0;
+                    float color = 1.0 - gray;
+
+                    r = (((float)rcrtc2->lut.r[i] - 128.0 * gray)/color);
+                    g = (((float)rcrtc2->lut.g[i] - 128.0 * gray)/color);
+                    b = (((float)rcrtc2->lut.b[i] - 128.0 * gray)/color);
+               }
+               else {
+                    float color = (float)saturation/128.0;
+                    float gray  = 1.0 - color;
+
+                    r = (((float)rcrtc2->lut.r[i] * color) + (128.0 * gray));
+                    g = (((float)rcrtc2->lut.g[i] * color) + (128.0 * gray));
+                    b = (((float)rcrtc2->lut.b[i] * color) + (128.0 * gray));
+               }
+               rcrtc2->lut.r[i] = CLAMP( r, 0, 255 );
+               rcrtc2->lut.g[i] = CLAMP( g, 0, 255 );
+               rcrtc2->lut.b[i] = CLAMP( b, 0, 255 );
+          }
+     }
+}
+    
+static void
+crtc2_set_palette( RadeonDriverData     *rdrv,
+                   RadeonCrtc2LayerData *rcrtc2 )
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     u32          tmp;
+     int          i, j;
+
+     if (!rcrtc2->lut.size) {
+          D_WARN( "palette is empty" );
+          return;
+     }
+
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC );
+
+     tmp = radeon_in32( mmio, DAC_CNTL2 );
+     radeon_out32( mmio, DAC_CNTL2, tmp | DAC2_PALETTE_ACC_CTL );
+
+     j = 256 / rcrtc2->lut.size;
+     for (i = 0; i < rcrtc2->lut.size; i++) {
+          radeon_out32( mmio, PALETTE_INDEX, i*j );
+          radeon_out32( mmio, PALETTE_DATA, (rcrtc2->lut.b[i]      ) |
+                                            (rcrtc2->lut.g[i] <<  8) |
+                                            (rcrtc2->lut.r[i] << 16) );
+     }
+
+     radeon_out32( mmio, DAC_CNTL2, tmp );
+
+     dfb_gfxcard_unlock();
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_mmio.h b/Source/DirectFB/gfxdrivers/radeon/radeon_mmio.h
new file mode 100755
index 0000000..cdfa1f7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_mmio.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_MMIO_H__
+#define __RADEON_MMIO_H__
+
+#include <unistd.h>
+#include <dfb_types.h>
+
+#include "radeon.h"
+
+
+static __inline__ void
+radeon_out8( volatile u8 *mmioaddr, u32 reg, u8 value )
+{
+     *((volatile u8*)(mmioaddr+reg)) = value;
+}
+
+static __inline__ void
+radeon_out16( volatile u8 *mmioaddr, u32 reg, u32 value )
+{
+#ifdef __powerpc__
+     asm volatile( "sthbrx %0,%1,%2;eieio"
+                  :: "r" (value), "b"(reg), "r" (mmioaddr) : "memory" );
+#else
+     *((volatile u16*)(mmioaddr+reg)) = value;
+#endif
+}
+
+static __inline__ void
+radeon_out32( volatile u8 *mmioaddr, u32 reg, u32 value )
+{
+#ifdef __powerpc__
+     asm volatile( "stwbrx %0,%1,%2;eieio" 
+                   :: "r" (value), "b"(reg), "r" (mmioaddr) : "memory" );
+#else
+     *((volatile u32*)(mmioaddr+reg)) = value;
+#endif
+}
+
+static __inline__ u8
+radeon_in8( volatile u8 *mmioaddr, u32 reg )
+{
+     return *((volatile u8*)(mmioaddr+reg));
+}
+
+static __inline__ u16
+radeon_in16( volatile u8 *mmioaddr, u32 reg )
+{
+#ifdef __powerpc__
+     u32 value;
+     asm volatile( "lhbrx %0,%1,%2;eieio"
+                   : "=r" (value) : "b" (reg), "r" (mmioaddr) );
+     return value;
+#else
+     return *((volatile u16*)(mmioaddr+reg));
+#endif
+}
+
+static __inline__ u32
+radeon_in32( volatile u8 *mmioaddr, u32 reg )
+{
+#ifdef __powerpc__
+     u32 value;
+     asm volatile( "lwbrx %0,%1,%2;eieio"
+                  : "=r" (value) : "b" (reg), "r" (mmioaddr) );
+     return value;
+#else
+     return *((volatile u32*)(mmioaddr+reg));
+#endif
+}
+
+
+static __inline__ void
+radeon_outpll( volatile u8 *mmioaddr, u32 addr, u32 value )
+{
+     radeon_out8( mmioaddr, CLOCK_CNTL_INDEX, (addr & 0x3f) | PLL_WR_EN );
+     radeon_out32( mmioaddr, CLOCK_CNTL_DATA, value );
+}
+
+static __inline__ u32
+radeon_inpll( volatile u8 *mmioaddr, u32 addr )
+{
+     radeon_out8( mmioaddr, CLOCK_CNTL_INDEX, addr & 0x3f );
+     return radeon_in32( mmioaddr, CLOCK_CNTL_DATA );
+}
+
+
+static inline bool
+radeon_waitfifo( RadeonDriverData *rdrv,
+                 RadeonDeviceData *rdev,
+                 unsigned int    space )
+{
+     int waitcycles = 0;
+
+     rdev->waitfifo_sum += space;
+     rdev->waitfifo_calls++;
+
+     if (rdev->fifo_space < space ) {
+          do {
+               rdev->fifo_space  = radeon_in32( rdrv->mmio_base, RBBM_STATUS );
+               rdev->fifo_space &= RBBM_FIFOCNT_MASK;
+               if (++waitcycles > 10000000) {
+                    radeon_reset( rdrv, rdev );
+                    D_BREAK( "FIFO timed out" );
+                    return false;
+               }
+          } while (rdev->fifo_space < space);
+          
+          rdev->fifo_waitcycles += waitcycles;
+     } else
+          rdev->fifo_cache_hits++;
+	    
+    rdev->fifo_space -= space;
+    
+    return true;
+}
+
+static inline bool
+radeon_waitidle( RadeonDriverData *rdrv, RadeonDeviceData *rdev )
+{
+     int waitcycles = 0;
+     int status;
+
+     if (!radeon_waitfifo( rdrv, rdev, 64 ))
+     	return false;
+     
+     do {
+          status = radeon_in32( rdrv->mmio_base, RBBM_STATUS );
+          if (++waitcycles > 10000000) {
+               radeon_reset( rdrv, rdev );
+               D_BREAK( "Engine timed out" );
+               return false;
+          }
+     } while (status & RBBM_ACTIVE);
+     
+     rdev->fifo_space = status & RBBM_FIFOCNT_MASK;
+     rdev->idle_waitcycles += waitcycles;
+     
+     return true;
+}
+
+
+#endif /* __RADEON_MMIO_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_overlay.c b/Source/DirectFB/gfxdrivers/radeon/radeon_overlay.c
new file mode 100755
index 0000000..bdcaabe
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_overlay.c
@@ -0,0 +1,983 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/layers.h>
+#include <core/layer_context.h>
+#include <core/layer_region.h>
+#include <core/layer_control.h>
+#include <core/layers_internal.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/types.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include "radeon.h"
+#include "radeon_regs.h"
+#include "radeon_mmio.h"
+
+
+typedef struct {
+     CoreLayerRegionConfig  config;
+     float                  brightness;
+     float                  contrast;
+     float                  saturation;
+     float                  hue;
+     int                    field;
+     int                    level;
+   
+     CoreScreen            *screen;
+     int                    crtc2;
+
+     CoreSurface           *surface;
+     CoreSurfaceBufferLock *lock;
+     
+     /* overlay registers */
+     struct {
+          u32 H_INC;
+          u32 STEP_BY;
+          u32 Y_X_START;
+          u32 Y_X_END;
+          u32 V_INC;
+          u32 P1_BLANK_LINES_AT_TOP;
+          u32 P23_BLANK_LINES_AT_TOP;
+          u32 VID_BUF_PITCH0_VALUE;
+          u32 VID_BUF_PITCH1_VALUE;
+          u32 P1_X_START_END;
+          u32 P2_X_START_END;
+          u32 P3_X_START_END;
+          u32 BASE_ADDR;
+          u32 VID_BUF0_BASE_ADRS;
+          u32 VID_BUF1_BASE_ADRS;
+          u32 VID_BUF2_BASE_ADRS;
+          u32 VID_BUF3_BASE_ADRS;
+          u32 VID_BUF4_BASE_ADRS;
+          u32 VID_BUF5_BASE_ADRS;
+          u32 P1_V_ACCUM_INIT;
+          u32 P23_V_ACCUM_INIT;
+          u32 P1_H_ACCUM_INIT;
+          u32 P23_H_ACCUM_INIT;
+          u32 VID_KEY_CLR_LOW;
+          u32 VID_KEY_CLR_HIGH;
+          u32 GRPH_KEY_CLR_LOW;
+          u32 GRPH_KEY_CLR_HIGH;
+          u32 KEY_CNTL;
+          u32 MERGE_CNTL;
+          u32 SCALE_CNTL;
+     } regs;
+} RadeonOverlayLayerData;
+
+static void ovl_calc_regs     ( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl,
+                                CoreSurface             *surface,
+                                CoreLayerRegionConfig   *config,
+                                CoreSurfaceBufferLock   *lock );
+static void ovl_set_regs      ( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl );                            
+static void ovl_calc_buffers  ( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl,
+                                CoreSurface             *surface,
+                                CoreLayerRegionConfig   *config,
+                                CoreSurfaceBufferLock   *lock );
+static void ovl_set_buffers   ( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl );
+static void ovl_set_colorkey  ( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl,
+                                CoreLayerRegionConfig   *config );
+static void ovl_set_adjustment( RadeonDriverData        *rdrv,
+                                RadeonOverlayLayerData  *rovl,
+                                float                    brightness,
+                                float                    contrast,
+                                float                    saturation,
+                                float                    hue );
+                
+#define OVL_SUPPORTED_OPTIONS \
+     ( DLOP_DST_COLORKEY | DLOP_OPACITY | DLOP_DEINTERLACING )
+
+/**********************/
+
+static int
+ovlLayerDataSize( void )
+{
+     return sizeof(RadeonOverlayLayerData);
+}
+
+static DFBResult
+ovlInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+     volatile u8            *mmio = rdrv->mmio_base;
+     DFBScreenDescription    dsc;
+     
+     dfb_screen_get_info( layer->screen, NULL, &dsc );
+     if (strstr( dsc.name, "CRTC2" ))
+          rovl->crtc2 = 1;
+          
+     rovl->level = 1;
+     
+     /* fill layer description */
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+     description->caps = DLCAPS_SURFACE       | DLCAPS_SCREEN_LOCATION |
+                         DLCAPS_BRIGHTNESS    | DLCAPS_CONTRAST        |
+                         DLCAPS_SATURATION    | DLCAPS_HUE             |
+                         DLCAPS_DST_COLORKEY  | DLCAPS_OPACITY         |
+                         DLCAPS_DEINTERLACING | DLCAPS_LEVELS;
+
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, 
+               "Radeon CRTC%c's Overlay", rovl->crtc2 ? '2' : '1' );
+
+     /* set 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;
+     
+     /* set default color adjustment */
+     adjustment->flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST |
+                              DCAF_SATURATION | DCAF_HUE;
+     adjustment->brightness = 0x8000;
+     adjustment->contrast   = 0x8000;
+     adjustment->saturation = 0x8000;
+     adjustment->hue        = 0x8000;
+
+     /* reset overlay */
+     radeon_out32( mmio, OV0_SCALE_CNTL, SCALER_SOFT_RESET ); 
+     radeon_out32( mmio, OV0_AUTO_FLIP_CNTL, 0 );
+     radeon_out32( mmio, OV0_DEINTERLACE_PATTERN, 0 );
+     radeon_out32( mmio, OV0_EXCLUSIVE_HORZ, 0 ); 
+     radeon_out32( mmio, OV0_FILTER_CNTL, FILTER_HARDCODED_COEF );
+     radeon_out32( mmio, OV0_TEST, 0 );
+     
+     /* reset color adjustments */
+     ovl_set_adjustment( rdrv, rovl, 0, 0, 0, 0 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     RadeonOverlayLayerData     *rovl = (RadeonOverlayLayerData*) layer_data;
+     CoreLayerRegionConfigFlags  fail = 0;
+
+     /* check for unsupported options */
+     if (config->options & ~OVL_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     if (rovl->level == -1) {
+          if (config->options & ~DLOP_DEINTERLACING)
+               fail |= CLRCF_OPTIONS;
+     }
+     else {
+          if (config->options &  DLOP_OPACITY &&
+              config->options & (DLOP_SRC_COLORKEY | DLOP_DST_COLORKEY))
+               fail |= CLRCF_OPTIONS;
+     }
+
+     /* check buffermode */
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+          case DLBM_TRIPLE:
+               break;
+          
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+     
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+               break;
+     }
+
+     /* check width */
+     if (config->width > 2048 || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 2048 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlAddRegion( CoreLayer             *layer,
+              void                  *driver_data,
+              void                  *layer_data,
+              void                  *region_data,
+              CoreLayerRegionConfig *config )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonDeviceData       *rdev = rdrv->device_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+     
+     if (rovl->crtc2 && !rdev->monitor2) {
+          D_ERROR( "DirectFB/Radeon/Overlay: "
+                   "no secondary monitor connected!\n" );
+          return DFB_IO;
+     }
+     
+     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 )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+
+     /* save configuration */
+     rovl->config = *config;
+     rovl->surface = surface;
+     rovl->screen = layer->screen;
+     
+     if (updated & (CLRCF_WIDTH  | CLRCF_HEIGHT | CLRCF_FORMAT  |
+                    CLRCF_SOURCE | CLRCF_DEST   | CLRCF_OPTIONS | CLRCF_OPACITY)) 
+     {
+          ovl_calc_regs( rdrv, rovl, surface, &rovl->config, lock );
+          ovl_set_regs( rdrv, rovl );
+     }
+     
+     if (updated & (CLRCF_SRCKEY | CLRCF_DSTKEY))
+          ovl_set_colorkey( rdrv, rovl, &rovl->config );
+
+     rovl->lock = lock;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlFlipRegion( CoreLayer             *layer,
+               void                  *driver_data,
+               void                  *layer_data,
+               void                  *region_data,
+               CoreSurface           *surface,
+               DFBSurfaceFlipFlags    flags,
+               CoreSurfaceBufferLock *lock )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+
+     dfb_surface_flip( surface, false );
+      
+     ovl_calc_buffers( rdrv, rovl, surface, &rovl->config, lock );
+     ovl_set_buffers( rdrv, rovl );
+   
+     if (flags & DSFLIP_WAIT)
+          dfb_layer_wait_vsync( layer );
+
+     rovl->lock = lock;
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlSetColorAdjustment( CoreLayer          *layer,
+                       void               *driver_data,
+                       void               *layer_data,
+                       DFBColorAdjustment *adj )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+
+     if (adj->flags & DCAF_BRIGHTNESS)
+          rovl->brightness = (float)(adj->brightness-0x8000) / 65535.0;
+
+     if (adj->flags & DCAF_CONTRAST)
+          rovl->contrast   = (float)adj->contrast / 32768.0;
+
+     if (adj->flags & DCAF_SATURATION)
+          rovl->saturation = (float)adj->saturation / 32768.0;
+
+     if (adj->flags & DCAF_HUE)
+          rovl->hue        = (float)(adj->hue-0x8000) * 3.1416 / 65535.0;
+
+     ovl_set_adjustment( rdrv, rovl, rovl->brightness, rovl->contrast,
+                                     rovl->saturation, rovl->hue );
+
+     return DFB_OK;
+}
+
+static DFBResult
+ovlSetInputField( CoreLayer *layer,
+                  void      *driver_data,
+                  void      *layer_data,
+                  void      *region_data,
+                  int        field )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+
+     rovl->field = field;
+             
+     if (rovl->surface) {
+          ovl_calc_buffers( rdrv, rovl, rovl->surface, &rovl->config, rovl->lock );
+          ovl_set_buffers( rdrv, rovl );
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+ovlGetLevel( CoreLayer *layer,
+             void      *driver_data,
+             void      *layer_data,
+             int       *level )
+{
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+     
+     *level = rovl->level;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+ovlSetLevel( CoreLayer *layer,
+             void      *driver_data,
+             void      *layer_data,
+             int        level )
+{
+     RadeonDriverData       *rdrv = (RadeonDriverData*) driver_data;
+     RadeonOverlayLayerData *rovl = (RadeonOverlayLayerData*) layer_data;
+     
+     if (!rovl->surface)
+          return DFB_UNSUPPORTED;
+     
+     switch (level) {
+          case -1:
+          case  1:
+               rovl->level = level;
+               ovl_calc_regs( rdrv, rovl, rovl->surface, &rovl->config, rovl->lock );
+               ovl_set_regs( rdrv, rovl );
+               break;
+          default:
+               return DFB_UNSUPPORTED;
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+ovlRemoveRegion( CoreLayer *layer,
+                 void      *driver_data,
+                 void      *layer_data,
+                 void      *region_data )
+{
+     RadeonDriverData *rdrv = (RadeonDriverData*) driver_data;
+     RadeonDeviceData *rdev = rdrv->device_data;
+
+     /* disable overlay */
+     radeon_waitfifo( rdrv, rdev, 1 ); 
+     radeon_out32( rdrv->mmio_base, OV0_SCALE_CNTL, 0 );
+
+     return DFB_OK;
+}
+
+
+DisplayLayerFuncs RadeonOverlayFuncs = {
+     .LayerDataSize      = ovlLayerDataSize,
+     .InitLayer          = ovlInitLayer,
+     .TestRegion         = ovlTestRegion,
+     .AddRegion          = ovlAddRegion,
+     .SetRegion          = ovlSetRegion,
+     .RemoveRegion       = ovlRemoveRegion,
+     .FlipRegion         = ovlFlipRegion,
+     .SetColorAdjustment = ovlSetColorAdjustment,
+     .SetInputField      = ovlSetInputField,
+     .GetLevel           = ovlGetLevel,
+     .SetLevel           = ovlSetLevel
+};
+
+
+/*** Internal Functions ***/
+
+static void
+ovl_calc_coordinates( RadeonDriverData       *rdrv,
+                      RadeonOverlayLayerData *rovl,
+                      CoreSurface            *surface,
+                      CoreLayerRegionConfig  *config )
+{
+     RadeonDeviceData *rdev    = rdrv->device_data;
+     DFBRectangle      source  = config->source;
+     DFBRectangle      dest    = config->dest; 
+     u32               ecp_div = 0;
+     u32               h_inc;
+     u32               h_inc2;
+     u32               v_inc;
+     u32               step_by;
+     u32               tmp;
+     int               xres;
+     int               yres;
+
+     dfb_screen_get_screen_size( rovl->screen, &xres, &yres );
+ 
+     if (dest.w > (source.w << 4))
+          dest.w = source.w << 4;
+
+     if (dest.h > (source.h << 4))
+          dest.h = source.h << 4;
+ 
+     if (dest.x < 0) {
+          source.w += dest.x * source.w / dest.w; 
+          dest.w   += dest.x;
+          dest.x    = 0;
+     }
+     
+     if (dest.y < 0) {
+          source.h += dest.y * source.h / dest.h;
+          dest.h   += dest.y;
+          dest.y    = 0;
+     }
+
+     if ((dest.x + dest.w) > xres) {
+          source.w = (xres - dest.x) * source.w / dest.w;
+          dest.w   =  xres - dest.x;
+     }
+
+     if ((dest.y + dest.h) > yres) {
+          source.h = (yres - dest.y) * source.h / dest.h;
+          dest.h   =  yres - dest.y;
+     }
+     
+     if (dest.w < 1 || dest.h < 1 || source.w < 1 || source.h < 1) {
+          config->opacity = 0;
+          return;
+     }
+
+     if (config->options & DLOP_DEINTERLACING)
+          source.h /= 2;
+
+     tmp = radeon_in32( rdrv->mmio_base, 
+                        rovl->crtc2 ? CRTC2_GEN_CNTL : CRTC_GEN_CNTL );
+     
+     if (tmp & CRTC_DBL_SCAN_EN) {
+          dest.y *= 2;
+          dest.h *= 2;
+     }
+
+     if (tmp & CRTC_INTERLACE_EN) {
+          dest.y /= 2;
+          dest.h /= 2;
+     }
+
+     /* FIXME: We need to know the VideoMode of the current screen. */
+#if 0
+     if ((100000000 / mode->pixclock) >= 17500)
+          ecp_div = 1;
+#endif
+
+     h_inc = (source.w << (12 + ecp_div)) / dest.w;
+     v_inc = (source.h << 20)             / dest.h;
+     
+     for (step_by = 1; h_inc >= (2 << 12);) {
+          step_by++;
+          h_inc >>= 1;
+     }
+
+     switch (surface->config.format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               h_inc2 = h_inc;
+               break;
+          default:
+               h_inc2 = h_inc >> 1;
+               break;
+     }
+
+     rovl->regs.V_INC   = v_inc;
+     rovl->regs.H_INC   = h_inc   | (h_inc2 << 16);
+     rovl->regs.STEP_BY = step_by | (step_by << 8);
+
+     /* compute values for horizontal accumulators */
+     tmp = 0x00028000 + (h_inc << 3);
+     rovl->regs.P1_H_ACCUM_INIT = ((tmp <<  4) & 0x000f8000) |
+                                  ((tmp << 12) & 0xf0000000);
+     tmp = 0x00028000 + (h_inc2 << 3);
+     rovl->regs.P23_H_ACCUM_INIT = ((tmp <<  4) & 0x000f8000) |
+                                   ((tmp << 12) & 0x70000000);
+
+     /* compute values for vertical accumulators */
+     tmp = 0x00018000;
+     rovl->regs.P1_V_ACCUM_INIT  = ((tmp << 4) & OV0_P1_V_ACCUM_INIT_MASK) |
+                                   (OV0_P1_MAX_LN_IN_PER_LN_OUT & 1);
+     tmp = 0x00018000;
+     rovl->regs.P23_V_ACCUM_INIT = ((tmp << 4) & OV0_P23_V_ACCUM_INIT_MASK) |
+                                   (OV0_P23_MAX_LN_IN_PER_LN_OUT & 1);
+    
+     if (!rovl->crtc2) {
+          if (rdev->chipset <  CHIP_R300 &&
+              rdev->chipset != CHIP_R200 &&
+              rdev->chipset != CHIP_UNKNOWN)
+               dest.x += 8;
+     }
+
+     /* compute destination coordinates */
+     rovl->regs.Y_X_START = (dest.x & 0xffff) | (dest.y << 16);
+     rovl->regs.Y_X_END   = ((dest.x + dest.w - 1) & 0xffff) | 
+                            ((dest.y + dest.h - 1) << 16);
+     
+     /* compute source coordinates */
+     rovl->regs.P1_BLANK_LINES_AT_TOP = P1_BLNK_LN_AT_TOP_M1_MASK  | 
+                                         ((source.h - 1) << 16);
+     rovl->regs.P1_X_START_END = (source.w - 1) & 0xffff;
+     
+     if (DFB_PLANAR_PIXELFORMAT( surface->config.format )) {
+          rovl->regs.P23_BLANK_LINES_AT_TOP = P23_BLNK_LN_AT_TOP_M1_MASK |
+                                              ((source.h/2 - 1) << 16);
+          rovl->regs.P2_X_START_END = (source.w/2 - 1) & 0xffff;
+          rovl->regs.P3_X_START_END = rovl->regs.P2_X_START_END;
+     }
+     else {
+          rovl->regs.P23_BLANK_LINES_AT_TOP = P23_BLNK_LN_AT_TOP_M1_MASK |
+                                              ((source.h - 1) << 16);
+          rovl->regs.P2_X_START_END = rovl->regs.P1_X_START_END;
+          rovl->regs.P3_X_START_END = rovl->regs.P1_X_START_END;
+     }
+}
+
+static void
+ovl_calc_buffers( RadeonDriverData       *rdrv,
+                  RadeonOverlayLayerData *rovl,
+                  CoreSurface            *surface,
+                  CoreLayerRegionConfig  *config,
+                  CoreSurfaceBufferLock  *lock )
+{
+     RadeonDeviceData  *rdev       = rdrv->device_data;
+     DFBRectangle       source     = config->source;
+     u32                offsets[3] = { 0, 0, 0 };
+     u32                pitch      = lock->pitch;
+     int                even       = 0;
+     int                cropleft;
+     int                croptop;
+     
+     if (config->options & DLOP_DEINTERLACING) {
+          source.y /= 2;
+          source.h /= 2;
+          pitch    *= 2;
+          even      = rovl->field;
+     }
+     
+     cropleft = source.x;
+     croptop  = source.y;
+     
+     if (config->dest.x < 0)
+          cropleft += -config->dest.x * source.w / config->dest.w;
+          
+     if (config->dest.y < 0)
+          croptop  += -config->dest.y * source.h / config->dest.h;
+
+     if (DFB_PLANAR_PIXELFORMAT( surface->config.format )) {
+          cropleft &= ~31;
+          croptop  &= ~1;
+     
+          offsets[0]  = lock->offset;
+          offsets[1]  = offsets[0] + surface->config.size.h   * lock->pitch; 
+          offsets[2]  = offsets[1] + surface->config.size.h/2 * lock->pitch/2;
+          offsets[0] += croptop   * pitch   + cropleft;
+          offsets[1] += croptop/2 * pitch/2 + cropleft/2;
+          offsets[2] += croptop/2 * pitch/2 + cropleft/2;
+          
+          if (even) {
+               offsets[0] += lock->pitch;
+               offsets[1] += lock->pitch/2;
+               offsets[2] += lock->pitch/2;
+          }
+
+          if (surface->config.format == DSPF_YV12) {
+               u32 tmp    = offsets[1];
+               offsets[1] = offsets[2];
+               offsets[2] = tmp;
+          }
+     } 
+     else {
+          offsets[0] = lock->offset + croptop * pitch +
+                       cropleft * DFB_BYTES_PER_PIXEL( surface->config.format );
+          if (even) 
+               offsets[0] += lock->pitch;
+          
+          offsets[1] = 
+          offsets[2] = offsets[0];
+     }
+
+     if (lock->phys - lock->offset == rdev->fb_phys)
+          rovl->regs.BASE_ADDR = rdev->fb_offset;
+     else
+          rovl->regs.BASE_ADDR = rdev->agp_offset;
+ 
+     rovl->regs.VID_BUF0_BASE_ADRS   = (offsets[0] & VIF_BUF0_BASE_ADRS_MASK);
+     rovl->regs.VID_BUF1_BASE_ADRS   = (offsets[1] & VIF_BUF1_BASE_ADRS_MASK) |
+                                        VIF_BUF1_PITCH_SEL;
+     rovl->regs.VID_BUF2_BASE_ADRS   = (offsets[2] & VIF_BUF2_BASE_ADRS_MASK) |
+                                        VIF_BUF2_PITCH_SEL;
+     rovl->regs.VID_BUF3_BASE_ADRS   = (offsets[0] & VIF_BUF3_BASE_ADRS_MASK);
+     rovl->regs.VID_BUF4_BASE_ADRS   = (offsets[1] & VIF_BUF4_BASE_ADRS_MASK) |
+                                        VIF_BUF4_PITCH_SEL;
+     rovl->regs.VID_BUF5_BASE_ADRS   = (offsets[2] & VIF_BUF5_BASE_ADRS_MASK) |
+                                        VIF_BUF5_PITCH_SEL;   
+     rovl->regs.VID_BUF_PITCH0_VALUE = pitch;
+     rovl->regs.VID_BUF_PITCH1_VALUE = pitch/2;
+}
+
+static void 
+ovl_calc_regs( RadeonDriverData       *rdrv,
+               RadeonOverlayLayerData *rovl,
+               CoreSurface            *surface,
+               CoreLayerRegionConfig  *config,
+               CoreSurfaceBufferLock  *lock )
+{
+     rovl->regs.SCALE_CNTL = 0;
+     
+     /* Configure coordinates */
+     ovl_calc_coordinates( rdrv, rovl, surface, config );
+     
+     /* Configure buffers */                                   
+     ovl_calc_buffers( rdrv, rovl, surface, config, lock );
+     
+     /* Configure scaler */
+     if (rovl->level == -1) {
+          rovl->regs.KEY_CNTL   = GRAPHIC_KEY_FN_FALSE |
+                                  VIDEO_KEY_FN_FALSE   |
+                                  CMP_MIX_AND;
+          rovl->regs.MERGE_CNTL = DISP_ALPHA_MODE_PER_PIXEL |
+                                  0x00ff0000 | /* graphic alpha */
+                                  0xff000000; /* overlay alpha */
+     }
+     else if (config->options & DLOP_OPACITY) {
+          rovl->regs.KEY_CNTL   = GRAPHIC_KEY_FN_TRUE |
+                                  VIDEO_KEY_FN_TRUE   |
+                                  CMP_MIX_AND;
+          rovl->regs.MERGE_CNTL = DISP_ALPHA_MODE_GLOBAL |
+                                  0x00ff0000             |
+                                  (config->opacity << 24);
+     }
+     else {
+          rovl->regs.KEY_CNTL = CMP_MIX_AND;
+          
+          if (config->options & DLOP_SRC_COLORKEY)
+               rovl->regs.KEY_CNTL |= VIDEO_KEY_FN_NE;
+          else
+               rovl->regs.KEY_CNTL |= VIDEO_KEY_FN_TRUE;
+
+          if (config->options & DLOP_DST_COLORKEY)
+               rovl->regs.KEY_CNTL |= GRAPHIC_KEY_FN_EQ;
+          else
+               rovl->regs.KEY_CNTL |= GRAPHIC_KEY_FN_TRUE;
+
+          rovl->regs.MERGE_CNTL = 0xffff0000;
+     }
+     
+     if (config->opacity) {
+          rovl->regs.SCALE_CNTL = SCALER_SMART_SWITCH   |
+                                  SCALER_DOUBLE_BUFFER  |
+                                  SCALER_ADAPTIVE_DEINT |
+                                  (rovl->crtc2 << 14);
+          
+          if (config->source.w == config->dest.w)
+               rovl->regs.SCALE_CNTL |= SCALER_HORZ_PICK_NEAREST;
+          if (config->source.h == config->dest.h)
+               rovl->regs.SCALE_CNTL |= SCALER_VERT_PICK_NEAREST;
+ 
+          switch (surface->config.format) {
+               case DSPF_RGB555:
+               case DSPF_ARGB1555:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_15BPP |
+                                             SCALER_PRG_LOAD_START;
+                    break;
+               case DSPF_RGB16:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_16BPP |
+                                             SCALER_PRG_LOAD_START;
+                    break; 
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_32BPP |
+                                             SCALER_PRG_LOAD_START;
+                    break;
+               case DSPF_UYVY:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_YVYU422;
+                    break;
+               case DSPF_YUY2:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_VYUY422;
+                    break;
+               case DSPF_YV12:
+               case DSPF_I420:
+                    rovl->regs.SCALE_CNTL |= SCALER_SOURCE_YUV12;
+                    break;
+               default:
+                    D_BUG( "unexpected pixelformat" );
+                    config->opacity = 0;
+                    return;
+          }
+          
+          rovl->regs.SCALE_CNTL |= SCALER_ENABLE;
+     }          
+}
+
+static void 
+ovl_set_regs( RadeonDriverData       *rdrv,
+              RadeonOverlayLayerData *rovl )
+{
+     RadeonDeviceData *rdev = rdrv->device_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+     
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( mmio, OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK );
+     while(!(radeon_in32( mmio, OV0_REG_LOAD_CNTL ) & REG_LD_CTL_LOCK_READBACK));
+     
+     radeon_waitfifo( rdrv, rdev, 17 );
+     radeon_out32( mmio, OV0_H_INC,                  rovl->regs.H_INC );
+     radeon_out32( mmio, OV0_STEP_BY,                rovl->regs.STEP_BY );
+     if (rovl->crtc2) {
+          radeon_out32( mmio, OV1_Y_X_START,         rovl->regs.Y_X_START );
+          radeon_out32( mmio, OV1_Y_X_END,           rovl->regs.Y_X_END );
+     } else {
+          radeon_out32( mmio, OV0_Y_X_START,         rovl->regs.Y_X_START );
+          radeon_out32( mmio, OV0_Y_X_END,           rovl->regs.Y_X_END );
+     }
+     radeon_out32( mmio, OV0_V_INC,                  rovl->regs.V_INC );
+     radeon_out32( mmio, OV0_P1_BLANK_LINES_AT_TOP,  rovl->regs.P1_BLANK_LINES_AT_TOP );
+     radeon_out32( mmio, OV0_P23_BLANK_LINES_AT_TOP, rovl->regs.P23_BLANK_LINES_AT_TOP );
+     radeon_out32( mmio, OV0_VID_BUF_PITCH0_VALUE,   rovl->regs.VID_BUF_PITCH0_VALUE );
+     radeon_out32( mmio, OV0_VID_BUF_PITCH1_VALUE,   rovl->regs.VID_BUF_PITCH1_VALUE );
+     radeon_out32( mmio, OV0_P1_X_START_END,         rovl->regs.P1_X_START_END );
+     radeon_out32( mmio, OV0_P2_X_START_END,         rovl->regs.P2_X_START_END );
+     radeon_out32( mmio, OV0_P3_X_START_END,         rovl->regs.P3_X_START_END );
+     radeon_out32( mmio, OV0_P1_V_ACCUM_INIT,        rovl->regs.P1_V_ACCUM_INIT );
+     radeon_out32( mmio, OV0_BASE_ADDR,              rovl->regs.BASE_ADDR );
+     radeon_out32( mmio, OV0_VID_BUF0_BASE_ADRS,     rovl->regs.VID_BUF0_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF1_BASE_ADRS,     rovl->regs.VID_BUF1_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF2_BASE_ADRS,     rovl->regs.VID_BUF2_BASE_ADRS );
+    
+     radeon_waitfifo( rdrv, rdev, 10 );
+     radeon_out32( mmio, OV0_VID_BUF3_BASE_ADRS,     rovl->regs.VID_BUF3_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF4_BASE_ADRS,     rovl->regs.VID_BUF4_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF5_BASE_ADRS,     rovl->regs.VID_BUF5_BASE_ADRS );
+     radeon_out32( mmio, OV0_P1_H_ACCUM_INIT,        rovl->regs.P1_H_ACCUM_INIT );
+     radeon_out32( mmio, OV0_P23_V_ACCUM_INIT,       rovl->regs.P23_V_ACCUM_INIT );
+     radeon_out32( mmio, OV0_P23_H_ACCUM_INIT,       rovl->regs.P23_H_ACCUM_INIT );
+
+     radeon_out32( mmio, DISP_MERGE_CNTL,            rovl->regs.MERGE_CNTL );
+     radeon_out32( mmio, OV0_KEY_CNTL,               rovl->regs.KEY_CNTL ); 
+     radeon_out32( mmio, OV0_SCALE_CNTL,             rovl->regs.SCALE_CNTL );
+     
+     radeon_out32( mmio, OV0_REG_LOAD_CNTL, 0 );
+}
+
+static void
+ovl_set_buffers( RadeonDriverData       *rdrv,
+                 RadeonOverlayLayerData *rovl )
+{
+     RadeonDeviceData *rdev = rdrv->device_data;
+     volatile u8      *mmio = rdrv->mmio_base;
+      
+     radeon_waitfifo( rdrv, rdev, 1 );
+     radeon_out32( mmio, OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK );
+     while(!(radeon_in32( mmio, OV0_REG_LOAD_CNTL ) & REG_LD_CTL_LOCK_READBACK));
+
+     radeon_waitfifo( rdrv, rdev, 8 );
+     radeon_out32( mmio, OV0_BASE_ADDR,          rovl->regs.BASE_ADDR );
+     radeon_out32( mmio, OV0_VID_BUF0_BASE_ADRS, rovl->regs.VID_BUF0_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF1_BASE_ADRS, rovl->regs.VID_BUF1_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF2_BASE_ADRS, rovl->regs.VID_BUF2_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF3_BASE_ADRS, rovl->regs.VID_BUF3_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF4_BASE_ADRS, rovl->regs.VID_BUF4_BASE_ADRS );
+     radeon_out32( mmio, OV0_VID_BUF5_BASE_ADRS, rovl->regs.VID_BUF5_BASE_ADRS );
+
+     radeon_out32( mmio, OV0_REG_LOAD_CNTL, 0 );
+}
+
+static void
+ovl_set_colorkey( RadeonDriverData       *rdrv,
+                  RadeonOverlayLayerData *rovl,
+                  CoreLayerRegionConfig  *config )              
+{
+     volatile u8 *mmio = rdrv->mmio_base;
+     u32          SkeyLow, SkeyHigh;
+     u32          DkeyLow, DkeyHigh;
+     u32          tmp;
+     
+     SkeyLow  = PIXEL_RGB32( config->src_key.r,
+                             config->src_key.g,
+                             config->src_key.b );
+     SkeyHigh = SkeyLow | 0xff000000;
+     
+     tmp = radeon_in32( mmio, rovl->crtc2 ? CRTC2_GEN_CNTL : CRTC_GEN_CNTL );
+     switch ((tmp >> 8) & 0xf) {
+          case DST_8BPP:
+          case DST_8BPP_RGB332:
+               DkeyLow = ((MAX( config->dst_key.r - 0x20, 0 ) & 0xe0) << 16) |
+                         ((MAX( config->dst_key.g - 0x20, 0 ) & 0xe0) <<  8) |
+                         ((MAX( config->dst_key.b - 0x40, 0 ) & 0xc0)      );
+               break;
+          case DST_15BPP:
+               DkeyLow = ((MAX( config->dst_key.r - 0x08, 0 ) & 0xf8) << 16) |
+                         ((MAX( config->dst_key.g - 0x08, 0 ) & 0xf8) <<  8) |
+                         ((MAX( config->dst_key.b - 0x08, 0 ) & 0xf8)      );
+               break;
+          case DST_16BPP:
+               DkeyLow = ((MAX( config->dst_key.r - 0x08, 0 ) & 0xf8) << 16) |
+                         ((MAX( config->dst_key.g - 0x04, 0 ) & 0xfc) <<  8) |
+                         ((MAX( config->dst_key.b - 0x08, 0 ) & 0xf8)      );
+               break;
+          default:
+               DkeyLow = PIXEL_RGB32( config->dst_key.r,
+                                      config->dst_key.g,
+                                      config->dst_key.b );
+               break;
+     }
+
+     DkeyHigh = PIXEL_RGB32( config->dst_key.r,
+                             config->dst_key.g,
+                             config->dst_key.b ) | 0xff000000;
+
+     radeon_waitfifo( rdrv, rdrv->device_data, 4 );
+     radeon_out32( mmio, OV0_VID_KEY_CLR_LOW,   SkeyLow  );
+     radeon_out32( mmio, OV0_VID_KEY_CLR_HIGH,  SkeyHigh );
+     radeon_out32( mmio, OV0_GRPH_KEY_CLR_LOW,  DkeyLow  );
+     radeon_out32( mmio, OV0_GRPH_KEY_CLR_HIGH, DkeyHigh ); 
+}
+
+static void
+ovl_set_adjustment( RadeonDriverData       *rdrv,
+                    RadeonOverlayLayerData *rovl,
+                    float                   brightness,
+                    float                   contrast,
+                    float                   saturation,
+                    float                   hue )
+{
+     volatile u8   *mmio = rdrv->mmio_base;
+     float          HueSin, HueCos; 
+     float          Luma;
+     float          RCb, RCr;
+     float          GCb, GCr;
+     float          BCb, BCr;
+     float          AdjOff, ROff, GOff, BOff;
+     u32            dwLuma, dwROff, dwGOff, dwBOff;
+     u32            dwRCb, dwRCr;
+     u32            dwGCb, dwGCr;
+     u32            dwBCb, dwBCr;
+     
+     HueSin = sin( hue );
+     HueCos = cos( hue );
+
+     Luma = contrast   *           +1.1678;
+     RCb  = saturation * -HueSin * +1.6007;
+     RCr  = saturation *  HueCos * +1.6007;
+     GCb  = saturation * (HueCos * -0.3929 - HueSin * -0.8154);
+     GCr  = saturation * (HueCos * -0.3929 + HueCos * -0.8154);
+     BCb  = saturation *  HueCos * +2.0232;
+     BCr  = saturation *  HueSin * +2.0232;
+    
+     AdjOff = contrast * 1.1678 * brightness * 1023.0;
+     ROff   = AdjOff - Luma * 64.0 - (RCb + RCr) * 512.0;
+     GOff   = AdjOff - Luma * 64.0 - (GCb + GCr) * 512.0;
+     BOff   = AdjOff - Luma * 64.0 - (BCb + BCr) * 512.0;
+     ROff   = CLAMP( ROff, -2048.0, 2047.5 );
+     GOff   = CLAMP( GOff, -2048.0, 2047.5 );
+     BOff   = CLAMP( BOff, -2048.0, 2047.5 );
+     dwROff = ((u32)(ROff * 2.0)) & 0x1fff;
+     dwGOff = ((u32)(GOff * 2.0)) & 0x1fff;
+     dwBOff = ((u32)(BOff * 2.0)) & 0x1fff;
+ 
+     dwLuma = (((u32)(Luma * 256.0)) & 0xfff) << 20;
+     dwRCb  = (((u32)(RCb  * 256.0)) & 0xfff) <<  4;
+     dwRCr  = (((u32)(RCr  * 256.0)) & 0xfff) << 20;
+     dwGCb  = (((u32)(GCb  * 256.0)) & 0xfff) <<  4;
+     dwGCr  = (((u32)(GCr  * 256.0)) & 0xfff) << 20;
+     dwBCb  = (((u32)(BCb  * 256.0)) & 0xfff) <<  4;
+     dwBCr  = (((u32)(BCr  * 256.0)) & 0xfff) << 20;
+ 
+     radeon_waitfifo( rdrv, rdrv->device_data, 6 );
+     radeon_out32( mmio, OV0_LIN_TRANS_A, dwRCb  | dwLuma );
+     radeon_out32( mmio, OV0_LIN_TRANS_B, dwROff | dwRCr );
+     radeon_out32( mmio, OV0_LIN_TRANS_C, dwGCb  | dwLuma );
+     radeon_out32( mmio, OV0_LIN_TRANS_D, dwGOff | dwGCr );
+     radeon_out32( mmio, OV0_LIN_TRANS_E, dwBCb  | dwLuma );
+     radeon_out32( mmio, OV0_LIN_TRANS_F, dwBOff | dwBCr );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_regs.h b/Source/DirectFB/gfxdrivers/radeon/radeon_regs.h
new file mode 100755
index 0000000..03e5952
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_regs.h
@@ -0,0 +1,4364 @@
+/*
+ * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
+ *                VA Linux Systems Inc., Fremont, California.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
+ * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@xfree86.org>
+ *   Rickard E. Faith <faith@valinux.com>
+ *   Alan Hourihane <alanh@fairlite.demon.co.uk>
+ *
+ * References:
+ *
+ * !!!! FIXME !!!!
+ *   RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
+ *   Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
+ *   1999.
+ *
+ * !!!! FIXME !!!!
+ *   RAGE 128 Software Development Manual (Technical Reference Manual P/N
+ *   SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
+ *
+ */
+
+/* !!!! FIXME !!!!  NOTE: THIS FILE HAS BEEN CONVERTED FROM r128_reg.h
+ * AND CONTAINS REGISTERS AND REGISTER DEFINITIONS THAT ARE NOT CORRECT
+ * ON THE RADEON.  A FULL AUDIT OF THIS CODE IS NEEDED!  */
+
+#ifndef __RADEON_REGS_H__
+#define __RADEON_REGS_H__
+
+#ifdef ROP_XOR
+#undef ROP_XOR
+#endif
+
+#ifdef ROP_COPY
+#undef ROP_COPY
+#endif
+
+
+				/* Registers for 2D/Video/Overlay */
+#define CONFIG_VENDOR_ID             0x0f00 /* PCI */
+#define CONFIG_DEVICE_ID             0x0f02 /* PCI */
+#define CONFIG_ADAPTER_ID            0x0f2c /* PCI */
+
+#define AGP_BASE                     0x0170
+#define AGP_CNTL                     0x0174
+#       define AGP_APER_SIZE_256MB   (0x00 << 0)
+#       define AGP_APER_SIZE_128MB   (0x20 << 0)
+#       define AGP_APER_SIZE_64MB    (0x30 << 0)
+#       define AGP_APER_SIZE_32MB    (0x38 << 0)
+#       define AGP_APER_SIZE_16MB    (0x3c << 0)
+#       define AGP_APER_SIZE_8MB     (0x3e << 0)
+#       define AGP_APER_SIZE_4MB     (0x3f << 0)
+#       define AGP_APER_SIZE_MASK    (0x3f << 0)
+#define AGP_COMMAND                  0x0f60 /* PCI */
+#define AGP_COMMAND_PCI_CONFIG       0x0060 /* offset in PCI config*/
+#       define AGP_ENABLE            (1<<8)
+#define AGP_PLL_CNTL                 0x000b /* PLL */
+#define AGP_STATUS                   0x0f5c /* PCI */
+#       define AGP_1X_MODE           0x01
+#       define AGP_2X_MODE           0x02
+#       define AGP_4X_MODE           0x04
+#       define AGP_FW_MODE           0x10
+#       define AGP_MODE_MASK         0x17
+#define ATTRDR                       0x03c1 /* VGA */
+#define ATTRDW                       0x03c0 /* VGA */
+#define ATTRX                        0x03c0 /* VGA */
+#define AUX_SC_CNTL                  0x1660
+#       define AUX1_SC_EN            (1 << 0)
+#       define AUX1_SC_MODE_OR       (0 << 1)
+#       define AUX1_SC_MODE_NAND     (1 << 1)
+#       define AUX2_SC_EN            (1 << 2)
+#       define AUX2_SC_MODE_OR       (0 << 3)
+#       define AUX2_SC_MODE_NAND     (1 << 3)
+#       define AUX3_SC_EN            (1 << 4)
+#       define AUX3_SC_MODE_OR       (0 << 5)
+#       define AUX3_SC_MODE_NAND     (1 << 5)
+#define AUX1_SC_BOTTOM               0x1670
+#define AUX1_SC_LEFT                 0x1664
+#define AUX1_SC_RIGHT                0x1668
+#define AUX1_SC_TOP                  0x166c
+#define AUX2_SC_BOTTOM               0x1680
+#define AUX2_SC_LEFT                 0x1674
+#define AUX2_SC_RIGHT                0x1678
+#define AUX2_SC_TOP                  0x167c
+#define AUX3_SC_BOTTOM               0x1690
+#define AUX3_SC_LEFT                 0x1684
+#define AUX3_SC_RIGHT                0x1688
+#define AUX3_SC_TOP                  0x168c
+#define AUX_WINDOW_HORZ_CNTL         0x02d8
+#define AUX_WINDOW_VERT_CNTL         0x02dc
+
+#define BASE_CODE                    0x0f0b
+#define BIOS_0_SCRATCH               0x0010
+#define BIOS_1_SCRATCH               0x0014
+#define BIOS_2_SCRATCH               0x0018
+#define BIOS_3_SCRATCH               0x001c
+#define BIOS_4_SCRATCH               0x0020
+#define BIOS_5_SCRATCH               0x0024
+#define BIOS_6_SCRATCH               0x0028
+#define BIOS_7_SCRATCH               0x002c
+#define BIOS_ROM                     0x0f30 /* PCI */
+#define BIST                         0x0f0f /* PCI */
+#define BRUSH_DATA0                  0x1480
+#define BRUSH_DATA1                  0x1484
+#define BRUSH_DATA10                 0x14a8
+#define BRUSH_DATA11                 0x14ac
+#define BRUSH_DATA12                 0x14b0
+#define BRUSH_DATA13                 0x14b4
+#define BRUSH_DATA14                 0x14b8
+#define BRUSH_DATA15                 0x14bc
+#define BRUSH_DATA16                 0x14c0
+#define BRUSH_DATA17                 0x14c4
+#define BRUSH_DATA18                 0x14c8
+#define BRUSH_DATA19                 0x14cc
+#define BRUSH_DATA2                  0x1488
+#define BRUSH_DATA20                 0x14d0
+#define BRUSH_DATA21                 0x14d4
+#define BRUSH_DATA22                 0x14d8
+#define BRUSH_DATA23                 0x14dc
+#define BRUSH_DATA24                 0x14e0
+#define BRUSH_DATA25                 0x14e4
+#define BRUSH_DATA26                 0x14e8
+#define BRUSH_DATA27                 0x14ec
+#define BRUSH_DATA28                 0x14f0
+#define BRUSH_DATA29                 0x14f4
+#define BRUSH_DATA3                  0x148c
+#define BRUSH_DATA30                 0x14f8
+#define BRUSH_DATA31                 0x14fc
+#define BRUSH_DATA32                 0x1500
+#define BRUSH_DATA33                 0x1504
+#define BRUSH_DATA34                 0x1508
+#define BRUSH_DATA35                 0x150c
+#define BRUSH_DATA36                 0x1510
+#define BRUSH_DATA37                 0x1514
+#define BRUSH_DATA38                 0x1518
+#define BRUSH_DATA39                 0x151c
+#define BRUSH_DATA4                  0x1490
+#define BRUSH_DATA40                 0x1520
+#define BRUSH_DATA41                 0x1524
+#define BRUSH_DATA42                 0x1528
+#define BRUSH_DATA43                 0x152c
+#define BRUSH_DATA44                 0x1530
+#define BRUSH_DATA45                 0x1534
+#define BRUSH_DATA46                 0x1538
+#define BRUSH_DATA47                 0x153c
+#define BRUSH_DATA48                 0x1540
+#define BRUSH_DATA49                 0x1544
+#define BRUSH_DATA5                  0x1494
+#define BRUSH_DATA50                 0x1548
+#define BRUSH_DATA51                 0x154c
+#define BRUSH_DATA52                 0x1550
+#define BRUSH_DATA53                 0x1554
+#define BRUSH_DATA54                 0x1558
+#define BRUSH_DATA55                 0x155c
+#define BRUSH_DATA56                 0x1560
+#define BRUSH_DATA57                 0x1564
+#define BRUSH_DATA58                 0x1568
+#define BRUSH_DATA59                 0x156c
+#define BRUSH_DATA6                  0x1498
+#define BRUSH_DATA60                 0x1570
+#define BRUSH_DATA61                 0x1574
+#define BRUSH_DATA62                 0x1578
+#define BRUSH_DATA63                 0x157c
+#define BRUSH_DATA7                  0x149c
+#define BRUSH_DATA8                  0x14a0
+#define BRUSH_DATA9                  0x14a4
+#define BRUSH_SCALE                  0x1470
+#define BRUSH_Y_X                    0x1474
+#define BUS_CNTL                     0x0030
+#       define BUS_MASTER_DIS         (1 << 6)
+#       define BUS_RD_DISCARD_EN      (1 << 24)
+#       define BUS_RD_ABORT_EN        (1 << 25)
+#       define BUS_MSTR_DISCONNECT_EN (1 << 28)
+#       define BUS_WRT_BURST          (1 << 29)
+#       define BUS_READ_BURST         (1 << 30)
+#define BUS_CNTL1                    0x0034
+#       define BUS_WAIT_ON_LOCK_EN    (1 << 4)
+
+#define CACHE_CNTL                   0x1724
+#define CACHE_LINE                   0x0f0c /* PCI */
+#define CAP0_TRIG_CNTL               0x0950 /* ? */
+#define CAP1_TRIG_CNTL               0x09c0 /* ? */
+#define CAPABILITIES_ID              0x0f50 /* PCI */
+#define CAPABILITIES_PTR             0x0f34 /* PCI */
+#define CLK_PIN_CNTL                 0x0001 /* PLL */
+#       define SCLK_DYN_START_CNTL   (1 << 15)
+#define CLOCK_CNTL_DATA              0x000c
+#define CLOCK_CNTL_INDEX             0x0008
+#       define PLL_WR_EN             (1 << 7)
+#       define PLL_DIV_SEL           (3 << 8)
+#       define PLL2_DIV_SEL_MASK     ~(3 << 8)
+#define CLK_PWRMGT_CNTL              0x0014
+#       define ENGIN_DYNCLK_MODE     (1 << 12)
+#       define ACTIVE_HILO_LAT_MASK  (3 << 13)
+#       define ACTIVE_HILO_LAT_SHIFT 13
+#       define DISP_DYN_STOP_LAT_MASK (1 << 12)
+#       define DYN_STOP_MODE_MASK    (7 << 21)
+#define PLL_PWRMGT_CNTL              0x0015
+#       define TCL_BYPASS_DISABLE    (1 << 20)
+#define CLR_CMP_CLR_3D               0x1a24
+#define CLR_CMP_CLR_DST              0x15c8
+#define CLR_CMP_CLR_SRC              0x15c4
+#define CLR_CMP_CNTL                 0x15c0
+#       define SRC_CMP_EQ_COLOR      (4 <<  0)
+#       define SRC_CMP_NEQ_COLOR     (5 <<  0)
+#       define CLR_CMP_SRC_SOURCE    (1 << 24)
+#define CLR_CMP_MASK                 0x15cc
+#       define CLR_CMP_MSK           0xffffffff
+#define CLR_CMP_MASK_3D              0x1A28
+#define COMMAND                      0x0f04 /* PCI */
+#define COMPOSITE_SHADOW_ID          0x1a0c
+#define CONFIG_APER_0_BASE           0x0100
+#define CONFIG_APER_1_BASE           0x0104
+#define CONFIG_APER_SIZE             0x0108
+#define CONFIG_BONDS                 0x00e8
+#define CONFIG_CNTL                  0x00e0
+#       define CFG_ATI_REV_A11       (0   << 16)
+#       define CFG_ATI_REV_A12       (1   << 16)
+#       define CFG_ATI_REV_A13       (2   << 16)
+#       define CFG_ATI_REV_ID_MASK   (0xf << 16)
+#define CONFIG_MEMSIZE               0x00f8
+#define CONFIG_MEMSIZE_EMBEDDED      0x0114
+#define CONFIG_REG_1_BASE            0x010c
+#define CONFIG_REG_APER_SIZE         0x0110
+#define CONFIG_XSTRAP                0x00e4
+#define CONSTANT_COLOR_C             0x1d34
+#       define CONSTANT_COLOR_MASK   0x00ffffff
+#       define CONSTANT_COLOR_ONE    0x00ffffff
+#       define CONSTANT_COLOR_ZERO   0x00000000
+#define CRC_CMDFIFO_ADDR             0x0740
+#define CRC_CMDFIFO_DOUT             0x0744
+#define GRPH_BUFFER_CNTL             0x02f0
+#       define GRPH_START_REQ_MASK          (0x7f)
+#       define GRPH_START_REQ_SHIFT         0
+#       define GRPH_STOP_REQ_MASK           (0x7f<<8)
+#       define GRPH_STOP_REQ_SHIFT          8
+#       define GRPH_CRITICAL_POINT_MASK     (0x7f<<16)
+#       define GRPH_CRITICAL_POINT_SHIFT    16
+#       define GRPH_CRITICAL_CNTL           (1<<28)
+#       define GRPH_BUFFER_SIZE             (1<<29)
+#       define GRPH_CRITICAL_AT_SOF         (1<<30)
+#       define GRPH_STOP_CNTL               (1<<31)
+#define GRPH2_BUFFER_CNTL            0x03f0
+#       define GRPH2_START_REQ_MASK         (0x7f)
+#       define GRPH2_START_REQ_SHIFT         0
+#       define GRPH2_STOP_REQ_MASK          (0x7f<<8)
+#       define GRPH2_STOP_REQ_SHIFT         8
+#       define GRPH2_CRITICAL_POINT_MASK    (0x7f<<16)
+#       define GRPH2_CRITICAL_POINT_SHIFT   16
+#       define GRPH2_CRITICAL_CNTL          (1<<28)
+#       define GRPH2_BUFFER_SIZE            (1<<29)
+#       define GRPH2_CRITICAL_AT_SOF        (1<<30)
+#       define GRPH2_STOP_CNTL              (1<<31)
+#define CRTC_CRNT_FRAME              0x0214
+#define CRTC_EXT_CNTL                0x0054
+#       define CRTC_VGA_XOVERSCAN    (1 <<  0)
+#       define VGA_ATI_LINEAR        (1 <<  3)
+#       define XCRT_CNT_EN           (1 <<  6)
+#       define CRTC_HSYNC_DIS        (1 <<  8)
+#       define CRTC_VSYNC_DIS        (1 <<  9)
+#       define CRTC_DISPLAY_DIS      (1 << 10)
+#       define CRTC_SYNC_TRISTAT     (1 << 11)
+#       define CRTC_CRT_ON           (1 << 15)
+#define CRTC_EXT_CNTL_DPMS_BYTE      0x0055
+#       define CRTC_HSYNC_DIS_BYTE   (1 <<  0)
+#       define CRTC_VSYNC_DIS_BYTE   (1 <<  1)
+#       define CRTC_DISPLAY_DIS_BYTE (1 <<  2)
+#define CRTC_GEN_CNTL                0x0050
+#       define CRTC_DBL_SCAN_EN      (1 <<  0)
+#       define CRTC_INTERLACE_EN     (1 <<  1)
+#       define CRTC_CSYNC_EN         (1 <<  4)
+#       define CRTC_CUR_EN           (1 << 16)
+#       define CRTC_CUR_MODE_MASK    (7 << 17)
+#       define CRTC_ICON_EN          (1 << 20)
+#       define CRTC_EXT_DISP_EN      (1 << 24)
+#       define CRTC_EN               (1 << 25)
+#       define CRTC_DISP_REQ_EN_B    (1 << 26)
+#define CRTC2_GEN_CNTL               0x03f8
+#       define CRTC2_DBL_SCAN_EN     (1 <<  0)
+#       define CRTC2_INTERLACE_EN    (1 <<  1)
+#       define CRTC2_SYNC_TRISTAT    (1 <<  4)
+#       define CRTC2_HSYNC_TRISTAT   (1 <<  5)
+#       define CRTC2_VSYNC_TRISTAT   (1 <<  6)
+#       define CRTC2_CRT2_ON         (1 <<  7)
+#       define CRTC2_ICON_EN         (1 << 15)
+#       define CRTC2_CUR_EN          (1 << 16)
+#       define CRTC2_CUR_MODE_MASK   (7 << 20)
+#       define CRTC2_DISP_DIS        (1 << 23)
+#       define CRTC2_EN              (1 << 25)
+#       define CRTC2_DISP_REQ_EN_B   (1 << 26)
+#       define CRTC2_CSYNC_EN        (1 << 27)
+#       define CRTC2_HSYNC_DIS       (1 << 28)
+#       define CRTC2_VSYNC_DIS       (1 << 29)
+#define CRTC_MORE_CNTL               0x27c
+#       define CRTC_H_CUTOFF_ACTIVE_EN (1<<4)   
+#       define CRTC_V_CUTOFF_ACTIVE_EN (1<<5)   
+#define CRTC_GUI_TRIG_VLINE          0x0218
+#define CRTC_H_SYNC_STRT_WID         0x0204
+#       define CRTC_H_SYNC_STRT_PIX        (0x07  <<  0)
+#       define CRTC_H_SYNC_STRT_CHAR       (0x3ff <<  3)
+#       define CRTC_H_SYNC_STRT_CHAR_SHIFT 3
+#       define CRTC_H_SYNC_WID             (0x3f  << 16)
+#       define CRTC_H_SYNC_WID_SHIFT       16
+#       define CRTC_H_SYNC_POL             (1     << 23)
+#define CRTC2_H_SYNC_STRT_WID        0x0304
+#       define CRTC2_H_SYNC_STRT_PIX        (0x07  <<  0)
+#       define CRTC2_H_SYNC_STRT_CHAR       (0x3ff <<  3)
+#       define CRTC2_H_SYNC_STRT_CHAR_SHIFT 3
+#       define CRTC2_H_SYNC_WID             (0x3f  << 16)
+#       define CRTC2_H_SYNC_WID_SHIFT       16
+#       define CRTC2_H_SYNC_POL             (1     << 23)
+#define CRTC_H_TOTAL_DISP            0x0200
+#       define CRTC_H_TOTAL          (0x03ff << 0)
+#       define CRTC_H_TOTAL_SHIFT    0
+#       define CRTC_H_DISP           (0x01ff << 16)
+#       define CRTC_H_DISP_SHIFT     16
+#define CRTC2_H_TOTAL_DISP           0x0300
+#       define CRTC2_H_TOTAL         (0x03ff << 0)
+#       define CRTC2_H_TOTAL_SHIFT   0
+#       define CRTC2_H_DISP          (0x01ff << 16)
+#       define CRTC2_H_DISP_SHIFT    16
+#define CRTC_OFFSET                  0x0224
+#define CRTC2_OFFSET                 0x0324
+#define CRTC_OFFSET_CNTL             0x0228
+#       define CRTC_TILE_EN          (1 << 15)
+#       define CRTC_HSYNC_EN         (1 << 16)
+#define CRTC2_OFFSET_CNTL            0x0328
+#       define CRTC2_TILE_EN         (1 << 15)
+#define CRTC_PITCH                   0x022c
+#define CRTC2_PITCH                  0x032c
+#define CRTC_STATUS                  0x005c
+#       define CRTC_VBLANK_SAVE      (1 <<  1)
+#       define CRTC_VBLANK_SAVE_CLEAR  (1 <<  1)
+#define CRTC2_STATUS                  0x03fc
+#       define CRTC2_VBLANK_SAVE      (1 <<  1)
+#       define CRTC2_VBLANK_SAVE_CLEAR  (1 <<  1)
+#define CRTC_V_SYNC_STRT_WID         0x020c
+#       define CRTC_V_SYNC_STRT        (0x7ff <<  0)
+#       define CRTC_V_SYNC_STRT_SHIFT  0
+#       define CRTC_V_SYNC_WID         (0x1f  << 16)
+#       define CRTC_V_SYNC_WID_SHIFT   16
+#       define CRTC_V_SYNC_POL         (1     << 23)
+#define CRTC2_V_SYNC_STRT_WID        0x030c
+#       define CRTC2_V_SYNC_STRT       (0x7ff <<  0)
+#       define CRTC2_V_SYNC_STRT_SHIFT 0
+#       define CRTC2_V_SYNC_WID        (0x1f  << 16)
+#       define CRTC2_V_SYNC_WID_SHIFT  16
+#       define CRTC2_V_SYNC_POL        (1     << 23)
+#define CRTC_V_TOTAL_DISP            0x0208
+#       define CRTC_V_TOTAL          (0x07ff << 0)
+#       define CRTC_V_TOTAL_SHIFT    0
+#       define CRTC_V_DISP           (0x07ff << 16)
+#       define CRTC_V_DISP_SHIFT     16
+#define CRTC2_V_TOTAL_DISP           0x0308
+#       define CRTC2_V_TOTAL         (0x07ff << 0)
+#       define CRTC2_V_TOTAL_SHIFT   0
+#       define CRTC2_V_DISP          (0x07ff << 16)
+#       define CRTC2_V_DISP_SHIFT    16
+#define CRTC_VLINE_CRNT_VLINE        0x0210
+#       define CRTC_CRNT_VLINE_MASK  (0x7ff << 16)
+#define CRTC2_CRNT_FRAME             0x0314
+#define CRTC2_GUI_TRIG_VLINE         0x0318
+#define CRTC2_STATUS                 0x03fc
+#define CRTC2_VLINE_CRNT_VLINE       0x0310
+#define CRTC8_DATA                   0x03d5 /* VGA, 0x3b5 */
+#define CRTC8_IDX                    0x03d4 /* VGA, 0x3b4 */
+#define CUR_CLR0                     0x026c
+#define CUR_CLR1                     0x0270
+#define CUR_HORZ_VERT_OFF            0x0268
+#define CUR_HORZ_VERT_POSN           0x0264
+#define CUR_OFFSET                   0x0260
+#       define CUR_LOCK              (1 << 31)
+#define CUR2_CLR0                    0x036c
+#define CUR2_CLR1                    0x0370
+#define CUR2_HORZ_VERT_OFF           0x0368
+#define CUR2_HORZ_VERT_POSN          0x0364
+#define CUR2_OFFSET                  0x0360
+#       define CUR2_LOCK             (1 << 31)
+
+#define DAC_CNTL                     0x0058
+#       define DAC_RANGE_CNTL        (3 <<  0)
+#       define DAC_RANGE_CNTL_MASK   0x03
+#       define DAC_BLANKING          (1 <<  2)
+#       define DAC_CMP_EN            (1 <<  3)
+#       define DAC_CMP_OUTPUT        (1 <<  7)
+#       define DAC_8BIT_EN           (1 <<  8)
+#       define DAC_TVO_EN            (1 << 10)
+#       define DAC_VGA_ADR_EN        (1 << 13)
+#       define DAC_PDWN              (1 << 15)
+#       define DAC_MASK_ALL          (0xff << 24)
+#define DAC_CNTL2                    0x007c
+#       define DAC2_DAC_CLK_SEL      (1 <<  0)
+#       define DAC2_DAC2_CLK_SEL     (1 <<  1)
+#       define DAC2_PALETTE_ACC_CTL  (1 <<  5)
+#define DAC_EXT_CNTL                 0x0280
+#       define DAC_FORCE_BLANK_OFF_EN (1 << 4)
+#       define DAC_FORCE_DATA_EN      (1 << 5)
+#       define DAC_FORCE_DATA_SEL_MASK (3 << 6)
+#       define DAC_FORCE_DATA_MASK   0x0003ff00
+#       define DAC_FORCE_DATA_SHIFT  8
+#define DAC_MACRO_CNTL               0x0d04
+#       define DAC_PDWN_R            (1 << 16)
+#       define DAC_PDWN_G            (1 << 17)
+#       define DAC_PDWN_B            (1 << 18)
+#define DISP_HW_DEBUG                0x0d14
+#       define CRT2_DISP1_SEL        (1 <<  5)
+#define DISP_OUTPUT_CNTL             0x0d64
+#       define DISP_DAC_SOURCE_MASK    0x03
+#       define DISP_DAC2_SOURCE_MASK   0x0c
+#       define DISP_DAC_SOURCE_CRTC2   0x01
+#       define DISP_DAC2_SOURCE_CRTC2  0x04
+#       define DISP_TV_SOURCE          (1 << 16)
+#       define DISP_TV_MODE_MASK       (3 << 17)
+#       define DISP_TV_MODE_888        (0 << 17)
+#       define DISP_TV_MODE_565        (1 << 17)
+#       define DISP_TV_YG_DITH_EN      (1 << 19)
+#       define DISP_TV_CBB_CRR_DITH_EN (1 << 20)
+#       define DISP_TV_BIT_WIDTH       (1 << 21)
+#       define DISP_TV_SYNC_MODE_MASK  (3 << 22)
+#       define DISP_TV_SYNC_COLOR_MASK (3 << 25)
+#define DAC_CRC_SIG                  0x02cc
+#define DAC_DATA                     0x03c9 /* VGA */
+#define DAC_MASK                     0x03c6 /* VGA */
+#define DAC_R_INDEX                  0x03c7 /* VGA */
+#define DAC_W_INDEX                  0x03c8 /* VGA */
+#define DDA_CONFIG                   0x02e0
+#define DDA_ON_OFF                   0x02e4
+#define DEFAULT_OFFSET               0x16e0
+#define DEFAULT_PITCH                0x16e4
+#define DEFAULT_SC_BOTTOM_RIGHT      0x16e8
+#       define DEFAULT_SC_RIGHT_MAX  (0x1fff <<  0)
+#       define DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
+#define DESTINATION_3D_CLR_CMP_VAL   0x1820
+#define DESTINATION_3D_CLR_CMP_MSK   0x1824
+#define DISP_MISC_CNTL               0x0d00
+#       define SOFT_RESET_GRPH_PP    (1 << 0)
+#define DISP_MERGE_CNTL		  0x0d60
+#       define DISP_ALPHA_MODE_MASK  0x03
+#       define DISP_ALPHA_MODE_KEY   0
+#       define DISP_ALPHA_MODE_PER_PIXEL 1
+#       define DISP_ALPHA_MODE_GLOBAL 2
+#       define DISP_RGB_OFFSET_EN    (1<<8)
+#       define DISP_GRPH_ALPHA_MASK  (0xff << 16)
+#       define DISP_OV0_ALPHA_MASK   (0xff << 24)
+#	    define DISP_LIN_TRANS_BYPASS (0x01 << 9)
+#define DISP2_MERGE_CNTL		    0x0d68
+#       define DISP2_RGB_OFFSET_EN   (1<<8)
+#define DISP_LIN_TRANS_GRPH_A        0x0d80
+#define DISP_LIN_TRANS_GRPH_B        0x0d84
+#define DISP_LIN_TRANS_GRPH_C        0x0d88
+#define DISP_LIN_TRANS_GRPH_D        0x0d8c
+#define DISP_LIN_TRANS_GRPH_E        0x0d90
+#define DISP_LIN_TRANS_GRPH_F        0x0d98
+#define DP_BRUSH_BKGD_CLR            0x1478
+#define DP_BRUSH_FRGD_CLR            0x147c
+#define DP_CNTL                      0x16c0
+#       define DST_X_LEFT_TO_RIGHT   (1 <<  0)
+#       define DST_Y_TOP_TO_BOTTOM   (1 <<  1)
+#define DP_CNTL_XDIR_YDIR_YMAJOR     0x16d0
+#       define DST_Y_MAJOR             (1 <<  2)
+#       define DST_Y_DIR_TOP_TO_BOTTOM (1 << 15)
+#       define DST_X_DIR_LEFT_TO_RIGHT (1 << 31)
+#define DP_DATATYPE                  0x16c4
+#       define DST_8BPP	                0x00000002
+#       define DST_15BPP                0x00000003
+#       define DST_16BPP                0x00000004
+#       define DST_24BPP                0x00000005
+#       define DST_32BPP                0x00000006
+#       define DST_8BPP_RGB332          0x00000007
+#       define DST_8BPP_Y8              0x00000008
+#       define DST_8BPP_RGB8            0x00000009
+#       define DST_16BPP_VYUY422        0x0000000b
+#       define DST_16BPP_YVYU422        0x0000000c
+#       define DST_32BPP_AYUV444        0x0000000e
+#       define DST_16BPP_ARGB4444       0x0000000f
+#       define BRUSH_SOLIDCOLOR	        0x00000d00
+#       define SRC_MONO	                0x00000000
+#       define SRC_MONO_LBKGD           0x00010000
+#       define SRC_DSTCOLOR             0x00030000
+#       define BYTE_ORDER_MSB_TO_LSB    0x00000000
+#       define BYTE_ORDER_LSB_TO_MSB    0x40000000
+#       define DP_CONVERSION_TEMP       0x80000000
+#       define HOST_BIG_ENDIAN_EN       (1 << 29)
+#define DP_GUI_MASTER_CNTL           0x146c
+#       define GMC_SRC_PITCH_OFFSET_CNTL   (1    <<  0)
+#       define GMC_DST_PITCH_OFFSET_CNTL   (1    <<  1)
+#       define GMC_SRC_CLIPPING            (1    <<  2)
+#       define GMC_DST_CLIPPING            (1    <<  3)
+#       define GMC_BRUSH_DATATYPE_MASK     (0x0f <<  4)
+#       define GMC_BRUSH_8X8_MONO_FG_BG    (0    <<  4)
+#       define GMC_BRUSH_8X8_MONO_FG_LA    (1    <<  4)
+#       define GMC_BRUSH_1X8_MONO_FG_BG    (4    <<  4)
+#       define GMC_BRUSH_1X8_MONO_FG_LA    (5    <<  4)
+#       define GMC_BRUSH_32x1_MONO_FG_BG   (6    <<  4)
+#       define GMC_BRUSH_32x1_MONO_FG_LA   (7    <<  4)
+#       define GMC_BRUSH_32x32_MONO_FG_BG  (8    <<  4)
+#       define GMC_BRUSH_32x32_MONO_FG_LA  (9    <<  4)
+#       define GMC_BRUSH_8x8_COLOR         (10   <<  4)
+#       define GMC_BRUSH_1X8_COLOR         (12   <<  4)
+#       define GMC_BRUSH_SOLID_COLOR       (13   <<  4)
+#       define GMC_BRUSH_NONE              (15   <<  4)
+#       define GMC_DST_8BPP                (2    <<  8)
+#       define GMC_DST_15BPP               (3    <<  8)
+#       define GMC_DST_16BPP               (4    <<  8)
+#       define GMC_DST_24BPP               (5    <<  8)
+#       define GMC_DST_32BPP               (6    <<  8)
+#       define GMC_DST_8BPP_RGB            (7    <<  8)
+#       define GMC_DST_Y8                  (8    <<  8)
+#       define GMC_DST_RGB8                (9    <<  8)
+#       define GMC_DST_VYUY                (11   <<  8)
+#       define GMC_DST_YVYU                (12   <<  8)
+#       define GMC_DST_AYUV444             (14   <<  8)
+#       define GMC_DST_ARGB4444            (15   <<  8)
+#       define GMC_DST_DATATYPE_MASK       (0x0f <<  8)
+#       define GMC_DST_DATATYPE_SHIFT      8
+#       define GMC_SRC_DATATYPE_MASK       (3    << 12)
+#       define GMC_SRC_DATATYPE_MONO_FG_BG (0    << 12)
+#       define GMC_SRC_DATATYPE_MONO_FG_LA (1    << 12)
+#       define GMC_SRC_DATATYPE_COLOR      (3    << 12)
+#       define GMC_BYTE_PIX_ORDER          (1    << 14)
+#       define GMC_BYTE_MSB_TO_LSB         (0    << 14)
+#       define GMC_BYTE_LSB_TO_MSB         (1    << 14)
+#       define GMC_CONVERSION_TEMP         (1    << 15)
+#       define GMC_CONVERSION_TEMP_6500    (0    << 15)
+#       define GMC_CONVERSION_TEMP_9300    (1    << 15)
+#       define GMC_ROP3_MASK               (0xff << 16)
+#       define GMC_ROP3_PATCOPY		   0x00f00000
+#       define GMC_ROP3_SRCCOPY		   0x00cc0000
+#       define GMC_ROP3_PATXOR             0x005a0000
+#       define GMC_ROP3_XOR                0x00660000
+#       define GMC_DP_SRC_SOURCE_MASK      (7    << 24)
+#       define GMC_DP_SRC_SOURCE_MEMORY    (2    << 24)
+#       define GMC_DP_SRC_SOURCE_HOST_DATA (3    << 24)
+#       define GMC_3D_FCN_EN               (1    << 27)
+#       define GMC_CLR_CMP_CNTL_DIS        (1    << 28)
+#       define GMC_AUX_CLIP_DIS            (1    << 29)
+#       define GMC_WR_MSK_DIS              (1    << 30)
+#       define GMC_LD_BRUSH_Y_X            (1    << 31)
+#define DP_GUI_MASTER_CNTL_C         0x1c84
+#define DP_MIX                       0x16c8
+#define DP_SRC_BKGD_CLR              0x15dc
+#define DP_SRC_FRGD_CLR              0x15d8
+#define DP_WRITE_MASK                0x16cc
+#define DST_BRES_DEC                 0x1630
+#define DST_BRES_ERR                 0x1628
+#define DST_BRES_INC                 0x162c
+#define DST_BRES_LNTH                0x1634
+#define DST_BRES_LNTH_SUB            0x1638
+#define DST_HEIGHT                   0x1410
+#define DST_HEIGHT_WIDTH             0x143c
+#define DST_HEIGHT_WIDTH_8           0x158c
+#define DST_HEIGHT_WIDTH_BW          0x15b4
+#define DST_HEIGHT_Y                 0x15a0
+#define DST_LINE_START               0x1600
+#define DST_LINE_END                 0x1604
+#define DST_LINE_PATCOUNT            0x1608
+#       define BRES_CNTL_SHIFT       8
+#define DST_OFFSET                   0x1404
+#define DST_PITCH                    0x1408
+#define DST_PITCH_OFFSET             0x142c
+#define DST_PITCH_OFFSET_C           0x1c80
+#       define PITCH_SHIFT           21
+#       define DST_TILE_LINEAR       (0 << 30)
+#       define DST_TILE_MACRO        (1 << 30)
+#       define DST_TILE_MICRO        (2 << 30)
+#       define DST_TILE_BOTH         (3 << 30)
+#define DST_WIDTH                    0x140c
+#define DST_WIDTH_HEIGHT             0x1598
+#define DST_WIDTH_X                  0x1588
+#define DST_WIDTH_X_INCY             0x159c
+#define DST_X                        0x141c
+#define DST_X_SUB                    0x15a4
+#define DST_X_Y                      0x1594
+#define DST_Y                        0x1420
+#define DST_Y_SUB                    0x15a8
+#define DST_Y_X                      0x1438
+
+#define FCP_CNTL                     0x0910
+#      define FCP0_SRC_PCICLK             0
+#      define FCP0_SRC_PCLK               1
+#      define FCP0_SRC_PCLKb              2
+#      define FCP0_SRC_HREF               3
+#      define FCP0_SRC_GND                4
+#      define FCP0_SRC_HREFb              5
+#define FLUSH_1                      0x1704
+#define FLUSH_2                      0x1708
+#define FLUSH_3                      0x170c
+#define FLUSH_4                      0x1710
+#define FLUSH_5                      0x1714
+#define FLUSH_6                      0x1718
+#define FLUSH_7                      0x171c
+#define FOG_3D_TABLE_START           0x1810
+#define FOG_3D_TABLE_END             0x1814
+#define FOG_3D_TABLE_DENSITY         0x181c
+#define FOG_TABLE_INDEX              0x1a14
+#define FOG_TABLE_DATA               0x1a18
+#define FP_CRTC_H_TOTAL_DISP         0x0250
+#define FP_CRTC_V_TOTAL_DISP         0x0254
+#define FP_CRTC2_H_TOTAL_DISP        0x0350
+#define FP_CRTC2_V_TOTAL_DISP        0x0354
+#       define FP_CRTC_H_TOTAL_MASK      0x000003ff
+#       define FP_CRTC_H_DISP_MASK       0x01ff0000
+#       define FP_CRTC_V_TOTAL_MASK      0x00000fff
+#       define FP_CRTC_V_DISP_MASK       0x0fff0000
+#       define FP_H_SYNC_STRT_CHAR_MASK  0x00001ff8
+#       define FP_H_SYNC_WID_MASK        0x003f0000
+#       define FP_V_SYNC_STRT_MASK       0x00000fff
+#       define FP_V_SYNC_WID_MASK        0x001f0000
+#       define FP_CRTC_H_TOTAL_SHIFT     0x00000000
+#       define FP_CRTC_H_DISP_SHIFT      0x00000010
+#       define FP_CRTC_V_TOTAL_SHIFT     0x00000000
+#       define FP_CRTC_V_DISP_SHIFT      0x00000010
+#       define FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003
+#       define FP_H_SYNC_WID_SHIFT       0x00000010
+#       define FP_V_SYNC_STRT_SHIFT      0x00000000
+#       define FP_V_SYNC_WID_SHIFT       0x00000010
+#define FP_GEN_CNTL                  0x0284
+#       define FP_FPON                  (1 <<  0)
+#       define FP_BLANK_EN              (1 <<  1)
+#       define FP_TMDS_EN               (1 <<  2)
+#       define FP_PANEL_FORMAT          (1 <<  3)
+#       define FP_EN_TMDS               (1 <<  7)
+#       define FP_DETECT_SENSE          (1 <<  8)
+#       define R200_FP_SOURCE_SEL_MASK         (3 <<  10)
+#       define R200_FP_SOURCE_SEL_CRTC1        (0 <<  10)
+#       define R200_FP_SOURCE_SEL_CRTC2        (1 <<  10)
+#       define R200_FP_SOURCE_SEL_RMX          (2 <<  10)
+#       define R200_FP_SOURCE_SEL_TRANS        (3 <<  10)
+#       define FP_SEL_CRTC1             (0 << 13)
+#       define FP_SEL_CRTC2             (1 << 13)
+#       define FP_CRTC_DONT_SHADOW_HPAR (1 << 15)
+#       define FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
+#       define FP_CRTC_DONT_SHADOW_HEND (1 << 17)
+#       define FP_CRTC_USE_SHADOW_VEND  (1 << 18)
+#       define FP_RMX_HVSYNC_CONTROL_EN (1 << 20)
+#       define FP_DFP_SYNC_SEL          (1 << 21)
+#       define FP_CRTC_LOCK_8DOT        (1 << 22)
+#       define FP_CRT_SYNC_SEL          (1 << 23)
+#       define FP_USE_SHADOW_EN         (1 << 24)
+#       define FP_CRT_SYNC_ALT          (1 << 26)
+#define FP2_GEN_CNTL                 0x0288
+#       define FP2_BLANK_EN             (1 <<  1)
+#       define FP2_ON                   (1 <<  2)
+#       define FP2_PANEL_FORMAT         (1 <<  3)
+#       define R200_FP2_SOURCE_SEL_MASK        (3 << 10)
+#       define R200_FP2_SOURCE_SEL_CRTC1       (0 <<  10)
+#       define R200_FP2_SOURCE_SEL_CRTC2       (1 << 10)
+#       define R200_FP2_SOURCE_SEL_RMX         (2 << 10)
+#       define FP2_SRC_SEL_MASK         (3 << 13)
+#       define FP2_SRC_SEL_CRTC2        (1 << 13)
+#       define FP2_FP_POL               (1 << 16)
+#       define FP2_LP_POL               (1 << 17)
+#       define FP2_SCK_POL              (1 << 18)
+#       define FP2_LCD_CNTL_MASK        (7 << 19)
+#       define FP2_PAD_FLOP_EN          (1 << 22)
+#       define FP2_CRC_EN               (1 << 23)
+#       define FP2_CRC_READ_EN          (1 << 24)
+#       define FP2_DVO_EN               (1 << 25)
+#       define FP2_DVO_RATE_SEL_SDR     (1 << 26)
+#define FP_H_SYNC_STRT_WID           0x02c4
+#define FP2_H_SYNC_STRT_WID          0x03c4
+#define FP_HORZ_STRETCH              0x028c
+#define FP_HORZ2_STRETCH             0x038c
+#       define HORZ_STRETCH_RATIO_MASK 0xffff
+#       define HORZ_STRETCH_RATIO_MAX  4096
+#       define HORZ_PANEL_SIZE         (0x1ff   << 16)
+#       define HORZ_PANEL_SHIFT        16
+#       define HORZ_STRETCH_PIXREP     (0      << 25)
+#       define HORZ_STRETCH_BLEND      (1      << 26)
+#       define HORZ_STRETCH_ENABLE     (1      << 25)
+#       define HORZ_AUTO_RATIO         (1      << 27)
+#       define HORZ_FP_LOOP_STRETCH    (0x7    << 28)
+#       define HORZ_AUTO_RATIO_INC     (1      << 31)
+#define FP_V_SYNC_STRT_WID           0x02c8
+#define FP_VERT_STRETCH              0x0290
+#define FP2_V_SYNC_STRT_WID          0x03c8
+#define FP_VERT2_STRETCH             0x0390
+#       define VERT_PANEL_SIZE          (0xfff << 12)
+#       define VERT_PANEL_SHIFT         12
+#       define VERT_STRETCH_RATIO_MASK  0xfff
+#       define VERT_STRETCH_RATIO_SHIFT 0
+#       define VERT_STRETCH_RATIO_MAX   4096
+#       define VERT_STRETCH_ENABLE      (1     << 25)
+#       define VERT_STRETCH_LINEREP     (0     << 26)
+#       define VERT_STRETCH_BLEND       (1     << 26)
+#       define VERT_AUTO_RATIO_EN       (1     << 27)
+#       define VERT_STRETCH_RESERVED    0xf1000000
+
+#define GEN_INT_CNTL                 0x0040
+#define GEN_INT_STATUS               0x0044
+#       define VSYNC_INT_AK          (1 <<  2)
+#       define VSYNC_INT             (1 <<  2)
+#       define VSYNC2_INT_AK         (1 <<  6)
+#       define VSYNC2_INT            (1 <<  6)
+#define GENENB                       0x03c3 /* VGA */
+#define GENFC_RD                     0x03ca /* VGA */
+#define GENFC_WT                     0x03da /* VGA, 0x03ba */
+#define GENMO_RD                     0x03cc /* VGA */
+#define GENMO_WT                     0x03c2 /* VGA */
+#define GENS0                        0x03c2 /* VGA */
+#define GENS1                        0x03da /* VGA, 0x03ba */
+#define GPIO_MONID                   0x0068 /* DDC interface via I2C */
+#define GPIO_MONIDB                  0x006c
+#define GPIO_CRT2_DDC                0x006c
+#define GPIO_DVI_DDC                 0x0064
+#define GPIO_VGA_DDC                 0x0060
+#       define GPIO_A_0              (1 <<  0)
+#       define GPIO_A_1              (1 <<  1)
+#       define GPIO_Y_0              (1 <<  8)
+#       define GPIO_Y_1              (1 <<  9)
+#       define GPIO_Y_SHIFT_0        8
+#       define GPIO_Y_SHIFT_1        9
+#       define GPIO_EN_0             (1 << 16)
+#       define GPIO_EN_1             (1 << 17)
+#       define GPIO_MASK_0           (1 << 24) /*??*/
+#       define GPIO_MASK_1           (1 << 25) /*??*/
+#define GRPH8_DATA                   0x03cf /* VGA */
+#define GRPH8_IDX                    0x03ce /* VGA */
+#define GUI_SCRATCH_REG0             0x15e0
+#define GUI_SCRATCH_REG1             0x15e4
+#define GUI_SCRATCH_REG2             0x15e8
+#define GUI_SCRATCH_REG3             0x15ec
+#define GUI_SCRATCH_REG4             0x15f0
+#define GUI_SCRATCH_REG5             0x15f4
+
+#define HEADER                       0x0f0e /* PCI */
+#define HOST_DATA0                   0x17c0
+#define HOST_DATA1                   0x17c4
+#define HOST_DATA2                   0x17c8
+#define HOST_DATA3                   0x17cc
+#define HOST_DATA4                   0x17d0
+#define HOST_DATA5                   0x17d4
+#define HOST_DATA6                   0x17d8
+#define HOST_DATA7                   0x17dc
+#define HOST_DATA_LAST               0x17e0
+#define HOST_PATH_CNTL               0x0130
+#       define HDP_SOFT_RESET        (1 << 26)
+#define HTOTAL_CNTL                  0x0009 /* PLL */
+#define HTOTAL2_CNTL                 0x002e /* PLL */
+
+#define I2C_CNTL_1                   0x0094 /* ? */
+#define DVI_I2C_CNTL_1               0x02e4 /* ? */
+#define INTERRUPT_LINE               0x0f3c /* PCI */
+#define INTERRUPT_PIN                0x0f3d /* PCI */
+#define IO_BASE                      0x0f14 /* PCI */
+
+#define LATENCY                      0x0f0d /* PCI */
+#define LEAD_BRES_DEC                0x1608
+#define LEAD_BRES_LNTH               0x161c
+#define LEAD_BRES_LNTH_SUB           0x1624
+#define LVDS_GEN_CNTL                0x02d0
+#       define LVDS_ON               (1   <<  0)
+#       define LVDS_DISPLAY_DIS      (1   <<  1)
+#       define LVDS_PANEL_TYPE       (1   <<  2)
+#       define LVDS_PANEL_FORMAT     (1   <<  3)
+#       define LVDS_EN               (1   <<  7)
+#       define LVDS_DIGON            (1   << 18)
+#       define LVDS_BLON             (1   << 19)
+#       define LVDS_SEL_CRTC2        (1   << 23)
+#define LVDS_PLL_CNTL                0x02d4
+#       define HSYNC_DELAY_SHIFT     28
+#       define HSYNC_DELAY_MASK      (0xf << 28)
+
+#define MAX_LATENCY                  0x0f3f /* PCI */
+#define MC_AGP_LOCATION              0x014c
+#define MC_FB_LOCATION               0x0148
+#define CRTC_BASE_ADDR               0x023c
+#define CRTC2_BASE_ADDR              0x033c
+#define DISPLAY_TEST_DEBUG_CNTL      0x0d10
+#define NB_TOM                       0x015c
+#define MCLK_CNTL                    0x0012 /* PLL */
+#       define FORCEON_MCLKA         (1 << 16)
+#       define FORCEON_MCLKB         (1 << 17)
+#       define FORCEON_YCLKA         (1 << 18)
+#       define FORCEON_YCLKB         (1 << 19)
+#       define FORCEON_MC            (1 << 20)
+#       define FORCEON_AIC           (1 << 21)
+#       define R300_DISABLE_MC_MCLKA        (1 << 21)
+#       define R300_DISABLE_MC_MCLKB        (1 << 21)
+#define MCLK_MISC                    0x001f /* PLL */
+#       define MC_MCLK_MAX_DYN_STOP_LAT (1<<12)
+#       define IO_MCLK_MAX_DYN_STOP_LAT (1<<13)
+#       define MC_MCLK_DYN_ENABLE    (1 << 14)
+#       define IO_MCLK_DYN_ENABLE    (1 << 14)
+#define MDGPIO_A_REG                 0x01ac
+#define MDGPIO_EN_REG                0x01b0
+#define MDGPIO_MASK                  0x0198
+#define MDGPIO_Y_REG                 0x01b4
+#define MEM_ADDR_CONFIG              0x0148
+#define MEM_BASE                     0x0f10 /* PCI */
+#define MEM_CNTL                     0x0140
+#       define MEM_NUM_CHANNELS_MASK 0x01
+#       define MEM_USE_B_CH_ONLY     (1<<1)
+#       define RV100_HALF_MODE              (1<<3)
+#       define R300_MEM_NUM_CHANNELS_MASK   0x03
+#       define R300_MEM_USE_CD_CH_ONLY      (1<<2)
+#define MEM_TIMING_CNTL              0x0144 /* EXT_MEM_CNTL */
+#define MEM_INIT_LAT_TIMER           0x0154
+#define MEM_INTF_CNTL                0x014c
+#define MEM_SDRAM_MODE_REG           0x0158
+#define MEM_STR_CNTL                 0x0150
+#define MEM_VGA_RP_SEL               0x003c
+#define MEM_VGA_WP_SEL               0x0038
+#define MIN_GRANT                    0x0f3e /* PCI */
+#define MM_DATA                      0x0004
+#define MM_INDEX                     0x0000
+#define MPLL_CNTL                    0x000e /* PLL */
+#define MPP_TB_CONFIG                0x01c0 /* ? */
+#define MPP_GP_CONFIG                0x01c8 /* ? */
+#define R300_MC_IND_INDEX                   0x01f8
+#       define R300_MC_IND_ADDR_MASK        0x3f
+#define R300_MC_IND_DATA                    0x01fc
+#define R300_MC_READ_CNTL_AB                0x017c
+#       define R300_MEM_RBS_POSITION_A_MASK 0x03
+#define R300_MC_READ_CNTL_CD_mcind	    0x24
+#       define R300_MEM_RBS_POSITION_C_MASK 0x03
+
+#define N_VIF_COUNT                  0x0248
+
+/* overlay */
+#define	OV0_Y_X_START                0x0400
+#define	OV0_Y_X_END                  0x0404
+#define	OV0_PIPELINE_CNTL            0x0408
+#define	OV0_EXCLUSIVE_HORZ           0x0408
+#	define EXCL_HORZ_START_MASK         0x000000ff
+#	define EXCL_HORZ_END_MASK           0x0000ff00
+#	define EXCL_HORZ_BACK_PORCH_MASK    0x00ff0000
+#	define EXCL_HORZ_EXCLUSIVE_EN       0x80000000
+#define	OV0_EXCLUSIVE_VERT           0x040C
+#	define EXCL_VERT_START_MASK	        0x000003ff
+#	define EXCL_VERT_END_MASK           0x03ff0000
+#define	OV0_REG_LOAD_CNTL            0x0410
+#	define REG_LD_CTL_LOCK                  0x00000001
+#	define REG_LD_CTL_VBLANK_DURING_LOCK    0x00000002
+#	define REG_LD_CTL_STALL_GUI_UNTIL_FLIP  0x00000004
+#	define REG_LD_CTL_LOCK_READBACK         0x00000008
+#define	OV0_SCALE_CNTL               0x0420
+#	define SCALER_PIX_EXPAND           0x00000001
+#	define SCALER_Y2R_TEMP             0x00000002
+#	define SCALER_HORZ_PICK_NEAREST    0x00000004
+#	define SCALER_VERT_PICK_NEAREST    0x00000008
+#	define SCALER_SIGNED_UV	           0x00000010
+#	define SCALER_GAMMA_SEL_MASK       0x00000060
+#	define SCALER_GAMMA_SEL_BRIGHT     0x00000000
+#	define SCALER_GAMMA_SEL_G22        0x00000020
+#	define SCALER_GAMMA_SEL_G18        0x00000040
+#	define SCALER_GAMMA_SEL_G14        0x00000060
+#	define SCALER_COMCORE_SHIFT_UP_ONE 0x00000080
+#	define SCALER_SURFAC_FORMAT        0x00000f00
+#	define SCALER_SOURCE_UNK0          0x00000000 /* 2 bpp ??? */
+#	define SCALER_SOURCE_UNK1          0x00000100 /* 4 bpp ??? */
+#	define SCALER_SOURCE_UNK2          0x00000200 /* 8 bpp ??? */
+#	define SCALER_SOURCE_15BPP         0x00000300
+#	define SCALER_SOURCE_16BPP         0x00000400
+/*#	define SCALER_SOURCE_24BPP         0x00000500*/
+#	define SCALER_SOURCE_32BPP         0x00000600
+#	define SCALER_SOURCE_UNK3          0x00000700 /* 8BPP_RGB332 ??? */
+#	define SCALER_SOURCE_UNK4          0x00000800 /* 8BPP_Y8 ??? */
+#	define SCALER_SOURCE_YUV9          0x00000900 /* 8BPP_RGB8 */
+#	define SCALER_SOURCE_YUV12         0x00000A00
+#	define SCALER_SOURCE_VYUY422       0x00000B00
+#	define SCALER_SOURCE_YVYU422       0x00000C00
+#	define SCALER_SOURCE_UNK5          0x00000D00 /* ??? */
+#	define SCALER_SOURCE_UNK6          0x00000E00 /* 32BPP_AYUV444 */
+#	define SCALER_SOURCE_UNK7          0x00000F00 /* 16BPP_ARGB4444 */
+#	define SCALER_ADAPTIVE_DEINT       0x00001000
+#	define R200_SCALER_TEMPORAL_DEINT  0x00002000
+#	define SCALER_UNKNOWN_FLAG1        0x00004000 /* ??? */
+#	define SCALER_SMART_SWITCH         0x00008000
+#	define SCALER_BURST_PER_PLANE      0x007f0000
+#	define SCALER_DOUBLE_BUFFER        0x01000000
+#	define SCALER_UNKNOWN_FLAG3        0x02000000 /* ??? */
+#	define SCALER_UNKNOWN_FLAG4        0x04000000 /* ??? */
+#	define SCALER_DIS_LIMIT            0x08000000
+#	define SCALER_PRG_LOAD_START       0x10000000
+#	define SCALER_INT_EMU              0x20000000
+#	define SCALER_ENABLE               0x40000000
+#	define SCALER_SOFT_RESET           0x80000000
+#define	OV0_V_INC                    0x0424
+#define	OV0_P1_V_ACCUM_INIT          0x0428
+#	define OV0_P1_MAX_LN_IN_PER_LN_OUT  0x00000003
+#	define OV0_P1_V_ACCUM_INIT_MASK     0x01ff8000
+#define	OV0_P23_V_ACCUM_INIT         0x042C
+#	define OV0_P23_MAX_LN_IN_PER_LN_OUT 0x00000003
+#	define OV0_P23_V_ACCUM_INIT_MASK    0x01ff8000
+#define	OV0_P1_BLANK_LINES_AT_TOP    0x0430
+#	define P1_BLNK_LN_AT_TOP_M1_MASK    0x00000fff
+#	define P1_ACTIVE_LINES_M1           0x0fff0000
+#define	OV0_P23_BLANK_LINES_AT_TOP   0x0434
+#	define P23_BLNK_LN_AT_TOP_M1_MASK   0x000007ff
+#	define P23_ACTIVE_LINES_M1          0x07ff0000
+#define	OV0_BASE_ADDR                0x043C
+#define	OV0_VID_BUF0_BASE_ADRS       0x0440
+#	define VIF_BUF0_PITCH_SEL           0x00000001
+#	define VIF_BUF0_TILE_ADRS           0x00000002
+#	define VIF_BUF0_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF0_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF1_BASE_ADRS       0x0444
+#	define VIF_BUF1_PITCH_SEL           0x00000001
+#	define VIF_BUF1_TILE_ADRS           0x00000002
+#	define VIF_BUF1_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF1_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF2_BASE_ADRS       0x0448
+#	define VIF_BUF2_PITCH_SEL           0x00000001
+#	define VIF_BUF2_TILE_ADRS           0x00000002
+#	define VIF_BUF2_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF2_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF3_BASE_ADRS       0x044C
+#	define VIF_BUF3_PITCH_SEL           0x00000001
+#	define VIF_BUF3_TILE_ADRS           0x00000002
+#	define VIF_BUF3_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF3_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF4_BASE_ADRS       0x0450
+#	define VIF_BUF4_PITCH_SEL           0x00000001
+#	define VIF_BUF4_TILE_ADRS           0x00000002
+#	define VIF_BUF4_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF4_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF5_BASE_ADRS       0x0454
+#	define VIF_BUF5_PITCH_SEL           0x00000001
+#	define VIF_BUF5_TILE_ADRS           0x00000002
+#	define VIF_BUF5_BASE_ADRS_MASK      0xfffffff0
+#	define VIF_BUF5_1ST_LINE_LSBS_MASK  0x48000000
+#define	OV0_VID_BUF_PITCH0_VALUE     0x0460
+#define	OV0_VID_BUF_PITCH1_VALUE     0x0464
+#define	OV0_AUTO_FLIP_CNTL           0x0470
+#	define OV0_AUTO_FLIP_CNTL_SOFT_BUF_NUM        0x00000007
+#	define OV0_AUTO_FLIP_CNTL_SOFT_REPEAT_FIELD   0x00000008
+#	define OV0_AUTO_FLIP_CNTL_SOFT_BUF_ODD        0x00000010
+#	define OV0_AUTO_FLIP_CNTL_IGNORE_REPEAT_FIELD 0x00000020
+#	define OV0_AUTO_FLIP_CNTL_SOFT_EOF_TOGGLE     0x00000040
+#	define OV0_AUTO_FLIP_CNTL_VID_PORT_SELECT     0x00000300
+#	define OV0_AUTO_FLIP_CNTL_P1_FIRST_LINE_EVEN  0x00010000
+#	define OV0_AUTO_FLIP_CNTL_SHIFT_EVEN_DOWN     0x00040000
+#	define OV0_AUTO_FLIP_CNTL_SHIFT_ODD_DOWN      0x00080000
+#	define OV0_AUTO_FLIP_CNTL_FIELD_POL_SOURCE    0x00800000
+#define	OV0_DEINTERLACE_PATTERN      0x0474
+#define	OV0_SUBMIT_HISTORY           0x0478
+#define	OV0_H_INC                    0x0480
+#define	OV0_STEP_BY                  0x0484
+#define	OV0_P1_H_ACCUM_INIT          0x0488
+#define	OV0_P23_H_ACCUM_INIT         0x048C
+#define	OV0_P1_X_START_END           0x0494
+#define	OV0_P2_X_START_END           0x0498
+#define	OV0_P3_X_START_END	         0x049C
+#define	OV0_FILTER_CNTL	             0x04A0
+#	define FILTER_PROGRAMMABLE_COEF     0x00000000
+#	define FILTER_HARD_SCALE_HORZ_Y		0x00000001
+#	define FILTER_HARD_SCALE_HORZ_UV    0x00000002
+#	define FILTER_HARD_SCALE_VERT_Y     0x00000004
+#	define FILTER_HARD_SCALE_VERT_UV    0x00000008
+#	define FILTER_HARDCODED_COEF        0x0000000F
+#	define FILTER_COEF_MASK	            0x0000000F
+#define	OV0_FOUR_TAP_COEF_0          0x04B0
+#	define OV0_FOUR_TAP_PHASE_0_TAP_0   0x0000000F
+#	define OV0_FOUR_TAP_PHASE_0_TAP_1   0x00007F00
+#	define OV0_FOUR_TAP_PHASE_0_TAP_2   0x007F0000
+#	define OV0_FOUR_TAP_PHASE_0_TAP_3   0x0F000000
+#define	OV0_FOUR_TAP_COEF_1	         0x04B4
+#	define OV0_FOUR_TAP_PHASE_1_5_TAP_0 0x0000000F
+#	define OV0_FOUR_TAP_PHASE_1_5_TAP_1	0x00007F00
+#	define OV0_FOUR_TAP_PHASE_1_5_TAP_2	0x007F0000
+#	define OV0_FOUR_TAP_PHASE_1_5_TAP_3	0x0F000000
+#define	OV0_FOUR_TAP_COEF_2	         0x04B8
+#	define OV0_FOUR_TAP_PHASE_2_6_TAP_0	0x0000000F
+#	define OV0_FOUR_TAP_PHASE_2_6_TAP_1	0x00007F00
+#	define OV0_FOUR_TAP_PHASE_2_6_TAP_2	0x007F0000
+#	define OV0_FOUR_TAP_PHASE_2_6_TAP_3	0x0F000000
+#define	OV0_FOUR_TAP_COEF_3	         0x04BC
+#	define OV0_FOUR_TAP_PHASE_3_7_TAP_0	0x0000000F
+#	define OV0_FOUR_TAP_PHASE_3_7_TAP_1	0x00007F00
+#	define OV0_FOUR_TAP_PHASE_3_7_TAP_2	0x007F0000
+#	define OV0_FOUR_TAP_PHASE_3_7_TAP_3	0x0F000000
+#define	OV0_FOUR_TAP_COEF_4	         0x04C0
+#	define OV0_FOUR_TAP_PHASE_4_TAP_0	0x0000000F
+#	define OV0_FOUR_TAP_PHASE_4_TAP_1	0x00007F00
+#	define OV0_FOUR_TAP_PHASE_4_TAP_2	0x007F0000
+#	define OV0_FOUR_TAP_PHASE_4_TAP_3	0x0F000000
+#define	OV0_FLAG_CNTL                0x04DC
+#define	OV0_SLICE_CNTL               0x04E0
+#	define SLICE_CNTL_DISABLE       0x40000000
+#define	OV0_VID_KEY_CLR_LOW	         0x04E4
+#define	OV0_VID_KEY_CLR_HIGH         0x04E8
+#define	OV0_GRPH_KEY_CLR_LOW         0x04EC
+#define	OV0_GRPH_KEY_CLR_HIGH        0x04F0
+#define	OV0_KEY_CNTL                 0x04F4
+#	define VIDEO_KEY_FN_MASK        0x00000003
+#	define VIDEO_KEY_FN_FALSE       0x00000000
+#	define VIDEO_KEY_FN_TRUE        0x00000001
+#	define VIDEO_KEY_FN_EQ          0x00000002
+#	define VIDEO_KEY_FN_NE          0x00000003
+#	define GRAPHIC_KEY_FN_MASK      0x00000030
+#	define GRAPHIC_KEY_FN_FALSE     0x00000000
+#	define GRAPHIC_KEY_FN_TRUE      0x00000010
+#	define GRAPHIC_KEY_FN_EQ        0x00000020
+#	define GRAPHIC_KEY_FN_NE        0x00000030
+#	define CMP_MIX_MASK             0x00000100
+#	define CMP_MIX_OR               0x00000000
+#	define CMP_MIX_AND              0x00000100
+#define	OV0_TEST                     0x04F8
+#	define OV0_SCALER_Y2R_DISABLE   0x00000001
+#	define OV0_SUBPIC_ONLY          0x00000008
+#	define OV0_EXTENSE              0x00000010
+#	define OV0_SWAP_UV              0x00000020
+#define OV0_COL_CONV				 0x04FC
+#	define OV0_CB_TO_B              0x0000007F
+#	define OV0_CB_TO_G              0x0000FF00
+#	define OV0_CR_TO_G              0x00FF0000
+#	define OV0_CR_TO_R              0x7F000000
+#	define OV0_NEW_COL_CONV			0x80000000
+#define OV1_Y_X_START                0x0600
+#define OV1_Y_X_END                  0x0604
+#define	OV0_LIN_TRANS_A              0x0D20
+#define	OV0_LIN_TRANS_B              0x0D24
+#define	OV0_LIN_TRANS_C              0x0D28
+#define	OV0_LIN_TRANS_D	             0x0D2C
+#define	OV0_LIN_TRANS_E              0x0D30
+#define	OV0_LIN_TRANS_F              0x0D34
+#define OV0_GAMMA_000_00F            0x0d40
+#define OV0_GAMMA_010_01F            0x0d44
+#define OV0_GAMMA_020_03F            0x0d48
+#define OV0_GAMMA_040_07F            0x0d4c
+#define OV0_GAMMA_080_0BF            0x0e00
+#define OV0_GAMMA_0C0_0FF            0x0e04
+#define OV0_GAMMA_100_13F            0x0e08
+#define OV0_GAMMA_140_17F            0x0e0c
+#define OV0_GAMMA_180_1BF            0x0e10
+#define OV0_GAMMA_1C0_1FF            0x0e14
+#define OV0_GAMMA_200_23F            0x0e18
+#define OV0_GAMMA_240_27F            0x0e1c
+#define OV0_GAMMA_280_2BF            0x0e20
+#define OV0_GAMMA_2C0_2FF            0x0e24
+#define OV0_GAMMA_300_33F            0x0e28
+#define OV0_GAMMA_340_37F            0x0e2c
+#define OV0_GAMMA_380_3BF            0x0d50
+#define OV0_GAMMA_3C0_3FF            0x0d54
+
+#define OVR_CLR                      0x0230
+#define OVR_WID_LEFT_RIGHT           0x0234
+#define OVR_WID_TOP_BOTTOM           0x0238
+
+/* subpicture */
+#define	SUBPIC_CNTL	                 0x0540
+#define	SUBPIC_DEFCOLCON             0x0544
+#define	SUBPIC_Y_X_START             0x054C
+#define	SUBPIC_Y_X_END               0x0550
+#define	SUBPIC_V_INC                 0x0554
+#define	SUBPIC_H_INC                 0x0558
+#define	SUBPIC_BUF0_OFFSET           0x055C
+#define	SUBPIC_BUF1_OFFSET           0x0560
+#define	SUBPIC_LC0_OFFSET            0x0564
+#define	SUBPIC_LC1_OFFSET            0x0568
+#define	SUBPIC_PITCH                 0x056C
+#define	SUBPIC_BTN_HLI_COLCON        0x0570
+#define	SUBPIC_BTN_HLI_Y_X_START     0x0574
+#define	SUBPIC_BTN_HLI_Y_X_END       0x0578
+#define	SUBPIC_PALETTE_INDEX         0x057C
+#define	SUBPIC_PALETTE_DATA	         0x0580
+#define	SUBPIC_H_ACCUM_INIT          0x0584
+#define	SUBPIC_V_ACCUM_INIT          0x0588
+
+#define P2PLL_CNTL                   0x002a /* P2PLL */
+#       define P2PLL_RESET                (1 <<  0)
+#       define P2PLL_SLEEP                (1 <<  1)
+#       define P2PLL_ATOMIC_UPDATE_EN     (1 << 16)
+#       define P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
+#       define P2PLL_ATOMIC_UPDATE_VSYNC  (1 << 18)
+#define P2PLL_DIV_0                  0x002c
+#       define P2PLL_FB0_DIV_MASK    0x07ff
+#       define P2PLL_POST0_DIV_MASK  0x00070000
+#define P2PLL_REF_DIV                0x002B /* PLL */
+#       define P2PLL_REF_DIV_MASK    0x03ff
+#       define P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
+#       define P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
+#       define R300_PPLL_REF_DIV_ACC_MASK   (0x3ff << 18)
+#       define R300_PPLL_REF_DIV_ACC_SHIFT  18
+#define PALETTE_DATA                 0x00b4
+#define PALETTE_30_DATA              0x00b8
+#define PALETTE_INDEX                0x00b0
+#define PCI_GART_PAGE                0x017c
+#define PIXCLKS_CNTL                 0x002d
+#       define PIX2CLK_SRC_SEL_MASK     0x03
+#       define PIX2CLK_SRC_SEL_CPUCLK   0x00
+#       define PIX2CLK_SRC_SEL_PSCANCLK 0x01
+#       define PIX2CLK_SRC_SEL_BYTECLK  0x02
+#       define PIX2CLK_SRC_SEL_P2PLLCLK 0x03
+#       define PIX2CLK_ALWAYS_ONb       (1<<6)
+#       define PIX2CLK_DAC_ALWAYS_ONb   (1<<7)
+#       define PIXCLK_TV_SRC_SEL        (1 << 8)
+#       define DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb (1 << 9)
+#       define R300_DVOCLK_ALWAYS_ONb          (1 << 10)
+#       define PIXCLK_BLEND_ALWAYS_ONb  (1 << 11)
+#       define PIXCLK_GV_ALWAYS_ONb     (1 << 12)
+#       define PIXCLK_DIG_TMDS_ALWAYS_ONb (1 << 13)
+#       define R300_PIXCLK_DVO_ALWAYS_ONb      (1 << 13)
+#       define PIXCLK_LVDS_ALWAYS_ONb   (1 << 14)
+#       define PIXCLK_TMDS_ALWAYS_ONb   (1 << 15)
+#       define R300_PIXCLK_TRANS_ALWAYS_ONb    (1 << 16)
+#       define R300_PIXCLK_TVO_ALWAYS_ONb      (1 << 17)
+#       define R300_P2G2CLK_ALWAYS_ONb         (1 << 18)
+#       define R300_P2G2CLK_DAC_ALWAYS_ONb     (1 << 19)
+#       define R300_DISP_DAC_PIXCLK_DAC2_BLANK_OFF (1 << 23)
+#define PLANE_3D_MASK_C              0x1d44
+#define PLL_TEST_CNTL                0x0013 /* PLL */
+#define PMI_CAP_ID                   0x0f5c /* PCI */
+#define PMI_DATA                     0x0f63 /* PCI */
+#define PMI_NXT_CAP_PTR              0x0f5d /* PCI */
+#define PMI_PMC_REG                  0x0f5e /* PCI */
+#define PMI_PMCSR_REG                0x0f60 /* PCI */
+#define PMI_REGISTER                 0x0f5c /* PCI */
+#define PPLL_CNTL                    0x0002 /* PLL */
+#       define PPLL_RESET                (1 <<  0)
+#       define PPLL_SLEEP                (1 <<  1)
+#       define PPLL_ATOMIC_UPDATE_EN     (1 << 16)
+#       define PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
+#       define PPLL_ATOMIC_UPDATE_VSYNC  (1 << 18)
+#define PPLL_DIV_0                   0x0004 /* PLL */
+#define PPLL_DIV_1                   0x0005 /* PLL */
+#define PPLL_DIV_2                   0x0006 /* PLL */
+#define PPLL_DIV_3                   0x0007 /* PLL */
+#       define PPLL_FB3_DIV_MASK     0x07ff
+#       define PPLL_POST3_DIV_MASK   0x00070000
+#define PPLL_REF_DIV                 0x0003 /* PLL */
+#       define PPLL_REF_DIV_MASK     0x03ff
+#       define PPLL_ATOMIC_UPDATE_R  (1 << 15) /* same as _W */
+#       define PPLL_ATOMIC_UPDATE_W  (1 << 15) /* same as _R */
+#define PWR_MNGMT_CNTL_STATUS        0x0f60 /* PCI */
+
+/* ERT registers */
+#define TV_MASTER_CNTL                    0x0800
+#       define TV_MASTER_TVCLK_ALWAYS_ONb       (1 << 30)
+#       define TV_MASTER_TV_ON                  (1 << 31)
+#define TV_RGB_CNTL                       0x0804
+#       define TV_RGB_CNTL_INI	         0x007b0004
+#define TV_SYNC_CNTL                      0x0808
+#define TV_HTOTAL                         0x080c
+#define TV_HDISP                          0x0810
+#define TV_HSTART                         0x0818
+#define TV_HCOUNT                         0x081c
+#define TV_VTOTAL                         0x0820
+#define TV_VDISP                          0x0824
+#define TV_VCOUNT                         0x0828
+#define TV_FTOTAL                         0x082c
+#define TV_FCOUNT                         0x0830
+#define TV_FRESTART                       0x0834
+#define TV_HRESTART                       0x0838
+#define TV_VRESTART                       0x083c
+#define TV_HOST_READ_DATA                 0x0840
+#define TV_HOST_WRITE_DATA                0x0844
+#define TV_HOST_RD_WT_CNTL                0x0848
+#define TV_VSCALER_CNTL1                  0x084c
+#       define TV_VSCALER_RESTART_FIELD	        (1 << 29)
+#define TV_TIMING_CNTL                    0x0850
+#define TV_VSCALER_CNTL2                  0x0854
+#define TV_Y_FALL_CNTL                    0x0858
+#define TV_Y_RISE_CNTL                    0x085c
+#define TV_Y_SAWTOOTH_CNTL                0x0860
+#define TV_UPSAMP_AND_GAIN_CNTL           0x0864
+#define TV_GAIN_LIMIT_SETTINGS            0x0868
+#define TV_LINEAR_GAIN_SETTINGS           0x086c
+#define TV_MODULATOR_CNTL1                0x0870
+#define TV_MODULATOR_CNTL2                0x0874
+#define TV_PRE_DAC_MUX_CNTL               0x0888
+#       define TV_PRE_DAC_Y_RED_EN              (1 << 0)
+#       define TV_PRE_DAC_C_GRN_EN              (1 << 1)
+#       define TV_PRE_DAC_CMP_BLU_EN            (1 << 2)
+#       define TV_PRE_DAC_RED_MX_FORCE_DAC_DATA (6 << 4)
+#       define TV_PRE_DAC_GRN_MX_FORCE_DAC_DATA (6 << 8)
+#       define TV_PRE_DAC_BLU_MX_FORCE_DAC_DATA (6 << 12)
+#       define TV_FORCE_DAC_DATA_SHIFT           16
+#define TV_DAC_CNTL                       0x088c
+#       define TV_DAC_NBLANK	                  (1 << 0)
+#       define	TV_DAC_NHOLD                     (1 << 1)
+#       define TV_DAC_CMPOUT                    (1 << 5)
+#       define	TV_DAC_BGSLEEP                   (1 << 6)
+#       define	TV_DAC_RDACPD                    (1 << 24)
+#       define	TV_DAC_GDACPD                    (1 << 25)
+#       define	TV_DAC_BDACPD                    (1 << 26)
+#define TV_CRC_CNTL                       0x0890
+#define TV_UV_ADR                         0x08ac
+/* ERT PLL registers */
+#define TV_PLL_CNTL	                      0x21
+#define TV_PLL_CNTL1                      0x22
+#       define	TV_PLL_CNTL1_TVPLL_RESET	        (1 << 1)
+#       define	TV_PLL_CNTL1_TVPLL_SLEEP         (1 << 3)
+#       define	TV_PLL_CNTL1_TVPDC_SHIFT          14
+#       define	TV_PLL_CNTL1_TVPDC_MASK          (3 << 14)
+#       define	TV_PLL_CNTL1_TVCLK_SRC_SEL       (1 << 30)
+
+
+#define RBBM_GUICNTL                 0x172c
+#       define HOST_DATA_SWAP_NONE   (0 << 0)
+#       define HOST_DATA_SWAP_16BIT  (1 << 0)
+#       define HOST_DATA_SWAP_32BIT  (2 << 0)
+#       define HOST_DATA_SWAP_HDW    (3 << 0)
+#define RBBM_SOFT_RESET              0x00f0
+#       define SOFT_RESET_CP         (1 <<  0)
+#       define SOFT_RESET_HI         (1 <<  1)
+#       define SOFT_RESET_SE         (1 <<  2)
+#       define SOFT_RESET_RE         (1 <<  3)
+#       define SOFT_RESET_PP         (1 <<  4)
+#       define SOFT_RESET_E2         (1 <<  5)
+#       define SOFT_RESET_RB         (1 <<  6)
+#       define SOFT_RESET_HDP        (1 <<  7)
+#define RBBM_STATUS                  0x0e40
+#       define RBBM_FIFOCNT_MASK     0x007f
+#       define RBBM_ACTIVE           (1 << 31)
+#define RB2D_DSTCACHE_MODE           0x3428
+#       define RB2D_DC_CACHE_ENABLE           (0)
+#       define RB2D_DC_2D_CACHE_DISABLE       (1)
+#       define RB2D_DC_3D_CACHE_DISABLE       (2)
+#       define RB2D_DC_CACHE_DISABLE		 (3)
+#       define RB2D_DC_2D_CACHE_LINESIZE_128	 (1 << 2)
+#       define RB2D_DC_3D_CACHE_LINESIZE_128  (2 << 2)
+#       define RB2D_DC_2D_CACHE_AUTOFLUSH     (1 << 8)
+#       define RB2D_DC_3D_CACHE_AUTOFLUSH     (2 << 8)
+#       define R200_RB2D_DC_2D_CACHE_AUTOFREE (1 << 10)
+#       define R200_RB2D_DC_3D_CACHE_AUTOFREE (2 << 10)
+#       define RB2D_DC_FORCE_RMW              (1 << 16)
+#       define R300_RB2D_DC_ENABLE            (1 << 17)
+#       define RB2D_DC_DISABLE_RI_FILL        (1 << 24)
+#       define RB2D_DC_DISABLE_RI_READ        (1 << 25)
+#       define RB2D_DC_DISABLE_MASK_CHK       (1 << 26)
+#define RB2D_DSTCACHE_CTLSTAT        0x342c
+#       define RB2D_DC_FLUSH         (3 << 0)
+#       define RB2D_DC_FREE          (3 << 2)
+#       define RB2D_DC_FLUSH_ALL     0xf
+#       define RB2D_DC_BUSY          (1 << 31)
+#define RB3D_DSTCACHE_MODE           0x3258
+#       define RB3D_DC_CACHE_ENABLE           (0)
+#       define RB3D_DC_2D_CACHE_DISABLE       (1)
+#       define RB3D_DC_3D_CACHE_DISABLE       (2)
+#       define RB3D_DC_CACHE_DISABLE		 (3)
+#       define RB3D_DC_2D_CACHE_LINESIZE_128	 (1 << 2)
+#       define RB3D_DC_3D_CACHE_LINESIZE_128  (2 << 2)
+#       define RB3D_DC_2D_CACHE_AUTOFLUSH     (1 << 8)
+#       define RB3D_DC_3D_CACHE_AUTOFLUSH     (2 << 8)
+#       define R200_RB3D_DC_2D_CACHE_AUTOFREE (1 << 10)
+#       define R200_RB3D_DC_3D_CACHE_AUTOFREE (2 << 10)
+#       define RB3D_DC_FORCE_RMW              (1 << 16)
+#       define R300_RB3D_DC_ENABLE            (1 << 17)
+#       define RB3D_DC_DISABLE_RI_FILL        (1 << 24)
+#       define RB3D_DC_DISABLE_RI_READ        (1 << 25)
+#       define RB3D_DC_DISABLE_MASK_CHK       (1 << 26)
+#define RB3D_DSTCACHE_CTLSTAT        0x325C
+#       define RB3D_DC_FLUSH                  (3 << 0)
+#       define RB3D_DC_FREE                   (3 << 2)
+#       define RB3D_DC_FLUSH_ALL               0xf
+#       define RB3D_DC_BUSY                   (1 << 31)
+#define REG_BASE                     0x0f18 /* PCI */
+#define REGPROG_INF                  0x0f09 /* PCI */
+#define REVISION_ID                  0x0f08 /* PCI */
+
+#define SC_BOTTOM                    0x164c
+#define SC_BOTTOM_RIGHT              0x16f0
+#define SC_BOTTOM_RIGHT_C            0x1c8c
+#define SC_LEFT                      0x1640
+#define SC_RIGHT                     0x1644
+#define SC_TOP                       0x1648
+#define SC_TOP_LEFT                  0x16ec
+#define SC_TOP_LEFT_C                0x1c88
+#       define SC_SIGN_MASK_LO       0x8000
+#       define SC_SIGN_MASK_HI       0x80000000
+#define SCLK_CNTL                    0x000d /* PLL */
+#       define SCLK_SRC_SEL_MASK     0x0007
+#       define DYN_STOP_LAT_MASK     0x00007ff8
+#       define CP_MAX_DYN_STOP_LAT   0x0008
+#       define SCLK_FORCEON_MASK     0xffff8000
+#       define SCLK_FORCE_DISP2      (1<<15)
+#       define SCLK_FORCE_CP         (1<<16)
+#       define SCLK_FORCE_HDP        (1<<17)
+#       define SCLK_FORCE_DISP1      (1<<18)
+#       define SCLK_FORCE_TOP        (1<<19)
+#       define SCLK_FORCE_E2         (1<<20)
+#       define SCLK_FORCE_SE         (1<<21)
+#       define SCLK_FORCE_IDCT       (1<<22)
+#       define SCLK_FORCE_VIP        (1<<23)
+#       define SCLK_FORCE_RE         (1<<24)
+#       define SCLK_FORCE_PB         (1<<25)
+#       define SCLK_FORCE_TAM        (1<<26)
+#       define SCLK_FORCE_TDM        (1<<27)
+#       define SCLK_FORCE_RB         (1<<28)
+#       define SCLK_FORCE_TV_SCLK    (1<<29)
+#       define SCLK_FORCE_SUBPIC     (1<<30)
+#       define SCLK_FORCE_OV0        (1<<31)
+#       define R300_SCLK_FORCE_VAP   (1<<21)
+#       define R300_SCLK_FORCE_SR    (1<<25)
+#       define R300_SCLK_FORCE_PX    (1<<26)
+#       define R300_SCLK_FORCE_TX    (1<<27)
+#       define R300_SCLK_FORCE_US    (1<<28)
+#       define R300_SCLK_FORCE_SU    (1<<30)
+#define R300_SCLK_CNTL2                     0x1e   /* PLL */
+#       define R300_SCLK_TCL_MAX_DYN_STOP_LAT (1<<10)
+#       define R300_SCLK_GA_MAX_DYN_STOP_LAT  (1<<11)
+#       define R300_SCLK_CBA_MAX_DYN_STOP_LAT (1<<12)
+#       define R300_SCLK_FORCE_TCL          (1<<13)
+#       define R300_SCLK_FORCE_CBA          (1<<14)
+#       define R300_SCLK_FORCE_GA           (1<<15)
+#define SCLK_MORE_CNTL               0x0035 /* PLL */
+#       define SCLK_MORE_MAX_DYN_STOP_LAT 0x0007
+#       define SCLK_MORE_FORCEON     0x0700
+#define SDRAM_MODE_REG               0x0158
+#define SEQ8_DATA                    0x03c5 /* VGA */
+#define SEQ8_IDX                     0x03c4 /* VGA */
+#define SNAPSHOT_F_COUNT             0x0244
+#define SNAPSHOT_VH_COUNTS           0x0240
+#define SNAPSHOT_VIF_COUNT           0x024c
+#define SRC_OFFSET                   0x15ac
+#define SRC_PITCH                    0x15b0
+#define SRC_PITCH_OFFSET             0x1428
+#define SRC_SC_BOTTOM                0x165c
+#define SRC_SC_BOTTOM_RIGHT          0x16f4
+#define SRC_SC_RIGHT                 0x1654
+#define SRC_X                        0x1414
+#define SRC_X_Y                      0x1590
+#define SRC_Y                        0x1418
+#define SRC_Y_X                      0x1434
+#define STATUS                       0x0f06 /* PCI */
+#define SUB_CLASS                    0x0f0a /* PCI */
+#define SURFACE_CNTL                 0x0b00
+#       define SURF_TRANSLATION_DIS  (1 << 8)
+#       define NONSURF_AP0_SWP_16BPP (1 << 20)
+#       define NONSURF_AP0_SWP_32BPP (1 << 21)
+#       define NONSURF_AP1_SWP_16BPP (1 << 22)
+#       define NONSURF_AP1_SWP_32BPP (1 << 23)
+#define SURFACE0_INFO                0x0b0c
+#define SURFACE0_LOWER_BOUND         0x0b04
+#define SURFACE0_UPPER_BOUND         0x0b08
+#define SURFACE1_INFO                0x0b1c
+#define SURFACE1_LOWER_BOUND         0x0b14
+#define SURFACE1_UPPER_BOUND         0x0b18
+#define SURFACE2_INFO                0x0b2c
+#define SURFACE2_LOWER_BOUND         0x0b24
+#define SURFACE2_UPPER_BOUND         0x0b28
+#define SURFACE3_INFO                0x0b3c
+#define SURFACE3_LOWER_BOUND         0x0b34
+#define SURFACE3_UPPER_BOUND         0x0b38
+#define SURFACE4_INFO                0x0b4c
+#define SURFACE4_LOWER_BOUND         0x0b44
+#define SURFACE4_UPPER_BOUND         0x0b48
+#define SURFACE5_INFO                0x0b5c
+#define SURFACE5_LOWER_BOUND         0x0b54
+#define SURFACE5_UPPER_BOUND         0x0b58
+#define SURFACE6_INFO                0x0b6c
+#define SURFACE6_LOWER_BOUND         0x0b64
+#define SURFACE6_UPPER_BOUND         0x0b68
+#define SURFACE7_INFO                0x0b7c
+#define SURFACE7_LOWER_BOUND         0x0b74
+#define SURFACE7_UPPER_BOUND         0x0b78
+#define SW_SEMAPHORE                 0x013c
+
+#define TEST_DEBUG_CNTL              0x0120
+#define TEST_DEBUG_MUX               0x0124
+#define TEST_DEBUG_OUT               0x012c
+#define TMDS_PLL_CNTL                0x02a8
+#define TMDS_TRANSMITTER_CNTL        0x02a4
+#       define TMDS_TRANSMITTER_PLLEN  1
+#       define TMDS_TRANSMITTER_PLLRST 2
+#define TRAIL_BRES_DEC               0x1614
+#define TRAIL_BRES_ERR               0x160c
+#define TRAIL_BRES_INC               0x1610
+#define TRAIL_X                      0x1618
+#define TRAIL_X_SUB                  0x1620
+
+#define VCLK_ECP_CNTL                0x0008 /* PLL */
+#       define VCLK_SRC_SEL_MASK     0x03
+#       define VCLK_SRC_SEL_CPUCLK   0x00
+#       define VCLK_SRC_SEL_PSCANCLK 0x01
+#       define VCLK_SRC_SEL_BYTECLK  0x02
+#       define VCLK_SRC_SEL_PPLLCLK  0x03
+#       define PIXCLK_ALWAYS_ONb     (1<<6)
+#       define PIXCLK_DAC_ALWAYS_ONb (1<<7)
+#       define R300_DISP_DAC_PIXCLK_DAC_BLANK_OFF (1<<23)
+
+#define VGA_DDA_CONFIG               0x02e8
+#define VGA_DDA_ON_OFF               0x02ec
+#define VID_BUFFER_CONTROL           0x0900
+#define VIDEOMUX_CNTL                0x0190
+#define VIPH_CONTROL                 0x0c40 /* ? */
+
+#define WAIT_UNTIL                   0x1720
+#       define WAIT_CRTC_PFLIP        (1 << 0)
+#       define R300_WAIT_2D_IDLE      (1 << 0)
+#       define R300_WAIT_3D_IDLE      (2 << 0)
+#       define R300_WAIT_2D_IDLECLEAN (3 << 0)
+#       define R300_WAIT_3D_IDLECLEAN (4 << 0)
+#       define WAIT_2D_IDLE           (1 << 14)
+#       define WAIT_3D_IDLE           (1 << 15)
+#       define WAIT_2D_IDLECLEAN      (1 << 16)
+#       define WAIT_3D_IDLECLEAN      (1 << 17)
+#       define WAIT_HOST_IDLECLEAN    (1 << 18)
+
+#define ISYNC_CNTL                   0x1724
+#	define ISYNC_ANY2D_IDLE3D        (1 << 0)
+#	define ISYNC_ANY3D_IDLE2D        (1 << 1)
+#	define ISYNC_TRIG2D_IDLE3D       (1 << 2)
+#	define ISYNC_TRIG3D_IDLE2D       (1 << 3)
+#	define ISYNC_WAIT_IDLEGUI	   (1 << 4)
+#	define ISYNC_CPSCRATCH_IDLEGUI   (1 << 5)
+
+#define X_MPLL_REF_FB_DIV            0x000a /* PLL */
+#define XCLK_CNTL                    0x000d /* PLL */
+#define XDLL_CNTL                    0x000c /* PLL */
+#define XPLL_CNTL                    0x000b /* PLL */
+
+
+
+				/* Registers for 3D/TCL */
+#define PP_BORDER_COLOR_0            0x1d40
+#define PP_BORDER_COLOR_1            0x1d44
+#define PP_BORDER_COLOR_2            0x1d48
+#define PP_CNTL                      0x1c38
+#       define STIPPLE_ENABLE        (1 <<  0)
+#       define SCISSOR_ENABLE        (1 <<  1)
+#       define PATTERN_ENABLE        (1 <<  2)
+#       define SHADOW_ENABLE         (1 <<  3)
+#       define TEX_ENABLE_MASK       (0xf << 4)
+#       define TEX_0_ENABLE          (1 <<  4)
+#       define TEX_1_ENABLE          (1 <<  5)
+#       define TEX_2_ENABLE          (1 <<  6)
+#       define TEX_3_ENABLE          (1 <<  7)
+#       define TEX_BLEND_ENABLE_MASK (0xf << 12)
+#       define TEX_BLEND_0_ENABLE    (1 << 12)
+#       define TEX_BLEND_1_ENABLE    (1 << 13)
+#       define TEX_BLEND_2_ENABLE    (1 << 14)
+#       define TEX_BLEND_3_ENABLE    (1 << 15)
+#       define PLANAR_YUV_ENABLE     (1 << 20)
+#       define SPECULAR_ENABLE       (1 << 21)
+#       define FOG_ENABLE            (1 << 22)
+#       define ALPHA_TEST_ENABLE     (1 << 23)
+#       define ANTI_ALIAS_NONE       (0 << 24)
+#       define ANTI_ALIAS_LINE       (1 << 24)
+#       define ANTI_ALIAS_POLY       (2 << 24)
+#       define ANTI_ALIAS_LINE_POLY  (3 << 24)
+#       define BUMP_MAP_ENABLE       (1 << 26)
+#       define BUMPED_MAP_T0         (0 << 27)
+#       define BUMPED_MAP_T1         (1 << 27)
+#       define BUMPED_MAP_T2         (2 << 27)
+#       define TEX_3D_ENABLE_0       (1 << 29)
+#       define TEX_3D_ENABLE_1       (1 << 30)
+#       define MC_ENABLE             (1 << 31)
+#define PP_FOG_COLOR                 0x1c18
+#       define FOG_COLOR_MASK        0x00ffffff
+#       define FOG_VERTEX            (0 << 24)
+#       define FOG_TABLE             (1 << 24)
+#       define FOG_USE_DEPTH         (0 << 25)
+#       define FOG_USE_DIFFUSE_ALPHA (2 << 25)
+#       define FOG_USE_SPEC_ALPHA    (3 << 25)
+#define PP_LUM_MATRIX                0x1d00
+#define PP_MISC                      0x1c14
+#       define REF_ALPHA_MASK        0x000000ff
+#       define ALPHA_TEST_FAIL       (0 << 8)
+#       define ALPHA_TEST_LESS       (1 << 8)
+#       define ALPHA_TEST_LEQUAL     (2 << 8)
+#       define ALPHA_TEST_EQUAL      (3 << 8)
+#       define ALPHA_TEST_GEQUAL     (4 << 8)
+#       define ALPHA_TEST_GREATER    (5 << 8)
+#       define ALPHA_TEST_NEQUAL     (6 << 8)
+#       define ALPHA_TEST_PASS       (7 << 8)
+#       define ALPHA_TEST_OP_MASK    (7 << 8)
+#       define CHROMA_FUNC_FAIL      (0 << 16)
+#       define CHROMA_FUNC_PASS      (1 << 16)
+#       define CHROMA_FUNC_NEQUAL    (2 << 16)
+#       define CHROMA_FUNC_EQUAL     (3 << 16)
+#       define CHROMA_KEY_NEAREST    (0 << 18)
+#       define CHROMA_KEY_ZERO       (1 << 18)
+#       define SHADOW_ID_AUTO_INC    (1 << 20)
+#       define SHADOW_FUNC_EQUAL     (0 << 21)
+#       define SHADOW_FUNC_NEQUAL    (1 << 21)
+#       define SHADOW_PASS_1         (0 << 22)
+#       define SHADOW_PASS_2         (1 << 22)
+#       define RIGHT_HAND_CUBE_D3D   (0 << 24)
+#       define RIGHT_HAND_CUBE_OGL   (1 << 24)
+#define PP_ROT_MATRIX_0              0x1d58
+#define PP_ROT_MATRIX_1              0x1d5c
+#define PP_TXFILTER_0                0x1c54
+#define PP_TXFILTER_1                0x1c6c
+#define PP_TXFILTER_2                0x1c84
+#       define MAG_FILTER_NEAREST                   (0  <<  0)
+#       define MAG_FILTER_LINEAR                    (1  <<  0)
+#       define MAG_FILTER_MASK                      (1  <<  0)
+#       define MIN_FILTER_NEAREST                   (0  <<  1)
+#       define MIN_FILTER_LINEAR                    (1  <<  1)
+#       define MIN_FILTER_NEAREST_MIP_NEAREST       (2  <<  1)
+#       define MIN_FILTER_NEAREST_MIP_LINEAR        (3  <<  1)
+#       define MIN_FILTER_LINEAR_MIP_NEAREST        (6  <<  1)
+#       define MIN_FILTER_LINEAR_MIP_LINEAR         (7  <<  1)
+#       define MIN_FILTER_ANISO_NEAREST             (8  <<  1)
+#       define MIN_FILTER_ANISO_LINEAR              (9  <<  1)
+#       define MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 <<  1)
+#       define MIN_FILTER_ANISO_NEAREST_MIP_LINEAR  (11 <<  1)
+#       define MIN_FILTER_MASK                      (15 <<  1)
+#       define MAX_ANISO_1_TO_1                     (0  <<  5)
+#       define MAX_ANISO_2_TO_1                     (1  <<  5)
+#       define MAX_ANISO_4_TO_1                     (2  <<  5)
+#       define MAX_ANISO_8_TO_1                     (3  <<  5)
+#       define MAX_ANISO_16_TO_1                    (4  <<  5)
+#       define MAX_ANISO_MASK                       (7  <<  5)
+#       define LOD_BIAS_MASK                        (0xff <<  8)
+#       define LOD_BIAS_SHIFT                       8
+#       define MAX_MIP_LEVEL_MASK                   (0x0f << 16)
+#       define MAX_MIP_LEVEL_SHIFT                  16
+#       define YUV_TO_RGB                           (1  << 20)
+#       define YUV_TEMPERATURE_COOL                 (0  << 21)
+#       define YUV_TEMPERATURE_HOT                  (1  << 21)
+#       define YUV_TEMPERATURE_MASK                 (1  << 21)
+#       define WRAPEN_S                             (1  << 22)
+#       define CLAMP_S_WRAP                         (0  << 23)
+#       define CLAMP_S_MIRROR                       (1  << 23)
+#       define CLAMP_S_CLAMP_LAST                   (2  << 23)
+#       define CLAMP_S_MIRROR_CLAMP_LAST            (3  << 23)
+#       define CLAMP_S_CLAMP_BORDER                 (4  << 23)
+#       define CLAMP_S_MIRROR_CLAMP_BORDER          (5  << 23)
+#       define CLAMP_S_CLAMP_GL                     (6  << 23)
+#       define CLAMP_S_MIRROR_CLAMP_GL              (7  << 23)
+#       define CLAMP_S_MASK                         (7  << 23)
+#       define WRAPEN_T                             (1  << 26)
+#       define CLAMP_T_WRAP                         (0  << 27)
+#       define CLAMP_T_MIRROR                       (1  << 27)
+#       define CLAMP_T_CLAMP_LAST                   (2  << 27)
+#       define CLAMP_T_MIRROR_CLAMP_LAST            (3  << 27)
+#       define CLAMP_T_CLAMP_BORDER                 (4  << 27)
+#       define CLAMP_T_MIRROR_CLAMP_BORDER          (5  << 27)
+#       define CLAMP_T_CLAMP_GL                     (6  << 27)
+#       define CLAMP_T_MIRROR_CLAMP_GL              (7  << 27)
+#       define CLAMP_T_MASK                         (7  << 27)
+#       define BORDER_MODE_OGL                      (0  << 31)
+#       define BORDER_MODE_D3D                      (1  << 31)
+#define PP_TXFORMAT_0                0x1c58
+#define PP_TXFORMAT_1                0x1c70
+#define PP_TXFORMAT_2                0x1c88
+#       define TXFORMAT_I8                 (0  <<  0)
+#       define TXFORMAT_AI88               (1  <<  0)
+#       define TXFORMAT_RGB332             (2  <<  0)
+#       define TXFORMAT_ARGB1555           (3  <<  0)
+#       define TXFORMAT_RGB565             (4  <<  0)
+#       define TXFORMAT_ARGB4444           (5  <<  0)
+#       define TXFORMAT_ARGB8888           (6  <<  0)
+#       define TXFORMAT_RGBA8888           (7  <<  0)
+#       define TXFORMAT_Y8                 (8  <<  0)
+#       define TXFORMAT_VYUY422            (10 <<  0)
+#       define TXFORMAT_YVYU422            (11 <<  0)
+#       define TXFORMAT_DXT1               (12 <<  0)
+#       define TXFORMAT_DXT23              (14 <<  0)
+#       define TXFORMAT_DXT45              (15 <<  0)
+#       define TXFORMAT_FORMAT_MASK        (31 <<  0)
+#       define TXFORMAT_FORMAT_SHIFT       0
+#       define TXFORMAT_APPLE_YUV_MODE     (1  <<  5)
+#       define TXFORMAT_ALPHA_IN_MAP       (1  <<  6)
+#       define TXFORMAT_NON_POWER2         (1  <<  7)
+#       define TXFORMAT_WIDTH_MASK         (15 <<  8)
+#       define TXFORMAT_WIDTH_SHIFT        8
+#       define TXFORMAT_HEIGHT_MASK        (15 << 12)
+#       define TXFORMAT_HEIGHT_SHIFT       12
+#       define TXFORMAT_F5_WIDTH_MASK      (15 << 16)
+#       define TXFORMAT_F5_WIDTH_SHIFT     16
+#       define TXFORMAT_F5_HEIGHT_MASK     (15 << 20)
+#       define TXFORMAT_F5_HEIGHT_SHIFT    20
+#       define TXFORMAT_ST_ROUTE_STQ0      (0  << 24)
+#       define TXFORMAT_ST_ROUTE_MASK      (3  << 24)
+#       define TXFORMAT_ST_ROUTE_STQ1      (1  << 24)
+#       define TXFORMAT_ST_ROUTE_STQ2      (2  << 24)
+#       define TXFORMAT_ENDIAN_NO_SWAP     (0  << 26)
+#       define TXFORMAT_ENDIAN_16BPP_SWAP  (1  << 26)
+#       define TXFORMAT_ENDIAN_32BPP_SWAP  (2  << 26)
+#       define TXFORMAT_ENDIAN_HALFDW_SWAP (3  << 26)
+#       define TXFORMAT_ALPHA_MASK_ENABLE  (1  << 28)
+#       define TXFORMAT_CHROMA_KEY_ENABLE  (1  << 29)
+#       define TXFORMAT_CUBIC_MAP_ENABLE   (1  << 30)
+#       define TXFORMAT_PERSPECTIVE_ENABLE (1  << 31)
+#define PP_CUBIC_FACES_0             0x1d24
+#define PP_CUBIC_FACES_1             0x1d28
+#define PP_CUBIC_FACES_2             0x1d2c
+#       define FACE_WIDTH_1_SHIFT          0
+#       define FACE_HEIGHT_1_SHIFT         4
+#       define FACE_WIDTH_1_MASK           (0xf << 0)
+#       define FACE_HEIGHT_1_MASK          (0xf << 4)
+#       define FACE_WIDTH_2_SHIFT          8
+#       define FACE_HEIGHT_2_SHIFT         12
+#       define FACE_WIDTH_2_MASK           (0xf << 8)
+#       define FACE_HEIGHT_2_MASK          (0xf << 12)
+#       define FACE_WIDTH_3_SHIFT          16
+#       define FACE_HEIGHT_3_SHIFT         20
+#       define FACE_WIDTH_3_MASK           (0xf << 16)
+#       define FACE_HEIGHT_3_MASK          (0xf << 20)
+#       define FACE_WIDTH_4_SHIFT          24
+#       define FACE_HEIGHT_4_SHIFT         28
+#       define FACE_WIDTH_4_MASK           (0xf << 24)
+#       define FACE_HEIGHT_4_MASK          (0xf << 28)
+
+#define PP_TXOFFSET_0                0x1c5c
+#define PP_TXOFFSET_1                0x1c74
+#define PP_TXOFFSET_2                0x1c8c
+#       define TXO_ENDIAN_NO_SWAP     (0 << 0)
+#       define TXO_ENDIAN_BYTE_SWAP   (1 << 0)
+#       define TXO_ENDIAN_WORD_SWAP   (2 << 0)
+#       define TXO_ENDIAN_HALFDW_SWAP (3 << 0)
+#       define TXO_MACRO_LINEAR       (0 << 2)
+#       define TXO_MACRO_TILE         (1 << 2)
+#       define TXO_MICRO_LINEAR       (0 << 3)
+#       define TXO_MICRO_TILE_X2      (1 << 3)
+#       define TXO_MICRO_TILE_OPT     (2 << 3)
+#       define TXO_OFFSET_MASK        0xffffffe0
+#       define TXO_OFFSET_SHIFT       5
+
+#define PP_CUBIC_OFFSET_T0_0         0x1dd0  /* bits [31:5] */
+#define PP_CUBIC_OFFSET_T0_1         0x1dd4
+#define PP_CUBIC_OFFSET_T0_2         0x1dd8
+#define PP_CUBIC_OFFSET_T0_3         0x1ddc
+#define PP_CUBIC_OFFSET_T0_4         0x1de0
+#define PP_CUBIC_OFFSET_T1_0         0x1e00
+#define PP_CUBIC_OFFSET_T1_1         0x1e04
+#define PP_CUBIC_OFFSET_T1_2         0x1e08
+#define PP_CUBIC_OFFSET_T1_3         0x1e0c
+#define PP_CUBIC_OFFSET_T1_4         0x1e10
+#define PP_CUBIC_OFFSET_T2_0         0x1e14
+#define PP_CUBIC_OFFSET_T2_1         0x1e18
+#define PP_CUBIC_OFFSET_T2_2         0x1e1c
+#define PP_CUBIC_OFFSET_T2_3         0x1e20
+#define PP_CUBIC_OFFSET_T2_4         0x1e24
+
+#define PP_TEX_SIZE_0                0x1d04  /* NPOT */
+#define PP_TEX_SIZE_1                0x1d0c
+#define PP_TEX_SIZE_2                0x1d14
+#       define TEX_USIZE_MASK        (0x7ff << 0)
+#       define TEX_USIZE_SHIFT       0
+#       define TEX_VSIZE_MASK        (0x7ff << 16)
+#       define TEX_VSIZE_SHIFT       16
+#       define SIGNED_RGB_MASK       (1 << 30)
+#       define SIGNED_RGB_SHIFT      30
+#       define SIGNED_ALPHA_MASK     (1 << 31)
+#       define SIGNED_ALPHA_SHIFT    31
+#define PP_TEX_PITCH_0               0x1d08  /* NPOT */
+#define PP_TEX_PITCH_1               0x1d10  /* NPOT */
+#define PP_TEX_PITCH_2               0x1d18  /* NPOT */
+/* note: bits 13-5: 32 byte aligned stride of texture map */
+
+#define PP_TXCBLEND_0                0x1c60
+#define PP_TXCBLEND_1                0x1c78
+#define PP_TXCBLEND_2                0x1c90
+#       define COLOR_ARG_A_SHIFT          0
+#       define COLOR_ARG_A_MASK           (0x1f << 0)
+#       define COLOR_ARG_A_ZERO           (0    << 0)
+#       define COLOR_ARG_A_CURRENT_COLOR  (2    << 0)
+#       define COLOR_ARG_A_CURRENT_ALPHA  (3    << 0)
+#       define COLOR_ARG_A_DIFFUSE_COLOR  (4    << 0)
+#       define COLOR_ARG_A_DIFFUSE_ALPHA  (5    << 0)
+#       define COLOR_ARG_A_SPECULAR_COLOR (6    << 0)
+#       define COLOR_ARG_A_SPECULAR_ALPHA (7    << 0)
+#       define COLOR_ARG_A_TFACTOR_COLOR  (8    << 0)
+#       define COLOR_ARG_A_TFACTOR_ALPHA  (9    << 0)
+#       define COLOR_ARG_A_T0_COLOR       (10   << 0)
+#       define COLOR_ARG_A_T0_ALPHA       (11   << 0)
+#       define COLOR_ARG_A_T1_COLOR       (12   << 0)
+#       define COLOR_ARG_A_T1_ALPHA       (13   << 0)
+#       define COLOR_ARG_A_T2_COLOR       (14   << 0)
+#       define COLOR_ARG_A_T2_ALPHA       (15   << 0)
+#       define COLOR_ARG_A_T3_COLOR       (16   << 0)
+#       define COLOR_ARG_A_T3_ALPHA       (17   << 0)
+#       define COLOR_ARG_B_SHIFT          5
+#       define COLOR_ARG_B_MASK           (0x1f << 5)
+#       define COLOR_ARG_B_ZERO           (0    << 5)
+#       define COLOR_ARG_B_CURRENT_COLOR  (2    << 5)
+#       define COLOR_ARG_B_CURRENT_ALPHA  (3    << 5)
+#       define COLOR_ARG_B_DIFFUSE_COLOR  (4    << 5)
+#       define COLOR_ARG_B_DIFFUSE_ALPHA  (5    << 5)
+#       define COLOR_ARG_B_SPECULAR_COLOR (6    << 5)
+#       define COLOR_ARG_B_SPECULAR_ALPHA (7    << 5)
+#       define COLOR_ARG_B_TFACTOR_COLOR  (8    << 5)
+#       define COLOR_ARG_B_TFACTOR_ALPHA  (9    << 5)
+#       define COLOR_ARG_B_T0_COLOR       (10   << 5)
+#       define COLOR_ARG_B_T0_ALPHA       (11   << 5)
+#       define COLOR_ARG_B_T1_COLOR       (12   << 5)
+#       define COLOR_ARG_B_T1_ALPHA       (13   << 5)
+#       define COLOR_ARG_B_T2_COLOR       (14   << 5)
+#       define COLOR_ARG_B_T2_ALPHA       (15   << 5)
+#       define COLOR_ARG_B_T3_COLOR       (16   << 5)
+#       define COLOR_ARG_B_T3_ALPHA       (17   << 5)
+#       define COLOR_ARG_C_SHIFT          10
+#       define COLOR_ARG_C_MASK           (0x1f << 10)
+#       define COLOR_ARG_C_ZERO           (0    << 10)
+#       define COLOR_ARG_C_CURRENT_COLOR  (2    << 10)
+#       define COLOR_ARG_C_CURRENT_ALPHA  (3    << 10)
+#       define COLOR_ARG_C_DIFFUSE_COLOR  (4    << 10)
+#       define COLOR_ARG_C_DIFFUSE_ALPHA  (5    << 10)
+#       define COLOR_ARG_C_SPECULAR_COLOR (6    << 10)
+#       define COLOR_ARG_C_SPECULAR_ALPHA (7    << 10)
+#       define COLOR_ARG_C_TFACTOR_COLOR  (8    << 10)
+#       define COLOR_ARG_C_TFACTOR_ALPHA  (9    << 10)
+#       define COLOR_ARG_C_T0_COLOR       (10   << 10)
+#       define COLOR_ARG_C_T0_ALPHA       (11   << 10)
+#       define COLOR_ARG_C_T1_COLOR       (12   << 10)
+#       define COLOR_ARG_C_T1_ALPHA       (13   << 10)
+#       define COLOR_ARG_C_T2_COLOR       (14   << 10)
+#       define COLOR_ARG_C_T2_ALPHA       (15   << 10)
+#       define COLOR_ARG_C_T3_COLOR       (16   << 10)
+#       define COLOR_ARG_C_T3_ALPHA       (17   << 10)
+#       define COMP_ARG_A                 (1 << 15)
+#       define COMP_ARG_A_SHIFT           15
+#       define COMP_ARG_B                 (1 << 16)
+#       define COMP_ARG_B_SHIFT           16
+#       define COMP_ARG_C                 (1 << 17)
+#       define COMP_ARG_C_SHIFT           17
+#       define BLEND_CTL_MASK             (7 << 18)
+#       define BLEND_CTL_ADD              (0 << 18)
+#       define BLEND_CTL_SUBTRACT         (1 << 18)
+#       define BLEND_CTL_ADDSIGNED        (2 << 18)
+#       define BLEND_CTL_BLEND            (3 << 18)
+#       define BLEND_CTL_DOT3             (4 << 18)
+#       define SCALE_SHIFT                21
+#       define SCALE_MASK                 (3 << 21)
+#       define SCALE_1X                   (0 << 21)
+#       define SCALE_2X                   (1 << 21)
+#       define SCALE_4X                   (2 << 21)
+#       define CLAMP_TX                   (1 << 23)
+#       define T0_EQ_TCUR                 (1 << 24)
+#       define T1_EQ_TCUR                 (1 << 25)
+#       define T2_EQ_TCUR                 (1 << 26)
+#       define T3_EQ_TCUR                 (1 << 27)
+#       define COLOR_ARG_MASK             0x1f
+#       define COMP_ARG_SHIFT             15
+#define PP_TXABLEND_0                0x1c64
+#define PP_TXABLEND_1                0x1c7c
+#define PP_TXABLEND_2                0x1c94
+#       define ALPHA_ARG_A_SHIFT          0
+#       define ALPHA_ARG_A_MASK           (0xf << 0)
+#       define ALPHA_ARG_A_ZERO           (0   << 0)
+#       define ALPHA_ARG_A_CURRENT_ALPHA  (1   << 0)
+#       define ALPHA_ARG_A_DIFFUSE_ALPHA  (2   << 0)
+#       define ALPHA_ARG_A_SPECULAR_ALPHA (3   << 0)
+#       define ALPHA_ARG_A_TFACTOR_ALPHA  (4   << 0)
+#       define ALPHA_ARG_A_T0_ALPHA       (5   << 0)
+#       define ALPHA_ARG_A_T1_ALPHA       (6   << 0)
+#       define ALPHA_ARG_A_T2_ALPHA       (7   << 0)
+#       define ALPHA_ARG_A_T3_ALPHA       (8   << 0)
+#       define ALPHA_ARG_B_SHIFT          4
+#       define ALPHA_ARG_B_MASK           (0xf << 4)
+#       define ALPHA_ARG_B_ZERO           (0   << 4)
+#       define ALPHA_ARG_B_CURRENT_ALPHA  (1   << 4)
+#       define ALPHA_ARG_B_DIFFUSE_ALPHA  (2   << 4)
+#       define ALPHA_ARG_B_SPECULAR_ALPHA (3   << 4)
+#       define ALPHA_ARG_B_TFACTOR_ALPHA  (4   << 4)
+#       define ALPHA_ARG_B_T0_ALPHA       (5   << 4)
+#       define ALPHA_ARG_B_T1_ALPHA       (6   << 4)
+#       define ALPHA_ARG_B_T2_ALPHA       (7   << 4)
+#       define ALPHA_ARG_B_T3_ALPHA       (8   << 4)
+#       define ALPHA_ARG_C_SHIFT          8
+#       define ALPHA_ARG_C_MASK           (0xf << 8)
+#       define ALPHA_ARG_C_ZERO           (0   << 8)
+#       define ALPHA_ARG_C_CURRENT_ALPHA  (1   << 8)
+#       define ALPHA_ARG_C_DIFFUSE_ALPHA  (2   << 8)
+#       define ALPHA_ARG_C_SPECULAR_ALPHA (3   << 8)
+#       define ALPHA_ARG_C_TFACTOR_ALPHA  (4   << 8)
+#       define ALPHA_ARG_C_T0_ALPHA       (5   << 8)
+#       define ALPHA_ARG_C_T1_ALPHA       (6   << 8)
+#       define ALPHA_ARG_C_T2_ALPHA       (7   << 8)
+#       define ALPHA_ARG_C_T3_ALPHA       (8   << 8)
+#       define DOT_ALPHA_DONT_REPLICATE   (1   << 9)
+#       define ALPHA_ARG_MASK             0xf
+
+#define PP_TFACTOR_0                 0x1c68
+#define PP_TFACTOR_1                 0x1c80
+#define PP_TFACTOR_2                 0x1c98
+
+#define RB3D_BLENDCNTL               0x1c20
+#       define COMB_FCN_MASK                    (3  << 12)
+#       define COMB_FCN_ADD_CLAMP               (0  << 12)
+#       define COMB_FCN_ADD_NOCLAMP             (1  << 12)
+#       define COMB_FCN_SUB_CLAMP               (2  << 12)
+#       define COMB_FCN_SUB_NOCLAMP             (3  << 12)
+#       define SRC_BLEND_GL_ZERO                (32 << 16)
+#       define SRC_BLEND_GL_ONE                 (33 << 16)
+#       define SRC_BLEND_GL_SRC_COLOR           (34 << 16)
+#       define SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
+#       define SRC_BLEND_GL_DST_COLOR           (36 << 16)
+#       define SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
+#       define SRC_BLEND_GL_SRC_ALPHA           (38 << 16)
+#       define SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
+#       define SRC_BLEND_GL_DST_ALPHA           (40 << 16)
+#       define SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
+#       define SRC_BLEND_GL_SRC_ALPHA_SATURATE  (42 << 16)
+#       define SRC_BLEND_MASK                   (63 << 16)
+#       define DST_BLEND_GL_ZERO                (32 << 24)
+#       define DST_BLEND_GL_ONE                 (33 << 24)
+#       define DST_BLEND_GL_SRC_COLOR           (34 << 24)
+#       define DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
+#       define DST_BLEND_GL_DST_COLOR           (36 << 24)
+#       define DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
+#       define DST_BLEND_GL_SRC_ALPHA           (38 << 24)
+#       define DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
+#       define DST_BLEND_GL_DST_ALPHA           (40 << 24)
+#       define DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
+#       define DST_BLEND_MASK                   (63 << 24)
+#define RB3D_CNTL                    0x1c3c
+#       define ALPHA_BLEND_ENABLE       (1  <<  0)
+#       define PLANE_MASK_ENABLE        (1  <<  1)
+#       define DITHER_ENABLE            (1  <<  2)
+#       define ROUND_ENABLE             (1  <<  3)
+#       define SCALE_DITHER_ENABLE      (1  <<  4)
+#       define DITHER_INIT              (1  <<  5)
+#       define ROP_ENABLE               (1  <<  6)
+#       define STENCIL_ENABLE           (1  <<  7)
+#       define Z_ENABLE                 (1  <<  8)
+#       define DEPTH_XZ_OFFEST_ENABLE   (1  <<  9)
+#       define COLOR_FORMAT_ARGB1555    (3  << 10)
+#       define COLOR_FORMAT_RGB565      (4  << 10)
+#       define COLOR_FORMAT_ARGB8888    (6  << 10)
+#       define COLOR_FORMAT_RGB332      (7  << 10)
+#       define COLOR_FORMAT_Y8          (8  << 10)
+#       define COLOR_FORMAT_RGB8        (9  << 10)
+#       define COLOR_FORMAT_YUV422_VYUY (11 << 10)
+#       define COLOR_FORMAT_YUV422_YVYU (12 << 10)
+#       define COLOR_FORMAT_AVYU        (14 << 10)
+#       define COLOR_FORMAT_ARGB4444    (15 << 10)
+#       define CLRCMP_FLIP_ENABLE       (1  << 14)
+#       define SEPARATE_ALPHA_ENABLE    (1  << 16)
+#define RB3D_COLOROFFSET             0x1c40
+#       define COLOROFFSET_MASK      0xfffffff0
+#define RB3D_COLORPITCH              0x1c48
+#       define COLORPITCH_MASK         0x000001ff8
+#       define COLOR_TILE_ENABLE       (1 << 16)
+#       define COLOR_MICROTILE_ENABLE  (1 << 17)
+#       define COLOR_ENDIAN_NO_SWAP    (0 << 18)
+#       define COLOR_ENDIAN_WORD_SWAP  (1 << 18)
+#       define COLOR_ENDIAN_DWORD_SWAP (2 << 18)
+#define RB3D_DEPTHOFFSET             0x1c24
+#define RB3D_DEPTHPITCH              0x1c28
+#       define DEPTHPITCH_MASK         0x00001ff8
+#       define DEPTH_ENDIAN_NO_SWAP    (0 << 18)
+#       define DEPTH_ENDIAN_WORD_SWAP  (1 << 18)
+#       define DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
+#define RB3D_PLANEMASK               0x1d84
+#define RB3D_ROPCNTL                 0x1d80
+#       define ROP_MASK              (15 << 8)
+#       define ROP_CLEAR             (0  << 8)
+#       define ROP_NOR               (1  << 8)
+#       define ROP_AND_INVERTED      (2  << 8)
+#       define ROP_COPY_INVERTED     (3  << 8)
+#       define ROP_AND_REVERSE       (4  << 8)
+#       define ROP_INVERT            (5  << 8)
+#       define ROP_XOR               (6  << 8)
+#       define ROP_NAND              (7  << 8)
+#       define ROP_AND               (8  << 8)
+#       define ROP_EQUIV             (9  << 8)
+#       define ROP_NOOP              (10 << 8)
+#       define ROP_OR_INVERTED       (11 << 8)
+#       define ROP_COPY              (12 << 8)
+#       define ROP_OR_REVERSE        (13 << 8)
+#       define ROP_OR                (14 << 8)
+#       define ROP_SET               (15 << 8)
+#define RB3D_STENCILREFMASK          0x1d7c
+#       define STENCIL_REF_SHIFT       0
+#       define STENCIL_REF_MASK        (0xff << 0)
+#       define STENCIL_MASK_SHIFT      16
+#       define STENCIL_VALUE_MASK      (0xff << 16)
+#       define STENCIL_WRITEMASK_SHIFT 24
+#       define STENCIL_WRITE_MASK      (0xff << 24)
+#define RB3D_ZSTENCILCNTL            0x1c2c
+#       define DEPTH_FORMAT_MASK          (0xf << 0)
+#       define DEPTH_FORMAT_16BIT_INT_Z   (0  <<  0)
+#       define DEPTH_FORMAT_24BIT_INT_Z   (2  <<  0)
+#       define DEPTH_FORMAT_24BIT_FLOAT_Z (3  <<  0)
+#       define DEPTH_FORMAT_32BIT_INT_Z   (4  <<  0)
+#       define DEPTH_FORMAT_32BIT_FLOAT_Z (5  <<  0)
+#       define DEPTH_FORMAT_16BIT_FLOAT_W (7  <<  0)
+#       define DEPTH_FORMAT_24BIT_FLOAT_W (9  <<  0)
+#       define DEPTH_FORMAT_32BIT_FLOAT_W (11 <<  0)
+#       define Z_TEST_NEVER               (0  <<  4)
+#       define Z_TEST_LESS                (1  <<  4)
+#       define Z_TEST_LEQUAL              (2  <<  4)
+#       define Z_TEST_EQUAL               (3  <<  4)
+#       define Z_TEST_GEQUAL              (4  <<  4)
+#       define Z_TEST_GREATER             (5  <<  4)
+#       define Z_TEST_NEQUAL              (6  <<  4)
+#       define Z_TEST_ALWAYS              (7  <<  4)
+#       define Z_TEST_MASK                (7  <<  4)
+#       define STENCIL_TEST_NEVER         (0  << 12)
+#       define STENCIL_TEST_LESS          (1  << 12)
+#       define STENCIL_TEST_LEQUAL        (2  << 12)
+#       define STENCIL_TEST_EQUAL         (3  << 12)
+#       define STENCIL_TEST_GEQUAL        (4  << 12)
+#       define STENCIL_TEST_GREATER       (5  << 12)
+#       define STENCIL_TEST_NEQUAL        (6  << 12)
+#       define STENCIL_TEST_ALWAYS        (7  << 12)
+#       define STENCIL_TEST_MASK          (0x7 << 12)
+#       define STENCIL_FAIL_KEEP          (0  << 16)
+#       define STENCIL_FAIL_ZERO          (1  << 16)
+#       define STENCIL_FAIL_REPLACE       (2  << 16)
+#       define STENCIL_FAIL_INC           (3  << 16)
+#       define STENCIL_FAIL_DEC           (4  << 16)
+#       define STENCIL_FAIL_INVERT        (5  << 16)
+#       define STENCIL_FAIL_MASK          (0x7 << 16)
+#       define STENCIL_ZPASS_KEEP         (0  << 20)
+#       define STENCIL_ZPASS_ZERO         (1  << 20)
+#       define STENCIL_ZPASS_REPLACE      (2  << 20)
+#       define STENCIL_ZPASS_INC          (3  << 20)
+#       define STENCIL_ZPASS_DEC          (4  << 20)
+#       define STENCIL_ZPASS_INVERT       (5  << 20)
+#       define STENCIL_ZPASS_MASK         (0x7 << 20)
+#       define STENCIL_ZFAIL_KEEP         (0  << 24)
+#       define STENCIL_ZFAIL_ZERO         (1  << 24)
+#       define STENCIL_ZFAIL_REPLACE      (2  << 24)
+#       define STENCIL_ZFAIL_INC          (3  << 24)
+#       define STENCIL_ZFAIL_DEC          (4  << 24)
+#       define STENCIL_ZFAIL_INVERT       (5  << 24)
+#       define STENCIL_ZFAIL_MASK         (0x7 << 24)
+#       define Z_COMPRESSION_ENABLE       (1  << 28)
+#       define FORCE_Z_DIRTY              (1  << 29)
+#       define Z_WRITE_ENABLE             (1  << 30)
+#define RE_LINE_PATTERN              0x1cd0
+#       define LINE_PATTERN_MASK             0x0000ffff
+#       define LINE_REPEAT_COUNT_SHIFT       16
+#       define LINE_PATTERN_START_SHIFT      24
+#       define LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
+#       define LINE_PATTERN_BIG_BIT_ORDER    (1 << 28)
+#       define LINE_PATTERN_AUTO_RESET       (1 << 29)
+#define RE_LINE_STATE                0x1cd4
+#       define LINE_CURRENT_PTR_SHIFT   0
+#       define LINE_CURRENT_COUNT_SHIFT 8
+#define RE_MISC                      0x26c4
+#       define STIPPLE_COORD_MASK       0x1f
+#       define STIPPLE_X_OFFSET_SHIFT   0
+#       define STIPPLE_X_OFFSET_MASK    (0x1f << 0)
+#       define STIPPLE_Y_OFFSET_SHIFT   8
+#       define STIPPLE_Y_OFFSET_MASK    (0x1f << 8)
+#       define STIPPLE_LITTLE_BIT_ORDER (0 << 16)
+#       define STIPPLE_BIG_BIT_ORDER    (1 << 16)
+#define RE_SOLID_COLOR               0x1c1c
+#define RE_POINTSIZE                 0x2648
+#       define RE_POINTSIZE_SHIFT    0
+#       define RE_MAXPOINTSIZE_SHIFT 16
+#define RE_TOP_LEFT                  0x26c0
+#       define RE_LEFT_SHIFT         0
+#       define RE_TOP_SHIFT          16
+#define RE_BOTTOM_RIGHT              0x1c44
+#       define RE_RIGHT_SHIFT        0
+#       define RE_BOTTOM_SHIFT       16
+
+#define SE_CNTL                      0x1c4c
+#       define FFACE_CULL_CW          (0 <<  0)
+#       define FFACE_CULL_CCW         (1 <<  0)
+#       define FFACE_CULL_DIR_MASK    (1 <<  0)
+#       define BFACE_CULL             (0 <<  1)
+#       define BFACE_SOLID            (3 <<  1)
+#       define FFACE_CULL             (0 <<  3)
+#       define FFACE_SOLID            (3 <<  3)
+#       define FFACE_CULL_MASK        (3 <<  3)
+#       define BADVTX_CULL_DISABLE    (1 <<  5)
+#       define FLAT_SHADE_VTX_0       (0 <<  6)
+#       define FLAT_SHADE_VTX_1       (1 <<  6)
+#       define FLAT_SHADE_VTX_2       (2 <<  6)
+#       define FLAT_SHADE_VTX_LAST    (3 <<  6)
+#       define DIFFUSE_SHADE_SOLID    (0 <<  8)
+#       define DIFFUSE_SHADE_FLAT     (1 <<  8)
+#       define DIFFUSE_SHADE_GOURAUD  (2 <<  8)
+#       define DIFFUSE_SHADE_MASK     (3 <<  8)
+#       define ALPHA_SHADE_SOLID      (0 << 10)
+#       define ALPHA_SHADE_FLAT       (1 << 10)
+#       define ALPHA_SHADE_GOURAUD    (2 << 10)
+#       define ALPHA_SHADE_MASK       (3 << 10)
+#       define SPECULAR_SHADE_SOLID   (0 << 12)
+#       define SPECULAR_SHADE_FLAT    (1 << 12)
+#       define SPECULAR_SHADE_GOURAUD (2 << 12)
+#       define SPECULAR_SHADE_MASK    (3 << 12)
+#       define FOG_SHADE_SOLID        (0 << 14)
+#       define FOG_SHADE_FLAT         (1 << 14)
+#       define FOG_SHADE_GOURAUD      (2 << 14)
+#       define FOG_SHADE_MASK         (3 << 14)
+#       define ZBIAS_ENABLE_POINT     (1 << 16)
+#       define ZBIAS_ENABLE_LINE      (1 << 17)
+#       define ZBIAS_ENABLE_TRI       (1 << 18)
+#       define WIDELINE_ENABLE        (1 << 20)
+#       define VPORT_XY_XFORM_ENABLE  (1 << 24)
+#       define VPORT_Z_XFORM_ENABLE   (1 << 25)
+#       define VTX_PIX_CENTER_D3D     (0 << 27)
+#       define VTX_PIX_CENTER_OGL     (1 << 27)
+#       define ROUND_MODE_TRUNC       (0 << 28)
+#       define ROUND_MODE_ROUND       (1 << 28)
+#       define ROUND_MODE_ROUND_EVEN  (2 << 28)
+#       define ROUND_MODE_ROUND_ODD   (3 << 28)
+#       define ROUND_PREC_16TH_PIX    (0 << 30)
+#       define ROUND_PREC_8TH_PIX     (1 << 30)
+#       define ROUND_PREC_4TH_PIX     (2 << 30)
+#       define ROUND_PREC_HALF_PIX    (3 << 30)
+#define R200_RE_CNTL				0x1c50 
+#       define R200_STIPPLE_ENABLE		0x1
+#       define R200_SCISSOR_ENABLE		0x2
+#       define R200_PATTERN_ENABLE		0x4
+#       define R200_PERSPECTIVE_ENABLE		0x8
+#       define R200_POINT_SMOOTH		0x20
+#       define R200_VTX_STQ0_D3D		0x00010000
+#       define R200_VTX_STQ1_D3D		0x00040000
+#       define R200_VTX_STQ2_D3D		0x00100000
+#       define R200_VTX_STQ3_D3D		0x00400000
+#       define R200_VTX_STQ4_D3D		0x01000000
+#       define R200_VTX_STQ5_D3D		0x04000000
+#define SE_CNTL_STATUS               0x2140
+#       define VC_NO_SWAP            (0 << 0)
+#       define VC_16BIT_SWAP         (1 << 0)
+#       define VC_32BIT_SWAP         (2 << 0)
+#       define VC_HALF_DWORD_SWAP    (3 << 0)
+#       define TCL_BYPASS            (1 << 8)
+#define SE_COORD_FMT                 0x1c50
+#       define VTX_XY_PRE_MULT_1_OVER_W0  (1 <<  0)
+#       define VTX_Z_PRE_MULT_1_OVER_W0   (1 <<  1)
+#       define VTX_ST0_NONPARAMETRIC      (1 <<  8)
+#       define VTX_ST1_NONPARAMETRIC      (1 <<  9)
+#       define VTX_ST2_NONPARAMETRIC      (1 << 10)
+#       define VTX_ST3_NONPARAMETRIC      (1 << 11)
+#       define VTX_W0_NORMALIZE           (1 << 12)
+#       define VTX_W0_IS_NOT_1_OVER_W0    (1 << 16)
+#       define VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17)
+#       define VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19)
+#       define VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21)
+#       define VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23)
+#       define TEX1_W_ROUTING_USE_W0      (0 << 26)
+#       define TEX1_W_ROUTING_USE_Q1      (1 << 26)
+#define SE_LINE_WIDTH                0x1db8
+#define SE_TCL_LIGHT_MODEL_CTL       0x226c
+#       define LIGHTING_ENABLE              (1 << 0)
+#       define LIGHT_IN_MODELSPACE          (1 << 1)
+#       define LOCAL_VIEWER                 (1 << 2)
+#       define NORMALIZE_NORMALS            (1 << 3)
+#       define RESCALE_NORMALS              (1 << 4)
+#       define SPECULAR_LIGHTS              (1 << 5)
+#       define DIFFUSE_SPECULAR_COMBINE     (1 << 6)
+#       define LIGHT_ALPHA                  (1 << 7)
+#       define LOCAL_LIGHT_VEC_GL           (1 << 8)
+#       define LIGHT_NO_NORMAL_AMBIENT_ONLY (1 << 9)
+#       define LM_SOURCE_STATE_PREMULT      0
+#       define LM_SOURCE_STATE_MULT         1
+#       define LM_SOURCE_VERTEX_DIFFUSE     2
+#       define LM_SOURCE_VERTEX_SPECULAR    3
+#       define EMISSIVE_SOURCE_SHIFT        16
+#       define AMBIENT_SOURCE_SHIFT         18
+#       define DIFFUSE_SOURCE_SHIFT         20
+#       define SPECULAR_SOURCE_SHIFT        22
+#define SE_TCL_MATERIAL_AMBIENT_RED     0x2220
+#define SE_TCL_MATERIAL_AMBIENT_GREEN   0x2224
+#define SE_TCL_MATERIAL_AMBIENT_BLUE    0x2228
+#define SE_TCL_MATERIAL_AMBIENT_ALPHA   0x222c
+#define SE_TCL_MATERIAL_DIFFUSE_RED     0x2230
+#define SE_TCL_MATERIAL_DIFFUSE_GREEN   0x2234
+#define SE_TCL_MATERIAL_DIFFUSE_BLUE    0x2238
+#define SE_TCL_MATERIAL_DIFFUSE_ALPHA   0x223c
+#define SE_TCL_MATERIAL_EMMISSIVE_RED   0x2210
+#define SE_TCL_MATERIAL_EMMISSIVE_GREEN 0x2214
+#define SE_TCL_MATERIAL_EMMISSIVE_BLUE  0x2218
+#define SE_TCL_MATERIAL_EMMISSIVE_ALPHA 0x221c
+#define SE_TCL_MATERIAL_SPECULAR_RED    0x2240
+#define SE_TCL_MATERIAL_SPECULAR_GREEN  0x2244
+#define SE_TCL_MATERIAL_SPECULAR_BLUE   0x2248
+#define SE_TCL_MATERIAL_SPECULAR_ALPHA  0x224c
+#define SE_TCL_MATRIX_SELECT_0       0x225c
+#       define MODELVIEW_0_SHIFT        0
+#       define MODELVIEW_1_SHIFT        4
+#       define MODELVIEW_2_SHIFT        8
+#       define MODELVIEW_3_SHIFT        12
+#       define IT_MODELVIEW_0_SHIFT     16
+#       define IT_MODELVIEW_1_SHIFT     20
+#       define IT_MODELVIEW_2_SHIFT     24
+#       define IT_MODELVIEW_3_SHIFT     28
+#define SE_TCL_MATRIX_SELECT_1       0x2260
+#       define MODELPROJECT_0_SHIFT     0
+#       define MODELPROJECT_1_SHIFT     4
+#       define MODELPROJECT_2_SHIFT     8
+#       define MODELPROJECT_3_SHIFT     12
+#       define TEXMAT_0_SHIFT           16
+#       define TEXMAT_1_SHIFT           20
+#       define TEXMAT_2_SHIFT           24
+#       define TEXMAT_3_SHIFT           28
+
+
+#define SE_TCL_OUTPUT_VTX_FMT        0x2254
+#       define TCL_VTX_W0                 (1 <<  0)
+#       define TCL_VTX_FP_DIFFUSE         (1 <<  1)
+#       define TCL_VTX_FP_ALPHA           (1 <<  2)
+#       define TCL_VTX_PK_DIFFUSE         (1 <<  3)
+#       define TCL_VTX_FP_SPEC            (1 <<  4)
+#       define TCL_VTX_FP_FOG             (1 <<  5)
+#       define TCL_VTX_PK_SPEC            (1 <<  6)
+#       define TCL_VTX_ST0                (1 <<  7)
+#       define TCL_VTX_ST1                (1 <<  8)
+#       define TCL_VTX_Q1                 (1 <<  9)
+#       define TCL_VTX_ST2                (1 << 10)
+#       define TCL_VTX_Q2                 (1 << 11)
+#       define TCL_VTX_ST3                (1 << 12)
+#       define TCL_VTX_Q3                 (1 << 13)
+#       define TCL_VTX_Q0                 (1 << 14)
+#       define TCL_VTX_WEIGHT_COUNT_SHIFT 15
+#       define TCL_VTX_NORM0              (1 << 18)
+#       define TCL_VTX_XY1                (1 << 27)
+#       define TCL_VTX_Z1                 (1 << 28)
+#       define TCL_VTX_W1                 (1 << 29)
+#       define TCL_VTX_NORM1              (1 << 30)
+#       define TCL_VTX_Z0                 (1 << 31)
+
+#define SE_TCL_OUTPUT_VTX_SEL        0x2258
+#       define TCL_COMPUTE_XYZW           (1 << 0)
+#       define TCL_COMPUTE_DIFFUSE        (1 << 1)
+#       define TCL_COMPUTE_SPECULAR       (1 << 2)
+#       define TCL_FORCE_NAN_IF_COLOR_NAN (1 << 3)
+#       define TCL_FORCE_INORDER_PROC     (1 << 4)
+#       define TCL_TEX_INPUT_TEX_0        0
+#       define TCL_TEX_INPUT_TEX_1        1
+#       define TCL_TEX_INPUT_TEX_2        2
+#       define TCL_TEX_INPUT_TEX_3        3
+#       define TCL_TEX_COMPUTED_TEX_0     8
+#       define TCL_TEX_COMPUTED_TEX_1     9
+#       define TCL_TEX_COMPUTED_TEX_2     10
+#       define TCL_TEX_COMPUTED_TEX_3     11
+#       define TCL_TEX_0_OUTPUT_SHIFT     16
+#       define TCL_TEX_1_OUTPUT_SHIFT     20
+#       define TCL_TEX_2_OUTPUT_SHIFT     24
+#       define TCL_TEX_3_OUTPUT_SHIFT     28
+
+#define SE_TCL_PER_LIGHT_CTL_0       0x2270
+#       define LIGHT_0_ENABLE               (1 <<  0)
+#       define LIGHT_0_ENABLE_AMBIENT       (1 <<  1)
+#       define LIGHT_0_ENABLE_SPECULAR      (1 <<  2)
+#       define LIGHT_0_IS_LOCAL             (1 <<  3)
+#       define LIGHT_0_IS_SPOT              (1 <<  4)
+#       define LIGHT_0_DUAL_CONE            (1 <<  5)
+#       define LIGHT_0_ENABLE_RANGE_ATTEN   (1 <<  6)
+#       define LIGHT_0_CONSTANT_RANGE_ATTEN (1 <<  7)
+#       define LIGHT_0_SHIFT                0
+#       define LIGHT_1_ENABLE               (1 << 16)
+#       define LIGHT_1_ENABLE_AMBIENT       (1 << 17)
+#       define LIGHT_1_ENABLE_SPECULAR      (1 << 18)
+#       define LIGHT_1_IS_LOCAL             (1 << 19)
+#       define LIGHT_1_IS_SPOT              (1 << 20)
+#       define LIGHT_1_DUAL_CONE            (1 << 21)
+#       define LIGHT_1_ENABLE_RANGE_ATTEN   (1 << 22)
+#       define LIGHT_1_CONSTANT_RANGE_ATTEN (1 << 23)
+#       define LIGHT_1_SHIFT                16
+#define SE_TCL_PER_LIGHT_CTL_1       0x2274
+#       define LIGHT_2_SHIFT            0
+#       define LIGHT_3_SHIFT            16
+#define SE_TCL_PER_LIGHT_CTL_2       0x2278
+#       define LIGHT_4_SHIFT            0
+#       define LIGHT_5_SHIFT            16
+#define SE_TCL_PER_LIGHT_CTL_3       0x227c
+#       define LIGHT_6_SHIFT            0
+#       define LIGHT_7_SHIFT            16
+
+#define SE_TCL_SHININESS             0x2250
+
+#define SE_TCL_TEXTURE_PROC_CTL      0x2268
+#       define TEXGEN_TEXMAT_0_ENABLE      (1 << 0)
+#       define TEXGEN_TEXMAT_1_ENABLE      (1 << 1)
+#       define TEXGEN_TEXMAT_2_ENABLE      (1 << 2)
+#       define TEXGEN_TEXMAT_3_ENABLE      (1 << 3)
+#       define TEXMAT_0_ENABLE             (1 << 4)
+#       define TEXMAT_1_ENABLE             (1 << 5)
+#       define TEXMAT_2_ENABLE             (1 << 6)
+#       define TEXMAT_3_ENABLE             (1 << 7)
+#       define TEXGEN_INPUT_MASK           0xf
+#       define TEXGEN_INPUT_TEXCOORD_0     0
+#       define TEXGEN_INPUT_TEXCOORD_1     1
+#       define TEXGEN_INPUT_TEXCOORD_2     2
+#       define TEXGEN_INPUT_TEXCOORD_3     3
+#       define TEXGEN_INPUT_OBJ            4
+#       define TEXGEN_INPUT_EYE            5
+#       define TEXGEN_INPUT_EYE_NORMAL     6
+#       define TEXGEN_INPUT_EYE_REFLECT    7
+#       define TEXGEN_INPUT_EYE_NORMALIZED 8
+#       define TEXGEN_0_INPUT_SHIFT        16
+#       define TEXGEN_1_INPUT_SHIFT        20
+#       define TEXGEN_2_INPUT_SHIFT        24
+#       define TEXGEN_3_INPUT_SHIFT        28
+
+#define SE_TCL_UCP_VERT_BLEND_CTL    0x2264
+#       define UCP_IN_CLIP_SPACE            (1 <<  0)
+#       define UCP_IN_MODEL_SPACE           (1 <<  1)
+#       define UCP_ENABLE_0                 (1 <<  2)
+#       define UCP_ENABLE_1                 (1 <<  3)
+#       define UCP_ENABLE_2                 (1 <<  4)
+#       define UCP_ENABLE_3                 (1 <<  5)
+#       define UCP_ENABLE_4                 (1 <<  6)
+#       define UCP_ENABLE_5                 (1 <<  7)
+#       define TCL_FOG_MASK                 (3 <<  8)
+#       define TCL_FOG_DISABLE              (0 <<  8)
+#       define TCL_FOG_EXP                  (1 <<  8)
+#       define TCL_FOG_EXP2                 (2 <<  8)
+#       define TCL_FOG_LINEAR               (3 <<  8)
+#       define RNG_BASED_FOG                (1 << 10)
+#       define LIGHT_TWOSIDE                (1 << 11)
+#       define BLEND_OP_COUNT_MASK          (7 << 12)
+#       define BLEND_OP_COUNT_SHIFT         12
+#       define POSITION_BLEND_OP_ENABLE     (1 << 16)
+#       define NORMAL_BLEND_OP_ENABLE       (1 << 17)
+#       define VERTEX_BLEND_SRC_0_PRIMARY   (1 << 18)
+#       define VERTEX_BLEND_SRC_0_SECONDARY (1 << 18)
+#       define VERTEX_BLEND_SRC_1_PRIMARY   (1 << 19)
+#       define VERTEX_BLEND_SRC_1_SECONDARY (1 << 19)
+#       define VERTEX_BLEND_SRC_2_PRIMARY   (1 << 20)
+#       define VERTEX_BLEND_SRC_2_SECONDARY (1 << 20)
+#       define VERTEX_BLEND_SRC_3_PRIMARY   (1 << 21)
+#       define VERTEX_BLEND_SRC_3_SECONDARY (1 << 21)
+#       define VERTEX_BLEND_WGT_MINUS_ONE   (1 << 22)
+#       define CULL_FRONT_IS_CW             (0 << 28)
+#       define CULL_FRONT_IS_CCW            (1 << 28)
+#       define CULL_FRONT                   (1 << 29)
+#       define CULL_BACK                    (1 << 30)
+#       define FORCE_W_TO_ONE               (1 << 31)
+
+#define SE_VPORT_XSCALE              0x1d98
+#define SE_VPORT_XOFFSET             0x1d9c
+#define SE_VPORT_YSCALE              0x1da0
+#define SE_VPORT_YOFFSET             0x1da4
+#define SE_VPORT_ZSCALE              0x1da8
+#define SE_VPORT_ZOFFSET             0x1dac
+#define SE_ZBIAS_FACTOR              0x1db0
+#define SE_ZBIAS_CONSTANT            0x1db4
+
+#define SE_VTX_FMT                   0x2080
+#       define SE_VTX_FMT_XY         0x00000000
+#       define SE_VTX_FMT_W0         0x00000001
+#       define SE_VTX_FMT_FPCOLOR    0x00000002
+#       define SE_VTX_FMT_FPALPHA    0x00000004
+#       define SE_VTX_FMT_PKCOLOR    0x00000008
+#       define SE_VTX_FMT_FPSPEC     0x00000010
+#       define SE_VTX_FMT_FPFOG      0x00000020
+#       define SE_VTX_FMT_PKSPEC     0x00000040
+#       define SE_VTX_FMT_ST0        0x00000080
+#       define SE_VTX_FMT_ST1        0x00000100
+#       define SE_VTX_FMT_Q1         0x00000200
+#       define SE_VTX_FMT_ST2        0x00000400
+#       define SE_VTX_FMT_Q2         0x00000800
+#       define SE_VTX_FMT_ST3        0x00001000
+#       define SE_VTX_FMT_Q3         0x00002000
+#       define SE_VTX_FMT_Q0         0x00004000
+#       define SE_VTX_FMT_BLND_WEIGHT_CNT_MASK  0x00038000
+#       define SE_VTX_FMT_N0         0x00040000
+#       define SE_VTX_FMT_XY1        0x08000000
+#       define SE_VTX_FMT_Z1         0x10000000
+#       define SE_VTX_FMT_W1         0x20000000
+#       define SE_VTX_FMT_N1         0x40000000
+#       define SE_VTX_FMT_Z          0x80000000
+
+#define SE_VF_CNTL                             0x2084
+#       define VF_PRIM_TYPE_POINT_LIST         1
+#       define VF_PRIM_TYPE_LINE_LIST          2
+#       define VF_PRIM_TYPE_LINE_STRIP         3
+#       define VF_PRIM_TYPE_TRIANGLE_LIST      4
+#       define VF_PRIM_TYPE_TRIANGLE_FAN       5
+#       define VF_PRIM_TYPE_TRIANGLE_STRIP     6
+#       define VF_PRIM_TYPE_TRIANGLE_FLAG      7
+#       define VF_PRIM_TYPE_RECTANGLE_LIST     8
+#       define VF_PRIM_TYPE_POINT_LIST_3       9
+#       define VF_PRIM_TYPE_LINE_LIST_3        10
+#       define VF_PRIM_TYPE_SPIRIT_LIST        11
+#       define VF_PRIM_TYPE_LINE_LOOP          12
+#       define VF_PRIM_TYPE_QUAD_LIST          13
+#       define VF_PRIM_TYPE_QUAD_STRIP         14
+#       define VF_PRIM_TYPE_POLYGON            15
+#       define VF_PRIM_WALK_STATE              (0<<4)
+#       define VF_PRIM_WALK_INDEX              (1<<4)
+#       define VF_PRIM_WALK_LIST               (2<<4)
+#       define VF_PRIM_WALK_DATA               (3<<4)
+#       define VF_COLOR_ORDER_RGBA             (1<<6)
+#       define VF_RADEON_MODE                  (1<<8)
+#       define VF_TCL_OUTPUT_CTL_ENA           (1<<9)
+#       define VF_PROG_STREAM_ENA              (1<<10)
+#       define VF_INDEX_SIZE_SHIFT             11
+#       define VF_NUM_VERTICES_SHIFT           16
+
+#define SE_PORT_DATA0			0x2000
+ 
+#define R200_SE_VAP_CNTL			0x2080
+#       define R200_VAP_TCL_ENABLE		0x00000001
+#       define R200_VAP_SINGLE_BUF_STATE_ENABLE	0x00000010
+#       define R200_VAP_FORCE_W_TO_ONE		0x00010000
+#       define R200_VAP_D3D_TEX_DEFAULT		0x00020000
+#       define R200_VAP_VF_MAX_VTX_NUM__SHIFT	18
+#       define R200_VAP_VF_MAX_VTX_NUM		(9 << 18)
+#       define R200_VAP_DX_CLIP_SPACE_DEF	0x00400000
+#define R200_VF_MAX_VTX_INDX			0x210c
+#define R200_VF_MIN_VTX_INDX			0x2110
+#define R200_SE_VTE_CNTL			0x20b0
+#       define R200_VPORT_X_SCALE_ENA			0x00000001
+#       define R200_VPORT_X_OFFSET_ENA			0x00000002
+#       define R200_VPORT_Y_SCALE_ENA			0x00000004
+#       define R200_VPORT_Y_OFFSET_ENA			0x00000008
+#       define R200_VPORT_Z_SCALE_ENA			0x00000010
+#       define R200_VPORT_Z_OFFSET_ENA			0x00000020
+#       define R200_VTX_XY_FMT				0x00000100
+#       define R200_VTX_Z_FMT				0x00000200
+#       define R200_VTX_W0_FMT				0x00000400
+#       define R200_VTX_W0_NORMALIZE			0x00000800
+#       define R200_VTX_ST_DENORMALIZED		0x00001000
+#define R200_SE_VAP_CNTL_STATUS			0x2140
+#       define R200_VC_NO_SWAP			(0 << 0)
+#       define R200_VC_16BIT_SWAP            (1 << 0)
+#       define R200_VC_32BIT_SWAP            (2 << 0)
+#       define R200_TCL_BYPASS               (1 << 8)
+#define R200_PP_TXFILTER_0			0x2c00
+#define R200_PP_TXFILTER_1              0x2c20
+#       define R200_MAG_FILTER_NEAREST		(0  <<  0)
+#       define R200_MAG_FILTER_LINEAR		(1  <<  0)
+#       define R200_MAG_FILTER_MASK		(1  <<  0)
+#       define R200_MIN_FILTER_NEAREST		(0  <<  1)
+#       define R200_MIN_FILTER_LINEAR		(1  <<  1)
+#       define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2  <<  1)
+#       define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3  <<  1)
+#       define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6  <<  1)
+#       define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7  <<  1)
+#       define R200_MIN_FILTER_ANISO_NEAREST	(8  <<  1)
+#       define R200_MIN_FILTER_ANISO_LINEAR	(9  <<  1)
+#       define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 <<  1)
+#       define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 <<  1)
+#       define R200_MIN_FILTER_MASK		(15 <<  1)
+#       define R200_MAX_ANISO_1_TO_1		(0  <<  5)
+#       define R200_MAX_ANISO_2_TO_1		(1  <<  5)
+#       define R200_MAX_ANISO_4_TO_1		(2  <<  5)
+#       define R200_MAX_ANISO_8_TO_1		(3  <<  5)
+#       define R200_MAX_ANISO_16_TO_1		(4  <<  5)
+#       define R200_MAX_ANISO_MASK		(7  <<  5)
+#       define R200_MAX_MIP_LEVEL_MASK		(0x0f << 16)
+#       define R200_MAX_MIP_LEVEL_SHIFT		16
+#       define R200_YUV_TO_RGB			(1  << 20)
+#       define R200_YUV_TEMPERATURE_COOL	(0  << 21)
+#       define R200_YUV_TEMPERATURE_HOT		(1  << 21)
+#       define R200_YUV_TEMPERATURE_MASK	(1  << 21)
+#       define R200_WRAPEN_S			(1  << 22)
+#       define R200_CLAMP_S_WRAP		(0  << 23)
+#       define R200_CLAMP_S_MIRROR		(1  << 23)
+#       define R200_CLAMP_S_CLAMP_LAST		(2  << 23)
+#       define R200_CLAMP_S_MIRROR_CLAMP_LAST	(3  << 23)
+#       define R200_CLAMP_S_CLAMP_BORDER	(4  << 23)
+#       define R200_CLAMP_S_MIRROR_CLAMP_BORDER	(5  << 23)
+#       define R200_CLAMP_S_CLAMP_GL		(6  << 23)
+#       define R200_CLAMP_S_MIRROR_CLAMP_GL	(7  << 23)
+#       define R200_CLAMP_S_MASK		(7  << 23)
+#       define R200_WRAPEN_T			(1  << 26)
+#       define R200_CLAMP_T_WRAP		(0  << 27)
+#       define R200_CLAMP_T_MIRROR		(1  << 27)
+#       define R200_CLAMP_T_CLAMP_LAST		(2  << 27)
+#       define R200_CLAMP_T_MIRROR_CLAMP_LAST	(3  << 27)
+#       define R200_CLAMP_T_CLAMP_BORDER	(4  << 27)
+#       define R200_CLAMP_T_MIRROR_CLAMP_BORDER	(5  << 27)
+#       define R200_CLAMP_T_CLAMP_GL		(6  << 27)
+#       define R200_CLAMP_T_MIRROR_CLAMP_GL	(7  << 27)
+#       define R200_CLAMP_T_MASK		(7  << 27)
+#       define R200_KILL_LT_ZERO		(1  << 30)
+#       define R200_BORDER_MODE_OGL		(0  << 31)
+#       define R200_BORDER_MODE_D3D		(1  << 31)
+#define R200_PP_TXFORMAT_0             0x2c04
+#define R200_PP_TXFORMAT_1             0x2c24
+#       define R200_TXFORMAT_I8			(0 << 0)
+#       define R200_TXFORMAT_AI88	          (1 << 0)
+#       define R200_TXFORMAT_RGB332		(2 << 0)
+#       define R200_TXFORMAT_ARGB1555		(3 << 0)
+#       define R200_TXFORMAT_RGB565		(4 << 0)
+#       define R200_TXFORMAT_ARGB4444		(5 << 0)
+#       define R200_TXFORMAT_ARGB8888		(6 << 0)
+#       define R200_TXFORMAT_RGBA8888		(7 << 0)
+#       define R200_TXFORMAT_Y8              (8 << 0)
+#       define R200_TXFORMAT_AVYU            (9 << 0)
+#       define R200_TXFORMAT_VYUY422		(10 << 0)
+#       define R200_TXFORMAT_YVYU422		(11 << 0)
+#       define R200_TXFORMAT_DXT1	          (12 << 0)
+#       define R200_TXFORMAT_DXT23           (14 << 0)
+#       define R200_TXFORMAT_DXT45           (15 << 0)
+#       define R200_TXFORMAT_FORMAT_MASK	(31 << 0)
+#       define R200_TXFORMAT_FORMAT_SHIFT	0
+#       define R200_TXFORMAT_ALPHA_IN_MAP	(1 << 6)
+#       define R200_TXFORMAT_NON_POWER2		(1 << 7)
+#       define R200_TXFORMAT_WIDTH_MASK		(15 <<	8)
+#       define R200_TXFORMAT_WIDTH_SHIFT	8
+#       define R200_TXFORMAT_HEIGHT_MASK	(15 << 12)
+#       define R200_TXFORMAT_HEIGHT_SHIFT	12
+#       define R200_TXFORMAT_F5_WIDTH_MASK	(15 << 16)	/* cube face 5 */
+#       define R200_TXFORMAT_F5_WIDTH_SHIFT	16
+#       define R200_TXFORMAT_F5_HEIGHT_MASK	(15 << 20)
+#       define R200_TXFORMAT_F5_HEIGHT_SHIFT	20
+#       define R200_TXFORMAT_ST_ROUTE_STQ0	(0 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_STQ1	(1 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_STQ2	(2 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_STQ3	(3 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_STQ4	(4 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_STQ5	(5 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_MASK	(7 << 24)
+#       define R200_TXFORMAT_ST_ROUTE_SHIFT	24
+#       define R200_TXFORMAT_ALPHA_MASK_ENABLE	(1 << 28)
+#       define R200_TXFORMAT_CHROMA_KEY_ENABLE	(1 << 29)
+#       define R200_TXFORMAT_CUBIC_MAP_ENABLE		(1 << 30)
+#define R200_PP_TXFORMAT_X_0            0x2c08
+#define R200_PP_TXFORMAT_X_1            0x2c28
+#define     R200_DEPTH_LOG2_MASK                      (0xf << 0)
+#define     R200_DEPTH_LOG2_SHIFT                     0
+#define     R200_VOLUME_FILTER_SHIFT                  4
+#define     R200_VOLUME_FILTER_MASK                   (1 << 4)
+#define     R200_VOLUME_FILTER_NEAREST                (0 << 4)
+#define     R200_VOLUME_FILTER_LINEAR                 (1 << 4)
+#define     R200_WRAPEN_Q                             (1  << 8)
+#define     R200_CLAMP_Q_WRAP                         (0  << 9)
+#define     R200_CLAMP_Q_MIRROR                       (1  << 9)
+#define     R200_CLAMP_Q_CLAMP_LAST                   (2  << 9)
+#define     R200_CLAMP_Q_MIRROR_CLAMP_LAST            (3  << 9)
+#define     R200_CLAMP_Q_CLAMP_BORDER                 (4  << 9)
+#define     R200_CLAMP_Q_MIRROR_CLAMP_BORDER          (5  << 9)
+#define     R200_CLAMP_Q_CLAMP_GL                     (6  << 9)
+#define     R200_CLAMP_Q_MIRROR_CLAMP_GL              (7  << 9)
+#define     R200_CLAMP_Q_MASK                         (7  << 9)
+#define     R200_MIN_MIP_LEVEL_MASK                   (0xff << 12)
+#define     R200_MIN_MIP_LEVEL_SHIFT                  12
+#define     R200_TEXCOORD_NONPROJ                     (0  << 16)
+#define     R200_TEXCOORD_CUBIC_ENV                   (1  << 16)
+#define     R200_TEXCOORD_VOLUME                      (2  << 16)
+#define     R200_TEXCOORD_PROJ                        (3  << 16)
+#define     R200_TEXCOORD_DEPTH                       (4  << 16)
+#define     R200_TEXCOORD_1D_PROJ                     (5  << 16)
+#define     R200_TEXCOORD_1D                          (6  << 16)
+#define     R200_TEXCOORD_ZERO                        (7  << 16)
+#define     R200_TEXCOORD_MASK                        (7  << 16)
+#define     R200_LOD_BIAS_MASK                        (0xfff80000)
+#define     R200_LOD_BIAS_SHIFT                       19
+#define R200_PP_TXSIZE_0	               0x2c0c /* NPOT only */
+#define R200_PP_TXSIZE_1                0x2c2c
+#define R200_PP_TXPITCH_0               0x2c10 /* NPOT only */
+#define R200_PP_TXPITCH_1               0x2c30
+#define R200_PP_BORDER_COLOR_0          0x2c14
+#define R200_PP_BORDER_COLOR_1          0x2c34
+#define R200_PP_TXOFFSET_0			0x2d00
+#define R200_PP_TXOFFSET_1              0x2d18
+#       define R200_TXO_ENDIAN_NO_SWAP		(0 << 0)
+#       define R200_TXO_ENDIAN_BYTE_SWAP	(1 << 0)
+#       define R200_TXO_ENDIAN_WORD_SWAP	(2 << 0)
+#       define R200_TXO_ENDIAN_HALFDW_SWAP	(3 << 0)
+#       define R200_TXO_OFFSET_MASK		0xffffffe0
+#       define R200_TXO_OFFSET_SHIFT		5
+
+
+#define R200_PP_TFACTOR_0			0x2ee0
+#define R200_PP_TFACTOR_1			0x2ee4
+#define R200_PP_TFACTOR_2			0x2ee8
+#define R200_PP_TFACTOR_3			0x2eec
+#define R200_PP_TFACTOR_4			0x2ef0
+#define R200_PP_TFACTOR_5			0x2ef4
+
+#define R200_PP_TXCBLEND_0			0x2f00
+#define R200_PP_TXCBLEND_1              0x2f10
+#       define R200_TXC_ARG_A_ZERO		(0)
+#       define R200_TXC_ARG_A_CURRENT_COLOR	(2)
+#       define R200_TXC_ARG_A_CURRENT_ALPHA	(3)
+#       define R200_TXC_ARG_A_DIFFUSE_COLOR	(4)
+#       define R200_TXC_ARG_A_DIFFUSE_ALPHA	(5)
+#       define R200_TXC_ARG_A_SPECULAR_COLOR	(6)
+#       define R200_TXC_ARG_A_SPECULAR_ALPHA	(7)
+#       define R200_TXC_ARG_A_TFACTOR_COLOR	(8)
+#       define R200_TXC_ARG_A_TFACTOR_ALPHA	(9)
+#       define R200_TXC_ARG_A_R0_COLOR		(10)
+#       define R200_TXC_ARG_A_R0_ALPHA		(11)
+#       define R200_TXC_ARG_A_R1_COLOR		(12)
+#       define R200_TXC_ARG_A_R1_ALPHA		(13)
+#       define R200_TXC_ARG_A_R2_COLOR		(14)
+#       define R200_TXC_ARG_A_R2_ALPHA		(15)
+#       define R200_TXC_ARG_A_R3_COLOR		(16)
+#       define R200_TXC_ARG_A_R3_ALPHA		(17)
+#       define R200_TXC_ARG_A_R4_COLOR		(18)
+#       define R200_TXC_ARG_A_R4_ALPHA		(19)
+#       define R200_TXC_ARG_A_R5_COLOR		(20)
+#       define R200_TXC_ARG_A_R5_ALPHA		(21)
+#       define R200_TXC_ARG_A_TFACTOR1_COLOR	(26)
+#       define R200_TXC_ARG_A_TFACTOR1_ALPHA	(27)
+#       define R200_TXC_ARG_A_MASK		(31 << 0)
+#       define R200_TXC_ARG_A_SHIFT		0
+#       define R200_TXC_ARG_B_ZERO		(0 << 5)
+#       define R200_TXC_ARG_B_CURRENT_COLOR	(2 << 5)
+#       define R200_TXC_ARG_B_CURRENT_ALPHA	(3 << 5)
+#       define R200_TXC_ARG_B_DIFFUSE_COLOR	(4 << 5)
+#       define R200_TXC_ARG_B_DIFFUSE_ALPHA	(5 << 5)
+#       define R200_TXC_ARG_B_SPECULAR_COLOR	(6 << 5)
+#       define R200_TXC_ARG_B_SPECULAR_ALPHA	(7 << 5)
+#       define R200_TXC_ARG_B_TFACTOR_COLOR	(8 << 5)
+#       define R200_TXC_ARG_B_TFACTOR_ALPHA	(9 << 5)
+#       define R200_TXC_ARG_B_R0_COLOR		(10 << 5)
+#       define R200_TXC_ARG_B_R0_ALPHA		(11 << 5)
+#       define R200_TXC_ARG_B_R1_COLOR		(12 << 5)
+#       define R200_TXC_ARG_B_R1_ALPHA		(13 << 5)
+#       define R200_TXC_ARG_B_R2_COLOR		(14 << 5)
+#       define R200_TXC_ARG_B_R2_ALPHA		(15 << 5)
+#       define R200_TXC_ARG_B_R3_COLOR		(16 << 5)
+#       define R200_TXC_ARG_B_R3_ALPHA		(17 << 5)
+#       define R200_TXC_ARG_B_R4_COLOR		(18 << 5)
+#       define R200_TXC_ARG_B_R4_ALPHA		(19 << 5)
+#       define R200_TXC_ARG_B_R5_COLOR		(20 << 5)
+#       define R200_TXC_ARG_B_R5_ALPHA		(21 << 5)
+#       define R200_TXC_ARG_B_TFACTOR1_COLOR	(26 << 5)
+#       define R200_TXC_ARG_B_TFACTOR1_ALPHA	(27 << 5)
+#       define R200_TXC_ARG_B_MASK		(31 << 5)
+#       define R200_TXC_ARG_B_SHIFT		5
+#       define R200_TXC_ARG_C_ZERO		(0 << 10)
+#       define R200_TXC_ARG_C_CURRENT_COLOR	(2 << 10)
+#       define R200_TXC_ARG_C_CURRENT_ALPHA	(3 << 10)
+#       define R200_TXC_ARG_C_DIFFUSE_COLOR	(4 << 10)
+#       define R200_TXC_ARG_C_DIFFUSE_ALPHA	(5 << 10)
+#       define R200_TXC_ARG_C_SPECULAR_COLOR	(6 << 10)
+#       define R200_TXC_ARG_C_SPECULAR_ALPHA	(7 << 10)
+#       define R200_TXC_ARG_C_TFACTOR_COLOR	(8 << 10)
+#       define R200_TXC_ARG_C_TFACTOR_ALPHA	(9 << 10)
+#       define R200_TXC_ARG_C_R0_COLOR		(10 << 10)
+#       define R200_TXC_ARG_C_R0_ALPHA		(11 << 10)
+#       define R200_TXC_ARG_C_R1_COLOR		(12 << 10)
+#       define R200_TXC_ARG_C_R1_ALPHA		(13 << 10)
+#       define R200_TXC_ARG_C_R2_COLOR		(14 << 10)
+#       define R200_TXC_ARG_C_R2_ALPHA		(15 << 10)
+#       define R200_TXC_ARG_C_R3_COLOR		(16 << 10)
+#       define R200_TXC_ARG_C_R3_ALPHA		(17 << 10)
+#       define R200_TXC_ARG_C_R4_COLOR		(18 << 10)
+#       define R200_TXC_ARG_C_R4_ALPHA		(19 << 10)
+#       define R200_TXC_ARG_C_R5_COLOR		(20 << 10)
+#       define R200_TXC_ARG_C_R5_ALPHA		(21 << 10)
+#       define R200_TXC_ARG_C_TFACTOR1_COLOR	(26 << 10)
+#       define R200_TXC_ARG_C_TFACTOR1_ALPHA	(27 << 10)
+#       define R200_TXC_ARG_C_MASK		(31 << 10)
+#       define R200_TXC_ARG_C_SHIFT		10
+#       define R200_TXC_COMP_ARG_A		(1 << 16)
+#       define R200_TXC_COMP_ARG_A_SHIFT	(16)
+#       define R200_TXC_BIAS_ARG_A		(1 << 17)
+#       define R200_TXC_SCALE_ARG_A		(1 << 18)
+#       define R200_TXC_NEG_ARG_A		(1 << 19)
+#       define R200_TXC_COMP_ARG_B		(1 << 20)
+#       define R200_TXC_COMP_ARG_B_SHIFT	(20)
+#       define R200_TXC_BIAS_ARG_B		(1 << 21)
+#       define R200_TXC_SCALE_ARG_B		(1 << 22)
+#       define R200_TXC_NEG_ARG_B		(1 << 23)
+#       define R200_TXC_COMP_ARG_C		(1 << 24)
+#       define R200_TXC_COMP_ARG_C_SHIFT	(24)
+#       define R200_TXC_BIAS_ARG_C		(1 << 25)
+#       define R200_TXC_SCALE_ARG_C		(1 << 26)
+#       define R200_TXC_NEG_ARG_C		(1 << 27)
+#       define R200_TXC_OP_MADD			(0 << 28)
+#       define R200_TXC_OP_CND0			(2 << 28)
+#       define R200_TXC_OP_LERP			(3 << 28)
+#       define R200_TXC_OP_DOT3			(4 << 28)
+#       define R200_TXC_OP_DOT4			(5 << 28)
+#       define R200_TXC_OP_CONDITIONAL		(6 << 28)
+#       define R200_TXC_OP_DOT2_ADD		(7 << 28)
+#       define R200_TXC_OP_MASK			(7 << 28)
+#define R200_PP_TXCBLEND2_0             0x2f04
+#define R200_PP_TXCBLEND2_1             0x2f14
+#       define R200_TXC_TFACTOR_SEL_SHIFT	0
+#       define R200_TXC_TFACTOR_SEL_MASK	0x7
+#       define R200_TXC_TFACTOR1_SEL_SHIFT	4
+#       define R200_TXC_TFACTOR1_SEL_MASK	(0x7 << 4)
+#       define R200_TXC_SCALE_SHIFT		8
+#       define R200_TXC_SCALE_MASK		(7 << 8)
+#       define R200_TXC_SCALE_1X		(0 << 8)
+#       define R200_TXC_SCALE_2X		(1 << 8)
+#       define R200_TXC_SCALE_4X		(2 << 8)
+#       define R200_TXC_SCALE_8X		(3 << 8)
+#       define R200_TXC_SCALE_INV2		(5 << 8)
+#       define R200_TXC_SCALE_INV4		(6 << 8)
+#       define R200_TXC_SCALE_INV8		(7 << 8)
+#       define R200_TXC_CLAMP_SHIFT		12
+#       define R200_TXC_CLAMP_MASK		(3 << 12)
+#       define R200_TXC_CLAMP_WRAP		(0 << 12)
+#       define R200_TXC_CLAMP_0_1		(1 << 12)
+#       define R200_TXC_CLAMP_8_8		(2 << 12)
+#       define R200_TXC_OUTPUT_REG_MASK		(7 << 16)
+#       define R200_TXC_OUTPUT_REG_NONE		(0 << 16)
+#       define R200_TXC_OUTPUT_REG_R0		(1 << 16)
+#       define R200_TXC_OUTPUT_REG_R1		(2 << 16)
+#       define R200_TXC_OUTPUT_REG_R2		(3 << 16)
+#       define R200_TXC_OUTPUT_REG_R3		(4 << 16)
+#       define R200_TXC_OUTPUT_REG_R4		(5 << 16)
+#       define R200_TXC_OUTPUT_REG_R5		(6 << 16)
+#       define R200_TXC_OUTPUT_MASK_MASK	(7 << 20)
+#       define R200_TXC_OUTPUT_MASK_RGB		(0 << 20)
+#       define R200_TXC_OUTPUT_MASK_RG		(1 << 20)
+#       define R200_TXC_OUTPUT_MASK_RB		(2 << 20)
+#       define R200_TXC_OUTPUT_MASK_R		(3 << 20)
+#       define R200_TXC_OUTPUT_MASK_GB		(4 << 20)
+#       define R200_TXC_OUTPUT_MASK_G		(5 << 20)
+#       define R200_TXC_OUTPUT_MASK_B		(6 << 20)
+#       define R200_TXC_OUTPUT_MASK_NONE	(7 << 20)
+#       define R200_TXC_REPL_NORMAL		0
+#       define R200_TXC_REPL_RED		1
+#       define R200_TXC_REPL_GREEN		2
+#       define R200_TXC_REPL_BLUE		3
+#       define R200_TXC_REPL_ARG_A_SHIFT	26
+#       define R200_TXC_REPL_ARG_A_MASK		(3 << 26)
+#       define R200_TXC_REPL_ARG_B_SHIFT	28
+#       define R200_TXC_REPL_ARG_B_MASK		(3 << 28)
+#       define R200_TXC_REPL_ARG_C_SHIFT	30
+#       define R200_TXC_REPL_ARG_C_MASK		(3 << 30)
+#define R200_PP_TXABLEND_0              0x2f08
+#define R200_PP_TXABLEND_1              0x2f18
+#       define R200_TXA_ARG_A_ZERO		(0)
+#       define R200_TXA_ARG_A_CURRENT_ALPHA	(2) /* guess */
+#       define R200_TXA_ARG_A_CURRENT_BLUE	(3) /* guess */
+#       define R200_TXA_ARG_A_DIFFUSE_ALPHA	(4)
+#       define R200_TXA_ARG_A_DIFFUSE_BLUE	(5)
+#       define R200_TXA_ARG_A_SPECULAR_ALPHA	(6)
+#       define R200_TXA_ARG_A_SPECULAR_BLUE	(7)
+#       define R200_TXA_ARG_A_TFACTOR_ALPHA	(8)
+#       define R200_TXA_ARG_A_TFACTOR_BLUE	(9)
+#       define R200_TXA_ARG_A_R0_ALPHA		(10)
+#       define R200_TXA_ARG_A_R0_BLUE		(11)
+#       define R200_TXA_ARG_A_R1_ALPHA		(12)
+#       define R200_TXA_ARG_A_R1_BLUE		(13)
+#       define R200_TXA_ARG_A_R2_ALPHA		(14)
+#       define R200_TXA_ARG_A_R2_BLUE		(15)
+#       define R200_TXA_ARG_A_R3_ALPHA		(16)
+#       define R200_TXA_ARG_A_R3_BLUE		(17)
+#       define R200_TXA_ARG_A_R4_ALPHA		(18)
+#       define R200_TXA_ARG_A_R4_BLUE		(19)
+#       define R200_TXA_ARG_A_R5_ALPHA		(20)
+#       define R200_TXA_ARG_A_R5_BLUE		(21)
+#       define R200_TXA_ARG_A_TFACTOR1_ALPHA	(26)
+#       define R200_TXA_ARG_A_TFACTOR1_BLUE	(27)
+#       define R200_TXA_ARG_A_MASK		(31 << 0)
+#       define R200_TXA_ARG_A_SHIFT		0
+#       define R200_TXA_ARG_B_ZERO		(0 << 5)
+#       define R200_TXA_ARG_B_CURRENT_ALPHA	(2 << 5) /* guess */
+#       define R200_TXA_ARG_B_CURRENT_BLUE	(3 << 5) /* guess */
+#       define R200_TXA_ARG_B_DIFFUSE_ALPHA	(4 << 5)
+#       define R200_TXA_ARG_B_DIFFUSE_BLUE	(5 << 5)
+#       define R200_TXA_ARG_B_SPECULAR_ALPHA	(6 << 5)
+#       define R200_TXA_ARG_B_SPECULAR_BLUE	(7 << 5)
+#       define R200_TXA_ARG_B_TFACTOR_ALPHA	(8 << 5)
+#       define R200_TXA_ARG_B_TFACTOR_BLUE	(9 << 5)
+#       define R200_TXA_ARG_B_R0_ALPHA		(10 << 5)
+#       define R200_TXA_ARG_B_R0_BLUE		(11 << 5)
+#       define R200_TXA_ARG_B_R1_ALPHA		(12 << 5)
+#       define R200_TXA_ARG_B_R1_BLUE		(13 << 5)
+#       define R200_TXA_ARG_B_R2_ALPHA		(14 << 5)
+#       define R200_TXA_ARG_B_R2_BLUE		(15 << 5)
+#       define R200_TXA_ARG_B_R3_ALPHA		(16 << 5)
+#       define R200_TXA_ARG_B_R3_BLUE		(17 << 5)
+#       define R200_TXA_ARG_B_R4_ALPHA		(18 << 5)
+#       define R200_TXA_ARG_B_R4_BLUE		(19 << 5)
+#       define R200_TXA_ARG_B_R5_ALPHA		(20 << 5)
+#       define R200_TXA_ARG_B_R5_BLUE		(21 << 5)
+#       define R200_TXA_ARG_B_TFACTOR1_ALPHA	(26 << 5)
+#       define R200_TXA_ARG_B_TFACTOR1_BLUE	(27 << 5)
+#       define R200_TXA_ARG_B_MASK		(31 << 5)
+#       define R200_TXA_ARG_B_SHIFT			5
+#       define R200_TXA_ARG_C_ZERO		(0 << 10)
+#       define R200_TXA_ARG_C_CURRENT_ALPHA	(2 << 10) /* guess */
+#       define R200_TXA_ARG_C_CURRENT_BLUE	(3 << 10) /* guess */
+#       define R200_TXA_ARG_C_DIFFUSE_ALPHA	(4 << 10)
+#       define R200_TXA_ARG_C_DIFFUSE_BLUE	(5 << 10)
+#       define R200_TXA_ARG_C_SPECULAR_ALPHA	(6 << 10)
+#       define R200_TXA_ARG_C_SPECULAR_BLUE	(7 << 10)
+#       define R200_TXA_ARG_C_TFACTOR_ALPHA	(8 << 10)
+#       define R200_TXA_ARG_C_TFACTOR_BLUE	(9 << 10)
+#       define R200_TXA_ARG_C_R0_ALPHA		(10 << 10)
+#       define R200_TXA_ARG_C_R0_BLUE		(11 << 10)
+#       define R200_TXA_ARG_C_R1_ALPHA		(12 << 10)
+#       define R200_TXA_ARG_C_R1_BLUE		(13 << 10)
+#       define R200_TXA_ARG_C_R2_ALPHA		(14 << 10)
+#       define R200_TXA_ARG_C_R2_BLUE		(15 << 10)
+#       define R200_TXA_ARG_C_R3_ALPHA		(16 << 10)
+#       define R200_TXA_ARG_C_R3_BLUE		(17 << 10)
+#       define R200_TXA_ARG_C_R4_ALPHA		(18 << 10)
+#       define R200_TXA_ARG_C_R4_BLUE		(19 << 10)
+#       define R200_TXA_ARG_C_R5_ALPHA		(20 << 10)
+#       define R200_TXA_ARG_C_R5_BLUE		(21 << 10)
+#       define R200_TXA_ARG_C_TFACTOR1_ALPHA	(26 << 10)
+#       define R200_TXA_ARG_C_TFACTOR1_BLUE	(27 << 10)
+#       define R200_TXA_ARG_C_MASK		(31 << 10)
+#       define R200_TXA_ARG_C_SHIFT		10
+#       define R200_TXA_COMP_ARG_A		(1 << 16)
+#       define R200_TXA_COMP_ARG_A_SHIFT	(16)
+#       define R200_TXA_BIAS_ARG_A		(1 << 17)
+#       define R200_TXA_SCALE_ARG_A		(1 << 18)
+#       define R200_TXA_NEG_ARG_A		(1 << 19)
+#       define R200_TXA_COMP_ARG_B		(1 << 20)
+#       define R200_TXA_COMP_ARG_B_SHIFT	(20)
+#       define R200_TXA_BIAS_ARG_B		(1 << 21)
+#       define R200_TXA_SCALE_ARG_B		(1 << 22)
+#       define R200_TXA_NEG_ARG_B		(1 << 23)
+#       define R200_TXA_COMP_ARG_C		(1 << 24)
+#       define R200_TXA_COMP_ARG_C_SHIFT	(24)
+#       define R200_TXA_BIAS_ARG_C		(1 << 25)
+#       define R200_TXA_SCALE_ARG_C		(1 << 26)
+#       define R200_TXA_NEG_ARG_C		(1 << 27)
+#       define R200_TXA_OP_MADD			(0 << 28)
+#       define R200_TXA_OP_CND0			(2 << 28)
+#       define R200_TXA_OP_LERP			(3 << 28)
+#       define R200_TXA_OP_CONDITIONAL		(6 << 28)
+#       define R200_TXA_OP_MASK			(7 << 28)
+#define R200_PP_TXABLEND2_0             0x2f0c
+#define R200_PP_TXABLEND2_1             0x2f1c
+#       define R200_TXA_TFACTOR_SEL_SHIFT	0
+#       define R200_TXA_TFACTOR_SEL_MASK	0x7
+#       define R200_TXA_TFACTOR1_SEL_SHIFT	4
+#       define R200_TXA_TFACTOR1_SEL_MASK	(0x7 << 4)
+#       define R200_TXA_SCALE_SHIFT		8
+#       define R200_TXA_SCALE_MASK		(7 << 8)
+#       define R200_TXA_SCALE_1X		(0 << 8)
+#       define R200_TXA_SCALE_2X		(1 << 8)
+#       define R200_TXA_SCALE_4X		(2 << 8)
+#       define R200_TXA_SCALE_8X		(3 << 8)
+#       define R200_TXA_SCALE_INV2		(5 << 8)
+#       define R200_TXA_SCALE_INV4		(6 << 8)
+#       define R200_TXA_SCALE_INV8		(7 << 8)
+#       define R200_TXA_CLAMP_SHIFT		12
+#       define R200_TXA_CLAMP_MASK		(3 << 12)
+#       define R200_TXA_CLAMP_WRAP		(0 << 12)
+#       define R200_TXA_CLAMP_0_1		(1 << 12)
+#       define R200_TXA_CLAMP_8_8		(2 << 12)
+#       define R200_TXA_OUTPUT_REG_MASK		(7 << 16)
+#       define R200_TXA_OUTPUT_REG_NONE		(0 << 16)
+#       define R200_TXA_OUTPUT_REG_R0		(1 << 16)
+#       define R200_TXA_OUTPUT_REG_R1		(2 << 16)
+#       define R200_TXA_OUTPUT_REG_R2		(3 << 16)
+#       define R200_TXA_OUTPUT_REG_R3		(4 << 16)
+#       define R200_TXA_OUTPUT_REG_R4		(5 << 16)
+#       define R200_TXA_OUTPUT_REG_R5		(6 << 16)
+#       define R200_TXA_DOT_ALPHA		(1 << 20)
+#       define R200_TXA_REPL_NORMAL		0
+#       define R200_TXA_REPL_RED		1
+#       define R200_TXA_REPL_GREEN		2
+#       define R200_TXA_REPL_ARG_A_SHIFT	26
+#       define R200_TXA_REPL_ARG_A_MASK		(3 << 26)
+#       define R200_TXA_REPL_ARG_B_SHIFT	28
+#       define R200_TXA_REPL_ARG_B_MASK		(3 << 28)
+#       define R200_TXA_REPL_ARG_C_SHIFT	30
+#       define R200_TXA_REPL_ARG_C_MASK		(3 << 30)
+#define R200_RB3D_BLENDCOLOR            0x3218 /* ARGB 8888 */
+#define R200_RB3D_ABLENDCNTL            0x321C /* see BLENDCNTL */
+#define R200_RB3D_CBLENDCNTL            0x3220 /* see BLENDCNTL */
+
+#define R200_SE_VTX_FMT_0			0x2088
+#       define R200_VTX_XY			0 /* always have xy */
+#       define R200_VTX_Z0			(1<<0)
+#       define R200_VTX_W0			(1<<1)
+#       define R200_VTX_WEIGHT_COUNT_SHIFT	(2)
+#       define R200_VTX_PV_MATRIX_SEL		(1<<5)
+#       define R200_VTX_N0			(1<<6)
+#       define R200_VTX_POINT_SIZE		(1<<7)
+#       define R200_VTX_DISCRETE_FOG		(1<<8)
+#       define R200_VTX_SHININESS_0		(1<<9)
+#       define R200_VTX_SHININESS_1		(1<<10)
+#       define   R200_VTX_COLOR_NOT_PRESENT	0
+#       define   R200_VTX_PK_RGBA		1
+#       define   R200_VTX_FP_RGB		2
+#       define   R200_VTX_FP_RGBA		3
+#       define   R200_VTX_COLOR_MASK		3
+#       define R200_VTX_COLOR_0_SHIFT		11
+#       define R200_VTX_COLOR_1_SHIFT		13
+#       define R200_VTX_COLOR_2_SHIFT		15
+#       define R200_VTX_COLOR_3_SHIFT		17
+#       define R200_VTX_COLOR_4_SHIFT		19
+#       define R200_VTX_COLOR_5_SHIFT		21
+#       define R200_VTX_COLOR_6_SHIFT		23
+#       define R200_VTX_COLOR_7_SHIFT		25
+#       define R200_VTX_XY1			(1<<28)
+#       define R200_VTX_Z1			(1<<29)
+#       define R200_VTX_W1			(1<<30)
+#       define R200_VTX_N1			(1<<31)
+#define R200_SE_VTX_FMT_1			0x208c
+#       define R200_VTX_TEX0_COMP_CNT_SHIFT	0
+#       define R200_VTX_TEX1_COMP_CNT_SHIFT	3
+#       define R200_VTX_TEX2_COMP_CNT_SHIFT	6
+#       define R200_VTX_TEX3_COMP_CNT_SHIFT	9
+#       define R200_VTX_TEX4_COMP_CNT_SHIFT	12
+#       define R200_VTX_TEX5_COMP_CNT_SHIFT	15
+
+#define R200_SE_TCL_OUTPUT_VTX_FMT_0		0x2090
+#define R200_SE_TCL_OUTPUT_VTX_FMT_1		0x2094
+#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL		0x2250
+#       define R200_OUTPUT_XYZW			(1<<0)
+#       define R200_OUTPUT_COLOR_0		(1<<8)
+#       define R200_OUTPUT_COLOR_1		(1<<9)
+#       define R200_OUTPUT_TEX_0		(1<<16)
+#       define R200_OUTPUT_TEX_1		(1<<17)
+#       define R200_OUTPUT_TEX_2		(1<<18)
+#       define R200_OUTPUT_TEX_3		(1<<19)
+#       define R200_OUTPUT_TEX_4		(1<<20)
+#       define R200_OUTPUT_TEX_5		(1<<21)
+#       define R200_OUTPUT_TEX_MASK		(0x3f<<16)
+#       define R200_OUTPUT_DISCRETE_FOG		(1<<24)
+#       define R200_OUTPUT_PT_SIZE		(1<<25)
+#       define R200_FORCE_INORDER_PROC		(1<<31)
+#define R200_PP_CNTL_X				0x2cc4
+#define R200_PP_TXMULTI_CTL_0			0x2c1c
+#define R200_SE_VTX_STATE_CNTL			0x2180
+#       define R200_UPDATE_USER_COLOR_0_ENA_MASK (1<<16)
+
+
+               /* R300 3D registers */
+#define R300_MC_INIT_MISC_LAT_TIMER	0x180
+#	define R300_MC_MISC__MC_CPR_INIT_LAT_SHIFT	0
+#	define R300_MC_MISC__MC_VF_INIT_LAT_SHIFT	4
+#	define R300_MC_MISC__MC_DISP0R_INIT_LAT_SHIFT	8
+#	define R300_MC_MISC__MC_DISP1R_INIT_LAT_SHIFT	12
+#	define R300_MC_MISC__MC_FIXED_INIT_LAT_SHIFT	16
+#	define R300_MC_MISC__MC_E2R_INIT_LAT_SHIFT	20
+#	define R300_MC_MISC__MC_SAME_PAGE_PRIO_SHIFT	24
+#	define R300_MC_MISC__MC_GLOBW_INIT_LAT_SHIFT	28
+
+
+#define R300_MC_INIT_GFX_LAT_TIMER	0x154
+#	define R300_MC_MISC__MC_G3D0R_INIT_LAT_SHIFT	0
+#	define R300_MC_MISC__MC_G3D1R_INIT_LAT_SHIFT	4
+#	define R300_MC_MISC__MC_G3D2R_INIT_LAT_SHIFT	8
+#	define R300_MC_MISC__MC_G3D3R_INIT_LAT_SHIFT	12
+#	define R300_MC_MISC__MC_TX0R_INIT_LAT_SHIFT	16
+#	define R300_MC_MISC__MC_TX1R_INIT_LAT_SHIFT	20
+#	define R300_MC_MISC__MC_GLOBR_INIT_LAT_SHIFT	24
+#	define R300_MC_MISC__MC_GLOBW_FULL_LAT_SHIFT	28
+
+/*
+This file contains registers and constants for the R300. They have been
+found mostly by examining command buffers captured using glxtest, as well
+as by extrapolating some known registers and constants from the R200.
+
+I am fairly certain that they are correct unless stated otherwise in comments.
+*/
+
+#define R300_SE_VPORT_XSCALE                0x1D98
+#define R300_SE_VPORT_XOFFSET               0x1D9C
+#define R300_SE_VPORT_YSCALE                0x1DA0
+#define R300_SE_VPORT_YOFFSET               0x1DA4
+#define R300_SE_VPORT_ZSCALE                0x1DA8
+#define R300_SE_VPORT_ZOFFSET               0x1DAC
+
+/* BEGIN: Wild guesses */
+#define R300_VAP_OUTPUT_VTX_FMT_0           0x2090
+#       define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT     (1<<0)
+#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT   (1<<1)
+#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT (1<<2) /* GUESS */
+#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT (1<<3) /* GUESS */
+#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT (1<<4) /* GUESS */
+#       define R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT (1<<16) /* GUESS */
+
+#define R300_VAP_OUTPUT_VTX_FMT_1           0x2094
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT 9
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT 12
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
+#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
+/* END */
+
+#define R300_SE_VTE_CNTL                  0x20b0
+#	define     R300_VPORT_X_SCALE_ENA                0x00000001
+#	define     R300_VPORT_X_OFFSET_ENA               0x00000002
+#	define     R300_VPORT_Y_SCALE_ENA                0x00000004
+#	define     R300_VPORT_Y_OFFSET_ENA               0x00000008
+#	define     R300_VPORT_Z_SCALE_ENA                0x00000010
+#	define     R300_VPORT_Z_OFFSET_ENA               0x00000020
+#	define     R300_VTX_XY_FMT                       0x00000100
+#	define     R300_VTX_Z_FMT                        0x00000200
+#	define     R300_VTX_W0_FMT                       0x00000400
+#	define     R300_VTX_W0_NORMALIZE                 0x00000800
+#	define     R300_VTX_ST_DENORMALIZED              0x00001000
+
+/* BEGIN: Vertex data assembly - lots of uncertainties */
+/* gap */
+/* Where do we get our vertex data?
+//
+// Vertex data either comes either from immediate mode registers or from
+// vertex arrays.
+// There appears to be no mixed mode (though we can force the pitch of
+// vertex arrays to 0, effectively reusing the same element over and over
+// again).
+//
+// Immediate mode is controlled by the INPUT_CNTL registers. I am not sure
+// if these registers influence vertex array processing.
+//
+// Vertex arrays are controlled via the 3D_LOAD_VBPNTR packet3.
+//
+// In both cases, vertex attributes are then passed through INPUT_ROUTE.
+
+// Beginning with INPUT_ROUTE_0_0 is a list of WORDs that route vertex data
+// into the vertex processor's input registers.
+// The first word routes the first input, the second word the second, etc.
+// The corresponding input is routed into the register with the given index.
+// The list is ended by a word with INPUT_ROUTE_END set.
+//
+// Always set COMPONENTS_4 in immediate mode. */
+
+#define R300_VAP_INPUT_ROUTE_0_0            0x2150
+#       define R300_INPUT_ROUTE_COMPONENTS_1     (0 << 0)
+#       define R300_INPUT_ROUTE_COMPONENTS_2     (1 << 0)
+#       define R300_INPUT_ROUTE_COMPONENTS_3     (2 << 0)
+#       define R300_INPUT_ROUTE_COMPONENTS_4     (3 << 0)
+#       define R300_INPUT_ROUTE_COMPONENTS_RGBA  (4 << 0) /* GUESS */
+#       define R300_VAP_INPUT_ROUTE_IDX_SHIFT    8
+#       define R300_VAP_INPUT_ROUTE_IDX_MASK     (31 << 8) /* GUESS */
+#       define R300_VAP_INPUT_ROUTE_END          (1 << 13)
+#       define R300_INPUT_ROUTE_IMMEDIATE_MODE   (0 << 14) /* GUESS */
+#       define R300_INPUT_ROUTE_FLOAT            (1 << 14) /* GUESS */
+#       define R300_INPUT_ROUTE_UNSIGNED_BYTE    (2 << 14) /* GUESS */
+#       define R300_INPUT_ROUTE_FLOAT_COLOR      (3 << 14) /* GUESS */
+#define R300_VAP_INPUT_ROUTE_0_1            0x2154
+#define R300_VAP_INPUT_ROUTE_0_2            0x2158
+#define R300_VAP_INPUT_ROUTE_0_3            0x215C
+#define R300_VAP_INPUT_ROUTE_0_4            0x2160
+#define R300_VAP_INPUT_ROUTE_0_5            0x2164
+#define R300_VAP_INPUT_ROUTE_0_6            0x2168
+#define R300_VAP_INPUT_ROUTE_0_7            0x216C
+
+/* gap */
+/* Notes:
+//  - always set up to produce at least two attributes:
+//    if vertex program uses only position, fglrx will set normal, too
+//  - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal */
+#define R300_VAP_INPUT_CNTL_0               0x2180
+#       define R300_INPUT_CNTL_0_COLOR           0x00000001
+#define R300_VAP_INPUT_CNTL_1               0x2184
+#       define R300_INPUT_CNTL_POS               0x00000001
+#       define R300_INPUT_CNTL_NORMAL            0x00000002
+#       define R300_INPUT_CNTL_COLOR             0x00000004
+#       define R300_INPUT_CNTL_TC0               0x00000400
+#       define R300_INPUT_CNTL_TC1               0x00000800
+#       define R300_INPUT_CNTL_TC2               0x00001000 /* GUESS */
+#       define R300_INPUT_CNTL_TC3               0x00002000 /* GUESS */
+#       define R300_INPUT_CNTL_TC4               0x00004000 /* GUESS */
+#       define R300_INPUT_CNTL_TC5               0x00008000 /* GUESS */
+#       define R300_INPUT_CNTL_TC6               0x00010000 /* GUESS */
+#       define R300_INPUT_CNTL_TC7               0x00020000 /* GUESS */
+
+/* gap */
+/* Words parallel to INPUT_ROUTE_0; All words that are active in INPUT_ROUTE_0
+// are set to a swizzling bit pattern, other words are 0.
+//
+// In immediate mode, the pattern is always set to xyzw. In vertex array
+// mode, the swizzling pattern is e.g. used to set zw components in texture
+// coordinates with only tweo components. */
+#define R300_VAP_INPUT_ROUTE_1_0            0x21E0
+#       define R300_INPUT_ROUTE_SELECT_X    0
+#       define R300_INPUT_ROUTE_SELECT_Y    1
+#       define R300_INPUT_ROUTE_SELECT_Z    2
+#       define R300_INPUT_ROUTE_SELECT_W    3
+#       define R300_INPUT_ROUTE_SELECT_ZERO 4
+#       define R300_INPUT_ROUTE_SELECT_ONE  5
+#       define R300_INPUT_ROUTE_SELECT_MASK 7
+#       define R300_INPUT_ROUTE_X_SHIFT          0
+#       define R300_INPUT_ROUTE_Y_SHIFT          3
+#       define R300_INPUT_ROUTE_Z_SHIFT          6
+#       define R300_INPUT_ROUTE_W_SHIFT          9
+#       define R300_INPUT_ROUTE_ENABLE           (15 << 12)
+#define R300_VAP_INPUT_ROUTE_1_1            0x21E4
+#define R300_VAP_INPUT_ROUTE_1_2            0x21E8
+#define R300_VAP_INPUT_ROUTE_1_3            0x21EC
+#define R300_VAP_INPUT_ROUTE_1_4            0x21F0
+#define R300_VAP_INPUT_ROUTE_1_5            0x21F4
+#define R300_VAP_INPUT_ROUTE_1_6            0x21F8
+#define R300_VAP_INPUT_ROUTE_1_7            0x21FC
+
+/* END */
+
+/* gap */
+/* BEGIN: Upload vertex program and data
+// The programmable vertex shader unit has a memory bank of unknown size
+// that can be written to in 16 byte units by writing the address into
+// UPLOAD_ADDRESS, followed by data in UPLOAD_DATA (multiples of 4 DWORDs).
+//
+// Pointers into the memory bank are always in multiples of 16 bytes.
+//
+// The memory bank is divided into areas with fixed meaning.
+//
+// Starting at address UPLOAD_PROGRAM: Vertex program instructions.
+// Native limits reported by drivers from ATI suggest size 256 (i.e. 4KB),
+// whereas the difference between known addresses suggests size 512.
+//
+// Starting at address UPLOAD_PARAMETERS: Vertex program parameters.
+// Native reported limits and the VPI layout suggest size 256, whereas
+// difference between known addresses suggests size 512.
+//
+// At address UPLOAD_POINTSIZE is a vector (0, 0, ps, 0), where ps is the
+// floating point pointsize. The exact purpose of this state is uncertain,
+// as there is also the R300_RE_POINTSIZE register.
+//
+// Multiple vertex programs and parameter sets can be loaded at once,
+// which could explain the size discrepancy. */
+#define R300_VAP_PVS_UPLOAD_ADDRESS         0x2200
+#       define R300_PVS_UPLOAD_PROGRAM           0x00000000
+#       define R300_PVS_UPLOAD_PARAMETERS        0x00000200
+#       define R300_PVS_UPLOAD_POINTSIZE         0x00000406
+/* gap */
+#define R300_VAP_PVS_UPLOAD_DATA            0x2208
+/* END */
+
+/* gap */
+/* I do not know the purpose of this register. However, I do know that
+// it is set to 221C_CLEAR for clear operations and to 221C_NORMAL
+// for normal rendering. */
+#define R300_VAP_UNKNOWN_221C               0x221C
+#       define R300_221C_NORMAL                  0x00000000
+#       define R300_221C_CLEAR                   0x0001C000
+
+/* gap */
+/* Sometimes, END_OF_PKT and 0x2284=0 are the only commands sent between
+// rendering commands and overwriting vertex program parameters.
+// Therefore, I suspect writing zero to 0x2284 synchronizes the engine and
+// avoids bugs caused by still running shaders reading bad data from memory. */
+#define R300_VAP_PVS_WAITIDLE               0x2284 /* GUESS */
+
+/* Absolutely no clue what this register is about. */
+#define R300_VAP_UNKNOWN_2288               0x2288
+#       define R300_2288_R300                    0x00750000 /* -- nh */
+#       define R300_2288_RV350                   0x0000FFFF /* -- Vladimir */
+
+/* gap */
+/* Addresses are relative to the vertex program instruction area of the
+// memory bank. PROGRAM_END points to the last instruction of the active
+// program
+//
+// The meaning of the two UNKNOWN fields is obviously not known. However,
+// experiments so far have shown that both *must* point to an instruction
+// inside the vertex program, otherwise the GPU locks up.
+// fglrx usually sets CNTL_3_UNKNOWN to the end of the program and
+// CNTL_1_UNKNOWN points to instruction where last write to position takes place. 
+// Most likely this is used to ignore rest of the program in cases where group of verts arent visible.
+// For some reason this "section" is sometimes accepted other instruction that have
+// no relationship with position calculations. 
+*/
+#define R300_VAP_PVS_CNTL_1                 0x22D0
+#       define R300_PVS_CNTL_1_PROGRAM_START_SHIFT   0
+#       define R300_PVS_CNTL_1_POS_END_SHIFT         10
+#       define R300_PVS_CNTL_1_PROGRAM_END_SHIFT     20
+/* Addresses are relative the the vertex program parameters area. */
+#define R300_VAP_PVS_CNTL_2                 0x22D4
+#       define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0
+#       define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT  16
+#define R300_VAP_PVS_CNTL_3	           0x22D8
+#       define R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT 10
+#       define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0
+
+/* The entire range from 0x2300 to 0x2AC inclusive seems to be used for
+// immediate vertices */
+#define R300_VAP_VTX_COLOR_R                0x2464
+#define R300_VAP_VTX_COLOR_G                0x2468
+#define R300_VAP_VTX_COLOR_B                0x246C
+#define R300_VAP_VTX_POS_0_X_1              0x2490 /* used for glVertex2*() */
+#define R300_VAP_VTX_POS_0_Y_1              0x2494
+#define R300_VAP_VTX_COLOR_PKD              0x249C /* RGBA */
+#define R300_VAP_VTX_POS_0_X_2              0x24A0 /* used for glVertex3*() */
+#define R300_VAP_VTX_POS_0_Y_2              0x24A4
+#define R300_VAP_VTX_POS_0_Z_2              0x24A8
+#define R300_VAP_VTX_END_OF_PKT             0x24AC /* write 0 to indicate end of packet? */
+
+/* gap */
+
+/* These are values from r300_reg/r300_reg.h - they are known to be correct
+   and are here so we can use one register file instead of several
+   - Vladimir */
+#define R300_GB_VAP_RASTER_VTX_FMT_0	0x4000
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT	(1<<0)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT	(1<<1)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_1_PRESENT	(1<<2)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_2_PRESENT	(1<<3)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_3_PRESENT	(1<<4)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_SPACE	(0xf<<5)
+#	define R300_GB_VAP_RASTER_VTX_FMT_0__PT_SIZE_PRESENT	(0x1<<16)
+
+#define R300_GB_VAP_RASTER_VTX_FMT_1	0x4004
+	/* each of the following is 3 bits wide, specifies number
+	   of components */
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT	0
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT	3
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT	6
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT	9
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT	12
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT	15
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT	18
+#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT	21
+
+/* UNK30 seems to enables point to quad transformation on textures
+   (or something closely related to that).
+   This bit is rather fatal at the time being due to lackings at pixel shader side */
+#define R300_GB_ENABLE	0x4008
+#	define R300_GB_POINT_STUFF_ENABLE	(1<<0)
+#	define R300_GB_LINE_STUFF_ENABLE	(1<<1)
+#	define R300_GB_TRIANGLE_STUFF_ENABLE	(1<<2)
+#	define R300_GB_STENCIL_AUTO_ENABLE	(1<<4)
+#	define R300_GB_UNK30			(1<<30)
+	/* each of the following is 2 bits wide */
+#define R300_GB_TEX_REPLICATE	0
+#define R300_GB_TEX_ST		1
+#define R300_GB_TEX_STR		2
+#	define R300_GB_TEX0_SOURCE_SHIFT	16
+#	define R300_GB_TEX1_SOURCE_SHIFT	18
+#	define R300_GB_TEX2_SOURCE_SHIFT	20
+#	define R300_GB_TEX3_SOURCE_SHIFT	22
+#	define R300_GB_TEX4_SOURCE_SHIFT	24
+#	define R300_GB_TEX5_SOURCE_SHIFT	26
+#	define R300_GB_TEX6_SOURCE_SHIFT	28
+#	define R300_GB_TEX7_SOURCE_SHIFT	30
+
+/* MSPOS - positions for multisample antialiasing (?) */
+#define R300_GB_MSPOS0	0x4010
+	/* shifts - each of the fields is 4 bits */
+#	define R300_GB_MSPOS0__MS_X0_SHIFT	0
+#	define R300_GB_MSPOS0__MS_Y0_SHIFT	4
+#	define R300_GB_MSPOS0__MS_X1_SHIFT	8
+#	define R300_GB_MSPOS0__MS_Y1_SHIFT	12
+#	define R300_GB_MSPOS0__MS_X2_SHIFT	16
+#	define R300_GB_MSPOS0__MS_Y2_SHIFT	20
+#	define R300_GB_MSPOS0__MSBD0_Y		24
+#	define R300_GB_MSPOS0__MSBD0_X		28
+
+#define R300_GB_MSPOS1	0x4014
+#	define R300_GB_MSPOS1__MS_X3_SHIFT	0
+#	define R300_GB_MSPOS1__MS_Y3_SHIFT	4
+#	define R300_GB_MSPOS1__MS_X4_SHIFT	8
+#	define R300_GB_MSPOS1__MS_Y4_SHIFT	12
+#	define R300_GB_MSPOS1__MS_X5_SHIFT	16
+#	define R300_GB_MSPOS1__MS_Y5_SHIFT	20
+#	define R300_GB_MSPOS1__MSBD1		24
+
+
+#define R300_GB_TILE_CONFIG	0x4018
+#	define R300_GB_TILE_ENABLE	(1<<0)
+#	define R300_GB_TILE_PIPE_COUNT_RV300	0
+#	define R300_GB_TILE_PIPE_COUNT_R300	(3<<1)
+#	define R300_GB_TILE_PIPE_COUNT_R420	(7<<1)
+#	define R300_GB_TILE_SIZE_8		0
+#	define R300_GB_TILE_SIZE_16		(1<<4)
+#	define R300_GB_TILE_SIZE_32		(2<<4)
+#	define R300_GB_SUPER_SIZE_1		(0<<6)
+#	define R300_GB_SUPER_SIZE_2		(1<<6)
+#	define R300_GB_SUPER_SIZE_4		(2<<6)
+#	define R300_GB_SUPER_SIZE_8		(3<<6)
+#	define R300_GB_SUPER_SIZE_16		(4<<6)
+#	define R300_GB_SUPER_SIZE_32		(5<<6)
+#	define R300_GB_SUPER_SIZE_64		(6<<6)
+#	define R300_GB_SUPER_SIZE_128		(7<<6)
+#	define R300_GB_SUPER_X_SHIFT		9	/* 3 bits wide */
+#	define R300_GB_SUPER_Y_SHIFT		12	/* 3 bits wide */
+#	define R300_GB_SUPER_TILE_A		0
+#	define R300_GB_SUPER_TILE_B		(1<<15)
+#	define R300_GB_SUBPIXEL_1_12		0
+#	define R300_GB_SUBPIXEL_1_16		(1<<16)
+
+#define R300_GB_FIFO_SIZE	0x4024
+	/* each of the following is 2 bits wide */
+#define R300_GB_FIFO_SIZE_32	0
+#define R300_GB_FIFO_SIZE_64	1
+#define R300_GB_FIFO_SIZE_128	2
+#define R300_GB_FIFO_SIZE_256	3
+#	define R300_SC_IFIFO_SIZE_SHIFT	0
+#	define R300_SC_TZFIFO_SIZE_SHIFT	2
+#	define R300_SC_BFIFO_SIZE_SHIFT	4
+
+#	define R300_US_OFIFO_SIZE_SHIFT	12
+#	define R300_US_WFIFO_SIZE_SHIFT	14
+	/* the following use the same constants as above, but meaning is
+	   is times 2 (i.e. instead of 32 words it means 64 */
+#	define R300_RS_TFIFO_SIZE_SHIFT	6
+#	define R300_RS_CFIFO_SIZE_SHIFT	8
+#	define R300_US_RAM_SIZE_SHIFT		10
+	/* watermarks, 3 bits wide */
+#	define R300_RS_HIGHWATER_COL_SHIFT	16
+#	define R300_RS_HIGHWATER_TEX_SHIFT	19
+#	define R300_OFIFO_HIGHWATER_SHIFT	22	/* two bits only */
+#	define R300_CUBE_FIFO_HIGHWATER_COL_SHIFT	24
+
+#define R300_GB_SELECT	0x401C
+#	define R300_GB_FOG_SELECT_C0A		0
+#	define R300_GB_FOG_SELECT_C1A		1
+#	define R300_GB_FOG_SELECT_C2A		2
+#	define R300_GB_FOG_SELECT_C3A		3
+#	define R300_GB_FOG_SELECT_1_1_W	4
+#	define R300_GB_FOG_SELECT_Z		5
+#	define R300_GB_DEPTH_SELECT_Z		0
+#	define R300_GB_DEPTH_SELECT_1_1_W	(1<<3)
+#	define R300_GB_W_SELECT_1_W		0
+#	define R300_GB_W_SELECT_1		(1<<4)
+
+#define R300_GB_AA_CONFIG		0x4020
+#	define R300_AA_ENABLE			0x01
+#	define R300_AA_SUBSAMPLES_2		0
+#	define R300_AA_SUBSAMPLES_3		(1<<1)
+#	define R300_AA_SUBSAMPLES_4		(2<<1)
+#	define R300_AA_SUBSAMPLES_6		(3<<1)
+
+/* END */
+
+/* gap */
+/* Zero to flush caches. */
+#define R300_TX_CNTL                        0x4100
+
+/* The upper enable bits are guessed, based on fglrx reported limits. */
+#define R300_TX_ENABLE                      0x4104
+#       define R300_TX_ENABLE_0                  (1 << 0)
+#       define R300_TX_ENABLE_1                  (1 << 1)
+#       define R300_TX_ENABLE_2                  (1 << 2)
+#       define R300_TX_ENABLE_3                  (1 << 3)
+#       define R300_TX_ENABLE_4                  (1 << 4)
+#       define R300_TX_ENABLE_5                  (1 << 5)
+#       define R300_TX_ENABLE_6                  (1 << 6)
+#       define R300_TX_ENABLE_7                  (1 << 7)
+#       define R300_TX_ENABLE_8                  (1 << 8)
+#       define R300_TX_ENABLE_9                  (1 << 9)
+#       define R300_TX_ENABLE_10                 (1 << 10)
+#       define R300_TX_ENABLE_11                 (1 << 11)
+#       define R300_TX_ENABLE_12                 (1 << 12)
+#       define R300_TX_ENABLE_13                 (1 << 13)
+#       define R300_TX_ENABLE_14                 (1 << 14)
+#       define R300_TX_ENABLE_15                 (1 << 15)
+
+/* The pointsize is given in multiples of 6. The pointsize can be
+// enormous: Clear() renders a single point that fills the entire
+// framebuffer. */
+#define R300_RE_POINTSIZE                   0x421C
+#       define R300_POINTSIZE_Y_SHIFT            0
+#       define R300_POINTSIZE_Y_MASK             (0xFFFF << 0) /* GUESS */
+#       define R300_POINTSIZE_X_SHIFT            16
+#       define R300_POINTSIZE_X_MASK             (0xFFFF << 16) /* GUESS */
+#       define R300_POINTSIZE_MAX             (R300_POINTSIZE_Y_MASK / 6)
+
+/* The line width is given in multiples of 6.
+   In default mode lines are classified as vertical lines.
+   HO: horizontal
+   VE: vertical or horizontal
+   HO & VE: no classification
+*/
+#define R300_RE_LINE_CNT                      0x4234
+#       define R300_LINESIZE_SHIFT            0
+#       define R300_LINESIZE_MASK             (0xFFFF << 0) /* GUESS */
+#       define R300_LINESIZE_MAX             (R300_LINESIZE_MASK / 6)
+#       define R300_LINE_CNT_HO               (1 << 16)
+#       define R300_LINE_CNT_VE               (1 << 17)
+
+/* Some sort of scale or clamp value for texcoordless textures. */
+#define R300_RE_UNK4238                       0x4238
+
+#define R300_RE_SHADE_MODEL                   0x4278
+#	define R300_RE_SHADE_MODEL_SMOOTH     0x3aaaa
+#	define R300_RE_SHADE_MODEL_FLAT       0x39595
+
+/* Dangerous */
+#define R300_RE_POLYGON_MODE                  0x4288
+#	define R300_PM_ENABLED                (1 << 0)
+#	define R300_PM_FRONT_POINT            (0 << 0)
+#	define R300_PM_BACK_POINT             (0 << 0)
+#	define R300_PM_FRONT_LINE             (1 << 4)
+#	define R300_PM_FRONT_FILL             (1 << 5)
+#	define R300_PM_BACK_LINE              (1 << 7)
+#	define R300_PM_BACK_FILL              (1 << 8)
+
+/* Not sure why there are duplicate of factor and constant values. 
+   My best guess so far is that there are seperate zbiases for test and write. 
+   Ordering might be wrong.
+   Some of the tests indicate that fgl has a fallback implementation of zbias
+   via pixel shaders. */
+#define R300_RE_ZBIAS_T_FACTOR                0x42A4
+#define R300_RE_ZBIAS_T_CONSTANT              0x42A8
+#define R300_RE_ZBIAS_W_FACTOR                0x42AC
+#define R300_RE_ZBIAS_W_CONSTANT              0x42B0
+
+/* This register needs to be set to (1<<1) for RV350 to correctly
+   perform depth test (see --vb-triangles in r300_demo)
+   Don't know about other chips. - Vladimir
+   This is set to 3 when GL_POLYGON_OFFSET_FILL is on.
+   My guess is that there are two bits for each zbias primitive (FILL, LINE, POINT).
+   One to enable depth test and one for depth write.
+   Yet this doesnt explain why depth writes work ...
+    */
+#define R300_RE_OCCLUSION_CNTL		    0x42B4
+#	define R300_OCCLUSION_ON		(1<<1)
+
+#define R300_RE_CULL_CNTL                   0x42B8
+#       define R300_CULL_FRONT                   (1 << 0)
+#       define R300_CULL_BACK                    (1 << 1)
+#       define R300_FRONT_FACE_CCW               (0 << 2)
+#       define R300_FRONT_FACE_CW                (1 << 2)
+
+
+/* BEGIN: Rasterization / Interpolators - many guesses
+// 0_UNKNOWN_18 has always been set except for clear operations.
+// TC_CNT is the number of incoming texture coordinate sets (i.e. it depends
+// on the vertex program, *not* the fragment program) */
+#define R300_RS_CNTL_0                      0x4300
+#       define R300_RS_CNTL_TC_CNT_SHIFT         2
+#       define R300_RS_CNTL_TC_CNT_MASK          (7 << 2)
+#       define R300_RS_CNTL_CI_CNT_SHIFT         7 /* number of color interpolators used */
+#       define R300_RS_CNTL_0_UNKNOWN_18         (1 << 18)
+/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n register. */
+#define R300_RS_CNTL_1                      0x4304
+
+/* gap */
+/* Only used for texture coordinates.
+// Use the source field to route texture coordinate input from the vertex program
+// to the desired interpolator. Note that the source field is relative to the
+// outputs the vertex program *actually* writes. If a vertex program only writes
+// texcoord[1], this will be source index 0.
+// Set INTERP_USED on all interpolators that produce data used by the
+// fragment program. INTERP_USED looks like a swizzling mask, but
+// I haven't seen it used that way.
+//
+// Note: The _UNKNOWN constants are always set in their respective register.
+// I don't know if this is necessary. */
+#define R300_RS_INTERP_0                    0x4310
+#define R300_RS_INTERP_1                    0x4314
+#       define R300_RS_INTERP_1_UNKNOWN          0x40
+#define R300_RS_INTERP_2                    0x4318
+#       define R300_RS_INTERP_2_UNKNOWN          0x80
+#define R300_RS_INTERP_3                    0x431C
+#       define R300_RS_INTERP_3_UNKNOWN          0xC0
+#define R300_RS_INTERP_4                    0x4320
+#define R300_RS_INTERP_5                    0x4324
+#define R300_RS_INTERP_6                    0x4328
+#define R300_RS_INTERP_7                    0x432C
+#       define R300_RS_INTERP_SRC_SHIFT          2
+#       define R300_RS_INTERP_SRC_MASK           (7 << 2)
+#       define R300_RS_INTERP_USED               0x00D10000
+
+/* These DWORDs control how vertex data is routed into fragment program
+// registers, after interpolators. */
+#define R300_RS_ROUTE_0                     0x4330
+#define R300_RS_ROUTE_1                     0x4334
+#define R300_RS_ROUTE_2                     0x4338
+#define R300_RS_ROUTE_3                     0x433C /* GUESS */
+#define R300_RS_ROUTE_4                     0x4340 /* GUESS */
+#define R300_RS_ROUTE_5                     0x4344 /* GUESS */
+#define R300_RS_ROUTE_6                     0x4348 /* GUESS */
+#define R300_RS_ROUTE_7                     0x434C /* GUESS */
+#       define R300_RS_ROUTE_SOURCE_INTERP_0     0
+#       define R300_RS_ROUTE_SOURCE_INTERP_1     1
+#       define R300_RS_ROUTE_SOURCE_INTERP_2     2
+#       define R300_RS_ROUTE_SOURCE_INTERP_3     3
+#       define R300_RS_ROUTE_SOURCE_INTERP_4     4
+#       define R300_RS_ROUTE_SOURCE_INTERP_5     5 /* GUESS */
+#       define R300_RS_ROUTE_SOURCE_INTERP_6     6 /* GUESS */
+#       define R300_RS_ROUTE_SOURCE_INTERP_7     7 /* GUESS */
+#       define R300_RS_ROUTE_ENABLE              (1 << 3) /* GUESS */
+#       define R300_RS_ROUTE_DEST_SHIFT          6
+#       define R300_RS_ROUTE_DEST_MASK           (31 << 6) /* GUESS */
+
+/* Special handling for color: When the fragment program uses color,
+// the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the
+// color register index. */
+#       define R300_RS_ROUTE_0_COLOR             (1 << 14)
+#       define R300_RS_ROUTE_0_COLOR_DEST_SHIFT  17
+#       define R300_RS_ROUTE_0_COLOR_DEST_MASK   (31 << 17) /* GUESS */
+/* As above, but for secondary color */
+#       define R300_RS_ROUTE_1_COLOR1            (1 << 14)
+#       define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17
+#       define R300_RS_ROUTE_1_COLOR1_DEST_MASK  (31 << 17)
+#       define R300_RS_ROUTE_1_UNKNOWN11         (1 << 11)
+/* END */
+
+/* BEGIN: Scissors and cliprects
+// There are four clipping rectangles. Their corner coordinates are inclusive.
+// Every pixel is assigned a number from 0 and 15 by setting bits 0-3 depending
+// on whether the pixel is inside cliprects 0-3, respectively. For example,
+// if a pixel is inside cliprects 0 and 1, but outside 2 and 3, it is assigned
+// the number 3 (binary 0011).
+// Iff the bit corresponding to the pixel's number in RE_CLIPRECT_CNTL is set,
+// the pixel is rasterized.
+//
+// In addition to this, there is a scissors rectangle. Only pixels inside the
+// scissors rectangle are drawn. (coordinates are inclusive)
+//
+// For some reason, the top-left corner of the framebuffer is at (1440, 1440)
+// for the purpose of clipping and scissors. */
+#define R300_RE_CLIPRECT_TL_0               0x43B0
+#define R300_RE_CLIPRECT_BR_0               0x43B4
+#define R300_RE_CLIPRECT_TL_1               0x43B8
+#define R300_RE_CLIPRECT_BR_1               0x43BC
+#define R300_RE_CLIPRECT_TL_2               0x43C0
+#define R300_RE_CLIPRECT_BR_2               0x43C4
+#define R300_RE_CLIPRECT_TL_3               0x43C8
+#define R300_RE_CLIPRECT_BR_3               0x43CC
+#       define R300_CLIPRECT_OFFSET              1440
+#       define R300_CLIPRECT_MASK                0x1FFF
+#       define R300_CLIPRECT_X_SHIFT             0
+#       define R300_CLIPRECT_X_MASK              (0x1FFF << 0)
+#       define R300_CLIPRECT_Y_SHIFT             13
+#       define R300_CLIPRECT_Y_MASK              (0x1FFF << 13)
+#define R300_RE_CLIPRECT_CNTL               0x43D0
+#       define R300_CLIP_OUT                     (1 << 0)
+#       define R300_CLIP_0                       (1 << 1)
+#       define R300_CLIP_1                       (1 << 2)
+#       define R300_CLIP_10                      (1 << 3)
+#       define R300_CLIP_2                       (1 << 4)
+#       define R300_CLIP_20                      (1 << 5)
+#       define R300_CLIP_21                      (1 << 6)
+#       define R300_CLIP_210                     (1 << 7)
+#       define R300_CLIP_3                       (1 << 8)
+#       define R300_CLIP_30                      (1 << 9)
+#       define R300_CLIP_31                      (1 << 10)
+#       define R300_CLIP_310                     (1 << 11)
+#       define R300_CLIP_32                      (1 << 12)
+#       define R300_CLIP_320                     (1 << 13)
+#       define R300_CLIP_321                     (1 << 14)
+#       define R300_CLIP_3210                    (1 << 15)
+
+/* gap */
+#define R300_RE_SCISSORS_TL                 0x43E0
+#define R300_RE_SCISSORS_BR                 0x43E4
+#       define R300_SCISSORS_OFFSET              1440
+#       define R300_SCISSORS_X_SHIFT             0
+#       define R300_SCISSORS_X_MASK              (0x1FFF << 0)
+#       define R300_SCISSORS_Y_SHIFT             13
+#       define R300_SCISSORS_Y_MASK              (0x1FFF << 13)
+/* END */
+
+/* BEGIN: Texture specification
+// The texture specification dwords are grouped by meaning and not by texture unit.
+// This means that e.g. the offset for texture image unit N is found in register
+// TX_OFFSET_0 + (4*N) */
+#define R300_TX_FILTER_0                    0x4400
+#define R300_TX_FILTER_1                    0x4404
+#       define R300_TX_REPEAT                    0
+#       define R300_TX_MIRRORED                  1
+#       define R300_TX_CLAMP                     4
+#       define R300_TX_CLAMP_TO_EDGE             2
+#       define R300_TX_CLAMP_TO_BORDER           6
+#       define R300_TX_WRAP_S_SHIFT              0
+#       define R300_TX_WRAP_S_MASK               (7 << 0)
+#       define R300_TX_WRAP_T_SHIFT              3
+#       define R300_TX_WRAP_T_MASK               (7 << 3)
+#       define R300_TX_WRAP_Q_SHIFT              6
+#       define R300_TX_WRAP_Q_MASK               (7 << 6)
+#       define R300_TX_MAG_FILTER_NEAREST        (1 << 9)
+#       define R300_TX_MAG_FILTER_LINEAR         (2 << 9)
+#       define R300_TX_MAG_FILTER_MASK           (3 << 9)
+#       define R300_TX_MIN_FILTER_NEAREST        (1 << 11)
+#       define R300_TX_MIN_FILTER_LINEAR         (2 << 11)
+#       define R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST       (5  <<  11)
+#       define R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR        (9  <<  11)
+#       define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST        (6  <<  11)
+#       define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR         (10 <<  11)
+/* NOTE: NEAREST doesnt seem to exist.
+   Im not seting MAG_FILTER_MASK and (3 << 11) on for all
+   anisotropy modes because that would void selected mag filter */
+#       define R300_TX_MIN_FILTER_ANISO_NEAREST             ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
+#       define R300_TX_MIN_FILTER_ANISO_LINEAR              ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
+#       define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST ((1 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
+#       define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR  ((2 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
+#       define R300_TX_MIN_FILTER_MASK           ( (15 << 11) | (3 << 13) )
+#       define R300_TX_MAX_ANISO_1_TO_1  (0 << 21)
+#       define R300_TX_MAX_ANISO_2_TO_1  (2 << 21)
+#       define R300_TX_MAX_ANISO_4_TO_1  (4 << 21)
+#       define R300_TX_MAX_ANISO_8_TO_1  (6 << 21)
+#       define R300_TX_MAX_ANISO_16_TO_1 (8 << 21)
+#       define R300_TX_MAX_ANISO_MASK    (14 << 21)
+
+#define R300_TX_FILTER1_0                      0x4440
+#define R300_TX_FILTER1_1                      0x4444
+#	define R300_CHROMA_KEY_MODE_DISABLE    0
+#	define R300_CHROMA_KEY_FORCE	       1
+#	define R300_CHROMA_KEY_BLEND           2
+#	define R300_MC_ROUND_NORMAL            (0<<2)
+#	define R300_MC_ROUND_MPEG4             (1<<2)
+#	define R300_LOD_BIAS_MASK	    0x1fff
+#	define R300_EDGE_ANISO_EDGE_DIAG       (0<<13)
+#	define R300_EDGE_ANISO_EDGE_ONLY       (1<<13)
+#	define R300_MC_COORD_TRUNCATE_DISABLE  (0<<14)
+#	define R300_MC_COORD_TRUNCATE_MPEG     (1<<14)
+#	define R300_TX_TRI_PERF_0_8            (0<<15)
+#	define R300_TX_TRI_PERF_1_8            (1<<15)
+#	define R300_TX_TRI_PERF_1_4            (2<<15)
+#	define R300_TX_TRI_PERF_3_8            (3<<15)
+#	define R300_ANISO_THRESHOLD_MASK       (7<<17)
+
+#define R300_TX_SIZE_0                      0x4480
+#define R300_TX_SIZE_1                      0x4484
+#       define R300_TX_WIDTH_SHIFT               0
+#       define R300_TX_WIDTH_MASK               (2047 << 0)
+#       define R300_TX_HEIGHT_SHIFT              11
+#       define R300_TX_HEIGHT_MASK               (2047 << 11)
+#       define R300_TX_UNK23                     (1 << 23)
+#       define R300_TX_SIZE_SHIFT                26 /* largest of width, height */
+#       define R300_TX_SIZE_MASK                 (15 << 26)
+#       define R300_TX_SIZE_PROJECTED            (1<<30)
+#       define R300_TX_SIZE_TXPITCH_EN           (1<<31)
+
+#define R300_TX_FORMAT_0                    0x44C0
+#define R300_TX_FORMAT_1                    0x44C4
+	/* The interpretation of the format word by Wladimir van der Laan */
+	/* The X, Y, Z and W refer to the layout of the components.
+	   They are given meanings as R, G, B and Alpha by the swizzle
+	   specification */
+#	define R300_TX_FORMAT_X8		    0x0
+#	define R300_TX_FORMAT_X16		    0x1
+#	define R300_TX_FORMAT_Y4X4		    0x2
+#	define R300_TX_FORMAT_Y8X8		    0x3
+#	define R300_TX_FORMAT_Y16X16		    0x4
+#	define R300_TX_FORMAT_Z3Y3X2		    0x5
+#	define R300_TX_FORMAT_Z5Y6X5		    0x6
+#	define R300_TX_FORMAT_Z6Y5X5		    0x7
+#	define R300_TX_FORMAT_Z11Y11X10		    0x8
+#	define R300_TX_FORMAT_Z10Y11X11		    0x9
+#	define R300_TX_FORMAT_W4Z4Y4X4		    0xA
+#	define R300_TX_FORMAT_W1Z5Y5X5		    0xB
+#	define R300_TX_FORMAT_W8Z8Y8X8		    0xC
+#	define R300_TX_FORMAT_W2Z10Y10X10	    0xD
+#	define R300_TX_FORMAT_W16Z16Y16X16	    0xE
+#	define R300_TX_FORMAT_DXT1	    	    0xF
+#	define R300_TX_FORMAT_DXT3	    	    0x10
+#	define R300_TX_FORMAT_DXT5	    	    0x11
+#	define R300_TX_FORMAT_D3DMFT_CxV8U8	    0x12     /* no swizzle */
+#	define R300_TX_FORMAT_A8R8G8B8	    	    0x13     /* no swizzle */
+#	define R300_TX_FORMAT_B8G8_B8G8	    	    0x14     /* no swizzle */
+#	define R300_TX_FORMAT_G8R8_G8B8	    	    0x15     /* no swizzle */
+						  /* 0x16 - some 16 bit green format.. ?? */
+#	define R300_TX_FORMAT_UNK25		   (1 << 25) /* no swizzle */
+#	define R300_TX_FORMAT_CUBIC_MAP		   (1 << 26)
+	/* gap */
+	/* Floating point formats */
+	/* Note - hardware supports both 16 and 32 bit floating point */
+#	define R300_TX_FORMAT_FL_I16	    	    0x18
+#	define R300_TX_FORMAT_FL_I16A16	    	    0x19
+#	define R300_TX_FORMAT_FL_R16G16B16A16	    0x1A
+#	define R300_TX_FORMAT_FL_I32	    	    0x1B
+#	define R300_TX_FORMAT_FL_I32A32	    	    0x1C
+#	define R300_TX_FORMAT_FL_R32G32B32A32	    0x1D
+	/* alpha modes, convenience mostly */
+	/* if you have alpha, pick constant appropriate to the
+	   number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */
+# 	define R300_TX_FORMAT_ALPHA_1CH		    0x000
+# 	define R300_TX_FORMAT_ALPHA_2CH		    0x200
+# 	define R300_TX_FORMAT_ALPHA_4CH		    0x600
+# 	define R300_TX_FORMAT_ALPHA_NONE	    0xA00
+	/* Swizzling */
+	/* constants */
+#	define R300_TX_FORMAT_X		0
+#	define R300_TX_FORMAT_Y		1
+#	define R300_TX_FORMAT_Z		2
+#	define R300_TX_FORMAT_W		3
+#	define R300_TX_FORMAT_ZERO	4
+#	define R300_TX_FORMAT_ONE	5
+#	define R300_TX_FORMAT_CUT_Z	6		/* 2.0*Z, everything above 1.0 is set to 0.0 */
+#	define R300_TX_FORMAT_CUT_W	7		/* 2.0*W, everything above 1.0 is set to 0.0 */
+#	define R300_TX_FORMAT_B_SHIFT	18
+#	define R300_TX_FORMAT_G_SHIFT	15
+#	define R300_TX_FORMAT_R_SHIFT	12
+#	define R300_TX_FORMAT_A_SHIFT	9
+	/* Convenience macro to take care of layout and swizzling */
+#	define R300_EASY_TXFORMAT(B, G, R, A, FMT)	(\
+	  ((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT) \
+	| ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT) \
+	| ((R300_TX_FORMAT_##R)<<R300_TX_FORMAT_R_SHIFT) \
+	| ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT) \
+	| (R300_TX_FORMAT_##FMT) \
+	  )
+	/* These can be ORed with result of R300_EASY_TX_FORMAT() */
+	/* We don't really know what they do. Take values from a constant color ? */
+#	define R300_TX_FORMAT_CONST_X		(1<<5)
+#	define R300_TX_FORMAT_CONST_Y		(2<<5)
+#	define R300_TX_FORMAT_CONST_Z		(4<<5)
+#	define R300_TX_FORMAT_CONST_W		(8<<5)
+#	define R300_TX_FORMAT_YUV_MODE     0x00800000
+     /* Precalculated formats */
+#    define R300_TXFORMAT_ARGB8888     R300_EASY_TXFORMAT(X, Y, Z, W, W8Z8Y8X8)
+#    define R300_TXFORMAT_XRGB8888     R300_EASY_TXFORMAT(X, Y, Z, ONE, W8Z8Y8X8)
+#    define R300_TXFORMAT_RGB565       R300_EASY_TXFORMAT(X, Y, Z, ONE, Z5Y6X5)
+#    define R300_TXFORMAT_ARGB4444     R300_EASY_TXFORMAT(X, Y, Z, W, W4Z4Y4X4)
+#    define R300_TXFORMAT_ARGB1555     R300_EASY_TXFORMAT(X, Y, Z, W, W1Z5Y5X5)
+#    define R300_TXFORMAT_RGB444       R300_EASY_TXFORMAT(X, Y, Z, ONE, W4Z4Y4X4)
+#    define R300_TXFORMAT_RGB555       R300_EASY_TXFORMAT(X, Y, Z, ONE, W1Z5Y5X5)
+#    define R300_TXFORMAT_RGB332       R300_EASY_TXFORMAT(X, Y, Z, ONE, Z3Y3X2)
+#    define R300_TXFORMAT_A8           R300_EASY_TXFORMAT(ONE, ONE, ONE, X, X8)
+#    define R300_TXFORMAT_I8           R300_EASY_TXFORMAT(X, X, X, X, X8)
+#    define R300_TXFORMAT_VYUY422      R300_EASY_TXFORMAT(X, Y, Z, ONE, G8R8_G8B8)|R300_TX_FORMAT_YUV_MODE
+#    define R300_TXFORMAT_YVYU422      R300_EASY_TXFORMAT(X, Y, Z, ONE, B8G8_B8G8)|R300_TX_FORMAT_YUV_MODE
+
+
+#define R300_TX_PITCH_0			    0x4500 /* obvious missing in gap */
+#define R300_TX_PITCH_1                0x4504
+
+#define R300_TX_OFFSET_0               0x4540
+#define R300_TX_OFFSET_1               0x4544
+/* BEGIN: Guess from R200 */
+#       define R300_TXO_ENDIAN_NO_SWAP           (0 << 0)
+#       define R300_TXO_ENDIAN_BYTE_SWAP         (1 << 0)
+#       define R300_TXO_ENDIAN_WORD_SWAP         (2 << 0)
+#       define R300_TXO_ENDIAN_HALFDW_SWAP       (3 << 0)
+#       define R300_TXO_MACRO_TILE               (1 << 2)
+#       define R300_TXO_MICRO_TILE               (1 << 3)
+#       define R300_TXO_OFFSET_MASK              0xffffffe0
+/* END */
+
+#define R300_TX_CHROMA_KEY_0                0x4580 /* pixel value */
+
+#define R300_TX_BORDER_COLOR_0              0x45C0 //ff00ff00 == { 0, 1.0, 0, 1.0 }
+
+/* END */
+
+/* BEGIN: Fragment program instruction set
+// Fragment programs are written directly into register space.
+// There are separate instruction streams for texture instructions and ALU
+// instructions.
+// In order to synchronize these streams, the program is divided into up
+// to 4 nodes. Each node begins with a number of TEX operations, followed
+// by a number of ALU operations.
+// The first node can have zero TEX ops, all subsequent nodes must have at least
+// one TEX ops.
+// All nodes must have at least one ALU op.
+//
+// The index of the last node is stored in PFS_CNTL_0: A value of 0 means
+// 1 node, a value of 3 means 4 nodes.
+// The total amount of instructions is defined in PFS_CNTL_2. The offsets are
+// offsets into the respective instruction streams, while *_END points to the
+// last instruction relative to this offset. */
+#define R300_PFS_CNTL_0                     0x4600
+#       define R300_PFS_CNTL_LAST_NODES_SHIFT    0
+#       define R300_PFS_CNTL_LAST_NODES_MASK     (3 << 0)
+#       define R300_PFS_CNTL_FIRST_NODE_HAS_TEX  (1 << 3)
+#define R300_PFS_CNTL_1                     0x4604
+/* There is an unshifted value here which has so far always been equal to the
+// index of the highest used temporary register. */
+#define R300_PFS_CNTL_2                     0x4608
+#       define R300_PFS_CNTL_ALU_OFFSET_SHIFT    0
+#       define R300_PFS_CNTL_ALU_OFFSET_MASK     (63 << 0)
+#       define R300_PFS_CNTL_ALU_END_SHIFT       6
+#       define R300_PFS_CNTL_ALU_END_MASK        (63 << 0)
+#       define R300_PFS_CNTL_TEX_OFFSET_SHIFT    12
+#       define R300_PFS_CNTL_TEX_OFFSET_MASK     (31 << 12) /* GUESS */
+#       define R300_PFS_CNTL_TEX_END_SHIFT       18
+#       define R300_PFS_CNTL_TEX_END_MASK        (31 << 18) /* GUESS */
+
+/* gap */
+/* Nodes are stored backwards. The last active node is always stored in
+// PFS_NODE_3.
+// Example: In a 2-node program, NODE_0 and NODE_1 are set to 0. The
+// first node is stored in NODE_2, the second node is stored in NODE_3.
+//
+// Offsets are relative to the master offset from PFS_CNTL_2.
+// LAST_NODE is set for the last node, and only for the last node. */
+#define R300_PFS_NODE_0                     0x4610
+#define R300_PFS_NODE_1                     0x4614
+#define R300_PFS_NODE_2                     0x4618
+#define R300_PFS_NODE_3                     0x461C
+#       define R300_PFS_NODE_ALU_OFFSET_SHIFT    0
+#       define R300_PFS_NODE_ALU_OFFSET_MASK     (63 << 0)
+#       define R300_PFS_NODE_ALU_END_SHIFT       6
+#       define R300_PFS_NODE_ALU_END_MASK        (63 << 6)
+#       define R300_PFS_NODE_TEX_OFFSET_SHIFT    12
+#       define R300_PFS_NODE_TEX_OFFSET_MASK     (31 << 12)
+#       define R300_PFS_NODE_TEX_END_SHIFT       17
+#       define R300_PFS_NODE_TEX_END_MASK        (31 << 17)
+/*#       define R300_PFS_NODE_LAST_NODE           (1 << 22) */
+#		define R300_PFS_NODE_OUTPUT_COLOR        (1 << 22)
+#		define R300_PFS_NODE_OUTPUT_DEPTH        (1 << 23)
+
+/* TEX
+// As far as I can tell, texture instructions cannot write into output
+// registers directly. A subsequent ALU instruction is always necessary,
+// even if it's just MAD o0, r0, 1, 0 */
+#define R300_PFS_TEXI_0                     0x4620
+#define R300_PFS_TEXI_1                     0x4624
+#       define R300_FPITX_SRC_SHIFT              0
+#       define R300_FPITX_SRC_MASK               (31 << 0)
+#       define R300_FPITX_SRC_CONST              (1 << 5) /* GUESS */
+#       define R300_FPITX_DST_SHIFT              6
+#       define R300_FPITX_DST_MASK               (31 << 6)
+#       define R300_FPITX_IMAGE_SHIFT            11
+#       define R300_FPITX_IMAGE_MASK             (15 << 11) /* GUESS based on layout and native limits */
+/* Unsure if these are opcodes, or some kind of bitfield, but this is how
+ * they were set when I checked
+ */
+#       define R300_FPITX_OPCODE_SHIFT           15
+#       define R300_FPITX_OP_TEX                 (1 << 15)
+#       define R300_FPITX_OP_KIL                 (2 << 15)
+#       define R300_FPITX_OP_TXP                 (3 << 15)
+#       define R300_FPITX_OP_TXB                 (4 << 15)
+
+/* ALU
+// The ALU instructions register blocks are enumerated according to the order
+// in which fglrx. I assume there is space for 64 instructions, since
+// each block has space for a maximum of 64 DWORDs, and this matches reported
+// native limits.
+//
+// The basic functional block seems to be one MAD for each color and alpha,
+// and an adder that adds all components after the MUL.
+//  - ADD, MUL, MAD etc.: use MAD with appropriate neutral operands
+//  - DP4: Use OUTC_DP4, OUTA_DP4
+//  - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands
+//  - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands
+//  - CMP: If ARG2 < 0, return ARG1, else return ARG0
+//  - FLR: use FRC+MAD
+//  - XPD: use MAD+MAD
+//  - SGE, SLT: use MAD+CMP
+//  - RSQ: use ABS modifier for argument
+//  - Use OUTC_REPL_ALPHA to write results of an alpha-only operation (e.g. RCP)
+//    into color register
+//  - apparently, there's no quick DST operation
+//  - fglrx set FPI2_UNKNOWN_31 on a "MAD fragment.color, tmp0, tmp1, tmp2"
+//  - fglrx set FPI2_UNKNOWN_31 on a "MAX r2, r1, c0"
+//  - fglrx once set FPI0_UNKNOWN_31 on a "FRC r1, r1"
+//
+// Operand selection
+// First stage selects three sources from the available registers and
+// constant parameters. This is defined in INSTR1 (color) and INSTR3 (alpha).
+// fglrx sorts the three source fields: Registers before constants,
+// lower indices before higher indices; I do not know whether this is necessary.
+// fglrx fills unused sources with "read constant 0"
+// According to specs, you cannot select more than two different constants.
+//
+// Second stage selects the operands from the sources. This is defined in
+// INSTR0 (color) and INSTR2 (alpha). You can also select the special constants
+// zero and one.
+// Swizzling and negation happens in this stage, as well.
+//
+// Important: Color and alpha seem to be mostly separate, i.e. their sources
+// selection appears to be fully independent (the register storage is probably
+// physically split into a color and an alpha section).
+// However (because of the apparent physical split), there is some interaction
+// WRT swizzling. If, for example, you want to load an R component into an
+// Alpha operand, this R component is taken from a *color* source, not from
+// an alpha source. The corresponding register doesn't even have to appear in
+// the alpha sources list. (I hope this alll makes sense to you)
+//
+// Destination selection
+// The destination register index is in FPI1 (color) and FPI3 (alpha) together
+// with enable bits.
+// There are separate enable bits for writing into temporary registers
+// (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_* /DSTA_OUTPUT).
+// You can write to both at once, or not write at all (the same index
+// must be used for both).
+//
+// Note: There is a special form for LRP
+//  - Argument order is the same as in ARB_fragment_program.
+//  - Operation is MAD
+//  - ARG1 is set to ARGC_SRC1C_LRP/ARGC_SRC1A_LRP
+//  - Set FPI0/FPI2_SPECIAL_LRP
+// Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD */
+#define R300_PFS_INSTR1_0                   0x46C0
+#       define R300_FPI1_SRC0C_SHIFT             0
+#       define R300_FPI1_SRC0C_MASK              (31 << 0)
+#       define R300_FPI1_SRC0C_CONST             (1 << 5)
+#       define R300_FPI1_SRC1C_SHIFT             6
+#       define R300_FPI1_SRC1C_MASK              (31 << 6)
+#       define R300_FPI1_SRC1C_CONST             (1 << 11)
+#       define R300_FPI1_SRC2C_SHIFT             12
+#       define R300_FPI1_SRC2C_MASK              (31 << 12)
+#       define R300_FPI1_SRC2C_CONST             (1 << 17)
+#       define R300_FPI1_DSTC_SHIFT              18
+#       define R300_FPI1_DSTC_MASK               (31 << 18)
+#       define R300_FPI1_DSTC_REG_MASK_SHIFT     23
+#       define R300_FPI1_DSTC_REG_X              (1 << 23)
+#       define R300_FPI1_DSTC_REG_Y              (1 << 24)
+#       define R300_FPI1_DSTC_REG_Z              (1 << 25)
+#       define R300_FPI1_DSTC_OUTPUT_MASK_SHIFT  26
+#       define R300_FPI1_DSTC_OUTPUT_X           (1 << 26)
+#       define R300_FPI1_DSTC_OUTPUT_Y           (1 << 27)
+#       define R300_FPI1_DSTC_OUTPUT_Z           (1 << 28)
+
+#define R300_PFS_INSTR3_0                   0x47C0
+#       define R300_FPI3_SRC0A_SHIFT             0
+#       define R300_FPI3_SRC0A_MASK              (31 << 0)
+#       define R300_FPI3_SRC0A_CONST             (1 << 5)
+#       define R300_FPI3_SRC1A_SHIFT             6
+#       define R300_FPI3_SRC1A_MASK              (31 << 6)
+#       define R300_FPI3_SRC1A_CONST             (1 << 11)
+#       define R300_FPI3_SRC2A_SHIFT             12
+#       define R300_FPI3_SRC2A_MASK              (31 << 12)
+#       define R300_FPI3_SRC2A_CONST             (1 << 17)
+#       define R300_FPI3_DSTA_SHIFT              18
+#       define R300_FPI3_DSTA_MASK               (31 << 18)
+#       define R300_FPI3_DSTA_REG                (1 << 23)
+#       define R300_FPI3_DSTA_OUTPUT             (1 << 24)
+#       define R300_FPI3_DSTA_DEPTH              (1 << 27)
+
+#define R300_PFS_INSTR0_0                   0x48C0
+#       define R300_FPI0_ARGC_SRC0C_XYZ          0
+#       define R300_FPI0_ARGC_SRC0C_XXX          1
+#       define R300_FPI0_ARGC_SRC0C_YYY          2
+#       define R300_FPI0_ARGC_SRC0C_ZZZ          3
+#       define R300_FPI0_ARGC_SRC1C_XYZ          4
+#       define R300_FPI0_ARGC_SRC1C_XXX          5
+#       define R300_FPI0_ARGC_SRC1C_YYY          6
+#       define R300_FPI0_ARGC_SRC1C_ZZZ          7
+#       define R300_FPI0_ARGC_SRC2C_XYZ          8
+#       define R300_FPI0_ARGC_SRC2C_XXX          9
+#       define R300_FPI0_ARGC_SRC2C_YYY          10
+#       define R300_FPI0_ARGC_SRC2C_ZZZ          11
+#       define R300_FPI0_ARGC_SRC0A              12
+#       define R300_FPI0_ARGC_SRC1A              13
+#       define R300_FPI0_ARGC_SRC2A              14
+#       define R300_FPI0_ARGC_SRC1C_LRP          15
+#       define R300_FPI0_ARGC_ZERO               20
+#       define R300_FPI0_ARGC_ONE                21
+#       define R300_FPI0_ARGC_HALF               22 /* GUESS */
+#       define R300_FPI0_ARGC_SRC0C_YZX          23
+#       define R300_FPI0_ARGC_SRC1C_YZX          24
+#       define R300_FPI0_ARGC_SRC2C_YZX          25
+#       define R300_FPI0_ARGC_SRC0C_ZXY          26
+#       define R300_FPI0_ARGC_SRC1C_ZXY          27
+#       define R300_FPI0_ARGC_SRC2C_ZXY          28
+#       define R300_FPI0_ARGC_SRC0CA_WZY         29
+#       define R300_FPI0_ARGC_SRC1CA_WZY         30
+#       define R300_FPI0_ARGC_SRC2CA_WZY         31
+
+#       define R300_FPI0_ARG0C_SHIFT             0
+#       define R300_FPI0_ARG0C_MASK              (31 << 0)
+#       define R300_FPI0_ARG0C_NEG               (1 << 5)
+#       define R300_FPI0_ARG0C_ABS               (1 << 6)
+#       define R300_FPI0_ARG1C_SHIFT             7
+#       define R300_FPI0_ARG1C_MASK              (31 << 7)
+#       define R300_FPI0_ARG1C_NEG               (1 << 12)
+#       define R300_FPI0_ARG1C_ABS               (1 << 13)
+#       define R300_FPI0_ARG2C_SHIFT             14
+#       define R300_FPI0_ARG2C_MASK              (31 << 14)
+#       define R300_FPI0_ARG2C_NEG               (1 << 19)
+#       define R300_FPI0_ARG2C_ABS               (1 << 20)
+#       define R300_FPI0_SPECIAL_LRP             (1 << 21)
+#       define R300_FPI0_OUTC_MAD                (0 << 23)
+#       define R300_FPI0_OUTC_DP3                (1 << 23)
+#       define R300_FPI0_OUTC_DP4                (2 << 23)
+#       define R300_FPI0_OUTC_MIN                (4 << 23)
+#       define R300_FPI0_OUTC_MAX                (5 << 23)
+#       define R300_FPI0_OUTC_CMP                (8 << 23)
+#       define R300_FPI0_OUTC_FRC                (9 << 23)
+#       define R300_FPI0_OUTC_REPL_ALPHA         (10 << 23)
+#       define R300_FPI0_OUTC_SAT                (1 << 30)
+#       define R300_FPI0_INSERT_NOP              (1 << 31)
+
+#define R300_PFS_INSTR2_0                   0x49C0
+#       define R300_FPI2_ARGA_SRC0C_X            0
+#       define R300_FPI2_ARGA_SRC0C_Y            1
+#       define R300_FPI2_ARGA_SRC0C_Z            2
+#       define R300_FPI2_ARGA_SRC1C_X            3
+#       define R300_FPI2_ARGA_SRC1C_Y            4
+#       define R300_FPI2_ARGA_SRC1C_Z            5
+#       define R300_FPI2_ARGA_SRC2C_X            6
+#       define R300_FPI2_ARGA_SRC2C_Y            7
+#       define R300_FPI2_ARGA_SRC2C_Z            8
+#       define R300_FPI2_ARGA_SRC0A              9
+#       define R300_FPI2_ARGA_SRC1A              10
+#       define R300_FPI2_ARGA_SRC2A              11
+#       define R300_FPI2_ARGA_SRC1A_LRP          15
+#       define R300_FPI2_ARGA_ZERO               16
+#       define R300_FPI2_ARGA_ONE                17
+#       define R300_FPI2_ARGA_HALF               18 /* GUESS */
+
+#       define R300_FPI2_ARG0A_SHIFT             0
+#       define R300_FPI2_ARG0A_MASK              (31 << 0)
+#       define R300_FPI2_ARG0A_NEG               (1 << 5)
+#       define R300_FPI2_ARG0A_ABS               (1 << 6) /* GUESS */
+#       define R300_FPI2_ARG1A_SHIFT             7
+#       define R300_FPI2_ARG1A_MASK              (31 << 7)
+#       define R300_FPI2_ARG1A_NEG               (1 << 12)
+#       define R300_FPI2_ARG1A_ABS	              (1 << 13) /* GUESS */
+#       define R300_FPI2_ARG2A_SHIFT             14
+#       define R300_FPI2_ARG2A_MASK              (31 << 14)
+#       define R300_FPI2_ARG2A_NEG               (1 << 19)
+#       define R300_FPI2_ARG2A_ABS               (1 << 20) /* GUESS */
+#       define R300_FPI2_SPECIAL_LRP             (1 << 21)
+#       define R300_FPI2_OUTA_MAD                (0 << 23)
+#       define R300_FPI2_OUTA_DP4                (1 << 23)
+#       define R300_FPI2_OUTA_MIN                (2 << 23)
+#       define R300_FPI2_OUTA_MAX                (3 << 23)
+#       define R300_FPI2_OUTA_CMP                (6 << 23)
+#       define R300_FPI2_OUTA_FRC                (7 << 23)
+#       define R300_FPI2_OUTA_EX2                (8 << 23)
+#       define R300_FPI2_OUTA_LG2                (9 << 23)
+#       define R300_FPI2_OUTA_RCP                (10 << 23)
+#       define R300_FPI2_OUTA_RSQ                (11 << 23)
+#       define R300_FPI2_OUTA_SAT                (1 << 30)
+#       define R300_FPI2_UNKNOWN_31              (1 << 31)
+/* END */
+
+/* gap */
+#define R300_PP_ALPHA_TEST                  0x4BD4
+#       define R300_REF_ALPHA_MASK               0x000000ff
+#       define R300_ALPHA_TEST_FAIL              (0 << 8)
+#       define R300_ALPHA_TEST_LESS              (1 << 8)
+#       define R300_ALPHA_TEST_LEQUAL            (3 << 8)
+#       define R300_ALPHA_TEST_EQUAL             (2 << 8)
+#       define R300_ALPHA_TEST_GEQUAL            (6 << 8)
+#       define R300_ALPHA_TEST_GREATER           (4 << 8)
+#       define R300_ALPHA_TEST_NEQUAL            (5 << 8)
+#       define R300_ALPHA_TEST_PASS              (7 << 8)
+#       define R300_ALPHA_TEST_OP_MASK           (7 << 8)
+#       define R300_ALPHA_TEST_ENABLE            (1 << 11)
+
+/* gap */
+/* Fragment program parameters in 7.16 floating point */
+#define R300_PFS_PARAM_0_X                  0x4C00
+#define R300_PFS_PARAM_0_Y                  0x4C04
+#define R300_PFS_PARAM_0_Z                  0x4C08
+#define R300_PFS_PARAM_0_W                  0x4C0C
+/* GUESS: PARAM_31 is last, based on native limits reported by fglrx */
+#define R300_PFS_PARAM_31_X                 0x4DF0
+#define R300_PFS_PARAM_31_Y                 0x4DF4
+#define R300_PFS_PARAM_31_Z                 0x4DF8
+#define R300_PFS_PARAM_31_W                 0x4DFC
+
+/* Notes:
+// - AFAIK fglrx always sets BLEND_UNKNOWN when blending is used in the application
+// - AFAIK fglrx always sets BLEND_NO_SEPARATE when CBLEND and ABLEND are set to the same
+//   function (both registers are always set up completely in any case)
+// - Most blend flags are simply copied from R200 and not tested yet */
+#define R300_RB3D_CBLEND                    0x4E04
+#define R300_RB3D_ABLEND                    0x4E08
+ /* the following only appear in CBLEND */
+#       define R300_BLEND_ENABLE                     (1 << 0)
+#       define R300_BLEND_UNKNOWN                    (3 << 1)
+#       define R300_BLEND_NO_SEPARATE                (1 << 3)
+ /* the following are shared between CBLEND and ABLEND */
+#       define R300_FCN_MASK                           (3  << 12)
+#       define R300_COMB_FCN_ADD_CLAMP                 (0  << 12)
+#       define R300_COMB_FCN_ADD_NOCLAMP               (1  << 12)
+#       define R300_COMB_FCN_SUB_CLAMP                 (2  << 12)
+#       define R300_COMB_FCN_SUB_NOCLAMP               (3  << 12)
+#       define R300_SRC_BLEND_GL_ZERO                  (32 << 16)
+#       define R300_SRC_BLEND_GL_ONE                   (33 << 16)
+#       define R300_SRC_BLEND_GL_SRC_COLOR             (34 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR   (35 << 16)
+#       define R300_SRC_BLEND_GL_DST_COLOR             (36 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_DST_COLOR   (37 << 16)
+#       define R300_SRC_BLEND_GL_SRC_ALPHA             (38 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA   (39 << 16)
+#       define R300_SRC_BLEND_GL_DST_ALPHA             (40 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA   (41 << 16)
+#       define R300_SRC_BLEND_GL_SRC_ALPHA_SATURATE    (42 << 16)
+#       define R300_SRC_BLEND_GL_CONST_COLOR           (43 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_CONST_COLOR (44 << 16)
+#       define R300_SRC_BLEND_GL_CONST_ALPHA           (45 << 16)
+#       define R300_SRC_BLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 16)
+#       define R300_SRC_BLEND_MASK                     (63 << 16)
+#       define R300_DST_BLEND_GL_ZERO                  (32 << 24)
+#       define R300_DST_BLEND_GL_ONE                   (33 << 24)
+#       define R300_DST_BLEND_GL_SRC_COLOR             (34 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_SRC_COLOR   (35 << 24)
+#       define R300_DST_BLEND_GL_DST_COLOR             (36 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_DST_COLOR   (37 << 24)
+#       define R300_DST_BLEND_GL_SRC_ALPHA             (38 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA   (39 << 24)
+#       define R300_DST_BLEND_GL_DST_ALPHA             (40 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_DST_ALPHA   (41 << 24)
+#       define R300_DST_BLEND_GL_CONST_COLOR           (43 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_CONST_COLOR (44 << 24)
+#       define R300_DST_BLEND_GL_CONST_ALPHA           (45 << 24)
+#       define R300_DST_BLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 24)
+#       define R300_DST_BLEND_MASK                     (63 << 24)
+#define R300_RB3D_COLORMASK                 0x4E0C
+#       define R300_COLORMASK0_B                 (1<<0)
+#       define R300_COLORMASK0_G                 (1<<1)
+#       define R300_COLORMASK0_R                 (1<<2)
+#       define R300_COLORMASK0_A                 (1<<3)
+
+#define R300_RB3D_BLENDCOLOR                0x4E10 /* ARGB */
+
+/* gap */
+#define R300_RB3D_COLOROFFSET0              0x4E28
+#       define R300_COLOROFFSET_MASK             0xFFFFFFF0 /* GUESS */
+#define R300_RB3D_COLOROFFSET1              0x4E2C /* GUESS */
+#define R300_RB3D_COLOROFFSET2              0x4E30 /* GUESS */
+#define R300_RB3D_COLOROFFSET3              0x4E34 /* GUESS */
+/* gap */
+/* Bit 16: Larger tiles
+// Bit 17: 4x2 tiles
+// Bit 18: Extremely weird tile like, but some pixels duplicated? */
+#define R300_RB3D_COLORPITCH0               0x4E38
+#       define R300_COLORPITCH_MASK              0x00001FF8 /* GUESS */
+#       define R300_COLOR_TILE_ENABLE            (1 << 16) /* GUESS */
+#       define R300_COLOR_MICROTILE_ENABLE       (1 << 17) /* GUESS */
+#       define R300_COLOR_ENDIAN_NO_SWAP         (0 << 18) /* GUESS */
+#       define R300_COLOR_ENDIAN_WORD_SWAP       (1 << 18) /* GUESS */
+#       define R300_COLOR_ENDIAN_DWORD_SWAP      (2 << 18) /* GUESS */
+#       define R300_COLOR_FORMAT_RGB565          (2 << 22)
+#       define R300_COLOR_FORMAT_ARGB8888        (3 << 22)
+#       define R300_COLOR_FORMAT_RGB8            (4 << 22)
+#       define R300_COLOR_FORMAT_MASK            (7 << 22)
+#define R300_RB3D_COLORPITCH1               0x4E3C /* GUESS */
+#define R300_RB3D_COLORPITCH2               0x4E40 /* GUESS */
+#define R300_RB3D_COLORPITCH3               0x4E44 /* GUESS */
+
+#define R300_RB3D_DSTCACHE_MODE             0x4E48
+/* gap */
+/* Guess by Vladimir.
+// Set to 0A before 3D operations, set to 02 afterwards. */
+#define R300_RB3D_DSTCACHE_CTLSTAT          0x4E4C
+#       define R300_RB3D_DSTCACHE_02             0x00000002
+#       define R300_RB3D_DSTCACHE_0A             0x0000000A
+
+/* gap */
+/* There seems to be no "write only" setting, so use Z-test = ALWAYS for this. */
+/* Bit (1<<8) is the "test" bit. so plain write is 6  - vd */
+#define R300_RB3D_ZSTENCIL_CNTL_0                   0x4F00
+#       define R300_RB3D_Z_DISABLED_1            0x00000010 /* GUESS */
+#       define R300_RB3D_Z_DISABLED_2            0x00000014 /* GUESS */
+#       define R300_RB3D_Z_TEST                  0x00000012
+#       define R300_RB3D_Z_TEST_AND_WRITE        0x00000016
+#       define R300_RB3D_Z_WRITE_ONLY            0x00000006
+#       define R300_RB3D_STENCIL_ENABLE	         0x00000001
+
+#define R300_RB3D_ZSTENCIL_CNTL_1                   0x4F04
+		/* functions */
+#	define R300_ZS_NEVER			0
+#	define R300_ZS_LESS	               1
+#	define R300_ZS_LEQUAL			2
+#	define R300_ZS_EQUAL			3
+#	define R300_ZS_GEQUAL			4
+#	define R300_ZS_GREATER			5
+#	define R300_ZS_NOTEQUAL			6
+#	define R300_ZS_ALWAYS			7
+#    define R300_ZS_MASK                7
+		/* operations */
+#	define R300_ZS_KEEP			0
+#	define R300_ZS_ZERO			1
+#	define R300_ZS_REPLACE			2
+#	define R300_ZS_INCR			3
+#	define R300_ZS_DECR			4
+#	define R300_ZS_INVERT			5
+#	define R300_ZS_INCR_WRAP		6
+#	define R300_ZS_DECR_WRAP		7
+
+       /* front and back refer to operations done for front
+          and back faces, i.e. separate stencil function support */
+#	define R300_RB3D_ZS1_DEPTH_FUNC_SHIFT		0
+#	define R300_RB3D_ZS1_FRONT_FUNC_SHIFT		3
+#	define R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT	6
+#	define R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT	9
+#	define R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT      12
+#	define R300_RB3D_ZS1_BACK_FUNC_SHIFT           15
+#	define R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT        18
+#	define R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT       21
+#	define R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT       24
+
+
+
+#define R300_RB3D_ZSTENCIL_CNTL_2                   0x4F08
+#	define R300_RB3D_ZS2_STENCIL_REF_SHIFT		0
+#	define R300_RB3D_ZS2_STENCIL_MASK		0xFF
+#	define R300_RB3D_ZS2_STENCIL_MASK_SHIFT	        8
+#	define R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT	16
+
+/* gap */
+
+#define R300_RB3D_ZSTENCIL_FORMAT                   0x4F10
+#	define R300_DEPTH_FORMAT_16BIT_INT_Z     (0 << 0)
+#	define R300_DEPTH_FORMAT_24BIT_INT_Z     (2 << 0)
+ /* 16 bit format or some aditional bit ? */
+#	define R300_DEPTH_FORMAT_UNK32          (32 << 0)
+
+/* gap */
+#define R300_RB3D_DEPTHOFFSET               0x4F20
+#define R300_RB3D_DEPTHPITCH                0x4F24
+#       define R300_DEPTHPITCH_MASK              0x00001FF8 /* GUESS */
+#       define R300_DEPTH_TILE_ENABLE            (1 << 16) /* GUESS */
+#       define R300_DEPTH_MICROTILE_ENABLE       (1 << 17) /* GUESS */
+#       define R300_DEPTH_ENDIAN_NO_SWAP         (0 << 18) /* GUESS */
+#       define R300_DEPTH_ENDIAN_WORD_SWAP       (1 << 18) /* GUESS */
+#       define R300_DEPTH_ENDIAN_DWORD_SWAP      (2 << 18) /* GUESS */
+
+/* BEGIN: Vertex program instruction set
+// Every instruction is four dwords long:
+//  DWORD 0: output and opcode
+//  DWORD 1: first argument
+//  DWORD 2: second argument
+//  DWORD 3: third argument
+//
+// Notes:
+//  - ABS r, a is implemented as MAX r, a, -a
+//  - MOV is implemented as ADD to zero
+//  - XPD is implemented as MUL + MAD
+//  - FLR is implemented as FRC + ADD
+//  - apparently, fglrx tries to schedule instructions so that there is at least
+//    one instruction between the write to a temporary and the first read
+//    from said temporary; however, violations of this scheduling are allowed
+//  - register indices seem to be unrelated with OpenGL aliasing to conventional state
+//  - only one attribute and one parameter can be loaded at a time; however, the
+//    same attribute/parameter can be used for more than one argument
+//  - the second software argument for POW is the third hardware argument (no idea why)
+//  - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2
+//
+// There is some magic surrounding LIT:
+//  The single argument is replicated across all three inputs, but swizzled:
+//   First argument: xyzy
+//   Second argument: xyzx
+//   Third argument: xyzw
+//  Whenever the result is used later in the fragment program, fglrx forces x and w
+//  to be 1.0 in the input selection; I don't know whether this is strictly necessary */
+#define R300_VPI_OUT_OP_DOT                     (1 << 0)
+#define R300_VPI_OUT_OP_MUL                     (2 << 0)
+#define R300_VPI_OUT_OP_ADD                     (3 << 0)
+#define R300_VPI_OUT_OP_MAD                     (4 << 0)
+#define R300_VPI_OUT_OP_DST                     (5 << 0)
+#define R300_VPI_OUT_OP_FRC                     (6 << 0)
+#define R300_VPI_OUT_OP_MAX                     (7 << 0)
+#define R300_VPI_OUT_OP_MIN                     (8 << 0)
+#define R300_VPI_OUT_OP_SGE                     (9 << 0)
+#define R300_VPI_OUT_OP_SLT                     (10 << 0)
+#define R300_VPI_OUT_OP_UNK12                   (12 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */
+#define R300_VPI_OUT_OP_EXP                     (65 << 0)
+#define R300_VPI_OUT_OP_LOG                     (66 << 0)
+#define R300_VPI_OUT_OP_UNK67                   (67 << 0) /* Used in fog computations, scalar(scalar) */
+#define R300_VPI_OUT_OP_LIT                     (68 << 0)
+#define R300_VPI_OUT_OP_POW                     (69 << 0)
+#define R300_VPI_OUT_OP_RCP                     (70 << 0)
+#define R300_VPI_OUT_OP_RSQ                     (72 << 0)
+#define R300_VPI_OUT_OP_UNK73                   (73 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */
+#define R300_VPI_OUT_OP_EX2                     (75 << 0)
+#define R300_VPI_OUT_OP_LG2                     (76 << 0)
+#define R300_VPI_OUT_OP_MAD_2                   (128 << 0)
+#define R300_VPI_OUT_OP_UNK129                  (129 << 0) /* all temps, vector(scalar, vector, vector) */
+
+#define R300_VPI_OUT_REG_CLASS_TEMPORARY        (0 << 8)
+#define R300_VPI_OUT_REG_CLASS_RESULT           (2 << 8)
+#define R300_VPI_OUT_REG_CLASS_MASK             (31 << 8)
+
+#define R300_VPI_OUT_REG_INDEX_SHIFT            13
+#define R300_VPI_OUT_REG_INDEX_MASK             (31 << 13) /* GUESS based on fglrx native limits */
+
+#define R300_VPI_OUT_WRITE_X                    (1 << 20)
+#define R300_VPI_OUT_WRITE_Y                    (1 << 21)
+#define R300_VPI_OUT_WRITE_Z                    (1 << 22)
+#define R300_VPI_OUT_WRITE_W                    (1 << 23)
+
+#define R300_VPI_IN_REG_CLASS_TEMPORARY         (0 << 0)
+#define R300_VPI_IN_REG_CLASS_ATTRIBUTE         (1 << 0)
+#define R300_VPI_IN_REG_CLASS_PARAMETER         (2 << 0)
+#define R300_VPI_IN_REG_CLASS_NONE              (9 << 0)
+#define R300_VPI_IN_REG_CLASS_MASK              (31 << 0) /* GUESS */
+
+#define R300_VPI_IN_REG_INDEX_SHIFT             5
+#define R300_VPI_IN_REG_INDEX_MASK              (255 << 5) /* GUESS based on fglrx native limits */
+
+/* The R300 can select components from the input register arbitrarily.
+// Use the following constants, shifted by the component shift you
+// want to select */
+#define R300_VPI_IN_SELECT_X    0
+#define R300_VPI_IN_SELECT_Y    1
+#define R300_VPI_IN_SELECT_Z    2
+#define R300_VPI_IN_SELECT_W    3
+#define R300_VPI_IN_SELECT_ZERO 4
+#define R300_VPI_IN_SELECT_ONE  5
+#define R300_VPI_IN_SELECT_MASK 7
+
+#define R300_VPI_IN_X_SHIFT                     13
+#define R300_VPI_IN_Y_SHIFT                     16
+#define R300_VPI_IN_Z_SHIFT                     19
+#define R300_VPI_IN_W_SHIFT                     22
+
+#define R300_VPI_IN_NEG_X                       (1 << 25)
+#define R300_VPI_IN_NEG_Y                       (1 << 26)
+#define R300_VPI_IN_NEG_Z                       (1 << 27)
+#define R300_VPI_IN_NEG_W                       (1 << 28)
+/* END */
+
+//BEGIN: Packet 3 commands
+
+// A primitive emission dword.
+#define R300_PRIM_TYPE_NONE                     (0 << 0)
+#define R300_PRIM_TYPE_POINT                    (1 << 0)
+#define R300_PRIM_TYPE_LINE                     (2 << 0)
+#define R300_PRIM_TYPE_LINE_STRIP               (3 << 0)
+#define R300_PRIM_TYPE_TRI_LIST                 (4 << 0)
+#define R300_PRIM_TYPE_TRI_FAN                  (5 << 0)
+#define R300_PRIM_TYPE_TRI_STRIP                (6 << 0)
+#define R300_PRIM_TYPE_TRI_TYPE2                (7 << 0)
+#define R300_PRIM_TYPE_RECT_LIST                (8 << 0)
+#define R300_PRIM_TYPE_3VRT_POINT_LIST          (9 << 0)
+#define R300_PRIM_TYPE_3VRT_LINE_LIST           (10 << 0)
+#define R300_PRIM_TYPE_POINT_SPRITES            (11 << 0) // GUESS (based on r200)
+#define R300_PRIM_TYPE_LINE_LOOP                (12 << 0)
+#define R300_PRIM_TYPE_QUADS                    (13 << 0)
+#define R300_PRIM_TYPE_QUAD_STRIP               (14 << 0)
+#define R300_PRIM_TYPE_POLYGON                  (15 << 0)
+#define R300_PRIM_TYPE_MASK                     0xF
+#define R300_PRIM_WALK_IND                      (1 << 4)
+#define R300_PRIM_WALK_LIST                     (2 << 4)
+#define R300_PRIM_WALK_RING                     (3 << 4)
+#define R300_PRIM_WALK_MASK                     (3 << 4)
+#define R300_PRIM_COLOR_ORDER_BGRA              (0 << 6) // GUESS (based on r200)
+#define R300_PRIM_COLOR_ORDER_RGBA              (1 << 6) // GUESS
+#define R300_PRIM_NUM_VERTICES_SHIFT            16
+
+               /* Registers for CP and Microcode Engine */
+#define CP_ME_RAM_ADDR               0x07d4
+#define CP_ME_RAM_RADDR              0x07d8
+#define CP_ME_RAM_DATAH              0x07dc
+#define CP_ME_RAM_DATAL              0x07e0
+
+#define CP_RB_BASE                   0x0700
+#define CP_RB_CNTL                   0x0704
+#define CP_RB_RPTR_ADDR              0x070c
+#define CP_RB_RPTR                   0x0710
+#define CP_RB_WPTR                   0x0714
+
+#define CP_IB_BASE                   0x0738
+#define CP_IB_BUFSZ                  0x073c
+
+#define CP_CSQ_CNTL                  0x0740
+#       define CSQ_CNT_PRIMARY_MASK     (0xff << 0)
+#       define CSQ_PRIDIS_INDDIS        (0    << 28)
+#       define CSQ_PRIPIO_INDDIS        (1    << 28)
+#       define CSQ_PRIBM_INDDIS         (2    << 28)
+#       define CSQ_PRIPIO_INDBM         (3    << 28)
+#       define CSQ_PRIBM_INDBM          (4    << 28)
+#       define CSQ_PRIPIO_INDPIO        (15   << 28)
+#define CP_CSQ_STAT                  0x07f8
+#       define CSQ_RPTR_PRIMARY_MASK    (0xff <<  0)
+#       define CSQ_WPTR_PRIMARY_MASK    (0xff <<  8)
+#       define CSQ_RPTR_INDIRECT_MASK   (0xff << 16)
+#       define CSQ_WPTR_INDIRECT_MASK   (0xff << 24)
+#define CP_CSQ_ADDR                  0x07f0
+#define CP_CSQ_DATA                  0x07f4
+#define CP_CSQ_APER_PRIMARY          0x1000
+#define CP_CSQ_APER_INDIRECT         0x1300
+
+#define CP_RB_WPTR_DELAY             0x0718
+#       define PRE_WRITE_TIMER_SHIFT    0
+#       define PRE_WRITE_LIMIT_SHIFT    23
+
+#define AIC_CNTL                     0x01d0
+#       define PCIGART_TRANSLATE_EN     (1 << 0)
+#define AIC_LO_ADDR                  0x01dc
+
+
+
+				/* Constants */
+#define LAST_FRAME_REG               GUI_SCRATCH_REG0
+#define LAST_CLEAR_REG               GUI_SCRATCH_REG2
+
+
+
+				/* CP packet types */
+#define CP_PACKET0                           0x00000000
+#define CP_PACKET1                           0x40000000
+#define CP_PACKET2                           0x80000000
+#define CP_PACKET3                           0xC0000000
+#       define CP_PACKET_MASK                0xC0000000
+#       define CP_PACKET_COUNT_MASK          0x3fff0000
+#       define CP_PACKET_MAX_DWORDS          (1 << 12)
+#       define CP_PACKET0_REG_MASK           0x000007ff
+#       define CP_PACKET1_REG0_MASK          0x000007ff
+#       define CP_PACKET1_REG1_MASK          0x003ff800
+
+#define CP_PACKET0_ONE_REG_WR                0x00008000
+
+#define CP_PACKET3_NOP                       0xC0001000
+#define CP_PACKET3_NEXT_CHAR                 0xC0001900
+#define CP_PACKET3_PLY_NEXTSCAN              0xC0001D00
+#define CP_PACKET3_SET_SCISSORS              0xC0001E00
+#define CP_PACKET3_3D_RNDR_GEN_INDX_PRIM     0xC0002300
+#define CP_PACKET3_LOAD_MICROCODE            0xC0002400
+#define CP_PACKET3_WAIT_FOR_IDLE             0xC0002600
+#define CP_PACKET3_3D_DRAW_VBUF              0xC0002800
+#define CP_PACKET3_3D_DRAW_IMMD              0xC0002900
+#define CP_PACKET3_3D_DRAW_INDX              0xC0002A00
+#define CP_PACKET3_LOAD_PALETTE              0xC0002C00
+#define R200_CP_PACKET3_3D_DRAW_IMMD_2              0xc0003500
+#define CP_PACKET3_3D_LOAD_VBPNTR            0xC0002F00
+#define CP_PACKET3_CNTL_PAINT                0xC0009100
+#define CP_PACKET3_CNTL_BITBLT               0xC0009200
+#define CP_PACKET3_CNTL_SMALLTEXT            0xC0009300
+#define CP_PACKET3_CNTL_HOSTDATA_BLT         0xC0009400
+#define CP_PACKET3_CNTL_POLYLINE             0xC0009500
+#define CP_PACKET3_CNTL_POLYSCANLINES        0xC0009800
+#define CP_PACKET3_CNTL_PAINT_MULTI          0xC0009A00
+#define CP_PACKET3_CNTL_BITBLT_MULTI         0xC0009B00
+#define CP_PACKET3_CNTL_TRANS_BITBLT         0xC0009C00
+
+
+#define CP_VC_FRMT_XY                        0x00000000
+#define CP_VC_FRMT_W0                        0x00000001
+#define CP_VC_FRMT_FPCOLOR                   0x00000002
+#define CP_VC_FRMT_FPALPHA                   0x00000004
+#define CP_VC_FRMT_PKCOLOR                   0x00000008
+#define CP_VC_FRMT_FPSPEC                    0x00000010
+#define CP_VC_FRMT_FPFOG                     0x00000020
+#define CP_VC_FRMT_PKSPEC                    0x00000040
+#define CP_VC_FRMT_ST0                       0x00000080
+#define CP_VC_FRMT_ST1                       0x00000100
+#define CP_VC_FRMT_Q1                        0x00000200
+#define CP_VC_FRMT_ST2                       0x00000400
+#define CP_VC_FRMT_Q2                        0x00000800
+#define CP_VC_FRMT_ST3                       0x00001000
+#define CP_VC_FRMT_Q3                        0x00002000
+#define CP_VC_FRMT_Q0                        0x00004000
+#define CP_VC_FRMT_BLND_WEIGHT_CNT_MASK      0x00038000
+#define CP_VC_FRMT_N0                        0x00040000
+#define CP_VC_FRMT_XY1                       0x08000000
+#define CP_VC_FRMT_Z1                        0x10000000
+#define CP_VC_FRMT_W1                        0x20000000
+#define CP_VC_FRMT_N1                        0x40000000
+#define CP_VC_FRMT_Z                         0x80000000
+
+#define CP_VC_CNTL_PRIM_TYPE_NONE            0x00000000
+#define CP_VC_CNTL_PRIM_TYPE_POINT           0x00000001
+#define CP_VC_CNTL_PRIM_TYPE_LINE            0x00000002
+#define CP_VC_CNTL_PRIM_TYPE_LINE_STRIP      0x00000003
+#define CP_VC_CNTL_PRIM_TYPE_TRI_LIST        0x00000004
+#define CP_VC_CNTL_PRIM_TYPE_TRI_FAN         0x00000005
+#define CP_VC_CNTL_PRIM_TYPE_TRI_STRIP       0x00000006
+#define CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2      0x00000007
+#define CP_VC_CNTL_PRIM_TYPE_RECT_LIST       0x00000008
+#define CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009
+#define CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST  0x0000000a
+#define CP_VC_CNTL_PRIM_WALK_IND             0x00000010
+#define CP_VC_CNTL_PRIM_WALK_LIST            0x00000020
+#define CP_VC_CNTL_PRIM_WALK_RING            0x00000030
+#define CP_VC_CNTL_COLOR_ORDER_BGRA          0x00000000
+#define CP_VC_CNTL_COLOR_ORDER_RGBA          0x00000040
+#define CP_VC_CNTL_MAOS_ENABLE               0x00000080
+#define CP_VC_CNTL_VTX_FMT_NON_MODE   0x00000000
+#define CP_VC_CNTL_VTX_FMT_MODE       0x00000100
+#define CP_VC_CNTL_TCL_DISABLE               0x00000000
+#define CP_VC_CNTL_TCL_ENABLE                0x00000200
+#define CP_VC_CNTL_NUM_SHIFT                 16
+
+#define VS_MATRIX_0_ADDR                   0
+#define VS_MATRIX_1_ADDR                   4
+#define VS_MATRIX_2_ADDR                   8
+#define VS_MATRIX_3_ADDR                  12
+#define VS_MATRIX_4_ADDR                  16
+#define VS_MATRIX_5_ADDR                  20
+#define VS_MATRIX_6_ADDR                  24
+#define VS_MATRIX_7_ADDR                  28
+#define VS_MATRIX_8_ADDR                  32
+#define VS_MATRIX_9_ADDR                  36
+#define VS_MATRIX_10_ADDR                 40
+#define VS_MATRIX_11_ADDR                 44
+#define VS_MATRIX_12_ADDR                 48
+#define VS_MATRIX_13_ADDR                 52
+#define VS_MATRIX_14_ADDR                 56
+#define VS_MATRIX_15_ADDR                 60
+#define VS_LIGHT_AMBIENT_ADDR             64
+#define VS_LIGHT_DIFFUSE_ADDR             72
+#define VS_LIGHT_SPECULAR_ADDR            80
+#define VS_LIGHT_DIRPOS_ADDR              88
+#define VS_LIGHT_HWVSPOT_ADDR             96
+#define VS_LIGHT_ATTENUATION_ADDR        104
+#define VS_MATRIX_EYE2CLIP_ADDR          112
+#define VS_UCP_ADDR                      116
+#define VS_GLOBAL_AMBIENT_ADDR           122
+#define VS_FOG_PARAM_ADDR                123
+#define VS_EYE_VECTOR_ADDR               124
+
+#define SS_LIGHT_DCD_ADDR                  0
+#define SS_LIGHT_SPOT_EXPONENT_ADDR        8
+#define SS_LIGHT_SPOT_CUTOFF_ADDR         16
+#define SS_LIGHT_SPECULAR_THRESH_ADDR     24
+#define SS_LIGHT_RANGE_CUTOFF_ADDR        32
+#define SS_VERT_GUARD_CLIP_ADJ_ADDR       48
+#define SS_VERT_GUARD_DISCARD_ADJ_ADDR    49
+#define SS_HORZ_GUARD_CLIP_ADJ_ADDR       50
+#define SS_HORZ_GUARD_DISCARD_ADJ_ADDR    51
+#define SS_SHININESS                      60
+
+
+#endif /* __RADEON_REGS_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/radeon_state.h b/Source/DirectFB/gfxdrivers/radeon/radeon_state.h
new file mode 100755
index 0000000..a91eca1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/radeon_state.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
+ *
+ * Graphics driver for ATI Radeon cards written by
+ *             Claudio Ciccani <klan@users.sf.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 __RADEON_STATE_H__
+#define __RADEON_STATE_H__
+
+#include <core/surface.h>
+
+/* R100 state funcs */
+void r100_restore           ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev  );
+void r100_set_destination   ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_source        ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_source_mask   ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_clip          ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_drawing_color ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_src_colorkey  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_blend_function( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_drawingflags  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r100_set_blittingflags ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+                              
+/* R200 state funcs */
+void r200_restore           ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev  );
+void r200_set_destination   ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_source        ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_source_mask   ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_clip          ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_drawing_color ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_src_colorkey  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_blend_function( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_drawingflags  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r200_set_blittingflags ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+                              
+/* R300 state funcs */
+void r300_restore           ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev  );
+void r300_set_destination   ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_source        ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_clip3d        ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              const DFBRegion  *clip  );
+void r300_set_clip          ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_drawing_color ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_blitting_color( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_src_colorkey  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_blend_function( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_render_options( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_drawingflags  ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+void r300_set_blittingflags ( RadeonDriverData *rdrv,
+                              RadeonDeviceData *rdev,
+                              CardState        *state );
+                              
+                              
+#define RADEON_IS_SET( flag ) \
+     ((rdev->set & SMF_##flag) == SMF_##flag)
+
+#define RADEON_SET( flag ) \
+     rdev->set |= SMF_##flag
+
+#define RADEON_UNSET( flag ) \
+     rdev->set &= ~(SMF_##flag)
+     
+     
+static inline u32
+radeon_buffer_offset( RadeonDeviceData *rdev, CoreSurfaceBufferLock *lock )
+{
+     if (lock->phys - lock->offset == rdev->fb_phys)
+          return lock->offset + rdev->fb_offset;
+
+     return lock->offset + rdev->agp_offset;
+}
+
+                                                        
+#endif /* __RADEON_STATE_H__ */
diff --git a/Source/DirectFB/gfxdrivers/radeon/vertex_shader.h b/Source/DirectFB/gfxdrivers/radeon/vertex_shader.h
new file mode 100755
index 0000000..4fd0fd2
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/radeon/vertex_shader.h
@@ -0,0 +1,83 @@
+#ifndef __VERTEX_SHADER_H__
+#define __VERTEX_SHADER_H__
+
+#define VSF_FLAG_X	1
+#define VSF_FLAG_Y	2
+#define VSF_FLAG_Z	4
+#define VSF_FLAG_W	8
+#define VSF_FLAG_XYZ	(VSF_FLAG_X | VSF_FLAG_Y | VSF_FLAG_Z)
+#define VSF_FLAG_ALL  0xf
+#define VSF_FLAG_NONE  0
+
+#define VSF_OUT_CLASS_TMP	0
+#define VSF_OUT_CLASS_ADDR	1
+#define VSF_OUT_CLASS_RESULT	2
+
+
+/* first CARD32 of an instruction */
+
+/* possible operations: 
+    DOT, MUL, ADD, MAD, FRC, MAX, MIN, SGE, SLT, EXP, LOG, LIT, POW, RCP, RSQ, EX2,
+    LG2, MAD_2 */
+
+#define MAKE_VSF_OP(op, out_reg_index, out_reg_fields, class) \
+   ((op)  \
+  	| ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) 	\
+ 	 | ((out_reg_fields) << 20) 	\
+  	| ( (class) << 8 ) )
+
+#define EASY_VSF_OP(op, out_reg_index, out_reg_fields, class) \
+	MAKE_VSF_OP(R300_VPI_OUT_OP_##op, out_reg_index, VSF_FLAG_##out_reg_fields, VSF_OUT_CLASS_##class) \
+
+/* according to Nikolai, the subsequent 3 CARD32 are sources, use same define for each */
+
+#define VSF_IN_CLASS_TMP	0
+#define VSF_IN_CLASS_ATTR	1
+#define VSF_IN_CLASS_PARAM	2
+#define VSF_IN_CLASS_NONE	9
+
+#define VSF_IN_COMPONENT_X	0
+#define VSF_IN_COMPONENT_Y	1
+#define VSF_IN_COMPONENT_Z	2
+#define VSF_IN_COMPONENT_W	3
+#define VSF_IN_COMPONENT_ZERO	4
+#define VSF_IN_COMPONENT_ONE	5
+
+#define MAKE_VSF_SOURCE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \
+	( ((in_reg_index)<<R300_VPI_IN_REG_INDEX_SHIFT) \
+	   | ((comp_x)<<R300_VPI_IN_X_SHIFT) \
+	   | ((comp_y)<<R300_VPI_IN_Y_SHIFT) \
+	   | ((comp_z)<<R300_VPI_IN_Z_SHIFT) \
+	   | ((comp_w)<<R300_VPI_IN_W_SHIFT) \
+	   | ((negate)<<25) | ((class)))
+	   
+#define EASY_VSF_SOURCE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \
+	MAKE_VSF_SOURCE(in_reg_index, \
+		VSF_IN_COMPONENT_##comp_x, \
+		VSF_IN_COMPONENT_##comp_y, \
+		VSF_IN_COMPONENT_##comp_z, \
+		VSF_IN_COMPONENT_##comp_w, \
+		VSF_IN_CLASS_##class, VSF_FLAG_##negate)
+
+/* special sources: */
+
+/* (1.0,1.0,1.0,1.0) vector (ATTR, plain ) */
+#define VSF_ATTR_UNITY(reg) 	EASY_VSF_SOURCE(reg, ONE, ONE, ONE, ONE, ATTR, NONE)  
+#define VSF_UNITY(reg) 	EASY_VSF_SOURCE(reg, ONE, ONE, ONE, ONE, NONE, NONE)  
+
+/* contents of unmodified register */
+#define VSF_REG(reg) 	EASY_VSF_SOURCE(reg, X, Y, Z, W, ATTR, NONE)
+
+/* contents of unmodified parameter */
+#define VSF_PARAM(reg) 	EASY_VSF_SOURCE(reg, X, Y, Z, W, PARAM, NONE)
+
+/* contents of unmodified temporary register */
+#define VSF_TMP(reg) 	EASY_VSF_SOURCE(reg, X, Y, Z, W, TMP, NONE)
+
+/* components of ATTR register */
+#define VSF_ATTR_X(reg) EASY_VSF_SOURCE(reg, X, X, X, X, ATTR, NONE)
+#define VSF_ATTR_Y(reg) EASY_VSF_SOURCE(reg, Y, Y, Y, Y, ATTR, NONE)
+#define VSF_ATTR_Z(reg) EASY_VSF_SOURCE(reg, Z, Z, Z, Z, ATTR, NONE)
+#define VSF_ATTR_W(reg) EASY_VSF_SOURCE(reg, W, W, W, W, ATTR, NONE)
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/savage/Makefile.am b/Source/DirectFB/gfxdrivers/savage/Makefile.am
new file mode 100755
index 0000000..3479720
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/Makefile.am
@@ -0,0 +1,45 @@
+## Makefile.am for DirectFB-internal/gfxdrivers/savage
+
+INCLUDES = \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+savage_LTLIBRARIES = libdirectfb_savage.la
+
+if BUILD_STATIC
+savage_DATA = $(savage_LTLIBRARIES:.la=.o)
+endif
+
+savagedir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_savage_la_SOURCES = \
+	mmio.h			\
+	savage.c		\
+	savage.h		\
+	savage3d.c		\
+	savage3d.h		\
+	savage4.c		\
+	savage4.h		\
+	savage2000.c		\
+	savage2000.h		\
+	savage_bci.h		\
+	savage_streams_old.c	\
+	savage_streams_old.h
+
+libdirectfb_savage_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_savage_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/savage/Makefile.in b/Source/DirectFB/gfxdrivers/savage/Makefile.in
new file mode 100755
index 0000000..943a241
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/Makefile.in
@@ -0,0 +1,611 @@
+# 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/savage
+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)$(savagedir)" "$(DESTDIR)$(savagedir)"
+savageLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(savage_LTLIBRARIES)
+libdirectfb_savage_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_savage_la_OBJECTS = savage.lo savage3d.lo savage4.lo \
+	savage2000.lo savage_streams_old.lo
+libdirectfb_savage_la_OBJECTS = $(am_libdirectfb_savage_la_OBJECTS)
+libdirectfb_savage_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_savage_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_savage_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_savage_la_SOURCES)
+savageDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(savage_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+savage_LTLIBRARIES = libdirectfb_savage.la
+@BUILD_STATIC_TRUE@savage_DATA = $(savage_LTLIBRARIES:.la=.o)
+savagedir = $(MODULEDIR)/gfxdrivers
+libdirectfb_savage_la_SOURCES = \
+	mmio.h			\
+	savage.c		\
+	savage.h		\
+	savage3d.c		\
+	savage3d.h		\
+	savage4.c		\
+	savage4.h		\
+	savage2000.c		\
+	savage2000.h		\
+	savage_bci.h		\
+	savage_streams_old.c	\
+	savage_streams_old.h
+
+libdirectfb_savage_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_savage_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/savage/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/savage/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-savageLTLIBRARIES: $(savage_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(savagedir)" || $(MKDIR_P) "$(DESTDIR)$(savagedir)"
+	@list='$(savage_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(savageLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(savagedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(savageLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(savagedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-savageLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(savage_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(savagedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(savagedir)/$$p"; \
+	done
+
+clean-savageLTLIBRARIES:
+	-test -z "$(savage_LTLIBRARIES)" || rm -f $(savage_LTLIBRARIES)
+	@list='$(savage_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_savage.la: $(libdirectfb_savage_la_OBJECTS) $(libdirectfb_savage_la_DEPENDENCIES) 
+	$(libdirectfb_savage_la_LINK) -rpath $(savagedir) $(libdirectfb_savage_la_OBJECTS) $(libdirectfb_savage_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savage2000.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savage3d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savage4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savage_streams_old.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-savageDATA: $(savage_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(savagedir)" || $(MKDIR_P) "$(DESTDIR)$(savagedir)"
+	@list='$(savage_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(savageDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(savagedir)/$$f'"; \
+	  $(savageDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(savagedir)/$$f"; \
+	done
+
+uninstall-savageDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(savage_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(savagedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(savagedir)/$$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)$(savagedir)" "$(DESTDIR)$(savagedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-savageLTLIBRARIES \
+	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-savageDATA install-savageLTLIBRARIES
+
+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-savageDATA uninstall-savageLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-savageLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-savageDATA install-savageLTLIBRARIES 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-savageDATA \
+	uninstall-savageLTLIBRARIES
+
+%.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/savage/mmio.h b/Source/DirectFB/gfxdrivers/savage/mmio.h
new file mode 100755
index 0000000..a589cc7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/mmio.h
@@ -0,0 +1,98 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE__MMIO_H__
+#define __SAVAGE__MMIO_H__
+
+#include <dfb_types.h>
+
+typedef u8 uint8;
+typedef u16 uint16;
+typedef u32 uint32;
+
+typedef s8 sint8;
+typedef s16 sint16;
+typedef s32 sint32;
+
+#if 0
+
+static inline void
+savage_out32(volatile uint8 *mmioaddr, uint32 reg, uint32 value)
+{
+     *((uint32*)(mmioaddr+reg)) = value;
+}
+
+static inline volatile uint32
+savage_in32(volatile uint8 *mmioaddr, uint32 reg)
+{
+     return *((uint32*)(mmioaddr+reg));
+}
+
+static inline void
+savage_out16(volatile uint8 *mmioaddr, uint32 reg, uint16 value)
+{
+     *((uint16*)(mmioaddr+reg)) = value;
+}
+
+#else
+
+#define savage_out32(mmio, reg, value) (*((volatile uint32 *) ((mmio)+(reg))) = (uint32)(value))
+#define savage_in32(mmio, reg)         (*((volatile uint32 *) ((mmio)+(reg))))
+#define savage_out16(mmio, reg, value) (*((volatile uint16 *) ((mmio)+(reg))) = (uint16)(value))
+
+#endif
+
+#if 0
+
+static inline void
+vga_out8(volatile uint8 *mmioaddr, uint16 reg, uint8 value)
+{
+     *((uint8*)(mmioaddr+0x8000+reg)) = value;
+}
+
+static inline void
+vga_out16(volatile uint8 *mmioaddr, uint16 reg, uint16 value)
+{
+     *((uint8*)(mmioaddr+0x8000+reg)) = value;
+}
+
+static inline volatile uint8
+vga_in8(volatile uint8 *mmioaddr, uint16 reg)
+{
+     return *((uint8*)(mmioaddr+0x8000+reg));
+}
+
+#else
+
+#define vga_out8(mmio, reg, value)  (*((volatile uint8 *) ((mmio)+0x8000+(reg))) = (uint8)(value))
+#define vga_out16(mmio, reg, value) (*((volatile uint16 *) ((mmio)+0x8000+(reg))) = (uint16)(value))
+#define vga_in8(mmio, reg)          (*((volatile uint8 *) ((mmio)+0x8000+(reg))))
+
+#endif
+
+#endif /* __SAVAGE__MMIO_H__ */
diff --git a/Source/DirectFB/gfxdrivers/savage/savage.c b/Source/DirectFB/gfxdrivers/savage/savage.c
new file mode 100755
index 0000000..dffb8e3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage.c
@@ -0,0 +1,346 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi>,
+              Claudio Ciccani <klan@users.sf.net> and
+              Alex Song <alexsong@comports.com>.
+
+   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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/gfxcard.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( savage )
+
+#include "savage.h"
+#include "savage3d.h"
+#include "savage4.h"
+#include "savage2000.h"
+#include "savage_bci.h"
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series     */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               return 1;
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series      */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               return 1;
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000         */
+               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,
+               "Savage Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     /* some defaults, each driver has it's own version */
+     info->version.major = 0;
+     info->version.minor = 3;
+
+     info->driver_data_size = sizeof (SavageDriverData);
+     info->device_data_size = sizeof (SavageDeviceData);
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               savage3d_get_info( device, info );
+               break;
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series  */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               savage4_get_info( device, info );
+               break;
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000     */
+               savage2000_get_info( device, info );
+               break;
+     }
+}
+
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+
+     sdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!sdrv->mmio_base)
+          return DFB_IO;
+
+     sdrv->bci_base = (volatile u32*)(sdrv->mmio_base + BCI_BUFFER_OFFSET);
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               return savage3d_init_driver( device, funcs, driver_data );
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series  */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               return savage4_init_driver( device, funcs, driver_data );
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000     */
+               return savage2000_init_driver( device, funcs, driver_data );
+     }
+
+     return DFB_BUG;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     SavageDeviceData *sdev = (SavageDeviceData*) device_data;
+     volatile u8      *mmio = sdrv->mmio_base;
+
+     /* use polling for syncing, artefacts occur otherwise */
+     dfb_config->pollvsync_after = 1;
+
+     sdev->accel_id = dfb_gfxcard_get_accelerator( device );
+
+     switch (sdev->accel_id) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               savage3d_init_device( device, device_info,
+                                     driver_data, device_data );
+               break;
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series  */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               savage4_init_device( device, device_info,
+                                    driver_data, device_data );
+               break;
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000     */
+               savage2000_init_device( device, device_info,
+                                       driver_data, device_data );
+               break;
+          default:
+               D_BUG("unexpected accelerator id");
+               return DFB_BUG;
+     }
+
+     /* Turn on 16-bit register access. */
+
+     vga_out8( mmio, 0x3d4, 0x31);
+     vga_out8( mmio, 0x3d5, 0x0c);
+
+     /* Set stride to use GBD. */
+
+     vga_out8( mmio, 0x3d4, 0x50);
+     vga_out8( mmio, 0x3d5, vga_in8( mmio, 0x3d5 ) | 0xC1);
+
+     /* Enable 2D engine. */
+
+     vga_out8( mmio, 0x3d4, 0x40 );
+     vga_out8( mmio, 0x3d5, 0x01 );
+
+
+     savage_out32( mmio, MONO_PAT_0, ~0 );
+     savage_out32( mmio, MONO_PAT_1, ~0 );
+
+     /* Setup plane masks */
+     savage_out32( mmio, 0x8128, ~0 ); /* enable all write planes */
+     savage_out32( mmio, 0x812C, ~0 ); /* enable all read planes */
+     savage_out16( mmio, 0x8134, 0x27 );
+     savage_out16( mmio, 0x8136, 0x07 );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     SavageDeviceData *sdev = (SavageDeviceData*) device_data;
+
+     (void) sdev;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               savage3d_close_device( device, driver_data, device_data );
+               break;
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series  */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               savage4_close_device( device, driver_data, device_data );
+               break;
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000     */
+               savage2000_close_device( device, driver_data, device_data );
+               break;
+     }
+
+     D_DEBUG( "DirectFBSavage: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFBSavage:  %9d savage_waitfifo calls\n",
+               sdev->waitfifo_calls );
+     D_DEBUG( "DirectFBSavage:  %9d savage_waitidle calls\n",
+               sdev->waitidle_calls );
+     D_DEBUG( "DirectFBSavage:  %9d register writes (savage_waitfifo sum)\n",
+               sdev->waitfifo_sum );
+     D_DEBUG( "DirectFBSavage:  %9d FIFO wait cycles (depends on CPU)\n",
+               sdev->fifo_waitcycles );
+     D_DEBUG( "DirectFBSavage:  %9d IDLE wait cycles (depends on CPU)\n",
+               sdev->idle_waitcycles );
+     D_DEBUG( "DirectFBSavage:  %9d FIFO space cache hits(depends on CPU)\n",
+               sdev->fifo_cache_hits );
+     D_DEBUG( "DirectFBSavage: Conclusion:\n" );
+     D_DEBUG( "DirectFBSavage:  Average register writes/savage_waitfifo "
+               "call: %.2f\n",
+               sdev->waitfifo_sum/(float)(sdev->waitfifo_calls) );
+     D_DEBUG( "DirectFBSavage:  Average wait cycles/savage_waitfifo call:"
+               " %.2f\n",
+               sdev->fifo_waitcycles/(float)(sdev->waitfifo_calls) );
+     D_DEBUG( "DirectFBSavage:  Average wait cycles/savage_waitidle call:"
+               " %.2f\n",
+               sdev->idle_waitcycles/(float)(sdev->waitidle_calls) );
+     D_DEBUG( "DirectFBSavage:  Average fifo space cache hits: %02d%%\n",
+               (int)(100 * sdev->fifo_cache_hits/
+               (float)(sdev->waitfifo_calls)) );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_SAVAGE3D:       /* Savage3D series */
+          case FB_ACCEL_SAVAGE3D_MV:
+          case FB_ACCEL_SAVAGE_MX_MV:
+          case FB_ACCEL_SAVAGE_MX:
+          case FB_ACCEL_SAVAGE_IX_MV:
+          case FB_ACCEL_SAVAGE_IX:
+               savage3d_close_driver( device, driver_data );
+               break;
+
+          case FB_ACCEL_SAVAGE4:        /* Savage4 series  */
+          case FB_ACCEL_PROSAVAGE_PM:
+          case FB_ACCEL_PROSAVAGE_KM:
+          case FB_ACCEL_S3TWISTER_P:
+          case FB_ACCEL_S3TWISTER_K:
+               savage4_close_driver( device, driver_data );
+               break;
+
+          case FB_ACCEL_SAVAGE2000:     /* Savage 2000     */
+               savage2000_close_driver( device, driver_data );
+               break;
+     }
+
+     dfb_gfxcard_unmap_mmio( device, sdrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/savage/savage.h b/Source/DirectFB/gfxdrivers/savage/savage.h
new file mode 100755
index 0000000..2b9b7c8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage.h
@@ -0,0 +1,145 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE_H__
+#define __SAVAGE_H__
+
+#include <core/gfxcard.h>
+
+#define SRC_BASE             0xa4d4
+#define DEST_BASE            0xa4d8
+#define CLIP_L_R             0xa4dc
+#define CLIP_T_B             0xa4e0
+#define DEST_SRC_STR         0xa4e4
+#define MONO_PAT_0           0xa4e8
+#define MONO_PAT_1           0xa4ec
+
+
+#define BCI_BUFFER_OFFSET    0x10000
+
+#define MAXFIFO              0x7f00
+
+typedef struct {
+     unsigned int accel_id;
+
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int waitidle_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+
+     unsigned int fifo_space;
+
+     unsigned int bci_ptr;
+} SavageDeviceData;
+
+typedef struct {
+     volatile u8  *mmio_base;
+     volatile u32 *bci_base;
+} SavageDriverData;
+
+
+#if 0
+typedef struct S3SAVDRAWCTRLtag {
+ hwUI32 uED:1; // Enable Dithering
+ hwUI32 uUVO:1; // UV Offset Enable (add 0.5 to u and v 
+ hwUI32 uBCM:2; // Backface Cull Mode
+                // 00 - reserved
+                // 01 - disable culling
+                // 10 - cull clockwise
+                // 11 - cull counterclockwise
+ hwUI32 uTVC:1; // vertex counter reset 1 - reset it
+ hwUI32 uSM:1; // Shade Mode 0 - gouraud, 1 - flat (color at vertex 0)
+ hwUI32 uESS:1; // Enable Specular
+ hwUI32 uDABM:3; // Destination Alpha Blend Mode look below 
+ hwUI32 uSABM:3; // Source Alpha Blend Mode look below
+ hwUI32 uReserved1:1;
+ hwUI32 uATC:3; // Alpha Test Compare look below
+ hwUI32 uEAT:1; // Enable Alpha Test
+ hwUI32 uAlphaRef:8; // Alpha Reference Value 
+ hwUI32 uTBC:3; // Texture Blending Control (look below)
+ hwUI32 uFDW:1; // Flush Destination Writes 
+ hwUI32 uFZW:1; // Flush Z Writes
+ hwUI32 uIM:1; // Interpolaton Mode 1 - linear color and fog interpolation
+} S3SAVDRAWCTRL, *PS3SAVDRAWCTRL;
+#endif
+
+#define DRAWCTRL_ENABLE_DITHERING            0x00000001
+#define DRAWCTRL_ENABLE_UV_OFFSET            0x00000002
+#define DRAWCTRL_CULL_REVERSED               0x00000000
+#define DRAWCTRL_CULL_NONE                   0x00000004
+#define DRAWCTRL_CULL_CLOCKWISE              0x00000008
+#define DRAWCTRL_CULL_COUNTERCLOCKWISE       0x0000000C
+#define DRAWCTRL_VERTEX_COUNTER_RESET        0x00000010
+#define DRAWCTRL_SHADE_GOURAUD               0x00000000
+#define DRAWCTRL_SHADE_FLAT                  0x00000020
+#define DRAWCTRL_ENABLE_SPECULAR             0x00000040
+#define DRAWCTRL_ENABLE_ALPHA_TEST           0x00020000
+#define DRAWCTRL_FLUSH_DESTINATION_WRITES    0x20000000
+#define DRAWCTRL_FLUSH_Z_WRITES              0x40000000
+#define DRAWCTRL_COLOR_AND_FOG_INTERPOLATION 0x80000000
+
+#define DRAWCTRL_DABM_ZERO                   (0 << 7)
+#define DRAWCTRL_DABM_ONE                    (1 << 7)
+#define DRAWCTRL_DABM_SOURCE_COLOR           (2 << 7)
+#define DRAWCTRL_DABM_ONE_MINUS_SOURCE_COLOR (3 << 7)
+#define DRAWCTRL_DABM_SOURCE_ALPHA           (4 << 7)
+#define DRAWCTRL_DABM_ONE_MINUS_SOURCE_ALPHA (5 << 7)
+#define DRAWCTRL_DABM_6                      (6 << 7)
+#define DRAWCTRL_DABM_7                      (7 << 7)
+
+#define DRAWCTRL_SABM_ZERO                   (0 << 10)
+#define DRAWCTRL_SABM_ONE                    (1 << 10)
+#define DRAWCTRL_SABM_DEST_COLOR             (2 << 10)
+#define DRAWCTRL_SABM_ONE_MINUS_DEST_COLOR   (3 << 10)
+#define DRAWCTRL_SABM_SOURCE_ALPHA           (4 << 10)
+#define DRAWCTRL_SABM_ONE_MINUS_SOURCE_ALPHA (5 << 10)
+#define DRAWCTRL_SABM_6                      (6 << 10)
+#define DRAWCTRL_SABM_7                      (7 << 10)
+
+#define DRAWCTRL_ATC_NEVER                   (0 << 14)
+#define DRAWCTRL_ATC_LESS                    (1 << 14)
+#define DRAWCTRL_ATC_EQUAL                   (2 << 14)
+#define DRAWCTRL_ATC_LEQUAL                  (3 << 14)
+#define DRAWCTRL_ATC_GREATER                 (4 << 14)
+#define DRAWCTRL_ATC_NOTEQUAL                (5 << 14)
+#define DRAWCTRL_ATC_GEQUAL                  (6 << 14)
+#define DRAWCTRL_ATC_ALWAYS                  (7 << 14)
+
+#define DRAWCTRL_TBC_DECAL                   (0 << 26)
+#define DRAWCTRL_TBC_MODULATE                (1 << 26)
+#define DRAWCTRL_TBC_DECALALPHA              (2 << 26)
+#define DRAWCTRL_TBC_MODULATEALPHA           (3 << 26)
+#define DRAWCTRL_TBC_4                       (4 << 26)
+#define DRAWCTRL_TBC_5                       (5 << 26)
+#define DRAWCTRL_TBC_COPY                    (6 << 26)
+#define DRAWCTRL_TBC_7                       (7 << 26)
+
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/savage/savage2000.c b/Source/DirectFB/gfxdrivers/savage/savage2000.c
new file mode 100755
index 0000000..0f06ed1
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage2000.c
@@ -0,0 +1,199 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+
+#include <gfx/util.h>
+#include <misc/conf.h>
+
+#include "savage.h"
+#include "savage2000.h"
+#include "mmio.h"
+
+
+/* state validation */
+
+
+/* required implementations */
+
+static DFBResult savage2000EngineSync( void *drv, void *dev )
+{
+     Savage2000DriverData *sdrv = (Savage2000DriverData*) drv;
+     Savage2000DeviceData *sdev = (Savage2000DeviceData*) dev;
+     
+     savage2000_waitidle( sdrv, sdev );
+
+     return DFB_OK;
+}
+
+#define SAVAGE2000_DRAWING_FLAGS \
+               (DSDRAW_NOFX)
+
+#define SAVAGE2000_DRAWING_FUNCTIONS \
+               (DFXL_NONE)
+
+#define SAVAGE2000_BLITTING_FLAGS \
+               (DSBLIT_NOFX)
+
+#define SAVAGE2000_BLITTING_FUNCTIONS \
+               (DFXL_NONE)
+
+
+static void savage2000CheckState( void *drv, void *dev,
+                                  CardState *state, DFBAccelerationMask accel )
+{
+}
+
+static void savage2000SetState( void *drv, void *dev,
+                                GraphicsDeviceFuncs *funcs,
+                                CardState *state, DFBAccelerationMask accel )
+{
+}
+
+static bool savage2000FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     return false;
+}
+
+static bool savage2000DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     return false;
+}
+
+static bool savage2000DrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     return false;
+}
+
+static bool savage2000FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     return false;
+}
+
+static bool savage2000Blit( void *drv, void *dev,
+                            DFBRectangle *rect, int dx, int dy )
+{
+     return false;
+}
+
+static bool savage2000StretchBlit( void *drv, void *dev,
+                                   DFBRectangle *sr, DFBRectangle *dr )
+{
+     return false;
+}
+
+/* exported symbols */
+
+void
+savage2000_get_info( CoreGraphicsDevice *device,
+                     GraphicsDriverInfo *info )
+{
+     info->version.major = 0;
+     info->version.minor = 0;
+
+     info->driver_data_size = sizeof (Savage2000DriverData);
+     info->device_data_size = sizeof (Savage2000DeviceData);
+}
+
+DFBResult
+savage2000_init_driver( CoreGraphicsDevice  *device,
+                        GraphicsDeviceFuncs *funcs,
+                        void                *driver_data )
+{
+     funcs->CheckState    = savage2000CheckState;
+     funcs->SetState      = savage2000SetState;
+     funcs->EngineSync    = savage2000EngineSync;          
+
+     funcs->FillRectangle = savage2000FillRectangle;
+     funcs->DrawRectangle = savage2000DrawRectangle;
+     funcs->DrawLine      = savage2000DrawLine;
+     funcs->FillTriangle  = savage2000FillTriangle;
+     funcs->Blit          = savage2000Blit;
+     funcs->StretchBlit   = savage2000StretchBlit;
+
+     return DFB_OK;
+}
+
+DFBResult
+savage2000_init_device( CoreGraphicsDevice *device,
+                        GraphicsDeviceInfo *device_info,
+                        void               *driver_data,
+                        void               *device_data )
+{
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Savage2000 Series" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "S3" );
+
+
+     device_info->caps.flags    = 0;
+     device_info->caps.accel    = SAVAGE2000_DRAWING_FUNCTIONS |
+                                  SAVAGE2000_BLITTING_FUNCTIONS;
+     device_info->caps.drawing  = SAVAGE2000_DRAWING_FLAGS;
+     device_info->caps.blitting = SAVAGE2000_BLITTING_FLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 2048;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     return DFB_OK;
+}
+
+void
+savage2000_close_device( CoreGraphicsDevice *device,
+                         void               *driver_data,
+                         void               *device_data )
+{
+}
+
+void
+savage2000_close_driver( CoreGraphicsDevice *device,
+                         void               *driver_data )
+{
+}
+
diff --git a/Source/DirectFB/gfxdrivers/savage/savage2000.h b/Source/DirectFB/gfxdrivers/savage/savage2000.h
new file mode 100755
index 0000000..de67737
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage2000.h
@@ -0,0 +1,105 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE2000_H__
+#define __SAVAGE2000_H__
+
+#include <core/gfxcard.h>
+
+#include "savage.h"
+#include "mmio.h"
+
+typedef struct {
+     SavageDeviceData s;
+} Savage2000DeviceData;
+
+typedef struct {
+     SavageDriverData s;
+} Savage2000DriverData;
+
+void
+savage2000_get_info( CoreGraphicsDevice *device,
+                     GraphicsDriverInfo *info );
+
+DFBResult
+savage2000_init_driver( CoreGraphicsDevice  *device,
+                        GraphicsDeviceFuncs *funcs,
+                        void                *driver_data );
+
+DFBResult
+savage2000_init_device( CoreGraphicsDevice *device,
+                        GraphicsDeviceInfo *device_info,
+                        void               *driver_data,
+                        void               *device_data );
+
+void
+savage2000_close_device( CoreGraphicsDevice *device,
+                         void               *driver_data,
+                         void               *device_data );
+
+void
+savage2000_close_driver( CoreGraphicsDevice *device,
+                         void               *driver_data );
+
+
+#undef FIFOSTATUS
+#define FIFOSTATUS      0x48C60
+
+/* Wait for fifo space */
+static inline void
+savage2000_waitfifo(Savage2000DriverData *sdrv,
+                    Savage2000DeviceData *sdev, int space)
+{
+     uint32         slots = MAXFIFO - space;
+     volatile u8   *mmio  = sdrv->s.mmio_base;
+
+     sdev->s.waitfifo_sum += space;
+     sdev->s.waitfifo_calls++;
+     
+     if ((savage_in32(mmio, FIFOSTATUS) & 0x000fffff) > slots) {
+          do {
+               sdev->s.fifo_waitcycles++;
+          } while (savage_in32(mmio, FIFOSTATUS) > slots);
+     }
+     else {
+          sdev->s.fifo_cache_hits++;
+     }
+}
+
+/* Wait for idle accelerator */
+static inline void
+savage2000_waitidle(Savage2000DriverData *sdrv, Savage2000DeviceData *sdev)
+{
+     sdev->s.waitidle_calls++;
+
+     while (savage_in32(sdrv->s.mmio_base, FIFOSTATUS) & 0x009fffff) {
+          sdev->s.idle_waitcycles++;
+     }
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/savage/savage3d.c b/Source/DirectFB/gfxdrivers/savage/savage3d.c
new file mode 100755
index 0000000..4117b0e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage3d.c
@@ -0,0 +1,561 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include "savage.h"
+#include "savage_bci.h"
+#include "savage3d.h"
+#include "mmio.h"
+#include "savage_streams_old.h"
+
+
+
+/* required implementations */
+
+static DFBResult savage3DEngineSync( void *drv, void *dev )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+
+     savage3D_waitidle( sdrv, sdev );
+
+     return DFB_OK;
+}
+
+#define SAVAGE3D_DRAWING_FLAGS \
+               (DSDRAW_NOFX)
+
+#define SAVAGE3D_DRAWING_FUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE)
+
+#define SAVAGE3D_BLITTING_FLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define SAVAGE3D_BLITTING_FUNCTIONS \
+               (DFXL_BLIT)
+
+
+static inline void savage3D_validate_gbd( Savage3DDriverData *sdrv,
+                                          Savage3DDeviceData *sdev,
+                                          CardState          *state )
+{
+     u32 BitmapDescriptor;
+     CoreSurface *destination;
+     int bpp;
+
+
+     if (sdev->v_gbd)
+          return;
+
+     destination = state->destination;
+     bpp = DFB_BYTES_PER_PIXEL(destination->config.format);
+     
+     BitmapDescriptor = BCI_BD_BW_DISABLE | 8 | 1;
+     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
+     BCI_BD_SET_STRIDE( BitmapDescriptor, state->dst.pitch / bpp );
+
+     /* strange effects if we don't wait here for the Savage3D being idle */
+     savage3D_waitidle( sdrv, sdev );
+     
+     savage3D_waitfifo( sdrv, sdev, 4 );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD1 );
+     BCI_SEND( state->dst.offset );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD2 );
+     BCI_SEND( BitmapDescriptor );
+
+     sdev->v_gbd = 1;
+}
+
+static inline void savage3D_validate_pbd( Savage3DDriverData *sdrv,
+                                          Savage3DDeviceData *sdev,
+                                          CardState          *state )
+{
+     u32 BitmapDescriptor;
+     CoreSurface *source;
+     int bpp;
+
+
+     if (sdev->v_pbd)
+          return;
+
+     source = state->source;
+     bpp = DFB_BYTES_PER_PIXEL(source->config.format);
+     
+     BitmapDescriptor = BCI_BD_BW_DISABLE;
+     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
+     BCI_BD_SET_STRIDE( BitmapDescriptor, state->src.pitch / bpp );
+
+     
+     savage3D_waitfifo( sdrv, sdev, 4 );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD1 );
+     BCI_SEND( state->src.offset );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD2 );
+     BCI_SEND( BitmapDescriptor );
+     
+     sdev->v_pbd = 1;
+}
+
+static inline void savage3D_validate_color( Savage3DDriverData *sdrv,
+                                            Savage3DDeviceData *sdev,
+                                            CardState          *state )
+{
+     if (sdev->v_color)
+          return;
+
+     savage3D_waitfifo( sdrv, sdev, 2 );
+
+     BCI_SEND( BCI_CMD_NOP | BCI_CMD_SEND_COLOR );
+     
+     switch (state->destination->config.format) {
+          case DSPF_A8:
+               BCI_SEND( state->color.a );
+               break;
+          case DSPF_ARGB1555:
+               BCI_SEND( PIXEL_ARGB1555(state->color.a,
+                                        state->color.r,
+                                        state->color.g,
+                                        state->color.b) );
+               break;
+          case DSPF_RGB16:
+               BCI_SEND( PIXEL_RGB16(state->color.r,
+                                     state->color.g,
+                                     state->color.b) );
+               break;
+          case DSPF_RGB32:
+               BCI_SEND( PIXEL_RGB32(state->color.r,
+                                     state->color.g,
+                                     state->color.b) );
+               break;
+          case DSPF_ARGB:
+               BCI_SEND( PIXEL_ARGB(state->color.a,
+                                    state->color.r,
+                                    state->color.g,
+                                    state->color.b) );
+               break;
+          default:
+               D_ONCE( "unsupported destination format" );
+               break;
+     }
+
+     sdev->v_color = 1;
+}
+
+static inline void savage3D_set_clip( Savage3DDriverData *sdrv,
+                                      Savage3DDeviceData *sdev,
+                                      DFBRegion          *clip )
+{
+     savage3D_waitfifo( sdrv, sdev, 3 );
+
+     BCI_SEND( BCI_CMD_NOP | BCI_CMD_CLIP_NEW );
+
+     BCI_SEND( BCI_CLIP_TL( clip->y1, clip->x1 ) );
+     BCI_SEND( BCI_CLIP_BR( clip->y2, clip->x2 ) );
+}
+
+static void savage3DCheckState( void *drv, void *dev,
+                                CardState *state, DFBAccelerationMask accel )
+{
+     switch (state->destination->config.format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~SAVAGE3D_DRAWING_FLAGS)
+               return;
+
+          state->accel |= SAVAGE3D_DRAWING_FUNCTIONS;
+     }
+     else {
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          if (state->blittingflags & ~SAVAGE3D_BLITTING_FLAGS)
+               return;
+
+          state->accel |= SAVAGE3D_BLITTING_FUNCTIONS;
+     }
+}
+
+
+static void savage3DSetState( void *drv, void *dev,
+                              GraphicsDeviceFuncs *funcs,
+                              CardState *state, DFBAccelerationMask accel )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+     
+     if (state->mod_hw) {
+          if (state->mod_hw & SMF_DESTINATION)
+               sdev->v_gbd = sdev->v_color = 0;
+          else if (state->mod_hw & SMF_COLOR)
+               sdev->v_color = 0;
+
+          if (state->mod_hw & SMF_SOURCE)
+               sdev->v_pbd = 0;
+     }
+          
+     savage3D_validate_gbd( sdrv, sdev, state );
+     
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+          case DFXL_FILLTRIANGLE:
+               savage3D_validate_color( sdrv, sdev, state );
+
+               state->set |= SAVAGE3D_DRAWING_FUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               savage3D_validate_pbd( sdrv, sdev, state );
+
+               state->set |= SAVAGE3D_BLITTING_FUNCTIONS;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function!" );
+               return;
+     }
+
+     if (state->mod_hw & SMF_BLITTING_FLAGS) {
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+               sdev->Cmd_Src_Transparent = BCI_CMD_SRC_TRANSPARENT |
+                                           BCI_CMD_SEND_COLOR;
+          else
+               sdev->Cmd_Src_Transparent = 0;
+     }
+
+     if (state->mod_hw & SMF_CLIP)
+          savage3D_set_clip( sdrv, sdev, &state->clip );
+
+     if (state->mod_hw & SMF_SRC_COLORKEY)
+          sdev->src_colorkey = state->src_colorkey;
+     
+     state->mod_hw = 0;
+}
+
+static bool savage3DFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+     
+     savage3D_waitfifo( sdrv, sdev, 3 );
+
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+
+     BCI_SEND( BCI_X_Y(rect->x, rect->y) );
+     BCI_SEND( BCI_W_H(rect->w, rect->h) );
+
+     return true;
+}
+
+static bool savage3DDrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+     
+     savage3D_waitfifo( sdrv, sdev, 12 );
+
+     /* first line */
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
+     BCI_SEND( BCI_W_H( 1 , rect->h) );     
+
+     /* second line */
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
+     BCI_SEND( BCI_W_H( rect->w , 1 ) );
+     
+     /* third line */
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( BCI_X_Y( rect->x, rect->y+rect->h-1 ) );
+     BCI_SEND( BCI_W_H( rect->w , 1 ) );     
+     
+     /* fourth line */
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
+          BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+          BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( BCI_X_Y( rect->x+rect->w-1, rect->y ) );
+     BCI_SEND( BCI_W_H( 1 , rect->h ) );
+
+     return true;
+}
+
+static bool savage3DDrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+     
+     int dx, dy;
+     int min, max, xp, yp, ym;
+     
+
+     dx = line->x2 - line->x1;
+     dy = line->y2 - line->y1;
+
+     xp = (dx >= 0);
+     if (!xp)
+          dx = -dx;
+
+     yp = (dy >= 0);
+     if (!yp)
+          dy = -dy;
+
+     ym = (dy > dx);
+     if (ym) {
+          max = dy + 1;
+          min = dx;
+     }
+     else {
+          max = dx + 1;
+          min = dy;
+     }
+
+     savage3D_waitfifo( sdrv, sdev, 4 );
+    
+     BCI_SEND( BCI_CMD_LINE_LAST_PIXEL | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+    
+     BCI_SEND( BCI_LINE_X_Y( line->x1, line->y1 ) );
+     BCI_SEND( BCI_LINE_STEPS( 2 * (min - max), 2 * min ) );
+     BCI_SEND( BCI_LINE_MISC( max, ym, xp, yp, 2 * min - max ) );
+
+     return true;
+}
+
+static bool savage3DFillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     return false;
+}
+
+static bool savage3DBlit( void *drv, void *dev,
+                          DFBRectangle *rect, int dx, int dy )
+{
+     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
+     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
+
+     u32 cmd = ( BCI_CMD_RECT | sdev->Cmd_Src_Transparent |
+                 BCI_CMD_CLIP_CURRENT | BCI_CMD_DEST_GBD |
+                 BCI_CMD_SRC_PBD_COLOR | (0xcc << 16) );
+     
+     if (dx < rect->x) {
+          cmd |= BCI_CMD_RECT_XP;
+     } 
+     else {
+          dx      += rect->w - 1;
+          rect->x += rect->w - 1;
+     }
+
+     if (dy < rect->y) { 
+          cmd |= BCI_CMD_RECT_YP;
+     }
+     else {
+          dy      += rect->h - 1;
+          rect->y += rect->h - 1;
+     }
+
+     savage3D_waitfifo( sdrv, sdev, sdev->Cmd_Src_Transparent ? 5 : 4 );
+
+     BCI_SEND( cmd );
+
+     /* we always have to send the colorkey,
+        but at least it does not clobber the fill color */
+     if (sdev->Cmd_Src_Transparent)
+          BCI_SEND( sdev->src_colorkey );
+
+     BCI_SEND( BCI_X_Y( rect->x, rect->y ) );
+     BCI_SEND( BCI_X_Y( dx, dy ) );
+     BCI_SEND( BCI_W_H( rect->w, rect->h ) );
+
+     return true;
+}
+
+static bool savage3DStretchBlit( void *drv, void *dev,
+                                 DFBRectangle *sr, DFBRectangle *dr )
+{
+     return false;
+}
+
+static void savage3DAfterSetVar( void *drv, void *dev )
+{
+}
+
+/* exported symbols */
+
+void
+savage3d_get_info( CoreGraphicsDevice *device,
+                   GraphicsDriverInfo *info )
+{
+     info->version.major = 0;
+     info->version.minor = 3;
+
+     info->driver_data_size = sizeof (Savage3DDriverData);
+     info->device_data_size = sizeof (Savage3DDeviceData);
+}
+
+DFBResult
+savage3d_init_driver( CoreGraphicsDevice  *device,
+                      GraphicsDeviceFuncs *funcs,
+                      void                *driver_data )
+{
+     funcs->CheckState    = savage3DCheckState;
+     funcs->SetState      = savage3DSetState;
+     funcs->EngineSync    = savage3DEngineSync;          
+     funcs->AfterSetVar   = savage3DAfterSetVar;
+
+     funcs->FillRectangle = savage3DFillRectangle;
+     funcs->DrawRectangle = savage3DDrawRectangle;
+     funcs->DrawLine      = savage3DDrawLine;
+     funcs->FillTriangle  = savage3DFillTriangle;
+     funcs->Blit          = savage3DBlit;
+     funcs->StretchBlit   = savage3DStretchBlit;
+
+     return DFB_OK;
+}
+
+DFBResult
+savage3d_init_device( CoreGraphicsDevice *device,
+                      GraphicsDeviceInfo *device_info,
+                      void               *driver_data,
+                      void               *device_data )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     volatile u8      *mmio = sdrv->mmio_base;
+
+     unsigned long	cobIndex;	/* size index */
+     unsigned long	cobSize;	/* size in bytes */
+     unsigned long	cobOffset;	/* offset in frame buffer */
+     
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Savage3D Series" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "S3" );
+
+
+     device_info->caps.flags    = CCF_CLIPPING;
+     device_info->caps.accel    = SAVAGE3D_DRAWING_FUNCTIONS |
+                                  SAVAGE3D_BLITTING_FUNCTIONS;
+     device_info->caps.drawing  = SAVAGE3D_DRAWING_FLAGS;
+     device_info->caps.blitting = SAVAGE3D_BLITTING_FLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 2048;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     
+  	 cobIndex = 7;
+	 cobSize = 0x400 << cobIndex;
+	 cobOffset = dfb_gfxcard_reserve_memory( device, cobSize );
+     
+     
+         /*  savage_out32( 0x8504, 0x00008000 );  */
+     
+     /* Disable BCI */
+	 savage_out32( mmio, 0x48C18,
+                   savage_in32( mmio, 0x48C18 ) & 0x3FF0);
+
+	 /* Setup BCI command overflow buffer */
+	 savage_out32( mmio, 0x48C14, (cobOffset >> 11) | (cobIndex << 29));
+
+	 /* Program shadow status update. */
+	 savage_out32( mmio, 0x48C10, 0x78207220);
+	 savage_out32( mmio, 0x48C0C, 0);
+	    
+     /* Enable BCI and command overflow buffer */
+	 savage_out32( mmio, 0x48C18, savage_in32( mmio, 0x48C18 ) | 0x0C);
+     
+     return DFB_OK;
+}
+
+void
+savage3d_close_device( CoreGraphicsDevice *device,
+                       void               *driver_data,
+                       void               *device_data )
+{
+}
+
+void
+savage3d_close_driver( CoreGraphicsDevice *device,
+                       void               *driver_data )
+{
+}
+
diff --git a/Source/DirectFB/gfxdrivers/savage/savage3d.h b/Source/DirectFB/gfxdrivers/savage/savage3d.h
new file mode 100755
index 0000000..d693c34
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage3d.h
@@ -0,0 +1,121 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE3D_H__
+#define __SAVAGE3D_H__
+
+#include <core/gfxcard.h>
+
+#include "savage.h"
+#include "mmio.h"
+
+
+typedef struct {
+     SavageDeviceData s;
+
+     /* state validation */
+     int v_gbd;      /* destination */
+     int v_pbd;      /* source */
+     int v_color;    /* opaque fill color */
+
+     /* saved values */
+     u32 Cmd_Src_Transparent;
+     u32 src_colorkey;
+} Savage3DDeviceData;
+
+typedef struct {
+     SavageDriverData s;
+} Savage3DDriverData;
+
+
+void
+savage3d_get_info( CoreGraphicsDevice *device,
+                   GraphicsDriverInfo *info );
+
+DFBResult
+savage3d_init_driver( CoreGraphicsDevice  *device,
+                      GraphicsDeviceFuncs *funcs,
+                      void                *driver_data );
+
+DFBResult
+savage3d_init_device( CoreGraphicsDevice *device,
+                      GraphicsDeviceInfo *device_info,
+                      void               *driver_data,
+                      void               *device_data );
+
+void
+savage3d_close_device( CoreGraphicsDevice *device,
+                       void               *driver_data,
+                       void               *device_data );
+
+void
+savage3d_close_driver( CoreGraphicsDevice *device,
+                       void               *driver_data );
+
+
+#define FIFOSTATUS      0x48C00
+#define TILEDAPERTURE0	0x48C40
+#define TILEDAPERTURE1	0x48C44
+#define TILEDAPERTURE2	0x48C48
+#define TILEDAPERTURE3	0x48C4C
+#define TILEDAPERTURE4	0x48C50
+#define TILEDAPERTURE5	0x48C54
+
+
+/* Wait for fifo space */
+static inline void
+savage3D_waitfifo(Savage3DDriverData *sdrv, Savage3DDeviceData *sdev, int space)
+{
+     uint32         slots = MAXFIFO - space;
+     volatile u8   *mmio  = sdrv->s.mmio_base;
+
+     sdev->s.waitfifo_sum += space;
+     sdev->s.waitfifo_calls++;
+     
+     if ((savage_in32(mmio, FIFOSTATUS) & 0x0000ffff) > slots) {
+          do {
+               sdev->s.fifo_waitcycles++;
+          } while ((savage_in32(mmio, FIFOSTATUS) & 0x0000ffff) > slots);
+     }
+     else {
+          sdev->s.fifo_cache_hits++;
+     }
+}
+
+/* Wait for idle accelerator */
+static inline void
+savage3D_waitidle(Savage3DDriverData *sdrv, Savage3DDeviceData *sdev)
+{
+     sdev->s.waitidle_calls++;
+
+     while ((savage_in32(sdrv->s.mmio_base, FIFOSTATUS) & 0x0008ffff) != 0x80000) {
+          sdev->s.idle_waitcycles++;
+     }
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/savage/savage4.c b/Source/DirectFB/gfxdrivers/savage/savage4.c
new file mode 100755
index 0000000..2026fe7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage4.c
@@ -0,0 +1,599 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+
+#include "savage.h"
+#include "savage4.h"
+#include "mmio.h"
+#include "savage_bci.h"
+/*
+ * (comment stolen from xfree86 savage driver).
+ * There are two different streams engines used in the Savage line.
+ * The old engine is in the 3D, 4, Pro, and Twister.
+ * The new engine is in the 2000, MX, IX, and Super.
+ */
+#include "savage_streams_old.h"
+
+/* #define SAVAGE_DEBUG */
+#ifdef SAVAGE_DEBUG
+#define SVGDBG(x...) fprintf(stderr, "savage4:" x)
+#else
+#define SVGDBG(x...)
+#endif
+
+/* required implementations */
+
+static DFBResult savage4EngineSync( void *drv, void *dev )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+     
+     SVGDBG("savage4enginesync\n");
+     savage4_waitidle( sdrv, sdev );
+
+     return DFB_OK;
+}
+
+#define SAVAGE4_DRAWING_FLAGS \
+               (DSDRAW_NOFX)
+
+#define SAVAGE4_DRAWING_FUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE)
+
+#define SAVAGE4_BLITTING_FLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define SAVAGE4_BLITTING_FUNCTIONS \
+               (DFXL_BLIT)
+
+
+static inline void savage4_validate_gbd( Savage4DriverData *sdrv,
+                                         Savage4DeviceData *sdev,
+                                         CardState         *state )
+{
+     u32 BitmapDescriptor;
+     CoreSurface *destination;
+     int bpp;
+
+     if (sdev->v_gbd)
+          return;
+
+     destination = state->destination;
+     bpp = DFB_BYTES_PER_PIXEL(destination->config.format);
+     
+     BitmapDescriptor = BCI_BD_BW_DISABLE | 8 | 1;
+     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
+     BCI_BD_SET_STRIDE( BitmapDescriptor, state->dst.pitch / bpp );
+
+     /* strange effects if we don't wait here for the Savage4 being idle */
+     savage4_waitidle( sdrv, sdev );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD1 );
+     BCI_SEND( state->dst.offset );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD2 );
+     BCI_SEND( BitmapDescriptor );
+
+     sdev->v_gbd = 1;
+}
+
+static inline void savage4_validate_pbd( Savage4DriverData *sdrv,
+                                         Savage4DeviceData *sdev,
+                                         CardState         *state )
+{
+     u32 BitmapDescriptor;
+     CoreSurface *source;
+     int bpp;
+
+     if (sdev->v_pbd)
+          return;
+
+     source = state->source;
+     bpp = DFB_BYTES_PER_PIXEL(source->config.format);
+     
+     BitmapDescriptor = BCI_BD_BW_DISABLE;
+     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
+     BCI_BD_SET_STRIDE( BitmapDescriptor, state->src.pitch / bpp );
+
+     
+     savage4_waitidle( sdrv, sdev );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD1 );
+     BCI_SEND( state->src.offset );
+
+     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD2 );
+     BCI_SEND( BitmapDescriptor );
+     
+     sdev->v_pbd = 1;
+}
+
+static inline void savage4_validate_color( Savage4DeviceData *sdev,
+                                           CardState         *state )
+{
+     if (sdev->v_color)
+          return;
+     
+     switch (state->destination->config.format) {
+          case DSPF_A8:
+               sdev->Fill_Color = state->color.a;
+               break;
+          case DSPF_ARGB1555:
+               sdev->Fill_Color = PIXEL_ARGB1555(state->color.a,
+                                                 state->color.r,
+                                                 state->color.g,
+                                                 state->color.b);
+               break;
+          case DSPF_RGB16:
+               sdev->Fill_Color = PIXEL_RGB16(state->color.r,
+                                              state->color.g,
+                                              state->color.b);
+               break;
+          case DSPF_RGB32:
+               sdev->Fill_Color = PIXEL_RGB32(state->color.r,
+                                              state->color.g,
+                                              state->color.b);
+               break;
+          case DSPF_ARGB:
+               sdev->Fill_Color = PIXEL_ARGB(state->color.a,
+                                             state->color.r,
+                                             state->color.g,
+                                             state->color.b);
+               break;
+          case DSPF_RGB332:
+               sdev->Fill_Color = PIXEL_RGB332(state->color.r,
+                                               state->color.g,
+                                               state->color.b);
+               break;
+          default:
+               D_BUG( "unexpected destination format" );
+               break;
+     }
+
+     sdev->v_color = 1;
+}
+
+static inline void savage4_set_clip( Savage4DriverData *sdrv,
+                                     Savage4DeviceData *sdev,
+                                     DFBRegion         *clip )
+{
+     SVGDBG("savage4_set_clip x1:%i y1:%i x2:%i y2:%i\n",
+            clip->x1, clip->y1, clip->x2, clip->y2);
+     savage4_waitfifo( sdrv, sdev, 3 );
+
+     BCI_SEND( BCI_CMD_NOP | BCI_CMD_CLIP_NEW );
+
+     BCI_SEND( BCI_CLIP_TL( clip->y1, clip->x1 ) );
+     BCI_SEND( BCI_CLIP_BR( clip->y2, clip->x2 ) );
+}
+
+static void savage4CheckState( void *drv, void *dev,
+                               CardState *state, DFBAccelerationMask accel )
+{
+     SVGDBG("savage4checkstate\n");
+     switch (state->destination->config.format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_RGB332:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          if (state->drawingflags & ~SAVAGE4_DRAWING_FLAGS)
+               return;
+
+          state->accel |= SAVAGE4_DRAWING_FUNCTIONS;
+     }
+     else {
+          if (state->source->config.format != state->destination->config.format)
+               return;
+
+          if (state->blittingflags & ~SAVAGE4_BLITTING_FLAGS)
+               return;
+
+          state->accel |= SAVAGE4_BLITTING_FUNCTIONS;
+     }
+}
+
+static void savage4SetState( void *drv, void *dev,
+                             GraphicsDeviceFuncs *funcs,
+                             CardState *state, DFBAccelerationMask accel )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+     
+     SVGDBG("savage4setstate\n");
+     if (state->mod_hw) {
+          if (state->mod_hw & SMF_DESTINATION)
+               sdev->v_gbd = sdev->v_color = 0;
+          else if (state->mod_hw & SMF_COLOR)
+               sdev->v_color = 0;
+
+          if (state->mod_hw & SMF_SOURCE)
+               sdev->v_pbd = 0;
+     }
+     
+     savage4_validate_gbd( sdrv, sdev, state );
+     
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+          case DFXL_FILLTRIANGLE:
+               savage4_validate_color( sdev, state );
+
+               state->set |= SAVAGE4_DRAWING_FUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               savage4_validate_pbd( sdrv, sdev, state );
+               
+               state->set |= SAVAGE4_BLITTING_FUNCTIONS;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function!" );
+               return;
+     }
+
+     if (state->mod_hw & SMF_BLITTING_FLAGS) {
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+               sdev->Cmd_Src_Transparent = BCI_CMD_SRC_TRANSPARENT |
+                                           BCI_CMD_SEND_COLOR;
+          else
+               sdev->Cmd_Src_Transparent = 0;
+     }
+
+     if (state->mod_hw & SMF_CLIP)
+          savage4_set_clip( sdrv, sdev, &state->clip );
+     
+     if (state->mod_hw & SMF_SRC_COLORKEY)
+          sdev->src_colorkey = state->src_colorkey;
+
+     state->mod_hw = 0;
+}
+
+
+static bool savage4FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+
+     savage4_waitfifo( sdrv, sdev, 4 );
+
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_SEND_COLOR |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( sdev->Fill_Color );
+     
+     BCI_SEND( BCI_X_Y(rect->x, rect->y) );
+     BCI_SEND( BCI_W_H(rect->w, rect->h) );
+
+     return true;
+}
+
+static bool savage4DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+     
+     savage4_waitfifo( sdrv, sdev, 13 );
+
+     /* first line */
+     BCI_SEND( BCI_CMD_RECT | BCI_CMD_SEND_COLOR |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+     
+     BCI_SEND( sdev->Fill_Color );
+     
+     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
+     BCI_SEND( BCI_W_H( 1 , rect->h) );     
+
+     /* second line */
+     BCI_SEND( BCI_CMD_RECT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+
+     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
+     BCI_SEND( BCI_W_H( rect->w , 1 ) );
+
+     /* third line */
+     BCI_SEND( BCI_CMD_RECT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+
+     BCI_SEND( BCI_X_Y( rect->x, rect->y+rect->h-1 ) );
+     BCI_SEND( BCI_W_H( rect->w , 1 ) );     
+     
+          
+     /* fourth line */
+     BCI_SEND( BCI_CMD_RECT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+
+     BCI_SEND( BCI_X_Y( rect->x+rect->w-1, rect->y ) );
+     BCI_SEND( BCI_W_H( 1 , rect->h ) );
+
+     return true;
+}
+
+static bool savage4DrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+     
+     int dx, dy;
+     int min, max, xp, yp, ym;
+     
+
+     dx = line->x2 - line->x1;
+     dy = line->y2 - line->y1;
+
+     xp = (dx >= 0);
+     if (!xp)
+          dx = -dx;
+
+     yp = (dy >= 0);
+     if (!yp)
+          dy = -dy;
+
+     ym = (dy > dx);
+     if (ym) {
+          max = dy + 1;
+          min = dx;
+     }
+     else {
+          max = dx + 1;
+          min = dy;
+     }
+
+     savage4_waitfifo( sdrv, sdev, 5 );
+    
+     BCI_SEND( BCI_CMD_LINE_LAST_PIXEL | BCI_CMD_CLIP_CURRENT |
+               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_SEND_COLOR |
+               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
+    
+     BCI_SEND( sdev->Fill_Color );
+     
+     BCI_SEND( BCI_LINE_X_Y( line->x1, line->y1 ) );
+     BCI_SEND( BCI_LINE_STEPS( 2 * (min - max), 2 * min ) );
+     BCI_SEND( BCI_LINE_MISC( max, ym, xp, yp, 2 * min - max ) );
+
+     return true;
+}
+
+static bool savage4FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     return false;
+}
+
+static bool savage4Blit( void *drv, void *dev,
+                         DFBRectangle *rect, int dx, int dy )
+{
+     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
+     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
+     
+     u32 cmd = ( BCI_CMD_RECT | sdev->Cmd_Src_Transparent |
+                 BCI_CMD_CLIP_CURRENT | BCI_CMD_DEST_GBD |
+                 BCI_CMD_SRC_PBD_COLOR | (0xcc << 16) );
+ 
+     SVGDBG("savage4Blit x:%i y:%i w:%i h:%i dx:%i dy:%i\n",
+            rect->x, rect->y, rect->w, rect->h, dx, dy);
+
+     if (dx < rect->x && dx >= 0) {
+          cmd |= BCI_CMD_RECT_XP; /* left to right */
+     } 
+     else {
+          dx      += rect->w - 1;
+          rect->x += rect->w - 1;
+     }
+
+     if (dy < rect->y && dy >= 0) { 
+          cmd |= BCI_CMD_RECT_YP; /* top to bottom */
+     }
+     else {
+          dy      += rect->h - 1;
+          rect->y += rect->h - 1;
+     }
+
+     savage4_waitfifo( sdrv, sdev, sdev->Cmd_Src_Transparent ? 5 : 4 );
+
+     BCI_SEND( cmd );
+
+     /* we always have to send the colorkey,
+        but at least it does not clobber the fill color */
+     if (sdev->Cmd_Src_Transparent)
+          BCI_SEND( sdev->src_colorkey );
+
+     BCI_SEND( BCI_X_Y( rect->x, rect->y ) );
+     BCI_SEND( BCI_X_Y( dx, dy ) );
+     BCI_SEND( BCI_W_H( rect->w, rect->h ) );
+
+     return true;
+}
+
+static bool savage4StretchBlit( void *drv, void *dev,
+                                DFBRectangle *sr, DFBRectangle *dr )
+{
+     return false;
+}
+
+static void savage4AfterSetVar( void *drv, void *dev )
+{
+     SVGDBG("savage4aftersetvar\n");
+}
+
+/* exported symbols */
+
+void
+savage4_get_info( CoreGraphicsDevice *device,
+                  GraphicsDriverInfo *info )
+{
+     SVGDBG("savage4getinfo\n");
+     info->version.major = 0;
+     info->version.minor = 3;
+
+     info->driver_data_size = sizeof (Savage4DriverData);
+     info->device_data_size = sizeof (Savage4DeviceData);
+}
+
+DFBResult
+savage4_init_driver( CoreGraphicsDevice  *device,
+                     GraphicsDeviceFuncs *funcs,
+                     void                *driver_data )
+{
+     SVGDBG("savage4initdriver\n");
+     funcs->CheckState    = savage4CheckState;
+     funcs->SetState      = savage4SetState;
+     funcs->EngineSync    = savage4EngineSync;          
+
+     funcs->AfterSetVar   = savage4AfterSetVar;
+
+     funcs->FillRectangle = savage4FillRectangle;
+     funcs->DrawRectangle = savage4DrawRectangle;
+     funcs->DrawLine      = savage4DrawLine;
+     funcs->FillTriangle  = savage4FillTriangle;
+     funcs->Blit          = savage4Blit;
+     funcs->StretchBlit   = savage4StretchBlit;
+
+     /* setup primary layer functions */
+//     dfb_layers_hook_primary(device, driver_data, &savagePrimaryFuncs,
+//                             &savage_pfuncs, &savage_pdriver_data);
+
+     /* setup secondary layer functions */
+ //    dfb_layers_register(device, driver_data, &savageSecondaryFuncs);
+
+     return DFB_OK;
+}
+
+DFBResult
+savage4_init_device( CoreGraphicsDevice *device,
+                     GraphicsDeviceInfo *device_info,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     volatile u8      *mmio = sdrv->mmio_base;
+
+     SVGDBG("savage4initdevice\n");
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Savage4 Series" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "S3" );
+
+
+     device_info->caps.flags    = CCF_CLIPPING;
+     device_info->caps.accel    = SAVAGE4_DRAWING_FUNCTIONS |
+                                  SAVAGE4_BLITTING_FUNCTIONS;
+     device_info->caps.drawing  = SAVAGE4_DRAWING_FLAGS;
+     device_info->caps.blitting = SAVAGE4_BLITTING_FLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 2048;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     
+     vga_out8( mmio, 0x3d4, CR_SYSCONF );
+     vga_out8( mmio, 0x3d5, CR_SYSCONF_ENABLE_2D_ENGINE_IO_ACCESS );
+
+     vga_out8( mmio, 0x3d4, CR_MEMCONF );
+     vga_out8( mmio, 0x3d5, CR_MEMCONF_ENABLE_VGA_16BIT_IO_ACCESS |
+                            CR_MEMCONF_ENHANCED_MODE_MEMORY_MAPPING );
+
+
+     /* Setup plane masks */
+     savage_out32( mmio, SAVAGE_2D_WRITE_MASK, ~0 );
+     savage_out32( mmio, SAVAGE_2D_READ_MASK, ~0 );
+     savage_out16( mmio, SAVAGE_2D_BACKGROUND_MIX, 0x03 );
+     savage_out16( mmio, SAVAGE_2D_FOREGROUND_MIX, 0x27 );
+
+     /* Disable BCI */
+     savage_out32( mmio, SAVAGE_COMMAND_OVERFLOW_BUFFER_POINTERS,
+                              (savage_in32( mmio, 0x48C18)) & 0x3FF0);
+
+     /* Program shadow status update */
+     savage_out32( mmio, 0x48C10, 0x00700040);
+
+     savage_out32( mmio, 0x48C0C, 0);
+
+     /* Enable BCI without the COB */
+     savage_out32( mmio, SAVAGE_COMMAND_OVERFLOW_BUFFER_POINTERS,
+                              (savage_in32( mmio, 0x48C18)) | 0x08);
+     
+     return DFB_OK;
+}
+
+void
+savage4_close_device( CoreGraphicsDevice *device,
+                      void               *driver_data,
+                      void               *device_data )
+{
+     SVGDBG("savage4closedevice\n");
+}
+
+void
+savage4_close_driver( CoreGraphicsDevice *device,
+                      void               *driver_data )
+{
+     SVGDBG("savage4closedriver\n");
+}
+/* end of code */
diff --git a/Source/DirectFB/gfxdrivers/savage/savage4.h b/Source/DirectFB/gfxdrivers/savage/savage4.h
new file mode 100755
index 0000000..ca46f9f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage4.h
@@ -0,0 +1,146 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE4_H__
+#define __SAVAGE4_H__
+
+#include <core/gfxcard.h>
+
+#include "mmio.h"
+
+typedef struct {
+     SavageDeviceData s;
+
+     /* state validation */
+     int v_gbd;      /* destination */
+     int v_pbd;      /* source */
+     int v_color;    /* opaque fill color */
+
+     /* saved values */
+     u32 Cmd_Src_Transparent;
+     u32 Fill_Color;
+     u32 src_colorkey;
+} Savage4DeviceData;
+
+typedef struct {
+     SavageDriverData s;
+} Savage4DriverData;
+
+
+void
+savage4_get_info( CoreGraphicsDevice *device,
+                  GraphicsDriverInfo *info );
+
+DFBResult
+savage4_init_driver( CoreGraphicsDevice  *device,
+                     GraphicsDeviceFuncs *funcs,
+                     void                *driver_data );
+
+DFBResult
+savage4_init_device( CoreGraphicsDevice *device,
+                     GraphicsDeviceInfo *device_info,
+                     void               *driver_data,
+                     void               *device_data );
+
+void
+savage4_close_device( CoreGraphicsDevice *device,
+                      void               *driver_data,
+                      void               *device_data );
+
+void
+savage4_close_driver( CoreGraphicsDevice *device,
+                      void               *driver_data );
+
+
+#define CR_MEMCONF                              0x31
+#define CR_MEMCONF_ENABLE_VGA_16BIT_IO_ACCESS   0x04
+#define CR_MEMCONF_ENHANCED_MODE_MEMORY_MAPPING 0x08
+
+#define CR_SYSCONF                              0x40
+#define CR_SYSCONF_ENABLE_2D_ENGINE_IO_ACCESS   0x01
+
+
+#define SAVAGE_2D_WRITE_MASK                    0x8128
+#define SAVAGE_2D_READ_MASK                     0x812C
+#define SAVAGE_2D_BACKGROUND_MIX                0x8134
+#define SAVAGE_2D_FOREGROUND_MIX                0x8136
+
+
+/* Configuration/Status Registers */
+
+#define SAVAGE_STATUS_WORD0                     0x48C00
+#define SAVAGE_STATUS_WORD1                     0x48C04
+#define SAVAGE_STATUS_WORD2                     0x48C08
+#define SAVAGE_SHADOW_STATUS_ADDRESS            0x48C0C
+#define SAVAGE_COMMAND_BUFFER_THRESHOLDS        0x48C10
+#define SAVAGE_COMMAND_OVERFLOW_BUFFER          0x48C14
+#define SAVAGE_COMMAND_OVERFLOW_BUFFER_POINTERS 0x48C18
+#define SAVAGE_VERTEX_BUFFER_ADDRESS            0x48C20
+#define SAVAGE_BCI_POWER_MANAGEMENT             0x48C24
+#define SAVAGE_TILED_SURFACE0                   0x48C40
+#define SAVAGE_TILED_SURFACE1                   0x48C44
+#define SAVAGE_TILED_SURFACE2                   0x48C48
+#define SAVAGE_TILED_SURFACE3                   0x48C4C
+#define SAVAGE_TILED_SURFACE4                   0x48C50
+#define SAVAGE_ALTERNATE_STATUS_WORD0           0x48C60
+#define SAVAGE_ALTERNATE_STATUS_WORD1           0x48C64
+
+
+/* Wait for fifo space */
+static inline void
+savage4_waitfifo(Savage4DriverData *sdrv, Savage4DeviceData *sdev, int space)
+{
+     uint32         slots = MAXFIFO - space;
+     volatile u8   *mmio  = sdrv->s.mmio_base;
+
+     sdev->s.waitfifo_sum += space;
+     sdev->s.waitfifo_calls++;
+     
+     if ((savage_in32(mmio, SAVAGE_ALTERNATE_STATUS_WORD0) & 0x001fffff) > slots) {
+          do {
+               sdev->s.fifo_waitcycles++;
+          } while ((savage_in32(mmio, SAVAGE_ALTERNATE_STATUS_WORD0) & 0x001fffff) > slots);
+     }
+     else {
+          sdev->s.fifo_cache_hits++;
+     }
+}
+
+/* Wait for idle accelerator */
+static inline void
+savage4_waitidle(Savage4DriverData *sdrv, Savage4DeviceData *sdev)
+{
+     sdev->s.waitidle_calls++;
+
+     while ((savage_in32(sdrv->s.mmio_base, SAVAGE_ALTERNATE_STATUS_WORD0) & 0x00a00000) != 0x00a00000) {
+          sdev->s.idle_waitcycles++;
+     }
+}
+
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/savage/savage_bci.h b/Source/DirectFB/gfxdrivers/savage/savage_bci.h
new file mode 100755
index 0000000..12ff14a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage_bci.h
@@ -0,0 +1,208 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 _S3BCI_H_
+#define _S3BCI_H_
+
+#define REVERSE_BYTE_ORDER32(dword) {\
+    unsigned int temp; \
+    dword =  (temp & 0xFF) << 24; \
+    dword |= (temp & 0xFF00) << 8; \
+    dword |= (temp & 0xFF0000) >> 8; \
+    dword |= (temp & 0xFF000000) >> 24; }
+
+
+#define BCI_SIZE 0x4000
+
+#define BCI_SEND(dw)   { \
+                           if (sdev->s.bci_ptr == BCI_SIZE) sdev->s.bci_ptr = 0; \
+                           sdrv->s.bci_base[sdev->s.bci_ptr++] = (u32)(dw); \
+                       }
+
+#define BCI_SENDF(dw)  { \
+                           if (sdev->s.bci_ptr == BCI_SIZE) sdev->s.bci_ptr = 0; \
+                           ((float*)sdrv->s.bci_base)[sdev->s.bci_ptr++] = (float)(dw); \
+                       }
+
+
+#define BCI_CMD_NOP                  0x40000000
+//#define BCI_CMD_SETREG               0x96000000 /* 8}CMD | 8}count | 16}index */
+#define BCI_CMD_RECT                 0x48000000
+#define BCI_CMD_RECT_XP              0x01000000
+#define BCI_CMD_RECT_YP              0x02000000
+#define BCI_CMD_SCANLINE             0x50000000
+#define BCI_CMD_LINE                 0x5C000000
+#define BCI_CMD_LINE_LAST_PIXEL      0x58000000
+#define BCI_CMD_BYTE_TEXT            0x63000000
+#define BCI_CMD_NT_BYTE_TEXT         0x67000000
+#define BCI_CMD_BIT_TEXT             0x6C000000
+#define BCI_CMD_GET_ROP(cmd)         (((cmd) >> 16) & 0xFF)
+#define BCI_CMD_SET_ROP(cmd, rop)    ((cmd) |= ((rop & 0xFF) << 16))
+#define BCI_CMD_SEND_COLOR           0x00008000
+
+#define BCI_CMD_CLIP_NONE            0x00000000
+#define BCI_CMD_CLIP_CURRENT         0x00002000
+#define BCI_CMD_CLIP_LR              0x00004000
+#define BCI_CMD_CLIP_NEW             0x00006000
+
+#define BCI_CMD_DEST_GBD             0x00000000
+#define BCI_CMD_DEST_PBD             0x00000800
+#define BCI_CMD_DEST_PBD_NEW         0x00000C00
+#define BCI_CMD_DEST_SBD             0x00001000
+#define BCI_CMD_DEST_SBD_NEW         0x00001400
+
+#define BCI_CMD_SRC_TRANSPARENT      0x00000200
+#define BCI_CMD_SRC_SOLID            0x00000000
+#define BCI_CMD_SRC_GBD              0x00000020
+#define BCI_CMD_SRC_COLOR            0x00000040
+#define BCI_CMD_SRC_MONO             0x00000060
+#define BCI_CMD_SRC_PBD_COLOR        0x00000080
+#define BCI_CMD_SRC_PBD_MONO         0x000000A0
+#define BCI_CMD_SRC_PBD_COLOR_NEW    0x000000C0
+#define BCI_CMD_SRC_PBD_MONO_NEW     0x000000E0
+#define BCI_CMD_SRC_SBD_COLOR        0x00000100
+#define BCI_CMD_SRC_SBD_MONO         0x00000120
+#define BCI_CMD_SRC_SBD_COLOR_NEW    0x00000140
+#define BCI_CMD_SRC_SBD_MONO_NEW     0x00000160
+
+#define BCI_CMD_PAT_TRANSPARENT      0x00000010
+#define BCI_CMD_PAT_NONE             0x00000000
+#define BCI_CMD_PAT_COLOR            0x00000002
+#define BCI_CMD_PAT_MONO             0x00000003
+#define BCI_CMD_PAT_PBD_COLOR        0x00000004
+#define BCI_CMD_PAT_PBD_MONO         0x00000005
+#define BCI_CMD_PAT_PBD_COLOR_NEW    0x00000006
+#define BCI_CMD_PAT_PBD_MONO_NEW     0x00000007
+#define BCI_CMD_PAT_SBD_COLOR        0x00000008
+#define BCI_CMD_PAT_SBD_MONO         0x00000009
+#define BCI_CMD_PAT_SBD_COLOR_NEW    0x0000000A
+#define BCI_CMD_PAT_SBD_MONO_NEW     0x0000000B
+
+#define BCI_BD_BW_DISABLE            0x10000000
+#define BCI_BD_TILE_MASK             0x03000000
+#define BCI_BD_TILE_NONE             0x00000000
+#define BCI_BD_TILE_16               0x02000000
+#define BCI_BD_TILE_32               0x04000000
+#define BCI_BD_GET_BPP(bd)           (((bd) >> 16) & 0xFF)
+#define BCI_BD_SET_BPP(bd, bpp)      ((bd) |= (((bpp) & 0xFF) << 16))
+#define BCI_BD_GET_STRIDE(bd)        ((bd) & 0xFFFF)
+#define BCI_BD_SET_STRIDE(bd, st)    ((bd) |= ((st) & 0xFFFF))
+
+#define BCI_W_H(w, h)                (((h) << 16) | ((w) & 0xFFF))
+#define BCI_X_Y(x, y)                (((y) << 16) | ((x) & 0xFFF))
+#define BCI_X_W(x, y)                (((w) << 16) | ((x) & 0xFFF))
+#define BCI_CLIP_LR(l, r)            (((r) << 16) | ((l) & 0xFFF))
+#define BCI_CLIP_TL(t, l)            (((t) << 16) | ((l) & 0xFFF))
+#define BCI_CLIP_BR(b, r)            (((b) << 16) | ((r) & 0xFFF))
+
+#define BCI_LINE_X_Y(x, y)           (((y) << 16) | ((x) & 0xFFFF))
+#define BCI_LINE_STEPS(diag, axi)    (((axi) << 16) | ((diag) & 0xFFFF))
+#define BCI_LINE_MISC(maj, ym, xp, yp, err) \
+(((maj) & 0xFFF) | (((ym) & 1) << 13) | \
+(((xp) & 1) << 14) | (((yp) & 1) << 15) | \
+((err) << 16))
+
+
+/* definition of BCI register indices */
+#define BCI_VERTEX0             0x00 
+#define BCI_VERTEX1             0x08 
+#define BCI_VERTEX2             0x10 
+#define BCI_TEXPALADDR          0x18
+#define BCI_COLORKEY            0x19 
+#define BCI_TEXADDR             0x1A 
+#define BCI_TEXDESC             0x1B
+#define BCI_TEXCTRL             0x1C 
+#define BCI_FOGTABLE            0x20 
+#define BCI_FOGCTRL             0x30 
+#define BCI_DRAWCTRL            0x31
+#define BCI_ZBCTRL              0x32  
+#define BCI_ZBADDR              0x33  
+#define BCI_DESTCTRL            0x34  
+#define BCI_SCSTART             0x35  
+#define BCI_SCEND               0x36  
+#define BCI_ZWATER              0x37
+#define BCI_DWATER              0x38
+
+
+
+// 8}CMD|8}count|16}skipflags
+#define BCI_CMD_TRILIST   0x80000000L
+#define BCI_CMD_TRISTRIP  0x82000000L
+#define BCI_CMD_TRIFAN    0x84000000L
+#define BCI_CMD_QUADLIST  0x86000000L
+// or this one with previous commands if this vertex list 
+// is continuation of previous one
+#define BCI_CMD_CONTINUE  0x01000000L
+// set any register that has bci index 8}CMD|8}count|16}index
+#define BCI_CMD_SETREG    0x96000000L
+// update shadow status 8}CMD|24}tag 
+#define BCI_CMD_UPDSHADOW 0x98000000L
+
+#define BCI_CMD_WAIT       0xC0000000L 
+#define BCI_WAIT_3D_IDLE   0x00010000L
+#define BCI_WAIT_2D_IDLE   0x00020000L
+#define BCI_WAIT_PAGEFLIP  0x01000000L
+#define BCI_WAIT_SCANLINE  0x02000000L
+
+#define BCI_SKIP_Z        0x01
+#define BCI_SKIP_W        0x02
+#define BCI_SKIP_DIFFUSE  0x04
+#define BCI_SKIP_SPECULAR 0x08
+#define BCI_SKIP_U        0x10
+#define BCI_SKIP_V        0x20
+
+/* definition of BCI register indices */
+#define BCI_VERTEX0		0x00    
+#define BCI_VERTEX1    		0x08
+#define BCI_VERTEX2             0x10
+#define BCI_TEXPALADDR          0x18
+#define BCI_COLORKEY            0x19
+#define BCI_TEXADDR             0x1A
+#define BCI_TEXDESC             0x1B
+#define BCI_TEXCTRL             0x1C
+#define BCI_FOGTABLE            0x20
+#define BCI_FOGCTRL             0x30
+#define BCI_DRAWCTRL            0x31
+#define BCI_ZBCTRL              0x32
+#define BCI_ZBADDR              0x33
+#define BCI_DESTCTRL            0x34
+#define BCI_SCSTART             0x35
+#define BCI_SCEND               0x36
+#define BCI_ZWATER              0x37 
+#define BCI_DWATER              0x38
+
+/* 2D regs */
+#define BCI_GBD1                0xE0
+#define BCI_GBD2                0xE1
+#define BCI_PBD1                0xE2
+#define BCI_PBD2                0xE3
+#define BCI_SBD1                0xE4
+#define BCI_SBD2                0xE5
+
+
+#endif /* _S3BCI_H_ */
diff --git a/Source/DirectFB/gfxdrivers/savage/savage_streams_old.c b/Source/DirectFB/gfxdrivers/savage/savage_streams_old.c
new file mode 100755
index 0000000..72673a2
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage_streams_old.c
@@ -0,0 +1,916 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <sys/io.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+
+#include <directfb.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+#include <core/layers.h>
+#include <core/windows.h>
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+#include <direct/mem.h>
+
+#include "savage.h"
+#include "savage_streams_old.h"
+#include "mmio.h"
+#include "savage_bci.h"
+
+/* #define SAVAGE_DEBUG */
+#ifdef SAVAGE_DEBUG
+     #define SVGDBG(x...) fprintf(stderr, "savage_streams_old:" x)
+#else
+     #define SVGDBG(x...)
+#endif
+
+typedef struct {
+     DFBRectangle          dest;
+     CoreLayerRegionConfig config;
+     int video_pitch;
+
+     struct {
+          /* secondary stream registers */
+          u32 SSTREAM_CTRL;
+          u32 SSTREAM_H_SCALE;
+          u32 BLEND_CTRL;
+          u32 SSTREAM_MULTIBUF;
+          u32 SSTREAM_FB_ADDR0;
+          u32 SSTREAM_FB_ADDR1;
+          u32 SSTREAM_STRIDE;
+          u32 SSTREAM_V_SCALE;
+          u32 SSTREAM_V_INIT_VALUE;
+          u32 SSTREAM_SRC_LINE_COUNT;
+          u32 SSTREAM_WIN_START;
+          u32 SSTREAM_WIN_SIZE;
+          u32 SSTREAM_FB_CB_ADDR;
+          u32 SSTREAM_FB_CR_ADDR;
+          u32 SSTREAM_CBCR_STRIDE;
+          u32 SSTREAM_FB_SIZE;
+          u32 SSTREAM_FB_ADDR2;
+          u32 CHROMA_KEY_CONTROL;
+          u32 CHROMA_KEY_UPPER_BOUND;
+     } regs;
+} SavageSecondaryLayerData;
+
+typedef struct {
+     CoreLayerRegionConfig config;
+     CoreSurfaceBufferLock *lock;
+     bool init;
+
+     struct {
+          /* primary stream registers */
+          u32 PSTREAM_CTRL;
+          u32 PSTREAM_FB_ADDR0;
+          u32 PSTREAM_FB_ADDR1;
+          u32 PSTREAM_STRIDE;
+          u32 PSTREAM_WIN_START;
+          u32 PSTREAM_WIN_SIZE;
+          u32 PSTREAM_FB_SIZE;
+     } regs;
+} SavagePrimaryLayerData;
+
+DisplayLayerFuncs savage_pfuncs;
+void *savage_pdriver_data;
+
+/* function prototypes */
+static void
+secondary_set_regs (SavageDriverData         *sdrv,
+                    SavageSecondaryLayerData *slay);
+static void
+secondary_calc_regs(SavageDriverData         *sdrv,
+                    SavageSecondaryLayerData *slay,
+                    CoreLayer                *layer,
+                    CoreLayerRegionConfig    *config,
+                    CoreSurface              *surface,
+                    CoreSurfaceBufferLock    *lock);
+
+static DFBResult
+savage_secondary_calc_colorkey( SavageDriverData         *sdrv,
+                                SavageSecondaryLayerData *slay,
+                                CoreLayerRegionConfig    *config,
+                                const DFBColorKey        *key,
+                                DFBSurfacePixelFormat     format );
+static void
+primary_set_regs   (SavageDriverData         *sdrv,
+                    SavagePrimaryLayerData   *play);
+static void
+primary_calc_regs  (SavageDriverData         *sdrv,
+                    SavagePrimaryLayerData   *play,
+                    CoreLayer                *layer,
+                    CoreLayerRegionConfig    *config,
+                    CoreSurface              *surface,
+                    CoreSurfaceBufferLock    *lock);
+
+static inline
+void waitretrace (void)
+{
+     iopl(3);
+     while ((inb (0x3da) & 0x8))
+          ;
+
+     while (!(inb (0x3da) & 0x8))
+          ;
+}
+
+static void
+streamOnOff(SavageDriverData * sdrv, int on)
+{
+     volatile u8 *mmio = sdrv->mmio_base;
+
+     waitretrace();
+
+     if (on) {
+          vga_out8( mmio, 0x3d4, 0x23 );
+          vga_out8( mmio, 0x3d5, 0x00 );
+
+          vga_out8( mmio, 0x3d4, 0x26 );
+          vga_out8( mmio, 0x3d5, 0x00 );
+
+          /* turn on stream operation */
+          vga_out8( mmio, 0x3d4, 0x67 );
+          vga_out8( mmio, 0x3d5, 0x0c );
+     }
+     else {
+          /* turn off stream operation */
+          vga_out8( mmio, 0x3d4, 0x67 );
+          vga_out8( mmio, 0x3d5, vga_in8( mmio, 0x3d5 ) & ~0x0c );
+     }
+}
+
+/* secondary layer functions */
+static int
+savageSecondaryLayerDataSize( void )
+{
+     SVGDBG("savageSecondaryLayerDataSize\n");
+     return sizeof(SavageSecondaryLayerData);
+}
+
+static DFBResult
+savageSecondaryInitLayer( CoreLayer                  *layer,
+                          void                       *driver_data,
+                          void                       *layer_data,
+                          DFBDisplayLayerDescription *description,
+                          DFBDisplayLayerConfig      *default_config,
+                          DFBColorAdjustment         *default_adj )
+{
+     SVGDBG("savageSecondaryInitLayer\n");
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION |
+                         DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST |
+                         DLCAPS_OPACITY | DLCAPS_HUE | DLCAPS_SATURATION |
+                         DLCAPS_ALPHACHANNEL | DLCAPS_SRC_COLORKEY |
+                         DLCAPS_DST_COLORKEY;
+     description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+     /* set name */
+     snprintf(description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH,
+              "Savage Secondary Stream");
+
+     /* fill out the default configuration */
+     default_config->flags       = DLCONF_WIDTH | DLCONF_HEIGHT |
+                                   DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
+                                   DLCONF_OPTIONS;
+     default_config->width       = 640;
+     default_config->height      = 480;
+     default_config->pixelformat = DSPF_YUY2;
+     default_config->buffermode  = DLBM_FRONTONLY;
+     default_config->options     = DLOP_NONE;
+
+     /* fill out default color adjustment,
+        only fields set in flags will be accepted from applications */
+     default_adj->flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST |
+                               DCAF_HUE | DCAF_SATURATION;
+     default_adj->brightness = 0x8000;
+     default_adj->contrast   = 0x8000;
+     default_adj->hue        = 0x8000;
+     default_adj->saturation = 0x8000;
+
+     return DFB_OK;
+}
+
+static DFBResult
+savageSecondaryRemoveRegion( CoreLayer *layer,
+                             void      *driver_data,
+                             void      *layer_data,
+                             void      *region_data )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     volatile u8 *mmio = sdrv->mmio_base;
+
+     SVGDBG("savageSecondaryRemoveRegion\n");
+
+     /* put primary stream on top of secondary stream */
+     savage_out32(mmio, SAVAGE_BLEND_CONTROL,
+                  SAVAGE_BLEND_CONTROL_COMP_PSTREAM);
+
+     return DFB_OK;
+}
+
+static DFBResult
+savageSecondaryTestRegion( CoreLayer                  *layer,
+                           void                       *driver_data,
+                           void                       *layer_data,
+                           CoreLayerRegionConfig      *config,
+                           CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     SVGDBG("savageSecondaryTestRegion\n");
+
+     /* check for unsupported options */
+     /* savage only supports one option at a time */
+     switch (config->options) {
+          case DLOP_NONE:
+          case DLOP_ALPHACHANNEL:
+          case DLOP_SRC_COLORKEY:
+          case DLOP_DST_COLORKEY:
+          case DLOP_OPACITY:
+               break;
+          default:
+               fail |= CLRCF_OPTIONS;
+               break;
+     }
+
+     /* check pixel format */
+     switch (config->format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               break;
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     /* check width */
+     if (config->width > 2048 || config->width < 1)
+          fail |= CLRCF_WIDTH;
+
+     /* check height */
+     if (config->height > 2048 || config->height < 1)
+          fail |= CLRCF_HEIGHT;
+
+     switch (config->format) {
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_I420:
+          case DSPF_YV12:
+               /* secondary is in YUV format */
+               if (config->dest.w < (config->source.w / 2))
+                    fail |= CLRCF_SOURCE | CLRCF_DEST;
+               if (config->dest.h < (config->source.h / 32))
+                    fail |= CLRCF_SOURCE | CLRCF_DEST;
+               break;
+          default:
+               /* secondary is in RGB format */
+               if (config->dest.w < config->source.w)
+                    fail |= CLRCF_SOURCE | CLRCF_DEST;
+               if (config->dest.h < config->source.h)
+                    fail |= CLRCF_SOURCE | CLRCF_DEST;
+               break;
+     }
+
+     /* write back failing fields */
+     if (failed)
+          *failed = fail;
+
+     /* return failure if any field failed */
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+savageSecondarySetRegion( CoreLayer                  *layer,
+                          void                       *driver_data,
+                          void                       *layer_data,
+                          void                       *region_data,
+                          CoreLayerRegionConfig      *config,
+                          CoreLayerRegionConfigFlags  updated,
+                          CoreSurface                *surface,
+                          CorePalette                *palette,
+                          CoreSurfaceBufferLock      *lock )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     SavageSecondaryLayerData *slay = (SavageSecondaryLayerData*) layer_data;
+
+     SVGDBG("savageSecondarySetConfiguration w:%i h:%i bpp:%i\n",
+            config->width, config->height,
+            DFB_BYTES_PER_PIXEL(config->pixelformat) * 8);
+
+     /* remember configuration */
+     slay->config = *config;
+
+     switch (config->options & (DLOP_SRC_COLORKEY | DLOP_DST_COLORKEY)) {
+          case DLOP_SRC_COLORKEY:
+               savage_secondary_calc_colorkey(sdrv, slay, config, &config->src_key,
+                                              config->format);
+               break;
+          case DLOP_DST_COLORKEY:
+               savage_secondary_calc_colorkey(sdrv, slay, config, &config->dst_key,
+                                              dfb_primary_layer_pixelformat());
+               break;
+          default:
+               slay->regs.CHROMA_KEY_CONTROL = 0;
+               slay->regs.CHROMA_KEY_UPPER_BOUND = 0;
+               break;
+     }
+
+     secondary_calc_regs(sdrv, slay, layer, config, surface, lock);
+
+     secondary_set_regs(sdrv, slay);
+
+     return DFB_OK;
+}
+
+static void
+savage_secondary_calc_opacity( SavageDriverData         *sdrv,
+                               SavageSecondaryLayerData *slay,
+                               CoreLayerRegionConfig    *config )
+{
+     u8 opacity = config->opacity;
+
+     switch (opacity) {
+          case 0:
+               /* put primary stream on top of secondary stream */
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_PSTREAM;
+               break;
+          case 0xFF:
+               /* put secondary stream on top of primary stream */
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_SSTREAM;
+               break;
+          default:
+               /* reverse opacity */
+               opacity = 7 - (opacity >> 5);
+
+               /* for some reason opacity can not be zero */
+               if (opacity == 0)
+                    opacity = 1;
+
+               /* dissolve primary and secondary stream */
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_DISSOLVE | KP_KS(opacity,0);
+               break;
+     }
+}
+
+static DFBResult
+savage_secondary_calc_colorkey( SavageDriverData         *sdrv,
+                                SavageSecondaryLayerData *slay,
+                                CoreLayerRegionConfig    *config,
+                                const DFBColorKey        *key,
+                                DFBSurfacePixelFormat     format )
+{
+     u32 reg;
+
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+               reg = 0x14000000;
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               reg = 0x17000000;
+               break;
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     slay->regs.CHROMA_KEY_CONTROL = reg | (key->r << 16) | (key->g << 8) | (key->b);
+     slay->regs.CHROMA_KEY_UPPER_BOUND = 0x00000000 | (key->r << 16) | (key->g << 8) | (key->b);
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+savageSecondaryFlipRegion( CoreLayer             *layer,
+                           void                  *driver_data,
+                           void                  *layer_data,
+                           void                  *region_data,
+                           CoreSurface           *surface,
+                           DFBSurfaceFlipFlags    flags,
+                           CoreSurfaceBufferLock *lock )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     SavageSecondaryLayerData *slay = (SavageSecondaryLayerData*) layer_data;
+
+     SVGDBG("savageSecondaryFlipRegion\n");
+
+     dfb_surface_flip( surface, false );
+
+     secondary_calc_regs(sdrv, slay, layer, &slay->config, surface, lock);
+     secondary_set_regs(sdrv, slay);
+
+     if (flags & DSFLIP_WAIT)
+          dfb_screen_wait_vsync( dfb_screens_at( DSCID_PRIMARY ) );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+savageSecondarySetColorAdjustment( CoreLayer          *layer,
+                                   void               *driver_data,
+                                   void               *layer_data,
+                                   DFBColorAdjustment *adj )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     SavageSecondaryLayerData *slay = (SavageSecondaryLayerData*) layer_data;
+     volatile u8      *mmio = sdrv->mmio_base;
+
+     SVGDBG("savageSecondaryColorAdjustment b:%i c:%i h:%i s:%i\n",
+            adj->brightness, adj->contrast, adj->hue, adj->saturation);
+
+     if ((slay->regs.SSTREAM_FB_SIZE & 0x00400000) == 0) {
+          /* secondary is in YUV format */
+          u32 reg;
+          long sat = adj->saturation * 16 / 65536;
+          double hue = (adj->hue - 0x8000) * 3.141592654 / 32768.0;
+          unsigned char hs1 = ((char)(sat * cos(hue))) & 0x1f;
+          unsigned char hs2 = ((char)(sat * sin(hue))) & 0x1f;
+
+          reg = 0x80008000 | (adj->brightness >> 8) |
+                ((adj->contrast & 0xf800) >> 3) | (hs1 << 16) | (hs2 << 24);
+
+          savage_out32(mmio, SAVAGE_COLOR_ADJUSTMENT, reg);
+
+          return DFB_OK;
+     }
+     else {
+          /* secondary is in RGB format */
+          return DFB_UNSUPPORTED;
+     }
+}
+
+DisplayLayerFuncs savageSecondaryFuncs = {
+     .LayerDataSize      = savageSecondaryLayerDataSize,
+     .InitLayer          = savageSecondaryInitLayer,
+     .RemoveRegion       = savageSecondaryRemoveRegion,
+     .TestRegion         = savageSecondaryTestRegion,
+     .SetRegion          = savageSecondarySetRegion,
+     .FlipRegion         = savageSecondaryFlipRegion,
+     .SetColorAdjustment = savageSecondarySetColorAdjustment,
+};
+
+/* secondary internal */
+static void
+secondary_set_regs(SavageDriverData *sdrv, SavageSecondaryLayerData *slay)
+{
+     volatile u8 *mmio = sdrv->mmio_base;
+
+     SVGDBG("secondary_set_regs\n");
+
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_CONTROL,
+                  slay->regs.SSTREAM_CTRL);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_HORIZONTAL_SCALING,
+                  slay->regs.SSTREAM_H_SCALE);
+     savage_out32(mmio, SAVAGE_BLEND_CONTROL,
+                  slay->regs.BLEND_CTRL);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_MULTIPLE_BUFFER_SUPPORT,
+                  slay->regs.SSTREAM_MULTIBUF);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS0,
+                  slay->regs.SSTREAM_FB_ADDR0);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS1,
+                  slay->regs.SSTREAM_FB_ADDR1);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS2,
+                  slay->regs.SSTREAM_FB_ADDR2);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_SIZE,
+                  slay->regs.SSTREAM_FB_SIZE);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_STRIDE,
+                  slay->regs.SSTREAM_STRIDE);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_VERTICAL_SCALING,
+                  slay->regs.SSTREAM_V_SCALE);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_SOURCE_LINE_COUNT,
+                  slay->regs.SSTREAM_SRC_LINE_COUNT);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_VERTICAL_INITIAL_VALUE,
+                  slay->regs.SSTREAM_V_INIT_VALUE);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_WINDOW_START,
+                  slay->regs.SSTREAM_WIN_START);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_WINDOW_SIZE,
+                  slay->regs.SSTREAM_WIN_SIZE);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FB_CB_ADDRESS,
+                  slay->regs.SSTREAM_FB_CB_ADDR);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FB_CR_ADDRESS,
+                  slay->regs.SSTREAM_FB_CR_ADDR);
+     savage_out32(mmio, SAVAGE_SECONDARY_STREAM_CBCR_STRIDE,
+                  slay->regs.SSTREAM_CBCR_STRIDE);
+
+     savage_out32(mmio, SAVAGE_CHROMA_KEY_CONTROL,
+                  slay->regs.CHROMA_KEY_CONTROL);
+     savage_out32(mmio, SAVAGE_CHROMA_KEY_UPPER_BOUND,
+                  slay->regs.CHROMA_KEY_UPPER_BOUND);
+
+     /* Set FIFO L2 on second stream. */
+     {
+          int pitch = slay->video_pitch;
+          unsigned char cr92;
+
+          SVGDBG("FIFO L2 pitch:%i\n", pitch);
+          pitch = (pitch + 7) / 8;
+          vga_out8(mmio, 0x3d4, 0x92);
+          cr92 = vga_in8( mmio, 0x3d5);
+          vga_out8(mmio, 0x3d5, (cr92 & 0x40) | (pitch >> 8) | 0x80);
+          vga_out8(mmio, 0x3d4, 0x93);
+          vga_out8(mmio, 0x3d5, pitch);
+     }
+}
+
+static void
+secondary_calc_regs(SavageDriverData         *sdrv,
+                    SavageSecondaryLayerData *slay,
+                    CoreLayer                *layer,
+                    CoreLayerRegionConfig    *config,
+                    CoreSurface              *surface,
+                    CoreSurfaceBufferLock    *lock)
+{
+     DFBRectangle *source = &config->source;
+     DFBRectangle *dest = &config->dest;
+
+     /* source size */
+     const int src_w = source->w;
+     const int src_h = source->h;
+     /* destination size */
+     const int drw_w = dest->w;
+     const int drw_h = dest->h;
+
+     SVGDBG("secondary_calc_regs x:%i y:%i w:%i h:%i\n",
+            dest->x, dest->y, dest->w, dest->h);
+     SVGDBG("w:%i h:%i pitch:%i video.offset:%x\n",
+            source->w, source->h, lock->pitch, lock->offset);
+
+     slay->video_pitch = 1;
+     slay->regs.SSTREAM_FB_SIZE = (((lock->pitch *
+                                     surface->config.size.h) / 8) - 1) & 0x003fffff;
+
+     switch (surface->config.format) {
+          case DSPF_ARGB1555:
+               SVGDBG("secondary set to DSPF_ARGB1555\n");
+               slay->regs.SSTREAM_FB_SIZE |= 0x00400000;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_KRGB16;
+               break;
+          case DSPF_RGB16:
+               SVGDBG("secondary set to DSPF_RGB16\n");
+               slay->regs.SSTREAM_FB_SIZE |= 0x00400000;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB16;
+               break;
+          case DSPF_RGB24:
+               SVGDBG("secondary set to DSPF_RGB24\n");
+               slay->regs.SSTREAM_FB_SIZE |= 0x00400000;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB24;
+               break;
+          case DSPF_RGB32:
+               SVGDBG("secondary set to DSPF_RGB32\n");
+               slay->regs.SSTREAM_FB_SIZE |= 0x00400000;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB32;
+               break;
+          case DSPF_YUY2:
+               SVGDBG("secondary set to DSPF_YUY2\n");
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YCbCr422;
+               break;
+          case DSPF_UYVY:
+               SVGDBG("secondary set to DSPF_UYVY\n");
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_CbYCrY422;
+               break;
+          case DSPF_I420:
+               SVGDBG("secondary set to DSPF_I420\n");
+               slay->video_pitch = 2;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YCbCr420;
+               slay->regs.SSTREAM_FB_CB_ADDR = lock->offset +
+                                               (surface->config.size.h * lock->pitch);
+               slay->regs.SSTREAM_FB_CR_ADDR = slay->regs.SSTREAM_FB_CB_ADDR +
+                                               ((surface->config.size.h * lock->pitch)/4);
+               slay->regs.SSTREAM_CBCR_STRIDE = ((lock->pitch/2)
+                                                 & 0x00001fff);
+               break;
+          case DSPF_YV12:
+               SVGDBG("secondary set to DSPF_YV12\n");
+               slay->video_pitch = 2;
+               slay->regs.SSTREAM_CTRL = SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YCbCr420;
+               slay->regs.SSTREAM_FB_CR_ADDR = lock->offset +
+                                               surface->config.size.h * lock->pitch;
+               slay->regs.SSTREAM_FB_CB_ADDR = slay->regs.SSTREAM_FB_CR_ADDR +
+                                               (surface->config.size.h * lock->pitch)/4;
+               slay->regs.SSTREAM_CBCR_STRIDE = ((lock->pitch/2)
+                                                 & 0x00001fff);
+               break;
+          default:
+               D_BUG("unexpected secondary pixelformat");
+               return;
+     }
+
+     slay->regs.SSTREAM_CTRL |= src_w;
+
+     switch (config->options) {
+          case DLOP_ALPHACHANNEL:
+               SVGDBG("secondary option DLOP_ALPHACHANNEL\n");
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_ALPHA;
+               break;
+          case DLOP_SRC_COLORKEY:
+               SVGDBG("secondary option DLOP_SRC_COLORKEY\n");
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_SCOLORKEY;
+               break;
+          case DLOP_DST_COLORKEY:
+               SVGDBG("secondary option DLOP_DST_COLORKEY\n");
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_PCOLORKEY;
+               break;
+          case DLOP_OPACITY:
+               SVGDBG("secondary option DLOP_OPACITY\n");
+               savage_secondary_calc_opacity( sdrv, slay, config );
+               break;
+          case DLOP_NONE:
+               SVGDBG("secondary option default\n");
+               slay->regs.BLEND_CTRL = SAVAGE_BLEND_CONTROL_COMP_SSTREAM;
+               break;
+          default:
+               D_BUG("unexcpected layer option");
+     }
+
+     slay->regs.SSTREAM_H_SCALE = ((32768 * src_w) / drw_w) & 0x0000FFFF;
+     slay->regs.SSTREAM_V_SCALE = ((32768 * src_h) / drw_h) & 0x000FFFFF;
+     slay->regs.SSTREAM_V_INIT_VALUE = 0;
+     slay->regs.SSTREAM_SRC_LINE_COUNT = src_h & 0x7ff;
+     slay->regs.SSTREAM_MULTIBUF = 0;
+     slay->regs.SSTREAM_FB_ADDR0 = lock->offset & 0x01ffffff;
+     slay->regs.SSTREAM_FB_ADDR1 = 0;
+     slay->regs.SSTREAM_FB_ADDR2 = 0;
+     slay->regs.SSTREAM_STRIDE = lock->pitch & 0x00001fff;
+     slay->regs.SSTREAM_WIN_START = OS_XY(dest->x, dest->y);
+     slay->regs.SSTREAM_WIN_SIZE = OS_WH(drw_w, drw_h);
+
+     /* remember pitch */
+     slay->video_pitch *= lock->pitch;
+}
+
+/* primary layer functions */
+static int
+savagePrimaryLayerDataSize( void )
+{
+     SVGDBG("savagePrimaryLayerDataSize\n");
+     return sizeof(SavagePrimaryLayerData);
+}
+
+static DFBResult
+savagePrimaryInitLayer( CoreLayer                  *layer,
+                        void                       *driver_data,
+                        void                       *layer_data,
+                        DFBDisplayLayerDescription *description,
+                        DFBDisplayLayerConfig      *default_config,
+                        DFBColorAdjustment         *default_adj )
+{
+     SavagePrimaryLayerData *play = (SavagePrimaryLayerData*) layer_data;
+     DFBResult ret;
+
+     SVGDBG("savagePrimaryInitLayer w:%i h:%i bpp:%i\n",
+            dfb_config->mode.width, dfb_config->mode.height,
+            dfb_config->mode.depth);
+
+     /* call the original initialization function first */
+     ret = savage_pfuncs.InitLayer (layer, driver_data, layer_data,
+                                    description, default_config, default_adj);
+     if (ret)
+          return ret;
+
+     /* set name */
+     snprintf(description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH,
+              "Savage Primary Stream");
+
+     /* add support for options */
+     default_config->flags |= DLCONF_OPTIONS;
+     default_config->options = DLOP_NONE;
+
+     /* add capabilities */
+     description->caps |= DLCAPS_SCREEN_LOCATION;
+
+     play->init = false;
+
+     return DFB_OK;
+}
+
+static DFBResult
+savagePrimarySetRegion( CoreLayer                  *layer,
+                        void                       *driver_data,
+                        void                       *layer_data,
+                        void                       *region_data,
+                        CoreLayerRegionConfig      *config,
+                        CoreLayerRegionConfigFlags  updated,
+                        CoreSurface                *surface,
+                        CorePalette                *palette,
+                        CoreSurfaceBufferLock      *lock )
+{
+     SavageDriverData *sdrv = (SavageDriverData*) driver_data;
+     SavagePrimaryLayerData *play = (SavagePrimaryLayerData*) layer_data;
+     DFBResult ret;
+
+     SVGDBG("savagePrimarySetConfiguration w:%i h:%i bpp:%i\n",
+            config->width, config->height,
+            DFB_BYTES_PER_PIXEL(config->format) * 8);
+
+     ret = savage_pfuncs.SetRegion(layer, driver_data, layer_data, region_data,
+                                   config, updated, surface, palette, lock);
+     if (ret != DFB_OK)
+          return ret;
+
+     /* remember configuration */
+     play->config = *config;
+     play->lock = lock;
+
+     primary_calc_regs(sdrv, play, layer, config, surface, lock);
+     primary_set_regs(sdrv, play);
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs savagePrimaryFuncs = {
+     .LayerDataSize = savagePrimaryLayerDataSize,
+     .InitLayer     = savagePrimaryInitLayer,
+     .SetRegion     = savagePrimarySetRegion,
+};
+
+/* primary internal */
+static void
+primary_set_regs(SavageDriverData *sdrv, SavagePrimaryLayerData *play)
+{
+     volatile u8 *mmio = sdrv->mmio_base;
+
+     SVGDBG("primary_set_regs\n");
+
+     /* turn streams on */
+     streamOnOff(sdrv, 1);
+
+     /* setup primary stream */
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_WINDOW_START,
+                  play->regs.PSTREAM_WIN_START);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_WINDOW_SIZE,
+                  play->regs.PSTREAM_WIN_SIZE);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_ADDRESS0,
+                  play->regs.PSTREAM_FB_ADDR0);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_ADDRESS1,
+                  play->regs.PSTREAM_FB_ADDR1);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_STRIDE,
+                  play->regs.PSTREAM_STRIDE);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_CONTROL,
+                  play->regs.PSTREAM_CTRL);
+     savage_out32(mmio, SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_SIZE,
+                  play->regs.PSTREAM_FB_SIZE);
+
+     if (!play->init) {
+          /* tweak */
+          /* fifo fetch delay register */
+          vga_out8( mmio, 0x3d4, 0x85 );
+          SVGDBG( "cr85: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+          vga_out8( mmio, 0x3d5, 0x00 );
+
+          /* force high priority for display channel memory */
+          vga_out8( mmio, 0x3d4, 0x88 );
+          SVGDBG( "cr88: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+          vga_out8( mmio, 0x3d5, vga_in8( mmio, 0x3d5 ) & ~0x01 );
+
+          /* primary stream timeout register */
+          vga_out8( mmio, 0x3d4, 0x71 );
+          SVGDBG( "cr71: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+
+          /* secondary stream timeout register */
+          vga_out8( mmio, 0x3d4, 0x73 );
+          SVGDBG( "cr73: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+
+          /* set primary stream to use memory mapped io */
+          vga_out8( mmio, 0x3d4, 0x69 );
+          SVGDBG( "cr69: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+          vga_out8( mmio, 0x3d5, vga_in8( mmio, 0x3d5 ) | 0x80 );
+
+          /* enable certain registers to be loaded on vsync */
+          vga_out8( mmio, 0x3d4, 0x51 );
+          SVGDBG( "cr51: 0x%02x\n", vga_in8( mmio, 0x3d5 ) );
+          vga_out8( mmio, 0x3d5, vga_in8( mmio, 0x3d5 ) | 0x80 );
+
+          /* setup secondary stream */
+          savage_out32(mmio, SAVAGE_CHROMA_KEY_CONTROL, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_CONTROL, 0);
+          savage_out32(mmio, SAVAGE_CHROMA_KEY_UPPER_BOUND, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_HORIZONTAL_SCALING, 0);
+          savage_out32(mmio, SAVAGE_COLOR_ADJUSTMENT, 0);
+          savage_out32(mmio, SAVAGE_BLEND_CONTROL, 1 << 24);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_MULTIPLE_BUFFER_SUPPORT, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS0, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS1, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS2, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_SIZE, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_STRIDE, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_VERTICAL_SCALING, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_SOURCE_LINE_COUNT, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_VERTICAL_INITIAL_VALUE, 0);
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_WINDOW_START,
+                       OS_XY(0xfffe, 0xfffe));
+          savage_out32(mmio, SAVAGE_SECONDARY_STREAM_WINDOW_SIZE,
+                       OS_WH(10,2));
+
+          play->init = true;
+     }
+}
+
+static void
+primary_calc_regs(SavageDriverData       *sdrv,
+                  SavagePrimaryLayerData *play,
+                  CoreLayer              *layer,
+                  CoreLayerRegionConfig  *config,
+                  CoreSurface            *surface,
+                  CoreSurfaceBufferLock  *lock)
+{
+     DFBRectangle *dest = &config->dest;
+
+     SVGDBG("primary_calc_regs w:%i h:%i pitch:%i video.offset:%x\n",
+            surface->config.size.w, surface->config.size.h, lock->pitch, lock->offset);
+
+     switch (surface->config.format) {
+          case DSPF_ARGB1555:
+               SVGDBG("primary set to DSPF_ARGB1555\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_KRGB16;
+               break;
+          case DSPF_RGB16:
+               SVGDBG("primary set to DSPF_RGB16\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB16;
+               break;
+          case DSPF_RGB24:
+               SVGDBG("primary set to DSPF_RGB24 (unaccelerated)\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB24;
+               break;
+          case DSPF_RGB32:
+               SVGDBG("primary set to DSPF_RGB32\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB32;
+               break;
+          case DSPF_ARGB:
+               SVGDBG("primary set to DSPF_ARGB\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_ARGB;
+               break;
+          case DSPF_RGB332:
+               SVGDBG("primary set to DSPF_RGB332\n");
+               play->regs.PSTREAM_CTRL = SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_CLUT;
+               break;
+          default:
+               D_BUG("unexpected primary pixelformat");
+               return;
+     }
+
+     play->regs.PSTREAM_FB_ADDR0 = lock->offset & 0x01ffffff;
+     play->regs.PSTREAM_FB_ADDR1 = 0;
+     play->regs.PSTREAM_STRIDE = lock->pitch & 0x00001fff;
+     play->regs.PSTREAM_WIN_START = OS_XY(dest->x, dest->y);
+     play->regs.PSTREAM_WIN_SIZE = OS_WH(dest->w, dest->h);
+     play->regs.PSTREAM_FB_SIZE = (((lock->pitch *
+                                     surface->config.size.h) / 8) - 1) & 0x003fffff;
+}
+/* end of code */
diff --git a/Source/DirectFB/gfxdrivers/savage/savage_streams_old.h b/Source/DirectFB/gfxdrivers/savage/savage_streams_old.h
new file mode 100755
index 0000000..e58cfb8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/savage/savage_streams_old.h
@@ -0,0 +1,142 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SAVAGE_STREAMS_OLD_H__
+#define __SAVAGE_STREAMS_OLD_H__
+
+#include "savage.h"
+#include <core/layers.h>
+
+extern DisplayLayerFuncs  savageSecondaryFuncs;
+extern DisplayLayerFuncs  savagePrimaryFuncs;
+extern DisplayLayerFuncs  savage_pfuncs;
+extern void              *savage_pdriver_data;
+
+/* Streams Processor Registers */
+#define SAVAGE_PRIMARY_STREAM_CONTROL                       0x8180
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_CLUT            0x00000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_ARGB            0x01000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_KRGB16          0x03000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB16           0x05000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB24           0x06000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSIDF_RGB32           0x07000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSFC_NOT_FILTERED     0x00000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSFC_REP_BOTH         0x10000000
+#define SAVAGE_PRIMARY_STREAM_CONTROL_PSFC_HOR_INTERPOLATE  0x20000000
+
+#define SAVAGE_CHROMA_KEY_CONTROL                           0x8184
+
+#define SAVAGE_GENLOCK_CONTROL                              0x8188
+
+#define SAVAGE_SECONDARY_STREAM_CONTROL                     0x8190
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_CbYCrY422     0x00000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YCbCr422      0x01000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YUV422        0x02000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_KRGB16        0x03000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_YCbCr420      0x04000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB16         0x05000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB24         0x06000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_SSIDF_RGB32         0x07000000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_H_DOWNSCALE4        0x00020000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_H_DOWNSCALE8        0x00030000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_H_DOWNSCALE16       0x00040000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_H_DOWNSCALE32       0x00050000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_H_DOWNSCALE64       0x00060000
+#define SAVAGE_SECONDARY_STREAM_CONTROL_LUMA_ONLY_INTERPOL  0x80000000
+
+#define SAVAGE_CHROMA_KEY_UPPER_BOUND                       0x8194
+
+#define SAVAGE_SECONDARY_STREAM_HORIZONTAL_SCALING          0x8198
+
+#define SAVAGE_COLOR_ADJUSTMENT                             0x819C
+
+#define SAVAGE_BLEND_CONTROL                                0x81a0
+#define SAVAGE_BLEND_CONTROL_COMP_SSTREAM                   0x00000000
+#define SAVAGE_BLEND_CONTROL_COMP_PSTREAM                   0x01000000
+#define SAVAGE_BLEND_CONTROL_COMP_DISSOLVE                  0x02000000
+#define SAVAGE_BLEND_CONTROL_COMP_FADE                      0x03000000
+#define SAVAGE_BLEND_CONTROL_COMP_ALPHA                     0x04000000
+#define SAVAGE_BLEND_CONTROL_COMP_PCOLORKEY                 0x05000000
+#define SAVAGE_BLEND_CONTROL_COMP_SCOLORKEY                 0x06000000
+#define KP_KS(kp,ks) ((kp<<10)|(ks<<2))
+
+#define SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_ADDRESS0         0x81c0
+
+#define SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_ADDRESS1         0x81c4
+
+#define SAVAGE_PRIMARY_STREAM_STRIDE                        0x81c8
+
+#define SAVAGE_SECONDARY_STREAM_MULTIPLE_BUFFER_SUPPORT     0x81cc
+
+#define SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS0       0x81d0
+
+#define SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS1       0x81d4
+
+#define SAVAGE_SECONDARY_STREAM_STRIDE                      0x81d8
+
+#define SAVAGE_SECONDARY_STREAM_VERTICAL_SCALING            0x81e0
+
+#define SAVAGE_SECONDARY_STREAM_VERTICAL_INITIAL_VALUE      0x81e4
+
+#define SAVAGE_SECONDARY_STREAM_SOURCE_LINE_COUNT           0x81e8
+
+#define SAVAGE_STREAMS_FIFO                                 0x81ec
+
+#define SAVAGE_PRIMARY_STREAM_WINDOW_START                  0x81f0
+
+#define SAVAGE_PRIMARY_STREAM_WINDOW_SIZE                   0x81f4
+
+#define SAVAGE_SECONDARY_STREAM_WINDOW_START                0x81f8
+
+#define SAVAGE_SECONDARY_STREAM_WINDOW_SIZE                 0x81fc
+
+#define SAVAGE_PRIMARY_STREAM_FIFO_MONITOR0                 0x8200
+
+#define SAVAGE_SECONDARY_STREAM_FIFO_MONITOR0               0x8204
+
+#define SAVAGE_SECONDARY_STREAM_FB_CB_ADDRESS               0x8208
+
+#define SAVAGE_SECONDARY_STREAM_FB_CR_ADDRESS               0x820C
+
+#define SAVAGE_PRIMARY_STREAM_FIFO_MONITOR1                 0x8210
+
+#define SAVAGE_SECONDARY_STREAM_FIFO_MONITOR1               0x8214
+
+#define SAVAGE_SECONDARY_STREAM_CBCR_STRIDE                 0x8218
+
+#define SAVAGE_PRIMARY_STREAM_FRAME_BUFFER_SIZE             0x8300
+
+#define SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_SIZE           0x8304
+
+#define SAVAGE_SECONDARY_STREAM_FRAME_BUFFER_ADDRESS2       0x8308
+
+/* macros */
+#define OS_XY(x,y) (((x+1)<<16)|(y+1))
+#define OS_WH(x,y) (((x-1)<<16)|(y))
+
+#endif /* __SAVAGE_STREAMS_OLD_H__ */
diff --git a/Source/DirectFB/gfxdrivers/sh772x/Makefile.am b/Source/DirectFB/gfxdrivers/sh772x/Makefile.am
new file mode 100755
index 0000000..462aa03
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/Makefile.am
@@ -0,0 +1,80 @@
+## Makefile.am for DirectFB/src/core/gfxcards/sh7722
+
+EXTRA_DIST = \
+	directfbrc.sh7722		\
+	directfbrc.sh7723		\
+	Makefile.kernel			\
+	README.sh7722			\
+	kernel-module/sh772x_driver.c	\
+	kernel-module/sh772x_gfx.h	\
+	kernel-module/sh7722.c		\
+	kernel-module/sh7722.h		\
+	kernel-module/sh7723.c		\
+	kernel-module/sh7723.h		\
+	kernel-module/Makefile
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	-I$(top_srcdir)/systems		\
+	-I$(srcdir)/kernel-module
+
+
+lib_LTLIBRARIES = libsh7722_jpeg.la
+
+libsh7722_jpeg_la_SOURCES =	\
+	sh7722_jpeglib.c	\
+	sh7722_jpeglib.h
+
+
+bin_PROGRAMS = sh7722_jpegtool
+
+sh7722_jpegtool_SOURCES = \
+	sh7722_jpegtool.c
+
+sh7722_jpegtool_LDADD = \
+	$(top_builddir)/src/libdirectfb.la	\
+	libsh7722_jpeg.la
+
+
+sh7722_LTLIBRARIES = libdirectfb_sh7722.la
+
+if BUILD_STATIC
+sh7722_DATA = $(sh7722_LTLIBRARIES:.la=.o)
+endif
+
+sh7722dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_sh7722_la_SOURCES =	\
+	sh7722.c		\
+	sh7722.h		\
+	sh7722_blt.c		\
+	sh7722_blt.h		\
+	sh7723_blt.c		\
+	sh7723_blt.h		\
+	sh7722_jpeg.c		\
+	sh7722_layer.c		\
+	sh7722_layer.h		\
+	sh7722_lcd.c		\
+	sh7722_lcd.h		\
+	sh7722_multi.c		\
+	sh7722_multi.h		\
+	sh7722_regs.h		\
+	sh7722_screen.c		\
+	sh7722_screen.h		\
+	sh7722_types.h
+
+libdirectfb_sh7722_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sh7722_la_LIBADD = \
+	$(top_builddir)/src/libdirectfb.la	\
+	libsh7722_jpeg.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/Makefile.in b/Source/DirectFB/gfxdrivers/sh772x/Makefile.in
new file mode 100755
index 0000000..a2fcc20
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/Makefile.in
@@ -0,0 +1,726 @@
+# 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@
+bin_PROGRAMS = sh7722_jpegtool$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = gfxdrivers/sh772x
+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)$(libdir)" "$(DESTDIR)$(sh7722dir)" \
+	"$(DESTDIR)$(bindir)" "$(DESTDIR)$(sh7722dir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+sh7722LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES) $(sh7722_LTLIBRARIES)
+libdirectfb_sh7722_la_DEPENDENCIES =  \
+	$(top_builddir)/src/libdirectfb.la libsh7722_jpeg.la
+am_libdirectfb_sh7722_la_OBJECTS = sh7722.lo sh7722_blt.lo \
+	sh7723_blt.lo sh7722_jpeg.lo sh7722_layer.lo sh7722_lcd.lo \
+	sh7722_multi.lo sh7722_screen.lo
+libdirectfb_sh7722_la_OBJECTS = $(am_libdirectfb_sh7722_la_OBJECTS)
+libdirectfb_sh7722_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_sh7722_la_LDFLAGS) $(LDFLAGS) -o $@
+libsh7722_jpeg_la_LIBADD =
+am_libsh7722_jpeg_la_OBJECTS = sh7722_jpeglib.lo
+libsh7722_jpeg_la_OBJECTS = $(am_libsh7722_jpeg_la_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_sh7722_jpegtool_OBJECTS = sh7722_jpegtool.$(OBJEXT)
+sh7722_jpegtool_OBJECTS = $(am_sh7722_jpegtool_OBJECTS)
+sh7722_jpegtool_DEPENDENCIES = $(top_builddir)/src/libdirectfb.la \
+	libsh7722_jpeg.la
+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_sh7722_la_SOURCES) \
+	$(libsh7722_jpeg_la_SOURCES) $(sh7722_jpegtool_SOURCES)
+DIST_SOURCES = $(libdirectfb_sh7722_la_SOURCES) \
+	$(libsh7722_jpeg_la_SOURCES) $(sh7722_jpegtool_SOURCES)
+sh7722DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(sh7722_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@
+EXTRA_DIST = \
+	directfbrc.sh7722		\
+	directfbrc.sh7723		\
+	Makefile.kernel			\
+	README.sh7722			\
+	kernel-module/sh772x_driver.c	\
+	kernel-module/sh772x_gfx.h	\
+	kernel-module/sh7722.c		\
+	kernel-module/sh7722.h		\
+	kernel-module/sh7723.c		\
+	kernel-module/sh7723.h		\
+	kernel-module/Makefile
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	-I$(top_srcdir)/systems		\
+	-I$(srcdir)/kernel-module
+
+lib_LTLIBRARIES = libsh7722_jpeg.la
+libsh7722_jpeg_la_SOURCES = \
+	sh7722_jpeglib.c	\
+	sh7722_jpeglib.h
+
+sh7722_jpegtool_SOURCES = \
+	sh7722_jpegtool.c
+
+sh7722_jpegtool_LDADD = \
+	$(top_builddir)/src/libdirectfb.la	\
+	libsh7722_jpeg.la
+
+sh7722_LTLIBRARIES = libdirectfb_sh7722.la
+@BUILD_STATIC_TRUE@sh7722_DATA = $(sh7722_LTLIBRARIES:.la=.o)
+sh7722dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_sh7722_la_SOURCES = \
+	sh7722.c		\
+	sh7722.h		\
+	sh7722_blt.c		\
+	sh7722_blt.h		\
+	sh7723_blt.c		\
+	sh7723_blt.h		\
+	sh7722_jpeg.c		\
+	sh7722_layer.c		\
+	sh7722_layer.h		\
+	sh7722_lcd.c		\
+	sh7722_lcd.h		\
+	sh7722_multi.c		\
+	sh7722_multi.h		\
+	sh7722_regs.h		\
+	sh7722_screen.c		\
+	sh7722_screen.h		\
+	sh7722_types.h
+
+libdirectfb_sh7722_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sh7722_la_LIBADD = \
+	$(top_builddir)/src/libdirectfb.la	\
+	libsh7722_jpeg.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/sh772x/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/sh772x/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-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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
+install-sh7722LTLIBRARIES: $(sh7722_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(sh7722dir)" || $(MKDIR_P) "$(DESTDIR)$(sh7722dir)"
+	@list='$(sh7722_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sh7722LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(sh7722dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sh7722LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(sh7722dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-sh7722LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sh7722_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(sh7722dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(sh7722dir)/$$p"; \
+	done
+
+clean-sh7722LTLIBRARIES:
+	-test -z "$(sh7722_LTLIBRARIES)" || rm -f $(sh7722_LTLIBRARIES)
+	@list='$(sh7722_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_sh7722.la: $(libdirectfb_sh7722_la_OBJECTS) $(libdirectfb_sh7722_la_DEPENDENCIES) 
+	$(libdirectfb_sh7722_la_LINK) -rpath $(sh7722dir) $(libdirectfb_sh7722_la_OBJECTS) $(libdirectfb_sh7722_la_LIBADD) $(LIBS)
+libsh7722_jpeg.la: $(libsh7722_jpeg_la_OBJECTS) $(libsh7722_jpeg_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libsh7722_jpeg_la_OBJECTS) $(libsh7722_jpeg_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+sh7722_jpegtool$(EXEEXT): $(sh7722_jpegtool_OBJECTS) $(sh7722_jpegtool_DEPENDENCIES) 
+	@rm -f sh7722_jpegtool$(EXEEXT)
+	$(LINK) $(sh7722_jpegtool_OBJECTS) $(sh7722_jpegtool_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_blt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_jpeg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_jpeglib.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_jpegtool.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_layer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_lcd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_multi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7722_screen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh7723_blt.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-sh7722DATA: $(sh7722_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(sh7722dir)" || $(MKDIR_P) "$(DESTDIR)$(sh7722dir)"
+	@list='$(sh7722_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(sh7722DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sh7722dir)/$$f'"; \
+	  $(sh7722DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sh7722dir)/$$f"; \
+	done
+
+uninstall-sh7722DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sh7722_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(sh7722dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(sh7722dir)/$$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) $(PROGRAMS) $(DATA)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sh7722dir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sh7722dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool clean-sh7722LTLIBRARIES 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-sh7722DATA install-sh7722LTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
+	uninstall-sh7722DATA uninstall-sh7722LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libLTLIBRARIES clean-libtool \
+	clean-sh7722LTLIBRARIES ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-sh7722DATA \
+	install-sh7722LTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-libLTLIBRARIES uninstall-sh7722DATA \
+	uninstall-sh7722LTLIBRARIES
+
+%.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/sh772x/Makefile.kernel b/Source/DirectFB/gfxdrivers/sh772x/Makefile.kernel
new file mode 100755
index 0000000..8b6be07
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/Makefile.kernel
@@ -0,0 +1,61 @@
+KERNEL_VERSION  ?= $(shell uname -r)
+KERNEL_MODLIB   ?= /lib/modules/$(KERNEL_VERSION)
+KERNEL_BUILD    ?= $(SYSROOT)$(KERNEL_MODLIB)/build
+KERNEL_SOURCE   ?= $(SYSROOT)$(KERNEL_MODLIB)/source
+
+ifeq ($(shell test -L $(KERNEL_BUILD) && echo yes),yes)
+  KERNEL_BUILD := $(SYSROOT)$(shell readlink $(KERNEL_BUILD))
+endif
+
+ifeq ($(shell test -L $(KERNEL_SOURCE) && echo yes),yes)
+  KERNEL_SOURCE := $(SYSROOT)$(shell readlink $(KERNEL_SOURCE))
+endif
+
+K_VERSION    := $(shell echo $(KERNEL_VERSION) | cut -d . -f 1)
+K_PATCHLEVEL := $(shell echo $(KERNEL_VERSION) | cut -d . -f 2)
+K_SUBLEVEL   := $(shell echo $(KERNEL_VERSION) | cut -d . -f 3 | cut -d '-' -f 1)
+
+
+DESTDIR ?= $(SYSROOT)
+
+
+ifeq ($(DEBUG_2DG),yes)
+  CPPFLAGS += -DSH7722GFX_DEBUG_2DG
+endif
+
+ifeq ($(DEBUG_JPU),yes)
+  CPPFLAGS += -DSH7722GFX_DEBUG_JPU
+endif
+
+ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/autoconf.h && echo yes),yes)
+  AUTOCONF_H = -include $(KERNEL_BUILD)/include/linux/autoconf.h
+endif
+  
+ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/config.h && echo yes),yes)
+  CPPFLAGS += -DHAVE_LINUX_CONFIG_H
+endif
+    
+check-version = $(shell expr \( $(K_VERSION) \* 65536 + $(K_PATCHLEVEL) \* 256 + $(K_SUBLEVEL) \) \>= \( $(1) \* 65536 + $(2) \* 256 + $(3) \))
+
+.PHONY: all install clean
+
+all:
+ifeq ($(call check-version,2,6,24),1)
+	$(MAKE) -C $(KERNEL_BUILD) \
+		KCPPFLAGS="$(CPPFLAGS) -I`pwd`/kernel-module" \
+		SUBDIRS="`pwd`/kernel-module" modules
+else
+	$(MAKE) -C $(KERNEL_BUILD) \
+		CPPFLAGS="$(CPPFLAGS) -D__KERNEL__ -I`pwd`/kernel-module -I$(KERNEL_BUILD)/include -I$(KERNEL_SOURCE)/include $(AUTOCONF_H)" \
+		SUBDIRS="`pwd`/kernel-module" modules
+endif
+
+clean:
+	rm -rf kernel-module/*.*o kernel-module/.*.*o* kernel-module/*.mod.c kernel-module/.tmp_versions
+
+install: all
+	install -v -m 0755 -d $(DESTDIR)/lib/modules/$(KERNEL_VERSION)/renesas
+	install -v -m 0644 kernel-module/sh772x_gfx.ko $(DESTDIR)/lib/modules/$(KERNEL_VERSION)/renesas/
+
+
+.PHONY: all clean
diff --git a/Source/DirectFB/gfxdrivers/sh772x/README.sh7722 b/Source/DirectFB/gfxdrivers/sh772x/README.sh7722
new file mode 100755
index 0000000..45bbf87
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/README.sh7722
@@ -0,0 +1,172 @@
+Renesas SH7722 graphics driver
+==============================
+
+This driver supports the SH7722 SoC from Renesas Solutions Corp. controlling
+- LCDC (LCD Controller) for display
+- BEU (Blit Engine Unit) for blending of planes
+- TDG (2D Graphics) for accelerated operations
+
+It's using a kernel device called sh7722gfx which mainly does interrupt handling.
+
+The 2D Graphics unit supports display lists in RAM and reads them via DMA. These
+lists consist of double word entries, first word designates a register, second
+word contains the data to write. Once a list has been completely processed, the
+hardware generates an interrupt to start the next list.
+
+The kernel module allocates a ring buffer for usage as a display list. The user
+space prepares a block of commands and puts it into the ring buffer. If the hardware
+is idle, it's started directly from user space. When a DMA completion interrupt
+is received, the next block of commands is started from kernel space. If the
+hardware is still running the previous block, new commands are appended to the
+next one. The driver is designed to run without any locking or system calls. Only
+a few interrupts happen over time depending on the operations. The hardware is not
+getting idle, while commands are being sent to keep it busy. There's just a minimal
+gap which is the interrupt handler setting the new start address and kicking the
+hardware again.
+
+To build the kernel module use "make -f Makefile.kernel". You might want to set
+the variables KERNEL_SOURCE, KERNEL_BUILD (if != KERNEL_SOURCE), KERNEL_VERSION
+and DESTDIR.
+
+To run the driver you need the DevMem system module using the directfbrc.sh7722
+file (renamed to directfbrc in $prefix/etc).
+
+
+Performance (as of 2007-09-21, multi app, 127.79 BogoMIPS)
+----------------------------------------------------------
+
+Only 14% CPU load with df_andi running 800x480 at 28.1 fps :)
+
+Benchmarking with 256x256 in 16bit mode... (16bit)
+                                                                                CPU load
+Anti-aliased Text                              3.020 secs (   41.721 KChars/sec) [100%]
+Anti-aliased Text (blend)                      3.328 secs (   10.817 KChars/sec) [100%]
+Fill Rectangle                                 5.549 secs (*  69.681 MPixel/sec) [  3%]
+Fill Rectangle (blend)                        11.873 secs (*  22.079 MPixel/sec) [  1%]
+Fill Rectangles [10]                           9.384 secs (*  69.838 MPixel/sec) [  0%]
+Fill Rectangles [10] (blend)                  14.836 secs (*  22.086 MPixel/sec) [  0%]
+Fill Triangles                                 3.024 secs (+  50.929 MPixel/sec) [ 40%]
+Fill Triangles (blend)                         3.064 secs (+  20.319 MPixel/sec) [  8%]
+Draw Rectangle                                 3.284 secs (*   6.942 KRects/sec) [ 26%]
+Draw Rectangle (blend)                         3.302 secs (*   6.268 KRects/sec) [ 25%]
+Draw Lines [10]                                3.238 secs (*  28.103 KLines/sec) [ 20%]
+Draw Lines [10] (blend)                        3.198 secs (*  27.829 KLines/sec) [ 19%]
+Fill Spans                                     3.092 secs (*  61.466 MPixel/sec) [ 33%]
+Fill Spans (blend)                             3.094 secs (*  21.181 MPixel/sec) [ 11%]
+Blit                                          10.436 secs (*  30.143 MPixel/sec) [  2%]
+Blit colorkeyed                                9.333 secs (*  32.301 MPixel/sec) [  2%]
+Blit destination colorkeyed                    3.763 secs (    6.966 MPixel/sec) [ 99%]
+Blit with format conversion                   13.369 secs (*  22.549 MPixel/sec) [  1%]
+Blit with colorizing                           4.419 secs (    2.966 MPixel/sec) [100%]
+Blit from 32bit (blend)                       21.973 secs (*  13.123 MPixel/sec) [  1%]
+Blit from 32bit (blend) with colorizing        5.129 secs (    1.277 MPixel/sec) [100%]
+Stretch Blit                                  10.271 secs (*  33.463 MPixel/sec) [  3%]
+Stretch Blit colorkeyed                        7.895 secs (*  35.159 MPixel/sec) [  3%]
+
+(*) SH7722/BLT: 940 starts, 940 done, 940 interrupts, 43 wait_idle, 780 wait_next, 89 idle
+(*) SH7722/BLT: 24700744 words, 26277 words/start, 277536 words/idle, 10 starts/idle
+
+* = accelerated
++ = half way accelerated
+
+
+Performance (as of 2007-09-25, multi app, 127.79 BogoMIPS)
+----------------------------------------------------------
+
+Only 13% CPU load with df_andi running 800x480 at 28.8 fps :)
+Only 46% CPU load with ClanBomber2 running 800x600 at 48 fps :)
+
+Benchmarking with 256x256 in 16bit mode... (16bit)
+                                                                                CPU load
+Anti-aliased Text                              3.057 secs (*  98.920 KChars/sec) [ 47%] !
+Anti-aliased Text (blend)                      3.298 secs (   10.915 KChars/sec) [100%] 
+Fill Rectangle                                 5.732 secs (*  69.743 MPixel/sec) [  3%] 
+Fill Rectangle (blend)                        11.571 secs (*  22.088 MPixel/sec) [  1%] 
+Fill Rectangles [10]                           9.384 secs (*  69.838 MPixel/sec) [  0%] 
+Fill Rectangles [10] (blend)                  14.836 secs (*  22.086 MPixel/sec) [  0%] 
+Fill Triangles                                 4.176 secs (*  61.989 MPixel/sec) [  6%] !
+Fill Triangles (blend)                         8.132 secs (*  21.759 MPixel/sec) [  2%] !
+Draw Rectangle                                 3.216 secs (*   6.965 KRects/sec) [ 26%]  
+Draw Rectangle (blend)                         3.290 secs (*   6.322 KRects/sec) [ 22%]  
+Draw Lines [10]                                3.216 secs (*  28.296 KLines/sec) [ 14%]  
+Draw Lines [10] (blend)                        3.196 secs (*  28.160 KLines/sec) [ 14%]  
+Fill Spans                                     3.086 secs (*  61.586 MPixel/sec) [ 25%]  
+Fill Spans (blend)                             3.092 secs (*  21.195 MPixel/sec) [  7%]  
+Blit                                           8.692 secs (*  30.159 MPixel/sec) [  2%]  
+Blit 180                                       4.783 secs (*  30.144 MPixel/sec) [  2%] !
+Blit colorkeyed                               11.965 secs (*  32.316 MPixel/sec) [  2%]  
+Blit destination colorkeyed                    3.795 secs (    6.907 MPixel/sec) [ 99%]   
+Blit with format conversion                    9.039 secs (*  22.476 MPixel/sec) [  1%]  
+Blit with colorizing                           4.414 secs (    2.969 MPixel/sec) [100%]  
+Blit from 32bit (blend)                       23.375 secs (*  13.177 MPixel/sec) [  1%]  
+Blit from 32bit (blend) with colorizing        5.137 secs (    1.275 MPixel/sec) [100%]  
+Stretch Blit                                   8.976 secs (*  33.495 MPixel/sec) [  2%]  
+Stretch Blit colorkeyed                        9.728 secs (*  35.226 MPixel/sec) [  2%]  
+
+(*) SH7722/BLT: 521 starts, 521 done, 521 interrupts, 45 wait_idle, 363 wait_next, 90 idle
+(*) SH7722/BLT: 11511104 words, 22094 words/start, 127901 words/idle, 5 starts/idle
+
+* = accelerated
+! = updated
+
+
+Statistics
+----------
+
+The statistics at the end are more valuable when looking at one case at a time:
+
+Fill Rectangle                                 5.834 secs (*  69.647 MPixel/sec) [  4%]
+
+(*) SH7722/BLT: 16 starts, 16 done, 16 interrupts, 4 wait_idle, 2 wait_next, 11 idle
+(*) SH7722/BLT: 74840 words, 4677 words/start, 6803 words/idle, 1 starts/idle
+
+This means that while the FillRectangle() benchmark was running, the hardware
+didn't get idle, which is obvious when running the benchmark for just 10 ms:
+
+Fill Rectangle                                 0.191 secs (*  68.624 MPixel/sec) [ 10%]
+
+(*) SH7722/BLT: 13 starts, 13 done, 13 interrupts, 4 wait_idle, 0 wait_next, 11 idle
+(*) SH7722/BLT: 2840 words, 218 words/start, 258 words/idle, 1 starts/idle
+
+See? The same number of times becoming idle, but a few less interrupts. Don't
+worry about the 191 ms the benchmark needed to complete, after 10 ms of stuffing
+the display list, we need to wait until the hardware is done before measuring
+the time it took and calculating the result.
+
+Here's FillSpans() which as opposed to FillRectangle() does a lot of small commands:
+
+Fill Spans                                     3.028 secs (*  61.467 MPixel/sec) [ 34%]
+
+(*) SH7722/BLT: 245 starts, 245 done, 245 interrupts, 3 wait_idle, 185 wait_next, 22 idle
+(*) SH7722/BLT: 5828128 words, 23788 words/start, 264914 words/idle, 11 starts/idle
+
+
+Example kernel log (debug mode)
+-------------------------------
+
+0.549.014 - sh7722_reset     : Resetting hardware...
+0.549.046 - sh7722_reset     : Initializing shared area...
+0.549.748 - sh7722_reset     : Clearing interrupts...
+0.549.770 - sh7722_reset     : Ready        (   idle, hw     0-    0, next     0-    0, invalid, HC 0000000, INT 000000)
+0.568.700 - sh7722_wait      : Waiting..... (running, hw     0-   54, next    56-   56, invalid, HC 1010111, INT 000000)
+0.573.339 - sh7722_tdg_irq   : -Interrupt   (running, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 100100)
+0.573.397 - sh7722_tdg_irq   :  '-> Idle.   (running, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 000000)
+0.573.480 - sh7722_wait      : ........done (   idle, hw     0-   54, next    56-   56, invalid, HC 0000000, INT 000000)
+0.583.575 - sh7722_wait      : Waiting..... (running, hw    56-   78, next    80-   80, invalid, HC 1010111, INT 000000)
+0.588.414 - sh7722_tdg_irq   : -Interrupt   (running, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 100100)
+0.588.470 - sh7722_tdg_irq   :  '-> Idle.   (running, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 000000)
+0.588.544 - sh7722_wait      : ........done (   idle, hw    56-   78, next    80-   80, invalid, HC 0000000, INT 000000)
+0.601.336 - sh7722_tdg_irq   : -Interrupt   (running, hw    80-  102, next   104-  104, invalid, HC 0000000, INT 100100)
+0.601.420 - sh7722_tdg_irq   :  '-> Idle.   (running, hw    80-  102, next   104-  104, invalid, HC 0000000, INT 000000)
+0.700.117 - sh7722_tdg_irq   : -Interrupt   (running, hw   104-  124, next   128-  128, invalid, HC 0000000, INT 100100)
+0.700.205 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   104-  124, next   128-  128, invalid, HC 0000000, INT 000000)
+3.115.419 - sh7722_tdg_irq   : -Interrupt   (running, hw   128-  220, next   224-  224, invalid, HC 0000000, INT 100100)
+3.115.506 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   128-  220, next   224-  224, invalid, HC 0000000, INT 000000)
+3.151.700 - sh7722_tdg_irq   : -Interrupt   (running, hw   224-  324, next   328-  328, invalid, HC 0000000, INT 100100)
+3.151.788 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   224-  324, next   328-  328, invalid, HC 0000000, INT 000000)
+3.159.160 - sh7722_wait      : Waiting..... (running, hw   328-  444, next   448-12994,   valid, HC 1010111, INT 000100)
+3.161.783 - sh7722_tdg_irq   : -Interrupt   (running, hw   328-  444, next   448-12994,   valid, HC 0000000, INT 100100)
+3.161.839 - sh7722_tdg_irq   :  '-> Start!  (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
+4.316.367 - sh7722_tdg_irq   : -Interrupt   (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 100100)
+4.316.434 - sh7722_tdg_irq   :  '-> Idle.   (running, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
+4.316.505 - sh7722_wait      : ........done (   idle, hw   448-12994, next 12996-12996, invalid, HC 0000000, INT 000000)
diff --git a/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7722 b/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7722
new file mode 100755
index 0000000..7417294
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7722
@@ -0,0 +1,10 @@
+
+system = devmem
+
+video-phys   = f800000	# Requires 'mem=120M' kernel option!!!!!
+video-length = 8388608	# 8MB of physically contiguous memory for acceleration
+
+mmio-phys    = fd000000	# Start of 2DG register space
+mmio-length  = 65536	# Size of register space
+
+accelerator  = 11591	# 0x2D47 (2DG)
diff --git a/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7723 b/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7723
new file mode 100755
index 0000000..b8cb009
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/directfbrc.sh7723
@@ -0,0 +1,10 @@
+
+system = devmem
+
+video-phys   = f800000	# Requires 'mem=120M' kernel option!!!!!
+video-length = 8388608	# 8MB of physically contiguous memory for acceleration
+
+mmio-phys    = a4680000	# Start of 2DG register space
+mmio-length  = 65536	# Size of register space
+
+accelerator  = 11591	# 0x2D47 (2DG)
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/Makefile b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/Makefile
new file mode 100755
index 0000000..d054dd5
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/Makefile
@@ -0,0 +1,3 @@
+obj-m += sh772x_gfx.o
+
+sh772x_gfx-y += sh772x_driver.o sh7722.o sh7723.o
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.c b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.c
new file mode 100755
index 0000000..981cf69
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.c
@@ -0,0 +1,1192 @@
+/*
+ * SH7722 Graphics Device
+ *
+ * Copyright (C) 2006-2008  IGEL Co.,Ltd
+ *
+ * Written by Denis Oliver Kropp <dok@directfb.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License v2
+ * as published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/version.h>
+
+#include <linux/delay.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+#include <linux/ioctl.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/dma-mapping.h>
+
+#include <asm/io.h>
+#include <asm/uaccess.h>
+
+#include <sh772x_gfx.h>
+
+
+//#define SH7722GFX_DEBUG_2DG
+//#define SH7722GFX_DEBUG_JPU
+//#define SH7722GFX_IRQ_POLLER
+
+
+/**********************************************************************************************************************/
+
+#ifndef SH7722_BEU_IRQ
+#define SH7722_BEU_IRQ 53
+#endif
+
+#ifndef SH7722_VEU_IRQ
+#define SH7722_VEU_IRQ 54
+#endif
+
+#ifndef SH7722_JPU_IRQ
+#define SH7722_JPU_IRQ 27
+#endif
+
+#ifndef SH7722_TDG_IRQ
+#define SH7722_TDG_IRQ 109
+#endif
+
+/**********************************************************************************************************************/
+
+#define ENGINE_REG_TOP   0xFD000000
+#define SH7722_VEU_BASE  0xFE920000
+#define SH7722_BEU_BASE  0xFE930000
+#define SH7722_JPU_BASE  0xFEA00000
+
+#define BEM_REG(x)       (*(volatile u32*)((x)+ENGINE_REG_TOP))
+#define VEU_REG(x)       (*(volatile u32*)((x)+SH7722_VEU_BASE))
+#define BEU_REG(x)       (*(volatile u32*)((x)+SH7722_BEU_BASE))
+#define JPU_REG(x)       (*(volatile u32*)((x)+SH7722_JPU_BASE))
+
+#define BEM_HC_STATUS              BEM_REG(0x00000)
+#define BEM_HC_RESET               BEM_REG(0x00004)
+#define BEM_HC_CLOCK               BEM_REG(0x00008)
+#define BEM_HC_INT_STATUS          BEM_REG(0x00020)
+#define BEM_HC_INT_MASK            BEM_REG(0x00024)
+#define BEM_HC_INT_CLEAR           BEM_REG(0x00028)
+#define BEM_HC_CACHE_FLUSH         BEM_REG(0x0002C)
+#define BEM_HC_DMA_ADR             BEM_REG(0x00040)
+#define BEM_HC_DMA_START           BEM_REG(0x00044)
+#define BEM_HC_DMA_STOP            BEM_REG(0x00048)
+#define BEM_PE_CACHE               BEM_REG(0x010B0)
+
+#define BEVTR                      BEU_REG(0x0018C)
+
+#define JPU_JCCMD                  JPU_REG(0x00004)
+#define JPU_JCSTS                  JPU_REG(0x00008)
+#define JPU_JINTE                  JPU_REG(0x00038)
+#define JPU_JINTS                  JPU_REG(0x0003C)
+#define JPU_JCDERR                 JPU_REG(0x00040)
+#define JPU_JCRST                  JPU_REG(0x00044)
+#define JPU_JIFDDVSZ               JPU_REG(0x000B4)
+#define JPU_JIFDDHSZ               JPU_REG(0x000B8)
+#define JPU_JIFDDYA1               JPU_REG(0x000BC)
+#define JPU_JIFDDCA1               JPU_REG(0x000C0)
+#define JPU_JIFDDYA2               JPU_REG(0x000C4)
+#define JPU_JIFDDCA2               JPU_REG(0x000C8)
+#define JPU_JIFESYA1               JPU_REG(0x00074)
+#define JPU_JIFESCA1               JPU_REG(0x00078)
+#define JPU_JIFESYA2               JPU_REG(0x0007C)
+#define JPU_JIFESCA2               JPU_REG(0x00080)
+#define JPU_JIFEDA1                JPU_REG(0x00090)
+#define JPU_JIFEDA2                JPU_REG(0x00094)
+
+#define VEU_VESTR                  VEU_REG(0x00000)
+#define VEU_VESWR                  VEU_REG(0x00010)
+#define VEU_VESSR                  VEU_REG(0x00014)
+#define VEU_VSAYR                  VEU_REG(0x00018)
+#define VEU_VSACR                  VEU_REG(0x0001c)
+#define VEU_VDAYR                  VEU_REG(0x00034)
+#define VEU_VDACR                  VEU_REG(0x00038)
+#define VEU_VTRCR                  VEU_REG(0x00050)
+#define VEU_VRFSR                  VEU_REG(0x00058)
+#define VEU_VEVTR                  VEU_REG(0x000A4)
+#define VEU_VSTAR                  VEU_REG(0x000b0)
+
+#define JINTS_MASK                 0x00007C68
+#define JINTS_INS3_HEADER          0x00000008
+#define JINTS_INS5_ERROR           0x00000020
+#define JINTS_INS6_DONE            0x00000040
+#define JINTS_INS10_XFER_DONE      0x00000400
+#define JINTS_INS11_LINEBUF0       0x00000800
+#define JINTS_INS12_LINEBUF1       0x00001000
+#define JINTS_INS13_LOADED         0x00002000
+#define JINTS_INS14_RELOAD         0x00004000
+
+#define JCCMD_START                0x00000001
+#define JCCMD_RESTART              0x00000002
+#define JCCMD_END                  0x00000004
+#define JCCMD_RESET                0x00000080
+#define JCCMD_LCMD2                0x00000100
+#define JCCMD_LCMD1                0x00000200
+#define JCCMD_READ_RESTART         0x00000400
+#define JCCMD_WRITE_RESTART        0x00000800
+
+#define VTRCR_CHRR                 0x0000C000
+
+/**********************************************************************************************************************/
+
+#ifdef SH7722GFX_DEBUG_2DG
+#define QPRINT(x...)     do {                                                        \
+     char buf[128];                                                                  \
+     struct timeval tv;                                                              \
+     do_gettimeofday( &tv );                                                         \
+     snprintf( buf, sizeof(buf), x );                                                \
+     printk( KERN_DEBUG "%ld.%03ld.%03ld - %-17s: %s\n",                             \
+             tv.tv_sec - base_time.tv_sec,                                           \
+             tv.tv_usec / 1000, tv.tv_usec % 1000, __FUNCTION__, buf );              \
+} while (0)
+#else
+#define QPRINT(x...)     do {} while (0)
+#endif
+
+#define QDUMP(msg)       QPRINT( "%-12s (%s, hw %5d-%5d, next %5d-%5d, %svalid, "    \
+                                 "HC %07x, INT %06x)", msg,                          \
+                                 shared->hw_running ? "running" : "   idle",         \
+                                 shared->hw_start,                                   \
+                                 shared->hw_end,                                     \
+                                 shared->next_start,                                 \
+                                 shared->next_end,                                   \
+                                 shared->next_valid ? "  " : "in",                   \
+                                 BEM_HC_STATUS, BEM_HC_INT_STATUS );
+
+/**********************************************************************************************************************/
+
+#ifdef SH7722GFX_DEBUG_JPU
+#define JPRINT(x...)     do {                                                        \
+     char buf[128];                                                                  \
+     struct timeval tv;                                                              \
+     do_gettimeofday( &tv );                                                         \
+     snprintf( buf, sizeof(buf), x );                                                \
+     printk( KERN_DEBUG "%ld.%03ld.%03ld - %-17s: %s\n",                             \
+             tv.tv_sec - base_time.tv_sec,                                           \
+             tv.tv_usec / 1000, tv.tv_usec % 1000, __FUNCTION__, buf );              \
+} while (0)
+#else
+#define JPRINT(x...)     do {} while (0)
+#endif
+
+/**********************************************************************************************************************/
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+#  define USE_DMA_ALLOC_COHERENT
+#endif
+
+static DECLARE_WAIT_QUEUE_HEAD( wait_idle );
+static DECLARE_WAIT_QUEUE_HEAD( wait_next );
+
+static SH772xGfxSharedArea *shared;
+
+static struct timeval       base_time;
+
+static struct page         *shared_page;
+static unsigned int         shared_order;
+
+#ifdef USE_DMA_ALLOC_COHERENT
+static unsigned long	 	shared_phys;
+#endif
+
+#ifdef SH7722GFX_IRQ_POLLER
+static int                  stop_poller;
+#endif
+
+/**********************************************************************************************************************/
+
+static DECLARE_WAIT_QUEUE_HEAD( wait_jpeg_irq );
+static DECLARE_WAIT_QUEUE_HEAD( wait_jpeg_run );
+static DECLARE_WAIT_QUEUE_HEAD( wait_jpeg_lock );
+
+static struct page         *jpeg_page;
+static unsigned int         jpeg_order;
+static volatile void       *jpeg_area;
+static u32                  jpeg_buffers;
+static int                  jpeg_buffer;
+static u32                  jpeg_error;
+static int                  jpeg_encode;
+static int                  jpeg_reading;
+static int                  jpeg_writing;
+static int                  jpeg_reading_line;
+static int                  jpeg_writing_line;
+static int                  jpeg_height;
+static int                  jpeg_inputheight;
+static unsigned long        jpeg_phys;
+static int                  jpeg_end;
+static u32                  jpeg_linebufs;
+static int                  jpeg_linebuf;
+static int                  jpeg_line;
+static int                  jpeg_line_veu; /* is the VEU done yet? */
+static int                  veu_linebuf;
+static int                  veu_running;
+
+static pid_t                jpeg_locked;
+
+/**********************************************************************************************************************/
+
+static int
+sh7722_reset( SH772xGfxSharedArea *shared )
+{
+     int i;
+
+     do_gettimeofday( &base_time );
+
+     QPRINT( "Resetting hardware..." );
+
+     BEM_HC_CLOCK = 0;
+     for (i=0; i<30000; i++);
+     BEM_HC_CLOCK = 0x1111;
+
+     BEM_HC_RESET = 0x1111;
+     for (i=0; i<30000; i++);
+     BEM_HC_RESET = 0;
+
+
+     QPRINT( "Initializing shared area..." );
+
+     memset( (void*) shared, 0, sizeof(SH772xGfxSharedArea) );
+
+#ifdef USE_DMA_ALLOC_COHERENT
+     shared->buffer_phys = shared_phys;
+#else
+     shared->buffer_phys = virt_to_phys(&shared->buffer[0]);
+#endif
+     shared->jpeg_phys   = virt_to_phys(jpeg_area);
+     shared->magic       = SH7722GFX_SHARED_MAGIC;
+
+
+     QPRINT( "Clearing interrupts..." );
+
+     BEM_HC_INT_CLEAR = 0x111111;
+     BEM_HC_INT_MASK  = 0x110011;
+
+     BEM_HC_CACHE_FLUSH = 0;
+
+     QDUMP( "Ready" );
+
+     return 0;
+}
+
+static int
+sh7722_wait_idle( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     QDUMP( "Waiting....." );
+
+     /* Does not need to be atomic. There's a lock in user space,
+      * but anyhow, this is just for statistics. */
+     shared->num_wait_idle++;
+
+     ret = wait_event_interruptible_timeout( wait_idle, !shared->hw_running, 42*HZ );
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                           "STATUS 0x%08x, INT_STATUS 0x%08x)\n",
+                  __FUNCTION__,
+                  shared->hw_running ? "" : "not ",
+                  shared->hw_start,
+                  shared->hw_end,
+                  shared->next_start,
+                  shared->next_end,
+                  shared->next_valid ? "" : "not ",
+                  BEM_HC_STATUS, BEM_HC_INT_STATUS );
+     }
+
+     QDUMP( "........done" );
+
+     return (ret > 0) ? 0 : (ret < 0) ? ret : -ETIMEDOUT;
+}
+
+static int
+sh7722_wait_next( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     QDUMP( "Waiting....." );
+
+     /* Does not need to be atomic. There's a lock in user space,
+      * but anyhow, this is just for statistics. */
+     shared->num_wait_next++;
+
+     ret = wait_event_interruptible_timeout( wait_next, !shared->hw_running ||
+                                             shared->next_start == shared->next_end, 42*HZ );
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                           "STATUS 0x%08x, INT_STATUS 0x%08x)\n",
+                  __FUNCTION__,
+                  shared->hw_running ? "" : "not ",
+                  shared->hw_start,
+                  shared->hw_end,
+                  shared->next_start,
+                  shared->next_end,
+                  shared->next_valid ? "" : "not ",
+                  BEM_HC_STATUS, BEM_HC_INT_STATUS );
+     }
+
+     QDUMP( "........done" );
+
+     return (ret > 0) ? 0 : (ret < 0) ? ret : -ETIMEDOUT;
+}
+
+/**********************************************************************************************************************/
+
+static int
+sh7722_wait_jpeg( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     ret = wait_event_interruptible_timeout( wait_jpeg_irq, shared->jpeg_ints, HZ );
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (status 0x%08x, ints 0x%08x)\n", __FUNCTION__, JPU_JCSTS, JPU_JINTS );
+     }
+
+     return (ret > 0) ? 0 : (ret < 0) ? ret : -ETIMEDOUT;
+}
+
+static int
+sh7722_run_jpeg( SH772xGfxSharedArea *shared,
+                 SH7722JPEG          *jpeg )
+{
+     int ret;
+     int encode  = (jpeg->flags & SH7722_JPEG_FLAG_ENCODE) ? 1 : 0;
+     int convert = (jpeg->flags & SH7722_JPEG_FLAG_CONVERT) ? 1 : 0;
+
+     JPRINT( "run JPEG called %d", jpeg->state );
+
+     switch (jpeg->state) {
+          case SH7722_JPEG_START:
+               JPRINT( "START (buffers: %d, flags: 0x%x)", jpeg->buffers, jpeg->flags );
+
+               jpeg_line         = 0;
+               jpeg_line_veu     = 0;
+               jpeg_end          = 0;
+               jpeg_error        = 0;
+               jpeg_encode       = encode;
+               jpeg_reading      = 0;
+               jpeg_writing      = 2;
+               jpeg_reading_line = encode && !convert;
+               jpeg_writing_line = !encode;
+               jpeg_height       = jpeg->height;
+               jpeg_inputheight  = jpeg->inputheight;
+               jpeg_phys         = jpeg->phys;
+               jpeg_linebuf      = 0;
+               jpeg_linebufs     = 0;
+               jpeg_buffer       = 0;
+               jpeg_buffers      = jpeg->buffers;
+               veu_linebuf       = 0;
+               veu_running       = 0;
+
+               jpeg->state       = SH7722_JPEG_RUN;
+               jpeg->error       = 0;
+
+//               if (!encode || !convert)
+                    JPU_JCCMD = JCCMD_START;
+               break;
+
+          case SH7722_JPEG_RUN:
+               JPRINT( "RUN (buffers: %d)", jpeg->buffers );
+
+               /* Validate loaded buffers. */
+               jpeg_buffers |= jpeg->buffers;
+               break;
+
+          default:
+               printk( KERN_ERR "%s: INVALID STATE %d! (status 0x%08x, ints 0x%08x)\n",
+                       __FUNCTION__, jpeg->state, JPU_JCSTS, JPU_JINTS );
+               return -EINVAL;
+     }
+
+     if (encode) {
+          if (convert) {
+               if (jpeg_linebufs != 3 && !veu_running) {
+                    JPRINT( " '-> convert start (buffers: %d, veu linebuf: %d)", jpeg_buffers, veu_linebuf );
+
+                    veu_running = 1;
+
+                    VEU_VDAYR = veu_linebuf ? JPU_JIFESYA2 : JPU_JIFESYA1;
+                    VEU_VDACR = veu_linebuf ? JPU_JIFESCA2 : JPU_JIFESCA1;
+                    VEU_VESTR = 0x1;
+               }
+          }
+          if (jpeg_buffers && !jpeg_writing) {
+               JPRINT( " '-> write start (buffers: %d)", jpeg_buffers );
+
+               jpeg_writing = 1;
+               JPU_JCCMD = JCCMD_WRITE_RESTART;
+          }
+     }
+     else if (jpeg_buffers && !jpeg_reading) {
+          JPRINT( " '-> read start (buffers: %d)", jpeg_buffers );
+
+          jpeg_reading = 1;
+          JPU_JCCMD = JCCMD_READ_RESTART;
+     }
+
+     ret = wait_event_interruptible_timeout( wait_jpeg_run,
+                                             jpeg_end || jpeg_error ||
+                                             (jpeg_buffers != 3 && (jpeg->flags & SH7722_JPEG_FLAG_RELOAD)), 5 * HZ );
+     if (ret < 0)
+          return ret;
+          
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (JCSTS 0x%08x, JINTS 0x%08x, JCRST 0x%08x)\n", __FUNCTION__,
+                  JPU_JCSTS, JPU_JINTS, JPU_JCRST );
+          return -ETIMEDOUT;
+     }
+
+     if (jpeg_error) {
+          /* Return error. */
+          jpeg->state = SH7722_JPEG_END;
+          jpeg->error = jpeg_error;
+
+          JPRINT( " '-> ERROR (0x%x)", jpeg->error );
+     }
+     else {
+          /* Return buffers to reload or to empty. */
+          jpeg->buffers = jpeg_buffers ^ 3;
+
+          if (jpeg_end) {
+               JPRINT( " '-> END" );
+
+               /* Return end. */
+               jpeg->state    = SH7722_JPEG_END;
+               jpeg->buffers |= 1 << jpeg_buffer;
+          }
+          else if (encode)
+               JPRINT( " '-> LOADED (%d)", jpeg->buffers );
+          else
+               JPRINT( " '-> RELOAD (%d)", jpeg->buffers );
+     }
+
+     return 0;
+}
+
+static int
+sh7722_lock_jpeg( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     if (jpeg_locked) {
+          ret = wait_event_interruptible_timeout( wait_jpeg_lock, !jpeg_locked, 5 * HZ );
+          if (ret < 0)
+               return ret;
+               
+          if (!ret) {
+               printk( KERN_ERR "%s: TIMEOUT! (status 0x%08x, ints 0x%08x)\n", __FUNCTION__, JPU_JCSTS, JPU_JINTS );
+               return -ETIMEDOUT;
+          }
+     }
+
+     jpeg_locked = current->pid;
+
+     return 0;
+}
+
+static int
+sh7722_unlock_jpeg( SH772xGfxSharedArea *shared )
+{
+     if (jpeg_locked != current->pid)
+          return -EIO;
+
+     jpeg_locked = 0;
+
+     wake_up_all( &wait_jpeg_lock );
+
+     return 0;
+}
+
+/**********************************************************************************************************************/
+
+static irqreturn_t
+sh7722_jpu_irq( int irq, void *ctx )
+{
+     u32                  ints;
+     SH772xGfxSharedArea *shared = ctx;
+     
+     ints = JPU_JINTS;
+
+     JPU_JINTS = ~ints & JINTS_MASK;
+
+     if (ints & (JINTS_INS3_HEADER | JINTS_INS5_ERROR | JINTS_INS6_DONE))
+          JPU_JCCMD = JCCMD_END;
+
+     JPRINT( " ... JPU int 0x%08x (veu_linebuf:%d,jpeg_linebuf:%d,jpeg_linebufs:%d,jpeg_line:%d,jpeg_buffers:%d)",
+             ints, veu_linebuf, jpeg_linebuf, jpeg_linebufs, jpeg_line, jpeg_buffers );
+
+     if (ints) {
+          shared->jpeg_ints |= ints;
+
+          wake_up_all( &wait_jpeg_irq );
+
+          /* Header */
+          if (ints & JINTS_INS3_HEADER) {
+               JPRINT( "         -> HEADER (%dx%d)", JPU_JIFDDHSZ, JPU_JIFDDVSZ );
+          }
+
+          /* Error */
+          if (ints & JINTS_INS5_ERROR) {
+               jpeg_error = JPU_JCDERR;
+
+               JPRINT( "         -> ERROR 0x%08x!", jpeg_error );
+
+               wake_up_all( &wait_jpeg_run );
+          }
+
+          /* Done */
+          if (ints & JINTS_INS6_DONE) {
+               jpeg_end = 1;
+
+               JPRINT( "         -> DONE" );
+
+               JPU_JCCMD = JCCMD_END;
+
+               wake_up_all( &wait_jpeg_run );
+          }
+
+          /* Done */
+          if (ints & JINTS_INS10_XFER_DONE) {
+               jpeg_end = 1;
+
+               JPRINT( "         -> XFER DONE" );
+
+               JPU_JCCMD = JCCMD_END;
+
+               wake_up_all( &wait_jpeg_run );
+          }
+
+          /* Line buffer ready? FIXME: encoding */
+          if (ints & (JINTS_INS11_LINEBUF0 | JINTS_INS12_LINEBUF1)) {
+               JPRINT( "         -> LINEBUF %d", jpeg_linebuf );
+
+               if (jpeg_encode) {
+                    jpeg_linebufs &= ~(1 << jpeg_linebuf);
+
+                    jpeg_linebuf = jpeg_linebuf ? 0 : 1;
+
+                    if (jpeg_linebufs) {
+                         jpeg_reading_line = 1;   /* should still be one */
+
+                         if (!jpeg_end)
+                              JPU_JCCMD = JCCMD_LCMD2 | JCCMD_LCMD1;
+                    }
+                    else {
+                         jpeg_reading_line = 0;
+                    }
+
+                    jpeg_line += 16;
+
+                    if (jpeg_line_veu<jpeg_height && !veu_running && !jpeg_end) {
+                         int offset = 0;
+                         int n      = 0;
+               
+                         JPRINT( "         -> CONVERT %d", veu_linebuf );
+
+                         veu_running = 1;
+
+                         /* we will not update VESSR or VRFSR to prevent recalculating
+                          * the input lines in case of partial content.
+                          * This prevents hangups in case of program errors */
+
+                         n = jpeg_line_veu * jpeg_inputheight;
+                         while (n >= jpeg_height*8) { offset+=8; n -= jpeg_height*8; }
+                         while (n >= jpeg_height)   { offset++;  n -= jpeg_height;   }
+                          
+                         /* VEU_VSACR is only used for CbCr, so we can simplify a bit */
+                         n = (VEU_VTRCR & VTRCR_CHRR) ? 0 : 1;
+
+                         VEU_VSAYR = jpeg_phys + offset * VEU_VESWR;
+                         VEU_VSACR = jpeg_phys + ((offset >> n) + jpeg_height) * VEU_VESWR;
+
+                         VEU_VDAYR = veu_linebuf ? JPU_JIFESYA2 : JPU_JIFESYA1;
+                         VEU_VDACR = veu_linebuf ? JPU_JIFESCA2 : JPU_JIFESCA1;
+                         VEU_VESTR = 0x1;
+                    }
+               }
+               else {
+                    jpeg_linebufs |= (1 << jpeg_linebuf);
+
+                    jpeg_linebuf = jpeg_linebuf ? 0 : 1;
+
+                    if (jpeg_linebufs != 3) {
+                         jpeg_writing_line = 1;   /* should still be one */
+
+                         if (jpeg_line > 0 && !jpeg_end)
+                              JPU_JCCMD = JCCMD_LCMD1 | JCCMD_LCMD2;
+                    }
+                    else {
+                         jpeg_writing_line = 0;
+                    }
+
+                    jpeg_line += 16;
+
+                    if (!veu_running && !jpeg_end && !jpeg_error) {
+                         JPRINT( "         -> CONVERT %d", veu_linebuf );
+
+                         veu_running = 1;
+
+                         VEU_VSAYR = veu_linebuf ? JPU_JIFDDYA2 : JPU_JIFDDYA1;
+                         VEU_VSACR = veu_linebuf ? JPU_JIFDDCA2 : JPU_JIFDDCA1;
+                         VEU_VESTR = 0x101;
+                    }
+               }
+          }
+
+          /* Loaded */
+          if (ints & JINTS_INS13_LOADED) {
+               JPRINT( "         -> LOADED %d (writing: %d)", jpeg_buffer, jpeg_writing );
+
+               jpeg_buffers &= ~(1 << jpeg_buffer);
+
+               jpeg_buffer = jpeg_buffer ? 0 : 1;
+
+               jpeg_writing--;
+
+               wake_up_all( &wait_jpeg_run );
+          }
+
+          /* Reload */
+          if (ints & JINTS_INS14_RELOAD) {
+               JPRINT( "         -> RELOAD %d", jpeg_buffer );
+
+               jpeg_buffers &= ~(1 << jpeg_buffer);
+
+               jpeg_buffer = jpeg_buffer ? 0 : 1;
+
+               if (jpeg_buffers) {
+                    jpeg_reading = 1;   /* should still be one */
+
+                    JPU_JCCMD = JCCMD_READ_RESTART;
+               }
+               else
+                    jpeg_reading = 0;
+
+               wake_up_all( &wait_jpeg_run );
+          }
+     }
+
+     return IRQ_HANDLED;
+}
+
+/**********************************************************************************************************************/
+
+static irqreturn_t
+sh7722_veu_irq( int irq, void *ctx )
+{
+     u32 events = VEU_VEVTR;
+
+     VEU_VEVTR = ~events & 0x101;
+
+     JPRINT( " ... VEU int 0x%08x (veu_linebuf:%d,jpeg_linebuf:%d,jpeg_linebufs:%d,jpeg_line:%d)",
+             events, veu_linebuf, jpeg_linebuf, jpeg_linebufs, jpeg_line );
+
+     /* update the lines processed.
+      * If we have tmpphys memory, we are ready now (veu lines == height) */
+     jpeg_line_veu += (VEU_VRFSR >> 16);
+
+     if (jpeg_encode) {
+          /* Fill line buffers. */
+          jpeg_linebufs |= 1 << veu_linebuf;
+
+          /* Resume encoding if it was blocked. */
+          if (!jpeg_reading_line && !jpeg_end && !jpeg_error && jpeg_linebufs) {
+               JPRINT( "         -> ENCODE %d", veu_linebuf );
+               jpeg_reading_line = 1;
+               JPU_JCCMD = JCCMD_LCMD2 | JCCMD_LCMD1;
+          }
+
+          veu_linebuf = veu_linebuf ? 0 : 1;
+
+          if(    jpeg_line_veu < jpeg_height /* still some more lines to do */
+             &&  jpeg_linebufs != 3          /* and still some place to put them */
+             && !jpeg_end                    /* safety, should not happen */
+             && !jpeg_error ) {
+               int offset = 0;
+               int n      = 0;
+               
+               JPRINT( "         -> CONVERT %d", veu_linebuf );
+
+               n = jpeg_line_veu * jpeg_inputheight;
+               while (n >= jpeg_height*8) { offset+=8; n -= jpeg_height*8; }
+               while (n >= jpeg_height)   { offset++;  n -= jpeg_height;   }
+               
+               /* VEU_VSACR is only used for CbCr, so we can simplify a bit */
+               n = (VEU_VTRCR & VTRCR_CHRR) ? 0 : 1;
+
+               VEU_VSAYR = jpeg_phys + offset * VEU_VESWR;
+               VEU_VSACR = jpeg_phys + ((offset >> n) + jpeg_height) * VEU_VESWR;
+
+               VEU_VDAYR  = veu_linebuf ? JPU_JIFESYA2 : JPU_JIFESYA1;
+               VEU_VDACR  = veu_linebuf ? JPU_JIFESCA2 : JPU_JIFESCA1;
+
+               veu_running = 1;   /* kick VEU to continue */
+               VEU_VESTR = 0x1;
+          }
+          else {
+               veu_running = 0;
+          }
+     }
+     else {
+          /* Release line buffer. */
+          jpeg_linebufs &= ~(1 << veu_linebuf);
+
+          /* Resume decoding if it was blocked. */
+          if (!jpeg_writing_line && !jpeg_end && !jpeg_error && jpeg_linebufs != 3) {
+               JPRINT( "         -> RESUME %d", jpeg_linebuf );
+
+               jpeg_writing_line = 1;
+
+               JPU_JCCMD = JCCMD_LCMD1 | JCCMD_LCMD2;
+          }
+
+          veu_linebuf = veu_linebuf ? 0 : 1;
+
+          if (jpeg_linebufs) {
+               JPRINT( "         -> CONVERT %d", veu_linebuf );
+
+               veu_running = 1;   /* should still be one */
+
+               VEU_VSAYR = veu_linebuf ? JPU_JIFDDYA2 : JPU_JIFDDYA1;
+               VEU_VSACR = veu_linebuf ? JPU_JIFDDCA2 : JPU_JIFDDCA1;
+               VEU_VESTR = 0x101;
+          }
+          else {
+               if (jpeg_end)
+                    wake_up_all( &wait_jpeg_run );
+
+               veu_running = 0;
+          }
+     }
+
+     return IRQ_HANDLED;
+}
+
+/**********************************************************************************************************************/
+
+static irqreturn_t
+sh7722_beu_irq( int irq, void *ctx )
+{
+     BEVTR = 0;
+
+     /* Nothing here so far. But Vsync could be added. */
+
+     return IRQ_HANDLED;
+}
+
+/**********************************************************************************************************************/
+
+static irqreturn_t
+sh7722_tdg_irq( int irq, void *ctx )
+{
+     SH772xGfxSharedArea *shared = ctx;
+     u32                  status = BEM_HC_INT_STATUS;
+
+     if (! (status & 0x111111)) {
+#ifndef SH7722GFX_IRQ_POLLER
+          printk( KERN_WARNING "%s: bogus interrupt, INT_STATUS 0x%08x!\n", __FUNCTION__, status );
+#endif
+          return IRQ_NONE;
+     }
+
+     if (status & ~0x100)
+          QDUMP( "-Interrupt" );
+
+     if (status & ~0x101100)
+          printk( KERN_ERR "%s: error! INT_STATUS 0x%08x!\n", __FUNCTION__, status );
+
+     shared->num_interrupts++;
+
+     /* Clear the interrupt. */
+     BEM_HC_INT_CLEAR = status;
+
+     if (status & 0x100010) {
+          if (!shared->hw_running)
+               printk( KERN_WARNING "%s: hw not running? INT_STATUS 0x%08x!\n", __FUNCTION__, status );
+
+          if (status & 0x10) {
+               printk( KERN_ERR "%s: RUNAWAY! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                                "STATUS 0x%08x, INT_STATUS 0x%08x)\n",
+                       __FUNCTION__,
+                       shared->hw_running ? "" : "not ",
+                       shared->hw_start,
+                       shared->hw_end,
+                       shared->next_start,
+                       shared->next_end,
+                       shared->next_valid ? "" : "not ",
+                       BEM_HC_STATUS, status );
+
+               BEM_HC_RESET = 0x1111;
+          }
+
+          /* Next valid means user space is not in the process of extending the buffer. */
+          if (shared->next_valid && shared->next_start != shared->next_end) {
+               shared->hw_start = shared->next_start;
+               shared->hw_end   = shared->next_end;
+
+               shared->next_start = shared->next_end = (shared->hw_end + 1 + 3) & ~3;
+               shared->next_valid = 0;
+
+               shared->num_words += shared->hw_end - shared->hw_start;
+
+               shared->num_starts++;
+
+               QDUMP( " '-> Start!" );
+
+               BEM_HC_DMA_ADR   = shared->buffer_phys + shared->hw_start*4;
+               BEM_HC_DMA_START = 1;
+
+               wake_up_all( &wait_next );
+          }
+          else {
+               shared->num_idle++;
+
+               QDUMP( " '-> Idle." );
+
+               BEM_PE_CACHE = 1;
+
+               shared->hw_running = 0;
+
+               wake_up_all( &wait_next );
+               wake_up_all( &wait_idle );
+          }
+
+          shared->num_done++;
+     }
+
+     return IRQ_HANDLED;
+}
+
+#ifdef SH7722GFX_IRQ_POLLER
+static int
+sh7722_tdg_irq_poller( void *arg )
+{
+     daemonize( "%s", __FUNCTION__ );
+
+     sigfillset( ¤t->blocked );
+
+     while (!stop_poller) {
+          set_current_state( TASK_UNINTERRUPTIBLE );
+          schedule_timeout( 1 );
+
+          sh7722_tdg_irq( SH7722_TDG_IRQ, (void*) arg );
+     }
+
+     stop_poller = 0;
+
+     return 0;
+}
+#endif
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+static int
+sh7722gfx_flush( struct file *filp,
+                 fl_owner_t   id )
+{
+     if (jpeg_locked == current->pid) {
+          jpeg_locked = 0;
+
+          wake_up_all( &wait_jpeg_lock );
+     }
+          
+     return 0;
+}
+
+static int
+sh7722gfx_ioctl( struct inode  *inode,
+                 struct file   *filp,
+                 unsigned int   cmd,
+                 unsigned long  arg )
+{
+     int            ret;
+     SH772xRegister reg;
+     SH7722JPEG     jpeg;
+
+     switch (cmd) {
+          case SH772xGFX_IOCTL_RESET:
+               return sh7722_reset( shared );
+
+          case SH772xGFX_IOCTL_WAIT_IDLE:
+               return sh7722_wait_idle( shared );
+
+          case SH772xGFX_IOCTL_WAIT_NEXT:
+               return sh7722_wait_next( shared );
+
+          case SH772xGFX_IOCTL_SETREG32:
+               if (copy_from_user( ®, (void*)arg, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               /* VEU, BEU, LCDC, VOU, JPEG */
+               if (reg.address < 0xFE920000 || reg.address > 0xFEA102D0)
+                    return -EACCES;
+
+               *(volatile __u32 *) reg.address = reg.value;
+
+               return 0;
+
+          case SH772xGFX_IOCTL_GETREG32:
+               if (copy_from_user( ®, (void*)arg, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               /* VEU, BEU, LCDC, VOU, JPEG */
+               if (reg.address < 0xFE920000 || reg.address > 0xFEA102D0)
+                    return -EACCES;
+
+               reg.value = *(volatile __u32 *) reg.address;
+
+               if (copy_to_user( (void*)arg, ®, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               return 0;
+
+          case SH7722GFX_IOCTL_WAIT_JPEG:
+               return sh7722_wait_jpeg( shared );
+
+          case SH7722GFX_IOCTL_RUN_JPEG:
+               if (copy_from_user( &jpeg, (void*)arg, sizeof(SH7722JPEG) ))
+                    return -EFAULT;
+
+               ret = sh7722_run_jpeg( shared, &jpeg );
+               if (ret)
+                    return ret;
+
+               if (copy_to_user( (void*)arg, &jpeg, sizeof(SH7722JPEG) ))
+                    return -EFAULT;
+
+               return 0;
+
+          case SH7722GFX_IOCTL_LOCK_JPEG:
+               return sh7722_lock_jpeg( shared );
+
+          case SH7722GFX_IOCTL_UNLOCK_JPEG:
+               return sh7722_unlock_jpeg( shared );
+     }
+
+     return -ENOSYS;
+}
+
+static int
+sh7722gfx_mmap( struct file           *file,
+                struct vm_area_struct *vma )
+{
+     unsigned int size;
+
+     /* Just allow mapping at offset 0. */
+     if (vma->vm_pgoff)
+          return -EINVAL;
+
+     /* Check size of requested mapping. */
+     size = vma->vm_end - vma->vm_start;
+     if (size != PAGE_ALIGN(sizeof(SH772xGfxSharedArea)))
+          return -EINVAL;
+
+     /* Set reserved and I/O flag for the area. */
+     vma->vm_flags |= VM_RESERVED | VM_IO;
+
+     /* Select uncached access. */
+     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+#ifdef USE_DMA_ALLOC_COHERENT
+	 return remap_pfn_range( vma, vma->vm_start, 
+			 				 (__u32)shared >> PAGE_SHIFT, 
+							 size, vma->vm_page_prot );
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
+     return remap_pfn_range( vma, vma->vm_start,
+                             virt_to_phys((void*)shared) >> PAGE_SHIFT,
+                             size, vma->vm_page_prot );
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+     return remap_page_range( vma, vma->vm_start,
+                              virt_to_phys((void*)shared),
+                              size, vma->vm_page_prot );
+#else
+     return io_remap_page_range( vma->vm_start,
+                                 virt_to_phys((void*)shared),
+                                 size, vma->vm_page_prot );
+#endif
+}
+
+/**********************************************************************************************************************/
+
+static struct file_operations sh7722gfx_fops = {
+     flush:    sh7722gfx_flush,
+     ioctl:    sh7722gfx_ioctl,
+     mmap:     sh7722gfx_mmap
+};
+
+static struct miscdevice sh7722gfx_miscdev = {
+     minor:    196,           // 7*7*2*2
+     name:     "sh772x_gfx",
+     fops:     &sh7722gfx_fops
+};
+
+/**********************************************************************************************************************/
+
+int
+sh7722_init( void )
+{
+     int i;
+     int ret;
+
+     /* Register the SH7722 graphics device. */
+     ret = misc_register( &sh7722gfx_miscdev );
+     if (ret < 0) {
+          printk( KERN_ERR "%s: misc_register() for minor %d failed! (error %d)\n",
+                  __FUNCTION__, sh7722gfx_miscdev.minor, ret );
+          return ret;
+     }
+
+     /* Allocate and initialize the shared area. */
+#ifdef USE_DMA_ALLOC_COHERENT
+	 shared		  = dma_alloc_coherent( NULL, sizeof(SH772xGfxSharedArea), 
+			 						    (dma_addr_t*)&shared_phys, GFP_KERNEL );
+
+     printk( KERN_INFO "sh7722gfx: shared area at %p [%lx/%lx] using %d bytes\n",
+             shared, virt_to_phys(shared), shared_phys, sizeof(SH772xGfxSharedArea) );
+
+#else
+     shared_order = get_order(PAGE_ALIGN(sizeof(SH772xGfxSharedArea)));
+     shared_page  = alloc_pages( GFP_DMA | GFP_KERNEL, shared_order );
+     shared       = ioremap( virt_to_phys( page_address(shared_page) ),
+                             PAGE_ALIGN(sizeof(SH772xGfxSharedArea)) );
+
+     for (i=0; i<1<<shared_order; i++)
+          SetPageReserved( shared_page + i );
+
+     printk( KERN_INFO "sh7722gfx: shared area (order %d) at %p [%lx] using %d bytes\n",
+             shared_order, shared, virt_to_phys(shared), sizeof(SH772xGfxSharedArea) );
+#endif
+
+
+     /* Allocate and initialize the JPEG area. */
+     jpeg_order = get_order(SH7722GFX_JPEG_SIZE);
+     jpeg_page  = alloc_pages( GFP_DMA | GFP_KERNEL, jpeg_order );
+     jpeg_area  = ioremap( virt_to_phys( page_address(jpeg_page) ),
+                           PAGE_ALIGN(SH7722GFX_JPEG_SIZE) );
+
+     for (i=0; i<1<<jpeg_order; i++)
+          SetPageReserved( jpeg_page + i );
+
+     printk( KERN_INFO "sh7722gfx: jpeg area (order %d) at %p [%lx] using %d bytes\n",
+             jpeg_order, jpeg_area, virt_to_phys(jpeg_area), SH7722GFX_JPEG_SIZE );
+
+
+     /* Register the BEU interrupt handler. */
+     ret = request_irq( SH7722_BEU_IRQ, sh7722_beu_irq, IRQF_DISABLED, "BEU", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7722_BEU_IRQ, ret );
+          goto error_beu;
+     }
+
+#ifdef SH7722GFX_IRQ_POLLER
+     kernel_thread( sh7722_tdg_irq_poller, (void*) shared, CLONE_KERNEL );
+#else
+     /* Register the TDG interrupt handler. */
+     ret = request_irq( SH7722_TDG_IRQ, sh7722_tdg_irq, IRQF_DISABLED, "TDG", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7722_TDG_IRQ, ret );
+          goto error_tdg;
+     }
+#endif
+
+     /* Register the JPU interrupt handler. */
+     ret = request_irq( SH7722_JPU_IRQ, sh7722_jpu_irq, IRQF_DISABLED, "JPU", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7722_JPU_IRQ, ret );
+          goto error_jpu;
+     }
+
+#if 0
+     /* Register the VEU interrupt handler. */
+     ret = request_irq( SH7722_VEU_IRQ, sh7722_veu_irq, IRQF_DISABLED, "VEU", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7722_VEU_IRQ, ret );
+          goto error_veu;
+     }
+#endif
+
+     sh7722_reset( shared );
+
+     return 0;
+
+
+error_veu:
+     free_irq( SH7722_JPU_IRQ, (void*) shared );
+
+error_jpu:
+#ifndef SH7722GFX_IRQ_POLLER
+     free_irq( SH7722_TDG_IRQ, (void*) shared );
+
+error_tdg:
+#endif
+     free_irq( SH7722_BEU_IRQ, (void*) shared );
+
+error_beu:
+     for (i=0; i<1<<jpeg_order; i++)
+          ClearPageReserved( jpeg_page + i );
+
+     __free_pages( jpeg_page, jpeg_order );
+
+
+     for (i=0; i<1<<shared_order; i++)
+          ClearPageReserved( shared_page + i );
+
+     __free_pages( shared_page, shared_order );
+
+
+     misc_deregister( &sh7722gfx_miscdev );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+void
+sh7722_exit( void )
+{
+     int i;
+
+
+     free_irq( SH7722_VEU_IRQ, (void*) shared );
+     free_irq( SH7722_JPU_IRQ, (void*) shared );
+
+#ifdef SH7722GFX_IRQ_POLLER
+     stop_poller = 1;
+
+     while (stop_poller) {
+          set_current_state( TASK_UNINTERRUPTIBLE );
+          schedule_timeout( 1 );
+     }
+#else
+     free_irq( SH7722_TDG_IRQ, (void*) shared );
+#endif
+
+     free_irq( SH7722_BEU_IRQ, (void*) shared );
+
+     misc_deregister( &sh7722gfx_miscdev );
+
+
+     for (i=0; i<1<<jpeg_order; i++)
+          ClearPageReserved( jpeg_page + i );
+
+     __free_pages( jpeg_page, jpeg_order );
+
+
+#ifdef USE_DMA_ALLOC_COHERENT
+	 dma_free_coherent( NULL, sizeof(SH772xGfxSharedArea), 
+			 			(void*)shared, (dma_addr_t)shared_phys );
+#else
+     for (i=0; i<1<<shared_order; i++)
+          ClearPageReserved( shared_page + i );
+
+     __free_pages( shared_page, shared_order );
+#endif
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.h b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.h
new file mode 100755
index 0000000..fc6f049
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7722.h
@@ -0,0 +1,21 @@
+/*
+ * SH7722/SH7723 Graphics Device
+ *
+ * Copyright (C) 2006-2008  IGEL Co.,Ltd
+ *
+ * Written by Denis Oliver Kropp <dok@directfb.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License v2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef __SH7722_H__
+#define __SH7722_H__
+
+int  sh7722_init( void );
+void sh7722_exit( void );
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.c b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.c
new file mode 100755
index 0000000..ea64cf4
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.c
@@ -0,0 +1,566 @@
+/*
+ *	SH7723 Graphics Device
+ *
+ *	Copyright (C) 2006-2008  IGEL Co.,Ltd
+ *
+ *      Written by Janine Kropp <nin@directfb.org>,
+ *                 Denis Oliver Kropp <dok@directfb.org>
+ *                 
+ *
+ *
+ *	This program is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU General Public License v2
+ *	as published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/version.h>
+
+#include <linux/delay.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+#include <linux/ioctl.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
+#include <asm/mach/irq.h>
+#endif
+
+#include <sh772x_gfx.h>
+
+
+//#define SH7723GFX_DEBUG_2DG
+//#define SH7723GFX_IRQ_POLLER
+
+
+/**********************************************************************************************************************/
+
+#ifndef SH7723_BEU_IRQ
+#define SH7723_BEU_IRQ 53
+#endif
+
+#ifndef SH7723_TDG_IRQ
+#define SH7723_TDG_IRQ 44
+#endif
+
+/**********************************************************************************************************************/
+
+#define	ENGINE_REG_TOP   0xA4680000
+#define SH7723_BEU_BASE  0xFE930000
+
+#define M2DG_REG(x)      (*(volatile u32*)((x)+ENGINE_REG_TOP))
+#define BEU_REG(x)       (*(volatile u32*)((x)+SH7723_BEU_BASE))
+
+#define	M2DG_SCLR             M2DG_REG(0x000)
+#define	M2DG_DLSAR            M2DG_REG(0x048)
+
+
+#define M2DG_STATUS           M2DG_REG(0x004)
+#define M2DG_STATUS_CLEAR     M2DG_REG(0x008)
+#define M2DG_INT_ENABLE       M2DG_REG(0x00c)
+
+#define M2DG_SCLR_START       0x00000001 
+#define M2DG_SCLR_RESET       0x80000000
+
+#define M2DG_INT_TRAP         0x0001 
+#define M2DG_INT_INTERRUPT    0x0002
+#define M2DG_INT_ERROR        0x0004
+#define M2DG_INT_ANY          0x0007 
+
+#define BEVTR                 BEU_REG(0x0018C)
+
+/**********************************************************************************************************************/
+
+#ifdef SH7723GFX_DEBUG_2DG
+#define QPRINT(x...)     do {                                                        \
+     char buf[128];                                                                  \
+     struct timeval tv;                                                              \
+     do_gettimeofday( &tv );                                                         \
+     snprintf( buf, sizeof(buf), x );                                                \
+     printk( KERN_DEBUG "%ld.%03ld.%03ld - %-17s: %s\n",                             \
+             tv.tv_sec - base_time.tv_sec,                                           \
+             tv.tv_usec / 1000, tv.tv_usec % 1000, __FUNCTION__, buf );              \
+} while (0)
+#else
+#define QPRINT(x...)     do {} while (0)
+#endif
+
+#define QDUMP(msg)       QPRINT( "%-12s (%s, hw %5d-%5d, next %5d-%5d, %svalid, "    \
+                                 "STATUS 0x%07x)", msg,                          \
+                                 shared->hw_running ? "running" : "   idle",         \
+                                 shared->hw_start,                                   \
+                                 shared->hw_end,                                     \
+                                 shared->next_start,                                 \
+                                 shared->next_end,                                   \
+                                 shared->next_valid ? "  " : "in",                   \
+                                 M2DG_STATUS & M2DG_INT_ANY );
+
+/**********************************************************************************************************************/
+
+static DECLARE_WAIT_QUEUE_HEAD( wait_idle );
+static DECLARE_WAIT_QUEUE_HEAD( wait_next );
+
+static SH772xGfxSharedArea *shared;
+
+static struct timeval       base_time;
+
+#ifndef SHARED_AREA_PHYS
+static struct page         *shared_page;
+static unsigned int         shared_order;
+#endif
+
+#ifdef SH7723GFX_IRQ_POLLER
+static int                  stop_poller;
+#endif
+
+/**********************************************************************************************************************/
+
+static int
+sh7723_reset( SH772xGfxSharedArea *shared )
+{
+     do_gettimeofday( &base_time );
+
+     QPRINT( "Resetting hardware..." );
+
+     M2DG_SCLR = M2DG_SCLR_RESET;
+     udelay( 5 );
+     M2DG_SCLR = 0;
+
+     QPRINT( "Initializing shared area..." );
+
+     memset( (void*) shared, 0, sizeof(SH772xGfxSharedArea) );
+
+     shared->buffer_phys = virt_to_phys(&shared->buffer[0]);
+     shared->magic       = SH7723GFX_SHARED_MAGIC;
+
+
+     QPRINT( "Clearing interrupts..." );
+
+     M2DG_STATUS_CLEAR = M2DG_INT_ANY;
+
+     M2DG_INT_ENABLE   = M2DG_INT_ANY;
+
+     QDUMP( "Ready" );
+
+     return 0;
+}
+
+/* copied from board-ap325rxa.c */
+#define PORT_PSCR        0xA405011E
+#define PORT_PSDR        0xA405013E
+#define FPGA_LCDREG      0xB4100180
+#define FPGA_BKLREG      0xB4100212
+
+static int
+sh7723_power_display( void )
+{
+     msleep(100);
+
+     /* ASD AP-320/325 LCD ON */
+     ctrl_outw(0x0018, FPGA_LCDREG);
+
+     /* backlight */
+     ctrl_outw((ctrl_inw(PORT_PSCR) & ~0x00C0) | 0x40, PORT_PSCR);
+     ctrl_outb(ctrl_inb(PORT_PSDR) & ~0x08, PORT_PSDR);
+     ctrl_outw(0x100, FPGA_BKLREG);
+     
+     return 0;
+}
+
+static int
+sh7723_wait_idle( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     QDUMP( "Waiting....." );
+
+     /* Does not need to be atomic. There's a lock in user space,
+      * but anyhow, this is just for statistics. */
+     shared->num_wait_idle++;
+
+     ret = wait_event_interruptible_timeout( wait_idle, !shared->hw_running, 42*HZ );
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                           "STATUS 0x%08x)\n",
+                  __FUNCTION__,
+                  shared->hw_running ? "" : "not ",
+                  shared->hw_start,
+                  shared->hw_end,
+                  shared->next_start,
+                  shared->next_end,
+                  shared->next_valid ? "" : "not ",
+                  M2DG_STATUS & M2DG_INT_ANY );
+     }
+
+     QDUMP( "........done" );
+
+     return (ret > 0) ? 0 : (ret < 0) ? ret : -ETIMEDOUT;
+}
+
+static int
+sh7723_wait_next( SH772xGfxSharedArea *shared )
+{
+     int ret;
+
+     QDUMP( "Waiting....." );
+
+     /* Does not need to be atomic. There's a lock in user space,
+      * but anyhow, this is just for statistics. */
+     shared->num_wait_next++;
+
+     ret = wait_event_interruptible_timeout( wait_next, !shared->hw_running ||
+                                             shared->next_start == shared->next_end, 42*HZ );
+     if (!ret) {
+          printk( KERN_ERR "%s: TIMEOUT! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                           "STATUS 0x%08x)\n",
+                  __FUNCTION__,
+                  shared->hw_running ? "" : "not ",
+                  shared->hw_start,
+                  shared->hw_end,
+                  shared->next_start,
+                  shared->next_end,
+                  shared->next_valid ? "" : "not ",
+                  M2DG_STATUS & M2DG_INT_ANY );
+     }
+
+     QDUMP( "........done" );
+
+     return (ret > 0) ? 0 : (ret < 0) ? ret : -ETIMEDOUT;
+}
+
+/**********************************************************************************************************************/
+
+static irqreturn_t
+sh7723_beu_irq( int irq, void *ctx )
+{
+     BEVTR = 0;
+
+     /* Nothing here so far. But Vsync could be added. */
+
+     return IRQ_HANDLED;
+}
+
+static irqreturn_t
+sh7723_tdg_irq( int irq, void *ctx )
+{
+     SH772xGfxSharedArea *shared = ctx;
+     u32                  status = M2DG_STATUS & M2DG_INT_ANY;
+
+     if (! (status & M2DG_INT_ANY)) {
+#ifndef SH7723GFX_IRQ_POLLER
+          printk( KERN_WARNING "%s: bogus interrupt, STATUS 0x%08x!\n", __FUNCTION__, status );
+#endif
+          return IRQ_NONE;
+     }
+
+//     if (status & ~0x100)
+          QDUMP( "-Interrupt" );
+
+     if (status & M2DG_INT_ERROR)
+          printk( KERN_ERR "%s: error! STATUS 0x%08x!\n", __FUNCTION__, status );
+
+     shared->num_interrupts++;
+
+     /* Clear the interrupt. */
+     M2DG_STATUS_CLEAR = status;
+
+     if (status & (M2DG_INT_TRAP | M2DG_INT_ERROR)) {
+          if (!shared->hw_running)
+               printk( KERN_WARNING "%s: huh, hw running? STATUS 0x%08x!\n", __FUNCTION__, status );
+
+          if (status & M2DG_INT_ERROR) {
+               printk( KERN_ERR "%s: ERROR! (%srunning, hw %d-%d, next %d-%d - %svalid, "
+                                "STATUS 0x%08x)\n",
+                       __FUNCTION__,
+                       shared->hw_running ? "" : "not ",
+                       shared->hw_start,
+                       shared->hw_end,
+                       shared->next_start,
+                       shared->next_end,
+                       shared->next_valid ? "" : "not ",
+                       status );
+
+               M2DG_SCLR = M2DG_SCLR_RESET;
+          }
+
+          /* Next valid means user space is not in the process of extending the buffer. */
+          if (shared->next_valid && shared->next_start != shared->next_end) {
+               shared->hw_start = shared->next_start;
+               shared->hw_end   = shared->next_end;
+
+               shared->next_start = shared->next_end = (shared->hw_end + 1 + 3) & ~3;
+               shared->next_valid = 0;
+
+               shared->num_words += shared->hw_end - shared->hw_start;
+
+               shared->num_starts++;
+
+               QDUMP( " '-> Start!" );
+
+               M2DG_DLSAR = shared->buffer_phys + shared->hw_start*4;
+               M2DG_SCLR  = M2DG_SCLR_START;
+
+               wake_up_all( &wait_next );
+          }
+          else {
+               shared->num_idle++;
+
+               QDUMP( " '-> Idle." );
+
+//check if needed
+//               BEM_PE_CACHE = 1;
+
+               shared->hw_running = 0;
+
+               wake_up_all( &wait_next );
+               wake_up_all( &wait_idle );
+          }
+
+          shared->num_done++;
+     }
+
+     return IRQ_HANDLED;
+}
+
+#ifdef SH7723GFX_IRQ_POLLER
+static int
+sh7723_tdg_irq_poller( void *arg )
+{
+     daemonize( "%s", __FUNCTION__ );
+
+     sigfillset( ¤t->blocked );
+
+     while (!stop_poller) {
+          set_current_state( TASK_UNINTERRUPTIBLE );
+          schedule_timeout( 1 );
+
+          sh7723_tdg_irq( SH7723_TDG_IRQ, (void*) arg );
+     }
+
+     stop_poller = 0;
+
+     return 0;
+}
+#endif
+
+/**********************************************************************************************************************/
+
+static int
+sh7723gfx_ioctl( struct inode  *inode,
+                 struct file   *filp,
+                 unsigned int   cmd,
+                 unsigned long  arg )
+{
+     SH772xRegister reg;
+
+     switch (cmd) {
+          case SH772xGFX_IOCTL_RESET:
+               return sh7723_reset( shared );
+
+          case SH772xGFX_IOCTL_WAIT_IDLE:
+               return sh7723_wait_idle( shared );
+
+          case SH772xGFX_IOCTL_WAIT_NEXT:
+               return sh7723_wait_next( shared );
+
+          case SH772xGFX_IOCTL_SETREG32:
+               if (copy_from_user( ®, (void*)arg, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               /* BEU, LCDC, VOU, 2DG */
+               if ((reg.address < 0xFE930000 || reg.address > 0xFEA102D0) &&
+                   (reg.address < 0xA4680000 || reg.address > 0xA468FFFF))
+                    return -EACCES;
+
+               *(volatile __u32 *) reg.address = reg.value;
+
+               return 0;
+
+          case SH772xGFX_IOCTL_GETREG32:
+               if (copy_from_user( ®, (void*)arg, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               /* BEU, LCDC, VOU */
+               if ((reg.address < 0xFE930000 || reg.address > 0xFEA102D0) &&
+                   (reg.address < 0xA4680000 || reg.address > 0xA468FFFF))
+                    return -EACCES;
+
+               reg.value = *(volatile __u32 *) reg.address;
+
+               if (copy_to_user( (void*)arg, ®, sizeof(SH772xRegister) ))
+                    return -EFAULT;
+
+               return 0;
+          
+          case SH772xGFX_IOCTL_POWER_DISPLAY:
+               return sh7723_power_display( );
+     }
+
+     return -ENOSYS;
+}
+
+static int
+sh7723gfx_mmap( struct file           *file,
+                struct vm_area_struct *vma )
+{
+     unsigned int size;
+
+     /* Just allow mapping at offset 0. */
+     if (vma->vm_pgoff)
+          return -EINVAL;
+
+     /* Check size of requested mapping. */
+     size = vma->vm_end - vma->vm_start;
+     if (size != PAGE_ALIGN(sizeof(SH772xGfxSharedArea)))
+          return -EINVAL;
+
+     /* Set reserved and I/O flag for the area. */
+     vma->vm_flags |= VM_RESERVED | VM_IO;
+
+     /* Select uncached access. */
+     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
+     return remap_pfn_range( vma, vma->vm_start,
+                             virt_to_phys((void*)shared) >> PAGE_SHIFT,
+                             size, vma->vm_page_prot );
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+     return remap_page_range( vma, vma->vm_start,
+                              virt_to_phys((void*)shared),
+                              size, vma->vm_page_prot );
+#else
+     return io_remap_page_range( vma->vm_start,
+                                 virt_to_phys((void*)shared),
+                                 size, vma->vm_page_prot );
+#endif
+}
+
+/**********************************************************************************************************************/
+
+static struct file_operations sh7723gfx_fops = {
+     ioctl:    sh7723gfx_ioctl,
+     mmap:     sh7723gfx_mmap
+};
+
+static struct miscdevice sh7723gfx_miscdev = {
+     minor:    196,           // 7*7*2*2
+     name:     "sh772x_gfx",
+     fops:     &sh7723gfx_fops
+};
+
+/**********************************************************************************************************************/
+
+int
+sh7723_init( void )
+{
+#ifndef SHARED_AREA_PHYS
+     int i;
+#endif
+     int ret;
+
+     /* Register the SH7723 graphics device. */
+     ret = misc_register( &sh7723gfx_miscdev );
+     if (ret < 0) {
+          printk( KERN_ERR "%s: misc_register() for minor %d failed! (error %d)\n",
+                  __FUNCTION__, sh7723gfx_miscdev.minor, ret );
+          return ret;
+     }
+
+     /* Allocate and initialize the shared area. */
+#ifdef SHARED_AREA_PHYS
+#if SHARED_AREA_SIZE < PAGE_ALIGN(sizeof(SH772xGfxSharedArea))
+#error SHARED_AREA_SIZE < PAGE_ALIGN(sizeof(SH772xGfxSharedArea))!
+#endif
+     shared = ioremap( SHARED_AREA_PHYS, PAGE_ALIGN(sizeof(SH772xGfxSharedArea)) );
+#else
+     shared_order = get_order(sizeof(SH772xGfxSharedArea));
+     shared_page  = alloc_pages( GFP_DMA | GFP_KERNEL, shared_order );
+     shared       = ioremap( virt_to_phys( page_address(shared_page) ),
+                             PAGE_ALIGN(sizeof(SH772xGfxSharedArea)) );
+
+     for (i=0; i<1<<shared_order; i++)
+          SetPageReserved( shared_page + i );
+#endif
+
+     printk( KERN_INFO "sh7723gfx: shared area (order %d) at %p [%lx] using %d bytes\n",
+             shared_order, shared, virt_to_phys(shared), sizeof(SH772xGfxSharedArea) );
+
+     /* Register the BEU interrupt handler. */
+     ret = request_irq( SH7723_BEU_IRQ, sh7723_beu_irq, IRQF_DISABLED, "BEU", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for BEU interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7723_BEU_IRQ, ret );
+          goto error_beu;
+     }
+
+#ifdef SH7723GFX_IRQ_POLLER
+     kernel_thread( sh7723_tdg_irq_poller, (void*) shared, CLONE_KERNEL );
+#else
+     /* Register the TDG interrupt handler. */
+     ret = request_irq( SH7723_TDG_IRQ, sh7723_tdg_irq, IRQF_DISABLED, "TDG", (void*) shared );
+     if (ret) {
+          printk( KERN_ERR "%s: request_irq() for TDG interrupt %d failed! (error %d)\n",
+                  __FUNCTION__, SH7723_TDG_IRQ, ret );
+          goto error_tdg;
+     }
+#endif
+
+     sh7723_reset( shared );
+
+     return 0;
+
+
+error_tdg:
+     free_irq( SH7723_BEU_IRQ, (void*) shared );
+
+error_beu:
+#ifndef SHARED_AREA_PHYS
+     for (i=0; i<1<<shared_order; i++)
+          ClearPageReserved( shared_page + i );
+
+     __free_pages( shared_page, shared_order );
+#endif
+
+     misc_deregister( &sh7723gfx_miscdev );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+void
+sh7723_exit( void )
+{
+#ifndef SHARED_AREA_PHYS
+     int i;
+#endif
+
+
+#ifdef SH7723GFX_IRQ_POLLER
+     stop_poller = 1;
+
+     while (stop_poller) {
+          set_current_state( TASK_UNINTERRUPTIBLE );
+          schedule_timeout( 1 );
+     }
+#else
+     free_irq( SH7723_TDG_IRQ, (void*) shared );
+#endif
+
+     free_irq( SH7723_BEU_IRQ, (void*) shared );
+
+     misc_deregister( &sh7723gfx_miscdev );
+
+
+#ifndef SHARED_AREA_PHYS
+     for (i=0; i<1<<shared_order; i++)
+          ClearPageReserved( shared_page + i );
+
+     __free_pages( shared_page, shared_order );
+#endif
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.h b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.h
new file mode 100755
index 0000000..dcaf481
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh7723.h
@@ -0,0 +1,21 @@
+/*
+ * SH7722/SH7723 Graphics Device
+ *
+ * Copyright (C) 2006-2008  IGEL Co.,Ltd
+ *
+ * Written by Denis Oliver Kropp <dok@directfb.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License v2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef __SH7723_H__
+#define __SH7723_H__
+
+int  sh7723_init( void );
+void sh7723_exit( void );
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_driver.c b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_driver.c
new file mode 100755
index 0000000..aba270b
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_driver.c
@@ -0,0 +1,82 @@
+/*
+ * SH7722/SH7723 Graphics Device
+ *
+ * Copyright (C) 2006-2008  IGEL Co.,Ltd
+ *
+ * Written by Denis Oliver Kropp <dok@directfb.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License v2
+ * as published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/version.h>
+
+#include <asm/io.h>
+#include <asm/processor.h>
+
+#include "sh7722.h"
+#include "sh7723.h"
+
+
+/**********************************************************************************************************************/
+
+static int sh772x_init = 0;
+
+/**********************************************************************************************************************/
+
+static int __init
+sh772x_driver_init( void )
+{
+     int ret = -ENODEV;
+
+     if ((ctrl_inl(CCN_PVR) & 0xffff00) == 0x300800) {
+          switch (ctrl_inl(CCN_PRR) & 0xf00) {
+               case 0xa00:
+                    ret = sh7722_init();
+                    if (ret)
+                         return ret;
+
+                    sh772x_init = 7722;
+                    break;
+
+               case 0x500:
+                    ret = sh7723_init();
+                    if (ret)
+                         return ret;
+
+                    sh772x_init = 7723;
+                    break;
+          }
+     }
+
+     return ret;
+}
+
+module_init( sh772x_driver_init );
+
+/**********************************************************************************************************************/
+
+static void __exit
+sh772x_driver_exit( void )
+{
+     switch (sh772x_init) {
+          case 7722:
+               sh7722_exit();
+               break;
+
+          case 7723:
+               sh7723_exit();
+               break;
+     }
+}
+
+module_exit( sh772x_driver_exit );
+
+/**********************************************************************************************************************/
+
+MODULE_AUTHOR( "Denis Oliver Kropp <dok@directfb.org> & Janine Kropp <nin@directfb.org>" );
+MODULE_LICENSE( "GPL v2" );
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_gfx.h b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_gfx.h
new file mode 100755
index 0000000..7c1abb5
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/kernel-module/sh772x_gfx.h
@@ -0,0 +1,105 @@
+#ifndef __SH772X_GFX_H__
+#define __SH772X_GFX_H__
+
+#include <asm/types.h>
+
+
+#define SH772xGFX_BUFFER_WORDS  0x1f000      /* Number of 32bit words in display list (ring buffer). */
+
+#define SH7722GFX_SHARED_MAGIC  0x77220001   /* Increase if binary compatibility is broken. */
+#define SH7723GFX_SHARED_MAGIC  0x77230001   /* Increase if binary compatibility is broken. */
+
+#define SH7722GFX_JPEG_RELOAD_SIZE       (64 * 1024)
+#define SH7722GFX_JPEG_LINEBUFFER_PITCH  (2560)
+#define SH7722GFX_JPEG_LINEBUFFER_HEIGHT (16)
+#define SH7722GFX_JPEG_LINEBUFFER_SIZE   (SH7722GFX_JPEG_LINEBUFFER_PITCH * SH7722GFX_JPEG_LINEBUFFER_HEIGHT * 2)
+#define SH7722GFX_JPEG_LINEBUFFER_SIZE_Y (SH7722GFX_JPEG_LINEBUFFER_PITCH * SH7722GFX_JPEG_LINEBUFFER_HEIGHT)
+#define SH7722GFX_JPEG_SIZE              (SH7722GFX_JPEG_LINEBUFFER_SIZE * 2 + SH7722GFX_JPEG_RELOAD_SIZE * 2)
+
+
+typedef volatile struct {
+     u32            buffer[SH772xGFX_BUFFER_WORDS];
+
+
+     int            hw_start;
+     int            hw_end;
+
+     int            hw_running;
+
+
+     int            next_start;
+     int            next_end;
+
+     int            next_valid;
+
+
+     unsigned long  buffer_phys;
+
+     unsigned int   num_words;
+     unsigned int   num_starts;
+     unsigned int   num_done;
+     unsigned int   num_interrupts;
+     unsigned int   num_wait_idle;
+     unsigned int   num_wait_next;
+     unsigned int   num_idle;
+
+     u32            jpeg_ints;
+     unsigned long  jpeg_phys;
+
+     u32            magic;
+} SH772xGfxSharedArea;
+
+
+typedef struct {
+     u32            address;  /* in */
+     u32            value;    /* in/out */
+} SH772xRegister;
+
+
+typedef enum {
+     SH7722_JPEG_START,
+     SH7722_JPEG_RUN,
+     SH7722_JPEG_END
+} SH7722JPEGState;
+
+typedef enum {
+     SH7722_JPEG_FLAG_RELOAD  = 0x00000001,  /* enable reload mode */
+     SH7722_JPEG_FLAG_CONVERT = 0x00000002,  /* enable conversion through VEU */
+     SH7722_JPEG_FLAG_ENCODE  = 0x00000004   /* set encoding mode */
+} SH7722JPEGFlags;
+
+typedef struct {
+     SH7722JPEGState state;   /* starting, running or ended (done/error) */
+     SH7722JPEGFlags flags;   /* control decoding options */
+
+     u32             buffers; /* input = loaded buffers, output = buffers to reload */
+     u32             error;   /* valid in END state, non-zero means error */
+
+     unsigned long   phys;    /* needed in case of scaling, prevents rounding errors */
+     int             height;
+     int             inputheight;
+} SH7722JPEG;
+
+
+/* Just initialization and synchronization.
+ * Hardware is started from user space via MMIO to DMA registers. */
+#define SH772xGFX_IOCTL_RESET      _IO( 'G', 0 )
+#define SH772xGFX_IOCTL_WAIT_IDLE  _IO( 'G', 1 )
+#define SH772xGFX_IOCTL_WAIT_NEXT  _IO( 'G', 2 )
+
+/* JPEG processing, requires programming from user space. */
+#define SH7722GFX_IOCTL_WAIT_JPEG   _IO  ( 'J', 0 )
+#define SH7722GFX_IOCTL_RUN_JPEG    _IOWR( 'J', 1, SH7722JPEG )
+#define SH7722GFX_IOCTL_LOCK_JPEG   _IO  ( 'J', 2 )
+#define SH7722GFX_IOCTL_UNLOCK_JPEG _IO  ( 'J', 3 )
+
+
+/* Register access limited to BEU, LCDC, VOU and JPU. */
+#define SH772xGFX_IOCTL_SETREG32   _IOW( 'g', 0, SH772xRegister )
+#define SH772xGFX_IOCTL_GETREG32   _IOR( 'g', 1, SH772xRegister )
+
+/* Generic IOCTL to power the display, do this after programming the LCD Controller */
+#define SH772xGFX_IOCTL_POWER_DISPLAY _IO( 'k', 0 )
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722.c
new file mode 100755
index 0000000..4d09928
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722.c
@@ -0,0 +1,490 @@
+#ifdef SH7722_DEBUG_DRIVER
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+#include <stdio.h>
+#include <jpeglib.h>
+
+#undef HAVE_STDLIB_H
+
+#include <config.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/system.h>
+
+#include <misc/conf.h>
+
+#include <core/core.h>
+#include <core/gfxcard.h>
+#include <core/layers.h>
+#include <core/screens.h>
+#include <core/system.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( sh7722 )
+
+
+#include "sh7722.h"
+#include "sh7722_blt.h"
+#include "sh7722_jpeglib.h"
+#include "sh7722_layer.h"
+#include "sh7722_lcd.h"
+#include "sh7722_multi.h"
+#include "sh7722_screen.h"
+
+#include "sh7723_blt.h"
+
+#ifdef SH772X_FBDEV_SUPPORT
+#include <linux/fb.h>
+#include <sys/mman.h>
+#endif
+
+
+D_DEBUG_DOMAIN( SH7722_Driver, "SH7722/Driver", "Renesas SH7722 Driver" );
+
+/**********************************************************************************************************************/
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     return dfb_gfxcard_get_accelerator( device ) == 0x2D47;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info )
+{
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+               "Renesas SH772x Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Denis & Janine Kropp" );
+
+     info->version.major = 0;
+     info->version.minor = 9;
+
+     info->driver_data_size = sizeof(SH7722DriverData);
+     info->device_data_size = sizeof(SH7722DeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     DFBResult         ret;
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = device_data;
+
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     /* Keep pointer to shared device data. */
+     sdrv->dev = device_data;
+
+     /* Keep core and device pointer. */
+     sdrv->core   = core;
+     sdrv->device = device;
+
+     /* Open the drawing engine device. */
+     sdrv->gfx_fd = direct_try_open( "/dev/sh772x_gfx", "/dev/misc/sh772x_gfx", O_RDWR, true );
+     if (sdrv->gfx_fd < 0)
+          return DFB_INIT;
+
+     /* Map its shared data. */
+     sdrv->gfx_shared = mmap( NULL, direct_page_align( sizeof(SH772xGfxSharedArea) ),
+                              PROT_READ | PROT_WRITE,
+                              MAP_SHARED, sdrv->gfx_fd, 0 );
+     if (sdrv->gfx_shared == MAP_FAILED) {
+          D_PERROR( "SH7722/Driver: Could not map shared area!\n" );
+          close( sdrv->gfx_fd );
+          return DFB_INIT;
+     }
+
+     sdrv->mmio_base = dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!sdrv->mmio_base) {
+          D_PERROR( "SH7722/Driver: Could not map MMIO area!\n" );
+          munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+          close( sdrv->gfx_fd );
+          return DFB_INIT;
+     }
+
+     /* Check the magic value. */
+     switch (sdrv->gfx_shared->magic) {
+          case SH7722GFX_SHARED_MAGIC:
+               sdev->sh772x = 7722;
+
+               /* Initialize function table. */
+               funcs->EngineReset       = sh7722EngineReset;
+               funcs->EngineSync        = sh7722EngineSync;
+               funcs->EmitCommands      = sh7722EmitCommands;
+               funcs->CheckState        = sh7722CheckState;
+               funcs->SetState          = sh7722SetState;
+               funcs->FillTriangle      = sh7722FillTriangle;
+               funcs->Blit              = sh7722Blit;
+               funcs->StretchBlit       = sh7722StretchBlit;
+               funcs->FlushTextureCache = sh7722FlushTextureCache;
+
+               /* Initialize JPEG library. */
+               ret = SH7722_JPEG_Initialize();
+               if (ret) {
+                    D_DERROR( ret, "SH7722/Driver: JPEG initialization failed!\n" );
+                    dfb_gfxcard_unmap_mmio( device, sdrv->mmio_base, -1 );
+                    munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+                    close( sdrv->gfx_fd );
+                    return DFB_INIT;
+               }
+               break;
+
+          case SH7723GFX_SHARED_MAGIC:
+               sdev->sh772x = 7723;
+
+               /* Initialize function table. */
+               funcs->EngineReset       = sh7723EngineReset;
+               funcs->EngineSync        = sh7723EngineSync;
+               funcs->EmitCommands      = sh7723EmitCommands;
+               funcs->CheckState        = sh7723CheckState;
+               funcs->SetState          = sh7723SetState;
+               funcs->FillRectangle     = sh7723FillRectangle;
+               funcs->FillTriangle      = sh7723FillTriangle;
+               funcs->DrawRectangle     = sh7723DrawRectangle;
+               funcs->DrawLine          = sh7723DrawLine;
+               funcs->Blit              = sh7723Blit;
+               break;
+
+          default:
+               D_ERROR( "SH772x/Driver: Magic value 0x%08x doesn't match 0x%08x or 0x%08x!\n",
+                        sdrv->gfx_shared->magic, SH7722GFX_SHARED_MAGIC, SH7723GFX_SHARED_MAGIC );
+               dfb_gfxcard_unmap_mmio( device, sdrv->mmio_base, -1 );
+               munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+               close( sdrv->gfx_fd );
+               return DFB_INIT;
+     }
+
+
+     /* Get virtual address for the LCD buffer in slaves here,
+        master does it in driver_init_device(). */
+#ifndef SH772X_FBDEV_SUPPORT
+     if (!dfb_core_is_master( core ))
+          sdrv->lcd_virt = dfb_gfxcard_memory_virtual( device, sdev->lcd_offset );
+#endif
+
+
+     /* Register primary screen. */
+     sdrv->screen = dfb_screens_register( device, driver_data, &sh7722ScreenFuncs );
+
+     /* Register three input system layers. */
+     sdrv->input1 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );
+     sdrv->input2 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );
+     sdrv->input3 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );
+
+     /* Register multi window layer. */
+     sdrv->multi = dfb_layers_register( sdrv->screen, driver_data, &sh7722MultiLayerFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = device_data;
+
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     /* FIXME: Add a runtime option / config file. */
+     sdev->lcd_format = DSPF_RGB16;
+
+     /* Check format of LCD buffer. */
+     switch (sdev->lcd_format) {
+          case DSPF_RGB16:
+          case DSPF_NV16:
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     if (sdev->sh772x == 7723)
+          memset( dfb_gfxcard_memory_virtual(device,0), 0, dfb_gfxcard_memory_length() );
+
+     /*
+      * Setup LCD buffer.
+      */
+#ifdef SH772X_FBDEV_SUPPORT
+     { 
+     	  struct fb_fix_screeninfo fsi;
+     	  struct fb_var_screeninfo vsi;
+		  int fbdev;
+
+		  if ((fbdev = open("/dev/fb", O_RDONLY)) < 0) {
+			   D_ERROR( "SH7722/Driver: Can't open fbdev to get LCDC info!\n" );
+			   return DFB_FAILURE;
+		  }
+
+		  if (ioctl(fbdev, FBIOGET_FSCREENINFO, &fsi) < 0) {
+			   D_ERROR( "SH7722/Driver: FBIOGET_FSCREEINFO failed.\n" );
+			   close(fbdev);
+			   return DFB_FAILURE;
+		  }
+
+		  if (ioctl(fbdev, FBIOGET_VSCREENINFO, &vsi) < 0) {
+			   D_ERROR( "SH7722/Driver: FBIOGET_VSCREEINFO failed.\n" );
+			   close(fbdev);
+			   return DFB_FAILURE;
+		  }
+
+		  sdev->lcd_width  = vsi.xres;
+		  sdev->lcd_height = vsi.yres;
+		  sdev->lcd_pitch  = fsi.line_length;
+		  sdev->lcd_size   = fsi.smem_len;
+		  sdev->lcd_offset = 0;
+		  sdev->lcd_phys   = fsi.smem_start;
+#if 0
+		  sdrv->lcd_virt   = mmap(NULL, fsi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED,
+				  				  fbdev, 0);
+		  if (sdrv->lcd_virt == MAP_FAILED) {
+			   D_PERROR( "SH7722/Driver: mapping fbdev failed.\n" );
+			   close(fbdev);
+			   return DFB_FAILURE;
+		  }
+
+          /* Clear LCD buffer. */
+          switch (sdev->lcd_format) {
+               case DSPF_RGB16:
+                    memset( (void*) sdrv->lcd_virt, 0x00, sdev->lcd_height * sdev->lcd_pitch );
+                    break;
+
+               case DSPF_NV16:
+                    memset( (void*) sdrv->lcd_virt, 0x10, sdev->lcd_height * sdev->lcd_pitch );
+                    memset( (void*) sdrv->lcd_virt + sdev->lcd_height * sdev->lcd_pitch, 0x80, sdev->lcd_height * sdev->lcd_pitch );
+                    break;
+
+               default:
+                    D_BUG( "unsupported format" );
+                    return DFB_BUG;
+          }
+#endif
+
+		  close(fbdev);
+     }     
+#else
+     sdev->lcd_width  = SH7722_LCD_WIDTH;
+     sdev->lcd_height = SH7722_LCD_HEIGHT;
+     sdev->lcd_pitch  = (DFB_BYTES_PER_LINE( sdev->lcd_format, sdev->lcd_width ) + 0xf) & ~0xf;
+     sdev->lcd_size   = DFB_PLANE_MULTIPLY( sdev->lcd_format, sdev->lcd_height ) * sdev->lcd_pitch;
+     sdev->lcd_offset = dfb_gfxcard_reserve_memory( device, sdev->lcd_size );
+
+     if (sdev->lcd_offset < 0) {
+          D_ERROR( "SH7722/Driver: Allocating %d bytes for the LCD buffer failed!\n", sdev->lcd_size );
+          return DFB_FAILURE;
+     }
+
+     sdev->lcd_phys = dfb_gfxcard_memory_physical( device, sdev->lcd_offset );
+
+     /* Get virtual addresses for LCD buffer in master here,
+        slaves do it in driver_init_driver(). */
+     sdrv->lcd_virt = dfb_gfxcard_memory_virtual( device, sdev->lcd_offset );
+#endif
+
+     D_INFO( "SH7722/LCD: Allocated %dx%d %s Buffer (%d bytes) at 0x%08lx (%p)\n",
+             sdev->lcd_width, sdev->lcd_height, dfb_pixelformat_name(sdev->lcd_format),
+             sdev->lcd_size, sdev->lcd_phys, sdrv->lcd_virt );
+
+     D_ASSERT( ! (sdev->lcd_pitch & 0xf) );
+     D_ASSERT( ! (sdev->lcd_phys & 0xf) );
+
+     /*
+      * Initialize hardware.
+      */
+
+     switch (sdev->sh772x) {
+          case 7722:
+               /* Reset the drawing engine. */
+               sh7722EngineReset( sdrv, sdev );
+
+               /* Fill in the device info. */
+               snprintf( device_info->name,   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,   "SH7722" );
+               snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Renesas" );
+
+               /* Set device limitations. */
+               device_info->limits.surface_byteoffset_alignment = 16;
+               device_info->limits.surface_bytepitch_alignment  = 8;
+
+               /* Set device capabilities. */
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS;
+               device_info->caps.accel    = SH7722_SUPPORTED_DRAWINGFUNCTIONS |
+                                            SH7722_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = SH7722_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = SH7722_SUPPORTED_BLITTINGFLAGS;
+
+               /* Change font format for acceleration. */
+               if (!dfb_config->software_only) {
+                    dfb_config->font_format  = DSPF_ARGB;
+                    dfb_config->font_premult = false;
+               }
+               break;
+
+          case 7723:
+               /* Reset the drawing engine. */
+               sh7723EngineReset( sdrv, sdev );
+
+               /* Fill in the device info. */
+               snprintf( device_info->name,   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,   "SH7723" );
+               snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Renesas" );
+
+               /* Set device limitations. */
+               device_info->limits.surface_byteoffset_alignment = 512;
+               device_info->limits.surface_bytepitch_alignment  = 64;
+
+               /* Set device capabilities. */
+               device_info->caps.flags    = CCF_CLIPPING | CCF_RENDEROPTS;
+               device_info->caps.accel    = SH7723_SUPPORTED_DRAWINGFUNCTIONS | \
+                                            SH7723_SUPPORTED_BLITTINGFUNCTIONS;
+               device_info->caps.drawing  = SH7723_SUPPORTED_DRAWINGFLAGS;
+               device_info->caps.blitting = SH7723_SUPPORTED_BLITTINGFLAGS;
+
+               break;
+
+          default:
+               D_BUG( "unexpected device" );
+               return DFB_BUG;
+     }
+
+
+     /* Wait for idle BEU. */
+     while (SH7722_GETREG32( sdrv, BSTAR ) & 1);
+
+     /* Disable all inputs. */
+     SH7722_SETREG32( sdrv, BESTR, 0 );
+
+     /* Disable all multi windows. */
+     SH7722_SETREG32( sdrv, BMWCR0, SH7722_GETREG32( sdrv, BMWCR0 ) & ~0xf );
+
+#ifndef SH772X_FBDEV_SUPPORT
+     /* Clear LCD buffer. */
+     switch (sdev->lcd_format) {
+          case DSPF_RGB16:
+               memset( (void*) sdrv->lcd_virt, 0x00, sdev->lcd_height * sdev->lcd_pitch );
+               break;
+
+          case DSPF_NV16:
+               memset( (void*) sdrv->lcd_virt, 0x10, sdev->lcd_height * sdev->lcd_pitch );
+               memset( (void*) sdrv->lcd_virt + sdev->lcd_height * sdev->lcd_pitch, 0x80, sdev->lcd_height * sdev->lcd_pitch );
+               break;
+
+          default:
+               D_BUG( "unsupported format" );
+               return DFB_BUG;
+     }
+#endif
+
+     /*
+      * TODO: Make LCD Buffer format and primary BEU format runtime configurable.
+      */
+
+     /* Set output pixel format of the BEU. */
+     switch (sdev->lcd_format) {
+          case DSPF_RGB16:
+               SH7722_SETREG32( sdrv, BPKFR, BPKFR_RY_RGB | WPCK_RGB16 );
+               break;
+
+          case DSPF_NV16:
+               SH7722_SETREG32( sdrv, BPKFR, BPKFR_RY_RGB | BPKFR_TE_ENABLED | CHDS_YCBCR422 );
+               SH7722_SETREG32( sdrv, BDACR, sdev->lcd_phys + sdev->lcd_height * sdev->lcd_pitch );
+               break;
+
+          default:
+               D_BUG( "unsupported format" );
+               return DFB_BUG;
+     }
+
+     SH7722_SETREG32( sdrv, BPROCR, 0x00000000 );
+
+     /* Have BEU render into LCD buffer. */
+     SH7722_SETREG32( sdrv, BBLCR1, MT_MEMORY );
+     SH7722_SETREG32( sdrv, BDAYR, sdev->lcd_phys & 0xfffffffc );
+     SH7722_SETREG32( sdrv, BDMWR, sdev->lcd_pitch & 0x0003fffc );
+
+#ifndef SH772X_FBDEV_SUPPORT
+     /* Setup LCD controller to show the buffer. */
+     sh7722_lcd_setup( sdrv, sdev->lcd_width, sdev->lcd_height,
+                       sdev->lcd_phys, sdev->lcd_pitch, sdev->lcd_format, false );
+#endif
+
+     /* Initialize BEU lock. */
+     fusion_skirmish_init( &sdev->beu_lock, "BEU", dfb_core_world(sdrv->core) );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     SH7722DeviceData *sdev = device_data;
+
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     /* Destroy BEU lock. */
+     fusion_skirmish_destroy( &sdev->beu_lock );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     SH7722DriverData    *sdrv   = driver_data;
+     SH772xGfxSharedArea *shared = sdrv->gfx_shared;
+
+     (void) shared;
+
+     D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );
+
+     D_INFO( "SH7722/BLT: %u starts, %u done, %u interrupts, %u wait_idle, %u wait_next, %u idle\n",
+             shared->num_starts, shared->num_done, shared->num_interrupts,
+             shared->num_wait_idle, shared->num_wait_next, shared->num_idle );
+
+     D_INFO( "SH7722/BLT: %u words, %u words/start, %u words/idle, %u starts/idle\n",
+             shared->num_words,
+             shared->num_words  / shared->num_starts,
+             shared->num_words  / shared->num_idle,
+             shared->num_starts / shared->num_idle );
+
+     /* Shutdown JPEG library. */
+     SH7722_JPEG_Shutdown();
+
+     /* Unmap shared area. */
+     munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+
+     /* Close Drawing Engine device. */
+     close( sdrv->gfx_fd );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722.h
new file mode 100755
index 0000000..0a80512
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722.h
@@ -0,0 +1,131 @@
+#ifndef __SH7722__SH7722_H__
+#define __SH7722__SH7722_H__
+
+#include <sys/ioctl.h>
+
+#include <sh772x_gfx.h>
+
+#include "sh7722_regs.h"
+#include "sh7722_types.h"
+
+
+#define SH772X_FBDEV_SUPPORT
+// #define JPU_SUPPORT
+
+/******************************************************************************
+ * Platform specific values (FIXME: add runtime config)
+ */
+
+#define ALGO_AP325
+#undef  SH7722_ALGO_PANEL
+
+/* LCD Panel Configuration */
+#if defined(SH7722_ALGO_PANEL)
+#  define	SH7722_LCD_WIDTH	640
+#  define	SH7722_LCD_HEIGHT	480
+#elif defined(ALGO_AP325)
+#  define	SH7722_LCD_WIDTH	800
+#  define	SH7722_LCD_HEIGHT	480
+#else
+#  define	SH7722_LCD_WIDTH	800
+#  define	SH7722_LCD_HEIGHT	480
+#endif
+
+
+/******************************************************************************
+ * Register access
+ */
+
+//#define SH7722_TDG_REG_USE_IOCTLS
+
+#ifdef SH7722_TDG_REG_USE_IOCTLS
+static inline u32
+SH7722_TDG_GETREG32( SH7722DriverData *sdrv,
+                     u32               address )
+{
+     SH772xRegister reg = { address, 0 };
+
+     if (ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_GETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_GETREG32( 0x%08x )\n", reg.address );
+
+     return reg.value;
+}
+
+static inline void
+SH7722_TDG_SETREG32( SH7722DriverData *sdrv,
+                     u32               address,
+                     u32               value )
+{
+     SH772xRegister reg = { address, value };
+
+     if (ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_SETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_SETREG32( 0x%08x, 0x%08x )\n", reg.address, reg.value );
+}
+#else
+static inline u32
+SH7722_TDG_GETREG32( SH7722DriverData *sdrv,
+                     u32               address )
+{
+     D_ASSERT( address >= dfb_config->mmio_phys );
+     D_ASSERT( address < (dfb_config->mmio_phys + dfb_config->mmio_length) );
+
+     return *(volatile u32*)(sdrv->mmio_base + (address - dfb_config->mmio_phys));
+}
+
+static inline void
+SH7722_TDG_SETREG32( SH7722DriverData *sdrv,
+                     u32               address,
+                     u32               value )
+{
+     D_ASSERT( address >= dfb_config->mmio_phys );
+     D_ASSERT( address < (dfb_config->mmio_phys + dfb_config->mmio_length) );
+
+     *(volatile u32*)(sdrv->mmio_base + (address - dfb_config->mmio_phys)) = value;
+}
+#endif
+
+
+static inline u32
+SH7722_GETREG32( SH7722DriverData *sdrv,
+                 u32               address )
+{
+     SH772xRegister reg = { address, 0 };
+
+     if (ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_GETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_GETREG32( 0x%08x )\n", reg.address );
+
+     return reg.value;
+}
+
+static inline void
+SH7722_SETREG32( SH7722DriverData *sdrv,
+                 u32               address,
+                 u32               value )
+{
+     SH772xRegister reg = { address, value };
+
+     if (ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_SETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_SETREG32( 0x%08x, 0x%08x )\n", reg.address, reg.value );
+}
+
+
+static inline void
+BEU_Start( SH7722DriverData *sdrv,
+           SH7722DeviceData *sdev )
+{
+     /* Wait for idle BEU. */
+     while (SH7722_GETREG32( sdrv, BSTAR ) & 1);
+
+     /* Start operation! */
+     SH7722_SETREG32( sdrv, BESTR, (sdev->input_mask << 8) | 1 );
+}
+
+static inline void
+BEU_Wait( SH7722DriverData *sdrv,
+          SH7722DeviceData *sdev )
+{
+     /* Wait for idle BEU. */
+     while (SH7722_GETREG32( sdrv, BSTAR ) & 1);
+}
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.c
new file mode 100755
index 0000000..ec373f8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.c
@@ -0,0 +1,2013 @@
+#ifdef SH7722_DEBUG_BLT
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <malloc.h>
+#include <errno.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include "sh7722.h"
+#include "sh7722_blt.h"
+
+
+D_DEBUG_DOMAIN( SH7722_BLT, "SH7722/BLT", "Renesas SH7722 Drawing Engine" );
+
+D_DEBUG_DOMAIN( SH7722_StartStop, "SH7722/StartStop", "Renesas SH7722 Drawing Start/Stop" );
+
+/*
+ * State validation flags.
+ *
+ * There's no prefix because of the macros below.
+ */
+enum {
+     DEST         = 0x00000001,
+     CLIP         = 0x00000002,
+     DEST_CLIP    = 0x00000003,
+
+     SOURCE       = 0x00000010,
+     MASK         = 0x00000020,
+
+     COLOR        = 0x00000100,
+
+     COLOR_KEY    = 0x00001000,
+     COLOR_CHANGE = 0x00002000,
+
+     BLENDING     = 0x00010000,
+
+     MATRIX       = 0x00100000,
+
+     BLIT_OP      = 0x01000000,
+
+     ALL          = 0x01113133
+};
+
+/*
+ * Map pixel formats.
+ */
+static int pixel_formats[DFB_NUM_PIXELFORMATS];
+
+__attribute__((constructor)) static void initialization( void )
+{
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)   ] =  0;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)    ] =  0;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)   ] =  1;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB555)  ] =  2;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_ARGB1555)] =  3;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)] =  4;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB444)  ] =  4;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB18)   ] =  6;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_ARGB1666)] =  6;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_ARGB6666)] =  6;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_RGB24)   ] =  7;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_A1)      ] =  8;
+     pixel_formats[DFB_PIXELFORMAT_INDEX(DSPF_A8)      ] = 10;
+}
+
+/*
+ * State handling macros.
+ */
+
+#define SH7722_VALIDATE(flags)          do { sdev->v_flags |=  (flags); } while (0)
+#define SH7722_INVALIDATE(flags)        do { sdev->v_flags &= ~(flags); } while (0)
+
+#define SH7722_CHECK_VALIDATE(flag)     do {                                                        \
+                                             if ((sdev->v_flags & flag) != flag)                    \
+                                                  sh7722_validate_##flag( sdrv, sdev, state );      \
+                                        } while (0)
+
+#define DUMP_INFO() D_DEBUG_AT( SH7722_BLT, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                            sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                            sdrv->gfx_shared->hw_start,                             \
+                                            sdrv->gfx_shared->hw_end,                               \
+                                            sdrv->gfx_shared->next_start,                           \
+                                            sdrv->gfx_shared->next_end,                             \
+                                            sdrv->gfx_shared->next_valid ? "" : "not " );
+
+#define AA_COEF     133
+
+/**********************************************************************************************************************/
+
+static bool sh7722FillRectangle        ( void *drv, void *dev, DFBRectangle *rect );
+static bool sh7722FillRectangleMatrixAA( void *drv, void *dev, DFBRectangle *rect );
+
+static bool sh7722DrawRectangle        ( void *drv, void *dev, DFBRectangle *rect );
+static bool sh7722DrawRectangleMatrixAA( void *drv, void *dev, DFBRectangle *rect );
+
+static bool sh7722DrawLine           ( void *drv, void *dev, DFBRegion *line );
+static bool sh7722DrawLineMatrix     ( void *drv, void *dev, DFBRegion *line );
+static bool sh7722DrawLineAA         ( void *drv, void *dev, DFBRegion *line );
+
+/**********************************************************************************************************************/
+
+static inline bool
+check_blend_functions( const CardState *state )
+{
+     switch (state->src_blend) {
+          case DSBF_ZERO:
+          case DSBF_ONE:
+          case DSBF_DESTCOLOR:
+          case DSBF_INVDESTCOLOR:
+          case DSBF_SRCALPHA:
+          case DSBF_INVSRCALPHA:
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+               return true;
+
+          default:
+               break;
+     }
+     switch (state->dst_blend) {
+          case DSBF_ZERO:
+          case DSBF_ONE:
+          case DSBF_SRCCOLOR:
+          case DSBF_INVSRCCOLOR:
+          case DSBF_SRCALPHA:
+          case DSBF_INVSRCALPHA:
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+/**********************************************************************************************************************/
+
+static inline bool
+start_hardware( SH7722DriverData *sdrv )
+{
+     SH772xGfxSharedArea *shared = sdrv->gfx_shared;
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     if (shared->hw_running || !shared->next_valid || shared->next_end == shared->next_start)
+          return false;
+
+     shared->hw_running = true;
+     shared->hw_start   = shared->next_start;
+     shared->hw_end     = shared->next_end;
+
+     shared->next_start = shared->next_end = (shared->hw_end + 1 + 3) & ~3;
+     shared->next_valid = false;
+
+     shared->num_words += shared->hw_end - shared->hw_start;
+
+     shared->num_starts++;
+
+     DUMP_INFO();
+
+     D_ASSERT( shared->buffer[shared->hw_end] == 0xF0000000 );
+
+     SH7722_TDG_SETREG32( sdrv, BEM_HC_DMA_ADR,   shared->buffer_phys + shared->hw_start*4 );
+     SH7722_TDG_SETREG32( sdrv, BEM_HC_DMA_START, 1 );
+
+     return true;
+}
+
+__attribute__((noinline))
+static void
+flush_prepared( SH7722DriverData *sdrv )
+{
+     SH772xGfxSharedArea *shared  = sdrv->gfx_shared;
+     unsigned int         timeout = 2;
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     D_ASSERT( sdrv->prep_num < SH772xGFX_BUFFER_WORDS );
+     D_ASSERT( sdrv->prep_num <= D_ARRAY_SIZE(sdrv->prep_buf) );
+
+     /* Something prepared? */
+     while (sdrv->prep_num) {
+          int next_end;
+
+          /* Mark shared information as invalid. From this point on the interrupt handler
+           * will not continue with the next block, and we'll start the hardware ourself. */
+          shared->next_valid = false;
+
+          /* Check if there's enough space at the end.
+           * Wait until hardware has started next block before it gets too big. */
+          if (shared->next_end + sdrv->prep_num >= SH772xGFX_BUFFER_WORDS ||
+              shared->next_end - shared->next_start >= SH772xGFX_BUFFER_WORDS/4)
+          {
+               /* If there's no next block waiting, start at the beginning. */
+               if (shared->next_start == shared->next_end)
+                    shared->next_start = shared->next_end = 0;
+               else {
+                    D_ASSERT( shared->buffer[shared->hw_end] == 0xF0000000 );
+
+                    /* Mark area as valid again. */
+                    shared->next_valid = true;
+
+                    /* Start in case it got idle while doing the checks. */
+                    if (!start_hardware( sdrv )) {
+                         /*
+                          * Hardware has not been started (still running).
+                          * Check for timeout. */
+                         if (!timeout--) {
+                              D_ERROR( "SH7722/Blt: Timeout waiting for processing!\n" );
+                              direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                                 sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                                 sdrv->gfx_shared->hw_start,                             \
+                                                 sdrv->gfx_shared->hw_end,                               \
+                                                 sdrv->gfx_shared->next_start,                           \
+                                                 sdrv->gfx_shared->next_end,                             \
+                                                 sdrv->gfx_shared->next_valid ? "" : "not " );
+                              D_ASSERT( shared->buffer[shared->hw_end] == 0xF0000000 );
+                              sh7722EngineReset( sdrv, sdrv->dev );
+                         }
+
+                         /* Wait til next block is started. */
+                         ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_NEXT );
+                    }
+
+                    /* Start over with the checks. */
+                    continue;
+               }
+          }
+
+          /* We are appending in case there was already a next block. */
+          next_end = shared->next_end + sdrv->prep_num;
+
+          /* Reset the timeout counter. */
+          timeout = 2;
+
+          /* While the hardware is running... */
+          while (shared->hw_running) {
+               D_ASSERT( shared->buffer[shared->hw_end] == 0xF0000000 );
+
+               /* ...make sure we don't over lap with its current buffer, otherwise wait. */
+               if (shared->hw_start > next_end || shared->hw_end < shared->next_start)
+                    break;
+
+               /* Check for timeout. */
+               if (!timeout--) {
+                    D_ERROR( "SH7722/Blt: Timeout waiting for space!\n" );
+                    direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                       sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                       sdrv->gfx_shared->hw_start,                             \
+                                       sdrv->gfx_shared->hw_end,                               \
+                                       sdrv->gfx_shared->next_start,                           \
+                                       sdrv->gfx_shared->next_end,                             \
+                                       sdrv->gfx_shared->next_valid ? "" : "not " );
+                    D_ASSERT( shared->buffer[shared->hw_end] == 0xF0000000 );
+                    sh7722EngineReset( sdrv, sdrv->dev );
+               }
+
+               /* Wait til next block is started. */
+               ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_NEXT );
+          }
+
+          /* Copy from local to shared buffer. */
+          direct_memcpy( (void*) &shared->buffer[shared->next_end], &sdrv->prep_buf[0], sdrv->prep_num * sizeof(__u32) );
+
+          /* Terminate the block. */
+          shared->buffer[next_end] = 0xF0000000;
+
+          /* Update next block information and mark valid. */
+          shared->next_end   = next_end;
+          shared->next_valid = true;
+
+          /* Reset local counter. */
+          sdrv->prep_num = 0;
+     }
+
+     /* Start in case it is idle. */
+     start_hardware( sdrv );
+}
+
+static inline __u32 *
+start_buffer( SH7722DriverData *sdrv,
+              int               space )
+{
+     /* Check for space in local buffer. */
+     if (sdrv->prep_num + space > SH7722GFX_MAX_PREPARE) {
+          /* Flush local buffer. */
+          flush_prepared( sdrv );
+
+          D_ASSERT( sdrv->prep_num == 0 );
+     }
+
+     /* Return next write position. */
+     return &sdrv->prep_buf[sdrv->prep_num];
+}
+
+static inline void
+submit_buffer( SH7722DriverData *sdrv,
+               int               entries )
+{
+     D_ASSERT( sdrv->prep_num + entries <= SH7722GFX_MAX_PREPARE );
+
+     /* Increment next write position. */
+     sdrv->prep_num += entries;
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+sh7722_validate_DEST_CLIP( SH7722DriverData *sdrv,
+                           SH7722DeviceData *sdev,
+                           CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 10 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( 0x%08lx [%d] - %4d,%4d-%4dx%4d )\n", __FUNCTION__,
+                 state->dst.phys, state->dst.pitch, DFB_RECTANGLE_VALS_FROM_REGION( &state->clip ) );
+
+     /* Set clip. */
+     prep[0] = BEM_PE_SC0_MIN;
+     prep[1] = SH7722_XY( state->clip.x1, state->clip.y1 );
+
+     prep[2] = BEM_PE_SC0_MAX;
+     prep[3] = SH7722_XY( state->clip.x2, state->clip.y2 );
+
+     /* Only clip? */
+     if (sdev->v_flags & DEST) {
+          submit_buffer( sdrv, 4 );
+     }
+     else {
+          CoreSurface       *surface = state->destination;
+          CoreSurfaceBuffer *buffer  = state->dst.buffer;
+
+          sdev->dst_phys  = state->dst.phys;
+          sdev->dst_pitch = state->dst.pitch;
+          sdev->dst_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
+          sdev->dst_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
+
+          /* Set destination. */
+          prep[4] = BEM_PE_DST;
+          prep[5] = pixel_formats[sdev->dst_index];
+
+          prep[6] = BEM_PE_DST_BASE;
+          prep[7] = sdev->dst_phys;
+
+          prep[8] = BEM_PE_DST_SIZE;
+          prep[9] = SH7722_XY( sdev->dst_pitch / sdev->dst_bpp, surface->config.size.h );
+
+          submit_buffer( sdrv, 10 );
+     }
+
+     /* Set the flags. */
+     SH7722_VALIDATE( DEST_CLIP );
+}
+
+static inline void
+sh7722_validate_SOURCE( SH7722DriverData *sdrv,
+                        SH7722DeviceData *sdev,
+                        CardState        *state )
+{
+     CoreSurface       *surface = state->source;
+     CoreSurfaceBuffer *buffer  = state->src.buffer;
+     __u32             *prep    = start_buffer( sdrv, 6 );
+
+     sdev->src_phys  = state->src.phys;
+     sdev->src_pitch = state->src.pitch;
+     sdev->src_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
+     sdev->src_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
+
+     /* Set source. */
+     prep[0] = BEM_TE_SRC;
+     prep[1] = pixel_formats[sdev->src_index];
+
+     prep[2] = BEM_TE_SRC_BASE;
+     prep[3] = sdev->src_phys;
+
+     prep[4] = BEM_TE_SRC_SIZE;
+     prep[5] = SH7722_XY( sdev->src_pitch / sdev->src_bpp, surface->config.size.h );
+
+     submit_buffer( sdrv, 6 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( SOURCE );
+}
+
+__attribute__((noinline))
+static void
+sh7722_validate_MASK( SH7722DriverData *sdrv,
+                      SH7722DeviceData *sdev,
+                      CardState        *state )
+{
+     CoreSurface       *surface = state->source_mask;
+     CoreSurfaceBuffer *buffer  = state->src_mask.buffer;
+     __u32             *prep    = start_buffer( sdrv, 6 );
+
+     sdev->mask_phys   = state->src_mask.phys;
+     sdev->mask_pitch  = state->src_mask.pitch;
+     sdev->mask_format = buffer->format;
+     sdev->mask_index  = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
+     sdev->mask_offset = state->src_mask_offset;
+     sdev->mask_flags  = state->src_mask_flags;
+
+     /* Set mask. */
+     prep[0] = BEM_TE_MASK;
+     prep[1] = TE_MASK_ENABLE | pixel_formats[sdev->mask_index];
+
+     prep[2] = BEM_TE_MASK_SIZE;
+     prep[3] = SH7722_XY( sdev->mask_pitch / DFB_BYTES_PER_PIXEL(sdev->mask_format), surface->config.size.h );
+
+     prep[4] = BEM_TE_MASK_BASE;
+     prep[5] = sdev->mask_phys  +  sdev->mask_pitch * sdev->mask_offset.y +
+               DFB_BYTES_PER_LINE( sdev->mask_format, sdev->mask_offset.x );
+     
+     submit_buffer( sdrv, 6 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( MASK );
+}
+
+static inline void
+sh7722_validate_COLOR( SH7722DriverData *sdrv,
+                       SH7722DeviceData *sdev,
+                       CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 4 );
+
+     prep[0] = BEM_BE_COLOR1;
+     prep[1] = PIXEL_ARGB( state->color.a,
+                           state->color.r,
+                           state->color.g,
+                           state->color.b );
+
+     prep[2] = BEM_WR_FGC;
+     prep[3] = prep[1];
+
+     submit_buffer( sdrv, 4 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( COLOR );
+}
+
+__attribute__((noinline))
+static void
+sh7722_validate_COLOR_KEY( SH7722DriverData *sdrv,
+                           SH7722DeviceData *sdev,
+                           CardState        *state )
+{
+     CoreSurfaceBuffer *buffer = state->src.buffer;
+     __u32             *prep   = start_buffer( sdrv, 4 );
+
+     prep[0] = BEM_PE_CKEY;
+     prep[1] = CKEY_EXCLUDE_ALPHA | CKEY_EXCLUDE_UNUSED | CKEY_B_ENABLE;
+
+     prep[2] = BEM_PE_CKEY_B;
+
+     switch (buffer->format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+               prep[3] = state->src_colorkey;
+               break;
+
+          case DSPF_RGB16:
+               prep[3] = RGB16_TO_RGB32( state->src_colorkey );
+               break;
+
+          case DSPF_ARGB1555:
+          case DSPF_RGB555:
+               prep[3] = ARGB1555_TO_RGB32( state->src_colorkey );
+               break;
+
+          case DSPF_ARGB4444:
+          case DSPF_RGB444:
+               prep[3] = ARGB4444_TO_RGB32( state->src_colorkey );
+               break;
+
+          default:
+               D_BUG( "unexpected pixelformat" );
+     }
+
+     submit_buffer( sdrv, 4 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( COLOR_KEY );
+}
+
+/* let compiler decide here :) */
+static void
+sh7722_validate_COLOR_CHANGE( SH7722DriverData *sdrv,
+                              SH7722DeviceData *sdev,
+                              CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 6 );
+
+     prep[0] = BEM_PE_COLORCHANGE;
+     prep[1] = COLORCHANGE_COMPARE_FIRST | COLORCHANGE_EXCLUDE_UNUSED;
+
+     prep[2] = BEM_PE_COLORCHANGE_0;
+     prep[3] = 0xffffff;
+
+     prep[4] = BEM_PE_COLORCHANGE_1;
+     prep[5] = PIXEL_ARGB( state->color.a,
+                           state->color.r,
+                           state->color.g,
+                           state->color.b );
+
+     submit_buffer( sdrv, 6 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( COLOR_CHANGE );
+}
+
+/*                            DSBF_UNKNOWN      = 0    */
+/*   BLE_DSTF_ZERO    = 0     DSBF_ZERO         = 1    */
+/*   BLE_DSTF_ONE     = 1     DSBF_ONE          = 2    */
+/*   BLE_DSTF_SRC     = 2     DSBF_SRCCOLOR     = 3    */
+/*   BLE_DSTF_1_SRC   = 3     DSBF_INVSRCCOLOR  = 4    */
+/*   BLE_DSTF_SRC_A   = 4     DSBF_SRCALPHA     = 5    */
+/*   BLE_DSTF_1_SRC_A = 5     DSBF_INVSRCALPHA  = 6    */
+/*   BLE_DSTF_DST_A   = 6     DSBF_DESTALPHA    = 7    */
+/*   BLE_DSTF_1_DST_A = 7     DSBF_INVDESTALPHA = 8    */
+/*                            DSBF_DESTCOLOR    = 9    */
+/*   Hey, matches!!? :-P      DSBF_INVDESTCOLOR = 10   */
+/*                            DSBF_SRCALPHASAT  = 11   */
+
+static inline void
+sh7722_validate_BLENDING( SH7722DriverData *sdrv,
+                          SH7722DeviceData *sdev,
+                          CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 2 );
+
+     sdev->ble_dstf =  (state->dst_blend - 1) & 7;
+     sdev->ble_srcf = ((state->src_blend - 1) & 7) << 4;
+
+     prep[0] = BEM_PE_FIXEDALPHA;
+     prep[1] = (state->color.a << 24) | (state->color.a << 16);
+
+     submit_buffer( sdrv, 2 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( BLENDING );
+}
+
+__attribute__((noinline))
+static void
+sh7722_validate_MATRIX( SH7722DriverData *sdrv,
+                        SH7722DeviceData *sdev,
+                        CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 12 );
+
+     prep[0]  = BEM_BE_MATRIX_A;
+     prep[1]  = state->matrix[0];
+              
+     prep[2]  = BEM_BE_MATRIX_B;
+     prep[3]  = state->matrix[1];
+              
+     prep[4]  = BEM_BE_MATRIX_C;
+     prep[5]  = state->matrix[2];
+              
+     prep[6]  = BEM_BE_MATRIX_D;
+     prep[7]  = state->matrix[3];
+              
+     prep[8]  = BEM_BE_MATRIX_E;
+     prep[9]  = state->matrix[4];
+
+     prep[10] = BEM_BE_MATRIX_F;
+     prep[11] = state->matrix[5];
+
+     submit_buffer( sdrv, 12 );
+
+     /* Keep for CPU transformation of lines. */
+     direct_memcpy( sdev->matrix, state->matrix, sizeof(s32) * 6 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( MATRIX );
+}
+
+static inline void
+sh7722_validate_BLIT_OP( SH7722DriverData *sdrv,
+                         SH7722DeviceData *sdev,
+                         CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 2 );
+
+     prep[0] = BEM_PE_OPERATION;
+     prep[1] = BLE_FUNC_NONE;
+
+     if (state->blittingflags & DSBLIT_XOR)
+          prep[1] |= BLE_ROP_XOR;
+
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+          prep[1] |= BLE_FUNC_AxB_plus_CxD | sdev->ble_srcf | sdev->ble_dstf;
+
+          switch (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               case DSBLIT_BLEND_ALPHACHANNEL:
+                    prep[1] |= BLE_SRCA_SOURCE_ALPHA;
+                    break;
+
+               case DSBLIT_BLEND_COLORALPHA:
+                    prep[1] |= BLE_SRCA_FIXED;
+                    break;
+          }
+     }
+     else if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA)
+          prep[1] |= BLE_FUNC_AxB_plus_CxD | BLE_SRCA_ALPHA_CHANNEL | BLE_SRCF_SRC_A | BLE_DSTF_1_SRC_A;
+
+     submit_buffer( sdrv, 2 );
+
+     /* Set the flag. */
+     SH7722_VALIDATE( BLIT_OP );
+}
+
+/**********************************************************************************************************************/
+
+__attribute__((noinline))
+static void
+invalidate_ckey( SH7722DriverData *sdrv, SH7722DeviceData *sdev )
+{
+     __u32 *prep = start_buffer( sdrv, 4 );
+
+     prep[0] = BEM_PE_CKEY;
+     prep[1] = 0;
+
+     prep[2] = BEM_PE_CKEY_B;
+     prep[3] = 0;
+
+     submit_buffer( sdrv, 4 );
+
+     sdev->ckey_b_enabled = false;
+
+     SH7722_INVALIDATE( COLOR_KEY );
+}
+
+__attribute__((noinline))
+static void
+invalidate_color_change( SH7722DriverData *sdrv, SH7722DeviceData *sdev )
+{
+     __u32 *prep = start_buffer( sdrv, 2 );
+
+     prep[0] = BEM_PE_COLORCHANGE;
+     prep[1] = COLORCHANGE_DISABLE;
+
+     submit_buffer( sdrv, 2 );
+
+     sdev->color_change_enabled = false;
+
+     SH7722_INVALIDATE( COLOR_CHANGE );
+}
+
+__attribute__((noinline))
+static void
+invalidate_mask( SH7722DriverData *sdrv, SH7722DeviceData *sdev )
+{
+     u32 *prep = start_buffer( sdrv, 2 );
+
+     prep[0] = BEM_TE_MASK;
+     prep[1] = TE_MASK_DISABLE;
+
+     submit_buffer( sdrv, 2 );
+
+     sdev->mask_enabled = false;
+
+     SH7722_INVALIDATE( MASK );
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+sh7722EngineSync( void *drv, void *dev )
+{
+     DFBResult            ret    = DFB_OK;
+     SH7722DriverData    *sdrv   = drv;
+     SH772xGfxSharedArea *shared = sdrv->gfx_shared;
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     while (shared->hw_running && ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_IDLE ) < 0) {
+          if (errno == EINTR)
+               continue;
+
+          ret = errno2result( errno );
+          D_PERROR( "SH7722/BLT: SH7722GFX_IOCTL_WAIT_IDLE failed!\n" );
+
+          direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                             sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                             sdrv->gfx_shared->hw_start,                             \
+                             sdrv->gfx_shared->hw_end,                               \
+                             sdrv->gfx_shared->next_start,                           \
+                             sdrv->gfx_shared->next_end,                             \
+                             sdrv->gfx_shared->next_valid ? "" : "not " );
+
+          break;
+     }
+
+     if (ret == DFB_OK) {
+          D_ASSERT( !shared->hw_running );
+          D_ASSERT( !shared->next_valid );
+     }
+
+     return ret;
+}
+
+void
+sh7722EngineReset( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep;
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_RESET );
+
+     prep = start_buffer( sdrv, 20 );
+
+     prep[0] = BEM_PE_OPERATION;
+     prep[1] = 0x00000000;
+
+     prep[2] = BEM_PE_COLORCHANGE;
+     prep[3] = 0x00000000;
+
+     prep[4] = BEM_PE_CKEY;
+     prep[5] = 0x00000000;
+
+     prep[6] = BEM_PE_CKEY_B;
+     prep[7] = 0;
+
+     prep[8] = BEM_PE_FIXEDALPHA;
+     prep[9] = 0x80000000;
+
+     prep[10] = BEM_TE_SRC_CNV;
+     prep[11] = 0x00100010;   /* full conversion of Ad, As, Cd and Cs */
+
+     prep[12] = BEM_TE_FILTER;
+     prep[13] = 0x00000000;   /* 0 = nearest, 3 = up bilinear / down average */
+
+     prep[14] = BEM_PE_SC;
+     prep[15] = 0x00000001;   /* enable clipping */
+
+     prep[16] = BEM_BE_ORIGIN;
+     prep[17] = SH7722_XY( 0, 0 );
+
+     prep[18] = BEM_TE_MASK_CNV;
+     prep[19] = 2;
+
+     submit_buffer( sdrv, 20 );
+
+     sdev->ckey_b_enabled       = false;
+     sdev->color_change_enabled = false;
+     sdev->mask_enabled         = false;
+}
+
+void
+sh7722EmitCommands( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     flush_prepared( sdrv );
+}
+
+void
+sh7722FlushTextureCache( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+     __u32            *prep = start_buffer( sdrv, 4 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     prep[0] = BEM_PE_CACHE;
+     prep[1] = 2;
+
+     prep[2] = BEM_TE_INVALID;
+     prep[3] = 1;
+
+     submit_buffer( sdrv, 4 );
+}
+
+/**********************************************************************************************************************/
+
+void
+sh7722CheckState( void                *drv,
+                  void                *dev,
+                  CardState           *state,
+                  DFBAccelerationMask  accel )
+{
+     D_DEBUG_AT( SH7722_BLT, "%s( %p, 0x%08x )\n", __FUNCTION__, state, accel );
+
+     /* Return if the desired function is not supported at all. */
+     if (accel & ~(SH7722_SUPPORTED_DRAWINGFUNCTIONS | SH7722_SUPPORTED_BLITTINGFUNCTIONS))
+          return;
+
+     /* Return if the destination format is not supported. */
+     switch (state->destination->config.format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+          case DSPF_RGB16:
+          case DSPF_ARGB1555:
+          case DSPF_RGB555:
+          case DSPF_ARGB4444:
+          case DSPF_RGB444:
+               break;
+          default:
+               return;
+     }
+
+     /* Check if drawing or blitting is requested. */
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* Return if unsupported drawing flags are set. */
+          if (state->drawingflags & ~SH7722_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          /* Return if blending with unsupported blend functions is requested. */
+          if (state->drawingflags & DSDRAW_BLEND) {
+               /* Check blend functions. */
+               if (!check_blend_functions( state ))
+                    return;
+
+               /* XOR only without blending. */
+               if (state->drawingflags & DSDRAW_XOR)
+                    return;
+          }
+
+          /* Enable acceleration of drawing functions. */
+          state->accel |= SH7722_SUPPORTED_DRAWINGFUNCTIONS;
+     }
+     else {
+          DFBSurfaceBlittingFlags flags = state->blittingflags;
+
+          /* Return if unsupported blitting flags are set. */
+          if (flags & ~SH7722_SUPPORTED_BLITTINGFLAGS) 
+               return;
+
+          /* Return if the source format is not supported. */
+          switch (state->source->config.format) {
+               case DSPF_ARGB:
+               case DSPF_RGB32:
+               case DSPF_RGB16:
+               case DSPF_ARGB1555:
+               case DSPF_RGB555:
+               case DSPF_ARGB4444:
+               case DSPF_RGB444:
+                    break;
+
+               default:
+                    return;
+          }
+
+          /* Return if blending with unsupported blend functions is requested. */
+          if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               /* Check blend functions. */
+               if (!check_blend_functions( state ))
+                    return;
+          }
+
+          /* XOR only without blending etc. */
+          if (flags & DSBLIT_XOR &&
+              flags & ~(DSBLIT_SRC_COLORKEY | DSBLIT_ROTATE180 | DSBLIT_XOR))
+               return;
+
+          /* Return if colorizing for non-font surfaces is requested. */
+          if ((flags & DSBLIT_COLORIZE) && !(state->source->type & CSTF_FONT))
+               return;
+
+          /* Return if blending with both alpha channel and value is requested. */
+          if (D_FLAGS_ARE_SET( flags, DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA))
+               return;
+
+          /* Mask checking. */
+          if (flags & DSBLIT_SRC_MASK_ALPHA) {
+               if (!state->source_mask)
+                    return;
+                    
+               /* Return if the source mask format is not supported. */
+               switch (state->source_mask->config.format) {
+                    case DSPF_A1:
+                    case DSPF_A8:
+                         break;
+
+                    default:
+                         return;
+               }
+          }
+
+          /* Enable acceleration of blitting functions. */
+          state->accel |= SH7722_SUPPORTED_BLITTINGFUNCTIONS;
+     }
+}
+
+/*
+ * Make sure that the hardware is programmed for execution of 'accel' according to the 'state'.
+ */
+void
+sh7722SetState( void                *drv,
+                void                *dev,
+                GraphicsDeviceFuncs *funcs,
+                CardState           *state,
+                DFBAccelerationMask  accel )
+{
+     SH7722DriverData       *sdrv     = drv;
+     SH7722DeviceData       *sdev     = dev;
+     StateModificationFlags  modified = state->mod_hw;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %p, 0x%08x ) <- modified 0x%08x\n",
+                 __FUNCTION__, state, accel, modified );
+     DUMP_INFO();
+
+     /*
+      * 1) Invalidate hardware states
+      *
+      * Each modification to the hw independent state invalidates one or more hardware states.
+      */
+
+     /* Simply invalidate all? */
+     if (modified == SMF_ALL) {
+          SH7722_INVALIDATE( ALL );
+     }
+     else if (modified) {
+          /* Invalidate destination registers. */
+          if (modified & SMF_DESTINATION)
+               SH7722_INVALIDATE( DEST );
+
+          /* Invalidate clipping registers. */
+          if (modified & SMF_CLIP)
+               SH7722_INVALIDATE( CLIP );
+
+          /* Invalidate source registers. */
+          if (modified & SMF_SOURCE)
+               SH7722_INVALIDATE( SOURCE | COLOR_KEY );
+          else if (modified & SMF_SRC_COLORKEY)
+               SH7722_INVALIDATE( COLOR_KEY );
+
+          /* Invalidate mask registers. */
+          if (modified & (SMF_SOURCE_MASK | SMF_SOURCE_MASK_VALS))
+               SH7722_INVALIDATE( MASK );
+
+          /* Invalidate color registers. */
+          if (modified & SMF_COLOR)
+               SH7722_INVALIDATE( BLENDING | COLOR | COLOR_CHANGE );
+          else if (modified & (SMF_SRC_BLEND | SMF_SRC_BLEND))
+               SH7722_INVALIDATE( BLENDING );
+
+          /* Invalidate matrix registers. */
+          if (modified & SMF_MATRIX)
+               SH7722_INVALIDATE( MATRIX );
+
+          /* Invalidate blitting operation. */
+          if (modified & SMF_BLITTING_FLAGS)
+               SH7722_INVALIDATE( BLIT_OP );
+     }
+
+     /*
+      * 2) Validate hardware states
+      *
+      * Each function has its own set of states that need to be validated.
+      */
+
+     /* Always requiring valid destination and clip. */
+     SH7722_CHECK_VALIDATE( DEST_CLIP );
+
+     /* Use transformation matrix? */
+     if (state->render_options & DSRO_MATRIX)
+          SH7722_CHECK_VALIDATE( MATRIX );
+
+     /* Depending on the function... */
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+               /* ...require valid color. */
+               SH7722_CHECK_VALIDATE( COLOR );
+
+               /* Use blending? */
+               if (state->drawingflags & DSDRAW_BLEND) {
+                    /* need valid source and destination blend factors */
+                    SH7722_CHECK_VALIDATE( BLENDING );
+               }
+
+               /* Clear old ckeys */
+               if (sdev->ckey_b_enabled)
+                    invalidate_ckey( sdrv, sdev );
+
+               /* Clear old mask */
+               if (sdev->mask_enabled)
+                    invalidate_mask( sdrv, sdev );
+
+               /* Choose function. */
+               switch (accel) {
+                    case DFXL_FILLRECTANGLE:
+                         if (state->render_options & (DSRO_MATRIX | DSRO_ANTIALIAS))
+                              funcs->FillRectangle = sh7722FillRectangleMatrixAA;
+                         else
+                              funcs->FillRectangle = sh7722FillRectangle;
+                         break;
+
+                    case DFXL_DRAWRECTANGLE:
+                         if (state->render_options & (DSRO_MATRIX | DSRO_ANTIALIAS))
+                              funcs->DrawRectangle = sh7722DrawRectangleMatrixAA;
+                         else
+                              funcs->DrawRectangle = sh7722DrawRectangle;
+                         break;
+
+                    case DFXL_DRAWLINE:
+                         if (state->render_options & DSRO_ANTIALIAS)
+                              funcs->DrawLine = sh7722DrawLineAA;
+                         else if (state->render_options & DSRO_MATRIX)
+                              funcs->DrawLine = sh7722DrawLineMatrix;
+                         else
+                              funcs->DrawLine = sh7722DrawLine;
+                         break;
+
+                    default:
+                         break;
+               }
+
+               /*
+                * 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 = SH7722_SUPPORTED_DRAWINGFUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               /* ...require valid source. */
+               SH7722_CHECK_VALIDATE( SOURCE );
+
+               /* Use blending? */
+               if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+                    /* need valid source and destination blend factors */
+                    SH7722_CHECK_VALIDATE( BLENDING );
+               }
+
+               /* Use color keying? */
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+                    /* Need valid color key settings (enabling). */
+                    SH7722_CHECK_VALIDATE( COLOR_KEY );
+
+                    sdev->ckey_b_enabled = true;
+               }
+               /* Disable color keying? */
+               else if (sdev->ckey_b_enabled)
+                    invalidate_ckey( sdrv, sdev );
+
+               /* Use color change? */
+               if (state->blittingflags & DSBLIT_COLORIZE) {
+                    /* Need valid color change settings (enabling). */
+                    SH7722_CHECK_VALIDATE( COLOR_CHANGE );
+
+                    sdev->color_change_enabled = true;
+               }
+               /* Disable color change? */
+               else if (sdev->color_change_enabled)
+                    invalidate_color_change( sdrv, sdev );
+
+               /* Use mask? */
+               if (state->blittingflags & DSBLIT_SRC_MASK_ALPHA) {
+                    /* need valid mask */
+                    SH7722_CHECK_VALIDATE( MASK );
+
+                    sdev->mask_enabled = true;
+               }
+               /* Disable mask? */
+               else if (sdev->mask_enabled)
+                    invalidate_mask( sdrv, sdev );
+
+               SH7722_CHECK_VALIDATE( BLIT_OP );
+
+               /*
+                * 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 = SH7722_SUPPORTED_BLITTINGFUNCTIONS;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     sdev->dflags         = state->drawingflags;
+     sdev->bflags         = state->blittingflags;
+     sdev->render_options = state->render_options;
+     sdev->color          = state->color;
+
+     /*
+      * 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;
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+draw_rectangle( SH7722DriverData *sdrv,
+                SH7722DeviceData *sdev,
+                int x1, int y1,
+                int x2, int y2,
+                int x3, int y3,
+                int x4, int y4,
+                bool antialias,
+                bool full )
+{
+     u32  ctrl = antialias ? WR_CTRL_ANTIALIAS : 0;
+     u32 *prep = start_buffer( sdrv, full ? 24 : 12 );
+
+     if (antialias) {
+          prep[0] = BEM_WR_FGC;
+          prep[1] = PIXEL_ARGB( (sdev->color.a * AA_COEF) >> 8,
+                                (sdev->color.r * AA_COEF) >> 8,
+                                (sdev->color.g * AA_COEF) >> 8,
+                                (sdev->color.b * AA_COEF) >> 8 );
+
+          prep[2] = BEM_PE_FIXEDALPHA;
+          prep[3] = (sdev->color.a * AA_COEF) << 16;
+     }
+     else {
+          prep[0] = BEM_WR_FGC;
+          prep[1] = PIXEL_ARGB( sdev->color.a,
+                                sdev->color.r,
+                                sdev->color.g,
+                                sdev->color.b );
+
+          prep[2] = BEM_PE_FIXEDALPHA;
+          prep[3] = (sdev->color.a << 24) << (sdev->color.a << 16);
+     }
+
+     prep[4] = BEM_WR_V1;
+     prep[5] = SH7722_XY( x1, y1 );
+
+     prep[6] = BEM_WR_V2;
+     prep[7] = SH7722_XY( x2, y2 );
+
+     prep[8] = BEM_PE_OPERATION;
+     prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf)
+                                             :
+                                              (antialias ? 
+                                               (BLE_FUNC_AxB_plus_CxD |
+                                                BLE_SRCF_ONE |
+                                                BLE_SRCA_FIXED |
+                                                BLE_DSTF_1_SRC_A) : BLE_FUNC_NONE
+                                              );
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[9] |= BLE_ROP_XOR;
+
+     prep[10] = BEM_WR_CTRL;
+     prep[11] = WR_CTRL_LINE | ctrl;
+
+     if (full) {
+          prep[12] = BEM_WR_V2;
+          prep[13] = SH7722_XY( x3, y3 );
+          prep[14] = BEM_WR_CTRL;
+          prep[15] = WR_CTRL_POLYLINE | ctrl;
+
+          prep[16] = BEM_WR_V2;
+          prep[17] = SH7722_XY( x4, y4 );
+          prep[18] = BEM_WR_CTRL;
+          prep[19] = WR_CTRL_POLYLINE | ctrl;
+
+          prep[20] = BEM_WR_V2;
+          prep[21] = SH7722_XY( x1, y1 );
+          prep[22] = BEM_WR_CTRL;
+          prep[23] = WR_CTRL_POLYLINE | ctrl;
+
+          submit_buffer( sdrv, 24 );
+     }
+     else {
+          prep[7]   = SH7722_XY( x3, y3 );
+          prep[11] |= WR_CTRL_ENDPOINT;
+
+          submit_buffer( sdrv, 12 );
+     }
+}
+
+/*
+ * Render a filled rectangle using the current hardware state.
+ */
+static bool
+sh7722FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 8 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+     prep[0] = BEM_BE_V1;
+     prep[1] = SH7722_XY( rect->x, rect->y );
+
+     prep[2] = BEM_BE_V2;
+     prep[3] = SH7722_XY( rect->w, rect->h );
+
+     prep[4] = BEM_PE_OPERATION;
+     prep[5] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[5] |= BLE_ROP_XOR;
+
+     prep[6] = BEM_BE_CTRL;
+     prep[7] = BE_CTRL_RECTANGLE | BE_CTRL_SCANMODE_LINE;
+
+     submit_buffer( sdrv, 8 );
+
+     return true;
+}
+
+/*
+ * This version sends a quadrangle to have all four edges transformed.
+ */
+static bool
+sh7722FillRectangleMatrixAA( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+
+     if (sdev->render_options & DSRO_ANTIALIAS) {
+          int x1 = rect->x;
+          int y1 = rect->y;
+          int x2 = rect->x + rect->w;
+          int y2 = rect->y;
+          int x3 = rect->x + rect->w;
+          int y3 = rect->y + rect->h;
+          int x4 = rect->x;
+          int y4 = rect->y + rect->h;
+
+          if (sdev->render_options & DSRO_MATRIX) {
+               int t;
+     
+               t  = ((x1 * sdev->matrix[0]) +
+                     (y1 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y1 = ((x1 * sdev->matrix[3]) +
+                     (y1 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+               x1 = t;
+     
+               t  = ((x2 * sdev->matrix[0]) +
+                     (y2 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y2 = ((x2 * sdev->matrix[3]) +
+                     (y2 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+               x2 = t;
+     
+               t  = ((x3 * sdev->matrix[0]) +
+                     (y3 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y3 = ((x3 * sdev->matrix[3]) +
+                     (y3 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+               x3 = t;
+     
+               t  = ((x4 * sdev->matrix[0]) +
+                     (y4 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y4 = ((x4 * sdev->matrix[3]) +
+                     (y4 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+               x4 = t;
+          }
+     
+          prep = start_buffer( sdrv, 28 );
+
+          prep[0] = BEM_WR_FGC;
+          prep[1] = PIXEL_ARGB( (sdev->color.a * AA_COEF) >> 8,
+                                (sdev->color.r * AA_COEF) >> 8,
+                                (sdev->color.g * AA_COEF) >> 8,
+                                (sdev->color.b * AA_COEF) >> 8 );
+
+          prep[2] = BEM_PE_FIXEDALPHA;
+          prep[3] = (sdev->color.a * AA_COEF) << 16;
+
+          prep[4] = BEM_WR_V1;
+          prep[5] = SH7722_XY( x1, y1 );
+
+          prep[6] = BEM_WR_V2;
+          prep[7] = SH7722_XY( x2, y2 );
+
+          prep[8] = BEM_PE_OPERATION;
+          prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                     sdev->ble_srcf |
+                                                     BLE_SRCA_FIXED |
+                                                     sdev->ble_dstf)
+                                                  :
+                                                    (BLE_FUNC_AxB_plus_CxD |
+                                                     BLE_SRCF_ONE |
+                                                     BLE_SRCA_FIXED |
+                                                     BLE_DSTF_1_SRC_A);
+
+          if (sdev->dflags & DSDRAW_XOR)
+               prep[9] |= BLE_ROP_XOR;
+
+          prep[10] = BEM_WR_CTRL;
+          prep[11] = WR_CTRL_LINE | WR_CTRL_ANTIALIAS;
+
+          if (rect->h > 1 && rect->w > 1) {
+               prep[12] = BEM_WR_V2;
+               prep[13] = SH7722_XY( x3, y3 );
+               prep[14] = BEM_WR_CTRL;
+               prep[15] = WR_CTRL_POLYLINE | WR_CTRL_ANTIALIAS;
+
+               prep[16] = BEM_WR_V2;
+               prep[17] = SH7722_XY( x4, y4 );
+               prep[18] = BEM_WR_CTRL;
+               prep[19] = WR_CTRL_POLYLINE | WR_CTRL_ANTIALIAS;
+
+               prep[20] = BEM_WR_V2;
+               prep[21] = SH7722_XY( x1, y1 );
+               prep[22] = BEM_WR_CTRL;
+               prep[23] = WR_CTRL_POLYLINE | WR_CTRL_ANTIALIAS;
+
+               prep[24] = BEM_WR_FGC;
+               prep[25] = PIXEL_ARGB( sdev->color.a,
+                                      sdev->color.r,
+                                      sdev->color.g,
+                                      sdev->color.b );
+
+               prep[26] = BEM_PE_FIXEDALPHA;
+               prep[27] = (sdev->color.a << 24) << (sdev->color.a << 16);
+
+               submit_buffer( sdrv, 28 );
+          }
+          else {
+               prep[7]   = SH7722_XY( x3, y3 );
+               prep[11] |= WR_CTRL_ENDPOINT;
+
+               prep[12] = BEM_WR_FGC;
+               prep[13] = PIXEL_ARGB( sdev->color.a,
+                                     sdev->color.r,
+                                     sdev->color.g,
+                                     sdev->color.b );
+
+               prep[14] = BEM_PE_FIXEDALPHA;
+               prep[15] = (sdev->color.a << 24) << (sdev->color.a << 16);
+
+               submit_buffer( sdrv, 16 );
+          }
+     }
+
+
+     prep = start_buffer( sdrv, 12 );
+
+     prep[0] = BEM_BE_V1;
+     prep[1] = SH7722_XY( rect->x, rect->y );
+
+     prep[2] = BEM_BE_V2;
+     prep[3] = SH7722_XY( rect->x, rect->y + rect->h );
+
+     prep[4] = BEM_BE_V3;
+     prep[5] = SH7722_XY( rect->x + rect->w, rect->y );
+
+     prep[6] = BEM_BE_V4;
+     prep[7] = SH7722_XY( rect->x + rect->w, rect->y + rect->h );
+
+     prep[8] = BEM_PE_OPERATION;
+     prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[9] |= BLE_ROP_XOR;
+
+     prep[10] = BEM_BE_CTRL;
+
+     if (sdev->render_options & DSRO_MATRIX)
+          prep[11] = BE_CTRL_QUADRANGLE | BE_CTRL_SCANMODE_4x4 |
+                     BE_CTRL_MATRIX | BE_CTRL_FIXMODE_16_16;// | BE_CTRL_ORIGIN;
+     else
+          prep[11] = BE_CTRL_QUADRANGLE | BE_CTRL_SCANMODE_LINE;
+
+     submit_buffer( sdrv, 12 );
+
+     return true;
+}
+
+/*
+ * Render a filled triangle using the current hardware state.
+ */
+bool
+sh7722FillTriangle( void *drv, void *dev, DFBTriangle *tri )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d,%d - %d,%d - %d,%d )\n", __FUNCTION__,
+                 tri->x1, tri->y1, tri->x2, tri->y2, tri->x3, tri->y3 );
+     DUMP_INFO();
+
+
+     if (sdev->render_options & DSRO_ANTIALIAS) {
+          int x1, y1;
+          int x2, y2;
+          int x3, y3;
+
+          if (sdev->render_options & DSRO_MATRIX) {
+               x1 = ((tri->x1 * sdev->matrix[0]) +
+                     (tri->y1 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y1 = ((tri->x1 * sdev->matrix[3]) +
+                     (tri->y1 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+
+               x2 = ((tri->x2 * sdev->matrix[0]) +
+                     (tri->y2 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y2 = ((tri->x2 * sdev->matrix[3]) +
+                     (tri->y2 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+
+               x3 = ((tri->x3 * sdev->matrix[0]) +
+                     (tri->y3 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+               y3 = ((tri->x3 * sdev->matrix[3]) +
+                     (tri->y3 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+          }
+          else {
+               x1 = tri->x1;
+               y1 = tri->y1;
+               x2 = tri->x2;
+               y2 = tri->y2;
+               x3 = tri->x3;
+               y3 = tri->y3;
+          }
+
+          prep = start_buffer( sdrv, 24 );
+
+          prep[0] = BEM_WR_FGC;
+          prep[1] = PIXEL_ARGB( (sdev->color.a * AA_COEF) >> 8,
+                                (sdev->color.r * AA_COEF) >> 8,
+                                (sdev->color.g * AA_COEF) >> 8,
+                                (sdev->color.b * AA_COEF) >> 8 );
+
+          prep[2] = BEM_PE_FIXEDALPHA;
+          prep[3] = (sdev->color.a * AA_COEF) << 16;
+
+          prep[4] = BEM_WR_V1;
+          prep[5] = SH7722_XY( x1, y1 );
+
+          prep[6] = BEM_WR_V2;
+          prep[7] = SH7722_XY( x2, y2 );
+
+          prep[8] = BEM_PE_OPERATION;
+          prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                     sdev->ble_srcf |
+                                                     BLE_SRCA_FIXED |
+                                                     sdev->ble_dstf)
+                                                  :
+                                                    (BLE_FUNC_AxB_plus_CxD |
+                                                     BLE_SRCF_ONE |
+                                                     BLE_SRCA_FIXED |
+                                                     BLE_DSTF_1_SRC_A);
+
+          if (sdev->dflags & DSDRAW_XOR)
+               prep[9] |= BLE_ROP_XOR;
+
+          prep[10] = BEM_WR_CTRL;
+          prep[11] = WR_CTRL_LINE | WR_CTRL_ANTIALIAS;
+
+          prep[12] = BEM_WR_V2;
+          prep[13] = SH7722_XY( x3, y3 );
+          prep[14] = BEM_WR_CTRL;
+          prep[15] = WR_CTRL_POLYLINE | WR_CTRL_ANTIALIAS;
+
+          prep[16] = BEM_WR_V2;
+          prep[17] = SH7722_XY( x1, y1 );
+          prep[18] = BEM_WR_CTRL;
+          prep[19] = WR_CTRL_POLYLINE | WR_CTRL_ANTIALIAS;
+
+          prep[20] = BEM_WR_FGC;
+          prep[21] = PIXEL_ARGB( sdev->color.a,
+                                 sdev->color.r,
+                                 sdev->color.g,
+                                 sdev->color.b );
+
+          prep[22] = BEM_PE_FIXEDALPHA;
+          prep[23] = (sdev->color.a << 24) << (sdev->color.a << 16);
+
+          submit_buffer( sdrv, 24 );
+     }
+
+
+     prep = start_buffer( sdrv, 12 );
+
+     prep[0] = BEM_BE_V1;
+     prep[1] = SH7722_XY( tri->x1, tri->y1 );
+
+     prep[2] = BEM_BE_V2;
+     prep[3] = SH7722_XY( tri->x2, tri->y2 );
+
+     prep[4] = BEM_BE_V3;
+     prep[5] = SH7722_XY( tri->x3, tri->y3 );
+
+     prep[6] = BEM_BE_V4;
+     prep[7] = SH7722_XY( tri->x3, tri->y3 );
+
+     prep[8] = BEM_PE_OPERATION;
+     prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[9] |= BLE_ROP_XOR;
+
+     prep[10] = BEM_BE_CTRL;
+     prep[11] = BE_CTRL_QUADRANGLE | BE_CTRL_SCANMODE_LINE;
+
+     if (sdev->render_options & DSRO_MATRIX)
+          prep[11] |= BE_CTRL_MATRIX | BE_CTRL_FIXMODE_16_16;// | BE_CTRL_ORIGIN;
+
+     submit_buffer( sdrv, 12 );
+
+     return true;
+}
+
+/*
+ * Render rectangle outlines using the current hardware state.
+ */
+static bool
+sh7722DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 20 );
+
+     int x1 = rect->x;
+     int y1 = rect->y;
+     int x2 = rect->x + rect->w;
+     int y2 = rect->y + rect->h;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+     prep[0] = BEM_WR_V1;
+     prep[1] = (y1 << 16) | x1;
+
+     prep[2] = BEM_WR_V2;
+     prep[3] = (y1 << 16) | x2;
+
+     prep[4] = BEM_PE_OPERATION;
+     prep[5] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[5] |= BLE_ROP_XOR;
+
+     prep[6] = BEM_WR_CTRL;
+     prep[7] = WR_CTRL_LINE;
+
+     if (rect->h > 1 && rect->w > 1) {
+          prep[8]  = BEM_WR_V2;
+          prep[9]  = (y2 << 16) | x2;
+          prep[10] = BEM_WR_CTRL;
+          prep[11] = WR_CTRL_POLYLINE;
+
+          prep[12] = BEM_WR_V2;
+          prep[13] = (y2 << 16) | x1;
+          prep[14] = BEM_WR_CTRL;
+          prep[15] = WR_CTRL_POLYLINE;
+
+          prep[16] = BEM_WR_V2;
+          prep[17] = (y1 << 16) | x1;
+          prep[18] = BEM_WR_CTRL;
+          prep[19] = WR_CTRL_POLYLINE;
+
+          submit_buffer( sdrv, 20 );
+     }
+     else {
+          prep[3]  = (y2 << 16) | x2;
+          prep[7] |= WR_CTRL_ENDPOINT;
+
+          submit_buffer( sdrv, 8 );
+     }
+
+     return true;
+}
+
+static bool
+sh7722DrawRectangleMatrixAA( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+
+     int x1 = rect->x;
+     int y1 = rect->y;
+     int x2 = rect->x + rect->w;
+     int y2 = rect->y;
+     int x3 = rect->x + rect->w;
+     int y3 = rect->y + rect->h;
+     int x4 = rect->x;
+     int y4 = rect->y + rect->h;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+     if (sdev->render_options & DSRO_MATRIX) {
+          int t;
+
+          t  = ((x1 * sdev->matrix[0]) +
+                (y1 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y1 = ((x1 * sdev->matrix[3]) +
+                (y1 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+          x1 = t;
+
+          t  = ((x2 * sdev->matrix[0]) +
+                (y2 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y2 = ((x2 * sdev->matrix[3]) +
+                (y2 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+          x2 = t;
+
+          t  = ((x3 * sdev->matrix[0]) +
+                (y3 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y3 = ((x3 * sdev->matrix[3]) +
+                (y3 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+          x3 = t;
+
+          t  = ((x4 * sdev->matrix[0]) +
+                (y4 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y4 = ((x4 * sdev->matrix[3]) +
+                (y4 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+          x4 = t;
+     }
+
+     if (sdev->render_options & DSRO_ANTIALIAS)
+          draw_rectangle( sdrv, sdev, x1, y1, x2, y2, x3, y3, x4, y4, true,  rect->h > 1 && rect->w > 1 );
+
+     draw_rectangle( sdrv, sdev, x1, y1, x2, y2, x3, y3, x4, y4, false, rect->h > 1 && rect->w > 1 );
+
+     return true;
+}
+
+/*
+ * Render a line using the current hardware state.
+ */
+static bool
+sh7722DrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 8 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d -> %d, %d )\n", __FUNCTION__,
+                 DFB_REGION_VALS( line ) );
+     DUMP_INFO();
+
+     prep[0] = BEM_WR_V1;
+     prep[1] = SH7722_XY( line->x1, line->y1 );
+
+     prep[2] = BEM_WR_V2;
+     prep[3] = SH7722_XY( line->x2, line->y2 );
+
+     prep[4] = BEM_PE_OPERATION;
+     prep[5] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[5] |= BLE_ROP_XOR;
+
+     prep[6] = BEM_WR_CTRL;
+     prep[7] = WR_CTRL_LINE | WR_CTRL_ENDPOINT;
+
+     submit_buffer( sdrv, 8 );
+
+     return true;
+}
+
+static bool
+sh7722DrawLineMatrix( void *drv, void *dev, DFBRegion *line )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 8 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d -> %d, %d )\n", __FUNCTION__,
+                 DFB_REGION_VALS( line ) );
+     DUMP_INFO();
+
+     int x1 = ((line->x1 * sdev->matrix[0]) +
+               (line->y1 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+     int y1 = ((line->x1 * sdev->matrix[3]) +
+               (line->y1 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+
+     int x2 = ((line->x2 * sdev->matrix[0]) +
+               (line->y2 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+     int y2 = ((line->x2 * sdev->matrix[3]) +
+               (line->y2 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+
+     prep[0] = BEM_WR_V1;
+     prep[1] = SH7722_XY( x1, y1 );
+
+     prep[2] = BEM_WR_V2;
+     prep[3] = SH7722_XY( x2, y2 );
+
+     prep[4] = BEM_PE_OPERATION;
+     prep[5] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[5] |= BLE_ROP_XOR;
+
+     prep[6] = BEM_WR_CTRL;
+     prep[7] = WR_CTRL_LINE | WR_CTRL_ENDPOINT;
+
+     submit_buffer( sdrv, 8 );
+
+     return true;
+}
+
+static bool
+sh7722DrawLineAA( void *drv, void *dev, DFBRegion *line )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 24 );
+     int               x1, y1;
+     int               x2, y2;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d -> %d, %d )\n", __FUNCTION__,
+                 DFB_REGION_VALS( line ) );
+     DUMP_INFO();
+
+     if (sdev->render_options & DSRO_MATRIX) {
+          x1 = ((line->x1 * sdev->matrix[0]) +
+                (line->y1 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y1 = ((line->x1 * sdev->matrix[3]) +
+                (line->y1 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+
+          x2 = ((line->x2 * sdev->matrix[0]) +
+                (line->y2 * sdev->matrix[1]) + sdev->matrix[2]) >> 16;
+          y2 = ((line->x2 * sdev->matrix[3]) +
+                (line->y2 * sdev->matrix[4]) + sdev->matrix[5]) >> 16;
+     }
+     else {
+          x1 = line->x1;
+          y1 = line->y1;
+          x2 = line->x2;
+          y2 = line->y2;
+     }
+
+     prep[0] = BEM_WR_FGC;
+     prep[1] = PIXEL_ARGB( (sdev->color.a * AA_COEF) >> 8,
+                           (sdev->color.r * AA_COEF) >> 8,
+                           (sdev->color.g * AA_COEF) >> 8,
+                           (sdev->color.b * AA_COEF) >> 8 );
+
+     prep[2] = BEM_PE_FIXEDALPHA;
+     prep[3] = (sdev->color.a * AA_COEF) << 16;
+
+     prep[4] = BEM_WR_V1;
+     prep[5] = SH7722_XY( x1, y1 );
+
+     prep[6] = BEM_WR_V2;
+     prep[7] = SH7722_XY( x2, y2 );
+
+     prep[8] = BEM_PE_OPERATION;
+     prep[9] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                sdev->ble_srcf |
+                                                BLE_SRCA_FIXED |
+                                                sdev->ble_dstf)
+                                             :
+                                               (BLE_FUNC_AxB_plus_CxD |
+                                                BLE_SRCF_ONE |
+                                                BLE_SRCA_FIXED |
+                                                BLE_DSTF_1_SRC_A);
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[9] |= BLE_ROP_XOR;
+
+     prep[10] = BEM_WR_CTRL;
+     prep[11] = WR_CTRL_LINE | WR_CTRL_ENDPOINT | WR_CTRL_ANTIALIAS;
+
+
+
+     prep[12] = BEM_WR_FGC;
+     prep[13] = PIXEL_ARGB( sdev->color.a,
+                            sdev->color.r,
+                            sdev->color.g,
+                            sdev->color.b );
+
+     prep[14] = BEM_PE_FIXEDALPHA;
+     prep[15] = (sdev->color.a << 24) | (sdev->color.a << 16);
+
+     prep[16] = BEM_WR_V1;
+     prep[17] = SH7722_XY( x1, y1 );
+
+     prep[18] = BEM_WR_V2;
+     prep[19] = SH7722_XY( x2, y2 );
+
+     prep[20] = BEM_PE_OPERATION;
+     prep[21] = (sdev->dflags & DSDRAW_BLEND) ? (BLE_FUNC_AxB_plus_CxD |
+                                                 sdev->ble_srcf |
+                                                 BLE_SRCA_FIXED |
+                                                 sdev->ble_dstf) : BLE_FUNC_NONE;
+
+     if (sdev->dflags & DSDRAW_XOR)
+          prep[21] |= BLE_ROP_XOR;
+
+     prep[22] = BEM_WR_CTRL;
+     prep[23] = WR_CTRL_LINE | WR_CTRL_ENDPOINT;
+
+
+     submit_buffer( sdrv, 24 );
+
+     return true;
+}
+
+/*
+ * Common implementation for Blit() and StretchBlit().
+ */
+static inline bool
+sh7722DoBlit( SH7722DriverData *sdrv, SH7722DeviceData *sdev,
+              DFBRectangle *rect, int x, int y, int w, int h )
+{
+     int    num  = 8;
+     __u32 *prep = start_buffer( sdrv, 12 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d  ->  %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ), x, y, w, h );
+     DUMP_INFO();
+
+     prep[0] = BEM_BE_SRC_LOC;
+
+     /* Stencil mode needs a workaround, because the hardware always adds the source location. */
+     if (sdev->bflags & DSBLIT_SRC_MASK_ALPHA && sdev->mask_flags & DSMF_STENCIL)
+          prep[1] = SH7722_XY( 0, 0 );
+     else
+          prep[1] = SH7722_XY( rect->x, rect->y );
+
+     prep[2] = BEM_BE_SRC_SIZE;
+     prep[3] = SH7722_XY( rect->w, rect->h );
+
+     prep[4] = BEM_BE_V1;
+     prep[5] = SH7722_XY( x, y );
+
+     prep[6] = BEM_BE_V2;
+     prep[7] = SH7722_XY( w, h );
+
+     /* Stencil mode needs a workaround, because the hardware always adds the source location. */
+     if (sdev->bflags & DSBLIT_SRC_MASK_ALPHA && sdev->mask_flags & DSMF_STENCIL) {
+          prep[num++] = BEM_TE_SRC_BASE;
+          prep[num++] = sdev->src_phys + sdev->src_pitch * rect->y + sdev->src_bpp * rect->x;
+
+          SH7722_INVALIDATE( SOURCE );
+     }
+
+     prep[num++] = BEM_BE_CTRL;
+     prep[num++] = BE_CTRL_RECTANGLE | BE_CTRL_TEXTURE | BE_CTRL_SCANMODE_LINE;
+
+     if (sdev->bflags & DSBLIT_ROTATE180)
+          prep[num-1] |= BE_FLIP_BOTH;
+     else if (rect->w == w && rect->h == h)  /* No blit direction handling for StretchBlit(). */
+          prep[num-1] |= BE_CTRL_BLTDIR_AUTOMATIC;
+
+     submit_buffer( sdrv, num );
+
+     return true;
+}
+
+/*
+ * This version sends a quadrangle to have all four edges transformed.
+ */
+__attribute__((noinline))
+static bool
+sh7722DoBlitM( SH7722DriverData *sdrv, SH7722DeviceData *sdev,
+               DFBRectangle *rect, int x1, int y1, int x2, int y2 )
+{
+     int    num  = 12;
+     __u32 *prep = start_buffer( sdrv, 16 );
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d  ->  %d, %d - %d, %d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ), x1, y1, x2, y2 );
+     DUMP_INFO();
+
+     prep[0]  = BEM_BE_SRC_LOC;
+
+     /* Stencil mode needs a workaround, because the hardware always adds the source location. */
+     if (sdev->bflags & DSBLIT_SRC_MASK_ALPHA && sdev->mask_flags & DSMF_STENCIL)
+          prep[1] = SH7722_XY( 0, 0 );
+     else
+          prep[1] = SH7722_XY( rect->x, rect->y );
+             
+     prep[2]  = BEM_BE_SRC_SIZE;
+     prep[3]  = SH7722_XY( rect->w, rect->h );
+             
+     prep[4]  = BEM_BE_V1;
+     prep[5]  = SH7722_XY( x1, y1 );
+             
+     prep[6]  = BEM_BE_V2;
+     prep[7]  = SH7722_XY( x1, y2 );
+             
+     prep[8]  = BEM_BE_V3;
+     prep[9]  = SH7722_XY( x2, y1 );
+
+     prep[10] = BEM_BE_V4;
+     prep[11] = SH7722_XY( x2, y2 );
+
+     /* Stencil mode needs a workaround, because the hardware always adds the source location. */
+     if (sdev->bflags & DSBLIT_SRC_MASK_ALPHA && sdev->mask_flags & DSMF_STENCIL) {
+          prep[num++] = BEM_TE_SRC_BASE;
+          prep[num++] = sdev->src_phys + sdev->src_pitch * rect->y + sdev->src_bpp * rect->x;
+
+          SH7722_INVALIDATE( SOURCE );
+     }
+
+     prep[num++] = BEM_BE_CTRL;
+     prep[num++] = BE_CTRL_QUADRANGLE | BE_CTRL_TEXTURE | BE_CTRL_SCANMODE_4x4 |
+                   BE_CTRL_MATRIX | BE_CTRL_FIXMODE_16_16;// | BE_CTRL_ORIGIN;
+
+     if (sdev->bflags & DSBLIT_ROTATE180)
+          prep[num-1] |= BE_FLIP_BOTH;
+
+     submit_buffer( sdrv, num );
+
+     return true;
+}
+
+/*
+ * Blit a rectangle using the current hardware state.
+ */
+bool
+sh7722Blit( void *drv, void *dev, DFBRectangle *rect, int x, int y )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d  -> %d, %d )\n",
+                 __FUNCTION__, DFB_RECTANGLE_VALS( rect ), x, y );
+
+     if (sdev->render_options & DSRO_MATRIX)
+          return sh7722DoBlitM( sdrv, sdev, rect, DFB_REGION_VALS_FROM_RECTANGLE_VALS( x, y, rect->w, rect->h ) );
+
+     return sh7722DoBlit( sdrv, sdev, rect, x, y, rect->w, rect->h );
+}
+
+/*
+ * StretchBlit a rectangle using the current hardware state.
+ */
+bool
+sh7722StretchBlit( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+
+     D_DEBUG_AT( SH7722_BLT, "%s( %d, %d - %dx%d  -> %d, %d - %dx%d )\n",
+                 __FUNCTION__, DFB_RECTANGLE_VALS( srect ), DFB_RECTANGLE_VALS( drect ) );
+
+     if (sdev->render_options & DSRO_MATRIX)
+          return sh7722DoBlitM( sdrv, sdev, srect, DFB_REGION_VALS_FROM_RECTANGLE( drect ) );
+
+     return sh7722DoBlit( sdrv, sdev, srect, drect->x, drect->y, drect->w, drect->h );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.h
new file mode 100755
index 0000000..00934bf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_blt.h
@@ -0,0 +1,214 @@
+#ifndef __SH7722_BLT_H__
+#define __SH7722_BLT_H__
+
+#include <sys/ioctl.h>
+
+#include "sh7722_types.h"
+
+
+
+#define SH7722_SUPPORTED_DRAWINGFLAGS      (DSDRAW_BLEND | \
+                                            DSDRAW_XOR)
+
+#define SH7722_SUPPORTED_DRAWINGFUNCTIONS  (DFXL_FILLRECTANGLE | \
+                                            DFXL_FILLTRIANGLE  | \
+                                            DFXL_DRAWRECTANGLE | \
+                                            DFXL_DRAWLINE)
+
+#define SH7722_SUPPORTED_BLITTINGFLAGS     (DSBLIT_BLEND_ALPHACHANNEL | \
+                                            DSBLIT_BLEND_COLORALPHA   | \
+                                            DSBLIT_SRC_COLORKEY       | \
+                                            DSBLIT_ROTATE180          | \
+                                            DSBLIT_COLORIZE           | \
+                                            DSBLIT_XOR                | \
+                                            DSBLIT_SRC_MASK_ALPHA)
+
+#define SH7722_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT | \
+                                            DFXL_STRETCHBLIT)
+
+
+DFBResult sh7722EngineSync  ( void *drv, void *dev );
+
+void sh7722EngineReset      ( void *drv, void *dev );
+void sh7722FlushTextureCache( void *drv, void *dev );
+
+void sh7722EmitCommands     ( void *drv, void *dev );
+
+void sh7722CheckState       ( void *drv, void *dev,
+                              CardState *state, DFBAccelerationMask accel );
+
+void sh7722SetState         ( void *drv, void *dev,
+                              GraphicsDeviceFuncs *funcs,
+                              CardState *state, DFBAccelerationMask accel );
+
+bool sh7722FillTriangle     ( void *drv, void *dev, DFBTriangle *tri );
+bool sh7722Blit             ( void *drv, void *dev, DFBRectangle *rect, int x, int y );
+bool sh7722StretchBlit      ( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect );
+
+
+
+#define SH7722_S16S16(h,l)         ((u32)((((u16)(h)) << 16) | ((u16)(l))))
+
+#define SH7722_XY(x,y)             SH7722_S16S16(y,x)
+
+#define	SH7722_TDG_BASE            0xFD000000
+
+#define	BEM_HC_DMA_ADR			   (SH7722_TDG_BASE + 0x00040)
+#define	BEM_HC_DMA_START		   (SH7722_TDG_BASE + 0x00044)
+
+#define	BEM_WR_CTRL                (0x00400)
+#define	BEM_WR_V1                  (0x00410)
+#define	BEM_WR_V2                  (0x00414)
+#define	BEM_WR_FGC                 (0x00420)
+
+#define	BEM_BE_CTRL                (0x00800)
+#define	BEM_BE_V1                  (0x00810)
+#define	BEM_BE_V2                  (0x00814)
+#define	BEM_BE_V3                  (0x00818)
+#define	BEM_BE_V4                  (0x0081C)
+#define	BEM_BE_COLOR1              (0x00820)
+#define	BEM_BE_SRC_LOC             (0x00830)
+#define	BEM_BE_SRC_SIZE            (0x00834)
+#define	BEM_BE_MATRIX_A            (0x00850)
+#define	BEM_BE_MATRIX_B            (0x00854)
+#define	BEM_BE_MATRIX_C            (0x00858)
+#define	BEM_BE_MATRIX_D            (0x0085C)
+#define	BEM_BE_MATRIX_E            (0x00860)
+#define	BEM_BE_MATRIX_F            (0x00864)
+#define	BEM_BE_ORIGIN              (0x00870)
+#define	BEM_BE_SC_MIN              (0x00880)
+#define	BEM_BE_SC_MAX              (0x00884)
+
+#define	BEM_TE_SRC                 (0x00C00)
+#define	BEM_TE_SRC_BASE            (0x00C04)
+#define	BEM_TE_SRC_SIZE            (0x00C08)
+#define	BEM_TE_SRC_CNV             (0x00C0C)
+#define	BEM_TE_MASK                (0x00C10)
+#define	BEM_TE_MASK_BASE           (0x00C14)
+#define	BEM_TE_MASK_SIZE           (0x00C18)
+#define	BEM_TE_MASK_CNV            (0x00C1C)
+#define	BEM_TE_ALPHA               (0x00C28)
+#define	BEM_TE_FILTER              (0x00C30)
+#define	BEM_TE_INVALID             (0x00C40)
+
+#define	BEM_PE_DST                 (0x01000)
+#define	BEM_PE_DST_BASE            (0x01004)
+#define	BEM_PE_DST_SIZE            (0x01008)
+#define	BEM_PE_SC                  (0x0100C)
+#define	BEM_PE_SC0_MIN             (0x01010)
+#define	BEM_PE_SC0_MAX             (0x01014)
+#define	BEM_PE_CKEY                (0x01040)
+#define	BEM_PE_CKEY_B              (0x01044)
+#define	BEM_PE_CKEY_A              (0x01048)
+#define	BEM_PE_COLORCHANGE         (0x01050)
+#define	BEM_PE_ALPHA               (0x01058)
+#define	BEM_PE_COLORCHANGE_0       (0x01060)
+#define	BEM_PE_COLORCHANGE_1       (0x01064)
+#define	BEM_PE_OPERATION           (0x01080)
+#define	BEM_PE_FIXEDALPHA          (0x01084)
+#define	BEM_PE_OFFSET              (0x01088)
+#define	BEM_PE_MASK                (0x01094)
+#define	BEM_PE_CACHE               (0x010B0)
+
+/*
+ * BEM_BE_CTRL
+ */
+#define BE_FLIP_NONE               0x00000000
+#define BE_FLIP_HORIZONTAL         0x01000000
+#define BE_FLIP_VERTICAL           0x02000000
+#define BE_FLIP_BOTH               0x03000000
+
+#define BE_CTRL_FIXMODE_20_12      0x00000000
+#define BE_CTRL_FIXMODE_16_16      0x00100000
+#define BE_CTRL_CLIP               0x00080000
+#define BE_CTRL_ORIGIN             0x00040000
+#define BE_CTRL_ZOOM               0x00020000
+#define BE_CTRL_MATRIX             0x00010000
+
+#define BE_CTRL_SCANMODE_LINE      0x00000000
+#define BE_CTRL_SCANMODE_4x4       0x00001000
+#define BE_CTRL_SCANMODE_8x4       0x00002000
+
+#define BE_CTRL_BLTDIR_FORWARD     0x00000000
+#define BE_CTRL_BLTDIR_BACKWARD    0x00000100
+#define BE_CTRL_BLTDIR_AUTOMATIC   0x00000200
+
+#define BE_CTRL_TEXTURE            0x00000020
+#define BE_CTRL_QUADRANGLE         0x00000002
+#define BE_CTRL_RECTANGLE          0x00000001
+
+/*
+ * BEM_PE_OPERATION
+ */
+#define BLE_FUNC_NONE              0x00000000
+#define BLE_FUNC_AxB_plus_CxD      0x10000000
+#define BLE_FUNC_CxD_minus_AxB     0x20000000
+#define BLE_FUNC_AxB_minus_CxD     0x30000000
+
+#define BLE_ROP_XOR                0x01660000
+
+#define BLE_SRCA_FIXED             0x00000000
+#define BLE_SRCA_SOURCE_ALPHA      0x00001000
+#define BLE_SRCA_ALPHA_CHANNEL     0x00002000
+
+#define BLE_DSTA_FIXED             0x00000000
+#define BLE_DSTA_DEST_ALPHA        0x00000100
+
+#define BLE_SRCF_ZERO              0x00000000
+#define BLE_SRCF_ONE               0x00000010
+#define BLE_SRCF_DST               0x00000020
+#define BLE_SRCF_1_DST             0x00000030
+#define BLE_SRCF_SRC_A             0x00000040
+#define BLE_SRCF_1_SRC_A           0x00000050
+#define BLE_SRCF_DST_A             0x00000060
+#define BLE_SRCF_1_DST_A           0x00000070
+
+#define BLE_DSTO_DST               0x00000000
+#define BLE_DSTO_OFFSET            0x00000008
+
+#define BLE_DSTF_ZERO              0x00000000
+#define BLE_DSTF_ONE               0x00000001
+#define BLE_DSTF_SRC               0x00000002
+#define BLE_DSTF_1_SRC             0x00000003
+#define BLE_DSTF_SRC_A             0x00000004
+#define BLE_DSTF_1_SRC_A           0x00000005
+#define BLE_DSTF_DST_A             0x00000006
+#define BLE_DSTF_1_DST_A           0x00000007
+
+/*
+ * BEM_PE_CKEY
+ */
+#define CKEY_EXCLUDE_UNUSED        0x00100000
+#define CKEY_EXCLUDE_ALPHA         0x00010000
+#define CKEY_A_ENABLE              0x00000100
+#define CKEY_B_ENABLE              0x00000001
+
+/*
+ * BEM_PE_COLORCHANGE
+ */
+#define COLORCHANGE_DISABLE        0x00000000
+#define COLORCHANGE_COMPARE_FIRST  0x0000000b
+#define COLORCHANGE_EXCLUDE_UNUSED 0x00010000
+
+/*
+ * BEM_PE_MASK
+ */
+#define PE_MASK_DISABLE            0x00000000
+#define PE_MASK_COLOR              0x00000001
+#define PE_MASK_ALPHA              0x00000080
+
+/*
+ * BEM_TE_MASK
+ */
+#define TE_MASK_DISABLE            0x00000000
+#define TE_MASK_ENABLE             0x00010000
+
+/*
+ * BEM_WR_CTRL
+ */
+#define WR_CTRL_LINE               0x00000002
+#define WR_CTRL_POLYLINE           0x00000003
+#define WR_CTRL_ANTIALIAS          0x00020100
+#define WR_CTRL_ENDPOINT           0x00001000
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeg.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeg.c
new file mode 100755
index 0000000..9208890
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeg.c
@@ -0,0 +1,395 @@
+#ifdef SH7722_DEBUG_JPEG
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+#include <stdio.h>
+#include <jpeglib.h>
+
+#undef HAVE_STDLIB_H
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <fcntl.h>
+
+#include <asm/types.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <directfb.h>
+
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <display/idirectfbsurface.h>
+#include <media/idirectfbdatabuffer.h>
+#include <media/idirectfbimageprovider.h>
+
+#include "sh7722.h"
+#include "sh7722_jpeglib.h"
+
+D_DEBUG_DOMAIN( SH7722_JPEG, "SH7722/JPEG", "SH7722 JPEG Processing Unit" );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, SH7722_JPEG )
+
+/*
+ * private data struct of IDirectFBImageProvider_SH7722_JPEG
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     SH7722_JPEG_context  info;
+
+     CoreDFB             *core;
+
+     IDirectFBDataBuffer *buffer;
+     DirectStream        *stream;
+
+     DIRenderCallback     render_callback;
+     void                *render_callback_context;
+} IDirectFBImageProvider_SH7722_JPEG_data;
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBImageProvider_SH7722_JPEG_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_SH7722_JPEG_data *data = thiz->priv;
+
+     data->buffer->Release( data->buffer );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBImageProvider_SH7722_JPEG_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_SH7722_JPEG_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG)
+
+     if (--data->ref == 0)
+          IDirectFBImageProvider_SH7722_JPEG_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_SH7722_JPEG_RenderTo( IDirectFBImageProvider *thiz,
+                                             IDirectFBSurface       *destination,
+                                             const DFBRectangle     *dest_rect )
+{
+     DFBResult              ret;
+     DFBRegion              clip;
+     DFBRectangle           rect; 
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *dst_surface;
+     CoreSurfaceBufferLock  lock;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG);
+
+     if (!data->buffer)
+          return DFB_BUFFEREMPTY;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(destination, dst_data, IDirectFBSurface);
+
+     dst_surface = dst_data->surface;
+     if (!dst_surface)
+          return DFB_DESTROYED;
+
+     dfb_region_from_rectangle( &clip, &dst_data->area.current );
+
+     if (dest_rect) {
+          if (dest_rect->w < 1 || dest_rect->h < 1)
+               return DFB_INVARG;
+          
+          rect.x = dest_rect->x + dst_data->area.wanted.x;
+          rect.y = dest_rect->y + dst_data->area.wanted.y;
+          rect.w = dest_rect->w;
+          rect.h = dest_rect->h;
+     }
+     else
+          rect = dst_data->area.wanted;
+
+     if (!dfb_rectangle_region_intersects( &rect, &clip ))
+          return DFB_OK;
+
+     ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_GPU, CSAF_WRITE, &lock );
+     if (ret)
+          return ret;
+
+     ret = SH7722_JPEG_Decode( &data->info, &rect, &clip, dst_surface->config.format,
+                               lock.phys, lock.addr, lock.pitch, dst_surface->config.size.w, dst_surface->config.size.h );
+
+     dfb_surface_unlock_buffer( dst_surface, &lock );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBImageProvider_SH7722_JPEG_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                                      DIRenderCallback        callback,
+                                                      void                   *context )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_SH7722_JPEG)
+
+     data->render_callback         = callback;
+     data->render_callback_context = context;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_SH7722_JPEG_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                          DFBSurfaceDescription  *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG)
+
+     if (!data->buffer)
+          return DFB_BUFFEREMPTY;
+     
+     desc->flags       = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     desc->height      = data->info.height;
+     desc->width       = data->info.width;
+     desc->pixelformat = data->info.mode420 ? DSPF_NV12 : DSPF_NV16;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_SH7722_JPEG_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                        DFBImageDescription    *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     if (!data->buffer)
+          return DFB_BUFFEREMPTY;
+
+     desc->caps = DICAPS_NONE;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_SH7722_JPEG_WriteBack( IDirectFBImageProvider *thiz,
+                                              IDirectFBSurface       *surface,
+                                              const DFBRectangle     *src_rect,
+                                              const char             *filename )
+{
+     DFBResult              ret;
+     DFBRegion              clip;
+     DFBRectangle           rect; 
+     IDirectFBSurface_data *src_data;
+     CoreSurface           *src_surface;
+     CoreSurfaceBufferLock  lock;
+     DFBDimension           jpeg_size;
+
+     CoreSurface           *tmp_surface;
+     CoreSurfaceBufferLock  tmp_lock;
+     int                    tmp_pitch;
+     unsigned int           tmp_phys;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_SH7722_JPEG)
+
+     if (!surface || !filename)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(surface, src_data, IDirectFBSurface);
+
+     D_DEBUG_AT( SH7722_JPEG, "%s - surface %p, rect %p to file %s\n",
+               __FUNCTION__, surface, src_rect, filename );
+
+     src_surface = src_data->surface;
+     if (!src_surface)
+          return DFB_DESTROYED;
+
+     switch (src_surface->config.format) {
+          case DSPF_NV12:
+          case DSPF_NV16:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_RGB24:
+               break;
+
+          default:
+               /* FIXME: implement fallback */
+               D_UNIMPLEMENTED();
+               return DFB_UNIMPLEMENTED;
+     }
+
+     dfb_region_from_rectangle( &clip, &src_data->area.current );
+
+     if (src_rect) {
+          if (src_rect->w < 1 || src_rect->h < 1)
+               return DFB_INVARG;
+
+          rect.x = src_rect->x + src_data->area.wanted.x;
+          rect.y = src_rect->y + src_data->area.wanted.y;
+          rect.w = src_rect->w;
+          rect.h = src_rect->h;
+     }
+     else
+          rect = src_data->area.wanted;
+
+     if (!dfb_rectangle_region_intersects( &rect, &clip ))
+          return DFB_INVAREA;
+
+     jpeg_size.w = src_surface->config.size.w;
+     jpeg_size.h = src_surface->config.size.h;
+     
+     /* it would be great if we had intermediate storage, since 
+      * this prevents handling the encoding in 16-line chunks,
+      * causing scaling artefacts at the border of these chunks */
+     
+     tmp_pitch = (jpeg_size.w + 3) & ~3;
+     ret = dfb_surface_create_simple( data->core, tmp_pitch, jpeg_size.h,
+                                      DSPF_NV16, DSCAPS_VIDEOONLY,
+                                      CSTF_NONE, 0, 0, &tmp_surface );
+     if( ret ) {
+          /* too bad, we proceed without */
+          D_DEBUG_AT( SH7722_JPEG, "%s - failed to create intermediate storage: %d\n",
+               __FUNCTION__, ret );
+          tmp_surface = 0;
+          tmp_phys    = 0;
+     }
+     else {
+          /* lock it to get the address */
+          ret = dfb_surface_lock_buffer( tmp_surface, CSBR_FRONT, CSAID_GPU, CSAF_READ | CSAF_WRITE, &tmp_lock );
+          if (ret) {
+               D_DEBUG_AT( SH7722_JPEG, "%s - failed to lock intermediate storage: %d\n",
+                    __FUNCTION__, ret );
+               dfb_surface_unref( tmp_surface );
+               tmp_surface = 0;
+               tmp_phys    = 0;
+          }
+          else {
+               tmp_phys = tmp_lock.phys;
+               D_DEBUG_AT( SH7722_JPEG, "%s - surface locked at %x\n", __FUNCTION__, tmp_phys );
+          }
+     }
+
+     ret = dfb_surface_lock_buffer( src_surface, CSBR_FRONT, CSAID_GPU, CSAF_READ, &lock );
+     if ( ret == DFB_OK ) {
+          ret = SH7722_JPEG_Encode( filename, &rect, src_surface->config.format, lock.phys, lock.pitch,
+                                    jpeg_size.w, jpeg_size.h, tmp_phys );
+                                    
+          dfb_surface_unlock_buffer( src_surface, &lock );
+     }
+     
+     if( tmp_surface ) {
+          /* unlock and release the created surface */
+          dfb_surface_unlock_buffer( tmp_surface, &tmp_lock );
+          dfb_surface_unref( tmp_surface );
+     }
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx )
+{
+     SH7722DeviceData *sdev = dfb_gfxcard_get_device_data();
+
+#ifndef JPU_SUPPORT
+     return DFB_UNSUPPORTED;
+#endif
+
+     if (sdev->sh772x != 7722)
+          return DFB_UNSUPPORTED;
+
+     /* Called with NULL when used for encoding. */
+     if (!ctx)
+          return DFB_OK;
+          
+     if (ctx->header[0] == 0xff && ctx->header[1] == 0xd8 && ctx->filename)
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... )
+{
+     DFBResult            ret;
+     IDirectFBDataBuffer *buffer;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_SH7722_JPEG);
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+
+     data->ref    = 1;
+     data->buffer = buffer;
+     data->core   = core;
+
+     if (buffer) {
+          IDirectFBDataBuffer_File_data *file_data;
+
+          ret = buffer->AddRef( buffer );
+          if (ret) {
+               DIRECT_DEALLOCATE_INTERFACE(thiz);
+               return ret;
+          }
+
+          DIRECT_INTERFACE_GET_DATA_FROM( buffer, file_data, IDirectFBDataBuffer_File );
+               
+          data->stream = file_data->stream;
+
+          ret = SH7722_JPEG_Open( file_data->stream, &data->info );
+          if (ret) {
+               buffer->Release( buffer );
+               DIRECT_DEALLOCATE_INTERFACE(thiz);
+               return ret;
+          }
+     }
+
+     thiz->AddRef                = IDirectFBImageProvider_SH7722_JPEG_AddRef;
+     thiz->Release               = IDirectFBImageProvider_SH7722_JPEG_Release;
+     thiz->RenderTo              = IDirectFBImageProvider_SH7722_JPEG_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_SH7722_JPEG_SetRenderCallback;
+     thiz->GetImageDescription   = IDirectFBImageProvider_SH7722_JPEG_GetImageDescription;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_SH7722_JPEG_GetSurfaceDescription;
+     thiz->WriteBack             = IDirectFBImageProvider_SH7722_JPEG_WriteBack;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.c
new file mode 100755
index 0000000..6d88da8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.c
@@ -0,0 +1,1654 @@
+#ifdef SH7722_DEBUG_JPEG
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+#include <stdio.h>
+#include <jpeglib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <asm/types.h>
+
+#ifdef STANDALONE
+#include "sh7722_jpeglib_standalone.h"
+#else
+#undef HAVE_STDLIB_H
+#include <config.h>
+
+#include <direct/conf.h>
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/stream.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+#endif
+
+#include <jpeglib.h>
+#include <setjmp.h>
+
+#include <sh772x_gfx.h>
+
+#include "sh7722_jpeglib.h"
+#include "sh7722_regs.h"
+
+
+D_DEBUG_DOMAIN( SH7722_JPEG, "SH7722/JPEG", "SH7722 JPEG Processing Unit" );
+
+/**********************************************************************************************************************/
+
+/*
+ * private data struct of SH7722_JPEG
+ */
+typedef struct {
+     int                            ref_count;
+
+     int                            gfx_fd;
+     SH772xGfxSharedArea           *gfx_shared;
+
+     unsigned long                  jpeg_phys;
+     unsigned long                  jpeg_lb1;
+     unsigned long                  jpeg_lb2;
+
+     volatile void                 *jpeg_virt;
+
+     unsigned long                  mmio_phys;
+     volatile void                 *mmio_base;
+} SH7722_JPEG_data;
+
+/**********************************************************************************************************************/
+
+#if 1
+static inline u32
+SH7722_GETREG32( SH7722_JPEG_data *data,
+                 u32               address )
+{
+     SH772xRegister reg = { address, 0 };
+
+     if (ioctl( data->gfx_fd, SH772xGFX_IOCTL_GETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_GETREG32( 0x%08x )\n", reg.address );
+
+     return reg.value;
+}
+
+static inline void
+SH7722_SETREG32( SH7722_JPEG_data *data,
+                 u32               address,
+                 u32               value )
+{
+     SH772xRegister reg = { address, value };
+
+     if (ioctl( data->gfx_fd, SH772xGFX_IOCTL_SETREG32, ® ) < 0)
+          D_PERROR( "SH772xGFX_IOCTL_SETREG32( 0x%08x, 0x%08x )\n", reg.address, reg.value );
+}
+#else
+static inline u32
+SH7722_GETREG32( SH7722_JPEG_data *data,
+                 u32               address )
+{
+     D_ASSERT( address >= data->mmio_phys );
+     D_ASSERT( address < (data->mmio_phys + data->mmio_length) );
+
+     return *(volatile u32*)(data->mmio_base + (address - data->mmio_phys));
+}
+
+static inline void
+SH7722_SETREG32( SH7722_JPEG_data *data,
+                 u32               address,
+                 u32               value )
+{
+     D_ASSERT( address >= data->mmio_phys );
+     D_ASSERT( address < (data->mmio_phys + data->mmio_length) );
+
+     *(volatile u32*)(data->mmio_base + (address - data->mmio_phys)) = value;
+}
+#endif
+
+static inline int
+coded_data_amount( SH7722_JPEG_data *data )
+{
+     return (SH7722_GETREG32(data, JCDTCU) << 16) | (SH7722_GETREG32(data, JCDTCM) << 8) | SH7722_GETREG32(data, JCDTCD);
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+DecodeHW( SH7722_JPEG_data      *data,
+          SH7722_JPEG_context   *info,
+          const DFBRectangle    *rect,
+          const DFBRegion       *clip,
+          DFBSurfacePixelFormat  format,
+          unsigned long          phys,
+          int                    pitch,
+          unsigned int           width,
+          unsigned int           height )
+{
+     DirectResult           ret;
+     unsigned int           len;
+     int                    i;
+     int                    cw, ch;
+     bool                   reload = false;
+     SH772xGfxSharedArea   *shared = data->gfx_shared;
+     SH7722JPEG             jpeg;
+     u32                    vtrcr   = 0;
+     u32                    vswpout = 0;
+     DirectStream          *stream  = info->stream;
+
+     D_ASSERT( data != NULL );
+     DFB_RECTANGLE_ASSERT( rect );
+     DFB_REGION_ASSERT( clip );
+
+     cw = clip->x2 - clip->x1 + 1;
+     ch = clip->y2 - clip->y1 + 1;
+
+     if (cw < 1 || ch < 1)
+          return DR_INVAREA;
+
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p, 0x%08lx|%d [%dx%d] %s )\n", __FUNCTION__,
+                 data, phys, pitch, info->width, info->height,
+                 dfb_pixelformat_name(format) );
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> %d,%d - %4dx%4d  [clip %d,%d - %4dx%4d]\n",
+                 DFB_RECTANGLE_VALS( rect ), DFB_RECTANGLE_VALS_FROM_REGION( clip ) );
+
+     /*
+      * Kernel based state machine
+      *
+      * Execution enters the kernel and only returns to user space for
+      *  - end of decoding
+      *  - error in decoding
+      *  - reload requested
+      *
+      * TODO
+      * - finish clipping (maybe not all is possible without tricky code)
+      * - modify state machine to be used by Construct(), GetSurfaceDescription() and RenderTo() to avoid redundancy
+      * - check return code and length from GetData()
+      */
+
+     /* No cropping of top or left edge :( */
+     if (clip->x1 > rect->x || clip->y1 > rect->y) {
+          D_UNIMPLEMENTED();
+          return DR_UNIMPLEMENTED;
+     }
+
+     /* Init VEU transformation control (format conversion). */
+     if (!info->mode420)
+          vtrcr |= (1 << 14);
+
+     switch (format) {
+          case DSPF_NV12:
+               vswpout = 0x70;
+               break;
+
+          case DSPF_NV16:
+               vswpout = 0x70;
+               vtrcr  |= (1 << 22);
+               break;
+
+          case DSPF_RGB16:
+               vswpout = 0x60;
+               vtrcr  |= (6 << 16) | 2;
+               break;
+
+          case DSPF_RGB32:
+               vswpout = 0x40;
+               vtrcr  |= (19 << 16) | 2;
+               break;
+
+          case DSPF_RGB24:
+               vswpout = 0x70;
+               vtrcr  |= (21 << 16) | 2;
+               break;
+
+          default:
+               D_BUG( "unexpected format %s", dfb_pixelformat_name(format) );
+               return DR_BUG;
+     }
+
+     /* Calculate destination base address. */
+     phys += DFB_BYTES_PER_LINE(format, rect->x) + rect->y * pitch;
+     jpeg.phys = phys;
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> locking JPU...\n" );
+
+     if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_LOCK_JPEG )) {
+          ret = errno2result( errno );
+          D_PERROR( "SH7722/JPEG: Could not lock JPEG engine!\n" );
+          return ret;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> loading...\n" );
+
+     /* Fill first reload buffer. */
+     ret = direct_stream_read( stream, SH7722GFX_JPEG_RELOAD_SIZE, (void*) data->jpeg_virt, &len );
+     if (ret) {
+          ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+          D_DERROR( ret, "SH7722/JPEG: Could not fill first reload buffer!\n" );
+          return DR_IO;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> setting...\n" );
+
+     /* Initialize JPEG state. */
+     jpeg.state   = SH7722_JPEG_START;
+     jpeg.flags   = 0;
+     jpeg.buffers = 1;
+
+     /* Enable reload if buffer was filled completely (coded data length >= one reload buffer). */
+     if (len == SH7722GFX_JPEG_RELOAD_SIZE) {
+          jpeg.flags |= SH7722_JPEG_FLAG_RELOAD;
+
+          reload = true;
+     }
+
+     /* Program JPU from RESET. */
+     SH7722_SETREG32( data, JCCMD,    JCCMD_RESET );
+     SH7722_SETREG32( data, JCMOD,    JCMOD_INPUT_CTRL | JCMOD_DSP_DECODE );
+     SH7722_SETREG32( data, JIFCNT,   JIFCNT_VJSEL_JPU );
+     SH7722_SETREG32( data, JIFECNT,  JIFECNT_SWAP_4321 );
+     SH7722_SETREG32( data, JIFDSA1,  data->jpeg_phys );
+     SH7722_SETREG32( data, JIFDSA2,  data->jpeg_phys + SH7722GFX_JPEG_RELOAD_SIZE );
+     SH7722_SETREG32( data, JIFDDRSZ, len & 0x00FFFF00 );
+
+     if (info->width == cw && info->height == ch && rect->w == cw && rect->h == ch &&
+         (( info->mode420 && format == DSPF_NV12) ||
+          (!info->mode420 && format == DSPF_NV16)))
+     {
+          /* Setup JPU for decoding in frame mode (directly to surface). */
+          SH7722_SETREG32( data, JINTE,    JINTS_INS5_ERROR | JINTS_INS6_DONE |
+                                          (reload ? JINTS_INS14_RELOAD : 0) );
+          SH7722_SETREG32( data, JIFDCNT,  JIFDCNT_SWAP_4321 | (reload ? JIFDCNT_RELOAD_ENABLE : 0) );
+
+          SH7722_SETREG32( data, JIFDDYA1, phys );
+          SH7722_SETREG32( data, JIFDDCA1, phys + pitch * height );
+          SH7722_SETREG32( data, JIFDDMW,  pitch );
+     }
+     else {
+          jpeg.flags |= SH7722_JPEG_FLAG_CONVERT;
+
+          /* Setup JPU for decoding in line buffer mode. */
+          SH7722_SETREG32( data, JINTE,    JINTS_INS5_ERROR | JINTS_INS6_DONE |
+                                          JINTS_INS11_LINEBUF0 | JINTS_INS12_LINEBUF1 |
+                                          (reload ? JINTS_INS14_RELOAD : 0) );
+          SH7722_SETREG32( data, JIFDCNT,  JIFDCNT_LINEBUF_MODE | (SH7722GFX_JPEG_LINEBUFFER_HEIGHT << 16) |
+                                          JIFDCNT_SWAP_4321 | (reload ? JIFDCNT_RELOAD_ENABLE : 0) );
+
+          SH7722_SETREG32( data, JIFDDYA1, data->jpeg_lb1 );
+          SH7722_SETREG32( data, JIFDDCA1, data->jpeg_lb1 + SH7722GFX_JPEG_LINEBUFFER_SIZE_Y );
+          SH7722_SETREG32( data, JIFDDYA2, data->jpeg_lb2 );
+          SH7722_SETREG32( data, JIFDDCA2, data->jpeg_lb2 + SH7722GFX_JPEG_LINEBUFFER_SIZE_Y );
+          SH7722_SETREG32( data, JIFDDMW,  SH7722GFX_JPEG_LINEBUFFER_PITCH );
+
+          /* Setup VEU for conversion/scaling (from line buffer to surface). */
+          SH7722_SETREG32( data, VEU_VBSRR, 0x00000100 );
+          SH7722_SETREG32( data, VEU_VESTR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VESWR, SH7722GFX_JPEG_LINEBUFFER_PITCH );
+          SH7722_SETREG32( data, VEU_VESSR, (info->height << 16) | info->width );
+          SH7722_SETREG32( data, VEU_VBSSR, 16 );
+          SH7722_SETREG32( data, VEU_VEDWR, pitch );
+          SH7722_SETREG32( data, VEU_VDAYR, phys );
+          SH7722_SETREG32( data, VEU_VDACR, phys + pitch * height );
+          SH7722_SETREG32( data, VEU_VTRCR, vtrcr );
+
+          SH7722_SETREG32( data, VEU_VRFCR, (((info->height << 12) / rect->h) << 16) |
+                                            ((info->width  << 12) / rect->w) );
+          SH7722_SETREG32( data, VEU_VRFSR, (ch << 16) | cw );
+          
+          SH7722_SETREG32( data, VEU_VENHR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VFMCR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VAPCR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VSWPR, 0x00000007 | vswpout );
+          SH7722_SETREG32( data, VEU_VEIER, 0x00000101 );
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> starting...\n" );
+
+     /* Clear interrupts in shared flags. */
+     shared->jpeg_ints = 0;
+
+     /* State machine. */
+     while (true) {
+          /* Run the state machine. */
+          if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_RUN_JPEG, &jpeg ) < 0) {
+               ret = errno2result( errno );
+
+               D_PERROR( "SH7722/JPEG: SH7722GFX_IOCTL_RUN_JPEG failed!\n" );
+               break;
+          }
+
+          D_ASSERT( jpeg.state != SH7722_JPEG_START );
+
+          /* Handle end (or error). */
+          if (jpeg.state == SH7722_JPEG_END) {
+               if (jpeg.error) {
+                    D_ERROR( "SH7722/JPEG: ERROR 0x%x!\n", jpeg.error );
+                    ret = DR_IO;
+               }
+
+               break;
+          }
+
+          /* Check for reload requests. */
+          for (i=1; i<=2; i++) {
+               if (jpeg.buffers & i) {
+                    if (jpeg.flags & SH7722_JPEG_FLAG_RELOAD) {
+                         D_ASSERT( reload );
+
+                         ret = direct_stream_read( stream, SH7722GFX_JPEG_RELOAD_SIZE,
+                                                   (void*) data->jpeg_virt +
+                                                   SH7722GFX_JPEG_RELOAD_SIZE * (i-1), &len );
+                         if (ret) {
+                              D_DERROR( ret, "SH7722/JPEG: Could not refill %s reload buffer!\n",
+                                        i == 1 ? "first" : "second" );
+                              jpeg.buffers &= ~i;
+                              jpeg.flags   &= ~SH7722_JPEG_FLAG_RELOAD;
+                         }
+                         else if (len < SH7722GFX_JPEG_RELOAD_SIZE)
+                              jpeg.flags &= ~SH7722_JPEG_FLAG_RELOAD;
+                    }
+                    else
+                         jpeg.buffers &= ~i;
+               }
+          }
+     }
+
+     ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+
+     return ret;
+}
+
+static int calculate_scaling( int input, int output )
+{
+     int frac = 0;
+     int mant = 0;
+     
+     if( input == output ) { /* no scaling, done */
+          return 0;
+     }
+
+     mant = input / output;     
+     frac = ((input * 4096 / output) & ~7) - mant * 4096;
+     
+     if( input < output ) { /* upscaling */
+          if( input*8 < output ) /* out-of-range */
+               return -1;
+
+          while( output > 1 + (int)((input-1)*4096/frac) ) {
+               frac -= 8;
+          }
+     }
+     else { /* downscaling */
+          int a,size,pmant;
+          
+          if( output*16 < input ) /* out-of-range */
+               return -1;
+
+          while(1) {
+               pmant = "1122333344444444"[mant] - '0';
+               a     = mant * 4096 + frac;
+               size  = (2*(input-1)*pmant)/(2*pmant);
+               size  = (((size-1) * 4096 * pmant) + a) / a;
+               
+               if( output <= size )
+                    break;
+                    
+               if( frac )
+                    frac -= 8;
+               else {
+                    mant--;
+                    frac = 0xff8;
+               }
+          }
+     }
+     
+     return (mant << 12) + frac;
+}
+
+static DirectResult
+EncodeHW( SH7722_JPEG_data      *data,
+          const char            *filename,
+          const DFBRectangle    *rect,
+          DFBSurfacePixelFormat  format,
+          unsigned long          phys,
+          int                    pitch,
+          unsigned int           width,
+          unsigned int           height,
+          unsigned long          tmpphys )
+{
+     DirectResult           ret;
+     int                    i, fd;
+     int                    written = 0;
+     SH772xGfxSharedArea   *shared  = data->gfx_shared;
+     u32                    vtrcr   = 0;
+     u32                    vswpin  = 0;
+     bool                   mode420 = false;
+     SH7722JPEG             jpeg;
+         
+     int horizontalscaling = 0;
+     int verticalscaling   = 0;
+
+     int clipwidth, clipheight;
+     DFBRectangle cliprect;
+
+     /* VEU has cliprequirement of 4 bytes, input and output must be 4 pixel aligned.
+      * We have to be careful with scaling: take clipped output and input */
+     
+     cliprect.h = (rect->h + 0x3) & ~0x3;
+     cliprect.w = (rect->w + 0x3) & ~0x3;
+     clipheight = (height  + 0x3) & ~0x3;
+     clipwidth  = (width   + 0x3) & ~0x3;
+
+     D_ASSERT( data != NULL );
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p, 0x%08lx|%d [%dx%d] %s )\n", __FUNCTION__,
+                 data, phys, pitch, width, height,
+                 dfb_pixelformat_name(format) );
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> %d,%d - %4dx%4d (at %lx)\n",
+                 DFB_RECTANGLE_VALS( rect ), tmpphys );
+
+     /* JPU input is 16x16 to 2560x1920 */
+     if (width < 16 || width > 2560 || height < 16 || height > 1920)
+          return DR_INVAREA;
+
+     if (rect->w < 1 || rect->h < 1)
+          return DR_INVAREA;
+
+     horizontalscaling = calculate_scaling( cliprect.w, clipwidth  );
+     verticalscaling   = calculate_scaling( cliprect.h, clipheight );
+     if( !tmpphys ) {
+          /* we don't have enough memory, so we do it in 16 pixel steps */
+          int h = ((rect->h * SH7722GFX_JPEG_LINEBUFFER_HEIGHT / height) + 0x3) & ~0x3;
+          verticalscaling = calculate_scaling( h, SH7722GFX_JPEG_LINEBUFFER_HEIGHT );
+     }
+     
+     /* scaling out-of-range? */
+     if( horizontalscaling == -1 || verticalscaling == -1 )
+          return DR_INVAREA;
+
+     /*
+      * Kernel based state machine
+      *
+      * Execution enters the kernel and only returns to user space for
+      *  - end of encoding
+      *  - error in encoding
+      *  - buffer loaded
+      *
+      * TODO
+      * - finish clipping (maybe not all is possible without tricky code)
+      */
+
+     /* Init VEU transformation control (format conversion). */
+     if (format == DSPF_NV12)
+          mode420 = true;
+     else
+          vtrcr |= (1 << 22);
+
+     switch (format) {
+          case DSPF_NV12:
+               vswpin = 0x07;
+               break;
+
+          case DSPF_NV16:
+               vswpin  = 0x07;
+               vtrcr  |= (1 << 14);
+               break;
+
+          case DSPF_RGB16:
+               vswpin  = 0x06;
+               vtrcr  |= (3 << 8) | 3;
+               break;
+
+          case DSPF_RGB32:
+               vswpin  = 0x04;
+               vtrcr  |= (0 << 8) | 3;
+               break;
+
+          case DSPF_RGB24:
+               vswpin  = 0x07;
+               vtrcr  |= (2 << 8) | 3;
+               break;
+
+          default:
+               D_BUG( "unexpected format %s", dfb_pixelformat_name(format) );
+               return DR_BUG;
+     }
+
+     /* Calculate source base address. */
+     /* TODO: NV12 input with offset. Colour will be off.. */
+     phys += DFB_BYTES_PER_LINE(format, rect->x) + rect->y * pitch;
+     jpeg.phys = phys;
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> locking JPU...\n" );
+
+     if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_LOCK_JPEG )) {
+          ret = errno2result( errno );
+          D_PERROR( "SH7722/JPEG: Could not lock JPEG engine!\n" );
+          return ret;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> opening '%s' for writing...\n", filename );
+
+     fd = open( filename, O_WRONLY | O_CREAT | O_TRUNC, 0644 );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+          D_PERROR( "SH7722/JPEG: Failed to open '%s' for writing!\n", filename );
+          return ret;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> setting...\n" );
+
+     /* Initialize JPEG state. */
+     jpeg.state   = SH7722_JPEG_START;
+     jpeg.flags   = SH7722_JPEG_FLAG_ENCODE;
+     jpeg.buffers = 3;
+
+     /* Always enable reload mode. */
+     jpeg.flags |= SH7722_JPEG_FLAG_RELOAD;
+
+     /* Program JPU from RESET. */
+     SH7722_SETREG32( data, JCCMD, JCCMD_RESET );
+     SH7722_SETREG32( data, JCMOD, JCMOD_INPUT_CTRL | JCMOD_DSP_ENCODE | (mode420 ? 2 : 1) );
+
+     SH7722_SETREG32( data, JCQTN,    0x14 );
+     SH7722_SETREG32( data, JCHTN,    0x3C );
+     SH7722_SETREG32( data, JCDRIU,   0x02 );
+     SH7722_SETREG32( data, JCDRID,   0x00 );
+     SH7722_SETREG32( data, JCHSZU,   width >> 8 );
+     SH7722_SETREG32( data, JCHSZD,   width & 0xff );
+     SH7722_SETREG32( data, JCVSZU,   height >> 8 );
+     SH7722_SETREG32( data, JCVSZD,   height & 0xff );
+     SH7722_SETREG32( data, JIFCNT,   JIFCNT_VJSEL_JPU );
+     SH7722_SETREG32( data, JIFDCNT,  JIFDCNT_SWAP_4321 );
+     SH7722_SETREG32( data, JIFEDA1,  data->jpeg_phys );
+     SH7722_SETREG32( data, JIFEDA2,  data->jpeg_phys + SH7722GFX_JPEG_RELOAD_SIZE );
+     SH7722_SETREG32( data, JIFEDRSZ, SH7722GFX_JPEG_RELOAD_SIZE );
+     SH7722_SETREG32( data, JIFESHSZ, clipwidth );
+     SH7722_SETREG32( data, JIFESVSZ, clipheight );
+
+     if (width == rect->w && height == rect->h && (format == DSPF_NV12 || format == DSPF_NV16))
+     {
+          D_DEBUG_AT( SH7722_JPEG, "  -> no VEU needed\n" );
+          
+          /* no scaling, and supported format - so no VEU needed */
+          /* Setup JPU for encoding in frame mode (directly from surface). */
+          SH7722_SETREG32( data, JINTE,    JINTS_INS10_XFER_DONE | JINTS_INS13_LOADED );
+          SH7722_SETREG32( data, JIFECNT,  JIFECNT_SWAP_4321 | JIFECNT_RELOAD_ENABLE | (mode420 ? 1 : 0) );
+
+          SH7722_SETREG32( data, JIFESYA1, phys );
+          SH7722_SETREG32( data, JIFESCA1, phys + pitch * height );
+          SH7722_SETREG32( data, JIFESMW,  pitch );
+     }
+     else {
+          /* Setup JPU for encoding in line buffer mode. */
+          jpeg.flags       |= SH7722_JPEG_FLAG_CONVERT;
+          jpeg.height       = height;
+          jpeg.inputheight  = rect->h;
+
+          SH7722_SETREG32( data, JINTE,    JINTS_INS11_LINEBUF0 | JINTS_INS12_LINEBUF1 |
+                                           JINTS_INS10_XFER_DONE | JINTS_INS13_LOADED );
+
+          if( tmpphys ) {
+               /* we have enough memory, so we just read one big "line" */
+               SH7722_SETREG32( data, JIFECNT,  JIFECNT_LINEBUF_MODE | (height << 16) |
+                                           JIFECNT_SWAP_4321 | JIFECNT_RELOAD_ENABLE | (mode420 ? 1 : 0) );
+               SH7722_SETREG32( data, JIFESYA1, tmpphys );
+               SH7722_SETREG32( data, JIFESCA1, tmpphys + clipwidth * height ); /* Y is 8bpp */
+               SH7722_SETREG32( data, JIFESMW,  clipwidth );
+          }
+          else {
+               SH7722_SETREG32( data, JIFECNT,  JIFECNT_LINEBUF_MODE | (SH7722GFX_JPEG_LINEBUFFER_HEIGHT << 16) |
+                                                JIFECNT_SWAP_4321 | JIFECNT_RELOAD_ENABLE | (mode420 ? 1 : 0) );
+
+               SH7722_SETREG32( data, JIFESYA1, data->jpeg_lb1 );
+               SH7722_SETREG32( data, JIFESCA1, data->jpeg_lb1 + SH7722GFX_JPEG_LINEBUFFER_SIZE_Y );
+               SH7722_SETREG32( data, JIFESMW,  SH7722GFX_JPEG_LINEBUFFER_PITCH );
+          }
+          SH7722_SETREG32( data, JIFESYA2, data->jpeg_lb2 );
+          SH7722_SETREG32( data, JIFESCA2, data->jpeg_lb2 + SH7722GFX_JPEG_LINEBUFFER_SIZE_Y );
+ 
+          /* we will not use the VEU in burst mode since we cannot program the 
+           * destination addresses intermediately in line mode. */
+          SH7722_SETREG32( data, VEU_VBSRR, 0x00000100 );
+          SH7722_SETREG32( data, VEU_VESTR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VSAYR, phys );
+          SH7722_SETREG32( data, VEU_VSACR, phys + pitch * height );
+          SH7722_SETREG32( data, VEU_VESWR, pitch );
+          
+          if( tmpphys ) {
+               SH7722_SETREG32( data, VEU_VESSR, (cliprect.h << 16) | cliprect.w );
+               SH7722_SETREG32( data, VEU_VEDWR, clipwidth );
+               SH7722_SETREG32( data, VEU_VDAYR, tmpphys );
+               SH7722_SETREG32( data, VEU_VDACR, tmpphys + clipwidth * height );
+               SH7722_SETREG32( data, VEU_VRFSR, (clipheight << 16) | clipwidth );
+          }
+          else {
+               int h = ((rect->h * SH7722GFX_JPEG_LINEBUFFER_HEIGHT / height) + 0x3) & ~0x3;
+               SH7722_SETREG32( data, VEU_VESSR, (h << 16) | cliprect.w );
+               SH7722_SETREG32( data, VEU_VEDWR, SH7722GFX_JPEG_LINEBUFFER_PITCH );
+               SH7722_SETREG32( data, VEU_VDAYR, data->jpeg_lb1 );
+               SH7722_SETREG32( data, VEU_VDACR, data->jpeg_lb1 + SH7722GFX_JPEG_LINEBUFFER_SIZE_Y );
+               SH7722_SETREG32( data, VEU_VRFSR, (SH7722GFX_JPEG_LINEBUFFER_HEIGHT << 16) | clipwidth );
+          }
+          SH7722_SETREG32( data, VEU_VRFCR, (verticalscaling << 16) | horizontalscaling );
+          SH7722_SETREG32( data, VEU_VTRCR, vtrcr );
+          SH7722_SETREG32( data, VEU_VENHR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VFMCR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VAPCR, 0x00000000 );
+          SH7722_SETREG32( data, VEU_VSWPR, 0x00000070 | vswpin );
+          SH7722_SETREG32( data, VEU_VEIER, 0x00000101 );
+     }
+
+     /* Init quantization tables. */
+     SH7722_SETREG32( data, JCQTBL0( 0), 0x100B0B0E );
+     SH7722_SETREG32( data, JCQTBL0( 1), 0x0C0A100E );
+     SH7722_SETREG32( data, JCQTBL0( 2), 0x0D0E1211 );
+     SH7722_SETREG32( data, JCQTBL0( 3), 0x10131828 );
+     SH7722_SETREG32( data, JCQTBL0( 4), 0x1A181616 );
+     SH7722_SETREG32( data, JCQTBL0( 5), 0x18312325 );
+     SH7722_SETREG32( data, JCQTBL0( 6), 0x1D283A33 );
+     SH7722_SETREG32( data, JCQTBL0( 7), 0x3D3C3933 );
+     SH7722_SETREG32( data, JCQTBL0( 8), 0x38374048 );
+     SH7722_SETREG32( data, JCQTBL0( 9), 0x5C4E4044 );
+     SH7722_SETREG32( data, JCQTBL0(10), 0x57453738 );
+     SH7722_SETREG32( data, JCQTBL0(11), 0x506D5157 );
+     SH7722_SETREG32( data, JCQTBL0(12), 0x5F626768 );
+     SH7722_SETREG32( data, JCQTBL0(13), 0x673E4D71 );
+     SH7722_SETREG32( data, JCQTBL0(14), 0x79706478 );
+     SH7722_SETREG32( data, JCQTBL0(15), 0x5C656763 );
+
+     SH7722_SETREG32( data, JCQTBL1( 0), 0x11121218 );
+     SH7722_SETREG32( data, JCQTBL1( 1), 0x15182F1A );
+     SH7722_SETREG32( data, JCQTBL1( 2), 0x1A2F6342 );
+     SH7722_SETREG32( data, JCQTBL1( 3), 0x38426363 );
+     SH7722_SETREG32( data, JCQTBL1( 4), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1( 5), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1( 6), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1( 7), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1( 8), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1( 9), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(10), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(11), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(12), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(13), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(14), 0x63636363 );
+     SH7722_SETREG32( data, JCQTBL1(15), 0x63636363 );
+
+     /* Init huffman tables. */
+     SH7722_SETREG32( data, JCHTBD0(0), 0x00010501 );
+     SH7722_SETREG32( data, JCHTBD0(1), 0x01010101 );
+     SH7722_SETREG32( data, JCHTBD0(2), 0x01000000 );
+     SH7722_SETREG32( data, JCHTBD0(3), 0x00000000 );
+     SH7722_SETREG32( data, JCHTBD0(4), 0x00010203 );
+     SH7722_SETREG32( data, JCHTBD0(5), 0x04050607 );
+     SH7722_SETREG32( data, JCHTBD0(6), 0x08090A0B );
+
+     SH7722_SETREG32( data, JCHTBD1(0), 0x00030101 );
+     SH7722_SETREG32( data, JCHTBD1(1), 0x01010101 );
+     SH7722_SETREG32( data, JCHTBD1(2), 0x01010100 );
+     SH7722_SETREG32( data, JCHTBD1(3), 0x00000000 );
+     SH7722_SETREG32( data, JCHTBD1(4), 0x00010203 );
+     SH7722_SETREG32( data, JCHTBD1(5), 0x04050607 );
+     SH7722_SETREG32( data, JCHTBD1(6), 0x08090A0B );
+
+     SH7722_SETREG32( data, JCHTBA0( 0), 0x00020103 );
+     SH7722_SETREG32( data, JCHTBA0( 1), 0x03020403 );
+     SH7722_SETREG32( data, JCHTBA0( 2), 0x05050404 );
+     SH7722_SETREG32( data, JCHTBA0( 3), 0x0000017D );
+     SH7722_SETREG32( data, JCHTBA0( 4), 0x01020300 );
+     SH7722_SETREG32( data, JCHTBA0( 5), 0x04110512 );
+     SH7722_SETREG32( data, JCHTBA0( 6), 0x21314106 );
+     SH7722_SETREG32( data, JCHTBA0( 7), 0x13516107 );
+     SH7722_SETREG32( data, JCHTBA0( 8), 0x22711432 );
+     SH7722_SETREG32( data, JCHTBA0( 9), 0x8191A108 );
+     SH7722_SETREG32( data, JCHTBA0(10), 0x2342B1C1 );
+     SH7722_SETREG32( data, JCHTBA0(11), 0x1552D1F0 );
+     SH7722_SETREG32( data, JCHTBA0(12), 0x24336272 );
+     SH7722_SETREG32( data, JCHTBA0(13), 0x82090A16 );
+     SH7722_SETREG32( data, JCHTBA0(14), 0x1718191A );
+     SH7722_SETREG32( data, JCHTBA0(15), 0x25262728 );
+     SH7722_SETREG32( data, JCHTBA0(16), 0x292A3435 );
+     SH7722_SETREG32( data, JCHTBA0(17), 0x36373839 );
+     SH7722_SETREG32( data, JCHTBA0(18), 0x3A434445 );
+     SH7722_SETREG32( data, JCHTBA0(19), 0x46474849 );
+     SH7722_SETREG32( data, JCHTBA0(20), 0x4A535455 );
+     SH7722_SETREG32( data, JCHTBA0(21), 0x56575859 );
+     SH7722_SETREG32( data, JCHTBA0(22), 0x5A636465 );
+     SH7722_SETREG32( data, JCHTBA0(23), 0x66676869 );
+     SH7722_SETREG32( data, JCHTBA0(24), 0x6A737475 );
+     SH7722_SETREG32( data, JCHTBA0(25), 0x76777879 );
+     SH7722_SETREG32( data, JCHTBA0(26), 0x7A838485 );
+     SH7722_SETREG32( data, JCHTBA0(27), 0x86878889 );
+     SH7722_SETREG32( data, JCHTBA0(28), 0x8A929394 );
+     SH7722_SETREG32( data, JCHTBA0(29), 0x95969798 );
+     SH7722_SETREG32( data, JCHTBA0(30), 0x999AA2A3 );
+     SH7722_SETREG32( data, JCHTBA0(31), 0xA4A5A6A7 );
+     SH7722_SETREG32( data, JCHTBA0(32), 0xA8A9AAB2 );
+     SH7722_SETREG32( data, JCHTBA0(33), 0xB3B4B5B6 );
+     SH7722_SETREG32( data, JCHTBA0(34), 0xB7B8B9BA );
+     SH7722_SETREG32( data, JCHTBA0(35), 0xC2C3C4C5 );
+     SH7722_SETREG32( data, JCHTBA0(36), 0xC6C7C8C9 );
+     SH7722_SETREG32( data, JCHTBA0(37), 0xCAD2D3D4 );
+     SH7722_SETREG32( data, JCHTBA0(38), 0xD5D6D7D8 );
+     SH7722_SETREG32( data, JCHTBA0(39), 0xD9DAE1E2 );
+     SH7722_SETREG32( data, JCHTBA0(40), 0xE3E4E5E6 );
+     SH7722_SETREG32( data, JCHTBA0(41), 0xE7E8E9EA );
+     SH7722_SETREG32( data, JCHTBA0(42), 0xF1F2F3F4 );
+     SH7722_SETREG32( data, JCHTBA0(43), 0xF5F6F7F8 );
+     SH7722_SETREG32( data, JCHTBA0(44), 0xF9FA0000 );
+
+     SH7722_SETREG32( data, JCHTBA1( 0), 0x00020102 );
+     SH7722_SETREG32( data, JCHTBA1( 1), 0x04040304 );
+     SH7722_SETREG32( data, JCHTBA1( 2), 0x07050404 );
+     SH7722_SETREG32( data, JCHTBA1( 3), 0x00010277 );
+     SH7722_SETREG32( data, JCHTBA1( 4), 0x00010203 );
+     SH7722_SETREG32( data, JCHTBA1( 5), 0x11040521 );
+     SH7722_SETREG32( data, JCHTBA1( 6), 0x31061241 );
+     SH7722_SETREG32( data, JCHTBA1( 7), 0x51076171 );
+     SH7722_SETREG32( data, JCHTBA1( 8), 0x13223281 );
+     SH7722_SETREG32( data, JCHTBA1( 9), 0x08144291 );
+     SH7722_SETREG32( data, JCHTBA1(10), 0xA1B1C109 );
+     SH7722_SETREG32( data, JCHTBA1(11), 0x233352F0 );
+     SH7722_SETREG32( data, JCHTBA1(12), 0x156272D1 );
+     SH7722_SETREG32( data, JCHTBA1(13), 0x0A162434 );
+     SH7722_SETREG32( data, JCHTBA1(14), 0xE125F117 );
+     SH7722_SETREG32( data, JCHTBA1(15), 0x18191A26 );
+     SH7722_SETREG32( data, JCHTBA1(16), 0x2728292A );
+     SH7722_SETREG32( data, JCHTBA1(17), 0x35363738 );
+     SH7722_SETREG32( data, JCHTBA1(18), 0x393A4344 );
+     SH7722_SETREG32( data, JCHTBA1(19), 0x45464748 );
+     SH7722_SETREG32( data, JCHTBA1(20), 0x494A5354 );
+     SH7722_SETREG32( data, JCHTBA1(21), 0x55565758 );
+     SH7722_SETREG32( data, JCHTBA1(22), 0x595A6364 );
+     SH7722_SETREG32( data, JCHTBA1(23), 0x65666768 );
+     SH7722_SETREG32( data, JCHTBA1(24), 0x696A7374 );
+     SH7722_SETREG32( data, JCHTBA1(25), 0x75767778 );
+     SH7722_SETREG32( data, JCHTBA1(26), 0x797A8283 );
+     SH7722_SETREG32( data, JCHTBA1(27), 0x84858687 );
+     SH7722_SETREG32( data, JCHTBA1(28), 0x88898A92 );
+     SH7722_SETREG32( data, JCHTBA1(29), 0x93949596 );
+     SH7722_SETREG32( data, JCHTBA1(30), 0x9798999A );
+     SH7722_SETREG32( data, JCHTBA1(31), 0xA2A3A4A5 );
+     SH7722_SETREG32( data, JCHTBA1(32), 0xA6A7A8A9 );
+     SH7722_SETREG32( data, JCHTBA1(33), 0xAAB2B3B4 );
+     SH7722_SETREG32( data, JCHTBA1(34), 0xB5B6B7B8 );
+     SH7722_SETREG32( data, JCHTBA1(35), 0xB9BAC2C3 );
+     SH7722_SETREG32( data, JCHTBA1(36), 0xC4C5C6C7 );
+     SH7722_SETREG32( data, JCHTBA1(37), 0xC8C9CAD2 );
+     SH7722_SETREG32( data, JCHTBA1(38), 0xD3D4D5D6 );
+     SH7722_SETREG32( data, JCHTBA1(39), 0xD7D8D9DA );
+     SH7722_SETREG32( data, JCHTBA1(40), 0xE2E3E4E5 );
+     SH7722_SETREG32( data, JCHTBA1(41), 0xE6E7E8E9 );
+     SH7722_SETREG32( data, JCHTBA1(42), 0xEAF2F3F4 );
+     SH7722_SETREG32( data, JCHTBA1(43), 0xF5F6F7F8 );
+     SH7722_SETREG32( data, JCHTBA1(44), 0xF9FA0000 );
+
+     /* Clear interrupts in shared flags. */
+     shared->jpeg_ints = 0;
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> starting...\n" );
+
+     /* State machine. */
+     while (true) {
+          /* Run the state machine. */
+          if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_RUN_JPEG, &jpeg ) < 0) {
+               ret = errno2result( errno );
+
+               D_PERROR( "SH7722/JPEG: SH7722GFX_IOCTL_RUN_JPEG failed!\n" );
+               break;
+          }
+
+          D_ASSERT( jpeg.state != SH7722_JPEG_START );
+
+          /* Check for loaded buffers. */
+          for (i=1; i<=2; i++) {
+               if (jpeg.buffers & i) {
+                    int amount = coded_data_amount( data ) - written;
+
+                    if (amount > SH7722GFX_JPEG_RELOAD_SIZE)
+                         amount = SH7722GFX_JPEG_RELOAD_SIZE;
+
+                    D_INFO( "SH7722/JPEG: Coded data amount: + %5d (buffer %d)\n", amount, i );
+
+                    written += write( fd, (void*) data->jpeg_virt + SH7722GFX_JPEG_RELOAD_SIZE * (i-1), amount );
+               }
+          }
+
+          /* Handle end (or error). */
+          if (jpeg.state == SH7722_JPEG_END) {
+               if (jpeg.error) {
+                    D_ERROR( "SH7722/JPEG: ERROR 0x%x!\n", jpeg.error );
+                    ret = DR_IO;
+               }
+
+               break;
+          }
+     }
+
+     D_INFO( "SH7722/JPEG: Coded data amount: = %5d (written: %d, buffers: %d)\n",
+             coded_data_amount( data ), written, jpeg.buffers );
+
+     ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+
+     close( fd );
+
+     return DR_OK;
+}
+
+#if 0
+static DirectResult
+DecodeHeader( SH7722_JPEG_data    *data,
+              DirectStream        *stream,
+              SH7722_JPEG_context *info )
+{
+     DirectResult         ret;
+     unsigned int         len;
+     SH772xGfxSharedArea *shared;
+
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p )\n", __FUNCTION__, data );
+
+     D_ASSERT( data != NULL );
+
+     shared = data->gfx_shared;
+
+     /*
+      * Do minimal stuff to decode the image header, serving as a good probe mechanism as well.
+      */
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> locking JPU...\n" );
+
+     if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_LOCK_JPEG )) {
+          ret = errno2result( errno );
+          D_PERROR( "SH7722/JPEG: Could not lock JPEG engine!\n" );
+          return ret;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> loading 32k...\n" );
+
+     /* Prefill reload buffer with 32k. */
+     ret = direct_stream_peek( stream, 32*1024, 0, (void*) data->jpeg_virt, &len );
+     if (ret) {
+          ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+          D_DEBUG_AT( SH7722_JPEG, "  -> ERROR from PeekData(): %s\n", DirectResultString(ret) );
+          return DR_IO;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> %u bytes loaded, setting...\n", len );
+
+     /* Program JPU from RESET. */
+     SH7722_SETREG32( data, JCCMD,    JCCMD_RESET );
+     SH7722_SETREG32( data, JCMOD,    JCMOD_INPUT_CTRL | JCMOD_DSP_DECODE );
+     SH7722_SETREG32( data, JINTE,    JINTS_INS3_HEADER | JINTS_INS5_ERROR );
+     SH7722_SETREG32( data, JIFCNT,   JIFCNT_VJSEL_JPU );
+     SH7722_SETREG32( data, JIFECNT,  JIFECNT_SWAP_4321 );
+     SH7722_SETREG32( data, JIFDCNT,  JIFDCNT_SWAP_4321 );
+     SH7722_SETREG32( data, JIFDSA1,  data->jpeg_phys );
+     SH7722_SETREG32( data, JIFDDRSZ, len );
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> starting...\n" );
+
+     /* Clear interrupts in shared flags. */
+     shared->jpeg_ints = 0;
+
+     /* Start decoder and begin reading from buffer. */
+     SH7722_SETREG32( data, JCCMD, JCCMD_START );
+
+     /* Stall machine. */
+     while (true) {
+          /* Check for new interrupts in shared flags... */
+          u32 ints = shared->jpeg_ints;
+          if (ints) {
+               /* ...and clear them (FIXME: race condition in case of multiple IRQs per command!). */
+               shared->jpeg_ints &= ~ints;
+
+               D_DEBUG_AT( SH7722_JPEG, "  -> JCSTS 0x%08x, JINTS 0x%08x\n", SH7722_GETREG32( data, JCSTS ), ints );
+
+               /* Check for errors! */
+               if (ints & JINTS_INS5_ERROR) {
+                    D_ERROR( "SH7722/JPEG: ERROR 0x%x!\n", SH7722_GETREG32( data, JCDERR ) );
+                    ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+                    return DR_IO;
+               }
+
+               /* Check for header interception... */
+               if (ints & JINTS_INS3_HEADER) {
+                    /* ...remember image information... */
+                    info->width   = SH7722_GETREG32( data, JIFDDHSZ );
+                    info->height  = SH7722_GETREG32( data, JIFDDVSZ );
+                    info->mode420 = (SH7722_GETREG32( data, JCMOD ) & 2) ? true : false;
+
+                    D_DEBUG_AT( SH7722_JPEG, "  -> %dx%d (4:2:%c)\n",
+                                info->width, info->height, info->mode420 ? '0' : '2' );
+
+                    break;
+               }
+          }
+          else {
+               D_DEBUG_AT( SH7722_JPEG, "  -> waiting...\n" );
+
+               /* ...otherwise wait for the arrival of new interrupt(s). */
+               if (ioctl( data->gfx_fd, SH7722GFX_IOCTL_WAIT_JPEG ) < 0) {
+                    D_PERROR( "SH7722/JPEG: Waiting for IRQ failed! (ints: 0x%x - JINTS 0x%x, JCSTS 0x%x)\n",
+                              ints, SH7722_GETREG32( data, JINTS ), SH7722_GETREG32( data, JCSTS ) );
+                    ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+                    return DR_FAILURE;
+               }
+          }
+     }
+
+     ioctl( data->gfx_fd, SH7722GFX_IOCTL_UNLOCK_JPEG );
+
+     if (info->width < 16 || info->width > 2560)
+          return DR_UNSUPPORTED;
+
+     if (info->height < 16 || info->height > 1920)
+          return DR_UNSUPPORTED;
+
+     return DR_OK;
+}
+#endif
+
+/**********************************************************************************************************************/
+
+static void write_rgb_span( u8 *src, void *dst, int len, DFBSurfacePixelFormat format )
+{
+     int i;
+
+     switch (format) {
+          case DSPF_RGB332:
+               for (i = 0; i < len; i++)
+                    ((u8*)dst)[i] = PIXEL_RGB332( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_ARGB1555:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_ARGB1555( 0xff, src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_ARGB2554:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_ARGB2554( 0xff, src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_ARGB4444:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_ARGB4444( 0xff, src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+               
+          case DSPF_RGB16:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_RGB16( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_RGB24:
+               direct_memcpy( dst, src, len*3 );
+               break;
+
+          case DSPF_RGB32:
+               for (i = 0; i < len; i++)
+                    ((u32*)dst)[i] = PIXEL_RGB32( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_ARGB:
+               for (i = 0; i < len; i++)
+                    ((u32*)dst)[i] = PIXEL_ARGB( 0xff, src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+               
+          case DSPF_AiRGB:
+               for (i = 0; i < len; i++)
+                    ((u32*)dst)[i] = PIXEL_AiRGB( 0xff, src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_RGB555:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_RGB555( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_BGR555:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_BGR555( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          case DSPF_RGB444:
+               for (i = 0; i < len; i++)
+                    ((u16*)dst)[i] = PIXEL_RGB444( src[i*3+0], src[i*3+1], src[i*3+2] );
+               break;
+
+          default:
+               D_ONCE( "unimplemented destination format (0x%08x)", format );
+               break;
+     }
+}
+
+static inline void
+copy_line_nv16( u16 *yy, u16 *cbcr, const u8 *src_ycbcr, int width )
+{
+     int x;
+
+     D_ASSUME( !(width & 1) );
+
+     for (x=0; x<width/2; x++) {
+#ifdef WORDS_BIGENDIAN
+          yy[x] = (src_ycbcr[0] << 8) | src_ycbcr[3];
+#else
+          yy[x] = (src_ycbcr[3] << 8) | src_ycbcr[0];
+#endif
+
+          cbcr[x] = (((src_ycbcr[2] + src_ycbcr[5]) << 7) & 0xff00) |
+                     ((src_ycbcr[1] + src_ycbcr[4]) >> 1);
+
+          src_ycbcr += 6;
+     }
+}
+
+static inline void
+copy_line_y( u16 *yy, const u8 *src_ycbcr, int width )
+{
+     int x;
+
+     D_ASSUME( !(width & 1) );
+
+     for (x=0; x<width/2; x++) {
+#ifdef WORDS_BIGENDIAN
+          yy[x] = (src_ycbcr[0] << 8) | src_ycbcr[3];
+#else
+          yy[x] = (src_ycbcr[3] << 8) | src_ycbcr[0];
+#endif
+
+          src_ycbcr += 6;
+     }
+}
+
+static DirectResult
+DecodeSW( SH7722_JPEG_context   *info,
+          const DFBRectangle    *rect,
+          const DFBRegion       *clip,
+          DFBSurfacePixelFormat  format,
+          void                  *addr,
+          int                    pitch,
+          unsigned int           width,
+          unsigned int           height )
+{
+     int cw, ch;
+     JSAMPARRAY buffer;      /* Output row buffer */
+     int row_stride;         /* physical row width in output buffer */
+     void *addr_uv = addr + height * pitch;
+
+     D_ASSERT( info != NULL );
+     DFB_RECTANGLE_ASSERT( rect );
+     DFB_REGION_ASSERT( clip );
+
+     cw = clip->x2 - clip->x1 + 1;
+     ch = clip->y2 - clip->y1 + 1;
+
+     if (cw < 1 || ch < 1)
+          return DR_INVAREA;
+
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p, %p|%d [%dx%d] %s )\n", __FUNCTION__,
+                 info, addr, pitch, info->width, info->height,
+                 dfb_pixelformat_name(format) );
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> %d,%d - %4dx%4d  [clip %d,%d - %4dx%4d]\n",
+                 DFB_RECTANGLE_VALS( rect ), DFB_RECTANGLE_VALS_FROM_REGION( clip ) );
+
+     /* No cropping or clipping yet :( */
+     if (clip->x1 != 0 || clip->y1 != 0 ||
+         clip->x2 != rect->w - 1 || clip->y2 != rect->h - 1 || rect->w != width || rect->h != height)
+     {
+          D_UNIMPLEMENTED();
+          return DR_UNIMPLEMENTED;
+     }
+
+     info->cinfo.output_components = 3;
+
+     /* Calculate destination base address. */
+     addr += DFB_BYTES_PER_LINE( format, rect->x ) + rect->y * pitch;
+
+     /* Not all formats yet :( */
+     switch (format) {
+          case DSPF_RGB332:
+          case DSPF_ARGB1555:
+          case DSPF_ARGB2554:
+          case DSPF_ARGB4444:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+          case DSPF_RGB444:
+               info->cinfo.out_color_space = JCS_RGB;
+               break;
+
+          case DSPF_NV12:
+               if (rect->x & 1)
+                    return DFB_INVARG;
+
+               if (rect->y & 1)
+                    return DFB_INVARG;
+
+               addr_uv += rect->x + rect->y / 2 * pitch;
+
+               info->cinfo.out_color_space = JCS_YCbCr;
+               break;
+                    
+          case DSPF_NV16:
+               if (rect->x & 1)
+                    return DFB_INVARG;
+
+               addr_uv += rect->x + rect->y * pitch;
+
+               info->cinfo.out_color_space = JCS_YCbCr;
+               break;
+
+          default:
+               D_UNIMPLEMENTED();
+               return DR_UNIMPLEMENTED;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> decoding...\n" );
+
+     jpeg_start_decompress( &info->cinfo );
+
+     row_stride = ((info->cinfo.output_width + 1) & ~1) * 3;
+
+     buffer = (*info->cinfo.mem->alloc_sarray)((j_common_ptr) &info->cinfo, JPOOL_IMAGE, row_stride, 1);
+
+     while (info->cinfo.output_scanline < info->cinfo.output_height) {
+          jpeg_read_scanlines( &info->cinfo, buffer, 1 );
+
+          switch (format) {
+               case DSPF_NV12:
+                    if (info->cinfo.output_scanline & 1) {
+                         copy_line_nv16( addr, addr_uv, *buffer, (rect->w + 1) & ~1 );
+                         addr_uv += pitch;
+                    }
+                    else
+                         copy_line_y( addr, *buffer, (rect->w + 1) & ~1 );
+                    break;
+
+               case DSPF_NV16:
+                    copy_line_nv16( addr, addr_uv, *buffer, (rect->w + 1) & ~1 );
+                    addr_uv += pitch;
+                    break;
+
+               default:
+                    write_rgb_span( *buffer, addr, rect->w, format );
+                    break;
+          }
+
+          addr += pitch;
+     }
+
+     jpeg_finish_decompress( &info->cinfo );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Initialize_GFX( SH7722_JPEG_data *data )
+{
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p )\n", __FUNCTION__, data );
+
+     /* Open the drawing engine device. */
+     data->gfx_fd = direct_try_open( "/dev/sh772x_gfx", "/dev/misc/sh772x_gfx", O_RDWR, true );
+     if (data->gfx_fd < 0)
+          return DR_INIT;
+
+     /* Map its shared data. */
+     data->gfx_shared = mmap( NULL, direct_page_align( sizeof(SH772xGfxSharedArea) ),
+                              PROT_READ | PROT_WRITE,
+                              MAP_SHARED, data->gfx_fd, 0 );
+     if (data->gfx_shared == MAP_FAILED) {
+          D_PERROR( "SH7722/GFX: Could not map shared area!\n" );
+          close( data->gfx_fd );
+          return DR_INIT;
+     }
+
+     D_DEBUG_AT( SH7722_JPEG, "  -> magic   0x%08x\n",  data->gfx_shared->magic );
+     D_DEBUG_AT( SH7722_JPEG, "  -> buffer  0x%08lx\n", data->gfx_shared->buffer_phys );
+     D_DEBUG_AT( SH7722_JPEG, "  -> jpeg    0x%08lx\n", data->gfx_shared->jpeg_phys );
+
+     /* Check the magic value. */
+     if (data->gfx_shared->magic != SH7722GFX_SHARED_MAGIC) {
+          D_ERROR( "SH7722/GFX: Magic value 0x%08x doesn't match 0x%08x!\n",
+                   data->gfx_shared->magic, SH7722GFX_SHARED_MAGIC );
+          munmap( (void*) data->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+          close( data->gfx_fd );
+          return DR_INIT;
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+Shutdown_GFX( SH7722_JPEG_data *data )
+{
+     munmap( (void*) data->gfx_shared, direct_page_align( sizeof(SH772xGfxSharedArea) ) );
+
+     close( data->gfx_fd );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Initialize_Mem( SH7722_JPEG_data *data,
+                unsigned long     phys )
+{
+     int fd;
+
+     D_DEBUG_AT( SH7722_JPEG, "%s( %p, 0x%08lx )\n", __FUNCTION__, data, phys );
+
+     fd = open( "/dev/mem", O_RDWR | O_SYNC );
+     if (fd < 0) {
+          D_PERROR( "SH7722/JPEG: Could not open /dev/mem!\n" );
+          return DR_INIT;
+     }
+
+     data->jpeg_virt = mmap( NULL, direct_page_align( SH7722GFX_JPEG_SIZE ),
+                             PROT_READ | PROT_WRITE, MAP_SHARED, fd, phys );
+     if (data->jpeg_virt == MAP_FAILED) {
+          D_PERROR( "SH7722/JPEG: Could not map /dev/mem at 0x%08lx (length %lu)!\n",
+                    phys, direct_page_align( SH7722GFX_JPEG_SIZE ) );
+          close( fd );
+          return DR_INIT;
+     }
+
+     data->jpeg_phys = phys;
+     data->jpeg_lb1  = data->jpeg_phys + SH7722GFX_JPEG_RELOAD_SIZE * 2;
+     data->jpeg_lb2  = data->jpeg_lb1  + SH7722GFX_JPEG_LINEBUFFER_SIZE;
+
+     close( fd );
+
+     return DR_OK;
+}
+
+static DirectResult
+Shutdown_Mem( SH7722_JPEG_data *data )
+{
+     munmap( (void*) data->jpeg_virt, direct_page_align( SH7722GFX_JPEG_SIZE ) );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+#define JPEG_PROG_BUF_SIZE    0x10000
+
+typedef struct {
+     struct jpeg_source_mgr  pub; /* public fields */
+
+     JOCTET                 *data;       /* start of buffer */
+
+     DirectStream           *stream;
+
+     int                     peekonly;
+     int                     peekoffset;
+} stream_source_mgr;
+
+typedef stream_source_mgr * stream_src_ptr;
+
+static void
+stream_init_source (j_decompress_ptr cinfo)
+{
+     stream_src_ptr src = (stream_src_ptr) cinfo->src;
+
+     direct_stream_seek( src->stream, 0 ); /* ignore return value */
+}
+
+static boolean
+stream_fill_input_buffer (j_decompress_ptr cinfo)
+{
+     DFBResult      ret;
+     unsigned int   nbytes = 0;
+     stream_src_ptr src    = (stream_src_ptr) cinfo->src;
+
+     struct timeval tv;
+
+     tv.tv_sec  = 0;
+     tv.tv_usec = 50000;
+
+     direct_stream_wait( src->stream, JPEG_PROG_BUF_SIZE, &tv );
+
+     if (src->peekonly) {
+          ret = direct_stream_peek( src->stream, JPEG_PROG_BUF_SIZE, src->peekoffset, src->data, &nbytes );
+          if (ret && ret != DFB_EOF)
+               D_DERROR( ret, "SH7722/JPEG: direct_stream_peek() failed!\n" );
+
+          src->peekoffset += MAX( nbytes, 0 );
+     }
+     else {
+          ret = direct_stream_read( src->stream, JPEG_PROG_BUF_SIZE, src->data, &nbytes );
+          if (ret && ret != DFB_EOF)
+               D_DERROR( ret, "SH7722/JPEG: direct_stream_read() failed!\n" );
+     }
+     
+     if (ret || nbytes <= 0) {
+          /* Insert a fake EOI marker */
+          src->data[0] = (JOCTET) 0xFF;
+          src->data[1] = (JOCTET) JPEG_EOI;
+          nbytes = 2;
+     }
+
+     src->pub.next_input_byte = src->data;
+     src->pub.bytes_in_buffer = nbytes;
+
+     return TRUE;
+}
+
+static void
+stream_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+{
+     stream_src_ptr src = (stream_src_ptr) cinfo->src;
+
+     if (num_bytes > 0) {
+          while (num_bytes > (long) src->pub.bytes_in_buffer) {
+               num_bytes -= (long) src->pub.bytes_in_buffer;
+               (void)stream_fill_input_buffer(cinfo);
+          }
+          src->pub.next_input_byte += (size_t) num_bytes;
+          src->pub.bytes_in_buffer -= (size_t) num_bytes;
+     }
+}
+
+static void
+stream_term_source (j_decompress_ptr cinfo)
+{
+}
+
+static void
+jpeg_stream_src (j_decompress_ptr cinfo, DirectStream *stream, int peekonly)
+{
+     stream_src_ptr src;
+
+     cinfo->src = (struct jpeg_source_mgr *)
+                  cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+                                           sizeof (stream_source_mgr));
+
+     src = (stream_src_ptr) cinfo->src;
+
+     src->data = (JOCTET *)
+                  cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+                                           JPEG_PROG_BUF_SIZE * sizeof (JOCTET));
+
+     src->stream = stream;
+     src->peekonly = peekonly;
+     src->peekoffset = 0;
+
+     src->pub.init_source       = stream_init_source;
+     src->pub.fill_input_buffer = stream_fill_input_buffer;
+     src->pub.skip_input_data   = stream_skip_input_data;
+     src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
+     src->pub.term_source       = stream_term_source;
+     src->pub.bytes_in_buffer   = 0; /* forces fill_input_buffer on first read */
+     src->pub.next_input_byte   = NULL; /* until buffer loaded */
+}
+
+struct my_error_mgr {
+     struct jpeg_error_mgr pub;     /* "public" fields */
+     jmp_buf  setjmp_buffer;          /* for return to caller */
+};
+
+static void
+jpeglib_panic(j_common_ptr cinfo)
+{
+     struct my_error_mgr *myerr = (struct my_error_mgr*) cinfo->err;
+     longjmp(myerr->setjmp_buffer, 1);
+}
+
+/**********************************************************************************************************************/
+
+static SH7722_JPEG_data data;
+
+DirectResult
+SH7722_JPEG_Initialize( void )
+{
+     DirectResult ret;
+
+     if (data.ref_count) {
+          data.ref_count++;
+          return DR_OK;
+     }
+
+     ret = Initialize_GFX( &data );
+     if (ret)
+          return ret;
+
+     ret = Initialize_Mem( &data, data.gfx_shared->jpeg_phys );
+     if (ret) {
+          Shutdown_GFX( &data );
+          return ret;
+     }
+
+     data.ref_count = 1;
+
+     return DR_OK;
+}
+
+DirectResult
+SH7722_JPEG_Shutdown( void )
+{
+     if (!data.ref_count)
+          return DR_DEAD;
+          
+     if (--data.ref_count)
+          return DR_OK;
+
+     Shutdown_Mem( &data );
+
+     Shutdown_GFX( &data );
+
+     return DR_OK;
+}
+
+DirectResult
+SH7722_JPEG_Open( DirectStream        *stream,
+                  SH7722_JPEG_context *context )
+{
+     struct my_error_mgr jerr;
+
+     if (!data.ref_count)
+          return DR_DEAD;
+
+     context->cinfo.err  = jpeg_std_error( &jerr.pub );
+     jerr.pub.error_exit = jpeglib_panic;
+
+     if (setjmp( jerr.setjmp_buffer )) {
+          D_ERROR( "SH7722/JPEG: Error while reading headers!\n" );
+
+          jpeg_destroy_decompress( &context->cinfo );
+          return DFB_FAILURE;
+     }
+
+     jpeg_create_decompress( &context->cinfo );
+     jpeg_stream_src( &context->cinfo, stream, 1 );
+     jpeg_read_header( &context->cinfo, TRUE );
+     jpeg_calc_output_dimensions( &context->cinfo );
+
+     context->stream = stream;
+     context->width  = context->cinfo.output_width;
+     context->height = context->cinfo.output_height;
+
+     context->mode420 = context->cinfo.comp_info[1].h_samp_factor == context->cinfo.comp_info[0].h_samp_factor / 2 &&
+                        context->cinfo.comp_info[1].v_samp_factor == context->cinfo.comp_info[0].v_samp_factor / 2 &&
+                        context->cinfo.comp_info[2].h_samp_factor == context->cinfo.comp_info[0].h_samp_factor / 2 &&
+                        context->cinfo.comp_info[2].v_samp_factor == context->cinfo.comp_info[0].v_samp_factor / 2;
+
+     context->mode444 = context->cinfo.comp_info[1].h_samp_factor == context->cinfo.comp_info[0].h_samp_factor &&
+                        context->cinfo.comp_info[1].v_samp_factor == context->cinfo.comp_info[0].v_samp_factor &&
+                        context->cinfo.comp_info[2].h_samp_factor == context->cinfo.comp_info[0].h_samp_factor &&
+                        context->cinfo.comp_info[2].v_samp_factor == context->cinfo.comp_info[0].v_samp_factor;
+
+     return DFB_OK;
+}
+
+DirectResult
+SH7722_JPEG_Decode( SH7722_JPEG_context   *context,
+                    const DFBRectangle    *rect,
+                    const DFBRegion       *clip,
+                    DFBSurfacePixelFormat  format,
+                    unsigned long          phys,
+                    void                  *addr,
+                    int                    pitch,
+                    unsigned int           width,
+                    unsigned int           height )
+{
+     DFBResult           ret = DFB_UNSUPPORTED;
+     DFBRectangle        _rect;
+     DFBRegion           _clip;
+     struct my_error_mgr jerr;
+     bool                sw_only = false;
+
+     if (!data.ref_count)
+          return DR_DEAD;
+
+     context->cinfo.err  = jpeg_std_error( &jerr.pub );
+     jerr.pub.error_exit = jpeglib_panic;
+
+     if (setjmp( jerr.setjmp_buffer )) {
+          D_ERROR( "SH7722/JPEG: Error while decoding image!\n" );
+          return DFB_FAILURE;
+     }
+
+     switch (format) {
+          case DSPF_NV12:
+          case DSPF_NV16:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_RGB24:
+               break;
+
+          case DSPF_RGB332:
+          case DSPF_ARGB1555:
+          case DSPF_ARGB2554:
+          case DSPF_ARGB4444:
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+          case DSPF_RGB444:
+               sw_only = true;
+               break;
+
+          default:
+               return DR_UNSUPPORTED;
+     }
+
+     if (!rect) {
+          _rect.x = 0;
+          _rect.y = 0;
+          _rect.w = width;
+          _rect.h = height;
+
+          rect = &_rect;
+     }
+
+     if (!clip) {
+          _clip.x1 = _rect.x;
+          _clip.y1 = _rect.y;
+          _clip.x2 = _rect.x + _rect.w - 1;
+          _clip.y2 = _rect.y + _rect.h - 1;
+
+          clip = &_clip;
+     }
+
+     if (!context->mode444 && !sw_only)
+          ret = DecodeHW( &data, context, rect, clip, format, phys, pitch, width, height );
+
+     if (ret) {
+          if (addr) {
+               ret = DecodeSW( context, rect, clip, format, addr, pitch, width, height );
+          }
+          else {
+               int fd, len = direct_page_align( DFB_PLANE_MULTIPLY( format, height ) * pitch );
+
+               fd = open( "/dev/mem", O_RDWR | O_SYNC );
+               if (fd < 0) {
+                    D_PERROR( "SH7722/JPEG: Could not open /dev/mem!\n" );
+                    return DR_INIT;
+               }
+
+               addr = mmap( NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, phys );
+               if (addr == MAP_FAILED) {
+                    D_PERROR( "SH7722/JPEG: Could not map /dev/mem at 0x%08lx (length %d)!\n", phys, len );
+                    close( fd );
+                    return DR_INIT;
+               }
+
+               ret = DecodeSW( context, rect, clip, format, addr, pitch, width, height );
+
+               munmap( addr, len );
+          }
+     }
+
+     return ret;
+}
+
+
+DirectResult
+SH7722_JPEG_Close( SH7722_JPEG_context *context )
+{
+     jpeg_destroy_decompress( &context->cinfo );
+
+     return DFB_OK;
+}
+
+DirectResult
+SH7722_JPEG_Encode( const char            *filename,
+                    const DFBRectangle    *srcrect,
+                    DFBSurfacePixelFormat  srcformat,
+                    unsigned long          srcphys,
+                    int                    srcpitch,
+                    unsigned int           width,
+                    unsigned int           height,
+                    unsigned int           tmpphys )
+{
+     DFBRectangle _rect;
+
+     if (!data.ref_count)
+          return DR_DEAD;
+
+     switch (srcformat) {
+          case DSPF_NV12:
+          case DSPF_NV16:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_RGB24:
+               break;
+
+          default:
+               return DR_UNSUPPORTED;
+     }
+
+     if (!srcrect) {
+          _rect.x = 0;
+          _rect.y = 0;
+          _rect.w = width;
+          _rect.h = height;
+
+          srcrect = &_rect;
+     }
+
+     return EncodeHW( &data, filename, srcrect, srcformat, srcphys, srcpitch, width, height, tmpphys );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.h
new file mode 100755
index 0000000..506a422
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpeglib.h
@@ -0,0 +1,47 @@
+#ifndef __SH7722__SH7722_JPEGLIB_H__
+#define __SH7722__SH7722_JPEGLIB_H__
+
+#include <jpeglib.h>
+
+typedef struct {
+     DirectStream                  *stream;
+
+     int                            width;
+     int                            height;
+     bool                           mode420;
+     bool                           mode444;
+
+     struct jpeg_decompress_struct  cinfo;
+} SH7722_JPEG_context;
+
+
+DirectResult SH7722_JPEG_Initialize( void );
+
+DirectResult SH7722_JPEG_Shutdown( void );
+
+DirectResult SH7722_JPEG_Open  ( DirectStream          *stream,
+                                 SH7722_JPEG_context   *context );
+
+DirectResult SH7722_JPEG_Decode( SH7722_JPEG_context   *context,
+                                 const DFBRectangle    *rect,
+                                 const DFBRegion       *clip,
+                                 DFBSurfacePixelFormat  format,
+                                 unsigned long          phys,
+                                 void                  *addr,
+                                 int                    pitch,
+                                 unsigned int           width,
+                                 unsigned int           height );
+
+DirectResult SH7722_JPEG_Close ( SH7722_JPEG_context   *context );
+
+DirectResult SH7722_JPEG_Encode( const char            *filename,
+                                 const DFBRectangle    *srcrect,
+                                 DFBSurfacePixelFormat  srcformat,
+                                 unsigned long          srcphys,
+                                 int                    srcpitch,
+                                 unsigned int           width,
+                                 unsigned int           height,
+                                 unsigned int           tmpphys );
+
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpegtool.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpegtool.c
new file mode 100755
index 0000000..5fd0fad
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_jpegtool.c
@@ -0,0 +1,142 @@
+#ifdef SH7722_DEBUG_JPEG
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#ifdef STANDALONE
+#include "sh7722_jpeglib_standalone.h"
+#else
+#include <config.h>
+
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/stream.h>
+#include <direct/util.h>
+
+#include <directfb.h>
+#endif
+
+#include "sh7722_jpeglib.h"
+
+
+void
+write_ppm( const char    *filename,
+           unsigned long  phys,
+           int            pitch,
+           unsigned int   width,
+           unsigned int   height )
+{
+     int   i;
+     int   fd;
+     int   size;
+     void *mem;
+     FILE *file;
+
+     size = direct_page_align( pitch * height );
+
+     fd = open( "/dev/mem", O_RDWR );
+     if (fd < 0) {
+          D_PERROR( "SH7722/JPEG: Could not open /dev/mem!\n" );
+          return;
+     }
+
+     mem = mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, phys );
+     if (mem == MAP_FAILED) {
+          D_PERROR( "SH7722/JPEG: Could not map /dev/mem at 0x%08lx (length %d)!\n", phys, size );
+          close( fd );
+          return;
+     }
+
+     close( fd );
+
+     file = fopen( filename, "wb" );
+     if (!file) {
+          D_PERROR( "SH7722/JPEG: Could not open '%s' for writing!\n", filename );
+          munmap( mem, size );
+          return;
+     }
+
+     fprintf( file, "P6\n%d %d\n255\n", width, height );
+
+     for (i=0; i<height; i++) {
+          fwrite( mem, 3, width, file );
+
+          mem += pitch;
+     }
+
+     fclose( file );
+
+     munmap( mem, size );
+}
+
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult           ret;
+     SH7722_JPEG_context    info;
+     DFBSurfacePixelFormat  format;
+     int                    pitch;
+     DirectStream          *stream = NULL;
+
+     if (argc != 2) {
+          fprintf( stderr, "Usage: %s <filename>\n", argv[0] );
+          return -1;
+     }
+
+#ifndef STANDALONE
+     direct_initialize();
+
+     direct_config->debug = true;
+#endif
+
+     ret = SH7722_JPEG_Initialize();
+     if (ret)
+          return ret;
+
+     ret = direct_stream_create( argv[1], &stream );
+     if (ret)
+          goto out;
+
+     ret = SH7722_JPEG_Open( stream, &info );
+     if (ret)
+          goto out;
+
+     D_INFO( "SH7722/JPEGTool: Opened %dx%d image (4:%s)\n", info.width, info.height,
+             info.mode420 ? "2:0" : info.mode444 ? "4:4" : "2:2?" );
+
+     format = DSPF_RGB24;// info.mode444 ? DSPF_NV16 : DSPF_NV12;
+     pitch  = (DFB_BYTES_PER_LINE( format, info.width ) + 31) & ~31;
+
+     ret = SH7722_JPEG_Decode( &info, NULL, NULL, format, 0x0f800000, NULL, pitch, info.width, info.height );
+     if (ret)
+          goto out;
+
+
+//  Use RGB24 format for this
+//     write_ppm( "test.ppm", 0x0f800000, pitch, info.width, info.height );
+
+     ret = SH7722_JPEG_Encode( "test.jpg", NULL, format, 0x0f800000, pitch, info.width, info.height, 0 );
+     if (ret)
+          goto out;
+
+
+out:
+     if (stream)
+          direct_stream_destroy( stream );
+
+     SH7722_JPEG_Shutdown();
+
+     return ret;
+}
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.c
new file mode 100755
index 0000000..8628ee8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.c
@@ -0,0 +1,529 @@
+#ifdef SH7722_DEBUG_LAYER
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <sys/mman.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include "sh7722.h"
+#include "sh7722_types.h"
+#include "sh7722_layer.h"
+#include "sh7722_lcd.h"
+
+
+D_DEBUG_DOMAIN( SH7722_Layer, "SH7722/Layer", "Renesas SH7722 Layers" );
+
+/**********************************************************************************************************************/
+
+static int
+sh7722LayerDataSize( void )
+{
+     return sizeof(SH7722LayerData);
+}
+
+static int
+sh7722RegionDataSize( void )
+{
+     return sizeof(SH7722RegionData);
+}
+
+static DFBResult
+sh7722InitLayer( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 DFBDisplayLayerDescription *description,
+                 DFBDisplayLayerConfig      *config,
+                 DFBColorAdjustment         *adjustment )
+{
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = sdrv->dev;
+     SH7722LayerData  *data = layer_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     /* initialize layer data */
+     data->layer = SH7722_LAYER_INPUT1 + sdrv->num_inputs++;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY |
+                         DLCAPS_SCREEN_POSITION | DLCAPS_SRC_COLORKEY;
+
+     description->type = DLTF_STILL_PICTURE | DLTF_GRAPHICS | DLTF_VIDEO;
+
+     /* set name */
+     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Input %d", sdrv->num_inputs );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+     config->width       = sdev->lcd_width;;
+     config->height      = sdev->lcd_height;
+     config->pixelformat = DSPF_RGB16;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_ALPHACHANNEL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722TestRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags *failed )
+{
+     SH7722DriverData           *sdrv = driver_data;
+     SH7722DeviceData           *sdev = sdrv->dev;
+     SH7722LayerData            *slay = layer_data;
+     CoreLayerRegionConfigFlags  fail = 0;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     if (config->options & ~SH7722_LAYER_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     switch (config->format) {
+          case DSPF_LUT8:
+               /* Indexed only for third input */
+               if (slay->layer != SH7722_LAYER_INPUT3)
+                    fail |= CLRCF_FORMAT;
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+          case DSPF_RGB24:
+          case DSPF_RGB16:
+               break;
+
+          case DSPF_NV12:
+          case DSPF_NV16:
+               /* YUV only for first input */
+               if (slay->layer != SH7722_LAYER_INPUT1)
+                    fail |= CLRCF_FORMAT;
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     if (config->width  < 32 || config->width  > sdev->lcd_width)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height < 32 || config->height > sdev->lcd_height)
+          fail |= CLRCF_HEIGHT;
+
+     if (config->dest.x >= sdev->lcd_width || config->dest.y >= sdev->lcd_height)
+          fail |= CLRCF_DEST;
+
+     if (config->dest.x < 0) {
+          config->dest.x = 0;
+// FIXME
+//          fail |= CLRCF_DEST;
+     }
+
+     if (config->dest.y < 0) {
+          config->dest.y = 0;
+// FIXME
+//          fail |= CLRCF_DEST;
+     }
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722AddRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreLayerRegionConfig *config )
+{
+     SH7722RegionData *sreg = region_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     sreg->config = *config;
+
+     D_MAGIC_SET( sreg, SH7722RegionData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722SetRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 void                       *region_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags  updated,
+                 CoreSurface                *surface,
+                 CorePalette                *palette,
+                 CoreSurfaceBufferLock      *lock )
+{
+     int               i, n;
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = sdrv->dev;
+     SH7722RegionData *sreg = region_data;
+     SH7722LayerData  *slay = layer_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( sreg, SH7722RegionData );
+
+     n = slay->layer - SH7722_LAYER_INPUT1;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 2 );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Wait for idle BEU. */
+     BEU_Wait( sdrv, sdev );
+
+     /* Update position? */
+     if (updated & CLRCF_DEST) {
+          /* Set horizontal and vertical offset. */
+          SH7722_SETREG32( sdrv, BLOCR(n), (config->dest.y << 16) | config->dest.x );
+     }
+
+     /* Update size? */
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT)) {
+          int cw = config->width;
+          int ch = config->height;
+
+          if (config->dest.x + cw > sdev->lcd_width)
+               cw = sdev->lcd_width - config->dest.x;
+
+          if (config->dest.y + ch > sdev->lcd_height)
+               ch = sdev->lcd_height - config->dest.y;
+
+          /* Set width and height. */
+          SH7722_SETREG32( sdrv, BSSZR(n), (ch << 16) | cw );
+          SH7722_SETREG32( sdrv, BTPSR, (ch << 16) | cw );
+     }
+
+     /* Update surface? */
+     if (updated & CLRCF_SURFACE) {
+          CoreSurfaceBuffer *buffer = lock->buffer;
+
+          /* Set buffer pitch. */
+          SH7722_SETREG32( sdrv, BSMWR(n), lock->pitch );
+
+          /* Set buffer offset (Y plane or RGB packed). */
+          SH7722_SETREG32( sdrv, BSAYR(n), lock->phys );
+
+          /* Set buffer offset (UV plane). */
+          if (DFB_PLANAR_PIXELFORMAT(buffer->format)) {
+               D_ASSUME( buffer->format == DSPF_NV12 || buffer->format == DSPF_NV16 );
+
+               SH7722_SETREG32( sdrv, BSACR(n), lock->phys + lock->pitch * surface->config.size.h );
+          }
+
+          sreg->surface = surface;
+     }
+
+     /* Update format? */
+     if (updated & CLRCF_FORMAT) {
+          unsigned long tBSIFR = 0;
+          unsigned long tBSWPR = BSWPR_MODSEL_EACH | (SH7722_GETREG32( sdrv, BSWPR ) & ~(7 << (n*8)));
+
+          /* Set pixel format. */
+          switch (config->format) {
+               case DSPF_NV12:
+                    tBSIFR |= CHRR_YCBCR_420 | BSIFR1_IN1TE_RGBYUV;
+                    break;
+
+               case DSPF_NV16:
+                    tBSIFR |= CHRR_YCBCR_422 | BSIFR1_IN1TE_RGBYUV;
+                    break;
+
+               case DSPF_ARGB:
+                    tBSIFR |= RPKF_ARGB;
+                    break;
+
+               case DSPF_RGB32:
+                    tBSIFR |= RPKF_RGB32;
+                    break;
+
+               case DSPF_RGB24:
+                    tBSIFR |= RPKF_RGB24;
+                    break;
+
+               case DSPF_RGB16:
+                    tBSIFR |= RPKF_RGB16;
+                    break;
+ 
+               case DSPF_LUT8:
+                    tBSIFR |= BSIFR3_MOD0_OSD | BSIFR3_MOD1_LUT;
+                    break;
+
+               default:
+                    break;
+          }
+
+#if 0
+          /* Set swapping. */
+          switch (config->format) {
+               case DSPF_LUT8:
+               case DSPF_NV12:
+               case DSPF_NV16:
+                    tBSWPR |= (BSWPR_INPUT_BYTESWAP |
+                               BSWPR_INPUT_WORDSWAP |
+                               BSWPR_INPUT_LONGSWAP) << (n*8);
+                    break;
+
+               case DSPF_RGB16:
+                    tBSWPR |= (BSWPR_INPUT_WORDSWAP |
+                               BSWPR_INPUT_LONGSWAP) << (n*8);
+                    break;
+
+               case DSPF_ARGB:
+               case DSPF_RGB32:
+               case DSPF_RGB24:
+                    tBSWPR |= (BSWPR_INPUT_LONGSWAP) << (n*8);
+                    break;
+
+               default:
+                    break;
+          }
+#endif
+
+          SH7722_SETREG32( sdrv, BSIFR(n), tBSIFR );
+          SH7722_SETREG32( sdrv, BSWPR, tBSWPR );
+     }
+
+     /* Update options or opacity? */
+     if (updated & (CLRCF_OPTIONS | CLRCF_OPACITY | CLRCF_FORMAT)) {
+          unsigned long tBBLCR0 = BBLCR0_LAY_123;
+
+          /* Set opacity value. */
+          tBBLCR0 &= ~(0xff << (n*8));
+          tBBLCR0 |= ((config->options & CLRCF_OPACITY) ? config->opacity : 0xff) << (n*8);
+
+          /* Enable/disable alpha channel. */
+          if ((config->options & DLOP_ALPHACHANNEL) && DFB_PIXELFORMAT_HAS_ALPHA(config->format))
+               tBBLCR0 |= BBLCR0_AMUX_BLENDPIXEL(n);
+          else
+               tBBLCR0 &= ~BBLCR0_AMUX_BLENDPIXEL(n);
+
+          SH7722_SETREG32( sdrv, BBLCR0, tBBLCR0 );
+     }
+
+     /* Update CLUT? */
+     if (updated & CLRCF_PALETTE && palette) {
+          const DFBColor *entries = palette->entries;
+
+          for (i=0; i<256; i++) {
+               SH7722_SETREG32( sdrv, BCLUT(i), PIXEL_ARGB( entries[i].a,
+                                                            entries[i].r,
+                                                            entries[i].g,
+                                                            entries[i].b ) );
+          }
+     }
+
+
+     /* Enable or disable input. */
+     if ((config->options & DLOP_OPACITY) && !config->opacity)
+          sdev->input_mask &= ~(1 << n);
+     else
+          sdev->input_mask |= (1 << n);
+
+     /* Choose parent input. */
+     if (sdev->input_mask) {
+          unsigned long tBBLCR1 = SH7722_GETREG32( sdrv, BBLCR1 ) & ~BBLCR1_PWD_INPUT_MASK;
+
+          if (sdev->input_mask & 4)
+               tBBLCR1 |= BBLCR1_PWD_INPUT3;
+          else if (sdev->input_mask & 2)
+               tBBLCR1 |= BBLCR1_PWD_INPUT2;
+          else
+               tBBLCR1 |= BBLCR1_PWD_INPUT1;
+
+          SH7722_SETREG32( sdrv, BBLCR1, tBBLCR1 );
+     }
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     sreg->config = *config;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722RemoveRegion( CoreLayer *layer,
+                    void      *driver_data,
+                    void      *layer_data,
+                    void      *region_data )
+{
+     int               n;
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = sdrv->dev;
+     SH7722LayerData  *slay = layer_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( sdev != NULL );
+     D_ASSERT( slay != NULL );
+
+     n = slay->layer - SH7722_LAYER_INPUT1;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 2 );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Wait for idle BEU. */
+     BEU_Wait( sdrv, sdev );
+
+     sdev->input_mask &= ~(1 << n);
+
+     /* Choose parent input. */
+     if (sdev->input_mask) {
+          unsigned long tBBLCR1 = SH7722_GETREG32( sdrv, BBLCR1 ) & ~BBLCR1_PWD_INPUT_MASK;
+
+          if (sdev->input_mask & 4)
+               tBBLCR1 |= BBLCR1_PWD_INPUT3;
+          else if (sdev->input_mask & 2)
+               tBBLCR1 |= BBLCR1_PWD_INPUT2;
+          else
+               tBBLCR1 |= BBLCR1_PWD_INPUT1;
+
+          SH7722_SETREG32( sdrv, BBLCR1, tBBLCR1 );
+     }
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722FlipRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreSurface           *surface,
+                  DFBSurfaceFlipFlags    flags,
+                  CoreSurfaceBufferLock *lock )
+{
+     int                n;
+     CoreSurfaceBuffer *buffer;
+     SH7722DriverData  *sdrv = driver_data;
+     SH7722DeviceData  *sdev = sdrv->dev;
+     SH7722LayerData   *slay = layer_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( sdrv != NULL );
+     D_ASSERT( sdev != NULL );
+     D_ASSERT( slay != NULL );
+
+     n = slay->layer - SH7722_LAYER_INPUT1;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 2 );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Set buffer offset (Y plane or RGB packed). */
+     SH7722_SETREG32( sdrv, BSAYR(n), lock->phys );
+
+     /* Set buffer offset (UV plane). */
+     if (DFB_PLANAR_PIXELFORMAT(buffer->format)) {
+          D_ASSUME( buffer->format == DSPF_NV12 || buffer->format == DSPF_NV16 );
+
+          SH7722_SETREG32( sdrv, BSACR(n), lock->phys + lock->pitch * surface->config.size.h );
+     }
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     /* Wait for idle BEU? */
+     if (flags & DSFLIP_WAIT)
+          BEU_Wait( sdrv, sdev );
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722UpdateRegion( CoreLayer             *layer,
+                    void                  *driver_data,
+                    void                  *layer_data,
+                    void                  *region_data,
+                    CoreSurface           *surface,
+                    const DFBRegion       *update,
+                    CoreSurfaceBufferLock *lock )
+{
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = sdrv->dev;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( sdrv != NULL );
+     D_ASSERT( sdev != NULL );
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     if (!(surface->config.caps & DSCAPS_FLIPPING))
+          BEU_Wait( sdrv, sdev );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs sh7722LayerFuncs = {
+     .LayerDataSize  = sh7722LayerDataSize,
+     .RegionDataSize = sh7722RegionDataSize,
+     .InitLayer      = sh7722InitLayer,
+
+     .TestRegion     = sh7722TestRegion,
+     .AddRegion      = sh7722AddRegion,
+     .SetRegion      = sh7722SetRegion,
+     .RemoveRegion   = sh7722RemoveRegion,
+     .FlipRegion     = sh7722FlipRegion,
+     .UpdateRegion   = sh7722UpdateRegion,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.h
new file mode 100755
index 0000000..b704214
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_layer.h
@@ -0,0 +1,11 @@
+#ifndef __SH7722__LAYER_H__
+#define __SH7722__LAYER_H__
+
+#include "sh7722_types.h"
+
+#define SH7722_LAYER_SUPPORTED_OPTIONS  (DLOP_ALPHACHANNEL | DLOP_OPACITY | DLOP_SRC_COLORKEY)
+
+extern DisplayLayerFuncs sh7722LayerFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.c
new file mode 100755
index 0000000..47df333
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.c
@@ -0,0 +1,172 @@
+#ifdef SH7722_DEBUG_LCD
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+
+#include <asm/types.h>
+
+#include <direct/debug.h>
+
+#include <misc/conf.h>
+
+#include "sh7722.h"
+
+
+D_DEBUG_DOMAIN( SH7722_LCD, "SH7722/LCD", "Renesas SH7722 LCD" );
+
+/**********************************************************************************************************************/
+
+void
+sh7722_lcd_setup( void                  *drv,
+                  int                    width,
+                  int                    height,
+                  ulong                  phys,
+                  int                    pitch,
+                  DFBSurfacePixelFormat  format,
+                  bool                   swap )
+{
+     u32 MLDDFR = 0;
+     u32 LDDDSR = 0;
+     u32 reg;
+
+     D_DEBUG_AT( SH7722_LCD, "%s( %dx%d @%lu:%d )\n", __FUNCTION__, width, height, phys, pitch );
+
+     D_ASSERT( width  > 7 );
+     D_ASSERT( height > 0 );
+
+     D_ASSERT( (phys & 7) == 0 );
+
+     D_ASSERT( pitch > 0 );
+     D_ASSERT( pitch < 0x10000 );
+     D_ASSERT( (pitch & 3) == 0 );
+
+     /* Choose input format. */
+     switch (format) {
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               MLDDFR = 0;
+               break;
+
+          case DSPF_RGB16:
+               MLDDFR = 3;
+               break;
+
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               MLDDFR = 8;
+               break;
+
+          case DSPF_RGB24:
+               MLDDFR = 11;
+               break;
+
+          case DSPF_NV12:
+               MLDDFR = 0x10000;
+               break;
+
+          case DSPF_NV16:
+               MLDDFR = 0x10100;
+               break;
+
+          default:
+               D_BUG( "invalid format" );
+               return;
+     }
+
+     /* Setup swapping. */
+     switch (format) {
+          case DSPF_NV12:     /* 1 byte */
+          case DSPF_NV16:
+          case DSPF_RGB24:
+               LDDDSR = 7;
+               break;
+
+          case DSPF_RGB16:    /* 2 byte */
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               LDDDSR = 6;
+               break;
+
+          case DSPF_RGB32:    /* 4 byte */
+          case DSPF_ARGB:
+               LDDDSR = 4;
+               break;
+
+          default:
+               D_BUG( "invalid format" );
+               return;
+     }
+
+     /* software reset of the LCD device */
+     reg = SH7722_GETREG32( drv, LCDC_LDCNT2R );
+     SH7722_SETREG32( drv, LCDC_LDCNT2R, reg | 0x100 );
+     while( SH7722_GETREG32( drv, LCDC_LDCNT2R ) & 0x100 );
+
+     /* stop the LCD while configuring */
+     SH7722_SETREG32( drv, LCDC_LDCNT2R,   0 );
+     SH7722_SETREG32( drv, LCDC_LDDCKSTPR, 1 );
+
+     SH7722_SETREG32( drv, LCDC_MLDDCKPAT1R,  0x05555555 );
+     SH7722_SETREG32( drv, LCDC_MLDDCKPAT2R,  0x55555555 );
+     SH7722_SETREG32( drv, LCDC_LDDCKR,       0x0000003c );
+     SH7722_SETREG32( drv, LCDC_MLDMT2R,      0x00000000 );
+     SH7722_SETREG32( drv, LCDC_MLDMT3R,      0x00000000 );
+     SH7722_SETREG32( drv, LCDC_MLDDFR,       MLDDFR );
+     SH7722_SETREG32( drv, LCDC_MLDSM1R,      0x00000000 );
+     SH7722_SETREG32( drv, LCDC_MLDSM2R,      0x00000000 );
+     SH7722_SETREG32( drv, LCDC_MLDSA1R,      phys );
+     SH7722_SETREG32( drv, LCDC_MLDSA2R,      DFB_PLANAR_PIXELFORMAT( format ) ? (phys + pitch * height) : 0 );
+     SH7722_SETREG32( drv, LCDC_MLDMLSR,      pitch );
+     SH7722_SETREG32( drv, LCDC_MLDWBCNTR,    0x00000000 );
+     SH7722_SETREG32( drv, LCDC_MLDWBAR,      0x00000000 );
+#if 0
+     SH7722_SETREG32( drv, LCDC_MLDMT1R,      0x18000006 );
+     SH7722_SETREG32( drv, LCDC_MLDHCNR,      ((width / 8) << 16) | (1056 / 8) );
+     SH7722_SETREG32( drv, LCDC_MLDHSYNR,     ((128 / 8) << 16) | (840 / 8) );
+     SH7722_SETREG32( drv, LCDC_MLDVLNR,      (height << 16) | 525 );
+     SH7722_SETREG32( drv, LCDC_MLDVSYNR,     (2 << 16) | 490 );
+     SH7722_SETREG32( drv, LCDC_MLDPMR,       0xf6000f00 );
+#elif 0
+     SH7722_SETREG32( drv, LCDC_MLDMT1R,      0x1c00000a );
+     SH7722_SETREG32( drv, LCDC_MLDHCNR,      0x00500060);
+     SH7722_SETREG32( drv, LCDC_MLDHSYNR,     0x00010052);
+     SH7722_SETREG32( drv, LCDC_MLDVLNR,      0x01e00200);
+     SH7722_SETREG32( drv, LCDC_MLDVSYNR,     0x000301f0);
+     SH7722_SETREG32( drv, LCDC_MLDPMR,       0x00000000 );	//igel
+#elif defined(SH7722_ALGO_PANEL)
+     SH7722_SETREG32( drv, LCDC_MLDMT1R,      0x1c00000a );
+     SH7722_SETREG32( drv, LCDC_MLDHCNR,      0x00500060);
+     SH7722_SETREG32( drv, LCDC_MLDHSYNR,     0x00010052);
+     SH7722_SETREG32( drv, LCDC_MLDVLNR,      0x01e0020e);
+     SH7722_SETREG32( drv, LCDC_MLDVSYNR,     0x000301f0);
+     SH7722_SETREG32( drv, LCDC_MLDPMR,       0x00000000 );	//igel
+#elif defined(ALGO_AP325)
+     SH7722_SETREG32( drv, LCDC_MLDMT1R,      0x1800000a );
+     SH7722_SETREG32( drv, LCDC_MLDHCNR,      ((width / 8) << 16) | (1000 / 8) );
+     SH7722_SETREG32( drv, LCDC_MLDHSYNR,     ((8 / 8) << 16) | (960 / 8) );
+     SH7722_SETREG32( drv, LCDC_MLDVLNR,      (height << 16) | 624 );
+     SH7722_SETREG32( drv, LCDC_MLDVSYNR,     (1 << 16) | 560 );
+     SH7722_SETREG32( drv, LCDC_MLDPMR,       0x00000000 );
+#endif
+     SH7722_SETREG32( drv, LCDC_LDINTR,       0x00000000 );
+     SH7722_SETREG32( drv, LCDC_LDRCNTR,      0x00000000 );
+     SH7722_SETREG32( drv, LCDC_LDDDSR,       swap ? LDDDSR : 0 );
+     SH7722_SETREG32( drv, LCDC_LDRCR,        0x00000000 );
+     SH7722_SETREG32( drv, LCDC_LDPALCR,      0x00000000 );
+     
+     /* enable and start displaying */
+     SH7722_SETREG32( drv, LCDC_LDCNT1R,      0x00000001 );
+     SH7722_SETREG32( drv, LCDC_LDCNT2R,      0x00000003 );
+     SH7722_SETREG32( drv, LCDC_LDDCKSTPR, 0 );
+     while( SH7722_GETREG32( drv, LCDC_LDDCKSTPR ) & 0x10000 );
+     
+     /* finally, turn the display on */
+     {
+          SH7722DriverData *sdrv = drv;
+          if (ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_POWER_DISPLAY ) < 0)
+               D_PERROR( "SH772xGFX_IOCTL_POWER_DISPLAY\n" );
+     }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.h
new file mode 100755
index 0000000..4e0a12d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_lcd.h
@@ -0,0 +1,17 @@
+#ifndef __SH7722__LCD_H__
+#define __SH7722__LCD_H__
+
+#include "sh7722_types.h"
+
+
+void sh7722_lcd_setup( void                  *drv,
+                       int                    width,
+                       int                    height,
+                       ulong                  phys,
+                       int                    pitch,
+                       DFBSurfacePixelFormat  format,
+                       bool                   swap );
+
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.c
new file mode 100755
index 0000000..d15871d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.c
@@ -0,0 +1,412 @@
+#ifdef SH7722_DEBUG_LAYER
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <sys/mman.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include "sh7722.h"
+#include "sh7722_types.h"
+#include "sh7722_multi.h"
+
+
+D_DEBUG_DOMAIN( SH7722_Layer, "SH7722/Layer", "Renesas SH7722 Layers" );
+
+/**********************************************************************************************************************/
+
+static int
+sh7722LayerDataSize( void )
+{
+     return sizeof(SH7722MultiLayerData);
+}
+
+static int
+sh7722RegionDataSize( void )
+{
+     return sizeof(SH7722MultiRegionData);
+}
+
+static DFBResult
+sh7722InitLayer( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 DFBDisplayLayerDescription *description,
+                 DFBDisplayLayerConfig      *config,
+                 DFBColorAdjustment         *adjustment )
+{
+	 SH7722DriverData *sdrv = driver_data;
+	 SH7722DeviceData *sdev = sdrv->dev;
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     /* set capabilities and type */
+     description->caps    = DLCAPS_SURFACE | DLCAPS_SCREEN_POSITION | DLCAPS_SRC_COLORKEY | DLCAPS_WINDOWS;
+     description->type    = DLTF_GRAPHICS;
+     description->regions = 4;
+
+     /* set name */
+     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Multi Window" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+     config->width       = sdev->lcd_width;
+     config->height      = sdev->lcd_height;
+     config->pixelformat = DSPF_NV16;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->options     = DLOP_NONE;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722TestRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     if (config->options & ~SH7722_MULTI_SUPPORTED_OPTIONS)
+          fail |= CLRCF_OPTIONS;
+
+     switch (config->format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+          case DSPF_RGB24:
+          case DSPF_RGB16:
+               break;
+
+#if FIXME_MAKE_CONFIGURABLE_
+          case DSPF_NV12:
+          case DSPF_NV16:
+               break;
+#endif
+
+          default:
+               fail |= CLRCF_FORMAT;
+     }
+
+     if (config->width  < 32 || config->width  > 1280)
+          fail |= CLRCF_WIDTH;
+
+     if (config->height < 32 || config->height > 1024)
+          fail |= CLRCF_HEIGHT;
+
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722AddRegion( CoreLayer             *layer,
+                 void                  *driver_data,
+                 void                  *layer_data,
+                 void                  *region_data,
+                 CoreLayerRegionConfig *config )
+{
+     int                    n;
+     SH7722MultiRegionData *sreg = region_data;
+     SH7722MultiLayerData  *slay = layer_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     if (slay->added == 0xF)
+          return DFB_LIMITEXCEEDED;
+
+     for (n=0; n<4; n++)
+          if (! (slay->added & (1 << n)))
+               break;
+
+     D_ASSERT( n < 4 );
+
+     sreg->config = *config;
+
+
+     slay->added |= 1 << n;
+
+     D_MAGIC_SET( sreg, SH7722MultiRegionData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722SetRegion( CoreLayer                  *layer,
+                 void                       *driver_data,
+                 void                       *layer_data,
+                 void                       *region_data,
+                 CoreLayerRegionConfig      *config,
+                 CoreLayerRegionConfigFlags  updated,
+                 CoreSurface                *surface,
+                 CorePalette                *palette,
+                 CoreSurfaceBufferLock      *lock )
+{
+     int                    n;
+     SH7722DriverData      *sdrv = driver_data;
+     SH7722DeviceData      *sdev = sdrv->dev;
+     SH7722MultiRegionData *sreg = region_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( sreg, SH7722MultiRegionData );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Wait for idle BEU. */
+     BEU_Wait( sdrv, sdev );
+
+     n = sreg->index;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 3 );
+
+     /* Update position? */
+     if (updated & CLRCF_DEST) {
+          /* Set horizontal and vertical offset. */
+          SH7722_SETREG32( sdrv, BMLOCR(n), (config->dest.y << 16) | config->dest.x );
+     }
+
+     /* Update size? */
+     if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT)) {
+          /* Set width and height. */
+          SH7722_SETREG32( sdrv, BMSSZR(n), (config->height << 16) | config->width );
+     }
+
+     /* Update surface? */
+     if (updated & CLRCF_SURFACE) {
+          CoreSurfaceBuffer *buffer;
+
+          D_ASSERT( surface != NULL );
+
+          buffer = lock->buffer;
+
+          D_ASSERT( buffer != NULL );
+
+          /* Set buffer pitch. */
+          SH7722_SETREG32( sdrv, BMSMWR(n), lock->pitch );
+
+          /* Set buffer offset (Y plane or RGB packed). */
+          SH7722_SETREG32( sdrv, BMSAYR(n), lock->phys );
+
+          /* Set buffer offset (UV plane). */
+          if (DFB_PLANAR_PIXELFORMAT(buffer->format)) {
+               D_ASSUME( buffer->format == DSPF_NV12 || buffer->format == DSPF_NV16 );
+
+               SH7722_SETREG32( sdrv, BMSACR(n), lock->phys + lock->pitch * surface->config.size.h );
+          }
+     }
+
+     /* Update format? */
+     if (updated & CLRCF_FORMAT) {
+          unsigned long tBMSIFR = 0;
+
+          /* Set pixel format. */
+          switch (config->format) {
+               case DSPF_NV12:
+                    tBMSIFR |= CHRR_YCBCR_420;
+                    break;
+
+               case DSPF_NV16:
+                    tBMSIFR |= CHRR_YCBCR_422;
+                    break;
+
+               case DSPF_ARGB:
+                    tBMSIFR |= RPKF_ARGB;
+                    break;
+
+               case DSPF_RGB32:
+                    tBMSIFR |= RPKF_RGB32;
+                    break;
+
+               case DSPF_RGB24:
+                    tBMSIFR |= RPKF_RGB24;
+                    break;
+
+               case DSPF_RGB16:
+                    tBMSIFR |= RPKF_RGB16;
+                    break;
+
+               default:
+                    break;
+          }
+
+          /* FIXME: all regions need to have the same format! */
+          SH7722_SETREG32( sdrv, BMSIFR, tBMSIFR );
+     }
+
+     SH7722_SETREG32( sdrv, BMWCR0, SH7722_GETREG32( sdrv, BMWCR0 ) | (1 << n) );
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722RemoveRegion( CoreLayer             *layer,
+                    void                  *driver_data,
+                    void                  *layer_data,
+                    void                  *region_data )
+{
+     int                    n;
+     SH7722DriverData      *sdrv = driver_data;
+     SH7722DeviceData      *sdev = sdrv->dev;
+     SH7722MultiRegionData *sreg = region_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( sreg, SH7722MultiRegionData );
+
+     n = sreg->index;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 3 );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Wait for idle BEU. */
+     BEU_Wait( sdrv, sdev );
+
+     /* Disable multi window. */
+     SH7722_SETREG32( sdrv, BMWCR0, SH7722_GETREG32( sdrv, BMWCR0 ) & ~(1 << n) );
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722FlipRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreSurface           *surface,
+                  DFBSurfaceFlipFlags    flags,
+                  CoreSurfaceBufferLock *lock )
+{
+     int                    n;
+     CoreSurfaceBuffer     *buffer;
+     SH7722DriverData      *sdrv = driver_data;
+     SH7722DeviceData      *sdev = sdrv->dev;
+     SH7722MultiRegionData *sreg = region_data;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( sdrv != NULL );
+     D_ASSERT( sdev != NULL );
+     D_MAGIC_ASSERT( sreg, SH7722MultiRegionData );
+
+     n = sreg->index;
+
+     D_ASSERT( n >= 0 );
+     D_ASSERT( n <= 3 );
+
+     buffer = lock->buffer;
+     D_ASSERT( buffer != NULL );
+
+     fusion_skirmish_prevail( &sdev->beu_lock );
+
+     /* Wait for idle BEU. */
+     BEU_Wait( sdrv, sdev );
+
+     /* Set buffer pitch. */
+     SH7722_SETREG32( sdrv, BMSMWR(n), lock->pitch );
+
+     /* Set buffer offset (Y plane or RGB packed). */
+     SH7722_SETREG32( sdrv, BMSAYR(n), lock->phys );
+
+     /* Set buffer offset (UV plane). */
+     if (DFB_PLANAR_PIXELFORMAT(buffer->format)) {
+          D_ASSUME( buffer->format == DSPF_NV12 || buffer->format == DSPF_NV16 );
+
+          SH7722_SETREG32( sdrv, BMSACR(n), lock->phys + lock->pitch * surface->config.size.h );
+     }
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     fusion_skirmish_dismiss( &sdev->beu_lock );
+
+     /* Wait for idle BEU? */
+     if (flags & DSFLIP_WAIT)
+          BEU_Wait( sdrv, sdev );
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722UpdateRegion( CoreLayer             *layer,
+                    void                  *driver_data,
+                    void                  *layer_data,
+                    void                  *region_data,
+                    CoreSurface           *surface,
+                    const DFBRegion       *update,
+                    CoreSurfaceBufferLock *lock )
+{
+     SH7722DriverData *sdrv = driver_data;
+     SH7722DeviceData *sdev = sdrv->dev;
+
+     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( surface != NULL );
+     D_ASSERT( sdrv != NULL );
+     D_ASSERT( sdev != NULL );
+
+     /* Start operation! */
+     BEU_Start( sdrv, sdev );
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs sh7722MultiLayerFuncs = {
+     .LayerDataSize  = sh7722LayerDataSize,
+     .RegionDataSize = sh7722RegionDataSize,
+     .InitLayer      = sh7722InitLayer,
+
+     .TestRegion     = sh7722TestRegion,
+     .AddRegion      = sh7722AddRegion,
+     .SetRegion      = sh7722SetRegion,
+     .RemoveRegion   = sh7722RemoveRegion,
+     .FlipRegion     = sh7722FlipRegion,
+     .UpdateRegion   = sh7722UpdateRegion,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.h
new file mode 100755
index 0000000..1a8008e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_multi.h
@@ -0,0 +1,11 @@
+#ifndef __SH7722__MULTI_H__
+#define __SH7722__MULTI_H__
+
+#include "sh7722_types.h"
+
+#define SH7722_MULTI_SUPPORTED_OPTIONS  (DLOP_SRC_COLORKEY)
+
+extern DisplayLayerFuncs sh7722MultiLayerFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_regs.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_regs.h
new file mode 100755
index 0000000..c0ef019
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_regs.h
@@ -0,0 +1,624 @@
+#ifndef __SH7722__SH7722_REGS_H__
+#define __SH7722__SH7722_REGS_H__
+
+
+/******************************************************************************
+ * Register access
+ */
+
+#define VEU_REG_BASE     0xFE920000
+#define SH7722_BEU_BASE  0xFE930000
+#define LCDC_REG_BASE    0xFE940000
+#define JPEG_REG_BASE    0xFEA00000
+
+
+/******************************************************************************
+ * BEU
+ */
+
+/* BEU start register */
+#define BESTR       (SH7722_BEU_BASE + 0x0000)
+
+/* BEU source memory width register 1 */
+#define BSMWR1      (SH7722_BEU_BASE + 0x0010)
+
+/* BEU source size register 1 */
+#define BSSZR1      (SH7722_BEU_BASE + 0x0014)
+
+/* BEU source address Y register 1 */
+#define BSAYR1      (SH7722_BEU_BASE + 0x0018)
+
+/* BEU source address C register 1 */
+#define BSACR1      (SH7722_BEU_BASE + 0x001C)
+
+/* BEU source address A register 1 */
+#define BSAAR1      (SH7722_BEU_BASE + 0x0020)
+
+/* BEU source image format register 1 */
+#define BSIFR1      (SH7722_BEU_BASE + 0x0024)
+
+/* BEU source memory width register 2 */
+#define BSMWR2      (SH7722_BEU_BASE + 0x0028)
+
+/* BEU source size register 2 */
+#define BSSZR2      (SH7722_BEU_BASE + 0x002C)
+
+/* BEU source address Y register 2 */
+#define BSAYR2      (SH7722_BEU_BASE + 0x0030)
+
+/* BEU source address C register 2 */
+#define BSACR2      (SH7722_BEU_BASE + 0x0034)
+
+/* BEU source address A register 2 */
+#define BSAAR2      (SH7722_BEU_BASE + 0x0038)
+
+/* BEU source image format register 2 */
+#define BSIFR2      (SH7722_BEU_BASE + 0x003C)
+
+/* BEU source memory width register 3 */
+#define BSMWR3      (SH7722_BEU_BASE + 0x0040)
+
+/* BEU source size register 3 */
+#define BSSZR3      (SH7722_BEU_BASE + 0x0044)
+
+/* BEU source address Y register 3 */
+#define BSAYR3      (SH7722_BEU_BASE + 0x0048)
+
+/* BEU source address C register 3 */
+#define BSACR3      (SH7722_BEU_BASE + 0x004C)
+
+/* BEU source address A register 3 */
+#define BSAAR3      (SH7722_BEU_BASE + 0x0050)
+
+/* BEU source image format register 3 */
+#define BSIFR3      (SH7722_BEU_BASE + 0x0054)
+
+/* BEU tile pattern size register */
+#define BTPSR       (SH7722_BEU_BASE + 0x0058)
+
+/* BEU multidisplay source memory width register 1 */
+#define BMSMWR1     (SH7722_BEU_BASE + 0x0070)
+
+/* BEU multidisplay source size register 1 */
+#define BMSSZR1     (SH7722_BEU_BASE + 0x0074)
+
+/* BEU multidisplay source address Y register 1 */
+#define BMSAYR1     (SH7722_BEU_BASE + 0x0078)
+
+/* BEU multidisplay source address C register 1 */
+#define BMSACR1     (SH7722_BEU_BASE + 0x007C)
+
+/* BEU multidisplay source memory width register 2 */
+#define BMSMWR2     (SH7722_BEU_BASE + 0x0080)
+
+/* BEU multidisplay source size register 2 */
+#define BMSSZR2     (SH7722_BEU_BASE + 0x0084)
+
+/* BEU multidisplay source address Y register 2 */
+#define BMSAYR2     (SH7722_BEU_BASE + 0x0088)
+
+/* BEU multidisplay source address C register 2 */
+#define BMSACR2     (SH7722_BEU_BASE + 0x008C)
+
+/* BEU multidisplay source memory width register 3 */
+#define BMSMWR3     (SH7722_BEU_BASE + 0x0090)
+
+/* BEU multidisplay source size register 3 */
+#define BMSSZR3     (SH7722_BEU_BASE + 0x0094)
+
+/* BEU multidisplay source address Y register 3 */
+#define BMSAYR3     (SH7722_BEU_BASE + 0x0098)
+
+/* BEU multidisplay source address C register 3 */
+#define BMSACR3     (SH7722_BEU_BASE + 0x009C)
+
+/* BEU multidisplay source memory width register 4 */
+#define BMSMWR4     (SH7722_BEU_BASE + 0x00A0)
+
+/* BEU multidisplay source size register 4 */
+#define BMSSZR4     (SH7722_BEU_BASE + 0x00A4)
+
+/* BEU multidisplay source address Y register 4 */
+#define BMSAYR4     (SH7722_BEU_BASE + 0x00A8)
+
+/* BEU multidisplay source address C register 4 */
+#define BMSACR4     (SH7722_BEU_BASE + 0x00AC)
+
+/* BEU multidisplay source image format register */
+#define BMSIFR      (SH7722_BEU_BASE + 0x00F0)
+
+/* BEU blend control register 0 */
+#define BBLCR0      (SH7722_BEU_BASE + 0x0100)
+
+/* BEU blend control register 1 */
+#define BBLCR1      (SH7722_BEU_BASE + 0x0104)
+
+/* BEU process control register */
+#define BPROCR      (SH7722_BEU_BASE + 0x0108)
+
+/* BEU multiwindow control register 0 */
+#define BMWCR0      (SH7722_BEU_BASE + 0x010C)
+
+/* Blend location register 1 */
+#define BLOCR1      (SH7722_BEU_BASE + 0x0114)
+
+/* Blend location register 2 */
+#define BLOCR2      (SH7722_BEU_BASE + 0x0118)
+
+/* Blend location register 3 */
+#define BLOCR3      (SH7722_BEU_BASE + 0x011C)
+
+/* BEU multidisplay location register 1 */
+#define BMLOCR1     (SH7722_BEU_BASE + 0x0120)
+
+/* BEU multidisplay location register 2 */
+#define BMLOCR2     (SH7722_BEU_BASE + 0x0124)
+
+/* BEU multidisplay location register 3 */
+#define BMLOCR3     (SH7722_BEU_BASE + 0x0128)
+
+/* BEU multidisplay location register 4 */
+#define BMLOCR4     (SH7722_BEU_BASE + 0x012C)
+
+/* BEU multidisplay transparent color control register 1 */
+#define BMPCCR1     (SH7722_BEU_BASE + 0x0130)
+
+/* BEU multidisplay transparent color control register 2 */
+#define BMPCCR2     (SH7722_BEU_BASE + 0x0134)
+
+/* Blend pack form register */
+#define BPKFR       (SH7722_BEU_BASE + 0x0140)
+
+/* BEU transparent color control register 0 */
+#define BPCCR0      (SH7722_BEU_BASE + 0x0144)
+
+/* BEU transparent color control register 11 */
+#define BPCCR11     (SH7722_BEU_BASE + 0x0148)
+
+/* BEU transparent color control register 12 */
+#define BPCCR12     (SH7722_BEU_BASE + 0x014C)
+
+/* BEU transparent color control register 21 */
+#define BPCCR21     (SH7722_BEU_BASE + 0x0150)
+
+/* BEU transparent color control register 22 */
+#define BPCCR22     (SH7722_BEU_BASE + 0x0154)
+
+/* BEU transparent color control register 31 */
+#define BPCCR31     (SH7722_BEU_BASE + 0x0158)
+
+/* BEU transparent color control register 32 */
+#define BPCCR32     (SH7722_BEU_BASE + 0x015C)
+
+/* BEU destination memory width register */
+#define BDMWR       (SH7722_BEU_BASE + 0x0160)
+
+/* BEU destination address Y register */
+#define BDAYR       (SH7722_BEU_BASE + 0x0164)
+
+/* BEU destination address C register */
+#define BDACR       (SH7722_BEU_BASE + 0x0168)
+
+/* BEU address fixed register */
+#define BAFXR       (SH7722_BEU_BASE + 0x0180)
+
+/* BEU swapping register */
+#define BSWPR       (SH7722_BEU_BASE + 0x0184)
+
+/* BEU event interrupt enable register */
+#define BEIER       (SH7722_BEU_BASE + 0x0188)
+
+/* BEU event register */
+#define BEVTR       (SH7722_BEU_BASE + 0x018C)
+
+/* BEU register control register */
+#define BRCNTR      (SH7722_BEU_BASE + 0x0194)
+
+/* BEU status register */
+#define BSTAR       (SH7722_BEU_BASE + 0x0198)
+
+/* BEU module reset register */
+#define BBRSTR      (SH7722_BEU_BASE + 0x019C)
+
+/* BEU register-plane forcible setting register */
+#define BRCHR       (SH7722_BEU_BASE + 0x01A0)
+
+
+/* Color Lookup Table - CLUT registers (0-255) */
+#define BCLUT(n)    (SH7722_BEU_BASE + 0x3000 + (n) * 0x04)
+
+
+
+/* BEU source memory width registers (0-2) */
+#define BSMWR(n)    (SH7722_BEU_BASE + 0x0010 + (n) * 0x18)
+
+/* BEU source size registers (0-2) */
+#define BSSZR(n)    (SH7722_BEU_BASE + 0x0014 + (n) * 0x18)
+
+/* BEU source address Y registers (0-2) */
+#define BSAYR(n)    (SH7722_BEU_BASE + 0x0018 + (n) * 0x18)
+
+/* BEU source address C registers (0-2) */
+#define BSACR(n)    (SH7722_BEU_BASE + 0x001C + (n) * 0x18)
+
+/* BEU source address A registers (0-2) */
+#define BSAAR(n)    (SH7722_BEU_BASE + 0x0020 + (n) * 0x18)
+
+/* BEU source image format registers (0-2) */
+#define BSIFR(n)    (SH7722_BEU_BASE + 0x0024 + (n) * 0x18)
+
+
+
+/* BEU multidisplay source memory width registers (0-3) */
+#define BMSMWR(n)   (SH7722_BEU_BASE + 0x0070 + (n) * 0x10)
+
+/* BEU multidisplay source size registers (0-3) */
+#define BMSSZR(n)   (SH7722_BEU_BASE + 0x0074 + (n) * 0x10)
+
+/* BEU multidisplay source address Y registers (0-3) */
+#define BMSAYR(n)   (SH7722_BEU_BASE + 0x0078 + (n) * 0x10)
+
+/* BEU multidisplay source address C registers (0-3) */
+#define BMSACR(n)   (SH7722_BEU_BASE + 0x007C + (n) * 0x10)
+
+
+
+/* Blend location registers (0-2) */
+#define BLOCR(n)    (SH7722_BEU_BASE + 0x0114 + (n) * 0x04)
+
+/* BEU multidisplay location registers (0-3) */
+#define BMLOCR(n)   (SH7722_BEU_BASE + 0x0120 + (n) * 0x04)
+
+
+/* BSIFR1-3 */
+#define CHRR_YCBCR_444   0x000
+#define CHRR_YCBCR_422   0x100
+#define CHRR_YCBCR_420   0x200
+#define CHRR_aYCBCR_444  0x300
+#define CHRR_aYCBCR_422  0x400
+#define CHRR_aYCBCR_420  0x500
+
+#define RPKF_ARGB        0x000
+#define RPKF_RGB32       0x000
+#define RPKF_RGB24       0x002
+#define RPKF_RGB16       0x003
+
+/* BSIFR1 */
+#define BSIFR1_IN1TE_RGBYUV   0x1000
+
+/* BSIFR3 */
+#define BSIFR3_MOD0_OSD       0x1000
+#define BSIFR3_MOD1_LUT       0x2000
+
+/* BPKFR */
+#define WPCK_RGB12            2
+#define WPCK_RGB16            6
+#define WPCK_RGB18            17
+#define WPCK_RGB32            19
+#define WPCK_RGB24            21
+
+#define CHDS_YCBCR444         0x000
+#define CHDS_YCBCR422         0x100
+#define CHDS_YCBCR420         0x200
+
+#define BPKFR_RY_YUV          0x000
+#define BPKFR_RY_RGB          0x800
+#define BPKFR_TE_DISABLED     0x000
+#define BPKFR_TE_ENABLED      0x400
+
+/* BBLCR0 */
+#define BBLCR0_LAY_123        0x05000000
+
+#define BBLCR0_AMUX_BLENDPIXEL(n)  (0x10000000 << (n))
+
+/* BBLCR1 */
+#define MT_MEMORY             0x10000
+#define MT_VOU                0x20000
+#define MT_MEMORY_VOU         0x30000
+#define MT_LCDC               0x40000
+#define MT_LCDC_MEMORY        0x50000
+
+#define BBLCR1_PWD_INPUT1     0x00000000
+#define BBLCR1_PWD_INPUT2     0x01000000
+#define BBLCR1_PWD_INPUT3     0x02000000
+#define BBLCR1_PWD_INPUT_MASK 0x03000000
+
+/* BSWPR */
+#define BSWPR_MODSEL_GLOBAL   0x00000000
+#define BSWPR_MODSEL_EACH     0x80000000
+
+#define BSWPR_INPUT_BYTESWAP  0x00000001
+#define BSWPR_INPUT_WORDSWAP  0x00000002
+#define BSWPR_INPUT_LONGSWAP  0x00000004
+
+#define BSWPR_OUTPUT_BYTESWAP 0x00000010
+#define BSWPR_OUTPUT_WORDSWAP 0x00000020
+#define BSWPR_OUTPUT_LONGSWAP 0x00000040
+
+#define BSWPR_INPUT2_BYTESWAP 0x00000100
+#define BSWPR_INPUT2_WORDSWAP 0x00000200
+#define BSWPR_INPUT2_LONGSWAP 0x00000400
+
+#define BSWPR_INPUT3_BYTESWAP 0x00010000
+#define BSWPR_INPUT3_WORDSWAP 0x00020000
+#define BSWPR_INPUT3_LONGSWAP 0x00040000
+
+#define BSWPR_MULWIN_BYTESWAP 0x01000000
+#define BSWPR_MULWIN_WORDSWAP 0x02000000
+#define BSWPR_MULWIN_LONGSWAP 0x04000000
+
+
+/******************************************************************************
+ * VEU
+ */
+
+#define VEU_VESTR             (VEU_REG_BASE + 0x0000)
+#define VEU_VESWR             (VEU_REG_BASE + 0x0010)
+#define VEU_VESSR             (VEU_REG_BASE + 0x0014)
+#define VEU_VSAYR             (VEU_REG_BASE + 0x0018)
+#define VEU_VSACR             (VEU_REG_BASE + 0x001c)
+#define VEU_VBSSR             (VEU_REG_BASE + 0x0020)
+#define VEU_VEDWR             (VEU_REG_BASE + 0x0030)
+#define VEU_VDAYR             (VEU_REG_BASE + 0x0034)
+#define VEU_VDACR             (VEU_REG_BASE + 0x0038)
+#define VEU_VTRCR             (VEU_REG_BASE + 0x0050)
+#define VEU_VRFCR             (VEU_REG_BASE + 0x0054)
+#define VEU_VRFSR             (VEU_REG_BASE + 0x0058)
+#define VEU_VENHR             (VEU_REG_BASE + 0x005c)
+#define VEU_VFMCR             (VEU_REG_BASE + 0x0070)
+#define VEU_VVTCR             (VEU_REG_BASE + 0x0074)
+#define VEU_VHTCR             (VEU_REG_BASE + 0x0078)
+#define VEU_VAPCR             (VEU_REG_BASE + 0x0080)
+#define VEU_VECCR             (VEU_REG_BASE + 0x0084)
+#define VEU_VAFXR             (VEU_REG_BASE + 0x0090)
+#define VEU_VSWPR             (VEU_REG_BASE + 0x0094)
+#define VEU_VEIER             (VEU_REG_BASE + 0x00a0)
+#define VEU_VEVTR             (VEU_REG_BASE + 0x00a4)
+#define VEU_VSTAR             (VEU_REG_BASE + 0x00b0)
+#define VEU_VBSRR             (VEU_REG_BASE + 0x00b4)
+
+
+/******************************************************************************
+ * LCD
+ */
+
+#define LCDC_LUT(n)           (LCDC_REG_BASE + (n) * 4)
+#define LCDC_MLDDCKPAT1R      (LCDC_REG_BASE + 0x0400)
+#define LCDC_MLDDCKPAT2R      (LCDC_REG_BASE + 0x0404)
+#define LCDC_SLDDCKPAT1R      (LCDC_REG_BASE + 0x0408)
+#define LCDC_SLDDCKPAT2R      (LCDC_REG_BASE + 0x040c)
+#define LCDC_LDDCKR           (LCDC_REG_BASE + 0x0410)
+#define LCDC_LDDCKSTPR        (LCDC_REG_BASE + 0x0414)
+#define LCDC_MLDMT1R          (LCDC_REG_BASE + 0x0418)
+#define LCDC_MLDMT2R          (LCDC_REG_BASE + 0x041c)
+#define LCDC_MLDMT3R          (LCDC_REG_BASE + 0x0420)
+#define LCDC_MLDDFR           (LCDC_REG_BASE + 0x0424)
+#define LCDC_MLDSM1R          (LCDC_REG_BASE + 0x0428)
+#define LCDC_MLDSM2R          (LCDC_REG_BASE + 0x042c)
+#define LCDC_MLDSA1R          (LCDC_REG_BASE + 0x0430)
+#define LCDC_MLDSA2R          (LCDC_REG_BASE + 0x0434)
+#define LCDC_MLDMLSR          (LCDC_REG_BASE + 0x0438)
+#define LCDC_MLDWBFR          (LCDC_REG_BASE + 0x043c)
+#define LCDC_MLDWBCNTR        (LCDC_REG_BASE + 0x0440)
+#define LCDC_MLDWBAR          (LCDC_REG_BASE + 0x0444)
+#define LCDC_MLDHCNR          (LCDC_REG_BASE + 0x0448)
+#define LCDC_MLDHSYNR         (LCDC_REG_BASE + 0x044c)
+#define LCDC_MLDVLNR          (LCDC_REG_BASE + 0x0450)
+#define LCDC_MLDVSYNR         (LCDC_REG_BASE + 0x0454)
+#define LCDC_MLDHPDR          (LCDC_REG_BASE + 0x0458)
+#define LCDC_MLDVPDR          (LCDC_REG_BASE + 0x045c)
+#define LCDC_MLDPMR           (LCDC_REG_BASE + 0x0460)
+#define LCDC_LDPALCR          (LCDC_REG_BASE + 0x0464)
+#define LCDC_LDINTR           (LCDC_REG_BASE + 0x0468)
+#define LCDC_LDSR             (LCDC_REG_BASE + 0x046c)
+#define LCDC_LDCNT1R          (LCDC_REG_BASE + 0x0470)
+#define LCDC_LDCNT2R          (LCDC_REG_BASE + 0x0474)
+#define LCDC_LDRCNTR          (LCDC_REG_BASE + 0x0478)
+#define LCDC_LDDDSR           (LCDC_REG_BASE + 0x047c)
+#define LCDC_LDRCR            (LCDC_REG_BASE + 0x0484)
+
+
+/******************************************************************************
+ * JPEG
+ */
+
+/* JPEG code mode register */
+#define JCMOD                 (JPEG_REG_BASE + 0x0000)
+
+/* JPEG code command register */
+#define JCCMD                 (JPEG_REG_BASE + 0x0004)
+
+/* JPEG code status register */
+#define JCSTS                 (JPEG_REG_BASE + 0x0008)
+
+/* JPEG code quantization table number register */
+#define JCQTN                 (JPEG_REG_BASE + 0x000C)
+
+/* JPEG code Huffman table number register */
+#define JCHTN                 (JPEG_REG_BASE + 0x0010)
+
+/* JPEG code DRI upper register */
+#define JCDRIU                (JPEG_REG_BASE + 0x0014)
+
+/* JPEG code DRI lower register */
+#define JCDRID                (JPEG_REG_BASE + 0x0018)
+
+/* JPEG code vertical size upper register */
+#define JCVSZU                (JPEG_REG_BASE + 0x001C)
+
+/* JPEG code vertical size lower register */
+#define JCVSZD                (JPEG_REG_BASE + 0x0020)
+
+/* JPEG code horizontal size upper register */
+#define JCHSZU                (JPEG_REG_BASE + 0x0024)
+
+/* JPEG code horizontal size lower register */
+#define JCHSZD                (JPEG_REG_BASE + 0x0028)
+
+/* JPEG code data count upper register */
+#define JCDTCU                (JPEG_REG_BASE + 0x002C)
+
+/* JPEG code data count middle register */
+#define JCDTCM                (JPEG_REG_BASE + 0x0030)
+
+/* JPEG code data count lower register */
+#define JCDTCD                (JPEG_REG_BASE + 0x0034)
+
+/* JPEG interrupt enable register */
+#define JINTE                 (JPEG_REG_BASE + 0x0038)
+
+/* JPEG interrupt status register */
+#define JINTS                 (JPEG_REG_BASE + 0x003C)
+
+/* JPEG code decode error register */
+#define JCDERR                (JPEG_REG_BASE + 0x0040)
+
+/* JPEG code reset register */
+#define JCRST                 (JPEG_REG_BASE + 0x0044)
+
+/* JPEG interface control register */
+#define JIFCNT                (JPEG_REG_BASE + 0x0060)
+
+/* JPEG interface encoding control register */
+#define JIFECNT               (JPEG_REG_BASE + 0x0070)
+
+/* JPEG interface encode source Y address register 1 */
+#define JIFESYA1              (JPEG_REG_BASE + 0x0074)
+
+/* JPEG interface encode source C address register 1 */
+#define JIFESCA1              (JPEG_REG_BASE + 0x0078)
+
+/* JPEG interface encode source Y address register 2 */
+#define JIFESYA2              (JPEG_REG_BASE + 0x007C)
+
+/* JPEG interface encode source C address register 2 */
+#define JIFESCA2              (JPEG_REG_BASE + 0x0080)
+
+/* JPEG interface encode source memory width register */
+#define JIFESMW               (JPEG_REG_BASE + 0x0084)
+
+/* JPEG interface encode source vertical size register */
+#define JIFESVSZ              (JPEG_REG_BASE + 0x0088)
+
+/* JPEG interface encode source horizontal size register */
+#define JIFESHSZ              (JPEG_REG_BASE + 0x008C)
+
+/* JPEG interface encode destination address register 1 */
+#define JIFEDA1               (JPEG_REG_BASE + 0x0090)
+
+/* JPEG interface encode destination address register 2 */
+#define JIFEDA2               (JPEG_REG_BASE + 0x0094)
+
+/* JPEG interface encode data reload size register */
+#define JIFEDRSZ              (JPEG_REG_BASE + 0x0098)
+
+/* JPEG interface decoding control register */
+#define JIFDCNT               (JPEG_REG_BASE + 0x00A0)
+
+/* JPEG interface decode source address register 1 */
+#define JIFDSA1               (JPEG_REG_BASE + 0x00A4)
+
+/* JPEG interface decode source address register 2 */
+#define JIFDSA2               (JPEG_REG_BASE + 0x00A8)
+
+/* JPEG interface decode data reload size register */
+#define JIFDDRSZ              (JPEG_REG_BASE + 0x00AC)
+
+/* JPEG interface decode destination memory width register */
+#define JIFDDMW               (JPEG_REG_BASE + 0x00B0)
+
+/* JPEG interface decode destination vertical size register */
+#define JIFDDVSZ              (JPEG_REG_BASE + 0x00B4)
+
+/* JPEG interface decode destination horizontal size register */
+#define JIFDDHSZ              (JPEG_REG_BASE + 0x00B8)
+
+/* JPEG interface decode destination Y address register 1 */
+#define JIFDDYA1              (JPEG_REG_BASE + 0x00BC)
+
+/* JPEG interface decode destination C address register 1 */
+#define JIFDDCA1              (JPEG_REG_BASE + 0x00C0)
+
+/* JPEG interface decode destination Y address register 2 */
+#define JIFDDYA2              (JPEG_REG_BASE + 0x00C4)
+
+/* JPEG interface decode destination C address register 2 */
+#define JIFDDCA2              (JPEG_REG_BASE + 0x00C8)
+
+
+/* JPEG code quantization table 0 register */
+#define JCQTBL0(n)               (JPEG_REG_BASE + 0x10000 + (((n)*4) & 0x3C)) // to 0x1003C
+
+/* JPEG code quantization table 1 register */
+#define JCQTBL1(n)               (JPEG_REG_BASE + 0x10040 + (((n)*4) & 0x3C)) // to 0x1007C
+
+/* JPEG code quantization table 2 register */
+#define JCQTBL2(n)               (JPEG_REG_BASE + 0x10080 + (((n)*4) & 0x3C)) // to 0x100BC
+
+/* JPEG code quantization table 3 register */
+#define JCQTBL3(n)               (JPEG_REG_BASE + 0x100C0 + (((n)*4) & 0x3C)) // to 0x100FC
+
+/* JPEG code Huffman table DC0 register */
+#define JCHTBD0(n)               (JPEG_REG_BASE + 0x10100 + (((n)*4) & 0x1C)) // to 0x1010C
+
+/* JPEG code Huffman table DC0 register */
+//#define JCHTBD1(n)               (JPEG_REG_BASE + 0x10110 + (((n)*4) & 0x0C)) // to 0x10118
+
+/* JPEG code Huffman table AC0 register */
+#define JCHTBA0(n)               (JPEG_REG_BASE + 0x10120 + (((n)*4) & 0xFC)) // to 0x1012C
+
+/* JPEG code Huffman table AC0 register */
+//#define JCHTBA1(n)               (JPEG_REG_BASE + 0x10130 + (((n)*4) & 0x0C)) // to 0x101D0
+
+/* JPEG code Huffman table DC1 register */
+#define JCHTBD1(n)               (JPEG_REG_BASE + 0x10200 + (((n)*4) & 0x1C)) // to 0x1020C
+
+/* JPEG code Huffman table DC1 register */
+//#define JCHTBD3(n)               (JPEG_REG_BASE + 0x10210 + (((n)*4) & 0x0C)) // to 0x10218
+
+/* JPEG code Huffman table AC1 register */
+#define JCHTBA1(n)               (JPEG_REG_BASE + 0x10220 + (((n)*4) & 0xFC)) // to 0x1022C
+
+/* JPEG code Huffman table AC1 register */
+//#define JCHTBA3(n)               (JPEG_REG_BASE + 0x10230 + (((n)*4) & 0xFC)) // to 0x102D0 
+
+
+#define JCCMD_START           0x00000001
+#define JCCMD_RESTART         0x00000002
+#define JCCMD_END             0x00000004
+#define JCCMD_LCMD2           0x00000100
+#define JCCMD_LCMD1           0x00000200
+#define JCCMD_RESET           0x00000080
+#define JCCMD_READ_RESTART    0x00000400
+#define JCCMD_WRITE_RESTART   0x00000800
+#define JCMOD_DSP_ENCODE      0x00000000
+#define JCMOD_DSP_DECODE      0x00000008
+#define JCMOD_INPUT_CTRL      0x00000080  // must always be set
+#define JIFCNT_VJSEL_JPU      0x00000000
+#define JIFCNT_VJSEL_VPU      0x00000002
+
+#define JIFECNT_LINEBUF_MODE  0x00000002
+#define JIFECNT_SWAP_1234     0x00000000
+#define JIFECNT_SWAP_2143     0x00000010
+#define JIFECNT_SWAP_3412     0x00000020
+#define JIFECNT_SWAP_4321     0x00000030
+#define JIFECNT_RELOAD_ENABLE 0x00000040
+
+#define JIFDCNT_LINEBUF_MODE  0x00000001
+#define JIFDCNT_SWAP_1234     0x00000000
+#define JIFDCNT_SWAP_2143     0x00000002
+#define JIFDCNT_SWAP_3412     0x00000004
+#define JIFDCNT_SWAP_4321     0x00000006
+#define JIFDCNT_RELOAD_ENABLE 0x00000008
+
+#define JINTS_MASK            0x00007C68
+#define JINTS_INS3_HEADER     0x00000008
+#define JINTS_INS5_ERROR      0x00000020
+#define JINTS_INS6_DONE       0x00000040
+#define JINTS_INS10_XFER_DONE 0x00000400
+#define JINTS_INS11_LINEBUF0  0x00000800
+#define JINTS_INS12_LINEBUF1  0x00001000
+#define JINTS_INS13_LOADED    0x00002000
+#define JINTS_INS14_RELOAD    0x00004000
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.c b/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.c
new file mode 100755
index 0000000..2fe4d46
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.c
@@ -0,0 +1,85 @@
+#ifdef SH7722_DEBUG_SCREEN
+#define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <sys/mman.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+
+#include "sh7722.h"
+#include "sh7722_screen.h"
+
+
+D_DEBUG_DOMAIN( SH7722_Screen, "SH7722/Screen", "Renesas SH7722 Screen" );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+sh7722InitScreen( CoreScreen           *screen,
+               CoreGraphicsDevice       *device,
+               void                 *driver_data,
+               void                 *screen_data,
+               DFBScreenDescription *description )
+{
+     D_DEBUG_AT( SH7722_Screen, "%s()\n", __FUNCTION__ );
+
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_NONE;
+
+     /* Set the screen name. */
+     snprintf( description->name, DFB_SCREEN_DESC_NAME_LENGTH, "SH7722 Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sh7722GetScreenSize( CoreScreen *screen,
+                  void       *driver_data,
+                  void       *screen_data,
+                  int        *ret_width,
+                  int        *ret_height )
+{
+	 SH7722DriverData *sdrv = driver_data;
+	 SH7722DeviceData *sdev = sdrv->dev;
+     D_DEBUG_AT( SH7722_Screen, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( ret_width != NULL );
+     D_ASSERT( ret_height != NULL );
+
+     *ret_width  = sdev->lcd_width;
+     *ret_height = sdev->lcd_height;
+
+     return DFB_OK;
+}
+
+ScreenFuncs sh7722ScreenFuncs = {
+     .InitScreen    = sh7722InitScreen,
+     .GetScreenSize = sh7722GetScreenSize,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.h
new file mode 100755
index 0000000..d545ed8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_screen.h
@@ -0,0 +1,9 @@
+#ifndef __SH7722__SCREEN_H__
+#define __SH7722__SCREEN_H__
+
+#include <core/screens.h>
+
+extern ScreenFuncs sh7722ScreenFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7722_types.h b/Source/DirectFB/gfxdrivers/sh772x/sh7722_types.h
new file mode 100755
index 0000000..ea367da
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7722_types.h
@@ -0,0 +1,136 @@
+#ifndef __SH7722__TYPES_H__
+#define __SH7722__TYPES_H__
+
+#include <core/layers.h>
+
+#include <sh772x_gfx.h>
+
+
+#define SH7722GFX_MAX_PREPARE             8192
+
+
+typedef enum {
+     SH7722_LAYER_INPUT1,
+     SH7722_LAYER_INPUT2,
+     SH7722_LAYER_INPUT3,
+     SH7722_LAYER_MULTIWIN
+} SH7722LayerID;
+
+
+typedef struct {
+     SH7722LayerID            layer;
+} SH7722LayerData;
+
+typedef struct {
+     int                      magic;
+
+     CoreLayerRegionConfig    config;
+
+     CoreSurface             *surface;
+     CorePalette             *palette;
+} SH7722RegionData;
+
+
+typedef struct {
+     unsigned int             added;
+     unsigned int             visible;
+} SH7722MultiLayerData;
+
+typedef struct {
+     int                      magic;
+
+     int                      index;
+     CoreLayerRegionConfig    config;
+
+     CoreSurface             *surface;
+     CorePalette             *palette;
+} SH7722MultiRegionData;
+
+
+typedef struct {
+     int                      sh772x;
+
+     int                      lcd_width;
+     int                      lcd_height;
+     int                      lcd_offset;
+     int                      lcd_pitch;
+     int                      lcd_size;
+     unsigned long            lcd_phys;
+     DFBSurfacePixelFormat    lcd_format;
+
+     /* state validation */
+     int                      v_flags;
+
+     /* prepared register values */
+     u32                      ble_srcf;
+     u32                      ble_dstf;
+
+     /* cached values */
+     unsigned long            dst_phys;
+     int                      dst_pitch;
+     int                      dst_bpp;
+     int                      dst_index;
+
+     unsigned long            src_phys;
+     int                      src_pitch;
+     int                      src_bpp;
+     int                      src_index;
+
+     unsigned long            mask_phys;
+     int                      mask_pitch;
+     DFBSurfacePixelFormat    mask_format;
+     int                      mask_index;
+     DFBPoint                 mask_offset;
+     DFBSurfaceMaskFlags      mask_flags;
+
+     DFBSurfaceDrawingFlags   dflags;
+     DFBSurfaceBlittingFlags  bflags;
+     DFBSurfaceRenderOptions  render_options;
+
+     bool                     ckey_b_enabled;
+     bool                     color_change_enabled;
+     bool                     mask_enabled;
+
+     unsigned int             input_mask;
+
+     s32                      matrix[6];
+     DFBColor                 color;
+
+     /* locking */
+     FusionSkirmish           beu_lock;
+
+
+     /* sh7723 */
+     u32                      rclr;
+     u32                      color16;
+} SH7722DeviceData;
+
+
+typedef struct {
+     SH7722DeviceData        *dev;
+
+     CoreDFB                 *core;
+     CoreGraphicsDevice      *device;
+
+     CoreScreen              *screen;
+
+     CoreLayer               *multi;
+     CoreLayer               *input1;
+     CoreLayer               *input2;
+     CoreLayer               *input3;
+
+     int                      gfx_fd;
+     SH772xGfxSharedArea     *gfx_shared;
+
+     int                      prep_num;
+     __u32                    prep_buf[SH7722GFX_MAX_PREPARE];
+
+     volatile void           *mmio_base;
+
+     int                      num_inputs;
+
+     volatile void           *lcd_virt;
+} SH7722DriverData;
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.c b/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.c
new file mode 100755
index 0000000..f784e81
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.c
@@ -0,0 +1,890 @@
+#ifdef SH7723_DEBUG_BLT
+     #define DIRECT_ENABLE_DEBUG
+#endif
+
+
+#include <config.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <malloc.h>
+#include <errno.h>
+
+#include <asm/types.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include "sh7722.h"
+
+#include "sh7723_blt.h"
+
+
+D_DEBUG_DOMAIN( SH7723_BLT, "SH7723/BLT", "Renesas SH7723 Drawing Engine" );
+
+/*
+ * State validation flags.
+ *
+ * There's no prefix because of the macros below.
+ */
+enum {
+     DEST         = 0x00000001,
+     CLIP         = 0x00000002,
+     DEST_CLIP    = 0x00000003,
+     
+     COLOR16      = 0x00000100,
+
+     ALPHA        = 0x00001000,
+
+     SOURCE       = 0x00010000,
+     STRANS       = 0x00020000,
+
+     ALL          = 0x00031103,
+};
+
+/*
+ * State handling macros.
+ */
+
+#define SH7723_VALIDATE(flags)          do { sdev->v_flags |=  (flags); } while (0)
+#define SH7723_INVALIDATE(flags)        do { sdev->v_flags &= ~(flags); } while (0)
+
+#define SH7723_CHECK_VALIDATE(flag)     do {                                                        \
+                                             if ((sdev->v_flags & flag) != flag)                    \
+                                                  sh7723_validate_##flag( sdrv, sdev, state );      \
+                                        } while (0)
+
+#define DUMP_INFO() D_DEBUG_AT( SH7723_BLT, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                            sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                            sdrv->gfx_shared->hw_start,                             \
+                                            sdrv->gfx_shared->hw_end,                               \
+                                            sdrv->gfx_shared->next_start,                           \
+                                            sdrv->gfx_shared->next_end,                             \
+                                            sdrv->gfx_shared->next_valid ? "" : "not " );
+
+/**********************************************************************************************************************/
+
+static inline bool
+start_hardware( SH7722DriverData *sdrv )
+{
+     SH772xGfxSharedArea *shared = sdrv->gfx_shared;
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     if (shared->hw_running || !shared->next_valid || shared->next_end == shared->next_start)
+          return false;
+
+     shared->hw_running = true;
+     shared->hw_start   = shared->next_start;
+     shared->hw_end     = shared->next_end;
+
+     shared->next_start = shared->next_end = (shared->hw_end + 1 + 3) & ~3;
+     shared->next_valid = false;
+
+     shared->num_words += shared->hw_end - shared->hw_start;
+
+     shared->num_starts++;
+
+     DUMP_INFO();
+
+     D_ASSERT( shared->buffer[shared->hw_end] == M2DG_OPCODE_TRAP );
+
+     SH7722_TDG_SETREG32( sdrv, M2DG_DLSAR, shared->buffer_phys + shared->hw_start*4 );
+     SH7722_TDG_SETREG32( sdrv, M2DG_SCLR,  1 );
+     return true;
+}
+
+__attribute__((noinline))
+static void
+flush_prepared( SH7722DriverData *sdrv )
+{
+     SH772xGfxSharedArea *shared  = sdrv->gfx_shared;
+     unsigned int         timeout = 2;
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     D_ASSERT( sdrv->prep_num < SH772xGFX_BUFFER_WORDS );
+     D_ASSERT( sdrv->prep_num <= D_ARRAY_SIZE(sdrv->prep_buf) );
+
+     /* Something prepared? */
+     while (sdrv->prep_num) {
+          int next_end;
+
+          /* Mark shared information as invalid. From this point on the interrupt handler
+           * will not continue with the next block, and we'll start the hardware ourself. */
+          shared->next_valid = false;
+
+          /* Check if there's enough space at the end.
+           * Wait until hardware has started next block before it gets too big. */
+          if (shared->next_end + sdrv->prep_num >= SH772xGFX_BUFFER_WORDS ||
+              shared->next_end - shared->next_start >= SH772xGFX_BUFFER_WORDS/4) {
+               /* If there's no next block waiting, start at the beginning. */
+               if (shared->next_start == shared->next_end)
+                    shared->next_start = shared->next_end = 0;
+               else {
+                    D_ASSERT( shared->buffer[shared->hw_end] == M2DG_OPCODE_TRAP );
+
+                    /* Mark area as valid again. */
+                    shared->next_valid = true;
+
+                    /* Start in case it got idle while doing the checks. */
+                    if (!start_hardware( sdrv )) {
+                         /*
+                          * Hardware has not been started (still running).
+                          * Check for timeout. */
+                         if (!timeout--) {
+                              D_ERROR( "SH7723/Blt: Timeout waiting for processing!\n" );
+                              direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                                 sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                                 sdrv->gfx_shared->hw_start,                             \
+                                                 sdrv->gfx_shared->hw_end,                               \
+                                                 sdrv->gfx_shared->next_start,                           \
+                                                 sdrv->gfx_shared->next_end,                             \
+                                                 sdrv->gfx_shared->next_valid ? "" : "not " );
+                              D_ASSERT( shared->buffer[shared->hw_end] == M2DG_OPCODE_TRAP );
+                              sh7723EngineReset( sdrv, sdrv->dev );
+                         }
+
+                         /* Wait til next block is started. */
+                         ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_NEXT );
+                    }
+
+                    /* Start over with the checks. */
+                    continue;
+               }
+          }
+
+          /* We are appending in case there was already a next block. */
+          next_end = shared->next_end + sdrv->prep_num;
+
+          /* Reset the timeout counter. */
+          timeout = 2;
+
+          /* While the hardware is running... */
+          while (shared->hw_running) {
+               D_ASSERT( shared->buffer[shared->hw_end] == M2DG_OPCODE_TRAP );
+
+               /* ...make sure we don't over lap with its current buffer, otherwise wait. */
+               if (shared->hw_start > next_end || shared->hw_end < shared->next_start)
+                    break;
+
+               /* Check for timeout. */
+               if (!timeout--) {
+                    D_ERROR( "SH7723/Blt: Timeout waiting for space!\n" );
+                    direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                                       sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                                       sdrv->gfx_shared->hw_start,                             \
+                                       sdrv->gfx_shared->hw_end,                               \
+                                       sdrv->gfx_shared->next_start,                           \
+                                       sdrv->gfx_shared->next_end,                             \
+                                       sdrv->gfx_shared->next_valid ? "" : "not " );
+                    D_ASSERT( shared->buffer[shared->hw_end] == M2DG_OPCODE_TRAP );
+                    sh7723EngineReset( sdrv, sdrv->dev );
+               }
+
+               /* Wait til next block is started. */
+               ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_NEXT );
+          }
+
+          /* Copy from local to shared buffer. */
+          direct_memcpy( (void*) &shared->buffer[shared->next_end], &sdrv->prep_buf[0], sdrv->prep_num * sizeof(__u32) );
+
+          /* Terminate the block. */
+          shared->buffer[next_end] = M2DG_OPCODE_TRAP;
+
+          /* Update next block information and mark valid. */
+          shared->next_end   = next_end;
+          shared->next_valid = true;
+
+          /* Reset local counter. */
+          sdrv->prep_num = 0;
+     }
+
+     /* Start in case it is idle. */
+     start_hardware( sdrv );
+}
+
+static inline __u32 *
+start_buffer( SH7722DriverData *sdrv,
+              int               space )
+{
+     /* Check for space in local buffer. */
+     if (sdrv->prep_num + space > SH7722GFX_MAX_PREPARE) {
+          /* Flush local buffer. */
+          flush_prepared( sdrv );
+
+          D_ASSERT( sdrv->prep_num == 0 );
+     }
+
+     /* Return next write position. */
+     return &sdrv->prep_buf[sdrv->prep_num];
+}
+
+static inline void
+submit_buffer( SH7722DriverData *sdrv,
+               int               entries )
+{
+     D_ASSERT( sdrv->prep_num + entries <= SH7722GFX_MAX_PREPARE );
+
+     /* Increment next write position. */
+     sdrv->prep_num += entries;
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+sh7723_validate_DEST_CLIP( SH7722DriverData *sdrv,
+                           SH7722DeviceData *sdev,
+                           CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 18 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s( 0x%08lx [%d] - %4d,%4d-%4dx%4d )\n", __FUNCTION__,
+                 state->dst.phys, state->dst.pitch, DFB_RECTANGLE_VALS_FROM_REGION( &state->clip ) );
+
+     prep[0] = M2DG_OPCODE_WPR;
+     prep[1] = 0x0d4;
+     prep[2] = SH7723_XY( state->clip.x1, state->clip.y1 ) ;
+
+     prep[3] = M2DG_OPCODE_WPR;
+     prep[4] = 0x0d8;
+     prep[5] = SH7723_XY( state->clip.x2, state->clip.y2) ;
+     
+     if (sdev->v_flags & DEST) {
+          submit_buffer( sdrv, 6 );
+     }
+     else {
+          CoreSurface       *surface = state->destination;
+          CoreSurfaceBuffer *buffer  = state->dst.buffer;
+     
+          sdev->dst_phys  = state->dst.phys;
+          sdev->dst_pitch = state->dst.pitch;
+          sdev->dst_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
+          sdev->dst_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
+
+          sdev->rclr &= ~0x00140000;
+     
+          switch (buffer->format) {
+               case DSPF_RGB16:
+                    sdev->rclr |= 0x00040000;
+                    break;
+     
+               case DSPF_ARGB1555:
+                    sdev->rclr |= 0x00140000;
+                    break;
+     
+               default:
+                    D_BUG("Unexpected pixelformat\n");
+                    return;
+          }
+     
+          /* Set destination start address. */
+          prep[ 6] = M2DG_OPCODE_WPR;
+          prep[ 7] = 0x50;
+          prep[ 8] = sdev->dst_phys;
+     
+          /* Set destination stride. */
+          prep[ 9] = M2DG_OPCODE_WPR;
+          prep[10] = 0x5c;
+          prep[11] = sdev->dst_pitch / sdev->dst_bpp;
+     
+          /* Set destination pixelformat in rendering control. */
+          prep[12] = M2DG_OPCODE_WPR;
+          prep[13] = 0xc0;
+          prep[14] = sdev->rclr;
+     
+          /* Set system clipping rectangle. */
+          prep[15] = M2DG_OPCODE_WPR;
+          prep[16] = 0xd0;
+          prep[17] = SH7723_XY( surface->config.size.w - 1, surface->config.size.h - 1 );
+     
+          submit_buffer( sdrv, 18 );
+     }
+
+     /* Set the flags. */
+     SH7723_VALIDATE( DEST_CLIP );
+}
+
+static inline void
+sh7723_validate_COLOR16( SH7722DriverData *sdrv,
+                         SH7722DeviceData *sdev,
+                         CardState        *state )
+{
+     sdev->color16 = dfb_pixel_from_color( state->destination->config.format, &state->color );
+
+     /* Set the flags. */
+     SH7723_VALIDATE( COLOR16 );
+}
+
+static inline void
+sh7723_validate_ALPHA( SH7722DriverData *sdrv,
+                       SH7722DeviceData *sdev,
+                       CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 3 );
+
+     prep[0] = M2DG_OPCODE_WPR;
+     prep[1] = 0x088;
+     prep[2] = state->color.a;
+
+     submit_buffer( sdrv, 3 );
+
+     /* Set the flags. */
+     SH7723_VALIDATE( ALPHA );
+}
+
+static inline void
+sh7723_validate_SOURCE( SH7722DriverData *sdrv,
+                        SH7722DeviceData *sdev,
+                        CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 6 );
+
+     CoreSurfaceBuffer *buffer = state->src.buffer;
+
+     sdev->src_phys  = state->src.phys;
+     sdev->src_pitch = state->src.pitch;
+     sdev->src_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
+     sdev->src_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
+
+     /* Set source start address. */
+     prep[0] = M2DG_OPCODE_WPR;
+     prep[1] = 0x4c;
+     prep[2] = sdev->src_phys;
+
+     /* Set source stride. */
+     prep[3] = M2DG_OPCODE_WPR;
+     prep[4] = 0x58;
+     prep[5] = sdev->src_pitch / sdev->src_bpp;
+
+     submit_buffer( sdrv, 6 );
+
+     /* Set the flags. */
+     SH7723_VALIDATE( SOURCE );
+}
+
+static inline void
+sh7723_validate_STRANS( SH7722DriverData *sdrv,
+                        SH7722DeviceData *sdev,
+                        CardState        *state )
+{
+     __u32 *prep = start_buffer( sdrv, 3 );
+
+     prep[0] = M2DG_OPCODE_WPR;
+     prep[1] = 0x080;
+     prep[2] = state->src_colorkey;
+
+     submit_buffer( sdrv, 3 );
+
+     /* Set the flags. */
+     SH7723_VALIDATE( STRANS );
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+sh7723EngineSync( void *drv, void *dev )
+{
+     DFBResult            ret    = DFB_OK;
+     SH7722DriverData    *sdrv   = drv;
+     SH772xGfxSharedArea *shared = sdrv->gfx_shared;
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     while (shared->hw_running && ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_WAIT_IDLE ) < 0) {
+          if (errno == EINTR)
+               continue;
+
+          ret = errno2result( errno );
+          D_PERROR( "SH7723/BLT: SH7723GFX_IOCTL_WAIT_IDLE failed!\n" );
+
+          direct_log_printf( NULL, "  -> %srunning, hw %d-%d, next %d-%d - %svalid\n",     \
+                             sdrv->gfx_shared->hw_running ? "" : "not ",             \
+                             sdrv->gfx_shared->hw_start,                             \
+                             sdrv->gfx_shared->hw_end,                               \
+                             sdrv->gfx_shared->next_start,                           \
+                             sdrv->gfx_shared->next_end,                             \
+                             sdrv->gfx_shared->next_valid ? "" : "not " );
+
+          break;
+     }
+
+     if (ret == DFB_OK) {
+          D_ASSERT( !shared->hw_running );
+          D_ASSERT( !shared->next_valid );
+     }
+
+     return ret;
+}
+
+void
+sh7723EngineReset( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+     __u32            *prep;
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     ioctl( sdrv->gfx_fd, SH772xGFX_IOCTL_RESET );
+
+     prep = start_buffer( sdrv, 4 );
+
+     /* Reset current pointer. */
+     prep[0] = M2DG_OPCODE_MOVE;
+     prep[1] = 0;
+
+     /* Reset local offset. */
+     prep[2] = M2DG_OPCODE_LCOFS;
+     prep[3] = 0;
+
+     submit_buffer( sdrv, 4 );
+}
+
+void
+sh7723EmitCommands( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     flush_prepared( sdrv );
+}
+
+void
+sh7723FlushTextureCache( void *drv, void *dev )
+{
+     SH7722DriverData *sdrv = drv;
+     __u32            *prep = start_buffer( sdrv, 1 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s()\n", __FUNCTION__ );
+
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_SYNC | M2DG_SYNC_TCLR;
+
+     submit_buffer( sdrv, 1 );
+}
+
+/**********************************************************************************************************************/
+
+void
+sh7723CheckState( void                *drv,
+                  void                *dev,
+                  CardState           *state,
+                  DFBAccelerationMask  accel )
+{
+     D_DEBUG_AT( SH7723_BLT, "%s( %p, 0x%08x )\n", __FUNCTION__, state, accel );
+
+     /* Return if the desired function is not supported at all. */
+     if (accel & ~(SH7723_SUPPORTED_DRAWINGFUNCTIONS | SH7723_SUPPORTED_BLITTINGFUNCTIONS))
+          return;
+
+     /* Return if the destination format is not supported. */
+     switch (state->destination->config.format) {
+          case DSPF_RGB16:
+//          case DSPF_ARGB1555:
+               break;
+
+          default:
+               return;
+     }
+
+     /* Check if drawing or blitting is requested. */
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* Return if unsupported drawing flags are set. */
+          if (state->drawingflags & ~SH7723_SUPPORTED_DRAWINGFLAGS)
+               return;
+
+          /* Return if blending with unsupported blend functions is requested. */
+          if (state->drawingflags & DSDRAW_BLEND) {
+               switch (accel) {
+                    case DFXL_FILLRECTANGLE:
+                    case DFXL_FILLTRIANGLE:
+                         break;
+                    default:
+                         return;
+               }
+
+               /* Return if blending with unsupported blend functions is requested. */
+               if (state->src_blend != DSBF_SRCALPHA || state->dst_blend != DSBF_INVSRCALPHA)
+                    return;
+
+               /* XOR only without blending. */
+               if (state->drawingflags & DSDRAW_XOR)
+                    return;
+          }
+
+          /* Enable acceleration of drawing functions. */
+          state->accel |= accel;
+     } else {
+          DFBSurfaceBlittingFlags flags = state->blittingflags;
+
+          /* Return if unsupported blitting flags are set. */
+          if (flags & ~SH7723_SUPPORTED_BLITTINGFLAGS)
+               return;
+
+          /* Return if the source format is not supported. */
+          if (state->source->config.format != state->destination->config.format)
+               return;
+      
+          /* Return if blending with unsupported blend functions is requested. */
+          if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               if (state->src_blend != DSBF_SRCALPHA || state->dst_blend != DSBF_INVSRCALPHA)
+                    return;
+          }
+
+          /* XOR only without blending etc. */
+          if (flags & DSBLIT_XOR &&
+              flags & ~(DSBLIT_SRC_COLORKEY | DSBLIT_ROTATE180 | DSBLIT_XOR))
+               return;
+
+          /* Return if colorizing for non-font surfaces is requested. */
+          if ((flags & DSBLIT_COLORIZE) && !(state->source->type & CSTF_FONT))
+               return;
+
+          /* Return if blending with both alpha channel and value is requested. */
+          if (D_FLAGS_ARE_SET( flags, DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA))
+               return;
+
+          /* Enable acceleration of blitting functions. */
+          state->accel |= accel;
+     }
+}
+
+/*
+ * Make sure that the hardware is programmed for execution of 'accel' according to the 'state'.
+ */
+void
+sh7723SetState( void                *drv,
+                void                *dev,
+                GraphicsDeviceFuncs *funcs,
+                CardState           *state,
+                DFBAccelerationMask  accel )
+{
+     SH7722DriverData       *sdrv     = drv;
+     SH7722DeviceData       *sdev     = dev;
+     StateModificationFlags  modified = state->mod_hw;
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %p, 0x%08x ) <- modified 0x%08x\n",
+                 __FUNCTION__, state, accel, modified );
+
+     DUMP_INFO();
+
+     /*
+      * 1) Invalidate hardware states
+      *
+      * Each modification to the hw independent state invalidates one or more hardware states.
+      */
+
+     /* Simply invalidate all? */
+     if (modified == SMF_ALL) {
+          SH7723_INVALIDATE( ALL );
+     } else if (modified) {
+          /* Invalidate destination registers. */
+          if (modified & SMF_DESTINATION)
+               SH7723_INVALIDATE( DEST | COLOR16 );
+
+          /* Invalidate clipping registers. */
+          if (modified & SMF_CLIP)
+               SH7723_INVALIDATE( CLIP );
+     
+          /* Invalidate color registers. */
+          if (modified & SMF_COLOR)
+               SH7723_INVALIDATE( ALPHA | COLOR16 );
+
+          /* Invalidate source registers. */
+          if (modified & SMF_SOURCE)
+               SH7723_INVALIDATE( SOURCE );
+
+          /* Invalidate source colorkey. */
+          if (modified & SMF_SRC_COLORKEY)
+               SH7723_INVALIDATE( STRANS );
+     }          
+      
+     /*
+      * 2) Validate hardware states
+      *
+      * Each function has its own set of states that need to be validated.
+      */
+
+     /* Always requiring valid destination and clip. */
+     SH7723_CHECK_VALIDATE( DEST_CLIP );
+
+     /* Depending on the function... */
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_FILLTRIANGLE:
+          case DFXL_DRAWLINE:
+               /* ...require valid color. */
+               SH7723_CHECK_VALIDATE( COLOR16 );
+
+               /* If blending is used, validate the alpha value. */
+               if (state->drawingflags & DSDRAW_BLEND)
+                    SH7723_CHECK_VALIDATE( ALPHA );
+               
+               /*
+                * 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 = SH7723_SUPPORTED_DRAWINGFUNCTIONS;
+
+               break;
+
+          case DFXL_BLIT:
+               /* ...require valid source. */
+               SH7723_CHECK_VALIDATE( SOURCE );
+
+               /* If blending is used, validate the alpha value. */
+               if (state->blittingflags & DSBLIT_BLEND_COLORALPHA)
+                    SH7723_CHECK_VALIDATE( ALPHA );
+
+               /* If colorkeying is used, validate the colorkey. */
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    SH7723_CHECK_VALIDATE( STRANS );
+               
+               /*
+                * 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 = SH7723_SUPPORTED_BLITTINGFUNCTIONS;
+
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+
+     }
+
+     sdev->dflags         = state->drawingflags;
+     sdev->bflags         = state->blittingflags;
+     sdev->render_options = state->render_options;
+     sdev->color          = state->color;
+     
+     /*
+      * 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
+sh7723FillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 6 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_BITBLTC | M2DG_DRAWMODE_CLIP;
+
+     if (sdev->dflags & DSDRAW_BLEND) 
+          prep[0] |= M2DG_DRAWMODE_ALPHA;
+
+     prep[1] = 0xcc; 
+     prep[2] = sdev->color16;
+     prep[3] = rect->w - 1;
+     prep[4] = rect->h - 1;
+     prep[5] = SH7723_XY( rect->x, rect->y );
+
+     submit_buffer( sdrv, 6 );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Render rectangle outlines using the current hardware state.
+ */
+bool
+sh7723DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer(sdrv, 8 );
+
+     int x1, x2, y1, y2;
+
+     x1 = rect->x;
+     y1 = rect->y; 
+     x2 = rect->x + rect->w - 1;
+     y2 = rect->y + rect->h - 1;
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %d, %d - %dx%d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( rect ) );
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_LINE_C | M2DG_DRAWMODE_CLIP; 
+
+     if (sdev->dflags & DSDRAW_BLEND) 
+          prep[0] |= M2DG_DRAWMODE_ALPHA;
+
+     prep[1] = (sdev->color16 << 16 ) | 5;
+     prep[2] = 0;
+
+     prep[3] = SH7723_XY( x1, y1 );
+     prep[4] = SH7723_XY( x2, y1 );
+     prep[5] = SH7723_XY( x2, y2 );
+     prep[6] = SH7723_XY( x1, y2 );
+     prep[7] = SH7723_XY( x1, y1 );
+
+     submit_buffer( sdrv, 8 );
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Render a triangle using the current hardware state.
+ */
+bool 
+sh7723FillTriangle( void *drv, void *dev, DFBTriangle *triangle )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 6 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %d, %d - %dx, %d - %d, %d )\n", __FUNCTION__,
+                 DFB_TRIANGLE_VALS( triangle ) );
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_POLYGON_4C | M2DG_DRAWMODE_CLIP;
+
+     if (sdev->dflags & DSDRAW_BLEND) 
+          prep[0] |= M2DG_DRAWMODE_ALPHA;
+
+     prep[1] = sdev->color16;
+
+     prep[2] = SH7723_XY( triangle->x1, triangle->y1 );
+     prep[3] = SH7723_XY( triangle->x2, triangle->y2 );
+     prep[4] = SH7723_XY( triangle->x3, triangle->y3 );
+     prep[5] = SH7723_XY( triangle->x3, triangle->y3 );
+
+     submit_buffer( sdrv, 6 );
+
+     /*
+      * TODO: use rlined to draw the aa'ed outline of a polygon
+      *       if also aval, set blke to 1
+      */
+     
+     
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Render a line with the specified width using the current hardware state.
+ */
+bool
+sh7723DrawLine( void *drv, void *dev, DFBRegion *line )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 5 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %d, %d - %d, %d )\n", __FUNCTION__,
+                 line->x1, line->y1, line->x2, line->y2 );
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_LINE_C | M2DG_DRAWMODE_CLIP;
+
+     if (sdev->render_options & DSRO_ANTIALIAS)
+          prep[0] |= M2DG_DRAWMODE_ANTIALIAS;
+
+     prep[1] = (sdev->color16 << 16) | 2;
+     prep[2] = 0;
+
+     prep[3] = SH7723_XY( line->x1, line->y1 );
+     prep[4] = SH7723_XY( line->x2, line->y2 );
+
+     submit_buffer( sdrv, 5);
+
+     return true;
+}
+
+/*
+ * Blit a rectangle using the current hardware state.
+ */
+bool
+sh7723Blit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     SH7722DriverData *sdrv = drv;
+     SH7722DeviceData *sdev = dev;
+     __u32            *prep = start_buffer( sdrv, 6 );
+
+     D_DEBUG_AT( SH7723_BLT, "%s( %d, %d - %dx%d <- %d, %d )\n", __FUNCTION__,
+                 dx, dy, rect->w, rect->h, rect->x, rect->y );
+     DUMP_INFO();
+
+     prep[0] = M2DG_OPCODE_BITBLTA | M2DG_DRAWMODE_CLIP;
+
+     if (sdev->bflags & DSBLIT_BLEND_COLORALPHA) 
+          prep[0] |= M2DG_DRAWMODE_ALPHA;
+
+     if (sdev->bflags & DSBLIT_SRC_COLORKEY) 
+          prep[0] |= M2DG_DRAWMODE_STRANS;
+
+     if (sdev->src_phys == sdev->dst_phys) {
+          if (dy > rect->y)
+               prep[0] |= M2DG_DRAWMODE_DSTDIR_Y | M2DG_DRAWMODE_SRCDIR_Y;
+          else if (dy == rect->y) {
+               if (dx > rect->x) 
+                    prep[0] |= M2DG_DRAWMODE_DSTDIR_X | M2DG_DRAWMODE_SRCDIR_X;
+          }
+     }
+          
+     prep[1] = 0xcc; 
+     prep[2] = SH7723_XY( rect->x, rect->y );
+     prep[3] = rect->w - 1;
+     prep[4] = rect->h - 1;
+     prep[5] = SH7723_XY( dx, dy );
+
+     submit_buffer( sdrv, 6 );
+
+     return true;
+}
diff --git a/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.h b/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.h
new file mode 100755
index 0000000..182c4b8
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sh772x/sh7723_blt.h
@@ -0,0 +1,239 @@
+#ifndef __SH7723_BLT_H__
+#define __SH7723_BLT_H__
+
+#include <sys/ioctl.h>
+
+#include "sh7722_types.h"
+
+
+
+#define SH7723_SUPPORTED_DRAWINGFLAGS      (DSDRAW_NOFX | DSDRAW_BLEND)
+
+#define SH7723_SUPPORTED_DRAWINGFUNCTIONS  (DFXL_FILLRECTANGLE | \
+                                            DFXL_FILLTRIANGLE  | \
+                                            DFXL_DRAWLINE      | \
+                                            DFXL_DRAWRECTANGLE)
+
+#define SH7723_SUPPORTED_BLITTINGFLAGS     (DSBLIT_BLEND_COLORALPHA | \
+                                            DSBLIT_SRC_COLORKEY)
+
+#define SH7723_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT)
+
+
+DFBResult sh7723EngineSync  ( void *drv, void *dev );
+
+void sh7723EngineReset      ( void *drv, void *dev );
+void sh7723FlushTextureCache( void *drv, void *dev );
+
+void sh7723EmitCommands     ( void *drv, void *dev );
+
+void sh7723CheckState       ( void *drv, void *dev,
+                              CardState *state, DFBAccelerationMask accel );
+
+void sh7723SetState         ( void *drv, void *dev,
+                              GraphicsDeviceFuncs *funcs,
+                              CardState *state, DFBAccelerationMask accel );
+
+bool sh7723FillRectangle    ( void *drv, void *dev, DFBRectangle *rect );
+bool sh7723FillTriangle     ( void *drv, void *dev, DFBTriangle *triangle );
+bool sh7723DrawRectangle    ( void *drv, void *dev, DFBRectangle *rect );
+bool sh7723DrawLine         ( void *drv, void *dev, DFBRegion *line );
+bool sh7723Blit             ( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
+
+#define SH7723_S16S16(h,l)         ((u32)((((u16)(h)) << 16) | ((u16)(l))))
+
+#define SH7723_XY(x,y)             SH7723_S16S16(x,y)
+
+#define	SH7723_TDG_BASE            0xA4680000
+
+//#define	BEM_HC_DMA_START		   (SH7723_TDG_BASE + 0x00044)
+#define	M2DG_SCLR		   (SH7723_TDG_BASE + 0x000)
+//#define	BEM_HC_DMA_ADR			   (SH7723_TDG_BASE + 0x00040)
+#define	M2DG_DLSAR		   (SH7723_TDG_BASE + 0x048)
+
+
+
+
+#define M2DG_OPCODE_TRAP        0x00000000
+#define M2DG_OPCODE_WPR         0x18000000
+#define M2DG_OPCODE_SYNC        0x12000000
+#define M2DG_OPCODE_LCOFS       0x40000000
+#define M2DG_OPCODE_MOVE        0x48000000
+#define M2DG_OPCODE_NOP         0x08000000
+#define M2DG_OPCODE_INTERRUPT   0x08008000
+#define M2DG_SYNC_TCLR          0x00000010
+
+#define M2DG_OPCODE_POLYGON_4C  0x80000000    
+#define M2DG_OPCODE_LINE_C      0xB0000000
+#define M2DG_OPCODE_BITBLTA     0xA2000100
+#define M2DG_OPCODE_BITBLTC     0xA0000000
+
+#define M2DG_DRAWMODE_STRANS    0x00000800
+#define M2DG_DRAWMODE_CLIP      0x00002000
+#define M2DG_DRAWMODE_ANTIALIAS 0x00000002
+#define M2DG_DRAWMODE_ALPHA     0x00000002
+
+#define M2DG_DRAWMODE_SRCDIR_X  0x00000040
+#define M2DG_DRAWMODE_SRCDIR_Y  0x00000020
+#define M2DG_DRAWMODE_DSTDIR_X  0x00000010
+#define M2DG_DRAWMODE_DSTDIR_Y  0x00000008
+
+
+
+//ignore and replace 
+#define	BEM_WR_CTRL                (0x00400)
+#define	BEM_WR_V1                  (0x00410)
+#define	BEM_WR_V2                  (0x00414)
+#define	BEM_WR_FGC                 (0x00420)
+
+#define	BEM_BE_CTRL                (0x00800)
+#define	BEM_BE_V1                  (0x00810)
+#define	BEM_BE_V2                  (0x00814)
+#define	BEM_BE_V3                  (0x00818)
+#define	BEM_BE_V4                  (0x0081C)
+#define	BEM_BE_COLOR1              (0x00820)
+#define	BEM_BE_SRC_LOC             (0x00830)
+#define	BEM_BE_SRC_SIZE            (0x00834)
+#define	BEM_BE_MATRIX_A            (0x00850)
+#define	BEM_BE_MATRIX_B            (0x00854)
+#define	BEM_BE_MATRIX_C            (0x00858)
+#define	BEM_BE_MATRIX_D            (0x0085C)
+#define	BEM_BE_MATRIX_E            (0x00860)
+#define	BEM_BE_MATRIX_F            (0x00864)
+#define	BEM_BE_ORIGIN              (0x00870)
+#define	BEM_BE_SC_MIN              (0x00880)
+#define	BEM_BE_SC_MAX              (0x00884)
+
+#define	BEM_TE_SRC                 (0x00C00)
+#define	BEM_TE_SRC_BASE            (0x00C04)
+#define	BEM_TE_SRC_SIZE            (0x00C08)
+#define	BEM_TE_SRC_CNV             (0x00C0C)
+#define	BEM_TE_MASK                (0x00C10)
+#define	BEM_TE_MASK_BASE           (0x00C14)
+#define	BEM_TE_MASK_SIZE           (0x00C18)
+#define	BEM_TE_MASK_CNV            (0x00C1C)
+#define	BEM_TE_ALPHA               (0x00C28)
+#define	BEM_TE_FILTER              (0x00C30)
+#define	BEM_TE_INVALID             (0x00C40)
+
+#define	BEM_PE_DST                 (0x01000)
+#define	BEM_PE_DST_BASE            (0x01004)
+#define	BEM_PE_DST_SIZE            (0x01008)
+#define	BEM_PE_SC                  (0x0100C)
+#define	BEM_PE_SC0_MIN             (0x01010)
+#define	BEM_PE_SC0_MAX             (0x01014)
+#define	BEM_PE_CKEY                (0x01040)
+#define	BEM_PE_CKEY_B              (0x01044)
+#define	BEM_PE_CKEY_A              (0x01048)
+#define	BEM_PE_COLORCHANGE         (0x01050)
+#define	BEM_PE_ALPHA               (0x01058)
+#define	BEM_PE_COLORCHANGE_0       (0x01060)
+#define	BEM_PE_COLORCHANGE_1       (0x01064)
+#define	BEM_PE_OPERATION           (0x01080)
+#define	BEM_PE_FIXEDALPHA          (0x01084)
+#define	BEM_PE_OFFSET              (0x01088)
+#define	BEM_PE_MASK                (0x01094)
+#define	BEM_PE_CACHE               (0x010B0)
+
+/*
+ * BEM_BE_CTRL
+ */
+#define BE_FLIP_NONE               0x00000000
+#define BE_FLIP_HORIZONTAL         0x01000000
+#define BE_FLIP_VERTICAL           0x02000000
+#define BE_FLIP_BOTH               0x03000000
+
+#define BE_CTRL_FIXMODE_20_12      0x00000000
+#define BE_CTRL_FIXMODE_16_16      0x00100000
+#define BE_CTRL_CLIP               0x00080000
+#define BE_CTRL_ORIGIN             0x00040000
+#define BE_CTRL_ZOOM               0x00020000
+#define BE_CTRL_MATRIX             0x00010000
+
+#define BE_CTRL_SCANMODE_LINE      0x00000000
+#define BE_CTRL_SCANMODE_4x4       0x00001000
+#define BE_CTRL_SCANMODE_8x4       0x00002000
+
+#define BE_CTRL_BLTDIR_FORWARD     0x00000000
+#define BE_CTRL_BLTDIR_BACKWARD    0x00000100
+#define BE_CTRL_BLTDIR_AUTOMATIC   0x00000200
+
+#define BE_CTRL_TEXTURE            0x00000020
+#define BE_CTRL_QUADRANGLE         0x00000002
+#define BE_CTRL_RECTANGLE          0x00000001
+
+/*
+ * BEM_PE_OPERATION
+ */
+#define BLE_FUNC_NONE              0x00000000
+#define BLE_FUNC_AxB_plus_CxD      0x10000000
+#define BLE_FUNC_CxD_minus_AxB     0x20000000
+#define BLE_FUNC_AxB_minus_CxD     0x30000000
+
+#define BLE_ROP_XOR                0x01660000
+
+#define BLE_SRCA_FIXED             0x00000000
+#define BLE_SRCA_SOURCE_ALPHA      0x00001000
+#define BLE_SRCA_ALPHA_CHANNEL     0x00002000
+
+#define BLE_DSTA_FIXED             0x00000000
+#define BLE_DSTA_DEST_ALPHA        0x00000100
+
+#define BLE_SRCF_ZERO              0x00000000
+#define BLE_SRCF_ONE               0x00000010
+#define BLE_SRCF_DST               0x00000020
+#define BLE_SRCF_1_DST             0x00000030
+#define BLE_SRCF_SRC_A             0x00000040
+#define BLE_SRCF_1_SRC_A           0x00000050
+#define BLE_SRCF_DST_A             0x00000060
+#define BLE_SRCF_1_DST_A           0x00000070
+
+#define BLE_DSTO_DST               0x00000000
+#define BLE_DSTO_OFFSET            0x00000008
+
+#define BLE_DSTF_ZERO              0x00000000
+#define BLE_DSTF_ONE               0x00000001
+#define BLE_DSTF_SRC               0x00000002
+#define BLE_DSTF_1_SRC             0x00000003
+#define BLE_DSTF_SRC_A             0x00000004
+#define BLE_DSTF_1_SRC_A           0x00000005
+#define BLE_DSTF_DST_A             0x00000006
+#define BLE_DSTF_1_DST_A           0x00000007
+
+/*
+ * BEM_PE_CKEY
+ */
+#define CKEY_EXCLUDE_UNUSED        0x00100000
+#define CKEY_EXCLUDE_ALPHA         0x00010000
+#define CKEY_A_ENABLE              0x00000100
+#define CKEY_B_ENABLE              0x00000001
+
+/*
+ * BEM_PE_COLORCHANGE
+ */
+#define COLORCHANGE_DISABLE        0x00000000
+#define COLORCHANGE_COMPARE_FIRST  0x0000000b
+#define COLORCHANGE_EXCLUDE_UNUSED 0x00010000
+
+/*
+ * BEM_PE_MASK
+ */
+#define PE_MASK_DISABLE            0x00000000
+#define PE_MASK_COLOR              0x00000001
+#define PE_MASK_ALPHA              0x00000080
+
+/*
+ * BEM_TE_MASK
+ */
+#define TE_MASK_DISABLE            0x00000000
+#define TE_MASK_ENABLE             0x00010000
+
+/*
+ * BEM_WR_CTRL
+ */
+#define WR_CTRL_LINE               0x00000002
+#define WR_CTRL_POLYLINE           0x00000003
+#define WR_CTRL_ANTIALIAS          0x00020100
+#define WR_CTRL_ENDPOINT           0x00001000
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sis315/Makefile.am b/Source/DirectFB/gfxdrivers/sis315/Makefile.am
new file mode 100755
index 0000000..de0b424
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/Makefile.am
@@ -0,0 +1,42 @@
+## Makefile.am for DirectFB/src/core/gfxcards/sis315
+
+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
+
+sis315_LTLIBRARIES = libdirectfb_sis315.la
+
+if BUILD_STATIC
+sis315_DATA = $(sis315_LTLIBRARIES:.la=.o)
+endif
+
+sis315dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_sis315_la_SOURCES =	\
+	sis315.c		\
+	sis315.h		\
+	sis315_accel.c		\
+	sis315_accel.h		\
+	sis315_compat.h		\
+	sis315_mmio.c		\
+	sis315_mmio.h		\
+	sis315_regs.h		\
+	sis315_state.c		\
+	sis315_state.h
+
+libdirectfb_sis315_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sis315_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/sis315/Makefile.in b/Source/DirectFB/gfxdrivers/sis315/Makefile.in
new file mode 100755
index 0000000..e41ae8e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/Makefile.in
@@ -0,0 +1,607 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = gfxdrivers/sis315
+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)$(sis315dir)" "$(DESTDIR)$(sis315dir)"
+sis315LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(sis315_LTLIBRARIES)
+libdirectfb_sis315_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_sis315_la_OBJECTS = sis315.lo sis315_accel.lo \
+	sis315_mmio.lo sis315_state.lo
+libdirectfb_sis315_la_OBJECTS = $(am_libdirectfb_sis315_la_OBJECTS)
+libdirectfb_sis315_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_sis315_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_sis315_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_sis315_la_SOURCES)
+sis315DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(sis315_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
+
+sis315_LTLIBRARIES = libdirectfb_sis315.la
+@BUILD_STATIC_TRUE@sis315_DATA = $(sis315_LTLIBRARIES:.la=.o)
+sis315dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_sis315_la_SOURCES = \
+	sis315.c		\
+	sis315.h		\
+	sis315_accel.c		\
+	sis315_accel.h		\
+	sis315_compat.h		\
+	sis315_mmio.c		\
+	sis315_mmio.h		\
+	sis315_regs.h		\
+	sis315_state.c		\
+	sis315_state.h
+
+libdirectfb_sis315_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sis315_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/sis315/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/sis315/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-sis315LTLIBRARIES: $(sis315_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(sis315dir)" || $(MKDIR_P) "$(DESTDIR)$(sis315dir)"
+	@list='$(sis315_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sis315LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(sis315dir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sis315LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(sis315dir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-sis315LTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sis315_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(sis315dir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(sis315dir)/$$p"; \
+	done
+
+clean-sis315LTLIBRARIES:
+	-test -z "$(sis315_LTLIBRARIES)" || rm -f $(sis315_LTLIBRARIES)
+	@list='$(sis315_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_sis315.la: $(libdirectfb_sis315_la_OBJECTS) $(libdirectfb_sis315_la_DEPENDENCIES) 
+	$(libdirectfb_sis315_la_LINK) -rpath $(sis315dir) $(libdirectfb_sis315_la_OBJECTS) $(libdirectfb_sis315_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis315.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis315_accel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis315_mmio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis315_state.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-sis315DATA: $(sis315_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(sis315dir)" || $(MKDIR_P) "$(DESTDIR)$(sis315dir)"
+	@list='$(sis315_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(sis315DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sis315dir)/$$f'"; \
+	  $(sis315DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sis315dir)/$$f"; \
+	done
+
+uninstall-sis315DATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sis315_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(sis315dir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(sis315dir)/$$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)$(sis315dir)" "$(DESTDIR)$(sis315dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-sis315LTLIBRARIES \
+	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-sis315DATA install-sis315LTLIBRARIES
+
+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-sis315DATA uninstall-sis315LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-sis315LTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-sis315DATA install-sis315LTLIBRARIES 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-sis315DATA \
+	uninstall-sis315LTLIBRARIES
+
+%.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/sis315/sis315.c b/Source/DirectFB/gfxdrivers/sis315/sis315.c
new file mode 100755
index 0000000..4717fe7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315.c
@@ -0,0 +1,355 @@
+/*
+ * $Id: sis315.c,v 1.20 2007-01-29 01:00:45 dok Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 <stdio.h>
+#include <sys/ioctl.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 <directfb.h>
+
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <core/gfxcard.h>
+#include <core/graphics_driver.h>
+#include <core/state.h>
+#include <core/surface.h>
+
+#include <fbdev/fbdev.h>
+
+#include "sis315.h"
+#include "sis315_accel.h"
+#include "sis315_compat.h"
+#include "sis315_state.h"
+
+DFB_GRAPHICS_DRIVER(sis315);
+
+#define SIS_SUPPORTED_DRAWING_FUNCTIONS		\
+	(DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE | DFXL_DRAWLINE)
+#define SIS_SUPPORTED_DRAWING_FLAGS		\
+	(DSDRAW_NOFX)
+#define SIS_SUPPORTED_BLITTING_FUNCTIONS	\
+	(DFXL_BLIT | DFXL_STRETCHBLIT)
+#define SIS_SUPPORTED_BLITTING_FLAGS		\
+	(DSBLIT_SRC_COLORKEY)
+
+static DFBResult sis_engine_sync(void *driver_data, void *device_data)
+{
+	(void)driver_data;
+	(void)device_data;
+
+	/*
+	 * this driver syncs after every command,
+	 * so this function can be left empty
+	 */
+
+    return DFB_OK;
+}
+
+static void sis_check_state(void *driver_data, void *device_data,
+			    CardState *state, DFBAccelerationMask accel)
+{
+	(void)driver_data;
+	(void)device_data;
+
+	switch (state->destination->config.format) {
+	case DSPF_LUT8:
+	case DSPF_ARGB1555:
+	case DSPF_RGB16:
+	case DSPF_RGB32:
+	case DSPF_ARGB:
+		break;
+	default:
+		return;
+	}
+
+	if (DFB_DRAWING_FUNCTION(accel)) {
+		if (state->drawingflags & ~SIS_SUPPORTED_DRAWING_FLAGS)
+			return;
+		if (accel & DFXL_FILLTRIANGLE) {
+			/* this is faster. don't know why. */
+			state->accel = 0;
+			return;
+		}
+		state->accel |= SIS_SUPPORTED_DRAWING_FUNCTIONS;
+	}
+	else {
+		if (state->blittingflags & ~SIS_SUPPORTED_BLITTING_FLAGS)
+			return;
+
+		switch (state->source->config.format) {
+		case DSPF_LUT8:
+		case DSPF_ARGB1555:
+		case DSPF_RGB16:
+		case DSPF_RGB32:
+		case DSPF_ARGB:
+			break;
+		default:
+			return;
+		}
+
+		if (state->source->config.format != state->destination->config.format)
+			return;
+
+		state->accel |= SIS_SUPPORTED_BLITTING_FUNCTIONS;
+	}
+}
+
+static void sis_set_state(void *driver_data, void *device_data,
+			  GraphicsDeviceFuncs *funcs, CardState *state,
+			  DFBAccelerationMask accel)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	(void)funcs;
+
+	if (state->mod_hw) {
+		if (state->mod_hw & SMF_SOURCE)
+			dev->v_source = 0;
+
+		if (state->mod_hw & SMF_DESTINATION)
+			dev->v_color = dev->v_destination = 0;
+		else if (state->mod_hw & SMF_COLOR)
+			dev->v_color = 0;
+
+		if (state->mod_hw & SMF_SRC_COLORKEY)
+			dev->v_src_colorkey = 0;
+
+//		if (state->mod_hw & SMF_BLITTING_FLAGS)
+//			dev->v_blittingflags = 0;
+	}
+
+	switch (accel) {
+	case DFXL_FILLRECTANGLE:
+	case DFXL_DRAWRECTANGLE:
+	case DFXL_DRAWLINE:
+		sis_validate_dst(drv, dev, state);
+		sis_validate_color(drv, dev, state);
+		state->set = SIS_SUPPORTED_DRAWING_FUNCTIONS;
+		break;
+	case DFXL_BLIT:
+		sis_validate_src(drv, dev, state);
+		sis_validate_dst(drv, dev, state);
+		if (state->blittingflags & DSBLIT_DST_COLORKEY)
+			sis_set_dst_colorkey(drv, dev, state);
+		if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+			sis_set_src_colorkey(drv, dev, state);
+		state->set = SIS_SUPPORTED_BLITTING_FUNCTIONS;
+		break;
+	case DFXL_STRETCHBLIT:
+		sis_validate_src(drv, dev, state);
+		sis_validate_dst(drv, dev, state);
+		if (state->blittingflags & DSBLIT_DST_COLORKEY)
+			sis_set_dst_colorkey(drv, dev, state);
+		if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+			sis_set_src_colorkey(drv, dev, state);
+		state->set = DFXL_STRETCHBLIT;
+		break;
+	default:
+		D_BUG("unexpected drawing or blitting function");
+		break;
+	}
+
+	if ((state->mod_hw & SMF_CLIP) && (accel!=DFXL_STRETCHBLIT))
+		sis_set_clip(drv, &state->clip);
+
+	state->mod_hw = 0;
+}
+
+static void check_sisfb_version(SiSDriverData *drv, const struct sisfb_info *i)
+{
+	u32 sisfb_version = SISFB_VERSION(i->sisfb_version,
+					  i->sisfb_revision,
+					  i->sisfb_patchlevel);
+
+	if (sisfb_version < SISFB_VERSION(1, 6, 23)) {
+		fprintf(stderr, "*** Warning: sisfb version < 1.6.23 detected, "
+				"please update your driver! ***\n");
+		drv->has_auto_maximize = false;
+	}
+	else {
+		drv->has_auto_maximize = true;
+	}
+}
+
+/*
+ * exported symbols...
+ */
+
+static int driver_probe(CoreGraphicsDevice *device)
+{
+	switch (dfb_gfxcard_get_accelerator(device)) {
+	case FB_ACCEL_SIS_GLAMOUR_2:
+	case FB_ACCEL_SIS_XABRE:
+	case FB_ACCEL_XGI_VOLARI_Z:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+static void driver_get_info(CoreGraphicsDevice *device,
+			    GraphicsDriverInfo *info)
+{
+	(void)device;
+
+	snprintf(info->name, DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+			"SiS 315 Driver");
+	snprintf(info->vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+			"Andreas Oberritter <obi@saftware.de>");
+
+	info->version.major = 0;
+	info->version.minor = 1;
+
+	info->driver_data_size = sizeof(SiSDriverData);
+	info->device_data_size = sizeof(SiSDeviceData);
+}
+
+static DFBResult driver_init_driver(CoreGraphicsDevice *device,
+				    GraphicsDeviceFuncs *funcs,
+				    void *driver_data,
+				    void *device_data,
+                    CoreDFB *core)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	FBDev *dfb_fbdev;
+	struct sisfb_info *fbinfo;
+	u32 fbinfo_size;
+	u32 zero = 0;
+
+	(void)device_data;
+
+	dfb_fbdev = dfb_system_data();
+	if (!dfb_fbdev)
+		return DFB_IO;
+
+	if (ioctl(dfb_fbdev->fd, SISFB_GET_INFO_SIZE, &fbinfo_size) == 0) {
+		fbinfo = D_MALLOC(fbinfo_size);
+		drv->get_info = SISFB_GET_INFO | (fbinfo_size << 16);
+		drv->get_automaximize = SISFB_GET_AUTOMAXIMIZE;
+		drv->set_automaximize = SISFB_SET_AUTOMAXIMIZE;
+	}
+	else {
+		fbinfo = D_MALLOC(sizeof(struct sisfb_info));
+		drv->get_info = SISFB_GET_INFO_OLD;
+		drv->get_automaximize = SISFB_GET_AUTOMAXIMIZE_OLD;
+		drv->set_automaximize = SISFB_SET_AUTOMAXIMIZE_OLD;
+	}
+
+	if (fbinfo == NULL)
+		return DFB_NOSYSTEMMEMORY;
+
+	if (ioctl(dfb_fbdev->fd, drv->get_info, fbinfo) == -1) {
+		D_FREE(fbinfo);
+		return DFB_IO;
+	}
+
+	check_sisfb_version(drv, fbinfo);
+
+	D_FREE(fbinfo);
+
+	if (drv->has_auto_maximize) {
+		if (ioctl(dfb_fbdev->fd, drv->get_automaximize, &drv->auto_maximize))
+			return DFB_IO;
+		if (drv->auto_maximize)
+			if (ioctl(dfb_fbdev->fd, drv->set_automaximize, &zero))
+				return DFB_IO;
+	}
+
+	drv->mmio_base = dfb_gfxcard_map_mmio(device, 0, -1);
+	if (!drv->mmio_base)
+		return DFB_IO;
+
+	/* base functions */
+	funcs->EngineSync = sis_engine_sync;
+	funcs->CheckState = sis_check_state;
+	funcs->SetState = sis_set_state;
+
+	/* drawing functions */
+	funcs->FillRectangle = sis_fill_rectangle;
+	funcs->DrawRectangle = sis_draw_rectangle;
+	funcs->DrawLine = sis_draw_line;
+
+	/* blitting functions */
+	funcs->Blit = sis_blit;
+	funcs->StretchBlit = sis_stretchblit;
+
+	/* allocate buffer for stretchBlit with colorkey */
+	drv->buffer_offset = dfb_gfxcard_reserve_memory( device, 1024*768*4 );
+
+	return DFB_OK;
+}
+
+static DFBResult driver_init_device(CoreGraphicsDevice *device,
+				    GraphicsDeviceInfo *device_info,
+				    void *driver_data,
+				    void *device_data)
+{
+	(void)device;
+	(void)driver_data;
+	(void)device_data;
+
+	snprintf(device_info->name,
+			DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "315");
+	snprintf(device_info->vendor,
+			DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "SiS");
+
+	device_info->caps.flags = CCF_CLIPPING;
+	device_info->caps.accel = SIS_SUPPORTED_DRAWING_FUNCTIONS |
+				SIS_SUPPORTED_BLITTING_FUNCTIONS;
+	device_info->caps.drawing = SIS_SUPPORTED_DRAWING_FLAGS;
+	device_info->caps.blitting = SIS_SUPPORTED_BLITTING_FLAGS;
+
+	device_info->limits.surface_byteoffset_alignment = 32 * 4;
+	device_info->limits.surface_pixelpitch_alignment = 32;
+
+	return DFB_OK;
+}
+
+static void driver_close_device(CoreGraphicsDevice *device,
+				void *driver_data,
+				void *device_data)
+{
+	(void)device;
+	(void)driver_data;
+	(void)device_data;
+}
+
+static void driver_close_driver(CoreGraphicsDevice *device,
+				void *driver_data)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+
+	dfb_gfxcard_unmap_mmio(device, drv->mmio_base, -1);
+
+	if ((drv->has_auto_maximize) && (drv->auto_maximize)) {
+		FBDev *dfb_fbdev = dfb_system_data();
+		if (!dfb_fbdev)
+			return;
+		ioctl(dfb_fbdev->fd, drv->set_automaximize, &drv->auto_maximize);
+	}
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315.h b/Source/DirectFB/gfxdrivers/sis315/sis315.h
new file mode 100755
index 0000000..e8b3632
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315.h
@@ -0,0 +1,59 @@
+/*
+ * $Id: sis315.h,v 1.6 2006-11-28 10:53:42 klan Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 _SIS315_H
+#define _SIS315_H
+
+#include <direct/types.h>
+
+typedef struct {
+	volatile u8 *mmio_base;
+	bool has_auto_maximize;
+	u32 auto_maximize;
+	/* ioctls */
+	int get_info;
+	int get_automaximize;
+	int set_automaximize;
+	unsigned long buffer_offset;
+} SiSDriverData;
+
+typedef struct {
+	/* state validation */
+	int v_blittingflags;
+	int v_color;
+	int v_destination;
+	int v_source;
+	int v_dst_colorkey;
+	int v_src_colorkey;
+
+	/* stored values */
+	int blit_cmd;
+	int blit_rop;
+	int cmd_bpp;
+	int color;
+	int src_offset;
+	int src_pitch;
+	int dst_offset;
+	int dst_pitch;
+} SiSDeviceData;
+
+#endif /* _SIS315_H */
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_accel.c b/Source/DirectFB/gfxdrivers/sis315/sis315_accel.c
new file mode 100755
index 0000000..99e5489
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_accel.c
@@ -0,0 +1,250 @@
+/*
+ * $Id: sis315_accel.c,v 1.4 2006-10-29 23:24:50 dok Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 <directfb.h>
+#include <core/coredefs.h>
+
+#include "sis315.h"
+#include "sis315_mmio.h"
+#include "sis315_regs.h"
+
+static void dump_cmd(SiSDriverData *drv)
+{
+	int i;
+	fprintf(stderr,"MMIO8200--MMIO8240 \n");
+	for( i = 0x8200 ; i < 0x8240 ; i+=0x10 )
+	{
+		fprintf(stderr,"[%04X]: %08lX %08lX %08lX %08lX\n",i,
+				sis_rl(drv->mmio_base, i),
+				sis_rl(drv->mmio_base, i+4),
+				sis_rl(drv->mmio_base, i+8),
+				sis_rl(drv->mmio_base, i+12));
+	}
+}
+
+
+static void sis_idle(SiSDriverData *drv)
+{
+	while (!(sis_rl(drv->mmio_base, SIS315_2D_CMD_QUEUE_STATUS) & 0x80000000));
+}
+
+static void sis_cmd(SiSDriverData *drv, SiSDeviceData *dev, u8 pat, u8 src, u32 type, u8 rop)
+{
+	sis_wl(drv->mmio_base, SIS315_2D_CMD, SIS315_2D_CMD_RECT_CLIP_EN |
+					      dev->cmd_bpp | (rop << 8) |
+					      pat | src | type);
+
+	sis_wl(drv->mmio_base, SIS315_2D_FIRE_TRIGGER, 0);
+	/* dump_cmd(drv); */
+	sis_idle(drv);
+}
+
+bool sis_fill_rectangle(void *driver_data, void *device_data, DFBRectangle *rect)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	sis_wl(drv->mmio_base, SIS315_2D_DST_Y, (rect->x << 16) | rect->y);
+	sis_wl(drv->mmio_base, SIS315_2D_RECT_WIDTH, (rect->h << 16) | rect->w);
+
+	sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+			  SIS315_2D_CMD_SRC_VIDEO,
+			  SIS315_2D_CMD_BITBLT,
+			  SIS315_ROP_COPY_PAT);
+
+	return true;
+}
+
+bool sis_draw_rectangle(void *driver_data, void *device_data, DFBRectangle *rect)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	/* from top left ... */
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X0, (rect->y << 16) | rect->x);
+	/* ... to top right ... */
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X1, (rect->y << 16) | (rect->x + rect->w - 1));
+	/* ... to bottom right ... */
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X(2), ((rect->y + rect->h - 1) << 16) | (rect->x + rect->w - 1));
+	/* ... to bottom left ... */
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X(3), ((rect->y + rect->h - 1) << 16) | rect->x);
+	/* ... and back to top left */
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X(4), ((rect->y + 1) << 16) | rect->x);
+
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_COUNT, 4);
+
+	sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+			  SIS315_2D_CMD_SRC_VIDEO,
+			  SIS315_2D_CMD_LINE_DRAW,
+			  SIS315_ROP_COPY_PAT);
+
+	return true;
+}
+
+bool sis_draw_line(void *driver_data, void *device_data, DFBRegion *line)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X0, (line->y1 << 16) | line->x1);
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_X1, (line->y2 << 16) | line->x2);
+	sis_wl(drv->mmio_base, SIS315_2D_LINE_COUNT, 1);
+
+	sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+			  SIS315_2D_CMD_SRC_VIDEO,
+			  SIS315_2D_CMD_LINE_DRAW,
+			  SIS315_ROP_COPY_PAT);
+
+	return true;
+}
+
+bool sis_blit(void *driver_data, void *device_data, DFBRectangle *rect, int dx, int dy)
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	sis_wl(drv->mmio_base, SIS315_2D_SRC_Y, (rect->x << 16) | rect->y);
+	sis_wl(drv->mmio_base, SIS315_2D_DST_Y, (dx << 16) | (dy & 0xffff) );
+	sis_wl(drv->mmio_base, SIS315_2D_RECT_WIDTH, (rect->h << 16) | rect->w);
+
+	if (dev->v_src_colorkey) {
+	    sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+		        SIS315_2D_CMD_SRC_VIDEO,
+			    SIS315_2D_CMD_TRANSPARENT_BITBLT,
+			    SIS315_ROP_AND_INVERTED_PAT);
+	}
+	else {
+    	sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+			  SIS315_2D_CMD_SRC_VIDEO,
+			  SIS315_2D_CMD_BITBLT,
+			  SIS315_ROP_COPY);
+	}
+
+	return true;
+}
+
+bool sis_stretchblit(void *driver_data, void *device_data, DFBRectangle *sr, DFBRectangle *dr )
+{
+	SiSDriverData *drv = (SiSDriverData *)driver_data;
+	SiSDeviceData *dev = (SiSDeviceData *)device_data;
+
+	long           lDstWidth, lDstHeight, lSrcWidth, lSrcHeight;
+	long           lSmallWidth, lLargeWidth, lSmallHeight, lLargeHeight;
+	long           lXInitErr, lYInitErr;
+	unsigned long  dst_offset, src_offset, src_pitch, dst_pitch, src_colorkey;   
+
+	if((dr->w > 0xfff)|(dr->h > 0xfff))
+		return false;
+
+	lSrcWidth  = sr->w;
+	lDstWidth  = dr->w;
+	lSrcHeight = sr->h;
+	lDstHeight = dr->h;
+
+	if(lDstWidth > lSrcWidth)
+	{
+		lLargeWidth = lDstWidth;
+		lSmallWidth = lSrcWidth;
+		lXInitErr   = 3 * lSrcWidth - 2 * lDstWidth;
+	}
+	else
+	{
+		lLargeWidth = lSrcWidth;
+		lSmallWidth = lDstWidth;
+		lXInitErr   = lDstWidth;     //HW design
+	}
+
+	if(lDstHeight > lSrcHeight)
+	{
+		lLargeHeight = lDstHeight;
+		lSmallHeight = lSrcHeight;
+		lYInitErr    = 3 * lSrcHeight - 2 * lDstHeight;
+	}
+	else
+	{
+		lLargeHeight = lSrcHeight;
+		lSmallHeight = lDstHeight;
+		lYInitErr    = lDstHeight;   //HW design
+	}
+
+	src_colorkey = sis_rl(drv->mmio_base, SIS315_2D_TRANS_SRC_KEY_HIGH);
+
+	sis_wl(drv->mmio_base, 0x8208, (sr->x << 16) | sr->y & 0xFFFF);
+	sis_wl(drv->mmio_base, 0x820C, ( dr->x << 16) | dr->y & 0xFFFF);
+
+	sis_wl(drv->mmio_base, 0x8218, (dr->h << 16) | dr->w & 0x0FFF);
+	sis_wl(drv->mmio_base, 0x821c, (sr->h << 16) | sr->w & 0x0FFF);
+
+	sis_wl(drv->mmio_base, 0x8220, ((((lSmallWidth - lLargeWidth) * 2) << 16 ) | ((lSmallWidth * 2) & 0xFFFF)));
+	sis_wl(drv->mmio_base, 0x8224, ((((lSmallHeight - lLargeHeight) * 2) << 16 ) | ((lSmallHeight * 2) & 0xFFFF)));
+	sis_wl(drv->mmio_base, 0x8228, ((lYInitErr << 16) | (lXInitErr & 0xFFFF)));
+
+	dev->blit_cmd = SIS_2D_CMD_DST_Y_INC | SIS_2D_CMD_SRC_X_INC \
+	              | SIS_2D_CMD_SRC_Y_INC | SIS_2D_CMD_DST_X_INC | SIS315_2D_CMD_STRETCH_BITBLT;
+
+	if(dev->v_src_colorkey) /* DSBLIT_SRC_COLORKEY */
+	{
+		dst_offset = sis_rl(drv->mmio_base, SIS315_2D_DST_ADDR);
+		src_offset = sis_rl(drv->mmio_base, SIS315_2D_SRC_ADDR);
+		src_pitch  = sis_rl(drv->mmio_base, 0x8204);
+		dst_pitch  = sis_rl(drv->mmio_base, 0x8214);
+
+		/* drv->buffer_offset reserve 1024x768x4 at driver_init_driver() in sis315.c */
+		sis_wl(drv->mmio_base, SIS315_2D_DST_ADDR, drv->buffer_offset);
+		sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+				  SIS315_2D_CMD_SRC_VIDEO,
+				  dev->blit_cmd,
+				  SIS315_ROP_COPY);
+
+		sis_wl(drv->mmio_base, SIS315_2D_SRC_ADDR, drv->buffer_offset);
+		sis_wl(drv->mmio_base, SIS315_2D_DST_ADDR, dst_offset);
+		sis_wl(drv->mmio_base, 0x8204, dst_pitch);
+		sis_wl(drv->mmio_base, SIS315_2D_SRC_Y, (dr->x << 16) | dr->y);
+		sis_wl(drv->mmio_base, SIS315_2D_DST_Y, (dr->x << 16) | (dr->y & 0xffff));
+		sis_wl(drv->mmio_base, SIS315_2D_RECT_WIDTH, (dr->h << 16) | dr->w);
+
+		sis_wl(drv->mmio_base, SIS315_2D_TRANS_SRC_KEY_HIGH, src_colorkey);
+		sis_wl(drv->mmio_base, SIS315_2D_TRANS_SRC_KEY_LOW, src_colorkey);
+
+        
+		sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+				  SIS315_2D_CMD_SRC_VIDEO,
+				  SIS315_2D_CMD_TRANSPARENT_BITBLT,
+				  SIS315_ROP_AND_INVERTED_PAT);
+
+		sis_wl(drv->mmio_base, SIS315_2D_SRC_ADDR, src_offset); /*restore*/
+		sis_wl(drv->mmio_base, 0x8204, src_pitch);
+	}
+	else /*simple stretch bitblt */
+	{
+
+		//fprintf(stderr,"dev->blit_cmd = %x \n",dev->blit_cmd);
+		sis_cmd(drv, dev, SIS315_2D_CMD_PAT_FG_REG,
+				  SIS315_2D_CMD_SRC_VIDEO,
+				  dev->blit_cmd,
+				  SIS315_ROP_COPY);
+	}
+
+	return true;
+}
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_accel.h b/Source/DirectFB/gfxdrivers/sis315/sis315_accel.h
new file mode 100755
index 0000000..11ead88
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_accel.h
@@ -0,0 +1,32 @@
+/*
+ * $Id: sis315_accel.h,v 1.2 2006-10-29 23:24:50 dok Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 _SIS315_ACCEL_H
+#define _SIS315_ACCEL_H
+
+bool sis_fill_rectangle(void *driver_data, void *device_data, DFBRectangle *rect);
+bool sis_draw_rectangle(void *driver_data, void *device_data, DFBRectangle *rect);
+bool sis_draw_line(void *driver_data, void *device_data, DFBRegion *line);
+bool sis_blit(void *driver_data, void *device_data, DFBRectangle *rect, int dx, int dy);
+bool sis_stretchblit(void *driver_data, void *device_data, DFBRectangle *sr, DFBRectangle *dr );
+
+#endif /* _SIS315_ACCEL_H */
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_compat.h b/Source/DirectFB/gfxdrivers/sis315/sis315_compat.h
new file mode 100755
index 0000000..c6f33da
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_compat.h
@@ -0,0 +1,89 @@
+#ifndef _SIS315_COMPAT_H
+#define _SIS315_COMPAT_H
+
+#include <dfb_types.h>
+
+#include <fbdev/fb.h>
+
+#ifndef FB_ACCEL_SIS_GLAMOUR_2
+#define FB_ACCEL_SIS_GLAMOUR_2  40     /* SiS 315, 650, 740            */
+#endif
+#ifndef FB_ACCEL_SIS_XABRE
+#define FB_ACCEL_SIS_XABRE      41     /* SiS 330 ("Xabre")            */
+#endif
+#ifndef FB_ACCEL_XGI_VOLARI_Z
+#define FB_ACCEL_XGI_VOLARI_Z   48     /* Z7 Z9                        */
+#endif
+
+struct sisfb_info {
+     u32     sisfb_id;          /* for identifying sisfb */
+#ifndef SISFB_ID
+#define SISFB_ID       0x53495346    /* Identify myself with 'SISF' */
+#endif
+     u32     chip_id;          /* PCI-ID of detected chip */
+     u32     memory;               /* total video memory in KB */
+     u32     heapstart;          /* heap start offset in KB */
+     u8      fbvidmode;          /* current sisfb mode */
+
+     u8      sisfb_version;
+     u8      sisfb_revision;
+     u8      sisfb_patchlevel;
+
+     u8      sisfb_caps;          /* sisfb capabilities */
+
+     u32     sisfb_tqlen;          /* turbo queue length (in KB) */
+
+     u32     sisfb_pcibus;          /* The card's PCI ID */
+     u32     sisfb_pcislot;
+     u32     sisfb_pcifunc;
+
+     u8      sisfb_lcdpdc;          /* PanelDelayCompensation */
+
+     u8      sisfb_lcda;          /* Detected status of LCDA for low res/text modes */
+
+     u32     sisfb_vbflags;
+     u32     sisfb_currentvbflags;
+
+     u32     sisfb_scalelcd;
+     u32     sisfb_specialtiming;
+
+     u8      sisfb_haveemi;
+     u8      sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
+     u8      sisfb_haveemilcd;
+
+     u8      sisfb_lcdpdca;          /* PanelDelayCompensation for LCD-via-CRT1 */
+
+     u16     sisfb_tvxpos, sisfb_tvypos;     /* Warning: Values + 32 ! */
+
+     u32     sisfb_heapsize;          /* heap size (in KB) */
+     u32     sisfb_videooffset;     /* Offset of viewport in video memory (in bytes) */
+
+     u32     sisfb_curfstn;          /* currently running FSTN/DSTN mode */
+     u32     sisfb_curdstn;
+
+     u16     sisfb_pci_vendor;     /* PCI vendor (SiS or XGI) */
+
+     u32     sisfb_vbflags2;          /* ivideo->vbflags2 */
+
+     u8      sisfb_can_post;          /* sisfb can POST this card */
+     u8      sisfb_card_posted;     /* card is POSTED */
+     u8      sisfb_was_boot_device;     /* This card was the boot video device (ie is primary) */
+
+     u8      reserved[183];          /* for future use */
+};
+
+#define SISFB_GET_INFO_SIZE        _IOR(0xF3,0x00,u32)
+
+#define SISFB_GET_INFO             _IOR(0xF3,0x01,struct sisfb_info)
+#define SISFB_GET_AUTOMAXIMIZE     _IOR(0xF3,0x03,u32)
+#define SISFB_SET_AUTOMAXIMIZE     _IOW(0xF3,0x03,u32)
+
+#define SISFB_GET_INFO_OLD         _IOR('n',0xF8,u32)
+#define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,u32)
+#define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,u32)
+
+
+#define SISFB_VERSION(a,b,c)     (((a) << 16) + ((b) << 8) + (c))
+
+
+#endif /* _SIS315_COMPAT_H */
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.c b/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.c
new file mode 100755
index 0000000..415ea0b
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.c
@@ -0,0 +1,51 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 "sis315_mmio.h"
+#include "direct/util.h"
+
+u32 sis_rl(volatile u8 *mmio, unsigned int offset)
+{
+#ifdef WORDS_BIGENDIAN
+     u32 r = *(volatile u32 *)(mmio + offset);
+     return BSWAP32(r);
+#else
+	return *(volatile u32 *)(mmio + offset);
+#endif
+}
+
+void sis_wl(volatile u8 *mmio, unsigned int offset, u32 value)
+{
+#ifdef WORDS_BIGENDIAN
+	*(volatile u32 *)(mmio + offset) = BSWAP32(value);
+#else
+	*(volatile u32 *)(mmio + offset) = value;
+#endif
+}
+
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.h b/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.h
new file mode 100755
index 0000000..42de5f0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_mmio.h
@@ -0,0 +1,37 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 _SIS315_MMIO_H
+#define _SIS315_MMIO_H
+
+#include <dfb_types.h>
+
+extern __inline__ u32 sis_rl(volatile u8 *mmio, unsigned int offset);
+extern __inline__ void sis_wl(volatile u8 *mmio, unsigned int offset, u32 value);
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_regs.h b/Source/DirectFB/gfxdrivers/sis315/sis315_regs.h
new file mode 100755
index 0000000..25ff40d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_regs.h
@@ -0,0 +1,161 @@
+#ifndef _SIS315_REGS_H
+#define _SIS315_REGS_H
+
+#define PAT_REG_SIZE 384
+
+enum sisfb_raster_op_bitblt {
+	SIS315_ROP_CLEAR		= 0x00, /* dst =    0,            0    */
+	SIS315_ROP_AND			= 0x88, /* dst =  dst &  src,     DSa  */
+	SIS315_RON_AND_REVERSE		= 0x44, /* dst = ~dst &  src,     SDna */
+	SIS315_ROP_COPY			= 0xCC, /* dst =  src,            S    */
+	SIS315_ROP_AND_INVERTED		= 0x22, /* dst =  dst & ~src,     DSna */
+	SIS315_ROP_NOOP			= 0xAA, /* dst =  dst,            D    */
+	SIS315_ROP_XOR			= 0x66, /* dst =  dst ^  src,     DSx  */
+	SIS315_ROP_OR			= 0xEE, /* dst =  dst |  src,     DSo  */
+	SIS315_ROP_NOR			= 0x11, /* dst =  ~(dst | src),   DSon */
+	SIS315_ROP_EQUIV		= 0x99, /* dst =  dst ^ ~src,     DSxn */
+	SIS315_ROP_INVERT  		= 0x55, /* dst = ~dst,            Dn   */
+	SIS315_ROP_OR_INVERSE		= 0xDD, /* dst = ~dst | src,      SDno */
+	SIS315_ROP_COPY_INVERTED	= 0x33, /* dst = ~src,            Sn   */
+	SIS315_ROP_OR_INVERTED		= 0xBB, /* dst = ~src | dst,      DSno */
+	SIS315_ROP_NAND			= 0x77, /* dst = ~(dst & src),    DSan */
+	SIS315_ROP_SET			= 0xFF, /* dst =    1,            1    */
+
+	/* same as above, but with pattern as source */
+	SIS315_ROP_CLEAR_PAT		= 0x00, /* dst =    0,            0    */
+	SIS315_ROP_AND_PAT		= 0xA0, /* dst =  dst &  src,     DSa  */
+	SIS315_RON_AND_REVERSE_PAT	= 0x50, /* dst = ~dst &  src,     SDna */
+	SIS315_ROP_COPY_PAT		= 0xF0, /* dst =  src,            S    */
+	SIS315_ROP_AND_INVERTED_PAT	= 0x0A, /* dst =  dst & ~src,     DSna */
+	SIS315_ROP_NOOP_PAT		= 0xAA, /* dst =  dst,            D    */
+	SIS315_ROP_XOR_PAT		= 0x5A, /* dst =  dst ^  src,     DSx  */
+	SIS315_ROP_OR_PAT		= 0xFA, /* dst =  dst |  src,     DSo  */
+	SIS315_ROP_NOR_PAT	       	= 0x05, /* dst =  ~(dst | src),   DSon */
+	SIS315_ROP_EQUIV_PAT		= 0xA5, /* dst =  dst ^ ~src,     DSxn */
+	SIS315_ROP_INVERT_PAT		= 0x55, /* dst = ~dst,            Dn   */
+	SIS315_ROP_OR_REVERSE_PAT	= 0xDD, /* dst = ~dst | src,      SDno */
+	SIS315_ROP_COPY_INVERTED_PAT	= 0x0F, /* dst = ~src,            Sn   */
+	SIS315_ROP_OR_INVERTED_PAT	= 0xAF, /* dst = ~src | dst,      DSno */
+	SIS315_ROP_NAND_PAT		= 0x5F, /* dst = ~(dst & src),    DSan */
+	SIS315_ROP_SET_PAT		= 0xFF, /* dst =    1,            1    */
+};
+
+enum sisfb_raster_op_transparent_bitblt {
+	SIS315_ROP_BLACK,
+	SIS315_ROP_NOT_MERGE_PEN,
+};
+
+enum sis315_2d_registers {
+	SIS315_2D_SRC_ADDR     = 0x8200,
+	SIS315_2D_SRC_PITCH    = 0x8204, SIS315_2D_AGP_BASE     = 0x8206,
+	SIS315_2D_SRC_Y        = 0x8208, SIS315_2D_SRC_X        = 0x820A,
+	SIS315_2D_DST_Y        = 0x820C, SIS315_2D_DST_X        = 0x820E,
+	SIS315_2D_DST_ADDR     = 0x8210,
+	SIS315_2D_DST_PITCH    = 0x8214, SIS315_2D_DST_HEIGHT   = 0x8216,
+	SIS315_2D_RECT_WIDTH   = 0x8218, SIS315_2D_RECT_HEIGHT  = 0x821A,
+	SIS315_2D_PAT_FG_COLOR = 0x821C,
+	SIS315_2D_PAT_BG_COLOR = 0x8220,
+	SIS315_2D_SRC_FG_COLOR = 0x8224,
+	SIS315_2D_SRC_BG_COLOR = 0x8228,
+	SIS315_2D_MONO_MASK    = 0x822C,
+	SIS315_2D_LEFT_CLIP    = 0x8234, SIS315_2D_TOP_CLIP     = 0x8236,
+	SIS315_2D_RIGHT_CLIP   = 0x8238, SIS315_2D_BOT_CLIP     = 0x823A,
+	SIS315_2D_CMD          = 0x823C,
+	SIS315_2D_FIRE_TRIGGER = 0x8240,
+	SIS315_2D_PATTERN_REG  = 0x8300
+};
+
+enum SIS315_2d_registers_StretchBlt {
+	SIS315_2D_X_ERROR_TERM = 0x8220,
+	SIS315_2D_Y_ERROR_TERM = 0x8224,
+	SIS315_2D_X_INITIAL_ERROR = 0x8228
+};
+
+enum sis315_2d_registers_drawline {
+	SIS315_2D_LINE_X0      = 0x8208, SIS315_2D_LINE_Y0           = 0x820A,
+	SIS315_2D_LINE_X1      = 0x820C, SIS315_2D_LINE_Y1           = 0x820E,
+	SIS315_2D_LINE_COUNT   = 0x8218, SIS315_2D_LINE_STYLE_PERIOD = 0x821A,
+	SIS315_2D_LINE_STYLE_0 = 0x822C,
+	SIS315_2D_LINE_STYLE_1 = 0x8230,
+	SIS315_2D_LINE_Xn      = 0x8300, SIS315_2D_LINE_Yn           = 0x8302,
+};
+
+#define SIS315_2D_LINE_X(n)	(0x8300 + ((n - 2) << 2))
+#define SIS315_2D_LINE_Y(n)	(0x8302 + ((n - 2) << 2))
+
+enum sis315_2d_register_transparent_bitblt {
+	SIS315_2D_TRANS_DEST_KEY_HIGH = 0x821C,
+	SIS315_2D_TRANS_DEST_KEY_LOW  = 0x8220,
+	SIS315_2D_TRANS_SRC_KEY_HIGH  = 0x8224,
+	SIS315_2D_TRANS_SRC_KEY_LOW   = 0x8228,
+};
+
+enum sis315_2d_cmd_type {
+	SIS315_2D_CMD_BITBLT             = 0x00, SIS315_2D_CMD_COLOREXP           = 0x01,
+	SIS315_2D_CMD_ENCOLOREXP         = 0x02, SIS315_2D_CMD_MULTIPLE_SCANLINE  = 0x03,
+	SIS315_2D_CMD_LINE_DRAW          = 0x04, SIS315_2D_CMD_TRAPEZOID_FILL     = 0x05,
+	SIS315_2D_CMD_TRANSPARENT_BITBLT = 0x06, SIS315_2D_CMD_ALPHA_BLENDING     = 0x07,
+	SIS315_2D_CMD_3D_FUNCTION        = 0x08, SIS315_2D_CMD_CLEAR_Z_BUFFER     = 0x09,
+       	SIS315_2D_CMD_GRADIENT_FILL      = 0x0A, SIS315_2D_CMD_STRETCH_BITBLT     = 0x0B
+};
+
+enum sis315_2d_cmd_control {
+	/* source selection */
+	SIS315_2D_CMD_SRC_VIDEO		= 0x00000000,
+	SIS315_2D_CMD_SRC_SYSTEM	= 0x00000010,
+	SIS315_2D_CMD_SRC_AGP		= 0x00000020,
+	/* pattern source selection */
+	SIS315_2D_CMD_PAT_FG_REG	= 0x00000000,
+	SIS315_2D_CMD_PAT_PAT_REG	= 0x00000040,
+	SIS315_2D_CMD_PAT_MONO_MASK	= 0x00000080,
+	/* color format flags */
+	SIS315_2D_CMD_CFB_8		= 0x00000000,
+	SIS315_2D_CMD_CFB_16		= 0x00010000,
+	SIS315_2D_CMD_CFB_32		= 0x00020000,
+	/* clipping flags */
+	SIS315_2D_CMD_NOCLIP		= 0x00000000,
+	SIS315_2D_CMD_RECT_CLIP_EN	= 0x00040000,
+	SIS315_2D_CMD_MERGE_CLIP_DIS	= 0x04000000,
+	/* subfunctions for transparent bitblt */
+	SIS315_2D_CMD_OPAQUE		= 0x00000000,
+	SIS315_2D_CMD_TRANSPARENT	= 0x00100000,
+	/* subfunctions for alpha blended blit */
+	SIS315_2D_CMD_CONSTANT_ALPHA	= 0x00000000,
+	SIS315_2D_CMD_PER_PIXEL_ALPHA	= 0x00080000,
+	SIS315_2D_CMD_NO_DEST_ALPHA	= 0x00100000,
+	SIS315_2D_CMD_3D_FULL_SCENE	= 0x00180000,
+	/* subfunctions for color expansion */
+	SIS315_2D_CMD_COLOR_TO_MONO	= 0x00100000,
+	SIS315_2D_CMD_AA_TEXT		= 0x00200000,
+	/* line flags */
+	SIS315_2D_CMD_NO_LAST_PIXEL	= 0x00200000,
+	SIS315_2D_CMD_NO_RESET_COUNTER	= 0x00400000,
+	SIS315_2D_CMD_LINE_STLYE_ENABLE	= 0x00800000,
+	/* destination */
+	SIS315_DST_VIDEO		= 0x00000000,
+	SIS315_DST_AGP			= 0x02000000,
+	/*for stretchblit */
+	SIS_2D_CMD_SRC_Y_DEC          = 0x00000000,
+	SIS_2D_CMD_SRC_Y_INC          = 0x00400000,
+	SIS_2D_CMD_SRC_X_DEC          = 0x00000000,
+	SIS_2D_CMD_SRC_X_INC          = 0x00200000,
+	SIS_2D_CMD_DST_Y_DEC          = 0x00000000,
+	SIS_2D_CMD_DST_Y_INC          = 0x00100000,
+	SIS_2D_CMD_DST_X_DEC          = 0x00000000,
+	SIS_2D_CMD_DST_X_INC          = 0x00080000,
+#if 0
+	SIS315_2D_CMD_DIR_X_INC		= 0x00010000,
+	SIS315_2D_CMD_DIR_X_DEC		= 0x00000000,
+	SIS315_2D_CMD_DIR_Y_INC		= 0x00020000,
+	SIS315_2D_CMD_DIR_Y_DEC		= 0x00000000,
+#endif
+};
+
+enum sis315_command_queue_registers {
+	SIS315_2D_CMD_QUEUE_BASE_ADDRESS  = 0x85C0,
+	SIS315_2D_CMD_QUEUE_WRITE_POINTER = 0x85C4,
+	SIS315_2D_CMD_QUEUE_READ_POINTER  = 0x85C8,
+	SIS315_2D_CMD_QUEUE_STATUS        = 0x85CC
+};
+
+#endif /* _SIS315_REGS_H */
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_state.c b/Source/DirectFB/gfxdrivers/sis315/sis315_state.c
new file mode 100755
index 0000000..d78a71e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_state.c
@@ -0,0 +1,164 @@
+/*
+ * $Id: sis315_state.c,v 1.6 2006-10-29 23:24:50 dok Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "sis315.h"
+#include "sis315_mmio.h"
+#include "sis315_regs.h"
+#include "sis315_state.h"
+
+static u16 dspfToSrcColor(DFBSurfacePixelFormat pf)
+{
+	switch (DFB_BITS_PER_PIXEL(pf)) {
+	case 16:
+		return 0x8000;
+	case 32:
+		return 0xc000;
+	default:
+		return 0x0000;
+	}
+}
+
+static u32 dspfToCmdBpp(DFBSurfacePixelFormat pf)
+{
+	switch (DFB_BITS_PER_PIXEL(pf)) {
+	case 16:
+		return SIS315_2D_CMD_CFB_16;
+	case 32:
+		return SIS315_2D_CMD_CFB_32;
+	default:
+		return SIS315_2D_CMD_CFB_8;
+	}
+}
+
+void sis_validate_color(SiSDriverData *drv, SiSDeviceData *dev, CardState *state)
+{
+	u32 color;
+
+	if (dev->v_color)
+		return;
+
+	switch (state->destination->config.format) {
+	case DSPF_LUT8:
+		color = state->color_index;
+		break;
+	case DSPF_ARGB1555:
+		color = PIXEL_ARGB1555(state->color.a,
+					state->color.r,
+					state->color.g,
+					state->color.b);
+		break;
+	case DSPF_RGB16:
+		color = PIXEL_RGB16(state->color.r,
+					 state->color.g,
+					 state->color.b);
+		break;
+	case DSPF_RGB32:
+		color = PIXEL_RGB32(state->color.r,
+					 state->color.g,
+					 state->color.b);
+		break;
+	case DSPF_ARGB:
+		color = PIXEL_ARGB(state->color.a,
+					state->color.r,
+					state->color.g,
+					state->color.b);
+		break;
+	default:
+		D_BUG("unexpected pixelformat");
+		return;
+	}
+
+	sis_wl(drv->mmio_base, SIS315_2D_PAT_FG_COLOR, color);
+
+	dev->v_color = 1;
+}
+
+void sis_validate_dst(SiSDriverData *drv, SiSDeviceData *dev, CardState *state)
+{
+	CoreSurface *dst = state->destination;
+
+	if (dev->v_destination)
+		return;
+
+	dev->cmd_bpp = dspfToCmdBpp(dst->config.format);
+
+	sis_wl(drv->mmio_base, SIS315_2D_DST_ADDR, state->dst.offset);
+	sis_wl(drv->mmio_base, SIS315_2D_DST_PITCH, (0xffff << 16) | state->dst.pitch);
+
+	dev->v_destination = 1;
+}
+
+void sis_validate_src(SiSDriverData *drv, SiSDeviceData *dev, CardState *state)
+{
+	CoreSurface *src = state->source;
+
+	if (dev->v_source)
+		return;
+
+	sis_wl(drv->mmio_base, SIS315_2D_SRC_ADDR, state->src.offset);
+	sis_wl(drv->mmio_base, SIS315_2D_SRC_PITCH, (dspfToSrcColor(src->config.format) << 16) | state->src.pitch);
+
+	dev->v_source = 1;
+}
+
+void sis_set_dst_colorkey(SiSDriverData *drv, SiSDeviceData *dev, CardState *state)
+{
+	if (dev->v_dst_colorkey)
+		return;
+
+	sis_wl(drv->mmio_base, SIS315_2D_TRANS_DEST_KEY_HIGH, state->dst_colorkey);
+	sis_wl(drv->mmio_base, SIS315_2D_TRANS_DEST_KEY_LOW, state->dst_colorkey);
+
+	dev->v_dst_colorkey = 1;
+}
+
+void sis_set_src_colorkey(SiSDriverData *drv, SiSDeviceData *dev, CardState *state)
+{
+	if (dev->v_src_colorkey)
+		return;
+
+	sis_wl(drv->mmio_base, SIS315_2D_TRANS_SRC_KEY_HIGH, state->src_colorkey);
+	sis_wl(drv->mmio_base, SIS315_2D_TRANS_SRC_KEY_LOW, state->src_colorkey);
+
+	dev->v_src_colorkey = 1;
+}
+
+
+void sis_set_clip(SiSDriverData *drv, DFBRegion *clip)
+{
+	sis_wl(drv->mmio_base, SIS315_2D_LEFT_CLIP, (clip->y1 << 16) | clip->x1);
+	sis_wl(drv->mmio_base, SIS315_2D_RIGHT_CLIP, (clip->y2 << 16) | clip->x2);
+}
+
+
+ 
diff --git a/Source/DirectFB/gfxdrivers/sis315/sis315_state.h b/Source/DirectFB/gfxdrivers/sis315/sis315_state.h
new file mode 100755
index 0000000..e0c86d7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/sis315/sis315_state.h
@@ -0,0 +1,34 @@
+/*
+ * $Id: sis315_state.h,v 1.2 2006-10-29 23:24:50 dok Exp $
+ *
+ * Copyright (C) 2003 by Andreas Oberritter <obi@saftware.de>
+ *
+ * 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 _SIS315_STATE_H
+#define _SIS315_STATE_H
+
+void sis_validate_color(SiSDriverData *drv, SiSDeviceData *dev, CardState *state);
+void sis_validate_dst(SiSDriverData *drv, SiSDeviceData *dev, CardState *state);
+void sis_validate_src(SiSDriverData *drv, SiSDeviceData *dev, CardState *state);
+void sis_set_dst_colorkey(SiSDriverData *drv, SiSDeviceData *dev, CardState *state);
+void sis_set_src_colorkey(SiSDriverData *drv, SiSDeviceData *dev, CardState *state);
+void sis_set_clip(SiSDriverData *drv, DFBRegion *clip);
+
+
+#endif /* _SIS315_STATE_H */
diff --git a/Source/DirectFB/gfxdrivers/tdfx/Makefile.am b/Source/DirectFB/gfxdrivers/tdfx/Makefile.am
new file mode 100755
index 0000000..98264f7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/tdfx/Makefile.am
@@ -0,0 +1,34 @@
+## Makefile.am for DirectFB/src/core/gfxcards/tdfx
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+tdfx_LTLIBRARIES = libdirectfb_tdfx.la
+
+if BUILD_STATIC
+tdfx_DATA = $(tdfx_LTLIBRARIES:.la=.o)
+endif
+
+tdfxdir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_tdfx_la_SOURCES =	\
+	tdfx.c	\
+	tdfx.h
+
+libdirectfb_tdfx_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_tdfx_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/tdfx/Makefile.in b/Source/DirectFB/gfxdrivers/tdfx/Makefile.in
new file mode 100755
index 0000000..68e9338
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/tdfx/Makefile.in
@@ -0,0 +1,595 @@
+# 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/tdfx
+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)$(tdfxdir)" "$(DESTDIR)$(tdfxdir)"
+tdfxLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(tdfx_LTLIBRARIES)
+libdirectfb_tdfx_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_tdfx_la_OBJECTS = tdfx.lo
+libdirectfb_tdfx_la_OBJECTS = $(am_libdirectfb_tdfx_la_OBJECTS)
+libdirectfb_tdfx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_tdfx_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_tdfx_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_tdfx_la_SOURCES)
+tdfxDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(tdfx_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_srcdir)/lib	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/systems	\
+	-I$(top_srcdir)/src
+
+tdfx_LTLIBRARIES = libdirectfb_tdfx.la
+@BUILD_STATIC_TRUE@tdfx_DATA = $(tdfx_LTLIBRARIES:.la=.o)
+tdfxdir = $(MODULEDIR)/gfxdrivers
+libdirectfb_tdfx_la_SOURCES = \
+	tdfx.c	\
+	tdfx.h
+
+libdirectfb_tdfx_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_tdfx_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/tdfx/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/tdfx/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-tdfxLTLIBRARIES: $(tdfx_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(tdfxdir)" || $(MKDIR_P) "$(DESTDIR)$(tdfxdir)"
+	@list='$(tdfx_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(tdfxLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(tdfxdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(tdfxLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(tdfxdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-tdfxLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(tdfx_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(tdfxdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(tdfxdir)/$$p"; \
+	done
+
+clean-tdfxLTLIBRARIES:
+	-test -z "$(tdfx_LTLIBRARIES)" || rm -f $(tdfx_LTLIBRARIES)
+	@list='$(tdfx_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_tdfx.la: $(libdirectfb_tdfx_la_OBJECTS) $(libdirectfb_tdfx_la_DEPENDENCIES) 
+	$(libdirectfb_tdfx_la_LINK) -rpath $(tdfxdir) $(libdirectfb_tdfx_la_OBJECTS) $(libdirectfb_tdfx_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdfx.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-tdfxDATA: $(tdfx_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(tdfxdir)" || $(MKDIR_P) "$(DESTDIR)$(tdfxdir)"
+	@list='$(tdfx_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(tdfxDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(tdfxdir)/$$f'"; \
+	  $(tdfxDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(tdfxdir)/$$f"; \
+	done
+
+uninstall-tdfxDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(tdfx_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(tdfxdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(tdfxdir)/$$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)$(tdfxdir)" "$(DESTDIR)$(tdfxdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-tdfxLTLIBRARIES \
+	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-tdfxDATA install-tdfxLTLIBRARIES
+
+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-tdfxDATA uninstall-tdfxLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-tdfxLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip install-tdfxDATA install-tdfxLTLIBRARIES \
+	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-tdfxDATA \
+	uninstall-tdfxLTLIBRARIES
+
+%.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/tdfx/tdfx.c b/Source/DirectFB/gfxdrivers/tdfx/tdfx.c
new file mode 100755
index 0000000..fdc03fc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/tdfx/tdfx.c
@@ -0,0 +1,884 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <dfb_types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <fbdev/fb.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+
+#include <core/graphics_driver.h>
+
+
+DFB_GRAPHICS_DRIVER( tdfx )
+
+#include "tdfx.h"
+
+static bool tdfxFillRectangle2D( void *drv, void *dev, DFBRectangle *rect );
+static bool tdfxFillRectangle3D( void *drv, void *dev, DFBRectangle *rect );
+static bool tdfxFillTriangle2D ( void *drv, void *dev, DFBTriangle  *tri );
+static bool tdfxFillTriangle3D ( void *drv, void *dev, DFBTriangle  *tri );
+static bool tdfxDrawLine2D     ( void *drv, void *dev, DFBRegion    *line );
+//static void tdfxDrawLine3D     ( void *drv, void *dev, DFBRegion    *line );
+
+typedef struct {
+     /* for fifo/performance monitoring */
+     unsigned int fifo_space;
+
+     unsigned int waitfifo_sum;
+     unsigned int waitfifo_calls;
+     unsigned int fifo_waitcycles;
+     unsigned int idle_waitcycles;
+     unsigned int fifo_cache_hits;
+
+     /* state validation */
+     int v_destination2D;
+     int v_destination3D;
+     int v_color1;
+     int v_colorFore;
+     int v_alphaMode;
+     int v_source2D;
+     int v_srcColorkey;
+     int v_commandExtra;
+} TDFXDeviceData;
+
+typedef struct {
+     volatile u8   *mmio_base;
+     Voodoo2D      *voodoo2D;
+     Voodoo3D      *voodoo3D;
+} TDFXDriverData;
+
+
+
+static inline void tdfx_waitfifo( TDFXDriverData *tdrv,
+                                  TDFXDeviceData *tdev,
+                                  unsigned int space )
+{
+     int timeout = 1000000;
+
+     tdev->waitfifo_calls++;
+     tdev->waitfifo_sum += space;
+
+     if (tdev->fifo_space < space) {
+          while (timeout--) {
+               tdev->fifo_waitcycles++;
+
+               tdev->fifo_space = (tdrv->voodoo2D->status & 0x3f);
+               if (tdev->fifo_space >= space)
+                    break;
+
+          }
+     } else {
+          tdev->fifo_cache_hits++;
+     }
+
+     tdev->fifo_space -= space;
+
+     if (!timeout)
+          D_WARN( "timeout during waitfifo!" );
+}
+
+static inline void tdfx_waitidle( TDFXDriverData *tdrv,
+                                  TDFXDeviceData *tdev )
+{
+     int i = 0;
+     int timeout = 1000000;
+
+//     tdfx_waitfifo( tdrv, tdev, 1 );
+
+//     voodoo3D->nopCMD = 0;
+
+     while (timeout--) {
+          tdev->idle_waitcycles++;
+
+          i = (tdrv->voodoo2D->status & (0xF << 7))  ?  0 : i + 1;
+          if (i == 3)
+               return;
+
+     }
+
+     D_BUG( "timeout during waitidle!\n");
+}
+
+
+static int blitFormat[] = {
+     2, /* DSPF_ARGB1555 */
+     3, /* DSPF_RGB16 */
+     4, /* DSPF_RGB24 */
+     5, /* DSPF_RGB32 */
+     5, /* DSPF_ARGB  */
+     0  /* DSPF_A8    */
+};
+
+static inline void tdfx_validate_source2D( TDFXDriverData *tdrv,
+                                           TDFXDeviceData *tdev,
+                                           CardState      *state )
+{
+     CoreSurface   *source   = state->source;
+     Voodoo2D      *voodoo2D = tdrv->voodoo2D;
+
+     if (tdev->v_source2D)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 2 );
+
+     voodoo2D->srcBaseAddr = state->src.offset & 0xFFFFFF;
+     voodoo2D->srcFormat   = (state->src.pitch & 0x3FFF) |
+                             (blitFormat[DFB_PIXELFORMAT_INDEX(source->config.format)] << 16);
+
+     tdev->v_source2D = 1;
+}
+
+static inline void tdfx_validate_destination2D( TDFXDriverData *tdrv,
+                                                TDFXDeviceData *tdev,
+                                                CardState      *state )
+{
+     CoreSurface   *destination = state->destination;
+     Voodoo2D      *voodoo2D    = tdrv->voodoo2D;
+
+     if (tdev->v_destination2D)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 2 );
+
+     voodoo2D->dstBaseAddr = state->dst.offset;
+     voodoo2D->dstFormat   = (state->dst.pitch & 0x3FFF) |
+                             (blitFormat[DFB_PIXELFORMAT_INDEX(destination->config.format)] << 16);
+
+     tdev->v_destination2D = 1;
+}
+
+static inline void tdfx_validate_destination3D( TDFXDriverData *tdrv,
+                                                TDFXDeviceData *tdev,
+                                                CardState      *state )
+{
+     CoreSurface   *destination = state->destination;
+     Voodoo3D      *voodoo3D    = tdrv->voodoo3D;
+
+     u32 lfbmode = TDFX_LFBMODE_PIXEL_PIPELINE_ENABLE;
+     u32 fbzMode = (1 << 9) | 1;
+
+     if (tdev->v_destination3D)
+          return;
+
+     switch (destination->config.format) {
+          case DSPF_ARGB1555:
+               lfbmode |= TDFX_LFBMODE_RGB555;
+               break;
+          case DSPF_RGB16:
+               lfbmode |= TDFX_LFBMODE_RGB565;
+               break;
+          case DSPF_RGB32:
+               lfbmode |= TDFX_LFBMODE_RGB0888;
+               break;
+          case DSPF_ARGB:
+               fbzMode |= (1 << 10);
+               lfbmode |= TDFX_LFBMODE_ARGB8888;
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     tdfx_waitfifo( tdrv, tdev, 4 );
+
+     voodoo3D->lfbMode = lfbmode;
+     voodoo3D->fbzMode = fbzMode;
+     voodoo3D->colBufferAddr = state->dst.offset;
+     voodoo3D->colBufferStride = state->dst.pitch;
+
+     tdev->v_destination3D = 1;
+}
+
+static inline void tdfx_validate_color1( TDFXDriverData *tdrv,
+                                         TDFXDeviceData *tdev,
+                                         CardState      *state )
+{
+     if (tdev->v_color1)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 1 );
+
+     tdrv->voodoo3D->color1 = PIXEL_ARGB( state->color.a,
+                                          state->color.r,
+                                          state->color.g,
+                                          state->color.b );
+
+     tdev->v_color1 = 1;
+}
+
+static inline void tdfx_validate_colorFore( TDFXDriverData *tdrv,
+                                            TDFXDeviceData *tdev,
+                                            CardState      *state )
+{
+     if (tdev->v_colorFore)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 1 );
+
+     switch (state->destination->config.format) {
+          case DSPF_A8:
+               tdrv->voodoo2D->colorFore = state->color.a;
+               break;
+          case DSPF_ARGB1555:
+               tdrv->voodoo2D->colorFore = PIXEL_ARGB1555( state->color.a,
+                                                           state->color.r,
+                                                           state->color.g,
+                                                           state->color.b );
+               break;
+          case DSPF_RGB16:
+               tdrv->voodoo2D->colorFore = PIXEL_RGB16( state->color.r,
+                                                        state->color.g,
+                                                        state->color.b );
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               tdrv->voodoo2D->colorFore = PIXEL_RGB32( state->color.r,
+                                                        state->color.g,
+                                                        state->color.b );
+               break;
+          case DSPF_ARGB:
+               tdrv->voodoo2D->colorFore = PIXEL_ARGB(  state->color.a,
+                                                        state->color.r,
+                                                        state->color.g,
+                                                        state->color.b );
+               break;
+          default:
+               D_BUG( "unexpected pixelformat!" );
+               break;
+     }
+
+     tdev->v_colorFore = 1;
+}
+
+static inline void tdfx_validate_alphaMode( TDFXDriverData *tdrv,
+                                            TDFXDeviceData *tdev,
+                                            CardState      *state )
+{
+     static int tdfxBlendFactor[] = {
+          0,
+          0x0, /* DSBF_ZERO         */
+          0x4, /* DSBF_ONE          */
+          0x2, /* DSBF_SRCCOLOR     */
+          0x6, /* DSBF_INVSRCCOLOR  */
+          0x1, /* DSBF_SRCALPHA     */
+          0x5, /* DSBF_INVSRCALPHA  */
+          0x3, /* DSBF_DESTALPHA    */
+          0x7, /* DSBF_INVDESTALPHA */
+          0x2, /* DSBF_DESTCOLOR    */
+          0x6, /* DSBF_INVDESTCOLOR */
+          0xF  /* DSBF_SRCALPHASAT  */
+     };
+
+     if (tdev->v_alphaMode)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 1 );
+
+     tdrv->voodoo3D->alphaMode = TDFX_ALPHAMODE_BLEND_ENABLE |
+                                 (tdfxBlendFactor[state->src_blend] <<  8) |
+                                 (tdfxBlendFactor[state->src_blend] << 16) |
+                                 (tdfxBlendFactor[state->dst_blend] << 12) |
+                                 (tdfxBlendFactor[state->dst_blend] << 20);
+
+     tdev->v_alphaMode = 1;
+}
+
+static inline void tdfx_validate_srcColorkey( TDFXDriverData *tdrv,
+                                              TDFXDeviceData *tdev,
+                                              CardState      *state )
+{
+     Voodoo2D *voodoo2D = tdrv->voodoo2D;
+
+     if (tdev->v_srcColorkey)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 2 );
+
+     voodoo2D->srcColorkeyMin =
+     voodoo2D->srcColorkeyMax = state->src_colorkey;
+
+     tdev->v_srcColorkey = 1;
+}
+
+static inline void tdfx_validate_commandExtra( TDFXDriverData *tdrv,
+                                               TDFXDeviceData *tdev,
+                                               CardState      *state )
+{
+     if (tdev->v_commandExtra)
+          return;
+
+     tdfx_waitfifo( tdrv, tdev, 1 );
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          tdrv->voodoo2D->commandExtra = 1;
+     else
+          tdrv->voodoo2D->commandExtra = 0;
+
+     tdev->v_commandExtra = 1;
+}
+
+
+
+static inline void tdfx_set_clip( TDFXDriverData *tdrv,
+                                  TDFXDeviceData *tdev,
+                                  DFBRegion      *clip )
+{
+     Voodoo2D *voodoo2D = tdrv->voodoo2D;
+     Voodoo3D *voodoo3D = tdrv->voodoo3D;
+
+     tdfx_waitfifo( tdrv, tdev, 4 );
+
+     voodoo2D->clip0Min = ((clip->y1 & 0xFFF) << 16) |
+                          (clip->x1 & 0xFFF);
+
+     voodoo2D->clip0Max = (((clip->y2+1) & 0xFFF) << 16) |
+                          ((clip->x2+1) & 0xFFF);
+
+     voodoo3D->clipLeftRight = ((clip->x1 & 0xFFF) << 16) |
+                               ((clip->x2+1) & 0xFFF);
+
+     voodoo3D->clipTopBottom = ((clip->y1 & 0xFFF) << 16) |
+                               ((clip->y2+1) & 0xFFF);
+}
+
+
+
+/* required implementations */
+
+static DFBResult tdfxEngineSync( void *drv, void *dev )
+{
+     TDFXDriverData *tdrv = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev = (TDFXDeviceData*) dev;
+
+     tdfx_waitidle( tdrv, tdev );
+
+     return DFB_OK;
+}
+
+#define TDFX_SUPPORTED_DRAWINGFLAGS \
+               (DSDRAW_BLEND)
+
+#define TDFX_SUPPORTED_DRAWINGFUNCTIONS \
+               (DFXL_FILLRECTANGLE | DFXL_DRAWLINE | DFXL_FILLTRIANGLE)
+
+#define TDFX_SUPPORTED_BLITTINGFLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define TDFX_SUPPORTED_BLITTINGFUNCTIONS \
+               (DFXL_BLIT | DFXL_STRETCHBLIT)
+
+
+static void tdfxCheckState( void *drv, void *dev,
+                            CardState *state, DFBAccelerationMask accel )
+{
+     /* check for the special drawing function that does not support
+        the usually supported drawingflags */
+     if (accel == DFXL_DRAWLINE  &&  state->drawingflags != DSDRAW_NOFX)
+          return;
+
+     /* if there are no other drawing flags than the supported */
+     if (!(state->drawingflags & ~TDFX_SUPPORTED_DRAWINGFLAGS))
+          state->accel |= TDFX_SUPPORTED_DRAWINGFUNCTIONS;
+
+     /* if there are no other blitting flags than the supported
+        and the source and destination formats are the same */
+     if (!(state->blittingflags & ~TDFX_SUPPORTED_BLITTINGFLAGS)  &&
+         state->source  &&  state->source->config.format != DSPF_RGB24)
+          state->accel |= TDFX_SUPPORTED_BLITTINGFUNCTIONS;
+}
+
+static void tdfxSetState( void *drv, void *dev,
+                          GraphicsDeviceFuncs *funcs,
+                          CardState *state, DFBAccelerationMask accel )
+{
+     TDFXDriverData *tdrv = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev = (TDFXDeviceData*) dev;
+
+     if (state->mod_hw & SMF_DESTINATION)
+          tdev->v_destination2D = tdev->v_destination3D = tdev->v_colorFore = 0;
+
+     if (state->mod_hw & SMF_SOURCE)
+          tdev->v_source2D = 0;
+
+     if (state->mod_hw & (SMF_DST_BLEND | SMF_SRC_BLEND))
+          tdev->v_alphaMode = 0;
+
+     if (state->mod_hw & SMF_COLOR)
+          tdev->v_color1 = tdev->v_colorFore = 0;
+
+     if (state->mod_hw & SMF_SRC_COLORKEY)
+          tdev->v_srcColorkey = 0;
+
+     if (state->mod_hw & SMF_BLITTING_FLAGS)
+          tdev->v_commandExtra = 0;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWLINE:
+          case DFXL_FILLTRIANGLE:
+               if (state->drawingflags & DSDRAW_BLEND) {
+                    tdfx_validate_color1( tdrv, tdev, state );
+                    tdfx_validate_alphaMode( tdrv, tdev, state );
+                    tdfx_validate_destination3D( tdrv, tdev, state );
+
+                    funcs->FillRectangle = tdfxFillRectangle3D;
+                    funcs->FillTriangle = tdfxFillTriangle3D;
+               } else {
+                    tdfx_validate_colorFore( tdrv, tdev, state );
+                    tdfx_validate_destination2D( tdrv, tdev, state );
+
+                    funcs->FillRectangle = tdfxFillRectangle2D;
+                    funcs->FillTriangle = tdfxFillTriangle2D;
+               }
+
+               state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWLINE;
+               break;
+
+          case DFXL_BLIT:
+          case DFXL_STRETCHBLIT:
+               if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                    tdfx_validate_srcColorkey( tdrv, tdev, state );
+
+               tdfx_validate_commandExtra( tdrv, tdev, state );
+               tdfx_validate_source2D( tdrv, tdev, state );
+               tdfx_validate_destination2D( tdrv, tdev, state );
+
+               state->set |= DFXL_BLIT | DFXL_STRETCHBLIT;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     if (state->mod_hw & SMF_CLIP)
+          tdfx_set_clip( tdrv, tdev, &state->clip );
+
+     state->mod_hw = 0;
+}
+
+static bool tdfxFillRectangle2D( void *drv, void *dev, DFBRectangle *rect )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+
+     tdfx_waitfifo( tdrv, tdev, 3 );
+
+     voodoo2D->dstXY   = ((rect->y & 0x1FFF) << 16) | (rect->x & 0x1FFF);
+     voodoo2D->dstSize = ((rect->h & 0x1FFF) << 16) | (rect->w & 0x1FFF);
+
+     voodoo2D->command = 5 | (1 << 8) | (0xCC << 24);
+
+     return true;
+}
+
+static bool tdfxFillRectangle3D( void *drv, void *dev, DFBRectangle *rect )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo3D       *voodoo3D = tdrv->voodoo3D;
+
+     tdfx_waitfifo( tdrv, tdev, 10 );
+
+     voodoo3D->vertexAx = S12_4(rect->x);
+     voodoo3D->vertexAy = S12_4(rect->y);
+
+     voodoo3D->vertexBx = S12_4(rect->x);
+     voodoo3D->vertexBy = S12_4(rect->y + rect->h);
+
+     voodoo3D->vertexCx = S12_4(rect->x + rect->w);
+     voodoo3D->vertexCy = S12_4(rect->y + rect->h);
+
+     voodoo3D->triangleCMD = (1 << 31);
+
+
+     voodoo3D->vertexBx = S12_4(rect->x + rect->w);
+     voodoo3D->vertexBy = S12_4(rect->y);
+
+     voodoo3D->triangleCMD = 0;
+
+     return true;
+}
+
+static bool tdfxDrawRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     return false;
+}
+
+static bool tdfxDrawLine2D( void *drv, void *dev, DFBRegion *line )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+
+     tdfx_waitfifo( tdrv, tdev, 5 );
+
+     voodoo2D->srcXY   = ((line->y1 & 0x1FFF) << 16) | (line->x1 & 0x1FFF);
+     voodoo2D->dstXY   = ((line->y2 & 0x1FFF) << 16) | (line->x2 & 0x1FFF);
+     voodoo2D->command = 6 | (1 << 8) | (0xCC << 24);
+
+     return true;
+}
+
+/*static bool tdfxDrawLine3D( void *drv, void *dev, DFBRegion *line )
+{
+     int xl, xr, yb, yt;
+
+     if (line->x1 < line->x2) {
+          xl = -8;
+          xr =  8;
+     }
+     else {
+          xl =  8;
+          xr = -8;
+     }
+
+     if (line->y1 < line->y2) {
+          yt = -8;
+          yb =  8;
+     }
+     else {
+          yt =  8;
+          yb = -8;
+     }
+
+     tdfx_waitfifo( 10 );
+
+     voodoo3D->vertexAx = S12_4_( line->x1, xl );
+     voodoo3D->vertexAy = S12_4_( line->y1, yt );
+
+     voodoo3D->vertexBx = S12_4_( line->x2, xl );
+     voodoo3D->vertexBy = S12_4_( line->y2, yb );
+
+     voodoo3D->vertexCx = S12_4_( line->x2, xr );
+     voodoo3D->vertexCy = S12_4_( line->y2, yb );
+
+     voodoo3D->triangleCMD = (1 << 31);
+
+
+     voodoo3D->vertexBx = S12_4_( line->x1, xr );
+     voodoo3D->vertexBy = S12_4_( line->y1, yt );
+
+     voodoo3D->triangleCMD = 0;
+
+     return true;
+}*/
+
+static bool tdfxFillTriangle2D( void *drv, void *dev, DFBTriangle *tri )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+
+     tdfx_waitfifo( tdrv, tdev, 7 );
+
+     dfb_sort_triangle( tri );
+
+     voodoo2D->srcXY = ((tri->y1 & 0x1FFF) << 16) | (tri->x1 & 0x1FFF);
+     voodoo2D->command = 8 | (1 << 8) | (0xCC << 24);
+
+     if (tri->x2 < tri->x3) {
+          voodoo2D->launchArea[0] = ((tri->y2 & 0x1FFF) << 16) | (tri->x2 & 0x1FFF);
+          voodoo2D->launchArea[1] = ((tri->y3 & 0x1FFF) << 16) | (tri->x3 & 0x1FFF);
+          voodoo2D->launchArea[2] = ((tri->y2 & 0x1FFF) << 16) | (tri->x2 & 0x1FFF);
+
+     } else {
+          voodoo2D->launchArea[0] = ((tri->y3 & 0x1FFF) << 16) | (tri->x3 & 0x1FFF);
+          voodoo2D->launchArea[1] = ((tri->y2 & 0x1FFF) << 16) | (tri->x2 & 0x1FFF);
+          voodoo2D->launchArea[2] = ((tri->y3 & 0x1FFF) << 16) | (tri->x3 & 0x1FFF);
+
+     }
+
+     return true;
+}
+
+static bool tdfxFillTriangle3D( void *drv, void *dev, DFBTriangle *tri )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo3D       *voodoo3D = tdrv->voodoo3D;
+
+     tdfx_waitfifo( tdrv, tdev, 7 );
+
+     dfb_sort_triangle( tri );
+
+     voodoo3D->vertexAx = S12_4(tri->x1);
+     voodoo3D->vertexAy = S12_4(tri->y1);
+
+     voodoo3D->vertexBx = S12_4(tri->x2);
+     voodoo3D->vertexBy = S12_4(tri->y2);
+
+     voodoo3D->vertexCx = S12_4(tri->x3);
+     voodoo3D->vertexCy = S12_4(tri->y3);
+
+     voodoo3D->triangleCMD = (1 << 31);
+
+     voodoo3D->triangleCMD = 0;
+
+     return true;
+}
+
+static bool tdfxBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+
+     u32 cmd = 1 | (1 <<8) | (0xCC << 24);//SST_2D_GO | SST_2D_SCRNTOSCRNBLIT | (ROP_COPY << 24);
+
+     if (rect->x <= dx) {
+          cmd |= (1 << 14);//SST_2D_X_RIGHT_TO_LEFT;
+          rect->x += rect->w-1;
+          dx += rect->w-1;
+     }
+     if (rect->y <= dy) {
+          cmd |= (1 << 15);//SST_2D_Y_BOTTOM_TO_TOP;
+          rect->y += rect->h-1;
+          dy += rect->h-1;
+     }
+
+
+     tdfx_waitfifo( tdrv, tdev, 4 );
+
+     voodoo2D->srcXY   = ((rect->y & 0x1FFF) << 16) | (rect->x & 0x1FFF);
+     voodoo2D->dstXY   = ((dy      & 0x1FFF) << 16) | (dx      & 0x1FFF);
+     voodoo2D->dstSize = ((rect->h & 0x1FFF) << 16) | (rect->w & 0x1FFF);
+
+     voodoo2D->command = cmd;
+
+     return true;
+}
+
+static bool tdfxStretchBlit( void *drv, void *dev, DFBRectangle *sr, DFBRectangle *dr )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) drv;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) dev;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+
+     tdfx_waitfifo( tdrv, tdev, 5 );
+
+     voodoo2D->srcXY   = ((sr->y & 0x1FFF) << 16) | (sr->x & 0x1FFF);
+     voodoo2D->srcSize = ((sr->h & 0x1FFF) << 16) | (sr->w & 0x1FFF);
+
+     voodoo2D->dstXY   = ((dr->y & 0x1FFF) << 16) | (dr->x & 0x1FFF);
+     voodoo2D->dstSize = ((dr->h & 0x1FFF) << 16) | (dr->w & 0x1FFF);
+
+     voodoo2D->command = 2 | (1 << 8) | (0xCC << 24);
+
+     return true;
+}
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_3DFX_BANSHEE:          /* Banshee/Voodoo3 */
+               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,
+               "3Dfx Voodoo 3/4/5/Banshee Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+
+     info->driver_data_size = sizeof (TDFXDriverData);
+     info->device_data_size = sizeof (TDFXDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     TDFXDriverData *tdrv = (TDFXDriverData*) driver_data;
+
+     tdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+     if (!tdrv->mmio_base)
+          return DFB_IO;
+
+     tdrv->voodoo2D = (Voodoo2D*)(tdrv->mmio_base + 0x100000);
+     tdrv->voodoo3D = (Voodoo3D*)(tdrv->mmio_base + 0x200000);
+
+     funcs->CheckState    = tdfxCheckState;
+     funcs->SetState      = tdfxSetState;
+     funcs->EngineSync    = tdfxEngineSync;
+
+     funcs->DrawRectangle = tdfxDrawRectangle;
+     funcs->DrawLine      = tdfxDrawLine2D;
+     funcs->Blit          = tdfxBlit;
+     funcs->StretchBlit   = tdfxStretchBlit;
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     TDFXDriverData *tdrv     = (TDFXDriverData*) driver_data;
+     TDFXDeviceData *tdev     = (TDFXDeviceData*) device_data;
+     Voodoo2D       *voodoo2D = tdrv->voodoo2D;
+     Voodoo3D       *voodoo3D = tdrv->voodoo3D;
+
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Voodoo 3/4/5/Banshee" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "3Dfx" );
+
+
+     device_info->caps.flags    = CCF_CLIPPING;
+     device_info->caps.accel    = TDFX_SUPPORTED_DRAWINGFUNCTIONS |
+                                  TDFX_SUPPORTED_BLITTINGFUNCTIONS;
+     device_info->caps.drawing  = TDFX_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = TDFX_SUPPORTED_BLITTINGFLAGS;
+
+     device_info->limits.surface_byteoffset_alignment = 32 * 4;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+
+     /* initialize card */
+     voodoo2D->status = 0;
+     voodoo3D->nopCMD = 3;
+
+     tdfx_waitfifo( tdrv, tdev, 6 );
+
+     voodoo3D->clipLeftRight1 = 0;
+     voodoo3D->clipTopBottom1 = 0;
+
+     voodoo3D->fbzColorPath = TDFX_FBZCOLORPATH_RGBSELECT_COLOR1 |
+                              TDFX_FBZCOLORPATH_ASELECT_COLOR1;
+
+     voodoo3D->textureMode = 0;
+
+     voodoo2D->commandExtra = 0;
+     voodoo2D->rop = 0xAAAAAA;
+
+     tdfx_waitfifo( tdrv, tdev, 1 );           /* VOODOO !!!  */
+
+     *((volatile u32*)((volatile u8*) tdrv->mmio_base + 0x10c)) =
+          1 << 4 | 1 << 8 | 5 << 12 | 1 << 18 | 5 << 24;
+
+     dfb_config->pollvsync_after = 1;
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data )
+{
+     TDFXDeviceData *tdev = (TDFXDeviceData*) device_data;
+     TDFXDriverData *tdrv = (TDFXDriverData*) driver_data;
+
+     (void) tdev;
+     (void) tdrv;
+
+     D_DEBUG( "DirectFB/TDFX: FIFO Performance Monitoring:\n" );
+     D_DEBUG( "DirectFB/TDFX:  %9d tdfx_waitfifo calls\n",
+               tdev->waitfifo_calls );
+     D_DEBUG( "DirectFB/TDFX:  %9d register writes (tdfx_waitfifo sum)\n",
+               tdev->waitfifo_sum );
+     D_DEBUG( "DirectFB/TDFX:  %9d FIFO wait cycles (depends on CPU)\n",
+               tdev->fifo_waitcycles );
+     D_DEBUG( "DirectFB/TDFX:  %9d IDLE wait cycles (depends on CPU)\n",
+               tdev->idle_waitcycles );
+     D_DEBUG( "DirectFB/TDFX:  %9d FIFO space cache hits(depends on CPU)\n",
+               tdev->fifo_cache_hits );
+     D_DEBUG( "DirectFB/TDFX: Conclusion:\n" );
+     D_DEBUG( "DirectFB/TDFX:  Average register writes/tdfx_waitfifo"
+               "call:%.2f\n",
+               tdev->waitfifo_sum/(float)(tdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/TDFX:  Average wait cycles/tdfx_waitfifo call:"
+               " %.2f\n",
+               tdev->fifo_waitcycles/(float)(tdev->waitfifo_calls) );
+     D_DEBUG( "DirectFB/TDFX:  Average fifo space cache hits: %02d%%\n",
+               (int)(100 * tdev->fifo_cache_hits/
+                     (float)(tdev->waitfifo_calls)) );
+
+     D_DEBUG( "DirectFB/TDFX:  Pixels Out: %d\n", tdrv->voodoo3D->fbiPixelsOut );
+     D_DEBUG( "DirectFB/TDFX:  Triangles Out: %d\n", tdrv->voodoo3D->fbiTrianglesOut );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data )
+{
+     TDFXDriverData *tdrv = (TDFXDriverData*) driver_data;
+
+     dfb_gfxcard_unmap_mmio( device, tdrv->mmio_base, -1 );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/tdfx/tdfx.h b/Source/DirectFB/gfxdrivers/tdfx/tdfx.h
new file mode 100755
index 0000000..04a9449
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/tdfx/tdfx.h
@@ -0,0 +1,250 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __TDFX_H__
+#define __TDFX_H__
+
+#include <dfb_types.h>
+
+
+#define S12_4(val)    (((u32)((s32)((val) << 4))) & 0xffff)
+#define S12_4_(a,b)   (((u32)((s32)(((a) << 4) + (b)))) & 0xffff)
+
+
+#define TDFX_LFBMODE_RGB565                   0
+#define TDFX_LFBMODE_RGB555                   1
+#define TDFX_LFBMODE_RGB0888                  4
+#define TDFX_LFBMODE_ARGB8888                 5
+#define TDFX_LFBMODE_PIXEL_PIPELINE_ENABLE   (1 << 8)
+
+#define TDFX_CLIP_ENABLE                     (1 << 31)
+
+
+#define TDFX_ALPHAMODE_BLEND_ENABLE          (1 << 4)
+
+#define TDFX_FBZCOLORPATH_RGBSELECT_COLOR1    2
+#define TDFX_FBZCOLORPATH_ASELECT_COLOR1     (2 << 2)
+
+typedef volatile struct {
+    u32 status;
+    u32 intrCtrl;
+
+    u32 vertexAx;
+    u32 vertexAy;
+    u32 vertexBx;
+    u32 vertexBy;
+    u32 vertexCx;
+    u32 vertexCy;
+
+    s32 startR;
+    s32 startG;
+    s32 startB;
+    s32 startZ;
+    s32 startA;
+    s32 startS;
+    s32 startT;
+    s32 startW;
+
+    s32 dRdX;
+    s32 dGdX;
+    s32 dBdX;
+    s32 dZdX;
+    s32 dAdX;
+    s32 dSdX;
+    s32 dTdX;
+    s32 dWdX;
+
+    s32 dRdY;
+    s32 dGdY;
+    s32 dBdY;
+    s32 dZdY;
+    s32 dAdY;
+    s32 dSdY;
+    s32 dTdY;
+    s32 dWdY;
+
+    u32 triangleCMD;
+    u32 reserved0;
+
+    float fvertexAx;
+    float fvertexAy;
+    float fvertexBx;
+    float fvertexBy;
+    float fvertexCx;
+    float fvertexCy;
+
+    float fstartR;
+    float fstartG;
+    float fstartB;
+    float fstartZ;
+    float fstartA;
+    float fstartS;
+    float fstartT;
+    float fstartW;
+
+    float fdRdX;
+    float fdGdX;
+    float fdBdX;
+    float fdZdX;
+    float fdAdX;
+    float fdSdX;
+    float fdTdX;
+    float fdWdX;
+
+    float fdRdY;
+    float fdGdY;
+    float fdBdY;
+    float fdZdY;
+    float fdAdY;
+    float fdSdY;
+    float fdTdY;
+    float fdWdY;
+
+    u32 ftriangleCMD;
+    u32 fbzColorPath;
+    u32 fogMode;
+    u32 alphaMode;
+    u32 fbzMode;
+    u32 lfbMode;
+    u32 clipLeftRight;
+    u32 clipTopBottom;
+
+    u32 nopCMD;
+    u32 fastfillCMD;
+    u32 swapbufferCMD;
+    u32 fogColor;
+    u32 zaColor;
+    u32 chromaKey;
+    u32 chromaRange;
+    u32 userIntrCMD;
+    u32 stipple;
+    u32 color0;
+    u32 color1;
+
+    u32 fbiPixelsIn;
+    u32 fbiChromaFail;
+    u32 fbiZfuncFail;
+    u32 fbiAfuncFail;
+    u32 fbiPixelsOut;
+
+    u32 fogTable[32];
+
+    u32 reserved1[3];
+
+    u32 colBufferAddr;
+    u32 colBufferStride;
+    u32 auxBufferAddr;
+    u32 auxBufferStride;
+
+    u32 reserved2;
+
+    u32 clipLeftRight1;
+    u32 clipTopBottom1;
+
+    u32 reserved3[17];
+    u32 swapPending;
+    u32 leftOverlayBuf;
+    u32 rightOverlayBuf;
+    u32 fbiSwapHistory;
+    u32 fbiTrianglesOut;
+    u32 sSetupMode;
+    float sVx;
+    float sVy;
+    u32 sARGB;
+    float sRed;
+    float sGreen;
+    float sBlue;
+    float sAlpha;
+    float sVz;
+    float sWb;
+    float sWtmu0;
+    float sS_W0;
+    float sT_W0;
+    float sWtmu1;
+    float sS_Wtmu1;
+    float sT_Wtmu1;
+    u32 sDrawTriCMD;
+    u32 sBeginTriCMD;
+
+    u32 reserved[22];
+    u32 textureMode;
+    u32 tLOD;
+    u32 tDetail;
+    u32 texBaseAddr;
+    u32 texBaseAddr1;
+    u32 texBaseAddr2;
+    u32 texBaseAddr3_8;
+    u32 texStride;
+    u32 trexInit1;
+
+    u32 nccTable0[12];
+    u32 nccTable1[12];
+
+    u32 reserved4[31];
+} Voodoo3D;
+
+
+typedef volatile struct {
+     u32 status;
+     u32 intCtrl;
+     u32 clip0Min;
+     u32 clip0Max;
+     u32 dstBaseAddr;
+     u32 dstFormat;
+     u32 srcColorkeyMin;
+     u32 srcColorkeyMax;
+     u32 dstColorkeyMin;
+     u32 dstColorkeyMax;
+     u32 bresError0;
+     u32 bresError1;
+     u32 rop;
+     u32 srcBaseAddr;
+     u32 commandExtra;
+     u32 lineStipple;
+     u32 lineStyle;
+     u32 pattern0Alias;
+     u32 pattern1Alias;
+     u32 clip1Min;
+     u32 clip1Max;
+     u32 srcFormat;
+     u32 srcSize;
+     u32 srcXY;
+     u32 colorBack;
+     u32 colorFore;
+     u32 dstSize;
+     u32 dstXY;
+     u32 command;
+
+     u32 reserved[3];
+
+     u32 launchArea[32];
+
+     u32 colorPattern[64];
+} Voodoo2D;
+
+#endif
diff --git a/Source/DirectFB/gfxdrivers/unichrome/Makefile.am b/Source/DirectFB/gfxdrivers/unichrome/Makefile.am
new file mode 100755
index 0000000..3d4c3f9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/Makefile.am
@@ -0,0 +1,50 @@
+## Makefile.am for DirectFB/gfxdrivers/unichrome
+
+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
+
+AM_CFLAGS = $(DFB_CFLAGS)
+
+unichrome_LTLIBRARIES = libdirectfb_unichrome.la
+
+if BUILD_STATIC
+unichrome_DATA = $(unichrome_LTLIBRARIES:.la=.o)
+endif
+
+unichromedir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_unichrome_la_SOURCES =  \
+	unichrome.c     unichrome.h     \
+	uc_probe.h                      \
+	uc_accel.c      uc_accel.h      \
+	uc_hw.h                         \
+	uc_hwset.c      uc_hwmap.c      \
+	uc_state.c      uc_state.h      \
+	uc_fifo.c       uc_fifo.h       \
+	uc_overlay.c    uc_overlay.h    \
+	uc_ovl_hwmap.c  uc_ovl_hwset.c  \
+	uc_primary.c                    \
+	uc_spic.c                       \
+	uc_ioctl.h                      \
+	mmio.h          vidregs.h       \
+	regs2d.h        regs3d.h
+
+libdirectfb_unichrome_la_LDFLAGS = \
+	-module			   \
+	-avoid-version		   \
+	$(DFB_LDFLAGS)
+
+libdirectfb_unichrome_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la	\
+	-lm
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/gfxdrivers/unichrome/Makefile.in b/Source/DirectFB/gfxdrivers/unichrome/Makefile.in
new file mode 100755
index 0000000..81e7126
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/Makefile.in
@@ -0,0 +1,626 @@
+# 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/unichrome
+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)$(unichromedir)" \
+	"$(DESTDIR)$(unichromedir)"
+unichromeLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(unichrome_LTLIBRARIES)
+libdirectfb_unichrome_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_unichrome_la_OBJECTS = unichrome.lo uc_accel.lo \
+	uc_hwset.lo uc_hwmap.lo uc_state.lo uc_fifo.lo uc_overlay.lo \
+	uc_ovl_hwmap.lo uc_ovl_hwset.lo uc_primary.lo uc_spic.lo
+libdirectfb_unichrome_la_OBJECTS =  \
+	$(am_libdirectfb_unichrome_la_OBJECTS)
+libdirectfb_unichrome_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_unichrome_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_unichrome_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_unichrome_la_SOURCES)
+unichromeDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(unichrome_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
+
+AM_CFLAGS = $(DFB_CFLAGS)
+unichrome_LTLIBRARIES = libdirectfb_unichrome.la
+@BUILD_STATIC_TRUE@unichrome_DATA = $(unichrome_LTLIBRARIES:.la=.o)
+unichromedir = $(MODULEDIR)/gfxdrivers
+libdirectfb_unichrome_la_SOURCES = \
+	unichrome.c     unichrome.h     \
+	uc_probe.h                      \
+	uc_accel.c      uc_accel.h      \
+	uc_hw.h                         \
+	uc_hwset.c      uc_hwmap.c      \
+	uc_state.c      uc_state.h      \
+	uc_fifo.c       uc_fifo.h       \
+	uc_overlay.c    uc_overlay.h    \
+	uc_ovl_hwmap.c  uc_ovl_hwset.c  \
+	uc_primary.c                    \
+	uc_spic.c                       \
+	uc_ioctl.h                      \
+	mmio.h          vidregs.h       \
+	regs2d.h        regs3d.h
+
+libdirectfb_unichrome_la_LDFLAGS = \
+	-module			   \
+	-avoid-version		   \
+	$(DFB_LDFLAGS)
+
+libdirectfb_unichrome_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la	\
+	-lm
+
+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/unichrome/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/unichrome/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-unichromeLTLIBRARIES: $(unichrome_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(unichromedir)" || $(MKDIR_P) "$(DESTDIR)$(unichromedir)"
+	@list='$(unichrome_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(unichromeLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(unichromedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(unichromeLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(unichromedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-unichromeLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(unichrome_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(unichromedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(unichromedir)/$$p"; \
+	done
+
+clean-unichromeLTLIBRARIES:
+	-test -z "$(unichrome_LTLIBRARIES)" || rm -f $(unichrome_LTLIBRARIES)
+	@list='$(unichrome_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_unichrome.la: $(libdirectfb_unichrome_la_OBJECTS) $(libdirectfb_unichrome_la_DEPENDENCIES) 
+	$(libdirectfb_unichrome_la_LINK) -rpath $(unichromedir) $(libdirectfb_unichrome_la_OBJECTS) $(libdirectfb_unichrome_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_accel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_fifo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_hwmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_hwset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_overlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_ovl_hwmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_ovl_hwset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_spic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uc_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unichrome.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-unichromeDATA: $(unichrome_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(unichromedir)" || $(MKDIR_P) "$(DESTDIR)$(unichromedir)"
+	@list='$(unichrome_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(unichromeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(unichromedir)/$$f'"; \
+	  $(unichromeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(unichromedir)/$$f"; \
+	done
+
+uninstall-unichromeDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(unichrome_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(unichromedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(unichromedir)/$$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)$(unichromedir)" "$(DESTDIR)$(unichromedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-unichromeLTLIBRARIES \
+	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-unichromeDATA install-unichromeLTLIBRARIES
+
+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-unichromeDATA uninstall-unichromeLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-unichromeLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip install-unichromeDATA \
+	install-unichromeLTLIBRARIES 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-unichromeDATA \
+	uninstall-unichromeLTLIBRARIES
+
+%.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/unichrome/mmio.h b/Source/DirectFB/gfxdrivers/unichrome/mmio.h
new file mode 100755
index 0000000..757445a
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/mmio.h
@@ -0,0 +1,43 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef _VIA_MMIO_H
+#define _VIA_MMIO_H
+
+#define TRACE_ENTER() printf("Entering %s\n", __PRETTY_FUNCTION__)
+#define TRACE_LEAVE() printf("Leaving %s\n", __PRETTY_FUNCTION__)
+
+#ifdef KERNEL
+
+#define VIA_OUT(hwregs, reg, val) *(volatile u32 *)((hwregs) + (reg)) = (val)
+#define VIA_IN(hwregs, reg)       *(volatile u32 *)((hwregs) + (reg))
+#define VGA_OUT8(hwregs, reg, val) *(volatile u8 *)((hwregs) + (reg) + 0x8000) = (val)
+#define VGA_IN8(hwregs, reg)       *(volatile u8 *)((hwregs) + (reg) + 0x8000)
+#define RS16(val)               ((u16)((s16)(val)))
+#define RS12(val)               (((u16)((s16)(val))) & 0xfff)
+
+
+#else // !KERNEL
+
+#define VIA_OUT(hwregs, reg, val)   *(volatile u32 *)((hwregs) + (reg)) = (val)
+#define VIA_IN(hwregs, reg)         *(volatile u32 *)((hwregs) + (reg))
+#define VGA_OUT8(hwregs, reg, val)  *(volatile u8 *)((hwregs) + (reg) + 0x8000) = (val)
+#define VGA_IN8(hwregs, reg)        *(volatile u8 *)((hwregs) + (reg) + 0x8000)
+
+#define RS16(val)               ((u16)((s16)(val)))
+#define RS12(val)               (((u16)((s16)(val))) & 0xfff)
+
+#endif // KERNEL
+
+#define VIDEO_OUT(hwregs, reg, val) VIA_OUT((hwregs)+0x200, reg, val)
+#define VIDEO_IN(hwregs, reg)       VIA_IN((hwregs)+0x200, reg)
+
+#define MAXLOOP                 0xffffff
+
+#endif /* _VIA_MMIO_H */
diff --git a/Source/DirectFB/gfxdrivers/unichrome/regs2d.h b/Source/DirectFB/gfxdrivers/unichrome/regs2d.h
new file mode 100755
index 0000000..9accbf7
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/regs2d.h
@@ -0,0 +1,197 @@
+// Note: This is a modified version of via_regs.h from the XFree86 CVS tree.
+
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIA_REGS_2D_H__
+#define __VIA_REGS_2D_H__
+
+/* Selected 2D engine raster operations.
+ * See xc/programs/Xserver/hw/xfree86/xaa/xaarop.h
+ * in the XFree86 project for the full list.
+ */
+#define VIA_ROP_DPx             (0x5A << 24)
+#define VIA_ROP_DSx             (0x66 << 24)
+#define VIA_ROP_S               (0xCC << 24)
+#define VIA_ROP_P               (0xF0 << 24)
+
+/* My own reverse-engineered bit definitions */
+
+// Use the following definitions with VIA_KEY_CONTROL
+
+/// When set, red channel is not drawn
+#define VIA_KEY_MASK_RED        0x40000000
+/// When set, green channel is not drawn
+#define VIA_KEY_MASK_GREEN      0x20000000
+/// When set, blue channel is not drawn
+#define VIA_KEY_MASK_BLUE       0x10000000
+
+/** When set, destination keying is enabled.
+ * Caveat: VIA's destination key is the opposite of DirectFB's:
+ * It draws where there is no match in the destination surface.
+ */
+#define VIA_KEY_ENABLE_DSTKEY   0x8000
+/** When set, source keying is enabled
+ * It draws the pixels in the source that do not match the color key.
+ */
+#define VIA_KEY_ENABLE_SRCKEY   0x4000
+/** Inverts the behaviour of the color keys:
+ * Dst key: draw where the destination matches the key
+ * Src key: draw where the source matches the key
+ * Problem: Since this bit affects both keys, you can not do
+ * combined source and destination keying with DirectFB.
+ * The inverted source key is all but useless since it will
+ * only draw the source pixels that match the key! 
+ * It must be a design error...
+ */
+#define VIA_KEY_INVERT_KEY      0x2000
+
+/* 2D engine registers and bit definitions */
+
+#define VIA_MMIO_REGSIZE        0x9000
+#define VIA_MMIO_REGBASE        0x0
+#define VIA_MMIO_VGABASE        0x8000
+#define VIA_MMIO_BLTBASE        0x200000
+#define VIA_MMIO_BLTSIZE        0x10000
+
+#define VIA_VQ_SIZE             (256*1024)
+
+/* defines for VIA 2D registers */
+#define VIA_REG_GECMD           0x000
+#define VIA_REG_GEMODE          0x004
+#define VIA_REG_GESTATUS        0x004       /* as same as VIA_REG_GEMODE */
+#define VIA_REG_SRCPOS          0x008
+#define VIA_REG_DSTPOS          0x00C
+#define VIA_REG_LINE_K1K2       0x008
+#define VIA_REG_LINE_XY         0x00C
+#define VIA_REG_DIMENSION       0x010       /* width and height */
+#define VIA_REG_PATADDR         0x014
+#define VIA_REG_FGCOLOR         0x018
+#define VIA_REG_DSTCOLORKEY     0x018       /* as same as VIA_REG_FG */
+#define VIA_REG_BGCOLOR         0x01C
+#define VIA_REG_SRCCOLORKEY     0x01C       /* as same as VIA_REG_BG */
+#define VIA_REG_CLIPTL          0x020       /* top and left of clipping */
+#define VIA_REG_CLIPBR          0x024       /* bottom and right of clipping */
+#define VIA_REG_OFFSET          0x028
+#define VIA_REG_LINE_ERROR      0x028
+#define VIA_REG_KEYCONTROL      0x02C       /* color key control */
+#define VIA_REG_SRCBASE         0x030
+#define VIA_REG_DSTBASE         0x034
+#define VIA_REG_PITCH           0x038       /* pitch of src and dst */
+#define VIA_REG_MONOPAT0        0x03C
+#define VIA_REG_MONOPAT1        0x040
+#define VIA_REG_COLORPAT        0x100       /* from 0x100 to 0x1ff */
+
+
+/* defines for VIA video registers */
+#define VIA_REG_INTERRUPT       0x200
+#define VIA_REG_CRTCSTART       0x214
+
+
+/* defines for VIA HW cursor registers */
+#define VIA_REG_CURSOR_MODE     0x2D0
+#define VIA_REG_CURSOR_POS      0x2D4
+#define VIA_REG_CURSOR_ORG      0x2D8
+#define VIA_REG_CURSOR_BG       0x2DC
+#define VIA_REG_CURSOR_FG       0x2E0
+
+
+/* defines for VIA 3D registers */
+#define VIA_REG_STATUS          0x400
+#define VIA_REG_TRANSET         0x43C
+#define VIA_REG_TRANSPACE       0x440
+
+/* VIA_REG_STATUS(0x400): Engine Status */
+#define VIA_CMD_RGTR_BUSY       0x00000080  /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY         0x00000001  /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY         0x00000002  /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY       0x00020000 /* Virtual Queue is busy */
+
+
+/* VIA_REG_GECMD(0x00): 2D Engine Command  */
+#define VIA_GEC_NOOP            0x00000000
+#define VIA_GEC_BLT             0x00000001
+#define VIA_GEC_LINE            0x00000005
+
+#define VIA_GEC_SRC_XY          0x00000000
+#define VIA_GEC_SRC_LINEAR      0x00000010
+#define VIA_GEC_DST_XY          0x00000000
+#define VIA_GEC_DST_LINRAT      0x00000020
+
+#define VIA_GEC_SRC_FB          0x00000000
+#define VIA_GEC_SRC_SYS         0x00000040
+#define VIA_GEC_DST_FB          0x00000000
+#define VIA_GEC_DST_SYS         0x00000080
+
+#define VIA_GEC_SRC_MONO        0x00000100  /* source is mono */
+#define VIA_GEC_PAT_MONO        0x00000200  /* pattern is mono */
+
+#define VIA_GEC_MSRC_OPAQUE     0x00000000  /* mono src is opaque */
+#define VIA_GEC_MSRC_TRANS      0x00000400  /* mono src is transparent */
+
+#define VIA_GEC_PAT_FB          0x00000000  /* pattern is in frame buffer */
+#define VIA_GEC_PAT_REG         0x00000800  /* pattern is from reg setting */
+
+#define VIA_GEC_CLIP_DISABLE    0x00000000
+#define VIA_GEC_CLIP_ENABLE     0x00001000
+
+#define VIA_GEC_FIXCOLOR_PAT    0x00002000
+
+#define VIA_GEC_INCX            0x00000000
+#define VIA_GEC_DECY            0x00004000
+#define VIA_GEC_INCY            0x00000000
+#define VIA_GEC_DECX            0x00008000
+
+#define VIA_GEC_MPAT_OPAQUE     0x00000000  /* mono pattern is opaque */
+#define VIA_GEC_MPAT_TRANS      0x00010000  /* mono pattern is transparent */
+
+#define VIA_GEC_MONO_UNPACK     0x00000000
+#define VIA_GEC_MONO_PACK       0x00020000
+#define VIA_GEC_MONO_DWORD      0x00000000
+#define VIA_GEC_MONO_WORD       0x00040000
+#define VIA_GEC_MONO_BYTE       0x00080000
+
+#define VIA_GEC_LASTPIXEL_ON    0x00000000
+#define VIA_GEC_LASTPIXEL_OFF   0x00100000
+#define VIA_GEC_X_MAJOR         0x00000000
+#define VIA_GEC_Y_MAJOR         0x00200000
+#define VIA_GEC_QUICK_START     0x00800000
+
+
+/* VIA_REG_GEMODE(0x04): GE mode */
+#define VIA_GEM_8bpp            0x00000000
+#define VIA_GEM_16bpp           0x00000100
+#define VIA_GEM_32bpp           0x00000300
+
+#define VIA_GEM_640             0x00000000   /* 640*480 */
+#define VIA_GEM_800             0x00000400   /* 800*600 */
+#define VIA_GEM_1024            0x00000800   /* 1024*768 */
+#define VIA_GEM_1280            0x00000C00   /* 1280*1024 */
+#define VIA_GEM_1600            0x00001000   /* 1600*1200 */
+#define VIA_GEM_2048            0x00001400   /* 2048*1536 */
+
+/* VIA_REG_PITCH(0x38): Pitch Setting */
+#define VIA_PITCH_ENABLE        0x80000000
+
+#endif // __VIA_REGS_2D_H__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/regs3d.h b/Source/DirectFB/gfxdrivers/unichrome/regs3d.h
new file mode 100755
index 0000000..6243297
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/regs3d.h
@@ -0,0 +1,1642 @@
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIA_REGS_3D_H__
+#define __VIA_REGS_3D_H__
+
+#define HC_REG_BASE             0x0400
+
+#define HC_ParaN_MASK           0xffffffff
+#define HC_Para_MASK            0x00ffffff
+#define HC_SubA_MASK            0xff000000
+#define HC_SubA_SHIFT           24
+/* Transmission Setting
+ */
+#define HC_REG_TRANS_SET        0x003c
+#define HC_ParaSubType_MASK     0xff000000
+#define HC_ParaType_MASK        0x00ff0000
+#define HC_ParaOS_MASK          0x0000ff00
+#define HC_ParaAdr_MASK         0x000000ff
+#define HC_ParaSubType_SHIFT    24
+#define HC_ParaType_SHIFT       16
+#define HC_ParaOS_SHIFT         8
+#define HC_ParaAdr_SHIFT        0
+
+#define HC_ParaType_CmdVdata    0x0000
+#define HC_ParaType_NotTex      0x0001
+#define HC_ParaType_Tex         0x0002
+#define HC_ParaType_Palette     0x0003
+#define HC_ParaType_PreCR       0x0010
+#define HC_ParaType_Auto        0x00fe
+
+/* Transmission Space
+ */
+#define HC_REG_Hpara0           0x0040
+#define HC_REG_HpataAF          0x02fc
+
+/* Read
+ */
+#define HC_REG_HREngSt          0x0000
+#define HC_REG_HRFIFOempty      0x0004
+#define HC_REG_HRFIFOfull       0x0008
+#define HC_REG_HRErr            0x000c
+#define HC_REG_FIFOstatus       0x0010
+/* HC_REG_HREngSt          0x0000
+ */
+#define HC_HDASZC_MASK          0x00010000
+#define HC_HSGEMI_MASK          0x0000f000
+#define HC_HLGEMISt_MASK        0x00000f00
+#define HC_HCRSt_MASK           0x00000080
+#define HC_HSE0St_MASK          0x00000040
+#define HC_HSE1St_MASK          0x00000020
+#define HC_HPESt_MASK           0x00000010
+#define HC_HXESt_MASK           0x00000008
+#define HC_HBESt_MASK           0x00000004
+#define HC_HE2St_MASK           0x00000002
+#define HC_HE3St_MASK           0x00000001
+/* HC_REG_HRFIFOempty      0x0004
+ */
+#define HC_HRZDempty_MASK       0x00000010
+#define HC_HRTXAempty_MASK      0x00000008
+#define HC_HRTXDempty_MASK      0x00000004
+#define HC_HWZDempty_MASK       0x00000002
+#define HC_HWCDempty_MASK       0x00000001
+/* HC_REG_HRFIFOfull       0x0008
+ */
+#define HC_HRZDfull_MASK        0x00000010
+#define HC_HRTXAfull_MASK       0x00000008
+#define HC_HRTXDfull_MASK       0x00000004
+#define HC_HWZDfull_MASK        0x00000002
+#define HC_HWCDfull_MASK        0x00000001
+/* HC_REG_HRErr            0x000c
+ */
+#define HC_HAGPCMErr_MASK       0x80000000
+#define HC_HAGPCMErrC_MASK      0x70000000
+/* HC_REG_FIFOstatus       0x0010
+ */
+#define HC_HRFIFOATall_MASK     0x80000000
+#define HC_HRFIFOATbusy_MASK    0x40000000
+#define HC_HRATFGMDo_MASK       0x00000100
+#define HC_HRATFGMDi_MASK       0x00000080
+#define HC_HRATFRZD_MASK        0x00000040
+#define HC_HRATFRTXA_MASK       0x00000020
+#define HC_HRATFRTXD_MASK       0x00000010
+#define HC_HRATFWZD_MASK        0x00000008
+#define HC_HRATFWCD_MASK        0x00000004
+#define HC_HRATTXTAG_MASK       0x00000002
+#define HC_HRATTXCH_MASK        0x00000001
+
+/* AGP Command Setting
+ */
+#define HC_SubA_HAGPBstL        0x0060
+#define HC_SubA_HAGPBendL       0x0061
+#define HC_SubA_HAGPCMNT        0x0062
+#define HC_SubA_HAGPBpL         0x0063
+#define HC_SubA_HAGPBpH         0x0064
+/* HC_SubA_HAGPCMNT        0x0062
+ */
+#define HC_HAGPCMNT_MASK        0x00800000
+#define HC_HCmdErrClr_MASK      0x00400000
+#define HC_HAGPBendH_MASK       0x0000ff00
+#define HC_HAGPBstH_MASK        0x000000ff
+#define HC_HAGPBendH_SHIFT      8
+#define HC_HAGPBstH_SHIFT       0
+/* HC_SubA_HAGPBpL         0x0063
+ */
+#define HC_HAGPBpL_MASK         0x00fffffc
+#define HC_HAGPBpID_MASK        0x00000003
+#define HC_HAGPBpID_PAUSE       0x00000000
+#define HC_HAGPBpID_JUMP        0x00000001
+#define HC_HAGPBpID_STOP        0x00000002
+/* HC_SubA_HAGPBpH         0x0064
+ */
+#define HC_HAGPBpH_MASK         0x00ffffff
+
+/* Miscellaneous Settings
+ */
+#define HC_SubA_HClipTB         0x0070
+#define HC_SubA_HClipLR         0x0071
+#define HC_SubA_HFPClipTL       0x0072
+#define HC_SubA_HFPClipBL       0x0073
+#define HC_SubA_HFPClipLL       0x0074
+#define HC_SubA_HFPClipRL       0x0075
+#define HC_SubA_HFPClipTBH      0x0076
+#define HC_SubA_HFPClipLRH      0x0077
+#define HC_SubA_HLP             0x0078
+#define HC_SubA_HLPRF           0x0079
+#define HC_SubA_HSolidCL        0x007a
+#define HC_SubA_HPixGC          0x007b
+#define HC_SubA_HSPXYOS         0x007c
+#define HC_SubA_HVertexCNT      0x007d
+
+#define HC_HClipT_MASK          0x00fff000
+#define HC_HClipT_SHIFT         12
+#define HC_HClipB_MASK          0x00000fff
+#define HC_HClipB_SHIFT         0
+#define HC_HClipL_MASK          0x00fff000
+#define HC_HClipL_SHIFT         12
+#define HC_HClipR_MASK          0x00000fff
+#define HC_HClipR_SHIFT         0
+#define HC_HFPClipBH_MASK       0x0000ff00
+#define HC_HFPClipBH_SHIFT      8
+#define HC_HFPClipTH_MASK       0x000000ff
+#define HC_HFPClipTH_SHIFT      0
+#define HC_HFPClipRH_MASK       0x0000ff00
+#define HC_HFPClipRH_SHIFT      8
+#define HC_HFPClipLH_MASK       0x000000ff
+#define HC_HFPClipLH_SHIFT      0
+#define HC_HSolidCH_MASK        0x000000ff
+#define HC_HPixGC_MASK          0x00800000
+#define HC_HSPXOS_MASK          0x00fff000
+#define HC_HSPXOS_SHIFT         12
+#define HC_HSPYOS_MASK          0x00000fff
+
+/* Command
+ * Command A
+ */
+#define HC_HCmdHeader_MASK      0xfe000000  /*0xffe00000*/
+#define HC_HE3Fire_MASK         0x00100000
+#define HC_HPMType_MASK         0x000f0000
+#define HC_HEFlag_MASK          0x0000e000
+#define HC_HShading_MASK        0x00001c00
+#define HC_HPMValidN_MASK       0x00000200
+#define HC_HPLEND_MASK          0x00000100
+#define HC_HVCycle_MASK         0x000000ff
+#define HC_HVCycle_Style_MASK   0x000000c0
+#define HC_HVCycle_ChgA_MASK    0x00000030
+#define HC_HVCycle_ChgB_MASK    0x0000000c
+#define HC_HVCycle_ChgC_MASK    0x00000003
+#define HC_HPMType_Point        0x00000000
+#define HC_HPMType_Line         0x00010000
+#define HC_HPMType_Tri          0x00020000
+#define HC_HPMType_TriWF        0x00040000
+#define HC_HEFlag_NoAA          0x00000000
+#define HC_HEFlag_ab            0x00008000
+#define HC_HEFlag_bc            0x00004000
+#define HC_HEFlag_ca            0x00002000
+#define HC_HShading_Solid       0x00000000
+#define HC_HShading_FlatA       0x00000400
+#define HC_HShading_FlatB       0x00000800
+#define HC_HShading_FlatC       0x00000c00
+#define HC_HShading_Gouraud     0x00001000
+#define HC_HVCycle_Full         0x00000000
+#define HC_HVCycle_AFP          0x00000040
+#define HC_HVCycle_One          0x000000c0
+#define HC_HVCycle_NewA         0x00000000
+#define HC_HVCycle_AA           0x00000010
+#define HC_HVCycle_AB           0x00000020
+#define HC_HVCycle_AC           0x00000030
+#define HC_HVCycle_NewB         0x00000000
+#define HC_HVCycle_BA           0x00000004
+#define HC_HVCycle_BB           0x00000008
+#define HC_HVCycle_BC           0x0000000c
+#define HC_HVCycle_NewC         0x00000000
+#define HC_HVCycle_CA           0x00000001
+#define HC_HVCycle_CB           0x00000002
+#define HC_HVCycle_CC           0x00000003
+
+/* Command B
+ */
+#define HC_HLPrst_MASK          0x00010000
+#define HC_HLLastP_MASK         0x00008000
+#define HC_HVPMSK_MASK          0x00007f80
+#define HC_HBFace_MASK          0x00000040
+#define HC_H2nd1VT_MASK         0x0000003f
+#define HC_HVPMSK_X             0x00004000
+#define HC_HVPMSK_Y             0x00002000
+#define HC_HVPMSK_Z             0x00001000
+#define HC_HVPMSK_W             0x00000800
+#define HC_HVPMSK_Cd            0x00000400
+#define HC_HVPMSK_Cs            0x00000200
+#define HC_HVPMSK_S             0x00000100
+#define HC_HVPMSK_T             0x00000080
+
+/* Enable Setting
+ */
+#define HC_SubA_HEnable         0x0000
+#define HC_HenTXEnvMap_MASK     0x00200000  /* environment mapping?? */
+#define HC_HenVertexCNT_MASK    0x00100000  /* vertex counter?? */
+#define HC_HenCPUDAZ_MASK       0x00080000  /* ???? */
+#define HC_HenDASZWC_MASK       0x00040000  /* ???? */
+#define HC_HenFBCull_MASK       0x00020000  /* culling? */
+#define HC_HenCW_MASK           0x00010000  /* color write? */
+#define HC_HenAA_MASK           0x00008000  /* anti aliasing??? */
+#define HC_HenST_MASK           0x00004000  /* stencil?? */
+#define HC_HenZT_MASK           0x00002000  /* z test?? */
+#define HC_HenZW_MASK           0x00001000  /* z write?? */
+#define HC_HenAT_MASK           0x00000800  /* alpha test?? */
+#define HC_HenAW_MASK           0x00000400  /* alpha write?? */
+#define HC_HenSP_MASK           0x00000200  /* specular?? */
+#define HC_HenLP_MASK           0x00000100  /* ???? */
+#define HC_HenTXCH_MASK         0x00000080  /* cache? half speed, right fonts */
+#define HC_HenTXMP_MASK         0x00000040  /* texture mapping */
+#define HC_HenTXPP_MASK         0x00000020  /* perspective correction?? */
+#define HC_HenTXTR_MASK         0x00000010  /* ???? */
+#define HC_HenCS_MASK           0x00000008  /* color space?? looks weird */
+#define HC_HenFOG_MASK          0x00000004  /* obviously fogging */
+#define HC_HenABL_MASK          0x00000002  /* alpha blending */
+#define HC_HenDT_MASK           0x00000001  /* dithering */
+
+/* Z Setting
+ */
+#define HC_SubA_HZWBBasL        0x0010
+#define HC_SubA_HZWBBasH        0x0011
+#define HC_SubA_HZWBType        0x0012
+#define HC_SubA_HZBiasL         0x0013
+#define HC_SubA_HZWBend         0x0014
+#define HC_SubA_HZWTMD          0x0015
+#define HC_SubA_HZWCDL          0x0016
+#define HC_SubA_HZWCTAGnum      0x0017
+#define HC_SubA_HZCYNum         0x0018
+#define HC_SubA_HZWCFire        0x0019
+/* HC_SubA_HZWBType
+ */
+#define HC_HZWBType_MASK        0x00800000
+#define HC_HZBiasedWB_MASK      0x00400000
+#define HC_HZONEasFF_MASK       0x00200000
+#define HC_HZOONEasFF_MASK      0x00100000
+#define HC_HZWBFM_MASK          0x00030000
+#define HC_HZWBLoc_MASK         0x0000c000
+#define HC_HZWBPit_MASK         0x00003fff
+#define HC_HZWBFM_16            0x00000000
+#define HC_HZWBFM_32            0x00020000
+#define HC_HZWBFM_24            0x00030000
+#define HC_HZWBLoc_Local        0x00000000
+#define HC_HZWBLoc_SyS          0x00004000
+/* HC_SubA_HZWBend
+ */
+#define HC_HZWBend_MASK         0x00ffe000
+#define HC_HZBiasH_MASK         0x000000ff
+#define HC_HZWBend_SHIFT        10
+/* HC_SubA_HZWTMD
+ */
+#define HC_HZWTMD_MASK          0x00070000
+#define HC_HEBEBias_MASK        0x00007f00
+#define HC_HZNF_MASK            0x000000ff
+#define HC_HZWTMD_NeverPass     0x00000000
+#define HC_HZWTMD_LT            0x00010000
+#define HC_HZWTMD_EQ            0x00020000
+#define HC_HZWTMD_LE            0x00030000
+#define HC_HZWTMD_GT            0x00040000
+#define HC_HZWTMD_NE            0x00050000
+#define HC_HZWTMD_GE            0x00060000
+#define HC_HZWTMD_AllPass       0x00070000
+#define HC_HEBEBias_SHIFT       8
+/* HC_SubA_HZWCDL          0x0016
+ */
+#define HC_HZWCDL_MASK          0x00ffffff
+/* HC_SubA_HZWCTAGnum      0x0017
+ */
+#define HC_HZWCTAGnum_MASK      0x00ff0000
+#define HC_HZWCTAGnum_SHIFT     16
+#define HC_HZWCDH_MASK          0x000000ff
+#define HC_HZWCDH_SHIFT         0
+/* HC_SubA_HZCYNum         0x0018
+ */
+#define HC_HZCYNum_MASK         0x00030000
+#define HC_HZCYNum_SHIFT        16
+#define HC_HZWCQWnum_MASK       0x00003fff
+#define HC_HZWCQWnum_SHIFT      0
+/* HC_SubA_HZWCFire        0x0019
+ */
+#define HC_ZWCFire_MASK         0x00010000
+#define HC_HZWCQWnumLast_MASK   0x00003fff
+#define HC_HZWCQWnumLast_SHIFT  0
+
+/* Stencil Setting
+ */
+#define HC_SubA_HSTREF          0x0023
+#define HC_SubA_HSTMD           0x0024
+/* HC_SubA_HSBFM
+ */
+#define HC_HSBFM_MASK           0x00030000
+#define HC_HSBLoc_MASK          0x0000c000
+#define HC_HSBPit_MASK          0x00003fff
+/* HC_SubA_HSTREF
+ */
+#define HC_HSTREF_MASK          0x00ff0000
+#define HC_HSTOPMSK_MASK        0x0000ff00
+#define HC_HSTBMSK_MASK         0x000000ff
+#define HC_HSTREF_SHIFT         16
+#define HC_HSTOPMSK_SHIFT       8
+/* HC_SubA_HSTMD
+ */
+#define HC_HSTMD_MASK           0x00070000
+#define HC_HSTOPSF_MASK         0x000001c0
+#define HC_HSTOPSPZF_MASK       0x00000038
+#define HC_HSTOPSPZP_MASK       0x00000007
+#define HC_HSTMD_NeverPass      0x00000000
+#define HC_HSTMD_LT             0x00010000
+#define HC_HSTMD_EQ             0x00020000
+#define HC_HSTMD_LE             0x00030000
+#define HC_HSTMD_GT             0x00040000
+#define HC_HSTMD_NE             0x00050000
+#define HC_HSTMD_GE             0x00060000
+#define HC_HSTMD_AllPass        0x00070000
+#define HC_HSTOPSF_KEEP         0x00000000
+#define HC_HSTOPSF_ZERO         0x00000040
+#define HC_HSTOPSF_REPLACE      0x00000080
+#define HC_HSTOPSF_INCRSAT      0x000000c0
+#define HC_HSTOPSF_DECRSAT      0x00000100
+#define HC_HSTOPSF_INVERT       0x00000140
+#define HC_HSTOPSF_INCR         0x00000180
+#define HC_HSTOPSF_DECR         0x000001c0
+#define HC_HSTOPSPZF_KEEP       0x00000000
+#define HC_HSTOPSPZF_ZERO       0x00000008
+#define HC_HSTOPSPZF_REPLACE    0x00000010
+#define HC_HSTOPSPZF_INCRSAT    0x00000018
+#define HC_HSTOPSPZF_DECRSAT    0x00000020
+#define HC_HSTOPSPZF_INVERT     0x00000028
+#define HC_HSTOPSPZF_INCR       0x00000030
+#define HC_HSTOPSPZF_DECR       0x00000038
+#define HC_HSTOPSPZP_KEEP       0x00000000
+#define HC_HSTOPSPZP_ZERO       0x00000001
+#define HC_HSTOPSPZP_REPLACE    0x00000002
+#define HC_HSTOPSPZP_INCRSAT    0x00000003
+#define HC_HSTOPSPZP_DECRSAT    0x00000004
+#define HC_HSTOPSPZP_INVERT     0x00000005
+#define HC_HSTOPSPZP_INCR       0x00000006
+#define HC_HSTOPSPZP_DECR       0x00000007
+
+/* Alpha Setting
+ */
+#define HC_SubA_HABBasL         0x0030
+#define HC_SubA_HABBasH         0x0031
+#define HC_SubA_HABFM           0x0032
+#define HC_SubA_HATMD           0x0033
+#define HC_SubA_HABLCsat        0x0034
+#define HC_SubA_HABLCop         0x0035
+#define HC_SubA_HABLAsat        0x0036
+#define HC_SubA_HABLAop         0x0037
+#define HC_SubA_HABLRCa         0x0038
+#define HC_SubA_HABLRFCa        0x0039
+#define HC_SubA_HABLRCbias      0x003a
+#define HC_SubA_HABLRCb         0x003b
+#define HC_SubA_HABLRFCb        0x003c
+#define HC_SubA_HABLRAa         0x003d
+#define HC_SubA_HABLRAb         0x003e
+/* HC_SubA_HABFM
+ */
+#define HC_HABFM_MASK           0x00030000
+#define HC_HABLoc_MASK          0x0000c000
+#define HC_HABPit_MASK          0x000007ff
+/* HC_SubA_HATMD
+ */
+#define HC_HATMD_MASK           0x00000700
+#define HC_HATREF_MASK          0x000000ff
+#define HC_HATMD_NeverPass      0x00000000
+#define HC_HATMD_LT             0x00000100
+#define HC_HATMD_EQ             0x00000200
+#define HC_HATMD_LE             0x00000300
+#define HC_HATMD_GT             0x00000400
+#define HC_HATMD_NE             0x00000500
+#define HC_HATMD_GE             0x00000600
+#define HC_HATMD_AllPass        0x00000700
+/* HC_SubA_HABLCsat
+ */
+#define HC_HABLCsat_MASK        0x00010000
+#define HC_HABLCa_MASK          0x0000fc00
+#define HC_HABLCa_C_MASK        0x0000c000
+#define HC_HABLCa_OPC_MASK      0x00003c00
+#define HC_HABLFCa_MASK         0x000003f0
+#define HC_HABLFCa_C_MASK       0x00000300
+#define HC_HABLFCa_OPC_MASK     0x000000f0
+#define HC_HABLCbias_MASK       0x0000000f
+#define HC_HABLCbias_C_MASK     0x00000008
+#define HC_HABLCbias_OPC_MASK   0x00000007
+/*-- Define the input color.
+ */
+#define HC_XC_Csrc              0x00000000
+#define HC_XC_Cdst              0x00000001
+#define HC_XC_Asrc              0x00000002
+#define HC_XC_Adst              0x00000003
+#define HC_XC_Fog               0x00000004
+#define HC_XC_HABLRC            0x00000005
+#define HC_XC_minSrcDst         0x00000006
+#define HC_XC_maxSrcDst         0x00000007
+#define HC_XC_mimAsrcInvAdst    0x00000008
+#define HC_XC_OPC               0x00000000
+#define HC_XC_InvOPC            0x00000010
+#define HC_XC_OPCp5             0x00000020
+/*-- Define the input Alpha
+ */
+#define HC_XA_OPA               0x00000000
+#define HC_XA_InvOPA            0x00000010
+#define HC_XA_OPAp5             0x00000020
+#define HC_XA_0                 0x00000000
+#define HC_XA_Asrc              0x00000001
+#define HC_XA_Adst              0x00000002
+#define HC_XA_Fog               0x00000003
+#define HC_XA_minAsrcFog        0x00000004
+#define HC_XA_minAsrcAdst       0x00000005
+#define HC_XA_maxAsrcFog        0x00000006
+#define HC_XA_maxAsrcAdst       0x00000007
+#define HC_XA_HABLRA            0x00000008
+#define HC_XA_minAsrcInvAdst    0x00000008
+#define HC_XA_HABLFRA           0x00000009
+/*--
+ */
+#define HC_HABLCa_OPC           (HC_XC_OPC << 10)
+#define HC_HABLCa_InvOPC        (HC_XC_InvOPC << 10)
+#define HC_HABLCa_OPCp5         (HC_XC_OPCp5 << 10)
+#define HC_HABLCa_Csrc          (HC_XC_Csrc << 10)
+#define HC_HABLCa_Cdst          (HC_XC_Cdst << 10)
+#define HC_HABLCa_Asrc          (HC_XC_Asrc << 10)
+#define HC_HABLCa_Adst          (HC_XC_Adst << 10)
+#define HC_HABLCa_Fog           (HC_XC_Fog << 10)
+#define HC_HABLCa_HABLRCa       (HC_XC_HABLRC << 10)
+#define HC_HABLCa_minSrcDst     (HC_XC_minSrcDst << 10)
+#define HC_HABLCa_maxSrcDst     (HC_XC_maxSrcDst << 10)
+#define HC_HABLFCa_OPC              (HC_XC_OPC << 4)
+#define HC_HABLFCa_InvOPC           (HC_XC_InvOPC << 4)
+#define HC_HABLFCa_OPCp5            (HC_XC_OPCp5 << 4)
+#define HC_HABLFCa_Csrc             (HC_XC_Csrc << 4)
+#define HC_HABLFCa_Cdst             (HC_XC_Cdst << 4)
+#define HC_HABLFCa_Asrc             (HC_XC_Asrc << 4)
+#define HC_HABLFCa_Adst             (HC_XC_Adst << 4)
+#define HC_HABLFCa_Fog              (HC_XC_Fog << 4)
+#define HC_HABLFCa_HABLRCa          (HC_XC_HABLRC << 4)
+#define HC_HABLFCa_minSrcDst        (HC_XC_minSrcDst << 4)
+#define HC_HABLFCa_maxSrcDst        (HC_XC_maxSrcDst << 4)
+#define HC_HABLFCa_mimAsrcInvAdst   (HC_XC_mimAsrcInvAdst << 4)
+#define HC_HABLCbias_HABLRCbias 0x00000000
+#define HC_HABLCbias_Asrc       0x00000001
+#define HC_HABLCbias_Adst       0x00000002
+#define HC_HABLCbias_Fog        0x00000003
+#define HC_HABLCbias_Cin        0x00000004
+/* HC_SubA_HABLCop         0x0035
+ */
+#define HC_HABLdot_MASK         0x00010000
+#define HC_HABLCop_MASK         0x00004000
+#define HC_HABLCb_MASK          0x00003f00
+#define HC_HABLCb_C_MASK        0x00003000
+#define HC_HABLCb_OPC_MASK      0x00000f00
+#define HC_HABLFCb_MASK         0x000000fc
+#define HC_HABLFCb_C_MASK       0x000000c0
+#define HC_HABLFCb_OPC_MASK     0x0000003c
+#define HC_HABLCshift_MASK      0x00000003
+#define HC_HABLCb_OPC           (HC_XC_OPC << 8)
+#define HC_HABLCb_InvOPC        (HC_XC_InvOPC << 8)
+#define HC_HABLCb_OPCp5         (HC_XC_OPCp5 << 8)
+#define HC_HABLCb_Csrc          (HC_XC_Csrc << 8)
+#define HC_HABLCb_Cdst          (HC_XC_Cdst << 8)
+#define HC_HABLCb_Asrc          (HC_XC_Asrc << 8)
+#define HC_HABLCb_Adst          (HC_XC_Adst << 8)
+#define HC_HABLCb_Fog           (HC_XC_Fog << 8)
+#define HC_HABLCb_HABLRCa       (HC_XC_HABLRC << 8)
+#define HC_HABLCb_minSrcDst     (HC_XC_minSrcDst << 8)
+#define HC_HABLCb_maxSrcDst     (HC_XC_maxSrcDst << 8)
+#define HC_HABLFCb_OPC              (HC_XC_OPC << 2)
+#define HC_HABLFCb_InvOPC           (HC_XC_InvOPC << 2)
+#define HC_HABLFCb_OPCp5            (HC_XC_OPCp5 << 2)
+#define HC_HABLFCb_Csrc             (HC_XC_Csrc << 2)
+#define HC_HABLFCb_Cdst             (HC_XC_Cdst << 2)
+#define HC_HABLFCb_Asrc             (HC_XC_Asrc << 2)
+#define HC_HABLFCb_Adst             (HC_XC_Adst << 2)
+#define HC_HABLFCb_Fog              (HC_XC_Fog << 2)
+#define HC_HABLFCb_HABLRCb          (HC_XC_HABLRC << 2)
+#define HC_HABLFCb_minSrcDst        (HC_XC_minSrcDst << 2)
+#define HC_HABLFCb_maxSrcDst        (HC_XC_maxSrcDst << 2)
+#define HC_HABLFCb_mimAsrcInvAdst   (HC_XC_mimAsrcInvAdst << 2)
+/* HC_SubA_HABLAsat        0x0036
+ */
+#define HC_HABLAsat_MASK        0x00010000
+#define HC_HABLAa_MASK          0x0000fc00
+#define HC_HABLAa_A_MASK        0x0000c000
+#define HC_HABLAa_OPA_MASK      0x00003c00
+#define HC_HABLFAa_MASK         0x000003f0
+#define HC_HABLFAa_A_MASK       0x00000300
+#define HC_HABLFAa_OPA_MASK     0x000000f0
+#define HC_HABLAbias_MASK       0x0000000f
+#define HC_HABLAbias_A_MASK     0x00000008
+#define HC_HABLAbias_OPA_MASK   0x00000007
+#define HC_HABLAa_OPA           (HC_XA_OPA << 10)
+#define HC_HABLAa_InvOPA        (HC_XA_InvOPA << 10)
+#define HC_HABLAa_OPAp5         (HC_XA_OPAp5 << 10)
+#define HC_HABLAa_0             (HC_XA_0 << 10)
+#define HC_HABLAa_Asrc          (HC_XA_Asrc << 10)
+#define HC_HABLAa_Adst          (HC_XA_Adst << 10)
+#define HC_HABLAa_Fog           (HC_XA_Fog << 10)
+#define HC_HABLAa_minAsrcFog    (HC_XA_minAsrcFog << 10)
+#define HC_HABLAa_minAsrcAdst   (HC_XA_minAsrcAdst << 10)
+#define HC_HABLAa_maxAsrcFog    (HC_XA_maxAsrcFog << 10)
+#define HC_HABLAa_maxAsrcAdst   (HC_XA_maxAsrcAdst << 10)
+#define HC_HABLAa_HABLRA        (HC_XA_HABLRA << 10)
+#define HC_HABLFAa_OPA          (HC_XA_OPA << 4)
+#define HC_HABLFAa_InvOPA       (HC_XA_InvOPA << 4)
+#define HC_HABLFAa_OPAp5        (HC_XA_OPAp5 << 4)
+#define HC_HABLFAa_0            (HC_XA_0 << 4)
+#define HC_HABLFAa_Asrc         (HC_XA_Asrc << 4)
+#define HC_HABLFAa_Adst         (HC_XA_Adst << 4)
+#define HC_HABLFAa_Fog          (HC_XA_Fog << 4)
+#define HC_HABLFAa_minAsrcFog   (HC_XA_minAsrcFog << 4)
+#define HC_HABLFAa_minAsrcAdst  (HC_XA_minAsrcAdst << 4)
+#define HC_HABLFAa_maxAsrcFog   (HC_XA_maxAsrcFog << 4)
+#define HC_HABLFAa_maxAsrcAdst  (HC_XA_maxAsrcAdst << 4)
+#define HC_HABLFAa_minAsrcInvAdst   (HC_XA_minAsrcInvAdst << 4)
+#define HC_HABLFAa_HABLFRA          (HC_XA_HABLFRA << 4)
+#define HC_HABLAbias_HABLRAbias 0x00000000
+#define HC_HABLAbias_Asrc       0x00000001
+#define HC_HABLAbias_Adst       0x00000002
+#define HC_HABLAbias_Fog        0x00000003
+#define HC_HABLAbias_Aaa        0x00000004
+/* HC_SubA_HABLAop         0x0037
+ */
+#define HC_HABLAop_MASK         0x00004000
+#define HC_HABLAb_MASK          0x00003f00
+#define HC_HABLAb_OPA_MASK      0x00000f00
+#define HC_HABLFAb_MASK         0x000000fc
+#define HC_HABLFAb_OPA_MASK     0x0000003c
+#define HC_HABLAshift_MASK      0x00000003
+#define HC_HABLAb_OPA           (HC_XA_OPA << 8)
+#define HC_HABLAb_InvOPA        (HC_XA_InvOPA << 8)
+#define HC_HABLAb_OPAp5         (HC_XA_OPAp5 << 8)
+#define HC_HABLAb_0             (HC_XA_0 << 8)
+#define HC_HABLAb_Asrc          (HC_XA_Asrc << 8)
+#define HC_HABLAb_Adst          (HC_XA_Adst << 8)
+#define HC_HABLAb_Fog           (HC_XA_Fog << 8)
+#define HC_HABLAb_minAsrcFog    (HC_XA_minAsrcFog << 8)
+#define HC_HABLAb_minAsrcAdst   (HC_XA_minAsrcAdst << 8)
+#define HC_HABLAb_maxAsrcFog    (HC_XA_maxAsrcFog << 8)
+#define HC_HABLAb_maxAsrcAdst   (HC_XA_maxAsrcAdst << 8)
+#define HC_HABLAb_HABLRA        (HC_XA_HABLRA << 8)
+#define HC_HABLFAb_OPA          (HC_XA_OPA << 2)
+#define HC_HABLFAb_InvOPA       (HC_XA_InvOPA << 2)
+#define HC_HABLFAb_OPAp5        (HC_XA_OPAp5 << 2)
+#define HC_HABLFAb_0            (HC_XA_0 << 2)
+#define HC_HABLFAb_Asrc         (HC_XA_Asrc << 2)
+#define HC_HABLFAb_Adst         (HC_XA_Adst << 2)
+#define HC_HABLFAb_Fog          (HC_XA_Fog << 2)
+#define HC_HABLFAb_minAsrcFog   (HC_XA_minAsrcFog << 2)
+#define HC_HABLFAb_minAsrcAdst  (HC_XA_minAsrcAdst << 2)
+#define HC_HABLFAb_maxAsrcFog   (HC_XA_maxAsrcFog << 2)
+#define HC_HABLFAb_maxAsrcAdst  (HC_XA_maxAsrcAdst << 2)
+#define HC_HABLFAb_minAsrcInvAdst   (HC_XA_minAsrcInvAdst << 2)
+#define HC_HABLFAb_HABLFRA          (HC_XA_HABLFRA << 2)
+/* HC_SubA_HABLRAa         0x003d
+ */
+#define HC_HABLRAa_MASK         0x00ff0000
+#define HC_HABLRFAa_MASK        0x0000ff00
+#define HC_HABLRAbias_MASK      0x000000ff
+#define HC_HABLRAa_SHIFT        16
+#define HC_HABLRFAa_SHIFT       8
+/* HC_SubA_HABLRAb         0x003e
+ */
+#define HC_HABLRAb_MASK         0x0000ff00
+#define HC_HABLRFAb_MASK        0x000000ff
+#define HC_HABLRAb_SHIFT        8
+
+/* Destination Setting
+ */
+#define HC_SubA_HDBBasL         0x0040
+#define HC_SubA_HDBBasH         0x0041
+#define HC_SubA_HDBFM           0x0042
+#define HC_SubA_HFBBMSKL        0x0043
+#define HC_SubA_HROP            0x0044
+/* HC_SubA_HDBFM           0x0042
+ */
+#define HC_HDBFM_MASK           0x001f0000
+#define HC_HDBLoc_MASK          0x0000c000
+#define HC_HDBPit_MASK          0x00003fff
+#define HC_HDBFM_RGB555         0x00000000
+#define HC_HDBFM_RGB565         0x00010000
+#define HC_HDBFM_ARGB4444       0x00020000
+#define HC_HDBFM_ARGB1555       0x00030000
+#define HC_HDBFM_BGR555         0x00040000
+#define HC_HDBFM_BGR565         0x00050000
+#define HC_HDBFM_ABGR4444       0x00060000
+#define HC_HDBFM_ABGR1555       0x00070000
+#define HC_HDBFM_ARGB0888       0x00080000
+#define HC_HDBFM_ARGB8888       0x00090000
+#define HC_HDBFM_ABGR0888       0x000a0000
+#define HC_HDBFM_ABGR8888       0x000b0000
+#define HC_HDBLoc_Local         0x00000000
+#define HC_HDBLoc_Sys           0x00004000
+/* HC_SubA_HROP            0x0044
+ */
+#define HC_HROP_MASK            0x00000f00
+#define HC_HFBBMSKH_MASK        0x000000ff
+#define HC_HROP_BLACK           0x00000000
+#define HC_HROP_DPon            0x00000100
+#define HC_HROP_DPna            0x00000200
+#define HC_HROP_Pn              0x00000300
+#define HC_HROP_PDna            0x00000400
+#define HC_HROP_Dn              0x00000500
+#define HC_HROP_DPx             0x00000600
+#define HC_HROP_DPan            0x00000700
+#define HC_HROP_DPa             0x00000800
+#define HC_HROP_DPxn            0x00000900
+#define HC_HROP_D               0x00000a00
+#define HC_HROP_DPno            0x00000b00
+#define HC_HROP_P               0x00000c00
+#define HC_HROP_PDno            0x00000d00
+#define HC_HROP_DPo             0x00000e00
+#define HC_HROP_WHITE           0x00000f00
+
+/* Fog Setting
+ */
+#define HC_SubA_HFogLF          0x0050
+#define HC_SubA_HFogCL          0x0051
+#define HC_SubA_HFogCH          0x0052
+#define HC_SubA_HFogStL         0x0053
+#define HC_SubA_HFogStH         0x0054
+#define HC_SubA_HFogOOdMF       0x0055
+#define HC_SubA_HFogOOdEF       0x0056
+#define HC_SubA_HFogEndL        0x0057
+#define HC_SubA_HFogDenst       0x0058
+/* HC_SubA_FogLF           0x0050
+ */
+#define HC_FogLF_MASK           0x00000010
+#define HC_FogEq_MASK           0x00000008
+#define HC_FogMD_MASK           0x00000007
+#define HC_FogMD_LocalFog        0x00000000
+#define HC_FogMD_LinearFog       0x00000002
+#define HC_FogMD_ExponentialFog  0x00000004
+#define HC_FogMD_Exponential2Fog 0x00000005
+/* #define HC_FogMD_FogTable       0x00000003 */
+
+/* HC_SubA_HFogDenst        0x0058
+ */
+#define HC_FogDenst_MASK        0x001fff00
+#define HC_FogEndL_MASK         0x000000ff
+
+/* Texture subtype definitions
+ */
+#define HC_SubType_Tex0         0x00000000
+#define HC_SubType_Tex1         0x00000001
+#define HC_SubType_TexGeneral   0x000000fe
+
+/* Attribute of texture n
+ */
+#define HC_SubA_HTXnL0BasL      0x0000
+#define HC_SubA_HTXnL1BasL      0x0001
+#define HC_SubA_HTXnL2BasL      0x0002
+#define HC_SubA_HTXnL3BasL      0x0003
+#define HC_SubA_HTXnL4BasL      0x0004
+#define HC_SubA_HTXnL5BasL      0x0005
+#define HC_SubA_HTXnL6BasL      0x0006
+#define HC_SubA_HTXnL7BasL      0x0007
+#define HC_SubA_HTXnL8BasL      0x0008
+#define HC_SubA_HTXnL9BasL      0x0009
+#define HC_SubA_HTXnLaBasL      0x000a
+#define HC_SubA_HTXnLbBasL      0x000b
+#define HC_SubA_HTXnLcBasL      0x000c
+#define HC_SubA_HTXnLdBasL      0x000d
+#define HC_SubA_HTXnLeBasL      0x000e
+#define HC_SubA_HTXnLfBasL      0x000f
+#define HC_SubA_HTXnL10BasL     0x0010
+#define HC_SubA_HTXnL11BasL     0x0011
+#define HC_SubA_HTXnL012BasH    0x0020
+#define HC_SubA_HTXnL345BasH    0x0021
+#define HC_SubA_HTXnL678BasH    0x0022
+#define HC_SubA_HTXnL9abBasH    0x0023
+#define HC_SubA_HTXnLcdeBasH    0x0024
+#define HC_SubA_HTXnLf1011BasH  0x0025
+#define HC_SubA_HTXnL0Pit       0x002b
+#define HC_SubA_HTXnL1Pit       0x002c
+#define HC_SubA_HTXnL2Pit       0x002d
+#define HC_SubA_HTXnL3Pit       0x002e
+#define HC_SubA_HTXnL4Pit       0x002f
+#define HC_SubA_HTXnL5Pit       0x0030
+#define HC_SubA_HTXnL6Pit       0x0031
+#define HC_SubA_HTXnL7Pit       0x0032
+#define HC_SubA_HTXnL8Pit       0x0033
+#define HC_SubA_HTXnL9Pit       0x0034
+#define HC_SubA_HTXnLaPit       0x0035
+#define HC_SubA_HTXnLbPit       0x0036
+#define HC_SubA_HTXnLcPit       0x0037
+#define HC_SubA_HTXnLdPit       0x0038
+#define HC_SubA_HTXnLePit       0x0039
+#define HC_SubA_HTXnLfPit       0x003a
+#define HC_SubA_HTXnL10Pit      0x003b
+#define HC_SubA_HTXnL11Pit      0x003c
+#define HC_SubA_HTXnL0_5WE      0x004b
+#define HC_SubA_HTXnL6_bWE      0x004c
+#define HC_SubA_HTXnLc_11WE     0x004d
+#define HC_SubA_HTXnL0_5HE      0x0051
+#define HC_SubA_HTXnL6_bHE      0x0052
+#define HC_SubA_HTXnLc_11HE     0x0053
+#define HC_SubA_HTXnL0OS        0x0077
+#define HC_SubA_HTXnTB          0x0078
+#define HC_SubA_HTXnMPMD        0x0079
+#define HC_SubA_HTXnCLODu       0x007a
+#define HC_SubA_HTXnFM          0x007b
+#define HC_SubA_HTXnTRCH        0x007c
+#define HC_SubA_HTXnTRCL        0x007d
+#define HC_SubA_HTXnTBC         0x007e
+#define HC_SubA_HTXnTRAH        0x007f
+#define HC_SubA_HTXnTBLCsat     0x0080
+#define HC_SubA_HTXnTBLCop      0x0081
+#define HC_SubA_HTXnTBLMPfog    0x0082
+#define HC_SubA_HTXnTBLAsat     0x0083
+#define HC_SubA_HTXnTBLRCa      0x0085
+#define HC_SubA_HTXnTBLRCb      0x0086
+#define HC_SubA_HTXnTBLRCc      0x0087
+#define HC_SubA_HTXnTBLRCbias   0x0088
+#define HC_SubA_HTXnTBLRAa      0x0089
+#define HC_SubA_HTXnTBLRFog     0x008a
+#define HC_SubA_HTXnBumpM00     0x0090
+#define HC_SubA_HTXnBumpM01     0x0091
+#define HC_SubA_HTXnBumpM10     0x0092
+#define HC_SubA_HTXnBumpM11     0x0093
+#define HC_SubA_HTXnLScale      0x0094
+#define HC_SubA_HTXSMD          0x0000
+/* HC_SubA_HTXnL012BasH    0x0020
+ */
+#define HC_HTXnL0BasH_MASK      0x000000ff
+#define HC_HTXnL1BasH_MASK      0x0000ff00
+#define HC_HTXnL2BasH_MASK      0x00ff0000
+#define HC_HTXnL1BasH_SHIFT     8
+#define HC_HTXnL2BasH_SHIFT     16
+/* HC_SubA_HTXnL345BasH    0x0021
+ */
+#define HC_HTXnL3BasH_MASK      0x000000ff
+#define HC_HTXnL4BasH_MASK      0x0000ff00
+#define HC_HTXnL5BasH_MASK      0x00ff0000
+#define HC_HTXnL4BasH_SHIFT     8
+#define HC_HTXnL5BasH_SHIFT     16
+/* HC_SubA_HTXnL678BasH    0x0022
+ */
+#define HC_HTXnL6BasH_MASK      0x000000ff
+#define HC_HTXnL7BasH_MASK      0x0000ff00
+#define HC_HTXnL8BasH_MASK      0x00ff0000
+#define HC_HTXnL7BasH_SHIFT     8
+#define HC_HTXnL8BasH_SHIFT     16
+/* HC_SubA_HTXnL9abBasH    0x0023
+ */
+#define HC_HTXnL9BasH_MASK      0x000000ff
+#define HC_HTXnLaBasH_MASK      0x0000ff00
+#define HC_HTXnLbBasH_MASK      0x00ff0000
+#define HC_HTXnLaBasH_SHIFT     8
+#define HC_HTXnLbBasH_SHIFT     16
+/* HC_SubA_HTXnLcdeBasH    0x0024
+ */
+#define HC_HTXnLcBasH_MASK      0x000000ff
+#define HC_HTXnLdBasH_MASK      0x0000ff00
+#define HC_HTXnLeBasH_MASK      0x00ff0000
+#define HC_HTXnLdBasH_SHIFT     8
+#define HC_HTXnLeBasH_SHIFT     16
+/* HC_SubA_HTXnLcdeBasH    0x0025
+ */
+#define HC_HTXnLfBasH_MASK      0x000000ff
+#define HC_HTXnL10BasH_MASK      0x0000ff00
+#define HC_HTXnL11BasH_MASK      0x00ff0000
+#define HC_HTXnL10BasH_SHIFT     8
+#define HC_HTXnL11BasH_SHIFT     16
+/* HC_SubA_HTXnL0Pit       0x002b
+ */
+#define HC_HTXnLnPit_MASK       0x00003fff
+#define HC_HTXnEnPit_MASK       0x00080000
+#define HC_HTXnLnPitE_MASK      0x00f00000
+#define HC_HTXnLnPitE_SHIFT     20
+/* HC_SubA_HTXnL0_5WE      0x004b
+ */
+#define HC_HTXnL0WE_MASK        0x0000000f
+#define HC_HTXnL1WE_MASK        0x000000f0
+#define HC_HTXnL2WE_MASK        0x00000f00
+#define HC_HTXnL3WE_MASK        0x0000f000
+#define HC_HTXnL4WE_MASK        0x000f0000
+#define HC_HTXnL5WE_MASK        0x00f00000
+#define HC_HTXnL1WE_SHIFT       4
+#define HC_HTXnL2WE_SHIFT       8
+#define HC_HTXnL3WE_SHIFT       12
+#define HC_HTXnL4WE_SHIFT       16
+#define HC_HTXnL5WE_SHIFT       20
+/* HC_SubA_HTXnL6_bWE      0x004c
+ */
+#define HC_HTXnL6WE_MASK        0x0000000f
+#define HC_HTXnL7WE_MASK        0x000000f0
+#define HC_HTXnL8WE_MASK        0x00000f00
+#define HC_HTXnL9WE_MASK        0x0000f000
+#define HC_HTXnLaWE_MASK        0x000f0000
+#define HC_HTXnLbWE_MASK        0x00f00000
+#define HC_HTXnL7WE_SHIFT       4
+#define HC_HTXnL8WE_SHIFT       8
+#define HC_HTXnL9WE_SHIFT       12
+#define HC_HTXnLaWE_SHIFT       16
+#define HC_HTXnLbWE_SHIFT       20
+/* HC_SubA_HTXnLc_11WE      0x004d
+ */
+#define HC_HTXnLcWE_MASK        0x0000000f
+#define HC_HTXnLdWE_MASK        0x000000f0
+#define HC_HTXnLeWE_MASK        0x00000f00
+#define HC_HTXnLfWE_MASK        0x0000f000
+#define HC_HTXnL10WE_MASK       0x000f0000
+#define HC_HTXnL11WE_MASK       0x00f00000
+#define HC_HTXnLdWE_SHIFT       4
+#define HC_HTXnLeWE_SHIFT       8
+#define HC_HTXnLfWE_SHIFT       12
+#define HC_HTXnL10WE_SHIFT      16
+#define HC_HTXnL11WE_SHIFT      20
+/* HC_SubA_HTXnL0_5HE      0x0051
+ */
+#define HC_HTXnL0HE_MASK        0x0000000f
+#define HC_HTXnL1HE_MASK        0x000000f0
+#define HC_HTXnL2HE_MASK        0x00000f00
+#define HC_HTXnL3HE_MASK        0x0000f000
+#define HC_HTXnL4HE_MASK        0x000f0000
+#define HC_HTXnL5HE_MASK        0x00f00000
+#define HC_HTXnL1HE_SHIFT       4
+#define HC_HTXnL2HE_SHIFT       8
+#define HC_HTXnL3HE_SHIFT       12
+#define HC_HTXnL4HE_SHIFT       16
+#define HC_HTXnL5HE_SHIFT       20
+/* HC_SubA_HTXnL6_bHE      0x0052
+ */
+#define HC_HTXnL6HE_MASK        0x0000000f
+#define HC_HTXnL7HE_MASK        0x000000f0
+#define HC_HTXnL8HE_MASK        0x00000f00
+#define HC_HTXnL9HE_MASK        0x0000f000
+#define HC_HTXnLaHE_MASK        0x000f0000
+#define HC_HTXnLbHE_MASK        0x00f00000
+#define HC_HTXnL7HE_SHIFT       4
+#define HC_HTXnL8HE_SHIFT       8
+#define HC_HTXnL9HE_SHIFT       12
+#define HC_HTXnLaHE_SHIFT       16
+#define HC_HTXnLbHE_SHIFT       20
+/* HC_SubA_HTXnLc_11HE      0x0053
+ */
+#define HC_HTXnLcHE_MASK        0x0000000f
+#define HC_HTXnLdHE_MASK        0x000000f0
+#define HC_HTXnLeHE_MASK        0x00000f00
+#define HC_HTXnLfHE_MASK        0x0000f000
+#define HC_HTXnL10HE_MASK       0x000f0000
+#define HC_HTXnL11HE_MASK       0x00f00000
+#define HC_HTXnLdHE_SHIFT       4
+#define HC_HTXnLeHE_SHIFT       8
+#define HC_HTXnLfHE_SHIFT       12
+#define HC_HTXnL10HE_SHIFT      16
+#define HC_HTXnL11HE_SHIFT      20
+/* HC_SubA_HTXnL0OS        0x0077
+ */
+#define HC_HTXnL0OS_MASK        0x003ff000
+#define HC_HTXnLVmax_MASK       0x00000fc0
+#define HC_HTXnLVmin_MASK       0x0000003f
+#define HC_HTXnL0OS_SHIFT       12
+#define HC_HTXnLVmax_SHIFT      6
+/* HC_SubA_HTXnTB          0x0078
+ */
+#define HC_HTXnTB_MASK          0x00f00000
+#define HC_HTXnFLSe_MASK        0x0000e000
+#define HC_HTXnFLSs_MASK        0x00001c00
+#define HC_HTXnFLTe_MASK        0x00000380
+#define HC_HTXnFLTs_MASK        0x00000070
+#define HC_HTXnFLDs_MASK        0x0000000f
+#define HC_HTXnTB_NoTB          0x00000000
+#define HC_HTXnTB_TBC_S         0x00100000
+#define HC_HTXnTB_TBC_T         0x00200000
+#define HC_HTXnTB_TB_S          0x00400000
+#define HC_HTXnTB_TB_T          0x00800000
+#define HC_HTXnFLSe_Nearest     0x00000000
+#define HC_HTXnFLSe_Linear      0x00002000
+#define HC_HTXnFLSe_NonLinear   0x00004000
+#define HC_HTXnFLSe_Sharp       0x00008000
+#define HC_HTXnFLSe_Flat_Gaussian_Cubic 0x0000c000
+#define HC_HTXnFLSs_Nearest     0x00000000
+#define HC_HTXnFLSs_Linear      0x00000400
+#define HC_HTXnFLSs_NonLinear   0x00000800
+#define HC_HTXnFLSs_Flat_Gaussian_Cubic 0x00001800
+#define HC_HTXnFLTe_Nearest     0x00000000
+#define HC_HTXnFLTe_Linear      0x00000080
+#define HC_HTXnFLTe_NonLinear   0x00000100
+#define HC_HTXnFLTe_Sharp       0x00000180
+#define HC_HTXnFLTe_Flat_Gaussian_Cubic 0x00000300
+#define HC_HTXnFLTs_Nearest     0x00000000
+#define HC_HTXnFLTs_Linear      0x00000010
+#define HC_HTXnFLTs_NonLinear   0x00000020
+#define HC_HTXnFLTs_Flat_Gaussian_Cubic 0x00000060
+#define HC_HTXnFLDs_Tex0        0x00000000
+#define HC_HTXnFLDs_Nearest     0x00000001
+#define HC_HTXnFLDs_Linear      0x00000002
+#define HC_HTXnFLDs_NonLinear   0x00000003
+#define HC_HTXnFLDs_Dither      0x00000004
+#define HC_HTXnFLDs_ConstLOD    0x00000005
+#define HC_HTXnFLDs_Ani         0x00000006
+#define HC_HTXnFLDs_AniDither   0x00000007
+/* HC_SubA_HTXnMPMD        0x0079
+ */
+#define HC_HTXnMPMD_SMASK       0x00070000
+#define HC_HTXnMPMD_TMASK       0x00380000
+#define HC_HTXnLODDTf_MASK      0x00000007
+#define HC_HTXnXY2ST_MASK       0x00000008
+#define HC_HTXnMPMD_Tsingle     0x00000000
+#define HC_HTXnMPMD_Tclamp      0x00080000
+#define HC_HTXnMPMD_Trepeat     0x00100000
+#define HC_HTXnMPMD_Tmirror     0x00180000
+#define HC_HTXnMPMD_Twrap       0x00200000
+#define HC_HTXnMPMD_Ssingle     0x00000000
+#define HC_HTXnMPMD_Sclamp      0x00010000
+#define HC_HTXnMPMD_Srepeat     0x00020000
+#define HC_HTXnMPMD_Smirror     0x00030000
+#define HC_HTXnMPMD_Swrap       0x00040000
+/* HC_SubA_HTXnCLODu       0x007a
+ */
+#define HC_HTXnCLODu_MASK       0x000ffc00
+#define HC_HTXnCLODd_MASK       0x000003ff
+#define HC_HTXnCLODu_SHIFT      10
+/* HC_SubA_HTXnFM          0x007b
+ */
+#define HC_HTXnFM_MASK          0x00ff0000
+#define HC_HTXnLoc_MASK         0x00000003
+#define HC_HTXnFM_INDEX         0x00000000
+#define HC_HTXnFM_Intensity     0x00080000
+#define HC_HTXnFM_Lum           0x00100000
+#define HC_HTXnFM_Alpha         0x00180000
+#define HC_HTXnFM_DX            0x00280000
+#define HC_HTXnFM_ARGB16        0x00880000
+#define HC_HTXnFM_ARGB32        0x00980000
+#define HC_HTXnFM_ABGR16        0x00a80000
+#define HC_HTXnFM_ABGR32        0x00b80000
+#define HC_HTXnFM_RGBA16        0x00c80000
+#define HC_HTXnFM_RGBA32        0x00d80000
+#define HC_HTXnFM_BGRA16        0x00e80000
+#define HC_HTXnFM_BGRA32        0x00f80000
+#define HC_HTXnFM_BUMPMAP       0x00380000
+#define HC_HTXnFM_Index1        (HC_HTXnFM_INDEX     | 0x00000000)
+#define HC_HTXnFM_Index2        (HC_HTXnFM_INDEX     | 0x00010000)
+#define HC_HTXnFM_Index4        (HC_HTXnFM_INDEX     | 0x00020000)
+#define HC_HTXnFM_Index8        (HC_HTXnFM_INDEX     | 0x00030000)
+#define HC_HTXnFM_T1            (HC_HTXnFM_Intensity | 0x00000000)
+#define HC_HTXnFM_T2            (HC_HTXnFM_Intensity | 0x00010000)
+#define HC_HTXnFM_T4            (HC_HTXnFM_Intensity | 0x00020000)
+#define HC_HTXnFM_T8            (HC_HTXnFM_Intensity | 0x00030000)
+#define HC_HTXnFM_L1            (HC_HTXnFM_Lum       | 0x00000000)
+#define HC_HTXnFM_L2            (HC_HTXnFM_Lum       | 0x00010000)
+#define HC_HTXnFM_L4            (HC_HTXnFM_Lum       | 0x00020000)
+#define HC_HTXnFM_L8            (HC_HTXnFM_Lum       | 0x00030000)
+#define HC_HTXnFM_AL44          (HC_HTXnFM_Lum       | 0x00040000)
+#define HC_HTXnFM_AL88          (HC_HTXnFM_Lum       | 0x00050000)
+#define HC_HTXnFM_A1            (HC_HTXnFM_Alpha     | 0x00000000)
+#define HC_HTXnFM_A2            (HC_HTXnFM_Alpha     | 0x00010000)
+#define HC_HTXnFM_A4            (HC_HTXnFM_Alpha     | 0x00020000)
+#define HC_HTXnFM_A8            (HC_HTXnFM_Alpha     | 0x00030000)
+#define HC_HTXnFM_DX1           (HC_HTXnFM_DX        | 0x00010000)
+#define HC_HTXnFM_DX23          (HC_HTXnFM_DX        | 0x00020000)
+#define HC_HTXnFM_DX45          (HC_HTXnFM_DX        | 0x00030000)
+#define HC_HTXnFM_RGB555        (HC_HTXnFM_ARGB16    | 0x00000000)
+#define HC_HTXnFM_RGB565        (HC_HTXnFM_ARGB16    | 0x00010000)
+#define HC_HTXnFM_ARGB1555      (HC_HTXnFM_ARGB16    | 0x00020000)
+#define HC_HTXnFM_ARGB4444      (HC_HTXnFM_ARGB16    | 0x00030000)
+#define HC_HTXnFM_ARGB0888      (HC_HTXnFM_ARGB32    | 0x00000000)
+#define HC_HTXnFM_ARGB8888      (HC_HTXnFM_ARGB32    | 0x00010000)
+#define HC_HTXnFM_BGR555        (HC_HTXnFM_ABGR16    | 0x00000000)
+#define HC_HTXnFM_BGR565        (HC_HTXnFM_ABGR16    | 0x00010000)
+#define HC_HTXnFM_ABGR1555      (HC_HTXnFM_ABGR16    | 0x00020000)
+#define HC_HTXnFM_ABGR4444      (HC_HTXnFM_ABGR16    | 0x00030000)
+#define HC_HTXnFM_ABGR0888      (HC_HTXnFM_ABGR32    | 0x00000000)
+#define HC_HTXnFM_ABGR8888      (HC_HTXnFM_ABGR32    | 0x00010000)
+#define HC_HTXnFM_RGBA5550      (HC_HTXnFM_RGBA16    | 0x00000000)
+#define HC_HTXnFM_RGBA5551      (HC_HTXnFM_RGBA16    | 0x00020000)
+#define HC_HTXnFM_RGBA4444      (HC_HTXnFM_RGBA16    | 0x00030000)
+#define HC_HTXnFM_RGBA8880      (HC_HTXnFM_RGBA32    | 0x00000000)
+#define HC_HTXnFM_RGBA8888      (HC_HTXnFM_RGBA32    | 0x00010000)
+#define HC_HTXnFM_BGRA5550      (HC_HTXnFM_BGRA16    | 0x00000000)
+#define HC_HTXnFM_BGRA5551      (HC_HTXnFM_BGRA16    | 0x00020000)
+#define HC_HTXnFM_BGRA4444      (HC_HTXnFM_BGRA16    | 0x00030000)
+#define HC_HTXnFM_BGRA8880      (HC_HTXnFM_BGRA32    | 0x00000000)
+#define HC_HTXnFM_BGRA8888      (HC_HTXnFM_BGRA32    | 0x00010000)
+#define HC_HTXnFM_VU88          (HC_HTXnFM_BUMPMAP   | 0x00000000)
+#define HC_HTXnFM_LVU655        (HC_HTXnFM_BUMPMAP   | 0x00010000)
+#define HC_HTXnFM_LVU888        (HC_HTXnFM_BUMPMAP   | 0x00020000)
+#define HC_HTXnFM_YUY2          0x00300000
+#define HC_HTXnLoc_Local        0x00000000
+#define HC_HTXnLoc_Sys          0x00000002
+#define HC_HTXnLoc_AGP          0x00000003
+/* HC_SubA_HTXnTRAH        0x007f
+ */
+#define HC_HTXnTRAH_MASK        0x00ff0000
+#define HC_HTXnTRAL_MASK        0x0000ff00
+#define HC_HTXnTBA_MASK         0x000000ff
+#define HC_HTXnTRAH_SHIFT       16
+#define HC_HTXnTRAL_SHIFT       8
+/* HC_SubA_HTXnTBLCsat     0x0080
+ *-- Define the input texture.
+ */
+#define HC_XTC_TOPC             0x00000000
+#define HC_XTC_InvTOPC          0x00000010
+#define HC_XTC_TOPCp5           0x00000020
+#define HC_XTC_Cbias            0x00000000
+#define HC_XTC_InvCbias         0x00000010
+#define HC_XTC_0                0x00000000
+#define HC_XTC_Dif              0x00000001
+#define HC_XTC_Spec             0x00000002
+#define HC_XTC_Tex              0x00000003
+#define HC_XTC_Cur              0x00000004
+#define HC_XTC_Adif             0x00000005
+#define HC_XTC_Fog              0x00000006
+#define HC_XTC_Atex             0x00000007
+#define HC_XTC_Acur             0x00000008
+#define HC_XTC_HTXnTBLRC        0x00000009
+#define HC_XTC_Ctexnext         0x0000000a
+/*--
+ */
+#define HC_HTXnTBLCsat_MASK     0x00800000
+#define HC_HTXnTBLCa_MASK       0x000fc000
+#define HC_HTXnTBLCb_MASK       0x00001f80
+#define HC_HTXnTBLCc_MASK       0x0000003f
+#define HC_HTXnTBLCa_TOPC       (HC_XTC_TOPC << 14)
+#define HC_HTXnTBLCa_InvTOPC    (HC_XTC_InvTOPC << 14)
+#define HC_HTXnTBLCa_TOPCp5     (HC_XTC_TOPCp5 << 14)
+#define HC_HTXnTBLCa_0          (HC_XTC_0 << 14)
+#define HC_HTXnTBLCa_Dif        (HC_XTC_Dif << 14)
+#define HC_HTXnTBLCa_Spec       (HC_XTC_Spec << 14)
+#define HC_HTXnTBLCa_Tex        (HC_XTC_Tex << 14)
+#define HC_HTXnTBLCa_Cur        (HC_XTC_Cur << 14)
+#define HC_HTXnTBLCa_Adif       (HC_XTC_Adif << 14)
+#define HC_HTXnTBLCa_Fog        (HC_XTC_Fog << 14)
+#define HC_HTXnTBLCa_Atex       (HC_XTC_Atex << 14)
+#define HC_HTXnTBLCa_Acur       (HC_XTC_Acur << 14)
+#define HC_HTXnTBLCa_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 14)
+#define HC_HTXnTBLCa_Ctexnext   (HC_XTC_Ctexnext << 14)
+#define HC_HTXnTBLCb_TOPC       (HC_XTC_TOPC << 7)
+#define HC_HTXnTBLCb_InvTOPC    (HC_XTC_InvTOPC << 7)
+#define HC_HTXnTBLCb_TOPCp5     (HC_XTC_TOPCp5 << 7)
+#define HC_HTXnTBLCb_0          (HC_XTC_0 << 7)
+#define HC_HTXnTBLCb_Dif        (HC_XTC_Dif << 7)
+#define HC_HTXnTBLCb_Spec       (HC_XTC_Spec << 7)
+#define HC_HTXnTBLCb_Tex        (HC_XTC_Tex << 7)
+#define HC_HTXnTBLCb_Cur        (HC_XTC_Cur << 7)
+#define HC_HTXnTBLCb_Adif       (HC_XTC_Adif << 7)
+#define HC_HTXnTBLCb_Fog        (HC_XTC_Fog << 7)
+#define HC_HTXnTBLCb_Atex       (HC_XTC_Atex << 7)
+#define HC_HTXnTBLCb_Acur       (HC_XTC_Acur << 7)
+#define HC_HTXnTBLCb_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 7)
+#define HC_HTXnTBLCb_Ctexnext   (HC_XTC_Ctexnext << 7)
+#define HC_HTXnTBLCc_TOPC       (HC_XTC_TOPC << 0)
+#define HC_HTXnTBLCc_InvTOPC    (HC_XTC_InvTOPC << 0)
+#define HC_HTXnTBLCc_TOPCp5     (HC_XTC_TOPCp5 << 0)
+#define HC_HTXnTBLCc_0          (HC_XTC_0 << 0)
+#define HC_HTXnTBLCc_Dif        (HC_XTC_Dif << 0)
+#define HC_HTXnTBLCc_Spec       (HC_XTC_Spec << 0)
+#define HC_HTXnTBLCc_Tex        (HC_XTC_Tex << 0)
+#define HC_HTXnTBLCc_Cur        (HC_XTC_Cur << 0)
+#define HC_HTXnTBLCc_Adif       (HC_XTC_Adif << 0)
+#define HC_HTXnTBLCc_Fog        (HC_XTC_Fog << 0)
+#define HC_HTXnTBLCc_Atex       (HC_XTC_Atex << 0)
+#define HC_HTXnTBLCc_Acur       (HC_XTC_Acur << 0)
+#define HC_HTXnTBLCc_HTXnTBLRC  (HC_XTC_HTXnTBLRC << 0)
+#define HC_HTXnTBLCc_Ctexnext   (HC_XTC_Ctexnext << 0)
+/* HC_SubA_HTXnTBLCop      0x0081
+ */
+#define HC_HTXnTBLdot_MASK      0x00c00000
+#define HC_HTXnTBLCop_MASK      0x00380000
+#define HC_HTXnTBLCbias_MASK    0x0007c000
+#define HC_HTXnTBLCshift_MASK   0x00001800
+#define HC_HTXnTBLAop_MASK      0x00000380
+#define HC_HTXnTBLAbias_MASK    0x00000078
+#define HC_HTXnTBLAshift_MASK   0x00000003
+#define HC_HTXnTBLCop_Add       0x00000000
+#define HC_HTXnTBLCop_Sub       0x00080000
+#define HC_HTXnTBLCop_Min       0x00100000
+#define HC_HTXnTBLCop_Max       0x00180000
+#define HC_HTXnTBLCop_Mask      0x00200000
+#define HC_HTXnTBLCbias_Cbias           (HC_XTC_Cbias << 14)
+#define HC_HTXnTBLCbias_InvCbias        (HC_XTC_InvCbias << 14)
+#define HC_HTXnTBLCbias_0               (HC_XTC_0 << 14)
+#define HC_HTXnTBLCbias_Dif             (HC_XTC_Dif << 14)
+#define HC_HTXnTBLCbias_Spec            (HC_XTC_Spec << 14)
+#define HC_HTXnTBLCbias_Tex             (HC_XTC_Tex << 14)
+#define HC_HTXnTBLCbias_Cur             (HC_XTC_Cur << 14)
+#define HC_HTXnTBLCbias_Adif            (HC_XTC_Adif << 14)
+#define HC_HTXnTBLCbias_Fog             (HC_XTC_Fog << 14)
+#define HC_HTXnTBLCbias_Atex            (HC_XTC_Atex << 14)
+#define HC_HTXnTBLCbias_Acur            (HC_XTC_Acur << 14)
+#define HC_HTXnTBLCbias_HTXnTBLRC       (HC_XTC_HTXnTBLRC << 14)
+#define HC_HTXnTBLCshift_1      0x00000000
+#define HC_HTXnTBLCshift_2      0x00000800
+#define HC_HTXnTBLCshift_No     0x00001000
+#define HC_HTXnTBLCshift_DotP   0x00001800
+#define HC_HTXnTBLAop_Add       0x00000000
+#define HC_HTXnTBLAop_Sub       0x00000080
+#define HC_HTXnTBLAop_Min       0x00000100
+#define HC_HTXnTBLAop_Max       0x00000180
+#define HC_HTXnTBLAop_Mask      0x00000200
+#define HC_HTXnTBLAbias_Inv             0x00000040
+#define HC_HTXnTBLAbias_Adif            0x00000000
+#define HC_HTXnTBLAbias_Fog             0x00000008
+#define HC_HTXnTBLAbias_Acur            0x00000010
+#define HC_HTXnTBLAbias_HTXnTBLRAbias   0x00000018
+#define HC_HTXnTBLAbias_Atex            0x00000020
+#define HC_HTXnTBLAshift_1      0x00000000
+#define HC_HTXnTBLAshift_2      0x00000001
+#define HC_HTXnTBLAshift_No     0x00000002
+/* #define HC_HTXnTBLAshift_DotP   0x00000003 */
+/* HC_SubA_HTXnTBLMPFog    0x0082
+ */
+#define HC_HTXnTBLMPfog_MASK    0x00e00000
+#define HC_HTXnTBLMPfog_0       0x00000000
+#define HC_HTXnTBLMPfog_Adif    0x00200000
+#define HC_HTXnTBLMPfog_Fog     0x00400000
+#define HC_HTXnTBLMPfog_Atex    0x00600000
+#define HC_HTXnTBLMPfog_Acur    0x00800000
+#define HC_HTXnTBLMPfog_GHTXnTBLRFog    0x00a00000
+/* HC_SubA_HTXnTBLAsat     0x0083
+ *-- Define the texture alpha input.
+ */
+#define HC_XTA_TOPA             0x00000000
+#define HC_XTA_InvTOPA          0x00000008
+#define HC_XTA_TOPAp5           0x00000010
+#define HC_XTA_Adif             0x00000000
+#define HC_XTA_Fog              0x00000001
+#define HC_XTA_Acur             0x00000002
+#define HC_XTA_HTXnTBLRA        0x00000003
+#define HC_XTA_Atex             0x00000004
+#define HC_XTA_Atexnext         0x00000005
+/*--
+ */
+#define HC_HTXnTBLAsat_MASK     0x00800000
+#define HC_HTXnTBLAMB_MASK      0x00700000
+#define HC_HTXnTBLAa_MASK       0x0007c000
+#define HC_HTXnTBLAb_MASK       0x00000f80
+#define HC_HTXnTBLAc_MASK       0x0000001f
+#define HC_HTXnTBLAMB_SHIFT     20
+#define HC_HTXnTBLAa_TOPA       (HC_XTA_TOPA << 14)
+#define HC_HTXnTBLAa_InvTOPA    (HC_XTA_InvTOPA << 14)
+#define HC_HTXnTBLAa_TOPAp5     (HC_XTA_TOPAp5 << 14)
+#define HC_HTXnTBLAa_Adif       (HC_XTA_Adif << 14)
+#define HC_HTXnTBLAa_Fog        (HC_XTA_Fog << 14)
+#define HC_HTXnTBLAa_Acur       (HC_XTA_Acur << 14)
+#define HC_HTXnTBLAa_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 14)
+#define HC_HTXnTBLAa_Atex       (HC_XTA_Atex << 14)
+#define HC_HTXnTBLAa_Atexnext   (HC_XTA_Atexnext << 14)
+#define HC_HTXnTBLAb_TOPA       (HC_XTA_TOPA << 7)
+#define HC_HTXnTBLAb_InvTOPA    (HC_XTA_InvTOPA << 7)
+#define HC_HTXnTBLAb_TOPAp5     (HC_XTA_TOPAp5 << 7)
+#define HC_HTXnTBLAb_Adif       (HC_XTA_Adif << 7)
+#define HC_HTXnTBLAb_Fog        (HC_XTA_Fog << 7)
+#define HC_HTXnTBLAb_Acur       (HC_XTA_Acur << 7)
+#define HC_HTXnTBLAb_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 7)
+#define HC_HTXnTBLAb_Atex       (HC_XTA_Atex << 7)
+#define HC_HTXnTBLAb_Atexnext   (HC_XTA_Atexnext << 7)
+#define HC_HTXnTBLAc_TOPA       (HC_XTA_TOPA << 0)
+#define HC_HTXnTBLAc_InvTOPA    (HC_XTA_InvTOPA << 0)
+#define HC_HTXnTBLAc_TOPAp5     (HC_XTA_TOPAp5 << 0)
+#define HC_HTXnTBLAc_Adif       (HC_XTA_Adif << 0)
+#define HC_HTXnTBLAc_Fog        (HC_XTA_Fog << 0)
+#define HC_HTXnTBLAc_Acur       (HC_XTA_Acur << 0)
+#define HC_HTXnTBLAc_HTXnTBLRA  (HC_XTA_HTXnTBLRA << 0)
+#define HC_HTXnTBLAc_Atex       (HC_XTA_Atex << 0)
+#define HC_HTXnTBLAc_Atexnext   (HC_XTA_Atexnext << 0)
+/* HC_SubA_HTXnTBLRAa      0x0089
+ */
+#define HC_HTXnTBLRAa_MASK      0x00ff0000
+#define HC_HTXnTBLRAb_MASK      0x0000ff00
+#define HC_HTXnTBLRAc_MASK      0x000000ff
+#define HC_HTXnTBLRAa_SHIFT     16
+#define HC_HTXnTBLRAb_SHIFT     8
+#define HC_HTXnTBLRAc_SHIFT     0
+/* HC_SubA_HTXnTBLRFog     0x008a
+ */
+#define HC_HTXnTBLRFog_MASK     0x0000ff00
+#define HC_HTXnTBLRAbias_MASK   0x000000ff
+#define HC_HTXnTBLRFog_SHIFT    8
+#define HC_HTXnTBLRAbias_SHIFT  0
+/* HC_SubA_HTXnLScale      0x0094
+ */
+#define HC_HTXnLScale_MASK      0x0007fc00
+#define HC_HTXnLOff_MASK        0x000001ff
+#define HC_HTXnLScale_SHIFT     10
+/* HC_SubA_HTXSMD          0x0000
+ */
+#define HC_HTXSMD_MASK          0x00000080
+#define HC_HTXTMD_MASK          0x00000040
+#define HC_HTXNum_MASK          0x00000038
+#define HC_HTXTRMD_MASK         0x00000006
+#define HC_HTXCHCLR_MASK        0x00000001
+#define HC_HTXNum_SHIFT         3
+
+/* Texture Palette n
+ */
+#define HC_SubType_TexPalette0  0x00000000
+#define HC_SubType_TexPalette1  0x00000001
+#define HC_SubType_FogTable     0x00000010
+#define HC_SubType_Stipple      0x00000014
+/* HC_SubA_TexPalette0     0x0000
+ */
+#define HC_HTPnA_MASK           0xff000000
+#define HC_HTPnR_MASK           0x00ff0000
+#define HC_HTPnG_MASK           0x0000ff00
+#define HC_HTPnB_MASK           0x000000ff
+/* HC_SubA_FogTable        0x0010
+ */
+#define HC_HFPn3_MASK           0xff000000
+#define HC_HFPn2_MASK           0x00ff0000
+#define HC_HFPn1_MASK           0x0000ff00
+#define HC_HFPn_MASK            0x000000ff
+#define HC_HFPn3_SHIFT          24
+#define HC_HFPn2_SHIFT          16
+#define HC_HFPn1_SHIFT          8
+
+/* Auto Testing & Security
+ */
+#define HC_SubA_HenFIFOAT       0x0000
+#define HC_SubA_HFBDrawFirst    0x0004
+#define HC_SubA_HFBBasL         0x0005
+#define HC_SubA_HFBDst          0x0006
+/* HC_SubA_HenFIFOAT       0x0000
+ */
+#define HC_HenFIFOAT_MASK       0x00000020
+#define HC_HenGEMILock_MASK     0x00000010
+#define HC_HenFBASwap_MASK      0x00000008
+#define HC_HenOT_MASK           0x00000004
+#define HC_HenCMDQ_MASK         0x00000002
+#define HC_HenTXCTSU_MASK       0x00000001
+/* HC_SubA_HFBDrawFirst    0x0004
+ */
+#define HC_HFBDrawFirst_MASK    0x00000800
+#define HC_HFBQueue_MASK        0x00000400
+#define HC_HFBLock_MASK         0x00000200
+#define HC_HEOF_MASK            0x00000100
+#define HC_HFBBasH_MASK         0x000000ff
+
+/* GEMI Setting
+ */
+#define HC_SubA_HTArbRCM        0x0008
+#define HC_SubA_HTArbRZ         0x000a
+#define HC_SubA_HTArbWZ         0x000b
+#define HC_SubA_HTArbRTX        0x000c
+#define HC_SubA_HTArbRCW        0x000d
+#define HC_SubA_HTArbE2         0x000e
+#define HC_SubA_HArbRQCM        0x0010
+#define HC_SubA_HArbWQCM        0x0011
+#define HC_SubA_HGEMITout       0x0020
+#define HC_SubA_HFthRTXD        0x0040
+#define HC_SubA_HFthRTXA        0x0044
+#define HC_SubA_HCMDQstL        0x0050
+#define HC_SubA_HCMDQendL       0x0051
+#define HC_SubA_HCMDQLen        0x0052
+/* HC_SubA_HTArbRCM        0x0008
+ */
+#define HC_HTArbRCM_MASK        0x0000ffff
+/* HC_SubA_HTArbRZ         0x000a
+ */
+#define HC_HTArbRZ_MASK         0x0000ffff
+/* HC_SubA_HTArbWZ         0x000b
+ */
+#define HC_HTArbWZ_MASK         0x0000ffff
+/* HC_SubA_HTArbRTX        0x000c
+ */
+#define HC_HTArbRTX_MASK        0x0000ffff
+/* HC_SubA_HTArbRCW        0x000d
+ */
+#define HC_HTArbRCW_MASK        0x0000ffff
+/* HC_SubA_HTArbE2         0x000e
+ */
+#define HC_HTArbE2_MASK         0x0000ffff
+/* HC_SubA_HArbRQCM        0x0010
+ */
+#define HC_HTArbRQCM_MASK       0x0000ffff
+/* HC_SubA_HArbWQCM        0x0011
+ */
+#define HC_HArbWQCM_MASK        0x0000ffff
+/* HC_SubA_HGEMITout       0x0020
+ */
+#define HC_HGEMITout_MASK       0x000f0000
+#define HC_HNPArbZC_MASK        0x0000ffff
+#define HC_HGEMITout_SHIFT      16
+/* HC_SubA_HFthRTXD        0x0040
+ */
+#define HC_HFthRTXD_MASK        0x00ff0000
+#define HC_HFthRZD_MASK         0x0000ff00
+#define HC_HFthWZD_MASK         0x000000ff
+#define HC_HFthRTXD_SHIFT       16
+#define HC_HFthRZD_SHIFT        8
+/* HC_SubA_HFthRTXA        0x0044
+ */
+#define HC_HFthRTXA_MASK        0x000000ff
+
+/******************************************************************************
+** Define the Halcyon Internal register access constants. For simulator only.
+******************************************************************************/
+#define HC_SIMA_HAGPBstL        0x0000
+#define HC_SIMA_HAGPBendL       0x0001
+#define HC_SIMA_HAGPCMNT        0x0002
+#define HC_SIMA_HAGPBpL         0x0003
+#define HC_SIMA_HAGPBpH         0x0004
+#define HC_SIMA_HClipTB         0x0005
+#define HC_SIMA_HClipLR         0x0006
+#define HC_SIMA_HFPClipTL       0x0007
+#define HC_SIMA_HFPClipBL       0x0008
+#define HC_SIMA_HFPClipLL       0x0009
+#define HC_SIMA_HFPClipRL       0x000a
+#define HC_SIMA_HFPClipTBH      0x000b
+#define HC_SIMA_HFPClipLRH      0x000c
+#define HC_SIMA_HLP             0x000d
+#define HC_SIMA_HLPRF           0x000e
+#define HC_SIMA_HSolidCL        0x000f
+#define HC_SIMA_HPixGC          0x0010
+#define HC_SIMA_HSPXYOS         0x0011
+#define HC_SIMA_HCmdA           0x0012
+#define HC_SIMA_HCmdB           0x0013
+#define HC_SIMA_HEnable         0x0014
+#define HC_SIMA_HZWBBasL        0x0015
+#define HC_SIMA_HZWBBasH        0x0016
+#define HC_SIMA_HZWBType        0x0017
+#define HC_SIMA_HZBiasL         0x0018
+#define HC_SIMA_HZWBend         0x0019
+#define HC_SIMA_HZWTMD          0x001a
+#define HC_SIMA_HZWCDL          0x001b
+#define HC_SIMA_HZWCTAGnum      0x001c
+#define HC_SIMA_HZCYNum         0x001d
+#define HC_SIMA_HZWCFire        0x001e
+/* #define HC_SIMA_HSBBasL         0x001d */
+/* #define HC_SIMA_HSBBasH         0x001e */
+/* #define HC_SIMA_HSBFM           0x001f */
+#define HC_SIMA_HSTREF          0x0020
+#define HC_SIMA_HSTMD           0x0021
+#define HC_SIMA_HABBasL         0x0022
+#define HC_SIMA_HABBasH         0x0023
+#define HC_SIMA_HABFM           0x0024
+#define HC_SIMA_HATMD           0x0025
+#define HC_SIMA_HABLCsat        0x0026
+#define HC_SIMA_HABLCop         0x0027
+#define HC_SIMA_HABLAsat        0x0028
+#define HC_SIMA_HABLAop         0x0029
+#define HC_SIMA_HABLRCa         0x002a
+#define HC_SIMA_HABLRFCa        0x002b
+#define HC_SIMA_HABLRCbias      0x002c
+#define HC_SIMA_HABLRCb         0x002d
+#define HC_SIMA_HABLRFCb        0x002e
+#define HC_SIMA_HABLRAa         0x002f
+#define HC_SIMA_HABLRAb         0x0030
+#define HC_SIMA_HDBBasL         0x0031
+#define HC_SIMA_HDBBasH         0x0032
+#define HC_SIMA_HDBFM           0x0033
+#define HC_SIMA_HFBBMSKL        0x0034
+#define HC_SIMA_HROP            0x0035
+#define HC_SIMA_HFogLF          0x0036
+#define HC_SIMA_HFogCL          0x0037
+#define HC_SIMA_HFogCH          0x0038
+#define HC_SIMA_HFogStL         0x0039
+#define HC_SIMA_HFogStH         0x003a
+#define HC_SIMA_HFogOOdMF       0x003b
+#define HC_SIMA_HFogOOdEF       0x003c
+#define HC_SIMA_HFogEndL        0x003d
+#define HC_SIMA_HFogDenst       0x003e
+/*---- start of texture 0 setting ----
+ */
+#define HC_SIMA_HTX0L0BasL      0x0040
+#define HC_SIMA_HTX0L1BasL      0x0041
+#define HC_SIMA_HTX0L2BasL      0x0042
+#define HC_SIMA_HTX0L3BasL      0x0043
+#define HC_SIMA_HTX0L4BasL      0x0044
+#define HC_SIMA_HTX0L5BasL      0x0045
+#define HC_SIMA_HTX0L6BasL      0x0046
+#define HC_SIMA_HTX0L7BasL      0x0047
+#define HC_SIMA_HTX0L8BasL      0x0048
+#define HC_SIMA_HTX0L9BasL      0x0049
+#define HC_SIMA_HTX0LaBasL      0x004a
+#define HC_SIMA_HTX0LbBasL      0x004b
+#define HC_SIMA_HTX0LcBasL      0x004c
+#define HC_SIMA_HTX0LdBasL      0x004d
+#define HC_SIMA_HTX0LeBasL      0x004e
+#define HC_SIMA_HTX0LfBasL      0x004f
+#define HC_SIMA_HTX0L10BasL     0x0050
+#define HC_SIMA_HTX0L11BasL     0x0051
+#define HC_SIMA_HTX0L012BasH    0x0052
+#define HC_SIMA_HTX0L345BasH    0x0053
+#define HC_SIMA_HTX0L678BasH    0x0054
+#define HC_SIMA_HTX0L9abBasH    0x0055
+#define HC_SIMA_HTX0LcdeBasH    0x0056
+#define HC_SIMA_HTX0Lf1011BasH  0x0057
+#define HC_SIMA_HTX0L0Pit       0x0058
+#define HC_SIMA_HTX0L1Pit       0x0059
+#define HC_SIMA_HTX0L2Pit       0x005a
+#define HC_SIMA_HTX0L3Pit       0x005b
+#define HC_SIMA_HTX0L4Pit       0x005c
+#define HC_SIMA_HTX0L5Pit       0x005d
+#define HC_SIMA_HTX0L6Pit       0x005e
+#define HC_SIMA_HTX0L7Pit       0x005f
+#define HC_SIMA_HTX0L8Pit       0x0060
+#define HC_SIMA_HTX0L9Pit       0x0061
+#define HC_SIMA_HTX0LaPit       0x0062
+#define HC_SIMA_HTX0LbPit       0x0063
+#define HC_SIMA_HTX0LcPit       0x0064
+#define HC_SIMA_HTX0LdPit       0x0065
+#define HC_SIMA_HTX0LePit       0x0066
+#define HC_SIMA_HTX0LfPit       0x0067
+#define HC_SIMA_HTX0L10Pit      0x0068
+#define HC_SIMA_HTX0L11Pit      0x0069
+#define HC_SIMA_HTX0L0_5WE      0x006a
+#define HC_SIMA_HTX0L6_bWE      0x006b
+#define HC_SIMA_HTX0Lc_11WE     0x006c
+#define HC_SIMA_HTX0L0_5HE      0x006d
+#define HC_SIMA_HTX0L6_bHE      0x006e
+#define HC_SIMA_HTX0Lc_11HE     0x006f
+#define HC_SIMA_HTX0L0OS        0x0070
+#define HC_SIMA_HTX0TB          0x0071
+#define HC_SIMA_HTX0MPMD        0x0072
+#define HC_SIMA_HTX0CLODu       0x0073
+#define HC_SIMA_HTX0FM          0x0074
+#define HC_SIMA_HTX0TRCH        0x0075
+#define HC_SIMA_HTX0TRCL        0x0076
+#define HC_SIMA_HTX0TBC         0x0077
+#define HC_SIMA_HTX0TRAH        0x0078
+#define HC_SIMA_HTX0TBLCsat     0x0079
+#define HC_SIMA_HTX0TBLCop      0x007a
+#define HC_SIMA_HTX0TBLMPfog    0x007b
+#define HC_SIMA_HTX0TBLAsat     0x007c
+#define HC_SIMA_HTX0TBLRCa      0x007d
+#define HC_SIMA_HTX0TBLRCb      0x007e
+#define HC_SIMA_HTX0TBLRCc      0x007f
+#define HC_SIMA_HTX0TBLRCbias   0x0080
+#define HC_SIMA_HTX0TBLRAa      0x0081
+#define HC_SIMA_HTX0TBLRFog     0x0082
+#define HC_SIMA_HTX0BumpM00     0x0083
+#define HC_SIMA_HTX0BumpM01     0x0084
+#define HC_SIMA_HTX0BumpM10     0x0085
+#define HC_SIMA_HTX0BumpM11     0x0086
+#define HC_SIMA_HTX0LScale      0x0087
+/*---- end of texture 0 setting ----      0x008f
+ */
+#define HC_SIMA_TX0TX1_OFF      0x0050
+/*---- start of texture 1 setting ----
+ */
+#define HC_SIMA_HTX1L0BasL      (HC_SIMA_HTX0L0BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L1BasL      (HC_SIMA_HTX0L1BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L2BasL      (HC_SIMA_HTX0L2BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L3BasL      (HC_SIMA_HTX0L3BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L4BasL      (HC_SIMA_HTX0L4BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L5BasL      (HC_SIMA_HTX0L5BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6BasL      (HC_SIMA_HTX0L6BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L7BasL      (HC_SIMA_HTX0L7BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L8BasL      (HC_SIMA_HTX0L8BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9BasL      (HC_SIMA_HTX0L9BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LaBasL      (HC_SIMA_HTX0LaBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LbBasL      (HC_SIMA_HTX0LbBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcBasL      (HC_SIMA_HTX0LcBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LdBasL      (HC_SIMA_HTX0LdBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LeBasL      (HC_SIMA_HTX0LeBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LfBasL      (HC_SIMA_HTX0LfBasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L10BasL     (HC_SIMA_HTX0L10BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L11BasL     (HC_SIMA_HTX0L11BasL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L012BasH    (HC_SIMA_HTX0L012BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L345BasH    (HC_SIMA_HTX0L345BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L678BasH    (HC_SIMA_HTX0L678BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9abBasH    (HC_SIMA_HTX0L9abBasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcdeBasH    (HC_SIMA_HTX0LcdeBasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lf1011BasH  (HC_SIMA_HTX0Lf1011BasH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0Pit       (HC_SIMA_HTX0L0Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L1Pit       (HC_SIMA_HTX0L1Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L2Pit       (HC_SIMA_HTX0L2Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L3Pit       (HC_SIMA_HTX0L3Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L4Pit       (HC_SIMA_HTX0L4Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L5Pit       (HC_SIMA_HTX0L5Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6Pit       (HC_SIMA_HTX0L6Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L7Pit       (HC_SIMA_HTX0L7Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L8Pit       (HC_SIMA_HTX0L8Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L9Pit       (HC_SIMA_HTX0L9Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LaPit       (HC_SIMA_HTX0LaPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LbPit       (HC_SIMA_HTX0LbPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LcPit       (HC_SIMA_HTX0LcPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LdPit       (HC_SIMA_HTX0LdPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LePit       (HC_SIMA_HTX0LePit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LfPit       (HC_SIMA_HTX0LfPit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L10Pit      (HC_SIMA_HTX0L10Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L11Pit      (HC_SIMA_HTX0L11Pit + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0_5WE      (HC_SIMA_HTX0L0_5WE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6_bWE      (HC_SIMA_HTX0L6_bWE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lc_11WE     (HC_SIMA_HTX0Lc_11WE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0_5HE      (HC_SIMA_HTX0L0_5HE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L6_bHE      (HC_SIMA_HTX0L6_bHE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1Lc_11HE      (HC_SIMA_HTX0Lc_11HE + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1L0OS        (HC_SIMA_HTX0L0OS + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TB          (HC_SIMA_HTX0TB + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1MPMD        (HC_SIMA_HTX0MPMD + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1CLODu       (HC_SIMA_HTX0CLODu + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1FM          (HC_SIMA_HTX0FM + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRCH        (HC_SIMA_HTX0TRCH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRCL        (HC_SIMA_HTX0TRCL + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBC         (HC_SIMA_HTX0TBC + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TRAH        (HC_SIMA_HTX0TRAH + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LTC         (HC_SIMA_HTX0LTC + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LTA         (HC_SIMA_HTX0LTA + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLCsat     (HC_SIMA_HTX0TBLCsat + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLCop      (HC_SIMA_HTX0TBLCop + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLMPfog    (HC_SIMA_HTX0TBLMPfog + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLAsat     (HC_SIMA_HTX0TBLAsat + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCa      (HC_SIMA_HTX0TBLRCa + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCb      (HC_SIMA_HTX0TBLRCb + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCc      (HC_SIMA_HTX0TBLRCc + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRCbias   (HC_SIMA_HTX0TBLRCbias + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRAa      (HC_SIMA_HTX0TBLRAa + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1TBLRFog     (HC_SIMA_HTX0TBLRFog + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM00     (HC_SIMA_HTX0BumpM00 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM01     (HC_SIMA_HTX0BumpM01 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM10     (HC_SIMA_HTX0BumpM10 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1BumpM11     (HC_SIMA_HTX0BumpM11 + HC_SIMA_TX0TX1_OFF)
+#define HC_SIMA_HTX1LScale      (HC_SIMA_HTX0LScale + HC_SIMA_TX0TX1_OFF)
+/*---- end of texture 1 setting ---- 0xaf
+ */
+#define HC_SIMA_HTXSMD          0x00b0
+#define HC_SIMA_HenFIFOAT       0x00b1
+#define HC_SIMA_HFBDrawFirst    0x00b2
+#define HC_SIMA_HFBBasL         0x00b3
+#define HC_SIMA_HTArbRCM        0x00b4
+#define HC_SIMA_HTArbRZ         0x00b5
+#define HC_SIMA_HTArbWZ         0x00b6
+#define HC_SIMA_HTArbRTX        0x00b7
+#define HC_SIMA_HTArbRCW        0x00b8
+#define HC_SIMA_HTArbE2         0x00b9
+#define HC_SIMA_HGEMITout       0x00ba
+#define HC_SIMA_HFthRTXD        0x00bb
+#define HC_SIMA_HFthRTXA        0x00bc
+/* Define the texture palette 0
+ */
+#define HC_SIMA_HTP0            0x0100
+#define HC_SIMA_HTP1            0x0200
+#define HC_SIMA_FOGTABLE        0x0300
+#define HC_SIMA_STIPPLE         0x0400
+#define HC_SIMA_HE3Fire         0x0440
+#define HC_SIMA_TRANS_SET       0x0441
+#define HC_SIMA_HREngSt         0x0442
+#define HC_SIMA_HRFIFOempty     0x0443
+#define HC_SIMA_HRFIFOfull      0x0444
+#define HC_SIMA_HRErr           0x0445
+#define HC_SIMA_FIFOstatus      0x0446
+
+/******************************************************************************
+** Define the AGP command header.
+******************************************************************************/
+#define HC_ACMD_MASK            0xfe000000
+#define HC_ACMD_SUB_MASK        0x0c000000
+#define HC_ACMD_HCmdA           0xee000000
+#define HC_ACMD_HCmdB           0xec000000
+#define HC_ACMD_HCmdC           0xea000000
+#define HC_ACMD_H1              0xf0000000
+#define HC_ACMD_H2              0xf2000000
+#define HC_ACMD_H3              0xf4000000
+#define HC_ACMD_H4              0xf6000000
+
+#define HC_ACMD_H1IO_MASK       0x000001ff
+#define HC_ACMD_H2IO1_MASK      0x001ff000
+#define HC_ACMD_H2IO2_MASK      0x000001ff
+#define HC_ACMD_H2IO1_SHIFT     12
+#define HC_ACMD_H2IO2_SHIFT     0
+#define HC_ACMD_H3IO_MASK       0x000001ff
+#define HC_ACMD_H3COUNT_MASK    0x01fff000
+#define HC_ACMD_H3COUNT_SHIFT   12
+#define HC_ACMD_H4ID_MASK       0x000001ff
+#define HC_ACMD_H4COUNT_MASK    0x01fffe00
+#define HC_ACMD_H4COUNT_SHIFT   9
+
+/********************************************************************************
+** Define Header
+********************************************************************************/
+#define HC_HEADER2              0xF210F110
+
+/********************************************************************************
+** Define Dummy Value
+********************************************************************************/
+#define HC_DUMMY                0xCCCCCCCC
+/********************************************************************************
+** Define for DMA use
+********************************************************************************/
+#define HALCYON_HEADER2     0XF210F110
+#define HALCYON_FIRECMD     0XEE100000
+#define HALCYON_FIREMASK    0XFFF00000
+#define HALCYON_CMDB        0XEC000000
+#define HALCYON_CMDBMASK    0XFFFE0000
+#define HALCYON_SUB_ADDR0   0X00000000
+#define HALCYON_HEADER1MASK 0XFFFFFF00
+#define HALCYON_HEADER1     0XF0000000
+#define HC_SubA_HAGPBstL        0x0060
+#define HC_SubA_HAGPBendL       0x0061
+#define HC_SubA_HAGPCMNT        0x0062
+#define HC_SubA_HAGPBpL         0x0063
+#define HC_SubA_HAGPBpH         0x0064
+#define HC_HAGPCMNT_MASK        0x00800000
+#define HC_HCmdErrClr_MASK      0x00400000
+#define HC_HAGPBendH_MASK       0x0000ff00
+#define HC_HAGPBstH_MASK        0x000000ff
+#define HC_HAGPBendH_SHIFT      8
+#define HC_HAGPBstH_SHIFT       0
+#define HC_HAGPBpL_MASK         0x00fffffc
+#define HC_HAGPBpID_MASK        0x00000003
+#define HC_HAGPBpID_PAUSE       0x00000000
+#define HC_HAGPBpID_JUMP        0x00000001
+#define HC_HAGPBpID_STOP        0x00000002
+#define HC_HAGPBpH_MASK         0x00ffffff
+
+#endif // __VIA_REGS_3D_H__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_accel.c b/Source/DirectFB/gfxdrivers/unichrome/uc_accel.c
new file mode 100755
index 0000000..a75cc6d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_accel.c
@@ -0,0 +1,578 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+
+#include <gfx/convert.h>
+
+#include "unichrome.h"
+#include "uc_accel.h"
+#include "uc_fifo.h"
+#include "mmio.h"
+
+#define UC_ACCEL_BEGIN()                        \
+    UcDriverData *ucdrv = (UcDriverData*) drv;  \
+    UcDeviceData *ucdev = (UcDeviceData*) dev;  \
+    struct uc_fifo *fifo = ucdrv->fifo;         \
+    /*printf("entering %s\n", __PRETTY_FUNCTION__)*/
+
+#define UC_ACCEL_END()                                      \
+    UC_FIFO_CHECK(fifo);                                    \
+    /*printf("leaving %s\n", __PRETTY_FUNCTION__)*/
+
+// Private functions ---------------------------------------------------------
+
+/** Wait until a new command can be set up. */
+
+static inline void uc_waitcmd(UcDriverData* ucdrv, UcDeviceData* ucdev)
+{
+    int loop = 0;
+
+    if (!ucdev->must_wait)
+        return;
+
+    //printf("waitcmd ");
+
+    while (VIA_IN(ucdrv->hwregs, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY) {
+        if (++loop > MAXLOOP) {
+            D_ERROR("DirectFB/Unichrome: Timeout waiting for idle command regulator!\n");
+            break;
+        }
+    }
+
+    //printf("waited for %d (0x%x) cycles.\n", loop, loop);
+
+    ucdev->cmd_waitcycles += loop;
+    ucdev->must_wait = 0;
+}
+
+/** Send commands to 2D/3D engine. */
+
+void uc_emit_commands(void* drv, void* dev)
+{
+    UC_ACCEL_BEGIN()
+
+    uc_waitcmd(ucdrv, ucdev);
+
+    UC_FIFO_FLUSH(fifo);
+
+    ucdev->must_wait = 1;
+}
+
+void uc_flush_texture_cache(void* drv, void* dev)
+{
+    UC_ACCEL_BEGIN()
+
+    (void) ucdev;
+
+    UC_FIFO_PREPARE(fifo, 16);
+
+    UC_FIFO_ADD_HDR(fifo, (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24));
+    UC_FIFO_ADD (fifo, 0x00000002);
+
+    UC_FIFO_ADD (fifo, 0x0113000d);
+    UC_FIFO_ADD (fifo, 0x02ed1316);
+    UC_FIFO_ADD (fifo, 0x03071000);
+
+    UC_FIFO_CHECK(fifo);
+}
+
+/**
+ * Draw a horizontal or vertical line.
+ *
+ * @param fifo          command FIFO
+ *
+ * @param x             start x position
+ * @param y             start y position
+ * @param len           length
+ * @param hv            if zero: draw from left to right
+ *                      if nonzero: draw from top to bottom.
+ *
+ * @note This is actually a 1-pixel high or wide rectangular color fill.
+ */
+
+static inline void uc_draw_hv_line(struct uc_fifo* fifo,
+                                   int x, int y, int len, int hv, int rop)
+{
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, ((RS16(y) << 16) | RS16(x)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, len << (hv ? 16 : 0));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT
+        | rop | VIA_GEC_CLIP_ENABLE);
+}
+
+// DirectFB interfacing functions --------------------------------------------
+
+// Functions using the 2D engine ---
+
+bool uc_fill_rectangle(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color);
+
+    if (r->w == 0 || r->h == 0) return true;
+
+    UC_FIFO_PREPARE(fifo, 8);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, ((RS16(r->y) << 16) | RS16(r->x)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION,
+        (((RS16(r->h - 1)) << 16) | RS16((r->w - 1))));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT
+        | ucdev->draw_rop2d | VIA_GEC_CLIP_ENABLE);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_rectangle(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color);
+
+    int rop = ucdev->draw_rop2d;
+
+    // Draw lines, in this order: top, bottom, left, right
+
+    UC_FIFO_PREPARE(fifo, 26);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    uc_draw_hv_line(fifo, r->x, r->y, r->w - 1, 0, rop);
+    uc_draw_hv_line(fifo, r->x, r->y + r->h - 1, r->w - 1, 0, rop);
+    uc_draw_hv_line(fifo, r->x, r->y, r->h - 1, 1, rop);
+    uc_draw_hv_line(fifo, r->x + r->w - 1, r->y, r->h - 1, 1, rop);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_line(void* drv, void* dev, DFBRegion* line)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: l = (%d, %d) - (%d, %d), c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  line->x1, line->y1, line->x2, line->y2, ucdev->color);
+
+    int cmd;
+    int dx, dy, tmp, error;
+
+    error = 1;
+
+    cmd = VIA_GEC_LINE | VIA_GEC_FIXCOLOR_PAT | ucdev->draw_rop2d
+        | VIA_GEC_CLIP_ENABLE;
+
+    dx = line->x2 - line->x1;
+    if (dx < 0)
+    {
+        dx = -dx;
+        cmd |= VIA_GEC_DECX;        // line will be drawn from right
+        error = 0;
+    }
+
+    dy = line->y2 - line->y1;
+    if (dy < 0)
+    {
+        dy = -dy;
+        cmd |= VIA_GEC_DECY;        // line will be drawn from bottom
+    }
+
+    if (dy > dx)
+    {
+        tmp  = dy;
+        dy = dx;
+        dx = tmp;                   // Swap 'dx' and 'dy'
+        cmd |= VIA_GEC_Y_MAJOR;     // Y major line
+    }
+
+    UC_FIFO_PREPARE(fifo, 12);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_K1K2,
+        ((((dy << 1) & 0x3fff) << 16)| (((dy - dx) << 1) & 0x3fff)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_XY,
+        ((RS16(line->y1) << 16) | RS16(line->x1)));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, dx);
+    UC_FIFO_ADD_2D(fifo, VIA_REG_LINE_ERROR,
+        (((dy << 1) - dx - error) & 0x3fff));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, cmd);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+static bool uc_blit_one_plane(void* drv, void* dev, DFBRectangle* rect, int dx, int dy)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = (%d, %d, %d, %d) -> (%d, %d)\n", __PRETTY_FUNCTION__,
+    //  rect->x, rect->y, rect->h, rect->w, dx, dy);
+
+    int cmd = VIA_GEC_BLT | VIA_ROP_S | VIA_GEC_CLIP_ENABLE;
+
+    int sx = rect->x;
+    int sy = rect->y;
+    int w = rect->w;
+    int h = rect->h;
+
+    if (!w || !h) return true;
+
+    (void) ucdev; // Kill 'unused variable' compiler warning.
+
+    if (sx < dx) {
+        cmd |= VIA_GEC_DECX;
+        sx += w - 1;
+        dx += w - 1;
+    }
+
+    if (sy < dy) {
+        cmd |= VIA_GEC_DECY;
+        sy += h - 1;
+        dy += h - 1;
+    }
+
+    UC_FIFO_PREPARE(fifo, 10);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_NotTex << 16);
+
+    UC_FIFO_ADD_2D(fifo, VIA_REG_SRCPOS, (RS16(sy) << 16) | RS16(sx));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DSTPOS, (RS16(dy) << 16) | RS16(dx));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_DIMENSION, (RS16(h - 1) << 16) | RS16(w - 1));
+    UC_FIFO_ADD_2D(fifo, VIA_REG_GECMD, cmd);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+static bool uc_blit_planar(void* drv, void* dev, DFBRectangle* rect, int dx, int dy)
+{
+    UC_ACCEL_BEGIN()
+
+    int uv_dst_offset = ucdev->dst_offset + (ucdev->dst_pitch * ucdev->dst_height);
+    int uv_src_offset = ucdev->src_offset + (ucdev->src_pitch * ucdev->src_height);
+    
+    int uv_dst_pitch = ucdev->dst_pitch / 2;
+    int uv_src_pitch = ucdev->src_pitch / 2;
+    int uv_pitch = ((uv_src_pitch >> 3) & 0x7fff) | (((uv_dst_pitch >> 3) & 0x7fff) << 16);
+    
+    DFBRectangle rect2 = *rect;
+    rect2.h /= 2;
+    rect2.w /= 2;
+    rect2.x /= 2;
+    rect2.y /= 2;
+    
+    // first blit the Y plane
+    
+    uc_blit_one_plane(drv, dev, rect, dx, dy);
+    
+    // now modify the offsets and clip region for the first chrominance plane
+    
+    UC_FIFO_PREPARE ( fifo, 12 );
+    UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH, VIA_PITCH_ENABLE | uv_pitch );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_SRCBASE, uv_src_offset >> 3 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_DSTBASE, uv_dst_offset >> 3 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPTL,
+                      (RS16(ucdev->clip.y1/2) << 16) | RS16(ucdev->clip.x1/2) );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPBR,
+                      (RS16(ucdev->clip.y2/2) << 16) | RS16(ucdev->clip.x2/2) );
+    UC_FIFO_CHECK ( fifo );
+    
+    uc_blit_one_plane(drv, dev, &rect2, dx/2, dy/2);
+    
+    // now for the second chrominance plane
+    
+    uv_src_offset += uv_src_pitch * ucdev->src_height/2;
+    uv_dst_offset += uv_dst_pitch * ucdev->dst_height/2;
+    
+    UC_FIFO_PREPARE ( fifo, 6 );
+    UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_SRCBASE, uv_src_offset >> 3 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_DSTBASE, uv_dst_offset >> 3 );
+    UC_FIFO_CHECK ( fifo );
+
+    uc_blit_one_plane(drv, dev, &rect2, dx/2, dy/2);
+    
+    // restore the card state to how we found it
+
+    UC_FIFO_PREPARE ( fifo, 12 );
+    UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH, VIA_PITCH_ENABLE | ucdev->pitch );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_SRCBASE, ucdev->src_offset >> 3 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_DSTBASE, ucdev->dst_offset >> 3 );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPTL,
+                      (RS16(ucdev->clip.y1) << 16) | RS16(ucdev->clip.x1) );
+    UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPBR,
+                      (RS16(ucdev->clip.y2) << 16) | RS16(ucdev->clip.x2) );
+    UC_FIFO_CHECK ( fifo );
+     
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_blit(void* drv, void* dev, DFBRectangle* rect, int dx, int dy)
+{
+    DFBSurfacePixelFormat format = ((UcDeviceData *)dev)->dst_format;
+    if (format == DSPF_YV12 || format == DSPF_I420)
+        return uc_blit_planar(drv, dev, rect, dx, dy);
+    else
+        return uc_blit_one_plane(drv, dev, rect, dx, dy);
+}
+
+// Functions using the 3D engine ---
+
+bool uc_fill_rectangle_3d(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    //printf("%s: r = {%d, %d, %d, %d}, c = 0x%08x\n", __PRETTY_FUNCTION__,
+    //  r->x, r->y, r->w, r->h, ucdev->color3d);
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HVCycle_AFP |
+        HC_HVCycle_AA | HC_HVCycle_BB | HC_HVCycle_NewC | HC_HShading_FlatC;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    if (r->w == 0 || r->h == 0) return true;
+
+    UC_FIFO_PREPARE(fifo, 18);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, 0);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w, r->y + r->h, 0);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y + r->h, ucdev->color3d);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_rectangle_3d(void* drv, void* dev, DFBRectangle* r)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Line | HC_HVCycle_AFP | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 20);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w - 1, r->y, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x + r->w - 1, r->y + r->h - 1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y + r->h - 1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, r->x, r->y, ucdev->color3d);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_draw_line_3d(void* drv, void* dev, DFBRegion* line)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Line | HC_HVCycle_Full | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 12);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, line->x1, line->y1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, line->x2, line->y2, 0);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_fill_triangle(void* drv, void* dev, DFBTriangle* tri)
+{
+    UC_ACCEL_BEGIN()
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Cd;
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HVCycle_Full | HC_HShading_FlatA;
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    UC_FIFO_PREPARE(fifo, 14);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYC(fifo, tri->x1, tri->y1, ucdev->color3d);
+    UC_FIFO_ADD_XYC(fifo, tri->x2, tri->y2, 0);
+    UC_FIFO_ADD_XYC(fifo, tri->x3, tri->y3, 0);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_ACCEL_END();
+    return true;
+}
+
+bool uc_blit_3d(void* drv, void* dev,
+                DFBRectangle* rect, int dx, int dy)
+{
+    DFBRectangle dest = {dx, dy, rect->w, rect->h};
+    return uc_stretch_blit(drv, dev, rect, &dest);
+}
+
+bool uc_stretch_blit(void* drv, void* dev,
+                     DFBRectangle* sr, DFBRectangle* dr)
+{
+    UC_ACCEL_BEGIN()
+
+    float w = ucdev->hwtex.l2w;
+    float h = ucdev->hwtex.l2h;
+
+    float dy = dr->y;
+
+    float s1 = (sr->x        ) / w;
+    float t1 = (sr->y        ) / h;
+    float s2 = (sr->x + sr->w) / w;
+    float t2 = (sr->y + sr->h) / h;
+
+    int cmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_W |
+               HC_HVPMSK_Cd  | HC_HVPMSK_S | HC_HVPMSK_T;
+
+    int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HShading_FlatC |
+               HC_HVCycle_AFP | HC_HVCycle_AA | HC_HVCycle_BB | HC_HVCycle_NewC;
+
+    int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+    if (ucdev->bflags & DSBLIT_DEINTERLACE) {
+         t1 *= 0.5f;
+         t2 *= 0.5f;
+
+         if (ucdev->field)
+             dy += 0.5f;
+         else
+             dy -= 0.5f;
+    }
+
+    UC_FIFO_PREPARE(fifo, 30);
+
+    UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+    UC_FIFO_ADD(fifo, cmdB);
+    UC_FIFO_ADD(fifo, cmdA);
+
+    UC_FIFO_ADD_XYWCST(fifo, dr->x+dr->w, dy,       1, 0,              s2, t1);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x,       dy+dr->h, 1, 0,              s1, t2);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x,       dy,       1, ucdev->color3d, s1, t1);
+    UC_FIFO_ADD_XYWCST(fifo, dr->x+dr->w, dy+dr->h, 1, ucdev->color3d, s2, t2);
+
+    UC_FIFO_ADD(fifo, cmdA_End);
+
+    UC_FIFO_PAD_EVEN(fifo);
+
+    UC_ACCEL_END();
+
+    return true;
+}
+
+#define DFBCOLOR_TO_ARGB(c)   PIXEL_ARGB( (c).a, (c).r, (c).g, (c).b )
+
+bool uc_texture_triangles( void *drv, void *dev,
+                           DFBVertex *vertices, int num,
+                           DFBTriangleFormation formation )
+{
+     UC_ACCEL_BEGIN()
+
+     int i;
+
+     int cmdB = HC_ACMD_HCmdB |
+                HC_HVPMSK_X   | HC_HVPMSK_Y | HC_HVPMSK_Z | HC_HVPMSK_W |
+                HC_HVPMSK_Cd  | HC_HVPMSK_S | HC_HVPMSK_T;
+
+     int cmdA = HC_ACMD_HCmdA | HC_HPMType_Tri | HC_HShading_Gouraud |
+                HC_HVCycle_Full;
+
+     int cmdA_End = cmdA | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
+
+
+     switch (formation) {
+          case DTTF_LIST:
+               cmdA |= HC_HVCycle_NewA | HC_HVCycle_NewB | HC_HVCycle_NewC;
+               break;
+          case DTTF_STRIP:
+               cmdA |= HC_HVCycle_AB | HC_HVCycle_BC | HC_HVCycle_NewC;
+               break;
+          case DTTF_FAN:
+               cmdA |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
+               break;
+          default:
+               D_ONCE( "unknown triangle formation" );
+               return false;
+     }
+
+     UC_FIFO_PREPARE(fifo, 6 + num * 7);
+
+     UC_FIFO_ADD_HDR(fifo, HC_ParaType_CmdVdata << 16);
+     UC_FIFO_ADD(fifo, cmdB);
+     UC_FIFO_ADD(fifo, cmdA);
+
+     for (i=0; i<num; i++) {
+          UC_FIFO_ADD_XYZWCST(fifo,
+                              vertices[i].x, vertices[i].y,
+                              vertices[i].z, vertices[i].w, ucdev->color3d,
+                              vertices[i].s, vertices[i].t);
+     }
+
+     UC_FIFO_ADD(fifo, cmdA_End);
+
+     UC_FIFO_PAD_EVEN(fifo);
+
+     UC_ACCEL_END();
+
+     return true;
+}
+
+    // Blit profiling
+
+    //struct timeval tv_start, tv_stop;
+    //gettimeofday(&tv_start, NULL);
+
+    // Run test here
+
+    //gettimeofday(&tv_stop, NULL);
+
+    //tv_stop.tv_sec -= tv_start.tv_sec;
+    //tv_stop.tv_usec -= tv_start.tv_usec;
+    //if (tv_stop.tv_usec < 0) {
+    //  tv_stop.tv_sec--;
+    //  tv_stop.tv_usec += 1000000;
+    //}
+
+    //printf("elapsed time: %d us\n", tv_stop.tv_usec);
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_accel.h b/Source/DirectFB/gfxdrivers/unichrome/uc_accel.h
new file mode 100755
index 0000000..2255ddc
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_accel.h
@@ -0,0 +1,123 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_ACCEL_H__
+#define __UC_ACCEL_H__
+
+#include "unichrome.h"
+
+
+// 2D accelerator capabilites
+
+#define UC_DRAWING_FLAGS_2D        (DSDRAW_XOR)
+
+#define UC_BLITTING_FLAGS_2D       (DSBLIT_SRC_COLORKEY | DSBLIT_DST_COLORKEY)
+
+#define UC_DRAWING_FUNCTIONS_2D    (DFXL_DRAWLINE      | \
+                                    DFXL_DRAWRECTANGLE | \
+                                    DFXL_FILLRECTANGLE)
+
+#define UC_BLITTING_FUNCTIONS_2D   (DFXL_BLIT)
+
+
+// 3D accelerator capabilites
+
+#ifdef UC_ENABLE_3D
+
+#define UC_DRAWING_FLAGS_3D        (DSDRAW_BLEND | DSDRAW_XOR)
+
+#define UC_BLITTING_FLAGS_3D       (DSBLIT_BLEND_ALPHACHANNEL | \
+                                    DSBLIT_BLEND_COLORALPHA   | \
+                                    DSBLIT_COLORIZE           | \
+                                    DSBLIT_DEINTERLACE)
+
+#define UC_BLITTING_FLAGS_3D_INV   (DSBLIT_BLEND_ALPHACHANNEL | \
+                                    DSBLIT_COLORIZE           | \
+                                    DSBLIT_DEINTERLACE)
+
+#define UC_DRAWING_FUNCTIONS_3D    (DFXL_DRAWLINE      | \
+                                    DFXL_DRAWRECTANGLE | \
+                                    DFXL_FILLRECTANGLE | \
+                                    DFXL_FILLTRIANGLE)
+
+#define UC_BLITTING_FUNCTIONS_3D   (DFXL_BLIT        | \
+                                    DFXL_STRETCHBLIT | \
+                                    DFXL_TEXTRIANGLES)
+
+#else
+
+#define UC_DRAWING_FLAGS_3D        0
+#define UC_BLITTING_FLAGS_3D       0
+#define UC_DRAWING_FUNCTIONS_3D    0
+#define UC_BLITTING_FUNCTIONS_3D   0
+
+#endif // UC_ENABLE_3D
+
+
+// Functions
+
+void uc_emit_commands      ( void         *drv,
+                             void         *dev );
+
+void uc_flush_texture_cache( void         *drv,
+                             void         *dev );
+
+bool uc_fill_rectangle     ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_rectangle     ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_line          ( void         *drv,
+                             void         *dev,
+                             DFBRegion    *line );
+
+bool uc_blit               ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect,
+                             int           dx,
+                             int           dy );
+
+bool uc_fill_rectangle_3d  ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_rectangle_3d  ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect );
+
+bool uc_draw_line_3d       ( void         *drv,
+                             void         *dev,
+                             DFBRegion    *line );
+
+bool uc_fill_triangle      ( void         *drv,
+                             void         *dev,
+                             DFBTriangle  *tri );
+
+bool uc_blit_3d            ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *rect,
+                             int           dx,
+                             int           dy );
+
+bool uc_stretch_blit       ( void         *drv,
+                             void         *dev,
+                             DFBRectangle *srect,
+                             DFBRectangle *drect );
+
+bool uc_texture_triangles  ( void         *drv,
+                             void         *dev,
+                             DFBVertex    *vertices,
+                             int           num,
+                             DFBTriangleFormation formation );
+
+#endif // __UC_ACCEL_H__
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.c b/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.c
new file mode 100755
index 0000000..cc13433
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.c
@@ -0,0 +1,198 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <fusion/shmalloc.h>
+
+#include "uc_fifo.h"
+
+//#define UC_FIFO_DUMP_DATA
+
+// Private functions ---------------------------------------------------------
+
+/**
+ * Pad the FIFO buffer to a 32 byte boundary. Used by uc_flush_agp().
+ * @note Equivalent DRI code is in via_ioctl::viaFlushPrimsLocked()
+ */
+
+static void uc_fifo_pad(struct uc_fifo* fifo)
+{
+    switch (fifo->used & 0x7)
+    {
+    case 0:
+        break;
+    case 2:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    case 4:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    case 6:
+        UC_FIFO_ADD(fifo, HALCYON_HEADER2);
+        UC_FIFO_ADD(fifo, HC_ParaType_NotTex << 16);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        UC_FIFO_ADD(fifo, HC_DUMMY);
+        break;
+    default:
+        break;
+    }
+}
+
+/**
+ * Manually write the FIFO buffer to the hardware.
+ * @note Equivalent DRI code is in via_ioctl::flush_sys()
+ */
+
+void uc_fifo_flush_sys(struct uc_fifo* fifo, volatile void *regs)
+{
+    u32* p;
+    u32* q;
+
+    volatile u32* hwregs     = regs;
+    volatile u32* reg_tset   = regs + VIA_REG_TRANSET;
+    volatile u32* reg_tspace = regs + VIA_REG_TRANSPACE;
+
+    int check2Dcmd;
+    u32 addr;
+
+    p = fifo->buf;
+    q = fifo->head;
+    check2Dcmd = 0;
+
+    uc_fifo_pad(fifo);
+
+#ifdef UC_FIFO_DUMP_DATA
+    printf("Flushing FIFO ... \n");
+#endif
+
+    while (p != q) {
+
+        if (*p == HALCYON_HEADER2) {
+            p++;
+            check2Dcmd = !(*p == HALCYON_SUB_ADDR0);
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tset = 0x%08x\n", *p);
+#endif
+            *reg_tset = *p;
+            p++;
+        }
+        else if (check2Dcmd && ((*p & HALCYON_HEADER1MASK) == HALCYON_HEADER1)) {
+            addr = (*p) & 0x0000001f;
+            p++;
+#ifdef UC_FIFO_DUMP_DATA
+            printf("2D (0x%02x) = 0x%x\n", addr << 2, *p);
+#endif
+            *(hwregs + addr) = *p;
+            p++;
+        }
+        else if ((*p & HALCYON_FIREMASK) == HALCYON_FIRECMD) {
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tspace = 0x%08x\n", *p);
+#endif
+            *reg_tspace = *p;
+            p++;
+
+            if ((p != q) && ((*p & HALCYON_FIREMASK) == HALCYON_FIRECMD))
+                p++;
+
+            if ((*p & HALCYON_CMDBMASK) != HC_ACMD_HCmdB)
+                check2Dcmd = 1;
+        }
+        else {
+#ifdef UC_FIFO_DUMP_DATA
+            printf("tspace = 0x%08x\n", *p);
+#endif
+            *reg_tspace = *p;
+            p++;
+        }
+    }
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->prep = 0;
+}
+
+/** Use an AGP transfer to write the FIFO buffer to the hardware. Not implemented. */
+#if 0
+static void uc_fifo_flush_agp(struct uc_fifo* fifo)
+{
+    // TODO - however, there is no point in doing this, because
+    // an AGP transfer can require more register writes than
+    // needed for drawing a single primitive. DirectFB needs to
+    // adopt a begin/end architecture first, like OpenGL has.
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->prep = 0;
+}
+#endif
+
+// Public functions ----------------------------------------------------------
+
+/** Create a FIFO. Returns NULL on failure. */
+
+struct uc_fifo* uc_fifo_create(FusionSHMPoolShared *pool, size_t size)
+{
+    struct uc_fifo* fifo;
+
+    size += 32;     // Needed for padding.
+
+    fifo = SHCALLOC(pool, 1, sizeof(struct uc_fifo));
+    if (!fifo) return NULL;
+
+    // Note: malloc won't work for DMA buffers...
+
+    fifo->buf = SHMALLOC(pool, sizeof(u32) * size);
+    if (!(fifo->buf)) {
+        SHFREE(pool, fifo);
+        return NULL;
+    }
+
+    fifo->head = fifo->buf;
+    fifo->used = 0;
+    fifo->size = (unsigned int) size;
+    fifo->prep = 0;
+
+    //fifo->flush_sys = uc_fifo_flush_sys;
+
+    //fifo->flush = uc_fifo_flush_sys;
+
+    return fifo;
+}
+
+/** Destroy a FIFO */
+
+void uc_fifo_destroy(FusionSHMPoolShared *pool, struct uc_fifo* fifo)
+{
+    if (fifo) {
+        if (fifo->buf) {
+            SHFREE(pool, fifo->buf);
+            fifo->buf = NULL;
+        }
+        SHFREE(pool, fifo);
+    }
+}
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.h b/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.h
new file mode 100755
index 0000000..e7a3d8f
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_fifo.h
@@ -0,0 +1,268 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_FIFO_H__
+#define __UC_FIFO_H__
+
+// Note to self: remove when added to makefile as -DUC_DEBUG.
+#define UC_DEBUG 1
+
+#include <dfb_types.h>
+
+#include "regs2d.h"
+#include "regs3d.h"
+#include "mmio.h"
+
+/**
+ * uc_fifo - GPU data queue.
+ *
+ * buf:         buffer start (userspace address)
+ * head:        pointer to first unused entry.
+ *
+ * size:        maximum number of entries in the fifo.
+ * prep:        number of entries allocated to be used.
+ * used:        number of entries currently in use.
+ *
+ * hwregs:      GPU register base address
+ * reg_tset:    address to GPU TRANSET register
+ * reg_tspace:  address to GPU TRANSPACE register
+ *
+ * flush:       function pointer to flush function (DMA or CPU)
+ * flush_sys:   function pointer to flush_sys (non-DMA) function
+ */
+
+struct uc_fifo
+{
+    u32* buf;
+    u32* head;
+
+    unsigned int size;
+    unsigned int prep;
+    unsigned int used;
+
+    //void (*flush)(struct uc_fifo* fifo, volatile void *hwregs);
+    //void (*flush_sys)(struct uc_fifo* fifo, volatile void *hwregs);
+};
+
+// Help macros ---------------------------------------------------------------
+
+// For the record: Macros suck maintenance- and debugging-wise,
+// but provide guaranteed inlining of the code.
+
+/**
+ * Send the contents of the FIFO buffer to the hardware, and clear
+ * the buffer. The transfer may be performed by the CPU or by DMA.
+ */
+
+//#define UC_FIFO_FLUSH(fifo) (fifo)->flush(fifo,ucdrv->hwregs)
+
+/**
+ * Same as UC_FIFO_FLUSH(), but always uses the CPU to transfer data.
+ */
+
+//#define UC_FIFO_FLUSH_SYS(fifo) (fifo)->flush_sys(fifo,ucdrv->hwregs)
+
+#define UC_FIFO_FLUSH(fifo)     uc_fifo_flush_sys(fifo,ucdrv->hwregs)
+#define UC_FIFO_FLUSH_SYS(fifo) uc_fifo_flush_sys(fifo,ucdrv->hwregs)
+
+/**
+ * Make sure there is room for dwsize double words in the FIFO.
+ * If necessary, the FIFO is flushed first.
+ *
+ * @param fifo      the fifo
+ * @param dwsize    number of double words to allocate
+ *
+ * @note It is ok to request more space than you will actually
+ * be using. This is useful when you don't know exactly beforehand
+ * how many entries you need.
+ *
+ * @note equivalent DRI code is in via_ioctl.c::viaCheckDma()
+ */
+
+#ifdef UC_DEBUG
+
+#define UC_FIFO_PREPARE(fifo, dwsize)                            \
+    do {                                                         \
+        if ((fifo)->used + dwsize + 32 > (fifo)->size) {         \
+            D_DEBUG("Unichrome: FIFO full - flushing it.");      \
+            UC_FIFO_FLUSH(fifo);                                 \
+        }                                                        \
+        if (dwsize + (fifo)->prep + 32 > (fifo)->size) {         \
+            D_BUG("Unichrome: FIFO too small for allocation.");  \
+        }                                                        \
+        (fifo)->prep += dwsize;                                  \
+    } while(0)
+
+#else
+
+#define UC_FIFO_PREPARE(fifo, dwsize)                       \
+    do {                                                    \
+        if ((fifo)->used + dwsize + 32 > (fifo)->size) {    \
+            UC_FIFO_FLUSH(fifo);                            \
+        }                                                   \
+        (fifo)->prep += dwsize;                             \
+    } while(0)
+
+#endif // UC_FIFO_DEBUG
+
+/**
+ * Add a 32-bit data word to the FIFO.
+ * Takes one entry in the FIFO.
+ */
+
+#define UC_FIFO_ADD(fifo, data)     \
+    do {                            \
+        *((fifo)->head) = (data);   \
+        (fifo)->head++;             \
+        (fifo)->used++;             \
+    } while(0)
+
+/**
+ * Add a command header. (HC_HEADER2 + parameter selection)
+ * Takes two entries in the fifo.
+ */
+
+#define UC_FIFO_ADD_HDR(fifo, param)    \
+    do {                                \
+        UC_FIFO_ADD(fifo, HC_HEADER2);  \
+        UC_FIFO_ADD(fifo, param);       \
+    } while(0);
+
+/**
+ * Add a floating point value to the FIFO.
+ * Non-floats (e.g integers) are converted first.
+ * Takes one entry in the FIFO.
+ */
+
+#define UC_FIFO_ADD_FLOAT(fifo, val)        \
+    do {                                    \
+        union {float f; u32 i;} v;          \
+        v.f = (float) (val);                \
+        UC_FIFO_ADD(fifo, v.i);             \
+    } while(0)
+
+/**
+ * Add a vertex on the form (x, y, color) to the FIFO.
+ * Takes three entries in the FIFO.
+ * The color format is 0xAARRGGBB.
+ */
+
+#define UC_FIFO_ADD_XYC(fifo, x, y, color)  \
+    do {                                    \
+        UC_FIFO_ADD_FLOAT(fifo, x);         \
+        UC_FIFO_ADD_FLOAT(fifo, y);         \
+        UC_FIFO_ADD(fifo, color);           \
+    } while(0)
+
+/**
+ * Add a vertex on the form (x, y, w, color, s, t) to the FIFO.
+ * Takes six entries in the FIFO.
+ * The color format is 0xAARRGGBB.
+ */
+
+#define UC_FIFO_ADD_XYWCST(fifo, x, y, w, color, s, t)  \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD_FLOAT(fifo, w);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+#define UC_FIFO_ADD_XYZWCST(fifo, x, y, z, w, color, s, t)  \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD_FLOAT(fifo, z);                     \
+        UC_FIFO_ADD_FLOAT(fifo, w);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+#define UC_FIFO_ADD_XYCST(fifo, x, y, color, s, t)      \
+    do {                                                \
+        UC_FIFO_ADD_FLOAT(fifo, x);                     \
+        UC_FIFO_ADD_FLOAT(fifo, y);                     \
+        UC_FIFO_ADD(fifo, color);                       \
+        UC_FIFO_ADD_FLOAT(fifo, s);                     \
+        UC_FIFO_ADD_FLOAT(fifo, t);                     \
+    } while(0)
+
+
+/**
+ * Add data specifically for the 2D controller, to the fifo.
+ * Takes two entries in the FIFO.
+ *
+ * @param reg   2D register index
+ * @param data  32-bit data to add
+ */
+
+#define UC_FIFO_ADD_2D(fifo, reg, data)                     \
+    do {                                                    \
+        UC_FIFO_ADD(fifo, ((reg) >> 2) | HALCYON_HEADER1);  \
+        UC_FIFO_ADD(fifo, (data));                          \
+    } while (0)
+
+/**
+ * Add data specifically for a 3D controller register, to the fifo.
+ * Takes one entry in the FIFO.
+ *
+ * @param reg   3D register index (8 bit)
+ * @param data  24-bit data to add (make sure bits 24 - 31 are cleared!)
+ */
+
+#define UC_FIFO_ADD_3D(fifo, reg, data) \
+    UC_FIFO_ADD(fifo, ((reg) << 24) | (data))
+
+/**
+ * Pad the FIFO to an even number of entries.
+ * Takes zero or one entries in the FIFO.
+ */
+#define UC_FIFO_PAD_EVEN(fifo)  \
+        if (fifo->used & 1) UC_FIFO_ADD(fifo, HC_DUMMY)
+
+/**
+ * Check for buffer overruns.
+ * Can be redefined to nothing in release builds.
+ */
+
+#ifdef UC_DEBUG
+
+#define UC_FIFO_CHECK(fifo)                              \
+    do {                                                 \
+        if ((fifo)->used > ((fifo)->size) - 32) {        \
+            D_BUG("Unichrome: FIFO overrun.");           \
+        }                                                \
+        if ((fifo)->used > (fifo)->prep) {               \
+            D_BUG("Unichrome: FIFO allocation error.");  \
+        }                                                \
+    } while(0)
+
+#else
+
+#define UC_FIFO_CHECK(fifo) do { } while(0)
+
+#endif // UC_DEBUG
+
+
+// FIFO functions ------------------------------------------------------------
+
+/** Create a FIFO. Returns NULL on failure. */
+
+struct uc_fifo* uc_fifo_create( FusionSHMPoolShared *pool, size_t size);
+
+/** Destroy a FIFO */
+
+void uc_fifo_destroy(FusionSHMPoolShared *pool, struct uc_fifo* fifo);
+
+void uc_fifo_flush_sys(struct uc_fifo* fifo, volatile void *regs);
+
+#endif // __UC_FIFO_H__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_hw.h b/Source/DirectFB/gfxdrivers/unichrome/uc_hw.h
new file mode 100755
index 0000000..953af37
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_hw.h
@@ -0,0 +1,105 @@
+// Shared header file for uc_hwmap.c and uc_hwset.c.
+
+#ifndef __UC_HW_H__
+#define __UC_HW_H__
+
+#include <direct/messages.h>
+
+#include <core/coredefs.h>
+
+#include "unichrome.h"
+#include "uc_fifo.h"
+
+// GPU - mapping functions (uc_hwmap.c)
+
+/// Map a DirectFB destination surface pixel format to the hw. (3D)
+static inline int uc_map_dst_format( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555: return HC_HDBFM_ARGB1555;
+          case DSPF_ARGB4444: return HC_HDBFM_ARGB4444;
+          case DSPF_RGB16:    return HC_HDBFM_RGB565;
+          case DSPF_RGB32:    return HC_HDBFM_ARGB0888;
+          case DSPF_ARGB:     return HC_HDBFM_ARGB8888;
+          case DSPF_AiRGB:    return HC_HDBFM_ARGB8888; // limited support
+
+          case DSPF_YUY2:
+          case DSPF_YV12:
+          case DSPF_I420:
+               // not supported for 3D but don't report an error
+               return 0;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+     return 0;
+}
+
+/// Map a DirectFB source surface pixel format to the hw. (3D)
+static inline int uc_map_src_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555: return HC_HTXnFM_ARGB1555;
+          case DSPF_ARGB4444: return HC_HTXnFM_ARGB4444;
+          case DSPF_RGB16:    return HC_HTXnFM_RGB565;
+          case DSPF_RGB32:    return HC_HTXnFM_ARGB0888;
+          case DSPF_ARGB:     return HC_HTXnFM_ARGB8888;
+          case DSPF_AiRGB:    return HC_HTXnFM_ARGB8888; // limited support
+          case DSPF_A8:       return HC_HTXnFM_A8;
+          case DSPF_LUT8:     return HC_HTXnFM_Index8;
+          case DSPF_YUY2:     return HC_HTXnFM_YUY2;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+     return 0;
+}
+
+void uc_map_blending_fn( struct uc_hw_alpha      *hwalpha,
+                         DFBSurfaceBlendFunction  sblend,
+                         DFBSurfaceBlendFunction  dblend,
+                         DFBSurfacePixelFormat    dformat );
+
+void uc_map_blitflags  ( struct uc_hw_texture    *tex,
+                         DFBSurfaceBlittingFlags  bflags,
+                         DFBSurfacePixelFormat    sformat,
+                         DFBSurfacePixelFormat    dformat );
+
+// GPU - setting functions (uc_hwset.c)
+
+void uc_set_blending_fn( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_texenv     ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_clip       ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_destination( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_source_2d  ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_source_3d  ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_color_2d   ( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+void uc_set_colorkey_2d( UcDriverData *ucdrv,
+                         UcDeviceData *ucdev,
+                         CardState    *state );
+
+#endif // __UC_HW_H__
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_hwmap.c b/Source/DirectFB/gfxdrivers/unichrome/uc_hwmap.c
new file mode 100755
index 0000000..fe1dc73
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_hwmap.c
@@ -0,0 +1,362 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+// Hardware mapping functions ------------------------------------------------
+
+#include <config.h>
+
+#include "uc_hw.h"
+#include <gfx/convert.h>
+
+/// Map DirectFB blending functions to hardware
+void
+uc_map_blending_fn( struct uc_hw_alpha      *hwalpha,
+                    DFBSurfaceBlendFunction  sblend,
+                    DFBSurfaceBlendFunction  dblend,
+                    DFBSurfacePixelFormat    dst_format )
+{
+     bool dst_alpha = DFB_PIXELFORMAT_HAS_ALPHA(dst_format);
+
+     // The HW's blending equation is:
+     // (Ca * FCa + Cbias + Cb * FCb) << Cshift
+
+     // Set source blending function
+
+     // Ca  -- always from source color.
+     hwalpha->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | HC_HABLCa_Csrc;
+     // Aa  -- always from source alpha.
+     hwalpha->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | HC_HABLAa_Asrc;
+
+     // FCa and FAa depend on the following condition.
+     switch (sblend) {
+          case DSBF_ZERO:
+               // GL_ZERO -- (0, 0, 0, 0)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
+               hwalpha->regHABLRFCa = 0x0;
+               hwalpha->regHABLRAa = 0x0;
+               break;
+
+          case DSBF_ONE:
+               // GL_ONE -- (1, 1, 1, 1)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+               hwalpha->regHABLRFCa = 0x0;
+               hwalpha->regHABLRAa = 0x0;
+               break;
+
+          case DSBF_SRCCOLOR:
+               // GL_SRC_COLOR -- (Rs, Gs, Bs, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Csrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_INVSRCCOLOR:
+               // GL_ONE_MINUS_SRC_COLOR -- (1, 1, 1, 1) - (Rs, Gs, Bs, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Csrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_SRCALPHA:
+               // GL_SRC_ALPHA -- (As, As, As, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Asrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_INVSRCALPHA:
+               // GL_ONE_MINUS_SRC_ALPHA -- (1, 1, 1, 1) - (As, As, As, As)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Asrc;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
+               break;
+
+          case DSBF_DESTALPHA:
+               // GL_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else { // (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Adst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
+               }
+               break;
+
+          case DSBF_INVDESTALPHA:
+               // GL_ONE_MINUS_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else { // (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Adst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
+               }
+               break;
+
+          case DSBF_DESTCOLOR:
+               // GL_DST_COLOR -- (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Cdst;
+               hwalpha->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
+               break;
+
+          case DSBF_INVDESTCOLOR:
+               // GL_ONE_MINUS_DST_COLOR -- (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Cdst;
+               hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
+               break;
+
+          case DSBF_SRCALPHASAT:
+               // GL_SRC_ALPHA_SATURATE
+               if (!dst_alpha) {
+                    // (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0
+                    // So (f, f, f, 1) = (0, 0, 0, 1)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               else {
+                    // (f, f, f, 1), f = min(As, 1 - Ad)
+                    hwalpha->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_mimAsrcInvAdst;
+                    hwalpha->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
+                    hwalpha->regHABLRFCa = 0x0;
+                    hwalpha->regHABLRAa = 0x0;
+               }
+               break;
+
+          default:
+               break;
+     }
+
+     // Set destination blending function
+
+     // Op is add.
+     // bias is 0.
+
+     hwalpha->regHABLCsat |= HC_HABLCbias_HABLRCbias;
+     hwalpha->regHABLAsat |= HC_HABLAbias_HABLRAbias;
+
+     // Cb  -- always from destination color.
+     hwalpha->regHABLCop = HC_HABLCb_OPC | HC_HABLCb_Cdst;
+     // Ab  -- always from destination alpha.
+     hwalpha->regHABLAop = HC_HABLAb_OPA | HC_HABLAb_Adst;
+
+     // FCb -- depends on the following condition.
+     switch (dblend) {
+          case DSBF_ZERO:
+               // GL_ZERO -- (0, 0, 0, 0)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+
+          case DSBF_ONE:
+               // GL_ONE -- (1, 1, 1, 1)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+
+          case DSBF_SRCCOLOR:
+               // GL_SRC_COLOR -- (Rs, Gs, Bs, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Csrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_INVSRCCOLOR:
+               // GL_ONE_MINUS_SRC_COLOR -- (1, 1, 1, 1) - (Rs, Gs, Bs, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Csrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_SRCALPHA:
+               // GL_SRC_ALPHA -- (As, As, As, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Asrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
+               break;
+
+          case DSBF_INVSRCALPHA:
+               // GL_ONE_MINUS_SRC_ALPHA -- (1, 1, 1, 1) - (As, As, As, As)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Asrc;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_0;
+               break;
+
+          case DSBF_DESTALPHA:
+               // GL_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1)
+                    hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
+                    hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
+                    hwalpha->regHABLRFCb = 0x0;
+                    hwalpha->regHABLRAb = 0x0;
+               }
+               else { // (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Adst;
+                    hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
+               }
+               break;
+
+          case DSBF_INVDESTALPHA:
+               // GL_ONE_MINUS_DST_ALPHA
+               if (!dst_alpha) { // (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
+                    hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+                    hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+                    hwalpha->regHABLRFCb = 0x0;
+                    hwalpha->regHABLRAb = 0x0;
+               }
+               else { // (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
+                    hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Adst;
+                    hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
+               }
+               break;
+
+          case DSBF_DESTCOLOR:
+               // GL_DST_COLOR -- (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Cdst;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
+               break;
+
+          case DSBF_INVDESTCOLOR:
+               // GL_ONE_MINUS_DST_COLOR -- (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
+               hwalpha->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Cdst;
+               hwalpha->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
+               break;
+
+          case DSBF_SRCALPHASAT:
+               // Unsupported?
+
+          default:
+               hwalpha->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
+               hwalpha->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
+               hwalpha->regHABLRFCb = 0x0;
+               hwalpha->regHABLRAb = 0x0;
+               break;
+     }
+}
+
+/// Map DFBSurfaceBlittingFlags to the hardware
+void
+uc_map_blitflags( struct uc_hw_texture    *tex,
+                  DFBSurfaceBlittingFlags  bflags,
+                  DFBSurfacePixelFormat    sformat,
+                  DFBSurfacePixelFormat    dformat )
+{
+     bool gotalpha = DFB_PIXELFORMAT_HAS_ALPHA(sformat);
+     bool invalpha = DFB_PIXELFORMAT_INV_ALPHA(sformat) ||
+          (!DFB_PIXELFORMAT_INV_ALPHA(sformat) && DFB_PIXELFORMAT_INV_ALPHA(dformat));
+
+     if (bflags & DSBLIT_COLORIZE) {
+          // Cv0 = Ct*Cf
+
+          // Hw setting:
+          // Ca = Ct, Cb = Cf, Cop = +, Cc = 0, Cbias = 0, Cshift = No.
+
+          tex->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+                                  HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_Tex |
+                                  HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_Dif |
+                                  HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+          tex->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
+                                 HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0 |
+                                 HC_HTXnTBLCshift_No;
+          tex->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_0;
+     }
+     else {
+          // Cv0 = Ct
+
+          // Hw setting:
+          // Ca = 0, Cb = 0, Cop = +, Cc = 0, Cbias = Ct, Cshift = No.
+
+          tex->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
+                                  HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
+                                  HC_HTXnTBLCb_TOPC | HC_HTXnTBLCb_0 |
+                                  HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
+          tex->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
+                                 HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_Tex |
+                                 HC_HTXnTBLCshift_No;
+          tex->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_0;
+     }
+
+     if (bflags & DSBLIT_BLEND_COLORALPHA) {
+          if ((bflags & DSBLIT_BLEND_ALPHACHANNEL) && gotalpha) {
+               // Av0 = At*Af
+
+               // Hw setting:
+               // Aa = At, Ab = Af, Cop = +, Ac = 0, Abias = 0, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_Atex |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_Adif |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+          else {
+               // (!(bflags & DSBLIT_BLEND_ALPHACHANNEL) && gotalpha) || !gotalpha
+               // Av0 = Af
+
+               // Hw setting:
+               // Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = Af, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Adif | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+     }
+     else {  // !(bflags & DSBLIT_BLEND_COLORALPHA)
+          if (gotalpha && ((bflags & DSBLIT_BLEND_ALPHACHANNEL) || invalpha)) {
+               // Av0 = At
+
+               // Hw setting:
+               // Aa = 0, Ab = 0, Cop = +, Ac = 0, Abias = At, Ashift = No.
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Atex | HC_HTXnTBLAshift_No;
+               if (invalpha)
+                    tex->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+          else { // !gotalpha
+               // Av0 = 1.0
+
+               // D_BUG warning: I'm guessing where values should go,
+               // and how big (0xff = 1.0 ?) it should be.
+
+               // Hw setting:
+               // Aa = 1.0, Ab = 1.0, Cop = -, Ac = 1.0, Abias = 1.0, Ashift = No.
+               // => Av = Aa*(Ab-Ac) + Abias = 1*(1-1)+1 = 1
+
+               tex->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
+                                       HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
+                                       HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
+                                       HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
+               tex->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add |
+                                       HC_HTXnTBLAbias_Inv | HC_HTXnTBLAbias_HTXnTBLRAbias | HC_HTXnTBLAshift_No;
+               tex->regHTXnTBLRAa_0 = 0x0;
+               tex->regHTXnTBLRFog_0 = 0x0;
+          }
+     }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_hwset.c b/Source/DirectFB/gfxdrivers/unichrome/uc_hwset.c
new file mode 100755
index 0000000..93fb017
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_hwset.c
@@ -0,0 +1,446 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+// Hardware setting functions ------------------------------------------------
+
+#include <config.h>
+
+#include "uc_hw.h"
+#include <core/state.h>
+#include <core/palette.h>
+#include <gfx/convert.h>
+
+/// Integer 2-logarithm, y = log2(x), where x and y are integers.
+#define ILOG2(x,y) ILOG2_PORTABLE(x,y)
+
+#define ILOG2_PORTABLE(x,y) \
+    do {                    \
+        unsigned int i = 0; \
+        y = x;              \
+        while (y != 0) {    \
+            i++;            \
+            y = y >> 1;     \
+        }                   \
+        y = i-1;            \
+    } while (0)
+
+#define ILOG2_X86(x,y)  // TODO - use BSR (bit scan reverse) instruction
+
+/// Set alpha blending function (3D)
+void
+uc_set_blending_fn( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo     *fifo    = ucdrv->fifo;
+     struct uc_hw_alpha *hwalpha = &ucdev->hwalpha;
+
+     if (UC_IS_VALID( uc_blending_fn ))
+          return;
+
+     uc_map_blending_fn( hwalpha, state->src_blend, state->dst_blend,
+                         state->destination->config.format );
+
+     UC_FIFO_PREPARE( fifo, 14 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLCsat,   hwalpha->regHABLCsat   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLCop,    hwalpha->regHABLCop    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLAsat,   hwalpha->regHABLAsat   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLAop,    hwalpha->regHABLAop    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCa,    hwalpha->regHABLRCa    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRFCa,   hwalpha->regHABLRFCa   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCbias, hwalpha->regHABLRCbias );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRCb,    hwalpha->regHABLRCb    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRFCb,   hwalpha->regHABLRFCb   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRAa,    hwalpha->regHABLRAa    );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HABLRAb,    hwalpha->regHABLRAb    );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_blending_fn );
+}
+
+/// Set texture environment (3D)
+void
+uc_set_texenv( UcDriverData *ucdrv,
+               UcDeviceData *ucdev,
+               CardState    *state )
+{
+     struct uc_fifo       *fifo  = ucdrv->fifo;
+     struct uc_hw_texture *hwtex = &ucdev->hwtex;
+
+     if (UC_IS_VALID( uc_texenv ))
+          return;
+
+     uc_map_blitflags( hwtex, state->blittingflags, state->source->config.format,
+                       state->destination->config.format );
+
+     // Texture mapping method
+     hwtex->regHTXnTB   = HC_HTXnFLSs_Linear | HC_HTXnFLTs_Linear |
+                          HC_HTXnFLSe_Linear | HC_HTXnFLTe_Linear;
+
+     hwtex->regHTXnMPMD = HC_HTXnMPMD_Sclamp | HC_HTXnMPMD_Tclamp;
+
+     UC_FIFO_PREPARE( fifo, 12 );
+     UC_FIFO_ADD_HDR( fifo, (HC_ParaType_Tex << 16) | (HC_SubType_Tex0 << 24) );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTB,       hwtex->regHTXnTB         );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnMPMD,     hwtex->regHTXnMPMD       );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLCsat,  hwtex->regHTXnTBLCsat_0  );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLCop,   hwtex->regHTXnTBLCop_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLMPfog, hwtex->regHTXnTBLMPfog_0 );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLAsat,  hwtex->regHTXnTBLAsat_0  );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRCb,   hwtex->regHTXnTBLRCb_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRAa,   hwtex->regHTXnTBLRAa_0   );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnTBLRFog,  hwtex->regHTXnTBLRFog_0  );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_texenv );
+}
+
+/// Set clipping rectangle (2D and 3D)
+void
+uc_set_clip( UcDriverData *ucdrv,
+             UcDeviceData *ucdev,
+             CardState    *state )
+{
+     struct uc_fifo *fifo = ucdrv->fifo;
+
+     if (DFB_REGION_EQUAL( ucdev->clip, state->clip ))
+          return;
+
+     UC_FIFO_PREPARE( fifo, 8 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+#ifdef UC_ENABLE_3D
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HClipTB,
+                      (RS12(state->clip.y1) << 12) | RS12(state->clip.y2+1) );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HClipLR,
+                      (RS12(state->clip.x1) << 12) | RS12(state->clip.x2+1) );
+
+#endif
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPTL,
+                      (RS16(state->clip.y1) << 16) | RS16(state->clip.x1) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_CLIPBR,
+                      (RS16(state->clip.y2) << 16) | RS16(state->clip.x2) );
+
+     UC_FIFO_CHECK( fifo );
+
+     ucdev->clip = state->clip;
+}
+
+/// Set destination (2D and 3D)
+void
+uc_set_destination( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo        *fifo        = ucdrv->fifo;
+
+     CoreSurface           *destination = state->destination;
+
+     DFBSurfacePixelFormat  dst_format  = destination->config.format;
+     int                    dst_offset  = state->dst.offset;
+     int                    dst_pitch   = state->dst.pitch;
+     int                    dst_height  = destination->config.size.h;
+     int                    dst_bpp     = DFB_BYTES_PER_PIXEL( dst_format );
+
+
+     /* Save FIFO space and CPU cycles. */
+     if (ucdev->dst_format == dst_format &&
+         ucdev->dst_offset == dst_offset &&
+         ucdev->dst_pitch  == dst_pitch &&
+         ucdev->dst_height == dst_height)
+          return;
+
+     // 2D engine setting
+
+     ucdev->pitch = (ucdev->pitch & 0x7fff) | (((dst_pitch >> 3) & 0x7fff) << 16);
+
+     UC_FIFO_PREPARE( fifo, 12 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH,   (VIA_PITCH_ENABLE | ucdev->pitch) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_DSTBASE, (dst_offset >> 3) );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_GEMODE,  (dst_bpp - 1) << 8 );
+
+#ifdef UC_ENABLE_3D
+     // 3D engine setting
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBBasL, dst_offset & 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBBasH, dst_offset >> 24 );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HDBFM,   (uc_map_dst_format( dst_format ) |
+                                              (dst_pitch & HC_HDBPit_MASK)    |
+                                              HC_HDBLoc_Local) );
+
+     UC_FIFO_PAD_EVEN(fifo);
+#endif
+
+     UC_FIFO_CHECK( fifo );
+
+     ucdev->dst_format = dst_format;
+     ucdev->dst_offset = dst_offset;
+     ucdev->dst_pitch  = dst_pitch;
+     ucdev->dst_height = dst_height;
+}
+
+/// Set new source (2D)
+void
+uc_set_source_2d( UcDriverData *ucdrv,
+                  UcDeviceData *ucdev,
+                  CardState    *state )
+{
+     struct uc_fifo *fifo   = ucdrv->fifo;
+
+     if (UC_IS_VALID( uc_source2d ))
+          return;
+
+     ucdev->pitch &= 0x7fff0000;
+     ucdev->pitch |= (state->src.pitch >> 3) & 0x7fff;
+
+     UC_FIFO_PREPARE( fifo, 6 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_SRCBASE, state->src.offset >> 3 );
+     UC_FIFO_ADD_2D ( fifo, VIA_REG_PITCH,   VIA_PITCH_ENABLE | ucdev->pitch );
+
+     UC_FIFO_CHECK( fifo );
+     
+     ucdev->src_offset = state->src.offset;
+     ucdev->src_pitch = state->src.pitch;
+     ucdev->src_height = state->source->config.size.h;
+
+     UC_VALIDATE( uc_source2d );
+}
+
+/// Set new source (3D)
+void
+uc_set_source_3d( UcDriverData *ucdrv,
+                  UcDeviceData *ucdev,
+                  CardState    *state )
+{
+     struct uc_fifo       *fifo   = ucdrv->fifo;
+     struct uc_hw_texture *hwtex  = &ucdev->hwtex;
+
+     CoreSurface          *source = state->source;
+
+     int src_height, src_offset, src_pitch;
+
+     if (UC_IS_VALID( uc_source3d ))
+          return;
+
+     src_height = source->config.size.h;
+     src_offset = state->src.offset;
+     src_pitch  = state->src.pitch;
+
+     /*
+      * TODO: Check if we can set the odd/even field as L1/L2 texture and select
+      * between L0/L1/L2 upon blit. Otherwise we depend on SMF_BLITTINGFLAGS ;(
+      */
+
+     if (state->blittingflags & DSBLIT_DEINTERLACE) {
+          if (source->field)
+               src_offset += src_pitch;
+
+          src_height >>= 1;
+          src_pitch  <<= 1;
+     }
+
+     ucdev->field = source->field;
+
+     // Round texture size up to nearest
+     // value evenly divisible by 2^n
+
+     ILOG2(source->config.size.w, hwtex->we);
+     hwtex->l2w = 1 << hwtex->we;
+     if (hwtex->l2w < source->config.size.w) {
+          hwtex->we++;
+          hwtex->l2w <<= 1;
+     }
+
+     ILOG2(src_height, hwtex->he);
+     hwtex->l2h = 1 << hwtex->he;
+     if (hwtex->l2h < src_height) {
+          hwtex->he++;
+          hwtex->l2h <<= 1;
+     }
+
+     hwtex->format = uc_map_src_format_3d( source->config.format );
+
+     UC_FIFO_PREPARE( fifo, 10);
+
+     UC_FIFO_ADD_HDR( fifo, (HC_ParaType_Tex << 16) | (HC_SubType_Tex0 << 24));
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnFM,       HC_HTXnLoc_Local | hwtex->format );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0OS,     (0 << HC_HTXnLVmax_SHIFT) );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0_5WE,   hwtex->we );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0_5HE,   hwtex->he );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL012BasH, (src_offset >> 24) & 0xff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0BasL,   (src_offset      ) & 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HTXnL0Pit,    (HC_HTXnEnPit_MASK | src_pitch) );
+
+     UC_FIFO_PAD_EVEN( fifo );
+
+     UC_FIFO_CHECK( fifo );
+
+     // Upload the palette of a 256 color texture.
+
+     if (hwtex->format == HC_HTXnFM_Index8) {
+          int       i, num;
+          DFBColor *colors;
+
+          UC_FIFO_PREPARE( fifo, 258 );
+
+          UC_FIFO_ADD_HDR( fifo, ((HC_ParaType_Palette    << 16) |
+                                  (HC_SubType_TexPalette0 << 24)) );
+
+          colors = source->palette->entries;
+          num    = source->palette->num_entries;
+
+          if (num > 256)
+               num = 256;
+
+          /* What about the last entry? -- dok */
+          for (i = 0; i < num; i++)
+               UC_FIFO_ADD( fifo, PIXEL_ARGB(colors[i].a, colors[i].r,
+                                             colors[i].g, colors[i].b) );
+
+          for (; i < 256; i++)
+               UC_FIFO_ADD( fifo, 0 );
+
+          UC_FIFO_CHECK( fifo );
+     }
+
+     ucdev->src_offset = src_offset;
+     ucdev->src_pitch = src_pitch;
+     ucdev->src_height = src_height;
+
+     UC_VALIDATE( uc_source3d );
+}
+
+/// Set either destination color key, or fill color, as needed. (2D)
+void
+uc_set_color_2d( UcDriverData *ucdrv,
+                 UcDeviceData *ucdev,
+                 CardState    *state )
+{
+     struct uc_fifo *fifo  = ucdrv->fifo;
+     u32             color = 0;
+
+     if (UC_IS_VALID( uc_color2d ))
+          return;
+
+     switch (state->destination->config.format) {
+          case DSPF_ARGB1555:
+               color = PIXEL_ARGB1555( state->color.a,
+                                       state->color.r,
+                                       state->color.g,
+                                       state->color.b );
+               color |= color << 16;
+               break;
+
+          case DSPF_ARGB4444:
+               color = PIXEL_ARGB4444( state->color.a,
+                                       state->color.r,
+                                       state->color.g,
+                                       state->color.b );
+               color |= color << 16;
+               break;
+
+          case DSPF_RGB16:
+               color = PIXEL_RGB16( state->color.r,
+                                    state->color.g,
+                                    state->color.b);
+               color |= color << 16;
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               color = PIXEL_ARGB( state->color.a,
+                                   state->color.r,
+                                   state->color.g,
+                                   state->color.b );
+               break;
+
+          case DSPF_AiRGB:
+               color = PIXEL_AiRGB( state->color.a,
+                                   state->color.r,
+                                   state->color.g,
+                                   state->color.b );
+               break;
+
+          default:
+               D_BUG( "unexpected pixel format" );
+     }
+
+
+     UC_FIFO_PREPARE( fifo, 8 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     // Opaque line drawing needs this
+     UC_FIFO_ADD_2D( fifo, VIA_REG_MONOPAT0,   0xff );
+
+     UC_FIFO_ADD_2D( fifo, VIA_REG_KEYCONTROL, 0 );
+     UC_FIFO_ADD_2D( fifo, VIA_REG_FGCOLOR,    color );
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_color2d );
+     UC_INVALIDATE( uc_colorkey2d );
+}
+
+void
+uc_set_colorkey_2d( UcDriverData *ucdrv,
+                    UcDeviceData *ucdev,
+                    CardState    *state )
+{
+     struct uc_fifo *fifo = ucdrv->fifo;
+
+     if (UC_IS_VALID( uc_colorkey2d ))
+          return;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          UC_FIFO_PREPARE( fifo, 6 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL, VIA_KEY_ENABLE_SRCKEY );
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_BGCOLOR, state->src_colorkey );
+     }
+     else if (state->blittingflags & DSBLIT_DST_COLORKEY) {
+          UC_FIFO_PREPARE( fifo, 6 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL,
+                           VIA_KEY_ENABLE_DSTKEY | VIA_KEY_INVERT_KEY );
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_FGCOLOR, state->dst_colorkey );
+     }
+     else {
+          UC_FIFO_PREPARE( fifo, 4 );
+          UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+          UC_FIFO_ADD_2D ( fifo, VIA_REG_KEYCONTROL, 0 );
+     }
+
+     UC_FIFO_CHECK( fifo );
+
+     UC_VALIDATE( uc_colorkey2d );
+     UC_INVALIDATE( uc_color2d );
+}
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_ioctl.h b/Source/DirectFB/gfxdrivers/unichrome/uc_ioctl.h
new file mode 100755
index 0000000..7836024
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_ioctl.h
@@ -0,0 +1,35 @@
+// Definitions of framebuffer ioctls
+
+#ifndef __UC_IOCTL_H__
+#define __UC_IOCTL_H__
+
+#include <fbdev/fbdev.h>
+#include <sys/ioctl.h>
+#include <dfb_types.h>
+
+// Parameters for FBIO_FLIPONVSYNC ioctl
+struct fb_flip {
+    u32 device;
+    u32 field;
+    u32 count;
+    u32 offset[6];
+};
+
+#define VIAFB_FLIP_GRAPHICS    0
+#define VIAFB_FLIP_V1          1
+#define VIAFB_FLIP_V3          2
+#define VIAFB_FLIP_SPIC        3
+#define VIAFB_FLIP_NOP         255
+
+#ifndef FBIO_FLIPONVSYNC
+#define FBIO_FLIPONVSYNC       _IOWR('F', 0x21, struct fb_flip)
+#endif
+
+// Parameters for FBIO_WAITFORVSYNC ioctl
+#define VIAFB_WAIT_ANY         0
+#define VIAFB_WAIT_TOPFIELD    1
+#define VIAFB_WAIT_BOTTOMFIELD 2
+#define VIAFB_WAIT_FLIP        3
+
+#endif // __UC_IOCTL_H__
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.c b/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.c
new file mode 100755
index 0000000..4402cb3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.c
@@ -0,0 +1,405 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <fbdev/fbdev.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "uc_ioctl.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+// Forward declaration
+static DFBResult
+uc_ovl_remove(CoreLayer *layer,
+              void      *driver_data,
+              void      *layer_data,
+              void      *region_data);
+
+
+static int uc_ovl_datasize( void )
+{
+    return sizeof(UcOverlayData);
+}
+
+
+static DFBResult
+uc_ovl_init_layer( CoreLayer                   *layer,
+                   void                        *driver_data,
+                   void                        *layer_data,
+                   DFBDisplayLayerDescription  *description,
+                   DFBDisplayLayerConfig       *config,
+                   DFBColorAdjustment          *adjustment )
+{
+    UcDriverData* ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+
+    // Save a pointer to the layer data for access by the primary
+    // This is needed to properly support levels and the primary alpha channel
+
+    ucdrv->ovl = ucovl;
+
+    // Set layer type, capabilities and name
+
+    description->caps = UC_OVL_CAPS;
+    description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+    snprintf(description->name,
+        DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VIA Unichrome Video");
+
+    adjustment->flags = DCAF_NONE;
+
+    // Fill out the default configuration
+
+    config->flags  = DLCONF_WIDTH | DLCONF_HEIGHT |
+                     DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+
+    ucovl->v1.win.w = 720;
+    ucovl->v1.win.h = 576;
+    ucovl->v1.win.x = 0;
+    ucovl->v1.win.y = 0;
+
+    config->width  = 720;
+    config->height = 576;
+
+    config->pixelformat = DSPF_YV12;
+    config->buffermode  = DLBM_FRONTONLY;
+    config->options     = DLOP_NONE;
+
+    // Reset overlay
+
+    ucovl->extfifo_on = false;
+    ucovl->hwrev = ucdrv->hwrev;
+    ucovl->scrwidth = ucovl->v1.win.w;
+
+    ucovl->v1.isenabled = false;
+    ucovl->v1.cfg = *config;
+    ucovl->v1.ox = 0;
+    ucovl->v1.oy = 0;
+    ucovl->v1.dst_key.index = 0;
+    ucovl->v1.dst_key.r = 0;
+    ucovl->v1.dst_key.g = 0;
+    ucovl->v1.dst_key.b = 0;
+    ucovl->v1.dstkey_enabled = false;
+    ucovl->v1.opacity = 0xff;
+    ucovl->v1.level = 1;
+
+//    adjustment->flags = DCAF_BRIGHTNESS | DCAF_CONTRAST |
+//        DCAF_HUE | DCAF_SATURATION;
+    adjustment->brightness = 0x8000;
+    adjustment->contrast = 0x8000;
+    adjustment->saturation = 0x8000;
+    adjustment->hue = 0x8000;
+    ucovl->v1.adj = *adjustment;
+
+    uc_ovl_remove(layer, driver_data, layer_data, NULL);
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_set_region( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   void                       *region_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags  updated,
+                   CoreSurface                *surface,
+                   CorePalette                *palette,
+                   CoreSurfaceBufferLock      *lock )
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    DFBRectangle   win;
+    
+    /* remember configuration */
+    ucovl->config = *config;
+
+    /* get new destination rectangle */
+    win = config->dest;
+
+    // Bounds checking
+    if ((win.x < -8192) || (win.x > 8192) ||
+        (win.y < -8192) || (win.y > 8192) ||
+        (win.w < 32) || (win.w > 4096) ||
+        (win.h < 32) || (win.h > 4096))
+    {
+        D_DEBUG("Layer size or position is out of bounds.");
+        return DFB_INVAREA;
+    }
+
+    ucovl->v1.isenabled = true;
+    ucovl->v1.win = win;
+    ucovl->v1.dst_key = config->dst_key;
+    ucovl->v1.dstkey_enabled = config->options & DLOP_DST_COLORKEY;
+    
+    if (config->options & DLOP_OPACITY)
+        ucovl->v1.opacity = config->opacity;
+    else
+        ucovl->v1.opacity = 0xff;
+
+    // printf("uc_overlay: color-keying is %s\n",
+    //     ucovl->v1.dstkey_enabled ? "enabled" : "disabled");
+
+    ucovl->deinterlace = config->options & DLOP_DEINTERLACING;
+    ucovl->surface     = surface;
+    ucovl->lock        = lock;
+
+    if (ucdrv->canfliponvsync) {
+        FBDev *dfb_fbdev = dfb_system_data();
+        int field_option = VIAFB_WAIT_FLIP; // wait for any pending flip
+        ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option);
+    }
+
+    return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface, lock);
+}
+
+
+static DFBResult
+uc_ovl_remove(CoreLayer *layer,
+              void      *driver_data,
+              void      *layer_data,
+              void      *region_data)
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    volatile u8*   vio = ucdrv->hwregs;
+
+    ucovl->v1.isenabled = false;
+
+    uc_ovl_vcmd_wait(vio);
+
+    VIDEO_OUT(vio, V_FIFO_CONTROL, UC_MAP_V1_FIFO_CONTROL(16,12,8));
+    //  VIDEO_OUT(vio, ALPHA_V3_FIFO_CONTROL, 0x0407181f);
+
+    if (ucovl->hwrev >= 0x10) {
+        VIDEO_OUT(vio, V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
+        VIDEO_OUT(vio, V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
+    }
+    else {
+        VIDEO_OUT(vio, V1_ColorSpaceReg_1, ColorSpaceValue_1);
+        VIDEO_OUT(vio, V1_ColorSpaceReg_2, ColorSpaceValue_2);
+    }
+
+    VIDEO_OUT(vio, HQV_CONTROL, VIDEO_IN(vio, HQV_CONTROL) & ~HQV_ENABLE);
+    VIDEO_OUT(vio, V1_CONTROL, VIDEO_IN(vio, V1_CONTROL) & ~V1_ENABLE);
+    //  VIDEO_OUT(vio, V3_CONTROL, VIDEO_IN(vio, V3_CONTROL) & ~V3_ENABLE);
+
+    VIDEO_OUT(vio, V_COMPOSE_MODE,
+        (VIDEO_IN(vio, V_COMPOSE_MODE) & ~ENABLE_COLOR_KEYING) | V1_COMMAND_FIRE);
+
+    ucovl->surface = NULL;
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_test_region(CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed)
+{
+    CoreLayerRegionConfigFlags fail = 0;
+
+    // Check layer options
+
+    if (config->options & ~UC_OVL_OPTIONS)
+        fail |= CLRCF_OPTIONS;
+
+    // Check pixelformats
+
+    switch (config->format) {
+          case DSPF_YUY2:
+              break;
+          case DSPF_UYVY:
+              fail |= CLRCF_FORMAT;   // Nope...  doesn't work.
+              break;
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_ARGB1555:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+              break;
+          default:
+              fail |= CLRCF_FORMAT;
+    }
+
+    // Check width and height
+
+    if (config->width > 4096 || config->width < 32)
+        fail |= CLRCF_WIDTH;
+
+    if (config->height > 4096 || config->height < 32)
+        fail |= CLRCF_HEIGHT;
+
+    if (failed) *failed = fail;
+    if (fail) return DFB_UNSUPPORTED;
+
+    return DFB_OK;
+}
+
+
+static DFBResult
+uc_ovl_flip_region( CoreLayer             *layer,
+                    void                  *driver_data,
+                    void                  *layer_data,
+                    void                  *region_data,
+                    CoreSurface           *surface,
+                    DFBSurfaceFlipFlags    flags,
+                    CoreSurfaceBufferLock *lock )
+{
+    //printf("Entering %s ... \n", __PRETTY_FUNCTION__);
+
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    DFBResult    ret;
+    FBDev *dfb_fbdev = dfb_system_data();
+
+    dfb_surface_flip(surface, false);
+
+    ucovl->field = 0;
+    ucovl->lock = lock;
+
+    if (ucdrv->canfliponvsync)
+    {
+        if (ucovl->config.options & DLOP_FIELD_PARITY)
+        {
+            struct fb_flip flip;
+            int field_option;
+
+            field_option = VIAFB_WAIT_FLIP; // ensure last pending flip complete
+            ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option);
+
+            flip.device = VIAFB_FLIP_V1;
+            flip.field = ucovl->config.parity;
+            flip.count = 0; // until we implement this
+
+            uc_ovl_map_buffer(surface->config.format,
+                lock->offset,
+                ucovl->v1.ox, ucovl->v1.oy, surface->config.size.w, surface->config.size.h,
+                lock->pitch, 0,
+                &flip.offset[0], &flip.offset[1], &flip.offset[2]);
+
+            ioctl(dfb_fbdev->fd, FBIO_FLIPONVSYNC, &flip);
+        }
+        else
+        {
+            ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface, lock);
+            if (ret)
+                return ret;
+        }
+    }
+    else
+    {
+        if (ucovl->config.options & DLOP_FIELD_PARITY)
+        {
+            int field_option;
+        
+            if (ucovl->config.parity == 0)  // top field first?
+                field_option = VIAFB_WAIT_BOTTOMFIELD;
+            else
+                field_option = VIAFB_WAIT_TOPFIELD;
+            ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option);
+            // that actually waits for VBLANK so we need a further delay
+            // to be sure the field has started and that the flip will
+            // take effect on the next field
+            usleep(2500);
+        }
+    
+        ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface, lock);
+        if (ret)
+            return ret;
+    }
+
+    if (flags & DSFLIP_WAIT)
+        dfb_layer_wait_vsync(layer);
+
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_get_level(CoreLayer    *layer,
+                 void         *driver_data,
+                 void         *layer_data,
+                 int          *level)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    *level = ucovl->v1.level;
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_set_level(CoreLayer    *layer,
+                 void         *driver_data,
+                 void         *layer_data,
+                 int          level)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+    if (level == 0) return DFB_INVARG;
+    
+    if (level < 0) {
+        // Enable underlay mode.
+        VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL,
+            uc_ovl_map_alpha(ucovl->opacity_primary));
+    }
+    else {
+        // Enable overlay mode (default)
+        VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL,
+            uc_ovl_map_alpha(ucovl->v1.opacity));
+    }
+    VIDEO_OUT(ucdrv->hwregs, V_COMPOSE_MODE, V1_COMMAND_FIRE |
+        (ucovl->v1.dstkey_enabled ? ENABLE_COLOR_KEYING : 0));
+
+    ucovl->v1.level = level;
+    return DFB_OK;
+}
+
+static DFBResult
+uc_ovl_set_input_field( CoreLayer *layer,
+                        void      *driver_data,
+                        void      *layer_data,
+                        void      *region_data,
+                        int        field )
+{
+     UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+     UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+     ucovl->field = field;
+
+     return uc_ovl_update(ucdrv, ucovl, UC_OVL_FIELD, ucovl->surface, ucovl->lock);
+}
+
+DisplayLayerFuncs ucOverlayFuncs = {
+     .LayerDataSize      = uc_ovl_datasize,
+     .InitLayer          = uc_ovl_init_layer,
+     .SetRegion          = uc_ovl_set_region,
+     .RemoveRegion       = uc_ovl_remove,
+     .TestRegion         = uc_ovl_test_region,
+     .FlipRegion         = uc_ovl_flip_region,
+     .GetLevel           = uc_ovl_get_level,
+     .SetLevel           = uc_ovl_set_level,
+     .SetInputField      = uc_ovl_set_input_field,
+//   .SetColorAdjustment = uc_ovl_set_adjustment,
+};
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.h b/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.h
new file mode 100755
index 0000000..123a5e0
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_overlay.h
@@ -0,0 +1,98 @@
+#ifndef __UC_OVERLAY_H__
+#define __UC_OVERLAY_H__
+
+#define UC_OVL_CAPS (DLCAPS_SURFACE | DLCAPS_OPACITY | DLCAPS_SCREEN_LOCATION \
+    | DLCAPS_DEINTERLACING | DLCAPS_DST_COLORKEY | DLCAPS_LEVELS \
+    | DLCAPS_FIELD_PARITY )
+/*    | DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST              \
+    | DLCAPS_SATURATION | DLCAPS_HUE)
+    */
+#define UC_OVL_OPTIONS (DLOP_DEINTERLACING | DLOP_DST_COLORKEY \
+    | DLOP_FIELD_PARITY | DLOP_OPACITY )
+
+#define ALIGN_TO(v, n) (((v) + (n-1)) & ~(n-1))
+#define UC_MAP_V1_FIFO_CONTROL(depth, pre_thr, thr) \
+    (((depth)-1) | ((thr) << 8) | ((pre_thr) << 24))
+
+// Actions for uc_ovl_update()
+
+#define UC_OVL_FLIP     1
+#define UC_OVL_CHANGE   2
+#define UC_OVL_FIELD    4
+
+/** Overlay layer data. */
+struct uc_ovl_vinfo {
+    bool isenabled;                 // True when visible
+    DFBRectangle win;               // Layer screen rectangle.
+    DFBDisplayLayerConfig cfg;      // Layer configuration
+    int ox, oy;                     // Top-left visible corner (the offset)
+                                    // in the source surface
+    u8 opacity;                     // Layer opacity
+    int level;                      // Position in the DirectFB layer stack
+                                    // < 0 = underlay mode, > 0 = overlay mode
+    DFBColorAdjustment adj;         // Color adjustment (brightness etc)
+    DFBColorKey dst_key;            // Destination color key
+    bool dstkey_enabled;            // Destination color key is enabled
+};
+
+typedef struct _UcOverlayData {
+
+    // TODO: initialize the variables!!!
+
+    u8                  hwrev;       // Unichrome revision
+    int                 scrwidth;    // Current screen width
+
+    bool                extfifo_on;  // True when we're using the extended fifo.
+    u8                  mclk_save[3];
+
+    struct uc_ovl_vinfo v1;          // Video overlay V1
+
+    CoreLayerRegionConfig config;
+    
+    bool                deinterlace;
+    int                 field;
+
+    CoreSurface        *surface;
+    CoreSurfaceBufferLock *lock;
+    
+    int                 opacity_primary; // overlay opacity if primary is logically
+                                         // above or -1 if primary has alpha channel
+
+} UcOverlayData;
+
+
+// Video engine - mapping functions (uc_ovl_hwmap.c)
+
+bool uc_ovl_map_vzoom(int sh, int dh, u32* zoom, u32* mini);
+bool uc_ovl_map_hzoom(int sw, int dw,  u32* zoom, u32* mini,
+                      u32* falign, u32* dcount);
+u32 uc_ovl_map_qwfetch(int falign, DFBSurfacePixelFormat format, int pfetch);
+u32 uc_ovl_map_format(DFBSurfacePixelFormat format);
+void uc_ovl_map_window(int scrw, int scrh, DFBRectangle* win, int sw, int sh,
+                       u32* win_start, u32* win_end,
+                       int* ox, int* oy, int *pfetch);
+void uc_ovl_map_buffer(DFBSurfacePixelFormat format, u32 buf,
+                       int x, int y, int w, int h, int pitch, int field,
+                       u32* y_start, u32* u_start, u32* v_start);
+u32 uc_ovl_map_alpha(int opacity);
+void uc_ovl_map_v1_control(DFBSurfacePixelFormat format, int sw,
+                           int hwrev, bool extfifo_on,
+                           u32* control, u32* fifo);
+u32 uc_ovl_map_fifo(u8 depth, u8 pre_thr, u8 thr);
+void uc_ovl_map_adjustment(DFBColorAdjustment* adj, u32* a1, u32* a2);
+u32 uc_ovl_map_colorkey(DFBColorKey* c);
+
+// Video engine - setting functions (uc_ovl_hwset.c)
+
+void uc_ovl_setup_fifo(UcOverlayData* ucovl, int scrwidth);
+void uc_ovl_vcmd_wait(volatile u8* vio);
+DFBResult uc_ovl_update(UcDriverData* ucdrv,
+                        UcOverlayData* ucovl, int action,
+                        CoreSurface* surface,
+                        CoreSurfaceBufferLock* lock);
+DFBResult uc_ovl_set_adjustment(CoreLayer *layer,
+                                void *driver_data,
+                                void *layer_data,
+                                DFBColorAdjustment *adj);
+
+#endif // __UC_OVERLAY_H__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwmap.c b/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwmap.c
new file mode 100755
index 0000000..9306b59
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwmap.c
@@ -0,0 +1,609 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+#include <gfx/convert.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+#include <math.h>
+
+/**
+ * Map hw settings for vertical scaling.
+ *
+ * @param sh        source height
+ * @param dh        destination height
+ * @param zoom      will hold vertical setting of zoom register.
+ * @param mini      will hold vertical setting of mini register.
+ *
+ * @returns true if successful.
+ *          false if the zooming factor is too large or small.
+ *
+ * @note Derived from VIA's V4L driver.
+ *       See ddover.c, DDOVER_HQVCalcZoomHeight()
+ */
+
+bool uc_ovl_map_vzoom(int sh, int dh, u32* zoom, u32* mini)
+{
+    u32 sh1, tmp, d;
+    bool zoom_ok = true;
+
+    if (sh == dh) { // No zoom
+        // Do nothing
+    }
+    else if (sh < dh) { // Zoom in
+
+        tmp = (sh * 0x0400) / dh;
+        zoom_ok = !(tmp > 0x3ff);
+
+        *zoom |= (tmp & 0x3ff) | V1_Y_ZOOM_ENABLE;
+        *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
+    }
+    else { // sw > dh - Zoom out
+
+        // Find a suitable divider (1 << d) = {2, 4, 8 or 16}
+
+        sh1 = sh;
+        for (d = 1; d < 5; d++) {
+            sh1 >>= 1;
+            if (sh1 <= dh) break;
+        }
+        if (d == 5) { // Too small.
+            d = 4;
+            zoom_ok = false;
+        }
+
+        *mini |= ((d<<1)-1) << 16;  // <= {1,3,5,7} << 16
+
+        // Add scaling
+
+        if (sh1 < dh)  {
+            tmp = (sh1 * 0x400) / dh;
+            *zoom |= ((tmp & 0x3ff) | V1_Y_ZOOM_ENABLE);
+            *mini |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
+        }
+    }
+
+    return zoom_ok;
+}
+
+
+/**
+ * Map hw settings for horizontal scaling.
+ *
+ * @param sw        source width
+ * @param dw        destination width
+ *
+ * @param zoom      will hold horizontal setting of zoom register.
+ * @param mini      will hold horizontal setting of mini register.
+ * @param falign    will hold fetch aligment
+ * @param dcount    will hold display count
+ *
+ * @returns true if successful.
+ *          false if the zooming factor is too large or small.
+ *
+ * @note Derived from VIA's V4L driver.
+ *       See ddover.c, DDOVER_HQVCalcZoomWidth() and DDOver_GetDisplayCount()
+ */
+bool uc_ovl_map_hzoom(int sw, int dw,  u32* zoom, u32* mini,
+                      u32* falign, u32* dcount)
+{
+    u32 tmp, sw1, d;
+    int md; // Minify-divider
+    bool zoom_ok = true;
+
+    md = 1;
+    *falign = 0;
+
+    if (sw == dw) { // No zoom
+        // Do nothing
+    }
+    else if (sw < dw) { // Zoom in
+
+        tmp = (sw * 0x0800) / dw;
+        zoom_ok = !(tmp > 0x7ff);
+
+        *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
+        *mini |= V1_X_INTERPOLY;
+    }
+    else { // sw > dw - Zoom out
+
+        // Find a suitable divider (1 << d) = {2, 4, 8 or 16}
+
+        sw1 = sw;
+        for (d = 1; d < 5; d++) {
+            sw1 >>= 1;
+            if (sw1 <= dw) break;
+        }
+        if (d == 5) { // Too small.
+            d = 4;
+            zoom_ok = false;
+        }
+
+        md = 1 << d;                    // <= {2,4,8,16}
+        *falign = ((md<<1)-1) & 0xf;    // <= {3,7,15,15}
+        *mini |= V1_X_INTERPOLY;
+        *mini |= ((d<<1)-1) << 24;      // <= {1,3,5,7} << 24
+
+        // Add scaling
+
+        if (sw1 < dw) {
+            //CLE bug
+            //tmp = sw1*0x0800 / dw;
+            tmp = (sw1 - 2) * 0x0800 / dw;
+            *zoom |= ((tmp & 0x7ff) << 16) | V1_X_ZOOM_ENABLE;
+        }
+    }
+
+    *dcount = sw - md;
+
+    return zoom_ok;
+}
+
+
+/**
+ * @param falign    fetch alignment
+ * @param format    overlay pixel format
+ * @param pfetch    source pixels per line
+ *
+ * @returns qword fetch register setting
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetFetch()
+ * @note Only call after uc_ovl_map_hzoom()
+ */
+u32 uc_ovl_map_qwfetch(int falign, DFBSurfacePixelFormat format, int pfetch)
+{
+    int fetch = 0;
+
+    switch (format) {
+    case DSPF_YV12:
+        fetch = ALIGN_TO(pfetch, 32) >> 4;
+        break;
+    case DSPF_I420:
+        fetch = (ALIGN_TO(pfetch, 16) >> 4) + 1;
+        break;
+    case DSPF_UYVY:
+    case DSPF_YUY2:
+        fetch = (ALIGN_TO(pfetch << 1, 16) >> 4) + 1;
+        break;
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+        fetch = (ALIGN_TO(pfetch << 1, 16) >> 4) + 1;
+        break;
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        fetch = (ALIGN_TO(pfetch << 2, 16) >> 4) + 1;
+        break;
+    default:
+        D_BUG("Unexpected pixelformat!");
+        break;
+    }
+
+    if (fetch < 4) fetch = 4;
+
+    // Note: Unsure if alignment is needed or is in the way.
+    fetch = ALIGN_TO(fetch, falign + 1);
+    return fetch << 20; // V12_QWORD_PER_LINE
+}
+
+
+/**
+ * Map pixel format.
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c, DDOver_GetV1Format()
+ */
+u32 uc_ovl_map_format(DFBSurfacePixelFormat format)
+{
+    switch (format) {
+    case DSPF_YV12:
+    case DSPF_I420:
+        return V1_COLORSPACE_SIGN | V1_YUV420;
+    case DSPF_UYVY:
+    case DSPF_YUY2:
+        return V1_COLORSPACE_SIGN | V1_YUV422;
+    case DSPF_ARGB1555:
+        return V1_RGB15;
+    case DSPF_RGB16:
+        return V1_RGB16;
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        return V1_RGB32;
+    default :
+        D_BUG("Unexpected pixelformat!");
+        return V1_YUV422;
+    }
+}
+
+
+/**
+ * Map overlay window.
+ *
+ * @param scrw      screen width (eg. 800)
+ * @param scrh      screen height (eg. 600)
+ * @param win       destination window
+ * @param sw        source surface width
+ * @param sh        source surface height
+ *
+ * @param win_start will hold window start register setting
+ * @param win_end   will hold window end register setting
+ *
+ * @parm ox         will hold new leftmost coordinate in source surface
+ * @parm oy         will hold new topmost coordinate in source surface
+ * @parm pfetch     will hold number of required source pixels per line
+ */
+void uc_ovl_map_window(int scrw, int scrh, DFBRectangle* win, int sw, int sh,
+                       u32* win_start, u32* win_end,
+                       int* ox, int* oy, int *pfetch)
+{
+    int x1, y1, x2, y2;
+    int x,y,dw,dh;      // These help making the code readable...
+
+    *ox = 0;
+    *oy = 0;
+    *win_start = 0;
+    *win_end = 0;
+
+    x = win->x;
+    y = win->y;
+    dw = win->w;
+    dh = win->h;
+
+    // For testing the clipping
+    //scrw -= 100;
+    //scrh -= 100;
+
+    // Handle invisible case.
+    if ((x > scrw) || (y > scrh) || (x+dw < 0) || (y+dh < 0)) return;
+
+    // Vertical clipping
+
+    if ((y >= 0) && (y+dh < scrh)) {
+        // No clipping
+        y1 = y;
+        y2 = y+dh-1;
+    }
+    else if ((y < 0) && (y+dh < scrh)) {
+        // Top clip
+        y2 = y+dh-1;
+        *oy = (int) (((float) (sh * -y)) / ((float) dh) + 0.5);
+        y1 = ((4-*oy)&3)*dh/sh;
+        *oy = (*oy + 3) & ~3;
+    }
+    else if ((y >= 0) && (y+dh >= scrh)) {
+        // Bottom clip
+        y1 = y;
+        y2 = scrh-1;
+    }
+    else { // if (y < 0) && (y+dh >= scrh)
+        // Top and bottom clip
+        y2 = scrh-1;
+        *oy = (int) (((float) (sh * -y)) / ((float) dh) + 0.5);
+        y1 = ((4-*oy)&3)*dh/sh;
+        *oy = (*oy + 3) & ~3;
+    }
+
+    // Horizontal clipping
+
+    if ((x >= 0) && (x+dw < scrw)) {
+        // No clipping
+        x1 = x;
+        x2 = x+dw-1;
+        *pfetch = sw;
+    }
+    else if ((x < 0) && (x+dw < scrw)) {
+        // Left clip
+        x2 = x+dw-1;
+        *ox = (int) (((float) (sw * -x)) / ((float) dw) + 0.5);
+        x1 = ((32-*ox)&31)*dw/sw;
+        *ox = (*ox + 31) & ~31;
+        *pfetch = sw - *ox;
+    }
+    else if ((x >= 0) && (x+dw >= scrw)) {
+        // Right clip
+        x1 = x;
+        x2 = scrw-1;
+        *pfetch = sw - (x+dw-scrw)*sw/dw;
+    }
+    else { // if (x < 0) && (x+dw >= scrw)
+        // Left and right clip
+        x2 = scrw-1;
+        *ox = (int) (((float) (sw * -x)) / ((float) dw) + 0.5);
+        x1 = ((32-*ox)&31)*dw/sw;
+        *ox = (*ox + 31) & ~31;
+        *pfetch = sw - *ox - (x+dw-scrw)*sw/dw;
+    }
+
+    if (*pfetch < 0)
+        *pfetch = 0;
+
+    *win_start = (x1 << 16) | y1;
+    *win_end = (x2 << 16) | y2;
+
+    // For testing the clipping
+    //*win_start = ((x1+50) << 16) | (y1+50);
+    //*win_end = ((x2+50) << 16) | (y2+50);
+}
+
+
+/**
+ * Map overlay buffer address.
+ *
+ * @param format    pixel format
+ * @param buf       Framebuffer address of surface (0 = start of framebuffer)
+ * @param ox        leftmost pixel to show (used when clipping, else set to zero)
+ * @param oy        topmost pixel to show (used when clipping, else set to zero)
+ * @param w         total surface width (does *not* depend on the x parameter)
+ * @param h         total surface height (does *not* depend on the y parameter)
+ * @param pitch     source surface pitch (bytes per pixel)
+ *
+ * @param y_start   will hold start address of Y(UV) or RGB buffer
+ * @param u_start   will hold start address of Cb buffer (planar modes only)
+ * @param v_start   will hold start address of Cr buffer (planar modes only)
+ *
+ * @note Derived from VIA's V4L driver. See ddover.c,
+ *       DDOver_GetSrcStartAddress() and DDOVer_GetYCbCrStartAddress()
+ */
+void uc_ovl_map_buffer(DFBSurfacePixelFormat format, u32 buf,
+                       int ox, int oy, int sw, int sh, int sp, int field,
+                       u32* y_start, u32* u_start, u32* v_start)
+{
+    int swap_cb_cr = 0;
+
+    u32 tmp;
+    u32 y_offset, uv_offset = 0;
+
+    switch (format) {
+
+    case DSPF_YUY2:
+    case DSPF_UYVY:
+        y_offset = ((oy * sp) + ((ox << 1) & ~15));
+        break;
+
+    case DSPF_YV12:
+        swap_cb_cr = 1;
+    case DSPF_I420:
+        y_offset = ((((oy & ~3) * sp) + ox + 16) & ~31) ;
+        if (oy > 0)
+            uv_offset = (((((oy & ~3) >> 1) * sp) + ox + 16) & ~31) >> 1;
+        else
+            uv_offset = y_offset >> 1;
+        break;
+
+    case DSPF_ARGB1555:
+    case DSPF_RGB16:
+        y_offset = (oy * sp) + ((ox * 16) >> 3);
+        break;
+
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        y_offset = (oy * sp) + ((ox * 32) >> 3);
+        break;
+
+    default:
+        y_offset = 0;
+        uv_offset = 0;
+        D_BUG("Unexpected pixelformat!");
+    }
+
+    if (field) {
+         y_offset  += sp;
+         uv_offset += sp >> 1;
+    }
+
+    *y_start = buf + y_offset;
+
+    if (u_start && v_start) {
+        *u_start = buf + sp * sh + uv_offset;
+        *v_start = buf + sp * sh + sp * (sh >> 2) + uv_offset;
+
+        if (swap_cb_cr) {
+            tmp = *u_start;
+            *u_start = *v_start;
+            *v_start = tmp;
+        }
+    }
+}
+
+
+/**
+ * Map alpha mode and opacity.
+ *
+ * @param opacity   Alpha opacity: 0 = transparent, 255 = opaque.
+ *                  -1 = Use alpha from underlying graphics.
+ *
+ * @returns alpha control register setting.
+ *
+ * @note: Unfortunately, if using alpha from underlying graphics,
+ *        the video is opaque if alpha = 255 and transparent if = 0.
+ *        The inverse would have made more sense ...
+ *
+ * @note: The hardware supports a separate alpha plane as well,
+ *        but it is not implemented here.
+ *
+ * @note: Derived from ddmpeg.c, VIAAlphaWin()
+ */
+
+u32 uc_ovl_map_alpha(int opacity)
+{
+    u32 ctrl = 0x00080000;      // Not sure what this number is, supposedly
+                                // it is the "expire number divided by 4".
+
+    if (opacity > 255) opacity = 255;
+
+    if (opacity < 0) {
+        ctrl |= ALPHA_WIN_BLENDING_GRAPHIC;
+    }
+    else {
+        opacity = opacity >> 4; // Throw away bits 0 - 3
+        ctrl |= (opacity << 12) | ALPHA_WIN_BLENDING_CONSTANT;
+    }
+
+    return ctrl; // V_ALPHA_CONTROL
+}
+
+/**
+ * Calculate V1 control and fifo-control register values
+ * @param format        pixel format
+ * @param sw            source width
+ * @param hwrev         Unichrome hardware revision
+ * @param extfifo_on    set this true if the extended FIFO is enabled
+ * @param control       will hold value for V1_CONTROL
+ * @param fifo          will hold value for V1_FIFO_CONTROL
+ */
+void uc_ovl_map_v1_control(DFBSurfacePixelFormat format, int sw,
+                           int hwrev, bool extfifo_on,
+                           u32* control, u32* fifo)
+{
+    *control = V1_BOB_ENABLE | V1_ENABLE | uc_ovl_map_format(format);
+
+    if (hwrev >= 0x10) {
+        *control |= V1_EXPIRE_NUM_F;
+    }
+    else {
+        if (extfifo_on) {
+            *control |= V1_EXPIRE_NUM_A | V1_FIFO_EXTENDED;
+        }
+        else {
+            *control |= V1_EXPIRE_NUM;
+        }
+    }
+
+    if ((format == DSPF_YV12) || (format == DSPF_I420)) {
+        //Minified video will be skewed without this workaround.
+        if (sw <= 80) { //Fetch count <= 5
+            *fifo = UC_MAP_V1_FIFO_CONTROL(16,0,0);
+        }
+        else {
+            if (hwrev == 0x10)
+                *fifo = UC_MAP_V1_FIFO_CONTROL(64,56,56);
+            else
+                *fifo = UC_MAP_V1_FIFO_CONTROL(16,12,8);
+        }
+    }
+    else {
+        if (hwrev >= 0x10) {
+            *fifo = UC_MAP_V1_FIFO_CONTROL(64,56,56);   // Default rev 0x10
+        }
+        else {
+            if (extfifo_on)
+                *fifo = UC_MAP_V1_FIFO_CONTROL(48,40,40);
+            else
+                *fifo = UC_MAP_V1_FIFO_CONTROL(32,29,16);   // Default
+        }
+    }
+}
+
+/** uc_ovl_map_adjustment() helper - clamp x to [lo, hi] */
+static float clamp(float x, float lo, float hi)
+{
+    return (x < lo) ? lo : ((x > hi) ? hi : x); /* 2 nested if's. */
+}
+
+/**
+ * uc_ovl_map_adjustment() helper - format x for the hardware.
+ *
+ * @param x     The value to format.
+ * @param ndec  Number of binary decimals.
+ * @param sbit  sign bit position.
+ *              =0: use two's complement representation
+ *              >0: use a sign bit + positive value.
+ * @param mask  Bitmask
+ * @param shift Position in hardware register.
+ */
+static int fmt(float x, int ndec, int sbit, u32 mask, int shift)
+{
+    int y = (x * (1 << ndec));
+    if (sbit && (y < 0)) y = -y | (1 << sbit);
+    return (((u32) y) & mask) << shift;
+}
+
+/**
+ * Map color adjustment to Unichrome hardware.
+ *
+ * @param adj   DirectFB color adjustment. All fields are assumed valid.
+ * @param a1    Will hold value for V1_ColorSpaceReg_1
+ * @param a2    Will hold value for V1_ColorSpaceReg_2
+ */
+void uc_ovl_map_adjustment(DFBColorAdjustment* adj, u32* a1, u32* a2)
+{
+    float con, sat, bri, hue;
+    float c, s;
+    float A, B1, C1, D, B2, C2, B3, C3;
+
+    // Map contrast to [0, 2.0] (preferred: [0, 1.66]), default: 1.0.
+    con = (float) adj->contrast / 32768.0;
+    // Map saturation to [0, 2.0], default: 1.0.
+    sat = (float) adj->saturation / 32768.0;
+    // Map brightness to [-121, 125], (preferred: [-94, 125.1]), default: 3.97.
+    bri = (float) (adj->brightness - 31696) / 270.48;
+    // Map hue to [-pi, pi], default is 0.0.
+    hue = (float) (adj->hue - 32768) / 10430.378;
+    // Note: The limits are estimates that need testing.
+
+    // Map parameters to hw registers.
+
+    s = sin(hue) * con * sat;
+    c = cos(hue) * con * sat;
+
+    A = clamp(1.164*con, 0, 1.9375);
+    B1 = clamp(-1.596*s, -0.75, 0.75);
+    C1 = clamp(1.596*c, 1, 2.875);
+    B2 = clamp( (0.813*s - 0.391*c), 0, -0.875);
+    C2 = clamp(-(0.813*c + 0.391*s), 0, -1.875);
+    B3 = clamp(2.018*c, 0, 3.75);
+    C3 = clamp(2.018*s, -1.25, 1.25);
+    D = clamp(1.164*(bri-16), -128, 127);
+
+    *a1 =
+        fmt(A,  4, 0, 0x1f, 24) | fmt(B1, 2, 2, 0x07, 18) |
+        fmt(C1, 3, 0, 0x1f,  9) | fmt(D,  0, 0, 0xff,  0);
+
+    *a2 =
+        fmt(B2, 3, 4, 0x7, 25) | fmt(C2, 3, 4, 0xf, 17) |
+        fmt(B3, 2, 0, 0xf, 10) | fmt(C3, 2, 3, 0xf,  2);
+}
+
+u32 uc_ovl_map_colorkey(DFBColorKey* c)
+{
+    u32 color;
+    DFBSurfacePixelFormat fmt;
+
+    color = 0;
+    fmt = dfb_primary_layer_pixelformat();
+
+    switch (fmt) 
+    {
+    case DSPF_ARGB1555:
+        color = PIXEL_ARGB1555(0, c->r, c->g, c->b);
+        break;
+
+    case DSPF_RGB16:
+        color = PIXEL_RGB16(c->r, c->g, c->b);
+        break;
+
+    case DSPF_RGB24:
+    case DSPF_RGB32:
+    case DSPF_ARGB:
+        color = PIXEL_ARGB(0, c->r, c->g, c->b);
+        break;
+
+    case DSPF_AiRGB:
+        color = PIXEL_AiRGB(0, c->r, c->g, c->b);
+        break;
+
+    default:
+        D_BUG( "unexpected pixel format" );
+    }
+
+    return color;
+}
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwset.c b/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwset.c
new file mode 100755
index 0000000..f601408
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_ovl_hwset.c
@@ -0,0 +1,283 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <sys/io.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+#include <direct/messages.h>
+
+#include <core/system.h>
+
+/**
+ * Set up the extended video FIFO.
+ * @note It will be turned on if ucovl->scrwidth > 1024.
+ */
+
+void uc_ovl_setup_fifo(UcOverlayData* ucovl, int scrwidth)
+{
+     u8* mclk_save = ucovl->mclk_save;
+
+     if (!iopl(3)) {
+          if (scrwidth <= 1024) { // Disable
+               if (ucovl->extfifo_on) {
+
+                    dfb_layer_wait_vsync(dfb_layer_at(DLID_PRIMARY));
+
+                    outb(0x16, 0x3c4); outb(mclk_save[0], 0x3c5);
+                    outb(0x17, 0x3c4); outb(mclk_save[1], 0x3c5);
+                    outb(0x18, 0x3c4); outb(mclk_save[2], 0x3c5);
+                    ucovl->extfifo_on = false;
+               }
+          }
+          else { // Enable
+               if (!ucovl->extfifo_on) {
+
+                    dfb_layer_wait_vsync(dfb_layer_at(DLID_PRIMARY));
+
+                    // Save current setting
+                    outb(0x16, 0x3c4); mclk_save[0] = inb(0x3c5);
+                    outb(0x17, 0x3c4); mclk_save[1] = inb(0x3c5);
+                    outb(0x18, 0x3c4); mclk_save[2] = inb(0x3c5);
+                    // Enable extended FIFO
+                    outb(0x17, 0x3c4); outb(0x2f, 0x3c5);
+                    outb(0x16, 0x3c4); outb((mclk_save[0] & 0xf0) | 0x14, 0x3c5);
+                    outb(0x18, 0x3c4); outb(0x56, 0x3c5);
+                    ucovl->extfifo_on = true;
+               }
+          }
+     }
+     else {
+          D_BUG( "Unichrome: could set io perissons\n" );
+     }
+     ucovl->scrwidth = scrwidth;
+}
+
+void uc_ovl_vcmd_wait(volatile u8* vio)
+{
+     while ((VIDEO_IN(vio, V_COMPOSE_MODE)
+             & (V1_COMMAND_FIRE | V3_COMMAND_FIRE)));
+}
+
+/**
+ * Update the video overlay.
+ *
+ * @param action        = UC_OVL_CHANGE: update everything
+ *                      = UC_OVL_FLIP: only flip to the front surface buffer.
+ * @param surface       source surface
+ *
+ * @note: Derived from ddmpeg.c, Upd_Video()
+ */
+
+DFBResult uc_ovl_update(UcDriverData* ucdrv,
+                        UcOverlayData* ucovl,
+                        int action,
+                        CoreSurface* surface,
+                        CoreSurfaceBufferLock* lock)
+{
+     int sw, sh, sp, sfmt;   // Source width, height, pitch and format
+     int dx, dy;             // Destination position
+     int dw, dh;             // Destination width and height
+     int pfetch;             // Source pixels required for one line
+     VideoMode *videomode;
+     DFBRectangle scr;       // Screen size
+     u32 dst_key = 0;        // Destination color key (hw format)
+
+     bool write_buffers = false;
+     bool write_settings = false;
+
+     volatile u8* vio = ucdrv->hwregs;
+
+     u32 win_start, win_end;   // Overlay register settings
+     u32 zoom, mini;
+     u32 dcount, falign, qwfetch;
+     u32 y_start, u_start, v_start;
+     u32 v_ctrl, fifo_ctrl;
+     u32 alpha = 0;
+
+     int offset = lock->offset;
+
+     if (!ucovl->v1.isenabled) return DFB_OK;
+
+     qwfetch = 0;
+
+     // Get screen size
+     videomode = dfb_system_current_mode();
+     scr.w = videomode ? videomode->xres : 720;
+     scr.h = videomode ? videomode->yres : 576;
+     scr.x = 0;
+     scr.y = 0;
+
+     if (ucovl->scrwidth != scr.w) {
+          // FIXME: fix uc_ovl_setup_fifo()
+          //    uc_ovl_setup_fifo(ucovl, scr.w);
+          action |= UC_OVL_CHANGE;
+     }
+
+     D_ASSERT(surface);
+
+     sw = surface->config.size.w;
+     sh = surface->config.size.h;
+     sp = lock->pitch;
+     sfmt = surface->config.format;
+
+     if (ucovl->deinterlace) {
+          /*if (ucovl->field)
+               offset += sp;*/
+
+          sh /= 2;
+          //sp *= 2;
+     }
+
+     if (action & UC_OVL_CHANGE) {
+
+          if ((sw > 4096) || (sh > 4096) ||
+              (sw < 32) || (sh < 1) || (sp > 0x1fff)) {
+               D_DEBUG("Layer surface size is out of bounds.");
+               return DFB_INVAREA;
+          }
+
+          dx = ucovl->v1.win.x;
+          dy = ucovl->v1.win.y;
+          dw = ucovl->v1.win.w;
+          dh = ucovl->v1.win.h;
+
+          // Get image format, FIFO size, etc.
+
+          uc_ovl_map_v1_control(sfmt, sw, ucovl->hwrev, ucovl->extfifo_on,
+                                &v_ctrl, &fifo_ctrl);
+
+          if (ucovl->deinterlace) {
+               v_ctrl |= /*V1_BOB_ENABLE |*/ V1_FRAME_BASE;
+          }
+
+          // Get layer window.
+          // The parts that fall outside the screen are clipped.
+
+          uc_ovl_map_window(scr.w, scr.h, &(ucovl->v1.win), sw, sh,
+                            &win_start, &win_end,
+                            &ucovl->v1.ox, &ucovl->v1.oy, &pfetch);
+
+          // Get scaling and data-fetch parameters
+
+          // Note: the *_map_?zoom() functions return false if the scaling
+          // is out of bounds. We don't act on it for now, because it only
+          // makes the display look strange.
+
+          zoom = 0;
+          mini = 0;
+
+          uc_ovl_map_vzoom(sh, dh, &zoom, &mini);
+          uc_ovl_map_hzoom(sw, dw, &zoom, &mini, &falign, &dcount);
+          qwfetch = uc_ovl_map_qwfetch(falign, sfmt, pfetch);
+
+          // Prepare destination color key
+          dst_key = uc_ovl_map_colorkey(&(ucovl->v1.dst_key));
+
+          // prepare opacity
+          if (ucovl->v1.level > 0)  // overlay
+               alpha = uc_ovl_map_alpha(ucovl->v1.opacity);
+          else
+               alpha = uc_ovl_map_alpha(ucovl->opacity_primary);
+          
+          write_settings = true;
+     }
+
+     if (action & (UC_OVL_FIELD | UC_OVL_FLIP | UC_OVL_CHANGE)) {
+          int field = 0;
+          // Update the buffer pointers
+
+          if (ucovl->deinterlace) {
+               field = ucovl->field;
+          }
+
+          uc_ovl_map_buffer(sfmt, offset,
+                            ucovl->v1.ox, ucovl->v1.oy, sw, surface->config.size.h, sp, 0/*field*/, &y_start,
+                            &u_start, &v_start);
+
+          if (field) {
+               y_start |= 0x08000000;
+          }
+
+          write_buffers = true;
+     }
+
+     // Write to the hardware
+
+/*    if (write_settings || write_buffers)
+        uc_ovl_vcmd_wait(vio);*/
+
+     if (write_settings) {
+
+          VIDEO_OUT(vio, V1_CONTROL, v_ctrl);
+          VIDEO_OUT(vio, V_FIFO_CONTROL, fifo_ctrl);
+
+          VIDEO_OUT(vio, V1_WIN_START_Y, win_start);
+          VIDEO_OUT(vio, V1_WIN_END_Y, win_end);
+
+          VIDEO_OUT(vio, V1_SOURCE_HEIGHT, (sh << 16) | dcount);
+          VIDEO_OUT(vio, V12_QWORD_PER_LINE, qwfetch);
+          VIDEO_OUT(vio, V1_STRIDE, sp | ((sp >> 1) << 16));
+
+          VIDEO_OUT(vio, V1_MINI_CONTROL, mini);
+          VIDEO_OUT(vio, V1_ZOOM_CONTROL, zoom);
+
+          VIDEO_OUT(vio, V_COLOR_KEY, dst_key);
+          
+          VIDEO_OUT(vio, V_ALPHA_CONTROL, alpha);
+     }
+
+     if (write_buffers) {
+
+          VIDEO_OUT(vio, V1_STARTADDR_0, y_start);
+          VIDEO_OUT(vio, V1_STARTADDR_CB0, u_start);
+          VIDEO_OUT(vio, V1_STARTADDR_CR0, v_start);
+     }
+
+     if (write_settings || write_buffers) {
+          VIDEO_OUT(vio, V_COMPOSE_MODE, V1_COMMAND_FIRE |
+              (ucovl->v1.dstkey_enabled ? ENABLE_COLOR_KEYING : 0));
+     }
+
+     return DFB_OK;
+}
+
+DFBResult uc_ovl_set_adjustment(CoreLayer            *layer,
+                                void                 *driver_data,
+                                void                 *layer_data,
+                                DFBColorAdjustment   *adj)
+{
+    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+    DFBColorAdjustment* ucadj;
+    u32 a1, a2;
+
+    ucadj = &ucovl->v1.adj;
+
+    if (adj->flags & DCAF_BRIGHTNESS)
+        ucadj->brightness = adj->brightness;
+    if (adj->flags & DCAF_CONTRAST)
+        ucadj->contrast = adj->contrast;
+    if (adj->flags & DCAF_HUE)
+        ucadj->hue = adj->hue;
+    if (adj->flags & DCAF_SATURATION)
+        ucadj->saturation = adj->saturation;
+
+    uc_ovl_map_adjustment(ucadj, &a1, &a2);
+
+    VIDEO_OUT(ucdrv->hwregs, V1_ColorSpaceReg_1, a1);
+    VIDEO_OUT(ucdrv->hwregs, V1_ColorSpaceReg_2, a2);
+
+    return DFB_OK;
+}
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_primary.c b/Source/DirectFB/gfxdrivers/unichrome/uc_primary.c
new file mode 100755
index 0000000..2c32184
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_primary.c
@@ -0,0 +1,182 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <core/layers.h>
+
+#include <misc/conf.h>
+
+#include "unichrome.h"
+#include "uc_overlay.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+/* primary layer hooks */
+
+#define OSD_OPTIONS      (DLOP_ALPHACHANNEL | DLOP_SRC_COLORKEY | DLOP_OPACITY)
+
+DisplayLayerFuncs  ucOldPrimaryFuncs;
+void              *ucOldPrimaryDriverData;
+
+static DFBResult
+osdInitLayer( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              DFBDisplayLayerDescription *description,
+              DFBDisplayLayerConfig      *config,
+              DFBColorAdjustment         *adjustment )
+{
+     DFBResult ret;
+
+     /* call the original initialization function first */
+     ret = ucOldPrimaryFuncs.InitLayer( layer,
+                                        ucOldPrimaryDriverData,
+                                        layer_data, description,
+                                        config, adjustment );
+     if (ret)
+          return ret;
+
+     /* set name */
+     snprintf(description->name,
+              DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VIA CLE266 Graphics");
+
+     /* add some capabilities */
+     description->caps |= DLCAPS_ALPHACHANNEL |
+                          DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY;
+
+     return DFB_OK;
+}
+
+static DFBResult
+osdTestRegion( CoreLayer                  *layer,
+               void                       *driver_data,
+               void                       *layer_data,
+               CoreLayerRegionConfig      *config,
+               CoreLayerRegionConfigFlags *failed )
+{
+     DFBResult                  ret;
+     CoreLayerRegionConfigFlags fail = 0;
+     DFBDisplayLayerOptions     options = config->options;
+
+     /* remove options before calling the original function */
+     config->options = DLOP_NONE;
+
+     /* call the original function */
+     ret = ucOldPrimaryFuncs.TestRegion( layer, ucOldPrimaryDriverData,
+                                         layer_data, config, &fail );
+
+     /* check options if specified */
+     if (options) {
+          /* any unsupported option wanted? */
+          if (options & ~OSD_OPTIONS)
+               fail |= CLRCF_OPTIONS;
+
+          /* opacity and alpha channel cannot be used at once */
+          if ((options & (DLOP_OPACITY | DLOP_ALPHACHANNEL)) ==
+              (DLOP_OPACITY | DLOP_ALPHACHANNEL))
+          {
+               fail |= CLRCF_OPTIONS;
+          }
+
+          if ((options & DLOP_ALPHACHANNEL) && config->format != DSPF_AiRGB)
+               fail |= CLRCF_OPTIONS;
+     }
+
+     /* restore options */
+     config->options = options;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return ret;
+}
+
+static DFBResult
+osdSetRegion( CoreLayer                  *layer,
+              void                       *driver_data,
+              void                       *layer_data,
+              void                       *region_data,
+              CoreLayerRegionConfig      *config,
+              CoreLayerRegionConfigFlags  updated,
+              CoreSurface                *surface,
+              CorePalette                *palette,
+              CoreSurfaceBufferLock      *lock )
+{
+     DFBResult     ret;
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+
+     /* call the original function */
+     ret = ucOldPrimaryFuncs.SetRegion( layer, ucOldPrimaryDriverData,
+                                        layer_data, region_data,
+                                        config, updated, surface,
+                                        palette, lock );
+     if (ret)
+          return ret;
+
+     uc_ovl_vcmd_wait(ucdrv->hwregs);
+
+     /* select pixel based or global alpha */
+
+     if (!ucdrv->ovl)   // overlay not present
+          return DFB_OK;
+     
+     if (config->options & DLOP_ALPHACHANNEL)
+          ucdrv->ovl->opacity_primary = -1; // use primary alpha for overlay
+     else if (config->options & DLOP_OPACITY)
+          ucdrv->ovl->opacity_primary = config->opacity ^ 0xff; // use inverse for overlay
+     else
+          ucdrv->ovl->opacity_primary = 0x00; // primary opaque == overlay transparent
+
+     if (ucdrv->ovl->v1.level < 0)  // primary on top?
+     {
+          VIDEO_OUT(ucdrv->hwregs, V_ALPHA_CONTROL,
+               uc_ovl_map_alpha(ucdrv->ovl->opacity_primary));
+          VIDEO_OUT(ucdrv->hwregs, V_COMPOSE_MODE,
+               VIDEO_IN(ucdrv->hwregs, V_COMPOSE_MODE) | V1_COMMAND_FIRE);
+     }
+     
+     return DFB_OK;
+}
+
+DisplayLayerFuncs ucPrimaryFuncs = {
+     .InitLayer  = osdInitLayer,
+
+     .TestRegion = osdTestRegion,
+     .SetRegion  = osdSetRegion,
+};
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_probe.h b/Source/DirectFB/gfxdrivers/unichrome/uc_probe.h
new file mode 100755
index 0000000..3925db9
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_probe.h
@@ -0,0 +1,42 @@
+/*
+   Copyright (c) 2004 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_PROBE_H__
+#define __UC_PROBE_H__
+
+#ifndef PCI_VENDOR_ID_VIA
+#define PCI_VENDOR_ID_VIA 0x1106
+#endif
+
+#ifndef FB_ACCEL_VIA_UNICHROME
+#define FB_ACCEL_VIA_UNICHROME 77
+#endif
+
+struct uc_via_chipinfo
+{
+#ifdef KERNEL
+    u16 id;                 // PCI id
+#else
+    u16 id;
+#endif
+    char* name;             // Human readable name, e.g CLE266/UniChrome
+};
+
+static struct uc_via_chipinfo uc_via_devices[] = 
+{
+    {0x3122, "CLE266/UniChrome"},       // aka VT3122
+    {0x7205, "KM400/UniChrome"},        // aka VT3205, P4M800
+    {0x7204, "K8M800/UniChrome Pro"},   // aka VT3204, Unichrome Pro B
+    {0x3118, "CN400/UniChrome Pro"},    // aka VT3259, PM8?0, Unichrome Pro A
+    {0x3344, "CN700/Unichrome Pro"},    // aka VT3314, P4M800Pro, VN800, CN900
+    {0x3157, "CX700/Unichrome Pro"},    // aka CX700 CX700M CX700M2
+    {0, ""}
+};
+
+#endif /* __UC_PROBE_H__ */
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_spic.c b/Source/DirectFB/gfxdrivers/unichrome/uc_spic.c
new file mode 100755
index 0000000..b7665b3
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_spic.c
@@ -0,0 +1,193 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include "unichrome.h"
+#include "vidregs.h"
+#include "mmio.h"
+
+#include <core/system.h>
+#include <core/palette.h>
+
+#define UC_SPIC_OPTIONS DLOP_OPACITY
+
+typedef struct _UcSubpictureData {
+} UcSubpictureData;
+
+static int uc_spic_datasize( void )
+{
+    return sizeof(UcSubpictureData);
+}
+
+static void
+uc_spic_set_palette( volatile u8* hwregs, CorePalette *palette )
+{
+    int i;
+
+    if (palette) {
+        for (i = 0; i < 16; i++) {
+            /* TODO: Check r-g-b order. */
+            VIDEO_OUT(hwregs, RAM_TABLE_CONTROL,
+                (palette->entries[i].r << 24) |
+                (palette->entries[i].g << 16) |
+                (palette->entries[i].b <<  8) |
+                (i << 4) | RAM_TABLE_RGB_ENABLE);
+        }
+    }
+}
+
+static void uc_spic_enable( volatile u8 *hwregs, bool enable )
+{
+    VIDEO_OUT(hwregs, SUBP_CONTROL_STRIDE,
+        (VIDEO_IN(hwregs, SUBP_CONTROL_STRIDE) & ~SUBP_HQV_ENABLE) |
+        (enable ? SUBP_HQV_ENABLE : 0));
+}
+
+static void
+uc_spic_set_buffer( volatile u8 *hwregs, CoreSurfaceBufferLock *lock )
+{
+    if (lock) {
+        VIDEO_OUT(hwregs, SUBP_STARTADDR,
+            lock->offset);
+        VIDEO_OUT(hwregs, SUBP_CONTROL_STRIDE,
+            (VIDEO_IN(hwregs, SUBP_CONTROL_STRIDE) & ~SUBP_STRIDE_MASK) |
+            (lock->pitch & SUBP_STRIDE_MASK) |
+            SUBP_AI44 );
+    }
+}
+
+static DFBResult
+uc_spic_init_layer( CoreLayer                   *layer,
+                    void                        *driver_data,
+                    void                        *layer_data,
+                    DFBDisplayLayerDescription  *description,
+                    DFBDisplayLayerConfig       *config,
+                    DFBColorAdjustment          *adjustment )
+{
+    /* Set layer type, capabilities and name */
+
+    description->caps = DLCAPS_SURFACE | DLCAPS_OPACITY;
+    description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+    snprintf(description->name,
+        DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VIA Unichrome DVD Subpicture");
+
+    adjustment->flags = DCAF_NONE;
+
+    /* Fill out the default configuration */
+
+    config->flags  = DLCONF_WIDTH | DLCONF_HEIGHT |
+                     DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+
+    config->width  = 720;
+    config->height = 576;
+
+    config->pixelformat = DSPF_ALUT44;
+    config->buffermode  = DLBM_FRONTONLY;
+    config->options     = DLOP_NONE;
+
+    return DFB_OK;
+}
+
+static DFBResult
+uc_spic_test_region( CoreLayer                  *layer,
+                     void                       *driver_data,
+                     void                       *layer_data,
+                     CoreLayerRegionConfig      *config,
+                     CoreLayerRegionConfigFlags *failed)
+{
+    CoreLayerRegionConfigFlags fail = 0;
+
+    /* Check layer options */
+
+    if (config->options & ~UC_SPIC_OPTIONS)
+        fail |= CLRCF_OPTIONS;
+
+    /* Check pixelformats */
+
+    switch (config->format) {
+          case DSPF_ALUT44:
+              break;
+          //case DSPF_LUTA44:
+              // IA44 does not exist in DirectFB, but hw supports it.
+          default:
+              fail |= CLRCF_FORMAT;
+    }
+
+    /* Check width and height */
+
+    if (config->width > 8195 || config->width < 1)
+        fail |= CLRCF_WIDTH;
+
+    if (config->height > 4096 || config->height < 1)
+        fail |= CLRCF_HEIGHT;
+
+    if (failed) *failed = fail;
+    if (fail) return DFB_UNSUPPORTED;
+
+    return DFB_OK;
+}
+
+static DFBResult
+uc_spic_set_region( CoreLayer                  *layer,
+                    void                       *driver_data,
+                    void                       *layer_data,
+                    void                       *region_data,
+                    CoreLayerRegionConfig      *config,
+                    CoreLayerRegionConfigFlags  updated,
+                    CoreSurface                *surface,
+                    CorePalette                *palette,
+                    CoreSurfaceBufferLock      *lock )
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+    uc_spic_set_palette(ucdrv->hwregs, palette);
+    uc_spic_set_buffer(ucdrv->hwregs, lock);
+    uc_spic_enable(ucdrv->hwregs, (config->opacity > 0));
+
+    return DFB_OK;
+}
+
+static DFBResult
+uc_spic_remove( CoreLayer *layer,
+                void      *driver_data,
+                void      *layer_data,
+                void      *region_data )
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+    uc_spic_enable(ucdrv->hwregs, false);
+    return DFB_OK;
+}
+
+static DFBResult
+uc_spic_flip_region( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data,
+                     CoreSurface           *surface,
+                     DFBSurfaceFlipFlags    flags,
+                     CoreSurfaceBufferLock *lock )
+{
+    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
+
+    dfb_surface_flip(surface, false);
+    uc_spic_set_buffer(ucdrv->hwregs, lock);
+
+    return DFB_OK;
+}
+
+DisplayLayerFuncs ucSubpictureFuncs = {
+     .LayerDataSize = uc_spic_datasize,
+     .InitLayer     = uc_spic_init_layer,
+     .SetRegion     = uc_spic_set_region,
+     .RemoveRegion  = uc_spic_remove,
+     .TestRegion    = uc_spic_test_region,
+     .FlipRegion    = uc_spic_flip_region,
+};
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_state.c b/Source/DirectFB/gfxdrivers/unichrome/uc_state.c
new file mode 100755
index 0000000..6e0fbfa
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_state.c
@@ -0,0 +1,350 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#include <config.h>
+
+#include <gfx/convert.h>
+#include "unichrome.h"
+#include "uc_state.h"
+#include "uc_accel.h"
+#include "uc_hw.h"
+
+enum uc_state_type {
+     UC_TYPE_UNSUPPORTED,
+     UC_TYPE_2D,
+     UC_TYPE_3D
+};
+
+/// GPU selecting functions --------------------------------------------------
+
+static inline bool
+uc_has_dst_format( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_ARGB4444:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_additional_draw_2d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_AiRGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_additional_blit_2d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_YV12:
+          case DSPF_I420:
+          case DSPF_YUY2:
+          case DSPF_AiRGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_has_src_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_ARGB4444:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_A8:
+          case DSPF_LUT8:
+          case DSPF_YUY2:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_has_inv_src_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_AiRGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline bool
+uc_has_inv_dst_format_3d( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_AiRGB:
+               return true;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+static inline enum uc_state_type
+uc_select_drawtype( CardState* state,
+                    DFBAccelerationMask accel )
+{
+     if (!(state->drawingflags & ~UC_DRAWING_FLAGS_2D) &&
+         !(accel & DFXL_FILLTRIANGLE))
+          return UC_TYPE_2D;
+
+     if (!(state->drawingflags & ~UC_DRAWING_FLAGS_3D))
+          return UC_TYPE_3D;
+
+     return UC_TYPE_UNSUPPORTED;
+}
+
+static inline enum uc_state_type
+uc_select_blittype( CardState* state,
+                    DFBAccelerationMask accel )
+{
+     if (!(state->blittingflags & ~UC_BLITTING_FLAGS_2D)) {
+          if ((state->source->config.format == state->destination->config.format) &&
+              !((state->blittingflags & DSBLIT_SRC_COLORKEY) &&
+                (state->blittingflags & DSBLIT_DST_COLORKEY)) &&
+              !(accel & (DFXL_STRETCHBLIT | DFXL_TEXTRIANGLES)))
+               return UC_TYPE_2D;
+     }
+
+     if (!(state->blittingflags & ~UC_BLITTING_FLAGS_3D)) {
+          if (uc_has_src_format_3d( state->source->config.format ))
+               return UC_TYPE_3D;
+     }
+     
+     if (!(state->blittingflags & ~UC_BLITTING_FLAGS_3D_INV)) {
+          if (uc_has_inv_src_format_3d( state->source->config.format ))
+               return UC_TYPE_3D;
+     }
+     
+     /* Special case for an inverted destination alpha channel.  This
+      * can only be done if no blending is requested at the same time. */
+     if (state->blittingflags == DSBLIT_NOFX) {
+          if (DFB_PIXELFORMAT_INV_ALPHA(state->destination->config.format) &&
+              !DFB_PIXELFORMAT_INV_ALPHA(state->source->config.format))
+               return UC_TYPE_3D;
+     }
+
+     return UC_TYPE_UNSUPPORTED;
+}
+
+// DirectFB interfacing functions --------------------------------------------
+
+void uc_check_state(void *drv, void *dev,
+                    CardState *state, DFBAccelerationMask accel)
+{
+     if (DFB_DRAWING_FUNCTION(accel)) {
+          /* Check drawing parameters. */
+          switch (uc_select_drawtype(state, accel)) {
+               case UC_TYPE_2D:
+                    if (uc_has_dst_format( state->destination->config.format ) ||
+                         uc_additional_draw_2d( state->destination->config.format ))
+                         state->accel |= UC_DRAWING_FUNCTIONS_2D;
+                    break;
+               case UC_TYPE_3D:
+                    if (uc_has_dst_format( state->destination->config.format ))
+                         state->accel |= UC_DRAWING_FUNCTIONS_3D;
+                    break;
+               default:
+                    return;
+          }
+     }
+     else {
+          /* Check blitting parameters. */
+          switch (uc_select_blittype(state, accel)) {
+               case UC_TYPE_2D:
+                    if (uc_has_dst_format( state->destination->config.format ) ||
+                         uc_additional_blit_2d( state->destination->config.format ))
+                         state->accel |= UC_BLITTING_FUNCTIONS_2D;
+                    break;
+               case UC_TYPE_3D:
+                    if (uc_has_dst_format( state->destination->config.format ) ||
+                         uc_has_inv_dst_format_3d( state->destination->config.format ))
+                         state->accel |= UC_BLITTING_FUNCTIONS_3D;
+                    break;
+               default:
+                    return;
+          }
+     }
+}
+
+void uc_set_state(void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                  CardState *state, DFBAccelerationMask accel)
+{
+     UcDriverData   *ucdrv = (UcDriverData*) drv;
+     UcDeviceData   *ucdev = (UcDeviceData*) dev;
+     struct uc_fifo *fifo  = ucdrv->fifo;
+
+     u32 rop3d     = HC_HROP_P;
+     u32 regEnable = HC_HenCW_MASK | HC_HenAW_MASK;
+
+     StateModificationFlags modified = state->mod_hw;
+
+     // Check modified states and update hw
+
+     if (modified & SMF_SOURCE)
+          UC_INVALIDATE( uc_source2d );
+
+     if (modified & (SMF_BLITTING_FLAGS | SMF_SOURCE))
+          UC_INVALIDATE( uc_source3d );
+
+     if (modified & (SMF_BLITTING_FLAGS | SMF_SOURCE | SMF_DESTINATION))
+          UC_INVALIDATE( uc_texenv );
+
+     if (modified & (SMF_BLITTING_FLAGS | SMF_SRC_COLORKEY | SMF_DST_COLORKEY))
+          UC_INVALIDATE( uc_colorkey2d );
+
+     if (modified & (SMF_COLOR | SMF_DESTINATION | SMF_DRAWING_FLAGS))
+          UC_INVALIDATE( uc_color2d );
+
+     if (modified & (SMF_SRC_BLEND | SMF_DST_BLEND))
+          UC_INVALIDATE( uc_blending_fn );
+
+
+     if (modified & SMF_COLOR)
+          ucdev->color3d = PIXEL_ARGB( state->color.a, state->color.r,
+                                       state->color.g, state->color.b );
+
+     if (modified & SMF_DRAWING_FLAGS) {
+          if (state->drawingflags & DSDRAW_XOR) {
+               ucdev->draw_rop3d = HC_HROP_DPx;
+               ucdev->draw_rop2d = VIA_ROP_DPx;
+          }
+          else {
+               ucdev->draw_rop3d = HC_HROP_P;
+               ucdev->draw_rop2d = VIA_ROP_P;
+          }
+     }
+
+     ucdev->bflags = state->blittingflags;
+
+     if (modified & SMF_DESTINATION)
+          uc_set_destination(ucdrv, ucdev, state);
+
+     if (modified & SMF_CLIP)
+          uc_set_clip(ucdrv, ucdev, state);
+
+
+     // Select GPU and check remaining states
+
+     if (DFB_DRAWING_FUNCTION(accel)) {
+
+          switch (uc_select_drawtype(state, accel)) {
+               case UC_TYPE_2D:
+                    funcs->FillRectangle = uc_fill_rectangle;
+                    funcs->DrawRectangle = uc_draw_rectangle;
+                    funcs->DrawLine = uc_draw_line;
+
+                    uc_set_color_2d(ucdrv, ucdev, state);
+
+                    state->set = UC_DRAWING_FUNCTIONS_2D;
+                    break;
+
+               case UC_TYPE_3D:
+                    funcs->FillRectangle = uc_fill_rectangle_3d;
+                    funcs->DrawRectangle = uc_draw_rectangle_3d;
+                    funcs->DrawLine = uc_draw_line_3d;
+
+                    if (state->drawingflags & DSDRAW_BLEND) {
+                         uc_set_blending_fn(ucdrv, ucdev, state);
+                         regEnable |= HC_HenABL_MASK;
+                    }
+
+                    rop3d = ucdev->draw_rop3d;
+
+                    state->set = UC_DRAWING_FUNCTIONS_3D;
+                    break;
+
+               case UC_TYPE_UNSUPPORTED:
+                    D_BUG("Unsupported drawing function!");
+                    break;
+          }
+     }
+     else { // DFB_BLITTING_FUNCTION(accel)
+          switch (uc_select_blittype(state, accel)) {
+               case UC_TYPE_2D:
+                    uc_set_source_2d(ucdrv, ucdev, state);
+                    funcs->Blit = uc_blit;
+
+                    uc_set_colorkey_2d(ucdrv, ucdev, state);
+                    state->set = UC_BLITTING_FUNCTIONS_2D;
+                    break;
+
+               case UC_TYPE_3D:
+                    funcs->Blit = uc_blit_3d;
+                    uc_set_source_3d(ucdrv, ucdev, state);
+                    uc_set_texenv(ucdrv, ucdev, state);
+                    uc_set_blending_fn(ucdrv, ucdev, state);
+
+                    regEnable |= HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK | HC_HenDT_MASK;
+
+                    if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                                DSBLIT_BLEND_COLORALPHA))
+                         regEnable |= HC_HenABL_MASK;
+
+                    state->set = UC_BLITTING_FUNCTIONS_3D;
+                    break;
+
+               case UC_TYPE_UNSUPPORTED:
+                    D_BUG("Unsupported blitting function!");
+                    break;
+          }
+     }
+
+#ifdef UC_ENABLE_3D
+     UC_FIFO_PREPARE( fifo, 6 );
+     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
+
+     /* Don't know what this does. DRI code always clears it. */
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HPixGC,   0 );
+
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HEnable,  regEnable );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HFBBMSKL, 0xffffff );
+     UC_FIFO_ADD_3D ( fifo, HC_SubA_HROP,     rop3d | 0xff );
+#endif
+
+     UC_FIFO_CHECK(fifo);
+
+     state->mod_hw = 0;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/unichrome/uc_state.h b/Source/DirectFB/gfxdrivers/unichrome/uc_state.h
new file mode 100755
index 0000000..a3e7484
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/uc_state.h
@@ -0,0 +1,68 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UC_STATE__
+#define __UC_STATE__
+
+#include <directfb.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+void uc_set_state(void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                  CardState *state, DFBAccelerationMask accel);
+void uc_check_state(void *drv, void *dev,
+                    CardState *state, DFBAccelerationMask accel);
+
+
+
+/*
+struct uc_hw_misc
+{
+    // These control clipping...
+
+    u32 regHClipTB;
+    u32 regHClipLR;
+    u32 regHFPClipTL;
+    u32 regHFPClipBL;
+    u32 regHFPClipLL;
+    u32 regHFPClipRL;
+    u32 regHFPClipTBH;
+    u32 regHFPClipLRH;
+
+    // Other functions
+
+    u32 regHLP;             // Line stipple pattern
+    u32 regHLPRF;           // Line stipple factor
+    u32 regHSolidCL;        // --- Don't know. Unused in DRI.
+    u32 regHPixGC;          // Don't know. Is kept cleared in DRI.
+    //u32 regHSPXYOS;       // Polygon stipple x and y offsets. Unused here.
+    u32 regHVertexCNT;      // --- Don't know. Unused in DRI.
+
+    u8 ps_xos;              // Polygon stipple x-offset. => regHSPXYOS
+    u8 ps_yos;              // Polygon stipple y-offset. => regHSPXYOS
+    u32 ps_pat[32];         // Polygon stipple pattern buffer.
+                            // These are not registers...
+};
+
+
+/// Stencil control.
+
+struct uc_hw_stencil
+{
+    //u32 regHSBBasL;       // These aren't in regs3d.h, but they should exist...
+    //u32 regHSBBasH;
+    //u32 regHSBFM;
+
+    u32 regHSTREF;          // Stencil reference value and plane mask
+    u32 regHSTMD;           // Stencil test function and fail operation and
+                            // zpass/zfail operations.
+};
+*/
+
+#endif // __UC_STATE__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/unichrome.c b/Source/DirectFB/gfxdrivers/unichrome/unichrome.c
new file mode 100755
index 0000000..062334e
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/unichrome.c
@@ -0,0 +1,596 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+// DirectFB headers
+
+#include <config.h>
+
+#include <fbdev/fbdev.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/coretypes.h>
+#include <core/core.h>
+#include <core/gfxcard.h>
+#include <core/graphics_driver.h>
+#include <core/system.h>
+#include <core/screens.h>
+
+#include <misc/conf.h>
+
+#include <fbdev/fb.h>
+
+// System headers
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <string.h>
+
+// Driver headers
+
+#include "unichrome.h"
+#include "uc_state.h"
+#include "uc_accel.h"
+#include "uc_fifo.h"
+#include "uc_ioctl.h"
+#include "mmio.h"
+#include "uc_probe.h"
+
+extern DisplayLayerFuncs ucOverlayFuncs;
+extern DisplayLayerFuncs ucPrimaryFuncs;
+extern DisplayLayerFuncs ucSubpictureFuncs;
+
+extern DisplayLayerFuncs  ucOldPrimaryFuncs;
+extern void              *ucOldPrimaryDriverData;
+
+
+DFB_GRAPHICS_DRIVER(unichrome)
+
+//----------
+
+/* PCI probing code is derived from gfxdrivers/matrox/matrox.c */
+
+/** Read PCI configuration register 'reg' for device at {bus,slot,func}. */
+static int pci_config_in8( unsigned int bus,
+                           unsigned int slot,
+                           unsigned int func,
+                           u8 reg )
+{
+    char  filename[512];
+    int   fd;
+    int   val;
+
+    val = 0;
+
+    snprintf( filename, 512, "/proc/bus/pci/%02x/%02x.%x", bus, slot, func );
+
+    fd = open( filename, O_RDONLY );
+    if (fd < 0) {
+        D_PERROR( "DirectFB/Unichrome: Error opening `%s'!\n", filename );
+        return -1;
+    }
+
+    if (lseek( fd, reg, SEEK_SET ) == reg) {
+        if (read( fd, &val, 1 ) == 1) {
+            close( fd );
+            return val;
+        }
+    }
+
+    close( fd );
+    return -1;
+}
+
+/* Probe for a Unichrome device.
+* @returns DFB_OK if successful, with ucdrv->hwid, ucdrv->hwrev,
+* and ucdrv->name filled in.
+*/
+static DFBResult uc_probe_pci( UcDriverData *ucdrv )
+{
+    unsigned int    bus, devfn, vendor, device;
+    char            line[512];
+    FILE            *file;
+    int             i;
+
+    const char* filename = "/proc/bus/pci/devices";
+
+    file = fopen( filename, "r" );
+    if (!file) {
+        D_PERROR( "DirectFB/Unichrome: Error opening `%s'!\n", filename );
+        return errno2result( errno );
+    }
+
+    while (fgets( line, 512, file )) {
+        if (sscanf( line, "%02x%02x\t%04x%04x",
+            &bus, &devfn, &vendor, &device ) != 4)
+            continue;
+
+        if (vendor != PCI_VENDOR_ID_VIA)
+            continue;
+
+        for (i = 0; uc_via_devices[i].id != 0; i++) {
+            if (device == uc_via_devices[i].id) {
+                // Found a Unichrome device.
+                ucdrv->hwid = device;
+                ucdrv->name = uc_via_devices[i].name;
+                // Read its revision number from the host bridge.
+                ucdrv->hwrev = pci_config_in8(0, 0, 0, 0xf6);
+                if (ucdrv->hwrev == -1 && dfb_config->unichrome_revision == -1) {
+                    ucdrv->hwrev = 0x11;    // a fairly arbitrary default
+                    D_ERROR( "DirectFB/Unichrome: Failed to determine hardware revision, assuming %d.\n",
+                        ucdrv->hwrev );
+                }
+                // Because we can only auto-detect if we're superuser,
+                // allow an override
+                if (dfb_config->unichrome_revision != -1)
+                    ucdrv->hwrev = dfb_config->unichrome_revision;
+                fclose( file );
+                return DFB_OK;
+            }
+        }
+    }
+
+    D_ERROR( "DirectFB/Unichrome: Can't find a Unichrome device in `%s'!\n",
+        filename );
+
+    fclose( file );
+    return DFB_INIT;
+}
+
+/**
+ * Dump beginning of virtual queue.
+ * Use it to check that the VQ actually is in use. */
+#if 0
+static void uc_dump_vq(UcDeviceData *ucdev)
+{
+     int i;
+     u8* vq;
+
+     if (!ucdev->vq_start) return;
+     vq = dfb_system_video_memory_virtual(ucdev->vq_start);
+
+     for (i = 0; i < 128; i++) {
+          printf("%02x ", *(vq+i));
+          if ((i+1) % 16 == 0) printf("\n");
+     }
+}
+#endif
+
+/** Allocate memory for the virtual queue. */
+
+static DFBResult uc_alloc_vq(CoreGraphicsDevice *device, UcDeviceData *ucdev)
+{
+     if (ucdev->vq_start) return DFB_OK;
+
+     ucdev->vq_size = 256*1024; // 256kb
+     ucdev->vq_start = dfb_gfxcard_reserve_memory( device, ucdev->vq_size );
+
+     if (!ucdev->vq_start)
+          return DFB_INIT;
+
+     ucdev->vq_end = ucdev->vq_start + ucdev->vq_size - 1;
+
+     // Debug: clear buffer
+     memset((void *) dfb_system_video_memory_virtual(ucdev->vq_start),
+            0xcc, ucdev->vq_size);
+
+     // uc_dump_vq(ucdev);
+
+     return DFB_OK;
+}
+
+/**
+ * Initialize the hardware.
+ * @param enable    enable VQ if true (else disable it.)
+ */
+
+static DFBResult uc_init_2d_engine(CoreGraphicsDevice *device, UcDeviceData *ucdev, UcDriverData *ucdrv, bool enable)
+{
+     DFBResult result = DFB_OK;
+     volatile u8* hwregs = ucdrv->hwregs;
+     int i;
+
+     // Init 2D engine registers to reset 2D engine
+
+     for ( i = 0x04; i <= 0x40; i += 4 )
+          VIA_OUT(hwregs, i, 0x0);
+
+     // Init AGP and VQ registers
+
+     VIA_OUT(hwregs, 0x43c, 0x00100000);
+     VIA_OUT(hwregs, 0x440, 0x00000000);
+     VIA_OUT(hwregs, 0x440, 0x00333004);
+     VIA_OUT(hwregs, 0x440, 0x60000000);
+     VIA_OUT(hwregs, 0x440, 0x61000000);
+     VIA_OUT(hwregs, 0x440, 0x62000000);
+     VIA_OUT(hwregs, 0x440, 0x63000000);
+     VIA_OUT(hwregs, 0x440, 0x64000000);
+     VIA_OUT(hwregs, 0x440, 0x7D000000);
+
+     VIA_OUT(hwregs, 0x43c, 0xfe020000);
+     VIA_OUT(hwregs, 0x440, 0x00000000);
+
+     if (enable) {
+          result = uc_alloc_vq(device,ucdev);
+          enable = (result == DFB_OK);
+     }
+
+     if (enable) { // Enable VQ
+
+          VIA_OUT(hwregs, 0x43c, 0x00fe0000);
+          VIA_OUT(hwregs, 0x440, 0x080003fe);
+          VIA_OUT(hwregs, 0x440, 0x0a00027c);
+          VIA_OUT(hwregs, 0x440, 0x0b000260);
+          VIA_OUT(hwregs, 0x440, 0x0c000274);
+          VIA_OUT(hwregs, 0x440, 0x0d000264);
+          VIA_OUT(hwregs, 0x440, 0x0e000000);
+          VIA_OUT(hwregs, 0x440, 0x0f000020);
+          VIA_OUT(hwregs, 0x440, 0x1000027e);
+          VIA_OUT(hwregs, 0x440, 0x110002fe);
+          VIA_OUT(hwregs, 0x440, 0x200f0060);
+
+          VIA_OUT(hwregs, 0x440, 0x00000006);
+          VIA_OUT(hwregs, 0x440, 0x40008c0f);
+          VIA_OUT(hwregs, 0x440, 0x44000000);
+          VIA_OUT(hwregs, 0x440, 0x45080c04);
+          VIA_OUT(hwregs, 0x440, 0x46800408);
+
+          VIA_OUT(hwregs, 0x440, 0x52000000 |
+                  ((ucdev->vq_start & 0xFF000000) >> 24) |
+                  ((ucdev->vq_end & 0xFF000000) >> 16));
+          VIA_OUT(hwregs, 0x440, 0x50000000 | (ucdev->vq_start & 0xFFFFFF));
+          VIA_OUT(hwregs, 0x440, 0x51000000 | (ucdev->vq_end & 0xFFFFFF));
+          VIA_OUT(hwregs, 0x440, 0x53000000 | (ucdev->vq_size >> 3));
+     }
+     else { // Disable VQ
+
+          VIA_OUT(hwregs, 0x43c, 0x00fe0000);
+          VIA_OUT(hwregs, 0x440, 0x00000004);
+          VIA_OUT(hwregs, 0x440, 0x40008c0f);
+          VIA_OUT(hwregs, 0x440, 0x44000000);
+          VIA_OUT(hwregs, 0x440, 0x45080c04);
+          VIA_OUT(hwregs, 0x440, 0x46800408);
+     }
+
+     return result;
+}
+
+static void uc_init_3d_engine(volatile u8* hwregs, int hwrev, bool init_all)
+{
+     u32 i;
+
+     if (init_all) {
+
+          // Clear NotTex registers
+
+          VIA_OUT(hwregs, 0x43C, 0x00010000);
+          for (i = 0; i <= 0x7d; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+
+          // Clear texture unit 0
+
+          VIA_OUT(hwregs, 0x43C, 0x00020000);
+          for (i = 0; i <= 0x94; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+          VIA_OUT(hwregs, 0x440, 0x82400000);
+
+          // Clear texture unit 1
+
+          VIA_OUT(hwregs, 0x43C, 0x01020000);
+          for (i = 0; i <= 0x94; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+          VIA_OUT(hwregs, 0x440, 0x82400000);
+
+          // Clear general texture settings
+
+          VIA_OUT(hwregs, 0x43C, 0xfe020000);
+          for (i = 0; i <= 0x03; i++)
+               VIA_OUT(hwregs, 0x440, i << 24);
+
+          // Clear palette settings
+
+          VIA_OUT(hwregs, 0x43C, 0x00030000);
+          for (i = 0; i <= 0xff; i++)
+               VIA_OUT(hwregs, 0x440, 0);
+
+          VIA_OUT(hwregs, 0x43C, 0x00100000);
+          VIA_OUT(hwregs, 0x440, 0x00333004);
+          VIA_OUT(hwregs, 0x440, 0x10000002);
+          VIA_OUT(hwregs, 0x440, 0x60000000);
+          VIA_OUT(hwregs, 0x440, 0x61000000);
+          VIA_OUT(hwregs, 0x440, 0x62000000);
+          VIA_OUT(hwregs, 0x440, 0x63000000);
+          VIA_OUT(hwregs, 0x440, 0x64000000);
+
+          VIA_OUT(hwregs, 0x43C, 0x00fe0000);
+
+          if (hwrev >= 3)
+               VIA_OUT(hwregs, 0x440,0x40008c0f);
+          else
+               VIA_OUT(hwregs, 0x440,0x4000800f);
+
+          VIA_OUT(hwregs, 0x440,0x44000000);
+          VIA_OUT(hwregs, 0x440,0x45080C04);
+          VIA_OUT(hwregs, 0x440,0x46800408);
+          VIA_OUT(hwregs, 0x440,0x50000000);
+          VIA_OUT(hwregs, 0x440,0x51000000);
+          VIA_OUT(hwregs, 0x440,0x52000000);
+          VIA_OUT(hwregs, 0x440,0x53000000);
+
+     }
+
+     VIA_OUT(hwregs, 0x43C,0x00fe0000);
+     VIA_OUT(hwregs, 0x440,0x08000001);
+     VIA_OUT(hwregs, 0x440,0x0A000183);
+     VIA_OUT(hwregs, 0x440,0x0B00019F);
+     VIA_OUT(hwregs, 0x440,0x0C00018B);
+     VIA_OUT(hwregs, 0x440,0x0D00019B);
+     VIA_OUT(hwregs, 0x440,0x0E000000);
+     VIA_OUT(hwregs, 0x440,0x0F000000);
+     VIA_OUT(hwregs, 0x440,0x10000000);
+     VIA_OUT(hwregs, 0x440,0x11000000);
+     VIA_OUT(hwregs, 0x440,0x20000000);
+}
+
+/** */
+
+static void uc_after_set_var(void* drv, void* dev)
+{
+     UcDriverData* ucdrv = (UcDriverData*) drv;
+
+     VGA_OUT8(ucdrv->hwregs, 0x3c4, 0x1a);
+     // Clear bit 6 in extended VGA register 0x1a to prevent system lockup.
+     VGA_OUT8(ucdrv->hwregs, 0x3c5, VGA_IN8(ucdrv->hwregs, 0x3c5) & 0xbf);
+     // Set bit 2, it might make a difference.
+     VGA_OUT8(ucdrv->hwregs, 0x3c5, VGA_IN8(ucdrv->hwregs, 0x3c5) | 0x4);
+
+     VIA_OUT(ucdrv->hwregs, VIA_REG_CURSOR_MODE, VIA_IN(ucdrv->hwregs, VIA_REG_CURSOR_MODE) & 0xFFFFFFFE);
+}
+
+/** Wait until the engine is idle. */
+
+static DFBResult uc_engine_sync(void* drv, void* dev)
+{
+     UcDriverData* ucdrv = (UcDriverData*) drv;
+     UcDeviceData* ucdev = (UcDeviceData*) dev;
+
+     int loop = 0;
+
+/*    printf("Entering uc_engine_sync(), status is 0x%08x\n",
+        VIA_IN(ucdrv->hwregs, VIA_REG_STATUS));
+*/
+
+     while ((VIA_IN(ucdrv->hwregs, VIA_REG_STATUS) & 0xfffeffff) != 0x00020000) {
+          if (++loop > MAXLOOP) {
+               D_ERROR("DirectFB/Unichrome: Timeout waiting for idle engine!\n");
+               break;
+
+               /* FIXME: return DFB_TIMEOUT and implement EngineReset! */
+          }
+     }
+
+     /* printf("Leaving uc_engine_sync(), status is 0x%08x, "
+         "waiting for %d (0x%x) cycles.\n",
+         VIA_IN(ucdrv->hwregs, VIA_REG_STATUS), loop, loop);
+      */
+
+     ucdev->idle_waitcycles += loop;
+     ucdev->must_wait = 0;
+
+     return DFB_OK;
+}
+
+
+// DirectFB interfacing functions --------------------------------------------
+
+static int driver_probe(CoreGraphicsDevice *device)
+{
+     struct stat s;
+
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_VIA_UNICHROME:
+               return 1;
+     }
+
+     return stat(UNICHROME_DEVICE, &s) + 1;
+}
+
+static void driver_get_info(CoreGraphicsDevice* device,
+                            GraphicsDriverInfo* info)
+{
+     // Fill in driver info structure.
+
+     snprintf(info->name,
+              DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+              "VIA UniChrome Driver");
+
+     snprintf(info->vendor,
+              DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+              "-");
+
+     snprintf(info->url,
+              DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH,
+              "http://www.directfb.org");
+
+     snprintf(info->license,
+              DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH,
+              "LGPL");
+
+     info->version.major = 0;
+     info->version.minor = 4;
+
+     info->driver_data_size = sizeof (UcDriverData);
+     info->device_data_size = sizeof (UcDeviceData);
+}
+
+static void uc_probe_fbdev(UcDriverData *ucdrv)
+{
+     struct fb_flip flip;
+     FBDev *dfb_fbdev = dfb_system_data();
+     flip.device = VIAFB_FLIP_NOP;
+     if (ioctl(dfb_fbdev->fd, FBIO_FLIPONVSYNC, &flip) == 0)
+          ucdrv->canfliponvsync = true;
+     else
+          ucdrv->canfliponvsync = false;
+}
+
+static DFBResult driver_init_driver(CoreGraphicsDevice* device,
+                                    GraphicsDeviceFuncs* funcs,
+                                    void* driver_data,
+                                    void* device_data,
+                                    CoreDFB *core)
+{
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+
+     //printf("Entering %s\n", __PRETTY_FUNCTION__);
+
+     ucdrv->file = -1;
+     ucdrv->pool = dfb_core_shmpool( core );
+
+     ucdrv->hwregs = dfb_gfxcard_map_mmio( device, 0, 0 );
+     if (!ucdrv->hwregs) {
+          int fd;
+
+          fd = open(UNICHROME_DEVICE, O_RDWR | O_SYNC, 0);
+          if (fd < 0) {
+              D_ERROR("DirectFB/Unichrome: Could not access %s. "
+                        "Is the ucio module installed?\n", UNICHROME_DEVICE);
+               return DFB_IO;
+          }
+
+          ucdrv->file = fd;
+
+          ucdrv->hwregs = mmap(NULL, 0x1000000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+          if (ucdrv->hwregs == MAP_FAILED)
+               return DFB_IO;
+     }
+
+     // Get hardware id and revision.
+     uc_probe_pci(ucdrv);
+
+     // Check framebuffer device capabilities
+     uc_probe_fbdev(ucdrv);
+
+     /* FIXME: this belongs to device_data! */
+     ucdrv->fifo = uc_fifo_create(ucdrv->pool, UC_FIFO_SIZE);
+     if (!ucdrv->fifo)
+          return D_OOSHM();
+
+     uc_after_set_var(driver_data, device_data);
+
+     // Driver specific initialization
+
+     funcs->CheckState        = uc_check_state;
+     funcs->SetState          = uc_set_state;
+     funcs->EngineSync        = uc_engine_sync;
+     funcs->EmitCommands      = uc_emit_commands;
+     funcs->FlushTextureCache = uc_flush_texture_cache;
+     funcs->AfterSetVar       = uc_after_set_var;
+
+     funcs->FillRectangle     = uc_fill_rectangle;
+     funcs->DrawRectangle     = uc_draw_rectangle;
+     funcs->DrawLine          = uc_draw_line;
+     funcs->FillTriangle      = uc_fill_triangle;
+     funcs->Blit              = uc_blit;
+     funcs->StretchBlit       = uc_stretch_blit;
+     funcs->TextureTriangles  = uc_texture_triangles;
+
+     ucdrv->ovl = NULL;
+
+     /* install primary layer hooks */
+     dfb_layers_hook_primary( device, driver_data, &ucPrimaryFuncs,
+                              &ucOldPrimaryFuncs, &ucOldPrimaryDriverData );
+
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                          driver_data, &ucOverlayFuncs );
+     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY),
+                          driver_data, &ucSubpictureFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult driver_init_device(CoreGraphicsDevice* device,
+                                    GraphicsDeviceInfo* device_info,
+                                    void* driver_data,
+                                    void* device_data)
+{
+     UcDriverData *ucdrv = (UcDriverData*) driver_data;
+     UcDeviceData *ucdev = (UcDeviceData*) device_data;
+
+     //printf("Entering %s\n", __PRETTY_FUNCTION__);
+
+     if (ucdrv->name != NULL) {
+          snprintf(device_info->name,
+                   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "%s", ucdrv->name);
+     }
+     else {
+          snprintf(device_info->name,
+                   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "UniChrome");
+     }
+     snprintf(device_info->vendor,
+              DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "VIA/S3G");
+
+     device_info->caps.flags = CCF_CLIPPING;
+     device_info->caps.accel =
+     UC_DRAWING_FUNCTIONS_2D | UC_DRAWING_FUNCTIONS_3D |
+     UC_BLITTING_FUNCTIONS_2D | UC_BLITTING_FUNCTIONS_3D;
+
+     device_info->caps.drawing  = UC_DRAWING_FLAGS_2D | UC_DRAWING_FLAGS_3D;
+     device_info->caps.blitting = UC_BLITTING_FLAGS_2D | UC_BLITTING_FLAGS_3D;
+
+     device_info->limits.surface_byteoffset_alignment = 32;
+     device_info->limits.surface_pixelpitch_alignment = 32;
+
+     ucdev->pitch = 0;
+     ucdev->draw_rop2d = VIA_ROP_P;
+     ucdev->draw_rop3d = HC_HROP_P;
+     ucdev->color = 0;
+     ucdev->bflags = 0;
+
+     ucdev->must_wait = 0;
+     ucdev->cmd_waitcycles = 0;
+     ucdev->idle_waitcycles = 0;
+
+     uc_init_2d_engine(device, ucdev, ucdrv, false); // VQ disabled - can't make it work.
+     uc_init_3d_engine(ucdrv->hwregs, ucdrv->hwrev, 1);
+
+     return DFB_OK;
+}
+
+static void driver_close_device(CoreGraphicsDevice *device,
+                                void *driver_data, void *device_data)
+{
+     UcDriverData* ucdrv = (UcDriverData*) driver_data;
+     UcDeviceData* ucdev = (UcDeviceData*) device_data;
+
+     // uc_dump_vq(ucdev);
+
+     uc_engine_sync(driver_data, device_data);
+     uc_init_2d_engine(device, ucdev, ucdrv, false);
+}
+
+static void driver_close_driver(CoreGraphicsDevice* device, void* driver_data)
+{
+     UcDriverData* ucdrv = (UcDriverData*) driver_data;
+
+     if (ucdrv->fifo)
+          uc_fifo_destroy( ucdrv->pool, ucdrv->fifo );
+
+     if (ucdrv->file != -1)
+          close( ucdrv->file );
+}
diff --git a/Source/DirectFB/gfxdrivers/unichrome/unichrome.h b/Source/DirectFB/gfxdrivers/unichrome/unichrome.h
new file mode 100755
index 0000000..7f8e72b
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/unichrome.h
@@ -0,0 +1,151 @@
+/*
+   Copyright (c) 2003 Andreas Robinson, 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.
+*/
+
+#ifndef __UNICHROME_H__
+#define __UNICHROME_H__
+
+#include <core/coredefs.h>
+#include <core/surface.h>
+#include <core/layers.h>
+#include <core/layer_control.h>
+
+#include <directfb.h>
+
+#define UNICHROME_DEVICE "/dev/ucio"
+#define UC_FIFO_SIZE 4096
+
+/** If defined - the driver will use the 3D engine. */
+#define UC_ENABLE_3D
+//#undef UC_ENABLE_3D
+
+
+/** Register settings for the current source surface. (3D) */
+struct uc_hw_texture {
+     DFBSurfaceBlittingFlags bltflags;
+
+     u32 l2w;        //width, rounded up to nearest 2^m, eg 600 => 1024
+     u32 l2h;        //height, rounded up, e.g 480 => 512
+     u32 we;         //width exponent, i.e m in the number 2^m
+     u32 he;         //height exponent
+
+     u32 format;     // HW pixel format
+
+     // 3d engine texture environment, texture unit 0
+
+     // Used for the DSBLIT_BLEND_ALPHACHANNEL, DSBLIT_BLEND_COLORALPHA
+     // and DSBLIT_COLORIZE blitting flags.
+
+     u32 regHTXnTB;
+     u32 regHTXnMPMD;
+
+     u32 regHTXnTBLCsat_0;
+     u32 regHTXnTBLCop_0;
+     u32 regHTXnTBLMPfog_0;
+     u32 regHTXnTBLAsat_0;
+     u32 regHTXnTBLRCb_0;
+     u32 regHTXnTBLRAa_0;
+     u32 regHTXnTBLRFog_0;
+};
+
+
+/** Hardware source-destination blending registers. */
+struct uc_hw_alpha {
+/*
+    u32 regHABBasL;         // Alpha buffer, low 24 bits.
+    u32 regHABBasH;         // Alpha buffer, high 8 bits.
+    u32 regHABFM;           // Alpha pixel format, memory type and pitch.
+    u32 regHATMD;           // Alpha test function and reference value.
+
+    // Blending function
+*/
+     u32 regHABLCsat;
+     u32 regHABLCop;
+     u32 regHABLAsat;
+     u32 regHABLAop;
+     u32 regHABLRCa;
+     u32 regHABLRFCa;
+     u32 regHABLRCbias;
+     u32 regHABLRCb;
+     u32 regHABLRFCb;
+     u32 regHABLRAa;
+     u32 regHABLRAb;
+};
+
+typedef enum {
+     uc_source2d    = 0x00000001,
+     uc_source3d    = 0x00000002,
+     uc_texenv      = 0x00000004,
+     uc_blending_fn = 0x00000008,
+     uc_color2d     = 0x00000010,
+     uc_colorkey2d  = 0x00000020
+} UcStateBits;
+
+#define UC_VALIDATE(b)       (ucdev->valid |= (b))
+#define UC_INVALIDATE(b)     (ucdev->valid &= ~(b))
+#define UC_IS_VALID(b)       (ucdev->valid & (b))
+
+typedef struct _UcDeviceData {
+
+     /* State validation */
+     UcStateBits valid;
+
+     /* Current state settings */
+     u32                     pitch;      // combined src/dst pitch (2D)
+     u32                     color;      // 2D fill color
+     u32                     color3d;    // color for 3D operations
+     u32                     draw_rop2d; // logical drawing ROP (2D)
+     u32                     draw_rop3d; // logical drawing ROP (3D)
+
+     DFBSurfaceBlittingFlags bflags;     // blitting flags
+     DFBRegion               clip;       // clipping region
+
+     DFBSurfacePixelFormat   dst_format; // destination pixel format
+     int                     dst_offset; // destination buffer byte offset
+     int                     dst_pitch;  // destination buffer byte pitch
+     int                     dst_height; // destination surface height
+     int                     src_offset; // source buffer byte offset
+     int                     src_pitch;  // source buffer byte pitch
+     int                     src_height; // source surface height
+
+     int                     field;      // source field
+
+     /* Hardware settings */
+     struct uc_hw_alpha      hwalpha;    // alpha blending setting (3D)
+     struct uc_hw_texture    hwtex;      // hardware settings for blitting (3D)
+
+
+     /// Set directly after a 2D/3D engine command is sent.
+     int must_wait;
+     unsigned int cmd_waitcycles;
+     unsigned int idle_waitcycles;
+
+     u32             vq_start;   // VQ related
+     u32             vq_size;
+     u32             vq_end;
+
+} UcDeviceData;
+
+
+typedef struct _UcDriverData {
+     int             file;       // File handle to mmapped IO region.
+     int             hwid;       // Graphics device PCI id.
+     char            hwrev;      // Hardware revision
+     char*           name;       // Graphics device name, eg CLE266/UniChrome
+     volatile void*  hwregs;     // Hardware register base
+     bool            canfliponvsync; // Kernel-assisted flip on vsync available
+     struct uc_fifo* fifo;       // Data FIFO.
+     
+     FusionSHMPoolShared *pool;
+     
+     struct _UcOverlayData *ovl; // Current overlay settings (initially NULL)
+     
+} UcDriverData;
+
+
+#endif // __UNICHROME_H__
diff --git a/Source/DirectFB/gfxdrivers/unichrome/vidregs.h b/Source/DirectFB/gfxdrivers/unichrome/vidregs.h
new file mode 100755
index 0000000..79cde4d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/unichrome/vidregs.h
@@ -0,0 +1,499 @@
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __VIDREGS_H__
+#define __VIDREGS_H__
+
+
+/* Video registers */
+#define V_FLAGS                         0x00
+#define V_CAP_STATUS                    0x04
+#define V_FLIP_STATUS                   0x04
+#define V_ALPHA_WIN_START               0x08
+#define V_ALPHA_WIN_END                 0x0C
+#define V_ALPHA_CONTROL                 0x10
+#define V_CRT_STARTADDR                 0x14
+#define V_CRT_STARTADDR_2               0x18
+#define V_ALPHA_STRIDE                  0x1C
+#define V_COLOR_KEY                     0x20
+#define V_ALPHA_STARTADDR               0x24
+#define V_CHROMAKEY_LOW                 0x28
+#define V_CHROMAKEY_HIGH                0x2C
+
+#define V1_CONTROL                      0x30
+#define V12_QWORD_PER_LINE              0x34
+#define V1_STARTADDR_1                  0x38
+#define V1_STARTADDR_Y1                 V1_STARTADDR_1  /* added by Kevin 3/30/2002 */
+#define V1_STRIDE                       0x3C
+#define V1_WIN_START_Y                  0x40
+#define V1_WIN_START_X                  0x42
+#define V1_WIN_END_Y                    0x44
+#define V1_WIN_END_X                    0x46
+#define V1_STARTADDR_2                  0x48
+#define V1_STARTADDR_Y2                 V1_STARTADDR_2  /* added by Kevin 3/30/2002 */
+#define V1_ZOOM_CONTROL                 0x4C
+#define V1_MINI_CONTROL                 0x50
+#define V1_STARTADDR_0                  0x54
+#define V1_STARTADDR_Y0                 V1_STARTADDR_0  /* added by Kevin 3/30/2002 */
+#define V_FIFO_CONTROL                  0x58
+#define V1_STARTADDR_3                  0x5C
+#define V1_STARTADDR_Y3                 V1_STARTADDR_3  /* added by Kevin 3/30/2002 */
+
+#define HI_CONTROL                      0x60
+#define SND_COLOR_KEY                   0x64
+#define ALPHA_V3_PREFIFO_CONTROL        0x68
+#define V1_SOURCE_HEIGHT                0x6C
+#define HI_TRANSPARENT_COLOR            0x70
+#define V_DISPLAY_TEMP                  0x74  /* No use */
+#define ALPHA_V3_FIFO_CONTROL           0x78
+#define V3_SOURCE_WIDTH                 0x7C
+#define V3_COLOR_KEY                    0x80
+#define V1_ColorSpaceReg_1              0x84
+#define V1_ColorSpaceReg_2              0x88
+#define V1_STARTADDR_CB0                0x8C
+#define V1_OPAQUE_CONTROL               0x90  /* To be deleted */
+#define V3_OPAQUE_CONTROL               0x94  /* To be deleted */
+#define V_COMPOSE_MODE                  0x98
+
+#define V3_STARTADDR_2                  0x9C
+#define V3_CONTROL                      0xA0
+#define V3_STARTADDR_0                  0xA4
+#define V3_STARTADDR_1                  0xA8
+#define V3_STRIDE                       0xAC
+#define V3_WIN_START_Y                  0xB0
+#define V3_WIN_START_X                  0xB2
+#define V3_WIN_END_Y                    0xB4
+#define V3_WIN_END_X                    0xB6
+#define V3_ALPHA_QWORD_PER_LINE         0xB8
+#define V3_ZOOM_CONTROL                 0xBC
+#define V3_MINI_CONTROL                 0xC0
+#define V3_ColorSpaceReg_1              0xC4
+#define V3_ColorSpaceReg_2              0xC8
+#define V3_DISPLAY_TEMP                 0xCC  /* No use */
+
+#define V1_STARTADDR_CB1                0xE4
+#define V1_STARTADDR_CB2                0xE8
+#define V1_STARTADDR_CB3                0xEC
+#define V1_STARTADDR_CR0                0xF0
+#define V1_STARTADDR_CR1                0xF4
+#define V1_STARTADDR_CR2                0xF8
+#define V1_STARTADDR_CR3                0xFC
+
+/* Video Capture Engine Registers - port 1 */
+#define CAP0_MASKS                      0x100
+#define CAP1_MASKS                      0x104
+#define CAP0_CONTROL                    0x110
+#define CAP0_H_RANGE                    0x114
+#define CAP0_V_RANGE                    0x118
+#define CAP0_SCAL_CONTROL               0x11C
+#define CAP0_VBI_H_RANGE                0x120
+#define CAP0_VBI_V_RANGE                0x124
+#define CAP0_VBI_STARTADDR              0x128
+#define CAP0_VBI_STRIDE                 0x12C
+#define CAP0_ANCIL_COUNT                0x130
+#define CAP0_MAXCOUNT                   0x134
+#define CAP0_VBIMAX_COUNT               0x138
+#define CAP0_DATA_COUNT                 0x13C
+#define CAP0_FB_STARTADDR0              0x140
+#define CAP0_FB_STARTADDR1              0x144
+#define CAP0_FB_STARTADDR2              0x148
+#define CAP0_STRIDE                     0x150
+
+/* Video Capture Engine Registers - port 2 */
+#define CAP1_CONTROL                    0x154
+#define CAP1_SCAL_CONTROL               0x160
+#define CAP1_VBI_H_RANGE                0x164 /*To be deleted*/
+#define CAP1_VBI_V_RANGE                0x168 /*To be deleted*/
+#define CAP1_VBI_STARTADDR              0x16C /*To be deleted*/
+#define CAP1_VBI_STRIDE                 0x170 /*To be deleted*/
+#define CAP1_ANCIL_COUNT                0x174 /*To be deleted*/
+#define CAP1_MAXCOUNT                   0x178
+#define CAP1_VBIMAX_COUNT               0x17C /*To be deleted*/
+#define CAP1_DATA_COUNT                 0x180
+#define CAP1_FB_STARTADDR0              0x184
+#define CAP1_FB_STARTADDR1              0x188
+#define CAP1_STRIDE                     0x18C
+
+/* SUBPICTURE Registers */
+#define SUBP_CONTROL_STRIDE             0x1C0
+#define SUBP_STARTADDR                  0x1C4
+#define RAM_TABLE_CONTROL               0x1C8
+#define RAM_TABLE_READ                  0x1CC
+
+/* HQV Registers */
+#define HQV_CONTROL                     0x1D0
+#define HQV_SRC_STARTADDR_Y             0x1D4
+#define HQV_SRC_STARTADDR_U             0x1D8
+#define HQV_SRC_STARTADDR_V             0x1DC
+#define HQV_SRC_FETCH_LINE              0x1E0
+#define HQV_FILTER_CONTROL              0x1E4
+#define HQV_MINIFY_CONTROL              0x1E8
+#define HQV_DST_STARTADDR0              0x1EC
+#define HQV_DST_STARTADDR1              0x1F0
+#define HQV_DST_STARTADDR2              0x1FC
+#define HQV_DST_STRIDE                  0x1F4
+#define HQV_SRC_STRIDE                  0x1F8
+
+
+
+/* Video command definitions */
+
+/* #define V_ALPHA_CONTROL - 0x210 */
+#define ALPHA_WIN_EXPIRENUMBER_4        0x00040000
+#define ALPHA_WIN_CONSTANT_FACTOR_4     0x00004000
+#define ALPHA_WIN_CONSTANT_FACTOR_12    0x0000c000
+#define ALPHA_WIN_BLENDING_CONSTANT     0x00000000
+#define ALPHA_WIN_BLENDING_ALPHA        0x00000001
+#define ALPHA_WIN_BLENDING_GRAPHIC      0x00000002
+#define ALPHA_WIN_PREFIFO_THRESHOLD_12  0x000c0000
+#define ALPHA_WIN_FIFO_THRESHOLD_8      0x000c0000
+#define ALPHA_WIN_FIFO_DEPTH_16         0x00100000
+
+/* V_CHROMAKEY_LOW - 0x228 */
+#define V_CHROMAKEY_V3                  0x80000000
+
+/* V1_CONTROL - 0x230 */
+#define V1_ENABLE                       0x00000001
+#define V1_FULL_SCREEN                  0x00000002
+#define V1_YUV422                       0x00000000
+#define V1_RGB32                        0x00000004
+#define V1_RGB15                        0x00000008
+#define V1_RGB16                        0x0000000C
+#define V1_YUV420                       0x00000010
+#define V1_COLORSPACE_SIGN              0x00000080
+#define V1_SRC_IS_FRAME_PIC             0x00000200
+#define V1_SRC_IS_FIELD_PIC             0x00000000
+#define V1_BOB_ENABLE                   0x00400000
+#define V1_FIELD_BASE                   0x00000000
+#define V1_FRAME_BASE                   0x01000000
+#define V1_SWAP_SW                      0x00000000
+#define V1_SWAP_HW_HQV                  0x02000000
+#define V1_SWAP_HW_CAPTURE              0x04000000
+#define V1_SWAP_HW_MC                   0x06000000
+/* #define V1_DOUBLE_BUFFERS            0x00000000 */
+/* #define V1_QUADRUPLE_BUFFERS         0x18000000 */
+#define V1_EXPIRE_NUM                   0x00050000
+#define V1_EXPIRE_NUM_A                 0x000a0000
+#define V1_EXPIRE_NUM_F                 0x000f0000 /* jason */
+#define V1_FIFO_EXTENDED                0x00200000
+#define V1_ON_CRT                       0x00000000
+#define V1_ON_SND_DISPLAY               0x80000000
+#define V1_FIFO_32V1_32V2               0x00000000
+#define V1_FIFO_48V1_32V2               0x00200000
+
+/* V12_QWORD_PER_LINE - 0x234 */
+#define V1_FETCH_COUNT                  0x3ff00000
+#define V1_FETCHCOUNT_ALIGNMENT         0x0000000f
+#define V1_FETCHCOUNT_UNIT              0x00000004   /* Doubld QWORD */
+
+/* V1_STRIDE */
+#define V1_STRIDE_YMASK                 0x00001fff
+#define V1_STRIDE_UVMASK                0x1ff00000
+
+/* V1_ZOOM_CONTROL - 0x24C */
+#define V1_X_ZOOM_ENABLE                0x80000000
+#define V1_Y_ZOOM_ENABLE                0x00008000
+
+/* V1_MINI_CONTROL - 0x250 */
+#define V1_X_INTERPOLY                  0x00000002  /* X interpolation */
+#define V1_Y_INTERPOLY                  0x00000001  /* Y interpolation */
+#define V1_YCBCR_INTERPOLY              0x00000004  /* Y, Cb, Cr all interpolation */
+#define V1_X_DIV_2                      0x01000000
+#define V1_X_DIV_4                      0x03000000
+#define V1_X_DIV_8                      0x05000000
+#define V1_X_DIV_16                     0x07000000
+#define V1_Y_DIV_2                      0x00010000
+#define V1_Y_DIV_4                      0x00030000
+#define V1_Y_DIV_8                      0x00050000
+#define V1_Y_DIV_16                     0x00070000
+
+/* V1_STARTADDR0 - 0x254 */
+#define SW_FLIP_ODD                     0x08000000
+
+/* V_FIFO_CONTROL - 0x258
+ * IA2 has 32 level FIFO for packet mode video format
+ *         32 level FIFO for planar mode video YV12.
+ *              with extension reg 230 bit 21 enable
+ *         16 level FIFO for planar mode video YV12.
+ *              with extension reg 230 bit 21 disable
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V1_FIFO_DEPTH12                 0x0000000B
+#define V1_FIFO_DEPTH16                 0x0000000F
+#define V1_FIFO_DEPTH32                 0x0000001F
+#define V1_FIFO_DEPTH48                 0x0000002F
+#define V1_FIFO_DEPTH64                 0x0000003F
+#define V1_FIFO_THRESHOLD6              0x00000600
+#define V1_FIFO_THRESHOLD8              0x00000800
+#define V1_FIFO_THRESHOLD12             0x00000C00
+#define V1_FIFO_THRESHOLD16             0x00001000
+#define V1_FIFO_THRESHOLD24             0x00001800
+#define V1_FIFO_THRESHOLD32             0x00002000
+#define V1_FIFO_THRESHOLD40             0x00002800
+#define V1_FIFO_THRESHOLD48             0x00003000
+#define V1_FIFO_THRESHOLD56             0x00003800
+#define V1_FIFO_THRESHOLD61             0x00003D00
+#define V1_FIFO_PRETHRESHOLD10          0x0A000000
+#define V1_FIFO_PRETHRESHOLD12          0x0C000000
+#define V1_FIFO_PRETHRESHOLD29          0x1d000000
+#define V1_FIFO_PRETHRESHOLD40          0x28000000
+#define V1_FIFO_PRETHRESHOLD44          0x2c000000
+#define V1_FIFO_PRETHRESHOLD56          0x38000000
+#define V1_FIFO_PRETHRESHOLD61          0x3D000000
+
+/* ALPHA_V3_FIFO_CONTROL - 0x278
+ * IA2 has 32 level FIFO for packet mode video format
+ *         32 level FIFO for planar mode video YV12.
+ *             with extension reg 230 bit 21 enable
+ *         16 level FIFO for planar mode video YV12.
+ *             with extension reg 230 bit 21 disable
+ *          8 level FIFO for ALPHA
+ * BCos of 128 bits. 1 level in IA2 = 2 level in VT3122
+ */
+#define V3_FIFO_DEPTH16                 0x0000000F
+#define V3_FIFO_DEPTH24                 0x00000017
+#define V3_FIFO_DEPTH32                 0x0000001F
+#define V3_FIFO_DEPTH48                 0x0000002F
+#define V3_FIFO_DEPTH64                 0x0000003F
+#define V3_FIFO_THRESHOLD8              0x00000800
+#define V3_FIFO_THRESHOLD12             0x00000C00
+#define V3_FIFO_THRESHOLD16             0x00001000
+#define V3_FIFO_THRESHOLD24             0x00001800
+#define V3_FIFO_THRESHOLD32             0x00002000
+#define V3_FIFO_THRESHOLD40             0x00002800
+#define V3_FIFO_THRESHOLD48             0x00003000
+#define V3_FIFO_THRESHOLD61             0x00003D00
+#define V3_FIFO_PRETHRESHOLD10          0x0000000A
+#define V3_FIFO_PRETHRESHOLD12          0x0000000C
+#define V3_FIFO_PRETHRESHOLD29          0x0000001d
+#define V3_FIFO_PRETHRESHOLD40          0x00000028
+#define V3_FIFO_PRETHRESHOLD44          0x0000002c
+#define V3_FIFO_PRETHRESHOLD56          0x00000038
+#define V3_FIFO_PRETHRESHOLD61          0x0000003D
+#define V3_FIFO_MASK                    0x0000007F
+#define ALPHA_FIFO_DEPTH8               0x00070000
+#define ALPHA_FIFO_THRESHOLD4           0x04000000
+#define ALPHA_FIFO_MASK                 0xffff0000
+#define ALPHA_FIFO_PRETHRESHOLD4        0x00040000
+
+/* IA2 */
+#define ColorSpaceValue_1               0x140020f2
+#define ColorSpaceValue_2               0x0a0a2c00
+
+#define ColorSpaceValue_1_3123C0        0x13000DED
+#define ColorSpaceValue_2_3123C0        0x13171000
+
+/* For TV setting */
+#define ColorSpaceValue_1TV             0x140020f2
+#define ColorSpaceValue_2TV             0x0a0a2c00
+
+/* V_COMPOSE_MODE - 0x298 */
+/* ENABLE_COLOR_KEYING - renamed from SELECT_VIDEO_IF_COLOR_KEY for DirectFB*/
+#define ENABLE_COLOR_KEYING             0x00000001  /* select video if (color key),otherwise select graphics */
+#define SELECT_VIDEO3_IF_COLOR_KEY      0x00000020  /* For 3123C0, select video3 if (color key),otherwise select graphics */
+#define SELECT_VIDEO_IF_CHROMA_KEY      0x00000002  /* 0x0000000a  //select video if (chroma key ),otherwise select graphics */
+#define ALWAYS_SELECT_VIDEO             0x00000000  /* always select video,Chroma key and Color key disable */
+#define COMPOSE_V1_V3                   0x00000000  /* V1 on top of V3 */
+#define COMPOSE_V3_V1                   0x00100000  /* V3 on top of V1 */
+#define COMPOSE_V1_TOP                  0x00000000
+#define COMPOSE_V3_TOP                  0x00100000
+#define V1_COMMAND_FIRE                 0x80000000  /* V1 commands fire */
+#define V3_COMMAND_FIRE                 0x40000000  /* V3 commands fire */
+#define V_COMMAND_LOAD                  0x20000000  /* Video register always loaded */
+#define V_COMMAND_LOAD_VBI              0x10000000  /* Video register always loaded at vbi without waiting source flip */
+#define V3_COMMAND_LOAD                 0x08000000  /* CLE_C0 Video3 register always loaded */
+#define V3_COMMAND_LOAD_VBI             0x00000100  /* CLE_C0 Video3 register always loaded at vbi without waiting source flip */
+#define SECOND_DISPLAY_COLOR_KEY_ENABLE 0x00010000
+
+/* V3_ZOOM_CONTROL - 0x2bc */
+#define V3_X_ZOOM_ENABLE                0x80000000
+#define V3_Y_ZOOM_ENABLE                0x00008000
+
+/* V3_MINI_CONTROL - 0x2c0 */
+#define V3_X_INTERPOLY                  0x00000002  /* X interpolation */
+#define V3_Y_INTERPOLY                  0x00000001  /* Y interpolation */
+#define V3_YCBCR_INTERPOLY              0x00000004  /* Y, Cb, Cr all interpolation */
+#define V3_X_DIV_2                      0x01000000
+#define V3_X_DIV_4                      0x03000000
+#define V3_X_DIV_8                      0x05000000
+#define V3_X_DIV_16                     0x07000000
+#define V3_Y_DIV_2                      0x00010000
+#define V3_Y_DIV_4                      0x00030000
+#define V3_Y_DIV_8                      0x00050000
+#define V3_Y_DIV_16                     0x00070000
+
+/* SUBP_CONTROL_STRIDE - 0x3c0 */
+#define SUBP_HQV_ENABLE                 0x00010000
+#define SUBP_IA44                       0x00020000
+#define SUBP_AI44                       0x00000000
+#define SUBP_STRIDE_MASK                0x00001fff
+#define SUBP_CONTROL_MASK               0x00070000
+
+/* RAM_TABLE_CONTROL - 0x3c8 */
+#define RAM_TABLE_RGB_ENABLE            0x00000007
+
+/* CAPTURE0_CONTROL - 0x310 */
+#define C0_ENABLE                       0x00000001
+#define BUFFER_2_MODE                   0x00000000
+#define BUFFER_3_MODE                   0x00000004
+#define BUFFER_4_MODE                   0x00000006
+#define SWAP_YUYV                       0x00000000
+#define SWAP_UYVY                       0x00000100
+#define SWAP_YVYU                       0x00000200
+#define SWAP_VYUY                       0x00000300
+#define IN_601_8                        0x00000000
+#define IN_656_8                        0x00000010
+#define IN_601_16                       0x00000020
+#define IN_656_16                       0x00000030
+#define DEINTER_ODD                     0x00000000
+#define DEINTER_EVEN                    0x00001000
+#define DEINTER_ODD_EVEN                0x00002000
+#define DEINTER_FRAME                   0x00003000
+#define VIP_1                           0x00000000
+#define VIP_2                           0x00000400
+#define H_FILTER_2                      0x00010000
+#define H_FILTER_4                      0x00020000
+#define H_FILTER_8_1331                 0x00030000
+#define H_FILTER_8_12221                0x00040000
+#define VIP_ENABLE                      0x00000008
+#define EN_FIELD_SIG                    0x00000800
+#define VREF_INVERT                     0x00100000
+#define FIELD_INPUT_INVERSE             0x00400000
+#define FIELD_INVERSE                   0x40000000
+
+#define C1_H_MINI_EN                    0x00000800
+#define C0_H_MINI_EN                    0x00000800
+#define C1_V_MINI_EN                    0x04000000
+#define C0_V_MINI_EN                    0x04000000
+#define C1_H_MINI_2                     0x00000400
+
+/* CAPTURE1_CONTROL - 0x354 */
+#define C1_ENABLE                       0x00000001
+
+/* V3_CONTROL - 0x2A0 */
+#define V3_ENABLE                       0x00000001
+#define V3_FULL_SCREEN                  0x00000002
+#define V3_YUV422                       0x00000000
+#define V3_RGB32                        0x00000004
+#define V3_RGB15                        0x00000008
+#define V3_RGB16                        0x0000000C
+#define V3_COLORSPACE_SIGN              0x00000080
+#define V3_EXPIRE_NUM                   0x00040000
+#define V3_EXPIRE_NUM_F                 0x000f0000
+#define V3_BOB_ENABLE                   0x00400000
+#define V3_FIELD_BASE                   0x00000000
+#define V3_FRAME_BASE                   0x01000000
+#define V3_SWAP_SW                      0x00000000
+#define V3_SWAP_HW_HQV                  0x02000000
+#define V3_FLIP_HW_CAPTURE0             0x04000000
+#define V3_FLIP_HW_CAPTURE1             0x06000000
+
+/* V3_ALPHA_FETCH_COUNT - 0x2B8 */
+#define V3_FETCH_COUNT                  0x3ff00000
+#define ALPHA_FETCH_COUNT               0x000003ff
+
+/* HQV_CONTROL - 0x3D0 */
+#define HQV_RGB32                       0x00000000
+#define HQV_RGB16                       0x20000000
+#define HQV_RGB15                       0x30000000
+#define HQV_YUV422                      0x80000000
+#define HQV_YUV420                      0xC0000000
+#define HQV_ENABLE                      0x08000000
+#define HQV_SRC_SW                      0x00000000
+#define HQV_SRC_MC                      0x01000000
+#define HQV_SRC_CAPTURE0                0x02000000
+#define HQV_SRC_CAPTURE1                0x03000000
+#define HQV_FLIP_EVEN                   0x00000000
+#define HQV_FLIP_ODD                    0x00000020
+#define HQV_SW_FLIP                     0x00000010   /* Write 1 to flip HQV buffer */
+#define HQV_DEINTERLACE                 0x00010000   /* First line of odd field will be repeated 3 times */
+#define HQV_FIELD_2_FRAME               0x00020000   /* Src is field. Display each line 2 times */
+#define HQV_FRAME_2_FIELD               0x00040000   /* Src is field. Display field */
+#define HQV_FRAME_UV                    0x00000000   /* Src is Non-interleaved */
+#define HQV_FIELD_UV                    0x00100000   /* Src is interleaved */
+#define HQV_IDLE                        0x00000008
+#define HQV_FLIP_STATUS                 0x00000001
+#define HQV_DOUBLE_BUFF                 0x00000000
+#define HQV_TRIPLE_BUFF                 0x04000000
+#define HQV_SUBPIC_FLIP                 0x00008000
+#define HQV_FIFO_STATUS                 0x00001000
+
+/* HQV_FILTER_CONTROL - 0x3E4 */
+#define HQV_H_LOWPASS_2TAP              0x00000001
+#define HQV_H_LOWPASS_4TAP              0x00000002
+#define HQV_H_LOWPASS_8TAP1             0x00000003   /* To be deleted */
+#define HQV_H_LOWPASS_8TAP2             0x00000004   /* To be deleted */
+#define HQV_H_HIGH_PASS                 0x00000008
+#define HQV_H_LOW_PASS                  0x00000000
+#define HQV_V_LOWPASS_2TAP              0x00010000
+#define HQV_V_LOWPASS_4TAP              0x00020000
+#define HQV_V_LOWPASS_8TAP1             0x00030000
+#define HQV_V_LOWPASS_8TAP2             0x00040000
+#define HQV_V_HIGH_PASS                 0x00080000
+#define HQV_V_LOW_PASS                  0x00000000
+#define HQV_H_HIPASS_F1_DEFAULT         0x00000040
+#define HQV_H_HIPASS_F2_DEFAULT         0x00000000
+#define HQV_V_HIPASS_F1_DEFAULT         0x00400000
+#define HQV_V_HIPASS_F2_DEFAULT         0x00000000
+#define HQV_H_HIPASS_F1_2TAP            0x00000050
+#define HQV_H_HIPASS_F2_2TAP            0x00000100
+#define HQV_V_HIPASS_F1_2TAP            0x00500000
+#define HQV_V_HIPASS_F2_2TAP            0x01000000
+#define HQV_H_HIPASS_F1_4TAP            0x00000060
+#define HQV_H_HIPASS_F2_4TAP            0x00000200
+#define HQV_V_HIPASS_F1_4TAP            0x00600000
+#define HQV_V_HIPASS_F2_4TAP            0x02000000
+#define HQV_H_HIPASS_F1_8TAP            0x00000080
+#define HQV_H_HIPASS_F2_8TAP            0x00000400
+#define HQV_V_HIPASS_F1_8TAP            0x00800000
+#define HQV_V_HIPASS_F2_8TAP            0x04000000
+/* IA2 NEW */
+#define HQV_V_FILTER2                   0x00080000
+#define HQV_H_FILTER2                   0x00000008
+#define HQV_H_TAP2_11                   0x00000041
+#define HQV_H_TAP4_121                  0x00000042
+#define HQV_H_TAP4_1111                 0x00000401
+#define HQV_H_TAP8_1331                 0x00000221
+#define HQV_H_TAP8_12221                0x00000402
+#define HQV_H_TAP16_1991                0x00000159
+#define HQV_H_TAP16_141041              0x0000026A
+#define HQV_H_TAP32                     0x0000015A
+#define HQV_V_TAP2_11                   0x00410000
+#define HQV_V_TAP4_121                  0x00420000
+#define HQV_V_TAP4_1111                 0x04010000
+#define HQV_V_TAP8_1331                 0x02210000
+#define HQV_V_TAP8_12221                0x04020000
+#define HQV_V_TAP16_1991                0x01590000
+#define HQV_V_TAP16_141041              0x026A0000
+#define HQV_V_TAP32                     0x015A0000
+#define HQV_V_FILTER_DEFAULT            0x00420000
+#define HQV_H_FILTER_DEFAULT            0x00000040
+
+/* HQV_MINI_CONTROL - 0x3E8 */
+#define HQV_H_MINIFY_ENABLE             0x00000800
+#define HQV_V_MINIFY_ENABLE             0x08000000
+#define HQV_VDEBLOCK_FILTER             0x80000000
+#define HQV_HDEBLOCK_FILTER             0x00008000
+
+#endif // __VIDREGS_H__
diff --git a/Source/DirectFB/gfxdrivers/vmware/Makefile.am b/Source/DirectFB/gfxdrivers/vmware/Makefile.am
new file mode 100755
index 0000000..34c1c38
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/Makefile.am
@@ -0,0 +1,36 @@
+## Makefile.am for DirectFB/src/core/gfxcards/vmware
+
+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
+
+vmware_LTLIBRARIES = libdirectfb_vmware.la
+
+if BUILD_STATIC
+vmware_DATA = $(vmware_LTLIBRARIES:.la=.o)
+endif
+
+vmwaredir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_vmware_la_SOURCES =	\
+	vmware_2d.c		\
+	vmware_2d.h		\
+	vmware_gfxdriver.c	\
+	vmware_gfxdriver.h
+
+libdirectfb_vmware_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS) -lm
+
+libdirectfb_vmware_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/vmware/Makefile.in b/Source/DirectFB/gfxdrivers/vmware/Makefile.in
new file mode 100755
index 0000000..5259e16
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/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/vmware
+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)$(vmwaredir)" "$(DESTDIR)$(vmwaredir)"
+vmwareLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(vmware_LTLIBRARIES)
+libdirectfb_vmware_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_vmware_la_OBJECTS = vmware_2d.lo vmware_gfxdriver.lo
+libdirectfb_vmware_la_OBJECTS = $(am_libdirectfb_vmware_la_OBJECTS)
+libdirectfb_vmware_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_vmware_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_vmware_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_vmware_la_SOURCES)
+vmwareDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(vmware_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
+
+vmware_LTLIBRARIES = libdirectfb_vmware.la
+@BUILD_STATIC_TRUE@vmware_DATA = $(vmware_LTLIBRARIES:.la=.o)
+vmwaredir = $(MODULEDIR)/gfxdrivers
+libdirectfb_vmware_la_SOURCES = \
+	vmware_2d.c		\
+	vmware_2d.h		\
+	vmware_gfxdriver.c	\
+	vmware_gfxdriver.h
+
+libdirectfb_vmware_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS) -lm
+
+libdirectfb_vmware_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/vmware/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  gfxdrivers/vmware/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-vmwareLTLIBRARIES: $(vmware_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(vmwaredir)" || $(MKDIR_P) "$(DESTDIR)$(vmwaredir)"
+	@list='$(vmware_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(vmwareLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(vmwaredir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(vmwareLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(vmwaredir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-vmwareLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(vmware_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(vmwaredir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(vmwaredir)/$$p"; \
+	done
+
+clean-vmwareLTLIBRARIES:
+	-test -z "$(vmware_LTLIBRARIES)" || rm -f $(vmware_LTLIBRARIES)
+	@list='$(vmware_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_vmware.la: $(libdirectfb_vmware_la_OBJECTS) $(libdirectfb_vmware_la_DEPENDENCIES) 
+	$(libdirectfb_vmware_la_LINK) -rpath $(vmwaredir) $(libdirectfb_vmware_la_OBJECTS) $(libdirectfb_vmware_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmware_2d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmware_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-vmwareDATA: $(vmware_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(vmwaredir)" || $(MKDIR_P) "$(DESTDIR)$(vmwaredir)"
+	@list='$(vmware_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(vmwareDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(vmwaredir)/$$f'"; \
+	  $(vmwareDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(vmwaredir)/$$f"; \
+	done
+
+uninstall-vmwareDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(vmware_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(vmwaredir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(vmwaredir)/$$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)$(vmwaredir)" "$(DESTDIR)$(vmwaredir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-vmwareLTLIBRARIES \
+	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-vmwareDATA install-vmwareLTLIBRARIES
+
+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-vmwareDATA uninstall-vmwareLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-vmwareLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip install-vmwareDATA install-vmwareLTLIBRARIES \
+	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-vmwareDATA \
+	uninstall-vmwareLTLIBRARIES
+
+%.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/vmware/vmware_2d.c b/Source/DirectFB/gfxdrivers/vmware/vmware_2d.c
new file mode 100755
index 0000000..1e50978
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/vmware_2d.c
@@ -0,0 +1,402 @@
+/*
+   (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 <config.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <core/state.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include "vmware_2d.h"
+#include "vmware_gfxdriver.h"
+
+
+D_DEBUG_DOMAIN( VMWare_2D, "VMWare/2D", "VMWare 2D Acceleration" );
+
+/*
+ * State validation flags.
+ *
+ * There's no prefix because of the macros below.
+ */
+enum {
+     DESTINATION  = 0x00000001,
+     COLOR        = 0x00000002,
+
+     SOURCE       = 0x00000010,
+
+     ALL          = 0x00000013
+};
+
+/*
+ * State handling macros.
+ */
+
+#define VMWARE_VALIDATE(flags)        do { vdev->v_flags |=  (flags); } while (0)
+#define VMWARE_INVALIDATE(flags)      do { vdev->v_flags &= ~(flags); } while (0)
+
+#define VMWARE_CHECK_VALIDATE(flag)   do {                                           \
+                                           if (! (vdev->v_flags & flag))             \
+                                                vmware_validate_##flag( vdev, state );  \
+                                      } while (0)
+
+
+/**************************************************************************************************/
+
+/*
+ * Called by vmwareSetState() to ensure that the destination registers are properly set
+ * for execution of rendering functions.
+ */
+static inline void
+vmware_validate_DESTINATION( VMWareDeviceData *vdev,
+                             CardState        *state )
+{
+     /* Remember destination parameters for usage in rendering functions. */
+     vdev->dst_addr   = state->dst.addr;
+     vdev->dst_pitch  = state->dst.pitch;
+     vdev->dst_format = state->dst.buffer->format;
+     vdev->dst_bpp    = DFB_BYTES_PER_PIXEL( vdev->dst_format );
+
+     /* Set the flag. */
+     VMWARE_VALIDATE( DESTINATION );
+}
+
+/*
+ * Called by vmwareSetState() to ensure that the color register is properly set
+ * for execution of rendering functions.
+ */
+static inline void
+vmware_validate_COLOR( VMWareDeviceData *vdev,
+                       CardState        *state )
+{
+     switch (vdev->dst_format) {
+          case DSPF_ARGB:
+               vdev->color_pixel = PIXEL_ARGB( state->color.a,
+                                               state->color.r,
+                                               state->color.g,
+                                               state->color.b );
+               break;
+
+          case DSPF_RGB32:
+               vdev->color_pixel = PIXEL_RGB32( state->color.r,
+                                                state->color.g,
+                                                state->color.b );
+               break;
+
+          case DSPF_RGB16:
+               vdev->color_pixel = PIXEL_RGB16( state->color.r,
+                                                state->color.g,
+                                                state->color.b );
+               break;
+
+          default:
+               D_BUG( "unexpected format %s", dfb_pixelformat_name(vdev->dst_format) );
+     }
+
+     /* Set the flag. */
+     VMWARE_VALIDATE( COLOR );
+}
+
+/*
+ * Called by vmwareSetState() to ensure that the source registers are properly set
+ * for execution of blitting functions.
+ */
+static inline void
+vmware_validate_SOURCE( VMWareDeviceData *vdev,
+                        CardState        *state )
+{
+     /* Remember source parameters for usage in rendering functions. */
+     vdev->src_addr   = state->src.addr;
+     vdev->src_pitch  = state->src.pitch;
+     vdev->src_format = state->src.buffer->format;
+     vdev->src_bpp    = DFB_BYTES_PER_PIXEL( vdev->src_format );
+
+     /* Set the flag. */
+     VMWARE_VALIDATE( SOURCE );
+}
+
+/**************************************************************************************************/
+
+/*
+ * 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
+vmwareEngineSync( void *drv, void *dev )
+{
+     return DFB_OK;
+}
+
+/*
+ * Reset the graphics engine.
+ */
+void
+vmwareEngineReset( void *drv, void *dev )
+{
+}
+
+/*
+ * 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
+vmwareEmitCommands( void *drv, void *dev )
+{
+}
+
+/*
+ * Check for acceleration of 'accel' using the given 'state'.
+ */
+void
+vmwareCheckState( void                *drv,
+                  void                *dev,
+                  CardState           *state,
+                  DFBAccelerationMask  accel )
+{
+     D_DEBUG_AT( VMWare_2D, "vmwareCheckState (state %p, accel 0x%08x) <- dest %p\n",
+                 state, accel, state->destination );
+
+     /* Return if the desired function is not supported at all. */
+     if (accel & ~(VMWARE_SUPPORTED_DRAWINGFUNCTIONS | VMWARE_SUPPORTED_BLITTINGFUNCTIONS))
+          return;
+
+     /* Return if the destination format is not supported. */
+     switch (state->destination->config.format) {
+          case DSPF_ARGB:
+          case DSPF_RGB32:
+          case DSPF_RGB16:
+               break;
+
+          default:
+               return;
+     }
+
+     /* Check if drawing or blitting is requested. */
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* Return if unsupported drawing flags are set. */
+          if (state->drawingflags & ~VMWARE_SUPPORTED_DRAWINGFLAGS)
+               return;
+     }
+     else {
+          /* Return if the source format is not supported. */
+          switch (state->source->config.format) {
+               case DSPF_ARGB:
+               case DSPF_RGB32:
+               case DSPF_RGB16:
+                    /* FIXME: Currently only copying blits supported. */
+                    if (state->source->config.format == state->destination->config.format)
+                         break;
+
+               default:
+                    return;
+          }
+
+          /* Return if unsupported blitting flags are set. */
+          if (state->blittingflags & ~VMWARE_SUPPORTED_BLITTINGFLAGS)
+               return;
+     }
+
+     /* Enable acceleration of the function. */
+     state->accel |= accel;
+}
+
+/*
+ * Make sure that the hardware is programmed for execution of 'accel' according to the 'state'.
+ */
+void
+vmwareSetState( void                *drv,
+                void                *dev,
+                GraphicsDeviceFuncs *funcs,
+                CardState           *state,
+                DFBAccelerationMask  accel )
+{
+     VMWareDeviceData       *vdev     = (VMWareDeviceData*) dev;
+     StateModificationFlags  modified = state->mod_hw;
+
+     D_DEBUG_AT( VMWare_2D, "vmwareSetState (state %p, accel 0x%08x) <- dest %p, modified 0x%08x\n",
+                 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) {
+          VMWARE_INVALIDATE( ALL );
+     }
+     else if (modified) {
+          /* Invalidate destination registers. */
+          if (modified & SMF_DESTINATION)
+               VMWARE_INVALIDATE( DESTINATION | COLOR );
+          else if (modified & SMF_COLOR)
+               VMWARE_INVALIDATE( COLOR );
+
+          if (modified & SMF_SOURCE)
+               VMWARE_INVALIDATE( SOURCE );
+     }
+
+     /*
+      * 2) Validate hardware states
+      *
+      * Each function has its own set of states that need to be validated.
+      */
+
+     /* Always requiring valid destination... */
+     VMWARE_CHECK_VALIDATE( DESTINATION );
+
+     /* Depending on the function... */
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+               /* ...require valid drawing color. */
+               VMWARE_CHECK_VALIDATE( COLOR );
+
+               /*
+                * 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 = VMWARE_SUPPORTED_DRAWINGFUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+               /* ...require valid source. */
+               VMWARE_CHECK_VALIDATE( SOURCE );
+
+               /*
+                * 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 = VMWARE_SUPPORTED_BLITTINGFUNCTIONS;
+               break;
+
+          default:
+               D_BUG( "unexpected drawing/blitting function" );
+               break;
+     }
+
+     /*
+      * 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
+vmwareFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     VMWareDeviceData *vdev = (VMWareDeviceData*) dev;
+     void             *addr = vdev->dst_addr + rect->y * vdev->dst_pitch +
+                              DFB_BYTES_PER_LINE(vdev->dst_format, rect->x);
+
+     D_DEBUG_AT( VMWare_2D, "%s( %d,%d-%dx%d )\n", __FUNCTION__, DFB_RECTANGLE_VALS( rect ) );
+
+     switch (vdev->dst_bpp) {
+          case 4:
+               while (rect->h--) {
+                    int  w   = rect->w;
+                    u32 *dst = addr;
+
+                    while (w--)
+                         *dst++ = vdev->color_pixel;
+
+                    addr += vdev->dst_pitch;
+               }
+               break;
+
+          case 2:
+               while (rect->h--) {
+                    int  w   = rect->w;
+                    u16 *dst = addr;
+
+                    while (w--)
+                         *dst++ = vdev->color_pixel;
+
+                    addr += vdev->dst_pitch;
+               }
+               break;
+
+          case 1:
+               while (rect->h--) {
+                    int  w   = rect->w;
+                    u8  *dst = addr;
+
+                    while (w--)
+                         *dst++ = vdev->color_pixel;
+
+                    addr += vdev->dst_pitch;
+               }
+               break;
+     }
+
+     return true;
+}
+
+/*
+ * Render a filled rectangle using the current hardware state.
+ */
+bool
+vmwareBlit( void *drv, void *dev, DFBRectangle *srect, int dx, int dy )
+{
+     VMWareDeviceData *vdev = (VMWareDeviceData*) dev;
+     void             *dst  = vdev->dst_addr + dy * vdev->dst_pitch +
+                              DFB_BYTES_PER_LINE(vdev->dst_format, dx);
+     void             *src  = vdev->src_addr + srect->y * vdev->src_pitch +
+                              DFB_BYTES_PER_LINE(vdev->src_format, srect->x);
+
+     D_DEBUG_AT( VMWare_2D, "%s( %d,%d-%dx%d -> %d, %d )\n", __FUNCTION__,
+                 DFB_RECTANGLE_VALS( srect ), dx, dy );
+
+     while (srect->h--) {
+          direct_memcpy( dst, src, srect->w * vdev->dst_bpp );
+
+          dst += vdev->dst_pitch;
+          src += vdev->src_pitch;
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/gfxdrivers/vmware/vmware_2d.h b/Source/DirectFB/gfxdrivers/vmware/vmware_2d.h
new file mode 100755
index 0000000..95be709
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/vmware_2d.h
@@ -0,0 +1,67 @@
+/*
+   (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 __VMWARE_2D_H__
+#define __VMWARE_2D_H__
+
+
+#define VMWARE_SUPPORTED_DRAWINGFLAGS      (DSDRAW_NOFX)
+
+#define VMWARE_SUPPORTED_DRAWINGFUNCTIONS  (DFXL_FILLRECTANGLE)
+
+#define VMWARE_SUPPORTED_BLITTINGFLAGS     (DSBLIT_NOFX)
+
+#define VMWARE_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT)
+
+
+DFBResult vmwareEngineSync   ( void                *drv,
+                               void                *dev );
+
+void      vmwareEngineReset  ( void                *drv,
+                               void                *dev );
+
+void      vmwareEmitCommands ( void                *drv,
+                               void                *dev );
+
+void      vmwareCheckState   ( void                *drv,
+                               void                *dev,
+                               CardState           *state,
+                               DFBAccelerationMask  accel );
+
+void      vmwareSetState     ( void                *drv,
+                               void                *dev,
+                               GraphicsDeviceFuncs *funcs,
+                               CardState           *state,
+                               DFBAccelerationMask  accel );
+
+bool      vmwareFillRectangle( void                *drv,
+                               void                *dev,
+                               DFBRectangle        *rect );
+
+bool      vmwareBlit         ( void                *drv,
+                               void                *dev,
+                               DFBRectangle        *srect,
+                               int                  dx,
+                               int                  dy );
+
+#endif
+
diff --git a/Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.c b/Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.c
new file mode 100755
index 0000000..ee39561
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.c
@@ -0,0 +1,128 @@
+/*
+   (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 <stdio.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+#include <core/gfxcard.h>
+
+#include "vmware_2d.h"
+#include "vmware_gfxdriver.h"
+
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( vmware )
+
+
+/**********************************************************************************************************************/
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     switch (dfb_gfxcard_get_accelerator( device )) {
+          case FB_ACCEL_VMWARE_BLITTER:
+               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,
+               "VMWare Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "Denis Oliver Kropp" );
+
+     info->version.major = 0;
+     info->version.minor = 0;
+
+     info->driver_data_size = sizeof(VMWareDriverData);
+     info->device_data_size = sizeof(VMWareDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     /* initialize function pointers */
+     funcs->EngineSync    = vmwareEngineSync;
+     funcs->EngineReset   = vmwareEngineReset;
+     funcs->EmitCommands  = vmwareEmitCommands;
+     funcs->CheckState    = vmwareCheckState;
+     funcs->SetState      = vmwareSetState;
+     funcs->FillRectangle = vmwareFillRectangle;
+     funcs->Blit          = vmwareBlit;
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     /* fill device info */
+     snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "VMWare" );
+     snprintf( device_info->name,   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,   "(fake) Blitter" );
+
+     /* device limitations */
+     device_info->limits.surface_byteoffset_alignment = 8;
+     device_info->limits.surface_bytepitch_alignment  = 8;
+
+     device_info->caps.flags    = 0;
+     device_info->caps.accel    = VMWARE_SUPPORTED_DRAWINGFUNCTIONS |
+                                  VMWARE_SUPPORTED_BLITTINGFUNCTIONS;
+     device_info->caps.drawing  = VMWARE_SUPPORTED_DRAWINGFLAGS;
+     device_info->caps.blitting = VMWARE_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/vmware/vmware_gfxdriver.h b/Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.h
new file mode 100755
index 0000000..3e747bf
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/vmware/vmware_gfxdriver.h
@@ -0,0 +1,58 @@
+/*
+   (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 __VMWARE_GFXDRIVER_H__
+#define __VMWARE_GFXDRIVER_H__
+
+#ifndef FB_ACCEL_VMWARE_BLITTER
+#define FB_ACCEL_VMWARE_BLITTER 51
+#endif
+
+
+typedef struct {
+     /* validation flags */
+     int                    v_flags;
+
+     /* cached/computed values */
+     void                  *dst_addr;
+     unsigned long          dst_pitch;
+     DFBSurfacePixelFormat  dst_format;
+     unsigned long          dst_bpp;
+
+     void                  *src_addr;
+     unsigned long          src_pitch;
+     DFBSurfacePixelFormat  src_format;
+     unsigned long          src_bpp;
+
+     unsigned long          color_pixel;
+
+     /** Add shared data here... **/
+} VMWareDeviceData;
+
+
+typedef struct {
+
+     /** Add local data here... **/
+} VMWareDriverData;
+
+
+#endif
diff --git a/Source/DirectFB/include/Makefile.am b/Source/DirectFB/include/Makefile.am
new file mode 100755
index 0000000..94b0162
--- /dev/null
+++ b/Source/DirectFB/include/Makefile.am
@@ -0,0 +1,119 @@
+## Makefile.am for DirectFB/include
+
+includedir = @INCLUDEDIR@
+
+DISTCLEANFILES = directfb_keynames.h directfb_strings.h
+
+include_HEADERS = \
+	directfb.h		\
+	directfb_keyboard.h	\
+	directfb_keynames.h	\
+	directfb_strings.h	\
+	directfb_util.h		\
+	directfb_version.h	\
+	directfbgl.h		\
+	dfb_types.h		\
+	dfiff.h			\
+	dgiff.h
+
+MKNAMES = $(top_srcdir)/tools/mknames.sh
+INCP = $(srcdir)
+
+distclean-local:
+	rm -f directfb_keynames.h directfb_strings.h
+
+directfb_keynames.h: directfb_keyboard.h $(MKNAMES) Makefile
+	@echo '#ifndef __DIRECTFB_KEYNAMES_H__' > $@
+	@echo '#define __DIRECTFB_KEYNAMES_H__' >> $@
+
+	$(MKNAMES) DFBInputDeviceKeySymbol DIKS NULL KeySymbol symbol $(INCP)/directfb_keyboard.h \
+	   | grep -v DIKS_ENTER >> $@
+
+	$(MKNAMES) DFBInputDeviceKeyIdentifier DIKI UNKNOWN KeyIdentifier identifier $(INCP)/directfb_keyboard.h \
+	   | grep -v DIKI_NUMBER_OF_KEYS | grep -v DIKI_KEYDEF_END >> $@
+
+	@echo '' >> $@
+	@echo '#endif' >> $@
+
+
+directfb_strings.h: directfb.h $(MKNAMES) Makefile
+	@echo '#ifndef __DIRECTFB_STRINGS_H__' > $@
+	@echo '#define __DIRECTFB_STRINGS_H__' >> $@
+
+	$(MKNAMES) DFBSurfacePixelFormat DSPF UNKNOWN PixelFormat format $(INCP)/directfb.h >> $@
+
+	$(MKNAMES) DFBInputDeviceTypeFlags DIDTF NONE InputDeviceTypeFlags type $(INCP)/directfb.h \
+	   | grep -v DIDTF_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceDrawingFlags DSDRAW NOFX SurfaceDrawingFlags flag $(INCP)/directfb.h \
+	   | grep -v DSDRAW_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceBlittingFlags DSBLIT NOFX SurfaceBlittingFlags flag $(INCP)/directfb.h \
+	   | grep -v DSBLIT_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceBlendFunction DSBF UNKNOWN SurfaceBlendFunction function $(INCP)/directfb.h \
+	   >> $@
+
+	@echo FIXME: Use DIMCAPS prefix for DFBImageCapabilities
+	$(MKNAMES) DFBInputDeviceCapabilities DICAPS NONE InputDeviceCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DICAPS_ALL | grep -v DICAPS_ALPHACHANNEL | grep -v DICAPS_COLORKEY >> $@
+
+	$(MKNAMES) DFBDisplayLayerTypeFlags DLTF NONE DisplayLayerTypeFlags type $(INCP)/directfb.h \
+	   | grep -v DLTF_ALL >> $@
+
+	$(MKNAMES) DFBDisplayLayerCapabilities DLCAPS NONE DisplayLayerCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DLCAPS_ALL >> $@
+
+	$(MKNAMES) DFBDisplayLayerBufferMode DLBM UNKNOWN DisplayLayerBufferMode mode $(INCP)/directfb.h \
+	   | grep -v DLBM_DONTCARE | grep -v DLBM_COLOR | grep -v DLBM_IMAGE | grep -v DLBM_TILE >> $@
+
+	$(MKNAMES) DFBWindowCapabilities DWCAPS NONE WindowCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DWCAPS_ALL >> $@
+
+	$(MKNAMES) DFBWindowOptions DWOP NONE WindowOptions option $(INCP)/directfb.h \
+	   | grep -v DWOP_ALL >> $@
+
+	$(MKNAMES) DFBScreenCapabilities DSCCAPS NONE ScreenCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSCCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderCapabilities DSECAPS NONE ScreenEncoderCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSECAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderType DSET UNKNOWN ScreenEncoderType type $(INCP)/directfb.h \
+	   | grep -v DSET_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderTVStandards DSETV UNKNOWN ScreenEncoderTVStandards standard $(INCP)/directfb.h \
+	   | grep -v DSETV_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputCapabilities DSOCAPS NONE ScreenOutputCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSOCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputConnectors DSOC UNKNOWN ScreenOutputConnectors connector $(INCP)/directfb.h \
+	   | grep -v DSOC_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputSignals DSOS NONE ScreenOutputSignals signal $(INCP)/directfb.h \
+	   | grep -v DSOS_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputSlowBlankingSignals DSOSB OFF ScreenOutputSlowBlankingSignals slow_signal $(INCP)/directfb.h \
+	   | grep -v DSOSB_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputResolution DSOR UNKNOWN ScreenOutputResolution resolution $(INCP)/directfb.h \
+	   | grep -v DSOR_ALL >> $@
+
+	$(MKNAMES) DFBScreenMixerCapabilities DSMCAPS NONE ScreenMixerCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSMCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenMixerTree DSMT UNKNOWN ScreenMixerTree tree $(INCP)/directfb.h \
+	   | grep -v DSMT_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderTestPicture DSETP OFF ScreenEncoderTestPicture test_picture $(INCP)/directfb.h \
+	   | grep -v DSETP_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderScanMode DSESM UNKNOWN ScreenEncoderScanMode scan_mode $(INCP)/directfb.h \
+	   | grep -v DSESM_ALL >> $@
+
+	$(MKNAMES) DFBAccelerationMask DFXL NONE AccelerationMask mask $(INCP)/directfb.h \
+	   | grep -v DFXL_ALL >> $@
+
+	@echo '' >> $@
+	@echo '#endif' >> $@
diff --git a/Source/DirectFB/include/Makefile.in b/Source/DirectFB/include/Makefile.in
new file mode 100755
index 0000000..3313a6b
--- /dev/null
+++ b/Source/DirectFB/include/Makefile.in
@@ -0,0 +1,590 @@
+# 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@
+subdir = include
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/directfb_version.h.in
+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 = directfb_version.h
+SOURCES =
+DIST_SOURCES =
+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)$(includedir)"
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+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@
+DISTCLEANFILES = directfb_keynames.h directfb_strings.h
+include_HEADERS = \
+	directfb.h		\
+	directfb_keyboard.h	\
+	directfb_keynames.h	\
+	directfb_strings.h	\
+	directfb_util.h		\
+	directfb_version.h	\
+	directfbgl.h		\
+	dfb_types.h		\
+	dfiff.h			\
+	dgiff.h
+
+MKNAMES = $(top_srcdir)/tools/mknames.sh
+INCP = $(srcdir)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  include/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
+directfb_version.h: $(top_builddir)/config.status $(srcdir)/directfb_version.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$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 $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(includedir)"; 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)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-generic \
+	distclean-libtool distclean-local 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-includeHEADERS 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-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
+
+
+distclean-local:
+	rm -f directfb_keynames.h directfb_strings.h
+
+directfb_keynames.h: directfb_keyboard.h $(MKNAMES) Makefile
+	@echo '#ifndef __DIRECTFB_KEYNAMES_H__' > $@
+	@echo '#define __DIRECTFB_KEYNAMES_H__' >> $@
+
+	$(MKNAMES) DFBInputDeviceKeySymbol DIKS NULL KeySymbol symbol $(INCP)/directfb_keyboard.h \
+	   | grep -v DIKS_ENTER >> $@
+
+	$(MKNAMES) DFBInputDeviceKeyIdentifier DIKI UNKNOWN KeyIdentifier identifier $(INCP)/directfb_keyboard.h \
+	   | grep -v DIKI_NUMBER_OF_KEYS | grep -v DIKI_KEYDEF_END >> $@
+
+	@echo '' >> $@
+	@echo '#endif' >> $@
+
+directfb_strings.h: directfb.h $(MKNAMES) Makefile
+	@echo '#ifndef __DIRECTFB_STRINGS_H__' > $@
+	@echo '#define __DIRECTFB_STRINGS_H__' >> $@
+
+	$(MKNAMES) DFBSurfacePixelFormat DSPF UNKNOWN PixelFormat format $(INCP)/directfb.h >> $@
+
+	$(MKNAMES) DFBInputDeviceTypeFlags DIDTF NONE InputDeviceTypeFlags type $(INCP)/directfb.h \
+	   | grep -v DIDTF_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceDrawingFlags DSDRAW NOFX SurfaceDrawingFlags flag $(INCP)/directfb.h \
+	   | grep -v DSDRAW_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceBlittingFlags DSBLIT NOFX SurfaceBlittingFlags flag $(INCP)/directfb.h \
+	   | grep -v DSBLIT_ALL >> $@
+
+	$(MKNAMES) DFBSurfaceBlendFunction DSBF UNKNOWN SurfaceBlendFunction function $(INCP)/directfb.h \
+	   >> $@
+
+	@echo FIXME: Use DIMCAPS prefix for DFBImageCapabilities
+	$(MKNAMES) DFBInputDeviceCapabilities DICAPS NONE InputDeviceCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DICAPS_ALL | grep -v DICAPS_ALPHACHANNEL | grep -v DICAPS_COLORKEY >> $@
+
+	$(MKNAMES) DFBDisplayLayerTypeFlags DLTF NONE DisplayLayerTypeFlags type $(INCP)/directfb.h \
+	   | grep -v DLTF_ALL >> $@
+
+	$(MKNAMES) DFBDisplayLayerCapabilities DLCAPS NONE DisplayLayerCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DLCAPS_ALL >> $@
+
+	$(MKNAMES) DFBDisplayLayerBufferMode DLBM UNKNOWN DisplayLayerBufferMode mode $(INCP)/directfb.h \
+	   | grep -v DLBM_DONTCARE | grep -v DLBM_COLOR | grep -v DLBM_IMAGE | grep -v DLBM_TILE >> $@
+
+	$(MKNAMES) DFBWindowCapabilities DWCAPS NONE WindowCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DWCAPS_ALL >> $@
+
+	$(MKNAMES) DFBWindowOptions DWOP NONE WindowOptions option $(INCP)/directfb.h \
+	   | grep -v DWOP_ALL >> $@
+
+	$(MKNAMES) DFBScreenCapabilities DSCCAPS NONE ScreenCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSCCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderCapabilities DSECAPS NONE ScreenEncoderCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSECAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderType DSET UNKNOWN ScreenEncoderType type $(INCP)/directfb.h \
+	   | grep -v DSET_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderTVStandards DSETV UNKNOWN ScreenEncoderTVStandards standard $(INCP)/directfb.h \
+	   | grep -v DSETV_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputCapabilities DSOCAPS NONE ScreenOutputCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSOCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputConnectors DSOC UNKNOWN ScreenOutputConnectors connector $(INCP)/directfb.h \
+	   | grep -v DSOC_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputSignals DSOS NONE ScreenOutputSignals signal $(INCP)/directfb.h \
+	   | grep -v DSOS_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputSlowBlankingSignals DSOSB OFF ScreenOutputSlowBlankingSignals slow_signal $(INCP)/directfb.h \
+	   | grep -v DSOSB_ALL >> $@
+
+	$(MKNAMES) DFBScreenOutputResolution DSOR UNKNOWN ScreenOutputResolution resolution $(INCP)/directfb.h \
+	   | grep -v DSOR_ALL >> $@
+
+	$(MKNAMES) DFBScreenMixerCapabilities DSMCAPS NONE ScreenMixerCapabilities capability $(INCP)/directfb.h \
+	   | grep -v DSMCAPS_ALL >> $@
+
+	$(MKNAMES) DFBScreenMixerTree DSMT UNKNOWN ScreenMixerTree tree $(INCP)/directfb.h \
+	   | grep -v DSMT_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderTestPicture DSETP OFF ScreenEncoderTestPicture test_picture $(INCP)/directfb.h \
+	   | grep -v DSETP_ALL >> $@
+
+	$(MKNAMES) DFBScreenEncoderScanMode DSESM UNKNOWN ScreenEncoderScanMode scan_mode $(INCP)/directfb.h \
+	   | grep -v DSESM_ALL >> $@
+
+	$(MKNAMES) DFBAccelerationMask DFXL NONE AccelerationMask mask $(INCP)/directfb.h \
+	   | grep -v DFXL_ALL >> $@
+
+	@echo '' >> $@
+	@echo '#endif' >> $@
+# 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/include/dfb_types.h b/Source/DirectFB/include/dfb_types.h
new file mode 100755
index 0000000..8ebd04f
--- /dev/null
+++ b/Source/DirectFB/include/dfb_types.h
@@ -0,0 +1,46 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB_TYPES_H__
+#define __DFB_TYPES_H__
+
+#include <direct/types.h>
+
+
+#ifdef DIRECTFB_ENABLE_DEPRECATED
+#define __u8   u8
+#define __u16  u16
+#define __u32  u32
+#define __u64  u64
+#define __s8   s8
+#define __s16  s16
+#define __s32  s32
+#define __s64  s64
+#endif
+
+#endif
diff --git a/Source/DirectFB/include/dfiff.h b/Source/DirectFB/include/dfiff.h
new file mode 100755
index 0000000..bcacaf3
--- /dev/null
+++ b/Source/DirectFB/include/dfiff.h
@@ -0,0 +1,60 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __DFIFF_H__
+#define __DFIFF_H__
+
+#include <inttypes.h>
+
+#define DFIFF_FLAG_LITTLE_ENDIAN   0x01
+
+typedef struct {
+     unsigned char magic[5];      /* "DFIFF" magic */
+
+     unsigned char major;         /* Major version number */
+     unsigned char minor;         /* Minor version number */
+
+     unsigned char flags;         /* Some flags like endianess */
+
+     /* From now on endianess matters... */
+
+     uint32_t                 width;
+     uint32_t                 height;
+     DFBSurfacePixelFormat    format;
+     uint32_t                 pitch;
+} DFIFFHeader;
+
+
+#endif
+
diff --git a/Source/DirectFB/include/dgiff.h b/Source/DirectFB/include/dgiff.h
new file mode 100755
index 0000000..103d7f2
--- /dev/null
+++ b/Source/DirectFB/include/dgiff.h
@@ -0,0 +1,101 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __DGIFF_H__
+#define __DGIFF_H__
+
+#include <inttypes.h>
+
+#define DGIFF_FLAG_LITTLE_ENDIAN   0x01
+
+typedef struct {
+     unsigned char  magic[5];      /* "DGIFF" magic */
+
+     unsigned char  major;         /* Major version number */
+     unsigned char  minor;         /* Minor version number */
+
+     unsigned char  flags;         /* Some flags like endianess */
+
+     /* From now on endianess matters... */
+
+     uint32_t       num_faces;
+
+     uint32_t       __pad;
+} DGIFFHeader;
+
+typedef struct {
+     int32_t        next_face;     /* byte offset from this to next face */
+
+     int32_t        size;
+
+     int32_t        ascender;
+     int32_t        descender;
+     int32_t        height;
+
+     int32_t        max_advance;
+
+     uint32_t       pixelformat;
+
+     uint32_t       num_glyphs;
+     uint32_t       num_rows;
+
+     DFBSurfaceBlittingFlags blittingflags;
+} DGIFFFaceHeader;
+
+typedef struct {
+     uint32_t       unicode;
+
+     uint32_t       row;
+
+     int32_t        offset;
+     int32_t        width;
+     int32_t        height;
+
+     int32_t        left;
+     int32_t        top;
+     int32_t        advance;
+} DGIFFGlyphInfo;
+
+typedef struct {
+     int32_t        width;
+     int32_t        height;
+     int32_t        pitch;         /* Preferably 8 byte aligned */
+
+     uint32_t       __pad;
+
+     /* Raw pixel data follows, "height * pitch" bytes. */
+} DGIFFGlyphRow;
+
+#endif
+
diff --git a/Source/DirectFB/include/directfb.h b/Source/DirectFB/include/directfb.h
new file mode 100755
index 0000000..6f494d9
--- /dev/null
+++ b/Source/DirectFB/include/directfb.h
@@ -0,0 +1,6642 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_H__
+#define __DIRECTFB_H__
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <dfb_types.h>
+#include <sys/time.h> /* struct timeval */
+
+#include <directfb_keyboard.h>
+
+#include <direct/interface.h>
+
+/*
+ * Version handling.
+ */
+extern const unsigned int directfb_major_version;
+extern const unsigned int directfb_minor_version;
+extern const unsigned int directfb_micro_version;
+extern const unsigned int directfb_binary_age;
+extern const unsigned int directfb_interface_age;
+
+/*
+ * Check for a certain DirectFB version.
+ * In case of an error a message is returned describing the mismatch.
+ */
+const char * DirectFBCheckVersion( unsigned int required_major,
+                                   unsigned int required_minor,
+                                   unsigned int required_micro );
+
+
+/*
+ * Main interface of DirectFB, created by DirectFBCreate().
+ */
+DECLARE_INTERFACE( IDirectFB )
+
+/*
+ * Interface to a surface object, being a graphics context for rendering and state control,
+ * buffer operations, palette access and sub area translate'n'clip logic.
+ */
+DECLARE_INTERFACE( IDirectFBSurface )
+
+/*
+ * Interface for read/write access to the colors of a palette object and for cloning it.
+ */
+DECLARE_INTERFACE( IDirectFBPalette )
+
+/*
+ * Input device interface for keymap access, event buffers and state queries.
+ */
+DECLARE_INTERFACE( IDirectFBInputDevice )
+
+/*
+ * Layer interface for configuration, window stack usage or direct surface access, with shared/exclusive context.
+ */
+DECLARE_INTERFACE( IDirectFBDisplayLayer )
+
+/*
+ * Interface to a window object, controlling appearance and focus, positioning and stacking,
+ * event buffers and surface access.
+ */
+DECLARE_INTERFACE( IDirectFBWindow )
+
+/*
+ * Interface to a local event buffer to send/receive events, wait for events, abort waiting or reset buffer.
+ */
+DECLARE_INTERFACE( IDirectFBEventBuffer )
+
+/*
+ * Font interface for getting metrics, measuring strings or single characters, query/choose encodings.
+ */
+DECLARE_INTERFACE( IDirectFBFont )
+
+/*
+ * Interface to an image provider, retrieving information about the image and rendering it to a surface.
+ */
+DECLARE_INTERFACE( IDirectFBImageProvider )
+
+/*
+ * Interface to a video provider for playback with advanced control and basic stream information.
+ */
+DECLARE_INTERFACE( IDirectFBVideoProvider )
+
+/*
+ * Data buffer interface, providing unified access to different kinds of data storage and live feed.
+ */
+DECLARE_INTERFACE( IDirectFBDataBuffer )
+
+/*
+ * Interface to different display outputs, encoders, connector settings, power management and synchronization.
+ */
+DECLARE_INTERFACE( IDirectFBScreen )
+
+/*
+ * OpenGL context of a surface.
+ */
+DECLARE_INTERFACE( IDirectFBGL )
+
+
+/*
+ * Return code of all interface methods and most functions
+ *
+ * Whenever a method has to return any information, it is done via output parameters. These are pointers to
+ * primitive types such as <i>int *ret_num</i>, enumerated types like <i>DFBBoolean *ret_enabled</i>, structures
+ * as in <i>DFBDisplayLayerConfig *ret_config</i>, just <i>void **ret_data</i> or other types...
+ */
+typedef enum {
+     /*
+      * Aliases for backward compatibility and uniform look in DirectFB code
+      */
+     DFB_OK              = DR_OK,                 /* No error occured. */
+     DFB_FAILURE         = DR_FAILURE,            /* A general or unknown error occured. */
+     DFB_INIT            = DR_INIT,               /* A general initialization error occured. */
+     DFB_BUG             = DR_BUG,                /* Internal bug or inconsistency has been detected. */
+     DFB_DEAD            = DR_DEAD,               /* Interface has a zero reference counter (available in debug mode). */
+     DFB_UNSUPPORTED     = DR_UNSUPPORTED,        /* The requested operation or an argument is (currently) not supported. */
+     DFB_UNIMPLEMENTED   = DR_UNIMPLEMENTED,      /* The requested operation is not implemented, yet. */
+     DFB_ACCESSDENIED    = DR_ACCESSDENIED,       /* Access to the resource is denied. */
+     DFB_INVAREA         = DR_INVAREA,            /* An invalid area has been specified or detected. */
+     DFB_INVARG          = DR_INVARG,             /* An invalid argument has been specified. */
+     DFB_NOSYSTEMMEMORY  = DR_NOLOCALMEMORY,      /* There's not enough system memory. */
+     DFB_NOSHAREDMEMORY  = DR_NOSHAREDMEMORY,     /* There's not enough shared memory. */
+     DFB_LOCKED          = DR_LOCKED,             /* The resource is (already) locked. */
+     DFB_BUFFEREMPTY     = DR_BUFFEREMPTY,        /* The buffer is empty. */
+     DFB_FILENOTFOUND    = DR_FILENOTFOUND,       /* The specified file has not been found. */
+     DFB_IO              = DR_IO,                 /* A general I/O error occured. */
+     DFB_BUSY            = DR_BUSY,               /* The resource or device is busy. */
+     DFB_NOIMPL          = DR_NOIMPL,             /* No implementation for this interface or content type has been found. */
+     DFB_TIMEOUT         = DR_TIMEOUT,            /* The operation timed out. */
+     DFB_THIZNULL        = DR_THIZNULL,           /* 'thiz' pointer is NULL. */
+     DFB_IDNOTFOUND      = DR_IDNOTFOUND,         /* No resource has been found by the specified id. */
+     DFB_DESTROYED       = DR_DESTROYED,          /* The underlying object (e.g. a window or surface) has been destroyed. */
+     DFB_FUSION          = DR_FUSION,             /* Internal fusion error detected, most likely related to IPC resources. */
+     DFB_BUFFERTOOLARGE  = DR_BUFFERTOOLARGE,     /* Buffer is too large. */
+     DFB_INTERRUPTED     = DR_INTERRUPTED,        /* The operation has been interrupted. */
+     DFB_NOCONTEXT       = DR_NOCONTEXT,          /* No context available. */
+     DFB_TEMPUNAVAIL     = DR_TEMPUNAVAIL,        /* Temporarily unavailable. */
+     DFB_LIMITEXCEEDED   = DR_LIMITEXCEEDED,      /* Attempted to exceed limit, i.e. any kind of maximum size, count etc. */
+     DFB_NOSUCHMETHOD    = DR_NOSUCHMETHOD,       /* Requested method is not known, e.g. to remote site. */
+     DFB_NOSUCHINSTANCE  = DR_NOSUCHINSTANCE,     /* Requested instance is not known, e.g. to remote site. */
+     DFB_ITEMNOTFOUND    = DR_ITEMNOTFOUND,       /* No such item found. */
+     DFB_VERSIONMISMATCH = DR_VERSIONMISMATCH,    /* Some versions didn't match. */
+     DFB_EOF             = DR_EOF,                /* Reached end of file. */
+     DFB_SUSPENDED       = DR_SUSPENDED,          /* The requested object is suspended. */
+     DFB_INCOMPLETE      = DR_INCOMPLETE,         /* The operation has been executed, but not completely. */
+     DFB_NOCORE          = DR_NOCORE,             /* Core part not available. */
+
+     /*
+      * DirectFB specific result codes starting at (after) this offset
+      */
+     DFB__RESULT_OFFSET  = D_RESULT_TYPE_BASE( 'D','F','B' ),
+
+     DFB_NOVIDEOMEMORY,  /* There's not enough video memory. */
+     DFB_MISSINGFONT,    /* No font has been set. */
+     DFB_MISSINGIMAGE,   /* No image has been set. */
+} DFBResult;
+
+/*
+ * A boolean.
+ */
+typedef enum {
+     DFB_FALSE = 0,
+     DFB_TRUE  = !DFB_FALSE
+} DFBBoolean;
+
+/*
+ * A point specified by x/y coordinates.
+ */
+typedef struct {
+     int            x;   /* X coordinate of it */
+     int            y;   /* Y coordinate of it */
+} DFBPoint;
+
+/*
+ * A horizontal line specified by x and width.
+ */
+typedef struct {
+     int            x;   /* X coordinate */
+     int            w;   /* width of span */
+} DFBSpan;
+
+/*
+ * A dimension specified by width and height.
+ */
+typedef struct {
+     int            w;   /* width of it */
+     int            h;   /* height of it */
+} DFBDimension;
+
+/*
+ * A rectangle specified by a point and a dimension.
+ */
+typedef struct {
+     int            x;   /* X coordinate of its top-left point */
+     int            y;   /* Y coordinate of its top-left point */
+     int            w;   /* width of it */
+     int            h;   /* height of it */
+} DFBRectangle;
+
+/*
+ * A rectangle specified by normalized coordinates.
+ *
+ * E.g. using 0.0, 0.0, 1.0, 1.0 would specify the whole screen.
+ */
+typedef struct {
+     float          x;   /* normalized X coordinate */
+     float          y;   /* normalized Y coordinate */
+     float          w;   /* normalized width */
+     float          h;   /* normalized height */
+} DFBLocation;
+
+/*
+ * A region specified by two points.
+ *
+ * The defined region includes both endpoints.
+ */
+typedef struct {
+     int            x1;  /* X coordinate of top-left point */
+     int            y1;  /* Y coordinate of top-left point */
+     int            x2;  /* X coordinate of lower-right point */
+     int            y2;  /* Y coordinate of lower-right point */
+} DFBRegion;
+
+/*
+ * Insets specify a distance from each edge of a rectangle.
+ *
+ * Positive values always mean 'outside'.
+ */
+typedef struct {
+     int            l;   /* distance from left edge */
+     int            t;   /* distance from top edge */
+     int            r;   /* distance from right edge */
+     int            b;   /* distance from bottom edge */
+} DFBInsets;
+
+/*
+ * A triangle specified by three points.
+ */
+typedef struct {
+     int            x1;  /* X coordinate of first edge */
+     int            y1;  /* Y coordinate of first edge */
+     int            x2;  /* X coordinate of second edge */
+     int            y2;  /* Y coordinate of second edge */
+     int            x3;  /* X coordinate of third edge */
+     int            y3;  /* Y coordinate of third edge */
+} DFBTriangle;
+
+/*
+ * A color defined by channels with 8bit each.
+ */
+typedef struct {
+     u8             a;   /* alpha channel */
+     u8             r;   /* red channel */
+     u8             g;   /* green channel */
+     u8             b;   /* blue channel */
+} DFBColor;
+
+/*
+ * A color key defined by R,G,B and eventually a color index.
+ */
+typedef struct {
+     u8             index;    /* color index */
+     u8             r;        /* red channel */
+     u8             g;        /* green channel */
+     u8             b;        /* blue channel */
+} DFBColorKey;
+
+/*
+ * A color defined by channels with 8bit each.
+ */
+typedef struct {
+     u8             a;   /* alpha channel */
+     u8             y;   /* luma channel */
+     u8             u;   /* chroma channel */
+     u8             v;   /* chroma channel */
+} DFBColorYUV;
+
+/*
+ * Macro to compare two points.
+ */
+#define DFB_POINT_EQUAL(a,b)  ((a).x == (b).x &&  \
+                               (a).y == (b).y)
+
+/*
+ * Macro to compare two rectangles.
+ */
+#define DFB_RECTANGLE_EQUAL(a,b)  ((a).x == (b).x &&  \
+                                   (a).y == (b).y &&  \
+                                   (a).w == (b).w &&  \
+                                   (a).h == (b).h)
+
+/*
+ * Macro to compare two locations.
+ */
+#define DFB_LOCATION_EQUAL(a,b)  ((a).x == (b).x &&  \
+                                  (a).y == (b).y &&  \
+                                  (a).w == (b).w &&  \
+                                  (a).h == (b).h)
+
+/*
+ * Macro to compare two regions.
+ */
+#define DFB_REGION_EQUAL(a,b)  ((a).x1 == (b).x1 &&  \
+                                (a).y1 == (b).y1 &&  \
+                                (a).x2 == (b).x2 &&  \
+                                (a).y2 == (b).y2)
+
+/*
+ * Macro to compare two colors.
+ */
+#define DFB_COLOR_EQUAL(x,y)  ((x).a == (y).a &&  \
+                               (x).r == (y).r &&  \
+                               (x).g == (y).g &&  \
+                               (x).b == (y).b)
+
+/*
+ * Macro to compare two color keys.
+ */
+#define DFB_COLORKEY_EQUAL(x,y) ((x).index == (y).index &&  \
+                                 (x).r == (y).r &&  \
+                                 (x).g == (y).g &&  \
+                                 (x).b == (y).b)
+
+/*
+ * Print a description of the result code along with an
+ * optional message that is put in front with a colon.
+ */
+DFBResult DirectFBError(
+                             const char  *msg,    /* optional message */
+                             DFBResult    result  /* result code to interpret */
+                       );
+
+/*
+ * Behaves like DirectFBError, but shuts down the calling application.
+ */
+DFBResult DirectFBErrorFatal(
+                             const char  *msg,    /* optional message */
+                             DFBResult    result  /* result code to interpret */
+                            );
+
+/*
+ * Returns a string describing 'result'.
+ */
+const char *DirectFBErrorString(
+                         DFBResult    result
+                      );
+
+/*
+ * Retrieves information about supported command-line flags in the
+ * form of a user-readable string formatted suitable to be printed
+ * as usage information.
+ */
+const char *DirectFBUsageString( void );
+
+/*
+ * Parses the command-line and initializes some variables. You
+ * absolutely need to call this before doing anything else.
+ * Removes all options used by DirectFB from argv.
+ */
+DFBResult DirectFBInit(
+                         int         *argc,    /* pointer to main()'s argc */
+                         char      *(*argv[])  /* pointer to main()'s argv */
+                      );
+
+/*
+ * Sets configuration parameters supported on command line and in
+ * config file. Can only be called before DirectFBCreate but after
+ * DirectFBInit.
+ */
+DFBResult DirectFBSetOption(
+                         const char  *name,
+                         const char  *value
+                      );
+
+/*
+ * Creates the super interface.
+ */
+DFBResult DirectFBCreate(
+                          IDirectFB **interface  /* pointer to the
+                                                    created interface */
+                        );
+
+
+typedef unsigned int DFBScreenID;
+typedef unsigned int DFBDisplayLayerID;
+typedef unsigned int DFBDisplayLayerSourceID;
+typedef unsigned int DFBWindowID;
+typedef unsigned int DFBInputDeviceID;
+typedef unsigned int DFBTextEncodingID;
+
+typedef u32 DFBDisplayLayerIDs;
+
+
+typedef unsigned int DFBColorID;
+
+/*
+ * Predefined color IDs.
+ */
+#define DCID_PRIMARY 0
+#define DCID_OUTLINE 1
+
+/*
+ * Maximum number of color ids.
+ */
+#define DFB_COLOR_IDS_MAX                    8
+
+
+/*
+ * Maximum number of layer ids.
+ */
+#define DFB_DISPLAYLAYER_IDS_MAX             32
+
+/*
+ * Adds the id to the bitmask of layer ids.
+ */
+#define DFB_DISPLAYLAYER_IDS_ADD(ids,id)     (ids) |=  (1 << (id))
+
+/*
+ * Removes the id from the bitmask of layer ids.
+ */
+#define DFB_DISPLAYLAYER_IDS_REMOVE(ids,id)  (ids) &= ~(1 << (id))
+
+/*
+ * Checks if the bitmask of layer ids contains the id.
+ */
+#define DFB_DISPLAYLAYER_IDS_HAVE(ids,id)    ((ids) & (1 << (id)))
+
+/*
+ * Empties (clears) the bitmask of layer ids.
+ */
+#define DFB_DISPLAYLAYER_IDS_EMPTY(ids)      (ids) = 0
+
+/*
+ * Predefined text encoding IDs.
+ */
+#define DTEID_UTF8  0
+#define DTEID_OTHER 1
+
+/*
+ * The cooperative level controls the super interface's behaviour
+ * in functions like SetVideoMode or CreateSurface for the primary.
+ */
+typedef enum {
+     DFSCL_NORMAL        = 0x00000000,  /* Normal shared access, primary
+                                           surface will be the buffer of an
+                                           implicitly created window at the
+                                           resolution given by SetVideoMode().
+                                           */
+     DFSCL_FULLSCREEN,                  /* Application grabs the primary layer,
+                                           SetVideoMode automates layer
+                                           control. Primary surface is the
+                                           primary layer surface. */
+     DFSCL_EXCLUSIVE                    /* All but the primary layer will be
+                                           disabled, the application has full
+                                           control over layers if desired,
+                                           other applications have no
+                                           input/output/control. Primary
+                                           surface is the primary layer
+                                           surface. */
+} DFBCooperativeLevel;
+
+/*
+ * Capabilities of a display layer.
+ */
+typedef enum {
+     DLCAPS_NONE              = 0x00000000,
+
+     DLCAPS_SURFACE           = 0x00000001,  /* The layer has a surface that can be drawn to. This
+                                                may not be provided by layers that display realtime
+                                                data, e.g. from an MPEG decoder chip. Playback
+                                                control may be provided by an external API. */
+     DLCAPS_OPACITY           = 0x00000002,  /* The layer supports blending with layer(s) below
+                                                based on a global alpha factor. */
+     DLCAPS_ALPHACHANNEL      = 0x00000004,  /* The layer supports blending with layer(s) below
+                                                based on each pixel's alpha value. */
+     DLCAPS_SCREEN_LOCATION   = 0x00000008,  /* The layer location on the screen can be changed,
+                                                this includes position and size as normalized
+                                                values. The default is 0.0f, 0.0f, 1.0f, 1.0f. 
+                                                Supports IDirectFBDisplayLayer::SetScreenLocation() 
+                                                and IDirectFBDisplayLayer::SetScreenRectangle().
+                                                This implies DLCAPS_SCREEN_POSITION and _SIZE. */
+     DLCAPS_FLICKER_FILTERING = 0x00000010,  /* Flicker filtering can be enabled for smooth output
+                                                on interlaced display devices. */
+     DLCAPS_DEINTERLACING     = 0x00000020,  /* The layer provides optional deinterlacing for
+                                                displaying interlaced video data on progressive
+                                                display devices. */
+     DLCAPS_SRC_COLORKEY      = 0x00000040,  /* A specific color can be declared as transparent. */
+     DLCAPS_DST_COLORKEY      = 0x00000080,  /* A specific color of layers below can be specified
+                                                as the color of the only locations where the layer
+                                                is visible. */
+     DLCAPS_BRIGHTNESS        = 0x00000100,  /* Adjustment of brightness is supported. */
+     DLCAPS_CONTRAST          = 0x00000200,  /* Adjustment of contrast is supported. */
+     DLCAPS_HUE               = 0x00000400,  /* Adjustment of hue is supported. */
+     DLCAPS_SATURATION        = 0x00000800,  /* Adjustment of saturation is supported. */
+     DLCAPS_LEVELS            = 0x00001000,  /* Adjustment of the layer's level
+                                                (z position) is supported. */
+     DLCAPS_FIELD_PARITY      = 0x00002000,  /* Field parity can be selected */
+     DLCAPS_WINDOWS           = 0x00004000,  /* Hardware window support. */
+     DLCAPS_SOURCES           = 0x00008000,  /* Sources can be selected. */
+     DLCAPS_ALPHA_RAMP        = 0x00010000,  /* Alpha values for formats with one or two alpha bits
+                                                can be chosen, i.e. using ARGB1555 or ARGB2554 the
+                                                user can define the meaning of the two or four
+                                                possibilities. In short, this feature provides a
+                                                lookup table for the alpha bits of these formats.
+                                                See also IDirectFBSurface::SetAlphaRamp(). */
+     DLCAPS_PREMULTIPLIED     = 0x00020000,  /* Surfaces with premultiplied alpha are supported. */
+
+     DLCAPS_SCREEN_POSITION   = 0x00100000,  /* The layer position on the screen can be changed. 
+                                                Supports IDirectFBDisplayLayer::SetScreenPosition(). */
+     DLCAPS_SCREEN_SIZE       = 0x00200000,  /* The layer size (defined by its source rectangle) 
+                                                can be scaled to a different size on the screen 
+                                                (defined by its screen/destination rectangle or 
+                                                its normalized size) and does not have to be 1:1 
+                                                with it. */
+
+     DLCAPS_CLIP_REGIONS      = 0x00400000,  /* Supports IDirectFBDisplayLayer::SetClipRegions(). */
+
+     DLCAPS_ALL               = 0x0073FFFF
+} DFBDisplayLayerCapabilities;
+
+/*
+ * Capabilities of a screen.
+ */
+typedef enum {
+     DSCCAPS_NONE             = 0x00000000,
+
+     DSCCAPS_VSYNC            = 0x00000001,  /* Synchronization with the
+                                                vertical retrace supported. */
+     DSCCAPS_POWER_MANAGEMENT = 0x00000002,  /* Power management supported. */
+
+     DSCCAPS_MIXERS           = 0x00000010,  /* Has mixers. */
+     DSCCAPS_ENCODERS         = 0x00000020,  /* Has encoders. */
+     DSCCAPS_OUTPUTS          = 0x00000040,  /* Has outputs. */
+
+     DSCCAPS_ALL              = 0x00000073
+} DFBScreenCapabilities;
+
+/*
+ * Used to enable some capabilities like flicker filtering or colorkeying.
+ */
+typedef enum {
+     DLOP_NONE                = 0x00000000,  /* None of these. */
+     DLOP_ALPHACHANNEL        = 0x00000001,  /* Make usage of alpha channel
+                                                for blending on a pixel per
+                                                pixel basis. */
+     DLOP_FLICKER_FILTERING   = 0x00000002,  /* Enable flicker filtering. */
+     DLOP_DEINTERLACING       = 0x00000004,  /* Enable deinterlacing of an
+                                                interlaced (video) source. */
+     DLOP_SRC_COLORKEY        = 0x00000008,  /* Enable source color key. */
+     DLOP_DST_COLORKEY        = 0x00000010,  /* Enable dest. color key. */
+     DLOP_OPACITY             = 0x00000020,  /* Make usage of the global alpha
+                                                factor set by SetOpacity. */
+     DLOP_FIELD_PARITY        = 0x00000040   /* Set field parity */
+} DFBDisplayLayerOptions;
+
+/*
+ * Layer Buffer Mode.
+ */
+typedef enum {
+     DLBM_UNKNOWN    = 0x00000000,
+
+     DLBM_FRONTONLY  = 0x00000001,      /* no backbuffer */
+     DLBM_BACKVIDEO  = 0x00000002,      /* backbuffer in video memory */
+     DLBM_BACKSYSTEM = 0x00000004,      /* backbuffer in system memory */
+     DLBM_TRIPLE     = 0x00000008,      /* triple buffering */
+     DLBM_WINDOWS    = 0x00000010       /* no layer buffers at all,
+                                           using buffer of each window */
+} DFBDisplayLayerBufferMode;
+
+/*
+ * Flags defining which fields of a DFBSurfaceDescription are valid.
+ */
+typedef enum {
+     DSDESC_NONE         = 0x00000000,  /* none of these */
+
+     DSDESC_CAPS         = 0x00000001,  /* caps field is valid */
+     DSDESC_WIDTH        = 0x00000002,  /* width field is valid */
+     DSDESC_HEIGHT       = 0x00000004,  /* height field is valid */
+     DSDESC_PIXELFORMAT  = 0x00000008,  /* pixelformat field is valid */
+     DSDESC_PREALLOCATED = 0x00000010,  /* Surface uses data that has been
+                                           preallocated by the application.
+                                           The field array 'preallocated'
+                                           has to be set using the first
+                                           element for the front buffer
+                                           and eventually the second one
+                                           for the back buffer. */
+     DSDESC_PALETTE      = 0x00000020,  /* Initialize the surfaces palette
+                                           with the entries specified in the
+                                           description. */
+
+     DSDESC_RESOURCE_ID  = 0x00000100,  /* user defined resource id for general purpose
+                                           surfaces is specified, or resource id of window,
+                                           layer, user is returned */
+
+     DSDESC_HINTS        = 0x00000200,  /* Flags for optimized allocation and pixel format selection are set.
+                                           See also DFBSurfaceHintFlags. */
+
+     DSDESC_ALL          = 0x0000033F   /* all of these */
+} DFBSurfaceDescriptionFlags;
+
+/*
+ * Flags defining which fields of a DFBPaletteDescription are valid.
+ */
+typedef enum {
+     DPDESC_CAPS         = 0x00000001,  /* Specify palette capabilities. */
+     DPDESC_SIZE         = 0x00000002,  /* Specify number of entries. */
+     DPDESC_ENTRIES      = 0x00000004   /* Initialize the palette with the
+                                           entries specified in the
+                                           description. */
+} DFBPaletteDescriptionFlags;
+
+/*
+ * The surface capabilities.
+ */
+typedef enum {
+     DSCAPS_NONE          = 0x00000000,  /* None of these. */
+
+     DSCAPS_PRIMARY       = 0x00000001,  /* It's the primary surface. */
+     DSCAPS_SYSTEMONLY    = 0x00000002,  /* Surface data is permanently stored in system memory.<br>
+                                            There's no video memory allocation/storage. */
+     DSCAPS_VIDEOONLY     = 0x00000004,  /* Surface data is permanently stored in video memory.<br>
+                                            There's no system memory allocation/storage. */
+     DSCAPS_DOUBLE        = 0x00000010,  /* Surface is double buffered */
+     DSCAPS_SUBSURFACE    = 0x00000020,  /* Surface is just a sub area of another
+                                            one sharing the surface data. */
+     DSCAPS_INTERLACED    = 0x00000040,  /* Each buffer contains interlaced video (or graphics)
+                                            data consisting of two fields.<br>
+                                            Their lines are stored interleaved. One field's height
+                                            is a half of the surface's height. */
+     DSCAPS_SEPARATED     = 0x00000080,  /* For usage with DSCAPS_INTERLACED.<br>
+                                            DSCAPS_SEPARATED specifies that the fields are NOT
+                                            interleaved line by line in the buffer.<br>
+                                            The first field is followed by the second one. */
+     DSCAPS_STATIC_ALLOC  = 0x00000100,  /* The amount of video or system memory allocated for the
+                                            surface is never less than its initial value. This way
+                                            a surface can be resized (smaller and bigger up to the
+                                            initial size) without reallocation of the buffers. It's
+                                            useful for surfaces that need a guaranteed space in
+                                            video memory after resizing. */
+     DSCAPS_TRIPLE        = 0x00000200,  /* Surface is triple buffered. */
+
+     DSCAPS_PREMULTIPLIED = 0x00001000,  /* Surface stores data with premultiplied alpha. */
+
+     DSCAPS_DEPTH         = 0x00010000,  /* A depth buffer is allocated. */
+
+     DSCAPS_SHARED        = 0x00100000,  /* The surface will be accessible among processes. */
+
+     DSCAPS_ROTATED       = 0x01000000,  /* The back buffers are allocated with swapped width/height (unimplemented!). */
+
+     DSCAPS_ALL           = 0x011113F7,  /* All of these. */
+
+
+     DSCAPS_FLIPPING      = DSCAPS_DOUBLE | DSCAPS_TRIPLE /* Surface needs Flip() calls to make
+                                                             updates/changes visible/usable. */
+} DFBSurfaceCapabilities;
+
+/*
+ * The palette capabilities.
+ */
+typedef enum {
+     DPCAPS_NONE         = 0x00000000   /* None of these. */
+} DFBPaletteCapabilities;
+
+/*
+ * Flags controlling drawing commands.
+ */
+typedef enum {
+     DSDRAW_NOFX               = 0x00000000, /* uses none of the effects */
+     DSDRAW_BLEND              = 0x00000001, /* uses alpha from color */
+     DSDRAW_DST_COLORKEY       = 0x00000002, /* write to destination only if the destination pixel
+                                                matches the destination color key */
+     DSDRAW_SRC_PREMULTIPLY    = 0x00000004, /* multiplies the color's rgb channels by the alpha
+                                                channel before drawing */
+     DSDRAW_DST_PREMULTIPLY    = 0x00000008, /* modulates the dest. color with the dest. alpha */
+     DSDRAW_DEMULTIPLY         = 0x00000010, /* divides the color by the alpha before writing the
+                                                data to the destination */
+     DSDRAW_XOR                = 0x00000020  /* bitwise xor the destination pixels with the
+                                                specified color after premultiplication */
+} DFBSurfaceDrawingFlags;
+
+/*
+ * Flags controlling blitting commands.
+ */
+typedef enum {
+     DSBLIT_NOFX               = 0x00000000, /* uses none of the effects */
+     DSBLIT_BLEND_ALPHACHANNEL = 0x00000001, /* enables blending and uses
+                                                alphachannel from source */
+     DSBLIT_BLEND_COLORALPHA   = 0x00000002, /* enables blending and uses
+                                                alpha value from color */
+     DSBLIT_COLORIZE           = 0x00000004, /* modulates source color with
+                                                the color's r/g/b values */
+     DSBLIT_SRC_COLORKEY       = 0x00000008, /* don't blit pixels matching the source color key */
+     DSBLIT_DST_COLORKEY       = 0x00000010, /* write to destination only if the destination pixel
+                                                matches the destination color key */
+     DSBLIT_SRC_PREMULTIPLY    = 0x00000020, /* modulates the source color with the (modulated)
+                                                source alpha */
+     DSBLIT_DST_PREMULTIPLY    = 0x00000040, /* modulates the dest. color with the dest. alpha */
+     DSBLIT_DEMULTIPLY         = 0x00000080, /* divides the color by the alpha before writing the
+                                                data to the destination */
+     DSBLIT_DEINTERLACE        = 0x00000100, /* deinterlaces the source during blitting by reading
+                                                only one field (every second line of full
+                                                image) scaling it vertically by factor two */
+     DSBLIT_SRC_PREMULTCOLOR   = 0x00000200, /* modulates the source color with the color alpha */
+     DSBLIT_XOR                = 0x00000400, /* bitwise xor the destination pixels with the
+                                                source pixels after premultiplication */
+     DSBLIT_INDEX_TRANSLATION  = 0x00000800, /* do fast indexed to indexed translation,
+                                                this flag is mutual exclusive with all others */
+     DSBLIT_ROTATE90           = 0x00002000, /* rotate the image by 90 degree */
+     DSBLIT_ROTATE180          = 0x00001000, /* rotate the image by 180 degree */
+     DSBLIT_ROTATE270          = 0x00004000, /* rotate the image by 270 degree */
+     DSBLIT_COLORKEY_PROTECT   = 0x00010000, /* make sure written pixels don't match color key (internal only ATM) */
+     DSBLIT_SRC_MASK_ALPHA     = 0x00100000, /* modulate source alpha channel with alpha channel from source mask,
+                                                see also IDirectFBSurface::SetSourceMask() */
+     DSBLIT_SRC_MASK_COLOR     = 0x00200000, /* modulate source color channels with color channels from source mask,
+                                                see also IDirectFBSurface::SetSourceMask() */
+} DFBSurfaceBlittingFlags;
+
+/*
+ * Options for drawing and blitting operations. Not mandatory for acceleration.
+ */
+typedef enum {
+     DSRO_NONE                 = 0x00000000, /* None of these. */
+
+     DSRO_SMOOTH_UPSCALE       = 0x00000001, /* Use interpolation for upscale StretchBlit(). */
+     DSRO_SMOOTH_DOWNSCALE     = 0x00000002, /* Use interpolation for downscale StretchBlit(). */
+     DSRO_MATRIX               = 0x00000004, /* Use the transformation matrix set via IDirectFBSurface::SetMatrix(). */
+     DSRO_ANTIALIAS            = 0x00000008, /* Enable anti-aliasing for edges (alphablend must be enabled). */
+
+     DSRO_ALL                  = 0x0000000F  /* All of these. */
+} DFBSurfaceRenderOptions;
+
+/*
+ * Mask of accelerated functions.
+ */
+typedef enum {
+     DFXL_NONE           = 0x00000000,  /* None of these. */
+
+     DFXL_FILLRECTANGLE  = 0x00000001,  /* FillRectangle() is accelerated. */
+     DFXL_DRAWRECTANGLE  = 0x00000002,  /* DrawRectangle() is accelerated. */
+     DFXL_DRAWLINE       = 0x00000004,  /* DrawLine() is accelerated. */
+     DFXL_FILLTRIANGLE   = 0x00000008,  /* FillTriangle() is accelerated. */
+
+     DFXL_BLIT           = 0x00010000,  /* Blit() and TileBlit() are accelerated. */
+     DFXL_STRETCHBLIT    = 0x00020000,  /* StretchBlit() is accelerated. */
+     DFXL_TEXTRIANGLES   = 0x00040000,  /* TextureTriangles() is accelerated. */
+
+     DFXL_DRAWSTRING     = 0x01000000,  /* DrawString() and DrawGlyph() are accelerated. */
+
+
+     DFXL_ALL            = 0x0107000F,  /* All drawing/blitting functions. */
+     DFXL_ALL_DRAW       = 0x0000000F,  /* All drawing functions. */
+     DFXL_ALL_BLIT       = 0x01070000,  /* All blitting functions. */
+} DFBAccelerationMask;
+
+
+/*
+ * @internal
+ */
+#define DFB_DRAWING_FUNCTION(a)    ((a) & 0x0000FFFF)
+
+/*
+ * @internal
+ */
+#define DFB_BLITTING_FUNCTION(a)   ((a) & 0xFFFF0000)
+
+/*
+ * Type of display layer for basic classification.
+ * Values may be or'ed together.
+ */
+typedef enum {
+     DLTF_NONE           = 0x00000000,  /* Unclassified, no specific type. */
+
+     DLTF_GRAPHICS       = 0x00000001,  /* Can be used for graphics output. */
+     DLTF_VIDEO          = 0x00000002,  /* Can be used for live video output.*/
+     DLTF_STILL_PICTURE  = 0x00000004,  /* Can be used for single frames. */
+     DLTF_BACKGROUND     = 0x00000008,  /* Can be used as a background layer.*/
+
+     DLTF_ALL            = 0x0000000F   /* All type flags set. */
+} DFBDisplayLayerTypeFlags;
+
+/*
+ * Type of input device for basic classification.
+ * Values may be or'ed together.
+ */
+typedef enum {
+     DIDTF_NONE          = 0x00000000,  /* Unclassified, no specific type. */
+
+     DIDTF_KEYBOARD      = 0x00000001,  /* Can act as a keyboard. */
+     DIDTF_MOUSE         = 0x00000002,  /* Can be used as a mouse. */
+     DIDTF_JOYSTICK      = 0x00000004,  /* Can be used as a joystick. */
+     DIDTF_REMOTE        = 0x00000008,  /* Is a remote control. */
+     DIDTF_VIRTUAL       = 0x00000010,  /* Is a virtual input device. */
+
+     DIDTF_ALL           = 0x0000001F   /* All type flags set. */
+} DFBInputDeviceTypeFlags;
+
+/*
+ * Basic input device features.
+ */
+typedef enum {
+     DICAPS_KEYS         = 0x00000001,  /* device supports key events */
+     DICAPS_AXES         = 0x00000002,  /* device supports axis events */
+     DICAPS_BUTTONS      = 0x00000004,  /* device supports button events */
+
+     DICAPS_ALL          = 0x00000007   /* all capabilities */
+} DFBInputDeviceCapabilities;
+
+/*
+ * Identifier (index) for e.g. mouse or joystick buttons.
+ */
+typedef enum {
+     DIBI_LEFT           = 0x00000000,  /* left mouse button */
+     DIBI_RIGHT          = 0x00000001,  /* right mouse button */
+     DIBI_MIDDLE         = 0x00000002,  /* middle mouse button */
+
+     DIBI_FIRST          = DIBI_LEFT,   /* other buttons:
+                                           DIBI_FIRST + zero based index */
+     DIBI_LAST           = 0x0000001F   /* 32 buttons maximum */
+} DFBInputDeviceButtonIdentifier;
+
+/*
+ * Axis identifier (index) for e.g. mouse or joystick.
+ *
+ * The X, Y and Z axis are predefined. To access other axes,
+ * use DIAI_FIRST plus a zero based index, e.g. the 4th axis
+ * would be (DIAI_FIRST + 3).
+ */
+typedef enum {
+     DIAI_X              = 0x00000000,  /* X axis */
+     DIAI_Y              = 0x00000001,  /* Y axis */
+     DIAI_Z              = 0x00000002,  /* Z axis */
+
+     DIAI_FIRST          = DIAI_X,      /* other axis:
+                                           DIAI_FIRST + zero based index */
+     DIAI_LAST           = 0x0000001F   /* 32 axes maximum */
+} DFBInputDeviceAxisIdentifier;
+
+/*
+ * Flags defining which fields of a DFBWindowDescription are valid.
+ */
+typedef enum {
+     DWDESC_CAPS         = 0x00000001,  /* caps field is valid */
+     DWDESC_WIDTH        = 0x00000002,  /* width field is valid */
+     DWDESC_HEIGHT       = 0x00000004,  /* height field is valid */
+     DWDESC_PIXELFORMAT  = 0x00000008,  /* pixelformat field is valid */
+     DWDESC_POSX         = 0x00000010,  /* posx field is valid */
+     DWDESC_POSY         = 0x00000020,  /* posy field is valid */
+     DWDESC_SURFACE_CAPS = 0x00000040,  /* Create the window surface with
+                                           special capabilities. */
+     DWDESC_PARENT       = 0x00000080,  /* This window has a parent according to parent_id field. */
+     DWDESC_OPTIONS      = 0x00000100,  /* Initial window options have been set. */
+     DWDESC_STACKING     = 0x00000200,  /* Initial stacking class has been set. */
+
+     DWDESC_TOPLEVEL_ID  = 0x00000400,  /* The top level window is set in toplevel_id field. */
+
+     DWDESC_RESOURCE_ID  = 0x00001000,  /* Resource id for window surface creation has been set. */
+} DFBWindowDescriptionFlags;
+
+/*
+ * Flags defining which fields of a DFBDataBufferDescription are valid.
+ */
+typedef enum {
+     DBDESC_FILE         = 0x00000001,  /* Create a static buffer for the
+                                           specified filename. */
+     DBDESC_MEMORY       = 0x00000002   /* Create a static buffer for the
+                                           specified memory area. */
+} DFBDataBufferDescriptionFlags;
+
+/*
+ * Capabilities a window can have.
+ */
+typedef enum {
+     DWCAPS_NONE         = 0x00000000,  /* None of these. */
+
+     DWCAPS_ALPHACHANNEL = 0x00000001,  /* The window has an alphachannel
+                                           for pixel-per-pixel blending. */
+     DWCAPS_DOUBLEBUFFER = 0x00000002,  /* The window's surface is double
+                                           buffered. This is very useful
+                                           to avoid visibility of content
+                                           that is still in preparation.
+                                           Normally a window's content can
+                                           get visible before an update if
+                                           there is another reason causing
+                                           a window stack repaint. */
+     DWCAPS_INPUTONLY    = 0x00000004,  /* The window has no surface.
+                                           You can not draw to it but it
+                                           receives events */
+     DWCAPS_NODECORATION = 0x00000008,  /* The window won't be decorated. */
+
+     DWCAPS_SUBWINDOW    = 0x00000010,  /* Not a top level window. */
+
+     DWCAPS_COLOR        = 0x00000020,  /* The window has no buffer;
+                                           it consumes no backing store.
+                                           It is filled with a constant color
+                                           and it receives events */
+
+     DWCAPS_NOFOCUS      = 0x00000100,  /* Window will never get focus or receive key events, unless it grabs them. */
+
+
+     DWCAPS_ALL          = 0x0000013F   /* All of these. */
+} DFBWindowCapabilities;
+
+/*
+ * Flags controlling the appearance and behaviour of the window.
+ */
+typedef enum {
+     DWOP_NONE           = 0x00000000,  /* none of these */
+     DWOP_COLORKEYING    = 0x00000001,  /* enable color key */
+     DWOP_ALPHACHANNEL   = 0x00000002,  /* enable alpha blending using the
+                                           window's alpha channel */
+     DWOP_OPAQUE_REGION  = 0x00000004,  /* overrides DWOP_ALPHACHANNEL for the
+                                           region set by SetOpaqueRegion() */
+     DWOP_SHAPED         = 0x00000008,  /* window doesn't receive mouse events for
+                                           invisible regions, must be used with
+                                           DWOP_ALPHACHANNEL or DWOP_COLORKEYING */
+     DWOP_KEEP_POSITION  = 0x00000010,  /* window can't be moved
+                                           with the mouse */
+     DWOP_KEEP_SIZE      = 0x00000020,  /* window can't be resized
+                                           with the mouse */
+     DWOP_KEEP_STACKING  = 0x00000040,  /* window can't be raised
+                                           or lowered with the mouse */
+     DWOP_GHOST          = 0x00001000,  /* never get focus or input,
+                                           clicks will go through,
+                                           implies DWOP_KEEP... */
+     DWOP_INDESTRUCTIBLE = 0x00002000,  /* window can't be destroyed
+                                           by internal shortcut */
+
+     DWOP_INPUTONLY      = 0x00004000,  /* The window will be input only.
+                                           It will receive events but is not shown.
+                                           Note that toggling this bit will not
+                                           free/assign the window surface. */
+
+     DWOP_SCALE          = 0x00010000,  /* Surface won't be changed if window size on screen changes. The surface
+                                           can be resized separately using IDirectFBWindow::ResizeSurface(). */
+
+     DWOP_KEEP_ABOVE     = 0x00100000,  /* Keep window above parent window. */
+     DWOP_KEEP_UNDER     = 0x00200000,  /* Keep window under parent window. */
+     DWOP_FOLLOW_BOUNDS  = 0x00400000,  /* Follow window bounds from parent. */
+
+     DWOP_ALL            = 0x0071707F   /* all possible options */
+} DFBWindowOptions;
+
+/*
+ * The stacking class restricts the stacking order of windows.
+ */
+typedef enum {
+     DWSC_MIDDLE         = 0x00000000,  /* This is the default stacking
+                                           class of new windows. */
+     DWSC_UPPER          = 0x00000001,  /* Window is always above windows
+                                           in the middle stacking class.
+                                           Only windows that are also in
+                                           the upper stacking class can
+                                           get above them. */
+     DWSC_LOWER          = 0x00000002   /* Window is always below windows
+                                           in the middle stacking class.
+                                           Only windows that are also in
+                                           the lower stacking class can
+                                           get below them. */
+} DFBWindowStackingClass;
+
+
+/*
+ * Flags describing how to load a font.
+ *
+ * These flags describe how a font is loaded and affect how the
+ * glyphs are drawn. There is no way to change this after the font
+ * has been loaded. If you need to render a font with different
+ * attributes, you have to create multiple FontProviders of the
+ * same font file.
+ */
+typedef enum {
+     DFFA_NONE           = 0x00000000,  /* none of these flags */
+     DFFA_NOKERNING      = 0x00000001,  /* don't use kerning */
+     DFFA_NOHINTING      = 0x00000002,  /* don't use hinting */
+     DFFA_MONOCHROME     = 0x00000004,  /* don't use anti-aliasing */
+     DFFA_NOCHARMAP      = 0x00000008,  /* no char map, glyph indices are
+                                           specified directly */
+     DFFA_FIXEDCLIP      = 0x00000010,  /* width fixed advance, clip to it */
+     DFFA_NOBITMAP       = 0x00000020,  /* ignore bitmap strikes; for
+                                           bitmap-only fonts this flag is
+                                           ignored */
+     DFFA_OUTLINED       = 0x00000040
+} DFBFontAttributes;
+
+/*
+ * Flags defining which fields of a DFBFontDescription are valid.
+ */
+typedef enum {
+     DFDESC_ATTRIBUTES        = 0x00000001,  /* attributes field is valid */
+     DFDESC_HEIGHT            = 0x00000002,  /* height is specified */
+     DFDESC_WIDTH             = 0x00000004,  /* width is specified */
+     DFDESC_INDEX             = 0x00000008,  /* index is specified */
+     DFDESC_FIXEDADVANCE      = 0x00000010,  /* specify a fixed advance overriding
+                                                any character advance of fixed or
+                                                proportional fonts */
+     DFDESC_FRACT_HEIGHT      = 0x00000020,  /* fractional height is set */
+     DFDESC_FRACT_WIDTH       = 0x00000040,  /* fractional width is set */
+     DFDESC_OUTLINE_WIDTH     = 0x00000080,  /* outline width is set */
+     DFDESC_OUTLINE_OPACITY   = 0x00000100,  /* outline opacity is set */
+     DFDESC_ROTATION          = 0x00002000,  /* rotation is set */
+} DFBFontDescriptionFlags;
+
+/*
+ * Description of how to load glyphs from a font file.
+ *
+ * The attributes control how the glyphs are rendered. Width and height can be used to specify the
+ * desired face size in pixels. If you are loading a non-scalable font, you shouldn't specify a
+ * font size.
+ *
+ * Please note that the height value in the DFBFontDescription doesn't correspond to the height
+ * returned by IDirectFBFont::GetHeight().
+ *
+ * The index field controls which face is loaded from a font file that provides a collection of
+ * faces. This is rarely needed.
+ *
+ * Fractional sizes (fract_height and fract_width) are 26.6 fixed point integers and override
+ * the pixel sizes if both are specified.
+ *
+ * Outline parameters are ignored if DFFA_OUTLINED is not used (see DFBFontAttributes). To change the
+ * default values of 1.0 each use DFDESC_OUTLINE_WIDTH and/or DFDESC_OUTLINE_OPACITY.
+ *
+ * The rotation value is a 0.24 fixed point number of rotations.  Use the macros DFB_DEGREES
+ * and DFB_RADIANS to convert from those units.
+ */
+typedef struct {
+     DFBFontDescriptionFlags            flags;
+
+     DFBFontAttributes                  attributes;
+     int                                height;
+     int                                width;
+     unsigned int                       index;
+     int                                fixed_advance;
+
+     int                                fract_height;
+     int                                fract_width;
+
+     int                                outline_width;      /* Outline width as 16.16 fixed point integer */
+     int                                outline_opacity;    /* Outline opacity as 16.16 fixed point integer */
+
+     int                                rotation;
+} DFBFontDescription;
+
+#define DFB_DEGREES(deg) ((int)((deg)/360.0*(1<<24)))
+#define DFB_RADIANS(rad) ((int)((rad)/(2.0*M_PI)*(1<<24)))
+
+/*
+ * @internal
+ *
+ * Encodes format constants in the following way (bit 31 - 0):
+ *
+ * lkjj:hhgg | gfff:eeed | cccc:bbbb | baaa:aaaa
+ *
+ * a) pixelformat index<br>
+ * b) effective color (or index) bits per pixel of format<br>
+ * c) effective alpha bits per pixel of format<br>
+ * d) alpha channel present<br>
+ * e) bytes per "pixel in a row" (1/8 fragment, i.e. bits)<br>
+ * f) bytes per "pixel in a row" (decimal part, i.e. bytes)<br>
+ * g) smallest number of pixels aligned to byte boundary (minus one)<br>
+ * h) multiplier for planes minus one (1/4 fragment)<br>
+ * j) multiplier for planes minus one (decimal part)<br>
+ * k) color and/or alpha lookup table present<br>
+ * l) alpha channel is inverted
+ */
+#define DFB_SURFACE_PIXELFORMAT( index, color_bits, alpha_bits, has_alpha,     \
+                                 row_bits, row_bytes, align, mul_f, mul_d,     \
+                                 has_lut, inv_alpha )                          \
+     ( (((index     ) & 0x7F)      ) |                                         \
+       (((color_bits) & 0x1F) <<  7) |                                         \
+       (((alpha_bits) & 0x0F) << 12) |                                         \
+       (((has_alpha ) ? 1 :0) << 16) |                                         \
+       (((row_bits  ) & 0x07) << 17) |                                         \
+       (((row_bytes ) & 0x07) << 20) |                                         \
+       (((align     ) & 0x07) << 23) |                                         \
+       (((mul_f     ) & 0x03) << 26) |                                         \
+       (((mul_d     ) & 0x03) << 28) |                                         \
+       (((has_lut   ) ? 1 :0) << 30) |                                         \
+       (((inv_alpha ) ? 1 :0) << 31) )
+
+/*
+ * Pixel format of a surface.
+ */
+typedef enum {
+     DSPF_UNKNOWN   = 0x00000000,  /* unknown or unspecified format */
+
+     /* 16 bit  ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */
+     DSPF_ARGB1555  = DFB_SURFACE_PIXELFORMAT(  0, 15, 1, 1, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   RGB (2 byte, red 5@11, green 6@5, blue 5@0) */
+     DSPF_RGB16     = DFB_SURFACE_PIXELFORMAT(  1, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 24 bit   RGB (3 byte, red 8@16, green 8@8, blue 8@0) */
+     DSPF_RGB24     = DFB_SURFACE_PIXELFORMAT(  2, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
+
+     /* 24 bit   RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
+     DSPF_RGB32     = DFB_SURFACE_PIXELFORMAT(  3, 24, 0, 0, 0, 4, 0, 0, 0, 0, 0 ),
+
+     /* 32 bit  ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
+     DSPF_ARGB      = DFB_SURFACE_PIXELFORMAT(  4, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
+
+     /*  8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
+     DSPF_A8        = DFB_SURFACE_PIXELFORMAT(  5,  0, 8, 1, 0, 1, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
+     DSPF_YUY2      = DFB_SURFACE_PIXELFORMAT(  6, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /*  8 bit   RGB (1 byte, red 3@5, green 3@2, blue 2@0) */
+     DSPF_RGB332    = DFB_SURFACE_PIXELFORMAT(  7,  8, 0, 0, 0, 1, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
+     DSPF_UYVY      = DFB_SURFACE_PIXELFORMAT(  8, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 12 bit   YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */
+     DSPF_I420      = DFB_SURFACE_PIXELFORMAT(  9, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
+
+     /* 12 bit   YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */
+     DSPF_YV12      = DFB_SURFACE_PIXELFORMAT( 10, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
+
+     /*  8 bit   LUT (8 bit color and alpha lookup from palette) */
+     DSPF_LUT8      = DFB_SURFACE_PIXELFORMAT( 11,  8, 0, 1, 0, 1, 0, 0, 0, 1, 0 ),
+
+     /*  8 bit  ALUT (1 byte, alpha 4@4, color lookup 4@0) */
+     DSPF_ALUT44    = DFB_SURFACE_PIXELFORMAT( 12,  4, 4, 1, 0, 1, 0, 0, 0, 1, 0 ),
+
+     /* 32 bit  ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
+     DSPF_AiRGB     = DFB_SURFACE_PIXELFORMAT( 13, 24, 8, 1, 0, 4, 0, 0, 0, 0, 1 ),
+
+     /*  1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
+     DSPF_A1        = DFB_SURFACE_PIXELFORMAT( 14,  0, 1, 1, 1, 0, 7, 0, 0, 0, 0 ),
+
+     /* 12 bit   YUV (8 bit Y plane followed by one 16 bit quarter size Cb|Cr [7:0|7:0] plane) */
+     DSPF_NV12      = DFB_SURFACE_PIXELFORMAT( 15, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
+
+     /* 16 bit   YUV (8 bit Y plane followed by one 16 bit half width Cb|Cr [7:0|7:0] plane) */
+     DSPF_NV16      = DFB_SURFACE_PIXELFORMAT( 16, 24, 0, 0, 0, 1, 0, 0, 1, 0, 0 ),
+
+     /* 16 bit  ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
+     DSPF_ARGB2554  = DFB_SURFACE_PIXELFORMAT( 17, 14, 2, 1, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit  ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */
+     DSPF_ARGB4444  = DFB_SURFACE_PIXELFORMAT( 18, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit  RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
+     DSPF_RGBA4444  = DFB_SURFACE_PIXELFORMAT( 19, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 12 bit   YUV (8 bit Y plane followed by one 16 bit quarter size Cr|Cb [7:0|7:0] plane) */
+     DSPF_NV21      = DFB_SURFACE_PIXELFORMAT( 20, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
+
+     /* 32 bit  AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
+     DSPF_AYUV      = DFB_SURFACE_PIXELFORMAT( 21, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
+
+     /*  4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
+     DSPF_A4        = DFB_SURFACE_PIXELFORMAT( 22,  0, 4, 1, 4, 0, 1, 0, 0, 0, 0 ),
+
+     /*  1 bit alpha (3 byte/  alpha 1@18, red 6@12, green 6@6, blue 6@0) */
+     DSPF_ARGB1666  = DFB_SURFACE_PIXELFORMAT( 23, 18, 1, 1, 0, 3, 0, 0, 0, 0, 0 ),
+
+     /*  6 bit alpha (3 byte/  alpha 6@18, red 6@12, green 6@6, blue 6@0) */
+     DSPF_ARGB6666  = DFB_SURFACE_PIXELFORMAT( 24, 18, 6, 1, 0, 3, 0, 0, 0, 0, 0 ),
+
+     /*  6 bit   RGB (3 byte/   red 6@12, green 6@6, blue 6@0) */
+     DSPF_RGB18     = DFB_SURFACE_PIXELFORMAT( 25, 18, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
+
+     /*  2 bit   LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
+     DSPF_LUT2      = DFB_SURFACE_PIXELFORMAT( 26,  2, 0, 1, 2, 0, 3, 0, 0, 1, 0 ),
+
+     /* 16 bit   RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */
+     DSPF_RGB444    = DFB_SURFACE_PIXELFORMAT( 27, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
+     DSPF_RGB555    = DFB_SURFACE_PIXELFORMAT( 28, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
+
+     /* 16 bit   BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */
+     DSPF_BGR555    = DFB_SURFACE_PIXELFORMAT( 29, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 )
+
+} DFBSurfacePixelFormat;
+
+/* Number of pixelformats defined */
+#define DFB_NUM_PIXELFORMATS            30
+
+/* These macros extract information about the pixel format. */
+#define DFB_PIXELFORMAT_INDEX(fmt)      (((fmt) & 0x0000007F)      )
+
+#define DFB_COLOR_BITS_PER_PIXEL(fmt)   (((fmt) & 0x00000F80) >>  7)
+
+#define DFB_ALPHA_BITS_PER_PIXEL(fmt)   (((fmt) & 0x0000F000) >> 12)
+
+#define DFB_PIXELFORMAT_HAS_ALPHA(fmt)  (((fmt) & 0x00010000) !=  0)
+
+#define DFB_BITS_PER_PIXEL(fmt)         (((fmt) & 0x007E0000) >> 17)
+
+#define DFB_BYTES_PER_PIXEL(fmt)        (((fmt) & 0x00700000) >> 20)
+
+#define DFB_BYTES_PER_LINE(fmt,width)   (((((fmt) & 0x007E0000) >> 17) * (width) + 7) >> 3)
+
+#define DFB_PIXELFORMAT_ALIGNMENT(fmt)  (((fmt) & 0x03800000) >> 23)
+
+#define DFB_PLANE_MULTIPLY(fmt,height)  ((((((fmt) & 0x3C000000) >> 26) + 4) * (height)) >> 2)
+
+#define DFB_PIXELFORMAT_IS_INDEXED(fmt) (((fmt) & 0x40000000) !=  0)
+
+#define DFB_PLANAR_PIXELFORMAT(fmt)     (((fmt) & 0x3C000000) !=  0)
+
+#define DFB_PIXELFORMAT_INV_ALPHA(fmt)  (((fmt) & 0x80000000) !=  0)
+
+/*
+ * Hint flags for optimized allocation, format selection etc.
+ */
+typedef enum {
+     DSHF_NONE                = 0x00000000,
+
+     DSHF_LAYER               = 0x00000001,       /* Surface optimized for display layer usage */
+     DSHF_WINDOW              = 0x00000002,       /* Surface optimized for being a window buffer */
+     DSHF_CURSOR              = 0x00000004,       /* Surface optimized for usage as a cursor shape */
+     DSHF_FONT                = 0x00000008,       /* Surface optimized for text rendering */
+
+     DSHF_ALL                 = 0x0000000F
+} DFBSurfaceHintFlags;
+
+/*
+ * Description of the surface that is to be created.
+ */
+typedef struct {
+     DFBSurfaceDescriptionFlags         flags;       /* field validation */
+
+     DFBSurfaceCapabilities             caps;        /* capabilities */
+     int                                width;       /* pixel width */
+     int                                height;      /* pixel height */
+     DFBSurfacePixelFormat              pixelformat; /* pixel format */
+
+     struct {
+          void                         *data;        /* data pointer of existing buffer */
+          int                           pitch;       /* pitch of buffer */
+     } preallocated[2];
+
+     struct {
+          const DFBColor               *entries;
+          unsigned int                  size;
+     } palette;                                      /* initial palette */
+
+     unsigned long                      resource_id;   /* universal resource id, either user specified for general
+                                                          purpose surfaces or id of layer or window */
+
+     DFBSurfaceHintFlags                hints;       /* usage hints for optimized allocation, format selection etc. */
+} DFBSurfaceDescription;
+
+/*
+ * Description of the palette that is to be created.
+ */
+typedef struct {
+     DFBPaletteDescriptionFlags         flags;       /* Validation of fields. */
+
+     DFBPaletteCapabilities             caps;        /* Palette capabilities. */
+     unsigned int                       size;        /* Number of entries. */
+     const DFBColor                    *entries;     /* Preset palette
+                                                        entries. */
+} DFBPaletteDescription;
+
+
+#define DFB_DISPLAY_LAYER_DESC_NAME_LENGTH   32
+
+/*
+ * Description of the display layer capabilities.
+ */
+typedef struct {
+     DFBDisplayLayerTypeFlags           type;          /* Classification of the display layer. */
+     DFBDisplayLayerCapabilities        caps;          /* Capability flags of the display layer. */
+
+     char name[DFB_DISPLAY_LAYER_DESC_NAME_LENGTH];    /* Display layer name. */
+
+     int                                level;         /* Default level. */
+     int                                regions;       /* Number of concurrent regions supported.<br>
+                                                           -1 = unlimited,
+                                                            0 = unknown/one,
+                                                           >0 = actual number */
+     int                                sources;       /* Number of selectable sources. */
+     int                                clip_regions;  /* Number of clipping regions. */
+} DFBDisplayLayerDescription;
+
+/*
+ * Capabilities of a display layer source.
+ */
+typedef enum {
+     DDLSCAPS_NONE       = 0x00000000,  /* none of these */
+
+     DDLSCAPS_SURFACE    = 0x00000001,  /* source has an accessable surface */
+
+     DDLSCAPS_ALL        = 0x00000001   /* all of these */
+} DFBDisplayLayerSourceCaps;
+
+#define DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH    24
+
+/*
+ * Description of a display layer source.
+ */
+typedef struct {
+     DFBDisplayLayerSourceID            source_id;          /* ID of the source. */
+
+     char name[DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH];  /* Name of the source. */
+
+     DFBDisplayLayerSourceCaps          caps;               /* Capabilites of the source. */
+} DFBDisplayLayerSourceDescription;
+
+
+#define DFB_SCREEN_DESC_NAME_LENGTH          32
+
+/*
+ * Description of the display encoder capabilities.
+ */
+typedef struct {
+     DFBScreenCapabilities              caps;        /* Capability flags of
+                                                        the screen. */
+
+     char name[DFB_SCREEN_DESC_NAME_LENGTH];         /* Rough description. */
+
+     int                                mixers;      /* Number of mixers
+                                                        available. */
+     int                                encoders;    /* Number of display
+                                                        encoders available. */
+     int                                outputs;     /* Number of output
+                                                        connectors available. */
+} DFBScreenDescription;
+
+
+#define DFB_INPUT_DEVICE_DESC_NAME_LENGTH    32
+#define DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH  40
+
+/*
+ * Description of the input device capabilities.
+ */
+typedef struct {
+     DFBInputDeviceTypeFlags            type;        /* classification of
+                                                        input device */
+     DFBInputDeviceCapabilities         caps;        /* capabilities,
+                                                        validates the
+                                                        following fields */
+
+     int                                min_keycode; /* minimum hardware
+                                                        keycode or -1 if
+                                                        no differentiation
+                                                        between hardware
+                                                        keys is made */
+     int                                max_keycode; /* maximum hardware
+                                                        keycode or -1 if
+                                                        no differentiation
+                                                        between hardware
+                                                        keys is made */
+     DFBInputDeviceAxisIdentifier       max_axis;    /* highest axis
+                                                        identifier */
+     DFBInputDeviceButtonIdentifier     max_button;  /* highest button
+                                                        identifier */
+
+     char name[DFB_INPUT_DEVICE_DESC_NAME_LENGTH];   /* Device name */
+
+     char vendor[DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
+
+     int  vendor_id;                                 /* Vendor ID */
+     int  product_id;                                /* Product ID */
+} DFBInputDeviceDescription;
+
+/*
+ * Input device state flags
+ */
+typedef enum {
+     DISTATE_NONE                  = 0x00000000,       /* none of these */
+
+     DISTATE_DISCONNECTED          = 0x00000001,       /* The device is currently not connected,
+                                                          but may be connected again (hotplug). */
+
+     DISTATE_ALL                   = 0x00000001,       /* all of these */
+} DFBInputDeviceStateFlags;
+
+/*
+ * State of an input device.
+ */
+typedef struct {
+     DFBInputDeviceStateFlags      flags;              /* State flags */
+} DFBInputDeviceState;
+
+typedef enum {
+     DIAIF_NONE                    = 0x00000000,
+
+     DIAIF_ABS_MIN                 = 0x00000001,
+     DIAIF_ABS_MAX                 = 0x00000002,
+
+     DIAIF_ALL                     = 0x00000003
+} DFBInputDeviceAxisInfoFlags;
+
+typedef struct {
+     DFBInputDeviceAxisInfoFlags   flags;
+     int                           abs_min;
+     int                           abs_max;
+} DFBInputDeviceAxisInfo;
+
+#define DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH    40
+#define DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH  60
+
+typedef struct {
+     int  major;                                          /* Major version */
+     int  minor;                                          /* Minor version */
+
+     char name[DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH];     /* Driver name */
+     char vendor[DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH]; /* Driver vendor */
+} DFBGraphicsDriverInfo;
+
+#define DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH    48
+#define DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH  64
+
+/*
+ * Description of the graphics device capabilities.
+ */
+typedef struct {
+     DFBAccelerationMask      acceleration_mask;          /* Accelerated functions */
+
+     DFBSurfaceBlittingFlags  blitting_flags;             /* Supported blitting flags */
+     DFBSurfaceDrawingFlags   drawing_flags;              /* Supported drawing flags */
+
+     unsigned int             video_memory;               /* Amount of video memory in bytes */
+
+     char name[DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH];     /* Device/Chipset name */
+     char vendor[DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
+
+     DFBGraphicsDriverInfo    driver;
+} DFBGraphicsDeviceDescription;
+
+/*
+ * Description of the window that is to be created.
+ */
+typedef struct {
+     DFBWindowDescriptionFlags          flags;        /* field validation */
+
+     DFBWindowCapabilities              caps;         /* capabilities */
+     int                                width;        /* pixel width */
+     int                                height;       /* pixel height */
+     DFBSurfacePixelFormat              pixelformat;  /* pixel format */
+     int                                posx;         /* distance from left layer border */
+     int                                posy;         /* distance from upper layer border */
+     DFBSurfaceCapabilities             surface_caps; /* pixel format */
+     DFBWindowID                        parent_id;    /* window id of parent window */
+     DFBWindowOptions                   options;      /* initial window options */
+     DFBWindowStackingClass             stacking;     /* initial stacking class */
+
+     unsigned long                      resource_id;  /* resource id used to create the window surface */
+
+     DFBWindowID                        toplevel_id;  /* top level window, if != 0 window will be a sub window */
+} DFBWindowDescription;
+
+/*
+ * Description of a data buffer that is to be created.
+ */
+typedef struct {
+     DFBDataBufferDescriptionFlags      flags;       /* field validation */
+
+     const char                        *file;        /* for file based data buffers */
+
+     struct {
+          const void                   *data;        /* static data pointer */
+          unsigned int                  length;      /* length of buffer */
+     } memory;                                       /* memory based buffers */
+} DFBDataBufferDescription;
+
+/*
+ * Return value of callback function of enumerations.
+ */
+typedef enum {
+     DFENUM_OK           = 0x00000000,  /* Proceed with enumeration */
+     DFENUM_CANCEL       = 0x00000001   /* Cancel enumeration */
+} DFBEnumerationResult;
+
+/*
+ * Called for each supported video mode.
+ */
+typedef DFBEnumerationResult (*DFBVideoModeCallback) (
+     int                       width,
+     int                       height,
+     int                       bpp,
+     void                     *callbackdata
+);
+
+/*
+ * Called for each existing screen.
+ * "screen_id" can be used to get an interface to the screen.
+ */
+typedef DFBEnumerationResult (*DFBScreenCallback) (
+     DFBScreenID                        screen_id,
+     DFBScreenDescription               desc,
+     void                              *callbackdata
+);
+
+/*
+ * Called for each existing display layer.
+ * "layer_id" can be used to get an interface to the layer.
+ */
+typedef DFBEnumerationResult (*DFBDisplayLayerCallback) (
+     DFBDisplayLayerID                  layer_id,
+     DFBDisplayLayerDescription         desc,
+     void                              *callbackdata
+);
+
+/*
+ * Called for each existing input device.
+ * "device_id" can be used to get an interface to the device.
+ */
+typedef DFBEnumerationResult (*DFBInputDeviceCallback) (
+     DFBInputDeviceID                   device_id,
+     DFBInputDeviceDescription          desc,
+     void                              *callbackdata
+);
+
+/*
+ * Called for each block of continous data requested, e.g. by a
+ * Video Provider. Write as many data as you can but not more
+ * than specified by length. Return the number of bytes written
+ * or 'EOF' if no data is available anymore.
+ */
+typedef int (*DFBGetDataCallback) (
+     void                              *buffer,
+     unsigned int                       length,
+     void                              *callbackdata
+);
+
+/*
+ * Information about an IDirectFBVideoProvider.
+ */
+typedef enum {
+     DVCAPS_BASIC       = 0x00000000,  /* basic ops (PlayTo, Stop)         */
+     DVCAPS_SEEK        = 0x00000001,  /* supports SeekTo                  */
+     DVCAPS_SCALE       = 0x00000002,  /* can scale the video              */
+     DVCAPS_INTERLACED  = 0x00000004,  /* supports interlaced surfaces     */
+     DVCAPS_SPEED       = 0x00000008,  /* supports changing playback speed */
+     DVCAPS_BRIGHTNESS  = 0x00000010,  /* supports Brightness adjustment   */
+     DVCAPS_CONTRAST    = 0x00000020,  /* supports Contrast adjustment     */
+     DVCAPS_HUE         = 0x00000040,  /* supports Hue adjustment          */
+     DVCAPS_SATURATION  = 0x00000080,  /* supports Saturation adjustment   */
+     DVCAPS_INTERACTIVE = 0x00000100,  /* supports SendEvent               */
+     DVCAPS_VOLUME      = 0x00000200,  /* supports Volume adjustment       */
+     DVCAPS_EVENT       = 0x00000400,  /* supports the sending of events as video/audio data changes.*/
+     DVCAPS_ATTRIBUTES  = 0x00000800,  /* supports dynamic changing of atrributes.*/
+     DVCAPS_AUDIO_SEL   = 0x00001000,  /* Supportes chosing audio outputs.*/
+} DFBVideoProviderCapabilities;
+
+/*
+ * Information about the status of an IDirectFBVideoProvider.
+ */
+typedef enum {
+     DVSTATE_UNKNOWN    = 0x00000000, /* unknown status               */
+     DVSTATE_PLAY       = 0x00000001, /* video provider is playing    */
+     DVSTATE_STOP       = 0x00000002, /* playback was stopped         */
+     DVSTATE_FINISHED   = 0x00000003, /* playback is finished         */
+     DVSTATE_BUFFERING  = 0x00000004  /* video provider is buffering,
+                                         playback is running          */
+} DFBVideoProviderStatus;
+
+/*
+ * Flags controlling playback mode of a IDirectFBVideoProvider.
+ */
+typedef enum {
+     DVPLAY_NOFX        = 0x00000000, /* normal playback           */
+     DVPLAY_REWIND      = 0x00000001, /* reverse playback          */
+     DVPLAY_LOOPING     = 0x00000002  /* automatically restart 
+                                         playback when end-of-stream
+                                         is reached (gapless).     */
+} DFBVideoProviderPlaybackFlags;
+
+/*
+ * Flags to allow Audio Unit selection.
+ */
+typedef enum {
+     DVAUDIOUNIT_NONE   = 0x00000000, /* No Audio Unit            */
+     DVAUDIOUNIT_ONE    = 0x00000001, /* Audio Unit One           */
+     DVAUDIOUNIT_TWO    = 0x00000002, /* Audio Unit Two           */
+     DVAUDIOUNIT_THREE  = 0x00000004, /* Audio Unit Three         */
+     DVAUDIOUNIT_FOUR   = 0x00000008, /* Audio Unit Four          */
+     DVAUDIOUNIT_ALL    = 0x0000000F, /* Audio Unit One           */
+} DFBVideoProviderAudioUnits;
+
+
+/*
+ * Flags defining which fields of a DFBColorAdjustment are valid.
+ */
+typedef enum {
+     DCAF_NONE         = 0x00000000,  /* none of these              */
+     DCAF_BRIGHTNESS   = 0x00000001,  /* brightness field is valid  */
+     DCAF_CONTRAST     = 0x00000002,  /* contrast field is valid    */
+     DCAF_HUE          = 0x00000004,  /* hue field is valid         */
+     DCAF_SATURATION   = 0x00000008,  /* saturation field is valid  */
+     DCAF_ALL          = 0x0000000F   /* all of these               */
+} DFBColorAdjustmentFlags;
+
+/*
+ * Color Adjustment used to adjust video colors.
+ *
+ * All fields are in the range 0x0 to 0xFFFF with
+ * 0x8000 as the default value (no adjustment).
+ */
+typedef struct {
+     DFBColorAdjustmentFlags  flags;
+
+     u16                      brightness;
+     u16                      contrast;
+     u16                      hue;
+     u16                      saturation;
+} DFBColorAdjustment;
+
+
+/*
+ * <i><b>IDirectFB</b></i> is the main interface. It can be
+ * retrieved by a call to <i>DirectFBCreate</i>. It's the only
+ * interface with a global creation facility. Other interfaces
+ * are created by this interface or interfaces created by it.
+ *
+ * <b>Hardware capabilities</b> such as the amount of video
+ * memory or a list of supported drawing/blitting functions and
+ * flags can be retrieved.  It also provides enumeration of all
+ * supported video modes.
+ *
+ * <b>Input devices</b> and <b>display layers</b> that are
+ * present can be enumerated via a callback mechanism. The
+ * callback is given the capabilities and the device or layer
+ * ID. An interface to specific input devices or display layers
+ * can be retrieved by passing the device or layer ID to the
+ * corresponding method.
+ *
+ * <b>Surfaces</b> for general purpose use can be created via
+ * <i>CreateSurface</i>. These surfaces are so called "offscreen
+ * surfaces" and could be used for sprites or icons.
+ *
+ * The <b>primary surface</b> is an abstraction and API shortcut
+ * for getting a surface for visual output. Fullscreen games for
+ * example have the whole screen as their primary
+ * surface. Alternatively fullscreen applications can be forced
+ * to run in a window. The primary surface is also created via
+ * <i>CreateSurface</i> but with the special capability
+ * DSCAPS_PRIMARY.
+ *
+ * The <b>cooperative level</b> selects the type of the primary
+ * surface.  With a call to <i>SetCooperativeLevel</i> the
+ * application can choose between the surface of an implicitly
+ * created window and the surface of the primary layer
+ * (deactivating the window stack). The application doesn't need
+ * to have any extra functionality to run in a window. If the
+ * application is forced to run in a window the call to
+ * <i>SetCooperativeLevel</i> fails with DFB_ACCESSDENIED.
+ * Applications that want to be "window aware" shouldn't exit on
+ * this error.
+ *
+ * The <b>video mode</b> can be changed via <i>SetVideoMode</i>
+ * and is the size and depth of the primary surface, i.e. the
+ * screen when in exclusive cooperative level. Without exclusive
+ * access <i>SetVideoMode</i> sets the size of the implicitly
+ * created window.
+ *
+ * <b>Event buffers</b> can be created with an option to
+ * automatically attach input devices matching the specified
+ * capabilities. If DICAPS_NONE is passed an event buffer with
+ * nothing attached to is created. An event buffer can be
+ * attached to input devices and windows.
+ *
+ * <b>Fonts, images and videos</b> are created by this
+ * interface. There are different implementations for different
+ * content types. On creation a suitable implementation is
+ * automatically chosen.
+ */
+DEFINE_INTERFACE(   IDirectFB,
+
+   /** Cooperative level, video mode **/
+
+     /*
+      * Puts the interface into the specified cooperative level.
+      *
+      * Function fails with DFB_LOCKED if another instance already
+      * is in a cooperative level other than DFSCL_NORMAL.
+      */
+     DFBResult (*SetCooperativeLevel) (
+          IDirectFB                *thiz,
+          DFBCooperativeLevel       level
+     );
+
+     /*
+      * Switch the current video mode (primary layer).
+      *
+      * If in shared cooperative level this function sets the
+      * resolution of the window that is created implicitly for
+      * the primary surface.
+      */
+     DFBResult (*SetVideoMode) (
+          IDirectFB                *thiz,
+          int                       width,
+          int                       height,
+          int                       bpp
+     );
+
+
+   /** Hardware capabilities **/
+
+     /*
+      * Get a description of the graphics device.
+      *
+      * For more detailed information use
+      * IDirectFBSurface::GetAccelerationMask().
+      */
+     DFBResult (*GetDeviceDescription) (
+          IDirectFB                    *thiz,
+          DFBGraphicsDeviceDescription *ret_desc
+     );
+
+     /*
+      * Enumerate supported video modes.
+      *
+      * Calls the given callback for all available video modes.
+      * Useful to select a certain mode to be used with
+      * IDirectFB::SetVideoMode().
+      */
+     DFBResult (*EnumVideoModes) (
+          IDirectFB                *thiz,
+          DFBVideoModeCallback      callback,
+          void                     *callbackdata
+     );
+
+
+   /** Surfaces & Palettes **/
+
+     /*
+      * Create a surface matching the specified description.
+      */
+     DFBResult (*CreateSurface) (
+          IDirectFB                     *thiz,
+          const DFBSurfaceDescription   *desc,
+          IDirectFBSurface             **ret_interface
+     );
+
+     /*
+      * Create a palette matching the specified description.
+      *
+      * Passing a NULL description creates a default palette with
+      * 256 entries filled with colors matching the RGB332 format.
+      */
+     DFBResult (*CreatePalette) (
+          IDirectFB                    *thiz,
+          const DFBPaletteDescription  *desc,
+          IDirectFBPalette            **ret_interface
+     );
+
+
+   /** Screens **/
+
+     /*
+      * Enumerate all existing screen.
+      *
+      * Calls the given callback for each available screen.
+      * The callback is passed the screen id that can be
+      * used to retrieve an interface to a specific screen using
+      * IDirectFB::GetScreen().
+      */
+     DFBResult (*EnumScreens) (
+          IDirectFB                *thiz,
+          DFBScreenCallback         callback,
+          void                     *callbackdata
+     );
+
+     /*
+      * Retrieve an interface to a specific screen.
+      */
+     DFBResult (*GetScreen) (
+          IDirectFB                *thiz,
+          DFBScreenID               screen_id,
+          IDirectFBScreen         **ret_interface
+     );
+
+
+   /** Display Layers **/
+
+     /*
+      * Enumerate all existing display layers.
+      *
+      * Calls the given callback for each available display
+      * layer. The callback is passed the layer id that can be
+      * used to retrieve an interface to a specific layer using
+      * IDirectFB::GetDisplayLayer().
+      */
+     DFBResult (*EnumDisplayLayers) (
+          IDirectFB                *thiz,
+          DFBDisplayLayerCallback   callback,
+          void                     *callbackdata
+     );
+
+     /*
+      * Retrieve an interface to a specific display layer.
+      *
+      * The default <i>layer_id</i> is DLID_PRIMARY.
+      * Others can be obtained using IDirectFB::EnumDisplayLayers().
+      */
+     DFBResult (*GetDisplayLayer) (
+          IDirectFB                *thiz,
+          DFBDisplayLayerID         layer_id,
+          IDirectFBDisplayLayer   **ret_interface
+     );
+
+
+   /** Input Devices **/
+
+     /*
+      * Enumerate all existing input devices.
+      *
+      * Calls the given callback for all available input devices.
+      * The callback is passed the device id that can be used to
+      * retrieve an interface on a specific device using
+      * IDirectFB::GetInputDevice().
+      */
+     DFBResult (*EnumInputDevices) (
+          IDirectFB                *thiz,
+          DFBInputDeviceCallback    callback,
+          void                     *callbackdata
+     );
+
+     /*
+      * Retrieve an interface to a specific input device.
+      */
+     DFBResult (*GetInputDevice) (
+          IDirectFB                *thiz,
+          DFBInputDeviceID          device_id,
+          IDirectFBInputDevice    **ret_interface
+     );
+
+     /*
+      * Create a buffer for events.
+      *
+      * Creates an empty event buffer without event sources connected to it.
+      */
+     DFBResult (*CreateEventBuffer) (
+          IDirectFB                   *thiz,
+          IDirectFBEventBuffer       **ret_buffer
+     );
+
+     /*
+      * Create a buffer for events with input devices connected.
+      *
+      * Creates an event buffer and attaches all input devices
+      * with matching capabilities. If no input devices match,
+      * e.g. by specifying DICAPS_NONE, a buffer will be returned
+      * that has no event sources connected to it.
+      *
+      * If global is DFB_FALSE events will only be delivered if this
+      * instance of IDirectFB has a focused primary (either running fullscreen
+      * or running in windowed mode with the window being focused).
+      *
+      * If global is DFB_TRUE no event will be discarded.
+      */
+     DFBResult (*CreateInputEventBuffer) (
+          IDirectFB                   *thiz,
+          DFBInputDeviceCapabilities   caps,
+          DFBBoolean                   global,
+          IDirectFBEventBuffer       **ret_buffer
+     );
+
+
+
+   /** Media **/
+
+     /*
+      * Create an image provider for the specified file.
+      */
+     DFBResult (*CreateImageProvider) (
+          IDirectFB                *thiz,
+          const char               *filename,
+          IDirectFBImageProvider  **ret_interface
+     );
+
+     /*
+      * Create a video provider.
+      */
+     DFBResult (*CreateVideoProvider) (
+          IDirectFB                *thiz,
+          const char               *filename,
+          IDirectFBVideoProvider  **ret_interface
+     );
+
+     /*
+      * Load a font from the specified file given a description
+      * of how to load the glyphs.
+      */
+     DFBResult (*CreateFont) (
+          IDirectFB                     *thiz,
+          const char                    *filename,
+          const DFBFontDescription      *desc,
+          IDirectFBFont                **ret_interface
+     );
+
+     /*
+      * Create a data buffer.
+      *
+      * If no description is specified (NULL) a streamed data buffer
+      * is created.
+      */
+     DFBResult (*CreateDataBuffer) (
+          IDirectFB                       *thiz,
+          const DFBDataBufferDescription  *desc,
+          IDirectFBDataBuffer            **ret_interface
+     );
+
+
+   /** Clipboard **/
+
+     /*
+      * Set clipboard content.
+      *
+      * This is an experimental and intermediate API call that is
+      * supposed to change soon.
+      *
+      * If timestamp is non null DirectFB returns the time stamp
+      * that it associated with the new data.
+      */
+     DFBResult (*SetClipboardData) (
+          IDirectFB                *thiz,
+          const char               *mime_type,
+          const void               *data,
+          unsigned int              size,
+          struct timeval           *ret_timestamp
+     );
+
+     /*
+      * Get clipboard content.
+      *
+      * Memory returned in *ret_mimetype and *ret_data has to be freed.
+      *
+      * This is an experimental and intermediate API call that is
+      * supposed to change soon.
+      */
+     DFBResult (*GetClipboardData) (
+          IDirectFB                *thiz,
+          char                    **ret_mimetype,
+          void                    **ret_data,
+          unsigned int             *ret_size
+     );
+
+     /*
+      * Get time stamp of last SetClipboardData call.
+      *
+      * This is an experimental and intermediate API call that is
+      * supposed to change soon.
+      */
+     DFBResult (*GetClipboardTimeStamp) (
+          IDirectFB                *thiz,
+          struct timeval           *ret_timestamp
+     );
+
+
+   /** Misc **/
+
+     /*
+      * Suspend DirectFB, no other calls to DirectFB are allowed
+      * until Resume has been called.
+      */
+     DFBResult (*Suspend) (
+          IDirectFB                *thiz
+     );
+
+     /*
+      * Resume DirectFB, only to be called after Suspend.
+      */
+     DFBResult (*Resume) (
+          IDirectFB                *thiz
+     );
+
+     /*
+      * Wait until graphics card is idle,
+      * i.e. finish all drawing/blitting functions.
+      */
+     DFBResult (*WaitIdle) (
+          IDirectFB                *thiz
+     );
+
+     /*
+      * Wait for next vertical retrace.
+      */
+     DFBResult (*WaitForSync) (
+          IDirectFB                *thiz
+     );
+
+
+   /** Extensions **/
+
+     /*
+      * Load an implementation of a specific interface type.
+      *
+      * This methods loads an interface implementation of the specified
+      * <b>type</b> of interface, e.g. "IFusionSound".
+      *
+      * A specific implementation can be forced with the optional
+      * <b>implementation</b> argument.
+      *
+      * Implementations are passed <b>arg</b> during probing and construction.
+      *
+      * If an implementation has been successfully probed and the interface
+      * has been constructed, the resulting interface pointer is stored in
+      * <b>interface</b>.
+      */
+     DFBResult (*GetInterface) (
+          IDirectFB                *thiz,
+          const char               *type,
+          const char               *implementation,
+          void                     *arg,
+          void                    **ret_interface
+     );
+
+
+   /** Input Devices */
+
+     DFBResult (*RescanInputDevices) (
+          IDirectFB                *thiz
+     );
+)
+
+/* predefined layer ids */
+#define DLID_PRIMARY          0x0000
+
+/* predefined layer source ids */
+#define DLSID_SURFACE         0x0000
+
+/* predefined screen ids */
+#define DSCID_PRIMARY         0x0000
+
+/* predefined input device ids */
+#define DIDID_KEYBOARD        0x0000    /* primary keyboard       */
+#define DIDID_MOUSE           0x0001    /* primary mouse          */
+#define DIDID_JOYSTICK        0x0002    /* primary joystick       */
+#define DIDID_REMOTE          0x0003    /* primary remote control */
+#define DIDID_ANY             0x0010    /* no primary device      */
+
+
+/*
+ * Cooperative level handling the access permissions.
+ */
+typedef enum {
+     DLSCL_SHARED             = 0, /* shared access */
+     DLSCL_EXCLUSIVE,              /* exclusive access,
+                                      fullscreen/mode switching */
+     DLSCL_ADMINISTRATIVE          /* administrative access,
+                                      enumerate windows, control them */
+} DFBDisplayLayerCooperativeLevel;
+
+/*
+ * Background mode defining how to erase/initialize the area
+ * for a windowstack repaint
+ */
+typedef enum {
+     DLBM_DONTCARE            = 0, /* do not clear the layer before
+                                      repainting the windowstack */
+     DLBM_COLOR,                   /* fill with solid color
+                                      (SetBackgroundColor) */
+     DLBM_IMAGE,                   /* use an image (SetBackgroundImage) */
+     DLBM_TILE                     /* use a tiled image (SetBackgroundImage) */
+} DFBDisplayLayerBackgroundMode;
+
+/*
+ * Layer configuration flags
+ */
+typedef enum {
+     DLCONF_NONE              = 0x00000000,
+
+     DLCONF_WIDTH             = 0x00000001,
+     DLCONF_HEIGHT            = 0x00000002,
+     DLCONF_PIXELFORMAT       = 0x00000004,
+     DLCONF_BUFFERMODE        = 0x00000008,
+     DLCONF_OPTIONS           = 0x00000010,
+     DLCONF_SOURCE            = 0x00000020,
+     DLCONF_SURFACE_CAPS      = 0x00000040,
+
+     DLCONF_ALL               = 0x0000007F
+} DFBDisplayLayerConfigFlags;
+
+/*
+ * Layer configuration
+ */
+typedef struct {
+     DFBDisplayLayerConfigFlags    flags;         /* Which fields of the configuration are set */
+
+     int                           width;         /* Pixel width */
+     int                           height;        /* Pixel height */
+     DFBSurfacePixelFormat         pixelformat;   /* Pixel format */
+     DFBDisplayLayerBufferMode     buffermode;    /* Buffer mode */
+     DFBDisplayLayerOptions        options;       /* Enable capabilities */
+     DFBDisplayLayerSourceID       source;        /* Selected layer source */
+
+     DFBSurfaceCapabilities        surface_caps;  /* Choose surface capabilities, available:
+                                                     INTERLACED, SEPARATED, PREMULTIPLIED. */
+} DFBDisplayLayerConfig;
+
+/*
+ * Screen Power Mode.
+ */
+typedef enum {
+     DSPM_ON        = 0,
+     DSPM_STANDBY,
+     DSPM_SUSPEND,
+     DSPM_OFF
+} DFBScreenPowerMode;
+
+
+/*
+ * Capabilities of a mixer.
+ */
+typedef enum {
+     DSMCAPS_NONE         = 0x00000000, /* None of these. */
+
+     DSMCAPS_FULL         = 0x00000001, /* Can mix full tree as specified in the description. */
+     DSMCAPS_SUB_LEVEL    = 0x00000002, /* Can set a maximum layer level, e.g. to exclude an OSD from VCR output. */
+     DSMCAPS_SUB_LAYERS   = 0x00000004, /* Can select a number of layers individually as specified in the description. */
+     DSMCAPS_BACKGROUND   = 0x00000008  /* Background color is configurable. */
+} DFBScreenMixerCapabilities;
+
+
+#define DFB_SCREEN_MIXER_DESC_NAME_LENGTH    24
+
+/*
+ * Description of a mixer.
+ */
+typedef struct {
+     DFBScreenMixerCapabilities  caps;
+
+     DFBDisplayLayerIDs          layers;             /* Visible layers if the
+                                                        full tree is selected. */
+
+     int                         sub_num;            /* Number of layers that can
+                                                        be selected in sub mode. */
+     DFBDisplayLayerIDs          sub_layers;         /* Layers available for sub mode
+                                                        with layer selection. */
+
+     char name[DFB_SCREEN_MIXER_DESC_NAME_LENGTH];   /* Mixer name */
+} DFBScreenMixerDescription;
+
+/*
+ * Flags for mixer configuration.
+ */
+typedef enum {
+     DSMCONF_NONE         = 0x00000000, /* None of these. */
+
+     DSMCONF_TREE         = 0x00000001, /* (Sub) tree is selected. */
+     DSMCONF_LEVEL        = 0x00000002, /* Level is specified. */
+     DSMCONF_LAYERS       = 0x00000004, /* Layer selection is set. */
+
+     DSMCONF_BACKGROUND   = 0x00000010, /* Background color is set. */
+
+     DSMCONF_ALL          = 0x00000017
+} DFBScreenMixerConfigFlags;
+
+/*
+ * (Sub) tree selection.
+ */
+typedef enum {
+     DSMT_UNKNOWN         = 0x00000000, /* Unknown mode */
+
+     DSMT_FULL            = 0x00000001, /* Full tree. */
+     DSMT_SUB_LEVEL       = 0x00000002, /* Sub tree via maximum level. */
+     DSMT_SUB_LAYERS      = 0x00000003  /* Sub tree via layer selection. */
+} DFBScreenMixerTree;
+
+/*
+ * Configuration of a mixer.
+ */
+typedef struct {
+     DFBScreenMixerConfigFlags   flags;      /* Validates struct members. */
+
+     DFBScreenMixerTree          tree;       /* Selected (sub) tree. */
+
+     int                         level;      /* Max. level of sub level mode. */
+     DFBDisplayLayerIDs          layers;     /* Layers for sub layers mode. */
+
+     DFBColor                    background; /* Background color. */
+} DFBScreenMixerConfig;
+
+
+/*
+ * Capabilities of an output.
+ */
+typedef enum {
+     DSOCAPS_NONE          = 0x00000000, /* None of these. */
+
+     DSOCAPS_CONNECTORS    = 0x00000001, /* Output connectors are available. */
+
+     DSOCAPS_ENCODER_SEL   = 0x00000010, /* Encoder can be selected. */
+     DSOCAPS_SIGNAL_SEL    = 0x00000020, /* Signal(s) can be selected. */
+     DSOCAPS_CONNECTOR_SEL = 0x00000040, /* Connector(s) can be selected. */
+     DSOCAPS_SLOW_BLANKING = 0x00000080, /* Slow Blanking on outputs is supported. */
+     DSOCAPS_RESOLUTION    = 0x00000100, /* Output Resolution can be changed. (global screen size)*/
+     DSOCAPS_ALL           = 0x000001F1
+} DFBScreenOutputCapabilities;
+
+/*
+ * Type of output connector.
+ */
+typedef enum {
+     DSOC_UNKNOWN        = 0x00000000, /* Unknown type */
+
+     DSOC_VGA            = 0x00000001, /* VGA connector */
+     DSOC_SCART          = 0x00000002, /* SCART connector */
+     DSOC_YC             = 0x00000004, /* Y/C connector */
+     DSOC_CVBS           = 0x00000008, /* CVBS connector */
+     DSOC_SCART2         = 0x00000010, /* 2nd SCART connector */
+     DSOC_COMPONENT      = 0x00000020, /* Component video connector */
+     DSOC_HDMI           = 0x00000040  /* HDMI connector */
+} DFBScreenOutputConnectors;
+
+/*
+ * Type of output signal.
+ */
+typedef enum {
+     DSOS_NONE           = 0x00000000, /* No signal */
+
+     DSOS_VGA            = 0x00000001, /* VGA signal */
+     DSOS_YC             = 0x00000002, /* Y/C signal */
+     DSOS_CVBS           = 0x00000004, /* CVBS signal */
+     DSOS_RGB            = 0x00000008, /* R/G/B signal */
+     DSOS_YCBCR          = 0x00000010, /* Y/Cb/Cr signal */
+     DSOS_HDMI           = 0x00000020, /* HDMI signal */
+     DSOS_656            = 0x00000040  /* 656 Digital output signal */
+} DFBScreenOutputSignals;
+
+
+/*
+ * Type of slow blanking signalling.
+ */
+typedef enum {
+     DSOSB_OFF           = 0x00000000, /* No signal */
+     DSOSB_16x9          = 0x00000001, /* 16*9 Widescreen signalling */
+     DSOSB_4x3           = 0x00000002, /* 4*3 widescreen signalling */
+     DSOSB_FOLLOW        = 0x00000004, /* Follow signalling */
+     DSOSB_MONITOR       = 0x00000008  /* Monitor */
+} DFBScreenOutputSlowBlankingSignals;
+
+/**
+ * Resolutions.  TV Standards implies too many things:
+ *               resolution / encoding / frequency.
+ */
+typedef enum {
+    DSOR_UNKNOWN   = 0x00000000, /* Unknown Resolution */
+    DSOR_640_480   = 0x00000001, /* 640x480 Resolution */
+    DSOR_720_480   = 0x00000002, /* 720x480 Resolution */
+    DSOR_720_576   = 0x00000004, /* 720x576 Resolution */
+    DSOR_800_600   = 0x00000008, /* 800x600 Resolution */
+    DSOR_1024_768  = 0x00000010, /* 1024x768 Resolution */
+    DSOR_1152_864  = 0x00000020, /* 1152x864 Resolution */
+    DSOR_1280_720  = 0x00000040, /* 1280x720 Resolution */
+    DSOR_1280_768  = 0x00000080, /* 1280x768 Resolution */
+    DSOR_1280_960  = 0x00000100, /* 1280x960 Resolution */
+    DSOR_1280_1024 = 0x00000200, /* 1280x1024 Resolution */
+    DSOR_1400_1050 = 0x00000400, /* 1400x1050 Resolution */
+    DSOR_1600_1200 = 0x00000800, /* 1600x1200 Resolution */
+    DSOR_1920_1080 = 0x00001000, /* 1920x1080 Resolution */
+    DSOR_ALL       = 0x00001FFF  /* All Resolution */
+} DFBScreenOutputResolution;
+
+
+#define DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH    24
+
+/*
+ * Description of a screen output.
+ */
+typedef struct {
+     DFBScreenOutputCapabilities   caps;             /* Screen capabilities. */
+
+     DFBScreenOutputConnectors     all_connectors;   /* Output connectors. */
+     DFBScreenOutputSignals        all_signals;      /* Output signals. */
+     DFBScreenOutputResolution     all_resolutions;  /* Output Resolutions */
+
+     char name[DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH];  /* Output name */
+} DFBScreenOutputDescription;
+
+/*
+ * Flags for screen output configuration.
+ */
+typedef enum {
+     DSOCONF_NONE         = 0x00000000, /* None of these. */
+
+     DSOCONF_ENCODER      = 0x00000001, /* Set encoder the signal(s) comes from. */
+     DSOCONF_SIGNALS      = 0x00000002, /* Select signal(s) from encoder. */
+     DSOCONF_CONNECTORS   = 0x00000004, /* Select output connector(s). */
+     DSOCONF_SLOW_BLANKING= 0x00000008, /* Can select slow blanking support. */
+     DSOCONF_RESOLUTION   = 0x00000010, /* Can change output resolution */
+     
+     DSOCONF_ALL          = 0x0000001F
+} DFBScreenOutputConfigFlags;
+
+/*
+ * Configuration of an output.
+ */
+typedef struct {
+     DFBScreenOutputConfigFlags  flags;          /* Validates struct members. */
+
+     int                         encoder;        /* Chosen encoder. */
+     DFBScreenOutputSignals      out_signals;    /* Selected encoder signal(s). */
+     DFBScreenOutputConnectors   out_connectors; /* Selected output connector(s). */
+     DFBScreenOutputSlowBlankingSignals     slow_blanking;/* Slow Blanking signals. */
+     DFBScreenOutputResolution   resolution;     /* Output Resolution */
+} DFBScreenOutputConfig;
+
+
+/*
+ * Capabilities of a display encoder.
+ */
+typedef enum {
+     DSECAPS_NONE         = 0x00000000, /* None of these. */
+
+     DSECAPS_TV_STANDARDS = 0x00000001, /* TV standards can be selected. */
+     DSECAPS_TEST_PICTURE = 0x00000002, /* Test picture generation supported. */
+     DSECAPS_MIXER_SEL    = 0x00000004, /* Mixer can be selected. */
+     DSECAPS_OUT_SIGNALS  = 0x00000008, /* Different output signals are supported. */
+     DSECAPS_SCANMODE     = 0x00000010, /* Can switch between interlaced and progressive output. */
+     DSECAPS_FREQUENCY    = 0x00000020, /* Can switch between different frequencies. */
+
+     DSECAPS_BRIGHTNESS   = 0x00000100, /* Adjustment of brightness is supported. */
+     DSECAPS_CONTRAST     = 0x00000200, /* Adjustment of contrast is supported. */
+     DSECAPS_HUE          = 0x00000400, /* Adjustment of hue is supported. */
+     DSECAPS_SATURATION   = 0x00000800, /* Adjustment of saturation is supported. */
+
+     DSECAPS_CONNECTORS   = 0x00001000, /* Select output connector(s). */
+     DSECAPS_SLOW_BLANKING = 0x00002000, /* Slow Blanking on outputs is supported. */
+     DSECAPS_RESOLUTION   = 0x00004000, /* Different encoder resolutions supported */
+
+     DSECAPS_ALL          = 0x00007f3f
+} DFBScreenEncoderCapabilities;
+
+/*
+ * Type of display encoder.
+ */
+typedef enum {
+     DSET_UNKNOWN         = 0x00000000, /* Unknown type */
+
+     DSET_CRTC            = 0x00000001, /* Encoder is a CRTC. */
+     DSET_TV              = 0x00000002, /* TV output encoder. */
+     DSET_DIGITAL         = 0x00000004  /* Support signals other than SD TV standards. */
+} DFBScreenEncoderType;
+
+/*
+ * TV standards.
+ */
+typedef enum {
+     DSETV_UNKNOWN        = 0x00000000, /* Unknown standard */
+
+     DSETV_PAL            = 0x00000001, /* PAL */
+     DSETV_NTSC           = 0x00000002, /* NTSC */
+     DSETV_SECAM          = 0x00000004, /* SECAM */
+     DSETV_PAL_60         = 0x00000008, /* PAL-60 */
+     DSETV_PAL_BG         = 0x00000010, /* PAL BG support (specific) */
+     DSETV_PAL_I          = 0x00000020, /* PAL I support (specific) */
+     DSETV_PAL_M          = 0x00000040, /* PAL M support (specific) */
+     DSETV_PAL_N          = 0x00000080, /* PAL N support (specific) */
+     DSETV_PAL_NC         = 0x00000100, /* PAL NC support (specific) */
+     DSETV_NTSC_M_JPN     = 0x00000200, /* NTSC_JPN support */
+     DSETV_NTSC_443       = 0x00000800, /* NTSC with 4.43MHz colour carrier */
+     DSETV_DIGITAL        = 0x00000400, /* TV standards from the digital domain.  specify resolution, scantype, frequency.*/
+     DSETV_ALL            = 0x00000FFF  /* All TV Standards*/
+} DFBScreenEncoderTVStandards;
+
+/*
+ * Scan modes.
+ */
+typedef enum {
+     DSESM_UNKNOWN        = 0x00000000, /* Unknown mode */
+
+     DSESM_INTERLACED     = 0x00000001, /* Interlaced scan mode */
+     DSESM_PROGRESSIVE    = 0x00000002  /* Progressive scan mode */
+} DFBScreenEncoderScanMode;
+
+/*
+ * Frequency of output signal.
+ */
+typedef enum {
+     DSEF_UNKNOWN        = 0x00000000, /* Unknown Frequency */
+
+     DSEF_25HZ           = 0x00000001, /* 25 Hz Output. */
+     DSEF_29_97HZ        = 0x00000002, /* 29.97 Hz Output. */
+     DSEF_50HZ           = 0x00000004, /* 50 Hz Output. */
+     DSEF_59_94HZ        = 0x00000008, /* 59.94 Hz Output. */
+     DSEF_60HZ           = 0x00000010, /* 60 Hz Output. */
+     DSEF_75HZ           = 0x00000020, /* 75 Hz Output. */
+     DSEF_30HZ           = 0x00000040, /* 30 Hz Output. */
+     DSEF_24HZ           = 0x00000080, /* 24 Hz Output. */
+     DSEF_23_976HZ       = 0x00000100, /* 23.976 Hz Output. */
+} DFBScreenEncoderFrequency;
+
+#define DFB_SCREEN_ENCODER_DESC_NAME_LENGTH    24
+
+/*
+ * Description of a display encoder.
+ */
+typedef struct {
+     DFBScreenEncoderCapabilities  caps;               /* Encoder capabilities. */
+     DFBScreenEncoderType          type;               /* Type of encoder. */
+
+     DFBScreenEncoderTVStandards   tv_standards;       /* Supported TV standards. */
+     DFBScreenOutputSignals        out_signals;        /* Supported output signals. */
+     DFBScreenOutputConnectors     all_connectors;     /* Supported output connectors */
+     DFBScreenOutputResolution     all_resolutions;    /* Supported Resolutions*/
+
+     char name[DFB_SCREEN_ENCODER_DESC_NAME_LENGTH];   /* Encoder name */
+} DFBScreenEncoderDescription;
+
+/*
+ * Flags for display encoder configuration.
+ */
+typedef enum {
+     DSECONF_NONE         = 0x00000000, /* None of these. */
+
+     DSECONF_TV_STANDARD  = 0x00000001, /* Set TV standard. */
+     DSECONF_TEST_PICTURE = 0x00000002, /* Set test picture mode. */
+     DSECONF_MIXER        = 0x00000004, /* Select mixer. */
+     DSECONF_OUT_SIGNALS  = 0x00000008, /* Select generated output signal(s). */
+     DSECONF_SCANMODE     = 0x00000010, /* Select interlaced or progressive output. */
+     DSECONF_TEST_COLOR   = 0x00000020, /* Set color for DSETP_SINGLE. */
+     DSECONF_ADJUSTMENT   = 0x00000040, /* Set color adjustment. */
+     DSECONF_FREQUENCY    = 0x00000080, /* Set Output Frequency*/
+
+     DSECONF_CONNECTORS   = 0x00000100, /* Select output connector(s). */
+     DSECONF_SLOW_BLANKING = 0x00000200, /* Can select slow blanking support. */
+     DSECONF_RESOLUTION    = 0x00000400, /* Can change resolution of the encoder.*/
+     
+     DSECONF_ALL          = 0x000007FF
+} DFBScreenEncoderConfigFlags;
+
+/*
+ * Test picture mode.
+ */
+typedef enum {
+     DSETP_OFF      = 0x00000000,  /* Disable test picture. */
+
+     DSETP_MULTI    = 0x00000001,  /* Show color bars. */
+     DSETP_SINGLE   = 0x00000002,  /* Whole screen as defined in configuration. */
+
+     DSETP_WHITE    = 0x00000010,  /* Whole screen (ff, ff, ff). */
+     DSETP_YELLOW   = 0x00000020,  /* Whole screen (ff, ff, 00). */
+     DSETP_CYAN     = 0x00000030,  /* Whole screen (00, ff, ff). */
+     DSETP_GREEN    = 0x00000040,  /* Whole screen (00, ff, 00). */
+     DSETP_MAGENTA  = 0x00000050,  /* Whole screen (ff, 00, ff). */
+     DSETP_RED      = 0x00000060,  /* Whole screen (ff, 00, 00). */
+     DSETP_BLUE     = 0x00000070,  /* Whole screen (00, 00, ff). */
+     DSETP_BLACK    = 0x00000080   /* Whole screen (00, 00, 00). */
+} DFBScreenEncoderTestPicture;
+
+/*
+ * Configuration of a display encoder.
+ */
+typedef struct {
+     DFBScreenEncoderConfigFlags   flags;         /* Validates struct members. */
+
+     DFBScreenEncoderTVStandards   tv_standard;   /* TV standard. */
+     DFBScreenEncoderTestPicture   test_picture;  /* Test picture mode. */
+     int                           mixer;         /* Selected mixer. */
+     DFBScreenOutputSignals        out_signals;   /* Generated output signals. */
+     DFBScreenOutputConnectors     out_connectors; /* Selected output connector(s). */
+     DFBScreenOutputSlowBlankingSignals     slow_blanking;/* Slow Blanking signals. */
+
+     DFBScreenEncoderScanMode      scanmode;      /* Interlaced or progressive output. */
+
+     DFBColor                      test_color;    /* Color for DSETP_SINGLE. */
+
+     DFBColorAdjustment            adjustment;    /* Color adjustment. */
+
+     DFBScreenEncoderFrequency     frequency;     /* Selected Output Frequency*/
+     DFBScreenOutputResolution     resolution;    /* Selected Output resolution*/
+} DFBScreenEncoderConfig;
+
+
+/*******************
+ * IDirectFBScreen *
+ *******************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBScreen,
+
+   /** Retrieving information **/
+
+     /*
+      * Get the unique screen ID.
+      */
+     DFBResult (*GetID) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenID                        *ret_screen_id
+     );
+
+     /*
+      * Get a description of this screen, i.e. the capabilities.
+      */
+     DFBResult (*GetDescription) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenDescription               *ret_desc
+     );
+     
+     /*
+      * Get the screen's width and height in pixels.
+      */
+     DFBResult (*GetSize) (
+          IDirectFBScreen                    *thiz,
+          int                                *ret_width,
+          int                                *ret_height
+     );
+
+
+   /** Display Layers **/
+
+     /*
+      * Enumerate all existing display layers for this screen.
+      *
+      * Calls the given callback for each available display
+      * layer. The callback is passed the layer id that can be
+      * used to retrieve an interface to a specific layer using
+      * IDirectFB::GetDisplayLayer().
+      */
+     DFBResult (*EnumDisplayLayers) (
+          IDirectFBScreen                    *thiz,
+          DFBDisplayLayerCallback             callback,
+          void                               *callbackdata
+     );
+
+
+   /** Power management **/
+
+     /*
+      * Set screen power mode.
+      */
+     DFBResult (*SetPowerMode) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenPowerMode                  mode
+     );
+
+
+   /** Synchronization **/
+
+     /*
+      * Wait for next vertical retrace.
+      */
+     DFBResult (*WaitForSync) (
+          IDirectFBScreen                    *thiz
+     );
+
+
+   /** Mixers **/
+
+     /*
+      * Get a description of available mixers.
+      *
+      * All descriptions are written to the array pointed to by
+      * <b>ret_descriptions</b>. The number of mixers is returned by
+      * IDirectFBScreen::GetDescription().
+      */
+     DFBResult (*GetMixerDescriptions) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenMixerDescription          *ret_descriptions
+     );
+
+     /*
+      * Get current mixer configuration.
+      */
+     DFBResult (*GetMixerConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 mixer,
+          DFBScreenMixerConfig               *ret_config
+     );
+
+     /*
+      * Test mixer configuration.
+      *
+      * If configuration fails and 'ret_failed' is not NULL it will
+      * indicate which fields of the configuration caused the error.
+      */
+     DFBResult (*TestMixerConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 mixer,
+          const DFBScreenMixerConfig         *config,
+          DFBScreenMixerConfigFlags          *ret_failed
+     );
+
+     /*
+      * Set mixer configuration.
+      */
+     DFBResult (*SetMixerConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 mixer,
+          const DFBScreenMixerConfig         *config
+     );
+
+
+   /** Encoders **/
+
+     /*
+      * Get a description of available display encoders.
+      *
+      * All descriptions are written to the array pointed to by
+      * <b>ret_descriptions</b>. The number of encoders is returned by
+      * IDirectFBScreen::GetDescription().
+      */
+     DFBResult (*GetEncoderDescriptions) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenEncoderDescription        *ret_descriptions
+     );
+
+     /*
+      * Get current encoder configuration.
+      */
+     DFBResult (*GetEncoderConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 encoder,
+          DFBScreenEncoderConfig             *ret_config
+     );
+
+     /*
+      * Test encoder configuration.
+      *
+      * If configuration fails and 'ret_failed' is not NULL it will
+      * indicate which fields of the configuration caused the
+      * error.
+      */
+     DFBResult (*TestEncoderConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 encoder,
+          const DFBScreenEncoderConfig       *config,
+          DFBScreenEncoderConfigFlags        *ret_failed
+     );
+
+     /*
+      * Set encoder configuration.
+      */
+     DFBResult (*SetEncoderConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 encoder,
+          const DFBScreenEncoderConfig       *config
+     );
+
+
+   /** Outputs **/
+
+     /*
+      * Get a description of available outputs.
+      *
+      * All descriptions are written to the array pointed to by
+      * <b>ret_descriptions</b>. The number of outputs is returned by
+      * IDirectFBScreen::GetDescription().
+      */
+     DFBResult (*GetOutputDescriptions) (
+          IDirectFBScreen                    *thiz,
+          DFBScreenOutputDescription         *ret_descriptions
+     );
+
+     /*
+      * Get current output configuration.
+      */
+     DFBResult (*GetOutputConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 output,
+          DFBScreenOutputConfig              *ret_config
+     );
+
+     /*
+      * Test output configuration.
+      *
+      * If configuration fails and 'ret_failed' is not NULL it will
+      * indicate which fields of the configuration caused the error.
+      */
+     DFBResult (*TestOutputConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 output,
+          const DFBScreenOutputConfig        *config,
+          DFBScreenOutputConfigFlags         *ret_failed
+     );
+
+     /*
+      * Set output configuration.
+      */
+     DFBResult (*SetOutputConfiguration) (
+          IDirectFBScreen                    *thiz,
+          int                                 output,
+          const DFBScreenOutputConfig        *config
+     );
+)
+
+
+/*************************
+ * IDirectFBDisplayLayer *
+ *************************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBDisplayLayer,
+
+   /** Information **/
+
+     /*
+      * Get the unique layer ID.
+      */
+     DFBResult (*GetID) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerID                  *ret_layer_id
+     );
+
+     /*
+      * Get a description of this display layer, i.e. the capabilities.
+      */
+     DFBResult (*GetDescription) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerDescription         *ret_desc
+     );
+
+     /*
+      * Get a description of available sources.
+      *
+      * All descriptions are written to the array pointed to by
+      * <b>ret_descriptions</b>. The number of sources is returned by
+      * IDirectFBDisplayLayer::GetDescription().
+      */
+     DFBResult (*GetSourceDescriptions) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerSourceDescription   *ret_descriptions
+     );
+
+     /*
+      * For an interlaced display, this returns the currently inactive
+      * field: 0 for the top field, and 1 for the bottom field.
+      *
+      * The inactive field is the one you should draw to next to avoid
+      * tearing, the active field is the one currently being displayed.
+      *
+      * For a progressive output, this should always return 0.  We should
+      * also have some other call to indicate whether the display layer
+      * is interlaced or progressive, but this is a start.
+      */
+     DFBResult (*GetCurrentOutputField) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                *ret_field
+     );
+
+
+   /** Interfaces **/
+
+     /*
+      * Get an interface to layer's surface.
+      *
+      * Only available in exclusive mode.
+      */
+     DFBResult (*GetSurface) (
+          IDirectFBDisplayLayer              *thiz,
+          IDirectFBSurface                  **ret_interface
+     );
+
+     /*
+      * Get an interface to the screen to which the layer belongs.
+      */
+     DFBResult (*GetScreen) (
+          IDirectFBDisplayLayer              *thiz,
+          IDirectFBScreen                   **ret_interface
+     );
+
+
+   /** Configuration **/
+
+     /*
+      * Set cooperative level to get control over the layer
+      * or the windows within this layer.
+      */
+     DFBResult (*SetCooperativeLevel) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerCooperativeLevel     level
+     );
+
+     /*
+      * Get current layer configuration.
+      */
+     DFBResult (*GetConfiguration) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerConfig              *ret_config
+     );
+
+     /*
+      * Test layer configuration.
+      *
+      * If configuration fails and 'failed' is not NULL it will
+      * indicate which fields of the configuration caused the
+      * error.
+      */
+     DFBResult (*TestConfiguration) (
+          IDirectFBDisplayLayer              *thiz,
+          const DFBDisplayLayerConfig        *config,
+          DFBDisplayLayerConfigFlags         *ret_failed
+     );
+
+     /*
+      * Set layer configuration.
+      *
+      * Only available in exclusive or administrative mode.
+      */
+     DFBResult (*SetConfiguration) (
+          IDirectFBDisplayLayer              *thiz,
+          const DFBDisplayLayerConfig        *config
+     );
+
+
+   /** Layout **/
+
+     /*
+      * Set location on screen as normalized values.
+      *
+      * So the whole screen is 0.0, 0.0, 1.0, 1.0.
+      */
+     DFBResult (*SetScreenLocation) (
+          IDirectFBDisplayLayer              *thiz,
+          float                               x,
+          float                               y,
+          float                               width,
+          float                               height
+     );
+
+     /*
+      * Set location on screen in pixels.
+      */
+     DFBResult (*SetScreenPosition) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 x,
+          int                                 y
+     );
+
+     /*
+      * Set location on screen in pixels.
+      */
+     DFBResult (*SetScreenRectangle) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 x,
+          int                                 y,
+          int                                 width,
+          int                                 height
+     );
+
+
+   /** Misc Settings **/
+
+     /*
+      * Set global alpha factor for blending with layer(s) below.
+      */
+     DFBResult (*SetOpacity) (
+          IDirectFBDisplayLayer              *thiz,
+          u8                                  opacity
+     );
+
+     /*
+      * Set the source rectangle.
+      *
+      * Only this part of the layer will be displayed.
+      */
+     DFBResult (*SetSourceRectangle) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 x,
+          int                                 y,
+          int                                 width,
+          int                                 height
+     );
+
+     /*
+      * For an interlaced display, this sets the field parity.
+      *
+      * field: 0 for top field first, and 1 for bottom field first.
+      */
+     DFBResult (*SetFieldParity) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 field
+     );
+
+     /*
+      * Set the clipping region(s).
+      *
+      * If supported, this method sets the clipping <b>regions</b> that are used to
+      * to enable or disable visibility of parts of the layer. The <b>num_regions</b>
+      * must not exceed the limit as stated in the display layer description.
+      *
+      * If <b>positive</b> is DFB_TRUE the layer will be shown only in these regions,
+      * otherwise it's shown as usual except in these regions.
+      *
+      * Also see IDirectFBDisplayLayer::GetDescription().
+      */
+     DFBResult (*SetClipRegions) (
+          IDirectFBDisplayLayer              *thiz,
+          const DFBRegion                    *regions,
+          int                                 num_regions,
+          DFBBoolean                          positive
+     );
+
+
+   /** Color keys **/
+
+     /*
+      * Set the source color key.
+      *
+      * If a pixel of the layer matches this color the underlying
+      * pixel is visible at this point.
+      */
+     DFBResult (*SetSrcColorKey) (
+          IDirectFBDisplayLayer              *thiz,
+          u8                                  r,
+          u8                                  g,
+          u8                                  b
+     );
+
+     /*
+      * Set the destination color key.
+      *
+      * The layer is only visible at points where the underlying
+      * pixel matches this color.
+      */
+     DFBResult (*SetDstColorKey) (
+          IDirectFBDisplayLayer              *thiz,
+          u8                                  r,
+          u8                                  g,
+          u8                                  b
+     );
+
+
+   /** Z Order **/
+
+     /*
+      * Get the current display layer level.
+      *
+      * The level describes the z axis position of a layer. The
+      * primary layer is always on level zero unless a special
+      * driver adds support for level adjustment on the primary
+      * layer.  Layers above have a positive level, e.g. video
+      * overlays.  Layers below have a negative level, e.g. video
+      * underlays or background layers.
+      */
+     DFBResult (*GetLevel) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                *ret_level
+     );
+
+     /*
+      * Set the display layer level.
+      *
+      * Moves the layer to the specified level. The order of all
+      * other layers won't be changed. Note that only a few
+      * layers support level adjustment which is reflected by
+      * their capabilities.
+      */
+     DFBResult (*SetLevel) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 level
+     );
+
+
+   /** Background handling **/
+
+     /*
+      * Set the erase behaviour for windowstack repaints.
+      *
+      * Only available in exclusive or administrative mode.
+      */
+     DFBResult (*SetBackgroundMode) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBDisplayLayerBackgroundMode       mode
+     );
+
+     /*
+      * Set the background image for the imaged background mode.
+      *
+      * Only available in exclusive or administrative mode.
+      */
+     DFBResult (*SetBackgroundImage) (
+          IDirectFBDisplayLayer              *thiz,
+          IDirectFBSurface                   *surface
+     );
+
+     /*
+      * Set the color for a solid colored background.
+      *
+      * Only available in exclusive or administrative mode.
+      */
+     DFBResult (*SetBackgroundColor) (
+          IDirectFBDisplayLayer              *thiz,
+          u8                                  r,
+          u8                                  g,
+          u8                                  b,
+          u8                                  a
+     );
+
+   /** Color adjustment **/
+
+     /*
+      * Get the layers color adjustment.
+      */
+     DFBResult (*GetColorAdjustment) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBColorAdjustment                 *ret_adj
+     );
+
+     /*
+      * Set the layers color adjustment.
+      *
+      * Only available in exclusive or administrative mode.
+      *
+      * This function only has an effect if the underlying
+      * hardware supports this operation. Check the layers
+      * capabilities to find out if this is the case.
+      */
+     DFBResult (*SetColorAdjustment) (
+          IDirectFBDisplayLayer              *thiz,
+          const DFBColorAdjustment           *adj
+     );
+
+
+   /** Windows **/
+
+     /*
+      * Create a window within this layer given a
+      * description of the window that is to be created.
+      */
+     DFBResult (*CreateWindow) (
+          IDirectFBDisplayLayer              *thiz,
+          const DFBWindowDescription         *desc,
+          IDirectFBWindow                   **ret_interface
+     );
+
+     /*
+      * Retrieve an interface to an existing window.
+      *
+      * The window is identified by its window id.
+      */
+     DFBResult (*GetWindow) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBWindowID                         window_id,
+          IDirectFBWindow                   **ret_interface
+     );
+
+
+   /** Cursor handling **/
+
+     /*
+      * Enable/disable the mouse cursor for this layer.
+      *
+      * Windows on a layer will only receive motion events if
+      * the cursor is enabled. This function is only available
+      * in exclusive/administrative mode.
+      */
+     DFBResult (*EnableCursor) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 enable
+     );
+
+     /*
+      * Returns the x/y coordinates of the layer's mouse cursor.
+      */
+     DFBResult (*GetCursorPosition) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                *ret_x,
+          int                                *ret_y
+     );
+
+     /*
+      * Move cursor to specified position.
+      *
+      * Handles movement like a real one, i.e. generates events.
+      */
+     DFBResult (*WarpCursor) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 x,
+          int                                 y
+     );
+
+     /*
+      * Set cursor acceleration.
+      *
+      * Sets the acceleration of cursor movements. The amount
+      * beyond the 'threshold' will be multiplied with the
+      * acceleration factor. The acceleration factor is
+      * 'numerator/denominator'.
+      */
+     DFBResult (*SetCursorAcceleration) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 numerator,
+          int                                 denominator,
+          int                                 threshold
+     );
+
+     /*
+      * Set the cursor shape and the hotspot.
+      */
+     DFBResult (*SetCursorShape) (
+          IDirectFBDisplayLayer              *thiz,
+          IDirectFBSurface                   *shape,
+          int                                 hot_x,
+          int                                 hot_y
+     );
+
+     /*
+      * Set the cursor opacity.
+      *
+      * This function is especially useful if you want
+      * to hide the cursor but still want windows on this
+      * display layer to receive motion events. In this
+      * case, simply set the cursor opacity to zero.
+      */
+     DFBResult (*SetCursorOpacity) (
+          IDirectFBDisplayLayer              *thiz,
+          u8                                  opacity
+     );
+
+
+   /** Synchronization **/
+
+     /*
+      * Wait for next vertical retrace.
+      */
+     DFBResult (*WaitForSync) (
+          IDirectFBDisplayLayer              *thiz
+     );
+
+
+   /** Contexts **/
+
+     /*
+      * Switch the layer context.
+      *
+      * Switches to the shared context unless <b>exclusive</b> is DFB_TRUE
+      * and the cooperative level of this interface is DLSCL_EXCLUSIVE.
+      */
+     DFBResult (*SwitchContext) (
+          IDirectFBDisplayLayer              *thiz,
+          DFBBoolean                          exclusive
+     );
+
+
+   /** Rotation **/
+
+     /*
+      * Set the rotation of data within the layer.
+      *
+      * Only available in exclusive or administrative mode.
+      *
+      * Any <b>rotation</b> other than 0, 90, 180 or 270 is not supported.
+      *
+      * No layer hardware feature usage, only rotated blitting is used.
+      */
+     DFBResult (*SetRotation) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                 rotation
+     );
+
+     /*
+      * Get the rotation of data within the layer.
+      */
+     DFBResult (*GetRotation) (
+          IDirectFBDisplayLayer              *thiz,
+          int                                *ret_rotation
+     );
+
+
+   /** Windows **/
+
+     /*
+      * Retrieve an interface to an existing window.
+      *
+      * The window is identified by its surface' resource id.
+      */
+     DFBResult (*GetWindowByResourceID) (
+          IDirectFBDisplayLayer              *thiz,
+          unsigned long                       resource_id,
+          IDirectFBWindow                   **ret_interface
+     );
+)
+
+
+/*
+ * Flipping flags controlling the behaviour of IDirectFBSurface::Flip().
+ */
+typedef enum {
+     DSFLIP_NONE         = 0x00000000,  /* None of these. */
+
+     DSFLIP_WAIT         = 0x00000001,  /* Flip() returns upon vertical sync. Flipping is still done
+                                           immediately unless DSFLIP_ONSYNC is specified, too.  */
+     DSFLIP_BLIT         = 0x00000002,  /* Copy from back buffer to front buffer rather than
+                                           just swapping these buffers. This behaviour is enforced
+                                           if the region passed to Flip() is not NULL or if the
+                                           surface being flipped is a sub surface. */
+     DSFLIP_ONSYNC       = 0x00000004,  /* Do the actual flipping upon the next vertical sync.
+                                           The Flip() method will still return immediately unless
+                                           DSFLIP_WAIT is specified, too. */
+
+     DSFLIP_PIPELINE     = 0x00000008,
+
+     DSFLIP_ONCE         = 0x00000010,
+
+     DSFLIP_WAITFORSYNC  = DSFLIP_WAIT | DSFLIP_ONSYNC
+} DFBSurfaceFlipFlags;
+
+/*
+ * Flags controlling the text layout.
+ */
+typedef enum {
+     DSTF_LEFT           = 0x00000000,  /* left aligned */
+     DSTF_CENTER         = 0x00000001,  /* horizontally centered */
+     DSTF_RIGHT          = 0x00000002,  /* right aligned */
+
+     DSTF_TOP            = 0x00000004,  /* y specifies the top
+                                           instead of the baseline */
+     DSTF_BOTTOM         = 0x00000008,  /* y specifies the bottom
+                                           instead of the baseline */
+
+     DSTF_OUTLINE        = 0x00000010,  /* enables outline rendering if loaded font supports it */
+
+     DSTF_TOPLEFT        = DSTF_TOP | DSTF_LEFT,
+     DSTF_TOPCENTER      = DSTF_TOP | DSTF_CENTER,
+     DSTF_TOPRIGHT       = DSTF_TOP | DSTF_RIGHT,
+
+     DSTF_BOTTOMLEFT     = DSTF_BOTTOM | DSTF_LEFT,
+     DSTF_BOTTOMCENTER   = DSTF_BOTTOM | DSTF_CENTER,
+     DSTF_BOTTOMRIGHT    = DSTF_BOTTOM | DSTF_RIGHT
+} DFBSurfaceTextFlags;
+
+/*
+ * Flags defining the type of data access.
+ * These are important for surface swapping management.
+ */
+typedef enum {
+     DSLF_READ           = 0x00000001,  /* request read access while
+                                           surface is locked */
+     DSLF_WRITE          = 0x00000002   /* Request write access. If 
+                                           specified and surface has 
+                                           a back buffer, it will be 
+                                           used. Otherwise, the front 
+                                           buffer is used. */
+} DFBSurfaceLockFlags;
+
+/*
+ * Available Porter/Duff rules.
+ */
+typedef enum {
+                               /* pixel = (source * fs + destination * fd),
+                                  sa = source alpha,
+                                  da = destination alpha */
+     DSPD_NONE           =  0, /* fs: sa      fd: 1.0-sa (defaults) */
+     DSPD_CLEAR          =  1, /* fs: 0.0     fd: 0.0    */
+     DSPD_SRC            =  2, /* fs: 1.0     fd: 0.0    */
+     DSPD_SRC_OVER       =  3, /* fs: 1.0     fd: 1.0-sa */
+     DSPD_DST_OVER       =  4, /* fs: 1.0-da  fd: 1.0    */
+     DSPD_SRC_IN         =  5, /* fs: da      fd: 0.0    */
+     DSPD_DST_IN         =  6, /* fs: 0.0     fd: sa     */
+     DSPD_SRC_OUT        =  7, /* fs: 1.0-da  fd: 0.0    */
+     DSPD_DST_OUT        =  8, /* fs: 0.0     fd: 1.0-sa */
+     DSPD_SRC_ATOP       =  9, /* fs: da      fd: 1.0-sa */
+     DSPD_DST_ATOP       = 10, /* fs: 1.0-da  fd: sa     */
+     DSPD_ADD            = 11, /* fs: 1.0     fd: 1.0    */
+     DSPD_XOR            = 12, /* fs: 1.0-da  fd: 1.0-sa */
+} DFBSurfacePorterDuffRule;
+
+/*
+ * Blend functions to use for source and destination blending
+ */
+typedef enum {
+     /*
+      * pixel color = sc * cf[sf] + dc * cf[df]
+      * pixel alpha = sa * af[sf] + da * af[df]
+      * sc = source color
+      * sa = source alpha
+      * dc = destination color
+      * da = destination alpha
+      * sf = source blend function
+      * df = destination blend function
+      * cf[x] = color factor for blend function x
+      * af[x] = alpha factor for blend function x
+      */
+     DSBF_UNKNOWN            = 0,  /*                             */
+     DSBF_ZERO               = 1,  /* cf:    0           af:    0 */
+     DSBF_ONE                = 2,  /* cf:    1           af:    1 */
+     DSBF_SRCCOLOR           = 3,  /* cf:   sc           af:   sa */
+     DSBF_INVSRCCOLOR        = 4,  /* cf: 1-sc           af: 1-sa */
+     DSBF_SRCALPHA           = 5,  /* cf:   sa           af:   sa */
+     DSBF_INVSRCALPHA        = 6,  /* cf: 1-sa           af: 1-sa */
+     DSBF_DESTALPHA          = 7,  /* cf:   da           af:   da */
+     DSBF_INVDESTALPHA       = 8,  /* cf: 1-da           af: 1-da */
+     DSBF_DESTCOLOR          = 9,  /* cf:   dc           af:   da */
+     DSBF_INVDESTCOLOR       = 10, /* cf: 1-dc           af: 1-da */
+     DSBF_SRCALPHASAT        = 11, /* cf: min(sa, 1-da)  af:    1 */
+} DFBSurfaceBlendFunction;
+
+/*
+ * Transformed vertex of a textured triangle.
+ */
+typedef struct {
+     float x;   /* Destination X coordinate (in pixels) */
+     float y;   /* Destination Y coordinate (in pixels) */
+     float z;   /* Z coordinate */
+     float w;   /* W coordinate */
+
+     float s;   /* Texture S coordinate */
+     float t;   /* Texture T coordinate */
+} DFBVertex;
+
+/*
+ * Way of building triangles from the list of vertices.
+ */
+typedef enum {
+     DTTF_LIST,  /* 0/1/2  3/4/5  6/7/8 ... */
+     DTTF_STRIP, /* 0/1/2  1/2/3  2/3/4 ... */
+     DTTF_FAN    /* 0/1/2  0/2/3  0/3/4 ... */
+} DFBTriangleFormation;
+
+/*
+ * Flags controlling surface masks set via IDirectFBSurface::SetSourceMask().
+ */
+typedef enum {
+     DSMF_NONE      = 0x00000000,  /* None of these. */
+
+     DSMF_STENCIL   = 0x00000001,  /* Take <b>x</b> and <b>y</b> as fixed start coordinates in the mask. */
+
+     DSMF_ALL       = 0x00000001,  /* All of these. */
+} DFBSurfaceMaskFlags;
+
+/********************
+ * IDirectFBSurface *
+ ********************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBSurface,
+
+   /** Retrieving information **/
+
+     /*
+      * Return the capabilities of this surface.
+      */
+     DFBResult (*GetCapabilities) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceCapabilities   *ret_caps
+     );
+
+     /*
+      * Get the surface's position in pixels.
+      */
+     DFBResult (*GetPosition) (
+          IDirectFBSurface         *thiz,
+          int                      *ret_x,
+          int                      *ret_y
+     );
+
+     /*
+      * Get the surface's width and height in pixels.
+      */
+     DFBResult (*GetSize) (
+          IDirectFBSurface         *thiz,
+          int                      *ret_width,
+          int                      *ret_height
+     );
+
+     /*
+      * Created sub surfaces might be clipped by their parents,
+      * this function returns the resulting rectangle relative
+      * to this surface.
+      *
+      * For non sub surfaces this function returns
+      * { 0, 0, width, height }.
+      */
+     DFBResult (*GetVisibleRectangle) (
+          IDirectFBSurface         *thiz,
+          DFBRectangle             *ret_rect
+     );
+
+     /*
+      * Get the current pixel format.
+      */
+     DFBResult (*GetPixelFormat) (
+          IDirectFBSurface         *thiz,
+          DFBSurfacePixelFormat    *ret_format
+     );
+
+     /*
+      * Get a mask of drawing functions that are hardware
+      * accelerated with the current settings.
+      *
+      * If a source surface is specified the mask will also
+      * contain accelerated blitting functions.  Note that there
+      * is no guarantee that these will actually be accelerated
+      * since the surface storage (video/system) is examined only
+      * when something actually gets drawn or blitted.
+      */
+     DFBResult (*GetAccelerationMask) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *source,
+          DFBAccelerationMask      *ret_mask
+     );
+
+
+   /** Palette & Alpha Ramp **/
+
+     /*
+      * Get access to the surface's palette.
+      *
+      * Returns an interface that can be used to gain
+      * read and/or write access to the surface's palette.
+      */
+     DFBResult (*GetPalette) (
+          IDirectFBSurface         *thiz,
+          IDirectFBPalette        **ret_interface
+     );
+
+     /*
+      * Change the surface's palette.
+      */
+     DFBResult (*SetPalette) (
+          IDirectFBSurface         *thiz,
+          IDirectFBPalette         *palette
+     );
+
+     /*
+      * Set the alpha ramp for formats with one or two alpha bits.
+      *
+      * Either all four values or the first and the
+      * last one are used, depending on the format.
+      * Default values are: 0x00, 0x55, 0xaa, 0xff.
+      */
+     DFBResult (*SetAlphaRamp) (
+          IDirectFBSurface         *thiz,
+          u8                        a0,
+          u8                        a1,
+          u8                        a2,
+          u8                        a3
+     );
+
+
+   /** Buffer operations **/
+
+     /*
+      * Lock the surface for the access type specified.
+      *
+      * Returns a data pointer and the line pitch of it.<br>
+      * <br>
+      * <b>Note:</b> If the surface is double/triple buffered and 
+      * the DSLF_WRITE flag is specified, the pointer is to the back 
+      * buffer.  In all other cases, the pointer is to the front 
+      * buffer.
+      */
+     DFBResult (*Lock) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceLockFlags       flags,
+          void                    **ret_ptr,
+          int                      *ret_pitch
+     );
+
+     /*
+      * Returns the framebuffer offset of a locked surface.
+      *
+      * The surface must exist in video memory.
+      */
+     DFBResult (*GetFramebufferOffset) (
+          IDirectFBSurface *thiz,
+          int              *offset
+     );
+
+     /*
+      * Unlock the surface after direct access.
+      */
+     DFBResult (*Unlock) (
+          IDirectFBSurface         *thiz
+     );
+
+     /*
+      * Flip/Update surface buffers.
+      *
+      * If no region is specified the whole surface is flipped,
+      * otherwise blitting is used to update the region.
+      * If surface capabilities don't include DSCAPS_FLIPPING,
+      * this method has the effect to make visible changes
+      * made to the surface contents.
+      */
+     DFBResult (*Flip) (
+          IDirectFBSurface         *thiz,
+          const DFBRegion          *region,
+          DFBSurfaceFlipFlags       flags
+     );
+
+     /*
+      * Set the active field.
+      *
+      * Interlaced surfaces consist of two fields. Software driven
+      * deinterlacing uses this method to manually switch the field
+      * that is displayed, e.g. scaled up vertically by two.
+      */
+     DFBResult (*SetField) (
+          IDirectFBSurface         *thiz,
+          int                       field
+     );
+
+     /*
+      * Clear the surface and its depth buffer if existent.
+      *
+      * Fills the whole (sub) surface with the specified color while ignoring
+      * drawing flags and color of the current state, but limited to the current clip.
+      *
+      * As with all drawing and blitting functions the backbuffer is written to.
+      * If you are initializing a double buffered surface you may want to clear both
+      * buffers by doing a Clear-Flip-Clear sequence.
+      */
+     DFBResult (*Clear) (
+          IDirectFBSurface         *thiz,
+          u8                        r,
+          u8                        g,
+          u8                        b,
+          u8                        a
+     );
+
+
+   /** Drawing/blitting control **/
+
+     /*
+      * Set the clipping region used to limit the area for
+      * drawing, blitting and text functions.
+      *
+      * If no region is specified (NULL passed) the clip is set
+      * to the surface extents (initial clip).
+      */
+     DFBResult (*SetClip) (
+          IDirectFBSurface         *thiz,
+          const DFBRegion          *clip
+     );
+
+     /*
+      * Get the clipping region used to limit the area for
+      * drawing, blitting and text functions.
+      */
+     DFBResult (*GetClip) (
+          IDirectFBSurface         *thiz,
+          DFBRegion                *ret_clip
+     );
+
+     /*
+      * Set the color used for drawing/text functions or
+      * alpha/color modulation (blitting functions).
+      *
+      * If you are not using the alpha value it should be set to
+      * 0xff to ensure visibility when the code is ported to or
+      * used for surfaces with an alpha channel.
+      *
+      * This method should be avoided for surfaces with an indexed
+      * pixelformat, e.g. DSPF_LUT8, otherwise an expensive search
+      * in the color/alpha lookup table occurs.
+      */
+     DFBResult (*SetColor) (
+          IDirectFBSurface         *thiz,
+          u8                        r,
+          u8                        g,
+          u8                        b,
+          u8                        a
+     );
+
+     /*
+      * Set the color like with SetColor() but using
+      * an index to the color/alpha lookup table.
+      *
+      * This method is only supported by surfaces with an
+      * indexed pixelformat, e.g. DSPF_LUT8. For these formats
+      * this method should be used instead of SetColor().
+      */
+     DFBResult (*SetColorIndex) (
+          IDirectFBSurface         *thiz,
+          unsigned int              index
+     );
+
+     /*
+      * Set the blend function that applies to the source.
+      */
+     DFBResult (*SetSrcBlendFunction) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceBlendFunction   function
+     );
+
+     /*
+      * Set the blend function that applies to the destination.
+      */
+     DFBResult (*SetDstBlendFunction) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceBlendFunction   function
+     );
+
+     /*
+      * Set the source and destination blend function by
+      * specifying a Porter/Duff rule.
+      */
+     DFBResult (*SetPorterDuff) (
+          IDirectFBSurface         *thiz,
+          DFBSurfacePorterDuffRule  rule
+     );
+
+     /*
+      * Set the source color key, i.e. the color that is excluded
+      * when blitting FROM this surface TO another that has
+      * source color keying enabled.
+      */
+     DFBResult (*SetSrcColorKey) (
+          IDirectFBSurface         *thiz,
+          u8                        r,
+          u8                        g,
+          u8                        b
+     );
+
+     /*
+      * Set the source color key like with SetSrcColorKey() but using
+      * an index to the color/alpha lookup table.
+      *
+      * This method is only supported by surfaces with an
+      * indexed pixelformat, e.g. DSPF_LUT8. For these formats
+      * this method should be used instead of SetSrcColorKey().
+      */
+     DFBResult (*SetSrcColorKeyIndex) (
+          IDirectFBSurface         *thiz,
+          unsigned int              index
+     );
+
+     /*
+      * Set the destination color key, i.e. the only color that
+      * gets overwritten by drawing and blitting to this surface
+      * when destination color keying is enabled.
+      */
+     DFBResult (*SetDstColorKey) (
+          IDirectFBSurface         *thiz,
+          u8                        r,
+          u8                        g,
+          u8                        b
+     );
+
+     /*
+      * Set the destination color key like with SetDstColorKey() but using
+      * an index to the color/alpha lookup table.
+      *
+      * This method is only supported by surfaces with an
+      * indexed pixelformat, e.g. DSPF_LUT8. For these formats
+      * this method should be used instead of SetDstColorKey().
+      */
+     DFBResult (*SetDstColorKeyIndex) (
+          IDirectFBSurface         *thiz,
+          unsigned int              index
+     );
+
+
+
+   /** Blitting functions **/
+
+     /*
+      * Set the flags for all subsequent blitting commands.
+      */
+     DFBResult (*SetBlittingFlags) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceBlittingFlags   flags
+     );
+
+     /*
+      * Blit an area from the source to this surface.
+      *
+      * Pass a NULL rectangle to use the whole source surface.
+      * Source may be the same surface.
+      */
+     DFBResult (*Blit) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *source,
+          const DFBRectangle       *source_rect,
+          int                       x,
+          int                       y
+     );
+
+     /*
+      * Blit an area from the source tiled to this surface.
+      *
+      * Pass a NULL rectangle to use the whole source surface.
+      * Source may be the same surface.
+      */
+     DFBResult (*TileBlit) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *source,
+          const DFBRectangle       *source_rect,
+          int                       x,
+          int                       y
+     );
+
+     /*
+      * Blit a bunch of areas at once.
+      *
+      * Source may be the same surface.
+      */
+     DFBResult (*BatchBlit) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *source,
+          const DFBRectangle       *source_rects,
+          const DFBPoint           *dest_points,
+          int                       num
+     );
+
+     /*
+      * Blit an area scaled from the source to the destination
+      * rectangle.
+      *
+      * Pass a NULL rectangle to use the whole source surface.
+      */
+     DFBResult (*StretchBlit) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *source,
+          const DFBRectangle       *source_rect,
+          const DFBRectangle       *destination_rect
+     );
+
+     /*
+      * Preliminary texture mapping support.
+      *
+      * Maps a <b>texture</b> onto triangles being built
+      * from <b>vertices</b> according to the chosen <b>formation</b>.
+      *
+      * Optional <b>indices</b> can be used to avoid rearrangement of vertex lists,
+      * otherwise the vertex list is processed consecutively, i.e. as if <b>indices</b>
+      * are ascending numbers starting at zero.
+      *
+      * Either the number of <b>indices</b> (if non NULL) or the number of <b>vertices</b> is
+      * specified by <b>num</b> and has to be three at least. If the chosen <b>formation</b>
+      * is DTTF_LIST it also has to be a multiple of three.
+      */
+     DFBResult (*TextureTriangles) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *texture,
+          const DFBVertex          *vertices,
+          const int                *indices,
+          int                       num,
+          DFBTriangleFormation      formation
+     );
+
+
+   /** Drawing functions **/
+
+     /*
+      * Set the flags for all subsequent drawing commands.
+      */
+     DFBResult (*SetDrawingFlags) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceDrawingFlags    flags
+     );
+
+     /*
+      * Fill the specified rectangle with the given color
+      * following the specified flags.
+      */
+     DFBResult (*FillRectangle) (
+          IDirectFBSurface         *thiz,
+          int                       x,
+          int                       y,
+          int                       w,
+          int                       h
+     );
+
+     /*
+      * Draw an outline of the specified rectangle with the given
+      * color following the specified flags.
+      */
+     DFBResult (*DrawRectangle) (
+          IDirectFBSurface         *thiz,
+          int                       x,
+          int                       y,
+          int                       w,
+          int                       h
+     );
+
+     /*
+      * Draw a line from one point to the other with the given color
+      * following the drawing flags.
+      */
+     DFBResult (*DrawLine) (
+          IDirectFBSurface         *thiz,
+          int                       x1,
+          int                       y1,
+          int                       x2,
+          int                       y2
+     );
+
+     /*
+      * Draw 'num_lines' lines with the given color following the
+      * drawing flags. Each line specified by a DFBRegion.
+      */
+     DFBResult (*DrawLines) (
+          IDirectFBSurface         *thiz,
+          const DFBRegion          *lines,
+          unsigned int              num_lines
+     );
+
+     /*
+      * Fill a non-textured triangle.
+      */
+     DFBResult (*FillTriangle) (
+          IDirectFBSurface         *thiz,
+          int                       x1,
+          int                       y1,
+          int                       x2,
+          int                       y2,
+          int                       x3,
+          int                       y3
+     );
+
+     /*
+      * Fill a bunch of rectangles with a single call.
+      *
+      * Fill <b>num</b> rectangles with the current color following the
+      * drawing flags. Each rectangle specified by a DFBRectangle.
+      */
+     DFBResult (*FillRectangles) (
+          IDirectFBSurface         *thiz,
+          const DFBRectangle       *rects,
+          unsigned int              num
+     );
+
+     /*
+      * Fill spans specified by x and width.
+      *
+      * Fill <b>num</b> spans with the given color following the
+      * drawing flags. Each span is specified by a DFBSpan.
+      */
+     DFBResult (*FillSpans) (
+          IDirectFBSurface         *thiz,
+          int                       y,
+          const DFBSpan            *spans,
+          unsigned int              num
+     );
+     
+     /*
+      * Fill a bunch of triangles with a single call.
+      *
+      * Fill <b>num</b> triangles with the current color following the
+      * drawing flags. Each triangle specified by a DFBTriangle.
+      */
+     DFBResult (*FillTriangles) (
+          IDirectFBSurface         *thiz,
+          const DFBTriangle        *tris,
+          unsigned int              num
+     );
+
+
+   /** Text functions **/
+
+     /*
+      * Set the font used by DrawString() and DrawGlyph().
+      * You can pass NULL here to unset the font.
+      */
+     DFBResult (*SetFont) (
+          IDirectFBSurface         *thiz,
+          IDirectFBFont            *font
+     );
+
+     /*
+      * Get the font associated with a surface.
+      *
+      * This function increases the font's reference count.
+      */
+     DFBResult (*GetFont) (
+          IDirectFBSurface         *thiz,
+          IDirectFBFont           **ret_font
+     );
+
+     /*
+      * Draw a string at the specified position with the
+      * given color following the specified flags.
+      *
+      * Bytes specifies the number of bytes to take from the
+      * string or -1 for the complete NULL-terminated string. You
+      * need to set a font using the SetFont() method before
+      * calling this function.
+      */
+     DFBResult (*DrawString) (
+          IDirectFBSurface         *thiz,
+          const char               *text,
+          int                       bytes,
+          int                       x,
+          int                       y,
+          DFBSurfaceTextFlags       flags
+     );
+
+     /*
+      * Draw a single glyph specified by its character code at the
+      * specified position with the given color following the
+      * specified flags.
+      *
+      * If font was loaded with the DFFA_NOCHARMAP flag, index specifies
+      * the raw glyph index in the font.
+      *
+      * You need to set a font using the SetFont() method before
+      * calling this function.
+      */
+     DFBResult (*DrawGlyph) (
+          IDirectFBSurface         *thiz,
+          unsigned int              character,
+          int                       x,
+          int                       y,
+          DFBSurfaceTextFlags       flags
+     );
+
+     /*
+      * Change the encoding used for text rendering.
+      */
+     DFBResult (*SetEncoding) (
+          IDirectFBSurface         *thiz,
+          DFBTextEncodingID         encoding
+     );
+
+
+   /** Lightweight helpers **/
+
+     /*
+      * Get an interface to a sub area of this surface.
+      *
+      * No image data is duplicated, this is a clipped graphics
+      * within the original surface. This is very helpful for
+      * lightweight components in a GUI toolkit.  The new
+      * surface's state (color, drawingflags, etc.) is
+      * independent from this one. So it's a handy graphics
+      * context.  If no rectangle is specified, the whole surface
+      * (or a part if this surface is a subsurface itself) is
+      * represented by the new one.
+      */
+     DFBResult (*GetSubSurface) (
+          IDirectFBSurface         *thiz,
+          const DFBRectangle       *rect,
+          IDirectFBSurface        **ret_interface
+     );
+
+
+   /** OpenGL **/
+
+     /*
+      * Get a unique OpenGL context for this surface.
+      */
+     DFBResult (*GetGL) (
+          IDirectFBSurface         *thiz,
+          IDirectFBGL             **ret_interface
+     );
+
+
+   /** Debug **/
+
+     /*
+      * Dump the contents of the surface to one or two files.
+      *
+      * Creates a PPM file containing the RGB data and a PGM file with
+      * the alpha data if present.
+      *
+      * The complete filenames will be
+      * <b>directory</b>/<b>prefix</b>_<i>####</i>.ppm for RGB and
+      * <b>directory</b>/<b>prefix</b>_<i>####</i>.pgm for the alpha channel
+      * if present. Example: "/directory/prefix_0000.ppm". No existing files
+      * will be overwritten.
+      */
+     DFBResult (*Dump) (
+          IDirectFBSurface         *thiz,
+          const char               *directory,
+          const char               *prefix
+     );
+
+     /*
+      * Disable hardware acceleration.
+      *
+      * If any function in <b>mask</b> is set, acceleration will not be used for it.<br/>
+      * Default is DFXL_NONE.
+      */
+     DFBResult (*DisableAcceleration) (
+          IDirectFBSurface         *thiz,
+          DFBAccelerationMask       mask
+     );
+
+
+   /** Resources **/
+
+     /*
+      * Release possible reference to source surface.
+      *
+      * For performance reasons the last surface that has been used for Blit() and others stays
+      * attached to the state of the destination surface to save the overhead of reprogramming
+      * the same values each time.
+      *
+      * That leads to the last source being still around regardless of it being released
+      * via its own interface. The worst case is generation of thumbnails using StretchBlit()
+      * from a huge surface to a small one. The small thumbnail surface keeps the big one alive,
+      * because no other blitting will be done to the small surface afterwards.
+      *
+      * To solve this, here's the method applications should use in such a case.
+      */
+     DFBResult (*ReleaseSource) (
+          IDirectFBSurface         *thiz
+     );
+
+
+   /** Blitting control **/
+
+     /*
+      * Set index translation table.
+      *
+      * Set the translation table used for fast indexed to indexed
+      * pixel format conversion.
+      *
+      * A negative index means that the pixel will not be written.
+      *
+      * Undefined indices will be treated like negative ones.
+      */
+     DFBResult (*SetIndexTranslation) (
+          IDirectFBSurface         *thiz,
+          const int                *indices,
+          int                       num_indices
+     );
+
+
+   /** Rendering **/
+
+     /*
+      * Set options affecting the output of drawing and blitting operations.
+      *
+      * None of these is mandatory and therefore unsupported flags will not
+      * cause a software fallback.
+      */
+     DFBResult (*SetRenderOptions) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceRenderOptions   options
+     );
+
+
+   /** Drawing/blitting control **/
+
+     /*
+      * Set the transformation matrix.
+      *
+      * Enable usage of this matrix by setting DSRO_MATRIX via IDirectFBSurface::SetRenderOptions().
+      *
+      * The matrix consists of 3x3 fixed point 16.16 values.
+      * The order in the array is from left to right and from top to bottom.
+      *
+      * All drawing and blitting will be transformed:
+      *
+      * <pre>
+      *        X' = (X * v0 + Y * v1 + v2) / (X * v6 + Y * v7 + v8)
+      *        Y' = (X * v3 + Y * v4 + v5) / (X * v6 + Y * v7 + v8)
+      * </pre>
+      */
+     DFBResult (*SetMatrix) (
+          IDirectFBSurface         *thiz,
+          const s32                *matrix
+     );
+
+     /*
+      * Set the surface to be used as a mask for blitting.
+      *
+      * The <b>mask</b> applies when DSBLIT_SRC_MASK_ALPHA or DSBLIT_SRC_MASK_COLOR is used.
+      *
+      * Depending on the <b>flags</b> reading either starts at a fixed location in the mask with
+      * absolute <b>x</b> and <b>y</b>, or at the same location as in the source, with <b>x</b>
+      * and <b>y</b> used as an offset.
+      *
+      * <i>Example with DSMF_STENCIL:</i>
+      * <pre>
+      *        Blit from <b>19,  6</b> in the source
+      *              and <b> 0,  0</b> in the mask (<b>x =  0, y =  0</b>)
+      *               or <b>-5, 17</b>             (<b>x = -5, y = 17</b>)
+      *               or <b>23, 42</b>             (<b>x = 23, y = 42</b>)
+      * </pre>
+      *
+      * <i>Example without:</i>
+      * <pre>
+      *        Blit from <b>19,  6</b> in the source
+      *              and <b>19,  6</b> in the mask (<b>x =  0, y =  0</b>)
+      *               or <b>14, 23</b>             (<b>x = -5, y = 17</b>)
+      *               or <b>42, 48</b>             (<b>x = 23, y = 42</b>)
+      * </pre>
+      *
+      * See also IDirectFBSurface::SetBlittingFlags().
+      */
+     DFBResult (*SetSourceMask) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *mask,
+          int                       x,
+          int                       y,
+          DFBSurfaceMaskFlags       flags
+     );
+
+
+   /** Lightweight helpers **/
+
+     /*
+      * Make this a sub surface or adjust the rectangle of this sub surface.
+      */
+     DFBResult (*MakeSubSurface) (
+          IDirectFBSurface         *thiz,
+          IDirectFBSurface         *from,
+          const DFBRectangle       *rect
+     );
+
+
+   /** Direct Write/Read **/
+
+     /*
+      * Write to the surface without the need for (Un)Lock.
+      * 
+      * <b>rect</b> defines the area inside the surface.
+      * <br><b>ptr</b> and <b>pitch</b> specify the source.
+      * <br>The format of the surface and the source data must be the same.
+      */
+     DFBResult (*Write) (
+          IDirectFBSurface         *thiz,
+          const DFBRectangle       *rect,
+          const void               *ptr,
+          int                       pitch
+     );
+
+     /*
+      * Read from the surface without the need for (Un)Lock.
+      * 
+      * <b>rect</b> defines the area inside the surface to be read.
+      * <br><b>ptr</b> and <b>pitch</b> specify the destination.
+      * <br>The destination data will have the same format as the surface.
+      */
+     DFBResult (*Read) (
+          IDirectFBSurface         *thiz,
+          const DFBRectangle       *rect,
+          void                     *ptr,
+          int                       pitch
+     );
+
+
+   /** Drawing/blitting control **/
+
+     /*
+      * Sets color values used for drawing/text functions or
+      * alpha/color modulation (blitting functions).
+      */
+     DFBResult (*SetColors) (
+          IDirectFBSurface         *thiz,
+          const DFBColorID         *ids,
+          const DFBColor           *colors,
+          unsigned int              num
+     );
+)
+
+
+/********************
+ * IDirectFBPalette *
+ ********************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBPalette,
+
+   /** Retrieving information **/
+
+     /*
+      * Return the capabilities of this palette.
+      */
+     DFBResult (*GetCapabilities) (
+          IDirectFBPalette         *thiz,
+          DFBPaletteCapabilities   *ret_caps
+     );
+
+     /*
+      * Get the number of entries in the palette.
+      */
+     DFBResult (*GetSize) (
+          IDirectFBPalette         *thiz,
+          unsigned int             *ret_size
+     );
+
+
+   /** Palette entries **/
+
+     /*
+      * Write entries to the palette.
+      *
+      * Writes the specified number of entries to the palette at the
+      * specified offset.
+      */
+     DFBResult (*SetEntries) (
+          IDirectFBPalette         *thiz,
+          const DFBColor           *entries,
+          unsigned int              num_entries,
+          unsigned int              offset
+     );
+
+     /*
+      * Read entries from the palette.
+      *
+      * Reads the specified number of entries from the palette at the
+      * specified offset.
+      */
+     DFBResult (*GetEntries) (
+          IDirectFBPalette         *thiz,
+          DFBColor                 *ret_entries,
+          unsigned int              num_entries,
+          unsigned int              offset
+     );
+
+     /*
+      * Find the best matching entry.
+      *
+      * Searches the map for an entry which best matches the specified color.
+      */
+     DFBResult (*FindBestMatch) (
+          IDirectFBPalette         *thiz,
+          u8                        r,
+          u8                        g,
+          u8                        b,
+          u8                        a,
+          unsigned int             *ret_index
+     );
+
+
+   /** Clone **/
+
+     /*
+      * Create a copy of the palette.
+      */
+     DFBResult (*CreateCopy) (
+          IDirectFBPalette         *thiz,
+          IDirectFBPalette        **ret_interface
+     );
+
+
+   /** YUV Palette **/
+
+     /*
+      * Write entries to the palette.
+      *
+      * Writes the specified number of entries to the palette at the
+      * specified offset.
+      */
+     DFBResult (*SetEntriesYUV) (
+          IDirectFBPalette         *thiz,
+          const DFBColorYUV        *entries,
+          unsigned int              num_entries,
+          unsigned int              offset
+     );
+
+     /*
+      * Read entries from the palette.
+      *
+      * Reads the specified number of entries from the palette at the
+      * specified offset.
+      */
+     DFBResult (*GetEntriesYUV) (
+          IDirectFBPalette         *thiz,
+          DFBColorYUV              *ret_entries,
+          unsigned int              num_entries,
+          unsigned int              offset
+     );
+
+     /*
+      * Find the best matching entry.
+      *
+      * Searches the map for an entry which best matches the specified color.
+      */
+     DFBResult (*FindBestMatchYUV) (
+          IDirectFBPalette         *thiz,
+          u8                        y,
+          u8                        u,
+          u8                        v,
+          u8                        a,
+          unsigned int             *ret_index
+     );
+)
+
+
+/*
+ * Specifies whether a key is currently down.
+ */
+typedef enum {
+     DIKS_UP             = 0x00000000,  /* key is not pressed */
+     DIKS_DOWN           = 0x00000001   /* key is pressed */
+} DFBInputDeviceKeyState;
+
+/*
+ * Specifies whether a button is currently pressed.
+ */
+typedef enum {
+     DIBS_UP             = 0x00000000,  /* button is not pressed */
+     DIBS_DOWN           = 0x00000001   /* button is pressed */
+} DFBInputDeviceButtonState;
+
+/*
+ * Flags specifying which buttons are currently down.
+ */
+typedef enum {
+     DIBM_LEFT           = 0x00000001,  /* left mouse button */
+     DIBM_RIGHT          = 0x00000002,  /* right mouse button */
+     DIBM_MIDDLE         = 0x00000004   /* middle mouse button */
+} DFBInputDeviceButtonMask;
+
+/*
+ * Flags specifying which modifiers are currently pressed.
+ */
+typedef enum {
+     DIMM_SHIFT     = (1 << DIMKI_SHIFT),    /* Shift key is pressed */
+     DIMM_CONTROL   = (1 << DIMKI_CONTROL),  /* Control key is pressed */
+     DIMM_ALT       = (1 << DIMKI_ALT),      /* Alt key is pressed */
+     DIMM_ALTGR     = (1 << DIMKI_ALTGR),    /* AltGr key is pressed */
+     DIMM_META      = (1 << DIMKI_META),     /* Meta key is pressed */
+     DIMM_SUPER     = (1 << DIMKI_SUPER),    /* Super key is pressed */
+     DIMM_HYPER     = (1 << DIMKI_HYPER)     /* Hyper key is pressed */
+} DFBInputDeviceModifierMask;
+
+
+/************************
+ * IDirectFBInputDevice *
+ ************************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBInputDevice,
+
+   /** Retrieving information **/
+
+     /*
+      * Get the unique device ID.
+      */
+     DFBResult (*GetID) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceID              *ret_device_id
+     );
+
+     /*
+      * Get a description of this device, i.e. the capabilities.
+      */
+     DFBResult (*GetDescription) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceDescription     *ret_desc
+     );
+
+
+   /** Key mapping **/
+
+     /*
+      * Fetch one entry from the keymap for a specific hardware keycode.
+      */
+     DFBResult (*GetKeymapEntry) (
+          IDirectFBInputDevice          *thiz,
+          int                            keycode,
+          DFBInputDeviceKeymapEntry     *ret_entry
+     );
+
+     /*
+      * Set one entry of the keymap to the specified entry.
+      * Each entry has 4 modifier combinations for going from key to symbol.
+      */
+     DFBResult (*SetKeymapEntry) (
+          IDirectFBInputDevice          *thiz,
+          int                            keycode,
+          DFBInputDeviceKeymapEntry     *entry
+     );
+
+     /*
+      * Load a keymap from the specified file.
+      * All specified keys will overwrite the current keymap.
+      * On return of an error, the keymap is in an unspecified state.
+      * the file must be ASCII containing lines:
+      * keycode <hw code> = <key id> = <symbol> .... (up to 4 symbols)
+      * Modifier-key-sensitive keys can be framed between
+      * capslock: .... :capslock or numlock: ... :numlock.
+      */
+     DFBResult (*LoadKeymap) (
+          IDirectFBInputDevice          *thiz,
+          char                          *filename
+     );
+
+   /** Event buffers **/
+
+     /*
+      * Create an event buffer for this device and attach it.
+      */
+     DFBResult (*CreateEventBuffer) (
+          IDirectFBInputDevice          *thiz,
+          IDirectFBEventBuffer         **ret_buffer
+     );
+
+     /*
+      * Attach an existing event buffer to this device.
+      *
+      * NOTE: Attaching multiple times generates multiple events.
+      *
+      */
+     DFBResult (*AttachEventBuffer) (
+          IDirectFBInputDevice          *thiz,
+          IDirectFBEventBuffer          *buffer
+     );
+     
+     /*
+      * Detach an event buffer from this device.
+      */
+     DFBResult (*DetachEventBuffer) (
+          IDirectFBInputDevice          *thiz,
+          IDirectFBEventBuffer          *buffer
+     );
+
+
+   /** General state queries **/
+
+     /*
+      * Get the current state of one key.
+      */
+     DFBResult (*GetKeyState) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceKeyIdentifier    key_id,
+          DFBInputDeviceKeyState        *ret_state
+     );
+
+     /*
+      * Get the current modifier mask.
+      */
+     DFBResult (*GetModifiers) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceModifierMask    *ret_modifiers
+     );
+
+     /*
+      * Get the current state of the key locks.
+      */
+     DFBResult (*GetLockState) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceLockState       *ret_locks
+     );
+
+     /*
+      * Get a mask of currently pressed buttons.
+      *
+      * The first button corrensponds to the right most bit.
+      */
+     DFBResult (*GetButtons) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceButtonMask      *ret_buttons
+     );
+
+     /*
+      * Get the state of a button.
+      */
+     DFBResult (*GetButtonState) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceButtonIdentifier button,
+          DFBInputDeviceButtonState     *ret_state
+     );
+
+     /*
+      * Get the current value of the specified axis.
+      */
+     DFBResult (*GetAxis) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceAxisIdentifier   axis,
+          int                           *ret_pos
+     );
+
+
+   /** Specialized queries **/
+
+     /*
+      * Utility function combining two calls to GetAxis().
+      *
+      * You may leave one of the x/y arguments NULL.
+      */
+     DFBResult (*GetXY) (
+          IDirectFBInputDevice          *thiz,
+          int                           *ret_x,
+          int                           *ret_y
+     );
+
+
+   /** Configuration */
+
+     DFBResult (*SetSensitivity) (
+          IDirectFBInputDevice          *thiz,
+          int                            sensitivity
+     );
+
+
+   /** State */
+
+     DFBResult (*GetState) (
+          IDirectFBInputDevice          *thiz,
+          DFBInputDeviceState           *state
+     );
+)
+
+
+/*
+ * Event class.
+ */
+typedef enum {
+     DFEC_NONE           = 0x00,   /* none of these */
+     DFEC_INPUT          = 0x01,   /* raw input event */
+     DFEC_WINDOW         = 0x02,   /* windowing event */
+     DFEC_USER           = 0x03,   /* custom event for the user of this library */
+     DFEC_UNIVERSAL      = 0x04,   /* universal event for custom usage with variable size */
+     DFEC_VIDEOPROVIDER  = 0x05    /* video provider event */
+} DFBEventClass;
+
+/*
+ * The type of an input event.
+ */
+typedef enum {
+     DIET_UNKNOWN        = 0,      /* unknown event */
+     DIET_KEYPRESS,                /* a key is been pressed */
+     DIET_KEYRELEASE,              /* a key is been released */
+     DIET_BUTTONPRESS,             /* a (mouse) button is been pressed */
+     DIET_BUTTONRELEASE,           /* a (mouse) button is been released */
+     DIET_AXISMOTION               /* mouse/joystick movement */
+} DFBInputEventType;
+
+/*
+ * Flags defining which additional (optional) event fields are valid.
+ */
+typedef enum {
+     DIEF_NONE           = 0x0000,   /* no additional fields */
+     DIEF_TIMESTAMP      = 0x0001,   /* timestamp is valid */
+     DIEF_AXISABS        = 0x0002,   /* axis and axisabs are valid */
+     DIEF_AXISREL        = 0x0004,   /* axis and axisrel are valid */
+
+     DIEF_KEYCODE        = 0x0008,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_KEYID          = 0x0010,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_KEYSYMBOL      = 0x0020,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_MODIFIERS      = 0x0040,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_LOCKS          = 0x0080,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_BUTTONS        = 0x0100,   /* used internally by the input core,
+                                        always set at application level */
+     DIEF_GLOBAL         = 0x0200,   /* Only for event buffers creates by
+                                        IDirectFB::CreateInputEventBuffer()
+                                        with global events enabled.
+                                        Indicates that the event would have been
+                                        filtered if the buffer hadn't been
+                                        global. */
+     DIEF_REPEAT         = 0x0400,   /* repeated event, e.g. key or button press */
+     DIEF_FOLLOW         = 0x0800,   /* another event will follow immediately, e.g. x/y axis */
+
+     DIEF_MIN            = 0x1000,   /* minimum value is set, e.g. for absolute axis motion */
+     DIEF_MAX            = 0x2000,   /* maximum value is set, e.g. for absolute axis motion */
+} DFBInputEventFlags;
+
+/*
+ * An input event, item of an input buffer.
+ */
+typedef struct {
+     DFBEventClass                   clazz;      /* clazz of event */
+
+     DFBInputEventType               type;       /* type of event */
+     DFBInputDeviceID                device_id;  /* source of event */
+     DFBInputEventFlags              flags;      /* which optional fields
+                                                    are valid? */
+
+     /* additionally (check flags) */
+     struct timeval                  timestamp;  /* time of event creation */
+
+/* DIET_KEYPRESS, DIET_KEYRELEASE */
+     int                             key_code;   /* hardware keycode, no
+                                                    mapping, -1 if device
+                                                    doesn't differentiate
+                                                    between several keys */
+     DFBInputDeviceKeyIdentifier     key_id;     /* basic mapping,
+                                                    modifier independent */
+     DFBInputDeviceKeySymbol         key_symbol; /* advanced mapping,
+                                                    unicode compatible,
+                                                    modifier dependent */
+     /* additionally (check flags) */
+     DFBInputDeviceModifierMask      modifiers;  /* pressed modifiers
+                                                    (optional) */
+     DFBInputDeviceLockState         locks;      /* active locks
+                                                    (optional) */
+
+/* DIET_BUTTONPRESS, DIET_BUTTONRELEASE */
+     DFBInputDeviceButtonIdentifier  button;     /* in case of a button
+                                                    event */
+     DFBInputDeviceButtonMask        buttons;    /* mask of currently
+                                                    pressed buttons */
+
+/* DIET_AXISMOTION */
+     DFBInputDeviceAxisIdentifier    axis;       /* in case of an axis
+                                                    event */
+     /* one of these two (check flags) */
+     int                             axisabs;    /* absolute mouse/
+                                                    joystick coordinate */
+     int                             axisrel;    /* relative mouse/
+                                                    joystick movement */
+
+     /* general information */
+     int                             min;        /* minimum possible value */
+     int                             max;        /* maximum possible value */
+} DFBInputEvent;
+
+/*
+ * Window Event Types - can also be used as flags for event filters.
+ */
+typedef enum {
+     DWET_NONE           = 0x00000000,
+
+     DWET_POSITION       = 0x00000001,  /* window has been moved by
+                                           window manager or the
+                                           application itself */
+     DWET_SIZE           = 0x00000002,  /* window has been resized
+                                           by window manager or the
+                                           application itself */
+     DWET_CLOSE          = 0x00000004,  /* closing this window has been
+                                           requested only */
+     DWET_DESTROYED      = 0x00000008,  /* window got destroyed by global
+                                           deinitialization function or
+                                           the application itself */
+     DWET_GOTFOCUS       = 0x00000010,  /* window got focus */
+     DWET_LOSTFOCUS      = 0x00000020,  /* window lost focus */
+
+     DWET_KEYDOWN        = 0x00000100,  /* a key has gone down while
+                                           window has focus */
+     DWET_KEYUP          = 0x00000200,  /* a key has gone up while
+                                           window has focus */
+
+     DWET_BUTTONDOWN     = 0x00010000,  /* mouse button went down in
+                                           the window */
+     DWET_BUTTONUP       = 0x00020000,  /* mouse button went up in
+                                           the window */
+     DWET_MOTION         = 0x00040000,  /* mouse cursor changed its
+                                           position in window */
+     DWET_ENTER          = 0x00080000,  /* mouse cursor entered
+                                           the window */
+     DWET_LEAVE          = 0x00100000,  /* mouse cursor left the window */
+
+     DWET_WHEEL          = 0x00200000,  /* mouse wheel was moved while
+                                           window has focus */
+
+     DWET_POSITION_SIZE  = DWET_POSITION | DWET_SIZE,/* initially sent to
+                                                        window when it's
+                                                        created */
+
+     DWET_UPDATE         = 0x10000000,
+
+     DWET_ALL            = 0x103F033F   /* all event types */
+} DFBWindowEventType;
+
+/*
+ * Flags for a window event.
+ */
+typedef enum {
+     DWEF_NONE           = 0x00000000,  /* none of these */
+
+     DWEF_RETURNED       = 0x00000001,  /* This is a returned event, e.g. unconsumed key. */
+     DWEF_RELATIVE       = 0x00000002,  /* This is a relative motion event (confined mode) */
+     DWEF_REPEAT         = 0x00000004,  /* This is a repeated event (e.g. key repeat) */
+
+     DWEF_ALL            = 0x00000007   /* all of these */
+} DFBWindowEventFlags;
+
+/*
+ * Video Provider Event Types - can also be used as flags for event filters.
+ */
+typedef enum {
+     DVPET_NONE           = 0x00000000,
+     DVPET_STARTED        = 0x00000001,  /* The video provider has started the playback     */
+     DVPET_STOPPED        = 0x00000002,  /* The video provider has stopped the playback     */
+     DVPET_SPEEDCHANGE    = 0x00000004,  /* A speed change has occured                      */
+     DVPET_STREAMCHANGE   = 0x00000008,  /* A stream description change has occured         */
+     DVPET_FATALERROR     = 0x00000010,  /* A fatal error has occured: restart must be done */
+     DVPET_FINISHED       = 0x00000020,  /* The video provider has finished the playback    */
+     DVPET_SURFACECHANGE  = 0x00000040,  /* A surface description change has occured        */
+     DVPET_FRAMEDECODED   = 0x00000080,  /* A frame has been decoded by the decoder         */
+     DVPET_FRAMEDISPLAYED = 0x00000100,  /* A frame has been rendered to the output         */
+     DVPET_DATAEXHAUSTED  = 0x00000200,  /* There is no more data available for consumption */
+     DVPET_VIDEOACTION    = 0x00000400,  /* An action is required on the video provider     */
+     DVPET_DATALOW        = 0x00000800,  /* The stream buffer is running low in data (threshold defined by implementation). */
+     DVPET_DATAHIGH       = 0x00001000,  /* The stream buffer is high. */
+     DVPET_BUFFERTIMELOW  = 0x00002000,  /* The stream buffer has less than requested playout time buffered. */
+     DVPET_BUFFERTIMEHIGH = 0x00004000,  /* The stream buffer has more than requested playout time buffered. */
+     DVPET_ALL            = 0x00007FFF   /* All event types */
+} DFBVideoProviderEventType;
+
+/*
+ * Event from the windowing system.
+ */
+typedef struct {
+     DFBEventClass                   clazz;      /* clazz of event */
+
+     DFBWindowEventType              type;       /* type of event */
+     DFBWindowEventFlags             flags;      /* event flags */
+
+     DFBWindowID                     window_id;  /* source of event */
+
+     /* used by DWET_MOVE, DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
+        DWET_ENTER, DWET_LEAVE */
+     int                             x;          /* x position of window
+                                                    or coordinate within
+                                                    window */
+     int                             y;          /* y position of window
+                                                    or coordinate within
+                                                    window */
+
+     /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
+        DWET_ENTER, DWET_LEAVE */
+     int                             cx;         /* x cursor position */
+     int                             cy;         /* y cursor position */
+
+     /* used by DWET_WHEEL */
+     int                             step;       /* wheel step */
+
+     /* used by DWET_RESIZE */
+     int                             w;          /* width of window */
+     int                             h;          /* height of window */
+
+     /* used by DWET_KEYDOWN, DWET_KEYUP */
+     int                             key_code;   /* hardware keycode, no
+                                                    mapping, -1 if device
+                                                    doesn't differentiate
+                                                    between several keys */
+     DFBInputDeviceKeyIdentifier     key_id;     /* basic mapping,
+                                                    modifier independent */
+     DFBInputDeviceKeySymbol         key_symbol; /* advanced mapping,
+                                                    unicode compatible,
+                                                    modifier dependent */
+     DFBInputDeviceModifierMask      modifiers;  /* pressed modifiers */
+     DFBInputDeviceLockState         locks;      /* active locks */
+
+     /* used by DWET_BUTTONDOWN, DWET_BUTTONUP */
+     DFBInputDeviceButtonIdentifier  button;     /* button being
+                                                    pressed or released */
+     /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP */
+     DFBInputDeviceButtonMask        buttons;    /* mask of currently
+                                                    pressed buttons */
+
+     struct timeval                  timestamp;  /* always set */
+} DFBWindowEvent;
+
+/*
+ * Video Provider Event Types - can also be used as flags for event filters.
+ */
+typedef enum {
+     DVPEDST_UNKNOWN      = 0x00000000, /* Event is valid for unknown Data   */
+     DVPEDST_AUDIO        = 0x00000001, /* Event is valid for Audio Data     */
+     DVPEDST_VIDEO        = 0x00000002, /* Event is valid for Video Data     */
+     DVPEDST_DATA         = 0x00000004, /* Event is valid for Data types     */
+     DVPEDST_ALL          = 0x00000007, /* Event is valid for all Data types */
+
+} DFBVideoProviderEventDataSubType;
+
+/*
+ * Event from the video provider
+ */
+typedef struct {
+     DFBEventClass                    clazz;      /* clazz of event */
+
+     DFBVideoProviderEventType        type;       /* type of event */
+     DFBVideoProviderEventDataSubType data_type;  /* data type that this event is applicable for. */
+
+     int                              data[4];    /* custom data - large enough for 4 ints so that in most cases
+                                                     memory allocation will not be needed */
+} DFBVideoProviderEvent;
+
+/*
+ * Event for usage by the user of this library.
+ */
+typedef struct {
+     DFBEventClass                   clazz;      /* clazz of event */
+
+     unsigned int                    type;       /* custom type */
+     void                           *data;       /* custom data */
+} DFBUserEvent;
+
+/*
+ * Universal event for custom usage with variable size.
+ */
+typedef struct {
+     DFBEventClass                   clazz;      /* clazz of event (DFEC_UNIVERSAL) */
+     unsigned int                    size;       /* size of this event, minimum is sizeof(DFBUniversalEvent),
+                                                    e.g. 8 bytes (on 32bit architectures) */
+
+
+     /* custom data follows, size of this data is 'size' - sizeof(DFBUniversalEvent) */
+} DFBUniversalEvent;
+
+/*
+ * General container for a DirectFB Event.
+ */
+typedef union {
+     DFBEventClass                   clazz;         /* clazz of event */
+     DFBInputEvent                   input;         /* field for input events */
+     DFBWindowEvent                  window;        /* field for window events */
+     DFBUserEvent                    user;          /* field for user-defined events */
+     DFBUniversalEvent               universal;     /* field for universal events */
+     DFBVideoProviderEvent           videoprovider; /* field for video provider */
+} DFBEvent;
+
+#define DFB_EVENT(e)          ((DFBEvent *) (e))
+
+/*
+ * Statistics about event buffer queue.
+ */
+typedef struct {
+     unsigned int   num_events;              /* Total number of events in the queue. */
+
+     unsigned int   DFEC_INPUT;              /* Number of input events. */
+     unsigned int   DFEC_WINDOW;             /* Number of window events. */
+     unsigned int   DFEC_USER;               /* Number of user events. */
+     unsigned int   DFEC_UNIVERSAL;          /* Number of universal events. */
+     unsigned int   DFEC_VIDEOPROVIDER;      /* Number of universal events. */
+
+     unsigned int   DIET_KEYPRESS;
+     unsigned int   DIET_KEYRELEASE;
+     unsigned int   DIET_BUTTONPRESS;
+     unsigned int   DIET_BUTTONRELEASE;
+     unsigned int   DIET_AXISMOTION;
+
+     unsigned int   DWET_POSITION;
+     unsigned int   DWET_SIZE;
+     unsigned int   DWET_CLOSE;
+     unsigned int   DWET_DESTROYED;
+     unsigned int   DWET_GOTFOCUS;
+     unsigned int   DWET_LOSTFOCUS;
+     unsigned int   DWET_KEYDOWN;
+     unsigned int   DWET_KEYUP;
+     unsigned int   DWET_BUTTONDOWN;
+     unsigned int   DWET_BUTTONUP;
+     unsigned int   DWET_MOTION;
+     unsigned int   DWET_ENTER;
+     unsigned int   DWET_LEAVE;
+     unsigned int   DWET_WHEEL;
+     unsigned int   DWET_POSITION_SIZE;
+
+     unsigned int   DVPET_STARTED;
+     unsigned int   DVPET_STOPPED;
+     unsigned int   DVPET_SPEEDCHANGE;
+     unsigned int   DVPET_STREAMCHANGE;
+     unsigned int   DVPET_FATALERROR;
+     unsigned int   DVPET_FINISHED;
+     unsigned int   DVPET_SURFACECHANGE;
+     unsigned int   DVPET_FRAMEDECODED;
+     unsigned int   DVPET_FRAMEDISPLAYED;
+     unsigned int   DVPET_DATAEXHAUSTED;
+     unsigned int   DVPET_DATALOW;
+     unsigned int   DVPET_VIDEOACTION;
+     unsigned int   DVPET_DATAHIGH;
+     unsigned int   DVPET_BUFFERTIMELOW;
+     unsigned int   DVPET_BUFFERTIMEHIGH;
+} DFBEventBufferStats;
+
+
+/************************
+ * IDirectFBEventBuffer *
+ ************************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBEventBuffer,
+
+
+   /** Buffer handling **/
+
+     /*
+      * Clear all events stored in this buffer.
+      */
+     DFBResult (*Reset) (
+          IDirectFBEventBuffer     *thiz
+     );
+
+
+   /** Waiting for events **/
+
+     /*
+      * Wait for the next event to occur.
+      * Thread is idle in the meantime.
+      */
+     DFBResult (*WaitForEvent) (
+          IDirectFBEventBuffer     *thiz
+     );
+
+     /*
+      * Block until next event to occur or timeout is reached.
+      * Thread is idle in the meantime.
+      */
+     DFBResult (*WaitForEventWithTimeout) (
+          IDirectFBEventBuffer     *thiz,
+          unsigned int              seconds,
+          unsigned int              milli_seconds
+     );
+
+
+   /** Fetching events **/
+
+     /*
+      * Get the next event and remove it from the FIFO.
+      */
+     DFBResult (*GetEvent) (
+          IDirectFBEventBuffer     *thiz,
+          DFBEvent                 *ret_event
+     );
+
+     /*
+      * Get the next event but leave it there, i.e. do a preview.
+      */
+     DFBResult (*PeekEvent) (
+          IDirectFBEventBuffer     *thiz,
+          DFBEvent                 *ret_event
+     );
+
+     /*
+      * Check if there is a pending event in the queue. This
+      * function returns DFB_OK if there is at least one event,
+      * DFB_BUFFER_EMPTY otherwise.
+      */
+     DFBResult (*HasEvent) (
+          IDirectFBEventBuffer     *thiz
+     );
+
+
+   /** Sending events **/
+
+     /*
+      * Put an event into the FIFO.
+      *
+      * This function does not wait until the event got fetched.
+      */
+     DFBResult (*PostEvent) (
+          IDirectFBEventBuffer     *thiz,
+          const DFBEvent           *event
+     );
+
+     /*
+      * Wake up any thread waiting for events in this buffer.
+      *
+      * This method causes any IDirectFBEventBuffer::WaitForEvent() or
+      * IDirectFBEventBuffer::WaitForEventWithTimeout() call to return with DFB_INTERRUPTED.
+      *
+      * It should be used rather than sending wake up messages which
+      * may pollute the queue and consume lots of CPU and memory compared to
+      * this 'single code line method'.
+      */
+     DFBResult (*WakeUp) (
+          IDirectFBEventBuffer     *thiz
+     );
+
+
+   /** Special handling **/
+
+     /*
+      * Create a file descriptor for reading events.
+      *
+      * This method provides an alternative for reading events from an event buffer.
+      * It creates a file descriptor which can be used in select(), poll() or read().
+      *
+      * In general only non-threaded applications which already use select() or poll() need it.
+      *
+      * <b>Note:</b> This method flushes the event buffer. After calling this method all other
+      * methods except IDirectFBEventBuffer::PostEvent() will return DFB_UNSUPPORTED.
+      * Calling this method again will return DFB_BUSY.
+      */
+     DFBResult (*CreateFileDescriptor) (
+          IDirectFBEventBuffer     *thiz,
+          int                      *ret_fd
+     );
+
+
+   /** Statistics **/
+
+     /*
+      * Enable/disable collection of event buffer statistics.
+      */
+     DFBResult (*EnableStatistics) (
+          IDirectFBEventBuffer     *thiz,
+          DFBBoolean                enable
+     );
+
+     /*
+      * Query collected event buffer statistics.
+      */
+     DFBResult (*GetStatistics) (
+          IDirectFBEventBuffer     *thiz,
+          DFBEventBufferStats      *ret_stats
+     );
+)
+
+/*
+ * The key selection defines a mode for filtering keys while the window is having the focus.
+ */
+typedef enum {
+     DWKS_ALL            = 0x00000000,  /* Select all keys (default). */
+     DWKS_NONE           = 0x00000001,  /* Don't select any key. */
+     DWKS_LIST           = 0x00000002   /* Select a list of keys. */
+} DFBWindowKeySelection;
+
+typedef enum {
+     DWGM_DEFAULT        = 0x00000000,  /* Use default values. */
+     DWGM_FOLLOW         = 0x00000001,  /* Use values of parent window. */
+     DWGM_RECTANGLE      = 0x00000002,  /* Use pixel values as defined. */
+     DWGM_LOCATION       = 0x00000003   /* Use relative values as defined. */
+} DFBWindowGeometryMode;
+
+typedef struct {
+     DFBWindowGeometryMode    mode;
+
+     DFBRectangle             rectangle;
+     DFBLocation              location;
+} DFBWindowGeometry;
+
+typedef enum {
+     DWCF_NONE           = 0x00000000,
+
+     DWCF_RELATIVE       = 0x00000001,
+     DWCF_EXPLICIT       = 0x00000002,
+     DWCF_UNCLIPPED      = 0x00000004,
+     DWCF_TRAPPED        = 0x00000008,
+     DWCF_FIXED          = 0x00000010,
+     DWCF_INVISIBLE      = 0x00000020,
+
+     DWCF_ALL            = 0x0000003F
+} DFBWindowCursorFlags;
+
+/*******************
+ * IDirectFBWindow *
+ *******************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBWindow,
+
+   /** Retrieving information **/
+
+     /*
+      * Get the unique window ID.
+      */
+     DFBResult (*GetID) (
+          IDirectFBWindow               *thiz,
+          DFBWindowID                   *ret_window_id
+     );
+
+     /*
+      * Get the current position of this window.
+      */
+     DFBResult (*GetPosition) (
+          IDirectFBWindow               *thiz,
+          int                           *ret_x,
+          int                           *ret_y
+     );
+
+     /*
+      * Get the size of the window in pixels.
+      */
+     DFBResult (*GetSize) (
+          IDirectFBWindow               *thiz,
+          int                           *ret_width,
+          int                           *ret_height
+     );
+
+
+   /** Close & Destroy **/
+
+     /*
+      * Send a close message to the window.
+      *
+      * This function sends a message of type DWET_CLOSE to the window.
+      * It does NOT actually close it.
+      */
+     DFBResult (*Close) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Destroys the window and sends a destruction message.
+      *
+      * This function sends a message of type DWET_DESTROY to
+      * the window after removing it from the window stack and
+      * freeing its data.  Some functions called from this
+      * interface will return DFB_DESTROYED after that.
+      */
+     DFBResult (*Destroy) (
+          IDirectFBWindow               *thiz
+     );
+
+
+   /** Surface & Scaling **/
+
+     /*
+      * Get an interface to the backing store surface.
+      *
+      * This surface has to be flipped to make previous drawing
+      * commands visible, i.e. to repaint the windowstack for
+      * that region.
+      */
+     DFBResult (*GetSurface) (
+          IDirectFBWindow               *thiz,
+          IDirectFBSurface             **ret_surface
+     );
+
+     /*
+      * Resize the surface of a scalable window.
+      *
+      * This requires the option DWOP_SCALE.
+      * See IDirectFBWindow::SetOptions().
+      */
+     DFBResult (*ResizeSurface) (
+          IDirectFBWindow               *thiz,
+          int                            width,
+          int                            height
+     );
+
+
+   /** Events **/
+
+     /*
+      * Create an event buffer for this window and attach it.
+      */
+     DFBResult (*CreateEventBuffer) (
+          IDirectFBWindow               *thiz,
+          IDirectFBEventBuffer         **ret_buffer
+     );
+
+     /*
+      * Attach an existing event buffer to this window.
+      *
+      * NOTE: Attaching multiple times generates multiple events.
+      *
+      */
+     DFBResult (*AttachEventBuffer) (
+          IDirectFBWindow               *thiz,
+          IDirectFBEventBuffer          *buffer
+     );
+     
+     /*
+      * Detach an event buffer from this window.
+      */
+     DFBResult (*DetachEventBuffer) (
+          IDirectFBWindow               *thiz,
+          IDirectFBEventBuffer          *buffer
+     );
+
+     /*
+      * Enable specific events to be sent to the window.
+      *
+      * The argument is a mask of events that will be set in the
+      * window's event mask. The default event mask is DWET_ALL.
+      */
+     DFBResult (*EnableEvents) (
+          IDirectFBWindow               *thiz,
+          DFBWindowEventType             mask
+     );
+
+     /*
+      * Disable specific events from being sent to the window.
+      *
+      * The argument is a mask of events that will be cleared in
+      * the window's event mask. The default event mask is DWET_ALL.
+      */
+     DFBResult (*DisableEvents) (
+          IDirectFBWindow               *thiz,
+          DFBWindowEventType             mask
+     );
+
+
+   /** Options **/
+
+     /*
+      * Set options controlling appearance and behaviour of the window.
+      */
+     DFBResult (*SetOptions) (
+          IDirectFBWindow               *thiz,
+          DFBWindowOptions               options
+     );
+
+     /*
+      * Get options controlling appearance and behaviour of the window.
+      */
+     DFBResult (*GetOptions) (
+          IDirectFBWindow               *thiz,
+          DFBWindowOptions              *ret_options
+     );
+
+     /*
+      * Set the window color.
+      *
+      * This is used in case you specified DWCAPS_COLOR.
+      * It specifies the window draw color.
+      */
+     DFBResult (*SetColor) (
+          IDirectFBWindow               *thiz,
+          u8                             r,
+          u8                             g,
+          u8                             b,
+          u8                             a
+     );
+
+     /*
+      * Set the window color key.
+      *
+      * If a pixel of the window matches this color the
+      * underlying window or the background is visible at this
+      * point.
+      */
+     DFBResult (*SetColorKey) (
+          IDirectFBWindow               *thiz,
+          u8                             r,
+          u8                             g,
+          u8                             b
+     );
+
+     /*
+      * Set the window color key (indexed).
+      *
+      * If a pixel (indexed format) of the window matches this
+      * color index the underlying window or the background is
+      * visible at this point.
+      */
+     DFBResult (*SetColorKeyIndex) (
+          IDirectFBWindow               *thiz,
+          unsigned int                   index
+     );
+
+     /*
+      * Set the window's global opacity factor.
+      *
+      * Set it to "0" to hide a window.
+      * Setting it to "0xFF" makes the window opaque if
+      * it has no alpha channel.
+      */
+     DFBResult (*SetOpacity) (
+          IDirectFBWindow               *thiz,
+          u8                             opacity
+     );
+
+     /*
+      * Disable alpha channel blending for one region of the window.
+      *
+      * If DWOP_ALPHACHANNEL and DWOP_OPAQUE_REGION are set but not DWOP_COLORKEYING
+      * and the opacity of the window is 255 the window gets rendered
+      * without alpha blending within the specified region.
+      *
+      * This is extremely useful for alpha blended window decorations while
+      * the main content stays opaque and gets rendered faster.
+      */
+     DFBResult (*SetOpaqueRegion) (
+          IDirectFBWindow               *thiz,
+          int                            x1,
+          int                            y1,
+          int                            x2,
+          int                            y2
+     );
+
+     /*
+      * Get the current opacity factor of this window.
+      */
+     DFBResult (*GetOpacity) (
+          IDirectFBWindow               *thiz,
+          u8                            *ret_opacity
+     );
+
+     /*
+      * Bind a cursor shape to this window.
+      *
+      * This method will set a per-window cursor shape. Everytime
+      * the cursor enters this window, the specified shape is set.
+      *
+      * Passing NULL will unbind a set shape and release its surface.
+      */
+     DFBResult (*SetCursorShape) (
+          IDirectFBWindow               *thiz,
+          IDirectFBSurface              *shape,
+          int                            hot_x,
+          int                            hot_y
+     );
+
+
+   /** Position and Size **/
+
+     /*
+      * Move the window by the specified distance.
+      */
+     DFBResult (*Move) (
+          IDirectFBWindow               *thiz,
+          int                            dx,
+          int                            dy
+     );
+
+     /*
+      * Move the window to the specified coordinates.
+      */
+     DFBResult (*MoveTo) (
+          IDirectFBWindow               *thiz,
+          int                            x,
+          int                            y
+     );
+
+     /*
+      * Resize the window.
+      */
+     DFBResult (*Resize) (
+          IDirectFBWindow               *thiz,
+          int                            width,
+          int                            height
+     );
+
+     /*
+      * Set position and size in one step.
+      */
+     DFBResult (*SetBounds) (
+          IDirectFBWindow               *thiz,
+          int                            x,
+          int                            y,
+          int                            width,
+          int                            height
+     );
+
+
+   /** Stacking **/
+
+     /*
+      * Put the window into a specific stacking class.
+      */
+     DFBResult (*SetStackingClass) (
+          IDirectFBWindow               *thiz,
+          DFBWindowStackingClass         stacking_class
+     );
+
+     /*
+      * Raise the window by one within the window stack.
+      */
+     DFBResult (*Raise) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Lower the window by one within the window stack.
+      */
+     DFBResult (*Lower) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Put the window on the top of the window stack.
+      */
+     DFBResult (*RaiseToTop) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Send a window to the bottom of the window stack.
+      */
+     DFBResult (*LowerToBottom) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Put a window on top of another window.
+      */
+     DFBResult (*PutAtop) (
+          IDirectFBWindow               *thiz,
+          IDirectFBWindow               *lower
+     );
+
+     /*
+      * Put a window below another window.
+      */
+     DFBResult (*PutBelow) (
+          IDirectFBWindow               *thiz,
+          IDirectFBWindow               *upper
+     );
+
+
+   /** Binding **/
+     
+     /*
+      * Bind a window at the specified position of this window.
+      *
+      * After binding, bound window will be automatically moved
+      * when this window moves to a new position.<br>
+      * Binding the same window to multiple windows is not supported.
+      * Subsequent call to Bind() automatically unbounds the bound window
+      * before binding it again.<br>
+      * To move the bound window to a new position call Bind() again 
+      * with the new coordinates.
+      */
+     DFBResult (*Bind) (
+          IDirectFBWindow               *thiz,
+          IDirectFBWindow               *window,
+          int                            x,
+          int                            y
+     );
+
+     /*
+      * Unbind a window from this window.
+      */
+     DFBResult (*Unbind) (
+          IDirectFBWindow               *thiz,
+          IDirectFBWindow               *window
+     );
+
+
+   /** Focus handling **/
+
+     /*
+      * Pass the focus to this window.
+      */
+     DFBResult (*RequestFocus) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Grab the keyboard, i.e. all following keyboard events are
+      * sent to this window ignoring the focus.
+      */
+     DFBResult (*GrabKeyboard) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Ungrab the keyboard, i.e. switch to standard key event
+      * dispatching.
+      */
+     DFBResult (*UngrabKeyboard) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Grab the pointer, i.e. all following mouse events are
+      * sent to this window ignoring the focus.
+      */
+     DFBResult (*GrabPointer) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Ungrab the pointer, i.e. switch to standard mouse event
+      * dispatching.
+      */
+     DFBResult (*UngrabPointer) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Grab a specific key, i.e. all following events of this key are
+      * sent to this window ignoring the focus.
+      */
+     DFBResult (*GrabKey) (
+          IDirectFBWindow               *thiz,
+          DFBInputDeviceKeySymbol        symbol,
+          DFBInputDeviceModifierMask     modifiers
+     );
+
+     /*
+      * Ungrab a specific key, i.e. switch to standard key event
+      * dispatching.
+      */
+     DFBResult (*UngrabKey) (
+          IDirectFBWindow               *thiz,
+          DFBInputDeviceKeySymbol        symbol,
+          DFBInputDeviceModifierMask     modifiers
+     );
+
+
+   /** Key selection **/
+
+     /*
+      * Selects a mode for filtering keys while being focused.
+      *
+      * The <b>selection</b> defines whether all, none or a specific set (list) of keys is selected.
+      * In case of a specific set, the <b>keys</b> array with <b>num_keys</b> has to be provided.
+      *
+      * Multiple calls to this method are possible. Each overrides all settings from the previous call.
+      */
+     DFBResult (*SetKeySelection) (
+          IDirectFBWindow               *thiz,
+          DFBWindowKeySelection          selection,
+          const DFBInputDeviceKeySymbol *keys,
+          unsigned int                   num_keys
+     );
+
+     /*
+      * Grab all unselected (filtered out) keys.
+      *
+      * Unselected keys are those not selected by the focused window. These keys won't be sent
+      * to that window. Instead one window in the stack can collect them.
+      *
+      * See also IDirectFBWindow::UngrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
+      */
+     DFBResult (*GrabUnselectedKeys) (
+          IDirectFBWindow               *thiz
+     );
+
+     /*
+      * Release the grab of unselected (filtered out) keys.
+      *
+      * See also IDirectFBWindow::GrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
+      */
+     DFBResult (*UngrabUnselectedKeys) (
+          IDirectFBWindow               *thiz
+     );
+
+
+   /** Advanced Geometry **/
+
+     /*
+      * Set area of surface to be shown in window.
+      *
+      * Default and maximum is to show whole surface.
+      */
+     DFBResult (*SetSrcGeometry) (
+          IDirectFBWindow               *thiz,
+          const DFBWindowGeometry       *geometry
+     );
+
+     /*
+      * Set destination location of window within its bounds.
+      *
+      * Default and maximum is to fill whole bounds.
+      */
+     DFBResult (*SetDstGeometry) (
+          IDirectFBWindow               *thiz,
+          const DFBWindowGeometry       *geometry
+     );
+
+
+   /** Properties **/
+
+     /*
+      * Set property controlling appearance and behaviour of the window.
+      */
+     DFBResult (*SetProperty) (
+          IDirectFBWindow               *thiz,
+          const char                    *key,
+          void                          *value,
+          void                         **ret_old_value
+     );
+
+     /*
+      * Get property controlling appearance and behaviour of the window.
+      */
+     DFBResult (*GetProperty) (
+          IDirectFBWindow               *thiz,
+          const char                    *key,
+          void                         **ret_value
+     );
+
+     /*
+      * Remove property controlling appearance and behaviour of the window.
+      */
+     DFBResult (*RemoveProperty) (
+          IDirectFBWindow               *thiz,
+          const char                    *key,
+          void                         **ret_value
+     );
+
+     /*
+      * Set window rotation.
+      */
+     DFBResult (*SetRotation) (
+          IDirectFBWindow               *thiz,
+          int                            rotation
+     );
+
+
+   /** Association **/
+
+     /*
+      * Change the window association.
+      *
+      * If <b>window_id</b> is 0, the window will be dissociated.
+      */
+     DFBResult (*SetAssociation) (
+          IDirectFBWindow               *thiz,
+          DFBWindowID                    window_id
+     );
+
+
+   /** Updates **/
+
+     /*
+      * Signal start of window content updates.
+      */
+     DFBResult (*BeginUpdates) (
+          IDirectFBWindow               *thiz,
+          const DFBRegion               *update
+     );
+
+
+   /** Events **/
+
+     /*
+      * Send event
+      */
+     DFBResult (*SendEvent) (
+          IDirectFBWindow               *thiz,
+          const DFBWindowEvent          *event
+     );
+
+
+   /** Cursor **/
+
+     /*
+      * Set cursor flags (active when in focus).
+      */
+     DFBResult (*SetCursorFlags) (
+          IDirectFBWindow               *thiz,
+          DFBWindowCursorFlags           flags
+     );
+
+     /*
+      * Set cursor resolution (coordinate space for cursor within window). 
+      *  
+      * The default cursor resolution is the surface dimensions. 
+      */
+     DFBResult (*SetCursorResolution) (
+          IDirectFBWindow               *thiz,
+          const DFBDimension            *resolution
+     );
+
+     /*
+      * Set cursor position within window coordinates (surface or cursor resolution).
+      */
+     DFBResult (*SetCursorPosition) (
+          IDirectFBWindow               *thiz,
+          int                            x,
+          int                            y
+     );
+)
+
+
+/*
+ * Called for each provided text encoding.
+ */
+typedef DFBEnumerationResult (*DFBTextEncodingCallback) (
+     DFBTextEncodingID    encoding_id,
+     const char          *name,
+     void                *context
+);
+
+/*****************
+ * IDirectFBFont *
+ *****************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBFont,
+
+   /** Retrieving information **/
+
+     /*
+      * Get the distance from the baseline to the top of the
+      * logical extents of this font.
+      */
+     DFBResult (*GetAscender) (
+          IDirectFBFont            *thiz,
+          int                      *ret_ascender
+     );
+
+     /*
+      * Get the distance from the baseline to the bottom of
+      * the logical extents of this font.
+      *
+      * This is a negative value!
+      */
+     DFBResult (*GetDescender) (
+          IDirectFBFont            *thiz,
+          int                      *ret_descender
+     );
+
+     /*
+      * Get the logical height of this font. This is the
+      * distance from one baseline to the next when writing
+      * several lines of text. Note that this value does not
+      * correspond the height value specified when loading the
+      * font.
+      */
+     DFBResult (*GetHeight) (
+          IDirectFBFont            *thiz,
+          int                      *ret_height
+     );
+
+     /*
+      * Get the maximum character width.
+      *
+      * This is a somewhat dubious value. Not all fonts
+      * specify it correcly. It can give you an idea of
+      * the maximum expected width of a rendered string.
+      */
+     DFBResult (*GetMaxAdvance) (
+          IDirectFBFont            *thiz,
+          int                      *ret_maxadvance
+     );
+
+     /*
+      * Get the kerning to apply between two glyphs specified by
+      * their character codes.
+      */
+     DFBResult (*GetKerning) (
+          IDirectFBFont            *thiz,
+          unsigned int              prev,
+          unsigned int              current,
+          int                      *ret_kern_x,
+          int                      *ret_kern_y
+     );
+
+   /** Measurements **/
+
+     /*
+      * Get the logical width of the specified string
+      * as if it were drawn with this font.
+      *
+      * Bytes specifies the number of bytes to take from the
+      * string or -1 for the complete NULL-terminated string.
+      *
+      * The returned width may be different than the actual drawn
+      * width of the text since this function returns the logical
+      * width that should be used to layout the text. A negative
+      * width indicates right-to-left rendering.
+      */
+     DFBResult (*GetStringWidth) (
+          IDirectFBFont            *thiz,
+          const char               *text,
+          int                       bytes,
+          int                      *ret_width
+     );
+
+     /*
+      * Get the logical and real extents of the specified
+      * string as if it were drawn with this font.
+      *
+      * Bytes specifies the number of bytes to take from the
+      * string or -1 for the complete NULL-terminated string.
+      *
+      * The logical rectangle describes the typographic extents
+      * and should be used to layout text. The ink rectangle
+      * describes the smallest rectangle containing all pixels
+      * that are touched when drawing the string. If you only
+      * need one of the rectangles, pass NULL for the other one.
+      *
+      * The ink rectangle is guaranteed to be a valid rectangle
+      * with positive width and height, while the logical
+      * rectangle may have negative width indicating right-to-left
+      * layout.
+      *
+      * The rectangle offsets are reported relative to the
+      * baseline and refer to the text being drawn using
+      * DSTF_LEFT.
+      */
+     DFBResult (*GetStringExtents) (
+          IDirectFBFont            *thiz,
+          const char               *text,
+          int                       bytes,
+          DFBRectangle             *ret_logical_rect,
+          DFBRectangle             *ret_ink_rect
+     );
+
+     /*
+      * Get the extents of a glyph specified by its character code.
+      *
+      * The rectangle describes the the smallest rectangle
+      * containing all pixels that are touched when drawing the
+      * glyph. It is reported relative to the baseline. If you
+      * only need the advance, pass NULL for the rectangle.
+      *
+      * The advance describes the horizontal offset to the next
+      * glyph (without kerning applied). It may be a negative
+      * value indicating left-to-right rendering. If you don't
+      * need this value, pass NULL for advance.
+      */
+     DFBResult (*GetGlyphExtents) (
+          IDirectFBFont            *thiz,
+          unsigned int              character,
+          DFBRectangle             *ret_rect,
+          int                      *ret_advance
+     );
+
+     /*
+      * Get the next explicit or automatic break within a string
+      * along with the logical width of the text, the string length,
+      * and a pointer to the next text line.
+      *  
+      * The bytes specifies the maximum number of bytes to take from the
+      * string or -1 for complete NULL-terminated string.
+      *
+      * The max_width specifies logical width of column onto which 
+      * the text will be drawn. Then the logical width of fitted
+      * text is returned in ret_width. The returned width may overlap
+      * the max width specified if there's only one character 
+      * that fits.
+      *
+      * The number of characters that fit into this column is
+      * returned by the ret_str_length. This value can be used as 
+      * the number of bytes to take when using DrawString().
+      *
+      * In ret_next_line a pointer to the next line of text is returned. This 
+      * will point to NULL or the end of the string if there's no more break.
+      */
+     DFBResult (*GetStringBreak) (
+          IDirectFBFont            *thiz,
+          const char               *text,
+          int                       bytes,
+          int                       max_width,
+          int                      *ret_width,
+          int                      *ret_str_length,
+          const char              **ret_next_line
+     );
+
+   /** Encodings **/
+
+     /*
+      * Change the default encoding used when the font is set at a surface.
+      *
+      * It's also the encoding used for the measurement functions
+      * of this interface, e.g. IDirectFBFont::GetStringExtents().
+      */
+     DFBResult (*SetEncoding) (
+          IDirectFBFont            *thiz,
+          DFBTextEncodingID         encoding
+     );
+
+     /*
+      * Enumerate all provided text encodings.
+      */
+     DFBResult (*EnumEncodings) (
+          IDirectFBFont            *thiz,
+          DFBTextEncodingCallback   callback,
+          void                     *context
+     );
+
+     /*
+      * Find an encoding by its name.
+      */
+     DFBResult (*FindEncoding) (
+          IDirectFBFont            *thiz,
+          const char               *name,
+          DFBTextEncodingID        *ret_encoding
+     );
+
+     /*
+      * Get the line spacing vector of this font. This is the
+      * displacement vector from one line to the next when writing
+      * several lines of text. It differs from the height only
+      * when the font is rotated.
+      */
+     DFBResult (*GetLineSpacingVector) (
+          IDirectFBFont            *thiz,
+          int                      *ret_xspacing,
+          int                      *ret_yspacing
+     );
+
+     /*
+      * Get the extents of a glyph specified by its character code (extended version).
+      *
+      * The rectangle describes the the smallest rectangle
+      * containing all pixels that are touched when drawing the
+      * glyph. It is reported relative to the baseline. If you
+      * only need the advance, pass NULL for the rectangle.
+      *
+      * The advance describes the horizontal offset to the next
+      * glyph (without kerning applied). It may be a negative
+      * value indicating left-to-right rendering. If you don't
+      * need this value, pass NULL for advance.
+      */
+     DFBResult (*GetGlyphExtentsXY) (
+          IDirectFBFont            *thiz,
+          unsigned int              character,
+          DFBRectangle             *ret_rect,
+          int                      *ret_xadvance,
+          int                      *ret_yadvance
+     );
+
+
+   /** Retrieving information **/
+
+     /*
+      * Get the description of the font.
+      */
+     DFBResult (*GetDescription) (
+          IDirectFBFont            *thiz,
+          DFBFontDescription       *ret_description
+     );
+)
+
+/*
+ * Capabilities of an image.
+ */
+typedef enum {
+     DICAPS_NONE            = 0x00000000,  /* None of these.            */
+     DICAPS_ALPHACHANNEL    = 0x00000001,  /* The image data contains an
+                                              alphachannel.             */
+     DICAPS_COLORKEY        = 0x00000002   /* The image has a colorkey,
+                                              e.g. the transparent color
+                                              of a GIF image.           */
+} DFBImageCapabilities;
+
+/*
+ * Information about an image including capabilities and values
+ * belonging to available capabilities.
+ */
+typedef struct {
+     DFBImageCapabilities     caps;        /* capabilities              */
+
+     u8                       colorkey_r;  /* colorkey red channel      */
+     u8                       colorkey_g;  /* colorkey green channel    */
+     u8                       colorkey_b;  /* colorkey blue channel     */
+} DFBImageDescription;
+
+
+typedef enum {
+        DIRCR_OK,
+        DIRCR_ABORT
+} DIRenderCallbackResult;
+/*
+ * Called whenever a chunk of the image is decoded.
+ * Has to be registered with IDirectFBImageProvider::SetRenderCallback().
+ */
+typedef DIRenderCallbackResult (*DIRenderCallback)(DFBRectangle *rect, void *ctx);
+
+/**************************
+ * IDirectFBImageProvider *
+ **************************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBImageProvider,
+
+   /** Retrieving information **/
+
+     /*
+      * Get a surface description that best matches the image
+      * contained in the file.
+      *
+      * For opaque image formats the pixel format of the primary
+      * layer is used. For images with alpha channel an ARGB
+      * surface description is returned.
+      */
+     DFBResult (*GetSurfaceDescription) (
+          IDirectFBImageProvider   *thiz,
+          DFBSurfaceDescription    *ret_dsc
+     );
+
+     /*
+      * Get a description of the image.
+      *
+      * This includes stuff that does not belong into the surface
+      * description, e.g. a colorkey of a transparent GIF.
+      */
+     DFBResult (*GetImageDescription) (
+          IDirectFBImageProvider   *thiz,
+          DFBImageDescription      *ret_dsc
+     );
+
+
+   /** Rendering **/
+
+     /*
+      * Render the file contents into the destination contents
+      * doing automatic scaling and color format conversion.
+      *
+      * If the image file has an alpha channel it is rendered
+      * with alpha channel if the destination surface is of the
+      * ARGB pixelformat. Otherwise, transparent areas are
+      * blended over a black background.
+      *
+      * If a destination rectangle is specified, the rectangle is
+      * clipped to the destination surface. If NULL is passed as
+      * destination rectangle, the whole destination surface is
+      * taken. The image is stretched to fill the rectangle.
+      */
+     DFBResult (*RenderTo) (
+          IDirectFBImageProvider   *thiz,
+          IDirectFBSurface         *destination,
+          const DFBRectangle       *destination_rect
+     );
+
+     /*
+      * Registers a callback for progressive image loading.
+      *
+      * The function is called each time a chunk of the image is decoded.
+      */
+     DFBResult (*SetRenderCallback) (
+          IDirectFBImageProvider   *thiz,
+          DIRenderCallback          callback,
+          void                     *callback_data
+     );
+
+
+   /** Encoding **/
+
+     /*
+      * Encode a portion of a surface.
+      */
+     DFBResult (*WriteBack) (
+          IDirectFBImageProvider   *thiz,
+          IDirectFBSurface         *surface,
+          const DFBRectangle       *src_rect,
+          const char               *filename
+     );
+)
+
+/*
+ * Capabilities of an audio/video stream.
+ */
+typedef enum {
+     DVSCAPS_NONE         = 0x00000000, /* None of these.         */
+     DVSCAPS_VIDEO        = 0x00000001, /* Stream contains video. */
+     DVSCAPS_AUDIO        = 0x00000002  /* Stream contains audio. */
+     /* DVSCAPS_SUBPICTURE ?! */
+} DFBStreamCapabilities;
+
+#define DFB_STREAM_DESC_ENCODING_LENGTH   30
+
+#define DFB_STREAM_DESC_TITLE_LENGTH     255
+
+#define DFB_STREAM_DESC_AUTHOR_LENGTH    255
+
+#define DFB_STREAM_DESC_ALBUM_LENGTH     255
+
+#define DFB_STREAM_DESC_GENRE_LENGTH      32
+
+#define DFB_STREAM_DESC_COMMENT_LENGTH   255
+
+/*
+ * Informations about an audio/video stream.
+ */
+typedef struct {
+     DFBStreamCapabilities  caps;         /* capabilities */
+
+     struct {
+          char              encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
+          double            framerate;    /* number of frames per second */
+          double            aspect;       /* frame aspect ratio */
+          int               bitrate;      /* amount of bits per second */
+    	  int               afd;          /* Active Format Descriptor */
+    	  int               width;        /* Width as reported by Sequence Header */
+    	  int               height;       /* Height as reported by Sequence Header */
+     } video;                             /* struct containing the above encoding properties for video */
+
+     struct {
+          char              encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
+          int               samplerate;   /* number of samples per second */
+          int               channels;     /* number of channels per sample */
+          int               bitrate;      /* amount of bits per second */
+     } audio;                             /* struct containing the above four encoding properties for audio */
+
+     char                   title[DFB_STREAM_DESC_TITLE_LENGTH];     /* title   */
+     char                   author[DFB_STREAM_DESC_AUTHOR_LENGTH];   /* author  */
+     char                   album[DFB_STREAM_DESC_ALBUM_LENGTH];     /* album   */
+     short                  year;                                    /* year    */
+     char                   genre[DFB_STREAM_DESC_GENRE_LENGTH];     /* genre   */
+     char                   comment[DFB_STREAM_DESC_COMMENT_LENGTH]; /* comment */
+} DFBStreamDescription;
+
+/*
+ * Type of an audio stream.
+ */
+typedef enum {
+     DSF_ES         = 0x00000000, /* ES.  */
+     DSF_PES        = 0x00000001, /* PES. */
+} DFBStreamFormat;
+
+/*
+ * Stream attributes for an audio/video stream.
+ */
+typedef struct {
+     struct {
+          char            encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
+          DFBStreamFormat format;                                    /* format of the video stream */
+     } video;                           /* struct containing the above two encoding properties for video */
+     
+     struct {
+          char            encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
+          DFBStreamFormat format;                                    /* format of the audio stream */
+     } audio;                           /* struct containing the above two encoding properties for audio */
+} DFBStreamAttributes;
+
+/*
+ * Buffer levels and occupancy for Audio/Video input buffers.
+ */
+typedef struct {
+     DFBStreamCapabilities valid;        /* Which of the Audio / Video sections are valid. */
+
+     struct {
+         unsigned int  buffer_size;      /* Size in bytes of the input buffer to video decoder */
+         unsigned int  minimum_level;    /* The level at which a DVPET_DATALOW event will be generated. */
+         unsigned int  maximum_level;    /* The level at which a DVPET_DATAHIGH event will be generated. */
+         unsigned int  current_level;    /* Current fill level of video input buffer.*/
+     } video;
+
+     struct {
+         unsigned int  buffer_size;      /* Size in bytes of the input buffer to audio decoder */
+         unsigned int  minimum_level;    /* The level at which a DVPET_DATALOW event will be generated. */
+         unsigned int  maximum_level;    /* The level at which a DVPET_DATAHIGH event will be generated. */
+         unsigned int  current_level;    /* Current fill level of audio input buffer.*/
+     } audio;
+} DFBBufferOccupancy;
+
+/*
+ * Buffer thresholds for Audio and Video.
+ */
+typedef struct {
+     DFBStreamCapabilities selection;    /* Which of the Audio / Video are we setting? */
+
+     struct {
+          unsigned int  minimum_level;   /* The level at which a DVPET_DATALOW event will be generated. */
+          unsigned int  maximum_level;   /* The level at which a DVPET_DATAHIGH event will be generated. */
+          unsigned int  minimum_time;    /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
+          unsigned int  maximum_time;    /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
+     } video;
+
+     struct {
+          unsigned int  minimum_level;   /* The level at which a DVPET_DATALOW event will be generated. */
+          unsigned int  maximum_level;   /* The level at which a DVPET_DATAHIGH event will be generated. */
+          unsigned int  minimum_time;    /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
+          unsigned int  maximum_time;    /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
+     } audio;
+} DFBBufferThresholds;
+
+/*
+ * Called for each written frame.
+ */
+typedef void (*DVFrameCallback)(void *ctx);
+
+
+/**************************
+ * IDirectFBVideoProvider *
+ **************************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBVideoProvider,
+
+   /** Retrieving information **/
+
+     /*
+      * Retrieve information about the video provider's
+      * capabilities.
+      */
+     DFBResult (*GetCapabilities) (
+          IDirectFBVideoProvider        *thiz,
+          DFBVideoProviderCapabilities  *ret_caps
+     );
+
+     /*
+      * Get a surface description that best matches the video
+      * contained in the file.
+      */
+     DFBResult (*GetSurfaceDescription) (
+          IDirectFBVideoProvider   *thiz,
+          DFBSurfaceDescription    *ret_dsc
+     );
+
+     /*
+      * Get a description of the video stream.
+      */
+     DFBResult (*GetStreamDescription) (
+          IDirectFBVideoProvider   *thiz,
+          DFBStreamDescription     *ret_dsc
+     );
+
+
+   /** Playback **/
+
+     /*
+      * Play the video rendering it into the specified rectangle
+      * of the destination surface.
+      *
+      * Optionally a callback can be registered that is called
+      * for each rendered frame. This is especially important if
+      * you are playing to a flipping surface. In this case, you
+      * should flip the destination surface in your callback.
+      */
+     DFBResult (*PlayTo) (
+          IDirectFBVideoProvider   *thiz,
+          IDirectFBSurface         *destination,
+          const DFBRectangle       *destination_rect,
+          DVFrameCallback           callback,
+          void                     *ctx
+     );
+
+     /*
+      * Stop rendering into the destination surface.
+      */
+     DFBResult (*Stop) (
+          IDirectFBVideoProvider   *thiz
+     );
+
+     /*
+      * Get the status of the playback.
+      */
+     DFBResult (*GetStatus) (
+          IDirectFBVideoProvider   *thiz,
+          DFBVideoProviderStatus   *ret_status
+     );
+
+
+   /** Media Control **/
+
+     /*
+      * Seeks to a position within the stream.
+      */
+     DFBResult (*SeekTo) (
+          IDirectFBVideoProvider   *thiz,
+          double                    seconds
+     );
+
+     /*
+      * Gets current position within the stream.
+      */
+     DFBResult (*GetPos) (
+          IDirectFBVideoProvider   *thiz,
+          double                   *ret_seconds
+     );
+
+     /*
+      * Gets the length of the stream.
+      */
+     DFBResult (*GetLength) (
+          IDirectFBVideoProvider   *thiz,
+          double                   *ret_seconds
+     );
+
+   /** Color Adjustment **/
+
+     /*
+      * Gets the current video color settings.
+      */
+     DFBResult (*GetColorAdjustment) (
+          IDirectFBVideoProvider   *thiz,
+          DFBColorAdjustment       *ret_adj
+     );
+
+     /*
+      * Adjusts the video colors.
+      *
+      * This function only has an effect if the video provider
+      * supports this operation. Check the providers capabilities
+      * to find out if this is the case.
+      */
+     DFBResult (*SetColorAdjustment) (
+          IDirectFBVideoProvider   *thiz,
+          const DFBColorAdjustment *adj
+     );
+
+   /** Interactivity **/
+
+     /*
+      * Send an input or window event.
+      *
+      * This method allows to redirect events to an interactive
+      * video provider. Events must be relative to the specified
+      * rectangle of the destination surface.
+      */
+     DFBResult (*SendEvent) (
+          IDirectFBVideoProvider   *thiz,
+          const DFBEvent           *event
+     );
+
+   /** Advanced control **/
+   
+     /*
+      * Set the flags controlling playback mode.
+      */
+     DFBResult (*SetPlaybackFlags) (
+          IDirectFBVideoProvider        *thiz,
+          DFBVideoProviderPlaybackFlags  flags
+     );
+     
+     /*
+      * Set the speed multiplier.
+      *
+      * Values below 1.0 reduce playback speed 
+      * while values over 1.0 increase it.<br>
+      * Specifying a value of 0.0 has the effect of
+      * putting the playback in pause mode without 
+      * stopping the video provider.
+      */
+     DFBResult (*SetSpeed) (
+          IDirectFBVideoProvider   *thiz,
+          double                    multiplier
+     );
+     
+     /*
+      * Get current speed multiplier.
+      */
+     DFBResult (*GetSpeed) (
+          IDirectFBVideoProvider   *thiz,
+          double                   *ret_multiplier
+     );
+     
+     /*
+      * Set volume level.
+      *
+      * Values between 0.0f and 1.0f adjust the volume level.
+      * Values over 1.0f increase the amplification level.
+      */
+     DFBResult (*SetVolume) (
+          IDirectFBVideoProvider   *thiz,
+          float                     level
+     );
+
+     /*
+      * Get volume level.
+      */
+     DFBResult (*GetVolume) (
+          IDirectFBVideoProvider   *thiz,
+          float                    *ret_level
+     );
+
+     /*
+      * Set the stream attributes.
+      * May have a wrapper with different media types types encapsulated.
+      * Can use this method to indicate the content type.
+      */
+     DFBResult (*SetStreamAttributes) (
+          IDirectFBVideoProvider   *thiz,
+          DFBStreamAttributes       attr
+     );
+
+     /*
+      * Set the audio units that are being used for output.
+      * May have multiple audio outputs and need to configure them on/off
+      * dynamically. 
+      */
+     DFBResult (*SetAudioOutputs) (
+          IDirectFBVideoProvider     *thiz,
+          DFBVideoProviderAudioUnits *audioUnits
+     );
+
+     /*
+      * Get the audio units that are being used for output.
+      */
+     DFBResult (*GetAudioOutputs) (
+          IDirectFBVideoProvider     *thiz,
+          DFBVideoProviderAudioUnits *audioUnits
+     );
+
+     /*
+      * Set the audio delay
+      *
+      * The parameter is in microseconds. Values < 0 make audio earlier, > 0 make audio later.
+      */
+      DFBResult (*SetAudioDelay) (
+          IDirectFBVideoProvider     *thiz,
+          long                        delay
+      );
+
+
+  /** Event buffers **/
+
+     /*
+      * Create an event buffer for this video provider and attach it.
+      */
+     DFBResult (*CreateEventBuffer) (
+          IDirectFBVideoProvider     *thiz,
+          IDirectFBEventBuffer      **ret_buffer
+     );
+
+     /*
+      * Attach an existing event buffer to this video provider.
+      *
+      * NOTE: Attaching multiple times generates multiple events.
+      */
+     DFBResult (*AttachEventBuffer) (
+          IDirectFBVideoProvider     *thiz,
+          IDirectFBEventBuffer       *buffer
+     );
+
+     /*
+      * Enable specific events to be sent from the video provider.
+      *
+      * The argument is a mask of events that will be set in the
+      * videoproviders's event mask. The default event mask is DVPET_ALL.
+      */
+     DFBResult (*EnableEvents) (
+          IDirectFBVideoProvider     *thiz,
+          DFBVideoProviderEventType   mask
+     );
+
+     /*
+      * Disable specific events from being sent from the video provider
+      *
+      * The argument is a mask of events that will be cleared in
+      * the video providers's event mask. The default event mask is DWET_ALL.
+      */
+     DFBResult (*DisableEvents) (
+          IDirectFBVideoProvider     *thiz,
+          DFBVideoProviderEventType   mask
+     );
+
+     /*
+      * Detach an event buffer from this video provider.
+      */
+     DFBResult (*DetachEventBuffer) (
+          IDirectFBVideoProvider     *thiz,
+          IDirectFBEventBuffer       *buffer
+     );
+
+
+  /** Buffer control **/
+
+     /*
+      * Get buffer occupancy (A/V) when playing this stream.
+      */
+     DFBResult (*GetBufferOccupancy) (
+          IDirectFBVideoProvider   *thiz,
+          DFBBufferOccupancy       *ret_occ
+     );
+
+     /*
+      * Set buffer thresholds for the Audio / Video playback.
+      */
+     DFBResult (*SetBufferThresholds) (
+          IDirectFBVideoProvider   *thiz,
+          DFBBufferThresholds       thresh
+     );
+
+     /*
+      * Get buffer thresholds for the Audio / Video playback.
+      */
+     DFBResult (*GetBufferThresholds) (
+          IDirectFBVideoProvider   *thiz,
+          DFBBufferThresholds      *ret_thresh
+     );
+)
+
+/***********************
+ * IDirectFBDataBuffer *
+ ***********************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBDataBuffer,
+
+
+   /** Buffer handling **/
+
+     /*
+      * Flushes all data in this buffer.
+      *
+      * This method only applies to streaming buffers.
+      */
+     DFBResult (*Flush) (
+          IDirectFBDataBuffer      *thiz
+     );
+
+     /*
+      * Finish writing into a streaming buffer.
+      *
+      * Subsequent calls to PutData will fail,
+      * while attempts to fetch data from the buffer will return EOF
+      * unless there is still data available.
+      */
+     DFBResult (*Finish) (
+          IDirectFBDataBuffer      *thiz
+     );
+
+     /*
+      * Seeks to a given byte position.
+      *
+      * This method only applies to static buffers.
+      */
+     DFBResult (*SeekTo) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int              offset
+     );
+
+     /*
+      * Get the current byte position within a static buffer.
+      *
+      * This method only applies to static buffers.
+      */
+     DFBResult (*GetPosition) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int             *ret_offset
+     );
+
+     /*
+      * Get the length of a static or streaming buffer in bytes.
+      *
+      * The length of a static buffer is its static size.
+      * A streaming buffer has a variable length reflecting
+      * the amount of buffered data.
+      */
+     DFBResult (*GetLength) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int             *ret_length
+     );
+
+   /** Waiting for data **/
+
+     /*
+      * Wait for data to be available.
+      * Thread is idle in the meantime.
+      *
+      * This method blocks until at least the specified number of bytes
+      * is available.
+      */
+     DFBResult (*WaitForData) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int              length
+     );
+
+     /*
+      * Wait for data to be available within an amount of time.
+      * Thread is idle in the meantime.
+      *
+      * This method blocks until at least the specified number of bytes
+      * is available or the timeout is reached.
+      */
+     DFBResult (*WaitForDataWithTimeout) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int              length,
+          unsigned int              seconds,
+          unsigned int              milli_seconds
+     );
+
+
+   /** Retrieving data **/
+
+     /*
+      * Fetch data from a streaming or static buffer.
+      *
+      * Static buffers will increase the data pointer.
+      * Streaming buffers will flush the data portion.
+      *
+      * The maximum number of bytes to fetch is specified by "length",
+      * the actual number of bytes fetched is returned via "read".
+      */
+     DFBResult (*GetData) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int              length,
+          void                     *ret_data,
+          unsigned int             *ret_read
+     );
+
+     /*
+      * Peek data from a streaming or static buffer.
+      *
+      * Unlike GetData() this method won't increase the data
+      * pointer or flush any portions of the data held.
+      *
+      * Additionally an offset relative to the current data pointer
+      * or beginning of the streaming buffer can be specified.
+      *
+      * The maximum number of bytes to peek is specified by "length",
+      * the actual number of bytes peeked is returned via "read".
+      */
+     DFBResult (*PeekData) (
+          IDirectFBDataBuffer      *thiz,
+          unsigned int              length,
+          int                       offset,
+          void                     *ret_data,
+          unsigned int             *ret_read
+     );
+
+     /*
+      * Check if there is data available.
+      *
+      * This method returns DFB_OK if there is data available,
+      * DFB_BUFFER_EMPTY otherwise.
+      */
+     DFBResult (*HasData) (
+          IDirectFBDataBuffer      *thiz
+     );
+
+
+   /** Providing data **/
+
+     /*
+      * Appends a block of data to a streaming buffer.
+      *
+      * This method does not wait until the data got fetched.
+      *
+      * Static buffers don't support this method.
+      */
+     DFBResult (*PutData) (
+          IDirectFBDataBuffer      *thiz,
+          const void               *data,
+          unsigned int              length
+     );
+
+
+   /** Media from data **/
+
+     /*
+      * Creates an image provider using the buffers data.
+      */
+     DFBResult (*CreateImageProvider) (
+          IDirectFBDataBuffer      *thiz,
+          IDirectFBImageProvider  **interface
+     );
+
+     /*
+      * Creates a video provider using the buffers data.
+      */
+     DFBResult (*CreateVideoProvider) (
+          IDirectFBDataBuffer      *thiz,
+          IDirectFBVideoProvider  **interface
+     );
+
+     /*
+      * Load a font using the buffer's data, given a description
+      * of how to load the glyphs.
+      */
+     DFBResult (*CreateFont) (
+          IDirectFBDataBuffer       *thiz,
+          const DFBFontDescription  *desc,
+          IDirectFBFont            **interface
+     );
+)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Source/DirectFB/include/directfb_keyboard.h b/Source/DirectFB/include/directfb_keyboard.h
new file mode 100755
index 0000000..4e7f312
--- /dev/null
+++ b/Source/DirectFB/include/directfb_keyboard.h
@@ -0,0 +1,820 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_KEYBOARD_H__
+#define __DIRECTFB_KEYBOARD_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/*
+ * DirectFB key types (for advanced mapping)
+ */
+typedef enum {
+     DIKT_UNICODE        = 0x0000,     /* Unicode 3.x character
+                                           (compatible to Latin-1) */
+     DIKT_SPECIAL        = 0xF000,     /* Special key (e.g. Cursor Up or Menu) */
+     DIKT_FUNCTION       = 0xF100,     /* Function key (F1 - Fn) */
+     DIKT_MODIFIER       = 0xF200,     /* Modifier key */
+     DIKT_LOCK           = 0xF300,     /* Lock key (e.g. CapsLock) */
+     DIKT_DEAD           = 0xF400,     /* Dead key (e.g. dead grave) */
+     DIKT_CUSTOM         = 0xF500,     /* Custom key (vendor specific) */
+     DIKT_IDENTIFIER     = 0xF600      /* DirectFB key identifier */
+} DFBInputDeviceKeyType;
+
+#define DFB_KEY(type,index)        ((DIKT_##type) | (index))
+
+#define DFB_KEY_TYPE(symbol)       ((((symbol) & ~0xFFF) == 0xF000) ? (symbol) & 0xFF00 : DIKT_UNICODE)
+#define DFB_KEY_INDEX(symbol)      ((symbol) & 0x00FF)
+
+#define DFB_KEY_IS_ASCII(symbol)   ((symbol) < 128)
+
+#define DFB_FUNCTION_KEY(n)        (DFB_KEY( FUNCTION, n ))
+#define DFB_MODIFIER_KEY(i)        (DFB_KEY( MODIFIER, (1 << i) ))
+#define DFB_CUSTOM_KEY(n)          (DFB_KEY( CUSTOM, n ))
+
+#define DFB_LOWER_CASE(symbol)     (((symbol) >= 'A' && (symbol) <= 'Z') ?\
+                                    ((symbol) | 0x20) : (symbol))
+#define DFB_UPPER_CASE(symbol)     (((symbol) >= 'a' && (symbol) <= 'z') ?\
+                                    ((symbol) & ~0x20) : (symbol))
+
+/*
+ * DirectFB modifier key identifiers (for advanced mapping)
+ */
+typedef enum {
+     DIMKI_SHIFT,                       /* Shift modifier key */
+     DIMKI_CONTROL,                     /* Control modifier key */
+     DIMKI_ALT,                         /* Alt modifier key */
+     DIMKI_ALTGR,                       /* AltGr modifier key */
+     DIMKI_META,                        /* Meta modifier key */
+     DIMKI_SUPER,                       /* Super modifier key */
+     DIMKI_HYPER,                       /* Hyper modifier key */
+
+     DIMKI_FIRST    = DIMKI_SHIFT,
+     DIMKI_LAST     = DIMKI_HYPER
+} DFBInputDeviceModifierKeyIdentifier;
+
+/*
+ * DirectFB key identifiers (for basic mapping)
+ */
+typedef enum {
+     DIKI_UNKNOWN = DFB_KEY( IDENTIFIER, 0 ),
+
+     DIKI_A,
+     DIKI_B,
+     DIKI_C,
+     DIKI_D,
+     DIKI_E,
+     DIKI_F,
+     DIKI_G,
+     DIKI_H,
+     DIKI_I,
+     DIKI_J,
+     DIKI_K,
+     DIKI_L,
+     DIKI_M,
+     DIKI_N,
+     DIKI_O,
+     DIKI_P,
+     DIKI_Q,
+     DIKI_R,
+     DIKI_S,
+     DIKI_T,
+     DIKI_U,
+     DIKI_V,
+     DIKI_W,
+     DIKI_X,
+     DIKI_Y,
+     DIKI_Z,
+
+     DIKI_0,
+     DIKI_1,
+     DIKI_2,
+     DIKI_3,
+     DIKI_4,
+     DIKI_5,
+     DIKI_6,
+     DIKI_7,
+     DIKI_8,
+     DIKI_9,
+
+     DIKI_F1,
+     DIKI_F2,
+     DIKI_F3,
+     DIKI_F4,
+     DIKI_F5,
+     DIKI_F6,
+     DIKI_F7,
+     DIKI_F8,
+     DIKI_F9,
+     DIKI_F10,
+     DIKI_F11,
+     DIKI_F12,
+
+     DIKI_SHIFT_L,
+     DIKI_SHIFT_R,
+     DIKI_CONTROL_L,
+     DIKI_CONTROL_R,
+     DIKI_ALT_L,
+     DIKI_ALT_R,
+     DIKI_META_L,
+     DIKI_META_R,
+     DIKI_SUPER_L,
+     DIKI_SUPER_R,
+     DIKI_HYPER_L,
+     DIKI_HYPER_R,
+
+     DIKI_CAPS_LOCK,
+     DIKI_NUM_LOCK,
+     DIKI_SCROLL_LOCK,
+
+     DIKI_ESCAPE,
+     DIKI_LEFT,
+     DIKI_RIGHT,
+     DIKI_UP,
+     DIKI_DOWN,
+     DIKI_TAB,
+     DIKI_ENTER,
+     DIKI_SPACE,
+     DIKI_BACKSPACE,
+     DIKI_INSERT,
+     DIKI_DELETE,
+     DIKI_HOME,
+     DIKI_END,
+     DIKI_PAGE_UP,
+     DIKI_PAGE_DOWN,
+     DIKI_PRINT,
+     DIKI_PAUSE,
+
+     /*  The labels on these keys depend on the type of keyboard.
+      *  We've choosen the names from a US keyboard layout. The
+      *  comments refer to the ISO 9995 terminology.
+      */
+     DIKI_QUOTE_LEFT,    /*  TLDE  */
+     DIKI_MINUS_SIGN,    /*  AE11  */
+     DIKI_EQUALS_SIGN,   /*  AE12  */
+     DIKI_BRACKET_LEFT,  /*  AD11  */
+     DIKI_BRACKET_RIGHT, /*  AD12  */
+     DIKI_BACKSLASH,     /*  BKSL  */
+     DIKI_SEMICOLON,     /*  AC10  */
+     DIKI_QUOTE_RIGHT,   /*  AC11  */
+     DIKI_COMMA,         /*  AB08  */
+     DIKI_PERIOD,        /*  AB09  */
+     DIKI_SLASH,         /*  AB10  */
+
+     DIKI_LESS_SIGN,     /*  103rd  */
+
+     DIKI_KP_DIV,
+     DIKI_KP_MULT,
+     DIKI_KP_MINUS,
+     DIKI_KP_PLUS,
+     DIKI_KP_ENTER,
+     DIKI_KP_SPACE,
+     DIKI_KP_TAB,
+     DIKI_KP_F1,
+     DIKI_KP_F2,
+     DIKI_KP_F3,
+     DIKI_KP_F4,
+     DIKI_KP_EQUAL,
+     DIKI_KP_SEPARATOR,
+
+     DIKI_KP_DECIMAL,
+     DIKI_KP_0,
+     DIKI_KP_1,
+     DIKI_KP_2,
+     DIKI_KP_3,
+     DIKI_KP_4,
+     DIKI_KP_5,
+     DIKI_KP_6,
+     DIKI_KP_7,
+     DIKI_KP_8,
+     DIKI_KP_9,
+
+     DIKI_KEYDEF_END,
+     DIKI_NUMBER_OF_KEYS = DIKI_KEYDEF_END - DFB_KEY( IDENTIFIER, 0 )
+
+} DFBInputDeviceKeyIdentifier;
+
+/*
+ * DirectFB key symbols (for advanced mapping)
+ */
+typedef enum {
+     /*
+      * Unicode excerpt - Controls and Basic Latin
+      *
+      * Any Unicode 3.x character can be used as a DirectFB key symbol,
+      * the values of this enum are compatible with Unicode.
+      */
+     DIKS_NULL                     = DFB_KEY( UNICODE, 0x00 ),
+     DIKS_BACKSPACE                = DFB_KEY( UNICODE, 0x08 ),
+     DIKS_TAB                      = DFB_KEY( UNICODE, 0x09 ),
+     DIKS_RETURN                   = DFB_KEY( UNICODE, 0x0D ),
+     DIKS_CANCEL                   = DFB_KEY( UNICODE, 0x18 ),
+     DIKS_ESCAPE                   = DFB_KEY( UNICODE, 0x1B ),
+     DIKS_SPACE                    = DFB_KEY( UNICODE, 0x20 ),
+     DIKS_EXCLAMATION_MARK         = DFB_KEY( UNICODE, 0x21 ),
+     DIKS_QUOTATION                = DFB_KEY( UNICODE, 0x22 ),
+     DIKS_NUMBER_SIGN              = DFB_KEY( UNICODE, 0x23 ),
+     DIKS_DOLLAR_SIGN              = DFB_KEY( UNICODE, 0x24 ),
+     DIKS_PERCENT_SIGN             = DFB_KEY( UNICODE, 0x25 ),
+     DIKS_AMPERSAND                = DFB_KEY( UNICODE, 0x26 ),
+     DIKS_APOSTROPHE               = DFB_KEY( UNICODE, 0x27 ),
+     DIKS_PARENTHESIS_LEFT         = DFB_KEY( UNICODE, 0x28 ),
+     DIKS_PARENTHESIS_RIGHT        = DFB_KEY( UNICODE, 0x29 ),
+     DIKS_ASTERISK                 = DFB_KEY( UNICODE, 0x2A ),
+     DIKS_PLUS_SIGN                = DFB_KEY( UNICODE, 0x2B ),
+     DIKS_COMMA                    = DFB_KEY( UNICODE, 0x2C ),
+     DIKS_MINUS_SIGN               = DFB_KEY( UNICODE, 0x2D ),
+     DIKS_PERIOD                   = DFB_KEY( UNICODE, 0x2E ),
+     DIKS_SLASH                    = DFB_KEY( UNICODE, 0x2F ),
+     DIKS_0                        = DFB_KEY( UNICODE, 0x30 ),
+     DIKS_1                        = DFB_KEY( UNICODE, 0x31 ),
+     DIKS_2                        = DFB_KEY( UNICODE, 0x32 ),
+     DIKS_3                        = DFB_KEY( UNICODE, 0x33 ),
+     DIKS_4                        = DFB_KEY( UNICODE, 0x34 ),
+     DIKS_5                        = DFB_KEY( UNICODE, 0x35 ),
+     DIKS_6                        = DFB_KEY( UNICODE, 0x36 ),
+     DIKS_7                        = DFB_KEY( UNICODE, 0x37 ),
+     DIKS_8                        = DFB_KEY( UNICODE, 0x38 ),
+     DIKS_9                        = DFB_KEY( UNICODE, 0x39 ),
+     DIKS_COLON                    = DFB_KEY( UNICODE, 0x3A ),
+     DIKS_SEMICOLON                = DFB_KEY( UNICODE, 0x3B ),
+     DIKS_LESS_THAN_SIGN           = DFB_KEY( UNICODE, 0x3C ),
+     DIKS_EQUALS_SIGN              = DFB_KEY( UNICODE, 0x3D ),
+     DIKS_GREATER_THAN_SIGN        = DFB_KEY( UNICODE, 0x3E ),
+     DIKS_QUESTION_MARK            = DFB_KEY( UNICODE, 0x3F ),
+     DIKS_AT                       = DFB_KEY( UNICODE, 0x40 ),
+     DIKS_CAPITAL_A                = DFB_KEY( UNICODE, 0x41 ),
+     DIKS_CAPITAL_B                = DFB_KEY( UNICODE, 0x42 ),
+     DIKS_CAPITAL_C                = DFB_KEY( UNICODE, 0x43 ),
+     DIKS_CAPITAL_D                = DFB_KEY( UNICODE, 0x44 ),
+     DIKS_CAPITAL_E                = DFB_KEY( UNICODE, 0x45 ),
+     DIKS_CAPITAL_F                = DFB_KEY( UNICODE, 0x46 ),
+     DIKS_CAPITAL_G                = DFB_KEY( UNICODE, 0x47 ),
+     DIKS_CAPITAL_H                = DFB_KEY( UNICODE, 0x48 ),
+     DIKS_CAPITAL_I                = DFB_KEY( UNICODE, 0x49 ),
+     DIKS_CAPITAL_J                = DFB_KEY( UNICODE, 0x4A ),
+     DIKS_CAPITAL_K                = DFB_KEY( UNICODE, 0x4B ),
+     DIKS_CAPITAL_L                = DFB_KEY( UNICODE, 0x4C ),
+     DIKS_CAPITAL_M                = DFB_KEY( UNICODE, 0x4D ),
+     DIKS_CAPITAL_N                = DFB_KEY( UNICODE, 0x4E ),
+     DIKS_CAPITAL_O                = DFB_KEY( UNICODE, 0x4F ),
+     DIKS_CAPITAL_P                = DFB_KEY( UNICODE, 0x50 ),
+     DIKS_CAPITAL_Q                = DFB_KEY( UNICODE, 0x51 ),
+     DIKS_CAPITAL_R                = DFB_KEY( UNICODE, 0x52 ),
+     DIKS_CAPITAL_S                = DFB_KEY( UNICODE, 0x53 ),
+     DIKS_CAPITAL_T                = DFB_KEY( UNICODE, 0x54 ),
+     DIKS_CAPITAL_U                = DFB_KEY( UNICODE, 0x55 ),
+     DIKS_CAPITAL_V                = DFB_KEY( UNICODE, 0x56 ),
+     DIKS_CAPITAL_W                = DFB_KEY( UNICODE, 0x57 ),
+     DIKS_CAPITAL_X                = DFB_KEY( UNICODE, 0x58 ),
+     DIKS_CAPITAL_Y                = DFB_KEY( UNICODE, 0x59 ),
+     DIKS_CAPITAL_Z                = DFB_KEY( UNICODE, 0x5A ),
+     DIKS_SQUARE_BRACKET_LEFT      = DFB_KEY( UNICODE, 0x5B ),
+     DIKS_BACKSLASH                = DFB_KEY( UNICODE, 0x5C ),
+     DIKS_SQUARE_BRACKET_RIGHT     = DFB_KEY( UNICODE, 0x5D ),
+     DIKS_CIRCUMFLEX_ACCENT        = DFB_KEY( UNICODE, 0x5E ),
+     DIKS_UNDERSCORE               = DFB_KEY( UNICODE, 0x5F ),
+     DIKS_GRAVE_ACCENT             = DFB_KEY( UNICODE, 0x60 ),
+     DIKS_SMALL_A                  = DFB_KEY( UNICODE, 0x61 ),
+     DIKS_SMALL_B                  = DFB_KEY( UNICODE, 0x62 ),
+     DIKS_SMALL_C                  = DFB_KEY( UNICODE, 0x63 ),
+     DIKS_SMALL_D                  = DFB_KEY( UNICODE, 0x64 ),
+     DIKS_SMALL_E                  = DFB_KEY( UNICODE, 0x65 ),
+     DIKS_SMALL_F                  = DFB_KEY( UNICODE, 0x66 ),
+     DIKS_SMALL_G                  = DFB_KEY( UNICODE, 0x67 ),
+     DIKS_SMALL_H                  = DFB_KEY( UNICODE, 0x68 ),
+     DIKS_SMALL_I                  = DFB_KEY( UNICODE, 0x69 ),
+     DIKS_SMALL_J                  = DFB_KEY( UNICODE, 0x6A ),
+     DIKS_SMALL_K                  = DFB_KEY( UNICODE, 0x6B ),
+     DIKS_SMALL_L                  = DFB_KEY( UNICODE, 0x6C ),
+     DIKS_SMALL_M                  = DFB_KEY( UNICODE, 0x6D ),
+     DIKS_SMALL_N                  = DFB_KEY( UNICODE, 0x6E ),
+     DIKS_SMALL_O                  = DFB_KEY( UNICODE, 0x6F ),
+     DIKS_SMALL_P                  = DFB_KEY( UNICODE, 0x70 ),
+     DIKS_SMALL_Q                  = DFB_KEY( UNICODE, 0x71 ),
+     DIKS_SMALL_R                  = DFB_KEY( UNICODE, 0x72 ),
+     DIKS_SMALL_S                  = DFB_KEY( UNICODE, 0x73 ),
+     DIKS_SMALL_T                  = DFB_KEY( UNICODE, 0x74 ),
+     DIKS_SMALL_U                  = DFB_KEY( UNICODE, 0x75 ),
+     DIKS_SMALL_V                  = DFB_KEY( UNICODE, 0x76 ),
+     DIKS_SMALL_W                  = DFB_KEY( UNICODE, 0x77 ),
+     DIKS_SMALL_X                  = DFB_KEY( UNICODE, 0x78 ),
+     DIKS_SMALL_Y                  = DFB_KEY( UNICODE, 0x79 ),
+     DIKS_SMALL_Z                  = DFB_KEY( UNICODE, 0x7A ),
+     DIKS_CURLY_BRACKET_LEFT       = DFB_KEY( UNICODE, 0x7B ),
+     DIKS_VERTICAL_BAR             = DFB_KEY( UNICODE, 0x7C ),
+     DIKS_CURLY_BRACKET_RIGHT      = DFB_KEY( UNICODE, 0x7D ),
+     DIKS_TILDE                    = DFB_KEY( UNICODE, 0x7E ),
+     DIKS_DELETE                   = DFB_KEY( UNICODE, 0x7F ),
+
+     DIKS_ENTER                    = DIKS_RETURN,
+
+     /*
+      * Unicode private area - DirectFB Special keys
+      */
+     DIKS_CURSOR_LEFT              = DFB_KEY( SPECIAL, 0x00 ),
+     DIKS_CURSOR_RIGHT             = DFB_KEY( SPECIAL, 0x01 ),
+     DIKS_CURSOR_UP                = DFB_KEY( SPECIAL, 0x02 ),
+     DIKS_CURSOR_DOWN              = DFB_KEY( SPECIAL, 0x03 ),
+     DIKS_INSERT                   = DFB_KEY( SPECIAL, 0x04 ),
+     DIKS_HOME                     = DFB_KEY( SPECIAL, 0x05 ),
+     DIKS_END                      = DFB_KEY( SPECIAL, 0x06 ),
+     DIKS_PAGE_UP                  = DFB_KEY( SPECIAL, 0x07 ),
+     DIKS_PAGE_DOWN                = DFB_KEY( SPECIAL, 0x08 ),
+     DIKS_PRINT                    = DFB_KEY( SPECIAL, 0x09 ),
+     DIKS_PAUSE                    = DFB_KEY( SPECIAL, 0x0A ),
+     DIKS_OK                       = DFB_KEY( SPECIAL, 0x0B ),
+     DIKS_SELECT                   = DFB_KEY( SPECIAL, 0x0C ),
+     DIKS_GOTO                     = DFB_KEY( SPECIAL, 0x0D ),
+     DIKS_CLEAR                    = DFB_KEY( SPECIAL, 0x0E ),
+     DIKS_POWER                    = DFB_KEY( SPECIAL, 0x0F ),
+     DIKS_POWER2                   = DFB_KEY( SPECIAL, 0x10 ),
+     DIKS_OPTION                   = DFB_KEY( SPECIAL, 0x11 ),
+     DIKS_MENU                     = DFB_KEY( SPECIAL, 0x12 ),
+     DIKS_HELP                     = DFB_KEY( SPECIAL, 0x13 ),
+     DIKS_INFO                     = DFB_KEY( SPECIAL, 0x14 ),
+     DIKS_TIME                     = DFB_KEY( SPECIAL, 0x15 ),
+     DIKS_VENDOR                   = DFB_KEY( SPECIAL, 0x16 ),
+
+     DIKS_ARCHIVE                  = DFB_KEY( SPECIAL, 0x17 ),
+     DIKS_PROGRAM                  = DFB_KEY( SPECIAL, 0x18 ),
+     DIKS_CHANNEL                  = DFB_KEY( SPECIAL, 0x19 ),
+     DIKS_FAVORITES                = DFB_KEY( SPECIAL, 0x1A ),
+     DIKS_EPG                      = DFB_KEY( SPECIAL, 0x1B ),
+     DIKS_PVR                      = DFB_KEY( SPECIAL, 0x1C ),
+     DIKS_MHP                      = DFB_KEY( SPECIAL, 0x1D ),
+     DIKS_LANGUAGE                 = DFB_KEY( SPECIAL, 0x1E ),
+     DIKS_TITLE                    = DFB_KEY( SPECIAL, 0x1F ),
+     DIKS_SUBTITLE                 = DFB_KEY( SPECIAL, 0x20 ),
+     DIKS_ANGLE                    = DFB_KEY( SPECIAL, 0x21 ),
+     DIKS_ZOOM                     = DFB_KEY( SPECIAL, 0x22 ),
+     DIKS_MODE                     = DFB_KEY( SPECIAL, 0x23 ),
+     DIKS_KEYBOARD                 = DFB_KEY( SPECIAL, 0x24 ),
+     DIKS_PC                       = DFB_KEY( SPECIAL, 0x25 ),
+     DIKS_SCREEN                   = DFB_KEY( SPECIAL, 0x26 ),
+
+     DIKS_TV                       = DFB_KEY( SPECIAL, 0x27 ),
+     DIKS_TV2                      = DFB_KEY( SPECIAL, 0x28 ),
+     DIKS_VCR                      = DFB_KEY( SPECIAL, 0x29 ),
+     DIKS_VCR2                     = DFB_KEY( SPECIAL, 0x2A ),
+     DIKS_SAT                      = DFB_KEY( SPECIAL, 0x2B ),
+     DIKS_SAT2                     = DFB_KEY( SPECIAL, 0x2C ),
+     DIKS_CD                       = DFB_KEY( SPECIAL, 0x2D ),
+     DIKS_TAPE                     = DFB_KEY( SPECIAL, 0x2E ),
+     DIKS_RADIO                    = DFB_KEY( SPECIAL, 0x2F ),
+     DIKS_TUNER                    = DFB_KEY( SPECIAL, 0x30 ),
+     DIKS_PLAYER                   = DFB_KEY( SPECIAL, 0x31 ),
+     DIKS_TEXT                     = DFB_KEY( SPECIAL, 0x32 ),
+     DIKS_DVD                      = DFB_KEY( SPECIAL, 0x33 ),
+     DIKS_AUX                      = DFB_KEY( SPECIAL, 0x34 ),
+     DIKS_MP3                      = DFB_KEY( SPECIAL, 0x35 ),
+     DIKS_PHONE                    = DFB_KEY( SPECIAL, 0x36 ),
+     DIKS_AUDIO                    = DFB_KEY( SPECIAL, 0x37 ),
+     DIKS_VIDEO                    = DFB_KEY( SPECIAL, 0x38 ),
+
+     DIKS_INTERNET                 = DFB_KEY( SPECIAL, 0x39 ),
+     DIKS_MAIL                     = DFB_KEY( SPECIAL, 0x3A ),
+     DIKS_NEWS                     = DFB_KEY( SPECIAL, 0x3B ),
+     DIKS_DIRECTORY                = DFB_KEY( SPECIAL, 0x3C ),
+     DIKS_LIST                     = DFB_KEY( SPECIAL, 0x3D ),
+     DIKS_CALCULATOR               = DFB_KEY( SPECIAL, 0x3E ),
+     DIKS_MEMO                     = DFB_KEY( SPECIAL, 0x3F ),
+     DIKS_CALENDAR                 = DFB_KEY( SPECIAL, 0x40 ),
+     DIKS_EDITOR                   = DFB_KEY( SPECIAL, 0x41 ),
+
+     DIKS_RED                      = DFB_KEY( SPECIAL, 0x42 ),
+     DIKS_GREEN                    = DFB_KEY( SPECIAL, 0x43 ),
+     DIKS_YELLOW                   = DFB_KEY( SPECIAL, 0x44 ),
+     DIKS_BLUE                     = DFB_KEY( SPECIAL, 0x45 ),
+
+     DIKS_CHANNEL_UP               = DFB_KEY( SPECIAL, 0x46 ),
+     DIKS_CHANNEL_DOWN             = DFB_KEY( SPECIAL, 0x47 ),
+     DIKS_BACK                     = DFB_KEY( SPECIAL, 0x48 ),
+     DIKS_FORWARD                  = DFB_KEY( SPECIAL, 0x49 ),
+     DIKS_FIRST                    = DFB_KEY( SPECIAL, 0x4A ),
+     DIKS_LAST                     = DFB_KEY( SPECIAL, 0x4B ),
+     DIKS_VOLUME_UP                = DFB_KEY( SPECIAL, 0x4C ),
+     DIKS_VOLUME_DOWN              = DFB_KEY( SPECIAL, 0x4D ),
+     DIKS_MUTE                     = DFB_KEY( SPECIAL, 0x4E ),
+     DIKS_AB                       = DFB_KEY( SPECIAL, 0x4F ),
+     DIKS_PLAYPAUSE                = DFB_KEY( SPECIAL, 0x50 ),
+     DIKS_PLAY                     = DFB_KEY( SPECIAL, 0x51 ),
+     DIKS_STOP                     = DFB_KEY( SPECIAL, 0x52 ),
+     DIKS_RESTART                  = DFB_KEY( SPECIAL, 0x53 ),
+     DIKS_SLOW                     = DFB_KEY( SPECIAL, 0x54 ),
+     DIKS_FAST                     = DFB_KEY( SPECIAL, 0x55 ),
+     DIKS_RECORD                   = DFB_KEY( SPECIAL, 0x56 ),
+     DIKS_EJECT                    = DFB_KEY( SPECIAL, 0x57 ),
+     DIKS_SHUFFLE                  = DFB_KEY( SPECIAL, 0x58 ),
+     DIKS_REWIND                   = DFB_KEY( SPECIAL, 0x59 ),
+     DIKS_FASTFORWARD              = DFB_KEY( SPECIAL, 0x5A ),
+     DIKS_PREVIOUS                 = DFB_KEY( SPECIAL, 0x5B ),
+     DIKS_NEXT                     = DFB_KEY( SPECIAL, 0x5C ),
+     DIKS_BEGIN                    = DFB_KEY( SPECIAL, 0x5D ),
+
+     DIKS_DIGITS                   = DFB_KEY( SPECIAL, 0x5E ),
+     DIKS_TEEN                     = DFB_KEY( SPECIAL, 0x5F ),
+     DIKS_TWEN                     = DFB_KEY( SPECIAL, 0x60 ),
+
+     DIKS_BREAK                    = DFB_KEY( SPECIAL, 0x61 ),
+     DIKS_EXIT                     = DFB_KEY( SPECIAL, 0x62 ),
+     DIKS_SETUP                    = DFB_KEY( SPECIAL, 0x63 ),
+
+     DIKS_CURSOR_LEFT_UP           = DFB_KEY( SPECIAL, 0x64 ),
+     DIKS_CURSOR_LEFT_DOWN         = DFB_KEY( SPECIAL, 0x65 ),
+     DIKS_CURSOR_UP_RIGHT          = DFB_KEY( SPECIAL, 0x66 ),
+     DIKS_CURSOR_DOWN_RIGHT        = DFB_KEY( SPECIAL, 0x67 ),
+
+     /*
+      * Unicode private area - DirectFB Function keys
+      *
+      * More function keys are available via DFB_FUNCTION_KEY(n).
+      */
+     DIKS_F1                       = DFB_FUNCTION_KEY(  1 ),
+     DIKS_F2                       = DFB_FUNCTION_KEY(  2 ),
+     DIKS_F3                       = DFB_FUNCTION_KEY(  3 ),
+     DIKS_F4                       = DFB_FUNCTION_KEY(  4 ),
+     DIKS_F5                       = DFB_FUNCTION_KEY(  5 ),
+     DIKS_F6                       = DFB_FUNCTION_KEY(  6 ),
+     DIKS_F7                       = DFB_FUNCTION_KEY(  7 ),
+     DIKS_F8                       = DFB_FUNCTION_KEY(  8 ),
+     DIKS_F9                       = DFB_FUNCTION_KEY(  9 ),
+     DIKS_F10                      = DFB_FUNCTION_KEY( 10 ),
+     DIKS_F11                      = DFB_FUNCTION_KEY( 11 ),
+     DIKS_F12                      = DFB_FUNCTION_KEY( 12 ),
+
+     /*
+      * Unicode private area - DirectFB Modifier keys
+      */
+     DIKS_SHIFT                    = DFB_MODIFIER_KEY( DIMKI_SHIFT ),
+     DIKS_CONTROL                  = DFB_MODIFIER_KEY( DIMKI_CONTROL ),
+     DIKS_ALT                      = DFB_MODIFIER_KEY( DIMKI_ALT ),
+     DIKS_ALTGR                    = DFB_MODIFIER_KEY( DIMKI_ALTGR ),
+     DIKS_META                     = DFB_MODIFIER_KEY( DIMKI_META ),
+     DIKS_SUPER                    = DFB_MODIFIER_KEY( DIMKI_SUPER ),
+     DIKS_HYPER                    = DFB_MODIFIER_KEY( DIMKI_HYPER ),
+
+     /*
+      * Unicode private area - DirectFB Lock keys
+      */
+     DIKS_CAPS_LOCK                = DFB_KEY( LOCK, 0x00 ),
+     DIKS_NUM_LOCK                 = DFB_KEY( LOCK, 0x01 ),
+     DIKS_SCROLL_LOCK              = DFB_KEY( LOCK, 0x02 ),
+
+     /*
+      * Unicode private area - DirectFB Dead keys
+      */
+     DIKS_DEAD_ABOVEDOT            = DFB_KEY( DEAD, 0x00 ),
+     DIKS_DEAD_ABOVERING           = DFB_KEY( DEAD, 0x01 ),
+     DIKS_DEAD_ACUTE               = DFB_KEY( DEAD, 0x02 ),
+     DIKS_DEAD_BREVE               = DFB_KEY( DEAD, 0x03 ),
+     DIKS_DEAD_CARON               = DFB_KEY( DEAD, 0x04 ),
+     DIKS_DEAD_CEDILLA             = DFB_KEY( DEAD, 0x05 ),
+     DIKS_DEAD_CIRCUMFLEX          = DFB_KEY( DEAD, 0x06 ),
+     DIKS_DEAD_DIAERESIS           = DFB_KEY( DEAD, 0x07 ),
+     DIKS_DEAD_DOUBLEACUTE         = DFB_KEY( DEAD, 0x08 ),
+     DIKS_DEAD_GRAVE               = DFB_KEY( DEAD, 0x09 ),
+     DIKS_DEAD_IOTA                = DFB_KEY( DEAD, 0x0A ),
+     DIKS_DEAD_MACRON              = DFB_KEY( DEAD, 0x0B ),
+     DIKS_DEAD_OGONEK              = DFB_KEY( DEAD, 0x0C ),
+     DIKS_DEAD_SEMIVOICED_SOUND    = DFB_KEY( DEAD, 0x0D ),
+     DIKS_DEAD_TILDE               = DFB_KEY( DEAD, 0x0E ),
+     DIKS_DEAD_VOICED_SOUND        = DFB_KEY( DEAD, 0x0F ),
+
+     /*
+      * Unicode private area - DirectFB Custom keys
+      *
+      * More custom keys are available via DFB_CUSTOM_KEY(n).
+      */
+     DIKS_CUSTOM0                  = DFB_CUSTOM_KEY( 0 ),
+     DIKS_CUSTOM1                  = DFB_CUSTOM_KEY( 1 ),
+     DIKS_CUSTOM2                  = DFB_CUSTOM_KEY( 2 ),
+     DIKS_CUSTOM3                  = DFB_CUSTOM_KEY( 3 ),
+     DIKS_CUSTOM4                  = DFB_CUSTOM_KEY( 4 ),
+     DIKS_CUSTOM5                  = DFB_CUSTOM_KEY( 5 ),
+     DIKS_CUSTOM6                  = DFB_CUSTOM_KEY( 6 ),
+     DIKS_CUSTOM7                  = DFB_CUSTOM_KEY( 7 ),
+     DIKS_CUSTOM8                  = DFB_CUSTOM_KEY( 8 ),
+     DIKS_CUSTOM9                  = DFB_CUSTOM_KEY( 9 ),
+     DIKS_CUSTOM10                 = DFB_CUSTOM_KEY( 10 ),
+     DIKS_CUSTOM11                 = DFB_CUSTOM_KEY( 11 ),
+     DIKS_CUSTOM12                 = DFB_CUSTOM_KEY( 12 ),
+     DIKS_CUSTOM13                 = DFB_CUSTOM_KEY( 13 ),
+     DIKS_CUSTOM14                 = DFB_CUSTOM_KEY( 14 ),
+     DIKS_CUSTOM15                 = DFB_CUSTOM_KEY( 15 ),
+     DIKS_CUSTOM16                 = DFB_CUSTOM_KEY( 16 ),
+     DIKS_CUSTOM17                 = DFB_CUSTOM_KEY( 17 ),
+     DIKS_CUSTOM18                 = DFB_CUSTOM_KEY( 18 ),
+     DIKS_CUSTOM19                 = DFB_CUSTOM_KEY( 19 ),
+     DIKS_CUSTOM20                 = DFB_CUSTOM_KEY( 20 ),
+     DIKS_CUSTOM21                 = DFB_CUSTOM_KEY( 21 ),
+     DIKS_CUSTOM22                 = DFB_CUSTOM_KEY( 22 ),
+     DIKS_CUSTOM23                 = DFB_CUSTOM_KEY( 23 ),
+     DIKS_CUSTOM24                 = DFB_CUSTOM_KEY( 24 ),
+     DIKS_CUSTOM25                 = DFB_CUSTOM_KEY( 25 ),
+     DIKS_CUSTOM26                 = DFB_CUSTOM_KEY( 26 ),
+     DIKS_CUSTOM27                 = DFB_CUSTOM_KEY( 27 ),
+     DIKS_CUSTOM28                 = DFB_CUSTOM_KEY( 28 ),
+     DIKS_CUSTOM29                 = DFB_CUSTOM_KEY( 29 ),
+     DIKS_CUSTOM30                 = DFB_CUSTOM_KEY( 30 ),
+     DIKS_CUSTOM31                 = DFB_CUSTOM_KEY( 31 ),
+     DIKS_CUSTOM32                 = DFB_CUSTOM_KEY( 32 ),
+     DIKS_CUSTOM33                 = DFB_CUSTOM_KEY( 33 ),
+     DIKS_CUSTOM34                 = DFB_CUSTOM_KEY( 34 ),
+     DIKS_CUSTOM35                 = DFB_CUSTOM_KEY( 35 ),
+     DIKS_CUSTOM36                 = DFB_CUSTOM_KEY( 36 ),
+     DIKS_CUSTOM37                 = DFB_CUSTOM_KEY( 37 ),
+     DIKS_CUSTOM38                 = DFB_CUSTOM_KEY( 38 ),
+     DIKS_CUSTOM39                 = DFB_CUSTOM_KEY( 39 ),
+     DIKS_CUSTOM40                 = DFB_CUSTOM_KEY( 40 ),
+     DIKS_CUSTOM41                 = DFB_CUSTOM_KEY( 41 ),
+     DIKS_CUSTOM42                 = DFB_CUSTOM_KEY( 42 ),
+     DIKS_CUSTOM43                 = DFB_CUSTOM_KEY( 43 ),
+     DIKS_CUSTOM44                 = DFB_CUSTOM_KEY( 44 ),
+     DIKS_CUSTOM45                 = DFB_CUSTOM_KEY( 45 ),
+     DIKS_CUSTOM46                 = DFB_CUSTOM_KEY( 46 ),
+     DIKS_CUSTOM47                 = DFB_CUSTOM_KEY( 47 ),
+     DIKS_CUSTOM48                 = DFB_CUSTOM_KEY( 48 ),
+     DIKS_CUSTOM49                 = DFB_CUSTOM_KEY( 49 ),
+     DIKS_CUSTOM50                 = DFB_CUSTOM_KEY( 50 ),
+     DIKS_CUSTOM51                 = DFB_CUSTOM_KEY( 51 ),
+     DIKS_CUSTOM52                 = DFB_CUSTOM_KEY( 52 ),
+     DIKS_CUSTOM53                 = DFB_CUSTOM_KEY( 53 ),
+     DIKS_CUSTOM54                 = DFB_CUSTOM_KEY( 54 ),
+     DIKS_CUSTOM55                 = DFB_CUSTOM_KEY( 55 ),
+     DIKS_CUSTOM56                 = DFB_CUSTOM_KEY( 56 ),
+     DIKS_CUSTOM57                 = DFB_CUSTOM_KEY( 57 ),
+     DIKS_CUSTOM58                 = DFB_CUSTOM_KEY( 58 ),
+     DIKS_CUSTOM59                 = DFB_CUSTOM_KEY( 59 ),
+     DIKS_CUSTOM60                 = DFB_CUSTOM_KEY( 60 ),
+     DIKS_CUSTOM61                 = DFB_CUSTOM_KEY( 61 ),
+     DIKS_CUSTOM62                 = DFB_CUSTOM_KEY( 62 ),
+     DIKS_CUSTOM63                 = DFB_CUSTOM_KEY( 63 ),
+     DIKS_CUSTOM64                 = DFB_CUSTOM_KEY( 64 ),
+     DIKS_CUSTOM65                 = DFB_CUSTOM_KEY( 65 ),
+     DIKS_CUSTOM66                 = DFB_CUSTOM_KEY( 66 ),
+     DIKS_CUSTOM67                 = DFB_CUSTOM_KEY( 67 ),
+     DIKS_CUSTOM68                 = DFB_CUSTOM_KEY( 68 ),
+     DIKS_CUSTOM69                 = DFB_CUSTOM_KEY( 69 ),
+     DIKS_CUSTOM70                 = DFB_CUSTOM_KEY( 70 ),
+     DIKS_CUSTOM71                 = DFB_CUSTOM_KEY( 71 ),
+     DIKS_CUSTOM72                 = DFB_CUSTOM_KEY( 72 ),
+     DIKS_CUSTOM73                 = DFB_CUSTOM_KEY( 73 ),
+     DIKS_CUSTOM74                 = DFB_CUSTOM_KEY( 74 ),
+     DIKS_CUSTOM75                 = DFB_CUSTOM_KEY( 75 ),
+     DIKS_CUSTOM76                 = DFB_CUSTOM_KEY( 76 ),
+     DIKS_CUSTOM77                 = DFB_CUSTOM_KEY( 77 ),
+     DIKS_CUSTOM78                 = DFB_CUSTOM_KEY( 78 ),
+     DIKS_CUSTOM79                 = DFB_CUSTOM_KEY( 79 ),
+     DIKS_CUSTOM80                 = DFB_CUSTOM_KEY( 80 ),
+     DIKS_CUSTOM81                 = DFB_CUSTOM_KEY( 81 ),
+     DIKS_CUSTOM82                 = DFB_CUSTOM_KEY( 82 ),
+     DIKS_CUSTOM83                 = DFB_CUSTOM_KEY( 83 ),
+     DIKS_CUSTOM84                 = DFB_CUSTOM_KEY( 84 ),
+     DIKS_CUSTOM85                 = DFB_CUSTOM_KEY( 85 ),
+     DIKS_CUSTOM86                 = DFB_CUSTOM_KEY( 86 ),
+     DIKS_CUSTOM87                 = DFB_CUSTOM_KEY( 87 ),
+     DIKS_CUSTOM88                 = DFB_CUSTOM_KEY( 88 ),
+     DIKS_CUSTOM89                 = DFB_CUSTOM_KEY( 89 ),
+     DIKS_CUSTOM90                 = DFB_CUSTOM_KEY( 90 ),
+     DIKS_CUSTOM91                 = DFB_CUSTOM_KEY( 91 ),
+     DIKS_CUSTOM92                 = DFB_CUSTOM_KEY( 92 ),
+     DIKS_CUSTOM93                 = DFB_CUSTOM_KEY( 93 ),
+     DIKS_CUSTOM94                 = DFB_CUSTOM_KEY( 94 ),
+     DIKS_CUSTOM95                 = DFB_CUSTOM_KEY( 95 ),
+     DIKS_CUSTOM96                 = DFB_CUSTOM_KEY( 96 ),
+     DIKS_CUSTOM97                 = DFB_CUSTOM_KEY( 97 ),
+     DIKS_CUSTOM98                 = DFB_CUSTOM_KEY( 98 ),
+     DIKS_CUSTOM99                 = DFB_CUSTOM_KEY( 99 ),
+     DIKS_CUSTOM100                = DFB_CUSTOM_KEY( 100 ),
+     DIKS_CUSTOM101                = DFB_CUSTOM_KEY( 101 ),
+     DIKS_CUSTOM102                = DFB_CUSTOM_KEY( 102 ),
+     DIKS_CUSTOM103                = DFB_CUSTOM_KEY( 103 ),
+     DIKS_CUSTOM104                = DFB_CUSTOM_KEY( 104 ),
+     DIKS_CUSTOM105                = DFB_CUSTOM_KEY( 105 ),
+     DIKS_CUSTOM106                = DFB_CUSTOM_KEY( 106 ),
+     DIKS_CUSTOM107                = DFB_CUSTOM_KEY( 107 ),
+     DIKS_CUSTOM108                = DFB_CUSTOM_KEY( 108 ),
+     DIKS_CUSTOM109                = DFB_CUSTOM_KEY( 109 ),
+     DIKS_CUSTOM110                = DFB_CUSTOM_KEY( 110 ),
+     DIKS_CUSTOM111                = DFB_CUSTOM_KEY( 111 ),
+     DIKS_CUSTOM112                = DFB_CUSTOM_KEY( 112 ),
+     DIKS_CUSTOM113                = DFB_CUSTOM_KEY( 113 ),
+     DIKS_CUSTOM114                = DFB_CUSTOM_KEY( 114 ),
+     DIKS_CUSTOM115                = DFB_CUSTOM_KEY( 115 ),
+     DIKS_CUSTOM116                = DFB_CUSTOM_KEY( 116 ),
+     DIKS_CUSTOM117                = DFB_CUSTOM_KEY( 117 ),
+     DIKS_CUSTOM118                = DFB_CUSTOM_KEY( 118 ),
+     DIKS_CUSTOM119                = DFB_CUSTOM_KEY( 119 ),
+     DIKS_CUSTOM120                = DFB_CUSTOM_KEY( 120 ),
+     DIKS_CUSTOM121                = DFB_CUSTOM_KEY( 121 ),
+     DIKS_CUSTOM122                = DFB_CUSTOM_KEY( 122 ),
+     DIKS_CUSTOM123                = DFB_CUSTOM_KEY( 123 ),
+     DIKS_CUSTOM124                = DFB_CUSTOM_KEY( 124 ),
+     DIKS_CUSTOM125                = DFB_CUSTOM_KEY( 125 ),
+     DIKS_CUSTOM126                = DFB_CUSTOM_KEY( 126 ),
+     DIKS_CUSTOM127                = DFB_CUSTOM_KEY( 127 ),
+     DIKS_CUSTOM128                = DFB_CUSTOM_KEY( 128 ),
+     DIKS_CUSTOM129                = DFB_CUSTOM_KEY( 129 ),
+     DIKS_CUSTOM130                = DFB_CUSTOM_KEY( 130 ),
+     DIKS_CUSTOM131                = DFB_CUSTOM_KEY( 131 ),
+     DIKS_CUSTOM132                = DFB_CUSTOM_KEY( 132 ),
+     DIKS_CUSTOM133                = DFB_CUSTOM_KEY( 133 ),
+     DIKS_CUSTOM134                = DFB_CUSTOM_KEY( 134 ),
+     DIKS_CUSTOM135                = DFB_CUSTOM_KEY( 135 ),
+     DIKS_CUSTOM136                = DFB_CUSTOM_KEY( 136 ),
+     DIKS_CUSTOM137                = DFB_CUSTOM_KEY( 137 ),
+     DIKS_CUSTOM138                = DFB_CUSTOM_KEY( 138 ),
+     DIKS_CUSTOM139                = DFB_CUSTOM_KEY( 139 ),
+     DIKS_CUSTOM140                = DFB_CUSTOM_KEY( 140 ),
+     DIKS_CUSTOM141                = DFB_CUSTOM_KEY( 141 ),
+     DIKS_CUSTOM142                = DFB_CUSTOM_KEY( 142 ),
+     DIKS_CUSTOM143                = DFB_CUSTOM_KEY( 143 ),
+     DIKS_CUSTOM144                = DFB_CUSTOM_KEY( 144 ),
+     DIKS_CUSTOM145                = DFB_CUSTOM_KEY( 145 ),
+     DIKS_CUSTOM146                = DFB_CUSTOM_KEY( 146 ),
+     DIKS_CUSTOM147                = DFB_CUSTOM_KEY( 147 ),
+     DIKS_CUSTOM148                = DFB_CUSTOM_KEY( 148 ),
+     DIKS_CUSTOM149                = DFB_CUSTOM_KEY( 149 ),
+     DIKS_CUSTOM150                = DFB_CUSTOM_KEY( 150 ),
+     DIKS_CUSTOM151                = DFB_CUSTOM_KEY( 151 ),
+     DIKS_CUSTOM152                = DFB_CUSTOM_KEY( 152 ),
+     DIKS_CUSTOM153                = DFB_CUSTOM_KEY( 153 ),
+     DIKS_CUSTOM154                = DFB_CUSTOM_KEY( 154 ),
+     DIKS_CUSTOM155                = DFB_CUSTOM_KEY( 155 ),
+     DIKS_CUSTOM156                = DFB_CUSTOM_KEY( 156 ),
+     DIKS_CUSTOM157                = DFB_CUSTOM_KEY( 157 ),
+     DIKS_CUSTOM158                = DFB_CUSTOM_KEY( 158 ),
+     DIKS_CUSTOM159                = DFB_CUSTOM_KEY( 159 ),
+     DIKS_CUSTOM160                = DFB_CUSTOM_KEY( 160 ),
+     DIKS_CUSTOM161                = DFB_CUSTOM_KEY( 161 ),
+     DIKS_CUSTOM162                = DFB_CUSTOM_KEY( 162 ),
+     DIKS_CUSTOM163                = DFB_CUSTOM_KEY( 163 ),
+     DIKS_CUSTOM164                = DFB_CUSTOM_KEY( 164 ),
+     DIKS_CUSTOM165                = DFB_CUSTOM_KEY( 165 ),
+     DIKS_CUSTOM166                = DFB_CUSTOM_KEY( 166 ),
+     DIKS_CUSTOM167                = DFB_CUSTOM_KEY( 167 ),
+     DIKS_CUSTOM168                = DFB_CUSTOM_KEY( 168 ),
+     DIKS_CUSTOM169                = DFB_CUSTOM_KEY( 169 ),
+     DIKS_CUSTOM170                = DFB_CUSTOM_KEY( 170 ),
+     DIKS_CUSTOM171                = DFB_CUSTOM_KEY( 171 ),
+     DIKS_CUSTOM172                = DFB_CUSTOM_KEY( 172 ),
+     DIKS_CUSTOM173                = DFB_CUSTOM_KEY( 173 ),
+     DIKS_CUSTOM174                = DFB_CUSTOM_KEY( 174 ),
+     DIKS_CUSTOM175                = DFB_CUSTOM_KEY( 175 ),
+     DIKS_CUSTOM176                = DFB_CUSTOM_KEY( 176 ),
+     DIKS_CUSTOM177                = DFB_CUSTOM_KEY( 177 ),
+     DIKS_CUSTOM178                = DFB_CUSTOM_KEY( 178 ),
+     DIKS_CUSTOM179                = DFB_CUSTOM_KEY( 179 ),
+     DIKS_CUSTOM180                = DFB_CUSTOM_KEY( 180 ),
+     DIKS_CUSTOM181                = DFB_CUSTOM_KEY( 181 ),
+     DIKS_CUSTOM182                = DFB_CUSTOM_KEY( 182 ),
+     DIKS_CUSTOM183                = DFB_CUSTOM_KEY( 183 ),
+     DIKS_CUSTOM184                = DFB_CUSTOM_KEY( 184 ),
+     DIKS_CUSTOM185                = DFB_CUSTOM_KEY( 185 ),
+     DIKS_CUSTOM186                = DFB_CUSTOM_KEY( 186 ),
+     DIKS_CUSTOM187                = DFB_CUSTOM_KEY( 187 ),
+     DIKS_CUSTOM188                = DFB_CUSTOM_KEY( 188 ),
+     DIKS_CUSTOM189                = DFB_CUSTOM_KEY( 189 ),
+     DIKS_CUSTOM190                = DFB_CUSTOM_KEY( 190 ),
+     DIKS_CUSTOM191                = DFB_CUSTOM_KEY( 191 ),
+     DIKS_CUSTOM192                = DFB_CUSTOM_KEY( 192 ),
+     DIKS_CUSTOM193                = DFB_CUSTOM_KEY( 193 ),
+     DIKS_CUSTOM194                = DFB_CUSTOM_KEY( 194 ),
+     DIKS_CUSTOM195                = DFB_CUSTOM_KEY( 195 ),
+     DIKS_CUSTOM196                = DFB_CUSTOM_KEY( 196 ),
+     DIKS_CUSTOM197                = DFB_CUSTOM_KEY( 197 ),
+     DIKS_CUSTOM198                = DFB_CUSTOM_KEY( 198 ),
+     DIKS_CUSTOM199                = DFB_CUSTOM_KEY( 199 ),
+     DIKS_CUSTOM200                = DFB_CUSTOM_KEY( 200 ),
+     DIKS_CUSTOM201                = DFB_CUSTOM_KEY( 201 ),
+     DIKS_CUSTOM202                = DFB_CUSTOM_KEY( 202 ),
+     DIKS_CUSTOM203                = DFB_CUSTOM_KEY( 203 ),
+     DIKS_CUSTOM204                = DFB_CUSTOM_KEY( 204 ),
+     DIKS_CUSTOM205                = DFB_CUSTOM_KEY( 205 ),
+     DIKS_CUSTOM206                = DFB_CUSTOM_KEY( 206 ),
+     DIKS_CUSTOM207                = DFB_CUSTOM_KEY( 207 ),
+     DIKS_CUSTOM208                = DFB_CUSTOM_KEY( 208 ),
+     DIKS_CUSTOM209                = DFB_CUSTOM_KEY( 209 ),
+     DIKS_CUSTOM210                = DFB_CUSTOM_KEY( 210 ),
+     DIKS_CUSTOM211                = DFB_CUSTOM_KEY( 211 ),
+     DIKS_CUSTOM212                = DFB_CUSTOM_KEY( 212 ),
+     DIKS_CUSTOM213                = DFB_CUSTOM_KEY( 213 ),
+     DIKS_CUSTOM214                = DFB_CUSTOM_KEY( 214 ),
+     DIKS_CUSTOM215                = DFB_CUSTOM_KEY( 215 ),
+     DIKS_CUSTOM216                = DFB_CUSTOM_KEY( 216 ),
+     DIKS_CUSTOM217                = DFB_CUSTOM_KEY( 217 ),
+     DIKS_CUSTOM218                = DFB_CUSTOM_KEY( 218 ),
+     DIKS_CUSTOM219                = DFB_CUSTOM_KEY( 219 ),
+     DIKS_CUSTOM220                = DFB_CUSTOM_KEY( 220 ),
+     DIKS_CUSTOM221                = DFB_CUSTOM_KEY( 221 ),
+     DIKS_CUSTOM222                = DFB_CUSTOM_KEY( 222 ),
+     DIKS_CUSTOM223                = DFB_CUSTOM_KEY( 223 ),
+     DIKS_CUSTOM224                = DFB_CUSTOM_KEY( 224 ),
+     DIKS_CUSTOM225                = DFB_CUSTOM_KEY( 225 ),
+     DIKS_CUSTOM226                = DFB_CUSTOM_KEY( 226 ),
+     DIKS_CUSTOM227                = DFB_CUSTOM_KEY( 227 ),
+     DIKS_CUSTOM228                = DFB_CUSTOM_KEY( 228 ),
+     DIKS_CUSTOM229                = DFB_CUSTOM_KEY( 229 ),
+     DIKS_CUSTOM230                = DFB_CUSTOM_KEY( 230 ),
+     DIKS_CUSTOM231                = DFB_CUSTOM_KEY( 231 ),
+     DIKS_CUSTOM232                = DFB_CUSTOM_KEY( 232 ),
+     DIKS_CUSTOM233                = DFB_CUSTOM_KEY( 233 ),
+     DIKS_CUSTOM234                = DFB_CUSTOM_KEY( 234 ),
+     DIKS_CUSTOM235                = DFB_CUSTOM_KEY( 235 ),
+     DIKS_CUSTOM236                = DFB_CUSTOM_KEY( 236 ),
+     DIKS_CUSTOM237                = DFB_CUSTOM_KEY( 237 ),
+     DIKS_CUSTOM238                = DFB_CUSTOM_KEY( 238 ),
+     DIKS_CUSTOM239                = DFB_CUSTOM_KEY( 239 ),
+     DIKS_CUSTOM240                = DFB_CUSTOM_KEY( 240 ),
+     DIKS_CUSTOM241                = DFB_CUSTOM_KEY( 241 ),
+     DIKS_CUSTOM242                = DFB_CUSTOM_KEY( 242 ),
+     DIKS_CUSTOM243                = DFB_CUSTOM_KEY( 243 ),
+     DIKS_CUSTOM244                = DFB_CUSTOM_KEY( 244 ),
+     DIKS_CUSTOM245                = DFB_CUSTOM_KEY( 245 ),
+     DIKS_CUSTOM246                = DFB_CUSTOM_KEY( 246 ),
+     DIKS_CUSTOM247                = DFB_CUSTOM_KEY( 247 ),
+     DIKS_CUSTOM248                = DFB_CUSTOM_KEY( 248 ),
+     DIKS_CUSTOM249                = DFB_CUSTOM_KEY( 249 ),
+     DIKS_CUSTOM250                = DFB_CUSTOM_KEY( 250 ),
+     DIKS_CUSTOM251                = DFB_CUSTOM_KEY( 251 ),
+     DIKS_CUSTOM252                = DFB_CUSTOM_KEY( 252 ),
+     DIKS_CUSTOM253                = DFB_CUSTOM_KEY( 253 ),
+     DIKS_CUSTOM254                = DFB_CUSTOM_KEY( 254 ),
+     DIKS_CUSTOM255                = DFB_CUSTOM_KEY( 255 )
+} DFBInputDeviceKeySymbol;
+
+/*
+ * Flags specifying the key locks that are currently active.
+ */
+typedef enum {
+     DILS_SCROLL         = 0x00000001,  /* scroll-lock active? */
+     DILS_NUM            = 0x00000002,  /* num-lock active? */
+     DILS_CAPS           = 0x00000004   /* caps-lock active? */
+} DFBInputDeviceLockState;
+
+/*
+ * Groups and levels as an index to the symbol array.
+ */
+typedef enum {
+     DIKSI_BASE          = 0x00,   /* base group, base level
+                                      (no modifier pressed) */
+     DIKSI_BASE_SHIFT    = 0x01,   /* base group, shifted level
+                                      (with Shift pressed) */
+     DIKSI_ALT           = 0x02,   /* alternative group, base level
+                                      (with AltGr pressed) */
+     DIKSI_ALT_SHIFT     = 0x03,   /* alternative group, shifted level
+                                      (with AltGr and Shift pressed) */
+
+     DIKSI_LAST          = DIKSI_ALT_SHIFT
+} DFBInputDeviceKeymapSymbolIndex;
+
+/*
+ * One entry in the keymap of an input device.
+ */
+typedef struct {
+     int                         code;                  /* hardware
+                                                           key code */
+     DFBInputDeviceLockState     locks;                 /* locks activating
+                                                           shifted level */
+     DFBInputDeviceKeyIdentifier identifier;            /* basic mapping */
+     DFBInputDeviceKeySymbol     symbols[DIKSI_LAST+1]; /* advanced key
+                                                           mapping */
+} DFBInputDeviceKeymapEntry;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/Source/DirectFB/include/directfb_keynames.h b/Source/DirectFB/include/directfb_keynames.h
new file mode 100755
index 0000000..0e06de7
--- /dev/null
+++ b/Source/DirectFB/include/directfb_keynames.h
@@ -0,0 +1,639 @@
+#ifndef __DIRECTFB_KEYNAMES_H__
+#define __DIRECTFB_KEYNAMES_H__
+
+
+struct DFBKeySymbolName {
+     DFBInputDeviceKeySymbol symbol;
+     const char *name;
+};
+
+#define DirectFBKeySymbolNames(Identifier) struct DFBKeySymbolName Identifier[] = { \
+     { DIKS_BACKSPACE, "BACKSPACE" }, \
+     { DIKS_TAB, "TAB" }, \
+     { DIKS_RETURN, "RETURN" }, \
+     { DIKS_CANCEL, "CANCEL" }, \
+     { DIKS_ESCAPE, "ESCAPE" }, \
+     { DIKS_SPACE, "SPACE" }, \
+     { DIKS_EXCLAMATION_MARK, "EXCLAMATION_MARK" }, \
+     { DIKS_QUOTATION, "QUOTATION" }, \
+     { DIKS_NUMBER_SIGN, "NUMBER_SIGN" }, \
+     { DIKS_DOLLAR_SIGN, "DOLLAR_SIGN" }, \
+     { DIKS_PERCENT_SIGN, "PERCENT_SIGN" }, \
+     { DIKS_AMPERSAND, "AMPERSAND" }, \
+     { DIKS_APOSTROPHE, "APOSTROPHE" }, \
+     { DIKS_PARENTHESIS_LEFT, "PARENTHESIS_LEFT" }, \
+     { DIKS_PARENTHESIS_RIGHT, "PARENTHESIS_RIGHT" }, \
+     { DIKS_ASTERISK, "ASTERISK" }, \
+     { DIKS_PLUS_SIGN, "PLUS_SIGN" }, \
+     { DIKS_COMMA, "COMMA" }, \
+     { DIKS_MINUS_SIGN, "MINUS_SIGN" }, \
+     { DIKS_PERIOD, "PERIOD" }, \
+     { DIKS_SLASH, "SLASH" }, \
+     { DIKS_0, "0" }, \
+     { DIKS_1, "1" }, \
+     { DIKS_2, "2" }, \
+     { DIKS_3, "3" }, \
+     { DIKS_4, "4" }, \
+     { DIKS_5, "5" }, \
+     { DIKS_6, "6" }, \
+     { DIKS_7, "7" }, \
+     { DIKS_8, "8" }, \
+     { DIKS_9, "9" }, \
+     { DIKS_COLON, "COLON" }, \
+     { DIKS_SEMICOLON, "SEMICOLON" }, \
+     { DIKS_LESS_THAN_SIGN, "LESS_THAN_SIGN" }, \
+     { DIKS_EQUALS_SIGN, "EQUALS_SIGN" }, \
+     { DIKS_GREATER_THAN_SIGN, "GREATER_THAN_SIGN" }, \
+     { DIKS_QUESTION_MARK, "QUESTION_MARK" }, \
+     { DIKS_AT, "AT" }, \
+     { DIKS_CAPITAL_A, "CAPITAL_A" }, \
+     { DIKS_CAPITAL_B, "CAPITAL_B" }, \
+     { DIKS_CAPITAL_C, "CAPITAL_C" }, \
+     { DIKS_CAPITAL_D, "CAPITAL_D" }, \
+     { DIKS_CAPITAL_E, "CAPITAL_E" }, \
+     { DIKS_CAPITAL_F, "CAPITAL_F" }, \
+     { DIKS_CAPITAL_G, "CAPITAL_G" }, \
+     { DIKS_CAPITAL_H, "CAPITAL_H" }, \
+     { DIKS_CAPITAL_I, "CAPITAL_I" }, \
+     { DIKS_CAPITAL_J, "CAPITAL_J" }, \
+     { DIKS_CAPITAL_K, "CAPITAL_K" }, \
+     { DIKS_CAPITAL_L, "CAPITAL_L" }, \
+     { DIKS_CAPITAL_M, "CAPITAL_M" }, \
+     { DIKS_CAPITAL_N, "CAPITAL_N" }, \
+     { DIKS_CAPITAL_O, "CAPITAL_O" }, \
+     { DIKS_CAPITAL_P, "CAPITAL_P" }, \
+     { DIKS_CAPITAL_Q, "CAPITAL_Q" }, \
+     { DIKS_CAPITAL_R, "CAPITAL_R" }, \
+     { DIKS_CAPITAL_S, "CAPITAL_S" }, \
+     { DIKS_CAPITAL_T, "CAPITAL_T" }, \
+     { DIKS_CAPITAL_U, "CAPITAL_U" }, \
+     { DIKS_CAPITAL_V, "CAPITAL_V" }, \
+     { DIKS_CAPITAL_W, "CAPITAL_W" }, \
+     { DIKS_CAPITAL_X, "CAPITAL_X" }, \
+     { DIKS_CAPITAL_Y, "CAPITAL_Y" }, \
+     { DIKS_CAPITAL_Z, "CAPITAL_Z" }, \
+     { DIKS_SQUARE_BRACKET_LEFT, "SQUARE_BRACKET_LEFT" }, \
+     { DIKS_BACKSLASH, "BACKSLASH" }, \
+     { DIKS_SQUARE_BRACKET_RIGHT, "SQUARE_BRACKET_RIGHT" }, \
+     { DIKS_CIRCUMFLEX_ACCENT, "CIRCUMFLEX_ACCENT" }, \
+     { DIKS_UNDERSCORE, "UNDERSCORE" }, \
+     { DIKS_GRAVE_ACCENT, "GRAVE_ACCENT" }, \
+     { DIKS_SMALL_A, "SMALL_A" }, \
+     { DIKS_SMALL_B, "SMALL_B" }, \
+     { DIKS_SMALL_C, "SMALL_C" }, \
+     { DIKS_SMALL_D, "SMALL_D" }, \
+     { DIKS_SMALL_E, "SMALL_E" }, \
+     { DIKS_SMALL_F, "SMALL_F" }, \
+     { DIKS_SMALL_G, "SMALL_G" }, \
+     { DIKS_SMALL_H, "SMALL_H" }, \
+     { DIKS_SMALL_I, "SMALL_I" }, \
+     { DIKS_SMALL_J, "SMALL_J" }, \
+     { DIKS_SMALL_K, "SMALL_K" }, \
+     { DIKS_SMALL_L, "SMALL_L" }, \
+     { DIKS_SMALL_M, "SMALL_M" }, \
+     { DIKS_SMALL_N, "SMALL_N" }, \
+     { DIKS_SMALL_O, "SMALL_O" }, \
+     { DIKS_SMALL_P, "SMALL_P" }, \
+     { DIKS_SMALL_Q, "SMALL_Q" }, \
+     { DIKS_SMALL_R, "SMALL_R" }, \
+     { DIKS_SMALL_S, "SMALL_S" }, \
+     { DIKS_SMALL_T, "SMALL_T" }, \
+     { DIKS_SMALL_U, "SMALL_U" }, \
+     { DIKS_SMALL_V, "SMALL_V" }, \
+     { DIKS_SMALL_W, "SMALL_W" }, \
+     { DIKS_SMALL_X, "SMALL_X" }, \
+     { DIKS_SMALL_Y, "SMALL_Y" }, \
+     { DIKS_SMALL_Z, "SMALL_Z" }, \
+     { DIKS_CURLY_BRACKET_LEFT, "CURLY_BRACKET_LEFT" }, \
+     { DIKS_VERTICAL_BAR, "VERTICAL_BAR" }, \
+     { DIKS_CURLY_BRACKET_RIGHT, "CURLY_BRACKET_RIGHT" }, \
+     { DIKS_TILDE, "TILDE" }, \
+     { DIKS_DELETE, "DELETE" }, \
+     { DIKS_CURSOR_LEFT, "CURSOR_LEFT" }, \
+     { DIKS_CURSOR_RIGHT, "CURSOR_RIGHT" }, \
+     { DIKS_CURSOR_UP, "CURSOR_UP" }, \
+     { DIKS_CURSOR_DOWN, "CURSOR_DOWN" }, \
+     { DIKS_INSERT, "INSERT" }, \
+     { DIKS_HOME, "HOME" }, \
+     { DIKS_END, "END" }, \
+     { DIKS_PAGE_UP, "PAGE_UP" }, \
+     { DIKS_PAGE_DOWN, "PAGE_DOWN" }, \
+     { DIKS_PRINT, "PRINT" }, \
+     { DIKS_PAUSE, "PAUSE" }, \
+     { DIKS_OK, "OK" }, \
+     { DIKS_SELECT, "SELECT" }, \
+     { DIKS_GOTO, "GOTO" }, \
+     { DIKS_CLEAR, "CLEAR" }, \
+     { DIKS_POWER, "POWER" }, \
+     { DIKS_POWER2, "POWER2" }, \
+     { DIKS_OPTION, "OPTION" }, \
+     { DIKS_MENU, "MENU" }, \
+     { DIKS_HELP, "HELP" }, \
+     { DIKS_INFO, "INFO" }, \
+     { DIKS_TIME, "TIME" }, \
+     { DIKS_VENDOR, "VENDOR" }, \
+     { DIKS_ARCHIVE, "ARCHIVE" }, \
+     { DIKS_PROGRAM, "PROGRAM" }, \
+     { DIKS_CHANNEL, "CHANNEL" }, \
+     { DIKS_FAVORITES, "FAVORITES" }, \
+     { DIKS_EPG, "EPG" }, \
+     { DIKS_PVR, "PVR" }, \
+     { DIKS_MHP, "MHP" }, \
+     { DIKS_LANGUAGE, "LANGUAGE" }, \
+     { DIKS_TITLE, "TITLE" }, \
+     { DIKS_SUBTITLE, "SUBTITLE" }, \
+     { DIKS_ANGLE, "ANGLE" }, \
+     { DIKS_ZOOM, "ZOOM" }, \
+     { DIKS_MODE, "MODE" }, \
+     { DIKS_KEYBOARD, "KEYBOARD" }, \
+     { DIKS_PC, "PC" }, \
+     { DIKS_SCREEN, "SCREEN" }, \
+     { DIKS_TV, "TV" }, \
+     { DIKS_TV2, "TV2" }, \
+     { DIKS_VCR, "VCR" }, \
+     { DIKS_VCR2, "VCR2" }, \
+     { DIKS_SAT, "SAT" }, \
+     { DIKS_SAT2, "SAT2" }, \
+     { DIKS_CD, "CD" }, \
+     { DIKS_TAPE, "TAPE" }, \
+     { DIKS_RADIO, "RADIO" }, \
+     { DIKS_TUNER, "TUNER" }, \
+     { DIKS_PLAYER, "PLAYER" }, \
+     { DIKS_TEXT, "TEXT" }, \
+     { DIKS_DVD, "DVD" }, \
+     { DIKS_AUX, "AUX" }, \
+     { DIKS_MP3, "MP3" }, \
+     { DIKS_PHONE, "PHONE" }, \
+     { DIKS_AUDIO, "AUDIO" }, \
+     { DIKS_VIDEO, "VIDEO" }, \
+     { DIKS_INTERNET, "INTERNET" }, \
+     { DIKS_MAIL, "MAIL" }, \
+     { DIKS_NEWS, "NEWS" }, \
+     { DIKS_DIRECTORY, "DIRECTORY" }, \
+     { DIKS_LIST, "LIST" }, \
+     { DIKS_CALCULATOR, "CALCULATOR" }, \
+     { DIKS_MEMO, "MEMO" }, \
+     { DIKS_CALENDAR, "CALENDAR" }, \
+     { DIKS_EDITOR, "EDITOR" }, \
+     { DIKS_RED, "RED" }, \
+     { DIKS_GREEN, "GREEN" }, \
+     { DIKS_YELLOW, "YELLOW" }, \
+     { DIKS_BLUE, "BLUE" }, \
+     { DIKS_CHANNEL_UP, "CHANNEL_UP" }, \
+     { DIKS_CHANNEL_DOWN, "CHANNEL_DOWN" }, \
+     { DIKS_BACK, "BACK" }, \
+     { DIKS_FORWARD, "FORWARD" }, \
+     { DIKS_FIRST, "FIRST" }, \
+     { DIKS_LAST, "LAST" }, \
+     { DIKS_VOLUME_UP, "VOLUME_UP" }, \
+     { DIKS_VOLUME_DOWN, "VOLUME_DOWN" }, \
+     { DIKS_MUTE, "MUTE" }, \
+     { DIKS_AB, "AB" }, \
+     { DIKS_PLAYPAUSE, "PLAYPAUSE" }, \
+     { DIKS_PLAY, "PLAY" }, \
+     { DIKS_STOP, "STOP" }, \
+     { DIKS_RESTART, "RESTART" }, \
+     { DIKS_SLOW, "SLOW" }, \
+     { DIKS_FAST, "FAST" }, \
+     { DIKS_RECORD, "RECORD" }, \
+     { DIKS_EJECT, "EJECT" }, \
+     { DIKS_SHUFFLE, "SHUFFLE" }, \
+     { DIKS_REWIND, "REWIND" }, \
+     { DIKS_FASTFORWARD, "FASTFORWARD" }, \
+     { DIKS_PREVIOUS, "PREVIOUS" }, \
+     { DIKS_NEXT, "NEXT" }, \
+     { DIKS_BEGIN, "BEGIN" }, \
+     { DIKS_DIGITS, "DIGITS" }, \
+     { DIKS_TEEN, "TEEN" }, \
+     { DIKS_TWEN, "TWEN" }, \
+     { DIKS_BREAK, "BREAK" }, \
+     { DIKS_EXIT, "EXIT" }, \
+     { DIKS_SETUP, "SETUP" }, \
+     { DIKS_CURSOR_LEFT_UP, "CURSOR_LEFT_UP" }, \
+     { DIKS_CURSOR_LEFT_DOWN, "CURSOR_LEFT_DOWN" }, \
+     { DIKS_CURSOR_UP_RIGHT, "CURSOR_UP_RIGHT" }, \
+     { DIKS_CURSOR_DOWN_RIGHT, "CURSOR_DOWN_RIGHT" }, \
+     { DIKS_F1, "F1" }, \
+     { DIKS_F2, "F2" }, \
+     { DIKS_F3, "F3" }, \
+     { DIKS_F4, "F4" }, \
+     { DIKS_F5, "F5" }, \
+     { DIKS_F6, "F6" }, \
+     { DIKS_F7, "F7" }, \
+     { DIKS_F8, "F8" }, \
+     { DIKS_F9, "F9" }, \
+     { DIKS_F10, "F10" }, \
+     { DIKS_F11, "F11" }, \
+     { DIKS_F12, "F12" }, \
+     { DIKS_SHIFT, "SHIFT" }, \
+     { DIKS_CONTROL, "CONTROL" }, \
+     { DIKS_ALT, "ALT" }, \
+     { DIKS_ALTGR, "ALTGR" }, \
+     { DIKS_META, "META" }, \
+     { DIKS_SUPER, "SUPER" }, \
+     { DIKS_HYPER, "HYPER" }, \
+     { DIKS_CAPS_LOCK, "CAPS_LOCK" }, \
+     { DIKS_NUM_LOCK, "NUM_LOCK" }, \
+     { DIKS_SCROLL_LOCK, "SCROLL_LOCK" }, \
+     { DIKS_DEAD_ABOVEDOT, "DEAD_ABOVEDOT" }, \
+     { DIKS_DEAD_ABOVERING, "DEAD_ABOVERING" }, \
+     { DIKS_DEAD_ACUTE, "DEAD_ACUTE" }, \
+     { DIKS_DEAD_BREVE, "DEAD_BREVE" }, \
+     { DIKS_DEAD_CARON, "DEAD_CARON" }, \
+     { DIKS_DEAD_CEDILLA, "DEAD_CEDILLA" }, \
+     { DIKS_DEAD_CIRCUMFLEX, "DEAD_CIRCUMFLEX" }, \
+     { DIKS_DEAD_DIAERESIS, "DEAD_DIAERESIS" }, \
+     { DIKS_DEAD_DOUBLEACUTE, "DEAD_DOUBLEACUTE" }, \
+     { DIKS_DEAD_GRAVE, "DEAD_GRAVE" }, \
+     { DIKS_DEAD_IOTA, "DEAD_IOTA" }, \
+     { DIKS_DEAD_MACRON, "DEAD_MACRON" }, \
+     { DIKS_DEAD_OGONEK, "DEAD_OGONEK" }, \
+     { DIKS_DEAD_SEMIVOICED_SOUND, "DEAD_SEMIVOICED_SOUND" }, \
+     { DIKS_DEAD_TILDE, "DEAD_TILDE" }, \
+     { DIKS_DEAD_VOICED_SOUND, "DEAD_VOICED_SOUND" }, \
+     { DIKS_CUSTOM0, "CUSTOM0" }, \
+     { DIKS_CUSTOM1, "CUSTOM1" }, \
+     { DIKS_CUSTOM2, "CUSTOM2" }, \
+     { DIKS_CUSTOM3, "CUSTOM3" }, \
+     { DIKS_CUSTOM4, "CUSTOM4" }, \
+     { DIKS_CUSTOM5, "CUSTOM5" }, \
+     { DIKS_CUSTOM6, "CUSTOM6" }, \
+     { DIKS_CUSTOM7, "CUSTOM7" }, \
+     { DIKS_CUSTOM8, "CUSTOM8" }, \
+     { DIKS_CUSTOM9, "CUSTOM9" }, \
+     { DIKS_CUSTOM10, "CUSTOM10" }, \
+     { DIKS_CUSTOM11, "CUSTOM11" }, \
+     { DIKS_CUSTOM12, "CUSTOM12" }, \
+     { DIKS_CUSTOM13, "CUSTOM13" }, \
+     { DIKS_CUSTOM14, "CUSTOM14" }, \
+     { DIKS_CUSTOM15, "CUSTOM15" }, \
+     { DIKS_CUSTOM16, "CUSTOM16" }, \
+     { DIKS_CUSTOM17, "CUSTOM17" }, \
+     { DIKS_CUSTOM18, "CUSTOM18" }, \
+     { DIKS_CUSTOM19, "CUSTOM19" }, \
+     { DIKS_CUSTOM20, "CUSTOM20" }, \
+     { DIKS_CUSTOM21, "CUSTOM21" }, \
+     { DIKS_CUSTOM22, "CUSTOM22" }, \
+     { DIKS_CUSTOM23, "CUSTOM23" }, \
+     { DIKS_CUSTOM24, "CUSTOM24" }, \
+     { DIKS_CUSTOM25, "CUSTOM25" }, \
+     { DIKS_CUSTOM26, "CUSTOM26" }, \
+     { DIKS_CUSTOM27, "CUSTOM27" }, \
+     { DIKS_CUSTOM28, "CUSTOM28" }, \
+     { DIKS_CUSTOM29, "CUSTOM29" }, \
+     { DIKS_CUSTOM30, "CUSTOM30" }, \
+     { DIKS_CUSTOM31, "CUSTOM31" }, \
+     { DIKS_CUSTOM32, "CUSTOM32" }, \
+     { DIKS_CUSTOM33, "CUSTOM33" }, \
+     { DIKS_CUSTOM34, "CUSTOM34" }, \
+     { DIKS_CUSTOM35, "CUSTOM35" }, \
+     { DIKS_CUSTOM36, "CUSTOM36" }, \
+     { DIKS_CUSTOM37, "CUSTOM37" }, \
+     { DIKS_CUSTOM38, "CUSTOM38" }, \
+     { DIKS_CUSTOM39, "CUSTOM39" }, \
+     { DIKS_CUSTOM40, "CUSTOM40" }, \
+     { DIKS_CUSTOM41, "CUSTOM41" }, \
+     { DIKS_CUSTOM42, "CUSTOM42" }, \
+     { DIKS_CUSTOM43, "CUSTOM43" }, \
+     { DIKS_CUSTOM44, "CUSTOM44" }, \
+     { DIKS_CUSTOM45, "CUSTOM45" }, \
+     { DIKS_CUSTOM46, "CUSTOM46" }, \
+     { DIKS_CUSTOM47, "CUSTOM47" }, \
+     { DIKS_CUSTOM48, "CUSTOM48" }, \
+     { DIKS_CUSTOM49, "CUSTOM49" }, \
+     { DIKS_CUSTOM50, "CUSTOM50" }, \
+     { DIKS_CUSTOM51, "CUSTOM51" }, \
+     { DIKS_CUSTOM52, "CUSTOM52" }, \
+     { DIKS_CUSTOM53, "CUSTOM53" }, \
+     { DIKS_CUSTOM54, "CUSTOM54" }, \
+     { DIKS_CUSTOM55, "CUSTOM55" }, \
+     { DIKS_CUSTOM56, "CUSTOM56" }, \
+     { DIKS_CUSTOM57, "CUSTOM57" }, \
+     { DIKS_CUSTOM58, "CUSTOM58" }, \
+     { DIKS_CUSTOM59, "CUSTOM59" }, \
+     { DIKS_CUSTOM60, "CUSTOM60" }, \
+     { DIKS_CUSTOM61, "CUSTOM61" }, \
+     { DIKS_CUSTOM62, "CUSTOM62" }, \
+     { DIKS_CUSTOM63, "CUSTOM63" }, \
+     { DIKS_CUSTOM64, "CUSTOM64" }, \
+     { DIKS_CUSTOM65, "CUSTOM65" }, \
+     { DIKS_CUSTOM66, "CUSTOM66" }, \
+     { DIKS_CUSTOM67, "CUSTOM67" }, \
+     { DIKS_CUSTOM68, "CUSTOM68" }, \
+     { DIKS_CUSTOM69, "CUSTOM69" }, \
+     { DIKS_CUSTOM70, "CUSTOM70" }, \
+     { DIKS_CUSTOM71, "CUSTOM71" }, \
+     { DIKS_CUSTOM72, "CUSTOM72" }, \
+     { DIKS_CUSTOM73, "CUSTOM73" }, \
+     { DIKS_CUSTOM74, "CUSTOM74" }, \
+     { DIKS_CUSTOM75, "CUSTOM75" }, \
+     { DIKS_CUSTOM76, "CUSTOM76" }, \
+     { DIKS_CUSTOM77, "CUSTOM77" }, \
+     { DIKS_CUSTOM78, "CUSTOM78" }, \
+     { DIKS_CUSTOM79, "CUSTOM79" }, \
+     { DIKS_CUSTOM80, "CUSTOM80" }, \
+     { DIKS_CUSTOM81, "CUSTOM81" }, \
+     { DIKS_CUSTOM82, "CUSTOM82" }, \
+     { DIKS_CUSTOM83, "CUSTOM83" }, \
+     { DIKS_CUSTOM84, "CUSTOM84" }, \
+     { DIKS_CUSTOM85, "CUSTOM85" }, \
+     { DIKS_CUSTOM86, "CUSTOM86" }, \
+     { DIKS_CUSTOM87, "CUSTOM87" }, \
+     { DIKS_CUSTOM88, "CUSTOM88" }, \
+     { DIKS_CUSTOM89, "CUSTOM89" }, \
+     { DIKS_CUSTOM90, "CUSTOM90" }, \
+     { DIKS_CUSTOM91, "CUSTOM91" }, \
+     { DIKS_CUSTOM92, "CUSTOM92" }, \
+     { DIKS_CUSTOM93, "CUSTOM93" }, \
+     { DIKS_CUSTOM94, "CUSTOM94" }, \
+     { DIKS_CUSTOM95, "CUSTOM95" }, \
+     { DIKS_CUSTOM96, "CUSTOM96" }, \
+     { DIKS_CUSTOM97, "CUSTOM97" }, \
+     { DIKS_CUSTOM98, "CUSTOM98" }, \
+     { DIKS_CUSTOM99, "CUSTOM99" }, \
+     { DIKS_CUSTOM100,  "CUSTOM100" }, \
+     { DIKS_CUSTOM101,  "CUSTOM101" }, \
+     { DIKS_CUSTOM102,  "CUSTOM102" }, \
+     { DIKS_CUSTOM103,  "CUSTOM103" }, \
+     { DIKS_CUSTOM104,  "CUSTOM104" }, \
+     { DIKS_CUSTOM105,  "CUSTOM105" }, \
+     { DIKS_CUSTOM106,  "CUSTOM106" }, \
+     { DIKS_CUSTOM107,  "CUSTOM107" }, \
+     { DIKS_CUSTOM108,  "CUSTOM108" }, \
+     { DIKS_CUSTOM109,  "CUSTOM109" }, \
+     { DIKS_CUSTOM110,  "CUSTOM110" }, \
+     { DIKS_CUSTOM111,  "CUSTOM111" }, \
+     { DIKS_CUSTOM112,  "CUSTOM112" }, \
+     { DIKS_CUSTOM113,  "CUSTOM113" }, \
+     { DIKS_CUSTOM114,  "CUSTOM114" }, \
+     { DIKS_CUSTOM115,  "CUSTOM115" }, \
+     { DIKS_CUSTOM116,  "CUSTOM116" }, \
+     { DIKS_CUSTOM117,  "CUSTOM117" }, \
+     { DIKS_CUSTOM118,  "CUSTOM118" }, \
+     { DIKS_CUSTOM119,  "CUSTOM119" }, \
+     { DIKS_CUSTOM120,  "CUSTOM120" }, \
+     { DIKS_CUSTOM121,  "CUSTOM121" }, \
+     { DIKS_CUSTOM122,  "CUSTOM122" }, \
+     { DIKS_CUSTOM123,  "CUSTOM123" }, \
+     { DIKS_CUSTOM124,  "CUSTOM124" }, \
+     { DIKS_CUSTOM125,  "CUSTOM125" }, \
+     { DIKS_CUSTOM126,  "CUSTOM126" }, \
+     { DIKS_CUSTOM127,  "CUSTOM127" }, \
+     { DIKS_CUSTOM128,  "CUSTOM128" }, \
+     { DIKS_CUSTOM129,  "CUSTOM129" }, \
+     { DIKS_CUSTOM130,  "CUSTOM130" }, \
+     { DIKS_CUSTOM131,  "CUSTOM131" }, \
+     { DIKS_CUSTOM132,  "CUSTOM132" }, \
+     { DIKS_CUSTOM133,  "CUSTOM133" }, \
+     { DIKS_CUSTOM134,  "CUSTOM134" }, \
+     { DIKS_CUSTOM135,  "CUSTOM135" }, \
+     { DIKS_CUSTOM136,  "CUSTOM136" }, \
+     { DIKS_CUSTOM137,  "CUSTOM137" }, \
+     { DIKS_CUSTOM138,  "CUSTOM138" }, \
+     { DIKS_CUSTOM139,  "CUSTOM139" }, \
+     { DIKS_CUSTOM140,  "CUSTOM140" }, \
+     { DIKS_CUSTOM141,  "CUSTOM141" }, \
+     { DIKS_CUSTOM142,  "CUSTOM142" }, \
+     { DIKS_CUSTOM143,  "CUSTOM143" }, \
+     { DIKS_CUSTOM144,  "CUSTOM144" }, \
+     { DIKS_CUSTOM145,  "CUSTOM145" }, \
+     { DIKS_CUSTOM146,  "CUSTOM146" }, \
+     { DIKS_CUSTOM147,  "CUSTOM147" }, \
+     { DIKS_CUSTOM148,  "CUSTOM148" }, \
+     { DIKS_CUSTOM149,  "CUSTOM149" }, \
+     { DIKS_CUSTOM150,  "CUSTOM150" }, \
+     { DIKS_CUSTOM151,  "CUSTOM151" }, \
+     { DIKS_CUSTOM152,  "CUSTOM152" }, \
+     { DIKS_CUSTOM153,  "CUSTOM153" }, \
+     { DIKS_CUSTOM154,  "CUSTOM154" }, \
+     { DIKS_CUSTOM155,  "CUSTOM155" }, \
+     { DIKS_CUSTOM156,  "CUSTOM156" }, \
+     { DIKS_CUSTOM157,  "CUSTOM157" }, \
+     { DIKS_CUSTOM158,  "CUSTOM158" }, \
+     { DIKS_CUSTOM159,  "CUSTOM159" }, \
+     { DIKS_CUSTOM160,  "CUSTOM160" }, \
+     { DIKS_CUSTOM161,  "CUSTOM161" }, \
+     { DIKS_CUSTOM162,  "CUSTOM162" }, \
+     { DIKS_CUSTOM163,  "CUSTOM163" }, \
+     { DIKS_CUSTOM164,  "CUSTOM164" }, \
+     { DIKS_CUSTOM165,  "CUSTOM165" }, \
+     { DIKS_CUSTOM166,  "CUSTOM166" }, \
+     { DIKS_CUSTOM167,  "CUSTOM167" }, \
+     { DIKS_CUSTOM168,  "CUSTOM168" }, \
+     { DIKS_CUSTOM169,  "CUSTOM169" }, \
+     { DIKS_CUSTOM170,  "CUSTOM170" }, \
+     { DIKS_CUSTOM171,  "CUSTOM171" }, \
+     { DIKS_CUSTOM172,  "CUSTOM172" }, \
+     { DIKS_CUSTOM173,  "CUSTOM173" }, \
+     { DIKS_CUSTOM174,  "CUSTOM174" }, \
+     { DIKS_CUSTOM175,  "CUSTOM175" }, \
+     { DIKS_CUSTOM176,  "CUSTOM176" }, \
+     { DIKS_CUSTOM177,  "CUSTOM177" }, \
+     { DIKS_CUSTOM178,  "CUSTOM178" }, \
+     { DIKS_CUSTOM179,  "CUSTOM179" }, \
+     { DIKS_CUSTOM180,  "CUSTOM180" }, \
+     { DIKS_CUSTOM181,  "CUSTOM181" }, \
+     { DIKS_CUSTOM182,  "CUSTOM182" }, \
+     { DIKS_CUSTOM183,  "CUSTOM183" }, \
+     { DIKS_CUSTOM184,  "CUSTOM184" }, \
+     { DIKS_CUSTOM185,  "CUSTOM185" }, \
+     { DIKS_CUSTOM186,  "CUSTOM186" }, \
+     { DIKS_CUSTOM187,  "CUSTOM187" }, \
+     { DIKS_CUSTOM188,  "CUSTOM188" }, \
+     { DIKS_CUSTOM189,  "CUSTOM189" }, \
+     { DIKS_CUSTOM190,  "CUSTOM190" }, \
+     { DIKS_CUSTOM191,  "CUSTOM191" }, \
+     { DIKS_CUSTOM192,  "CUSTOM192" }, \
+     { DIKS_CUSTOM193,  "CUSTOM193" }, \
+     { DIKS_CUSTOM194,  "CUSTOM194" }, \
+     { DIKS_CUSTOM195,  "CUSTOM195" }, \
+     { DIKS_CUSTOM196,  "CUSTOM196" }, \
+     { DIKS_CUSTOM197,  "CUSTOM197" }, \
+     { DIKS_CUSTOM198,  "CUSTOM198" }, \
+     { DIKS_CUSTOM199,  "CUSTOM199" }, \
+     { DIKS_CUSTOM200,  "CUSTOM200" }, \
+     { DIKS_CUSTOM201,  "CUSTOM201" }, \
+     { DIKS_CUSTOM202,  "CUSTOM202" }, \
+     { DIKS_CUSTOM203,  "CUSTOM203" }, \
+     { DIKS_CUSTOM204,  "CUSTOM204" }, \
+     { DIKS_CUSTOM205,  "CUSTOM205" }, \
+     { DIKS_CUSTOM206,  "CUSTOM206" }, \
+     { DIKS_CUSTOM207,  "CUSTOM207" }, \
+     { DIKS_CUSTOM208,  "CUSTOM208" }, \
+     { DIKS_CUSTOM209,  "CUSTOM209" }, \
+     { DIKS_CUSTOM210,  "CUSTOM210" }, \
+     { DIKS_CUSTOM211,  "CUSTOM211" }, \
+     { DIKS_CUSTOM212,  "CUSTOM212" }, \
+     { DIKS_CUSTOM213,  "CUSTOM213" }, \
+     { DIKS_CUSTOM214,  "CUSTOM214" }, \
+     { DIKS_CUSTOM215,  "CUSTOM215" }, \
+     { DIKS_CUSTOM216,  "CUSTOM216" }, \
+     { DIKS_CUSTOM217,  "CUSTOM217" }, \
+     { DIKS_CUSTOM218,  "CUSTOM218" }, \
+     { DIKS_CUSTOM219,  "CUSTOM219" }, \
+     { DIKS_CUSTOM220,  "CUSTOM220" }, \
+     { DIKS_CUSTOM221,  "CUSTOM221" }, \
+     { DIKS_CUSTOM222,  "CUSTOM222" }, \
+     { DIKS_CUSTOM223,  "CUSTOM223" }, \
+     { DIKS_CUSTOM224,  "CUSTOM224" }, \
+     { DIKS_CUSTOM225,  "CUSTOM225" }, \
+     { DIKS_CUSTOM226,  "CUSTOM226" }, \
+     { DIKS_CUSTOM227,  "CUSTOM227" }, \
+     { DIKS_CUSTOM228,  "CUSTOM228" }, \
+     { DIKS_CUSTOM229,  "CUSTOM229" }, \
+     { DIKS_CUSTOM230,  "CUSTOM230" }, \
+     { DIKS_CUSTOM231,  "CUSTOM231" }, \
+     { DIKS_CUSTOM232,  "CUSTOM232" }, \
+     { DIKS_CUSTOM233,  "CUSTOM233" }, \
+     { DIKS_CUSTOM234,  "CUSTOM234" }, \
+     { DIKS_CUSTOM235,  "CUSTOM235" }, \
+     { DIKS_CUSTOM236,  "CUSTOM236" }, \
+     { DIKS_CUSTOM237,  "CUSTOM237" }, \
+     { DIKS_CUSTOM238,  "CUSTOM238" }, \
+     { DIKS_CUSTOM239,  "CUSTOM239" }, \
+     { DIKS_CUSTOM240,  "CUSTOM240" }, \
+     { DIKS_CUSTOM241,  "CUSTOM241" }, \
+     { DIKS_CUSTOM242,  "CUSTOM242" }, \
+     { DIKS_CUSTOM243,  "CUSTOM243" }, \
+     { DIKS_CUSTOM244,  "CUSTOM244" }, \
+     { DIKS_CUSTOM245,  "CUSTOM245" }, \
+     { DIKS_CUSTOM246,  "CUSTOM246" }, \
+     { DIKS_CUSTOM247,  "CUSTOM247" }, \
+     { DIKS_CUSTOM248,  "CUSTOM248" }, \
+     { DIKS_CUSTOM249,  "CUSTOM249" }, \
+     { DIKS_CUSTOM250,  "CUSTOM250" }, \
+     { DIKS_CUSTOM251,  "CUSTOM251" }, \
+     { DIKS_CUSTOM252,  "CUSTOM252" }, \
+     { DIKS_CUSTOM253,  "CUSTOM253" }, \
+     { DIKS_CUSTOM254,  "CUSTOM254" }, \
+     { DIKS_CUSTOM255,  "CUSTOM255" }, \
+     { DIKS_NULL, "NULL" } \
+};
+
+
+struct DFBKeyIdentifierName {
+     DFBInputDeviceKeyIdentifier identifier;
+     const char *name;
+};
+
+#define DirectFBKeyIdentifierNames(Identifier) struct DFBKeyIdentifierName Identifier[] = { \
+     { DIKI_A, "A" }, \
+     { DIKI_B, "B" }, \
+     { DIKI_C, "C" }, \
+     { DIKI_D, "D" }, \
+     { DIKI_E, "E" }, \
+     { DIKI_F, "F" }, \
+     { DIKI_G, "G" }, \
+     { DIKI_H, "H" }, \
+     { DIKI_I, "I" }, \
+     { DIKI_J, "J" }, \
+     { DIKI_K, "K" }, \
+     { DIKI_L, "L" }, \
+     { DIKI_M, "M" }, \
+     { DIKI_N, "N" }, \
+     { DIKI_O, "O" }, \
+     { DIKI_P, "P" }, \
+     { DIKI_Q, "Q" }, \
+     { DIKI_R, "R" }, \
+     { DIKI_S, "S" }, \
+     { DIKI_T, "T" }, \
+     { DIKI_U, "U" }, \
+     { DIKI_V, "V" }, \
+     { DIKI_W, "W" }, \
+     { DIKI_X, "X" }, \
+     { DIKI_Y, "Y" }, \
+     { DIKI_Z, "Z" }, \
+     { DIKI_0, "0" }, \
+     { DIKI_1, "1" }, \
+     { DIKI_2, "2" }, \
+     { DIKI_3, "3" }, \
+     { DIKI_4, "4" }, \
+     { DIKI_5, "5" }, \
+     { DIKI_6, "6" }, \
+     { DIKI_7, "7" }, \
+     { DIKI_8, "8" }, \
+     { DIKI_9, "9" }, \
+     { DIKI_F1, "F1" }, \
+     { DIKI_F2, "F2" }, \
+     { DIKI_F3, "F3" }, \
+     { DIKI_F4, "F4" }, \
+     { DIKI_F5, "F5" }, \
+     { DIKI_F6, "F6" }, \
+     { DIKI_F7, "F7" }, \
+     { DIKI_F8, "F8" }, \
+     { DIKI_F9, "F9" }, \
+     { DIKI_F10, "F10" }, \
+     { DIKI_F11, "F11" }, \
+     { DIKI_F12, "F12" }, \
+     { DIKI_SHIFT_L, "SHIFT_L" }, \
+     { DIKI_SHIFT_R, "SHIFT_R" }, \
+     { DIKI_CONTROL_L, "CONTROL_L" }, \
+     { DIKI_CONTROL_R, "CONTROL_R" }, \
+     { DIKI_ALT_L, "ALT_L" }, \
+     { DIKI_ALT_R, "ALT_R" }, \
+     { DIKI_META_L, "META_L" }, \
+     { DIKI_META_R, "META_R" }, \
+     { DIKI_SUPER_L, "SUPER_L" }, \
+     { DIKI_SUPER_R, "SUPER_R" }, \
+     { DIKI_HYPER_L, "HYPER_L" }, \
+     { DIKI_HYPER_R, "HYPER_R" }, \
+     { DIKI_CAPS_LOCK, "CAPS_LOCK" }, \
+     { DIKI_NUM_LOCK, "NUM_LOCK" }, \
+     { DIKI_SCROLL_LOCK, "SCROLL_LOCK" }, \
+     { DIKI_ESCAPE, "ESCAPE" }, \
+     { DIKI_LEFT, "LEFT" }, \
+     { DIKI_RIGHT, "RIGHT" }, \
+     { DIKI_UP, "UP" }, \
+     { DIKI_DOWN, "DOWN" }, \
+     { DIKI_TAB, "TAB" }, \
+     { DIKI_ENTER, "ENTER" }, \
+     { DIKI_SPACE, "SPACE" }, \
+     { DIKI_BACKSPACE, "BACKSPACE" }, \
+     { DIKI_INSERT, "INSERT" }, \
+     { DIKI_DELETE, "DELETE" }, \
+     { DIKI_HOME, "HOME" }, \
+     { DIKI_END, "END" }, \
+     { DIKI_PAGE_UP, "PAGE_UP" }, \
+     { DIKI_PAGE_DOWN, "PAGE_DOWN" }, \
+     { DIKI_PRINT, "PRINT" }, \
+     { DIKI_PAUSE, "PAUSE" }, \
+     { DIKI_QUOTE_LEFT, "QUOTE_LEFT" }, \
+     { DIKI_MINUS_SIGN, "MINUS_SIGN" }, \
+     { DIKI_EQUALS_SIGN, "EQUALS_SIGN" }, \
+     { DIKI_BRACKET_LEFT, "BRACKET_LEFT" }, \
+     { DIKI_BRACKET_RIGHT, "BRACKET_RIGHT" }, \
+     { DIKI_BACKSLASH, "BACKSLASH" }, \
+     { DIKI_SEMICOLON, "SEMICOLON" }, \
+     { DIKI_QUOTE_RIGHT, "QUOTE_RIGHT" }, \
+     { DIKI_COMMA, "COMMA" }, \
+     { DIKI_PERIOD, "PERIOD" }, \
+     { DIKI_SLASH, "SLASH" }, \
+     { DIKI_LESS_SIGN, "LESS_SIGN" }, \
+     { DIKI_KP_DIV, "KP_DIV" }, \
+     { DIKI_KP_MULT, "KP_MULT" }, \
+     { DIKI_KP_MINUS, "KP_MINUS" }, \
+     { DIKI_KP_PLUS, "KP_PLUS" }, \
+     { DIKI_KP_ENTER, "KP_ENTER" }, \
+     { DIKI_KP_SPACE, "KP_SPACE" }, \
+     { DIKI_KP_TAB, "KP_TAB" }, \
+     { DIKI_KP_F1, "KP_F1" }, \
+     { DIKI_KP_F2, "KP_F2" }, \
+     { DIKI_KP_F3, "KP_F3" }, \
+     { DIKI_KP_F4, "KP_F4" }, \
+     { DIKI_KP_EQUAL, "KP_EQUAL" }, \
+     { DIKI_KP_SEPARATOR, "KP_SEPARATOR" }, \
+     { DIKI_KP_DECIMAL, "KP_DECIMAL" }, \
+     { DIKI_KP_0, "KP_0" }, \
+     { DIKI_KP_1, "KP_1" }, \
+     { DIKI_KP_2, "KP_2" }, \
+     { DIKI_KP_3, "KP_3" }, \
+     { DIKI_KP_4, "KP_4" }, \
+     { DIKI_KP_5, "KP_5" }, \
+     { DIKI_KP_6, "KP_6" }, \
+     { DIKI_KP_7, "KP_7" }, \
+     { DIKI_KP_8, "KP_8" }, \
+     { DIKI_KP_9, "KP_9" }, \
+     { DIKI_UNKNOWN, "UNKNOWN" } \
+};
+
+#endif
diff --git a/Source/DirectFB/include/directfb_strings.h b/Source/DirectFB/include/directfb_strings.h
new file mode 100755
index 0000000..f826817
--- /dev/null
+++ b/Source/DirectFB/include/directfb_strings.h
@@ -0,0 +1,474 @@
+#ifndef __DIRECTFB_STRINGS_H__
+#define __DIRECTFB_STRINGS_H__
+
+
+struct DFBPixelFormatName {
+     DFBSurfacePixelFormat format;
+     const char *name;
+};
+
+#define DirectFBPixelFormatNames(Identifier) struct DFBPixelFormatName Identifier[] = { \
+     { DSPF_ARGB1555, "ARGB1555" }, \
+     { DSPF_RGB16, "RGB16" }, \
+     { DSPF_RGB24, "RGB24" }, \
+     { DSPF_RGB32, "RGB32" }, \
+     { DSPF_ARGB, "ARGB" }, \
+     { DSPF_A8, "A8" }, \
+     { DSPF_YUY2, "YUY2" }, \
+     { DSPF_RGB332, "RGB332" }, \
+     { DSPF_UYVY, "UYVY" }, \
+     { DSPF_I420, "I420" }, \
+     { DSPF_YV12, "YV12" }, \
+     { DSPF_LUT8, "LUT8" }, \
+     { DSPF_ALUT44, "ALUT44" }, \
+     { DSPF_AiRGB, "AiRGB" }, \
+     { DSPF_A1, "A1" }, \
+     { DSPF_NV12, "NV12" }, \
+     { DSPF_NV16, "NV16" }, \
+     { DSPF_ARGB2554, "ARGB2554" }, \
+     { DSPF_ARGB4444, "ARGB4444" }, \
+     { DSPF_RGBA4444, "RGBA4444" }, \
+     { DSPF_NV21, "NV21" }, \
+     { DSPF_AYUV, "AYUV" }, \
+     { DSPF_A4, "A4" }, \
+     { DSPF_ARGB1666, "ARGB1666" }, \
+     { DSPF_ARGB6666, "ARGB6666" }, \
+     { DSPF_RGB18, "RGB18" }, \
+     { DSPF_LUT2, "LUT2" }, \
+     { DSPF_RGB444, "RGB444" }, \
+     { DSPF_RGB555, "RGB555" }, \
+     { DSPF_BGR555, "BGR555" }, \
+     { DSPF_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBInputDeviceTypeFlagsName {
+     DFBInputDeviceTypeFlags type;
+     const char *name;
+};
+
+#define DirectFBInputDeviceTypeFlagsNames(Identifier) struct DFBInputDeviceTypeFlagsName Identifier[] = { \
+     { DIDTF_KEYBOARD, "KEYBOARD" }, \
+     { DIDTF_MOUSE, "MOUSE" }, \
+     { DIDTF_JOYSTICK, "JOYSTICK" }, \
+     { DIDTF_REMOTE, "REMOTE" }, \
+     { DIDTF_VIRTUAL, "VIRTUAL" }, \
+     { DIDTF_NONE, "NONE" } \
+};
+
+
+struct DFBSurfaceDrawingFlagsName {
+     DFBSurfaceDrawingFlags flag;
+     const char *name;
+};
+
+#define DirectFBSurfaceDrawingFlagsNames(Identifier) struct DFBSurfaceDrawingFlagsName Identifier[] = { \
+     { DSDRAW_BLEND, "BLEND" }, \
+     { DSDRAW_DST_COLORKEY, "DST_COLORKEY" }, \
+     { DSDRAW_SRC_PREMULTIPLY, "SRC_PREMULTIPLY" }, \
+     { DSDRAW_DST_PREMULTIPLY, "DST_PREMULTIPLY" }, \
+     { DSDRAW_DEMULTIPLY, "DEMULTIPLY" }, \
+     { DSDRAW_XOR, "XOR" }, \
+     { DSDRAW_NOFX, "NOFX" } \
+};
+
+
+struct DFBSurfaceBlittingFlagsName {
+     DFBSurfaceBlittingFlags flag;
+     const char *name;
+};
+
+#define DirectFBSurfaceBlittingFlagsNames(Identifier) struct DFBSurfaceBlittingFlagsName Identifier[] = { \
+     { DSBLIT_BLEND_ALPHACHANNEL, "BLEND_ALPHACHANNEL" }, \
+     { DSBLIT_BLEND_COLORALPHA, "BLEND_COLORALPHA" }, \
+     { DSBLIT_COLORIZE, "COLORIZE" }, \
+     { DSBLIT_SRC_COLORKEY, "SRC_COLORKEY" }, \
+     { DSBLIT_DST_COLORKEY, "DST_COLORKEY" }, \
+     { DSBLIT_SRC_PREMULTIPLY, "SRC_PREMULTIPLY" }, \
+     { DSBLIT_DST_PREMULTIPLY, "DST_PREMULTIPLY" }, \
+     { DSBLIT_DEMULTIPLY, "DEMULTIPLY" }, \
+     { DSBLIT_DEINTERLACE, "DEINTERLACE" }, \
+     { DSBLIT_SRC_PREMULTCOLOR, "SRC_PREMULTCOLOR" }, \
+     { DSBLIT_XOR, "XOR" }, \
+     { DSBLIT_INDEX_TRANSLATION, "INDEX_TRANSLATION" }, \
+     { DSBLIT_ROTATE90, "ROTATE90" }, \
+     { DSBLIT_ROTATE180, "ROTATE180" }, \
+     { DSBLIT_ROTATE270, "ROTATE270" }, \
+     { DSBLIT_COLORKEY_PROTECT, "COLORKEY_PROTECT" }, \
+     { DSBLIT_SRC_MASK_ALPHA, "SRC_MASK_ALPHA" }, \
+     { DSBLIT_SRC_MASK_COLOR, "SRC_MASK_COLOR" }, \
+     { DSBLIT_NOFX, "NOFX" } \
+};
+
+
+struct DFBSurfaceBlendFunctionName {
+     DFBSurfaceBlendFunction function;
+     const char *name;
+};
+
+#define DirectFBSurfaceBlendFunctionNames(Identifier) struct DFBSurfaceBlendFunctionName Identifier[] = { \
+     { DSBF_ZERO, "ZERO" }, \
+     { DSBF_ONE, "ONE" }, \
+     { DSBF_SRCCOLOR, "SRCCOLOR" }, \
+     { DSBF_INVSRCCOLOR, "INVSRCCOLOR" }, \
+     { DSBF_SRCALPHA, "SRCALPHA" }, \
+     { DSBF_INVSRCALPHA, "INVSRCALPHA" }, \
+     { DSBF_DESTALPHA, "DESTALPHA" }, \
+     { DSBF_INVDESTALPHA, "INVDESTALPHA" }, \
+     { DSBF_DESTCOLOR, "DESTCOLOR" }, \
+     { DSBF_INVDESTCOLOR, "INVDESTCOLOR" }, \
+     { DSBF_SRCALPHASAT, "SRCALPHASAT" }, \
+     { DSBF_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBInputDeviceCapabilitiesName {
+     DFBInputDeviceCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBInputDeviceCapabilitiesNames(Identifier) struct DFBInputDeviceCapabilitiesName Identifier[] = { \
+     { DICAPS_KEYS, "KEYS" }, \
+     { DICAPS_AXES, "AXES" }, \
+     { DICAPS_BUTTONS, "BUTTONS" }, \
+     { DICAPS_NONE, "NONE" } \
+};
+
+
+struct DFBDisplayLayerTypeFlagsName {
+     DFBDisplayLayerTypeFlags type;
+     const char *name;
+};
+
+#define DirectFBDisplayLayerTypeFlagsNames(Identifier) struct DFBDisplayLayerTypeFlagsName Identifier[] = { \
+     { DLTF_GRAPHICS, "GRAPHICS" }, \
+     { DLTF_VIDEO, "VIDEO" }, \
+     { DLTF_STILL_PICTURE, "STILL_PICTURE" }, \
+     { DLTF_BACKGROUND, "BACKGROUND" }, \
+     { DLTF_NONE, "NONE" } \
+};
+
+
+struct DFBDisplayLayerCapabilitiesName {
+     DFBDisplayLayerCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBDisplayLayerCapabilitiesNames(Identifier) struct DFBDisplayLayerCapabilitiesName Identifier[] = { \
+     { DLCAPS_SURFACE, "SURFACE" }, \
+     { DLCAPS_OPACITY, "OPACITY" }, \
+     { DLCAPS_ALPHACHANNEL, "ALPHACHANNEL" }, \
+     { DLCAPS_SCREEN_LOCATION, "SCREEN_LOCATION" }, \
+     { DLCAPS_FLICKER_FILTERING, "FLICKER_FILTERING" }, \
+     { DLCAPS_DEINTERLACING, "DEINTERLACING" }, \
+     { DLCAPS_SRC_COLORKEY, "SRC_COLORKEY" }, \
+     { DLCAPS_DST_COLORKEY, "DST_COLORKEY" }, \
+     { DLCAPS_BRIGHTNESS, "BRIGHTNESS" }, \
+     { DLCAPS_CONTRAST, "CONTRAST" }, \
+     { DLCAPS_HUE, "HUE" }, \
+     { DLCAPS_SATURATION, "SATURATION" }, \
+     { DLCAPS_LEVELS, "LEVELS" }, \
+     { DLCAPS_FIELD_PARITY, "FIELD_PARITY" }, \
+     { DLCAPS_WINDOWS, "WINDOWS" }, \
+     { DLCAPS_SOURCES, "SOURCES" }, \
+     { DLCAPS_ALPHA_RAMP, "ALPHA_RAMP" }, \
+     { DLCAPS_PREMULTIPLIED, "PREMULTIPLIED" }, \
+     { DLCAPS_SCREEN_POSITION, "SCREEN_POSITION" }, \
+     { DLCAPS_SCREEN_SIZE, "SCREEN_SIZE" }, \
+     { DLCAPS_CLIP_REGIONS, "CLIP_REGIONS" }, \
+     { DLCAPS_NONE, "NONE" } \
+};
+
+
+struct DFBDisplayLayerBufferModeName {
+     DFBDisplayLayerBufferMode mode;
+     const char *name;
+};
+
+#define DirectFBDisplayLayerBufferModeNames(Identifier) struct DFBDisplayLayerBufferModeName Identifier[] = { \
+     { DLBM_FRONTONLY, "FRONTONLY" }, \
+     { DLBM_BACKVIDEO, "BACKVIDEO" }, \
+     { DLBM_BACKSYSTEM, "BACKSYSTEM" }, \
+     { DLBM_TRIPLE, "TRIPLE" }, \
+     { DLBM_WINDOWS, "WINDOWS" }, \
+     { DLBM_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBWindowCapabilitiesName {
+     DFBWindowCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBWindowCapabilitiesNames(Identifier) struct DFBWindowCapabilitiesName Identifier[] = { \
+     { DWCAPS_ALPHACHANNEL, "ALPHACHANNEL" }, \
+     { DWCAPS_DOUBLEBUFFER, "DOUBLEBUFFER" }, \
+     { DWCAPS_INPUTONLY, "INPUTONLY" }, \
+     { DWCAPS_NODECORATION, "NODECORATION" }, \
+     { DWCAPS_SUBWINDOW, "SUBWINDOW" }, \
+     { DWCAPS_NOFOCUS, "NOFOCUS" }, \
+     { DWCAPS_NONE, "NONE" } \
+};
+
+
+struct DFBWindowOptionsName {
+     DFBWindowOptions option;
+     const char *name;
+};
+
+#define DirectFBWindowOptionsNames(Identifier) struct DFBWindowOptionsName Identifier[] = { \
+     { DWOP_COLORKEYING, "COLORKEYING" }, \
+     { DWOP_ALPHACHANNEL, "ALPHACHANNEL" }, \
+     { DWOP_OPAQUE_REGION, "OPAQUE_REGION" }, \
+     { DWOP_SHAPED, "SHAPED" }, \
+     { DWOP_ALPHACHANNEL, "ALPHACHANNEL" }, \
+     { DWOP_KEEP_POSITION, "KEEP_POSITION" }, \
+     { DWOP_KEEP_SIZE, "KEEP_SIZE" }, \
+     { DWOP_KEEP_STACKING, "KEEP_STACKING" }, \
+     { DWOP_GHOST, "GHOST" }, \
+     { DWOP_INDESTRUCTIBLE, "INDESTRUCTIBLE" }, \
+     { DWOP_SCALE, "SCALE" }, \
+     { DWOP_KEEP_ABOVE, "KEEP_ABOVE" }, \
+     { DWOP_KEEP_UNDER, "KEEP_UNDER" }, \
+     { DWOP_FOLLOW_BOUNDS, "FOLLOW_BOUNDS" }, \
+     { DWOP_NONE, "NONE" } \
+};
+
+
+struct DFBScreenCapabilitiesName {
+     DFBScreenCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBScreenCapabilitiesNames(Identifier) struct DFBScreenCapabilitiesName Identifier[] = { \
+     { DSCCAPS_VSYNC, "VSYNC" }, \
+     { DSCCAPS_POWER_MANAGEMENT, "POWER_MANAGEMENT" }, \
+     { DSCCAPS_MIXERS, "MIXERS" }, \
+     { DSCCAPS_ENCODERS, "ENCODERS" }, \
+     { DSCCAPS_OUTPUTS, "OUTPUTS" }, \
+     { DSCCAPS_NONE, "NONE" } \
+};
+
+
+struct DFBScreenEncoderCapabilitiesName {
+     DFBScreenEncoderCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBScreenEncoderCapabilitiesNames(Identifier) struct DFBScreenEncoderCapabilitiesName Identifier[] = { \
+     { DSECAPS_TV_STANDARDS, "TV_STANDARDS" }, \
+     { DSECAPS_TEST_PICTURE, "TEST_PICTURE" }, \
+     { DSECAPS_MIXER_SEL, "MIXER_SEL" }, \
+     { DSECAPS_OUT_SIGNALS, "OUT_SIGNALS" }, \
+     { DSECAPS_SCANMODE, "SCANMODE" }, \
+     { DSECAPS_FREQUENCY, "FREQUENCY" }, \
+     { DSECAPS_BRIGHTNESS, "BRIGHTNESS" }, \
+     { DSECAPS_CONTRAST, "CONTRAST" }, \
+     { DSECAPS_HUE, "HUE" }, \
+     { DSECAPS_SATURATION, "SATURATION" }, \
+     { DSECAPS_CONNECTORS, "CONNECTORS" }, \
+     { DSECAPS_SLOW_BLANKING, "SLOW_BLANKING" }, \
+     { DSECAPS_RESOLUTION, "RESOLUTION" }, \
+     { DSECAPS_NONE, "NONE" } \
+};
+
+
+struct DFBScreenEncoderTypeName {
+     DFBScreenEncoderType type;
+     const char *name;
+};
+
+#define DirectFBScreenEncoderTypeNames(Identifier) struct DFBScreenEncoderTypeName Identifier[] = { \
+     { DSET_CRTC, "CRTC" }, \
+     { DSET_TV, "TV" }, \
+     { DSET_DIGITAL, "DIGITAL" }, \
+     { DSET_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBScreenEncoderTVStandardsName {
+     DFBScreenEncoderTVStandards standard;
+     const char *name;
+};
+
+#define DirectFBScreenEncoderTVStandardsNames(Identifier) struct DFBScreenEncoderTVStandardsName Identifier[] = { \
+     { DSETV_PAL, "PAL" }, \
+     { DSETV_NTSC, "NTSC" }, \
+     { DSETV_SECAM, "SECAM" }, \
+     { DSETV_PAL_60, "PAL_60" }, \
+     { DSETV_PAL_BG, "PAL_BG" }, \
+     { DSETV_PAL_I, "PAL_I" }, \
+     { DSETV_PAL_M, "PAL_M" }, \
+     { DSETV_PAL_N, "PAL_N" }, \
+     { DSETV_PAL_NC, "PAL_NC" }, \
+     { DSETV_NTSC_M_JPN, "NTSC_M_JPN" }, \
+     { DSETV_NTSC_443, "NTSC_443" }, \
+     { DSETV_DIGITAL, "DIGITAL" }, \
+     { DSETV_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBScreenOutputCapabilitiesName {
+     DFBScreenOutputCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBScreenOutputCapabilitiesNames(Identifier) struct DFBScreenOutputCapabilitiesName Identifier[] = { \
+     { DSOCAPS_CONNECTORS, "CONNECTORS" }, \
+     { DSOCAPS_ENCODER_SEL, "ENCODER_SEL" }, \
+     { DSOCAPS_SIGNAL_SEL, "SIGNAL_SEL" }, \
+     { DSOCAPS_CONNECTOR_SEL, "CONNECTOR_SEL" }, \
+     { DSOCAPS_SLOW_BLANKING, "SLOW_BLANKING" }, \
+     { DSOCAPS_RESOLUTION, "RESOLUTION" }, \
+     { DSOCAPS_NONE, "NONE" } \
+};
+
+
+struct DFBScreenOutputConnectorsName {
+     DFBScreenOutputConnectors connector;
+     const char *name;
+};
+
+#define DirectFBScreenOutputConnectorsNames(Identifier) struct DFBScreenOutputConnectorsName Identifier[] = { \
+     { DSOC_VGA, "VGA" }, \
+     { DSOC_SCART, "SCART" }, \
+     { DSOC_YC, "YC" }, \
+     { DSOC_CVBS, "CVBS" }, \
+     { DSOC_SCART2, "SCART2" }, \
+     { DSOC_COMPONENT, "COMPONENT" }, \
+     { DSOC_HDMI, "HDMI" }, \
+     { DSOC_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBScreenOutputSignalsName {
+     DFBScreenOutputSignals signal;
+     const char *name;
+};
+
+#define DirectFBScreenOutputSignalsNames(Identifier) struct DFBScreenOutputSignalsName Identifier[] = { \
+     { DSOS_VGA, "VGA" }, \
+     { DSOS_YC, "YC" }, \
+     { DSOS_CVBS, "CVBS" }, \
+     { DSOS_RGB, "RGB" }, \
+     { DSOS_YCBCR, "YCBCR" }, \
+     { DSOS_HDMI, "HDMI" }, \
+     { DSOS_656, "656" }, \
+     { DSOS_NONE, "NONE" } \
+};
+
+
+struct DFBScreenOutputSlowBlankingSignalsName {
+     DFBScreenOutputSlowBlankingSignals slow_signal;
+     const char *name;
+};
+
+#define DirectFBScreenOutputSlowBlankingSignalsNames(Identifier) struct DFBScreenOutputSlowBlankingSignalsName Identifier[] = { \
+     { DSOSB_16x9, "16x9" }, \
+     { DSOSB_4x3, "4x3" }, \
+     { DSOSB_FOLLOW, "FOLLOW" }, \
+     { DSOSB_MONITOR, "MONITOR" }, \
+     { DSOSB_OFF, "OFF" } \
+};
+
+
+struct DFBScreenOutputResolutionName {
+     DFBScreenOutputResolution resolution;
+     const char *name;
+};
+
+#define DirectFBScreenOutputResolutionNames(Identifier) struct DFBScreenOutputResolutionName Identifier[] = { \
+     { DSOR_640_480, "640_480" }, \
+     { DSOR_720_480, "720_480" }, \
+     { DSOR_720_576, "720_576" }, \
+     { DSOR_800_600, "800_600" }, \
+     { DSOR_1024_768, "1024_768" }, \
+     { DSOR_1152_864, "1152_864" }, \
+     { DSOR_1280_720, "1280_720" }, \
+     { DSOR_1280_768, "1280_768" }, \
+     { DSOR_1280_960, "1280_960" }, \
+     { DSOR_1280_1024, "1280_1024" }, \
+     { DSOR_1400_1050, "1400_1050" }, \
+     { DSOR_1600_1200, "1600_1200" }, \
+     { DSOR_1920_1080, "1920_1080" }, \
+     { DSOR_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBScreenMixerCapabilitiesName {
+     DFBScreenMixerCapabilities capability;
+     const char *name;
+};
+
+#define DirectFBScreenMixerCapabilitiesNames(Identifier) struct DFBScreenMixerCapabilitiesName Identifier[] = { \
+     { DSMCAPS_FULL, "FULL" }, \
+     { DSMCAPS_SUB_LEVEL, "SUB_LEVEL" }, \
+     { DSMCAPS_SUB_LAYERS, "SUB_LAYERS" }, \
+     { DSMCAPS_BACKGROUND, "BACKGROUND" }, \
+     { DSMCAPS_NONE, "NONE" } \
+};
+
+
+struct DFBScreenMixerTreeName {
+     DFBScreenMixerTree tree;
+     const char *name;
+};
+
+#define DirectFBScreenMixerTreeNames(Identifier) struct DFBScreenMixerTreeName Identifier[] = { \
+     { DSMT_FULL, "FULL" }, \
+     { DSMT_SUB_LEVEL, "SUB_LEVEL" }, \
+     { DSMT_SUB_LAYERS, "SUB_LAYERS" }, \
+     { DSMT_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBScreenEncoderTestPictureName {
+     DFBScreenEncoderTestPicture test_picture;
+     const char *name;
+};
+
+#define DirectFBScreenEncoderTestPictureNames(Identifier) struct DFBScreenEncoderTestPictureName Identifier[] = { \
+     { DSETP_MULTI, "MULTI" }, \
+     { DSETP_SINGLE, "SINGLE" }, \
+     { DSETP_WHITE, "WHITE" }, \
+     { DSETP_YELLOW, "YELLOW" }, \
+     { DSETP_CYAN, "CYAN" }, \
+     { DSETP_GREEN, "GREEN" }, \
+     { DSETP_MAGENTA, "MAGENTA" }, \
+     { DSETP_RED, "RED" }, \
+     { DSETP_BLUE, "BLUE" }, \
+     { DSETP_BLACK, "BLACK" }, \
+     { DSETP_OFF, "OFF" } \
+};
+
+
+struct DFBScreenEncoderScanModeName {
+     DFBScreenEncoderScanMode scan_mode;
+     const char *name;
+};
+
+#define DirectFBScreenEncoderScanModeNames(Identifier) struct DFBScreenEncoderScanModeName Identifier[] = { \
+     { DSESM_INTERLACED, "INTERLACED" }, \
+     { DSESM_PROGRESSIVE, "PROGRESSIVE" }, \
+     { DSESM_UNKNOWN, "UNKNOWN" } \
+};
+
+
+struct DFBAccelerationMaskName {
+     DFBAccelerationMask mask;
+     const char *name;
+};
+
+#define DirectFBAccelerationMaskNames(Identifier) struct DFBAccelerationMaskName Identifier[] = { \
+     { DFXL_FILLRECTANGLE, "FILLRECTANGLE" }, \
+     { DFXL_DRAWRECTANGLE, "DRAWRECTANGLE" }, \
+     { DFXL_DRAWLINE, "DRAWLINE" }, \
+     { DFXL_FILLTRIANGLE, "FILLTRIANGLE" }, \
+     { DFXL_BLIT, "BLIT" }, \
+     { DFXL_STRETCHBLIT, "STRETCHBLIT" }, \
+     { DFXL_TEXTRIANGLES, "TEXTRIANGLES" }, \
+     { DFXL_DRAWSTRING, "DRAWSTRING" }, \
+     { DFXL_NONE, "NONE" } \
+};
+
+#endif
diff --git a/Source/DirectFB/include/directfb_util.h b/Source/DirectFB/include/directfb_util.h
new file mode 100755
index 0000000..1d3caae
--- /dev/null
+++ b/Source/DirectFB/include/directfb_util.h
@@ -0,0 +1,612 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_UTIL_H__
+#define __DIRECTFB_UTIL_H__
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <directfb_strings.h>
+
+#include <direct/types.h>
+#include <direct/debug.h>
+
+bool dfb_region_intersect( DFBRegion *region,
+                           int x1, int y1, int x2, int y2 );
+
+bool dfb_region_region_intersect( DFBRegion       *region,
+                                  const DFBRegion *clip );
+
+bool dfb_region_rectangle_intersect( DFBRegion          *region,
+                                     const DFBRectangle *rect );
+
+bool dfb_unsafe_region_intersect( DFBRegion *region,
+                                  int x1, int y1, int x2, int y2 );
+
+bool dfb_unsafe_region_rectangle_intersect( DFBRegion          *region,
+                                            const DFBRectangle *rect );
+
+bool dfb_rectangle_intersect_by_unsafe_region( DFBRectangle *rectangle,
+                                               DFBRegion    *region );
+
+bool dfb_rectangle_intersect_by_region( DFBRectangle    *rectangle,
+                                        const DFBRegion *region );
+
+bool dfb_rectangle_intersect( DFBRectangle       *rectangle,
+                              const DFBRectangle *clip );
+
+/* returns the result in the first rectangle */
+void dfb_rectangle_union ( DFBRectangle       *rect1,
+                           const DFBRectangle *rect2 );
+
+
+#define DFB_RECTANGLE_ASSERT(r)              \
+     do {                                    \
+          D_ASSERT( (r) != NULL );           \
+          D_ASSERT( (r)->w >= 0 );           \
+          D_ASSERT( (r)->h >= 0 );           \
+     } while (0)
+
+#define DFB_RECTANGLE_ASSERT_IF(r)           \
+     do {                                    \
+          if ((r) != NULL) {                 \
+               D_ASSERT( (r)->w >= 0 );      \
+               D_ASSERT( (r)->h >= 0 );      \
+          }                                  \
+     } while (0)
+
+#define DFB_RECTANGLE_VALS(r)                (r)->x, (r)->y, (r)->w, (r)->h
+#define DFB_RECTANGLE_VALS_FROM_REGION(r)    (r)->x1, (r)->y1, (r)->x2-(r)->x1+1, (r)->y2-(r)->y1+1
+#define DFB_RECTANGLE_INIT_FROM_REGION(r)    (DFBRectangle){ DFB_RECTANGLE_VALS_FROM_REGION(r) }
+#define DFB_RECTANGLE_CONTAINS_POINT(r,X,Y)  (((X) >= (r)->x) && ((X) < (r)->x + (r)->w) && \
+                                              ((Y) >= (r)->y) && ((Y) < (r)->y + (r)->h))
+
+#define DFB_RECTANGLES_DEBUG_AT( Domain, rects, num )                                                         \
+     do {                                                                                                     \
+          unsigned int i;                                                                                     \
+                                                                                                              \
+          for (i=0; i<(num); i++)                                                                             \
+               D_DEBUG_AT( Domain, "  -> [%2d] %4d,%4d-%4dx%4d\n", i, DFB_RECTANGLE_VALS(&(rects)[i]) );      \
+     } while (0)
+
+
+#define DFB_TRIANGLE_VALS(t)                 (t)->x1, (t)->y1, (t)->x2, (t)->y2, (t)->x3, (t)->y3
+
+#define DFB_COLORKEY_VALS(c)                 (c)->r, (c)->g, (c)->b, (c)->index
+
+#define DFB_REGION_CHECK(r)     \
+      ((r) != NULL &&           \
+       (r)->x1 <= (r)->x2 &&    \
+       (r)->y1 <= (r)->y2)
+
+#define DFB_REGION_CHECK_IF(r)  \
+      ((r) == NULL ||           \
+       ((r)->x1 <= (r)->x2 &&   \
+        (r)->y1 <= (r)->y2))
+
+#define DFB_REGION_ASSERT(r)                 \
+     do {                                    \
+          D_ASSERT( (r) != NULL );           \
+          D_ASSERT( (r)->x1 <= (r)->x2 );    \
+          D_ASSERT( (r)->y1 <= (r)->y2 );    \
+     } while (0)
+
+#define DFB_REGION_ASSERT_IF(r)                   \
+     do {                                         \
+          if ((r) != NULL) {                      \
+               D_ASSERT( (r)->x1 <= (r)->x2 );    \
+               D_ASSERT( (r)->y1 <= (r)->y2 );    \
+          }                                       \
+     } while (0)
+
+
+#define DFB_REGION_VALS(r)                   (r)->x1, (r)->y1, (r)->x2, (r)->y2
+
+#define DFB_REGION_VALS_FROM_DIMENSION(d)    0, 0, (d)->w-1, (d)->h-1
+#define DFB_REGION_INIT_FROM_DIMENSION(d)    (DFBRegion){ DFB_REGION_VALS_FROM_DIMENSION(d) }
+
+#define DFB_REGION_VALS_FROM_RECTANGLE(r)    (r)->x, (r)->y, (r)->x+(r)->w-1, (r)->y+(r)->h-1
+#define DFB_REGION_INIT_FROM_RECTANGLE(r)    (DFBRegion){ DFB_REGION_VALS_FROM_RECTANGLE(r) }
+
+#define DFB_REGION_VALS_FROM_RECTANGLE_VALS(x,y,w,h)   (x), (y), (x)+(w)-1, (y)+(h)-1
+#define DFB_REGION_INIT_FROM_RECTANGLE_VALS(x,y,w,h)   (DFBRegion){ DFB_REGION_VALS_FROM_RECTANGLE_VALS(x,y,w,h) }
+
+#define DFB_REGION_VALS_TRANSLATED(r,x,y)    (r)->x1 + x, (r)->y1 + y, (r)->x2 + x, (r)->y2 + y
+#define DFB_REGION_INIT_TRANSLATED(r,x,y)    (DFBRegion){ DFB_REGION_VALS_TRANSLATED(r,x,y) }
+
+#define DFB_REGION_VALS_INTERSECTED(r,X1,Y1,X2,Y2)   (r)->x1 > (X1) ? (r)->x1 : (X1),      \
+                                                     (r)->y1 > (Y1) ? (r)->y1 : (Y1),      \
+                                                     (r)->x2 < (X2) ? (r)->x2 : (X2),      \
+                                                     (r)->y2 < (Y2) ? (r)->y2 : (Y2)
+#define DFB_REGION_INIT_INTERSECTED(r,X1,Y1,X2,Y2)   (DFBRegion){ DFB_REGION_VALS_INTERSECTED(r,X1,Y1,X2,Y2) }
+
+
+#define DFB_REGION_CONTAINS_POINT(r,X,Y)     (((X) >= (r)->x1) && ((X) <= (r)->x2) && \
+                                              ((Y) >= (r)->y1) && ((Y) <= (r)->y2))
+
+static inline void dfb_rectangle_from_region( DFBRectangle    *rect,
+                                              const DFBRegion *region )
+{
+     D_ASSERT( rect != NULL );
+
+     DFB_REGION_ASSERT( region );
+
+     rect->x = region->x1;
+     rect->y = region->y1;
+     rect->w = region->x2 - region->x1 + 1;
+     rect->h = region->y2 - region->y1 + 1;
+}
+
+static inline void dfb_rectangle_from_rectangle_plus_insets( DFBRectangle       *rect,
+                                                             const DFBRectangle *inner,
+                                                             const DFBInsets    *insets )
+{
+     D_ASSERT( rect != NULL );
+     D_ASSERT( insets != NULL );
+
+     DFB_RECTANGLE_ASSERT( inner );
+
+     rect->x = inner->x - insets->l;
+     rect->y = inner->y - insets->t;
+     rect->w = inner->w + insets->l + insets->r;
+     rect->h = inner->h + insets->t + insets->b;
+}
+
+static inline void dfb_region_from_rectangle( DFBRegion          *region,
+                                              const DFBRectangle *rect )
+{
+     D_ASSERT( region != NULL );
+
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_ASSERT( rect->w > 0 );
+     D_ASSERT( rect->h > 0 );
+
+     region->x1 = rect->x;
+     region->y1 = rect->y;
+     region->x2 = rect->x + rect->w - 1;
+     region->y2 = rect->y + rect->h - 1;
+}
+
+static inline void dfb_region_from_rotated( DFBRegion          *region,
+                                            const DFBRegion    *from,
+                                            const DFBDimension *size,
+                                            int                 rotation )
+{
+     D_ASSERT( region != NULL );
+
+     DFB_REGION_ASSERT( from );
+     D_ASSERT( size != NULL );
+     D_ASSERT( size->w > 0 );
+     D_ASSERT( size->h > 0 );
+     D_ASSUME( rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270 );
+
+     switch (rotation) {
+          default:
+               D_BUG( "invalid rotation %d", rotation );
+          case 0:
+               *region = *from;
+               break;
+
+          case 90:
+               region->x1 = from->y1;
+               region->y1 = size->w - from->x2 - 1;
+               region->x2 = from->y2;
+               region->y2 = size->w - from->x1 - 1;
+               break;
+
+          case 180:
+               region->x1 = size->w - from->x2 - 1;
+               region->y1 = size->h - from->y2 - 1;
+               region->x2 = size->w - from->x1 - 1;
+               region->y2 = size->h - from->y1 - 1;
+               break;
+
+          case 270:
+               region->x1 = size->h - from->y2 - 1;
+               region->y1 = from->x1;
+               region->x2 = size->h - from->y1 - 1;
+               region->y2 = from->x2;
+               break;
+     }
+
+     DFB_REGION_ASSERT( region );
+}
+
+static inline void dfb_rectangle_from_rotated( DFBRectangle       *rectangle,
+                                               const DFBRectangle *from,
+                                               const DFBDimension *size,
+                                               int                 rotation )
+{
+     D_ASSERT( rectangle != NULL );
+
+     DFB_RECTANGLE_ASSERT( from );
+     D_ASSERT( size != NULL );
+     D_ASSERT( size->w > 0 );
+     D_ASSERT( size->h > 0 );
+     D_ASSUME( rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270 );
+
+     switch (rotation) {
+          default:
+               D_BUG( "invalid rotation %d", rotation );
+          case 0:
+               *rectangle = *from;
+               break;
+
+          case 90:
+               rectangle->x = from->y;
+               rectangle->y = size->w - from->x - from->w;
+               rectangle->w = from->h;
+               rectangle->h = from->w;
+               break;
+
+          case 180:
+               rectangle->x = size->w - from->x - from->w;
+               rectangle->y = size->h - from->y - from->h;
+               rectangle->w = from->w;
+               rectangle->h = from->h;
+               break;
+
+          case 270:
+               rectangle->x = size->h - from->y - from->h;
+               rectangle->y = from->x;
+               rectangle->w = from->h;
+               rectangle->h = from->w;
+               break;
+     }
+
+     DFB_RECTANGLE_ASSERT( rectangle );
+}
+
+static inline void dfb_point_from_rotated_region( DFBPoint           *point,
+                                                  const DFBRegion    *from,
+                                                  const DFBDimension *size,
+                                                  int                 rotation )
+{
+     D_ASSERT( point != NULL );
+
+     DFB_REGION_ASSERT( from );
+     D_ASSERT( size != NULL );
+     D_ASSERT( size->w > 0 );
+     D_ASSERT( size->h > 0 );
+     D_ASSUME( rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270 );
+
+     switch (rotation) {
+          default:
+               D_BUG( "invalid rotation %d", rotation );
+          case 0:
+               point->x = from->x1;
+               point->y = from->y1;
+               break;
+
+          case 90:
+               point->x = from->y1;
+               point->y = size->w - from->x2 - 1;
+               break;
+
+          case 180:
+               point->x = size->w - from->x2 - 1;
+               point->y = size->h - from->y2 - 1;
+               break;
+
+          case 270:
+               point->x = size->h - from->y2 - 1;
+               point->y = from->x1;
+               break;
+     }
+
+     D_ASSERT( point->x >= 0 );
+     D_ASSERT( point->y >= 0 );
+     D_ASSERT( point->x < size->w );
+     D_ASSERT( point->y < size->h );
+}
+
+
+static inline void dfb_rectangle_translate( DFBRectangle *rect,
+                                            int           dx,
+                                            int           dy )
+{
+     DFB_RECTANGLE_ASSERT( rect );
+
+     rect->x += dx;
+     rect->y += dy;
+}
+
+static inline void dfb_region_translate( DFBRegion *region,
+                                         int        dx,
+                                         int        dy )
+{
+     DFB_REGION_ASSERT( region );
+
+     region->x1 += dx;
+     region->y1 += dy;
+     region->x2 += dx;
+     region->y2 += dy;
+}
+
+static inline void dfb_rectangle_resize( DFBRectangle *rect,
+                                         int           width,
+                                         int           height )
+{
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_ASSERT( width >= 0 );
+     D_ASSERT( height >= 0 );
+
+     rect->w = width;
+     rect->h = height;
+}
+
+static inline void dfb_region_resize( DFBRegion *region,
+                                      int        width,
+                                      int        height )
+{
+     DFB_REGION_ASSERT( region );
+
+     D_ASSERT( width >= 0 );
+     D_ASSERT( height >= 0 );
+
+     region->x2 = region->x1 + width - 1;
+     region->y2 = region->y1 + height - 1;
+}
+
+static inline bool dfb_region_intersects( const DFBRegion *region,
+                                          int              x1,
+                                          int              y1,
+                                          int              x2,
+                                          int              y2 )
+{
+     DFB_REGION_ASSERT( region );
+
+     D_ASSERT( x1 <= x2 );
+     D_ASSERT( y1 <= y2 );
+
+     return (region->x1 <= x2 &&
+             region->y1 <= y2 &&
+             region->x2 >= x1 &&
+             region->y2 >= y1);
+}
+
+static inline bool dfb_region_region_intersects( const DFBRegion *region,
+                                                 const DFBRegion *other )
+{
+     DFB_REGION_ASSERT( region );
+     DFB_REGION_ASSERT( other );
+
+     return (region->x1 <= other->x2 &&
+             region->y1 <= other->y2 &&
+             region->x2 >= other->x1 &&
+             region->y2 >= other->y1);
+}
+
+static inline bool dfb_region_region_extends( const DFBRegion *a,
+                                              const DFBRegion *b )
+{
+     if (a->x1 == b->x1 && a->x2 == b->x2)
+          return (a->y1 == b->y2 - 1) || (a->y2 == b->y1 - 1);
+
+     if (a->y1 == b->y1 && a->y2 == b->y2)
+          return (a->x1 == b->x2 - 1) || (a->x2 == b->x1 - 1);
+
+     return false;
+}
+
+static inline void dfb_region_region_union( DFBRegion       *region,
+                                            const DFBRegion *other )
+{
+     DFB_REGION_ASSERT( region );
+     DFB_REGION_ASSERT( other );
+
+     if (region->x1 > other->x1)
+          region->x1 = other->x1;
+
+     if (region->y1 > other->y1)
+          region->y1 = other->y1;
+
+     if (region->x2 < other->x2)
+          region->x2 = other->x2;
+
+     if (region->y2 < other->y2)
+          region->y2 = other->y2;
+}
+
+static inline bool dfb_rectangle_region_intersects( const DFBRectangle *rect,
+                                                    const DFBRegion    *region )
+{
+     DFB_RECTANGLE_ASSERT( rect );
+
+     DFB_REGION_ASSERT( region );
+
+     return (rect->x <= region->x2 &&
+             rect->y <= region->y2 &&
+             rect->x + rect->w > region->x1 &&
+             rect->y + rect->h > region->y1);
+}
+
+static inline void dfb_region_clip( DFBRegion *region,
+                                    int        x1,
+                                    int        y1,
+                                    int        x2,
+                                    int        y2 )
+{
+     DFB_REGION_ASSERT( region );
+
+     D_ASSERT( dfb_region_intersects( region, x1, y1, x2, y2 ) );
+
+     if (region->x1 < x1)
+          region->x1 = x1;
+
+     if (region->y1 < y1)
+          region->y1 = y1;
+
+     if (region->x2 > x2)
+          region->x2 = x2;
+
+     if (region->y2 > y2)
+          region->y2 = y2;
+}
+
+static inline void dfb_rectangle_subtract( DFBRectangle    *rect, 
+                                           const DFBInsets *insets )
+{
+     D_ASSERT( rect != NULL );
+     D_ASSERT( insets != NULL );
+     
+     rect->x += insets->l;
+     rect->y += insets->t;
+     rect->w -= insets->l + insets->r;
+     rect->h -= insets->t + insets->b;
+     
+     if (rect->w <= 0 || rect->h <= 0)
+          rect->w = rect->h = 0;
+}
+
+/*
+ * Compute line segment intersection. 
+ * Return true if intersection point exists within the given segment.
+ */
+static inline bool dfb_line_segment_intersect( const DFBRegion *line, 
+                                               const DFBRegion *seg, 
+                                               int             *x, 
+                                               int             *y )
+{
+     int x1, x2, x3, x4;
+     int y1, y2, y3, y4;
+     int num, den;
+     
+     D_ASSERT( line != NULL );
+     D_ASSERT( seg != NULL );
+     
+     x1 = seg->x1;  y1 = seg->y1;  x2 = seg->y2;  y2 = seg->y2;
+     x3 = line->x1; y3 = line->y1; x4 = line->x2; y4 = line->y2;
+     
+     num = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
+     den = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
+
+     if (!den) /* parallel */
+          return false;
+          
+     if (num && ((num < 0) != (den < 0) || abs(num) > abs(den))) /* not within segment */
+          return false;
+     
+     if (x)
+          *x = (s64)(x2 - x1) * num / den + x1;
+     if (y)
+          *y = (s64)(y2 - y1) * num / den + y1;
+     
+     return true;
+}
+
+
+/*
+ * Copied declaration of DFBPixelFormatName from directfb_strings.h
+ */
+extern const struct DFBPixelFormatName dfb_pixelformat_names[];
+
+
+const char *dfb_input_event_type_name ( DFBInputEventType     type );
+const char *dfb_pixelformat_name      ( DFBSurfacePixelFormat format );
+const char *dfb_window_event_type_name( DFBWindowEventType    type );
+
+
+
+typedef struct {
+     int        magic;
+
+     DFBRegion *regions;
+     int        max_regions;
+     int        num_regions;
+
+     DFBRegion  bounding;
+} DFBUpdates;
+
+#define DFB_UPDATES_ASSERT(updates)                                        \
+     do {                                                                  \
+          D_MAGIC_ASSERT( updates, DFBUpdates );                           \
+          D_ASSERT( (updates)->regions != NULL );                          \
+          D_ASSERT( (updates)->max_regions > 0 );                          \
+          D_ASSERT( (updates)->num_regions <= (updates)->max_regions );    \
+     } while (0)
+
+
+void dfb_updates_init( DFBUpdates      *updates,
+                       DFBRegion       *regions,
+                       int              max_regions );
+
+void dfb_updates_add ( DFBUpdates      *updates,
+                       const DFBRegion *region );
+
+void dfb_updates_stat( DFBUpdates      *updates,
+                       int             *ret_total,
+                       int             *ret_bounding );
+
+void dfb_updates_get_rectangles( DFBUpdates   *updates,
+                                 DFBRectangle *ret_rects,
+                                 int          *ret_num );
+
+static inline void
+dfb_updates_add_rect( DFBUpdates      *updates,
+                      int              x,
+                      int              y,
+                      int              w,
+                      int              h )
+{
+     DFBRegion region = DFB_REGION_INIT_FROM_RECTANGLE_VALS( x, y, w, h );
+
+     dfb_updates_add( updates, ®ion );
+}
+
+static inline void
+dfb_updates_reset( DFBUpdates *updates )
+{
+     D_MAGIC_ASSERT( updates, DFBUpdates );
+
+     updates->num_regions = 0;
+}
+
+static inline void
+dfb_updates_deinit( DFBUpdates *updates )
+{
+     D_MAGIC_ASSERT( updates, DFBUpdates );
+
+     D_MAGIC_CLEAR( updates );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Source/DirectFB/include/directfb_version.h b/Source/DirectFB/include/directfb_version.h
new file mode 100755
index 0000000..e66ed2e
--- /dev/null
+++ b/Source/DirectFB/include/directfb_version.h
@@ -0,0 +1,38 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_VERSION_H__
+#define __DIRECTFB_VERSION_H__
+
+#define DIRECTFB_MAJOR_VERSION  (1)
+#define DIRECTFB_MINOR_VERSION  (4)
+#define DIRECTFB_MICRO_VERSION  (0)
+#define DIRECTFB_BINARY_AGE     (0)
+#define DIRECTFB_INTERFACE_AGE  (0)
+
+#endif /* __DIRECTFB_VERSION_H__ */
diff --git a/Source/DirectFB/include/directfb_version.h.in b/Source/DirectFB/include/directfb_version.h.in
new file mode 100755
index 0000000..3c92323
--- /dev/null
+++ b/Source/DirectFB/include/directfb_version.h.in
@@ -0,0 +1,38 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_VERSION_H__
+#define __DIRECTFB_VERSION_H__
+
+#define DIRECTFB_MAJOR_VERSION  (@DIRECTFB_MAJOR_VERSION@)
+#define DIRECTFB_MINOR_VERSION  (@DIRECTFB_MINOR_VERSION@)
+#define DIRECTFB_MICRO_VERSION  (@DIRECTFB_MICRO_VERSION@)
+#define DIRECTFB_BINARY_AGE     (@DIRECTFB_BINARY_AGE@)
+#define DIRECTFB_INTERFACE_AGE  (@DIRECTFB_INTERFACE_AGE@)
+
+#endif /* __DIRECTFB_VERSION_H__ */
diff --git a/Source/DirectFB/include/directfb_windows.h b/Source/DirectFB/include/directfb_windows.h
new file mode 100755
index 0000000..b0135e0
--- /dev/null
+++ b/Source/DirectFB/include/directfb_windows.h
@@ -0,0 +1,240 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFB_WINDOWS_H__
+#define __DIRECTFB_WINDOWS_H__
+
+#include <directfb.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*
+ * The DirectFB Windows interface version.
+ */
+#define DIRECTFB_WINDOWS_INTERFACE_VERSION  1
+
+
+/*
+ * Window stack extension.
+ */
+DECLARE_INTERFACE( IDirectFBWindows )
+
+
+typedef enum {
+     DWCONF_NONE                   = 0x00000000,
+
+     DWCONF_POSITION               = 0x00000001,
+     DWCONF_SIZE                   = 0x00000002,
+     DWCONF_OPACITY                = 0x00000004,
+     DWCONF_STACKING               = 0x00000008,
+
+     DWCONF_OPTIONS                = 0x00000010,
+     DWCONF_EVENTS                 = 0x00000020,
+     DWCONF_ASSOCIATION            = 0x00000040,
+
+     DWCONF_COLOR_KEY              = 0x00000100,
+     DWCONF_OPAQUE                 = 0x00000200,
+     DWCONF_COLOR                  = 0x00000400,
+
+     DWCONF_KEY_SELECTION          = 0x00001000,
+     DWCONF_CURSOR_FLAGS           = 0x00002000,
+     DWCONF_CURSOR_RESOLUTION      = 0x00004000,
+
+     DWCONF_SRC_GEOMETRY           = 0x00010000,
+     DWCONF_DST_GEOMETRY           = 0x00020000,
+
+     DWCONF_ROTATION               = 0x00040000,
+
+     DWCONF_ALL                    = 0x0007777F
+} DFBWindowConfigFlags;
+
+typedef struct {
+     DFBRectangle                  bounds;                  /* position and size */
+     int                           opacity;                 /* global alpha factor */
+     DFBWindowStackingClass        stacking;                /* level boundaries */
+
+     DFBWindowOptions              options;                 /* flags for appearance/behaviour */
+     DFBWindowEventType            events;                  /* mask of enabled events */
+     DFBWindowID                   association;             /* ID of window which this is associated to */
+
+     u32                           color_key;               /* transparent pixel */
+     DFBRegion                     opaque;                  /* region of the window forced to be opaque */
+     DFBColor                      color;                   /* constant color (no surface needed) */
+
+//     DFBWindowKeySelection         key_selection;           /* how to filter keys in focus */
+//     DFBInputDeviceKeySymbol      *keys;                    /* list of keys for DWKS_LIST */
+//     unsigned int                  num_keys;                /* number of entries in key array */
+
+     DFBWindowCursorFlags          cursor_flags;
+     DFBDimension                  cursor_resolution;
+
+     DFBWindowGeometry             src_geometry;            /* advanced source geometry */
+     DFBWindowGeometry             dst_geometry;            /* advanced destination geometry */
+
+     int                           rotation;
+} DFBWindowConfig;
+
+
+typedef enum {
+     DWSTATE_NONE                  = 0x00000000,
+
+     DWSTATE_INSERTED              = 0x00000001,
+
+     DWSTATE_FOCUSED               = 0x00000002,            /* only used for GetWindowInfo */
+     DWSTATE_ENTERED               = 0x00000004,            /* only used for GetWindowInfo */
+
+     DWSTATE_UPDATING              = 0x00000010,
+
+     DWSTATE_ALL                   = 0x00000017
+} DFBWindowStateFlags;
+
+typedef struct {
+     DFBWindowStateFlags           flags;
+} DFBWindowState;
+
+
+typedef struct {
+     DFBWindowID                   window_id;
+     DFBWindowCapabilities         caps;
+
+     u64                           resource_id;
+
+
+     DFBWindowConfig               config;
+
+     DFBWindowState                state;
+} DFBWindowInfo;
+
+
+typedef enum {
+     DWREL_TOP,
+     DWREL_BOTTOM
+} DFBWindowRelation;
+
+
+/*
+ * Windows watcher interface
+ */
+typedef struct {
+     /*
+      * Add window,
+      *
+      * called for each window existing at watcher registration and each added afterwards.
+      */
+     void (*WindowAdd)     ( void                   *context,
+                             const DFBWindowInfo    *info );
+
+     /*
+      * Remove window,
+      *
+      * called for each window being removed.
+      */
+     void (*WindowRemove)  ( void                   *context,
+                             DFBWindowID             window_id );
+
+     /*
+      * Change window configuration,
+      *
+      * called for each window changing its configuration.
+      *
+      * The flags specify which of the items have changed actually.
+      */
+     void (*WindowConfig)  ( void                   *context,
+                             DFBWindowID             window_id,
+                             const DFBWindowConfig  *config,
+                             DFBWindowConfigFlags    flags );
+
+     /*
+      * Update window state,
+      *
+      * called for each window changing its state.
+      *
+      * In case of insertion of a window, prior to this, the watcher will receive the WindowRestack call,
+      * which contains the z-position at which the window has been inserted.
+      */
+     void (*WindowState)   ( void                   *context,
+                             DFBWindowID             window_id,
+                             const DFBWindowState   *state );
+
+     /*
+      * Update window z-position,
+      *
+      * called for each window changing its z-position.
+      *
+      * In case of insertion of a window, after this call, the watcher will receive the WindowState call,
+      * which indicates insertion of the window.
+      *
+      * Upon reinsertion, only this call will be received.
+      */
+     void (*WindowRestack) ( void                   *context,
+                             DFBWindowID             window_id,
+                             unsigned int            index );
+
+     /*
+      * Switch window focus,
+      *
+      * called for each window getting the focus.
+      */
+     void (*WindowFocus)   ( void                   *context,
+                             DFBWindowID             window_id );
+} DFBWindowsWatcher;
+
+
+/********************
+ * IDirectFBWindows *
+ ********************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBWindows,
+
+   /** Watching **/
+
+     /*
+      * Registers a new windows watcher.
+      *
+      * For any window already existing, the WindowAdded callback will be called immediately.
+      */
+     DFBResult (*RegisterWatcher) (
+          IDirectFBWindows         *thiz,
+          const DFBWindowsWatcher  *watcher,
+          void                     *context
+     );
+)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/Source/DirectFB/include/directfbgl.h b/Source/DirectFB/include/directfbgl.h
new file mode 100755
index 0000000..c570e8c
--- /dev/null
+++ b/Source/DirectFB/include/directfbgl.h
@@ -0,0 +1,118 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFBGL_H__
+#define __DIRECTFBGL_H__
+
+#include <directfb.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*
+ * The DirectFBGL interface version.
+ */
+#define DIRECTFBGL_INTERFACE_VERSION  1
+
+
+/* 
+ * Attributes of an OpenGL context.
+ */
+typedef struct {
+     int        buffer_size;
+     int        depth_size;
+     int        stencil_size;
+     int        aux_buffers;
+    
+     int        red_size;
+     int        green_size;
+     int        blue_size;
+     int        alpha_size;
+
+     int        accum_red_size;
+     int        accum_green_size;
+     int        accum_blue_size;
+     int        accum_alpha_size;
+
+     DFBBoolean double_buffer;
+     DFBBoolean stereo;
+} DFBGLAttributes;
+
+
+/***************
+ * IDirectFBGL *
+ ***************/
+
+/*
+ * <i>No summary yet...</i>
+ */
+DEFINE_INTERFACE(   IDirectFBGL,
+
+   /** Context handling **/
+
+     /*
+      * Acquire the hardware lock.
+      */
+     DFBResult (*Lock) (
+          IDirectFBGL              *thiz
+     );
+
+     /*
+      * Release the lock.
+      */
+     DFBResult (*Unlock) (
+          IDirectFBGL              *thiz
+     );
+
+     /*
+      * Query the OpenGL attributes.
+      */
+     DFBResult (*GetAttributes) (
+          IDirectFBGL              *thiz,
+          DFBGLAttributes          *attributes
+     );
+     
+     /*
+      * Get the address of an OpenGL function.
+      */
+     DFBResult (*GetProcAddress) (
+          IDirectFBGL              *thiz,
+          const char               *name,
+          void                    **ret_address
+     );
+)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/Source/DirectFB/inputdrivers/Makefile.am b/Source/DirectFB/inputdrivers/Makefile.am
new file mode 100755
index 0000000..331644c
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/Makefile.am
@@ -0,0 +1,98 @@
+## Makefile.am for DirectFB/inputdrivers
+
+if DBOX2REMOTE
+DBOX2REMOTE_DIR = dbox2remote
+endif
+
+if DREAMBOXREMOTE
+DREAMBOXREMOTE_DIR = dreamboxremote
+endif
+
+if DYNAPRO_INPUT
+DYNAPRO_INPUT_DIR = dynapro
+endif
+
+if ELO_INPUT
+ELO_INPUT_DIR = elo
+endif
+
+if GUNZE_INPUT
+GUNZE_INPUT_DIR = gunze
+endif
+
+if H3600_TS
+H3600_TS_DIR = h3600_ts
+endif
+
+if JOYSTICK_INPUT
+JOYSTICK_INPUT_DIR = joystick
+endif
+
+if KEYBOARD_INPUT
+KEYBOARD_INPUT_DIR = keyboard
+endif
+
+if LINUX_INPUT
+LINUX_INPUT_DIR = linux_input
+endif
+
+if LIRC_INPUT
+LIRC_INPUT_DIR = lirc
+endif
+
+if MUTOUCH_TS
+MUTOUCH_TS_DIR = mutouch
+endif
+
+if ZYTRONIC_TS
+ZYTRONIC_TS_DIR = zytronic
+endif
+
+if PENMOUNT_TS
+PENMOUNT_TS_DIR = penmount
+endif
+
+if PS2MOUSE_INPUT
+PS2MOUSE_INPUT_DIR = ps2mouse
+endif
+
+if SERIAL_MOUSE_INPUT
+SERIALMOUSE_INPUT_DIR = serialmouse
+endif
+
+if SONYPI
+SONYPI_DIR = sonypi
+endif
+
+if TSLIB
+TSLIB_DIR = tslib
+endif
+
+if UCB1X00_TS
+UCB1X00_TS_DIR = ucb1x00_ts
+endif
+
+if WM97XX_TS
+WM97XX_TS_DIR = wm97xx_ts
+endif
+
+SUBDIRS = \
+	$(DBOX2REMOTE_DIR)	\
+	$(DREAMBOXREMOTE_DIR)	\
+	$(DYNAPRO_INPUT_DIR)	\
+	$(ELO_INPUT_DIR)	\
+	$(GUNZE_INPUT_DIR)	\
+	$(H3600_TS_DIR)		\
+	$(JOYSTICK_INPUT_DIR)	\
+	$(KEYBOARD_INPUT_DIR)	\
+	$(LINUX_INPUT_DIR)	\
+	$(LIRC_INPUT_DIR)	\
+	$(MUTOUCH_TS_DIR)	\
+	$(ZYTRONIC_TS_DIR)	\
+	$(PENMOUNT_TS_DIR)	\
+	$(PS2MOUSE_INPUT_DIR)	\
+	$(SERIALMOUSE_INPUT_DIR) \
+	$(SONYPI_DIR)		\
+	$(TSLIB_DIR)		\
+	$(UCB1X00_TS_DIR)	\
+	$(WM97XX_TS_DIR)
diff --git a/Source/DirectFB/inputdrivers/Makefile.in b/Source/DirectFB/inputdrivers/Makefile.in
new file mode 100755
index 0000000..2da6621
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/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@
+subdir = inputdrivers
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = dbox2remote dreamboxremote dynapro elo gunze h3600_ts \
+	joystick keyboard linux_input lirc mutouch zytronic penmount \
+	ps2mouse serialmouse sonypi tslib ucb1x00_ts wm97xx_ts
+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@
+@DBOX2REMOTE_TRUE@DBOX2REMOTE_DIR = dbox2remote
+@DREAMBOXREMOTE_TRUE@DREAMBOXREMOTE_DIR = dreamboxremote
+@DYNAPRO_INPUT_TRUE@DYNAPRO_INPUT_DIR = dynapro
+@ELO_INPUT_TRUE@ELO_INPUT_DIR = elo
+@GUNZE_INPUT_TRUE@GUNZE_INPUT_DIR = gunze
+@H3600_TS_TRUE@H3600_TS_DIR = h3600_ts
+@JOYSTICK_INPUT_TRUE@JOYSTICK_INPUT_DIR = joystick
+@KEYBOARD_INPUT_TRUE@KEYBOARD_INPUT_DIR = keyboard
+@LINUX_INPUT_TRUE@LINUX_INPUT_DIR = linux_input
+@LIRC_INPUT_TRUE@LIRC_INPUT_DIR = lirc
+@MUTOUCH_TS_TRUE@MUTOUCH_TS_DIR = mutouch
+@ZYTRONIC_TS_TRUE@ZYTRONIC_TS_DIR = zytronic
+@PENMOUNT_TS_TRUE@PENMOUNT_TS_DIR = penmount
+@PS2MOUSE_INPUT_TRUE@PS2MOUSE_INPUT_DIR = ps2mouse
+@SERIAL_MOUSE_INPUT_TRUE@SERIALMOUSE_INPUT_DIR = serialmouse
+@SONYPI_TRUE@SONYPI_DIR = sonypi
+@TSLIB_TRUE@TSLIB_DIR = tslib
+@UCB1X00_TS_TRUE@UCB1X00_TS_DIR = ucb1x00_ts
+@WM97XX_TS_TRUE@WM97XX_TS_DIR = wm97xx_ts
+SUBDIRS = \
+	$(DBOX2REMOTE_DIR)	\
+	$(DREAMBOXREMOTE_DIR)	\
+	$(DYNAPRO_INPUT_DIR)	\
+	$(ELO_INPUT_DIR)	\
+	$(GUNZE_INPUT_DIR)	\
+	$(H3600_TS_DIR)		\
+	$(JOYSTICK_INPUT_DIR)	\
+	$(KEYBOARD_INPUT_DIR)	\
+	$(LINUX_INPUT_DIR)	\
+	$(LIRC_INPUT_DIR)	\
+	$(MUTOUCH_TS_DIR)	\
+	$(ZYTRONIC_TS_DIR)	\
+	$(PENMOUNT_TS_DIR)	\
+	$(PS2MOUSE_INPUT_DIR)	\
+	$(SERIALMOUSE_INPUT_DIR) \
+	$(SONYPI_DIR)		\
+	$(TSLIB_DIR)		\
+	$(UCB1X00_TS_DIR)	\
+	$(WM97XX_TS_DIR)
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  inputdrivers/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/inputdrivers/dbox2remote/Makefile.am b/Source/DirectFB/inputdrivers/dbox2remote/Makefile.am
new file mode 100755
index 0000000..9d880f8
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dbox2remote/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/dbox2remote
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+dbox2remote_LTLIBRARIES = libdirectfb_dbox2remote.la
+
+if BUILD_STATIC
+dbox2remote_DATA = $(dbox2remote_LTLIBRARIES:.la=.o)
+endif
+
+dbox2remotedir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_dbox2remote_la_SOURCES =	\
+	dbox2remote.c
+
+libdirectfb_dbox2remote_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dbox2remote_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/dbox2remote/Makefile.in b/Source/DirectFB/inputdrivers/dbox2remote/Makefile.in
new file mode 100755
index 0000000..924cfb1
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dbox2remote/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 = inputdrivers/dbox2remote
+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)$(dbox2remotedir)" \
+	"$(DESTDIR)$(dbox2remotedir)"
+dbox2remoteLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(dbox2remote_LTLIBRARIES)
+libdirectfb_dbox2remote_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_dbox2remote_la_OBJECTS = dbox2remote.lo
+libdirectfb_dbox2remote_la_OBJECTS =  \
+	$(am_libdirectfb_dbox2remote_la_OBJECTS)
+libdirectfb_dbox2remote_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libdirectfb_dbox2remote_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_dbox2remote_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_dbox2remote_la_SOURCES)
+dbox2remoteDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dbox2remote_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+dbox2remote_LTLIBRARIES = libdirectfb_dbox2remote.la
+@BUILD_STATIC_TRUE@dbox2remote_DATA = $(dbox2remote_LTLIBRARIES:.la=.o)
+dbox2remotedir = $(MODULEDIR)/inputdrivers
+libdirectfb_dbox2remote_la_SOURCES = \
+	dbox2remote.c
+
+libdirectfb_dbox2remote_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dbox2remote_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  inputdrivers/dbox2remote/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/dbox2remote/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-dbox2remoteLTLIBRARIES: $(dbox2remote_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(dbox2remotedir)" || $(MKDIR_P) "$(DESTDIR)$(dbox2remotedir)"
+	@list='$(dbox2remote_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(dbox2remoteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(dbox2remotedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(dbox2remoteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(dbox2remotedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-dbox2remoteLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dbox2remote_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(dbox2remotedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(dbox2remotedir)/$$p"; \
+	done
+
+clean-dbox2remoteLTLIBRARIES:
+	-test -z "$(dbox2remote_LTLIBRARIES)" || rm -f $(dbox2remote_LTLIBRARIES)
+	@list='$(dbox2remote_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_dbox2remote.la: $(libdirectfb_dbox2remote_la_OBJECTS) $(libdirectfb_dbox2remote_la_DEPENDENCIES) 
+	$(libdirectfb_dbox2remote_la_LINK) -rpath $(dbox2remotedir) $(libdirectfb_dbox2remote_la_OBJECTS) $(libdirectfb_dbox2remote_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbox2remote.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-dbox2remoteDATA: $(dbox2remote_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(dbox2remotedir)" || $(MKDIR_P) "$(DESTDIR)$(dbox2remotedir)"
+	@list='$(dbox2remote_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dbox2remoteDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dbox2remotedir)/$$f'"; \
+	  $(dbox2remoteDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dbox2remotedir)/$$f"; \
+	done
+
+uninstall-dbox2remoteDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dbox2remote_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(dbox2remotedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(dbox2remotedir)/$$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)$(dbox2remotedir)" "$(DESTDIR)$(dbox2remotedir)"; 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-dbox2remoteLTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dbox2remoteDATA \
+	install-dbox2remoteLTLIBRARIES
+
+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-dbox2remoteDATA \
+	uninstall-dbox2remoteLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-dbox2remoteLTLIBRARIES clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dbox2remoteDATA \
+	install-dbox2remoteLTLIBRARIES install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-dbox2remoteDATA \
+	uninstall-dbox2remoteLTLIBRARIES
+
+%.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/inputdrivers/dbox2remote/dbox2remote.c b/Source/DirectFB/inputdrivers/dbox2remote/dbox2remote.c
new file mode 100755
index 0000000..cc7dbc1
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dbox2remote/dbox2remote.c
@@ -0,0 +1,340 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include <fcntl.h>
+
+#include <dbox/fp.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( dbox2remote )
+
+#define DEVICE "/dev/dbox/rc0"
+
+typedef struct {
+     DFBInputDeviceKeySymbol  key;
+     u16                      rccode;
+} KeyCode;
+
+/* REMOTE_NEW is the one with _fewer_ buttons */
+static KeyCode keycodes_new_remote[] = {
+     { DIKS_0, 0x0000 },
+     { DIKS_1, 0x0001 },
+     { DIKS_2, 0x0002 },
+     { DIKS_3, 0x0003 },
+     { DIKS_4, 0x0004 },
+     { DIKS_5, 0x0005 },
+     { DIKS_6, 0x0006 },
+     { DIKS_7, 0x0007 },
+     { DIKS_8, 0x0008 },
+     { DIKS_9, 0x0009 },
+
+     { DIKS_CURSOR_LEFT, 0x000b },
+     { DIKS_CURSOR_RIGHT, 0x000a },
+     { DIKS_CURSOR_UP, 0x000c },
+     { DIKS_CURSOR_DOWN, 0x000d },
+     /* FIXME: add support for right-up, right-down, left-down, left-up,
+        they occur, too */
+
+     { DIKS_RED, 0x0013 },
+     { DIKS_GREEN, 0x0011 },
+     { DIKS_YELLOW, 0x0012 },
+     { DIKS_BLUE, 0x0014 },
+
+     { DIKS_OK, 0x000e },
+     { DIKS_HOME, 0x001F },
+     { DIKS_VENDOR, 0x0018 },                     /* "d-box" key */
+     { DIKS_POWER, 0x0010 },
+
+     { DIKS_PAGE_DOWN, 0x0053 },                   /* dbox1 only  */
+     { DIKS_PAGE_UP, 0x0054 },                     /* dbox1 only  */
+
+     { DIKS_VOLUME_UP, 0x0015 },
+     { DIKS_VOLUME_DOWN, 0x0016 },
+     { DIKS_MUTE, 0x000f },
+     { DIKS_INFO, 0x0017 },
+     { DIKS_NULL, 0xFFFF }
+};
+
+static KeyCode keycodes_old_remote[] = {
+     { DIKS_0, 0x5c00 },
+     { DIKS_1, 0x5c01 },
+     { DIKS_2, 0x5c02 },
+     { DIKS_3, 0x5c03 },
+     { DIKS_4, 0x5c04 },
+     { DIKS_5, 0x5c05 },
+     { DIKS_6, 0x5c06 },
+     { DIKS_7, 0x5c07 },
+     { DIKS_8, 0x5c08 },
+     { DIKS_9, 0x5c09 },
+
+     { DIKS_CURSOR_LEFT, 0x5c2f },
+     { DIKS_CURSOR_RIGHT, 0x5c2e },
+     { DIKS_CURSOR_UP, 0x5c0e },
+     { DIKS_CURSOR_DOWN, 0x5c0f },
+
+     { DIKS_RED, 0x5c2D },
+     { DIKS_GREEN, 0x5c55 },
+     { DIKS_YELLOW, 0x5c52 },
+     { DIKS_BLUE, 0x5c3b },
+
+     { DIKS_OK, 0x5c30 },
+     { DIKS_HOME, 0x5c20 },                       /* radio key  */
+     { DIKS_VENDOR, 0x5c27 },                     /* TV key     */
+     { DIKS_POWER, 0x5c0c },
+
+     { DIKS_PAGE_DOWN, 0x5c53 },                   /* dbox1 only */
+     { DIKS_PAGE_UP, 0x5c54 },                     /* dbox1 only */
+
+     { DIKS_VOLUME_UP, 0x5c16 },
+     { DIKS_VOLUME_DOWN, 0x5c17 },
+     { DIKS_MUTE, 0x5c28 },
+     { DIKS_INFO, 0x5c82 },
+     { DIKS_NULL, 0xFFFF }
+};
+
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} Dbox2remoteData;
+
+
+/*
+ * helper function for translating rccode
+ */
+static DFBInputDeviceKeySymbol
+dbox2remote_parse_rccode( u16 rccode )
+{
+     KeyCode *keycode;
+
+     if ((rccode & 0xff00) == 0x5c00) {
+          keycode = keycodes_old_remote;
+     }
+     else {
+          keycode = keycodes_new_remote;
+          rccode &= 0x003f;
+     }
+
+     while (keycode->key != DIKS_NULL) {
+          if (keycode->rccode == rccode) {
+               return keycode->key;
+          }
+          keycode++;
+     }
+
+     return DIKS_NULL;
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+dbox2remoteEventThread( DirectThread *thread, void *driver_data )
+{
+     Dbox2remoteData *data = (Dbox2remoteData*) driver_data;
+     int              readlen;
+     u16              rccode;
+     DFBInputEvent    evt;
+
+     while ((readlen = read( data->fd, &rccode, 2 )) == 2) {
+          direct_thread_testcancel( thread );
+
+          /* translate rccode to DirectFB keycode */
+          evt.key_symbol = dbox2remote_parse_rccode( rccode );
+          if (evt.key_symbol != DIKS_NULL) {
+               /* set event type and dispatch*/
+               evt.type = DIET_KEYPRESS;
+               evt.flags = DIEF_KEYSYMBOL;
+               dfb_input_dispatch( data->device, &evt );
+
+               /* set event type and dispatch*/
+               evt.type = DIET_KEYRELEASE;
+               evt.flags = DIEF_KEYSYMBOL;
+               dfb_input_dispatch( data->device, &evt );
+          }
+     }
+
+     if (readlen <= 0 && errno != EINTR)
+          D_PERROR ("dbox2remote thread died\n");
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     /* Check if we are able to read from device */
+     if (access( DEVICE, R_OK ))
+        return 0;
+
+     return 1;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "dbox2 remote" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "fischlustig" );
+
+     info->version.major = 0;
+     info->version.minor = 9;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int                 fd;
+     Dbox2remoteData    *data;
+
+     /* open device */
+     fd = open( DEVICE, O_RDONLY);
+     if (fd < 0) {
+          D_PERROR( "DirectFB/dbox2remote: could not open device" );
+          return DFB_INIT;
+     }
+
+     /* apply voodoo */
+     ioctl( fd, RC_IOCTL_BCODES, 0 );
+
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "dbox2 remote control" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "nokia/sagem/philips" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_REMOTE;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_REMOTE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_KEYS;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(Dbox2remoteData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, dbox2remoteEventThread, data, "DBOX2 Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     Dbox2remoteData *data = (Dbox2remoteData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close file */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE ( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/dreamboxremote/Makefile.am b/Source/DirectFB/inputdrivers/dreamboxremote/Makefile.am
new file mode 100755
index 0000000..126288b
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dreamboxremote/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/dreamboxremote
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+dreamboxremote_LTLIBRARIES = libdirectfb_dreamboxremote.la
+
+if BUILD_STATIC
+dreamboxremote_DATA = $(dreamboxremote_LTLIBRARIES:.la=.o)
+endif
+
+dreamboxremotedir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_dreamboxremote_la_SOURCES =	\
+	dreamboxremote.c
+
+libdirectfb_dreamboxremote_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dreamboxremote_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/dreamboxremote/Makefile.in b/Source/DirectFB/inputdrivers/dreamboxremote/Makefile.in
new file mode 100755
index 0000000..003e84b
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dreamboxremote/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 = inputdrivers/dreamboxremote
+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)$(dreamboxremotedir)" \
+	"$(DESTDIR)$(dreamboxremotedir)"
+dreamboxremoteLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(dreamboxremote_LTLIBRARIES)
+libdirectfb_dreamboxremote_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_dreamboxremote_la_OBJECTS = dreamboxremote.lo
+libdirectfb_dreamboxremote_la_OBJECTS =  \
+	$(am_libdirectfb_dreamboxremote_la_OBJECTS)
+libdirectfb_dreamboxremote_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_dreamboxremote_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_dreamboxremote_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_dreamboxremote_la_SOURCES)
+dreamboxremoteDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dreamboxremote_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+dreamboxremote_LTLIBRARIES = libdirectfb_dreamboxremote.la
+@BUILD_STATIC_TRUE@dreamboxremote_DATA = $(dreamboxremote_LTLIBRARIES:.la=.o)
+dreamboxremotedir = $(MODULEDIR)/inputdrivers
+libdirectfb_dreamboxremote_la_SOURCES = \
+	dreamboxremote.c
+
+libdirectfb_dreamboxremote_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dreamboxremote_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  inputdrivers/dreamboxremote/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/dreamboxremote/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-dreamboxremoteLTLIBRARIES: $(dreamboxremote_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(dreamboxremotedir)" || $(MKDIR_P) "$(DESTDIR)$(dreamboxremotedir)"
+	@list='$(dreamboxremote_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(dreamboxremoteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(dreamboxremotedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(dreamboxremoteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(dreamboxremotedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-dreamboxremoteLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dreamboxremote_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(dreamboxremotedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(dreamboxremotedir)/$$p"; \
+	done
+
+clean-dreamboxremoteLTLIBRARIES:
+	-test -z "$(dreamboxremote_LTLIBRARIES)" || rm -f $(dreamboxremote_LTLIBRARIES)
+	@list='$(dreamboxremote_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_dreamboxremote.la: $(libdirectfb_dreamboxremote_la_OBJECTS) $(libdirectfb_dreamboxremote_la_DEPENDENCIES) 
+	$(libdirectfb_dreamboxremote_la_LINK) -rpath $(dreamboxremotedir) $(libdirectfb_dreamboxremote_la_OBJECTS) $(libdirectfb_dreamboxremote_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dreamboxremote.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-dreamboxremoteDATA: $(dreamboxremote_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(dreamboxremotedir)" || $(MKDIR_P) "$(DESTDIR)$(dreamboxremotedir)"
+	@list='$(dreamboxremote_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(dreamboxremoteDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dreamboxremotedir)/$$f'"; \
+	  $(dreamboxremoteDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dreamboxremotedir)/$$f"; \
+	done
+
+uninstall-dreamboxremoteDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dreamboxremote_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(dreamboxremotedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(dreamboxremotedir)/$$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)$(dreamboxremotedir)" "$(DESTDIR)$(dreamboxremotedir)"; 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-dreamboxremoteLTLIBRARIES clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dreamboxremoteDATA \
+	install-dreamboxremoteLTLIBRARIES
+
+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-dreamboxremoteDATA \
+	uninstall-dreamboxremoteLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-dreamboxremoteLTLIBRARIES clean-generic clean-libtool \
+	ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dreamboxremoteDATA \
+	install-dreamboxremoteLTLIBRARIES install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-dreamboxremoteDATA \
+	uninstall-dreamboxremoteLTLIBRARIES
+
+%.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/inputdrivers/dreamboxremote/dreamboxremote.c b/Source/DirectFB/inputdrivers/dreamboxremote/dreamboxremote.c
new file mode 100755
index 0000000..2aa297f
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dreamboxremote/dreamboxremote.c
@@ -0,0 +1,329 @@
+/*
+   (c) Copyright 2005  Marcel Siegert
+
+   All rights reserved.
+
+   Written by Marcel Siegert <mws@directfb.org>
+
+   Mainly based on dbox2remote:
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include <fcntl.h>
+
+#include <dbox/fp.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+DFB_INPUT_DRIVER( dreamboxremote )
+
+#define DEVICE "/dev/rawir2"
+
+typedef struct {
+     DFBInputDeviceKeySymbol  key;
+     u16                      rccode;
+} KeyCode;
+
+static KeyCode keycodes_remote[] = {
+     { DIKS_0, 0x0000 },
+     { DIKS_1, 0x0001 },
+     { DIKS_2, 0x0002 },
+     { DIKS_3, 0x0003 },
+     { DIKS_4, 0x0004 },
+     { DIKS_5, 0x0005 },
+     { DIKS_6, 0x0006 },
+     { DIKS_7, 0x0007 },
+     { DIKS_8, 0x0008 },
+     { DIKS_9, 0x0009 },
+     { DIKS_VOLUME_UP, 0x000a },
+     { DIKS_VOLUME_DOWN, 0x000b },
+     { DIKS_SELECT, 0x000c }, // DM500 Mute
+// TODO find appropriate DIKS codes 
+/*
+     { DIKS_TV??, 0x000c }, // TV
+     { DIKS_, 0x000d }, // bouquet up
+     { DIKS_, 0x000e }, // bouquet down
+     { DIKS_, 0x000f }, // power on/off standby
+*/
+     { DIKS_MENU, 0x0020 }, // DREAM 
+     { DIKS_CURSOR_UP, 0x0021 },
+     { DIKS_CURSOR_DOWN, 0x0022 },
+     { DIKS_CURSOR_LEFT, 0x0023 },
+     { DIKS_CURSOR_RIGHT, 0x0024 },
+     { DIKS_OK, 0x0025 },
+// TODO find appropriate DIKS codes 
+//     { DIKS_, 0x0026 }, // audio
+//     { DIKS_, 0x0027 }, // video
+     { DIKS_INFO, 0x0028 },
+     { DIKS_RED, 0x0040 },
+     { DIKS_GREEN, 0x0041 },
+     { DIKS_YELLOW, 0x0042 },
+     { DIKS_BLUE, 0x0043 },
+     { DIKS_MUTE, 0x0044 },
+// TODO find appropriate DIKS codes 
+//     { DIKS_, 0x0045 }, // text
+//     { DIKS_, 0x0050 }, // forward
+//     { DIKS_, 0x0051 }, // back
+     { DIKS_HOME, 0x0052 }, // lame
+     { DIKS_SLOW, 0x0054 }, // dm500 lame
+//     { DIKS_, 0x0053 }, // text
+//     { DIKS_, 0x0054 }, // help
+
+     { DIKS_NULL, 0xFFFF }
+};
+
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} DreamboxremoteData;
+
+
+/*
+ * helper function for translating rccode
+ */
+static DFBInputDeviceKeySymbol
+dreamboxremote_parse_rccode( u16 rccode )
+{
+	KeyCode *keycode;
+	static  u16 rccodeOld = 0;
+
+	keycode = keycodes_remote;
+	/* 0x00ff indicates key was released
+	   so reset rccodeOld and do nothing
+	*/
+	if ( rccode == 0x00ff ) {
+		rccodeOld = 0;
+		return DIKS_NULL;
+	}
+	/* check for a new keycode
+	   the drivers return msb clear if a key is
+	   pressed - msb set if pressed
+	   ignore key down - otherwise 2 events are 
+	   generated for one press
+	*/
+	rccode &= 0x7fff;
+	if (rccodeOld != rccode ) {
+		rccodeOld = rccode;
+		return DIKS_NULL;
+	}
+	
+	while (keycode->key != DIKS_NULL) {
+		if (keycode->rccode == rccode) {
+			return keycode->key;
+		}
+		keycode++;
+	}
+	return DIKS_NULL;
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+dreamboxremoteEventThread( DirectThread *thread, void *driver_data )
+{
+     DreamboxremoteData *data = (DreamboxremoteData*) driver_data;
+     int              readlen;
+     u16              rccode;
+     DFBInputEvent    evt;
+
+     while ((readlen = read( data->fd, &rccode, 2 )) == 2) {
+          direct_thread_testcancel( thread );
+
+          /* translate rccode to DirectFB keycode */
+          evt.key_symbol = dreamboxremote_parse_rccode( rccode );
+          if (evt.key_symbol != DIKS_NULL) {
+               /* set event type and dispatch*/
+               evt.type = DIET_KEYPRESS;
+               evt.flags = DIEF_KEYSYMBOL;
+               dfb_input_dispatch( data->device, &evt );
+
+               /* set event type and dispatch*/
+               evt.type = DIET_KEYRELEASE;
+               evt.flags = DIEF_KEYSYMBOL;
+               dfb_input_dispatch( data->device, &evt );
+          }
+     }
+
+     if (readlen <= 0 && errno != EINTR)
+          D_PERROR ("dreamboxremote thread died\n");
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     /* Check if we are able to read from device */
+     if (access( DEVICE, R_OK ))
+        return 0;
+
+     return 1;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "dreambox remote" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "mws" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int                 fd;
+     DreamboxremoteData    *data;
+
+     /* open device */
+     fd = open( DEVICE, O_RDONLY);
+     if (fd < 0) {
+          D_PERROR( "DirectFB/dreamboxremote: could not open device" );
+          return DFB_INIT;
+     }
+
+     /* apply voodoo */
+     //ioctl( fd, RC_IOCTL_BCODES, 0 );
+
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "dreambox remote control" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "DM7000/DM56XX/DM500" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_REMOTE;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_REMOTE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_KEYS;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(DreamboxremoteData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, dreamboxremoteEventThread, data, "DreamBox Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     DreamboxremoteData *data = (DreamboxremoteData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close file */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE ( data );
+}
diff --git a/Source/DirectFB/inputdrivers/dynapro/Makefile.am b/Source/DirectFB/inputdrivers/dynapro/Makefile.am
new file mode 100755
index 0000000..58dfc5c
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dynapro/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/inputdrivers/dynapro
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_dynapro.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_dynapro_la_SOURCES =	\
+	dynapro.c
+
+libdirectfb_dynapro_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dynapro_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/inputdrivers/dynapro/Makefile.in b/Source/DirectFB/inputdrivers/dynapro/Makefile.in
new file mode 100755
index 0000000..ecd0a80
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dynapro/Makefile.in
@@ -0,0 +1,592 @@
+# 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 = inputdrivers/dynapro
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_dynapro_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_dynapro_la_OBJECTS = dynapro.lo
+libdirectfb_dynapro_la_OBJECTS = $(am_libdirectfb_dynapro_la_OBJECTS)
+libdirectfb_dynapro_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_dynapro_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_dynapro_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_dynapro_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_dynapro.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_dynapro_la_SOURCES = \
+	dynapro.c
+
+libdirectfb_dynapro_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_dynapro_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  inputdrivers/dynapro/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/dynapro/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_dynapro.la: $(libdirectfb_dynapro_la_OBJECTS) $(libdirectfb_dynapro_la_DEPENDENCIES) 
+	$(libdirectfb_dynapro_la_LINK) -rpath $(inputdir) $(libdirectfb_dynapro_la_OBJECTS) $(libdirectfb_dynapro_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynapro.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/dynapro/dynapro.c b/Source/DirectFB/inputdrivers/dynapro/dynapro.c
new file mode 100755
index 0000000..11ab3fb
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/dynapro/dynapro.c
@@ -0,0 +1,356 @@
+/*
+   Written by Pär Degerman <parde@ikp.liu.se>
+
+   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.
+
+	
+	NOTES
+	=====
+	This driver is based heavily on code from two other DirectFB
+	drivers, namely mutouch.c by Simon Ueng and elo.c by Byron 
+	Stanoszek and Brandon Reynolds, so a lot of credit should go 
+	to those people and not me.
+
+	INSTRUCTIONS
+	============
+	You should change DYNAPRO_MIN_X and DYNAPRO_MIN_Y to match
+	the orientation of your touchscreen.
+
+*/
+
+#include <config.h>
+
+#include <unistd.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <fcntl.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+DFB_INPUT_DRIVER( dynapro )
+
+#define DYNAPRO_DEVICE "/dev/ttyS0"
+#define DYNAPRO_BAUD B9600
+#define DYNAPRO_PACKET_SIZE 5
+
+#define DYNAPRO_SCREENWIDTH 800
+#define DYNAPRO_SCREENHEIGHT 600
+#define DYNAPRO_MINX 800
+#define DYNAPRO_MINY 600
+
+#define DYNAPRO_CMD_TOUCH 0x81
+#define DYNAPRO_CMD_UNTOUCH 0x80
+
+typedef struct __dynaproData__ {
+  int fd;
+  DirectThread *thread;
+  CoreInputDevice *device;
+
+  unsigned short screen_width;
+  unsigned short screen_height;
+  unsigned short min_x;
+  unsigned short min_y;
+
+  unsigned short x;
+  unsigned short y;
+  unsigned char action;
+} dynaproData;
+
+/* Read a packet from touchcontroller */
+static inline unsigned char *dynapro_getpck(int fd)
+{
+  static unsigned char packet[DYNAPRO_PACKET_SIZE];
+  static unsigned int len = 0, start = 0;
+
+  while(1) {
+	 if (read(fd, &packet[len++], 1) < 1) {
+		break;
+	 }
+
+	 if (0 == start) {
+		if (packet[len-1] & 0x80) {
+			/* Packet start found */
+			start = 1;
+			continue;
+		} else {
+			/* Continue searching for packet start */
+			len = 0;
+			start = 0;
+			continue;
+		}
+	 } else if (len < DYNAPRO_PACKET_SIZE) {
+		/* Continue until we have a full packet */
+		start = 1;
+		continue;
+	 }
+
+	 /* A full packet received */
+	 len = 0;
+	 start = 0;
+	 return packet;
+  }
+
+  return NULL;
+}
+
+/* Remove all input translations over tty serial controller.
+ *
+ * set=1:  Saves current settings then turns rawmode on.
+ * set=0:  Restores controller to previous saved value.
+ */
+static void tty_rawmode(int fd, int set)
+{
+  static struct termios tbuf, termios_save;
+
+  if(set) {
+	 tcgetattr(fd, &termios_save);
+    tbuf = termios_save;
+
+    tbuf.c_iflag = 0; /* No input processing */
+    tbuf.c_oflag = 0; /* No output processing */
+    tbuf.c_lflag = 0; /* Disable erase/kill, signals, and echo */
+
+	 /* Set baud & 1-char read mode */
+    tbuf.c_cflag = DYNAPRO_BAUD | CS8 | CLOCAL | CREAD;
+
+    tcsetattr(fd, TCSANOW, &tbuf);
+  } else {
+    tcsetattr(fd, TCSANOW, &termios_save);
+  }
+}
+
+/* Open file descriptor to touch device */
+static int dynaproOpenDevice(char *device)
+{
+  int fd;
+
+  if((fd = open(device, O_RDWR|O_NOCTTY)) == -1) {
+    D_PERROR("DirectFB/dynbapro: Error opening '%s'!\n",device);
+    return -1;
+  }
+
+  if((flock(fd, LOCK_EX|LOCK_NB)) == -1) {
+    D_PERROR("DirectFB/dynbapro: Error locking '%s'!\n",device);
+    close(fd);
+    return -1;
+  }
+
+  tty_rawmode(fd,1);
+
+  return fd;
+}
+
+
+static int dynaproGetEvent(dynaproData *event)
+{
+  unsigned char *ptr;
+  unsigned int cmd, x, y;
+
+  /* read packet */
+  if(!(ptr = dynapro_getpck(event->fd))) {
+    return -1;
+  }
+
+  /* Get command (touch/untouch) and coordinates */
+  cmd = ptr[0];
+  x = (event->screen_width * ((ptr[3] << 8) + ptr[4])) / 0x0fff;
+  y = (event->screen_height* ((ptr[1] << 8) + ptr[2])) / 0x0fff;
+
+  if (event->min_x)
+	 x = event->min_x - x;
+  if (event->min_y)
+	 y = event->min_y - y;
+
+  event->action = cmd;
+  event->x = x;
+  event->y = y;
+
+  return 0;
+}
+
+
+/* The main routine for dynapro */
+static void *dynaproTouchEventThread(DirectThread *thread, void *driver_data)
+{
+  dynaproData *data = (dynaproData *) driver_data;
+
+  /* Read data */
+  while (1) {
+    DFBInputEvent evt;
+
+    if(dynaproGetEvent(data) == -1) {
+		continue;
+	 }
+    direct_thread_testcancel(thread);
+
+    /* Dispatch axis */
+    evt.type    = DIET_AXISMOTION;
+    evt.flags   = DIEF_AXISABS;
+    evt.axis    = DIAI_X;
+    evt.axisabs = data->x;
+    dfb_input_dispatch(data->device, &evt);
+
+    evt.type    = DIET_AXISMOTION;
+    evt.flags   = DIEF_AXISABS;
+    evt.axis    = DIAI_Y;
+    evt.axisabs = data->y;
+    dfb_input_dispatch(data->device, &evt);
+
+    /* Dispatch touch event */
+    if (DYNAPRO_CMD_UNTOUCH == data->action)
+      evt.type = DIET_BUTTONRELEASE;
+    else
+      evt.type = DIET_BUTTONPRESS;
+
+    evt.flags  = DIEF_NONE;
+    evt.button = DIBI_LEFT;
+
+    dfb_input_dispatch(data->device, &evt);
+    direct_thread_testcancel(thread);
+  }
+
+  return NULL;
+}
+
+
+/* exported symbols */
+static int driver_get_available( void )
+{
+  int fd;
+
+  fd = dynaproOpenDevice(DYNAPRO_DEVICE);
+  if (fd < 0) {
+    return 0;
+  }
+  close(fd);
+
+  return 1;
+}
+
+static void driver_get_info( InputDriverInfo *info )
+{
+  /* fill driver info structure */
+  snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+           "dynapro" );
+  snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+           "3M" );
+
+  info->version.major = 0;
+  info->version.minor = 1;
+}
+
+static DFBResult driver_open_device(CoreInputDevice *device,
+                                    unsigned int number,
+                                    InputDeviceInfo *info,
+                                    void **driver_data)
+{
+  int fd;
+  dynaproData *data;
+
+  /* open device */
+  fd = dynaproOpenDevice(DYNAPRO_DEVICE);
+  if(fd < 0) {
+    D_PERROR("DirectFB/dynapro: Error opening '"DYNAPRO_DEVICE"'!\n");
+    return DFB_INIT;
+  }
+
+  data = D_CALLOC(1, sizeof(dynaproData));
+  if (!data) {
+    tty_rawmode(fd, 0);
+    close(fd);
+    return D_OOM();
+  }
+
+  data->fd     = fd;
+  data->device = device;
+
+  /* FIXME! Use settings instead? */
+  data->screen_width  = DYNAPRO_SCREENWIDTH;
+  data->screen_height = DYNAPRO_SCREENHEIGHT;
+  data->min_x = DYNAPRO_MINX;
+  data->min_y = DYNAPRO_MINY;
+
+  /* fill device info structure */
+  snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+           "dynapro");
+  snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,
+           "3M");
+
+  info->prefered_id     = DIDID_MOUSE;
+  info->desc.type       = DIDTF_MOUSE;
+  info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+  info->desc.max_axis   = DIAI_Y;
+  info->desc.max_button = DIBI_LEFT;
+
+  /* start input thread */
+  data->thread = direct_thread_create(DTT_INPUT, 
+												  dynaproTouchEventThread, 
+												  data, 
+												  "Dynapro Touch Input");
+
+  /* set private data pointer */
+  *driver_data = data;
+
+  return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+                                         void        *driver_data,
+                                         DFBInputDeviceKeymapEntry *entry)
+{
+  return DFB_UNSUPPORTED;
+}
+
+static void driver_close_device(void *driver_data)
+{
+  dynaproData *data = (dynaproData *)driver_data;
+
+  /* stop input thread */
+  direct_thread_cancel(data->thread);
+  direct_thread_join(data->thread);
+  direct_thread_destroy(data->thread);
+
+  /* restore termnial settings for the port */
+  tty_rawmode(data->fd, 0);
+
+  /* close device */
+  close(data->fd);
+
+  /* free private data */
+  D_FREE(data);
+}
diff --git a/Source/DirectFB/inputdrivers/elo/Makefile.am b/Source/DirectFB/inputdrivers/elo/Makefile.am
new file mode 100755
index 0000000..28a3583
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/elo/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/elo
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_elo.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_elo_la_SOURCES =	\
+	elo.c
+
+libdirectfb_elo_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_elo_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/elo/Makefile.in b/Source/DirectFB/inputdrivers/elo/Makefile.in
new file mode 100755
index 0000000..f52684b
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/elo/Makefile.in
@@ -0,0 +1,592 @@
+# 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 = inputdrivers/elo
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_elo_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_elo_la_OBJECTS = elo.lo
+libdirectfb_elo_la_OBJECTS = $(am_libdirectfb_elo_la_OBJECTS)
+libdirectfb_elo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_elo_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_elo_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_elo_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_elo.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_elo_la_SOURCES = \
+	elo.c
+
+libdirectfb_elo_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_elo_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  inputdrivers/elo/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/elo/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_elo.la: $(libdirectfb_elo_la_OBJECTS) $(libdirectfb_elo_la_DEPENDENCIES) 
+	$(libdirectfb_elo_la_LINK) -rpath $(inputdir) $(libdirectfb_elo_la_OBJECTS) $(libdirectfb_elo_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elo.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/elo/elo.c b/Source/DirectFB/inputdrivers/elo/elo.c
new file mode 100755
index 0000000..0274bff
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/elo/elo.c
@@ -0,0 +1,539 @@
+/*
+   (c) Copyright 2003  Commercial Timesharing Inc.
+
+   All rights reserved.
+
+   Written by Byron Stanoszek <bstanoszek@comtime.com> and
+              Brandon Reynolds <bmr@comtime.com>
+
+   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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/file.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( elo )
+
+#define elo_REPORT_SIZE    5
+#define elo_PACKET_SIZE    10
+#define elo_SCREENWIDTH    4096
+#define elo_SCREENHEIGHT   4096
+#define elo_MINX           0
+#define elo_MINY           0
+
+
+/* Mode 1 Bit Definitions */
+#define ELO_M_INITIAL 0x01  /* Enables initial pressing detection */
+#define ELO_M_STREAM  0x02  /* Enables stream touch (when finger moves) */
+#define ELO_M_UNTOUCH 0x04  /* Enables untouch detection */
+#define ELO_M_RANGECK 0x40  /* Range checking mode */
+
+/* Mode 2 Bit Definitions */
+#define ELO_M_TRIM    0x02  /* Trim Mode */
+#define ELO_M_CALIB   0x04  /* Calibration Mode */
+#define ELO_M_SCALE   0x08  /* Scaling Mode */
+#define ELO_M_TRACK   0x40  /* Tracking Mode */
+
+
+typedef struct __eloData__ {
+  int fd;
+  DirectThread *thread;
+  CoreInputDevice *device;
+  unsigned short x;
+  unsigned short y;
+  unsigned short screen_width;
+  unsigned short screen_height;
+  unsigned short min_x;
+  unsigned short min_y;
+  unsigned char action;
+} eloData;
+
+static int elo_check_ack(int fd);
+
+static inline void __mdelay(unsigned int msec)
+{
+  struct timespec delay;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = msec * 1000000;
+  nanosleep (&delay, NULL);
+}
+
+// Write a 10-byte character packet to the touch device.
+//
+static inline void elo_putbuf(int fd, unsigned char *data)
+{
+  unsigned char packet[10];
+  int i;
+
+  packet[0]='U';  /* Special serial lead-in byte */
+  memcpy(packet+1, data, 8);
+  packet[9]=0;
+
+  /* Calculate checksum */
+  for(i=1;i<9;i++)
+    packet[9]+=packet[i];
+  packet[9]--;
+
+  write(fd, packet, 10);
+}
+// Read a packet from the touch device.
+//
+static inline unsigned char *elo_getbuf(int fd)
+{
+  static unsigned char packet[10];
+  static int len=0, start=0;
+
+  fd_set set;
+  unsigned char checksum;
+  int i, j;
+
+  while(1) {
+    /* look ahead to see if there is any data to be gotten */
+    FD_ZERO(&set);
+    FD_SET(fd, &set);
+    if(!select(fd+1, &set, NULL, NULL, NULL))
+      return NULL;
+
+    /* read the next byte from the stream */
+    if(read(fd, &packet[len++], 1) < 1)
+      exit(1);
+    if(!start && packet[len-1] != 0x55) {  /* search for `begin-packet' 0x55 */
+      len=0;
+      continue;
+    }
+
+    start=1;
+    if(len < 10)  /* wait until we get 10 full bytes first */
+      continue;
+
+    /* check packet checksum when finished */
+    for(i=1,checksum=0;i<9;i++)
+      checksum+=packet[i];
+    checksum--;
+
+    /* checksum does not match */
+    if(checksum != packet[9]) {
+      /* scan buffer for next `begin-packet' byte 0x55 */
+      for(i=1;i<10;i++)
+        if(packet[i] == 0x55)
+          break;
+      if(i == 10) {  /* No other 0x55 found */
+        len=0;
+        continue;
+      }
+      for(j=0;i+j < 10;j++)  /* Move 0x55 to front of buffer */
+        packet[j]=packet[i+j];
+      len=j;
+      continue;
+    }
+
+    /* We have a match. Return buffer string */
+    len=0;  /* set for next match */
+
+    return packet+1;
+  }
+}
+
+// Remove all input translations over tty serial controller.
+//
+// set=1:  Saves current settings then turns rawmode on.
+// set=0:  Restores controller to previous saved value.
+//
+static void tty_rawmode(int fd, int set)
+{
+  static struct termio tbuf, termio_save;
+
+  int ret;
+
+  if(set) {
+    ioctl(fd, TCGETA, &termio_save);
+    tbuf=termio_save;
+
+    /* For complete explanation of the flags set/unset below, see termios(3)
+       unix programmers reference manual. */
+
+    tbuf.c_iflag = 0; /* No input processing */
+    tbuf.c_oflag = 0; /* No output processing */
+    tbuf.c_lflag = 0; /* Disable erase/kill, signals, and echo */
+
+    tbuf.c_cflag = B9600|CS8|CLOCAL|CREAD;  /* Set baud & 1-char read mode */
+
+    ret = ioctl(fd, TCSETAF, &tbuf);
+    D_INFO("Elo:tty_rawmode ioctl= %d\n",ret);
+  } else
+    ioctl(fd, TCSETAF, &termio_save);
+}
+
+// Wait for acknowledgment. Returns 0 if no packet received or 1 for success or 2 for fail.
+static int elo_check_ack(int fd)
+{
+  unsigned char buf[100];
+  int i;
+
+
+  __mdelay(100);
+  fd_set set;
+  struct timeval timeout={0, 100000};  /* 0.1 seconds */
+  FD_ZERO(&set);
+  FD_SET(fd, &set);
+  if(!select(fd+1, &set, NULL, NULL, &timeout)) {
+    D_INFO("Elo:elo_check_ack NO PACKET\n");
+    return 0;
+  }
+  memset(buf, 0, sizeof(buf));
+  ssize_t nb = read( fd, buf, sizeof(buf)-1);
+  if( nb >= 0) {
+    for( i = 0; i < nb; i++ ) {
+      if( buf[i] < 0x20 )
+        buf[i] = 0x20;
+    }
+    buf[nb] = '\0';     /* buf now look as a string */
+    char* pt = strstr( buf, "A0000");
+    if ( pt != NULL ) {
+      D_INFO("Elo:elo_check_ack nb= %zd ACK OK\n", nb);
+      
+      return 1;
+    }
+  }
+  D_INFO("Elo:elo_check_ack nb= %zd ACK KO\n", nb);
+  return 2;
+}
+
+// Set scaling info to touch device. Axis can be either 'X', 'Y', or 'Z'.
+//
+static int elo_set_scale(int fd, unsigned char axis, short low, short high)
+{
+  unsigned char packet[8], *ptr;
+
+  if(axis < 'X' || axis > 'Z')
+    return -1;
+
+  memset(packet, 0, 8);
+  packet[0]='S';
+  packet[1]=axis;
+  packet[2]=low;
+  packet[3]=low >> 8;
+  packet[4]=high;
+  packet[5]=high >> 8;
+
+  /* send packet until proper ack is received */
+  while(1) {
+    elo_putbuf(fd, packet);
+
+    int ret = elo_check_ack(fd);
+    if( ret == 1 )      // OK
+      return 0;
+    if( ret == 0 )      // No receive 
+      return -2;
+  }
+}
+
+// Set touch screen response packet mode (see #ifdefs in beginning of file).
+//
+static int elo_set_mode(int fd, unsigned char mode1, unsigned char mode2)
+{
+  unsigned char packet[8];
+
+  /* create packet */
+  memset(packet, 0, 8);
+  packet[0]='M';
+  packet[2]=mode1;
+  packet[3]=mode2;
+
+  /* send packet until proper ack is received */
+  while(1) {
+    elo_putbuf(fd, packet);
+
+    int ret = elo_check_ack(fd);
+    if( ret == 1 )      // OK
+      return 0;
+    if( ret == 0 )      // No receive 
+      return -2;
+    
+  }
+}
+// Reset the touch-screen interface.
+//
+static int elo_reset_touch(int fd)
+{
+  unsigned char packet[8];
+
+  /* Send reset command */
+  memset(packet, 0, 8);
+  packet[0]='R';
+  packet[1]=1;    /* 0=Hard reset, 1=Soft */
+  elo_putbuf(fd, packet);
+
+  /* Wait for response */
+  if(!elo_check_ack(fd))
+    return -1;  /* no valid packet received */
+
+  /* Set the proper mode of operation:
+      Initial Touch, Range Checking, Calibration, Scaling, and Trim. */
+
+  elo_set_mode(fd,ELO_M_INITIAL|ELO_M_UNTOUCH|ELO_M_RANGECK,
+                  ELO_M_CALIB|ELO_M_SCALE|ELO_M_TRIM);
+
+  /* Set scaling to 80 x 25 */
+  elo_set_scale(fd, 'X', elo_MINX, elo_SCREENWIDTH-1);
+  elo_set_scale(fd, 'Y', elo_MINY, elo_SCREENHEIGHT-1);
+
+  return 0;
+}
+
+static int eloOpenDevice(char *device)
+{
+  int fd;
+  int res;
+
+  if((fd = open(device, O_RDWR|O_NOCTTY)) == -1)
+    return -1;
+
+  if((flock(fd, LOCK_EX|LOCK_NB)) == -1) {
+    D_PERROR("DirectFB/elo: Error locking '%s'!\n",device);
+    close(fd);
+    return -1;
+  }
+
+  tty_rawmode(fd,1);
+
+  if((res=elo_reset_touch(fd))) {
+    close(fd);
+    return -1;
+  }
+
+  return fd;
+}
+//
+//
+static int eloGetEvent(eloData *event)
+{
+  unsigned char *ptr;
+
+  /* read in the packet */
+  if(!(ptr=elo_getbuf(event->fd)))
+    return -1;
+
+  if(ptr[0] != 'T')
+    return -1;
+
+  /* Get touch coordinates */
+  event->x = ptr[2]+(ptr[3] << 8);
+  event->y = ptr[4]+(ptr[5] << 8);
+
+  /* Check for invalid range -- reset touch device if so */
+  if(event->x >= event->screen_width
+     || event->y >= event->screen_height) {
+    elo_reset_touch(event->fd);
+    return -1;
+  }
+
+  event->action = ptr[1];
+
+  return 0; // valid touch
+}
+
+/* The main routine for elo */
+static void *eloTouchEventThread(DirectThread *thread, void *driver_data)
+{
+  eloData *data = (eloData *) driver_data;
+
+   /* Read data */
+  while (1) {
+    DFBInputEvent evt;
+
+    if(eloGetEvent(data) == -1) continue;
+    direct_thread_testcancel(thread);
+
+    /* Dispatch axis */
+    evt.type    = DIET_AXISMOTION;
+    evt.flags   = DIEF_AXISABS;
+    evt.axis    = DIAI_X;
+    evt.axisabs = data->x;
+    dfb_input_dispatch(data->device, &evt);
+
+    evt.type    = DIET_AXISMOTION;
+    evt.flags   = DIEF_AXISABS;
+    evt.axis    = DIAI_Y;
+    evt.axisabs = data->y;
+    dfb_input_dispatch(data->device, &evt);
+
+    /* Dispatch touch event */
+    if(data->action & ELO_M_UNTOUCH)
+      evt.type = DIET_BUTTONRELEASE;
+    else
+      evt.type = DIET_BUTTONPRESS;
+
+    evt.flags  = DIEF_NONE;
+    evt.button = DIBI_LEFT;
+
+    dfb_input_dispatch(data->device, &evt);
+    direct_thread_testcancel(thread);
+  }
+
+  return NULL;
+}
+
+/* exported symbols */
+
+static int driver_get_available( void )
+{
+  int fd;
+ 
+  /* we will only use the ELO device if it has been configured */
+  if(!dfb_config->elo_device) {
+    return 0;
+  }
+  fd = eloOpenDevice (dfb_config->elo_device);
+  if (fd < 0) {
+    D_INFO("Elo:driver_get_available NON OK\n");
+    return 0;
+  }
+  close(fd);
+
+  return 1;
+}
+
+static void driver_get_info( InputDriverInfo *info )
+{
+  /* fill driver info structure */
+  snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+           "elo" );
+  snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+           "elo Systems" );
+
+  info->version.major = 0;
+  info->version.minor = 2;
+}
+
+static DFBResult driver_open_device(CoreInputDevice *device,
+                                    unsigned int number,
+                                    InputDeviceInfo *info,
+                                    void **driver_data)
+{
+  int fd;
+  eloData *data;
+
+  /* open device */
+  fd = eloOpenDevice(dfb_config->elo_device);
+  if(fd < 0) {
+    D_INFO("DirectFB/elo: Error opening '%s'!\n", dfb_config->elo_device);
+    return DFB_INIT;
+  }
+
+  data = D_CALLOC(1, sizeof(eloData));
+  if (!data) {
+    close(fd);
+    return D_OOM();
+  }
+
+  data->fd     = fd;
+  data->device = device;
+
+  /* Must define the correct resolution of screen */
+  data->screen_width  = elo_SCREENWIDTH;
+  data->screen_height = elo_SCREENHEIGHT;
+
+  /* The following variable are defined to adjust the orientation of
+   * the touchscreen. Variables are either max screen height/width or 0.
+   */
+  data->min_x = elo_MINX;
+  data->min_y = elo_MINY;
+
+  /* fill device info structure */
+  snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+           "elo");
+  snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,
+           "elo Systems");
+
+  info->prefered_id     = DIDID_MOUSE;
+  info->desc.type       = DIDTF_MOUSE;
+  info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+  info->desc.max_axis   = DIAI_Y;
+  info->desc.max_button = DIBI_LEFT;
+
+  /* start input thread */
+  data->thread = direct_thread_create (DTT_INPUT, eloTouchEventThread, data, "ELO Touch Input");
+
+  /* set private data pointer */
+  *driver_data = data;
+
+  return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+                                         void        *driver_data,
+                                         DFBInputDeviceKeymapEntry *entry)
+{
+  return DFB_UNSUPPORTED;
+}
+
+static void driver_close_device(void *driver_data)
+{
+  eloData *data = (eloData *)driver_data;
+
+  /* stop input thread */
+  direct_thread_cancel(data->thread);
+  direct_thread_join(data->thread);
+  direct_thread_destroy(data->thread);
+
+  /* restore termnial settings for the port */
+  tty_rawmode(data->fd,0);
+
+  /* close device */
+  close(data->fd);
+
+  /* free private data */
+  D_FREE(data);
+}
diff --git a/Source/DirectFB/inputdrivers/gunze/Makefile.am b/Source/DirectFB/inputdrivers/gunze/Makefile.am
new file mode 100755
index 0000000..ef0b9e6
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/gunze/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/inputdrivers/gunze
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_gunze.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_gunze_la_SOURCES =	\
+	gunze.c
+
+libdirectfb_gunze_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_gunze_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/gunze/Makefile.in b/Source/DirectFB/inputdrivers/gunze/Makefile.in
new file mode 100755
index 0000000..ceef162
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/gunze/Makefile.in
@@ -0,0 +1,592 @@
+# 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 = inputdrivers/gunze
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_gunze_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_gunze_la_OBJECTS = gunze.lo
+libdirectfb_gunze_la_OBJECTS = $(am_libdirectfb_gunze_la_OBJECTS)
+libdirectfb_gunze_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_gunze_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_gunze_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_gunze_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_gunze.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_gunze_la_SOURCES = \
+	gunze.c
+
+libdirectfb_gunze_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_gunze_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  inputdrivers/gunze/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/gunze/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_gunze.la: $(libdirectfb_gunze_la_OBJECTS) $(libdirectfb_gunze_la_DEPENDENCIES) 
+	$(libdirectfb_gunze_la_LINK) -rpath $(inputdir) $(libdirectfb_gunze_la_OBJECTS) $(libdirectfb_gunze_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gunze.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/gunze/gunze.c b/Source/DirectFB/inputdrivers/gunze/gunze.c
new file mode 100755
index 0000000..840cd33
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/gunze/gunze.c
@@ -0,0 +1,576 @@
+/*
+   (c) Copyright 2005  Gnat Solutions, Inc.
+
+   All rights reserved.
+
+   Written by Nathanael D. Noblet <nathanael@gnat.ca>
+
+   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.
+
+   This driver is a re-write from the gunze driver provided in XFree86. 
+   Using the MuTouch driver as a skeleton.
+
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+DFB_INPUT_DRIVER( gunze )
+
+#define BUFFER_SIZE         64          /* size of reception buffer */
+#define GUNZE_MAXPHYSCOORD  1023
+#define GUNZE_MAXCOORD      (64*1024-1) /* oversampled, synthetic value */
+#define FLAG_TAPPING        1
+#define FLAG_WAS_UP         2
+#define BAUDRATE            B9600
+
+#define GunzeT_PACKET_SIZE     10
+#define GunzeT_SCREENWIDTH     1024
+#define GunzeT_SCREENHEIGHT    768
+#define GunzeT_MINX            0
+#define GunzeT_MINY            0
+#define GunzeT_DEFAULT_DEVICE   "/dev/ttyS0"
+
+#define GUNZE_PANEL_TOUCH       T
+#define GUNZE_PANEL_UNTOUCH     R
+
+#define GUNZE_SERIAL_DLEN 11
+#define GUNZE_PS2_DLEN     3
+
+#define GUNZE_SECTION_NAME    "gunze"
+#define GUNZE_DEFAULT_CFGFILE "/etc/gunzets.calib"
+
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
+/*
+* Serial protocol (11 b):  <T-or-R> <4-bytes-for-X> , <4-bytes-for-Y> 0x0d
+*/
+typedef struct __GunzeTData__
+{
+    const char *gunDevice;	/* device file name */
+    DirectThread *thread;
+    CoreInputDevice *device;
+    unsigned int x;
+    unsigned int y;
+    unsigned int screen_width;
+    unsigned int screen_height;
+    int     flags;                 /* various flags */
+    int     gunType;               /* TYPE_SERIAL, etc */
+    int     gunBaud;               /* 9600 or 19200 */
+    int     gunDlen;               /* data length (3 or 11) */
+    int     gunPrevX;              /* previous X position */
+    int     gunPrevY;              /* previous Y position */
+    int     gunSmooth;             /* how smooth the motion is */
+    int     gunTapping;            /* move-and-tap (or press-only) not implemented */
+    int     gunPrevButtonState;    /* previous button state */
+    int     gunBytes;              /* number of bytes read */
+    unsigned char gunData[16];     /* data read on the device */
+    int         gunCalib[4];       /* calibration data */
+    char	*gunConfig;            /* filename for configuration */
+    int     fd;
+} GunzeTData;
+
+enum devicetypeitems {
+    TYPE_UNKNOWN = 0,
+    TYPE_SERIAL = 1,
+    TYPE_PS2,
+    TYPE_USB
+};
+
+static int GunzeReadCalib(GunzeTData *priv)
+{
+    int i=1;
+    int err = 1;
+    FILE *f;
+    priv->gunCalib[0]=priv->gunCalib[1]=priv->gunCalib[2]=priv->gunCalib[3]=0;
+    f = fopen(priv->gunConfig, "r");
+    if (f)
+    {
+        char s[80];
+        fgets(s, 80, f); /* discard the comment */
+        if (fscanf(f, "%d %d %d %d", priv->gunCalib, priv->gunCalib+1, priv->gunCalib+2, priv->gunCalib+3) == 4)
+        {
+            D_PERROR("DirectFB/gunze: Calibration invalid 0 i:%d gunCalib[0]:%d \n",i,priv->gunCalib[0]);
+            err = 0;
+        }
+
+        for (i=0; i<4; i++) 
+        {
+            if (priv->gunCalib[i] & ~1023)
+            {
+                D_PERROR("DirectFB/gunze: Calibration invalid 0 i:%d gunCalib[i]:%d \n",i,priv->gunCalib[i]);
+                err++;
+            }
+            if (abs(priv->gunCalib[0] - priv->gunCalib[2]) < 100)
+            {
+                D_PERROR("DirectFB/gunze: Calibration invalid 1 0:%d 2:%d abs(%d)\n",priv->gunCalib[0],priv->gunCalib[2],abs(priv->gunCalib[0] - priv->gunCalib[2]));
+                err++;
+            }
+            if (abs(priv->gunCalib[1] - priv->gunCalib[3]) < 100)
+            {
+                D_PERROR("DirectFB/gunze: Calibration invalid 2 1:%d 3:%d abs(%d)\n",priv->gunCalib[1],priv->gunCalib[3],abs(priv->gunCalib[1] - priv->gunCalib[3]));
+                err++;
+            }
+            fclose(f);
+        }
+    }
+    if (err)
+    {
+      D_PERROR("DirectFB/gunze: Calibration data absent or invalid, using defaults\n");
+      priv->gunCalib[0] = priv->gunCalib[1] = 128; /* 1/8 */
+      priv->gunCalib[2] = priv->gunCalib[3] = 896; /* 7/8 */
+    }
+    return 0;
+}
+
+static int GunzeSetToOptimalCTRL(int file)
+{
+    struct termios  newtio;
+    int err;
+
+    SYSCALL(err = tcgetattr(file, &newtio));
+
+    if (err == -1) {
+        D_PERROR("DirectFB/gunze: Gunze touch screen tcgetattr failed\n");
+        return 0;
+    }
+
+    memset(&newtio,0, sizeof(newtio)); /* clear struct for new port settings */
+/*
+    BAUDRATE: Set bps rate. You could also use cfsetispeed and cfsetospeed.
+    CRTSCTS : output hardware flow control (only used if the cable has
+            all necessary lines. See sect. 7 of Serial-HOWTO)
+    CS8     : 8n1 (8bit,no parity,1 stopbit)
+    CLOCAL  : local connection, no modem contol
+    CREAD   : enable receiving characters
+*/
+    newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
+/*
+    IGNPAR  : ignore bytes with parity errors
+    ICRNL   : map CR to NL (otherwise a CR input on the other computer will not terminate input)
+    otherwise make device raw (no other input processing)
+*/
+    newtio.c_iflag = IGNPAR | ICRNL;
+/*  Raw output */
+    newtio.c_oflag = 0;
+/*
+    ICANON  : enable canonical input
+    disable all echo functionality, and don't send signals to calling program
+*/
+    newtio.c_lflag = ICANON;
+
+/*
+    initialize all control characters 
+    default values can be found in /usr/include/termios.h, and are given
+    in the comments, but we don't need them here
+*/
+    newtio.c_cc[VINTR]    = 0;     /* Ctrl-c */ 
+    newtio.c_cc[VQUIT]    = 0;     /* Ctrl-\ */
+    newtio.c_cc[VERASE]   = 0;     /* del */
+    newtio.c_cc[VKILL]    = 0;     /* @ */
+    newtio.c_cc[VEOF]     = 4;     /* Ctrl-d */
+    newtio.c_cc[VTIME]    = 0;     /* inter-character timer unused */
+    newtio.c_cc[VMIN]     = 1;     /* blocking read until 1 character arrives */
+    newtio.c_cc[VSWTC]    = 0;     /* '\0' */
+    newtio.c_cc[VSTART]   = 0;     /* Ctrl-q */ 
+    newtio.c_cc[VSTOP]    = 0;     /* Ctrl-s */
+    newtio.c_cc[VSUSP]    = 0;     /* Ctrl-z */
+    newtio.c_cc[VEOL]     = 0;     /* '\0' */
+    newtio.c_cc[VREPRINT] = 0;     /* Ctrl-r */
+    newtio.c_cc[VDISCARD] = 0;     /* Ctrl-u */
+    newtio.c_cc[VWERASE]  = 0;     /* Ctrl-w */
+    newtio.c_cc[VLNEXT]   = 0;     /* Ctrl-v */
+    newtio.c_cc[VEOL2]    = 0;     /* '\0' */
+
+    /* now clean the modem line and activate the settings for the port */
+
+    tcflush(file, TCIFLUSH);
+    err = tcsetattr(file, TCSANOW, &newtio);
+    if (err == -1) {
+        D_PERROR("DirectFB/gunze: Gunze touch screen tcsetattr TCSANOW failed\n");
+        return 0;
+    }
+
+    return 1;
+}
+
+static int GunzeOpenDevice(const char *device)
+{
+    int fd;
+    int res;
+
+    /* opens device */
+    SYSCALL(fd = open(device, O_RDWR | O_NOCTTY));
+    if (fd == -1)
+    {
+        D_PERROR("DirectFB/gunze: Error opening device %s\n",device);
+        return fd;
+    }
+
+    /* setup termios settings for communication */
+    if((res = GunzeSetToOptimalCTRL(fd)) == 0)
+    {
+        close(fd);
+        return res;
+    }
+
+    return fd;
+}
+
+/* The main routine for GunzeTouch */
+static void *GunzeTouchEventThread(DirectThread *thread, void *driver_data)
+{
+    GunzeTData *priv = (GunzeTData *) driver_data;
+    unsigned char *pkt = priv->gunData;
+    int len, loop;
+    int x =0;
+    int y =0;
+    int button =0;
+    int *calib = priv->gunCalib;
+    unsigned char buffer[BUFFER_SIZE];
+
+    while ((len = read( priv->fd, buffer, BUFFER_SIZE)) >= 0 || errno == EINTR)
+    {
+
+        if (len <= 0) 
+        {
+            D_PERROR("DirectFB/gunze: error reading Gunze touch screen device %d %d\n",errno,priv->fd);
+            perror(NULL);
+            return NULL;
+        }
+
+        for(loop=0; loop<len; loop++) 
+        {
+            /* if first byte, ensure that the packet is syncronized */
+            if (priv->gunBytes == 0) 
+            {
+                int error  = 0;
+                if (priv->gunDlen == GUNZE_SERIAL_DLEN) 
+                {
+                    /* First byte is 'R' (0x52) or 'T' (0x54) */
+                    if ((buffer[loop] != 'R') && (buffer[loop] != 'T'))
+                        error = 1;
+                }
+                /* PS/2 / USB Unsupported for now (basically I don't have one, and didn't test adding support will be trivial
+                else  
+                {
+                    if ( !(buffer[loop] & 0x80) || (len > loop+1 && !(buffer[loop+1] & 0x80)) || (len > loop+2 && (buffer[loop+2]  & 0x80)))
+                        error = 1;
+                }
+                */
+                if (error)
+                {
+                    D_PERROR("DirectFB/gunze: GunzeReadInput: bad first byte 0x%x %c\n",buffer[loop],buffer[loop]);
+                    continue;
+                }
+            }
+
+            pkt[priv->gunBytes++] = buffer[loop];
+
+            /* Hack: sometimes a serial packet gets corrupted. If so, drop it */
+            if (buffer[loop] == 0x0d && priv->gunBytes != priv->gunDlen && priv->gunDlen == GUNZE_SERIAL_DLEN) 
+            {
+                pkt[priv->gunBytes-1] = '\0';
+                D_PERROR("DirectFB/gunze: Bad packet \"%s\" dropping it\n", pkt);
+                priv->gunBytes = 0;
+                continue;
+            }
+
+            /* if whole packet collected, decode it */
+            if (priv->gunBytes == priv->gunDlen) 
+            {
+                DFBInputEvent evt;
+
+                priv->gunBytes = 0;
+                if (priv->gunDlen == GUNZE_SERIAL_DLEN) 
+                {
+                    /* if T button == true */
+                    button = (pkt[0] == 'T');
+                    x = atoi((char *)pkt+1);
+                    y = atoi((char *)pkt+6);
+                }
+                /* USB version which I haven't added support for 
+                else
+                {
+                    button = (pkt[2] & 0x40);
+                    x = ((pkt[0] & 0x7f) << 3) | ((pkt[1] & 0x70) >> 4);
+                    y = ((pkt[1] & 0x0f) << 6) | ((pkt[2] & 0x3f));
+                }
+                */
+
+                if (x>1023 || x<0 || y>1023 || y<0) 
+                {
+                    D_PERROR("DirectFB/gunze: Bad packet \"%s\" -> %i,%i\n", pkt, x, y);
+
+                    priv->gunBytes = 0;
+                    continue;
+                }
+
+                /*
+                Ok, now that we have raw data, turn it to real data
+                according to calibration, smoothness, tapping and debouncing
+                calibrate and rescale (by multiplying by 64) 
+
+                I don't fully understand this, came from xf86Gunze.c
+                x = 64*128 + 64*768 * (x - calib[0])/(calib[2]-calib[0]);
+                y = 64*128 + 64*768 * (y - calib[1])/(calib[3]-calib[1]);
+                */
+
+                x = 8192 + 49152 * (x - calib[0])/(calib[2]-calib[0]);
+                y = 8192 + 49152 * (y - calib[1])/(calib[3]-calib[1]);
+                y = GUNZE_MAXCOORD - y;
+                /* smooth it down, unless first touch */
+                if (!(priv->flags & FLAG_WAS_UP)) 
+                {
+                    x = (priv->gunPrevX * priv->gunSmooth + x)/(priv->gunSmooth+1);
+                    y = (priv->gunPrevY * priv->gunSmooth + y)/(priv->gunSmooth+1);
+                }
+
+                /* convert gunze x/y to screen dimensions */
+                x = x * priv->screen_width  / (GUNZE_MAXCOORD);
+                y = y * priv->screen_height / (GUNZE_MAXCOORD);
+                if (x < 0) x = 0;
+                if (y < 0) y = 0;
+                if (x > priv->screen_width)  x = priv->screen_width;
+                if (y > priv->screen_height) y = priv->screen_height;
+
+                if (!button)
+                    priv->flags |= FLAG_WAS_UP;
+                else
+                    priv->flags &= ~FLAG_WAS_UP;
+
+                /* Now send events */
+
+                /* only post new x/y if different from previous tap */
+                if ( (priv->gunPrevX != x) || (priv->gunPrevY != y) )
+                {
+                    direct_thread_testcancel (thread);
+                    /* Dispatch axis */
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = x;
+                    dfb_input_dispatch (priv->device, &evt);
+
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = y;
+                    dfb_input_dispatch (priv->device, &evt);
+                    direct_thread_testcancel (thread);
+                    /*printf("dispatched motion x %d y %d\n",x,y);*/
+                }
+                /* post button state change at x/y */
+                if (priv->gunPrevButtonState != button)
+                {
+                    direct_thread_testcancel (thread);
+
+                    /* Dispatch axis */
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = x;
+                    dfb_input_dispatch (priv->device, &evt);
+
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = y;
+                    dfb_input_dispatch (priv->device, &evt);
+
+                    /* Dispatch touch event */
+                    evt.type = (button) ? DIET_BUTTONPRESS:DIET_BUTTONRELEASE;
+                    evt.flags  = DIEF_NONE;
+                    evt.button = DIBI_LEFT;
+
+                    dfb_input_dispatch (priv->device, &evt);
+                    direct_thread_testcancel (thread);
+                    /* printf("dispatched button x %d y %d\n",x,y); */
+                }
+
+                /* remember data */
+                priv->gunPrevButtonState = button;
+                priv->gunPrevX = x;
+                priv->gunPrevY = y;
+
+            }
+        }
+    }
+
+    return NULL;
+}
+
+/* exported symbols */
+
+static int driver_get_available( void )
+{
+    int fd;
+    /*
+    if (!dfb_config->gunze_device){
+        D_PERROR("DirectFB/GunzeTouch: Missing Gunze device file using default %s!\n",GunzeT_DEFAULT_DEVICE);
+        fflush(NULL);
+    }*/
+
+/*    
+    if (!dfb_config->gunze_device)
+        return 0;
+    */
+    /* TODO gotta clean this up... seems odd to open & close it like this... */
+     //fd = GunzeOpenDevice (dfb_config->gunze_device);
+    fd = GunzeOpenDevice(GunzeT_DEFAULT_DEVICE);
+    if (fd < 0)
+        return 0;
+
+    close(fd);
+
+    return 1;
+}
+
+static void driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,"gunze" );
+     snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,"Gunze" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+static DFBResult driver_open_device(CoreInputDevice *device,
+                                    unsigned int number,
+                                    InputDeviceInfo *info,
+                                    void **driver_data)
+{
+    int fd;
+    GunzeTData *data = NULL;
+    const char *devname = GunzeT_DEFAULT_DEVICE;
+
+
+//    if (!dfb_config->gunze_device)
+//        D_PERROR("DirectFB/GunzeTouch: Missing Gunze device file using default %s!\n",GunzeT_DEFAULT_DEVICE);
+
+
+    /* open device */
+    fd = GunzeOpenDevice (devname);
+
+    if (fd < 0) {
+        D_PERROR("DirectFB/GunzeTouch: Error opening '%s'!\n", devname);
+        return DFB_INIT;
+    }
+
+    data = D_CALLOC (1, sizeof(GunzeTData));
+    if (!data) {
+         close (fd);
+         return D_OOM ();
+    }
+
+    data->fd = fd;
+    data->device = device;
+    data->gunDevice= devname;
+    /* hard coded... */
+    data->gunType = TYPE_SERIAL;
+    data->gunDlen = GUNZE_SERIAL_DLEN;
+    /* Must define the correct resolution of screen */
+    data->screen_width  = GunzeT_SCREENWIDTH;
+    data->screen_height = GunzeT_SCREENHEIGHT;
+    data->gunConfig = GUNZE_DEFAULT_CFGFILE;//(!dfb_config->gunze_calibration_file)?GUNZE_DEFAULT_CFGFILE:dfb_config->gunze_calibration_file;
+
+    /* The following variable are defined to adjust the orientation of
+    * the touchscreen. Variables are either max screen height/width or 0.
+    * don't know how to use this as it was taken from mutouch likely not needed...
+
+    data->min_x = GunzeT_MINX;
+    data->min_y = GunzeT_MINY;
+*/
+    /* grab calibration data */
+    GunzeReadCalib(data);
+
+    /* fill device info structure */
+    snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,"gunze");
+    snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,"Gunze");
+
+    info->prefered_id     = DIDID_MOUSE;
+    info->desc.type        = DIDTF_MOUSE;
+    info->desc.caps        = DICAPS_AXES | DICAPS_BUTTONS;
+    info->desc.max_axis   = DIAI_Y;
+    info->desc.max_button = DIBI_LEFT;
+
+    /* start input thread */
+    data->thread = direct_thread_create (DTT_INPUT, GunzeTouchEventThread, data, "GunzeTouch Input");
+
+    /* set private data pointer */
+    *driver_data = data;
+
+    return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+                                         void        *driver_data,
+                                         DFBInputDeviceKeymapEntry *entry)
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void driver_close_device(void *driver_data)
+{
+     GunzeTData *data = (GunzeTData *)driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel (data->thread);
+     direct_thread_join (data->thread);
+     direct_thread_destroy (data->thread);
+
+     /* close device */
+     close (data->fd);
+
+     /* free private data */
+     D_FREE (data);
+}
+
diff --git a/Source/DirectFB/inputdrivers/h3600_ts/Makefile.am b/Source/DirectFB/inputdrivers/h3600_ts/Makefile.am
new file mode 100755
index 0000000..3338669
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/h3600_ts/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/h3600_ts
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_h3600_ts.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_h3600_ts_la_SOURCES =	\
+	h3600_ts.c
+
+libdirectfb_h3600_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_h3600_ts_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/h3600_ts/Makefile.in b/Source/DirectFB/inputdrivers/h3600_ts/Makefile.in
new file mode 100755
index 0000000..45e88ef
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/h3600_ts/Makefile.in
@@ -0,0 +1,593 @@
+# 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 = inputdrivers/h3600_ts
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_h3600_ts_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_h3600_ts_la_OBJECTS = h3600_ts.lo
+libdirectfb_h3600_ts_la_OBJECTS =  \
+	$(am_libdirectfb_h3600_ts_la_OBJECTS)
+libdirectfb_h3600_ts_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_h3600_ts_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_h3600_ts_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_h3600_ts_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_h3600_ts.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_h3600_ts_la_SOURCES = \
+	h3600_ts.c
+
+libdirectfb_h3600_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_h3600_ts_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  inputdrivers/h3600_ts/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/h3600_ts/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_h3600_ts.la: $(libdirectfb_h3600_ts_la_OBJECTS) $(libdirectfb_h3600_ts_la_DEPENDENCIES) 
+	$(libdirectfb_h3600_ts_la_LINK) -rpath $(inputdir) $(libdirectfb_h3600_ts_la_OBJECTS) $(libdirectfb_h3600_ts_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h3600_ts.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/h3600_ts/h3600_ts.c b/Source/DirectFB/inputdrivers/h3600_ts/h3600_ts.c
new file mode 100755
index 0000000..6a6b1af
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/h3600_ts/h3600_ts.c
@@ -0,0 +1,239 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <linux/h3600_ts.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( h3600_ts )
+
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} H3600TSData;
+
+static void *
+h3600tsEventThread( DirectThread *thread, void *driver_data )
+{
+     H3600TSData *data = (H3600TSData*) driver_data;
+
+     TS_EVENT ts_event;
+
+     int readlen;
+
+     unsigned short old_x = -1;
+     unsigned short old_y = -1;
+     unsigned short old_pressure = 0;
+
+     while ((readlen = read(data->fd, &ts_event, sizeof(TS_EVENT))) > 0  ||
+            errno == EINTR)
+     {
+          DFBInputEvent evt;
+
+          direct_thread_testcancel( thread );
+
+          if (readlen < 1)
+               continue;
+
+          if (ts_event.pressure) {
+               if (ts_event.x != old_x) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = ts_event.x;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_x = ts_event.x;
+               }
+
+               if (ts_event.y != old_y) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = ts_event.y;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_y = ts_event.y;
+               }
+          }
+
+          if ((ts_event.pressure && !old_pressure) ||
+              (!ts_event.pressure && old_pressure)) {
+               evt.type   = (ts_event.pressure ?
+                             DIET_BUTTONPRESS : DIET_BUTTONRELEASE);
+               evt.flags  = DIEF_NONE;
+               evt.button = DIBI_LEFT;
+
+               dfb_input_dispatch( data->device, &evt );
+
+               old_pressure = ts_event.pressure;
+          }
+     }
+
+     if (readlen <= 0)
+          D_PERROR ("H3600 Touchscreen thread died\n");
+
+     return NULL;
+}
+
+
+/* exported symbols */
+
+static int driver_get_available( void )
+{
+     int fd;
+
+     fd = open( dfb_config->h3600_device ? : "/dev/ts", O_RDONLY | O_NOCTTY );
+     if (fd < 0)
+          return 0;
+
+     close( fd );
+
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "H3600 Touchscreen Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 2;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int          fd;
+     H3600TSData *data;
+
+     /* open device */
+     fd = open( dfb_config->h3600_device ? : "/dev/ts", O_RDONLY | O_NOCTTY );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/H3600: Error opening `%s'!\n", dfb_config->h3600_device ? : "/dev/ts" );
+          return DFB_INIT;
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "H3600 Touchscreen" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id     = DIDID_MOUSE;
+
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(H3600TSData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, h3600tsEventThread, data, "H3600 TS Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     H3600TSData *data = (H3600TSData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     if (close( data->fd ) < 0)
+          D_PERROR( "DirectFB/H3600: Error closing `%s'!\n", dfb_config->h3600_device ? : "/dev/ts" );
+
+     /* free private data */
+     D_FREE( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/joystick/Makefile.am b/Source/DirectFB/inputdrivers/joystick/Makefile.am
new file mode 100755
index 0000000..0f957df
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/joystick/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/joystick
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+joystick_LTLIBRARIES = libdirectfb_joystick.la
+
+if BUILD_STATIC
+joystick_DATA = $(joystick_LTLIBRARIES:.la=.o)
+endif
+
+joystickdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_joystick_la_SOURCES =	\
+	joystick.c
+
+libdirectfb_joystick_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_joystick_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/joystick/Makefile.in b/Source/DirectFB/inputdrivers/joystick/Makefile.in
new file mode 100755
index 0000000..83b7633
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/joystick/Makefile.in
@@ -0,0 +1,594 @@
+# 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 = inputdrivers/joystick
+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)$(joystickdir)" \
+	"$(DESTDIR)$(joystickdir)"
+joystickLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(joystick_LTLIBRARIES)
+libdirectfb_joystick_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_joystick_la_OBJECTS = joystick.lo
+libdirectfb_joystick_la_OBJECTS =  \
+	$(am_libdirectfb_joystick_la_OBJECTS)
+libdirectfb_joystick_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_joystick_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_joystick_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_joystick_la_SOURCES)
+joystickDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(joystick_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+joystick_LTLIBRARIES = libdirectfb_joystick.la
+@BUILD_STATIC_TRUE@joystick_DATA = $(joystick_LTLIBRARIES:.la=.o)
+joystickdir = $(MODULEDIR)/inputdrivers
+libdirectfb_joystick_la_SOURCES = \
+	joystick.c
+
+libdirectfb_joystick_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_joystick_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  inputdrivers/joystick/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/joystick/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-joystickLTLIBRARIES: $(joystick_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(joystickdir)" || $(MKDIR_P) "$(DESTDIR)$(joystickdir)"
+	@list='$(joystick_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(joystickLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(joystickdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(joystickLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(joystickdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-joystickLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(joystick_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(joystickdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(joystickdir)/$$p"; \
+	done
+
+clean-joystickLTLIBRARIES:
+	-test -z "$(joystick_LTLIBRARIES)" || rm -f $(joystick_LTLIBRARIES)
+	@list='$(joystick_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_joystick.la: $(libdirectfb_joystick_la_OBJECTS) $(libdirectfb_joystick_la_DEPENDENCIES) 
+	$(libdirectfb_joystick_la_LINK) -rpath $(joystickdir) $(libdirectfb_joystick_la_OBJECTS) $(libdirectfb_joystick_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/joystick.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-joystickDATA: $(joystick_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(joystickdir)" || $(MKDIR_P) "$(DESTDIR)$(joystickdir)"
+	@list='$(joystick_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(joystickDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(joystickdir)/$$f'"; \
+	  $(joystickDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(joystickdir)/$$f"; \
+	done
+
+uninstall-joystickDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(joystick_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(joystickdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(joystickdir)/$$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)$(joystickdir)" "$(DESTDIR)$(joystickdir)"; 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-joystickLTLIBRARIES 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-joystickDATA install-joystickLTLIBRARIES
+
+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-joystickDATA uninstall-joystickLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-joystickLTLIBRARIES 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-info install-info-am \
+	install-joystickDATA install-joystickLTLIBRARIES 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-joystickDATA uninstall-joystickLTLIBRARIES
+
+%.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/inputdrivers/joystick/joystick.c b/Source/DirectFB/inputdrivers/joystick/joystick.c
new file mode 100755
index 0000000..807c455
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/joystick/joystick.c
@@ -0,0 +1,279 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <time.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <sys/vt.h>
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+typedef unsigned long kernel_ulong_t;
+#define BITS_PER_LONG    (sizeof(long)*8)
+#endif
+
+#include <linux/joystick.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( joystick )
+
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} JoystickData;
+
+
+static void
+joystick_handle_event( JoystickData *data, struct js_event jse )
+{
+     DFBInputEvent event;
+
+     switch (jse.type) {
+          case JS_EVENT_BUTTON:
+               event.type    = (jse.value ?
+                                DIET_BUTTONPRESS : DIET_BUTTONRELEASE);
+               event.flags   = DIEF_NONE; /* button is always valid */
+               event.button  = jse.number;
+               break;
+          case JS_EVENT_AXIS:
+               event.type    = DIET_AXISMOTION;
+               event.flags   = DIEF_AXISABS;
+               event.axis    = jse.number;
+               event.axisabs = jse.value;
+               break;
+          case JS_EVENT_INIT:
+          case JS_EVENT_INIT | JS_EVENT_BUTTON:
+          case JS_EVENT_INIT | JS_EVENT_AXIS:
+               D_ONCE( "Joystick sends JS_EVENT_INIT events, " \
+                       "make sure it has been calibrated using 'jscal -c'\n");
+               return;
+               break;
+          default:
+               D_PERROR ("unknown joystick event type\n");
+               return;
+     }
+
+     dfb_input_dispatch( data->device, &event );
+}
+
+static void*
+joystickEventThread( DirectThread *thread, void *driver_data )
+{
+     int              len;
+     struct js_event  jse;
+     JoystickData    *data = driver_data;
+
+     while ((len = read( data->fd, &jse,
+                         sizeof(struct js_event) )) > 0 || errno == EINTR)
+     {
+          direct_thread_testcancel( thread );
+
+          if (len != sizeof(struct js_event))
+               continue;
+
+          joystick_handle_event( data, jse );
+     }
+
+     if (len <= 0 && errno != EINTR)
+          D_PERROR ("joystick thread died\n");
+
+     return NULL;
+}
+
+/* exported symbols */
+
+static int
+driver_get_available( void )
+{
+     int  i, fd;
+     int  joy_count = 0;
+     char devicename[20];
+
+     for (i=0; i<8; i++) {
+          snprintf( devicename, 20, "/dev/js%d", i );
+
+          fd = open( devicename, O_RDONLY );
+          if (fd < 0)
+               break;
+
+          close (fd);
+
+          joy_count++;
+     }
+
+     if (!joy_count) {
+          /* try new-style device names */
+
+          for (i=0; i<8; i++) {
+               snprintf( devicename, 20, "/dev/input/js%d", i );
+
+               fd = open( devicename, O_RDONLY );
+               if (fd < 0)
+                    break;
+
+               close (fd);
+
+               joy_count++;
+          }
+     }
+
+     return joy_count;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "Joystick Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 9;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int           fd, buttons, axes;
+     JoystickData *data;
+     char          devicename[20];
+
+     /* open the right device */
+     snprintf( devicename, 20, "/dev/js%d", number );
+
+     fd = open( devicename, O_RDONLY );
+     if (fd < 0) {
+          /* try new-style device names */
+          snprintf( devicename, 20, "/dev/input/js%d", number );
+
+          fd = open( devicename, O_RDONLY );
+          if (fd < 0) {
+               D_PERROR( "DirectFB/Joystick: Could not open `%s'!\n",
+                          devicename );
+               return DFB_INIT; /* no joystick available */
+          }
+     }
+
+     /* query number of buttons and axes */
+     ioctl( fd, JSIOCGBUTTONS, &buttons );
+     ioctl( fd, JSIOCGAXES, &axes );
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "Joystick" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id     = DIDID_JOYSTICK;
+
+     info->desc.type       = DIDTF_JOYSTICK;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_button = buttons - 1;
+     info->desc.max_axis   = axes - 1;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(JoystickData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, joystickEventThread, data, "Joystick Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     JoystickData *data = (JoystickData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/keyboard/Makefile.am b/Source/DirectFB/inputdrivers/keyboard/Makefile.am
new file mode 100755
index 0000000..3b949ed
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/keyboard/Makefile.am
@@ -0,0 +1,33 @@
+## Makefile.am for DirectFB/inputdrivers/keyboard
+
+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
+
+keyboard_LTLIBRARIES = libdirectfb_keyboard.la
+
+if BUILD_STATIC
+keyboard_DATA = $(keyboard_LTLIBRARIES:.la=.o)
+endif
+
+keyboarddir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_keyboard_la_SOURCES =	\
+	keyboard.c
+
+libdirectfb_keyboard_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_keyboard_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/keyboard/Makefile.in b/Source/DirectFB/inputdrivers/keyboard/Makefile.in
new file mode 100755
index 0000000..a11b449
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/keyboard/Makefile.in
@@ -0,0 +1,596 @@
+# 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 = inputdrivers/keyboard
+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)$(keyboarddir)" \
+	"$(DESTDIR)$(keyboarddir)"
+keyboardLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(keyboard_LTLIBRARIES)
+libdirectfb_keyboard_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_keyboard_la_OBJECTS = keyboard.lo
+libdirectfb_keyboard_la_OBJECTS =  \
+	$(am_libdirectfb_keyboard_la_OBJECTS)
+libdirectfb_keyboard_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_keyboard_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_keyboard_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_keyboard_la_SOURCES)
+keyboardDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(keyboard_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
+
+keyboard_LTLIBRARIES = libdirectfb_keyboard.la
+@BUILD_STATIC_TRUE@keyboard_DATA = $(keyboard_LTLIBRARIES:.la=.o)
+keyboarddir = $(MODULEDIR)/inputdrivers
+libdirectfb_keyboard_la_SOURCES = \
+	keyboard.c
+
+libdirectfb_keyboard_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_keyboard_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  inputdrivers/keyboard/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/keyboard/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-keyboardLTLIBRARIES: $(keyboard_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(keyboarddir)" || $(MKDIR_P) "$(DESTDIR)$(keyboarddir)"
+	@list='$(keyboard_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(keyboardLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(keyboarddir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(keyboardLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(keyboarddir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-keyboardLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(keyboard_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(keyboarddir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(keyboarddir)/$$p"; \
+	done
+
+clean-keyboardLTLIBRARIES:
+	-test -z "$(keyboard_LTLIBRARIES)" || rm -f $(keyboard_LTLIBRARIES)
+	@list='$(keyboard_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_keyboard.la: $(libdirectfb_keyboard_la_OBJECTS) $(libdirectfb_keyboard_la_DEPENDENCIES) 
+	$(libdirectfb_keyboard_la_LINK) -rpath $(keyboarddir) $(libdirectfb_keyboard_la_OBJECTS) $(libdirectfb_keyboard_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.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-keyboardDATA: $(keyboard_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(keyboarddir)" || $(MKDIR_P) "$(DESTDIR)$(keyboarddir)"
+	@list='$(keyboard_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(keyboardDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(keyboarddir)/$$f'"; \
+	  $(keyboardDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(keyboarddir)/$$f"; \
+	done
+
+uninstall-keyboardDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(keyboard_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(keyboarddir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(keyboarddir)/$$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)$(keyboarddir)" "$(DESTDIR)$(keyboarddir)"; 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-keyboardLTLIBRARIES 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-keyboardDATA install-keyboardLTLIBRARIES
+
+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-keyboardDATA uninstall-keyboardLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-keyboardLTLIBRARIES 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-info install-info-am \
+	install-keyboardDATA install-keyboardLTLIBRARIES 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-keyboardDATA uninstall-keyboardLTLIBRARIES
+
+%.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/inputdrivers/keyboard/keyboard.c b/Source/DirectFB/inputdrivers/keyboard/keyboard.c
new file mode 100755
index 0000000..783ebfb
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/keyboard/keyboard.c
@@ -0,0 +1,524 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/kd.h>
+#include <sys/vt.h>
+
+#include <errno.h>
+
+#include <fbdev/fbdev.h>
+
+#include <linux/keyboard.h>
+
+#include <termios.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+
+DFB_INPUT_DRIVER( keyboard )
+
+typedef struct {
+     CoreInputDevice *device;
+     DirectThread    *thread;
+
+     struct termios   old_ts;
+
+     int              vt_fd;
+} KeyboardData;
+
+static DFBInputDeviceKeySymbol
+keyboard_get_symbol( int                             code,
+                     unsigned short                  value,
+                     DFBInputDeviceKeymapSymbolIndex level )
+{
+     unsigned char type  = KTYP(value);
+     unsigned char index = KVAL(value);
+     int           base  = (level == DIKSI_BASE);
+
+     switch (type) {
+          case KT_FN:
+               if (index < 20)
+                    return DFB_FUNCTION_KEY( index + 1 );
+               break;
+          case KT_LETTER:
+          case KT_LATIN:
+               switch (index) {
+                    case 0x1c:
+                         return DIKS_PRINT;
+                    case 0x7f:
+                         return DIKS_BACKSPACE;
+                    case 0xa4:
+                         return 0x20ac; /* euro currency sign */
+                    default:
+                         return index;
+               }
+               break;
+          case KT_DEAD:
+               switch (value) {
+                    case K_DGRAVE:
+                         return DIKS_DEAD_GRAVE;
+
+                    case K_DACUTE:
+                         return DIKS_DEAD_ACUTE;
+
+                    case K_DCIRCM:
+                         return DIKS_DEAD_CIRCUMFLEX;
+
+                    case K_DTILDE:
+                         return DIKS_DEAD_TILDE;
+
+                    case K_DDIERE:
+                         return DIKS_DEAD_DIAERESIS;
+
+                    case K_DCEDIL:
+                         return DIKS_DEAD_CEDILLA;
+
+                    default:
+                         break;
+               }
+               break;
+          case KT_PAD:
+               if (index <= 9 && level != DIKSI_BASE)
+                    return DIKS_0 + index;
+               break;
+          case 0xe: /* special IPAQ H3600 case - AH */
+               switch (index) {
+                    case 0x20:     return DIKS_CALENDAR;
+                    case 0x1a:     return DIKS_BACK;
+                    case 0x1c:     return DIKS_MEMO;
+                    case 0x21:     return DIKS_POWER;
+               }
+               break;
+          case 0xd: /* another special IPAQ H3600 case - AH */
+               switch (index) {
+                    case 0x2:     return DIKS_DIRECTORY;
+                    case 0x1:     return DIKS_MAIL;  /* Q on older iPaqs */
+               }
+               break;
+     }
+
+     switch (value) {
+          case K_LEFT:    return DIKS_CURSOR_LEFT;
+          case K_RIGHT:   return DIKS_CURSOR_RIGHT;
+          case K_UP:      return DIKS_CURSOR_UP;
+          case K_DOWN:    return DIKS_CURSOR_DOWN;
+          case K_ENTER:   return DIKS_ENTER;
+          case K_CTRL:    return DIKS_CONTROL;
+          case K_SHIFT:   return DIKS_SHIFT;
+          case K_ALT:     return DIKS_ALT;
+          case K_ALTGR:   return DIKS_ALTGR;
+          case K_INSERT:  return DIKS_INSERT;
+          case K_REMOVE:  return DIKS_DELETE;
+          case K_FIND:    return DIKS_HOME;
+          case K_SELECT:  return DIKS_END;
+          case K_PGUP:    return DIKS_PAGE_UP;
+          case K_PGDN:    return DIKS_PAGE_DOWN;
+          case K_NUM:     return DIKS_NUM_LOCK;
+          case K_HOLD:    return DIKS_SCROLL_LOCK;
+          case K_PAUSE:   return DIKS_PAUSE;
+          case K_BREAK:   return DIKS_BREAK;
+          case K_CAPS:    return DIKS_CAPS_LOCK;
+
+          case K_P0:      return DIKS_INSERT;
+          case K_P1:      return DIKS_END;
+          case K_P2:      return DIKS_CURSOR_DOWN;
+          case K_P3:      return DIKS_PAGE_DOWN;
+          case K_P4:      return DIKS_CURSOR_LEFT;
+          case K_P5:      return DIKS_BEGIN;
+          case K_P6:      return DIKS_CURSOR_RIGHT;
+          case K_P7:      return DIKS_HOME;
+          case K_P8:      return DIKS_CURSOR_UP;
+          case K_P9:      return DIKS_PAGE_UP;
+          case K_PPLUS:   return DIKS_PLUS_SIGN;
+          case K_PMINUS:  return DIKS_MINUS_SIGN;
+          case K_PSTAR:   return DIKS_ASTERISK;
+          case K_PSLASH:  return DIKS_SLASH;
+          case K_PENTER:  return DIKS_ENTER;
+          case K_PCOMMA:  return base ? DIKS_DELETE : DIKS_COMMA;
+          case K_PDOT:    return base ? DIKS_DELETE : DIKS_PERIOD;
+          case K_PPARENL: return DIKS_PARENTHESIS_LEFT;
+          case K_PPARENR: return DIKS_PARENTHESIS_RIGHT;
+     }
+
+     /* special keys not in the map, hack? */
+     if (code == 124)         /* keypad equal key */
+          return DIKS_EQUALS_SIGN;
+
+     if (code == 125)         /* left windows key */
+          return DIKS_META;
+
+     if (code == 126)         /* right windows key */
+          return DIKS_META;
+
+     if (code == 127)         /* context menu key */
+          return DIKS_SUPER;
+
+     return DIKS_NULL;
+}
+
+static DFBInputDeviceKeyIdentifier
+keyboard_get_identifier( int code, unsigned short value )
+{
+     unsigned char type  = KTYP(value);
+     unsigned char index = KVAL(value);
+
+     if (type == KT_PAD) {
+          if (index <= 9)
+               return DIKI_KP_0 + index;
+
+          switch (value) {
+               case K_PSLASH: return DIKI_KP_DIV;
+               case K_PSTAR:  return DIKI_KP_MULT;
+               case K_PMINUS: return DIKI_KP_MINUS;
+               case K_PPLUS:  return DIKI_KP_PLUS;
+               case K_PENTER: return DIKI_KP_ENTER;
+               case K_PCOMMA:
+               case K_PDOT:   return DIKI_KP_DECIMAL;
+          }
+     }
+
+     /* Looks like a hack, but don't know a better way yet. */
+     switch (code) {
+          case 12: return DIKI_MINUS_SIGN;
+          case 13: return DIKI_EQUALS_SIGN;
+          case 26: return DIKI_BRACKET_LEFT;
+          case 27: return DIKI_BRACKET_RIGHT;
+          case 39: return DIKI_SEMICOLON;
+          case 40: return DIKI_QUOTE_RIGHT;
+          case 41: return DIKI_QUOTE_LEFT;
+          case 43: return DIKI_BACKSLASH;
+          case 51: return DIKI_COMMA;
+          case 52: return DIKI_PERIOD;
+          case 53: return DIKI_SLASH;
+          case 54: return DIKI_SHIFT_R;
+          case 97: return DIKI_CONTROL_R;
+          default:
+               ;
+     }
+
+     /* special keys not in the map, hack? */
+     if (code == 124)         /* keypad equal key */
+          return DIKI_KP_EQUAL;
+
+     if (code == 125)         /* left windows key */
+          return DIKI_META_L;
+
+     if (code == 126)         /* right windows key */
+          return DIKI_META_R;
+
+     if (code == 127)         /* context menu key */
+          return DIKI_SUPER_R;
+
+     return DIKI_UNKNOWN;
+}
+
+static unsigned short
+keyboard_read_value( KeyboardData *data,
+                     unsigned char table, unsigned char index )
+{
+     struct kbentry entry;
+
+     entry.kb_table = table;
+     entry.kb_index = index;
+     entry.kb_value = 0;
+
+     if (ioctl( data->vt_fd, KDGKBENT, &entry )) {
+          D_PERROR("DirectFB/keyboard: KDGKBENT (table: %d, index: %d) "
+                    "failed!\n", table, index);
+          return 0;
+     }
+
+     return entry.kb_value;
+}
+
+static void
+keyboard_set_lights( KeyboardData *data, DFBInputDeviceLockState locks )
+{
+     ioctl( data->vt_fd, KDSKBLED, locks );
+}
+
+static void*
+keyboardEventThread( DirectThread *thread, void *driver_data )
+{
+     int            readlen;
+     unsigned char  buf[64];
+     KeyboardData  *data = (KeyboardData*) driver_data;
+
+     /* Read keyboard data */
+     while ((readlen = read (data->vt_fd, buf, 64)) >= 0 || errno == EINTR) {
+          int i;
+
+          direct_thread_testcancel( thread );
+
+          for (i = 0; i < readlen; i++) {
+               DFBInputEvent evt;
+
+               evt.type     = ((buf[i] & 0x80) ?
+                               DIET_KEYRELEASE : DIET_KEYPRESS);
+               evt.flags    = DIEF_KEYCODE;
+               evt.key_code = buf[i] & 0x7f;
+
+               dfb_input_dispatch( data->device, &evt );
+
+               keyboard_set_lights( data, evt.locks );
+          }
+
+          if (readlen <= 0)
+               usleep( 200000 );
+     }
+
+     if (readlen <= 0 && errno != EINTR)
+          D_PERROR ("keyboard thread died\n");
+
+     return NULL;
+}
+
+/* driver functions */
+
+static int
+driver_get_available( void )
+{
+     int fd;
+
+     switch (dfb_system_type()) {
+          case CORE_FBDEV:
+          case CORE_DEVMEM:
+               return 1;
+
+          default:
+               return 0;
+     }
+
+     fd = open( "/dev/tty0", O_RDWR | O_NOCTTY );
+     if (fd < 0)
+          return 0;
+
+     close( fd );
+
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "Keyboard Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 9;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int             fd;
+     struct termios  ts;
+     KeyboardData   *data;
+
+
+     if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) {
+          FBDev *dfb_fbdev = dfb_system_data();
+
+          fd = dup( dfb_fbdev->vt->fd );
+          if (fd < 0) {
+               D_PERROR( "DirectFB/Keyboard: Could not dup() file descriptor of TTY!\n" );
+               return DFB_INIT;
+          }
+     }
+     else {
+          fd = open( "/dev/tty0", O_RDWR | O_NOCTTY );
+          if (fd < 0) {
+               D_PERROR( "DirectFB/Keyboard: Could not open() /dev/tty0!\n" );
+               return DFB_INIT;
+          }
+     }
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(KeyboardData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->device = device;
+     data->vt_fd  = fd;
+
+     tcgetattr( data->vt_fd, &data->old_ts );
+
+     ts = data->old_ts;
+     ts.c_cc[VTIME] = 0;
+     ts.c_cc[VMIN] = 1;
+     ts.c_lflag &= ~(ICANON|ECHO|ISIG);
+     ts.c_iflag = 0;
+     tcsetattr( data->vt_fd, TCSAFLUSH, &ts );
+
+     tcsetpgrp( data->vt_fd, getpgrp() );
+
+     if (dfb_system_type() == CORE_FBDEV && dfb_config->vt) {
+          FBDev *dfb_fbdev = dfb_system_data();
+          dfb_fbdev->vt->flush = false;
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "Keyboard" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     /* claim to be the primary keyboard */
+     info->prefered_id = DIDID_KEYBOARD;
+
+     /* classify as a keyboard able to produce key events */
+     info->desc.type   = DIDTF_KEYBOARD;
+     info->desc.caps   = DICAPS_KEYS;
+
+     /* enable translation of raw hardware keycodes */
+     info->desc.min_keycode = 0;
+     info->desc.max_keycode = 127;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, keyboardEventThread, data, "Keyboard Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the kernel keymap.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     int                         code = entry->code;
+     unsigned short              value;
+     DFBInputDeviceKeyIdentifier identifier;
+
+     /* fetch the base level */
+     value = keyboard_read_value( driver_data, K_NORMTAB, code );
+
+     /* get the identifier for basic mapping */
+     identifier = keyboard_get_identifier( code, value );
+
+     /* is CapsLock effective? */
+     if (KTYP(value) == KT_LETTER)
+          entry->locks |= DILS_CAPS;
+
+     /* is NumLock effective? */
+     if (identifier >= DIKI_KP_DECIMAL && identifier <= DIKI_KP_9)
+          entry->locks |= DILS_NUM;
+
+     /* write identifier to entry */
+     entry->identifier = identifier;
+
+     /* write base level symbol to entry */
+     entry->symbols[DIKSI_BASE] = keyboard_get_symbol( code, value, DIKSI_BASE );
+
+
+     /* fetch the shifted base level */
+     value = keyboard_read_value( driver_data, K_SHIFTTAB, entry->code );
+
+     /* write shifted base level symbol to entry */
+     entry->symbols[DIKSI_BASE_SHIFT] = keyboard_get_symbol( code, value,
+                                                             DIKSI_BASE_SHIFT );
+
+
+     /* fetch the alternative level */
+     value = keyboard_read_value( driver_data, K_ALTTAB, entry->code );
+
+     /* write alternative level symbol to entry */
+     entry->symbols[DIKSI_ALT] = keyboard_get_symbol( code, value, DIKSI_ALT );
+
+
+     /* fetch the shifted alternative level */
+     value = keyboard_read_value( driver_data, K_ALTSHIFTTAB, entry->code );
+
+     /* write shifted alternative level symbol to entry */
+     entry->symbols[DIKSI_ALT_SHIFT] = keyboard_get_symbol( code, value,
+                                                            DIKSI_ALT_SHIFT );
+
+     return DFB_OK;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     KeyboardData *data = (KeyboardData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     if (tcsetattr( data->vt_fd, TCSAFLUSH, &data->old_ts ) < 0)
+          D_PERROR("DirectFB/keyboard: tcsetattr for original values failed!\n");
+
+     close( data->vt_fd );
+
+     /* free private data */
+     D_FREE( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/linux_input/Makefile.am b/Source/DirectFB/inputdrivers/linux_input/Makefile.am
new file mode 100755
index 0000000..eb4265a
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/linux_input/Makefile.am
@@ -0,0 +1,34 @@
+## Makefile.am for DirectFB/inputdrivers/linux_input
+
+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
+
+linux_input_LTLIBRARIES = libdirectfb_linux_input.la
+
+if BUILD_STATIC
+linux_input_DATA = $(linux_input_LTLIBRARIES:.la=.o)
+endif
+
+linux_inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_linux_input_la_SOURCES = \
+	input_fake.h		\
+	linux_input.c
+
+libdirectfb_linux_input_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_linux_input_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/inputdrivers/linux_input/Makefile.in b/Source/DirectFB/inputdrivers/linux_input/Makefile.in
new file mode 100755
index 0000000..8f54db6
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/linux_input/Makefile.in
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = inputdrivers/linux_input
+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)$(linux_inputdir)" \
+	"$(DESTDIR)$(linux_inputdir)"
+linux_inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(linux_input_LTLIBRARIES)
+libdirectfb_linux_input_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_linux_input_la_OBJECTS = linux_input.lo
+libdirectfb_linux_input_la_OBJECTS =  \
+	$(am_libdirectfb_linux_input_la_OBJECTS)
+libdirectfb_linux_input_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libdirectfb_linux_input_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_linux_input_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_linux_input_la_SOURCES)
+linux_inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(linux_input_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
+
+linux_input_LTLIBRARIES = libdirectfb_linux_input.la
+@BUILD_STATIC_TRUE@linux_input_DATA = $(linux_input_LTLIBRARIES:.la=.o)
+linux_inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_linux_input_la_SOURCES = \
+	input_fake.h		\
+	linux_input.c
+
+libdirectfb_linux_input_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_linux_input_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  inputdrivers/linux_input/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/linux_input/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-linux_inputLTLIBRARIES: $(linux_input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(linux_inputdir)" || $(MKDIR_P) "$(DESTDIR)$(linux_inputdir)"
+	@list='$(linux_input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(linux_inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(linux_inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(linux_inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(linux_inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-linux_inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(linux_input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(linux_inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(linux_inputdir)/$$p"; \
+	done
+
+clean-linux_inputLTLIBRARIES:
+	-test -z "$(linux_input_LTLIBRARIES)" || rm -f $(linux_input_LTLIBRARIES)
+	@list='$(linux_input_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_linux_input.la: $(libdirectfb_linux_input_la_OBJECTS) $(libdirectfb_linux_input_la_DEPENDENCIES) 
+	$(libdirectfb_linux_input_la_LINK) -rpath $(linux_inputdir) $(libdirectfb_linux_input_la_OBJECTS) $(libdirectfb_linux_input_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_input.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-linux_inputDATA: $(linux_input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(linux_inputdir)" || $(MKDIR_P) "$(DESTDIR)$(linux_inputdir)"
+	@list='$(linux_input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(linux_inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_inputdir)/$$f'"; \
+	  $(linux_inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_inputdir)/$$f"; \
+	done
+
+uninstall-linux_inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(linux_input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(linux_inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(linux_inputdir)/$$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)$(linux_inputdir)" "$(DESTDIR)$(linux_inputdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-linux_inputLTLIBRARIES \
+	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-linux_inputDATA \
+	install-linux_inputLTLIBRARIES
+
+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-linux_inputDATA \
+	uninstall-linux_inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-linux_inputLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-linux_inputDATA install-linux_inputLTLIBRARIES \
+	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-linux_inputDATA \
+	uninstall-linux_inputLTLIBRARIES
+
+%.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/inputdrivers/linux_input/input_fake.h b/Source/DirectFB/inputdrivers/linux_input/input_fake.h
new file mode 100755
index 0000000..7aecc9f
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/linux_input/input_fake.h
@@ -0,0 +1,84 @@
+#ifndef _INPUT_FAKE_H
+#define _INPUT_FAKE_H
+
+#include <linux/input.h>
+
+
+#if !defined(KEY_OK)
+
+/**
+ *  define some additional remote control keys in case they 
+ *  were not already defined above in <linux/input.h>
+ */
+
+#define KEY_OK           0x160
+#define KEY_SELECT       0x161
+#define KEY_GOTO         0x162
+#define KEY_CLEAR        0x163
+#define KEY_POWER2       0x164
+#define KEY_OPTION       0x165
+#define KEY_INFO         0x166
+#define KEY_TIME         0x167
+#define KEY_VENDOR       0x168
+#define KEY_ARCHIVE      0x169
+#define KEY_PROGRAM      0x16a
+#define KEY_CHANNEL      0x16b
+#define KEY_FAVORITES    0x16c
+#define KEY_EPG          0x16d
+#define KEY_PVR          0x16e
+#define KEY_MHP          0x16f
+#define KEY_LANGUAGE     0x170
+#define KEY_TITLE        0x171
+#define KEY_SUBTITLE     0x172
+#define KEY_ANGLE        0x173
+#define KEY_ZOOM         0x174
+#define KEY_MODE         0x175
+#define KEY_KEYBOARD     0x176
+#define KEY_SCREEN       0x177
+#define KEY_PC           0x178
+#define KEY_TV           0x179
+#define KEY_TV2          0x17a
+#define KEY_VCR          0x17b
+#define KEY_VCR2         0x17c
+#define KEY_SAT          0x17d
+#define KEY_SAT2         0x17e
+#define KEY_CD           0x17f
+#define KEY_TAPE         0x180
+#define KEY_RADIO        0x181
+#define KEY_TUNER        0x182
+#define KEY_PLAYER       0x183
+#define KEY_TEXT         0x184
+#define KEY_DVD          0x185
+#define KEY_AUX          0x186
+#define KEY_MP3          0x187
+#define KEY_AUDIO        0x188
+#define KEY_VIDEO        0x189
+#define KEY_DIRECTORY    0x18a
+#define KEY_LIST         0x18b
+#define KEY_MEMO         0x18c
+#define KEY_CALENDAR     0x18d
+#define KEY_RED          0x18e
+#define KEY_GREEN        0x18f
+#define KEY_YELLOW       0x190
+#define KEY_BLUE         0x191
+#define KEY_CHANNELUP    0x192
+#define KEY_CHANNELDOWN  0x193
+#define KEY_FIRST        0x194
+#define KEY_LAST         0x195
+#define KEY_AB           0x196
+#define KEY_PLAY         0x197
+#define KEY_RESTART      0x198
+#define KEY_SLOW         0x199
+#define KEY_SHUFFLE      0x19a
+#define KEY_FASTFORWARD  0x19b
+#define KEY_PREVIOUS     0x19c
+#define KEY_NEXT         0x19d
+#define KEY_DIGITS       0x19e
+#define KEY_TEEN         0x19f
+#define KEY_TWEN         0x1a0
+#define KEY_BREAK        0x1a1
+
+
+#endif  /* !defined(KEY_OK)  */
+#endif  /* _INPUT_FAKE_H */
+
diff --git a/Source/DirectFB/inputdrivers/linux_input/linux_input.c b/Source/DirectFB/inputdrivers/linux_input/linux_input.c
new file mode 100755
index 0000000..9294ef7
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/linux_input/linux_input.c
@@ -0,0 +1,1994 @@
+/*
+   (c) Copyright 2001-2008  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+typedef unsigned long kernel_ulong_t;
+#define BITS_PER_LONG    (sizeof(long)*8)
+#endif
+
+#include <linux/input.h>
+
+#ifndef KEY_OK
+/* Linux kernel 2.5.42+ defines additional keys in linux/input.h */
+#include "input_fake.h"
+#endif
+
+#ifndef EV_CNT
+#define EV_CNT (EV_MAX+1)
+#define KEY_CNT (KEY_MAX+1)
+#define REL_CNT (REL_MAX+1)
+#define ABS_CNT (ABS_MAX+1)
+#define LED_CNT (LED_MAX+1)
+#endif
+
+/* compat defines for older kernel like 2.4.x */
+#ifndef EV_SYN
+#define EV_SYN			0x00
+#define SYN_REPORT              0
+#define SYN_CONFIG              1
+#define ABS_TOOL_WIDTH		0x1c
+#define BTN_TOOL_DOUBLETAP	0x14d
+#define BTN_TOOL_TRIPLETAP	0x14e
+#endif
+
+#ifndef EVIOCGLED
+#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len)
+#endif
+
+#ifndef EVIOCGRAB
+#define EVIOCGRAB _IOW('E', 0x90, int)
+#endif
+
+#include <linux/keyboard.h>
+
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <dfb_types.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/kd.h>
+#include <stdlib.h>
+
+#define DFB_INPUTDRIVER_HAS_AXIS_INFO
+#define DFB_INPUTDRIVER_HAS_SENSITIVITY
+
+#include <directfb.h>
+#include <directfb_keyboard.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+#include <core/system.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#ifdef LINUX_INPUT_USE_FBDEV
+#include <fbdev/fbdev.h>
+#endif
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( linux_input )
+
+#ifndef BITS_PER_LONG
+#define BITS_PER_LONG        (sizeof(long) * 8)
+#endif
+#define NBITS(x)             ((((x)-1)/BITS_PER_LONG)+1)
+#define OFF(x)               ((x)%BITS_PER_LONG)
+#define BIT(x)               (1UL<<OFF(x))
+#define LONG(x)              ((x)/BITS_PER_LONG)
+#undef test_bit
+#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
+
+/* compat for 2.4.x kernel - just a compile fix */
+#ifndef HAVE_INPUT_ABSINFO
+struct input_absinfo {
+        s32 value;
+        s32 minimum;
+        s32 maximum;
+        s32 fuzz;
+        s32 flat;
+};
+#endif
+
+
+D_DEBUG_DOMAIN( LinuxInput_Driver, "LinuxInput/Driver", "Linux Input Driver" );
+
+
+/*
+ * Touchpads related stuff
+ */
+typedef enum {
+     TOUCHPAD_FSM_START,
+     TOUCHPAD_FSM_MAIN,
+     TOUCHPAD_FSM_DRAG_START,
+     TOUCHPAD_FSM_DRAG_MAIN,
+} TouchPadState;
+
+struct touchpad_axis {
+     int old, min, max;
+};
+
+struct touchpad_fsm_state {
+     TouchPadState fsm_state;
+
+     struct touchpad_axis x;
+     struct touchpad_axis y;
+     struct timeval timeout;
+};
+
+typedef enum {
+     EVENT_NONE     = 0x00000000,
+
+     EVENT_BUTTON   = 0x00000001,
+     EVENT_KEY      = 0x00000002,
+     EVENT_AXES     = 0x00000004,
+
+     EVENT_ALL      = 0x00000007,
+} EventFlags;
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     unsigned int             index;
+
+     CoreInputDevice         *device;
+     DirectThread            *thread;
+
+     InputDeviceInfo          info;
+
+     int                      fd;
+
+     bool                     has_leds;
+     unsigned long            led_state[NBITS(LED_CNT)];
+     DFBInputDeviceLockState  locks;
+
+#ifdef LINUX_INPUT_USE_FBDEV
+     VirtualTerminal         *vt;
+#endif
+
+     bool                      touchpad;
+     struct touchpad_fsm_state fsm_state;
+
+     struct {
+          EventFlags                added;
+
+          DFBInputEvent             button;
+          DFBInputEvent             key;
+
+          DFBInputEvent             axes[DIAI_LAST+1];
+     }                         events;
+
+     struct timeval            timeout;
+
+     int                       sensitivity;
+} LinuxInputData;
+
+
+typedef struct {
+     char            *device;
+     InputDeviceInfo  info;
+     LinuxInputData  *data;
+} InputDevice;
+
+
+static bool check_device( const char      *device,
+                          InputDeviceInfo *ret_info );
+
+
+#define MAX_LINUX_INPUT_DEVICES 16
+
+static int         num_devices = 0;
+static InputDevice devices[MAX_LINUX_INPUT_DEVICES];
+
+
+static const
+int basic_keycodes [] = {
+     DIKI_UNKNOWN, DIKI_ESCAPE, DIKI_1, DIKI_2, DIKI_3, DIKI_4, DIKI_5,
+     DIKI_6, DIKI_7, DIKI_8, DIKI_9, DIKI_0, DIKI_MINUS_SIGN,
+     DIKI_EQUALS_SIGN, DIKI_BACKSPACE,
+
+     DIKI_TAB, DIKI_Q, DIKI_W, DIKI_E, DIKI_R, DIKI_T, DIKI_Y, DIKI_U,
+     DIKI_I, DIKI_O, DIKI_P, DIKI_BRACKET_LEFT, DIKI_BRACKET_RIGHT,
+     DIKI_ENTER,
+
+     DIKI_CONTROL_L, DIKI_A, DIKI_S, DIKI_D, DIKI_F, DIKI_G, DIKI_H, DIKI_J,
+     DIKI_K, DIKI_L, DIKI_SEMICOLON, DIKI_QUOTE_RIGHT, DIKI_QUOTE_LEFT,
+
+     DIKI_SHIFT_L, DIKI_BACKSLASH, DIKI_Z, DIKI_X, DIKI_C, DIKI_V, DIKI_B,
+     DIKI_N, DIKI_M, DIKI_COMMA, DIKI_PERIOD, DIKI_SLASH, DIKI_SHIFT_R,
+     DIKI_KP_MULT, DIKI_ALT_L, DIKI_SPACE, DIKI_CAPS_LOCK,
+
+     DIKI_F1, DIKI_F2, DIKI_F3, DIKI_F4, DIKI_F5, DIKI_F6, DIKI_F7, DIKI_F8,
+     DIKI_F9, DIKI_F10, DIKI_NUM_LOCK, DIKI_SCROLL_LOCK,
+
+     DIKI_KP_7, DIKI_KP_8, DIKI_KP_9, DIKI_KP_MINUS,
+     DIKI_KP_4, DIKI_KP_5, DIKI_KP_6, DIKI_KP_PLUS,
+     DIKI_KP_1, DIKI_KP_2, DIKI_KP_3, DIKI_KP_0, DIKI_KP_DECIMAL,
+
+     /*KEY_103RD,*/ DIKI_BACKSLASH,
+     /*KEY_F13,*/ DFB_FUNCTION_KEY(13),
+     /*KEY_102ND*/ DIKI_LESS_SIGN,
+
+     DIKI_F11, DIKI_F12, DIKI_PRINT, DFB_FUNCTION_KEY(15),
+     DFB_FUNCTION_KEY(16), DFB_FUNCTION_KEY(17), DFB_FUNCTION_KEY(18),
+     DFB_FUNCTION_KEY(19), DFB_FUNCTION_KEY(20),
+
+     DIKI_KP_ENTER, DIKI_CONTROL_R, DIKI_KP_DIV, DIKI_PRINT, DIKS_ALTGR,
+
+     /*KEY_LINEFEED*/ DIKI_UNKNOWN,
+
+     DIKI_HOME, DIKI_UP, DIKI_PAGE_UP, DIKI_LEFT, DIKI_RIGHT,
+     DIKI_END, DIKI_DOWN, DIKI_PAGE_DOWN, DIKI_INSERT, DIKI_DELETE,
+
+     /*KEY_MACRO,*/ DIKI_UNKNOWN,
+
+     DIKS_MUTE, DIKS_VOLUME_DOWN, DIKS_VOLUME_UP, DIKS_POWER, DIKI_KP_EQUAL,
+
+     /*KEY_KPPLUSMINUS,*/ DIKI_UNKNOWN,
+
+     DIKS_PAUSE, DFB_FUNCTION_KEY(21), DFB_FUNCTION_KEY(22),
+     DFB_FUNCTION_KEY(23), DFB_FUNCTION_KEY(24),
+
+     DIKI_KP_SEPARATOR, DIKI_META_L, DIKI_META_R, DIKI_SUPER_L,
+
+     DIKS_STOP,
+
+     /*DIKS_AGAIN, DIKS_PROPS, DIKS_UNDO, DIKS_FRONT, DIKS_COPY,
+     DIKS_OPEN, DIKS_PASTE, DIKS_FIND, DIKS_CUT,*/
+     DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN,
+     DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     DIKS_HELP, DIKS_MENU, DIKS_CALCULATOR, DIKS_SETUP,
+
+     /*KEY_SLEEP, KEY_WAKEUP, KEY_FILE, KEY_SENDFILE, KEY_DELETEFILE,
+     KEY_XFER,*/
+     DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN,
+     DIKI_UNKNOWN,
+
+     /*KEY_PROG1, KEY_PROG2,*/
+     DIKS_CUSTOM1, DIKS_CUSTOM2,
+
+     DIKS_INTERNET,
+
+     /*KEY_MSDOS, KEY_COFFEE, KEY_DIRECTION, KEY_CYCLEWINDOWS,*/
+     DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     DIKS_MAIL,
+
+     /*KEY_BOOKMARKS, KEY_COMPUTER, */
+     DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     DIKS_BACK, DIKS_FORWARD,
+
+     /*KEY_CLOSECD, KEY_EJECTCD, KEY_EJECTCLOSECD,*/
+     DIKS_EJECT, DIKS_EJECT, DIKS_EJECT,
+
+     DIKS_NEXT, DIKS_PLAYPAUSE, DIKS_PREVIOUS, DIKS_STOP, DIKS_RECORD,
+     DIKS_REWIND, DIKS_PHONE,
+
+     /*KEY_ISO,*/ DIKI_UNKNOWN,
+     /*KEY_CONFIG,*/ DIKS_SETUP,
+     /*KEY_HOMEPAGE, KEY_REFRESH,*/ DIKI_UNKNOWN, DIKS_SHUFFLE,
+
+     DIKS_EXIT, /*KEY_MOVE,*/ DIKI_UNKNOWN, DIKS_EDITOR,
+
+     /*KEY_SCROLLUP,*/ DIKS_PAGE_UP,
+     /*KEY_SCROLLDOWN,*/ DIKS_PAGE_DOWN,
+     /*KEY_KPLEFTPAREN,*/ DIKI_UNKNOWN,
+     /*KEY_KPRIGHTPAREN,*/ DIKI_UNKNOWN,
+
+     /* unused codes 181-182: */
+     DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     DFB_FUNCTION_KEY(13), DFB_FUNCTION_KEY(14), DFB_FUNCTION_KEY(15),
+     DFB_FUNCTION_KEY(16), DFB_FUNCTION_KEY(17), DFB_FUNCTION_KEY(18),
+     DFB_FUNCTION_KEY(19), DFB_FUNCTION_KEY(20), DFB_FUNCTION_KEY(21),
+     DFB_FUNCTION_KEY(22), DFB_FUNCTION_KEY(23), DFB_FUNCTION_KEY(24),
+
+     /* unused codes 195-199: */
+     DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     /* KEY_PLAYCD, KEY_PAUSECD */
+     DIKS_PLAY, DIKS_PAUSE,
+
+     /*KEY_PROG3, KEY_PROG4,*/
+     DIKS_CUSTOM3, DIKS_CUSTOM4,
+
+     DIKI_UNKNOWN,
+
+     /*KEY_SUSPEND, KEY_CLOSE*/
+     DIKI_UNKNOWN, DIKI_UNKNOWN,
+
+     /* KEY_PLAY */
+     DIKS_PLAY,
+
+     /* KEY_FASTFORWARD */
+     DIKS_FASTFORWARD,
+
+     /* KEY_BASSBOOST */
+     DIKI_UNKNOWN,
+
+     /* KEY_PRINT */
+     DIKS_PRINT,
+
+     /* KEY_HP             */  DIKI_UNKNOWN,
+     /* KEY_CAMERA         */  DIKI_UNKNOWN,
+     /* KEY_SOUND          */  DIKS_AUDIO,
+     /* KEY_QUESTION       */  DIKS_HELP,
+     /* KEY_EMAIL          */  DIKS_MAIL,
+     /* KEY_CHAT           */  DIKI_UNKNOWN,
+     /* KEY_SEARCH         */  DIKI_UNKNOWN,
+     /* KEY_CONNECT        */  DIKI_UNKNOWN,
+     /* KEY_FINANCE        */  DIKI_UNKNOWN,
+     /* KEY_SPORT          */  DIKI_UNKNOWN,
+     /* KEY_SHOP           */  DIKI_UNKNOWN,
+     /* KEY_ALTERASE       */  DIKI_UNKNOWN,
+     /* KEY_CANCEL         */  DIKS_CANCEL,
+     /* KEY_BRIGHTNESSDOWN */  DIKI_UNKNOWN,
+     /* KEY_BRIGHTNESSUP   */  DIKI_UNKNOWN,
+     /* KEY_MEDIA          */  DIKI_UNKNOWN,
+};
+
+static const
+int ext_keycodes [] = {
+     DIKS_OK, DIKS_SELECT, DIKS_GOTO, DIKS_CLEAR, DIKS_POWER2, DIKS_OPTION,
+     DIKS_INFO, DIKS_TIME, DIKS_VENDOR, DIKS_ARCHIVE, DIKS_PROGRAM,
+     DIKS_CHANNEL, DIKS_FAVORITES, DIKS_EPG, DIKS_PVR, DIKS_MHP,
+     DIKS_LANGUAGE, DIKS_TITLE, DIKS_SUBTITLE, DIKS_ANGLE, DIKS_ZOOM,
+     DIKS_MODE, DIKS_KEYBOARD, DIKS_SCREEN, DIKS_PC, DIKS_TV, DIKS_TV2,
+     DIKS_VCR, DIKS_VCR2, DIKS_SAT, DIKS_SAT2, DIKS_CD, DIKS_TAPE,
+     DIKS_RADIO, DIKS_TUNER, DIKS_PLAYER, DIKS_TEXT, DIKS_DVD, DIKS_AUX,
+     DIKS_MP3, DIKS_AUDIO, DIKS_VIDEO, DIKS_DIRECTORY, DIKS_LIST, DIKS_MEMO,
+     DIKS_CALENDAR, DIKS_RED, DIKS_GREEN, DIKS_YELLOW, DIKS_BLUE,
+     DIKS_CHANNEL_UP, DIKS_CHANNEL_DOWN, DIKS_FIRST, DIKS_LAST, DIKS_AB,
+     DIKS_NEXT, DIKS_RESTART, DIKS_SLOW, DIKS_SHUFFLE, DIKS_FASTFORWARD,
+     DIKS_PREVIOUS, DIKS_NEXT, DIKS_DIGITS, DIKS_TEEN, DIKS_TWEN, DIKS_BREAK
+};
+
+/**********************************************************************************************************************/
+
+static void touchpad_fsm_init( struct touchpad_fsm_state *state );
+static int  touchpad_fsm( struct touchpad_fsm_state *state,
+                          const struct input_event  *levt,
+                          DFBInputEvent             *devt );
+
+/**********************************************************************************************************************/
+
+static bool timeout_passed( const struct timeval *timeout, const struct timeval *current );
+static bool timeout_is_set( const struct timeval *timeout );
+static void timeout_add( struct timeval *timeout, const struct timeval *sub );
+static void timeout_sub( struct timeval *timeout, const struct timeval *sub );
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+/*
+ * Translates a Linux input keycode into a DirectFB keycode.
+ */
+static int
+translate_key( unsigned short code )
+{
+     if (code < D_ARRAY_SIZE( basic_keycodes ))
+          return basic_keycodes[code];
+
+     if (code >= KEY_OK)
+          if (code - KEY_OK < D_ARRAY_SIZE( ext_keycodes ))
+               return ext_keycodes[code-KEY_OK];
+
+     return DIKI_UNKNOWN;
+}
+
+#ifdef LINUX_INPUT_USE_FBDEV
+static DFBInputDeviceKeySymbol
+keyboard_get_symbol( int                             code,
+                     unsigned short                  value,
+                     DFBInputDeviceKeymapSymbolIndex level )
+{
+     unsigned char type  = KTYP(value);
+     unsigned char index = KVAL(value);
+     int           base  = (level == DIKSI_BASE);
+
+     switch (type) {
+          case KT_FN:
+               if (index < 20)
+                    return DFB_FUNCTION_KEY( index + 1 );
+               break;
+          case KT_LETTER:
+          case KT_LATIN:
+               switch (index) {
+                    case 0x1c:
+                         return DIKS_PRINT;
+                    case 0x7f:
+                         return DIKS_BACKSPACE;
+                    case 0xa4:
+                         return 0x20ac; /* euro currency sign */
+                    default:
+                         return index;
+               }
+               break;
+          case KT_DEAD:
+               switch (value) {
+                    case K_DGRAVE:
+                         return DIKS_DEAD_GRAVE;
+
+                    case K_DACUTE:
+                         return DIKS_DEAD_ACUTE;
+
+                    case K_DCIRCM:
+                         return DIKS_DEAD_CIRCUMFLEX;
+
+                    case K_DTILDE:
+                         return DIKS_DEAD_TILDE;
+
+                    case K_DDIERE:
+                         return DIKS_DEAD_DIAERESIS;
+
+                    case K_DCEDIL:
+                         return DIKS_DEAD_CEDILLA;
+
+                    default:
+                         break;
+               }
+               break;
+          case KT_PAD:
+               if (index <= 9 && level != DIKSI_BASE)
+                    return DIKS_0 + index;
+               break;
+          case 0xe: /* special IPAQ H3600 case - AH */
+               switch (index) {
+                    case 0x20:     return DIKS_CALENDAR;
+                    case 0x1a:     return DIKS_BACK;
+                    case 0x1c:     return DIKS_MEMO;
+                    case 0x21:     return DIKS_POWER;
+               }
+               break;
+          case 0xd: /* another special IPAQ H3600 case - AH */
+               switch (index) {
+                    case 0x2:     return DIKS_DIRECTORY;
+                    case 0x1:     return DIKS_MAIL;  /* Q on older iPaqs */
+               }
+               break;
+     }
+
+     switch (value) {
+          case K_LEFT:    return DIKS_CURSOR_LEFT;
+          case K_RIGHT:   return DIKS_CURSOR_RIGHT;
+          case K_UP:      return DIKS_CURSOR_UP;
+          case K_DOWN:    return DIKS_CURSOR_DOWN;
+          case K_ENTER:   return DIKS_ENTER;
+          case K_CTRL:    return DIKS_CONTROL;
+          case K_SHIFT:   return DIKS_SHIFT;
+          case K_ALT:     return DIKS_ALT;
+          case K_ALTGR:   return DIKS_ALTGR;
+          case K_INSERT:  return DIKS_INSERT;
+          case K_REMOVE:  return DIKS_DELETE;
+          case K_FIND:    return DIKS_HOME;
+          case K_SELECT:  return DIKS_END;
+          case K_PGUP:    return DIKS_PAGE_UP;
+          case K_PGDN:    return DIKS_PAGE_DOWN;
+          case K_NUM:     return DIKS_NUM_LOCK;
+          case K_HOLD:    return DIKS_SCROLL_LOCK;
+          case K_PAUSE:   return DIKS_PAUSE;
+          case K_BREAK:   return DIKS_BREAK;
+          case K_CAPS:    return DIKS_CAPS_LOCK;
+
+          case K_P0:      return DIKS_INSERT;
+          case K_P1:      return DIKS_END;
+          case K_P2:      return DIKS_CURSOR_DOWN;
+          case K_P3:      return DIKS_PAGE_DOWN;
+          case K_P4:      return DIKS_CURSOR_LEFT;
+          case K_P5:      return DIKS_BEGIN;
+          case K_P6:      return DIKS_CURSOR_RIGHT;
+          case K_P7:      return DIKS_HOME;
+          case K_P8:      return DIKS_CURSOR_UP;
+          case K_P9:      return DIKS_PAGE_UP;
+          case K_PPLUS:   return DIKS_PLUS_SIGN;
+          case K_PMINUS:  return DIKS_MINUS_SIGN;
+          case K_PSTAR:   return DIKS_ASTERISK;
+          case K_PSLASH:  return DIKS_SLASH;
+          case K_PENTER:  return DIKS_ENTER;
+          case K_PCOMMA:  return base ? DIKS_DELETE : DIKS_COMMA;
+          case K_PDOT:    return base ? DIKS_DELETE : DIKS_PERIOD;
+          case K_PPARENL: return DIKS_PARENTHESIS_LEFT;
+          case K_PPARENR: return DIKS_PARENTHESIS_RIGHT;
+     }
+
+     /* special keys not in the map, hack? */
+     if (code == 99)
+          return DIKS_PRINT;
+
+     if (code == 124)         /* keypad equal key */
+          return DIKS_EQUALS_SIGN;
+
+     if (code == 125)         /* left windows key */
+          return DIKS_META;
+
+     if (code == 126)         /* right windows key */
+          return DIKS_META;
+
+     if (code == 127)         /* context menu key */
+          return DIKS_SUPER;
+
+     return DIKS_NULL;
+}
+
+static DFBInputDeviceKeyIdentifier
+keyboard_get_identifier( int code, unsigned short value )
+{
+     unsigned char type  = KTYP(value);
+     unsigned char index = KVAL(value);
+
+     if (type == KT_PAD) {
+          if (index <= 9)
+               return DIKI_KP_0 + index;
+
+          switch (value) {
+               case K_PSLASH: return DIKI_KP_DIV;
+               case K_PSTAR:  return DIKI_KP_MULT;
+               case K_PMINUS: return DIKI_KP_MINUS;
+               case K_PPLUS:  return DIKI_KP_PLUS;
+               case K_PENTER: return DIKI_KP_ENTER;
+               case K_PCOMMA:
+               case K_PDOT:   return DIKI_KP_DECIMAL;
+          }
+     }
+
+     /* Looks like a hack, but don't know a better way yet. */
+     switch (code) {
+          case 12: return DIKI_MINUS_SIGN;
+          case 13: return DIKI_EQUALS_SIGN;
+          case 26: return DIKI_BRACKET_LEFT;
+          case 27: return DIKI_BRACKET_RIGHT;
+          case 39: return DIKI_SEMICOLON;
+          case 40: return DIKI_QUOTE_RIGHT;
+          case 41: return DIKI_QUOTE_LEFT;
+          case 43: return DIKI_BACKSLASH;
+          case 51: return DIKI_COMMA;
+          case 52: return DIKI_PERIOD;
+          case 53: return DIKI_SLASH;
+          case 54: return DIKI_SHIFT_R;
+          case 97: return DIKI_CONTROL_R;
+          case 100: return DIKI_ALT_R;
+          default:
+               ;
+     }
+
+     /* special keys not in the map, hack? */
+     if (code == 124)         /* keypad equal key */
+          return DIKI_KP_EQUAL;
+
+     if (code == 125)         /* left windows key */
+          return DIKI_META_L;
+
+     if (code == 126)         /* right windows key */
+          return DIKI_META_R;
+
+     if (code == 127)         /* context menu key */
+          return DIKI_SUPER_R;
+
+     return DIKI_UNKNOWN;
+}
+
+static unsigned short
+keyboard_read_value( const LinuxInputData *data,
+                     unsigned char table, unsigned char index )
+{
+     struct kbentry entry;
+
+     if (!data->vt)
+          return 0;
+
+     entry.kb_table = table;
+     entry.kb_index = index;
+     entry.kb_value = 0;
+
+     if (ioctl( data->vt->fd, KDGKBENT, &entry )) {
+          D_PERROR("DirectFB/keyboard: KDGKBENT (table: %d, index: %d) "
+                    "failed!\n", table, index);
+          return 0;
+     }
+
+     return entry.kb_value;
+}
+#endif /* LINUX_INPUT_USE_FBDEV */
+
+/**********************************************************************************************************************/
+
+/*
+ * Translates key and button events.
+ */
+static bool
+key_event( const struct input_event *levt,
+           DFBInputEvent            *devt )
+{
+     int code = levt->code;
+
+     /* map touchscreen and smartpad events to button mouse */
+     if (code == BTN_TOUCH || code == BTN_TOOL_FINGER)
+          code = BTN_MOUSE;
+
+     if ((code >= BTN_MOUSE && code < BTN_JOYSTICK) || code == BTN_TOUCH) {
+          /* ignore repeat events for buttons */
+          if (levt->value == 2)
+               return false;
+
+          devt->type   = levt->value ? DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+          /* don't set DIEF_BUTTONS, it will be set by the input core */
+          devt->button = DIBI_FIRST + code - BTN_MOUSE;
+     }
+     else {
+          int key = translate_key( code );
+
+          if (key == DIKI_UNKNOWN)
+               return false;
+
+          devt->type = levt->value ? DIET_KEYPRESS : DIET_KEYRELEASE;
+
+          if (DFB_KEY_TYPE(key) == DIKT_IDENTIFIER) {
+               devt->key_id = key;
+               devt->flags |= DIEF_KEYID;
+          }
+          else {
+               devt->key_symbol = key;
+               devt->flags |= DIEF_KEYSYMBOL;
+          }
+
+          devt->flags |= DIEF_KEYCODE;
+          devt->key_code = code;
+     }
+
+     if (levt->value == 2)
+          devt->flags |= DIEF_REPEAT;
+
+     return true;
+}
+
+/*
+ * Translates relative axis events.
+ */
+static bool
+rel_event( const LinuxInputData     *data,
+           const struct input_event *levt,
+           DFBInputEvent            *devt )
+{
+     switch (levt->code) {
+          case REL_X:
+               devt->axis = DIAI_X;
+               devt->axisrel = levt->value * data->sensitivity;
+               break;
+
+          case REL_Y:
+               devt->axis = DIAI_Y;
+               devt->axisrel = levt->value * data->sensitivity;
+               break;
+
+          case REL_Z:
+          case REL_WHEEL:
+               devt->axis = DIAI_Z;
+               devt->axisrel = -levt->value * data->sensitivity;
+               break;
+
+          default:
+               if (levt->code > REL_MAX || levt->code > DIAI_LAST)
+                    return false;
+               devt->axis = levt->code;
+               devt->axisrel = levt->value * data->sensitivity;
+     }
+
+     devt->type    = DIET_AXISMOTION;
+     devt->flags  |= DIEF_AXISREL;
+
+     return true;
+}
+
+/*
+ * Translates absolute axis events.
+ */
+static bool
+abs_event( const struct input_event *levt,
+           DFBInputEvent            *devt )
+{
+     switch (levt->code) {
+          case ABS_X:
+               devt->axis = DIAI_X;
+               break;
+
+          case ABS_Y:
+               devt->axis = DIAI_Y;
+               break;
+
+          case ABS_Z:
+          case ABS_WHEEL:
+               devt->axis = DIAI_Z;
+               break;
+
+          default:
+               if (levt->code >= ABS_PRESSURE || levt->code > DIAI_LAST)
+                    return false;
+               devt->axis = levt->code;
+     }
+
+     devt->type    = DIET_AXISMOTION;
+     devt->flags  |= DIEF_AXISABS;
+     devt->axisabs = levt->value;
+
+     return true;
+}
+
+/*
+ * Translates a Linux input event into a DirectFB input event.
+ */
+static bool
+translate_event( const LinuxInputData     *data,
+                 const struct input_event *levt,
+                 DFBInputEvent            *devt )
+{
+     devt->flags     = DIEF_TIMESTAMP;
+     devt->timestamp = levt->time;
+
+     switch (levt->type) {
+          case EV_KEY:
+               return key_event( levt, devt );
+
+          case EV_REL:
+               return rel_event( data, levt, devt );
+
+          case EV_ABS:
+               return abs_event( levt, devt );
+
+          default:
+               ;
+     }
+
+     return false;
+}
+
+static void
+set_led( const LinuxInputData *data, int led, int state )
+{
+     struct input_event levt;
+
+     levt.type = EV_LED;
+     levt.code = led;
+     levt.value = !!state;
+
+     write( data->fd, &levt, sizeof(levt) );
+}
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+static void
+LinuxInput_Initialize( LinuxInputData *data )
+{
+     /* Query min/max coordinates. */
+     if (data->touchpad) {
+          struct input_absinfo absinfo;
+
+          touchpad_fsm_init( &data->fsm_state );
+
+          ioctl( data->fd, EVIOCGABS(ABS_X), &absinfo );
+          data->fsm_state.x.min = absinfo.minimum;
+          data->fsm_state.x.max = absinfo.maximum;
+
+          ioctl( data->fd, EVIOCGABS(ABS_Y), &absinfo );
+          data->fsm_state.y.min = absinfo.minimum;
+          data->fsm_state.y.max = absinfo.maximum;
+     }
+}
+
+static void
+LinuxInput_FlushEvents( LinuxInputData *data )
+{
+     int            i;
+     int            num = 0;
+     DFBInputEvent *events[DIAI_LAST+1+2];
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %p )\n", __FUNCTION__, data );
+
+     /* Flush axis events first */
+     if (data->events.added & EVENT_AXES) {
+          for (i=0; i<D_ARRAY_SIZE(data->events.axes); i++) {
+               if (data->events.axes[i].type)
+                    events[num++] = &data->events.axes[i];
+          }
+     }
+
+     /* Flush button */
+     if (data->events.added & EVENT_BUTTON) {
+          events[num++] = &data->events.button;
+     }
+
+     /* Flush key */
+     if (data->events.added & EVENT_KEY) {
+          events[num++] = &data->events.key;
+     }
+
+     /* Clear event mask */
+     data->events.added = EVENT_NONE;
+
+     /*
+      * Dispatch all events
+      */
+     for (i=0; i<num; i++) {
+          /* Add DIEF_FOLLOW to all but last event */
+          if (i < num-1)
+               events[i]->flags |= DIEF_FOLLOW;
+
+          dfb_input_dispatch( data->device, events[i] );
+
+          if (data->has_leds && (events[i]->locks != data->locks)) {
+               set_led( data, LED_SCROLLL, events[i]->locks & DILS_SCROLL );
+               set_led( data, LED_NUML,    events[i]->locks & DILS_NUM );
+               set_led( data, LED_CAPSL,   events[i]->locks & DILS_CAPS );
+
+               data->locks = events[i]->locks;
+          }
+
+          events[i]->type  = DIET_UNKNOWN;
+          events[i]->flags = DIEF_NONE;
+     }
+}
+
+static void
+LinuxInput_AddEvent( LinuxInputData *data,
+                     DFBInputEvent  *event )
+{
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %p, %p )\n", __FUNCTION__, data, event );
+     D_DEBUG_AT( LinuxInput_Driver, " =-> type %d, flags 0x%04x\n", event->type, event->flags );
+
+     if (!data->events.added && dfb_config->max_axis_rate) {
+          struct timeval time;
+
+          gettimeofday( &time, NULL );
+
+          data->timeout.tv_sec  = 0;
+          data->timeout.tv_usec = 1000000 / dfb_config->max_axis_rate;
+
+          timeout_add( &data->timeout, &time );
+     }
+
+     switch (event->type) {
+          case DIET_BUTTONPRESS:
+          case DIET_BUTTONRELEASE:
+               if (data->events.button.type) {
+                    D_BUG( "previous button event not flushed" );
+                    LinuxInput_FlushEvents( data );
+               }
+
+               data->events.added  |= EVENT_BUTTON;
+               data->events.button  = *event;
+               break;
+
+          case DIET_KEYPRESS:
+          case DIET_KEYRELEASE:
+               if (data->events.key.type) {
+                    D_BUG( "previous key event not flushed" );
+                    LinuxInput_FlushEvents( data );
+               }
+
+               data->events.added |= EVENT_KEY;
+               data->events.key    = *event;
+               break;
+
+          case DIET_AXISMOTION:
+               if (event->axis < DIAI_FIRST || event->axis > DIAI_LAST) {
+                    D_BUG( "axis %d out of range", event->axis );
+                    return;
+               }
+
+               if (data->events.axes[event->axis].type) {
+                    if (dfb_config->mouse_motion_compression || dfb_config->max_axis_rate) {
+                         if (D_FLAGS_IS_SET( event->flags, DIEF_AXISREL )) {
+                              if (D_FLAGS_IS_SET( data->events.axes[event->axis].flags, DIEF_AXISREL ))
+                                   event->axisrel += data->events.axes[event->axis].axisrel;
+                              else
+                                   D_WARN( "previous axis event with different abs/rel flag" );
+                         }
+                         else {
+                              if (D_FLAGS_IS_SET( data->events.axes[event->axis].flags, DIEF_AXISREL ))
+                                   D_WARN( "previous axis event with different abs/rel flag" );
+                         }
+                    }
+                    else {
+                         D_BUG( "previous axis event not flushed" );
+                         LinuxInput_FlushEvents( data );
+                    }
+               }
+
+               data->events.added             |= EVENT_AXES;
+               data->events.axes[event->axis]  = *event;
+               break;
+
+          default:
+               D_ONCE( "unknown event type %d", event->type );
+     }
+}
+
+static void
+LinuxInput_HandleEvent( LinuxInputData           *data,
+                        const struct input_event *levt )
+{
+     int           status = -1;
+     DFBInputEvent temp   = { .type = DIET_UNKNOWN };
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %p, %p )\n", __FUNCTION__, data, levt );
+     D_DEBUG_AT( LinuxInput_Driver, " =-> 0x%02x 0x%03x\n", levt->type, levt->code );
+
+     if (levt->type == EV_SYN && levt->code == SYN_REPORT) {
+          /* With mouse motion compression wait as long as only axis events are added */
+          if ((dfb_config->mouse_motion_compression || dfb_config->max_axis_rate) && data->events.added == EVENT_AXES)
+               return;
+
+          LinuxInput_FlushEvents( data );
+
+          return;
+     }
+
+     if (data->touchpad) {
+          status = touchpad_fsm( &data->fsm_state, levt, &temp );
+          if (!status)
+               /* Handled but no further processing is necessary. */
+               return;
+     }
+
+     if (status < 0) {
+          /* Not handled. Try the direct approach. */
+          if (!translate_event( data, levt, &temp ))
+               return;
+     }
+
+     D_ASSERT( temp.type != DIET_UNKNOWN );
+
+     LinuxInput_AddEvent( data, &temp );
+}
+
+static void
+LinuxInput_HandleTimeout( LinuxInputData *data )
+{
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %p )\n", __FUNCTION__, data );
+
+     if (data->touchpad) {
+          DFBInputEvent event;
+
+          if (touchpad_fsm( &data->fsm_state, NULL, &event ) > 0)
+               dfb_input_dispatch( data->device, &event );
+     }
+
+     LinuxInput_FlushEvents( data );
+}
+
+static DFBResult
+LinuxInput_GetTimeout( LinuxInputData *data,
+                       struct timeval *ret_timeout )
+{
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %p )\n", __FUNCTION__, data );
+
+     if (data->events.added && dfb_config->max_axis_rate) {
+          *ret_timeout = data->timeout;
+
+          return DFB_OK;
+     }
+
+     if (data->touchpad && timeout_is_set( &data->fsm_state.timeout )) {
+          *ret_timeout = data->fsm_state.timeout;
+
+          return DFB_OK;
+     }
+
+     return DFB_TEMPUNAVAIL;
+}
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+static void
+LinuxInput_CloseDevice( LinuxInputData *data )
+{
+     int fd = data->fd;
+
+     D_INFO( "LinuxInput: Disconnected '%s'\n", data->info.desc.name );
+
+     dfb_input_device_disconnected( data->device );
+
+     data->fd = -1;
+
+     close( fd );
+}
+
+static void
+LinuxInput_ProbeDevice( const char *device )
+{
+     DFBResult       ret;
+     int             i, fd;
+     InputDeviceInfo info;
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %s )\n", __FUNCTION__, device );
+
+     for (i=0; i<num_devices; i++) {
+          if (!strcmp( devices[i].device, device )) {
+               if (devices[i].data && devices[i].data->fd != -1)
+                    return;
+
+               break;
+          }
+     }
+
+     if (!check_device( device, &info ))
+          return;
+
+     for (i=0; i<num_devices; i++) {
+          if (!memcmp( &info, &devices[i].info, sizeof(InputDeviceInfo) )) {
+               if (devices[i].data && devices[i].data->fd == -1) {
+                    D_INFO( "LinuxInput: Reconnected '%s'\n", info.desc.name );
+
+                    dfb_input_device_reconnected( devices[i].data->device );
+
+                    /* reopen device */
+                    fd = open( device, O_RDWR );
+                    if (fd < 0) {
+                         D_PERROR( "DirectFB/linux_input: could not reopen device" );
+                         return;
+                    }
+
+                    /* grab device */
+                    if (dfb_config->linux_input_grab) {
+                         ret = ioctl( fd, EVIOCGRAB, 1 );
+                         /* 2.4 kernels don't have EVIOCGRAB so ignore EINVAL */
+                         if (ret && errno != EINVAL) {
+                              D_PERROR( "DirectFB/linux_input: could not grab device" );
+                              close( fd );
+                              return;
+                         }
+                    }
+
+                    devices[i].data->fd = fd;
+
+                    D_FREE( devices[i].device );
+
+                    devices[i].device = D_STRDUP( device );
+               }
+
+               return;
+          }
+     }
+
+     D_INFO( "LinuxInput: Added '%s'\n", info.desc.name );
+
+     devices[num_devices].device = D_STRDUP( device );
+     devices[num_devices].info   = info;
+
+     num_devices++;
+}
+
+static void
+LinuxInput_UpdateDevices()
+{
+     int i;
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s()\n", __FUNCTION__ );
+
+     /* Use the devices specified in the configuration. */
+     if (fusion_vector_has_elements( &dfb_config->linux_input_devices )) {
+          const char *device;
+
+          fusion_vector_foreach (device, i, dfb_config->linux_input_devices) {
+               if (num_devices >= MAX_LINUX_INPUT_DEVICES)
+                    break;
+
+               LinuxInput_ProbeDevice( device );
+          }
+     }
+     else {
+          char *tsdev;
+
+          /* Check for tslib device being used. */
+          tsdev = getenv( "TSLIB_TSDEVICE" );
+
+          /* No devices specified. Try to guess some. */
+          for (i=0; i<MAX_LINUX_INPUT_DEVICES; i++) {
+               char buf[32];
+
+               snprintf( buf, 32, "/dev/input/event%d", i );
+
+               /* Let tslib driver handle its device. */
+               if (tsdev && !strcmp( tsdev, buf ))
+                    continue;
+
+               LinuxInput_ProbeDevice( buf );
+          }
+     }
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+linux_input_EventThread( DirectThread *thread, void *driver_data )
+{
+     DFBResult       ret;
+     LinuxInputData *data = (LinuxInputData*) driver_data;
+
+     LinuxInput_Initialize( data );
+
+     while (true) {
+          int            status;
+          fd_set         set;
+          struct timeval timeout;
+          bool           handle = false;
+
+          if (data->fd < 0) {
+               usleep( 100000 );
+
+               if (data->index == 0)
+                    LinuxInput_UpdateDevices();
+
+               continue;
+          }
+
+          FD_ZERO( &set );
+          FD_SET( data->fd, &set );
+
+          ret = LinuxInput_GetTimeout( data, &timeout );
+          switch (ret) {
+               case DFB_TEMPUNAVAIL:
+                    timeout.tv_sec  = 0;
+                    timeout.tv_usec = 2000000;
+
+                    status = select( data->fd + 1, &set, NULL, NULL, &timeout );
+                    break;
+
+               case DFB_OK: {
+                    struct timeval time;
+
+                    handle = true;
+
+                    gettimeofday( &time, NULL );
+
+                    if (!timeout_passed( &timeout, &time )) {
+                         timeout_sub( &timeout, &time );
+
+                         status = select( data->fd + 1, &set, NULL, NULL, &timeout );
+                         break;
+                    }
+               }
+
+               default:
+                    status = 0;
+                    break;
+          }
+
+          /* timeout? */
+          if (status == 0) {
+               if (handle)
+                    LinuxInput_HandleTimeout( data );
+
+               if (data->index == 0)
+                    LinuxInput_UpdateDevices();
+
+               continue;
+          }
+
+          if (status < 0) {
+               direct_thread_testcancel( thread );
+
+               if (errno != EINTR)
+                    break;
+          }
+          else if (FD_ISSET( data->fd, &set )) {
+               int                i;
+               int                readlen;
+               struct input_event levt[64];
+
+               readlen = read( data->fd, levt, sizeof(levt) );
+               if (readlen < 0) {
+                    direct_thread_testcancel( thread );
+
+                    if (errno != EINTR) {
+                         if (errno != ENODEV)
+                              D_PERROR( "LinuxInput: Error during read()!\n" );
+
+                         LinuxInput_CloseDevice( data );
+                    }
+               }
+               else if (readlen > 0) {
+                    D_DEBUG_AT( LinuxInput_Driver, "%s( '%s' )\n", __FUNCTION__, data->info.desc.name );
+
+                    for (i=0; i<readlen / sizeof(levt[0]); i++)
+                         LinuxInput_HandleEvent( data, &levt[i] );
+               }
+               else
+                    LinuxInput_CloseDevice( data );
+          }
+
+          /* Handle mouse motion compression, though this might break the SYN_REPORT semantics */
+          if (dfb_config->mouse_motion_compression && data->events.added && !dfb_config->max_axis_rate)
+               LinuxInput_FlushEvents( data );
+     }
+
+     D_PERROR( "linux_input thread died\n" );
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Fill device information.
+ * Queries the input device and tries to classify it.
+ */
+static void
+get_device_info( int              fd,
+                 InputDeviceInfo *info,
+                 bool            *touchpad )
+{
+     unsigned int  num_keys     = 0;
+     unsigned int  num_ext_keys = 0;
+     unsigned int  num_buttons  = 0;
+     unsigned int  num_rels     = 0;
+     unsigned int  num_abs      = 0;
+
+     unsigned long evbit[NBITS(EV_CNT)];
+     unsigned long keybit[NBITS(KEY_CNT)];
+     unsigned long relbit[NBITS(REL_CNT)];
+     unsigned long absbit[NBITS(ABS_CNT)];
+
+     struct input_id devinfo;
+
+     /* get device name */
+     ioctl( fd, EVIOCGNAME(DFB_INPUT_DEVICE_DESC_NAME_LENGTH - 1), info->desc.name );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Linux" );
+
+     /* get event type bits */
+     ioctl( fd, EVIOCGBIT(0, sizeof(evbit)), evbit );
+
+     if (test_bit( EV_KEY, evbit )) {
+          int i;
+
+          /* get keyboard bits */
+          ioctl( fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit );
+
+          /**  count typical keyboard keys only */
+          for (i=KEY_Q; i<=KEY_M; i++)
+               if (test_bit( i, keybit ))
+                    num_keys++;
+
+          for (i=KEY_OK; i<KEY_CNT; i++)
+               if (test_bit( i, keybit ))
+                    num_ext_keys++;
+
+          for (i=BTN_MOUSE; i<BTN_JOYSTICK; i++)
+               if (test_bit( i, keybit ))
+                    num_buttons++;
+     }
+
+     if (test_bit( EV_REL, evbit )) {
+          int i;
+
+          /* get bits for relative axes */
+          ioctl( fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit );
+
+          for (i=0; i<REL_CNT; i++)
+               if (test_bit( i, relbit ))
+                    num_rels++;
+     }
+
+     if (test_bit( EV_ABS, evbit )) {
+          int i;
+
+          /* get bits for absolute axes */
+          ioctl( fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit );
+
+          for (i=0; i<ABS_PRESSURE; i++)
+               if (test_bit( i, absbit ))
+                    num_abs++;
+     }
+
+     /* Touchpad? */
+     /* FIXME: can we rely on BTN_TOUCH? xorg synaptics driver doesn't use it. */
+     if (test_bit( EV_KEY, evbit ) &&
+         test_bit( BTN_TOUCH, keybit ) &&
+         test_bit( BTN_TOOL_FINGER, keybit) &&
+         test_bit( EV_ABS, evbit ) &&
+         test_bit( ABS_X, absbit ) &&
+         test_bit( ABS_Y, absbit ) &&
+         test_bit( ABS_PRESSURE, absbit ))
+          *touchpad = true;
+     else
+          *touchpad = false;
+
+     /* Mouse, Touchscreen or Smartpad ? */
+     if ((test_bit( EV_KEY, evbit ) &&
+          (test_bit( BTN_TOUCH, keybit ) || test_bit( BTN_TOOL_FINGER, keybit ))) ||
+          ((num_rels >= 2 && num_buttons)  ||  (num_abs == 2 && (num_buttons == 1))))
+          info->desc.type |= DIDTF_MOUSE;
+     else if (num_abs && num_buttons) /* Or a Joystick? */
+          info->desc.type |= DIDTF_JOYSTICK;
+
+     /* A Keyboard, do we have at least some letters? */
+     if (num_keys > 20) {
+          info->desc.type |= DIDTF_KEYBOARD;
+          info->desc.caps |= DICAPS_KEYS;
+     }
+
+     info->desc.min_keycode = 0;
+     info->desc.max_keycode = 127;
+
+     /* A Remote Control? */
+     if (num_ext_keys) {
+          info->desc.type |= DIDTF_REMOTE;
+          info->desc.caps |= DICAPS_KEYS;
+     }
+
+     /* Buttons */
+     if (num_buttons) {
+          info->desc.caps       |= DICAPS_BUTTONS;
+          info->desc.max_button  = DIBI_FIRST + num_buttons - 1;
+     }
+
+     /* Axes */
+     if (num_rels || num_abs) {
+          info->desc.caps       |= DICAPS_AXES;
+          info->desc.max_axis    = DIAI_FIRST + MAX(num_rels, num_abs) - 1;
+     }
+
+     /* Decide which primary input device to be. */
+     if (info->desc.type & DIDTF_KEYBOARD)
+          info->prefered_id = DIDID_KEYBOARD;
+     else if (info->desc.type & DIDTF_REMOTE)
+          info->prefered_id = DIDID_REMOTE;
+     else if (info->desc.type & DIDTF_JOYSTICK)
+          info->prefered_id = DIDID_JOYSTICK;
+     else if (info->desc.type & DIDTF_MOUSE)
+          info->prefered_id = DIDID_MOUSE;
+     else
+          info->prefered_id = DIDID_ANY;
+
+     /* Get VID and PID information */
+     ioctl( fd, EVIOCGID, &devinfo );
+     
+     info->desc.vendor_id  = devinfo.vendor;
+     info->desc.product_id = devinfo.product;
+}
+
+static bool
+check_device( const char      *device,
+              InputDeviceInfo *ret_info )
+{
+     int  fd;
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %s )\n", __FUNCTION__, device );
+
+     /* Check if we are able to open the device */
+     fd = open( device, O_RDWR );
+     if (fd < 0) {
+          return false;
+     }
+     else {
+          bool touchpad;
+
+          /* try to grab the device */
+          if (dfb_config->linux_input_grab) {
+               /* 2.4 kernels don't have EVIOCGRAB so ignore EINVAL */
+               if (ioctl( fd, EVIOCGRAB, 1 ) && errno != EINVAL) {
+                    close( fd );
+                    return false;
+               }
+          }
+
+          memset( ret_info, 0, sizeof(InputDeviceInfo) );
+
+          get_device_info( fd, ret_info, &touchpad );
+
+          if (dfb_config->linux_input_grab)
+               ioctl( fd, EVIOCGRAB, 0 );
+          close( fd );
+
+          if (!dfb_config->linux_input_ir_only ||
+              (ret_info->desc.type & DIDTF_REMOTE))
+               return true;
+     }
+
+     return false;
+}
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     D_DEBUG_AT( LinuxInput_Driver, "%s()\n", __FUNCTION__ );
+
+#ifdef LINUX_INPUT_USE_FBDEV
+     if (dfb_system_type() != CORE_FBDEV)
+         return 0;
+#endif
+
+     LinuxInput_UpdateDevices();
+
+     printf("================JK: get_available returns %d\n", num_devices);
+     return num_devices;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "Linux Input Driver" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int              fd, ret;
+     unsigned long    ledbit[NBITS(LED_CNT)];
+     LinuxInputData  *data;
+#ifdef LINUX_INPUT_USE_FBDEV
+     FBDev           *dfb_fbdev = dfb_system_data();
+#endif
+     bool             touchpad;
+
+     D_DEBUG_AT( LinuxInput_Driver, "%s( %d ) <- %s\n", __FUNCTION__, number, devices[number].device );
+
+     /* open device */
+     fd = open( devices[number].device, O_RDWR );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/linux_input: could not open device" );
+          return DFB_INIT;
+     }
+
+     /* grab device */
+     if (dfb_config->linux_input_grab) {
+          ret = ioctl( fd, EVIOCGRAB, 1 );
+          /* 2.4 kernels don't have EVIOCGRAB so ignore EINVAL */
+          if (ret && errno != EINVAL) {
+               D_PERROR( "DirectFB/linux_input: could not grab device" );
+               close( fd );
+               return DFB_INIT;
+          }
+     }
+
+     /* fill device info structure */
+     get_device_info( fd, info, &touchpad );
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(LinuxInputData) );
+     if (!data) {
+          if (dfb_config->linux_input_grab)
+               ioctl( fd, EVIOCGRAB, 0 );
+          close( fd );
+          return D_OOM();
+     }
+
+     data->index  = number;
+     data->fd     = fd;
+     data->device = device;
+     data->info   = *info;
+#ifdef LINUX_INPUT_USE_FBDEV
+     if (dfb_system_type() == CORE_FBDEV)
+          data->vt = dfb_fbdev->vt;
+#endif
+     data->touchpad = touchpad;
+
+     /* check if the device has LEDs */
+     ret = ioctl( fd, EVIOCGBIT(EV_LED, sizeof(ledbit)), ledbit );
+     if (ret < 0)
+          D_PERROR( "DirectFB/linux_input: could not get LED bits" );
+     else
+          data->has_leds = test_bit( LED_SCROLLL, ledbit ) ||
+                           test_bit( LED_NUML, ledbit ) ||
+                           test_bit( LED_CAPSL, ledbit );
+
+     if (data->has_leds) {
+          /* get LED state */
+          ret = ioctl( fd, EVIOCGLED(sizeof(data->led_state)), data->led_state );
+          if (ret < 0) {
+               D_PERROR( "DirectFB/linux_input: could not get LED state" );
+               if (dfb_config->linux_input_grab)
+                    ioctl( fd, EVIOCGRAB, 0 );
+               close( fd );
+               D_FREE( data );
+               return DFB_INIT;
+          }
+
+          /* turn off LEDs */
+          set_led( data, LED_SCROLLL, 0 );
+          set_led( data, LED_NUML, 0 );
+          set_led( data, LED_CAPSL, 0 );
+     }
+
+     data->sensitivity = 0x10000;
+
+     devices[number].data = data;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, linux_input_EventThread, data, "Linux Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Obtain information about an axis (only absolute axis so far).
+ */
+static DFBResult
+driver_get_axis_info( CoreInputDevice              *device,
+                      void                         *driver_data,
+                      DFBInputDeviceAxisIdentifier  axis,
+                      DFBInputDeviceAxisInfo       *ret_info )
+{
+     LinuxInputData *data = (LinuxInputData*) driver_data;
+
+     if (data->touchpad)
+          return DFB_OK;
+
+     if (axis <= ABS_PRESSURE && axis < DIAI_LAST) {
+          unsigned long absbit[NBITS(ABS_CNT)];
+
+          /* check if we have an absolute axes */
+          ioctl( data->fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit );
+
+          if (test_bit (axis, absbit)) {
+               struct input_absinfo absinfo;
+
+               if (ioctl( data->fd, EVIOCGABS(axis), &absinfo ) == 0 &&
+                   (absinfo.minimum || absinfo.maximum)) {
+                    ret_info->flags  |= DIAIF_ABS_MIN | DIAIF_ABS_MAX;
+                    ret_info->abs_min = absinfo.minimum;
+                    ret_info->abs_max = absinfo.maximum;
+               }
+          }
+     }
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the kernel keymap.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+#ifdef LINUX_INPUT_USE_FBDEV
+     LinuxInputData             *data = (LinuxInputData*) driver_data;
+     int                         code = entry->code;
+     unsigned short              value;
+     DFBInputDeviceKeyIdentifier identifier;
+
+     if (!data->vt)
+          return DFB_UNSUPPORTED;
+
+     /* fetch the base level */
+     value = keyboard_read_value( driver_data, K_NORMTAB, code );
+
+     /* get the identifier for basic mapping */
+     identifier = keyboard_get_identifier( code, value );
+
+     /* is CapsLock effective? */
+     if (KTYP(value) == KT_LETTER)
+          entry->locks |= DILS_CAPS;
+
+     /* is NumLock effective? */
+     if (identifier >= DIKI_KP_DECIMAL && identifier <= DIKI_KP_9)
+          entry->locks |= DILS_NUM;
+
+     /* write identifier to entry */
+     entry->identifier = identifier;
+
+     /* write base level symbol to entry */
+     entry->symbols[DIKSI_BASE] = keyboard_get_symbol( code, value, DIKSI_BASE );
+
+
+     /* fetch the shifted base level */
+     value = keyboard_read_value( driver_data, K_SHIFTTAB, entry->code );
+
+     /* write shifted base level symbol to entry */
+     entry->symbols[DIKSI_BASE_SHIFT] = keyboard_get_symbol( code, value,
+                                                             DIKSI_BASE_SHIFT );
+
+
+     /* fetch the alternative level */
+     value = keyboard_read_value( driver_data, K_ALTTAB, entry->code );
+
+     /* write alternative level symbol to entry */
+     entry->symbols[DIKSI_ALT] = keyboard_get_symbol( code, value, DIKSI_ALT );
+
+
+     /* fetch the shifted alternative level */
+     value = keyboard_read_value( driver_data, K_ALTSHIFTTAB, entry->code );
+
+     /* write shifted alternative level symbol to entry */
+     entry->symbols[DIKSI_ALT_SHIFT] = keyboard_get_symbol( code, value,
+                                                            DIKSI_ALT_SHIFT );
+
+     return DFB_OK;
+#else
+     return DFB_UNSUPPORTED;
+#endif
+}
+
+/*
+ * Obtain information about an axis (only absolute axis so far).
+ */
+static DFBResult
+driver_set_sensitivity( CoreInputDevice *device,
+                        void            *driver_data,
+                        int              sensitivity )
+{
+     LinuxInputData *data = (LinuxInputData*) driver_data;
+
+     data->sensitivity = sensitivity;
+
+     return DFB_OK;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     LinuxInputData *data = (LinuxInputData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     if (data->has_leds) {
+          /* restore LED state */
+          set_led( data, LED_SCROLLL, test_bit( LED_SCROLLL, data->led_state ) );
+          set_led( data, LED_NUML, test_bit( LED_NUML, data->led_state ) );
+          set_led( data, LED_CAPSL, test_bit( LED_CAPSL, data->led_state ) );
+     }
+
+     /* release device */
+     if (dfb_config->linux_input_grab)
+          ioctl( data->fd, EVIOCGRAB, 0 );
+
+     /* close file */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE( data );
+}
+
+/**********************************************************************************************************************/
+
+static bool
+timeout_is_set( const struct timeval *timeout )
+{
+     return timeout->tv_sec || timeout->tv_usec;
+}
+
+static bool
+timeout_passed( const struct timeval *timeout, const struct timeval *current )
+{
+     return !timeout_is_set( timeout ) ||
+          current->tv_sec > timeout->tv_sec ||
+          (current->tv_sec == timeout->tv_sec && current->tv_usec > timeout->tv_usec);
+}
+
+static void
+timeout_clear( struct timeval *timeout )
+{
+     timeout->tv_sec  = 0;
+     timeout->tv_usec = 0;
+}
+
+static void
+timeout_add( struct timeval *timeout, const struct timeval *add )
+{
+     timeout->tv_sec += add->tv_sec;
+     timeout->tv_usec += add->tv_usec;
+     while (timeout->tv_usec >= 1000000) {
+          timeout->tv_sec++;
+          timeout->tv_usec -= 1000000;
+     }
+}
+
+static void
+timeout_sub( struct timeval *timeout, const struct timeval *sub )
+{
+     timeout->tv_sec -= sub->tv_sec;
+     timeout->tv_usec -= sub->tv_usec;
+     while (timeout->tv_usec < 0) {
+          timeout->tv_sec--;
+          timeout->tv_usec += 1000000;
+     }
+}
+
+/**********************************************************************************************************************/
+
+static void
+touchpad_fsm_init( struct touchpad_fsm_state *state )
+{
+     state->x.old = -1;
+     state->y.old = -1;
+     state->fsm_state = TOUCHPAD_FSM_START;
+     timeout_clear( &state->timeout );
+}
+
+static int
+touchpad_normalize( const struct touchpad_axis *axis, int value )
+{
+     return ((value - axis->min) << 9) / (axis->max - axis->min);
+}
+
+static int
+touchpad_translate( struct touchpad_fsm_state *state,
+                    const struct input_event  *levt,
+                    DFBInputEvent             *devt )
+{
+     struct touchpad_axis *axis = NULL;
+     int abs, rel;
+
+     devt->flags     = DIEF_TIMESTAMP | DIEF_AXISREL;
+     devt->timestamp = levt->time;
+     devt->type      = DIET_AXISMOTION;
+
+     switch (levt->code) {
+     case ABS_X:
+          axis       = &state->x;
+          devt->axis = DIAI_X;
+          break;
+     case ABS_Y:
+          axis       = &state->y;
+          devt->axis = DIAI_Y;
+          break;
+     default:
+          return 0;
+     }
+
+     abs = touchpad_normalize( axis, levt->value );
+     if (axis->old == -1)
+          axis->old = abs;
+     rel = abs - axis->old;
+
+#define ACCEL_THRESHOLD 25
+#define ACCEL_NUM       3
+#define ACCEL_DENOM     1
+
+     if (rel > ACCEL_THRESHOLD)
+          rel += (rel - ACCEL_THRESHOLD) * ACCEL_NUM / ACCEL_DENOM;
+     else if (rel < -ACCEL_THRESHOLD)
+          rel += (rel + ACCEL_THRESHOLD) * ACCEL_NUM / ACCEL_DENOM;
+
+     axis->old     = abs;
+     devt->axisrel = rel;
+
+     return 1;
+}
+
+static bool
+touchpad_finger_landing( const struct input_event *levt )
+{
+     return levt->type == EV_KEY && levt->code == BTN_TOUCH && levt->value == 1;
+}
+
+static bool
+touchpad_finger_leaving( const struct input_event *levt )
+{
+     return levt->type == EV_KEY && levt->code == BTN_TOUCH && levt->value == 0;
+}
+
+static bool
+touchpad_finger_moving( const struct input_event *levt )
+{
+     return levt->type == EV_ABS && (levt->code == ABS_X || levt->code == ABS_Y);
+}
+
+/*
+ * This FSM takes into accout finger landing on touchpad and leaving and
+ * translates absolute DFBInputEvent into a relative one
+ */
+static int
+touchpad_fsm( struct touchpad_fsm_state *state,
+              const struct input_event  *levt,
+              DFBInputEvent             *devt )
+{
+     struct timeval timeout = { 0, 125000 };
+
+     /* select() timeout? */
+     if (!levt) {
+          /* Check if button release is due. */
+          if (state->fsm_state == TOUCHPAD_FSM_DRAG_START) {
+               devt->flags     = DIEF_TIMESTAMP;
+               devt->timestamp = state->timeout; /* timeout of current time? */
+               devt->type      = DIET_BUTTONRELEASE;
+               devt->button    = DIBI_FIRST;
+
+               touchpad_fsm_init( state );
+               return 1;
+          }
+
+          /* Already passed, clear it so select() won't return until there is something to do. */
+          timeout_clear( &state->timeout );
+          return 0;
+     }
+
+     /* More or less ignore these events for now */
+     if ((levt->type == EV_SYN && levt->code == SYN_REPORT) ||
+         (levt->type == EV_ABS && levt->code == ABS_PRESSURE) ||
+         (levt->type == EV_ABS && levt->code == ABS_TOOL_WIDTH) ||
+         (levt->type == EV_KEY && levt->code == BTN_TOOL_FINGER) ||
+         (levt->type == EV_KEY && levt->code == BTN_TOOL_DOUBLETAP) ||
+         (levt->type == EV_KEY && levt->code == BTN_TOOL_TRIPLETAP)) {
+
+          /* Check if button release is due. */
+          if (state->fsm_state == TOUCHPAD_FSM_DRAG_START &&
+              timeout_passed( &state->timeout, &levt->time )) {
+               devt->flags     = DIEF_TIMESTAMP;
+               devt->timestamp = state->timeout; /* timeout of levt->time? */
+               devt->type      = DIET_BUTTONRELEASE;
+               devt->button    = DIBI_FIRST;
+
+               touchpad_fsm_init( state );
+               return 1;
+          }
+
+          return 0;
+     }
+
+     /* Use translate_event() for other events. */
+     if (!(levt->type == EV_KEY && levt->code == BTN_TOUCH) &&
+         !(levt->type == EV_ABS && (levt->code == ABS_X || levt->code == ABS_Y)))
+          return -1;
+
+     switch (state->fsm_state) {
+     case TOUCHPAD_FSM_START:
+          if (touchpad_finger_landing( levt )) {
+               state->fsm_state = TOUCHPAD_FSM_MAIN;
+               state->timeout = levt->time;
+               timeout_add( &state->timeout, &timeout );
+          }
+          return 0;
+
+     case TOUCHPAD_FSM_MAIN:
+          if (touchpad_finger_moving( levt )) {
+               if (1){//timeout_passed( &state->timeout, &levt->time )) {
+                    //timeout_clear( &state->timeout );
+                    return touchpad_translate( state, levt, devt );
+               }
+          }
+          else if (touchpad_finger_leaving( levt )) {
+               if (!timeout_passed( &state->timeout, &levt->time )) {
+                    devt->flags     = DIEF_TIMESTAMP;
+                    devt->timestamp = levt->time;
+                    devt->type      = DIET_BUTTONPRESS;
+                    devt->button    = DIBI_FIRST;
+
+                    touchpad_fsm_init( state );
+                    state->fsm_state = TOUCHPAD_FSM_DRAG_START;
+                    state->timeout = levt->time;
+                    timeout_add( &state->timeout, &timeout );
+                    return 1;
+               }
+               else {
+                    touchpad_fsm_init( state );
+               }
+          }
+          return 0;
+
+     case TOUCHPAD_FSM_DRAG_START:
+          if (timeout_passed( &state->timeout, &levt->time )){
+               devt->flags     = DIEF_TIMESTAMP;
+               devt->timestamp = state->timeout; /* timeout of levt->time? */
+               devt->type      = DIET_BUTTONRELEASE;
+               devt->button    = DIBI_FIRST;
+
+               touchpad_fsm_init(state);
+               return 1;
+          }
+          else {
+               if (touchpad_finger_landing( levt )) {
+                    state->fsm_state = TOUCHPAD_FSM_DRAG_MAIN;
+                    state->timeout = levt->time;
+                    timeout_add( &state->timeout, &timeout );
+               }
+          }
+          return 0;
+
+     case TOUCHPAD_FSM_DRAG_MAIN:
+          if (touchpad_finger_moving( levt )) {
+               if (1){//timeout_passed( &state->timeout, &levt->time )) {
+                   //timeout_clear( &state->timeout );
+                    return touchpad_translate( state, levt, devt );
+               }
+          }
+          else if (touchpad_finger_leaving( levt )) {
+               devt->flags     = DIEF_TIMESTAMP;
+               devt->timestamp = levt->time;
+               devt->type      = DIET_BUTTONRELEASE;
+               devt->button    = DIBI_FIRST;
+
+               touchpad_fsm_init( state );
+               return 1;
+          }
+          return 0;
+
+     default:
+          return 0;
+     }
+
+     return 0;
+}
diff --git a/Source/DirectFB/inputdrivers/lirc/Makefile.am b/Source/DirectFB/inputdrivers/lirc/Makefile.am
new file mode 100755
index 0000000..c4b2f94
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/lirc/Makefile.am
@@ -0,0 +1,32 @@
+## Makefile.am for DirectFB/inputdrivers/lirc
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-I$(top_builddir)/include
+
+lirc_LTLIBRARIES = libdirectfb_lirc.la
+
+if BUILD_STATIC
+lirc_DATA = $(lirc_LTLIBRARIES:.la=.o)
+endif
+
+lircdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_lirc_la_SOURCES =	\
+	lirc.c
+
+libdirectfb_lirc_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_lirc_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/lirc/Makefile.in b/Source/DirectFB/inputdrivers/lirc/Makefile.in
new file mode 100755
index 0000000..6bc39d3
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/lirc/Makefile.in
@@ -0,0 +1,593 @@
+# 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 = inputdrivers/lirc
+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)$(lircdir)" "$(DESTDIR)$(lircdir)"
+lircLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lirc_LTLIBRARIES)
+libdirectfb_lirc_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_lirc_la_OBJECTS = lirc.lo
+libdirectfb_lirc_la_OBJECTS = $(am_libdirectfb_lirc_la_OBJECTS)
+libdirectfb_lirc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_lirc_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_lirc_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_lirc_la_SOURCES)
+lircDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(lirc_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-I$(top_builddir)/include
+
+lirc_LTLIBRARIES = libdirectfb_lirc.la
+@BUILD_STATIC_TRUE@lirc_DATA = $(lirc_LTLIBRARIES:.la=.o)
+lircdir = $(MODULEDIR)/inputdrivers
+libdirectfb_lirc_la_SOURCES = \
+	lirc.c
+
+libdirectfb_lirc_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_lirc_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  inputdrivers/lirc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/lirc/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-lircLTLIBRARIES: $(lirc_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(lircdir)" || $(MKDIR_P) "$(DESTDIR)$(lircdir)"
+	@list='$(lirc_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(lircLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(lircdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(lircLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(lircdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-lircLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lirc_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(lircdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(lircdir)/$$p"; \
+	done
+
+clean-lircLTLIBRARIES:
+	-test -z "$(lirc_LTLIBRARIES)" || rm -f $(lirc_LTLIBRARIES)
+	@list='$(lirc_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_lirc.la: $(libdirectfb_lirc_la_OBJECTS) $(libdirectfb_lirc_la_DEPENDENCIES) 
+	$(libdirectfb_lirc_la_LINK) -rpath $(lircdir) $(libdirectfb_lirc_la_OBJECTS) $(libdirectfb_lirc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lirc.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-lircDATA: $(lirc_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(lircdir)" || $(MKDIR_P) "$(DESTDIR)$(lircdir)"
+	@list='$(lirc_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(lircDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(lircdir)/$$f'"; \
+	  $(lircDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(lircdir)/$$f"; \
+	done
+
+uninstall-lircDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lirc_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(lircdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(lircdir)/$$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)$(lircdir)" "$(DESTDIR)$(lircdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-lircLTLIBRARIES \
+	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-lircDATA install-lircLTLIBRARIES
+
+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-lircDATA uninstall-lircLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-lircLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-lircDATA \
+	install-lircLTLIBRARIES 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-lircDATA \
+	uninstall-lircLTLIBRARIES
+
+%.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/inputdrivers/lirc/lirc.c b/Source/DirectFB/inputdrivers/lirc/lirc.c
new file mode 100755
index 0000000..edb6957
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/lirc/lirc.c
@@ -0,0 +1,353 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <directfb.h>
+#include <directfb_keynames.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( lirc )
+
+static DirectFBKeySymbolNames(keynames);
+
+static bool keynames_sorted = false;
+
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} LircData;
+
+
+static int keynames_compare (const void *key,
+                             const void *base)
+{
+  return strcmp ((const char *) key,
+                 ((const struct DFBKeySymbolName *) base)->name);
+}
+
+static int keynames_sort_compare (const void *d1,
+                                  const void *d2)
+{
+  return strcmp (((const struct DFBKeySymbolName *) d1)->name,
+                 ((const struct DFBKeySymbolName *) d2)->name);
+}
+
+static DFBInputDeviceKeySymbol lirc_parse_line(const char *line)
+{
+     struct DFBKeySymbolName *symbol_name;
+     char *s, *name;
+
+     if (!keynames_sorted) {
+          qsort ( keynames,
+                  D_ARRAY_SIZE( keynames ),
+                  sizeof(keynames[0]),
+                  (__compar_fn_t) keynames_sort_compare );
+          keynames_sorted = true;
+     }
+
+     s = strchr( line, ' ' );
+     if (!s || !s[1])
+          return DIKS_NULL;
+
+     s = strchr( ++s, ' ' );
+     if (!s|| !s[1])
+          return DIKS_NULL;
+
+     name = ++s;
+
+     s = strchr( name, ' ' );
+     if (s)
+          *s = '\0';
+
+     switch (strlen( name )) {
+          case 0:
+               return DIKS_NULL;
+          case 1:
+               return (DFBInputDeviceKeySymbol) name[0];
+          default:
+               symbol_name = bsearch( name, keynames,
+                                      D_ARRAY_SIZE( keynames ),
+                                      sizeof(keynames[0]),
+                                      (__compar_fn_t) keynames_compare );
+               if (symbol_name)
+                    return symbol_name->symbol;
+               break;
+     }
+
+     return DIKS_NULL;
+}
+
+static void*
+lircEventThread( DirectThread *thread, void *driver_data )
+{
+     int                      repeats = 0;
+     DFBInputDeviceKeySymbol  last    = DIKS_NULL;
+     LircData                *data    = (LircData*) driver_data;
+
+     while (true) {
+          struct timeval          tv;
+          fd_set                  set;
+          int                     result;
+          int                     readlen;
+          char                    buf[128];
+          DFBInputEvent           evt;
+          DFBInputDeviceKeySymbol symbol;
+
+          FD_ZERO(&set);
+          FD_SET(data->fd,&set);
+
+          tv.tv_sec  = 0;
+          tv.tv_usec = 200000;
+
+          result = select (data->fd+1, &set, NULL, NULL, &tv);
+
+          switch (result) {
+               case -1:
+                    /* error */
+                    if (errno == EINTR)
+                         continue;
+
+                    D_PERROR("DirectFB/LIRC: select() failed\n");
+                    return NULL;
+
+               case 0:
+                    /* timeout, release last key */
+                    if (last != DIKS_NULL) {
+                         evt.flags      = DIEF_KEYSYMBOL;
+                         evt.type       = DIET_KEYRELEASE;
+                         evt.key_symbol = last;
+
+                         dfb_input_dispatch( data->device, &evt );
+
+                         last = DIKS_NULL;
+                    }
+                    continue;
+
+               default:
+                    /* data arrived */
+                    break;
+          }
+
+          direct_thread_testcancel( thread );
+
+          /* read data */
+          readlen = read( data->fd, buf, 128 );
+          if (readlen < 1)
+               continue;
+
+          /* get new key */
+          symbol = lirc_parse_line( buf );
+          if (symbol == DIKS_NULL)
+               continue;
+
+          /* repeated key? */
+          if (symbol == last) {
+               /* swallow the first three repeats */
+               if (++repeats < 4)
+                    continue;
+          }
+          else {
+               /* reset repeat counter */
+               repeats = 0;
+
+               /* release previous key if not released yet */
+               if (last != DIKS_NULL) {
+                    evt.flags      = DIEF_KEYSYMBOL;
+                    evt.type       = DIET_KEYRELEASE;
+                    evt.key_symbol = last;
+
+                    dfb_input_dispatch( data->device, &evt );
+               }
+          }
+
+          /* send the press event */
+          evt.flags      = DIEF_KEYSYMBOL;
+          evt.type       = DIET_KEYPRESS;
+          evt.key_symbol = symbol;
+
+          dfb_input_dispatch( data->device, &evt );
+
+          /* remember last key */
+          last = symbol;
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+static int
+driver_get_available( void )
+{
+     int fd;
+     struct sockaddr_un addr;
+
+     addr.sun_family = AF_UNIX;
+     direct_snputs( addr.sun_path, "/dev/lircd", sizeof(addr.sun_path) );
+
+     fd = socket( PF_UNIX, SOCK_STREAM, 0 );
+     if (fd < 0)
+          return 0;
+
+     if (connect( fd, (struct sockaddr*)&addr, sizeof(addr) ) < 0) {
+          close( fd );
+          return 0;
+     }
+
+     close( fd );
+
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "LIRC Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 2;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int                 fd;
+     LircData           *data;
+     struct sockaddr_un  sa;
+
+     /* create socket */
+     sa.sun_family = AF_UNIX;
+     direct_snputs( sa.sun_path, "/dev/lircd", sizeof(sa.sun_path) );
+
+     fd = socket( PF_UNIX, SOCK_STREAM, 0 );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/LIRC: socket" );
+          return DFB_INIT;
+     }
+
+     /* initiate connection */
+     if (connect( fd, (struct sockaddr*)&sa, sizeof(sa) ) < 0) {
+          D_PERROR( "DirectFB/LIRC: connect" );
+          close( fd );
+          return DFB_INIT;
+     }
+
+     /* fill driver info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "LIRC Device" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id = DIDID_REMOTE;
+
+     info->desc.type   = DIDTF_REMOTE;
+     info->desc.caps   = DICAPS_KEYS;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(LircData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, lircEventThread, data, "LiRC Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     LircData *data = (LircData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close socket */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/mutouch/Makefile.am b/Source/DirectFB/inputdrivers/mutouch/Makefile.am
new file mode 100755
index 0000000..513cd1b
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/mutouch/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/inputdrivers/microtouch
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_mutouch.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_mutouch_la_SOURCES = mutouch.c
+
+libdirectfb_mutouch_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_mutouch_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/mutouch/Makefile.in b/Source/DirectFB/inputdrivers/mutouch/Makefile.in
new file mode 100755
index 0000000..544ea61
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/mutouch/Makefile.in
@@ -0,0 +1,590 @@
+# 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 = inputdrivers/mutouch
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_mutouch_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_mutouch_la_OBJECTS = mutouch.lo
+libdirectfb_mutouch_la_OBJECTS = $(am_libdirectfb_mutouch_la_OBJECTS)
+libdirectfb_mutouch_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_mutouch_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_mutouch_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_mutouch_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_mutouch.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_mutouch_la_SOURCES = mutouch.c
+libdirectfb_mutouch_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_mutouch_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  inputdrivers/mutouch/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/mutouch/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_mutouch.la: $(libdirectfb_mutouch_la_OBJECTS) $(libdirectfb_mutouch_la_DEPENDENCIES) 
+	$(libdirectfb_mutouch_la_LINK) -rpath $(inputdir) $(libdirectfb_mutouch_la_OBJECTS) $(libdirectfb_mutouch_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutouch.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/mutouch/mutouch.c b/Source/DirectFB/inputdrivers/mutouch/mutouch.c
new file mode 100755
index 0000000..79c278f
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/mutouch/mutouch.c
@@ -0,0 +1,615 @@
+/*
+   (c) Copyright 2000-2002  Fulgid Technology Co., Ltd.
+
+   All rights reserved.
+
+   Written by Simon Ueng <simon@ftech.com.tw>
+
+   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.
+
+   This driver is a re-write from the MuTouch driver provided in XFree86.
+   Extended options in the MuTouch firmware are not used as it wasn't
+   an issue during the writing of this driver.
+   Baudrate has also been rewritting to automatically adjust to 19200 if
+   its support else it uses 9600.
+
+   Feel free to change according to your needs, but changing both
+   MuT_MINX as well as MuT_MINY is required to adjust the orientation
+   of the touchscreen. We've had numerous occasions where the one
+   touchscreen was installed in a different orientation than others.
+   Also don't forget to adjust the MuT_SCREENWIDTH and MuT_SCREENHEIGHT
+   for the appropriate screen dimension.
+
+   Not much time has been spent writing this driver therefore expect errors.
+   Calibration process has also been omitted since there are applications
+   to do the calibration process.
+
+   Lastly, please don't email me regarding technical informations. I
+   don't work for 3M. But if you have any new ideas on improving this
+   driver, please don't hesitate to share it with me.
+   */
+/*
+ * Jacques Luder j.luder@laposte.net 
+ * Baudrate adjust now realy working ! 
+ * version 0.3 10/09/2006 Jacques Luder j.luder@laposte.net
+ * Can now work also with a keyspan USB-Serial line.
+ * Can start OK even if someone touch the screen during probing.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( mutouch )
+
+
+#define BAUDRATE         B9600
+#define OPTIMAL_BAUDRATE B19200
+#define MAX_TIMEOUT      5
+
+#define MuT_REPORT_SIZE  5
+#define MuT_PACKET_SIZE  10
+#define MuT_SCREENWIDTH  4096
+#define MuT_SCREENHEIGHT 4096
+#define MuT_MINX         0
+#define MuT_MINY         0
+
+#define MuT_LEAD_BYTE    0x01
+#define MuT_TRAIL_BYTE   0x0d
+
+
+#define ERROR_NOT_SUITABLE    -1110  /* The touchpanel firmware is not
+                                        suitable for IMP2001 */
+#define ERROR_NOT_FOUND       -1111  /* Touchpanel not found */
+#define ERROR_INIT            -1112  /* Error occurred while initializing */
+
+#define MUT_PANEL_TOUCH       0x01
+#define MUT_PANEL_UNTOUCH     0x00
+
+
+/* Commands */
+#define MuT_RESET             "R"
+#define MuT_AUTOBAUD_DISABLE  "AD"
+#define MuT_RESTORE_DEFAULTS  "RD"
+#define MuT_QUERY             "Z"
+#define MuT_FORMAT_TABLET     "FT"
+#define MuT_FORMAT_RAW        "FR"
+#define MuT_CALIBRATE_RAW     "CR"
+#define MuT_CALIBRATE_EXT     "CX"
+#define MuT_OUTPUT_IDENT      "OI"
+#define MuT_UNIT_TYPE         "UT"
+#define MuT_FINGER_ONLY       "FO"
+#define MuT_PEN_ONLY          "PO"
+#define MuT_PEN_FINGER        "PF"
+#define MuT_MODE_STREAM       "MS"
+#define MuT_MODE_DOWN_UP      "MDU"
+
+/* Command reply */
+#define MuT_OK                '0'
+#define MuT_ERROR             '1'
+
+/* Offsets in status byte of touch and motion reports */
+#define MuT_WHICH_DEVICE      0x20
+#define MuT_CONTACT           0x40
+
+/* Identity and friends */
+#define MuT_SMT3_IDENT        "Q1"
+#define MuT_THRU_GLASS_IDENT  "T1"
+
+/* Event mask */
+#define MuT_PANEL_TOUCH_MASK  0x40
+#define MuT_PANEL_SYNC_MASK   0x80
+
+typedef struct __MuTData__ {
+     int fd;
+     DirectThread *thread;
+     CoreInputDevice *device;
+     unsigned short x;
+     unsigned short y;
+     unsigned short screen_width;
+     unsigned short screen_height;
+     unsigned short min_x;
+     unsigned short min_y;
+     unsigned char action;
+} MuTData;
+
+/* Global Variables */
+static unsigned char packet[MuT_PACKET_SIZE];
+
+
+static inline void __mdelay(unsigned int msec)
+{
+     struct timespec delay;
+
+     delay.tv_sec = 0;
+     delay.tv_nsec = msec * 1000000;
+     nanosleep (&delay, NULL);
+}
+
+static inline void MuTSendPacket(int file, char *packet, unsigned char len)
+{
+     unsigned char tmp_packet[MuT_PACKET_SIZE];
+
+     direct_memcpy (&tmp_packet[1], packet, len);
+     *tmp_packet = MuT_LEAD_BYTE;
+     tmp_packet[len + 1] = MuT_TRAIL_BYTE;
+     write (file, tmp_packet, len + 2);
+}
+
+static inline void MuTReadPacket(int file, unsigned char *packet)
+{
+     int n = 0;
+
+     while ( n < MuT_REPORT_SIZE ) {
+          read( file, &packet[n], 1 );
+          if ( (packet[0] & MuT_PANEL_SYNC_MASK) != 0) {
+               n++;
+          }
+     } 
+}
+
+static int MuTSetToOptimalCTRL(int file, unsigned long baud)
+{
+     unsigned char packet[3]={0,0,0};
+     struct termios options;
+     struct termios save_options;
+     /*
+     * We are now in a mode who "works" but may be not the good one !
+     * So we will make a test if a "good" mode works fine ...
+     */
+
+     tcgetattr(file, &options);
+     tcgetattr(file, &save_options);   // Save mode who works.
+     /*
+     * Send a command to change to suitable mode.
+     */
+     switch (baud) {
+          case B19200:
+               MuTSendPacket (file, "PN811", 5);
+               break;
+          case B9600:
+               MuTSendPacket (file, "PN812", 5);
+               break;
+     }
+     // Note answer from driver will be lost ! there is no way to catch it with some
+     // USB-Serial device. we have only to wait !
+     __mdelay (20);
+
+     /*
+     * We can't work on CS7 mode messages format are not the same !
+     */
+     options.c_cflag =  CS8 | CLOCAL | CREAD;
+     /*
+     * POSIX says speed is ONLY here !
+     */
+     cfsetospeed( &options, baud);
+     cfsetispeed( &options, 0);    // Same as output.
+
+     tcsetattr (file, TCSANOW, &options);
+     __mdelay (100);
+     tcflush (file, TCIFLUSH);
+     /*
+     * With some USB-Serial device flush may occurs after sending message and answer from driver 
+     * may be lost ! ... so we wait !
+     */
+     __mdelay (100);
+
+     switch (baud) {
+          case B19200:
+               MuTSendPacket (file, "PN811", 5);
+               break;
+          case B9600:
+               MuTSendPacket (file, "PN812", 5);
+               break;
+     }
+     /* 
+     * note if someone touch screen, we have also to strip "touch" message by testing MuT_LEAD_BYTE.
+     */
+     __mdelay (100);
+     int n = 0;
+     while ( n <3 ) {
+          if (read( file, &packet[n], 1 ) <=0)
+               break;
+          if ( packet[n] == MuT_LEAD_BYTE ) {       // new start
+               n = 0;
+               packet[0] = MuT_LEAD_BYTE;
+          }
+          if ( (n==1) && (packet[1] != MuT_OK)) {
+               n = 0;
+               packet[0]= 0;
+          }
+          if ( (n==2) && (packet[2] != MuT_TRAIL_BYTE) ) {
+               n = 0;
+               packet[0]= 0;
+          }
+          if ( packet[0] == MuT_LEAD_BYTE)
+               n++;
+     }
+
+     if ( n == 3 ) {
+          /* Unset O_NONBLOCK */
+          int flags;
+          flags = fcntl( file,  F_GETFL );
+          flags &= ~O_NONBLOCK;
+          fcntl( file, F_SETFL, flags );
+          /* Unset VTIME */  
+          options.c_cc[VMIN] = 1;
+          options.c_cc[VTIME] = 0;
+          tcsetattr (file, TCSANOW, &options);
+          __mdelay (100);
+
+          return 1;   // OK
+     }
+     // KO return to old termios options.
+     tcsetattr (file, TCSANOW, &save_options);
+     __mdelay (100);
+     return 0;
+}
+
+
+static int MuTPollDevice(char *device)
+{
+     int file;
+     struct termios options;
+     unsigned char i, m;
+     unsigned char packet[MuT_PACKET_SIZE];
+     unsigned long baud[2] = {B9600, B19200};
+     unsigned long misc[2] = {CS8, CS7 | CSTOPB};
+
+     file = open (device, O_RDWR | O_NOCTTY);
+
+     /* Set O_NONBLOCK */
+     int flags;
+     flags = fcntl( file,  F_GETFL );
+     flags |= O_NONBLOCK;
+     fcntl( file, F_SETFL, flags );
+
+
+     /* Make raw I/O */
+     memset (&options, 0, sizeof (struct termios));
+
+     /* cfmakeraw(&options) */
+     options.c_cc[VMIN] = 0;
+     options.c_cc[VTIME] = 10;
+
+     /* loop through the bauds */
+     for (i = 0; i < 2; i++) {
+          /* loop through the misc configs */
+          for (m = 0; m < 2; m++) {
+               options.c_cflag =  misc[m] | CLOCAL | CREAD;
+               /*
+               * POSIX
+               */
+               cfsetospeed( &options, baud[i]);
+               cfsetispeed( &options, 0);
+               tcsetattr (file, TCSANOW, &options);
+               /* wait for some USB-Serial device */
+               __mdelay (100);
+               tcflush (file, TCIFLUSH);
+               __mdelay (100);
+
+               MuTSendPacket (file, MuT_QUERY, strlen (MuT_QUERY));
+               /* we are in O_NONBLOCK  need wait before read  */
+               __mdelay (100);
+
+               int n = 0;
+               while ( n <3 ) {
+                    if (read( file, &packet[n], 1 ) <=0)
+                         break;
+                    if ( packet[n] == MuT_LEAD_BYTE ) {       // new start
+                         n = 0;
+                         packet[0] = MuT_LEAD_BYTE;
+                    }
+                    if ( (n==1) && (packet[1] != MuT_OK)) {    // false start
+                         n = 0;
+                         packet[0]= 0;
+                    }
+                    if ( (n==2) && (packet[2] != MuT_TRAIL_BYTE) ) {  // false start
+                         n = 0;
+                         packet[0]= 0;
+                    }
+                    if ( packet[0] == MuT_LEAD_BYTE)
+                         n++;
+               }
+
+               if ( n == 3 ) {
+
+
+                    if (MuTSetToOptimalCTRL (file, B19200)) {
+                         return file;
+                    }
+                    else if (MuTSetToOptimalCTRL (file, B9600)) {
+                         return file;
+                    }
+                    else return ERROR_NOT_SUITABLE;
+               }
+          }
+     }
+     close(file);
+     return ERROR_NOT_FOUND;
+}
+
+static int MuTInitCmd(int file, char *cmd)
+{
+     unsigned char timeout = 0;
+     unsigned char packet[MuT_PACKET_SIZE];
+
+     do {
+          MuTSendPacket (file, cmd, strlen (cmd));
+
+          /*
+          * Strip out 'touch" message
+          */
+          int n = 0;
+          while ( n <3 ) {
+               if (read( file, &packet[n], 1 ) <=0)
+                    break;
+               if ( packet[0] == MuT_LEAD_BYTE)
+                    n++;
+          }
+
+          timeout++;
+          if (timeout >= MAX_TIMEOUT)
+               return ERROR_INIT;
+     } while (packet[1] != MuT_OK);
+
+     return 1;
+}
+
+static inline int MuTInitialize(int file)
+{
+     if (!MuTInitCmd (file, MuT_RESET))
+          return 0;
+     if (!MuTInitCmd (file, MuT_FINGER_ONLY))
+          return 0;
+     if (!MuTInitCmd (file, MuT_MODE_DOWN_UP))
+          return 0;
+     if (!MuTInitCmd (file, MuT_FORMAT_TABLET))
+          return 0;
+
+     return 1;
+}
+
+static int MuTOpenDevice(char *device)
+{
+     int fd;
+     int res;
+
+     fd = MuTPollDevice (device);
+     if ((res = MuTInitialize (fd)) == 0) {
+          close (fd);
+          return res;
+     }
+
+     return fd;
+}
+
+#define WORD_ASSEMBLY(byte1, byte2)	(((byte2) << 7) | (byte1))
+static int MuTGetEvent(MuTData *event)
+{
+     MuTReadPacket(event->fd, packet);
+     
+     /* Sync bit always must be set to 1 */
+     if ((*packet & MuT_PANEL_SYNC_MASK) == 0)
+          return 0;
+     
+     if (*packet & MuT_PANEL_TOUCH_MASK)
+          event->action = MUT_PANEL_TOUCH;
+     else
+          event->action = MUT_PANEL_UNTOUCH;
+
+     event->x = (event->screen_width *
+                 WORD_ASSEMBLY(packet[1], packet[2])) / 16383;
+     event->y = (event->screen_height *
+                 WORD_ASSEMBLY(packet[3], packet[4])) / 16383;
+
+     if (event->min_x)
+          event->x = event->min_x - event->x;
+     if (event->min_y)
+          event->y = event->min_y - event->y;
+
+     return 1;
+}
+
+/* The main routine for MuTouch */
+static void *MuTouchEventThread(DirectThread *thread, void *driver_data)
+{
+     MuTData *data = (MuTData *) driver_data;
+
+     /* Read data */
+     while (1) {
+          DFBInputEvent evt;
+
+          if (!MuTGetEvent (data))
+               continue;
+          direct_thread_testcancel (thread);
+
+          /* Dispatch axis */
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_X;
+          evt.axisabs = data->x;
+          dfb_input_dispatch (data->device, &evt);
+
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_Y;
+          evt.axisabs = data->y;
+          dfb_input_dispatch (data->device, &evt);
+
+          /* Dispatch touch event */
+          switch (data->action) {
+               case MUT_PANEL_TOUCH:
+                    evt.type = DIET_BUTTONPRESS;
+                    break;
+               case MUT_PANEL_UNTOUCH:
+                    evt.type = DIET_BUTTONRELEASE;
+                    break;
+          }
+
+          evt.flags  = DIEF_NONE;
+          evt.button = DIBI_LEFT;
+
+          dfb_input_dispatch (data->device, &evt);
+          direct_thread_testcancel (thread);
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+static int driver_get_available( void )
+{
+     int fd;
+
+     if (!dfb_config->mut_device)
+          return 0;
+
+     fd = MuTOpenDevice (dfb_config->mut_device);
+     if (fd < 0)
+          return 0;
+
+     close(fd);
+
+     return 1;
+}
+
+static void driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+              "MuTouch" );
+     snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+              "Microtouch" );
+
+     info->version.major = 0;
+     info->version.minor = 3;
+}
+
+static DFBResult driver_open_device(CoreInputDevice *device,
+                                    unsigned int number,
+                                    InputDeviceInfo *info,
+                                    void **driver_data)
+{
+     int fd;
+     MuTData *data;
+
+     /* open device */
+     fd = MuTOpenDevice (dfb_config->mut_device);
+     D_INFO("MuTouch:driver_open_device %s fd %d\n", dfb_config->mut_device,fd);
+
+     if (fd < 0) {
+          return DFB_INIT;
+     }
+
+     data = D_CALLOC (1, sizeof(MuTData));
+     if (!data) {
+          close (fd);
+          return D_OOM ();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* Must define the correct resolution of screen */
+     data->screen_width  = MuT_SCREENWIDTH;
+     data->screen_height = MuT_SCREENHEIGHT;
+
+     /* The following variable are defined to adjust the orientation of
+      * the touchscreen. Variables are either max screen height/width or 0.
+      */
+     data->min_x = MuT_MINX;
+     data->min_y = MuT_MINY;
+
+     /* fill device info structure */
+     snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+              "MuTouch");
+     snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,
+              "Microtouch");
+
+     info->prefered_id     = DIDID_MOUSE;
+     info->desc.type        = DIDTF_MOUSE;
+     info->desc.caps        = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* start input thread */
+     data->thread = direct_thread_create (DTT_INPUT, MuTouchEventThread, data, "MuTouch Input");
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+                                         void        *driver_data,
+                                         DFBInputDeviceKeymapEntry *entry)
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void driver_close_device(void *driver_data)
+{
+     MuTData *data = (MuTData *)driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel (data->thread);
+     direct_thread_join (data->thread);
+     direct_thread_destroy (data->thread);
+
+     /* close device */
+     close (data->fd);
+
+     /* free private data */
+     D_FREE (data);
+}
+
diff --git a/Source/DirectFB/inputdrivers/penmount/Makefile.am b/Source/DirectFB/inputdrivers/penmount/Makefile.am
new file mode 100755
index 0000000..4b2e92f
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/penmount/Makefile.am
@@ -0,0 +1,29 @@
+## Makefile.am for DirectFB/inputdrivers/penmount
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_penmount.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_penmount_la_SOURCES = penmount.c
+
+libdirectfb_penmount_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_penmount_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/penmount/Makefile.in b/Source/DirectFB/inputdrivers/penmount/Makefile.in
new file mode 100755
index 0000000..8805622
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/penmount/Makefile.in
@@ -0,0 +1,591 @@
+# 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 = inputdrivers/penmount
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_penmount_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_penmount_la_OBJECTS = penmount.lo
+libdirectfb_penmount_la_OBJECTS =  \
+	$(am_libdirectfb_penmount_la_OBJECTS)
+libdirectfb_penmount_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_penmount_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_penmount_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_penmount_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_penmount.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_penmount_la_SOURCES = penmount.c
+libdirectfb_penmount_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_penmount_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  inputdrivers/penmount/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/penmount/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_penmount.la: $(libdirectfb_penmount_la_OBJECTS) $(libdirectfb_penmount_la_DEPENDENCIES) 
+	$(libdirectfb_penmount_la_LINK) -rpath $(inputdir) $(libdirectfb_penmount_la_OBJECTS) $(libdirectfb_penmount_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/penmount.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/penmount/penmount.c b/Source/DirectFB/inputdrivers/penmount/penmount.c
new file mode 100755
index 0000000..76bce8e
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/penmount/penmount.c
@@ -0,0 +1,363 @@
+/*
+   (c) Copyright 2000-2002  Fulgid Technology Co., Ltd.
+
+   All rights reserved.
+
+   Written by Simon Ueng <simon@ftech.com.tw>
+   Modified by Nikita Egorov <nikego@gmail.com>
+
+   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.
+
+   This driver is a re-write from the MuTouch driver.
+*/
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( penmount )
+
+#define BAUDRATE		B19200
+
+#define PeM_REPORT_SIZE		5
+#define PeM_PACKET_SIZE		10
+#define PeM_SCREENWIDTH		640
+#define PeM_SCREENHEIGHT	480
+#define PeM_MINX		0
+#define PeM_MINY		0
+
+#define PEM_PANEL_TOUCH		0x01
+#define PEM_PANEL_UNTOUCH	0x00
+
+
+/* Event mask */
+#define PeM_PANEL_TOUCH_MASK	0x40
+#define PeM_PANEL_SYNC_MASK	0x80
+
+typedef struct __PeMData__ {
+     int fd;
+     DirectThread *thread;
+     CoreInputDevice *device;
+     unsigned short x;
+     unsigned short y;
+     unsigned short screen_width;
+     unsigned short screen_height;
+     unsigned short min_x;
+     unsigned short min_y;
+     unsigned char action;
+} PeMData;
+
+/* Global Variables */
+static unsigned char packet[PeM_PACKET_SIZE];
+
+	/* touchscreen values of left/top position  */
+static int min_x=19,min_y=1001;
+
+	/* touchscreen values of right/bottom position  */
+static int max_x=946,max_y=62;
+
+
+static inline void __mdelay(unsigned int msec){
+     struct timespec delay;
+
+     delay.tv_sec = 0;
+     delay.tv_nsec = msec * 1000000;
+     nanosleep (&delay, NULL);
+}
+
+static inline void PeMSendPacket(int file, unsigned char *packet, unsigned char len){
+	
+     write (file, packet, len);
+}
+
+static inline void PeMReadPacket(int file, unsigned char *packet){
+     int n = 0;
+     memset (packet, 0, PeM_PACKET_SIZE);
+     while ((n += read (file, packet+n, PeM_REPORT_SIZE-n)) != PeM_REPORT_SIZE);
+}
+
+static int PeMPollDevice(const char *device){
+     int file;
+     struct termios options;
+	
+     /* Make raw I/O */
+     memset (&options, 0, sizeof (struct termios));
+     
+	/* Open I/O port */
+	 file = open (device, O_RDWR | O_NOCTTY);
+	 
+	 options.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD;
+     options.c_cc[VMIN] = 1;
+     options.c_cc[VTIME] = 0;
+     
+     tcflush (file, TCIFLUSH);
+     tcsetattr (file, TCSANOW, &options);
+
+     return file;
+}
+
+static inline int PeMInitialize(int file){
+	/* it's a stub */
+	/* I dont know how get information about PenMount device... */
+	
+     return 1;
+}
+
+static int PeMOpenDevice(char *device){
+     int fd;
+     int res;
+     
+	 char *pos = strstr(device, ":raw");
+	 if (pos) {// raw data 
+	 	  max_x = min_x;
+	 	  max_y = min_y;
+	 	  *pos = 0;
+	 }
+     fd = PeMPollDevice (device);
+     if ((res = PeMInitialize (fd)) == 0) {
+          close (fd);
+          return res;
+     }
+     return fd;
+}
+
+static int convert_x(int x,PeMData *event){
+	if (max_x != min_x)
+		return .5+event->screen_width*((double)x - min_x)/(max_x - min_x);
+	else	
+		return x;
+}
+
+static int convert_y(int y,PeMData *event){
+	if (max_y != min_y)
+		return .5+event->screen_height*((double)y - min_y)/(max_y - min_y);
+	else
+		return y;
+}
+
+#define WORD_ASSEMBLY(byte1, byte2)	(((byte2) << 7) | (byte1))
+
+static int PeMGetEvent(PeMData *event){
+	
+     PeMReadPacket(event->fd, packet);
+     /* Sync bit always must be set to 1 */
+     if ((*packet & PeM_PANEL_SYNC_MASK) == 0)
+          return 0;
+     
+     if (*packet & PeM_PANEL_TOUCH_MASK)
+          event->action = PEM_PANEL_TOUCH;
+     else
+          event->action = PEM_PANEL_UNTOUCH;
+          
+	 event->y = convert_y( WORD_ASSEMBLY(packet[2], packet[1]),event);
+	 event->x = convert_x( WORD_ASSEMBLY(packet[4], packet[3]),event);
+
+     if (event->min_x)
+          event->x = event->min_x - event->x;
+     if (event->min_y)
+          event->y = event->min_y - event->y;
+
+     return 1;
+}
+
+/* The main routine for PenMount */
+static void *PenMountEventThread(DirectThread *thread, void *driver_data){
+	
+     PeMData *data = (PeMData *) driver_data;
+
+     /* Read data */
+     while (1) {
+          DFBInputEvent evt;
+          static int pressed = 0;
+
+          if (!PeMGetEvent (data))
+	       continue;
+	      direct_thread_testcancel (thread);
+
+          /* Dispatch axis */
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_X;
+          evt.axisabs = data->x;
+          dfb_input_dispatch (data->device, &evt);
+
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_Y;
+          evt.axisabs = data->y;
+          dfb_input_dispatch (data->device, &evt);
+
+          /* Dispatch touch event */
+          switch (data->action) {
+               case PEM_PANEL_TOUCH:
+               		if (!pressed)
+                    	evt.type = DIET_BUTTONPRESS;
+                    pressed = 1;
+               		break;
+               case PEM_PANEL_UNTOUCH:
+               		if (pressed)
+                    	evt.type = DIET_BUTTONRELEASE;
+                    pressed = 0;	
+                    break;
+          }
+
+          evt.flags  = DIEF_NONE;
+          evt.button = DIBI_LEFT;
+
+          dfb_input_dispatch (data->device, &evt);
+          direct_thread_testcancel (thread);
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+static int driver_get_available( void ){
+     int fd;
+
+     if (!dfb_config->penmount_device)
+          return 0;
+
+     fd = PeMOpenDevice (dfb_config->penmount_device);
+     if (fd < 0)
+          return 0;
+
+     close(fd);
+
+     return 1;
+}
+
+static void driver_get_info( InputDriverInfo *info ){
+     /* fill driver info structure */
+     snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+              "PenMount 9509" );
+     snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+              "AMT" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+static DFBResult driver_open_device(CoreInputDevice *device,
+                                    unsigned int number,
+                                    InputDeviceInfo *info,
+                                    void **driver_data){
+     int fd;
+     PeMData *data;
+    
+     /* open device */
+     fd = PeMOpenDevice (dfb_config->penmount_device);
+     if (fd < 0) {
+          D_PERROR("DirectFB/PenMount: Error opening '%s'!\n", dfb_config->penmount_device);
+          return DFB_INIT;
+     }
+
+     data = D_CALLOC (1, sizeof(PeMData));
+     if (!data) {
+          close (fd);
+          return D_OOM ();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* Must define the correct resolution of screen */
+     data->screen_width  = PeM_SCREENWIDTH;
+     data->screen_height = PeM_SCREENHEIGHT;
+
+     /* The following variable are defined to adjust the orientation of
+      * the touchscreen. Variables are either max screen height/width or 0.
+      */
+     data->min_x = PeM_MINX;
+     data->min_y = PeM_MINY;
+
+     /* fill device info structure */
+     snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+              "PenMount 9509");
+     snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,
+              "AMT");
+
+     info->prefered_id		= DIDID_MOUSE;
+     info->desc.type		= DIDTF_MOUSE;
+     info->desc.caps		= DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis	= DIAI_Y;
+     info->desc.max_button	= DIBI_LEFT;
+
+     /* start input thread */
+     data->thread = direct_thread_create (DTT_INPUT, PenMountEventThread, data, "PenMount Input");
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+                                         void        *driver_data,
+                                         DFBInputDeviceKeymapEntry *entry)
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void driver_close_device(void *driver_data){
+     PeMData *data = (PeMData *)driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel (data->thread);
+     direct_thread_join (data->thread);
+     direct_thread_destroy (data->thread);
+
+     /* close device */
+     close (data->fd);
+
+     /* free private data */
+     D_FREE (data);
+}
diff --git a/Source/DirectFB/inputdrivers/ps2mouse/Makefile.am b/Source/DirectFB/inputdrivers/ps2mouse/Makefile.am
new file mode 100755
index 0000000..30915f8
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ps2mouse/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/ps2mouse
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/src
+
+ps2mouse_LTLIBRARIES = libdirectfb_ps2mouse.la
+
+if BUILD_STATIC
+ps2mouse_DATA = $(ps2mouse_LTLIBRARIES:.la=.o)
+endif
+
+ps2mousedir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_ps2mouse_la_SOURCES =	\
+	ps2mouse.c
+
+libdirectfb_ps2mouse_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ps2mouse_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/ps2mouse/Makefile.in b/Source/DirectFB/inputdrivers/ps2mouse/Makefile.in
new file mode 100755
index 0000000..8ee00f3
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ps2mouse/Makefile.in
@@ -0,0 +1,594 @@
+# 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 = inputdrivers/ps2mouse
+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)$(ps2mousedir)" \
+	"$(DESTDIR)$(ps2mousedir)"
+ps2mouseLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(ps2mouse_LTLIBRARIES)
+libdirectfb_ps2mouse_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_ps2mouse_la_OBJECTS = ps2mouse.lo
+libdirectfb_ps2mouse_la_OBJECTS =  \
+	$(am_libdirectfb_ps2mouse_la_OBJECTS)
+libdirectfb_ps2mouse_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_ps2mouse_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_ps2mouse_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_ps2mouse_la_SOURCES)
+ps2mouseDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(ps2mouse_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_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/src
+
+ps2mouse_LTLIBRARIES = libdirectfb_ps2mouse.la
+@BUILD_STATIC_TRUE@ps2mouse_DATA = $(ps2mouse_LTLIBRARIES:.la=.o)
+ps2mousedir = $(MODULEDIR)/inputdrivers
+libdirectfb_ps2mouse_la_SOURCES = \
+	ps2mouse.c
+
+libdirectfb_ps2mouse_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ps2mouse_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  inputdrivers/ps2mouse/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/ps2mouse/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-ps2mouseLTLIBRARIES: $(ps2mouse_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(ps2mousedir)" || $(MKDIR_P) "$(DESTDIR)$(ps2mousedir)"
+	@list='$(ps2mouse_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ps2mouseLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(ps2mousedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ps2mouseLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(ps2mousedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-ps2mouseLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ps2mouse_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(ps2mousedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(ps2mousedir)/$$p"; \
+	done
+
+clean-ps2mouseLTLIBRARIES:
+	-test -z "$(ps2mouse_LTLIBRARIES)" || rm -f $(ps2mouse_LTLIBRARIES)
+	@list='$(ps2mouse_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_ps2mouse.la: $(libdirectfb_ps2mouse_la_OBJECTS) $(libdirectfb_ps2mouse_la_DEPENDENCIES) 
+	$(libdirectfb_ps2mouse_la_LINK) -rpath $(ps2mousedir) $(libdirectfb_ps2mouse_la_OBJECTS) $(libdirectfb_ps2mouse_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps2mouse.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-ps2mouseDATA: $(ps2mouse_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(ps2mousedir)" || $(MKDIR_P) "$(DESTDIR)$(ps2mousedir)"
+	@list='$(ps2mouse_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(ps2mouseDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ps2mousedir)/$$f'"; \
+	  $(ps2mouseDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ps2mousedir)/$$f"; \
+	done
+
+uninstall-ps2mouseDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ps2mouse_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(ps2mousedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(ps2mousedir)/$$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)$(ps2mousedir)" "$(DESTDIR)$(ps2mousedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-ps2mouseLTLIBRARIES \
+	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-ps2mouseDATA install-ps2mouseLTLIBRARIES
+
+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-ps2mouseDATA uninstall-ps2mouseLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-ps2mouseLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-ps2mouseDATA install-ps2mouseLTLIBRARIES 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-ps2mouseDATA \
+	uninstall-ps2mouseLTLIBRARIES
+
+%.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/inputdrivers/ps2mouse/ps2mouse.c b/Source/DirectFB/inputdrivers/ps2mouse/ps2mouse.c
new file mode 100755
index 0000000..5b0fe2d
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ps2mouse/ps2mouse.c
@@ -0,0 +1,576 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/utsname.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( ps2mouse )
+
+
+/* Stolen from the linux kernel (pc_keyb.h) */
+#define PS2_SET_RES      0xE8    /* Set resolution     */
+#define PS2_SET_SCALE11  0xE6    /* Set 1:1 scaling    */
+#define PS2_SET_SCALE21  0xE7    /* Set 2:1 scaling    */
+#define PS2_GET_SCALE    0xE9    /* Get scaling factor */
+#define PS2_SET_STREAM   0xEA    /* Set stream mode    */
+#define PS2_SET_SAMPLE   0xF3    /* Set sample rate    */
+#define PS2_ENABLE_DEV   0xF4    /* Enable aux device  */
+#define PS2_DISABLE_DEV  0xF5    /* Disable aux device */
+#define PS2_RESET        0xFF    /* Reset aux device   */
+#define PS2_ACK          0xFA    /* Command byte ACK   */
+
+/*** mouse commands ***/
+
+#define PS2_SEND_ID      0xF2
+#define PS2_ID_ERROR     -1
+#define PS2_ID_PS2       0
+#define PS2_ID_IMPS2     3
+
+static int         ndev;
+static const char *devlist[8];
+
+typedef struct {
+     int              fd;
+     CoreInputDevice *device;
+     DirectThread    *thread;
+
+     int              mouseId;
+     int              packetLength;
+
+     int              dx;
+     int              dy;
+} PS2MouseData;
+
+
+static void
+flush_xy( PS2MouseData *data )
+{
+     DFBInputEvent evt;
+
+     if (data->dx) {
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISREL;
+          evt.axis    = DIAI_X;
+          evt.axisrel = data->dx;
+
+          /* Signal immediately following event. */
+          if (data->dy)
+               evt.flags |= DIEF_FOLLOW;
+
+          dfb_input_dispatch( data->device, &evt );
+
+          data->dx = 0;
+     }
+
+     if (data->dy) {
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISREL;
+          evt.axis    = DIAI_Y;
+          evt.axisrel = data->dy;
+
+          dfb_input_dispatch( data->device, &evt );
+
+          data->dy = 0;
+     }
+}
+
+static void*
+ps2mouseEventThread( DirectThread *thread, void *driver_data )
+{
+     PS2MouseData *data  = (PS2MouseData*) driver_data;
+
+     unsigned char packet[4];
+     unsigned char pos = 0;
+     unsigned char last_buttons = 0;
+
+     int readlen;
+     unsigned char buf[256];
+
+
+     while ( (readlen = read(data->fd, buf, 256)) > 0 ) {
+          int i;
+
+          direct_thread_testcancel( thread );
+
+          for ( i = 0; i < readlen; i++ ) {
+
+               if ( pos == 0  &&  (buf[i] & 0xc0) ) {
+                    continue;
+               }
+               packet[pos++] = buf[i];
+               if ( pos == data->packetLength ) {
+                    int dx, dy, dz;
+                    int buttons;
+
+                    pos = 0;
+
+                    if ( !(packet[0] & 0x08) ) {
+                         /* We've lost sync! */
+                         i--;    /* does this make sense? oh well,
+                                    it will resync eventually (will it ?)*/
+                         continue;
+                    }
+
+                    buttons = packet[0] & 0x07;
+                    dx = (packet[0] & 0x10) ?   packet[1]-256  :  packet[1];
+                    dy = (packet[0] & 0x20) ? -(packet[2]-256) : -packet[2];
+                    if (data->mouseId == PS2_ID_IMPS2) {
+                         /* Just strip off the extra buttons if present
+                            and sign extend the 4 bit value */
+                         dz = (s8)((packet[3] & 0x80) ?
+                                      packet[3] | 0xf0 : packet[3] & 0x0F);
+                         if (dz) {
+                              DFBInputEvent evt;
+
+                              evt.type    = DIET_AXISMOTION;
+                              evt.flags   = DIEF_AXISREL;
+                              evt.axis    = DIAI_Z;
+                              evt.axisrel = dz;
+
+                              flush_xy( data );
+
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                    }
+                    else {
+                         dz = 0;
+                    }
+
+                    data->dx += dx;
+                    data->dy += dy;
+
+                    if ( !dfb_config->mouse_motion_compression )
+                         flush_xy( data );
+
+                    if ( last_buttons != buttons ) {
+                         DFBInputEvent evt;
+                         unsigned char changed_buttons;
+
+                         changed_buttons = last_buttons ^ buttons;
+
+                         /* make sure the compressed motion event is dispatched
+                            before any button change */
+                         flush_xy( data );
+
+                         if ( changed_buttons & 0x01 ) {
+                              evt.type = (buttons & 0x01) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_LEFT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if ( changed_buttons & 0x02 ) {
+                              evt.type = (buttons & 0x02) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_RIGHT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if ( changed_buttons & 0x04 ) {
+                              evt.type = (buttons & 0x04) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_MIDDLE;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+
+                         last_buttons = buttons;
+                    }
+               }
+          }
+          /* make sure the compressed motion event is dispatched,
+             necessary if the last packet was a motion event */
+          flush_xy( data );
+     }
+
+     if ( readlen <= 0 && errno != EINTR )
+          D_PERROR ("psmouse thread died\n");
+
+     return NULL;
+}
+
+
+static int
+ps2WriteChar( int fd, unsigned char c, bool verbose )
+{
+     struct timeval tv;
+     fd_set fds;
+
+     tv.tv_sec = 0;
+     tv.tv_usec = 200000;       /*  timeout 200 ms  */
+
+     FD_ZERO( &fds );
+     FD_SET( fd, &fds );
+
+     write( fd, &c, 1 );
+
+     if ( select(fd+1, &fds, NULL, NULL, &tv) == 0 ) {
+          if ( verbose )
+               D_ERROR( "DirectFB/PS2Mouse: timeout waiting for ack!!\n" );
+          return -1;
+     }
+
+     read( fd, &c, 1 );
+
+     if ( c != PS2_ACK )
+          return -2;
+
+     return 0;
+}
+
+
+static int
+ps2GetId( int fd, bool verbose )
+{
+     unsigned char c;
+
+     if ( ps2WriteChar(fd, PS2_SEND_ID, verbose) < 0 )
+          return PS2_ID_ERROR;
+
+     read( fd, &c, 1 );
+
+     return( c );
+}
+
+
+static int
+ps2Write( int fd, const unsigned char *data, size_t len, bool verbose)
+{
+     size_t i;
+     int    error = 0;
+
+     for ( i = 0; i < len; i++ ) {
+          if ( ps2WriteChar(fd, data[i], verbose) < 0 ) {
+               if ( verbose )
+                    D_ERROR( "DirectFB/PS2Mouse: error @byte %zu\n", i );
+               error++;
+          }
+     }
+
+     if ( error && verbose )
+          D_ERROR( "DirectFB/PS2Mouse: missed %i ack's!\n", error);
+
+     return( error );
+}
+
+
+static int
+init_ps2( int fd, bool verbose )
+{
+     static const unsigned char basic_init[] =
+     { PS2_ENABLE_DEV, PS2_SET_SAMPLE, 100 };
+     static const unsigned char imps2_init[] =
+     { PS2_SET_SAMPLE, 200, PS2_SET_SAMPLE, 100, PS2_SET_SAMPLE, 80 };
+     static const unsigned char ps2_init[] =
+     { PS2_SET_SCALE11, PS2_ENABLE_DEV, PS2_SET_SAMPLE, 100, PS2_SET_RES, 3 };
+     int mouseId;
+
+     struct timeval tv;
+     fd_set fds;
+     int count = 100;
+
+     /* read all data from the file descriptor before initializing the mouse */
+     while (true) {
+          unsigned char buf[64];
+
+          tv.tv_sec  = 0;
+          tv.tv_usec = 50000;       /*  timeout 1/50 sec  */
+
+          FD_ZERO( &fds );
+          FD_SET( fd, &fds );
+
+          if (select( fd+1, &fds, NULL, NULL, &tv ))
+               read( fd, buf, sizeof(buf) );
+          else
+               break;
+
+          if (! --count) {
+               D_ERROR( "DirectFB/PS2Mouse: "
+                         "PS/2 mouse keeps sending data, "
+                         "initialization failed\n" );
+               return -1;
+          }
+     }
+
+     ps2Write( fd, basic_init, sizeof (basic_init), verbose );
+     /* Do a basic init in case the mouse is confused */
+     if (ps2Write( fd, basic_init, sizeof (basic_init), verbose ) != 0) {
+          if (verbose)
+               D_ERROR( "DirectFB/PS2Mouse: PS/2 mouse failed init\n" );
+          return -1;
+     }
+
+     ps2Write( fd, ps2_init, sizeof (ps2_init), verbose );
+
+     if (ps2Write(fd, imps2_init, sizeof (imps2_init), verbose) != 0) {
+          if (verbose)
+               D_ERROR ("DirectFB/PS2Mouse: mouse failed IMPS/2 init\n");
+          return -2;
+     }
+
+     if ((mouseId = ps2GetId( fd, verbose )) < 0)
+          return mouseId;
+
+     if ( mouseId != PS2_ID_IMPS2 )   /*  unknown id, assume PS/2  */
+          mouseId = PS2_ID_PS2;
+
+     return mouseId;
+}
+
+/**************************************************************************************************/
+
+static void
+check_devices( const char *devnames[], int num )
+{
+     int i, fd;
+
+     for (i=0; i<num; i++) {
+          if ((fd = open( devnames[i], O_RDWR | O_SYNC )) < 0)
+               continue;
+
+          if (init_ps2( fd, false ) < 0) {
+               close( fd );
+               continue;
+          }
+
+          devlist[ndev++] = devnames[i];
+
+          close( fd );
+
+          break;
+     }
+}
+
+#define CHECK_DEVICES(n)  check_devices( n, D_ARRAY_SIZE(n) )
+
+/**************************************************************************************************/
+
+static const char *dev_psaux[2] = { "/dev/psaux", "/dev/misc/psaux" };
+static const char *dev_input[1] = { "/dev/input/mice" };
+
+/**************************************************************************************************/
+
+static int
+driver_get_available( void )
+{
+     struct utsname uts;
+     bool           check_psaux = true;
+     bool           check_input = true;
+
+     if (dfb_system_type() != CORE_FBDEV)
+          return 0;
+
+     if (dfb_config->mouse_protocol   &&
+        (strcasecmp( dfb_config->mouse_protocol, "PS/2")   == 0 ||
+         strcasecmp( dfb_config->mouse_protocol, "IMPS/2") == 0))
+     {
+          int fd = open( dfb_config->mouse_source, O_RDONLY | O_NONBLOCK );
+
+          if (fd < 0) {
+               D_PERROR( "DirectFB/PS2Mouse: opening %s failed!\n",
+                         dfb_config->mouse_source );
+               return 0;
+          }
+          
+          devlist[0] = dfb_config->mouse_source;
+          close( fd );
+          return 1;
+     }
+
+     if (uname( &uts ) < 0)
+          D_PERROR( "DirectFB/PS2Mouse: uname() failed!\n" );
+     else if (!strncmp( uts.release, "2.6.", 4 ) || !strncmp( uts.release, "2.5.", 4 ))
+          check_psaux = false;
+
+     if (check_psaux)
+          CHECK_DEVICES( dev_psaux );
+
+     if (check_input)
+          CHECK_DEVICES( dev_input );
+
+     return ndev;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "PS/2 Mouse Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 1;
+     info->version.minor = 0;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int           fd;
+     int           mouseId = -1;
+     int           flags;
+     PS2MouseData *data;
+
+     /* open device */
+
+     flags = (dfb_config->mouse_gpm_source)
+             ? (O_RDONLY | O_NONBLOCK)
+             : (O_RDWR | O_SYNC | O_EXCL);
+     
+     fd = open( devlist[number], flags );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/PS2Mouse: failed opening `%s' !\n",
+                     devlist[number] );
+          close( fd );
+          return DFB_INIT;
+     }
+
+     fcntl( fd, F_SETFL, fcntl ( fd, F_GETFL ) & ~O_NONBLOCK );
+ 
+     if (!dfb_config->mouse_gpm_source) {
+          mouseId = init_ps2( fd, true );
+          
+          if (mouseId  < 0) {
+               D_PERROR( "DirectFB/PS2Mouse: could not initialize mouse on `%s'!\n",
+                          devlist[number] );
+               close( fd );
+               return DFB_INIT;
+          }
+     }
+
+     if (dfb_config->mouse_protocol) {
+          if (strcasecmp( dfb_config->mouse_protocol, "IMPS/2" ) == 0) {
+               mouseId = PS2_ID_IMPS2;
+          } 
+          else if (strcasecmp( dfb_config->mouse_protocol, "PS/2" ) == 0) {
+               mouseId = PS2_ID_PS2;
+          } 
+          else {
+               D_ERROR( "DirectFB/PS2Mouse: unsupported protocol `%s' !\n",
+                         dfb_config->mouse_protocol );
+               close( fd );
+               return DFB_INIT;
+          }
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+               (mouseId == PS2_ID_IMPS2) ? "IMPS/2 Mouse" : "PS/2 Mouse" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id     = DIDID_MOUSE;
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = (mouseId == PS2_ID_IMPS2) ? DIAI_Z : DIAI_Y;
+     info->desc.max_button = DIBI_MIDDLE;     /* TODO: probe!? */
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(PS2MouseData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd           = fd;
+     data->device       = device;
+     data->mouseId      = mouseId;
+     data->packetLength = (mouseId == PS2_ID_IMPS2) ? 4 : 3;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, ps2mouseEventThread, data, "PS/2 Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     PS2MouseData *data = (PS2MouseData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE( data );
+}
diff --git a/Source/DirectFB/inputdrivers/serialmouse/Makefile.am b/Source/DirectFB/inputdrivers/serialmouse/Makefile.am
new file mode 100755
index 0000000..13f5744
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/serialmouse/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/inputdrivers/serialmouse
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+serialmouse_LTLIBRARIES = libdirectfb_serialmouse.la
+
+if BUILD_STATIC
+serialmouse_DATA = $(serialmouse_LTLIBRARIES:.la=.o)
+endif
+
+serialmousedir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_serialmouse_la_SOURCES = serialmouse.c
+
+libdirectfb_serialmouse_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_serialmouse_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/serialmouse/Makefile.in b/Source/DirectFB/inputdrivers/serialmouse/Makefile.in
new file mode 100755
index 0000000..682ce14
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/serialmouse/Makefile.in
@@ -0,0 +1,595 @@
+# 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 = inputdrivers/serialmouse
+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)$(serialmousedir)" \
+	"$(DESTDIR)$(serialmousedir)"
+serialmouseLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(serialmouse_LTLIBRARIES)
+libdirectfb_serialmouse_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_serialmouse_la_OBJECTS = serialmouse.lo
+libdirectfb_serialmouse_la_OBJECTS =  \
+	$(am_libdirectfb_serialmouse_la_OBJECTS)
+libdirectfb_serialmouse_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libdirectfb_serialmouse_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_serialmouse_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_serialmouse_la_SOURCES)
+serialmouseDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(serialmouse_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+serialmouse_LTLIBRARIES = libdirectfb_serialmouse.la
+@BUILD_STATIC_TRUE@serialmouse_DATA = $(serialmouse_LTLIBRARIES:.la=.o)
+serialmousedir = $(MODULEDIR)/inputdrivers
+libdirectfb_serialmouse_la_SOURCES = serialmouse.c
+libdirectfb_serialmouse_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_serialmouse_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  inputdrivers/serialmouse/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/serialmouse/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-serialmouseLTLIBRARIES: $(serialmouse_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(serialmousedir)" || $(MKDIR_P) "$(DESTDIR)$(serialmousedir)"
+	@list='$(serialmouse_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(serialmouseLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(serialmousedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(serialmouseLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(serialmousedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-serialmouseLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(serialmouse_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(serialmousedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(serialmousedir)/$$p"; \
+	done
+
+clean-serialmouseLTLIBRARIES:
+	-test -z "$(serialmouse_LTLIBRARIES)" || rm -f $(serialmouse_LTLIBRARIES)
+	@list='$(serialmouse_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_serialmouse.la: $(libdirectfb_serialmouse_la_OBJECTS) $(libdirectfb_serialmouse_la_DEPENDENCIES) 
+	$(libdirectfb_serialmouse_la_LINK) -rpath $(serialmousedir) $(libdirectfb_serialmouse_la_OBJECTS) $(libdirectfb_serialmouse_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialmouse.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-serialmouseDATA: $(serialmouse_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(serialmousedir)" || $(MKDIR_P) "$(DESTDIR)$(serialmousedir)"
+	@list='$(serialmouse_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(serialmouseDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(serialmousedir)/$$f'"; \
+	  $(serialmouseDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(serialmousedir)/$$f"; \
+	done
+
+uninstall-serialmouseDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(serialmouse_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(serialmousedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(serialmousedir)/$$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)$(serialmousedir)" "$(DESTDIR)$(serialmousedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-serialmouseLTLIBRARIES \
+	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-serialmouseDATA \
+	install-serialmouseLTLIBRARIES
+
+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-serialmouseDATA \
+	uninstall-serialmouseLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-serialmouseLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-serialmouseDATA install-serialmouseLTLIBRARIES \
+	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-serialmouseDATA uninstall-serialmouseLTLIBRARIES
+
+%.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/inputdrivers/serialmouse/serialmouse.c b/Source/DirectFB/inputdrivers/serialmouse/serialmouse.c
new file mode 100755
index 0000000..3aba563
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/serialmouse/serialmouse.c
@@ -0,0 +1,572 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( serialmouse )
+
+#define MIDDLE   0x08
+
+typedef enum
+{
+     PROTOCOL_MS,           /* two buttons MS protocol                            */
+     PROTOCOL_MS3,          /* MS with ugly 3-button extension                    */
+     PROTOCOL_MOUSEMAN,     /* referred to as MS + Logitech extension in mouse(4) */
+     PROTOCOL_MOUSESYSTEMS, /* most commonly used serial mouse protocol nowadays  */
+     LAST_PROTOCOL
+} MouseProtocol;
+
+static const char *protocol_names[LAST_PROTOCOL] =
+{
+     "MS",
+     "MS3",
+     "MouseMan",
+     "MouseSystems"
+};
+
+typedef struct {
+     CoreInputDevice   *device;
+     DirectThread  *thread;
+
+     int            fd;
+
+     MouseProtocol  protocol;
+
+     DFBInputEvent  x_motion;
+     DFBInputEvent  y_motion;
+} SerialMouseData;
+
+static inline void
+mouse_motion_initialize( SerialMouseData *data )
+{
+     data->x_motion.type    = data->y_motion.type    = DIET_AXISMOTION;
+     data->x_motion.axisrel = data->y_motion.axisrel = 0;
+
+     data->x_motion.axis    = DIAI_X;
+     data->y_motion.axis    = DIAI_Y;
+}
+
+static inline void
+mouse_motion_compress( SerialMouseData *data, int dx, int dy )
+{
+     data->x_motion.axisrel += dx;
+     data->y_motion.axisrel += dy;
+}
+
+static inline void
+mouse_motion_realize( SerialMouseData *data )
+{
+     if (data->x_motion.axisrel) {
+          data->x_motion.flags = DIEF_AXISREL;
+          dfb_input_dispatch( data->device, &data->x_motion );
+          data->x_motion.axisrel = 0;
+     }
+
+     if (data->y_motion.axisrel) {
+          data->y_motion.flags = DIEF_AXISREL;
+          dfb_input_dispatch( data->device, &data->y_motion );
+          data->y_motion.axisrel = 0;
+     }
+}
+
+
+static void
+mouse_setspeed( SerialMouseData *data )
+{
+     struct termios tty;
+
+     tcgetattr (data->fd, &tty);
+
+     tty.c_iflag     = IGNBRK | IGNPAR;
+     tty.c_oflag     = 0;
+     tty.c_lflag     = 0;
+     tty.c_line      = 0;
+     tty.c_cc[VTIME] = 0;
+     tty.c_cc[VMIN]  = 1;
+     tty.c_cflag     = CREAD|CLOCAL|HUPCL|B1200;
+     tty.c_cflag    |= ((data->protocol == PROTOCOL_MOUSESYSTEMS) ?
+                        CS8|CSTOPB : CS7);
+
+     tcsetattr (data->fd, TCSAFLUSH, &tty);
+
+     write (data->fd, "*n", 2);
+}
+
+/* the main routine for MS mice (plus extensions) */
+static void*
+mouseEventThread_ms( DirectThread *thread, void *driver_data )
+{
+     SerialMouseData *data = (SerialMouseData*) driver_data;
+     DFBInputEvent    evt;
+
+     unsigned char buf[256];
+     unsigned char packet[4];
+     unsigned char pos = 0;
+     unsigned char last_buttons = 0;
+     int dx, dy;
+     int buttons;
+     int readlen;
+     int i;
+
+     mouse_motion_initialize( data );
+
+     /* Read data */
+     while ((readlen = read( data->fd, buf, 256 )) >= 0 || errno == EINTR) {
+
+          direct_thread_testcancel( thread );
+
+          for (i = 0; i < readlen; i++) {
+
+               if (pos == 0  && !(buf[i] & 0x40))
+                    continue;
+
+               /* We did not reset the position in the mouse event handler
+                  since a forth byte may follow. We check for it now and
+                  reset the position if this is a start byte. */
+               if (pos == 3 && buf[i] & 0x40)
+                    pos = 0;
+
+               packet[pos++] = buf[i];
+
+               switch (pos) {
+               case 3:
+                    if (data->protocol != PROTOCOL_MOUSEMAN)
+                         pos = 0;
+
+                    buttons = packet[0] & 0x30;
+                    dx = (signed char)
+                         (((packet[0] & 0x03) << 6) | (packet[1] & 0x3f));
+                    dy = (signed char)
+                         (((packet[0] & 0x0C) << 4) | (packet[2] & 0x3f));
+
+                    mouse_motion_compress( data, dx, dy );
+
+                    if (data->protocol == PROTOCOL_MS3) {
+                         if (!dx && !dy && buttons == (last_buttons & ~MIDDLE))
+                              buttons = last_buttons ^ MIDDLE;  /* toggle    */
+                         else
+                              buttons |= last_buttons & MIDDLE; /* preserve  */
+                    }
+
+                    if (!dfb_config->mouse_motion_compression)
+                         mouse_motion_realize( data );
+
+                    if (last_buttons != buttons) {
+                         unsigned char changed_buttons = last_buttons ^ buttons;
+
+                         /* make sure the compressed motion event is dispatched
+                            before any button change */
+                         mouse_motion_realize( data );
+
+                         if (changed_buttons & 0x20) {
+                              evt.type = (buttons & 0x20) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_LEFT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if (changed_buttons & 0x10) {
+                              evt.type = (buttons & 0x10) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_RIGHT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if (changed_buttons & MIDDLE) {
+                              evt.type = (buttons & MIDDLE) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE;
+                              evt.button = DIBI_MIDDLE;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+
+                         last_buttons = buttons;
+                    }
+                    break;
+
+               case 4:
+                    pos = 0;
+
+                    evt.type = (packet[3] & 0x20) ?
+                         DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                    evt.flags = DIEF_NONE; /* button is always valid */
+                    evt.button = DIBI_MIDDLE;
+                    dfb_input_dispatch( data->device, &evt );
+                    break;
+
+               default:
+                    break;
+               }
+          }
+
+          /* make sure the compressed motion event is dispatched,
+             necessary if the last packet was a motion event */
+          if (readlen > 0)
+               mouse_motion_realize( data );
+
+          direct_thread_testcancel( thread );
+     }
+
+     D_PERROR ("serial mouse thread died\n");
+
+     return NULL;
+}
+
+/* the main routine for MouseSystems */
+static void*
+mouseEventThread_mousesystems( DirectThread *thread, void *driver_data )
+{
+     SerialMouseData *data = (SerialMouseData*) driver_data;
+
+     unsigned char buf[256];
+     unsigned char packet[5];
+     unsigned char pos = 0;
+     unsigned char last_buttons = 0;
+     int i;
+     int readlen;
+
+     mouse_motion_initialize( data );
+
+     /* Read data */
+     while ((readlen = read( data->fd, buf, 256 )) >= 0 || errno == EINTR) {
+
+          direct_thread_testcancel( thread );
+
+          for (i = 0; i < readlen; i++) {
+
+               if (pos == 0  && (buf[i] & 0xf8) != 0x80)
+                    continue;
+
+               packet[pos++] = buf[i];
+
+               if (pos == 5) {
+                    int dx, dy;
+                    int buttons;
+
+                    pos = 0;
+
+                    buttons= (~packet[0]) & 0x07;
+                    dx =    (signed char) (packet[1]) + (signed char)(packet[3]);
+                    dy = - ((signed char) (packet[2]) + (signed char)(packet[4]));
+
+                    mouse_motion_compress( data, dx, dy );
+
+                    if (!dfb_config->mouse_motion_compression)
+                         mouse_motion_realize( data );
+
+                    if (last_buttons != buttons) {
+                         DFBInputEvent evt;
+                         unsigned char changed_buttons = last_buttons ^ buttons;
+
+                         /* make sure the compressed motion event is dispatched
+                            before any button change */
+                         mouse_motion_realize( data );
+
+                         if (changed_buttons & 0x04) {
+                              evt.type = (buttons & 0x04) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE; /* button is always valid */
+                              evt.button = DIBI_LEFT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if (changed_buttons & 0x01) {
+                              evt.type = (buttons & 0x01) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE; /* button is always valid */
+                              evt.button = DIBI_MIDDLE;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+                         if (changed_buttons & 0x02) {
+                              evt.type = (buttons & 0x02) ?
+                                   DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+                              evt.flags = DIEF_NONE; /* button is always valid */
+                              evt.button = DIBI_RIGHT;
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+
+                         last_buttons = buttons;
+                    }
+               }
+          }
+
+          /* make sure the compressed motion event is dispatched,
+             necessary if the last packet was a motion event */
+          if (readlen > 0)
+               mouse_motion_realize( data );
+
+          direct_thread_testcancel( thread );
+     }
+
+     D_PERROR ("serial mouse thread died\n");
+
+     return NULL;
+}
+
+static MouseProtocol mouse_get_protocol( void )
+{
+     MouseProtocol protocol;
+
+     if (!dfb_config->mouse_protocol)
+          return LAST_PROTOCOL;
+
+     for (protocol = 0; protocol < LAST_PROTOCOL; protocol++) {
+          if (strcasecmp (dfb_config->mouse_protocol,
+                          protocol_names[protocol]) == 0)
+               break;
+     }
+
+     return protocol;
+}
+
+/* exported symbols */
+
+static int
+driver_get_available( void )
+{
+     struct serial_struct serial_info;
+     struct timeval       timeout;
+     MouseProtocol        protocol;
+     fd_set               set;
+     int                  fd;
+     char                 buf[8];
+     int                  readlen;
+     int                  lines;
+     int                  flags;
+
+     if (dfb_system_type() != CORE_FBDEV)
+          return 0;
+
+     protocol = mouse_get_protocol();
+     if (protocol == LAST_PROTOCOL)
+          return 0;
+
+     /* initialize source device name to read from */
+     /* initialize flags to open device with */
+     flags = O_NONBLOCK;
+     D_INFO( "DirectFB/SerialMouse: mouse detection on device '%s'...", dfb_config->mouse_source );
+
+     /* open device to read from */
+     fd = open( dfb_config->mouse_source, flags );
+     if (fd < 0) {
+          D_INFO( "DirectFB/SerialMouse: could not open device '%s'!\n", dfb_config->mouse_source );
+          return 0;
+     }
+
+     /*  test if this is a serial device  */
+     if (dfb_config->mouse_gpm_source) {
+
+          /* test whether a there is really a GPM driver active */
+          /* availibity of device name is enough */
+
+          goto success;
+
+     }
+     else {
+          if (ioctl( fd, TIOCGSERIAL, &serial_info ))
+               goto error;
+
+          /*  test if there's a mouse connected by lowering and raising RTS  */
+          if (ioctl( fd, TIOCMGET, &lines ))
+               goto error;
+
+          lines ^= TIOCM_RTS;
+          if (ioctl( fd, TIOCMSET, &lines ))
+               goto error;
+          usleep (1000);
+          lines |= TIOCM_RTS;
+          if (ioctl( fd, TIOCMSET, &lines ))
+               goto error;
+
+          /*  wait for the mouse to send 0x4D  */
+          FD_ZERO (&set);
+          FD_SET (fd, &set);
+          timeout.tv_sec  = 0;
+          timeout.tv_usec = 50000;
+
+          while (select (fd+1, &set, NULL, NULL, &timeout) < 0 && errno == EINTR);
+
+          if (FD_ISSET (fd, &set) && (readlen = read (fd, buf, 8) > 0)) {
+               int i;
+
+               for (i=0; i<readlen; i++) {
+                    if (buf[i] == 0x4D)
+                         break;
+               }
+               if (i < readlen)
+                    goto success;
+          }
+     }
+
+error:
+     D_INFO("DirectFB/SerialMouse: Failed\n");
+     close (fd);
+     return 0;
+
+success:
+     D_INFO("DirectFB/SerialMouse: OK\n");
+     close (fd);
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "Serial Mouse Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 2;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int              fd;
+     int              flags;
+     MouseProtocol    protocol;
+     SerialMouseData *data;
+
+     protocol = mouse_get_protocol();
+     if (protocol == LAST_PROTOCOL) /* shouldn't happen */
+          return DFB_BUG;
+
+     /* open device */
+     flags = O_NONBLOCK | (dfb_config->mouse_gpm_source ? O_RDONLY : O_RDWR);
+     fd = open( dfb_config->mouse_source, flags );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/SerialMouse: Error opening '%s'!\n", dfb_config->mouse_source );
+          return DFB_INIT;
+     }
+
+     /* reset the O_NONBLOCK flag */
+     fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) & ~O_NONBLOCK);
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(SerialMouseData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd       = fd;
+     data->device   = device;
+     data->protocol = protocol;
+
+     mouse_setspeed( data );
+
+     /* fill device info structure */
+     snprintf( info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+               "Serial Mouse (%s)", protocol_names[protocol] );
+
+     snprintf( info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id     = DIDID_MOUSE;
+
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = (protocol > PROTOCOL_MS) ? DIBI_MIDDLE : DIBI_RIGHT;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, protocol == PROTOCOL_MOUSESYSTEMS ?
+                                          mouseEventThread_mousesystems : mouseEventThread_ms,
+                                          data, "SerMouse Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     SerialMouseData *data = (SerialMouseData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/sonypi/Makefile.am b/Source/DirectFB/inputdrivers/sonypi/Makefile.am
new file mode 100755
index 0000000..7851e0e
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/sonypi/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/sonypi
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+sonypi_LTLIBRARIES = libdirectfb_sonypi.la
+
+if BUILD_STATIC
+sonypi_DATA = $(sonypi_LTLIBRARIES:.la=.o)
+endif
+
+sonypidir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_sonypi_la_SOURCES =	\
+	sonypi.c
+
+libdirectfb_sonypi_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sonypi_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/sonypi/Makefile.in b/Source/DirectFB/inputdrivers/sonypi/Makefile.in
new file mode 100755
index 0000000..65b7d32
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/sonypi/Makefile.in
@@ -0,0 +1,592 @@
+# 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 = inputdrivers/sonypi
+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)$(sonypidir)" "$(DESTDIR)$(sonypidir)"
+sonypiLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(sonypi_LTLIBRARIES)
+libdirectfb_sonypi_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_sonypi_la_OBJECTS = sonypi.lo
+libdirectfb_sonypi_la_OBJECTS = $(am_libdirectfb_sonypi_la_OBJECTS)
+libdirectfb_sonypi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_sonypi_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_sonypi_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_sonypi_la_SOURCES)
+sonypiDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(sonypi_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+sonypi_LTLIBRARIES = libdirectfb_sonypi.la
+@BUILD_STATIC_TRUE@sonypi_DATA = $(sonypi_LTLIBRARIES:.la=.o)
+sonypidir = $(MODULEDIR)/inputdrivers
+libdirectfb_sonypi_la_SOURCES = \
+	sonypi.c
+
+libdirectfb_sonypi_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_sonypi_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  inputdrivers/sonypi/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/sonypi/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-sonypiLTLIBRARIES: $(sonypi_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(sonypidir)" || $(MKDIR_P) "$(DESTDIR)$(sonypidir)"
+	@list='$(sonypi_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sonypiLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(sonypidir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sonypiLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(sonypidir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-sonypiLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sonypi_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(sonypidir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(sonypidir)/$$p"; \
+	done
+
+clean-sonypiLTLIBRARIES:
+	-test -z "$(sonypi_LTLIBRARIES)" || rm -f $(sonypi_LTLIBRARIES)
+	@list='$(sonypi_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_sonypi.la: $(libdirectfb_sonypi_la_OBJECTS) $(libdirectfb_sonypi_la_DEPENDENCIES) 
+	$(libdirectfb_sonypi_la_LINK) -rpath $(sonypidir) $(libdirectfb_sonypi_la_OBJECTS) $(libdirectfb_sonypi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sonypi.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-sonypiDATA: $(sonypi_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(sonypidir)" || $(MKDIR_P) "$(DESTDIR)$(sonypidir)"
+	@list='$(sonypi_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(sonypiDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sonypidir)/$$f'"; \
+	  $(sonypiDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sonypidir)/$$f"; \
+	done
+
+uninstall-sonypiDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sonypi_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(sonypidir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(sonypidir)/$$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)$(sonypidir)" "$(DESTDIR)$(sonypidir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-sonypiLTLIBRARIES \
+	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-sonypiDATA install-sonypiLTLIBRARIES
+
+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-sonypiDATA uninstall-sonypiLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-sonypiLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-sonypiDATA install-sonypiLTLIBRARIES 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-sonypiDATA \
+	uninstall-sonypiLTLIBRARIES
+
+%.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/inputdrivers/sonypi/sonypi.c b/Source/DirectFB/inputdrivers/sonypi/sonypi.c
new file mode 100755
index 0000000..0632d25
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/sonypi/sonypi.c
@@ -0,0 +1,265 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include <fcntl.h>
+
+#include <linux/sonypi.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( sonypi )
+
+#define DEVICE "/dev/sonypi"
+
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+
+     int           fd;
+} SonypiData;
+
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+sonypiEventThread( DirectThread *thread, void *driver_data )
+{
+     SonypiData    *data = (SonypiData*) driver_data;
+     int            readlen;
+     u8             buffer[16];
+
+     /* loop until error occurs except EINTR */
+     while ((readlen = read( data->fd, buffer, 16 )) > 0 || errno == EINTR) {
+          int           i;
+          DFBInputEvent evt;
+
+          direct_thread_testcancel( thread );
+
+          /* process each byte */
+          for (i=0; i<readlen; i++) {
+
+               /* check for jogdial events */
+               switch (buffer[i]) {
+                    case SONYPI_EVENT_JOGDIAL_DOWN:
+                    case SONYPI_EVENT_JOGDIAL_UP:
+                    case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED:
+                    case SONYPI_EVENT_JOGDIAL_UP_PRESSED:
+                         evt.type  = DIET_AXISMOTION;
+                         evt.axis  = DIAI_Z;
+                         evt.flags = DIEF_AXISREL;
+
+                         if (buffer[i] == SONYPI_EVENT_JOGDIAL_DOWN ||
+                             buffer[i] == SONYPI_EVENT_JOGDIAL_DOWN_PRESSED)
+                              evt.axisrel = 1;
+                         else
+                              evt.axisrel = -1;
+
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+
+                    case SONYPI_EVENT_JOGDIAL_PRESSED:
+                    case SONYPI_EVENT_JOGDIAL_RELEASED:
+                         if (buffer[i] == SONYPI_EVENT_JOGDIAL_PRESSED)
+                              evt.type = DIET_BUTTONPRESS;
+                         else
+                              evt.type = DIET_BUTTONRELEASE;
+
+                         evt.flags  = DIEF_NONE; /* button is always valid */
+                         evt.button = DIBI_MIDDLE;
+
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+
+                    default:
+                         ;
+               }
+          }
+     }
+
+     if (readlen < 0)
+          D_PERROR ("sonypi thread died\n");
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     int fd;
+
+     /* Check if we are able to open device for reading */
+     if ((fd = open( DEVICE, O_RDONLY )) < 0)
+        return 0;
+
+     close(fd);
+
+     return 1;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "SonyPI Jogdial Driver" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Denis Oliver Kropp" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int         fd;
+     SonypiData *data;
+
+     /* open device */
+     fd = open( DEVICE, O_RDONLY);
+     if (fd < 0) {
+          D_PERROR( "DirectFB/sonypi: could not open device" );
+          return DFB_INIT;
+     }
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "PI Jogdial" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Sony" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_MOUSE;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_MOUSE;
+
+     /* set capabilities */
+     info->desc.caps       = DICAPS_BUTTONS | DICAPS_AXES;
+     info->desc.max_axis   = DIAI_Z;
+     info->desc.max_button = DIBI_MIDDLE;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(SonypiData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, sonypiEventThread, data, "Sony PI Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     SonypiData *data = (SonypiData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close file */
+     close( data->fd );
+
+     /* free private data */
+     D_FREE ( data );
+}
+
diff --git a/Source/DirectFB/inputdrivers/tslib/Makefile.am b/Source/DirectFB/inputdrivers/tslib/Makefile.am
new file mode 100755
index 0000000..5bca495
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/tslib/Makefile.am
@@ -0,0 +1,33 @@
+## Makefile.am for DirectFB/inputdrivers/tslib
+
+INCLUDES = \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir)/lib \
+	-I$(top_srcdir)/lib \
+	-I$(top_srcdir)/src
+
+tslib_LTLIBRARIES = libdirectfb_tslib.la
+
+if BUILD_STATIC
+tslib_DATA = $(tslib_LTLIBRARIES:.la=.o)
+endif
+
+tslibdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_tslib_la_SOURCES = \
+	tslib.c
+
+libdirectfb_tslib_la_CFLAGS = \
+	$(TSLIB_CFLAGS)
+
+libdirectfb_tslib_la_LDFLAGS = \
+	-module \
+	-avoid-version \
+	$(DFB_LDFLAGS)
+
+libdirectfb_tslib_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(TSLIB_LIBS)
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/inputdrivers/tslib/Makefile.in b/Source/DirectFB/inputdrivers/tslib/Makefile.in
new file mode 100755
index 0000000..f630293
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/tslib/Makefile.in
@@ -0,0 +1,605 @@
+# 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 = inputdrivers/tslib
+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)$(tslibdir)" "$(DESTDIR)$(tslibdir)"
+tslibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(tslib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libdirectfb_tslib_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_tslib_la_OBJECTS = libdirectfb_tslib_la-tslib.lo
+libdirectfb_tslib_la_OBJECTS = $(am_libdirectfb_tslib_la_OBJECTS)
+libdirectfb_tslib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(libdirectfb_tslib_la_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_tslib_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_tslib_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_tslib_la_SOURCES)
+tslibDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(tslib_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_srcdir)/include \
+	-I$(top_builddir)/lib \
+	-I$(top_srcdir)/lib \
+	-I$(top_srcdir)/src
+
+tslib_LTLIBRARIES = libdirectfb_tslib.la
+@BUILD_STATIC_TRUE@tslib_DATA = $(tslib_LTLIBRARIES:.la=.o)
+tslibdir = $(MODULEDIR)/inputdrivers
+libdirectfb_tslib_la_SOURCES = \
+	tslib.c
+
+libdirectfb_tslib_la_CFLAGS = \
+	$(TSLIB_CFLAGS)
+
+libdirectfb_tslib_la_LDFLAGS = \
+	-module \
+	-avoid-version \
+	$(DFB_LDFLAGS)
+
+libdirectfb_tslib_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(TSLIB_LIBS)
+
+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  inputdrivers/tslib/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/tslib/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-tslibLTLIBRARIES: $(tslib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(tslibdir)" || $(MKDIR_P) "$(DESTDIR)$(tslibdir)"
+	@list='$(tslib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(tslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(tslibdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(tslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(tslibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-tslibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(tslib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(tslibdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(tslibdir)/$$p"; \
+	done
+
+clean-tslibLTLIBRARIES:
+	-test -z "$(tslib_LTLIBRARIES)" || rm -f $(tslib_LTLIBRARIES)
+	@list='$(tslib_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_tslib.la: $(libdirectfb_tslib_la_OBJECTS) $(libdirectfb_tslib_la_DEPENDENCIES) 
+	$(libdirectfb_tslib_la_LINK) -rpath $(tslibdir) $(libdirectfb_tslib_la_OBJECTS) $(libdirectfb_tslib_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdirectfb_tslib_la-tslib.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 $@ $<
+
+libdirectfb_tslib_la-tslib.lo: tslib.c
+@am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdirectfb_tslib_la_CFLAGS) $(CFLAGS) -MT libdirectfb_tslib_la-tslib.lo -MD -MP -MF $(DEPDIR)/libdirectfb_tslib_la-tslib.Tpo -c -o libdirectfb_tslib_la-tslib.lo `test -f 'tslib.c' || echo '$(srcdir)/'`tslib.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libdirectfb_tslib_la-tslib.Tpo $(DEPDIR)/libdirectfb_tslib_la-tslib.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tslib.c' object='libdirectfb_tslib_la-tslib.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdirectfb_tslib_la_CFLAGS) $(CFLAGS) -c -o libdirectfb_tslib_la-tslib.lo `test -f 'tslib.c' || echo '$(srcdir)/'`tslib.c
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-tslibDATA: $(tslib_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(tslibdir)" || $(MKDIR_P) "$(DESTDIR)$(tslibdir)"
+	@list='$(tslib_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(tslibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(tslibdir)/$$f'"; \
+	  $(tslibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(tslibdir)/$$f"; \
+	done
+
+uninstall-tslibDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(tslib_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(tslibdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(tslibdir)/$$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)$(tslibdir)" "$(DESTDIR)$(tslibdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-tslibLTLIBRARIES \
+	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-tslibDATA install-tslibLTLIBRARIES
+
+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-tslibDATA uninstall-tslibLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-tslibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip install-tslibDATA install-tslibLTLIBRARIES \
+	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-tslibDATA \
+	uninstall-tslibLTLIBRARIES
+
+%.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/inputdrivers/tslib/tslib.c b/Source/DirectFB/inputdrivers/tslib/tslib.c
new file mode 100755
index 0000000..57b8296
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/tslib/tslib.c
@@ -0,0 +1,292 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Shane Volpe <shanevolpe@gmail.com
+
+   Based on usb1x00_ts writen by:
+              Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org> and
+              Ville Syrj��<syrjala@sci.fi>.
+
+   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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <tslib.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+#include <misc/conf.h>
+
+DFB_INPUT_DRIVER( tslib )
+
+typedef struct {
+     CoreInputDevice *device;
+     DirectThread    *thread;
+     struct tsdev    *ts;
+} tslibData;
+
+#define MAX_TSLIB_DEVICES 16
+
+static int num_devices = 0;
+static char *device_names[MAX_TSLIB_DEVICES];
+
+static void *
+tslibEventThread( DirectThread *thread, void *driver_data )
+{
+     tslibData *data = (tslibData *) driver_data;
+     struct ts_sample ts_event;
+     int readlen;
+     int old_x = -1;
+     int old_y = -1;
+     unsigned int old_pressure = 0;
+
+     while ((readlen = ts_read( data->ts, &ts_event, 1 )) >= 0) {
+          DFBInputEvent evt;
+
+          direct_thread_testcancel( thread );
+
+          if (readlen < 1)
+               continue;
+
+          if (ts_event.pressure) {
+               if (ts_event.x != old_x) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = ts_event.x;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_x = ts_event.x;
+               }
+
+               if (ts_event.y != old_y) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = ts_event.y;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_y = ts_event.y;
+               }
+          }
+
+          if (!ts_event.pressure != !old_pressure) {
+               evt.type   = ts_event.pressure ? DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+               evt.flags  = DIEF_NONE;
+               evt.button = DIBI_LEFT;
+
+               dfb_input_dispatch( data->device, &evt );
+
+               old_pressure = ts_event.pressure;
+          }
+     }
+
+     if (readlen < 0)
+          D_ERROR( "tslib Input thread died\n" );
+
+     return NULL;
+}
+
+static bool
+check_device( const char *device )
+{
+     struct tsdev *ts;
+
+     ts = ts_open( device, 0 );
+     if (!ts)
+          return false;
+
+     if (ts_config( ts )) {
+          ts_close( ts );
+          return false;
+     }
+
+     ts_close( ts );
+
+     return true;
+}
+
+/* exported symbols */
+
+static int
+driver_get_available(void)
+{
+     int   i;
+     char *tsdev;
+
+     /* Use the devices specified in the configuration. */
+     if (fusion_vector_has_elements( &dfb_config->tslib_devices )) {
+          const char *device;
+
+          fusion_vector_foreach (device, i, dfb_config->tslib_devices) {
+               if (num_devices >= MAX_TSLIB_DEVICES)
+                    break;
+
+               if (check_device( device ))
+                    device_names[num_devices++] = D_STRDUP( device );
+          }
+
+          return num_devices;
+     }
+
+     /* Check for environment variable. */
+     tsdev = getenv( "TSLIB_TSDEVICE" );
+     if (tsdev && check_device( tsdev ))
+          device_names[num_devices++] = D_STRDUP( tsdev );
+
+     /* Try to guess some (more) devices. */
+     for (i = 0; i < MAX_TSLIB_DEVICES; i++) {
+          char buf[32];
+
+          if (num_devices >= MAX_TSLIB_DEVICES)
+               break;
+
+          snprintf( buf, 32, "/dev/input/tslib%d", i );
+
+          /* Already handled above. */
+          if (tsdev && !strcmp( tsdev, buf ))
+               continue;
+
+          if (check_device( buf ))
+               device_names[num_devices++] = D_STRDUP( buf );
+     }
+
+     return num_devices;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+               "tslib Input Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+               "tslib" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     tslibData *data;
+     struct tsdev *ts;
+
+     /* open device */
+     ts = ts_open( device_names[number], 0 );
+     if (!ts) {
+          D_ERROR( "DirectFB/tslib: Error opening `%s'!\n", device_names[number] );
+          return DFB_INIT;
+     }
+
+     /* configure device */
+     if (ts_config( ts )) {
+          D_ERROR( "DirectFB/tslib: Error configuring `%s'!\n", device_names[number] );
+          ts_close( ts );
+          return DFB_INIT;
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "tslib touchscreen %d", number );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "tslib" );
+
+     info->prefered_id     = DIDID_MOUSE;
+
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(tslibData) );
+     if (!data) {
+          ts_close( ts );
+          return D_OOM();
+     }
+
+     data->ts     = ts;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, tslibEventThread, data, "tslib Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     tslibData *data = (tslibData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     ts_close( data->ts );
+
+     /* free private data */
+     D_FREE( data );
+}
diff --git a/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.am b/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.am
new file mode 100755
index 0000000..e85b9bc
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/ucb1x00_ts
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_ucb1x00_ts.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_ucb1x00_ts_la_SOURCES =	\
+	ucb1x00_ts.c
+
+libdirectfb_ucb1x00_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ucb1x00_ts_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.in b/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.in
new file mode 100755
index 0000000..1738272
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ucb1x00_ts/Makefile.in
@@ -0,0 +1,594 @@
+# 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 = inputdrivers/ucb1x00_ts
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_ucb1x00_ts_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_ucb1x00_ts_la_OBJECTS = ucb1x00_ts.lo
+libdirectfb_ucb1x00_ts_la_OBJECTS =  \
+	$(am_libdirectfb_ucb1x00_ts_la_OBJECTS)
+libdirectfb_ucb1x00_ts_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libdirectfb_ucb1x00_ts_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_ucb1x00_ts_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_ucb1x00_ts_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_ucb1x00_ts.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_ucb1x00_ts_la_SOURCES = \
+	ucb1x00_ts.c
+
+libdirectfb_ucb1x00_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_ucb1x00_ts_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  inputdrivers/ucb1x00_ts/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/ucb1x00_ts/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_ucb1x00_ts.la: $(libdirectfb_ucb1x00_ts_la_OBJECTS) $(libdirectfb_ucb1x00_ts_la_DEPENDENCIES) 
+	$(libdirectfb_ucb1x00_ts_la_LINK) -rpath $(inputdir) $(libdirectfb_ucb1x00_ts_la_OBJECTS) $(libdirectfb_ucb1x00_ts_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ucb1x00_ts.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/ucb1x00_ts/ucb1x00_ts.c b/Source/DirectFB/inputdrivers/ucb1x00_ts/ucb1x00_ts.c
new file mode 100755
index 0000000..1b91477
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/ucb1x00_ts/ucb1x00_ts.c
@@ -0,0 +1,361 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+#define FIX_PRECISION 8
+#define inttofix(A) ((A) << FIX_PRECISION)
+#define fixtoint(A) ((A) >> FIX_PRECISION)
+#define fixmult(A, B) (((A) * (B)) >> FIX_PRECISION)
+#define fixdiv(A, B) (((A) << FIX_PRECISION) / (B))
+
+DFB_INPUT_DRIVER( ucb1x00_ts )
+
+typedef struct {
+     CoreInputDevice   *device;
+     DirectThread  *thread;
+
+     int            fd;
+} ucb1x00TSData;
+
+/* I copied this from the kernel driver since there is no include file */
+typedef struct {
+     u16               pressure;
+     u16               x;
+     u16               y;
+     u16               pad;
+     struct timeval  stamp;
+} TS_EVENT;
+
+static struct {
+     int xmin;
+     int xmax;
+     int ymin;
+     int ymax;
+     int xswap;
+     int yswap;
+     int zthresh;
+     int jthresh;
+     int numevents;
+     int xres;
+     int yres;
+} config = { 50, 930, 50, 930, 1, 1, 50, 5, 8, 640, 480};
+
+/* needed for event filter */
+static TS_EVENT *event_buffer = NULL;
+
+static int
+avg_events(int which, int count)
+{
+     int i, sum = 0;
+
+     for(i = 0; i < count; i++)
+          sum += which ? event_buffer[i].x : event_buffer[i].y;
+
+     return(sum / count);
+}
+
+static void
+filter_event(TS_EVENT *ts_event)
+{
+     int dx, dy;
+     static int lastx = 0, lasty = 0;
+     static int lastb = 0;
+     static int evcnt = 0;
+     static int event_index = 0;
+
+     /* Increment the buffer index and the count of items in the buffer. */
+     if(++evcnt > config.numevents) evcnt = config.numevents;
+     if(++event_index == config.numevents) event_index = 0;
+
+     /* If the pen has just been pressed down, reset the counters. */
+     if(ts_event->pressure > config.zthresh) {
+          if(!lastb) {
+               lastb = 1;
+               evcnt = 1;
+               event_index = 0;
+          }
+     } else lastb = 0;
+
+     /* Store this event in the circular buffer. */
+     direct_memcpy(&event_buffer[event_index], ts_event, sizeof(TS_EVENT));
+
+     /* Don't try to average and filter if we only have one reading. */
+     if(evcnt > 1) {
+          /* Average the closest values */
+          ts_event->y = avg_events(0, evcnt);
+          ts_event->x = avg_events(1, evcnt);
+
+          /* Ignore movements which are below the minimum threshold */
+          dx = ts_event->x - lastx;
+          if(dx < 0) dx = -dx;
+          if(dx < config.jthresh) ts_event->x = lastx;
+          dy = ts_event->y - lasty;
+          if(dy < 0) dy = -dy;
+          if(dy < config.jthresh) ts_event->y = lasty;
+     }
+
+     /* Remember the values we are returning. */
+     lastx = ts_event->x;
+     lasty = ts_event->y;
+}
+
+static void
+scale_point( TS_EVENT *ts_event )
+{
+     int x = ts_event->x;
+     int y = ts_event->y;
+
+     /* Clip any values outside the expected range. */
+     if(x > config.xmax) x = config.xmax;
+     if(x < config.xmin) x = config.xmin;
+     if(y > config.ymax) y = config.ymax;
+     if(y < config.ymin) y = config.ymin;
+
+     /* ((x - config.xmin) / (config.xmax - config.xmin)) * config.xres */
+     x = fixtoint(fixmult(fixdiv(inttofix(x - config.xmin),
+                  inttofix(config.xmax - config.xmin)), inttofix(config.xres)));
+
+     /* ((y - config.ymin) / (config.ymax - config.ymin)) * config.yres */
+     y = fixtoint(fixmult(fixdiv(inttofix(y - config.ymin),
+                  inttofix(config.ymax - config.ymin)), inttofix(config.yres)));
+
+     /* Swap the X and/or Y axes if necessary.*/
+     ts_event->x = config.xswap ? (config.xres - x) : x;
+     ts_event->y = config.yswap ? (config.yres - y) : y;
+}
+
+static void *
+ucb1x00tsEventThread( DirectThread *thread, void *driver_data )
+{
+     ucb1x00TSData *data = (ucb1x00TSData*) driver_data;
+
+     TS_EVENT ts_event;
+
+     int readlen;
+
+     unsigned short old_x = -1;
+     unsigned short old_y = -1;
+     unsigned short old_pressure = 0;
+
+     while ((readlen = read(data->fd, &ts_event, sizeof(TS_EVENT))) > 0  ||
+            errno == EINTR)
+     {
+          DFBInputEvent evt;
+
+          direct_thread_testcancel( thread );
+
+          if (readlen < 1)
+               continue;
+
+          filter_event( &ts_event );
+          scale_point( &ts_event );
+	
+	  ts_event.pressure = (ts_event.pressure > config.zthresh );
+	
+          if (ts_event.pressure) {
+               if (ts_event.x != old_x) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = ts_event.x;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_x = ts_event.x;
+               }
+
+               if (ts_event.y != old_y) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = ts_event.y;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_y = ts_event.y;
+               }
+          }
+
+          if ((ts_event.pressure && !old_pressure) ||
+              (!ts_event.pressure && old_pressure)) {
+               evt.type   = (ts_event.pressure ?
+                             DIET_BUTTONPRESS : DIET_BUTTONRELEASE);
+               evt.flags  = DIEF_NONE;
+               evt.button = DIBI_LEFT;
+
+               dfb_input_dispatch( data->device, &evt );
+
+               old_pressure = ts_event.pressure;
+          }
+     }
+
+     if (readlen <= 0)
+          D_PERROR ("ucb1x00 Touchscreen thread died\n");
+
+     return NULL;
+}
+
+
+/* exported symbols */
+
+static int
+driver_get_available( void )
+{
+     int fd;
+
+     fd = open( "/dev/ucb1x00-ts", O_RDONLY | O_NOCTTY );
+     if (fd < 0)
+          return 0;
+
+     close( fd );
+
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "ucb1x00 Touchscreen Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+               "fischlustig" );
+
+     info->version.major = 0;
+     info->version.minor = 4;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int          fd;
+     ucb1x00TSData *data;
+
+     /* open device */
+     fd = open( "/dev/ucb1x00-ts", O_RDONLY | O_NOCTTY );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/ucb1x00: Error opening `/dev/ucb1x00-ts'!\n" );
+          return DFB_INIT;
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "ucb1x00 Touchscreen" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Unknown" );
+
+     info->prefered_id     = DIDID_MOUSE;
+
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(ucb1x00TSData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     event_buffer = malloc( sizeof( TS_EVENT) * config.numevents );
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, ucb1x00tsEventThread, data, "UCB TS Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     ucb1x00TSData *data = (ucb1x00TSData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     if (close( data->fd ) < 0)
+          D_PERROR( "DirectFB/ucb1x00: Error closing `/dev/ucb1x00-ts'!\n" );
+
+     if (event_buffer)
+          free( event_buffer );
+
+     /* free private data */
+     D_FREE( data );
+}
diff --git a/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.am b/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.am
new file mode 100755
index 0000000..d65c509
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/inputdrivers/wm97xx
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_wm97xx_ts.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_wm97xx_ts_la_SOURCES =	\
+	wm97xx_ts.c
+
+libdirectfb_wm97xx_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_wm97xx_ts_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.in b/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.in
new file mode 100755
index 0000000..90a99e8
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/wm97xx_ts/Makefile.in
@@ -0,0 +1,593 @@
+# 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 = inputdrivers/wm97xx_ts
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_wm97xx_ts_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_wm97xx_ts_la_OBJECTS = wm97xx_ts.lo
+libdirectfb_wm97xx_ts_la_OBJECTS =  \
+	$(am_libdirectfb_wm97xx_ts_la_OBJECTS)
+libdirectfb_wm97xx_ts_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_wm97xx_ts_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_wm97xx_ts_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_wm97xx_ts_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_wm97xx_ts.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_wm97xx_ts_la_SOURCES = \
+	wm97xx_ts.c
+
+libdirectfb_wm97xx_ts_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_wm97xx_ts_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  inputdrivers/wm97xx_ts/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/wm97xx_ts/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_wm97xx_ts.la: $(libdirectfb_wm97xx_ts_la_OBJECTS) $(libdirectfb_wm97xx_ts_la_DEPENDENCIES) 
+	$(libdirectfb_wm97xx_ts_la_LINK) -rpath $(inputdir) $(libdirectfb_wm97xx_ts_la_OBJECTS) $(libdirectfb_wm97xx_ts_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wm97xx_ts.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/wm97xx_ts/wm97xx_ts.c b/Source/DirectFB/inputdrivers/wm97xx_ts/wm97xx_ts.c
new file mode 100755
index 0000000..8294a23
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/wm97xx_ts/wm97xx_ts.c
@@ -0,0 +1,260 @@
+/*
+
+   Driver for Wolfson WM9705/WM9712 touchscreen controllers as
+   found in the Dell Axim and Toshiba e740.
+
+   liam.girdwood@wolfsonmicro.com
+
+   NOTE: Please make sure that pressure measurement is enable in the
+         kernel driver. (i.e. pil != 0) Please read
+		  wolfson-touchscreen.txt in your kernel documentation for
+		  details.
+
+   Based on the h3600_ts.c driver:
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( wm97xx_ts )
+
+typedef struct {
+     CoreInputDevice   *device;
+     DirectThread  *thread;
+
+     int            fd;
+} WM97xxTSData;
+
+/* I copied this from the kernel driver since there is no include file */
+typedef struct {
+     u16               pressure;
+     u16               x;
+     u16               y;
+     u16               pad;
+     struct timeval  stamp;
+} TS_EVENT;
+
+static void *
+wm97xxtsEventThread( DirectThread *thread, void *driver_data )
+{
+     WM97xxTSData *data = (WM97xxTSData*) driver_data;
+
+     TS_EVENT ts_event;
+
+     int readlen;
+
+     unsigned short old_x = -1;
+     unsigned short old_y = -1;
+     unsigned short old_pressure = 0;
+
+     while ((readlen = read(data->fd, &ts_event, sizeof(TS_EVENT))) > 0  ||
+            errno == EINTR)
+     {
+          DFBInputEvent evt;
+
+          direct_thread_testcancel( thread );
+
+          if (readlen < 1)
+               continue;
+
+          if (ts_event.pressure) {
+               if (ts_event.x != old_x) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_X;
+                    evt.axisabs = ts_event.x;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_x = ts_event.x;
+               }
+
+               if (ts_event.y != old_y) {
+                    evt.type    = DIET_AXISMOTION;
+                    evt.flags   = DIEF_AXISABS;
+                    evt.axis    = DIAI_Y;
+                    evt.axisabs = ts_event.y;
+
+                    dfb_input_dispatch( data->device, &evt );
+
+                    old_y = ts_event.y;
+               }
+          }
+
+          if ((ts_event.pressure && !old_pressure) ||
+              (!ts_event.pressure && old_pressure)) {
+               evt.type   = (ts_event.pressure ?
+                             DIET_BUTTONPRESS : DIET_BUTTONRELEASE);
+               evt.flags  = DIEF_NONE;
+               evt.button = DIBI_LEFT;
+
+               dfb_input_dispatch( data->device, &evt );
+
+               old_pressure = ts_event.pressure;
+          }
+     }
+
+     if (readlen <= 0)
+          D_PERROR ("WM97xx Touchscreen thread died\n");
+
+     return NULL;
+}
+
+
+/* exported symbols */
+
+static int driver_get_available( void )
+{
+     int fd;
+
+     fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
+     if (fd < 0)
+          return 0;
+
+     close( fd );
+
+     return 1;
+}
+
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "WM97xx Touchscreen Driver" );
+
+     snprintf( info->vendor,
+               DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     int          fd;
+     WM97xxTSData *data;
+
+     /* open device */
+     fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/WM97xx: Error opening `/dev/touchscreen/wm97xx'!\n" );
+          return DFB_INIT;
+     }
+
+     /* fill device info structure */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "WM97xx Touchscreen" );
+
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "Wolfson Microelectronics" );
+
+     info->prefered_id     = DIDID_MOUSE;
+
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(WM97xxTSData) );
+     if (!data) {
+          close( fd );
+          return D_OOM();
+     }
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, wm97xxtsEventThread, data, "WM97xx TS Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice               *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static void
+driver_close_device( void *driver_data )
+{
+     WM97xxTSData *data = (WM97xxTSData*) driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel( data->thread );
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* close device */
+     if (close( data->fd ) < 0)
+          D_PERROR( "DirectFB/WM97xx: Error closing `/dev/touchscreen/wm97xx'!\n" );
+
+     /* free private data */
+     D_FREE( data );
+}
diff --git a/Source/DirectFB/inputdrivers/zytronic/Makefile.am b/Source/DirectFB/inputdrivers/zytronic/Makefile.am
new file mode 100755
index 0000000..b113b4b
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/zytronic/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/inputdrivers/zytronic
+
+INCLUDES = \
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_zytronic.la
+
+if BUILD_STATIC
+input_DATA = $(input_LTLIBRARIES:.la=.o)
+endif
+
+inputdir = $(MODULEDIR)/inputdrivers
+
+libdirectfb_zytronic_la_SOURCES = zytronic.c
+
+libdirectfb_zytronic_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_zytronic_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+	
diff --git a/Source/DirectFB/inputdrivers/zytronic/Makefile.in b/Source/DirectFB/inputdrivers/zytronic/Makefile.in
new file mode 100755
index 0000000..6819549
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/zytronic/Makefile.in
@@ -0,0 +1,591 @@
+# 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 = inputdrivers/zytronic
+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)$(inputdir)" "$(DESTDIR)$(inputdir)"
+inputLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(input_LTLIBRARIES)
+libdirectfb_zytronic_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_zytronic_la_OBJECTS = zytronic.lo
+libdirectfb_zytronic_la_OBJECTS =  \
+	$(am_libdirectfb_zytronic_la_OBJECTS)
+libdirectfb_zytronic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_zytronic_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_zytronic_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_zytronic_la_SOURCES)
+inputDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(input_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_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+input_LTLIBRARIES = libdirectfb_zytronic.la
+@BUILD_STATIC_TRUE@input_DATA = $(input_LTLIBRARIES:.la=.o)
+inputdir = $(MODULEDIR)/inputdrivers
+libdirectfb_zytronic_la_SOURCES = zytronic.c
+libdirectfb_zytronic_la_LDFLAGS = \
+	-module			\
+	-avoid-version		\
+	$(DFB_LDFLAGS)
+
+libdirectfb_zytronic_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  inputdrivers/zytronic/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  inputdrivers/zytronic/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-inputLTLIBRARIES: $(input_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdir)/$$p"; \
+	done
+
+clean-inputLTLIBRARIES:
+	-test -z "$(input_LTLIBRARIES)" || rm -f $(input_LTLIBRARIES)
+	@list='$(input_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_zytronic.la: $(libdirectfb_zytronic_la_OBJECTS) $(libdirectfb_zytronic_la_DEPENDENCIES) 
+	$(libdirectfb_zytronic_la_LINK) -rpath $(inputdir) $(libdirectfb_zytronic_la_OBJECTS) $(libdirectfb_zytronic_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zytronic.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-inputDATA: $(input_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdir)"
+	@list='$(input_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \
+	  $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \
+	done
+
+uninstall-inputDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(input_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdir)/$$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)$(inputdir)" "$(DESTDIR)$(inputdir)"; 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-inputLTLIBRARIES 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-inputDATA install-inputLTLIBRARIES
+
+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-inputDATA uninstall-inputLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputLTLIBRARIES 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-info install-info-am install-inputDATA \
+	install-inputLTLIBRARIES 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-inputDATA \
+	uninstall-inputLTLIBRARIES
+
+%.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/inputdrivers/zytronic/zytronic.c b/Source/DirectFB/inputdrivers/zytronic/zytronic.c
new file mode 100755
index 0000000..e98d480
--- /dev/null
+++ b/Source/DirectFB/inputdrivers/zytronic/zytronic.c
@@ -0,0 +1,628 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/* 
+ * This is a driver for a Zytronic Touchscreen.
+ * Note that is not the standard Zytronic (microsoft-DLL controllable) touchscreen;
+ * It uses a micro-controller similar to the one of Elo or Mutouch touchscreens.
+ * The configuration inside directfbrc is equal to Elo/Mutouch config.
+ * All three touchscreens are conceptualised to use 4096x4096 virtual resolutions.
+ *
+ * This driver has been kindly provided by Jacques Luder.
+ * Written by Eric Wajman - Jacques Luder.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include <termios.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include <linux/serial.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/system.h>
+
+#include <misc/conf.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/memcpy.h>
+#include <direct/thread.h>
+
+#include <core/input_driver.h>
+
+DFB_INPUT_DRIVER( zytronic )
+
+
+// codes de retours :
+  #define ZYT_ERR_NOT_START_OF_READ                   -1 // erreur si on demande un lecture de msg alors que l'on ne 
+                                                         // reçoit pas ':' comme premier caractère (à priori ne devrait
+                                                         // jamais arriver...?)
+  #define ZYT_ERR_CANT_OPEN                           -2 // erreur si on n'arrive pas à ouvrir le "fichier" lié au device.
+  #define ZYT_ACK_NACK                                -3 // prévient que le message lu est un ack/nack
+                                                         // et non un vrai message
+  #define ZYT_END_OF_CONF_FILE                        -4 // prévient que l'on a atteint la fin du fichier de configuration
+
+// infos utiles :
+  #define ZYT_PAQUET_SIZE                           128 // taille max d'un msg envoyé/reçu (pour la taille du tableau)
+  #define ZYT_ENDOFMSG_CR                           13  // 1er caractère de fin de message reçu
+  #define ZYT_ENDOFMSG_LF                           10  // 2ème caractère de fin de message reçu
+
+// commandes protocoles (pas toutes utilisées dans ce driver) :
+  #define ZYT_ENABLE_CONTROLLER                     201
+  #define ZYT_DISABLE_CONTROLLER                    200
+
+  #define ZYT_XY_TOUCH_MESSAGE_MODE                 210
+  #define ZYT_INIT_FW_RESET                         72
+  #define ZYT_FORCE_EQUALISATION                    69
+  #define ZYT_SET_TOUCH_THRESHOLD                   100 // + valeur de Threshold voulue (entre 5 et 50)
+
+  #define ZYT_REQ_FW_AND_ID                         86
+  #define ZYT_REQ_NON_VOLATILE_SETTINGS             88
+  #define ZYT_RESTORE_FACTORY_DEFAULT_SETTINGS      68
+  #define ZYT_REQ_SHORT_STATUS_MESSAGE              71
+
+  #define ZYT_REQ_SINGLE_FRAME_OF_RAW_SENSOR_DATA   82
+  #define ZYT_ENABLE_CONTINUOUS_RAW_SENSOR_DATA     205
+  #define ZYT_DISABLE_CONTINUOUS_RAW_SENSOR_DATA    204
+
+  #define ZYT_SET_FRAME_AVERAGING                   220 // + nombre de frame pour "xy averaging" voulue (1 à 9)
+  #define ZYT_SET_GLASS_THICKNESS                   230 // + valeur (ci dessous)
+    #define ZYT_GLASS_THIN                          0
+    #define ZYT_GLASS_MEDIUM                        1
+    #define ZYT_GLASS_THICK                         2
+
+  #define ZYT_ENABLE_CONTROLLER_ACK_NAK             203
+  #define ZYT_DISABLE_CONTROLLER_ACK_NAK            202
+  #define ZYT_STORE_DATA_BLOCK                      213 // + le code à enregistrer (voir la doc du protocole...)
+  #define ZYT_RETRIEVE_DATA_BLOCK                   214 // + taile des infos à récupèrer (voir la doc du protocole...)
+
+// paramètres de notre fichier de configuration :
+  #define ZYT_CONF_FILE                             "/etc/zyposConf" // le nom de notre fichier de configuration
+  #define ZYT_CONF_DIM_DALLE_X                      "dimDalleX"
+  #define ZYT_CONF_DIM_DALLE_Y                      "dimDalleY"
+  #define ZYT_CONF_SEUIL                            "seuil"
+  #define ZYT_CONF_EPAISSEUR                        "epaisseur"
+  #define ZYT_CONF_ATTENTE_MULTI_CLIC               "attenteMultiClic"
+  #define ZYT_CONF_MODE                             "mode"
+  #define ZYT_CONF_FRAME_AVERAGING                  "frameAveraging"
+  #define ZYT_CONF_NB_CLIGN_TO_PRESS                "nbClignToPress"
+  #define ZYT_CONF_DEBUG                            "debug"
+
+// types d'action (pour ZytData->action):
+  #define ZYT_ACTION_TOUCH                          0x01
+  #define ZYT_ACTION_RELEASE                        0x00
+
+// les masques :
+  #define ZYT_MASK_ACTION                           0x40
+  #define ZYT_MASK_SYNC_MSG                         0x80
+
+typedef enum{
+  NO_DRAG_DROP=0,
+  CONTINUOUS=1,
+} ZytMode;
+
+typedef enum{
+  NO_DEBUG=0,
+  DEBUG=1,
+} ZytDebug;
+
+// structure du paramètrage
+typedef struct {
+  unsigned short dimDalleX;
+  unsigned short dimDalleY;
+  unsigned short seuil;
+  unsigned short epaisseur;
+  unsigned int attenteMultiClic;
+  ZytMode mode;
+  unsigned short frameRateAveraging;
+  unsigned short nbClignToPress;
+  ZytDebug debug;
+} ZytConf_t;
+
+/* structure de data du Zytronic */
+typedef struct __ZytData__ {
+  int fd;
+  DirectThread *thread;
+  CoreInputDevice *device;
+  unsigned short x;
+  unsigned short y;
+  unsigned char action;
+} ZytData;
+
+/* Global Variables */
+static unsigned char packet[ZYT_PAQUET_SIZE];
+static struct termios options; // pour changer les configurations du port (avec cfmakeraw)
+static struct termios saved_options;// pour sauvegarder l'ancienne configuration du port et la rétablir après
+static ZytConf_t zytConf;
+
+// fonction pour faire des mini-pauses en millisecondes : (utile? on garde)
+static inline void __mdelay(unsigned int msec)
+{
+  struct timespec delay;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = msec * 1000000;
+  nanosleep (&delay, NULL);
+}
+
+// procédure pour envoyer un paquet au controleur Zytronic, encapsulé d'une certaine manière par rapport
+// au protocole (pour Zytronic il y n'a rien autour du code OP_CODE lui même)
+static inline void ZytSendPacket(int file, unsigned char *msg, unsigned char len)
+{
+  write(file,msg,len);
+}
+
+// procédure pour lire un "paquet" de données venant du controleur (un message donc)
+static int ZytReadMsg(int file, unsigned char *msg)
+{
+  int i=0;
+  read(file,&msg[0],1);
+
+  if(msg[0]==':'){ // si c'est un réponse à une commande :
+    do{ // on lit tant qu'on trouve pas les 2 caractères de fin :
+      i++; // on commence à lire à 1 (car le 0 est déjà lu)
+      read(file,&msg[i],1);
+    }while(msg[i]!=ZYT_ENDOFMSG_LF || msg[i-1]!=ZYT_ENDOFMSG_CR);
+  }else if(msg[0]==0xC0 || msg[0]==0x80){ // si c'est un appui ou un relachement sur la dalle :
+    // on lit les 4 caractères pour la position du touché :
+    for(i=1;i<5;i++){
+      read(file,&msg[i],1);
+    }
+  }else if(msg[0]==0x06 || msg[0]==0x15){ // si c'est un ACK/NACK on le dit
+    if(zytConf.debug==DEBUG){
+      D_INFO("ZYT, reception d'un ACK/NACK (6=ACK, 21=NACK): %d\n",msg[0]); //debug
+    }
+    return ZYT_ACK_NACK;
+  }else { // sinon : ce n'est pas le début d'une lecture => on a perdu des donneés précédemment ...
+    D_INFO("ZYT_ERR_NOT_START_OF_READ\n"); // ça ne devrait PAS arriver !
+    return ZYT_ERR_NOT_START_OF_READ;
+  }
+  if(zytConf.debug==DEBUG){
+    D_INFO("ZYT_READ_MSG : nb octets recus= %d\n",i); // debug
+  }
+
+  return 0;
+}
+
+#define WORD_ASSEMBLY(b1,b2) (((b2) << 7) | (b1))
+// fonction qui permet de récupèrer les informations contenues dans un "message" en mode "touch XY mode" ***
+static int ZytReadTouchMessage(ZytData* event){
+  if( ZytReadMsg(event->fd,packet) != 0 ) {
+    return 0; // on renvoit qu'on a pas pu lire correctement
+  }
+
+  // on récupère les infos x,y et appui ou relachement:
+  if( (packet[0] & ZYT_MASK_ACTION) == 0 ){
+    event->action = ZYT_ACTION_RELEASE;
+  }else{
+    event->action = ZYT_ACTION_TOUCH;
+  }
+
+  event->x = (float)(4096*WORD_ASSEMBLY(packet[1], packet[2])/zytConf.dimDalleX);
+  event->y = (float)(4096*WORD_ASSEMBLY(packet[3], packet[4])/zytConf.dimDalleY);
+
+ return 1; // on dit que on a effectivement bien lu
+}
+
+// procédure pour écrire un paramètre dans le fichier de configuration Zytronic :
+static void ecrireConf(int f,char *sp, char *sv){
+  char tmp[100];
+
+  strcpy(tmp,":");
+  strcat(tmp,sp);
+  strcat(tmp,"=");
+  strcat(tmp,sv);
+  strcat(tmp,";\n");
+  write(f,tmp,strlen(tmp));
+}
+
+// procédure pour créer le fichier de configuration avec les valeurs par défaut
+static void createConfigFile(int *fdConf){
+  char tmp[10];
+
+  // création du fichier :
+  *fdConf = open(ZYT_CONF_FILE,O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+
+  // mise en place des valeurs par défaut :
+  sprintf(tmp,"%d",zytConf.dimDalleX);
+  ecrireConf(*fdConf,ZYT_CONF_DIM_DALLE_X,tmp);
+  sprintf(tmp,"%d",zytConf.dimDalleY);
+  ecrireConf(*fdConf,ZYT_CONF_DIM_DALLE_Y,tmp);
+  sprintf(tmp,"%d",zytConf.seuil);
+  ecrireConf(*fdConf,ZYT_CONF_SEUIL,tmp);
+  sprintf(tmp,"%d",zytConf.epaisseur);
+  ecrireConf(*fdConf,ZYT_CONF_EPAISSEUR,tmp);
+  sprintf(tmp,"%d",zytConf.attenteMultiClic);
+  ecrireConf(*fdConf,ZYT_CONF_ATTENTE_MULTI_CLIC,tmp);
+  sprintf(tmp,"%d",zytConf.mode);
+  ecrireConf(*fdConf,ZYT_CONF_MODE,tmp);
+  sprintf(tmp,"%d",zytConf.frameRateAveraging);
+  ecrireConf(*fdConf,ZYT_CONF_FRAME_AVERAGING,tmp);
+  sprintf(tmp,"%d",zytConf.nbClignToPress);
+  ecrireConf(*fdConf,ZYT_CONF_NB_CLIGN_TO_PRESS,tmp);
+  sprintf(tmp,"%d",zytConf.debug);
+  ecrireConf(*fdConf,ZYT_CONF_DEBUG,tmp);
+  D_INFO("fsync renvoi la valeur: %d\n",fsync(*fdConf)); //pour s'assurer qu'on écrit bien dans le fichier
+}
+
+// procédure qui retourne le prochain paramètre lu dans le fichier de configuration
+static int nextConf(int fdConf,char *param, char *res){
+  char charActuel;
+  int i,nb=1;
+
+  // note : on suppose pour l'instant qu'aucune erreur de lecture n'intervient, ni de fichier mal formaté *** ...
+
+  // on cherche le début d'un paramètre de configuration (ou la fin du fichier) :
+  while(charActuel!=':' && nb==1){
+    nb = read(fdConf,&charActuel,1);
+  }
+  if(nb==0){ // le cas échéant, on prévient que le fichier ne contient pas d'autres paramètres (fin du fichier)
+    return ZYT_END_OF_CONF_FILE;
+  }
+
+  // on enregistre le nom du paramètre:
+  i=0;
+  read(fdConf,&charActuel,1);
+  while(charActuel!='='){
+    param[i]=charActuel;
+    read(fdConf,&charActuel,1);
+    i++;
+  }
+  param[i]='\0';
+
+
+  // on enregistre la valeur de ce paramètre :
+  i=0;
+  read(fdConf,&charActuel,1);
+  while(charActuel!=';'){
+    res[i]=charActuel;
+    read(fdConf,&charActuel,1);
+    i++;
+  }
+  res[i]='\0';
+
+  // on retourne le tout (en indiquant que tout s'est bien passé, on a pas atteint la fin du fichier)
+  return 0;
+}
+
+// procédure pour "activer" le device, en l'occurence : mettre les paramètres de base qui nous intéressent nous :
+static void ZytActivateDevice(int fd)
+{
+  int fdConf,val;
+  char param[100],res[10];
+
+  //paramètres par défaut : (également utilisés pour créer le fichier de configuration par la suite, s'il n'existe pas)
+  zytConf.dimDalleX = 1024;
+  zytConf.dimDalleY = 768;
+  zytConf.seuil = 10;
+  zytConf.epaisseur = 1;
+  zytConf.attenteMultiClic = 300;
+  // par défaut on ne garde que le premier appui d'une série : la "souris" ne bougera pas entre un appui et un relachement
+  zytConf.mode=NO_DRAG_DROP;
+  zytConf.frameRateAveraging=3;
+  zytConf.nbClignToPress=5; // le nombre d'appuis successifs pour comprendre un appui après un clignotement
+  zytConf.debug=NO_DEBUG;
+
+  // récupération des paramètres choisis, et création du fichier si besoin :
+  fdConf = open(ZYT_CONF_FILE,O_RDWR);
+  if(fdConf==-1){
+    D_INFO("ZYT, le fichier %s de configuration de la dalle zytronic n'existe pas, creation en cours...\n",ZYT_CONF_FILE);
+    createConfigFile(&fdConf);
+    D_INFO("ZYT, ...creation de %s finie.\n",ZYT_CONF_FILE);
+  }else{
+    D_INFO("ZYT, le fichier %s de configuration de la dalle zytronic existe.\n",ZYT_CONF_FILE);
+  }
+
+  // puis, on charge les valeurs de configuration, en gardant les valeurs par défaut pour les paramètres non précisés :
+  lseek(fdConf,0,SEEK_SET); // on retourne au début du fichier (au cas où on vient de le créé)
+  while(nextConf(fdConf,param,res)!=ZYT_END_OF_CONF_FILE){
+    val = atoi(res);
+    D_INFO("parametre : %s = %d\n",param,val); //debug
+    if(strcmp(param,ZYT_CONF_DIM_DALLE_X)==0){
+      zytConf.dimDalleX=val;
+    }else if(strcmp(param,ZYT_CONF_DIM_DALLE_Y)==0){
+      zytConf.dimDalleY=val;
+    }else if(strcmp(param,ZYT_CONF_SEUIL)==0){
+      zytConf.seuil=val;
+    }else if(strcmp(param,ZYT_CONF_EPAISSEUR)==0){
+      zytConf.epaisseur=val;
+    }else if(strcmp(param,ZYT_CONF_ATTENTE_MULTI_CLIC)==0){
+      zytConf.attenteMultiClic=val*1000; //on passe les millisecondes en microsecondes
+    }else if(strcmp(param,ZYT_CONF_MODE)==0){
+      zytConf.mode=val;
+    }else if(strcmp(param,ZYT_CONF_FRAME_AVERAGING)==0){
+      zytConf.frameRateAveraging=val;
+    }else if(strcmp(param,ZYT_CONF_NB_CLIGN_TO_PRESS)==0){
+      zytConf.nbClignToPress=val;
+    }else if(strcmp(param,ZYT_CONF_DEBUG)==0){
+      zytConf.debug=val;
+    }else {
+      D_INFO("ZYT, parametre non reconnu : %s\n",param);
+      D_INFO("ZYT, veuillez verifier le  fichier de configuration %s!\n",ZYT_CONF_FILE);
+    }
+  }
+  close(fdConf);
+
+  // envoi des paramètres du controleur pour utilisation normale :
+  //packet[0]=ZYT_INIT_FW_RESET; // permet de "mieux" initialiser le controleur, utile? (long : ~5sec)
+  //ZytSendPacket(fd,packet,1); // attention, commande inutilisable telle qu'elle, car elle coupe la liaison
+     // et donc empêche les commandes suivantes...
+     // (ici en l'occurence tout le paramètrage qui suit...) !!!
+  packet[0]=ZYT_RESTORE_FACTORY_DEFAULT_SETTINGS;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_SET_FRAME_AVERAGING + zytConf.frameRateAveraging;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_DISABLE_CONTINUOUS_RAW_SENSOR_DATA;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_SET_TOUCH_THRESHOLD + zytConf.seuil;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_SET_GLASS_THICKNESS + zytConf.epaisseur;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_ENABLE_CONTROLLER;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_FORCE_EQUALISATION;
+  ZytSendPacket(fd,packet,1);
+  packet[0]=ZYT_XY_TOUCH_MESSAGE_MODE;
+  ZytSendPacket(fd,packet,1);
+}
+
+// fonction pour "ouvrir" le périphérique
+// (càd: ouvrir le fichier spécial qui permet de communiquer avec le controleur)
+static int ZytOpenDevice(char *device)
+{
+     int fd;
+     fd = open (device, O_RDWR | O_NOCTTY); // pourquoi 0_NOCTTY ? ***
+     if ( fd == -1 ) {
+          return ZYT_ERR_CANT_OPEN;
+     }
+
+     // on récupère l'actuelle configuration du port :
+     tcgetattr(fd,&options);
+     tcgetattr(fd,&saved_options);
+
+     // on passe en 96000 bauds :
+     cfsetospeed(&options,B9600);
+     cfsetispeed(&options,B9600);
+
+     // on passe en mode de fonctionnement "pur" pour pouvoir utiliser correctement le port série :
+     cfmakeraw(&options);
+     tcsetattr(fd,TCSANOW,&options);
+
+     return fd;
+}
+
+// le thread qui sert à recevoir des données en continue :
+static void *ZytronicEventThread(DirectThread *thread, void *driver_data)
+{
+     ZytData *data = (ZytData *) driver_data;
+     int lastAction = ZYT_ACTION_RELEASE;
+     struct timeval unT;
+     unsigned int lastT,newT;
+     unsigned short nbClignot=0;
+     lastT = 0;
+     DFBInputEvent evt;
+
+     /* Read data */
+     while (1) {
+          if (!ZytReadTouchMessage (data)){ // si jamais il y a eut mauvaise lecture (pas normal)
+               continue; // on ignore le mesage mal lu
+          }
+          // en mode sans drag&drop, si l'action actuelle est la même que la précédente, on l'ignore:
+          if (zytConf.mode==NO_DRAG_DROP && lastAction == data->action){
+               nbClignot=0; // et on dit que ça clignote pas (car c'est un appui long, pas un clignotement)
+               continue;		// permet de ne garder que le premier appui, et le relachement :
+          }
+          gettimeofday(&unT,NULL);
+          newT = unT.tv_sec*1000000 + unT.tv_usec;
+          if(zytConf.debug==DEBUG){
+               D_INFO("newT=%u\n",newT);
+               D_INFO("lastT=%u\n",lastT);
+               D_INFO("lastT+attente=%u\n",lastT+zytConf.attenteMultiClic);
+          }
+
+          // si on "appui" trop vite, sans faire un appui continu, on réenregistre la dernière action,... :
+          if(data->action==ZYT_ACTION_TOUCH && nbClignot < zytConf.nbClignToPress && \
+          (lastT + zytConf.attenteMultiClic) > newT) {
+               nbClignot++;// ..on compte combien de fois de suite on essai d'appuyer (pour voir si c'est la fin
+                           // d'un clignotement justement parce qu'on a rapprocher le doigt suffisemment) ..
+               gettimeofday(&unT,NULL);
+               lastT = unT.tv_sec*1000000 + unT.tv_usec;
+               continue; // ..et on ignore cet appui (permet d'éviter le phénomène de clignotement..)
+          }
+          nbClignot=0; // on remet le compteur à zéro, puisque c'est ici un appui réel
+          direct_thread_testcancel (thread); // si cette ligne fait bien ce que je pense (regarder si on n'a pas
+            // demandé la fin du thread en cours) pourquoi est-elle là, et pas avant le "if" ? Car si le controlleur
+            // n'envoi plus aucune information pendant un moment, le driver ne peut pas détecter de "cancel"
+            // pendant ce laps de temps .. ? ***
+
+          // Dispatch axis
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_X;
+          evt.axisabs = data->x;
+          dfb_input_dispatch (data->device, &evt);
+
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS;
+          evt.axis    = DIAI_Y;
+          evt.axisabs = data->y;
+          dfb_input_dispatch (data->device, &evt);
+
+          // Dispatch touch event
+          switch (data->action) {
+               case ZYT_ACTION_TOUCH:
+                    evt.type = DIET_BUTTONPRESS;
+                    break;
+               case ZYT_ACTION_RELEASE:
+                    evt.type = DIET_BUTTONRELEASE;
+                    break;
+          }
+
+
+          evt.flags  = DIEF_NONE;
+          evt.button = DIBI_LEFT;
+          dfb_input_dispatch (data->device, &evt);
+
+          lastAction = data->action; // on enregistre l'évènement
+          gettimeofday(&unT,NULL); // on enregistre quand s'est produit l'évènement
+          lastT = unT.tv_sec*1000000 + unT.tv_usec;
+
+          if(zytConf.debug==DEBUG){
+               D_INFO("Zytronic TOUCH : x=%d y=%d action=%d\n", data->x,data->y,data->action);
+          }
+
+          direct_thread_testcancel (thread);
+     }
+
+     return NULL;
+}
+
+
+/* exported symbols */
+
+// procédure pour dire à directFB si c'est bien ce driver qu'il faut charger :
+static int driver_get_available( void )
+{
+     int fd;
+
+     /* we only try to open the device if it has been actually configured */
+     if( !dfb_config->zytronic_device )
+          return 0;
+
+     fd = ZytOpenDevice(dfb_config->zytronic_device );
+     D_INFO( "Zytronic:driver_get_available %s fd %d\n", dfb_config->zytronic_device,fd );
+
+     if (fd < 0){
+          D_INFO( "The Zytronic driver cannot be loaded from %s\n", dfb_config->zytronic_device );
+          return 0;
+     }
+
+     close(fd);
+     return 1;
+}
+
+// donne la description du driver :
+static void driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf(info->name, DFB_INPUT_DRIVER_INFO_NAME_LENGTH,
+               "Zypos" );
+     snprintf(info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH,
+               "Zytronic" );
+
+     info->version.major = 0;
+     info->version.minor = 5;
+}
+
+// "ouvre" le device et commnce à le préparer :
+static DFBResult driver_open_device(CoreInputDevice *device,
+          unsigned int number,
+          InputDeviceInfo *info,
+          void **driver_data)
+{
+     int fd;
+     ZytData *data;
+
+     /* open device */
+     fd = ZytOpenDevice (dfb_config->zytronic_device);
+     D_INFO("ZYT, driver_open_device %s fd %d\n", dfb_config->zytronic_device,fd);
+
+     if (fd < 0) {
+          return DFB_INIT;
+     }
+
+     ZytActivateDevice(fd); //on configure le controleur pour fonctionner en mode normal
+
+     data = D_CALLOC (1, sizeof(ZytData));
+
+     data->fd     = fd;
+     data->device = device;
+
+     /* fill device info structure */
+     snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH,
+               "Zypos");
+     snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH,
+               "Zytronic");
+
+     info->prefered_id     = DIDID_MOUSE;
+     info->desc.type       = DIDTF_MOUSE;
+     info->desc.caps       = DICAPS_AXES | DICAPS_BUTTONS;
+     info->desc.max_axis   = DIAI_Y;
+     info->desc.max_button = DIBI_LEFT;
+
+     /* start input thread */
+     data->thread = direct_thread_create (DTT_INPUT, ZytronicEventThread, data, "Zytronic Input");
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult driver_get_keymap_entry(CoreInputDevice *device,
+          void        *driver_data,
+          DFBInputDeviceKeymapEntry *entry)
+{
+     return DFB_UNSUPPORTED;
+}
+
+// "fermeture" du driver ***
+static void driver_close_device(void *driver_data)
+{
+     ZytData *data = (ZytData *)driver_data;
+
+     /* stop input thread */
+     direct_thread_cancel (data->thread);
+     direct_thread_join (data->thread);
+     direct_thread_destroy (data->thread);
+
+     /* close device */
+     tcsetattr(data->fd,TCSANOW,&saved_options); // remise en l'état de l'ancienne configuration du port
+     close (data->fd);
+
+     /* free private data */
+     D_FREE (data);
+}
diff --git a/Source/DirectFB/install-sh b/Source/DirectFB/install-sh
new file mode 100755
index 0000000..a5897de
--- /dev/null
+++ b/Source/DirectFB/install-sh
@@ -0,0 +1,519 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-12-25.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
+
+    -o) chowncmd="$chownprog $2"
+	shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dst_arg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/Makefile.am b/Source/DirectFB/interfaces/IDirectFBFont/Makefile.am
new file mode 100755
index 0000000..c133da5
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/Makefile.am
@@ -0,0 +1,77 @@
+## Makefile.am for DirectFB/interfaces/IDirectFBFont
+
+idirectfbfontdir = $(MODULEDIR)/interfaces/IDirectFBFont
+
+if FREETYPE_PROVIDER
+FREETYPE_PROVIDER_LTLIB = libidirectfbfont_ft2.la
+else
+FREETYPE_PROVIDER_LTLIB =
+endif
+
+if LINOTYPE_PROVIDER
+LINOTYPE_PROVIDER_LTLIB = libidirectfbfont_lino.la
+else
+LINOTYPE_PROVIDER_LTLIB =
+endif
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src 	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+AM_CFLAGS = $(FREETYPE_CFLAGS) $(LINOTYPE_CFLAGS)
+
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_default.la	\
+	$(FREETYPE_PROVIDER_LTLIB)	\
+	$(LINOTYPE_PROVIDER_LTLIB)	\
+	libidirectfbfont_dgiff.la
+
+if BUILD_STATIC
+idirectfbfont_DATA = $(idirectfbfont_LTLIBRARIES:.la=.o)
+endif
+
+
+libidirectfbfont_default_la_SOURCES = idirectfbfont_default.c default_font.h
+
+libidirectfbfont_default_la_LDFLAGS = -avoid-version -module
+
+libidirectfbfont_default_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+libidirectfbfont_dgiff_la_SOURCES = idirectfbfont_dgiff.c
+
+libidirectfbfont_dgiff_la_LDFLAGS = -avoid-version -module
+
+libidirectfbfont_dgiff_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+libidirectfbfont_ft2_la_SOURCES = idirectfbfont_ft2.c
+
+libidirectfbfont_ft2_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(FREETYPE_LIBS)
+
+libidirectfbfont_ft2_la_LDFLAGS = -avoid-version -module
+
+
+libidirectfbfont_lino_la_SOURCES = idirectfbfont_lino.c
+
+libidirectfbfont_lino_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(LINOTYPE_LIBS)
+
+libidirectfbfont_lino_la_LDFLAGS = -avoid-version -module
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/Makefile.in b/Source/DirectFB/interfaces/IDirectFBFont/Makefile.in
new file mode 100755
index 0000000..a124d84
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/Makefile.in
@@ -0,0 +1,648 @@
+# 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 = interfaces/IDirectFBFont
+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)$(idirectfbfontdir)" \
+	"$(DESTDIR)$(idirectfbfontdir)"
+idirectfbfontLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(idirectfbfont_LTLIBRARIES)
+libidirectfbfont_default_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbfont_default_la_OBJECTS = idirectfbfont_default.lo
+libidirectfbfont_default_la_OBJECTS =  \
+	$(am_libidirectfbfont_default_la_OBJECTS)
+libidirectfbfont_default_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libidirectfbfont_default_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+libidirectfbfont_dgiff_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbfont_dgiff_la_OBJECTS = idirectfbfont_dgiff.lo
+libidirectfbfont_dgiff_la_OBJECTS =  \
+	$(am_libidirectfbfont_dgiff_la_OBJECTS)
+libidirectfbfont_dgiff_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libidirectfbfont_dgiff_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am__DEPENDENCIES_1 =
+libidirectfbfont_ft2_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libidirectfbfont_ft2_la_OBJECTS = idirectfbfont_ft2.lo
+libidirectfbfont_ft2_la_OBJECTS =  \
+	$(am_libidirectfbfont_ft2_la_OBJECTS)
+libidirectfbfont_ft2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbfont_ft2_la_LDFLAGS) $(LDFLAGS) -o $@
+@FREETYPE_PROVIDER_TRUE@am_libidirectfbfont_ft2_la_rpath = -rpath \
+@FREETYPE_PROVIDER_TRUE@	$(idirectfbfontdir)
+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 = $(libidirectfbfont_default_la_SOURCES) \
+	$(libidirectfbfont_dgiff_la_SOURCES) \
+	$(libidirectfbfont_ft2_la_SOURCES)
+DIST_SOURCES = $(libidirectfbfont_default_la_SOURCES) \
+	$(libidirectfbfont_dgiff_la_SOURCES) \
+	$(libidirectfbfont_ft2_la_SOURCES)
+idirectfbfontDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idirectfbfont_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@
+idirectfbfontdir = $(MODULEDIR)/interfaces/IDirectFBFont
+@FREETYPE_PROVIDER_FALSE@FREETYPE_PROVIDER_LTLIB = 
+@FREETYPE_PROVIDER_TRUE@FREETYPE_PROVIDER_LTLIB = libidirectfbfont_ft2.la
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src 	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+AM_CFLAGS = $(FREETYPE_CFLAGS)
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_default.la	\
+	$(FREETYPE_PROVIDER_LTLIB)	\
+	libidirectfbfont_dgiff.la
+
+@BUILD_STATIC_TRUE@idirectfbfont_DATA = $(idirectfbfont_LTLIBRARIES:.la=.o)
+libidirectfbfont_default_la_SOURCES = idirectfbfont_default.c default_font.h
+libidirectfbfont_default_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_default_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbfont_dgiff_la_SOURCES = idirectfbfont_dgiff.c
+libidirectfbfont_dgiff_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_dgiff_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbfont_ft2_la_SOURCES = idirectfbfont_ft2.c
+libidirectfbfont_ft2_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(FREETYPE_LIBS)
+
+libidirectfbfont_ft2_la_LDFLAGS = -avoid-version -module
+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  interfaces/IDirectFBFont/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  interfaces/IDirectFBFont/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-idirectfbfontLTLIBRARIES: $(idirectfbfont_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbfontLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbfontdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbfontdir)/$$p"; \
+	done
+
+clean-idirectfbfontLTLIBRARIES:
+	-test -z "$(idirectfbfont_LTLIBRARIES)" || rm -f $(idirectfbfont_LTLIBRARIES)
+	@list='$(idirectfbfont_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
+libidirectfbfont_default.la: $(libidirectfbfont_default_la_OBJECTS) $(libidirectfbfont_default_la_DEPENDENCIES) 
+	$(libidirectfbfont_default_la_LINK) -rpath $(idirectfbfontdir) $(libidirectfbfont_default_la_OBJECTS) $(libidirectfbfont_default_la_LIBADD) $(LIBS)
+libidirectfbfont_dgiff.la: $(libidirectfbfont_dgiff_la_OBJECTS) $(libidirectfbfont_dgiff_la_DEPENDENCIES) 
+	$(libidirectfbfont_dgiff_la_LINK) -rpath $(idirectfbfontdir) $(libidirectfbfont_dgiff_la_OBJECTS) $(libidirectfbfont_dgiff_la_LIBADD) $(LIBS)
+libidirectfbfont_ft2.la: $(libidirectfbfont_ft2_la_OBJECTS) $(libidirectfbfont_ft2_la_DEPENDENCIES) 
+	$(libidirectfbfont_ft2_la_LINK) $(am_libidirectfbfont_ft2_la_rpath) $(libidirectfbfont_ft2_la_OBJECTS) $(libidirectfbfont_ft2_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont_default.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont_dgiff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont_ft2.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-idirectfbfontDATA: $(idirectfbfont_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbfontDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  $(idirectfbfontDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	done
+
+uninstall-idirectfbfontDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbfontdir)/$$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)$(idirectfbfontdir)" "$(DESTDIR)$(idirectfbfontdir)"; 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-idirectfbfontLTLIBRARIES 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-idirectfbfontDATA \
+	install-idirectfbfontLTLIBRARIES
+
+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-idirectfbfontDATA \
+	uninstall-idirectfbfontLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-idirectfbfontLTLIBRARIES 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-idirectfbfontDATA \
+	install-idirectfbfontLTLIBRARIES 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-idirectfbfontDATA \
+	uninstall-idirectfbfontLTLIBRARIES
+
+%.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/interfaces/IDirectFBFont/default_font.h b/Source/DirectFB/interfaces/IDirectFBFont/default_font.h
new file mode 100755
index 0000000..a0c953d
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/default_font.h
@@ -0,0 +1,623 @@
+/* DirectFB surface dump created by directfb-csource 0.9.17 */
+
+static unsigned char font_data[] = 
+  "\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0"
+  "\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\377\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\377\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0"
+  "\0\377\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0"
+  "\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0"
+  "\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\377\0\0"
+  "\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0"
+  "\0\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\377"
+  "\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\0\377\0"
+  "\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0"
+  "\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\0\0\0"
+  "\0\377\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0"
+  "\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0"
+  "\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\377"
+  "\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\377\0\0\0\0\0\0"
+  "\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377\0\0\0\0\377\0"
+  "\0\0\0\377\0\0\377\0\0\0\0\377\0\0\0\377\0\0\0\0\377\0\0\0\0\0\0\0\0"
+  "\0\0\377\0\0\0\0\0\0\377\0\0\0\0\377\0\0\0\0\377\0\0\0\0\0\0\377\0\0"
+  "\0\0\0\0\377\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\377"
+  "\0\0\0\0\0\0\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8U8\0\34UUU\34\34"
+  "UUU\34""8U\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0""8U\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0UU\0\0\0\0"
+  "\0\0\0\0\0\0\0\0""8U8\0\0\0\0\0\0\0\0\0\0""8U\34\0\0\0\0\0\0\0""88\0"
+  "\0\0\34U\0\0\0UU\0\0\0\0\0\0\34U8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\34U8\0UU\0\0\0\0\0\0\377\252\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34U\34\0\0qU\0\0"
+  "\215U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34U8\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\377\377\252\0U"
+  "\377\377\377UU\377\377\377U\252\377\3778\0\0\0""8U\0\0\0\0\0\0\2158\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\34U8\0\0\0\0""8\252\2528\0\0\0\0\0q\252\252\252"
+  "\252\2528\0\0\0\0\0\0""8\215\252\252U\0\0""8\252\252\252\252\2158\0\0"
+  "\0\0""8\252\252\252\252\252\252q\0\0q\252\252\252\252\252\252\0\0\0\0"
+  "8\215\252\252q\34\0\0\0\252\252\0\0\0\0q\2528\0\0""8\252q\0\0\0\252\252"
+  "\0\0\0q\2528\0\0\34\252\2528\0q\2528\0\0\0\0\0\0\252\252q\0\0\0\0q\252"
+  "\252\0\0\0""8\252\252U\0\0\0""8\252q\0\0\0\0U\252\252\2158\0\0\0\0""8"
+  "\252\252\252\252\215\34\0\0\0\0\0U\252\252\2158\0\0\0\0""8\252\252\252"
+  "\252\252U\0\0\0\0\0\34\215\252\252q\34\0q\252\252\252\252\252\252\252"
+  "\252\0q\2528\0\0\0\0\252\252\0\0\252\2528\0\0\0\0""8\252q\0\252\2528"
+  "\0\0\0\252\252\215\0\0\0U\252q\0\252\252U\0\0\0\0\215\25288\252\252\34"
+  "\0\0\0""8\252\252\0q\252\252\252\252\252\252q\0\0\0\0\0\0\0\0\0\0\0\252"
+  "\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0"
+  "\0\0\215\377\377\377U\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0""8\377\377"
+  "8\0\0\342\377\215\0\0\377\377\0\0\0\0\0\0U\377\252\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0UU\34\0\0\0\0\0\0\0\0\0\0\0\0\34UU\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0U\377\252\0\0U\377\252\0\377\377\0\0\0\0\0\34\377"
+  "\306\34\0\0\0\0\0\0UU\0\0\0\0\0\342\252\0\0\0\0\0\0\0\0\0U\252\252q\0"
+  "\0\0\0\0\0\0\0\0q\3778\0\34\377\252\0\0\342\306\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\34\215\342\377\342U\0\0\0\0\0\0\306\377\342\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377U8\0U\377\215U\34\34"
+  "U\215\377U8q\377\252\0\0\0\252\377\34\0\0\0\0""8\377\377\215\34\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\252\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\252U\0\34\2528\0\0U\377\252\0\0\0\0\252\377\377\252\0\0\0\0\0\252\377"
+  "\377\377\377\377\377\252\0\0\0\0\252\377\377\377\377\377\34\0U\377\377"
+  "\377\377\377\377\252\0\0\0U\377\377\377\377\377\377\252\0\0\252\377\377"
+  "\377\377\377\377\0\0\0\252\377\377\377\377\377\377\0\0\0\377\377\0\0"
+  "\0\0\252\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377U\0\0\306\377\306"
+  "\0\0\252\377U\0\0\0\0\0\0\377\377\342\0\0\0\0\342\377\377\0\0\0U\377"
+  "\377\342\0\0\0U\377\252\0\0\0\252\377\377\377\377\377U\0\0\0U\377\377"
+  "\377\377\377\377U\0\0\0\252\377\377\377\377\377U\0\0\0U\377\377\377\377"
+  "\377\377\342\0\0\0U\377\377\377\377\377\215\0\252\377\377\377\377\377"
+  "\377\377\377\0\252\377U\0\0\0\0\377\377\0\0\306\377\215\0\0\0\0\215\377"
+  "\252\0\342\377U\0\0""8\377\377\377\0\0\0\252\377q\0q\377\377\34\0\0q"
+  "\377\342\0\0\342\377\215\0\0\0\252\377\252\0\252\377\377\377\377\377"
+  "\377\252\0\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\377\377q\215\34\0\0\0\0\0\0\0"
+  "\0\0\252\377U\0\0\0\0\0\0""8\377\3778\0\0\342\377\215\0\0\377\377\0\0"
+  "\0\0\0\0U\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0U\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377\377\377\377\0\0\0\0\0\0"
+  "\0\0\0\0\0\215\377\377\377\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0U\377\252\0\0""8\377\252\0\377\342\0\0\0\34\306\377\377\377\377\342"
+  "\0\0\0\34\342\377\377\342\34\0\0""8\377\215\0\0\0\0\0\0\0\0\252\377\377"
+  "\377\377\252\0\0\0\0\0\0\0\0\306\377\0\0\215\377U\0\0\215\3778\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0""8\377\342\252\377\3778\0\0\0\0""8\377\342\377q"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252\0\0"
+  "\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0U\377q\0\0\0\0\0U\306\377\342"
+  "8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0U\377q\0U\377U\0\0""8\377\252\0\0\0\0\377\342\377\377\0\0\0\0\0\252"
+  "\377U\0\0U\377\377\34\0\0\215\377\3068\0""8q\0\0U\377\252\0\0""8\342"
+  "\377q\0\0U\377\252\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\215\377\3068\0"
+  "\34qq\0\0\0\377\377\0\0\0\0\252\377U\0\0U\377\252\0\0\0\377\377\0\0\0"
+  "\252\377U\0q\377\342\34\0\0\252\377U\0\0\0\0\0\34\377\377\377\34\0\0"
+  "\34\377\377\3778\0\0U\377\342\377U\0\0U\377\252\0\0q\377\252\34\0U\377"
+  "\377\34\0\0U\377\252\0\0U\377\377\0\0q\377\252\34\0U\377\377\34\0\0U"
+  "\377\252\0\0\34\342\377q\0\34\377\3778\0\34q8\0\0\0\0U\377\252\0\0\0"
+  "\0\252\377U\0\0\0\0\377\377\0\0q\377\306\0\0\0\0\306\377U\0\252\377\252"
+  "\0\0U\377\306\3778\0\0\306\377U\0\0\342\377\215\0\0\342\3778\0\0q\377"
+  "\342\0\0\0\377\3778\0\0\0\0\0\0q\377U\0\0\0\0\0\0\0\0\0\0\0\252\377U"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0"
+  "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0""88\0\0\0\34"
+  "U\0\0\0\377\377\0\0\0\0\0\0U\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8U8\0\0\0\0\0\0\0""8\0\0\0\0""8U8\0"
+  "\0\0\0\0""8UU\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377\342"
+  "qq\215\0\0\0\0\0\0\0\0\0\0q\377\342Uq\377\377\34\0\0\0\0UU\34\0\0\0\0"
+  "\0\0UU\34\0\0\0\0U\377\252\0\0\0\377\252\0\377\252\0\0\0\342\377\306"
+  "\377\342\252\377\0\0\0\215\377qq\377\252\0\0\215\3778\0\0\0\0\0\0\0""8"
+  "\377\342\34\34\342\3778\0\0\0\0\0\0\0\377\252\0\0\342\377\0\0\0U\377"
+  "\215\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\34\0q\377\252\0\0\0\0\306\3778\377"
+  "\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252"
+  "\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0\0\377\252\0\0\0\0\0\0\0"
+  "8\252\0\0\0\0\0\0\0\0\0\0\0\0\215\342\215\306\377\215\342\215\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0U\377U\0U\377\34\0\0\0\377\252\0\0\0""8\377\252\252"
+  "\377U\0\0\0\0\252\377U\0\0\0\252\377U\0\34\377\377\34\0\0\0\0\0\0U\377"
+  "\252\0\0\0""8\377\342\0\0U\377\252\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\34"
+  "\377\377\34\0\0\0\0\0\0\0\0\377\377\0\0\0\0\252\377U\0\0U\377\252\0\0"
+  "\0\377\377\0\0\0\252\377U\34\342\377U\0\0\0\252\377U\0\0\0\0\0U\377\306"
+  "\377U\0\0U\377\342\377U\0\0U\377\252\377\306\0\0U\377\252\0\0\342\377"
+  "\34\0\0\0q\377\215\0\0U\377\252\0\0\0\306\377U\0\342\377\34\0\0\0q\377"
+  "\215\0\0U\377\252\0\0\0U\377\252\0U\377\252\0\0\0\0\0\0\0\0\0U\377\252"
+  "\0\0\0\0\252\377U\0\0\0\0\377\377\0\0""8\377\377\0\0\0\0\377\377\0\0"
+  "\215\377\252\0\0\252\377q\377U\0\0\377\377\34\0\0U\377\377\34q\377\306"
+  "\0\0\0\34\377\3778\0q\377\306\0\0\0\0\0\0\34\377\306\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0"
+  "\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0\0U\377\252\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\377\377\377\306\34\0"
+  "\0\34q\342\252\0\0U\342\377\377\377\306\34\0""8\342\377\377\377\342U"
+  "\0\0\0\0""8\377\252\0\0\0\0U\377\377\377\377\377\252\0\0\0\342\377\34"
+  "\0\0\0\0U\377\377\377\377\377\377\3778\252\377U\0\0\306\377U\0\0U\377"
+  "\377\377\377\215\0\0\0\34\342\377\377\377\215\0\0\0U\377\252\0\0\0\377"
+  "\252\0\377\252\0\0U\377\306\0\377\252\0\0\0\0\0\377\306\0\0\306\377\0"
+  "\0\306\377\0\0\0\0\0\0\0\0U\377\252\0\0\252\377U\0\0\0\0\0\0U\377U\0"
+  "\34\377\252\0\0\0\0\377\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\377\252"
+  "\0\0\0""8\377\215\0\215\377q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\377\252\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0\0"
+  "\306\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8\215\342\377\377"
+  "\306q\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\215\3778\0\252\377\0\0\0\0\377\252"
+  "\0\0\0\215\377Uq\377\215\0\0\0\0\252\377U\0\0\0\252\3778\0U\377\252\0"
+  "\0\0\0\0\0\0U\377\252\0\0\0\0\377\377\34\0U\377\252\0\0\0\0\0\0\0\252"
+  "\377U\0\0\0\0\0U\377\252\0\0\0\0\0\0\0\0\0\377\377\0\0\0\0\252\377U\0"
+  "\0U\377\252\0\0\0\377\377\0\0\0\252\377U\252\377\252\0\0\0\0\252\377"
+  "U\0\0\0\0\0U\377\252\377\252\0\0\252\377\252\377U\0\0U\377\252\306\377"
+  "\34\0U\377\252\0\34\377\342\0\0\0\0""8\377\306\0\0U\377\252\0\0\0\252"
+  "\377U\34\377\342\0\0\0\0""8\377\306\0\0U\377\252\0\0\0q\377\215\0U\377"
+  "\342\34\0\0\0\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0\0\0\0\377\377\0\0"
+  "\0\342\377U\0\0U\377\306\0\0U\377\342\0\0\306\3778\377\215\0\0\377\377"
+  "\0\0\0\0\306\377\215\342\377\34\0\0\0\0\215\377\252\0\306\3778\0\0\0"
+  "\0\0\0\306\3778\0\0\0""8\306\377\377\342U\0\0\0\252\377q\306\377\306"
+  "8\0\0\0\34\252\377\377\306\0\0\34\252\377\342U\377\377\0\0\0q\342\377"
+  "\342U\0U\377\377\377\377\377\0\0q\342\377\377\377\377\215\0\252\377q"
+  "\215\377\377U\0\0\0\377\377\0\0\0\252\377U\0\0\377\377\0\0\342\377\215"
+  "\0U\377\252\0\0U\377Uq\377\377\215\34\306\377\342U\0\0U\377Uq\342\377"
+  "\252\0\0\0\0q\342\377\342q\0\0\0\252\377\34\306\377\342U\0\0\0U\342\377"
+  "\306\34\377\252\0\0\377\252U\342\3778\0\215\377\377\342qU\377\377\377"
+  "\377\252\0U\377\252\0\0U\377\252\0\252\377\215\0\0\34\377\377U\377\342"
+  "\0\0""8\377\377U\0\0\252\377U\215\377\306\0\0U\377\342\0\377\3778\0\0"
+  "8\377\306\0\377\377\377\377\377\377\0\0\215\377\306U\252\377\215\0q\377"
+  "\377\377\252\0\0q\377\215U\306\377\215\0\34\377\215U\215\377\342\0\0"
+  "\0\0\215\3778\0\0\0\0U\377\306\252\252\252q\0\0""8\377\252\0\0\0\0\0"
+  "8\252\252\252\252\252\377\377\0\252\377q\0\0\306\377U\0\34\377\377qU"
+  "\342\3778\0\0\342\377\215U\342\3778\0\0""8\377\252\0\0\0\0\0\0\0\0\0"
+  "\0U\377\252\0\377\252\0\0\0\0\0\377\252\0\0\252\377\0\34\377\252\0\0"
+  "\0\0\0\0\0\0""8\377\342\0\0\342\377\34\0\0\0\0\0\0\252\377\34\0U\377"
+  "\252\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\342\377q\0\0\0"
+  "\306\377\34\0\34\377\342\0\0\0\0\0\0\0\0""8\252\252\0U\3068\0\0\0\0\0"
+  "\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\377\252\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0\0"
+  "q\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\34U\34\0\0\0\0\0\0q\377\377U\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\252\377\377\377\377\377\377\377\377\377\0\0\0\0"
+  "\0\0\0\306\37788\377\342\0\0\0\0\252\377U\0\0U\377\252\0\0\252\377U\0"
+  "\0\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0U\377\306UUUU\0\0\0\252\377U"
+  "\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\377\377UUUU\306\377U\0\0U\377\252"
+  "\0\0\0\377\377\0\0\0\252\377\252\377\342\34\0\0\0\0\252\377U\0\0\0\0"
+  "\0U\377\252\306\342\0\0\342\342\252\377U\0\0U\377\252U\377\215\0U\377"
+  "\252\0U\377\252\0\0\0\0\0\377\377\0\0U\377\252\0\0\0\342\3778U\377\252"
+  "\0\0\0\0\0\377\377\0\0U\377\252\0\0""8\342\3778\0\0\342\377\342q\0\0"
+  "\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0\0\0\0\377\377\0\0\0\252\377\215"
+  "\0\0\215\377q\0\0""8\377\377\0\0\377\252\0\377\252\0U\377\252\0\0\0\0"
+  "8\377\377\377\215\0\0\0\0\0\34\377\377\34\377\306\0\0\0\0\0\0U\377\215"
+  "\0\0\0\0q\377\252\252\377\3778\0\0\252\377\377\306\306\377\342\0\0\34"
+  "\342\377\306\306\342\0\0\215\377\342\252\377\377\377\0\0q\377\342\252"
+  "\377\37788\252\377\377\252\252\0q\377\342\252\306\377\342U\0\252\377"
+  "\377\306\252\377\3778\0\0\377\377\0\0\0\252\377U\0\0\377\377\0q\377\306"
+  "\0\0U\377\252\0\0U\377\377\342\252\377\377\342\306\306\377\342\0\0U\377"
+  "\377\342\252\342\377\215\0\0q\377\342\252\342\377\215\0\0\252\377\377"
+  "\306\306\377\342\34\0\34\342\377\306\306\377\377\252\0\0\377\377\342"
+  "\306\377\34q\377\342\252\342\2158\252\377\377\252q\0U\377\252\0\0U\377"
+  "\252\0U\377\306\0\0U\377\252\0\377\377\0\0q\377\377\215\0\0\377\377\0"
+  "\34\342\3778\0\342\3778\0\252\377q\0\0q\377\215\0\252\252\252\252\377"
+  "\377\0\0\377\377\34\0\34\377\377\0q\342\252\377\252\0\0\0""8\0\0\34\377"
+  "\377\0\0\34\0\0\0\306\377U\0\0\0\377\306\0\0\0\0\0U\377U\0\0\0\0\0\0"
+  "q\377\215\306\377\342U\0\0\0\0\0\0U\377\252\0""8\377\342\34U\377\342"
+  "\0\0\215\377\215\0\0U\377\252\0U\377\306\0\0q\377\252\0\0\0\377\252\0"
+  "\0\0\0\0\0\0\0\0\0\34\377\377q\377\252\0\0\0\0\0\377\252\0\0\252\377"
+  "\0U\377U\0\34UU\0\0\0\0\0\252\377\252\252\377\252\0\0\0\0\0\0\0\342\306"
+  "\0\0\215\377U\0\0\0\0\252\377U\0""8\252\252\252\252\252\252\252\252\252"
+  "\0\0\0\0q\377\342\34\0\0""8\377\215\0\0\0\215\377q\0\0\0\0\0""8\306\377"
+  "\377q\0""8\342\377\342q\0\0\0\0\0U\377U\0\0\0\0\0\0\252\377U\0\0\0\0"
+  "\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8\377\252\0\0\0U\377"
+  "U\0\0\0\0U\377U\0\0\377\342\0\0\0\0""8\377\215\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0U\377U\0\0\0\0\0""8\377q\215\377\34\0\0\0\0\0\0\0\0\0\0\0\0\0q\252"
+  "\377\377\252\252\377\342\252q\0\0\0\0\0\0\34\377\377\0\0\377\3778\0\0"
+  "\0\252\377\377\377\377\377\306\0\0\0\252\377U\0\0\0\0\0\0\0U\377\252"
+  "\0\0\0\0\252\377U\0U\377\377\377\377\377\377U\0\0\252\377\377\377\377"
+  "\377\252\0\252\377U\0U\377\377\377\377\0\0\0\377\377\377\377\377\377"
+  "\377\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377\377\377\215\0\0\0"
+  "\0\0\252\377U\0\0\0\0\0q\377\215\215\377\34\34\377\252\215\377q\0\0U"
+  "\377\252\0\342\342\0U\377\252\0U\377\252\0\0\0\0\0\377\377\0\0U\377\306"
+  "UU\306\377\306\0U\377\252\0\0\0\0\0\377\377\0\0U\377\377\377\377\377"
+  "\3068\0\0\0U\342\377\377\342q\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0\0"
+  "\0\0\377\377\0\0\0U\377\306\0\0\306\3778\0\0\0\377\377\34""8\377\215"
+  "\0\306\377\0U\377\252\0\0\0\0\0\252\377\377\34\0\0\0\0\0\0\215\377\252"
+  "\3778\0\0\0\0\0\0\342\377\34\0\0\0\0\0\0\0\0q\377\252\0\0\252\377\306"
+  "\0\0\306\377U\0\215\377\215\0\0\0\0\0\377\377\34\0q\377\377\0\0\377\377"
+  "\34\0q\377\252\0\0\377\377\0\0\0\342\377\34\0\0\342\377\34\0\252\377"
+  "\306\0\0\252\377U\0\0\377\377\0\0\0\252\377U\0\0\377\377\34\377\377\34"
+  "\0\0U\377\252\0\0U\377\306\0\0\252\377\306\0\0\377\377\0\0U\377\377\34"
+  "\0U\377\252\0\0\377\377\34\0\34\377\377\0\0\252\377\306\0\0\306\377U"
+  "\0U\377\306\0\0\306\377\252\0\0\377\377U\0U\0\252\377U\0\0\0\0\0\377"
+  "\377\0\0\0U\377\252\0\0U\377\252\0\0\377\377\0\0\252\377q\0\342\3778"
+  "\0\252\377\342\306\0\0\377\306\0\0U\377\306q\377\215\0\0U\377\306\0\0"
+  "\252\377U\0\0\0\0q\377\215\0""8\377\306\0\0\0\306\377U\0\0U\377\252\0"
+  "\0\0\0\0\0\0\377\377\0\0\0\0\0\0\306\377U\0\0q\377q\0\0\0\0\0\252\377"
+  "U\0\0\0\0\0\0\252\377\377\306\306\377\342\34\0\0\0\0\0\252\377U\0\0U"
+  "\377\377\377\342\34\0\0\252\377U\0\0\0\377\342\0\215\377q\0\0\34\377"
+  "\377\0\0\0\377\252\0\0\0\0\0\0\0\0\0\0\0U\377\377\377\342q\0\0\0\0\252"
+  "\377\34\34\377\306\0\252\377\34U\377\377\377\342\34\0\0\0""8\377\377"
+  "\377\215\0\0\0\0\0\0\0""8\377\215\0\0\252\377U\0\0\0\0\252\377U\0U\377"
+  "\377\377\377\377\377\377\377\377\0\0\0\34\342\377U\0\0\0\306\377\34\0"
+  "\0\0\0\342\342\0\0\0""8\306\377\342q\34\0\0\0\0q\306\377\342q\0\0\0U"
+  "\377U\0\0\0\0\0\0\377\377\252\0\0\0\0\0\377\377\252\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0""8\342\3778\0\0\0U\377U\0\0\0\0U\377U\0\0q\377\3068"
+  "\0\0\0\342\342\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0U\306\0\0\306"
+  "8\0\0\0""8\252\2158\0\0\0""8\0\0\0\0\377\252\0\0\377\252\0\0\0\0\0\0"
+  "\0\0U\377\252\0\0\252\377q\0\0\0\252\377\306\252\252\342\377\342\34\0"
+  "\252\377U\0\0\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0U\377\306UUUU\0\0"
+  "\0\252\377\306\252\252\252q\0\252\377U\0""8\252\252\377\377\0\0\0\377"
+  "\377UUUU\306\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377\215\377\377"
+  "\34\0\0\0\0\252\377U\0\0\0\0\0\252\377UU\377UU\377UU\377\252\0\0U\377"
+  "\252\0q\377UU\377\252\0U\377\252\0\0\0\0\0\377\377\0\0U\377\377\377\377"
+  "\377\306\34\0U\377\252\0\0\0\0\0\377\377\0\0U\377\342\252\342\377\252"
+  "\0\0\0\0\0\34\215\342\377\377\252\0\0\0\0U\377\252\0\0\0\0\252\377U\0"
+  "\0\0\0\377\377\0\0\0\0\377\377\0\0\377\342\0\0\0\0\342\377UU\377U\0\252"
+  "\377\34\215\377U\0\0\0\0\0\342\377\377q\0\0\0\0\0\0\34\377\377\306\0"
+  "\0\0\0\0\0q\377q\0\0\0\0\0\0\0""8U\215\377\252\0\0\252\377q\0\0q\377"
+  "\252\0\342\377\34\0\0\0\0U\377\306\0\0\34\377\377\0U\377\252\0\0\0\377"
+  "\342\0\0\377\377\0\0\0\377\377\0\0\0\252\377U\0\252\377U\0\0\252\377"
+  "U\0\0\377\377\0\0\0\252\377U\0\0\377\377\252\377U\0\0\0U\377\252\0\0"
+  "U\377U\0\0\252\377U\0\0\377\377\0\0U\377\252\0\0U\377\252\0U\377\306"
+  "\0\0\0\306\377U\0\252\377U\0\0q\377\252\0\252\377U\0\0q\377\252\0\0\377"
+  "\377\0\0\0\0\215\377\3428\0\0\0\0\377\377\0\0\0U\377\252\0\0U\377\252"
+  "\0\0\306\377U\0\306\377\34\0\252\377U\0\342\306\252\377\0U\377\252\0"
+  "\0\0\306\377\342\342\0\0\0\0\377\377\0\0\377\377\0\0\0\0\34\377\342\0"
+  "\0U\377\252\0\0\0\252\377U\0\0U\377\252\0\0\0\0\0\0q\377\306\0\0\0\0"
+  "\34q\377\342\0\0\0\306\377\0""8\3778\0\0\252\377\215\252\252q\0\0\0\252"
+  "\377\306\0\0\306\377q\0\0\0\0\34\377\377\0\0\34\342\377\306\342\377\252"
+  "\0\0\252\377U\0\0\0\377\377\0\252\377U\0\0\0\377\377\0\0\0\377\252\0"
+  "\0\0\0\0\0\0\0\0\0\0\0""8\252\377\377\377\342\34\0\0""8\377\377\377\377"
+  "8\0\377\306\0\342\342Uq\377\252\0\0\34\342\377\377\377\34\0U\377U\0\0"
+  "\0q\3778\0\0\252\377U\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\377"
+  "\306\0\0\0""8\377\215\0\0\0\0\0q\377U\0\215\377\306U\0\0\0\0\0\0\0\0"
+  "\0""8\252\377\342\0\0U\377U\0\0\0\0\0\0U\252\34\0\0\0\0\0U\252\34\0""8"
+  "UUU8\0\0\0\0\0\0\0\0\0\0\0\252\377\306\0\0\0\0U\377U\0\0\0\0U\377U\0"
+  "\0\34\306\377\252\0\0\0\215\377\34\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\215\377\377\377\377\306U\252\377\0\0\0\0\377\252"
+  "\0""8\377q\0\0\0\0\0\0\0\0\252\377\252UU\252\377\306\0\0\0\252\377U\0"
+  "\0\0\215\377\306\0\252\377U\0\0\0\0\0\0\0U\377\252\0\0\0\0\252\377U\0"
+  "U\377\252\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\252\377U\0\0\0\0\377\377\0"
+  "\0\0\377\377\0\0\0\0\252\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377"
+  "U\306\377\306\0\0\0\0\252\377U\0\0\0\0\0\252\377U\0\377\252\252\377\34"
+  "U\377\252\0\0U\377\252\0\34\377\306U\377\252\0U\377\252\0\0\0\0\0\377"
+  "\377\0\0U\377\306UU8\0\0\0U\377\252\0\0\0\0\0\377\377\0\0U\377\252\0"
+  "\34\342\377\215\0\0\0\0\0\0\0\252\377\377\34\0\0\0U\377\252\0\0\0\0\252"
+  "\377U\0\0\0\0\377\377\0\0\0\0\306\377UU\377\252\0\0\0\0\252\377U\252"
+  "\377\34\0U\377U\252\377U\0\0\0\0\215\377\306\377\377\34\0\0\0\0\0\0\306"
+  "\377U\0\0\0\0\0\34\377\342\0\0\0\0\0\0U\377\377\377\377\377\252\0\0\252"
+  "\377U\0\0U\377\252\0\377\377\0\0\0\0\0U\377\252\0\0\0\377\377\0U\377"
+  "\377\377\377\377\377\377\0\0\377\377\0\0\0\342\3778\0\0\342\3778\0\252"
+  "\377U\0\0\252\377U\0\0\377\377\0\0\0\252\377U\0\0\377\377\377\377\34"
+  "\0\0\0U\377\252\0\0U\377U\0\0\252\377U\0\0\377\377\0\0U\377\252\0\0U"
+  "\377\252\0U\377\252\0\0\0\252\377U\0\252\377U\0\0U\377\252\0\252\377"
+  "U\0\0U\377\252\0\0\377\377\0\0\0\0\0\252\377\377\252\34\0\0\377\377\0"
+  "\0\0U\377\252\0\0U\377\252\0\0q\377q\0\377\342\0\0U\377\252\34\377\252"
+  "\215\3778q\377U\0\0\0""8\377\377q\0\0\0\0\306\377U8\377\306\0\0\0\0\252"
+  "\3778\0\0U\377\252\0\0\0\252\377U\0\0U\377\252\0\0\0\0\0\34\342\377q"
+  "\0\0\0\252\377\377\342\34\0\0\34\377\252\0U\377U\0\0\252\377\377\377"
+  "\377\377\215\0\0\252\377U\0\0U\377\252\0\0\0\0q\377\252\0\0\252\377q"
+  "\0\34\342\377q\0\215\377\252\0\0""8\377\377\0\252\377U\0\0\0\377\377"
+  "\0\0\0\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\306\342\377\252\0\0\0"
+  "8\252\2528\0""8\377\215U\377q\0\0\306\377\0\0\215\377\252U\377\342\34"
+  "U\377U\0\0\0\306\377\0\0\0\252\377U\0\0\0\0\252\377U\0\34UUUUUUUUU\0"
+  "\0\0\252\377U\0\0\0\0""8\34\0\0\0\0\0\0U\0\0q\377\377\306U\0\0\0\0\0"
+  "\0\0""8\215\342\377\306\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\252\377\377\377\252\0\0\0\0\0\0\0\0\0\0\0\0\252\377q\0\0\0U\377U\0\0"
+  "\0\0U\377U\0\0\306\377q\0\0\0\0U\377q\0\0\0\0\0\0\0\0\0\252\377\377\377"
+  "\377\377\377\377\252\0\0\0\0\0\0\0\0\0\0Uq\0""8\306\377\377\377U\0""8"
+  "\377\377\377\377\377\377\377\377\377U\0\0\0\0\0\0\377\377\377\377\377"
+  "\377\377\377\34\0\0\252\377U\0\0\0\0\377\377\0U\377\252\0\0\0\0\0\0\0"
+  "U\377\252\0\0\0\0\342\377\34\0U\377\252\0\0\0\0\0\0\0\252\377U\0\0\0"
+  "\0\0q\377\252\0\0\0\0\377\377\0\0\0\377\377\0\0\0\0\252\377U\0\0U\377"
+  "\252\0\0\0\377\377\0\0\0\252\377U\34\377\377q\0\0\0\252\377U\0\0\0\0"
+  "\0\252\377U\0\306\342\306\306\0U\377\252\0\0U\377\252\0\0\252\377q\377"
+  "\252\0\34\377\342\0\0\0\0""8\377\306\0\0U\377\252\0\0\0\0\0\0\34\377"
+  "\342\0\0\0\0""8\377\306\0\0U\377\252\0\0""8\377\377\34\0\0\0\0\0\0\0"
+  "\306\377U\0\0\0U\377\252\0\0\0\0\252\377U\0\0\0\0\377\377\0\0\0\0q\377"
+  "\215\215\377U\0\0\0\0q\377\252\306\377\0\0""8\377q\342\377\0\0\0\0\34"
+  "\377\377\34\306\377\252\0\0\0\0\0\0\252\377U\0\0\0\0\0\252\3778\0\0\0"
+  "\0\0\34\377\377\215U\215\377\252\0\0\252\377U\0\0U\377\252\0\377\377"
+  "\0\0\0\0\0U\377\252\0\0\0\377\377\0U\377\342\252\252\252\252\252\0\0"
+  "\377\377\0\0\0q\377\342\252\306\377\306\0\0\252\377U\0\0\252\377U\0\0"
+  "\377\377\0\0\0\252\377U\0\0\377\377\215\377\306\0\0\0U\377\252\0\0U\377"
+  "U\0\0\252\377U\0\0\377\377\0\0U\377\252\0\0U\377\252\0U\377\252\0\0\0"
+  "\252\377U\0\252\377U\0\0U\377\252\0\252\377U\0\0U\377\252\0\0\377\377"
+  "\0\0\0\0\0\0""8\342\377\342\0\0\377\377\0\0\0U\377\252\0\0U\377\252\0"
+  "\0""8\377\252U\377\215\0\0\34\377\252U\377UU\377q\252\3778\0\0\0\215"
+  "\377\377\342\0\0\0\0q\377\215q\377\215\0\0\0U\377\252\0\0\0U\377\252"
+  "\0\0\0\252\377U\0\0U\377\252\0\0\0\0\34\342\377\252\0\0\0\0q\252\377"
+  "\377\252\0\0\215\3778\0\215\377U\0\0U\377\215\0""8\377\377\34\0\252\377"
+  "U\0\0U\377\252\0\0\0\0\306\377U\0\0\377\377\0\0\0U\377\252\0""8\377\377"
+  "qU\342\377\377\0\252\377U\0\0\0\377\377\0\0\0\215U\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\377\252\34\377\377\0\0\0\0\0\0\0\0\215\3778U\377U\0\0\252"
+  "\377\0\0\377\377\0\0U\377\342\342\377\34\0\0\0\377\252\0\0\0\252\377"
+  "U\0\0\0\0\252\377U\0U\377\377\377\377\377\377\377\377\377\0\0\0U\252"
+  "8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34q\342\377\377\2528\0\34\215\342\377"
+  "\377\2158\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8UUU8\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\34\377\252\0\0\0U\377U\0\0\0\0U\377U\0\0\377\306"
+  "\0\0\0\0\0\0\377\306\0\0\0\0\0\0\0\0\0q\252\252\306\377\306\252\252q"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34U\34\0\0""8\252\306\377\306\252\342"
+  "\377\252\252\34\0\0\0\0\0""8\377\377UUUU\342\377q\0\0\252\377U\0\0\0"
+  "\34\377\377\0\34\377\377\34\0\0\0\0\0\0U\377\252\0\0\0""8\377\342\0\0"
+  "U\377\252\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\34\377\377\34\0\0\0\377\377"
+  "\0\0\0\377\377\0\0\0\0\252\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252"
+  "\377U\0\215\377\342\34\0\0\252\377U\0\0\0\0\0\252\377U\0\215\377\377"
+  "\215\0U\377\252\0\0U\377\252\0\0""8\377\306\377\252\0\0\342\377\34\0"
+  "\0\0q\377\215\0\0U\377\252\0\0\0\0\0\0\0\342\377\34\0\0\0q\377\215\0"
+  "\0U\377\252\0\0\0\306\377q\0\0\0\0\0\0\0\252\377U\0\0\0U\377\252\0\0"
+  "\0\0\252\377q\0\0\0\34\377\377\0\0\0\0\34\377\252\252\377\0\0\0\0\0U"
+  "\377\252\377\252\0\0\0\377\252\377\377\0\0\0\0\306\377\215\0""8\377\377"
+  "8\0\0\0\0\0\252\377U\0\0\0\0""8\377\306\0\0\0\0\0\0U\377\252\0\0U\377"
+  "\252\0\0\252\377q\0\0q\377\215\0\306\3778\0\0\0\0""8\377\306\0\0\34\377"
+  "\377\0\34\377\306\0\0\0\0\0\0\0\377\377\0\0\0\0\342\377\377\377\215\34"
+  "\0\0\252\377U\0\0\252\377U\0\0\377\377\0\0\0\252\377U\0\0\377\377\0\342"
+  "\377q\0\0U\377\252\0\0U\377U\0\0\252\377U\0\0\377\377\0\0U\377\252\0"
+  "\0U\377\252\0\34\377\342\0\0\0\342\377\34\0\252\377\215\0\0q\377\215"
+  "\0\215\377q\0\0\215\377\252\0\0\377\377\0\0\0\0\0\0\0\0\306\377U\0\377"
+  "\377\0\0\0U\377\252\0\0q\377\252\0\0\0\342\377q\377U\0\0\0\342\377\215"
+  "\377\34\0\377\252\306\377\0\0\0""8\377\306\306\377\215\0\0\0\34\377\306"
+  "\252\3778\0\0\0\342\342\34\0\0\0\34\377\377\0\0\0\377\377\0\0\0U\377"
+  "\252\0\0\0\34\342\377\252\0\0\0\0\0\0\0\34\342\377q\0\342\342\0\0\252"
+  "\377U\0\0\0\0\0\0\0\252\377U\0q\377q\0\0q\377\215\0\0\0\34\377\377\0"
+  "\0\0\377\377\0\0\0U\377\252\0\0U\377\377\377\252\377\377\0q\377\252\0"
+  "\0U\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252\0\377\377\0"
+  "\0\0\0\0\0\0\0\306\342\0U\377U\0\0\252\377\0\0\377\377\0\0\0U\377\377"
+  "\306\0\0\0U\377U\0\0\0U\377\252\0\0\0\0\342\377\0\0\34UUUUUUUUU\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8\252\377\252\0U\377\306"
+  "q\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\377\252\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252"
+  "\0\0\0\0\0\0\252\377\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\215\377\34\0\252\377\0\0\0\0\0\0\0\0"
+  "\215\377\252\0\0\0\0\252\377\252\0\0\252\377U\0\0\34\252\377\306\0\0"
+  "\215\377\3068\0\34U\0\0U\377\252\0\0""8\342\377q\0\0U\377\252\0\0\0\0"
+  "\0\0\0\252\377U\0\0\0\0\0\0\252\377\3068\0\0\377\377\0\0\0\377\377\0"
+  "\0\0\0\252\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377U\0\34\342\377"
+  "\215\0\0\252\377U\0\0\0\0\0\377\377\0\0U\377\377U\0\0\377\377\0\0U\377"
+  "\252\0\0\0\342\342\377\252\0\0q\377\342\34\0U\377\377\34\0\0U\377\252"
+  "\0\0\0\0\0\0\0q\377\342\34\0U\377\377\34\0\0U\377\252\0\0\0q\377\342"
+  "\0\0\252U\0\0q\377\342\0\0\0\0U\377\252\0\0\0\0U\377\3428\0\34\252\377"
+  "\215\0\0\0\0\0\342\377\377\306\0\0\0\0\0\34\377\252\377\215\0\0\0\306"
+  "\252\377\252\0\0\0""8\377\342\34\0\0\306\377\306\0\0\0\0\0\252\377U\0"
+  "\0\0\0\306\3778\0\0\0\0\0\0U\377\306\0\34\342\377\252\0\0\252\377\342"
+  "\34\34\342\377U\0q\377\306\34\0\34\0\0\377\377U\0\252\377\377\0\0\342"
+  "\377q\0\0U\34\0\0\377\377\0\0\0""8\377q\0\0\0\0\0\0\252\377U\0\0\252"
+  "\377U\0\0\377\377\0\0\0\252\377U\0\0\377\377\0q\377\342\34\0U\377\252"
+  "\0\0U\377U\0\0\252\377U\0\0\377\377\0\0U\377\252\0\0U\377\252\0\0\306"
+  "\377U\0U\377\342\0\0\252\377\342\34\34\342\377U\0U\377\342\34\34\342"
+  "\377\252\0\0\377\377\0\0\0\0UU\0\0\306\377U\0\377\377\34\0\0U\377\306"
+  "\0\34\342\377\252\0\0\0\252\377\252\377\0\0\0\0\252\377\252\377\0\0\306"
+  "\306\377\252\0\0\0\342\3778\34\377\377\34\0\0\0\306\377\342\377\0\0\0"
+  "\215\377q\0\0\0\0\0\306\377q\0\215\377\306\0\0\0U\377\252\0\0U\377\377"
+  "\252\0\0\0\0\0\0\0\0\0U\377\252U\377\342\252\252\342\377\306q\0\0\0\0"
+  "\0\0\252\377U\0\34\377\342\34\34\342\3778\0\0\0q\377\252\0\0\0\306\377"
+  "\215\0\34\306\377q\0\0\0\34U8\34\377\306\0\34\377\377\34\34\306\377q"
+  "\0\0U\377\252\0\0\0\0\0\0\0\0\0\0\0\215U\0\377\306\252\377\252\0\0\0"
+  "\0\0\0\0\34\377\252\0\0\377\306\0\34\377\306\0\0\306\377\252\34\0U\342"
+  "\377\252\0\0\0\252\377\34\0\0\0""8\377\252\0\0\0\0\377\342\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\34""8\0\34\34\0\0\0\0\0\0\0\0U\377U\0\34\342\342\34\0\252\377U\34"
+  "\342\342\34\0\252\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252"
+  "\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0\0\0\0q\377U\0\0\0\0\0\0"
+  "\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252"
+  "\377\0\0\306\342\0\0\0\0\0\0\0\0\306\377U\0\0\0\0U\377\377\0\0\252\377"
+  "\377\377\377\377\377\342\34\0\0\0\252\377\377\377\377\377\34\0U\377\377"
+  "\377\377\377\377\252\0\0\0U\377\377\377\377\377\377\342\0\0\252\377U"
+  "\0\0\0\0\0\0\34\306\377\377\377\377\377\377\0\0\0\377\377\0\0\0\0\252"
+  "\377U\0\0U\377\252\0\0\0\377\377\0\0\0\252\377U\0\0q\377\3778\0\252\377"
+  "\377\377\377\377\377\0\377\377\0\0\0UU\0\0\0\377\377\0\0U\377\252\0\0"
+  "\0q\377\377\252\0\0\0\252\377\377\377\377\377U\0\0\0U\377\252\0\0\0\0"
+  "\0\0\0\0\252\377\377\377\377\377\3428\0\0U\377\252\0\0\0""8\377\3778"
+  "U\377\377\377\377\377\377U\0\0\0\0U\377\252\0\0\0\0\0\252\377\377\377"
+  "\377\377\342\34\0\0\0\0\0\215\377\377q\0\0\0\0\0\0\377\377\377U\0\0\0"
+  "\252\377\377\252\0\0\0\342\377q\0\0\0\34\377\377q\0\0\0\0\252\377U\0"
+  "\0\0\0\377\377\377\377\377\377\377\377\0\0\342\377\377\377\342\377\252"
+  "\0\0\252\377\306\377\377\377\342\0\0\0\342\377\377\377\377\34\0\215\377"
+  "\377\377\342\342\377\0\0""8\377\377\377\377\377\215\0\0\377\377\0\0\0"
+  "8\377\377\377\377\377\306\34\0\252\377U\0\0\252\377U\0\0\377\377\0\0"
+  "\0\252\377U\0\0\377\377\0\0\306\377\252\0""8\377\377\377UU\377U\0\0\252"
+  "\377U\0\0\377\377\0\0U\377\252\0\0U\377\252\0\0""8\377\377\377\377\377"
+  "8\0\0\252\377\377\377\377\377\306\0\0\0\306\377\377\377\377\377\252\0"
+  "\0\377\377\0\0\0\0\377\377\377\377\377\306\0\0\342\377\377\342\0\34\377"
+  "\377\377\377\306\377\252\0\0\0U\377\377\252\0\0\0\0q\377\342\252\0\0"
+  "\252\377\377\215\0\0q\377\252\0\0\215\377\306\0\0\0q\377\377\252\0\0"
+  "\0\377\377\377\377\377\377U\0""8\377\377\377\377\342\34\0U\377\377\377"
+  "\377\377\0\252\377\377\377\377\377\377U\0\0\0\0\0U\377\252U\377\377\377"
+  "\377\377\377\377\252\0\0\0\0\0\0\306\3778\0\0\215\377\377\377\377\252"
+  "\0\0\0\0\306\377U\0\0\0""8\342\377\377\377\377\342\0\0\0\0\0\0\0q\377"
+  "\215\0\0\215\377\377\377\377\252\0\0\0\252\377\377\0\0\0\0\0\0\0\0\0"
+  "\0U\377\377\377\377\377\377\342\34\0\0\0\0\0\0\0U\377U\0\0\215\377\377"
+  "\377\3778\0\0\34\342\377\377\377\377\377\306\377\252\0\0\342\306\0\0"
+  "\0\0\0\377\377\0\0\0""8\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
+  "\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0U\377U\0U\377\377U\0\377\377\252U\377\377U\0\377\377\252\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252\0\0\0U\377U\0\0\0\0U\377U\0\0"
+  "\377\252\0\0\0\0\0\0\34\377\252\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\342\0\0\377\252\0\0\0\0"
+  "\0\0\0\0\252\252\34\0\0\0\0\0\252\252\34\0q\252\252\252\252\252q\34\0"
+  "\0\0\0\0""8\252\252\252U\0\0""8\252\252\252\252\2528\0\0\0\0""8\252\252"
+  "\252\252\252\252\215\0\0U\252\34\0\0\0\0\0\0\0\0U\252\252\252q\34\0\0"
+  "\0\252\252\0\0\0\0q\2528\0\0""8\252q\0\0\0\377\377\0\0\0q\2528\0\0\0"
+  "\215\252q\0q\252\252\252\252\252\252\0\252\252\0\0\0\0\0\0\0\0\252\252"
+  "\0\0""8\252q\0\0\0\34\252\252q\0\0\0\0U\252\252\2158\0\0\0\0""8\252q"
+  "\0\0\0\0\0\0\0\0\0U\252\252\215q\377\377\252\0""8\252q\0\0\0\0\215\252"
+  "8\0U\215\252\252\215\34\0\0\0\0\0""8\252q\0\0\0\0\0\0U\252\252\252q\0"
+  "\0\0\0\0\0\0""8\252\252\34\0\0\0\0\0\0\215\252\252\34\0\0\0U\252\252"
+  "8\0\0""8\252\252\0\0\0\0\0q\252q\0\0\0\0q\2528\0\0\0\0\252\252\252\252"
+  "\252\252\252\252\0\0\34\215\252q\34\252\252\0\0q\252\0\215\252\215\34"
+  "\0\0\0\0q\252\252\215\34\0\0q\252\252\34q\252\0\0\0\34\215\252\252q\34"
+  "\0\0\252\252\0\0\0\0q\252\252\252\306\377\306\0q\2528\0\0q\2528\0\0\252"
+  "\252\0\0\0\252\377U\0\0\252\252\0\0""8\252\252\0\0q\252\252\34""8\252"
+  "8\0\0q\2528\0\0\252\252\0\0""8\252q\0\0""8\252q\0\0\0\34\215\252\215"
+  "\34\0\0\0\252\377U\215\252\215\34\0\0\0\34\215\252\215U\377\252\0\0\252"
+  "\252\0\0\0\0""8\215\252\252q\0\0\0\34\252\252\215\0\0""8\252\252U\0\252"
+  "q\0\0\0\0\252\252U\0\0\0\0\34\252\252U\0\0""8\252\2528\0\0\252\252\34"
+  "\0\0\34\252\252\34\0\0\0q\377q\0\0\0\252\252\252\252\252\2528\0\0\34"
+  "\215\252\215\34\0\0""8\252\252\252\252\252\0q\252\252\252\252\252\252"
+  "8\0\0\0\0\0\306\377q\0\0\0\0\0\252\377U\0\0\0\0\0\0""8\377\342\0\0\0"
+  "\0U\252\252q\0\0\0\0\34\377\377\0\0\0\0\0\34\215\252\252q\0\0\0\0\0\0"
+  "\0\0\342\3778\0\0\0""8\252\252q\0\0\0\0\34\252U\0\0\0\0\0\0\0\0\0\0\0"
+  "U\252\252\377\342q\0\0\0\0\0\0\0\0\0\252\377\0\0\0\0q\252\2528\0\0\0"
+  "\0\34q\252\252q\34\0\342\215\0""8\377\215\0\0\0\0\0\252\3778\0\0q\377"
+  "U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\252\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\306\3778\0q\377\215"
+  "\0\215\215\0\0U\252\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252"
+  "\0\0\0U\377U\0\0\0\0U\377U\0\0\377\252\0\0\0\0\0\0\0\342\342\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\252q\0\0\252U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\252"
+  "\0\0\0\0\306\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0U\377\252\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\3778\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\306\377"
+  "\342\0\0\0\0\0\0\252\377U\0\0\0\0\34q\377\377U\0\0\0\0\0\0\0\0\0\0\0"
+  "\0q\377\306\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\342\377\252\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\252\0\0\0\0\0\0\0"
+  "\0\0\0\252\215\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\3778\0\0"
+  "\0\0\0""8\377\215\0\0\306\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377"
+  "U\0\34\377\252\0\0\306\342\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\377\342\0\0\0U\377U\0\0\0\0U\377U\0""8\377\252\0\0\0\0"
+  "\0\0\0\215\3778\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0q\377\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34""8\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\342\377\215\0\0""8\342\342\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34"
+  "\342\3778\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0U"
+  "\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\377"
+  "\306\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0U\377\377\377\377\306\34\0\0\0\0\0\0\252\377U\0\0\252\377\377\377"
+  "\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\252\377q\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\252\377\377\377\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\252q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0q\252\0\0\0\0\0\0\0\252\215\0\0\342q\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0U\377U\0\34\215\0\0\0\215\34\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0U\377\377\377\377\377\377\377\377\377U\0\0\252\377\377\252"
+  "\0U\377\377\377UU\377\377\377U\252\377\377q\0\0\0\0\0\0\0""8\2528\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0""8\377\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377\377"
+  "\377\377\377\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\342\377\252\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\252\377U\0\0\0\0\0\0\0\0\0\0\0U\377\252\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\377\3778\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\252\252"
+  "q8\0\0\0\0\0\0\0\0""8U\34\0\0U\252\252U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\252q8\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\34UUUUUUUUU\34\0\0\34\215\252q\0""8\252\252\252"
+  "88\252\252\2528q\252\215\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2158\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""8\215\252\252q\34\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0Uq\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0q\2528\0\0\0"
+  "\0\0\0\0\0\0\0\0""8\252q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\34\252\34\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0U\377U\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+
+static DFBSurfaceDescription font_desc = {
+  flags                   : DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |
+                            DSDESC_PREALLOCATED,
+  width                   : 824,
+  height                  : 21,
+  pixelformat             : DSPF_A8,
+  preallocated : {{  data : (void *) font_data,
+                    pitch : 824  }}
+};
+
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_default.c b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_default.c
new file mode 100755
index 0000000..323d61a
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_default.c
@@ -0,0 +1,322 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdarg.h>
+
+#include <directfb.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <media/idirectfbfont.h>
+
+#include <direct/hash.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/utf8.h>
+
+#include "default_font.h"
+
+#define DEFAULT_FONT_HEIGHT     24
+#define DEFAULT_FONT_ASCENDER   16
+#define DEFAULT_FONT_DESCENDER  -4
+
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, Default )
+
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx )
+{
+     /* default font is created with a NULL filename */
+     if (ctx->filename)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc )
+{
+     DFBResult         ret;
+     CoreFont         *font;
+     CoreSurface      *surface;
+     CoreFontCacheRow *row;
+     u8               *pixels;
+     int               i;
+
+     CoreSurfaceConfig  config;
+
+     D_DEBUG( "DirectFB/FontDefault: Construct default font");
+
+     if (desc->flags & DFDESC_ROTATION) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_UNSUPPORTED;
+     }
+
+     ret = dfb_font_create( core, desc, "", &font );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     D_ASSERT( font->pixel_format == DSPF_ARGB ||
+               font->pixel_format == DSPF_AiRGB ||
+               font->pixel_format == DSPF_ARGB4444 ||
+               font->pixel_format == DSPF_RGBA4444 ||
+               font->pixel_format == DSPF_ARGB2554 ||
+               font->pixel_format == DSPF_ARGB1555 ||
+               font->pixel_format == DSPF_A8 ||
+               font->pixel_format == DSPF_A4 ||
+               font->pixel_format == DSPF_A1 );
+
+     font->height    = DEFAULT_FONT_HEIGHT;
+     font->ascender  = DEFAULT_FONT_ASCENDER;
+     font->descender = DEFAULT_FONT_DESCENDER;
+     font->up_unit_x =  0.0;
+     font->up_unit_y = -1.0;
+
+     row = D_CALLOC( 1, sizeof(CoreFontCacheRow) );
+     if (!row) {
+          D_OOM();
+          dfb_font_destroy( font );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_NOSYSTEMMEMORY;
+     }
+
+     config.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+     config.size.w = font_desc.width;
+     config.size.h = font_desc.height;
+     config.format = font->pixel_format;
+     config.caps   = font->surface_caps;
+
+     ret = dfb_surface_create( core, &config, CSTF_FONT, 0, NULL, &surface );
+     if (ret) {
+          dfb_font_destroy( font );
+          return ret;
+     }
+
+     font->num_rows  = 1;
+     font->row_width = font_desc.width;
+     font->rows      = D_MALLOC(sizeof (void *));
+     font->rows[0]   = row;
+
+     row->surface = surface;
+
+     D_MAGIC_SET( row, CoreFontCacheRow );
+
+     pixels = font_data;
+
+     {
+          CoreGlyphData *data;
+          int use_unicode;
+          int start = 0;
+          int index = 0;
+          int key;
+          const char *glyphs =
+          "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+          "abcdefghijklmnopqrstuvwxyz"
+          "01234567890!\"$%&/()=?^<>" // FIXME: '0' is repeated!
+          "|,;.:-_{[]}\\`+*~#'";
+
+          if (desc && (desc->flags & DFDESC_ATTRIBUTES) &&
+              (desc->attributes & DFFA_NOCHARMAP))
+               use_unicode = 0;
+          else
+               use_unicode = 1;
+
+          for (i = 0; i < font_desc.width; i++) {
+               if (pixels[i] == 0xFF) {
+                    if (use_unicode)
+                         key = glyphs[index];
+                    else
+                         key = index;
+                         
+                    if (!direct_hash_lookup( font->layers[0].glyph_hash, key )) { 
+                         data = D_CALLOC( 1, sizeof(CoreGlyphData) );
+                         data->surface = surface;
+                         data->start   = start;
+                         data->width   = i - start + 1;
+                         data->height  = font_desc.height - 1;
+                         data->left    = 0;
+                         data->top     = 0;
+                         data->xadvance = ((desc && (desc->flags &
+                                                    DFDESC_FIXEDADVANCE)) ?
+                                         desc->fixed_advance :
+                                         data->width + 1);
+                         data->yadvance = 0;
+
+                         D_DEBUG( "DirectFB/core/fonts: "
+                                       "glyph '%c' at %d, width %d\n",
+                                       glyphs[index], start, i-start );
+
+                         D_MAGIC_SET( data, CoreGlyphData );
+
+                         if (font->maxadvance < data->xadvance)
+                              font->maxadvance = data->xadvance;
+                              
+                         direct_hash_insert( font->layers[0].glyph_hash, key, data );
+                    }
+
+                    start = i + 1;
+                    index++;
+               }
+               if (glyphs[index] == '\0')
+                    break;
+          }
+
+          /*  space  */
+          data = D_CALLOC( 1, sizeof(CoreGlyphData) );
+          data->xadvance = 5;
+          data->yadvance = 0;
+
+          D_MAGIC_SET( data, CoreGlyphData );
+
+          if (use_unicode)
+               key = 32;
+          else
+               key = index;
+
+          direct_hash_insert( font->layers[0].glyph_hash, key, data );
+     }
+
+     {
+          CoreSurfaceBufferLock lock;
+
+          ret = dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+          if (ret) {
+               D_DERROR( ret, "IDirectFBFont_Default: Could not lock surface buffer!\n" );
+          }
+          else {
+               for (i = 1; i < font_desc.height; i++) {
+                    int    i, j, n;
+                    u8  *dst8  = lock.addr;
+                    u16 *dst16 = lock.addr;
+                    u32 *dst32 = lock.addr;
+
+                    pixels += font_desc.preallocated[0].pitch;
+                    switch (surface->config.format) {
+                         case DSPF_ARGB:
+                              if (surface->config.caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<font_desc.width; i++)
+                                        dst32[i] = pixels[i] * 0x01010101;
+                              }
+                              else
+                                   for (i=0; i<font_desc.width; i++)
+                                        dst32[i] = (pixels[i] << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_AiRGB:
+                              for (i=0; i<font_desc.width; i++)
+                                   dst32[i] = ((pixels[i] ^ 0xFF) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_ARGB4444:
+                         case DSPF_RGBA4444:
+                              if (surface->config.caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<font_desc.width; i++)
+                                        dst16[i] = (pixels[i] >> 4) * 0x1111;
+                              }
+                              else {
+                                   if( surface->config.format == DSPF_ARGB4444 ) {
+                                        for (i=0; i<font_desc.width; i++)
+                                             dst16[i] = (pixels[i] << 8) | 0x0FFF;
+                                   } else {
+                                        for (i=0; i<font_desc.width; i++)
+                                             dst16[i] = (pixels[i] >> 4) | 0xFFF0;
+                                   }
+                              }
+                              break;
+                         case DSPF_ARGB2554:
+                              for (i=0; i<font_desc.width; i++)
+                                   dst16[i] = (pixels[i] << 8) | 0x3FFF;
+                              break;
+                         case DSPF_ARGB1555:
+                              for (i=0; i<font_desc.width; i++)
+                                   dst16[i] = (pixels[i] << 8) | 0x7FFF;
+                              break;
+                         case DSPF_A8:
+                              direct_memcpy( lock.addr, pixels, font_desc.width );
+                              break;
+                         case DSPF_A4:
+                              for (i=0, j=0; i<font_desc.width; i+=2, j++)
+                                   dst8[j] = (pixels[i] & 0xF0) | (pixels[i+1] >> 4);
+                              break;
+                         case DSPF_A1:
+                              for (i=0, j=0; i < font_desc.width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<font_desc.width; ++i, ++n)
+                                        p |= (pixels[i] & 0x80) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         case DSPF_LUT2:
+                              for (i=0, j=0; i < font_desc.width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<font_desc.width; ++i, n+=2)
+                                        p |= (pixels[i] & 0xC0) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         default:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+
+                    lock.addr += lock.pitch;
+               }
+
+               dfb_surface_unlock_buffer( surface, &lock );
+          }
+     }
+
+     return IDirectFBFont_Construct (thiz, font);
+}
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_dgiff.c b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_dgiff.c
new file mode 100755
index 0000000..5e1977c
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_dgiff.c
@@ -0,0 +1,364 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fcntl.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <directfb.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <media/idirectfbfont.h>
+
+#include <direct/hash.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/utf8.h>
+
+#include <dgiff.h>
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc );
+
+/**********************************************************************************************************************/
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, DGIFF )
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     void *map;     /* Memory map of the file. */
+     int   size;    /* Size of the memory map. */
+} DGIFFImplData;
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBFont_DGIFF_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_data *data = thiz->priv;
+     CoreFont           *font = data->font;
+     DGIFFImplData      *impl = font->impl_data;
+
+     munmap( impl->map, impl->size );
+
+     D_FREE( impl );
+
+     IDirectFBFont_Destruct( thiz );
+}
+
+
+static DirectResult
+IDirectFBFont_DGIFF_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (--data->ref == 0) {
+          IDirectFBFont_DGIFF_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx )
+{
+     DFBResult   ret = DFB_OK;
+     int         fd;
+     DGIFFHeader header;
+
+     if (!ctx->filename)
+          return DFB_UNSUPPORTED;
+
+     /* Open the file. */
+     fd = open( ctx->filename, O_RDONLY );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Font/DGIFF: Failure during open() of '%s'!\n", ctx->filename );
+          goto out;
+     }
+
+     /* Read the header. */
+     if (read( fd, &header, sizeof(header) ) != sizeof(header)) {
+          ret = errno2result( errno );
+          D_PERROR( "Font/DGIFF: Failure reading %zu bytes from '%s'!\n", sizeof(header), ctx->filename );
+          goto out;
+     }
+
+     /* Check the magic. */
+     if (strncmp( (char*) header.magic, "DGIFF", 5 ))
+          ret = DFB_UNSUPPORTED;
+
+out:
+     if (fd >= 0)
+          close( fd );
+
+     return ret;
+}
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc )
+{
+     DFBResult        ret;
+     int              i;
+     int              fd;
+     struct stat      stat;
+     void            *ptr  = MAP_FAILED;
+     CoreFont        *font = NULL;
+     DGIFFHeader     *header;
+     DGIFFFaceHeader *face;
+     DGIFFGlyphInfo  *glyphs;
+     DGIFFGlyphRow   *row;
+     DGIFFImplData   *data;
+     char            *filename;
+     CoreSurfaceConfig config;
+
+//     if (desc->flags & (DFDESC_WIDTH | DFDESC_ATTRIBUTES | DFDESC_FIXEDADVANCE))
+  //        return DFB_UNSUPPORTED;
+     /* use the filename for backwards compatibility */
+     filename = ctx->filename;
+
+     if (desc->flags & DFDESC_ROTATION)
+          return DFB_UNSUPPORTED;
+
+     /* Open the file. */
+     fd = open( filename, O_RDONLY );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Font/DGIFF: Failure during open() of '%s'!\n", filename );
+          return ret;
+     }
+
+     /* Query file size etc. */
+     if (fstat( fd, &stat ) < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Font/DGIFF: Failure during fstat() of '%s'!\n", filename );
+          goto error;
+     }
+
+     /* Memory map the file. */
+     ptr = mmap( NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0 );
+     if (ptr == MAP_FAILED) {
+          ret = errno2result( errno );
+          D_PERROR( "Font/DGIFF: Failure during mmap() of '%s'!\n", filename );
+          goto error;
+     }
+
+     /* Keep entry pointers for main header and face. */
+     header = ptr;
+     face   = ptr + sizeof(DGIFFHeader);
+
+     /* Lookup requested face, otherwise use first if nothing requested or show error if not found. */
+     if (desc->flags & DFDESC_HEIGHT) {
+          for (i=0; i<header->num_faces; i++) {
+               if (face->size == desc->height)
+                    break;
+
+               face = ((void*) face) + face->next_face;
+          }
+
+          if (i == header->num_faces) {
+               ret = DFB_UNSUPPORTED;
+               D_ERROR( "Font/DGIFF: Requested size %d not found in '%s'!\n", desc->height, filename );
+               goto error;
+          }
+     }
+
+     glyphs = (void*)(face + 1);
+     row    = (void*)(glyphs + face->num_glyphs);
+
+     /* Create the core object. */
+     ret = dfb_font_create( core, desc, filename, &font );
+     if (ret)
+          goto error;
+
+     /* Fill font information. */
+     font->ascender     = face->ascender;
+     font->descender    = face->descender;
+     font->height       = face->height;
+     font->up_unit_x    =  0.0;
+     font->up_unit_y    = -1.0;
+
+     font->maxadvance   = face->max_advance;
+     font->pixel_format = face->pixelformat;
+     font->surface_caps = DSCAPS_NONE;
+
+     font->num_rows     = face->num_rows;
+
+     if (face->blittingflags)
+          font->blittingflags = face->blittingflags;
+
+     /* Allocate array for glyph cache rows. */
+     font->rows = D_CALLOC( face->num_rows, sizeof(void*) );
+     if (!font->rows) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     /* Build glyph cache rows. */
+
+     config.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_PREALLOCATED;
+     config.format = face->pixelformat;
+     config.preallocated[1].addr = NULL;
+     config.preallocated[1].pitch = 0;
+
+     for (i=0; i<face->num_rows; i++) {
+          font->rows[i] = D_CALLOC( 1, sizeof(CoreFontCacheRow) );
+          if (!font->rows[i]) {
+               ret = D_OOM();
+               goto error;
+          }
+
+          config.size.w = row->width;
+          config.size.h = row->height;
+          config.preallocated[0].addr = (void*)(row+1);
+          config.preallocated[0].pitch = row->pitch;
+
+          ret = dfb_surface_create( core, &config, CSTF_PREALLOCATED, 0, NULL,
+                                    &font->rows[i]->surface );
+
+          if (ret) {
+               D_DERROR( ret, "DGIFF/Font: Could not create preallocated %s %dx%d glyph row surface!\n",
+                         dfb_pixelformat_name(face->pixelformat), row->width, row->height );
+               goto error;
+          }
+
+          D_MAGIC_SET( font->rows[i], CoreFontCacheRow );
+
+          /* Jump to next row. */
+          row = (void*)(row + 1) + row->pitch * row->height;
+     }
+
+     /* Build glyph infos. */
+     for (i=0; i<face->num_glyphs; i++) {
+          CoreGlyphData  *data;
+          DGIFFGlyphInfo *glyph = &glyphs[i];
+
+          data = D_CALLOC( 1, sizeof(CoreGlyphData) );
+          if (!data) {
+               ret = D_OOM();
+               goto error;
+          }
+
+          data->surface = font->rows[glyph->row]->surface;
+
+          data->start   = glyph->offset;
+          data->width   = glyph->width;
+          data->height  = glyph->height;
+          data->left    = glyph->left;
+          data->top     = glyph->top;
+          data->xadvance = glyph->advance;
+          data->yadvance = 0;
+
+          D_MAGIC_SET( data, CoreGlyphData );
+
+          direct_hash_insert( font->layers[0].glyph_hash, glyph->unicode, data );
+
+          if (glyph->unicode < 128)
+               font->layers[0].glyph_data[glyph->unicode] = data;
+     }
+
+
+     data = D_CALLOC( 1, sizeof(DGIFFImplData) );
+     if (!data) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     data->map  = ptr;
+     data->size = stat.st_size;
+
+     font->impl_data = data;
+
+     /* Already close, we still have the map. */
+     close( fd );
+
+     ret = IDirectFBFont_Construct( thiz, font );
+     D_ASSERT( ret == DFB_OK );
+
+     thiz->Release = IDirectFBFont_DGIFF_Release;
+
+     return DFB_OK;
+
+
+error:
+     if (font) {
+          if (font->rows) {
+               for (i=0; i<font->num_rows; i++) {
+                    if (font->rows[i]) {
+                         if (font->rows[i]->surface)
+                              dfb_surface_unref( font->rows[i]->surface );
+
+                         D_FREE( font->rows[i] );
+                    }
+               }
+
+               D_FREE( font->rows );
+
+               font->rows = NULL;
+          }
+
+          dfb_font_destroy( font );
+     }
+
+     if (ptr != MAP_FAILED)
+          munmap( ptr, stat.st_size );
+
+     close( fd );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_ft2.c b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_ft2.c
new file mode 100755
index 0000000..b5dc666
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_ft2.c
@@ -0,0 +1,949 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <math.h>
+
+#include <directfb.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <media/idirectfbfont.h>
+
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/utf8.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#undef SIZEOF_LONG
+#include <ft2build.h>
+#include FT_GLYPH_H
+
+#ifndef FT_LOAD_TARGET_MONO
+    /* FT_LOAD_TARGET_MONO was added in FreeType-2.1.3, we have to use (less good)
+       FT_LOAD_MONOCHROME with older versions. Make it an alias for code simplicity. */
+    #define FT_LOAD_TARGET_MONO FT_LOAD_MONOCHROME
+#endif
+
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, FT2 )
+
+static FT_Library      library           = NULL;
+static int             library_ref_count = 0;
+static pthread_mutex_t library_mutex     = PTHREAD_MUTEX_INITIALIZER;
+
+#define KERNING_CACHE_MIN    0
+#define KERNING_CACHE_MAX  127
+#define KERNING_CACHE_SIZE (KERNING_CACHE_MAX - KERNING_CACHE_MIN + 1)
+
+#define KERNING_DO_CACHE(a,b)      ((a) >= KERNING_CACHE_MIN && \
+                                    (a) <= KERNING_CACHE_MAX && \
+                                    (b) >= KERNING_CACHE_MIN && \
+                                    (b) <= KERNING_CACHE_MAX)
+
+#define KERNING_CACHE_ENTRY(a,b)   \
+     (data->kerning[(a)-KERNING_CACHE_MIN][(b)-KERNING_CACHE_MIN])
+
+#define CHAR_INDEX(c)    (((c) < 256) ? data->indices[c] : FT_Get_Char_Index( data->face, c ))
+
+typedef struct {
+     FT_Face      face;
+     int          disable_charmap;
+     int          fixed_advance;
+     bool         fixed_clip;
+     unsigned int indices[256];
+} FT2ImplData;
+
+typedef struct {
+     signed char x;
+     signed char y;
+} KerningCacheEntry;
+
+typedef struct {
+     FT2ImplData base;
+
+     KerningCacheEntry kerning[KERNING_CACHE_SIZE][KERNING_CACHE_SIZE];
+} FT2ImplKerningData;
+
+/**********************************************************************************************************************/
+
+static DFBResult
+ft2UTF8GetCharacterIndex( CoreFont     *thiz,
+                          unsigned int  character,
+                          unsigned int *ret_index )
+{
+     FT2ImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+
+     if (data->disable_charmap)
+          *ret_index = character;
+     else {
+          pthread_mutex_lock ( &library_mutex );
+
+          *ret_index = CHAR_INDEX( character );
+
+          pthread_mutex_unlock ( &library_mutex );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+ft2UTF8DecodeText( CoreFont       *thiz,
+                   const void     *text,
+                   int             length,
+                   unsigned int   *ret_indices,
+                   int            *ret_num )
+{
+     int pos = 0, num = 0;
+     const u8 *bytes   = text;
+     FT2ImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     pthread_mutex_lock ( &library_mutex );
+
+     while (pos < length) {
+          unsigned int c;
+
+          if (bytes[pos] < 128)
+               c = bytes[pos++];
+          else {
+               c = DIRECT_UTF8_GET_CHAR( &bytes[pos] );
+               pos += DIRECT_UTF8_SKIP(bytes[pos]);
+          }
+
+          if (data->disable_charmap)
+               ret_indices[num++] = c;
+          else
+               ret_indices[num++] = CHAR_INDEX( c );
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     *ret_num = num;
+
+     return DFB_OK;
+}
+
+static const CoreFontEncodingFuncs ft2UTF8Funcs = {
+     .GetCharacterIndex = ft2UTF8GetCharacterIndex,
+     .DecodeText        = ft2UTF8DecodeText,
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult
+ft2Latin1GetCharacterIndex( CoreFont     *thiz,
+                            unsigned int  character,
+                            unsigned int *ret_index )
+{
+     FT2ImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+
+     if (data->disable_charmap)
+          *ret_index = character;
+     else
+          *ret_index = data->indices[character];
+
+     return DFB_OK;
+}
+
+static DFBResult
+ft2Latin1DecodeText( CoreFont       *thiz,
+                     const void     *text,
+                     int             length,
+                     unsigned int   *ret_indices,
+                     int            *ret_num )
+{
+     int i;
+     const u8 *bytes   = text;
+     FT2ImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     if (data->disable_charmap) {
+          for (i=0; i<length; i++)
+               ret_indices[i] = bytes[i];
+     }
+     else {
+          for (i=0; i<length; i++)
+               ret_indices[i] = data->indices[bytes[i]];
+     }
+
+     *ret_num = length;
+
+     return DFB_OK;
+}
+
+static const CoreFontEncodingFuncs ft2Latin1Funcs = {
+     .GetCharacterIndex = ft2Latin1GetCharacterIndex,
+     .DecodeText        = ft2Latin1DecodeText,
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult
+render_glyph( CoreFont      *thiz,
+              unsigned int   index,
+              CoreGlyphData *info )
+{
+     FT_Error     err;
+     FT_Face      face;
+     FT_Int       load_flags;
+     u8          *src;
+     int          y;
+     FT2ImplData *data    = thiz->impl_data;
+     CoreSurface *surface = info->surface;
+     CoreSurfaceBufferLock  lock;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     face = data->face;
+
+     load_flags = (unsigned long) face->generic.data;
+     load_flags |= FT_LOAD_RENDER;
+
+     if ((err = FT_Load_Glyph( face, index, load_flags ))) {
+          D_DEBUG( "DirectFB/FontFT2: Could not render glyph for character index #%d!\n", index );
+          pthread_mutex_unlock ( &library_mutex );
+          return DFB_FAILURE;
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     err = dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+     if (err) {
+          D_DERROR( err, "DirectFB/FontFT2: Unable to lock surface!\n" );
+          return err;
+     }
+
+     info->width = face->glyph->bitmap.width;
+     if (info->width + info->start > surface->config.size.w)
+          info->width = surface->config.size.w - info->start;
+
+     info->height = face->glyph->bitmap.rows;
+     if (info->height > surface->config.size.h)
+          info->height = surface->config.size.h;
+
+     /* bitmap_left and bitmap_top are relative to the glyph's origin on the
+        baseline.  info->left and info->top are relative to the top-left of the
+        character cell. */
+     info->left =   face->glyph->bitmap_left - thiz->ascender*thiz->up_unit_x;
+     info->top  = - face->glyph->bitmap_top  - thiz->ascender*thiz->up_unit_y;
+
+     if (data->fixed_clip) {
+          while (info->left + info->width > data->fixed_advance)
+               info->left--;
+
+          if (info->left < 0)
+               info->left = 0;
+
+          if (info->width > data->fixed_advance)
+               info->width = data->fixed_advance;
+     }
+
+     src = face->glyph->bitmap.buffer;
+     lock.addr += DFB_BYTES_PER_LINE(surface->config.format, info->start);
+
+     for (y=0; y < info->height; y++) {
+          int  i, j, n;
+          u8  *dst8  = lock.addr;
+          u16 *dst16 = lock.addr;
+          u32 *dst32 = lock.addr;
+
+          switch (face->glyph->bitmap.pixel_mode) {
+               case ft_pixel_mode_grays:
+                    switch (surface->config.format) {
+                         case DSPF_ARGB:
+                              if (thiz->surface_caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<info->width; i++)
+                                        dst32[i] = src[i] * 0x01010101;
+                              }
+                              else
+                                   for (i=0; i<info->width; i++)
+                                        dst32[i] = (src[i] << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_AiRGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = ((src[i] ^ 0xFF) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_ARGB4444:
+                         case DSPF_RGBA4444:
+                              if (thiz->surface_caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<info->width; i++)
+                                        dst16[i] = (src[i] >> 4) * 0x1111;
+                              }
+                              else {
+                                   if( surface->config.format == DSPF_ARGB4444 ) {
+                                        for (i=0; i<info->width; i++)
+                                             dst16[i] = (src[i] << 8) | 0x0FFF;
+                                   } else {
+                                        for (i=0; i<info->width; i++)
+                                             dst16[i] = (src[i] >> 4) | 0xFFF0;
+                                   }
+                              }
+                              break;
+                         case DSPF_ARGB2554:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (src[i] << 8) | 0x3FFF;
+                              break;
+                         case DSPF_ARGB1555:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (src[i] << 8) | 0x7FFF;
+                              break;
+                         case DSPF_A8:
+                              direct_memcpy( lock.addr, src, info->width );
+                              break;
+                         case DSPF_A4:
+                              for (i=0, j=0; i<info->width; i+=2, j++)
+                                   dst8[j] = (src[i] & 0xF0) | (src[i+1] >> 4);
+                              break;
+                         case DSPF_A1:
+                              for (i=0, j=0; i < info->width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<info->width; ++i, ++n)
+                                        p |= (src[i] & 0x80) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         case DSPF_LUT2:
+                              for (i=0, j=0; i < info->width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<info->width; ++i, n+=2)
+                                        p |= (src[i] & 0xC0) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         default:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+                    break;
+
+               case ft_pixel_mode_mono:
+                    switch (surface->config.format) {
+                         case DSPF_ARGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0xFF : 0x00) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_AiRGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x00 : 0xFF) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_ARGB4444:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0xF : 0x0) << 12) | 0xFFF;
+                              break;
+                         case DSPF_RGBA4444:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0xF : 0x0)      ) | 0xFFF0;
+                              break;
+                         case DSPF_ARGB2554:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x3 : 0x0) << 14) | 0x3FFF;
+                              break;
+                         case DSPF_ARGB1555:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x1 : 0x0) << 15) | 0x7FFF;
+                              break;
+                         case DSPF_A8:
+                              for (i=0; i<info->width; i++)
+                                   dst8[i] = (src[i>>3] &
+                                              (1<<(7-(i%8)))) ? 0xFF : 0x00;
+                              break;
+                         case DSPF_A4:
+                              for (i=0, j=0; i<info->width; i+=2, j++)
+                                   dst8[j] = ((src[i>>3] &
+                                              (1<<(7-(i%8)))) ? 0xF0 : 0x00) |
+                                             ((src[(i+1)>>3] &
+                                              (1<<(7-((i+1)%8)))) ? 0x0F : 0x00);
+                              break;
+                         case DSPF_A1:
+                              direct_memcpy( lock.addr, src, DFB_BYTES_PER_LINE(DSPF_A1, info->width) );
+                              break;
+                         default:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+                    break;
+
+               default:
+                    break;
+
+          }
+
+          src += face->glyph->bitmap.pitch;
+
+          lock.addr += lock.pitch;
+     }
+
+     dfb_surface_unlock_buffer( surface, &lock );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+get_glyph_info( CoreFont      *thiz,
+                unsigned int   index,
+                CoreGlyphData *info )
+{
+     FT_Error err;
+     FT_Face  face;
+     FT_Int   load_flags;
+     FT2ImplData *data = (FT2ImplData*) thiz->impl_data;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     face = data->face;
+
+     load_flags = (unsigned long) face->generic.data;
+
+     if ((err = FT_Load_Glyph( face, index, load_flags ))) {
+          D_DEBUG( "DirectFB/FontFT2: Could not load glyph for character index #%d!\n", index );
+
+          pthread_mutex_unlock ( &library_mutex );
+
+          return DFB_FAILURE;
+     }
+
+     if (face->glyph->format != ft_glyph_format_bitmap) {
+          err = FT_Render_Glyph( face->glyph,
+                                 (load_flags & FT_LOAD_TARGET_MONO) ? ft_render_mode_mono : ft_render_mode_normal );
+          if (err) {
+               D_ERROR( "DirectFB/FontFT2: Could not render glyph for character index #%d!\n", index );
+
+               pthread_mutex_unlock ( &library_mutex );
+
+               return DFB_FAILURE;
+          }
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     info->width   = face->glyph->bitmap.width;
+     info->height  = face->glyph->bitmap.rows;
+
+     if (data->fixed_advance) {
+          info->xadvance = - data->fixed_advance * thiz->up_unit_y;
+          info->yadvance =   data->fixed_advance * thiz->up_unit_x;
+     }
+     else {
+          info->xadvance =   face->glyph->advance.x >> 6;
+          info->yadvance = - face->glyph->advance.y >> 6;
+     }
+
+     if (data->fixed_clip && info->width > data->fixed_advance)
+          info->width = data->fixed_advance;
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+get_kerning( CoreFont     *thiz,
+             unsigned int  prev,
+             unsigned int  current,
+             int          *kern_x,
+             int          *kern_y)
+{
+     FT_Vector vector;
+
+     FT2ImplKerningData *data = thiz->impl_data;
+     KerningCacheEntry *cache = NULL;
+
+     D_ASSUME( (kern_x != NULL) || (kern_y != NULL) );
+
+     /*
+      * Use cached values if characters are in the
+      * cachable range and the cache entry is already filled.
+      */
+     if (KERNING_DO_CACHE (prev, current)) {
+          cache = &KERNING_CACHE_ENTRY (prev, current);
+
+          if (kern_x)
+               *kern_x = (int) cache->x;
+
+          if (kern_y)
+               *kern_y = (int) cache->y;
+
+          return DFB_OK;
+     }
+
+     pthread_mutex_lock ( &library_mutex );
+
+     /* Lookup kerning values for the character pair. */
+     /* The vector returned by FreeType does not allow for any rotation. */
+     FT_Get_Kerning( data->base.face,
+                     prev, current, ft_kerning_default, &vector );
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     /* Convert to integer. */
+     if (kern_x)
+          *kern_x = (int)(- vector.x*thiz->up_unit_y + vector.y*thiz->up_unit_x) >> 6;
+
+     if (kern_y)
+          *kern_y = (int)(  vector.y*thiz->up_unit_y + vector.x*thiz->up_unit_x) >> 6;
+
+     return DFB_OK;
+}
+
+static void
+init_kerning_cache( FT2ImplKerningData *data, float up_unit_x, float up_unit_y )
+{
+     int a, b;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     for (a=KERNING_CACHE_MIN; a<=KERNING_CACHE_MAX; a++) {
+          for (b=KERNING_CACHE_MIN; b<=KERNING_CACHE_MAX; b++) {
+               FT_Vector          vector;
+               KerningCacheEntry *cache = &KERNING_CACHE_ENTRY( a, b );
+
+               /* Lookup kerning values for the character pair. */
+               FT_Get_Kerning( data->base.face,
+                               a, b, ft_kerning_default, &vector );
+
+               cache->x = (signed char) ((int)(- vector.x*up_unit_y + vector.y*up_unit_x) >> 6);
+               cache->y = (signed char) ((int)(  vector.y*up_unit_y + vector.x*up_unit_x) >> 6);
+          }
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+}
+
+static DFBResult
+init_freetype( void )
+{
+     FT_Error err;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     if (!library) {
+          D_DEBUG( "DirectFB/FontFT2: Initializing the FreeType2 library.\n" );
+          err = FT_Init_FreeType( &library );
+          if (err) {
+               D_ERROR( "DirectFB/FontFT2: "
+                         "Initialization of the FreeType2 library failed!\n" );
+               library = NULL;
+               pthread_mutex_unlock( &library_mutex );
+               return DFB_FAILURE;
+          }
+     }
+
+     library_ref_count++;
+     pthread_mutex_unlock( &library_mutex );
+
+     return DFB_OK;
+}
+
+
+static void
+release_freetype( void )
+{
+     pthread_mutex_lock( &library_mutex );
+
+     if (library && --library_ref_count == 0) {
+          D_DEBUG( "DirectFB/FontFT2: Releasing the FreeType2 library.\n" );
+          FT_Done_FreeType( library );
+          library = NULL;
+     }
+
+     pthread_mutex_unlock( &library_mutex );
+}
+
+
+static void
+IDirectFBFont_FT2_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_data *data = (IDirectFBFont_data*)thiz->priv;
+
+     if (data->font->impl_data) {
+          FT2ImplData *impl_data = (FT2ImplData*) data->font->impl_data;
+
+          pthread_mutex_lock ( &library_mutex );
+          FT_Done_Face( impl_data->face );
+          pthread_mutex_unlock ( &library_mutex );
+
+          D_FREE( impl_data );
+
+          data->font->impl_data = NULL;
+     }
+
+     IDirectFBFont_Destruct( thiz );
+
+     release_freetype();
+}
+
+
+static DirectResult
+IDirectFBFont_FT2_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (--data->ref == 0) {
+          IDirectFBFont_FT2_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx )
+{
+     FT_Error err;
+     FT_Face  face;
+
+     D_DEBUG( "DirectFB/FontFT2: Probe font `%s'.\n", ctx->filename );
+
+     if (!ctx->content)
+          return DFB_UNSUPPORTED;
+
+     if (init_freetype() != DFB_OK) {
+          return DFB_FAILURE;
+     }
+
+     pthread_mutex_lock ( &library_mutex );
+
+     /*
+      * This should be
+      * err = FT_New...Face( library, ctx->filename, -1, NULL );
+      * but due to freetype bugs it doesn't work.
+      */
+     err = FT_New_Memory_Face( library, ctx->content, ctx->content_size, 0, &face );
+     if (!err)
+          FT_Done_Face( face );
+     pthread_mutex_unlock ( &library_mutex );
+
+     release_freetype();
+
+     return err ? DFB_UNSUPPORTED : DFB_OK;
+}
+
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc )
+{
+     int                 i;
+     DFBResult           ret;
+     CoreFont           *font;
+     FT_Face             face;
+     FT_Error            err;
+     FT_Int              load_flags = FT_LOAD_DEFAULT;
+     FT2ImplData        *data;
+     bool                disable_charmap = false;
+     bool                disable_kerning = false;
+     bool                load_mono = false;
+     u32                 mask = 0;
+     unsigned int        size = 0, size_read = 0;
+     char               *filename = ctx->filename; /* intended for printf only */
+
+     float sin_rot = 0.0;
+     float cos_rot = 1.0;
+
+     D_DEBUG( "DirectFB/FontFT2: "
+              "Construct font from file `%s' (index %d) at pixel size %d x %d and rotation %d.\n",
+              filename,
+              (desc->flags & DFDESC_INDEX)    ? desc->index    : 0,
+              (desc->flags & DFDESC_WIDTH)    ? desc->width    : 0,
+              (desc->flags & DFDESC_HEIGHT)   ? desc->height   : 0,
+              (desc->flags & DFDESC_ROTATION) ? desc->rotation : 0 );
+
+     if (init_freetype() != DFB_OK) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     pthread_mutex_lock ( &library_mutex );
+     err = FT_New_Memory_Face( library, ctx->content, ctx->content_size,
+                               (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                               &face );
+     pthread_mutex_unlock ( &library_mutex );
+     if (err) {
+          switch (err) {
+               case FT_Err_Unknown_File_Format:
+                    D_ERROR( "DirectFB/FontFT2: "
+                              "Unsupported font format in file `%s'!\n", filename );
+                    break;
+               default:
+                    D_ERROR( "DirectFB/FontFT2: "
+                              "Failed loading face %d from font file `%s'!\n",
+                              (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                              filename );
+                    break;
+          }
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+ 
+     if ((desc->flags & DFDESC_ROTATION) && desc->rotation) {
+          if (!FT_IS_SCALABLE(face)) {
+               D_ERROR( "DirectFB/FontFT2: "
+                         "Face %d from font file `%s' is not scalable so cannot be rotated\n",
+                         (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                         filename );
+               pthread_mutex_lock ( &library_mutex );
+               FT_Done_Face( face );
+               pthread_mutex_unlock ( &library_mutex );
+               DIRECT_DEALLOCATE_INTERFACE( thiz );
+               return DFB_UNSUPPORTED;
+          }
+
+          float rot_radians = 2.0 * M_PI * desc->rotation / (1<<24);
+          sin_rot = sin(rot_radians);
+          cos_rot = cos(rot_radians);
+
+          int sin_rot_fx = (int)(sin_rot*65536.0);
+          int cos_rot_fx = (int)(cos_rot*65536.0);
+          FT_Matrix matrix;
+          matrix.xx =  cos_rot_fx;
+          matrix.xy = -sin_rot_fx;
+          matrix.yx =  sin_rot_fx;
+          matrix.yy =  cos_rot_fx;
+
+          pthread_mutex_lock ( &library_mutex );
+          FT_Set_Transform( face, &matrix, NULL );
+          /* FreeType docs suggest FT_Set_Transform returns an error code, but it seems
+             that this is not the case. */
+          pthread_mutex_unlock ( &library_mutex );
+     }
+
+     if (dfb_config->font_format == DSPF_A1 || dfb_config->font_format == DSPF_ARGB1555)
+          load_mono = true;
+
+     if (desc->flags & DFDESC_ATTRIBUTES) {
+          if (desc->attributes & DFFA_NOHINTING)
+               load_flags |= FT_LOAD_NO_HINTING;
+          if (desc->attributes & DFFA_NOBITMAP)
+               load_flags |= FT_LOAD_NO_BITMAP;
+          if (desc->attributes & DFFA_NOCHARMAP)
+               disable_charmap = true;
+          if (desc->attributes & DFFA_NOKERNING)
+               disable_kerning = true;
+          if (desc->attributes & DFFA_MONOCHROME)
+               load_mono = true;
+     }
+
+     if (load_mono)
+          load_flags |= FT_LOAD_TARGET_MONO;
+
+     if (!disable_charmap) {
+          pthread_mutex_lock ( &library_mutex );
+          err = FT_Select_Charmap( face, ft_encoding_unicode );
+          pthread_mutex_unlock ( &library_mutex );
+
+#if FREETYPE_MINOR > 0
+
+          /* ft_encoding_latin_1 has been introduced in freetype-2.1 */
+          if (err) {
+               D_DEBUG( "DirectFB/FontFT2: "
+                        "Couldn't select Unicode encoding, "
+                        "falling back to Latin1.\n");
+               pthread_mutex_lock ( &library_mutex );
+               err = FT_Select_Charmap( face, ft_encoding_latin_1 );
+               pthread_mutex_unlock ( &library_mutex );
+          }
+#endif
+          if (err) {
+               D_DEBUG( "DirectFB/FontFT2: "
+                        "Couldn't select Unicode/Latin1 encoding, "
+                        "trying Symbol.\n");
+               pthread_mutex_lock ( &library_mutex );
+               err = FT_Select_Charmap( face, ft_encoding_symbol );
+               pthread_mutex_unlock ( &library_mutex );
+
+               if (!err)
+                    mask = 0xf000;
+          }
+     }
+
+#if 0
+     if (err) {
+          D_ERROR( "DirectFB/FontFT2: "
+                    "Couldn't select a suitable encoding for face %d from font file `%s'!\n", (desc->flags & DFDESC_INDEX) ? desc->index : 0, filename );
+          pthread_mutex_lock ( &library_mutex );
+          FT_Done_Face( face );
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+#endif
+
+     if (desc->flags & (DFDESC_HEIGHT       | DFDESC_WIDTH |
+                        DFDESC_FRACT_HEIGHT | DFDESC_FRACT_WIDTH))
+     {
+          int fw = 0, fh = 0;
+
+          if (desc->flags & DFDESC_FRACT_HEIGHT)
+               fh = desc->fract_height;
+          else if (desc->flags & DFDESC_HEIGHT)
+               fh = desc->height << 6;
+
+          if (desc->flags & DFDESC_FRACT_WIDTH)
+               fw = desc->fract_width;
+          else if (desc->flags & DFDESC_WIDTH)
+               fw = desc->width << 6;
+
+          pthread_mutex_lock ( &library_mutex );
+          err = FT_Set_Char_Size( face, fw, fh, 0, 0 );
+          pthread_mutex_unlock ( &library_mutex );
+          if (err) {
+               D_ERROR( "DirectB/FontFT2: "
+                         "Could not set pixel size to %d x %d!\n",
+                         (desc->flags & DFDESC_WIDTH)  ? desc->width  : 0,
+                         (desc->flags & DFDESC_HEIGHT) ? desc->height : 0 );
+               pthread_mutex_lock ( &library_mutex );
+               FT_Done_Face( face );
+               pthread_mutex_unlock ( &library_mutex );
+               DIRECT_DEALLOCATE_INTERFACE( thiz );
+               return DFB_FAILURE;
+          }
+     }
+
+     face->generic.data = (void *)(unsigned long) load_flags;
+     face->generic.finalizer = NULL;
+
+     ret = dfb_font_create( core, desc, filename, &font );
+     if (ret) {
+          pthread_mutex_lock ( &library_mutex );
+          FT_Done_Face( face );
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     D_ASSERT( font->pixel_format == DSPF_ARGB ||
+               font->pixel_format == DSPF_AiRGB ||
+               font->pixel_format == DSPF_ARGB4444 ||
+               font->pixel_format == DSPF_RGBA4444 ||
+               font->pixel_format == DSPF_ARGB2554 ||
+               font->pixel_format == DSPF_ARGB1555 ||
+               font->pixel_format == DSPF_A8 ||
+               font->pixel_format == DSPF_A4 ||
+               font->pixel_format == DSPF_A1 );
+
+     font->ascender   = face->size->metrics.ascender >> 6;
+     font->descender  = face->size->metrics.descender >> 6;
+     font->height     = font->ascender + ABS(font->descender) + 1;
+     font->maxadvance = face->size->metrics.max_advance >> 6;
+ 
+     font->up_unit_x  = -sin_rot;
+     font->up_unit_y  = -cos_rot;
+
+     D_DEBUG( "DirectFB/FontFT2: height = %d, ascender = %d, descender = %d, maxadvance = %d, up unit: %5.2f,%5.2f\n",
+              font->height, font->ascender, font->descender, font->maxadvance, font->up_unit_x, font->up_unit_y );
+
+     font->GetGlyphData = get_glyph_info;
+     font->RenderGlyph  = render_glyph;
+
+     if (FT_HAS_KERNING(face) && !disable_kerning) {
+          font->GetKerning = get_kerning;
+          data = D_CALLOC( 1, sizeof(FT2ImplKerningData) );
+     }
+     else
+          data = D_CALLOC( 1, sizeof(FT2ImplData) );
+
+     data->face            = face;
+     data->disable_charmap = disable_charmap;
+
+     if (FT_HAS_KERNING(face) && !disable_kerning)
+          init_kerning_cache( (FT2ImplKerningData*) data, font->up_unit_x, font->up_unit_y);
+
+     if (desc->flags & DFDESC_FIXEDADVANCE) {
+          data->fixed_advance = desc->fixed_advance;
+          font->maxadvance    = desc->fixed_advance;
+
+          if ((desc->flags & DFDESC_ATTRIBUTES) && (desc->attributes & DFFA_FIXEDCLIP))
+               data->fixed_clip = true;
+     }
+
+     for (i=0; i<256; i++)
+          data->indices[i] = FT_Get_Char_Index( face, i | mask );
+
+     font->impl_data = data;
+
+     dfb_font_register_encoding( font, "UTF8",   &ft2UTF8Funcs,   DTEID_UTF8 );
+     dfb_font_register_encoding( font, "Latin1", &ft2Latin1Funcs, DTEID_OTHER );
+
+     IDirectFBFont_Construct( thiz, font );
+
+     thiz->Release = IDirectFBFont_FT2_Release;
+
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_lino.c b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_lino.c
new file mode 100755
index 0000000..4d03e7f
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBFont/idirectfbfont_lino.c
@@ -0,0 +1,1324 @@
+/*
+   (c) Copyright 2001-2008  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <math.h>
+
+#include <directfb.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/convert.h>
+
+#include <media/idirectfbfont.h>
+
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/utf8.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#undef SIZEOF_LONG
+/*
+#include <ft2build.h>
+#include FT_GLYPH_H
+*/
+/*#ifndef FT_LOAD_TARGET_MONO DZ*/
+/* FT_LOAD_TARGET_MONO was added in FreeType-2.1.3, we have to use (less good)
+   FT_LOAD_MONOCHROME with older versions. Make it an alias for code simplicity. */
+/*    #define FT_LOAD_TARGET_MONO FT_LOAD_MONOCHROME
+#endif
+*/
+#include <fs_itype.h>
+#include <adfinittermsystem.h>
+
+#ifdef NOT_BIG_ENOUGH_FOR_GULIM_AC3
+#define THE_HEAP_SIZE       327680
+#else
+// Increase the heap size to 1.5MB to avoid the missing character problem (running out of heap)
+#define THE_HEAP_SIZE       (1*1024*1024 + 512*1024)
+#endif
+static FS_BOOLEAN state_init = false;
+static FS_STATE state_global;
+static  bool  load_mono = false;
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, Lino )
+
+
+D_DEBUG_DOMAIN( Font_Itype, "Font/Itype", "Itype" );
+
+/*
+static FT_Library      library           = NULL;
+*/
+static int             library_ref_count = 0;
+static pthread_mutex_t library_mutex     = PTHREAD_MUTEX_INITIALIZER;
+
+#define KERNING_CACHE_MIN    0
+#define KERNING_CACHE_MAX  127
+#define KERNING_CACHE_SIZE (KERNING_CACHE_MAX - KERNING_CACHE_MIN + 1)
+
+#define KERNING_DO_CACHE(a,b)      ((a) >= KERNING_CACHE_MIN && \
+                                    (a) <= KERNING_CACHE_MAX && \
+                                    (b) >= KERNING_CACHE_MIN && \
+                                    (b) <= KERNING_CACHE_MAX)
+
+#define KERNING_CACHE_ENTRY(a,b)   \
+     (data->kerning[(a)-KERNING_CACHE_MIN][(b)-KERNING_CACHE_MIN])
+/*
+#define CHAR_INDEX(c)    (((c) < 256) ? data->indices[c] : FT_Get_Char_Index( data->face, c ))
+*/
+#define CHAR_INDEX(c)    (((c) < 256) ? data->indices[c] : FS_map_char( data->state, c ))
+
+typedef struct {
+     /*FT_Face      face;*/
+     FS_STATE   *state;
+     int          disable_charmap;
+     int          fixed_advance;
+     bool         fixed_clip;
+     unsigned int indices[256];
+} ITImplData;
+
+typedef struct {
+     signed char x;
+     signed char y;
+} KerningCacheEntry;
+
+typedef struct {
+     ITImplData base;
+
+     KerningCacheEntry kerning[KERNING_CACHE_SIZE][KERNING_CACHE_SIZE];
+} ITImplKerningData;
+
+/**********************************************************************************************************************/
+
+static DFBResult
+UTF8GetCharacterIndex( CoreFont     *thiz,
+                       unsigned int  character,
+                       unsigned int *ret_index )
+{
+     ITImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+
+     if (data->disable_charmap)
+          *ret_index = character;
+     else {
+          pthread_mutex_lock ( &library_mutex );
+
+          *ret_index = CHAR_INDEX( character );
+
+          pthread_mutex_unlock ( &library_mutex );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+UTF8DecodeText( CoreFont       *thiz,
+                const void     *text,
+                int             length,
+                unsigned int   *ret_indices,
+                int            *ret_num )
+{
+     int pos = 0, num = 0;
+     const u8 *bytes   = text;
+     ITImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     pthread_mutex_lock ( &library_mutex );
+
+     while (pos < length) {
+          unsigned int c;
+
+          if (bytes[pos] < 128)
+               c = bytes[pos++];
+          else {
+               c = DIRECT_UTF8_GET_CHAR( &bytes[pos] );
+               pos += DIRECT_UTF8_SKIP(bytes[pos]);
+          }
+
+          if (data->disable_charmap)
+               ret_indices[num++] = c;
+          else
+               ret_indices[num++] = CHAR_INDEX( c );
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     *ret_num = num;
+
+     return DFB_OK;
+}
+
+static const CoreFontEncodingFuncs UTF8Funcs = {
+     .GetCharacterIndex = UTF8GetCharacterIndex,
+     .DecodeText        = UTF8DecodeText,
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult
+UTF16GetCharacterIndex( CoreFont     *thiz,
+                        unsigned int  character,
+                        unsigned int *ret_index )
+{
+     ITImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+
+     if (data->disable_charmap)
+          *ret_index = character;
+     else {
+          pthread_mutex_lock ( &library_mutex );
+
+          *ret_index = CHAR_INDEX( character );
+
+          pthread_mutex_unlock ( &library_mutex );
+     }
+
+     return DFB_OK;
+}
+
+#define SURROGATE_VALUE(h,l) (((h) - 0xd800) * 0x400 + (l) - 0xdc00 + 0x10000)
+
+static DFBResult
+UTF16DecodeText( CoreFont       *thiz,
+                 const void     *text,
+                 int             length,
+                 unsigned int   *ret_indices,
+                 int            *ret_num )
+{
+     int pos = 0, num = 0;
+     unsigned int high_surrogate = 0;
+     const u16  *shorts = text;
+     ITImplData *data   = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     pthread_mutex_lock ( &library_mutex );
+
+     while (pos < length/2) {
+          unsigned int c = shorts[pos++];
+
+          if (c >= 0xdc00 && c < 0xe000) { /* low surrogate */
+               c = SURROGATE_VALUE (high_surrogate, c);
+               high_surrogate = 0;
+          }
+          else if (c >= 0xd800 && c < 0xdc00) { /* high surrogate */
+               high_surrogate = c;
+               continue;
+          }
+
+          if (data->disable_charmap)
+               ret_indices[num++] = c;
+          else
+               ret_indices[num++] = CHAR_INDEX( c );
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+
+     *ret_num = num;
+
+     return DFB_OK;
+}
+
+static const CoreFontEncodingFuncs UTF16Funcs = {
+     .GetCharacterIndex = UTF16GetCharacterIndex,
+     .DecodeText        = UTF16DecodeText,
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Latin1GetCharacterIndex( CoreFont     *thiz,
+                         unsigned int  character,
+                         unsigned int *ret_index )
+{
+     ITImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+
+     if (data->disable_charmap)
+          *ret_index = character;
+     else
+          *ret_index = data->indices[character];
+
+     return DFB_OK;
+}
+
+static DFBResult
+Latin1DecodeText( CoreFont       *thiz,
+                  const void     *text,
+                  int             length,
+                  unsigned int   *ret_indices,
+                  int            *ret_num )
+{
+     int i;
+     const u8 *bytes   = text;
+     ITImplData *data = thiz->impl_data;
+
+     D_MAGIC_ASSERT( thiz, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     if (data->disable_charmap) {
+          for (i=0; i<length; i++)
+               ret_indices[i] = bytes[i];
+     }
+     else {
+          for (i=0; i<length; i++)
+               ret_indices[i] = data->indices[bytes[i]];
+     }
+
+     *ret_num = length;
+
+     return DFB_OK;
+}
+
+static const CoreFontEncodingFuncs Latin1Funcs = {
+     .GetCharacterIndex = Latin1GetCharacterIndex,
+     .DecodeText        = Latin1DecodeText,
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult
+render_glyph( CoreFont      *thiz,
+              unsigned int   index,
+              CoreGlyphData *info )
+{
+     /* FT_Error     err;
+      FT_Face      face;
+      FT_Int       load_flags;*/
+     u8          *src;
+     int          y;
+     FS_LONG err;
+     FS_LONG load_flags;
+     ITImplData *data = (ITImplData*) thiz->impl_data;
+     FS_GLYPHMAP   *glyph_map;
+
+     CoreSurface *surface = info->surface;
+     CoreSurfaceBufferLock  lock;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     /*  face = data->face;
+
+       load_flags = (unsigned long) face->generic.data;
+       load_flags |= FT_LOAD_RENDER;
+
+       if ((err = FT_Load_Glyph( face, index, load_flags ))) {
+            D_DEBUG( "DirectFB/FontFT2: Could not render glyph for character index #%d!\n", index );
+            pthread_mutex_unlock ( &library_mutex );
+            return DFB_FAILURE;
+       }
+  */
+
+     switch (info->layer) {
+          case 0:
+               err = FS_set_flags( data->state, FLAGS_NO_EFFECT );
+               if (err) {
+                    D_ERROR( "DirectFB/FontItype: Failed setting FLAGS_NO_EFFECT!\n" );
+
+                    pthread_mutex_unlock ( &library_mutex );
+                    return DFB_FAILURE;
+               }
+               break;
+
+          case 1:
+               err = FS_set_flags( data->state, FLAGS_OUTLINED_SOFT );
+               if (err) {
+                    D_ERROR( "DirectFB/FontItype: Failed setting FLAGS_OUTLINED_SOFT!\n" );
+
+                    pthread_mutex_unlock ( &library_mutex );
+                    return DFB_FAILURE;
+               }
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     if (load_mono)
+          glyph_map = FS_get_glyphmap( data->state, index, FS_MAP_BITMAP );
+     else
+          glyph_map = FS_get_glyphmap( data->state, index, FS_MAP_EDGE_GRAYMAP8 | FS_MAP_GRAYMAP8);
+     if (!glyph_map) {
+          /* glyph_map->err = FS_error(&state);*/
+          D_DEBUG( "DirectFB/FontItype: Could not load glyph for character index #%d!\n", index );
+
+          pthread_mutex_unlock ( &library_mutex );
+
+          return DFB_FAILURE;
+     }
+     pthread_mutex_unlock ( &library_mutex );
+
+     err = dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+     if (err) {
+          D_DERROR( err, "DirectFB/FontItype: Unable to lock surface!\n" );
+          return err;
+     }
+
+     info->width = glyph_map->width;
+     if (info->width + info->start > surface->config.size.w)
+          info->width = surface->config.size.w - info->start;
+
+     info->height = glyph_map->height;
+     if (info->height > surface->config.size.h)
+          info->height = surface->config.size.h;
+
+     /* bitmap_left and bitmap_top are relative to the glyph's origin on the
+        baseline.  info->left and info->top are relative to the top-left of the
+        character cell. */
+     info->left = glyph_map->lo_x - thiz->ascender*thiz->up_unit_x;
+     info->top  = - glyph_map->hi_y - thiz->ascender*thiz->up_unit_y;
+
+     if (data->fixed_clip) {
+          while (info->left + info->width > data->fixed_advance)
+               info->left--;
+
+          if (info->left < 0)
+               info->left = 0;
+
+          if (info->width > data->fixed_advance)
+               info->width = data->fixed_advance;
+     }
+
+     /*src = face->glyph->bitmap.buffer;*/
+     src = glyph_map->bits;
+     lock.addr += DFB_BYTES_PER_LINE(surface->config.format, info->start);
+
+     for (y=0; y < info->height; y++) {
+          int  i, j, n;
+          u8  *dst8  = lock.addr;
+          u16 *dst16 = lock.addr;
+          u32 *dst32 = lock.addr;
+
+          /*switch (face->glyph->bitmap.pixel_mode) {*/
+          switch (load_mono) {
+               /* case ft_pixel_mode_grays:*/
+               case false:
+                    switch (surface->config.format) {
+                         case DSPF_ARGB:
+                              if (thiz->surface_caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<info->width; i++)
+                                        dst32[i] = src[i] * 0x01010101;
+                              }
+                              else
+                                   for (i=0; i<info->width; i++)
+                                        dst32[i] = (src[i] << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_AiRGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = ((src[i] ^ 0xFF) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_ARGB4444:
+                              if (thiz->surface_caps & DSCAPS_PREMULTIPLIED) {
+                                   for (i=0; i<info->width; i++)
+                                        dst16[i] = (src[i] >> 4) * 0x1111;
+                              }
+                              else {
+                                   for (i=0; i<info->width; i++)
+                                        dst16[i] = (src[i] << 8) | 0xFFF;
+                              }
+                              break;
+                         case DSPF_ARGB2554:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (src[i] << 8) | 0x3FFF;
+                              break;
+                         case DSPF_ARGB1555:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (src[i] << 8) | 0x7FFF;
+                              break;
+                         case DSPF_A8:
+                              direct_memcpy( lock.addr, src, info->width );
+                              break;
+                         case DSPF_A4:
+                              for (i=0, j=0; i<info->width; i+=2, j++)
+                                   dst8[j] = (src[i] & 0xF0) | (src[i+1] >> 4);
+                              break;
+                         case DSPF_A1:
+                              for (i=0, j=0; i < info->width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<info->width; ++i, ++n)
+                                        p |= (src[i] & 0x80) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         case DSPF_LUT2:
+                              for (i=0, j=0; i < info->width; ++j) {
+                                   register u8 p = 0;
+
+                                   for (n=0; n<8 && i<info->width; ++i, n+=2)
+                                        p |= (src[i] & 0xC0) >> n;
+
+                                   dst8[j] = p;
+                              }
+                              break;
+                         default:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+                    break;
+
+                    /* case ft_pixel_mode_mono: */
+               case true:
+                    switch (surface->config.format) {
+                         case DSPF_ARGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0xFF : 0x00) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_AiRGB:
+                              for (i=0; i<info->width; i++)
+                                   dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x00 : 0xFF) << 24) | 0xFFFFFF;
+                              break;
+                         case DSPF_ARGB4444:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0xF : 0x0) << 12) | 0xFFF;
+                              break;
+                         case DSPF_ARGB2554:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x3 : 0x0) << 14) | 0x3FFF;
+                              break;
+                         case DSPF_ARGB1555:
+                              for (i=0; i<info->width; i++)
+                                   dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ?
+                                                0x1 : 0x0) << 15) | 0x7FFF;
+                              break;
+                         case DSPF_A8:
+                              for (i=0; i<info->width; i++)
+                                   dst8[i] = (src[i>>3] &
+                                              (1<<(7-(i%8)))) ? 0xFF : 0x00;
+                              break;
+                         case DSPF_A4:
+                              for (i=0, j=0; i<info->width; i+=2, j++)
+                                   dst8[j] = ((src[i>>3] &
+                                               (1<<(7-(i%8)))) ? 0xF0 : 0x00) |
+                                             ((src[(i+1)>>3] &
+                                               (1<<(7-((i+1)%8)))) ? 0x0F : 0x00);
+                              break;
+                         case DSPF_A1:
+                              direct_memcpy( lock.addr, src, DFB_BYTES_PER_LINE(DSPF_A1, info->width) );
+                              break;
+                         default:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+                    break;
+
+               default:
+                    break;
+
+          }
+
+          /*src += face->glyph->bitmap.pitch; */
+          src += glyph_map->bpl;
+
+          lock.addr += lock.pitch;
+     }
+
+     dfb_surface_unlock_buffer( surface, &lock );
+     FS_free_char(data->state,glyph_map);
+     return DFB_OK;
+}
+
+
+static DFBResult
+get_glyph_info( CoreFont      *thiz,
+                unsigned int   index,
+                CoreGlyphData *info )
+{
+     FS_LONG err;
+     /*    FT_Face  face;
+         FT_Int   load_flags;*/
+     ITImplData *data = (ITImplData*) thiz->impl_data;
+     FS_GLYPHMAP   *glyph_map;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     /* face = data->face;
+
+      load_flags = (unsigned long) face->generic.data;
+       */
+
+     switch (info->layer) {
+          case 0:
+               err = FS_set_flags( data->state, FLAGS_NO_EFFECT );
+               if (err) {
+                    D_ERROR( "DirectFB/FontItype: Failed setting FLAGS_NO_EFFECT!\n" );
+
+                    pthread_mutex_unlock ( &library_mutex );
+                    return DFB_FAILURE;
+               }
+               break;
+
+          case 1:
+               err = FS_set_flags( data->state, FLAGS_OUTLINED_SOFT );
+               if (err) {
+                    D_ERROR( "DirectFB/FontItype: Failed setting FLAGS_OUTLINED_SOFT!\n" );
+
+                    pthread_mutex_unlock ( &library_mutex );
+                    return DFB_FAILURE;
+               }
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     if (load_mono)
+          glyph_map = FS_get_glyphmap( data->state, index, FS_MAP_BITMAP );
+     else
+          glyph_map = FS_get_glyphmap( data->state, index, FS_MAP_EDGE_GRAYMAP8 | FS_MAP_GRAYMAP8);
+     if (!glyph_map) {
+          /*glyph_map->err = FS_error(&state);*/
+          D_DEBUG( "DirectFB/FontItype: Could not load glyph for character index #%d!\n", index );
+
+          pthread_mutex_unlock ( &library_mutex );
+
+          return DFB_FAILURE;
+     }
+
+     /*  if ((err = FT_Load_Glyph( face, index, load_flags ))) {
+            D_DEBUG( "DirectFB/FontFT2: Could not load glyph for character index #%d!\n", index );
+
+            pthread_mutex_unlock ( &library_mutex );
+
+            return DFB_FAILURE;
+       }
+
+       if (face->glyph->format != ft_glyph_format_bitmap) {
+            err = FT_Render_Glyph( face->glyph,
+                                   (load_flags & FT_LOAD_TARGET_MONO) ? ft_render_mode_mono : ft_render_mode_normal );
+            if (err) {
+                 D_ERROR( "DirectFB/FontFT2: Could not render glyph for character index #%d!\n", index );
+
+                 pthread_mutex_unlock ( &library_mutex );
+
+                 return DFB_FAILURE;
+            }
+       }
+  */
+     pthread_mutex_unlock ( &library_mutex );
+
+     info->width   = glyph_map->width;
+     info->height  = glyph_map->height;
+//     info->advance = data->fixed_advance ?
+//                     data->fixed_advance : (glyph_map->dx >> 16);
+     if (data->fixed_advance) {
+          info->xadvance = - data->fixed_advance * thiz->up_unit_y;
+          info->yadvance =   data->fixed_advance * thiz->up_unit_x;
+     }
+     else {
+          info->xadvance =   glyph_map->dx >> 16;
+          info->yadvance = - glyph_map->dy >> 16;
+     }
+
+     if (data->fixed_clip && info->width > data->fixed_advance)
+          info->width = data->fixed_advance;
+     FS_free_char(data->state,glyph_map);
+     return DFB_OK;
+}
+
+
+static DFBResult
+get_kerning( CoreFont     *thiz,
+             unsigned int  prev,
+             unsigned int  current,
+             int          *kern_x,
+             int          *kern_y)
+{
+     /*   FT_Vector vector;
+
+         FT2ImplKerningData *data = thiz->impl_data;
+         KerningCacheEntry *cache = NULL;
+
+         D_ASSUME( (kern_x != NULL) || (kern_y != NULL) );
+    */
+     /*
+      * Use cached values if characters are in the
+      * cachable range and the cache entry is already filled.
+      */
+     /*    if (KERNING_DO_CACHE (prev, current)) {
+              cache = &KERNING_CACHE_ENTRY (prev, current);
+
+              if (kern_x)
+                   *kern_x = (int) cache->x;
+
+              if (kern_y)
+                   *kern_y = (int) cache->y;
+
+              return DFB_OK;
+         }
+
+         pthread_mutex_lock ( &library_mutex );
+    */
+     /* Lookup kerning values for the character pair. */
+/*     FT_Get_Kerning( data->base.face,
+                     prev, current, ft_kerning_default, &vector );
+
+     pthread_mutex_unlock ( &library_mutex );
+*/
+     /* Convert to integer. */
+/*     if (kern_x)
+          *kern_x = vector.x >> 6;
+
+     if (kern_y)
+          *kern_y = vector.y >> 6;
+*/
+     if (kern_x)
+          *kern_x = 0;
+     if (kern_y)
+          *kern_y = 0;
+     return DFB_OK;
+}
+
+static void
+init_kerning_cache( ITImplKerningData *data )
+{
+     /*    int a, b;
+
+         pthread_mutex_lock ( &library_mutex );
+
+         for (a=KERNING_CACHE_MIN; a<=KERNING_CACHE_MAX; a++) {
+              for (b=KERNING_CACHE_MIN; b<=KERNING_CACHE_MAX; b++) {
+                   FT_Vector          vector;
+                   KerningCacheEntry *cache = &KERNING_CACHE_ENTRY( a, b );
+    */
+     /* Lookup kerning values for the character pair. */
+/*               FT_Get_Kerning( data->base.face,
+                               a, b, ft_kerning_default, &vector );
+
+               cache->x = (signed char) (vector.x >> 6);
+               cache->y = (signed char) (vector.y >> 6);
+          }
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+      */
+}
+
+/*static DFBResult
+init_freetype( void )
+{
+     FT_Error err;
+
+     pthread_mutex_lock ( &library_mutex );
+
+     if (!library) {
+          D_DEBUG( "DirectFB/FontFT2: Initializing the FreeType2 library.\n" );
+          err = FT_Init_FreeType( &library );
+          if (err) {
+               D_ERROR( "DirectFB/FontFT2: "
+                         "Initialization of the FreeType2 library failed!\n" );
+               library = NULL;
+               pthread_mutex_unlock( &library_mutex );
+               return DFB_FAILURE;
+          }
+     }
+
+     library_ref_count++;
+     pthread_mutex_unlock( &library_mutex );
+
+     return DFB_OK;
+}
+
+
+static void
+release_freetype( void )
+{
+     pthread_mutex_lock( &library_mutex );
+
+     if (library && --library_ref_count == 0) {
+          D_DEBUG( "DirectFB/FontFT2: Releasing the FreeType2 library.\n" );
+          FT_Done_FreeType( library );
+          library = NULL;
+     }
+
+     pthread_mutex_unlock( &library_mutex );
+}
+
+*/
+FS_STATE *
+init_itype( )
+{
+     FS_LONG err;
+     FS_STATE *state=NULL;
+
+     pthread_mutex_lock ( &library_mutex );
+     if (!state_init) {
+          D_DEBUG( "DirectFB/FontItype: Initializing the Itype library.\n" );
+          memset(&state_global, 0, sizeof(FS_STATE));
+
+          err = FS_init(&state_global, THE_HEAP_SIZE);
+          if (err) {
+               D_ERROR( "DirectFB/FontItype: "
+                        "Initialization of the Itype library failed!\n" );
+               pthread_mutex_unlock( &library_mutex );
+               return state;
+          }
+          state_init = true;
+          state =&state_global;
+     }
+     else {
+          state=FS_new_client(&state_global,0);
+          if (state==NULL) {
+               D_ERROR( "DirectFB/FontItype: "
+                        "Add new client failed!\n" );
+               pthread_mutex_unlock( &library_mutex );
+               return state;
+          }
+     }
+     library_ref_count++;
+     pthread_mutex_unlock( &library_mutex );
+
+     return state;
+}
+
+
+static void
+release_itype( void )
+{
+     pthread_mutex_lock( &library_mutex );
+
+     if (state_init && --library_ref_count == 0) {
+          D_DEBUG( "DirectFB/FontItype: Releasing the Itype library.\n" );
+          /* FT_Done_FreeType( library );
+           library = NULL;
+             */
+
+          FS_exit(&state_global);
+          state_init = false;
+     }
+
+     pthread_mutex_unlock( &library_mutex );
+}
+
+static void
+IDirectFBFont_IT_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_data *data = (IDirectFBFont_data*)thiz->priv;
+
+     if (data->font->impl_data) {
+          ITImplData *impl_data = (ITImplData*) data->font->impl_data;
+
+          pthread_mutex_lock ( &library_mutex );
+          /* FT_Done_Face( impl_data->face ); */
+          if (library_ref_count>1)
+               FS_end_client(impl_data->state);
+          pthread_mutex_unlock ( &library_mutex );
+
+          D_FREE( impl_data );
+
+          data->font->impl_data = NULL;
+     }
+
+     IDirectFBFont_Destruct( thiz );
+
+     release_itype();
+}
+
+
+static DirectResult
+IDirectFBFont_IT_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (--data->ref == 0) {
+          IDirectFBFont_IT_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+Probe( IDirectFBFont_ProbeContext *ctx )
+{
+     /* FT_Error err;
+      FT_Face  face;
+       */
+     FS_LONG err;
+     FILECHAR font_name[MAX_FONT_NAME_LEN];
+     FS_STATE *state_tp;
+
+     D_DEBUG_AT( Font_Itype, "Probe font `%s'.\n", ctx->filename );
+
+     if (!ctx->content)
+          return DFB_UNSUPPORTED;
+
+     if (ctx->filename && strchr (ctx->filename, '.' ) &&
+        (!strcasecmp ( strchr (ctx->filename, '.' ), ".ttf" ) == 0 &&
+         !strcasecmp ( strchr (ctx->filename, '.' ), ".otf" ) == 0 &&
+		 !strcasecmp ( strchr (ctx->filename, '.' ), ".ltt") == 0))
+          return DFB_UNSUPPORTED;
+
+     state_tp = init_itype();
+     if (state_tp == NULL)
+          return DFB_FAILURE;
+
+     pthread_mutex_lock ( &library_mutex );
+     /*
+      * This should be
+      * err = FT_New_Face( library, ctx->filename, -1, NULL );
+      * but due to freetype bugs it doesn't work.
+      */
+     /* err = FT_New_Face( library, ctx->filename, 0, &face );
+      if (!err)
+           FT_Done_Face( face );
+             */
+     if (library_ref_count > 1)
+          FS_end_client(state_tp);
+     pthread_mutex_unlock ( &library_mutex );
+
+     release_itype();
+
+     return  DFB_OK;
+}
+
+static  bool                   disable_kerning = false;
+static DFBResult
+Construct( IDirectFBFont               *thiz,
+           CoreDFB                     *core,
+           IDirectFBFont_ProbeContext  *ctx,
+           DFBFontDescription          *desc )
+{
+     int                    i;
+     DFBResult              ret;
+     CoreFont              *font;
+     /* FT_Face                face;
+      FT_Error               err;
+      FT_Int                 load_flags = FT_LOAD_DEFAULT; */
+     ITImplData           *data;
+     bool                   disable_charmap = false;
+
+     u32                    mask = 0;
+     FS_ULONG               flags;
+
+     FS_LONG err;
+
+     FS_ULONG load_flags;
+
+
+     FILECHAR fontName[MAX_FONT_NAME_LEN];
+     FS_STATE *state;
+     float sin_rot = 0.0;
+     float cos_rot = 1.0;
+
+     D_DEBUG( "DirectFB/FontItype: "
+              "Construct font from file `%s' (index %d) at pixel size %d x %d.\n",
+              ctx->filename,
+              (desc->flags & DFDESC_INDEX)  ? desc->index  : 0,
+              (desc->flags & DFDESC_WIDTH)  ? desc->width  : 0,
+              (desc->flags & DFDESC_HEIGHT)   ? desc->height   : 0,
+              (desc->flags & DFDESC_ROTATION) ? desc->rotation : 0 );
+
+     state = init_itype();
+     if (state == NULL) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+     pthread_mutex_lock ( &library_mutex );
+     err = FS_load_font(state, NULL, ctx->content,0, MAX_FONT_NAME_LEN, fontName);
+
+     if (err) {
+          D_ERROR( "DirectFB/FontItype: "
+                   "Failed loading face %d from font file `%s' (error %lu)!\n",
+                   (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                   ctx->filename, state->error );
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     err = FS_set_font(state, fontName);
+     if (err) {
+          D_ERROR( "DirectFB/FontItype: "
+                   "Failed seting font `%s'!\n", fontName );
+          FS_delete_font(state, fontName);
+
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     err = FS_set_cmap(state, 3,1 );
+     if (err) {
+          D_ERROR( "DirectFB/FontItype: "
+                   "Failed seting cmap `%s'!\n", fontName );
+          FS_delete_font(state, fontName);
+
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+
+     err = FS_set_flags( state, FLAGS_CMAP_OFF );
+     if (err) {
+          D_ERROR( "DirectFB/FontItype: "
+                   "Failed setting FLAGS_CMAP_OFF for `%s'!\n", fontName );
+          FS_delete_font(state, fontName);
+
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     if (desc->flags & DFDESC_ATTRIBUTES && desc->attributes & DFFA_OUTLINED) {
+          if (desc->flags & DFDESC_OUTLINE_WIDTH)
+               FS_set_outline_width( state, desc->outline_width >> 16 );
+          else
+               FS_set_outline_width( state, 1 );
+
+          if (desc->flags & DFDESC_OUTLINE_OPACITY)
+               FS_set_outline_opacity( state, desc->outline_opacity );
+          else
+               FS_set_outline_opacity( state, 0x10000 );
+     }
+
+     pthread_mutex_unlock ( &library_mutex );
+     /*
+     if (init_freetype() != DFB_OK) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     pthread_mutex_lock ( &library_mutex );
+     err = FT_New_Face( library, filename,
+                        (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                        &face );
+     pthread_mutex_unlock ( &library_mutex );
+     if (err) {
+          switch (err) {
+               case FT_Err_Unknown_File_Format:
+                    D_ERROR( "DirectFB/FontFT2: "
+                              "Unsupported font format in file `%s'!\n", filename );
+                    break;
+               default:
+                    D_ERROR( "DirectFB/FontFT2: "
+                              "Failed loading face %d from font file `%s'!\n",
+                              (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+                              filename );
+                    break;
+          }
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+*/
+     if (dfb_config->font_format == DSPF_A1 || dfb_config->font_format == DSPF_ARGB1555)
+          load_mono = true;
+
+
+
+
+/*
+     if (desc->flags & DFDESC_ATTRIBUTES) {
+          if (desc->attributes & DFFA_NOHINTING)
+               load_flags |= FT_LOAD_NO_HINTING;
+          if (desc->attributes & DFFA_NOCHARMAP)
+               disable_charmap = true;
+          if (desc->attributes & DFFA_NOKERNING)
+               disable_kerning = true;
+          if (desc->attributes & DFFA_MONOCHROME)
+               load_mono = true;
+     }
+*/
+     if (desc->flags & DFDESC_ATTRIBUTES) {
+          if (desc->attributes & DFFA_NOHINTING)
+               load_flags |= FLAGS_HINTS_OFF;
+          if (desc->attributes & DFFA_NOCHARMAP) {
+               load_flags |= FLAGS_CMAP_OFF ;
+               disable_charmap = true;
+          }
+          if (desc->attributes & DFFA_NOKERNING)
+               disable_kerning = true;
+          if (desc->attributes & DFFA_MONOCHROME)
+               load_mono = true;
+     }
+/*     if (load_mono)
+          load_flags |= FT_LOAD_TARGET_MONO;
+
+     if (!disable_charmap) {
+          pthread_mutex_lock ( &library_mutex );
+          err = FT_Select_Charmap( face, ft_encoding_unicode );
+          pthread_mutex_unlock ( &library_mutex );
+            */
+     if (!disable_charmap) {
+          pthread_mutex_lock ( &library_mutex );
+          err = FS_set_cmap( state, 3,1 );  /* Microsoft platform, Unicode */
+          pthread_mutex_unlock ( &library_mutex );
+
+
+/* #if FREETYPE_MINOR > 0*/
+
+          /* ft_encoding_latin_1 has been introduced in freetype-2.1 */
+          if (err) {
+               D_DEBUG( "DirectFB/FontItype: "
+                        "Couldn't select Unicode encoding, "
+                        "falling back to Latin1.\n");
+               pthread_mutex_lock ( &library_mutex );
+               err = FS_set_cmap( state, 3,0 );
+               pthread_mutex_unlock ( &library_mutex );
+          }
+/*#endif */
+          /*         if (err) {
+                        D_DEBUG( "DirectFB/Itype: "
+                                 "Couldn't select Unicode/Latin1 encoding, "
+                                 "trying Symbol.\n");
+                        pthread_mutex_lock ( &library_mutex );
+                        err = FS_set_cmap( &state, 3,3 );
+                        pthread_mutex_unlock ( &library_mutex );
+
+                        if (!err)
+                             mask = 0xf000;
+                     }  */
+
+     }
+
+/*#if 0 */
+     if (err) {
+          D_ERROR( "DirectFB/Itype: "
+                   "Couldn't select a suitable encoding for face %d from font file `%s'!\n", (desc->flags & DFDESC_INDEX) ? desc->index : 0, ctx->filename );
+          pthread_mutex_lock ( &library_mutex );
+          /*FT_Done_Face( face );*/
+          FS_delete_font(state, fontName);
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+/* #endif */
+
+     if (desc->flags & (DFDESC_HEIGHT       | DFDESC_WIDTH |
+                        DFDESC_FRACT_HEIGHT | DFDESC_FRACT_WIDTH)) {
+          int fw = 0, fh = 0;
+
+          if (desc->flags & DFDESC_FRACT_HEIGHT)
+               fh = desc->fract_height;
+          else if (desc->flags & DFDESC_HEIGHT)
+               fh = desc->height << 16;
+
+          if (desc->flags & DFDESC_FRACT_WIDTH)
+               fw = desc->fract_width;
+          else if (desc->flags & DFDESC_WIDTH)
+               fw = desc->width << 16;
+
+          pthread_mutex_lock ( &library_mutex );
+          // CR brg36mgr#105644: [extginga]Lintotype to support new font styles
+          // Previously the fw and fh were always made equal to each other:
+          // Now they can be set differently.
+/* 
+          if ( fw != fh && fh != 0)
+               fw=fh;
+          else
+               fh=fw;*/
+          // Replaced by the following to ensure that fw and fh is different from 0
+          // unless they are both 0, then no font will be shown.
+          if ( fw == 0 )
+          {
+            fw = fh;
+          }
+          if ( fh == 0 )
+          {
+            fh = fw;
+          }
+
+          if ((desc->flags & DFDESC_ROTATION) && desc->rotation) {
+//JMH          if (!FT_IS_SCALABLE(face)) {
+//JMH               D_ERROR( "DirectFB/FontFT2: "
+//JMH                         "Face %d from font file `%s' is not scalable so cannot be rotated\n",
+//JMH                         (desc->flags & DFDESC_INDEX) ? desc->index : 0,
+//JMH                         filename );
+//JMH               pthread_mutex_lock ( &library_mutex );
+//JMH               FT_Done_Face( face );
+//JMH               pthread_mutex_unlock ( &library_mutex );
+//JMH               DIRECT_DEALLOCATE_INTERFACE( thiz );
+//JMH               return DFB_UNSUPPORTED;
+//JMH          }
+               float rot_radians = 2.0 * M_PI * desc->rotation / (1<<24);
+               sin_rot = sin(rot_radians);
+               cos_rot = cos(rot_radians);
+		       err = FS_set_scale (state, fw*cos_rot, -fh*sin_rot, fw*sin_rot, fh*cos_rot );
+		  }
+	      else
+		  {
+               err = FS_set_scale( state, fw, 0, 0, fh);
+		  }
+
+          pthread_mutex_unlock ( &library_mutex );
+          if (err) {
+               D_ERROR( "DirectB/Itype: "
+                        "Could not set pixel size to %d x %d!\n",
+                        (desc->flags & DFDESC_WIDTH)  ? desc->width  : 0,
+                        (desc->flags & DFDESC_HEIGHT) ? desc->height : 0 );
+               pthread_mutex_lock ( &library_mutex );
+               /* FT_Done_Face( face );  */
+               FS_delete_font(state, fontName);
+               pthread_mutex_unlock ( &library_mutex );
+               DIRECT_DEALLOCATE_INTERFACE( thiz );
+               return DFB_FAILURE;
+          }
+     }
+
+     /*  face->generic.data = (void *)(unsigned long) load_flags;
+       face->generic.finalizer = NULL;
+  */
+     ret = dfb_font_create( core, desc, ctx->filename, &font );
+     if (ret) {
+          pthread_mutex_lock ( &library_mutex );
+          /* FT_Done_Face( face );  */
+          FS_delete_font(state, fontName);
+          pthread_mutex_unlock ( &library_mutex );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     font->attributes = desc->attributes;
+
+     D_ASSERT( font->pixel_format == DSPF_ARGB ||
+               font->pixel_format == DSPF_AiRGB ||
+               font->pixel_format == DSPF_ARGB4444 ||
+               font->pixel_format == DSPF_ARGB2554 ||
+               font->pixel_format == DSPF_ARGB1555 ||
+               font->pixel_format == DSPF_A8 ||
+               font->pixel_format == DSPF_A4 ||
+               font->pixel_format == DSPF_A1 );
+
+     /*
+     font->ascender   = face->size->metrics.ascender >> 6;
+     font->descender  = face->size->metrics.descender >> 6;
+     font->height     = font->ascender + ABS(font->descender) + 1;
+     font->maxadvance = face->size->metrics.max_advance >> 6;
+      */
+     FS_FIXED ascender;
+     FS_FIXED descender;
+     FS_FIXED leading;
+     FsAscDescLeadSource *source;
+     source = D_CALLOC( 1, sizeof(FsAscDescLeadSource) );
+     pthread_mutex_lock ( &library_mutex );
+     err = FS_get_ascender_descender_leading(state, &ascender,&descender,&leading,source);
+     pthread_mutex_unlock ( &library_mutex );
+
+     font->ascender   = (ascender >> 16) + 1;
+     font->descender  = 0 - (descender >> 16) - 1;
+     font->height     = font->ascender + ABS(font->descender) + 1;
+     font->maxadvance = font->height + (leading >> 16);
+
+     font->up_unit_x  = -sin_rot;
+     font->up_unit_y  = -cos_rot;
+
+     D_FREE(source);
+     D_DEBUG( "DirectFB/Itype: height = %d, ascender = %d, descender = %d, maxadvance = %d, up unit: %5.2f,%5.2f\n",
+              font->height, font->ascender, font->descender, font->maxadvance, font->up_unit_x, font->up_unit_y );
+
+     font->GetGlyphData = get_glyph_info;
+     font->RenderGlyph  = render_glyph;
+/*
+     if (FT_HAS_KERNING(face) && !disable_kerning) {
+          font->GetKerning = get_kerning;
+          data = D_CALLOC( 1, sizeof(FT2ImplKerningData) );
+     }
+     else
+          data = D_CALLOC( 1, sizeof(FT2ImplData) );
+*/
+     if (!disable_kerning) {
+          font->GetKerning = get_kerning;
+          data = D_CALLOC( 1, sizeof(ITImplKerningData) );
+     }
+     else
+          data = D_CALLOC( 1, sizeof(ITImplData) );
+
+     data->state            = state;
+     data->disable_charmap = disable_charmap;
+
+     if (/*FT_HAS_KERNING(face) && */!disable_kerning)
+          init_kerning_cache( (ITImplKerningData*) data );
+
+     if (desc->flags & DFDESC_FIXEDADVANCE) {
+          data->fixed_advance = desc->fixed_advance;
+          font->maxadvance    = desc->fixed_advance;
+
+          if ((desc->flags & DFDESC_ATTRIBUTES) && (desc->attributes & DFFA_FIXEDCLIP))
+               data->fixed_clip = true;
+     }
+
+     for (i=0; i<256; i++)
+          /* data->indices[i] = FT_Get_Char_Index( face, i | mask );*/
+          data->indices[i] = FS_map_char( state, i | mask );
+
+     font->impl_data = data;
+
+     dfb_font_register_encoding( font, "UTF8",   &UTF8Funcs,   DTEID_UTF8 );
+     dfb_font_register_encoding( font, "UTF16",  &UTF16Funcs,  DTEID_OTHER );
+     dfb_font_register_encoding( font, "Latin1", &Latin1Funcs, DTEID_OTHER );
+
+     IDirectFBFont_Construct( thiz, font );
+
+     thiz->Release = IDirectFBFont_IT_Release;
+
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.am b/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.am
new file mode 100755
index 0000000..f512afd
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.am
@@ -0,0 +1,82 @@
+## Makefile.am for DirectFB/interfaces/IDirectFBImageProvider
+
+idirectfbimageproviderdir = $(MODULEDIR)/interfaces/IDirectFBImageProvider
+
+if GIF_PROVIDER
+GIF_PROVIDER_LTLIB = libidirectfbimageprovider_gif.la
+else
+GIF_PROVIDER_LTLIB = 
+endif
+
+if JPEG_PROVIDER
+JPEG_PROVIDER_LTLIB = libidirectfbimageprovider_jpeg.la
+else
+JPEG_PROVIDER_LTLIB = 
+endif
+
+if PNG_PROVIDER
+PNG_PROVIDER_LTLIB = libidirectfbimageprovider_png.la
+else
+PNG_PROVIDER_LTLIB = 
+endif
+
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_dfiff.la	\
+	$(GIF_PROVIDER_LTLIB)			\
+	$(JPEG_PROVIDER_LTLIB)			\
+	$(PNG_PROVIDER_LTLIB)
+
+if BUILD_STATIC
+idirectfbimageprovider_DATA = $(idirectfbimageprovider_LTLIBRARIES:.la=.o)
+endif
+
+
+libidirectfbimageprovider_png_la_SOURCES = idirectfbimageprovider_png.c
+
+libidirectfbimageprovider_png_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(LIBPNG)
+
+libidirectfbimageprovider_png_la_LDFLAGS = -avoid-version -module
+
+
+libidirectfbimageprovider_dfiff_la_SOURCES = idirectfbimageprovider_dfiff.c
+
+libidirectfbimageprovider_dfiff_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbimageprovider_dfiff_la_LDFLAGS = -avoid-version -module
+
+
+libidirectfbimageprovider_gif_la_SOURCES = idirectfbimageprovider_gif.c
+
+libidirectfbimageprovider_gif_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbimageprovider_gif_la_LDFLAGS = -avoid-version -module
+
+
+libidirectfbimageprovider_jpeg_la_SOURCES = idirectfbimageprovider_jpeg.c
+
+libidirectfbimageprovider_jpeg_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(LIBJPEG)
+
+libidirectfbimageprovider_jpeg_la_LDFLAGS = -avoid-version -module
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.in b/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.in
new file mode 100755
index 0000000..4f7e8d2
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/Makefile.in
@@ -0,0 +1,683 @@
+# 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 = interfaces/IDirectFBImageProvider
+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)$(idirectfbimageproviderdir)" \
+	"$(DESTDIR)$(idirectfbimageproviderdir)"
+idirectfbimageproviderLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(idirectfbimageprovider_LTLIBRARIES)
+libidirectfbimageprovider_dfiff_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbimageprovider_dfiff_la_OBJECTS =  \
+	idirectfbimageprovider_dfiff.lo
+libidirectfbimageprovider_dfiff_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_dfiff_la_OBJECTS)
+libidirectfbimageprovider_dfiff_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_dfiff_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbimageprovider_gif_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbimageprovider_gif_la_OBJECTS =  \
+	idirectfbimageprovider_gif.lo
+libidirectfbimageprovider_gif_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_gif_la_OBJECTS)
+libidirectfbimageprovider_gif_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_gif_la_LDFLAGS) $(LDFLAGS) -o $@
+@GIF_PROVIDER_TRUE@am_libidirectfbimageprovider_gif_la_rpath = -rpath \
+@GIF_PROVIDER_TRUE@	$(idirectfbimageproviderdir)
+am__DEPENDENCIES_1 =
+libidirectfbimageprovider_jpeg_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libidirectfbimageprovider_jpeg_la_OBJECTS =  \
+	idirectfbimageprovider_jpeg.lo
+libidirectfbimageprovider_jpeg_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_jpeg_la_OBJECTS)
+libidirectfbimageprovider_jpeg_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_jpeg_la_LDFLAGS) $(LDFLAGS) -o $@
+@JPEG_PROVIDER_TRUE@am_libidirectfbimageprovider_jpeg_la_rpath =  \
+@JPEG_PROVIDER_TRUE@	-rpath $(idirectfbimageproviderdir)
+libidirectfbimageprovider_png_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libidirectfbimageprovider_png_la_OBJECTS =  \
+	idirectfbimageprovider_png.lo
+libidirectfbimageprovider_png_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_png_la_OBJECTS)
+libidirectfbimageprovider_png_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_png_la_LDFLAGS) $(LDFLAGS) -o $@
+@PNG_PROVIDER_TRUE@am_libidirectfbimageprovider_png_la_rpath = -rpath \
+@PNG_PROVIDER_TRUE@	$(idirectfbimageproviderdir)
+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 = $(libidirectfbimageprovider_dfiff_la_SOURCES) \
+	$(libidirectfbimageprovider_gif_la_SOURCES) \
+	$(libidirectfbimageprovider_jpeg_la_SOURCES) \
+	$(libidirectfbimageprovider_png_la_SOURCES)
+DIST_SOURCES = $(libidirectfbimageprovider_dfiff_la_SOURCES) \
+	$(libidirectfbimageprovider_gif_la_SOURCES) \
+	$(libidirectfbimageprovider_jpeg_la_SOURCES) \
+	$(libidirectfbimageprovider_png_la_SOURCES)
+idirectfbimageproviderDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idirectfbimageprovider_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@
+idirectfbimageproviderdir = $(MODULEDIR)/interfaces/IDirectFBImageProvider
+@GIF_PROVIDER_FALSE@GIF_PROVIDER_LTLIB = 
+@GIF_PROVIDER_TRUE@GIF_PROVIDER_LTLIB = libidirectfbimageprovider_gif.la
+@JPEG_PROVIDER_FALSE@JPEG_PROVIDER_LTLIB = 
+@JPEG_PROVIDER_TRUE@JPEG_PROVIDER_LTLIB = libidirectfbimageprovider_jpeg.la
+@PNG_PROVIDER_FALSE@PNG_PROVIDER_LTLIB = 
+@PNG_PROVIDER_TRUE@PNG_PROVIDER_LTLIB = libidirectfbimageprovider_png.la
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_dfiff.la	\
+	$(GIF_PROVIDER_LTLIB)			\
+	$(JPEG_PROVIDER_LTLIB)			\
+	$(PNG_PROVIDER_LTLIB)
+
+@BUILD_STATIC_TRUE@idirectfbimageprovider_DATA = $(idirectfbimageprovider_LTLIBRARIES:.la=.o)
+libidirectfbimageprovider_png_la_SOURCES = idirectfbimageprovider_png.c
+libidirectfbimageprovider_png_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(LIBPNG)
+
+libidirectfbimageprovider_png_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_dfiff_la_SOURCES = idirectfbimageprovider_dfiff.c
+libidirectfbimageprovider_dfiff_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbimageprovider_dfiff_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_gif_la_SOURCES = idirectfbimageprovider_gif.c
+libidirectfbimageprovider_gif_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbimageprovider_gif_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_jpeg_la_SOURCES = idirectfbimageprovider_jpeg.c
+libidirectfbimageprovider_jpeg_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(LIBJPEG)
+
+libidirectfbimageprovider_jpeg_la_LDFLAGS = -avoid-version -module
+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  interfaces/IDirectFBImageProvider/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  interfaces/IDirectFBImageProvider/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-idirectfbimageproviderLTLIBRARIES: $(idirectfbimageprovider_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbimageproviderLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$p"; \
+	done
+
+clean-idirectfbimageproviderLTLIBRARIES:
+	-test -z "$(idirectfbimageprovider_LTLIBRARIES)" || rm -f $(idirectfbimageprovider_LTLIBRARIES)
+	@list='$(idirectfbimageprovider_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
+libidirectfbimageprovider_dfiff.la: $(libidirectfbimageprovider_dfiff_la_OBJECTS) $(libidirectfbimageprovider_dfiff_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_dfiff_la_LINK) -rpath $(idirectfbimageproviderdir) $(libidirectfbimageprovider_dfiff_la_OBJECTS) $(libidirectfbimageprovider_dfiff_la_LIBADD) $(LIBS)
+libidirectfbimageprovider_gif.la: $(libidirectfbimageprovider_gif_la_OBJECTS) $(libidirectfbimageprovider_gif_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_gif_la_LINK) $(am_libidirectfbimageprovider_gif_la_rpath) $(libidirectfbimageprovider_gif_la_OBJECTS) $(libidirectfbimageprovider_gif_la_LIBADD) $(LIBS)
+libidirectfbimageprovider_jpeg.la: $(libidirectfbimageprovider_jpeg_la_OBJECTS) $(libidirectfbimageprovider_jpeg_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_jpeg_la_LINK) $(am_libidirectfbimageprovider_jpeg_la_rpath) $(libidirectfbimageprovider_jpeg_la_OBJECTS) $(libidirectfbimageprovider_jpeg_la_LIBADD) $(LIBS)
+libidirectfbimageprovider_png.la: $(libidirectfbimageprovider_png_la_OBJECTS) $(libidirectfbimageprovider_png_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_png_la_LINK) $(am_libidirectfbimageprovider_png_la_rpath) $(libidirectfbimageprovider_png_la_OBJECTS) $(libidirectfbimageprovider_png_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_dfiff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_gif.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_jpeg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_png.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-idirectfbimageproviderDATA: $(idirectfbimageprovider_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbimageproviderDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  $(idirectfbimageproviderDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	done
+
+uninstall-idirectfbimageproviderDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$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)$(idirectfbimageproviderdir)" "$(DESTDIR)$(idirectfbimageproviderdir)"; 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-idirectfbimageproviderLTLIBRARIES \
+	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-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES
+
+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-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-idirectfbimageproviderLTLIBRARIES 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-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES 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-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES
+
+%.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/interfaces/IDirectFBImageProvider/idirectfbimageprovider_dfiff.c b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_dfiff.c
new file mode 100755
index 0000000..56207e4
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_dfiff.c
@@ -0,0 +1,374 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <idirectfb.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <misc/gfx_util.h>
+
+#include <media/idirectfbdatabuffer.h>
+#include <media/idirectfbimageprovider.h>
+
+#include <dfiff.h>
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, DFIFF )
+
+
+/*
+ * private data struct of IDirectFBImageProvider_DFIFF
+ */
+typedef struct {
+     int                  ref;     /* reference counter */
+
+     void                *ptr;     /* pointer to raw file data (mapped) */
+     int                  len;     /* data length, i.e. file size */
+
+     DIRenderCallback     render_callback;
+     void                *render_callback_context;
+
+     CoreDFB             *core;
+} IDirectFBImageProvider_DFIFF_data;
+
+
+
+
+
+static void
+IDirectFBImageProvider_DFIFF_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_DFIFF_data *data = thiz->priv;
+
+     munmap( data->ptr, data->len );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBImageProvider_DFIFF_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_DFIFF)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_DFIFF_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_DFIFF)
+
+     if (--data->ref == 0) {
+          IDirectFBImageProvider_DFIFF_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_DFIFF_RenderTo( IDirectFBImageProvider *thiz,
+                                       IDirectFBSurface       *destination,
+                                       const DFBRectangle     *dest_rect )
+{
+     DFBResult              ret;
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *dst_surface;
+     const DFIFFHeader     *header;
+     DFBRectangle           rect;
+     DFBRectangle           clipped;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_DFIFF)
+
+     if (!destination)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM (destination, dst_data, IDirectFBSurface);
+
+     dst_surface = dst_data->surface;
+     if (!dst_surface)
+          return DFB_DEAD;
+
+     if (dest_rect) {
+          rect.x = dest_rect->x + dst_data->area.wanted.x;
+          rect.y = dest_rect->y + dst_data->area.wanted.y;
+          rect.w = dest_rect->w;
+          rect.h = dest_rect->h;
+     }
+     else
+          rect = dst_data->area.wanted;
+
+     if (rect.w < 1 || rect.h < 1)
+          return DFB_INVAREA;
+
+     clipped = rect;
+
+     if (!dfb_rectangle_intersect( &clipped, &dst_data->area.current ))
+          return DFB_INVAREA;
+
+     header = data->ptr;
+
+     if (DFB_RECTANGLE_EQUAL( rect, clipped ) &&
+         rect.w == header->width && rect.h == header->height &&
+         dst_surface->config.format == header->format)
+     {
+          ret = dfb_surface_write_buffer( dst_surface, CSBR_BACK,
+                                          data->ptr + sizeof(DFIFFHeader), header->pitch, &rect );
+          if (ret)
+               return ret;
+     }
+     else {
+          IDirectFBSurface      *source;
+          DFBSurfaceDescription  desc;
+          DFBSurfaceCapabilities caps;
+          DFBRegion              clip = DFB_REGION_INIT_FROM_RECTANGLE( &clipped );
+          DFBRegion              old_clip;
+
+          thiz->GetSurfaceDescription( thiz, &desc );
+
+          desc.flags |= DSDESC_PREALLOCATED;   
+          desc.preallocated[0].data  = data->ptr + sizeof(DFIFFHeader);
+          desc.preallocated[0].pitch = header->pitch;
+
+          ret = idirectfb_singleton->CreateSurface( idirectfb_singleton, &desc, &source );
+          if (ret)
+               return ret;
+
+          destination->GetCapabilities( destination, &caps );
+
+          if (caps & DSCAPS_PREMULTIPLIED && DFB_PIXELFORMAT_HAS_ALPHA(desc.pixelformat))
+               destination->SetBlittingFlags( destination, DSBLIT_SRC_PREMULTIPLY );
+          else
+               destination->SetBlittingFlags( destination, DSBLIT_NOFX );
+
+          destination->GetClip( destination, &old_clip );
+          destination->SetClip( destination, &clip );
+
+          destination->StretchBlit( destination, source, NULL, &rect );
+
+          destination->SetClip( destination, &old_clip );
+
+          destination->SetBlittingFlags( destination, DSBLIT_NOFX );
+
+          destination->ReleaseSource( destination );
+
+          source->Release( source );
+     }
+     
+     if (data->render_callback) {
+          DFBRectangle rect = { 0, 0, clipped.w, clipped.h };
+          data->render_callback( &rect, data->render_callback_context );
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_DFIFF_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                                DIRenderCallback        callback,
+                                                void                   *context )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_DFIFF)
+
+     data->render_callback         = callback;
+     data->render_callback_context = context;
+
+     return DFB_OK;
+}
+
+/* Loading routines */
+
+static DFBResult
+IDirectFBImageProvider_DFIFF_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                    DFBSurfaceDescription *dsc )
+{
+     const DFIFFHeader *header;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_DFIFF)
+
+     header = data->ptr;
+
+     dsc->flags       = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     dsc->width       = header->width;
+     dsc->height      = header->height;
+     dsc->pixelformat = header->format;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_DFIFF_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                  DFBImageDescription    *desc )
+{
+     const DFIFFHeader *header;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_DFIFF)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     header = data->ptr;
+
+     desc->caps = DICAPS_NONE;
+
+     if (DFB_PIXELFORMAT_HAS_ALPHA( header->format ))
+          desc->caps |= DICAPS_ALPHACHANNEL;
+
+     return DFB_OK;
+}
+
+
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx )
+{
+     if (!strncmp( (const char*) ctx->header, "DFIFF", 5 ))
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... )
+{
+     DFBResult                 ret;
+     struct stat               stat;
+     void                     *ptr;
+     int                       fd = -1;
+     IDirectFBDataBuffer_data *buffer_data;
+
+     IDirectFBDataBuffer *buffer;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_DFIFF)
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+
+     D_MAGIC_ASSERT( (IAny*) buffer, DirectInterface );
+
+     /* Get the buffer's private data. */
+     buffer_data = buffer->priv;
+     if (!buffer_data) {
+          ret = DFB_DEAD;
+          goto error;
+     }
+
+     /* Check for valid filename. */
+     if (!buffer_data->filename) {
+          ret = DFB_UNSUPPORTED;
+          goto error;
+     }
+
+     /* Open the file. */
+     fd = open( buffer_data->filename, O_RDONLY );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "ImageProvider/DFIFF: Failure during open() of '%s'!\n", buffer_data->filename );
+          goto error;
+     }
+
+     /* Query file size etc. */
+     if (fstat( fd, &stat ) < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "ImageProvider/DFIFF: Failure during fstat() of '%s'!\n", buffer_data->filename );
+          goto error;
+     }
+
+     /* Memory map the file. */
+     ptr = mmap( NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0 );
+     if (ptr == MAP_FAILED) {
+          ret = errno2result( errno );
+          D_PERROR( "ImageProvider/DFIFF: Failure during mmap() of '%s'!\n", buffer_data->filename );
+          goto error;
+     }
+
+     /* Already close, we still have the map. */
+     close( fd );
+
+     data->ref = 1;
+     data->ptr = ptr;
+     data->len = stat.st_size;
+     data->core = core;
+
+     thiz->AddRef                = IDirectFBImageProvider_DFIFF_AddRef;
+     thiz->Release               = IDirectFBImageProvider_DFIFF_Release;
+     thiz->RenderTo              = IDirectFBImageProvider_DFIFF_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_DFIFF_SetRenderCallback;
+     thiz->GetImageDescription   = IDirectFBImageProvider_DFIFF_GetImageDescription;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_DFIFF_GetSurfaceDescription;
+
+     return DFB_OK;
+
+error:
+     if (fd != -1)
+          close( fd );
+
+     DIRECT_DEALLOCATE_INTERFACE(thiz);
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_gif.c b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_gif.c
new file mode 100755
index 0000000..f9e8229
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_gif.c
@@ -0,0 +1,924 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <stdarg.h>
+
+#include <directfb.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <media/idirectfbimageprovider.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/surface.h>
+
+#include <misc/gfx_util.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <misc/util.h>
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, GIF )
+
+
+#ifndef NODEBUG
+#define GIFERRORMSG(x...)     { fprintf( stderr, "(GIFLOADER) "x ); \
+                                fprintf( stderr, "\n" ); }
+#else
+#define GIFERRORMSG(x...)
+#endif
+
+#define MAXCOLORMAPSIZE 256
+
+#define CM_RED   0
+#define CM_GREEN 1
+#define CM_BLUE  2
+
+#define MAX_LWZ_BITS 12
+
+#define INTERLACE     0x40
+#define LOCALCOLORMAP 0x80
+
+#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
+
+#define LM_to_uint(a,b) (((b)<<8)|(a))
+
+/*
+ * private data struct of IDirectFBImageProvider_GIF
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBDataBuffer *buffer;
+
+     u32                 *image;
+     int                  image_width;
+     int                  image_height;
+     bool                 image_transparency;
+     u32                  image_colorkey;
+
+     unsigned int  Width;
+     unsigned int  Height;
+     u8            ColorMap[3][MAXCOLORMAPSIZE];
+     unsigned int  BitPixel;
+     unsigned int  ColorResolution;
+     u32           Background;
+     unsigned int  AspectRatio;
+
+
+     int GrayScale;
+     int transparent;
+     int delayTime;
+     int inputFlag;
+     int disposal;
+
+
+     u8 buf[280];
+     int curbit, lastbit, done, last_byte;
+
+
+     int fresh;
+     int code_size, set_code_size;
+     int max_code, max_code_size;
+     int firstcode, oldcode;
+     int clear_code, end_code;
+     int table[2][(1<< MAX_LWZ_BITS)];
+     int stack[(1<<(MAX_LWZ_BITS))*2], *sp;
+
+     DIRenderCallback  render_callback;
+     void             *render_callback_ctx;
+
+     CoreDFB *core;
+} IDirectFBImageProvider_GIF_data;
+
+static bool verbose       = false;
+static bool showComment   = false;
+static bool ZeroDataBlock = false;
+
+static u32* ReadGIF( IDirectFBImageProvider_GIF_data *data, int imageNumber,
+                       int *width, int *height, bool *transparency,
+                       u32 *key_rgb, bool alpha, bool headeronly);
+
+static bool ReadOK( IDirectFBDataBuffer *buffer, void *data, unsigned int len );
+
+
+static DirectResult
+IDirectFBImageProvider_GIF_AddRef  ( IDirectFBImageProvider *thiz );
+
+static DirectResult
+IDirectFBImageProvider_GIF_Release ( IDirectFBImageProvider *thiz );
+
+static DFBResult
+IDirectFBImageProvider_GIF_RenderTo( IDirectFBImageProvider *thiz,
+                                     IDirectFBSurface       *destination,
+                                     const DFBRectangle     *destination_rect );
+
+static DFBResult
+IDirectFBImageProvider_GIF_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                              DIRenderCallback        callback,
+                                              void                   *context );
+
+static DFBResult
+IDirectFBImageProvider_GIF_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                  DFBSurfaceDescription  *dsc );
+
+static DFBResult
+IDirectFBImageProvider_GIF_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                DFBImageDescription    *dsc );
+
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx )
+{
+     if (strncmp ((char*) ctx->header, "GIF8", 4) == 0)
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... )
+{
+     IDirectFBDataBuffer *buffer;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_GIF)
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+     
+     data->ref = 1;
+
+     data->GrayScale   = -1;
+     data->transparent = -1;
+     data->delayTime   = -1;
+
+     data->core = core;
+     data->buffer = buffer;
+     buffer->AddRef( buffer );
+
+     data->image = ReadGIF( data, 1, &data->image_width, &data->image_height,
+                            &data->image_transparency, &data->image_colorkey,
+                            true, false );
+
+     buffer->Release( buffer );
+     data->buffer = NULL;
+     
+     if (!data->image) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     thiz->AddRef = IDirectFBImageProvider_GIF_AddRef;
+     thiz->Release = IDirectFBImageProvider_GIF_Release;
+     thiz->RenderTo = IDirectFBImageProvider_GIF_RenderTo;
+     thiz->SetRenderCallback = IDirectFBImageProvider_GIF_SetRenderCallback;
+     thiz->GetImageDescription = IDirectFBImageProvider_GIF_GetImageDescription;
+     thiz->GetSurfaceDescription =
+                               IDirectFBImageProvider_GIF_GetSurfaceDescription;
+
+     return DFB_OK;
+}
+
+static void
+IDirectFBImageProvider_GIF_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_GIF_data *data =
+                                   (IDirectFBImageProvider_GIF_data*)thiz->priv;
+
+     if (data->image)
+          D_FREE( data->image );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBImageProvider_GIF_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_GIF)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_GIF_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_GIF)
+
+     if (--data->ref == 0) {
+          IDirectFBImageProvider_GIF_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_GIF_RenderTo( IDirectFBImageProvider *thiz,
+                                     IDirectFBSurface       *destination,
+                                     const DFBRectangle     *dest_rect )
+{
+     DFBResult              ret;
+     DFBRegion              clip;
+     DFBRectangle           rect;
+     DFBSurfacePixelFormat  format;
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *dst_surface;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_GIF)
+
+     dst_data = (IDirectFBSurface_data*) destination->priv;
+     if (!dst_data)
+          return DFB_DEAD;
+
+     dst_surface = dst_data->surface;
+     if (!dst_surface)
+          return DFB_DESTROYED;
+
+     dfb_region_from_rectangle( &clip, &dst_data->area.current );
+
+     if (dest_rect) {
+          if (dest_rect->w < 1 || dest_rect->h < 1)
+               return DFB_INVARG;
+          rect = *dest_rect; 
+          rect.x += dst_data->area.wanted.x;
+          rect.y += dst_data->area.wanted.y;
+     }
+     else {
+          rect = dst_data->area.wanted;
+     }
+
+     ret = destination->GetPixelFormat( destination, &format );
+     if (ret)
+          return ret;
+
+     /* actual loading and rendering */
+     if (dfb_rectangle_region_intersects( &rect, &clip )) {
+          CoreSurfaceBufferLock lock;
+
+          ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+          if (ret)
+               return ret;
+
+          dfb_scale_linear_32( data->image, data->image_width, data->image_height,
+                               lock.addr, lock.pitch, &rect, dst_surface, &clip );
+
+          dfb_surface_unlock_buffer( dst_surface, &lock );
+
+          if (data->render_callback) {
+               DIRenderCallbackResult r;
+
+               rect.x = 0;
+               rect.y = 0;
+               rect.w = data->image_width;
+               rect.h = data->image_height;
+
+               r = data->render_callback( &rect, data->render_callback_ctx );
+
+               if (r != DIRCR_OK)
+                       return DFB_INTERRUPTED;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_GIF_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                              DIRenderCallback        callback,
+                                              void                   *context )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_GIF)
+
+     data->render_callback     = callback;
+     data->render_callback_ctx = context;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_GIF_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                  DFBSurfaceDescription  *dsc )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_GIF)
+
+     dsc->flags       = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     dsc->width       = data->image_width;
+     dsc->height      = data->image_height;
+     dsc->pixelformat = dfb_primary_layer_pixelformat();
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_GIF_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                DFBImageDescription    *dsc )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_GIF)
+
+     if (data->image_transparency) {
+          dsc->caps = DICAPS_COLORKEY;
+
+          dsc->colorkey_r = (data->image_colorkey & 0xff0000) >> 16;
+          dsc->colorkey_g = (data->image_colorkey & 0x00ff00) >>  8;
+          dsc->colorkey_b = (data->image_colorkey & 0x0000ff);
+     }
+     else
+          dsc->caps = DICAPS_NONE;
+
+     return DFB_OK;
+}
+
+
+/**********************************
+         GIF Loader Code
+ **********************************/
+
+static int ReadColorMap( IDirectFBDataBuffer *buffer, int number,
+                         u8 buf[3][MAXCOLORMAPSIZE] )
+{
+     int     i;
+     u8 rgb[3];
+
+     for (i = 0; i < number; ++i) {
+          if (! ReadOK( buffer, rgb, sizeof(rgb) )) {
+               GIFERRORMSG("bad colormap" );
+               return true;
+          }
+
+          buf[CM_RED][i]   = rgb[0] ;
+          buf[CM_GREEN][i] = rgb[1] ;
+          buf[CM_BLUE][i]  = rgb[2] ;
+     }
+     return false;
+}
+
+static int GetDataBlock(IDirectFBDataBuffer *buffer, u8 *buf)
+{
+     unsigned char count;
+
+     if (! ReadOK( buffer, &count, 1 )) {
+          GIFERRORMSG("error in getting DataBlock size" );
+          return -1;
+     }
+     ZeroDataBlock = count == 0;
+
+     if ((count != 0) && (! ReadOK( buffer, buf, count ))) {
+          GIFERRORMSG("error in reading DataBlock" );
+          return -1;
+     }
+
+     return count;
+}
+
+static int GetCode(IDirectFBImageProvider_GIF_data *data, int code_size, int flag)
+{
+     int i, j, ret;
+     unsigned char count;
+
+     if (flag) {
+          data->curbit = 0;
+          data->lastbit = 0;
+          data->done = false;
+          return 0;
+     }
+
+     if ( (data->curbit+code_size) >= data->lastbit) {
+          if (data->done) {
+               if (data->curbit >= data->lastbit) {
+                    GIFERRORMSG("ran off the end of my bits" );
+               }
+             return -1;
+          }
+          data->buf[0] = data->buf[data->last_byte-2];
+          data->buf[1] = data->buf[data->last_byte-1];
+
+          if ((count = GetDataBlock( data->buffer, &data->buf[2] )) == 0) {
+               data->done = true;
+          }
+
+          data->last_byte = 2 + count;
+          data->curbit = (data->curbit - data->lastbit) + 16;
+          data->lastbit = (2+count) * 8;
+     }
+
+     ret = 0;
+     for (i = data->curbit, j = 0; j < code_size; ++i, ++j) {
+          ret |= ((data->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
+     }
+     data->curbit += code_size;
+
+     return ret;
+}
+
+static int DoExtension( IDirectFBImageProvider_GIF_data *data, int label )
+{
+     unsigned char buf[256] = { 0 };
+     char *str;
+
+     switch (label) {
+          case 0x01:              /* Plain Text Extension */
+               str = "Plain Text Extension";
+               break;
+          case 0xff:              /* Application Extension */
+               str = "Application Extension";
+               break;
+          case 0xfe:              /* Comment Extension */
+               str = "Comment Extension";
+               while (GetDataBlock( data->buffer, (u8*) buf ) != 0) {
+                    if (showComment)
+                         GIFERRORMSG("gif comment: %s", buf );
+                    }
+               return false;
+          case 0xf9:              /* Graphic Control Extension */
+               str = "Graphic Control Extension";
+               (void) GetDataBlock( data->buffer, (u8*) buf );
+               data->disposal    = (buf[0] >> 2) & 0x7;
+               data->inputFlag   = (buf[0] >> 1) & 0x1;
+               data->delayTime   = LM_to_uint( buf[1], buf[2] );
+               if ((buf[0] & 0x1) != 0) {
+                    data->transparent = buf[3];
+               }
+               while (GetDataBlock( data->buffer, (u8*) buf ) != 0)
+                    ;
+               return false;
+          default:
+               str = (char*) buf;
+               snprintf(str, 256, "UNKNOWN (0x%02x)", label);
+          break;
+     }
+
+     if (verbose)
+          GIFERRORMSG("got a '%s' extension", str );
+
+     while (GetDataBlock( data->buffer, (u8*) buf ) != 0)
+          ;
+
+     return false;
+}
+
+static int LWZReadByte( IDirectFBImageProvider_GIF_data *data, int flag, int input_code_size )
+{
+     int code, incode;
+     int i;
+
+     if (flag) {
+          data->set_code_size = input_code_size;
+          data->code_size = data->set_code_size+1;
+          data->clear_code = 1 << data->set_code_size ;
+          data->end_code = data->clear_code + 1;
+          data->max_code_size = 2*data->clear_code;
+          data->max_code = data->clear_code+2;
+
+          GetCode(data, 0, true);
+
+          data->fresh = true;
+
+          for (i = 0; i < data->clear_code; ++i) {
+               data->table[0][i] = 0;
+               data->table[1][i] = i;
+          }
+          for (; i < (1<<MAX_LWZ_BITS); ++i) {
+               data->table[0][i] = data->table[1][0] = 0;
+          }
+          data->sp = data->stack;
+
+          return 0;
+     }
+     else if (data->fresh) {
+          data->fresh = false;
+          do {
+               data->firstcode = data->oldcode = GetCode( data, data->code_size, false );
+          } while (data->firstcode == data->clear_code);
+
+          return data->firstcode;
+     }
+
+     if (data->sp > data->stack) {
+          return *--data->sp;
+     }
+
+     while ((code = GetCode( data, data->code_size, false )) >= 0) {
+          if (code == data->clear_code) {
+               for (i = 0; i < data->clear_code; ++i) {
+                    data->table[0][i] = 0;
+                    data->table[1][i] = i;
+               }
+               for (; i < (1<<MAX_LWZ_BITS); ++i) {
+                    data->table[0][i] = data->table[1][i] = 0;
+               }
+               data->code_size = data->set_code_size+1;
+               data->max_code_size = 2*data->clear_code;
+               data->max_code = data->clear_code+2;
+               data->sp = data->stack;
+               data->firstcode = data->oldcode = GetCode( data, data->code_size, false );
+
+               return data->firstcode;
+          }
+          else if (code == data->end_code) {
+               int count;
+               u8 buf[260];
+
+               if (ZeroDataBlock) {
+                    return -2;
+               }
+
+               while ((count = GetDataBlock( data->buffer, buf )) > 0)
+                    ;
+
+               if (count != 0)
+                    GIFERRORMSG("missing EOD in data stream "
+                                "(common occurence)");
+
+               return -2;
+          }
+
+          incode = code;
+
+          if (code >= data->max_code) {
+               *data->sp++ = data->firstcode;
+               code = data->oldcode;
+          }
+
+          while (code >= data->clear_code) {
+               *data->sp++ = data->table[1][code];
+               if (code == data->table[0][code]) {
+                    GIFERRORMSG("circular table entry BIG ERROR");
+               }
+               code = data->table[0][code];
+          }
+
+          *data->sp++ = data->firstcode = data->table[1][code];
+
+          if ((code = data->max_code) <(1<<MAX_LWZ_BITS)) {
+               data->table[0][code] = data->oldcode;
+               data->table[1][code] = data->firstcode;
+               ++data->max_code;
+               if ((data->max_code >= data->max_code_size)
+                   && (data->max_code_size < (1<<MAX_LWZ_BITS)))
+               {
+                    data->max_code_size *= 2;
+                    ++data->code_size;
+               }
+          }
+
+          data->oldcode = incode;
+
+          if (data->sp > data->stack) {
+               return *--data->sp;
+          }
+     }
+     return code;
+}
+
+static int SortColors (const void *a, const void *b)
+{
+     return (*((const u8 *) a) - *((const u8 *) b));
+}
+
+/*  looks for a color that is not in the colormap and ideally not
+    even close to the colors used in the colormap  */
+static u32 FindColorKey( int n_colors, u8 cmap[3][MAXCOLORMAPSIZE] )
+{
+     u32   color = 0xFF000000;
+     u8    csort[MAXCOLORMAPSIZE];
+     int   i, j, index, d;
+
+     if (n_colors < 1)
+          return color;
+
+     D_ASSERT( n_colors <= MAXCOLORMAPSIZE );
+
+     for (i = 0; i < 3; i++) {
+          direct_memcpy( csort, cmap[i], n_colors );
+          qsort( csort, n_colors, 1, SortColors );
+
+          for (j = 1, index = 0, d = 0; j < n_colors; j++) {
+               if (csort[j] - csort[j-1] > d) {
+                    d = csort[j] - csort[j-1];
+                    index = j;
+               }
+          }
+          if ((csort[0] - 0x0) > d) {
+               d = csort[0] - 0x0;
+               index = n_colors;
+          }
+          if (0xFF - (csort[n_colors - 1]) > d) {
+               index = n_colors + 1;
+          }
+
+          if (index < n_colors)
+               csort[0] = csort[index] - (d/2);
+          else if (index == n_colors)
+               csort[0] = 0x0;
+          else
+               csort[0] = 0xFF;
+
+          color |= (csort[0] << (8 * (2 - i)));
+     }
+
+     return color;
+}
+
+static u32* ReadImage( IDirectFBImageProvider_GIF_data *data, int width, int height,
+                       u8 cmap[3][MAXCOLORMAPSIZE], u32 key_rgb,
+                       bool interlace, bool ignore )
+{
+     u8 c;
+     int v;
+     int xpos = 0, ypos = 0, pass = 0;
+     u32 *image;
+
+     /*
+     **  Initialize the decompression routines
+     */
+     if (! ReadOK( data->buffer, &c, 1 ))
+          GIFERRORMSG("EOF / read error on image data" );
+
+     if (LWZReadByte( data, true, c ) < 0)
+          GIFERRORMSG("error reading image" );
+
+     /*
+     **  If this is an "uninteresting picture" ignore it.
+     */
+     if (ignore) {
+          if (verbose)
+               GIFERRORMSG("skipping image..." );
+
+          while (LWZReadByte( data, false, c ) >= 0)
+               ;
+          return NULL;
+     }
+     
+     // FIXME: allocates four additional bytes because the scaling functions
+     //        in src/misc/gfx_util.c have an off-by-one bug which causes
+     //        segfaults on darwin/osx (not on linux)           
+     if ((image = D_MALLOC(width * height * 4 + 4)) == NULL) {
+          GIFERRORMSG("couldn't alloc space for image" );
+     }
+
+     if (verbose) {
+          GIFERRORMSG("reading %d by %d%s GIF image", width, height,
+                      interlace ? " interlaced" : "" );
+     }
+
+     while ((v = LWZReadByte( data, false, c )) >= 0 ) {
+          u32 *dst = image + (ypos * width + xpos);
+
+          if (v == data->transparent) {
+               *dst++ = key_rgb;
+          }
+          else {
+               *dst++ = (0xFF000000              |
+                         cmap[CM_RED][v]   << 16 |
+                         cmap[CM_GREEN][v] << 8  |
+                         cmap[CM_BLUE][v]);
+          }
+
+          ++xpos;
+          if (xpos == width) {
+               xpos = 0;
+               if (interlace) {
+                    switch (pass) {
+                         case 0:
+                         case 1:
+                              ypos += 8;
+                              break;
+                         case 2:
+                              ypos += 4;
+                              break;
+                         case 3:
+                              ypos += 2;
+                              break;
+                    }
+
+                    if (ypos >= height) {
+                         ++pass;
+                         switch (pass) {
+                              case 1:
+                                   ypos = 4;
+                                   break;
+                              case 2:
+                                   ypos = 2;
+                                   break;
+                              case 3:
+                                   ypos = 1;
+                              break;
+                              default:
+                                   goto fini;
+                         }
+                    }
+               }
+               else {
+                    ++ypos;
+               }
+          }
+          if (ypos >= height) {
+               break;
+          }
+     }
+
+fini:
+
+     if (LWZReadByte( data, false, c ) >= 0) {
+          GIFERRORMSG("too much input data, ignoring extra...");
+     }
+     return image;
+}
+
+
+static u32* ReadGIF( IDirectFBImageProvider_GIF_data *data, int imageNumber,
+                     int *width, int *height, bool *transparency,
+                     u32 *key_rgb, bool alpha, bool headeronly)
+{
+     u8    buf[16];
+     u8    c;
+     u8    localColorMap[3][MAXCOLORMAPSIZE];
+     u32   colorKey = 0;
+     bool  useGlobalColormap;
+     int   bitPixel;
+     int   imageCount = 0;
+     char  version[4];
+
+     if (! ReadOK( data->buffer, buf, 6 )) {
+          GIFERRORMSG("error reading magic number" );
+     }
+
+     if (strncmp( (char *)buf, "GIF", 3 ) != 0) {
+          GIFERRORMSG("not a GIF file" );
+     }
+
+     direct_snputs( version, (char *)buf + 3, 4 );
+
+     if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
+          GIFERRORMSG("bad version number, not '87a' or '89a'" );
+     }
+
+     if (! ReadOK(data->buffer,buf,7)) {
+          GIFERRORMSG("failed to read screen descriptor" );
+     }
+
+     data->Width           = LM_to_uint( buf[0], buf[1] );
+     data->Height          = LM_to_uint( buf[2], buf[3] );
+     data->BitPixel        = 2 << (buf[4] & 0x07);
+     data->ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
+     data->Background      = buf[5];
+     data->AspectRatio     = buf[6];
+
+     if (BitSet(buf[4], LOCALCOLORMAP)) {    /* Global Colormap */
+          if (ReadColorMap( data->buffer, data->BitPixel, data->ColorMap )) {
+               GIFERRORMSG("error reading global colormap" );
+          }
+     }
+
+     if (data->AspectRatio != 0 && data->AspectRatio != 49) {
+          /* float r = ( (float) data->AspectRatio + 15.0 ) / 64.0; */
+          GIFERRORMSG("warning - non-square pixels");
+     }
+
+     data->transparent = -1;
+     data->delayTime   = -1;
+     data->inputFlag   = -1;
+     data->disposal    = 0;
+
+     for (;;) {
+          if (! ReadOK( data->buffer, &c, 1)) {
+               GIFERRORMSG("EOF / read error on image data" );
+          }
+
+          if (c == ';') {         /* GIF terminator */
+               if (imageCount < imageNumber) {
+                    GIFERRORMSG("only %d image%s found in file",
+                                imageCount, imageCount>1?"s":"" );
+               }
+               return NULL;
+          }
+
+          if (c == '!') {         /* Extension */
+               if (! ReadOK( data->buffer, &c, 1)) {
+                    GIFERRORMSG("OF / read error on extention function code");
+               }
+               DoExtension( data, c );
+            continue;
+          }
+
+          if (c != ',') {         /* Not a valid start character */
+               GIFERRORMSG("bogus character 0x%02x, ignoring", (int) c );
+               continue;
+          }
+
+          ++imageCount;
+
+          if (! ReadOK( data->buffer, buf, 9 )) {
+               GIFERRORMSG("couldn't read left/top/width/height");
+          }
+
+          *width  = LM_to_uint( buf[4], buf[5] );
+          *height = LM_to_uint( buf[6], buf[7] );
+          *transparency = (data->transparent != -1);
+
+          if (headeronly && !(*transparency && key_rgb))
+               return NULL;
+
+          useGlobalColormap = ! BitSet( buf[8], LOCALCOLORMAP );
+
+          if (useGlobalColormap) {
+               if (*transparency && (key_rgb || !headeronly))
+                    colorKey = FindColorKey( data->BitPixel,
+                                             data->ColorMap );
+          }
+          else {
+               bitPixel = 2 << (buf[8] & 0x07);
+               if (ReadColorMap( data->buffer, bitPixel, localColorMap ))
+                    GIFERRORMSG("error reading local colormap" );
+
+               if (*transparency && (key_rgb || !headeronly))
+                    colorKey = FindColorKey( bitPixel, localColorMap );
+          }
+
+          if (key_rgb)
+               *key_rgb = colorKey;
+
+          if (headeronly)
+               return NULL;
+
+          if (alpha)
+               colorKey &= 0x00FFFFFF;
+
+          return ReadImage( data, *width, *height,
+                            (useGlobalColormap ?
+                             data->ColorMap : localColorMap), colorKey,
+                            BitSet( buf[8], INTERLACE ),
+                            imageCount != imageNumber);
+     }
+}
+
+static bool
+ReadOK( IDirectFBDataBuffer *buffer, void *data, unsigned int len )
+{
+     DFBResult ret;
+
+     ret = buffer->WaitForData( buffer, len );
+     if (ret) {
+          DirectFBError( "(DirectFB/ImageProvider_GIF) WaitForData failed", ret );
+          return false;
+     }
+
+     ret = buffer->GetData( buffer, len, data, NULL );
+     if (ret) {
+          DirectFBError( "(DirectFB/ImageProvider_GIF) GetData failed", ret );
+          return false;
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c
new file mode 100755
index 0000000..e67da17
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c
@@ -0,0 +1,640 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include <directfb.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <media/idirectfbimageprovider.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/surface.h>
+
+#include <misc/gfx_util.h>
+#include <misc/util.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <setjmp.h>
+#include <math.h>
+
+#undef HAVE_STDLIB_H
+#include <jpeglib.h>
+
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, JPEG )
+
+/*
+ * private data struct of IDirectFBImageProvider_JPEG
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBDataBuffer *buffer;
+
+     DIRenderCallback     render_callback;
+     void                *render_callback_context;
+
+     u32                 *image;
+     int                  width;
+     int                  height;
+
+     CoreDFB             *core;
+} IDirectFBImageProvider_JPEG_data;
+
+static DirectResult
+IDirectFBImageProvider_JPEG_AddRef  ( IDirectFBImageProvider *thiz );
+
+static DirectResult
+IDirectFBImageProvider_JPEG_Release ( IDirectFBImageProvider *thiz );
+
+static DFBResult
+IDirectFBImageProvider_JPEG_RenderTo( IDirectFBImageProvider *thiz,
+                                      IDirectFBSurface       *destination,
+                                      const DFBRectangle     *destination_rect );
+
+static DFBResult
+IDirectFBImageProvider_JPEG_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                               DIRenderCallback        callback,
+                                               void                   *context );
+
+static DFBResult
+IDirectFBImageProvider_JPEG_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                   DFBSurfaceDescription  *dsc);
+
+static DFBResult
+IDirectFBImageProvider_JPEG_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                 DFBImageDescription    *dsc );
+
+
+#define JPEG_PROG_BUF_SIZE    0x10000
+
+typedef struct {
+     struct jpeg_source_mgr  pub; /* public fields */
+
+     JOCTET                 *data;       /* start of buffer */
+
+     IDirectFBDataBuffer    *buffer;
+
+     int                     peekonly;
+     int                     peekoffset;
+} buffer_source_mgr;
+
+typedef buffer_source_mgr * buffer_src_ptr;
+
+static void
+buffer_init_source (j_decompress_ptr cinfo)
+{
+     buffer_src_ptr src          = (buffer_src_ptr) cinfo->src;
+     IDirectFBDataBuffer *buffer = src->buffer;
+
+     buffer->SeekTo( buffer, 0 ); /* ignore return value */
+}
+
+static boolean
+buffer_fill_input_buffer (j_decompress_ptr cinfo)
+{
+     DFBResult            ret;
+     unsigned int         nbytes = 0;
+     buffer_src_ptr       src    = (buffer_src_ptr) cinfo->src;
+     IDirectFBDataBuffer *buffer = src->buffer;
+
+     buffer->WaitForDataWithTimeout( buffer, JPEG_PROG_BUF_SIZE, 1, 0 );
+
+     if (src->peekonly) {
+          ret = buffer->PeekData( buffer, JPEG_PROG_BUF_SIZE,
+                                  src->peekoffset, src->data, &nbytes );
+          src->peekoffset += MAX( nbytes, 0 );
+     }
+     else {
+          ret = buffer->GetData( buffer, JPEG_PROG_BUF_SIZE, src->data, &nbytes );
+     }
+     
+     if (ret || nbytes <= 0) {
+          /* Insert a fake EOI marker */
+          src->data[0] = (JOCTET) 0xFF;
+          src->data[1] = (JOCTET) JPEG_EOI;
+          nbytes = 2;
+
+          if (ret && ret != DFB_EOF)
+               DirectFBError( "(DirectFB/ImageProvider_JPEG) GetData failed", ret );
+     }
+
+     src->pub.next_input_byte = src->data;
+     src->pub.bytes_in_buffer = nbytes;
+
+     return TRUE;
+}
+
+static void
+buffer_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+{
+     buffer_src_ptr src = (buffer_src_ptr) cinfo->src;
+
+     if (num_bytes > 0) {
+          while (num_bytes > (long) src->pub.bytes_in_buffer) {
+               num_bytes -= (long) src->pub.bytes_in_buffer;
+               (void)buffer_fill_input_buffer(cinfo);
+          }
+          src->pub.next_input_byte += (size_t) num_bytes;
+          src->pub.bytes_in_buffer -= (size_t) num_bytes;
+     }
+}
+
+static void
+buffer_term_source (j_decompress_ptr cinfo)
+{
+}
+
+static void
+jpeg_buffer_src (j_decompress_ptr cinfo, IDirectFBDataBuffer *buffer, int peekonly)
+{
+     buffer_src_ptr src;
+
+     cinfo->src = (struct jpeg_source_mgr *)
+                  cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+                                           sizeof (buffer_source_mgr));
+
+     src = (buffer_src_ptr) cinfo->src;
+
+     src->data = (JOCTET *)
+                  cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+                                           JPEG_PROG_BUF_SIZE * sizeof (JOCTET));
+
+     src->buffer = buffer;
+     src->peekonly = peekonly;
+     src->peekoffset = 0;
+
+     src->pub.init_source       = buffer_init_source;
+     src->pub.fill_input_buffer = buffer_fill_input_buffer;
+     src->pub.skip_input_data   = buffer_skip_input_data;
+     src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
+     src->pub.term_source       = buffer_term_source;
+     src->pub.bytes_in_buffer   = 0; /* forces fill_input_buffer on first read */
+     src->pub.next_input_byte   = NULL; /* until buffer loaded */
+}
+
+struct my_error_mgr {
+     struct jpeg_error_mgr pub;     /* "public" fields */
+     jmp_buf  setjmp_buffer;          /* for return to caller */
+};
+
+static void
+jpeglib_panic(j_common_ptr cinfo)
+{
+     struct my_error_mgr *myerr = (struct my_error_mgr*) cinfo->err;
+     longjmp(myerr->setjmp_buffer, 1);
+}
+
+static inline void
+copy_line32( u32 *argb, const u8 *rgb, int width )
+{
+     while (width--) {
+          *argb++ = 0xFF000000 | (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
+
+          rgb += 3;
+     }
+}
+
+static inline void
+copy_line_nv16( u16 *yy, u16 *cbcr, const u8 *src_ycbcr, int width )
+{
+     int x;
+
+     for (x=0; x<width/2; x++) {
+#ifdef WORDS_BIGENDIAN
+          yy[x] = (src_ycbcr[0] << 8) | src_ycbcr[3];
+
+          cbcr[x] = (((src_ycbcr[1] + src_ycbcr[4]) << 7) & 0xff00) |
+                     ((src_ycbcr[2] + src_ycbcr[5]) >> 1);
+#else
+          yy[x] = (src_ycbcr[3] << 8) | src_ycbcr[0];
+
+          cbcr[x] = (((src_ycbcr[2] + src_ycbcr[5]) << 7) & 0xff00) |
+                     ((src_ycbcr[1] + src_ycbcr[4]) >> 1);
+#endif
+
+          src_ycbcr += 6;
+     }
+
+     if (width & 1) {
+          u8 *y = (u8*) yy;
+
+          y[width-1] = src_ycbcr[0];
+
+#ifdef WORDS_BIGENDIAN
+          cbcr[x] = (src_ycbcr[1] << 8) | src_ycbcr[2];
+#else
+          cbcr[x] = (src_ycbcr[2] << 8) | src_ycbcr[1];
+#endif
+     }
+}
+
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx )
+{
+     if (ctx->header[0] == 0xff && ctx->header[1] == 0xd8) {
+          if (strncmp ((char*) ctx->header + 6, "JFIF", 4) == 0 ||
+              strncmp ((char*) ctx->header + 6, "Exif", 4) == 0)
+               return DFB_OK;
+
+          if (ctx->filename && strchr (ctx->filename, '.' ) &&
+             (strcasecmp ( strchr (ctx->filename, '.' ), ".jpg" ) == 0 ||
+              strcasecmp ( strchr (ctx->filename, '.' ), ".jpeg") == 0))
+               return DFB_OK;
+     }
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... )
+{
+     struct jpeg_decompress_struct cinfo;
+     struct my_error_mgr jerr;
+     
+     IDirectFBDataBuffer *buffer;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_JPEG)
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+
+     data->ref    = 1;
+     data->buffer = buffer;
+     data->core   = core;
+
+     buffer->AddRef( buffer );
+
+     cinfo.err = jpeg_std_error(&jerr.pub);
+     jerr.pub.error_exit = jpeglib_panic;
+
+     if (setjmp(jerr.setjmp_buffer)) {
+          D_ERROR( "ImageProvider/JPEG: Error while reading headers!\n" );
+
+          jpeg_destroy_decompress(&cinfo);
+          buffer->Release( buffer );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return DFB_FAILURE;
+     }
+
+     jpeg_create_decompress(&cinfo);
+     jpeg_buffer_src(&cinfo, buffer, 1);
+     jpeg_read_header(&cinfo, TRUE);
+     jpeg_start_decompress(&cinfo);
+     
+     data->width = cinfo.output_width;
+     data->height = cinfo.output_height;
+     
+     jpeg_abort_decompress(&cinfo);
+     jpeg_destroy_decompress(&cinfo);
+
+     thiz->AddRef = IDirectFBImageProvider_JPEG_AddRef;
+     thiz->Release = IDirectFBImageProvider_JPEG_Release;
+     thiz->RenderTo = IDirectFBImageProvider_JPEG_RenderTo;
+     thiz->SetRenderCallback = IDirectFBImageProvider_JPEG_SetRenderCallback;
+     thiz->GetImageDescription =IDirectFBImageProvider_JPEG_GetImageDescription;
+     thiz->GetSurfaceDescription =
+     IDirectFBImageProvider_JPEG_GetSurfaceDescription;
+
+     return DFB_OK;
+}
+
+static void
+IDirectFBImageProvider_JPEG_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_JPEG_data *data =
+                              (IDirectFBImageProvider_JPEG_data*)thiz->priv;
+
+     data->buffer->Release( data->buffer );
+
+     if (data->image)
+          D_FREE( data->image );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBImageProvider_JPEG_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_JPEG)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_JPEG_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_JPEG)
+
+     if (--data->ref == 0) {
+          IDirectFBImageProvider_JPEG_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_JPEG_RenderTo( IDirectFBImageProvider *thiz,
+                                      IDirectFBSurface       *destination,
+                                      const DFBRectangle     *dest_rect )
+{
+     DFBResult              ret;
+     bool                   direct = false;
+     DFBRegion              clip;
+     DFBRectangle           rect;
+     DFBSurfacePixelFormat  format;
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *dst_surface;
+     CoreSurfaceBufferLock  lock;
+     DIRenderCallbackResult cb_result = DIRCR_OK;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_JPEG)
+
+     dst_data = (IDirectFBSurface_data*) destination->priv;
+     if (!dst_data)
+          return DFB_DEAD;
+
+     dst_surface = dst_data->surface;
+     if (!dst_surface)
+          return DFB_DESTROYED;
+
+     ret = destination->GetPixelFormat( destination, &format );
+     if (ret)
+          return ret;
+
+     dfb_region_from_rectangle( &clip, &dst_data->area.current );
+
+     if (dest_rect) {
+          if (dest_rect->w < 1 || dest_rect->h < 1)
+               return DFB_INVARG;
+          
+          rect = *dest_rect;
+          rect.x += dst_data->area.wanted.x;
+          rect.y += dst_data->area.wanted.y;
+
+          if (!dfb_rectangle_region_intersects( &rect, &clip ))
+               return DFB_OK;
+     }
+     else {
+          rect = dst_data->area.wanted;
+     }
+
+     ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+     if (ret)
+          return ret;
+
+     /* actual loading and rendering */
+     if (!data->image) {
+          struct jpeg_decompress_struct cinfo;
+          struct my_error_mgr jerr;
+          JSAMPARRAY buffer;      /* Output row buffer */
+          int row_stride;         /* physical row width in output buffer */
+          u32 *row_ptr;
+          int y = 0;
+          int uv_offset = 0;
+
+          cinfo.err = jpeg_std_error(&jerr.pub);
+          jerr.pub.error_exit = jpeglib_panic;
+
+          if (setjmp(jerr.setjmp_buffer)) {
+               D_ERROR( "ImageProvider/JPEG: Error during decoding!\n" );
+
+               jpeg_destroy_decompress(&cinfo);
+
+               if (data->image) {
+                    dfb_scale_linear_32( data->image, data->width, data->height,
+                                         lock.addr, lock.pitch, &rect, dst_surface, &clip );
+                    dfb_surface_unlock_buffer( dst_surface, &lock );
+                    if (data->render_callback) {
+                         DFBRectangle r = { 0, 0, data->width, data->height };
+
+                         if (data->render_callback( &r, data->render_callback_context ) != DIRCR_OK)
+                              return DFB_INTERRUPTED;
+                    }
+
+                    return DFB_INCOMPLETE;
+               }
+               else
+                    dfb_surface_unlock_buffer( dst_surface, &lock );
+
+               return DFB_FAILURE;
+          }
+
+          jpeg_create_decompress(&cinfo);
+          jpeg_buffer_src(&cinfo, data->buffer, 0);
+          jpeg_read_header(&cinfo, TRUE);
+          jpeg_calc_output_dimensions(&cinfo);
+
+          if (cinfo.output_width == rect.w && cinfo.output_height == rect.h)
+               direct = true;
+
+          cinfo.output_components = 3;
+
+          switch (dst_surface->config.format) {
+               case DSPF_NV16:
+                    uv_offset = dst_surface->config.size.h * lock.pitch;
+
+                    if (direct && !rect.x && !rect.y) {
+                         D_INFO( "JPEG: Using YCbCr color space directly! (%dx%d)\n",
+                                 cinfo.output_width, cinfo.output_height );
+                         cinfo.out_color_space = JCS_YCbCr;
+                         break;
+                    }
+                    D_INFO( "JPEG: Going through RGB color space! (%dx%d -> %dx%d @%d,%d)\n",
+                            cinfo.output_width, cinfo.output_height, rect.w, rect.h, rect.x, rect.y );
+               
+               default:
+                    cinfo.out_color_space = JCS_RGB;
+                    break;
+          }
+
+          jpeg_start_decompress(&cinfo);
+
+          data->width = cinfo.output_width;
+          data->height = cinfo.output_height;
+
+          row_stride = cinfo.output_width * 3;
+
+          buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo,
+                                              JPOOL_IMAGE, row_stride, 1);
+
+          data->image = D_CALLOC( data->height, data->width * 4 );
+          if (!data->image) {
+               dfb_surface_unlock_buffer( dst_surface, &lock );
+               return D_OOM();
+          }
+          row_ptr = data->image;
+
+          while (cinfo.output_scanline < cinfo.output_height && cb_result == DIRCR_OK) {
+               jpeg_read_scanlines(&cinfo, buffer, 1);
+
+               switch (dst_surface->config.format) {
+                    case DSPF_NV16:
+                         if (direct) {
+                              copy_line_nv16( lock.addr, lock.addr + uv_offset, *buffer, rect.w );
+
+                              lock.addr += lock.pitch;
+
+                              if (data->render_callback) {
+                                   DFBRectangle r = { 0, y, data->width, 1 };
+
+                                   cb_result = data->render_callback( &r, 
+                                                                      data->render_callback_context );
+                              }
+                              break;
+                         }
+
+                    default:
+                         copy_line32( row_ptr, *buffer, data->width);
+
+                         if (direct) {
+                              DFBRectangle r = { rect.x, rect.y+y, rect.w, 1 };
+                              dfb_copy_buffer_32( row_ptr, lock.addr, lock.pitch,
+                                                  &r, dst_surface, &clip );
+                              if (data->render_callback) {
+                                   r = (DFBRectangle){ 0, y, data->width, 1 };
+                                   cb_result = data->render_callback( &r, 
+                                                                      data->render_callback_context );
+                              }
+                         }
+                         break;
+               }
+
+               row_ptr += data->width;
+               y++;
+          }
+
+          if (!direct) {
+               dfb_scale_linear_32( data->image, data->width, data->height,
+                                    lock.addr, lock.pitch, &rect, dst_surface, &clip );
+               if (data->render_callback) {
+                    DFBRectangle r = { 0, 0, data->width, data->height };
+                    cb_result = data->render_callback( &r, data->render_callback_context );
+               }
+          }
+
+          if (cb_result != DIRCR_OK) {
+               jpeg_abort_decompress(&cinfo);
+               D_FREE( data->image );
+               data->image = NULL;
+          }
+          else {
+               jpeg_finish_decompress(&cinfo);
+          }
+          jpeg_destroy_decompress(&cinfo);
+     }
+     else {
+          dfb_scale_linear_32( data->image, data->width, data->height,
+                               lock.addr, lock.pitch, &rect, dst_surface, &clip );
+          if (data->render_callback) {
+               DFBRectangle r = { 0, 0, data->width, data->height };
+               data->render_callback( &r, data->render_callback_context );
+          }
+     }
+     
+     dfb_surface_unlock_buffer( dst_surface, &lock );
+
+     if (cb_result != DIRCR_OK)
+         return DFB_INTERRUPTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_JPEG_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                               DIRenderCallback        callback,
+                                               void                   *context )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_JPEG)
+
+     data->render_callback         = callback;
+     data->render_callback_context = context;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_JPEG_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                   DFBSurfaceDescription  *dsc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_JPEG)
+     
+     dsc->flags  = DSDESC_WIDTH |  DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     dsc->height = data->height;
+     dsc->width  = data->width;
+     dsc->pixelformat = dfb_primary_layer_pixelformat();
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_JPEG_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                 DFBImageDescription    *dsc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_JPEG)
+
+     if (!dsc)
+          return DFB_INVARG;
+
+     dsc->caps = DICAPS_NONE;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c
new file mode 100755
index 0000000..3e7769d
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c
@@ -0,0 +1,868 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <png.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include <directfb.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <media/idirectfbimageprovider.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+
+#include <misc/gfx_util.h>
+#include <misc/util.h>
+
+#include <gfx/clip.h>
+#include <gfx/convert.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include "config.h"
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, PNG )
+
+
+enum {
+     STAGE_ABORT = -2,
+     STAGE_ERROR = -1,
+     STAGE_START =  0,
+     STAGE_INFO,
+     STAGE_IMAGE,
+     STAGE_END
+};
+
+/*
+ * private data struct of IDirectFBImageProvider_PNG
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+     IDirectFBDataBuffer *buffer;
+
+     int                  stage;
+     int                  rows;
+
+     png_structp          png_ptr;
+     png_infop            info_ptr;
+
+     png_uint_32          width;
+     png_uint_32          height;
+     int                  bpp;
+     int                  color_type;
+     png_uint_32          color_key;
+     bool                 color_keyed;
+
+     void                *image;
+     int                  pitch;
+     u32                  palette[256];
+     DFBColor             colors[256];
+
+     DIRenderCallback     render_callback;
+     void                *render_callback_context;
+
+     CoreDFB             *core;
+} IDirectFBImageProvider_PNG_data;
+
+static DirectResult
+IDirectFBImageProvider_PNG_AddRef  ( IDirectFBImageProvider *thiz );
+
+static DirectResult
+IDirectFBImageProvider_PNG_Release ( IDirectFBImageProvider *thiz );
+
+static DFBResult
+IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
+                                     IDirectFBSurface       *destination,
+                                     const DFBRectangle     *destination_rect );
+
+static DFBResult
+IDirectFBImageProvider_PNG_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                              DIRenderCallback        callback,
+                                              void                   *context );
+
+static DFBResult
+IDirectFBImageProvider_PNG_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                  DFBSurfaceDescription  *dsc );
+
+static DFBResult
+IDirectFBImageProvider_PNG_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                DFBImageDescription    *dsc );
+
+/* Called at the start of the progressive load, once we have image info */
+static void
+png_info_callback (png_structp png_read_ptr,
+                   png_infop   png_info_ptr);
+
+/* Called for each row; note that you will get duplicate row numbers
+   for interlaced PNGs */
+static void
+png_row_callback  (png_structp png_read_ptr,
+                   png_bytep   new_row,
+                   png_uint_32 row_num,
+                   int         pass_num);
+
+/* Called after reading the entire image */
+static void
+png_end_callback  (png_structp png_read_ptr,
+                   png_infop   png_info_ptr);
+
+/* Pipes data into libpng until stage is different from the one specified. */
+static DFBResult
+push_data_until_stage (IDirectFBImageProvider_PNG_data *data,
+                       int                              stage,
+                       int                              buffer_size);
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Probe( IDirectFBImageProvider_ProbeContext *ctx )
+{
+     if (png_check_sig( ctx->header, 8 ))
+          return DFB_OK;
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           ... )
+{
+     DFBResult ret = DFB_FAILURE;
+
+     IDirectFBDataBuffer *buffer;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_PNG)
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+
+     data->ref    = 1;
+     data->buffer = buffer;
+     data->core   = core;
+
+     /* Increase the data buffer reference counter. */
+     buffer->AddRef( buffer );
+
+     /* Create the PNG read handle. */
+     data->png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
+                                             NULL, NULL, NULL );
+     if (!data->png_ptr)
+          goto error;
+
+     if (setjmp( data->png_ptr->jmpbuf )) {
+          D_ERROR( "ImageProvider/PNG: Error reading header!\n" );
+          goto error;
+     }
+
+     /* Create the PNG info handle. */
+     data->info_ptr = png_create_info_struct( data->png_ptr );
+     if (!data->info_ptr)
+          goto error;
+
+     /* Setup progressive image loading. */
+     png_set_progressive_read_fn( data->png_ptr, data,
+                                  png_info_callback,
+                                  png_row_callback,
+                                  png_end_callback );
+
+
+     /* Read until info callback is called. */
+     ret = push_data_until_stage( data, STAGE_INFO, 64 );
+     if (ret)
+          goto error;
+
+     thiz->AddRef                = IDirectFBImageProvider_PNG_AddRef;
+     thiz->Release               = IDirectFBImageProvider_PNG_Release;
+     thiz->RenderTo              = IDirectFBImageProvider_PNG_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_PNG_SetRenderCallback;
+     thiz->GetImageDescription   = IDirectFBImageProvider_PNG_GetImageDescription;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_PNG_GetSurfaceDescription;
+
+     return DFB_OK;
+
+error:
+     if (data->png_ptr)
+          png_destroy_read_struct( &data->png_ptr, &data->info_ptr, NULL );
+
+     buffer->Release( buffer );
+
+     if (data->image)
+          D_FREE( data->image );
+
+     DIRECT_DEALLOCATE_INTERFACE(thiz);
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBImageProvider_PNG_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_PNG_data *data =
+                              (IDirectFBImageProvider_PNG_data*)thiz->priv;
+
+     png_destroy_read_struct( &data->png_ptr, &data->info_ptr, NULL );
+
+     /* Decrease the data buffer reference counter. */
+     data->buffer->Release( data->buffer );
+
+     /* Deallocate image data. */
+     if (data->image)
+          D_FREE( data->image );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBImageProvider_PNG_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_PNG)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_PNG_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_PNG)
+
+     if (--data->ref == 0) {
+          IDirectFBImageProvider_PNG_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+IDirectFBImageProvider_PNG_RenderTo( IDirectFBImageProvider *thiz,
+                                     IDirectFBSurface       *destination,
+                                     const DFBRectangle     *dest_rect )
+{
+     DFBResult              ret = DFB_OK;
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *dst_surface;
+     DFBRegion              clip;
+     DFBRectangle           rect;
+     png_infop              info;
+     int                    x, y;
+     DFBRectangle           clipped;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_PNG)
+
+     info = data->info_ptr;
+
+     dst_data = (IDirectFBSurface_data*) destination->priv;
+     if (!dst_data)
+          return DFB_DEAD;
+
+     dst_surface = dst_data->surface;
+     if (!dst_surface)
+          return DFB_DESTROYED;
+
+     dfb_region_from_rectangle( &clip, &dst_data->area.current );
+
+     if (dest_rect) {
+          if (dest_rect->w < 1 || dest_rect->h < 1)
+               return DFB_INVARG;
+          rect = *dest_rect;
+          rect.x += dst_data->area.wanted.x;
+          rect.y += dst_data->area.wanted.y;
+     }
+     else {
+          rect = dst_data->area.wanted;
+     }
+
+     if (setjmp( data->png_ptr->jmpbuf )) {
+          D_ERROR( "ImageProvider/PNG: Error during decoding!\n" );
+
+          if (data->stage < STAGE_IMAGE)
+               return DFB_FAILURE;
+
+          data->stage = STAGE_ERROR;
+     }
+
+     /* Read until image is completely decoded. */
+     if (data->stage != STAGE_ERROR) {
+          ret = push_data_until_stage( data, STAGE_END, 16384 );
+          if (ret)
+               return ret;
+     }
+
+     clipped = rect;
+
+     if (!dfb_rectangle_intersect_by_region( &clipped, &clip ))
+          return DFB_INVAREA;
+
+     /* actual rendering */
+     if (rect.w == data->width && rect.h == data->height &&
+         (data->color_type == PNG_COLOR_TYPE_RGB || data->color_type == PNG_COLOR_TYPE_RGBA) &&
+         (dst_surface->config.format == DSPF_RGB32 || dst_surface->config.format == DSPF_ARGB))
+     {
+          ret = dfb_surface_write_buffer( dst_surface, CSBR_BACK,
+                                          data->image +
+                                             (clipped.x - rect.x) * 4 +
+                                             (clipped.y - rect.y) * data->width * 4,
+                                          data->width * 4, &clipped );
+     }
+     else {
+          CoreSurfaceBufferLock lock;
+
+          ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+          if (ret)
+               return ret;
+
+          switch (data->color_type) {
+               case PNG_COLOR_TYPE_PALETTE:
+                    if (dst_surface->config.format == DSPF_LUT8 && data->info_ptr->bit_depth == 8) {
+                         /*
+                          * Special indexed PNG to LUT8 loading.
+                          */
+
+                         /* FIXME: Limitation for LUT8 is to load complete surface only. */
+                         dfb_clip_rectangle( &clip, &rect );
+                         if (rect.x == 0 && rect.y == 0 &&
+                             rect.w == dst_surface->config.size.w  &&
+                             rect.h == dst_surface->config.size.h &&
+                             rect.w == data->width         &&
+                             rect.h == data->height)
+                         {
+                              for (y=0; y<data->height; y++)
+                                   direct_memcpy( lock.addr + lock.pitch * y,
+                                                  data->image + data->pitch * y,
+                                                  data->width );
+
+                              break;
+                         }
+                    }
+                    /* fall through */
+
+               case PNG_COLOR_TYPE_GRAY: {
+                    /*
+                     * Convert to ARGB and use generic loading code.
+                     */
+
+                    // FIXME: allocates four additional bytes because the scaling functions
+                    //        in src/misc/gfx_util.c have an off-by-one bug which causes
+                    //        segfaults on darwin/osx (not on linux)                
+                    int size = data->width * data->height * 4 + 4;
+
+                    /* allocate image data */
+                    void *image_argb = D_MALLOC( size );
+
+                    if (!image_argb) {
+                         D_ERROR( "DirectFB/ImageProvider_PNG: Could not "
+                                  "allocate %d bytes of system memory!\n", size );
+                         ret = DFB_NOSYSTEMMEMORY;
+                    }
+                    else {
+                         if (data->color_type == PNG_COLOR_TYPE_GRAY) {
+                              int num = 1 << data->info_ptr->bit_depth;
+
+                              for (x=0; x<num; x++) {
+                                   int value = x * 255 / (num - 1);
+
+                                   data->palette[x] = 0xff000000 | (value << 16) | (value << 8) | value;
+                              }
+                         }
+
+                         switch (data->info_ptr->bit_depth) {
+                              case 8:
+                                   for (y=0; y<data->height; y++) {
+                                        u8  *S = data->image + data->pitch * y;
+                                        u32 *D = image_argb  + data->width * y * 4;
+
+                                        for (x=0; x<data->width; x++)
+                                             D[x] = data->palette[ S[x] ];
+                                   }
+                                   break;
+
+                              case 4:
+                                   for (y=0; y<data->height; y++) {
+                                        u8  *S = data->image + data->pitch * y;
+                                        u32 *D = image_argb  + data->width * y * 4;
+
+                                        for (x=0; x<data->width; x++) {
+                                             if (x & 1)
+                                                  D[x] = data->palette[ S[x>>1] & 0xf ];
+                                             else
+                                                  D[x] = data->palette[ S[x>>1] >> 4 ];
+                                        }
+                                   }
+                                   break;
+
+                              case 2:
+                                   for (y=0; y<data->height; y++) {
+                                        int  n = 6;
+                                        u8  *S = data->image + data->pitch * y;
+                                        u32 *D = image_argb  + data->width * y * 4;
+
+                                        for (x=0; x<data->width; x++) {
+                                             D[x] = data->palette[ (S[x>>2] >> n) & 3 ];
+
+                                             n = (n ? n - 2 : 6);
+                                        }
+                                   }
+                                   break;
+
+                              case 1:
+                                   for (y=0; y<data->height; y++) {
+                                        int  n = 7;
+                                        u8  *S = data->image + data->pitch * y;
+                                        u32 *D = image_argb  + data->width * y * 4;
+
+                                        for (x=0; x<data->width; x++) {
+                                             D[x] = data->palette[ (S[x>>3] >> n) & 1 ];
+
+                                             n = (n ? n - 1 : 7);
+                                        }
+                                   }
+                                   break;
+
+                              default:
+                                   D_ERROR( "ImageProvider/PNG: Unsupported indexed bit depth %d!\n",
+                                            data->info_ptr->bit_depth );
+                         }
+
+                         dfb_scale_linear_32( image_argb, data->width, data->height,
+                                              lock.addr, lock.pitch, &rect, dst_surface, &clip );
+ 
+                         D_FREE( image_argb );
+                    }
+                    break;
+               }
+               default:
+                    /*
+                     * Generic loading code.
+                     */
+                    dfb_scale_linear_32( data->image, data->width, data->height,
+                                         lock.addr, lock.pitch, &rect, dst_surface, &clip );
+                    break;
+          }
+
+          dfb_surface_unlock_buffer( dst_surface, &lock );
+     }
+
+     if (data->stage != STAGE_END)
+          ret = DFB_INCOMPLETE;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBImageProvider_PNG_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                              DIRenderCallback        callback,
+                                              void                   *context )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_PNG)
+
+     data->render_callback         = callback;
+     data->render_callback_context = context;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_PNG_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                  DFBSurfaceDescription *dsc )
+{
+     DFBSurfacePixelFormat primary_format = dfb_primary_layer_pixelformat();
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBImageProvider_PNG)
+
+     dsc->flags  = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     dsc->width  = data->width;
+     dsc->height = data->height;
+
+     if (data->color_type & PNG_COLOR_MASK_ALPHA)
+          dsc->pixelformat = DFB_PIXELFORMAT_HAS_ALPHA(primary_format) ? primary_format : DSPF_ARGB;
+     else
+          dsc->pixelformat = primary_format;
+
+     if (data->color_type == PNG_COLOR_TYPE_PALETTE) {
+          dsc->flags  |= DSDESC_PALETTE;
+
+          dsc->palette.entries = data->colors;  /* FIXME */
+          dsc->palette.size    = 256;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_PNG_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                DFBImageDescription    *dsc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_PNG)
+
+     if (!dsc)
+          return DFB_INVARG;
+
+     dsc->caps = DICAPS_NONE;
+
+     if (data->color_type & PNG_COLOR_MASK_ALPHA)
+          dsc->caps |= DICAPS_ALPHACHANNEL;
+
+     if (data->color_keyed) {
+          dsc->caps |= DICAPS_COLORKEY;
+
+          dsc->colorkey_r = (data->color_key & 0xff0000) >> 16;
+          dsc->colorkey_g = (data->color_key & 0x00ff00) >>  8;
+          dsc->colorkey_b = (data->color_key & 0x0000ff);
+     }
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+#define MAXCOLORMAPSIZE 256
+
+static int SortColors (const void *a, const void *b)
+{
+     return (*((const u8 *) a) - *((const u8 *) b));
+}
+
+/*  looks for a color that is not in the colormap and ideally not
+    even close to the colors used in the colormap  */
+static u32 FindColorKey( int n_colors, u8 *cmap )
+{
+     u32   color = 0xFF000000;
+     u8    csort[n_colors];
+     int   i, j, index, d;
+
+     if (n_colors < 1)
+          return color;
+
+     for (i = 0; i < 3; i++) {
+          direct_memcpy( csort, cmap + (n_colors * i), n_colors );
+          qsort( csort, n_colors, 1, SortColors );
+
+          for (j = 1, index = 0, d = 0; j < n_colors; j++) {
+               if (csort[j] - csort[j-1] > d) {
+                    d = csort[j] - csort[j-1];
+                    index = j;
+               }
+          }
+          if ((csort[0] - 0x0) > d) {
+               d = csort[0] - 0x0;
+               index = n_colors;
+          }
+          if (0xFF - (csort[n_colors - 1]) > d) {
+               index = n_colors + 1;
+          }
+
+          if (index < n_colors)
+               csort[0] = csort[index] - (d/2);
+          else if (index == n_colors)
+               csort[0] = 0x0;
+          else
+               csort[0] = 0xFF;
+
+          color |= (csort[0] << (8 * (2 - i)));
+     }
+
+     return color;
+}
+
+/* Called at the start of the progressive load, once we have image info */
+static void
+png_info_callback( png_structp png_read_ptr,
+                   png_infop   png_info_ptr )
+{
+     int                              i;
+     IDirectFBImageProvider_PNG_data *data;
+
+     data = png_get_progressive_ptr( png_read_ptr );
+
+     /* error stage? */
+     if (data->stage < 0)
+          return;
+
+     /* set info stage */
+     data->stage = STAGE_INFO;
+
+     png_get_IHDR( data->png_ptr, data->info_ptr,
+                   &data->width, &data->height, &data->bpp, &data->color_type,
+                   NULL, NULL, NULL );
+
+     if (png_get_valid( data->png_ptr, data->info_ptr, PNG_INFO_tRNS )) {
+          data->color_keyed = true;
+
+          /* generate color key based on palette... */
+          if (data->color_type == PNG_COLOR_TYPE_PALETTE) {
+               u32        key;
+               png_colorp palette    = data->info_ptr->palette;
+               png_bytep  trans      = data->info_ptr->trans;
+               int        num_colors = MIN( MAXCOLORMAPSIZE,
+                                            data->info_ptr->num_palette );
+               u8         cmap[3][num_colors];
+
+               for (i=0; i<num_colors; i++) {
+                    cmap[0][i] = palette[i].red;
+                    cmap[1][i] = palette[i].green;
+                    cmap[2][i] = palette[i].blue;
+               }
+
+               key = FindColorKey( num_colors, &cmap[0][0] );
+
+               for (i=0; i<data->info_ptr->num_trans; i++) {
+                    if (!trans[i]) {
+                         palette[i].red   = (key & 0xff0000) >> 16;
+                         palette[i].green = (key & 0x00ff00) >>  8;
+                         palette[i].blue  = (key & 0x0000ff);
+                    }
+               }
+
+               data->color_key = key;
+          }
+          else {
+               /* ...or based on trans rgb value */
+               png_color_16p trans = &data->info_ptr->trans_values;
+
+               data->color_key = (((trans->red & 0xff00) << 8) |
+                                  ((trans->green & 0xff00)) |
+                                  ((trans->blue & 0xff00) >> 8));
+          }
+     }
+
+     switch (data->color_type) {
+          case PNG_COLOR_TYPE_PALETTE: {
+               png_colorp palette    = data->info_ptr->palette;
+               png_bytep  trans      = data->info_ptr->trans;
+               int        num_trans  = data->info_ptr->num_trans;
+               int        num_colors = MIN( MAXCOLORMAPSIZE, data->info_ptr->num_palette );
+
+               for (i=0; i<num_colors; i++) {
+                    data->colors[i].a = (i < num_trans) ? trans[i] : 0xff;
+                    data->colors[i].r = palette[i].red;
+                    data->colors[i].g = palette[i].green;
+                    data->colors[i].b = palette[i].blue;
+
+                    data->palette[i] = PIXEL_ARGB( data->colors[i].a,
+                                                   data->colors[i].r,
+                                                   data->colors[i].g,
+                                                   data->colors[i].b );
+               }
+
+               data->pitch = (data->width + 7) & ~7;
+               break;
+          }
+
+          case PNG_COLOR_TYPE_GRAY:
+               data->pitch = data->width;
+
+               if (data->bpp == 16)
+                    png_set_strip_16( data->png_ptr );
+
+               break;
+
+          case PNG_COLOR_TYPE_GRAY_ALPHA:
+               png_set_gray_to_rgb( data->png_ptr );
+               /* fall through */
+
+          default:
+               data->pitch = data->width * 4;
+
+               if (data->bpp == 16)
+                    png_set_strip_16( data->png_ptr );
+
+#ifdef WORDS_BIGENDIAN
+               if (!(data->color_type & PNG_COLOR_MASK_ALPHA))
+                    png_set_filler( data->png_ptr, 0xFF, PNG_FILLER_BEFORE );
+
+               png_set_swap_alpha( data->png_ptr );
+#else
+               if (!(data->color_type & PNG_COLOR_MASK_ALPHA))
+                    png_set_filler( data->png_ptr, 0xFF, PNG_FILLER_AFTER );
+
+               png_set_bgr( data->png_ptr );
+#endif
+               break;
+     }
+
+     png_set_interlace_handling( data->png_ptr );
+
+     /* Update the info to reflect our transformations */
+     png_read_update_info( data->png_ptr, data->info_ptr );
+}
+
+/* Called for each row; note that you will get duplicate row numbers
+   for interlaced PNGs */
+static void
+png_row_callback( png_structp png_read_ptr,
+                  png_bytep   new_row,
+                  png_uint_32 row_num,
+                  int         pass_num )
+{
+     IDirectFBImageProvider_PNG_data *data;
+
+     data = png_get_progressive_ptr( png_read_ptr );
+
+     /* error stage? */
+     if (data->stage < 0)
+          return;
+
+     /* set image decoding stage */
+     data->stage = STAGE_IMAGE;
+
+     /* check image data pointer */
+     if (!data->image) {
+          // FIXME: allocates four additional bytes because the scaling functions
+          //        in src/misc/gfx_util.c have an off-by-one bug which causes
+          //        segfaults on darwin/osx (not on linux)                
+          int size = data->pitch * data->height + 4;
+
+          /* allocate image data */
+          data->image = D_CALLOC( 1, size );
+          if (!data->image) {
+               D_ERROR("DirectFB/ImageProvider_PNG: Could not "
+                        "allocate %d bytes of system memory!\n", size);
+
+               /* set error stage */
+               data->stage = STAGE_ERROR;
+
+               return;
+          }
+     }
+
+     /* write to image data */
+     png_progressive_combine_row( data->png_ptr, (png_bytep) (data->image +
+                                  row_num * data->pitch), new_row );
+
+     /* increase row counter, FIXME: interlaced? */
+     data->rows++;
+
+     if (data->render_callback) {
+          DIRenderCallbackResult r;
+          DFBRectangle rect = { 0, row_num, data->width, 1 };
+
+          r = data->render_callback( &rect, data->render_callback_context );
+          if (r != DIRCR_OK)
+              data->stage = STAGE_ABORT;
+     }
+}
+
+/* Called after reading the entire image */
+static void
+png_end_callback   (png_structp png_read_ptr,
+                    png_infop   png_info_ptr)
+{
+     IDirectFBImageProvider_PNG_data *data;
+
+     data = png_get_progressive_ptr( png_read_ptr );
+
+     /* error stage? */
+     if (data->stage < 0)
+          return;
+
+     /* set end stage */
+     data->stage = STAGE_END;
+}
+
+/* Pipes data into libpng until stage is different from the one specified. */
+static DFBResult
+push_data_until_stage (IDirectFBImageProvider_PNG_data *data,
+                       int                              stage,
+                       int                              buffer_size)
+{
+     DFBResult            ret;
+     IDirectFBDataBuffer *buffer = data->buffer;
+
+     while (data->stage < stage) {
+          unsigned int  len;
+          unsigned char buf[buffer_size];
+
+          if (data->stage < 0)
+               return DFB_FAILURE;
+
+          while (buffer->HasData( buffer ) == DFB_OK) {
+               D_DEBUG( "ImageProvider/PNG: Retrieving data (up to %d bytes)...\n", buffer_size );
+
+               ret = buffer->GetData( buffer, buffer_size, buf, &len );
+               if (ret)
+                    return ret;
+
+               D_DEBUG( "ImageProvider/PNG: Got %d bytes...\n", len );
+
+               png_process_data( data->png_ptr, data->info_ptr, buf, len );
+
+               D_DEBUG( "ImageProvider/PNG: ...processed %d bytes.\n", len );
+
+               /* are we there yet? */
+               if (data->stage < 0 || data->stage >= stage) {
+                   switch (data->stage) {
+                        case STAGE_ABORT: return DFB_INTERRUPTED;
+                        case STAGE_ERROR: return DFB_FAILURE;
+                        default:          return DFB_OK;
+                   }
+               }
+          }
+
+          D_DEBUG( "ImageProvider/PNG: Waiting for data...\n" );
+
+          if (buffer->WaitForData( buffer, 1 ) == DFB_EOF)
+               return DFB_FAILURE;
+     }
+
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.am b/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.am
new file mode 100755
index 0000000..affe5ef
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.am
@@ -0,0 +1,57 @@
+## Makefile.am for DirectFB/interfaces/IDirectFBVideoProvider
+
+idirectfbvideoproviderdir = $(MODULEDIR)/interfaces/IDirectFBVideoProvider
+
+EXTRA_DIST = videodev.h videodev2.h
+
+if V4L_PROVIDER
+V4L_PROVIDER_LTLIB = libidirectfbvideoprovider_v4l.la
+else
+V4L_PROVIDER_LTLIB =
+endif
+
+if GIF_PROVIDER
+GIF_PROVIDER_LTLIB = libidirectfbvideoprovider_gif.la
+else
+GIF_PROVIDER_LTLIB =
+endif
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+
+idirectfbvideoprovider_LTLIBRARIES =	\
+	$(GIF_PROVIDER_LTLIB)	\
+	$(V4L_PROVIDER_LTLIB)	
+
+if BUILD_STATIC
+idirectfbvideoprovider_DATA = $(idirectfbvideoprovider_LTLIBRARIES:.la=.o)
+endif
+
+
+libidirectfbvideoprovider_v4l_la_SOURCES = idirectfbvideoprovider_v4l.c
+
+libidirectfbvideoprovider_v4l_la_LDFLAGS = -avoid-version -module
+
+libidirectfbvideoprovider_v4l_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+libidirectfbvideoprovider_gif_la_SOURCES = idirectfbvideoprovider_gif.c
+
+libidirectfbvideoprovider_gif_la_LDFLAGS = -avoid-version -module
+
+libidirectfbvideoprovider_gif_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.in b/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.in
new file mode 100755
index 0000000..33f8f5e
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/Makefile.in
@@ -0,0 +1,635 @@
+# 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 = interfaces/IDirectFBVideoProvider
+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)$(idirectfbvideoproviderdir)" \
+	"$(DESTDIR)$(idirectfbvideoproviderdir)"
+idirectfbvideoproviderLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(idirectfbvideoprovider_LTLIBRARIES)
+libidirectfbvideoprovider_gif_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbvideoprovider_gif_la_OBJECTS =  \
+	idirectfbvideoprovider_gif.lo
+libidirectfbvideoprovider_gif_la_OBJECTS =  \
+	$(am_libidirectfbvideoprovider_gif_la_OBJECTS)
+libidirectfbvideoprovider_gif_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbvideoprovider_gif_la_LDFLAGS) $(LDFLAGS) -o $@
+@GIF_PROVIDER_TRUE@am_libidirectfbvideoprovider_gif_la_rpath = -rpath \
+@GIF_PROVIDER_TRUE@	$(idirectfbvideoproviderdir)
+libidirectfbvideoprovider_v4l_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libidirectfbvideoprovider_v4l_la_OBJECTS =  \
+	idirectfbvideoprovider_v4l.lo
+libidirectfbvideoprovider_v4l_la_OBJECTS =  \
+	$(am_libidirectfbvideoprovider_v4l_la_OBJECTS)
+libidirectfbvideoprovider_v4l_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbvideoprovider_v4l_la_LDFLAGS) $(LDFLAGS) -o $@
+@V4L_PROVIDER_TRUE@am_libidirectfbvideoprovider_v4l_la_rpath = -rpath \
+@V4L_PROVIDER_TRUE@	$(idirectfbvideoproviderdir)
+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 = $(libidirectfbvideoprovider_gif_la_SOURCES) \
+	$(libidirectfbvideoprovider_v4l_la_SOURCES)
+DIST_SOURCES = $(libidirectfbvideoprovider_gif_la_SOURCES) \
+	$(libidirectfbvideoprovider_v4l_la_SOURCES)
+idirectfbvideoproviderDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idirectfbvideoprovider_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@
+idirectfbvideoproviderdir = $(MODULEDIR)/interfaces/IDirectFBVideoProvider
+EXTRA_DIST = videodev.h videodev2.h
+@V4L_PROVIDER_FALSE@V4L_PROVIDER_LTLIB = 
+@V4L_PROVIDER_TRUE@V4L_PROVIDER_LTLIB = libidirectfbvideoprovider_v4l.la
+@GIF_PROVIDER_FALSE@GIF_PROVIDER_LTLIB = 
+@GIF_PROVIDER_TRUE@GIF_PROVIDER_LTLIB = libidirectfbvideoprovider_gif.la
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include	\
+	-I$(top_builddir)/lib	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+idirectfbvideoprovider_LTLIBRARIES = \
+	$(GIF_PROVIDER_LTLIB)	\
+	$(V4L_PROVIDER_LTLIB)	
+
+@BUILD_STATIC_TRUE@idirectfbvideoprovider_DATA = $(idirectfbvideoprovider_LTLIBRARIES:.la=.o)
+libidirectfbvideoprovider_v4l_la_SOURCES = idirectfbvideoprovider_v4l.c
+libidirectfbvideoprovider_v4l_la_LDFLAGS = -avoid-version -module
+libidirectfbvideoprovider_v4l_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libidirectfbvideoprovider_gif_la_SOURCES = idirectfbvideoprovider_gif.c
+libidirectfbvideoprovider_gif_la_LDFLAGS = -avoid-version -module
+libidirectfbvideoprovider_gif_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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  interfaces/IDirectFBVideoProvider/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  interfaces/IDirectFBVideoProvider/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-idirectfbvideoproviderLTLIBRARIES: $(idirectfbvideoprovider_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbvideoproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbvideoproviderdir)"
+	@list='$(idirectfbvideoprovider_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbvideoproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbvideoproviderdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbvideoproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbvideoproviderdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbvideoproviderLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbvideoprovider_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbvideoproviderdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbvideoproviderdir)/$$p"; \
+	done
+
+clean-idirectfbvideoproviderLTLIBRARIES:
+	-test -z "$(idirectfbvideoprovider_LTLIBRARIES)" || rm -f $(idirectfbvideoprovider_LTLIBRARIES)
+	@list='$(idirectfbvideoprovider_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
+libidirectfbvideoprovider_gif.la: $(libidirectfbvideoprovider_gif_la_OBJECTS) $(libidirectfbvideoprovider_gif_la_DEPENDENCIES) 
+	$(libidirectfbvideoprovider_gif_la_LINK) $(am_libidirectfbvideoprovider_gif_la_rpath) $(libidirectfbvideoprovider_gif_la_OBJECTS) $(libidirectfbvideoprovider_gif_la_LIBADD) $(LIBS)
+libidirectfbvideoprovider_v4l.la: $(libidirectfbvideoprovider_v4l_la_OBJECTS) $(libidirectfbvideoprovider_v4l_la_DEPENDENCIES) 
+	$(libidirectfbvideoprovider_v4l_la_LINK) $(am_libidirectfbvideoprovider_v4l_la_rpath) $(libidirectfbvideoprovider_v4l_la_OBJECTS) $(libidirectfbvideoprovider_v4l_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbvideoprovider_gif.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbvideoprovider_v4l.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-idirectfbvideoproviderDATA: $(idirectfbvideoprovider_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbvideoproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbvideoproviderdir)"
+	@list='$(idirectfbvideoprovider_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbvideoproviderDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbvideoproviderdir)/$$f'"; \
+	  $(idirectfbvideoproviderDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbvideoproviderdir)/$$f"; \
+	done
+
+uninstall-idirectfbvideoproviderDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbvideoprovider_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbvideoproviderdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbvideoproviderdir)/$$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)$(idirectfbvideoproviderdir)" "$(DESTDIR)$(idirectfbvideoproviderdir)"; 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-idirectfbvideoproviderLTLIBRARIES \
+	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-idirectfbvideoproviderDATA \
+	install-idirectfbvideoproviderLTLIBRARIES
+
+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-idirectfbvideoproviderDATA \
+	uninstall-idirectfbvideoproviderLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-idirectfbvideoproviderLTLIBRARIES 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-idirectfbvideoproviderDATA \
+	install-idirectfbvideoproviderLTLIBRARIES 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-idirectfbvideoproviderDATA \
+	uninstall-idirectfbvideoproviderLTLIBRARIES
+
+%.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/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_gif.c b/Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_gif.c
new file mode 100755
index 0000000..65f3fbb
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_gif.c
@@ -0,0 +1,1075 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <idirectfb.h>
+
+#include <core/surface.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <media/idirectfbdatabuffer.h>
+#include <media/idirectfbvideoprovider.h>
+
+#include <misc/gfx_util.h>
+
+
+static DFBResult Probe( IDirectFBVideoProvider_ProbeContext *ctx );
+
+static DFBResult Construct( IDirectFBVideoProvider *thiz,
+                            IDirectFBDataBuffer    *buffer );
+
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBVideoProvider, Gif )
+
+/*****************************************************************************/
+
+#define MAXCOLORMAPSIZE 256
+
+#define CM_RED   0
+#define CM_GREEN 1
+#define CM_BLUE  2
+
+#define MAX_LWZ_BITS 12
+
+#define INTERLACE     0x40
+#define LOCALCOLORMAP 0x80
+
+#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
+
+#define LM_to_uint(a,b) (((b)<<8)|(a))
+
+typedef struct {
+     int                            ref;      /* reference counter */
+
+     IDirectFBDataBuffer           *buffer;
+     DFBBoolean                     seekable;
+     
+     IDirectFBSurface              *destination;
+     IDirectFBSurface_data         *dst_data;
+     DFBRectangle                   dst_rect;
+     
+     u32                           *image;
+     
+     DirectThread                  *thread;
+     pthread_mutex_t                lock;
+     pthread_cond_t                 cond;
+     
+     DFBVideoProviderStatus         status;
+     DFBVideoProviderPlaybackFlags  flags;
+     double                         speed;
+     
+     unsigned int                   start_pos;
+
+     char                           Version[4];
+     unsigned int                   Width;
+     unsigned int                   Height;
+     u8                             ColorMap[3][MAXCOLORMAPSIZE];
+     unsigned int                   BitPixel;
+     unsigned int                   ColorResolution;
+     u32                            Background;
+     unsigned int                   AspectRatio;
+
+     int                            transparent;
+     unsigned int                   delayTime;
+     int                            inputFlag;
+     int                            disposal;
+
+     u8                             buf[280];
+     int                            curbit, lastbit, done, last_byte;
+
+     int                            fresh;
+     int                            code_size, set_code_size;
+     int                            max_code, max_code_size;
+     int                            firstcode, oldcode;
+     int                            clear_code, end_code;
+     int                            table[2][(1<< MAX_LWZ_BITS)];
+     int                            stack[(1<<(MAX_LWZ_BITS))*2], *sp;
+
+     DVFrameCallback                callback;
+     void                          *callback_ctx;
+} IDirectFBVideoProvider_GIF_data;
+
+#define GIFERRORMSG(x, ...) \
+     D_ERROR( "IDirectFBVideoProvider_GIF: " #x "!\n", ## __VA_ARGS__ )
+
+#define GIFDEBUGMSG(x, ...) \
+     D_DEBUG( "IDirectFBVideoProvider_GIF: " #x "!\n", ## __VA_ARGS__ )
+
+/*****************************************************************************/
+
+static int ZeroDataBlock = 0;
+
+static DFBResult
+FetchData( IDirectFBDataBuffer *buffer, void *data, unsigned int len )
+{
+     DFBResult ret = DFB_OK;
+
+     do {
+          unsigned int read = 0;
+          
+          ret = buffer->WaitForData( buffer, len );
+          if (ret == DFB_OK)
+               ret = buffer->GetData( buffer, len, data, &read );
+          if (ret)
+               break;
+               
+          data += read;
+          len  -= read;
+     } while (len);
+     
+     return ret;
+}
+
+static int ReadColorMap( IDirectFBDataBuffer *buffer, int number,
+                         u8 buf[3][MAXCOLORMAPSIZE] )
+{
+     int  i;
+     u8   rgb[3*number];
+     
+     if (FetchData( buffer, rgb, sizeof(rgb) )) {
+          GIFERRORMSG("bad colormap");
+          return -1;
+     }
+
+     for (i = 0; i < number; ++i) {
+          buf[CM_RED][i]   = rgb[i*3+0];
+          buf[CM_GREEN][i] = rgb[i*3+1];
+          buf[CM_BLUE][i]  = rgb[i*3+2];
+     }
+     
+     return 0;
+}
+
+static int GetDataBlock(IDirectFBDataBuffer *buffer, u8 *buf)
+{
+     unsigned char count;
+
+     if (FetchData( buffer, &count, 1 )) {
+          GIFERRORMSG("error in getting DataBlock size");
+          return -1;
+     }
+     ZeroDataBlock = (count == 0);
+
+     if ((count != 0) && FetchData( buffer, buf, count )) {
+          GIFERRORMSG("error in reading DataBlock");
+          return -1;
+     }
+
+     return count;
+}
+
+static int GetCode(IDirectFBVideoProvider_GIF_data *data, int code_size, int flag)
+{
+     int i, j, ret;
+     unsigned char count;
+
+     if (flag) {
+          data->curbit = 0;
+          data->lastbit = 0;
+          data->done = false;
+          return 0;
+     }
+
+     if ( (data->curbit+code_size) >= data->lastbit) {
+          if (data->done) {
+               if (data->curbit >= data->lastbit) {
+                    GIFERRORMSG("ran off the end of my bits");
+               }
+               return -1;
+          }
+          data->buf[0] = data->buf[data->last_byte-2];
+          data->buf[1] = data->buf[data->last_byte-1];
+
+          if ((count = GetDataBlock( data->buffer, &data->buf[2] )) == 0) {
+               data->done = true;
+          }
+
+          data->last_byte = 2 + count;
+          data->curbit = (data->curbit - data->lastbit) + 16;
+          data->lastbit = (2+count) * 8;
+     }
+
+     ret = 0;
+     for (i = data->curbit, j = 0; j < code_size; ++i, ++j) {
+          ret |= ((data->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
+     }
+     data->curbit += code_size;
+
+     return ret;
+}
+
+static int DoExtension( IDirectFBVideoProvider_GIF_data *data, int label )
+{
+     unsigned char buf[256] = { 0 };
+     char *str;
+
+     switch (label) {
+          case 0x01:              /* Plain Text Extension */
+               str = "Plain Text Extension";
+               break;
+          case 0xff:              /* Application Extension */
+               str = "Application Extension";
+               break;
+          case 0xfe:              /* Comment Extension */
+               str = "Comment Extension";
+               while (GetDataBlock( data->buffer, (u8*) buf ) != 0)
+                    GIFDEBUGMSG("gif comment: %s", buf);
+               return false;
+          case 0xf9:              /* Graphic Control Extension */
+               str = "Graphic Control Extension";
+               (void) GetDataBlock( data->buffer, (u8*) buf );
+               data->disposal  = (buf[0] >> 2) & 0x7;
+               data->inputFlag = (buf[0] >> 1) & 0x1;
+               if (LM_to_uint( buf[1], buf[2] ))
+                    data->delayTime = LM_to_uint( buf[1], buf[2] ) * 10000;
+               if ((buf[0] & 0x1) != 0)
+                    data->transparent = buf[3];
+               else
+                    data->transparent = -1;
+               while (GetDataBlock( data->buffer, (u8*) buf ) != 0)
+                    ;
+               return false;
+          default:
+               str = (char*) buf;
+               snprintf(str, 256, "UNKNOWN (0x%02x)", label);
+          break;
+     }
+
+     GIFDEBUGMSG("got a '%s' extension", str );
+
+     while (GetDataBlock( data->buffer, (u8*) buf ) != 0);
+
+     return 0;
+}
+
+static int LWZReadByte( IDirectFBVideoProvider_GIF_data *data, int flag, int input_code_size )
+{
+     int code, incode;
+     int i;
+
+     if (flag) {
+          data->set_code_size = input_code_size;
+          data->code_size = data->set_code_size+1;
+          data->clear_code = 1 << data->set_code_size ;
+          data->end_code = data->clear_code + 1;
+          data->max_code_size = 2*data->clear_code;
+          data->max_code = data->clear_code+2;
+
+          GetCode(data, 0, true);
+
+          data->fresh = true;
+
+          for (i = 0; i < data->clear_code; ++i) {
+               data->table[0][i] = 0;
+               data->table[1][i] = i;
+          }
+          for (; i < (1<<MAX_LWZ_BITS); ++i) {
+               data->table[0][i] = data->table[1][0] = 0;
+          }
+          data->sp = data->stack;
+
+          return 0;
+     }
+     else if (data->fresh) {
+          data->fresh = false;
+          do {
+               data->firstcode = data->oldcode = GetCode( data, data->code_size, false );
+          } while (data->firstcode == data->clear_code);
+
+          return data->firstcode;
+     }
+
+     if (data->sp > data->stack) {
+          return *--data->sp;
+     }
+
+     while ((code = GetCode( data, data->code_size, false )) >= 0) {
+          if (code == data->clear_code) {
+               for (i = 0; i < data->clear_code; ++i) {
+                    data->table[0][i] = 0;
+                    data->table[1][i] = i;
+               }
+               for (; i < (1<<MAX_LWZ_BITS); ++i) {
+                    data->table[0][i] = data->table[1][i] = 0;
+               }
+               data->code_size = data->set_code_size+1;
+               data->max_code_size = 2*data->clear_code;
+               data->max_code = data->clear_code+2;
+               data->sp = data->stack;
+               data->firstcode = data->oldcode = GetCode( data, data->code_size, false );
+
+               return data->firstcode;
+          }
+          else if (code == data->end_code) {
+               int count;
+               u8 buf[260];
+
+               if (ZeroDataBlock) {
+                    return -2;
+               }
+
+               while ((count = GetDataBlock( data->buffer, buf )) > 0)
+                    ;
+
+               if (count != 0)
+                    GIFERRORMSG("missing EOD in data stream (common occurence)");
+
+               return -2;
+          }
+
+          incode = code;
+
+          if (code >= data->max_code) {
+               *data->sp++ = data->firstcode;
+               code = data->oldcode;
+          }
+
+          while (code >= data->clear_code) {
+               *data->sp++ = data->table[1][code];
+               if (code == data->table[0][code]) {
+                    GIFERRORMSG("circular table entry BIG ERROR");
+               }
+               code = data->table[0][code];
+          }
+
+          *data->sp++ = data->firstcode = data->table[1][code];
+
+          if ((code = data->max_code) <(1<<MAX_LWZ_BITS)) {
+               data->table[0][code] = data->oldcode;
+               data->table[1][code] = data->firstcode;
+               ++data->max_code;
+               if ((data->max_code >= data->max_code_size)
+                   && (data->max_code_size < (1<<MAX_LWZ_BITS)))
+               {
+                    data->max_code_size *= 2;
+                    ++data->code_size;
+               }
+          }
+
+          data->oldcode = incode;
+
+          if (data->sp > data->stack) {
+               return *--data->sp;
+          }
+     }
+     return code;
+}
+
+static int ReadImage( IDirectFBVideoProvider_GIF_data *data, 
+                      int left, int top, int width, int height,
+                      u8 cmap[3][MAXCOLORMAPSIZE], bool interlace, bool ignore )
+{
+     u8   c;
+     int  v;
+     int  xpos = 0, ypos = 0, pass = 0;
+     u32 *image, *dst;
+
+     /*
+     **  Initialize the decompression routines
+     */
+     if (FetchData( data->buffer, &c, 1 ))
+          GIFERRORMSG("EOF / read error on image data");
+
+     if (LWZReadByte( data, true, c ) < 0)
+          GIFERRORMSG("error reading image");
+
+     /*
+     **  If this is an "uninteresting picture" ignore it.
+     */
+     if (ignore) {
+          GIFDEBUGMSG("skipping image...");
+
+          while (LWZReadByte( data, false, c ) >= 0)
+               ;
+          return 0;
+     }
+     
+     switch (data->disposal) {
+          case 2:
+               GIFDEBUGMSG("restoring to background color...");
+               memset( data->image, 0, data->Width * data->Height * 4 );
+               break;
+          case 3:
+               GIFERRORMSG("restoring to previous frame is unsupported");
+               break;
+          default:
+               break;
+     }
+     
+     dst = image = data->image + (top * data->Width + left);
+
+     GIFDEBUGMSG("reading %dx%d at %dx%d %sGIF image",
+                 width, height, left, top, interlace ? " interlaced " : "" );
+
+     while ((v = LWZReadByte( data, false, c )) >= 0 ) {
+          if (v != data->transparent) {
+               dst[xpos] = (0xFF000000              |
+                            cmap[CM_RED][v]   << 16 |
+                            cmap[CM_GREEN][v] << 8  |
+                            cmap[CM_BLUE][v]);
+          }
+
+          ++xpos;
+          if (xpos == width) {
+               xpos = 0;
+               if (interlace) {
+                    switch (pass) {
+                         case 0:
+                         case 1:
+                              ypos += 8;
+                              break;
+                         case 2:
+                              ypos += 4;
+                              break;
+                         case 3:
+                              ypos += 2;
+                              break;
+                    }
+
+                    if (ypos >= height) {
+                         ++pass;
+                         switch (pass) {
+                              case 1:
+                                   ypos = 4;
+                                   break;
+                              case 2:
+                                   ypos = 2;
+                                   break;
+                              case 3:
+                                   ypos = 1;
+                              break;
+                              default:
+                                   goto fini;
+                         }
+                    }
+               }
+               else {
+                    ++ypos;
+               }
+               dst = image + ypos * data->Width;
+          } 
+          if (ypos >= height) {
+               break;
+          }
+     }
+
+fini:
+
+     if (LWZReadByte( data, false, c ) >= 0) {
+          GIFERRORMSG("too much input data, ignoring extra...");
+          //while (LWZReadByte( data, false, c ) >= 0);
+     }
+
+     return 0;
+}
+
+static void GIFReset( IDirectFBVideoProvider_GIF_data *data )
+{
+     data->transparent = -1;
+     data->delayTime   = 1000000; /* default: 1s */
+     data->inputFlag   = -1;
+     data->disposal    = 0;
+     
+     if (data->image)
+          memset( data->image, 0, data->Width*data->Height*4 );
+}
+
+static DFBResult GIFReadHeader( IDirectFBVideoProvider_GIF_data *data )
+{
+     DFBResult ret;
+     u8        buf[7];
+     
+     ret = FetchData( data->buffer, buf, 6 );
+     if (ret) {
+          GIFERRORMSG("error reading header");
+          return ret;
+     }
+
+     if (memcmp( buf, "GIF", 3 )) {
+          GIFERRORMSG("bad magic");
+          return DFB_UNSUPPORTED;
+     }
+     
+     memcpy( data->Version, &buf[3], 3 );
+     data->Version[3] = '\0';
+     
+     ret = FetchData( data->buffer, buf, 7 );
+     if (ret) {
+          GIFERRORMSG("error reading screen descriptor");
+          return ret;
+     }
+
+     data->Width           = LM_to_uint( buf[0], buf[1] );
+     data->Height          = LM_to_uint( buf[2], buf[3] );
+     data->BitPixel        = 2 << (buf[4] & 0x07);
+     data->ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
+     data->Background      = buf[5];
+     data->AspectRatio     = buf[6];
+     if (data->AspectRatio)
+          data->AspectRatio = ((data->AspectRatio + 15) << 8) >> 6;
+     else
+          data->AspectRatio = (data->Width << 8) / data->Height;
+
+     if (BitSet(buf[4], LOCALCOLORMAP)) {    /* Global Colormap */
+          if (ReadColorMap( data->buffer, data->BitPixel, data->ColorMap )) {
+               GIFERRORMSG("error reading global colormap");
+               return DFB_FAILURE;
+          }
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult GIFReadFrame( IDirectFBVideoProvider_GIF_data *data )
+{
+     u8    buf[16], c;
+     int   top, left;
+     int   width, height;
+     u8    localColorMap[3][MAXCOLORMAPSIZE];
+     bool  useGlobalColormap;
+
+     data->curbit = data->lastbit = data->done = data->last_byte = 0;
+
+     data->fresh = 
+     data->code_size = data->set_code_size =
+     data->max_code = data->max_code_size = 
+     data->firstcode = data->oldcode =
+     data->clear_code = data->end_code = 0;
+
+     for (;;) {
+          DFBResult ret;
+          
+          ret = FetchData( data->buffer, &c, 1);
+          if (ret) {
+               GIFERRORMSG("EOF / read error on image data" );
+               return DFB_EOF;
+          }
+
+          if (c == ';') /* GIF terminator */
+               return DFB_EOF;
+
+          if (c == '!') { /* Extension */
+               if (FetchData( data->buffer, &c, 1)) {
+                    GIFERRORMSG("EOF / read error on extention function code");
+                    return DFB_EOF;
+               }
+               DoExtension( data, c );
+               continue;
+          } 
+
+          if (c != ',') { /* Not a valid start character */
+               GIFERRORMSG("bogus character 0x%02x, ignoring", (int) c );
+               continue;
+          }
+               
+          ret = FetchData( data->buffer, buf, 9 );
+          if (ret) {
+               GIFERRORMSG("couldn't read left/top/width/height");
+               return ret;
+          }
+               
+          left   = LM_to_uint( buf[0], buf[1] );
+          top    = LM_to_uint( buf[2], buf[3] );
+          width  = LM_to_uint( buf[4], buf[5] );
+          height = LM_to_uint( buf[6], buf[7] );
+
+          useGlobalColormap = !BitSet( buf[8], LOCALCOLORMAP );
+
+          if (!useGlobalColormap) {
+               int bitPixel = 2 << (buf[8] & 0x07);
+               if (ReadColorMap( data->buffer, bitPixel, localColorMap ))
+                    GIFERRORMSG("error reading local colormap");
+          }
+
+          if (ReadImage( data, left, top, width, height,
+                        (useGlobalColormap ?
+                         data->ColorMap : localColorMap),
+                         BitSet( buf[8], INTERLACE ), 0 )) {
+               GIFERRORMSG("error reading image");
+               return DFB_FAILURE;
+          }
+          
+          break;
+     }
+     
+     return DFB_OK;
+}
+
+/*****************************************************************************/
+
+static void
+IDirectFBVideoProvider_GIF_Destruct( IDirectFBVideoProvider *thiz )
+{
+     IDirectFBVideoProvider_GIF_data *data = thiz->priv;
+     
+     thiz->Stop( thiz );
+     
+     if (data->image)
+          D_FREE( data->image );
+     
+     if (data->buffer)
+          data->buffer->Release( data->buffer );
+    
+     pthread_cond_destroy( &data->cond );
+     pthread_mutex_destroy( &data->lock );
+          
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBVideoProvider_GIF_AddRef( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBVideoProvider_GIF_Release( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+
+     if (--data->ref == 0)
+          IDirectFBVideoProvider_GIF_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetCapabilities( IDirectFBVideoProvider       *thiz,
+                                            DFBVideoProviderCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!caps)
+          return DFB_INVARG;
+          
+     *caps = DVCAPS_BASIC | DVCAPS_SCALE | DVCAPS_SPEED;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetSurfaceDescription( IDirectFBVideoProvider *thiz,
+                                                  DFBSurfaceDescription  *desc )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!desc)
+          return DFB_INVARG;
+          
+     desc->flags       = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
+     desc->width       = data->Width;
+     desc->height      = data->Height;
+     desc->pixelformat = DSPF_ARGB;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetStreamDescription( IDirectFBVideoProvider *thiz,
+                                                 DFBStreamDescription   *desc )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!desc)
+          return DFB_INVARG;
+          
+     desc->caps = DVSCAPS_VIDEO;
+     
+     snprintf( desc->video.encoding,
+               DFB_STREAM_DESC_ENCODING_LENGTH, "GIF %s", data->Version );
+     desc->video.framerate = 0;
+     desc->video.aspect    = (double)data->AspectRatio/256.0;
+     desc->video.bitrate   = 0;
+     
+     desc->title[0] = desc->author[0] = 
+     desc->album[0] = desc->genre[0] = desc->comment[0] = 0;
+     desc->year = 0;
+     
+     return DFB_OK;
+}
+
+static void*
+GIFVideo( DirectThread *self, void *arg )
+{
+     IDirectFBVideoProvider_GIF_data *data = arg;
+     
+     pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
+     
+     while (!direct_thread_is_canceled( self )) {
+          DFBResult              ret;
+          DFBRectangle           rect;
+          DFBRegion              clip;
+          CoreSurface           *surface;
+          CoreSurfaceBufferLock  lock;
+          
+          pthread_mutex_lock( &data->lock );
+          
+          if (direct_thread_is_canceled( self )) {
+               pthread_mutex_unlock( &data->lock );
+               break;
+          }
+          
+          ret = GIFReadFrame( data );
+          if (ret) { 
+               if (ret == DFB_EOF) {
+                    GIFReset( data );
+                    if (data->flags & DVPLAY_LOOPING) {
+                         data->buffer->SeekTo( data->buffer, data->start_pos );
+                    }
+                    else {
+                         data->status = DVSTATE_FINISHED;
+                         pthread_mutex_unlock( &data->lock );
+                         break;
+                    }
+               }
+               pthread_mutex_unlock( &data->lock );
+               continue;
+          }
+          
+          rect = (data->dst_rect.w == 0)
+                 ? data->dst_data->area.wanted : data->dst_rect;          
+          dfb_region_from_rectangle( &clip, &data->dst_data->area.current );
+          
+          surface = data->dst_data->surface;
+          D_MAGIC_ASSERT( surface, CoreSurface );
+
+          if (dfb_rectangle_region_intersects( &rect, &clip ) &&
+              dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock ) == DFB_OK)
+          {
+               dfb_scale_linear_32( data->image, data->Width, data->Height,
+                                    lock.addr, lock.pitch, &rect, data->dst_data->surface, &clip );
+                                    
+               dfb_surface_unlock_buffer( surface, &lock );
+               
+               if (data->callback)
+                    data->callback( data->callback_ctx );
+          }
+
+          if (!data->speed) {
+               pthread_cond_wait( &data->cond, &data->lock );
+          }
+          else {
+               struct timespec ts;
+               unsigned long   us;
+               
+               us = data->delayTime;
+               if (data->speed != 1.0)
+                    us = ((double)us / data->speed + .5);
+                    
+               direct_util_get_monotonic_pthread_timeout(&ts,
+                                                         us/1000000,
+                                                         (us%1000000) * 1000);
+                    
+               pthread_cond_timedwait( &data->cond, &data->lock, &ts );
+          }
+          
+          pthread_mutex_unlock( &data->lock );
+     }
+     
+     return (void*)0;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_PlayTo( IDirectFBVideoProvider *thiz,
+                                   IDirectFBSurface       *destination,
+                                   const DFBRectangle     *dest_rect,
+                                   DVFrameCallback         callback,
+                                   void                   *ctx )
+{
+     IDirectFBSurface_data *dst_data;
+     DFBRectangle           rect = { 0, 0, 0, 0 };
+     DFBResult              ret;
+     
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!destination)
+          return DFB_INVARG;
+          
+     dst_data = destination->priv;
+     if (!dst_data || !dst_data->surface)
+          return DFB_DESTROYED;
+          
+     if (dest_rect) {
+          if (dest_rect->w < 1 || dest_rect->h < 1)
+               return DFB_INVARG;
+          
+          rect = *dest_rect;
+          rect.x += dst_data->area.wanted.x;
+          rect.y += dst_data->area.wanted.y;
+     }          
+     
+     pthread_mutex_lock( &data->lock );
+     
+     if (data->status == DVSTATE_FINISHED) {
+          ret = data->buffer->SeekTo( data->buffer, data->start_pos );
+          if (ret) {
+               pthread_mutex_unlock( &data->lock );
+               return ret;
+          }
+     }
+     data->status = DVSTATE_PLAY;
+     
+     if (!data->image) {          
+          data->image = D_CALLOC( 4, data->Width * data->Height );
+          if (!data->image) {
+               pthread_mutex_unlock( &data->lock );
+               return D_OOM();
+          }
+     }
+     
+     if (data->destination)
+          data->destination->Release( data->destination );
+     
+     destination->AddRef( destination );
+     data->destination = destination;
+     data->dst_data    = dst_data;
+     data->dst_rect    = rect;
+     
+     data->callback     = callback;
+     data->callback_ctx = ctx;
+     
+     if (!data->thread) {
+          data->thread = direct_thread_create( DTT_DEFAULT, GIFVideo,
+                                              (void*)data, "GIF Video" );
+     }
+     
+     pthread_mutex_unlock( &data->lock );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_Stop( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (data->thread) {
+          direct_thread_cancel( data->thread );
+          pthread_mutex_lock( &data->lock );
+          pthread_cond_signal( &data->cond );
+          pthread_mutex_unlock( &data->lock );
+          direct_thread_join( data->thread );
+          direct_thread_destroy( data->thread );
+          data->thread = NULL;
+     }
+     
+     if (data->destination) {
+          data->destination->Release( data->destination );
+          data->destination = NULL;
+          data->dst_data    = NULL;
+     }
+     
+     data->status = DVSTATE_STOP;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetStatus( IDirectFBVideoProvider *thiz,
+                                      DFBVideoProviderStatus *status )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!status)
+          return DFB_INVARG;
+          
+     *status = data->status;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_SeekTo( IDirectFBVideoProvider *thiz,
+                                   double                  seconds )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (seconds < 0.0)
+          return DFB_INVARG;
+          
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetPos( IDirectFBVideoProvider *thiz,
+                                   double                 *seconds )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!seconds)
+          return DFB_INVARG;
+          
+     *seconds = 0.0;
+          
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetLength( IDirectFBVideoProvider *thiz,
+                                      double                 *seconds )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!seconds)
+          return DFB_INVARG;
+          
+     *seconds = 0.0;
+          
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_SetPlaybackFlags( IDirectFBVideoProvider        *thiz,
+                                             DFBVideoProviderPlaybackFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (flags & ~DVPLAY_LOOPING)
+          return DFB_UNSUPPORTED;
+          
+     if (flags & DVPLAY_LOOPING && !data->seekable)
+          return DFB_UNSUPPORTED;
+          
+     data->flags = flags;
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_SetSpeed( IDirectFBVideoProvider *thiz,
+                                     double                  multiplier )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (multiplier < 0.0)
+          return DFB_INVARG;
+    
+     if (data->speed != multiplier) {
+          pthread_mutex_lock( &data->lock ); 
+          data->speed = multiplier;
+          pthread_cond_signal( &data->cond );
+          pthread_mutex_unlock( &data->lock );
+     }
+     
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GIF_GetSpeed( IDirectFBVideoProvider *thiz,
+                                     double                 *multiplier )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBVideoProvider_GIF )
+     
+     if (!multiplier)
+          return DFB_INVARG;
+          
+     *multiplier = data->speed;
+     
+     return DFB_OK;
+}
+
+/* exported symbols */
+static DFBResult
+Probe( IDirectFBVideoProvider_ProbeContext *ctx )
+{
+     if (!memcmp( ctx->header, "GIF89", 5 ))
+          return DFB_OK;
+          
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBVideoProvider *thiz,
+           IDirectFBDataBuffer    *buffer )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IDirectFBVideoProvider_GIF )
+
+     data->ref    = 1;
+     data->status = DVSTATE_STOP;
+     data->buffer = buffer;
+     data->speed  = 1.0;
+     
+     buffer->AddRef( buffer );
+     data->seekable = (buffer->SeekTo( buffer, 0 ) == DFB_OK);
+     
+     GIFReset( data );
+     ret = GIFReadHeader( data );
+     if (ret) {
+          IDirectFBVideoProvider_GIF_Destruct( thiz );
+          return ret;
+     }
+     
+     data->buffer->GetPosition( data->buffer, &data->start_pos );
+     
+     direct_util_recursive_pthread_mutex_init( &data->lock );
+     direct_util_monotonic_pthread_cond_init( &data->cond );
+     
+     thiz->AddRef                = IDirectFBVideoProvider_GIF_AddRef;
+     thiz->Release               = IDirectFBVideoProvider_GIF_Release;
+     thiz->GetCapabilities       = IDirectFBVideoProvider_GIF_GetCapabilities;
+     thiz->GetSurfaceDescription = IDirectFBVideoProvider_GIF_GetSurfaceDescription;
+     thiz->GetStreamDescription  = IDirectFBVideoProvider_GIF_GetStreamDescription;
+     thiz->PlayTo                = IDirectFBVideoProvider_GIF_PlayTo;
+     thiz->Stop                  = IDirectFBVideoProvider_GIF_Stop;
+     thiz->GetStatus             = IDirectFBVideoProvider_GIF_GetStatus;
+     thiz->SeekTo                = IDirectFBVideoProvider_GIF_SeekTo;
+     thiz->GetPos                = IDirectFBVideoProvider_GIF_GetPos;
+     thiz->GetLength             = IDirectFBVideoProvider_GIF_GetLength;
+     thiz->SetPlaybackFlags      = IDirectFBVideoProvider_GIF_SetPlaybackFlags;
+     thiz->SetSpeed              = IDirectFBVideoProvider_GIF_SetSpeed;
+     thiz->GetSpeed              = IDirectFBVideoProvider_GIF_GetSpeed;
+     
+     return DFB_OK;
+}
diff --git a/Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c b/Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c
new file mode 100755
index 0000000..6d7df13
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_v4l.c
@@ -0,0 +1,1523 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+#if defined(__dietlibc__) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+#include <string.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/select.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#ifdef HAVE_LINUX_COMPILER_H
+#include <linux/compiler.h>
+#endif
+#include "videodev.h"
+
+#include <directfb.h>
+
+#include <media/idirectfbvideoprovider.h>
+#include <media/idirectfbdatabuffer.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/layers.h>
+#include <core/layer_control.h>
+#include <core/surface.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <misc/util.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#ifdef DFB_HAVE_V4L2
+#include "videodev2.h"
+#endif
+
+static DFBResult
+Probe( IDirectFBVideoProvider_ProbeContext *ctx );
+
+static DFBResult
+Construct( IDirectFBVideoProvider *thiz, ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBVideoProvider, V4L )
+
+/*
+ * private data struct of IDirectFBVideoProvider
+ */
+typedef struct {
+     int                      ref;       /* reference counter */
+
+     char                    *filename;
+     int                      fd;
+#ifdef DFB_HAVE_V4L2
+#define NUMBER_OF_BUFFERS 2
+     bool is_v4l2;
+
+     struct v4l2_format fmt;
+     struct v4l2_capability caps;
+
+     struct v4l2_queryctrl brightness;
+     struct v4l2_queryctrl contrast;
+     struct v4l2_queryctrl saturation;
+     struct v4l2_queryctrl hue;
+
+     struct v4l2_requestbuffers req;
+     struct v4l2_buffer vidbuf[NUMBER_OF_BUFFERS];
+     char *ptr[NUMBER_OF_BUFFERS]; /* only used for capture to system memory */
+     bool framebuffer_or_system;
+#endif
+     struct video_capability  vcap;
+     struct video_mmap        vmmap;
+     struct video_mbuf        vmbuf;
+     void                    *buffer;
+     bool                     grab_mode;
+
+     DirectThread            *thread;
+     CoreSurface             *destination;
+     CoreSurfaceBufferLock    destinationlock;
+     DVFrameCallback          callback;
+     void                    *ctx;
+
+     CoreCleanup             *cleanup;
+
+     bool                     running;
+     pthread_mutex_t          lock;
+
+     Reaction                 reaction; /* for the destination listener */
+
+     CoreDFB                 *core;
+} IDirectFBVideoProvider_V4L_data;
+
+static const unsigned int zero = 0;
+static const unsigned int one = 1;
+
+static void* OverlayThread( DirectThread *thread, void *context );
+static void* GrabThread( DirectThread *thread, void *context );
+static ReactionResult v4l_videosurface_listener( const void *msg_data, void *ctx );
+static ReactionResult v4l_systemsurface_listener( const void *msg_data, void *ctx );
+static DFBResult v4l_to_surface_overlay( CoreSurface *surface, DFBRectangle *rect,
+                                         IDirectFBVideoProvider_V4L_data *data );
+static DFBResult v4l_to_surface_grab( CoreSurface *surface, DFBRectangle *rect,
+                                      IDirectFBVideoProvider_V4L_data *data );
+static DFBResult v4l_stop( IDirectFBVideoProvider_V4L_data *data, bool detach );
+static void v4l_deinit( IDirectFBVideoProvider_V4L_data *data );
+static void v4l_cleanup( void *data, int emergency );
+
+#ifdef DFB_HAVE_V4L2
+static DFBResult v4l2_playto( CoreSurface *surface, DFBRectangle *rect, IDirectFBVideoProvider_V4L_data *data );
+#endif
+
+static void
+IDirectFBVideoProvider_V4L_Destruct( IDirectFBVideoProvider *thiz )
+{
+     IDirectFBVideoProvider_V4L_data *data =
+     (IDirectFBVideoProvider_V4L_data*)thiz->priv;
+
+     if (data->cleanup)
+          dfb_core_cleanup_remove( NULL, data->cleanup );
+
+     v4l_deinit( data );
+
+     D_FREE( data->filename );
+
+     pthread_mutex_destroy( &data->lock );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBVideoProvider_V4L_AddRef( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBVideoProvider_V4L_Release( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (--data->ref == 0) {
+          IDirectFBVideoProvider_V4L_Destruct( thiz );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetCapabilities( IDirectFBVideoProvider       *thiz,
+                                            DFBVideoProviderCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!caps)
+          return DFB_INVARG;
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          *caps = 0;
+
+          data->saturation.id = V4L2_CID_SATURATION;
+          if (ioctl( data->fd, VIDIOC_G_CTRL, &data->saturation )) {
+               *caps |= DVCAPS_SATURATION;
+          }
+          else {
+               data->saturation.id = 0;
+          }
+          data->brightness.id = V4L2_CID_BRIGHTNESS;
+          if (ioctl( data->fd, VIDIOC_G_CTRL, &data->brightness )) {
+               *caps |= DVCAPS_BRIGHTNESS;
+          }
+          else {
+               data->brightness.id = 0;
+          }
+          data->contrast.id = V4L2_CID_CONTRAST;
+          if (ioctl( data->fd, VIDIOC_G_CTRL, &data->contrast )) {
+               *caps |= DVCAPS_CONTRAST;
+          }
+          else {
+               data->contrast.id = 0;
+          }
+          data->hue.id = V4L2_CID_HUE;
+          if (ioctl( data->fd, VIDIOC_G_CTRL, &data->hue )) {
+               *caps |= DVCAPS_HUE;
+          }
+          else {
+               data->hue.id = 0;
+          }
+          /* fixme: interlaced might not be true for field capture */
+          *caps |= DVCAPS_BASIC | DVCAPS_SCALE | DVCAPS_INTERLACED;
+     }
+     else
+#endif
+     {
+          *caps = ( DVCAPS_BASIC      |
+                    DVCAPS_BRIGHTNESS |
+                    DVCAPS_CONTRAST   |
+                    DVCAPS_HUE        |
+                    DVCAPS_SATURATION |
+                    DVCAPS_INTERLACED );
+
+          if (data->vcap.type & VID_TYPE_SCALES)
+               *caps |= DVCAPS_SCALE;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetSurfaceDescription( IDirectFBVideoProvider *thiz,
+                                                  DFBSurfaceDescription  *desc )
+{
+     IDirectFBVideoProvider_V4L_data *data;
+
+     if (!thiz || !desc)
+          return DFB_INVARG;
+
+     data = (IDirectFBVideoProvider_V4L_data*)thiz->priv;
+
+     if (!data)
+          return DFB_DEAD;
+
+     desc->flags  = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          desc->width = 720;  /* fimxe: depends on the selected standard: query standard and set accordingly */
+          desc->height = 576;
+     }
+     else
+#endif
+     {
+          desc->width  = data->vcap.maxwidth;
+          desc->height = data->vcap.maxheight;
+     }
+     desc->pixelformat = dfb_primary_layer_pixelformat();
+     desc->caps = DSCAPS_INTERLACED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetStreamDescription( IDirectFBVideoProvider *thiz,
+                                                 DFBStreamDescription   *desc )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     desc->caps = DVSCAPS_VIDEO;
+     
+     desc->video.encoding[0] = 0;
+     desc->video.framerate   = 10; // assume 10fps
+#ifdef DFB_HAVE_V4L2
+     desc->video.aspect      = 720.0/576.0;
+#else
+     desc->video.aspect      = (double)data->vcap.maxwidth /
+                               (double)data->vcap.maxheight;
+#endif
+     desc->video.bitrate     = 0;
+
+     desc->title[0] = desc->author[0] = desc->album[0]   =
+     desc->year     = desc->genre[0]  = desc->comment[0] = 0;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_PlayTo( IDirectFBVideoProvider *thiz,
+                                   IDirectFBSurface       *destination,
+                                   const DFBRectangle     *dstrect,
+                                   DVFrameCallback         callback,
+                                   void                   *ctx )
+{
+     DFBRectangle           rect;
+     IDirectFBSurface_data *dst_data;
+     CoreSurface           *surface = 0;
+     DFBResult              ret;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!destination)
+          return DFB_INVARG;
+
+     dst_data = (IDirectFBSurface_data*)destination->priv;
+
+     if (!dst_data)
+          return DFB_DEAD;
+
+     if (!dst_data->area.current.w || !dst_data->area.current.h)
+          return DFB_INVAREA;
+
+     if (dstrect) {
+          if (dstrect->w < 1  ||  dstrect->h < 1)
+               return DFB_INVARG;
+
+          rect = *dstrect;
+
+          rect.x += dst_data->area.wanted.x;
+          rect.y += dst_data->area.wanted.y;
+     }
+     else
+          rect = dst_data->area.wanted;
+
+     if (!dfb_rectangle_intersect( &rect, &dst_data->area.current ))
+          return DFB_INVAREA;
+
+     v4l_stop( data, true );
+
+     pthread_mutex_lock( &data->lock );
+
+     data->callback = callback;
+     data->ctx      = ctx;
+
+     surface = dst_data->surface;
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          ret = v4l2_playto( surface, &rect, data );
+     }
+     else
+#endif
+     {
+          data->grab_mode = false;
+          if (getenv( "DFB_V4L_GRAB" ) ||
+              (surface->config.caps & DSCAPS_SYSTEMONLY) ||
+              (surface->config.caps & DSCAPS_FLIPPING) ||
+              !(VID_TYPE_OVERLAY & data->vcap.type))
+               data->grab_mode = true;
+          else {
+               /*
+                * Because we're constantly writing to the surface we
+                * permanently lock it.
+                */
+               ret = dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_GPU,
+                                              CSAF_WRITE, &data->destinationlock );
+
+               if (ret) {
+                    pthread_mutex_unlock( &data->lock );
+                    return ret;
+               }
+          }
+
+          if (data->grab_mode)
+               ret = v4l_to_surface_grab( surface, &rect, data );
+          else
+               ret = v4l_to_surface_overlay( surface, &rect, data );
+     }
+     if (ret && !data->grab_mode)
+          dfb_surface_unlock_buffer( surface, &data->destinationlock );
+
+     pthread_mutex_unlock( &data->lock );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_Stop( IDirectFBVideoProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     return v4l_stop( data, true );
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetStatus( IDirectFBVideoProvider *thiz,
+                                      DFBVideoProviderStatus *status )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!status)
+          return DFB_INVARG;
+
+     *status = data->running ? DVSTATE_PLAY : DVSTATE_STOP;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_SeekTo( IDirectFBVideoProvider *thiz,
+                                   double                  seconds )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetPos( IDirectFBVideoProvider *thiz,
+                                   double                 *seconds )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetLength( IDirectFBVideoProvider *thiz,
+                                      double                 *seconds )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_GetColorAdjustment( IDirectFBVideoProvider *thiz,
+                                               DFBColorAdjustment     *adj )
+{
+     struct video_picture pic;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!adj)
+          return DFB_INVARG;
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          struct v4l2_control ctrl;
+
+          if (data->brightness.id) {
+               ctrl.id = data->brightness.id;
+               if (!ioctl( data->fd, VIDIOC_G_CTRL, &ctrl )) {
+                    adj->flags |= DCAF_BRIGHTNESS;
+                    adj->brightness = 0xffff * ctrl.value / (data->brightness.maximum - data->brightness.minimum);
+               }
+          }
+          if (data->contrast.id) {
+               ctrl.id = data->contrast.id;
+               if (!ioctl( data->fd, VIDIOC_G_CTRL, &ctrl )) {
+                    adj->flags |= DCAF_CONTRAST;
+                    adj->contrast = 0xffff * ctrl.value / (data->contrast.maximum - data->contrast.minimum);
+               }
+          }
+          if (data->hue.id) {
+               ctrl.id = data->hue.id;
+               if (!ioctl( data->fd, VIDIOC_G_CTRL, &ctrl )) {
+                    adj->flags |= DCAF_HUE;
+                    adj->hue = 0xffff * ctrl.value / (data->hue.maximum - data->hue.minimum);
+               }
+          }
+          if (data->saturation.id) {
+               ctrl.id = data->saturation.id;
+               if (!ioctl( data->fd, VIDIOC_G_CTRL, &ctrl )) {
+                    adj->flags |= DCAF_SATURATION;
+                    adj->saturation = 0xffff * ctrl.value / (data->saturation.maximum - data->saturation.minimum);
+               }
+          }
+     }
+     else
+#endif
+     {
+          ioctl( data->fd, VIDIOCGPICT, &pic );
+
+          adj->flags = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_HUE | DCAF_SATURATION;
+
+          adj->brightness = pic.brightness;
+          adj->contrast   = pic.contrast;
+          adj->hue        = pic.hue;
+          adj->saturation = pic.colour;
+     }
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_SetColorAdjustment( IDirectFBVideoProvider   *thiz,
+                                               const DFBColorAdjustment *adj )
+{
+     struct video_picture pic;
+
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     if (!adj)
+          return DFB_INVARG;
+
+     if (adj->flags == DCAF_NONE)
+          return DFB_OK;
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          struct v4l2_control ctrl;
+          if ((adj->flags & DCAF_BRIGHTNESS) && data->brightness.id) {
+               ctrl.id = data->brightness.id;
+               ctrl.value = (adj->brightness * (data->brightness.maximum - data->brightness.minimum)) / 0xfff;
+               ioctl( data->fd, VIDIOC_S_CTRL, &ctrl );
+          }
+          if ((adj->flags & DCAF_CONTRAST) && data->contrast.id) {
+               ctrl.id = data->contrast.id;
+               ctrl.value = (adj->contrast * (data->contrast.maximum - data->contrast.minimum)) / 0xfff;
+               ioctl( data->fd, VIDIOC_S_CTRL, &ctrl );
+          }
+          if ((adj->flags & DCAF_HUE) && data->hue.id) {
+               ctrl.id = data->hue.id;
+               ctrl.value = (adj->hue * (data->hue.maximum - data->hue.minimum)) / 0xfff;
+               ioctl( data->fd, VIDIOC_S_CTRL, &ctrl );
+          }
+          if ((adj->flags & DCAF_SATURATION) && data->saturation.id) {
+               ctrl.id = data->saturation.id;
+               ctrl.value = (adj->saturation * (data->saturation.maximum - data->saturation.minimum)) / 0xfff;
+               ioctl( data->fd, VIDIOC_S_CTRL, &ctrl );
+          }
+     }
+     else
+#endif
+     {
+          if (ioctl( data->fd, VIDIOCGPICT, &pic ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCGPICT failed!\n" );
+
+               return ret;
+          }
+
+          if (adj->flags & DCAF_BRIGHTNESS) pic.brightness = adj->brightness;
+          if (adj->flags & DCAF_CONTRAST)   pic.contrast   = adj->contrast;
+          if (adj->flags & DCAF_HUE)        pic.hue        = adj->hue;
+          if (adj->flags & DCAF_SATURATION) pic.colour     = adj->saturation;
+
+          if (ioctl( data->fd, VIDIOCSPICT, &pic ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCSPICT failed!\n" );
+
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBVideoProvider_V4L_SendEvent( IDirectFBVideoProvider *thiz,
+                                      const DFBEvent         *evt )
+{
+     DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L)
+
+     return DFB_UNSUPPORTED;
+}
+
+
+/* exported symbols */
+
+static DFBResult
+Probe( IDirectFBVideoProvider_ProbeContext *ctx )
+{
+     if (ctx->filename) {
+          if (strncmp( ctx->filename, "/dev/video", 10 ) == 0)
+               return DFB_OK;
+
+          if (strncmp( ctx->filename, "/dev/v4l/video", 14 ) == 0)
+               return DFB_OK;
+     }
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBVideoProvider *thiz, ... )
+{
+     int fd;
+     IDirectFBDataBuffer *buffer;
+     IDirectFBDataBuffer_data *buffer_data;
+     CoreDFB             *core;
+     va_list              tag;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBVideoProvider_V4L)
+
+     va_start( tag, thiz );
+     buffer = va_arg( tag, IDirectFBDataBuffer * );
+     core = va_arg( tag, CoreDFB * );
+     va_end( tag );
+
+
+     data->ref  = 1;
+     data->core = core;
+
+     buffer_data = (IDirectFBDataBuffer_data*) buffer->priv;
+
+     fd = open( buffer_data->filename, O_RDWR );     
+     if (fd < 0) {
+          DFBResult ret = errno2result( errno );
+
+          D_PERROR( "DirectFB/Video4Linux: Cannot open `%s'!\n",
+                     buffer_data->filename );
+
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     direct_util_recursive_pthread_mutex_init( &data->lock );
+
+#ifdef DFB_HAVE_V4L2
+     data->is_v4l2 = 0;
+
+     /* look if the device is a v4l2 device */
+     if (!ioctl( fd, VIDIOC_QUERYCAP, &data->caps )) {
+          D_INFO( "DirectFB/Video4Linux: This is a Video4Linux-2 device.\n" );
+          data->is_v4l2 = 1;
+     }
+
+     if (data->is_v4l2) {
+          /* hmm, anything to do here? */
+     }
+     else
+#endif
+     {
+          D_INFO( "DirectFB/Video4Linux: This is a Video4Linux-1 device.\n" );
+
+          ioctl( fd, VIDIOCGCAP, &data->vcap );
+          ioctl( fd, VIDIOCCAPTURE, &zero );
+
+          ioctl( fd, VIDIOCGMBUF, &data->vmbuf );
+
+          data->buffer = mmap( NULL, data->vmbuf.size,
+                               PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
+     }
+
+     data->filename = D_STRDUP( buffer_data->filename );
+     data->fd       = fd;
+
+     thiz->AddRef    = IDirectFBVideoProvider_V4L_AddRef;
+     thiz->Release   = IDirectFBVideoProvider_V4L_Release;
+     thiz->GetCapabilities = IDirectFBVideoProvider_V4L_GetCapabilities;
+     thiz->GetSurfaceDescription = IDirectFBVideoProvider_V4L_GetSurfaceDescription;
+     thiz->GetStreamDescription = IDirectFBVideoProvider_V4L_GetStreamDescription;
+     thiz->PlayTo    = IDirectFBVideoProvider_V4L_PlayTo;
+     thiz->Stop      = IDirectFBVideoProvider_V4L_Stop;
+     thiz->GetStatus = IDirectFBVideoProvider_V4L_GetStatus;
+     thiz->SeekTo    = IDirectFBVideoProvider_V4L_SeekTo;
+     thiz->GetPos    = IDirectFBVideoProvider_V4L_GetPos;
+     thiz->GetLength = IDirectFBVideoProvider_V4L_GetLength;
+     thiz->GetColorAdjustment = IDirectFBVideoProvider_V4L_GetColorAdjustment;
+     thiz->SetColorAdjustment = IDirectFBVideoProvider_V4L_SetColorAdjustment;
+     thiz->SendEvent = IDirectFBVideoProvider_V4L_SendEvent;
+
+     return DFB_OK;
+}
+
+
+/*****************/
+
+/*
+ * bogus thread to generate callback,
+ * because video4linux does not support syncing in overlay mode
+ */
+static void *
+OverlayThread( DirectThread *thread, void *ctx )
+{
+     IDirectFBVideoProvider_V4L_data *data = (IDirectFBVideoProvider_V4L_data*)ctx;
+
+     int field = 0;
+     struct timeval tv;
+
+     while (data->running) {
+          tv.tv_sec = 0;
+          tv.tv_usec = 20000;
+          select( 0, 0, 0, 0, &tv );
+
+          if (!data->running)
+               break;
+
+          if (data->destination &&
+              (data->destination->config.caps & DSCAPS_INTERLACED)) {
+               dfb_surface_set_field( data->destination, field );
+
+               field = !field;
+          }
+
+          if (!data->running)
+               break;
+
+          if (data->callback)
+               data->callback( data->ctx );
+     }
+
+     return NULL;
+}
+
+/*
+ * thread to capture data from v4l buffers and generate callback
+ */
+static void *
+GrabThread( DirectThread *thread, void *ctx )
+{
+     IDirectFBVideoProvider_V4L_data *data = (IDirectFBVideoProvider_V4L_data*)ctx;
+     CoreSurface *surface = data->destination;
+     void *src, *dst;
+     int dst_pitch, src_pitch, h;
+     int frame = 0;
+
+     D_DEBUG( "DirectFB/Video4Linux: %s started.\n", __FUNCTION__ );
+
+     src_pitch = DFB_BYTES_PER_LINE( surface->config.format, surface->config.size.w );
+
+     while (frame < data->vmbuf.frames) {
+          data->vmmap.frame = frame;
+          ioctl( data->fd, VIDIOCMCAPTURE, &data->vmmap );
+          frame++;
+     }
+
+     if (dfb_surface_ref( surface )) {
+          D_ERROR( "DirectFB/Video4Linux: dfb_surface_ref() failed!\n" );
+          return NULL;
+     }
+
+     frame = 0;
+     while (data->running) {
+          ioctl( data->fd, VIDIOCSYNC, &frame );
+
+          if (!data->running)
+               break;
+
+          h = surface->config.size.h;
+          src = data->buffer + data->vmbuf.offsets[frame];
+          
+          dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU,
+                                   CSAF_WRITE, &data->destinationlock );
+          dst       = data->destinationlock.addr;
+          dst_pitch = data->destinationlock.pitch;
+
+          while (h--) {
+               direct_memcpy( dst, src, src_pitch );
+               dst += dst_pitch;
+               src += src_pitch;
+          }
+          if (surface->config.format == DSPF_I420) {
+               h = surface->config.size.h;
+               while (h--) {
+                    direct_memcpy( dst, src, src_pitch >> 1 );
+                    dst += dst_pitch >> 1;
+                    src += src_pitch >> 1;
+               }
+          }
+          else if (surface->config.format == DSPF_YV12) {
+               h = surface->config.size.h >> 1;
+               src += h * (src_pitch >> 1);
+               while (h--) {
+                    direct_memcpy( dst, src, src_pitch >> 1 );
+                    dst += dst_pitch >> 1;
+                    src += src_pitch >> 1;
+               }
+               h = surface->config.size.h >> 1;
+               src -=  2 * h * (src_pitch >> 1);
+               while (h--) {
+                    direct_memcpy( dst, src, src_pitch >> 1 );
+                    dst += dst_pitch >> 1;
+                    src += src_pitch >> 1;
+               }
+          }
+          dfb_surface_unlock_buffer( surface, &data->destinationlock );
+
+          data->vmmap.frame = frame;
+          ioctl( data->fd, VIDIOCMCAPTURE, &data->vmmap );
+
+          if (!data->running)
+               break;
+
+          if (surface->config.caps & DSCAPS_INTERLACED)
+               dfb_surface_set_field( surface, 0 );
+
+          if (data->callback)
+               data->callback( data->ctx );
+
+          if (!data->running)
+               break;
+
+          sched_yield();
+
+          if (surface->config.caps & DSCAPS_INTERLACED) {
+               if (!data->running)
+                    break;
+
+               dfb_surface_set_field( surface, 1 );
+
+               if (data->callback)
+                    data->callback( data->ctx );
+
+               if (!data->running)
+                    break;
+
+               sched_yield();
+          }
+
+          if (++frame == data->vmbuf.frames)
+               frame = 0;
+     }
+
+     dfb_surface_unref( surface );
+
+     return NULL;
+}
+
+static ReactionResult
+v4l_videosurface_listener( const void *msg_data, void *ctx )
+{
+//     const CoreSurfaceNotification   *notification = msg_data;
+//     IDirectFBVideoProvider_V4L_data *data         = ctx;
+//     CoreSurface                     *surface      = notification->surface;
+
+     /*
+     if ((notification->flags & CSNF_SIZEFORMAT) ||
+         (surface->back_buffer->video.health != CSH_STORED)) {
+          v4l_stop( data, false );
+          return RS_REMOVE;
+     }
+     */
+     
+     return RS_OK;
+}
+
+static ReactionResult
+v4l_systemsurface_listener( const void *msg_data, void *ctx )
+{
+//     const CoreSurfaceNotification   *notification = msg_data;
+//     IDirectFBVideoProvider_V4L_data *data         = ctx;
+//     CoreSurface                     *surface      = notification->surface;
+
+     /*
+     if ((notification->flags & CSNF_SIZEFORMAT) ||
+         (surface->back_buffer->system.health != CSH_STORED &&
+          surface->back_buffer->video.health != CSH_STORED)) {
+          v4l_stop( data, false );
+          return RS_REMOVE;
+     }
+     */
+
+     return RS_OK;
+}
+
+
+/************/
+
+static DFBResult
+v4l_to_surface_overlay( CoreSurface *surface, DFBRectangle *rect,
+                        IDirectFBVideoProvider_V4L_data *data )
+{
+     int bpp, palette;
+
+     D_DEBUG( "DirectFB/Video4Linux: %s (%p, %d,%d - %dx%d)\n", __FUNCTION__,
+              surface, rect->x, rect->y, rect->w, rect->h );
+
+     /*
+      * Sanity check. Overlay to system surface isn't possible.
+      */
+     if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          return DFB_UNSUPPORTED;
+
+     switch (surface->config.format) {
+          case DSPF_YUY2:
+               bpp = 16;
+               palette = VIDEO_PALETTE_YUYV;
+               break;
+          case DSPF_UYVY:
+               bpp = 16;
+               palette = VIDEO_PALETTE_UYVY;
+               break;
+          case DSPF_I420:
+               bpp = 8;
+               palette = VIDEO_PALETTE_YUV420P;
+               break;
+          case DSPF_ARGB1555:
+               bpp = 15;
+               palette = VIDEO_PALETTE_RGB555;
+               break;
+          case DSPF_RGB16:
+               bpp = 16;
+               palette = VIDEO_PALETTE_RGB565;
+               break;
+          case DSPF_RGB24:
+               bpp = 24;
+               palette = VIDEO_PALETTE_RGB24;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_RGB32:
+               bpp = 32;
+               palette = VIDEO_PALETTE_RGB32;
+               break;
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     {
+          struct video_buffer b;
+
+          /* in overlay mode, the destinationlock is already taken
+           * and pointing to the back buffer */
+          CoreSurfaceBufferLock *lock = &data->destinationlock;
+
+          b.base = (void*)dfb_gfxcard_memory_physical( NULL, lock->offset );
+          b.width = lock->pitch / ((bpp + 7) / 8);
+          b.height = surface->config.size.h;
+          b.depth = bpp;
+          b.bytesperline = lock->pitch;
+
+          if (ioctl( data->fd, VIDIOCSFBUF, &b ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCSFBUF failed, must run being root!\n" );
+
+               return ret;
+          }
+     }
+     {
+          struct video_picture p;
+
+          if (ioctl( data->fd, VIDIOCGPICT, &p ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCGPICT failed!\n" );
+
+               return ret;
+          }
+
+          p.depth = bpp;
+          p.palette = palette;
+
+          if (ioctl( data->fd, VIDIOCSPICT, &p ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCSPICT failed!\n" );
+
+               return ret;
+          }
+     }
+     {
+          struct video_window win;
+
+          win.width = rect->w;
+          win.height = rect->h;
+          win.x = rect->x;
+          win.y = rect->y;
+          win.flags = 0;
+          win.clips = NULL;
+          win.clipcount = 0;
+          win.chromakey = 0;
+
+          if (ioctl( data->fd, VIDIOCSWIN, &win ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux: VIDIOCSWIN failed!\n" );
+
+               return ret;
+          }
+     }
+
+     if (!data->cleanup)
+          data->cleanup = dfb_core_cleanup_add( NULL, v4l_cleanup, data, true );
+
+     if (ioctl( data->fd, VIDIOCCAPTURE, &one ) < 0) {
+          DFBResult ret = errno2result( errno );
+
+          D_PERROR( "DirectFB/Video4Linux: Could not start capturing (VIDIOCCAPTURE failed)!\n" );
+
+          return ret;
+     }
+
+     data->destination = surface;
+
+     dfb_surface_attach( surface, v4l_videosurface_listener,
+                         data, &data->reaction );
+
+     data->running = true;
+
+     if (data->callback || (surface->config.caps & DSCAPS_INTERLACED))
+          data->thread = direct_thread_create( DTT_CRITICAL, OverlayThread, data, "V4L Overlay" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+v4l_to_surface_grab( CoreSurface *surface, DFBRectangle *rect,
+                     IDirectFBVideoProvider_V4L_data *data )
+{
+     int palette;
+
+     D_DEBUG( "DirectFB/Video4Linux: %s...\n", __FUNCTION__ );
+
+     if (!data->vmbuf.frames)
+          return DFB_UNSUPPORTED;
+
+     switch (surface->config.format) {
+          case DSPF_YUY2:
+               palette = VIDEO_PALETTE_YUYV;
+               break;
+          case DSPF_UYVY:
+               palette = VIDEO_PALETTE_UYVY;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+               palette = VIDEO_PALETTE_YUV420P;
+               break;
+          case DSPF_ARGB1555:
+               palette = VIDEO_PALETTE_RGB555;
+               break;
+          case DSPF_RGB16:
+               palette = VIDEO_PALETTE_RGB565;
+               break;
+          case DSPF_RGB24:
+               palette = VIDEO_PALETTE_RGB24;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_RGB32:
+               palette = VIDEO_PALETTE_RGB32;
+               break;
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     data->vmmap.width = surface->config.size.w;
+     data->vmmap.height = surface->config.size.h;
+     data->vmmap.format = palette;
+     data->vmmap.frame = 0;
+     if (ioctl( data->fd, VIDIOCMCAPTURE, &data->vmmap ) < 0) {
+          DFBResult ret = errno2result( errno );
+
+          D_PERROR( "DirectFB/Video4Linux: Could not start capturing (VIDIOCMCAPTURE failed)!\n" );
+
+          return ret;
+     }
+
+     if (!data->cleanup)
+          data->cleanup = dfb_core_cleanup_add( NULL, v4l_cleanup, data, true );
+
+     data->destination = surface;
+
+     dfb_surface_attach( surface, v4l_systemsurface_listener,
+                         data, &data->reaction );
+
+     data->running = true;
+
+     data->thread = direct_thread_create( DTT_INPUT, GrabThread, data, "V4L Grabber" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+v4l_stop( IDirectFBVideoProvider_V4L_data *data, bool detach )
+{
+     CoreSurface *destination;
+
+     D_DEBUG( "DirectFB/Video4Linux: %s...\n", __FUNCTION__ );
+
+     pthread_mutex_lock( &data->lock );
+
+     if (!data->running) {
+          pthread_mutex_unlock( &data->lock );
+          return DFB_OK;
+     }
+
+     if (data->thread) {
+          data->running = false;
+          direct_thread_join( data->thread );
+          direct_thread_destroy( data->thread );
+          data->thread = NULL;
+     }
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          /* turn off streaming */
+          int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+          int err = ioctl( data->fd, VIDIOC_STREAMOFF, &type );
+          if (err) {
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_STREAMOFF.\n" );
+               /* don't quit here */
+          }
+     }
+     else
+#endif
+     {
+          if (!data->grab_mode) {
+               if (ioctl( data->fd, VIDIOCCAPTURE, &zero ) < 0)
+                    D_PERROR( "DirectFB/Video4Linux: "
+                              "Could not stop capturing (VIDIOCCAPTURE failed)!\n" );
+          }
+     }
+
+     destination = data->destination;
+
+     if (!destination) {
+          pthread_mutex_unlock( &data->lock );
+          return DFB_OK;
+     }
+
+#ifdef DFB_HAVE_V4L2
+     if (data->is_v4l2) {
+          /* unmap all buffers, if necessary */
+          if (data->framebuffer_or_system) {
+               int i;
+               for (i = 0; i < data->req.count; i++) {
+                    struct v4l2_buffer *vidbuf = &data->vidbuf[i];
+                    D_DEBUG( "DirectFB/Video4Linux2: %d => 0x%08x, len:%d\n", i, (u32) data->ptr[i], vidbuf->length );
+                    if (munmap( data->ptr[i], vidbuf->length )) {
+                         D_PERROR( "DirectFB/Video4Linux2: munmap().\n" );
+                    }
+               }
+          }
+          else {
+               dfb_surface_unlock_buffer( destination, &data->destinationlock );
+          }
+     }
+     else
+#endif
+     {
+          if (!data->grab_mode)
+               dfb_surface_unlock_buffer( destination, &data->destinationlock );
+     }
+
+     data->destination = NULL;
+
+     pthread_mutex_unlock( &data->lock );
+
+     if (detach)
+          dfb_surface_detach( destination, &data->reaction );
+
+     return DFB_OK;
+}
+
+static void
+v4l_deinit( IDirectFBVideoProvider_V4L_data *data )
+{
+     if (data->fd == -1) {
+          D_BUG( "v4l_deinit with 'fd == -1'" );
+          return;
+     }
+
+     v4l_stop( data, true );
+
+     munmap( data->buffer, data->vmbuf.size );
+     close( data->fd );
+     data->fd = -1;
+}
+
+static void
+v4l_cleanup( void *ctx, int emergency )
+{
+     IDirectFBVideoProvider_V4L_data *data =
+     (IDirectFBVideoProvider_V4L_data*)ctx;
+
+     if (emergency)
+          v4l_stop( data, false );
+     else
+          v4l_deinit( data );
+}
+
+/* v4l2 specific stuff */
+#ifdef DFB_HAVE_V4L2
+static int
+wait_for_buffer( int vid, struct v4l2_buffer *cur )
+{
+     fd_set rdset;
+     struct timeval timeout;
+     int n, err;
+
+//	D_DEBUG("DirectFB/Video4Linux2: %s...\n", __FUNCTION__);
+
+     cur->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+     FD_ZERO( &rdset );
+     FD_SET( vid, &rdset );
+
+     timeout.tv_sec = 5;
+     timeout.tv_usec = 0;
+
+     n = select( vid + 1, &rdset, NULL, NULL, &timeout );
+     if (n == -1) {
+          D_PERROR( "DirectFB/Video4Linux2: select().\n" );
+          return -1;     /* fixme */
+     }
+     else if (n == 0) {
+          D_PERROR( "DirectFB/Video4Linux2: select(), timeout.\n" );
+          return -1;     /* fixme */
+     }
+     else if (FD_ISSET( vid, &rdset )) {
+          err = ioctl( vid, VIDIOC_DQBUF, cur );
+          if (err) {
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_DQBUF.\n" );
+               return -1;     /* fixme */
+          }
+     }
+     return 0;
+}
+
+static void *
+V4L2_Thread( DirectThread *thread, void *ctx )
+{
+     int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+     int i, err;
+
+     IDirectFBVideoProvider_V4L_data *data = (IDirectFBVideoProvider_V4L_data *) ctx;
+     CoreSurface *surface = data->destination;
+     void *src, *dst;
+     int dst_pitch, src_pitch, h;
+
+     D_DEBUG( "DirectFB/Video4Linux2: %s started.\n", __FUNCTION__ );
+
+     src_pitch = DFB_BYTES_PER_LINE( surface->config.format, surface->config.size.w );
+
+     /* Queue all buffers */
+     for (i = 0; i < data->req.count; i++) {
+          struct v4l2_buffer *vidbuf = &data->vidbuf[i];
+
+          if (!data->framebuffer_or_system) {
+               vidbuf->m.offset = data->destinationlock.offset;
+          }
+
+          err = ioctl( data->fd, VIDIOC_QBUF, vidbuf );
+          if (err) {
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_QBUF.\n" );
+               return NULL;
+          }
+     }
+
+     /* start streaming */
+     if (ioctl( data->fd, VIDIOC_STREAMON, &type )) {
+          D_PERROR( "DirectFB/Video4Linux2: VIDIOC_STREAMON.\n" );
+          return NULL;   /* fixme */
+     }
+
+     while (data->running) {
+
+          struct v4l2_buffer cur;
+
+          if (wait_for_buffer( data->fd, &cur )) {
+               return NULL;
+          }
+
+          if (data->framebuffer_or_system) {
+               CoreSurfaceBufferLock lock;
+
+               D_DEBUG( "DirectFB/Video4Linux2: index:%d, to system memory.\n", cur.index );
+
+               h = surface->config.size.h;
+               src = data->ptr[cur.index];
+
+               dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+               dst       = lock.addr;
+               dst_pitch = lock.pitch;
+               while (h--) {
+                    direct_memcpy( dst, src, src_pitch );
+                    dst += dst_pitch;
+                    src += src_pitch;
+               }
+               if (surface->config.format == DSPF_I420) {
+                    h = surface->config.size.h;
+                    while (h--) {
+                         direct_memcpy( dst, src, src_pitch >> 1 );
+                         dst += dst_pitch >> 1;
+                         src += src_pitch >> 1;
+                    }
+               }
+               else if (surface->config.format == DSPF_YV12) {
+                    h = surface->config.size.h >> 1;
+                    src += h * (src_pitch >> 1);
+                    while (h--) {
+                         direct_memcpy( dst, src, src_pitch >> 1 );
+                         dst += dst_pitch >> 1;
+                         src += src_pitch >> 1;
+                    }
+                    h = surface->config.size.h >> 1;
+                    src -= 2 * h * (src_pitch >> 1);
+                    while (h--) {
+                         direct_memcpy( dst, src, src_pitch >> 1 );
+                         dst += dst_pitch >> 1;
+                         src += src_pitch >> 1;
+                    }
+               }
+               else if (surface->config.format == DSPF_NV12 ||
+                        surface->config.format == DSPF_NV21) {
+                    h = surface->config.size.h >> 1;
+                    while (h--) {
+                         direct_memcpy( dst, src, src_pitch );
+                         dst += dst_pitch;
+                         src += src_pitch;
+                    }
+               }
+               dfb_surface_unlock_buffer( surface, &lock );
+          }
+          else {
+               D_DEBUG( "DirectFB/Video4Linux2: index:%d, to overlay surface\n", cur.index );
+          }
+
+          if (data->callback)
+               data->callback( data->ctx );
+
+          if (ioctl( data->fd, VIDIOC_QBUF, &cur )) {
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_QBUF.\n" );
+               return NULL;
+          }
+     }
+
+     return NULL;
+}
+
+static DFBResult
+v4l2_playto( CoreSurface *surface, DFBRectangle *rect, IDirectFBVideoProvider_V4L_data *data )
+{
+     int palette;
+
+     int err;
+     int i;
+
+     D_DEBUG( "DirectFB/Video4Linux2: %s...\n", __FUNCTION__ );
+
+     switch (surface->config.format) {
+          case DSPF_YUY2:
+               palette = V4L2_PIX_FMT_YUYV;
+               break;
+          case DSPF_UYVY:
+               palette = V4L2_PIX_FMT_UYVY;
+               break;
+          case DSPF_I420:
+               palette = V4L2_PIX_FMT_YUV420;
+               break;
+          case DSPF_YV12:
+               palette = V4L2_PIX_FMT_YVU420;
+               break;
+          case DSPF_NV12:
+               palette = V4L2_PIX_FMT_NV12;
+               break;
+          case DSPF_NV21:
+               palette = V4L2_PIX_FMT_NV21;
+               break;
+          case DSPF_RGB332:
+               palette = V4L2_PIX_FMT_RGB332;
+               break;
+          case DSPF_ARGB1555:
+               palette = V4L2_PIX_FMT_RGB555;
+               break;
+          case DSPF_RGB16:
+               palette = V4L2_PIX_FMT_RGB565;
+               break;
+          case DSPF_RGB24:
+               palette = V4L2_PIX_FMT_BGR24;
+               break;
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+          case DSPF_RGB32:
+               palette = V4L2_PIX_FMT_BGR32;
+               break;
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     err = dfb_surface_lock_buffer( surface, CSBR_BACK, CSAID_GPU, CSAF_WRITE, &data->destinationlock );
+     if (err)
+          return err;
+
+     data->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+     data->fmt.fmt.pix.width = surface->config.size.w;
+     data->fmt.fmt.pix.height = surface->config.size.h;
+     data->fmt.fmt.pix.pixelformat = palette;
+     data->fmt.fmt.pix.bytesperline = data->destinationlock.pitch;
+     data->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; /* fixme: we can do field based capture, too */
+
+     D_DEBUG( "DirectFB/Video4Linux2: surface->config.size.w:%d, surface->config.size.h:%d.\n", surface->config.size.w, surface->config.size.h );
+
+     err = ioctl( data->fd, VIDIOC_S_FMT, &data->fmt );
+     if (err) {
+          D_PERROR( "DirectFB/Video4Linux2: VIDIOC_S_FMT.\n" );
+          dfb_surface_unlock_buffer( surface, &data->destinationlock );
+          return err;
+     }
+
+     if (data->fmt.fmt.pix.width != surface->config.size.w || data->fmt.fmt.pix.height != surface->config.size.h) {
+          D_PERROR( "DirectFB/Video4Linux2: driver cannot fulfill application request.\n" );
+          dfb_surface_unlock_buffer( surface, &data->destinationlock );
+          return DFB_UNSUPPORTED;  /* fixme */
+     }
+
+     if (data->brightness.id) {
+          ioctl( data->fd, VIDIOC_G_CTRL, &data->brightness );
+     }
+     if (data->contrast.id) {
+          ioctl( data->fd, VIDIOC_G_CTRL, &data->contrast );
+     }
+     if (data->saturation.id) {
+          ioctl( data->fd, VIDIOC_G_CTRL, &data->saturation );
+     }
+     if (data->hue.id) {
+          ioctl( data->fd, VIDIOC_G_CTRL, &data->hue );
+     }
+
+     if (surface->config.caps & DSCAPS_SYSTEMONLY) {
+          data->framebuffer_or_system = 1;
+          data->req.memory = V4L2_MEMORY_MMAP;
+          dfb_surface_unlock_buffer( surface, &data->destinationlock );
+     }
+     else {
+          struct v4l2_framebuffer fb;
+
+          data->framebuffer_or_system = 0;
+          data->req.memory = V4L2_MEMORY_OVERLAY;
+
+          fb.base = (void *) dfb_gfxcard_memory_physical( NULL, 0 );
+          fb.fmt.width = surface->config.size.w;
+          fb.fmt.height = surface->config.size.h;
+          fb.fmt.pixelformat = palette;
+
+          D_DEBUG( "w:%d, h:%d, bpl:%d, base:0x%08lx\n",
+                   fb.fmt.width, fb.fmt.height, fb.fmt.bytesperline, (unsigned long)fb.base );
+
+          if (ioctl( data->fd, VIDIOC_S_FBUF, &fb ) < 0) {
+               DFBResult ret = errno2result( errno );
+
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_S_FBUF failed, must run being root!\n" );
+
+               dfb_surface_unlock_buffer( surface, &data->destinationlock );
+               return ret;
+          }
+     }
+
+     /* Ask Video Device for Buffers */
+     data->req.count = NUMBER_OF_BUFFERS;
+     data->req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+     err = ioctl( data->fd, VIDIOC_REQBUFS, &data->req );
+     if (err < 0 || data->req.count < NUMBER_OF_BUFFERS) {
+          D_PERROR( "DirectFB/Video4Linux2: VIDIOC_REQBUFS: %d, %d.\n", err, data->req.count );
+          if (!data->framebuffer_or_system)
+               dfb_surface_unlock_buffer( surface, &data->destinationlock );
+          return err;
+     }
+
+     /* Query each buffer and map it to the video device if necessary */
+     for (i = 0; i < data->req.count; i++) {
+          struct v4l2_buffer *vidbuf = &data->vidbuf[i];
+
+          vidbuf->index = i;
+          vidbuf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+          err = ioctl( data->fd, VIDIOC_QUERYBUF, vidbuf );
+          if (err < 0) {
+               D_PERROR( "DirectFB/Video4Linux2: VIDIOC_QUERYBUF.\n" );
+               if (!data->framebuffer_or_system)
+                    dfb_surface_unlock_buffer( surface, &data->destinationlock );
+               return err;
+          }
+
+/*
+          if (vidbuf->length == 0) {
+               D_PERROR( "DirectFB/Video4Linux2: length is zero!\n" );
+               return -EINVAL;
+          }
+*/
+          if (data->framebuffer_or_system) {
+               data->ptr[i] = mmap( 0, vidbuf->length, PROT_READ | PROT_WRITE, MAP_SHARED, data->fd, vidbuf->m.offset );
+               if (data->ptr[i] == MAP_FAILED) {
+                    D_PERROR( "DirectFB/Video4Linux2: mmap().\n" );
+                    if (!data->framebuffer_or_system)
+                         dfb_surface_unlock_buffer( surface, &data->destinationlock );
+                    return err;
+               }
+          }
+          D_DEBUG( "DirectFB/Video4Linux2: len:0x%08x, %d => 0x%08x\n", vidbuf->length, i, (u32) data->ptr[i] );
+     }
+
+     if (!data->cleanup)
+          data->cleanup = dfb_core_cleanup_add( NULL, v4l_cleanup, data, true );
+
+     data->destination = surface;
+
+     dfb_surface_attach( surface, v4l_systemsurface_listener, data, &data->reaction );
+
+     data->running = true;
+
+     data->thread = direct_thread_create( DTT_DEFAULT, V4L2_Thread, data, "Video4Linux 2" );
+
+     return DFB_OK;
+}
+#endif
diff --git a/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev.h b/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev.h
new file mode 100755
index 0000000..c5ad64f
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev.h
@@ -0,0 +1,353 @@
+#ifndef __LINUX_VIDEODEV_H
+#define __LINUX_VIDEODEV_H
+
+#include <linux/types.h>
+#include <linux/version.h>
+
+#define HAVE_V4L2 1
+#include "videodev2.h"
+
+#define VID_TYPE_CAPTURE	1	/* Can capture */
+#define VID_TYPE_TUNER		2	/* Can tune */
+#define VID_TYPE_TELETEXT	4	/* Does teletext */
+#define VID_TYPE_OVERLAY	8	/* Overlay onto frame buffer */
+#define VID_TYPE_CHROMAKEY	16	/* Overlay by chromakey */
+#define VID_TYPE_CLIPPING	32	/* Can clip */
+#define VID_TYPE_FRAMERAM	64	/* Uses the frame buffer memory */
+#define VID_TYPE_SCALES		128	/* Scalable */
+#define VID_TYPE_MONOCHROME	256	/* Monochrome only */
+#define VID_TYPE_SUBCAPTURE	512	/* Can capture subareas of the image */
+#define VID_TYPE_MPEG_DECODER	1024	/* Can decode MPEG streams */
+#define VID_TYPE_MPEG_ENCODER	2048	/* Can encode MPEG streams */
+#define VID_TYPE_MJPEG_DECODER	4096	/* Can decode MJPEG streams */
+#define VID_TYPE_MJPEG_ENCODER	8192	/* Can encode MJPEG streams */
+
+struct video_capability
+{
+	char name[32];
+	int type;
+	int channels;	/* Num channels */
+	int audios;	/* Num audio devices */
+	int maxwidth;	/* Supported width */
+	int maxheight;	/* And height */
+	int minwidth;	/* Supported width */
+	int minheight;	/* And height */
+};
+
+
+struct video_channel
+{
+	int channel;
+	char name[32];
+	int tuners;
+	__u32  flags;
+#define VIDEO_VC_TUNER		1	/* Channel has a tuner */
+#define VIDEO_VC_AUDIO		2	/* Channel has audio */
+	__u16  type;
+#define VIDEO_TYPE_TV		1
+#define VIDEO_TYPE_CAMERA	2	
+	__u16 norm;			/* Norm set by channel */
+};
+
+struct video_tuner
+{
+	int tuner;
+	char name[32];
+	unsigned long rangelow, rangehigh;	/* Tuner range */
+	__u32 flags;
+#define VIDEO_TUNER_PAL		1
+#define VIDEO_TUNER_NTSC	2
+#define VIDEO_TUNER_SECAM	4
+#define VIDEO_TUNER_LOW		8	/* Uses KHz not MHz */
+#define VIDEO_TUNER_NORM	16	/* Tuner can set norm */
+#define VIDEO_TUNER_STEREO_ON	128	/* Tuner is seeing stereo */
+#define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
+#define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
+	__u16 mode;			/* PAL/NTSC/SECAM/OTHER */
+#define VIDEO_MODE_PAL		0
+#define VIDEO_MODE_NTSC		1
+#define VIDEO_MODE_SECAM	2
+#define VIDEO_MODE_AUTO		3
+	__u16 signal;			/* Signal strength 16bit scale */
+};
+
+struct video_picture
+{
+	__u16	brightness;
+	__u16	hue;
+	__u16	colour;
+	__u16	contrast;
+	__u16	whiteness;	/* Black and white only */
+	__u16	depth;		/* Capture depth */
+	__u16   palette;	/* Palette in use */
+#define VIDEO_PALETTE_GREY	1	/* Linear greyscale */
+#define VIDEO_PALETTE_HI240	2	/* High 240 cube (BT848) */
+#define VIDEO_PALETTE_RGB565	3	/* 565 16 bit RGB */
+#define VIDEO_PALETTE_RGB24	4	/* 24bit RGB */
+#define VIDEO_PALETTE_RGB32	5	/* 32bit RGB */	
+#define VIDEO_PALETTE_RGB555	6	/* 555 15bit RGB */
+#define VIDEO_PALETTE_YUV422	7	/* YUV422 capture */
+#define VIDEO_PALETTE_YUYV	8
+#define VIDEO_PALETTE_UYVY	9	/* The great thing about standards is ... */
+#define VIDEO_PALETTE_YUV420	10
+#define VIDEO_PALETTE_YUV411	11	/* YUV411 capture */
+#define VIDEO_PALETTE_RAW	12	/* RAW capture (BT848) */
+#define VIDEO_PALETTE_YUV422P	13	/* YUV 4:2:2 Planar */
+#define VIDEO_PALETTE_YUV411P	14	/* YUV 4:1:1 Planar */
+#define VIDEO_PALETTE_YUV420P	15	/* YUV 4:2:0 Planar */
+#define VIDEO_PALETTE_YUV410P	16	/* YUV 4:1:0 Planar */
+#define VIDEO_PALETTE_PLANAR	13	/* start of planar entries */
+#define VIDEO_PALETTE_COMPONENT 7	/* start of component entries */
+};
+
+struct video_audio
+{
+	int	audio;		/* Audio channel */
+	__u16	volume;		/* If settable */
+	__u16	bass, treble;
+	__u32	flags;
+#define VIDEO_AUDIO_MUTE	1
+#define VIDEO_AUDIO_MUTABLE	2
+#define VIDEO_AUDIO_VOLUME	4
+#define VIDEO_AUDIO_BASS	8
+#define VIDEO_AUDIO_TREBLE	16	
+#define VIDEO_AUDIO_BALANCE	32
+	char    name[16];
+#define VIDEO_SOUND_MONO	1
+#define VIDEO_SOUND_STEREO	2
+#define VIDEO_SOUND_LANG1	4
+#define VIDEO_SOUND_LANG2	8
+        __u16   mode;
+        __u16	balance;	/* Stereo balance */
+        __u16	step;		/* Step actual volume uses */
+};
+
+struct video_clip
+{
+	__s32	x,y;
+	__s32	width, height;
+	struct	video_clip *next;	/* For user use/driver use only */
+};
+
+struct video_window
+{
+	__u32	x,y;			/* Position of window */
+	__u32	width,height;		/* Its size */
+	__u32	chromakey;
+	__u32	flags;
+	struct	video_clip *clips;	/* Set only */
+	int	clipcount;
+#define VIDEO_WINDOW_INTERLACE	1
+#define VIDEO_WINDOW_CHROMAKEY	16	/* Overlay by chromakey */
+#define VIDEO_CLIP_BITMAP	-1
+/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
+#define VIDEO_CLIPMAP_SIZE	(128 * 625)
+};
+
+struct video_capture
+{
+	__u32 	x,y;			/* Offsets into image */
+	__u32	width, height;		/* Area to capture */
+	__u16	decimation;		/* Decimation divider */
+	__u16	flags;			/* Flags for capture */
+#define VIDEO_CAPTURE_ODD		0	/* Temporal */
+#define VIDEO_CAPTURE_EVEN		1
+};
+
+struct video_buffer
+{
+	void	*base;
+	int	height,width;
+	int	depth;
+	int	bytesperline;
+};
+
+struct video_mmap
+{
+	unsigned	int frame;		/* Frame (0 - n) for double buffer */
+	int		height,width;
+	unsigned	int format;		/* should be VIDEO_PALETTE_* */
+};
+
+struct video_key
+{
+	__u8	key[8];
+	__u32	flags;
+};
+
+
+#define VIDEO_MAX_FRAME		32
+
+struct video_mbuf
+{
+	int	size;		/* Total memory to map */
+	int	frames;		/* Frames */
+	int	offsets[VIDEO_MAX_FRAME];
+};
+	
+
+#define 	VIDEO_NO_UNIT	(-1)
+
+	
+struct video_unit
+{
+	int 	video;		/* Video minor */
+	int	vbi;		/* VBI minor */
+	int	radio;		/* Radio minor */
+	int	audio;		/* Audio minor */
+	int	teletext;	/* Teletext minor */
+};
+
+struct vbi_format {
+	__u32	sampling_rate;	/* in Hz */
+	__u32	samples_per_line;
+	__u32	sample_format;	/* VIDEO_PALETTE_RAW only (1 byte) */
+	__s32	start[2];	/* starting line for each frame */
+	__u32	count[2];	/* count of lines for each frame */
+	__u32	flags;
+#define	VBI_UNSYNC	1	/* can distingues between top/bottom field */
+#define	VBI_INTERLACED	2	/* lines are interlaced */
+};
+
+/* video_info is biased towards hardware mpeg encode/decode */
+/* but it could apply generically to any hardware compressor/decompressor */
+struct video_info
+{
+	__u32	frame_count;	/* frames output since decode/encode began */
+	__u32	h_size;		/* current unscaled horizontal size */
+	__u32	v_size;		/* current unscaled veritcal size */
+	__u32	smpte_timecode;	/* current SMPTE timecode (for current GOP) */
+	__u32	picture_type;	/* current picture type */
+	__u32	temporal_reference;	/* current temporal reference */
+	__u8	user_data[256];	/* user data last found in compressed stream */
+	/* user_data[0] contains user data flags, user_data[1] has count */
+};
+
+/* generic structure for setting playback modes */
+struct video_play_mode
+{
+	int	mode;
+	int	p1;
+	int	p2;
+};
+
+/* for loading microcode / fpga programming */
+struct video_code
+{
+	char	loadwhat[16];	/* name or tag of file being passed */
+	int	datasize;
+	__u8	*data;
+};
+
+#define VIDIOCGCAP		_IOR('v',1,struct video_capability)	/* Get capabilities */
+#define VIDIOCGCHAN		_IOWR('v',2,struct video_channel)	/* Get channel info (sources) */
+#define VIDIOCSCHAN		_IOW('v',3,struct video_channel)	/* Set channel 	*/
+#define VIDIOCGTUNER		_IOWR('v',4,struct video_tuner)		/* Get tuner abilities */
+#define VIDIOCSTUNER		_IOW('v',5,struct video_tuner)		/* Tune the tuner for the current channel */
+#define VIDIOCGPICT		_IOR('v',6,struct video_picture)	/* Get picture properties */
+#define VIDIOCSPICT		_IOW('v',7,struct video_picture)	/* Set picture properties */
+#define VIDIOCCAPTURE		_IOW('v',8,int)				/* Start, end capture */
+#define VIDIOCGWIN		_IOR('v',9, struct video_window)	/* Get the video overlay window */
+#define VIDIOCSWIN		_IOW('v',10, struct video_window)	/* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
+#define VIDIOCGFBUF		_IOR('v',11, struct video_buffer)	/* Get frame buffer */
+#define VIDIOCSFBUF		_IOW('v',12, struct video_buffer)	/* Set frame buffer - root only */
+#define VIDIOCKEY		_IOR('v',13, struct video_key)		/* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
+#define VIDIOCGFREQ		_IOR('v',14, unsigned long)		/* Set tuner */
+#define VIDIOCSFREQ		_IOW('v',15, unsigned long)		/* Set tuner */
+#define VIDIOCGAUDIO		_IOR('v',16, struct video_audio)	/* Get audio info */
+#define VIDIOCSAUDIO		_IOW('v',17, struct video_audio)	/* Audio source, mute etc */
+#define VIDIOCSYNC		_IOW('v',18, int)			/* Sync with mmap grabbing */
+#define VIDIOCMCAPTURE		_IOW('v',19, struct video_mmap)		/* Grab frames */
+#define VIDIOCGMBUF		_IOR('v',20, struct video_mbuf)		/* Memory map buffer info */
+#define VIDIOCGUNIT		_IOR('v',21, struct video_unit)		/* Get attached units */
+#define VIDIOCGCAPTURE		_IOR('v',22, struct video_capture)	/* Get subcapture */
+#define VIDIOCSCAPTURE		_IOW('v',23, struct video_capture)	/* Set subcapture */
+#define VIDIOCSPLAYMODE		_IOW('v',24, struct video_play_mode)	/* Set output video mode/feature */
+#define VIDIOCSWRITEMODE	_IOW('v',25, int)			/* Set write mode */
+#define VIDIOCGPLAYINFO		_IOR('v',26, struct video_info)		/* Get current playback info from hardware */
+#define VIDIOCSMICROCODE	_IOW('v',27, struct video_code)		/* Load microcode into hardware */
+#define	VIDIOCGVBIFMT		_IOR('v',28, struct vbi_format)		/* Get VBI information */
+#define	VIDIOCSVBIFMT		_IOW('v',29, struct vbi_format)		/* Set VBI information */
+
+
+#define BASE_VIDIOCPRIVATE	192		/* 192-255 are private */
+
+/* VIDIOCSWRITEMODE */
+#define VID_WRITE_MPEG_AUD		0
+#define VID_WRITE_MPEG_VID		1
+#define VID_WRITE_OSD			2
+#define VID_WRITE_TTX			3
+#define VID_WRITE_CC			4
+#define VID_WRITE_MJPEG			5
+
+/* VIDIOCSPLAYMODE */
+#define VID_PLAY_VID_OUT_MODE		0
+	/* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
+#define VID_PLAY_GENLOCK		1
+	/* p1: 0 = OFF, 1 = ON */
+	/* p2: GENLOCK FINE DELAY value */ 
+#define VID_PLAY_NORMAL			2
+#define VID_PLAY_PAUSE			3
+#define VID_PLAY_SINGLE_FRAME		4
+#define VID_PLAY_FAST_FORWARD		5
+#define VID_PLAY_SLOW_MOTION		6
+#define VID_PLAY_IMMEDIATE_NORMAL	7
+#define VID_PLAY_SWITCH_CHANNELS	8
+#define VID_PLAY_FREEZE_FRAME		9
+#define VID_PLAY_STILL_MODE		10
+#define VID_PLAY_MASTER_MODE		11
+	/* p1: see below */
+#define		VID_PLAY_MASTER_NONE	1
+#define		VID_PLAY_MASTER_VIDEO	2
+#define		VID_PLAY_MASTER_AUDIO	3
+#define VID_PLAY_ACTIVE_SCANLINES	12
+	/* p1 = first active; p2 = last active */
+#define VID_PLAY_RESET			13
+#define VID_PLAY_END_MARK		14
+
+
+
+#define VID_HARDWARE_BT848	1
+#define VID_HARDWARE_QCAM_BW	2
+#define VID_HARDWARE_PMS	3
+#define VID_HARDWARE_QCAM_C	4
+#define VID_HARDWARE_PSEUDO	5
+#define VID_HARDWARE_SAA5249	6
+#define VID_HARDWARE_AZTECH	7
+#define VID_HARDWARE_SF16MI	8
+#define VID_HARDWARE_RTRACK	9
+#define VID_HARDWARE_ZOLTRIX	10
+#define VID_HARDWARE_SAA7146    11
+#define VID_HARDWARE_VIDEUM	12	/* Reserved for Winnov videum */
+#define VID_HARDWARE_RTRACK2	13
+#define VID_HARDWARE_PERMEDIA2	14	/* Reserved for Permedia2 */
+#define VID_HARDWARE_RIVA128	15	/* Reserved for RIVA 128 */
+#define VID_HARDWARE_PLANB	16	/* PowerMac motherboard video-in */
+#define VID_HARDWARE_BROADWAY	17	/* Broadway project */
+#define VID_HARDWARE_GEMTEK	18
+#define VID_HARDWARE_TYPHOON	19
+#define VID_HARDWARE_VINO	20	/* SGI Indy Vino */
+#define VID_HARDWARE_CADET	21	/* Cadet radio */
+#define VID_HARDWARE_TRUST	22	/* Trust FM Radio */
+#define VID_HARDWARE_TERRATEC	23	/* TerraTec ActiveRadio */
+#define VID_HARDWARE_CPIA	24
+#define VID_HARDWARE_ZR36120	25	/* Zoran ZR36120/ZR36125 */
+#define VID_HARDWARE_ZR36067	26	/* Zoran ZR36067/36060 */
+#define VID_HARDWARE_OV511	27	
+#define VID_HARDWARE_ZR356700	28	/* Zoran 36700 series */
+#define VID_HARDWARE_W9966	29
+#define VID_HARDWARE_SE401	30	/* SE401 USB webcams */
+#define VID_HARDWARE_PWC	31	/* Philips webcams */
+#define VID_HARDWARE_MEYE	32	/* Sony Vaio MotionEye cameras */
+#define VID_HARDWARE_CPIA2	33
+#define VID_HARDWARE_VICAM      34
+#define VID_HARDWARE_SF16FMR2	35
+#define VID_HARDWARE_W9968CF    36
+#define VID_HARDWARE_SAA7114H   37
+#endif /* __LINUX_VIDEODEV_H */
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev2.h b/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev2.h
new file mode 100755
index 0000000..026b836
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBVideoProvider/videodev2.h
@@ -0,0 +1,897 @@
+#ifndef __LINUX_VIDEODEV2_H
+#define __LINUX_VIDEODEV2_H
+/*
+ *	Video for Linux Two
+ *
+ *	Header file for v4l or V4L2 drivers and applications, for
+ *	Linux kernels 2.2.x or 2.4.x.
+ *
+ *	See http://bytesex.org/v4l/ for API specs and other
+ *	v4l2 documentation.
+ *
+ *	Author: Bill Dirks <bdirks@pacbell.net>
+ *		Justin Schoeman
+ *		et al.
+ */
+
+/*
+ *	M I S C E L L A N E O U S
+ */
+
+/*  Four-character-code (FOURCC) */
+#define v4l2_fourcc(a,b,c,d)\
+        (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
+
+/*
+ *	E N U M S
+ */
+enum v4l2_field {
+	V4L2_FIELD_ANY        = 0, /* driver can choose from none,
+				      top, bottom, interlaced
+				      depending on whatever it thinks
+				      is approximate ... */
+	V4L2_FIELD_NONE       = 1, /* this device has no fields ... */
+	V4L2_FIELD_TOP        = 2, /* top field only */
+	V4L2_FIELD_BOTTOM     = 3, /* bottom field only */
+	V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
+	V4L2_FIELD_SEQ_TB     = 5, /* both fields sequential into one
+				      buffer, top-bottom order */
+	V4L2_FIELD_SEQ_BT     = 6, /* same as above + bottom-top order */
+	V4L2_FIELD_ALTERNATE  = 7, /* both fields alternating into
+				      separate buffers */
+};
+#define V4L2_FIELD_HAS_TOP(field)	\
+	((field) == V4L2_FIELD_TOP 	||\
+	 (field) == V4L2_FIELD_INTERLACED ||\
+	 (field) == V4L2_FIELD_SEQ_TB	||\
+	 (field) == V4L2_FIELD_SEQ_BT)
+#define V4L2_FIELD_HAS_BOTTOM(field)	\
+	((field) == V4L2_FIELD_BOTTOM 	||\
+	 (field) == V4L2_FIELD_INTERLACED ||\
+	 (field) == V4L2_FIELD_SEQ_TB	||\
+	 (field) == V4L2_FIELD_SEQ_BT)
+#define V4L2_FIELD_HAS_BOTH(field)	\
+	((field) == V4L2_FIELD_INTERLACED ||\
+	 (field) == V4L2_FIELD_SEQ_TB	||\
+	 (field) == V4L2_FIELD_SEQ_BT)
+
+enum v4l2_buf_type {
+	V4L2_BUF_TYPE_VIDEO_CAPTURE  = 1,
+	V4L2_BUF_TYPE_VIDEO_OUTPUT   = 2,
+	V4L2_BUF_TYPE_VIDEO_OVERLAY  = 3,
+	V4L2_BUF_TYPE_VBI_CAPTURE    = 4,
+	V4L2_BUF_TYPE_VBI_OUTPUT     = 5,
+	V4L2_BUF_TYPE_PRIVATE        = 0x80,
+};
+
+enum v4l2_ctrl_type {
+	V4L2_CTRL_TYPE_INTEGER	     = 1,
+	V4L2_CTRL_TYPE_BOOLEAN	     = 2,
+	V4L2_CTRL_TYPE_MENU	     = 3,
+	V4L2_CTRL_TYPE_BUTTON	     = 4,
+};
+
+enum v4l2_tuner_type {
+	V4L2_TUNER_RADIO	     = 1,
+	V4L2_TUNER_ANALOG_TV	     = 2,
+};
+
+enum v4l2_memory {
+	V4L2_MEMORY_MMAP             = 1,
+	V4L2_MEMORY_USERPTR          = 2,
+	V4L2_MEMORY_OVERLAY          = 3,
+};
+
+/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
+enum v4l2_colorspace {
+	/* ITU-R 601 -- broadcast NTSC/PAL */
+	V4L2_COLORSPACE_SMPTE170M     = 1,
+
+	/* 1125-Line (US) HDTV */
+	V4L2_COLORSPACE_SMPTE240M     = 2,
+
+	/* HD and modern captures. */
+	V4L2_COLORSPACE_REC709        = 3,
+	
+	/* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
+	V4L2_COLORSPACE_BT878         = 4,
+	
+	/* These should be useful.  Assume 601 extents. */
+	V4L2_COLORSPACE_470_SYSTEM_M  = 5,
+	V4L2_COLORSPACE_470_SYSTEM_BG = 6,
+	
+	/* I know there will be cameras that send this.  So, this is
+	 * unspecified chromaticities and full 0-255 on each of the
+	 * Y'CbCr components
+	 */
+	V4L2_COLORSPACE_JPEG          = 7,
+	
+	/* For RGB colourspaces, this is probably a good start. */
+	V4L2_COLORSPACE_SRGB          = 8,
+};
+
+enum v4l2_priority {
+	V4L2_PRIORITY_UNSET       = 0,  /* not initialized */
+	V4L2_PRIORITY_BACKGROUND  = 1,
+	V4L2_PRIORITY_INTERACTIVE = 2,
+	V4L2_PRIORITY_RECORD      = 3,
+	V4L2_PRIORITY_DEFAULT     = V4L2_PRIORITY_INTERACTIVE,
+};
+
+struct v4l2_rect {
+	__s32   left;
+	__s32   top;
+	__s32   width;
+	__s32   height;
+};
+
+struct v4l2_fract {
+	__u32   numerator;
+	__u32   denominator;
+};
+
+/*
+ *	D R I V E R   C A P A B I L I T I E S
+ */
+struct v4l2_capability
+{
+	__u8	driver[16];	/* i.e. "bttv" */
+	__u8	card[32];	/* i.e. "Hauppauge WinTV" */
+	__u8	bus_info[32];	/* "PCI:" + pci_name(pci_dev) */
+	__u32   version;        /* should use KERNEL_VERSION() */
+	__u32	capabilities;	/* Device capabilities */
+	__u32	reserved[4];
+};
+
+/* Values for 'capabilities' field */
+#define V4L2_CAP_VIDEO_CAPTURE	0x00000001  /* Is a video capture device */
+#define V4L2_CAP_VIDEO_OUTPUT	0x00000002  /* Is a video output device */
+#define V4L2_CAP_VIDEO_OVERLAY	0x00000004  /* Can do video overlay */
+#define V4L2_CAP_VBI_CAPTURE	0x00000010  /* Is a VBI capture device */
+#define V4L2_CAP_VBI_OUTPUT	0x00000020  /* Is a VBI output device */
+#define V4L2_CAP_RDS_CAPTURE	0x00000100  /* RDS data capture */
+
+#define V4L2_CAP_TUNER		0x00010000  /* has a tuner */
+#define V4L2_CAP_AUDIO		0x00020000  /* has audio support */
+#define V4L2_CAP_RADIO		0x00040000  /* is a radio device */
+
+#define V4L2_CAP_READWRITE      0x01000000  /* read/write systemcalls */
+#define V4L2_CAP_ASYNCIO        0x02000000  /* async I/O */
+#define V4L2_CAP_STREAMING      0x04000000  /* streaming I/O ioctls */
+
+/*
+ *	V I D E O   I M A G E   F O R M A T
+ */
+
+struct v4l2_pix_format
+{
+	__u32         	 	width;
+	__u32	         	height;
+	__u32	         	pixelformat;
+	enum v4l2_field  	field;
+	__u32            	bytesperline;	/* for padding, zero if unused */
+	__u32          	 	sizeimage;
+        enum v4l2_colorspace	colorspace;
+	__u32			priv;		/* private data, depends on pixelformat */
+};
+
+/*           Pixel format    FOURCC                  depth  Description   */
+#define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R','G','B','1') /*  8  RGB-3-3-2     */
+#define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R','G','B','O') /* 16  RGB-5-5-5     */
+#define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R','G','B','P') /* 16  RGB-5-6-5     */
+#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16  RGB-5-5-5 BE  */
+#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16  RGB-5-6-5 BE  */
+#define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B','G','R','3') /* 24  BGR-8-8-8     */
+#define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R','G','B','3') /* 24  RGB-8-8-8     */
+#define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B','G','R','4') /* 32  BGR-8-8-8-8   */
+#define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R','G','B','4') /* 32  RGB-8-8-8-8   */
+#define V4L2_PIX_FMT_GREY    v4l2_fourcc('G','R','E','Y') /*  8  Greyscale     */
+#define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y','V','U','9') /*  9  YVU 4:1:0     */
+#define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y','V','1','2') /* 12  YVU 4:2:0     */
+#define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y','U','Y','V') /* 16  YUV 4:2:2     */
+#define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U','Y','V','Y') /* 16  YUV 4:2:2     */
+#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16  YVU422 planar */
+#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16  YVU411 planar */
+#define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y','4','1','P') /* 12  YUV 4:1:1     */
+
+/* two planes -- one Y, one Cr + Cb interleaved  */
+#define V4L2_PIX_FMT_NV12    v4l2_fourcc('N','V','1','2') /* 12  Y/CbCr 4:2:0  */
+#define V4L2_PIX_FMT_NV21    v4l2_fourcc('N','V','2','1') /* 12  Y/CrCb 4:2:0  */
+
+/*  The following formats are not defined in the V4L2 specification */
+#define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y','U','V','9') /*  9  YUV 4:1:0     */
+#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y','U','1','2') /* 12  YUV 4:2:0     */
+#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y','Y','U','V') /* 16  YUV 4:2:2     */
+#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H','I','2','4') /*  8  8-bit color   */
+
+/* compressed formats */
+#define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M','J','P','G') /* Motion-JPEG   */
+#define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J','P','E','G') /* JFIF JPEG     */
+#define V4L2_PIX_FMT_DV       v4l2_fourcc('d','v','s','d') /* 1394          */
+#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M','P','E','G') /* MPEG          */
+
+/*  Vendor-specific formats   */
+#define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W','N','V','A') /* Winnov hw compress */
+
+/*
+ *	F O R M A T   E N U M E R A T I O N
+ */
+struct v4l2_fmtdesc
+{
+	__u32	            index;             /* Format number      */
+	enum v4l2_buf_type  type;              /* buffer type        */
+	__u32               flags;
+	__u8	            description[32];   /* Description string */
+	__u32	            pixelformat;       /* Format fourcc      */
+	__u32	            reserved[4];
+};
+
+#define V4L2_FMT_FLAG_COMPRESSED 0x0001
+
+
+/*
+ *	T I M E C O D E
+ */
+struct v4l2_timecode
+{
+	__u32	type;
+	__u32	flags;
+	__u8	frames;
+	__u8	seconds;
+	__u8	minutes;
+	__u8	hours;
+	__u8	userbits[4];
+};
+
+/*  Type  */
+#define V4L2_TC_TYPE_24FPS		1
+#define V4L2_TC_TYPE_25FPS		2
+#define V4L2_TC_TYPE_30FPS		3
+#define V4L2_TC_TYPE_50FPS		4
+#define V4L2_TC_TYPE_60FPS		5
+
+/*  Flags  */
+#define V4L2_TC_FLAG_DROPFRAME		0x0001 /* "drop-frame" mode */
+#define V4L2_TC_FLAG_COLORFRAME		0x0002
+#define V4L2_TC_USERBITS_field		0x000C
+#define V4L2_TC_USERBITS_USERDEFINED	0x0000
+#define V4L2_TC_USERBITS_8BITCHARS	0x0008
+/* The above is based on SMPTE timecodes */
+
+
+/*
+ *	C O M P R E S S I O N   P A R A M E T E R S
+ */
+#if 0
+/* ### generic compression settings don't work, there is too much
+ * ### codec-specific stuff.  Maybe reuse that for MPEG codec settings
+ * ### later ... */
+struct v4l2_compression
+{
+	__u32	quality;
+	__u32	keyframerate;
+	__u32	pframerate;
+	__u32	reserved[5];
+
+/*  what we'll need for MPEG, extracted from some postings on
+    the v4l list (Gert Vervoort, PlasmaJohn).
+
+system stream:
+  - type: elementary stream(ES), packatised elementary stream(s) (PES)
+    program stream(PS), transport stream(TS)
+  - system bitrate
+  - PS packet size (DVD: 2048 bytes, VCD: 2324 bytes)
+  - TS video PID
+  - TS audio PID
+  - TS PCR PID
+  - TS system information tables (PAT, PMT, CAT, NIT and SIT)
+  - (MPEG-1 systems stream vs. MPEG-2 program stream (TS not supported
+    by MPEG-1 systems)
+
+audio:
+  - type: MPEG (+Layer I,II,III), AC-3, LPCM
+  - bitrate
+  - sampling frequency (DVD: 48 Khz, VCD: 44.1 KHz, 32 kHz)
+  - Trick Modes? (ff, rew)
+  - Copyright
+  - Inverse Telecine
+
+video:
+  - picturesize (SIF, 1/2 D1, 2/3 D1, D1) and PAL/NTSC norm can be set
+    through excisting V4L2 controls
+  - noise reduction, parameters encoder specific?
+  - MPEG video version: MPEG-1, MPEG-2
+  - GOP (Group Of Pictures) definition:
+    - N: number of frames per GOP
+    - M: distance between reference (I,P) frames
+    - open/closed GOP
+  - quantiser matrix: inter Q matrix (64 bytes) and intra Q matrix (64 bytes)
+  - quantiser scale: linear or logarithmic
+  - scanning: alternate or zigzag
+  - bitrate mode: CBR (constant bitrate) or VBR (variable bitrate).
+  - target video bitrate for CBR
+  - target video bitrate for VBR
+  - maximum video bitrate for VBR - min. quantiser value for VBR
+  - max. quantiser value for VBR
+  - adaptive quantisation value
+  - return the number of bytes per GOP or bitrate for bitrate monitoring
+
+*/
+};
+#endif
+
+struct v4l2_jpegcompression
+{
+	int quality;
+
+	int  APPn;              /* Number of APP segment to be written,
+				 * must be 0..15 */
+	int  APP_len;           /* Length of data in JPEG APPn segment */
+	char APP_data[60];      /* Data in the JPEG APPn segment. */
+	
+	int  COM_len;           /* Length of data in JPEG COM segment */
+	char COM_data[60];      /* Data in JPEG COM segment */
+	
+	__u32 jpeg_markers;     /* Which markers should go into the JPEG
+				 * output. Unless you exactly know what
+				 * you do, leave them untouched.
+				 * Inluding less markers will make the
+				 * resulting code smaller, but there will
+				 * be fewer aplications which can read it.
+				 * The presence of the APP and COM marker
+				 * is influenced by APP_len and COM_len
+				 * ONLY, not by this property! */
+	
+#define V4L2_JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
+#define V4L2_JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
+#define V4L2_JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
+#define V4L2_JPEG_MARKER_COM (1<<6)    /* Comment segment */
+#define V4L2_JPEG_MARKER_APP (1<<7)    /* App segment, driver will
+                                        * allways use APP0 */
+};
+
+
+/*
+ *	M E M O R Y - M A P P I N G   B U F F E R S
+ */
+struct v4l2_requestbuffers
+{
+	__u32	                count;
+	enum v4l2_buf_type      type;
+	enum v4l2_memory        memory;
+	__u32	                reserved[2];
+};
+
+struct v4l2_buffer
+{
+	__u32			index;
+	enum v4l2_buf_type      type;
+	__u32			bytesused;
+	__u32			flags;
+	enum v4l2_field		field;
+	struct timeval		timestamp;
+	struct v4l2_timecode	timecode;
+	__u32			sequence;
+
+	/* memory location */
+	enum v4l2_memory        memory;
+	union {
+		__u32           offset;
+		unsigned long   userptr;
+	} m;
+	__u32			length;
+
+	__u32			reserved[2];
+};
+
+/*  Flags for 'flags' field */
+#define V4L2_BUF_FLAG_MAPPED	0x0001  /* Buffer is mapped (flag) */
+#define V4L2_BUF_FLAG_QUEUED	0x0002	/* Buffer is queued for processing */
+#define V4L2_BUF_FLAG_DONE	0x0004	/* Buffer is ready */
+#define V4L2_BUF_FLAG_KEYFRAME	0x0008	/* Image is a keyframe (I-frame) */
+#define V4L2_BUF_FLAG_PFRAME	0x0010	/* Image is a P-frame */
+#define V4L2_BUF_FLAG_BFRAME	0x0020	/* Image is a B-frame */
+#define V4L2_BUF_FLAG_TIMECODE	0x0100	/* timecode field is valid */
+
+/*
+ *	O V E R L A Y   P R E V I E W
+ */
+struct v4l2_framebuffer
+{
+	__u32			capability;
+	__u32			flags;
+/* FIXME: in theory we should pass something like PCI device + memory
+ * region + offset instead of some physical address */
+	void*                   base;
+	struct v4l2_pix_format	fmt;
+};
+/*  Flags for the 'capability' field. Read only */
+#define V4L2_FBUF_CAP_EXTERNOVERLAY	0x0001
+#define V4L2_FBUF_CAP_CHROMAKEY		0x0002
+#define V4L2_FBUF_CAP_LIST_CLIPPING     0x0004
+#define V4L2_FBUF_CAP_BITMAP_CLIPPING	0x0008
+/*  Flags for the 'flags' field. */
+#define V4L2_FBUF_FLAG_PRIMARY		0x0001
+#define V4L2_FBUF_FLAG_OVERLAY		0x0002
+#define V4L2_FBUF_FLAG_CHROMAKEY	0x0004
+
+struct v4l2_clip
+{
+	struct v4l2_rect        c;
+	struct v4l2_clip	*next;
+};
+
+struct v4l2_window
+{
+	struct v4l2_rect        w;
+	enum v4l2_field  	field;
+	__u32			chromakey;
+	struct v4l2_clip	*clips;
+	__u32			clipcount;
+	void			*bitmap;
+};
+
+
+/*
+ *	C A P T U R E   P A R A M E T E R S
+ */
+struct v4l2_captureparm
+{
+	__u32		   capability;	  /*  Supported modes */
+	__u32		   capturemode;	  /*  Current mode */
+	struct v4l2_fract  timeperframe;  /*  Time per frame in .1us units */
+	__u32		   extendedmode;  /*  Driver-specific extensions */
+	__u32              readbuffers;   /*  # of buffers for read */
+	__u32		   reserved[4];
+};
+/*  Flags for 'capability' and 'capturemode' fields */
+#define V4L2_MODE_HIGHQUALITY	0x0001	/*  High quality imaging mode */
+#define V4L2_CAP_TIMEPERFRAME	0x1000	/*  timeperframe field is supported */
+
+struct v4l2_outputparm
+{
+	__u32		   capability;	 /*  Supported modes */
+	__u32		   outputmode;	 /*  Current mode */
+	struct v4l2_fract  timeperframe; /*  Time per frame in seconds */
+	__u32		   extendedmode; /*  Driver-specific extensions */
+	__u32              writebuffers; /*  # of buffers for write */
+	__u32		   reserved[4];
+};
+
+/*
+ *	I N P U T   I M A G E   C R O P P I N G
+ */
+
+struct v4l2_cropcap {
+	enum v4l2_buf_type      type;	
+        struct v4l2_rect        bounds;
+        struct v4l2_rect        defrect;
+        struct v4l2_fract       pixelaspect;
+};
+
+struct v4l2_crop {
+	enum v4l2_buf_type      type;
+	struct v4l2_rect        c;
+};
+
+/*
+ *      A N A L O G   V I D E O   S T A N D A R D
+ */
+
+typedef __u64 v4l2_std_id;
+
+/* one bit for each */
+#define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
+#define V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
+#define V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
+#define V4L2_STD_PAL_H          ((v4l2_std_id)0x00000008)
+#define V4L2_STD_PAL_I          ((v4l2_std_id)0x00000010)
+#define V4L2_STD_PAL_D          ((v4l2_std_id)0x00000020)
+#define V4L2_STD_PAL_D1         ((v4l2_std_id)0x00000040)
+#define V4L2_STD_PAL_K          ((v4l2_std_id)0x00000080)
+
+#define V4L2_STD_PAL_M          ((v4l2_std_id)0x00000100)
+#define V4L2_STD_PAL_N          ((v4l2_std_id)0x00000200)
+#define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
+#define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
+
+#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
+#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
+
+#define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
+#define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
+#define V4L2_STD_SECAM_G        ((v4l2_std_id)0x00040000)
+#define V4L2_STD_SECAM_H        ((v4l2_std_id)0x00080000)
+#define V4L2_STD_SECAM_K        ((v4l2_std_id)0x00100000)
+#define V4L2_STD_SECAM_K1       ((v4l2_std_id)0x00200000)
+#define V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
+
+/* ATSC/HDTV */
+#define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
+#define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
+
+/* some common needed stuff */
+#define V4L2_STD_PAL_BG		(V4L2_STD_PAL_B		|\
+				 V4L2_STD_PAL_B1	|\
+				 V4L2_STD_PAL_G)
+#define V4L2_STD_PAL_DK		(V4L2_STD_PAL_D		|\
+				 V4L2_STD_PAL_D1	|\
+				 V4L2_STD_PAL_K)
+#define V4L2_STD_PAL		(V4L2_STD_PAL_BG	|\
+				 V4L2_STD_PAL_DK	|\
+				 V4L2_STD_PAL_H		|\
+				 V4L2_STD_PAL_I)
+#define V4L2_STD_NTSC           (V4L2_STD_NTSC_M	|\
+				 V4L2_STD_NTSC_M_JP)
+#define V4L2_STD_SECAM		(V4L2_STD_SECAM_B	|\
+				 V4L2_STD_SECAM_D	|\
+				 V4L2_STD_SECAM_G	|\
+				 V4L2_STD_SECAM_H	|\
+				 V4L2_STD_SECAM_K	|\
+				 V4L2_STD_SECAM_K1	|\
+				 V4L2_STD_SECAM_L)
+
+#define V4L2_STD_525_60		(V4L2_STD_PAL_M		|\
+				 V4L2_STD_PAL_60	|\
+				 V4L2_STD_NTSC)
+#define V4L2_STD_625_50		(V4L2_STD_PAL		|\
+				 V4L2_STD_PAL_N		|\
+				 V4L2_STD_PAL_Nc	|\
+				 V4L2_STD_SECAM)
+
+#define V4L2_STD_UNKNOWN        0
+#define V4L2_STD_ALL            (V4L2_STD_525_60	|\
+				 V4L2_STD_625_50)
+
+struct v4l2_standard
+{
+	__u32	       	     index;
+	v4l2_std_id          id;
+	__u8		     name[24];
+	struct v4l2_fract    frameperiod; /* Frames, not fields */
+	__u32		     framelines;
+	__u32		     reserved[4];
+};
+
+
+/*
+ *	V I D E O   I N P U T S
+ */
+struct v4l2_input
+{
+	__u32	     index;		/*  Which input */
+	__u8	     name[32];	        /*  Label */
+	__u32	     type;		/*  Type of input */
+	__u32	     audioset;	        /*  Associated audios (bitfield) */
+	__u32        tuner;             /*  Associated tuner */
+	v4l2_std_id  std;
+	__u32	     status;
+	__u32	     reserved[4];
+};
+/*  Values for the 'type' field */
+#define V4L2_INPUT_TYPE_TUNER		1
+#define V4L2_INPUT_TYPE_CAMERA		2
+
+/* field 'status' - general */
+#define V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
+#define V4L2_IN_ST_NO_SIGNAL   0x00000002
+#define V4L2_IN_ST_NO_COLOR    0x00000004
+
+/* field 'status' - analog */
+#define V4L2_IN_ST_NO_H_LOCK   0x00000100  /* No horizontal sync lock */
+#define V4L2_IN_ST_COLOR_KILL  0x00000200  /* Color killer is active */
+
+/* field 'status' - digital */
+#define V4L2_IN_ST_NO_SYNC     0x00010000  /* No synchronization lock */
+#define V4L2_IN_ST_NO_EQU      0x00020000  /* No equalizer lock */
+#define V4L2_IN_ST_NO_CARRIER  0x00040000  /* Carrier recovery failed */
+
+/* field 'status' - VCR and set-top box */
+#define V4L2_IN_ST_MACROVISION 0x01000000  /* Macrovision detected */
+#define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
+#define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
+
+/*
+ *	V I D E O   O U T P U T S
+ */
+struct v4l2_output
+{
+	__u32	     index;		/*  Which output */
+	__u8	     name[32];	        /*  Label */
+	__u32	     type;		/*  Type of output */
+	__u32	     audioset;	        /*  Associated audios (bitfield) */
+	__u32	     modulator;         /*  Associated modulator */
+	v4l2_std_id  std;
+	__u32	     reserved[4];
+};
+/*  Values for the 'type' field */
+#define V4L2_OUTPUT_TYPE_MODULATOR		1
+#define V4L2_OUTPUT_TYPE_ANALOG			2
+#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
+
+/*
+ *	C O N T R O L S
+ */
+struct v4l2_control
+{
+	__u32		     id;
+	__s32		     value;
+};
+
+/*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
+struct v4l2_queryctrl
+{
+	__u32	             id;
+	enum v4l2_ctrl_type  type;
+	__u8		     name[32];	/* Whatever */
+	__s32		     minimum;	/* Note signedness */
+	__s32		     maximum;
+	__s32	             step;
+	__s32		     default_value;
+	__u32                flags;
+	__u32		     reserved[2];
+};
+
+/*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
+struct v4l2_querymenu
+{
+	__u32		id;
+	__u32		index;
+	__u8		name[32];	/* Whatever */
+	__u32		reserved;
+};
+
+/*  Control flags  */
+#define V4L2_CTRL_FLAG_DISABLED		0x0001
+#define V4L2_CTRL_FLAG_GRABBED		0x0002
+
+/*  Control IDs defined by V4L2 */
+#define V4L2_CID_BASE			0x00980900
+/*  IDs reserved for driver specific controls */
+#define V4L2_CID_PRIVATE_BASE		0x08000000
+
+#define V4L2_CID_BRIGHTNESS		(V4L2_CID_BASE+0)
+#define V4L2_CID_CONTRAST		(V4L2_CID_BASE+1)
+#define V4L2_CID_SATURATION		(V4L2_CID_BASE+2)
+#define V4L2_CID_HUE			(V4L2_CID_BASE+3)
+#define V4L2_CID_AUDIO_VOLUME		(V4L2_CID_BASE+5)
+#define V4L2_CID_AUDIO_BALANCE		(V4L2_CID_BASE+6)
+#define V4L2_CID_AUDIO_BASS		(V4L2_CID_BASE+7)
+#define V4L2_CID_AUDIO_TREBLE		(V4L2_CID_BASE+8)
+#define V4L2_CID_AUDIO_MUTE		(V4L2_CID_BASE+9)
+#define V4L2_CID_AUDIO_LOUDNESS		(V4L2_CID_BASE+10)
+#define V4L2_CID_BLACK_LEVEL		(V4L2_CID_BASE+11)
+#define V4L2_CID_AUTO_WHITE_BALANCE	(V4L2_CID_BASE+12)
+#define V4L2_CID_DO_WHITE_BALANCE	(V4L2_CID_BASE+13)
+#define V4L2_CID_RED_BALANCE		(V4L2_CID_BASE+14)
+#define V4L2_CID_BLUE_BALANCE		(V4L2_CID_BASE+15)
+#define V4L2_CID_GAMMA			(V4L2_CID_BASE+16)
+#define V4L2_CID_WHITENESS		(V4L2_CID_GAMMA) /* ? Not sure */
+#define V4L2_CID_EXPOSURE		(V4L2_CID_BASE+17)
+#define V4L2_CID_AUTOGAIN		(V4L2_CID_BASE+18)
+#define V4L2_CID_GAIN			(V4L2_CID_BASE+19)
+#define V4L2_CID_HFLIP			(V4L2_CID_BASE+20)
+#define V4L2_CID_VFLIP			(V4L2_CID_BASE+21)
+#define V4L2_CID_HCENTER		(V4L2_CID_BASE+22)
+#define V4L2_CID_VCENTER		(V4L2_CID_BASE+23)
+#define V4L2_CID_LASTP1			(V4L2_CID_BASE+24) /* last CID + 1 */
+
+/*
+ *	T U N I N G
+ */
+struct v4l2_tuner
+{
+	__u32                   index;
+	__u8			name[32];
+	enum v4l2_tuner_type    type;
+	__u32			capability;
+	__u32			rangelow;
+	__u32			rangehigh;
+	__u32			rxsubchans;
+	__u32			audmode;
+	__s32			signal;
+	__s32			afc;
+	__u32			reserved[4];
+};
+
+struct v4l2_modulator
+{
+	__u32			index;
+	__u8			name[32];
+	__u32			capability;
+	__u32			rangelow;
+	__u32			rangehigh;
+	__u32			txsubchans;
+	__u32			reserved[4];
+};
+
+/*  Flags for the 'capability' field */
+#define V4L2_TUNER_CAP_LOW		0x0001
+#define V4L2_TUNER_CAP_NORM		0x0002
+#define V4L2_TUNER_CAP_STEREO		0x0010
+#define V4L2_TUNER_CAP_LANG2		0x0020
+#define V4L2_TUNER_CAP_SAP		0x0020
+#define V4L2_TUNER_CAP_LANG1		0x0040
+
+/*  Flags for the 'rxsubchans' field */
+#define V4L2_TUNER_SUB_MONO		0x0001
+#define V4L2_TUNER_SUB_STEREO		0x0002
+#define V4L2_TUNER_SUB_LANG2		0x0004
+#define V4L2_TUNER_SUB_SAP		0x0004
+#define V4L2_TUNER_SUB_LANG1		0x0008
+
+/*  Values for the 'audmode' field */
+#define V4L2_TUNER_MODE_MONO		0x0000
+#define V4L2_TUNER_MODE_STEREO		0x0001
+#define V4L2_TUNER_MODE_LANG2		0x0002
+#define V4L2_TUNER_MODE_SAP		0x0002
+#define V4L2_TUNER_MODE_LANG1		0x0003
+
+struct v4l2_frequency
+{
+	__u32	              tuner;
+	enum v4l2_tuner_type  type;
+        __u32	              frequency;
+	__u32	              reserved[8];
+};
+
+/*
+ *	A U D I O
+ */
+struct v4l2_audio
+{
+	__u32	index;
+	__u8	name[32];
+	__u32	capability;
+	__u32	mode;
+	__u32	reserved[2];
+};
+/*  Flags for the 'capability' field */
+#define V4L2_AUDCAP_STEREO		0x00001
+#define V4L2_AUDCAP_AVL			0x00002
+
+/*  Flags for the 'mode' field */
+#define V4L2_AUDMODE_AVL		0x00001
+
+struct v4l2_audioout
+{
+	__u32	index;
+	__u8	name[32];
+	__u32	capability;
+	__u32	mode;
+	__u32	reserved[2];
+};
+
+/*
+ *	D A T A   S E R V I C E S   ( V B I )
+ *
+ *	Data services API by Michael Schimek
+ */
+
+struct v4l2_vbi_format
+{
+	__u32	sampling_rate;		/* in 1 Hz */
+	__u32	offset;
+	__u32	samples_per_line;
+	__u32	sample_format;		/* V4L2_PIX_FMT_* */
+	__s32	start[2];
+	__u32	count[2];
+	__u32	flags;			/* V4L2_VBI_* */
+	__u32	reserved[2];		/* must be zero */
+};
+
+/*  VBI flags  */
+#define V4L2_VBI_UNSYNC		(1<< 0)
+#define V4L2_VBI_INTERLACED	(1<< 1)
+
+
+/*
+ *	A G G R E G A T E   S T R U C T U R E S
+ */
+
+/*	Stream data format
+ */
+struct v4l2_format
+{
+	enum v4l2_buf_type type;
+	union
+	{
+		struct v4l2_pix_format	pix;  // V4L2_BUF_TYPE_VIDEO_CAPTURE
+		struct v4l2_window	win;  // V4L2_BUF_TYPE_VIDEO_OVERLAY
+		struct v4l2_vbi_format	vbi;  // V4L2_BUF_TYPE_VBI_CAPTURE
+		__u8	raw_data[200];        // user-defined
+	} fmt;
+};
+
+
+/*	Stream type-dependent parameters
+ */
+struct v4l2_streamparm
+{
+	enum v4l2_buf_type type;
+	union
+	{
+		struct v4l2_captureparm	capture;
+		struct v4l2_outputparm	output;
+		__u8	raw_data[200];  /* user-defined */
+	} parm;
+};
+
+
+
+/*
+ *	I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
+ *
+ */
+#define VIDIOC_QUERYCAP		_IOR  ('V',  0, struct v4l2_capability)
+#define VIDIOC_RESERVED		_IO   ('V',  1)
+#define VIDIOC_ENUM_FMT         _IOWR ('V',  2, struct v4l2_fmtdesc)
+#define VIDIOC_G_FMT		_IOWR ('V',  4, struct v4l2_format)
+#define VIDIOC_S_FMT		_IOWR ('V',  5, struct v4l2_format)
+#if 0
+#define VIDIOC_G_COMP		_IOR  ('V',  6, struct v4l2_compression)
+#define VIDIOC_S_COMP		_IOW  ('V',  7, struct v4l2_compression)
+#endif
+#define VIDIOC_REQBUFS		_IOWR ('V',  8, struct v4l2_requestbuffers)
+#define VIDIOC_QUERYBUF		_IOWR ('V',  9, struct v4l2_buffer)
+#define VIDIOC_G_FBUF		_IOR  ('V', 10, struct v4l2_framebuffer)
+#define VIDIOC_S_FBUF		_IOW  ('V', 11, struct v4l2_framebuffer)
+#define VIDIOC_OVERLAY		_IOW  ('V', 14, int)
+#define VIDIOC_QBUF		_IOWR ('V', 15, struct v4l2_buffer)
+#define VIDIOC_DQBUF		_IOWR ('V', 17, struct v4l2_buffer)
+#define VIDIOC_STREAMON		_IOW  ('V', 18, int)
+#define VIDIOC_STREAMOFF	_IOW  ('V', 19, int)
+#define VIDIOC_G_PARM		_IOWR ('V', 21, struct v4l2_streamparm)
+#define VIDIOC_S_PARM		_IOWR ('V', 22, struct v4l2_streamparm)
+#define VIDIOC_G_STD		_IOR  ('V', 23, v4l2_std_id)
+#define VIDIOC_S_STD		_IOW  ('V', 24, v4l2_std_id)
+#define VIDIOC_ENUMSTD		_IOWR ('V', 25, struct v4l2_standard)
+#define VIDIOC_ENUMINPUT	_IOWR ('V', 26, struct v4l2_input)
+#define VIDIOC_G_CTRL		_IOWR ('V', 27, struct v4l2_control)
+#define VIDIOC_S_CTRL		_IOWR ('V', 28, struct v4l2_control)
+#define VIDIOC_G_TUNER		_IOWR ('V', 29, struct v4l2_tuner)
+#define VIDIOC_S_TUNER		_IOW  ('V', 30, struct v4l2_tuner)
+#define VIDIOC_G_AUDIO		_IOR  ('V', 33, struct v4l2_audio)
+#define VIDIOC_S_AUDIO		_IOW  ('V', 34, struct v4l2_audio)
+#define VIDIOC_QUERYCTRL	_IOWR ('V', 36, struct v4l2_queryctrl)
+#define VIDIOC_QUERYMENU	_IOWR ('V', 37, struct v4l2_querymenu)
+#define VIDIOC_G_INPUT		_IOR  ('V', 38, int)
+#define VIDIOC_S_INPUT		_IOWR ('V', 39, int)
+#define VIDIOC_G_OUTPUT		_IOR  ('V', 46, int)
+#define VIDIOC_S_OUTPUT		_IOWR ('V', 47, int)
+#define VIDIOC_ENUMOUTPUT	_IOWR ('V', 48, struct v4l2_output)
+#define VIDIOC_G_AUDOUT		_IOR  ('V', 49, struct v4l2_audioout)
+#define VIDIOC_S_AUDOUT		_IOW  ('V', 50, struct v4l2_audioout)
+#define VIDIOC_G_MODULATOR	_IOWR ('V', 54, struct v4l2_modulator)
+#define VIDIOC_S_MODULATOR	_IOW  ('V', 55, struct v4l2_modulator)
+#define VIDIOC_G_FREQUENCY	_IOWR ('V', 56, struct v4l2_frequency)
+#define VIDIOC_S_FREQUENCY	_IOW  ('V', 57, struct v4l2_frequency)
+#define VIDIOC_CROPCAP		_IOWR ('V', 58, struct v4l2_cropcap)
+#define VIDIOC_G_CROP		_IOWR ('V', 59, struct v4l2_crop)
+#define VIDIOC_S_CROP		_IOW  ('V', 60, struct v4l2_crop)
+#define VIDIOC_G_JPEGCOMP	_IOR  ('V', 61, struct v4l2_jpegcompression)
+#define VIDIOC_S_JPEGCOMP	_IOW  ('V', 62, struct v4l2_jpegcompression)
+#define VIDIOC_QUERYSTD      	_IOR  ('V', 63, v4l2_std_id)
+#define VIDIOC_TRY_FMT      	_IOWR ('V', 64, struct v4l2_format)
+#define VIDIOC_ENUMAUDIO	_IOWR ('V', 65, struct v4l2_audio)
+#define VIDIOC_ENUMAUDOUT	_IOWR ('V', 66, struct v4l2_audioout)
+#define VIDIOC_G_PRIORITY       _IOR  ('V', 67, enum v4l2_priority)
+#define VIDIOC_S_PRIORITY       _IOW  ('V', 68, enum v4l2_priority)
+
+/* for compatibility, will go away some day */
+#define VIDIOC_OVERLAY_OLD     	_IOWR ('V', 14, int)
+#define VIDIOC_S_PARM_OLD      	_IOW  ('V', 22, struct v4l2_streamparm)
+#define VIDIOC_S_CTRL_OLD      	_IOW  ('V', 28, struct v4l2_control)
+#define VIDIOC_G_AUDIO_OLD     	_IOWR ('V', 33, struct v4l2_audio)
+#define VIDIOC_G_AUDOUT_OLD    	_IOWR ('V', 49, struct v4l2_audioout)
+#define VIDIOC_CROPCAP_OLD     	_IOR  ('V', 58, struct v4l2_cropcap)
+
+#define BASE_VIDIOC_PRIVATE	192		/* 192-255 are private */
+
+#endif /* __LINUX_VIDEODEV2_H */
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.c b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.c
new file mode 100755
index 0000000..98b6d1a
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.c
@@ -0,0 +1,339 @@
+/*
+   (c) Copyright 2001-2008  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <stdarg.h>
+
+#include <directfb.h>
+#include <directfb_windows.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/memcpy.h>
+
+#include <fusion/reactor.h>
+
+#include <core/wm.h>
+
+#include "idirectfbwindows_default.h"
+
+
+D_DEBUG_DOMAIN( IDirectFBWindows_default, "IDirectFBWindows/default", "IDirectFBWindows Interface default Implementation" );
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Probe( void *ctx, ... );
+
+static DirectResult
+Construct( void *interface, ... );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBWindows, default )
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DirectLink           link;
+
+     DFBWindowsWatcher    watcher;
+     void                *context;
+
+     Reaction             reactions[_CORE_WM_NUM_CHANNELS];
+} RegisteredWatcher;
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBWindows_Destruct( IDirectFBWindows *thiz )
+{
+     IDirectFBWindows_data *data;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( %p )\n", __FUNCTION__, thiz );
+
+     D_ASSERT( thiz != NULL );
+
+     data = thiz->priv;
+}
+
+static DirectResult
+IDirectFBWindows_AddRef( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows)
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Release( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows)
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->ref == 0)
+          IDirectFBWindows_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowAdd( const void *msg_data,
+                                        void       *ctx )
+{
+     const CoreWM_WindowAdd *add        = msg_data;
+     RegisteredWatcher      *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowAdd != NULL );
+
+     registered->watcher.WindowAdd( registered->context, &add->info );
+
+     return RS_OK;
+}
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowRemove( const void *msg_data,
+                                           void       *ctx )
+{
+     const CoreWM_WindowRemove *remove     = msg_data;
+     RegisteredWatcher         *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowRemove != NULL );
+
+     registered->watcher.WindowRemove( registered->context, remove->window_id );
+
+     return RS_OK;
+}
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowConfig( const void *msg_data,
+                                           void       *ctx )
+{
+     const CoreWM_WindowConfig *config     = msg_data;
+     RegisteredWatcher         *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowConfig != NULL );
+
+     registered->watcher.WindowConfig( registered->context, config->window_id, &config->config, config->flags );
+
+     return RS_OK;
+}
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowState( const void *msg_data,
+                                          void       *ctx )
+{
+     const CoreWM_WindowState *state      = msg_data;
+     RegisteredWatcher        *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowState != NULL );
+
+     registered->watcher.WindowState( registered->context, state->window_id, &state->state );
+
+     return RS_OK;
+}
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowRestack( const void *msg_data,
+                                            void       *ctx )
+{
+     const CoreWM_WindowRestack *restack    = msg_data;
+     RegisteredWatcher          *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowRestack != NULL );
+
+     registered->watcher.WindowRestack( registered->context, restack->window_id, restack->index );
+
+     return RS_OK;
+}
+
+static ReactionResult
+IDirectFBWindows_WM_Reaction_WindowFocus( const void *msg_data,
+                                          void       *ctx )
+{
+     const CoreWM_WindowFocus *focus      = msg_data;
+     RegisteredWatcher        *registered = ctx;
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( msg %p, ctx %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( registered->watcher.WindowFocus != NULL );
+
+     registered->watcher.WindowFocus( registered->context, focus->window_id );
+
+     return RS_OK;
+}
+
+#define WM_ATTACH( Func, CHANNEL )                                                                  \
+     do {                                                                                           \
+          if (watcher->Func) {                                                                      \
+               ret = dfb_wm_attach( data->core, CORE_WM_##CHANNEL,                                  \
+                                    IDirectFBWindows_WM_Reaction_##Func, registered,                \
+                                    ®istered->reactions[CORE_WM_##CHANNEL] );                    \
+               if (ret) {                                                                           \
+                    D_DERROR( ret, "IDirectFBWindows_RegisterWatcher: "                             \
+                                   "dfb_wm_attach( 'CORE_WM_" #CHANNEL "' ) failed!\n" );           \
+                    goto error;                                                                     \
+               }                                                                                    \
+          }                                                                                         \
+     } while (0)
+
+/**********************************************************************************************************************/
+
+static DirectResult
+IDirectFBWindows_RegisterWatcher( IDirectFBWindows        *thiz,
+                                  const DFBWindowsWatcher *watcher,
+                                  void                    *context )
+{
+     DFBResult          ret;
+     int                i;
+     RegisteredWatcher *registered;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows)
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!watcher)
+          return DFB_INVARG;
+
+     if (!watcher->WindowAdd     &&
+         !watcher->WindowRemove  &&
+         !watcher->WindowConfig  &&
+         !watcher->WindowState   &&
+         !watcher->WindowRestack &&
+         !watcher->WindowFocus)
+          return DFB_INVARG;
+
+     registered = D_CALLOC( 1, sizeof(RegisteredWatcher) );
+     if (!registered)
+          return D_OOM();
+
+     registered->watcher = *watcher;
+     registered->context = context;
+
+     WM_ATTACH( WindowAdd,     WINDOW_ADD );
+     WM_ATTACH( WindowRemove,  WINDOW_REMOVE );
+     WM_ATTACH( WindowConfig,  WINDOW_CONFIG );
+     WM_ATTACH( WindowState,   WINDOW_STATE );
+     WM_ATTACH( WindowRestack, WINDOW_RESTACK );
+     WM_ATTACH( WindowFocus,   WINDOW_FOCUS );
+
+     direct_list_append( &data->watchers, ®istered->link );
+
+     return DFB_OK;
+
+
+error:
+     for (i=_CORE_WM_NUM_CHANNELS-1; i>=0; i--) {
+          if (registered->reactions[i].func)
+               dfb_wm_detach( data->core, ®istered->reactions[i] );
+     }
+
+     D_FREE( registered );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Probe( void *ctx, ... )
+{
+     D_DEBUG_AT( IDirectFBWindows_default, "%s()\n", __FUNCTION__ );
+
+     (void) ctx;
+
+     /* ... */
+
+     return DFB_OK;
+}
+
+static DirectResult
+Construct( void *interface, ... )
+{
+     DFBResult         ret = DFB_INVARG;
+     IDirectFB        *dfb;
+     IDirectFBWindows *thiz = interface;
+     CoreDFB          *core;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindows)
+
+     D_DEBUG_AT( IDirectFBWindows_default, "%s( %p )\n", __FUNCTION__, thiz );
+
+     va_list tag;
+     va_start(tag, interface);
+     dfb = va_arg(tag, IDirectFB *);
+     core = va_arg(tag, CoreDFB *);
+     va_end( tag );
+
+     /* Check arguments. */
+     if (!thiz)
+          goto error;
+
+     /* Initialize interface data. */
+     data->ref       = 1;
+     data->core      = core;
+     data->idirectfb = dfb;
+
+
+     /* Initialize function pointer table. */
+     thiz->AddRef             = IDirectFBWindows_AddRef;
+     thiz->Release            = IDirectFBWindows_Release;
+
+     thiz->RegisterWatcher    = IDirectFBWindows_RegisterWatcher;
+
+
+     return DFB_OK;
+
+
+error:
+     DIRECT_DEALLOCATE_INTERFACE(thiz);
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.h b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.h
new file mode 100755
index 0000000..ec6c8fb
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_default.h
@@ -0,0 +1,50 @@
+/*
+   (c) Copyright 2001-2008  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOWS_DEFAULT_H__
+#define __IIDIRECTFBWINDOWS_DEFAULT_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+
+/*
+ * private data struct of IDirectFBWindows
+ */
+typedef struct {
+     int                       ref;             /* reference counter */
+
+     CoreDFB                  *core;
+     IDirectFB                *idirectfb;
+
+     DirectLink               *watchers;
+} IDirectFBWindows_data;
+
+
+#endif
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.c b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.c
new file mode 100755
index 0000000..29549f0
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.c
@@ -0,0 +1,325 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbwindows_requestor.h"
+
+#include "idirectfbwindows_dispatcher.h"
+
+
+static DFBResult Probe();
+static DFBResult Construct( IDirectFBWindows *thiz,
+                            IDirectFBWindows *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBWindows, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBWindows_Dispatcher_Destruct( IDirectFBWindows *thiz )
+{
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBWindows_Dispatcher_AddRef( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Dispatcher_Release( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBWindows_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindows_Dispatcher_RegisterWatcher( IDirectFBWindows        *thiz,
+                                             const DFBWindowsWatcher *watcher,
+                                             void                    *context )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBWindows *thiz, IDirectFBWindows *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Dispatcher)
+
+     return thiz->Release( thiz );
+}
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     VoodooManager       *manager;
+
+     VoodooInstanceID     instance;
+} WatcherContext;
+
+static void
+IDirectFBWindows_Dispatcher_WindowAdd( void                *context,
+                                       const DFBWindowInfo *info )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowAdd, VREQ_NONE, NULL,
+                             VMBT_DATA, sizeof(DFBWindowInfo), info,
+                             VMBT_NONE );
+}
+
+static void
+IDirectFBWindows_Dispatcher_WindowRemove( void        *context,
+                                          DFBWindowID  window_id )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRemove, VREQ_NONE, NULL,
+                             VMBT_ID, window_id,
+                             VMBT_NONE );
+}
+
+static void
+IDirectFBWindows_Dispatcher_WindowConfig( void                  *context,
+                                          DFBWindowID            window_id,
+                                          const DFBWindowConfig *config,
+                                          DFBWindowConfigFlags   flags )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowConfig, VREQ_NONE, NULL,
+                             VMBT_ID, window_id,
+                             VMBT_DATA, sizeof(DFBWindowConfig), config,
+                             VMBT_INT, flags,
+                             VMBT_NONE );
+}
+
+static void
+IDirectFBWindows_Dispatcher_WindowState( void                 *context,
+                                         DFBWindowID           window_id,
+                                         const DFBWindowState *state )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowState, VREQ_NONE, NULL,
+                             VMBT_ID, window_id,
+                             VMBT_DATA, sizeof(DFBWindowState), state,
+                             VMBT_NONE );
+}
+
+static void
+IDirectFBWindows_Dispatcher_WindowRestack( void         *context,
+                                           DFBWindowID   window_id,
+                                           unsigned int  index )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRestack, VREQ_NONE, NULL,
+                             VMBT_ID, window_id,
+                             VMBT_UINT, index,
+                             VMBT_NONE );
+}
+
+static void
+IDirectFBWindows_Dispatcher_WindowFocus( void        *context,
+                                         DFBWindowID  window_id )
+{
+     WatcherContext *ctx = context;
+
+     voodoo_manager_request( ctx->manager, ctx->instance,
+                             IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowFocus, VREQ_NONE, NULL,
+                             VMBT_ID, window_id,
+                             VMBT_NONE );
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Dispatch_RegisterWatcher( IDirectFBWindows *thiz, IDirectFBWindows *real,
+                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult            ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     unsigned int         mask;
+     DFBWindowsWatcher    watcher;
+     WatcherContext      *context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_UINT( parser, mask );
+     VOODOO_PARSER_END( parser );
+
+     memset( &watcher, 0, sizeof(watcher) );
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowAdd))
+          watcher.WindowAdd = IDirectFBWindows_Dispatcher_WindowAdd;
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRemove))
+          watcher.WindowRemove = IDirectFBWindows_Dispatcher_WindowRemove;
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowConfig))
+          watcher.WindowConfig = IDirectFBWindows_Dispatcher_WindowConfig;
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowState))
+          watcher.WindowState = IDirectFBWindows_Dispatcher_WindowState;
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRestack))
+          watcher.WindowRestack = IDirectFBWindows_Dispatcher_WindowRestack;
+
+     if (mask & (1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowFocus))
+          watcher.WindowFocus = IDirectFBWindows_Dispatcher_WindowFocus;
+
+     context = D_CALLOC( 1, sizeof(WatcherContext) );
+     if (!context)
+          return D_OOM();
+
+     context->manager  = manager;
+     context->instance = instance;
+
+     ret = real->RegisterWatcher( real, &watcher, context );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial, DR_OK, VOODOO_INSTANCE_NONE, VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBWindows/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBWINDOWS_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_METHOD_ID_RegisterWatcher:
+               return Dispatch_RegisterWatcher( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBWindows *thiz,     /* Dispatcher interface */
+           IDirectFBWindows *real,     /* Real interface implementation */
+           VoodooManager    *manager,  /* Manager of the Voodoo framework */
+           VoodooInstanceID  super,    /* Instance ID of the super interface */
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindows_Dispatcher)
+
+     D_ASSERT( real != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     /* Register the dispatcher, getting a new instance ID that refers to it. */
+     ret = voodoo_manager_register_local( manager, false, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     /* Return the new instance. */
+     *ret_instance = instance;
+
+     /* Initialize interface data. */
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+
+     /* Initialize interface methods. */
+     thiz->AddRef          = IDirectFBWindows_Dispatcher_AddRef;
+     thiz->Release         = IDirectFBWindows_Dispatcher_Release;
+     thiz->RegisterWatcher = IDirectFBWindows_Dispatcher_RegisterWatcher;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.h b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.h
new file mode 100755
index 0000000..a1b39e1
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_dispatcher.h
@@ -0,0 +1,53 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOWS_DISPATCHER_H__
+#define __IDIRECTFBWINDOWS_DISPATCHER_H__
+
+#include <directfb_windows.h>
+
+
+#define IDIRECTFBWINDOWS_METHOD_ID_AddRef                     1
+#define IDIRECTFBWINDOWS_METHOD_ID_Release                    2
+#define IDIRECTFBWINDOWS_METHOD_ID_RegisterWatcher            3
+
+/*
+ * private data struct of IDirectFBWindows_Dispatcher
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBWindows    *real;
+
+     VoodooInstanceID     self;
+     VoodooInstanceID     super;
+
+     VoodooInstanceID     remote;
+} IDirectFBWindows_Dispatcher_data;
+
+#endif
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.c b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.c
new file mode 100755
index 0000000..16c7286
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.c
@@ -0,0 +1,365 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbwindows_dispatcher.h"
+
+#include "idirectfbwindows_requestor.h"
+
+
+static DFBResult Probe();
+static DFBResult Construct( IDirectFBWindows *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBWindows, Requestor )
+
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBWindows_Requestor_Destruct( IDirectFBWindows *thiz )
+{
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+IDirectFBWindows_Requestor_AddRef( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_Release( IDirectFBWindows *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBWindows_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DirectLink           link;
+
+     DFBWindowsWatcher    watcher;
+     void                *context;
+
+     VoodooInstanceID     instance;
+} RegisteredWatcher;
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowAdd( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBWindowInfo *info;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, info );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowAdd != NULL );
+
+     registered->watcher.WindowAdd( registered->context, info );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowRemove( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     VoodooInstanceID    window_id;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, window_id );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowRemove != NULL );
+
+     registered->watcher.WindowRemove( registered->context, window_id );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowConfig( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser    parser;
+     VoodooInstanceID       window_id;
+     const DFBWindowConfig *config;
+     DFBWindowConfigFlags   flags;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, window_id );
+     VOODOO_PARSER_GET_DATA( parser, config );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowConfig != NULL );
+
+     registered->watcher.WindowConfig( registered->context, window_id, config, flags );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowState( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser   parser;
+     VoodooInstanceID      window_id;
+     const DFBWindowState *state;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, window_id );
+     VOODOO_PARSER_GET_DATA( parser, state );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowState != NULL );
+
+     registered->watcher.WindowState( registered->context, window_id, state );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowRestack( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     VoodooInstanceID    window_id;
+     unsigned int        index;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, window_id );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowRestack != NULL );
+
+     registered->watcher.WindowRestack( registered->context, window_id, index );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher_WindowFocus( IDirectFBWindows *thiz, RegisteredWatcher *registered,
+                                                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     VoodooInstanceID    window_id;
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, window_id );
+     VOODOO_PARSER_END( parser );
+
+     D_ASSERT( registered->watcher.WindowFocus != NULL );
+
+     registered->watcher.WindowFocus( registered->context, window_id );
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBWindows_Requestor_DispatchWatcher( void                 *dispatcher,
+                                            void                 *real,
+                                            VoodooManager        *manager,
+                                            VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBWindows_Requestor/DispatchWatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowAdd:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowAdd( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRemove:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowRemove( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowConfig:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowConfig( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowState:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowState( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRestack:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowRestack( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowFocus:
+               return IDirectFBWindows_Requestor_DispatchWatcher_WindowFocus( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+IDirectFBWindows_Requestor_RegisterWatcher( IDirectFBWindows        *thiz,
+                                            const DFBWindowsWatcher *watcher,
+                                            void                    *context )
+{
+     DFBResult              ret;
+     RegisteredWatcher     *registered;
+     VoodooResponseMessage *response;
+     unsigned int           mask = 0;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindows_Requestor)
+
+     if (!watcher)
+          return DFB_INVARG;
+
+     if (watcher->WindowAdd)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowAdd;
+
+     if (watcher->WindowRemove)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRemove;
+
+     if (watcher->WindowConfig)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowConfig;
+
+     if (watcher->WindowState)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowState;
+
+     if (watcher->WindowRestack)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRestack;
+
+     if (watcher->WindowFocus)
+          mask |= 1 << IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowFocus;
+
+     if (!mask)
+          return DFB_INVARG;
+
+
+     registered = D_CALLOC( 1, sizeof(RegisteredWatcher) );
+     if (!registered)
+          return D_OOM();
+
+     registered->watcher = *watcher;
+     registered->context = context;
+
+     ret = voodoo_manager_register_local( data->manager, false, thiz, registered,
+                                          IDirectFBWindows_Requestor_DispatchWatcher, ®istered->instance );
+     if (ret) {
+          D_DERROR( ret, "IDirectFBWindows_Requestor_RegisterWatcher: Could not register local instance!\n" );
+          goto error;
+     }
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOWS_METHOD_ID_RegisterWatcher, VREQ_RESPOND, &response,
+                                   VMBT_ID, registered->instance,
+                                   VMBT_UINT, mask,
+                                   VMBT_NONE );
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          goto error;
+     }
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (ret)
+          goto error;
+
+
+     direct_list_append( &data->watchers, ®istered->link );
+
+     return DFB_OK;
+
+
+error:
+     if (registered->instance)
+          voodoo_manager_unregister_local( data->manager, registered->instance );
+
+     D_FREE( registered );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBWindows *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindows_Requestor)
+
+     data->ref       = 1;
+     data->manager   = manager;
+     data->instance  = instance;
+     data->idirectfb = arg;
+
+     thiz->AddRef          = IDirectFBWindows_Requestor_AddRef;
+     thiz->Release         = IDirectFBWindows_Requestor_Release;
+     thiz->RegisterWatcher = IDirectFBWindows_Requestor_RegisterWatcher;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.h b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.h
new file mode 100755
index 0000000..2d61e81
--- /dev/null
+++ b/Source/DirectFB/interfaces/IDirectFBWindows/idirectfbwindows_requestor.h
@@ -0,0 +1,58 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOWS_REQUESTOR_H__
+#define __IDIRECTFBWINDOWS_REQUESTOR_H__
+
+#include <directfb.h>
+
+#include <voodoo/manager.h>
+
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowAdd     1
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRemove  2
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowConfig  3
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowState   4
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowRestack 5
+#define IDIRECTFBWINDOWS_REQUESTOR_METHOD_ID_DispatchWatcher_WindowFocus   6
+
+/*
+ * private data struct of IDirectFBWindows_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFB           *idirectfb;
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+
+     DirectLink          *watchers;
+} IDirectFBWindows_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/interfaces/Makefile.am b/Source/DirectFB/interfaces/Makefile.am
new file mode 100755
index 0000000..6a3d7b1
--- /dev/null
+++ b/Source/DirectFB/interfaces/Makefile.am
@@ -0,0 +1,6 @@
+## Makefile.am for DirectFB/interfaces
+
+SUBDIRS = \
+	IDirectFBFont		\
+	IDirectFBImageProvider	\
+	IDirectFBVideoProvider
diff --git a/Source/DirectFB/interfaces/Makefile.in b/Source/DirectFB/interfaces/Makefile.in
new file mode 100755
index 0000000..4d34421
--- /dev/null
+++ b/Source/DirectFB/interfaces/Makefile.in
@@ -0,0 +1,560 @@
+# 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@
+subdir = interfaces
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = \
+	IDirectFBFont		\
+	IDirectFBImageProvider	\
+	IDirectFBVideoProvider
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  interfaces/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  interfaces/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/lib/Makefile.am b/Source/DirectFB/lib/Makefile.am
new file mode 100755
index 0000000..89ac43d
--- /dev/null
+++ b/Source/DirectFB/lib/Makefile.am
@@ -0,0 +1,7 @@
+## Makefile.am for DirectFB/lib
+
+if ENABLE_VOODOO
+VOODOO_DIR = voodoo
+endif
+
+SUBDIRS = direct fusion $(VOODOO_DIR)
diff --git a/Source/DirectFB/lib/Makefile.in b/Source/DirectFB/lib/Makefile.in
new file mode 100755
index 0000000..5c1ee83
--- /dev/null
+++ b/Source/DirectFB/lib/Makefile.in
@@ -0,0 +1,557 @@
+# 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@
+subdir = lib
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = direct fusion voodoo
+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@
+@ENABLE_VOODOO_TRUE@VOODOO_DIR = voodoo
+SUBDIRS = direct fusion $(VOODOO_DIR)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  lib/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/lib/direct/Makefile.am b/Source/DirectFB/lib/direct/Makefile.am
new file mode 100755
index 0000000..c7604cd
--- /dev/null
+++ b/Source/DirectFB/lib/direct/Makefile.am
@@ -0,0 +1,138 @@
+## Makefile.am for DirectFB/lib/direct
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = direct.pc
+
+EXTRA_DIST = \
+	armasm_memcpy.S			\
+	armasm_memcpy.h			\
+	ppcasm_memcpy.S			\
+	ppcasm_memcpy_cachable.S	\
+	ppcasm_memcpy.h			\
+	ppc_asm.h
+
+if BUILDPPCASM
+if HAVE_LINUX
+ppcasm_sources = ppcasm_memcpy.S ppcasm_memcpy_cachable.S
+else
+ppcasm_sources = ppcasm_memcpy.S
+endif
+
+ppcasm_headers = ppcasm_memcpy.h ppc_asm.h
+endif
+
+if BUILDARMASM
+armasm_sources = armasm_memcpy.S
+armasm_header = armasm_memcpy.h
+endif
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/direct
+
+
+includedir = @INCLUDEDIR@/direct
+
+include_HEADERS = \
+	$(ppcasm_headers)		\
+	$(armasm_headers)		\
+	build.h				\
+	clock.h				\
+	conf.h				\
+	debug.h				\
+	direct.h			\
+	hash.h				\
+	interface.h			\
+	interface_implementation.h	\
+	list.h				\
+	log.h				\
+	mem.h				\
+	memcpy.h			\
+	messages.h			\
+	modules.h			\
+	serial.h			\
+	signals.h			\
+	stream.h			\
+	system.h			\
+	thread.h			\
+	trace.h				\
+	tree.h				\
+	types.h				\
+	utf8.h				\
+	fastlz.h			\
+	flz.h			\
+	util.h
+
+
+lib_LTLIBRARIES = libdirect.la
+
+libdirect_la_SOURCES = \
+	$(ppcasm_sources)	\
+	$(armasm_sources)	\
+	clock.c			\
+	conf.c			\
+	debug.c			\
+	direct.c		\
+	hash.c			\
+	interface.c		\
+	list.c			\
+	log.c			\
+	mem.c			\
+	memcpy.c		\
+	messages.c		\
+	modules.c		\
+	signals.c		\
+	stream.c		\
+	system.c		\
+	trace.c			\
+	tree.c			\
+	thread.c		\
+	utf8.c			\
+	fastlz.c		\
+	flz.c		\
+	util.c
+
+libdirect_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+
+#
+## and now rebuild the static version with the *correct* object files
+#
+if BUILD_STATIC
+
+clean-local:
+	rm -f libdirect_fixed.a
+
+all-local: libdirect_fixed.a
+
+libdirect_fixed.a: .libs/libdirect.a
+	rm -f libdirect_fixed.a
+	${AR} cru libdirect_fixed.a `find . -name "*.o" | grep -v '.libs' | grep -v dtest`
+	${RANLIB} libdirect_fixed.a
+	cp -pf libdirect_fixed.a .libs/libdirect.a
+
+.libs/libdirect.a: libdirect.la
+
+else
+
+clean-local:
+
+all-local:
+
+endif
+
+
+include $(top_srcdir)/rules/nmfile.make
diff --git a/Source/DirectFB/lib/direct/Makefile.in b/Source/DirectFB/lib/direct/Makefile.in
new file mode 100755
index 0000000..efb1a74
--- /dev/null
+++ b/Source/DirectFB/lib/direct/Makefile.in
@@ -0,0 +1,769 @@
+# 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 = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/build.h.in \
+	$(srcdir)/direct.pc.in $(top_srcdir)/rules/nmfile.make
+subdir = lib/direct
+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 = build.h direct.pc
+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)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
+	"$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libdirect_la_LIBADD =
+am__libdirect_la_SOURCES_DIST = ppcasm_memcpy.S \
+	ppcasm_memcpy_cachable.S armasm_memcpy.S clock.c conf.c \
+	debug.c direct.c hash.c interface.c list.c log.c mem.c \
+	memcpy.c messages.c modules.c signals.c stream.c system.c \
+	trace.c tree.c thread.c utf8.c util.c
+@BUILDPPCASM_TRUE@@HAVE_LINUX_FALSE@am__objects_1 = ppcasm_memcpy.lo
+@BUILDPPCASM_TRUE@@HAVE_LINUX_TRUE@am__objects_1 = ppcasm_memcpy.lo \
+@BUILDPPCASM_TRUE@@HAVE_LINUX_TRUE@	ppcasm_memcpy_cachable.lo
+@BUILDARMASM_TRUE@am__objects_2 = armasm_memcpy.lo
+am_libdirect_la_OBJECTS = $(am__objects_1) $(am__objects_2) clock.lo \
+	conf.lo debug.lo direct.lo hash.lo interface.lo list.lo log.lo \
+	mem.lo memcpy.lo messages.lo modules.lo signals.lo stream.lo \
+	system.lo trace.lo tree.lo thread.lo utf8.lo util.lo
+libdirect_la_OBJECTS = $(am_libdirect_la_OBJECTS)
+libdirect_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirect_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+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 = $(libdirect_la_SOURCES)
+DIST_SOURCES = $(am__libdirect_la_SOURCES_DIST)
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+am__include_HEADERS_DIST = ppcasm_memcpy.h ppc_asm.h build.h clock.h \
+	conf.h debug.h direct.h hash.h interface.h \
+	interface_implementation.h list.h log.h mem.h memcpy.h \
+	messages.h modules.h serial.h signals.h stream.h system.h \
+	thread.h trace.h tree.h types.h utf8.h util.h
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+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@/direct
+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_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = direct.pc
+EXTRA_DIST = \
+	armasm_memcpy.S			\
+	armasm_memcpy.h			\
+	ppcasm_memcpy.S			\
+	ppcasm_memcpy_cachable.S	\
+	ppcasm_memcpy.h			\
+	ppc_asm.h
+
+@BUILDPPCASM_TRUE@@HAVE_LINUX_FALSE@ppcasm_sources = ppcasm_memcpy.S
+@BUILDPPCASM_TRUE@@HAVE_LINUX_TRUE@ppcasm_sources = ppcasm_memcpy.S ppcasm_memcpy_cachable.S
+@BUILDPPCASM_TRUE@ppcasm_headers = ppcasm_memcpy.h ppc_asm.h
+@BUILDARMASM_TRUE@armasm_sources = armasm_memcpy.S
+@BUILDARMASM_TRUE@armasm_header = armasm_memcpy.h
+include_HEADERS = \
+	$(ppcasm_headers)		\
+	$(armasm_headers)		\
+	build.h				\
+	clock.h				\
+	conf.h				\
+	debug.h				\
+	direct.h			\
+	hash.h				\
+	interface.h			\
+	interface_implementation.h	\
+	list.h				\
+	log.h				\
+	mem.h				\
+	memcpy.h			\
+	messages.h			\
+	modules.h			\
+	serial.h			\
+	signals.h			\
+	stream.h			\
+	system.h			\
+	thread.h			\
+	trace.h				\
+	tree.h				\
+	types.h				\
+	utf8.h				\
+	util.h
+
+lib_LTLIBRARIES = libdirect.la
+libdirect_la_SOURCES = \
+	$(ppcasm_sources)	\
+	$(armasm_sources)	\
+	clock.c			\
+	conf.c			\
+	debug.c			\
+	direct.c		\
+	hash.c			\
+	interface.c		\
+	list.c			\
+	log.c			\
+	mem.c			\
+	memcpy.c		\
+	messages.c		\
+	modules.c		\
+	signals.c		\
+	stream.c		\
+	system.c		\
+	trace.c			\
+	tree.c			\
+	thread.c		\
+	utf8.c			\
+	util.c
+
+libdirect_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@LIBTONM = $(LTLIBRARIES:.la=-$(LT_RELEASE).so.$(LT_BINARY))
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/nmfile.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  lib/direct/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  lib/direct/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
+build.h: $(top_builddir)/config.status $(srcdir)/build.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+direct.pc: $(top_builddir)/config.status $(srcdir)/direct.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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
+libdirect.la: $(libdirect_la_OBJECTS) $(libdirect_la_DEPENDENCIES) 
+	$(libdirect_la_LINK) -rpath $(libdir) $(libdirect_la_OBJECTS) $(libdirect_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/armasm_memcpy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcpy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messages.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modules.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcasm_memcpy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcasm_memcpy_cachable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signals.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@
+
+.S.o:
+@am__fastdepCCAS_TRUE@	$(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@	$(CPPASCOMPILE) -c -o $@ $<
+
+.S.obj:
+@am__fastdepCCAS_TRUE@	$(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCCAS_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@	$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.S.lo:
+@am__fastdepCCAS_TRUE@	$(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@	$(LTCPPASCOMPILE) -c -o $@ $<
+
+.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-pkgconfigDATA: $(pkgconfig_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+
+uninstall-pkgconfigDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$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) $(HEADERS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; 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."
+@BUILD_SHARED_FALSE@install-data-local:
+@ENABLE_TRACE_FALSE@install-data-local:
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	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-data-local install-includeHEADERS \
+	install-pkgconfigDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-exec-local install-libLTLIBRARIES
+
+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-includeHEADERS uninstall-libLTLIBRARIES \
+	uninstall-pkgconfigDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+	clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	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-data-local install-dvi install-dvi-am \
+	install-exec install-exec-am install-exec-local install-html \
+	install-html-am install-includeHEADERS install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-pkgconfigDATA 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-includeHEADERS uninstall-libLTLIBRARIES \
+	uninstall-pkgconfigDATA
+
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/direct
+
+#
+#
+
+@BUILD_STATIC_TRUE@clean-local:
+@BUILD_STATIC_TRUE@	rm -f libdirect_fixed.a
+
+@BUILD_STATIC_TRUE@all-local: libdirect_fixed.a
+
+@BUILD_STATIC_TRUE@libdirect_fixed.a: .libs/libdirect.a
+@BUILD_STATIC_TRUE@	rm -f libdirect_fixed.a
+@BUILD_STATIC_TRUE@	${AR} cru libdirect_fixed.a `find . -name "*.o" | grep -v '.libs' | grep -v dtest`
+@BUILD_STATIC_TRUE@	${RANLIB} libdirect_fixed.a
+@BUILD_STATIC_TRUE@	cp -pf libdirect_fixed.a .libs/libdirect.a
+
+@BUILD_STATIC_TRUE@.libs/libdirect.a: libdirect.la
+
+@BUILD_STATIC_FALSE@clean-local:
+
+@BUILD_STATIC_FALSE@all-local:
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@install-data-local:
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	mkdir -p -- "$(DESTDIR)$(libdir)"
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	nm -n ".libs/$(LIBTONM)" > "$(DESTDIR)$(libdir)/nm-n.$(LIBTONM)"
+# 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/lib/direct/armasm_memcpy.S b/Source/DirectFB/lib/direct/armasm_memcpy.S
new file mode 100755
index 0000000..e422168
--- /dev/null
+++ b/Source/DirectFB/lib/direct/armasm_memcpy.S
@@ -0,0 +1,421 @@
+/*
+ * ARM memcpy asm replacement.
+ *
+ * Copyright (C) 2009 Bluush Dev Team.
+ *
+ * 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>
+
+#if USE_ARMASM && !WORDS_BIGENDIAN
+
+#define _LABEL(f)   f :
+
+.global direct_armasm_memcpy
+
+	.code 32
+
+_LABEL(direct_armasm_memcpy)	
+	cmp r1, r0
+	bcc Lmemcpy_backwards
+
+	moveq r0, #0
+	moveq pc, lr
+	
+	stmdb sp!, {r0, lr}
+	subs r2, r2, #4
+	blt Lmemcpy_fl4
+	ands r12, r0, #3
+	bne Lmemcpy_fdestul
+	ands r12, r1, #3
+	bne Lmemcpy_fsrcul
+
+_LABEL(Lmemcpy_ft8)
+	subs r2, r2, #8
+	blt Lmemcpy_fl12
+	subs r2, r2, #0x14        
+	blt Lmemcpy_fl32
+	stmdb sp!, {r4}
+
+_LABEL(Lmemcpy_floop32)
+	ldmia r1!, {r3, r4, r12, lr}
+	stmia r0!, {r3, r4, r12, lr}
+	ldmia r1!, {r3, r4, r12, lr}
+	stmia r0!, {r3, r4, r12, lr}
+	subs r2, r2, #0x20        
+	bge Lmemcpy_floop32
+
+	cmn r2, #0x10
+	ldmgeia r1!, {r3, r4, r12, lr}
+	stmgeia r0!, {r3, r4, r12, lr}
+	subge r2, r2, #0x10        
+	ldmia sp!, {r4}
+
+_LABEL(Lmemcpy_fl32)
+	adds r2, r2, #0x14        
+
+
+_LABEL(Lmemcpy_floop12)
+	ldmgeia r1!, {r3, r12, lr}
+	stmgeia r0!, {r3, r12, lr}
+	subges r2, r2, #0x0c        
+	bge Lmemcpy_floop12
+
+_LABEL(Lmemcpy_fl12)
+	adds r2, r2, #8
+	blt Lmemcpy_fl4
+
+	subs r2, r2, #4
+	ldrlt r3, [r1], #4
+	strlt r3, [r0], #4
+	ldmgeia r1!, {r3, r12}
+	stmgeia r0!, {r3, r12}
+	subge r2, r2, #4
+
+_LABEL(Lmemcpy_fl4)
+	adds r2, r2, #4
+	ldmeqia sp!, {r0, pc}
+	
+	cmp r2, #2
+	ldrb r3, [r1], #1
+	strb r3, [r0], #1
+	ldrgeb r3, [r1], #1
+	strgeb r3, [r0], #1
+	ldrgtb r3, [r1], #1
+	strgtb r3, [r0], #1
+	ldmia sp!, {r0, pc}
+
+
+_LABEL(Lmemcpy_fdestul)
+	rsb r12, r12, #4
+	cmp r12, #2
+	
+	ldrb r3, [r1], #1
+	strb r3, [r0], #1
+	ldrgeb r3, [r1], #1
+	strgeb r3, [r0], #1
+	ldrgtb r3, [r1], #1
+	strgtb r3, [r0], #1
+	subs r2, r2, r12
+	blt Lmemcpy_fl4
+	
+	ands r12, r1, #3
+	beq Lmemcpy_ft8
+
+
+_LABEL(Lmemcpy_fsrcul)
+	bic r1, r1, #3
+	ldr lr, [r1], #4
+	cmp r12, #2
+	bgt Lmemcpy_fsrcul3
+	beq Lmemcpy_fsrcul2
+	cmp r2, #0x0c            
+	blt Lmemcpy_fsrcul1loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5}
+
+_LABEL(Lmemcpy_fsrcul1loop16)
+	mov r3, lr, lsr #8
+	ldmia r1!, {r4, r5, r12, lr}
+	orr r3, r3, r4, lsl #24
+	mov r4, r4, lsr #8
+	orr r4, r4, r5, lsl #24
+	mov r5, r5, lsr #8
+	orr r5, r5, r12, lsl #24
+	mov r12, r12, lsr #8
+	orr r12, r12, lr, lsl #24
+	stmia r0!, {r3-r5, r12}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_fsrcul1loop16
+	ldmia sp!, {r4, r5}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_fsrcul1l4
+
+_LABEL(Lmemcpy_fsrcul1loop4)
+	mov r12, lr, lsr #8
+	ldr lr, [r1], #4
+	orr r12, r12, lr, lsl #24
+	str r12, [r0], #4
+	subs r2, r2, #4
+	bge Lmemcpy_fsrcul1loop4
+
+_LABEL(Lmemcpy_fsrcul1l4)
+	sub r1, r1, #3
+	b Lmemcpy_fl4
+
+_LABEL(Lmemcpy_fsrcul2)
+	cmp r2, #0x0c            
+	blt Lmemcpy_fsrcul2loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5}
+
+_LABEL(Lmemcpy_fsrcul2loop16)
+	mov r3, lr, lsr #16
+	ldmia r1!, {r4, r5, r12, lr}
+	orr r3, r3, r4, lsl #16
+	mov r4, r4, lsr #16
+	orr r4, r4, r5, lsl #16
+	mov r5, r5, lsr #16
+	orr r5, r5, r12, lsl #16
+	mov r12, r12, lsr #16
+	orr r12, r12, lr, lsl #16
+	stmia r0!, {r3-r5, r12}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_fsrcul2loop16
+	ldmia sp!, {r4, r5}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_fsrcul2l4
+
+_LABEL(Lmemcpy_fsrcul2loop4)
+	mov r12, lr, lsr #16
+	ldr lr, [r1], #4
+	orr r12, r12, lr, lsl #16
+	str r12, [r0], #4
+	subs r2, r2, #4
+	bge Lmemcpy_fsrcul2loop4
+
+_LABEL(Lmemcpy_fsrcul2l4)
+	sub r1, r1, #2
+	b Lmemcpy_fl4
+
+_LABEL(Lmemcpy_fsrcul3)
+	cmp r2, #0x0c            
+	blt Lmemcpy_fsrcul3loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5}
+
+_LABEL(Lmemcpy_fsrcul3loop16)
+	mov r3, lr, lsr #24
+	ldmia r1!, {r4, r5, r12, lr}
+	orr r3, r3, r4, lsl #8
+	mov r4, r4, lsr #24
+	orr r4, r4, r5, lsl #8
+	mov r5, r5, lsr #24
+	orr r5, r5, r12, lsl #8
+	mov r12, r12, lsr #24
+	orr r12, r12, lr, lsl #8
+	stmia r0!, {r3-r5, r12}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_fsrcul3loop16
+	ldmia sp!, {r4, r5}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_fsrcul3l4
+
+_LABEL(Lmemcpy_fsrcul3loop4)
+	mov r12, lr, lsr #24
+	ldr lr, [r1], #4
+	orr r12, r12, lr, lsl #8
+	str r12, [r0], #4
+	subs r2, r2, #4
+	bge Lmemcpy_fsrcul3loop4
+
+_LABEL(Lmemcpy_fsrcul3l4)
+	sub r1, r1, #1
+	b Lmemcpy_fl4
+
+_LABEL(Lmemcpy_backwards)
+	add r1, r1, r2
+	add r0, r0, r2
+	subs r2, r2, #4
+	blt Lmemcpy_bl4
+	ands r12, r0, #3
+	bne Lmemcpy_bdestul
+	ands r12, r1, #3
+	bne Lmemcpy_bsrcul
+
+_LABEL(Lmemcpy_bt8)
+	subs r2, r2, #8
+	blt Lmemcpy_bl12
+	stmdb sp!, {r4, lr}
+	subs r2, r2, #0x14
+	blt Lmemcpy_bl32
+
+
+_LABEL(Lmemcpy_bloop32)
+	ldmdb r1!, {r3, r4, r12, lr}
+	stmdb r0!, {r3, r4, r12, lr}
+	ldmdb r1!, {r3, r4, r12, lr}
+	stmdb r0!, {r3, r4, r12, lr}
+	subs r2, r2, #0x20        
+	bge Lmemcpy_bloop32
+
+_LABEL(Lmemcpy_bl32)
+	cmn r2, #0x10            
+	ldmgedb r1!, {r3, r4, r12, lr}
+	stmgedb r0!, {r3, r4, r12, lr}
+	subge r2, r2, #0x10        
+	adds r2, r2, #0x14        
+	ldmgedb r1!, {r3, r12, lr}
+	stmgedb r0!, {r3, r12, lr}
+	subge r2, r2, #0x0c        
+	ldmia sp!, {r4, lr}
+
+_LABEL(Lmemcpy_bl12)
+	adds r2, r2, #8
+	blt Lmemcpy_bl4
+	subs r2, r2, #4
+	ldrlt r3, [r1, #-4]!
+	strlt r3, [r0, #-4]!
+	ldmgedb r1!, {r3, r12}
+	stmgedb r0!, {r3, r12}
+	subge r2, r2, #4
+
+_LABEL(Lmemcpy_bl4)
+	adds r2, r2, #4
+	moveq pc, lr
+
+	cmp r2, #2
+	ldrb r3, [r1, #-1]!
+	strb r3, [r0, #-1]!
+	ldrgeb r3, [r1, #-1]!
+	strgeb r3, [r0, #-1]!
+	ldrgtb r3, [r1, #-1]!
+	strgtb r3, [r0, #-1]!
+	mov pc, lr
+
+
+_LABEL(Lmemcpy_bdestul)
+	cmp r12, #2
+
+	ldrb r3, [r1, #-1]!
+	strb r3, [r0, #-1]!
+	ldrgeb r3, [r1, #-1]!
+	strgeb r3, [r0, #-1]!
+	ldrgtb r3, [r1, #-1]!
+	strgtb r3, [r0, #-1]!
+	subs r2, r2, r12
+	blt Lmemcpy_bl4
+	ands r12, r1, #3
+	beq Lmemcpy_bt8
+
+
+_LABEL(Lmemcpy_bsrcul)
+	bic r1, r1, #3
+	ldr r3, [r1, #0]
+	cmp r12, #2
+	blt Lmemcpy_bsrcul1
+	beq Lmemcpy_bsrcul2
+	cmp r2, #0x0c            
+	blt Lmemcpy_bsrcul3loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5, lr}
+
+_LABEL(Lmemcpy_bsrcul3loop16)
+	mov lr, r3, lsl #8
+	ldmdb r1!, {r3-r5, r12}
+	orr lr, lr, r12, lsr #24
+	mov r12, r12, lsl #8
+	orr r12, r12, r5, lsr #24
+	mov r5, r5, lsl #8
+	orr r5, r5, r4, lsr #24
+	mov r4, r4, lsl #8
+	orr r4, r4, r3, lsr #24
+	stmdb r0!, {r4, r5, r12, lr}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_bsrcul3loop16
+	ldmia sp!, {r4, r5, lr}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_bsrcul3l4
+
+_LABEL(Lmemcpy_bsrcul3loop4)
+	mov r12, r3, lsl #8
+	ldr r3, [r1, #-4]!
+	orr r12, r12, r3, lsr #24
+	str r12, [r0, #-4]!
+	subs r2, r2, #4
+	bge Lmemcpy_bsrcul3loop4
+
+_LABEL(Lmemcpy_bsrcul3l4)
+	add r1, r1, #3
+	b Lmemcpy_bl4
+
+_LABEL(Lmemcpy_bsrcul2)
+	cmp r2, #0x0c            
+	blt Lmemcpy_bsrcul2loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5, lr}
+
+_LABEL(Lmemcpy_bsrcul2loop16)
+	mov lr, r3, lsl #16
+	ldmdb r1!, {r3-r5, r12}
+	orr lr, lr, r12, lsr #16
+	mov r12, r12, lsl #16
+	orr r12, r12, r5, lsr #16
+	mov r5, r5, lsl #16
+	orr r5, r5, r4, lsr #16
+	mov r4, r4, lsl #16
+	orr r4, r4, r3, lsr #16
+	stmdb r0!, {r4, r5, r12, lr}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_bsrcul2loop16
+	ldmia sp!, {r4, r5, lr}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_bsrcul2l4
+
+_LABEL(Lmemcpy_bsrcul2loop4)
+	mov r12, r3, lsl #16
+	ldr r3, [r1, #-4]!
+	orr r12, r12, r3, lsr #16
+	str r12, [r0, #-4]!
+	subs r2, r2, #4
+	bge Lmemcpy_bsrcul2loop4
+
+_LABEL(Lmemcpy_bsrcul2l4)
+	add r1, r1, #2
+	b Lmemcpy_bl4
+
+_LABEL(Lmemcpy_bsrcul1)
+	cmp r2, #0x0c            
+	blt Lmemcpy_bsrcul1loop4
+	sub r2, r2, #0x0c        
+	stmdb sp!, {r4, r5, lr}
+
+_LABEL(Lmemcpy_bsrcul1loop32)
+	mov lr, r3, lsl #24
+	ldmdb r1!, {r3-r5, r12}
+	orr lr, lr, r12, lsr #8
+	mov r12, r12, lsl #24
+	orr r12, r12, r5, lsr #8
+	mov r5, r5, lsl #24
+	orr r5, r5, r4, lsr #8
+	mov r4, r4, lsl #24
+	orr r4, r4, r3, lsr #8
+	stmdb r0!, {r4, r5, r12, lr}
+	subs r2, r2, #0x10        
+	bge Lmemcpy_bsrcul1loop32
+	ldmia sp!, {r4, r5, lr}
+	adds r2, r2, #0x0c        
+	blt Lmemcpy_bsrcul1l4
+
+_LABEL(Lmemcpy_bsrcul1loop4)
+	mov r12, r3, lsl #24
+	ldr r3, [r1, #-4]!
+	orr r12, r12, r3, lsr #8
+	str r12, [r0, #-4]!
+	subs r2, r2, #4
+	bge Lmemcpy_bsrcul1loop4
+
+_LABEL(Lmemcpy_bsrcul1l4)
+	add r1, r1, #1
+	b Lmemcpy_bl4
+
+
+	.ltorg
+	
+#endif /* USE_ARMASM && !WORDS_BIGENDIAN */
+
+
diff --git a/Source/DirectFB/lib/direct/armasm_memcpy.h b/Source/DirectFB/lib/direct/armasm_memcpy.h
new file mode 100755
index 0000000..27138ab
--- /dev/null
+++ b/Source/DirectFB/lib/direct/armasm_memcpy.h
@@ -0,0 +1,32 @@
+/*
+ * ARM memcpy asm replacement.
+ *
+ * Copyright (C) 2009 Bluush Dev Team.
+ *
+ * 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 __ARMASM_MEMCPY_H__
+#define __ARMASM_MEMCPY_H__
+
+#if USE_ARMASM && !WORDS_BIGENDIAN
+
+void *direct_armasm_memcpy          ( void *dest, const void *src, size_t n);
+
+#endif /* USE_ARMASM && !WORDS_BIGENDIAN */
+
+#endif /* __ARMASM_MEMCPY_H__ */
+ 
diff --git a/Source/DirectFB/lib/direct/build.h.in b/Source/DirectFB/lib/direct/build.h.in
new file mode 100755
index 0000000..926cea5
--- /dev/null
+++ b/Source/DirectFB/lib/direct/build.h.in
@@ -0,0 +1,51 @@
+/*
+   (c) Copyright 2000-2002  convergence integrated media GmbH.
+   (c) Copyright 2002-2004  convergence GmbH.
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org> and
+              Ville Syrjälä <syrjala@sci.fi>.
+
+   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 __DIRECT__BUILD_H__
+#define __DIRECT__BUILD_H__
+
+#define DIRECT_BUILD_DEBUG   (@DIRECT_BUILD_DEBUG@)
+#define DIRECT_BUILD_DEBUGS  (@DIRECT_BUILD_DEBUGS@)
+#define DIRECT_BUILD_TRACE   (@DIRECT_BUILD_TRACE@)
+#define DIRECT_BUILD_TEXT    (@DIRECT_BUILD_TEXT@)
+#define DIRECT_BUILD_GETTID  (@DIRECT_BUILD_GETTID@)
+#define DIRECT_BUILD_NETWORK (@DIRECT_BUILD_NETWORK@)
+#define DIRECT_BUILD_STDBOOL (@DIRECT_BUILD_STDBOOL@)
+
+
+#if !DIRECT_BUILD_DEBUGS
+#if defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
+#define DIRECT_MINI_DEBUG
+#endif
+#undef DIRECT_ENABLE_DEBUG
+#ifdef DIRECT_FORCE_DEBUG
+#warning DIRECT_FORCE_DEBUG used with 'pure release' library headers.
+#undef DIRECT_FORCE_DEBUG
+#endif
+#endif
+ 
+#endif
diff --git a/Source/DirectFB/lib/direct/clock.c b/Source/DirectFB/lib/direct/clock.c
new file mode 100755
index 0000000..e77bfe2
--- /dev/null
+++ b/Source/DirectFB/lib/direct/clock.c
@@ -0,0 +1,135 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/util.h>
+
+#ifdef CLOCK_MONOTONIC
+#include <sys/syscall.h>
+#endif
+#include <sys/time.h>
+#include <time.h>
+
+D_DEBUG_DOMAIN( Direct_Clock, "Direct/Clock", "Time measurement etc." );
+
+static struct timeval start_time = { 0, 0 };
+
+/* libc has incredibly messy way of doing this,
+ * typically requiring -lrt. We just skip all this mess */
+struct timeval*
+direct_monotonic_gettimeofday( struct timeval *tv )
+{
+     struct timespec ts;
+
+#ifdef CLOCK_MONOTONIC
+     /* No locking or atomic ops for no_monotonic here */
+     static int no_monotonic = 0;
+
+     if (!no_monotonic)
+          if(syscall( __NR_clock_gettime, CLOCK_MONOTONIC, &ts ))
+              no_monotonic = 1;
+
+     if (no_monotonic)
+          if(syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts))
+#endif
+          {
+               gettimeofday( tv, NULL );
+               return tv;
+          }
+
+     tv->tv_sec = ts.tv_sec;
+     tv->tv_usec = ts.tv_nsec / 1000;
+
+     return tv;
+}
+
+long long
+direct_clock_get_micros( void )
+{
+     struct timeval tv;
+     long long      ret;
+
+     if (start_time.tv_sec == 0) {
+          direct_monotonic_gettimeofday( &start_time );
+          return 0;
+     }
+
+     direct_monotonic_gettimeofday( &tv );
+
+     ret = (long long)(tv.tv_sec - start_time.tv_sec) * 1000000LL +
+           (long long)(tv.tv_usec - start_time.tv_usec);
+     if (ret < 0) {
+          D_DEBUG_AT( Direct_Clock, "Clock skew detected (%lld in the past)!\n", -ret );
+          start_time = tv;
+          ret = 0;
+     }
+
+     return ret;
+}
+
+long long
+direct_clock_get_millis( void )
+{
+     return direct_clock_get_micros() / 1000LL;
+}
+
+void
+direct_clock_set_start( const struct timeval *start )
+{
+     long long diff;
+
+     D_ASSERT( start != NULL );
+
+     diff = (long long)(start->tv_sec  - start_time.tv_sec)  * 1000LL +
+            (long long)(start->tv_usec - start_time.tv_usec) / 1000LL;
+
+     D_DEBUG_AT( Direct_Clock, "Adjusting start time "
+                 "(%lld.%lld seconds diff)\n", diff / 1000LL, ABS(diff) % 1000LL );
+
+     start_time = *start;
+}
+
+long long
+direct_clock_get_abs_micros( void )
+{
+     struct timeval tv;
+
+     direct_monotonic_gettimeofday( &tv );
+
+     return (long long)(tv.tv_sec) * 1000000LL + (long long)(tv.tv_usec);
+}
+
+long long
+direct_clock_get_abs_millis( void )
+{
+     return direct_clock_get_abs_micros() / 1000LL;
+}
+
diff --git a/Source/DirectFB/lib/direct/clock.h b/Source/DirectFB/lib/direct/clock.h
new file mode 100755
index 0000000..dca6ea9
--- /dev/null
+++ b/Source/DirectFB/lib/direct/clock.h
@@ -0,0 +1,45 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__CLOCK_H__
+#define __DIRECT__CLOCK_H__
+
+#include <sys/time.h>
+
+struct timeval* direct_monotonic_gettimeofday( struct timeval *tv );
+
+long long direct_clock_get_micros( void );
+long long direct_clock_get_millis( void );
+
+void      direct_clock_set_start( const struct timeval *start );
+
+long long direct_clock_get_abs_micros( void );
+long long direct_clock_get_abs_millis( void );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/conf.c b/Source/DirectFB/lib/direct/conf.c
new file mode 100755
index 0000000..8be92af
--- /dev/null
+++ b/Source/DirectFB/lib/direct/conf.c
@@ -0,0 +1,348 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <string.h>
+
+#include <direct/conf.h>
+#include <direct/mem.h>
+#include <direct/util.h>
+
+
+static DirectConfig config = {
+     .debug                 = false,
+     .trace                 = true,
+     .sighandler            = true,
+
+     .fatal                 = DCFL_ASSERT,
+     .fatal_break           = true,
+     .thread_block_signals  = true,
+     .thread_priority_scale = 100,
+};
+
+DirectConfig *direct_config       = &config;
+const char   *direct_config_usage =
+     "libdirect options:\n"
+     "  memcpy=<method>                Skip memcpy() probing (help = show list)\n"
+     "  [no-]quiet                     Disable text output except debug messages or direct logs\n"
+     "  [no-]quiet=<type>              Only quiet certain types (cumulative with 'quiet')\n"
+     "                                 [ info | warning | error | once | unimplemented ]\n"
+     "  [no-]debug                     Enable debug output\n"
+     "  [no-]debugmem                  Enable memory allocation tracking\n"
+     "  [no-]trace                     Enable stack trace support\n"
+     "  log-file=<name>                Write all messages to a file\n"
+     "  log-udp=<host>:<port>          Send all messages via UDP to host:port\n"
+     "  fatal-level=<level>            Abort on NONE, ASSERT (default) or ASSUME (incl. assert)\n"
+     "  [no-]fatal-break               Abort on BREAK (default)\n"
+     "  dont-catch=<num>[[,<num>]...]  Don't catch these signals\n"
+     "  [no-]sighandler                Enable signal handler\n"
+     "  [no-]thread-block-signals      Block all signals in new threads?\n"
+     "  disable-module=<module_name>   suppress loading this module\n"
+     "  module-dir=<directory>         Override default module search directory (default = $libdir/directfb-x.y-z)\n"
+     "  thread-priority-scale=<100th>  Apply scaling factor on thread type based priorities\n"
+     "\n";
+
+/**********************************************************************************************************************/
+
+DirectResult
+direct_config_set( const char *name, const char *value )
+{
+     if (strcmp (name, "disable-module" ) == 0) {
+          if (value) {
+               int n = 0;
+
+               while (direct_config->disable_module &&
+                      direct_config->disable_module[n])
+                    n++;
+
+               direct_config->disable_module = D_REALLOC( direct_config->disable_module,
+                                                          sizeof(char*) * (n + 2) );
+
+               direct_config->disable_module[n] = D_STRDUP( value );
+               direct_config->disable_module[n+1] = NULL;
+          }
+          else {
+               D_ERROR("Direct/Config '%s': No module name specified!\n", name);
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "module-dir" ) == 0) {
+          if (value) {
+               if (direct_config->module_dir)
+                    D_FREE( direct_config->module_dir );
+               direct_config->module_dir = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("Direct/Config 'module-dir': No directory name specified!\n");
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "memcpy" ) == 0) {
+          if (value) {
+               if (direct_config->memcpy)
+                    D_FREE( direct_config->memcpy );
+               direct_config->memcpy = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("Direct/Config '%s': No method specified!\n", name);
+               return DR_INVARG;
+          }
+     }
+     else
+          if (strcmp (name, "quiet" ) == 0 || strcmp (name, "no-quiet" ) == 0) {
+          /* Enable/disable all at once by default. */
+          DirectMessageType type = DMT_ALL;
+
+          /* Find out the specific message type being configured. */
+          if (value) {
+               if (!strcmp( value, "info" ))           type = DMT_INFO;              else
+               if (!strcmp( value, "warning" ))        type = DMT_WARNING;           else
+               if (!strcmp( value, "error" ))          type = DMT_ERROR;             else
+               if (!strcmp( value, "once" ))           type = DMT_ONCE;              else
+               if (!strcmp( value, "unimplemented" ))  type = DMT_UNIMPLEMENTED; 
+               else {
+                    D_ERROR( "DirectFB/Config '%s': Unknown message type '%s'!\n", name, value );
+                    return DR_INVARG;
+               }
+          }
+
+          /* Set/clear the corresponding flag in the configuration. */
+          if (name[0] == 'q')
+               direct_config->quiet |= type;
+          else
+               direct_config->quiet &= ~type;
+     }
+     else
+          if (strcmp (name, "no-quiet" ) == 0) {
+          direct_config->quiet = false;
+     }
+     else
+          if (strcmp (name, "debug" ) == 0) {
+          if (value)
+               direct_debug_config_domain( value, true );
+          else
+               direct_config->debug = true;
+     }
+     else
+          if (strcmp (name, "no-debug" ) == 0) {
+          if (value)
+               direct_debug_config_domain( value, false );
+          else
+               direct_config->debug = false;
+     }
+     else
+          if (strcmp (name, "debugmem" ) == 0) {
+          direct_config->debugmem = true;
+     }
+     else
+          if (strcmp (name, "no-debugmem" ) == 0) {
+          direct_config->debugmem = false;
+     }
+     else
+          if (strcmp (name, "trace" ) == 0) {
+          direct_config->trace = true;
+     }
+     else
+          if (strcmp (name, "no-trace" ) == 0) {
+          direct_config->trace = false;
+     }
+     else
+          if (strcmp (name, "log-file" ) == 0 || strcmp (name, "log-udp" ) == 0) {
+          if (value) {
+               DirectResult  ret;
+               DirectLog    *log;
+
+               ret = direct_log_create( strcmp(name,"log-udp") ? DLT_FILE : DLT_UDP, value, &log );
+               if (ret)
+                    return ret;
+
+               if (direct_config->log)
+                    direct_log_destroy( direct_config->log );
+
+               direct_config->log = log;
+
+               direct_log_set_default( log );
+          }
+          else {
+               if (strcmp(name,"log-udp"))
+                    D_ERROR("Direct/Config '%s': No file name specified!\n", name);
+               else
+                    D_ERROR("Direct/Config '%s': No host and port specified!\n", name);
+               return DR_INVARG;
+          }
+     }
+     else
+          if (strcmp (name, "fatal-level" ) == 0) {
+          if (strcasecmp (value, "none" ) == 0) {
+               direct_config->fatal = DCFL_NONE;
+          }
+          else
+               if (strcasecmp (value, "assert" ) == 0) {
+               direct_config->fatal = DCFL_ASSERT;
+          }
+          else
+               if (strcasecmp (value, "assume" ) == 0) {
+               direct_config->fatal = DCFL_ASSUME;
+          }
+          else {
+               D_ERROR("Direct/Config '%s': Unknown level specified (use 'none', 'assert', 'assume')!\n", name);
+               return DR_INVARG;
+          }
+     }
+     else
+          if (strcmp (name, "fatal-break" ) == 0) {
+          direct_config->fatal_break = true;
+     }
+     else
+          if (strcmp (name, "no-fatal-break" ) == 0) {
+          direct_config->fatal_break = false;
+     }
+     else
+          if (strcmp (name, "sighandler" ) == 0) {
+          direct_config->sighandler = true;
+     }
+     else
+          if (strcmp (name, "no-sighandler" ) == 0) {
+          direct_config->sighandler = false;
+     }
+     else
+          if (strcmp (name, "dont-catch" ) == 0) {
+          if (value) {
+               char *signals   = D_STRDUP( value );
+               char *p = NULL, *r, *s = signals;
+
+               while ((r = strtok_r( s, ",", &p ))) {
+                    char          *error;
+                    unsigned long  signum;
+
+                    direct_trim( &r );
+
+                    signum = strtoul( r, &error, 10 );
+
+                    if (*error) {
+                         D_ERROR( "Direct/Config '%s': Error in number at '%s'!\n", name, error );
+                         D_FREE( signals );
+                         return DR_INVARG;
+                    }
+
+                    sigaddset( &direct_config->dont_catch, signum );
+
+                    s = NULL;
+               }
+
+               D_FREE( signals );
+          }
+          else {
+               D_ERROR("Direct/Config '%s': No signals specified!\n", name);
+               return DR_INVARG;
+          }
+     }
+     else
+          if (strcmp (name, "thread_block_signals") == 0) {
+          direct_config->thread_block_signals = true;
+     }
+     else
+          if (strcmp (name, "no-thread_block_signals") == 0) {
+          direct_config->thread_block_signals = false;
+     } else
+     if (strcmp (name, "thread-priority-scale" ) == 0) {
+          if (value) {
+               int scale;
+
+               if (sscanf( value, "%d", &scale ) < 1) {
+                    D_ERROR("Direct/Config '%s': Could not parse value!\n", name);
+                    return DR_INVARG;
+               }
+
+               direct_config->thread_priority_scale = scale;
+          }
+          else {
+               D_ERROR("Direct/Config '%s': No value specified!\n", name);
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "thread-priority" ) == 0) {  /* Must be moved to lib/direct/conf.c in trunk! */
+          if (value) {
+               int priority;
+
+               if (sscanf( value, "%d", &priority ) < 1) {
+                    D_ERROR("Direct/Config '%s': Could not parse value!\n", name);
+                    return DR_INVARG;
+               }
+
+               direct_config->thread_priority = priority;
+          }
+          else {
+               D_ERROR("Direct/Config '%s': No value specified!\n", name);
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "thread-scheduler" ) == 0) {  /* Must be moved to lib/direct/conf.c in trunk! */
+          if (value) {
+               if (strcmp( value, "other" ) == 0) {
+                    direct_config->thread_scheduler = DCTS_OTHER;
+               } else
+               if (strcmp( value, "fifo" ) == 0) {
+                    direct_config->thread_scheduler = DCTS_FIFO;
+               } else
+               if (strcmp( value, "rr" ) == 0) {
+                    direct_config->thread_scheduler = DCTS_RR;
+               } else {
+                    D_ERROR( "Direct/Config '%s': Unknown scheduler '%s'!\n", name, value );
+                    return DR_INVARG;
+               }
+          }
+          else {
+               D_ERROR( "Direct/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "thread-stacksize" ) == 0) {  /* Must be moved to lib/direct/conf.c in trunk! */
+          if (value) {
+               int size;
+
+               if (sscanf( value, "%d", &size ) < 1) {
+                    D_ERROR( "Direct/Config '%s': Could not parse value!\n", name );
+                    return DR_INVARG;
+               }
+
+               direct_config->thread_stack_size = size;
+          }
+          else {
+               D_ERROR( "Direct/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     }
+     else
+          return DR_UNSUPPORTED;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/direct/conf.h b/Source/DirectFB/lib/direct/conf.h
new file mode 100755
index 0000000..ef1230e
--- /dev/null
+++ b/Source/DirectFB/lib/direct/conf.h
@@ -0,0 +1,92 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__CONF_H__
+#define __DIRECT__CONF_H__
+
+
+#include <direct/messages.h>
+
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#else
+#include <sys/signal.h>
+#endif
+
+typedef enum {
+     DCFL_NONE,     /* None is fatal. */
+     DCFL_ASSERT,   /* ASSERT is fatal. */
+     DCFL_ASSUME    /* ASSERT and ASSUME are fatal. */
+} DirectConfigFatalLevel;
+
+typedef enum {
+     DCTS_OTHER,
+     DCTS_FIFO,
+     DCTS_RR
+} DirectConfigThreadScheduler;
+
+struct __D_DirectConfig {
+     DirectMessageType             quiet;
+     bool                          debug;
+     bool                          trace;
+
+     char                         *memcpy;            /* Don't probe for memcpy routines to save a lot of
+                                                         startup time. Use this one instead if it's set. */
+
+     char                        **disable_module;    /* Never load these modules. */
+     char                         *module_dir;        /* module dir override */
+
+     bool                          sighandler;
+     sigset_t                      dont_catch;        /* don't catch these signals */
+
+     DirectLog                    *log;
+
+     DirectConfigFatalLevel        fatal;
+     
+     bool                          debugmem;
+
+     bool                          thread_block_signals;
+
+     bool                          fatal_break;        /* Should D_BREAK() cause a trap? */
+
+     int                           thread_priority;
+     DirectConfigThreadScheduler   thread_scheduler;
+     int                           thread_stack_size;
+     int                           thread_priority_scale;
+};
+
+extern DirectConfig *direct_config;
+
+extern const char   *direct_config_usage;
+
+
+DirectResult direct_config_set( const char *name, const char *value );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/debug.c b/Source/DirectFB/lib/direct/debug.c
new file mode 100755
index 0000000..6aad0a1
--- /dev/null
+++ b/Source/DirectFB/lib/direct/debug.c
@@ -0,0 +1,430 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/build.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/log.h>
+#include <direct/thread.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+
+#if DIRECT_BUILD_TEXT
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+typedef struct {
+     DirectLink  link;
+     char       *name;
+     bool        enabled;
+} DebugDomainEntry;
+
+/**************************************************************************************************/
+
+static pthread_mutex_t  domains_lock = PTHREAD_MUTEX_INITIALIZER;
+static unsigned int     domains_age  = 1;
+static DirectLink      *domains      = NULL;
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+static inline DebugDomainEntry *
+lookup_domain( const char *name, bool sub )
+{
+     DebugDomainEntry *entry;
+
+     direct_list_foreach (entry, domains) {
+          if (! strcasecmp( entry->name, name ))
+               return entry;
+     }
+
+     /*
+      * If the domain being registered contains a slash, but didn't exactly match an entry
+      * in directfbrc, check to see if the domain is descended from an entry in directfbrc
+      * (e.g. 'ui/field/messages' matches 'ui' or 'ui/field')
+      */
+     if (sub && strchr(name, '/')) {
+          int passed_name_len = strlen( name );
+
+          direct_list_foreach (entry, domains) {
+               int entry_len = strlen( entry->name );
+               if ((passed_name_len > entry_len) &&
+                   (name[entry_len] == '/') &&
+                   (! strncasecmp( entry->name, name, entry_len))) {
+                    return entry;
+               }
+          }
+     }
+
+     return NULL;
+}
+
+__attribute__((no_instrument_function))
+static inline bool
+check_domain( DirectDebugDomain *domain )
+{
+     if (domain->age != domains_age) {
+          DebugDomainEntry *entry = lookup_domain( domain->name, true );
+
+          domain->age = domains_age;
+
+          if (entry) {
+               domain->registered = true;
+               domain->enabled    = entry->enabled;
+          }
+     }
+
+     return domain->registered ? domain->enabled : direct_config->debug;
+}
+
+#endif /* DIRECT_BUILD_DEBUGS */
+
+/**************************************************************************************************/
+
+void
+direct_debug_config_domain( const char *name, bool enable )
+{
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+     DebugDomainEntry *entry;
+
+     pthread_mutex_lock( &domains_lock );
+
+     entry = lookup_domain( name, false );
+     if (!entry) {
+          entry = calloc( 1, sizeof(DebugDomainEntry) );
+          if (!entry) {
+               D_WARN( "out of memory" );
+               pthread_mutex_unlock( &domains_lock );
+               return;
+          }
+
+          entry->name = strdup( name );
+
+          direct_list_prepend( &domains, &entry->link );
+     }
+
+     entry->enabled = enable;
+
+     if (! ++domains_age)
+          domains_age++;
+
+     pthread_mutex_unlock( &domains_lock );
+#endif /* DIRECT_BUILD_DEBUGS */
+}
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+static inline void
+debug_domain_vprintf( const char        *name,
+                      int                name_len,
+                      const char        *format,
+                      va_list            ap )
+{
+     char        buf[512];
+     long long   millis = direct_clock_get_millis();
+     const char *thread = direct_thread_self_name();
+     int         indent = direct_trace_debug_indent() * 4;
+
+     /* Prepare user message. */
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     /* Fill up domain name column after the colon, prepending remaining space (excl. ': ') to indent. */
+     indent += (name_len < 20 ? 20 : 36) - name_len - 2;
+
+     /* Print full message. */
+     direct_log_printf( NULL, "(-) [%-15s %3lld.%03lld] (%5d) %s: %*s%s", thread ? thread : "  NO NAME",
+                        millis / 1000LL, millis % 1000LL, direct_gettid(), name, indent, "", buf );
+}
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+__attribute__((no_instrument_function))
+void
+direct_debug( const char *format, ... )
+{
+     va_list ap;
+
+     va_start( ap, format );
+
+     debug_domain_vprintf( "- - ", 4, format, ap );
+
+     va_end( ap );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_debug_at( DirectDebugDomain *domain,
+                 const char        *format, ... )
+{
+     bool enabled;
+
+     pthread_mutex_lock( &domains_lock );
+
+     enabled = check_domain( domain );
+
+     pthread_mutex_unlock( &domains_lock );
+
+     if (enabled) {
+          va_list ap;
+
+          va_start( ap, format );
+
+          debug_domain_vprintf( domain->name, domain->name_len, format, ap );
+
+          va_end( ap );
+     }
+}
+
+#endif /* DIRECT_BUILD_DEBUGS */
+
+__attribute__((no_instrument_function))
+void
+direct_debug_at_always( DirectDebugDomain *domain,
+                        const char        *format, ... )
+{
+     va_list ap;
+
+     va_start( ap, format );
+
+     debug_domain_vprintf( domain->name, domain->name_len, format, ap );
+
+     va_end( ap );
+}
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+__attribute__((no_instrument_function))
+void
+direct_debug_enter( DirectDebugDomain *domain,
+                    const char *func,
+                    const char *file,
+                    int         line,
+                    const char *format, ... )
+{
+     bool enabled;
+
+     pthread_mutex_lock( &domains_lock );
+
+     enabled = check_domain( domain );
+
+     pthread_mutex_unlock( &domains_lock );
+
+     if (enabled) {
+          int         len;
+          char        dom[48];
+          char        fmt[128];
+          char        buf[512];
+          long long   millis = direct_clock_get_millis();
+          const char *name   = direct_thread_self_name();
+          va_list     ap;
+
+          va_start( ap, format );
+
+          vsnprintf( buf, sizeof(buf), format, ap );
+
+          va_end( ap );
+
+
+          len = snprintf( dom, sizeof(dom), "%s:", domain->name );
+
+          if (len < 18)
+               len = 18;
+          else
+               len = 28;
+
+          len += direct_trace_debug_indent() * 4;
+
+          snprintf( fmt, sizeof(fmt), "(>) [%%-15s %%3lld.%%03lld] (%%5d) %%-%ds Entering %%s%%s [%%s:%%d]\n", len );
+
+          direct_log_printf( NULL, fmt, name ? name : "  NO NAME  ",
+                             millis / 1000LL, millis % 1000LL, direct_gettid(), dom,
+			     func, buf, file, line );
+     }
+}
+
+__attribute__((no_instrument_function))
+void
+direct_debug_exit( DirectDebugDomain *domain,
+                   const char *func,
+                   const char *file,
+                   int         line,
+                   const char *format, ... )
+{
+     bool enabled;
+
+     pthread_mutex_lock( &domains_lock );
+
+     enabled = check_domain( domain );
+
+     pthread_mutex_unlock( &domains_lock );
+
+     if (enabled) {
+          int         len;
+          char        dom[48];
+          char        fmt[128];
+          char        buf[512];
+          long long   millis = direct_clock_get_millis();
+          const char *name   = direct_thread_self_name();
+          va_list     ap;
+
+          va_start( ap, format );
+
+          vsnprintf( buf, sizeof(buf), format, ap );
+
+          va_end( ap );
+
+
+          len = snprintf( dom, sizeof(dom), "%s:", domain->name );
+
+          if (len < 18)
+               len = 18;
+          else
+               len = 28;
+
+          len += direct_trace_debug_indent() * 4;
+
+          snprintf( fmt, sizeof(fmt), "(<) [%%-15s %%3lld.%%03lld] (%%5d) %%-%ds Returning from %%s%%s [%%s:%%d]\n", len );
+
+          direct_log_printf( NULL, fmt, name ? name : "  NO NAME  ",
+                             millis / 1000LL, millis % 1000LL, direct_gettid(), dom,
+			     func, buf, file, line );
+     }
+}
+
+__attribute__((no_instrument_function))
+static void
+trap( const char *domain )
+{
+     D_DEBUG( "Direct/%s: Raising SIGTRAP...\n", domain );
+
+     raise( SIGTRAP );
+
+     D_DEBUG( "Direct/%s: ...didn't catch signal on my own, calling killpg().\n", domain );
+
+     kill( direct_gettid(), SIGTRAP );
+
+     D_DEBUG( "Direct/%s: ...still running, calling pthread_exit().\n", domain );
+
+     pthread_exit( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_break( const char *func,
+              const char *file,
+              int         line,
+              const char *format, ... )
+{
+     char        buf[512];
+     long long   millis = direct_clock_get_millis();
+     const char *name   = direct_thread_self_name();
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL,
+                        "(!) [%-15s %3lld.%03lld] (%5d) *** Break [%s] *** [%s:%d in %s()]\n",
+                        name ? name : "  NO NAME  ", millis / 1000LL, millis % 1000LL,
+                        direct_gettid(), buf, file, line, func );
+
+     direct_trace_print_stack( NULL );
+
+     if (direct_config->fatal_break)
+          trap( "Break" );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_assertion( const char *exp,
+                  const char *func,
+                  const char *file,
+                  int         line )
+{
+     long long   millis = direct_clock_get_millis();
+     const char *name   = direct_thread_self_name();
+
+     direct_log_printf( NULL,
+                        "(!) [%-15s %3lld.%03lld] (%5d) *** Assertion [%s] failed *** [%s:%d in %s()]\n",
+                        name ? name : "  NO NAME  ", millis / 1000LL, millis % 1000LL,
+                        direct_gettid(), exp, file, line, func );
+
+     direct_trace_print_stack( NULL );
+
+     if (direct_config->fatal >= DCFL_ASSERT)
+          trap( "Assertion" );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_assumption( const char *exp,
+                   const char *func,
+                   const char *file,
+                   int         line )
+{
+     long long   millis = direct_clock_get_millis();
+     const char *name   = direct_thread_self_name();
+
+     direct_log_printf( NULL,
+                        "(!) [%-15s %3lld.%03lld] (%5d) *** Assumption [%s] failed *** [%s:%d in %s()]\n",
+                        name ? name : "  NO NAME  ", millis / 1000LL, millis % 1000LL,
+                        direct_gettid(), exp, file, line, func );
+
+     direct_trace_print_stack( NULL );
+
+     if (direct_config->fatal >= DCFL_ASSUME)
+          trap( "Assumption" );
+}
+
+#endif /* DIRECT_BUILD_DEBUGS */
+
+#else
+
+void
+direct_debug_config_domain( const char *name, bool enable )
+{
+}
+
+#endif /* DIRECT_BUILD_TEXT */
+
diff --git a/Source/DirectFB/lib/direct/debug.h b/Source/DirectFB/lib/direct/debug.h
new file mode 100755
index 0000000..1232716
--- /dev/null
+++ b/Source/DirectFB/lib/direct/debug.h
@@ -0,0 +1,287 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__DEBUG_H__
+#define __DIRECT__DEBUG_H__
+
+#include <direct/build.h>
+
+#include <stdio.h>
+#include <errno.h>
+
+#include <direct/clock.h>
+#include <direct/conf.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+#include <direct/system.h>
+#include <direct/thread.h>
+#include <direct/trace.h>
+#include <direct/types.h>
+
+
+typedef struct {
+     unsigned int   age;
+     bool           enabled;
+     bool           registered;
+
+     const char    *name;
+     const char    *description;
+
+     int            name_len;
+} DirectDebugDomain;
+
+void direct_debug_config_domain( const char *name, bool enable );
+
+
+#if DIRECT_BUILD_TEXT
+
+#define D_DEBUG_DOMAIN(identifier,name,description)                                  \
+     static DirectDebugDomain identifier __attribute__((unused))                     \
+            = { 0, false, false, name, description, sizeof(name) - 1 }
+
+void direct_debug_at_always( DirectDebugDomain *domain,
+                             const char        *format, ... )  D_FORMAT_PRINTF(2);
+
+#define d_debug_at( domain, x... )      direct_debug_at_always( &domain, x )
+
+
+#if DIRECT_BUILD_DEBUGS
+
+void direct_debug( const char *format, ... )  D_FORMAT_PRINTF(1);
+
+void direct_debug_at( DirectDebugDomain *domain,
+                      const char        *format, ... )  D_FORMAT_PRINTF(2);
+
+void direct_debug_enter( DirectDebugDomain *domain,
+	      	         const char *func,
+                         const char *file,
+                         int         line,
+                         const char *format, ... )  D_FORMAT_PRINTF(5);
+
+void direct_debug_exit( DirectDebugDomain *domain,
+	      	        const char *func,
+                        const char *file,
+                        int         line,
+                        const char *format, ... )  D_FORMAT_PRINTF(5);
+
+void direct_break( const char *func,
+                   const char *file,
+                   int         line,
+                   const char *format, ... )  D_FORMAT_PRINTF(4);
+
+void direct_assertion( const char *exp,
+                       const char *func,
+                       const char *file,
+                       int         line );
+
+void direct_assumption( const char *exp,
+                        const char *func,
+                        const char *file,
+                        int         line );
+#endif
+
+#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
+
+#define D_DEBUG_ENABLED  (1)
+
+#define D_DEBUG(x...)                                                                \
+     do {                                                                            \
+          if (!direct_config || direct_config->debug)                                \
+               direct_debug( x );                                                    \
+     } while (0)
+
+
+#define D_DEBUG_AT(d,x...)                                                           \
+     do {                                                                            \
+          direct_debug_at( &d, x );                                                  \
+     } while (0)
+
+#define D_DEBUG_ENTER(d,x...)                                                        \
+     do {                                                                            \
+          direct_debug_enter( &d, __FUNCTION__, __FILE__, __LINE__, x );             \
+     } while (0)
+
+#define D_DEBUG_EXIT(d,x...)                                                         \
+     do {                                                                            \
+          direct_debug_exit( &d, __FUNCTION__, __FILE__, __LINE__, x );              \
+     } while (0)
+
+#define D_ASSERT(exp)                                                                \
+     do {                                                                            \
+          if (!(exp))                                                                \
+               direct_assertion( #exp, __FUNCTION__, __FILE__, __LINE__ );           \
+     } while (0)
+
+
+#define D_ASSUME(exp)                                                                \
+     do {                                                                            \
+          if (!(exp))                                                                \
+               direct_assumption( #exp, __FUNCTION__, __FILE__, __LINE__ );          \
+     } while (0)
+
+
+#define D_BREAK(x...)                                                                \
+     do {                                                                            \
+          direct_break( __FUNCTION__, __FILE__, __LINE__, x );                       \
+     } while (0)
+
+#elif defined(DIRECT_MINI_DEBUG)
+
+/*
+ * Mini debug mode, only D_DEBUG_AT, no domain filters, simple assertion
+ */
+
+#define D_DEBUG_ENABLED  (2)
+
+#define D_DEBUG_AT(d,x...)                                                           \
+     do {                                                                            \
+          if (direct_config->debug) direct_debug_at_always( &d, x );                 \
+     } while (0)
+
+#define D_CHECK(exp, aa)                                                             \
+     do {                                                                            \
+          if (!(exp)) {                                                              \
+               long long   millis = direct_clock_get_millis();                       \
+               const char *name   = direct_thread_self_name();                       \
+                                                                                     \
+               direct_log_printf( NULL,                                              \
+                                  "(!) [%-15s %3lld.%03lld] (%5d) *** " #aa " [%s] failed *** [%s:%d in %s()]\n",  \
+                                  name ? name : "  NO NAME  ", millis / 1000LL, millis % 1000LL,                   \
+                                  direct_gettid(), #exp, __FILE__, __LINE__, __FUNCTION__ );                       \
+                                                                                     \
+               direct_trace_print_stack( NULL );                                     \
+          }                                                                          \
+     } while (0)
+
+#define D_ASSERT(exp)    D_CHECK(exp, Assertion)
+#define D_ASSUME(exp)    D_CHECK(exp, Assumption)
+
+#endif    /* MINI_DEBUG  / DIRECT_BUILD_DEBUG || DIRECT_ENABLE_DEBUG || DIRECT_FORCE_DEBUG */
+
+#endif    /* DIRECT_BUILD_TEXT */
+
+
+/*
+ * Fallback definitions, e.g. without DIRECT_BUILD_TEXT or DIRECT_ENABLE_DEBUG
+ */
+
+#ifndef D_DEBUG_ENABLED
+#define D_DEBUG_ENABLED  (0)
+#endif
+
+#ifndef D_DEBUG
+#define D_DEBUG(x...)              do {} while (0)
+#endif
+
+#ifndef D_DEBUG_AT
+#define D_DEBUG_AT(d,x...)         do {} while (0)
+#endif
+
+#ifndef D_DEBUG_ENTER
+#define D_DEBUG_ENTER(d,x...)      do {} while (0)
+#endif
+
+#ifndef D_DEBUG_EXIT
+#define D_DEBUG_EXIT(d,x...)       do {} while (0)
+#endif
+
+#ifndef D_ASSERT
+#define D_ASSERT(exp)              do {} while (0)
+#endif
+
+#ifndef D_ASSUME
+#define D_ASSUME(exp)              do {} while (0)
+#endif
+
+#ifndef D_BREAK
+#define D_BREAK(x...)              do {} while (0)
+#endif
+
+#ifndef d_debug_at
+#define d_debug_at( domain, x... ) do {} while (0)
+#endif
+
+#ifndef D_DEBUG_DOMAIN
+#define D_DEBUG_DOMAIN(i,n,d)
+#endif
+
+
+
+/*
+ * Magic Assertions & Utilities
+ */
+
+#define D_MAGIC(spell)             ( (((spell)[sizeof(spell)*8/9] << 24) | \
+                                      ((spell)[sizeof(spell)*7/9] << 16) | \
+                                      ((spell)[sizeof(spell)*6/9] <<  8) | \
+                                      ((spell)[sizeof(spell)*5/9]      )) ^  \
+                                     (((spell)[sizeof(spell)*4/9] << 24) | \
+                                      ((spell)[sizeof(spell)*3/9] << 16) | \
+                                      ((spell)[sizeof(spell)*2/9] <<  8) | \
+                                      ((spell)[sizeof(spell)*1/9]      )) )
+
+
+#define D_MAGIC_SET(o,m)           do {                                              \
+                                        D_ASSERT( (o) != NULL );                     \
+                                        D_ASSUME( (o)->magic != D_MAGIC(#m) );       \
+                                                                                     \
+                                        (o)->magic = D_MAGIC(#m);                    \
+                                   } while (0)
+
+#define D_MAGIC_SET_ONLY(o,m)      do {                                              \
+                                        D_ASSERT( (o) != NULL );                     \
+                                                                                     \
+                                        (o)->magic = D_MAGIC(#m);                    \
+                                   } while (0)
+
+#define D_MAGIC_ASSERT(o,m)        do {                                              \
+                                        D_ASSERT( (o) != NULL );                     \
+                                        D_ASSERT( (o)->magic == D_MAGIC(#m) );       \
+                                   } while (0)
+
+#define D_MAGIC_ASSUME(o,m)        do {                                              \
+                                        D_ASSUME( (o) != NULL );                     \
+                                        if (o)                                       \
+                                             D_ASSUME( (o)->magic == D_MAGIC(#m) );  \
+                                   } while (0)
+
+#define D_MAGIC_ASSERT_IF(o,m)     do {                                              \
+                                        if (o)                                       \
+                                             D_ASSERT( (o)->magic == D_MAGIC(#m) );  \
+                                   } while (0)
+
+#define D_MAGIC_CLEAR(o)           do {                                              \
+                                        D_ASSERT( (o) != NULL );                     \
+                                        D_ASSUME( (o)->magic != 0 );                 \
+                                                                                     \
+                                        (o)->magic = 0;                              \
+                                   } while (0)
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/direct.c b/Source/DirectFB/lib/direct/direct.c
new file mode 100755
index 0000000..38b930f
--- /dev/null
+++ b/Source/DirectFB/lib/direct/direct.c
@@ -0,0 +1,197 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/log.h>
+#include <direct/mem.h>
+#include <direct/signals.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+D_DEBUG_DOMAIN( Direct_Main, "Direct/Main", "Initialization and shutdown of libdirect" );
+
+/**************************************************************************************************/
+
+struct __D_DirectCleanupHandler {
+     DirectLink                link;
+     
+     int                       magic;
+     
+     DirectCleanupHandlerFunc  func;
+     void                     *ctx;
+};
+
+/**************************************************************************************************/
+
+static int              refs      = 0;
+static DirectLink      *handlers  = NULL; 
+static pthread_mutex_t  main_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/**************************************************************************************************/
+
+static void
+direct_cleanup( void )
+{
+     DirectCleanupHandler *handler, *temp;
+     
+     if (!refs)
+          return;
+          
+     direct_list_foreach_safe (handler, temp, handlers) {
+          D_DEBUG_AT( Direct_Main, "Calling cleanup func %p...\n", handler->func );
+
+          handler->func( handler->ctx );
+          
+          /*direct_list_remove( &handlers, &handler->link );
+
+          D_MAGIC_CLEAR( handler );
+
+          D_FREE( handler );*/
+     }
+     
+     direct_print_memleaks();
+
+     direct_print_interface_leaks();
+}
+
+/**************************************************************************************************/
+
+DirectResult 
+direct_cleanup_handler_add( DirectCleanupHandlerFunc   func,
+                            void                      *ctx,
+                            DirectCleanupHandler     **ret_handler )
+{
+     DirectCleanupHandler *handler;
+     
+     D_ASSERT( func != NULL );
+     D_ASSERT( ret_handler != NULL );
+     
+     D_DEBUG_AT( Direct_Main,
+                 "Adding cleanup handler %p with context %p...\n", func, ctx );
+     
+     handler = D_CALLOC( 1, sizeof(DirectCleanupHandler) );
+     if (!handler) {
+          D_WARN( "out of memory" );
+          return DR_NOLOCALMEMORY;
+     }
+     
+     handler->func = func;
+     handler->ctx  = ctx;
+     
+     D_MAGIC_SET( handler, DirectCleanupHandler );
+
+     pthread_mutex_lock( &main_lock );
+     
+     if (handlers == NULL)
+          atexit( direct_cleanup );
+     
+     direct_list_append( &handlers, &handler->link );
+     
+     pthread_mutex_unlock( &main_lock );
+     
+     *ret_handler = handler;
+     
+     return DR_OK;
+}
+
+DirectResult
+direct_cleanup_handler_remove( DirectCleanupHandler *handler )
+{
+     D_ASSERT( handler != NULL );
+     
+     D_MAGIC_ASSERT( handler, DirectCleanupHandler );
+
+     D_DEBUG_AT( Direct_Main, "Removing cleanup handler %p with context %p...\n", 
+                 handler->func, handler->ctx );
+
+     pthread_mutex_lock( &main_lock );
+     direct_list_remove( &handlers, &handler->link );
+     pthread_mutex_unlock( &main_lock );
+
+     D_MAGIC_CLEAR( handler );
+
+     D_FREE( handler );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_initialize( void )
+{
+     pthread_mutex_lock( &main_lock );
+
+     D_DEBUG_AT( Direct_Main, "direct_initialize() called...\n" );
+
+     if (refs++) {
+          D_DEBUG_AT( Direct_Main, "...%d references now.\n", refs );
+          pthread_mutex_unlock( &main_lock );
+          return DR_OK;
+     }
+     else if (!direct_thread_self_name())
+          direct_thread_set_name( "Main Thread" );
+
+     D_DEBUG_AT( Direct_Main, "...initializing now.\n" );
+
+     direct_signals_initialize();
+
+     pthread_mutex_unlock( &main_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_shutdown( void )
+{
+     pthread_mutex_lock( &main_lock );
+
+     D_DEBUG_AT( Direct_Main, "direct_shutdown() called...\n" );
+
+     if (--refs) {
+          D_DEBUG_AT( Direct_Main, "...%d references left.\n", refs );
+          pthread_mutex_unlock( &main_lock );
+          return DR_OK;
+     }
+
+     D_DEBUG_AT( Direct_Main, "...shutting down now.\n" );
+
+     direct_signals_shutdown();
+
+     pthread_mutex_unlock( &main_lock );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/direct/direct.h b/Source/DirectFB/lib/direct/direct.h
new file mode 100755
index 0000000..b94e999
--- /dev/null
+++ b/Source/DirectFB/lib/direct/direct.h
@@ -0,0 +1,49 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__DIRECT_H__
+#define __DIRECT__DIRECT_H__
+
+#include <direct/types.h>
+
+DirectResult direct_initialize( void );
+DirectResult direct_shutdown( void );
+
+
+typedef void (*DirectCleanupHandlerFunc)( void *ctx );
+
+
+DirectResult direct_cleanup_handler_add( DirectCleanupHandlerFunc   func,
+                                         void                      *ctx,
+                                         DirectCleanupHandler     **ret_handler );
+
+DirectResult direct_cleanup_handler_remove( DirectCleanupHandler   *handler );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/direct.pc.in b/Source/DirectFB/lib/direct/direct.pc.in
new file mode 100755
index 0000000..fa6e663
--- /dev/null
+++ b/Source/DirectFB/lib/direct/direct.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+moduledir=@MODULEDIR@
+moduledirname=@MODULEDIRNAME@
+includedir=@includedir@
+
+Name: Direct
+Description: DirectFB base development library
+Version: @VERSION@
+Libs: -L${libdir} -ldirect @THREADLIB@
+Libs.private: -L${libdir} @DYNLIB@
+Cflags: @THREADFLAGS@ -I@INCLUDEDIR@
diff --git a/Source/DirectFB/lib/direct/fastlz.c b/Source/DirectFB/lib/direct/fastlz.c
new file mode 100755
index 0000000..60bf3ca
--- /dev/null
+++ b/Source/DirectFB/lib/direct/fastlz.c
@@ -0,0 +1,97 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <string.h>
+
+#include <direct/fastlz.h>
+#include <direct/messages.h>
+
+#include "flz.h"
+
+
+int
+direct_fastlz_compress( const void *input,
+                        int         length,
+                        void       *output )
+{
+     return fastlz_compress_level( 2, input, length, output );
+}
+
+int
+direct_fastlz_decompress( const void *input,
+                          int         length,
+                          void       *output,
+                          int         maxout )
+{
+     return fastlz_decompress( input, length, output, maxout );
+}
+
+int
+direct_fastlz_compress_multi( const void   **inputs,
+                              int           *lengths,
+                              unsigned int   num,
+                              void          *output )
+{
+     // FIXME: Optimize by modifying fastlz compressor to take an array of buffers directly
+
+     unsigned int  i;
+     int           total  = 0;
+     int           offset = 0;
+     void         *buffer;
+     int           result;
+
+     if (num == 0)
+          return 0;
+
+     if (num == 1)
+          return direct_fastlz_compress( inputs[0], lengths[0], output );
+
+     for (i=0; i<num; i++)
+          total += lengths[i];
+
+     buffer = malloc( total );
+     if (!buffer) {
+          D_OOM();
+          return 0;
+     }
+
+     for (i=0; i<num; i++) {
+          memcpy( (char*) buffer + offset, inputs[i], lengths[i] );
+
+          offset += lengths[i];
+     }
+
+     result = direct_fastlz_compress( buffer, total, output );
+
+     free( buffer );
+
+     return result;
+}
diff --git a/Source/DirectFB/lib/direct/fastlz.h b/Source/DirectFB/lib/direct/fastlz.h
new file mode 100755
index 0000000..3a8750d
--- /dev/null
+++ b/Source/DirectFB/lib/direct/fastlz.h
@@ -0,0 +1,52 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__FASTLZ_H__
+#define __DIRECT__FASTLZ_H__
+
+#include <direct/types.h>
+
+/**********************************************************************************************************************/
+
+int direct_fastlz_compress      ( const void    *input,
+                                  int            length,
+                                  void          *output );
+
+int direct_fastlz_decompress    ( const void    *input,
+                                  int            length,
+                                  void          *output,
+                                  int            maxout );
+
+
+int direct_fastlz_compress_multi( const void   **inputs,
+                                  int           *lengths,
+                                  unsigned int   num,
+                                  void          *output );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/flz.c b/Source/DirectFB/lib/direct/flz.c
new file mode 100755
index 0000000..070bbe2
--- /dev/null
+++ b/Source/DirectFB/lib/direct/flz.c
@@ -0,0 +1,555 @@
+/*  
+  FastLZ - lightning-fast lossless compression library
+
+  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
+  Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
+  Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in
+  all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+  THE SOFTWARE.
+*/
+
+#if !defined(FASTLZ__COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR)
+
+/*
+ * Always check for bound when decompressing.
+ * Generally it is best to leave it defined.
+ */
+#define FASTLZ_SAFE
+
+/*
+ * Give hints to the compiler for branch prediction optimization.
+ */
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define FASTLZ_EXPECT_CONDITIONAL(c)    (__builtin_expect((c), 1))
+#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
+#else
+#define FASTLZ_EXPECT_CONDITIONAL(c)    (c)
+#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (c)
+#endif
+
+/*
+ * Use inlined functions for supported systems.
+ */
+#if defined(__GNUC__) || defined(__DMC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C)
+#define FASTLZ_INLINE inline
+#elif defined(__BORLANDC__) || defined(_MSC_VER) || defined(__LCC__)
+#define FASTLZ_INLINE __inline
+#else 
+#define FASTLZ_INLINE
+#endif
+
+/*
+ * Prevent accessing more than 8-bit at once, except on x86 architectures.
+ */
+#if !defined(FASTLZ_STRICT_ALIGN)
+#define FASTLZ_STRICT_ALIGN
+
+#if 0
+#if defined(__i386__) || defined(__386)  /* GNU C, Sun Studio */
+#undef FASTLZ_STRICT_ALIGN
+#elif defined(__i486__) || defined(__i586__) || defined(__i686__) /* GNU C */
+#undef FASTLZ_STRICT_ALIGN
+#elif defined(_M_IX86) /* Intel, MSVC */
+#undef FASTLZ_STRICT_ALIGN
+#elif defined(__386)
+#undef FASTLZ_STRICT_ALIGN
+#elif defined(_X86_) /* MinGW */
+#undef FASTLZ_STRICT_ALIGN
+#elif defined(__I86__) /* Digital Mars */
+#undef FASTLZ_STRICT_ALIGN
+#endif
+#endif
+
+#endif
+
+/*
+ * FIXME: use preprocessor magic to set this on different platforms!
+ */
+typedef unsigned char  flzuint8;
+typedef unsigned short flzuint16;
+typedef unsigned int   flzuint32;
+
+/* prototypes */
+int fastlz_compress(const void* input, int length, void* output);
+int fastlz_compress_level(int level, const void* input, int length, void* output);
+int fastlz_decompress(const void* input, int length, void* output, int maxout);
+
+#define MAX_COPY       32
+#define MAX_LEN       264  /* 256 + 8 */
+#define MAX_DISTANCE 8192
+
+#if !defined(FASTLZ_STRICT_ALIGN)
+#define FASTLZ_READU16(p) *((const flzuint16*)(p)) 
+#else
+#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
+#endif
+
+#define HASH_LOG  13
+#define HASH_SIZE (1<< HASH_LOG)
+#define HASH_MASK  (HASH_SIZE-1)
+#define HASH_FUNCTION(v,p) { v = FASTLZ_READU16(p); v ^= FASTLZ_READU16(p+1)^(v>>(16-HASH_LOG));v &= HASH_MASK; }
+
+#undef FASTLZ_LEVEL
+#define FASTLZ_LEVEL 1
+
+#undef FASTLZ_COMPRESSOR
+#undef FASTLZ_DECOMPRESSOR
+#define FASTLZ_COMPRESSOR fastlz1_compress
+#define FASTLZ_DECOMPRESSOR fastlz1_decompress
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
+static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
+#include "flz.c"
+
+#undef FASTLZ_LEVEL
+#define FASTLZ_LEVEL 2
+
+#undef MAX_DISTANCE
+#define MAX_DISTANCE 8191
+#define MAX_FARDISTANCE (65535+MAX_DISTANCE-1)
+
+#undef FASTLZ_COMPRESSOR
+#undef FASTLZ_DECOMPRESSOR
+#define FASTLZ_COMPRESSOR fastlz2_compress
+#define FASTLZ_DECOMPRESSOR fastlz2_decompress
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
+static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
+#include "flz.c"
+
+int fastlz_compress(const void* input, int length, void* output)
+{
+  /* for short block, choose fastlz1 */
+  if(length < 65536)
+    return fastlz1_compress(input, length, output);
+
+  /* else... */
+  return fastlz2_compress(input, length, output);
+}
+
+int fastlz_decompress(const void* input, int length, void* output, int maxout)
+{
+  /* magic identifier for compression level */
+  int level = ((*(const flzuint8*)input) >> 5) + 1;
+
+  if(level == 1)
+    return fastlz1_decompress(input, length, output, maxout);
+  if(level == 2)
+    return fastlz2_decompress(input, length, output, maxout);
+
+  /* unknown level, trigger error */
+  return 0;
+}
+
+int fastlz_compress_level(int level, const void* input, int length, void* output)
+{
+  if(level == 1)
+    return fastlz1_compress(input, length, output);
+  if(level == 2)
+    return fastlz2_compress(input, length, output);
+
+  return 0;
+}
+
+#else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
+
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output)
+{
+  const flzuint8* ip = (const flzuint8*) input;
+  const flzuint8* ip_bound = ip + length - 2;
+  const flzuint8* ip_limit = ip + length - 12;
+  flzuint8* op = (flzuint8*) output;
+
+  const flzuint8* htab[HASH_SIZE];
+  const flzuint8** hslot;
+  flzuint32 hval;
+
+  flzuint32 copy;
+
+  /* sanity check */
+  if(FASTLZ_UNEXPECT_CONDITIONAL(length < 4))
+  {
+    if(length)
+    {
+      /* create literal copy only */
+      *op++ = length-1;
+      ip_bound++;
+      while(ip <= ip_bound)
+        *op++ = *ip++;
+      return length+1;
+    }
+    else
+      return 0;
+  }
+
+  /* initializes hash table */
+  for (hslot = htab; hslot < htab + HASH_SIZE; hslot++)
+    *hslot = ip;
+
+  /* we start with literal copy */
+  copy = 2;
+  *op++ = MAX_COPY-1;
+  *op++ = *ip++;
+  *op++ = *ip++;
+
+  /* main loop */
+  while(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
+  {
+    const flzuint8* ref;
+    flzuint32 distance;
+
+    /* minimum match length */
+    flzuint32 len = 3;
+
+    /* comparison starting-point */
+    const flzuint8* anchor = ip;
+
+    /* check for a run */
+#if FASTLZ_LEVEL==2
+    if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))
+    {
+      distance = 1;
+      ip += 3;
+      ref = anchor - 1 + 3;
+      goto match;
+    }
+#endif
+
+    /* find potential match */
+    HASH_FUNCTION(hval,ip);
+    hslot = htab + hval;
+    ref = htab[hval];
+
+    /* calculate distance to the match */
+    distance = anchor - ref;
+
+    /* update hash table */
+    *hslot = anchor;
+
+    /* is this a match? check the first 3 bytes */
+    if(distance==0 || 
+#if FASTLZ_LEVEL==1
+    (distance >= MAX_DISTANCE) ||
+#else
+    (distance >= MAX_FARDISTANCE) ||
+#endif
+    *ref++ != *ip++ || *ref++!=*ip++ || *ref++!=*ip++)
+      goto literal;
+
+#if FASTLZ_LEVEL==2
+    /* far, needs at least 5-byte match */
+    if(distance >= MAX_DISTANCE)
+    {
+      if(*ip++ != *ref++ || *ip++!= *ref++) 
+        goto literal;
+      len += 2;
+    }
+    
+    match:
+#endif
+
+    /* last matched byte */
+    ip = anchor + len;
+
+    /* distance is biased */
+    distance--;
+
+    if(!distance)
+    {
+      /* zero distance means a run */
+      flzuint8 x = ip[-1];
+      while(ip < ip_bound)
+        if(*ref++ != x) break; else ip++;
+    }
+    else
+    for(;;)
+    {
+      /* safe because the outer check against ip limit */
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      if(*ref++ != *ip++) break;
+      while(ip < ip_bound)
+        if(*ref++ != *ip++) break;
+      break;
+    }
+
+    /* if we have copied something, adjust the copy count */
+    if(copy)
+      /* copy is biased, '0' means 1 byte copy */
+      *(op-copy-1) = copy-1;
+    else
+      /* back, to overwrite the copy count */
+      op--;
+
+    /* reset literal counter */
+    copy = 0;
+
+    /* length is biased, '1' means a match of 3 bytes */
+    ip -= 3;
+    len = ip - anchor;
+
+    /* encode the match */
+#if FASTLZ_LEVEL==2
+    if(distance < MAX_DISTANCE)
+    {
+      if(len < 7)
+      {
+        *op++ = (len << 5) + (distance >> 8);
+        *op++ = (distance & 255);
+      }
+      else
+      {
+        *op++ = (7 << 5) + (distance >> 8);
+        for(len-=7; len >= 255; len-= 255)
+          *op++ = 255;
+        *op++ = len;
+        *op++ = (distance & 255);
+      }
+    }
+    else
+    {
+      /* far away, but not yet in the another galaxy... */
+      if(len < 7)
+      {
+        distance -= MAX_DISTANCE;
+        *op++ = (len << 5) + 31;
+        *op++ = 255;
+        *op++ = distance >> 8;
+        *op++ = distance & 255;
+      }
+      else
+      {
+        distance -= MAX_DISTANCE;
+        *op++ = (7 << 5) + 31;
+        for(len-=7; len >= 255; len-= 255)
+          *op++ = 255;
+        *op++ = len;
+        *op++ = 255;
+        *op++ = distance >> 8;
+        *op++ = distance & 255;
+      }
+    }
+#else
+
+    if(FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN-2))
+      while(len > MAX_LEN-2)
+      {
+        *op++ = (7 << 5) + (distance >> 8);
+        *op++ = MAX_LEN - 2 - 7 -2; 
+        *op++ = (distance & 255);
+        len -= MAX_LEN-2;
+      }
+
+    if(len < 7)
+    {
+      *op++ = (len << 5) + (distance >> 8);
+      *op++ = (distance & 255);
+    }
+    else
+    {
+      *op++ = (7 << 5) + (distance >> 8);
+      *op++ = len - 7;
+      *op++ = (distance & 255);
+    }
+#endif
+
+    /* update the hash at match boundary */
+    HASH_FUNCTION(hval,ip);
+    htab[hval] = ip++;
+    HASH_FUNCTION(hval,ip);
+    htab[hval] = ip++;
+
+    /* assuming literal copy */
+    *op++ = MAX_COPY-1;
+
+    continue;
+
+    literal:
+      *op++ = *anchor++;
+      ip = anchor;
+      copy++;
+      if(FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY))
+      {
+        copy = 0;
+        *op++ = MAX_COPY-1;
+      }
+  }
+
+  /* left-over as literal copy */
+  ip_bound++;
+  while(ip <= ip_bound)
+  {
+    *op++ = *ip++;
+    copy++;
+    if(copy == MAX_COPY)
+    {
+      copy = 0;
+      *op++ = MAX_COPY-1;
+    }
+  }
+
+  /* if we have copied something, adjust the copy length */
+  if(copy)
+    *(op-copy-1) = copy-1;
+  else
+    op--;
+
+#if FASTLZ_LEVEL==2
+  /* marker for fastlz2 */
+  *(flzuint8*)output |= (1 << 5);
+#endif
+
+  return op - (flzuint8*)output;
+}
+
+static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)
+{
+  const flzuint8* ip = (const flzuint8*) input;
+  const flzuint8* ip_limit  = ip + length;
+  flzuint8* op = (flzuint8*) output;
+  flzuint8* op_limit = op + maxout;
+  flzuint32 ctrl = (*ip++) & 31;
+  int loop = 1;
+
+  do
+  {
+    const flzuint8* ref = op;
+    flzuint32 len = ctrl >> 5;
+    flzuint32 ofs = (ctrl & 31) << 8;
+
+    if(ctrl >= 32)
+    {
+#if FASTLZ_LEVEL==2
+      flzuint8 code;
+#endif
+      len--;
+      ref -= ofs;
+      if (len == 7-1)
+#if FASTLZ_LEVEL==1
+        len += *ip++;
+      ref -= *ip++;
+#else
+        do
+        {
+          code = *ip++;
+          len += code;
+        } while (code==255);
+      code = *ip++;
+      ref -= code;
+
+      /* match from 16-bit distance */
+      if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))
+      if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))
+      {
+        ofs = (*ip++) << 8;
+        ofs += *ip++;
+        ref = op - ofs - MAX_DISTANCE;
+      }
+#endif
+      
+#ifdef FASTLZ_SAFE
+      if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))
+        return 0;
+
+      if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))
+        return 0;
+#endif
+
+      if(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))
+        ctrl = *ip++;
+      else
+        loop = 0;
+
+      if(ref == op)
+      {
+        /* optimize copy for a run */
+        flzuint8 b = ref[-1];
+        *op++ = b;
+        *op++ = b;
+        *op++ = b;
+        for(; len; --len)
+          *op++ = b;
+      }
+      else
+      {
+#if !defined(FASTLZ_STRICT_ALIGN)
+        const flzuint16* p;
+        flzuint16* q;
+#endif
+        /* copy from reference */
+        ref--;
+        *op++ = *ref++;
+        *op++ = *ref++;
+        *op++ = *ref++;
+
+#if !defined(FASTLZ_STRICT_ALIGN)
+        /* copy a byte, so that now it's word aligned */
+        if(len & 1)
+        {
+          *op++ = *ref++;
+          len--;
+        }
+
+        /* copy 16-bit at once */
+        q = (flzuint16*) op;
+        op += len;
+        p = (const flzuint16*) ref;
+        for(len>>=1; len > 4; len-=4)
+        {
+          *q++ = *p++;
+          *q++ = *p++;
+          *q++ = *p++;
+          *q++ = *p++;
+        }
+        for(; len; --len)
+          *q++ = *p++;
+#else
+        for(; len; --len)
+          *op++ = *ref++;
+#endif
+      }
+    }
+    else
+    {
+      ctrl++;
+#ifdef FASTLZ_SAFE
+      if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))
+        return 0;
+      if (FASTLZ_UNEXPECT_CONDITIONAL(ip + ctrl > ip_limit))
+        return 0;
+#endif
+
+      *op++ = *ip++; 
+      for(--ctrl; ctrl; ctrl--)
+        *op++ = *ip++;
+
+      loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);
+      if(loop)
+        ctrl = *ip++;
+    }
+  }
+  while(FASTLZ_EXPECT_CONDITIONAL(loop));
+
+  return op - (flzuint8*)output;
+}
+
+#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */
diff --git a/Source/DirectFB/lib/direct/flz.h b/Source/DirectFB/lib/direct/flz.h
new file mode 100755
index 0000000..f87bc7b
--- /dev/null
+++ b/Source/DirectFB/lib/direct/flz.h
@@ -0,0 +1,100 @@
+/*  
+  FastLZ - lightning-fast lossless compression library
+
+  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
+  Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
+  Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in
+  all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+  THE SOFTWARE.
+*/
+
+#ifndef FASTLZ_H
+#define FASTLZ_H
+
+#define FASTLZ_VERSION 0x000100
+
+#define FASTLZ_VERSION_MAJOR     0
+#define FASTLZ_VERSION_MINOR     0
+#define FASTLZ_VERSION_REVISION  0
+
+#define FASTLZ_VERSION_STRING "0.1.0"
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/**
+  Compress a block of data in the input buffer and returns the size of 
+  compressed block. The size of input buffer is specified by length. The 
+  minimum input buffer size is 16.
+
+  The output buffer must be at least 5% larger than the input buffer  
+  and can not be smaller than 66 bytes.
+
+  If the input is not compressible, the return value might be larger than
+  length (input buffer size).
+
+  The input buffer and the output buffer can not overlap.
+*/
+
+int fastlz_compress(const void* input, int length, void* output);
+
+/**
+  Decompress a block of compressed data and returns the size of the 
+  decompressed block. If error occurs, e.g. the compressed data is 
+  corrupted or the output buffer is not large enough, then 0 (zero) 
+  will be returned instead.
+
+  The input buffer and the output buffer can not overlap.
+
+  Decompression is memory safe and guaranteed not to write the output buffer
+  more than what is specified in maxout.
+ */
+
+int fastlz_decompress(const void* input, int length, void* output, int maxout); 
+
+/**
+  Compress a block of data in the input buffer and returns the size of 
+  compressed block. The size of input buffer is specified by length. The 
+  minimum input buffer size is 16.
+
+  The output buffer must be at least 5% larger than the input buffer  
+  and can not be smaller than 66 bytes.
+
+  If the input is not compressible, the return value might be larger than
+  length (input buffer size).
+
+  The input buffer and the output buffer can not overlap.
+
+  Compression level can be specified in parameter level. At the moment, 
+  only level 1 and level 2 are supported.
+  Level 1 is the fastest compression and generally useful for short data.
+  Level 2 is slightly slower but it gives better compression ratio.
+
+  Note that the compressed data, regardless of the level, can always be
+  decompressed using the function fastlz_decompress above.
+*/  
+
+int fastlz_compress_level(int level, const void* input, int length, void* output);
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif /* FASTLZ_H */
diff --git a/Source/DirectFB/lib/direct/hash.c b/Source/DirectFB/lib/direct/hash.c
new file mode 100755
index 0000000..729e866
--- /dev/null
+++ b/Source/DirectFB/lib/direct/hash.c
@@ -0,0 +1,268 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+
+#include <direct/debug.h>
+#include <direct/hash.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+
+D_DEBUG_DOMAIN( Direct_Hash, "Direct/Hash", "Hash table implementation" );
+
+
+#define REMOVED  ((void *) -1)
+
+typedef struct {
+     unsigned long  key;
+     void          *value;
+} Element;
+
+struct __D_DirectHash {
+     int       magic;
+
+     int       size;
+
+     int       count;
+     int       removed;
+
+     Element  *elements;
+};
+
+/**************************************************************************************************/
+
+static inline int
+locate_key( const DirectHash *hash, unsigned long key )
+{
+     int            pos;
+     const Element *element;
+
+     pos = key % hash->size;
+
+     element = &hash->elements[pos];
+
+     while (element->value) {
+          if (element->value != REMOVED && element->key == key)
+               return pos;
+
+          if (++pos == hash->size)
+               pos = 0;
+
+          element = &hash->elements[pos];
+     }
+
+     return -1;
+}
+
+/**************************************************************************************************/
+
+DirectResult
+direct_hash_create( int          size,
+                    DirectHash **ret_hash )
+{
+     DirectHash *hash;
+
+     if (size < 17)
+          size = 17;
+
+     D_DEBUG_AT( Direct_Hash, "Creating hash table with initial capacity of %d...\n", size );
+
+     hash = D_CALLOC( 1, sizeof (DirectHash) );
+     if (!hash) {
+          D_WARN( "out of memory" );
+          return DR_NOLOCALMEMORY;
+     }
+
+     hash->size     = size;
+     hash->elements = D_CALLOC( size, sizeof(Element) );
+
+     if (!hash->elements) {
+          D_WARN( "out of memory" );
+          D_FREE( hash );
+          return DR_NOLOCALMEMORY;
+     }
+
+     D_MAGIC_SET( hash, DirectHash );
+
+     *ret_hash = hash;
+
+     return DR_OK;
+}
+
+void
+direct_hash_destroy( DirectHash *hash )
+{
+     D_MAGIC_ASSERT( hash, DirectHash );
+
+     D_MAGIC_CLEAR( hash );
+
+     D_FREE( hash->elements );
+     D_FREE( hash );
+}
+
+DirectResult
+direct_hash_insert( DirectHash    *hash,
+                    unsigned long  key,
+                    void          *value )
+{
+     int      pos;
+     Element *element;
+
+     D_MAGIC_ASSERT( hash, DirectHash );
+     D_ASSERT( value != NULL );
+
+     /* Need to resize the hash table? */
+     if ((hash->count + hash->removed) > hash->size / 4) {
+          int      i, size = hash->size * 3;
+          Element *elements;
+
+          D_DEBUG_AT( Direct_Hash, "Resizing from %d to %d... (count %d, removed %d)\n",
+                      hash->size, size, hash->count, hash->removed );
+
+          elements = D_CALLOC( size, sizeof(Element) );
+          if (!elements) {
+               D_WARN( "out of memory" );
+               return DR_NOLOCALMEMORY;
+          }
+
+          for (i=0; i<hash->size; i++) {
+               Element *element = &hash->elements[i];
+               Element *insertElement;
+
+               if (element->value && element->value != REMOVED) {
+                    pos = element->key % size;
+
+                    insertElement = &elements[pos];
+                    while (insertElement->value && insertElement->value != REMOVED) {
+                        if (++pos == size)
+                            pos = 0;
+                        insertElement = &elements[pos];
+                    }
+
+                    elements[pos] = *element;
+               }
+          }
+
+          D_FREE( hash->elements );
+
+          hash->size     = size;
+          hash->elements = elements;
+          hash->removed  = 0;
+     }
+
+     pos = key % hash->size;
+
+     D_DEBUG_AT( Direct_Hash, "Attempting to insert key 0x%08lx at position %d...\n", key, pos );
+
+     element = &hash->elements[pos];
+
+     while (element->value && element->value != REMOVED) {
+          if (element->key == key) {
+               D_BUG( "key already exists" );
+               return DR_BUG;
+          }
+
+          if (++pos == hash->size)
+               pos = 0;
+
+          element = &hash->elements[pos];
+     }
+
+     if (element->value == REMOVED)
+          hash->removed--;
+
+     element->key   = key;
+     element->value = value;
+
+     hash->count++;
+
+     D_DEBUG_AT( Direct_Hash, "...inserted at %d, new count = %d, removed = %d, size = %d, key = 0x%08lx.\n",
+                 pos, hash->count, hash->removed, hash->size, key );
+
+     return DR_OK;
+}
+
+void
+direct_hash_remove( DirectHash    *hash,
+                    unsigned long  key )
+{
+     int pos;
+
+     D_MAGIC_ASSERT( hash, DirectHash );
+
+     pos = locate_key( hash, key );
+     if (pos == -1) {
+          D_WARN( "key not found" );
+          return;
+     }
+
+     hash->elements[pos].value = REMOVED;
+
+     hash->count--;
+     hash->removed++;
+
+     D_DEBUG_AT( Direct_Hash, "Removed key 0x%08lx at %d, new count = %d, removed = %d, size = %d.\n",
+                 key, pos, hash->count, hash->removed, hash->size );
+}
+
+void *
+direct_hash_lookup( DirectHash    *hash,
+                    unsigned long  key )
+{
+     int pos;
+
+     D_MAGIC_ASSERT( hash, DirectHash );
+
+     pos = locate_key( hash, key );
+
+     return (pos != -1) ? hash->elements[pos].value : NULL;
+}
+
+void
+direct_hash_iterate( DirectHash             *hash,
+                     DirectHashIteratorFunc  func,
+                     void                   *ctx )
+{
+     int i;
+
+     D_MAGIC_ASSERT( hash, DirectHash );
+
+     for (i=0; i<hash->size; i++) {
+          Element *element = &hash->elements[i];
+
+          if (!element->value || element->value == REMOVED)
+               continue;
+
+          if (!func( hash, element->key, element->value, ctx ) )
+               return;
+     }
+}
+
diff --git a/Source/DirectFB/lib/direct/hash.h b/Source/DirectFB/lib/direct/hash.h
new file mode 100755
index 0000000..6b487d9
--- /dev/null
+++ b/Source/DirectFB/lib/direct/hash.h
@@ -0,0 +1,61 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__HASH_H__
+#define __DIRECT__HASH_H__
+
+#include <direct/types.h>
+
+
+typedef bool (*DirectHashIteratorFunc)( DirectHash    *hash,
+                                        unsigned long  key,
+                                        void          *value,
+                                        void          *ctx );
+
+
+DirectResult  direct_hash_create ( int            size,
+                                   DirectHash   **ret_hash );
+
+void          direct_hash_destroy( DirectHash    *hash );
+
+DirectResult  direct_hash_insert ( DirectHash    *hash,
+                                   unsigned long  key,
+                                   void          *value );
+
+void          direct_hash_remove ( DirectHash    *hash,
+                                   unsigned long  key );
+
+void         *direct_hash_lookup ( DirectHash    *hash,
+                                   unsigned long  key );
+
+void          direct_hash_iterate( DirectHash             *hash,
+                                   DirectHashIteratorFunc  func,
+                                   void                   *ctx );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/interface.c b/Source/DirectFB/lib/direct/interface.c
new file mode 100755
index 0000000..1247412
--- /dev/null
+++ b/Source/DirectFB/lib/direct/interface.c
@@ -0,0 +1,474 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <pthread.h>
+#include <dirent.h>
+#ifndef USE_KOS
+#include <dlfcn.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <alloca.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+#ifdef PIC
+#define DYNAMIC_LINKING
+#endif
+
+
+D_DEBUG_DOMAIN( Direct_Interface, "Direct/Interface", "Direct Interface" );
+
+
+typedef struct {
+     DirectLink            link;
+
+     int                   magic;
+
+     char                 *filename;
+     void                 *module_handle;
+
+     DirectInterfaceFuncs *funcs;
+
+     const char           *type;
+     const char           *implementation;
+
+     int                   references;
+} DirectInterfaceImplementation;
+
+
+#ifdef PTHREADMINIT
+static pthread_mutex_t  implementations_mutex = PTHREAD_MUTEX_INITIALIZER;
+#else
+static pthread_mutex_t  implementations_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#endif
+static DirectLink      *implementations       = NULL;
+
+/**************************************************************************************************/
+
+void
+DirectRegisterInterface( DirectInterfaceFuncs *funcs )
+{
+     DirectInterfaceImplementation *impl;
+
+     D_DEBUG_AT( Direct_Interface, "%s( %p )\n", __FUNCTION__, funcs );
+
+     impl = D_CALLOC( 1, sizeof(DirectInterfaceImplementation) );
+
+     impl->funcs          = funcs;
+     impl->type           = funcs->GetType();
+     impl->implementation = funcs->GetImplementation();
+
+     D_MAGIC_SET( impl, DirectInterfaceImplementation );
+
+     D_DEBUG_AT( Direct_Interface, "  -> %s | %s\n", impl->type, impl->implementation );
+
+     pthread_mutex_lock( &implementations_mutex );
+     direct_list_prepend( &implementations, &impl->link );
+     pthread_mutex_unlock( &implementations_mutex );
+}
+
+void
+DirectUnregisterInterface( DirectInterfaceFuncs *funcs )
+{
+     DirectInterfaceImplementation *impl;
+
+     pthread_mutex_lock( &implementations_mutex );
+
+     direct_list_foreach (impl, implementations) {
+          D_MAGIC_ASSERT( impl, DirectInterfaceImplementation );
+
+          if (impl->funcs == funcs) {
+               direct_list_remove( &implementations, &impl->link );
+
+               break;
+          }
+     }
+
+     pthread_mutex_unlock( &implementations_mutex );
+
+     if (!impl) {
+          D_BUG( "implementation not found" );
+          return;
+     }
+
+     D_MAGIC_CLEAR( impl );
+
+     D_FREE( impl );
+}
+
+DirectResult
+DirectProbeInterface( DirectInterfaceFuncs *funcs, void *ctx )
+{
+     return (funcs->Probe( ctx ) == DR_OK);
+}
+
+DirectResult
+DirectGetInterface( DirectInterfaceFuncs     **funcs,
+                    const char                *type,
+                    const char                *implementation,
+                    DirectInterfaceProbeFunc   probe,
+                    void                      *probe_ctx )
+{
+#ifdef DYNAMIC_LINKING
+     int                         len;
+     DIR                        *dir;
+     char                       *interface_dir;
+     struct dirent              *entry = NULL;
+     struct dirent               tmp;
+     const char                 *path;
+#endif
+
+     DirectLink *link;
+
+     D_DEBUG_AT( Direct_Interface, "%s( %p, '%s', '%s', %p, %p )\n", __FUNCTION__,
+                 funcs, type, implementation, probe, probe_ctx );
+
+     pthread_mutex_lock( &implementations_mutex );
+
+     /*
+      * Check existing implementations first.
+      */
+     direct_list_foreach( link, implementations ) {
+          DirectInterfaceImplementation *impl = (DirectInterfaceImplementation*) link;
+
+          if (type && strcmp( type, impl->type ))
+               continue;
+
+          if (implementation && strcmp( implementation, impl->implementation ))
+               continue;
+
+          D_DEBUG_AT( Direct_Interface, "  -> Probing '%s'...\n", impl->implementation );
+
+          if (probe && !probe( impl->funcs, probe_ctx ))
+               continue;
+          else {
+               if (!impl->references) {
+                    D_INFO( "Direct/Interface: Using '%s' implementation of '%s'.\n",
+                            impl->implementation, impl->type );
+               }
+
+               *funcs = impl->funcs;
+               impl->references++;
+
+               pthread_mutex_unlock( &implementations_mutex );
+
+               return DR_OK;
+          }
+     }
+
+#ifdef DYNAMIC_LINKING
+     /*
+      * Try to load it dynamically.
+      */
+
+     /* NULL type means we can't find plugin, so stop immediately */
+     if (type == NULL) {
+          pthread_mutex_unlock( &implementations_mutex );
+          return DR_NOIMPL;
+     }
+
+     path = direct_config->module_dir;
+     if(!path)
+          path = MODULEDIR;
+
+     len = strlen(path) + strlen("/interfaces/") + strlen(type) + 1;
+     interface_dir = alloca( len );
+     snprintf( interface_dir, len, "%s%sinterfaces/%s", path, (path[strlen(path)-1]=='/') ? "" : "/", type );
+
+     dir = opendir( interface_dir );
+     if (!dir) {
+          D_DEBUG( "Could not open interface directory `%s'!\n", interface_dir );
+          pthread_mutex_unlock( &implementations_mutex );
+          return errno2result( errno );
+     }
+
+     /*
+      * Iterate directory.
+      */
+     while (readdir_r( dir, &tmp, &entry ) == 0 && entry) {
+          void *handle = NULL;
+          char  buf[4096];
+
+          DirectInterfaceImplementation *old_impl = (DirectInterfaceImplementation*) implementations;
+
+          if (strlen(entry->d_name) < 4 ||
+              entry->d_name[strlen(entry->d_name)-1] != 'o' ||
+              entry->d_name[strlen(entry->d_name)-2] != 's')
+               continue;
+
+          snprintf( buf, 4096, "%s/%s", interface_dir, entry->d_name );
+
+          /*
+           * Check if it got already loaded.
+           */
+          direct_list_foreach( link, implementations ) {
+               DirectInterfaceImplementation *impl = (DirectInterfaceImplementation*) link;
+
+               if (impl->filename && !strcmp( impl->filename, buf )) {
+                    handle = impl->module_handle;
+                    break;
+               }
+          }
+
+          /*
+           * If already loaded take the next one.
+           */
+          if (handle)
+               continue;
+
+          /*
+           * Open it and check.
+           */
+          handle = dlopen( buf, RTLD_NOW );
+          if (handle) {
+               DirectInterfaceImplementation *impl = (DirectInterfaceImplementation*) implementations;
+
+               /*
+                * Check if it registered itself.
+                */
+               if (impl == old_impl) {
+                    dlclose( handle );
+                    continue;
+               }
+
+               /*
+                * Keep filename and module handle.
+                */
+               impl->filename      = D_STRDUP( buf );
+               impl->module_handle = handle;
+
+               /*
+                * Almost the same stuff like above, TODO: make function.
+                */
+               if (strcmp( type, impl->type ))
+                    continue;
+
+               if (implementation && strcmp( implementation,
+                                             impl->implementation ))
+                    continue;
+
+               if (probe && !probe( impl->funcs, probe_ctx )) {
+                    continue;
+               }
+               else {
+                    D_INFO( "Direct/Interface: Loaded '%s' implementation of '%s'.\n",
+                            impl->implementation, impl->type );
+
+                    *funcs = impl->funcs;
+                    impl->references++;
+
+                    closedir( dir );
+
+                    pthread_mutex_unlock( &implementations_mutex );
+
+                    return DR_OK;
+               }
+          }
+          else
+               D_DLERROR( "Direct/Interface: Unable to dlopen `%s'!\n", buf );
+     }
+
+     closedir( dir );
+
+     pthread_mutex_unlock( &implementations_mutex );
+#endif
+
+     return DR_NOIMPL;
+}
+
+/**************************************************************************************************/
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+typedef struct {
+     const void        *interface;
+     char              *name;
+     char              *what;
+
+     const char        *func;
+     const char        *file;
+     int                line;
+
+     DirectTraceBuffer *trace;
+} InterfaceDesc;
+
+static int              alloc_count    = 0;
+static int              alloc_capacity = 0;
+static InterfaceDesc   *alloc_list     = NULL;
+static pthread_mutex_t  alloc_lock     = PTHREAD_MUTEX_INITIALIZER;
+
+/**************************************************************************************************/
+
+void
+direct_print_interface_leaks( void )
+{
+     unsigned int i;
+
+     pthread_mutex_lock( &alloc_lock );
+
+     if (alloc_count /*&& (!direct_config || direct_config->debug)*/) {
+          direct_log_printf( NULL, "Interface instances remaining (%d): \n", alloc_count );
+
+          for (i=0; i<alloc_count; i++) {
+               InterfaceDesc *desc = &alloc_list[i];
+
+               direct_log_printf( NULL, "  - '%s' at %p (%s) allocated in %s (%s: %u)\n", desc->name,
+                        desc->interface, desc->what, desc->func, desc->file, desc->line );
+
+               if (desc->trace)
+                    direct_trace_print_stack( desc->trace );
+          }
+     }
+
+     pthread_mutex_unlock( &alloc_lock );
+}
+
+/**************************************************************************************************/
+
+static InterfaceDesc *
+allocate_interface_desc( void )
+{
+     int cap = alloc_capacity;
+
+     if (!cap)
+          cap = 64;
+     else if (cap == alloc_count)
+          cap <<= 1;
+
+     if (cap != alloc_capacity) {
+          alloc_capacity = cap;
+          alloc_list     = realloc( alloc_list, sizeof(InterfaceDesc) * cap );
+
+          D_ASSERT( alloc_list != NULL );
+     }
+
+     return &alloc_list[alloc_count++];
+}
+
+static inline void
+fill_interface_desc( InterfaceDesc     *desc,
+                     const void        *interface,
+                     const char        *name,
+                     const char        *func,
+                     const char        *file,
+                     int                line,
+                     const char        *what,
+                     DirectTraceBuffer *trace )
+{
+     desc->interface = interface;
+     desc->name      = strdup( name );
+     desc->what      = strdup( what );
+     desc->func      = func;
+     desc->file      = file;
+     desc->line      = line;
+     desc->trace     = trace;
+}
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+void
+direct_dbg_interface_add( const char *func,
+                          const char *file,
+                          int         line,
+                          const char *what,
+                          const void *interface,
+                          const char *name )
+{
+     InterfaceDesc *desc;
+
+     pthread_mutex_lock( &alloc_lock );
+
+     desc = allocate_interface_desc();
+
+     fill_interface_desc( desc, interface, name,
+                          func, file, line, what, direct_trace_copy_buffer(NULL) );
+
+     pthread_mutex_unlock( &alloc_lock );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_dbg_interface_remove( const char *func,
+                             const char *file,
+                             int         line,
+                             const char *what,
+                             const void *interface )
+{
+     unsigned int i;
+
+     pthread_mutex_lock( &alloc_lock );
+
+     for (i=0; i<alloc_count; i++) {
+          InterfaceDesc *desc = &alloc_list[i];
+
+          if (desc->interface == interface) {
+               if (desc->trace)
+                    direct_trace_free_buffer( desc->trace );
+
+               free( desc->what );
+               free( desc->name );
+
+               if (i < --alloc_count)
+                    direct_memmove( desc, desc + 1, (alloc_count - i) * sizeof(InterfaceDesc) );
+
+               pthread_mutex_unlock( &alloc_lock );
+
+               return;
+          }
+     }
+
+     pthread_mutex_unlock( &alloc_lock );
+
+     D_ERROR( "Direct/Interface: unknown instance %p (%s) from [%s:%d in %s()]\n",
+              interface, what, file, line, func );
+     D_BREAK( "unknown instance" );
+}
+
+#else     /* DIRECT_BUILD_DEBUG */
+
+void
+direct_print_interface_leaks( void )
+{
+}
+
+#endif    /* DIRECT_BUILD_DEBUG */
+
diff --git a/Source/DirectFB/lib/direct/interface.h b/Source/DirectFB/lib/direct/interface.h
new file mode 100755
index 0000000..5e6200d
--- /dev/null
+++ b/Source/DirectFB/lib/direct/interface.h
@@ -0,0 +1,215 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__INTERFACE_H__
+#define __DIRECT__INTERFACE_H__
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+/*
+ * Forward declaration macro for interfaces.
+ */
+#define DECLARE_INTERFACE( IFACE )                \
+     typedef struct _##IFACE IFACE;
+
+/*
+ * Macro for an interface definition.
+ */
+#define DEFINE_INTERFACE( IFACE, IDATA... )       \
+     struct _##IFACE {                            \
+          void          *priv;                    \
+          int            magic;                   \
+                                                  \
+          DirectResult (*AddRef)( IFACE *thiz );  \
+          DirectResult (*Release)( IFACE *thiz ); \
+                                                  \
+          IDATA                                   \
+     };
+
+/*
+ * Declare base interface
+ */
+DECLARE_INTERFACE( IAny )
+
+/*
+ * Define base interface
+ */
+DEFINE_INTERFACE( IAny, )
+
+/*
+ * Function type for probing of interface implementations
+ */
+typedef DirectResult (*DirectInterfaceGenericProbeFunc)( void *ctx, ... );
+
+/*
+ * Function type for initialization of interface instances
+ */
+typedef DirectResult (*DirectInterfaceGenericConstructFunc)( void *interface, ... );
+
+/*
+ * Function table for interface implementations
+ */
+typedef struct {
+     const char * (*GetType)(void);
+     const char * (*GetImplementation)(void);
+     DirectResult (*Allocate)( void **interface );
+     
+     DirectInterfaceGenericProbeFunc     Probe;
+     DirectInterfaceGenericConstructFunc Construct;
+} DirectInterfaceFuncs;
+
+/*
+ * Callback type for user probing interface implementations
+ */
+typedef DirectResult (*DirectInterfaceProbeFunc)( DirectInterfaceFuncs *impl, void *ctx );
+
+/*
+ * Loads an interface of a specific 'type'.
+ * Optionally an 'implementation' can be chosen.
+ * A 'probe' function can be used to check available implementations.
+ *
+ * After success 'funcs' is set.
+ */
+DirectResult DirectGetInterface( DirectInterfaceFuncs     **funcs,
+                                 const char                *type,
+                                 const char                *implementation,
+                                 DirectInterfaceProbeFunc   probe,
+                                 void                      *probe_ctx );
+
+/*
+ * Default probe function. Calls "funcs->Probe(ctx)".
+ * Can be used as the 'probe' argument to DirectGetInterface.
+ * 'probe_ctx' should then be set to the interface specific probe context.
+ */
+DirectResult DirectProbeInterface( DirectInterfaceFuncs *funcs, void *ctx );
+
+/*
+ * Called by implementation modules during 'dlopen'ing or at startup if linked
+ * into the executable.
+ */
+void DirectRegisterInterface( DirectInterfaceFuncs *funcs );
+
+void DirectUnregisterInterface( DirectInterfaceFuncs *funcs );
+
+void direct_print_interface_leaks(void);
+
+#if DIRECT_BUILD_DEBUGS
+void direct_dbg_interface_add   ( const char *func,
+                                  const char *file,
+                                  int         line,
+                                  const char *what,
+                                  const void *interface,
+                                  const char *name );
+
+void direct_dbg_interface_remove( const char *func,
+                                  const char *file,
+                                  int         line,
+                                  const char *what,
+                                  const void *interface );
+#endif
+
+#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
+
+#if !DIRECT_BUILD_DEBUGS
+#error Building with debug, but library headers suggest that debug is not supported.
+#endif
+
+#define DIRECT_DBG_INTERFACE_ADD        direct_dbg_interface_add
+#define DIRECT_DBG_INTERFACE_REMOVE     direct_dbg_interface_remove
+
+#else
+
+#define DIRECT_DBG_INTERFACE_ADD(func,file,line,what,interface,name)  do {} while (0)
+#define DIRECT_DBG_INTERFACE_REMOVE(func,file,line,what,interface)    do {} while (0)
+
+#endif
+
+
+
+#define DIRECT_ALLOCATE_INTERFACE(p,i)                                               \
+     do {                                                                            \
+          (p) = (__typeof__(p))D_CALLOC( 1, sizeof(i) );                             \
+                                                                                     \
+          D_MAGIC_SET( (IAny*)(p), DirectInterface );                                \
+                                                                                     \
+          DIRECT_DBG_INTERFACE_ADD( __FUNCTION__, __FILE__, __LINE__, #p, p, #i );   \
+     } while (0)
+
+
+#define DIRECT_ALLOCATE_INTERFACE_DATA(p,i)                                          \
+     i##_data *data;                                                                 \
+                                                                                     \
+     D_MAGIC_ASSERT( (IAny*)(p), DirectInterface );                                  \
+                                                                                     \
+     if (!(p)->priv)                                                                 \
+          (p)->priv = D_CALLOC( 1, sizeof(i##_data) );                               \
+                                                                                     \
+     data = (i##_data*)((p)->priv);
+
+
+#define DIRECT_DEALLOCATE_INTERFACE(p)                                               \
+     DIRECT_DBG_INTERFACE_REMOVE( __FUNCTION__, __FILE__, __LINE__, #p, p );         \
+                                                                                     \
+     if ((p)->priv) {                                                                \
+          D_FREE( (p)->priv );                                                       \
+          (p)->priv = NULL;                                                          \
+     }                                                                               \
+                                                                                     \
+     D_MAGIC_CLEAR( (IAny*)(p) );                                                    \
+                                                                                     \
+     D_FREE( (p) );
+
+
+#define DIRECT_INTERFACE_GET_DATA(i)                                                 \
+     i##_data *data;                                                                 \
+                                                                                     \
+     if (!thiz)                                                                      \
+          return DR_THIZNULL;                                                        \
+                                                                                     \
+     D_MAGIC_ASSERT( (IAny*)thiz, DirectInterface );                                 \
+                                                                                     \
+     data = (i##_data*) thiz->priv;                                                  \
+                                                                                     \
+     if (!data)                                                                      \
+          return DR_DEAD;
+
+
+#define DIRECT_INTERFACE_GET_DATA_FROM(interface,data,prefix)                        \
+     do {                                                                            \
+          D_MAGIC_ASSERT( (IAny*)(interface), DirectInterface );                     \
+                                                                                     \
+          (data) = (prefix##_data*) (interface)->priv;                               \
+                                                                                     \
+          if (!(data))                                                               \
+               return DR_DEAD;                                                       \
+     } while (0)
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/interface_implementation.h b/Source/DirectFB/lib/direct/interface_implementation.h
new file mode 100755
index 0000000..7951b59
--- /dev/null
+++ b/Source/DirectFB/lib/direct/interface_implementation.h
@@ -0,0 +1,91 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__INTERFACE_IMPLEMENTATION_H__
+#define __DIRECT__INTERFACE_IMPLEMENTATION_H__
+
+#include <direct/interface.h>
+
+
+static const char   *GetType( void );
+static const char   *GetImplementation( void );
+static DirectResult  Allocate( void **interface );
+
+static DirectInterfaceFuncs interface_funcs = {
+     .GetType            = GetType,
+     .GetImplementation  = GetImplementation,
+     .Allocate           = Allocate,
+     .Probe              = (DirectInterfaceGenericProbeFunc) Probe,
+     .Construct          = (DirectInterfaceGenericConstructFunc) Construct
+};
+
+#define DIRECT_INTERFACE_IMPLEMENTATION(type, impl)    \
+                                                       \
+static const char *                                    \
+GetType( void )                                        \
+{                                                      \
+     return #type;                                     \
+}                                                      \
+                                                       \
+static const char *                                    \
+GetImplementation( void )                              \
+{                                                      \
+     return #impl;                                     \
+}                                                      \
+                                                       \
+static DirectResult                                    \
+Allocate( void **interface )                           \
+{                                                      \
+     DIRECT_ALLOCATE_INTERFACE( *interface, type );    \
+     return DR_OK;                                     \
+}                                                      \
+                                                       \
+__attribute__((constructor))                           \
+void                                                   \
+type##_##impl##_ctor(void);                            \
+                                                       \
+__attribute__((constructor))                           \
+void                                                   \
+type##_##impl##_ctor(void)                             \
+{                                                      \
+     DirectRegisterInterface( &interface_funcs );      \
+}                                                      \
+                                                       \
+__attribute__((destructor))                            \
+void                                                   \
+type##_##impl##_dtor(void);                            \
+                                                       \
+__attribute__((destructor))                            \
+void                                                   \
+type##_##impl##_dtor(void)                             \
+{                                                      \
+     DirectUnregisterInterface( &interface_funcs );    \
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/list.c b/Source/DirectFB/lib/direct/list.c
new file mode 100755
index 0000000..8a82bfa
--- /dev/null
+++ b/Source/DirectFB/lib/direct/list.c
@@ -0,0 +1,35 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stddef.h>
+
+#include <direct/list.h>
+
+
diff --git a/Source/DirectFB/lib/direct/list.h b/Source/DirectFB/lib/direct/list.h
new file mode 100755
index 0000000..25ecdf8
--- /dev/null
+++ b/Source/DirectFB/lib/direct/list.h
@@ -0,0 +1,224 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__LIST_H__
+#define __DIRECT__LIST_H__
+
+#include <direct/types.h>
+#include <direct/debug.h>
+
+
+struct __D_DirectLink {
+     int         magic;
+
+     DirectLink *next;
+     DirectLink *prev; /* The 'prev' pointer of the first element always points
+                          to the last element of the list, for fast appending ;-) */
+};
+
+static __inline__ void
+direct_list_prepend( DirectLink **list, DirectLink *link )
+{
+     DirectLink *first = *list;
+
+     link->next = first;
+
+     if (first) {
+          D_MAGIC_ASSERT( first, DirectLink );
+
+          link->prev = first->prev;
+
+          first->prev = link;
+     }
+     else
+          link->prev = link;
+
+     *list = link;
+
+     D_MAGIC_SET( link, DirectLink );
+}
+
+static __inline__ void
+direct_list_append( DirectLink **list, DirectLink *link )
+{
+     DirectLink *first = *list;
+
+     link->next = NULL;
+
+     if (first) {
+          DirectLink *last = first->prev;
+
+          D_MAGIC_ASSERT( first, DirectLink );
+          D_MAGIC_ASSERT( last, DirectLink );
+
+          link->prev = last;
+
+          last->next = first->prev = link;
+     }
+     else
+          *list = link->prev = link;
+
+     D_MAGIC_SET( link, DirectLink );
+}
+
+static __inline__ bool
+direct_list_contains_element_EXPENSIVE( DirectLink *list, DirectLink *link )
+{
+     D_MAGIC_ASSERT_IF( list, DirectLink );
+     
+     while (list) {
+          if (list == link)
+               return true;
+
+          list = list->next;
+     }
+
+     return false;
+}
+
+static __inline__ int
+direct_list_count_elements_EXPENSIVE( DirectLink *list )
+{
+     int count = 0;
+
+     while (list) {
+          D_MAGIC_ASSERT( list, DirectLink );
+
+          count++;
+          
+          list = list->next;
+     }
+
+     return count;
+}
+
+static __inline__ void
+direct_list_remove( DirectLink **list, DirectLink *link )
+{
+     DirectLink *next;
+     DirectLink *prev;
+
+     D_ASSERT( list != NULL );
+
+     D_ASSERT( direct_list_contains_element_EXPENSIVE( *list, link ) );
+
+     D_MAGIC_ASSERT( *list, DirectLink );
+     D_MAGIC_ASSERT( link, DirectLink );
+
+     next = link->next;
+     prev = link->prev;
+
+     if (next) {
+          D_MAGIC_ASSERT( next, DirectLink );
+
+          next->prev = prev;
+     }
+     else
+         (*list)->prev = prev;
+
+     if (link == *list)
+          *list = next;
+     else {
+          D_MAGIC_ASSERT( prev, DirectLink );
+
+          prev->next = next;
+     }
+
+     link->next = link->prev = NULL;
+
+     D_MAGIC_CLEAR( link );
+}
+
+static __inline__ void
+direct_list_move_to_front( DirectLink **list, DirectLink *link )
+{
+     DirectLink *next;
+     DirectLink *prev;
+     DirectLink *first;
+
+     D_ASSERT( list != NULL );
+
+     first = *list;
+
+     D_ASSERT( direct_list_contains_element_EXPENSIVE( first, link ) );
+
+     D_MAGIC_ASSERT( first, DirectLink );
+     D_MAGIC_ASSERT( link, DirectLink );
+
+     if (first == link)
+          return;
+
+     next = link->next;
+     prev = link->prev;
+
+     D_MAGIC_ASSERT_IF( next, DirectLink );
+     D_MAGIC_ASSERT( prev, DirectLink );
+
+     if (next) {
+          next->prev = prev;
+
+          link->prev = first->prev;
+     }
+     else
+          link->prev = prev;
+
+     prev->next = next;
+
+     link->next = first;
+
+     first->prev = link;
+
+     *list = link;
+}
+
+static __inline__ bool
+direct_list_check_link( const DirectLink *link )
+{
+     D_MAGIC_ASSERT_IF( link, DirectLink );
+
+     return link != NULL;
+}
+
+
+#define direct_list_foreach(elem, list)                     \
+     for (elem = (__typeof__(elem))(list);                  \
+          direct_list_check_link( (DirectLink*)(elem) );    \
+          elem = (__typeof__(elem))(((DirectLink*)(elem))->next))
+
+#define direct_list_foreach_reverse(elem, list)                    \
+     for (elem = (__typeof__(elem))((list) ? (list)->prev : NULL); \
+          direct_list_check_link( (DirectLink*)(elem) );           \
+          elem = (__typeof__(elem))((((DirectLink*)(elem))->prev->next) ? ((DirectLink*)(elem))->prev : NULL))
+
+#define direct_list_foreach_safe(elem, temp, list)                                             \
+     for (elem = (__typeof__(elem))(list), temp = ((__typeof__(temp))(elem) ? (__typeof__(temp))(((DirectLink*)(elem))->next) : NULL); \
+          direct_list_check_link( (DirectLink*)(elem) );                                       \
+          elem = (__typeof__(elem))(temp), temp = ((__typeof__(temp))(elem) ? (__typeof__(temp))(((DirectLink*)(elem))->next) : NULL))
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/log.c b/Source/DirectFB/lib/direct/log.c
new file mode 100755
index 0000000..774b7a5
--- /dev/null
+++ b/Source/DirectFB/lib/direct/log.c
@@ -0,0 +1,414 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <netdb.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/log.h>
+#include <direct/util.h>
+
+
+struct __D_DirectLog {
+     int             magic;
+
+     DirectLogType   type;
+
+     int             fd;
+
+     pthread_mutex_t lock;
+};
+
+/**********************************************************************************************************************/
+
+/* Statically allocated to avoid endless loops between D_CALLOC() and D_DEBUG(), while the latter would only
+ * call the allocation once, if there wouldn't be the loopback...
+ */
+static DirectLog       fallback_log;
+
+static DirectLog      *default_log   = NULL;
+static pthread_once_t  init_fallback = PTHREAD_ONCE_INIT;
+
+/**********************************************************************************************************************/
+
+static DirectResult init_stderr( DirectLog  *log );
+
+static DirectResult init_file  ( DirectLog  *log,
+                                 const char *filename );
+
+static DirectResult init_udp   ( DirectLog  *log,
+                                 const char *hostport );
+
+/**********************************************************************************************************************/
+
+DirectResult
+direct_log_create( DirectLogType   type,
+                   const char     *param,
+                   DirectLog     **ret_log )
+{
+     DirectResult  ret = DR_INVARG;
+     DirectLog    *log;
+
+     log = D_CALLOC( 1, sizeof(DirectLog) );
+     if (!log)
+          return D_OOM();
+
+     log->type = type;
+
+     switch (type) {
+          case DLT_STDERR:
+               ret = init_stderr( log );
+               break;
+
+          case DLT_FILE:
+               ret = init_file( log, param );
+               break;
+
+          case DLT_UDP:
+               ret = init_udp( log, param );
+               break;
+     }
+
+     if (ret)
+          D_FREE( log );
+     else {
+          direct_util_recursive_pthread_mutex_init( &log->lock );
+
+          D_MAGIC_SET( log, DirectLog );
+
+          *ret_log = log;
+     }
+
+     return ret;
+}
+
+DirectResult
+direct_log_destroy( DirectLog *log )
+{
+     D_MAGIC_ASSERT( log, DirectLog );
+
+     D_ASSERT( &fallback_log != log );
+
+     if (log == default_log)
+          default_log = NULL;
+
+     close( log->fd );
+
+     D_MAGIC_CLEAR( log );
+
+     D_FREE( log );
+
+     return DR_OK;
+}
+
+__attribute__((no_instrument_function))
+DirectResult
+direct_log_printf( DirectLog  *log,
+                   const char *format, ... )
+{
+     va_list args;
+
+     /*
+      * Don't use D_MAGIC_ASSERT or any other
+      * macros/functions that might cause an endless loop.
+      */
+
+     va_start( args, format );
+
+     /* Use the default log if passed log is invalid. */
+     if (!log || log->magic != D_MAGIC("DirectLog"))
+          log = direct_log_default();
+
+     /* Write to stderr as a fallback if default is invalid, too. */
+     if (!log || log->magic != D_MAGIC("DirectLog")) {
+	 
+			printf(format,args);
+	 
+	 
+	 
+          //vfprintf( stderr, format, args );
+		  
+		  
+		  
+		  
+          fflush( stderr );
+     }
+     else {
+          int  len;
+          char buf[512];
+
+          len = vsnprintf( buf, sizeof(buf), format, args );
+
+          pthread_mutex_lock( &log->lock );
+
+		  
+		  
+		  
+         // write( log->fd, buf, len );
+		printf("%s\n",buf);
+		  
+		  
+		  
+		  
+          pthread_mutex_unlock( &log->lock );
+     }
+
+     va_end( args );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_log_set_default( DirectLog *log )
+{
+     D_MAGIC_ASSERT( log, DirectLog );
+
+     default_log = log;
+
+     return DR_OK;
+}
+
+__attribute__((no_instrument_function))
+void
+direct_log_lock( DirectLog *log )
+{
+     D_MAGIC_ASSERT_IF( log, DirectLog );
+
+     if (!log)
+          log = direct_log_default();
+
+     D_MAGIC_ASSERT( log, DirectLog );
+
+     pthread_mutex_lock( &log->lock );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_log_unlock( DirectLog *log )
+{
+     D_MAGIC_ASSERT_IF( log, DirectLog );
+
+     if (!log)
+          log = direct_log_default();
+
+     D_MAGIC_ASSERT( log, DirectLog );
+
+     pthread_mutex_unlock( &log->lock );
+}
+
+__attribute__((no_instrument_function))
+static void
+init_fallback_log( void )
+{
+     fallback_log.type = DLT_STDERR;
+     fallback_log.fd   = fileno( stderr );
+
+     direct_util_recursive_pthread_mutex_init( &fallback_log.lock );
+
+     D_MAGIC_SET( &fallback_log, DirectLog );
+}
+
+__attribute__((no_instrument_function))
+DirectLog *
+direct_log_default( void )
+{
+     pthread_once( &init_fallback, init_fallback_log );
+
+     if (!default_log)
+          default_log = &fallback_log;
+
+     D_MAGIC_ASSERT( default_log, DirectLog );
+
+     return default_log;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+init_stderr( DirectLog *log )
+{
+     log->fd = dup( fileno( stderr ) );
+
+     return DR_OK;
+}
+
+static DirectResult
+init_file( DirectLog  *log,
+           const char *filename )
+{
+     DirectResult ret;
+     int          fd;
+
+     fd = open( filename, O_WRONLY | O_CREAT | O_APPEND, 0664 );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Direct/Log: Could not open '%s' for writing!\n", filename );
+          return ret;
+     }
+
+     log->fd = fd;
+
+     return DR_OK;
+}
+
+static DirectResult
+parse_host_addr( const char       *hostport,
+                 struct addrinfo **ret_addr )
+{
+     int   i, ret;
+     
+     int   size = strlen( hostport ) + 1;
+     char  buf[size];
+     
+     char *hoststr = buf;
+     char *portstr = NULL;
+     char *end;
+
+     struct addrinfo hints;
+
+     memcpy( buf, hostport, size );
+
+     for (i=0; i<size; i++) {
+          if (buf[i] == ':') {
+               buf[i]  = 0;
+               portstr = &buf[i+1];
+
+               break;
+          }
+     }
+
+     if (!portstr) {
+          D_ERROR( "Direct/Log: Parse error in '%s' that should be '<host>:<port>'!\n", hostport );
+          return DR_INVARG;
+     }
+
+     strtoul( portstr, &end, 10 );
+     if (end && *end) {
+          D_ERROR( "Direct/Log: Parse error in port number '%s'!\n", portstr );
+          return DR_INVARG;
+     }
+     
+     memset( &hints, 0, sizeof(hints) );
+     hints.ai_socktype = SOCK_DGRAM;
+     hints.ai_family   = PF_UNSPEC;
+     
+     ret = getaddrinfo( hoststr, portstr, &hints, ret_addr );
+     if (ret) {
+          switch (ret) {
+               case EAI_FAMILY:
+                    D_ERROR( "Direct/Log: Unsupported address family!\n" );
+                    return DR_UNSUPPORTED;
+               
+               case EAI_SOCKTYPE:
+                    D_ERROR( "Direct/Log: Unsupported socket type!\n" );
+                    return DR_UNSUPPORTED;
+               
+               case EAI_NONAME:
+                    D_ERROR( "Direct/Log: Host not found!\n" );
+                    return DR_FAILURE;
+                    
+               case EAI_SERVICE:
+                    D_ERROR( "Direct/Log: Port %s is unreachable!\n", portstr );
+                    return DR_FAILURE;
+               
+#ifdef EAI_ADDRFAMILY
+               case EAI_ADDRFAMILY:
+#endif
+               case EAI_NODATA:
+                    D_ERROR( "Direct/Log: Host found, but has no address!\n" );
+                    return DR_FAILURE;
+                    
+               case EAI_MEMORY:
+                    return D_OOM();
+
+               case EAI_FAIL:
+                    D_ERROR( "Direct/Log: A non-recoverable name server error occurred!\n" );
+                    return DR_FAILURE;
+
+               case EAI_AGAIN:
+                    D_ERROR( "Direct/Log: Temporary error, try again!\n" );
+                    return DR_TEMPUNAVAIL;
+                    
+               default:
+                    D_ERROR( "Direct/Log: Unknown error occured!?\n" );
+                    return DR_FAILURE;
+          }
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+init_udp( DirectLog  *log,
+          const char *hostport )
+{
+     DirectResult     ret;
+     int              fd;
+     struct addrinfo *addr;
+     
+     ret = parse_host_addr( hostport, &addr );
+     if (ret)
+          return ret;
+
+     fd = socket( addr->ai_family, SOCK_DGRAM, 0 );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Direct/Log: Could not create a UDP socket!\n" );
+          freeaddrinfo( addr );
+          return ret;
+     }
+
+     ret = connect( fd, addr->ai_addr, addr->ai_addrlen );
+     freeaddrinfo( addr );
+     
+     if (ret) {
+          ret = errno2result( errno );
+          D_PERROR( "Direct/Log: Could not connect UDP socket to '%s'!\n", hostport );
+          close( fd );
+          return ret;
+     }
+
+     log->fd = fd;
+
+     return DR_OK;
+}
diff --git a/Source/DirectFB/lib/direct/log.h b/Source/DirectFB/lib/direct/log.h
new file mode 100755
index 0000000..68eeccb
--- /dev/null
+++ b/Source/DirectFB/lib/direct/log.h
@@ -0,0 +1,89 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__LOG_H__
+#define __DIRECT__LOG_H__
+
+#include <direct/types.h>
+#include <direct/messages.h>
+
+
+typedef enum {
+     DLT_STDERR,    /* Simply print out log on stderr. */
+     DLT_FILE,      /* Write log into a file. */
+     DLT_UDP        /* Send out log via UDP. */
+} DirectLogType;
+
+
+/*
+ * Creates a logging facility.
+ *
+ * For each 'type' the 'param' has a different meaning:
+ *   DLT_STDERR     ignored (leave NULL)
+ *   DLT_FILE       file name
+ *   DLT_UDP        <ip>:<port>
+ */
+DirectResult direct_log_create     ( DirectLogType     type,
+                                     const char       *param,
+                                     DirectLog       **ret_log );
+
+/*
+ * Destroys a logging facility.
+ */
+DirectResult direct_log_destroy    ( DirectLog        *log );
+
+/*
+ * Write to the log in a printf fashion.
+ *
+ * If log is NULL, the default log is used if it's valid,
+ * otherwise stderr is used a fallback until now.
+ */
+DirectResult direct_log_printf     ( DirectLog        *log,
+                                     const char       *format, ... )  D_FORMAT_PRINTF(2);
+
+/*
+ * Set the default log that's used when no valid log is passed.
+ */
+DirectResult direct_log_set_default( DirectLog        *log );
+
+/*
+ * Locks a logging facility for non-intermixed output of multiple calls in multiple threads. Not mandatory.
+ */
+void         direct_log_lock       ( DirectLog        *log );
+
+/*
+ * Unlocks a logging facility.
+ */
+void         direct_log_unlock     ( DirectLog        *log );
+
+/*
+ * Returns the default log.
+ */
+DirectLog   *direct_log_default( void );
+
+#endif
diff --git a/Source/DirectFB/lib/direct/mem.c b/Source/DirectFB/lib/direct/mem.c
new file mode 100755
index 0000000..7b65a32
--- /dev/null
+++ b/Source/DirectFB/lib/direct/mem.c
@@ -0,0 +1,350 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/build.h>
+
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <signal.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+
+D_DEBUG_DOMAIN( Direct_Mem, "Direct/Mem", "libdirect memory allocation (debugging)" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     const void        *mem;
+     size_t             bytes;
+     const char        *func;
+     const char        *file;
+     int                line;
+     DirectTraceBuffer *trace;
+} MemDesc;
+
+/**********************************************************************************************************************/
+
+static int              alloc_count    = 0;
+static int              alloc_capacity = 0;
+static MemDesc         *alloc_list     = NULL;
+static pthread_mutex_t  alloc_lock     = PTHREAD_MUTEX_INITIALIZER;
+
+/**********************************************************************************************************************/
+
+void
+direct_print_memleaks( void )
+{
+     unsigned int i;
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+
+     if (alloc_count && (!direct_config || direct_config->debugmem)) {
+          direct_log_printf( NULL, "Local memory allocations remaining (%d): \n", alloc_count );
+
+          for (i=0; i<alloc_count; i++) {
+               MemDesc *desc = &alloc_list[i];
+
+               direct_log_printf( NULL, "%7zu bytes at %p allocated in %s (%s: %u)\n",
+                                  desc->bytes, desc->mem, desc->func, desc->file, desc->line );
+
+               if (desc->trace)
+                    direct_trace_print_stack( desc->trace );
+          }
+     }
+
+     pthread_mutex_unlock( &alloc_lock );
+}
+
+/**********************************************************************************************************************/
+
+/* FIXME: Replace array by linked list, or at least avoid the memmove on free of an item. */
+
+static MemDesc *
+allocate_mem_desc( void )
+{
+     int cap = alloc_capacity;
+
+     if (!cap)
+          cap = 64;
+     else if (cap == alloc_count)
+          cap <<= 1;
+
+     if (cap != alloc_capacity) {
+          void *new_list = malloc( sizeof(MemDesc) * cap );
+
+          if (!new_list) {
+               D_WARN( "could not allocate more descriptors (%d->%d)", alloc_capacity, cap );
+               return NULL;
+          }
+
+          direct_memcpy( new_list, alloc_list, sizeof(MemDesc) * alloc_count );
+
+          free( alloc_list );
+
+          alloc_capacity = cap;
+          alloc_list     = new_list;
+     }
+
+     return &alloc_list[alloc_count++];
+}
+
+static inline void
+fill_mem_desc( MemDesc *desc, const void *mem, int bytes,
+               const char *func, const char *file, int line, DirectTraceBuffer *trace )
+{
+     desc->mem   = mem;
+     desc->bytes = bytes;
+     desc->func  = func;
+     desc->file  = file;
+     desc->line  = line;
+     desc->trace = trace;
+}
+
+/**********************************************************************************************************************/
+
+void *
+direct_malloc( const char* file, int line, const char *func, size_t bytes )
+{
+     void    *mem;
+     MemDesc *desc;
+
+     D_DEBUG_AT( Direct_Mem, "  +%6zu bytes [%s:%d in %s()]\n", bytes, file, line, func );
+
+     mem = malloc( bytes );
+     if (!mem)
+          return NULL;
+
+     if (!direct_config->debugmem)
+          return mem;
+
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+     desc = allocate_mem_desc();
+     pthread_mutex_unlock( &alloc_lock );
+
+     if (desc)
+          fill_mem_desc( desc, mem, bytes, func, file, line, direct_trace_copy_buffer(NULL) );
+
+     return mem;
+}
+
+void *
+direct_calloc( const char* file, int line, const char *func, size_t count, size_t bytes )
+{
+     void    *mem;
+     MemDesc *desc;
+
+     D_DEBUG_AT( Direct_Mem, "  +%6zu bytes [%s:%d in %s()]\n", count * bytes, file, line, func );
+
+     mem = calloc( count, bytes );
+     if (!mem)
+          return NULL;
+
+     if (!direct_config->debugmem)
+          return mem;
+
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+     desc = allocate_mem_desc();
+     pthread_mutex_unlock( &alloc_lock );
+
+     if (desc)
+          fill_mem_desc( desc, mem, count * bytes, func, file, line, direct_trace_copy_buffer(NULL) );
+
+     return mem;
+}
+
+void *
+direct_realloc( const char *file, int line, const char *func, const char *what, void *mem, size_t bytes )
+{
+     int i;
+
+     if (!mem)
+          return direct_malloc( file, line, func, bytes );
+
+     if (!bytes) {
+          direct_free( file, line, func, what, mem );
+          return NULL;
+     }
+
+     if (!direct_config->debugmem) {
+          D_DEBUG_AT( Direct_Mem, "  *%6zu bytes [%s:%d in %s()] '%s'\n", bytes, file, line, func, what );
+          return realloc( mem, bytes );
+     }
+
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+
+     for (i=0; i<alloc_count; i++) {
+          MemDesc *desc = &alloc_list[i];
+
+          if (desc->mem == mem) {
+               void *new_mem = realloc( mem, bytes );
+
+               D_DEBUG_AT( Direct_Mem, "  %c%6zu bytes [%s:%d in %s()] (%s%zu) <- %p -> %p '%s'\n",
+                           (bytes > desc->bytes) ? '>' : '<', bytes, file, line, func,
+                           (bytes > desc->bytes) ? "+" : "", bytes - desc->bytes, mem, new_mem, what);
+
+               if (desc->trace) {
+                    direct_trace_free_buffer( desc->trace );
+                    desc->trace = NULL;
+               }
+
+               if (!new_mem) {
+                    D_WARN( "could not reallocate memory (%p: %zu->%zu)", mem, desc->bytes, bytes );
+
+                    alloc_count--;
+
+                    /* FIXME: This can be very slow. */
+                    if (i < alloc_count)
+                         direct_memmove( desc, desc + 1, (alloc_count - i) * sizeof(MemDesc) );
+               }
+               else
+                    fill_mem_desc( desc, new_mem, bytes, func, file, line, direct_trace_copy_buffer(NULL) );
+
+               pthread_mutex_unlock( &alloc_lock );
+
+               return new_mem;
+          }
+     }
+
+     pthread_mutex_unlock( &alloc_lock );
+
+     D_ERROR( "Direct/Mem: Not reallocating unknown %p (%s) from [%s:%d in %s()] - corrupt/incomplete list?\n",
+              mem, what, file, line, func );
+
+     return direct_malloc( file, line, func, bytes );
+}
+
+void
+direct_free( const char *file, int line, const char *func, const char *what, void *mem )
+{
+     unsigned int i;
+
+     if (!mem) {
+          D_WARN( "%s (NULL) called", __FUNCTION__ );
+          return;
+     }
+
+     if (!direct_config->debugmem) {
+          D_DEBUG_AT( Direct_Mem, "  - number of bytes of %s [%s:%d in %s()] -> %p\n", what, file, line, func, mem );
+          free( mem );
+          return;
+     }
+
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+
+     for (i=0; i<alloc_count; i++) {
+          MemDesc *desc = &alloc_list[i];
+
+          if (desc->mem == mem) {
+               free( mem );
+
+               D_DEBUG_AT( Direct_Mem, "  -%6zu bytes [%s:%d in %s()] -> %p '%s'\n",
+                           desc->bytes, file, line, func, mem, what );
+
+               if (desc->trace)
+                    direct_trace_free_buffer( desc->trace );
+
+               alloc_count--;
+
+               /* FIXME: This can be very slow. */
+               if (i < alloc_count)
+                    direct_memmove( desc, desc + 1, (alloc_count - i) * sizeof(MemDesc) );
+
+               pthread_mutex_unlock( &alloc_lock );
+
+               return;
+          }
+     }
+
+     pthread_mutex_unlock( &alloc_lock );
+
+     D_ERROR( "Direct/Mem: Not freeing unknown %p (%s) from [%s:%d in %s()] - corrupt/incomplete list?\n",
+              mem, what, file, line, func );
+}
+
+char *
+direct_strdup( const char* file, int line, const char *func, const char *string )
+{
+     void    *mem;
+     MemDesc *desc;
+     size_t   length = strlen( string ) + 1;
+
+     mem = malloc( length );
+     D_DEBUG_AT( Direct_Mem, "  +%6zu bytes [%s:%d in %s()] -> %p \"%30s\"\n", length, file, line, func, mem, string );
+     if (!mem)
+          return NULL;
+
+     direct_memcpy( mem, string, length );
+
+     if (!direct_config->debugmem)
+          return mem;
+
+
+     /* Debug only. */
+     pthread_mutex_lock( &alloc_lock );
+     desc = allocate_mem_desc();
+     pthread_mutex_unlock( &alloc_lock );
+
+     if (desc)
+          fill_mem_desc( desc, mem, length, func, file, line, direct_trace_copy_buffer(NULL) );
+
+     return mem;
+}
+
+/**********************************************************************************************************************/
+
+#else
+
+void
+direct_print_memleaks( void )
+{
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/mem.h b/Source/DirectFB/lib/direct/mem.h
new file mode 100755
index 0000000..2366e26
--- /dev/null
+++ b/Source/DirectFB/lib/direct/mem.h
@@ -0,0 +1,84 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__MEM_H__
+#define __DIRECT__MEM_H__
+
+#include <stddef.h>
+
+#include <direct/build.h>
+
+void direct_print_memleaks( void );
+
+
+void  direct_free   ( const char *file, int line,
+                      const char *func, const char *what, void *mem );
+
+void *direct_malloc ( const char *file, int line,
+                      const char *func, size_t bytes );
+
+void *direct_calloc ( const char *file, int line,
+                      const char *func, size_t count, size_t bytes);
+
+void *direct_realloc( const char *file, int line,
+                      const char *func, const char *what, void *mem,
+                      size_t bytes );
+
+char *direct_strdup ( const char *file, int line,
+                      const char *func, const char *string );
+
+
+#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
+
+#if !DIRECT_BUILD_DEBUGS
+#warning Building with debug, but library headers suggest that debug is not supported.
+#endif
+
+
+#define D_FREE(mem)           direct_free( __FILE__, __LINE__, __FUNCTION__, #mem, mem )
+#define D_MALLOC(bytes)       direct_malloc( __FILE__, __LINE__, __FUNCTION__, bytes )
+#define D_CALLOC(count,bytes) direct_calloc( __FILE__, __LINE__, __FUNCTION__, count, bytes )
+#define D_REALLOC(mem,bytes)  direct_realloc( __FILE__, __LINE__, __FUNCTION__, #mem, mem, bytes )
+#define D_STRDUP(string)      direct_strdup( __FILE__, __LINE__, __FUNCTION__, string )
+
+#else
+
+#include <stdlib.h>
+#include <string.h>
+
+#define D_FREE     free
+#define D_MALLOC   malloc
+#define D_CALLOC   calloc
+#define D_REALLOC  realloc
+#define D_STRDUP   strdup
+
+#endif
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/memcpy.c b/Source/DirectFB/lib/direct/memcpy.c
new file mode 100755
index 0000000..918853f
--- /dev/null
+++ b/Source/DirectFB/lib/direct/memcpy.c
@@ -0,0 +1,265 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Fast memcpy code was taken from xine (see below).
+
+   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 <sys/time.h>
+#include <time.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <dfb_types.h>
+
+#include <direct/conf.h>
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#if defined (ARCH_PPC) || defined (ARCH_ARM) || (SIZEOF_LONG == 8)
+# define RUN_BENCHMARK  1
+#else
+# define RUN_BENCHMARK  0
+#endif
+
+#if RUN_BENCHMARK
+D_DEBUG_DOMAIN( Direct_Memcpy, "Direct/Memcpy", "Direct's Memcpy Routines" );
+#endif
+
+#ifdef USE_PPCASM
+#include "ppcasm_memcpy.h"
+#endif
+
+#if defined(USE_ARMASM) && !defined(WORDS_BIGENDIAN)
+#include "armasm_memcpy.h"
+#endif
+
+
+#if SIZEOF_LONG == 8
+
+static void * generic64_memcpy( void * to, const void * from, size_t len )
+{
+     register u8       *d = (u8*)to;
+     register const u8 *s = (const u8*)from;
+     size_t             n;
+
+     if (len >= 128) {
+          unsigned long delta;
+
+          /* Align destination to 8-byte boundary */
+          delta = (unsigned long)d & 7;
+          if (delta) {
+               len -= 8 - delta;                 
+
+               if ((unsigned long)d & 1) {
+                    *d++ = *s++;
+               }
+               if ((unsigned long)d & 2) {
+                    *((u16*)d) = *((const u16*)s);
+                    d += 2; s += 2;
+               }
+               if ((unsigned long)d & 4) {
+                    *((u32*)d) = *((const u32*)s);
+                    d += 4; s += 4;
+               }
+          }
+          
+          n    = len >> 6;
+          len &= 63;
+          
+          for (; n; n--) {
+               ((u64*)d)[0] = ((const u64*)s)[0];
+               ((u64*)d)[1] = ((const u64*)s)[1];
+               ((u64*)d)[2] = ((const u64*)s)[2];
+               ((u64*)d)[3] = ((const u64*)s)[3];
+               ((u64*)d)[4] = ((const u64*)s)[4];
+               ((u64*)d)[5] = ((const u64*)s)[5];
+               ((u64*)d)[6] = ((const u64*)s)[6];
+               ((u64*)d)[7] = ((const u64*)s)[7];
+               d += 64; s += 64;
+          }
+     }
+     /*
+      * Now do the tail of the block
+      */
+     if (len) {
+          n = len >> 3;
+          
+          for (; n; n--) {
+               *((u64*)d) = *((const u64*)s);
+               d += 8; s += 8;
+          }
+          if (len & 4) {
+               *((u32*)d) = *((const u32*)s);
+               d += 4; s += 4;
+          }
+          if (len & 2)  {
+               *((u16*)d) = *((const u16*)s);
+               d += 2; s += 2;
+          }
+          if (len & 1)
+               *d = *s;
+     }
+     
+     return to;
+}
+
+#endif /* SIZEOF_LONG == 8 */
+
+
+typedef void* (*memcpy_func)(void *to, const void *from, size_t len);
+
+static struct {
+     char                 *name;
+     char                 *desc;
+     memcpy_func           function;
+     unsigned long long    time;
+     u32                   cpu_require;
+} memcpy_method[] =
+{
+     { NULL, NULL, NULL, 0, 0},
+     { "libc",     "libc memcpy()",             (memcpy_func) memcpy, 0, 0},
+#if SIZEOF_LONG == 8
+     { "generic64","Generic 64bit memcpy()",    generic64_memcpy, 0, 0},
+#endif /* SIZEOF_LONG == 8 */
+#ifdef USE_PPCASM
+     { "ppc",      "ppcasm_memcpy()",            direct_ppcasm_memcpy, 0, 0},
+#ifdef __LINUX__
+     { "ppccache", "ppcasm_cacheable_memcpy()",  direct_ppcasm_cacheable_memcpy, 0, 0},
+#endif /* __LINUX__ */
+#endif /* USE_PPCASM */
+#if defined(USE_ARMASM) && !defined(WORDS_BIGENDIAN)
+	 { "arm",      "armasm_memcpy()",            direct_armasm_memcpy, 0, 0},
+#endif
+     { NULL, NULL, NULL, 0, 0}
+};
+
+
+static inline unsigned long long int rdtsc( void )
+{
+     struct timeval tv;
+
+     gettimeofday (&tv, NULL);
+     return (tv.tv_sec * 1000000 + tv.tv_usec);
+}
+
+
+memcpy_func direct_memcpy = (memcpy_func) memcpy;
+
+#define BUFSIZE 1024
+
+void
+direct_find_best_memcpy( void )
+{
+     /* Save library size and startup time
+        on platforms without a special memcpy() implementation. */
+#if RUN_BENCHMARK
+     unsigned long long t;
+     char *buf1, *buf2;
+     int i, j, best = 0;
+     u32 config_flags = 0;
+
+     if (direct_config->memcpy) {
+          for (i=1; memcpy_method[i].name; i++) {
+               if (!strcmp( direct_config->memcpy, memcpy_method[i].name )) {
+                    if (memcpy_method[i].cpu_require & ~config_flags)
+                         break;
+
+                    direct_memcpy = memcpy_method[i].function;
+
+                    D_INFO( "Direct/Memcpy: Forced to use %s\n", memcpy_method[i].desc );
+
+                    return;
+               }
+          }
+     }
+
+     if (!(buf1 = D_MALLOC( BUFSIZE * 500 )))
+          return;
+
+     if (!(buf2 = D_MALLOC( BUFSIZE * 500 ))) {
+          D_FREE( buf1 );
+          return;
+     }
+
+     D_DEBUG_AT( Direct_Memcpy, "Benchmarking memcpy methods (smaller is better):\n");
+
+     /* make sure buffers are present on physical memory */
+     memcpy( buf1, buf2, BUFSIZE * 500 );
+     memcpy( buf2, buf1, BUFSIZE * 500 );
+
+     for (i=1; memcpy_method[i].name; i++) {
+          if (memcpy_method[i].cpu_require & ~config_flags)
+               continue;
+
+          t = rdtsc();
+
+          for (j=0; j<500; j++)
+               memcpy_method[i].function( buf1 + j*BUFSIZE, buf2 + j*BUFSIZE, BUFSIZE );
+
+          t = rdtsc() - t;
+          memcpy_method[i].time = t;
+
+          D_DEBUG_AT( Direct_Memcpy, "\t%-10s  %20lld\n", memcpy_method[i].name, t );
+
+          if (best == 0 || t < memcpy_method[best].time)
+               best = i;
+     }
+
+     if (best) {
+          direct_memcpy = memcpy_method[best].function;
+
+          D_INFO( "Direct/Memcpy: Using %s\n", memcpy_method[best].desc );
+     }
+
+     D_FREE( buf1 );
+     D_FREE( buf2 );
+#endif
+}
+
+void
+direct_print_memcpy_routines( void )
+{
+     int i;
+     u32 config_flags = 0;
+
+     direct_log_printf( NULL, "\nPossible values for memcpy option are:\n\n" );
+
+     for (i=1; memcpy_method[i].name; i++) {
+          bool unsupported = (memcpy_method[i].cpu_require & ~config_flags);
+
+          direct_log_printf( NULL, "  %-10s  %-27s  %s\n", memcpy_method[i].name,
+                             memcpy_method[i].desc, unsupported ? "" : "supported" );
+     }
+
+     direct_log_printf( NULL, "\n" );
+}
+
diff --git a/Source/DirectFB/lib/direct/memcpy.h b/Source/DirectFB/lib/direct/memcpy.h
new file mode 100755
index 0000000..374bc54
--- /dev/null
+++ b/Source/DirectFB/lib/direct/memcpy.h
@@ -0,0 +1,51 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__MEMCPY_H__
+#define __DIRECT__MEMCPY_H__
+
+#include <stdlib.h>
+#include <string.h>
+
+
+void direct_find_best_memcpy( void );
+void direct_print_memcpy_routines( void );
+
+extern void *(*direct_memcpy)( void *to, const void *from, size_t len );
+
+static __inline__ void *direct_memmove( void *to, const void *from, size_t len )
+{
+     if ((from < to && ((const char*) from + len) < ((char*) to)) ||
+         (((char*) to + len) < ((const char*) from)))
+          return direct_memcpy( to, from, len );
+     else
+          return memmove( to, from, len );
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/messages.c b/Source/DirectFB/lib/direct/messages.c
new file mode 100755
index 0000000..21b5978
--- /dev/null
+++ b/Source/DirectFB/lib/direct/messages.c
@@ -0,0 +1,215 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdarg.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <direct/build.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+
+#if DIRECT_BUILD_TEXT
+
+__attribute__((no_instrument_function))
+void
+direct_messages_info( const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "(*) %s", buf );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_error( const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "(!) %s", buf );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_derror( DirectResult result, const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "(!) %s    --> %s\n", buf, DirectResultString( result ) );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_perror( int erno, const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "(!) %s    --> %s\n", buf, strerror( erno ) );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_dlerror( const char *dlerr, const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "(!) %s    --> %s\n", buf, dlerr );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_once( const char *func,
+                      const char *file,
+                      int         line,
+                      const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, " (!!!)  *** ONCE [%s] *** [%s:%d in %s()]\n", buf, file, line, func );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_unimplemented( const char *func,
+                               const char *file,
+                               int         line )
+{
+     direct_log_printf( NULL, " (!!!)  *** UNIMPLEMENTED [%s] *** [%s:%d]\n", func, file, line );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_bug( const char *func,
+                     const char *file,
+                     int         line,
+                     const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, " (!?!)  *** BUG [%s] *** [%s:%d in %s()]\n", buf, file, line, func );
+
+     direct_trace_print_stack( NULL );
+}
+
+__attribute__((no_instrument_function))
+void
+direct_messages_warn( const char *func,
+                      const char *file,
+                      int         line,
+                      const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, " (!!!)  *** WARNING [%s] *** [%s:%d in %s()]\n", buf, file, line, func );
+
+     direct_trace_print_stack( NULL );
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/messages.h b/Source/DirectFB/lib/direct/messages.h
new file mode 100755
index 0000000..bafce88
--- /dev/null
+++ b/Source/DirectFB/lib/direct/messages.h
@@ -0,0 +1,173 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__MESSAGES_H__
+#define __DIRECT__MESSAGES_H__
+
+#include <direct/build.h>
+#include <direct/types.h>
+
+
+#if __GNUC__ >= 3
+#define D_FORMAT_PRINTF(n)         __attribute__((__format__ (__printf__, n, n+1)))
+#else
+#define D_FORMAT_PRINTF(n)
+#endif
+
+typedef enum {
+     DMT_NONE           = 0x00000000, /* No message type. */
+
+     DMT_BANNER         = 0x00000001, /* Startup banner. */
+     DMT_INFO           = 0x00000002, /* Info messages. */
+     DMT_WARNING        = 0x00000004, /* Warnings. */
+     DMT_ERROR          = 0x00000008, /* Error messages: regular, with DFBResult, bugs,
+                                         system call errors, dlopen errors */
+     DMT_UNIMPLEMENTED  = 0x00000010, /* Messages notifying unimplemented functionality. */
+     DMT_ONCE           = 0x00000020, /* One-shot messages .*/
+
+     DMT_ALL            = 0x0000003f  /* All types. */
+} DirectMessageType;
+
+#if DIRECT_BUILD_TEXT
+
+#include <errno.h>
+
+#include <direct/conf.h>
+
+
+void direct_messages_info         ( const char *format, ... )  D_FORMAT_PRINTF(1);
+
+void direct_messages_error        ( const char *format, ... )  D_FORMAT_PRINTF(1);
+
+void direct_messages_derror       ( DirectResult result,
+                                    const char *format, ... )  D_FORMAT_PRINTF(2);
+
+void direct_messages_perror       ( int         erno,
+                                    const char *format, ... )  D_FORMAT_PRINTF(2);
+
+void direct_messages_dlerror      ( const char *dlerr,
+                                    const char *format, ... )  D_FORMAT_PRINTF(2);
+
+void direct_messages_once         ( const char *func,
+                                    const char *file,
+                                    int         line,
+                                    const char *format, ... )  D_FORMAT_PRINTF(4);
+
+void direct_messages_unimplemented( const char *func,
+                                    const char *file,
+                                    int         line );
+
+void direct_messages_bug          ( const char *func,
+                                    const char *file,
+                                    int         line,
+                                    const char *format, ... )  D_FORMAT_PRINTF(4);
+
+void direct_messages_warn         ( const char *func,
+                                    const char *file,
+                                    int         line,
+                                    const char *format, ... )  D_FORMAT_PRINTF(4);
+
+
+#define D_INFO(x...)     do {                                                                  \
+                              if (!(direct_config->quiet & DMT_INFO))                          \
+                                   direct_messages_info( x );                                  \
+                         } while (0)
+
+#define D_ERROR(x...)    do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ERROR))                         \
+                                   direct_messages_error( x );                                 \
+                         } while (0)
+
+#define D_DERROR(r,x...) do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ERROR))                         \
+                                   direct_messages_derror( r, x );                             \
+                         } while (0)
+
+#define D_PERROR(x...)   do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ERROR))                         \
+                                   direct_messages_perror( errno, x );                         \
+                         } while (0)
+
+#define D_DLERROR(x...)  do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ERROR))                         \
+                                   direct_messages_dlerror( dlerror(), x );                    \
+                         } while (0)
+
+
+#define D_ONCE(x...)     do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ONCE)) {                        \
+                                   static bool first = true;                                   \
+                                   if (first) {                                                \
+                                        direct_messages_once( __FUNCTION__,                    \
+                                                              __FILE__, __LINE__, x );         \
+                                        first = false;                                         \
+                                   }                                                           \
+                              }                                                                \
+                         } while (0)
+
+#define D_UNIMPLEMENTED() do {                                                                 \
+                              if (!(direct_config->quiet & DMT_UNIMPLEMENTED)) {               \
+                                   static bool first = true;                                   \
+                                   if (first) {                                                \
+                                        direct_messages_unimplemented( __FUNCTION__,           \
+                                                                       __FILE__, __LINE__ );   \
+                                        first = false;                                         \
+                                   }                                                           \
+                              }                                                                \
+                         } while (0)
+
+#define D_BUG(x...)      do {                                                                  \
+                              if (!(direct_config->quiet & DMT_ERROR))                         \
+                                   direct_messages_bug( __FUNCTION__, __FILE__, __LINE__, x ); \
+                         } while (0)
+
+#define D_WARN(x...)     do {                                                                  \
+                              if (!(direct_config->quiet & DMT_WARNING))                       \
+                                   direct_messages_warn( __FUNCTION__, __FILE__, __LINE__, x );\
+                         } while (0)
+
+#define D_OOM()          (direct_messages_warn( __FUNCTION__, __FILE__, __LINE__,              \
+                                                "out of memory" ), DR_NOLOCALMEMORY)
+
+
+#else
+     #define D_INFO(x...)          do { } while (0)
+     #define D_ERROR(x...)         do { } while (0)
+     #define D_DERROR(x...)        do { } while (0)
+     #define D_PERROR(x...)        do { } while (0)
+     #define D_DLERROR(x...)       do { } while (0)
+     #define D_ONCE(x...)          do { } while (0)
+     #define D_UNIMPLEMENTED()     do { } while (0)
+     #define D_BUG(x...)           do { } while (0)
+     #define D_WARN(x...)          do { } while (0)
+     #define D_OOM()               (printf("out of memory\n"), DR_NOLOCALMEMORY)
+#endif
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/modules.c b/Source/DirectFB/lib/direct/modules.c
new file mode 100755
index 0000000..ba3d59b
--- /dev/null
+++ b/Source/DirectFB/lib/direct/modules.c
@@ -0,0 +1,463 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <sys/types.h>
+#include <alloca.h>
+#include <dirent.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <direct/conf.h>
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/modules.h>
+
+#ifdef PIC
+#define DYNAMIC_LINKING
+#endif
+
+#ifdef DYNAMIC_LINKING
+#include <dlfcn.h>
+#endif
+
+D_DEBUG_DOMAIN( Direct_Modules, "Direct/Modules", "Module loading and registration" );
+
+/******************************************************************************/
+
+#ifdef DYNAMIC_LINKING
+
+static DirectModuleEntry *lookup_by_name( const DirectModuleDir *directory,
+                                          const char            *name );
+
+static DirectModuleEntry *lookup_by_file( const DirectModuleDir *directory,
+                                          const char            *file );
+
+static void *open_module  ( DirectModuleEntry *module );
+static bool  load_module  ( DirectModuleEntry *module );
+static void  unload_module( DirectModuleEntry *module );
+
+#endif
+
+/******************************************************************************/
+
+static int
+suppress_module (const char *name)
+{
+     int i = 0;
+
+     if (!direct_config || !direct_config->disable_module)
+          return 0;
+
+     while (direct_config->disable_module[i]) {
+          if (strcmp (direct_config->disable_module[i], name) == 0) {
+               D_INFO( "Direct/Modules: suppress module '%s'\n", direct_config->disable_module[i] );
+               return 1;
+          }
+
+          i++;
+     }
+
+     return 0;
+}
+
+void
+direct_modules_register( DirectModuleDir *directory,
+                         unsigned int     abi_version,
+                         const char      *name,
+                         const void      *funcs )
+{
+     DirectModuleEntry *entry;
+
+     D_ASSERT( directory != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( funcs != NULL );
+
+     D_DEBUG_AT( Direct_Modules, "Registering '%s' ('%s')...\n", name, directory->path );
+
+#ifdef DYNAMIC_LINKING
+     if ((entry = lookup_by_name( directory, name )) != NULL) {
+          D_MAGIC_ASSERT( entry, DirectModuleEntry );
+
+          entry->loaded = true;
+          entry->funcs  = funcs;
+
+          return;
+     }
+#endif
+
+     if (directory->loading) {
+          entry = directory->loading;
+          D_MAGIC_ASSERT( entry, DirectModuleEntry );
+
+          directory->loading = NULL;
+     }
+     else {
+          entry = D_CALLOC( 1, sizeof(DirectModuleEntry) );
+          if (!entry) {
+               D_OOM();
+               return;
+          }
+
+          D_MAGIC_SET( entry, DirectModuleEntry );
+     }
+
+     entry->directory = directory;
+     entry->loaded    = true;
+     entry->name      = D_STRDUP( name );
+     entry->funcs     = funcs;
+
+     entry->disabled  = suppress_module( name );
+
+     if (abi_version != directory->abi_version) {
+          D_ERROR( "Direct/Modules: ABI version of '%s' (%d) does not match %d!\n",
+                   entry->file ? entry->file : entry->name,
+                   abi_version, directory->abi_version );
+
+          entry->disabled = true;
+     }
+
+     direct_list_prepend( &directory->entries, &entry->link );
+
+     D_DEBUG_AT( Direct_Modules, "...registered.\n" );
+}
+
+void
+direct_modules_unregister( DirectModuleDir *directory,
+                           const char      *name )
+{
+     DirectModuleEntry *entry;
+
+     D_DEBUG_AT( Direct_Modules, "Unregistering '%s' ('%s')...\n", name, directory->path );
+
+#ifdef DYNAMIC_LINKING
+     entry = lookup_by_name( directory, name );
+     if (!entry) {
+          D_ERROR( "Direct/Modules: Unregister failed, could not find '%s' module!\n", name );
+          return;
+     }
+
+     D_MAGIC_ASSERT( entry, DirectModuleEntry );
+
+     D_FREE( entry->name );
+
+     direct_list_remove( &directory->entries, &entry->link );
+
+     D_MAGIC_CLEAR( entry );
+
+     D_FREE( entry );
+#endif
+
+     D_DEBUG_AT( Direct_Modules, "...unregistered.\n" );
+}
+
+int
+direct_modules_explore_directory( DirectModuleDir *directory )
+{
+#ifdef DYNAMIC_LINKING
+     DIR           *dir;
+     struct dirent *entry = NULL;
+     struct dirent  tmp;
+     int            count = 0;
+     const char    *pathfront = "";
+     const char    *path;
+     char          *buf;
+
+     D_ASSERT( directory != NULL );
+     D_ASSERT( directory->path != NULL );
+
+     D_DEBUG_AT( Direct_Modules, "%s( '%s' )\n", __FUNCTION__, directory->path );
+
+     path = directory->path;
+
+     if (path[0] != '/') {
+          pathfront = direct_config->module_dir;
+          if (!pathfront)
+               pathfront = MODULEDIR;
+     }
+
+     buf = alloca( strlen(pathfront) + 1 + strlen(path) + 1 ); /* pre, slash, post, 0 */
+     sprintf( buf, "%s/%s", pathfront, path );
+
+     dir = opendir( buf );
+     if (!dir) {
+          D_DEBUG_AT( Direct_Modules, "  -> ERROR opening directory: %s!\n", strerror(errno) );
+          return 0;
+     }
+
+     while (readdir_r( dir, &tmp, &entry ) == 0 && entry) {
+          void              *handle;
+          DirectModuleEntry *module;
+          int                entry_len = strlen(entry->d_name);
+
+          if (entry_len < 4 ||
+              entry->d_name[entry_len-1] != 'o' ||
+              entry->d_name[entry_len-2] != 's')
+               continue;
+
+          if (lookup_by_file( directory, entry->d_name ))
+               continue;
+
+
+          module = D_CALLOC( 1, sizeof(DirectModuleEntry) );
+          if (!module)
+               continue;
+
+          D_MAGIC_SET( module, DirectModuleEntry );
+
+          module->directory = directory;
+          module->dynamic   = true;
+          module->file      = D_STRDUP( entry->d_name );
+          if (!module->file) {
+               D_MAGIC_CLEAR( module );
+               D_FREE( module );
+               continue;
+          }
+
+          directory->loading = module;
+
+          if ((handle = open_module( module )) != NULL) {
+               if (!module->loaded) {
+                    int    len;
+                    void (*func)( void );
+
+                    D_ERROR( "Direct/Modules: Module '%s' did not register itself after loading! "
+                             "Trying default module constructor...\n", entry->d_name );
+
+                    len = strlen( entry->d_name );
+
+                    entry->d_name[len-3] = 0;
+
+                    func = dlsym( handle, entry->d_name + 3 );
+                    if (func) {
+                         func();
+
+                         if (!module->loaded) {
+                              D_ERROR( "Direct/Modules: ... even did not register after "
+                                       "explicitly calling the module constructor!\n" );
+                         }
+                    }
+                    else {
+                         D_ERROR( "Direct/Modules: ... default contructor not found!\n" );
+                    }
+
+                    if (!module->loaded) {
+                         module->disabled = true;
+
+                         direct_list_prepend( &directory->entries,
+                                              &module->link );
+                    }
+               }
+
+               if (module->disabled) {
+                    module->loaded = false;
+
+                    /* may call direct_modules_unregister() */
+                    dlclose( handle );
+               }
+               else {
+                    module->handle = handle;
+
+                    count++;
+               }
+          }
+          else {
+               module->disabled = true;
+
+               direct_list_prepend( &directory->entries, &module->link );
+          }
+
+          directory->loading = NULL;
+     }
+
+     closedir( dir );
+
+     return count;
+#else
+     return 0;
+#endif
+}
+
+const void *
+direct_module_ref( DirectModuleEntry *module )
+{
+     D_MAGIC_ASSERT( module, DirectModuleEntry );
+
+     if (module->disabled)
+          return NULL;
+
+#ifdef DYNAMIC_LINKING
+     if (!module->loaded && !load_module( module ))
+          return NULL;
+#endif
+
+     module->refs++;
+
+     return module->funcs;
+}
+
+void
+direct_module_unref( DirectModuleEntry *module )
+{
+     D_MAGIC_ASSERT( module, DirectModuleEntry );
+     D_ASSERT( module->refs > 0 );
+
+     if (--module->refs)
+          return;
+
+#ifdef DYNAMIC_LINKING
+     if (module->dynamic)
+          unload_module( module );
+#endif
+}
+
+/******************************************************************************/
+
+#ifdef DYNAMIC_LINKING
+
+static DirectModuleEntry *
+lookup_by_name( const DirectModuleDir *directory,
+                const char            *name )
+{
+     DirectLink *l;
+
+     D_ASSERT( directory != NULL );
+     D_ASSERT( name != NULL );
+
+     direct_list_foreach (l, directory->entries) {
+          DirectModuleEntry *entry = (DirectModuleEntry*) l;
+
+          D_MAGIC_ASSERT( entry, DirectModuleEntry );
+
+          if (!entry->name)
+               continue;
+
+          if (!strcmp( entry->name, name ))
+               return entry;
+     }
+
+     return NULL;
+}
+
+static DirectModuleEntry *
+lookup_by_file( const DirectModuleDir *directory,
+                const char            *file )
+{
+     DirectLink *l;
+
+     D_ASSERT( directory != NULL );
+     D_ASSERT( file != NULL );
+
+     direct_list_foreach (l, directory->entries) {
+          DirectModuleEntry *entry = (DirectModuleEntry*) l;
+
+          D_MAGIC_ASSERT( entry, DirectModuleEntry );
+
+          if (!entry->file)
+               continue;
+
+          if (!strcmp( entry->file, file ))
+               return entry;
+     }
+
+     return NULL;
+}
+
+static bool
+load_module( DirectModuleEntry *module )
+{
+     D_MAGIC_ASSERT( module, DirectModuleEntry );
+     D_ASSERT( module->dynamic == true );
+     D_ASSERT( module->file != NULL );
+     D_ASSERT( module->loaded == false );
+     D_ASSERT( module->disabled == false );
+
+     module->handle = open_module( module );
+
+     return module->loaded;
+}
+
+static void
+unload_module( DirectModuleEntry *module )
+{
+     void *handle;
+
+     D_MAGIC_ASSERT( module, DirectModuleEntry );
+     D_ASSERT( module->dynamic == true );
+     D_ASSERT( module->handle != NULL );
+     D_ASSERT( module->loaded == true );
+
+     handle = module->handle;
+
+     module->handle = NULL;
+     module->loaded = false;
+
+     /* may call direct_modules_unregister() */
+     dlclose( handle );
+}
+
+static void *
+open_module( DirectModuleEntry *module )
+{
+     DirectModuleDir *directory;
+     const char      *pathfront = "";
+     const char      *path;
+     char            *buf;
+     void            *handle;
+
+     D_MAGIC_ASSERT( module, DirectModuleEntry );
+
+     D_ASSERT( module->file != NULL );
+     D_ASSERT( module->directory != NULL );
+     D_ASSERT( module->directory->path != NULL );
+
+     directory = module->directory;
+     path      = directory->path;
+
+     if (path[0] != '/') {
+          pathfront = direct_config->module_dir;
+          if (!pathfront)
+               pathfront = MODULEDIR;
+     }
+
+     buf = alloca( strlen( pathfront ) + 1 + strlen( path ) + 1 + strlen( module->file ) + 1 );
+     sprintf( buf, "%s/%s/%s", pathfront, path, module->file );
+
+     D_DEBUG_AT( Direct_Modules, "Loading '%s'...\n", buf );
+
+     handle = dlopen( buf, RTLD_NOW );
+     if (!handle)
+          D_DLERROR( "Direct/Modules: Unable to dlopen `%s'!\n", buf );
+
+     return handle;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/modules.h b/Source/DirectFB/lib/direct/modules.h
new file mode 100755
index 0000000..ba11b83
--- /dev/null
+++ b/Source/DirectFB/lib/direct/modules.h
@@ -0,0 +1,95 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__MODULES_H__
+#define __DIRECT__MODULES_H__
+
+#include <pthread.h>
+
+#include <direct/types.h>
+#include <direct/list.h>
+#include <direct/util.h>
+
+
+struct __D_DirectModuleEntry {
+     DirectLink         link;
+
+     int                magic;
+
+     DirectModuleDir   *directory;
+
+     bool               loaded;
+     bool               dynamic;
+     bool               disabled;
+
+     char              *name;
+     const void        *funcs;
+
+     int                refs;
+     char              *file;
+     void              *handle;
+};
+
+struct __D_DirectModuleDir {
+     pthread_mutex_t    lock;
+
+     const char        *path;
+     unsigned int       abi_version;
+
+     DirectLink        *entries;
+
+     DirectModuleEntry *loading;
+};
+
+#define DECLARE_MODULE_DIRECTORY(d)  \
+     extern DirectModuleDir d
+
+#define DEFINE_MODULE_DIRECTORY(d,p,n)                 \
+     DirectModuleDir d = {                             \
+          .lock        = PTHREAD_MUTEX_INITIALIZER,    \
+          .path        = p,                            \
+          .abi_version = n,                            \
+          .entries     = NULL,                         \
+          .loading     = NULL,                         \
+     }
+
+int   direct_modules_explore_directory( DirectModuleDir *directory );
+
+void  direct_modules_register( DirectModuleDir *directory,
+                               unsigned int     abi_version,
+                               const char      *name,
+                               const void      *funcs );
+
+void  direct_modules_unregister( DirectModuleDir *directory,
+                                 const char      *name );
+
+const void *direct_module_ref  ( DirectModuleEntry *module );
+void        direct_module_unref( DirectModuleEntry *module );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/ppc_asm.h b/Source/DirectFB/lib/direct/ppc_asm.h
new file mode 100755
index 0000000..c35192b
--- /dev/null
+++ b/Source/DirectFB/lib/direct/ppc_asm.h
@@ -0,0 +1,115 @@
+/* Condition Register Bit Fields */
+
+#define	cr0	0
+#define	cr1	1
+#define	cr2	2
+#define	cr3	3
+#define	cr4	4
+#define	cr5	5
+#define	cr6	6
+#define	cr7	7
+
+
+/* General Purpose Registers (GPRs) */
+
+#define	r0	0
+#define	r1	1
+#define	r2	2
+#define	r3	3
+#define	r4	4
+#define	r5	5
+#define	r6	6
+#define	r7	7
+#define	r8	8
+#define	r9	9
+#define	r10	10
+#define	r11	11
+#define	r12	12
+#define	r13	13
+#define	r14	14
+#define	r15	15
+#define	r16	16
+#define	r17	17
+#define	r18	18
+#define	r19	19
+#define	r20	20
+#define	r21	21
+#define	r22	22
+#define	r23	23
+#define	r24	24
+#define	r25	25
+#define	r26	26
+#define	r27	27
+#define	r28	28
+#define	r29	29
+#define	r30	30
+#define	r31	31
+
+
+/* Floating Point Registers (FPRs) */
+
+#define	fr0	0
+#define	fr1	1
+#define	fr2	2
+#define	fr3	3
+#define	fr4	4
+#define	fr5	5
+#define	fr6	6
+#define	fr7	7
+#define	fr8	8
+#define	fr9	9
+#define	fr10	10
+#define	fr11	11
+#define	fr12	12
+#define	fr13	13
+#define	fr14	14
+#define	fr15	15
+#define	fr16	16
+#define	fr17	17
+#define	fr18	18
+#define	fr19	19
+#define	fr20	20
+#define	fr21	21
+#define	fr22	22
+#define	fr23	23
+#define	fr24	24
+#define	fr25	25
+#define	fr26	26
+#define	fr27	27
+#define	fr28	28
+#define	fr29	29
+#define	fr30	30
+#define	fr31	31
+
+#define	vr0	0
+#define	vr1	1
+#define	vr2	2
+#define	vr3	3
+#define	vr4	4
+#define	vr5	5
+#define	vr6	6
+#define	vr7	7
+#define	vr8	8
+#define	vr9	9
+#define	vr10	10
+#define	vr11	11
+#define	vr12	12
+#define	vr13	13
+#define	vr14	14
+#define	vr15	15
+#define	vr16	16
+#define	vr17	17
+#define	vr18	18
+#define	vr19	19
+#define	vr20	20
+#define	vr21	21
+#define	vr22	22
+#define	vr23	23
+#define	vr24	24
+#define	vr25	25
+#define	vr26	26
+#define	vr27	27
+#define	vr28	28
+#define	vr29	29
+#define	vr30	30
+#define	vr31	31
diff --git a/Source/DirectFB/lib/direct/ppcasm_memcpy.S b/Source/DirectFB/lib/direct/ppcasm_memcpy.S
new file mode 100755
index 0000000..04b695b
--- /dev/null
+++ b/Source/DirectFB/lib/direct/ppcasm_memcpy.S
@@ -0,0 +1,77 @@
+/*
+ * String handling functions for PowerPC.
+ *
+ * Copyright (C) 1996 Paul Mackerras.
+ *
+ *
+ * In a mail from Paul on 23.10.2006 05:47:
+ *
+ * You may put an LGPL permission statement on that code, replacing the
+ * GPL permission statement.  From a technical point of view, I'm not
+ * sure that the code in ppcasm_memcpy_cachable.S is the best thing to
+ * use in userspace, though; for one thing, it has a cache line size
+ * assumption encoded into it.  Why don't you just use the glibc memcpy?
+ * It's pretty well optimized these days, AFAIK.
+ * 
+ * Paul.
+ *
+ *
+ * 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 "ppc_asm.h"
+
+	.globl	direct_ppcasm_memcpy
+direct_ppcasm_memcpy:
+	srwi.	r7,r5,3
+	addi	r6,r3,-4
+	addi	r4,r4,-4
+	beq	2f			/* if less than 8 bytes to do */
+	andi.	r0,r6,3			/* get dest word aligned */
+	mtctr	r7
+	bne	5f
+1:	lwz	r7,4(r4)
+	lwzu	r8,8(r4)
+	stw	r7,4(r6)
+	stwu	r8,8(r6)
+	bdnz	1b
+	andi.	r5,r5,7
+2:	cmplwi	0,r5,4
+	blt	3f
+	lwzu	r0,4(r4)
+	addi	r5,r5,-4
+	stwu	r0,4(r6)
+3:	cmpwi	0,r5,0
+	beqlr
+	mtctr	r5
+	addi	r4,r4,3
+	addi	r6,r6,3
+4:	lbzu	r0,1(r4)
+	stbu	r0,1(r6)
+	bdnz	4b
+	blr
+5:	subfic	r0,r0,4
+	mtctr	r0
+6:	lbz	r7,4(r4)
+	addi	r4,r4,1
+	stb	r7,4(r6)
+	addi	r6,r6,1
+	bdnz	6b
+	subf	r5,r0,r5
+	rlwinm.	r7,r5,32-3,3,31
+	beq	2b
+	mtctr	r7
+	b	1b
diff --git a/Source/DirectFB/lib/direct/ppcasm_memcpy.h b/Source/DirectFB/lib/direct/ppcasm_memcpy.h
new file mode 100755
index 0000000..4e7edaf
--- /dev/null
+++ b/Source/DirectFB/lib/direct/ppcasm_memcpy.h
@@ -0,0 +1,7 @@
+#ifndef __DIRECT__PPCASM_MEMCPY_H__
+#define __DIRECT__PPCASM_MEMCPY_H__
+
+void *direct_ppcasm_cacheable_memcpy( void *dest, const void *src, size_t n);
+void *direct_ppcasm_memcpy          ( void *dest, const void *src, size_t n);
+
+#endif
diff --git a/Source/DirectFB/lib/direct/ppcasm_memcpy_cachable.S b/Source/DirectFB/lib/direct/ppcasm_memcpy_cachable.S
new file mode 100755
index 0000000..920dea2
--- /dev/null
+++ b/Source/DirectFB/lib/direct/ppcasm_memcpy_cachable.S
@@ -0,0 +1,180 @@
+/*
+ * String handling functions for PowerPC.
+ *
+ * Copyright (C) 1996 Paul Mackerras.
+ *
+ *
+ * In a mail from Paul on 23.10.2006 05:47:
+ *
+ * You may put an LGPL permission statement on that code, replacing the
+ * GPL permission statement.  From a technical point of view, I'm not
+ * sure that the code in ppcasm_memcpy_cachable.S is the best thing to
+ * use in userspace, though; for one thing, it has a cache line size
+ * assumption encoded into it.  Why don't you just use the glibc memcpy?
+ * It's pretty well optimized these days, AFAIK.
+ * 
+ * Paul.
+ *
+ *
+ * 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 __ASSEMBLY__
+
+#include <linux/config.h>
+
+#if defined(CONFIG_8xx) || defined(CONFIG_403GCX)
+#define L1_CACHE_LINE_SIZE       16
+#define LG_L1_CACHE_LINE_SIZE     4 
+#elif defined(CONFIG_PPC64BRIDGE) 
+#define L1_CACHE_LINE_SIZE      128
+#define LG_L1_CACHE_LINE_SIZE     7  
+#else
+#define L1_CACHE_LINE_SIZE       32
+#define LG_L1_CACHE_LINE_SIZE     5
+#endif
+
+#include "ppc_asm.h"
+
+#define COPY_16_BYTES		\
+	lwz	r7,4(r4);	\
+	lwz	r8,8(r4);	\
+	lwz	r9,12(r4);	\
+	lwzu	r10,16(r4);	\
+	stw	r7,4(r6);	\
+	stw	r8,8(r6);	\
+	stw	r9,12(r6);	\
+	stwu	r10,16(r6)
+
+#define COPY_16_BYTES_WITHEX(n)	\
+8 ## n ## 0:			\
+	lwz	r7,4(r4);	\
+8 ## n ## 1:			\
+	lwz	r8,8(r4);	\
+8 ## n ## 2:			\
+	lwz	r9,12(r4);	\
+8 ## n ## 3:			\
+	lwzu	r10,16(r4);	\
+8 ## n ## 4:			\
+	stw	r7,4(r6);	\
+8 ## n ## 5:			\
+	stw	r8,8(r6);	\
+8 ## n ## 6:			\
+	stw	r9,12(r6);	\
+8 ## n ## 7:			\
+	stwu	r10,16(r6)
+
+#define COPY_16_BYTES_EXCODE(n)			\
+9 ## n ## 0:					\
+	addi	r5,r5,-(16 * n);		\
+	b	104f;				\
+9 ## n ## 1:					\
+	addi	r5,r5,-(16 * n);		\
+	b	105f;				\
+.section __ex_table,"a";			\
+	.align	2;				\
+	.long	8 ## n ## 0b,9 ## n ## 0b;	\
+	.long	8 ## n ## 1b,9 ## n ## 0b;	\
+	.long	8 ## n ## 2b,9 ## n ## 0b;	\
+	.long	8 ## n ## 3b,9 ## n ## 0b;	\
+	.long	8 ## n ## 4b,9 ## n ## 1b;	\
+	.long	8 ## n ## 5b,9 ## n ## 1b;	\
+	.long	8 ## n ## 6b,9 ## n ## 1b;	\
+	.long	8 ## n ## 7b,9 ## n ## 1b;	\
+	.text
+
+	.text
+
+
+CACHELINE_MASK = (L1_CACHE_LINE_SIZE - 1)
+
+	.global	direct_ppcasm_cacheable_memcpy
+direct_ppcasm_cacheable_memcpy:
+#if 0 /* this part causes "error loading shared library: unexpected reloc type
+         0x0b (???) */
+	add	r7,r3,r5		/* test if the src & dst overlap */
+	add	r8,r4,r5
+	cmplw	0,r4,r7
+	cmplw	1,r3,r8
+	crand	0,0,4			/* cr0.lt &= cr1.lt */
+	blt	ppcasm_memcpy			/* if regions overlap */
+#endif
+	addi	r4,r4,-4
+	addi	r6,r3,-4
+	neg	r0,r3
+	andi.	r0,r0,CACHELINE_MASK	/* # bytes to start of cache line */
+	beq	58f
+
+	cmplw	0,r5,r0			/* is this more than total to do? */
+	blt	63f			/* if not much to do */
+	andi.	r8,r0,3			/* get it word-aligned first */
+	subf	r5,r0,r5
+	mtctr	r8
+	beq+	61f
+70:	lbz	r9,4(r4)		/* do some bytes */
+	stb	r9,4(r6)
+	addi	r4,r4,1
+	addi	r6,r6,1
+	bdnz	70b
+61:	srwi.	r0,r0,2
+	mtctr	r0
+	beq	58f
+72:	lwzu	r9,4(r4)		/* do some words */
+	stwu	r9,4(r6)
+	bdnz	72b
+
+58:	srwi.	r0,r5,LG_L1_CACHE_LINE_SIZE /* complete cachelines */
+	clrlwi	r5,r5,32-LG_L1_CACHE_LINE_SIZE
+	li	r11,4
+	mtctr	r0
+	beq	63f
+53:
+#if !defined(CONFIG_8xx)
+	dcbz	r11,r6
+#endif
+	COPY_16_BYTES
+#if L1_CACHE_LINE_SIZE >= 32
+	COPY_16_BYTES
+#if L1_CACHE_LINE_SIZE >= 64
+	COPY_16_BYTES
+	COPY_16_BYTES
+#if L1_CACHE_LINE_SIZE >= 128
+	COPY_16_BYTES
+	COPY_16_BYTES
+	COPY_16_BYTES
+	COPY_16_BYTES
+#endif
+#endif
+#endif
+	bdnz	53b
+
+63:	srwi.	r0,r5,2
+	mtctr	r0
+	beq	64f
+30:	lwzu	r0,4(r4)
+	stwu	r0,4(r6)
+	bdnz	30b
+
+64:	andi.	r0,r5,3
+	mtctr	r0
+	beq+	65f
+40:	lbz	r0,4(r4)
+	stb	r0,4(r6)
+	addi	r4,r4,1
+	addi	r6,r6,1
+	bdnz	40b
+65:	blr
+
diff --git a/Source/DirectFB/lib/direct/serial.h b/Source/DirectFB/lib/direct/serial.h
new file mode 100755
index 0000000..d201708
--- /dev/null
+++ b/Source/DirectFB/lib/direct/serial.h
@@ -0,0 +1,118 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__SERIAL_H__
+#define __DIRECT__SERIAL_H__
+
+#include <direct/types.h>
+#include <direct/debug.h>
+
+struct __D_DirectSerial {
+     int   magic;
+
+     u32 value;
+     u32 overflow;
+};
+
+static __inline__ void
+direct_serial_init( DirectSerial *serial )
+{
+     D_ASSERT( serial != NULL );
+
+     serial->value    = 0;
+     serial->overflow = 0;
+
+     D_MAGIC_SET( serial, DirectSerial );
+}
+
+static __inline__ void
+direct_serial_deinit( DirectSerial *serial )
+{
+     D_MAGIC_CLEAR( serial );
+}
+
+static __inline__ void
+direct_serial_increase( DirectSerial *serial )
+{
+     D_MAGIC_ASSERT( serial, DirectSerial );
+
+     if (! ++serial->value)
+          serial->overflow++;
+}
+
+static __inline__ void
+direct_serial_copy( DirectSerial *serial, const DirectSerial *source )
+{
+     D_MAGIC_ASSERT( serial, DirectSerial );
+     D_MAGIC_ASSERT( source, DirectSerial );
+
+     serial->value    = source->value;
+     serial->overflow = source->overflow;
+}
+
+static __inline__ bool
+direct_serial_check( DirectSerial *serial, const DirectSerial *source )
+{
+     D_MAGIC_ASSERT( serial, DirectSerial );
+     D_MAGIC_ASSERT( source, DirectSerial );
+
+     if (serial->overflow < source->overflow)
+          return false;
+     else if (serial->overflow == source->overflow && serial->value < source->value)
+          return false;
+
+     D_ASSUME( serial->value == source->value );
+
+     return true;
+}
+
+static __inline__ bool
+direct_serial_update( DirectSerial *serial, const DirectSerial *source )
+{
+     D_MAGIC_ASSERT( serial, DirectSerial );
+     D_MAGIC_ASSERT( source, DirectSerial );
+
+     if (serial->overflow < source->overflow) {
+          serial->overflow = source->overflow;
+          serial->value    = source->value;
+
+          return true;
+     }
+     else if (serial->overflow == source->overflow && serial->value < source->value) {
+          serial->value = source->value;
+
+          return true;
+     }
+
+     D_ASSUME( serial->value == source->value );
+
+     return false;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/signals.c b/Source/DirectFB/lib/direct/signals.c
new file mode 100755
index 0000000..5b0310a
--- /dev/null
+++ b/Source/DirectFB/lib/direct/signals.c
@@ -0,0 +1,480 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <pthread.h>
+
+#include <signal.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <direct/clock.h>
+#include <direct/conf.h>
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/system.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+D_DEBUG_DOMAIN( Direct_Signals, "Direct/Signals", "Signal handling" );
+
+
+struct __D_DirectSignalHandler {
+     DirectLink               link;
+
+     int                      magic;
+
+     int                      num;
+     DirectSignalHandlerFunc  func;
+     void                    *ctx;
+};
+
+/**************************************************************************************************/
+
+typedef struct {
+     int              signum;
+     struct sigaction old_action;
+} SigHandled;
+
+static int sigs_to_handle[] = { /*SIGALRM,*/ SIGHUP, SIGINT, /*SIGPIPE,*/ /*SIGPOLL,*/
+                                SIGTERM, /*SIGUSR1, SIGUSR2,*/ /*SIGVTALRM,*/
+                                /*SIGSTKFLT,*/ SIGABRT, SIGFPE, SIGILL, SIGQUIT,
+                                SIGSEGV, SIGTRAP, /*SIGSYS, SIGEMT,*/ SIGBUS,
+                                SIGXCPU, SIGXFSZ };
+
+#define NUM_SIGS_TO_HANDLE ((int)D_ARRAY_SIZE( sigs_to_handle ))
+
+static SigHandled sigs_handled[NUM_SIGS_TO_HANDLE];
+
+static DirectLink      *handlers = NULL;
+static pthread_mutex_t  handlers_lock;
+
+/**************************************************************************************************/
+
+static void install_handlers( void );
+static void remove_handlers( void );
+
+/**************************************************************************************************/
+
+DirectResult
+direct_signals_initialize( void )
+{
+     D_DEBUG_AT( Direct_Signals, "Initializing...\n" );
+
+     direct_util_recursive_pthread_mutex_init( &handlers_lock );
+
+     install_handlers();
+
+     return DR_OK;
+}
+
+DirectResult
+direct_signals_shutdown( void )
+{
+     D_DEBUG_AT( Direct_Signals, "Shutting down...\n" );
+
+     remove_handlers();
+
+     pthread_mutex_destroy( &handlers_lock );
+
+     return DR_OK;
+}
+
+void
+direct_signals_block_all( void )
+{
+     sigset_t signals;
+
+     D_DEBUG_AT( Direct_Signals, "Blocking all signals from now on!\n" );
+
+     sigfillset( &signals );
+
+     if (pthread_sigmask( SIG_BLOCK, &signals, NULL ))
+          D_PERROR( "Direct/Signals: Setting signal mask failed!\n" );
+}
+
+DirectResult
+direct_signal_handler_add( int                       num,
+                           DirectSignalHandlerFunc   func,
+                           void                     *ctx,
+                           DirectSignalHandler     **ret_handler )
+{
+     DirectSignalHandler *handler;
+
+     D_ASSERT( func != NULL );
+     D_ASSERT( ret_handler != NULL );
+
+     D_DEBUG_AT( Direct_Signals,
+                 "Adding handler %p for signal %d with context %p...\n", func, num, ctx );
+
+     handler = D_CALLOC( 1, sizeof(DirectSignalHandler) );
+     if (!handler) {
+          D_WARN( "out of memory" );
+          return DR_NOLOCALMEMORY;
+     }
+
+     handler->num  = num;
+     handler->func = func;
+     handler->ctx  = ctx;
+
+     D_MAGIC_SET( handler, DirectSignalHandler );
+
+     pthread_mutex_lock( &handlers_lock );
+     direct_list_append( &handlers, &handler->link );
+     pthread_mutex_unlock( &handlers_lock );
+
+     *ret_handler = handler;
+
+     return DR_OK;
+}
+
+DirectResult
+direct_signal_handler_remove( DirectSignalHandler *handler )
+{
+     D_MAGIC_ASSERT( handler, DirectSignalHandler );
+
+     D_DEBUG_AT( Direct_Signals, "Removing handler %p for signal %d with context %p...\n",
+                 handler->func, handler->num, handler->ctx );
+
+     pthread_mutex_lock( &handlers_lock );
+     direct_list_remove( &handlers, &handler->link );
+     pthread_mutex_unlock( &handlers_lock );
+
+     D_MAGIC_CLEAR( handler );
+
+     D_FREE( handler );
+
+     return DR_OK;
+}
+
+/**************************************************************************************************/
+
+static bool
+show_segv( const siginfo_t *info )
+{
+     switch (info->si_code) {
+#ifdef SEGV_MAPERR
+          case SEGV_MAPERR:
+               direct_log_printf( NULL, " (at %p, invalid address) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef SEGV_ACCERR
+          case SEGV_ACCERR:
+               direct_log_printf( NULL, " (at %p, invalid permissions) <--\n", info->si_addr );
+               return true;
+#endif
+     }
+     return false;
+}
+
+static bool
+show_bus( const siginfo_t *info )
+{
+     switch (info->si_code) {
+#ifdef BUG_ADRALN
+          case BUS_ADRALN:
+               direct_log_printf( NULL, " (at %p, invalid address alignment) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef BUS_ADRERR
+          case BUS_ADRERR:
+               direct_log_printf( NULL, " (at %p, non-existent physical address) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef BUS_OBJERR
+          case BUS_OBJERR:
+               direct_log_printf( NULL, " (at %p, object specific hardware error) <--\n", info->si_addr );
+               return true;
+#endif
+     }
+
+     return false;
+}
+
+static bool
+show_ill( const siginfo_t *info )
+{
+     switch (info->si_code) {
+#ifdef ILL_ILLOPC
+          case ILL_ILLOPC:
+               direct_log_printf( NULL, " (at %p, illegal opcode) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_ILLOPN
+          case ILL_ILLOPN:
+               direct_log_printf( NULL, " (at %p, illegal operand) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_ILLADR
+          case ILL_ILLADR:
+               direct_log_printf( NULL, " (at %p, illegal addressing mode) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_ILLTRP
+          case ILL_ILLTRP:
+               direct_log_printf( NULL, " (at %p, illegal trap) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_PRVOPC
+          case ILL_PRVOPC:
+               direct_log_printf( NULL, " (at %p, privileged opcode) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_PRVREG
+          case ILL_PRVREG:
+               direct_log_printf( NULL, " (at %p, privileged register) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_COPROC
+          case ILL_COPROC:
+               direct_log_printf( NULL, " (at %p, coprocessor error) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef ILL_BADSTK
+          case ILL_BADSTK:
+               direct_log_printf( NULL, " (at %p, internal stack error) <--\n", info->si_addr );
+               return true;
+#endif
+     }
+
+     return false;
+}
+
+static bool
+show_fpe( const siginfo_t *info )
+{
+     switch (info->si_code) {
+#ifdef FPE_INTDIV
+          case FPE_INTDIV:
+               direct_log_printf( NULL, " (at %p, integer divide by zero) <--\n", info->si_addr );
+               return true;
+#endif
+#ifdef FPE_FLTDIV
+          case FPE_FLTDIV:
+               direct_log_printf( NULL, " (at %p, floating point divide by zero) <--\n", info->si_addr );
+               return true;
+#endif
+     }
+
+     direct_log_printf( NULL, " (at %p) <--\n", info->si_addr );
+
+     return true;
+}
+
+static bool
+show_any( const siginfo_t *info )
+{
+     switch (info->si_code) {
+#ifdef SI_USER
+          case SI_USER:
+               direct_log_printf( NULL, " (sent by pid %d, uid %d) <--\n", info->si_pid, info->si_uid );
+               return true;
+#endif
+#ifdef SI_KERNEL
+          case SI_KERNEL:
+               direct_log_printf( NULL, " (sent by the kernel) <--\n" );
+               return true;
+#endif
+     }
+     return false;
+}
+
+static void
+#ifdef SA_SIGINFO
+signal_handler( int num, siginfo_t *info, void *foo )
+#else
+signal_handler( int num )
+#endif
+{
+     DirectLink *l, *n;
+     void       *addr   = NULL;
+     int         pid    = direct_gettid();
+     long long   millis = direct_clock_get_millis();
+
+     fflush(stdout);
+     fflush(stderr);
+
+     direct_log_printf( NULL, "(!) [%5d: %4lld.%03lld] --> Caught signal %d",
+                        pid, millis/1000, millis%1000, num );
+
+#ifdef SA_SIGINFO
+     if (info && info > (siginfo_t*) 0x100) {
+          bool shown = false;
+
+          if (info->si_code > 0 && info->si_code < 0x80) {
+               addr = info->si_addr;
+
+               switch (num) {
+                    case SIGSEGV:
+                         shown = show_segv( info );
+                         break;
+
+                    case SIGBUS:
+                         shown = show_bus( info );
+                         break;
+
+                    case SIGILL:
+                         shown = show_ill( info );
+                         break;
+
+                    case SIGFPE:
+                         shown = show_fpe( info );
+                         break;
+
+                    default:
+                         direct_log_printf( NULL, " <--\n" );
+                         addr  = NULL;
+                         shown = true;
+                         break;
+               }
+          }
+          else
+               shown = show_any( info );
+
+          if (!shown)
+               direct_log_printf( NULL, " (unknown origin) <--\n" );
+     }
+     else
+#endif
+          direct_log_printf( NULL, ", no siginfo available <--\n" );
+
+     direct_trace_print_stacks();
+
+     /* Loop through all handlers. */
+     pthread_mutex_lock( &handlers_lock );
+
+     direct_list_foreach_safe (l, n, handlers) {
+          DirectSignalHandler *handler = (DirectSignalHandler*) l;
+
+          if (handler->num != num && handler->num != DIRECT_SIGNAL_ANY)
+               continue;
+
+          switch (handler->func( num, addr, handler->ctx )) {
+               case DSHR_OK:
+                    break;
+
+               case DSHR_REMOVE:
+                    direct_list_remove( &handlers, &handler->link );
+                    D_MAGIC_CLEAR( handler );
+                    D_FREE( handler );
+                    break;
+
+               case DSHR_RESUME:
+                    millis = direct_clock_get_millis();
+
+                    direct_log_printf( NULL, "(!) [%5d: %4lld.%03lld]      -> cured!\n",
+                                       pid, millis / 1000, millis % 1000 );
+                    pthread_mutex_unlock( &handlers_lock );
+                    return;
+
+               default:
+                    D_BUG( "unknown result" );
+                    break;
+          }
+     }
+
+     pthread_mutex_unlock( &handlers_lock );
+
+
+//     sleep(100);
+
+
+     remove_handlers();
+
+     raise( num );
+     
+     abort();
+
+     exit( -num );
+}
+
+/**************************************************************************************************/
+
+static void
+install_handlers( void )
+{
+     int i;
+
+     for (i=0; i<NUM_SIGS_TO_HANDLE; i++) {
+          sigs_handled[i].signum = -1;
+
+          if (direct_config->sighandler && !sigismember( &direct_config->dont_catch,
+                                                         sigs_to_handle[i] ))
+          {
+               struct sigaction action;
+               int              signum = sigs_to_handle[i];
+
+#ifdef SA_SIGINFO
+               action.sa_sigaction = signal_handler;
+               action.sa_flags     = SA_SIGINFO;
+#else
+               action.sa_handler   = signal_handler;
+               action.sa_flags     = 0;
+#endif
+
+               if (signum != SIGSEGV)
+                    action.sa_flags |= SA_NODEFER;
+
+               sigemptyset( &action.sa_mask );
+
+               if (sigaction( signum, &action, &sigs_handled[i].old_action )) {
+                    D_PERROR( "Direct/Signals: "
+                              "Unable to install signal handler for signal %d!\n", signum );
+                    continue;
+               }
+
+               sigs_handled[i].signum = signum;
+          }
+     }
+}
+
+static void
+remove_handlers( void )
+{
+     int i;
+
+     for (i=0; i<NUM_SIGS_TO_HANDLE; i++) {
+          if (sigs_handled[i].signum != -1) {
+               int signum = sigs_handled[i].signum;
+
+               if (sigaction( signum, &sigs_handled[i].old_action, NULL )) {
+                    D_PERROR( "Direct/Signals: "
+                              "Unable to restore previous handler for signal %d!\n", signum );
+               }
+
+               sigs_handled[i].signum = -1;
+          }
+     }
+}
+
diff --git a/Source/DirectFB/lib/direct/signals.h b/Source/DirectFB/lib/direct/signals.h
new file mode 100755
index 0000000..8765fe1
--- /dev/null
+++ b/Source/DirectFB/lib/direct/signals.h
@@ -0,0 +1,70 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__SIGNALS_H__
+#define __DIRECT__SIGNALS_H__
+
+#include <direct/types.h>
+
+
+typedef enum {
+     DSHR_OK,
+     DSHR_REMOVE,
+     DSHR_RESUME
+} DirectSignalHandlerResult;
+
+typedef DirectSignalHandlerResult (*DirectSignalHandlerFunc)( int   num,
+                                                              void *addr,
+                                                              void *ctx );
+
+
+DirectResult direct_signals_initialize( void );
+DirectResult direct_signals_shutdown( void );
+
+/*
+ * Modifies the current thread's signal mask to block everything.
+ * Should be called by input threads once to avoid killing themselves
+ * in the signal handler by deinitializing all input drivers.
+ */
+void direct_signals_block_all( void );
+
+/*
+ * Signal number to use when registering a handler for any interrupt.
+ */
+#define DIRECT_SIGNAL_ANY     -1
+
+
+DirectResult direct_signal_handler_add   ( int                       num,
+                                           DirectSignalHandlerFunc   func,
+                                           void                     *ctx,
+                                           DirectSignalHandler     **ret_handler );
+
+DirectResult direct_signal_handler_remove( DirectSignalHandler      *handler );
+
+
+#endif
diff --git a/Source/DirectFB/lib/direct/stream.c b/Source/DirectFB/lib/direct/stream.c
new file mode 100755
index 0000000..1e531d9
--- /dev/null
+++ b/Source/DirectFB/lib/direct/stream.c
@@ -0,0 +1,2286 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <netdb.h>
+
+#include <direct/build.h>
+#include <direct/types.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/debug.h>
+#include <direct/util.h>
+
+#include <direct/stream.h>
+
+
+struct __D_DirectStream {
+     int                   magic;
+     int                   ref;
+     
+     int                   fd;
+     unsigned int          offset;
+     int                   length;
+     
+     char                 *mime;
+
+     /* cache for piped streams */
+     void                 *cache;
+     unsigned int          cache_size;
+
+#if DIRECT_BUILD_NETWORK
+     /* remote streams data */
+     struct {
+          int              sd;
+          
+          char            *host;
+          int              port;
+          struct addrinfo *addr;
+          
+          char            *user;
+          char            *pass;
+          char            *auth;
+          
+          char            *path;
+          
+          int              redirects;
+          
+          void            *data;
+          
+          bool             real_rtsp;
+          bool             real_pack;
+     } remote;
+#endif
+
+     DirectResult  (*wait)  ( DirectStream   *stream,
+                              unsigned int    length,
+                              struct timeval *tv );
+     DirectResult  (*peek)  ( DirectStream *stream,
+                              unsigned int  length,
+                              int           offset,
+                              void         *buf,
+                              unsigned int *read_out );
+     DirectResult  (*read)  ( DirectStream *stream,
+                              unsigned int  length,
+                              void         *buf, 
+                              unsigned int *read_out );
+     DirectResult  (*seek)  ( DirectStream *stream,
+                              unsigned int  offset );
+};
+
+
+static void direct_stream_close( DirectStream *stream );
+
+
+#if DIRECT_BUILD_NETWORK
+D_DEBUG_DOMAIN( Direct_Stream, "Direct/Stream", "Stream wrapper" );
+#endif
+
+/************************** Begin Network Support ***************************/
+
+#if DIRECT_BUILD_NETWORK
+
+#define NET_TIMEOUT         15
+#define HTTP_PORT           80
+#define FTP_PORT            21
+#define RTSP_PORT           554
+#define HTTP_MAX_REDIRECTS  15
+
+static DirectResult http_open( DirectStream *stream, const char *filename );
+static DirectResult ftp_open ( DirectStream *stream, const char *filename );
+static DirectResult rtsp_open( DirectStream *stream, const char *filename );
+
+
+static inline char* trim( char *s )
+{
+     char *e;
+
+#define space( c ) ((c) == ' '  || (c) == '\t' || \
+                    (c) == '\r' || (c) == '\n' || \
+                    (c) == '"'  || (c) == '\'')  
+     
+     for (; space(*s); s++);
+     
+     e = s + strlen(s) - 1;
+     for (; e > s && space(*e); *e-- = '\0');
+     
+#undef space
+
+     return s;
+}
+
+static void
+parse_url( const char *url, char **ret_host, int *ret_port, 
+           char **ret_user, char **ret_pass, char **ret_path )
+{
+     char *host = NULL;
+     int   port = 0;
+     char *user = NULL;
+     char *pass = NULL;
+     char *path;
+     char *tmp;
+     
+     tmp = strchr( url, '/' );
+     if (tmp) {
+          host = alloca( tmp - url + 1 );
+          memcpy( host, url, tmp - url );
+          host[tmp-url] = '\0';
+          path = tmp;
+     } else {
+          host = alloca( strlen( url ) + 1 );
+          memcpy( host, url, strlen( url ) + 1 );
+          path = "/";
+     }
+
+     tmp = strrchr( host, '@' );
+     if (tmp) {
+          *tmp = '\0';
+          pass = strchr( host, ':' );
+          if (pass) {
+               *pass = '\0';
+               pass++;
+          }
+          user = host;
+          host = tmp + 1;
+     }
+
+     tmp = strchr( host, ':' );
+     if (tmp) {
+          port = strtol( tmp+1, NULL, 10 );
+          *tmp = '\0';
+     }
+
+     /* IPv6 variant (host within brackets) */
+     if (*host == '[') {
+          host++;
+          tmp = strchr( host, ']' );
+          if (tmp)
+               *tmp = '\0';
+     }
+     
+     if (ret_host)
+          *ret_host = D_STRDUP( host );
+     
+     if (ret_port && port)
+          *ret_port = port;
+
+     if (ret_user && user)
+          *ret_user = D_STRDUP( user );
+
+     if (ret_pass && pass)
+          *ret_pass = D_STRDUP( pass );
+
+     if (ret_path)
+          *ret_path = D_STRDUP( path );
+}
+
+/*****************************************************************************/
+
+static int
+net_response( DirectStream *stream, char *buf, size_t size )
+{
+     fd_set         set;
+     struct timeval tv;
+     int            i;
+     
+     FD_ZERO( &set );
+     FD_SET( stream->remote.sd, &set );
+
+     for (i = 0; i < size-1; i++) {
+          tv.tv_sec  = NET_TIMEOUT;
+          tv.tv_usec = 0;
+          select( stream->remote.sd+1, &set, NULL, NULL, &tv );
+          
+          if (recv( stream->remote.sd, buf+i, 1, 0 ) != 1)
+               break;
+
+          if (buf[i] == '\n') {
+               if (i > 0 && buf[i-1] == '\r')
+                    i--;
+               break;
+          }
+     }
+
+     buf[i] = '\0';
+     
+     D_DEBUG_AT( Direct_Stream, "got [%s].\n", buf );
+     
+     return i;
+}
+
+static int
+net_command( DirectStream *stream, char *buf, size_t size )
+{
+     fd_set         s;
+     struct timeval t;
+     int            status;
+     int            version;
+     char           space;
+
+     FD_ZERO( &s );
+     FD_SET( stream->remote.sd, &s );
+
+     t.tv_sec  = NET_TIMEOUT;
+     t.tv_usec = 0;
+
+     switch (select( stream->remote.sd+1, NULL, &s, NULL, &t )) {
+          case 0:
+               D_DEBUG_AT( Direct_Stream, "Timeout!\n" );
+          case -1:
+               return -1;
+     }
+     
+     send( stream->remote.sd, buf, strlen(buf), 0 );
+     send( stream->remote.sd, "\r\n", 2, 0 );
+     
+     D_DEBUG_AT( Direct_Stream, "sent [%s].\n", buf );
+
+     while (net_response( stream, buf, size ) > 0) {
+          status = 0;
+          if (sscanf( buf, "HTTP/1.%d %3d", &version, &status ) == 2 ||
+              sscanf( buf, "RTSP/1.%d %3d", &version, &status ) == 2 ||
+              sscanf( buf, "ICY %3d", &status )                 == 1 ||
+              sscanf( buf, "%3d%[ ]", &status, &space )         == 2)
+               return status;
+     }
+     
+     return 0;
+}
+
+static DirectResult
+net_wait( DirectStream   *stream,
+          unsigned int    length,
+          struct timeval *tv )
+{
+     fd_set s;
+
+     if (stream->cache_size >= length)
+          return DR_OK;
+
+     if (stream->fd == -1)
+          return DR_EOF;
+     
+     FD_ZERO( &s );
+     FD_SET( stream->fd, &s );
+     
+     switch (select( stream->fd+1, &s, NULL, NULL, tv )) {
+          case 0:
+               if (!tv && !stream->cache_size)
+                    return DR_EOF;
+               return DR_TIMEOUT;
+          case -1:
+               return errno2result( errno );
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+net_peek( DirectStream *stream,
+          unsigned int  length,
+          int           offset,
+          void         *buf,
+          unsigned int *read_out )
+{
+     char *tmp;
+     int   size;
+
+     if (offset < 0)
+          return DR_UNSUPPORTED;
+
+     tmp = alloca( length + offset );
+     
+     size = recv( stream->fd, tmp, length+offset, MSG_PEEK );
+     switch (size) {
+          case 0:
+               return DR_EOF;
+          case -1:
+               if (errno == EAGAIN || errno == EWOULDBLOCK)
+                    return DR_BUFFEREMPTY;
+               return errno2result( errno );
+          default:
+               if (size < offset)
+                    return DR_BUFFEREMPTY;
+               size -= offset;
+               break;
+     }
+
+     direct_memcpy( buf, tmp+offset, size );
+
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}
+
+static DirectResult
+net_read( DirectStream *stream, 
+          unsigned int  length,
+          void         *buf,
+          unsigned int *read_out )
+{
+     int size;
+     
+     size = recv( stream->fd, buf, length, 0 );
+     switch (size) {
+          case 0:
+               return DR_EOF;
+          case -1:
+               if (errno == EAGAIN || errno == EWOULDBLOCK)
+                    return DR_BUFFEREMPTY;
+               return errno2result( errno );
+     }
+
+     stream->offset += size;
+     
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}
+
+static DirectResult
+net_connect( struct addrinfo *addr, int sock, int proto, int *ret_fd )
+{
+     DirectResult     ret = DR_OK;
+     int              fd  = -1;
+     struct addrinfo *tmp;
+
+     D_ASSERT( addr != NULL );
+     D_ASSERT( ret_fd != NULL );
+
+     for (tmp = addr; tmp; tmp = tmp->ai_next) {
+          int err;
+          
+          fd = socket( tmp->ai_family, sock, proto );
+          if (fd < 0) {
+               ret = errno2result( errno );
+               D_DEBUG_AT( Direct_Stream,
+                           "failed to create socket!\n\t->%s",
+                           strerror(errno) );
+               continue;
+          }
+
+          fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) | O_NONBLOCK );
+
+          D_DEBUG_AT( Direct_Stream, 
+                      "connecting to %s...\n", tmp->ai_canonname );
+
+          if (proto == IPPROTO_UDP)
+               err = bind( fd, tmp->ai_addr, tmp->ai_addrlen );
+          else
+               err = connect( fd, tmp->ai_addr, tmp->ai_addrlen );
+
+          if (err == 0 || errno == EINPROGRESS) {
+               struct timeval t = { NET_TIMEOUT, 0 };
+               fd_set         s;
+
+               /* Join multicast group? */
+               if (tmp->ai_addr->sa_family == AF_INET) {
+                    struct sockaddr_in *saddr = (struct sockaddr_in *) tmp->ai_addr;
+
+                    if (IN_MULTICAST( ntohl(saddr->sin_addr.s_addr) )) {
+                         struct ip_mreq req;
+
+                         D_DEBUG_AT( Direct_Stream, 
+                                     "joining multicast group (%u.%u.%u.%u)...\n",
+                                     (u8)tmp->ai_addr->sa_data[2], (u8)tmp->ai_addr->sa_data[3],
+                                     (u8)tmp->ai_addr->sa_data[4], (u8)tmp->ai_addr->sa_data[5] );
+
+                         req.imr_multiaddr.s_addr = saddr->sin_addr.s_addr;
+                         req.imr_interface.s_addr = 0;
+
+                         err = setsockopt( fd, SOL_IP, IP_ADD_MEMBERSHIP, &req, sizeof(req) );
+                         if (err < 0) {
+                              ret = errno2result( errno );
+                              D_PERROR( "Direct/Stream: Could not join multicast group (%u.%u.%u.%u)!\n",
+                                        (u8)tmp->ai_addr->sa_data[2], (u8)tmp->ai_addr->sa_data[3],
+                                        (u8)tmp->ai_addr->sa_data[4], (u8)tmp->ai_addr->sa_data[5] );
+                              close( fd );
+                              continue;
+                         }
+
+                         setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, saddr, sizeof(*saddr) );
+                    }
+               }
+
+               FD_ZERO( &s );
+               FD_SET( fd, &s );
+              
+               err = select( fd+1, NULL, &s, NULL, &t );
+               if (err < 1) {
+                    D_DEBUG_AT( Direct_Stream, "...connection failed.\n" );
+                    
+                    close( fd );
+                    fd = -1;
+
+                    if (err == 0) {
+                         ret = DR_TIMEOUT;
+                         continue;
+                    } else {
+                         ret = errno2result( errno );
+                         break;
+                    }
+               }
+
+               D_DEBUG_AT( Direct_Stream, "...connected.\n" );
+               
+               ret = DR_OK;
+               break;
+          }
+     }
+
+     *ret_fd = fd;
+
+     return ret;
+}
+
+static DirectResult
+net_open( DirectStream *stream, const char *filename, int proto )
+{
+     DirectResult    ret  = DR_OK;
+     int             sock = (proto == IPPROTO_TCP) ? SOCK_STREAM : SOCK_DGRAM;
+     struct addrinfo hints;
+     char            port[16];
+     
+     parse_url( filename, 
+                &stream->remote.host,
+                &stream->remote.port,
+                &stream->remote.user,
+                &stream->remote.pass,
+                &stream->remote.path );
+     
+     snprintf( port, sizeof(port), "%d", stream->remote.port );
+
+     memset( &hints, 0, sizeof(hints) );
+     hints.ai_flags    = AI_CANONNAME;
+     hints.ai_socktype = sock;
+     hints.ai_family   = PF_UNSPEC;
+     
+     if (getaddrinfo( stream->remote.host, port,
+                      &hints, &stream->remote.addr )) {
+          D_ERROR( "Direct/Stream: "
+                   "failed to resolve host '%s'!\n", stream->remote.host );
+          return DR_FAILURE;
+     }
+
+     ret = net_connect( stream->remote.addr, sock, proto, &stream->remote.sd );
+     if (ret)
+          return ret;
+
+     stream->fd     = stream->remote.sd;
+     stream->length = -1; 
+     stream->wait   = net_wait;
+     stream->peek   = net_peek;
+     stream->read   = net_read;
+
+     return ret;
+}
+
+/*****************************************************************************/
+
+static DirectResult
+http_seek( DirectStream *stream, unsigned int offset )
+{
+     DirectResult ret;
+     char         buf[1280];
+     int          status, len;
+     
+     close( stream->remote.sd );
+     stream->remote.sd = -1;
+
+     ret = net_connect( stream->remote.addr, 
+                        SOCK_STREAM, IPPROTO_TCP, &stream->remote.sd );
+     if (ret)
+          return ret;
+     
+     stream->fd = stream->remote.sd;
+ 
+     len = snprintf( buf, sizeof(buf),
+                     "GET %s HTTP/1.0\r\n"
+                     "Host: %s:%d\r\n",
+                     stream->remote.path,
+                     stream->remote.host,
+                     stream->remote.port );
+     if (stream->remote.auth) {
+          len += snprintf( buf+len, sizeof(buf)-len,
+                           "Authorization: Basic %s\r\n",
+                           stream->remote.auth );
+     }
+     snprintf( buf+len, sizeof(buf)-len,
+               "User-Agent: DirectFB/%s\r\n"
+               "Accept: */*\r\n"
+               "Range: bytes=%d-\r\n"
+               "Connection: Close\r\n",
+               DIRECTFB_VERSION, offset );
+     
+     status = net_command( stream, buf, sizeof(buf) );
+     switch (status) {
+          case 200 ... 299:
+               stream->offset = offset;
+               break;
+          default:
+               if (status)
+                    D_DEBUG_AT( Direct_Stream,
+                                "server returned status %d.\n", status );
+               return DR_FAILURE;
+     }
+
+     /* discard remaining headers */
+     while (net_response( stream, buf, sizeof(buf) ) > 0);
+
+     return DR_OK;
+}    
+
+static DirectResult
+http_open( DirectStream *stream, const char *filename )
+{
+     DirectResult ret;
+     char         buf[1280];
+     int          status, len;
+     
+     stream->remote.port = HTTP_PORT;
+
+     ret = net_open( stream, filename, IPPROTO_TCP );
+     if (ret)
+          return ret;
+
+     if (stream->remote.user) {
+          char *tmp;
+
+          if (stream->remote.pass) {
+               tmp = alloca( strlen( stream->remote.user ) +
+                             strlen( stream->remote.pass ) + 2 );
+               len = sprintf( tmp, "%s:%s",
+                              stream->remote.user, stream->remote.pass );
+          } else {
+               tmp = alloca( strlen( stream->remote.user ) + 2 );
+               len = sprintf( tmp, "%s:", stream->remote.user );
+          }
+
+          stream->remote.auth = direct_base64_encode( tmp, len );
+     }
+
+     len = snprintf( buf, sizeof(buf),
+                     "GET %s HTTP/1.0\r\n"
+                     "Host: %s:%d\r\n",
+                     stream->remote.path,
+                     stream->remote.host,
+                     stream->remote.port );
+     if (stream->remote.auth) {
+          len += snprintf( buf+len, sizeof(buf)-len,
+                           "Authorization: Basic %s\r\n",
+                           stream->remote.auth );
+     }
+     snprintf( buf+len, sizeof(buf)-len,
+               "User-Agent: DirectFB/%s\r\n"
+               "Accept: */*\r\n"
+               "Connection: Close\r\n",
+               DIRECTFB_VERSION );
+     
+     status = net_command( stream, buf, sizeof(buf) );
+
+     while (net_response( stream, buf, sizeof(buf) ) > 0) {
+          if (!strncasecmp( buf, "Accept-Ranges:", 14 )) {
+               if (strcmp( trim( buf+14 ), "none" ))
+                    stream->seek = http_seek;
+          }
+          else if (!strncasecmp( buf, "Content-Type:", 13 )) {
+               char *mime = trim( buf+13 );
+               char *tmp  = strchr( mime, ';' );
+               if (tmp)
+                    *tmp = '\0';
+               if (stream->mime)
+                    D_FREE( stream->mime );
+               stream->mime = D_STRDUP( mime );
+          }
+          else if (!strncasecmp( buf, "Content-Length:", 15 )) {
+               char *tmp = trim( buf+15 );
+               if (sscanf( tmp, "%d", &stream->length ) < 1)
+                    sscanf( tmp, "bytes=%d", &stream->length );
+          }
+          else if (!strncasecmp( buf, "Location:", 9 )) { 
+               direct_stream_close( stream );
+               stream->seek = NULL;
+               
+               if (++stream->remote.redirects > HTTP_MAX_REDIRECTS) {
+                    D_ERROR( "Direct/Stream: "
+                             "reached maximum number of redirects (%d).\n",
+                             HTTP_MAX_REDIRECTS );
+                    return DR_LIMITEXCEEDED;
+               }
+               
+               filename = trim( buf+9 );
+               if (!strncmp( filename, "http://", 7 ))
+                    return http_open( stream, filename+7 );
+               if (!strncmp( filename, "ftp://", 6 ))
+                    return ftp_open( stream, filename+6 );
+               if (!strncmp( filename, "rtsp://", 7 ))
+                    return rtsp_open( stream, filename+7 );
+               
+               return DR_UNSUPPORTED;
+          }
+     }
+
+     switch (status) {
+          case 200 ... 299:
+               break;
+          default:
+               if (status)
+                    D_DEBUG_AT( Direct_Stream,
+                                "server returned status %d.\n", status );
+               return (status == 404) ? DR_FILENOTFOUND : DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+/*****************************************************************************/
+
+static DirectResult
+ftp_open_pasv( DirectStream *stream, char *buf, size_t size )
+{
+     DirectResult ret;
+     int          i, len;
+
+     snprintf( buf, size, "PASV" );
+     if (net_command( stream, buf, size ) != 227)
+          return DR_FAILURE;
+
+     /* parse IP and port for passive mode */
+     for (i = 4; buf[i]; i++) {
+          unsigned int d[6];
+     
+          if (sscanf( &buf[i], "%u,%u,%u,%u,%u,%u",
+                      &d[0], &d[1], &d[2], &d[3], &d[4], &d[5] ) == 6)
+          {
+               struct addrinfo hints, *addr;
+                    
+               /* address */
+               len = snprintf( buf, size, 
+                               "%u.%u.%u.%u",
+                               d[0], d[1], d[2], d[3] );
+               /* port */
+               snprintf( buf+len+1, size-len-1,
+                         "%u", ((d[4] & 0xff) << 8) | (d[5] & 0xff) );
+
+               memset( &hints, 0, sizeof(hints) );
+               hints.ai_flags    = AI_CANONNAME;
+               hints.ai_socktype = SOCK_STREAM;
+               hints.ai_family   = PF_UNSPEC;
+
+               if (getaddrinfo( buf, buf+len+1, &hints, &addr )) {
+                    D_DEBUG_AT( Direct_Stream, 
+                                "failed to resolve host '%s'.\n", buf );
+                    return DR_FAILURE;
+               }
+                    
+               ret = net_connect( addr, SOCK_STREAM, IPPROTO_TCP, &stream->fd );
+               
+               freeaddrinfo( addr );
+               
+               return ret;
+          }
+     }
+
+     return DR_FAILURE;
+}
+
+static DirectResult
+ftp_seek( DirectStream *stream, unsigned int offset )
+{
+     DirectResult ret = DR_OK;
+     char         buf[512];
+    
+     if (stream->fd > 0) {
+          int status;
+          
+          close( stream->fd );
+          stream->fd = -1;
+
+          /* ignore response */
+          while (net_response( stream, buf, sizeof(buf) ) > 0) {
+               if (sscanf( buf, "%3d%[ ]", &status, buf ) == 2)
+                    break;
+          }
+     }
+
+     ret = ftp_open_pasv( stream, buf, sizeof(buf) );
+     if (ret)
+          return ret;
+     
+     snprintf( buf, sizeof(buf), "REST %d", offset );
+     if (net_command( stream, buf, sizeof(buf) ) != 350)
+          goto error;
+
+     snprintf( buf, sizeof(buf), "RETR %s", stream->remote.path );
+     switch (net_command( stream, buf, sizeof(buf) )) {
+          case 150:
+          case 125:
+               break;
+          default:
+               goto error;
+     }
+
+     stream->offset = offset;
+
+     return DR_OK;
+
+error:
+     close( stream->fd );
+     stream->fd = -1;
+     
+     return DR_FAILURE;
+}
+
+static DirectResult
+ftp_open( DirectStream *stream, const char *filename )
+{
+     DirectResult ret;
+     int          status = 0;
+     char         buf[512];
+     
+     stream->remote.port = FTP_PORT;
+
+     ret = net_open( stream, filename, IPPROTO_TCP );
+     if (ret)
+          return ret;
+
+     while (net_response( stream, buf, sizeof(buf) ) > 0) {
+          if (sscanf( buf, "%3d%[ ]", &status, buf ) == 2)
+               break;
+     }
+     if (status != 220)
+          return DR_FAILURE;
+     
+     /* login */
+     snprintf( buf, sizeof(buf), "USER %s", stream->remote.user ? : "anonymous" );
+     switch (net_command( stream, buf, sizeof(buf) )) {
+          case 230:
+          case 331:
+               break;
+          default:
+               return DR_FAILURE;
+     }
+
+     if (stream->remote.pass) {
+          snprintf( buf, sizeof(buf), "PASS %s", stream->remote.pass );
+          if (net_command( stream, buf, sizeof(buf) ) != 230)
+               return DR_FAILURE;
+     }
+     
+     /* enter binary mode */
+     snprintf( buf, sizeof(buf), "TYPE I" );
+     if (net_command( stream, buf, sizeof(buf) ) != 200)
+          return DR_FAILURE;
+
+     /* get file size */
+     snprintf( buf, sizeof(buf), "SIZE %s", stream->remote.path );
+     if (net_command( stream, buf, sizeof(buf) ) == 213)
+          stream->length = strtol( buf+4, NULL, 10 );
+
+     /* enter passive mode by default */
+     ret = ftp_open_pasv( stream, buf, sizeof(buf) );
+     if (ret)
+          return ret;
+
+     /* retrieve file */
+     snprintf( buf, sizeof(buf), "RETR %s", stream->remote.path );
+     switch (net_command( stream, buf, sizeof(buf) )) {
+          case 125:
+          case 150:
+               break;
+          default:
+               return DR_FAILURE;
+     }
+
+     stream->seek = ftp_seek;
+     
+     return DR_OK;
+}
+
+/*****************************************************************************/
+
+typedef struct {
+     s8          pt;   // payload type (-1: dymanic)
+     u8          type; // codec type
+     const char *name;
+     const char *mime;
+     u32         fcc;
+} RTPPayload;
+
+typedef struct {
+     char              *control;
+     
+     int                pt;
+     const RTPPayload  *payload;
+     
+     int                dur; // duration
+     int                abr; // avg bitrate
+     int                mbr; // max bitrate
+     int                aps; // avg packet size
+     int                mps; // max packet size
+     int                str; // start time
+     int                prl; // preroll
+     
+     char              *mime;
+     int                mime_size;
+     
+     void              *data;
+     int                data_size;
+} SDPStreamDesc;
+
+#define PAYLOAD_VIDEO 1
+#define PAYLOAD_AUDIO 2
+
+#define FCC( a, b, c, d ) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
+
+static const RTPPayload payloads[] = {
+     { 31, PAYLOAD_VIDEO, "H261",          "video/h261",   FCC('H','2','6','1') },
+     { 34, PAYLOAD_VIDEO, "H263",          "video/h263",   FCC('H','2','6','3') },
+   //{ -1, PAYLOAD_VIDEO, "H264",          "video/h264",   FCC('H','2','6','4') },
+     { 32, PAYLOAD_VIDEO, "MPV",           "video/mpeg",   FCC('M','P','E','G') },
+     { 33,             0, "MP2T",          "video/mpegts", 0 },
+     { -1, PAYLOAD_VIDEO, "MP4V-ES",       "video/mpeg4",  FCC('M','P','4','S') },
+     { 14, PAYLOAD_AUDIO, "MPA",           "audio/mpeg",   0x0055 },
+   //{ -1, PAYLOAD_AUDIO, "mpeg4-generic", "audio/aac",    0x00ff },
+};
+
+#define NUM_PAYLOADS D_ARRAY_SIZE( payloads )
+
+static DirectResult
+sdp_parse( DirectStream *stream, int length, SDPStreamDesc **ret_streams, int *ret_num )
+{
+     char          *buf, *tmp;
+     SDPStreamDesc *desc = NULL;
+     int            num  = 0;
+     fd_set         set;
+     struct timeval tv;
+     int            i;
+
+     buf = D_CALLOC( 1, length+1 );
+     if (!buf)
+          return D_OOM();
+          
+     FD_ZERO( &set );
+     FD_SET( stream->remote.sd, &set );
+     
+     for (tmp = buf; length;) {
+          int size;
+          
+          tv.tv_sec  = NET_TIMEOUT;
+          tv.tv_usec = 0;
+          select( stream->remote.sd+1, &set, NULL, NULL, &tv );
+          
+          size = recv( stream->remote.sd, tmp, length, MSG_WAITALL );
+          if (size < 1)
+               break;
+          tmp += size;
+          length -= size;
+     }
+     
+     for (tmp = buf; tmp && *tmp;) {
+          char *end;
+          
+          end = strchr( tmp, '\n' );
+          if (end) {
+               if (end > tmp && *(end-1) == '\r')
+                    *(end-1) = '\0';
+               *end = '\0';
+          }
+          
+          D_DEBUG_AT( Direct_Stream, "SDP [%s]\n", tmp );
+          
+          switch (*tmp) {
+               case 'm':
+                    /* media */
+                    if (*(tmp+1) == '=') {                   
+                         desc = D_REALLOC( desc, ++num*sizeof(SDPStreamDesc) );
+                         memset( &desc[num-1], 0, sizeof(SDPStreamDesc) );
+                         
+                         tmp += 2;
+                         if (sscanf( tmp, "audio %d RTP/AVP %d", &i, &desc[num-1].pt ) == 2 ||
+                             sscanf( tmp, "video %d RTP/AVP %d", &i, &desc[num-1].pt ) == 2) {
+                              for (i = 0; i < NUM_PAYLOADS; i++) {
+                                   if (desc[num-1].pt == payloads[i].pt) {
+                                        desc[num-1].payload = &payloads[i];
+                                        desc[num-1].mime = D_STRDUP( payloads[i].mime );
+                                        desc[num-1].mime_size = strlen( payloads[i].mime );
+                                        break;
+                                   }
+                              }
+                         }   
+                    }
+                    break;
+               case 'a':
+                    /* attribute */
+                    if (*(tmp+1) == '=' && num) {
+                         tmp += 2;
+                         if (!strncmp( tmp, "control:", 8 )) {
+                              desc[num-1].control = D_STRDUP( trim( tmp+8 ) );
+                         }
+                         else if (!strncmp( tmp, "rtpmap:", 7 )) {
+                              if (!desc[num-1].payload && desc[num-1].pt) {
+                                   char *sep;
+                                   
+                                   tmp = strchr( trim( tmp+7 ), ' ' );
+                                   if (!tmp) break;
+                                   sep = strchr( ++tmp, '/' );
+                                   if (sep) *sep = '\0';
+                                   
+                                   for (i = 0; i < NUM_PAYLOADS; i++) {
+                                        if (strcmp( tmp, payloads[i].name ))
+                                             continue;
+                                        desc[num-1].payload = &payloads[i];
+                                        desc[num-1].mime = D_STRDUP( payloads[i].mime );
+                                        desc[num-1].mime_size = strlen( payloads[i].mime );
+                                        break;
+                                   }
+                              }
+                         }                                   
+                         else if (!strncmp( tmp, "length:npt=", 11 )) {
+                              double val = atof( tmp+11 );
+                              desc[num-1].dur = val * 1000.0;
+                         }
+                         else if (!strncmp( tmp, "mimetype:string;", 16 )) {
+                              if (desc[num-1].mime)
+                                   D_FREE( desc[num-1].mime );
+                              desc[num-1].mime = D_STRDUP( trim( tmp+16 ) );
+                              desc[num-1].mime_size = strlen( desc[num-1].mime );
+                         }                               
+                         else if (!strncmp( tmp, "AvgBitRate:", 11 )) {
+                              sscanf( tmp+11, "integer;%d", &desc[num-1].abr );
+                         }
+                         else if (!strncmp( tmp, "MaxBitRate:", 11 )) {
+                              sscanf( tmp+11, "integer;%d", &desc[num-1].mbr );
+                         }
+                         else if (!strncmp( tmp, "AvgPacketSize:", 14 )) {
+                              sscanf( tmp+14, "integer;%d", &desc[num-1].aps );
+                         }
+                         else if (!strncmp( tmp, "MaxPacketSize:", 14 )) {
+                              sscanf( tmp+14, "integer;%d", &desc[num-1].mps );
+                         }
+                         else if (!strncmp( tmp, "StartTime:", 10 )) {
+                              sscanf( tmp+10, "integer;%d", &desc[num-1].str );
+                         }
+                         else if (!strncmp( tmp, "Preroll:", 8 )) {
+                              sscanf( tmp+8, "integer;%d", &desc[num-1].prl );
+                         }
+                         else if (!strncmp( tmp, "OpaqueData:buffer;", 18 )) {
+                              desc[num-1].data = 
+                                   direct_base64_decode( trim( tmp+18 ),
+                                                         &desc[num-1].data_size );
+                         }
+                    }
+                    break;
+               default:
+                    break;
+          }
+          
+          tmp = end;
+          if (tmp) tmp++;
+     }
+     
+     D_FREE( buf );                   
+     
+     *ret_streams = desc;
+     *ret_num     = num;
+
+     return desc ? DR_OK : DR_EOF;
+}
+
+static void
+sdp_free( SDPStreamDesc *streams, int num )
+{
+     int i;
+     
+     for (i = 0; i < num; i++) {
+          if (streams[i].control)
+               D_FREE( streams[i].control );
+          if (streams[i].mime)
+               D_FREE( streams[i].mime );
+          if (streams[i].data)
+               D_FREE( streams[i].data );
+     }
+     D_FREE( streams );
+}
+
+static DirectResult
+rmf_write_header( SDPStreamDesc *streams, int n_streams, void **ret_buf, unsigned int *ret_size )
+{
+     unsigned char *dst, *tmp;
+     int            abr = 0;
+     int            mbr = 0;
+     int            aps = 0;
+     int            mps = 0;
+     int            str = 0;
+     int            prl = 0;
+     int            dur = 0;
+     int            i, len;
+          
+     len = 86 + n_streams*46;
+     for (i = 0; i < n_streams; i++) {
+          abr += streams[i].abr;
+          aps += streams[i].aps;
+          if (mbr < streams[i].mbr)
+               mbr = streams[i].mbr;
+          if (mps < streams[i].mps)
+               mps = streams[i].mps;
+          if (dur < streams[i].dur)
+               dur = streams[i].dur;
+          if (streams[i].mime)
+               len += streams[i].mime_size;
+          if (streams[i].data)
+               len += streams[i].data_size;
+          else if (streams[i].payload)
+               len += 74;
+     }
+          
+     *ret_buf = dst = D_MALLOC( len );
+     if (!dst)
+          return D_OOM();
+     *ret_size = len;
+          
+     /* RMF */
+     dst[0] = '.'; dst[1] = 'R', dst[2] = 'M'; dst[3] = 'F';
+     dst[4] = dst[5] = dst[6] = 0; dst[7] = 18;              // size
+     dst[8] = dst[9] = 0;                                    // version
+     dst[10] = dst[11] = dst[12] = dst[13] = 0;              // ??
+     dst[14] = dst[15] = dst[16] = 0; dst[17] = 4+n_streams; // num streams
+     dst += 18;
+          
+     /* PROP */
+     dst[0] = 'P'; dst[1] = 'R'; dst[2] = 'O'; dst[3] = 'P';
+     dst[4] = dst[5] = dst[6] = 0; dst[7] = 50;
+     dst[8] = dst[9] = 0;
+     dst[10] = mbr>>24; dst[11] = mbr>>16; dst[12] = mbr>>8; dst[13] = mbr;
+     dst[14] = abr>>24; dst[15] = abr>>16; dst[16] = abr>>8; dst[17] = abr;
+     dst[18] = mps>>24; dst[19] = mps>>16; dst[20] = mps>>8; dst[21] = mps;
+     dst[22] = aps>>24; dst[23] = aps>>16; dst[24] = aps>>8; dst[25] = aps;
+     dst[26] = dst[27] = dst[28] = dst[29] = 0; // num packets
+     dst[30] = dur>>24; dst[31] = dur>>16; dst[32] = dur>>8; dst[33] = dur;
+     dst[34] = dst[35] = dst[36] = dst[37] = 0; // preroll
+     dst[38] = dst[39] = dst[40] = dst[41] = 0; // index offset
+     dst[42] = len>>24; dst[43] = len>>16; dst[44] = len>>8; dst[45] = len;
+     dst[46] = 0; dst[47] = n_streams;          // num streams
+     dst[48] = 0; dst[49] = 7;                  // flags
+     dst += 50;
+          
+     for (i = 0; i < n_streams; i++) {
+          len = 46 + streams[i].mime_size;
+          if (streams[i].data)
+               len += streams[i].data_size;
+          else if (streams[i].payload)
+               len += 74;
+               
+          abr = streams[i].abr;
+          mbr = streams[i].mbr;
+          aps = streams[i].aps;
+          mps = streams[i].mps;
+          str = streams[i].str;
+          prl = streams[i].prl;
+          dur = streams[i].dur;
+               
+          /* MDPR */
+          dst[0] = 'M'; dst[1] = 'D'; dst[2] = 'P'; dst[3] = 'R';
+          dst[4] = len>>24; dst[5] = len>>16; dst[6] = len>>8; dst[7] = len;
+          dst[8] = dst[9] = 0;
+          dst[10] = 0; dst[11] = i;
+          dst[12] = mbr>>24; dst[13] = mbr>>16; dst[14] = mbr>>8; dst[15] = mbr;
+          dst[16] = abr>>24; dst[17] = abr>>16; dst[18] = abr>>8; dst[19] = abr;
+          dst[20] = mps>>24; dst[21] = mps>>16; dst[22] = mps>>8; dst[23] = mps;
+          dst[24] = aps>>24; dst[25] = aps>>16; dst[26] = aps>>8; dst[27] = aps;
+          dst[28] = str>>24; dst[29] = str>>16; dst[30] = str>>8; dst[31] = str;
+          dst[32] = prl>>24; dst[33] = prl>>16; dst[34] = prl>>8; dst[35] = prl;
+          dst[36] = dur>>24; dst[37] = dur>>16; dst[38] = dur>>8; dst[39] = dur;
+          dst += 40;
+               
+          /* description */
+          *dst++ = 0;
+          /* mimetype */
+          *dst++ = streams[i].mime_size;
+          for (tmp = (unsigned char*)streams[i].mime; tmp && *tmp;)
+               *dst++ = *tmp++;
+               
+          /* codec data */
+          if (streams[i].data) {
+               len = streams[i].data_size;
+               dst[0] = len>>24; dst[1] = len>>16; dst[2] = len>>8; dst[3] = len;
+               direct_memcpy( dst+4, streams[i].data, streams[i].data_size );
+               dst += len+4;
+          }
+          else if (streams[i].payload) {
+               u32 fcc = streams[i].payload->fcc;
+               
+               dst[0] = dst[1] = dst[2] = 0; dst[3] = 74;
+               dst += 4;
+               memset( dst, 0, 74 );
+               
+               if (streams[i].payload->type == PAYLOAD_AUDIO) {
+                    dst[0] = '.'; dst[1] = 'r'; dst[2] = 'a'; dst[3] = 0xfd;
+                    dst[4] = 0; dst[5] = 5; // version
+                    dst[66] = fcc; dst[67] = fcc>>8; dst[68] = fcc>>16; dst[69] = fcc>>24;
+               }
+               else {
+                    dst[0] = dst[1] = dst[2] = 0; dst[3] = 34;
+                    dst[4] = 'V'; dst[5] = 'I'; dst[6] = 'D'; dst[7] = 'O';
+                    dst[8] = fcc; dst[9] = fcc>>8; dst[10] = fcc>>16; dst[11] = fcc>>24;
+                    dst[30] = 0x10;
+               }
+               dst += 74;
+          }
+          else {
+               dst[0] = dst[1] = dst[2] = dst[3] = 0;
+               dst += 4;
+          }
+     }
+          
+     /* DATA */
+     dst[0] = 'D'; dst[1] = 'A'; dst[2] = 'T'; dst[3] = 'A';
+     dst[4] = dst[5] = dst[6] = 0; dst[7] = 18; // size
+     dst[8] = dst[9] = 0;                       // version
+     dst[10] = dst[11] = dst[12] = dst[13] = 0; // num packets
+     dst[14] = dst[15] = dst[16] = dst[17] = 0; // next data 
+     
+     return DR_OK;
+}
+
+static int
+rmf_write_pheader( unsigned char *dst, int id, int sz, unsigned int ts )
+{
+     /* version */
+     dst[0] = dst[1] = 0;
+     /* length */
+     dst[2] = (sz+12)>>8; dst[3] = sz+12;
+     /* indentifier */
+     dst[4] = id>>8; dst[5] = id;
+     /* timestamp */
+     dst[6] = ts>>24; dst[7] = ts>>16; dst[8] = ts>>8; dst[9] = ts;
+     /* reserved */
+     dst[10] = 0;
+     /* flags */
+     dst[11] = 0;
+
+     return 12;
+}
+
+static void
+real_calc_challenge2( char response[64], char checksum[32], char *challenge )
+{
+     const unsigned char xor_table[37] = {
+          0x05, 0x18, 0x74, 0xd0, 0x0d, 0x09, 0x02, 0x53,
+          0xc0, 0x01, 0x05, 0x05, 0x67, 0x03, 0x19, 0x70,
+          0x08, 0x27, 0x66, 0x10, 0x10, 0x72, 0x08, 0x09,
+          0x63, 0x11, 0x03, 0x71, 0x08, 0x08, 0x70, 0x02,
+          0x10, 0x57, 0x05, 0x18, 0x54
+     };
+     char buf[128];
+     char md5[16];
+     int  len;
+     int  i;
+     
+     memset( response, 0, 64 );
+     memset( checksum, 0, 32 );
+     
+     buf[0] = 0xa1; buf[1] = 0xe9; buf[2] = 0x14; buf[3] = 0x9d;
+     buf[4] = 0x0e; buf[5] = 0x6b; buf[6] = 0x3b; buf[7] = 0x59;
+     memset( buf+8, 0, 120 );
+     
+     len = strlen( challenge );
+     if (len == 40) {
+          challenge[32] = '\0';
+          len = 32;
+     }
+     memcpy( buf+8, challenge, MAX(len,56) );
+     
+     for (i = 0; i < 37; i++)
+          buf[8+i] ^= xor_table[i];
+      
+     /* compute response */    
+     direct_md5_sum( md5, buf, 64 );
+     /* convert to ascii */
+     for (i = 0; i < 16; i++) {
+          char a, b;
+          a = (md5[i] >> 4) & 15;
+          b =  md5[i]       & 15;
+          response[i*2+0] = ((a < 10) ? (a + 48) : (a + 87)) & 255;
+          response[i*2+1] = ((b < 10) ? (b + 48) : (b + 87)) & 255;
+     }
+     /* tail */
+     len = strlen( response );
+     direct_snputs( &response[len], "01d0a8e3", 64-len );
+     
+     /* compute checksum */
+     for (i = 0; i < len/4; i++)
+          checksum[i] = response[i*4];
+}
+
+static DirectResult
+rtsp_session_open( DirectStream *stream )
+{
+     DirectResult   ret;
+     int            status;
+     int            cseq        = 0;
+     SDPStreamDesc *streams     = NULL;
+     int            n_streams   = 0;
+     char           session[32] = {0, };
+     char           challen[64] = {0, };
+     char           buf[1280];
+     int            i, len;
+     
+     snprintf( buf, sizeof(buf),
+               "OPTIONS rtsp://%s:%d RTSP/1.0\r\n"
+               "CSeq: %d\r\n"
+               "User-Agent: DirectFB/%s\r\n"
+               "ClientChallenge: 9e26d33f2984236010ef6253fb1887f7\r\n"
+               "PlayerStarttime: [28/03/2003:22:50:23 00:00]\r\n"
+               "CompanyID: KnKV4M4I/B2FjJ1TToLycw==\r\n"
+               "GUID: 00000000-0000-0000-0000-000000000000\r\n"
+               "RegionData: 0\r\n",
+               stream->remote.host,
+               stream->remote.port,
+               ++cseq, DIRECTFB_VERSION );
+     
+     if (net_command( stream, buf, sizeof(buf) ) != 200)
+          return DR_FAILURE;
+     
+     while (net_response( stream, buf, sizeof(buf) ) > 0) {
+          if (!strncmp( buf, "RealChallenge1:", 15 )) {
+               snprintf( challen, sizeof(challen), "%s", trim( buf+15 ) );
+               stream->remote.real_rtsp = true;
+          }
+     }
+
+     len = snprintf( buf, sizeof(buf),
+                     "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n"
+                     "CSeq: %d\r\n"
+                     "Accept: application/sdp\r\n"
+                     "Bandwidth: 10485800\r\n",
+                     stream->remote.host,
+                     stream->remote.port,
+                     stream->remote.path,
+                     ++cseq );
+     if (stream->remote.real_rtsp) {
+          snprintf( buf+len, sizeof(buf)-len,
+                    "GUID: 00000000-0000-0000-0000-000000000000\r\n"
+                    "RegionData: 0\r\n"
+                    "ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586\r\n"
+                    "SupportsMaximumASMBandwidth: 1\r\n"
+                    "Require: com.real.retain-entity-for-setup\r\n" );
+     }
+     
+     status = net_command( stream, buf, sizeof(buf) );
+     if (status != 200)
+          return (status == 404) ? DR_FILENOTFOUND : DR_FAILURE;
+     
+     len = 0;
+     while (net_response( stream, buf, sizeof(buf) ) > 0) {
+          if (!strncasecmp( buf, "ETag:", 5 )) {
+               snprintf( session, sizeof(session), "%s", trim( buf+5 ) );
+          }
+          else if (!strncasecmp( buf, "Content-Length:", 15 )) {
+               char *tmp = trim( buf+15 );
+               if (sscanf( tmp, "%d", &len ) != 1)
+                    sscanf( tmp, "bytes=%d", &len );
+          }
+     }
+     
+     if (!len) {
+          D_DEBUG_AT( Direct_Stream, "Couldn't get sdp length!\n" );
+          return DR_FAILURE;
+     }       
+         
+     ret = sdp_parse( stream, len, &streams, &n_streams );
+     if (ret)
+          return ret;
+     
+     for (i = 0; i < n_streams; i++) {
+          /* skip unhandled payload types */
+          if (!stream->remote.real_rtsp && !streams[i].payload)
+               continue;
+               
+          len = snprintf( buf, sizeof(buf),
+                         "SETUP rtsp://%s:%d%s/%s RTSP/1.0\r\n"
+                         "CSeq: %d\r\n",
+                         stream->remote.host,
+                         stream->remote.port,
+                         stream->remote.path,
+                         streams[i].control, ++cseq );
+          if (*session) {
+               if (*challen) {
+                    char response[64];
+                    char checksum[32];
+                    
+                    real_calc_challenge2( response, checksum, challen );
+                    len += snprintf( buf+len, sizeof(buf)-len,
+                                     "RealChallenge2: %s, sd=%s\r\n",
+                                     response, checksum );
+                    *challen = '\0';
+               }
+               len += snprintf( buf+len, sizeof(buf)-len,
+                                "%s: %s\r\n",
+                                i ? "Session" : "If-Match", session );
+          }
+          snprintf( buf+len, sizeof(buf)-len,
+                    "Transport: %s\r\n",
+                    stream->remote.real_rtsp
+                    ? "x-pn-tng/tcp;mode=play,rtp/avp/tcp;unicast;mode=play"
+                    : "RTP/AVP/TCP;unicast" );
+
+          if (net_command( stream, buf, sizeof(buf) ) != 200) {
+               sdp_free( streams, n_streams );
+               return DR_FAILURE;
+          }
+          
+          while (net_response( stream, buf, sizeof(buf) ) > 0) {
+               if (!strncmp( buf, "Session:", 8 ))
+                    snprintf( session, sizeof(session), "%s", trim( buf+8 ) );
+          }
+     }
+     
+     len = snprintf( buf, sizeof(buf),
+                    "PLAY rtsp://%s:%d%s RTSP/1.0\r\n"
+                    "CSeq: %d\r\n",
+                    stream->remote.host,
+                    stream->remote.port,
+                    stream->remote.path,
+                    ++cseq );
+     if (*session) {
+          len += snprintf( buf+len, sizeof(buf)-len,
+                           "Session: %s\r\n", session );
+     }
+     snprintf( buf+len, sizeof(buf)-len, 
+               "Range: npt=0-\r\n"
+               "Connection: Close\r\n" );
+     
+     if (net_command( stream, buf, sizeof(buf) ) != 200) {
+          sdp_free( streams, n_streams );
+          return DR_FAILURE;
+     }
+     
+     /* discard remaining headers */
+     while (net_response( stream, buf, sizeof(buf) ) > 0);
+     
+     /* revert to blocking mode */
+     fcntl( stream->fd, F_SETFL, 
+            fcntl( stream->fd, F_GETFL ) & ~O_NONBLOCK );
+            
+     if (!stream->remote.real_rtsp) {
+          RTPPayload *p;
+          
+          stream->remote.data = D_CALLOC( 1, (n_streams+1)*sizeof(RTPPayload) );
+          if (!stream->remote.data) {
+               sdp_free( streams, n_streams );
+               return D_OOM();
+          }
+          
+          p = (RTPPayload*) stream->remote.data;
+          for (i = 0; i < n_streams; i++) {
+               if (streams[i].payload) {
+                    *p = *(streams[i].payload);
+                    p->pt = streams[i].pt;
+                    p++;
+               }
+          }  
+     }
+     
+     stream->remote.real_pack = true;
+     if (n_streams == 1 && streams[0].mime) {
+          if (!strcmp( streams[0].mime, "audio/mpeg" ) ||
+              !strcmp( streams[0].mime, "audio/aac" )  ||
+              !strcmp( streams[0].mime, "video/mpeg" ) ||
+              !strcmp( streams[0].mime, "video/mpegts" ))
+          {
+               stream->mime = D_STRDUP( streams[0].mime );
+               stream->remote.real_pack = false;
+          }
+     }
+     if (stream->remote.real_pack) {
+          ret = rmf_write_header( streams, n_streams,
+                                 &stream->cache, &stream->cache_size );
+          if (ret) {
+               sdp_free( streams, n_streams );
+               return ret;
+          }
+          stream->mime = D_STRDUP( "application/vnd.rn-realmedia" );
+     }         
+
+     sdp_free( streams, n_streams );
+     
+     return DR_OK;
+}
+
+static DirectResult
+rvp_read_packet( DirectStream *stream )
+{
+     unsigned char  buf[9];
+     int            size;
+     int            len;
+     unsigned char  id;
+     unsigned int   ts;
+     
+     while (1) {
+          do {
+               size = recv( stream->fd, buf, 1, MSG_WAITALL );
+               if (size < 1)
+                    return DR_EOF;
+          } while (buf[0] != '$');
+     
+          size = recv( stream->fd, buf, 7, MSG_WAITALL );
+          if (size < 7)
+               return DR_EOF;
+          
+          len = (buf[0] << 16) + (buf[1] << 8) + buf[2]; 
+          id = buf[3];
+          if (id != 0x40 && id != 0x42) {
+               if (buf[5] == 0x06) // EOS
+                    return DR_EOF;
+               size = recv( stream->fd, buf, 9, MSG_WAITALL );
+               if (size < 9)
+                    return DR_EOF;
+               id = buf[5];
+               len -= 9;
+          }
+          id = (id >> 1) & 1;
+          
+          size = recv( stream->fd, buf, 6, MSG_WAITALL );
+          if (size < 6)
+               return DR_EOF;
+          ts = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+               
+          len -= 10;
+          if (len > 0) {
+               unsigned char *dst;
+               
+               size = len + 12;   
+               stream->cache = D_REALLOC( stream->cache, stream->cache_size+size );
+               if (!stream->cache)
+                    return D_OOM();
+               dst = stream->cache+stream->cache_size;
+               stream->cache_size += size;
+               
+               dst += rmf_write_pheader( dst, id, len, ts ); 
+               
+               while (len) {
+                    size = recv( stream->fd, dst, len, MSG_WAITALL );
+                    if (size < 1)
+                         return DR_EOF;
+                    dst += size;
+                    len -= size;
+               }
+               break;
+          }
+     }
+     
+     return DR_OK;
+}
+
+static DirectResult
+rtp_read_packet( DirectStream *stream )
+{
+     RTPPayload    *payloads = (RTPPayload*)stream->remote.data;
+     unsigned char  buf[12];
+     int            size;
+     int            len;
+     unsigned char  id;
+     unsigned short seq;
+     unsigned int   ts;
+     int            skip;
+     
+     while (1) {
+          RTPPayload *p;
+          
+          do {
+               size = recv( stream->fd, buf, 1, MSG_WAITALL );
+               if (size < 1)
+                    return DR_EOF;
+          } while (buf[0] != '$');
+     
+          size = recv( stream->fd, buf, 3, MSG_WAITALL );
+          if (size < 3)
+               return DR_EOF;
+          
+          id = buf[0];
+          len = (buf[1] << 8) | buf[2];
+          if (len < 12)
+               continue;
+     
+          size = recv( stream->fd, buf, 12, MSG_WAITALL );
+          if (size < 12)
+               return DR_EOF;
+          len -= 12;
+
+          if ((buf[0] & 0xc0) != (2 << 6))
+               D_DEBUG_AT( Direct_Stream, "Bad RTP version %d!\n", buf[0] );
+          seq = (buf[2] <<  8) |  buf[3];
+          ts  = (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
+          
+          for (p = payloads; p->pt; p++) {
+               if (p->pt == (buf[1] & 0x7f))
+                    break;
+          }
+          
+          switch (p->pt) {
+               case  0: // Unhandled
+                    skip = len;
+                    break;
+               case 14: // MPEG Audio
+                    skip = 4;
+                    break;
+               case 32: // MPEG Video
+                    size = recv( stream->fd, buf, 1, MSG_WAITALL );
+                    if (size < 1)
+                         return DR_EOF;
+                    len--;
+                    skip = 3;
+                    if (buf[0] & (1 << 2))
+                         skip += 4;
+                    break;
+               case 34: // H263
+                    size = recv( stream->fd, buf, 1, MSG_WAITALL );
+                    if (size < 1)
+                         return DR_EOF;
+                    len--;
+                    skip = 3;
+                    if (buf[0] & (1 << 7))
+                         skip += 4;
+                    if (buf[0] & (1 << 6))
+                         skip += 4;
+                    break;                   
+               default:
+                    skip = 0;
+                    break;
+          }
+          
+          while (skip) {
+               size = recv( stream->fd, buf, MIN(skip,12), MSG_WAITALL );
+               if (size < 1)
+                    return DR_EOF;
+               len -= size;
+               skip -= size;
+          }
+          
+          if (len > 0) {
+               unsigned char *dst;
+               
+               size = len;
+               if (stream->remote.real_pack) {
+                    size += 12;
+                    if (p->type == PAYLOAD_VIDEO)
+                         size += 7;
+               }
+                  
+               stream->cache = D_REALLOC( stream->cache, stream->cache_size+size );
+               if (!stream->cache)
+                    return D_OOM();
+               dst = stream->cache+stream->cache_size;
+               stream->cache_size += size;
+               
+               if (stream->remote.real_pack) {                              
+                    if (p->type == PAYLOAD_VIDEO) {
+                         dst += rmf_write_pheader( dst, id, len+7, ts );
+                         dst[0] = 0x81;
+                         dst[1] = 0x01;
+                         dst[2] = (len | 0x4000)>>8; dst[3] = len;
+                         dst[4] = (len | 0x4000)>>8; dst[5] = len;
+                         dst[6] = seq;
+                         dst += 7;
+                    } else {
+                         dst += rmf_write_pheader( dst, id, len, ts );
+                    }
+               }
+               
+               while (len) {
+                    size = recv( stream->fd, dst, len, MSG_WAITALL );
+                    if (size < 1)
+                         return DR_EOF;
+                    dst += size;
+                    len -= size;
+               }
+               break;
+          }
+     }
+     
+     return DR_OK;
+}
+
+static DirectResult
+rtsp_peek( DirectStream *stream,
+           unsigned int  length,
+           int           offset,
+           void         *buf,
+           unsigned int *read_out )
+{
+     DirectResult ret;
+     unsigned int len;
+
+     if (offset < 0)
+          return DR_UNSUPPORTED;
+
+     len = length + offset;
+     while (len > stream->cache_size) {
+          ret = (stream->remote.real_rtsp) 
+                ? rvp_read_packet( stream ) 
+                : rtp_read_packet( stream );
+          if (ret) {
+               if (stream->cache_size < offset)
+                    return ret;
+               break;
+          }
+     }
+
+     len = MIN( stream->cache_size-offset, length );
+     direct_memcpy( buf, stream->cache+offset, len );
+
+     if (read_out)
+          *read_out = len;
+
+     return DR_OK;
+}
+
+static DirectResult
+rtsp_read( DirectStream *stream,
+           unsigned int  length,
+           void         *buf,
+           unsigned int *read_out )
+{
+     DirectResult ret;
+     unsigned int size = 0;
+
+     while (size < length) {
+          if (stream->cache_size) {
+               unsigned int len = MIN( stream->cache_size, length-size );
+          
+               direct_memcpy( buf+size, stream->cache, len );
+               size += len;
+               stream->cache_size -= len;
+          
+               if (stream->cache_size) {
+                    direct_memcpy( stream->cache, 
+                                   stream->cache+len, stream->cache_size );
+               } else {
+                    D_FREE( stream->cache );
+                    stream->cache = NULL;
+               }
+          }
+          
+          if (size < length) {
+               ret = (stream->remote.real_rtsp) 
+                     ? rvp_read_packet( stream ) 
+                     : rtp_read_packet( stream );
+               if (ret) {
+                    if (!size)
+                         return ret;
+                    break;
+               }
+          }          
+     }
+
+     stream->offset += size;
+
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}           
+ 
+static DirectResult 
+rtsp_open( DirectStream *stream, const char *filename )
+{
+     DirectResult ret;
+     
+     stream->remote.port = RTSP_PORT;
+
+     ret = net_open( stream, filename, IPPROTO_TCP );
+     if (ret)
+          return ret;
+          
+     ret = rtsp_session_open( stream );
+     if (ret) {
+          close( stream->remote.sd );
+          return ret;
+     }
+       
+     stream->peek = rtsp_peek;
+     stream->read = rtsp_read;
+     
+     return DR_OK;
+}
+
+#endif /* DIRECT_BUILD_NETWORK */   
+
+/************************** End of Network Support ***************************/
+
+static DirectResult
+pipe_wait( DirectStream   *stream,
+           unsigned int    length,
+           struct timeval *tv )
+{
+     fd_set s;
+
+     if (stream->cache_size >= length)
+          return DR_OK;
+     
+     FD_ZERO( &s );
+     FD_SET( stream->fd, &s );
+     
+     switch (select( stream->fd+1, &s, NULL, NULL, tv )) {
+          case 0:
+               if (!tv && !stream->cache_size)
+                    return DR_EOF;
+               return DR_TIMEOUT;
+          case -1:
+               return errno2result( errno );
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+pipe_peek( DirectStream *stream,
+           unsigned int  length,
+           int           offset,
+           void         *buf,
+           unsigned int *read_out )
+{
+     unsigned int size = length;
+     int          len;
+
+     if (offset < 0)
+          return DR_UNSUPPORTED;
+
+     len = length + offset;
+     if (len > stream->cache_size) {
+          ssize_t s;
+          
+          stream->cache = D_REALLOC( stream->cache, len );
+          if (!stream->cache) {
+               stream->cache_size = 0;
+               return D_OOM();
+          }
+
+          s = read( stream->fd, 
+                    stream->cache + stream->cache_size,
+                    len - stream->cache_size );
+          if (s < 0) {
+               if (errno != EAGAIN || stream->cache_size == 0)
+                    return errno2result( errno );
+               s = 0;
+          }
+          
+          stream->cache_size += s;
+          if (stream->cache_size <= offset)
+               return DR_BUFFEREMPTY;
+          
+          size = stream->cache_size - offset;
+     }
+
+     direct_memcpy( buf, stream->cache+offset, size );
+
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}
+
+static DirectResult
+pipe_read( DirectStream *stream,
+           unsigned int  length,
+           void         *buf,
+           unsigned int *read_out )
+{
+     unsigned int size = 0;
+
+     if (stream->cache_size) {
+          size = MIN( stream->cache_size, length );
+          
+          direct_memcpy( buf, stream->cache, size );
+     
+          length -= size;
+          stream->cache_size -= size; 
+          
+          if (stream->cache_size) {
+               direct_memcpy( stream->cache, 
+                              stream->cache+size, stream->cache_size );
+          } else {
+               D_FREE( stream->cache );
+               stream->cache = NULL;
+          }
+     }
+
+     if (length) {
+          ssize_t s;
+          
+          s = read( stream->fd, buf+size, length-size );
+          switch (s) {
+               case 0:
+                    if (!size)
+                         return DR_EOF;
+                    break;
+               case -1:
+                    if (!size) {
+                         return (errno == EAGAIN)
+                                ? DR_BUFFEREMPTY
+                                : errno2result( errno );
+                    }
+                    break;
+               default:
+                    size += s;
+                    break;
+          }
+     }
+
+     stream->offset += size;
+
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}
+ 
+/*****************************************************************************/
+
+static DirectResult
+file_peek( DirectStream *stream,
+           unsigned int  length,
+           int           offset,
+           void         *buf,
+           unsigned int *read_out )
+{
+     DirectResult ret = DR_OK;
+     ssize_t      size;
+     
+     if (lseek( stream->fd, offset, SEEK_CUR ) < 0)
+          return DR_FAILURE;
+
+     size = read( stream->fd, buf, length );
+     switch (size) {
+          case 0:
+               ret = DR_EOF;
+               break;
+          case -1:
+               ret = (errno == EAGAIN)
+                     ? DR_BUFFEREMPTY
+                     : errno2result( errno );
+               size = 0;
+               break;
+     }
+
+     if (lseek( stream->fd, - offset - size, SEEK_CUR ) < 0)
+          return DR_FAILURE;
+     
+     if (read_out)
+          *read_out = size;
+
+     return ret;
+}
+
+static DirectResult
+file_read( DirectStream *stream,
+           unsigned int  length,
+           void         *buf,
+           unsigned int *read_out )
+{
+     ssize_t size;
+
+     size = read( stream->fd, buf, length );
+     switch (size) {
+          case 0:
+               return DR_EOF;
+          case -1:
+               if (errno == EAGAIN)
+                    return DR_BUFFEREMPTY;
+               return errno2result( errno );
+     }
+
+     stream->offset += size;
+     
+     if (read_out)
+          *read_out = size;
+
+     return DR_OK;
+}
+
+static DirectResult
+file_seek( DirectStream *stream, unsigned int offset )
+{
+     off_t off;
+
+     off = lseek( stream->fd, offset, SEEK_SET );
+     if (off < 0)
+          return DR_FAILURE;
+
+     stream->offset = off;
+
+     return DR_OK;
+}
+
+static DirectResult
+file_open( DirectStream *stream, const char *filename, int fileno )
+{
+     if (filename)
+          stream->fd = open( filename, O_RDONLY | O_NONBLOCK );
+     else
+          stream->fd = dup( fileno );
+     
+     if (stream->fd < 0)
+          return errno2result( errno );
+    
+     fcntl( stream->fd, F_SETFL, 
+               fcntl( stream->fd, F_GETFL ) | O_NONBLOCK );
+
+     if (lseek( stream->fd, 0, SEEK_CUR ) < 0 && errno == ESPIPE) {
+          stream->length = -1;
+          stream->wait   = pipe_wait;
+          stream->peek   = pipe_peek;
+          stream->read   = pipe_read;
+     }
+     else {
+          struct stat s;
+
+          if (fstat( stream->fd, &s ) < 0)
+               return errno2result( errno );
+      
+          stream->length = s.st_size;
+          stream->peek   = file_peek;
+          stream->read   = file_read;
+          stream->seek   = file_seek;
+     }
+     
+     return DR_OK;
+}
+
+/*****************************************************************************/
+
+DirectResult
+direct_stream_create( const char    *filename,
+                      DirectStream **ret_stream )
+{
+     DirectStream *stream;
+     DirectResult  ret;
+
+     D_ASSERT( filename != NULL );
+     D_ASSERT( ret_stream != NULL );
+     
+     stream = D_CALLOC( 1, sizeof(DirectStream) );
+     if (!stream)
+          return D_OOM();
+
+     D_MAGIC_SET( stream, DirectStream );
+     
+     stream->ref =  1;
+     stream->fd  = -1;
+
+     if (!strncmp( filename, "stdin:/", 7 )) {
+          ret = file_open( stream, NULL, STDIN_FILENO );
+     }
+     else if (!strncmp( filename, "file:/", 6 )) {
+          ret = file_open( stream, filename+6, -1 );
+     }
+     else if (!strncmp( filename, "fd:/", 4 )) {
+          ret = (filename[4] >= '0' && filename[4] <= '9')
+                ? file_open( stream, NULL, atoi(filename+4) ) : DR_INVARG;
+     }
+#if DIRECT_BUILD_NETWORK
+     else if (!strncmp( filename, "http://", 7 ) ||
+              !strncmp( filename, "unsv://", 7 )) {
+          ret = http_open( stream, filename+7 );
+     }
+     else if (!strncmp( filename, "ftp://", 6 )) {
+          ret = ftp_open( stream, filename+6 );
+     }
+     else if (!strncmp( filename, "rtsp://", 7 )) {
+          ret = rtsp_open( stream, filename+7 );
+     }
+     else if (!strncmp( filename, "tcp://", 6 )) {
+          ret = net_open( stream, filename+6, IPPROTO_TCP );
+     }
+     else if (!strncmp( filename, "udp://", 6 )) {
+          ret = net_open( stream, filename+6, IPPROTO_UDP );
+     }
+#endif
+     else {
+          ret = file_open( stream, filename, -1 );
+     }
+
+     if (ret) {
+          direct_stream_close( stream );
+          D_FREE( stream );
+          return ret;
+     }
+
+     *ret_stream = stream;
+
+     return DR_OK;
+}
+
+DirectStream*
+direct_stream_dup( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+     stream->ref++;
+     
+     return stream;
+}
+
+int
+direct_stream_fileno( DirectStream  *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+     return stream->fd;
+}
+
+bool
+direct_stream_seekable( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+     
+     D_MAGIC_ASSERT( stream, DirectStream );
+
+     return stream->seek ? true : false;
+}
+
+bool
+direct_stream_remote( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+#if DIRECT_BUILD_NETWORK
+     if (stream->remote.host)
+          return true;
+#endif
+     return false;
+}
+
+const char*
+direct_stream_mime( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+     
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+     return stream->mime;
+}
+
+unsigned int 
+direct_stream_offset( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+     return stream->offset;
+}
+
+unsigned int
+direct_stream_length( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+
+     return (stream->length >= 0) ? stream->length : stream->offset;
+}
+
+DirectResult
+direct_stream_wait( DirectStream   *stream,
+                    unsigned int    length,
+                    struct timeval *tv )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+ 
+     if (length && stream->wait)
+          return stream->wait( stream, length, tv );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_stream_peek( DirectStream *stream,
+                    unsigned int  length,
+                    int           offset,
+                    void         *buf,
+                    unsigned int *read_out )
+{
+     D_ASSERT( stream != NULL );
+     D_ASSERT( length != 0 );
+     D_ASSERT( buf != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+     
+     if (stream->length >= 0 && (stream->offset + offset) >= stream->length)
+          return DR_EOF;
+
+     if (stream->peek)
+          return stream->peek( stream, length, offset, buf, read_out );
+
+     return DR_UNSUPPORTED;
+}
+
+DirectResult
+direct_stream_read( DirectStream *stream,
+                    unsigned int  length,
+                    void         *buf,
+                    unsigned int *read_out )
+{
+     D_ASSERT( stream != NULL ); 
+     D_ASSERT( length != 0 );
+     D_ASSERT( buf != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+
+     if (stream->length >= 0 && stream->offset >= stream->length)
+          return DR_EOF;
+
+     if (stream->read)
+          return stream->read( stream, length, buf, read_out );
+
+     return DR_UNSUPPORTED;
+}
+
+DirectResult
+direct_stream_seek( DirectStream *stream,
+                    unsigned int  offset )
+{
+     D_ASSERT( stream != NULL );
+     
+     D_MAGIC_ASSERT( stream, DirectStream );
+
+     if (stream->offset == offset)
+          return DR_OK;
+     
+     if (stream->length >= 0 && offset > stream->length)
+          offset = stream->length;
+     
+     if (stream->seek)
+          return stream->seek( stream, offset );
+
+     return DR_UNSUPPORTED;
+}
+
+static void
+direct_stream_close( DirectStream *stream )
+{
+#if DIRECT_BUILD_NETWORK
+     if (stream->remote.host) {
+          D_FREE( stream->remote.host );
+          stream->remote.host = NULL;
+     }
+
+     if (stream->remote.user) {
+          D_FREE( stream->remote.user );
+          stream->remote.user = NULL;
+     }
+
+     if (stream->remote.pass) {
+          D_FREE( stream->remote.pass );
+          stream->remote.pass = NULL;
+     }
+
+     if (stream->remote.auth) {
+          D_FREE( stream->remote.auth );
+          stream->remote.auth = NULL;
+     }
+
+     if (stream->remote.path) {
+          D_FREE( stream->remote.path );
+          stream->remote.path = NULL;
+     }
+     
+     if (stream->remote.addr) {
+          freeaddrinfo( stream->remote.addr );
+          stream->remote.addr = NULL;
+     }
+     
+     if (stream->remote.data) {
+          D_FREE( stream->remote.data );
+          stream->remote.data = NULL;
+     }
+
+     if (stream->remote.sd > 0) {
+          close( stream->remote.sd ); 
+          stream->remote.sd = -1;
+     }
+#endif
+     
+     if (stream->mime) {
+          D_FREE( stream->mime );
+          stream->mime = NULL;
+     }
+     
+     if (stream->cache) {
+          D_FREE( stream->cache );
+          stream->cache = NULL;
+          stream->cache_size = 0;
+     }
+
+     if (stream->fd >= 0) {
+          fcntl( stream->fd, F_SETFL, 
+                    fcntl( stream->fd, F_GETFL ) & ~O_NONBLOCK );
+          close( stream->fd );
+          stream->fd = -1;
+     }
+}
+
+void
+direct_stream_destroy( DirectStream *stream )
+{
+     D_ASSERT( stream != NULL );
+
+     D_MAGIC_ASSERT( stream, DirectStream );
+
+     if (--stream->ref == 0) {
+          direct_stream_close( stream );
+
+          D_FREE( stream );
+     }
+}
diff --git a/Source/DirectFB/lib/direct/stream.h b/Source/DirectFB/lib/direct/stream.h
new file mode 100755
index 0000000..6b77690
--- /dev/null
+++ b/Source/DirectFB/lib/direct/stream.h
@@ -0,0 +1,129 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__STREAM_H__
+#define __DIRECT__STREAM_H__
+
+#include <stdio.h>
+#include <sys/time.h>
+
+#include <direct/types.h>
+
+/*
+ * Create a stream wrapper.
+ * 
+ * 'filename' can be a plain file name or one of the following:
+ *   http://<host>[:<port>]/<path>
+ *   unsv://<host>[:<port>]/<path>
+ *   ftp://<host>[:<port>]/<path>
+ *   rtsp://<host>[:<port>]/<path>
+ *   tcp://<host>:<port>
+ *   udp://<host>:<port>
+ *   file:/<path>
+ *   fd:/<fileno>
+ *   stdin:/
+ */
+DirectResult  direct_stream_create  ( const char     *filename,
+                                      DirectStream  **ret_stream );
+                                      
+/*
+ * Duplicate the stream (never fails).
+ */
+DirectStream *direct_stream_dup     ( DirectStream   *stream );     
+
+/*
+ * Return the file descriptor associated to the stream.
+ */
+int           direct_stream_fileno  ( DirectStream   *stream );
+
+/*
+ * True if stream is seekable.
+ */
+bool          direct_stream_seekable( DirectStream   *stream );
+
+/*
+ * True if stream originates from a remote host.
+ */
+bool          direct_stream_remote  ( DirectStream   *stream );
+
+/*
+ * Get the mime description of the stream.
+ * Returns NULL if the information is not available.
+ */
+const char*   direct_stream_mime    ( DirectStream   *stream );
+
+/*
+ * Get stream length.
+ */
+unsigned int  direct_stream_length  ( DirectStream   *stream );
+
+/*
+ * Get stream position.
+ */
+unsigned int  direct_stream_offset  ( DirectStream   *stream );
+
+/*
+ * Wait for data to be available.
+ * If 'timeout' is NULL, the function blocks indefinitely.
+ * Set the 'timeout' to 0 to make the function return immediatly.
+ */
+DirectResult  direct_stream_wait    ( DirectStream   *stream,
+                                      unsigned int    length,
+                                      struct timeval *timeout );
+
+/*
+ * Peek 'length' bytes of data at offset 'offset' from the stream.
+ */
+DirectResult  direct_stream_peek    ( DirectStream   *stream,
+                                      unsigned int    length,
+                                      int             offset,
+                                      void           *buf,
+                                      unsigned int   *read_out );
+
+/*
+ * Fetch 'length' bytes of data from the stream.
+ */
+DirectResult  direct_stream_read    ( DirectStream   *stream,
+                                      unsigned int    length,
+                                      void           *buf,
+                                      unsigned int   *read_out );
+
+/*
+ * Seek to the specified absolute offset within the stream.
+ */
+DirectResult  direct_stream_seek    ( DirectStream   *stream,
+                                      unsigned int    offset );
+
+/*
+ * Destroy the stream wrapper.
+ */
+void          direct_stream_destroy ( DirectStream   *stream );
+
+
+#endif /* __DIRECT__STREAM_H__ */
+
diff --git a/Source/DirectFB/lib/direct/system.c b/Source/DirectFB/lib/direct/system.c
new file mode 100755
index 0000000..b4b5b29
--- /dev/null
+++ b/Source/DirectFB/lib/direct/system.c
@@ -0,0 +1,68 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <errno.h>
+#include <unistd.h>
+
+#include <direct/build.h>
+#include <direct/system.h>
+
+#if DIRECT_BUILD_GETTID && defined(HAVE_LINUX_UNISTD_H)
+#include <linux/unistd.h>
+#endif
+
+__attribute__((no_instrument_function))
+pid_t
+direct_gettid( void )
+{
+     pid_t tid = -1;
+#if DIRECT_BUILD_GETTID && defined(__NR_gettid) /* present on linux >= 2.4.20 */
+     tid = syscall(__NR_gettid);
+#endif
+     if (tid < 0)
+          tid = getpid();
+
+     return tid;
+}
+
+long
+direct_pagesize( void )
+{
+     return sysconf( _SC_PAGESIZE );
+}
+
+unsigned long
+direct_page_align( unsigned long value )
+{
+     unsigned long mask = sysconf( _SC_PAGESIZE ) - 1;
+
+     return (value + mask) & ~mask;
+}
+
diff --git a/Source/DirectFB/lib/direct/system.h b/Source/DirectFB/lib/direct/system.h
new file mode 100755
index 0000000..5cfe74e
--- /dev/null
+++ b/Source/DirectFB/lib/direct/system.h
@@ -0,0 +1,40 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__SYSTEM_H__
+#define __DIRECT__SYSTEM_H__
+
+#include <sys/types.h>
+
+pid_t direct_gettid( void );
+long  direct_pagesize( void );
+
+unsigned long direct_page_align( unsigned long value );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/thread.c b/Source/DirectFB/lib/direct/thread.c
new file mode 100755
index 0000000..91c66fc
--- /dev/null
+++ b/Source/DirectFB/lib/direct/thread.c
@@ -0,0 +1,795 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <pthread.h>
+#include <signal.h>
+#include <sched.h>
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/system.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+D_DEBUG_DOMAIN( Direct_Thread,     "Direct/Thread",      "Thread management" );
+D_DEBUG_DOMAIN( Direct_ThreadInit, "Direct/Thread/Init", "Thread initialization" );
+
+
+/* FIXME: DIRECT_THREAD_WAIT_INIT is required, but should be optional. */
+#define DIRECT_THREAD_WAIT_INIT
+
+
+struct __D_DirectThread {
+     int                   magic;
+
+     pthread_t             thread;      /* The pthread thread identifier. */
+     pid_t                 tid;
+
+     char                 *name;
+
+     DirectThreadType      type;        /* The thread's type, e.g. input thread. */
+     DirectThreadMainFunc  main;        /* The thread's main routine (or entry point). */
+     void                 *arg;         /* Custom argument passed to the main routine. */
+
+     bool                  canceled;    /* Set when direct_thread_cancel() is called. */
+     bool                  joining;     /* Set when direct_thread_join() is called. */
+     bool                  joined;      /* Set when direct_thread_join() has finished. */
+     bool                  detached;    /* Set when direct_thread_detach() is called. */
+     bool                  terminated;  /* Set when direct_thread_terminate() is called. */
+
+#ifdef DIRECT_THREAD_WAIT_INIT
+     bool                  init;        /* Set to true before calling the main routine. */
+#endif
+
+     pthread_mutex_t       lock;
+     pthread_cond_t        cond;
+
+     unsigned int          counter;
+};
+
+struct __D_DirectThreadInitHandler {
+     DirectLink            link;
+
+     int                   magic;
+
+     DirectThreadInitFunc  func;
+     void                 *arg;
+};
+
+/******************************************************************************/
+
+/*
+ * Wrapper around pthread's main routine to pass additional arguments
+ * and setup things like signal masks and scheduling priorities.
+ */
+static void *direct_thread_main( void *arg );
+
+/******************************************************************************/
+
+static pthread_mutex_t  handler_lock = PTHREAD_MUTEX_INITIALIZER;
+static DirectLink      *handlers     = NULL;
+
+/******************************************************************************/
+
+DirectThreadInitHandler *
+direct_thread_add_init_handler( DirectThreadInitFunc  func,
+                                void                 *arg )
+{
+     DirectThreadInitHandler *handler;
+
+     handler = D_CALLOC( 1, sizeof(DirectThreadInitHandler) );
+     if (!handler) {
+          D_WARN( "out of memory" );
+          return NULL;
+     }
+
+     handler->func = func;
+     handler->arg  = arg;
+
+     D_MAGIC_SET( handler, DirectThreadInitHandler );
+
+     pthread_mutex_lock( &handler_lock );
+
+     direct_list_append( &handlers, &handler->link );
+
+     pthread_mutex_unlock( &handler_lock );
+
+     return handler;
+}
+
+void
+direct_thread_remove_init_handler( DirectThreadInitHandler *handler )
+{
+     D_MAGIC_ASSERT( handler, DirectThreadInitHandler );
+
+     pthread_mutex_lock( &handler_lock );
+
+     direct_list_remove( &handlers, &handler->link );
+
+     pthread_mutex_unlock( &handler_lock );
+
+     D_MAGIC_CLEAR( handler );
+
+     D_FREE( handler );
+}
+
+/******************************************************************************/
+
+static pthread_mutex_t key_lock   = PTHREAD_MUTEX_INITIALIZER;
+static pthread_key_t   thread_key = -1;
+
+/******************************************************************************/
+
+DirectThread *
+direct_thread_create( DirectThreadType      thread_type,
+                      DirectThreadMainFunc  thread_main,
+                      void                 *arg,
+                      const char           *name )
+{
+     DirectThread       *thread;
+     pthread_attr_t      attr;
+     struct sched_param  param;
+     int                 policy;
+     int                 priority;
+     size_t              stack_size;
+
+     D_ASSERT( thread_main != NULL );
+     D_ASSERT( name != NULL );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %s, %p(%p), '%s' )\n", __FUNCTION__,
+                 direct_thread_type_name(thread_type), thread_main, arg, name );
+
+     /* Create the key for the TSD (thread specific data). */
+     pthread_mutex_lock( &key_lock );
+
+     if (thread_key == -1)
+          pthread_key_create( &thread_key, NULL );
+
+     pthread_mutex_unlock( &key_lock );
+
+     /* Allocate thread structure. */
+     thread = D_CALLOC( 1, sizeof(DirectThread) );
+     if (!thread) {
+          D_OOM();
+          return NULL;
+     }
+
+     /* Write thread information to structure. */
+     thread->name = D_STRDUP( name );
+     thread->type = thread_type;
+     thread->main = thread_main;
+     thread->arg  = arg;
+
+     /* Initialize to -1 for synchronization. */
+     thread->thread = (pthread_t) -1;
+     thread->tid    = (pid_t) -1;
+
+     /* Initialize mutex and condition. */
+     direct_util_recursive_pthread_mutex_init( &thread->lock );
+     pthread_cond_init( &thread->cond, NULL );
+
+     D_MAGIC_SET( thread, DirectThread );
+
+     /* Initialize scheduling and other parameters. */
+     pthread_attr_init( &attr );
+
+#ifdef PTHREAD_EXPLICIT_SCHED
+     pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+#endif
+
+     /* Select scheduler. */
+     switch (direct_config->thread_scheduler) {
+          case DCTS_FIFO:
+               policy = SCHED_FIFO;
+               break;
+
+          case DCTS_RR:
+               policy = SCHED_RR;
+               break;
+
+          default:
+               policy = SCHED_OTHER;
+               break;
+     }
+
+     if (pthread_attr_setschedpolicy( &attr, policy ))
+          D_PERROR( "Direct/Thread: Could not set scheduling policy to %s!\n", direct_thread_policy_name(policy) );
+
+     /* Read (back) value. */
+     pthread_attr_getschedpolicy( &attr, &policy );
+
+     /* Select priority. */
+     switch (thread->type) {
+          case DTT_CLEANUP:
+          case DTT_INPUT:
+          case DTT_OUTPUT:
+          case DTT_MESSAGING:
+          case DTT_CRITICAL:
+               priority = thread->type * direct_config->thread_priority_scale / 100;
+               break;
+
+          default:
+               priority = direct_config->thread_priority;
+               break;
+     }
+
+     D_DEBUG_AT( Direct_ThreadInit, "  -> %s (%d) [%d;%d]\n", direct_thread_policy_name(policy), priority,
+                 sched_get_priority_min( policy ), sched_get_priority_max( policy ) );
+
+     if (priority < sched_get_priority_min( policy ))
+          priority = sched_get_priority_min( policy );
+
+     if (priority > sched_get_priority_max( policy ))
+          priority = sched_get_priority_max( policy );
+
+     param.sched_priority = priority;
+
+     if (pthread_attr_setschedparam( &attr, ¶m ))
+          D_PERROR( "Direct/Thread: Could not set scheduling priority to %d!\n", priority );
+
+     /* Select stack size? */
+     if (direct_config->thread_stack_size > 0) {
+          if (pthread_attr_setstacksize( &attr, direct_config->thread_stack_size ))
+               D_PERROR( "Direct/Thread: Could not set stack size to %d!\n", direct_config->thread_stack_size );
+     }
+
+     /* Read (back) value. */
+     pthread_attr_getstacksize( &attr, &stack_size );
+
+     /* Lock the thread mutex. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> locking...\n" );
+     pthread_mutex_lock( &thread->lock );
+
+     /* Create and run the thread. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> creating...\n" );
+     pthread_create( &thread->thread, &attr, direct_thread_main, thread );
+
+     pthread_attr_destroy( &attr );
+
+     pthread_getschedparam( thread->thread, &policy, ¶m );
+
+     D_INFO( "Direct/Thread: Started '%s' (%d) [%s %s/%s %d/%d] <%zu>...\n",
+             name, thread->tid, direct_thread_type_name(thread_type),
+             direct_thread_policy_name(policy), direct_thread_scheduler_name(direct_config->thread_scheduler),
+             param.sched_priority, priority, stack_size );
+
+#ifdef DIRECT_THREAD_WAIT_INIT
+     /* Wait for completion of the thread's initialization. */
+     while (!thread->init) {
+          D_DEBUG_AT( Direct_ThreadInit, "  -> waiting...\n" );
+          pthread_cond_wait( &thread->cond, &thread->lock );
+     }
+
+     D_DEBUG_AT( Direct_ThreadInit, "  -> ...thread is running.\n" );
+#endif
+
+     /* Unlock the thread mutex. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> unlocking...\n" );
+     pthread_mutex_unlock( &thread->lock );
+
+     D_DEBUG_AT( Direct_ThreadInit, "  -> returning %p\n", thread );
+
+     return thread;
+}
+
+DirectThread *
+direct_thread_self( void )
+{
+     DirectThread *thread = pthread_getspecific( thread_key );
+
+     if (thread)
+          D_MAGIC_ASSERT( thread, DirectThread );
+
+     return thread;
+}
+
+const char *
+direct_thread_get_name( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->name != NULL );
+
+     return thread->name;
+}
+
+pid_t
+direct_thread_get_tid( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     return thread->tid;
+}
+
+__attribute__((no_instrument_function))
+const char *
+direct_thread_self_name( void )
+{
+     DirectThread *thread = pthread_getspecific( thread_key );
+
+     /*
+      * This function is called by debugging functions, e.g. debug messages, assertions etc.
+      * Therefore no assertions are made here, because they would loop forever if they fail.
+      */
+
+#ifndef MACOS
+     return thread ? thread->name : NULL;
+#else
+     return "debug";
+#endif
+}
+
+void
+direct_thread_set_name( const char *name )
+{
+     char         *copy;
+     DirectThread *thread = pthread_getspecific( thread_key );
+
+     D_DEBUG_AT( Direct_Thread, "%s( '%s' )\n", __FUNCTION__, name );
+
+     /* Support this function for non-direct threads. */
+     if (!thread) {
+          D_DEBUG_AT( Direct_Thread, "  -> attaching unknown thread %d\n", direct_gettid() );
+
+          /* Create the key for the TSD (thread specific data). */
+          pthread_mutex_lock( &key_lock );
+
+          if (thread_key == -1)
+               pthread_key_create( &thread_key, NULL );
+
+          pthread_mutex_unlock( &key_lock );
+
+
+          thread = D_CALLOC( 1, sizeof(DirectThread) );
+          if (!thread) {
+               D_OOM();
+               return;
+          }
+
+          thread->thread = pthread_self();
+          thread->tid    = direct_gettid();
+
+          D_MAGIC_SET( thread, DirectThread );
+
+          pthread_setspecific( thread_key, thread );
+     }
+     else
+          D_DEBUG_AT( Direct_Thread, "  -> was '%s' (%d)\n", thread->name, direct_gettid() );
+
+     /* Duplicate string. */
+     copy = D_STRDUP( name );
+     if (!copy) {
+          D_OOM();
+          return;
+     }
+
+     /* Free old string. */
+     if (thread->name)
+          D_FREE( thread->name );
+
+     /* Keep the copy. */
+     thread->name = copy;
+}
+
+DirectResult
+direct_thread_wait( DirectThread *thread, int timeout_ms )
+{
+     unsigned int old_counter = thread->counter;
+
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d, %dms )\n", __FUNCTION__,
+                 thread->main, thread->name, thread->tid, timeout_ms );
+
+     while (old_counter == thread->counter && !thread->terminated)
+          pthread_cond_wait( &thread->cond, &thread->lock );
+
+     if (thread->terminated)
+          return DR_DEAD;
+
+     return DR_OK;
+}
+
+void
+direct_thread_notify( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     pthread_mutex_lock( &thread->lock );
+
+     thread->counter++;
+
+     pthread_mutex_unlock( &thread->lock );
+
+     pthread_cond_broadcast( &thread->cond );
+}
+
+void
+direct_thread_lock( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     pthread_mutex_lock( &thread->lock );
+}
+
+void
+direct_thread_unlock( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     pthread_mutex_unlock( &thread->lock );
+}
+
+void
+direct_thread_terminate( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+     D_ASSUME( !pthread_equal( thread->thread, pthread_self() ) );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     thread->terminated = true;
+
+     direct_thread_notify( thread );
+}
+
+void
+direct_thread_cancel( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+     D_ASSERT( !pthread_equal( thread->thread, pthread_self() ) );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     thread->canceled = true;
+
+#if DIRECT_BUILD_NO_PTHREAD_CANCEL
+     D_UNIMPLEMENTED();
+#else
+     pthread_cancel( thread->thread );
+#endif
+}
+
+bool
+direct_thread_is_canceled( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     return thread->canceled;
+}
+
+void
+direct_thread_detach( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+     D_ASSERT( !pthread_equal( thread->thread, pthread_self() ) );
+
+     D_ASSUME( !thread->canceled );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     thread->detached = true;
+
+     pthread_detach( thread->thread );
+}
+
+bool
+direct_thread_is_detached( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     return thread->detached;
+}
+
+void
+direct_thread_testcancel( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+     D_ASSERT( pthread_equal( thread->thread, pthread_self() ) );
+
+#if DIRECT_BUILD_NO_PTHREAD_CANCEL
+     D_UNIMPLEMENTED();
+#else
+     /* Quick check before calling the pthread function. */
+     if (thread->canceled)
+          pthread_testcancel();
+#endif
+}
+
+void
+direct_thread_join( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSERT( thread->thread != -1 );
+
+     D_ASSUME( !pthread_equal( thread->thread, pthread_self() ) );
+     D_ASSUME( !thread->joining );
+     D_ASSUME( !thread->joined );
+     D_ASSUME( !thread->detached );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     if (thread->detached) {
+          D_DEBUG_AT( Direct_Thread, "  -> DETACHED!\n" );
+          return;
+     }
+
+     if (!thread->joining && !pthread_equal( thread->thread, pthread_self() )) {
+          thread->joining = true;
+
+          D_DEBUG_AT( Direct_Thread, "  -> joining...\n" );
+
+          pthread_join( thread->thread, NULL );
+
+          thread->joined = true;
+
+          D_DEBUG_AT( Direct_Thread, "  -> joined.\n" );
+     }
+}
+
+bool
+direct_thread_is_joined( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     return thread->joined;
+}
+
+void
+direct_thread_destroy( DirectThread *thread )
+{
+     D_MAGIC_ASSERT( thread, DirectThread );
+     D_ASSUME( !pthread_equal( thread->thread, pthread_self() ) );
+     D_ASSUME( !thread->detached );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     if (thread->detached) {
+          D_DEBUG_AT( Direct_Thread, "  -> DETACHED!\n" );
+          return;
+     }
+
+     if (!thread->joined && !pthread_equal( thread->thread, pthread_self() )) {
+          if (thread->canceled)
+               D_DEBUG_AT( Direct_Thread, "  -> cancled but not joined!\n" );
+          else {
+               D_DEBUG_AT( Direct_Thread, "  -> still running!\n" );
+
+               if (thread->name)
+                    D_ERROR( "Direct/Thread: Canceling '%s' (%d)!\n", thread->name, thread->tid );
+               else
+                    D_ERROR( "Direct/Thread: Canceling %d!\n", thread->tid );
+
+               thread->detached = true;
+
+               pthread_detach( thread->thread );
+
+               direct_thread_cancel( thread );
+
+               return;
+          }
+     }
+
+     D_MAGIC_CLEAR( thread );
+
+     D_FREE( thread->name );
+     D_FREE( thread );
+}
+
+/******************************************************************************/
+
+#if DIRECT_BUILD_TEXT
+const char *
+direct_thread_type_name( DirectThreadType type )
+{
+     switch (type) {
+          case DTT_DEFAULT:
+               return "DEFAULT";
+
+          case DTT_CLEANUP:
+               return "CLEANUP";
+
+          case DTT_INPUT:
+               return "INPUT";
+
+          case DTT_OUTPUT:
+               return "OUTPUT";
+
+          case DTT_MESSAGING:
+               return "MESSAGING";
+
+          case DTT_CRITICAL:
+               return "CRITICAL";
+     }
+
+     return "<unknown>";
+}
+
+const char *
+direct_thread_scheduler_name( DirectConfigThreadScheduler scheduler )
+{
+     switch (scheduler) {
+          case DCTS_OTHER:
+               return "OTHER";
+
+          case DCTS_FIFO:
+               return "FIFO";
+
+          case DCTS_RR:
+               return "RR";
+     }
+
+     return "<unknown>";
+}
+
+const char *
+direct_thread_policy_name( int policy )
+{
+     switch (policy) {
+          case SCHED_OTHER:
+               return "OTHER";
+
+          case SCHED_FIFO:
+               return "FIFO";
+
+          case SCHED_RR:
+               return "RR";
+     }
+
+     return "<unknown>";
+}
+#endif
+
+/******************************************************************************/
+
+static void
+direct_thread_cleanup( void *arg )
+{
+     DirectThread *thread = arg;
+
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
+
+     if (thread->detached) {
+          D_MAGIC_CLEAR( thread );
+
+          D_FREE( thread->name );
+          D_FREE( thread );
+     }
+}
+
+/******************************************************************************/
+
+static void *
+direct_thread_main( void *arg )
+{
+     void                    *ret;
+     DirectThread            *thread = arg;
+     DirectThreadInitHandler *handler;
+     pid_t                    tid;
+
+     tid = direct_gettid();
+
+     D_DEBUG_AT( Direct_ThreadInit, "%s( %p ) <- tid %d\n", __FUNCTION__, arg, tid );
+
+     D_DEBUG_AT( Direct_ThreadInit, "  -> starting...\n" );
+
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     pthread_cleanup_push( direct_thread_cleanup, thread );
+
+
+     pthread_setspecific( thread_key, thread );
+
+     thread->tid = tid;
+
+
+     /* Call all init handlers. */
+     pthread_mutex_lock( &handler_lock );
+
+     direct_list_foreach (handler, handlers)
+          handler->func( thread, handler->arg );
+
+     pthread_mutex_unlock( &handler_lock );
+
+
+     /* Have all signals handled by the main thread. */
+     if (direct_config->thread_block_signals)
+          direct_signals_block_all();
+
+     /* Lock the thread mutex. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> locking...\n" );
+     pthread_mutex_lock( &thread->lock );
+
+     /* Indicate that our initialization has completed. */
+     thread->init = true;
+
+#ifdef DIRECT_THREAD_WAIT_INIT
+     D_DEBUG_AT( Direct_ThreadInit, "  -> signalling...\n" );
+     pthread_cond_signal( &thread->cond );
+#endif
+
+     /* Unlock the thread mutex. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> unlocking...\n" );
+     pthread_mutex_unlock( &thread->lock );
+
+     if (thread->joining) {
+          D_DEBUG_AT( Direct_Thread, "  -> Being joined before entering main routine!\n" );
+          return NULL;
+     }
+
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     /* Call main routine. */
+     D_DEBUG_AT( Direct_ThreadInit, "  -> running...\n" );
+     ret = thread->main( thread, thread->arg );
+
+     D_DEBUG_AT( Direct_Thread, "  -> Returning %p from '%s' (%s, %d)...\n",
+                 ret, thread->name, direct_thread_type_name(thread->type), thread->tid );
+
+     D_MAGIC_ASSERT( thread, DirectThread );
+
+     pthread_cleanup_pop( 1 );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/lib/direct/thread.h b/Source/DirectFB/lib/direct/thread.h
new file mode 100755
index 0000000..18205c4
--- /dev/null
+++ b/Source/DirectFB/lib/direct/thread.h
@@ -0,0 +1,168 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__THREAD_H__
+#define __DIRECT__THREAD_H__
+
+#include <sys/types.h>
+
+#include <direct/types.h>
+#include <direct/conf.h>
+
+typedef enum {
+     DTT_DEFAULT    =   0,
+     DTT_CLEANUP    =  -5,
+     DTT_INPUT      = -10,
+     DTT_OUTPUT     = -12,
+     DTT_MESSAGING  = -15,
+     DTT_CRITICAL   = -20
+} DirectThreadType;
+
+typedef void * (*DirectThreadMainFunc)( DirectThread *thread, void *arg );
+
+typedef void   (*DirectThreadInitFunc)( DirectThread *thread, void *arg );
+
+
+/*
+ * Add a handler being called at the beginning of new threads.
+ */
+DirectThreadInitHandler *direct_thread_add_init_handler   ( DirectThreadInitFunc     func,
+                                                            void                    *arg );
+
+/*
+ * Remove the specified handler.
+ */
+void                     direct_thread_remove_init_handler( DirectThreadInitHandler *handler );
+
+/*
+ * Create a new thread and start it.
+ * The thread type is relevant for the scheduling priority.
+ */
+DirectThread *direct_thread_create     ( DirectThreadType      thread_type,
+                                         DirectThreadMainFunc  thread_main,
+                                         void                 *arg,
+                                         const char           *name );
+
+/*
+ * Returns the thread of the caller.
+ */
+DirectThread *direct_thread_self       ( void );
+
+/*
+ * Returns the name of the specified thread.
+ */
+const char   *direct_thread_get_name   ( DirectThread *thread );
+
+/*
+ * Returns the thread ID of the specified thread.
+ */
+pid_t         direct_thread_get_tid    ( DirectThread *thread );
+
+/*
+ * Returns the name of the calling thread.
+ */
+const char   *direct_thread_self_name  ( void );
+
+/*
+ * Changes the name of the calling thread.
+ */
+void          direct_thread_set_name   ( const char   *name );
+
+/*
+ * Wait on the thread object to be notified via direct_thread_notify().
+ */
+DirectResult  direct_thread_wait       ( DirectThread *thread,
+                                         int           timeout_ms );
+
+/*
+ * Notify the thread object waking up callers of direct_thread_wait().
+ */
+void direct_thread_notify     ( DirectThread *thread );
+
+void direct_thread_lock       ( DirectThread *thread );
+void direct_thread_unlock     ( DirectThread *thread );
+
+/*
+ * Kindly ask the thread to terminate (for joining without thread cancellation).
+ */
+void direct_thread_terminate  ( DirectThread *thread );
+
+/*
+ * Cancel a running thread.
+ */
+void direct_thread_cancel     ( DirectThread *thread );
+
+/*
+ * Returns true if the specified thread has been canceled.
+ */
+bool direct_thread_is_canceled( DirectThread *thread );
+
+/*
+ * Detach a thread.
+ */
+void direct_thread_detach     ( DirectThread *thread );
+
+/*
+ * Returns true if the specified thread has been detached.
+ */
+bool direct_thread_is_detached( DirectThread *thread );
+
+/*
+ * Check if the calling thread is canceled.
+ * Must not be called by other threads than 'thread'.
+ * This function won't return if the thread is canceled.
+ */
+void direct_thread_testcancel ( DirectThread *thread );
+
+/*
+ * Wait until a running thread is terminated.
+ */
+void direct_thread_join       ( DirectThread *thread );
+
+/*
+ * Returns true if the specified thread has been join.
+ */
+bool direct_thread_is_joined  ( DirectThread *thread );
+
+/*
+ * Free resources allocated by direct_thread_create.
+ * If the thread is still running it will be killed.
+ */
+void direct_thread_destroy    ( DirectThread *thread );
+
+/*
+ * Utilities for stringification.
+ */
+#if DIRECT_BUILD_TEXT
+const char *direct_thread_type_name     ( DirectThreadType type );
+const char *direct_thread_scheduler_name( DirectConfigThreadScheduler scheduler );
+const char *direct_thread_policy_name   ( int policy );
+#endif
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/trace.c b/Source/DirectFB/lib/direct/trace.c
new file mode 100755
index 0000000..d895333
--- /dev/null
+++ b/Source/DirectFB/lib/direct/trace.c
@@ -0,0 +1,676 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <pthread.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include <direct/build.h>
+#include <direct/list.h>
+#include <direct/log.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/system.h>
+#include <direct/thread.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+
+#ifdef PIC
+#define DYNAMIC_LINKING
+#endif
+
+
+#if DIRECT_BUILD_TRACE
+
+#ifdef DYNAMIC_LINKING
+#include <dlfcn.h>
+#endif
+
+#define MAX_BUFFERS 200
+#define MAX_LEVEL   200
+
+#define NAME_LEN    92
+
+
+typedef enum {
+     TF_NONE   = 0x00000000,
+
+     TF_DEBUG  = 0x00000001
+} TraceFlags;
+
+typedef struct {
+     void       *addr;
+     TraceFlags  flags;
+} Trace;
+
+struct __D_DirectTraceBuffer {
+     pid_t tid;
+     char *name;
+     int   level;
+     bool  in_trace;
+     Trace trace[MAX_LEVEL];
+};
+
+/**************************************************************************************************/
+
+static DirectTraceBuffer *buffers[MAX_BUFFERS];
+static int                buffers_num  = 0;
+static pthread_mutex_t    buffers_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_key_t      trace_key    = -1;
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+static void
+buffer_destroy( void *arg )
+{
+     int                i;
+     DirectTraceBuffer *buffer = arg;
+
+     pthread_mutex_lock( &buffers_lock );
+
+     /* Remove from list. */
+     for (i=0; i<buffers_num; i++) {
+          if (buffers[i] == buffer)
+               break;
+     }
+
+     for (; i<buffers_num-1; i++)
+          buffers[i] = buffers[i+1];
+
+     buffers_num--;
+
+     /* Deallocate the buffer. */
+     direct_trace_free_buffer( buffer );
+
+     pthread_mutex_unlock( &buffers_lock );
+}
+
+__attribute__((no_instrument_function))
+static inline DirectTraceBuffer *
+get_trace_buffer( void )
+{
+     DirectTraceBuffer *buffer;
+
+     buffer = pthread_getspecific( trace_key );
+     if (!buffer) {
+          const char *name = direct_thread_self_name();
+
+          pthread_mutex_lock( &buffers_lock );
+
+          if (!buffers_num)
+               pthread_key_create( &trace_key, buffer_destroy );
+          else if (buffers_num == MAX_BUFFERS) {
+               D_ERROR( "Direct/Trace: Maximum number of threads (%d) reached!\n", MAX_BUFFERS );
+               pthread_mutex_unlock( &buffers_lock );
+               return NULL;
+          }
+
+          pthread_setspecific( trace_key,
+                               buffer = calloc( 1, sizeof(DirectTraceBuffer) ) );
+
+          buffer->tid  = direct_gettid();
+          buffer->name = name ? strdup( name ) : NULL;
+
+          buffers[buffers_num++] = buffer;
+
+          pthread_mutex_unlock( &buffers_lock );
+     }
+
+     return buffer;
+}
+
+/**************************************************************************************************/
+
+typedef struct {
+     long offset;
+     char name[NAME_LEN];
+} Symbol;
+
+typedef struct {
+     DirectLink  link;
+
+     char       *filename;
+     Symbol     *symbols;
+     int         capacity;
+     int         num_symbols;
+} SymbolTable;
+
+static DirectLink      *tables      = NULL;
+static pthread_mutex_t  tables_lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+__attribute__((no_instrument_function))
+static void
+add_symbol( SymbolTable *table, long offset, const char *name )
+{
+     Symbol *symbol;
+
+     if (table->num_symbols == table->capacity) {
+          Symbol *symbols;
+          int     capacity = table->capacity * 2;
+
+          if (!capacity)
+               capacity = 256;
+
+          symbols = malloc( capacity * sizeof(Symbol) );
+          if (!symbols) {
+               D_WARN( "out of memory" );
+               return;
+          }
+
+          direct_memcpy( symbols, table->symbols, table->num_symbols * sizeof(Symbol) );
+
+          free( table->symbols );
+
+          table->symbols  = symbols;
+          table->capacity = capacity;
+     }
+
+     symbol = &table->symbols[ table->num_symbols++ ];
+
+     symbol->offset = offset;
+
+     direct_snputs( symbol->name, name, NAME_LEN );
+}
+
+__attribute__((no_instrument_function))
+static SymbolTable *
+load_symbols( const char *filename )
+{
+     SymbolTable *table;
+     FILE        *fp = NULL;
+     bool         is_pipe = false;
+     char         file[1024];
+     char         line[1024];
+     int          command_len;
+     char        *command;
+     const char  *full_path = filename;
+     char        *tmp;
+
+     if (filename) {
+          if (access( filename, R_OK ) < 0 && errno == ENOENT) {
+               int len;
+
+               if ((len = readlink( "/proc/self/exe", file, sizeof(file) - 1 )) < 0) {
+                    D_PERROR( "Direct/Trace: readlink( \"/proc/self/exe\" ) failed!\n" );
+                    return NULL;
+               }
+
+               file[len] = 0;
+
+
+               tmp = strrchr( file, '/' );
+               if (!tmp)
+                    return NULL;
+
+               if (strcmp( filename, tmp + 1 ))
+                    return NULL;
+
+               full_path = file;
+          }
+     }
+     else {
+          int   len;
+
+          if ((len = readlink( "/proc/self/exe", file, sizeof(file) - 1 )) < 0) {
+               D_PERROR( "Direct/Trace: readlink( \"/proc/self/exe\" ) failed!\n" );
+               return NULL;
+          }
+
+          file[len] = 0;
+
+          full_path = file;
+     }
+
+     command_len = strlen( full_path ) + 32;
+     command     = alloca( command_len );
+
+     /* First check if there's an "nm-n" file. */
+     tmp = strrchr( full_path, '/' );
+     if (!tmp)
+          return NULL;
+
+     *tmp = 0;
+     snprintf( command, command_len, "%s/nm-n.%s", full_path, tmp + 1 );
+     *tmp = '/';
+
+     if (access( command, R_OK ) == 0) {
+          fp = fopen( command, "r" );
+          if (!fp)
+               D_PERROR( "Direct/Trace: fopen( \"%s\", \"r\" ) failed!\n", command );
+     }
+     else {
+          snprintf( command, command_len, "%s.nm", full_path );
+          if (access( command, R_OK ) == 0) {
+               fp = fopen( command, "r" );
+               if (!fp)
+                    D_PERROR( "Direct/Trace: fopen( \"%s\", \"r\" ) failed!\n", command );
+          }
+     }
+
+     /* Fallback to live mode. */
+     if (!fp) {
+          snprintf( command, command_len, "nm -n %s", full_path );
+
+          fp = popen( command, "r" );
+          if (!fp) {
+               D_PERROR( "Direct/Trace: popen( \"%s\", \"r\" ) failed!\n", command );
+               return NULL;
+          }
+
+          is_pipe = true;
+     }
+
+     table = calloc( 1, sizeof(SymbolTable) );
+     if (!table) {
+          D_OOM();
+          goto out;
+     }
+
+     if (filename)
+          table->filename = strdup( filename );
+
+     while (fgets( line, sizeof(line), fp )) {
+          int  n;
+          int  digits = sizeof(long) * 2;
+          long offset = 0;
+          int  length = strlen(line);
+
+          if (line[0] == ' ' || length < (digits + 5) || line[length-1] != '\n')
+               continue;
+
+          if (line[digits + 1] != 't' && line[digits + 1] != 'T' && line[digits + 1] != 'W')
+               continue;
+
+          if (line[digits] != ' ' || line[digits + 2] != ' ' || line[digits + 3] == '.')
+               continue;
+
+          for (n=0; n<digits; n++) {
+               char c = line[n];
+
+               offset <<= 4;
+
+               if (c >= '0' && c <= '9')
+                    offset |= c - '0';
+               else
+                    offset |= c - 'a' + 10;
+          }
+
+          line[length-1] = 0;
+
+          add_symbol( table, offset, line + digits + 3 );
+     }
+
+out:
+     if (is_pipe)
+          pclose( fp );
+     else
+          fclose( fp );
+
+     return table;
+}
+
+__attribute__((no_instrument_function))
+static int
+compare_symbols(const void *x, const void *y)
+{
+     return  *((const long*) x)  -  *((const long*) y);
+}
+
+__attribute__((no_instrument_function))
+static SymbolTable *
+find_table( const char *filename )
+{
+     SymbolTable *table;
+
+     if (filename) {
+          direct_list_foreach (table, tables) {
+               if (table->filename && !strcmp( filename, table->filename ))
+                    return table;
+          }
+     }
+     else {
+          direct_list_foreach (table, tables) {
+               if (!table->filename)
+                    return table;
+          }
+     }
+
+     return NULL;
+}
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+const char *
+direct_trace_lookup_symbol( const char *filename, long offset )
+{
+     Symbol      *symbol;
+     SymbolTable *table;
+
+     pthread_mutex_lock( &tables_lock );
+
+     table = find_table( filename );
+     if (!table) {
+          table = load_symbols( filename );
+          if (!table) {
+               pthread_mutex_unlock( &tables_lock );
+               return false;
+          }
+
+          direct_list_prepend( &tables, &table->link );
+     }
+
+     pthread_mutex_unlock( &tables_lock );
+
+     symbol = bsearch( &offset, table->symbols, table->num_symbols,
+                       sizeof(Symbol), compare_symbols );
+
+     return symbol ? symbol->name : NULL;
+}
+
+__attribute__((no_instrument_function))
+const char *
+direct_trace_lookup_file( void *address, void **ret_base )
+{
+#ifdef DYNAMIC_LINKING
+     Dl_info info;
+
+     if (dladdr( address, &info )) {
+          if (ret_base)
+               *ret_base = info.dli_fbase;
+
+          return info.dli_fname;
+     }
+     else
+#endif
+     {
+          if (ret_base)
+               *ret_base = NULL;
+     }
+
+     return NULL;
+}
+
+__attribute__((no_instrument_function))
+void
+direct_trace_print_stack( DirectTraceBuffer *buffer )
+{
+#ifdef DYNAMIC_LINKING
+     Dl_info info;
+#endif
+     int     i;
+     int     level;
+
+     if (!direct_config->trace)
+          return;
+
+     if (!buffer)
+          buffer = get_trace_buffer();
+
+     if (buffer->in_trace)
+          return;
+
+     buffer->in_trace = true;
+
+
+     level = buffer->level;
+     if (level > MAX_LEVEL) {
+          D_WARN( "only showing %d of %d items", MAX_LEVEL, level );
+          level = MAX_LEVEL;
+     }
+     else if (level == 0) {
+          buffer->in_trace = false;
+          return;
+     }
+
+     direct_log_lock( NULL );
+
+     if (buffer->name)
+          direct_log_printf( NULL, "(-) [%5d: -STACK- '%s']\n", buffer->tid, buffer->name );
+     else
+          direct_log_printf( NULL, "(-) [%5d: -STACK- ]\n", buffer->tid );
+
+     for (i=level-1; i>=0; i--) {
+          void *fn = buffer->trace[i].addr;
+
+#ifdef DYNAMIC_LINKING
+          if (dladdr( fn, &info )) {
+               if (info.dli_fname) {
+                    const char *symbol = NULL;//info.dli_sname;
+
+                    if (!symbol) {
+                         symbol = direct_trace_lookup_symbol(info.dli_fname, (long)(fn - info.dli_fbase));
+                         if (!symbol) {
+                              symbol = direct_trace_lookup_symbol(info.dli_fname, (long)(fn));
+                              if (!symbol) {
+                                   if (info.dli_sname)
+                                        symbol = info.dli_sname;
+                                   else
+                                        symbol = "??";
+                              }
+                         }
+                    }
+
+                    direct_log_printf( NULL, "  #%-2d 0x%08lx in %s () from %s [%p]\n",
+                                       level - i - 1, (unsigned long) fn, symbol, info.dli_fname, info.dli_fbase );
+               }
+               else if (info.dli_sname) {
+                    direct_log_printf( NULL, "  #%-2d 0x%08lx in %s ()\n",
+                                       level - i - 1, (unsigned long) fn, info.dli_sname );
+               }
+               else
+                    direct_log_printf( NULL, "  #%-2d 0x%08lx in ?? ()\n",
+                                       level - i - 1, (unsigned long) fn );
+          }
+          else
+#endif
+          {
+               const char *symbol = direct_trace_lookup_symbol(NULL, (long)(fn));
+               direct_log_printf( NULL, "  #%-2d 0x%08lx in %s ()\n",
+                                  level - i - 1, (unsigned long) fn, symbol ? symbol : "??" );
+          }
+     }
+
+     direct_log_printf( NULL, "\n" );
+     direct_log_unlock( NULL );
+
+     buffer->in_trace = false;
+}
+
+__attribute__((no_instrument_function))
+void
+direct_trace_print_stacks( void )
+{
+     int                i;
+     DirectTraceBuffer *buffer = get_trace_buffer();
+
+     if (buffer->level)
+          direct_trace_print_stack( buffer );
+
+     pthread_mutex_lock( &buffers_lock );
+
+     for (i=0; i<buffers_num; i++) {
+          if (buffers[i] != buffer && buffers[i]->level)
+               direct_trace_print_stack( buffers[i] );
+     }
+
+     pthread_mutex_unlock( &buffers_lock );
+}
+
+__attribute__((no_instrument_function))
+int
+direct_trace_debug_indent( void )
+{
+     int                in;
+     DirectTraceBuffer *buffer = get_trace_buffer();
+     int                level  = buffer->level - 1;
+
+     if (level < 0)
+          return 0;
+
+     buffer->trace[level--].flags |= TF_DEBUG;
+
+     for (in=0; level>=0; level--) {
+          if (buffer->trace[level].flags & TF_DEBUG)
+               in++;
+     }
+
+     return in;
+}
+
+__attribute__((no_instrument_function))
+DirectTraceBuffer *
+direct_trace_copy_buffer( DirectTraceBuffer *buffer )
+{
+     int                level;
+     DirectTraceBuffer *copy;
+
+     if (!buffer)
+          buffer = get_trace_buffer();
+
+     level = buffer->level;
+     if (level > MAX_LEVEL) {
+          D_WARN( "only copying %d of %d items", MAX_LEVEL, level );
+          level = MAX_LEVEL;
+     }
+
+     copy = calloc( 1, sizeof(*buffer) - sizeof(buffer->trace) + sizeof(buffer->trace[0]) * level );
+     if (!copy)
+          return NULL;
+
+     if (buffer->name)
+          copy->name = strdup( buffer->name );
+
+     copy->tid   = buffer->tid;
+     copy->level = buffer->level;
+
+     direct_memcpy( copy->trace, buffer->trace, level * sizeof(buffer->trace[0]) );
+
+     return copy;
+}
+
+__attribute__((no_instrument_function))
+void
+direct_trace_free_buffer( DirectTraceBuffer *buffer )
+{
+     if (buffer->name)
+          free( buffer->name );
+
+     free( buffer );
+}
+
+/**************************************************************************************************/
+
+__attribute__((no_instrument_function))
+void
+__cyg_profile_func_enter (void *this_fn,
+                          void *call_site)
+{
+     if (direct_config->trace) {
+          DirectTraceBuffer *buffer = get_trace_buffer();
+          int                level  = buffer->level++;
+          Trace             *trace  = &buffer->trace[level];
+
+          if (level < MAX_LEVEL) {
+               trace->addr  = this_fn;
+               trace->flags = TF_NONE;
+          }
+     }
+}
+
+__attribute__((no_instrument_function))
+void
+__cyg_profile_func_exit (void *this_fn,
+                         void *call_site)
+{
+     if (direct_config->trace) {
+          DirectTraceBuffer *buffer = get_trace_buffer();
+
+          if (buffer->level > 0)
+               buffer->level--;
+     }
+}
+
+#else
+
+const char *
+direct_trace_lookup_symbol( const char *filename, long offset )
+{
+     return NULL;
+}
+
+const char *
+direct_trace_lookup_file( void *address, void **ret_base )
+{
+     if (ret_base)
+          *ret_base = NULL;
+          
+     return NULL;
+}
+
+void
+direct_trace_print_stack( DirectTraceBuffer *buffer )
+{
+}
+
+void
+direct_trace_print_stacks( void )
+{
+}
+
+int
+direct_trace_debug_indent( void )
+{
+     return 0;
+}
+
+DirectTraceBuffer *
+direct_trace_copy_buffer( DirectTraceBuffer *buffer )
+{
+     return NULL;
+}
+
+void
+direct_trace_free_buffer( DirectTraceBuffer *buffer )
+{
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/trace.h b/Source/DirectFB/lib/direct/trace.h
new file mode 100755
index 0000000..2975522
--- /dev/null
+++ b/Source/DirectFB/lib/direct/trace.h
@@ -0,0 +1,98 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__TRACE_H__
+#define __DIRECT__TRACE_H__
+
+#include <direct/types.h>
+
+/***********************************************************************************************************************
+** Symbols
+*/
+
+/*
+ * Returns filename on success or NULL.
+ *
+ * Stores load address of object in 'ret_base' on success.
+ */
+const char *direct_trace_lookup_file  ( void        *address,
+                                        void       **ret_base );
+
+/*
+ * Look up a symbol by filename and offset.
+ *
+ * Returns symbol name on success or NULL.
+ */
+const char *direct_trace_lookup_symbol( const char  *filename,
+                                        long         offset );
+
+/*
+ * Convenience function combining direct_trace_lookup_file() and direct_trace_lookup_symbol().
+ */
+static inline const char *
+direct_trace_lookup_symbol_at( void *address )
+{
+     void       *base;
+     const char *filename;
+
+     filename = direct_trace_lookup_file( address, &base );
+
+     return direct_trace_lookup_symbol( filename, (unsigned long) address - (unsigned long) base );
+}
+
+/***********************************************************************************************************************
+** Stacks
+*/
+
+/*
+ * Print stack in 'buffer' or current if NULL.
+ */
+void direct_trace_print_stack( DirectTraceBuffer *buffer );
+
+/*
+ * Print stack of each known thread.
+ */
+void direct_trace_print_stacks( void );
+
+/*
+ * Returns indent level for debug output.
+ */
+int  direct_trace_debug_indent( void );
+
+/*
+ * Create a copy of a stack in 'buffer' or of current if NULL.
+ */
+DirectTraceBuffer *direct_trace_copy_buffer( DirectTraceBuffer *buffer );
+
+/*
+ * Free a (copied) stack buffer.
+ */
+void               direct_trace_free_buffer( DirectTraceBuffer *buffer );
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/tree.c b/Source/DirectFB/lib/direct/tree.c
new file mode 100755
index 0000000..38aac17
--- /dev/null
+++ b/Source/DirectFB/lib/direct/tree.c
@@ -0,0 +1,307 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Balanced binary tree ported from glib-2.0.
+
+   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 <stdlib.h>
+
+#include <direct/mem.h>
+#include <direct/tree.h>
+
+
+static DirectNode *tree_node_new         ( DirectTree *tree,
+                                           void       *key,
+                                           void       *value );
+
+static void        tree_node_destroy     ( DirectTree *tree,
+                                           DirectNode *node );
+
+static DirectNode *tree_node_insert      ( DirectTree *tree,
+                                           DirectNode *node,
+                                           void       *key,
+                                           void       *value,
+                                           int        *inserted );
+
+static DirectNode *tree_node_lookup      ( DirectNode *node,
+                                           void       *key );
+
+static DirectNode *tree_node_balance     ( DirectNode *node );
+
+static DirectNode *tree_node_rotate_left ( DirectNode *node );
+
+static DirectNode *tree_node_rotate_right( DirectNode *node );
+
+
+DirectTree *
+direct_tree_new( void )
+{
+     return D_CALLOC( 1, sizeof (DirectTree) );
+}
+
+void
+direct_tree_destroy( DirectTree *tree )
+{
+     unsigned int i;
+
+     for (i = 0; i < 128; i++) {
+          if (tree->fast_keys[i])
+               D_FREE( tree->fast_keys[i] );
+     }
+
+     tree_node_destroy( tree, tree->root );
+
+     D_FREE( tree );
+}
+
+void
+direct_tree_insert( DirectTree *tree,
+                    void       *key,
+                    void       *value )
+{
+     int           inserted = 0;
+     unsigned long fast_key = (unsigned long) key;
+
+     if (fast_key < 128)
+          tree->fast_keys[fast_key] = value;
+     else
+          tree->root = tree_node_insert( tree, tree->root, key, value, &inserted );
+}
+
+void *
+direct_tree_lookup( DirectTree *tree,
+                    void       *key )
+{
+     DirectNode    *node;
+     unsigned long  fast_key = (unsigned long) key;
+
+     if (fast_key < 128)
+          return tree->fast_keys[fast_key];
+
+     node = tree_node_lookup( tree->root, key );
+
+     return node ? node->value : NULL;
+}
+
+static DirectNode *
+tree_node_new( DirectTree *tree,
+               void       *key,
+               void       *value )
+{
+     DirectNode *node;
+
+     node = D_MALLOC(sizeof (DirectNode));
+
+     node->balance = 0;
+     node->left    = NULL;
+     node->right   = NULL;
+     node->key     = key;
+     node->value   = value;
+
+     return node;
+}
+
+static void
+tree_node_destroy (DirectTree *tree,
+                   DirectNode *node)
+{
+     if (node) {
+          tree_node_destroy (tree, node->left);
+          tree_node_destroy (tree, node->right);
+
+          if (node->value)
+               D_FREE(node->value);
+
+          D_FREE(node);
+     }
+}
+
+static DirectNode *
+tree_node_insert (DirectTree *tree,
+                  DirectNode *node,
+                  void       *key,
+                  void       *value,
+                  int        *inserted)
+{
+     int cmp;
+     int old_balance;
+
+     if (!node) {
+          *inserted = 1;
+          return tree_node_new (tree, key, value);
+     }
+
+     cmp = key - node->key;
+     if (cmp == 0) {
+          node->value = value;
+          return node;
+     }
+
+     if (cmp < 0) {
+          if (node->left) {
+               old_balance = node->left->balance;
+           node->left = tree_node_insert (tree, node->left,
+                                              key, value, inserted);
+
+               if ((old_balance != node->left->balance) && node->left->balance)
+                   node->balance -= 1;
+          }
+          else {
+               *inserted = 1;
+               node->left = tree_node_new (tree, key, value);
+               node->balance -= 1;
+          }
+     }
+     else if (cmp > 0) {
+          if (node->right) {
+               old_balance = node->right->balance;
+               node->right = tree_node_insert (tree, node->right,
+                                               key, value, inserted);
+
+               if ((old_balance != node->right->balance) && node->right->balance)
+                    node->balance += 1;
+          }
+          else {
+               *inserted = 1;
+               node->right = tree_node_new (tree, key, value);
+               node->balance += 1;
+          }
+     }
+
+     if (*inserted && (node->balance < -1 || node->balance > 1))
+          node = tree_node_balance (node);
+
+     return node;
+}
+
+static DirectNode *
+tree_node_lookup (DirectNode *node,
+                  void       *key)
+{
+     int cmp;
+
+     if (!node)
+          return NULL;
+
+     cmp = key - node->key;
+     if (cmp == 0)
+          return node;
+
+     if (cmp < 0 && node->left) {
+          return tree_node_lookup (node->left, key);
+     }
+     else if (cmp > 0 && node->right) {
+          return tree_node_lookup (node->right, key);
+     }
+
+     return NULL;
+}
+
+static DirectNode *
+tree_node_balance (DirectNode *node)
+{
+     if (node->balance < -1) {
+          if (node->left->balance > 0)
+               node->left = tree_node_rotate_left (node->left);
+          node = tree_node_rotate_right (node);
+     }
+     else if (node->balance > 1) {
+          if (node->right->balance < 0)
+               node->right = tree_node_rotate_right (node->right);
+          node = tree_node_rotate_left (node);
+     }
+
+     return node;
+}
+
+static DirectNode *
+tree_node_rotate_left (DirectNode *node)
+{
+     DirectNode *right;
+     int         a_bal;
+     int         b_bal;
+
+     right = node->right;
+
+     node->right = right->left;
+     right->left = node;
+
+     a_bal = node->balance;
+     b_bal = right->balance;
+
+     if (b_bal <= 0) {
+          if (a_bal >= 1)
+               right->balance = b_bal - 1;
+          else
+               right->balance = a_bal + b_bal - 2;
+          node->balance = a_bal - 1;
+     }
+     else {
+          if (a_bal <= b_bal)
+               right->balance = a_bal - 2;
+          else
+               right->balance = b_bal - 1;
+          node->balance = a_bal - b_bal - 1;
+     }
+
+     return right;
+}
+
+static DirectNode *
+tree_node_rotate_right (DirectNode *node)
+{
+     DirectNode *left;
+     int         a_bal;
+     int         b_bal;
+
+     left = node->left;
+
+     node->left = left->right;
+     left->right = node;
+
+     a_bal = node->balance;
+     b_bal = left->balance;
+
+     if (b_bal <= 0) {
+          if (b_bal > a_bal)
+               left->balance = b_bal + 1;
+          else
+               left->balance = a_bal + 2;
+          node->balance = a_bal - b_bal + 1;
+     }
+     else {
+          if (a_bal <= -1)
+               left->balance = b_bal + 1;
+          else
+               left->balance = a_bal + b_bal + 2;
+          node->balance = a_bal + 1;
+     }
+
+     return left;
+}
diff --git a/Source/DirectFB/lib/direct/tree.h b/Source/DirectFB/lib/direct/tree.h
new file mode 100755
index 0000000..165ed1c
--- /dev/null
+++ b/Source/DirectFB/lib/direct/tree.h
@@ -0,0 +1,67 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Balanced binary tree ported from glib by Sven Neumann
+   <sven@convergence.de>.
+
+   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 __DIRECT__TREE_H__
+#define __DIRECT__TREE_H__
+
+#include <direct/types.h>
+
+
+typedef struct __D_DirectNode DirectNode;
+
+struct __D_DirectTree
+{
+     DirectNode *root;
+     void       *fast_keys[128];
+};
+
+struct __D_DirectNode
+{
+     int         balance;
+     DirectNode *left;
+     DirectNode *right;
+     void       *key;
+     void       *value;
+};
+
+
+DirectTree *direct_tree_new    ( void );
+
+void        direct_tree_destroy( DirectTree *tree );
+
+void        direct_tree_insert ( DirectTree *tree,
+                                 void       *key,
+                                 void       *value );
+
+void       *direct_tree_lookup ( DirectTree *tree,
+                                 void       *key );
+
+#endif
diff --git a/Source/DirectFB/lib/direct/types.h b/Source/DirectFB/lib/direct/types.h
new file mode 100755
index 0000000..2677e00
--- /dev/null
+++ b/Source/DirectFB/lib/direct/types.h
@@ -0,0 +1,169 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__TYPES_H__
+#define __DIRECT__TYPES_H__
+
+#include <direct/build.h>
+
+/*
+ * Define the bool type by including stdbool.h (preferably)...
+ */
+#if DIRECT_BUILD_STDBOOL
+#  include <stdbool.h>
+/*
+ * ...or defining it ourself, if not using C++ or another definition
+ */
+#elif !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
+#  warning Fallback definition of bool using u8! Checking for 'flags & 0x100' or higher bits will be false :(
+   typedef u8 bool;
+#  ifndef false
+#   define false (0)
+#  endif
+#  ifndef true
+#   define true (!false)
+#  endif
+#endif /* DIRECT_BUILD_STDBOOL */
+
+
+#ifdef USE_KOS
+
+#include <sys/types.h>
+
+typedef uint8 u8;
+typedef uint16 u16;
+typedef uint32 u32;
+typedef uint64 u64;
+
+typedef sint8 s8;
+typedef sint16 s16;
+typedef sint32 s32;
+typedef sint64 s64;
+
+#else
+
+#include <stdint.h>
+
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
+typedef int8_t s8;
+typedef int16_t s16;
+typedef int32_t s32;
+typedef int64_t s64;
+
+#endif
+
+
+typedef enum {
+     DR_OK = 0x00000000, /* No error occured. */
+     DR_FAILURE,         /* A general or unknown error occured. */
+     DR_INIT,            /* A general initialization error occured. */
+     DR_BUG,             /* Internal bug or inconsistency has been detected. */
+     DR_DEAD,            /* Interface has a zero reference counter (available in debug mode). */
+     DR_UNSUPPORTED,     /* The requested operation or an argument is (currently) not supported. */
+     DR_UNIMPLEMENTED,   /* The requested operation is not implemented, yet. */
+     DR_ACCESSDENIED,    /* Access to the resource is denied. */
+     DR_INVAREA,         /* An invalid area has been specified or detected. */
+     DR_INVARG,          /* An invalid argument has been specified. */
+     DR_NOLOCALMEMORY,   /* There's not enough local system memory. */
+     DR_NOSHAREDMEMORY,  /* There's not enough shared system memory. */
+     DR_LOCKED,          /* The resource is (already) locked. */
+     DR_BUFFEREMPTY,     /* The buffer is empty. */
+     DR_FILENOTFOUND,    /* The specified file has not been found. */
+     DR_IO,              /* A general I/O error occured. */
+     DR_BUSY,            /* The resource or device is busy. */
+     DR_NOIMPL,          /* No implementation for this interface or content type has been found. */
+     DR_TIMEOUT,         /* The operation timed out. */
+     DR_THIZNULL,        /* 'thiz' pointer is NULL. */
+     DR_IDNOTFOUND,      /* No resource has been found by the specified id. */
+     DR_DESTROYED,       /* The requested object has been destroyed. */
+     DR_FUSION,          /* Internal fusion error detected, most likely related to IPC resources. */
+     DR_BUFFERTOOLARGE,  /* Buffer is too large. */
+     DR_INTERRUPTED,     /* The operation has been interrupted. */
+     DR_NOCONTEXT,       /* No context available. */
+     DR_TEMPUNAVAIL,     /* Temporarily unavailable. */
+     DR_LIMITEXCEEDED,   /* Attempted to exceed limit, i.e. any kind of maximum size, count etc. */
+     DR_NOSUCHMETHOD,    /* Requested method is not known. */
+     DR_NOSUCHINSTANCE,  /* Requested instance is not known. */
+     DR_ITEMNOTFOUND,    /* No such item found. */
+     DR_VERSIONMISMATCH, /* Some versions didn't match. */
+     DR_EOF,             /* Reached end of file. */
+     DR_SUSPENDED,       /* The requested object is suspended. */
+     DR_INCOMPLETE,      /* The operation has been executed, but not completely. */
+     DR_NOCORE           /* Core part not available. */
+} DirectResult;
+
+/*
+ * Generate result code base for API 'A','B','C', e.g. 'D','F','B'.
+ */
+#define D_RESULT_TYPE_BASE( a,b,c )     ((((unsigned)(a)&0x7f) * 0x02000000) + \
+                                         (((unsigned)(b)&0x7f) * 0x00040000) + \
+                                         (((unsigned)(c)&0x7f) * 0x00000800))
+
+/*
+ * Generate result code maximum for API 'A','B','C', e.g. 'D','F','B'.
+ */
+#define D_RESULT_TYPE_MAX( a,b,c )      (D_RESULT_TYPE_BASE(a,b,c) + 0x7ff)
+
+/*
+ * Check if given result code belongs to API 'A','B','C', e.g. 'D','F','B'.
+ */
+#define D_RESULT_TYPE_IS( code,a,b,c )  ((code) >= D_RESULT_TYPE_BASE(a,b,c) && (code) <= D_RESULT_TYPE_MAX(a,b,c))
+
+
+/*
+ * Return value of enumeration callbacks
+ */
+typedef enum {
+     DENUM_OK       = 0x00000000,  /* Proceed with enumeration */
+     DENUM_CANCEL   = 0x00000001   /* Cancel enumeration */
+} DirectEnumerationResult;
+
+
+typedef u32 unichar;
+
+typedef struct __D_DirectCleanupHandler      DirectCleanupHandler;
+typedef struct __D_DirectConfig              DirectConfig;
+typedef struct __D_DirectHash                DirectHash;
+typedef struct __D_DirectLink                DirectLink;
+typedef struct __D_DirectLog                 DirectLog;
+typedef struct __D_DirectModuleDir           DirectModuleDir;
+typedef struct __D_DirectModuleEntry         DirectModuleEntry;
+typedef struct __D_DirectSerial              DirectSerial;
+typedef struct __D_DirectSignalHandler       DirectSignalHandler;
+typedef struct __D_DirectStream              DirectStream;
+typedef struct __D_DirectTraceBuffer         DirectTraceBuffer;
+typedef struct __D_DirectTree                DirectTree;
+typedef struct __D_DirectThread              DirectThread;
+typedef struct __D_DirectThreadInitHandler   DirectThreadInitHandler;
+
+#endif
+
diff --git a/Source/DirectFB/lib/direct/utf8.c b/Source/DirectFB/lib/direct/utf8.c
new file mode 100755
index 0000000..75896da
--- /dev/null
+++ b/Source/DirectFB/lib/direct/utf8.c
@@ -0,0 +1,36 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   UTF8 routines ported from glib-2.0 and optimized
+
+   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 <direct/utf8.h>
+
+
+
diff --git a/Source/DirectFB/lib/direct/utf8.h b/Source/DirectFB/lib/direct/utf8.h
new file mode 100755
index 0000000..a073c65
--- /dev/null
+++ b/Source/DirectFB/lib/direct/utf8.h
@@ -0,0 +1,80 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   UTF8 routines ported from glib-2.0 and optimized
+
+   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 __DIRECT__UTF8_H__
+#define __DIRECT__UTF8_H__
+
+#include <direct/types.h>
+
+
+#define DIRECT_UTF8_SKIP(c)     (((u8)(c) < 0xc0) ? 1 : __direct_utf8_skip[(u8)(c)&0x3f])
+
+#define DIRECT_UTF8_GET_CHAR(p) (*(const u8*)(p) < 0xc0 ? \
+                                 *(const u8*)(p) : __direct_utf8_get_char((const u8*)(p)))
+
+
+/*
+ *  Actually the last two fields used to be zero since they indicate an
+ *  invalid UTF-8 string. Changed it to 1 to avoid endless looping on
+ *  invalid input.
+ */
+static const char __direct_utf8_skip[64] = {
+     2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+     3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+static __inline__ unichar __direct_utf8_get_char( const u8 *p )
+{
+     int              len;
+     register unichar result = p[0];
+
+     if (result < 0xc0)
+          return result;
+
+     if (result > 0xfd)
+          return (unichar) -1;
+
+     len = __direct_utf8_skip[result & 0x3f];
+
+     result &= 0x7c >> len;
+
+     while (--len) {
+          int c = *(++p);
+
+          if ((c & 0xc0) != 0x80)
+               return (unichar) -1;
+
+          result = (result << 6) | (c & 0x3f);
+     }
+
+     return result;
+}
+
+#endif
diff --git a/Source/DirectFB/lib/direct/util.c b/Source/DirectFB/lib/direct/util.c
new file mode 100755
index 0000000..9e7a03a
--- /dev/null
+++ b/Source/DirectFB/lib/direct/util.c
@@ -0,0 +1,519 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+#include <direct/clock.h>
+
+#ifdef CLOCK_MONOTONIC
+#include <sys/syscall.h>
+#endif
+
+static int no_monotonic_pthread_clock;
+
+/*
+ * translates errno to DirectResult
+ */
+DirectResult
+errno2result( int erno )
+{
+     switch (erno) {
+          case 0:
+               return DR_OK;
+          case ENOENT:
+               return DR_FILENOTFOUND;
+          case EACCES:
+          case EPERM:
+               return DR_ACCESSDENIED;
+          case EBUSY:
+          case EAGAIN:
+               return DR_BUSY;
+          case ECONNREFUSED:
+               return DR_ACCESSDENIED;
+          case ENODEV:
+          case ENXIO:
+#ifdef ENOTSUP
+          /* ENOTSUP is not defined on NetBSD */
+          case ENOTSUP:
+#endif
+               return DR_UNSUPPORTED;
+     }
+
+     return DR_FAILURE;
+}
+
+const char *
+DirectResultString( DirectResult result )
+{
+     if (!D_RESULT_TYPE_IS( result, 0, 0, 0 ))
+          return "UNKNOWN RESULT CODE TYPE!";
+
+     switch (result) {
+          case DR_OK:
+               return "OK";
+          case DR_FAILURE:
+               return "General failure!";
+          case DR_INIT:
+               return "Initialization error!";
+          case DR_BUG:
+               return "Internal bug!";
+          case DR_DEAD:
+               return "Interface was released!";
+          case DR_UNSUPPORTED:
+               return "Not supported!";
+          case DR_UNIMPLEMENTED:
+               return "Not implemented!";
+          case DR_ACCESSDENIED:
+               return "Access denied!";
+          case DR_INVARG:
+               return "Invalid argument!";
+          case DR_NOLOCALMEMORY:
+               return "Out of memory!";
+          case DR_LOCKED:
+               return "Resource is locked!";
+          case DR_BUFFEREMPTY:
+               return "Buffer is empty!";
+          case DR_FILENOTFOUND:
+               return "File not found!";
+          case DR_IO:
+               return "General I/O error!";
+          case DR_NOIMPL:
+               return "No (suitable) implementation found!";
+          case DR_TIMEOUT:
+               return "Operation timed out!";
+          case DR_BUSY:
+               return "Resource is busy!";
+          case DR_THIZNULL:
+               return "'thiz' argument is NULL!";
+          case DR_IDNOTFOUND:
+               return "Requested ID not found!";
+          case DR_INVAREA:
+               return "Invalid area present!";
+          case DR_DESTROYED:
+               return "Resource was destroyed!";
+          case DR_FUSION:
+               return "Fusion IPC error detected!";
+          case DR_BUFFERTOOLARGE:
+               return "Buffer is too large!";
+          case DR_INTERRUPTED:
+               return "Operation has been interrupted!";
+          case DR_NOCONTEXT:
+               return "No context available!";
+          case DR_TEMPUNAVAIL:
+               return "Resource temporarily unavailable!";
+          case DR_LIMITEXCEEDED:
+               return "Limit has been exceeded!";
+          case DR_NOSUCHMETHOD:
+               return "No such (remote) method!";
+          case DR_NOSUCHINSTANCE:
+               return "No such (remote) instance!";
+          case DR_ITEMNOTFOUND:
+               return "Appropriate item not found!";
+          case DR_VERSIONMISMATCH:
+               return "Some versions didn't match!";
+          case DR_NOSHAREDMEMORY:
+               return "Out of shared memory!";
+          case DR_EOF:
+               return "End of file!";
+          case DR_SUSPENDED:
+               return "Object is suspended!";
+          case DR_INCOMPLETE:
+               return "Operation incomplete!";
+          case DR_NOCORE:
+               return "No core (loaded)!";
+          default:
+               break;
+     }
+
+     return "UNKNOWN RESULT CODE!";
+}
+
+int
+direct_safe_dup( int fd )
+{
+    int n = 0;
+    int fc[3];
+
+    while (fd >= 0 && fd <= 2) {
+        fc[n++] = fd;
+        fd = dup (fd);
+    }
+
+    while (n)
+        close (fc[--n]);
+
+    return fd;
+}
+
+int
+direct_try_open( const char *name1, const char *name2, int flags, bool error_msg )
+{
+     int fd;
+
+     fd = open (name1, flags);
+     if (fd >= 0)
+          return direct_safe_dup (fd);
+
+     if (errno != ENOENT) {
+          if (error_msg)
+               D_PERROR( "Direct/Util: opening '%s' failed\n", name1 );
+          return -1;
+     }
+
+     fd = open (name2, flags);
+     if (fd >= 0)
+          return direct_safe_dup (fd);
+
+     if (error_msg) {
+          if (errno == ENOENT)
+               D_PERROR( "Direct/Util: opening '%s' and '%s' failed\n", name1, name2 );
+          else
+               D_PERROR( "Direct/Util: opening '%s' failed\n", name2 );
+     }
+
+     return -1;
+}
+
+void
+direct_trim( char **s )
+{
+     int i;
+     int len = strlen( *s );
+
+     for (i = len-1; i >= 0; i--)
+          if ((*s)[i] <= ' ')
+               (*s)[i] = 0;
+          else
+               break;
+
+     while (**s)
+          if (**s <= ' ')
+               (*s)++;
+          else
+               return;
+}
+
+/*
+ * Utility function to initialize recursive mutexes.
+ */
+int
+direct_util_recursive_pthread_mutex_init( pthread_mutex_t *mutex )
+{
+     int                 ret;
+     pthread_mutexattr_t attr;
+
+     pthread_mutexattr_init( &attr );
+#if HAVE_DECL_PTHREAD_MUTEX_RECURSIVE
+     pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
+#endif
+     ret = pthread_mutex_init( mutex, &attr );
+     if (ret)
+          D_PERROR( "Direct/Lock: Could not initialize recursive mutex!\n" );
+
+     pthread_mutexattr_destroy( &attr );
+
+     return ret;
+}
+
+/*
+ * Utility function to initialize monotonic condition.
+ */
+int
+direct_util_monotonic_pthread_cond_init( pthread_cond_t *cond )
+{
+#if defined(CLOCK_MONOTONIC) && !defined(DIRECT_BUILD_NO_PTHREAD_CONDATTR)
+     int                ret;
+     pthread_condattr_t attr;
+
+     struct timespec dummy;
+     pthread_condattr_init( &attr );
+
+     if(!no_monotonic_pthread_clock) {
+          if((syscall( __NR_clock_getres, CLOCK_MONOTONIC, &dummy ) == 0) &&
+               (pthread_condattr_setclock( &attr, CLOCK_MONOTONIC ) == 0))
+               ;
+          else
+               no_monotonic_pthread_clock = 1;
+     }
+
+     ret = pthread_cond_init( cond, &attr );
+     if (ret)
+          D_PERROR( "Direct/Lock: Could not initialize monotonic condition!\n" );
+
+     pthread_condattr_destroy( &attr );
+
+     return ret;
+#else
+     pthread_cond_init( cond, NULL );
+
+     return 0;
+#endif
+}
+
+/*
+ * Utility function to calibrate timeout for monotonic condition.
+ */
+void
+direct_util_get_monotonic_pthread_timeout( struct timespec *timeout,
+                                           int seconds,
+                                           int nano_seconds )
+{
+     struct timeval  now;
+    
+     if(no_monotonic_pthread_clock)
+          gettimeofday( &now, NULL );
+     else
+          direct_monotonic_gettimeofday( &now );
+
+     timeout->tv_sec  = now.tv_sec + seconds;
+     timeout->tv_nsec = (now.tv_usec * 1000) + nano_seconds;
+
+     timeout->tv_sec  += timeout->tv_nsec / 1000000000;
+     timeout->tv_nsec %= 1000000000;
+}
+
+/*
+ * Encode/Decode Base-64.
+ */
+char*
+direct_base64_encode( const void *data, int size )
+{
+     static const char   *enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                "abcdefghijklmnopqrstuvwxyz"
+                                "0123456789+/=";
+     const unsigned char *src = (const unsigned char*)data;
+     char                *ret;
+     char                *buf;
+     
+     D_ASSERT( data != NULL );
+
+     buf = ret = D_MALLOC( (size + 2) / 3 * 4 + 1 );
+     if (!ret)
+          return NULL;
+     
+     for (; size >= 3; size -= 3) {
+          buf[0] = enc[((src[0] & 0xfc) >> 2)];
+          buf[1] = enc[((src[0] & 0x03) << 4) | ((src[1] & 0xf0) >> 4)];
+          buf[2] = enc[((src[1] & 0x0f) << 2) | ((src[2] & 0xc0) >> 6)];
+          buf[3] = enc[((src[2] & 0x3f))];
+          buf += 4;
+          src += 3;
+     }
+
+     if (size > 0) {
+          buf[0] = enc[(src[0] & 0xfc) >> 2];
+          
+          if (size > 1) {
+               buf[1] = enc[((src[0] & 0x03) << 4) | ((src[1] & 0xf0) >> 4)];
+               buf[2] = enc[((src[1] & 0x0f) << 2)];
+          } else {
+               buf[1] = enc[(src[0] & 0x03) << 4];
+               buf[2] = '=';
+          }
+
+          buf[3] = '=';
+          buf += 4;
+     }
+
+     *buf = '\0';
+
+     return ret;
+}
+
+void*
+direct_base64_decode( const char *string, int *ret_size )
+{
+     unsigned char  dec[256];
+     unsigned char *ret;
+     unsigned char *buf;
+     int            len;
+     int            i, j;
+     
+     D_ASSERT( string != NULL );
+     
+     len = strlen( string );
+     buf = ret = D_MALLOC( len * 3 / 4 + 3 );
+     if (!ret)
+          return NULL;
+
+     /* generate decode table */
+     for (i = 0; i < 255; i++)
+          dec[i] = 0x80;
+     for (i = 'A'; i <= 'Z'; i++)
+          dec[i] = 0  + (i - 'A');
+     for (i = 'a'; i <= 'z'; i++)
+          dec[i] = 26 + (i - 'a');
+     for (i = '0'; i <= '9'; i++)
+          dec[i] = 52 + (i - '0');
+     dec['+'] = 62;
+     dec['/'] = 63;
+     dec['='] = 0;
+  
+     /* decode */
+     for (j = 0; j < len; j += 4) {
+          unsigned char a[4], b[4];
+
+          for (i = 0; i < 4; i++) {
+               int c = string[i+j];
+               a[i] = c;
+               b[i] = dec[c];
+          }
+    
+          *buf++ = (b[0] << 2) | (b[1] >> 4);
+          *buf++ = (b[1] << 4) | (b[2] >> 2);
+          *buf++ = (b[2] << 6) | (b[3]     );
+          if (a[2] == '=' || a[3] == '=')
+               break;
+     }
+
+     *buf = '\0';
+     
+     if (ret_size)
+          *ret_size = buf - ret;
+
+     return ret;
+}
+
+/*
+ * Compute MD5 sum.
+ */
+static const u8 S[4][4] = {
+     { 7, 12, 17, 22 },  /* Round 1 */
+     { 5,  9, 14, 20 },  /* Round 2 */
+     { 4, 11, 16, 23 },  /* Round 3 */
+     { 6, 10, 15, 21 }   /* Round 4 */
+};
+
+static const u32 T[64] = {
+     0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,   /* Round 1 */
+     0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
+     0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
+     0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
+
+     0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,   /* Round 2 */
+     0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
+     0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
+     0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
+
+     0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,   /* Round 3 */
+     0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
+     0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
+     0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
+
+     0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,   /* Round 4 */
+     0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
+     0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
+     0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
+};
+                
+static void
+md5_hash( u32 ABCD[4], u32 X[16] )
+{
+     u32 a = ABCD[3];
+     u32 b = ABCD[2];
+     u32 c = ABCD[1];
+     u32 d = ABCD[0];
+     int   t;
+     int   i;
+    
+#ifdef WORDS_BIGENDIAN
+     for (i = 0; i < 16; i++)
+          X[i] = BSWAP32(X[i]);
+#endif
+
+     for (i = 0; i < 64; i++) {
+          t = S[i>>4][i&3];
+          a += T[i];
+          switch (i>>4) {
+               case 0: a += (d ^ (b&(c^d))) + X[     i &15]; break;
+               case 1: a += (c ^ (d&(c^b))) + X[(1+5*i)&15]; break;
+               case 2: a += (b^c^d)         + X[(5+3*i)&15]; break;
+               case 3: a += (c^(b|~d))      + X[(  7*i)&15]; break;
+          }
+          a = b + ((a << t) | (a >> (32 - t)));
+          t = d; d = c; c = b; b = a; a = t;
+     }
+     
+     ABCD[0] += d;
+     ABCD[1] += c;
+     ABCD[2] += b;
+     ABCD[3] += a;
+}         
+
+void 
+direct_md5_sum( void *dst, const void *src, const int len )
+{
+     u8    block[64];
+     u32 ABCD[4];
+     int   i, j;
+     
+     D_ASSERT( dst != NULL );
+     D_ASSERT( src != NULL );
+     
+     ABCD[0] = 0x10325476;
+     ABCD[1] = 0x98badcfe;
+     ABCD[2] = 0xefcdab89;
+     ABCD[3] = 0x67452301;
+     
+     for (i = 0, j = 0; i < len; i++) {
+          block[j++] = ((const u8*)src)[i];
+          if (j == 64) {
+               md5_hash( ABCD, (u32*)block );
+               j = 0;
+          }
+     }
+     
+     block[j++] = 0x80;
+     memset( &block[j], 0, 64-j );
+     
+     if (j > 56) {
+          md5_hash( ABCD, (u32*)block );
+          memset( block, 0, 64 );
+     }
+     
+     for (i = 0; i < 8; i++)
+          block[56+i] = ((u64)len << 3) >> (i << 3);
+          
+     md5_hash( ABCD, (u32*)block );
+     
+     for (i = 0; i < 4; i++)
+#ifdef WORDS_BIGENDIAN
+          ((u32*)dst)[i] = BSWAP32(ABCD[3-i]);
+#else
+          ((u32*)dst)[i] = ABCD[3-i];
+#endif
+}
diff --git a/Source/DirectFB/lib/direct/util.h b/Source/DirectFB/lib/direct/util.h
new file mode 100755
index 0000000..b93359e
--- /dev/null
+++ b/Source/DirectFB/lib/direct/util.h
@@ -0,0 +1,330 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__UTIL_H__
+#define __DIRECT__UTIL_H__
+
+#include <unistd.h>
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#include <sched.h>
+#endif
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef SIGN
+#define SIGN(x)  (((x) < 0) ?  -1  :  (((x) > 0) ? 1 : 0))
+#endif
+
+#ifndef ABS
+#define ABS(x)   ((x) > 0 ? (x) : -(x))
+#endif
+
+#ifndef CLAMP
+#define CLAMP(x,min,max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
+#endif
+
+#ifndef BSWAP16
+#define BSWAP16(x) (((u16)(x)>>8) | ((u16)(x)<<8))
+#endif
+
+#ifndef BSWAP32
+#define BSWAP32(x) ((((u32)(x)>>24) & 0x000000ff) | (((u32)(x)>> 8) & 0x0000ff00) | \
+                    (((u32)(x)<< 8) & 0x00ff0000) | (((u32)(x)<<24) & 0xff000000))
+#endif
+
+
+#define D_FLAGS_SET(flags,f)       do { (flags) |= (f); } while (0)
+#define D_FLAGS_CLEAR(flags,f)     do { (flags) &= ~(f); } while (0)
+#define D_FLAGS_IS_SET(flags,f)    (((flags) & (f)) != 0)
+#define D_FLAGS_ARE_SET(flags,f)   (((flags) & (f)) == (f))
+#define D_FLAGS_ARE_IN(flags,f)    (((flags) & ~(f)) == 0)
+#define D_FLAGS_INVALID(flags,f)   (((flags) & ~(f)) != 0)
+
+#define D_FLAGS_ASSERT(flags,f)    D_ASSERT( D_FLAGS_ARE_IN(flags,f) )
+
+#define D_ARRAY_SIZE(array)        ((int)(sizeof(array) / sizeof((array)[0])))
+
+#define D_UTIL_SWAP(a,b)                                    \
+     do {                                                   \
+          const typeof(a) x = (a); (a) = (b); (b) = x;      \
+     } while (0)
+
+
+#if __GNUC__ >= 3
+#define D_CONST_FUNC               __attribute__((const))
+#else
+#define D_CONST_FUNC
+#endif
+
+
+#define D_BITn32(f)  (((f) & 0x00000001) ?  0 : \
+                      ((f) & 0x00000002) ?  1 : \
+                      ((f) & 0x00000004) ?  2 : \
+                      ((f) & 0x00000008) ?  3 : \
+                      ((f) & 0x00000010) ?  4 : \
+                      ((f) & 0x00000020) ?  5 : \
+                      ((f) & 0x00000040) ?  6 : \
+                      ((f) & 0x00000080) ?  7 : \
+                      ((f) & 0x00000100) ?  8 : \
+                      ((f) & 0x00000200) ?  9 : \
+                      ((f) & 0x00000400) ? 10 : \
+                      ((f) & 0x00000800) ? 11 : \
+                      ((f) & 0x00001000) ? 12 : \
+                      ((f) & 0x00002000) ? 13 : \
+                      ((f) & 0x00004000) ? 14 : \
+                      ((f) & 0x00008000) ? 15 : \
+                      ((f) & 0x00010000) ? 16 : \
+                      ((f) & 0x00020000) ? 17 : \
+                      ((f) & 0x00040000) ? 18 : \
+                      ((f) & 0x00080000) ? 19 : \
+                      ((f) & 0x00100000) ? 20 : \
+                      ((f) & 0x00200000) ? 21 : \
+                      ((f) & 0x00400000) ? 22 : \
+                      ((f) & 0x00800000) ? 23 : \
+                      ((f) & 0x01000000) ? 24 : \
+                      ((f) & 0x02000000) ? 25 : \
+                      ((f) & 0x04000000) ? 26 : \
+                      ((f) & 0x08000000) ? 27 : \
+                      ((f) & 0x10000000) ? 28 : \
+                      ((f) & 0x20000000) ? 29 : \
+                      ((f) & 0x40000000) ? 30 : \
+                      ((f) & 0x80000000) ? 31 : -1)
+
+
+/*
+ * portable sched_yield() implementation
+ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#define direct_sched_yield()  sched_yield()
+#else
+#define direct_sched_yield()  usleep(1)
+#endif
+
+/*
+ * translates errno to DirectResult
+ */
+DirectResult errno2result( int erno );
+
+const char *DirectResultString( DirectResult result );
+
+/*
+ * duplicates a file descriptor as needed to ensure it's not stdin, stdout, or stderr
+ */
+int direct_safe_dup( int fd );
+
+int direct_try_open( const char *name1, const char *name2, int flags, bool error_msg );
+
+void direct_trim( char **s );
+
+/*
+ * Set a string with a maximum size including the zero termination.
+ *
+ * This acts like a strncpy(d,s,n), but always terminates the string like snprintf(d,n,"%s",s).
+ *
+ * Returns dest or NULL if n is zero.
+ */
+static __inline__ char *
+direct_snputs( char       *dest,
+               const char *src,
+               size_t      n )
+{
+     char *start = dest;
+
+     D_ASSERT( dest != NULL );
+     D_ASSERT( src != NULL );
+
+     if (!n)
+          return NULL;
+
+     for (; n>1 && *src; n--)
+          *dest++ = *src++;
+
+     *dest = 0;
+
+     return start;
+}
+
+/*
+ * Encode/Decode Base-64 strings.
+ */
+char *direct_base64_encode( const void *data, int size );
+void *direct_base64_decode( const char *string, int *ret_size );
+
+/*
+ * Compute MD5 sum (store 16-bytes long result in "dst").
+ */
+void  direct_md5_sum( void *dst, const void *src, const int len );
+
+/*
+ * Slow implementation, but quite fast if only low bits are set.
+ */
+static __inline__ int
+direct_util_count_bits( unsigned int mask )
+{
+     register int ret = 0;
+
+     while (mask) {
+          ret += mask & 1;
+          mask >>= 1;
+     }
+
+     return ret;
+}
+
+/*
+ * Generic alignment routine.
+ */
+static __inline__ int
+direct_util_align( int value,
+                   int alignment )
+{
+     if (alignment > 1) {
+          int tail = value % alignment;
+
+          if (tail)
+               value += alignment - tail;
+     }
+
+     return value;
+}
+
+/*
+ * Utility function to initialize recursive mutexes.
+ */
+int direct_util_recursive_pthread_mutex_init( pthread_mutex_t *mutex );
+
+/*
+ * Utility function to calibrate timeout for monotonic condition.
+ */
+void direct_util_get_monotonic_pthread_timeout( struct timespec *timeout,
+                                                int seconds,
+                                                int nano_seconds );
+
+/*
+ * Utility function to initialize monotonic condition.
+ */
+int direct_util_monotonic_pthread_cond_init( pthread_cond_t *cond );
+
+/* floor and ceil implementation to get rid of libm */
+
+/*
+ IEEE floor for computers that round to nearest or even.
+
+ 'f' must be between -4194304 and 4194303.
+
+ This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
+ but uses some IEEE specific tricks for better speed.
+*/
+static __inline__ int
+D_IFLOOR(float f)
+{
+        int ai, bi;
+        double af, bf;
+
+        af = (3 << 22) + 0.5 + (double)f;
+        bf = (3 << 22) + 0.5 - (double)f;
+
+#if defined(__GNUC__) && defined(__i386__)
+        /*
+         GCC generates an extra fstp/fld without this.
+        */
+        __asm__ __volatile__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+        __asm__ __volatile__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+#else
+        {
+                union { int i; float f; } u;
+                u.f = af; ai = u.i;
+                u.f = bf; bi = u.i;
+        }
+#endif
+
+        return (ai - bi) >> 1;
+}
+
+
+/*
+ IEEE ceil for computers that round to nearest or even.
+
+ 'f' must be between -4194304 and 4194303.
+
+ This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
+ but uses some IEEE specific tricks for better speed.
+*/
+static __inline__ int
+D_ICEIL(float f)
+{
+        int ai, bi;
+        double af, bf;
+
+        af = (3 << 22) + 0.5 + (double)f;
+        bf = (3 << 22) + 0.5 - (double)f;
+
+#if defined(__GNUC__) && defined(__i386__)
+        /*
+         GCC generates an extra fstp/fld without this.
+        */
+        __asm__ __volatile__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+        __asm__ __volatile__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+#else
+        {
+                union { int i; float f; } u;
+                u.f = af; ai = u.i;
+                u.f = bf; bi = u.i;
+        }
+#endif
+
+        return (ai - bi + 1) >> 1;
+}
+
+static __inline__ int
+direct_log2( int val )
+{
+     register int ret = 0;
+
+     while (val >> ++ret);
+
+     if ((1 << --ret) < val)
+          ret++;
+
+     return ret;
+}
+
+
+#endif
diff --git a/Source/DirectFB/lib/fusion/Makefile.am b/Source/DirectFB/lib/fusion/Makefile.am
new file mode 100755
index 0000000..b97afe1
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/Makefile.am
@@ -0,0 +1,100 @@
+## Makefile.am for DirectFB/lib/fusion
+
+SUBDIRS = shm
+
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = fusion.pc
+
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/core/fusion
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/fusion
+
+
+includedir = @INCLUDEDIR@/fusion
+
+include_HEADERS = \
+	arena.h			\
+	build.h			\
+	call.h			\
+	conf.h			\
+	fusion.h		\
+	fusion_internal.h	\
+	hash.h			\
+	lock.h			\
+	object.h		\
+	property.h		\
+	protocol.h		\
+	reactor.h		\
+	ref.h			\
+	shmalloc.h		\
+	types.h			\
+	vector.h
+
+
+lib_LTLIBRARIES = libfusion.la
+
+libfusion_la_SOURCES = \
+	arena.c			\
+	call.c			\
+	conf.c			\
+	fusion.c		\
+	hash.c			\
+	lock.c			\
+	object.c		\
+	property.c		\
+	reactor.c		\
+	ref.c			\
+	shmalloc.c		\
+	vector.c
+
+libfusion_la_LIBADD = \
+	shm/libfusion_shm.la	\
+	../direct/libdirect.la
+
+libfusion_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)                              	\
+	$(DFB_LDFLAGS)
+
+
+#
+## and now rebuild the static version with the *correct* object files
+#
+if BUILD_STATIC
+
+clean-local:
+	rm -f libfusion_fixed.a
+
+all-local: libfusion_fixed.a
+
+libfusion_fixed.a: .libs/libfusion.a
+	rm -f libfusion_fixed.a
+	${AR} cru libfusion_fixed.a `find . -name "*.o" | grep -v '.libs'`
+	${RANLIB} libfusion_fixed.a
+	cp -pf libfusion_fixed.a .libs/libfusion.a
+
+.libs/libfusion.a: libfusion.la
+
+else
+
+clean-local:
+
+all-local:
+
+endif
+
+
+include $(top_srcdir)/rules/nmfile.make
diff --git a/Source/DirectFB/lib/fusion/Makefile.in b/Source/DirectFB/lib/fusion/Makefile.in
new file mode 100755
index 0000000..34f267d
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/Makefile.in
@@ -0,0 +1,804 @@
+# 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 = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/build.h.in \
+	$(srcdir)/fusion.pc.in $(top_srcdir)/rules/nmfile.make
+subdir = lib/fusion
+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 = build.h fusion.pc
+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)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
+	"$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libfusion_la_DEPENDENCIES = shm/libfusion_shm.la \
+	../direct/libdirect.la
+am_libfusion_la_OBJECTS = arena.lo call.lo conf.lo fusion.lo hash.lo \
+	lock.lo object.lo property.lo reactor.lo ref.lo shmalloc.lo \
+	vector.lo
+libfusion_la_OBJECTS = $(am_libfusion_la_OBJECTS)
+libfusion_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libfusion_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 = $(libfusion_la_SOURCES)
+DIST_SOURCES = $(libfusion_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@/fusion
+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@
+SUBDIRS = shm
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = fusion.pc
+include_HEADERS = \
+	arena.h			\
+	build.h			\
+	call.h			\
+	conf.h			\
+	fusion.h		\
+	fusion_internal.h	\
+	hash.h			\
+	lock.h			\
+	object.h		\
+	property.h		\
+	protocol.h		\
+	reactor.h		\
+	ref.h			\
+	shmalloc.h		\
+	types.h			\
+	vector.h
+
+lib_LTLIBRARIES = libfusion.la
+libfusion_la_SOURCES = \
+	arena.c			\
+	call.c			\
+	conf.c			\
+	fusion.c		\
+	hash.c			\
+	lock.c			\
+	object.c		\
+	property.c		\
+	reactor.c		\
+	ref.c			\
+	shmalloc.c		\
+	vector.c
+
+libfusion_la_LIBADD = \
+	shm/libfusion_shm.la	\
+	../direct/libdirect.la
+
+libfusion_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)                              	\
+	$(DFB_LDFLAGS)
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@LIBTONM = $(LTLIBRARIES:.la=-$(LT_RELEASE).so.$(LT_BINARY))
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/nmfile.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  lib/fusion/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  lib/fusion/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
+build.h: $(top_builddir)/config.status $(srcdir)/build.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+fusion.pc: $(top_builddir)/config.status $(srcdir)/fusion.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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
+libfusion.la: $(libfusion_la_OBJECTS) $(libfusion_la_DEPENDENCIES) 
+	$(libfusion_la_LINK) -rpath $(libdir) $(libfusion_la_OBJECTS) $(libfusion_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arena.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/call.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/property.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reactor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.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-pkgconfigDATA: $(pkgconfig_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+
+uninstall-pkgconfigDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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."
+@BUILD_SHARED_FALSE@install-data-local:
+@ENABLE_TRACE_FALSE@install-data-local:
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-includeHEADERS \
+	install-pkgconfigDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-exec-local install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
+	uninstall-pkgconfigDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am all-local check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool clean-local ctags \
+	ctags-recursive 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-data-local install-dvi install-dvi-am \
+	install-exec install-exec-am install-exec-local install-html \
+	install-html-am install-includeHEADERS install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-includeHEADERS \
+	uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
+
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/core/fusion
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/fusion
+
+#
+#
+
+@BUILD_STATIC_TRUE@clean-local:
+@BUILD_STATIC_TRUE@	rm -f libfusion_fixed.a
+
+@BUILD_STATIC_TRUE@all-local: libfusion_fixed.a
+
+@BUILD_STATIC_TRUE@libfusion_fixed.a: .libs/libfusion.a
+@BUILD_STATIC_TRUE@	rm -f libfusion_fixed.a
+@BUILD_STATIC_TRUE@	${AR} cru libfusion_fixed.a `find . -name "*.o" | grep -v '.libs'`
+@BUILD_STATIC_TRUE@	${RANLIB} libfusion_fixed.a
+@BUILD_STATIC_TRUE@	cp -pf libfusion_fixed.a .libs/libfusion.a
+
+@BUILD_STATIC_TRUE@.libs/libfusion.a: libfusion.la
+
+@BUILD_STATIC_FALSE@clean-local:
+
+@BUILD_STATIC_FALSE@all-local:
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@install-data-local:
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	mkdir -p -- "$(DESTDIR)$(libdir)"
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	nm -n ".libs/$(LIBTONM)" > "$(DESTDIR)$(libdir)/nm-n.$(LIBTONM)"
+# 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/lib/fusion/arena.c b/Source/DirectFB/lib/fusion/arena.c
new file mode 100755
index 0000000..9d86dca
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/arena.c
@@ -0,0 +1,566 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <fusion/build.h>
+#include <fusion/types.h>
+#include <fusion/lock.h>
+#include <fusion/hash.h>
+#include <fusion/ref.h>
+#include <fusion/arena.h>
+#include <fusion/shm/shm.h>
+#include <fusion/shmalloc.h>
+
+#include "fusion_internal.h"
+
+
+#if FUSION_BUILD_MULTI
+
+D_DEBUG_DOMAIN( Fusion_Arena, "Fusion/Arena", "Fusion Arena" );
+
+struct __Fusion_FusionArena {
+     DirectLink         link;
+
+     int                magic;
+
+     FusionWorldShared *shared;
+
+     FusionSkirmish     lock;
+     FusionRef          ref;
+
+     char              *name;
+
+     FusionHash        *field_hash;
+};
+
+/**********************************************************************************************************************/
+
+static FusionArena *lock_arena  ( FusionWorld *world,
+                                  const char  *name,
+                                  bool         add );
+
+static void         unlock_arena( FusionArena *arena );
+
+/**********************************************************************************************************************/
+
+DirectResult
+fusion_arena_enter (FusionWorld     *world,
+                    const char      *name,
+                    ArenaEnterFunc   initialize,
+                    ArenaEnterFunc   join,
+                    void            *ctx,
+                    FusionArena    **ret_arena,
+                    int             *ret_error)
+{
+     FusionArena       *arena;
+     FusionWorldShared *shared;
+     ArenaEnterFunc     func;
+     int                error = 0;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_ASSERT( name != NULL );
+     D_ASSERT( initialize != NULL );
+     D_ASSERT( join != NULL );
+     D_ASSERT( ret_arena != NULL );
+
+     D_DEBUG_AT( Fusion_Arena, "%s( '%s' )\n", __FUNCTION__, name );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     /* Lookup arena and lock it. If it doesn't exist create it. */
+     arena = lock_arena( world, name, true );
+     if (!arena)
+          return DR_FAILURE;
+
+     /* Check if we are the first. */
+     if (fusion_ref_zero_trylock( &arena->ref ) == DR_OK) {
+          D_DEBUG ("Fusion/Arena: entering arena '%s' (establishing)\n", name);
+
+          /* Call 'initialize' later. */
+          func = initialize;
+
+          /* Unlock the reference counter. */
+          fusion_ref_unlock( &arena->ref );
+     }
+     else {
+          D_DEBUG ("Fusion/Arena: entering arena '%s' (joining)\n", name);
+
+          fusion_shm_attach_unattached( world );
+
+          /* Call 'join' later. */
+          func = join;
+     }
+
+     /* Increase reference counter. */
+     fusion_ref_up (&arena->ref, false);
+
+     /* Return the arena. */
+     *ret_arena = arena;
+
+     /* Call 'initialize' or 'join'. */
+     error = func (arena, ctx);
+
+     /* Return the return value of the callback. */
+     if (ret_error)
+          *ret_error = error;
+
+     if (error) {
+          fusion_ref_down (&arena->ref, false);
+
+          if (func == initialize) {
+               /* Destroy fields. */
+               fusion_hash_destroy( arena->field_hash );
+
+               /* Destroy reference counter. */
+               fusion_ref_destroy( &arena->ref );
+
+               /* Destroy the arena lock. This has to happen before
+                  locking the list. Otherwise a dead lock with lock_arena()
+                  below could occur. */
+               fusion_skirmish_destroy( &arena->lock );
+
+               /* Lock the list and remove the arena. */
+               fusion_skirmish_prevail( &shared->arenas_lock );
+               direct_list_remove( &shared->arenas, &arena->link );
+               fusion_skirmish_dismiss( &shared->arenas_lock );
+
+               D_MAGIC_CLEAR( arena );
+
+               /* Free allocated memory. */
+               SHFREE( shared->main_pool, arena->name );
+               SHFREE( shared->main_pool, arena );
+
+               return DR_OK;
+          }
+     }
+
+     /* Unlock the arena. */
+     unlock_arena( arena );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_arena_add_shared_field (FusionArena *arena,
+                               const char  *name,
+                               void        *data)
+{
+     DirectResult       ret;
+     FusionWorldShared *shared;
+     char              *shname;
+
+     D_ASSERT( arena != NULL );
+     D_ASSERT( data != NULL );
+     D_ASSERT( name != NULL );
+
+     D_MAGIC_ASSERT( arena, FusionArena );
+
+     D_DEBUG_AT( Fusion_Arena, "%s( '%s', '%s' -> %p )\n", __FUNCTION__, arena->name, name, data );
+
+     shared = arena->shared;
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     /* Lock the arena. */
+     ret = fusion_skirmish_prevail( &arena->lock );
+     if (ret)
+          return ret;
+
+     /* Give it the requested name. */
+     shname = SHSTRDUP( shared->main_pool, name );
+     if (shname)
+          ret = fusion_hash_replace( arena->field_hash, shname, data, NULL, NULL );
+     else
+          ret = D_OOSHM();
+
+     /* Unlock the arena. */
+     fusion_skirmish_dismiss( &arena->lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_arena_get_shared_field (FusionArena  *arena,
+                               const char   *name,
+                               void        **data)
+{
+     void *ptr;
+
+     D_ASSERT( arena != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( data != NULL );
+
+     D_MAGIC_ASSERT( arena, FusionArena );
+
+     D_DEBUG_AT( Fusion_Arena, "%s( '%s', '%s' )\n", __FUNCTION__, arena->name, name );
+
+     /* Lock the arena. */
+     if (fusion_skirmish_prevail( &arena->lock ))
+          return DR_FAILURE;
+
+     /* Lookup entry. */
+     ptr = fusion_hash_lookup( arena->field_hash, name );
+
+     D_DEBUG_AT( Fusion_Arena, "  -> %p\n", ptr );
+
+     /* Unlock the arena. */
+     fusion_skirmish_dismiss( &arena->lock );
+
+     if (!ptr)
+          return DR_ITEMNOTFOUND;
+
+     *data = ptr;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_arena_exit (FusionArena   *arena,
+                   ArenaExitFunc  shutdown,
+                   ArenaExitFunc  leave,
+                   void          *ctx,
+                   bool           emergency,
+                   int           *ret_error)
+{
+     int error = 0;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( arena, FusionArena );
+
+     D_DEBUG_AT( Fusion_Arena, "%s( '%s' )\n", __FUNCTION__, arena->name );
+
+     D_ASSERT( shutdown != NULL );
+
+     shared = arena->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     /* Lock the arena. */
+     if (fusion_skirmish_prevail( &arena->lock ))
+          return DR_FAILURE;
+
+     /* Decrease reference counter. */
+     fusion_ref_down( &arena->ref, false );
+
+     /* If we are the last... */
+     if (fusion_ref_zero_trylock( &arena->ref ) == DR_OK) {
+          /* Deinitialize everything. */
+          error = shutdown( arena, ctx, emergency );
+
+          /* Destroy fields. */
+          fusion_hash_destroy( arena->field_hash );
+
+          /* Destroy reference counter. */
+          fusion_ref_destroy( &arena->ref );
+
+          /* Destroy the arena lock. This has to happen before
+             locking the list. Otherwise a dead lock with lock_arena()
+             below could occur. */
+          fusion_skirmish_destroy( &arena->lock );
+
+          /* Lock the list and remove the arena. */
+          fusion_skirmish_prevail( &shared->arenas_lock );
+          direct_list_remove( &shared->arenas, &arena->link );
+          fusion_skirmish_dismiss( &shared->arenas_lock );
+
+          D_MAGIC_CLEAR( arena );
+
+          /* Free allocated memory. */
+          SHFREE( shared->main_pool, arena->name );
+          SHFREE( shared->main_pool, arena );
+     }
+     else {
+          if (!leave) {
+               fusion_ref_up( &arena->ref, false );
+               fusion_skirmish_dismiss( &arena->lock );
+               return DR_BUSY;
+          }
+
+          /* Simply leave the arena. */
+          error = leave( arena, ctx, emergency );
+
+          /* Unlock the arena. */
+          fusion_skirmish_dismiss( &arena->lock );
+     }
+
+     /* Return the return value of the callback. */
+     if (ret_error)
+          *ret_error = error;
+
+     return DR_OK;
+}
+
+
+/*****************************
+ *  File internal functions  *
+ *****************************/
+
+static FusionArena *
+create_arena( FusionWorld *world,
+              const char  *name )
+{
+     DirectResult       ret;
+     char               buf[64];
+     FusionArena       *arena;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( name != NULL );
+
+     shared = world->shared;
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     arena = SHCALLOC( shared->main_pool, 1, sizeof(FusionArena) );
+     if (!arena) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     arena->shared = shared;
+
+     snprintf( buf, sizeof(buf), "Arena '%s'", name );
+
+     /* Initialize lock and reference counter. */
+     ret = fusion_skirmish_init( &arena->lock, buf, world );
+     if (ret)
+          goto error;
+
+     ret = fusion_ref_init( &arena->ref, buf, world );
+     if (ret)
+          goto error_ref;
+
+     /* Give it the requested name. */
+     arena->name = SHSTRDUP( shared->main_pool, name );
+     if (!arena->name) {
+          D_OOSHM();
+          goto error_prevail;
+     }
+
+     ret = fusion_hash_create( shared->main_pool, HASH_STRING, HASH_PTR, 7, &arena->field_hash );
+     if (ret)
+          goto error_hash;
+
+     fusion_hash_set_autofree( arena->field_hash, true, false );
+
+     /* Add it to the list. */
+     direct_list_prepend( &shared->arenas, &arena->link );
+
+     /* Lock the newly created arena. */
+     ret = fusion_skirmish_prevail( &arena->lock );
+     if (ret)
+          goto error_prevail;
+
+     D_MAGIC_SET( arena, FusionArena );
+
+     /* Returned locked new arena. */
+     return arena;
+
+
+error_prevail:
+     fusion_hash_destroy( arena->field_hash );
+
+error_hash:
+     if (arena->name)
+          SHFREE( shared->main_pool, arena->name );
+
+     fusion_ref_destroy( &arena->ref );
+
+error_ref:
+     fusion_skirmish_destroy( &arena->lock );
+
+error:
+     SHFREE( shared->main_pool, arena );
+
+     return NULL;
+}
+
+static FusionArena *
+lock_arena( FusionWorld *world,
+            const char  *name,
+            bool         add )
+{
+     FusionArena       *arena;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( name != NULL );
+
+     shared = world->shared;
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     /* Lock the list. */
+     if (fusion_skirmish_prevail( &shared->arenas_lock ))
+          return NULL;
+
+     /* For each exisiting arena... */
+     direct_list_foreach (arena, shared->arenas) {
+          /* Lock the arena.
+             This would fail if the arena has been
+             destroyed while waiting for the lock. */
+          if (fusion_skirmish_prevail( &arena->lock ))
+               continue;
+
+          D_MAGIC_ASSERT( arena, FusionArena );
+
+          /* Check if the name matches. */
+          if (! strcmp( arena->name, name )) {
+               /* Check for an orphaned arena. */
+               if (fusion_ref_zero_trylock( &arena->ref ) == DR_OK) {
+                    D_ERROR( "Fusion/Arena: orphaned arena '%s'!\n", name );
+
+                    fusion_ref_unlock( &arena->ref );
+
+//                    arena = NULL;
+               }
+
+               /* Unlock the list. */
+               fusion_skirmish_dismiss( &shared->arenas_lock );
+
+               /* Return locked arena. */
+               return arena;
+          }
+
+          /* Unlock mismatched arena. */
+          fusion_skirmish_dismiss( &arena->lock );
+     }
+
+     /* If no arena name matched, create a new arena
+        before unlocking the list again. */
+     arena = add ? create_arena( world, name ) : NULL;
+
+     /* Unlock the list. */
+     fusion_skirmish_dismiss( &shared->arenas_lock );
+
+     return arena;
+}
+
+static void
+unlock_arena( FusionArena *arena )
+{
+     D_ASSERT( arena != NULL );
+
+     D_MAGIC_ASSERT( arena, FusionArena );
+
+     /* Unlock the arena. */
+     fusion_skirmish_dismiss( &arena->lock );
+}
+
+#else
+
+DirectResult
+fusion_arena_enter (FusionWorld    *world,
+                    const char     *name,
+                    ArenaEnterFunc  initialize,
+                    ArenaEnterFunc  join,
+                    void           *ctx,
+                    FusionArena   **ret_arena,
+                    int            *ret_error)
+{
+     int error;
+
+     D_ASSERT( name != NULL );
+     D_ASSERT( initialize != NULL );
+     D_ASSERT( join != NULL );
+     D_ASSERT( ret_arena != NULL );
+
+     /* Always call 'initialize'. */
+     error = initialize (NULL, ctx);
+
+     /* Return the return value of the callback. */
+     if (ret_error)
+          *ret_error = error;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_arena_add_shared_field (FusionArena *arena,
+                               const char  *name,
+                               void        *data)
+{
+     D_ASSERT( data != NULL );
+     D_ASSERT( name != NULL );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_arena_get_shared_field (FusionArena  *arena,
+                               const char   *name,
+                               void        **data)
+{
+     D_ASSERT( data != NULL );
+     D_ASSERT( name != NULL );
+
+     D_BUG( "should not call this in fake mode" );
+
+     /* No field by that name has been found. */
+     return DR_ITEMNOTFOUND;
+}
+
+DirectResult
+fusion_arena_exit (FusionArena   *arena,
+                   ArenaExitFunc  shutdown,
+                   ArenaExitFunc  leave,
+                   void          *ctx,
+                   bool           emergency,
+                   int           *ret_error)
+{
+     int error = 0;
+
+     D_ASSERT( shutdown != NULL );
+
+     /* Deinitialize everything. */
+     error = shutdown( arena, ctx, emergency );
+
+     /* Return the return value of the callback. */
+     if (ret_error)
+          *ret_error = error;
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/arena.h b/Source/DirectFB/lib/fusion/arena.h
new file mode 100755
index 0000000..d11d134
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/arena.h
@@ -0,0 +1,62 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__ARENA_H__
+#define __FUSION__ARENA_H__
+
+#include <fusion/types.h>
+
+typedef int (*ArenaEnterFunc) (FusionArena *arena, void *ctx);
+typedef int (*ArenaExitFunc) (FusionArena *arena, void *ctx, bool emergency);
+
+
+DirectResult fusion_arena_enter            (FusionWorld     *world,
+                                            const char      *name,
+                                            ArenaEnterFunc   initialize,
+                                            ArenaEnterFunc   join,
+                                            void            *ctx,
+                                            FusionArena    **ret_arena,
+                                            int             *ret_error);
+
+DirectResult fusion_arena_add_shared_field (FusionArena     *arena,
+                                            const char      *name,
+                                            void            *data);
+
+DirectResult fusion_arena_get_shared_field (FusionArena     *arena,
+                                            const char      *name,
+                                            void           **data);
+
+DirectResult fusion_arena_exit             (FusionArena     *arena,
+                                            ArenaExitFunc    shutdown,
+                                            ArenaExitFunc    leave,
+                                            void            *ctx,
+                                            bool             emergency,
+                                            int             *ret_error);
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/build.h.in b/Source/DirectFB/lib/fusion/build.h.in
new file mode 100755
index 0000000..74b4128
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/build.h.in
@@ -0,0 +1,36 @@
+/*
+   (c) Copyright 2000-2002  convergence integrated media GmbH.
+   (c) Copyright 2002-2004  convergence GmbH.
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org> and
+              Ville Syrjälä <syrjala@sci.fi>.
+
+   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 __FUSION__BUILD_H__
+#define __FUSION__BUILD_H__
+
+#define FUSION_BUILD_MULTI   (@FUSION_BUILD_MULTI@)
+#define FUSION_BUILD_KERNEL  (@FUSION_BUILD_KERNEL@)
+#define FUSION_MESSAGE_SIZE  (@FUSION_MESSAGE_SIZE@)
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/call.c b/Source/DirectFB/lib/fusion/call.c
new file mode 100755
index 0000000..71ce5e5
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/call.c
@@ -0,0 +1,581 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fusion/build.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+#include <fusion/types.h>
+#include <fusion/call.h>
+#include <fusion/conf.h>
+
+#include "fusion_internal.h"
+
+
+D_DEBUG_DOMAIN( Fusion_Call, "Fusion/Call", "Fusion Call" );
+
+
+#if FUSION_BUILD_MULTI
+
+#if FUSION_BUILD_KERNEL
+
+DirectResult
+fusion_call_init (FusionCall        *call,
+                  FusionCallHandler  handler,
+                  void              *ctx,
+                  const FusionWorld *world)
+{
+     FusionCallNew call_new;
+
+     D_DEBUG_AT( Fusion_Call, "%s( %p, %p <%s>, %p, %p )\n", __FUNCTION__, call, handler,
+                 direct_trace_lookup_symbol_at( handler ), ctx, world );
+
+     D_ASSERT( call != NULL );
+     D_ASSERT( handler != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+
+     /* Called from others. */
+     call_new.handler = handler;
+     call_new.ctx     = ctx;
+
+     while (ioctl( world->fusion_fd, FUSION_CALL_NEW, &call_new )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_CALL_NEW");
+
+          return DR_FAILURE;
+     }
+
+     memset( call, 0, sizeof(FusionCall) );
+
+     /* Store handler, called directly when called by ourself. */
+     call->handler = handler;
+     call->ctx     = ctx;
+
+     /* Store call and own fusion id. */
+     call->call_id   = call_new.call_id;
+     call->fusion_id = fusion_id( world );
+
+     /* Keep back pointer to shared world data. */
+     call->shared = world->shared;
+
+     D_DEBUG_AT( Fusion_Call, "  -> call id %d\n", call->call_id );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_execute (FusionCall          *call,
+                     FusionCallExecFlags  flags,
+                     int                  call_arg,
+                     void                *call_ptr,
+                     int                 *ret_val)
+{
+     D_DEBUG_AT( Fusion_Call, "%s( %p, 0x%x, %d, %p )\n", __FUNCTION__, call, flags, call_arg, call_ptr );
+
+     D_ASSERT( call != NULL );
+
+     if (!call->handler)
+          return DR_DESTROYED;
+
+     D_DEBUG_AT( Fusion_Call, "  -> %s\n", direct_trace_lookup_symbol_at( call->handler ) );
+
+     if (!(flags & FCEF_NODIRECT) && call->fusion_id == _fusion_id( call->shared )) {
+          int                     ret;
+          FusionCallHandlerResult result;
+
+          result = call->handler( _fusion_id( call->shared ), call_arg, call_ptr, call->ctx, 0, &ret );
+
+          if (result != FCHR_RETURN)
+               D_WARN( "local call handler returned FCHR_RETAIN, need FCEF_NODIRECT" );
+
+          if (ret_val)
+               *ret_val = ret;
+     }
+     else {
+          FusionCallExecute execute;
+
+          execute.call_id  = call->call_id;
+          execute.call_arg = call_arg;
+          execute.call_ptr = call_ptr;
+          execute.flags    = flags;
+
+          while (ioctl( _fusion_fd( call->shared ), FUSION_CALL_EXECUTE, &execute )) {
+               switch (errno) {
+                    case EINTR:
+                         continue;
+                    case EINVAL:
+//                         D_ERROR ("Fusion/Call: invalid call\n");
+                         return DR_INVARG;
+                    case EIDRM:
+                         return DR_DESTROYED;
+                    default:
+                         break;
+               }
+
+               D_PERROR ("FUSION_CALL_EXECUTE");
+
+               return DR_FAILURE;
+          }
+
+          if (ret_val)
+               *ret_val = execute.ret_val;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_return( FusionCall   *call,
+                    unsigned int  serial,
+                    int           val )
+{
+     FusionCallReturn call_ret;
+
+     D_DEBUG_AT( Fusion_Call, "%s( %p, %u, %d )\n", __FUNCTION__, call, serial, val );
+
+     D_ASSERT( call != NULL );
+
+     D_DEBUG_AT( Fusion_Call, "  -> %s\n", direct_trace_lookup_symbol_at( call->handler ) );
+
+     D_ASSUME( serial != 0 );
+     if (!serial)
+          return DR_UNSUPPORTED;
+
+     call_ret.call_id = call->call_id;
+     call_ret.val     = val;
+     call_ret.serial  = serial;
+
+     while (ioctl (_fusion_fd( call->shared ), FUSION_CALL_RETURN, &call_ret)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EIDRM:
+                    D_WARN( "caller withdrawn (signal?)" );
+                    return DR_NOCONTEXT;
+               case EINVAL:
+                    D_ERROR( "Fusion/Call: invalid call\n" );
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_CALL_RETURN");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_destroy (FusionCall *call)
+{
+     D_DEBUG_AT( Fusion_Call, "%s( %p )\n", __FUNCTION__, call );
+
+     D_ASSERT( call != NULL );
+     D_ASSERT( call->handler != NULL );
+
+     D_DEBUG_AT( Fusion_Call, "  -> %s\n", direct_trace_lookup_symbol_at( call->handler ) );
+
+     while (ioctl (_fusion_fd( call->shared ), FUSION_CALL_DESTROY, &call->call_id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Call: invalid call\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_CALL_DESTROY");
+
+          return DR_FAILURE;
+     }
+
+     call->handler = NULL;
+
+     return DR_OK;
+}
+
+void
+_fusion_call_process( FusionWorld *world, int call_id, FusionCallMessage *msg )
+{
+     FusionCallHandler       call_handler;
+     FusionCallReturn        call_ret;
+     FusionCallHandlerResult result;
+
+     D_DEBUG_AT( Fusion_Call, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( msg != NULL );
+
+     call_handler = msg->handler;
+
+     D_ASSERT( call_handler != NULL );
+
+     D_DEBUG_AT( Fusion_Call, "  -> %s\n", direct_trace_lookup_symbol_at( call_handler ) );
+
+     call_ret.val = 0;
+
+     result = call_handler( msg->caller, msg->call_arg, msg->call_ptr, msg->ctx, msg->serial, &call_ret.val );
+
+     switch (result) {
+          case FCHR_RETURN:
+               if (msg->serial) {
+                    call_ret.serial  = msg->serial;
+                    call_ret.call_id = call_id;
+
+                    while (ioctl (world->fusion_fd, FUSION_CALL_RETURN, &call_ret)) {
+                         switch (errno) {
+                              case EINTR:
+                                   continue;
+                              case EIDRM:
+                                   D_WARN( "caller withdrawn (signal?)" );
+                                   return;
+                              case EINVAL:
+                                   D_ERROR( "Fusion/Call: invalid call\n" );
+                                   return;
+                              default:
+                                   D_PERROR( "FUSION_CALL_RETURN" );
+                                   return;
+                         }
+                    }
+               }
+               break;
+
+          case FCHR_RETAIN:
+               break;
+
+          default:
+               D_BUG( "unknown result %d from call handler", result );
+     }
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+
+DirectResult
+fusion_call_init (FusionCall        *call,
+                  FusionCallHandler  handler,
+                  void              *ctx,
+                  const FusionWorld *world)
+{
+     D_ASSERT( call != NULL );
+     D_ASSERT( handler != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+
+     memset( call, 0, sizeof(FusionCall) );
+
+     call->call_id = ++world->shared->call_ids;
+
+     /* Store handler, called directly when called by ourself. */
+     call->handler = handler;
+     call->ctx     = ctx;
+
+     /* Store own fusion id. */
+     call->fusion_id = fusion_id( world );
+
+     /* Keep back pointer to shared world data. */
+     call->shared = world->shared;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_execute (FusionCall          *call,
+                     FusionCallExecFlags  flags,
+                     int                  call_arg,
+                     void                *call_ptr,
+                     int                 *ret_val)
+{
+     DirectResult        ret = DR_OK;
+     FusionWorld        *world;
+     FusionCallMessage   msg;
+     struct sockaddr_un  addr;
+     
+     D_ASSERT( call != NULL );
+
+     if (!call->handler)
+          return DR_DESTROYED;
+
+     if (!(flags & FCEF_NODIRECT) && call->fusion_id == _fusion_id( call->shared )) {
+          int                     ret;
+          FusionCallHandlerResult result;
+
+          result = call->handler( _fusion_id( call->shared ), call_arg, call_ptr, call->ctx, 0, &ret );
+
+          if (result != FCHR_RETURN)
+               D_WARN( "local call handler returned FCHR_RETAIN, need FCEF_NODIRECT" );
+
+          if (ret_val)
+               *ret_val = ret;
+               
+          return DR_OK;
+     }
+     
+     world = _fusion_world( call->shared );
+     
+     msg.type     = FMT_CALL;  
+     msg.caller   = world->fusion_id;
+     msg.call_id  = call->call_id;
+     msg.call_arg = call_arg;
+     msg.call_ptr = call_ptr; 
+     msg.handler  = call->handler;
+     msg.ctx      = call->ctx;
+     msg.flags    = flags;
+     
+     if (flags & FCEF_ONEWAY) {
+          /* Invalidate serial. */
+          msg.serial = -1;
+          
+          /* Send message. */
+          addr.sun_family = AF_UNIX;
+          snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                    "/tmp/.fusion-%d/%lx", call->shared->world_index, call->fusion_id );
+         
+          ret = _fusion_send_message( world->fusion_fd, &msg, sizeof(msg), &addr );
+     }
+     else {
+          int       fd;
+          socklen_t len;
+          int       err;
+
+          fd = socket( PF_LOCAL, SOCK_RAW, 0 );
+          if (fd < 0) {
+               D_PERROR( "Fusion/Call: Error creating local socket!\n" ) ;
+               return DR_IO;
+          }
+
+          /* Set close-on-exec flag. */
+          fcntl( fd, F_SETFD, FD_CLOEXEC );
+          
+          addr.sun_family = AF_UNIX;
+          len = snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                          "/tmp/.fusion-%d/call.%x.", fusion_world_index( world ), call->call_id ); 
+          
+          /* Generate call serial (socket address is based on it). */
+          for (msg.serial = 0; msg.serial <= 0xffffff; msg.serial++) {
+               snprintf( addr.sun_path+len, sizeof(addr.sun_path)-len, "%x", msg.serial );
+               err = bind( fd, (struct sockaddr*)&addr, sizeof(addr) );
+               if (err == 0) {
+                    chmod( addr.sun_path, 0660 );
+                    /* Change group, if requested. */
+                    if (fusion_config->shmfile_gid != (gid_t)-1)
+                         chown( addr.sun_path, -1, fusion_config->shmfile_gid );
+                    break;
+               }
+          }
+          
+          if (err < 0) {
+               D_PERROR( "Fusion/Call: Error binding local socket!\n" );
+               close( fd );
+               return DR_IO;
+          }
+
+          /* Send message. */
+          snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                    "/tmp/.fusion-%d/%lx", call->shared->world_index, call->fusion_id );
+          
+          ret = _fusion_send_message( fd, &msg, sizeof(msg), &addr );
+          if (ret == DR_OK) {
+               FusionCallReturn callret;
+               /* Wait for reply. */
+               ret = _fusion_recv_message( fd, &callret, sizeof(callret), NULL );
+               if (ret == DR_OK) {
+                    if (ret_val)
+                         *ret_val = callret.val;
+               } 
+          }
+          
+          len = sizeof(addr);
+          if (getsockname( fd, (struct sockaddr*)&addr, &len ) == 0)
+               unlink( addr.sun_path );
+          close( fd );
+     }
+
+     return ret;
+}
+
+DirectResult
+fusion_call_return( FusionCall   *call,
+                    unsigned int  serial,
+                    int           val )
+{
+     struct sockaddr_un addr;
+     FusionCallReturn   callret;
+     
+     D_ASSERT( call != NULL );
+
+     addr.sun_family = AF_UNIX;
+     snprintf( addr.sun_path, sizeof(addr.sun_path), 
+               "/tmp/.fusion-%d/call.%x.%x", call->shared->world_index, call->call_id, serial );
+               
+     callret.type = FMT_CALLRET;
+     callret.val  = val;
+               
+     return _fusion_send_message( _fusion_fd( call->shared ), &callret, sizeof(callret), &addr );
+}
+
+DirectResult
+fusion_call_destroy (FusionCall *call)
+{
+     D_ASSERT( call != NULL );
+     D_ASSERT( call->handler != NULL );
+
+     call->handler = NULL;
+
+     return DR_OK;
+}
+
+void
+_fusion_call_process( FusionWorld *world, int call_id, FusionCallMessage *msg )
+{
+     FusionCallHandler       call_handler;
+     FusionCallHandlerResult result;
+     FusionCallReturn        callret;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( msg != NULL );
+
+     call_handler = msg->handler;
+
+     D_ASSERT( call_handler != NULL );
+
+     callret.type = FMT_CALLRET;
+     callret.val  = 0;
+
+     result = call_handler( msg->caller, msg->call_arg, msg->call_ptr, msg->ctx, msg->serial, &callret.val );
+     switch (result) {
+          case FCHR_RETURN:
+               if (!(msg->flags & FCEF_ONEWAY)) {
+                    struct sockaddr_un addr;
+
+                    addr.sun_family = AF_UNIX;
+                    snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                              "/tmp/.fusion-%d/call.%x.%x", fusion_world_index( world ), call_id, msg->serial );
+               
+                    if (_fusion_send_message( world->fusion_fd, &callret, sizeof(callret), &addr ))
+                         D_ERROR( "Fusion/Call: Couldn't send call return (serial: 0x%08x)!\n", msg->serial );
+               }
+               break;
+
+          case FCHR_RETAIN:
+               break;
+
+          default:
+               D_BUG( "unknown result %d from call handler", result );
+               break;
+     }
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+#else  /* FUSION_BUILD_MULTI */
+
+DirectResult
+fusion_call_init (FusionCall        *call,
+                  FusionCallHandler  handler,
+                  void              *ctx,
+                  const FusionWorld *world)
+{
+     D_ASSERT( call != NULL );
+     D_ASSERT( call->handler == NULL );
+     D_ASSERT( handler != NULL );
+
+     /* Called locally. */
+     call->handler = handler;
+     call->ctx     = ctx;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_execute (FusionCall          *call,
+                     FusionCallExecFlags  flags,
+                     int                  call_arg,
+                     void                *call_ptr,
+                     int                 *ret_val)
+{
+     FusionCallHandlerResult ret;
+     int                     val = 0;
+
+     D_ASSERT( call != NULL );
+
+     if (!call->handler)
+          return DR_DESTROYED;
+
+     ret = call->handler( 1, call_arg, call_ptr, call->ctx, 0, &val );
+     if (ret != FCHR_RETURN)
+          D_WARN( "only FCHR_RETURN supported in single app core at the moment" );
+
+     if (ret_val)
+          *ret_val = val;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_call_return( FusionCall   *call,
+                    unsigned int  serial,
+                    int           val )
+{
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_call_destroy (FusionCall *call)
+{
+     D_ASSERT( call != NULL );
+     D_ASSERT( call->handler != NULL );
+
+     call->handler = NULL;
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/call.h b/Source/DirectFB/lib/fusion/call.h
new file mode 100755
index 0000000..e513696
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/call.h
@@ -0,0 +1,74 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__CALL_H__
+#define __FUSION__CALL_H__
+
+#include <fusion/types.h>
+
+typedef enum {
+     FCHR_RETURN,
+     FCHR_RETAIN
+} FusionCallHandlerResult;
+
+typedef FusionCallHandlerResult (*FusionCallHandler) (int           caller,   /* fusion id of the caller */
+                                                      int           call_arg, /* optional call parameter */
+                                                      void         *call_ptr, /* optional call parameter */
+                                                      void         *ctx,      /* optional handler context */
+                                                      unsigned int  serial,
+                                                      int          *ret_val );
+
+typedef struct {
+     FusionWorldShared *shared;
+     int                call_id;
+     FusionID           fusion_id;
+     FusionCallHandler  handler;
+     void              *ctx;
+} FusionCall;
+
+
+DirectResult fusion_call_init   ( FusionCall          *call,
+                                  FusionCallHandler    handler,
+                                  void                *ctx,
+                                  const FusionWorld   *world );
+
+DirectResult fusion_call_execute( FusionCall          *call,
+                                  FusionCallExecFlags  flags,
+                                  int                  call_arg,
+                                  void                *call_ptr,
+                                  int                 *ret_val );
+
+DirectResult fusion_call_return ( FusionCall          *call,
+                                  unsigned int         serial,
+                                  int                  val );
+
+DirectResult fusion_call_destroy( FusionCall          *call );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/conf.c b/Source/DirectFB/lib/fusion/conf.c
new file mode 100755
index 0000000..017364f
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/conf.c
@@ -0,0 +1,113 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stddef.h>
+#include <string.h>
+#include <grp.h>
+
+#include <direct/conf.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <fusion/conf.h>
+
+
+static FusionConfig config = {
+     .tmpfs       = NULL,
+     .shmfile_gid = -1,
+};
+
+FusionConfig *fusion_config       = &config;
+const char   *fusion_config_usage =
+     "libfusion options:\n"
+     "  force-slave                    Always enter as a slave, waiting for the master, if not there\n"
+     "  tmpfs=<directory>              Location of shared memory file\n"
+     "  shmfile-group=<groupname>      Group that owns shared memory files\n"
+     "  [no-]debugshm                  Enable shared memory allocation tracking\n"
+     "  [no-]madv-remove               Enable usage of MADV_REMOVE (default = auto)\n"
+     "\n";
+
+/**********************************************************************************************************************/
+
+DirectResult
+fusion_config_set( const char *name, const char *value )
+{
+     if (strcmp (name, "tmpfs" ) == 0) {
+          if (value) {
+               if (fusion_config->tmpfs)
+                    D_FREE( fusion_config->tmpfs );
+               fusion_config->tmpfs = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("Fusion/Config 'tmpfs': No directory specified!\n");
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "shmfile-group" ) == 0) {
+          if (value) {
+               struct group *group_info;
+               
+               group_info = getgrnam( value );
+               if (group_info)
+                    fusion_config->shmfile_gid = group_info->gr_gid;
+               else
+                    D_PERROR("Fusion/Config 'shmfile-group': Group '%s' not found!\n", value);
+          }
+          else {
+               D_ERROR("Fusion/Config 'shmfile-group': No file group name specified!\n");
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "force-slave" ) == 0) {
+          fusion_config->force_slave = true;
+     } else
+     if (strcmp (name, "no-force-slave" ) == 0) {
+          fusion_config->force_slave = false;
+     } else
+     if (strcmp (name, "debugshm" ) == 0) {
+          fusion_config->debugshm = true;
+     } else
+     if (strcmp (name, "no-debugshm" ) == 0) {
+          fusion_config->debugshm = false;
+     } else
+     if (strcmp (name, "madv-remove" ) == 0) {
+          fusion_config->madv_remove       = true;
+          fusion_config->madv_remove_force = true;
+     } else
+     if (strcmp (name, "no-madv-remove" ) == 0) {
+          fusion_config->madv_remove       = false;
+          fusion_config->madv_remove_force = true;
+     } else
+     if (direct_config_set( name, value ))
+          return DR_UNSUPPORTED;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/fusion/conf.h b/Source/DirectFB/lib/fusion/conf.h
new file mode 100755
index 0000000..0cdf9a2
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/conf.h
@@ -0,0 +1,55 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__CONF_H__
+#define __FUSION__CONF_H__
+
+
+#include <fusion/types.h>
+
+struct __Fusion_FusionConfig {
+     char *tmpfs;             /* location of shm file */
+
+     bool  debugshm;
+     bool  madv_remove;
+     bool  madv_remove_force;
+     bool  force_slave;
+
+     gid_t shmfile_gid;       /* group that owns shm file */     
+};
+
+extern FusionConfig *fusion_config;
+
+extern const char   *fusion_config_usage;
+
+
+DirectResult fusion_config_set( const char *name, const char *value );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/fusion.c b/Source/DirectFB/lib/fusion/fusion.c
new file mode 100755
index 0000000..2812f20
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/fusion.c
@@ -0,0 +1,2658 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <time.h>
+#include <fcntl.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <sys/utsname.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/thread.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+#include <fusion/build.h>
+#include <fusion/conf.h>
+#include <fusion/types.h>
+
+#include "fusion_internal.h"
+
+#include <fusion/shmalloc.h>
+
+#include <fusion/shm/shm.h>
+
+
+#if FUSION_BUILD_MULTI
+
+D_DEBUG_DOMAIN( Fusion_Main,          "Fusion/Main",          "Fusion - High level IPC" );
+D_DEBUG_DOMAIN( Fusion_Main_Dispatch, "Fusion/Main/Dispatch", "Fusion - High level IPC Dispatch" );
+
+/**********************************************************************************************************************/
+
+static void                      *fusion_dispatch_loop ( DirectThread *thread,
+                                                         void         *arg );
+
+/**********************************************************************************************************************/
+
+static void                       fusion_fork_handler_prepare( void );
+static void                       fusion_fork_handler_parent( void );
+static void                       fusion_fork_handler_child( void );
+
+/**********************************************************************************************************************/
+
+static FusionWorld     *fusion_worlds[FUSION_MAX_WORLDS];
+static pthread_mutex_t  fusion_worlds_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_once_t   fusion_init_once   = PTHREAD_ONCE_INIT;
+
+/**********************************************************************************************************************/
+
+int
+_fusion_fd( const FusionWorldShared *shared )
+{
+     int          index;
+     FusionWorld *world;
+
+//     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     index = shared->world_index;
+
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < FUSION_MAX_WORLDS );
+
+     world = fusion_worlds[index];
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return world->fusion_fd;
+}
+
+FusionID
+_fusion_id( const FusionWorldShared *shared )
+{
+     int          index;
+     FusionWorld *world;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     index = shared->world_index;
+
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < FUSION_MAX_WORLDS );
+
+     world = fusion_worlds[index];
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return world->fusion_id;
+}
+
+FusionWorld *
+_fusion_world( const FusionWorldShared *shared )
+{
+     int          index;
+     FusionWorld *world;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     index = shared->world_index;
+
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < FUSION_MAX_WORLDS );
+
+     world = fusion_worlds[index];
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return world;
+}
+
+/**********************************************************************************************************************/
+
+static void
+init_once( void )
+{
+     struct utsname uts;
+     int            i, j, k, l;
+
+     pthread_atfork( fusion_fork_handler_prepare, fusion_fork_handler_parent, fusion_fork_handler_child );
+
+     if (uname( &uts ) < 0) {
+          D_PERROR( "Fusion/Init: uname() failed!\n" );
+          return;
+     }
+     
+#if !FUSION_BUILD_KERNEL
+     D_INFO( "Fusion/Init: "
+             "Builtin Implementation is still experimental! Crash/Deadlocks might occur!\n" );
+#endif
+
+     if (fusion_config->madv_remove_force) {
+          if (fusion_config->madv_remove)
+               D_INFO( "Fusion/SHM: Using MADV_REMOVE (forced)\n" );
+          else
+               D_INFO( "Fusion/SHM: Not using MADV_REMOVE (forced)!\n" );
+     }
+     else {
+          switch (sscanf( uts.release, "%d.%d.%d.%d", &i, &j, &k, &l )) {
+               case 3:
+                    l = 0;
+               case 4:
+                    if (((i << 24) | (j << 16) | (k << 8) | l) >= 0x02061302)
+                         fusion_config->madv_remove = true;
+                    break;
+
+               default:
+                    D_WARN( "could not parse kernel version '%s'", uts.release );
+          }
+
+          if (fusion_config->madv_remove)
+               D_INFO( "Fusion/SHM: Using MADV_REMOVE (%d.%d.%d.%d >= 2.6.19.2)\n", i, j, k, l );
+          else
+               D_INFO( "Fusion/SHM: NOT using MADV_REMOVE (%d.%d.%d.%d < 2.6.19.2)! [0x%08x]\n",
+                       i, j, k, l, (i << 24) | (j << 16) | (k << 8) | l );
+     }
+}
+
+/**********************************************************************************************************************/
+
+#if FUSION_BUILD_KERNEL
+
+static void
+fusion_world_fork( FusionWorld *world )
+{
+     int                fd;
+     char               buf1[20];
+     char               buf2[20];
+     FusionEnter        enter;
+     FusionFork         fork;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     snprintf( buf1, sizeof(buf1), "/dev/fusion%d", shared->world_index );
+     snprintf( buf2, sizeof(buf2), "/dev/fusion/%d", shared->world_index );
+
+     /* Open Fusion Kernel Device. */
+     fd = direct_try_open( buf1, buf2, O_RDWR | O_NONBLOCK, true );
+     if (fd < 0) {
+          D_PERROR( "Fusion/Main: Reopening fusion device (world %d) failed!\n", shared->world_index );
+          raise(5);
+     }
+
+     /* Drop "identity" when running another program. */
+     if (fcntl( fd, F_SETFD, FD_CLOEXEC ) < 0)
+          D_PERROR( "Fusion/Init: Setting FD_CLOEXEC flag failed!\n" );
+
+     /* Fill enter information. */
+     enter.api.major = FUSION_API_MAJOR_REQUIRED;
+     enter.api.minor = FUSION_API_MINOR_REQUIRED;
+     enter.fusion_id = 0;     /* Clear for check below. */
+
+     /* Enter the fusion world. */
+     while (ioctl( fd, FUSION_ENTER, &enter )) {
+          if (errno != EINTR) {
+               D_PERROR( "Fusion/Init: Could not reenter world '%d'!\n", shared->world_index );
+               raise(5);
+          }
+     }
+
+     /* Check for valid Fusion ID. */
+     if (!enter.fusion_id) {
+          D_ERROR( "Fusion/Init: Got no ID from FUSION_ENTER! Kernel module might be too old.\n" );
+          raise(5);
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> Fusion ID 0x%08lx\n", enter.fusion_id );
+
+
+     /* Fill fork information. */
+     fork.fusion_id = world->fusion_id;
+
+     /* Fork within the fusion world. */
+     while (ioctl( fd, FUSION_FORK, &fork )) {
+          if (errno != EINTR) {
+               D_PERROR( "Fusion/Main: Could not fork in world '%d'!\n", shared->world_index );
+               raise(5);
+          }
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> Fusion ID 0x%08lx\n", fork.fusion_id );
+
+     /* Get new fusion id back. */
+     world->fusion_id = fork.fusion_id;
+
+     /* Close old file descriptor. */
+     close( world->fusion_fd );
+
+     /* Write back new file descriptor. */
+     world->fusion_fd = fd;
+
+
+     D_DEBUG_AT( Fusion_Main, "  -> restarting dispatcher loop...\n" );
+
+     /* Restart the dispatcher thread. FIXME: free old struct */
+     world->dispatch_loop = direct_thread_create( DTT_MESSAGING,
+                                                  fusion_dispatch_loop,
+                                                  world, "Fusion Dispatch" );
+     if (!world->dispatch_loop)
+          raise(5);
+}
+
+static void
+fusion_fork_handler_prepare( void )
+{
+     int i;
+     
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+     
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld *world = fusion_worlds[i];
+
+          if (!world)
+               continue;
+               
+          D_MAGIC_ASSERT( world, FusionWorld );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_PREPARE );
+     }
+}     
+
+static void
+fusion_fork_handler_parent( void )
+{
+     int i;
+
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+    
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld       *world = fusion_worlds[i];
+          FusionWorldShared *shared;
+
+          if (!world)
+               continue;
+               
+          D_MAGIC_ASSERT( world, FusionWorld );
+          
+          shared = world->shared;
+          
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_PARENT );
+               
+          if (world->fork_action == FFA_FORK) {
+               /* Increase the shared reference counter. */
+               if (fusion_master( world ))
+                    shared->refs++;
+          }
+     }
+}
+
+static void
+fusion_fork_handler_child( void )
+{
+     int i;
+
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld *world = fusion_worlds[i];
+
+          if (!world)
+               continue;
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_CHILD );
+
+          switch (world->fork_action) {
+               default:
+                    D_BUG( "unknown fork action %d", world->fork_action );
+
+               case FFA_CLOSE:
+                    D_DEBUG_AT( Fusion_Main, "  -> closing world %d\n", i );
+
+                    /* Remove world from global list. */
+                    fusion_worlds[i] = NULL;
+
+                    /* Unmap shared area. */
+                    munmap( world->shared, sizeof(FusionWorldShared) );
+
+                    /* Close Fusion Kernel Device. */
+                    close( world->fusion_fd );
+
+                    /* Free local world data. */
+                    D_MAGIC_CLEAR( world );
+                    D_FREE( world );
+
+                    break;
+
+               case FFA_FORK:
+                    D_DEBUG_AT( Fusion_Main, "  -> forking in world %d\n", i );
+
+                    fusion_world_fork( world );
+
+                    break;
+          }
+     }
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Enters a fusion world by joining or creating it.
+ *
+ * If <b>world</b> is negative, the next free index is used to create a new world.
+ * Otherwise the world with the specified index is joined or created.
+ */
+DirectResult
+fusion_enter( int               world_index,
+              int               abi_version,
+              FusionEnterRole   role,
+              FusionWorld     **ret_world )
+{
+     DirectResult       ret    = DR_OK;
+     int                fd     = -1;
+     FusionWorld       *world  = NULL;
+     FusionWorldShared *shared = NULL;
+     FusionEnter        enter;
+     char               buf1[20];
+     char               buf2[20];
+
+     D_DEBUG_AT( Fusion_Main, "%s( %d, %d, %p )\n", __FUNCTION__, world_index, abi_version, ret_world );
+
+     D_ASSERT( ret_world != NULL );
+
+     if (world_index >= FUSION_MAX_WORLDS) {
+          D_ERROR( "Fusion/Init: World index %d exceeds maximum index %d!\n", world_index, FUSION_MAX_WORLDS - 1 );
+          return DR_INVARG;
+     }
+
+     pthread_once( &fusion_init_once, init_once );
+
+
+     if (fusion_config->force_slave)
+          role = FER_SLAVE;
+
+     direct_initialize();
+
+     pthread_mutex_lock( &fusion_worlds_lock );
+
+
+     if (world_index < 0) {
+          if (role == FER_SLAVE) {
+               D_ERROR( "Fusion/Init: Slave role and a new world (index -1) was requested!\n" );
+               pthread_mutex_unlock( &fusion_worlds_lock );
+               return DR_INVARG;
+          }
+
+          for (world_index=0; world_index<FUSION_MAX_WORLDS; world_index++) {
+               world = fusion_worlds[world_index];
+               if (world)
+                    break;
+
+               snprintf( buf1, sizeof(buf1), "/dev/fusion%d", world_index );
+               snprintf( buf2, sizeof(buf2), "/dev/fusion/%d", world_index );
+
+               /* Open Fusion Kernel Device. */
+               fd = direct_try_open( buf1, buf2, O_RDWR | O_NONBLOCK | O_EXCL, false );
+               if (fd < 0) {
+                    if (errno != EBUSY)
+                         D_PERROR( "Fusion/Init: Error opening '%s' and/or '%s'!\n", buf1, buf2 );
+               }
+               else
+                    break;
+          }
+     }
+     else {
+          world = fusion_worlds[world_index];
+          if (!world) {
+               int flags = O_RDWR | O_NONBLOCK;
+
+               snprintf( buf1, sizeof(buf1), "/dev/fusion%d", world_index );
+               snprintf( buf2, sizeof(buf2), "/dev/fusion/%d", world_index );
+
+               if (role == FER_MASTER)
+                    flags |= O_EXCL;
+               else if (role == FER_SLAVE)
+                    flags |= O_APPEND;
+
+               /* Open Fusion Kernel Device. */
+               fd = direct_try_open( buf1, buf2, flags, true );
+          }
+     }
+
+     /* Enter a world again? */
+     if (world) {
+          D_MAGIC_ASSERT( world, FusionWorld );
+          D_ASSERT( world->refs > 0 );
+
+          /* Check the role again. */
+          switch (role) {
+               case FER_MASTER:
+                    if (world->fusion_id != FUSION_ID_MASTER) {
+                         D_ERROR( "Fusion/Init: Master role requested for a world (%d) "
+                                  "we're already slave in!\n", world_index );
+                         ret = DR_UNSUPPORTED;
+                         goto error;
+                    }
+                    break;
+
+               case FER_SLAVE:
+                    if (world->fusion_id == FUSION_ID_MASTER) {
+                         D_ERROR( "Fusion/Init: Slave role requested for a world (%d) "
+                                  "we're already master in!\n", world_index );
+                         ret = DR_UNSUPPORTED;
+                         goto error;
+                    }
+                    break;
+
+               case FER_ANY:
+                    break;
+          }
+
+          shared = world->shared;
+
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+          if (shared->world_abi != abi_version) {
+               D_ERROR( "Fusion/Init: World ABI (%d) of world '%d' doesn't match own (%d)!\n",
+                        shared->world_abi, world_index, abi_version );
+               ret = DR_VERSIONMISMATCH;
+               goto error;
+          }
+
+          world->refs++;
+
+          pthread_mutex_unlock( &fusion_worlds_lock );
+
+          D_DEBUG_AT( Fusion_Main, "  -> using existing world %p [%d]\n", world, world_index );
+
+          /* Return the world. */
+          *ret_world = world;
+
+          return DR_OK;
+     }
+
+     if (fd < 0) {
+          D_PERROR( "Fusion/Init: Opening fusion device (world %d) as '%s' failed!\n", world_index,
+                    role == FER_ANY ? "any" : (role == FER_MASTER ? "master" : "slave")  );
+          ret = DR_INIT;
+          goto error;
+     }
+
+     /* Drop "identity" when running another program. */
+     if (fcntl( fd, F_SETFD, FD_CLOEXEC ) < 0)
+          D_PERROR( "Fusion/Init: Setting FD_CLOEXEC flag failed!\n" );
+
+     /* Fill enter information. */
+     enter.api.major = FUSION_API_MAJOR_REQUIRED;
+     enter.api.minor = FUSION_API_MINOR_REQUIRED;
+     enter.fusion_id = 0;     /* Clear for check below. */
+
+     /* Enter the fusion world. */
+     while (ioctl( fd, FUSION_ENTER, &enter )) {
+          if (errno != EINTR) {
+               D_PERROR( "Fusion/Init: Could not enter world '%d'!\n", world_index );
+               ret = DR_INIT;
+               goto error;
+          }
+     }
+
+     /* Check for valid Fusion ID. */
+     if (!enter.fusion_id) {
+          D_ERROR( "Fusion/Init: Got no ID from FUSION_ENTER! Kernel module might be too old.\n" );
+          ret = DR_INIT;
+          goto error;
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> Fusion ID 0x%08lx\n", enter.fusion_id );
+
+     /* Check slave role only, master is handled by O_EXCL earlier. */
+     if (role == FER_SLAVE && enter.fusion_id == FUSION_ID_MASTER) {
+          D_PERROR( "Fusion/Init: Entering world '%d' as a slave failed!\n", world_index );
+          ret = DR_UNSUPPORTED;
+          goto error;
+     }
+
+     /* Map shared area. */
+     shared = mmap( (void*) 0x20000000 + 0x2000 * world_index, sizeof(FusionWorldShared),
+                    PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0 );
+     if (shared == MAP_FAILED) {
+          D_PERROR( "Fusion/Init: Mapping shared area failed!\n" );
+          goto error;
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> shared area at %p, size %zu\n", shared, sizeof(FusionWorldShared) );
+
+     /* Initialize shared data. */
+     if (enter.fusion_id == FUSION_ID_MASTER) {
+          /* Initialize reference counter. */
+          shared->refs = 1;
+          
+          /* Set ABI version. */
+          shared->world_abi = abi_version;
+
+          /* Set the world index. */
+          shared->world_index = world_index;
+
+          /* Set start time of world clock. */
+          direct_monotonic_gettimeofday( &shared->start_time );
+
+          D_MAGIC_SET( shared, FusionWorldShared );
+     }
+     else {
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+          /* Check ABI version. */
+          if (shared->world_abi != abi_version) {
+               D_ERROR( "Fusion/Init: World ABI (%d) doesn't match own (%d)!\n",
+                        shared->world_abi, abi_version );
+               ret = DR_VERSIONMISMATCH;
+               goto error;
+          }
+     }
+
+     /* Synchronize to world clock. */
+     direct_clock_set_start( &shared->start_time );
+     
+
+     /* Allocate local data. */
+     world = D_CALLOC( 1, sizeof(FusionWorld) );
+     if (!world) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     /* Initialize local data. */
+     world->refs      = 1;
+     world->shared    = shared;
+     world->fusion_fd = fd;
+     world->fusion_id = enter.fusion_id;
+
+     D_MAGIC_SET( world, FusionWorld );
+
+     fusion_worlds[world_index] = world;
+
+
+     /* Initialize shared memory part. */
+     ret = fusion_shm_init( world );
+     if (ret)
+          goto error2;
+
+
+     D_DEBUG_AT( Fusion_Main, "  -> initializing other parts...\n" );
+
+     /* Initialize other parts. */
+     if (enter.fusion_id == FUSION_ID_MASTER) {
+          fusion_skirmish_init( &shared->arenas_lock, "Fusion Arenas", world );
+          fusion_skirmish_init( &shared->reactor_globals, "Fusion Reactor Globals", world );
+
+          /* Create the main pool. */
+          ret = fusion_shm_pool_create( world, "Fusion Main Pool", 0x100000,
+                                        fusion_config->debugshm, &shared->main_pool );
+          if (ret)
+               goto error3;
+     }
+
+
+     D_DEBUG_AT( Fusion_Main, "  -> starting dispatcher loop...\n" );
+
+     /* Start the dispatcher thread. */
+     world->dispatch_loop = direct_thread_create( DTT_MESSAGING,
+                                                  fusion_dispatch_loop,
+                                                  world, "Fusion Dispatch" );
+     if (!world->dispatch_loop) {
+          ret = DR_FAILURE;
+          goto error4;
+     }
+
+
+     /* Let others enter the world. */
+     if (enter.fusion_id == FUSION_ID_MASTER) {
+          D_DEBUG_AT( Fusion_Main, "  -> unblocking world...\n" );
+
+          while (ioctl( fd, FUSION_UNBLOCK )) {
+               if (errno != EINTR) {
+                    D_PERROR( "Fusion/Init: Could not unblock world!\n" );
+                    ret = DR_FUSION;
+                    goto error4;
+               }
+          }
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> done. (%p)\n", world );
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     /* Return the fusion world. */
+     *ret_world = world;
+
+     return DR_OK;
+
+
+error4:
+     if (world->dispatch_loop)
+          direct_thread_destroy( world->dispatch_loop );
+
+     if (enter.fusion_id == FUSION_ID_MASTER)
+          fusion_shm_pool_destroy( world, shared->main_pool );
+
+error3:
+     if (enter.fusion_id == FUSION_ID_MASTER) {
+          fusion_skirmish_destroy( &shared->arenas_lock );
+          fusion_skirmish_destroy( &shared->reactor_globals );
+     }
+
+     fusion_shm_deinit( world );
+
+
+error2:
+     fusion_worlds[world_index] = world;
+
+     D_MAGIC_CLEAR( world );
+
+     D_FREE( world );
+
+error:
+     if (shared && shared != MAP_FAILED) {
+          if (enter.fusion_id == FUSION_ID_MASTER)
+               D_MAGIC_CLEAR( shared );
+
+          munmap( shared, sizeof(FusionWorldShared) );
+     }
+
+     if (fd != -1)
+          close( fd );
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     direct_shutdown();
+
+     return ret;
+}
+
+DirectResult
+fusion_stop_dispatcher( FusionWorld *world,
+                        bool         emergency )
+{
+     if (!emergency) {
+          fusion_sync( world );
+
+          direct_thread_lock( world->dispatch_loop );
+     }
+          
+     world->dispatch_stop = true;
+
+     if (!emergency) {
+          direct_thread_unlock( world->dispatch_loop );
+
+          fusion_sync( world );
+     }
+
+     return DR_OK;
+}
+
+/*
+ * Exits the fusion world.
+ *
+ * If 'emergency' is true the function won't join but kill the dispatcher thread.
+ */
+DirectResult
+fusion_exit( FusionWorld *world,
+             bool         emergency )
+{
+     FusionWorldShared *shared;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %semergency )\n", __FUNCTION__, world, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+
+     pthread_mutex_lock( &fusion_worlds_lock );
+
+     D_ASSERT( world->refs > 0 );
+
+     if (--world->refs) {
+          pthread_mutex_unlock( &fusion_worlds_lock );
+          return DR_OK;
+     }
+
+     if (!emergency) {
+          int               foo;
+          FusionSendMessage msg;
+
+          /* Wake up the read loop thread. */
+          msg.fusion_id = world->fusion_id;
+          msg.msg_id    = 0;
+          msg.msg_data  = &foo;
+          msg.msg_size  = sizeof(foo);
+
+          while (ioctl( world->fusion_fd, FUSION_SEND_MESSAGE, &msg ) < 0) {
+               if (errno != EINTR) {
+                    D_PERROR( "FUSION_SEND_MESSAGE" );
+                    direct_thread_cancel( world->dispatch_loop );
+                    break;
+               }
+          }
+
+          /* Wait for its termination. */
+          direct_thread_join( world->dispatch_loop );
+     }
+
+     direct_thread_destroy( world->dispatch_loop );
+
+     /* Master has to deinitialize shared data. */
+     if (fusion_master( world )) {
+          shared->refs--;
+          if (shared->refs == 0) {
+               fusion_skirmish_destroy( &shared->reactor_globals );
+               fusion_skirmish_destroy( &shared->arenas_lock );
+
+               fusion_shm_pool_destroy( world, shared->main_pool );
+          
+               /* Deinitialize shared memory. */
+               fusion_shm_deinit( world );
+          }
+     }
+     else {
+          /* Leave shared memory. */
+          fusion_shm_deinit( world );
+     }
+
+     /* Reset local dispatch nodes. */
+     _fusion_reactor_free_all( world );
+
+
+     /* Remove world from global list. */
+     fusion_worlds[shared->world_index] = NULL;
+
+
+     /* Unmap shared area. */
+     if (fusion_master( world ) && shared->refs == 0)
+          D_MAGIC_CLEAR( shared );
+
+     munmap( shared, sizeof(FusionWorldShared) );
+
+
+     /* Close Fusion Kernel Device. */
+     close( world->fusion_fd );
+
+
+     /* Free local world data. */
+     D_MAGIC_CLEAR( world );
+     D_FREE( world );
+
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     direct_shutdown();
+
+     return DR_OK;
+}
+
+/*
+ * Sends a signal to one or more fusionees and optionally waits
+ * for their processes to terminate.
+ *
+ * A fusion_id of zero means all fusionees but the calling one.
+ * A timeout of zero means infinite waiting while a negative value
+ * means no waiting at all.
+ */
+DirectResult
+fusion_kill( FusionWorld *world,
+             FusionID     fusion_id,
+             int          signal,
+             int          timeout_ms )
+{
+     FusionKill param;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     param.fusion_id  = fusion_id;
+     param.signal     = signal;
+     param.timeout_ms = timeout_ms;
+
+     while (ioctl( world->fusion_fd, FUSION_KILL, ¶m )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case ETIMEDOUT:
+                    return DR_TIMEOUT;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_KILL");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void *
+fusion_dispatch_loop( DirectThread *thread, void *arg )
+{
+     int          len = 0;
+     int          result;
+     char         buf[FUSION_MESSAGE_SIZE];
+     fd_set       set;
+     FusionWorld *world = arg;
+
+     D_DEBUG_AT( Fusion_Main_Dispatch, "%s() running...\n", __FUNCTION__ );
+
+     while (true) {
+          char *buf_p = buf;
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          FD_ZERO( &set );
+          FD_SET( world->fusion_fd, &set );
+
+          result = select( world->fusion_fd + 1, &set, NULL, NULL, NULL );
+          if (result < 0) {
+               switch (errno) {
+                    case EINTR:
+                         continue;
+
+                    default:
+                         D_PERROR( "Fusion/Dispatcher: select() failed!\n" );
+                         return NULL;
+               }
+          }
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          if (FD_ISSET( world->fusion_fd, &set )) {
+               len = read( world->fusion_fd, buf, FUSION_MESSAGE_SIZE );
+               if (len < 0)
+                    break;
+
+               D_DEBUG_AT( Fusion_Main_Dispatch, "  -> got %d bytes...\n", len );
+
+               direct_thread_lock( world->dispatch_loop );
+
+               if (world->dispatch_stop) {
+                    D_DEBUG_AT( Fusion_Main_Dispatch, "  -> IGNORING (dispatch_stop!)\n" );
+               }
+               else {
+                    while (buf_p < buf + len) {
+                         FusionReadMessage *header = (FusionReadMessage*) buf_p;
+                         void              *data   = buf_p + sizeof(FusionReadMessage);
+
+                         if (world->dispatch_stop) {
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> ABORTING (dispatch_stop!)\n" );
+                              break;
+                         }
+
+                         D_MAGIC_ASSERT( world, FusionWorld );
+                         D_ASSERT( (buf + len - buf_p) >= sizeof(FusionReadMessage) );
+
+                         switch (header->msg_type) {
+                              case FMT_SEND:
+                                   D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_SEND!\n" );
+                                   break; 
+                              case FMT_CALL:
+                                   D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_CALL...\n" );
+                                   _fusion_call_process( world, header->msg_id, data );
+                                   break;
+                              case FMT_REACTOR:
+                                   D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_REACTOR...\n" );
+                                   _fusion_reactor_process_message( world, header->msg_id, header->msg_channel, data );
+                                   break;
+                              case FMT_SHMPOOL:
+                                   D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_SHMPOOL...\n" );
+                                   _fusion_shmpool_process( world, header->msg_id, data );
+                                   break;
+                              default:
+                                   D_DEBUG( "Fusion/Receiver: discarding message of unknown type '%d'\n",
+                                            header->msg_type );
+                                   break;
+                         }
+
+                         buf_p = data + ((header->msg_size + 3) & ~3);
+                    }
+               }
+
+               direct_thread_unlock( world->dispatch_loop );
+
+               if (!world->refs) {
+                    D_DEBUG_AT( Fusion_Main_Dispatch, "  -> good bye!\n" );
+                    return NULL;
+               }
+          }
+     }
+
+     D_PERROR( "Fusion/Receiver: reading from fusion device failed!\n" );
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+#else /* FUSION_BUILD_KERNEL */
+
+#include <dirent.h>
+
+#include <direct/system.h>
+
+typedef struct {
+     DirectLink   link;
+
+     FusionRef   *ref;
+
+     int          count;
+} __FusioneeRef;
+
+typedef struct {
+     DirectLink   link;
+     
+     FusionID     id;
+     pid_t        pid;
+
+     DirectLink  *refs;
+} __Fusionee;
+
+
+/**********************************************************************************************************************/
+
+static DirectResult
+_fusion_add_fusionee( FusionWorld *world, FusionID fusion_id )
+{
+     DirectResult       ret;
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %lu )\n", __FUNCTION__, world, fusion_id );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     fusionee = SHCALLOC( shared->main_pool, 1, sizeof(__Fusionee) );
+     if (!fusionee)
+          return D_OOSHM();
+     
+     fusionee->id  = fusion_id;
+     fusionee->pid = direct_gettid();
+     
+     ret = fusion_skirmish_prevail( &shared->fusionees_lock );
+     if (ret) {
+          SHFREE( shared->main_pool, fusionee );
+          return ret;
+     }
+     
+     direct_list_append( &shared->fusionees, &fusionee->link );
+     
+     fusion_skirmish_dismiss( &shared->fusionees_lock );
+
+     /* Set local pointer. */
+     world->fusionee = fusionee;
+
+     return DR_OK;
+}    
+
+void
+_fusion_add_local( FusionWorld *world, FusionRef *ref, int add )
+{
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee;
+     __FusioneeRef     *fusionee_ref;
+
+     //D_DEBUG_AT( Fusion_Main, "%s( %p, %p, %d )\n", __FUNCTION__, world, ref, add );
+
+     D_ASSERT( ref != NULL );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     fusionee = world->fusionee;
+
+     D_ASSERT( fusionee != NULL );
+
+     direct_list_foreach (fusionee_ref, fusionee->refs) {
+          if (fusionee_ref->ref == ref)
+               break;
+     }
+
+     if (fusionee_ref) { 
+          fusionee_ref->count += add;
+
+          //D_DEBUG_AT( Fusion_Main, " -> refs = %d\n", fusionee_ref->count );
+          
+          if (fusionee_ref->count == 0) {
+               direct_list_remove( &fusionee->refs, &fusionee_ref->link );
+               SHFREE( shared->main_pool, fusionee_ref );
+          }
+     }
+     else {
+          if (add <= 0) /* called from _fusion_remove_fusionee() */
+               return;
+          
+          //D_DEBUG_AT( Fusion_Main, " -> new ref\n" );
+          
+          fusionee_ref = SHCALLOC( shared->main_pool, 1, sizeof(__FusioneeRef) );
+          if (!fusionee_ref) {
+               D_OOSHM();
+               return;
+          }
+
+          fusionee_ref->ref   = ref;
+          fusionee_ref->count = add;
+
+          direct_list_prepend( &fusionee->refs, &fusionee_ref->link );
+     }
+}
+
+void
+_fusion_check_locals( FusionWorld *world, FusionRef *ref )
+{
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee;
+     __FusioneeRef     *fusionee_ref, *temp;
+     DirectLink        *list = NULL;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %p )\n", __FUNCTION__, world, ref );
+
+     D_ASSERT( ref != NULL );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     if (fusion_skirmish_prevail( &shared->fusionees_lock ))
+          return;
+
+     direct_list_foreach (fusionee, shared->fusionees) { 
+          if (fusionee->id == world->fusion_id)
+               continue;
+          
+          direct_list_foreach (fusionee_ref, fusionee->refs) {    
+               if (fusionee_ref->ref == ref) {
+                    if (kill( fusionee->pid, 0 ) < 0 && errno == ESRCH) { 
+                         direct_list_remove( &fusionee->refs, &fusionee_ref->link );
+                         direct_list_append( &list, &fusionee_ref->link );
+                    }
+                    break;
+               }
+          }
+     }
+
+     fusion_skirmish_dismiss( &shared->fusionees_lock );
+
+     direct_list_foreach_safe (fusionee_ref, temp, list) {
+          _fusion_ref_change( ref, -fusionee_ref->count, false );
+          
+          SHFREE( shared->main_pool, fusionee_ref );
+     }
+}
+
+void
+_fusion_remove_all_locals( FusionWorld *world, const FusionRef *ref )
+{
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee;
+     __FusioneeRef     *fusionee_ref, *temp;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %p )\n", __FUNCTION__, world, ref );
+
+     D_ASSERT( ref != NULL );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     if (fusion_skirmish_prevail( &shared->fusionees_lock ))
+          return;
+
+     direct_list_foreach (fusionee, shared->fusionees) {
+          direct_list_foreach_safe (fusionee_ref, temp, fusionee->refs) {
+               if (fusionee_ref->ref == ref) {
+                    direct_list_remove( &fusionee->refs, &fusionee_ref->link );
+                    
+                    SHFREE( shared->main_pool, fusionee_ref );
+               }
+          }
+     }
+
+     fusion_skirmish_dismiss( &shared->fusionees_lock );
+}
+
+static void
+_fusion_remove_fusionee( FusionWorld *world, FusionID fusion_id )
+{
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee;
+     __FusioneeRef     *fusionee_ref, *temp;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %lu )\n", __FUNCTION__, world, fusion_id );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     fusion_skirmish_prevail( &shared->fusionees_lock );
+
+     if (fusion_id == world->fusion_id) {
+          fusionee = world->fusionee;
+     }
+     else {
+          direct_list_foreach (fusionee, shared->fusionees) {
+               if (fusionee->id == fusion_id)
+                    break;
+          }
+     }
+
+     if (!fusionee) {
+          D_DEBUG_AT( Fusion_Main, "Fusionee %lu not found!\n", fusion_id );
+          fusion_skirmish_dismiss( &shared->fusionees_lock );
+          return;
+     }
+
+     direct_list_remove( &shared->fusionees, &fusionee->link );
+
+     fusion_skirmish_dismiss( &shared->fusionees_lock );
+     
+     direct_list_foreach_safe (fusionee_ref, temp, fusionee->refs) {
+          direct_list_remove( &fusionee->refs, &fusionee_ref->link );
+               
+          _fusion_ref_change( fusionee_ref->ref, -fusionee_ref->count, false );
+          
+          SHFREE( shared->main_pool, fusionee_ref );
+     }
+
+     SHFREE( shared->main_pool, fusionee );
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+_fusion_send_message( int                 fd, 
+                      const void         *msg, 
+                      size_t              msg_size, 
+                      struct sockaddr_un *addr )
+{
+     socklen_t len = sizeof(struct sockaddr_un);
+     
+     D_ASSERT( msg != NULL );
+
+     if (!addr) {
+          addr = alloca( sizeof(struct sockaddr_un) );
+          getsockname( fd, (struct sockaddr*)addr, &len );
+     }          
+    
+     while (sendto( fd, msg, msg_size, 0, (struct sockaddr*)addr, len ) < 0) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case ECONNREFUSED:
+                    return DR_FUSION;
+               default:
+                    break;
+          }
+
+          D_PERROR( "Fusion: sendto()\n" );
+
+          return DR_IO;
+     }
+     
+     return DR_OK;
+}
+
+DirectResult
+_fusion_recv_message( int                 fd, 
+                      void               *msg,
+                      size_t              msg_size,
+                      struct sockaddr_un *addr )
+{
+     socklen_t len = addr ? sizeof(struct sockaddr_un) : 0;
+     
+     D_ASSERT( msg != NULL );
+    
+     while (recvfrom( fd, msg, msg_size, 0, (struct sockaddr*)addr, &len ) < 0) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case ECONNREFUSED:
+                    return DR_FUSION;
+               default:
+                    break;
+          }
+
+          D_PERROR( "Fusion: recvfrom()\n" );
+          
+          return DR_IO;
+     }
+     
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void
+fusion_fork_handler_prepare( void )
+{
+     int i;
+     
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+     
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld *world = fusion_worlds[i];
+
+          if (!world)
+               continue;
+               
+          D_MAGIC_ASSERT( world, FusionWorld );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_PREPARE );
+     }
+}
+
+static void
+fusion_fork_handler_parent( void )
+{
+     int i;
+
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+    
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld        *world = fusion_worlds[i];
+           FusionWorldShared *shared;
+
+          if (!world)
+               continue;
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+          
+          shared = world->shared;
+          
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_PARENT );
+               
+          if (world->fork_action == FFA_FORK) {
+               /* Increase the shared reference counter. */
+               if (fusion_master( world ))
+                    shared->refs++;
+               
+               /* Cancel the dispatcher to prevent conflicts. */
+               direct_thread_cancel( world->dispatch_loop );
+          }
+     }
+}
+
+static void
+fusion_fork_handler_child( void )
+{
+     int i;
+
+     D_DEBUG_AT( Fusion_Main, "%s()\n", __FUNCTION__ );
+
+     for (i=0; i<FUSION_MAX_WORLDS; i++) {
+          FusionWorld       *world = fusion_worlds[i];
+          FusionWorldShared *shared;
+
+          if (!world)
+               continue;
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          shared = world->shared;
+
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+          
+          if (world->fork_callback)
+               world->fork_callback( world->fork_action, FFS_CHILD );
+
+          switch (world->fork_action) {
+               default:
+                    D_BUG( "unknown fork action %d", world->fork_action );
+
+               case FFA_CLOSE:
+                    D_DEBUG_AT( Fusion_Main, "  -> closing world %d\n", i );
+
+                    /* Remove world from global list. */
+                    fusion_worlds[i] = NULL;
+
+                    /* Unmap shared area. */
+                    munmap( world->shared, sizeof(FusionWorldShared) );
+
+                    /* Close socket. */
+                    close( world->fusion_fd );
+
+                    /* Free local world data. */
+                    D_MAGIC_CLEAR( world );
+                    D_FREE( world );
+
+                    break;
+
+               case FFA_FORK: {
+                    __Fusionee    *fusionee;
+                    __FusioneeRef *fusionee_ref;
+                    
+                    D_DEBUG_AT( Fusion_Main, "  -> forking in world %d\n", i );
+
+                    fusionee = world->fusionee;
+                    
+                    D_DEBUG_AT( Fusion_Main, "  -> duplicating fusion id %lu\n", world->fusion_id );
+                    
+                    fusion_skirmish_prevail( &shared->fusionees_lock );
+                   
+                    if (_fusion_add_fusionee( world, world->fusion_id )) {
+                         fusion_skirmish_dismiss( &shared->fusionees_lock );
+                         raise( SIGTRAP );
+                    }
+
+                    D_DEBUG_AT( Fusion_Main, "  -> duplicating local refs...\n" );
+                    
+                    direct_list_foreach (fusionee_ref, fusionee->refs) {
+                         __FusioneeRef *new_ref;
+
+                         new_ref = SHCALLOC( shared->main_pool, 1, sizeof(__FusioneeRef) );
+                         if (!new_ref) {  
+                              D_OOSHM();
+                              fusion_skirmish_dismiss( &shared->fusionees_lock );
+                              raise( SIGTRAP );
+                         }
+
+                         new_ref->ref   = fusionee_ref->ref;
+                         new_ref->count = fusionee_ref->count;
+                         /* Avoid locking. */ 
+                         new_ref->ref->multi.builtin.local += new_ref->count;
+
+                         direct_list_append( &((__Fusionee*)world->fusionee)->refs, &new_ref->link );
+                    }
+
+                    fusion_skirmish_dismiss( &shared->fusionees_lock );
+
+                    D_DEBUG_AT( Fusion_Main, "  -> restarting dispatcher loop...\n" );
+                    
+                    /* Restart the dispatcher thread. FIXME: free old struct */
+                    world->dispatch_loop = direct_thread_create( DTT_MESSAGING,
+                                                                 fusion_dispatch_loop,
+                                                                 world, "Fusion Dispatch" );
+                    if (!world->dispatch_loop)
+                         raise( SIGTRAP );
+               
+               }    break;
+          }
+     }
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * Enters a fusion world by joining or creating it.
+ *
+ * If <b>world</b> is negative, the next free index is used to create a new world.
+ * Otherwise the world with the specified index is joined or created.
+ */
+DirectResult
+fusion_enter( int               world_index,
+              int               abi_version,
+              FusionEnterRole   role,
+              FusionWorld     **ret_world )
+{
+     DirectResult        ret     = DR_OK;
+     int                 fd      = -1;
+     FusionID            id      = -1;
+     FusionWorld        *world   = NULL;
+     FusionWorldShared  *shared  = MAP_FAILED;
+     struct sockaddr_un  addr;
+     char                buf[128];
+     int                 len, err;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %d, %d, %p )\n", __FUNCTION__, world_index, abi_version, ret_world );
+
+     D_ASSERT( ret_world != NULL );
+
+     if (world_index >= FUSION_MAX_WORLDS) {
+          D_ERROR( "Fusion/Init: World index %d exceeds maximum index %d!\n", world_index, FUSION_MAX_WORLDS - 1 );
+          return DR_INVARG;
+     }
+     
+     if (fusion_config->force_slave)
+          role = FER_SLAVE;
+
+     pthread_once( &fusion_init_once, init_once );
+
+     direct_initialize();
+     
+     fd = socket( PF_LOCAL, SOCK_RAW, 0 );
+     if (fd < 0) {
+          D_PERROR( "Fusion/Init: Error creating local socket!\n" );
+          return DR_IO;
+     }
+          
+     /* Set close-on-exec flag. */
+     if (fcntl( fd, F_SETFD, FD_CLOEXEC ) < 0)
+          D_PERROR( "Fusion/Init: Couldn't set close-on-exec flag!\n" );
+
+     pthread_mutex_lock( &fusion_worlds_lock );
+     
+     addr.sun_family = AF_UNIX;
+     
+     if (world_index < 0) {
+          if (role == FER_SLAVE) {
+               D_ERROR( "Fusion/Init: Slave role and a new world (index -1) was requested!\n" );
+               pthread_mutex_unlock( &fusion_worlds_lock );
+               close( fd );
+               return DR_INVARG;
+          }
+          
+          for (world_index=0; world_index<FUSION_MAX_WORLDS; world_index++) {
+               if (fusion_worlds[world_index])
+                    continue;
+
+               len = snprintf( addr.sun_path, sizeof(addr.sun_path), "/tmp/.fusion-%d/", world_index );
+               /* Make socket directory if it doesn't exits. */
+               if (mkdir( addr.sun_path, 0775 ) == 0) {
+                    chmod( addr.sun_path, 0775 );
+                    if (fusion_config->shmfile_gid != (gid_t)-1)
+                         chown( addr.sun_path, -1, fusion_config->shmfile_gid );
+               }
+               
+               snprintf( addr.sun_path+len, sizeof(addr.sun_path)-len, "%lx", FUSION_ID_MASTER );
+               
+               /* Bind to address. */
+               err = bind( fd, (struct sockaddr*)&addr, sizeof(addr) );
+               if (err == 0) {
+                    chmod( addr.sun_path, 0660 );
+                    /* Change group, if requested. */
+                    if (fusion_config->shmfile_gid != (gid_t)-1)
+                         chown( addr.sun_path, -1, fusion_config->shmfile_gid );
+                    id = FUSION_ID_MASTER;
+                    break;
+               }
+          }            
+     }
+     else {
+          world = fusion_worlds[world_index];
+          if (!world) {
+               len = snprintf( addr.sun_path, sizeof(addr.sun_path), "/tmp/.fusion-%d/", world_index );
+               /* Make socket directory if it doesn't exits. */
+               if (mkdir( addr.sun_path, 0775 ) == 0) {
+                    chmod( addr.sun_path, 0775 );
+                    if (fusion_config->shmfile_gid != (gid_t)-1)
+                         chown( addr.sun_path, -1, fusion_config->shmfile_gid );
+               }
+               
+               /* Check wether we are master. */
+               snprintf( addr.sun_path+len, sizeof(addr.sun_path)-len, "%lx", FUSION_ID_MASTER );
+               
+               err = bind( fd, (struct sockaddr*)&addr, sizeof(addr) );
+               if (err < 0) {
+                    if (role == FER_MASTER) {
+                         D_ERROR( "Fusion/Main: Couldn't start session as master! Remove %s.\n", addr.sun_path );
+                         ret = DR_INIT;
+                         goto error;
+                    }
+                    
+                    /* Auto generate slave id. */
+                    for (id = FUSION_ID_MASTER+1; id < (FusionID)-1; id++) {
+                         snprintf( addr.sun_path+len, sizeof(addr.sun_path)-len, "%lx", id );
+                         err = bind( fd, (struct sockaddr*)&addr, sizeof(addr) );
+                         if (err == 0) {
+                              chmod( addr.sun_path, 0660 );
+                               /* Change group, if requested. */
+                              if (fusion_config->shmfile_gid != (gid_t)-1)
+                                   chown( addr.sun_path, -1, fusion_config->shmfile_gid );
+                              break;
+                         }
+                    }
+               }
+               else if (err == 0 && role != FER_SLAVE) { 
+                    chmod( addr.sun_path, 0660 );
+                    /* Change group, if requested. */
+                    if (fusion_config->shmfile_gid != (gid_t)-1)
+                         chown( addr.sun_path, -1, fusion_config->shmfile_gid ); 
+                    id = FUSION_ID_MASTER;
+               }
+          }
+     }
+     
+     /* Enter a world again? */
+     if (world) {
+          D_MAGIC_ASSERT( world, FusionWorld );
+          D_ASSERT( world->refs > 0 );
+
+          /* Check the role again. */
+          switch (role) {
+               case FER_MASTER:
+                    if (world->fusion_id != FUSION_ID_MASTER) {
+                         D_ERROR( "Fusion/Init: Master role requested for a world (%d) "
+                                  "we're already slave in!\n", world_index );
+                         ret = DR_UNSUPPORTED;
+                         goto error;
+                    }
+                    break;
+
+               case FER_SLAVE:
+                    if (world->fusion_id == FUSION_ID_MASTER) {
+                         D_ERROR( "Fusion/Init: Slave role requested for a world (%d) "
+                                  "we're already master in!\n", world_index );
+                         ret = DR_UNSUPPORTED;
+                         goto error;
+                    }
+                    break;
+
+               case FER_ANY:
+                    break;
+          }
+
+          shared = world->shared;
+
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+          if (shared->world_abi != abi_version) {
+               D_ERROR( "Fusion/Init: World ABI (%d) of world '%d' doesn't match own (%d)!\n",
+                        shared->world_abi, world_index, abi_version );
+               ret = DR_VERSIONMISMATCH;
+               goto error;
+          }
+
+          world->refs++;
+
+          pthread_mutex_unlock( &fusion_worlds_lock );
+
+          D_DEBUG_AT( Fusion_Main, "  -> using existing world %p [%d]\n", world, world_index );
+
+          close( fd );
+
+          /* Return the world. */
+          *ret_world = world;
+
+          return DR_OK;
+     }
+     
+     if (id == (FusionID)-1) {
+          D_ERROR( "Fusion/Init: Opening fusion socket (world %d) as '%s' failed!\n", world_index,
+                    role == FER_ANY ? "any" : (role == FER_MASTER ? "master" : "slave")  );
+          ret = DR_INIT;
+          goto error;
+     }
+     
+     D_DEBUG_AT( Fusion_Main, "  -> Fusion ID 0x%08lx\n", id );
+
+     if (id == FUSION_ID_MASTER) {
+          int shared_fd;
+          
+          snprintf( buf, sizeof(buf), "%s/fusion.%d.core", 
+                    fusion_config->tmpfs ? : "/dev/shm", world_index );
+           
+          /* Open shared memory file. */         
+          shared_fd = open( buf, O_RDWR | O_CREAT | O_TRUNC, 0660 );
+          if (shared_fd < 0) {
+               D_PERROR( "Fusion/Init: Couldn't open shared memory file!\n" );
+               ret = DR_INIT;
+               goto error;
+          }
+
+          if (fusion_config->shmfile_gid != (gid_t)-1) {
+               if (fchown( shared_fd, -1, fusion_config->shmfile_gid ) != 0)
+                    D_INFO( "Fusion/Init: Changing owner on %s failed... continuing on.\n", buf );
+          }
+         
+          fchmod( shared_fd, 0660 );
+          ftruncate( shared_fd, sizeof(FusionWorldShared) );
+          
+          /* Map shared area. */
+          shared = mmap( (void*) 0x20000000 + 0x2000 * world_index, sizeof(FusionWorldShared),
+                         PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, shared_fd, 0 );
+          if (shared == MAP_FAILED) {
+               D_PERROR( "Fusion/Init: Mapping shared area failed!\n" );
+               close( shared_fd );
+               ret = DR_INIT;
+               goto error;
+          }
+          
+          close( shared_fd );
+          
+          D_DEBUG_AT( Fusion_Main, "  -> shared area at %p, size %zu\n", shared, sizeof(FusionWorldShared) );
+          
+          /* Initialize reference counter. */
+          shared->refs = 1;
+          
+          /* Set ABI version. */
+          shared->world_abi = abi_version;
+
+          /* Set the world index. */
+          shared->world_index = world_index;
+
+          /* Set pool allocation base/max. */
+          shared->pool_base = (void*)0x20000000 + 0x2000 * FUSION_MAX_WORLDS + 0x8000000 * world_index;
+          shared->pool_max  = shared->pool_base + 0x8000000 - 1;
+
+          /* Set start time of world clock. */
+          direct_monotonic_gettimeofday( &shared->start_time );
+
+          D_MAGIC_SET( shared, FusionWorldShared );
+     }
+     else {
+          FusionEnter enter;
+          int         shared_fd;
+          
+          /* Fill enter information. */
+          enter.type      = FMT_ENTER;
+          enter.fusion_id = id;
+          
+          snprintf( addr.sun_path, sizeof(addr.sun_path),
+                    "/tmp/.fusion-%d/%lx", world_index, FUSION_ID_MASTER );
+          
+          /* Send enter message (used to sync with the master) */
+          ret = _fusion_send_message( fd, &enter, sizeof(FusionEnter), &addr );
+          if (ret == DR_OK) {
+               ret = _fusion_recv_message( fd, &enter, sizeof(FusionEnter), NULL );
+               if (ret == DR_OK && enter.type != FMT_ENTER) {
+                    D_ERROR( "Fusion/Init: Expected message ENTER, got '%d'!\n", enter.type );
+                    ret = DR_FUSION;
+               }
+          }
+               
+          if (ret) {
+               D_ERROR( "Fusion/Init: Could not enter world '%d'!\n", world_index );
+               goto error;
+          }
+          
+          snprintf( buf, sizeof(buf), "%s/fusion.%d.core", 
+                    fusion_config->tmpfs ? : "/dev/shm", world_index );
+          
+          /* Open shared memory file. */
+          shared_fd = open( buf, O_RDWR );
+          if (shared_fd < 0) {
+               D_PERROR( "Fusion/Init: Couldn't open shared memory file!\n" );
+               ret = DR_INIT;
+               goto error;
+          }
+          
+          /* Map shared area. */
+          shared = mmap( (void*) 0x20000000 + 0x2000 * world_index, sizeof(FusionWorldShared),
+                         PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, shared_fd, 0 );
+          if (shared == MAP_FAILED) {
+               D_PERROR( "Fusion/Init: Mapping shared area failed!\n" );
+               close( shared_fd );
+               ret = DR_INIT;
+               goto error;
+          }
+          
+          close( shared_fd );
+          
+          D_DEBUG_AT( Fusion_Main, "  -> shared area at %p, size %zu\n", shared, sizeof(FusionWorldShared) );
+          
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+          /* Check ABI version. */
+          if (shared->world_abi != abi_version) {
+               D_ERROR( "Fusion/Init: World ABI (%d) doesn't match own (%d)!\n",
+                        shared->world_abi, abi_version );
+               ret = DR_VERSIONMISMATCH;
+               goto error;
+          }
+     }
+
+     /* Synchronize to world clock. */
+     direct_clock_set_start( &shared->start_time );
+     
+     /* Allocate local data. */
+     world = D_CALLOC( 1, sizeof(FusionWorld) );
+     if (!world) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     /* Initialize local data. */
+     world->refs      = 1;
+     world->shared    = shared;
+     world->fusion_fd = fd;
+     world->fusion_id = id;
+
+     D_MAGIC_SET( world, FusionWorld );
+
+     fusion_worlds[world_index] = world;
+
+     /* Initialize shared memory part. */
+     ret = fusion_shm_init( world );
+     if (ret)
+          goto error2;
+
+     D_DEBUG_AT( Fusion_Main, "  -> initializing other parts...\n" );
+
+     /* Initialize other parts. */
+     if (world->fusion_id == FUSION_ID_MASTER) {
+          fusion_skirmish_init( &shared->arenas_lock, "Fusion Arenas", world );
+          fusion_skirmish_init( &shared->reactor_globals, "Fusion Reactor Globals", world );
+          fusion_skirmish_init( &shared->fusionees_lock, "Fusionees", world );
+
+          /* Create the main pool. */
+          ret = fusion_shm_pool_create( world, "Fusion Main Pool", 0x100000,
+                                        fusion_config->debugshm, &shared->main_pool );
+          if (ret)
+               goto error3;
+     }
+     
+     /* Add ourselves to the list of fusionees. */
+     ret = _fusion_add_fusionee( world, id );
+     if (ret)
+          goto error4;
+          
+     D_DEBUG_AT( Fusion_Main, "  -> starting dispatcher loop...\n" );
+
+     /* Start the dispatcher thread. */
+     world->dispatch_loop = direct_thread_create( DTT_MESSAGING,
+                                                  fusion_dispatch_loop,
+                                                  world, "Fusion Dispatch" );
+     if (!world->dispatch_loop) {
+          ret = DR_FAILURE;
+          goto error5;
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> done. (%p)\n", world );
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     /* Return the fusion world. */
+     *ret_world = world;
+
+     return DR_OK;
+
+
+error5:
+     if (world->dispatch_loop)
+          direct_thread_destroy( world->dispatch_loop );
+     
+     _fusion_remove_fusionee( world, id );
+     
+error4:
+     if (world->fusion_id == FUSION_ID_MASTER)
+          fusion_shm_pool_destroy( world, shared->main_pool );
+
+error3:
+     if (world->fusion_id == FUSION_ID_MASTER) {
+          fusion_skirmish_destroy( &shared->arenas_lock );
+          fusion_skirmish_destroy( &shared->reactor_globals );
+          fusion_skirmish_destroy( &shared->fusionees_lock );
+     }
+
+     fusion_shm_deinit( world );
+
+
+error2:
+     fusion_worlds[world_index] = world;
+
+     D_MAGIC_CLEAR( world );
+
+     D_FREE( world );
+
+error:
+     if (shared != MAP_FAILED) {
+          if (id == FUSION_ID_MASTER)
+               D_MAGIC_CLEAR( shared );
+
+          munmap( shared, sizeof(FusionWorldShared) );
+     }
+
+     if (fd != -1) {
+          /* Unbind. */
+          socklen_t len = sizeof(addr);
+          if (getsockname( fd, (struct sockaddr*)&addr, &len ) == 0)
+               unlink( addr.sun_path );
+               
+          close( fd );
+     }
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     direct_shutdown();
+
+     return ret;
+}
+
+DirectResult
+fusion_stop_dispatcher( FusionWorld *world,
+                        bool         emergency )
+{
+     if (!emergency) {
+          fusion_sync( world );
+
+          direct_thread_lock( world->dispatch_loop );
+     }
+
+     world->dispatch_stop = true;
+
+     if (!emergency) {
+          direct_thread_unlock( world->dispatch_loop );
+
+          fusion_sync( world );
+     }
+
+     return DR_OK;
+}
+
+/*
+ * Exits the fusion world.
+ *
+ * If 'emergency' is true the function won't join but kill the dispatcher thread.
+ */
+DirectResult
+fusion_exit( FusionWorld *world,
+             bool         emergency )
+{
+     FusionWorldShared *shared;
+     int                world_index;
+     bool               clear = false;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %semergency )\n", __FUNCTION__, world, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+     
+     world_index = shared->world_index;
+
+     pthread_mutex_lock( &fusion_worlds_lock );
+
+     D_ASSERT( world->refs > 0 );
+
+     if (--world->refs) {
+          pthread_mutex_unlock( &fusion_worlds_lock );
+          return DR_OK;
+     }
+ 
+     if (!emergency) {
+          FusionMessageType msg = FMT_SEND;
+
+          /* Wakeup dispatcher. */
+          if (_fusion_send_message( world->fusion_fd, &msg, sizeof(msg), NULL ))
+               direct_thread_cancel( world->dispatch_loop );
+
+          /* Wait for its termination. */
+          direct_thread_join( world->dispatch_loop );
+     }
+
+     direct_thread_destroy( world->dispatch_loop );
+
+     /* Remove ourselves from list. */
+     if (!emergency || fusion_master( world )) {
+          _fusion_remove_fusionee( world, world->fusion_id );
+     }
+     else {
+          struct sockaddr_un addr;
+          FusionLeave        leave;
+
+          addr.sun_family = AF_UNIX;
+          snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                    "/tmp/.fusion-%d/%lx", world_index, FUSION_ID_MASTER );
+
+          leave.type      = FMT_LEAVE;
+          leave.fusion_id = world->fusion_id;
+
+          _fusion_send_message( world->fusion_fd, &leave, sizeof(FusionLeave), &addr );
+     }
+
+     /* Master has to deinitialize shared data. */
+     if (fusion_master( world )) {
+          shared->refs--;
+          if (shared->refs == 0) {
+               fusion_skirmish_destroy( &shared->reactor_globals );
+               fusion_skirmish_destroy( &shared->arenas_lock );
+               fusion_skirmish_destroy( &shared->fusionees_lock );
+
+               fusion_shm_pool_destroy( world, shared->main_pool );
+          
+               /* Deinitialize shared memory. */
+               fusion_shm_deinit( world );
+          
+               clear = true;
+          }
+     }
+     else {
+          /* Leave shared memory. */
+          fusion_shm_deinit( world );
+     }
+
+     /* Reset local dispatch nodes. */
+     _fusion_reactor_free_all( world );
+
+     /* Remove world from global list. */
+     fusion_worlds[shared->world_index] = NULL;
+
+     /* Unmap shared area. */
+     if (clear)
+          D_MAGIC_CLEAR( shared );
+     
+     munmap( shared, sizeof(FusionWorldShared) );
+     
+     /* Close socket. */     
+     close( world->fusion_fd );
+
+     if (clear) {
+          DIR  *dir;
+          char  buf[128];
+          int   len;
+          
+          /* Remove core shmfile. */
+          snprintf( buf, sizeof(buf), "%s/fusion.%d.core", 
+                    fusion_config->tmpfs ? : "/dev/shm", world_index );
+          D_DEBUG_AT( Fusion_Main, "Removing shmfile %s.\n", buf );
+          unlink( buf );
+          
+          /* Cleanup socket directory. */
+          len = snprintf( buf, sizeof(buf), "/tmp/.fusion-%d/", world_index );
+          dir = opendir( buf );
+          if (dir) {
+               struct dirent *entry = NULL;
+               struct dirent  tmp;
+               
+               while (readdir_r( dir, &tmp, &entry ) == 0 && entry) {
+                    if (entry->d_name[0] != '.') {
+                         struct stat st;
+                         
+                         direct_snputs( buf+len, entry->d_name, sizeof(buf)-len );
+                         if (stat( buf, &st ) == 0 && S_ISSOCK(st.st_mode)) {
+                              D_DEBUG_AT( Fusion_Main, "Removing socket %s.\n", buf );
+                              unlink( buf );
+                         }
+                    }
+               }
+               
+               closedir( dir );
+          }
+          else {
+               D_PERROR( "Fusion/Main: Couldn't open socket directory %s", buf );
+          }
+     }
+     
+     /* Free local world data. */
+     D_MAGIC_CLEAR( world );
+     D_FREE( world );
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p ) done.\n", __FUNCTION__, world );
+
+     pthread_mutex_unlock( &fusion_worlds_lock );
+
+     direct_shutdown();
+
+     return DR_OK;
+}
+
+/*
+ * Sends a signal to one or more fusionees and optionally waits
+ * for their processes to terminate.
+ *
+ * A fusion_id of zero means all fusionees but the calling one.
+ * A timeout of zero means infinite waiting while a negative value
+ * means no waiting at all.
+ */
+DirectResult
+fusion_kill( FusionWorld *world,
+             FusionID     fusion_id,
+             int          signal,
+             int          timeout_ms )
+{
+     FusionWorldShared *shared;
+     __Fusionee        *fusionee, *temp;
+     int                result;
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p, %lu, %d, %d )\n", 
+                 __FUNCTION__, world, fusion_id, signal, timeout_ms );
+     
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+     
+     fusion_skirmish_prevail( &shared->fusionees_lock );
+     
+     direct_list_foreach_safe (fusionee, temp, shared->fusionees) {          
+          if (fusion_id == 0 && fusionee->id == world->fusion_id)
+               continue;
+                
+          if (fusion_id != 0 && fusionee->id != fusion_id)
+               continue;
+
+          D_DEBUG_AT( Fusion_Main, " -> killing fusionee %lu (%d)...\n", fusionee->id, fusionee->pid );
+          
+          result = kill( fusionee->pid, signal );
+          if (result == 0 && timeout_ms >= 0) {
+               pid_t     pid  = fusionee->pid;
+               long long stop = timeout_ms ? (direct_clock_get_micros() + timeout_ms*1000) : 0;
+               
+               fusion_skirmish_dismiss( &shared->fusionees_lock );
+          
+               while (kill( pid, 0 ) == 0) { 
+                    usleep( 1000 );
+                    
+                    if (timeout_ms && direct_clock_get_micros() >= stop)
+                         break;
+               };
+               
+               fusion_skirmish_prevail( &shared->fusionees_lock );
+          }
+          else if (result < 0) {
+               if (errno == ESRCH) {
+                    D_DEBUG_AT( Fusion_Main, " ... fusionee %lu exited without removing itself!\n", fusionee->id );
+
+                    _fusion_remove_fusionee( world, fusionee->id );
+               }
+               else {
+                    D_PERROR( "Fusion/Main: kill(%d, %d)\n", fusionee->pid, signal );
+               }
+          } 
+     }
+     
+     fusion_skirmish_dismiss( &shared->fusionees_lock );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void *
+fusion_dispatch_loop( DirectThread *self, void *arg )
+{
+     FusionWorld        *world = arg;
+     struct sockaddr_un  addr;
+     socklen_t           addr_len = sizeof(addr); 
+     fd_set              set;
+     char                buf[FUSION_MESSAGE_SIZE];
+
+     D_DEBUG_AT( Fusion_Main_Dispatch, "%s() running...\n", __FUNCTION__ );
+
+     while (true) {
+          int result;
+          
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          FD_ZERO( &set );
+          FD_SET( world->fusion_fd, &set );
+
+          result = select( world->fusion_fd + 1, &set, NULL, NULL, NULL );
+          if (result < 0) {
+               switch (errno) {
+                    case EINTR:
+                         continue;
+
+                    default:
+                         D_PERROR( "Fusion/Dispatcher: select() failed!\n" );
+                         return NULL;
+               }
+          }
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          if (FD_ISSET( world->fusion_fd, &set ) && 
+              recvfrom( world->fusion_fd, buf, sizeof(buf), 0, (struct sockaddr*)&addr, &addr_len ) > 0) {
+               FusionMessage *msg = (FusionMessage*)buf;               
+
+               pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
+
+               D_DEBUG_AT( Fusion_Main_Dispatch, " -> message from '%s'...\n", addr.sun_path );
+
+               direct_thread_lock( world->dispatch_loop );
+
+               if (world->dispatch_stop) {
+                    D_DEBUG_AT( Fusion_Main_Dispatch, "  -> IGNORING (dispatch_stop!)\n" );
+               }
+               else {
+                    switch (msg->type) {
+                         case FMT_SEND:
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_SEND...\n" );
+                              break;
+
+                         case FMT_ENTER:
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_ENTER...\n" ); 
+                              if (!fusion_master( world )) {
+                                   D_ERROR( "Fusion/Dispatch: Got ENTER request, but I'm not master!\n" );
+                                   break;
+                              }
+                              if (msg->enter.fusion_id == world->fusion_id) {
+                                   D_ERROR( "Fusion/Dispatch: Received ENTER request from myself!\n" );
+                                   break;
+                              }
+                              /* Nothing to do here. Send back message. */
+                              _fusion_send_message( world->fusion_fd, msg, sizeof(FusionEnter), &addr );
+                              break;
+
+                         case FMT_LEAVE:
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_LEAVE...\n" );
+                              if (!fusion_master( world )) {
+                                   D_ERROR( "Fusion/Dispatch: Got LEAVE request, but I'm not master!\n" );
+                                   break;
+                              }
+                              if (msg->leave.fusion_id == world->fusion_id) {
+                                   D_ERROR( "Fusion/Dispatch: Received LEAVE request from myself!\n" );
+                                   break;
+                              }
+                              _fusion_remove_fusionee( world, msg->leave.fusion_id );
+                              break;
+
+                         case FMT_CALL:
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_CALL...\n" );
+                              _fusion_call_process( world, msg->call.call_id, &msg->call );
+                              break;
+
+                         case FMT_REACTOR:
+                              D_DEBUG_AT( Fusion_Main_Dispatch, "  -> FMT_REACTOR...\n" );
+                              _fusion_reactor_process_message( world, msg->reactor.id, msg->reactor.channel, 
+                                                               &buf[sizeof(FusionReactorMessage)] );
+                              if (msg->reactor.ref) {
+                                   fusion_ref_down( msg->reactor.ref, true );
+                                   if (fusion_ref_zero_trylock( msg->reactor.ref ) == DR_OK) {
+                                        fusion_ref_destroy( msg->reactor.ref );
+                                        SHFREE( world->shared->main_pool, msg->reactor.ref );
+                                   }
+                              }
+                              break;                    
+
+                         default:
+                              D_BUG( "unexpected message type (%d)", msg->type );
+                              break;
+                    }
+               }
+
+               direct_thread_unlock( world->dispatch_loop );
+
+               if (!world->refs) {
+                    D_DEBUG_AT( Fusion_Main_Dispatch, "  -> good bye!\n" );
+                    return NULL;
+               }
+
+               D_DEBUG_AT( Fusion_Main_Dispatch, " ...done\n" );
+
+               pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
+          }
+     }
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+#endif /* FUSION_BUILD_KERNEL */
+
+/*
+ * Wait until all pending messages are processed.
+ */
+DirectResult
+fusion_sync( const FusionWorld *world )
+{
+     int            result;
+     fd_set         set;
+     struct timeval tv;
+     int            loops = 200;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_DEBUG_AT( Fusion_Main, "%s( %p )\n", __FUNCTION__, world );
+
+     D_DEBUG_AT( Fusion_Main, "syncing with fusion device...\n" );
+
+     while (loops--) {
+          FD_ZERO( &set );
+          FD_SET( world->fusion_fd, &set );
+
+          tv.tv_sec  = 0;
+          tv.tv_usec = 20000;
+
+          result = select( world->fusion_fd + 1, &set, NULL, NULL, &tv );
+          D_DEBUG_AT( Fusion_Main, "  -> select() returned %d...\n", result );
+          switch (result) {
+               case -1:
+                    if (errno == EINTR)
+                         return DR_OK;
+
+                    D_PERROR( "Fusion/Sync: select() failed!\n");
+                    return DR_FAILURE;
+
+               default:
+                    D_DEBUG_AT( Fusion_Main, "  -> FD_ISSET %d...\n", FD_ISSET( world->fusion_fd, &set ) );
+                    
+                    if (FD_ISSET( world->fusion_fd, &set )) {
+                         usleep( 20000 );
+                         break;
+                    }
+
+               case 0:
+                    D_DEBUG_AT( Fusion_Main, "  -> synced.\n");
+                    return DR_OK;
+          }
+     }
+
+     D_DEBUG_AT( Fusion_Main, "  -> timeout!\n");
+
+     D_ERROR( "Fusion/Main: Timeout waiting for empty message queue!\n" );
+
+     return DR_TIMEOUT;
+}
+
+/*
+ * Sets the fork() action of the calling Fusionee within the world.
+ */
+void
+fusion_world_set_fork_action( FusionWorld      *world,
+                              FusionForkAction  action )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     world->fork_action = action;
+}
+
+/*
+ * Gets the current fork() action.
+ */
+FusionForkAction 
+fusion_world_get_fork_action( FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     return world->fork_action;
+}
+
+/*
+ * Registers a callback called upon fork().
+ */
+void
+fusion_world_set_fork_callback( FusionWorld        *world,
+                                FusionForkCallback  callback )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     world->fork_callback = callback;
+}
+
+/*
+ * Return the index of the specified world.
+ */
+int
+fusion_world_index( const FusionWorld *world )
+{
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     return shared->world_index;
+}
+
+/*
+ * Return the own Fusion ID within the specified world.
+ */
+FusionID
+fusion_id( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return world->fusion_id;
+}
+
+/*
+ * Return if the world is a multi application world.
+ */
+bool
+fusion_is_multi( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return true;
+}
+
+/*
+ * Return the thread ID of the Fusion Dispatcher within the specified world.
+ */
+pid_t
+fusion_dispatcher_tid( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return direct_thread_get_tid( world->dispatch_loop );
+}
+
+/*
+ * Return true if this process is the master.
+ */
+bool
+fusion_master( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return world->fusion_id == FUSION_ID_MASTER;
+}
+
+/*
+ * Check if a pointer points to the shared memory.
+ */
+bool
+fusion_is_shared( FusionWorld *world,
+                  const void  *ptr )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shm = &world->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     if (ptr >= (void*) world->shared && ptr < (void*) world->shared + sizeof(FusionWorldShared))
+          return true;
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return false;
+
+     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+          if (shared->pools[i].active) {
+               shmalloc_heap       *heap;
+               FusionSHMPoolShared *pool = &shared->pools[i];
+
+               D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+               heap = pool->heap;
+
+               D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+               if (ptr >= pool->addr_base && ptr < pool->addr_base + heap->size) {
+                    fusion_skirmish_dismiss( &shared->lock );
+                    return true;
+               }
+          }
+     }
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return false;
+}
+
+#else /* FUSION_BUILD_MULTI */
+
+/*
+ * Enters a fusion world by joining or creating it.
+ *
+ * If <b>world_index</b> is negative, the next free index is used to create a new world.
+ * Otherwise the world with the specified index is joined or created.
+ */
+DirectResult fusion_enter( int               world_index,
+                           int               abi_version,
+                           FusionEnterRole   role,
+                           FusionWorld     **ret_world )
+{
+     DirectResult  ret;
+     FusionWorld  *world = NULL;
+
+     D_ASSERT( ret_world != NULL );
+
+     ret = direct_initialize();
+     if (ret)
+          return ret;
+
+     world = D_CALLOC( 1, sizeof(FusionWorld) );
+     if (!world) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     world->shared = D_CALLOC( 1, sizeof(FusionWorldShared) );
+     if (!world->shared) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     /* Create the main pool. */
+     ret = fusion_shm_pool_create( world, "Fusion Main Pool", 0x100000,
+                                   fusion_config->debugshm, &world->shared->main_pool );
+     if (ret)
+          goto error;
+
+     D_MAGIC_SET( world, FusionWorld );
+     D_MAGIC_SET( world->shared, FusionWorldShared );
+
+     *ret_world = world;
+
+     return DR_OK;
+
+
+error:
+     if (world) {
+          if (world->shared)
+               D_FREE( world->shared );
+
+          D_FREE( world );
+     }
+
+     direct_shutdown();
+
+     return ret;
+}
+
+DirectResult
+fusion_stop_dispatcher( FusionWorld *world,
+                        bool         emergency )
+{
+     return DR_OK;
+}
+
+/*
+ * Exits the fusion world.
+ *
+ * If 'emergency' is true the function won't join but kill the dispatcher thread.
+ */
+DirectResult
+fusion_exit( FusionWorld *world,
+             bool         emergency )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+
+     fusion_shm_pool_destroy( world, world->shared->main_pool );
+
+     D_MAGIC_CLEAR( world->shared );
+
+     D_FREE( world->shared );
+
+     D_MAGIC_CLEAR( world );
+
+     D_FREE( world );
+
+     direct_shutdown();
+
+     return DR_OK;
+}
+
+/*
+ * Sets the fork() action of the calling Fusionee within the world.
+ */
+void
+fusion_world_set_fork_action( FusionWorld      *world,
+                              FusionForkAction  action )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+}
+
+/*
+ * Gets the current fork() action.
+ */
+FusionForkAction 
+fusion_world_get_fork_action( FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     return world->fork_action;
+}
+
+/*
+ * Registers a callback called upon fork().
+ */
+void
+fusion_world_set_fork_callback( FusionWorld        *world,
+                                FusionForkCallback  callback )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+}
+
+/*
+ * Return the index of the specified world.
+ */
+int
+fusion_world_index( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return 0;
+}
+
+
+/*
+ * Return true if this process is the master.
+ */
+bool
+fusion_master( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return true;
+}
+
+/*
+ * Sends a signal to one or more fusionees and optionally waits
+ * for their processes to terminate.
+ *
+ * A fusion_id of zero means all fusionees but the calling one.
+ * A timeout of zero means infinite waiting while a negative value
+ * means no waiting at all.
+ */
+DirectResult
+fusion_kill( FusionWorld *world,
+             FusionID     fusion_id,
+             int          signal,
+             int          timeout_ms )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return DR_OK;
+}
+
+/*
+ * Return the own Fusion ID within the specified world.
+ */
+FusionID
+fusion_id( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return 1;
+}
+
+/*
+ * Return if the world is a multi application world.
+ */
+bool
+fusion_is_multi( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return false;
+}
+
+/*
+ * Wait until all pending messages are processed.
+ */
+DirectResult
+fusion_sync( const FusionWorld *world )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return DR_OK;
+}
+
+/* Check if a pointer points to the shared memory. */
+bool
+fusion_is_shared( FusionWorld *world,
+                  const void  *ptr )
+{
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     return true;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/fusion.h b/Source/DirectFB/lib/fusion/fusion.h
new file mode 100755
index 0000000..bfe3da2
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/fusion.h
@@ -0,0 +1,142 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__FUSION_H__
+#define __FUSION__FUSION_H__
+
+#include <sys/types.h>
+
+#include <fusion/types.h>
+
+typedef enum {
+     FER_ANY,
+     FER_MASTER,
+     FER_SLAVE
+} FusionEnterRole;
+
+typedef enum {
+     FFA_CLOSE,
+     FFA_FORK
+} FusionForkAction;
+
+typedef enum {
+     FFS_PREPARE,
+     FFS_PARENT,
+     FFS_CHILD
+} FusionForkState;
+
+typedef void (*FusionForkCallback) ( FusionForkAction action, FusionForkState state );
+
+/*
+ * Enters a fusion world by joining or creating it.
+ *
+ * If <b>world_index</b> is negative, the next free index is used to create a new world.
+ * Otherwise the world with the specified index is joined or created.
+ */
+DirectResult fusion_enter( int               world_index,
+                           int               abi_version,
+                           FusionEnterRole   role,
+                           FusionWorld     **ret_world );
+
+/*
+ * Exits the fusion world.
+ *
+ * If 'emergency' is true the function won't join but kill the dispatcher thread.
+ */
+DirectResult fusion_exit( FusionWorld *world,
+                          bool         emergency );
+
+DirectResult fusion_stop_dispatcher( FusionWorld *world,
+                                     bool         emergency );
+
+/*
+ * Sets the fork() action of the calling Fusionee within the world.
+ */
+void fusion_world_set_fork_action( FusionWorld      *world,
+                                   FusionForkAction  action );
+                                   
+/*
+ * Gets the current fork() action.
+ */ 
+FusionForkAction fusion_world_get_fork_action( FusionWorld *world );
+
+/*
+ * Registers a callback called upon fork().
+ */
+void fusion_world_set_fork_callback( FusionWorld        *world,
+                                     FusionForkCallback  callback );
+
+/*
+ * Return the index of the specified world.
+ */
+int fusion_world_index( const FusionWorld *world );
+
+/*
+ * Return the own Fusion ID within the specified world.
+ */
+FusionID fusion_id( const FusionWorld *world );
+
+/*
+ * Return if the world is a multi application world.
+ */
+bool fusion_is_multi( const FusionWorld *world );
+
+/*
+ * Return the thread ID of the Fusion Dispatcher within the specified world.
+ */
+pid_t fusion_dispatcher_tid( const FusionWorld *world );
+
+/*
+ * Return true if this process is the master.
+ */
+bool fusion_master( const FusionWorld *world );
+
+/*
+ * Wait until all pending messages are processed.
+ */
+DirectResult fusion_sync( const FusionWorld *world );
+
+/*
+ * Sends a signal to one or more fusionees and optionally waits
+ * for their processes to terminate.
+ *
+ * A fusion_id of zero means all fusionees but the calling one.
+ * A timeout of zero means infinite waiting while a negative value
+ * means no waiting at all.
+ */
+DirectResult fusion_kill( FusionWorld *world,
+                          FusionID     fusion_id,
+                          int          signal,
+                          int          timeout_ms );
+
+/* Check if a pointer points to the shared memory. */
+bool fusion_is_shared( FusionWorld *world,
+                       const void  *ptr );
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/fusion.pc.in b/Source/DirectFB/lib/fusion/fusion.pc.in
new file mode 100755
index 0000000..09cf78c
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/fusion.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Fusion IPC
+Description: High Level IPC Mechanisms
+Version: @VERSION@
+Requires: direct
+Libs: -L${libdir} -lfusion
+Cflags: -I@INCLUDEDIR@
diff --git a/Source/DirectFB/lib/fusion/fusion_internal.h b/Source/DirectFB/lib/fusion/fusion_internal.h
new file mode 100755
index 0000000..5e7c474
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/fusion_internal.h
@@ -0,0 +1,185 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__FUSION_INTERNAL_H__
+#define __FUSION__FUSION_INTERNAL_H__
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <string.h>
+
+#include <direct/list.h>
+
+#include <fusion/build.h>
+#include <fusion/fusion.h>
+#include <fusion/lock.h>
+#include <fusion/ref.h>
+#include <fusion/shm/shm_internal.h>
+
+#if FUSION_BUILD_MULTI
+# if FUSION_BUILD_KERNEL
+#  include <sys/ioctl.h>
+#  include <linux/fusion.h>
+# else
+#  include <fusion/protocol.h>
+# endif
+#endif
+
+#define FUSION_MAX_WORLDS     8
+
+/***************************************
+ *  Fusion internal type declarations  *
+ ***************************************/
+
+struct __Fusion_FusionWorldShared {
+     int                  magic;
+     
+     int                  refs;     /* Increased by the master on fork(). */
+
+     int                  world_index;
+
+     int                  world_abi;
+
+     struct timeval       start_time;
+
+     DirectLink          *arenas;
+     FusionSkirmish       arenas_lock;
+
+     FusionSkirmish       reactor_globals;
+
+     FusionSHMShared      shm;
+
+     FusionSHMPoolShared *main_pool;
+     
+     DirectLink          *fusionees;   /* Connected fusionees. */
+     FusionSkirmish       fusionees_lock;
+    
+     unsigned int         call_ids;    /* Generates call ids. */
+     unsigned int         lock_ids;    /* Generates locks ids. */
+     unsigned int         ref_ids;     /* Generates refs ids. */
+     unsigned int         reactor_ids; /* Generates reactors ids. */
+     unsigned int         pool_ids;    /* Generates pools ids. */
+
+     void                *pool_base;   /* SHM pool allocation base. */ 
+     void                *pool_max;    /* SHM pool max address. */
+};
+
+struct __Fusion_FusionWorld {
+     int                  magic;
+
+     int                  refs;
+
+     FusionWorldShared   *shared;
+
+     int                  fusion_fd;
+     FusionID             fusion_id;
+
+     DirectThread        *dispatch_loop;
+     bool                 dispatch_stop;
+
+     /*
+      * List of reactors with at least one local reaction attached.
+      */
+     DirectLink          *reactor_nodes;
+     pthread_mutex_t      reactor_nodes_lock;
+
+     FusionSHM            shm;
+
+     FusionForkAction     fork_action;
+     FusionForkCallback   fork_callback;
+     
+     void                *fusionee;
+};
+
+/*******************************************
+ *  Fusion internal function declarations  *
+ *******************************************/
+
+int      _fusion_fd( const FusionWorldShared *shared );
+FusionID _fusion_id( const FusionWorldShared *shared );
+
+FusionWorld *_fusion_world( const FusionWorldShared *shared );
+
+/*
+ * from reactor.c
+ */
+void _fusion_reactor_free_all       ( FusionWorld   *world );
+void _fusion_reactor_process_message( FusionWorld   *world,
+                                      int            reactor_id,
+                                      int            channel,
+                                      const void    *msg_data );
+
+
+#if FUSION_BUILD_MULTI
+/*
+ * from call.c
+ */
+void _fusion_call_process( FusionWorld       *world,
+                           int                call_id,
+                           FusionCallMessage *call );
+
+#if FUSION_BUILD_KERNEL
+/*
+ * from shm.c
+ */
+void _fusion_shmpool_process( FusionWorld          *world,
+                              int                   pool_id,
+                              FusionSHMPoolMessage *msg );
+#else
+/*
+ * form fusion.c
+ */ 
+void _fusion_add_local( FusionWorld *world,
+                        FusionRef   *ref,
+                        int          add );
+
+void _fusion_check_locals( FusionWorld *world,
+                           FusionRef   *ref );
+
+void _fusion_remove_all_locals( FusionWorld     *world,
+                                const FusionRef *ref );
+                               
+DirectResult _fusion_send_message( int                  fd, 
+                                   const void          *msg, 
+                                   size_t               msg_size,
+                                   struct sockaddr_un  *addr );                                   
+DirectResult _fusion_recv_message( int                  fd, 
+                                   void                *msg,
+                                   size_t               msg_size,
+                                   struct sockaddr_un  *addr );
+
+/*
+ * from ref.c
+ */
+DirectResult _fusion_ref_change( FusionRef *ref, int add, bool global );
+                                   
+#endif /* FUSION_BUILD_KERNEL */
+#endif /* FUSION_BUILD_MULTI */
+
+#endif
diff --git a/Source/DirectFB/lib/fusion/hash.c b/Source/DirectFB/lib/fusion/hash.c
new file mode 100755
index 0000000..06723d2
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/hash.c
@@ -0,0 +1,560 @@
+/*
+   GLIB - Library of useful routines for C programming
+   Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ 
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi>,
+              Claudio Ciccani <klan@users.sf.net> and
+              Michael Emmel <mike.emmel@gmail.com>.
+ 
+   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.
+*/
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/util.h>
+#include <fusion/object.h>
+#include <fusion/shmalloc.h>
+#include <fusion/hash.h>
+
+
+D_DEBUG_DOMAIN( Fusion_Hash, "Fusion/Hash", "Hash table implementation" );
+
+
+
+
+static const unsigned int primes[] =
+{
+     11,
+     19,
+     37,
+     73,
+     109,
+     163,
+     251,
+     367,
+     557,
+     823,
+     1237,
+     1861,
+     2777,
+     4177,
+     6247,
+     9371,
+     14057,
+     21089,
+     31627,
+     47431,
+     71143,
+     106721,
+     160073,
+     240101,
+     360163,
+     540217,
+     810343,
+     1215497,
+     1823231,
+     2734867,
+     4102283,
+     6153409,
+     9230113,
+     13845163,
+};
+
+
+static const unsigned int nprimes = D_ARRAY_SIZE( primes );
+
+static DirectResult
+fusion_hash_create_internal(bool type,FusionSHMPoolShared *pool,
+                            FusionHashType key_type,
+                            FusionHashType value_type,
+                            int  size, FusionHash **ret_hash );
+
+static void
+fusion_hash_node_destroy (FusionHash *hash,FusionHashNode *node,
+                          void **old_key,void **old_value);
+
+static unsigned int
+spaced_primes_closest (unsigned int num)
+{
+     int i;
+     for (i = 0; i < nprimes; i++)
+          if (primes[i] > num)
+               return primes[i];
+     return primes[nprimes - 1];
+}
+
+/**
+ * fusion_hash_create_local:
+ * @key_type: Type of hash key the hash is optimized for strings ints and pointers 
+ * @value_type: Type of hash data optimized for strings ints and pointers 
+ * @size: Inital size of the hash table 
+ * @ret_hash:the new hash table
+ * Creates a new #FusionHash that uses local memory
+ * 
+ * Return value: a new #FusionHash.
+ **/
+DirectResult
+fusion_hash_create_local (FusionHashType key_type, FusionHashType value_type,
+                          int  size, FusionHash **ret_hash )
+{
+     return fusion_hash_create_internal(true,NULL,key_type,value_type,
+                                        size,ret_hash );
+
+}
+
+/**
+ * fusion_hash_create:
+ * @key_type: Type of hash key the hash is optimized for strings ints and pointers 
+ * @value_type: Type of hash data optimized for strings ints and pointers 
+ * @size: Inital size of the hash table 
+ * @ret_hash:the new hash table
+ * Creates a new #FusionHash with a reference count of 1.
+ * 
+ * Return value: a new #FusionHash.
+ **/
+DirectResult
+fusion_hash_create (FusionSHMPoolShared *pool,
+                    FusionHashType key_type,
+                    FusionHashType value_type,
+                    int  size, FusionHash **ret_hash )
+{
+     return fusion_hash_create_internal(false,pool,key_type,value_type,
+                                        size,ret_hash );
+}
+
+static DirectResult
+fusion_hash_create_internal (bool local,FusionSHMPoolShared *pool,
+                             FusionHashType key_type,
+                             FusionHashType value_type,
+                             int  size, FusionHash **ret_hash )
+{
+     FusionHash *hash;
+
+     if (!ret_hash)
+          return DR_BUG;
+     if (!local && !pool)
+          return DR_BUG;
+
+     if (size < FUSION_HASH_MIN_SIZE)
+          size = FUSION_HASH_MIN_SIZE;
+
+     if (local)
+          hash = D_CALLOC(1, sizeof (FusionHash) );
+     else
+          hash = SHCALLOC(pool, 1, sizeof (FusionHash) );
+
+     if (!hash)
+          return local ?DR_NOLOCALMEMORY:DR_NOSHAREDMEMORY;
+
+     hash->local              = local;
+     hash->pool               = pool;
+     hash->key_type           = key_type;
+     hash->value_type         = value_type;
+     hash->size               = size;
+     hash->nnodes             = 0;
+     if (local)
+          hash->nodes = D_CALLOC(size,sizeof (FusionHashNode*) );
+     else
+          hash->nodes = SHCALLOC(pool, size, sizeof(FusionHashNode*) );
+
+     if (!hash->nodes) {
+          if (local)
+               D_FREE(hash );
+          else
+               SHFREE(pool, hash );
+          return local?DR_NOLOCALMEMORY:DR_NOSHAREDMEMORY;
+     }
+
+     D_MAGIC_SET(hash, FusionHash );
+
+     *ret_hash = hash;
+
+     return DR_OK;
+}
+
+void
+fusion_hash_destroy( FusionHash *hash )
+{
+     int i;
+     FusionHashNode *node, *next;
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     for (i = 0; i < hash->size; i++) {
+          for (node = hash->nodes[i]; node; node = next) {
+               next = node->next;
+               fusion_hash_node_destroy(hash, node, NULL, NULL);
+          }
+     }
+     if (hash->local)
+          D_FREE(hash->nodes);
+     else
+          SHFREE( hash->pool, hash->nodes );
+     D_MAGIC_CLEAR( hash );
+     if (hash->local)
+          D_FREE(hash);
+     else
+          SHFREE( hash->pool, hash );
+}
+
+void
+fusion_hash_set_autofree( FusionHash *hash, bool free_keys, bool free_values )
+{
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     hash->free_keys   = free_keys;
+     hash->free_values = free_values;
+}
+
+/**
+ * fusion_hash_lookup:
+ * @hash: a #FusionHash.
+ * @key: the key to look up.
+ * 
+ * Looks up a key in a #FusionHash. Note that this function cannot
+ * distinguish between a key that is not present and one which is present
+ * and has the value %NULL. If you need this distinction, use
+ * hash_lookup_extended().
+ * 
+ * Return value: the associated value, or %NULL if the key is not found.
+ **/
+void *
+fusion_hash_lookup (FusionHash *hash, const void * key)
+{
+     FusionHashNode *node;
+     D_MAGIC_ASSERT( hash, FusionHash );
+     node = *fusion_hash_lookup_node (hash, key);
+     return node ? node->value : NULL;
+}
+
+/**
+ * fusion_hash_insert:
+ * @hash: a #FusionHash.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ * 
+ * Inserts a new key and value into a #FusionHash.
+ * If the key already exists in the #FusionHash DR_BUG is returned 
+ * If you think a key may exist you should call fusion_hash_replace
+ * Generally this is only used on a new FusionHash
+ **/
+DirectResult
+fusion_hash_insert( FusionHash *hash,
+                    void       *key,
+                    void       *value )
+{
+     FusionHashNode **node;
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     node = fusion_hash_lookup_node (hash, key);
+
+     if (*node) {
+          D_BUG( "key already exists" );
+          return DR_BUG;
+     }
+     else {
+          if (hash->local)
+               (*node) = D_CALLOC(1,sizeof(FusionHashNode));
+          else
+               (*node) = SHCALLOC(hash->pool, 1, sizeof(FusionHashNode));
+          if ( !(*node) )
+               return hash->local?DR_NOLOCALMEMORY:DR_NOSHAREDMEMORY;
+
+          (*node)->key = key;
+          (*node)->value = value;
+          hash->nnodes++;
+          if ( fusion_hash_should_resize(hash) )
+               fusion_hash_resize(hash);
+     }
+     return DR_OK;
+}
+
+/**
+ * hash_replace:
+ * @hash: a #FusionHash.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ * 
+ * Inserts a new key and value into a #FusionHash similar to 
+ * hash_insert(). The difference is that if the key already exists 
+ * in the #FusionHash, it gets replaced by the new key. 
+ * If you supplied a  oldkey pointer or oldkey value they are returned
+ * otherwise free is called the key if table type is not type HASH_INT
+ * and free is called on the old value if not supplied
+ **/
+DirectResult
+fusion_hash_replace (FusionHash *hash,
+                     void *   key, 
+                     void *   value,
+                     void **old_key,
+                     void **old_value)
+{
+     FusionHashNode **node;
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     node = fusion_hash_lookup_node (hash, key);
+
+     if (*node) {
+          if ( old_key)
+               *old_key = (*node)->key;
+          else if ( hash->key_type != HASH_INT ) {
+               if (hash->free_keys) {
+                    if (hash->local)
+                         D_FREE((*node)->key);
+                    else
+                         SHFREE(hash->pool, (*node)->key );
+               }
+          }
+
+          if ( old_value)
+               *old_value = (*node)->value;
+          else if ( hash->value_type != HASH_INT ) {
+               if (hash->free_values) {
+                    if (hash->local)
+                         D_FREE((*node)->value);
+                    else
+                         SHFREE(hash->pool, (*node)->value );
+               }
+          }
+     }
+     else {
+          if (hash->local)
+               *node = D_CALLOC(1, sizeof(FusionHashNode));
+          else
+               *node = SHCALLOC(hash->pool, 1, sizeof(FusionHashNode));
+
+          if ( !(*node) )
+               return hash->local?DR_NOLOCALMEMORY:DR_NOSHAREDMEMORY;
+
+          hash->nnodes++;
+     }
+     (*node)->key = (void*)key;
+     (*node)->value = (void*)value;
+
+     return DR_OK;
+}
+
+/**
+ * fusion_hash_remove:
+ * @hash: a #FusionHash.
+ * @key: the key to remove.
+ * @old_key: returned old_key 
+ * @old_value: returned old_value 
+ * Removes a key and its associated value from a #FusionHash.
+ *
+ * If the #FusionHash was created using hash_new_full(), the
+ * key and value are freed using the supplied destroy functions, otherwise
+ * you have to make sure that any dynamically allocated values are freed 
+ * yourself.
+ * If you supplied a  oldkey pointer or oldkey value they are returned
+ * otherwise free is called the key if table type is not type HASH_INT
+ * and free is called on the old value if not supplied
+ * 
+ **/
+DirectResult
+fusion_hash_remove (FusionHash    *hash,
+                    const void *  key,
+                    void **old_key,
+                    void **old_value)
+{
+     FusionHashNode **node, *dest;
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     node = fusion_hash_lookup_node (hash, key);
+     if (*node) {
+          dest = *node;
+          (*node) = dest->next;
+          fusion_hash_node_destroy(hash, dest, old_key, old_value);
+          hash->nnodes--;
+          return DR_OK;
+     }
+     return DR_OK;
+}
+
+/**
+ * hash_foreach:
+ * @hash: a #FusionHash.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ * 
+ * Calls the given function for each of the key/value pairs in the
+ * #FusionHash.  The function is passed the key and value of each
+ * pair, and the given @user_data parameter.  The hash table may not
+ * be modified while iterating over it (you can't add/remove
+ * items). To remove all items matching a predicate, use
+ * hash_foreach_remove().
+ **/
+void
+fusion_hash_iterate( FusionHash             *hash,
+                     FusionHashIteratorFunc  func,
+                     void                   *ctx )
+{
+     int i;
+     FusionHashNode *node;
+     FusionHashNode *next;
+
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     for (i = 0; i < hash->size; i++) {
+          for (node = hash->nodes[i]; node; node = next) {
+               next = node->next;
+
+               if ( func(hash, node->key, node->value, ctx))
+                    return;
+          }
+     }
+}
+
+/**
+ * hash_size:
+ * @hash: a #FusionHash.
+ * 
+ * Returns the number of elements contained in the #FusionHash.
+ * 
+ * Return value: the number of key/value pairs in the #FusionHash.
+ **/
+unsigned int
+fusion_hash_size (FusionHash *hash)
+{
+     D_MAGIC_ASSERT( hash, FusionHash );
+     return hash->nnodes;
+}
+
+/**
+ * fusion_hash_should_resize:
+ * Call the function after adding or removing several
+ * values it has a decent heurisitc to determine if
+ * the hash has grown to large
+ */
+bool fusion_hash_should_resize ( FusionHash    *hash)
+{
+     D_MAGIC_ASSERT( hash, FusionHash );
+     if ((hash->size >= 3 * hash->nnodes &&
+          hash->size > FUSION_HASH_MIN_SIZE) ||
+         (3 * hash->size <= hash->nnodes &&
+          hash->size < FUSION_HASH_MAX_SIZE))
+          return true;
+     return false;
+}
+
+/* Hash Functions
+ * Resize the hash to minumim for this number of entries
+ */
+DirectResult
+fusion_hash_resize (FusionHash *hash)
+{
+     FusionHashNode **new_nodes;
+     FusionHashNode *node;
+     FusionHashNode *next;
+     unsigned int hash_val;
+     int new_size;
+     int i;
+     D_MAGIC_ASSERT( hash, FusionHash );
+
+     new_size = spaced_primes_closest (hash->nnodes);
+     if (new_size > FUSION_HASH_MAX_SIZE )
+          new_size = FUSION_HASH_MAX_SIZE;
+     if (new_size <  FUSION_HASH_MIN_SIZE)
+          new_size = FUSION_HASH_MIN_SIZE;
+
+     if (hash->local)
+          new_nodes = D_CALLOC (new_size, sizeof(FusionHashNode*));
+     else
+          new_nodes = SHCALLOC (hash->pool, new_size, sizeof(FusionHashNode*));
+     if (!new_nodes)
+          return hash->local?DR_NOLOCALMEMORY:DR_NOSHAREDMEMORY;
+
+     for (i = 0; i < hash->size; i++)
+          for (node = hash->nodes[i]; node; node = next) {
+               next = node->next;
+               /*TODO We could also optimize pointer hashing*/
+               if (hash->key_type == HASH_STRING ) {
+                    unsigned int h;
+                    const signed char *p = node->key;
+                    HASH_STR(h, p)
+                    hash_val = h % new_size;
+               }
+               else
+                    hash_val = ((unsigned long)node->key) % new_size;
+
+               node->next = new_nodes[hash_val];
+               new_nodes[hash_val] = node;
+          }
+     if (hash->local)
+          D_FREE(hash->nodes);
+     else
+          SHFREE(hash->pool, hash->nodes);
+     hash->nodes = new_nodes;
+     hash->size = new_size;
+     return true;
+}
+
+
+static void
+fusion_hash_node_destroy (FusionHash *hash,FusionHashNode *node,
+                          void **old_key,void **old_value)
+{
+     if (!node )
+          return;
+
+     if ( old_key)
+          *old_key = node->key;
+     else if ( hash->key_type != HASH_INT ) {
+          if (hash->free_keys) {
+               if ( hash->local)
+                    D_FREE(node->key );
+               else
+                    SHFREE(hash->pool,node->key );
+          }
+     }
+
+     if ( old_value)
+          *old_value = node->value;
+     else if ( hash->value_type != HASH_INT ) {
+          if (hash->free_values) {
+               if ( hash->local)
+                    D_FREE(node->value );
+               else
+                    SHFREE(hash->pool,node->value );
+          }
+     }
+
+     if ( hash->local)
+          D_FREE(node);
+     else
+          SHFREE(hash->pool,node);
+}
+
diff --git a/Source/DirectFB/lib/fusion/hash.h b/Source/DirectFB/lib/fusion/hash.h
new file mode 100755
index 0000000..8c8b459
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/hash.h
@@ -0,0 +1,179 @@
+/*
+    GLIB - Library of useful routines for C programming
+    Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi>,
+              Claudio Ciccani <klan@users.sf.net> and
+              Michael Emmel <memmel@gmail.com>.
+ 
+   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.
+*/
+
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __FUSION_HASH_H__
+#define __FUSION_HASH_H__
+
+#include <fusion/types.h>
+#include <fusion/shmalloc.h>
+#include <string.h>
+
+#define FUSION_HASH_MIN_SIZE 11
+#define FUSION_HASH_MAX_SIZE 13845163
+
+#define HASH_STR(h,p) \
+{\
+    h = *p;\
+    if (h)\
+        for (p += 1; *p != '\0'; p++)\
+            h = (h << 5) - h + *p;\
+}\
+
+typedef enum {
+HASH_PTR,
+HASH_STRING,
+HASH_INT
+}
+FusionHashType;
+
+typedef struct _FusionHashNode  FusionHashNode;
+
+struct _FusionHashNode
+{
+    void      *key;
+    void      *value;
+    FusionHashNode *next;
+};
+
+struct __Fusion_FusionHash
+{
+    int       magic;
+    bool      local;
+    FusionHashType key_type;
+    FusionHashType value_type;
+    int             size;
+    int             nnodes;
+    FusionHashNode      **nodes;
+    FusionSHMPoolShared *pool;
+
+    bool  free_keys;
+    bool  free_values;
+};
+
+typedef bool (*FusionHashIteratorFunc)( FusionHash *hash,
+                                        void       *key,
+                                        void       *value,
+                                        void       *ctx );
+
+
+DirectResult
+fusion_hash_resize (FusionHash  *hash);
+
+DirectResult
+fusion_hash_create (FusionSHMPoolShared *pool,
+                    FusionHashType key_type,
+                    FusionHashType value_type,
+                    int  size, FusionHash **ret_hash );
+
+DirectResult
+fusion_hash_create_local (FusionHashType key_type, FusionHashType value_type,
+                          int  size, FusionHash **ret_hash );
+
+DirectResult
+fusion_hash_remove (FusionHash    *hash,
+                    const void *  key,
+                    void **old_key,
+                    void **old_value);
+
+DirectResult
+fusion_hash_insert( FusionHash *hash, void  *key, void  *value );
+
+DirectResult
+fusion_hash_replace (FusionHash *hash,
+                     void *   key, 
+                     void *   value,
+                     void **old_key,
+                     void **old_value);
+void
+fusion_hash_destroy( FusionHash *hash );
+
+void
+fusion_hash_set_autofree( FusionHash *hash, bool free_keys, bool free_values );
+
+void *
+fusion_hash_lookup (FusionHash *hash, const void * key);
+
+void
+fusion_hash_iterate( FusionHash             *hash,
+                     FusionHashIteratorFunc  func,
+                     void                   *ctx );
+
+unsigned int
+fusion_hash_size (FusionHash *hash);
+
+bool fusion_hash_should_resize ( FusionHash    *hash);
+
+
+static inline FusionHashNode**
+fusion_hash_lookup_node (FusionHash *hash,
+              const void *   key)
+{
+  FusionHashNode **node;
+
+  /*TODO We could also optimize pointer hashing*/
+  if (hash->key_type == HASH_STRING )
+  {
+    unsigned int h;
+    const signed char *p = key;
+    HASH_STR(h,p)
+    node = &hash->nodes[h % hash->size];
+  }
+  else
+    node = &hash->nodes[((unsigned long)key) % hash->size];
+
+    /* Hash table lookup needs to be fast.
+     *  We therefore remove the extra conditional of testing
+     *  whether to call the key_equal_func or not from
+     *  the inner loop.
+     */
+    if (hash->key_type == HASH_STRING ) {
+        while(*node && strcmp((const char *)(*node)->key,(const char*)key))
+            node = &(*node)->next;
+    }
+    else
+        while (*node && (*node)->key != key)
+            node = &(*node)->next;
+
+  return node;
+
+}
+
+
+
+#endif /*__FUSION_HASH_H__*/
+
diff --git a/Source/DirectFB/lib/fusion/lock.c b/Source/DirectFB/lib/fusion/lock.c
new file mode 100755
index 0000000..33945c5
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/lock.c
@@ -0,0 +1,687 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+
+#include <sys/param.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/build.h>
+#include <fusion/types.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+
+#include "fusion_internal.h"
+
+
+#if FUSION_BUILD_MULTI
+
+D_DEBUG_DOMAIN( Fusion_Skirmish, "Fusion/Skirmish", "Fusion's Skirmish (Mutex)" );
+
+
+#if FUSION_BUILD_KERNEL
+
+DirectResult
+fusion_skirmish_init( FusionSkirmish    *skirmish,
+                      const char        *name,
+                      const FusionWorld *world )
+{
+     FusionEntryInfo info;
+
+     D_ASSERT( skirmish != NULL );
+     D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     D_DEBUG_AT( Fusion_Skirmish, "fusion_skirmish_init( %p, '%s' )\n", skirmish, name ? : "" );
+
+     while (ioctl( world->fusion_fd, FUSION_SKIRMISH_NEW, &skirmish->multi.id )) {
+          if (errno == EINTR)
+               continue;
+
+          D_PERROR( "FUSION_SKIRMISH_NEW" );
+          return DR_FUSION;
+     }
+
+     D_DEBUG_AT( Fusion_Skirmish, "  -> new skirmish %p [%d]\n", skirmish, skirmish->multi.id );
+     
+     info.type = FT_SKIRMISH;
+     info.id   = skirmish->multi.id;
+
+     direct_snputs( info.name, name, sizeof(info.name) );
+
+     ioctl( world->fusion_fd, FUSION_ENTRY_SET_INFO, &info );
+
+     /* Keep back pointer to shared world data. */
+     skirmish->multi.shared = world->shared;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_prevail( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_PREVAIL, &skirmish->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_PREVAIL");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_swoop( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_SWOOP, &skirmish->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EAGAIN:
+                    return DR_BUSY;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_SWOOP");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_lock_count( FusionSkirmish *skirmish, int *lock_count )
+{
+     int data[2];
+
+     D_ASSERT( skirmish != NULL );
+
+     data[0] = skirmish->multi.id;
+     data[1] = 0;
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_LOCK_COUNT, data)) {
+           switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+           }
+
+          D_PERROR ("FUSION_SKIRMISH_LOCK_COUNT");
+          return DR_FUSION;
+     }
+
+     *lock_count = data[1];
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_dismiss (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_DISMISS, &skirmish->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_DISMISS");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_destroy (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     D_DEBUG_AT( Fusion_Skirmish, "fusion_skirmish_destroy( %p [%d] )\n", skirmish, skirmish->multi.id );
+     
+     while (ioctl( _fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_DESTROY, &skirmish->multi.id )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+                    
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_DESTROY");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_wait( FusionSkirmish *skirmish, unsigned int timeout )
+{
+     FusionSkirmishWait wait;
+
+     D_ASSERT( skirmish != NULL );
+
+     wait.id         = skirmish->multi.id;
+     wait.timeout    = timeout;
+     wait.lock_count = 0;
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_WAIT, &wait)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case ETIMEDOUT:
+                    return DR_TIMEOUT;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_WAIT");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_notify( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+
+     while (ioctl (_fusion_fd( skirmish->multi.shared ), FUSION_SKIRMISH_NOTIFY, &skirmish->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR ("Fusion/Lock: invalid skirmish\n");
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR ("FUSION_SKIRMISH_NOTIFY");
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+#include <direct/clock.h>
+#include <direct/list.h>
+#include <direct/system.h>
+
+typedef struct {
+     DirectLink  link;
+     
+     pid_t       pid;
+     bool        notified;
+} WaitNode;
+
+
+DirectResult
+fusion_skirmish_init( FusionSkirmish    *skirmish,
+                      const char        *name,
+                      const FusionWorld *world )
+{
+     D_ASSERT( skirmish != NULL );
+     //D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+     
+     D_DEBUG_AT( Fusion_Skirmish, "fusion_skirmish_init( %p, '%s' )\n", 
+                 skirmish, name ? : "" );
+     
+     skirmish->multi.id = ++world->shared->lock_ids;
+     
+     /* Set state to unlocked. */
+     skirmish->multi.builtin.locked = 0;
+     skirmish->multi.builtin.owner  = 0;
+
+     skirmish->multi.builtin.waiting = NULL;
+    
+     skirmish->multi.builtin.requested = false;
+     skirmish->multi.builtin.destroyed = false;
+     
+     /* Keep back pointer to shared world data. */
+     skirmish->multi.shared = world->shared;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_prevail( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+     
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+          
+     asm( "" ::: "memory" );
+
+     if (skirmish->multi.builtin.locked &&
+         skirmish->multi.builtin.owner != direct_gettid())
+     {
+          int count = 0;
+          
+          while (skirmish->multi.builtin.locked) {
+               /* Check whether owner exited without unlocking. */
+               if (kill( skirmish->multi.builtin.owner, 0 ) < 0 && errno == ESRCH) { 
+                    skirmish->multi.builtin.locked = 0;
+                    skirmish->multi.builtin.requested = false; 
+                    break;
+               }
+
+               skirmish->multi.builtin.requested = true;
+               
+               asm( "" ::: "memory" );
+               
+               if (++count > 1000) {
+                    usleep( 10000 );
+                    count = 0;
+               }
+               else {
+                    direct_sched_yield();
+               }
+               
+               if (skirmish->multi.builtin.destroyed)
+                    return DR_DESTROYED;
+          }
+     }
+     
+     skirmish->multi.builtin.locked++;
+     skirmish->multi.builtin.owner = direct_gettid();
+     
+     asm( "" ::: "memory" );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_swoop( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+     
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+          
+     asm( "" ::: "memory" );
+          
+     if (skirmish->multi.builtin.locked &&
+         skirmish->multi.builtin.owner != direct_gettid()) {
+          /* Check whether owner exited without unlocking. */
+          if (kill( skirmish->multi.builtin.owner, 0 ) < 0 && errno == ESRCH) { 
+               skirmish->multi.builtin.locked = 0;
+               skirmish->multi.builtin.requested = false;
+          }
+          else
+               return DR_BUSY;
+     }
+          
+     skirmish->multi.builtin.locked++;
+     skirmish->multi.builtin.owner = direct_gettid();
+     
+     asm( "" ::: "memory" );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_lock_count( FusionSkirmish *skirmish, int *lock_count )
+{
+     D_ASSERT( skirmish != NULL );
+     
+     if (skirmish->multi.builtin.destroyed) {
+          *lock_count = 0;
+          return DR_DESTROYED;
+     }
+
+     *lock_count = skirmish->multi.builtin.locked;
+     
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_dismiss (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+     
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+          
+     asm( "" ::: "memory" );
+
+     if (skirmish->multi.builtin.locked) {
+          if (skirmish->multi.builtin.owner != direct_gettid()) {
+               D_ERROR( "Fusion/Skirmish: "
+                        "Tried to dismiss a skirmish not owned by current process!\n" );
+               return DR_ACCESSDENIED;
+          }
+          
+          if (--skirmish->multi.builtin.locked == 0) {
+               skirmish->multi.builtin.owner = 0;
+
+               if (skirmish->multi.builtin.requested) {
+                    skirmish->multi.builtin.requested = false;
+                    direct_sched_yield();
+               }
+          }
+     }
+     
+     asm( "" ::: "memory" );
+     
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_destroy (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     D_DEBUG_AT( Fusion_Skirmish, "fusion_skirmish_destroy( %p )\n", skirmish );
+     
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+          
+     if (skirmish->multi.builtin.waiting)
+          fusion_skirmish_notify( skirmish );
+          
+     skirmish->multi.builtin.destroyed = true;
+
+     return DR_OK;
+}
+
+#ifdef SIGRTMAX
+# define SIGRESTART  SIGRTMAX
+#else
+# define SIGRESTART  SIGCONT
+#endif
+
+static void restart_handler( int s ) {}
+
+DirectResult
+fusion_skirmish_wait( FusionSkirmish *skirmish, unsigned int timeout )
+{
+     WaitNode         *node;
+     long long         stop;
+     struct sigaction  act, oldact;
+     sigset_t          mask, set;
+     DirectResult      ret = DR_OK;
+     
+     D_ASSERT( skirmish != NULL );
+     
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+ 
+     /* Set timeout. */
+     stop = direct_clock_get_micros() + timeout * 1000ll;
+      
+     /* Add ourself to the list of waiting processes. */    
+     node = SHMALLOC( skirmish->multi.shared->main_pool, sizeof(WaitNode) );
+     if (!node)
+          return D_OOSHM();
+     
+     node->pid      = direct_gettid();
+     node->notified = false;
+     
+     direct_list_append( &skirmish->multi.builtin.waiting, &node->link );
+      
+     /* Install a (fake) signal handler for SIGRESTART. */
+     act.sa_handler = restart_handler;
+     act.sa_flags   = SA_RESETHAND | SA_RESTART | SA_NOMASK;
+     
+     sigaction( SIGRESTART, &act, &oldact );
+     
+     /* Unblock SIGRESTART. */
+     sigprocmask( SIG_SETMASK, NULL, &mask );
+     sigdelset( &mask, SIGRESTART );
+
+     fusion_skirmish_dismiss( skirmish );
+
+     while (!node->notified) {
+          if (timeout) {
+               long long now = direct_clock_get_micros();
+
+               if (now >= stop) {
+                    /* Stop notifying us. */
+                    node->notified = true;
+                    ret = DR_TIMEOUT;
+                    break;
+               }
+               
+               sigprocmask( SIG_SETMASK, &mask, &set );
+               usleep( stop - now );
+               sigprocmask( SIG_SETMASK, &set, NULL );           
+          }
+          else {
+               sigsuspend( &mask );
+          }
+     }
+
+     /* Flush pending signals. */
+     if (!sigpending( &set ) && sigismember( &set, SIGRESTART ) > 0)
+          sigsuspend( &mask );
+     
+     if (fusion_skirmish_prevail( skirmish ))
+          ret = DR_DESTROYED;
+     
+     direct_list_remove( &skirmish->multi.builtin.waiting, &node->link );
+
+     SHFREE( skirmish->multi.shared->main_pool, node );
+     
+     sigaction( SIGRESTART, &oldact, NULL );
+
+     return ret;
+}
+
+DirectResult
+fusion_skirmish_notify( FusionSkirmish *skirmish )
+{
+     WaitNode *node, *temp;
+     
+     D_ASSERT( skirmish != NULL );
+
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     direct_list_foreach_safe (node, temp, skirmish->multi.builtin.waiting) {
+          if (node->notified)
+               continue;
+
+          node->notified = true;
+
+          if (kill( node->pid, SIGRESTART ) < 0) {
+               if (errno == ESRCH) {
+                    /* Remove dead process. */
+                    direct_list_remove( &skirmish->multi.builtin.waiting, &node->link );
+                    SHFREE( skirmish->multi.shared->main_pool, node );
+               }
+               else {
+                    D_PERROR( "Fusion/Skirmish: Couldn't send notification signal!\n" );
+               }
+          }
+     }
+
+     return DR_OK;
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+#else  /* FUSION_BUILD_MULTI */
+
+DirectResult
+fusion_skirmish_init( FusionSkirmish    *skirmish,
+                      const char        *name,
+                      const FusionWorld *world )
+{
+     D_ASSERT( skirmish != NULL );
+
+     direct_util_recursive_pthread_mutex_init( &skirmish->single.lock );
+     pthread_cond_init( &skirmish->single.cond, NULL );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_prevail (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     if (pthread_mutex_lock( &skirmish->single.lock ))
+          return errno2result( errno );
+
+     skirmish->single.count++;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_swoop (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     if (pthread_mutex_trylock( &skirmish->single.lock ))
+          return errno2result( errno );
+
+     skirmish->single.count++;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_lock_count( FusionSkirmish *skirmish, int *lock_count )
+{
+     D_ASSERT( skirmish != NULL );
+     D_ASSERT( lock_count != NULL );
+     
+     if (pthread_mutex_trylock( &skirmish->single.lock )) {
+          *lock_count = 0;
+          return errno2result( errno );
+     }
+
+     *lock_count = skirmish->single.count;
+
+     pthread_mutex_unlock( &skirmish->single.lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_dismiss (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+
+     skirmish->single.count--;
+
+     if (pthread_mutex_unlock( &skirmish->single.lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_skirmish_destroy (FusionSkirmish *skirmish)
+{
+     D_ASSERT( skirmish != NULL );
+     
+     pthread_cond_broadcast( &skirmish->single.cond );
+     pthread_cond_destroy( &skirmish->single.cond );
+
+     return pthread_mutex_destroy( &skirmish->single.lock );
+}
+
+DirectResult
+fusion_skirmish_wait( FusionSkirmish *skirmish, unsigned int timeout )
+{
+     D_ASSERT( skirmish != NULL );
+     
+     if (timeout) {
+          struct timespec ts;
+          struct timeval  tv;
+          int             ret;
+          
+          gettimeofday( &tv, NULL );
+          
+          ts.tv_nsec = tv.tv_usec*1000 + (timeout%1000)*1000000;
+          ts.tv_sec  = tv.tv_sec + timeout/1000 + ts.tv_nsec/1000000000;
+          ts.tv_nsec = ts.tv_nsec % 1000000000;
+          
+          ret = pthread_cond_timedwait( &skirmish->single.cond, 
+                                        &skirmish->single.lock, &ts );
+                                        
+          return (ret == ETIMEDOUT) ? DR_TIMEOUT : DR_OK;
+     }
+
+     return pthread_cond_wait( &skirmish->single.cond, &skirmish->single.lock );
+}
+
+DirectResult
+fusion_skirmish_notify( FusionSkirmish *skirmish )
+{
+     D_ASSERT( skirmish != NULL );
+
+     pthread_cond_broadcast( &skirmish->single.cond );
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/lock.h b/Source/DirectFB/lib/fusion/lock.h
new file mode 100755
index 0000000..d5071bb
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/lock.h
@@ -0,0 +1,122 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__LOCK_H__
+#define __FUSION__LOCK_H__
+
+#include <pthread.h>
+
+#include <fusion/types.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+
+typedef union {
+     /* multi app */
+     struct {
+          int                      id;
+          const FusionWorldShared *shared;
+          /* builtin impl */
+          struct {
+               unsigned int        locked;
+               pid_t               owner;
+               DirectLink         *waiting;
+               bool                requested;
+               bool                destroyed;
+          } builtin;
+     } multi;
+     
+     /* single app */
+     struct {
+          pthread_mutex_t          lock;
+          pthread_cond_t           cond;
+          int                      count;
+     } single;
+} FusionSkirmish;
+
+/*
+ * Initialize.
+ */
+DirectResult fusion_skirmish_init   ( FusionSkirmish    *skirmish,
+                                      const char        *name,
+                                      const FusionWorld *world );
+
+/*
+ * Lock.
+ */
+DirectResult fusion_skirmish_prevail( FusionSkirmish    *skirmish );
+
+/*
+ * Try lock.
+ */
+DirectResult fusion_skirmish_swoop  ( FusionSkirmish    *skirmish );
+
+/*
+ * Find out how many times current thread has acquired lock. 
+ */
+DirectResult fusion_skirmish_lock_count( FusionSkirmish *skirmish, int *lock_count );
+
+/*
+ * Unlock.
+ */
+DirectResult fusion_skirmish_dismiss( FusionSkirmish    *skirmish );
+
+/*
+ * Deinitialize.
+ */
+DirectResult fusion_skirmish_destroy( FusionSkirmish    *skirmish );
+
+/*
+ * Wait & Notify.
+ *
+ * Must be locked!
+ */
+DirectResult fusion_skirmish_wait   ( FusionSkirmish    *skirmish,
+                                      unsigned int       timeout );
+DirectResult fusion_skirmish_notify ( FusionSkirmish    *skirmish );
+
+
+#if D_DEBUG_ENABLED
+#define FUSION_SKIRMISH_ASSERT(skirmish)                                                  \
+     do {                                                                                 \
+          int lock_count;                                                                 \
+                                                                                          \
+          D_ASSERT( skirmish != NULL );                                                   \
+                                                                                          \
+          D_ASSERT( fusion_skirmish_lock_count( skirmish, &lock_count ) == DR_OK );      \
+          D_ASSERT( lock_count > 0 );                                                     \
+     } while (0)
+#else
+#define FUSION_SKIRMISH_ASSERT(skirmish)                                                  \
+     do {                                                                                 \
+     } while (0)
+#endif
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/object.c b/Source/DirectFB/lib/fusion/object.c
new file mode 100755
index 0000000..9138889
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/object.c
@@ -0,0 +1,640 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <sys/param.h>
+
+#include <pthread.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <fusion/build.h>
+#include <fusion/object.h>
+#include <fusion/hash.h>
+#include <fusion/shmalloc.h>
+
+#include "fusion_internal.h"
+
+D_DEBUG_DOMAIN( Fusion_Object, "Fusion/Object", "Fusion Objects and Pools" );
+
+struct __Fusion_FusionObjectPool {
+     int                     magic;
+
+     FusionWorldShared      *shared;
+
+     FusionSkirmish          lock;
+     DirectLink             *objects;
+     FusionObjectID          id_pool;
+
+     char                   *name;
+     int                     object_size;
+     int                     message_size;
+     FusionObjectDestructor  destructor;
+     void                   *ctx;
+
+     FusionCall              call;
+};
+
+static FusionCallHandlerResult
+object_reference_watcher( int caller, int call_arg, void *call_ptr, void *ctx, unsigned int serial, int *ret_val )
+{
+     FusionObject     *object;
+     FusionObjectPool *pool = ctx;
+
+     D_DEBUG_AT( Fusion_Object, "%s( %d, %d, %p, %p, %u, %p )\n",
+                 __FUNCTION__, caller, call_arg, call_ptr, ctx, serial, ret_val );
+
+#if FUSION_BUILD_KERNEL
+     if (caller) {
+          D_BUG( "Call not from Fusion/Kernel (caller %d)", caller );
+          return FCHR_RETURN;
+     }
+#endif
+
+     D_MAGIC_ASSERT( pool, FusionObjectPool );
+
+     /* Lock the pool. */
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return FCHR_RETURN;
+
+     /* Lookup the object. */
+     direct_list_foreach (object, pool->objects) {
+          if (object->id != call_arg)
+               continue;
+
+          D_MAGIC_ASSERT( object, FusionObject );
+
+          switch (fusion_ref_zero_trylock( &object->ref )) {
+               case DR_OK:
+                    break;
+
+               case DR_DESTROYED:
+                    D_BUG( "already destroyed %p [%ld] in '%s'", object, object->id, pool->name );
+
+                    direct_list_remove( &pool->objects, &object->link );
+                    fusion_skirmish_dismiss( &pool->lock );
+                    return FCHR_RETURN;
+
+
+               default:
+                    D_ERROR( "Fusion/ObjectPool: Error locking ref of %p [%ld] in '%s'\n",
+                             object, object->id, pool->name );
+                    /* fall through */
+
+               case DR_BUSY:
+                    fusion_skirmish_dismiss( &pool->lock );
+                    return FCHR_RETURN;
+          }
+
+          D_DEBUG_AT( Fusion_Object, "== %s ==\n", pool->name );
+          D_DEBUG_AT( Fusion_Object, "  -> dead object %p [%ld]\n", object, object->id );
+
+          if (object->state == FOS_INIT) {
+               D_BUG( "== %s == incomplete object: %d (%p)", pool->name, call_arg, object );
+               D_WARN( "won't destroy incomplete object, leaking some memory" );
+               direct_list_remove( &pool->objects, &object->link );
+               fusion_skirmish_dismiss( &pool->lock );
+               return FCHR_RETURN;
+          }
+
+          /* Set "deinitializing" state. */
+          object->state = FOS_DEINIT;
+
+          /* Remove the object from the pool. */
+          object->pool = NULL;
+          direct_list_remove( &pool->objects, &object->link );
+
+          /* Unlock the pool. */
+          fusion_skirmish_dismiss( &pool->lock );
+
+
+          D_DEBUG_AT( Fusion_Object, "  -> calling destructor...\n" );
+
+          /* Call the destructor. */
+          pool->destructor( object, false, pool->ctx );
+
+          D_DEBUG_AT( Fusion_Object, "  -> destructor done.\n" );
+
+          return FCHR_RETURN;
+     }
+
+     D_BUG( "unknown object [%d] in '%s'", call_arg, pool->name );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return FCHR_RETURN;
+}
+
+FusionObjectPool *
+fusion_object_pool_create( const char             *name,
+                           int                     object_size,
+                           int                     message_size,
+                           FusionObjectDestructor  destructor,
+                           void                   *ctx,
+                           const FusionWorld      *world )
+{
+     FusionObjectPool  *pool;
+     FusionWorldShared *shared;
+
+     D_ASSERT( name != NULL );
+     D_ASSERT( object_size >= sizeof(FusionObject) );
+     D_ASSERT( message_size > 0 );
+     D_ASSERT( destructor != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     /* Allocate shared memory for the pool. */
+     pool = SHCALLOC( shared->main_pool, 1, sizeof(FusionObjectPool) );
+     if (!pool) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     /* Initialize the pool lock. */
+     fusion_skirmish_init( &pool->lock, name, world );
+
+     /* Fill information. */
+     pool->shared       = shared;
+     pool->name         = SHSTRDUP( shared->main_pool, name );
+     pool->object_size  = object_size;
+     pool->message_size = message_size;
+     pool->destructor   = destructor;
+     pool->ctx          = ctx;
+
+     /* Destruction call from Fusion. */
+     fusion_call_init( &pool->call, object_reference_watcher, pool, world );
+
+     D_MAGIC_SET( pool, FusionObjectPool );
+
+     return pool;
+}
+
+DirectResult
+fusion_object_pool_destroy( FusionObjectPool  *pool,
+                            const FusionWorld *world )
+{
+     DirectResult       ret;
+     DirectLink        *n;
+     FusionObject      *object;
+     FusionWorldShared *shared;
+
+     D_ASSERT( pool != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+     D_ASSERT( shared == pool->shared );
+
+     D_DEBUG_AT( Fusion_Object, "== %s ==\n", pool->name );
+     D_DEBUG_AT( Fusion_Object, "  -> destroying pool...\n" );
+
+     D_DEBUG_AT( Fusion_Object, "  -> syncing...\n" );
+
+     /* Wait for processing of pending messages. */
+     if (pool->objects)
+          fusion_sync( world );
+
+     D_DEBUG_AT( Fusion_Object, "  -> locking...\n" );
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret)
+          return ret;
+
+     /* Destroy the call. */
+     fusion_call_destroy( &pool->call );
+
+     if (pool->objects)
+          D_WARN( "still objects in '%s'", pool->name );
+
+     /* Destroy zombies */
+     direct_list_foreach_safe (object, n, pool->objects) {
+          int refs;
+
+          fusion_ref_stat( &object->ref, &refs );
+
+          D_DEBUG_AT( Fusion_Object, "== %s ==\n", pool->name );
+          D_DEBUG_AT( Fusion_Object, "  -> zombie %p [%ld], refs %d\n", object, object->id, refs );
+
+          /* Set "deinitializing" state. */
+          object->state = FOS_DEINIT;
+
+          /* Remove the object from the pool. */
+          //direct_list_remove( &pool->objects, &object->link );
+          //object->pool = NULL;
+
+          D_DEBUG_AT( Fusion_Object, "  -> calling destructor...\n" );
+
+          /* Call the destructor. */
+          pool->destructor( object, refs > 0, pool->ctx );
+
+          D_DEBUG_AT( Fusion_Object, "  -> destructor done.\n" );
+
+          D_ASSERT( ! direct_list_contains_element_EXPENSIVE( pool->objects, (DirectLink*) object ) );
+     }
+
+     pool->objects = NULL;
+
+     /* Destroy the pool lock. */
+     fusion_skirmish_destroy( &pool->lock );
+
+     D_DEBUG_AT( Fusion_Object, "  -> pool destroyed (%s)\n", pool->name );
+
+     D_MAGIC_CLEAR( pool );
+
+     /* Deallocate shared memory. */
+     SHFREE( shared->main_pool, pool->name );
+     SHFREE( shared->main_pool, pool );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_object_pool_enum( FusionObjectPool     *pool,
+                         FusionObjectCallback  callback,
+                         void                 *ctx )
+{
+     FusionObject *object;
+
+     D_MAGIC_ASSERT( pool, FusionObjectPool );
+     D_ASSERT( callback != NULL );
+
+     /* Lock the pool. */
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return DR_FUSION;
+
+     direct_list_foreach (object, pool->objects) {
+          D_MAGIC_ASSERT( object, FusionObject );
+
+          if (!callback( pool, object, ctx ))
+               break;
+     }
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return DR_OK;
+}
+
+FusionObject *
+fusion_object_create( FusionObjectPool  *pool,
+                      const FusionWorld *world )
+{
+     FusionObject      *object;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( pool, FusionObjectPool );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+     D_ASSERT( shared == pool->shared );
+
+     /* Lock the pool. */
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return NULL;
+
+     /* Allocate shared memory for the object. */
+     object = SHCALLOC( shared->main_pool, 1, pool->object_size );
+     if (!object) {
+          D_OOSHM();
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Set "initializing" state. */
+     object->state = FOS_INIT;
+
+     /* Set object id. */
+     object->id = ++pool->id_pool;
+
+     /* Initialize the reference counter. */
+     if (fusion_ref_init( &object->ref, pool->name, world )) {
+          SHFREE( shared->main_pool, object );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Increase the object's reference counter. */
+     fusion_ref_up( &object->ref, false );
+
+     /* Install handler for automatic destruction. */
+     if (fusion_ref_watch( &object->ref, &pool->call, object->id )) {
+          fusion_ref_destroy( &object->ref );
+          SHFREE( shared->main_pool, object );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Create a reactor for message dispatching. */
+     object->reactor = fusion_reactor_new( pool->message_size, pool->name, world );
+     if (!object->reactor) {
+          fusion_ref_destroy( &object->ref );
+          SHFREE( shared->main_pool, object );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     fusion_reactor_set_lock( object->reactor, &pool->lock );
+
+     /* Set pool/world back pointer. */
+     object->pool   = pool;
+     object->shared = shared;
+
+     /* Add the object to the pool. */
+     direct_list_prepend( &pool->objects, &object->link );
+
+     D_DEBUG_AT( Fusion_Object, "== %s ==\n", pool->name );
+
+#if FUSION_BUILD_MULTI
+     D_DEBUG_AT( Fusion_Object, "  -> added %p with ref [0x%x]\n", object, object->ref.multi.id );
+#else
+     D_DEBUG_AT( Fusion_Object, "  -> added %p\n", object );
+#endif
+
+     D_MAGIC_SET( object, FusionObject );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return object;
+}
+
+DirectResult
+fusion_object_get( FusionObjectPool  *pool,
+                   FusionObjectID     object_id,
+                   FusionObject     **ret_object )
+{
+     DirectResult  ret = DR_IDNOTFOUND;
+     FusionObject *object;
+
+     D_MAGIC_ASSERT( pool, FusionObjectPool );
+     D_ASSERT( ret_object != NULL );
+
+     /* Lock the pool. */
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return DR_FUSION;
+
+     direct_list_foreach (object, pool->objects) {
+          D_MAGIC_ASSERT( object, FusionObject );
+
+          if (object->id == object_id) {
+               ret = fusion_object_ref( object );
+               break;
+          }
+     }
+
+     if (ret == DR_OK)
+          *ret_object = object;
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_object_set_lock( FusionObject   *object,
+                        FusionSkirmish *lock )
+{
+     D_MAGIC_ASSERT( object, FusionObject );
+
+     D_ASSERT( lock != NULL );
+
+     D_ASSUME( object->state == FOS_INIT );
+
+     return fusion_reactor_set_lock_only( object->reactor, lock );
+}
+
+DirectResult
+fusion_object_activate( FusionObject *object )
+{
+     D_MAGIC_ASSERT( object, FusionObject );
+
+     /* Set "active" state. */
+     object->state = FOS_ACTIVE;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_object_destroy( FusionObject *object )
+{
+     FusionObjectPool  *pool;
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( object->state != FOS_ACTIVE );
+
+     shared = object->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     pool = object->pool;
+
+//     D_ASSUME( pool != NULL );
+
+     /* Set "deinitializing" state. */
+     object->state = FOS_DEINIT;
+
+     /* Remove the object from the pool. */
+     if (pool) {
+          D_MAGIC_ASSERT( pool, FusionObjectPool );
+
+          /* Lock the pool. */
+          if (fusion_skirmish_prevail( &pool->lock ))
+               return DR_FAILURE;
+
+          D_MAGIC_ASSERT( pool, FusionObjectPool );
+
+          D_ASSUME( object->pool != NULL );
+
+          /* Remove the object from the pool. */
+          if (object->pool) {
+               D_ASSERT( object->pool == pool );
+
+               object->pool = NULL;
+
+               direct_list_remove( &pool->objects, &object->link );
+          }
+
+          /* Unlock the pool. */
+          fusion_skirmish_dismiss( &pool->lock );
+     }
+
+     fusion_ref_destroy( &object->ref );
+
+     fusion_reactor_free( object->reactor );
+
+     if ( object->properties )
+          fusion_hash_destroy(object->properties);
+
+     D_MAGIC_CLEAR( object );
+     SHFREE( shared->main_pool, object );
+     return DR_OK;
+}
+
+/*
+ * Sets a value for a key.
+ * If the key currently has a value the old value is returned
+ * in old_value.
+ * If old_value is null the object is freed with SHFREE.
+ * If this is not the correct semantics for your data, if for example
+ * its reference counted  you must pass in a old_value.
+ */
+DirectResult
+fusion_object_set_property( FusionObject  *object,
+                            const char    *key,
+                            void          *value,
+                            void         **old_value )
+{
+     DirectResult  ret;
+     char         *sharedkey;
+
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( object->shared != NULL );
+     D_ASSERT( key != NULL );
+     D_ASSERT( value != NULL );
+
+     /* Create property hash on demand. */
+     if (!object->properties) {
+          ret = fusion_hash_create( object->shared->main_pool,
+                                    HASH_STRING, HASH_PTR,
+                                    FUSION_HASH_MIN_SIZE,
+                                    &object->properties );
+          if (ret)
+               return ret;
+     }
+
+     /* Create a shared copy of the key. */
+     sharedkey = SHSTRDUP( object->shared->main_pool, key );
+     if (!sharedkey)
+          return D_OOSHM();
+
+     /* Put it into the hash. */
+     ret = fusion_hash_replace( object->properties, sharedkey,
+                                value, NULL, old_value );
+     if (ret)
+          SHFREE( object->shared->main_pool, sharedkey );
+
+     return ret;
+}
+
+/*
+ * Helper function for int values
+ */
+DirectResult
+fusion_object_set_int_property( FusionObject *object,
+                                const char   *key,
+                                int           value )
+{
+     DirectResult  ret;
+     int          *iptr;
+
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( key != NULL );
+
+     iptr = SHMALLOC( object->shared->main_pool, sizeof(int) );
+     if (!iptr)
+          return D_OOSHM();
+
+     *iptr = value;
+
+     ret = fusion_object_set_property( object, key, iptr, NULL );
+     if (ret)
+          SHFREE( object->shared->main_pool, iptr );
+
+     return ret;
+}
+
+/*
+ * Helper function for char* values use if the string 
+ * is not in shared memory
+ * Assumes that the old value was a string and frees it.
+ */
+DirectResult
+fusion_object_set_string_property( FusionObject *object,
+                                   const char   *key,
+                                   char         *value )
+{
+     DirectResult  ret;
+     char         *copy;
+
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( key != NULL );
+     D_ASSERT( value != NULL );
+
+     copy = SHSTRDUP( object->shared->main_pool, value );
+     if (!copy)
+          return D_OOSHM();
+
+     ret = fusion_object_set_property( object, key, copy, NULL );
+     if (ret)
+          SHFREE( object->shared->main_pool, copy );
+
+     return ret;
+}
+
+void *
+fusion_object_get_property( FusionObject *object, const char *key )
+{
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( key != NULL );
+
+     if (!object->properties)
+          return NULL;
+
+     return fusion_hash_lookup( object->properties, key );
+}
+
+void 
+fusion_object_remove_property( FusionObject  *object,
+                               const char    *key,
+                               void         **old_value)
+{
+     D_MAGIC_ASSERT( object, FusionObject );
+     D_ASSERT( key != NULL );
+
+     if (!object->properties)
+          return;
+
+     fusion_hash_remove( object->properties, key, NULL, old_value );
+
+     if (fusion_hash_should_resize( object->properties ))
+          fusion_hash_resize( object->properties );
+}
+
diff --git a/Source/DirectFB/lib/fusion/object.h b/Source/DirectFB/lib/fusion/object.h
new file mode 100755
index 0000000..ae75374
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/object.h
@@ -0,0 +1,279 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__OBJECT_H__
+#define __FUSION__OBJECT_H__
+
+#include <fusion/types.h>
+
+#include <fusion/lock.h>
+#include <direct/list.h>
+#include <fusion/ref.h>
+#include <fusion/reactor.h>
+#include <direct/debug.h>
+
+typedef void (*FusionObjectDestructor)( FusionObject *object, bool zombie, void *ctx );
+
+typedef bool (*FusionPropIterator)( char *key, void *value, void *ctx);
+
+
+
+
+typedef unsigned long FusionObjectID;
+
+
+typedef enum {
+     FOS_INIT,
+     FOS_ACTIVE,
+     FOS_DEINIT
+} FusionObjectState;
+
+struct __Fusion_FusionObject {
+     DirectLink         link;
+     FusionObjectPool  *pool;
+
+     int                magic;
+
+     FusionObjectID     id;
+
+     FusionObjectState  state;
+
+     FusionRef          ref;
+     FusionReactor     *reactor;
+
+     FusionWorldShared *shared;
+     FusionHash        *properties;
+};
+
+
+typedef bool (*FusionObjectCallback)( FusionObjectPool *pool,
+                                      FusionObject     *object,
+                                      void             *ctx );
+
+
+FusionObjectPool *fusion_object_pool_create ( const char             *name,
+                                              int                     object_size,
+                                              int                     message_size,
+                                              FusionObjectDestructor  destructor,
+                                              void                   *ctx,
+                                              const FusionWorld      *world );
+
+DirectResult      fusion_object_pool_destroy( FusionObjectPool       *pool,
+                                              const FusionWorld      *world );
+
+
+DirectResult      fusion_object_pool_enum   ( FusionObjectPool       *pool,
+                                              FusionObjectCallback    callback,
+                                              void                   *ctx );
+
+
+FusionObject     *fusion_object_create  ( FusionObjectPool  *pool,
+                                          const FusionWorld *world );
+
+DirectResult      fusion_object_get     ( FusionObjectPool  *pool,
+                                          FusionObjectID     object_id,
+                                          FusionObject     **ret_object );
+
+DirectResult      fusion_object_set_lock( FusionObject      *object,
+                                          FusionSkirmish    *lock );
+
+DirectResult      fusion_object_activate( FusionObject      *object );
+
+DirectResult      fusion_object_destroy ( FusionObject      *object );
+
+DirectResult      fusion_object_set_property( FusionObject      *object ,
+                        const char *key, void *value, void **old_value);
+
+DirectResult       fusion_object_set_int_property( FusionObject  *object ,
+                        const char *key,int value);
+
+DirectResult       fusion_object_set_string_property( FusionObject  *object ,
+                        const char *key,char *value);
+
+void *fusion_object_get_property( FusionObject *object ,const char *key);
+void fusion_object_remove_property( FusionObject *object ,const char *key,void **ret_val);
+
+#define FUSION_OBJECT_METHODS(type, prefix)                                    \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_attach( type         *object,                                         \
+                 ReactionFunc  func,                                           \
+                 void         *ctx,                                            \
+                 Reaction     *ret_reaction )                                  \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_attach( ((FusionObject*)object)->reactor,           \
+                                   func, ctx, ret_reaction );                  \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_attach_channel( type         *object,                                 \
+                         int           channel,                                \
+                         ReactionFunc  func,                                   \
+                         void         *ctx,                                    \
+                         Reaction     *ret_reaction )                          \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_attach_channel( ((FusionObject*)object)->reactor,   \
+                                           channel, func, ctx, ret_reaction ); \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_detach( type     *object,                                             \
+                 Reaction *reaction )                                          \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_detach( ((FusionObject*)object)->reactor,           \
+                                   reaction );                                 \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_attach_global( type           *object,                                \
+                        int             index,                                 \
+                        void           *ctx,                                   \
+                        GlobalReaction *reaction )                             \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_attach_global( ((FusionObject*)object)->reactor,    \
+                                          index, ctx, reaction );              \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_detach_global( type           *object,                                \
+                        GlobalReaction *reaction )                             \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_detach_global( ((FusionObject*)object)->reactor,    \
+                                          reaction );                          \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_dispatch( type               *object,                                 \
+                   void               *message,                                \
+                   const ReactionFunc *globals )                               \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_dispatch( ((FusionObject*)object)->reactor,         \
+                                     message, true, globals );                 \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_dispatch_channel( type               *object,                         \
+                           int                 channel,                        \
+                           void               *message,                        \
+                           int                 size,                           \
+                           const ReactionFunc *globals )                       \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_reactor_dispatch_channel( ((FusionObject*)object)->reactor, \
+                                      channel, message, size, true, globals ); \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_ref( type *object )                                                   \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_ref_up( &((FusionObject*)object)->ref, false );             \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_unref( type *object )                                                 \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_ref_down( &((FusionObject*)object)->ref, false );           \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_ref_stat( type *object, int *refs )                                   \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     return fusion_ref_stat ( &((FusionObject*)object)->ref, refs );           \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_link( type **link,                                                    \
+               type  *object )                                                 \
+{                                                                              \
+     DirectResult ret;                                                         \
+                                                                               \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+                                                                               \
+     ret = fusion_ref_up( &((FusionObject*)object)->ref, true );               \
+     if (ret)                                                                  \
+          return ret;                                                          \
+                                                                               \
+     *link = object;                                                           \
+                                                                               \
+     return DR_OK;                                                            \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_unlink( type **link )                                                 \
+{                                                                              \
+     type *object = *link;                                                     \
+                                                                               \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+                                                                               \
+     *link = NULL;                                                             \
+                                                                               \
+     return fusion_ref_down( &((FusionObject*)object)->ref, true );            \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_inherit( type *object,                                                \
+                  void *from )                                                 \
+{                                                                              \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+     D_MAGIC_ASSERT( (FusionObject*) from, FusionObject );                     \
+                                                                               \
+     return fusion_ref_inherit( &((FusionObject*)object)->ref,                 \
+                                &((FusionObject*)from)->ref );                 \
+}                                                                              \
+                                                                               \
+static inline DirectResult                                                     \
+prefix##_globalize( type *object )                                             \
+{                                                                              \
+     DirectResult ret;                                                         \
+                                                                               \
+     D_MAGIC_ASSERT( (FusionObject*) object, FusionObject );                   \
+                                                                               \
+     ret = fusion_ref_up( &((FusionObject*)object)->ref, true );               \
+     if (ret)                                                                  \
+          return ret;                                                          \
+                                                                               \
+     ret = fusion_ref_down( &((FusionObject*)object)->ref, false );            \
+     if (ret)                                                                  \
+          fusion_ref_down( &((FusionObject*)object)->ref, true );              \
+                                                                               \
+     return ret;                                                               \
+}
+
+FUSION_OBJECT_METHODS( void, fusion_object )
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/property.c b/Source/DirectFB/lib/fusion/property.c
new file mode 100755
index 0000000..640f572
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/property.c
@@ -0,0 +1,530 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <fusion/build.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/types.h>
+#include <fusion/property.h>
+
+#include "fusion_internal.h"
+
+
+#if FUSION_BUILD_MULTI
+
+#if FUSION_BUILD_KERNEL
+
+DirectResult
+fusion_property_init (FusionProperty *property, const FusionWorld *world)
+{
+     D_ASSERT( property != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     while (ioctl (world->fusion_fd, FUSION_PROPERTY_NEW, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_NEW");
+
+          return DR_FAILURE;
+     }
+
+     /* Keep back pointer to shared world data. */
+     property->multi.shared = world->shared;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_lease (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     while (ioctl (_fusion_fd( property->multi.shared ), FUSION_PROPERTY_LEASE, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EAGAIN:
+                    return DR_BUSY;
+               case EINVAL:
+                    D_ERROR ("Fusion/Property: invalid property\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_LEASE");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_purchase (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     while (ioctl (_fusion_fd( property->multi.shared ), FUSION_PROPERTY_PURCHASE, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EAGAIN:
+                    return DR_BUSY;
+               case EINVAL:
+                    D_ERROR ("Fusion/Property: invalid property\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_PURCHASE");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_cede (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     while (ioctl (_fusion_fd( property->multi.shared ), FUSION_PROPERTY_CEDE, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Property: invalid property\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_CEDE");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_holdup (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     while (ioctl (_fusion_fd( property->multi.shared ), FUSION_PROPERTY_HOLDUP, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Property: invalid property\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_HOLDUP");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_destroy (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     while (ioctl (_fusion_fd( property->multi.shared ), FUSION_PROPERTY_DESTROY, &property->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Property: invalid property\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_PROPERTY_DESTROY");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+#include <direct/system.h>
+
+DirectResult
+fusion_property_init (FusionProperty *property, const FusionWorld *world)
+{
+     D_ASSERT( property != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     /* Set state to available. */
+     property->multi.builtin.state = FUSION_PROPERTY_AVAILABLE;
+     property->multi.builtin.owner = 0;
+
+     property->multi.builtin.requested = false;
+     property->multi.builtin.destroyed = false;
+
+     /* Keep back pointer to shared world data. */
+     property->multi.shared = world->shared;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_lease (FusionProperty *property)
+{
+     int count = 0;
+     
+     D_ASSERT( property != NULL );
+
+     if (property->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     D_ASSUME( property->multi.builtin.owner != direct_gettid() );
+     
+     asm( "" ::: "memory" );
+     
+     while (property->multi.builtin.state == FUSION_PROPERTY_LEASED) {
+          /* Check whether owner exited without releasing. */
+          if (kill( property->multi.builtin.owner, 0 ) < 0 && errno == ESRCH) {
+               property->multi.builtin.state = FUSION_PROPERTY_AVAILABLE;
+               property->multi.builtin.requested = false;
+               break;
+          }
+          
+          property->multi.builtin.requested = true;
+          
+          asm( "" ::: "memory" );
+          
+          if (++count > 1000) {
+               usleep( 10000 );
+               count = 0;
+          }
+          else {          
+               direct_sched_yield();
+          }
+               
+          if (property->multi.builtin.destroyed)
+               return DR_DESTROYED;
+     }
+
+     if (property->multi.builtin.state == FUSION_PROPERTY_PURCHASED) {
+          /* Check whether owner exited without releasing. */
+          if (!(kill( property->multi.builtin.owner, 0 ) < 0 && errno == ESRCH))
+               return DR_BUSY;
+     }
+     
+     property->multi.builtin.state = FUSION_PROPERTY_LEASED;
+     property->multi.builtin.owner = direct_gettid();
+     
+     asm( "" ::: "memory" );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_purchase (FusionProperty *property)
+{
+     int count = 0;
+     
+     D_ASSERT( property != NULL );
+
+     if (property->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     D_ASSUME( property->multi.builtin.owner != direct_gettid() );
+     
+     asm( "" ::: "memory" );
+          
+     while (property->multi.builtin.state == FUSION_PROPERTY_LEASED) {
+          /* Check whether owner exited without releasing. */
+          if (kill( property->multi.builtin.owner, 0 ) < 0 && errno == ESRCH) {
+               property->multi.builtin.state = FUSION_PROPERTY_AVAILABLE;
+               property->multi.builtin.requested = false;
+               break;
+          }
+          
+          property->multi.builtin.requested = true;
+          
+          asm( "" ::: "memory" );
+          
+          if (++count > 1000) {
+               usleep( 10000 );
+               count = 0;
+          }
+          else {          
+               direct_sched_yield();
+          }
+               
+          if (property->multi.builtin.destroyed)
+               return DR_DESTROYED;
+     }
+     
+     if (property->multi.builtin.state == FUSION_PROPERTY_PURCHASED) {
+          /* Check whether owner exited without releasing. */
+          if (!(kill( property->multi.builtin.owner, 0 ) < 0 && errno == ESRCH))
+               return DR_BUSY;
+     }
+     
+     property->multi.builtin.state = FUSION_PROPERTY_PURCHASED;
+     property->multi.builtin.owner = direct_gettid();
+     
+     asm( "" ::: "memory" );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_cede (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+     
+     if (property->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     D_ASSUME( property->multi.builtin.state != FUSION_PROPERTY_AVAILABLE );
+     D_ASSUME( property->multi.builtin.owner == direct_gettid() );
+
+     property->multi.builtin.state = FUSION_PROPERTY_AVAILABLE;
+     property->multi.builtin.owner = 0;
+     
+     asm( "" ::: "memory" );
+
+     if (property->multi.builtin.requested) {
+          property->multi.builtin.requested = false;
+          asm( "" ::: "memory" );
+          direct_sched_yield();
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_holdup (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     if (property->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     if (property->multi.builtin.state == FUSION_PROPERTY_PURCHASED &&
+         property->multi.builtin.owner != direct_gettid()) {
+          pid_t pid = property->multi.builtin.owner;
+          
+          if (kill( pid, SIGKILL ) < 0 && errno != ESRCH)
+               return DR_UNSUPPORTED;
+
+          /* Wait process termination. */
+          while (kill( pid, 0 ) == 0) {
+               if (property->multi.builtin.destroyed)
+                    return DR_DESTROYED;
+               
+               direct_sched_yield();
+          }
+          
+          property->multi.builtin.state = FUSION_PROPERTY_AVAILABLE;
+          property->multi.builtin.owner = 0;
+          property->multi.builtin.requested = false;
+     } 
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_property_destroy (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     if (property->multi.builtin.destroyed)
+          return DR_DESTROYED;
+     
+     property->multi.builtin.destroyed = true;
+
+     return DR_OK;
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+#else /* FUSION_BUILD_MULTI */
+
+#include <pthread.h>
+
+/*
+ * Initializes the property
+ */
+DirectResult
+fusion_property_init (FusionProperty *property, const FusionWorld *world)
+{
+     D_ASSERT( property != NULL );
+
+     direct_util_recursive_pthread_mutex_init (&property->single.lock);
+     pthread_cond_init (&property->single.cond, NULL);
+
+     property->single.state = FUSION_PROPERTY_AVAILABLE;
+
+     return DR_OK;
+}
+
+/*
+ * Lease the property causing others to wait before leasing or purchasing.
+ */
+DirectResult
+fusion_property_lease (FusionProperty *property)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( property != NULL );
+
+     pthread_mutex_lock (&property->single.lock);
+
+     /* Wait as long as the property is leased by another party. */
+     while (property->single.state == FUSION_PROPERTY_LEASED)
+          pthread_cond_wait (&property->single.cond, &property->single.lock);
+
+     /* Fail if purchased by another party, otherwise succeed. */
+     if (property->single.state == FUSION_PROPERTY_PURCHASED)
+          ret = DR_BUSY;
+     else
+          property->single.state = FUSION_PROPERTY_LEASED;
+
+     pthread_mutex_unlock (&property->single.lock);
+
+     return ret;
+}
+
+/*
+ * Purchase the property disallowing others to lease or purchase it.
+ */
+DirectResult
+fusion_property_purchase (FusionProperty *property)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( property != NULL );
+
+     pthread_mutex_lock (&property->single.lock);
+
+     /* Wait as long as the property is leased by another party. */
+     while (property->single.state == FUSION_PROPERTY_LEASED)
+          pthread_cond_wait (&property->single.cond, &property->single.lock);
+
+     /* Fail if purchased by another party, otherwise succeed. */
+     if (property->single.state == FUSION_PROPERTY_PURCHASED)
+          ret = DR_BUSY;
+     else {
+          property->single.state = FUSION_PROPERTY_PURCHASED;
+
+          /* Wake up any other waiting party. */
+          pthread_cond_broadcast (&property->single.cond);
+     }
+
+     pthread_mutex_unlock (&property->single.lock);
+
+     return ret;
+}
+
+/*
+ * Cede the property allowing others to lease or purchase it.
+ */
+DirectResult
+fusion_property_cede (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     pthread_mutex_lock (&property->single.lock);
+
+     /* Simple error checking, maybe we should also check the owner. */
+     D_ASSERT( property->single.state != FUSION_PROPERTY_AVAILABLE );
+
+     /* Put back into 'available' state. */
+     property->single.state = FUSION_PROPERTY_AVAILABLE;
+
+     /* Wake up one waiting party if there are any. */
+     pthread_cond_signal (&property->single.cond);
+
+     pthread_mutex_unlock (&property->single.lock);
+
+     return DR_OK;
+}
+
+/*
+ * Does nothing to avoid killing ourself.
+ */
+DirectResult
+fusion_property_holdup (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     return DR_OK;
+}
+
+/*
+ * Destroys the property
+ */
+DirectResult
+fusion_property_destroy (FusionProperty *property)
+{
+     D_ASSERT( property != NULL );
+
+     pthread_cond_destroy (&property->single.cond);
+     pthread_mutex_destroy (&property->single.lock);
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/property.h b/Source/DirectFB/lib/fusion/property.h
new file mode 100755
index 0000000..74e3d1f
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/property.h
@@ -0,0 +1,114 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__PROPERTY_H__
+#define __FUSION__PROPERTY_H__
+
+#include <pthread.h>
+
+#include <fusion/types.h>
+
+typedef enum {
+     FUSION_PROPERTY_AVAILABLE,
+     FUSION_PROPERTY_LEASED,
+     FUSION_PROPERTY_PURCHASED
+} FusionPropertyState;
+
+
+typedef union {
+     /* multi app */
+     struct {
+          int                      id;
+          const FusionWorldShared *shared;
+          /* builtin impl */
+          struct {
+               FusionPropertyState state;
+               pid_t               owner;
+               bool                requested;
+               bool                destroyed;
+          } builtin;
+     } multi;
+     
+     /* single app */
+     struct {
+          pthread_mutex_t          lock;
+          pthread_cond_t           cond;
+          FusionPropertyState      state;
+     } single;
+} FusionProperty;
+
+/*
+ * Initializes the property
+ */
+DirectResult fusion_property_init     (FusionProperty    *property,
+                                       const FusionWorld *world);
+
+/*
+ * Lease the property causing others to wait before leasing or purchasing.
+ *
+ * Waits as long as property is leased by another party.
+ * Returns DR_BUSY if property is/gets purchased by another party.
+ *
+ * Succeeds if property is available,
+ * puts the property into 'leased' state.
+ */
+DirectResult fusion_property_lease    (FusionProperty *property);
+
+/*
+ * Purchase the property disallowing others to lease or purchase it.
+ *
+ * Waits as long as property is leased by another party.
+ * Returns DR_BUSY if property is/gets purchased by another party.
+ *
+ * Succeeds if property is available,
+ * puts the property into 'purchased' state and wakes up any waiting party.
+ */
+DirectResult fusion_property_purchase (FusionProperty *property);
+
+/*
+ * Cede the property allowing others to lease or purchase it.
+ *
+ * Puts the property into 'available' state and wakes up one waiting party.
+ */
+DirectResult fusion_property_cede     (FusionProperty *property);
+
+/*
+ * Kills the owner of the property.
+ *
+ * Tries to make a purchased property available again by killing
+ * the process that purchased it.
+ */
+DirectResult fusion_property_holdup   (FusionProperty *property);
+
+/*
+ * Destroys the property
+ */
+DirectResult fusion_property_destroy  (FusionProperty *property);
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/protocol.h b/Source/DirectFB/lib/fusion/protocol.h
new file mode 100755
index 0000000..8670b1d
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/protocol.h
@@ -0,0 +1,119 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION_PROTOCOL_H__
+#define __FUSION_PROTOCOL_H__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <direct/types.h>
+
+
+typedef enum {
+     FMT_SEND,
+     FMT_ENTER,
+     FMT_LEAVE,
+     FMT_CALL,
+     FMT_CALLRET,
+     FMT_REACTOR
+} FusionMessageType;
+
+/*
+ * Enter world (slave).
+ */
+typedef struct {
+     FusionMessageType    type;
+     
+     FusionID             fusion_id;
+} FusionEnter;
+
+/*
+ * Leave the world (slave).
+ */
+typedef struct {
+     FusionMessageType    type;
+     
+     FusionID             fusion_id;
+} FusionLeave;
+
+/*
+ * Execute a call.
+ */
+typedef struct {
+     FusionMessageType    type;
+
+     unsigned int         serial;
+
+     FusionID             caller;
+     int                  call_id;
+     int                  call_arg;
+     void                *call_ptr;
+
+     void                *handler;
+     void                *ctx;
+     
+     FusionCallExecFlags  flags;
+} FusionCallMessage, FusionCallExecute;
+
+/*
+ * Send call return.
+ */
+typedef struct {
+     FusionMessageType    type;
+     
+     int                  val;
+} FusionCallReturn;
+
+/*
+ * Send reactor message.
+ */
+typedef struct {
+     FusionMessageType    type;
+     
+     int                  id;
+     int                  channel;
+     
+     FusionRef           *ref;
+} FusionReactorMessage;
+
+
+typedef union {
+     FusionMessageType    type;
+     
+     FusionEnter          enter;
+     FusionLeave          leave;
+     FusionCallMessage    call;
+     FusionCallReturn     callret;
+     FusionReactorMessage reactor;
+} FusionMessage;
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/reactor.c b/Source/DirectFB/lib/fusion/reactor.c
new file mode 100755
index 0000000..7e1feae
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/reactor.c
@@ -0,0 +1,1868 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+
+#include <sys/param.h>
+
+#include <pthread.h>
+
+#include <fusion/build.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+#include <fusion/types.h>
+#include <fusion/lock.h>
+#include <fusion/shmalloc.h>
+#include <fusion/reactor.h>
+
+#include "fusion_internal.h"
+
+
+#if FUSION_BUILD_MULTI
+
+D_DEBUG_DOMAIN( Fusion_Reactor, "Fusion/Reactor", "Fusion's Reactor" );
+
+struct __Fusion_FusionReactor {
+     int                magic;
+
+     int                id;        /* reactor id                          */
+     int                msg_size;  /* size of each message                */
+     bool               direct;
+     bool               destroyed;
+
+     DirectLink        *globals;
+     FusionSkirmish    *globals_lock;
+
+     FusionWorldShared *shared;
+     
+#if !FUSION_BUILD_KERNEL
+     DirectLink        *listeners;  /* list of attached listeners */
+     FusionSkirmish     listeners_lock;
+
+     FusionCall        *call;
+#endif
+};
+
+typedef struct {
+     DirectLink         link;
+
+     int                magic;
+
+     pthread_rwlock_t   lock;
+
+     int                reactor_id;
+     FusionReactor     *reactor;
+
+     DirectLink        *links; /* reactor listeners attached to node  */
+} ReactorNode;
+
+typedef struct {
+     DirectLink         link;
+
+     int                magic;
+
+     Reaction          *reaction;
+     int                channel;
+} NodeLink;
+
+/**************************************************************************************************/
+
+static ReactorNode *lock_node      ( int                 reactor_id,
+                                     bool                add_it,
+                                     bool                wlock,
+                                     FusionReactor      *reactor, /* one of reactor and world must not be NULL */
+                                     FusionWorld        *world );
+
+static void         unlock_node    ( ReactorNode        *node );
+
+static void         process_globals( FusionReactor      *reactor,
+                                     const void         *msg_data,
+                                     const ReactionFunc *globals );
+
+/**************************************************************************************************/
+
+#if FUSION_BUILD_KERNEL
+
+FusionReactor *
+fusion_reactor_new( int                msg_size,
+                    const char        *name,
+                    const FusionWorld *world )
+{
+     FusionEntryInfo    info;
+     FusionReactor     *reactor;
+     FusionWorldShared *shared;
+
+//     D_ASSERT( msg_size > 0 );
+     D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_new( '%s', size %d )\n", name ? : "", msg_size );
+
+     /* allocate shared reactor data */
+     reactor = SHCALLOC( shared->main_pool, 1, sizeof (FusionReactor) );
+     if (!reactor) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     /* create a new reactor */
+     while (ioctl( world->fusion_fd, FUSION_REACTOR_NEW, &reactor->id )) {
+          if (errno == EINTR)
+              continue;
+
+          D_PERROR( "FUSION_REACTOR_NEW" );
+          SHFREE( shared->main_pool, reactor );
+          return NULL;
+     }
+
+     /* set the static message size, should we make dynamic? (TODO?) */
+     reactor->msg_size = msg_size;
+     
+     /* Set default lock for global reactions. */
+     reactor->globals_lock = &shared->reactor_globals;
+
+     D_DEBUG_AT( Fusion_Reactor, "  -> new reactor %p [%d] with lock %p [%d]\n",
+                 reactor, reactor->id, reactor->globals_lock, reactor->globals_lock->multi.id );
+
+     reactor->shared = shared;
+     reactor->direct = true;
+
+     D_MAGIC_SET( reactor, FusionReactor );
+
+
+     info.type = FT_REACTOR;
+     info.id   = reactor->id;
+
+     direct_snputs( info.name, name, sizeof(info.name) );
+
+     ioctl( world->fusion_fd, FUSION_ENTRY_SET_INFO, &info );
+
+     return reactor;
+}
+
+DirectResult
+fusion_reactor_destroy( FusionReactor *reactor )
+{
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     shared = reactor->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_destroy( %p [%d] )\n", reactor, reactor->id );
+
+     D_ASSUME( !reactor->destroyed );
+
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+
+     while (ioctl( _fusion_fd( shared ), FUSION_REACTOR_DESTROY, &reactor->id )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR( "FUSION_REACTOR_DESTROY" );
+          return DR_FUSION;
+     }
+
+     reactor->destroyed = true;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_free( FusionReactor *reactor )
+{
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     shared = reactor->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_free( %p [%d] )\n", reactor, reactor->id );
+
+     D_MAGIC_CLEAR( reactor );
+
+//     D_ASSUME( reactor->destroyed );
+
+     if (!reactor->destroyed)
+          while (ioctl( _fusion_fd( shared ), FUSION_REACTOR_DESTROY, &reactor->id ) && errno == EINTR);
+
+     /* free shared reactor data */
+     SHFREE( shared->main_pool, reactor );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_attach_channel( FusionReactor *reactor,
+                               int            channel,
+                               ReactionFunc   func,
+                               void          *ctx,
+                               Reaction      *reaction )
+{
+     ReactorNode         *node;
+     NodeLink            *link;
+     FusionReactorAttach  attach;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( func != NULL );
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_attach( %p [%d], func %p, ctx %p, reaction %p )\n",
+                 reactor, reactor->id, func, ctx, reaction );
+
+     link = D_CALLOC( 1, sizeof(NodeLink) );
+     if (!link)
+          return D_OOM();
+
+     node = lock_node( reactor->id, true, true, reactor, NULL );
+     if (!node) {
+          D_FREE( link );
+          return DR_FUSION;
+     }
+
+     attach.reactor_id = reactor->id;
+     attach.channel    = channel;
+
+     while (ioctl( _fusion_fd( reactor->shared ), FUSION_REACTOR_ATTACH, &attach )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                    unlock_node( node );
+                    D_FREE( link );
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR( "FUSION_REACTOR_ATTACH" );
+          unlock_node( node );
+          D_FREE( link );
+          return DR_FUSION;
+     }
+
+     /* fill out callback information */
+     reaction->func      = func;
+     reaction->ctx       = ctx;
+     reaction->node_link = link;
+
+     link->reaction = reaction;
+     link->channel  = channel;
+
+     D_MAGIC_SET( link, NodeLink );
+
+     /* prepend the reaction to the local reaction list */
+     direct_list_prepend( &node->links, &link->link );
+
+     unlock_node( node );
+
+     return DR_OK;
+}
+
+static void
+remove_node_link( ReactorNode *node,
+                  NodeLink    *link )
+{
+     D_MAGIC_ASSERT( node, ReactorNode );
+     D_MAGIC_ASSERT( link, NodeLink );
+
+     D_ASSUME( link->reaction == NULL );
+
+     direct_list_remove( &node->links, &link->link );
+
+     D_MAGIC_CLEAR( link );
+
+     D_FREE( link );
+}
+
+DirectResult
+fusion_reactor_detach( FusionReactor *reactor,
+                       Reaction      *reaction )
+{
+     ReactorNode *node;
+     NodeLink    *link;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_detach( %p [%d], reaction %p ) <- func %p, ctx %p\n",
+                 reactor, reactor->id, reaction, reaction->func, reaction->ctx );
+
+     node = lock_node( reactor->id, false, true, reactor, NULL );
+     if (!node) {
+          D_BUG( "node not found" );
+          return DR_BUG;
+     }
+
+     link = reaction->node_link;
+     D_ASSUME( link != NULL );
+
+     if (link) {
+          FusionReactorDetach detach;
+
+          D_ASSERT( link->reaction == reaction );
+
+          detach.reactor_id = reactor->id;
+          detach.channel    = link->channel;
+
+          reaction->node_link = NULL;
+
+          link->reaction = NULL;
+
+          remove_node_link( node, link );
+
+          while (ioctl( _fusion_fd( reactor->shared ), FUSION_REACTOR_DETACH, &detach )) {
+               switch (errno) {
+                    case EINTR:
+                         continue;
+
+                    case EINVAL:
+                         D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                         unlock_node( node );
+                         return DR_DESTROYED;
+               }
+
+               D_PERROR( "FUSION_REACTOR_DETACH" );
+               unlock_node( node );
+               return DR_FUSION;
+          }
+     }
+
+     unlock_node( node );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_dispatch_channel( FusionReactor      *reactor,
+                                 int                 channel,
+                                 const void         *msg_data,
+                                 int                 msg_size,
+                                 bool                self,
+                                 const ReactionFunc *globals )
+{
+     FusionReactorDispatch dispatch;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     D_ASSERT( msg_data != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_dispatch( %p [%d], msg_data %p, self %s, globals %p)\n",
+                 reactor, reactor->id, msg_data, self ? "true" : "false", globals );
+
+     /* Handle global reactions first. */
+     if (reactor->globals) {
+          if (globals)
+               process_globals( reactor, msg_data, globals );
+          else
+               D_ERROR( "Fusion/Reactor: global reactions exist but no "
+                        "globals have been passed to dispatch()\n" );
+     }
+     
+     /* Handle local reactions. */
+     if (self && reactor->direct) {
+          _fusion_reactor_process_message( _fusion_world(reactor->shared), reactor->id, channel, msg_data );
+          self = false;
+     }
+
+     /* Initialize dispatch data. */
+     dispatch.reactor_id = reactor->id;
+     dispatch.channel    = channel;
+     dispatch.self       = self;
+     dispatch.msg_size   = msg_size;
+     dispatch.msg_data   = msg_data;
+
+     /* Dispatch the message to handle foreign reactions. */
+     while (ioctl( _fusion_fd( reactor->shared ), FUSION_REACTOR_DISPATCH, &dispatch )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR( "FUSION_REACTOR_DISPATCH" );
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_set_dispatch_callback( FusionReactor  *reactor,
+                                      FusionCall     *call,
+                                      void           *call_ptr )
+{
+     FusionReactorSetCallback callback;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( call != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_set_dispatch_callback( %p [%d], call %p [%d], ptr %p)\n",
+                 reactor, reactor->id, call, call->call_id, call_ptr );
+
+     /* Fill callback info. */
+     callback.reactor_id = reactor->id;
+     callback.call_id    = call->call_id;
+     callback.call_ptr   = call_ptr;
+
+     /* Set the dispatch callback. */
+     while (ioctl( _fusion_fd( reactor->shared ), FUSION_REACTOR_SET_DISPATCH_CALLBACK, &callback )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                    return DR_DESTROYED;
+          }
+
+          D_PERROR( "FUSION_REACTOR_SET_DISPATCH_CALLBACK" );
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_set_name( FusionReactor *reactor,
+                         const char    *name )
+{
+     FusionEntryInfo info;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( name != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor, "%s( %p, '%s' )\n", __FUNCTION__, reactor, name );
+
+     /* Initialize reactor info. */
+     info.type = FT_REACTOR;
+     info.id   = reactor->id;
+
+     /* Put reactor name into info. */
+     direct_snputs( info.name, name, sizeof(info.name) );
+
+     /* Set the reactor info. */
+     while (ioctl( _fusion_fd( reactor->shared ), FUSION_ENTRY_SET_INFO, &info )) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+
+               case EINVAL:
+                    D_ERROR( "Fusion/Reactor: invalid reactor\n" );
+                    return DR_IDNOTFOUND;
+          }
+
+          D_PERROR( "FUSION_ENTRY_SET_INFO( reactor 0x%08x, '%s' )\n", reactor->id, name );
+          return DR_FUSION;
+     }
+
+     return DR_OK;
+}
+
+void
+_fusion_reactor_process_message( FusionWorld *world,
+                                 int          reactor_id,
+                                 int          channel,
+                                 const void  *msg_data )
+{
+     ReactorNode *node;
+     NodeLink    *link;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( msg_data != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "  _fusion_reactor_process_message( [%d], msg_data %p )\n", reactor_id, msg_data );
+
+     /* Find the local counter part of the reactor. */
+     node = lock_node( reactor_id, false, false, NULL, world );
+     if (!node)
+          return;
+
+     D_DEBUG_AT( Fusion_Reactor, "    -> node %p, reactor %p\n", node, node->reactor );
+
+     D_ASSUME( node->links != NULL );
+
+     if (!node->links) {
+          D_DEBUG_AT( Fusion_Reactor, "    -> no local reactions!?!\n" );
+          unlock_node( node );
+          return;
+     }
+
+     direct_list_foreach (link, node->links) {
+          Reaction *reaction;
+
+          D_MAGIC_ASSERT( link, NodeLink );
+
+          if (link->channel != channel)
+               continue;
+
+          reaction = link->reaction;
+          if (!reaction)
+               continue;
+
+          if (reaction->func( msg_data, reaction->ctx ) == RS_REMOVE) {
+               FusionReactorDetach detach;
+
+               detach.reactor_id = reactor_id;
+               detach.channel    = channel;
+
+               D_DEBUG_AT( Fusion_Reactor, "    -> removing %p, func %p, ctx %p\n",
+                           reaction, reaction->func, reaction->ctx );
+
+               link->reaction = NULL;
+
+               /* We can't remove the link as we only have read lock, to avoid dead locks. */
+
+               while (ioctl( world->fusion_fd, FUSION_REACTOR_DETACH, &detach )) {
+                    switch (errno) {
+                         case EINTR:
+                              continue;
+
+                         case EINVAL:
+                              D_ERROR( "Fusion/Reactor: invalid reactor (DETACH)\n" );
+                              break;
+
+                         default:
+                              D_PERROR( "FUSION_REACTOR_DETACH" );
+                              break;
+                    }
+
+                    break;
+               }
+          }
+     }
+
+     unlock_node( node );
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+typedef struct {
+     DirectLink    link;
+     
+     unsigned int  refs;
+     
+     FusionID      fusion_id;
+     int           channel;
+} __Listener;
+
+
+FusionReactor *
+fusion_reactor_new( int                msg_size,
+                    const char        *name,
+                    const FusionWorld *world )
+{
+     FusionReactor     *reactor;
+     FusionWorldShared *shared;
+
+     D_ASSERT( msg_size > 0 );
+     D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shared = world->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_new( '%s', size %d )\n", name ? : "", msg_size );
+
+     /* allocate shared reactor data */
+     reactor = SHCALLOC( shared->main_pool, 1, sizeof (FusionReactor) );
+     if (!reactor) {
+          D_OOSHM();
+          return NULL;
+     }
+     
+     /* Generate the reactor id */
+     reactor->id = ++shared->reactor_ids; 
+
+     /* Set the static message size, should we make dynamic? (TODO?) */
+     reactor->msg_size = msg_size;
+     
+     /* Set default lock for global reactions. */
+     reactor->globals_lock = &shared->reactor_globals;
+     
+     fusion_skirmish_init( &reactor->listeners_lock, "Reactor Listeners", world );
+
+     D_DEBUG_AT( Fusion_Reactor, "  -> new reactor %p [%d] with lock %p [%d]\n",
+                 reactor, reactor->id, reactor->globals_lock, reactor->globals_lock->multi.id );
+
+     reactor->shared = shared;
+     reactor->direct = true;
+
+     D_MAGIC_SET( reactor, FusionReactor );
+
+     return reactor;
+}
+
+DirectResult
+fusion_reactor_destroy( FusionReactor *reactor )
+{
+     FusionWorldShared *shared;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     shared = reactor->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_destroy( %p [%d] )\n", reactor, reactor->id );
+
+     D_ASSUME( !reactor->destroyed );
+
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+          
+     fusion_skirmish_destroy( &reactor->listeners_lock );
+          
+     reactor->destroyed = true;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_free( FusionReactor *reactor )
+{
+     FusionWorldShared *shared;
+     __Listener        *listener, *temp;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     shared = reactor->shared;
+
+     D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_free( %p [%d] )\n", reactor, reactor->id );
+
+     D_MAGIC_CLEAR( reactor );
+
+//     D_ASSUME( reactor->destroyed );
+
+     direct_list_foreach_safe (listener, temp, reactor->listeners) {
+          direct_list_remove( &reactor->listeners, &listener->link );
+          SHFREE( shared->main_pool, listener );
+     }
+
+     /* free shared reactor data */
+     SHFREE( shared->main_pool, reactor );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_attach_channel( FusionReactor *reactor,
+                               int            channel,
+                               ReactionFunc   func,
+                               void          *ctx,
+                               Reaction      *reaction )
+{
+     FusionWorldShared *shared;
+     ReactorNode       *node;
+     NodeLink          *link;
+     FusionID           fusion_id;
+     __Listener        *listener;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( func != NULL );
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_attach( %p [%d], func %p, ctx %p, reaction %p )\n",
+                 reactor, reactor->id, func, ctx, reaction );
+                 
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+                 
+     shared = reactor->shared;
+
+     link = D_CALLOC( 1, sizeof(NodeLink) );
+     if (!link)
+          return D_OOM();
+
+     node = lock_node( reactor->id, true, true, reactor, NULL );
+     if (!node) {
+          D_FREE( link );
+          return DR_FUSION;
+     }
+     
+     fusion_id = _fusion_id( shared );
+     
+     fusion_skirmish_prevail( &reactor->listeners_lock );
+     
+     direct_list_foreach (listener, reactor->listeners) {
+          if (listener->fusion_id == fusion_id && listener->channel == channel) {
+               listener->refs++;
+               break;
+          }
+     }
+     
+     if (!listener) {
+          listener = SHCALLOC( shared->main_pool, 1, sizeof(__Listener) );
+          if (!listener) {
+               D_OOSHM();
+               fusion_skirmish_dismiss( &reactor->listeners_lock );
+               unlock_node( node );
+               D_FREE( link );
+               return DR_NOSHAREDMEMORY;
+          }
+          
+          listener->refs      = 1;
+          listener->fusion_id = fusion_id;
+          listener->channel   = channel;
+         
+          direct_list_append( &reactor->listeners, &listener->link );
+     }
+     
+     fusion_skirmish_dismiss( &reactor->listeners_lock );
+
+     /* fill out callback information */
+     reaction->func      = func;
+     reaction->ctx       = ctx;
+     reaction->node_link = link;
+
+     link->reaction = reaction;
+     link->channel  = channel;
+
+     D_MAGIC_SET( link, NodeLink );
+
+     /* prepend the reaction to the local reaction list */
+     direct_list_prepend( &node->links, &link->link );
+
+     unlock_node( node );
+
+     return DR_OK;
+}
+
+static void
+remove_node_link( ReactorNode *node,
+                  NodeLink    *link )
+{
+     D_MAGIC_ASSERT( node, ReactorNode );
+     D_MAGIC_ASSERT( link, NodeLink );
+
+     D_ASSUME( link->reaction == NULL );
+
+     direct_list_remove( &node->links, &link->link );
+
+     D_MAGIC_CLEAR( link );
+
+     D_FREE( link );
+}
+
+DirectResult
+fusion_reactor_detach( FusionReactor *reactor,
+                       Reaction      *reaction )
+{
+     FusionWorldShared *shared;
+     ReactorNode       *node;
+     NodeLink          *link;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_detach( %p [%d], reaction %p ) <- func %p, ctx %p\n",
+                 reactor, reactor->id, reaction, reaction->func, reaction->ctx );
+     
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+                          
+     shared = reactor->shared;
+
+     node = lock_node( reactor->id, false, true, reactor, NULL );
+     if (!node) {
+          D_BUG( "node not found" );
+          return DR_BUG;
+     }
+
+     link = reaction->node_link;
+     D_ASSUME( link != NULL );
+
+     if (link) {
+          __Listener *listener;
+          FusionID    fusion_id = _fusion_id( shared );
+
+          D_ASSERT( link->reaction == reaction );
+
+          reaction->node_link = NULL;
+
+          link->reaction = NULL;
+
+          remove_node_link( node, link );
+          
+          fusion_skirmish_prevail( &reactor->listeners_lock );
+          
+          direct_list_foreach (listener, reactor->listeners) {
+               if (listener->fusion_id == fusion_id && listener->channel == link->channel) {
+                    if (--listener->refs == 0) {
+                         direct_list_remove( &reactor->listeners, &listener->link );
+                         SHFREE( shared->main_pool, listener );
+                    }
+                    break;
+               }
+          }
+           
+          fusion_skirmish_dismiss( &reactor->listeners_lock );
+          
+          if (!listener)
+               D_ERROR( "Fusion/Reactor: Couldn't detach listener!\n" );
+     }
+
+     unlock_node( node );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_dispatch_channel( FusionReactor      *reactor,
+                                 int                 channel,
+                                 const void         *msg_data,
+                                 int                 msg_size,
+                                 bool                self,
+                                 const ReactionFunc *globals )
+{
+     FusionWorld           *world;
+     __Listener            *listener, *temp; 
+     FusionRef             *ref = NULL;
+     FusionReactorMessage  *msg;
+     struct sockaddr_un     addr;
+     int                    len;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     D_ASSERT( msg_data != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_dispatch( %p [%d], msg_data %p, self %s, globals %p)\n",
+                 reactor, reactor->id, msg_data, self ? "true" : "false", globals );
+
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+
+     if (msg_size > FUSION_MESSAGE_SIZE-sizeof(FusionReactorMessage)) {
+          D_ERROR( "Fusion/Reactor: Message too large (%d)!\n", msg_size );
+          return DR_UNSUPPORTED;
+     }
+
+     world = _fusion_world( reactor->shared );
+
+     if (reactor->call) {
+          ref = SHMALLOC( world->shared->main_pool, sizeof(FusionRef) );
+          if (!ref)
+               return D_OOSHM();
+
+          fusion_ref_init( ref, "Dispatch Ref", world ); 
+          fusion_ref_up( ref, true );
+          fusion_ref_watch( ref, reactor->call, 0 ); 
+     }
+
+     /* Handle global reactions first. */
+     if (reactor->globals) {
+          if (globals)
+               process_globals( reactor, msg_data, globals );
+          else
+               D_ERROR( "Fusion/Reactor: global reactions exist but no "
+                        "globals have been passed to dispatch()\n" );
+     }
+     
+     /* Handle local reactions. */
+     if (self && reactor->direct) {
+          _fusion_reactor_process_message( _fusion_world(reactor->shared), reactor->id, channel, msg_data );
+          self = false;
+     }
+     
+     msg = alloca( sizeof(FusionReactorMessage) + msg_size );
+     
+     msg->type    = FMT_REACTOR;
+     msg->id      = reactor->id;
+     msg->channel = channel;
+     msg->ref     = ref;
+     
+     memcpy( (void*)msg + sizeof(FusionReactorMessage), msg_data, msg_size );
+
+     addr.sun_family = AF_UNIX;
+     len = snprintf( addr.sun_path, sizeof(addr.sun_path), 
+                     "/tmp/.fusion-%d/", fusion_world_index( world ) );
+     
+     fusion_skirmish_prevail( &reactor->listeners_lock );
+     
+     direct_list_foreach_safe (listener, temp, reactor->listeners) {
+          if (listener->channel == channel) {
+               DirectResult ret;
+               
+               if (!self && listener->fusion_id == world->fusion_id)
+                    continue;
+
+               if (ref)
+                    fusion_ref_up( ref, true );
+
+               snprintf( addr.sun_path+len, sizeof(addr.sun_path)-len, "%lx", listener->fusion_id );
+
+               D_DEBUG_AT( Fusion_Reactor, " -> sending to '%s'\n", addr.sun_path );
+               
+               ret = _fusion_send_message( world->fusion_fd, msg, sizeof(FusionReactorMessage)+msg_size, &addr );
+               if (ret == DR_FUSION) {
+                    D_DEBUG_AT( Fusion_Reactor, " -> removing dead listener %lu\n", listener->fusion_id );
+                    
+                    if (ref)
+                         fusion_ref_down( ref, true );
+                    
+                    direct_list_remove( &reactor->listeners, &listener->link ); 
+                    
+                    SHFREE( reactor->shared->main_pool, listener );
+               }
+          }
+     }
+     
+     fusion_skirmish_dismiss( &reactor->listeners_lock );
+
+     if (ref) {
+          fusion_ref_down( ref, true );
+          if (fusion_ref_zero_trylock( ref ) == DR_OK) {
+               fusion_ref_destroy( ref );
+               SHFREE( world->shared->main_pool, ref );
+          }
+     }
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_dispatch( %p ) done.\n", reactor );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_set_dispatch_callback( FusionReactor  *reactor,
+                                      FusionCall     *call,
+                                      void           *call_ptr )
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( call != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_set_dispatch_callback( %p [%d], call %p [%d], ptr %p)\n",
+                 reactor, reactor->id, call, call->call_id, call_ptr );
+                 
+     if (reactor->destroyed)
+          return DR_DESTROYED;
+
+     if (call_ptr)
+          return DR_UNIMPLEMENTED;
+
+     reactor->call = call;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_set_name( FusionReactor *reactor,
+                         const char    *name )
+{
+     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+void
+_fusion_reactor_process_message( FusionWorld *world,
+                                 int          reactor_id,
+                                 int          channel,
+                                 const void  *msg_data )
+{
+     ReactorNode *node;
+     NodeLink    *link;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_ASSERT( msg_data != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "  _fusion_reactor_process_message( [%d], msg_data %p )\n", reactor_id, msg_data );
+
+     /* Find the local counter part of the reactor. */
+     node = lock_node( reactor_id, false, false, NULL, world );
+     if (!node)
+          return;
+
+     D_DEBUG_AT( Fusion_Reactor, "    -> node %p, reactor %p\n", node, node->reactor );
+
+     D_ASSUME( node->links != NULL );
+
+     if (!node->links) {
+          D_DEBUG_AT( Fusion_Reactor, "    -> no local reactions!?!\n" );
+          unlock_node( node );
+          return;
+     }
+
+     direct_list_foreach (link, node->links) {
+          Reaction *reaction;
+
+          D_MAGIC_ASSERT( link, NodeLink );
+
+          if (link->channel != channel)
+               continue;
+
+          reaction = link->reaction;
+          if (!reaction)
+               continue;
+
+          if (reaction->func( msg_data, reaction->ctx ) == RS_REMOVE) {
+               FusionReactor *reactor = node->reactor;
+               __Listener    *listener;
+               
+               D_DEBUG_AT( Fusion_Reactor, "    -> removing %p, func %p, ctx %p\n",
+                           reaction, reaction->func, reaction->ctx );
+               
+               fusion_skirmish_prevail( &reactor->listeners_lock );
+               
+               direct_list_foreach (listener, reactor->listeners) {
+                    if (listener->fusion_id == world->fusion_id && listener->channel == channel) {
+                         if (--listener->refs == 0) {
+                              direct_list_remove( &reactor->listeners, &listener->link );
+                              SHFREE( world->shared->main_pool, listener );
+                         }
+                         break;
+                    }
+               }
+               
+               fusion_skirmish_dismiss( &reactor->listeners_lock );
+          }
+     }
+
+     unlock_node( node );
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+
+DirectResult
+fusion_reactor_set_lock( FusionReactor  *reactor,
+                         FusionSkirmish *lock )
+{
+     DirectResult    ret;
+     FusionSkirmish *old;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     old = reactor->globals_lock;
+
+     D_ASSERT( lock != NULL );
+     D_ASSERT( old != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_set_lock( %p [%d], lock %p [%d] ) <- old %p [%d]\n",
+                 reactor, reactor->id, lock, lock->multi.id, old, old->multi.id );
+
+     /*
+      * Acquire the old lock to make sure that changing the lock doesn't
+      * result in mismatching lock/unlock pairs in other functions.
+      */
+     ret = fusion_skirmish_prevail( old );
+     if (ret)
+          return ret;
+
+     D_ASSUME( reactor->globals_lock != lock );
+
+     /* Set the lock replacement. */
+     reactor->globals_lock = lock;
+
+     /* Release the old lock which is obsolete now. */
+     fusion_skirmish_dismiss( old );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_set_lock_only( FusionReactor  *reactor,
+                              FusionSkirmish *lock )
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( lock != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor, "fusion_reactor_set_lock_only( %p [%d], lock %p [%d] ) <- old %p [%d]\n",
+                 reactor, reactor->id, lock, lock->multi.id, reactor->globals_lock, reactor->globals_lock->multi.id );
+
+     D_ASSUME( reactor->globals_lock != lock );
+
+     /* Set the lock replacement. */
+     reactor->globals_lock = lock;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_attach (FusionReactor *reactor,
+                       ReactionFunc   func,
+                       void          *ctx,
+                       Reaction      *reaction)
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     D_ASSERT( func != NULL );
+     D_ASSERT( reaction != NULL );
+
+     return fusion_reactor_attach_channel( reactor, 0, func, ctx, reaction );
+}
+
+DirectResult
+fusion_reactor_attach_global( FusionReactor  *reactor,
+                              int             index,
+                              void           *ctx,
+                              GlobalReaction *reaction )
+{
+     DirectResult    ret;
+     FusionSkirmish *lock;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     D_ASSERT( index >= 0 );
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_attach_global( %p [%d], index %d, ctx %p, reaction %p )\n",
+                 reactor, reactor->id, index, ctx, reaction );
+
+     /* Initialize reaction data. */
+     reaction->index    = index;
+     reaction->ctx      = ctx;
+     reaction->attached = true;
+
+     /* Remember for safety. */
+     lock = reactor->globals_lock;
+
+     D_ASSERT( lock != NULL );
+
+     /* Lock the list of global reactions. */
+     ret = fusion_skirmish_prevail( lock );
+     if (ret)
+          return ret;
+
+     /* FIXME: Might have changed while waiting for the lock. */
+     if (lock != reactor->globals_lock)
+          D_WARN( "using old lock once more" );
+
+     /* Prepend the reaction to the list. */
+     direct_list_prepend( &reactor->globals, &reaction->link );
+
+     /* Unlock the list of global reactions. */
+     fusion_skirmish_dismiss( lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_detach_global( FusionReactor  *reactor,
+                              GlobalReaction *reaction )
+{
+     DirectResult    ret;
+     FusionSkirmish *lock;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     D_ASSERT( reaction != NULL );
+
+     D_DEBUG_AT( Fusion_Reactor,
+                 "fusion_reactor_detach_global( %p [%d], reaction %p ) <- index %d, ctx %p\n",
+                 reactor, reactor->id, reaction, reaction->index, reaction->ctx );
+
+     /* Remember for safety. */
+     lock = reactor->globals_lock;
+
+     D_ASSERT( lock != NULL );
+
+     /* Lock the list of global reactions. */
+     ret = fusion_skirmish_prevail( lock );
+     if (ret)
+          return ret;
+
+     /* FIXME: Might have changed while waiting for the lock. */
+     if (lock != reactor->globals_lock)
+          D_WARN( "using old lock once more" );
+
+     D_ASSUME( reaction->attached );
+
+     /* Check against multiple detach. */
+     if (reaction->attached) {
+          /* Mark as detached. */
+          reaction->attached = false;
+
+          /* Remove the reaction from the list. */
+          direct_list_remove( &reactor->globals, &reaction->link );
+     }
+
+     /* Unlock the list of global reactions. */
+     fusion_skirmish_dismiss( lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_dispatch( FusionReactor      *reactor,
+                         const void         *msg_data,
+                         bool                self,
+                         const ReactionFunc *globals )
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     return fusion_reactor_dispatch_channel( reactor, 0, msg_data, reactor->msg_size, self, globals );
+}
+
+DirectResult
+fusion_reactor_sized_dispatch( FusionReactor      *reactor,
+                               const void         *msg_data,
+                               int                 msg_size,
+                               bool                self,
+                               const ReactionFunc *globals )
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     return fusion_reactor_dispatch_channel( reactor, 0, msg_data, msg_size, self, globals );
+}
+
+DirectResult
+fusion_reactor_direct( FusionReactor *reactor, bool direct )
+{
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+     
+     reactor->direct = direct;
+     
+     return DR_OK;
+}
+
+
+void
+_fusion_reactor_free_all( FusionWorld *world )
+{
+     ReactorNode *node, *node_temp;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_DEBUG_AT( Fusion_Reactor, "_fusion_reactor_free_all() <- nodes %p\n", world->reactor_nodes );
+
+
+     pthread_mutex_lock( &world->reactor_nodes_lock );
+
+     direct_list_foreach_safe (node, node_temp, world->reactor_nodes) {
+          NodeLink *link, *link_temp;
+
+          D_MAGIC_ASSERT( node, ReactorNode );
+
+          pthread_rwlock_wrlock( &node->lock );
+
+          direct_list_foreach_safe (link, link_temp, node->links) {
+               D_MAGIC_ASSERT( link, NodeLink );
+
+               D_MAGIC_CLEAR( link );
+
+               D_FREE( link );
+          }
+
+          pthread_rwlock_unlock( &node->lock );
+          pthread_rwlock_destroy( &node->lock );
+
+          D_MAGIC_CLEAR( node );
+
+          D_FREE( node );
+     }
+
+     world->reactor_nodes = NULL;
+
+     pthread_mutex_unlock( &world->reactor_nodes_lock );
+}
+
+static void
+process_globals( FusionReactor      *reactor,
+                 const void         *msg_data,
+                 const ReactionFunc *globals )
+{
+     DirectLink     *n;
+     GlobalReaction *global;
+     FusionSkirmish *lock;
+     int             max_index = -1;
+
+     D_MAGIC_ASSERT( reactor, FusionReactor );
+
+     D_ASSERT( msg_data != NULL );
+     D_ASSERT( globals != NULL );
+
+/*     D_DEBUG_AT( Fusion_Reactor, "  process_globals( %p [%d], msg_data %p, globals %p )\n",
+                 reactor, reactor->id, msg_data, globals );*/
+
+     /* Find maximum reaction index. */
+     while (globals[max_index+1])
+          max_index++;
+
+     if (max_index < 0)
+          return;
+
+     /* Remember for safety. */
+     lock = reactor->globals_lock;
+
+     D_ASSERT( lock != NULL );
+
+     /* Lock the list of global reactions. */
+     if (fusion_skirmish_prevail( lock ))
+          return;
+
+     /* FIXME: Might have changed while waiting for the lock. */
+     if (lock != reactor->globals_lock)
+          D_WARN( "using old lock once more" );
+
+     /* Loop through all global reactions. */
+     direct_list_foreach_safe (global, n, reactor->globals) {
+          int index = global->index;
+
+          /* Check if the index is valid. */
+          if (index < 0 || index > max_index) {
+               D_WARN( "index out of bounds (%d/%d)", global->index, max_index );
+               continue;
+          }
+
+          /* Call reaction and remove it if requested. */
+          if (globals[global->index]( msg_data, global->ctx ) == RS_REMOVE) {
+               /*D_DEBUG_AT( Fusion_Reactor, "    -> removing %p, index %d, ctx %p\n",
+                           global, global->index, global->ctx );*/
+
+               direct_list_remove( &reactor->globals, &global->link );
+          }
+     }
+
+     /* Unlock the list of global reactions. */
+     fusion_skirmish_dismiss( lock );
+}
+
+
+
+/*****************************
+ *  File internal functions  *
+ *****************************/
+
+static ReactorNode *
+lock_node( int reactor_id, bool add_it, bool wlock, FusionReactor *reactor, FusionWorld *world )
+{
+     DirectLink        *n;
+     ReactorNode       *node;
+     FusionWorldShared *shared;
+
+     D_DEBUG_AT( Fusion_Reactor, "    lock_node( [%d], add %s, reactor %p )\n",
+                 reactor_id, add_it ? "true" : "false", reactor );
+
+     D_ASSERT( reactor != NULL || (!add_it && world != NULL) );
+
+     if (reactor) {
+          D_MAGIC_ASSERT( reactor, FusionReactor );
+
+          shared = reactor->shared;
+
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+
+          world = _fusion_world( shared );
+
+          D_MAGIC_ASSERT( world, FusionWorld );
+     }
+     else {
+          D_MAGIC_ASSERT( world, FusionWorld );
+
+          shared = world->shared;
+
+          D_MAGIC_ASSERT( shared, FusionWorldShared );
+     }
+
+
+     pthread_mutex_lock( &world->reactor_nodes_lock );
+
+     direct_list_foreach_safe (node, n, world->reactor_nodes) {
+          D_MAGIC_ASSERT( node, ReactorNode );
+
+          if (node->reactor_id == reactor_id) {
+               if (wlock) {
+                    DirectLink *n;
+                    NodeLink   *link;
+
+                    pthread_rwlock_wrlock( &node->lock );
+
+                    /* FIXME: don't cleanup asynchronously */
+                    direct_list_foreach_safe (link, n, node->links) {
+                         D_MAGIC_ASSERT( link, NodeLink );
+
+                         if (!link->reaction) {
+                              D_DEBUG_AT( Fusion_Reactor, "    -> cleaning up %p\n", link );
+                         
+                              remove_node_link( node, link );
+                         }
+                         else
+                              D_ASSERT( link->reaction->node_link == link );
+                    }
+               }
+               else
+                    pthread_rwlock_rdlock( &node->lock );
+
+               /* FIXME: Don't cleanup asynchronously. */
+               if (!node->links && !add_it) {
+//                    D_DEBUG_AT( Fusion_Reactor, "      -> cleaning up mine %p\n", node );
+
+                    direct_list_remove( &world->reactor_nodes, &node->link );
+
+                    pthread_rwlock_unlock( &node->lock );
+                    pthread_rwlock_destroy( &node->lock );
+
+                    D_MAGIC_CLEAR( node );
+
+                    D_FREE( node );
+
+                    node = NULL;
+               }
+               else {
+/*                    D_DEBUG_AT( Fusion_Reactor, "      -> found %p (%d reactions)\n",
+                                node, direct_list_count_elements_EXPENSIVE( node->reactions ) );*/
+
+                    D_ASSERT( node->reactor == reactor || reactor == NULL );
+
+                    direct_list_move_to_front( &world->reactor_nodes, &node->link );
+               }
+
+               pthread_mutex_unlock( &world->reactor_nodes_lock );
+
+               return node;
+          }
+
+          /* FIXME: Don't cleanup asynchronously. */
+          if (!pthread_rwlock_trywrlock( &node->lock )) {
+               if (!node->links) {
+//                    D_DEBUG_AT( Fusion_Reactor, "      -> cleaning up other %p\n", node );
+
+                    direct_list_remove( &world->reactor_nodes, &node->link );
+
+                    pthread_rwlock_unlock( &node->lock );
+                    pthread_rwlock_destroy( &node->lock );
+
+                    D_MAGIC_CLEAR( node );
+
+                    D_FREE( node );
+               }
+               else {
+                    /*D_DEBUG_AT( Fusion_Reactor, "      -> keeping other %p (%d reactions)\n",
+                                node, direct_list_count_elements_EXPENSIVE( node->reactions ) );*/
+
+                    pthread_rwlock_unlock( &node->lock );
+               }
+          }
+     }
+
+//     D_DEBUG_AT( Fusion_Reactor, "      -> not found%s adding\n", add_it ? ", but" : " and not" );
+
+     if (add_it) {
+          D_MAGIC_ASSERT( reactor, FusionReactor );
+
+          node = D_CALLOC( 1, sizeof(ReactorNode) );
+          if (!node) {
+               D_OOM();
+               return NULL;
+          }
+
+          //direct_util_recursive_pthread_mutex_init( &node->lock );
+          pthread_rwlock_init( &node->lock, NULL );
+
+
+          if (wlock)
+               pthread_rwlock_wrlock( &node->lock );
+          else
+               pthread_rwlock_rdlock( &node->lock );
+
+          node->reactor_id = reactor_id;
+          node->reactor    = reactor;
+
+          D_MAGIC_SET( node, ReactorNode );
+
+          direct_list_prepend( &world->reactor_nodes, &node->link );
+
+          pthread_mutex_unlock( &world->reactor_nodes_lock );
+
+          return node;
+     }
+
+     pthread_mutex_unlock( &world->reactor_nodes_lock );
+
+     return NULL;
+}
+
+static void
+unlock_node( ReactorNode *node )
+{
+     D_ASSERT( node != NULL );
+
+//     D_MAGIC_ASSERT( node->reactor, FusionReactor );
+
+/*     D_DEBUG_AT( Fusion_Reactor, "    unlock_node( %p, reactor %p [%d] )\n",
+                 node, node->reactor, node->reactor->id );*/
+
+     pthread_rwlock_unlock( &node->lock );
+}
+
+#else /* FUSION_BUILD_MULTI */
+
+/***************************
+ *  Internal declarations  *
+ ***************************/
+
+/*
+ *
+ */
+struct __Fusion_FusionReactor {
+     DirectLink       *reactions; /* reactor listeners attached to node  */
+     pthread_mutex_t   reactions_lock;
+
+     DirectLink       *globals; /* global reactions attached to node  */
+     pthread_mutex_t   globals_lock;
+
+     bool              destroyed;
+};
+
+static void
+process_globals( FusionReactor      *reactor,
+                 const void         *msg_data,
+                 const ReactionFunc *globals );
+
+/****************
+ *  Public API  *
+ ****************/
+
+FusionReactor *
+fusion_reactor_new( int                msg_size,
+                    const char        *name,
+                    const FusionWorld *world )
+{
+     FusionReactor *reactor;
+
+     D_ASSERT( msg_size > 0 );
+
+     reactor = D_CALLOC( 1, sizeof(FusionReactor) );
+     if (!reactor)
+          return NULL;
+
+     direct_util_recursive_pthread_mutex_init( &reactor->reactions_lock );
+     direct_util_recursive_pthread_mutex_init( &reactor->globals_lock );
+
+     return reactor;
+}
+
+DirectResult
+fusion_reactor_set_lock( FusionReactor  *reactor,
+                         FusionSkirmish *lock )
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( lock != NULL );
+
+//     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_set_lock_only( FusionReactor  *reactor,
+                              FusionSkirmish *lock )
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( lock != NULL );
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_attach (FusionReactor *reactor,
+                       ReactionFunc   func,
+                       void          *ctx,
+                       Reaction      *reaction)
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( func != NULL );
+     D_ASSERT( reaction != NULL );
+
+     reaction->func = func;
+     reaction->ctx  = ctx;
+
+     pthread_mutex_lock( &reactor->reactions_lock );
+
+     direct_list_prepend( &reactor->reactions, &reaction->link );
+
+     pthread_mutex_unlock( &reactor->reactions_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_detach (FusionReactor *reactor,
+                       Reaction      *reaction)
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( reaction != NULL );
+
+     pthread_mutex_lock( &reactor->reactions_lock );
+
+     direct_list_remove( &reactor->reactions, &reaction->link );
+
+     pthread_mutex_unlock( &reactor->reactions_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_attach_global (FusionReactor  *reactor,
+                              int             index,
+                              void           *ctx,
+                              GlobalReaction *reaction)
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( index >= 0 );
+     D_ASSERT( reaction != NULL );
+
+     reaction->index = index;
+     reaction->ctx   = ctx;
+
+     pthread_mutex_lock( &reactor->globals_lock );
+
+     direct_list_prepend( &reactor->globals, &reaction->link );
+
+     pthread_mutex_unlock( &reactor->globals_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_detach_global (FusionReactor  *reactor,
+                              GlobalReaction *reaction)
+{
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( reaction != NULL );
+
+     pthread_mutex_lock( &reactor->globals_lock );
+
+     direct_list_remove( &reactor->globals, &reaction->link );
+
+     pthread_mutex_unlock( &reactor->globals_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_attach_channel( FusionReactor *reactor,
+                               int            channel,
+                               ReactionFunc   func,
+                               void          *ctx,
+                               Reaction      *reaction )
+{
+     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_dispatch_channel( FusionReactor      *reactor,
+                                 int                 channel,
+                                 const void         *msg_data,
+                                 int                 msg_size,
+                                 bool                self,
+                                 const ReactionFunc *globals )
+{
+     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_set_dispatch_callback( FusionReactor  *reactor,
+                                      FusionCall     *call,
+                                      void           *call_ptr )
+{
+     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_set_name( FusionReactor *reactor,
+                         const char    *name )
+{
+     D_UNIMPLEMENTED();
+
+     return DR_UNIMPLEMENTED;
+}
+
+DirectResult
+fusion_reactor_dispatch (FusionReactor      *reactor,
+                         const void         *msg_data,
+                         bool                self,
+                         const ReactionFunc *globals)
+{
+     DirectLink *l;
+
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( msg_data != NULL );
+
+     if (reactor->globals) {
+          if (globals)
+               process_globals( reactor, msg_data, globals );
+          else
+               D_ERROR( "Fusion/Reactor: global reactions exist but no "
+                        "globals have been passed to dispatch()\n" );
+     }
+
+     if (!self)
+          return DR_OK;
+
+     pthread_mutex_lock( &reactor->reactions_lock );
+
+     l = reactor->reactions;
+     while (l) {
+          DirectLink *next     = l->next;
+          Reaction   *reaction = (Reaction*) l;
+
+          switch (reaction->func( msg_data, reaction->ctx )) {
+               case RS_REMOVE:
+                    direct_list_remove( &reactor->reactions, l );
+                    break;
+
+               case RS_DROP:
+                    pthread_mutex_unlock( &reactor->reactions_lock );
+                    return DR_OK;
+
+               default:
+                    break;
+          }
+
+          l = next;
+     }
+
+     pthread_mutex_unlock( &reactor->reactions_lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_direct( FusionReactor *reactor, bool direct )
+{
+     D_ASSERT( reactor != NULL );
+     
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_destroy (FusionReactor *reactor)
+{
+     D_ASSERT( reactor != NULL );
+
+     D_ASSUME( !reactor->destroyed );
+
+     reactor->destroyed = true;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_reactor_free (FusionReactor *reactor)
+{
+     D_ASSERT( reactor != NULL );
+
+//     D_ASSUME( reactor->destroyed );
+
+     reactor->reactions = NULL;
+
+     pthread_mutex_destroy( &reactor->reactions_lock );
+
+     D_FREE( reactor );
+
+     return DR_OK;
+}
+
+/******************************************************************************/
+
+static void
+process_globals( FusionReactor      *reactor,
+                 const void         *msg_data,
+                 const ReactionFunc *globals )
+{
+     DirectLink     *n;
+     GlobalReaction *global;
+     int             max_index = -1;
+
+     D_ASSERT( reactor != NULL );
+     D_ASSERT( msg_data != NULL );
+     D_ASSERT( globals != NULL );
+
+     while (globals[max_index+1])
+          max_index++;
+
+     if (max_index < 0)
+          return;
+
+     pthread_mutex_lock( &reactor->globals_lock );
+
+     direct_list_foreach_safe (global, n, reactor->globals) {
+          if (global->index < 0 || global->index > max_index) {
+               D_WARN( "global reaction index out of bounds (%d/%d)", global->index, max_index );
+          }
+          else {
+               if (globals[ global->index ]( msg_data, global->ctx ) == RS_REMOVE)
+                    direct_list_remove( &reactor->globals, &global->link );
+          }
+     }
+
+     pthread_mutex_unlock( &reactor->globals_lock );
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/reactor.h b/Source/DirectFB/lib/fusion/reactor.h
new file mode 100755
index 0000000..3466c5a
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/reactor.h
@@ -0,0 +1,197 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__REACTOR_H__
+#define __FUSION__REACTOR_H__
+
+#include <direct/list.h>
+
+#include <fusion/types.h>
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+typedef enum {
+     RS_OK,
+     RS_REMOVE,
+     RS_DROP
+} ReactionResult;
+
+typedef ReactionResult (*ReactionFunc)( const void *msg_data,
+                                        void       *ctx );
+
+typedef struct {
+     DirectLink    link;
+     ReactionFunc  func;
+     void         *ctx;
+     void         *node_link;
+} Reaction;
+
+typedef struct {
+     DirectLink  link;
+     int         index;
+     void       *ctx;
+     bool        attached;
+} GlobalReaction;
+
+
+/*
+ * Create a new reactor configured for the specified message data size.
+ */
+FusionReactor *fusion_reactor_new          ( int                 msg_size,
+                                             const char         *name,
+                                             const FusionWorld  *world );
+
+/*
+ * Destroy the reactor.
+ */
+DirectResult   fusion_reactor_destroy      ( FusionReactor      *reactor );
+
+/*
+ * Free the reactor.
+ */
+DirectResult   fusion_reactor_free         ( FusionReactor      *reactor );
+
+
+/*
+ * Makes the reactor use the specified lock for managing global reactions.
+ *
+ * After creating the reactor a global default lock is set which is created
+ * by Fusion once during initialization.
+ *
+ * To avoid dead locks caused by alternating lock orders of the global reaction
+ * lock and another lock, the default lock is replaced by the other lock.
+ */
+DirectResult   fusion_reactor_set_lock     ( FusionReactor      *reactor,
+                                             FusionSkirmish     *skirmish );
+
+DirectResult   fusion_reactor_set_lock_only( FusionReactor      *reactor,
+                                             FusionSkirmish     *lock );
+
+/*
+ * Attach a local reaction to the reactor (channel 0).
+ */
+DirectResult   fusion_reactor_attach       ( FusionReactor      *reactor,
+                                             ReactionFunc        func,
+                                             void               *ctx,
+                                             Reaction           *reaction );
+
+/*
+ * Attach a local reaction to a specific reactor channel (0-1023).
+ */
+DirectResult   fusion_reactor_attach_channel( FusionReactor      *reactor,
+                                              int                 channel,
+                                              ReactionFunc        func,
+                                              void               *ctx,
+                                              Reaction           *reaction );
+
+/*
+ * Detach an attached local reaction from the reactor.
+ */
+DirectResult   fusion_reactor_detach       ( FusionReactor      *reactor,
+                                             Reaction           *reaction );
+
+
+/*
+ * Attach a global reaction to the reactor.
+ *
+ * It's always called directly, no matter which Fusionee calls fusion_reactor_dispatch().
+ * Any data referenced by the reaction function has to be in shared memory, unless it uses a
+ * mechanism to lookup a local counter part or representative, based on shared information.
+ *
+ * A global reaction is not defined directly as a function pointer, because that's always a
+ * local address. Instead, it's specified by an index into a built in function table that
+ * must be passed to fusion_reactor_dispatch() each time it is called.
+ */
+DirectResult   fusion_reactor_attach_global( FusionReactor      *reactor,
+                                             int                 index,
+                                             void               *ctx,
+                                             GlobalReaction     *reaction );
+
+/*
+ * Detach an attached global reaction from the reactor.
+ */
+DirectResult   fusion_reactor_detach_global( FusionReactor      *reactor,
+                                             GlobalReaction     *reaction );
+
+/*
+ * Dispatch a message to any attached reaction (channel 0).
+ *
+ * Setting 'self' to false excludes the caller's local reactions.
+ */
+DirectResult   fusion_reactor_dispatch     ( FusionReactor      *reactor,
+                                             const void         *msg_data,
+                                             bool                self,
+                                             const ReactionFunc *globals );
+
+/*
+ * Dispatch a message to any attached reaction with a given size. Instead of
+ * using the size defined by the reactor, the caller can specify the size of
+ * the data.
+ *
+ * Setting 'self' to false excludes the caller's local reactions.
+ */
+DirectResult   fusion_reactor_sized_dispatch( FusionReactor      *reactor,
+                                              const void         *msg_data,
+                                              int                 msg_size,
+                                              bool                self,
+                                              const ReactionFunc *globals );
+
+/*
+ * Dispatch a message via a specific channel (0-1023).
+ *
+ * Setting 'self' to false excludes the caller's local reactions.
+ */
+DirectResult   fusion_reactor_dispatch_channel( FusionReactor      *reactor,
+                                                int                 channel,
+                                                const void         *msg_data,
+                                                int                 msg_size,
+                                                bool                self,
+                                                const ReactionFunc *globals );
+
+
+/*
+ * Have the call executed when a dispatched message has been processed by all recipients.
+ */
+DirectResult   fusion_reactor_set_dispatch_callback( FusionReactor  *reactor,
+                                                     FusionCall     *call,
+                                                     void           *call_ptr );
+
+/*
+ * Change the name of the reactor (debug).
+ */
+DirectResult   fusion_reactor_set_name             ( FusionReactor  *reactor,
+                                                     const char     *name );
+
+/*
+ * Specify whether local message handlers (reactions) should be called directly.
+ */
+DirectResult   fusion_reactor_direct        ( FusionReactor      *reactor,
+                                              bool                direct );
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/ref.c b/Source/DirectFB/lib/fusion/ref.c
new file mode 100755
index 0000000..6c278e6
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/ref.c
@@ -0,0 +1,849 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <fusion/build.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/types.h>
+#include <fusion/ref.h>
+
+#include "fusion_internal.h"
+
+#include <signal.h>
+
+
+#if FUSION_BUILD_MULTI
+
+D_DEBUG_DOMAIN( Fusion_Ref, "Fusion/Ref", "Fusion's Reference Counter" );
+
+
+#if FUSION_BUILD_KERNEL
+
+DirectResult
+fusion_ref_init (FusionRef         *ref,
+                 const char        *name,
+                 const FusionWorld *world)
+{
+     FusionEntryInfo info;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_DEBUG_AT( Fusion_Ref, "fusion_ref_init( %p, '%s' )\n", ref, name ? : "" );
+
+     while (ioctl( world->fusion_fd, FUSION_REF_NEW, &ref->multi.id )) {
+          if (errno == EINTR)
+               continue;
+
+          D_PERROR( "FUSION_REF_NEW" );
+          return DR_FUSION;
+     }
+
+     D_DEBUG_AT( Fusion_Ref, "  -> new ref %p [%d]\n", ref, ref->multi.id );
+
+     info.type = FT_REF;
+     info.id   = ref->multi.id;
+
+     direct_snputs( info.name, name, sizeof(info.name) );
+
+     ioctl( world->fusion_fd, FUSION_ENTRY_SET_INFO, &info );
+
+     /* Keep back pointer to shared world data. */
+     ref->multi.shared  = world->shared;
+     ref->multi.creator = fusion_id( world );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_set_name (FusionRef  *ref,
+                     const char *name)
+{
+     FusionEntryInfo info;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( name != NULL );
+
+     info.type = FT_REF;
+     info.id   = ref->multi.id;
+
+     direct_snputs( info.name, name, sizeof(info.name) );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_ENTRY_SET_INFO, &info)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EAGAIN:
+                    return DR_LOCKED;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_ENTRY_SET_NAME");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_up (FusionRef *ref, bool global)
+{
+     D_ASSERT( ref != NULL );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), global ?
+                   FUSION_REF_UP_GLOBAL : FUSION_REF_UP, &ref->multi.id))
+     {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EAGAIN:
+                    return DR_LOCKED;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          if (global)
+               D_PERROR ("FUSION_REF_UP_GLOBAL");
+          else
+               D_PERROR ("FUSION_REF_UP");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_down (FusionRef *ref, bool global)
+{
+     D_ASSERT( ref != NULL );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), global ?
+                   FUSION_REF_DOWN_GLOBAL : FUSION_REF_DOWN, &ref->multi.id))
+     {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          if (global)
+               D_PERROR ("FUSION_REF_DOWN_GLOBAL");
+          else
+               D_PERROR ("FUSION_REF_DOWN");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_stat (FusionRef *ref, int *refs)
+{
+     int val;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( refs != NULL );
+
+     while ((val = ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_STAT, &ref->multi.id)) < 0) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_STAT");
+
+          return DR_FAILURE;
+     }
+
+     *refs = val;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_zero_lock (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_ZERO_LOCK, &ref->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_ZERO_LOCK");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_zero_trylock (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_ZERO_TRYLOCK, &ref->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case ETOOMANYREFS:
+                    return DR_BUSY;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_ZERO_TRYLOCK");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_unlock (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_UNLOCK, &ref->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_UNLOCK");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_watch (FusionRef *ref, FusionCall *call, int call_arg)
+{
+     FusionRefWatch watch;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( call != NULL );
+
+     watch.id       = ref->multi.id;
+     watch.call_id  = call->call_id;
+     watch.call_arg = call_arg;
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_WATCH, &watch)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_WATCH");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_inherit (FusionRef *ref, FusionRef *from)
+{
+     FusionRefInherit inherit;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( from != NULL );
+
+     inherit.id   = ref->multi.id;
+     inherit.from = from->multi.id;
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_INHERIT, &inherit)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_INHERIT");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_destroy (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+
+     D_DEBUG_AT( Fusion_Ref, "fusion_ref_destroy( %p [%d] )\n", ref, ref->multi.id );
+
+     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_DESTROY, &ref->multi.id)) {
+          switch (errno) {
+               case EINTR:
+                    continue;
+               case EINVAL:
+                    D_ERROR ("Fusion/Reference: invalid reference\n");
+                    return DR_DESTROYED;
+               default:
+                    break;
+          }
+
+          D_PERROR ("FUSION_REF_DESTROY");
+
+          return DR_FAILURE;
+     }
+
+     return DR_OK;
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+DirectResult
+fusion_ref_init (FusionRef         *ref,
+                 const char        *name,
+                 const FusionWorld *world)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( name != NULL );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_DEBUG_AT( Fusion_Ref, "fusion_ref_init( %p, '%s' )\n", ref, name ? : "" );
+     
+     ref->multi.id = ++world->shared->ref_ids;
+     
+     ref->multi.builtin.local  = 0;
+     ref->multi.builtin.global = 0;
+     
+     fusion_skirmish_init( &ref->multi.builtin.lock, name, world );
+     
+     ref->multi.builtin.call = NULL;
+
+     /* Keep back pointer to shared world data. */
+     ref->multi.shared  = world->shared;
+     ref->multi.creator = fusion_id( world );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_set_name (FusionRef  *ref,
+                     const char *name)
+{
+     return DR_OK;
+}
+
+DirectResult
+_fusion_ref_change (FusionRef *ref, int add, bool global)
+{
+     DirectResult ret;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( add != 0 );
+     
+     ret = fusion_skirmish_prevail( &ref->multi.builtin.lock );
+     if (ret)
+          return ret;
+     
+     if (global) {
+          if (ref->multi.builtin.global+add < 0) {
+               D_BUG( "ref has no global references" );
+               fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+               return DR_BUG;
+          }
+
+          ref->multi.builtin.global += add;
+     }
+     else {          
+          if (ref->multi.builtin.local+add < 0) {
+               D_BUG( "ref has no local references" );
+               fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+               return DR_BUG;
+          }
+
+          ref->multi.builtin.local += add;
+          
+          _fusion_add_local( _fusion_world(ref->multi.shared), ref, add ); 
+     }
+
+     if (ref->multi.builtin.local+ref->multi.builtin.global == 0) {
+          fusion_skirmish_notify( &ref->multi.builtin.lock );
+
+          if (ref->multi.builtin.call) {
+               fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+               return fusion_call_execute( ref->multi.builtin.call, FCEF_ONEWAY, 
+                                           ref->multi.builtin.call_arg, NULL, NULL );
+          }
+     }
+     
+     fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_up (FusionRef *ref, bool global)
+{
+     return _fusion_ref_change( ref, +1, global );
+}
+
+DirectResult
+fusion_ref_down (FusionRef *ref, bool global)
+{
+     return _fusion_ref_change( ref, -1, global );
+}
+
+DirectResult
+fusion_ref_stat (FusionRef *ref, int *refs)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( refs != NULL );
+          
+     *refs = ref->multi.builtin.local + ref->multi.builtin.global;
+     
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_zero_lock (FusionRef *ref)
+{
+     DirectResult ret;
+     
+     D_ASSERT( ref != NULL );
+
+     ret = fusion_skirmish_prevail( &ref->multi.builtin.lock );
+     if (ret)
+          return ret;
+     
+     if (ref->multi.builtin.call) {
+          ret = DR_ACCESSDENIED;
+     }
+     else {
+          if (ref->multi.builtin.local)
+               _fusion_check_locals( _fusion_world(ref->multi.shared), ref );
+          
+          while (ref->multi.builtin.local+ref->multi.builtin.global) {    
+               ret = fusion_skirmish_wait( &ref->multi.builtin.lock, 1000 ); /* 1 second */
+               if (ret && ret != DR_TIMEOUT);
+                    return ret;
+               
+               if (ref->multi.builtin.call) {
+                    ret = DR_ACCESSDENIED;
+                    break;
+               }
+
+               if (ref->multi.builtin.local)
+                    _fusion_check_locals( _fusion_world(ref->multi.shared), ref );
+          }
+     }
+          
+     if (ret)
+          fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_zero_trylock (FusionRef *ref)
+{
+     DirectResult ret;
+     
+     D_ASSERT( ref != NULL );
+
+     ret = fusion_skirmish_prevail( &ref->multi.builtin.lock );
+     if (ret)
+          return ret;
+
+     if (ref->multi.builtin.local)
+          _fusion_check_locals( _fusion_world(ref->multi.shared), ref );
+
+     if (ref->multi.builtin.local+ref->multi.builtin.global)
+          ret = DR_BUSY;
+     
+     if (ret)
+          fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_unlock (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+          
+     fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_watch (FusionRef *ref, FusionCall *call, int call_arg)
+{
+     DirectResult ret;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( call != NULL );
+
+     ret = fusion_skirmish_prevail( &ref->multi.builtin.lock );
+     if (ret)
+          return ret;
+     
+     if (ref->multi.builtin.local+ref->multi.builtin.global == 0) {
+          D_BUG( "ref has no references" );
+          ret = DR_BUG;
+     }
+     else if (ref->multi.builtin.call) {
+          ret = DR_BUSY;
+     }
+     else {
+          ref->multi.builtin.call = call;
+          ref->multi.builtin.call_arg = call_arg;
+          fusion_skirmish_notify( &ref->multi.builtin.lock );
+     }
+     
+     fusion_skirmish_dismiss( &ref->multi.builtin.lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_inherit (FusionRef *ref, FusionRef *from)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( from != NULL );
+
+     D_UNIMPLEMENTED();
+     
+     return fusion_ref_up( ref, true );
+}
+
+DirectResult
+fusion_ref_destroy (FusionRef *ref)
+{
+     FusionSkirmish *skirmish;
+     
+     D_ASSERT( ref != NULL );
+
+     D_DEBUG_AT( Fusion_Ref, "fusion_ref_destroy( %p )\n", ref );
+    
+     skirmish = &ref->multi.builtin.lock;
+     if (skirmish->multi.builtin.destroyed)
+          return DR_DESTROYED;
+
+     _fusion_remove_all_locals( _fusion_world(ref->multi.shared), ref ); 
+
+     fusion_skirmish_destroy( skirmish );
+
+     return DR_OK;
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+#else /* FUSION_BUILD_MULTI */
+
+DirectResult
+fusion_ref_init (FusionRef         *ref,
+                 const char        *name,
+                 const FusionWorld *world)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( name != NULL );
+
+     direct_util_recursive_pthread_mutex_init (&ref->single.lock);
+     pthread_cond_init (&ref->single.cond, NULL);
+
+     ref->single.refs      = 0;
+     ref->single.destroyed = false;
+     ref->single.locked    = 0;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_set_name (FusionRef  *ref,
+                     const char *name)
+{
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_up (FusionRef *ref, bool global)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( ref != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     if (ref->single.destroyed)
+          ret = DR_DESTROYED;
+     else if (ref->single.locked)
+          ret = DR_LOCKED;
+     else
+          ref->single.refs++;
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_down (FusionRef *ref, bool global)
+{
+     D_ASSERT( ref != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     if (!ref->single.refs) {
+          D_BUG( "no more references" );
+          pthread_mutex_unlock (&ref->single.lock);
+          return DR_BUG;
+     }
+
+     if (ref->single.destroyed) {
+          pthread_mutex_unlock (&ref->single.lock);
+          return DR_DESTROYED;
+     }
+
+     if (! --ref->single.refs) {
+          if (ref->single.call) {
+               FusionCall *call = ref->single.call;
+
+               if (call->handler) {
+                    int ret;
+                    pthread_mutex_unlock (&ref->single.lock);
+                    call->handler( 0, ref->single.call_arg, NULL, call->ctx, 0, &ret );
+                    return DR_OK;
+               }
+          }
+          else
+               pthread_cond_broadcast (&ref->single.cond);
+     }
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_stat (FusionRef *ref, int *refs)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( refs != NULL );
+
+     if (ref->single.destroyed)
+          return DR_DESTROYED;
+
+     *refs = ref->single.refs;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_ref_zero_lock (FusionRef *ref)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( ref != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     do {
+          if (ref->single.destroyed)
+               ret = DR_DESTROYED;
+          else if (ref->single.locked)
+               ret = DR_LOCKED;
+          else if (ref->single.refs)
+               pthread_cond_wait (&ref->single.cond, &ref->single.lock);
+          else {
+               ref->single.locked = direct_gettid();
+               break;
+          }
+     } while (ret == DR_OK);
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_zero_trylock (FusionRef *ref)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( ref != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     if (ref->single.destroyed)
+          ret = DR_DESTROYED;
+     else if (ref->single.locked)
+          ret = DR_LOCKED;
+     else if (ref->single.refs)
+          ret = DR_BUSY;
+     else
+          ref->single.locked = direct_gettid();
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_unlock (FusionRef *ref)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( ref != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     if (ref->single.locked == direct_gettid()) {
+          ref->single.locked = 0;
+
+          pthread_cond_broadcast (&ref->single.cond);
+     }
+     else
+          ret = DR_ACCESSDENIED;
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_watch (FusionRef *ref, FusionCall *call, int call_arg)
+{
+     DirectResult ret = DR_OK;
+
+     D_ASSERT( ref != NULL );
+     D_ASSERT( call != NULL );
+
+     pthread_mutex_lock (&ref->single.lock);
+
+     if (ref->single.destroyed)
+          ret = DR_DESTROYED;
+     else if (!ref->single.refs)
+          ret = DR_BUG;
+     else if (ref->single.call)
+          ret = DR_BUSY;
+     else {
+          ref->single.call     = call;
+          ref->single.call_arg = call_arg;
+     }
+
+     pthread_mutex_unlock (&ref->single.lock);
+
+     return ret;
+}
+
+DirectResult
+fusion_ref_inherit (FusionRef *ref, FusionRef *from)
+{
+     D_ASSERT( ref != NULL );
+     D_ASSERT( from != NULL );
+
+     D_UNIMPLEMENTED();
+
+     /* FIXME */
+     return fusion_ref_up( ref, true );
+}
+
+DirectResult
+fusion_ref_destroy (FusionRef *ref)
+{
+     D_ASSERT( ref != NULL );
+
+     ref->single.destroyed = true;
+
+     pthread_cond_broadcast (&ref->single.cond);
+
+     pthread_mutex_destroy (&ref->single.lock);
+     pthread_cond_destroy (&ref->single.cond);
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/ref.h b/Source/DirectFB/lib/fusion/ref.h
new file mode 100755
index 0000000..b9beda7
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/ref.h
@@ -0,0 +1,134 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__REF_H__
+#define __FUSION__REF_H__
+
+#include <pthread.h>
+
+#include <fusion/types.h>
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+typedef union {
+     /* multi app */
+     struct {
+          int                      id;
+          const FusionWorldShared *shared;
+          FusionID                 creator;
+          /* builtin impl */
+          struct {
+               int                 local;
+               int                 global;
+               FusionSkirmish      lock; 
+          
+               FusionCall         *call;
+               int                 call_arg;
+          } builtin;
+     } multi;
+     
+     /* single app */
+     struct {
+          int                      refs;
+          pthread_cond_t           cond;
+          pthread_mutex_t          lock;
+          bool                     destroyed;
+          int                      locked;
+
+          FusionCall              *call;
+          int                      call_arg;
+     } single;
+} FusionRef;
+
+/*
+ * Initialize.
+ */
+DirectResult fusion_ref_init         (FusionRef         *ref,
+                                      const char        *name,
+                                      const FusionWorld *world);
+
+DirectResult fusion_ref_set_name     (FusionRef         *ref,
+                                      const char        *name);
+
+/*
+ * Lock, increase, unlock.
+ */
+DirectResult fusion_ref_up           (FusionRef *ref, bool global);
+
+/*
+ * Lock, decrease, unlock.
+ */
+DirectResult fusion_ref_down         (FusionRef *ref, bool global);
+
+/*
+ * Get the current reference count. Meant for debugging only.
+ * This value is not reliable, because no locking will be performed
+ * and the value may change after or even while returning it.
+ */
+DirectResult fusion_ref_stat         (FusionRef *ref, int *refs);
+
+/*
+ * Wait for zero and lock.
+ */
+DirectResult fusion_ref_zero_lock    (FusionRef *ref);
+
+/*
+ * Check for zero and lock if true.
+ */
+DirectResult fusion_ref_zero_trylock (FusionRef *ref);
+
+/*
+ * Unlock the counter.
+ * Only to be called after successful zero_lock or zero_trylock.
+ */
+DirectResult fusion_ref_unlock       (FusionRef *ref);
+
+/*
+ * Have the call executed when reference counter reaches zero.
+ */
+DirectResult fusion_ref_watch        (FusionRef  *ref,
+                                      FusionCall *call,
+                                      int         call_arg);
+
+/*
+ * Inherit local reference count from another reference.
+ *
+ * The local count of the other reference (and its inherited references) is added to this reference.
+ */
+DirectResult fusion_ref_inherit      (FusionRef *ref,
+                                      FusionRef *from);
+
+/*
+ * Deinitialize.
+ * Can be called after successful zero_lock or zero_trylock
+ * so that waiting fusion_ref_up calls return with DR_DESTROYED.
+ */
+DirectResult fusion_ref_destroy      (FusionRef *ref);
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/shm/Makefile.am b/Source/DirectFB/lib/fusion/shm/Makefile.am
new file mode 100755
index 0000000..23ed4a5
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/Makefile.am
@@ -0,0 +1,31 @@
+## Makefile.am for DirectFB/lib/fusion/shm
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"@DATADIR@\"	\
+	-DMODULEDIR=\"@MODULEDIR@\"
+
+if ENABLE_MULTI
+SHMSOURCES = heap.c pool.c shm.c
+else
+SHMSOURCES = fake.c
+endif
+
+EXTRA_DIST = fake.c
+
+noinst_LTLIBRARIES = libfusion_shm.la
+
+libfusion_shm_la_SOURCES = \
+	$(SHMSOURCES)
+
+includedir = @INCLUDEDIR@/fusion/shm
+
+include_HEADERS = \
+	pool.h			\
+	shm.h			\
+	shm_internal.h
diff --git a/Source/DirectFB/lib/fusion/shm/Makefile.in b/Source/DirectFB/lib/fusion/shm/Makefile.in
new file mode 100755
index 0000000..987fa8f
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/Makefile.in
@@ -0,0 +1,565 @@
+# 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@
+subdir = lib/fusion/shm
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libfusion_shm_la_LIBADD =
+am__libfusion_shm_la_SOURCES_DIST = fake.c heap.c pool.c shm.c
+@ENABLE_MULTI_FALSE@am__objects_1 = fake.lo
+@ENABLE_MULTI_TRUE@am__objects_1 = heap.lo pool.lo shm.lo
+am_libfusion_shm_la_OBJECTS = $(am__objects_1)
+libfusion_shm_la_OBJECTS = $(am_libfusion_shm_la_OBJECTS)
+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 = $(libfusion_shm_la_SOURCES)
+DIST_SOURCES = $(am__libfusion_shm_la_SOURCES_DIST)
+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)$(includedir)"
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+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@/fusion/shm
+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_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"@DATADIR@\"	\
+	-DMODULEDIR=\"@MODULEDIR@\"
+
+@ENABLE_MULTI_FALSE@SHMSOURCES = fake.c
+@ENABLE_MULTI_TRUE@SHMSOURCES = heap.c pool.c shm.c
+EXTRA_DIST = fake.c
+noinst_LTLIBRARIES = libfusion_shm.la
+libfusion_shm_la_SOURCES = \
+	$(SHMSOURCES)
+
+include_HEADERS = \
+	pool.h			\
+	shm.h			\
+	shm_internal.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/fusion/shm/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  lib/fusion/shm/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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
+libfusion_shm.la: $(libfusion_shm_la_OBJECTS) $(libfusion_shm_la_DEPENDENCIES) 
+	$(LINK)  $(libfusion_shm_la_OBJECTS) $(libfusion_shm_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shm.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-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-includeHEADERS
+
+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-includeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES 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-includeHEADERS 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-includeHEADERS
+
+# 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/lib/fusion/shm/fake.c b/Source/DirectFB/lib/fusion/shm/fake.c
new file mode 100755
index 0000000..32e25cd
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/fake.c
@@ -0,0 +1,163 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <fusion/shm/shm.h>
+#include <fusion/shm/pool.h>
+
+#include <fusion/shm/shm_internal.h>
+
+
+DirectResult
+fusion_shm_pool_create( FusionWorld          *world,
+                        const char           *name,
+                        unsigned int          max_size,
+                        bool                  debug,
+                        FusionSHMPoolShared **ret_pool )
+{
+     FusionSHMPoolShared *pool;
+
+#if !DIRECT_BUILD_DEBUGS
+     debug = false;
+#endif
+
+     pool = D_CALLOC( 1, sizeof(FusionSHMPoolShared) );
+     if (!pool)
+          return D_OOM();
+
+     pool->debug = debug;
+
+     D_MAGIC_SET( pool, FusionSHMPoolShared );
+
+     *ret_pool = pool;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_destroy( FusionWorld         *world,
+                         FusionSHMPoolShared *pool )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_MAGIC_CLEAR( pool );
+
+     D_FREE( pool );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_attach( FusionSHM           *shm,
+                        FusionSHMPoolShared *pool )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     pool->index++;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_detach( FusionSHM           *shm,
+                        FusionSHMPoolShared *pool )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_ASSERT( pool->index > 0 );
+
+     pool->index--;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_allocate( FusionSHMPoolShared  *pool,
+                          int                   size,
+                          bool                  clear,
+                          bool                  lock,
+                          void                **ret_data )
+{
+     void *data;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     data = clear ? D_CALLOC( 1, size ) : D_MALLOC( size );
+     if (!data)
+          return DR_NOSHAREDMEMORY;
+
+     *ret_data = data;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_reallocate( FusionSHMPoolShared  *pool,
+                            void                 *data,
+                            int                   size,
+                            bool                  lock,
+                            void                **ret_data )
+{
+     void *new_data;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     new_data = D_REALLOC( data, size );
+     if (!new_data)
+          return DR_NOSHAREDMEMORY;
+
+     *ret_data = new_data;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_deallocate( FusionSHMPoolShared *pool,
+                            void                *data,
+                            bool                 lock )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_FREE( data );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_enum_pools( FusionWorld           *world,
+                       FusionSHMPoolCallback  callback,
+                       void                  *ctx )
+{
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/fusion/shm/heap.c b/Source/DirectFB/lib/fusion/shm/heap.c
new file mode 100755
index 0000000..4a76229
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/heap.c
@@ -0,0 +1,802 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/* Heap management adapted from libc
+   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+                  Written May 1989 by Mike Haertel.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.
+
+   The author may be reached (Email) at the address mike@ai.mit.edu,
+   or (US mail) as Mike Haertel c/o Free Software Foundation.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/conf.h>
+#include <fusion/shmalloc.h>
+#include <fusion/fusion_internal.h>
+
+#include <fusion/shm/pool.h>
+#include <fusion/shm/shm_internal.h>
+
+
+D_DEBUG_DOMAIN( Fusion_SHMHeap, "Fusion/SHMHeap", "Fusion Shared Memory Heap" );
+
+/**********************************************************************************************************************/
+
+/* Aligned allocation.  */
+static void *
+align( shmalloc_heap *heap, size_t size )
+{
+     void          *result;
+     unsigned long  adj;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %zu )\n", __FUNCTION__, heap, size );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     result = __shmalloc_brk( heap, size );
+
+     adj = (unsigned long) result % BLOCKSIZE;
+     if (adj != 0) {
+          adj = BLOCKSIZE - adj;
+          __shmalloc_brk( heap, adj );
+          result = (char *) result + adj;
+     }
+
+     return result;
+}
+
+/* Get neatly aligned memory, initializing or
+   growing the heap info table as necessary. */
+static void *
+morecore( shmalloc_heap *heap, size_t size )
+{
+     void *result;
+     shmalloc_info *newinfo, *oldinfo;
+     size_t newsize;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %zu )\n", __FUNCTION__, heap, size );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     result = align( heap, size );
+     if (result == NULL)
+          return NULL;
+
+     /* Check if we need to grow the info table.  */
+     if ((size_t) BLOCK ((char *) result + size) > heap->heapsize) {
+          newsize = heap->heapsize;
+
+          while ((size_t) BLOCK ((char *) result + size) > newsize)
+               newsize *= 2;
+
+          newinfo = (shmalloc_info *) align( heap, newsize * sizeof (shmalloc_info) );
+          if (newinfo == NULL) {
+               __shmalloc_brk( heap, -size );
+               return NULL;
+          }
+
+          direct_memcpy( newinfo, heap->heapinfo,
+                         heap->heapsize * sizeof (shmalloc_info) );
+
+          memset (newinfo + heap->heapsize,
+                  0, (newsize - heap->heapsize) * sizeof (shmalloc_info));
+
+          oldinfo = heap->heapinfo;
+
+          newinfo[BLOCK (oldinfo)].busy.type = 0;
+          newinfo[BLOCK (oldinfo)].busy.info.size = BLOCKIFY (heap->heapsize * sizeof (shmalloc_info));
+
+          heap->heapinfo = newinfo;
+
+          _fusion_shfree( heap, oldinfo );
+
+          heap->heapsize = newsize;
+     }
+
+     heap->heaplimit = BLOCK ((char *) result + size);
+
+     return result;
+}
+
+/**********************************************************************************************************************/
+
+/* Allocate memory from the heap.  */
+void *
+_fusion_shmalloc( shmalloc_heap *heap, size_t size )
+{
+     void *result;
+     size_t block, blocks, lastblocks, start;
+     register size_t i;
+     struct list *next;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %zu )\n", __FUNCTION__, heap, size );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     /* Some programs will call shmalloc (0). We let them pass. */
+     if (size == 0)
+          return NULL;
+
+     if (size < sizeof (struct list))
+          size = sizeof (struct list);
+
+     /* Determine the allocation policy based on the request size.  */
+     if (size <= BLOCKSIZE / 2) {
+          /* Small allocation to receive a fragment of a block.
+             Determine the logarithm to base two of the fragment size. */
+          register size_t log = 1;
+          --size;
+          while ((size /= 2) != 0)
+               ++log;
+
+          /* Look in the fragment lists for a
+             free fragment of the desired size. */
+          next = heap->fraghead[log].next;
+          if (next != NULL) {
+               /* There are free fragments of this size.
+                  Pop a fragment out of the fragment list and return it.
+                  Update the block's nfree and first counters. */
+               result = (void *) next;
+               next->prev->next = next->next;
+               if (next->next != NULL)
+                    next->next->prev = next->prev;
+               block = BLOCK (result);
+               if (--(heap->heapinfo[block].busy.info.frag.nfree) != 0)
+                    heap->heapinfo[block].busy.info.frag.first = (unsigned long int)
+                                                                   ((unsigned long int) ((char *) next->next - (char *) NULL)
+                                                                    % BLOCKSIZE) >> log;
+
+               /* Update the statistics.  */
+               heap->chunks_used++;
+               heap->bytes_used += 1 << log;
+               heap->chunks_free--;
+               heap->bytes_free -= 1 << log;
+          }
+          else {
+               /* No free fragments of the desired size, so get a new block
+                  and break it into fragments, returning the first.  */
+               result = _fusion_shmalloc( heap, BLOCKSIZE );
+               if (result == NULL)
+                    return NULL;
+#if 1   /* Adapted from Mike */
+               heap->fragblocks[log]++;
+#endif
+
+               /* Link all fragments but the first into the free list.  */
+               for (i = 1; i < (size_t) (BLOCKSIZE >> log); ++i) {
+                    next = (struct list *) ((char *) result + (i << log));
+                    next->next = heap->fraghead[log].next;
+                    next->prev = &heap->fraghead[log];
+                    next->prev->next = next;
+                    if (next->next != NULL)
+                         next->next->prev = next;
+               }
+
+               /* Initialize the nfree and first counters for this block.  */
+               block = BLOCK (result);
+               heap->heapinfo[block].busy.type = log;
+               heap->heapinfo[block].busy.info.frag.nfree = i - 1;
+               heap->heapinfo[block].busy.info.frag.first = i - 1;
+
+               heap->chunks_free += (BLOCKSIZE >> log) - 1;
+               heap->bytes_free += BLOCKSIZE - (1 << log);
+               heap->bytes_used -= BLOCKSIZE - (1 << log);
+          }
+     }
+     else {
+          /* Large allocation to receive one or more blocks.
+             Search the free list in a circle starting at the last place visited.
+             If we loop completely around without finding a large enough
+             space we will have to get more memory from the system.  */
+          blocks = BLOCKIFY (size);
+          start = block = heap->heapindex;
+          while (heap->heapinfo[block].free.size < blocks) {
+               block = heap->heapinfo[block].free.next;
+               if (block == start) {
+                    /* Need to get more from the system.  Check to see if
+                       the new core will be contiguous with the final free
+                       block; if so we don't need to get as much.  */
+                    block = heap->heapinfo[0].free.prev;
+                    lastblocks = heap->heapinfo[block].free.size;
+                    if (heap->heaplimit != 0 && block + lastblocks == heap->heaplimit &&
+                        __shmalloc_brk( heap, 0 ) == ADDRESS (block + lastblocks) &&
+                        (morecore( heap, (blocks - lastblocks) * BLOCKSIZE) ) != NULL) {
+#if 1   /* Adapted from Mike */
+
+                         /* Note that morecore() can change the location of
+                            the final block if it moves the info table and the
+                            old one gets coalesced into the final block. */
+                         block = heap->heapinfo[0].free.prev;
+                         heap->heapinfo[block].free.size += blocks - lastblocks;
+#else
+                         heap->heapinfo[block].free.size = blocks;
+#endif
+                         heap->bytes_free += (blocks - lastblocks) * BLOCKSIZE;
+                         continue;
+                    }
+                    result = morecore( heap, blocks * BLOCKSIZE );
+                    if (result == NULL)
+                         return NULL;
+                    block = BLOCK (result);
+                    heap->heapinfo[block].busy.type = 0;
+                    heap->heapinfo[block].busy.info.size = blocks;
+                    heap->chunks_used++;
+                    heap->bytes_used += blocks * BLOCKSIZE;
+                    return result;
+               }
+          }
+
+          /* At this point we have found a suitable free list entry.
+             Figure out how to remove what we need from the list. */
+          result = ADDRESS (block);
+          if (heap->heapinfo[block].free.size > blocks) {
+               /* The block we found has a bit left over,
+                  so relink the tail end back into the free list. */
+               heap->heapinfo[block + blocks].free.size
+               = heap->heapinfo[block].free.size - blocks;
+               heap->heapinfo[block + blocks].free.next
+               = heap->heapinfo[block].free.next;
+               heap->heapinfo[block + blocks].free.prev
+               = heap->heapinfo[block].free.prev;
+               heap->heapinfo[heap->heapinfo[block].free.prev].free.next
+               = heap->heapinfo[heap->heapinfo[block].free.next].free.prev
+                 = heap->heapindex = block + blocks;
+          }
+          else {
+               /* The block exactly matches our requirements,
+                  so just remove it from the list. */
+               heap->heapinfo[heap->heapinfo[block].free.next].free.prev
+               = heap->heapinfo[block].free.prev;
+               heap->heapinfo[heap->heapinfo[block].free.prev].free.next
+               = heap->heapindex = heap->heapinfo[block].free.next;
+               heap->chunks_free--;
+          }
+
+          heap->heapinfo[block].busy.type = 0;
+          heap->heapinfo[block].busy.info.size = blocks;
+          heap->chunks_used++;
+          heap->bytes_used += blocks * BLOCKSIZE;
+          heap->bytes_free -= blocks * BLOCKSIZE;
+     }
+
+     return result;
+}
+
+/* Resize the given region to the new size, returning a pointer
+   to the (possibly moved) region.  This is optimized for speed;
+   some benchmarks seem to indicate that greater compactness is
+   achieved by unconditionally allocating and copying to a
+   new region.  This module has incestuous knowledge of the
+   internals of both free and shmalloc. */
+void *
+_fusion_shrealloc( shmalloc_heap *heap, void *ptr, size_t size )
+{
+     void  *result;
+     int    type;
+     size_t block, blocks, oldlimit;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %p, %zu )\n", __FUNCTION__, heap, ptr, size );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     if (ptr == NULL)
+          return _fusion_shmalloc( heap, size );
+     else if (size == 0) {
+          _fusion_shfree( heap, ptr );
+          return NULL;
+     }
+
+     block = BLOCK (ptr);
+
+     type = heap->heapinfo[block].busy.type;
+     switch (type) {
+          case 0:
+               /* Maybe reallocate a large block to a small fragment.  */
+               if (size <= BLOCKSIZE / 2) {
+                    result = _fusion_shmalloc( heap, size );
+                    if (result != NULL) {
+                         direct_memcpy (result, ptr, size);
+                         _fusion_shfree( heap, ptr );
+                         return result;
+                    }
+               }
+
+               /* The new size is a large allocation as well;
+                  see if we can hold it in place. */
+               blocks = BLOCKIFY (size);
+               if (blocks < heap->heapinfo[block].busy.info.size) {
+                    /* The new size is smaller; return
+                       excess memory to the free list. */
+                    heap->heapinfo[block + blocks].busy.type = 0;
+                    heap->heapinfo[block + blocks].busy.info.size
+                    = heap->heapinfo[block].busy.info.size - blocks;
+                    heap->heapinfo[block].busy.info.size = blocks;
+                    _fusion_shfree( heap, ADDRESS (block + blocks) );
+                    result = ptr;
+               }
+               else if (blocks == heap->heapinfo[block].busy.info.size)
+                    /* No size change necessary.  */
+                    result = ptr;
+               else {
+                    /* Won't fit, so allocate a new region that will.
+                       Free the old region first in case there is sufficient
+                       adjacent free space to grow without moving. */
+                    blocks = heap->heapinfo[block].busy.info.size;
+                    /* Prevent free from actually returning memory to the system.  */
+                    oldlimit = heap->heaplimit;
+                    heap->heaplimit = 0;
+                    _fusion_shfree( heap, ptr );
+                    heap->heaplimit = oldlimit;
+                    result = _fusion_shmalloc( heap, size );
+                    if (result == NULL) {
+                         /* Now we're really in trouble.  We have to unfree
+                            the thing we just freed.  Unfortunately it might
+                            have been coalesced with its neighbors.  */
+                         if (heap->heapindex == block)
+                              (void) _fusion_shmalloc( heap, blocks * BLOCKSIZE );
+                         else {
+                              void *previous = _fusion_shmalloc( heap, (block - heap->heapindex) * BLOCKSIZE );
+                              (void) _fusion_shmalloc( heap, blocks * BLOCKSIZE );
+                              _fusion_shfree( heap, previous );
+                         }
+                         return NULL;
+                    }
+                    if (ptr != result)
+                         direct_memmove (result, ptr, blocks * BLOCKSIZE);
+               }
+               break;
+
+          default:
+               /* Old size is a fragment; type is logarithm
+                  to base two of the fragment size.  */
+               if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type))
+                    /* The new size is the same kind of fragment.  */
+                    result = ptr;
+               else {
+                    /* The new size is different; allocate a new space,
+                       and copy the lesser of the new size and the old. */
+                    result = _fusion_shmalloc( heap, size );
+                    if (result == NULL)
+                         return NULL;
+                    direct_memcpy (result, ptr, MIN (size, (size_t) 1 << type));
+                    _fusion_shfree( heap, ptr );
+               }
+               break;
+     }
+
+     return result;
+}
+
+/* Return memory to the heap. */
+void
+_fusion_shfree( shmalloc_heap *heap, void *ptr )
+{
+     int type;
+     size_t block, blocks;
+     register size_t i;
+     struct list *prev, *next;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %p )\n", __FUNCTION__, heap, ptr );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     if (ptr == NULL)
+          return;
+
+     block = BLOCK (ptr);
+
+     type = heap->heapinfo[block].busy.type;
+     switch (type) {
+          case 0:
+               /* Get as many statistics as early as we can.  */
+               heap->chunks_used--;
+               heap->bytes_used -= heap->heapinfo[block].busy.info.size * BLOCKSIZE;
+               heap->bytes_free += heap->heapinfo[block].busy.info.size * BLOCKSIZE;
+
+               /* Find the free cluster previous to this one in the free list.
+                  Start searching at the last block referenced; this may benefit
+                  programs with locality of allocation.  */
+               i = heap->heapindex;
+               if (i > block)
+                    while (i > block)
+                         i = heap->heapinfo[i].free.prev;
+               else {
+                    do
+                         i = heap->heapinfo[i].free.next;
+                    while (i > 0 && i < block);
+                    i = heap->heapinfo[i].free.prev;
+               }
+
+               /* Determine how to link this block into the free list.  */
+               if (block == i + heap->heapinfo[i].free.size) {
+                    /* Coalesce this block with its predecessor.  */
+                    heap->heapinfo[i].free.size += heap->heapinfo[block].busy.info.size;
+                    block = i;
+               }
+               else {
+                    /* Really link this block back into the free list.  */
+                    heap->heapinfo[block].free.size = heap->heapinfo[block].busy.info.size;
+                    heap->heapinfo[block].free.next = heap->heapinfo[i].free.next;
+                    heap->heapinfo[block].free.prev = i;
+                    heap->heapinfo[i].free.next = block;
+                    heap->heapinfo[heap->heapinfo[block].free.next].free.prev = block;
+                    heap->chunks_free++;
+               }
+
+               /* Now that the block is linked in, see if we can coalesce it
+                  with its successor (by deleting its successor from the list
+                  and adding in its size).  */
+               if (block + heap->heapinfo[block].free.size == heap->heapinfo[block].free.next) {
+                    heap->heapinfo[block].free.size
+                    += heap->heapinfo[heap->heapinfo[block].free.next].free.size;
+                    heap->heapinfo[block].free.next
+                    = heap->heapinfo[heap->heapinfo[block].free.next].free.next;
+                    heap->heapinfo[heap->heapinfo[block].free.next].free.prev = block;
+                    heap->chunks_free--;
+               }
+
+               blocks = heap->heapinfo[block].free.size;
+
+/* FIXME: as this is used when kernel is detected as >= 2.6.19.2 only, this fallback definition should be ok for now */
+#ifndef MADV_REMOVE
+#define MADV_REMOVE 9
+#endif
+               /* Punch a hole into the tmpfs file to really free RAM. */
+               if (fusion_config->madv_remove)
+                    madvise( ADDRESS(block), blocks * BLOCKSIZE, MADV_REMOVE );
+
+               /* Now see if we can truncate the end.  */
+               if (blocks >= FINAL_FREE_BLOCKS && block + blocks == heap->heaplimit
+                   && __shmalloc_brk( heap, 0 ) == ADDRESS (block + blocks))
+               {
+                    register size_t bytes = blocks * BLOCKSIZE;
+                    heap->heaplimit -= blocks;
+                    __shmalloc_brk( heap, -bytes );
+                    heap->heapinfo[heap->heapinfo[block].free.prev].free.next = heap->heapinfo[block].free.next;
+                    heap->heapinfo[heap->heapinfo[block].free.next].free.prev = heap->heapinfo[block].free.prev;
+                    block = heap->heapinfo[block].free.prev;
+                    heap->chunks_free--;
+                    heap->bytes_free -= bytes;
+               }
+
+               /* Set the next search to begin at this block.  */
+               heap->heapindex = block;
+               break;
+
+          default:
+               /* Do some of the statistics.  */
+               heap->chunks_used--;
+               heap->bytes_used -= 1 << type;
+               heap->chunks_free++;
+               heap->bytes_free += 1 << type;
+
+               /* Get the address of the first free fragment in this block.  */
+               prev = (struct list *) ((char *) ADDRESS (block) +
+                                       (heap->heapinfo[block].busy.info.frag.first << type));
+
+#if 1   /* Adapted from Mike */
+               if ((int)heap->heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1
+                   && heap->fragblocks[type] > 1)
+#else
+               if ((int)heap->heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1)
+#endif
+               {
+                    /* If all fragments of this block are free, remove them
+                       from the fragment list and free the whole block.  */
+#if 1   /* Adapted from Mike */
+                    heap->fragblocks[type]--;
+#endif
+                    next = prev;
+                    for (i = 1; i < (size_t) (BLOCKSIZE >> type); ++i)
+                         next = next->next;
+                    prev->prev->next = next;
+                    if (next != NULL)
+                         next->prev = prev->prev;
+                    heap->heapinfo[block].busy.type = 0;
+                    heap->heapinfo[block].busy.info.size = 1;
+
+                    /* Keep the statistics accurate.  */
+                    heap->chunks_used++;
+                    heap->bytes_used += BLOCKSIZE;
+                    heap->chunks_free -= BLOCKSIZE >> type;
+                    heap->bytes_free -= BLOCKSIZE;
+
+                    _fusion_shfree( heap, ADDRESS (block) );
+               }
+               else if (heap->heapinfo[block].busy.info.frag.nfree != 0) {
+                    /* If some fragments of this block are free, link this
+                       fragment into the fragment list after the first free
+                       fragment of this block. */
+                    next = (struct list *) ptr;
+                    next->next = prev->next;
+                    next->prev = prev;
+                    prev->next = next;
+                    if (next->next != NULL)
+                         next->next->prev = next;
+                    heap->heapinfo[block].busy.info.frag.nfree++;
+               }
+               else {
+                    /* No fragments of this block are free, so link this
+                       fragment into the fragment list and announce that
+                       it is the first free fragment of this block. */
+                    prev = (struct list *) ptr;
+                    heap->heapinfo[block].busy.info.frag.nfree = 1;
+                    heap->heapinfo[block].busy.info.frag.first = (unsigned long int)
+                                                                   ((unsigned long int) ((char *) ptr - (char *) NULL)
+                                                                    % BLOCKSIZE >> type);
+                    prev->next = heap->fraghead[type].next;
+                    prev->prev = &heap->fraghead[type];
+                    prev->prev->next = prev;
+                    if (prev->next != NULL)
+                         prev->next->prev = prev;
+               }
+               break;
+     }
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+__shmalloc_init_heap( FusionSHM  *shm,
+                      const char *filename,
+                      void       *addr_base,
+                      int         space,
+                      int        *ret_fd,
+                      int        *ret_size )
+{
+     DirectResult     ret;
+     int              size;
+     FusionSHMShared *shared;
+     int              heapsize = (space + BLOCKSIZE-1) / BLOCKSIZE;
+     int              fd       = -1;
+     shmalloc_heap   *heap     = NULL;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, '%s', %p, %d, %p, %p )\n",
+                 __FUNCTION__, shm, filename, addr_base, space, ret_fd, ret_size );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_ASSERT( filename != NULL );
+     D_ASSERT( addr_base != NULL );
+     D_ASSERT( ret_fd != NULL );
+     D_ASSERT( ret_size != NULL );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+     D_ASSERT( shared->tmpfs[0] != 0 );
+
+     size = BLOCKALIGN(sizeof(shmalloc_heap)) + BLOCKALIGN( heapsize * sizeof(shmalloc_info) );
+
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> opening shared memory file '%s'...\n", filename );
+
+     /* open the virtual file */
+     fd = open( filename, O_RDWR | O_CREAT | O_TRUNC, 0660 );
+     if (fd < 0) {
+          ret = errno2result(errno);
+          D_PERROR( "Fusion/SHM: Could not open shared memory file '%s'!\n", filename );
+          goto error;
+     }
+
+     if (fusion_config->shmfile_gid != (gid_t)-1) {
+          /* chgrp the SH_FILE dev entry */
+          if (fchown( fd, -1, fusion_config->shmfile_gid ) != 0)
+               D_WARN( "Fusion/SHM: Changing owner on %s failed... continuing on.", filename );
+     }
+
+     fchmod( fd, 0660 );
+     ftruncate( fd, size );
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> mmaping shared memory file... (%d bytes)\n", size );
+
+     /* map it shared */
+     heap = mmap( addr_base, size + space, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0 );
+     if (heap == MAP_FAILED) {
+          ret = errno2result(errno);
+          D_PERROR( "Fusion/SHM: Could not mmap shared memory file '%s'!\n", filename );
+          goto error;
+     }
+
+     if (heap != addr_base) {
+          D_ERROR( "Fusion/SHM: mmap() returned address (%p) differs from requested (%p)\n", heap, addr_base );
+          ret = DR_FUSION;
+          goto error;
+     }
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> done.\n" );
+
+     heap->size     = size;
+     heap->heapsize = heapsize;
+     heap->heapinfo = (void*) heap + BLOCKALIGN(sizeof(shmalloc_heap));
+     heap->heapbase = (char*) heap->heapinfo;
+
+     D_MAGIC_SET( heap, shmalloc_heap );
+
+     *ret_fd   = fd;
+     *ret_size = size;
+
+     return DR_OK;
+
+
+error:
+     if (heap)
+          munmap( heap, size );
+
+     if (fd != -1) {
+          close( fd );
+          unlink( filename );
+     }
+
+     return ret;
+}
+
+DirectResult
+__shmalloc_join_heap( FusionSHM  *shm,
+                      const char *filename,
+                      void       *addr_base,
+                      int         size,
+                      int        *ret_fd )
+{
+     DirectResult     ret;
+     FusionSHMShared *shared;
+     int              fd   = -1;
+     shmalloc_heap   *heap = NULL;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, '%s', %p, %d, %p )\n",
+                 __FUNCTION__, shm, filename, addr_base, size, ret_fd );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_ASSERT( filename != NULL );
+     D_ASSERT( addr_base != NULL );
+     D_ASSERT( size >= sizeof(shmalloc_heap) );
+     D_ASSERT( ret_fd != NULL );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+     D_ASSERT( shared->tmpfs[0] != 0 );
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> opening shared memory file '%s'...\n", filename );
+
+     /* open the virtual file */
+     fd = open( filename, O_RDWR );
+     if (fd < 0) {
+          ret = errno2result(errno);
+          D_PERROR( "Fusion/SHM: Could not open shared memory file '%s'!\n", filename );
+          goto error;
+     }
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> mmaping shared memory file... (%d bytes)\n", size );
+
+     /* map it shared */
+     heap = mmap( addr_base, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0 );
+     if (heap == MAP_FAILED) {
+          ret = errno2result(errno);
+          D_PERROR( "Fusion/SHM: Could not mmap shared memory file '%s'!\n", filename );
+          goto error;
+     }
+
+     if (heap != addr_base) {
+          D_ERROR( "Fusion/SHM: mmap() returned address (%p) differs from requested (%p)\n", heap, addr_base );
+          ret = DR_FUSION;
+          goto error;
+     }
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     D_DEBUG_AT( Fusion_SHMHeap, "  -> done.\n" );
+
+     *ret_fd = fd;
+
+     return DR_OK;
+
+
+error:
+     if (heap)
+          munmap( heap, size );
+
+     if (fd != -1)
+          close( fd );
+
+     return ret;
+}
+
+void *
+__shmalloc_brk( shmalloc_heap *heap, int increment )
+{
+     FusionSHMShared     *shm;
+     FusionWorld         *world;
+     FusionSHMPool       *pool;
+     FusionSHMPoolShared *shared;
+
+     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %d )\n", __FUNCTION__, heap, increment );
+
+     D_MAGIC_ASSERT( heap, shmalloc_heap );
+
+     shared = heap->pool;
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+     shm = shared->shm;
+     D_MAGIC_ASSERT( shm, FusionSHMShared );
+
+     world = _fusion_world( shm->world );
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     pool = &world->shm.pools[shared->index];
+     D_MAGIC_ASSERT( pool, FusionSHMPool );
+
+     if (increment) {
+          int new_size = heap->size + increment;
+
+          if (new_size > shared->max_size) {
+               D_WARN( "maximum shared memory size exceeded!" );
+               fusion_dbg_print_memleaks( shared );
+               return NULL;
+          }
+
+          if (ftruncate( pool->fd, new_size ) < 0) {
+               D_PERROR( "Fusion/SHM: ftruncating shared memory file failed!\n" );
+               return NULL;
+          }
+
+          heap->size = new_size;
+     }
+
+     return shared->addr_base + heap->size - increment;
+}
+
diff --git a/Source/DirectFB/lib/fusion/shm/pool.c b/Source/DirectFB/lib/fusion/shm/pool.c
new file mode 100755
index 0000000..030314f
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/pool.c
@@ -0,0 +1,954 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <unistd.h>
+#include <sys/mman.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <fusion/shmalloc.h>
+#include <fusion/fusion_internal.h>
+
+#include <fusion/shm/pool.h>
+#include <fusion/shm/shm_internal.h>
+
+
+D_DEBUG_DOMAIN( Fusion_SHMPool, "Fusion/SHMPool", "Fusion Shared Memory Pool" );
+
+/**********************************************************************************************************************/
+
+static DirectResult init_pool    ( FusionSHM           *shm,
+                                   FusionSHMPool       *pool,
+                                   FusionSHMPoolShared *shared,
+                                   const char          *name,
+                                   unsigned int         max_size,
+                                   bool                 debug );
+
+static DirectResult join_pool    ( FusionSHM           *shm,
+                                   FusionSHMPool       *pool,
+                                   FusionSHMPoolShared *shared );
+
+static void         leave_pool   ( FusionSHM           *shm,
+                                   FusionSHMPool       *pool,
+                                   FusionSHMPoolShared *shared );
+
+static void         shutdown_pool( FusionSHM           *shm,
+                                   FusionSHMPool       *pool,
+                                   FusionSHMPoolShared *shared );
+
+/**********************************************************************************************************************/
+
+DirectResult
+fusion_shm_pool_create( FusionWorld          *world,
+                        const char           *name,
+                        unsigned int          max_size,
+                        bool                  debug,
+                        FusionSHMPoolShared **ret_pool )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+     D_ASSERT( name != NULL );
+     D_ASSERT( max_size > 0 );
+     D_ASSERT( ret_pool != NULL );
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p [%d], '%s', %d, %p, %sdebug )\n", __FUNCTION__,
+                 world, world->shared->world_index, name, max_size, ret_pool, debug ? "" : "non-" );
+
+#if !DIRECT_BUILD_DEBUGS
+     debug = false;
+#endif
+
+     shm = &world->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     if (max_size < 8192) {
+          D_ERROR( "Fusion/SHMPool: Maximum size (%d) should be 8192 at least!\n", max_size );
+          return DR_INVARG;
+     }
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          goto error;
+
+     if (shared->num_pools == FUSION_SHM_MAX_POOLS) {
+          D_ERROR( "Fusion/SHMPool: Maximum number of pools (%d) already reached!\n", FUSION_SHM_MAX_POOLS );
+          ret = DR_LIMITEXCEEDED;
+          goto error;
+     }
+
+     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+          if (!shared->pools[i].active)
+               break;
+
+          D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+          D_MAGIC_ASSUME( &shm->pools[i], FusionSHMPool );
+     }
+
+     D_ASSERT( i < FUSION_SHM_MAX_POOLS );
+
+     D_DEBUG_AT( Fusion_SHMPool, "  -> index %d\n", i );
+
+     memset( &shm->pools[i], 0, sizeof(FusionSHMPool) );
+     memset( &shared->pools[i], 0, sizeof(FusionSHMPoolShared) );
+
+     shared->pools[i].index = i;
+
+     ret = init_pool( shm, &shm->pools[i], &shared->pools[i], name, max_size, debug );
+     if (ret)
+          goto error;
+
+     shared->num_pools++;
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     *ret_pool = &shared->pools[i];
+
+     D_DEBUG_AT( Fusion_SHMPool, "  -> %p\n", *ret_pool );
+
+     return DR_OK;
+
+
+error:
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_shm_pool_destroy( FusionWorld         *world,
+                         FusionSHMPoolShared *pool )
+{
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p )\n", __FUNCTION__, world, pool );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     shm = &world->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     D_ASSERT( shared == pool->shm );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return ret;
+
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return ret;
+     }
+
+     D_ASSERT( pool->active );
+     D_ASSERT( pool->index >= 0 );
+     D_ASSERT( pool->index < FUSION_SHM_MAX_POOLS );
+     D_ASSERT( pool->pool_id == shm->pools[pool->index].pool_id );
+     D_ASSERT( pool == &shared->pools[pool->index] );
+
+     D_MAGIC_ASSERT( &shm->pools[pool->index], FusionSHMPool );
+
+     shutdown_pool( shm, &shm->pools[pool->index], pool );
+
+     shared->num_pools--;
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_attach( FusionSHM           *shm,
+                        FusionSHMPoolShared *pool )
+{
+     DirectResult     ret;
+     FusionSHMShared *shared;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p )\n", __FUNCTION__, shm, pool );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     D_ASSERT( shared == pool->shm );
+
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          return ret;
+     }
+
+     D_ASSERT( pool->active );
+     D_ASSERT( pool->index >= 0 );
+     D_ASSERT( pool->index < FUSION_SHM_MAX_POOLS );
+     D_ASSERT( pool == &shared->pools[pool->index] );
+     D_ASSERT( !shm->pools[pool->index].attached );
+
+     ret = join_pool( shm, &shm->pools[pool->index], pool );
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return ret;
+}
+
+DirectResult
+fusion_shm_pool_detach( FusionSHM           *shm,
+                        FusionSHMPoolShared *pool )
+{
+     DirectResult     ret;
+     FusionSHMShared *shared;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p )\n", __FUNCTION__, shm, pool );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     D_ASSERT( shared == pool->shm );
+
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return ret;
+     }
+
+     D_ASSERT( pool->active );
+     D_ASSERT( pool->index >= 0 );
+     D_ASSERT( pool->index < FUSION_SHM_MAX_POOLS );
+     D_ASSERT( pool->pool_id == shm->pools[pool->index].pool_id );
+     D_ASSERT( pool == &shared->pools[pool->index] );
+     D_ASSERT( shm->pools[pool->index].attached );
+
+     D_MAGIC_ASSERT( &shm->pools[pool->index], FusionSHMPool );
+
+     leave_pool( shm, &shm->pools[pool->index], pool );
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_allocate( FusionSHMPoolShared  *pool,
+                          int                   size,
+                          bool                  clear,
+                          bool                  lock,
+                          void                **ret_data )
+{
+     DirectResult  ret;
+     void         *data;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %d, %sclear, %p )\n", __FUNCTION__,
+                 pool, size, clear ? "" : "un", ret_data );
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_ASSERT( size > 0 );
+     D_ASSERT( ret_data != NULL );
+
+     if (lock) {
+          ret = fusion_skirmish_prevail( &pool->lock );
+          if (ret)
+               return ret;
+     }
+
+     __shmalloc_brk( pool->heap, 0 );
+
+     data = _fusion_shmalloc( pool->heap, size );
+     if (!data) {
+          if (lock)
+               fusion_skirmish_dismiss( &pool->lock );
+          return DR_NOSHAREDMEMORY;
+     }
+
+     if (clear)
+          memset( data, 0, size );
+
+     *ret_data = data;
+
+     if (lock)
+          fusion_skirmish_dismiss( &pool->lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_reallocate( FusionSHMPoolShared  *pool,
+                            void                 *data,
+                            int                   size,
+                            bool                  lock,
+                            void                **ret_data )
+{
+     DirectResult  ret;
+     void         *new_data;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %d, %p )\n",
+                 __FUNCTION__, pool, data, size, ret_data );
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( data >= pool->addr_base );
+     D_ASSERT( data < pool->addr_base + pool->max_size );
+     D_ASSERT( size > 0 );
+     D_ASSERT( ret_data != NULL );
+
+     if (lock) {
+          ret = fusion_skirmish_prevail( &pool->lock );
+          if (ret)
+               return ret;
+     }
+
+     __shmalloc_brk( pool->heap, 0 );
+
+     new_data = _fusion_shrealloc( pool->heap, data, size );
+     if (!new_data) {
+          if (lock)
+               fusion_skirmish_dismiss( &pool->lock );
+          return DR_NOSHAREDMEMORY;
+     }
+
+     *ret_data = new_data;
+
+     if (lock)
+          fusion_skirmish_dismiss( &pool->lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_pool_deallocate( FusionSHMPoolShared *pool,
+                            void                *data,
+                            bool                 lock )
+{
+     DirectResult ret;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p )\n", __FUNCTION__, pool, data );
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( data >= pool->addr_base );
+     D_ASSERT( data < pool->addr_base + pool->max_size );
+
+     if (lock) {
+          ret = fusion_skirmish_prevail( &pool->lock );
+          if (ret)
+               return ret;
+     }
+
+     __shmalloc_brk( pool->heap, 0 );
+
+     _fusion_shfree( pool->heap, data );
+
+     if (lock)
+          fusion_skirmish_dismiss( &pool->lock );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+#if FUSION_BUILD_KERNEL
+
+static DirectResult
+init_pool( FusionSHM           *shm,
+           FusionSHMPool       *pool,
+           FusionSHMPoolShared *shared,
+           const char          *name,
+           unsigned int         max_size,
+           bool                 debug )
+{
+     DirectResult         ret;
+     int                  fd;
+     int                  size;
+     FusionWorld         *world;
+     FusionSHMPoolNew     pool_new    = { .pool_id = 0 };
+     FusionSHMPoolAttach  pool_attach = { .pool_id = 0 };
+     FusionEntryInfo      info;
+     char                 buf[FUSION_SHM_TMPFS_PATH_NAME_LEN + 32];
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p, '%s', %d, %sdebug )\n",
+                 __FUNCTION__, shm, pool, shared, name, max_size, debug ? "" : "non-" );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shm->shared, FusionSHMShared );
+     D_ASSERT( name != NULL );
+     D_ASSERT( max_size > sizeof(shmalloc_heap) );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_ASSERT( pool != NULL );
+     D_ASSERT( shared != NULL );
+
+     /* Fill out information for new pool. */
+     pool_new.max_size = max_size;
+
+     pool_new.max_size += BLOCKALIGN(sizeof(shmalloc_heap)) +
+                          BLOCKALIGN( (max_size + BLOCKSIZE-1) / BLOCKSIZE * sizeof(shmalloc_info) );
+
+     /* Create the new pool. */
+     while (ioctl( world->fusion_fd, FUSION_SHMPOOL_NEW, &pool_new )) {
+          if (errno == EINTR)
+               continue;
+
+          D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_NEW failed!\n" );
+          return DR_FUSION;
+     }
+
+     /* Set the pool info. */
+     info.type = FT_SHMPOOL;
+     info.id   = pool_new.pool_id;
+
+     snprintf( info.name, sizeof(info.name), "%s", name );
+
+     ioctl( world->fusion_fd, FUSION_ENTRY_SET_INFO, &info );
+
+
+     /* Set pool to attach to. */
+     pool_attach.pool_id = pool_new.pool_id;
+
+     /* Attach to the pool. */
+     while (ioctl( world->fusion_fd, FUSION_SHMPOOL_ATTACH, &pool_attach )) {
+          if (errno == EINTR)
+               continue;
+
+          D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_ATTACH failed!\n" );
+
+          while (ioctl( world->fusion_fd, FUSION_SHMPOOL_DESTROY, &shared->pool_id )) {
+               if (errno != EINTR) {
+                    D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_DESTROY failed!\n" );
+                    break;
+               }
+          }
+
+          return DR_FUSION;
+     }
+
+
+     /* Generate filename. */
+     snprintf( buf, sizeof(buf), "%s/fusion.%d.%d", shm->shared->tmpfs,
+               fusion_world_index( shm->world ), pool_new.pool_id );
+
+     /* Initialize the heap. */
+     ret = __shmalloc_init_heap( shm, buf, pool_new.addr_base, max_size, &fd, &size );
+     if (ret) {
+          while (ioctl( world->fusion_fd, FUSION_SHMPOOL_DESTROY, &shared->pool_id )) {
+               if (errno != EINTR) {
+                    D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_DESTROY failed!\n" );
+                    break;
+               }
+          }
+
+          return ret;
+     }
+
+
+     /* Initialize local data. */
+     pool->attached = true;
+     pool->shm      = shm;
+     pool->shared   = shared;
+     pool->pool_id  = pool_new.pool_id;
+     pool->fd       = fd;
+     pool->filename = D_STRDUP( buf );
+
+     /* Initialize shared data. */
+     shared->active     = true;
+     shared->debug      = debug;
+     shared->shm        = shm->shared;
+     shared->max_size   = pool_new.max_size;
+     shared->pool_id    = pool_new.pool_id;
+     shared->addr_base  = pool_new.addr_base;
+     shared->heap       = pool_new.addr_base;
+     shared->heap->pool = shared;
+
+     fusion_skirmish_init( &shared->lock, name, world );
+
+
+     D_MAGIC_SET( pool, FusionSHMPool );
+     D_MAGIC_SET( shared, FusionSHMPoolShared );
+
+
+     shared->name = SHSTRDUP( shared, name );
+
+     return DR_OK;
+}
+
+static DirectResult
+join_pool( FusionSHM           *shm,
+           FusionSHMPool       *pool,
+           FusionSHMPoolShared *shared )
+{
+     DirectResult         ret;
+     int                  fd;
+     FusionWorld         *world;
+     FusionSHMPoolAttach  pool_attach = { .pool_id = 0 };
+     char                 buf[FUSION_SHM_TMPFS_PATH_NAME_LEN + 32];
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shm->shared, FusionSHMShared );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+#if !DIRECT_BUILD_DEBUGS
+     if (shared->debug) {
+          D_ERROR( "Fusion/SHM: Can't join debug enabled pool with pure-release library!\n" );
+          return DR_UNSUPPORTED;
+     }
+#endif
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+
+     /* Set pool to attach to. */
+     pool_attach.pool_id = shared->pool_id;
+
+     /* Attach to the pool. */
+     while (ioctl( world->fusion_fd, FUSION_SHMPOOL_ATTACH, &pool_attach )) {
+          if (errno == EINTR)
+               continue;
+
+          D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_ATTACH failed!\n" );
+          return DR_FUSION;
+     }
+
+
+     /* Generate filename. */
+     snprintf( buf, sizeof(buf), "%s/fusion.%d.%d", shm->shared->tmpfs,
+               fusion_world_index( shm->world ), shared->pool_id );
+
+     /* Join the heap. */
+     ret = __shmalloc_join_heap( shm, buf, pool_attach.addr_base, shared->max_size, &fd );
+     if (ret) {
+          while (ioctl( world->fusion_fd, FUSION_SHMPOOL_DETACH, &shared->pool_id )) {
+               if (errno != EINTR) {
+                    D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_DETACH failed!\n" );
+                    break;
+               }
+          }
+
+          return ret;
+     }
+
+
+     /* Initialize local data. */
+     pool->attached = true;
+     pool->shm      = shm;
+     pool->shared   = shared;
+     pool->pool_id  = shared->pool_id;
+     pool->fd       = fd;
+     pool->filename = D_STRDUP( buf );
+
+
+     D_MAGIC_SET( pool, FusionSHMPool );
+
+     return DR_OK;
+}
+
+static void
+leave_pool( FusionSHM           *shm,
+            FusionSHMPool       *pool,
+            FusionSHMPoolShared *shared )
+{
+     FusionWorld *world;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPool );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     while (ioctl( world->fusion_fd, FUSION_SHMPOOL_DETACH, &shared->pool_id )) {
+          if (errno != EINTR) {
+               D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_DETACH failed!\n" );
+               break;
+          }
+     }
+
+     if (munmap( shared->addr_base, shared->max_size ))
+          D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );
+
+     if (pool->fd != -1 && close( pool->fd ))
+          D_PERROR( "Fusion/SHM: Could not close shared memory file '%s'!\n", pool->filename );
+
+     pool->attached = false;
+
+     D_FREE( pool->filename );
+
+     D_MAGIC_CLEAR( pool );
+}
+
+static void
+shutdown_pool( FusionSHM           *shm,
+               FusionSHMPool       *pool,
+               FusionSHMPoolShared *shared )
+{
+     FusionWorld *world;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPool );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     SHFREE( shared, shared->name );
+
+     fusion_dbg_print_memleaks( shared );
+
+     while (ioctl( world->fusion_fd, FUSION_SHMPOOL_DESTROY, &shared->pool_id )) {
+          if (errno != EINTR) {
+               D_PERROR( "Fusion/SHM: FUSION_SHMPOOL_DESTROY failed!\n" );
+               break;
+          }
+     }
+
+     if (munmap( shared->addr_base, shared->max_size ))
+          D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );
+
+     if (pool->fd != -1 && close( pool->fd ))
+          D_PERROR( "Fusion/SHM: Could not close shared memory file '%s'!\n", pool->filename );
+
+     if (unlink( pool->filename ))
+          D_PERROR( "Fusion/SHM: Could not unlink shared memory file '%s'!\n", pool->filename );
+
+     shared->active = false;
+
+     pool->attached = false;
+
+     D_FREE( pool->filename );
+
+     D_MAGIC_CLEAR( pool );
+
+     fusion_skirmish_destroy( &shared->lock );
+
+     D_MAGIC_CLEAR( shared );
+}
+
+#else /* FUSION_BUILD_KERNEL */
+
+static DirectResult
+init_pool( FusionSHM           *shm,
+           FusionSHMPool       *pool,
+           FusionSHMPoolShared *shared,
+           const char          *name,
+           unsigned int         max_size,
+           bool                 debug )
+{
+     DirectResult   ret;
+     int            fd;
+     int            size;
+     long           page_size;
+     int            pool_id;
+     unsigned int   pool_max_size;
+     void          *pool_addr_base = NULL;
+     FusionWorld   *world;
+     char           buf[FUSION_SHM_TMPFS_PATH_NAME_LEN + 32];
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p, '%s', %d, %sdebug )\n",
+                 __FUNCTION__, shm, pool, shared, name, max_size, debug ? "" : "non-" );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shm->shared, FusionSHMShared );
+     D_ASSERT( name != NULL );
+     D_ASSERT( max_size > sizeof(shmalloc_heap) );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     D_ASSERT( pool != NULL );
+     D_ASSERT( shared != NULL );
+
+     page_size = direct_pagesize();
+
+     pool_id = ++world->shared->pool_ids;
+
+     pool_max_size = max_size + BLOCKALIGN(sizeof(shmalloc_heap)) +
+                                BLOCKALIGN( (max_size + BLOCKSIZE-1) / BLOCKSIZE * sizeof(shmalloc_info) );
+
+     pool_addr_base = world->shared->pool_base;
+     world->shared->pool_base += ((pool_max_size + page_size - 1) & ~(page_size - 1)) + page_size;
+     /* Exceeded limit? */
+     if (world->shared->pool_base > world->shared->pool_max)
+          return DR_NOSHAREDMEMORY;
+
+     /* Generate filename. */
+     snprintf( buf, sizeof(buf), "%s/fusion.%d.%d", shm->shared->tmpfs,
+               fusion_world_index( world ), pool_id );
+
+     /* Initialize the heap. */
+     ret = __shmalloc_init_heap( shm, buf, pool_addr_base, max_size, &fd, &size );
+     if (ret)
+          return ret;
+
+     /* Initialize local data. */
+     pool->attached = true;
+     pool->shm      = shm;
+     pool->shared   = shared;
+     pool->pool_id  = pool_id;
+     pool->fd       = fd;
+     pool->filename = D_STRDUP( buf );
+
+     /* Initialize shared data. */
+     shared->active     = true;
+     shared->debug      = debug;
+     shared->shm        = shm->shared;
+     shared->max_size   = pool_max_size;
+     shared->pool_id    = pool_id;
+     shared->addr_base  = pool_addr_base;
+     shared->heap       = pool_addr_base;
+     shared->heap->pool = shared;
+
+     fusion_skirmish_init( &shared->lock, name, world );
+
+
+     D_MAGIC_SET( pool, FusionSHMPool );
+     D_MAGIC_SET( shared, FusionSHMPoolShared );
+
+
+     shared->name = SHSTRDUP( shared, name );
+
+     return DR_OK;
+}
+
+static DirectResult
+join_pool( FusionSHM           *shm,
+           FusionSHMPool       *pool,
+           FusionSHMPoolShared *shared )
+{
+     DirectResult  ret;
+     int           fd;
+     FusionWorld  *world;
+     char          buf[FUSION_SHM_TMPFS_PATH_NAME_LEN + 32];
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shm->shared, FusionSHMShared );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+#if !DIRECT_BUILD_DEBUGS
+     if (shared->debug) {
+          D_ERROR( "Fusion/SHM: Can't join debug enabled pool with pure-release library!\n" );
+          return DR_UNSUPPORTED;
+     }
+#endif
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     /* Generate filename. */
+     snprintf( buf, sizeof(buf), "%s/fusion.%d.%d", shm->shared->tmpfs,
+               fusion_world_index( shm->world ), shared->pool_id );
+
+     /* Join the heap. */
+     ret = __shmalloc_join_heap( shm, buf, shared->addr_base, shared->max_size, &fd );
+     if (ret)
+          return ret;
+
+     /* Initialize local data. */
+     pool->attached = true;
+     pool->shm      = shm;
+     pool->shared   = shared;
+     pool->pool_id  = shared->pool_id;
+     pool->fd       = fd;
+     pool->filename = D_STRDUP( buf );
+
+
+     D_MAGIC_SET( pool, FusionSHMPool );
+
+     return DR_OK;
+}
+
+static void
+leave_pool( FusionSHM           *shm,
+            FusionSHMPool       *pool,
+            FusionSHMPoolShared *shared )
+{
+     FusionWorld *world;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPool );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     if (munmap( shared->addr_base, shared->max_size ))
+          D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );
+
+     if (pool->fd != -1 && close( pool->fd ))
+          D_PERROR( "Fusion/SHM: Could not close shared memory file '%s'!\n", pool->filename );
+
+     pool->attached = false;
+
+     D_FREE( pool->filename );
+
+     D_MAGIC_CLEAR( pool );
+}
+
+static void
+shutdown_pool( FusionSHM           *shm,
+               FusionSHMPool       *pool,
+               FusionSHMPoolShared *shared )
+{
+     FusionWorld *world;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %p, %p )\n", __FUNCTION__, shm, pool, shared );
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( pool, FusionSHMPool );
+     D_MAGIC_ASSERT( shared, FusionSHMPoolShared );
+
+     world = shm->world;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     SHFREE( shared, shared->name );
+
+     fusion_dbg_print_memleaks( shared );
+
+     if (munmap( shared->addr_base, shared->max_size ))
+          D_PERROR( "Fusion/SHM: Could not munmap shared memory file '%s'!\n", pool->filename );
+
+     if (pool->fd != -1 && close( pool->fd ))
+          D_PERROR( "Fusion/SHM: Could not close shared memory file '%s'!\n", pool->filename );
+
+     if (unlink( pool->filename ))
+          D_PERROR( "Fusion/SHM: Could not unlink shared memory file '%s'!\n", pool->filename );
+
+     shared->active = false;
+
+     pool->attached = false;
+
+     D_FREE( pool->filename );
+
+     D_MAGIC_CLEAR( pool );
+
+     fusion_skirmish_destroy( &shared->lock );
+
+     D_MAGIC_CLEAR( shared );
+}
+
+#endif /* FUSION_BUILD_KERNEL */
+
+/**********************************************************************************************************************/
+
+#if FUSION_BUILD_KERNEL
+void
+_fusion_shmpool_process( FusionWorld          *world,
+                         int                   pool_id,
+                         FusionSHMPoolMessage *msg )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %d, %p )\n", __FUNCTION__, world, pool_id, msg );
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shm = &world->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return;
+
+     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+          if (shm->pools[i].attached) {
+               D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
+
+               if (shm->pools[i].pool_id == pool_id) {
+                    switch (msg->type) {
+                         case FSMT_REMAP:
+                              break;
+
+                         case FSMT_UNMAP:
+                              D_UNIMPLEMENTED();
+                              break;
+                    }
+
+                    break;
+               }
+          }
+     }
+
+     fusion_skirmish_dismiss( &shared->lock );
+}
+#endif /* FUSION_BUILD_KERNEL */
diff --git a/Source/DirectFB/lib/fusion/shm/pool.h b/Source/DirectFB/lib/fusion/shm/pool.h
new file mode 100755
index 0000000..b809a5a
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/pool.h
@@ -0,0 +1,69 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__SHM__POOL_H__
+#define __FUSION__SHM__POOL_H__
+
+#include <fusion/types.h>
+
+
+DirectResult fusion_shm_pool_create    ( FusionWorld          *world,
+                                         const char           *name,
+                                         unsigned int          max_size,
+                                         bool                  debug,
+                                         FusionSHMPoolShared **ret_pool );
+
+DirectResult fusion_shm_pool_destroy   ( FusionWorld          *world,
+                                         FusionSHMPoolShared  *pool );
+
+
+DirectResult fusion_shm_pool_attach    ( FusionSHM            *shm,
+                                         FusionSHMPoolShared  *pool );
+
+DirectResult fusion_shm_pool_detach    ( FusionSHM            *shm,
+                                         FusionSHMPoolShared  *pool );
+
+
+DirectResult fusion_shm_pool_allocate  ( FusionSHMPoolShared  *pool,
+                                         int                   size,
+                                         bool                  clear,
+                                         bool                  lock,
+                                         void                **ret_data );
+
+DirectResult fusion_shm_pool_reallocate( FusionSHMPoolShared  *pool,
+                                         void                 *data,
+                                         int                   size,
+                                         bool                  lock,
+                                         void                **ret_data );
+
+DirectResult fusion_shm_pool_deallocate( FusionSHMPoolShared  *pool,
+                                         void                 *data,
+                                         bool                  lock );
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/shm/shm.c b/Source/DirectFB/lib/fusion/shm/shm.c
new file mode 100755
index 0000000..21c7f42
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/shm.c
@@ -0,0 +1,337 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/vfs.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/signals.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/conf.h>
+#include <fusion/fusion_internal.h>
+
+#include <fusion/shm/pool.h>
+#include <fusion/shm/shm.h>
+#include <fusion/shm/shm_internal.h>
+
+
+/**********************************************************************************************************************/
+
+static int
+find_tmpfs( char *name, int len )
+{
+     int    largest = 0;
+     char   buffer[1024];
+     FILE  *mounts_handle;
+
+     mounts_handle = fopen( "/proc/mounts", "r" );
+     if (!mounts_handle)
+          return 0;
+
+     while (fgets( buffer, sizeof(buffer), mounts_handle )) {
+          char *mount_point;
+          char *mount_fs;
+          char *pointer = buffer;
+
+          strsep( &pointer, " " );
+
+          mount_point = strsep( &pointer, " " );
+          mount_fs = strsep( &pointer, " " );
+
+          if (mount_fs && mount_point && !access( mount_point, W_OK ) && 
+             (!strcmp( mount_fs, "tmpfs" ) || !strcmp( mount_fs, "shmfs" ) || !strcmp( mount_fs, "ramfs" )))
+          {
+               struct statfs stat;
+               int           bytes;
+
+               if (statfs( mount_point, &stat )) {
+                    D_PERROR( "Fusion/SHM: statfs on '%s' failed!\n", mount_point );
+                    continue;
+               }
+
+               bytes = stat.f_blocks * stat.f_bsize;
+
+               if (bytes > largest || (bytes == largest && !strcmp(mount_point,"/dev/shm"))) {
+                    largest = bytes;
+
+                    direct_snputs( name, mount_point, len );
+               }
+          }
+     }
+
+     fclose( mounts_handle );
+
+     return largest;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+fusion_shm_init( FusionWorld *world )
+{
+     int              i;
+     int              num;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+
+     shm    = &world->shm;
+     shared = &world->shared->shm;
+
+     /* Initialize local data. */
+     memset( shm, 0, sizeof(FusionSHM) );
+
+     shm->world  = world;
+     shm->shared = shared;
+
+     /* Initialize shared data. */
+     if (fusion_master( world )) {
+          memset( shared, 0, sizeof(FusionSHMShared) );
+
+          if (fusion_config->tmpfs) {
+               snprintf( shared->tmpfs, FUSION_SHM_TMPFS_PATH_NAME_LEN, fusion_config->tmpfs );
+          }
+          else if (!find_tmpfs( shared->tmpfs, FUSION_SHM_TMPFS_PATH_NAME_LEN )) {
+               D_ERROR( "Fusion/SHM: Could not find tmpfs mount point, falling back to /dev/shm!\n" );
+               snprintf( shared->tmpfs, FUSION_SHM_TMPFS_PATH_NAME_LEN, "/dev/shm" );
+          }
+
+          shared->world = world->shared;
+
+          /* Initialize shared lock. */
+          ret = fusion_skirmish_init( &shared->lock, "Fusion SHM", world );
+          if (ret) {
+               D_DERROR( ret, "Fusion/SHM: Failed to create skirmish!\n" );
+               return ret;
+          }
+
+          /* Initialize static pool array. */
+          for (i=0; i<FUSION_SHM_MAX_POOLS; i++)
+               shared->pools[i].index = i;
+
+          D_MAGIC_SET( shm, FusionSHM );
+          D_MAGIC_SET( shared, FusionSHMShared );
+     }
+     else {
+          D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+          ret = fusion_skirmish_prevail( &shared->lock );
+          if (ret)
+               return ret;
+
+          D_MAGIC_SET( shm, FusionSHM );
+
+          for (i=0, num=0; i<FUSION_SHM_MAX_POOLS; i++) {
+               if (shared->pools[i].active) {
+                    D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+
+                    ret = fusion_shm_pool_attach( shm, &shared->pools[i] );
+                    if (ret) {
+                         for (--i; i>=0; i--) {
+                              if (shared->pools[i].active)
+                                   fusion_shm_pool_detach( shm, &shared->pools[i] );
+                         }
+
+                         fusion_skirmish_dismiss( &shared->lock );
+
+                         D_MAGIC_CLEAR( shm );
+
+                         return ret;
+                    }
+
+                    num++;
+               }
+          }
+
+          D_ASSERT( num == shared->num_pools );
+
+          fusion_skirmish_dismiss( &shared->lock );
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_deinit( FusionWorld *world )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+
+     shm = &world->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+
+     shared = shm->shared;
+
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return ret;
+
+     /* Deinitialize shared data. */
+     if (fusion_master( world )) {
+          D_ASSUME( shared->num_pools == 0 );
+
+          for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+               if (shared->pools[i].active) {
+                    D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+                    D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
+
+                    D_WARN( "destroying remaining '%s'", shared->pools[i].name );
+
+                    fusion_shm_pool_destroy( world, &shared->pools[i] );
+               }
+          }
+
+          /* Destroy shared lock. */
+          fusion_skirmish_destroy( &shared->lock );
+
+          D_MAGIC_CLEAR( shared );
+     }
+     else {
+          for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+               if (shared->pools[i].active) {
+                    D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+                    D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
+
+                    fusion_shm_pool_detach( shm, &shared->pools[i] );
+               }
+          }
+
+          fusion_skirmish_dismiss( &shared->lock );
+     }
+
+     D_MAGIC_CLEAR( shm );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_attach_unattached( FusionWorld *world )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+
+     shm    = &world->shm;
+     shared = &world->shared->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return ret;
+
+     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+          if (!shared->pools[i].active)
+               continue;
+
+          D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+
+          if (!shm->pools[i].attached) {
+               ret = fusion_shm_pool_attach( shm, &shared->pools[i] );
+               if (ret)
+                    D_DERROR( ret, "fusion_shm_pool_attach( '%s' ) failed!\n", shared->pools[i].name );
+          }
+          else
+               D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
+     }
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_shm_enum_pools( FusionWorld           *world,
+                       FusionSHMPoolCallback  callback,
+                       void                  *ctx )
+{
+     int              i;
+     DirectResult     ret;
+     FusionSHM       *shm;
+     FusionSHMShared *shared;
+
+     D_MAGIC_ASSERT( world, FusionWorld );
+     D_MAGIC_ASSERT( world->shared, FusionWorldShared );
+     D_ASSERT( callback != NULL );
+
+     shm    = &world->shm;
+     shared = &world->shared->shm;
+
+     D_MAGIC_ASSERT( shm, FusionSHM );
+     D_MAGIC_ASSERT( shared, FusionSHMShared );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret)
+          return ret;
+
+     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
+          if (!shared->pools[i].active)
+               continue;
+
+          if (!shm->pools[i].attached) {
+               D_BUG( "not attached to pool" );
+               continue;
+          }
+
+          D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );
+          D_MAGIC_ASSERT( &shared->pools[i], FusionSHMPoolShared );
+
+          if (callback( &shm->pools[i], ctx ) == DENUM_CANCEL)
+               break;
+     }
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/fusion/shm/shm.h b/Source/DirectFB/lib/fusion/shm/shm.h
new file mode 100755
index 0000000..6764d17
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/shm.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__SHM__SHM_H__
+#define __FUSION__SHM__SHM_H__
+
+#include <fusion/types.h>
+
+typedef DirectEnumerationResult (*FusionSHMPoolCallback)( FusionSHMPool *pool,
+                                                          void          *ctx );
+
+DirectResult fusion_shm_init  ( FusionWorld *world );
+
+DirectResult fusion_shm_deinit( FusionWorld *world );
+
+DirectResult fusion_shm_attach_unattached( FusionWorld *world );
+
+DirectResult fusion_shm_enum_pools( FusionWorld           *world,
+                                    FusionSHMPoolCallback  callback,
+                                    void                  *ctx );
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/shm/shm_internal.h b/Source/DirectFB/lib/fusion/shm/shm_internal.h
new file mode 100755
index 0000000..3e282a5
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shm/shm_internal.h
@@ -0,0 +1,264 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__SHM__SHM_INTERNAL_H__
+#define __FUSION__SHM__SHM_INTERNAL_H__
+
+#include <limits.h>
+
+#include <direct/list.h>
+
+#include <fusion/build.h>
+#include <fusion/lock.h>
+
+
+#define FUSION_SHM_MAX_POOLS                 24
+#define FUSION_SHM_TMPFS_PATH_NAME_LEN       64
+
+
+typedef struct __shmalloc_heap shmalloc_heap;
+
+
+/*
+ * Local pool data.
+ */
+struct __Fusion_FusionSHMPool {
+     int                  magic;
+
+     bool                 attached;     /* Indicates usage of this entry in the static pool array. */
+
+     FusionSHM           *shm;          /* Back pointer to local SHM data. */
+
+     FusionSHMPoolShared *shared;       /* Pointer to shared pool data. */
+
+     int                  pool_id;      /* The pool's ID within the world. */
+
+     int                  fd;           /* File descriptor of shared memory file. */
+     char                *filename;     /* Name of the shared memory file. */
+};
+
+/*
+ * Shared pool data.
+ */
+struct __Fusion_FusionSHMPoolShared {
+     int                  magic;
+
+     bool                 debug;        /* Debug allocations in this pool? */
+
+     int                  index;        /* Index within the static pool array. */
+     bool                 active;       /* Indicates usage of this entry in the static pool array. */
+
+     FusionSHMShared     *shm;          /* Back pointer to shared SHM data. */
+
+     int                  max_size;     /* Maximum possible size of the shared memory. */
+     int                  pool_id;      /* The pool's ID within the world. */
+     void                *addr_base;    /* Virtual starting address of shared memory. */
+
+     FusionSkirmish       lock;         /* Lock for this pool. */
+
+     shmalloc_heap       *heap;         /* The actual heap information ported from libc5. */
+
+     char                *name;         /* Name of the pool (allocated in the pool). */
+
+     DirectLink          *allocs;       /* Used for debugging. */
+};
+
+
+/*
+ * Local SHM data.
+ */
+struct __Fusion_FusionSHM {
+     int                  magic;
+
+     FusionWorld         *world;        /* Back pointer to local world data. */
+
+     FusionSHMShared     *shared;       /* Pointer to shared SHM data. */
+
+     FusionSHMPool        pools[FUSION_SHM_MAX_POOLS]; /* Local data of all pools. */
+
+     DirectSignalHandler *signal_handler;
+};
+
+/*
+ * Shared SHM data.
+ */
+struct __Fusion_FusionSHMShared {
+     int                  magic;
+
+     FusionWorldShared   *world;        /* Back pointer to shared world data. */
+
+     FusionSkirmish       lock;         /* Lock for list of pools. */
+
+     int                  num_pools;    /* Number of active pools. */
+     FusionSHMPoolShared  pools[FUSION_SHM_MAX_POOLS]; /* Shared data of all pools. */
+
+     char                 tmpfs[FUSION_SHM_TMPFS_PATH_NAME_LEN];
+};
+
+
+
+/* The allocator divides the heap into blocks of fixed size; large
+   requests receive one or more whole blocks, and small requests
+   receive a fragment of a block.  Fragment sizes are powers of two,
+   and all fragments of a block are the same size.  When all the
+   fragments in a block have been freed, the block itself is freed.  */
+#define INT_BIT          (CHAR_BIT * sizeof(int))
+#define BLOCKLOG         (INT_BIT > 16 ? 12 : 9)
+#define BLOCKSIZE        (1 << BLOCKLOG)
+#define BLOCKIFY(SIZE)   (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE)
+#define BLOCKALIGN(SIZE) (((SIZE) + BLOCKSIZE - 1) & ~(BLOCKSIZE - 1))
+
+/* Number of contiguous free blocks allowed to build up at the end of
+   memory before they will be returned to the system.  */
+#define FINAL_FREE_BLOCKS       8
+
+/* Address to block number and vice versa.  */
+#define BLOCK(A)        (((char *) (A) - heap->heapbase) / BLOCKSIZE + 1)
+#define ADDRESS(B)      ((void *) (((B) - 1) * BLOCKSIZE + heap->heapbase))
+
+
+/* Data structure giving per-block information.  */
+typedef union {
+
+     /* Heap information for a busy block.  */
+     struct {
+
+          /* Zero for a large block, or positive giving the
+             logarithm to the base two of the fragment size.  */
+          int type;
+
+          union {
+               struct {
+                    size_t nfree;   /* Free fragments in a fragmented block.  */
+                    size_t first;   /* First free fragment of the block.  */
+               } frag;
+
+               /* Size (in blocks) of a large cluster.  */
+               size_t size;
+          } info;
+     } busy;
+
+     /* Heap information for a free block
+        (that may be the first of a free cluster).  */
+     struct {
+          size_t size;                /* Size (in blocks) of a free cluster.  */
+          size_t next;                /* Index of next free cluster.  */
+          size_t prev;                /* Index of previous free cluster.  */
+     } free;
+} shmalloc_info;
+
+/* Doubly linked lists of free fragments.  */
+struct list {
+     struct list *next;
+     struct list *prev;
+};
+
+
+#define SHMEMDESC_FUNC_NAME_LENGTH 48
+#define SHMEMDESC_FILE_NAME_LENGTH 24
+
+/* Used for debugging. */
+typedef struct {
+     DirectLink    link;
+
+     const void   *mem;
+     size_t        bytes;
+     char          func[SHMEMDESC_FUNC_NAME_LENGTH];
+     char          file[SHMEMDESC_FILE_NAME_LENGTH];
+     unsigned int  line;
+
+     FusionID      fid;
+} SHMemDesc;
+
+
+struct __shmalloc_heap {
+     int magic;
+
+     /* Pointer to first block of the heap.  */
+     char *heapbase;
+
+     /* Block information table indexed by block number giving per-block information. */
+     shmalloc_info *heapinfo;
+
+     /* Number of info entries.  */
+     size_t heapsize;
+
+     /* Current search index for the heap table.  */
+     size_t heapindex;
+
+     /* Limit of valid info table indices.  */
+     size_t heaplimit;
+
+#if 1   /* Adapted from Mike */
+     /* Count of large blocks allocated for each fragment size. */
+     int fragblocks[BLOCKLOG];
+#endif
+
+     /* Free list headers for each fragment size.  */
+     struct list fraghead[BLOCKLOG];
+
+     /* Instrumentation.  */
+     size_t chunks_used;
+     size_t bytes_used;
+     size_t chunks_free;
+     size_t bytes_free;
+
+     /* Total size of heap in bytes. */
+     int size;
+
+     /* Back pointer to shared memory pool. */
+     FusionSHMPoolShared *pool;
+};
+
+
+void *_fusion_shmalloc (shmalloc_heap *heap, size_t __size);
+
+void *_fusion_shrealloc (shmalloc_heap *heap, void *__ptr, size_t __size);
+
+void  _fusion_shfree (shmalloc_heap *heap, void *__ptr);
+
+
+DirectResult __shmalloc_init_heap( FusionSHM     *shm,
+                                   const char    *filename,
+                                   void          *addr_base,
+                                   int            space,
+                                   int           *ret_fd,
+                                   int           *ret_size );
+
+DirectResult __shmalloc_join_heap( FusionSHM     *shm,
+                                   const char    *filename,
+                                   void          *addr_base,
+                                   int            size,
+                                   int           *ret_fd );
+
+void        *__shmalloc_brk      ( shmalloc_heap *heap,
+                                   int            increment );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/shmalloc.c b/Source/DirectFB/lib/fusion/shmalloc.c
new file mode 100755
index 0000000..5fd3408
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shmalloc.c
@@ -0,0 +1,679 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <direct/build.h>
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <fusion/build.h>
+#include <fusion/shmalloc.h>
+
+#include <fusion/fusion_internal.h>
+#include <fusion/shm/shm_internal.h>
+
+
+#if FUSION_BUILD_MULTI
+
+/*************************** MULTI APPLICATION CORE ***************************/
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+D_DEBUG_DOMAIN( Fusion_SHM, "Fusion/SHM", "Fusion Shared Memory" );
+
+void
+fusion_dbg_print_memleaks( FusionSHMPoolShared *pool )
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+     unsigned int  total = 0;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return;
+     }
+
+     if (pool->allocs) {
+          direct_log_printf( NULL, "\nShared memory allocations remaining (%d) in '%s': \n",
+                             direct_list_count_elements_EXPENSIVE( pool->allocs ), pool->name );
+
+          direct_list_foreach (desc, pool->allocs) {
+               direct_log_printf( NULL, " %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u)\n",
+                                  desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                                  desc->func, desc->fid, desc->file, desc->line );
+
+               total += desc->bytes;
+          }
+
+          direct_log_printf( NULL, "   -------\n  %7dk total\n", total >> 10 );
+          direct_log_printf( NULL, "\nShared memory file size: %dk\n", pool->heap->size >> 10 );
+     }
+
+     fusion_skirmish_dismiss( &pool->lock );
+}
+
+static SHMemDesc *
+fill_shmem_desc( SHMemDesc *desc, int bytes, const char *func, const char *file, int line, FusionID fusion_id )
+{
+     D_ASSERT( desc != NULL );
+
+     desc->mem   = desc + 1;
+     desc->bytes = bytes;
+
+     snprintf( desc->func, SHMEMDESC_FUNC_NAME_LENGTH, func );
+     snprintf( desc->file, SHMEMDESC_FILE_NAME_LENGTH, file );
+
+     desc->line = line;
+     desc->fid  = fusion_id;
+
+     return desc;
+}
+
+/* Allocate SIZE bytes of memory.  */
+void *
+fusion_dbg_shmalloc( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, size_t __size )
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+     void         *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( file != NULL );
+     D_ASSERT( line > 0 );
+     D_ASSERT( func != NULL );
+     D_ASSERT( __size > 0 );
+
+     if (!pool->debug)
+          return fusion_shmalloc( pool, __size );
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return NULL;
+     }
+
+     /* Allocate memory from the pool. */
+     ret = fusion_shm_pool_allocate( pool, __size + sizeof(SHMemDesc), false, false, &data );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not allocate %zu bytes from pool!\n", __size + sizeof(SHMemDesc) );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Fill description. */
+     desc = fill_shmem_desc( data, __size, func, file, line, _fusion_id(pool->shm->world) );
+
+     D_DEBUG_AT( Fusion_SHM, "allocating %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u)\n",
+                 desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                 desc->func, desc->fid, desc->file, desc->line );
+
+     /* Add description to list. */
+     direct_list_append( &pool->allocs, &desc->link );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return data + sizeof(SHMemDesc);
+}
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+void *
+fusion_dbg_shcalloc( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, size_t __nmemb, size_t __size)
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+     void         *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( file != NULL );
+     D_ASSERT( line > 0 );
+     D_ASSERT( func != NULL );
+     D_ASSERT( __nmemb > 0 );
+     D_ASSERT( __size > 0 );
+
+     if (!pool->debug)
+          return fusion_shcalloc( pool, __nmemb, __size );
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return NULL;
+     }
+
+     /* Allocate memory from the pool. */
+     ret = fusion_shm_pool_allocate( pool, __nmemb * __size + sizeof(SHMemDesc), true, false, &data );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not allocate %zu bytes from pool!\n", __nmemb * __size + sizeof(SHMemDesc) );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Fill description. */
+     desc = fill_shmem_desc( data, __nmemb * __size, func, file, line, _fusion_id(pool->shm->world) );
+
+     D_DEBUG_AT( Fusion_SHM, "allocating %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u)\n",
+                 desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                 desc->func, desc->fid, desc->file, desc->line );
+
+     /* Add description to list. */
+     direct_list_append( &pool->allocs, &desc->link );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return data + sizeof(SHMemDesc);
+}
+
+/* Re-allocate the previously allocated block
+   in __ptr, making the new block SIZE bytes long.  */
+void *
+fusion_dbg_shrealloc( FusionSHMPoolShared *pool,
+                      const char *file, int line,
+                      const char *func, const char *what, void *__ptr,
+                      size_t __size )
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+     void         *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( file != NULL );
+     D_ASSERT( line > 0 );
+     D_ASSERT( func != NULL );
+     D_ASSERT( what != NULL );
+
+     if (!pool->debug)
+          return fusion_shrealloc( pool, __ptr, __size );
+
+     if (!__ptr)
+          return fusion_dbg_shmalloc( pool, file, line, func, __size );
+
+     if (!__size) {
+          fusion_dbg_shfree( pool, file, line, func, what, __ptr );
+          return NULL;
+     }
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return NULL;
+     }
+
+     /* Lookup the corresponding description. */
+     direct_list_foreach (desc, pool->allocs) {
+          if (desc->mem == __ptr)
+               break;
+     }
+
+     if (!desc) {
+          D_ERROR( "Fusion/SHM: Cannot reallocate unknown chunk at %p (%s) from [%s:%d in %s()]!\n",
+                   __ptr, what, file, line, func );
+          D_BREAK( "unknown chunk" );
+          return NULL; /* shouldn't happen due to the break */
+     }
+
+     /* Remove the description in case the block moves. */
+     direct_list_remove( &pool->allocs, &desc->link );
+
+     /* Reallocate the memory block. */
+     ret = fusion_shm_pool_reallocate( pool, __ptr - sizeof(SHMemDesc), __size + sizeof(SHMemDesc), false, &data );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not reallocate from %zu to %zu bytes!\n",
+                    desc->bytes + sizeof(SHMemDesc), __size + sizeof(SHMemDesc) );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Fill description. */
+     desc = fill_shmem_desc( data, __size, func, file, line, _fusion_id(pool->shm->world) );
+
+     D_DEBUG_AT( Fusion_SHM, "reallocating %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u) '%s'\n",
+                 desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                 desc->func, desc->fid, desc->file, desc->line, what );
+
+     /* Add description to list. */
+     direct_list_append( &pool->allocs, &desc->link );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return data + sizeof(SHMemDesc);
+}
+
+/* Free a block allocated by `shmalloc', `shrealloc' or `shcalloc'.  */
+void
+fusion_dbg_shfree( FusionSHMPoolShared *pool,
+                   const char *file, int line,
+                   const char *func, const char *what, void *__ptr )
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( file != NULL );
+     D_ASSERT( line > 0 );
+     D_ASSERT( func != NULL );
+     D_ASSERT( what != NULL );
+     D_ASSERT( __ptr != NULL );
+
+     if (!pool->debug)
+          return fusion_shfree( pool, __ptr );
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return;
+     }
+
+     /* Lookup the corresponding description. */
+     direct_list_foreach (desc, pool->allocs) {
+          if (desc->mem == __ptr)
+               break;
+     }
+
+     if (!desc) {
+          D_ERROR( "Fusion/SHM: Cannot free unknown chunk at %p (%s) from [%s:%d in %s()]!\n",
+                   __ptr, what, file, line, func );
+          D_BREAK( "unknown chunk" );
+          return; /* shouldn't happen due to the break */
+     }
+
+     D_DEBUG_AT( Fusion_SHM, "freeing %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u) '%s'\n",
+                 desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                 desc->func, desc->fid, desc->file, desc->line, what );
+
+     /* Remove the description. */
+     direct_list_remove( &pool->allocs, &desc->link );
+
+     /* Free the memory block. */
+     fusion_shm_pool_deallocate( pool, __ptr - sizeof(SHMemDesc), false );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+}
+
+/* Duplicate string in shared memory. */
+char *
+fusion_dbg_shstrdup( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, const char *string )
+{
+     DirectResult  ret;
+     SHMemDesc    *desc;
+     void         *data = NULL;
+     int           length;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( file != NULL );
+     D_ASSERT( line > 0 );
+     D_ASSERT( func != NULL );
+     D_ASSERT( string != NULL );
+
+     if (!pool->debug)
+          return fusion_shstrdup( pool, string );
+
+     length = strlen( string ) + 1;
+
+     /* Lock the pool. */
+     ret = fusion_skirmish_prevail( &pool->lock );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not lock shared memory pool!\n" );
+          return NULL;
+     }
+
+     /* Allocate memory from the pool. */
+     ret = fusion_shm_pool_allocate( pool, length + sizeof(SHMemDesc), false, false, &data );
+     if (ret) {
+          D_DERROR( ret, "Fusion/SHM: Could not allocate %zu bytes from pool!\n", length + sizeof(SHMemDesc) );
+          fusion_skirmish_dismiss( &pool->lock );
+          return NULL;
+     }
+
+     /* Fill description. */
+     desc = fill_shmem_desc( data, length, func, file, line, _fusion_id(pool->shm->world) );
+
+     D_DEBUG_AT( Fusion_SHM, "allocating %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u) <- \"%s\"\n",
+                 desc->bytes, desc->mem, (ulong)desc->mem - (ulong)pool->heap,
+                 desc->func, desc->fid, desc->file, desc->line, string );
+
+     D_DEBUG_AT( Fusion_SHM, "  -> allocs: %p\n", pool->allocs );
+
+     /* Add description to list. */
+     direct_list_append( &pool->allocs, &desc->link );
+
+     /* Unlock the pool. */
+     fusion_skirmish_dismiss( &pool->lock );
+
+     /* Copy string content. */
+     direct_memcpy( data + sizeof(SHMemDesc), string, length );
+
+     return data + sizeof(SHMemDesc);
+}
+
+#else
+
+void
+fusion_dbg_print_memleaks( FusionSHMPoolShared *pool )
+{
+}
+
+#endif
+
+/**********************************************************************************************************************/
+
+/* Allocate SIZE bytes of memory.  */
+void *
+fusion_shmalloc( FusionSHMPoolShared *pool, size_t __size )
+{
+     void *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     if (fusion_shm_pool_allocate( pool, __size, false, true, &data ))
+          return NULL;
+
+     D_ASSERT( data != NULL );
+
+     return data;
+}
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+void *
+fusion_shcalloc( FusionSHMPoolShared *pool, size_t __nmemb, size_t __size )
+{
+     void *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __nmemb > 0 );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     if (fusion_shm_pool_allocate( pool, __nmemb * __size, true, true, &data ))
+          return NULL;
+
+     D_ASSERT( data != NULL );
+
+     return data;
+}
+
+/* Re-allocate the previously allocated block
+   in __ptr, making the new block SIZE bytes long.  */
+void *
+fusion_shrealloc( FusionSHMPoolShared *pool, void *__ptr, size_t __size )
+{
+     void *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     if (!__ptr)
+          return fusion_shmalloc( pool, __size );
+
+     if (!__size) {
+          fusion_shfree( pool, __ptr );
+          return NULL;
+     }
+
+     if (fusion_shm_pool_reallocate( pool, __ptr, __size, true, &data ))
+          return NULL;
+
+     D_ASSERT( data != NULL || __size == 0 );
+
+     return data;
+}
+
+/* Free a block allocated by `shmalloc', `shrealloc' or `shcalloc'.  */
+void
+fusion_shfree( FusionSHMPoolShared *pool, void *__ptr )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __ptr != NULL );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     fusion_shm_pool_deallocate( pool, __ptr, true );
+}
+
+/* Duplicate string in shared memory. */
+char *
+fusion_shstrdup( FusionSHMPoolShared *pool, const char* string )
+{
+     int   len;
+     void *data = NULL;
+
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( string != NULL );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     len = strlen( string ) + 1;
+
+     if (fusion_shm_pool_allocate( pool, len, false, true, &data ))
+          return NULL;
+
+     D_ASSERT( data != NULL );
+
+     direct_memcpy( data, string, len );
+
+     return data;
+}
+
+#else
+
+/************************** SINGLE APPLICATION CORE ***************************/
+
+#include <direct/mem.h>
+
+void
+fusion_dbg_print_memleaks( FusionSHMPoolShared *pool )
+{
+}
+
+#if DIRECT_BUILD_DEBUGS  /* Build with debug support? */
+
+/* Allocate SIZE bytes of memory.  */
+void *
+fusion_dbg_shmalloc( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, size_t __size )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          return direct_malloc( file, line, func, __size );
+
+     return malloc( __size );
+}
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+void *
+fusion_dbg_shcalloc( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, size_t __nmemb, size_t __size)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __nmemb > 0 );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          return direct_calloc( file, line, func, __nmemb, __size );
+
+     return calloc( __nmemb, __size );
+}
+
+/* Re-allocate the previously allocated block
+   in __ptr, making the new block SIZE bytes long.  */
+void *
+fusion_dbg_shrealloc( FusionSHMPoolShared *pool,
+                      const char *file, int line,
+                      const char *func, const char *what, void *__ptr,
+                      size_t __size )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     if (pool->debug)
+          return direct_realloc( file, line, func, what, __ptr, __size );
+
+     return realloc( __ptr, __size );
+}
+
+/* Free a block allocated by `shmalloc', `shrealloc' or `shcalloc'.  */
+void
+fusion_dbg_shfree( FusionSHMPoolShared *pool,
+                   const char *file, int line,
+                   const char *func, const char *what, void *__ptr )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __ptr != NULL );
+
+     if (pool->debug)
+          direct_free( file, line, func, what, __ptr );
+     else
+          free( __ptr );
+}
+
+/* Duplicate string in shared memory. */
+char *
+fusion_dbg_shstrdup( FusionSHMPoolShared *pool,
+                     const char *file, int line,
+                     const char *func, const char *string )
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( string != NULL );
+
+     if (pool->debug)
+          return direct_strdup( file, line, func, string );
+
+     return strdup( string );
+}
+
+#endif
+
+/**********************************************************************************************************************/
+
+/* Allocate SIZE bytes of memory.  */
+void *
+fusion_shmalloc (FusionSHMPoolShared *pool,
+                 size_t __size)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     return malloc( __size );
+}
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+void *
+fusion_shcalloc (FusionSHMPoolShared *pool,
+                 size_t __nmemb, size_t __size)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __nmemb > 0 );
+     D_ASSERT( __size > 0 );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     return calloc( __nmemb, __size );
+}
+
+/* Re-allocate the previously allocated block
+   in __ptr, making the new block SIZE bytes long.  */
+void *
+fusion_shrealloc (FusionSHMPoolShared *pool,
+                  void *__ptr, size_t __size)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     return realloc( __ptr, __size );
+}
+
+/* Free a block allocated by `shmalloc', `shrealloc' or `shcalloc'.  */
+void
+fusion_shfree (FusionSHMPoolShared *pool,
+               void *__ptr)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( __ptr != NULL );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     free( __ptr );
+}
+
+/* Duplicate string in shared memory. */
+char *
+fusion_shstrdup (FusionSHMPoolShared *pool,
+                 const char          *string)
+{
+     D_MAGIC_ASSERT( pool, FusionSHMPoolShared );
+     D_ASSERT( string != NULL );
+
+     if (pool->debug)
+          D_WARN( "Fusion/SHMMalloc: Pool runs in debug mode, but access from pure-release is attempted!\n" );
+
+     return strdup( string );
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/shmalloc.h b/Source/DirectFB/lib/fusion/shmalloc.h
new file mode 100755
index 0000000..4b8c8d3
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/shmalloc.h
@@ -0,0 +1,124 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Fusion shmalloc is based on GNU malloc. Please see below.
+
+   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 __FUSION__SHMALLOC_H__
+#define __FUSION__SHMALLOC_H__
+
+#include <stddef.h>
+
+#include <direct/build.h>
+#include <fusion/build.h>
+
+#include <fusion/types.h>
+#include <fusion/shm/pool.h>
+
+
+#if FUSION_BUILD_MULTI && DIRECT_BUILD_TEXT
+#define D_OOSHM()        (direct_messages_warn( __FUNCTION__, __FILE__, __LINE__,              \
+                                                "out of shared memory" ), DR_NOSHAREDMEMORY)
+#else
+#define D_OOSHM()        D_OOM()
+#endif
+
+
+
+void  fusion_dbg_print_memleaks( FusionSHMPoolShared *pool );
+
+
+void *fusion_dbg_shmalloc ( FusionSHMPoolShared *pool,
+                            const char *file, int line,
+                            const char *func, size_t __size );
+
+void *fusion_dbg_shcalloc ( FusionSHMPoolShared *pool,
+                            const char *file, int line,
+                            const char *func, size_t __nmemb, size_t __size);
+
+void *fusion_dbg_shrealloc( FusionSHMPoolShared *pool,
+                            const char *file, int line,
+                            const char *func, const char *what, void *__ptr,
+                            size_t __size );
+
+void  fusion_dbg_shfree   ( FusionSHMPoolShared *pool,
+                            const char *file, int line,
+                            const char *func, const char *what, void *__ptr );
+
+char *fusion_dbg_shstrdup ( FusionSHMPoolShared *pool,
+                            const char *file, int line,
+                            const char *func, const char *string );
+
+
+/* Allocate SIZE bytes of memory.  */
+void *fusion_shmalloc (FusionSHMPoolShared *pool, size_t __size);
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+void *fusion_shcalloc (FusionSHMPoolShared *pool, size_t __nmemb, size_t __size);
+
+/* Re-allocate the previously allocated block
+   in __ptr, making the new block SIZE bytes long.  */
+void *fusion_shrealloc (FusionSHMPoolShared *pool, void *__ptr, size_t __size);
+
+/* Free a block allocated by `shmalloc', `shrealloc' or `shcalloc'.  */
+void  fusion_shfree (FusionSHMPoolShared *pool, void *__ptr);
+
+/* Duplicate string in shared memory. */
+char *fusion_shstrdup (FusionSHMPoolShared *pool, const char *string);
+
+
+
+#if DIRECT_BUILD_DEBUGS || DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
+
+#if !DIRECT_BUILD_DEBUGS
+#warning Building with debug, but library headers suggest that debug is not supported.
+#endif
+
+
+#define SHMALLOC(pool,bytes)        fusion_dbg_shmalloc( pool, __FILE__, __LINE__, __FUNCTION__, bytes )
+#define SHCALLOC(pool,count,bytes)  fusion_dbg_shcalloc( pool, __FILE__, __LINE__, __FUNCTION__, count, bytes )
+#define SHREALLOC(pool,mem,bytes)   fusion_dbg_shrealloc( pool, __FILE__, __LINE__, __FUNCTION__, #mem, mem, bytes )
+#define SHFREE(pool,mem)            fusion_dbg_shfree( pool, __FILE__, __LINE__, __FUNCTION__, #mem,mem )
+#define SHSTRDUP(pool,string)       fusion_dbg_shstrdup( pool, __FILE__, __LINE__, __FUNCTION__, string )
+
+
+#else
+
+
+#define SHMALLOC   fusion_shmalloc
+#define SHCALLOC   fusion_shcalloc
+#define SHREALLOC  fusion_shrealloc
+#define SHFREE     fusion_shfree
+#define SHSTRDUP   fusion_shstrdup
+
+
+#endif
+
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/types.h b/Source/DirectFB/lib/fusion/types.h
new file mode 100755
index 0000000..bb5967f
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/types.h
@@ -0,0 +1,87 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__TYPES_H__
+#define __FUSION__TYPES_H__
+
+#include <fusion/build.h>
+
+#if FUSION_BUILD_MULTI && FUSION_BUILD_KERNEL
+
+#include <linux/fusion.h>
+
+#define FUSION_API_MAJOR_REQUIRED 8
+#define FUSION_API_MINOR_REQUIRED 0
+
+#if FUSION_API_MAJOR_REQUIRED > FUSION_API_MAJOR_PROVIDED
+#error Major version of Fusion Kernel Module too low! Upgrade your kernel.
+#else
+#if FUSION_API_MAJOR_REQUIRED == FUSION_API_MAJOR_PROVIDED
+#if FUSION_API_MINOR_REQUIRED > FUSION_API_MINOR_PROVIDED
+#error Minor version of Fusion Kernel Module too low! Upgrade your kernel.
+#endif
+#endif
+#endif
+
+#else
+typedef unsigned long FusionID;
+
+#define FUSION_ID_MASTER 1L
+
+typedef enum {
+     FCEF_NONE     = 0x00000000,
+     FCEF_ONEWAY   = 0x00000001,
+     FCEF_ALL      = 0x00000001
+} FusionCallExecFlags;
+
+#endif
+
+#define FCEF_NODIRECT 0x80000000
+
+#include <direct/types.h>
+
+
+typedef struct __Fusion_FusionConfig         FusionConfig;
+
+typedef struct __Fusion_FusionArena          FusionArena;
+typedef struct __Fusion_FusionReactor        FusionReactor;
+typedef struct __Fusion_FusionWorld          FusionWorld;
+typedef struct __Fusion_FusionWorldShared    FusionWorldShared;
+
+typedef struct __Fusion_FusionObject         FusionObject;
+typedef struct __Fusion_FusionObjectPool     FusionObjectPool;
+
+typedef struct __Fusion_FusionSHM            FusionSHM;
+typedef struct __Fusion_FusionSHMShared      FusionSHMShared;
+
+typedef struct __Fusion_FusionSHMPool        FusionSHMPool;
+typedef struct __Fusion_FusionSHMPoolShared  FusionSHMPoolShared;
+typedef struct __Fusion_FusionHash           FusionHash;
+
+#endif
+
diff --git a/Source/DirectFB/lib/fusion/vector.c b/Source/DirectFB/lib/fusion/vector.c
new file mode 100755
index 0000000..aa8a4a0
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/vector.c
@@ -0,0 +1,230 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+
+#include <fusion/object.h>
+#include <fusion/shmalloc.h>
+#include <fusion/vector.h>
+
+
+static inline bool ensure_capacity( FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( vector->capacity > 0 );
+
+     if (!vector->elements) {
+          if (vector->pool)
+               vector->elements = SHMALLOC( vector->pool, vector->capacity * sizeof(void*) );
+          else
+               vector->elements = D_MALLOC( vector->capacity * sizeof(void*) );
+
+          if (!vector->elements)
+               return false;
+     }
+     else if (vector->count == vector->capacity) {
+          void *elements;
+          void *oldelements = vector->elements;
+          int   capacity    = vector->capacity << 1;
+
+          if (vector->pool)
+               elements = SHMALLOC( vector->pool, capacity * sizeof(void*) );
+          else
+               elements = D_MALLOC( capacity * sizeof(void*) );
+
+          if (!elements)
+               return false;
+
+          direct_memcpy( elements, vector->elements,
+                         vector->count * sizeof(void*) );
+
+          vector->elements = elements;
+          vector->capacity = capacity;
+
+          if (vector->pool)
+               SHFREE( vector->pool, oldelements );
+          else
+               D_FREE( oldelements );
+     }
+
+     return true;
+}
+
+void
+fusion_vector_init( FusionVector        *vector,
+                    int                  capacity,
+                    FusionSHMPoolShared *pool )
+{
+     D_ASSERT( vector != NULL );
+     D_ASSERT( capacity > 0 );
+
+     vector->elements = NULL;
+     vector->count    = 0;
+     vector->capacity = capacity;
+     vector->pool     = pool;
+
+     D_MAGIC_SET( vector, FusionVector );
+}
+
+void
+fusion_vector_destroy( FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( vector->count == 0 || vector->elements != NULL );
+
+     if (vector->elements) {
+          if (vector->pool)
+               SHFREE( vector->pool, vector->elements );
+          else
+               D_FREE( vector->elements );
+
+          vector->elements = NULL;
+     }
+
+     D_MAGIC_CLEAR( vector );
+}
+
+DirectResult
+fusion_vector_add( FusionVector *vector,
+                   void         *element )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( element != NULL );
+
+     /* Make sure there's a free entry left. */
+     if (!ensure_capacity( vector ))
+          return D_OOSHM();
+
+     /* Add the element to the vector. */
+     vector->elements[vector->count++] = element;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_vector_insert( FusionVector *vector,
+                      void         *element,
+                      int           index )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( element != NULL );
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index <= vector->count );
+
+     /* Make sure there's a free entry left. */
+     if (!ensure_capacity( vector ))
+          return D_OOSHM();
+
+     /* Move elements from insertion point one up. */
+     memmove( &vector->elements[ index + 1 ],
+              &vector->elements[ index ],
+              (vector->count - index) * sizeof(void*) );
+
+     /* Insert the element into the vector. */
+     vector->elements[index] = element;
+
+     /* Increase the element counter. */
+     vector->count++;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_vector_move( FusionVector *vector,
+                    int           from,
+                    int           to )
+{
+     void *element;
+
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( from >= 0 );
+     D_ASSERT( from < vector->count );
+     D_ASSERT( to >= 0 );
+     D_ASSERT( to < vector->count );
+
+     if (to == from)
+          return DR_OK;
+
+     /* Save the element. */
+     element = vector->elements[from];
+
+     /* Move elements that lie on the way to the new position. */
+     if (to > from) {
+          /* Element is moving up -> move other elements down. */
+          memmove( &vector->elements[ from ],
+                   &vector->elements[ from + 1 ],
+                   (to - from) * sizeof(void*) );
+     }
+     else {
+          /* Element is moving down -> move other elements up. */
+          memmove( &vector->elements[ to + 1 ],
+                   &vector->elements[ to ],
+                   (from - to) * sizeof(void*) );
+     }
+
+     /* Restore the element at the new position. */
+     vector->elements[to] = element;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_vector_remove( FusionVector *vector,
+                      int           index )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < vector->count );
+
+     /* Move elements after this element one down. */
+     memmove( &vector->elements[ index ],
+              &vector->elements[ index + 1 ],
+              (vector->count - index - 1) * sizeof(void*) );
+
+     /* Decrease the element counter. */
+     vector->count--;
+
+     return DR_OK;
+}
+
+DirectResult
+fusion_vector_remove_last( FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( vector->count > 0 );
+
+     /* Decrease the element counter. */
+     vector->count--;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/fusion/vector.h b/Source/DirectFB/lib/fusion/vector.h
new file mode 100755
index 0000000..e978ce9
--- /dev/null
+++ b/Source/DirectFB/lib/fusion/vector.h
@@ -0,0 +1,164 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FUSION__VECTOR_H__
+#define __FUSION__VECTOR_H__
+
+#include <limits.h>
+
+#include <fusion/types.h>
+
+#include <direct/debug.h>
+
+typedef struct {
+     int    magic;
+
+     void **elements;
+     int    count;
+
+     int    capacity;
+
+     FusionSHMPoolShared *pool;
+} FusionVector;
+
+void         fusion_vector_init       ( FusionVector        *vector,
+                                        int                  capacity,
+                                        FusionSHMPoolShared *pool );
+
+void         fusion_vector_destroy    ( FusionVector        *vector );
+
+DirectResult fusion_vector_add        ( FusionVector        *vector,
+                                        void                *element );
+
+DirectResult fusion_vector_insert     ( FusionVector        *vector,
+                                        void                *element,
+                                        int                  index );
+
+DirectResult fusion_vector_move       ( FusionVector        *vector,
+                                        int                  from,
+                                        int                  to );
+
+DirectResult fusion_vector_remove     ( FusionVector        *vector,
+                                        int                  index );
+
+DirectResult fusion_vector_remove_last( FusionVector        *vector );
+
+
+static inline bool
+fusion_vector_has_elements( const FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+
+     return vector->count > 0;
+}
+
+static inline bool
+fusion_vector_is_empty( const FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+
+     return vector->count == 0;
+}
+
+static inline int
+fusion_vector_size( const FusionVector *vector )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+
+     return vector->count;
+}
+
+static inline void *
+fusion_vector_at( const FusionVector *vector, int index )
+{
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < vector->count );
+
+     return vector->elements[index];
+}
+
+static inline bool
+fusion_vector_contains( const FusionVector *vector, const void *element )
+{
+     int           i;
+     int           count;
+     void * const *elements;
+
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( element != NULL );
+
+     count    = vector->count;
+     elements = vector->elements;
+
+     /* Start with more recently added elements. */
+     for (i=count-1; i>=0; i--)
+          if (elements[i] == element)
+               return true;
+
+     return false;
+}
+
+static inline int
+fusion_vector_index_of( const FusionVector *vector, const void *element )
+{
+     int           i;
+     int           count;
+     void * const *elements;
+
+     D_MAGIC_ASSERT( vector, FusionVector );
+     D_ASSERT( element != NULL );
+
+     count    = vector->count;
+     elements = vector->elements;
+
+     /* Start with more recently added elements. */
+     for (i=count-1; i>=0; i--)
+          if (elements[i] == element)
+               return i;
+
+     /*
+      * In case the return value isn't checked
+      * this will most likely generate a bad address.
+      */
+     return INT_MIN >> 2;
+}
+
+
+#define fusion_vector_foreach(element, index, vector)                         \
+     for ((index) = 0;                                                        \
+          (index) < (vector).count && (element = (vector).elements[index]);   \
+          (index)++)
+
+#define fusion_vector_foreach_reverse(element, index, vector)                 \
+     for ((index) = (vector).count - 1;                                       \
+          (index) >= 0 && (element = (vector).elements[index]);               \
+          (index)--)
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/Makefile.am b/Source/DirectFB/lib/voodoo/Makefile.am
new file mode 100755
index 0000000..bf3c143
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/Makefile.am
@@ -0,0 +1,82 @@
+## Makefile.am for DirectFB/lib/voodoo
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = voodoo.pc
+
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/voodoo
+
+
+includedir = @INCLUDEDIR@/voodoo
+
+include_HEADERS = \
+	build.h			\
+	client.h		\
+	conf.h			\
+	interface.h		\
+	manager.h		\
+	message.h		\
+	server.h		\
+	play.h		\
+	types.h
+
+
+lib_LTLIBRARIES = libvoodoo.la
+
+libvoodoo_la_SOURCES = \
+	client.c		\
+	conf.c			\
+	interface.c		\
+	internal.h		\
+	manager.c		\
+	play.c		\
+	server.c
+
+libvoodoo_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+libvoodoo_la_LIBADD = ../direct/libdirect.la
+
+
+#
+## and now rebuild the static version with the *correct* object files
+#
+if BUILD_STATIC
+
+clean-local:
+	rm -f libvoodoo_fixed.a
+
+all-local: libvoodoo_fixed.a
+
+libvoodoo_fixed.a: .libs/libvoodoo.a
+	rm -f libvoodoo_fixed.a
+	${AR} cru libvoodoo_fixed.a `find . -name "*.o"`
+	${RANLIB} libvoodoo_fixed.a
+	cp -pf libvoodoo_fixed.a .libs/libvoodoo.a
+
+.libs/libvoodoo.a: libvoodoo.la
+
+else
+
+clean-local:
+
+all-local:
+
+endif
+
+
+include $(top_srcdir)/rules/nmfile.make
diff --git a/Source/DirectFB/lib/voodoo/Makefile.in b/Source/DirectFB/lib/voodoo/Makefile.in
new file mode 100755
index 0000000..4a4a5a2
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/Makefile.in
@@ -0,0 +1,666 @@
+# 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 = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/build.h.in \
+	$(srcdir)/voodoo.pc.in $(top_srcdir)/rules/nmfile.make
+subdir = lib/voodoo
+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 = build.h voodoo.pc
+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)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
+	"$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libvoodoo_la_DEPENDENCIES = ../direct/libdirect.la
+am_libvoodoo_la_OBJECTS = client.lo conf.lo interface.lo play.lo manager.lo \
+	server.lo
+libvoodoo_la_OBJECTS = $(am_libvoodoo_la_OBJECTS)
+libvoodoo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libvoodoo_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 = $(libvoodoo_la_SOURCES)
+DIST_SOURCES = $(libvoodoo_la_SOURCES)
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+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@/voodoo
+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_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = voodoo.pc
+include_HEADERS = \
+	build.h			\
+	client.h		\
+	conf.h			\
+	interface.h		\
+	manager.h		\
+	message.h		\
+	server.h		\
+	play.h		\
+	types.h
+
+lib_LTLIBRARIES = libvoodoo.la
+libvoodoo_la_SOURCES = \
+	client.c		\
+	conf.c			\
+	interface.c		\
+	internal.h		\
+	manager.c		\
+	play.c		\
+	server.c
+
+libvoodoo_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+libvoodoo_la_LIBADD = ../direct/libdirect.la
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@LIBTONM = $(LTLIBRARIES:.la=-$(LT_RELEASE).so.$(LT_BINARY))
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/nmfile.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  lib/voodoo/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  lib/voodoo/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
+build.h: $(top_builddir)/config.status $(srcdir)/build.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+voodoo.pc: $(top_builddir)/config.status $(srcdir)/voodoo.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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
+libvoodoo.la: $(libvoodoo_la_OBJECTS) $(libvoodoo_la_DEPENDENCIES) 
+	$(libvoodoo_la_LINK) -rpath $(libdir) $(libvoodoo_la_OBJECTS) $(libvoodoo_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/play.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-pkgconfigDATA: $(pkgconfig_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+
+uninstall-pkgconfigDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgconfig_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+	done
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$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) $(HEADERS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; 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."
+@BUILD_SHARED_FALSE@install-data-local:
+@ENABLE_TRACE_FALSE@install-data-local:
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	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-data-local install-includeHEADERS \
+	install-pkgconfigDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-exec-local install-libLTLIBRARIES
+
+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-includeHEADERS uninstall-libLTLIBRARIES \
+	uninstall-pkgconfigDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+	clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	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-data-local install-dvi install-dvi-am \
+	install-exec install-exec-am install-exec-local install-html \
+	install-html-am install-includeHEADERS install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-pkgconfigDATA 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-includeHEADERS uninstall-libLTLIBRARIES \
+	uninstall-pkgconfigDATA
+
+
+# If the old location isn't cleared, builds of external modules fail
+install-exec-local:
+	rm -rf $(DESTDIR)$(INTERNALINCLUDEDIR)/voodoo
+
+#
+#
+
+@BUILD_STATIC_TRUE@clean-local:
+@BUILD_STATIC_TRUE@	rm -f libvoodoo_fixed.a
+
+@BUILD_STATIC_TRUE@all-local: libvoodoo_fixed.a
+
+@BUILD_STATIC_TRUE@libvoodoo_fixed.a: .libs/libvoodoo.a
+@BUILD_STATIC_TRUE@	rm -f libvoodoo_fixed.a
+@BUILD_STATIC_TRUE@	${AR} cru libvoodoo_fixed.a `find . -name "*.o"`
+@BUILD_STATIC_TRUE@	${RANLIB} libvoodoo_fixed.a
+@BUILD_STATIC_TRUE@	cp -pf libvoodoo_fixed.a .libs/libvoodoo.a
+
+@BUILD_STATIC_TRUE@.libs/libvoodoo.a: libvoodoo.la
+
+@BUILD_STATIC_FALSE@clean-local:
+
+@BUILD_STATIC_FALSE@all-local:
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@install-data-local:
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	mkdir -p -- "$(DESTDIR)$(libdir)"
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	nm -n ".libs/$(LIBTONM)" > "$(DESTDIR)$(libdir)/nm-n.$(LIBTONM)"
+# 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/lib/voodoo/app.h b/Source/DirectFB/lib/voodoo/app.h
new file mode 100755
index 0000000..163edc6
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/app.h
@@ -0,0 +1,66 @@
+/*
+   (c) Copyright 2001-2010  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__APP_H__
+#define __VOODOO__APP_H__
+
+#include <voodoo/types.h>
+
+
+
+typedef enum {
+     VADESC_NONE    = 0x00000000,
+
+     VADESC_NAME    = 0x00000001,
+     VADESC_TEXT    = 0x00000002,
+
+     VADESC_ALL     = 0x00000003,
+} VoodooAppDescriptionFlags;
+
+
+#define VOODOO_APP_DESCRIPTION_NAME_LENGTH      128
+#define VOODOO_APP_DESCRIPTION_TEXT_LENGTH     1024
+
+typedef struct {
+     u8                            uuid[16];
+     VoodooAppDescriptionFlags     flags;
+
+     char                          name[VOODOO_APP_DESCRIPTION_NAME_LENGTH];
+     char                          text[VOODOO_APP_DESCRIPTION_TEXT_LENGTH];
+} VoodooAppDescription;
+
+typedef struct {
+     u8                            uuid[16];
+
+     VoodooAppDescription          app;
+     u8                            player_uuid[16];
+} VoodooAppInstanceDescription;
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/build.h.in b/Source/DirectFB/lib/voodoo/build.h.in
new file mode 100755
index 0000000..c5553e2
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/build.h.in
@@ -0,0 +1,34 @@
+/*
+   (c) Copyright 2000-2002  convergence integrated media GmbH.
+   (c) Copyright 2002-2004  convergence GmbH.
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org> and
+              Ville Syrjälä <syrjala@sci.fi>.
+
+   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 __VOODOO__BUILD_H__
+#define __VOODOO__BUILD_H__
+
+/* nothing yet */
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/client.c b/Source/DirectFB/lib/voodoo/client.c
new file mode 100755
index 0000000..66844e2
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/client.c
@@ -0,0 +1,208 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+#include <voodoo/manager.h>
+#include <voodoo/play.h>
+
+/**********************************************************************************************************************/
+
+struct __V_VoodooClient {
+     DirectLink     link;
+
+     int            refs;
+
+     VoodooLink     vl;
+     VoodooManager *manager;
+
+     char          *host;
+     int            port;
+};
+
+static DirectLink *m_clients; // FIXME: add lock
+
+/**********************************************************************************************************************/
+
+DirectResult
+voodoo_client_create( const char     *host,
+                      int             port,
+                      VoodooClient  **ret_client )
+{
+     DirectResult    ret;
+     VoodooClient   *client;
+     VoodooPlayer   *player;
+     int             bc_num  = 10;
+     int             bc_wait = 4000;
+     char            buf[100] = { 0 };
+     const char     *hostname = host;
+     bool            raw = true;
+
+     D_ASSERT( ret_client != NULL );
+
+     if (!port)
+          port = 2323;
+
+     direct_list_foreach (client, m_clients) {
+          if (!strcmp( client->host, host ) && client->port == port) {
+               D_INFO( "Voodoo/Client: Reconnecting to '%s', increasing ref count of existing connection!\n", host );
+
+               client->refs++;
+
+               *ret_client = client;
+
+               return DR_OK;
+          }
+     }
+
+
+     ret = voodoo_player_create( NULL, &player );
+     if (ret) {
+          D_DERROR( ret, "Voodoo/Client: Could not create the player!\n" );
+          return ret;
+     }
+
+     while (bc_num--) {
+          VoodooPlayInfo info;
+
+          // FIXME: resolve first, not late in voodoo_link_init_connect
+          if (hostname && hostname[0]) {
+               ret = voodoo_player_lookup_by_address( player, hostname, &info );
+               if (ret == DR_OK) {
+                    if (info.flags & VPIF_LINK)
+                         raw = false;
+                    
+                    break;
+               }
+          }
+          else {
+               ret = voodoo_player_lookup( player, NULL, &info, buf, sizeof(buf) );
+               if (ret == DR_OK) {
+                    if (info.flags & VPIF_LINK)
+                         raw = false;
+
+                    hostname = buf;
+
+                    break;
+               }
+          }
+
+          voodoo_player_broadcast( player );
+
+          direct_thread_sleep( bc_wait );
+
+          bc_wait += bc_wait;
+     }
+
+     voodoo_player_destroy( player );
+
+     if (!hostname || !hostname[0]) {
+          D_ERROR( "Voodoo/Play: Did not find any other player!\n" );
+          return DR_ITEMNOTFOUND;
+     }
+
+
+     /* Allocate client structure. */
+     client = D_CALLOC( 1, sizeof(VoodooClient) );
+     if (!client)
+          return D_OOM();
+
+
+     /* Initialize client structure. */
+     ret = voodoo_link_init_connect( &client->vl, hostname, port,
+                                     !voodoo_config->link_packet && (voodoo_config->link_raw || raw) );
+     if (ret) {
+          D_DERROR( ret, "Voodoo/Client: Failed to initialize Voodoo Link!\n" );
+          D_FREE( client );
+          return ret;
+     }
+
+     /* Create the manager. */
+     ret = voodoo_manager_create( &client->vl, client, NULL, &client->manager );
+     if (ret) {
+          client->vl.Close( &client->vl );
+          D_FREE( client );
+          return ret;
+     }
+
+     client->refs = 1;
+     client->host = D_STRDUP( host );
+     client->port = port;
+
+     direct_list_prepend( &m_clients, &client->link );
+
+     /* Return the new client. */
+     *ret_client = client;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_client_destroy( VoodooClient *client )
+{
+     D_ASSERT( client != NULL );
+
+     D_INFO( "Voodoo/Client: Decreasing ref count of connection...\n" );
+
+     if (! --(client->refs)) {
+          voodoo_manager_destroy( client->manager );
+
+          //client->vl.Close( &client->vl );
+
+          direct_list_remove( &m_clients, &client->link );
+
+          D_FREE( client->host );
+          D_FREE( client );
+     }
+
+     return DR_OK;
+}
+
+VoodooManager *
+voodoo_client_manager( const VoodooClient *client )
+{
+     D_ASSERT( client != NULL );
+
+     return client->manager;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/client.h b/Source/DirectFB/lib/voodoo/client.h
new file mode 100755
index 0000000..5905ef8
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/client.h
@@ -0,0 +1,44 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CLIENT_H__
+#define __VOODOO__CLIENT_H__
+
+#include <voodoo/types.h>
+
+
+DirectResult   voodoo_client_create ( const char         *host,
+                                      int                 session,
+                                      VoodooClient      **ret_client );
+
+DirectResult   voodoo_client_destroy( VoodooClient       *client );
+
+
+VoodooManager *voodoo_client_manager( const VoodooClient *client );
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/compat.h b/Source/DirectFB/lib/voodoo/compat.h
new file mode 100755
index 0000000..e7b5a75
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/compat.h
@@ -0,0 +1,8 @@
+#include "mutex.h"
+#include "waitqueue.h"
+
+#define direct_thread_sleep usleep
+#define direct_snprintf     snprintf
+#define direct_sscanf       sscanf
+#define direct_getpid       getpid
+
diff --git a/Source/DirectFB/lib/voodoo/conf.c b/Source/DirectFB/lib/voodoo/conf.c
new file mode 100755
index 0000000..456643d
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/conf.c
@@ -0,0 +1,253 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+
+#include <direct/conf.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+
+
+static VoodooConfig config = {
+     .compression_min = 1
+};
+
+VoodooConfig *voodoo_config = &config;
+const char   *voodoo_config_usage =
+     "libvoodoo options:\n"
+     "  player-name=<name>             Set player name\n"
+     "  player-vendor=<name>           Set player vendor\n"
+     "  player-model=<name>            Set player model\n"
+     "  player-uuid=<name>             Set player uuid\n"
+     "  proxy-memory-max=<kB>          Set maximum amount of memory per connection\n"
+     "  proxy-surface-max=<kB>         Set maximum amount of memory per surface\n"
+     "  [no-]server-fork               Fork a new process for each connection (default: no)\n"
+     "  server-single=<interface>      Enable single client mode for super interface, e.g. IDirectFB\n"
+     "  compression-min=<bytes>        Enable compression (if != 0) for packets with at least num bytes\n"
+     "  [no-]link-raw                  Set link mode to 'raw'\n"
+     "  [no-]link-packet               Set link mode to 'packet'\n"
+     "\n";
+
+/**********************************************************************************************************************/
+
+DirectResult
+voodoo_config_set( const char *name, const char *value )
+{
+     if (strcmp (name, "player-name" ) == 0) {
+          if (value) {
+               direct_snputs( voodoo_config->play_info.name, value, VOODOO_PLAYER_NAME_LENGTH );
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "player-vendor" ) == 0) {
+          if (value) {
+               direct_snputs( voodoo_config->play_info.vendor, value, VOODOO_PLAYER_VENDOR_LENGTH );
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "player-model" ) == 0) {
+          if (value) {
+               direct_snputs( voodoo_config->play_info.model, value, VOODOO_PLAYER_MODEL_LENGTH );
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "player-uuid" ) == 0) {
+          if (value) {
+               sscanf( value, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+                       (unsigned int*)&voodoo_config->play_info.uuid[0], (unsigned int*)&voodoo_config->play_info.uuid[1], (unsigned int*)&voodoo_config->play_info.uuid[2], (unsigned int*)&voodoo_config->play_info.uuid[3], (unsigned int*)&voodoo_config->play_info.uuid[4],
+                       (unsigned int*)&voodoo_config->play_info.uuid[5], (unsigned int*)&voodoo_config->play_info.uuid[6], (unsigned int*)&voodoo_config->play_info.uuid[7], (unsigned int*)&voodoo_config->play_info.uuid[8], (unsigned int*)&voodoo_config->play_info.uuid[9],
+                       (unsigned int*)&voodoo_config->play_info.uuid[10], (unsigned int*)&voodoo_config->play_info.uuid[11], (unsigned int*)&voodoo_config->play_info.uuid[12], (unsigned int*)&voodoo_config->play_info.uuid[13], (unsigned int*)&voodoo_config->play_info.uuid[14],
+                       (unsigned int*)&voodoo_config->play_info.uuid[15] );
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "proxy-memory-max" ) == 0) {
+          if (value) {
+               unsigned int max;
+
+               if (sscanf( value, "%u", &max ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->memory_max = max * 1024;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "proxy-surface-max" ) == 0) {
+          if (value) {
+               unsigned int max;
+
+               if (sscanf( value, "%u", &max ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->surface_max = max * 1024;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "proxy-layer-mask" ) == 0) {
+          if (value) {
+               unsigned int mask;
+
+               if (sscanf( value, "%u", &mask ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->layer_mask = mask;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "proxy-stacking-mask" ) == 0) {
+          if (value) {
+               unsigned int mask;
+
+               if (sscanf( value, "%u", &mask ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->stacking_mask = mask;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "proxy-resource-id" ) == 0) {
+          if (value) {
+               unsigned int resource_id;
+
+               if (sscanf( value, "%u", &resource_id ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->resource_id = resource_id;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "server-fork" ) == 0) {
+          voodoo_config->server_fork = true;
+     } else
+     if (strcmp (name, "no-server-fork" ) == 0) {
+          voodoo_config->server_fork = false;
+     } else
+     if (strcmp (name, "server-single" ) == 0) {
+          if (value) {
+               if (voodoo_config->server_single)
+                    D_FREE( voodoo_config->server_single );
+
+               voodoo_config->server_single = D_STRDUP( value );
+               if (!voodoo_config->server_single)
+                    D_OOM();
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "play-broadcast" ) == 0) {
+          if (value) {
+               if (voodoo_config->play_broadcast)
+                    D_FREE( voodoo_config->play_broadcast );
+
+               voodoo_config->play_broadcast = D_STRDUP( value );
+               if (!voodoo_config->play_broadcast)
+                    D_OOM();
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "compression-min" ) == 0) {
+          if (value) {
+               unsigned int min;
+
+               if (sscanf( value, "%u", &min ) != 1) {
+                    D_ERROR( "Voodoo/Config '%s': Invalid value specified!\n", name );
+                    return DR_INVARG;
+               }
+
+               voodoo_config->compression_min = min;
+          }
+          else {
+               D_ERROR( "Voodoo/Config '%s': No value specified!\n", name );
+               return DR_INVARG;
+          }
+     } else
+     if (strcmp (name, "link-raw" ) == 0) {
+          voodoo_config->link_raw = true;
+     } else
+     if (strcmp (name, "no-link-raw" ) == 0) {
+          voodoo_config->link_raw = false;
+     } else
+     if (strcmp (name, "link-packet" ) == 0) {
+          voodoo_config->link_packet = true;
+     } else
+     if (strcmp (name, "no-link-packet" ) == 0) {
+          voodoo_config->link_packet = false;
+     } else
+     if (direct_config_set( name, value ))
+          return DR_UNSUPPORTED;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/conf.h b/Source/DirectFB/lib/voodoo/conf.h
new file mode 100755
index 0000000..57dac9a
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/conf.h
@@ -0,0 +1,58 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONF_H__
+#define __VOODOO__CONF_H__
+
+#include <voodoo/play.h>
+
+
+struct __V_VoodooConfig {
+    VoodooPlayInfo  play_info;
+    bool            forward_nodes;
+    unsigned int    memory_max;
+    unsigned int    surface_max;
+    unsigned int    layer_mask;
+    unsigned int    stacking_mask;
+    unsigned int    resource_id;
+    bool            server_fork;
+    char           *server_single;
+    char           *play_broadcast;
+    unsigned int    compression_min;
+    bool            link_raw;
+    bool            link_packet;
+};
+
+extern VoodooConfig *voodoo_config;
+
+
+DirectResult voodoo_config_set( const char *name, const char *value );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/connection.cpp b/Source/DirectFB/lib/voodoo/connection.cpp
new file mode 100755
index 0000000..3bde3e1
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection.cpp
@@ -0,0 +1,70 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection.h>
+
+
+D_DEBUG_DOMAIN( Voodoo_Connection, "Voodoo/Connection", "Voodoo Connection" );
+
+/**********************************************************************************************************************/
+
+VoodooConnection::VoodooConnection( VoodooManager *manager,
+                                    VoodooLink    *link )
+     :
+     magic(0),
+     manager(manager),
+     link(link)
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnection::%s( %p )\n", __func__, this );
+
+     D_MAGIC_SET( this, VoodooConnection );
+}
+
+VoodooConnection::~VoodooConnection()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnection::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     link->Close( link );
+
+     D_MAGIC_CLEAR( this );
+}
+
diff --git a/Source/DirectFB/lib/voodoo/connection.h b/Source/DirectFB/lib/voodoo/connection.h
new file mode 100755
index 0000000..0e6521b
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection.h
@@ -0,0 +1,60 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONNECTION_H__
+#define __VOODOO__CONNECTION_H__
+
+extern "C" {
+#include <voodoo/types.h>
+}
+
+
+class VoodooConnection {
+protected:
+     int                         magic;
+
+     VoodooManager              *manager;
+     VoodooLink                 *link;
+
+public:
+     VoodooConnection( VoodooManager *manager,
+                       VoodooLink    *link );
+
+     virtual ~VoodooConnection();
+
+     virtual void Start() = 0;
+     virtual void Stop() = 0;
+
+
+     virtual VoodooPacket *GetPacket( size_t        length ) = 0;
+     virtual void          PutPacket( VoodooPacket *packet,
+                                      bool          flush ) = 0;
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/connection_link.cpp b/Source/DirectFB/lib/voodoo/connection_link.cpp
new file mode 100755
index 0000000..b0ae138
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_link.cpp
@@ -0,0 +1,331 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+extern "C" {
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/fastlz.h>
+#include <direct/hash.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection_link.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+#include <vector>
+
+
+//namespace Voodoo {
+
+D_DEBUG_DOMAIN( Voodoo_Connection, "Voodoo/Connection", "Voodoo Connection" );
+D_DEBUG_DOMAIN( Voodoo_Input,      "Voodoo/Input",      "Voodoo Input" );
+D_DEBUG_DOMAIN( Voodoo_Output,     "Voodoo/Output",     "Voodoo Output" );
+
+/**********************************************************************************************************************/
+
+VoodooConnectionLink::VoodooConnectionLink( VoodooManager *manager,
+                                            VoodooLink    *link )
+     :
+     VoodooConnection( manager, link )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p )\n", __func__, this );
+
+     input.start   = 0;
+     input.last    = 0;
+     input.end     = 0;
+     input.max     = 0;
+
+     output.packets = NULL;
+     output.sending = NULL;
+
+     /* Initialize all locks. */
+     direct_mutex_init( &output.lock );
+
+     /* Initialize all wait conditions. */
+     direct_waitqueue_init( &output.wait );
+
+     /* Set default buffer limit. */
+     input.max = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX;
+
+     /* Allocate buffers. */
+     size_t input_buffer_size = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX + VOODOO_PACKET_MAX + sizeof(VoodooPacketHeader);
+
+     input.buffer = (u8*) D_MALLOC( input_buffer_size );
+
+     D_INFO( "VoodooConnection/Link: Allocated "_ZU" kB input buffer at %p\n", input_buffer_size/1024, input.buffer );
+
+     direct_tls_register( &output.tls, OutputTLS_Destructor );
+}
+
+VoodooConnectionLink::~VoodooConnectionLink()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     /* Acquire locks and wake up waiters. */
+     direct_mutex_lock( &output.lock );
+     direct_waitqueue_broadcast( &output.wait );
+     direct_mutex_unlock( &output.lock );
+
+     /* Destroy conditions. */
+     direct_waitqueue_deinit( &output.wait );
+
+     /* Destroy locks. */
+     direct_mutex_deinit( &output.lock );
+
+     /* Deallocate buffers. */
+     D_FREE( input.buffer );
+
+     direct_tls_unregister( &output.tls );
+}
+
+/**********************************************************************************************************************/
+
+VoodooPacket *
+VoodooConnectionLink::GetPacket( size_t length )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p, length "_ZU" )\n", __func__, this, length );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+     D_ASSERT( length >= (int) sizeof(VoodooMessageHeader) );
+     D_ASSUME( length <= MAX_MSG_SIZE );
+
+     if (length > MAX_MSG_SIZE) {
+          D_WARN( _ZU" exceeds maximum message size of %d", length, MAX_MSG_SIZE );
+          return NULL;
+     }
+
+     size_t aligned = VOODOO_MSG_ALIGN( length );
+
+
+     Packets *packets = (Packets*) direct_tls_get( output.tls );
+
+     if (!packets) {
+          packets = new Packets( this );
+
+          direct_tls_set( output.tls, packets );
+     }
+
+     VoodooPacket *packet = packets->active;
+
+     if (packet) {
+          if (packet->append( aligned ))
+               return packet;
+
+          Flush( packet );
+     }
+
+     packet = packets->Get();
+     if (packet) {
+          if (packet->sending) {
+               direct_mutex_lock( &output.lock );
+
+               while (packet->sending)
+                    direct_waitqueue_wait( &output.wait, &output.lock );
+
+               direct_mutex_unlock( &output.lock );
+          }
+          packet->reset( aligned );
+     }
+
+     return packet;
+}
+
+void
+VoodooConnectionLink::PutPacket( VoodooPacket *packet, bool flush )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p, %sflush )\n", __func__, this, flush ? "" : "NO " );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     Packets *packets = (Packets*) direct_tls_get( output.tls );
+
+     D_ASSERT( packets != NULL );
+     D_ASSERT( packet == packets->active );
+
+     if (flush) {
+          Flush( packet );
+
+          packets->active = NULL;
+     }
+}
+
+void
+VoodooConnectionLink::Stop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_lock( &output.lock );
+
+     while (output.packets) {
+          VoodooPacket *packet = (VoodooPacket*) output.packets;
+
+          D_DEBUG_AT( Voodoo_Connection, "  -> discarding output packet %p\n", packet );
+
+          D_ASSUME( packet->sending );
+
+          packet->sending = false;
+
+          direct_list_remove( &output.packets, &packet->link );
+     }
+
+     direct_mutex_unlock( &output.lock );
+
+     direct_waitqueue_broadcast( &output.wait );
+}
+
+void
+VoodooConnectionLink::Flush( VoodooPacket *packet )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p, packet %p )\n", __func__, this, packet );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_lock( &output.lock );
+
+     D_ASSERT( !direct_list_contains_element_EXPENSIVE( output.packets, &packet->link ) );
+
+     D_ASSERT( !packet->sending );
+
+     packet->sending = true;
+
+     direct_list_append( &output.packets, &packet->link );
+
+     direct_mutex_unlock( &output.lock );
+
+     link->WakeUp( link );
+}
+
+void
+VoodooConnectionLink::OutputTLS_Destructor( void *ptr )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( ptr %p )\n", __func__, ptr );
+
+     Packets *packets = (Packets*) ptr;
+
+     delete packets;
+
+     D_DEBUG_AT( Voodoo_Connection, "  -> OutputTLS_Destructor done\n" );
+}
+
+VoodooConnectionLink::Packets::Packets( VoodooConnectionLink* connection )
+     :
+     magic(0),
+     connection(connection),
+     next(0),
+     num(0),
+     active(NULL)
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::Packets::%s( %p )\n", __func__, this );
+
+     memset( packets, 0, sizeof(packets) );
+
+     D_MAGIC_SET( this, Packets );
+}
+
+VoodooConnectionLink::Packets::~Packets()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::Packets::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, Packets );
+
+     for (size_t i=0; i<num; i++) {
+          if (packets[i]) {
+               D_DEBUG_AT( Voodoo_Connection, "  -> destroying output packet "_ZU" (%p)\n", i, packets[i] );
+
+               if (packets[i]->sending) {
+                    direct_mutex_lock( &connection->output.lock );
+
+                    while (packets[i]->sending) {
+                         D_DEBUG_AT( Voodoo_Connection, "  -> packet sending, waiting...\n" );
+
+                         direct_waitqueue_wait( &connection->output.wait, &connection->output.lock );
+                    }
+
+                    direct_mutex_unlock( &connection->output.lock );
+               }
+
+               D_FREE( packets[i] );
+          }
+     }
+}
+
+VoodooPacket *
+VoodooConnectionLink::Packets::Get()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::Packets::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, Packets );
+
+     VoodooPacket *packet;
+
+     if (num < VOODOO_CONNECTION_PACKET_NUM_OUTPUT) {
+          packet = packets[num] = VoodooPacket::New( 0 );
+
+          D_DEBUG_AT( Voodoo_Connection, "  -> new ["_ZU"] %p\n", num, packet );
+
+          num++;
+     }
+     else {
+          packet = packets[next];
+
+          next = (next+1) % VOODOO_CONNECTION_PACKET_NUM_OUTPUT;
+
+          D_DEBUG_AT( Voodoo_Connection, "  -> reusing %p\n", packet );
+     }
+
+     active = packet;
+
+     return packet;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/connection_link.h b/Source/DirectFB/lib/voodoo/connection_link.h
new file mode 100755
index 0000000..328151c
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_link.h
@@ -0,0 +1,106 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONNECTION_LINK_H__
+#define __VOODOO__CONNECTION_LINK_H__
+
+#include <voodoo/connection.h>
+
+extern "C" {
+#include <direct/thread.h>
+}
+
+#define VOODOO_CONNECTION_PACKET_NUM_OUTPUT  2
+#define VOODOO_CONNECTION_LINK_INPUT_BUF_MAX ((VOODOO_PACKET_MAX + sizeof(VoodooPacketHeader)) * 1)
+
+
+class VoodooConnectionLink : public VoodooConnection {
+protected:
+     struct {
+          u8                    *buffer;
+          size_t                 start;
+          size_t                 last;
+          size_t                 end;
+          size_t                 max;
+     } input;
+
+     struct {
+          DirectMutex            lock;
+          DirectWaitQueue        wait;
+          DirectTLS              tls;
+          DirectLink            *packets;
+
+          VoodooPacket          *sending;
+          size_t                 sent;
+     } output;
+
+public:
+     VoodooConnectionLink( VoodooManager *manager,
+                           VoodooLink    *link );
+
+     virtual ~VoodooConnectionLink();
+
+
+     virtual VoodooPacket *GetPacket( size_t        length );
+     virtual void          PutPacket( VoodooPacket *packet,
+                                      bool          flush );
+
+     virtual void          Stop     ();
+
+
+private:
+     void                  Flush    ( VoodooPacket *packet );
+
+     static void           OutputTLS_Destructor( void *ptr );
+
+
+private:
+     friend class Packets;
+
+     class Packets {
+     private:
+          int                   magic;
+          VoodooConnectionLink *connection;
+          VoodooPacket         *packets[VOODOO_CONNECTION_PACKET_NUM_OUTPUT];
+          size_t                next;
+          size_t                num;
+
+     public:
+          VoodooPacket         *active;
+
+     public:
+          Packets( VoodooConnectionLink *connection );
+
+          ~Packets();
+
+          VoodooPacket *Get();
+     };
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/connection_packet.cpp b/Source/DirectFB/lib/voodoo/connection_packet.cpp
new file mode 100755
index 0000000..1e8a77f
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_packet.cpp
@@ -0,0 +1,368 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/fastlz.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection_packet.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+#include <vector>
+
+
+//namespace Voodoo {
+
+D_DEBUG_DOMAIN( Voodoo_Connection, "Voodoo/Connection", "Voodoo Connection" );
+D_DEBUG_DOMAIN( Voodoo_Input,      "Voodoo/Input",      "Voodoo Input" );
+D_DEBUG_DOMAIN( Voodoo_Output,     "Voodoo/Output",     "Voodoo Output" );
+
+/**********************************************************************************************************************/
+
+VoodooConnectionPacket::VoodooConnectionPacket( VoodooManager *manager,
+                                                VoodooLink    *link )
+     :
+     VoodooConnectionLink( manager, link ),
+     stop( false ),
+     closed( false )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+}
+
+VoodooConnectionPacket::~VoodooConnectionPacket()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+}
+
+void
+VoodooConnectionPacket::Start()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     io = direct_thread_create( DTT_DEFAULT, io_loop_main, this, "Voodoo IO" );
+}
+
+void
+VoodooConnectionPacket::Stop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_lock( &output.lock );
+
+     while (!closed && output.packets) {
+          D_DEBUG_AT( Voodoo_Connection, "  -> waiting for output packets to be sent...\n" );
+
+          direct_waitqueue_wait( &output.wait, &output.lock );
+     }
+
+     direct_mutex_unlock( &output.lock );
+
+     stop = true;
+
+     link->WakeUp( link );
+
+     /* Wait for manager threads exiting. */
+     direct_thread_join( io );
+     direct_thread_destroy( io );
+
+     VoodooConnectionLink::Stop();
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooConnectionPacket::io_loop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     while (!stop) {
+          D_MAGIC_ASSERT( this, VoodooConnection );
+
+          if (input.start == input.max) {
+               input.start = 0;
+               input.end   = 0;
+               input.last  = 0;
+               input.max   = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX;
+          }
+
+          if (!stop) {
+               DirectResult  ret;
+               VoodooChunk   chunks[2];
+               VoodooChunk  *chunk_read  = NULL;
+               VoodooChunk  *chunk_write = NULL;
+               size_t        last        = input.last;
+               VoodooPacket *packet      = NULL;
+
+               std::vector<VoodooChunk> chunks_write;
+               std::vector<VoodooChunk> chunks_read;
+
+               if (!output.sending) {
+                    direct_mutex_lock( &output.lock );
+
+                    if (output.packets) {
+                         VoodooPacket *packet = (VoodooPacket*) output.packets;
+
+                         D_ASSERT( packet->sending );
+
+                         if (voodoo_config->compression_min && packet->size() >= voodoo_config->compression_min) {
+                              output.sending = VoodooPacket::Compressed( packet );
+
+                              if (output.sending->flags() & VPHF_COMPRESSED) {
+                                   D_DEBUG_AT( Voodoo_Output, "  -> Compressed %u to %u bytes... (packet %p)\n",
+                                               output.sending->uncompressed(), output.sending->size(), packet );
+
+                                   output.sending->sending = true;
+
+                                   packet->sending = false;
+
+                                   direct_list_remove( &output.packets, &packet->link );
+
+                                   direct_waitqueue_broadcast( &output.wait );
+                              }
+                         }
+                         else
+                              output.sending = packet;
+
+                         output.sent = 0;
+                    }
+
+                    direct_mutex_unlock( &output.lock );
+               }
+
+               if (output.sending) {
+                    packet = output.sending;
+
+                    D_ASSERT( packet->sending );
+
+                    chunk_write = &chunks[1];
+
+                    chunk_write->ptr    = (char*) packet->data_header() + output.sent;
+                    chunk_write->length = VOODOO_MSG_ALIGN(packet->size() + sizeof(VoodooPacketHeader)) - output.sent;
+                    chunk_write->done   = 0;
+
+                    chunks_write.push_back( chunks[1] );
+
+                    chunk_write = chunks_write.data();
+               }
+
+               if (input.end < input.max && manager->DispatchReady()) {
+                    chunk_read = &chunks[0];
+
+                    chunk_read->ptr    = input.buffer + input.end;
+                    chunk_read->length = input.max - input.end;
+                    chunk_read->done   = 0;
+
+                    chunks_read.push_back( chunks[0] );
+
+                    chunk_read = chunks_read.data();
+               }
+
+
+               ret = link->SendReceive( link,
+                                        chunks_write.data(), chunks_write.size(),
+                                        chunks_read.data(), chunks_read.size() );
+               switch (ret) {
+                    case DR_OK:
+                         if (chunk_write && chunk_write->done) {
+                              D_DEBUG_AT( Voodoo_Output, "  -> Sent "_ZD"/"_ZD" bytes... (packet %p)\n", chunk_write->done, chunk_write->length, packet );
+
+                              output.sent += chunk_write->done;
+
+                              if (output.sent == VOODOO_MSG_ALIGN(packet->size() + sizeof(VoodooPacketHeader))) {
+                                   output.sending = NULL;
+
+                                   if (packet->flags() & VPHF_COMPRESSED) {
+                                        packet->sending = false;
+
+                                        D_FREE( packet );
+                                   }
+                                   else {
+                                        direct_mutex_lock( &output.lock );
+
+                                        packet->sending = false;
+
+                                        direct_list_remove( &output.packets, &packet->link );
+
+                                        direct_mutex_unlock( &output.lock );
+
+                                        direct_waitqueue_broadcast( &output.wait );
+                                   }
+                              }
+                         }
+                         break;
+
+                    case DR_TIMEOUT:
+                         //D_DEBUG_AT( Voodoo_Connection, "  -> timeout\n" );
+                         break;
+
+                    case DR_INTERRUPTED:
+                         D_DEBUG_AT( Voodoo_Connection, "  -> interrupted\n" );
+                         break;
+
+                    default:
+                         if (ret == DR_IO)
+                              D_DEBUG_AT( Voodoo_Connection, "  -> Connection closed!\n" );
+                         else
+						 {
+                              D_DERROR( ret, "Voodoo/ConnectionPacket: Could not receive data!\n" );
+							  exit(0);
+						 }
+
+                         goto disconnect;
+               }
+
+
+               if (chunk_read && chunk_read->done) {
+                    D_DEBUG_AT( Voodoo_Input, "  -> Received "_ZD" bytes...\n", chunk_read->done );
+
+                    input.end += (size_t) chunk_read->done;
+
+                    do {
+                         VoodooPacketHeader *header;
+                         size_t              aligned;
+
+                         /* Get the packet header. */
+                         header  = (VoodooPacketHeader *)(input.buffer + last);
+                         aligned = VOODOO_MSG_ALIGN( header->size );
+
+                         D_DEBUG_AT( Voodoo_Input, "  -> Next packet has %u ("_ZU") -> %u bytes (flags 0x%04x)...\n",
+                                     header->size, aligned, header->uncompressed, header->flags );
+
+                         if (input.end - last >= sizeof(VoodooPacketHeader)) {
+                              if (header->uncompressed < (int) sizeof(VoodooMessageHeader)) {
+                                   D_DERROR( ret, "Voodoo/ConnectionPacket: Data error, uncompressed %d < min %zu!\n", header->uncompressed, sizeof(VoodooPacketHeader) );
+
+                                   goto disconnect;
+                              }
+
+                              if (header->uncompressed > VOODOO_PACKET_MAX) {
+                                   D_DERROR( ret, "Voodoo/ConnectionPacket: Data error, uncompressed %d > max %d!\n", header->uncompressed, VOODOO_PACKET_MAX );
+
+                                   goto disconnect;
+                              }
+                         }
+
+                         if (sizeof(VoodooPacketHeader) + aligned > input.end - last) {
+                              D_DEBUG_AT( Voodoo_Input, "  -> ...fetching tail of message.\n" );
+
+                              /* Extend the buffer if the message doesn't fit into the default boundary. */
+                              if (sizeof(VoodooPacketHeader) + aligned > input.max - last)
+                                   input.max = last + sizeof(VoodooPacketHeader) + aligned;
+
+                              break;
+                         }
+
+                         last += sizeof(VoodooPacketHeader) + aligned;
+                    } while (last < input.end);
+
+                    if (last != input.last) {
+                         input.last = last;
+
+                         D_DEBUG_AT( Voodoo_Input, "  { START "_ZD", LAST "_ZD", END "_ZD", MAX "_ZD" }\n",
+                                     input.start, input.last, input.end, input.max );
+
+                         while (input.start < input.last) {
+                              /* Get the packet header. */
+                              VoodooPacketHeader *header = (VoodooPacketHeader *)(input.buffer + input.start);
+
+                              VoodooPacket *p;
+
+                              D_ASSERT( header->uncompressed <= VOODOO_PACKET_MAX );
+
+                              if (header->flags & VPHF_COMPRESSED) {
+                                   size_t uncompressed = direct_fastlz_decompress( header + 1, header->size, tmp, header->uncompressed );
+
+                                   D_DEBUG_AT( Voodoo_Input, "  -> Uncompressed "_ZU" bytes (%u compressed)\n", uncompressed, header->size );
+
+                                   (void) uncompressed;
+
+                                   D_ASSERT( uncompressed == header->uncompressed );
+
+                                   // FIXME: don't copy, but read into packet directly, maybe call manager->GetPacket() at the top of this loop
+                                   p = VoodooPacket::Copy( header->uncompressed, VPHF_NONE,
+                                                           header->uncompressed, tmp );
+                              }
+                              else {
+                                   // FIXME: don't copy, but read into packet directly, maybe call manager->GetPacket() at the top of this loop
+                                   p = VoodooPacket::Copy( header->uncompressed, VPHF_NONE,
+                                                           header->uncompressed, header + 1 );
+                              }
+
+                              manager->DispatchPacket( p );
+
+                              input.start += VOODOO_MSG_ALIGN(header->size) + sizeof(VoodooPacketHeader);
+                         }
+                    }
+               }
+          }
+     }
+
+     return NULL;
+
+
+disconnect:
+     closed = true;
+
+     manager->handle_disconnect();
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooConnectionPacket::io_loop_main( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, thread %p )\n", __func__, arg, thread );
+
+     VoodooConnectionPacket *connection = (VoodooConnectionPacket*) arg;
+
+     return connection->io_loop();
+}
+
diff --git a/Source/DirectFB/lib/voodoo/connection_packet.h b/Source/DirectFB/lib/voodoo/connection_packet.h
new file mode 100755
index 0000000..ec53e27
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_packet.h
@@ -0,0 +1,61 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONNECTION_PACKET_H__
+#define __VOODOO__CONNECTION_PACKET_H__
+
+#include <voodoo/connection_link.h>
+
+
+class VoodooConnectionPacket : public VoodooConnectionLink {
+private:
+     char          tmp[VOODOO_PACKET_MAX];
+     DirectThread *io;
+     bool          stop;
+     bool          closed;
+
+public:
+     VoodooConnectionPacket( VoodooManager *manager,
+                             VoodooLink    *link );
+
+     virtual ~VoodooConnectionPacket();
+
+     virtual void Start();
+     virtual void Stop();
+
+
+private:
+     void *io_loop();
+
+
+     static void  *io_loop_main( DirectThread *thread,
+                                 void         *arg );
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/connection_packet_old.cpp b/Source/DirectFB/lib/voodoo/connection_packet_old.cpp
new file mode 100755
index 0000000..0efec4d
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_packet_old.cpp
@@ -0,0 +1,433 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+extern "C" {
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/fastlz.h>
+#include <direct/hash.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection_packet.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+#include <vector>
+
+
+#define IN_BUF_MAX   (640 * 1024)
+#define OUT_BUF_MAX  (640 * 1024)
+
+
+//namespace Voodoo {
+
+D_DEBUG_DOMAIN( Voodoo_Connection, "Voodoo/Connection", "Voodoo Connection" );
+D_DEBUG_DOMAIN( Voodoo_Input,      "Voodoo/Input",      "Voodoo Input" );
+D_DEBUG_DOMAIN( Voodoo_Output,     "Voodoo/Output",     "Voodoo Output" );
+
+/**********************************************************************************************************************/
+
+VoodooConnectionPacket::VoodooConnectionPacket( VoodooManager *manager,
+                                                VoodooLink    *link )
+     :
+     VoodooConnection( manager, link )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     input.start  = 0;
+     input.last   = 0;
+     input.end    = 0;
+     input.max    = 0;
+
+     output.start = 0;
+     output.end   = 0;
+
+     /* Initialize all locks. */
+     direct_recursive_mutex_init( &input.lock );
+     direct_recursive_mutex_init( &output.lock );
+
+     /* Initialize all wait conditions. */
+     direct_waitqueue_init( &input.wait );
+     direct_waitqueue_init( &output.wait );
+
+     /* Set default buffer limit. */
+     input.max = IN_BUF_MAX;
+
+     /* Allocate buffers. */
+     input.buffer  = (u8*) D_MALLOC( IN_BUF_MAX + VOODOO_PACKET_MAX + sizeof(VoodooPacketHeader) );
+     output.buffer = (u8*) D_MALLOC( OUT_BUF_MAX );
+
+     io = direct_thread_create( DTT_DEFAULT, io_loop_main, this, "Voodoo IO" );
+}
+
+VoodooConnectionPacket::~VoodooConnectionPacket()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     link->WakeUp( link );
+
+     /* Acquire locks and wake up waiters. */
+     direct_mutex_lock( &input.lock );
+     direct_waitqueue_broadcast( &input.wait );
+     direct_mutex_unlock( &input.lock );
+
+     direct_mutex_lock( &output.lock );
+     direct_waitqueue_broadcast( &output.wait );
+     direct_mutex_unlock( &output.lock );
+
+     /* Wait for manager threads exiting. */
+     direct_thread_join( io );
+     direct_thread_destroy( io );
+
+     /* Destroy conditions. */
+     direct_waitqueue_deinit( &input.wait );
+     direct_waitqueue_deinit( &output.wait );
+
+     /* Destroy locks. */
+     direct_mutex_deinit( &input.lock );
+     direct_mutex_deinit( &output.lock );
+
+     /* Deallocate buffers. */
+     D_FREE( output.buffer );
+     D_FREE( input.buffer );
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooConnectionPacket::io_loop_main( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, thread %p )\n", __func__, arg, thread );
+
+     VoodooConnectionPacket *connection = (VoodooConnectionPacket*) arg;
+
+     return connection->io_loop();
+}
+
+void *
+VoodooConnectionPacket::io_loop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p )\n", __func__, this );
+
+     while (!manager->is_quit) {
+          D_MAGIC_ASSERT( this, VoodooConnection );
+
+//          direct_mutex_lock( &manager->input.lock );
+
+          if (input.start == input.max) {
+               input.start = 0;
+               input.end   = 0;
+               input.last  = 0;
+               input.max   = IN_BUF_MAX;
+          }
+
+//          direct_mutex_unlock( &input.lock );
+
+          if (!manager->is_quit) {
+               DirectResult  ret;
+               VoodooChunk   chunks[2];
+               VoodooChunk  *chunk_read  = NULL;
+               VoodooChunk  *chunk_write = NULL;
+               size_t        last        = input.last;
+
+               std::vector<VoodooChunk> chunks_write;
+               std::vector<VoodooChunk> chunks_read;
+
+               direct_mutex_lock( &output.lock );
+
+               if (input.end < input.max) {
+                    chunk_read = &chunks[0];
+
+                    chunk_read->ptr    = input.buffer + input.end;
+                    chunk_read->length = input.max - input.end;
+                    chunk_read->done   = 0;
+
+                    chunks_read.push_back( chunks[0] );
+
+                    chunk_read = chunks_read.data();
+               }
+
+               if (output.end > output.start) {
+                    chunk_write = &chunks[1];
+
+                    chunk_write->ptr    = output.buffer + output.start;
+                    chunk_write->length = output.end - output.start;
+                    chunk_write->done   = 0;
+
+                    if (chunk_write->length > 65536) {
+                         chunk_write->length = 65536;
+                    }
+
+                    chunks_write.push_back( chunks[1] );
+
+                    chunk_write = chunks_write.data();
+               }
+
+               if (!chunk_write)
+                    direct_mutex_unlock( &output.lock );
+
+#if 0
+               if (chunk_write) {
+                    char buf[chunk_write->length*4/3];
+
+                    size_t comp = direct_fastlz_compress( chunk_write->ptr, chunk_write->length, buf );
+
+                    D_DEBUG_AT( Voodoo_Output, "  -> Compressed "_ZU"%% ("_ZU" -> "_ZU")\n",
+                                comp * 100 / chunk_write->length, chunk_write->length, comp );
+               }
+#endif
+
+               ret = link->SendReceive( link,
+                                        chunks_write.data(), chunks_write.size(),
+                                        chunks_read.data(), chunks_read.size() );
+               switch (ret) {
+                    case DR_OK:
+                         if (chunk_write && chunk_write->done) {
+                              D_DEBUG_AT( Voodoo_Output, "  -> Sent "_ZD"/"_ZD" bytes...\n", chunk_write->done, chunk_write->length );
+
+                              output.start += (size_t) chunk_write->done;
+
+                              //direct_mutex_lock( &output.lock );
+
+                              if (output.start == output.end) {
+                                   output.start = output.end = 0;
+
+                                   direct_waitqueue_broadcast( &output.wait );
+                              }
+
+                              //direct_mutex_unlock( &output.lock );
+                         }
+                         break;
+
+                    case DR_TIMEOUT:
+                         //D_WARN("timeout");
+                         break;
+
+                    case DR_INTERRUPTED:
+                         //D_WARN("interrupted");
+                         break;
+
+                    default:
+                         D_DERROR( ret, "Voodoo/Manager: Could not receive data!\n" );
+                         manager->handle_disconnect();
+                         break;
+               }
+
+               if (chunk_write)
+                    direct_mutex_unlock( &output.lock );
+
+
+
+               if (chunk_read && chunk_read->done) {
+                    D_DEBUG_AT( Voodoo_Input, "  -> Received "_ZD" bytes...\n", chunk_read->done );
+
+                    input.end += (size_t) chunk_read->done;
+
+                    do {
+                         VoodooPacketHeader *header;
+
+                         /* Get the packet header. */
+                         header = (VoodooPacketHeader *)(input.buffer + last);
+
+                         D_DEBUG_AT( Voodoo_Input, "  -> Next packet has %u bytes...\n", header->size );
+
+                         D_ASSERT( header->size >= (int) sizeof(VoodooMessageHeader) );
+                         D_ASSERT( header->size <= MAX_MSG_SIZE );
+
+                         if (sizeof(VoodooPacketHeader) + header->size > input.end - last) {
+                              D_DEBUG_AT( Voodoo_Input, "  -> ...fetching tail of message.\n" );
+
+                              /* Extend the buffer if the message doesn't fit into the default boundary. */
+                              if (sizeof(VoodooPacketHeader) + header->size > input.max - last) {
+                                   D_ASSERT( input.max == IN_BUF_MAX );
+
+
+                                   input.max = last + sizeof(VoodooPacketHeader) + header->size;
+                              }
+
+                              break;
+                         }
+
+                         last += sizeof(VoodooPacketHeader) + header->size;
+                    } while (last < input.end);
+
+                    if (last != input.last) {
+
+                         input.last = last;
+
+                         D_DEBUG_AT( Voodoo_Input, "  { START "_ZD", LAST "_ZD", END "_ZD", MAX "_ZD" }\n",
+                                     input.start, input.last, input.end, input.max );
+
+                         while (input.start < input.last) {
+                              /* Get the packet header. */
+                              VoodooPacketHeader *header = (VoodooPacketHeader *)(input.buffer + input.start);
+
+                              ProcessMessages( (VoodooMessageHeader *)(header + 1), header->uncompressed );
+
+                              input.start += header->size + sizeof(VoodooPacketHeader);
+                         }
+                    }
+               }
+          }
+     }
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+VoodooConnectionPacket::lock_output( int    length,
+                                     void **ret_ptr )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, length %d )\n", __func__, this, length );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+     D_ASSERT( length >= (int) sizeof(VoodooMessageHeader) );
+     D_ASSUME( length <= MAX_MSG_SIZE );
+     D_ASSERT( ret_ptr != NULL );
+
+     if (length > MAX_MSG_SIZE) {
+          D_WARN( "%d exceeds maximum message size of %d", length, MAX_MSG_SIZE );
+          return DR_LIMITEXCEEDED;
+     }
+
+     int aligned = VOODOO_MSG_ALIGN( length );
+
+     direct_mutex_lock( &output.lock );
+
+     while (output.end + aligned > OUT_BUF_MAX) {
+          link->WakeUp( link );
+
+          direct_waitqueue_wait( &output.wait, &output.lock );
+
+          if (manager->is_quit) {
+               direct_mutex_lock( &output.lock );
+               return DR_DESTROYED;
+          }
+     }
+
+     *ret_ptr = output.buffer + output.end;
+
+     D_DEBUG_AT( Voodoo_Output, "  -> offset "_ZD", aligned length %d\n", output.end, aligned );
+
+     output.end += aligned;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooConnectionPacket::unlock_output( bool flush )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, %sflush )\n", __func__, this, flush ? "" : "NO " );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_unlock( &output.lock );
+
+     if (flush)
+          link->WakeUp( link );
+
+     return DR_OK;
+}
+
+VoodooPacket *
+VoodooConnectionPacket::GetPacket( size_t length )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, length "_ZU" )\n", __func__, this, length );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+     D_ASSERT( length >= (int) sizeof(VoodooMessageHeader) );
+     D_ASSUME( length <= MAX_MSG_SIZE );
+
+     if (length > MAX_MSG_SIZE) {
+          D_WARN( _ZU" exceeds maximum message size of %d", length, MAX_MSG_SIZE );
+          return NULL;
+     }
+
+     int aligned = sizeof(VoodooPacketHeader) + VOODOO_MSG_ALIGN( length );
+
+     direct_mutex_lock( &output.lock );
+
+     while (output.end + aligned > OUT_BUF_MAX) {
+          link->WakeUp( link );
+
+          direct_waitqueue_wait( &output.wait, &output.lock );
+
+          if (manager->is_quit) {
+               direct_mutex_lock( &output.lock );
+               return NULL;
+          }
+     }
+
+     D_DEBUG_AT( Voodoo_Output, "  -> offset "_ZD", aligned length %d\n", output.end, aligned );
+
+     output.end += aligned;
+
+     return VoodooPacket::New( output.buffer + output.end - aligned, aligned - sizeof(VoodooPacketHeader) );
+}
+
+void
+VoodooConnectionPacket::PutPacket( VoodooPacket *packet, bool flush )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionPacket::%s( %p, %sflush )\n", __func__, this, flush ? "" : "NO " );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_unlock( &output.lock );
+
+     if (flush)
+          link->WakeUp( link );
+
+//     delete packet;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/connection_packet_old.h b/Source/DirectFB/lib/voodoo/connection_packet_old.h
new file mode 100755
index 0000000..cfb10bf
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_packet_old.h
@@ -0,0 +1,87 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONNECTION_PACKET_H__
+#define __VOODOO__CONNECTION_PACKET_H__
+
+#include <voodoo/connection.h>
+
+extern "C" {
+#include <direct/thread.h>
+}
+
+
+class VoodooConnectionPacket : public VoodooConnection {
+private:
+     DirectThread               *io;
+
+     struct {
+          DirectMutex            lock;
+          DirectWaitQueue        wait;
+          u8                    *buffer;
+          size_t                 start;
+          size_t                 last;
+          size_t                 end;
+          size_t                 max;
+     } input;
+
+     struct {
+          DirectMutex            lock;
+          DirectWaitQueue        wait;
+          u8                    *buffer;
+          size_t                 start;
+          size_t                 end;
+     } output;
+
+public:
+     VoodooConnectionPacket( VoodooManager *manager,
+                             VoodooLink    *link );
+
+     virtual ~VoodooConnectionPacket();
+
+
+     virtual DirectResult lock_output  ( int            length,
+                                         void         **ret_ptr );
+
+     virtual DirectResult unlock_output( bool           flush );
+
+
+     virtual VoodooPacket *GetPacket( size_t        length );
+     virtual void          PutPacket( VoodooPacket *packet,
+                                      bool          flush );
+
+
+private:
+     static void *io_loop_main ( DirectThread  *thread,
+                                 void          *arg );
+
+     void        *io_loop      ();
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/connection_raw.cpp b/Source/DirectFB/lib/voodoo/connection_raw.cpp
new file mode 100755
index 0000000..c6ba56a
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_raw.cpp
@@ -0,0 +1,341 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#ifdef VOODOO_CONNECTION_RAW_DUMP
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#endif
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection_raw.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+#include <vector>
+
+
+//namespace Voodoo {
+
+D_DEBUG_DOMAIN( Voodoo_Connection, "Voodoo/Connection", "Voodoo Connection" );
+D_DEBUG_DOMAIN( Voodoo_Input,      "Voodoo/Input",      "Voodoo Input" );
+D_DEBUG_DOMAIN( Voodoo_Output,     "Voodoo/Output",     "Voodoo Output" );
+
+/**********************************************************************************************************************/
+
+VoodooConnectionRaw::VoodooConnectionRaw( VoodooManager *manager,
+                                          VoodooLink    *link )
+     :
+     VoodooConnectionLink( manager, link ),
+     stop( false ),
+     closed( false )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p )\n", __func__, this );
+
+     if (link->code) {
+          input.end = 4;
+
+          memcpy( input.buffer, &link->code, sizeof(u32) );
+     }
+}
+
+VoodooConnectionRaw::~VoodooConnectionRaw()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+}
+
+void
+VoodooConnectionRaw::Start()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     io = direct_thread_create( DTT_DEFAULT, io_loop_main, this, "Voodoo IO" );
+}
+
+void
+VoodooConnectionRaw::Stop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooConnection );
+
+     direct_mutex_lock( &output.lock );
+
+     while (!closed && output.packets) {
+          D_DEBUG_AT( Voodoo_Connection, "  -> waiting for output packets to be sent...\n" );
+
+          direct_waitqueue_wait( &output.wait, &output.lock );
+     }
+
+     direct_mutex_unlock( &output.lock );
+
+     stop = true;
+
+     link->WakeUp( link );
+
+     /* Wait for manager threads exiting. */
+     direct_thread_join( io );
+     direct_thread_destroy( io );
+
+     VoodooConnectionLink::Stop();
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooConnectionRaw::io_loop()
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p )\n", __func__, this );
+
+#ifdef VOODOO_CONNECTION_RAW_DUMP
+     int dump_fd = open("voodoo_write.raw", O_TRUNC|O_CREAT|O_WRONLY, 0660 );
+     int dump_read_fd = open("voodoo_read.raw", O_TRUNC|O_CREAT|O_WRONLY, 0660 );
+#endif
+
+     while (!stop) {
+          D_MAGIC_ASSERT( this, VoodooConnection );
+
+          if (input.start == input.max) {
+               input.start = 0;
+               input.end   = 0;
+               input.last  = 0;
+               input.max   = VOODOO_CONNECTION_LINK_INPUT_BUF_MAX;
+          }
+
+          if (!stop) {
+               DirectResult  ret;
+               VoodooChunk   chunks[2];
+               VoodooChunk  *chunk_read  = NULL;
+               VoodooChunk  *chunk_write = NULL;
+               size_t        last        = input.last;
+               VoodooPacket *packet      = NULL;
+
+               std::vector<VoodooChunk> chunks_write;
+               std::vector<VoodooChunk> chunks_read;
+
+               if (!output.sending) {
+                    direct_mutex_lock( &output.lock );
+
+                    if (output.packets) {
+                         VoodooPacket *packet = (VoodooPacket*) output.packets;
+
+                         D_ASSERT( packet->sending );
+
+                         output.sending = packet;
+                         output.sent    = 0;
+                    }
+
+                    direct_mutex_unlock( &output.lock );
+               }
+
+               if (output.sending) {
+                    packet = output.sending;
+
+                    D_ASSERT( packet->sending );
+
+                    chunk_write = &chunks[1];
+
+                    chunk_write->ptr    = (char*) packet->data_start() + output.sent;
+                    chunk_write->length = VOODOO_MSG_ALIGN(packet->size()) - output.sent;
+                    chunk_write->done   = 0;
+
+                    chunks_write.push_back( chunks[1] );
+
+                    chunk_write = chunks_write.data();
+               }
+
+               if (input.end < input.max && manager->DispatchReady()) {
+                    chunk_read = &chunks[0];
+
+                    chunk_read->ptr    = input.buffer + input.end;
+                    chunk_read->length = input.max - input.end;
+                    chunk_read->done   = 0;
+
+                    chunks_read.push_back( chunks[0] );
+
+                    chunk_read = chunks_read.data();
+               }
+                    
+
+               ret = link->SendReceive( link,
+                                        chunks_write.data(), chunks_write.size(),
+                                        chunks_read.data(), chunks_read.size() );
+               switch (ret) {
+                    case DR_OK:
+                         if (chunk_write && chunk_write->done) {
+                              D_DEBUG_AT( Voodoo_Output, "  -> Sent "_ZD"/"_ZD" bytes...\n", chunk_write->done, chunk_write->length );
+
+#ifdef VOODOO_CONNECTION_RAW_DUMP
+                              write( dump_fd, chunk_write->ptr, chunk_write->done );
+#endif
+
+                              output.sent += chunk_write->done;
+
+                              if (output.sent == VOODOO_MSG_ALIGN(packet->size())) {
+                                   output.sending = NULL;
+
+                                   direct_mutex_lock( &output.lock );
+
+                                   packet->sending = false;
+
+                                   direct_list_remove( &output.packets, &packet->link );
+
+                                   direct_mutex_unlock( &output.lock );
+
+                                   direct_waitqueue_broadcast( &output.wait );
+                              }
+                         }
+                         break;
+
+                    case DR_TIMEOUT:
+                         //D_DEBUG_AT( Voodoo_Connection, "  -> timeout\n" );
+                         break;
+
+                    case DR_INTERRUPTED:
+                         D_DEBUG_AT( Voodoo_Connection, "  -> interrupted\n" );
+                         break;
+
+                    default:
+                         if (ret == DR_IO)
+                              D_DEBUG_AT( Voodoo_Connection, "  -> Connection closed!\n" );
+                         else
+						 {
+                              D_DERROR( ret, "Voodoo/ConnectionRaw: Could not receive data!\n" );
+							  exit(0);
+						 }
+
+                         closed = true;
+
+                         manager->handle_disconnect();
+
+                         return NULL;
+               }
+
+
+               if (chunk_read && chunk_read->done) {
+                    D_DEBUG_AT( Voodoo_Input, "  -> Received "_ZD" bytes...\n", chunk_read->done );
+
+#ifdef VOODOO_CONNECTION_RAW_DUMP
+                    write( dump_read_fd, chunk_read->ptr, chunk_read->done );
+#endif
+
+                    input.end += (size_t) chunk_read->done;
+
+                    do {
+                         VoodooMessageHeader *header;
+                         size_t               aligned;
+
+                         D_DEBUG_AT( Voodoo_Input, "  { LAST "_ZD", INPUT LAST "_ZD" }\n", last, input.last );
+
+                         if (input.end - last < 4) {
+                              D_DEBUG_AT( Voodoo_Input, "  -> ...only "_ZU" bytes left\n", input.end - last );
+                              break;
+                         }
+
+                         /* Get the message header. */
+                         header  = (VoodooMessageHeader *)(input.buffer + last);
+                         aligned = VOODOO_MSG_ALIGN( header->size );
+
+                         D_DEBUG_AT( Voodoo_Input, "  -> Next message has %d ("_ZD") bytes and is of type %d...\n",
+                                     header->size, aligned, header->type );
+
+                         D_ASSERT( header->size >= (int) sizeof(VoodooMessageHeader) );
+                         D_ASSERT( header->size <= MAX_MSG_SIZE );
+
+                         if (aligned > input.end - last) {
+                              D_DEBUG_AT( Voodoo_Input, "  -> ...fetching tail of message.\n" );
+
+                              /* Extend the buffer if the message doesn't fit into the default boundary. */
+                              if (aligned > input.max - last)
+                                   input.max = last + aligned;
+
+                              break;
+                         }
+
+                         last += aligned;
+                    } while (last < input.end);
+
+                    if (last != input.last) {
+                         input.last = last;
+
+                         D_DEBUG_AT( Voodoo_Input, "  { START "_ZD", LAST "_ZD", END "_ZD", MAX "_ZD" }\n",
+                                     input.start, input.last, input.end, input.max );
+
+                         // FIXME: don't copy, but read into packet directly, maybe call manager->GetPacket() at the top of this loop
+                         VoodooPacket *p = VoodooPacket::Copy( input.last - input.start, VPHF_NONE,
+                                                               input.last - input.start, input.buffer + input.start );
+
+                         manager->DispatchPacket( p );
+
+                         input.start = input.last;
+                    }
+               }
+          }
+     }
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooConnectionRaw::io_loop_main( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionRaw::%s( %p, thread %p )\n", __func__, arg, thread );
+
+     VoodooConnectionRaw *connection = (VoodooConnectionRaw*) arg;
+
+     return connection->io_loop();
+}
+
diff --git a/Source/DirectFB/lib/voodoo/connection_raw.h b/Source/DirectFB/lib/voodoo/connection_raw.h
new file mode 100755
index 0000000..45ce4c5
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/connection_raw.h
@@ -0,0 +1,60 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__CONNECTION_RAW_H__
+#define __VOODOO__CONNECTION_RAW_H__
+
+#include <voodoo/connection_link.h>
+
+
+class VoodooConnectionRaw : public VoodooConnectionLink {
+private:
+     DirectThread *io;
+     bool          stop;
+     bool          closed;
+
+public:
+     VoodooConnectionRaw( VoodooManager *manager,
+                          VoodooLink    *link );
+
+     virtual ~VoodooConnectionRaw();
+
+     virtual void Start();
+     virtual void Stop();
+
+
+private:
+     void *io_loop();
+
+
+     static void  *io_loop_main( DirectThread *thread,
+                                 void         *arg );
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/dispatcher.cpp b/Source/DirectFB/lib/voodoo/dispatcher.cpp
new file mode 100755
index 0000000..af98c0a
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/dispatcher.cpp
@@ -0,0 +1,231 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/link.h>
+#include <voodoo/message.h>
+}
+
+#include <voodoo/dispatcher.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+D_DEBUG_DOMAIN( Voodoo_Dispatcher, "Voodoo/Dispatcher", "Voodoo Dispatcher" );
+
+/**********************************************************************************************************************/
+
+VoodooDispatcher::VoodooDispatcher( VoodooManager *manager )
+     :
+     magic(0),
+     manager(manager),
+     packets(NULL)
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );
+
+     /* Initialize lock. */
+     direct_mutex_init( &lock );
+
+     /* Initialize wait queue. */
+     direct_waitqueue_init( &queue );
+
+     D_MAGIC_SET( this, VoodooDispatcher );
+
+
+     dispatch_loop = direct_thread_create( DTT_MESSAGING, DispatchLoopMain, this, "Voodoo Dispatch" );
+}
+
+VoodooDispatcher::~VoodooDispatcher()
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooDispatcher );
+
+     /* Acquire lock and wake up waiters. */
+     direct_mutex_lock( &lock );
+     direct_waitqueue_broadcast( &queue );
+     direct_mutex_unlock( &lock );
+
+     /* Wait for dispatcher loop exiting. */
+     direct_thread_join( dispatch_loop );
+     direct_thread_destroy( dispatch_loop );
+
+     /* Destroy queue. */
+     direct_waitqueue_deinit( &queue );
+
+     /* Destroy lock. */
+     direct_mutex_deinit( &lock );
+
+     D_MAGIC_CLEAR( this );
+}
+
+bool
+VoodooDispatcher::Ready()
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooDispatcher );
+
+     direct_mutex_lock( &lock );
+
+     bool ready = direct_list_count_elements_EXPENSIVE( packets ) < 3;
+
+     direct_mutex_unlock( &lock );
+
+     return ready;
+}
+
+void
+VoodooDispatcher::PutPacket( VoodooPacket *packet )
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p, packet %p )\n", __func__, this, packet );
+
+     D_MAGIC_ASSERT( this, VoodooDispatcher );
+
+     direct_mutex_lock( &lock );
+
+     direct_list_append( &packets, &packet->link );
+
+     direct_waitqueue_broadcast( &queue );
+
+     direct_mutex_unlock( &lock );
+}
+
+void
+VoodooDispatcher::ProcessMessages( VoodooMessageHeader *first,
+                                   size_t               total_length )
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p, first %p, total_length "_ZU" )\n",
+                 __func__, this, first, total_length );
+
+     D_MAGIC_ASSERT( this, VoodooDispatcher );
+
+     VoodooMessageHeader *header = first;
+     size_t               offset = 0;
+     size_t               aligned;
+
+     while (offset < total_length) {
+          /* Get the message header. */
+          header  = (VoodooMessageHeader *)((char*) first + offset);
+          aligned = VOODOO_MSG_ALIGN( header->size );
+
+          D_DEBUG_AT( Voodoo_Dispatcher, "  -> Next message has %d ("_ZU") bytes and is of type %d... (offset "_ZU"/"_ZU")\n",
+                      header->size, aligned, header->type, offset, total_length );
+
+          D_ASSERT( header->size >= (int) sizeof(VoodooMessageHeader) );
+          D_ASSERT( header->size <= MAX_MSG_SIZE );
+
+          D_ASSERT( offset + aligned <= total_length );
+
+          switch (header->type) {
+               case VMSG_SUPER:
+                    manager->handle_super( (VoodooSuperMessage*) header );
+                    break;
+
+               case VMSG_REQUEST:
+                    manager->handle_request( (VoodooRequestMessage*) header );
+                    break;
+
+               case VMSG_RESPONSE:
+                    manager->handle_response( (VoodooResponseMessage*) header );
+                    break;
+
+               default:
+                    D_BUG( "invalid message type %d", header->type );
+                    break;
+          }
+
+          offset += aligned;
+     }
+
+     D_ASSERT( offset == total_length );
+}
+
+/**********************************************************************************************************************/
+
+void *
+VoodooDispatcher::DispatchLoop()
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );
+
+     direct_mutex_lock( &lock );
+
+     while (!manager->is_quit) {
+          VoodooPacket *packet;
+
+          D_MAGIC_ASSERT( this, VoodooDispatcher );
+
+          if (packets) {
+               packet = (VoodooPacket*) packets;
+
+               direct_list_remove( &packets, &packet->link );
+
+               manager->link->WakeUp( manager->link );
+          }
+          else {
+               direct_waitqueue_wait( &queue, &lock );
+
+               continue;
+          }
+
+
+          direct_mutex_unlock( &lock );
+
+          ProcessMessages( (VoodooMessageHeader*) packet->data_start(), packet->size() );
+
+          D_FREE( packet );
+
+          direct_mutex_lock( &lock );
+     }
+
+     direct_mutex_unlock( &lock );
+
+     return NULL;
+}
+
+void *
+VoodooDispatcher::DispatchLoopMain( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p, thread %p )\n", __func__, arg, thread );
+
+     VoodooDispatcher *dispatcher = (VoodooDispatcher*) arg;
+
+     return dispatcher->DispatchLoop();
+}
+
diff --git a/Source/DirectFB/lib/voodoo/dispatcher.h b/Source/DirectFB/lib/voodoo/dispatcher.h
new file mode 100755
index 0000000..f0518db
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/dispatcher.h
@@ -0,0 +1,71 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__DISPATCHER_H__
+#define __VOODOO__DISPATCHER_H__
+
+extern "C" {
+#include <voodoo/types.h>
+}
+
+
+class VoodooDispatcher {
+private:
+     int                         magic;
+
+     VoodooManager              *manager;
+
+     DirectMutex                 lock;
+     DirectWaitQueue             queue;
+
+     DirectThread               *dispatch_loop;
+
+     DirectLink                 *packets;
+
+
+public:
+     VoodooDispatcher( VoodooManager *manager );
+
+     ~VoodooDispatcher();
+
+     bool Ready    ();
+     void PutPacket( VoodooPacket *packet );
+
+
+private:
+     void        *DispatchLoop();
+
+     static void *DispatchLoopMain( DirectThread        *thread,
+                                    void                *arg );
+
+     void         ProcessMessages ( VoodooMessageHeader *first,
+                                    size_t               total_length );
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/instance.cpp b/Source/DirectFB/lib/voodoo/instance.cpp
new file mode 100755
index 0000000..61bd20f
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/instance.cpp
@@ -0,0 +1,107 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/internal.h>
+}
+
+#include <voodoo/instance.h>
+#include <voodoo/manager.h>
+
+
+D_DEBUG_DOMAIN( Voodoo_Instance, "Voodoo/Instance", "Voodoo Instance" );
+
+/**********************************************************************************************************************/
+
+VoodooInstance::VoodooInstance()
+     :
+     magic(0),
+     refs(1)
+{
+     D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
+
+     D_MAGIC_SET( this, VoodooInstance );
+}
+
+VoodooInstance::~VoodooInstance()
+{
+     D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooInstance );
+
+
+     D_MAGIC_CLEAR( this );
+}
+
+void
+VoodooInstance::AddRef()
+{
+     D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooInstance );
+
+     D_ASSERT( refs > 0 );
+
+     refs++;
+}
+
+void
+VoodooInstance::Release()
+{
+     D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooInstance );
+
+     D_ASSERT( refs > 0 );
+
+     if (!--refs) {
+          D_DEBUG_AT( Voodoo_Instance, "  -> zero refs, deleting instance...\n" );
+
+          delete this;
+     }
+}
+
+DirectResult
+VoodooInstance::Dispatch( VoodooManager        *manager,
+                          VoodooRequestMessage *msg )
+{
+     D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p, manager %p, msg %p )\n", __func__, this, manager, msg );
+
+     D_MAGIC_ASSERT( this, VoodooInstance );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/instance.h b/Source/DirectFB/lib/voodoo/instance.h
new file mode 100755
index 0000000..a8b434c
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/instance.h
@@ -0,0 +1,61 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__INSTANCE_H__
+#define __VOODOO__INSTANCE_H__
+
+extern "C" {
+#include <voodoo/types.h>
+}
+
+
+class VoodooInstance {
+protected:
+     int                         magic;
+
+private:
+     unsigned int                refs;
+
+public:
+     VoodooInstance();
+
+protected:
+     virtual ~VoodooInstance();
+
+public:
+     void AddRef();
+     void Release();
+
+
+public:
+     virtual DirectResult Dispatch( VoodooManager        *manager,
+                                    VoodooRequestMessage *msg );
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/interface.c b/Source/DirectFB/lib/voodoo/interface.c
new file mode 100755
index 0000000..4281cb6
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/interface.c
@@ -0,0 +1,114 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/interface.h>
+
+
+DirectResult
+voodoo_construct_requestor( VoodooManager     *manager,
+                            const char        *name,
+                            VoodooInstanceID   instance,
+                            void              *arg,
+                            void             **ret_requestor )
+{
+     DirectResult          ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *requestor;
+
+     D_ASSERT( manager != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( instance != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_requestor != NULL );
+
+     ret = DirectGetInterface( &funcs, name, "Requestor", NULL, NULL );
+     if (ret) {
+          D_ERROR( "Voodoo/Interface: Could not load 'Requestor' implementation of '%s'!\n", name );
+          return ret;
+     }
+
+     ret = funcs->Allocate( &requestor );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( requestor, manager, instance, arg );
+     if (ret)
+          return ret;
+
+     *ret_requestor = requestor;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_construct_dispatcher( VoodooManager     *manager,
+                             const char        *name,
+                             void              *interface,
+                             VoodooInstanceID   super,
+                             void              *arg,
+                             VoodooInstanceID  *ret_instance,
+                             void             **ret_dispatcher )
+{
+     DirectResult          ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *dispatcher;
+     VoodooInstanceID      instance;
+
+     D_ASSERT( manager != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( interface != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     ret = DirectGetInterface( &funcs, name, "Dispatcher", NULL, NULL );
+     if (ret) {
+          D_ERROR( "Voodoo/Interface: Could not load 'Dispatcher' implementation of '%s'!\n", name );
+          return ret;
+     }
+
+     ret = funcs->Allocate( &dispatcher );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( dispatcher, interface, manager, super, arg, &instance );
+     if (ret)
+          return ret;
+
+     *ret_instance = instance;
+
+     if (ret_dispatcher)
+          *ret_dispatcher = dispatcher;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/interface.h b/Source/DirectFB/lib/voodoo/interface.h
new file mode 100755
index 0000000..8b1a47b
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/interface.h
@@ -0,0 +1,52 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__INTERFACE_H__
+#define __VOODOO__INTERFACE_H__
+
+#include <voodoo/types.h>
+
+
+DirectResult
+voodoo_construct_requestor( VoodooManager     *manager,
+                            const char        *name,
+                            VoodooInstanceID   instance,
+                            void              *arg,
+                            void             **ret_interface );
+
+DirectResult
+voodoo_construct_dispatcher( VoodooManager     *manager,
+                             const char        *name,
+                             void              *interface,
+                             VoodooInstanceID   super,
+                             void              *arg,
+                             VoodooInstanceID  *ret_instance,
+                             void             **ret_dispatcher );
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/internal.h b/Source/DirectFB/lib/voodoo/internal.h
new file mode 100755
index 0000000..4eae9b0
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/internal.h
@@ -0,0 +1,40 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__INTERNAL_H__
+#define __VOODOO__INTERNAL_H__
+
+#include <voodoo/types.h>
+
+
+DirectResult VOODOO_API voodoo_server_construct( VoodooServer         *server,
+                                                 VoodooManager        *manager,
+                                                 const char           *name,
+                                                 VoodooInstanceID     *ret_instance );
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/ivoodooplayer.c b/Source/DirectFB/lib/voodoo/ivoodooplayer.c
new file mode 100755
index 0000000..2324667
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/ivoodooplayer.c
@@ -0,0 +1,247 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include <semaphore.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <directfb_version.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/internal.h>
+#include <voodoo/manager.h>
+#include <voodoo/play_server.h>
+#include <voodoo/ivoodooplayer.h>
+
+
+D_DEBUG_DOMAIN( IVoodooPlayer_, "IVoodooPlayer", "IVoodooPlayer" );
+
+/**********************************************************************************************************************/
+
+static DirectResult CreateRemote( const char *host, int session, IVoodooPlayer **ret_interface );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int            ref;
+} IVoodooPlayer_data;
+
+static DirectResult
+IVoodooPlayer_AddRef( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA( IVoodooPlayer );
+
+     data->ref++;
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_Release( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA( IVoodooPlayer );
+
+     if (!--data->ref)
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_GetApps( IVoodooPlayer        *thiz,
+                       unsigned int          max_num,
+                       unsigned int         *ret_num,
+                       VoodooAppDescription *ret_applications )
+{
+     D_DEBUG_AT( IVoodooPlayer_, "%s()\n", __func__ );
+
+     if (!max_num || !ret_num || !ret_applications)
+          return DR_INVARG;
+
+     return voodoo_player_get_apps( voodoo_player, max_num, ret_num, ret_applications );
+}
+
+static DirectResult
+IVoodooPlayer_LaunchApp( IVoodooPlayer *thiz,
+                         const u8       app_uuid[16],
+                         const u8       player_uuid[16],
+                         u8             ret_instance_uuid[16] )
+{
+     D_DEBUG_AT( IVoodooPlayer_, "%s()\n", __func__ );
+
+     if (!app_uuid || !player_uuid || !ret_instance_uuid)
+          return DR_INVARG;
+
+     return voodoo_player_launch_app( voodoo_player, app_uuid, player_uuid, ret_instance_uuid );
+}
+
+static DirectResult
+IVoodooPlayer_StopInstance( IVoodooPlayer *thiz,
+                            const u8       instance_uuid[16] )
+{
+     D_DEBUG_AT( IVoodooPlayer_, "%s()\n", __func__ );
+
+     if (!instance_uuid)
+          return DR_INVARG;
+
+     return voodoo_player_stop_instance( voodoo_player, instance_uuid );
+}
+
+static DirectResult
+IVoodooPlayer_WaitInstance( IVoodooPlayer *thiz,
+                            const u8       instance_uuid[16] )
+{
+     D_DEBUG_AT( IVoodooPlayer_, "%s()\n", __func__ );
+
+     if (!instance_uuid)
+          return DR_INVARG;
+
+     return voodoo_player_wait_instance( voodoo_player, instance_uuid );
+}
+
+static DirectResult
+IVoodooPlayer_GetInstances( IVoodooPlayer                *thiz,
+                            unsigned int                  max_num,
+                            unsigned int                 *ret_num,
+                            VoodooAppInstanceDescription *ret_instances )
+{
+     D_DEBUG_AT( IVoodooPlayer_, "%s()\n", __func__ );
+
+     if (!max_num || !ret_num || !ret_instances)
+          return DR_INVARG;
+
+     return voodoo_player_get_instances( voodoo_player, max_num, ret_num, ret_instances );
+}
+
+static DirectResult
+IVoodooPlayer_Construct( IVoodooPlayer *thiz )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IVoodooPlayer );
+
+     data->ref = 1;
+
+     thiz->AddRef       = IVoodooPlayer_AddRef;
+     thiz->Release      = IVoodooPlayer_Release;
+     thiz->GetApps      = IVoodooPlayer_GetApps;
+     thiz->LaunchApp    = IVoodooPlayer_LaunchApp;
+     thiz->StopInstance = IVoodooPlayer_StopInstance;
+     thiz->WaitInstance = IVoodooPlayer_WaitInstance;
+     thiz->GetInstances = IVoodooPlayer_GetInstances;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooPlayerCreate( IVoodooPlayer **ret_interface )
+{
+     DirectResult   ret;
+     IVoodooPlayer *player;
+
+     if (!ret_interface)
+          return DR_INVARG;
+
+     if (dfb_config->remote.host)
+          return CreateRemote( dfb_config->remote.host, dfb_config->remote.session, ret_interface );
+
+     if (!voodoo_player)
+          return DR_NOSUCHINSTANCE;
+
+     DIRECT_ALLOCATE_INTERFACE( player, IVoodooPlayer );
+
+     ret = IVoodooPlayer_Construct( player );
+     if (ret)
+          return ret;
+
+     *ret_interface = player;
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+CreateRemote( const char *host, int session, IVoodooPlayer **ret_interface )
+{
+     DFBResult             ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *interface;
+
+     D_ASSERT( host != NULL );
+     D_ASSERT( ret_interface != NULL );
+
+     ret = DirectGetInterface( &funcs, "IVoodooPlayer", "Requestor", NULL, NULL );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( &interface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( interface, host, session );
+     if (ret)
+          return ret;
+
+     *ret_interface = interface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/ivoodooplayer.h b/Source/DirectFB/lib/voodoo/ivoodooplayer.h
new file mode 100755
index 0000000..ae1ef03
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/ivoodooplayer.h
@@ -0,0 +1,74 @@
+/*
+   (c) Copyright 2001-2010  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IVOODOOPLAYER_H__
+#define __IVOODOOPLAYER_H__
+
+#include <voodoo/app.h>
+
+
+DECLARE_INTERFACE( IVoodooPlayer );
+
+DEFINE_INTERFACE( IVoodooPlayer,
+
+     DirectResult (*GetApps)(
+          IVoodooPlayer                 *thiz,
+          unsigned int                   max_num,
+          unsigned int                  *ret_num,
+          VoodooAppDescription          *ret_applications
+     );
+
+     DirectResult (*LaunchApp)(
+          IVoodooPlayer                 *thiz,
+          const u8                       app_uuid[16],
+          const u8                       player_uuid[16],
+          u8                             ret_instance_uuid[16]
+     );
+
+     DirectResult (*StopInstance)(
+          IVoodooPlayer                 *thiz,
+          const u8                       instance_uuid[16]
+     );
+
+     DirectResult (*WaitInstance)(
+          IVoodooPlayer                 *thiz,
+          const u8                       instance_uuid[16]
+     );
+
+     DirectResult (*GetInstances)(
+          IVoodooPlayer                 *thiz,
+          unsigned int                   max_num,
+          unsigned int                  *ret_num,
+          VoodooAppInstanceDescription  *ret_instances
+     );
+);
+
+
+DirectResult VoodooPlayerCreate( IVoodooPlayer **ret_interface );
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.c b/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.c
new file mode 100755
index 0000000..bcf4711
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.c
@@ -0,0 +1,359 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/ivoodooplayer.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include "ivoodooplayer_dispatcher.h"
+
+static DirectResult Probe( void );
+static DirectResult Construct( IVoodooPlayer    *thiz,
+                               VoodooManager    *manager,
+                               VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IVoodooPlayer, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IVoodooPlayer_Dispatcher
+ */
+typedef struct {
+     int                    ref;          /* reference counter */
+
+     IVoodooPlayer         *real;
+
+     VoodooInstanceID       self;         /* The instance of this dispatcher itself. */
+} IVoodooPlayer_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IVoodooPlayer_Dispatcher_Destruct( IVoodooPlayer *thiz )
+{
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IVoodooPlayer_Dispatcher_AddRef( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     data->ref++;
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_Dispatcher_Release( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     if (--data->ref == 0)
+          IVoodooPlayer_Dispatcher_Destruct( thiz );
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_Dispatcher_GetApps( IVoodooPlayer        *thiz,
+                                  unsigned int          max_num,
+                                  unsigned int         *ret_num,
+                                  VoodooAppDescription *ret_applications )
+{
+     return DR_UNIMPLEMENTED;
+}
+
+static DirectResult
+IVoodooPlayer_Dispatcher_LaunchApp( IVoodooPlayer *thiz,
+                                    const u8       app_uuid[16],
+                                    const u8       player_uuid[16],
+                                    u8             ret_instance_uuid[16] )
+{
+     return DR_UNIMPLEMENTED;
+}
+
+static DirectResult
+IVoodooPlayer_Dispatcher_StopInstance( IVoodooPlayer *thiz,
+                                       const u8       instance_uuid[16] )
+{
+     return DR_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_GetApps( IVoodooPlayer *thiz, IVoodooPlayer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     unsigned int          max_num;
+     VoodooMessageParser   parser;
+     unsigned int          num;
+     VoodooAppDescription *apps;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, max_num );
+     VOODOO_PARSER_END( parser );
+
+     if (max_num > 1000)
+          return DR_LIMITEXCEEDED;
+
+     apps = D_MALLOC( max_num * sizeof(VoodooAppDescription) );
+     if (!apps)
+          return D_OOM();
+
+     ret = real->GetApps( real, max_num, &num, apps );
+     if (ret == DR_OK) {
+          if (num > 0) {
+               ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                             ret, VOODOO_INSTANCE_NONE,
+                                             VMBT_UINT, num,
+                                             VMBT_DATA, num * sizeof(VoodooAppDescription), apps,
+                                             VMBT_NONE );
+          }
+          else {
+               ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                             ret, VOODOO_INSTANCE_NONE,
+                                             VMBT_UINT, num,
+                                             VMBT_NONE );
+          }
+     }
+
+     D_FREE( apps );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_LaunchApp( IVoodooPlayer *thiz, IVoodooPlayer *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult             ret;
+     VoodooMessageParser      parser;
+     const u8                *app_uuid;
+     const u8                *player_uuid;
+     u8                       instance_uuid[16];
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, app_uuid );
+     VOODOO_PARSER_GET_DATA( parser, player_uuid );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->LaunchApp( real, app_uuid, player_uuid, instance_uuid );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, 16, instance_uuid,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_StopInstance( IVoodooPlayer *thiz, IVoodooPlayer *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const u8            *instance_uuid;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, instance_uuid );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->StopInstance( real, instance_uuid );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_WaitInstance( IVoodooPlayer *thiz, IVoodooPlayer *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const u8            *instance_uuid;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, instance_uuid );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->WaitInstance( real, instance_uuid );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetInstances( IVoodooPlayer *thiz, IVoodooPlayer *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                  ret;
+     unsigned int                  max_num;
+     VoodooMessageParser           parser;
+     unsigned int                  num;
+     VoodooAppInstanceDescription *instances;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, max_num );
+     VOODOO_PARSER_END( parser );
+
+     if (max_num > 1000)
+          return DR_LIMITEXCEEDED;
+
+     instances = D_MALLOC( max_num * sizeof(VoodooAppInstanceDescription) );
+     if (!instances)
+          return D_OOM();
+
+     ret = real->GetInstances( real, max_num, &num, instances );
+     if (ret == DR_OK) {
+          if (num > 0) {
+               ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                             ret, VOODOO_INSTANCE_NONE,
+                                             VMBT_UINT, num,
+                                             VMBT_DATA, num * sizeof(VoodooAppInstanceDescription), instances,
+                                             VMBT_NONE );
+          }
+          else {
+               ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                             ret, VOODOO_INSTANCE_NONE,
+                                             VMBT_UINT, num,
+                                             VMBT_NONE );
+          }
+     }
+
+     D_FREE( instances );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IVoodooPlayer/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IVOODOOPLAYER_METHOD_ID_GetApps:
+               return Dispatch_GetApps( dispatcher, real, manager, msg );
+
+          case IVOODOOPLAYER_METHOD_ID_LaunchApp:
+               return Dispatch_LaunchApp( dispatcher, real, manager, msg );
+
+          case IVOODOOPLAYER_METHOD_ID_StopInstance:
+               return Dispatch_StopInstance( dispatcher, real, manager, msg );
+
+          case IVOODOOPLAYER_METHOD_ID_WaitInstance:
+               return Dispatch_WaitInstance( dispatcher, real, manager, msg );
+
+          case IVOODOOPLAYER_METHOD_ID_GetInstances:
+               return Dispatch_GetInstances( dispatcher, real, manager, msg );
+     }
+
+     return DR_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DR_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DirectResult
+Construct( IVoodooPlayer *thiz, VoodooManager *manager, VoodooInstanceID *ret_instance )
+{
+     DirectResult      ret;
+     IVoodooPlayer    *real;
+     VoodooInstanceID  instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IVoodooPlayer_Dispatcher)
+
+     ret = VoodooPlayerCreate( &real );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, thiz, real, Dispatch, &instance );
+     if (ret) {
+          real->Release( real );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     data->ref  = 1;
+     data->real = real;
+     data->self = instance;
+
+     thiz->AddRef       = IVoodooPlayer_Dispatcher_AddRef;
+     thiz->Release      = IVoodooPlayer_Dispatcher_Release;
+     thiz->GetApps      = IVoodooPlayer_Dispatcher_GetApps;
+     thiz->LaunchApp    = IVoodooPlayer_Dispatcher_LaunchApp;
+     thiz->StopInstance = IVoodooPlayer_Dispatcher_StopInstance;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.h b/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.h
new file mode 100755
index 0000000..a01d0d9
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/ivoodooplayer_dispatcher.h
@@ -0,0 +1,41 @@
+/*
+   (c) Copyright 2001-2010  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IVOODOOPLAYER_DISPATCHER_H__
+#define __IVOODOOPLAYER_DISPATCHER_H__
+
+#define IVOODOOPLAYER_METHOD_ID_AddRef       1
+#define IVOODOOPLAYER_METHOD_ID_Release      2
+#define IVOODOOPLAYER_METHOD_ID_GetApps      3
+#define IVOODOOPLAYER_METHOD_ID_LaunchApp    4
+#define IVOODOOPLAYER_METHOD_ID_StopInstance 5
+#define IVOODOOPLAYER_METHOD_ID_WaitInstance 6
+#define IVOODOOPLAYER_METHOD_ID_GetInstances 7
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/ivoodooplayer_requestor.c b/Source/DirectFB/lib/voodoo/ivoodooplayer_requestor.c
new file mode 100755
index 0000000..1ffdcf9
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/ivoodooplayer_requestor.c
@@ -0,0 +1,330 @@
+/*
+   (c) Copyright 2001-2010  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/ivoodooplayer.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include "ivoodooplayer_dispatcher.h"
+
+
+static DirectResult Probe( void );
+static DirectResult Construct( IVoodooPlayer *thiz, const char *host, int session );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IVoodooPlayer, Requestor )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IVoodooPlayer_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooClient        *client;
+     VoodooManager       *manager;
+
+     VoodooInstanceID     instance;
+} IVoodooPlayer_Requestor_data;
+
+/**************************************************************************************************/
+
+static void
+IVoodooPlayer_Requestor_Destruct( IVoodooPlayer *thiz )
+{
+     IVoodooPlayer_Requestor_data *data = thiz->priv;
+
+	D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_client_destroy( data->client );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IVoodooPlayer_Requestor_AddRef( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     data->ref++;
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_Release( IVoodooPlayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     if (--data->ref == 0)
+          IVoodooPlayer_Requestor_Destruct( thiz );
+
+     return DR_OK;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_GetApps( IVoodooPlayer        *thiz,
+                                 unsigned int          max_num,
+                                 unsigned int         *ret_num,
+                                 VoodooAppDescription *ret_applications )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     if (!max_num || !ret_num || !ret_applications)
+          return DR_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IVOODOOPLAYER_METHOD_ID_GetApps, VREQ_RESPOND, &response,
+                                   VMBT_UINT, max_num,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+          unsigned int        num;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_UINT( parser, num );
+
+          if (num > max_num)
+               num = max_num;
+
+          *ret_num = num;
+
+          if (num > 0)
+               VOODOO_PARSER_READ_DATA( parser, ret_applications, num * sizeof(VoodooAppDescription) );
+
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_LaunchApp( IVoodooPlayer *thiz,
+                                   const u8       app_uuid[16],
+                                   const u8       player_uuid[16],
+                                   u8             ret_instance_uuid[16] )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     if (!app_uuid || !player_uuid || !ret_instance_uuid)
+          return DR_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IVOODOOPLAYER_METHOD_ID_LaunchApp, VREQ_RESPOND, &response,
+                                   VMBT_DATA, 16, app_uuid,
+                                   VMBT_DATA, 16, player_uuid,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_READ_DATA( parser, ret_instance_uuid, 16 );
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_StopInstance( IVoodooPlayer *thiz,
+                                      const u8       instance_uuid[16] )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     if (!instance_uuid)
+          return DR_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IVOODOOPLAYER_METHOD_ID_StopInstance, VREQ_RESPOND, &response,
+                                   VMBT_DATA, 16, instance_uuid,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_WaitInstance( IVoodooPlayer *thiz,
+                                      const u8       instance_uuid[16] )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     if (!instance_uuid)
+          return DR_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IVOODOOPLAYER_METHOD_ID_WaitInstance, VREQ_RESPOND, &response,
+                                   VMBT_DATA, 16, instance_uuid,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DirectResult
+IVoodooPlayer_Requestor_GetInstances( IVoodooPlayer                *thiz,
+                                      unsigned int                  max_num,
+                                      unsigned int                 *ret_num,
+                                      VoodooAppInstanceDescription *ret_instances )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     if (!max_num || !ret_num || !ret_instances)
+          return DR_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA(IVoodooPlayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IVOODOOPLAYER_METHOD_ID_GetInstances, VREQ_RESPOND, &response,
+                                   VMBT_UINT, max_num,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+          unsigned int        num;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_UINT( parser, num );
+
+          if (num > max_num)
+               num = max_num;
+
+          *ret_num = num;
+
+          if (num > 0)
+               VOODOO_PARSER_READ_DATA( parser, ret_instances, num * sizeof(VoodooAppInstanceDescription) );
+
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DR_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DirectResult
+Construct( IVoodooPlayer *thiz, const char *host, int session )
+{
+     DirectResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IVoodooPlayer_Requestor)
+
+     data->ref = 1;
+
+     ret = voodoo_client_create( host, session, &data->client );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->manager = voodoo_client_manager( data->client );
+
+     ret = voodoo_manager_super( data->manager, "IVoodooPlayer", &data->instance );
+     if (ret) {
+          voodoo_client_destroy( data->client );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     thiz->AddRef       = IVoodooPlayer_Requestor_AddRef;
+     thiz->Release      = IVoodooPlayer_Requestor_Release;
+     thiz->GetApps      = IVoodooPlayer_Requestor_GetApps;
+     thiz->LaunchApp    = IVoodooPlayer_Requestor_LaunchApp;
+     thiz->StopInstance = IVoodooPlayer_Requestor_StopInstance;
+     thiz->WaitInstance = IVoodooPlayer_Requestor_WaitInstance;
+     thiz->GetInstances = IVoodooPlayer_Requestor_GetInstances;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/link.h b/Source/DirectFB/lib/voodoo/link.h
new file mode 100755
index 0000000..e54b1d4
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/link.h
@@ -0,0 +1,78 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__LINK_H__
+#define __VOODOO__LINK_H__
+
+#include <voodoo/types.h>
+
+
+typedef struct {
+     void   *ptr;
+     size_t  length;
+     size_t  done;
+} VoodooChunk;
+
+
+struct __V_VoodooLink {
+     void *priv;
+     u32   code;
+
+     void    (*Close)( VoodooLink *link );
+
+     /* See 'read(2)', blocking */
+     ssize_t (*Read) ( VoodooLink *link,
+                       void       *buffer,
+                       size_t      count );
+
+     /* See 'write(2)', blocking */
+     ssize_t (*Write)( VoodooLink *link,
+                       const void *buffer,
+                       size_t      count );
+
+
+     /* For later... */
+     DirectResult (*SendReceive)( VoodooLink  *link,
+                                  VoodooChunk *send,
+                                  size_t       num_send,
+                                  VoodooChunk *recv,
+                                  size_t       num_recv );
+
+     DirectResult (*WakeUp)     ( VoodooLink  *link );
+};
+
+
+DirectResult VOODOO_API voodoo_link_init_connect( VoodooLink *link,
+                                                  const char *hostname,
+                                                  int         port,
+                                                  bool        raw );
+
+DirectResult VOODOO_API voodoo_link_init_fd     ( VoodooLink *link,
+                                                  int         fd[2] );
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/manager.cpp b/Source/DirectFB/lib/voodoo/manager.cpp
new file mode 100755
index 0000000..3b2f70c
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/manager.cpp
@@ -0,0 +1,937 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <algorithm>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+}
+
+#include <voodoo/connection_packet.h>
+#include <voodoo/connection_raw.h>
+#include <voodoo/dispatcher.h>
+#include <voodoo/manager.h>
+#include <voodoo/packet.h>
+
+
+//namespace Voodoo {
+
+D_DEBUG_DOMAIN( Voodoo_Dispatch, "Voodoo/Dispatch", "Voodoo Dispatch" );
+D_DEBUG_DOMAIN( Voodoo_Manager,  "Voodoo/Manager",  "Voodoo Manager" );
+
+/**********************************************************************************************************************/
+
+VoodooManager::VoodooManager( VoodooLink    *link,
+                              VoodooContext *context )
+     :
+     magic(0),
+     is_quit(false),
+     msg_count(0),
+     msg_serial(0)
+{
+     D_ASSERT( link != NULL );
+
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     /* Store link and context */
+     this->link    = link;
+     this->context = context;
+
+
+     instances.last   = 0;
+
+     response.current = NULL;
+
+
+     /* Initialize all locks. */
+     direct_recursive_mutex_init( &instances.lock );
+     direct_recursive_mutex_init( &response.lock );
+
+     /* Initialize all wait conditions. */
+     direct_waitqueue_init( &response.wait_get );
+     direct_waitqueue_init( &response.wait_put );
+
+     D_MAGIC_SET( this, VoodooManager );
+
+
+     dispatcher = new VoodooDispatcher( this );
+
+
+     /* Add connection */
+     if ((link->code & 0x8000ffff) == 0x80008676) {
+          D_INFO( "Voodoo/Manager: Connection mode is PACKET\n" );
+
+          connection = new VoodooConnectionPacket( this, link );
+     }
+     else {
+          D_INFO( "Voodoo/Manager: Connection mode is RAW\n" );
+
+          connection = new VoodooConnectionRaw( this, link );
+
+          // FIXME: query manager dynamically for compression instead
+          voodoo_config->compression_min = 0;
+     }
+
+     connection->Start();
+}
+
+static void
+instance_iterator( std::pair<VoodooInstanceID,VoodooInstance*> pair )
+{
+     D_DEBUG_AT( Voodoo_Manager, "%s( id %u, instance %p )\n", __func__, pair.first, pair.second );
+
+     pair.second->Release();
+}
+
+VoodooManager::~VoodooManager()
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+
+     if (!is_quit)
+          quit();
+
+     connection->Stop();
+
+     /* Destroy dispatcher */
+     delete dispatcher;
+
+     /* Remove connection */
+     delete connection;
+
+     /* Destroy conditions. */
+     direct_waitqueue_deinit( &response.wait_get );
+     direct_waitqueue_deinit( &response.wait_put );
+
+     /* Destroy locks. */
+     direct_mutex_deinit( &instances.lock );
+     direct_mutex_deinit( &response.lock );
+
+     /* Release all remaining interfaces. */
+     std::for_each( instances.remote.begin(), instances.remote.end(), instance_iterator );
+     std::for_each( instances.local.begin(), instances.local.end(), instance_iterator );
+
+     D_MAGIC_CLEAR( this );
+}
+
+/**********************************************************************************************************************/
+
+void
+VoodooManager::DispatchPacket( VoodooPacket *packet )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p, packet %p )\n", __func__, this, packet );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSUME( !is_quit );
+
+     if (is_quit)
+          return;
+
+     dispatcher->PutPacket( packet );
+}
+
+bool
+VoodooManager::DispatchReady()
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+//     D_ASSUME( !is_quit );
+
+     if (is_quit)
+          return false;
+
+     return dispatcher->Ready();
+}
+
+/**********************************************************************************************************************/
+
+void
+VoodooManager::quit()
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSUME( !is_quit );
+
+     if (is_quit)
+          return;
+
+     /* Have all threads quit upon this. */
+     is_quit = true;
+
+     /* Acquire locks and wake up waiters. */
+     direct_mutex_lock( &response.lock );
+     direct_waitqueue_broadcast( &response.wait_get );
+     direct_waitqueue_broadcast( &response.wait_put );
+     direct_mutex_unlock( &response.lock );
+}
+
+void
+VoodooManager::handle_disconnect()
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Remote site disconnected from manager at %p!\n", this );
+
+     quit();
+}
+
+void
+VoodooManager::handle_super( VoodooSuperMessage *super )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     DirectResult  ret;
+     const char   *name;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( super != NULL );
+     D_ASSERT( super->header.size >= (int) sizeof(VoodooSuperMessage) );
+     D_ASSERT( super->header.type == VMSG_SUPER );
+
+     name = (const char *) (super + 1);
+
+     D_DEBUG_AT( Voodoo_Dispatch, "  -> Handling SUPER message %llu for '%s' (%d bytes).\n",
+                 (unsigned long long)super->header.serial, name, super->header.size );
+
+     VoodooInstanceID instance_id;
+
+     ret = context->HandleSuper( this, name, &instance_id );
+     if (ret)
+          do_respond( true, super->header.serial, ret );
+     else
+          do_respond( true, super->header.serial, DR_OK, instance_id );
+}
+
+typedef struct {
+     VoodooManager        *manager;
+     VoodooInstance       *instance;
+     VoodooRequestMessage *request;
+} DispatchAsyncContext;
+
+void *
+VoodooManager::dispatch_async_thread( DirectThread *thread,
+                                      void         *arg )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, arg );
+
+     DirectResult          ret;
+     DispatchAsyncContext *context  = (DispatchAsyncContext*) arg;
+     VoodooManager        *manager  = context->manager;
+     VoodooInstance       *instance = context->instance;
+     VoodooRequestMessage *request  = context->request;
+
+     ret = instance->Dispatch( manager, request );
+
+     if (ret && (request->flags & VREQ_RESPOND))
+          manager->do_respond( true, request->header.serial, ret );
+
+     D_FREE( context );
+
+     return NULL;
+}
+
+void
+VoodooManager::handle_request( VoodooRequestMessage *request )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     DirectResult    ret;
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( request != NULL );
+     D_ASSERT( request->header.size >= (int) sizeof(VoodooRequestMessage) );
+     D_ASSERT( request->header.type == VMSG_REQUEST );
+
+     D_DEBUG_AT( Voodoo_Dispatch, "  -> Handling REQUEST message %llu to %u::%u %s%s(%d bytes).\n",
+                 (unsigned long long)request->header.serial, request->instance, request->method,
+                 (request->flags & VREQ_RESPOND) ? "[RESPONDING] " : "",
+                 (request->flags & VREQ_ASYNC) ? "[ASYNC] " : "",
+                 request->header.size );
+
+     direct_mutex_lock( &instances.lock );
+
+     InstanceMap::iterator itr = instances.local.find( request->instance );
+
+     if (itr == instances.local.end()) {
+          direct_mutex_unlock( &instances.lock );
+
+          D_ERROR( "Voodoo/Dispatch: "
+                   "Requested instance %u doesn't exist (anymore)!\n", request->instance );
+
+          if (request->flags & VREQ_RESPOND)
+               do_respond( true, request->header.serial, DR_NOSUCHINSTANCE );
+
+          return;
+     }
+
+     instance = (*itr).second;
+
+     if (request->flags & VREQ_ASYNC) {
+          DirectThread         *thread;
+          DispatchAsyncContext *context;
+
+          context = (DispatchAsyncContext*) D_MALLOC( sizeof(DispatchAsyncContext) + request->header.size );
+          if (!context) {
+               D_WARN( "out of memory" );
+               direct_mutex_unlock( &instances.lock );
+               return;
+          }
+
+          context->manager  = this;
+          context->instance = instance;
+          context->request  = (VoodooRequestMessage*) (context + 1);
+
+          direct_memcpy( context->request, request, request->header.size );
+
+          thread = direct_thread_create( DTT_DEFAULT, dispatch_async_thread, context, "Voodoo Async" );
+          direct_thread_detach( thread );
+          // FIXME: free thread?
+     }
+     else {
+          ret = instance->Dispatch( this, request );
+
+          if (ret && (request->flags & VREQ_RESPOND))
+               do_respond( true, request->header.serial, ret );
+     }
+
+     direct_mutex_unlock( &instances.lock );
+}
+
+void
+VoodooManager::handle_response( VoodooResponseMessage *msg )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( msg != NULL );
+     D_ASSERT( msg->header.size >= (int) sizeof(VoodooResponseMessage) );
+     D_ASSERT( msg->header.type == VMSG_RESPONSE );
+     D_ASSERT( msg->request < msg_serial );
+
+     D_DEBUG_AT( Voodoo_Dispatch, "  -> Handling RESPONSE message %llu (%s) with instance %u for request "
+                 "%llu (%d bytes).\n", (unsigned long long)msg->header.serial, DirectResultString( msg->result ),
+                 msg->instance, (unsigned long long)msg->request, msg->header.size );
+
+     direct_mutex_lock( &response.lock );
+
+     D_ASSERT( response.current == NULL );
+
+     response.current = msg;
+
+     direct_mutex_unlock( &response.lock );
+
+
+     direct_waitqueue_broadcast( &response.wait_get );
+
+     direct_mutex_lock( &response.lock );
+
+     while (response.current && !is_quit)
+          direct_waitqueue_wait( &response.wait_put, &response.lock );
+
+     direct_mutex_unlock( &response.lock );
+}
+
+/**************************************************************************************************/
+
+DirectResult
+VoodooManager::lock_response( VoodooMessageSerial     request,
+                              VoodooResponseMessage **ret_response )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooResponseMessage *msg = NULL;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( ret_response != NULL );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Locking response to request %llu...\n", (unsigned long long)request );
+
+     direct_mutex_lock( &response.lock );
+
+     while (!is_quit) {
+          msg = response.current;
+          if (msg && msg->request == request)
+               break;
+
+          if (msg)
+               D_DEBUG_AT( Voodoo_Manager, "  -> ...current response is for request %llu...\n", (unsigned long long)msg->request );
+
+          D_DEBUG_AT( Voodoo_Manager, "  -> ...(still) waiting for response to request %llu...\n", (unsigned long long)request );
+
+          direct_waitqueue_wait( &response.wait_get, &response.lock );
+     }
+
+     if (is_quit) {
+          D_ERROR( "Voodoo/Manager: Quit while waiting for response!\n" );
+          direct_mutex_unlock( &response.lock );
+          return DR_DESTROYED;
+     }
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> ...locked response %llu to request %llu (%d bytes).\n",
+                 (unsigned long long)msg->header.serial, (unsigned long long)request, msg->header.size );
+
+     *ret_response = msg;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::unlock_response( VoodooResponseMessage *msg )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( msg != NULL );
+     D_ASSERT( msg == response.current );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Unlocking response %llu to request %llu (%d bytes)...\n",
+                 (unsigned long long)msg->header.serial, (unsigned long long)msg->request, msg->header.size );
+
+     response.current = NULL;
+
+     direct_mutex_unlock( &response.lock );
+
+     direct_waitqueue_broadcast( &response.wait_put );
+
+     return DR_OK;
+}
+
+
+
+
+DirectResult
+VoodooManager::do_super( const char       *name,
+                         VoodooInstanceID *ret_instance )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     DirectResult           ret;
+     int                    len;
+     int                    size;
+     VoodooPacket          *packet;
+     VoodooMessageSerial    serial;
+     VoodooSuperMessage    *msg;
+     VoodooResponseMessage *response;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( name != NULL );
+     D_ASSERT( ret_instance != NULL );
+
+     if (is_quit) {
+          D_DEBUG_AT( Voodoo_Manager, "  -> QUIT!\n" );
+          return DR_IO;
+     }
+
+     /* Calculate the total message size. */
+     len  = strlen( name ) + 1;
+     size = sizeof(VoodooSuperMessage) + len;
+
+
+     /* Lock the output buffer for direct writing. */
+     packet = connection->GetPacket( size );
+     if (!packet)
+          return DR_FAILURE;
+
+     msg = (VoodooSuperMessage*) packet->data_raw();
+
+     serial = msg_serial++;
+
+     /* Fill message header. */
+     msg->header.size   = size;
+     msg->header.serial = serial;
+     msg->header.type   = VMSG_SUPER;
+
+     /* Append the name of the super interface to create. */
+     direct_memcpy( msg + 1, name, len );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Sending SUPER message %llu for '%s' (%d bytes).\n", (unsigned long long)serial, name, size );
+
+     /* Unlock the output buffer. */
+     connection->PutPacket( packet, true );
+
+
+     /* Wait for and lock the response buffer. */
+     ret = lock_response( serial, &response );
+     if (ret) {
+          D_ERROR( "Voodoo/Manager: "
+                   "Waiting for the response failed (%s)!\n", DirectResultString( ret ) );
+          return ret;
+     }
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Got response %llu (%s) with instance %u for request %llu "
+                 "(%d bytes).\n", (unsigned long long)response->header.serial, DirectResultString( ret ),
+                 response->instance, (unsigned long long)response->request, response->header.size );
+
+     ret = response->result;
+     if (ret) {
+          D_ERROR( "Voodoo/Manager: Could not create remote super interface '%s' (%s)!\n",
+                   name, DirectResultString( ret ) );
+          unlock_response( response );
+          return ret;
+     }
+
+     D_INFO( "Voodoo/Manager: Created remote super interface '%s'.\n", name );
+
+     /* Return the new instance ID. */
+     *ret_instance = response->instance;
+
+     /* Unlock the response buffer. */
+     unlock_response( response );
+
+     return DR_OK;
+}
+
+void
+VoodooManager::write_blocks( void                     *dst,
+                             const VoodooMessageBlock *blocks,
+                             size_t                    num )
+{
+     size_t  i;
+     u32    *d32 = (u32*) dst;
+
+     for (i=0; i<num; i++) {
+          /* Write block type and length. */
+          d32[0] = blocks[i].type;
+          d32[1] = blocks[i].len;
+
+          /* Write block content. */
+          if (blocks[i].ptr) {
+               u32 *s32 = (u32*) blocks[i].ptr;
+
+               switch (blocks[i].len) {
+                    case 16:
+                         d32[5] = s32[3];
+                    case 12:
+                         d32[4] = s32[2];
+                    case 8:
+                         d32[3] = s32[1];
+                    case 4:
+                         d32[2] = s32[0];
+                         break;
+
+                    default:
+                         direct_memcpy( &d32[2], blocks[i].ptr, blocks[i].len );
+               }
+          }
+          else if (blocks[i].len) {
+               D_ASSERT( blocks[i].len == 4 );
+
+               d32[2] = blocks[i].val;
+          }
+
+          /* Advance message data pointer. */
+          d32 += 2 + (VOODOO_MSG_ALIGN(blocks[i].len) >> 2);
+     }
+
+     /* Write terminator. */
+     d32[0] = VMBT_NONE;
+}
+
+DirectResult
+VoodooManager::do_request( VoodooInstanceID         instance,
+                           VoodooMethodID           method,
+                           VoodooRequestFlags       flags,
+                           VoodooResponseMessage  **ret_response,
+                           VoodooMessageBlock      *blocks,
+                           size_t                   num_blocks,
+                           size_t                   data_size )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     DirectResult          ret;
+     size_t                size;
+     VoodooPacket         *packet;
+     VoodooMessageSerial   serial;
+     VoodooRequestMessage *msg;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( instance != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_response != NULL || !(flags & VREQ_RESPOND) );
+     D_ASSUME( (flags & (VREQ_RESPOND | VREQ_QUEUE)) != (VREQ_RESPOND | VREQ_QUEUE) );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Instance %u, method %u, flags 0x%08x...\n", instance, method, flags );
+
+     if (is_quit) {
+          D_DEBUG_AT( Voodoo_Manager, "  -> QUIT!\n" );
+          return DR_IO;
+     }
+
+     /* Calculate the total message size. */
+     size = sizeof(VoodooRequestMessage) + data_size;
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> complete message size: %d\n", size );
+
+     /* Lock the output buffer for direct writing. */
+     packet = connection->GetPacket( size );
+     if (!packet)
+          return DR_FAILURE;
+
+     msg = (VoodooRequestMessage*) packet->data_raw();
+
+     serial = msg_serial++;
+
+     /* Fill message header. */
+     msg->header.size   = size;
+     msg->header.serial = serial;
+     msg->header.type   = VMSG_REQUEST;
+
+     /* Fill message body. */
+     msg->instance = instance;
+     msg->method   = method;
+     msg->flags    = flags;
+
+     /* Append custom data. */
+     write_blocks( msg + 1, blocks, num_blocks );
+
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Sending REQUEST message %llu to %u::%u %s(%d bytes).\n",
+                 (unsigned long long)serial, instance, method, (flags & VREQ_RESPOND) ? "[RESPONDING] " : "", size );
+
+     /* Unlock the output buffer. */
+     connection->PutPacket( packet, !(flags & VREQ_QUEUE) );
+
+     /* Wait for and lock the response buffer. */
+     if (flags & VREQ_RESPOND) {
+          VoodooResponseMessage *response;
+
+          ret = lock_response( serial, &response );
+          if (ret) {
+               D_ERROR( "Voodoo/Manager: "
+                        "Waiting for the response failed (%s)!\n", DirectResultString( ret ) );
+               return ret;
+          }
+
+          D_DEBUG_AT( Voodoo_Manager, "  -> Got response %llu (%s) with instance %u for request %llu "
+                      "(%d bytes).\n", (unsigned long long)response->header.serial, DirectResultString( response->result ),
+                      response->instance, (unsigned long long)response->request, response->header.size );
+
+          *ret_response = response;
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::next_response( VoodooResponseMessage  *response,
+                              VoodooResponseMessage **ret_response )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     DirectResult        ret;
+     VoodooMessageSerial serial;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( response != NULL );
+
+     serial = response->request;
+
+     /* Unlock the response buffer. */
+     unlock_response( response );
+
+     ret = lock_response( serial, &response );
+     if (ret) {
+          D_ERROR( "Voodoo/Manager: "
+                   "Waiting for the response failed (%s)!\n", DirectResultString( ret ) );
+          return ret;
+     }
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Got response %llu (%s) with instance %u for request %llu "
+                 "(%d bytes).\n", (unsigned long long)response->header.serial, DirectResultString( response->result ),
+                 response->instance, (unsigned long long)response->request, response->header.size );
+
+     *ret_response = response;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::finish_request( VoodooResponseMessage *response )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( response != NULL );
+
+     /* Unlock the response buffer. */
+     return unlock_response( response );
+}
+
+DirectResult
+VoodooManager::do_respond( bool                 flush,
+                           VoodooMessageSerial  request,
+                           DirectResult         result,
+                           VoodooInstanceID     instance,
+                           VoodooMessageBlock  *blocks,
+                           size_t               num_blocks,
+                           size_t               data_size )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     size_t                 size;
+     VoodooPacket          *packet;
+     VoodooMessageSerial    serial;
+     VoodooResponseMessage *msg;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Request %llu, result %d, instance %u...\n", (unsigned long long)request, result, instance );
+
+     if (is_quit) {
+          D_DEBUG_AT( Voodoo_Manager, "  -> QUIT!\n" );
+          return DR_IO;
+     }
+
+     /* Calculate the total message size. */
+     size = sizeof(VoodooResponseMessage) + data_size;
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> complete message size: %d\n", size );
+
+
+     /* Lock the output buffer for direct writing. */
+     packet = connection->GetPacket( size );
+     if (!packet)
+          return DR_FAILURE;
+
+     msg = (VoodooResponseMessage*) packet->data_raw();
+
+     serial = msg_serial++;
+
+     /* Fill message header. */
+     msg->header.size   = size;
+     msg->header.serial = serial;
+     msg->header.type   = VMSG_RESPONSE;
+
+     /* Fill message body. */
+     msg->request  = request;
+     msg->result   = result;
+     msg->instance = instance;
+
+     /* Append custom data. */
+     write_blocks( msg + 1, blocks, num_blocks );
+
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Sending RESPONSE message %llu (%s) with instance %u for request %llu (%d bytes).\n",
+                 (unsigned long long)serial, DirectResultString( result ), instance, (unsigned long long)request, size );
+
+     /* Unlock the output buffer. */
+     connection->PutPacket( packet, flush );
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::register_local( VoodooInstance   *instance,
+                               VoodooInstanceID *ret_instance )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooInstanceID instance_id;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( instance != NULL );
+     D_ASSERT( ret_instance != NULL );
+
+     instance->AddRef();
+
+     direct_mutex_lock( &instances.lock );
+
+     instance_id = ++instances.last;
+
+     instances.local[instance_id] = instance;
+
+     direct_mutex_unlock( &instances.lock );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Added local instance %u (%p)\n", instance_id, instance );
+
+     *ret_instance = instance_id;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::unregister_local( VoodooInstanceID instance_id )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+
+     direct_mutex_lock( &instances.lock );
+
+     InstanceMap::iterator itr = instances.local.find( instance_id );
+
+     if (itr == instances.local.end()) {
+          direct_mutex_unlock( &instances.lock );
+          return DR_NOSUCHINSTANCE;
+     }
+
+     instance = (*itr).second;
+
+     instances.local.erase( itr );
+
+     direct_mutex_unlock( &instances.lock );
+
+     instance->Release();
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::lookup_local( VoodooInstanceID   instance_id,
+                             VoodooInstance   **ret_instance )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( instance_id != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     direct_mutex_lock( &instances.lock );
+
+     InstanceMap::iterator itr = instances.local.find( instance_id );
+
+     direct_mutex_unlock( &instances.lock );
+
+     if (itr == instances.local.end())
+          return DR_NOSUCHINSTANCE;
+
+     instance = (*itr).second;
+
+     // FIXME: addref?
+
+     *ret_instance = instance;
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::register_remote( VoodooInstance   *instance,
+                                VoodooInstanceID  instance_id )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( instance != NULL );
+     D_ASSERT( instance_id != VOODOO_INSTANCE_NONE );
+
+     instance->AddRef();
+
+     direct_mutex_lock( &instances.lock );
+
+     instances.remote[instance_id] = instance;
+
+     direct_mutex_unlock( &instances.lock );
+
+     D_DEBUG_AT( Voodoo_Manager, "  -> Added remote instance %u (%p)\n", instance_id, instance );
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::unregister_remote( VoodooInstanceID instance_id )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+
+     direct_mutex_lock( &instances.lock );
+
+     InstanceMap::iterator itr = instances.remote.find( instance_id );
+
+     if (itr == instances.remote.end()) {
+          direct_mutex_unlock( &instances.lock );
+          return DR_NOSUCHINSTANCE;
+     }
+
+     instance = (*itr).second;
+
+     instances.remote.erase( itr );
+
+     direct_mutex_unlock( &instances.lock );
+
+     instance->Release();
+
+     return DR_OK;
+}
+
+DirectResult
+VoodooManager::lookup_remote( VoodooInstanceID   instance_id,
+                              VoodooInstance   **ret_instance )
+{
+     D_DEBUG_AT( Voodoo_Manager, "VoodooManager::%s( %p )\n", __func__, this );
+
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( this, VoodooManager );
+     D_ASSERT( instance_id != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     direct_mutex_lock( &instances.lock );
+
+     InstanceMap::iterator itr = instances.remote.find( instance_id );
+
+     direct_mutex_unlock( &instances.lock );
+
+     if (itr == instances.remote.end())
+          return DR_NOSUCHINSTANCE;
+
+     instance = (*itr).second;
+
+     // FIXME: addref?
+
+     *ret_instance = instance;
+
+     return DR_OK;
+}
+
+//}
+
diff --git a/Source/DirectFB/lib/voodoo/manager.h b/Source/DirectFB/lib/voodoo/manager.h
new file mode 100755
index 0000000..ae3189b
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/manager.h
@@ -0,0 +1,279 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__MANAGER_H__
+#define __VOODOO__MANAGER_H__
+
+#include <voodoo/types.h>
+#include <voodoo/message.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#include <direct/interface.h>
+#include <direct/thread.h>
+}
+
+#include <map>
+
+#include <voodoo/instance.h>
+
+
+typedef struct {
+     VoodooMessageBlockType  type;
+     unsigned int            len;
+     void                   *ptr;
+     u32                     val;
+} VoodooMessageBlock;
+
+
+typedef std::map<VoodooInstanceID,VoodooInstance*> InstanceMap;
+
+
+class VoodooDispatcher;
+
+
+class VoodooContext {
+public:
+     virtual DirectResult HandleSuper( VoodooManager    *manager,
+                                       const char       *name,
+                                       VoodooInstanceID *ret_instance ) = 0;
+};
+
+
+class VoodooManager {
+public:
+     int                         magic;
+
+     bool                        is_quit;
+
+private:
+     friend class VoodooDispatcher;
+
+     VoodooLink                 *link;
+     VoodooConnection           *connection;
+
+     VoodooContext              *context;
+
+     size_t                      msg_count;
+     VoodooMessageSerial         msg_serial;
+
+     struct {
+          DirectMutex            lock;
+          InstanceMap            local;
+          InstanceMap            remote;
+          VoodooInstanceID       last;
+     } instances;
+
+     struct {
+          DirectMutex            lock;
+          DirectWaitQueue        wait_get;
+          DirectWaitQueue        wait_put;
+          VoodooResponseMessage *current;
+     } response;
+
+
+     VoodooDispatcher *dispatcher;
+
+
+
+public:
+     VoodooManager( VoodooLink    *link,
+                    VoodooContext *context );
+     ~VoodooManager();
+
+
+     /** New API **/
+
+     void         DispatchPacket       ( VoodooPacket            *packet );
+     bool         DispatchReady        ();   // FIXME: will be obsolete with GetPacket() method, called by connection code to read directly into packet
+
+
+
+     /** Old API **/
+
+     void         quit                 ();
+
+
+     void         handle_disconnect    ();
+     void         handle_super         ( VoodooSuperMessage      *super );
+
+     void         handle_request       ( VoodooRequestMessage    *request );
+     void         handle_response      ( VoodooResponseMessage   *response );
+
+
+private:
+     static void *dispatch_async_thread( DirectThread            *thread,
+                                         void                    *arg );
+
+
+
+
+public:
+     DirectResult do_super             ( const char              *name,
+                                         VoodooInstanceID        *ret_instance );
+
+     DirectResult do_request           ( VoodooInstanceID         instance,
+                                         VoodooMethodID           method,
+                                         VoodooRequestFlags       flags,
+                                         VoodooResponseMessage  **ret_response,
+                                         VoodooMessageBlock      *blocks = NULL,
+                                         size_t                   num_blocks = 0,
+                                         size_t                   data_size = 0 );
+
+     DirectResult next_response        ( VoodooResponseMessage   *response,
+                                         VoodooResponseMessage  **ret_response );
+
+     DirectResult finish_request       ( VoodooResponseMessage   *response );
+
+     DirectResult do_respond           ( bool                     flush,
+                                         VoodooMessageSerial      request,
+                                         DirectResult             result,
+                                         VoodooInstanceID         instance = VOODOO_INSTANCE_NONE,
+                                         VoodooMessageBlock      *blocks = NULL,
+                                         size_t                   num_blocks = 0,
+                                         size_t                   data_size = 0 );
+
+private:
+     inline void  write_blocks         ( void                     *dst,
+                                         const VoodooMessageBlock *blocks,
+                                         size_t                    num_blocks );
+
+     DirectResult lock_response        ( VoodooMessageSerial      request,
+                                         VoodooResponseMessage  **ret_response );
+
+     DirectResult unlock_response      ( VoodooResponseMessage   *response );
+
+
+public:
+     DirectResult register_local       ( VoodooInstance          *instance,
+                                         VoodooInstanceID        *ret_instance );
+
+     DirectResult unregister_local     ( VoodooInstanceID         instance_id );
+
+     DirectResult lookup_local         ( VoodooInstanceID         instance_id,
+                                         VoodooInstance         **ret_instance );
+
+     DirectResult register_remote      ( VoodooInstance          *instance,
+                                         VoodooInstanceID         instance_id );
+
+     DirectResult unregister_remote    ( VoodooInstanceID         instance_id );
+
+     DirectResult lookup_remote        ( VoodooInstanceID         instance_id,
+                                         VoodooInstance         **ret_instance );
+};
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DirectResult VOODOO_API voodoo_manager_create         ( VoodooLink              *link,
+                                                        VoodooClient            *client,
+                                                        VoodooServer            *server,
+                                                        VoodooManager          **ret_manager );
+
+DirectResult VOODOO_API voodoo_manager_quit           ( VoodooManager           *manager );
+
+bool         VOODOO_API voodoo_manager_is_closed      ( const VoodooManager     *manager );
+
+DirectResult VOODOO_API voodoo_manager_destroy        ( VoodooManager           *manager );
+
+
+/* Super */
+
+DirectResult VOODOO_API voodoo_manager_super          ( VoodooManager           *manager,
+                                                        const char              *name,
+                                                        VoodooInstanceID        *ret_instance );
+
+
+/* Request */
+
+DirectResult VOODOO_API voodoo_manager_request        ( VoodooManager           *manager,
+                                                        VoodooInstanceID         instance,
+                                                        VoodooMethodID           method,
+                                                        VoodooRequestFlags       flags,
+                                                        VoodooResponseMessage  **ret_response, ... );
+
+DirectResult VOODOO_API voodoo_manager_next_response  ( VoodooManager           *manager,
+                                                        VoodooResponseMessage   *response,
+                                                        VoodooResponseMessage  **ret_response );
+
+DirectResult VOODOO_API voodoo_manager_finish_request ( VoodooManager           *manager,
+                                                        VoodooResponseMessage   *response );
+
+
+/* Response */
+
+DirectResult VOODOO_API voodoo_manager_respond        ( VoodooManager           *manager,
+                                                        bool                     flush,
+                                                        VoodooMessageSerial      request,
+                                                        DirectResult             result,
+                                                        VoodooInstanceID         instance, ... );
+
+
+/* Instances */
+
+DirectResult VOODOO_API voodoo_manager_register_local ( VoodooManager           *manager,
+                                                        VoodooInstanceID         super,
+                                                        void                    *dispatcher,
+                                                        void                    *real,
+                                                        VoodooDispatch           dispatch,
+                                                        VoodooInstanceID        *ret_instance_id );
+
+DirectResult VOODOO_API voodoo_manager_unregister_local( VoodooManager           *manager,
+                                                         VoodooInstanceID         instance_id );
+
+DirectResult VOODOO_API voodoo_manager_lookup_local   ( VoodooManager           *manager,
+                                                        VoodooInstanceID         instance,
+                                                        void                   **ret_dispatcher,
+                                                        void                   **ret_real );
+
+DirectResult VOODOO_API voodoo_manager_register_remote( VoodooManager           *manager,
+                                                        bool                     super,
+                                                        void                    *requestor,
+                                                        VoodooInstanceID         instance );
+
+DirectResult VOODOO_API voodoo_manager_lookup_remote  ( VoodooManager           *manager,
+                                                        VoodooInstanceID         instance,
+                                                        void                   **ret_requestor );
+
+
+/* Security */
+
+DirectResult VOODOO_API voodoo_manager_check_allocation( VoodooManager           *manager,
+                                                         unsigned int             amount );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/manager_c.cpp b/Source/DirectFB/lib/voodoo/manager_c.cpp
new file mode 100755
index 0000000..7019da8
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/manager_c.cpp
@@ -0,0 +1,553 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <list>
+
+#include <stdarg.h>
+
+extern "C" {
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/server.h>
+}
+
+#include <voodoo/manager.h>
+
+
+D_DEBUG_DOMAIN( Voodoo_Manager,  "Voodoo/Manager",  "Voodoo Manager" );
+
+/**********************************************************************************************************************/
+
+
+#define VOODOO_MANAGER_MESSAGE_BLOCKS_MAX 20
+
+static __inline__ int
+calc_blocks( va_list args,
+             VoodooMessageBlock *ret_blocks, size_t *ret_num )
+{
+     int                    size = 4;  /* for the terminating VMBT_NONE */
+     size_t                 num  = 0;
+     VoodooMessageBlockType type;
+
+     /* Fetch first block type. */
+     type = (VoodooMessageBlockType) va_arg( args, int );
+
+     while (type != VMBT_NONE) {
+          if (num == VOODOO_MANAGER_MESSAGE_BLOCKS_MAX) {
+               // FIXME: support more blocks?
+               D_UNIMPLEMENTED();
+               break;
+          }
+
+          /* Set message block type. */
+          ret_blocks[num].type = type;
+
+          switch (type) {
+               case VMBT_ID:
+                    ret_blocks[num].len = 4;
+                    ret_blocks[num].ptr = NULL;
+                    ret_blocks[num].val = va_arg( args, u32 );
+
+                    D_DEBUG( "Voodoo/Message: + ID %u\n", ret_blocks[num].val );
+                    break;
+
+               case VMBT_INT:
+                    ret_blocks[num].len = 4;
+                    ret_blocks[num].ptr = NULL;
+                    ret_blocks[num].val = va_arg( args, s32 );
+
+                    D_DEBUG( "Voodoo/Message: + INT %d\n", ret_blocks[num].val );
+                    break;
+
+               case VMBT_UINT:
+                    ret_blocks[num].len = 4;
+                    ret_blocks[num].ptr = NULL;
+                    ret_blocks[num].val = va_arg( args, u32 );
+
+                    D_DEBUG( "Voodoo/Message: + UINT %u\n", ret_blocks[num].val );
+                    break;
+
+               case VMBT_DATA:
+                    ret_blocks[num].len = va_arg( args, int );
+                    ret_blocks[num].ptr = va_arg( args, void * );
+
+//                    D_ASSERT( ret_blocks[num].len > 0 );
+                    D_ASSERT( ret_blocks[num].ptr != NULL );
+
+                    D_DEBUG( "Voodoo/Message: + DATA at %p with length %d\n", ret_blocks[num].ptr, ret_blocks[num].len );
+                    break;
+
+               case VMBT_ODATA:
+                    ret_blocks[num].len = va_arg( args, int );
+                    ret_blocks[num].ptr = va_arg( args, void * );
+
+                    D_ASSERT( ret_blocks[num].len > 0 );
+
+                    D_DEBUG( "Voodoo/Message: + ODATA at %p with length %d\n", ret_blocks[num].ptr, ret_blocks[num].len );
+
+                    if (!ret_blocks[num].ptr)
+                         ret_blocks[num].len = 0;
+                    break;
+
+               case VMBT_STRING:
+                    ret_blocks[num].ptr = va_arg( args, char * );
+                    ret_blocks[num].len = strlen( (const char*) ret_blocks[num].ptr ) + 1;
+
+                    D_ASSERT( ret_blocks[num].ptr != NULL );
+
+                    D_DEBUG( "Voodoo/Message: + STRING '%s' at %p with length %d\n", (char*) ret_blocks[num].ptr, ret_blocks[num].ptr, ret_blocks[num].len );
+                    break;
+
+               default:
+                    D_BREAK( "unknown message block type" );
+          }
+
+          /* Fetch next block type. */
+          type = (VoodooMessageBlockType) va_arg( args, int );
+
+          size += 8 + VOODOO_MSG_ALIGN(ret_blocks[num].len);
+
+          num++;
+     }
+
+     *ret_num = num;
+
+     return size;
+}
+
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+/* Old C API
+ */
+
+/*
+
+
+register add refs proxy
+unregister releases proxy
+
+proxy destruct releases real
+
+*/
+
+class VoodooInstanceInterface : public VoodooInstance {
+public:
+     VoodooManager  *manager;
+     VoodooInstance *super;
+     IAny           *proxy;
+     IAny           *real;
+     VoodooDispatch  dispatch;
+
+
+     static std::list<VoodooInstanceInterface*> interfaces;
+
+
+public:
+     VoodooInstanceInterface( VoodooManager  *manager,
+                              VoodooInstance *super,
+                              IAny           *proxy,
+                              IAny           *real,
+                              VoodooDispatch  dispatch )
+          :
+          manager( manager ),
+          super( super ),
+          proxy( proxy ),
+          real( real ),
+          dispatch( dispatch )
+     {
+          D_DEBUG_AT( Voodoo_Manager, "VoodooInstanceInterface::%s( %p, manager %p, super %p, proxy %p, real %p, dispatch %p )\n",
+                      __func__, this, manager, super, proxy, real, dispatch );
+
+          if (super)
+               super->AddRef();
+
+          interfaces.push_back( this );
+     }
+
+protected:
+     virtual ~VoodooInstanceInterface()
+     {
+          D_DEBUG_AT( Voodoo_Manager, "VoodooInstanceInterface::%s( %p )\n", __func__, this );
+
+          D_MAGIC_ASSERT( this, VoodooInstance );
+
+          if (proxy) {
+               D_DEBUG_AT( Voodoo_Manager, "  -> releasing proxy interface\n" );
+
+               proxy->Release( proxy );
+          }
+
+
+          if (super) {
+               D_DEBUG_AT( Voodoo_Manager, "  -> releasing super instance\n" );
+
+               super->Release();
+          }
+
+          interfaces.remove( this );
+     }
+
+public:
+     virtual DirectResult
+     Dispatch( VoodooManager        *manager,
+               VoodooRequestMessage *msg )
+     {
+          D_DEBUG_AT( Voodoo_Manager, "VoodooInstanceInterface::%s( %p, manager %p, msg %p )\n", __func__, this, manager, msg );
+
+          D_MAGIC_ASSERT( this, VoodooInstance );
+
+          D_ASSERT( dispatch != NULL );
+
+          return dispatch( proxy, real, manager, msg );
+     }
+};
+
+std::list<VoodooInstanceInterface*> VoodooInstanceInterface::interfaces;
+
+/**********************************************************************************************************************/
+
+class VoodooContextClassic : public VoodooContext {
+private:
+     VoodooServer *server;
+
+public:
+     VoodooContextClassic( VoodooServer *server )
+          :
+          server( server )
+     {
+     }
+
+     virtual DirectResult
+     HandleSuper( VoodooManager *manager, const char *name, VoodooInstanceID *ret_instance )
+     {
+          return voodoo_server_construct( server, manager, name, ret_instance );
+     }
+};
+
+DirectResult
+voodoo_manager_create( VoodooLink     *link,
+                       VoodooClient   *client,
+                       VoodooServer   *server,
+                       VoodooManager **ret_manager )
+{
+     D_ASSERT( ret_manager != NULL );
+
+     *ret_manager = new VoodooManager( link, new VoodooContextClassic( server ) );  // FIXME: leak
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_manager_quit( VoodooManager *manager )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     manager->quit();
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_manager_destroy( VoodooManager *manager )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     delete manager;
+
+     for (std::list<VoodooInstanceInterface*>::const_iterator iter = VoodooInstanceInterface::interfaces.begin();
+          iter != VoodooInstanceInterface::interfaces.end(); iter++)
+     {
+          VoodooInstanceInterface *instance = *iter;
+
+          if (instance->manager == manager)
+               D_INFO( "Zombie: Instance %p, proxy %p, real %p, super %p\n", instance, instance->proxy, instance->real, instance->super );
+     }
+
+     return DR_OK;
+}
+
+bool
+voodoo_manager_is_closed( const VoodooManager *manager )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     return manager->is_quit;
+}
+
+/**************************************************************************************************/
+
+DirectResult
+voodoo_manager_super( VoodooManager    *manager,
+                      const char       *name,
+                      VoodooInstanceID *ret_instance )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     return manager->do_super( name, ret_instance );
+}
+
+DirectResult
+voodoo_manager_request( VoodooManager           *manager,
+                        VoodooInstanceID         instance,
+                        VoodooMethodID           method,
+                        VoodooRequestFlags       flags,
+                        VoodooResponseMessage  **ret_response, ... )
+{
+     DirectResult ret;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     va_list ap;
+
+     va_start( ap, ret_response );
+
+
+     VoodooMessageBlock    blocks[VOODOO_MANAGER_MESSAGE_BLOCKS_MAX];
+     size_t                num_blocks;
+     size_t                data_size;
+
+     data_size = calc_blocks( ap, blocks, &num_blocks );
+
+
+     ret = manager->do_request( instance, method, flags, ret_response, blocks, num_blocks, data_size );
+
+     va_end( ap );
+
+     return ret;
+}
+
+DirectResult
+voodoo_manager_next_response( VoodooManager          *manager,
+                              VoodooResponseMessage  *response,
+                              VoodooResponseMessage **ret_response )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     return manager->next_response( response, ret_response );
+}
+
+DirectResult
+voodoo_manager_finish_request( VoodooManager         *manager,
+                               VoodooResponseMessage *response )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     return manager->finish_request( response );
+}
+
+DirectResult
+voodoo_manager_respond( VoodooManager          *manager,
+                        bool                    flush,
+                        VoodooMessageSerial     request,
+                        DirectResult            result,
+                        VoodooInstanceID        instance, ... )
+{
+     DirectResult ret;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     va_list ap;
+
+     va_start( ap, instance );
+
+
+     VoodooMessageBlock    blocks[VOODOO_MANAGER_MESSAGE_BLOCKS_MAX];
+     size_t                num_blocks;
+     size_t                data_size;
+
+     data_size = calc_blocks( ap, blocks, &num_blocks );
+
+
+     ret = manager->do_respond( flush, request, result, instance, blocks, num_blocks, data_size );
+
+     va_end( ap );
+
+     return ret;
+}
+
+DirectResult
+voodoo_manager_register_local( VoodooManager    *manager,
+                               VoodooInstanceID  super,
+                               void             *dispatcher,
+                               void             *real,
+                               VoodooDispatch    dispatch,
+                               VoodooInstanceID *ret_instance )
+{
+     DirectResult    ret;
+     VoodooInstance *super_instance = NULL;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     if (super != VOODOO_INSTANCE_NONE) {
+          ret = manager->lookup_local( super, &super_instance );
+          if (ret) {
+               D_DERROR( ret, "Voodoo/Manager: Could not lookup super instance %u!\n", super );
+               return ret;
+          }
+     }
+
+
+     VoodooInstanceInterface *instance = new VoodooInstanceInterface( manager, super_instance, (IAny*) dispatcher, (IAny*) real, dispatch );
+
+     ret = manager->register_local( instance, ret_instance );
+
+     instance->Release();
+
+     return ret;
+}
+
+DirectResult
+voodoo_manager_unregister_local( VoodooManager    *manager,
+                                 VoodooInstanceID  instance_id )
+{
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     return manager->unregister_local( instance_id );
+}
+
+DirectResult
+voodoo_manager_lookup_local( VoodooManager     *manager,
+                             VoodooInstanceID   instance_id,
+                             void             **ret_dispatcher,
+                             void             **ret_real )
+{
+     DirectResult    ret;
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     ret = manager->lookup_local( instance_id, &instance );
+     if (ret)
+          return ret;
+
+     if (ret_dispatcher)
+          *ret_dispatcher = ((VoodooInstanceInterface*) instance)->proxy;
+
+     if (ret_real)
+          *ret_real = ((VoodooInstanceInterface*) instance)->real;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_manager_register_remote( VoodooManager    *manager,
+                                bool              super,
+                                void             *requestor,
+                                VoodooInstanceID  instance_id )
+{
+     DirectResult ret;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     VoodooInstanceInterface *instance = new VoodooInstanceInterface( manager, NULL, (IAny*) requestor, NULL, NULL);
+
+     ret = manager->register_remote( instance, instance_id );
+
+     instance->Release();
+
+     return ret;
+}
+
+
+DirectResult
+voodoo_manager_lookup_remote( VoodooManager     *manager,
+                              VoodooInstanceID   instance_id,
+                              void             **ret_requestor )
+{
+     DirectResult    ret;
+     VoodooInstance *instance;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     ret = manager->lookup_remote( instance_id, &instance );
+     if (ret)
+          return ret;
+
+     if (ret_requestor)
+          *ret_requestor = ((VoodooInstanceInterface*) instance)->proxy;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_manager_check_allocation( VoodooManager *manager,
+                                 unsigned int   amount )
+{
+#ifndef WIN32
+     FILE   *f;
+     char    buf[2000];
+     int     size;
+     char   *p;
+     size_t  bytes;
+
+     D_MAGIC_ASSERT( manager, VoodooManager );
+
+     if (!voodoo_config->memory_max)
+          return DR_OK;
+
+     direct_snprintf( buf, sizeof(buf), "/proc/%d/status", direct_getpid() );
+
+     f = fopen( buf, "r" );
+     if (!f) {
+          D_ERROR( "Could not open '%s'!\n", buf );
+          return DR_FAILURE;
+     }
+
+     bytes = fread( buf, 1, sizeof(buf)-1, f );
+
+     fclose( f );
+
+     if (bytes) {
+          buf[bytes] = 0;
+
+          p = strstr( buf, "VmRSS:" );
+          if (!p) {
+               D_ERROR( "Could not find memory information!\n" );
+               return DR_FAILURE;
+          }
+
+          sscanf( p + 6, " %u", &size );
+
+          D_INFO( "SIZE: %u kB (+%u kB)\n", size, amount / 1024 );
+
+          if (size * 1024 + amount > voodoo_config->memory_max)
+               return DR_LIMITEXCEEDED;
+     }
+#endif
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/message.h b/Source/DirectFB/lib/voodoo/message.h
new file mode 100755
index 0000000..514b3bc
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/message.h
@@ -0,0 +1,258 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__MESSAGE_H__
+#define __VOODOO__MESSAGE_H__
+
+#include <voodoo/types.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+
+
+#define VOODOO_MSG_ALIGN(i)     (((i) + 3) & ~3)
+
+typedef enum {
+     VMBT_NONE,
+     VMBT_ID,
+     VMBT_INT,
+     VMBT_UINT,
+     VMBT_DATA,
+     VMBT_ODATA,
+     VMBT_STRING
+} VoodooMessageBlockType;
+
+typedef enum {
+     VREQ_NONE    = 0x00000000,
+     VREQ_RESPOND = 0x00000001,
+     VREQ_ASYNC   = 0x00000002,
+     VREQ_QUEUE   = 0x00000004
+} VoodooRequestFlags;
+
+typedef enum {
+     VMSG_SUPER,
+     VMSG_REQUEST,
+     VMSG_RESPONSE,
+
+     VMSG_DISCOVER, // temporary solution for compatibility
+     VMSG_SENDINFO, // temporary solution for compatibility
+} VoodooMessageType;
+
+
+struct __V_VoodooMessageHeader {
+     int                 size;
+     VoodooMessageSerial serial;
+     u32   type;
+};
+
+
+struct __V_VoodooSuperMessage {
+     VoodooMessageHeader header;
+};
+
+struct __V_VoodooRequestMessage {
+     VoodooMessageHeader header;
+
+     VoodooInstanceID    instance;
+     VoodooMethodID      method;
+
+     u32  flags;
+};
+
+struct __V_VoodooResponseMessage {
+     VoodooMessageHeader header;
+
+     VoodooMessageSerial request;
+     DirectResult        result;
+
+     VoodooInstanceID    instance;
+};
+
+
+typedef struct {
+     int         magic;
+
+     const void *msg;
+     const void *ptr;
+} VoodooMessageParser;
+
+
+
+#define __VOODOO_PARSER_PROLOG( parser, req_type )          \
+     const void             *_vp_ptr;                       \
+     VoodooMessageBlockType  _vp_type;                      \
+     int                     _vp_length;                    \
+                                                            \
+     D_MAGIC_ASSERT( &(parser), VoodooMessageParser );      \
+                                                            \
+     _vp_ptr = (parser).ptr;                                \
+                                                            \
+     /* Read message block type. */                         \
+     _vp_type = *(const u32*) _vp_ptr;                      \
+                                                            \
+     D_ASSERT( _vp_type == (req_type) );                    \
+                                                            \
+     /* Read data block length. */                          \
+     _vp_length = *(const s32*) (_vp_ptr + 4)
+
+
+#define __VOODOO_PARSER_EPILOG( parser )                    \
+     /* Advance message data pointer. */                    \
+     (parser).ptr += 8 + VOODOO_MSG_ALIGN(_vp_length)
+
+
+#define VOODOO_PARSER_BEGIN( parser, message )                                                 \
+     do {                                                                                      \
+          const VoodooMessageHeader *_vp_header = (const VoodooMessageHeader *) (message);     \
+                                                                                               \
+          D_ASSERT( (message) != NULL );                                                       \
+          D_ASSERT( _vp_header->type == VMSG_REQUEST || _vp_header->type == VMSG_RESPONSE );   \
+                                                                                               \
+          (parser).msg = (message);                                                            \
+          (parser).ptr = (parser).msg + (_vp_header->type == VMSG_REQUEST ?                    \
+                              sizeof(VoodooRequestMessage) : sizeof(VoodooResponseMessage));   \
+                                                                                               \
+          D_MAGIC_SET_ONLY( &(parser), VoodooMessageParser );                                  \
+     } while (0)
+
+
+#define VOODOO_PARSER_GET_ID( parser, ret_id )                        \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_ID );                  \
+                                                                      \
+          D_ASSERT( _vp_length == 4 );                                \
+                                                                      \
+          /* Read the ID. */                                          \
+          (ret_id) = *(const u32*) (_vp_ptr + 8);                     \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_GET_INT( parser, ret_int )                      \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_INT );                 \
+                                                                      \
+          D_ASSERT( _vp_length == 4 );                                \
+                                                                      \
+          /* Read the integer. */                                     \
+          (ret_int) = *(const s32*) (_vp_ptr + 8);                    \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_GET_UINT( parser, ret_uint )                    \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_UINT );                \
+                                                                      \
+          D_ASSERT( _vp_length == 4 );                                \
+                                                                      \
+          /* Read the unsigned integer. */                            \
+          (ret_uint) = *(const u32*) (_vp_ptr + 8);                   \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_GET_DATA( parser, ret_data )                    \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_DATA );                \
+                                                                      \
+          D_ASSERT( _vp_length > 0 );                                 \
+                                                                      \
+          /* Return pointer to data. */                               \
+          (ret_data) = _vp_ptr + 8;                                   \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_READ_DATA( parser, dst, max_len )               \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_DATA );                \
+                                                                      \
+          D_ASSERT( _vp_length > 0 );                                 \
+          D_ASSERT( _vp_length <= max_len );                          \
+                                                                      \
+          /* Copy data block. */                                      \
+          direct_memcpy( (dst), _vp_ptr + 8, _vp_length );            \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_COPY_DATA( parser, ret_data )                   \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_DATA );                \
+                                                                      \
+          D_ASSERT( _vp_length > 0 );                                 \
+                                                                      \
+          /* Allocate memory on the stack. */                         \
+          (ret_data) = alloca( _vp_length );                          \
+                                                                      \
+          /* Copy data block. */                                      \
+          direct_memcpy( (ret_data), _vp_ptr + 8, _vp_length );       \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_GET_ODATA( parser, ret_data )                   \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_ODATA );               \
+                                                                      \
+          D_ASSERT( _vp_length >= 0 );                                \
+                                                                      \
+          /* Return pointer to data or NULL. */                       \
+          if (_vp_length)                                             \
+               (ret_data) = _vp_ptr + 8;                              \
+          else                                                        \
+               (ret_data) = NULL;                                     \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+#define VOODOO_PARSER_GET_STRING( parser, ret_string )                \
+     do {                                                             \
+          __VOODOO_PARSER_PROLOG( parser, VMBT_STRING );              \
+                                                                      \
+          D_ASSERT( _vp_length > 0 );                                 \
+                                                                      \
+          /* Return pointer to string. */                             \
+          (ret_string) = (const char*) (_vp_ptr + 8);                 \
+                                                                      \
+          __VOODOO_PARSER_EPILOG( parser );                           \
+     } while (0)
+
+
+#define VOODOO_PARSER_END( parser )                                   \
+     do {                                                             \
+          D_MAGIC_ASSERT( &(parser), VoodooMessageParser );           \
+                                                                      \
+          D_ASSUME( *(const u32*) ((parser).ptr) == VMBT_NONE );      \
+                                                                      \
+          D_MAGIC_CLEAR( &(parser) );                                 \
+     } while (0)
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/mutex.c b/Source/DirectFB/lib/voodoo/mutex.c
new file mode 100755
index 0000000..dcc287d
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/mutex.c
@@ -0,0 +1,105 @@
+/*
+   (c) Copyright 2001-2008  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/util.h>
+
+#include "mutex.h"
+
+/**********************************************************************************************************************/
+
+DirectResult
+direct_mutex_init( DirectMutex *mutex )
+{
+     if (pthread_mutex_init( &mutex->lock, NULL ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_recursive_mutex_init( DirectMutex *mutex )
+{
+     DirectResult        ret = DR_OK;
+     int                 result;
+     pthread_mutexattr_t attr;
+
+     pthread_mutexattr_init( &attr );
+#if HAVE_DECL_PTHREAD_MUTEX_RECURSIVE
+     pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
+#endif
+     result = pthread_mutex_init( &mutex->lock, &attr );
+     if (result) {
+          ret = errno2result( errno );
+          D_PERROR( "Direct/Mutex: Could not initialize recursive mutex!\n" );
+     }
+
+     pthread_mutexattr_destroy( &attr );
+
+     return (DirectResult) ret;
+}
+
+__attribute__((no_instrument_function))
+DirectResult
+direct_mutex_lock( DirectMutex *mutex )
+{
+     if (pthread_mutex_lock( &mutex->lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+__attribute__((no_instrument_function))
+DirectResult
+direct_mutex_unlock( DirectMutex *mutex )
+{
+     if (pthread_mutex_unlock( &mutex->lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_mutex_trylock( DirectMutex *mutex )
+{
+     if (pthread_mutex_trylock( &mutex->lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+DirectResult
+direct_mutex_deinit( DirectMutex *mutex )
+{
+     if (pthread_mutex_destroy( &mutex->lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/mutex.h b/Source/DirectFB/lib/voodoo/mutex.h
new file mode 100755
index 0000000..fa520fd
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/mutex.h
@@ -0,0 +1,142 @@
+/*
+   (c) Copyright 2001-2008  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__OS__LINUX__GLIBC__MUTEX_H__
+#define __DIRECT__OS__LINUX__GLIBC__MUTEX_H__
+
+#include <pthread.h>
+
+#include <direct/util.h>
+
+
+#define _ZU "%zu"
+#define _ZD "%zd"
+
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     pthread_mutex_t     lock;
+} DirectMutex;
+
+/**********************************************************************************************************************/
+
+#define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
+#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
+
+
+DirectResult direct_mutex_init           ( DirectMutex *mutex );
+
+DirectResult direct_recursive_mutex_init ( DirectMutex *mutex );
+
+DirectResult direct_mutex_lock           ( DirectMutex *mutex );
+
+DirectResult direct_mutex_unlock         ( DirectMutex *mutex );
+
+DirectResult direct_mutex_trylock        ( DirectMutex *mutex );
+
+DirectResult direct_mutex_deinit         ( DirectMutex *mutex );
+
+
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+typedef struct {
+     pthread_key_t key;
+} DirectTLS;
+
+/**********************************************************************************************************************/
+
+#define DIRECT_TLS_DATA( name )    \
+     static DirectTLS name = { (pthread_key_t) -1 }
+
+/**********************************************************************************************************************/
+
+__attribute__((no_instrument_function))
+static inline void *direct_tls_get__( DirectTLS *tls );
+
+__attribute__((no_instrument_function))
+static inline DirectResult direct_tls_set__( DirectTLS *tls,
+                                             void      *value );
+
+__attribute__((no_instrument_function))
+static inline DirectResult direct_tls_register( DirectTLS  *tls,
+                                                void      (*destructor)( void* ) );
+
+__attribute__((no_instrument_function))
+static inline DirectResult direct_tls_unregister( DirectTLS *tls );
+
+/**********************************************************************************************************************/
+
+#define direct_tls_get( name )                    direct_tls_get__( &name )
+#define direct_tls_set( name, v )                 direct_tls_set__( &name, v )
+
+/**********************************************************************************************************************/
+
+static inline void *
+direct_tls_get__( DirectTLS *tls )
+{
+     void *value;
+
+     value = pthread_getspecific( tls->key );
+
+     return value;
+}
+
+static inline DirectResult
+direct_tls_set__( DirectTLS *tls,
+                  void      *value )
+{
+     if (pthread_setspecific( tls->key, value ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_tls_register( DirectTLS *tls, void (*destructor)( void* ) )
+{
+     if (pthread_key_create( &tls->key, destructor ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_tls_unregister( DirectTLS *tls )
+{
+     if (pthread_key_delete( tls->key ))
+          return errno2result( errno );
+
+     tls->key = (pthread_key_t) -1;
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/packet.h b/Source/DirectFB/lib/voodoo/packet.h
new file mode 100755
index 0000000..3f97071
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/packet.h
@@ -0,0 +1,285 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__PACKET_H__
+#define __VOODOO__PACKET_H__
+
+extern "C" {
+#include <direct/fastlz.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+
+
+#include <voodoo/types.h>
+}
+
+
+typedef enum {
+     VPHF_NONE       = 0x00000000,
+
+     VPHF_COMPRESSED = 0x00000001,
+
+     VPHF_ALL        = 0x00000001
+} VoodooPacketHeaderFlags;
+
+
+typedef struct {
+     u32  size;
+     u32  flags;
+     u32  uncompressed;
+     u32  align;
+} VoodooPacketHeader;
+
+
+class VoodooPacket {
+public:
+     DirectLink          link;
+     bool                sending;
+
+private:
+     void               *data;
+     void               *current;
+     VoodooPacketHeader  header;
+
+     VoodooPacket( u32   size,
+                   void *data )
+          :
+          sending(false),
+          data(data),
+          current(data)
+     {
+          memset( &link, 0, sizeof(link) );
+
+          header.size         = size;
+          header.flags        = VPHF_NONE;
+          header.uncompressed = size;
+     }
+
+     VoodooPacket( u32   size,
+                   u32   flags,
+                   u32   uncompressed,
+                   void *data )
+          :
+          sending(false),
+          data(data),
+          current(data)
+     {
+          memset( &link, 0, sizeof(link) );
+
+          header.size         = size;
+          header.flags        = VPHF_COMPRESSED;
+          header.uncompressed = uncompressed;
+     }
+
+     ~VoodooPacket() {};
+
+public:
+/*
+     static VoodooPacket *
+     New( u32 size )
+     {
+          VoodooPacket *packet = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
+
+          if (!packet) {
+               D_OOM();
+               return NULL;
+          }
+
+          return new (packet) VoodooPacket( size, packet + 1 );
+
+
+          if (data)
+               this->data = data;
+          else
+               this->data = header + 1;
+     }
+*/
+     static VoodooPacket *
+     New( u32   size,
+          void *data )
+     {
+          return new VoodooPacket( size, data );
+     }
+
+     static VoodooPacket *
+     Reset( VoodooPacket *packet,
+            u32           size,
+            void         *data )
+     {
+          return new (packet) VoodooPacket( size, data );
+     }
+
+     static VoodooPacket *
+     New( void *header,
+          u32   size )
+     {
+          VoodooPacketHeader *h = (VoodooPacketHeader*) header;
+
+          h->size         = size;
+          h->flags        = VPHF_NONE;
+          h->uncompressed = size;
+
+          return new VoodooPacket( size, (char*) header + sizeof(VoodooPacketHeader) );
+     }
+
+     static VoodooPacket *
+     New( u32 size )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + VOODOO_PACKET_MAX );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          return new (p) VoodooPacket( size, p + 1 );
+     }
+
+     static VoodooPacket *
+     Compressed( VoodooPacket *packet )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size * 4 / 3 );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          int compressed = direct_fastlz_compress( packet->data, packet->header.uncompressed, p + 1 );
+
+          if ((size_t) compressed < packet->header.uncompressed)
+               return new (p) VoodooPacket( compressed, VPHF_COMPRESSED, packet->header.uncompressed, p + 1 );
+
+          D_FREE( p );
+
+          return packet;
+     }
+
+     static VoodooPacket *
+     Copy( VoodooPacket *packet )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          direct_memcpy( p + 1, packet->data_start(), packet->header.size );
+
+          return new (p) VoodooPacket( packet->header.size, packet->header.flags, packet->header.uncompressed, p + 1 );
+     }
+
+     static VoodooPacket *
+     Copy( u32   size,
+           u32   flags,
+           u32   uncompressed,
+           void *data )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          direct_memcpy( p + 1, data, size );
+
+          return new (p) VoodooPacket( size, flags, uncompressed, p + 1 );
+     }
+
+     inline u32
+     size() const
+     {
+          return header.size;
+     }
+
+     inline u32
+     flags() const
+     {
+          return header.flags;
+     }
+
+     inline u32
+     uncompressed() const
+     {
+          return header.uncompressed;
+     }
+
+     inline const void *
+     data_header() const
+     {
+          D_ASSERT( data == this + 1 );
+
+          return &header;
+     }
+
+     inline const void *
+     data_start() const
+     {
+          return data;
+     }
+
+     inline void *
+     data_raw() const
+     {
+          return current;
+     }
+
+
+     inline bool
+     append( size_t size )
+     {
+          D_ASSERT( data == this + 1 );
+
+          if (header.size + size > VOODOO_PACKET_MAX)
+               return false;
+
+          current = (char*) data + header.size;
+
+          header.size         += size;
+          header.uncompressed += size;
+
+          return true;
+     }
+
+     inline void
+     reset( size_t size )
+     {
+          D_ASSERT( data == this + 1 );
+
+          current = (char*) data;
+
+          header.size         = size;
+          header.uncompressed = size;
+     }
+};
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/play.c b/Source/DirectFB/lib/voodoo/play.c
new file mode 100755
index 0000000..a262472
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/play.c
@@ -0,0 +1,935 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+
+#include <directfb_version.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/message.h>
+#include <voodoo/play.h>
+#include <voodoo/play_internal.h>
+
+#ifdef MACOS
+#define	min(a,b)	((a) < (b) ? (a) : (b))
+#define	max(a,b)	((a) > (b) ? (a) : (b))
+#endif
+
+D_DEBUG_DOMAIN( Voodoo_Play, "Voodoo/Play", "Voodoo Play" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DirectLink          link;
+
+     VoodooPlayVersion   version;
+     VoodooPlayInfo      info;
+
+     long long           last_seen;
+     long long           broadcast;
+
+     char                addr[64];
+} PlayerNode;
+
+/**********************************************************************************************************************/
+
+static void  player_send_info( VoodooPlayer    *player,
+                               const in_addr_t *in_addr,
+                               bool             discover );
+
+static void *player_main_loop( DirectThread    *thread,
+                               void            *arg );
+
+/**********************************************************************************************************************/
+
+static const int one = 1;
+
+VoodooPlayVersion g_VoodooPlay_version;
+VoodooPlayInfo    g_VoodooPlay_info;
+
+/**********************************************************************************************************************/
+
+static VoodooPlayer *g_VoodooPlayer;
+
+/**********************************************************************************************************************/
+
+/*
+ * FIXME
+ */
+static void
+generate_uuid( u8 *buf )
+{
+     int i;
+
+     srand( direct_clock_get_abs_micros() );
+
+     for (i=0; i<16; i++) {
+          buf[i] = rand();
+     }
+}
+
+/**********************************************************************************************************************/
+
+pthread_mutex_t gplayermut = PTHREAD_MUTEX_INITIALIZER;
+
+
+DirectResult createSocketForPlayer (int * retfd)
+{
+    int fd = -1;
+    *retfd = -1;
+    DirectResult ret;
+    struct sockaddr_in  addr;
+    D_INFO("Voodoo/Player: Creating the Socket for player 0x%08x\n",(int) g_VoodooPlayer);
+    /* Create the player socket. */
+    fd = socket( PF_INET, SOCK_DGRAM, 0 );
+    if (fd < 0) {
+        ret = errno2result( errno );
+        D_PERROR( "Voodoo/Player: Could not create the socket via socket()!\n" );
+       
+        return ret;
+    }
+    
+    /* Allow reuse of local address. */
+    if (setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one) ) < 0)
+        D_PERROR( "Voodoo/Player: Could not set SO_REUSEADDR!\n" );
+    
+    if (setsockopt( fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one) ) < 0)
+        D_PERROR( "Voodoo/Player: Could not set SO_BROADCAST!\n" );
+    
+    /* Bind the socket to the local port. */
+    addr.sin_family      = AF_INET;
+    addr.sin_addr.s_addr = inet_addr( "0.0.0.0" );
+    addr.sin_port        = htons( 2323 );
+    
+    if (bind( fd, (struct sockaddr*) &addr, sizeof(addr) )) {
+        ret = errno2result( errno );
+        D_PERROR( "Voodoo/Player: Could not bind() the socket!\n" );
+        close( fd );
+        
+        return ret;
+    }
+    
+    *retfd = fd;
+    return DR_OK;
+    
+    
+}
+
+
+DirectResult
+voodoo_player_create( const VoodooPlayInfo  *info,
+                      VoodooPlayer         **ret_player )
+{
+     DirectResult        ret;
+     int                 fd;
+     
+     VoodooPlayer       *player;
+     pthread_mutex_lock(&gplayermut);
+     D_ASSERT( ret_player != NULL );
+
+     if (g_VoodooPlayer) {
+          *ret_player = g_VoodooPlayer;
+		  pthread_mutex_unlock(&gplayermut);
+          return DR_OK;
+     }
+    
+     ret = createSocketForPlayer(&fd);
+     if ( ret != DR_OK)
+     {
+         pthread_mutex_unlock(&gplayermut);
+         return ret;
+         
+     }
+    
+
+
+     /* Allocate player structure. */
+     player = D_CALLOC( 1, sizeof(VoodooPlayer) );
+     if (!player) {
+          D_WARN( "out of memory" );
+          close( fd );
+		  pthread_mutex_unlock(&gplayermut);
+          return DR_NOLOCALMEMORY;
+     }
+
+     pthread_mutex_init( &player->lock, NULL );
+
+     /* Initialize player structure. */
+     player->fd = fd;
+
+     /* Fill version struct */
+     player->version.v[0] = VPVF_LITTLE_ENDIAN | VPVF_32BIT_SERIALS;
+     player->version.v[1] = DIRECTFB_MAJOR_VERSION;
+     player->version.v[2] = DIRECTFB_MINOR_VERSION;
+     player->version.v[3] = DIRECTFB_MICRO_VERSION;
+
+     /* Fill info struct */
+     direct_snputs( player->info.name,   voodoo_config->play_info.name,    VOODOO_PLAYER_NAME_LENGTH );
+     direct_snputs( player->info.vendor, voodoo_config->play_info.vendor,  VOODOO_PLAYER_VENDOR_LENGTH );
+     direct_snputs( player->info.model,  voodoo_config->play_info.model,   VOODOO_PLAYER_MODEL_LENGTH );
+     direct_memcpy( player->info.uuid,   voodoo_config->play_info.uuid,    16 );
+
+     if (info)
+          player->info = *info;
+
+     if (!player->info.name[0])
+          direct_snputs( player->info.name, "Unnamed Player", VOODOO_PLAYER_NAME_LENGTH );
+
+     if (!player->info.vendor[0])
+          direct_snputs( player->info.vendor, "Unknown Vendor", VOODOO_PLAYER_VENDOR_LENGTH );
+
+     if (!player->info.model[0])
+          direct_snputs( player->info.model, "Unknown Model", VOODOO_PLAYER_MODEL_LENGTH );
+
+     if (!player->info.uuid[0])
+          generate_uuid( player->info.uuid );
+
+     player->info.flags |= VPIF_LINK;
+
+     D_MAGIC_SET( player, VoodooPlayer );
+
+
+     g_VoodooPlay_version = player->version;
+     g_VoodooPlay_info    = player->info;
+
+
+     char buf[33];
+
+     snprintf( buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               player->info.uuid[0], player->info.uuid[1], player->info.uuid[2], player->info.uuid[3], player->info.uuid[4],
+               player->info.uuid[5], player->info.uuid[6], player->info.uuid[7], player->info.uuid[8], player->info.uuid[9],
+               player->info.uuid[10], player->info.uuid[11], player->info.uuid[12], player->info.uuid[13], player->info.uuid[14],
+               player->info.uuid[15] );
+
+     D_INFO( "Running player '%s' with UUID %s!\n", player->info.name, buf );
+
+     /* Start messaging thread */
+     player->thread = direct_thread_create( DTT_DEFAULT, player_main_loop, player, "Voodoo/Player" );
+
+     /* Return the new player. */
+     *ret_player = player;
+
+     if (!g_VoodooPlayer)
+          g_VoodooPlayer = player;
+		  
+	 pthread_mutex_unlock(&gplayermut);
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_destroy( VoodooPlayer *player )
+{
+	pthread_mutex_lock(&gplayermut);
+	D_MAGIC_ASSERT( player, VoodooPlayer );
+	
+      if (g_VoodooPlayer == player)
+	  {
+		  pthread_mutex_unlock(&gplayermut);
+          return DR_OK;
+	  }
+     D_INFO("Voodoo/Player: Destroying the player 0x%08x\n",(int) player);
+     player->quit = true;
+
+     direct_thread_join( player->thread );
+     direct_thread_destroy( player->thread );
+
+     close( player->fd );
+
+     pthread_mutex_destroy( &player->lock );
+
+     D_MAGIC_CLEAR( player );
+
+     D_FREE( player );
+	 g_VoodooPlayer = NULL;
+	 pthread_mutex_unlock(&gplayermut);
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_broadcast( VoodooPlayer *player )
+{
+#if !VOODOO_PLAY_FAKE
+     int           ret;
+#ifdef MACOS
+     char          *ptr, lastname[IFNAMSIZ];
+#else
+     int           i;
+#endif
+     struct ifreq  req[16];
+     struct ifconf conf;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     player->broadcast++;
+	 
+     conf.ifc_buf = (char*) req;
+     conf.ifc_len = sizeof(req);
+
+     ret = ioctl( player->fd, SIOCGIFCONF, &conf );
+     if (ret) {
+          D_PERROR( "Voodoo/Player: ioctl( SIOCGIFCONF ) failed!\n" );
+          return DR_FAILURE;
+     }
+
+#ifdef MACOS
+     // TIV: On iPhone (and I believe in general on BSD, you can't just plainly iterate on struct size)
+     
+     lastname[0] = 0;
+     
+     for (ptr = conf.ifc_buf; ptr < conf.ifc_buf + conf.ifc_len; )
+     {
+         char                 buf[100];
+         int                  len, flags;
+         struct ifreq         ifrcopy, *ifr  = (struct ifreq *)ptr;
+         struct sockaddr_in  *addr = (struct sockaddr_in*) &ifr->ifr_broadaddr;
+
+         len = max(sizeof(struct sockaddr), ifr->ifr_addr.sa_len);
+         ptr += sizeof(ifr->ifr_name) + len; // for next one in buffer
+         
+         if (strncmp(lastname, ifr->ifr_name, IFNAMSIZ) == 0)
+         {
+             continue; /* already processed this interface */
+         }
+
+         memcpy(lastname, ifr->ifr_name, IFNAMSIZ);
+
+         ifrcopy = *ifr;
+         ioctl( player->fd, SIOCGIFFLAGS, &ifrcopy);
+         flags = ifrcopy.ifr_flags;
+         if ((flags & IFF_UP) == 0)
+         {
+             D_INFO( "Voodoo/Player:   %-16s is not up.\n", ifrcopy.ifr_name );
+             continue;	// ignore if interface not up
+         }
+
+         ret = ioctl( player->fd, SIOCGIFBRDADDR, ifr );
+         if (ret) {
+             D_PERROR( "Voodoo/Player: ioctl( SIOCGIFBRDADDR ) %-16s failed!\n", ifr->ifr_name );
+             continue;
+         }
+         
+         if (addr->sin_addr.s_addr) {
+              inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+              D_INFO( "Voodoo/Player:   %-16s (%s)\n", ifr->ifr_name, buf );
+         }
+         else {
+              ret = ioctl( player->fd, SIOCGIFDSTADDR, ifr );
+              if (ret) {
+                   D_PERROR( "Voodoo/Player: ioctl( SIOCGIFDSTADDR ) failed!\n" );
+                   continue;
+              }
+
+              inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+              D_INFO( "Voodoo/Player:   %-16s (%s) (P-t-P)\n", ifr->ifr_name, buf );
+         }
+         
+         player_send_info( player, &addr->sin_addr.s_addr, true );
+     }
+#else
+     D_INFO( "Voodoo/Player: Detected %d interfaces\n", conf.ifc_len/sizeof(req[0]) );
+
+     for (i=0; i<conf.ifc_len/sizeof(req[0]); i++) {
+          struct sockaddr_in *addr = (struct sockaddr_in*) &req[i].ifr_broadaddr;
+          char                buf[100];
+
+          ret = ioctl( player->fd, SIOCGIFBRDADDR, &req[i] );
+          if (ret) {
+               D_PERROR( "Voodoo/Player: ioctl( SIOCGIFBRDADDR ) failed!\n" );
+               continue;
+          }
+
+          if (addr->sin_addr.s_addr) {
+               inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+               D_INFO( "Voodoo/Player:   %-16s (%s)\n", req[i].ifr_name, buf );
+          }
+          else {
+               ret = ioctl( player->fd, SIOCGIFDSTADDR, &req[i] );
+               if (ret) {
+                    D_PERROR( "Voodoo/Player: ioctl( SIOCGIFDSTADDR ) failed!\n" );
+                    continue;
+               }
+
+               inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+               D_INFO( "Voodoo/Player:   %-16s (%s) (P-t-P)\n", req[i].ifr_name, buf );
+          }
+
+          //addr->sin_addr.s_addr = inet_addr( "192.168.1.150" );
+          //addr->sin_addr.s_addr = inet_addr( "192.168.255.255" );
+
+          player_send_info( player, &addr->sin_addr.s_addr, true );
+     }
+#endif
+#endif
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_lookup( VoodooPlayer   *player,
+                      const u8        uuid[16],
+                      VoodooPlayInfo *ret_info,
+                      char           *ret_addr,
+                      int             max_addr )
+{
+     PlayerNode *node;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     pthread_mutex_lock( &player->lock );
+
+     direct_list_foreach (node, player->nodes) {
+          if (!uuid || !memcmp( node->info.uuid, uuid, 16 )) {
+               if (ret_info)
+                    direct_memcpy( ret_info, &node->info, sizeof(VoodooPlayInfo) );
+
+               if (ret_addr)
+                    direct_snputs( ret_addr, node->addr, max_addr );
+
+               pthread_mutex_unlock( &player->lock );
+               return DR_OK;
+          }
+     }
+
+     if (uuid && !memcmp( player->info.uuid, uuid, 16 )) {
+          if (ret_info)
+               direct_memcpy( ret_info, &player->info, sizeof(VoodooPlayInfo) );
+
+          if (ret_addr)
+               direct_snputs( ret_addr, "127.0.0.1", max_addr );
+
+          pthread_mutex_unlock( &player->lock );
+          return DR_OK;
+     }
+
+     pthread_mutex_unlock( &player->lock );
+
+     return DR_ITEMNOTFOUND;
+}
+
+DirectResult
+voodoo_player_lookup_by_address( VoodooPlayer   *player,
+                                 const char     *addr,
+                                 VoodooPlayInfo *ret_info )
+{
+     PlayerNode *node;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     pthread_mutex_lock( &player->lock );
+
+     direct_list_foreach (node, player->nodes) {
+          if (!addr || !strcmp( node->addr, addr )) {
+               direct_memcpy( ret_info, &node->info, sizeof(VoodooPlayInfo) );
+
+               pthread_mutex_unlock( &player->lock );
+               return DR_OK;
+          }
+     }
+
+     if (addr && !strcmp( "127.0.0.1", addr )) {
+          direct_memcpy( ret_info, &player->info, sizeof(VoodooPlayInfo) );
+
+          pthread_mutex_unlock( &player->lock );
+          return DR_OK;
+     }
+
+     pthread_mutex_unlock( &player->lock );
+
+     return DR_ITEMNOTFOUND;
+}
+
+DirectResult
+voodoo_player_enumerate( VoodooPlayer          *player,
+                         VoodooPlayerCallback   callback,
+                         void                  *ctx )
+{
+     PlayerNode *node;
+     long long   now = direct_clock_get_abs_millis();
+
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     pthread_mutex_lock( &player->lock );
+
+     direct_list_foreach (node, player->nodes) {
+          if (node->broadcast != player->broadcast && direct_clock_get_abs_millis() - node->last_seen > 1000)
+               continue;
+			   
+          if (callback( ctx, &node->info, &node->version,
+                        node->addr, now - node->last_seen ) == DENUM_CANCEL)
+               break;
+     }
+
+     pthread_mutex_unlock( &player->lock );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+__attribute__((unused))
+static void
+player_send_info( VoodooPlayer    *player,
+                  const in_addr_t *in_addr,
+                  bool             discover )
+{
+     int                 ret;
+     struct sockaddr_in  addr;
+     VoodooPlayMessage   msg;
+     PlayerNode         *node;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     msg.version = player->version;
+     msg.type    = discover ? VPMT_DISCOVER : VPMT_SENDINFO;
+     msg.info    = player->info;
+
+     addr.sin_family      = AF_INET;
+     addr.sin_addr.s_addr = *in_addr;
+     addr.sin_port        = htons( 2323 );
+
+     ret = sendto( player->fd, &msg, sizeof(msg), 0, (struct sockaddr*) &addr, sizeof(addr) );
+     if (ret < 0) {
+          D_PERROR( "Voodoo/Player: sendto() failed!\n" );
+          return;
+     }
+
+     if (!discover && voodoo_config->forward_nodes) {
+          direct_list_foreach (node, player->nodes) {
+               VoodooPlayInfo info = node->info;
+     
+               info.flags |= VPIF_LEVEL2;
+     
+               msg.version = node->version;
+               msg.type    = discover ? VPMT_DISCOVER : VPMT_SENDINFO;
+               msg.info    = info;
+     
+               ret = sendto( player->fd, &msg, sizeof(msg), 0, (struct sockaddr*) &addr, sizeof(addr) );
+               if (ret < 0) {
+                    D_PERROR( "Voodoo/Player: sendto() failed!\n" );
+                    return;
+               }
+          }
+     }
+}
+
+static void
+player_save_info( VoodooPlayer            *player,
+                  const VoodooPlayMessage *msg,
+                  const char              *addr )
+{
+     PlayerNode *node;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     direct_list_foreach (node, player->nodes) {
+          if (!memcmp( node->info.uuid, msg->info.uuid, 16 )) {
+               if (msg->info.flags & VPIF_LEVEL2 && !(node->info.flags & VPIF_LEVEL2)) {
+                    node->version = msg->version;
+                    node->info    = msg->info;
+
+                    direct_snputs( node->addr, addr, sizeof(node->addr) );
+               }
+               node->version   = msg->version;
+               node->info      = msg->info;
+
+                node->last_seen = direct_clock_get_abs_millis();
+               node->broadcast = player->broadcast;
+
+               direct_snputs( node->addr, addr, sizeof(node->addr) );
+ 
+                return;
+
+          }
+     }
+
+     node = D_CALLOC( 1, sizeof(PlayerNode) );
+     if (!node) {
+          D_OOM();
+          return;
+     }
+
+     node->version   = msg->version;
+     node->info      = msg->info;
+
+     node->last_seen = direct_clock_get_abs_millis();
+     node->broadcast = player->broadcast;
+	 
+     direct_snputs( node->addr, addr, sizeof(node->addr) );
+
+
+     direct_list_append( &player->nodes, &node->link );
+}
+
+#if !VOODOO_PLAY_FAKE
+static void *
+player_main_loop( DirectThread *thread, void *arg )
+{
+     VoodooPlayer       *player = arg;
+     int                 ret;
+     struct sockaddr_in  addr;
+     socklen_t           addr_len = sizeof(addr);
+     VoodooPlayMessage   msg;
+     char                buf[100];
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+     while (!player->quit) {
+          struct pollfd  pf;
+
+          pf.fd     = player->fd;
+          pf.events = POLLIN;
+
+          switch (poll( &pf, 1, 100 )) {
+               default:
+                    ret = recvfrom( player->fd, &msg, sizeof(msg), 0, (struct sockaddr*) &addr, &addr_len );
+                    if (ret < 0) {
+                         D_PERROR( "Voodoo/Player: recvfrom() failed!\n" );
+                         close(player->fd);
+                         ret = createSocketForPlayer(&player->fd);
+                          
+                         continue;
+                    }
+
+                    inet_ntop( AF_INET, &addr.sin_addr, buf, sizeof(buf) );
+
+                    pthread_mutex_lock( &player->lock );
+
+                    /* Send reply if message is not from ourself */
+                    if (memcmp( msg.info.uuid, player->info.uuid, 16 )) {
+                         switch (msg.type) {
+                              case VPMT_DISCOVER:
+                                   D_INFO( "Voodoo/Player: Received DISCOVER from '%s' (%s)\n", msg.info.name, buf );
+                                   player_send_info( player, &addr.sin_addr.s_addr, false );
+                                   break;
+
+                              case VPMT_SENDINFO:
+                                   D_INFO( "Voodoo/Player: Received SENDINFO from '%s' (%s)\n", msg.info.name, buf );
+                                   player_save_info( player, &msg, buf );
+                                   break;
+
+                              default:
+                                   D_ERROR( "Voodoo/Player: Received unknown message (%s)\n", buf );
+                                   break;
+                         }
+                    }
+                    else
+                         D_INFO( "Voodoo/Player: Received message from ourself (%s)\n", buf );
+
+                    pthread_mutex_unlock( &player->lock );
+                    break;
+
+               case 0:
+                    D_DEBUG( "Voodoo/Player: Timeout during poll()\n" );
+                    break;
+
+               case -1:
+                    if (errno != EINTR) {
+                         D_PERROR( "Voodoo/Player: Could not poll() the socket!\n" );
+                         close(player->fd);
+                         ret = createSocketForPlayer(&player->fd);
+                        // player->quit = true;
+                    }
+                    break;
+          }
+     }
+
+     return DR_OK;
+}
+#else
+
+static DirectResult
+send_discover_and_receive_info( int                fd,
+                                VoodooPlayVersion *ret_version,
+                                VoodooPlayInfo    *ret_info )
+{
+     int                 ret;
+     VoodooMessageHeader header;
+
+     D_INFO( "Voodoo/Player: Sending VMSG_DISCOVER message via Voodoo TCP port...\n" );
+
+     header.size   = sizeof(VoodooMessageHeader);
+     header.serial = 0;
+     header.type   = VMSG_DISCOVER;
+
+     ret = write( fd, &header, sizeof(header) );
+     if (ret < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Player: Failed to send VMSG_DISCOVER message via Voodoo TCP port!\n" );
+          return ret;
+     }
+
+
+
+     struct pollfd pfd;
+
+     pfd.events = POLL_IN;
+     pfd.fd     = fd;
+
+     // wait for up to one second (old server will not reply anything, so we have to timeout)
+     ret = poll( &pfd, 1, 1000 );
+     if (ret < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Player: Failed to wait for reply after sending VMSG_DISCOVER message via Voodoo TCP port!\n" );
+          return ret;
+     }
+
+     if (ret == 0) {
+          D_INFO( "Voodoo/Player: Old Voodoo Server without VMSG_DISCOVER support (timeout waiting for reply)\n" );
+          return DR_UNSUPPORTED;
+     }
+
+     D_INFO( "Voodoo/Player: New Voodoo Server with VMSG_DISCOVER support, reading version/info (SENDINFO) reply...\n" );
+
+
+     struct {
+          VoodooMessageHeader header;
+          VoodooPlayVersion   version;
+          VoodooPlayInfo      info;
+     } msg;
+
+     size_t got = 0;
+
+     while (got < sizeof(msg)) {
+          ret = read( fd, (void*) &msg + got, sizeof(msg) - got );
+          if (ret < 0) {
+               ret = errno2result( errno );
+               D_PERROR( "Voodoo/Player: Failed to read after sending VMSG_DISCOVER message via Voodoo TCP port!\n" );
+               return ret;
+          }
+
+          got += ret;
+     }
+
+
+     if (msg.header.type != VMSG_SENDINFO) {
+          D_ERROR( "Voodoo/Player: Received message after sending VMSG_DISCOVER message via Voodoo TCP port is no VMSG_SENDINFO!\n");
+          return DR_INVARG;
+     }
+
+     *ret_version = msg.version;
+     *ret_info    = msg.info;
+
+     D_INFO( "Voodoo/Player: Voodoo Server sent name '%s', version %d.%d.%d\n",
+             msg.info.name, msg.version.v[1], msg.version.v[2], msg.version.v[3] );
+
+     return DR_OK;
+}
+
+static void
+player_try_connect( VoodooPlayer *player,
+                    u32           addr )
+{
+     DirectResult   ret;
+     int            fd, err;
+     struct in_addr sin_addr = { addr };
+
+     char buf[100];
+
+     inet_ntop( AF_INET, &sin_addr, buf, sizeof(buf) );
+
+
+     /* Create the client socket. */
+     fd = socket( AF_INET, SOCK_STREAM, 0 );
+     if (fd < 0) {
+          D_PERROR( "Voodoo/Player: Could not create the socket via socket( %d )!\n", AF_INET );
+          return;
+     }
+
+     struct sockaddr_in sock_addr;
+
+     sock_addr.sin_family = AF_INET;
+     sock_addr.sin_port   = htons( 2323 );
+     sock_addr.sin_addr   = sin_addr;
+
+     /* Connect to the server. */
+     err = connect( fd, (struct sockaddr*) &sock_addr, sizeof(sock_addr) );
+     if (err) {
+          D_PERROR( "Voodoo/Player: No Voodoo at '%s:2323'", buf );
+          close( fd );
+          return;
+     }
+
+     D_INFO( "Voodoo/Player: Found Voodoo at '%s'!\n", buf );
+
+
+     VoodooPlayMessage msg;
+
+
+     ret = send_discover_and_receive_info( fd, &msg.version, &msg.info );
+     if (ret) {
+          /* Fill version struct */
+          msg.version.v[0] = VPVF_LITTLE_ENDIAN | VPVF_32BIT_SERIALS;
+          msg.version.v[1] = DIRECTFB_MAJOR_VERSION;
+          msg.version.v[2] = DIRECTFB_MINOR_VERSION;
+          msg.version.v[3] = DIRECTFB_MICRO_VERSION;
+
+          msg.type = VPMT_SENDINFO;
+
+          /* Fill info struct */
+          direct_snputs( msg.info.name,   "Unknown", VOODOO_PLAYER_NAME_LENGTH );
+          direct_snputs( msg.info.vendor, "Unknown", VOODOO_PLAYER_VENDOR_LENGTH );
+          direct_snputs( msg.info.model,  "Unknown", VOODOO_PLAYER_MODEL_LENGTH );
+          generate_uuid( msg.info.uuid );
+     }
+
+
+     close( fd );
+
+
+     pthread_mutex_lock( &player->lock );
+
+     player_save_info( player, &msg, buf );
+
+     pthread_mutex_unlock( &player->lock );
+}
+
+typedef struct {
+     VoodooPlayer *player;
+     u32           addr;
+} PlayerTryContext;
+
+static void *
+player_try_thread( void *arg )
+{
+     PlayerTryContext *context = arg;
+
+     player_try_connect( context->player, context->addr );
+
+     D_FREE( context );
+
+     return NULL;
+}
+
+static void *
+player_main_loop( DirectThread *thread, void *arg )
+{
+     VoodooPlayer  *player = arg;
+     int            ret;
+     int            i;
+     struct ifreq   req[16];
+     struct ifconf  conf;
+
+     D_MAGIC_ASSERT( player, VoodooPlayer );
+
+//     while (!player->quit) {
+          conf.ifc_buf = (char*) req;
+          conf.ifc_len = sizeof(req);
+
+          ret = ioctl( player->fd, SIOCGIFCONF, &conf );
+          if (ret) {
+               D_PERROR( "Voodoo/Player: ioctl( SIOCGIFCONF ) failed!\n" );
+               return NULL;
+          }
+
+          D_INFO( "Voodoo/Player: Detected %d interfaces\n", conf.ifc_len/sizeof(req[0]) );
+
+          for (i=0; i<conf.ifc_len/sizeof(req[0]); i++) {
+               struct sockaddr_in *addr = (struct sockaddr_in*) &req[i].ifr_broadaddr;
+               char                buf[100];
+
+               ret = ioctl( player->fd, SIOCGIFBRDADDR, &req[i] );
+               if (ret) {
+                    D_PERROR( "Voodoo/Player: ioctl( SIOCGIFBRDADDR ) failed!\n" );
+                    continue;
+               }
+
+               if (addr->sin_addr.s_addr) {
+                    inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+                    D_INFO( "Voodoo/Player:   %-16s (%s)  [0x%08x]\n", req[i].ifr_name, buf, addr->sin_addr.s_addr );
+
+                    u32 _addr = htonl( addr->sin_addr.s_addr );
+                    u32 a;
+
+                    for (a = (_addr & ~0xff) + 1; a < (_addr | 0xff); a++) {
+                         if (a == _addr)
+                              continue;
+
+                         PlayerTryContext *context = D_CALLOC( 1, sizeof(PlayerTryContext) );
+
+                         context->player = player;
+                         context->addr   = ntohl(a);
+
+
+                         pthread_t t;
+
+                         pthread_create( &t, NULL, player_try_thread, context );
+                    }
+               }
+               else {
+                    ret = ioctl( player->fd, SIOCGIFDSTADDR, &req[i] );
+                    if (ret) {
+                         D_PERROR( "Voodoo/Player: ioctl( SIOCGIFDSTADDR ) failed!\n" );
+                         continue;
+                    }
+
+                    inet_ntop( AF_INET, &addr->sin_addr, buf, sizeof(buf) );
+
+                    D_INFO( "Voodoo/Player:   %-16s (%s) (P-t-P)\n", req[i].ifr_name, buf );
+               }
+          }
+//     }
+
+     return DR_OK;
+}
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/play.h b/Source/DirectFB/lib/voodoo/play.h
new file mode 100755
index 0000000..1dc50df
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/play.h
@@ -0,0 +1,146 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__PLAY_H__
+#define __VOODOO__PLAY_H__
+
+#include <voodoo/types.h>
+
+
+#define VOODOO_PLAY_VERSION_FIXED_SIZE  32
+
+#define VOODOO_PLAYER_NAME_LENGTH       96
+
+#define VOODOO_PLAYER_VENDOR_LENGTH     96
+#define VOODOO_PLAYER_MODEL_LENGTH      96
+
+
+#define VOODOO_LINK_PORT    8676    // 'V' 'L'
+
+
+typedef enum {
+    VPVF_NONE           = 0x00000000,
+
+    VPVF_LITTLE_ENDIAN  = 0x00000001,   /* Always set, no big endian support for now */
+    VPVF_32BIT_SERIALS  = 0x00000002,   /* Using 32bit message serials, always set */
+
+    VPVF_ALL            = 0x00000007
+} VoodooPlayVersionFlags;
+
+typedef struct {
+    u8                          v[4];   /* flags, major, minor, micro */
+} VoodooPlayVersion;
+
+
+typedef enum {
+    VPIF_NONE   = 0x00000000,
+
+    VPIF_LEVEL2 = 0x00000001,
+    VPIF_LINK   = 0x00000002,   /* Supports new VoodooLink protocol */
+
+    VPIF_ALL    = 0x00000003
+} VoodooPlayInfoFlags;
+
+typedef struct {
+    VoodooPlayInfoFlags         flags;
+
+    u8                          uuid[16];
+
+    char                        name[VOODOO_PLAYER_NAME_LENGTH];        /* "My Philips TV" */
+
+    char                        vendor[VOODOO_PLAYER_VENDOR_LENGTH];    /* "Philips Consumer Lifestyle" */
+    char                        model[VOODOO_PLAYER_MODEL_LENGTH];      /* "32PFL9604H/10" */
+} VoodooPlayInfo;
+
+
+typedef enum {
+    VPMT_INVALID,
+
+    VPMT_DISCOVER,
+    VPMT_SENDINFO,
+} VoodooPlayMessageType;
+
+
+
+/*
+ 
+ One play message on a new connection from both sides.
+ Both sides having received the other side's info know if the connection is to be closed or can succeed.
+ 
+ Game about endianness conversion: both sides randomly send 0 or 1 as part of the info,
+                                   if both are equal, then server converts, otherwise client
+*/
+
+typedef struct {
+    /* Version information first in structure, fixed size (union!) */
+    union {
+        char __fixed[VOODOO_PLAY_VERSION_FIXED_SIZE];
+
+
+        VoodooPlayVersion       version;                                /* (1.0, ...) */
+    };
+
+    VoodooPlayMessageType       type;
+
+    union {
+        VoodooPlayInfo          info;       /* DISCOVER, SENDINFO */
+    };
+} VoodooPlayMessage;
+
+
+typedef DirectEnumerationResult (*VoodooPlayerCallback)( void                    *ctx,
+                                                         const VoodooPlayInfo    *info,
+                                                         const VoodooPlayVersion *version,
+                                                         const char              *address,
+                                                         unsigned int             ms_since_last_seen );
+
+
+DirectResult voodoo_player_create    ( const VoodooPlayInfo  *info,
+                                       VoodooPlayer         **ret_player );
+
+DirectResult voodoo_player_destroy   ( VoodooPlayer          *player );
+
+DirectResult voodoo_player_broadcast ( VoodooPlayer          *player );
+
+DirectResult voodoo_player_lookup    ( VoodooPlayer          *player,
+                                       const u8               uuid[16],
+                                       VoodooPlayInfo        *ret_info,
+                                       char                  *ret_addr,
+                                       int                    max_addr );
+
+DirectResult voodoo_player_lookup_by_address( VoodooPlayer          *player,
+                                              const char            *addr,
+                                              VoodooPlayInfo        *ret_info );
+
+DirectResult voodoo_player_enumerate ( VoodooPlayer          *player,
+                                       VoodooPlayerCallback   callback,
+                                       void                  *ctx );
+
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/play_internal.h b/Source/DirectFB/lib/voodoo/play_internal.h
new file mode 100755
index 0000000..0aa0f91
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/play_internal.h
@@ -0,0 +1,89 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__PLAY_INTERNAL_H__
+#define __VOODOO__PLAY_INTERNAL_H__
+
+#include <voodoo/app.h>
+#include <voodoo/play.h>
+#include <voodoo/play_server.h>
+
+#include <direct/list.h>
+#include <direct/thread.h>
+
+
+struct __V_VoodooPlayer {
+     int                 magic;
+
+     int                 fd;
+
+     pthread_mutex_t     lock;
+
+     bool                quit;
+
+     VoodooPlayVersion   version;
+     VoodooPlayInfo      info;
+
+     DirectThread       *thread;
+
+     DirectLink         *nodes;
+
+     long long           broadcast;
+
+     VoodooServer               *server;
+
+     const VoodooAppDescription *apps;
+     unsigned int                num_apps;
+
+     VoodooPlayerLaunchFunc      launch_func;
+     VoodooPlayerStopFunc        stop_func;
+     void                       *ctx;
+
+     DirectLink                 *instances;
+     pthread_mutex_t             instances_lock;
+     pthread_cond_t              instances_cond;
+};
+
+
+typedef struct {
+     DirectLink            link;
+
+     u8                    uuid[16];
+
+     void                 *data;
+
+     VoodooAppDescription  app;
+     u8                    player_uuid[16];
+} VoodooAppInstance;
+
+
+extern VoodooPlayVersion g_VoodooPlay_version;
+extern VoodooPlayInfo    g_VoodooPlay_info;
+
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/play_server.c b/Source/DirectFB/lib/voodoo/play_server.c
new file mode 100755
index 0000000..1e933f5
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/play_server.c
@@ -0,0 +1,430 @@
+/*
+   (c) Copyright 2001-2010  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+
+#include <directfb_version.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/play_server.h>
+#include <voodoo/play_internal.h>
+#include <voodoo/server.h>
+
+D_DEBUG_DOMAIN( Voodoo_Play_Server, "Voodoo/Play/Server", "Voodoo Play Server" );
+
+/**********************************************************************************************************************/
+
+VoodooPlayer *voodoo_player;
+
+/**********************************************************************************************************************/
+/*
+ * FIXME
+ */
+static void
+generate_uuid( u8 *buf )
+{
+     int i;
+
+     for (i=0; i<16; i++) {
+          buf[i] = rand();
+     }
+}
+
+static DirectResult
+ConstructDispatcher( VoodooServer     *server,
+                     VoodooManager    *manager,
+                     const char       *name,
+                     void             *ctx,
+                     VoodooInstanceID *ret_instance )
+{
+     DirectResult          ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *interface;
+     VoodooInstanceID      instance;
+
+     D_ASSERT( server != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( ret_instance != NULL );
+
+     ret = DirectGetInterface( &funcs, name, "Dispatcher", NULL, NULL );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( &interface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( interface, manager, &instance );
+     if (ret)
+          return ret;
+
+     *ret_instance = instance;
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+voodoo_player_run_server( VoodooPlayer               *player,
+                          const VoodooAppDescription *apps,
+                          unsigned int                num_apps,
+                          VoodooPlayerLaunchFunc      launch_func,
+                          VoodooPlayerStopFunc        stop_func,
+                          void                       *ctx )
+{
+     DirectResult  ret;
+     VoodooServer *server;
+
+     D_ASSERT( player != NULL );
+     D_ASSERT( apps != NULL );
+     D_ASSERT( num_apps > 0 );
+     D_ASSERT( launch_func != NULL );
+
+     if (voodoo_player) {
+          D_ERROR( "Voodoo/Play: Already running as a server!\n" );
+          return DR_BUSY;
+     }
+
+     ret = voodoo_server_create( &server );
+     if (ret)
+          return ret;
+
+     ret = voodoo_server_register( server, "IVoodooPlayer", ConstructDispatcher, NULL );
+     if (ret) {
+          D_ERROR( "Voodoo/Player: Could not register super interface 'IVoodooPlayer'!\n" );
+          voodoo_server_destroy( server );
+          return ret;
+     }
+
+     player->server      = server;
+     player->apps        = apps;
+     player->num_apps    = num_apps;
+     player->launch_func = launch_func;
+     player->stop_func   = stop_func;
+     player->ctx         = ctx;
+
+     pthread_mutex_init( &player->instances_lock, NULL );
+     pthread_cond_init( &player->instances_cond, NULL );
+
+     voodoo_player = player;
+
+     ret = voodoo_server_run( server, false );
+     if (ret)
+          D_DERROR( ret, "Voodoo/Player: Server exiting!\n" );
+
+     voodoo_player = NULL;
+
+     player->server      = NULL;
+     player->apps        = NULL;
+     player->num_apps    = 0;
+     player->launch_func = NULL;
+     player->stop_func   = NULL;
+     player->ctx         = NULL;
+     player->instances   = NULL;
+
+     pthread_mutex_destroy( &player->instances_lock );
+     pthread_cond_destroy( &player->instances_cond );
+
+     voodoo_server_destroy( server );
+
+     return ret;
+}
+
+DirectResult
+voodoo_player_get_apps( VoodooPlayer         *player,
+                        unsigned int          max_num,
+                        unsigned int         *ret_num,
+                        VoodooAppDescription *ret_apps )
+{
+     D_ASSERT( player != NULL );
+     D_ASSERT( ret_num != NULL );
+     D_ASSERT( ret_apps != NULL );
+
+     ///
+
+     unsigned int num = max_num;
+
+     if (num > player->num_apps)
+          num = player->num_apps;
+
+     *ret_num = num;
+
+     direct_memcpy( ret_apps, player->apps, sizeof(VoodooAppDescription) * num );
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_launch_app( VoodooPlayer *player,
+                          const u8      app_uuid[16],
+                          const u8      player_uuid[16],
+                          u8            ret_instance_uuid[16] )
+{
+     DirectResult ret;
+     int          i;
+
+     D_ASSERT( player != NULL );
+     D_ASSERT( app_uuid != NULL );
+     D_ASSERT( player_uuid != NULL );
+     D_ASSERT( ret_instance_uuid != NULL );
+
+
+     char buf1[33];
+     char buf2[33];
+
+     snprintf( buf1, sizeof(buf1), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               app_uuid[0], app_uuid[1], app_uuid[2], app_uuid[3], app_uuid[4],
+               app_uuid[5], app_uuid[6], app_uuid[7], app_uuid[8], app_uuid[9],
+               app_uuid[10], app_uuid[11], app_uuid[12], app_uuid[13], app_uuid[14],
+               app_uuid[15] );
+
+     snprintf( buf2, sizeof(buf2), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               player_uuid[0], player_uuid[1], player_uuid[2], player_uuid[3], player_uuid[4],
+               player_uuid[5], player_uuid[6], player_uuid[7], player_uuid[8], player_uuid[9],
+               player_uuid[10], player_uuid[11], player_uuid[12], player_uuid[13], player_uuid[14],
+               player_uuid[15] );
+
+     D_INFO( "Voodoo/Player: Launching application %s on %s...\n", buf1, buf2 );
+
+
+     const VoodooAppDescription *app = NULL;
+
+     for (i=0; i<player->num_apps; i++) {
+          if (!memcmp( app_uuid, player->apps[i].uuid, 16 )) {
+               app = &player->apps[i];
+               break;
+          }
+     }
+
+     if (!app) {
+          D_ERROR( "Voodoo/Player: Could not lookup application with UUID %s!\n", buf1 );
+          return DR_ITEMNOTFOUND;
+     }
+
+
+     VoodooPlayInfo info;
+     char           addr[1000];
+
+
+     voodoo_player_broadcast( player );
+     sleep( 1 );
+
+     ret = voodoo_player_lookup( player, player_uuid, &info, addr, sizeof(addr) );
+     if (ret) {
+          if (   (player_uuid[0]==0xf0) && (player_uuid[1]==0xf0) && (player_uuid[2]==0xf0) && (player_uuid[3]==0xf0) 
+			  && (player_uuid[4]==0xf0) && (player_uuid[5]==0xf0) && (player_uuid[6]==0xf0) && (player_uuid[7]==0xf0) 
+			  && (player_uuid[8]==0xf0) && (player_uuid[9]==0xf0) && (player_uuid[10]==0xf0) && (player_uuid[11]==0xf0) )
+		  {
+			  sprintf(addr, "%d.%d.%d.%d", player_uuid[12], player_uuid[13], player_uuid[14], player_uuid[15]);
+		  }
+		  else
+		  {
+            D_DERROR( ret, "Voodoo/Player: Could not lookup player with UUID %s!\n", buf2 );
+            return ret;
+		  }
+     }
+
+
+     VoodooAppInstance *instance;
+
+     instance = D_CALLOC( 1, sizeof(VoodooAppInstance) );
+     if (!instance)
+          return D_OOM();
+
+     ret = player->launch_func( player, player->ctx, app, &info, addr, &instance->data );
+     if (ret) {
+          D_DERROR( ret, "Voodoo/Player: Could not launch application '%s'\n", app->name );
+          D_FREE( instance );
+          return ret;
+     }
+
+     generate_uuid( instance->uuid );
+
+     direct_memcpy( &instance->app, app, sizeof(VoodooAppDescription) );
+     direct_memcpy( instance->player_uuid, player_uuid, 16 );
+     
+
+
+     pthread_mutex_lock( &player->instances_lock );
+
+     direct_list_append( &player->instances, &instance->link );
+
+     direct_memcpy( ret_instance_uuid, instance->uuid, 16 );
+
+     pthread_mutex_unlock( &player->instances_lock );
+
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_stop_instance( VoodooPlayer *player,
+                             const u8      instance_uuid[16] )
+{
+     DirectResult       ret;
+     char               buf1[33];
+     VoodooAppInstance *instance;
+
+     snprintf( buf1, sizeof(buf1), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               instance_uuid[0], instance_uuid[1], instance_uuid[2], instance_uuid[3], instance_uuid[4],
+               instance_uuid[5], instance_uuid[6], instance_uuid[7], instance_uuid[8], instance_uuid[9],
+               instance_uuid[10], instance_uuid[11], instance_uuid[12], instance_uuid[13], instance_uuid[14],
+               instance_uuid[15] );
+
+     D_INFO( "Voodoo/Player: Stopping instance %s...\n", buf1 );
+
+     pthread_mutex_lock( &player->instances_lock );
+
+     direct_list_foreach (instance, player->instances) {
+          if (!memcmp( instance->uuid, instance_uuid, 16 ))
+               break;
+     }
+
+     if (!instance) {
+          D_ERROR( "Voodoo/Player: Could not find instance with UUID %s!\n", buf1 );
+          pthread_mutex_unlock( &player->instances_lock );
+          return DR_NOSUCHINSTANCE;
+     }
+
+     ret = player->stop_func( player, player->ctx, instance->data );
+     if (ret) {
+          D_DERROR( ret, "Voodoo/Player: Could not stop instance with UUID %s!\n", buf1 );
+          pthread_mutex_unlock( &player->instances_lock );
+          return ret;
+     }
+
+     direct_list_remove( &player->instances, &instance->link );
+
+     pthread_cond_broadcast( &player->instances_cond );
+
+     pthread_mutex_unlock( &player->instances_lock );
+
+     D_FREE( instance );
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_wait_instance( VoodooPlayer *player,
+                             const u8      instance_uuid[16] )
+{
+     char               buf1[33];
+     VoodooAppInstance *instance;
+
+     snprintf( buf1, sizeof(buf1), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               instance_uuid[0], instance_uuid[1], instance_uuid[2], instance_uuid[3], instance_uuid[4],
+               instance_uuid[5], instance_uuid[6], instance_uuid[7], instance_uuid[8], instance_uuid[9],
+               instance_uuid[10], instance_uuid[11], instance_uuid[12], instance_uuid[13], instance_uuid[14],
+               instance_uuid[15] );
+
+     D_INFO( "Voodoo/Player: Waiting for instance %s...\n", buf1 );
+
+
+     do {
+          pthread_mutex_lock( &player->instances_lock );
+
+          direct_list_foreach (instance, player->instances) {
+               if (!memcmp( instance->uuid, instance_uuid, 16 )) {
+                    pthread_cond_wait( &player->instances_cond, &player->instances_lock );
+                    break;
+               }
+          }
+
+          pthread_mutex_unlock( &player->instances_lock );
+     } while (instance);
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_player_get_instances( VoodooPlayer                 *player,
+                             unsigned int                  max_num,
+                             unsigned int                 *ret_num,
+                             VoodooAppInstanceDescription *ret_instances )
+{
+     VoodooAppInstance *instance;
+
+     D_ASSERT( player != NULL );
+     D_ASSERT( ret_num != NULL );
+     D_ASSERT( ret_instances != NULL );
+
+     ///
+
+     pthread_mutex_lock( &player->instances_lock );
+
+     unsigned int i = 0;
+
+     direct_list_foreach (instance, player->instances) {
+          if (i == max_num)
+               break;
+
+          direct_memcpy( ret_instances[i].uuid,        instance->uuid,        16 );
+          direct_memcpy( &ret_instances[i].app,        &instance->app,        sizeof(VoodooAppDescription) );
+          direct_memcpy( ret_instances[i].player_uuid, instance->player_uuid, 16 );
+
+          i++;
+     }
+
+     *ret_num = i;
+
+     pthread_mutex_unlock( &player->instances_lock );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/play_server.h b/Source/DirectFB/lib/voodoo/play_server.h
new file mode 100755
index 0000000..9677e7e
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/play_server.h
@@ -0,0 +1,79 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__PLAY_SERVER_H__
+#define __VOODOO__PLAY_SERVER_H__
+
+#include <voodoo/app.h>
+#include <voodoo/play.h>
+
+
+typedef DirectResult (*VoodooPlayerLaunchFunc)( VoodooPlayer                *player,
+                                                void                        *ctx,
+                                                const VoodooAppDescription  *app,
+                                                const VoodooPlayInfo        *player_info,
+                                                const char                  *player_addr,
+                                                void                       **ret_data );
+
+typedef DirectResult (*VoodooPlayerStopFunc)  ( VoodooPlayer               *player,
+                                                void                       *ctx,
+                                                void                       *data );
+
+
+DirectResult voodoo_player_run_server   ( VoodooPlayer                 *player,
+                                          const VoodooAppDescription   *apps,
+                                          unsigned int                  num_apps,
+                                          VoodooPlayerLaunchFunc        launch_func,
+                                          VoodooPlayerStopFunc          stop_func,
+                                          void                         *ctx );
+                                                                       
+DirectResult voodoo_player_get_apps     ( VoodooPlayer                 *player,
+                                          unsigned int                  max_num,
+                                          unsigned int                 *ret_num,
+                                          VoodooAppDescription         *ret_apps );
+                                                                       
+DirectResult voodoo_player_launch_app   ( VoodooPlayer                 *player,
+                                          const u8                      app_uuid[16],
+                                          const u8                      player_uuid[16],
+                                          u8                            ret_instance_uuid[16] );
+                                                                       
+DirectResult voodoo_player_stop_instance( VoodooPlayer                 *player,
+                                          const u8                      instance_uuid[16] );
+                                                                       
+DirectResult voodoo_player_wait_instance( VoodooPlayer                 *player,
+                                          const u8                      instance_uuid[16] );
+
+DirectResult voodoo_player_get_instances( VoodooPlayer                 *player,
+                                          unsigned int                  max_num,
+                                          unsigned int                 *ret_num,
+                                          VoodooAppInstanceDescription *ret_instances );
+
+
+extern VoodooPlayer *voodoo_player;
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/server.c b/Source/DirectFB/lib/voodoo/server.c
new file mode 100755
index 0000000..0c543b6
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/server.c
@@ -0,0 +1,459 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include <semaphore.h>
+
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/server.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+#include <voodoo/manager.h>
+
+
+typedef struct {
+     sem_t          sem;
+
+     pid_t          gfxpid;
+} ServerShared;
+
+typedef struct {
+     DirectLink     link;
+
+     VoodooLink     vl;
+     VoodooManager *manager;
+} Connection;
+
+typedef struct {
+     const char           *name;
+     VoodooSuperConstruct  func;
+     void                 *ctx;
+
+     IAny                 *interface;
+} Super;
+
+#define MAX_SUPER   8
+
+struct __V_VoodooServer {
+     int         fd;
+
+     bool        quit;
+     DirectLink *connections;
+
+     int         num_super;
+     Super       supers[MAX_SUPER];
+
+     ServerShared *shared;
+};
+
+/**************************************************************************************************/
+
+static DirectResult accept_connection( VoodooServer *server, int fd );
+
+/**************************************************************************************************/
+
+static const int one = 1;
+
+/**************************************************************************************************/
+
+DirectResult
+voodoo_server_create( VoodooServer **ret_server )
+{
+     DirectResult        ret;
+     struct sockaddr_in  addr;
+     int                 fd     = -1;
+     VoodooServer       *server = NULL;
+
+     D_ASSERT( ret_server != NULL );
+
+     /* Create the server socket. */
+     fd = socket( PF_INET, SOCK_STREAM, 0 );
+     if (fd < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Server: Could not create the socket via socket()!\n" );
+          goto error;
+     }
+
+     /* Allow reuse of local address. */
+     if (setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one) ) < 0)
+          D_PERROR( "Voodoo/Server: Could not set SO_REUSEADDR!\n" );
+
+     /* Bind the socket to the local port. */
+     addr.sin_family      = AF_INET;
+     addr.sin_addr.s_addr = inet_addr( "0.0.0.0" );
+     addr.sin_port        = htons( 2323 );
+
+     if (bind( fd, &addr, sizeof(addr) )) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Server: Could not bind() the socket!\n" );
+          goto error;
+     }
+
+     /* Start listening. */
+     if (listen( fd, 4 )) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Server: Could not listen() to the socket!\n" );
+          goto error;
+     }
+
+     /* Allocate server structure. */
+     server = D_CALLOC( 1, sizeof(VoodooServer) );
+     if (!server) {
+          ret = D_OOM();
+          D_WARN( "out of memory" );
+          goto error;
+     }
+
+     /* Initialize server structure. */
+     server->fd = fd;
+
+     {
+          int zfd;
+
+          zfd = open( "/dev/zero", O_RDWR );
+          if (zfd < 0) {
+               ret = errno2result( errno );
+               D_PERROR( "Voodoo/Server: Failed to open /dev/zero!\n" );
+               goto error;
+          }
+
+          server->shared = mmap( NULL, sizeof(ServerShared), PROT_READ | PROT_WRITE, MAP_SHARED, zfd, 0 );
+
+          close( zfd );
+
+          if (server->shared == MAP_FAILED) {
+               ret = errno2result( errno );
+               D_PERROR( "Voodoo/Server: Failed to mmap /dev/zero!\n" );
+               server->shared = NULL;
+               goto error;
+          }
+
+          if (sem_init( &server->shared->sem, 1, 1 )) {
+               ret = errno2result( errno );
+               D_PERROR( "Voodoo/Server: Failed to create process shared semaphore!\n" );
+               goto error;
+          }
+     }
+
+     /* Return the new server. */
+     *ret_server = server;
+
+     return DR_OK;
+
+
+error:
+     if (server) {
+          if (server->shared)
+               munmap( server->shared, sizeof(ServerShared) );
+
+          D_FREE( server );
+     }
+
+     if (fd >= 0)
+          close( fd );
+
+     return ret;
+}
+
+DirectResult
+voodoo_server_register( VoodooServer         *server,
+                        const char           *name,
+                        VoodooSuperConstruct  func,
+                        void                 *ctx )
+{
+     Super *super;
+
+     D_ASSERT( server != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( func != NULL );
+
+     if (server->num_super == MAX_SUPER)
+          return DR_LIMITEXCEEDED;
+
+     super = &server->supers[server->num_super++];
+
+     super->name = name;
+     super->func = func;
+     super->ctx  = ctx;
+
+     return DR_OK;
+}
+
+static inline Super *
+lookup_super( VoodooServer *server,
+              const char   *name )
+{
+     int i;
+
+     D_ASSERT( server != NULL );
+     D_ASSERT( name != NULL );
+
+     for (i=0; i<server->num_super; i++) {
+          Super *super = &server->supers[i];
+
+          if (! strcmp( name, super->name ))
+               return super;
+     }
+
+     return NULL;
+}
+
+DirectResult
+voodoo_server_construct( VoodooServer      *server,
+                         VoodooManager     *manager,
+                         const char        *name,
+                         VoodooInstanceID  *ret_instance )
+{
+     DirectResult      ret;
+     Super            *super;
+     VoodooInstanceID  instance;
+
+     D_ASSERT( server != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( ret_instance != NULL );
+
+     super = lookup_super( server, name );
+     if (!super) {
+          D_ERROR( "Voodoo/Server: Super interface '%s' is not available!\n", name );
+          return DR_UNSUPPORTED;
+     }
+
+     if (!strcmp( name, "IDirectFB" )) {
+          sem_wait( &server->shared->sem );
+
+          if (server->shared->gfxpid) {
+               D_INFO( "Voodoo/Server: Killing previous graphics process with pid %d\n", server->shared->gfxpid );
+               kill( server->shared->gfxpid, SIGTERM );
+          }
+
+          server->shared->gfxpid = getpid();
+
+          D_INFO( "Voodoo/Server: New graphics process has pid %d\n", server->shared->gfxpid );
+
+          sem_post( &server->shared->sem );
+     }
+
+     ret = super->func( server, manager, name, super->ctx, &instance );
+     if (ret) {
+          D_ERROR( "Voodoo/Server: "
+                   "Creating super interface '%s' failed (%s)!\n", name, DirectResultString(ret) );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_server_run( VoodooServer *server,
+                   bool          forking )
+{
+     DirectLink *l, *n;
+     struct pollfd pf;
+     bool           listener = true;
+
+     D_ASSERT( server != NULL );
+
+     while (!server->quit) {
+          /* Cleanup dead connections. */
+          direct_list_foreach_safe (l, n, server->connections) {
+               Connection *connection = (Connection*) l;
+
+               if (voodoo_manager_is_closed( connection->manager )) {
+                    sem_wait( &server->shared->sem );
+
+                    if (server->shared->gfxpid == getpid()) {
+                         D_INFO( "Voodoo/Server: Closing graphics process with pid %d\n", server->shared->gfxpid );
+                         server->shared->gfxpid = 0;
+                    }
+
+                    sem_post( &server->shared->sem );
+
+
+                    voodoo_manager_destroy( connection->manager );
+
+                    //connection->vl.Close( &connection->vl );
+
+                    direct_list_remove( &server->connections, l );
+
+                    D_INFO( "Voodoo/Server: Closed connection.\n" );
+
+                    D_FREE( connection );
+
+                    if (forking && !server->connections)
+                         return DR_OK;
+               }
+          }
+
+          if (listener) {
+               int              i;
+               int              fd;
+               struct sockaddr  addr;
+               socklen_t        addrlen = sizeof(addr);
+
+          pf.fd     = server->fd;
+          pf.events = POLLIN;
+
+          switch (poll( &pf, 1, 200 )) {
+               default:
+                         fd = accept( server->fd, &addr, &addrlen );
+                         if (fd < 0) {
+                              D_PERROR( "Voodoo/Server: Could not accept() incoming connection!\n" );
+                    break;
+                         }
+
+                         if (forking) {
+                              switch (fork()) {
+               case 0:
+                                        listener = false;
+     
+                                        for (i=3; i<65535; i++) {
+                                             if (i != fd)
+                                                  close( i );
+                                        }
+     
+                                        accept_connection( server, fd );
+                                        break;
+     
+                                   case -1:
+                                        D_PERROR( "Voodoo/Server: Could not fork()!\n" );
+                                        break;
+     
+                                   default:
+                                        close( fd );
+                                        break;
+                              }
+                         }
+                         else {
+                              accept_connection( server, fd );
+                         }
+                         break;
+
+                    case 0:
+                         waitpid( -1, NULL, WNOHANG );
+
+                    D_DEBUG( "Voodoo/Server: Timeout during poll()\n" );
+                    break;
+
+               case -1:
+                    if (errno != EINTR) {
+                         D_PERROR( "Voodoo/Server: Could not poll() the socket!\n" );
+                         server->quit = true;
+                    }
+                    break;
+          }
+     }
+          else
+               usleep( 200000 );
+     }
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_server_destroy( VoodooServer *server )
+{
+     DirectLink *l;
+
+     D_ASSERT( server != NULL );
+
+     close( server->fd );
+
+     /* Close all connections. */
+     direct_list_foreach (l, server->connections) {
+          Connection *connection = (Connection*) l;
+
+          voodoo_manager_destroy( connection->manager );
+
+          //connection->vl.Close( &connection->vl );
+
+          D_FREE( connection );
+     }
+
+     D_FREE( server );
+
+     return DR_OK;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+accept_connection( VoodooServer *server, int fd )
+{
+     DirectResult  ret;
+     int           fds[2] = { fd, fd };
+     Connection   *connection;
+
+     connection = D_CALLOC( 1, sizeof(Connection) );
+     if (!connection) {
+          D_WARN( "out of memory" );
+          return DR_NOLOCALMEMORY;
+     }
+
+     voodoo_link_init_fd( &connection->vl, fds );
+
+     ret = voodoo_manager_create( &connection->vl, NULL, server, &connection->manager );
+     if (ret) {
+          connection->vl.Close( &connection->vl );
+          D_FREE( connection );
+          return ret;
+     }
+
+     direct_list_prepend( &server->connections, &connection->link );
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/server.h b/Source/DirectFB/lib/voodoo/server.h
new file mode 100755
index 0000000..e00329f
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/server.h
@@ -0,0 +1,52 @@
+/*
+   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__SERVER_H__
+#define __VOODOO__SERVER_H__
+
+#include <voodoo/types.h>
+
+
+DirectResult voodoo_server_create  ( VoodooServer         **ret_server );
+
+DirectResult voodoo_server_register( VoodooServer          *server,
+                                     const char            *name,
+                                     VoodooSuperConstruct   func,
+                                     void                  *ctx );
+
+DirectResult voodoo_server_run     ( VoodooServer          *server,
+                                     bool                   forking );
+
+DirectResult voodoo_server_destroy ( VoodooServer          *server );
+
+DirectResult voodoo_server_construct( VoodooServer         *server,
+                                      VoodooManager        *manager,
+                                      const char           *name,
+                                      VoodooInstanceID     *ret_instance );
+
+#endif
diff --git a/Source/DirectFB/lib/voodoo/types.h b/Source/DirectFB/lib/voodoo/types.h
new file mode 100755
index 0000000..ef9277c
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/types.h
@@ -0,0 +1,97 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VOODOO__TYPES_H__
+#define __VOODOO__TYPES_H__
+
+#include <direct/types.h>
+
+#include "compat.h"
+
+#ifdef WIN32
+// The following ifdef block is the standard way of creating macros which make exporting 
+// from a DLL simpler. All files within this DLL are compiled with the VOODOO_EXPORTS
+// symbol defined on the command line. This symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see 
+// VOODOO_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef VOODOO_EXPORTS
+#define VOODOO_API __declspec(dllexport)
+#else
+#define VOODOO_API __declspec(dllimport)
+#endif
+#else
+#define VOODOO_API
+#endif
+
+
+typedef u32 VoodooInstanceID;
+typedef u32 VoodooMethodID;
+typedef u32 VoodooMessageSerial;
+
+#define VOODOO_INSTANCE_NONE  ((VoodooInstanceID) 0)
+
+
+typedef struct __V_VoodooMessageHeader   VoodooMessageHeader;
+typedef struct __V_VoodooSuperMessage    VoodooSuperMessage;
+typedef struct __V_VoodooRequestMessage  VoodooRequestMessage;
+typedef struct __V_VoodooResponseMessage VoodooResponseMessage;
+
+
+typedef struct __V_VoodooClient          VoodooClient;
+typedef struct __V_VoodooConfig          VoodooConfig;
+typedef struct __V_VoodooLink            VoodooLink;
+typedef struct __V_VoodooPlayer          VoodooPlayer;
+typedef struct __V_VoodooServer          VoodooServer;
+
+#ifdef __cplusplus
+class VoodooConnection;
+class VoodooManager;
+class VoodooPacket;
+#else
+typedef void*         VoodooManager;
+#endif
+
+
+typedef DirectResult (*VoodooSuperConstruct)( VoodooServer         *server,
+                                              VoodooManager        *manager,
+                                              const char           *name,
+                                              void                 *ctx,
+                                              VoodooInstanceID     *ret_instance );
+
+typedef DirectResult (*VoodooDispatch)      ( void                 *dispatcher,
+                                              void                 *real,
+                                              VoodooManager        *manager,
+                                              VoodooRequestMessage *msg );
+
+
+#define MAX_MSG_SIZE          (17 * 1024)
+#define VOODOO_PACKET_MAX     (MAX_MSG_SIZE)
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/unix/interfaces_unix.c b/Source/DirectFB/lib/voodoo/unix/interfaces_unix.c
new file mode 100755
index 0000000..5c3b1f8
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/unix/interfaces_unix.c
@@ -0,0 +1,237 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/mem.h>
+
+#include <voodoo/play.h>
+
+#include <unistd.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <net/if.h>
+
+#include <sys/ioctl.h>
+
+
+
+DirectResult
+voodoo_play_get_broadcast( VoodooPlayAddress **ret_addr,
+                           size_t             *ret_num )
+{
+     size_t             num = 0;
+     size_t             i   = 0;
+     VoodooPlayAddress *addr;
+
+     int            ret;
+     int            fd;
+     char          *ptr, lastname[IFNAMSIZ];
+     struct ifreq   req[16];
+     struct ifconf  conf;
+
+     D_ASSERT( ret_addr != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     conf.ifc_buf = (char*) req;
+     conf.ifc_len = sizeof(req);
+
+     fd = socket( AF_INET, SOCK_DGRAM, 0 );
+     if (fd < 0) {
+          D_PERROR( "Voodoo/Unix: socket( AF_INET, SOCK_DGRAM, 0 ) failed!\n" );
+          return DR_FAILURE;
+     }
+
+     ret = ioctl( fd, SIOCGIFCONF, &conf );
+     if (ret) {
+          D_PERROR( "Voodoo/Player: ioctl( SIOCGIFCONF ) failed!\n" );
+          close( fd );
+          return DR_FAILURE;
+     }
+
+     lastname[0] = 0;
+
+     for (ptr = conf.ifc_buf; ptr < conf.ifc_buf + conf.ifc_len; ) {
+          struct ifreq         ifrcopy, *ifr  = (struct ifreq *)ptr;
+          struct sockaddr_in  *saddr = (struct sockaddr_in*) &ifr->ifr_broadaddr;
+
+#ifdef MACOS
+          ptr += sizeof(ifr->ifr_name) + MAX(sizeof(struct sockaddr), ifr->ifr_addr.sa_len); // for next one in buffer
+#else
+          ptr += sizeof(req[0]);
+#endif
+
+          if (strncmp(lastname, ifr->ifr_name, IFNAMSIZ) == 0) {
+               continue; /* already processed this interface */
+          }
+
+          memcpy(lastname, ifr->ifr_name, IFNAMSIZ);
+
+          ifrcopy = *ifr;
+          ioctl( fd, SIOCGIFFLAGS, &ifrcopy);
+          if ((ifrcopy.ifr_flags & IFF_UP) == 0)
+               continue;   // ignore if interface not up
+
+          ret = ioctl( fd, SIOCGIFBRDADDR, ifr );
+          if (ret)
+               continue;
+
+          if (!saddr->sin_addr.s_addr) {
+               ret = ioctl( fd, SIOCGIFDSTADDR, ifr );
+               if (ret)
+                    continue;
+          }
+
+          num++;
+     }
+
+
+     addr = D_CALLOC( num, sizeof(VoodooPlayAddress) );
+     if (!addr) {
+          close( fd );
+          return D_OOM();
+     }
+
+
+     for (ptr = conf.ifc_buf; ptr < conf.ifc_buf + conf.ifc_len; ) {
+          char                 buf[100];
+          struct ifreq         ifrcopy, *ifr  = (struct ifreq *)ptr;
+          struct sockaddr_in  *saddr = (struct sockaddr_in*) &ifr->ifr_broadaddr;
+
+#ifdef MACOS
+          ptr += sizeof(ifr->ifr_name) + MAX(sizeof(struct sockaddr), ifr->ifr_addr.sa_len); // for next one in buffer
+#else
+          ptr += sizeof(req[0]);
+#endif
+
+          if (strncmp(lastname, ifr->ifr_name, IFNAMSIZ) == 0) {
+               continue; /* already processed this interface */
+          }
+
+          memcpy(lastname, ifr->ifr_name, IFNAMSIZ);
+
+          ifrcopy = *ifr;
+          ioctl( fd, SIOCGIFFLAGS, &ifrcopy);
+          if ((ifrcopy.ifr_flags & IFF_UP) == 0) {
+               D_INFO( "Voodoo/Player:   %-16s is not up.\n", ifrcopy.ifr_name );
+               continue;   // ignore if interface not up
+          }
+
+          ret = ioctl( fd, SIOCGIFBRDADDR, ifr );
+          if (ret) {
+               D_PERROR( "Voodoo/Player: ioctl( SIOCGIFBRDADDR ) %-16s failed!\n", ifr->ifr_name );
+               continue;
+          }
+
+          if (saddr->sin_addr.s_addr) {
+               inet_ntop( AF_INET, &saddr->sin_addr, buf, sizeof(buf) );
+
+               D_INFO( "Voodoo/Player:   %-16s (%s)\n", ifr->ifr_name, buf );
+          }
+          else {
+               ret = ioctl( fd, SIOCGIFDSTADDR, ifr );
+               if (ret) {
+                    D_PERROR( "Voodoo/Player: ioctl( SIOCGIFDSTADDR ) failed!\n" );
+                    continue;
+               }
+
+               inet_ntop( AF_INET, &saddr->sin_addr, buf, sizeof(buf) );
+
+               D_INFO( "Voodoo/Player:   %-16s (%s) (P-t-P)\n", ifr->ifr_name, buf );
+          }
+
+          voodoo_play_from_inet_addr( &addr[i++], saddr->sin_addr.s_addr );
+     }
+
+     close( fd );
+
+     *ret_addr = addr;
+     *ret_num  = num;
+
+     return DR_OK;
+}
+
+
+
+#if 0
+
+DirectResult
+voodoo_play_get_broadcast( VoodooPlayAddress **ret_addr,
+                           size_t             *ret_num )
+{
+     DirectResult       ret = DR_OK;
+     VoodooPlayAddress *addr;
+
+     // Get local host name
+     char szHostName[128] = "";
+
+     if (gethostname(szHostName, sizeof(szHostName))) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Win32: gethostname() failed!\n" );
+          return ret;
+     }
+
+     // Get local IP addresses
+     struct hostent *pHost = 0;
+
+     pHost = gethostbyname(szHostName);
+     if (!pHost) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Win32: gethostbyname('%s') failed!\n", szHostName );
+          return ret;
+     }
+
+
+     size_t iCnt, iTotal = 0;
+
+     for (iCnt = 0; pHost->h_addr_list[iCnt]; ++iCnt)
+          iTotal++;
+
+
+     addr = D_CALLOC( iTotal, sizeof(VoodooPlayAddress) );
+     if (!addr)
+          return D_OOM();
+
+     for (iCnt = 0; pHost->h_addr_list[iCnt]; ++iCnt) {
+          struct sockaddr_in SocketAddress;
+
+          memcpy(&SocketAddress.sin_addr, pHost->h_addr_list[iCnt], pHost->h_length);
+
+          voodoo_play_from_inet_addr( &addr[iCnt], SocketAddress.sin_addr.s_addr );
+     }
+
+     *ret_addr = addr;
+     *ret_num  = iTotal;
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/lib/voodoo/unix/link_unix.c b/Source/DirectFB/lib/voodoo/unix/link_unix.c
new file mode 100755
index 0000000..1b6690c
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/unix/link_unix.c
@@ -0,0 +1,567 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+//#include <aio.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+#include <voodoo/manager.h>
+#include <voodoo/play.h>
+
+
+#define UNIX_PATH_MAX	108
+
+
+D_DEBUG_DOMAIN( Voodoo_Link, "Voodoo/Link", "Voodoo Link" );
+
+/**********************************************************************************************************************/
+
+#if !VOODOO_BUILD_NO_SETSOCKOPT
+static const int one = 1;
+static const int tos = IPTOS_LOWDELAY;
+#endif
+
+/**********************************************************************************************************************/
+
+#define DUMP_SOCKET_OPTION(fd,o)                                                \
+do {                                                                            \
+     int val = 0;                                                               \
+     unsigned int len = 4;                                                      \
+                                                                                \
+     if (getsockopt( fd, SOL_SOCKET, o, &val, &len ))                           \
+          D_PERROR( "Voodoo/Manager: getsockopt() for " #o " failed!\n" );      \
+     else                                                                       \
+          D_DEBUG( "Voodoo/Manager: " #o " is %d\n", val );                     \
+} while (0)
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int fd[2];
+     int wakeup_fds[2];
+} Link;
+
+static void
+Close( VoodooLink *link )
+{
+     Link *l = link->priv;
+
+     D_INFO( "Voodoo/Link: Closing connection.\n" );
+
+     close( l->fd[0] );
+
+     if (l->fd[1] != l->fd[0])
+          close( l->fd[1] );
+
+     close( l->wakeup_fds[0] );
+     close( l->wakeup_fds[1] );
+
+     D_FREE( link->priv );
+     link->priv = NULL;
+}
+
+static ssize_t
+Read( VoodooLink *link,
+      void       *buffer,
+      size_t      count )
+{
+     Link *l = link->priv;
+
+     return recv( l->fd[0], buffer, count, 0 );
+}
+
+static ssize_t
+Write( VoodooLink *link,
+       const void *buffer,
+       size_t      count )
+{
+     Link *l = link->priv;
+
+     return send( l->fd[1], buffer, count, 0 );
+}
+
+
+// FIXME: refactor, optionally using lio_listio
+static DirectResult
+SendReceive( VoodooLink  *link,
+             VoodooChunk *sends,
+             size_t       num_send,
+             VoodooChunk *recvs,
+             size_t       num_recv )
+{
+     Link    *l = link->priv;
+     size_t   i;
+     ssize_t  ret;
+     int      select_result;
+
+     D_DEBUG_AT( Voodoo_Link, "%s( link %p, sends %p, num_send %zu, recvs %p, num_recv %zu )\n",
+                 __func__, link, sends, num_send, recvs, num_recv );
+
+     while (true) {
+          fd_set fds_read;
+          fd_set fds_write;
+          struct timeval tv;
+
+          FD_ZERO( &fds_read );
+          FD_ZERO( &fds_write );
+
+          if (num_recv)
+               FD_SET( l->fd[0], &fds_read );
+
+          if (num_send)
+               FD_SET( l->fd[1], &fds_write );
+
+          FD_SET( l->wakeup_fds[0], &fds_read );
+
+          tv.tv_sec  = 1;
+          tv.tv_usec = 0;
+
+          D_DEBUG_AT( Voodoo_Link, "  -> select( %s%s )...\n", num_recv ? "R" : " ", num_send ? "W" : " " );
+          select_result = select( MAX(MAX(l->wakeup_fds[0],l->fd[0]),l->fd[1])+1, &fds_read, &fds_write, NULL, &tv );
+          switch (select_result) {
+               default:
+                    if (FD_ISSET( l->fd[1], &fds_write )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => WRITE\n" );
+
+                         for (i=0; i<num_send; i++) {
+                              while (sends[i].done != sends[i].length) {
+#if 1
+                                   ret = send( l->fd[1], sends[i].ptr, sends[i].length, MSG_DONTWAIT );
+                                   if (ret < 0) {
+                                        D_PERROR( "Voodoo/Link: Failed to send() data!\n" );
+                                        return DR_IO;
+                                   }
+                                   else {
+                                        sends[i].done += ret;
+/*
+                                        if (sends[i].done != sends[i].length)
+                                             D_WARN( "partial send of %d/%d bytes", ret, sends[i].length );
+                                        else
+                                             D_WARN( "full send of %d bytes", ret, sends[i].length );
+*/
+                                        return DR_OK;
+                                   }
+#else
+                                   struct aiocb cb;
+
+                                   memset( &cb, 0, sizeof(struct aiocb) );
+
+                                   cb.aio_fildes = l->fd[1];
+                                   cb.aio_buf    = sends[i].ptr;
+                                   cb.aio_nbytes = sends[i].length;
+                                   cb.aio_offset = (intptr_t)-1;
+                                   cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+
+                                   ret = aio_write( &cb );
+                                   if (ret < 0) {
+                                        D_PERROR( "Voodoo/Link: aio_write() failed!\n" );
+                                        return DR_IO;
+                                   }
+                                   else {
+                                        do {
+                                             const struct aiocb *cbs[] = { &cb };
+
+                                             ret = aio_suspend( cbs, 1, NULL );
+                                             if (ret < 0) {
+                                                  D_PERROR( "Voodoo/Link: aio_suspend() failed!\n" );
+                                                  return DR_IO;
+                                             }
+
+                                             ret = aio_error( &cb );
+                                        } while (ret == EINPROGRESS);
+
+                                        switch (ret) {
+                                             case 0:
+                                                  ret = aio_return( &cb );
+                                                  if (ret < 0) {
+                                                       D_ERROR( "Voodoo/Link: aio_return() failed!\n     -> %s\n", strerror(ret) );
+                                                       return DR_IO;
+                                                  }
+                                                  break;
+
+                                             default:
+                                                  D_ERROR( "Voodoo/Link: aio_error() failed!\n     -> %s\n", strerror(ret) );
+                                                  return DR_IO;
+                                        }
+
+                                        sends[i].done += ret;
+/*
+                                        if (sends[i].done != sends[i].length)
+                                             D_WARN( "partial send of %d/%d bytes", ret, sends[i].length );
+                                        else
+                                             D_WARN( "full send of %d bytes", ret, sends[i].length );
+*/
+                                        return DR_OK;
+                                   }
+#endif
+                              }
+                         }
+                    }
+
+                    if (FD_ISSET( l->fd[0], &fds_read )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => READ\n" );
+
+                         for (i=0; i<num_recv; i++) {
+                              ret = recv( l->fd[0], recvs[i].ptr, recvs[i].length, MSG_DONTWAIT );
+                              if (ret < 0) {
+                                   if (errno == EAGAIN) {
+                                        break;
+                                   }
+                                   D_PERROR( "Voodoo/Link: Failed to recv() data!\n" );
+                                   return DR_FAILURE;
+                              }
+
+                              if (!ret)
+                                   return DR_IO;
+
+
+                              recvs[i].done = ret;
+
+                              if (recvs[i].done < recvs[i].length)
+                                   break;
+                         }
+                    }
+
+                    if (FD_ISSET( l->wakeup_fds[0], &fds_read )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => WAKE UP\n" );
+
+                         static char buf[1000];
+                         read( l->wakeup_fds[0], buf, sizeof(buf) );
+                         if (!FD_ISSET( l->fd[0], &fds_read ) && !FD_ISSET( l->fd[0], &fds_write ))
+                              return DR_INTERRUPTED;
+                    }
+
+                    return DR_OK;
+
+               case 0:
+                    D_DEBUG_AT( Voodoo_Link, "  => TIMEOUT\n" );
+                    return DR_TIMEOUT;
+
+               case -1:
+                    D_ERROR( "Voodoo/Link: select() failed!\n" );
+                    return DR_FAILURE;
+          }
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+WakeUp( VoodooLink *link )
+{
+     Link *l = link->priv;
+     char  c = 0;
+
+     write( l->wakeup_fds[1], &c, 1 );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+voodoo_link_init_connect( VoodooLink *link,
+                          const char *hostname,
+                          int         port,
+                          bool        raw )
+{
+     DirectResult     ret;
+     int              err;
+     struct addrinfo  hints;
+     struct addrinfo *addr;
+     char             portstr[10];
+     Link            *l;
+
+
+     memset( &hints, 0, sizeof(hints) );
+     hints.ai_flags    = AI_CANONNAME;
+     hints.ai_socktype = SOCK_STREAM;
+     hints.ai_family   = PF_UNSPEC;
+
+     D_INFO( "Voodoo/Link: Looking up host '%s'...\n", hostname );
+
+     snprintf( portstr, sizeof(portstr), "%d", port );
+
+     err = getaddrinfo( hostname, portstr, &hints, &addr );
+     if (err) {
+          switch (err) {
+               case EAI_FAMILY:
+                    D_ERROR( "Direct/Log: Unsupported address family!\n" );
+                    return DR_UNSUPPORTED;
+
+               case EAI_SOCKTYPE:
+                    D_ERROR( "Direct/Log: Unsupported socket type!\n" );
+                    return DR_UNSUPPORTED;
+
+               case EAI_NONAME:
+                    D_ERROR( "Direct/Log: Host not found!\n" );
+                    return DR_FAILURE;
+
+               case EAI_SERVICE:
+                    D_ERROR( "Direct/Log: Service is unreachable!\n" );
+                    return DR_FAILURE;
+
+#ifdef EAI_ADDRFAMILY
+               case EAI_ADDRFAMILY:
+#endif
+               case EAI_NODATA:
+                    D_ERROR( "Direct/Log: Host found, but has no address!\n" );
+                    return DR_FAILURE;
+
+               case EAI_MEMORY:
+                    return D_OOM();
+
+               case EAI_FAIL:
+                    D_ERROR( "Direct/Log: A non-recoverable name server error occurred!\n" );
+                    return DR_FAILURE;
+
+               case EAI_AGAIN:
+                    D_ERROR( "Direct/Log: Temporary error, try again!\n" );
+                    return DR_TEMPUNAVAIL;
+
+               default:
+                    D_ERROR( "Direct/Log: Unknown error occured!?\n" );
+                    return DR_FAILURE;
+          }
+     }
+
+
+     l = D_CALLOC( 1, sizeof(Link) );
+     if (!l)
+          return D_OOM();
+
+     /* Create the client socket. */
+     l->fd[0] = socket( addr->ai_family, SOCK_STREAM, 0 );
+     if (l->fd[0] < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket creation failed!\n" );
+          freeaddrinfo( addr );
+          D_FREE( l );
+          return ret;
+     }
+     l->fd[1] = l->fd[0];
+
+#if !VOODOO_BUILD_NO_SETSOCKOPT
+//     if (setsockopt( l->fd[0], SOL_IP, IP_TOS, &tos, sizeof(tos) ) < 0)
+//          D_PERROR( "Voodoo/Manager: Could not set IP_TOS!\n" );
+
+     if (setsockopt( l->fd[0], SOL_TCP, TCP_NODELAY, &one, sizeof(one) ) < 0)
+          D_PERROR( "Voodoo/Manager: Could not set TCP_NODELAY!\n" );
+#endif
+
+     D_INFO( "Voodoo/Link: Connecting to '%s:%d'...\n", addr->ai_canonname, port );
+
+     /* Connect to the server. */
+     err = connect( l->fd[0], addr->ai_addr, addr->ai_addrlen );
+     freeaddrinfo( addr );
+
+     if (err) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket connect failed!\n" );
+          close( l->fd[0] );
+          D_FREE( l );
+          return ret;
+     }
+
+     D_INFO( "Voodoo/Link: Connected.\n" );
+
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDBUF );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVBUF );
+
+     if (!raw) {
+          link->code = 0x80008676;
+
+          if (write( l->fd[1], &link->code, sizeof(link->code) ) != 4) {
+               D_ERROR( "Voodoo/Link: Coult not write initial four bytes!\n" );
+               close( l->fd[0] );
+               D_FREE( l );
+               return DR_IO;
+          }
+     }
+     D_INFO( "Voodoo/Link: Sent link code (%s).\n", raw ? "raw" : "packet" );
+
+     pipe( l->wakeup_fds );
+
+
+     link->priv        = l;
+     link->Close       = Close;
+     link->Read        = Read;
+     link->Write       = Write;
+     link->SendReceive = SendReceive;
+     link->WakeUp      = WakeUp;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_link_init_local( VoodooLink *link,
+                        const char *path,
+                        bool        raw )
+{
+     DirectResult        ret;
+     int                 err;
+     struct sockaddr_un  addr;
+     Link               *l;
+
+     D_ASSERT( link != NULL );
+     D_ASSERT( path != NULL );
+
+     l = D_CALLOC( 1, sizeof(Link) );
+     if (!l)
+          return D_OOM();
+
+     /* Create the client socket. */
+     l->fd[0] = socket( AF_LOCAL, SOCK_STREAM, 0 );
+     if (l->fd[0] < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket creation failed!\n" );
+          D_FREE( l );
+          return ret;
+     }
+     l->fd[1] = l->fd[0];
+
+#if !VOODOO_BUILD_NO_SETSOCKOPT
+//     if (setsockopt( l->fd[0], SOL_IP, IP_TOS, &tos, sizeof(tos) ) < 0)
+//          D_PERROR( "Voodoo/Manager: Could not set IP_TOS!\n" );
+
+     if (setsockopt( l->fd[0], SOL_TCP, TCP_NODELAY, &one, sizeof(one) ) < 0)
+          D_PERROR( "Voodoo/Manager: Could not set TCP_NODELAY!\n" );
+#endif
+
+     D_INFO( "Voodoo/Link: Connecting to '%s'...\n", path );
+
+
+     memset( &addr, 0, sizeof(addr) );
+
+     /* Bind the socket to the local port. */
+     addr.sun_family = AF_UNIX;
+
+     snprintf( addr.sun_path + 1, UNIX_PATH_MAX - 1, "%s", path );
+
+     /* Connect to the server. */
+     err = connect( l->fd[0], (struct sockaddr*) &addr, strlen(addr.sun_path+1)+1 + sizeof(addr.sun_family) );
+     if (err) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket connect failed!\n" );
+          close( l->fd[0] );
+          D_FREE( l );
+          return ret;
+     }
+
+     D_INFO( "Voodoo/Link: Connected.\n" );
+
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDBUF );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVBUF );
+
+     if (!raw) {
+          link->code = 0x80008676;
+
+          if (write( l->fd[1], &link->code, sizeof(link->code) ) != 4) {
+               D_ERROR( "Voodoo/Link: Coult not write initial four bytes!\n" );
+               close( l->fd[0] );
+               D_FREE( l );
+               return DR_IO;
+          }
+     }
+     D_INFO( "Voodoo/Link: Sent link code (%s).\n", raw ? "raw" : "packet" );
+
+     pipe( l->wakeup_fds );
+
+
+     link->priv        = l;
+     link->Close       = Close;
+     link->Read        = Read;
+     link->Write       = Write;
+     link->SendReceive = SendReceive;
+     link->WakeUp      = WakeUp;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_link_init_fd( VoodooLink *link,
+                     int         fd[2] )
+{
+     Link *l;
+
+     if (read( fd[0], &link->code, sizeof(link->code) ) != 4) {
+          D_ERROR( "Voodoo/Link: Coult not read initial four bytes!\n" );
+          return DR_IO;
+     }
+
+     l = D_CALLOC( 1, sizeof(Link) );
+     if (!l)
+          return D_OOM();
+
+     l->fd[0] = fd[0];
+     l->fd[1] = fd[1];
+
+     pipe( l->wakeup_fds );
+
+     link->priv        = l;
+     link->Close       = Close;
+     link->Read        = Read;
+     link->Write       = Write;
+     link->SendReceive = SendReceive;
+     link->WakeUp      = WakeUp;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/unix/link_unix_1408limit.c b/Source/DirectFB/lib/voodoo/unix/link_unix_1408limit.c
new file mode 100755
index 0000000..790aa99
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/unix/link_unix_1408limit.c
@@ -0,0 +1,422 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/conf.h>
+#include <voodoo/internal.h>
+#include <voodoo/link.h>
+#include <voodoo/manager.h>
+#include <voodoo/play.h>
+
+
+D_DEBUG_DOMAIN( Voodoo_Link, "Voodoo/Link", "Voodoo Link" );
+
+/**********************************************************************************************************************/
+
+#if !VOODOO_BUILD_NO_SETSOCKOPT
+static const int one = 1;
+static const int tos = IPTOS_LOWDELAY;
+#endif
+
+/**********************************************************************************************************************/
+
+#define DUMP_SOCKET_OPTION(fd,o)                                                \
+do {                                                                            \
+     int val = 0;                                                               \
+     unsigned int len = 4;                                                      \
+                                                                                \
+     if (getsockopt( fd, SOL_SOCKET, o, &val, &len ))                           \
+          D_PERROR( "Voodoo/Manager: getsockopt() for " #o " failed!\n" );      \
+     else                                                                       \
+          D_DEBUG( "Voodoo/Manager: " #o " is %d\n", val );                     \
+} while (0)
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int fd[2];
+     int wakeup_fds[2];
+} Link;
+
+static void
+Close( VoodooLink *link )
+{
+     Link *l = link->priv;
+
+     D_INFO( "Voodoo/Link: Closing connection.\n" );
+
+     close( l->fd[0] );
+
+     if (l->fd[1] != l->fd[0])
+          close( l->fd[1] );
+
+     D_FREE( link->priv );
+     link->priv = NULL;
+}
+
+static ssize_t
+Read( VoodooLink *link,
+      void       *buffer,
+      size_t      count )
+{
+     Link *l = link->priv;
+
+     return recv( l->fd[0], buffer, count, 0 );
+}
+
+static ssize_t
+Write( VoodooLink *link,
+       const void *buffer,
+       size_t      count )
+{
+     Link *l = link->priv;
+
+     return send( l->fd[1], buffer, count, 0 );
+}
+
+
+// FIXME: refactor, optionally using lio_listio
+static DirectResult
+SendReceive( VoodooLink  *link,
+             VoodooChunk *sends,
+             size_t       num_send,
+             VoodooChunk *recvs,
+             size_t       num_recv )
+{
+     Link    *l = link->priv;
+     size_t   i;
+     ssize_t  ret;
+     int      select_result;
+
+     D_DEBUG_AT( Voodoo_Link, "%s( link %p, sends %p, num_send %zu, recvs %p, num_recv %zu )\n",
+                 __func__, link, sends, num_send, recvs, num_recv );
+
+     while (true) {
+          fd_set fds_read;
+          fd_set fds_write;
+          struct timeval tv;
+
+          FD_ZERO( &fds_read );
+          FD_ZERO( &fds_write );
+
+          if (num_recv)
+               FD_SET( l->fd[0], &fds_read );
+
+          if (num_send)
+               FD_SET( l->fd[1], &fds_write );
+
+          FD_SET( l->wakeup_fds[0], &fds_read );
+
+          tv.tv_sec  = 1;
+          tv.tv_usec = 0;
+
+          D_DEBUG_AT( Voodoo_Link, "  -> select( %s%s )...\n", num_recv ? "R" : " ", num_send ? "W" : " " );
+          select_result = select( MAX(MAX(l->wakeup_fds[0],l->fd[0]),l->fd[1])+1, &fds_read, &fds_write, NULL, &tv );
+          switch (select_result) {
+               default:
+                    if (FD_ISSET( l->fd[1], &fds_write )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => WRITE\n" );
+
+                         for (i=0; i<num_send; i++) {
+                              while (sends[i].done != sends[i].length) {
+                                   ret = send( l->fd[1], sends[i].ptr, sends[i].length, MSG_DONTWAIT );
+                                   if (ret < 0) {
+                                        //if (errno == EAGAIN) {
+                                        //     break;
+                                        //}
+                                        D_PERROR( "Voodoo/Link: Failed to send() data!\n" );
+                                        return DR_FAILURE;
+                                   }
+                                   else {
+                                        sends[i].done += ret;
+/*
+                                        if (sends[i].done != sends[i].length)
+                                             D_WARN( "partial send of %d/%d bytes", ret, sends[i].length );
+                                        else
+                                             D_WARN( "full send of %d bytes", ret, sends[i].length );
+*/
+//                                        return DR_OK;
+                                        break;
+                                   }
+                              }
+                         }
+                    }
+
+                    if (FD_ISSET( l->fd[0], &fds_read )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => READ\n" );
+
+                         for (i=0; i<num_recv; i++) {
+                              ret = recv( l->fd[0], recvs[i].ptr, recvs[i].length, MSG_DONTWAIT );
+                              if (ret < 0) {
+                                   if (errno == EAGAIN) {
+                                        break;
+                                   }
+                                   D_PERROR( "Voodoo/Link: Failed to recv() data!\n" );
+                                   return DR_FAILURE;
+                              }
+
+                              if (!ret)
+                                   return DR_IO;
+
+
+                              recvs[i].done = ret;
+
+                              if (recvs[i].done < recvs[i].length)
+                                   break;
+                         }
+                    }
+
+                    if (FD_ISSET( l->wakeup_fds[0], &fds_read )) {
+                         D_DEBUG_AT( Voodoo_Link, "  => WAKE UP\n" );
+
+                         static char buf[1000];
+                         read( l->wakeup_fds[0], buf, sizeof(buf) );
+                         if (!FD_ISSET( l->fd[0], &fds_read ) && !FD_ISSET( l->fd[0], &fds_write ))
+                              return DR_INTERRUPTED;
+                    }
+
+                    return DR_OK;
+
+               case 0:
+                    D_DEBUG_AT( Voodoo_Link, "  => TIMEOUT\n" );
+                    return DR_TIMEOUT;
+
+               case -1:
+                    D_ERROR( "Voodoo/Link: select() failed!\n" );
+                    return DR_FAILURE;
+          }
+     }
+
+     return DR_OK;
+}
+
+static DirectResult
+WakeUp( VoodooLink *link )
+{
+     Link *l = link->priv;
+     char  c = 0;
+
+     write( l->wakeup_fds[1], &c, 1 );
+
+     return DR_OK;
+}
+
+/**********************************************************************************************************************/
+
+DirectResult
+voodoo_link_init_connect( VoodooLink *link,
+                          const char *hostname,
+                          int         port,
+                          bool        raw )
+{
+     DirectResult     ret;
+     int              err;
+     struct addrinfo  hints;
+     struct addrinfo *addr;
+     char             portstr[10];
+     Link            *l;
+
+
+     memset( &hints, 0, sizeof(hints) );
+     hints.ai_flags    = AI_CANONNAME;
+     hints.ai_socktype = SOCK_STREAM;
+     hints.ai_family   = PF_UNSPEC;
+
+     D_INFO( "Voodoo/Link: Looking up host '%s'...\n", hostname );
+
+     snprintf( portstr, sizeof(portstr), "%d", port );
+
+     err = getaddrinfo( hostname, portstr, &hints, &addr );
+     if (err) {
+          switch (err) {
+               case EAI_FAMILY:
+                    D_ERROR( "Direct/Log: Unsupported address family!\n" );
+                    return DR_UNSUPPORTED;
+
+               case EAI_SOCKTYPE:
+                    D_ERROR( "Direct/Log: Unsupported socket type!\n" );
+                    return DR_UNSUPPORTED;
+
+               case EAI_NONAME:
+                    D_ERROR( "Direct/Log: Host not found!\n" );
+                    return DR_FAILURE;
+
+               case EAI_SERVICE:
+                    D_ERROR( "Direct/Log: Service is unreachable!\n" );
+                    return DR_FAILURE;
+
+#ifdef EAI_ADDRFAMILY
+               case EAI_ADDRFAMILY:
+#endif
+               case EAI_NODATA:
+                    D_ERROR( "Direct/Log: Host found, but has no address!\n" );
+                    return DR_FAILURE;
+
+               case EAI_MEMORY:
+                    return D_OOM();
+
+               case EAI_FAIL:
+                    D_ERROR( "Direct/Log: A non-recoverable name server error occurred!\n" );
+                    return DR_FAILURE;
+
+               case EAI_AGAIN:
+                    D_ERROR( "Direct/Log: Temporary error, try again!\n" );
+                    return DR_TEMPUNAVAIL;
+
+               default:
+                    D_ERROR( "Direct/Log: Unknown error occured!?\n" );
+                    return DR_FAILURE;
+          }
+     }
+
+
+     l = D_CALLOC( 1, sizeof(Link) );
+     if (!l)
+          return D_OOM();
+
+     /* Create the client socket. */
+     l->fd[0] = socket( addr->ai_family, SOCK_STREAM, 0 );
+     if (l->fd[0] < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket creation failed!\n" );
+          freeaddrinfo( addr );
+          D_FREE( l );
+          return ret;
+     }
+     l->fd[1] = l->fd[0];
+
+#if !VOODOO_BUILD_NO_SETSOCKOPT
+     if (setsockopt( l->fd[0], SOL_IP, IP_TOS, &tos, sizeof(tos) ) < 0)
+          D_PERROR( "Voodoo/Manager: Could not set IP_TOS!\n" );
+
+     if (setsockopt( l->fd[0], SOL_TCP, TCP_NODELAY, &one, sizeof(one) ) < 0)
+          D_PERROR( "Voodoo/Manager: Could not set TCP_NODELAY!\n" );
+#endif
+
+     D_INFO( "Voodoo/Link: Connecting to '%s:%d'...\n", addr->ai_canonname, port );
+
+     /* Connect to the server. */
+     err = connect( l->fd[0], addr->ai_addr, addr->ai_addrlen );
+     freeaddrinfo( addr );
+
+     if (err) {
+          ret = errno2result( errno );
+          D_PERROR( "Voodoo/Link: Socket connect failed!\n" );
+          close( l->fd[0] );
+          D_FREE( l );
+          return ret;
+     }
+
+     D_INFO( "Voodoo/Link: Connected.\n" );
+
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVLOWAT );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_SNDBUF );
+     DUMP_SOCKET_OPTION( l->fd[0], SO_RCVBUF );
+
+     if (!raw) {
+          link->code = 0x80008676;
+
+          if (write( l->fd[1], &link->code, sizeof(link->code) ) != 4) {
+               D_ERROR( "Voodoo/Link: Coult not write initial four bytes!\n" );
+               close( l->fd[0] );
+               D_FREE( l );
+               return DR_IO;
+          }
+     }
+     D_INFO( "Voodoo/Link: Sent link code (%s).\n", raw ? "raw" : "packet" );
+
+     pipe( l->wakeup_fds );
+
+
+     link->priv        = l;
+     link->Close       = Close;
+     link->Read        = Read;
+     link->Write       = Write;
+     link->SendReceive = SendReceive;
+     link->WakeUp      = WakeUp;
+
+     return DR_OK;
+}
+
+DirectResult
+voodoo_link_init_fd( VoodooLink *link,
+                     int         fd[2] )
+{
+     Link *l;
+
+     if (read( fd[0], &link->code, sizeof(link->code) ) != 4) {
+          D_ERROR( "Voodoo/Link: Coult not read initial four bytes!\n" );
+          return DR_IO;
+     }
+
+     l = D_CALLOC( 1, sizeof(Link) );
+     if (!l)
+          return D_OOM();
+
+     l->fd[0] = fd[0];
+     l->fd[1] = fd[1];
+
+     pipe( l->wakeup_fds );
+
+     link->priv        = l;
+     link->Close       = Close;
+     link->Read        = Read;
+     link->Write       = Write;
+     link->SendReceive = SendReceive;
+     link->WakeUp      = WakeUp;
+
+     return DR_OK;
+}
+
diff --git a/Source/DirectFB/lib/voodoo/voodoo.pc.in b/Source/DirectFB/lib/voodoo/voodoo.pc.in
new file mode 100755
index 0000000..8e29024
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/voodoo.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Voodoo
+Description: Interface based network transparency (like CORBA)
+Version: @VERSION@
+Requires: direct
+Libs: -L${libdir} -lvoodoo
+Cflags: -I@INCLUDEDIR@
diff --git a/Source/DirectFB/lib/voodoo/waitqueue.h b/Source/DirectFB/lib/voodoo/waitqueue.h
new file mode 100755
index 0000000..ab163ce
--- /dev/null
+++ b/Source/DirectFB/lib/voodoo/waitqueue.h
@@ -0,0 +1,117 @@
+/*
+   (c) Copyright 2001-2008  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECT__OS__LINUX__GLIBC__WAITQUEUE_H__
+#define __DIRECT__OS__LINUX__GLIBC__WAITQUEUE_H__
+
+#include <pthread.h>
+
+#include <direct/util.h>
+
+#include "mutex.h"
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     pthread_cond_t      cond;
+} DirectWaitQueue;
+
+/**********************************************************************************************************************/
+
+#define DIRECT_WAITQUEUE_INITIALIZER(name)            { PTHREAD_COND_INITIALIZER }
+
+/**********************************************************************************************************************/
+
+static inline DirectResult
+direct_waitqueue_init( DirectWaitQueue *queue )
+{
+     if (pthread_cond_init( &queue->cond, NULL ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_waitqueue_wait( DirectWaitQueue *queue, DirectMutex *mutex )
+{
+     if (pthread_cond_wait( &queue->cond, &mutex->lock ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_waitqueue_wait_timeout( DirectWaitQueue *queue, DirectMutex *mutex, unsigned long micros )
+{
+     struct timeval  now;
+     struct timespec timeout;
+     long int        nano_seconds = micros * 1000;
+
+     gettimeofday( &now, NULL );
+
+     timeout.tv_sec  = now.tv_sec;
+     timeout.tv_nsec = (now.tv_usec * 1000) + nano_seconds;
+
+     timeout.tv_sec  += timeout.tv_nsec / 1000000000;
+     timeout.tv_nsec %= 1000000000;
+
+     if (pthread_cond_timedwait( &queue->cond, &mutex->lock, &timeout ) == ETIMEDOUT)
+          return DR_TIMEOUT;
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_waitqueue_signal( DirectWaitQueue *queue )
+{
+     if (pthread_cond_signal( &queue->cond ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_waitqueue_broadcast( DirectWaitQueue *queue )
+{
+     if (pthread_cond_broadcast( &queue->cond ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+static inline DirectResult
+direct_waitqueue_deinit( DirectWaitQueue *queue )
+{
+     if (pthread_cond_destroy( &queue->cond ))
+          return errno2result( errno );
+
+     return DR_OK;
+}
+
+#endif
+
diff --git a/Source/DirectFB/ltmain.sh b/Source/DirectFB/ltmain.sh
new file mode 100755
index 0000000..e420fac
--- /dev/null
+++ b/Source/DirectFB/ltmain.sh
@@ -0,0 +1,6964 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008  Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION="1.5.26 Debian 1.5.26-1ubuntu1"
+TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+lt_env=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+	  save_$lt_var=\$$lt_var
+	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
+	  $lt_var=C
+	  export $lt_var
+	fi"
+done
+
+if test -n "$lt_env"; then
+  lt_env="env $lt_env"
+fi
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+	# Failing that, at least try and use $RANDOM to avoid a race
+	my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+	save_mktempdir_umask=`umask`
+	umask 0077
+	$mkdir "$my_tmpdir"
+	umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || {
+        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+	exit $EXIT_FAILURE
+      }
+    fi
+
+    $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	$SED -n -e '1,100{
+		/ I /{
+			s,.*,import,
+			p
+			q
+			}
+		}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      exit $EXIT_FAILURE
+    fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  extracted_serial=`expr $extracted_serial + 1`
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+	exit $exit_status
+      fi
+      case $host in
+      *-darwin*)
+	$show "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	if test -z "$run"; then
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+	  if test -n "$darwin_arches"; then 
+	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    ${rm}r unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd "$darwin_orig_dir"
+ 	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	fi # $run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+        ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2008  Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $?
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $?
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $?
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag)
+    prevopt="--tag"
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no) 
+  ;;
+shared)
+  build_libtool_libs=no
+  build_old_libs=yes
+  ;;
+static)
+  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+  ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
+
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, and some SunOS ksh mistreat backslash-escaping
+      # in scan sets (worked around with variable expansion),
+      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
+      # at all, so we specify them separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.[fF][09]?) xform=[fF][09]. ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    *.obj) xform=obj ;;
+    *.sx) xform=sx ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+    case $qlibobj in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qlibobj="\"$qlibobj\"" ;;
+    esac
+    test "X$libobj" != "X$qlibobj" \
+	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
+	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+      $echo "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+    case $qsrcfile in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      qsrcfile="\"$qsrcfile\"" ;;
+    esac
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	exit_status=$?
+	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $exit_status
+	fi
+      fi
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval $lt_env "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval $lt_env "$command"; then :
+      else
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    notinst_path= # paths that contain not-installed libtool libraries
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    single_module="${wl}-single_module"
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat $save_arg`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		# If there is no directory component, then add one.
+		case $arg in
+		*/* | *\\*) . $arg ;;
+		*) . ./$arg ;;
+		esac
+
+		if test -z "$pic_object" || \
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none && \
+		   test "$non_pic_object" = none; then
+		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+
+		# Extract subdirectory from the argument.
+		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		if test "X$xdir" = "X$arg"; then
+		  xdir=
+		else
+		  xdir="$xdir/"
+		fi
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if test -z "$run"; then
+		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+		  exit $EXIT_FAILURE
+		else
+		  # Dry-run case.
+
+		  # Extract subdirectory from the argument.
+		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		  if test "X$xdir" = "X$arg"; then
+		    xdir=
+		  else
+		    xdir="$xdir/"
+		  fi
+
+		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      fi
+	    done
+	  else
+	    $echo "$modename: link input file \`$save_arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	darwin_framework|darwin_framework_skip)
+	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  prev=
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit $EXIT_FAILURE
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework|-arch|-isysroot)
+	case " $CC " in
+	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
+		prev=darwin_framework_skip ;;
+	  *) compiler_flags="$compiler_flags $arg"
+	     prev=darwin_framework ;;
+	esac
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    absdir="$dir"
+	    notinst_path="$notinst_path $dir"
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs -framework System"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      -model)
+	compile_command="$compile_command $arg"
+	compiler_flags="$compiler_flags $arg"
+	finalize_command="$finalize_command $arg"
+	prev=xcompiler
+	continue
+	;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m* pass through architecture-specific compiler args for GCC
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  # If there is no directory component, then add one.
+	  case $arg in
+	  */* | *\\*) . $arg ;;
+	  *) . ./$arg ;;
+	  esac
+
+	  if test -z "$pic_object" || \
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none && \
+	     test "$non_pic_object" = none; then
+	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+ 	  else
+	    xdir="$xdir/"
+	  fi
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if test -z "$run"; then
+	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+	    exit $EXIT_FAILURE
+	  else
+	    # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+	exit $exit_status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link)
+	  libs="$deplibs %DEPLIBS%"
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+	  ;;
+	esac
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		  library_names=
+		  old_library=
+		  case $lib in
+		  */* | *\\*) . $lib ;;
+		  *) . ./$lib ;;
+		  esac
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+		    test "X$ladir" = "X$lib" && ladir="."
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+	        ;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    valid_a_lib=no
+	    case $deplibs_check_method in
+	      match_pattern*)
+		set dummy $deplibs_check_method
+	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+		if eval $echo \"$deplib\" 2>/dev/null \
+		    | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		  valid_a_lib=yes
+		fi
+		;;
+	      pass_all)
+		valid_a_lib=yes
+		;;
+            esac
+	    if test "$valid_a_lib" != yes; then
+	      $echo
+	      $echo "*** Warning: Trying to link with static lib archive $deplib."
+	      $echo "*** I have the capability to make that library automatically link in when"
+	      $echo "*** you link to this library.  But I can only do this if you have a"
+	      $echo "*** shared version of the library, which you do not appear to have"
+	      $echo "*** because the file extensions .$libext of this argument makes me believe"
+	      $echo "*** that it is just a static archive that I should not used here."
+	    else
+	      $echo
+	      $echo "*** Warning: Linking the shared library $output against the"
+	      $echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit $EXIT_FAILURE
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $absdir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes ; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on
+	  # some systems (darwin)
+	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	    $echo
+	    if test "$linkmode" = prog; then
+	      $echo "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $echo "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $echo "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$extract_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$old_archive_from_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a module then we can not link against
+		    # it, someone is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null |
+                      $EGREP ": [^:]* bundle" >/dev/null ; then
+		      $echo "** Warning, lib $linklib is a module, not a shared library"
+		      if test -z "$old_library" ; then
+		        $echo
+		        $echo "** And there doesn't seem to be a static archive available"
+		        $echo "** The link will probably fail, sorry"
+		      else
+		        add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit $EXIT_FAILURE
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	        add="$inst_prefix_dir$libdir/$linklib"
+	      else
+	        add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $echo
+	    $echo "*** Warning: This system can not link to static lib archive $lib."
+	    $echo "*** I have the capability to make that library automatically link in when"
+	    $echo "*** you link to this library.  But I can only do this if you have a"
+	    $echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $echo "*** But as you try to build a module library, libtool will still create "
+	      $echo "*** a static module, that should work as long as the dlopening application"
+	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$echo
+		$echo "*** However, this would only work if libtool was able to extract symbol"
+		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$echo "*** not find such a program.  So, this module is probably useless."
+		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit $EXIT_FAILURE
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="$absdir"
+		fi
+		depdepl=
+		case $host in
+		*-*-darwin*)
+		  # we do not want to link against static libs,
+		  # but need to link against shared
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$deplibdir/$depdepl" ; then
+		      depdepl="$deplibdir/$depdepl"
+	      	    elif test -f "$path/$depdepl" ; then
+		      depdepl="$path/$depdepl"
+		    else
+		      # Can't find it, oh well...
+		      depdepl=
+		    fi
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
+		  fi
+		  path=""
+		  ;;
+		*)
+		  path="-L$path"
+		  ;;
+		esac
+		;;
+	      -l*)
+		case $host in
+		*-*-darwin*)
+		  # Again, we only want to link against shared libraries
+		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		  for tmp in $newlib_search_path ; do
+		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		      eval depdepl="$tmp/lib$tmp_libs.dylib"
+		      break
+		    fi
+		  done
+		  path=""
+		  ;;
+		*) continue ;;
+		esac
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	      case " $deplibs " in
+	      *" $depdepl "*) ;;
+	      *) deplibs="$depdepl $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
+      esac
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit $EXIT_FAILURE
+	else
+	  $echo
+	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  $echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$2"
+	  number_minor="$3"
+	  number_revision="$4"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  *)
+	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$2"
+	  revision="$3"
+	  age="$4"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    major=`expr $current - $age`
+	  else
+	    major=`expr $current - $age + 1`
+	  fi
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+	         then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+	fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+	        fi
+		if test -n "$i" ; then
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $echo
+		    $echo "*** Warning: dynamic linker does not accept needed library $i."
+		    $echo "*** I have the capability to make that library automatically link in when"
+		    $echo "*** you link to this library.  But I can only do this if you have a"
+		    $echo "*** shared version of the library, which I believe you do not have"
+		    $echo "*** because a test_compile did reveal that the linker did not use it for"
+		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		$rm conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval \\$echo \"$libname_spec\"`
+		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		    set dummy $deplib_matches
+		    deplib_match=$2
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $echo
+		      $echo "*** Warning: dynamic linker does not accept needed library $i."
+		      $echo "*** I have the capability to make that library automatically link in when"
+		      $echo "*** you link to this library.  But I can only do this if you have a"
+		      $echo "*** shared version of the library, which you do not appear to have"
+		      $echo "*** because a test_compile did reveal that the linker did not use this one"
+		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $echo
+		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $echo "*** make it link in!  You will probably need to install it or some"
+		  $echo "*** library that it depends on before this library will be fully"
+		  $echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval $echo \"$potent_lib\" 2>/dev/null \
+		        | ${SED} 10q \
+		        | $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	    -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+	    done
+	  fi
+	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
+	    | grep . >/dev/null; then
+	    $echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $echo
+	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $echo "*** a static module, that should work as long as the dlopening"
+	    $echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $echo
+	      $echo "*** However, this would only work if libtool was able to extract symbol"
+	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $echo "*** not find such a program.  So, this module is probably useless."
+	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $echo "*** The inter-library dependencies that have been dropped here will be"
+	    $echo "*** automatically added whenever a program is linked with this library"
+	    $echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $echo
+	      $echo "*** Since this library must not contain undefined symbols,"
+	      $echo "*** because either the platform does not support them or"
+	      $echo "*** it was explicitly requested with -no-undefined,"
+	      $echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      case $archive_cmds in
+	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+	      esac
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	        $show "$cmd"
+	        $run eval "$cmd" || exit $?
+	        skipped_export=false
+	      else
+	        # The command line is too long to execute in one step.
+	        $show "using reloadable object file for export list..."
+	        skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+		case " $convenience " in
+		*" $test_deplib "*) ;;
+		*)
+			tmp_deplibs="$tmp_deplibs $test_deplib"
+			;;
+		esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+	
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval test_cmds=\"$archive_expsym_cmds\"
+	  cmds=$archive_expsym_cmds
+	else
+	  eval test_cmds=\"$archive_cmds\"
+	  cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise.
+	  $echo "creating reloadable object files..."
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  delfiles=
+	  last_robj=
+	  k=1
+	  output=$output_objdir/$output_la-${k}.$objext
+	  # Loop over the list of objects to be linked.
+	  for obj in $save_libobjs
+	  do
+	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	    if test "X$objlist" = X ||
+	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+		 test "$len" -le "$max_cmd_len"; }; then
+	      objlist="$objlist $obj"
+	    else
+	      # The command $test_cmds is almost too long, add a
+	      # command to the queue.
+	      if test "$k" -eq 1 ; then
+		# The first file doesn't have a previous command to add.
+		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+	      else
+		# All subsequent reloadable object files will link in
+		# the last one created.
+		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+	      fi
+	      last_robj=$output_objdir/$output_la-${k}.$objext
+	      k=`expr $k + 1`
+	      output=$output_objdir/$output_la-${k}.$objext
+	      objlist=$obj
+	      len=1
+	    fi
+	  done
+	  # Handle the remaining objects by creating one last
+	  # reloadable object file.  All subsequent reloadable object
+	  # files will link in the last one created.
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	  if ${skipped_export-false}; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    libobjs=$output
+	    # Append the command to create the export file.
+	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+	  # Set up a command to remove the reloadable object files
+	  # after they are used.
+	  i=0
+	  while test "$i" -lt "$k"
+	  do
+	    i=`expr $i + 1`
+	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+	  done
+
+	  $echo "creating a temporary reloadable object file: $output"
+
+	  # Loop through the commands generated above and execute them.
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $concat_cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    cmds=$archive_expsym_cmds
+	  else
+	    cmds=$archive_cmds
+	    fi
+	  fi
+
+	  # Append the command to remove the reloadable object files
+	  # to the just-reset $cmds.
+	  eval cmds=\"\$cmds~\$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      $show "${rm}r $gentop"
+	      $run ${rm}r "$gentop"
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
+      esac
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	cmds=$reload_cmds
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$outputname.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    else
+	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval '$echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+	    case $host in
+	    *cygwin* | *mingw* )
+	  $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs */
+struct {
+"
+	      ;;
+	    * )
+	  $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+	      ;;
+	    esac
+
+
+	  $echo >> "$output_objdir/$dlsyms" "\
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+          case $host in
+          *cygwin* | *mingw* )
+            if test -f "$output_objdir/${outputname}.def" ; then
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            else
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+             fi
+            ;;
+          * )
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            ;;
+          esac
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	exit_status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+            output_name=`basename $output`
+            output_path=`dirname $output`
+            cwrappersource="$output_path/$objdir/lt-$output_name.c"
+            cwrapper="$output_path/$output_name.exe"
+            $rm $cwrappersource $cwrapper
+            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+            cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+            cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+            case $host_os in
+              mingw*)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+              ;;
+              *)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+              ;;
+            esac
+
+            cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+        return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+        const char* q;
+        size_t p_len;
+        for (q = p; *q; q++)
+          if (IS_PATH_SEPARATOR(*q))
+            break;
+        p_len = q - p;
+        p_next = (*q == '\0' ? q : q + 1);
+        if (p_len == 0)
+        {
+          /* empty path: current directory */
+          if (getcwd (tmp, LT_PATHMAX) == NULL)
+            lt_fatal ("getcwd failed");
+          tmp_len = strlen(tmp);
+          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, tmp, tmp_len);
+          concat_name[tmp_len] = '/';
+          strcpy (concat_name + tmp_len + 1, wrapper);
+        }
+        else
+        {
+          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, p, p_len);
+          concat_name[p_len] = '/';
+          strcpy (concat_name + p_len + 1, wrapper);
+        }
+        if (check_executable(concat_name))
+          return concat_name;
+        XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+          # we should really use a build-platform specific compiler
+          # here, but OTOH, the wrappers (shell script and this C one)
+          # are only useful if you want to execute the "real" binary.
+          # Since the "real" binary is built for $host, then this
+          # wrapper might as well be built for $host, too.
+          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+          ;;
+        esac
+        $rm $output
+        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \$*\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $echo "copying selected object files to avoid basename conflicts..."
+
+	  if test -z "$gentop"; then
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "$mkdir $gentop"
+	    $run $mkdir "$gentop"
+	    exit_status=$?
+	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+	      exit $exit_status
+	    fi
+	  fi
+
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		counter=`expr $counter + 1`
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      $run ln "$obj" "$gentop/$newobj" ||
+	      $run cp "$obj" "$gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*"` &&
+	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  $echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+	        RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) 
+      	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
+	;;
+      -g | -m | -o) prev=$arg ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  if test "$inst_prefix_dir" = "$destdir"; then
+	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+	  else
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+	  fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  cmds=$postinstall_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || {
+	      lt_exit=$?
+
+	      # Restore the uninstalled library and exit
+	      if test "$mode" = relink; then
+		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	      fi
+
+	      exit $lt_exit
+	    }
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      file=`$echo $file|${SED} 's,.exe$,,'`
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir=`func_mktempdir`
+	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway 
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  cmds=$finish_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+		$lt_var=\$save_$lt_var; export $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      cmds=$postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      cmds=$old_postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" \
+	     && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" \
+	     && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    file=`$echo $file|${SED} 's,.exe$,,'`
+	    noexename=`$echo $name|${SED} 's,.exe$,,'`
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/Source/DirectFB/m4/as-ac-expand.m4 b/Source/DirectFB/m4/as-ac-expand.m4
new file mode 100755
index 0000000..d6c9e33
--- /dev/null
+++ b/Source/DirectFB/m4/as-ac-expand.m4
@@ -0,0 +1,43 @@
+dnl as-ac-expand.m4 0.2.0
+dnl autostars m4 macro for expanding directories using configure's prefix
+dnl thomas@apestaart.org
+
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
+dnl example
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
+
+AC_DEFUN([AS_AC_EXPAND],
+[
+  EXP_VAR=[$1]
+  FROM_VAR=[$2]
+
+  dnl first expand prefix and exec_prefix if necessary
+  prefix_save=$prefix
+  exec_prefix_save=$exec_prefix
+
+  dnl if no prefix given, then use /usr/local, the default prefix
+  if test "x$prefix" = "xNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  dnl if no exec_prefix given, then use prefix
+  if test "x$exec_prefix" = "xNONE"; then
+    exec_prefix=$prefix
+  fi
+
+  full_var="$FROM_VAR"
+  dnl loop until it doesn't change anymore
+  while true; do
+    new_full_var="`eval echo $full_var`"
+    if test "x$new_full_var" = "x$full_var"; then break; fi
+    full_var=$new_full_var
+  done
+
+  dnl clean up
+  full_var=$new_full_var
+  AC_SUBST([$1], "$full_var")
+
+  dnl restore prefix and exec_prefix
+  prefix=$prefix_save
+  exec_prefix=$exec_prefix_save
+])
diff --git a/Source/DirectFB/missing b/Source/DirectFB/missing
new file mode 100755
index 0000000..1c8ff70
--- /dev/null
+++ b/Source/DirectFB/missing
@@ -0,0 +1,367 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case $f in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f y.tab.h; then
+	echo >y.tab.h
+    fi
+    if test ! -f y.tab.c; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f lex.yy.c; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case $firstarg in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case $firstarg in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Source/DirectFB/patches/Makefile.am b/Source/DirectFB/patches/Makefile.am
new file mode 100755
index 0000000..d0ef09a
--- /dev/null
+++ b/Source/DirectFB/patches/Makefile.am
@@ -0,0 +1,16 @@
+## Makefile.am for DirectFB/patches
+
+EXTRA_DIST = \
+	README.davincifb				\
+	README.fusion					\
+	README.matroxfb-vsync-irq-patch			\
+	README.savagefb					\
+	davincifb-triple-osd0-2.6.10.patch.bz2		\
+	matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2	\
+	matroxfb-g400-clock-2.4.22.patch.bz2		\
+	matroxfb-vsync-irq-2.4.20.patch.bz2		\
+	matroxfb-vsync-irq-2.4.21-pre6.patch.bz2	\
+	savagefb-0.3.2-linux-2.4.26.patch.bz2		\
+	savagefb-0.4.0-linux-2.4.19.patch.bz2		\
+	savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2	\
+	vmwarefb-0.7.0-linux-2.4.22.patch.bz2
diff --git a/Source/DirectFB/patches/Makefile.in b/Source/DirectFB/patches/Makefile.in
new file mode 100755
index 0000000..8e227d9
--- /dev/null
+++ b/Source/DirectFB/patches/Makefile.in
@@ -0,0 +1,412 @@
+# 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@
+subdir = patches
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+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@
+EXTRA_DIST = \
+	README.davincifb				\
+	README.fusion					\
+	README.matroxfb-vsync-irq-patch			\
+	README.savagefb					\
+	davincifb-triple-osd0-2.6.10.patch.bz2		\
+	matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2	\
+	matroxfb-g400-clock-2.4.22.patch.bz2		\
+	matroxfb-vsync-irq-2.4.20.patch.bz2		\
+	matroxfb-vsync-irq-2.4.21-pre6.patch.bz2	\
+	savagefb-0.3.2-linux-2.4.26.patch.bz2		\
+	savagefb-0.4.0-linux-2.4.19.patch.bz2		\
+	savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2	\
+	vmwarefb-0.7.0-linux-2.4.22.patch.bz2
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  patches/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  patches/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# 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/patches/README.davincifb b/Source/DirectFB/patches/README.davincifb
new file mode 100755
index 0000000..b7a4de5
--- /dev/null
+++ b/Source/DirectFB/patches/README.davincifb
@@ -0,0 +1,2 @@
+This patch allows triple buffering on OSD0 using RGB16 format
+and adds support for choosing on+off sync flipping.
diff --git a/Source/DirectFB/patches/README.fusion b/Source/DirectFB/patches/README.fusion
new file mode 100755
index 0000000..5b7c507
--- /dev/null
+++ b/Source/DirectFB/patches/README.fusion
@@ -0,0 +1 @@
+Please download linux-fusion separately from the web site.
diff --git a/Source/DirectFB/patches/README.matroxfb-vsync-irq-patch b/Source/DirectFB/patches/README.matroxfb-vsync-irq-patch
new file mode 100755
index 0000000..eaa24fe
--- /dev/null
+++ b/Source/DirectFB/patches/README.matroxfb-vsync-irq-patch
@@ -0,0 +1,4 @@
+This patch adds the ioctl FBIO_WAITFORVSYNC.
+The calling process' state will be set to TASK_INTERRUPTIBLE,
+it will be waken up by the interrupt handler for the vertical retrace.
+Processes can now wait for the vertical retrace without CPU usage.
diff --git a/Source/DirectFB/patches/README.savagefb b/Source/DirectFB/patches/README.savagefb
new file mode 100755
index 0000000..06ea3c1
--- /dev/null
+++ b/Source/DirectFB/patches/README.savagefb
@@ -0,0 +1,13 @@
+The Savage frame buffer driver is highly experimental. Use at your own risk.
+
+There are two alternative patches:
+
+ savagefb-0.3.2-linux-2.4.19-pre7.patch  adds basic frame buffer support for
+                                         S3 Savage cards
+
+ savagefb-0.4.0-linux-2.4.19.patch       contains the features of the 0.3.2
+                                         version plus support for accelerated
+                                         fills and blits. Unfortunately it
+                                         doesn't seem to work for all cards.
+	                                 Use 'fbset -accel false' to turn off
+                                         acceleration.
diff --git a/Source/DirectFB/patches/davincifb-triple-osd0-2.6.10.patch.bz2 b/Source/DirectFB/patches/davincifb-triple-osd0-2.6.10.patch.bz2
new file mode 100755
index 0000000..5fe50fc
Binary files /dev/null and b/Source/DirectFB/patches/davincifb-triple-osd0-2.6.10.patch.bz2 differ
diff --git a/Source/DirectFB/patches/matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2 b/Source/DirectFB/patches/matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2
new file mode 100755
index 0000000..8a10dc2
Binary files /dev/null and b/Source/DirectFB/patches/matroxfb-full-memory-linux-2.4.21-rc2.patch.bz2 differ
diff --git a/Source/DirectFB/patches/matroxfb-g400-clock-2.4.22.patch.bz2 b/Source/DirectFB/patches/matroxfb-g400-clock-2.4.22.patch.bz2
new file mode 100755
index 0000000..c89604f
Binary files /dev/null and b/Source/DirectFB/patches/matroxfb-g400-clock-2.4.22.patch.bz2 differ
diff --git a/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.20.patch.bz2 b/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.20.patch.bz2
new file mode 100755
index 0000000..3e48cce
Binary files /dev/null and b/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.20.patch.bz2 differ
diff --git a/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.21-pre6.patch.bz2 b/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.21-pre6.patch.bz2
new file mode 100755
index 0000000..cc37602
Binary files /dev/null and b/Source/DirectFB/patches/matroxfb-vsync-irq-2.4.21-pre6.patch.bz2 differ
diff --git a/Source/DirectFB/patches/savagefb-0.3.2-linux-2.4.26.patch.bz2 b/Source/DirectFB/patches/savagefb-0.3.2-linux-2.4.26.patch.bz2
new file mode 100755
index 0000000..4860e07
Binary files /dev/null and b/Source/DirectFB/patches/savagefb-0.3.2-linux-2.4.26.patch.bz2 differ
diff --git a/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.19.patch.bz2 b/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.19.patch.bz2
new file mode 100755
index 0000000..08918a8
Binary files /dev/null and b/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.19.patch.bz2 differ
diff --git a/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2 b/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2
new file mode 100755
index 0000000..68dac68
Binary files /dev/null and b/Source/DirectFB/patches/savagefb-0.4.0-linux-2.4.21-rc2.patch.bz2 differ
diff --git a/Source/DirectFB/patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2 b/Source/DirectFB/patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2
new file mode 100755
index 0000000..a897a21
Binary files /dev/null and b/Source/DirectFB/patches/vmwarefb-0.7.0-linux-2.4.22.patch.bz2 differ
diff --git a/Source/DirectFB/proxy/Makefile.am b/Source/DirectFB/proxy/Makefile.am
new file mode 100755
index 0000000..01c978b
--- /dev/null
+++ b/Source/DirectFB/proxy/Makefile.am
@@ -0,0 +1,3 @@
+## Makefile.am for DirectFB/proxy
+
+SUBDIRS = dispatcher requestor
diff --git a/Source/DirectFB/proxy/Makefile.in b/Source/DirectFB/proxy/Makefile.in
new file mode 100755
index 0000000..039e0d7
--- /dev/null
+++ b/Source/DirectFB/proxy/Makefile.in
@@ -0,0 +1,556 @@
+# 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@
+subdir = proxy
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = dispatcher requestor
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  proxy/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  proxy/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/proxy/dispatcher/Makefile.am b/Source/DirectFB/proxy/dispatcher/Makefile.am
new file mode 100755
index 0000000..cd50dc8
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/Makefile.am
@@ -0,0 +1,124 @@
+## Makefile.am for DirectFB/proxy/dispatcher
+
+INTERFACES_DIR = $(MODULEDIR)/interfaces
+
+idirectfbdir              = $(INTERFACES_DIR)/IDirectFB
+idirectfbdatabufferdir    = $(INTERFACES_DIR)/IDirectFBDataBuffer
+idirectfbdisplaylayerdir  = $(INTERFACES_DIR)/IDirectFBDisplayLayer
+idirectfbeventbufferdir   = $(INTERFACES_DIR)/IDirectFBEventBuffer
+idirectfbfontdir          = $(INTERFACES_DIR)/IDirectFBFont
+idirectfbimageproviderdir = $(INTERFACES_DIR)/IDirectFBImageProvider
+idirectfbinputdevicedir   = $(INTERFACES_DIR)/IDirectFBInputDevice
+idirectfbpalettedir       = $(INTERFACES_DIR)/IDirectFBPalette
+idirectfbscreendir        = $(INTERFACES_DIR)/IDirectFBScreen
+idirectfbsurfacedir       = $(INTERFACES_DIR)/IDirectFBSurface
+idirectfbwindowdir        = $(INTERFACES_DIR)/IDirectFBWindow
+idirectfbvideoproviderdir = $(INTERFACES_DIR)/IDirectFBVideoProvider
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib			\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/src 		\
+	-I$(top_srcdir)/proxy/requestor	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+LIBS = \
+	$(top_builddir)/lib/voodoo/libvoodoo.la \
+	$(top_builddir)/lib/direct/libdirect.la
+
+
+idirectfb_LTLIBRARIES = \
+	libidirectfb_dispatcher.la
+
+idirectfbdatabuffer_LTLIBRARIES = \
+	libidirectfbdatabuffer_dispatcher.la
+
+idirectfbdisplaylayer_LTLIBRARIES = \
+	libidirectfbdisplaylayer_dispatcher.la
+
+idirectfbeventbuffer_LTLIBRARIES = \
+	libidirectfbeventbuffer_dispatcher.la
+
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_dispatcher.la
+
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_dispatcher.la
+
+idirectfbinputdevice_LTLIBRARIES = \
+	libidirectfbinputdevice_dispatcher.la
+
+idirectfbpalette_LTLIBRARIES = \
+	libidirectfbpalette_dispatcher.la
+
+idirectfbscreen_LTLIBRARIES = \
+	libidirectfbscreen_dispatcher.la
+
+idirectfbsurface_LTLIBRARIES = \
+	libidirectfbsurface_dispatcher.la
+
+idirectfbwindow_LTLIBRARIES = \
+	libidirectfbwindow_dispatcher.la
+
+if BUILD_STATIC
+idirectfb_DATA              = libidirectfb_dispatcher.o
+idirectfbdatabuffer_DATA    = libidirectfbdatabuffer_dispatcher.o
+idirectfbdisplaylayer_DATA  = libidirectfbdisplaylayer_dispatcher.o
+idirectfbeventbuffer_DATA   = libidirectfbeventbuffer_dispatcher.o
+idirectfbfont_DATA          = libidirectfbfont_dispatcher.o
+idirectfbimageprovider_DATA = libidirectfbimageprovider_dispatcher.o
+idirectfbinputdevice_DATA   = libidirectfbinputdevice_dispatcher.o
+idirectfbpalette_DATA       = libidirectfbpalette_dispatcher.o
+idirectfbscreen_DATA        = libidirectfbscreen_dispatcher.o
+idirectfbsurface_DATA       = libidirectfbsurface_dispatcher.o
+idirectfbwindow_DATA        = libidirectfbwindow_dispatcher.o
+endif
+
+libidirectfb_dispatcher_la_SOURCES = idirectfb_dispatcher.c idirectfb_dispatcher.h
+libidirectfb_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfb_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbdatabuffer_dispatcher_la_SOURCES = idirectfbdatabuffer_dispatcher.c idirectfbdatabuffer_dispatcher.h
+libidirectfbdatabuffer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbdatabuffer_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbdisplaylayer_dispatcher_la_SOURCES = idirectfbdisplaylayer_dispatcher.c idirectfbdisplaylayer_dispatcher.h
+libidirectfbdisplaylayer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbdisplaylayer_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbeventbuffer_dispatcher_la_SOURCES = idirectfbeventbuffer_dispatcher.c idirectfbeventbuffer_dispatcher.h
+libidirectfbeventbuffer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbeventbuffer_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbfont_dispatcher_la_SOURCES = idirectfbfont_dispatcher.c idirectfbfont_dispatcher.h
+libidirectfbfont_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbimageprovider_dispatcher_la_SOURCES = idirectfbimageprovider_dispatcher.c idirectfbimageprovider_dispatcher.h
+libidirectfbimageprovider_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbinputdevice_dispatcher_la_SOURCES = idirectfbinputdevice_dispatcher.c idirectfbinputdevice_dispatcher.h
+libidirectfbinputdevice_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbinputdevice_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbpalette_dispatcher_la_SOURCES = idirectfbpalette_dispatcher.c idirectfbpalette_dispatcher.h
+libidirectfbpalette_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbpalette_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbscreen_dispatcher_la_SOURCES = idirectfbscreen_dispatcher.c idirectfbscreen_dispatcher.h
+libidirectfbscreen_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbscreen_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbsurface_dispatcher_la_SOURCES = idirectfbsurface_dispatcher.c idirectfbsurface_dispatcher.h
+libidirectfbsurface_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbsurface_dispatcher_la_LIBADDD = $(LIBS)
+
+libidirectfbwindow_dispatcher_la_SOURCES = idirectfbwindow_dispatcher.c idirectfbwindow_dispatcher.h
+libidirectfbwindow_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbwindow_dispatcher_la_LIBADDD = $(LIBS)
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/proxy/dispatcher/Makefile.in b/Source/DirectFB/proxy/dispatcher/Makefile.in
new file mode 100755
index 0000000..f06094e
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/Makefile.in
@@ -0,0 +1,1402 @@
+# 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 = proxy/dispatcher
+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)$(idirectfbdir)" \
+	"$(DESTDIR)$(idirectfbdatabufferdir)" \
+	"$(DESTDIR)$(idirectfbdisplaylayerdir)" \
+	"$(DESTDIR)$(idirectfbeventbufferdir)" \
+	"$(DESTDIR)$(idirectfbfontdir)" \
+	"$(DESTDIR)$(idirectfbimageproviderdir)" \
+	"$(DESTDIR)$(idirectfbinputdevicedir)" \
+	"$(DESTDIR)$(idirectfbpalettedir)" \
+	"$(DESTDIR)$(idirectfbscreendir)" \
+	"$(DESTDIR)$(idirectfbsurfacedir)" \
+	"$(DESTDIR)$(idirectfbwindowdir)" "$(DESTDIR)$(idirectfbdir)" \
+	"$(DESTDIR)$(idirectfbdatabufferdir)" \
+	"$(DESTDIR)$(idirectfbdisplaylayerdir)" \
+	"$(DESTDIR)$(idirectfbeventbufferdir)" \
+	"$(DESTDIR)$(idirectfbfontdir)" \
+	"$(DESTDIR)$(idirectfbimageproviderdir)" \
+	"$(DESTDIR)$(idirectfbinputdevicedir)" \
+	"$(DESTDIR)$(idirectfbpalettedir)" \
+	"$(DESTDIR)$(idirectfbscreendir)" \
+	"$(DESTDIR)$(idirectfbsurfacedir)" \
+	"$(DESTDIR)$(idirectfbwindowdir)"
+idirectfbLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbdatabufferLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbdisplaylayerLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbeventbufferLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbfontLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbimageproviderLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbinputdeviceLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbpaletteLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbscreenLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbsurfaceLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbwindowLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(idirectfb_LTLIBRARIES) \
+	$(idirectfbdatabuffer_LTLIBRARIES) \
+	$(idirectfbdisplaylayer_LTLIBRARIES) \
+	$(idirectfbeventbuffer_LTLIBRARIES) \
+	$(idirectfbfont_LTLIBRARIES) \
+	$(idirectfbimageprovider_LTLIBRARIES) \
+	$(idirectfbinputdevice_LTLIBRARIES) \
+	$(idirectfbpalette_LTLIBRARIES) $(idirectfbscreen_LTLIBRARIES) \
+	$(idirectfbsurface_LTLIBRARIES) $(idirectfbwindow_LTLIBRARIES)
+libidirectfb_dispatcher_la_LIBADD =
+am_libidirectfb_dispatcher_la_OBJECTS = idirectfb_dispatcher.lo
+libidirectfb_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfb_dispatcher_la_OBJECTS)
+libidirectfb_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libidirectfb_dispatcher_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+libidirectfbdatabuffer_dispatcher_la_LIBADD =
+am_libidirectfbdatabuffer_dispatcher_la_OBJECTS =  \
+	idirectfbdatabuffer_dispatcher.lo
+libidirectfbdatabuffer_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbdatabuffer_dispatcher_la_OBJECTS)
+libidirectfbdatabuffer_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbdatabuffer_dispatcher_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbdisplaylayer_dispatcher_la_LIBADD =
+am_libidirectfbdisplaylayer_dispatcher_la_OBJECTS =  \
+	idirectfbdisplaylayer_dispatcher.lo
+libidirectfbdisplaylayer_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbdisplaylayer_dispatcher_la_OBJECTS)
+libidirectfbdisplaylayer_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbdisplaylayer_dispatcher_la_LDFLAGS) $(LDFLAGS) \
+	-o $@
+libidirectfbeventbuffer_dispatcher_la_LIBADD =
+am_libidirectfbeventbuffer_dispatcher_la_OBJECTS =  \
+	idirectfbeventbuffer_dispatcher.lo
+libidirectfbeventbuffer_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbeventbuffer_dispatcher_la_OBJECTS)
+libidirectfbeventbuffer_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbeventbuffer_dispatcher_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbfont_dispatcher_la_LIBADD =
+am_libidirectfbfont_dispatcher_la_OBJECTS =  \
+	idirectfbfont_dispatcher.lo
+libidirectfbfont_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbfont_dispatcher_la_OBJECTS)
+libidirectfbfont_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbfont_dispatcher_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbimageprovider_dispatcher_la_LIBADD =
+am_libidirectfbimageprovider_dispatcher_la_OBJECTS =  \
+	idirectfbimageprovider_dispatcher.lo
+libidirectfbimageprovider_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_dispatcher_la_OBJECTS)
+libidirectfbimageprovider_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_dispatcher_la_LDFLAGS) $(LDFLAGS) \
+	-o $@
+libidirectfbinputdevice_dispatcher_la_LIBADD =
+am_libidirectfbinputdevice_dispatcher_la_OBJECTS =  \
+	idirectfbinputdevice_dispatcher.lo
+libidirectfbinputdevice_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbinputdevice_dispatcher_la_OBJECTS)
+libidirectfbinputdevice_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbinputdevice_dispatcher_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbpalette_dispatcher_la_LIBADD =
+am_libidirectfbpalette_dispatcher_la_OBJECTS =  \
+	idirectfbpalette_dispatcher.lo
+libidirectfbpalette_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbpalette_dispatcher_la_OBJECTS)
+libidirectfbpalette_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbpalette_dispatcher_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbscreen_dispatcher_la_LIBADD =
+am_libidirectfbscreen_dispatcher_la_OBJECTS =  \
+	idirectfbscreen_dispatcher.lo
+libidirectfbscreen_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbscreen_dispatcher_la_OBJECTS)
+libidirectfbscreen_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbscreen_dispatcher_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbsurface_dispatcher_la_LIBADD =
+am_libidirectfbsurface_dispatcher_la_OBJECTS =  \
+	idirectfbsurface_dispatcher.lo
+libidirectfbsurface_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbsurface_dispatcher_la_OBJECTS)
+libidirectfbsurface_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbsurface_dispatcher_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbwindow_dispatcher_la_LIBADD =
+am_libidirectfbwindow_dispatcher_la_OBJECTS =  \
+	idirectfbwindow_dispatcher.lo
+libidirectfbwindow_dispatcher_la_OBJECTS =  \
+	$(am_libidirectfbwindow_dispatcher_la_OBJECTS)
+libidirectfbwindow_dispatcher_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbwindow_dispatcher_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 = $(libidirectfb_dispatcher_la_SOURCES) \
+	$(libidirectfbdatabuffer_dispatcher_la_SOURCES) \
+	$(libidirectfbdisplaylayer_dispatcher_la_SOURCES) \
+	$(libidirectfbeventbuffer_dispatcher_la_SOURCES) \
+	$(libidirectfbfont_dispatcher_la_SOURCES) \
+	$(libidirectfbimageprovider_dispatcher_la_SOURCES) \
+	$(libidirectfbinputdevice_dispatcher_la_SOURCES) \
+	$(libidirectfbpalette_dispatcher_la_SOURCES) \
+	$(libidirectfbscreen_dispatcher_la_SOURCES) \
+	$(libidirectfbsurface_dispatcher_la_SOURCES) \
+	$(libidirectfbwindow_dispatcher_la_SOURCES)
+DIST_SOURCES = $(libidirectfb_dispatcher_la_SOURCES) \
+	$(libidirectfbdatabuffer_dispatcher_la_SOURCES) \
+	$(libidirectfbdisplaylayer_dispatcher_la_SOURCES) \
+	$(libidirectfbeventbuffer_dispatcher_la_SOURCES) \
+	$(libidirectfbfont_dispatcher_la_SOURCES) \
+	$(libidirectfbimageprovider_dispatcher_la_SOURCES) \
+	$(libidirectfbinputdevice_dispatcher_la_SOURCES) \
+	$(libidirectfbpalette_dispatcher_la_SOURCES) \
+	$(libidirectfbscreen_dispatcher_la_SOURCES) \
+	$(libidirectfbsurface_dispatcher_la_SOURCES) \
+	$(libidirectfbwindow_dispatcher_la_SOURCES)
+idirectfbDATA_INSTALL = $(INSTALL_DATA)
+idirectfbdatabufferDATA_INSTALL = $(INSTALL_DATA)
+idirectfbdisplaylayerDATA_INSTALL = $(INSTALL_DATA)
+idirectfbeventbufferDATA_INSTALL = $(INSTALL_DATA)
+idirectfbfontDATA_INSTALL = $(INSTALL_DATA)
+idirectfbimageproviderDATA_INSTALL = $(INSTALL_DATA)
+idirectfbinputdeviceDATA_INSTALL = $(INSTALL_DATA)
+idirectfbpaletteDATA_INSTALL = $(INSTALL_DATA)
+idirectfbscreenDATA_INSTALL = $(INSTALL_DATA)
+idirectfbsurfaceDATA_INSTALL = $(INSTALL_DATA)
+idirectfbwindowDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idirectfb_DATA) $(idirectfbdatabuffer_DATA) \
+	$(idirectfbdisplaylayer_DATA) $(idirectfbeventbuffer_DATA) \
+	$(idirectfbfont_DATA) $(idirectfbimageprovider_DATA) \
+	$(idirectfbinputdevice_DATA) $(idirectfbpalette_DATA) \
+	$(idirectfbscreen_DATA) $(idirectfbsurface_DATA) \
+	$(idirectfbwindow_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 = \
+	$(top_builddir)/lib/voodoo/libvoodoo.la \
+	$(top_builddir)/lib/direct/libdirect.la
+
+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@
+INTERFACES_DIR = $(MODULEDIR)/interfaces
+idirectfbdir = $(INTERFACES_DIR)/IDirectFB
+idirectfbdatabufferdir = $(INTERFACES_DIR)/IDirectFBDataBuffer
+idirectfbdisplaylayerdir = $(INTERFACES_DIR)/IDirectFBDisplayLayer
+idirectfbeventbufferdir = $(INTERFACES_DIR)/IDirectFBEventBuffer
+idirectfbfontdir = $(INTERFACES_DIR)/IDirectFBFont
+idirectfbimageproviderdir = $(INTERFACES_DIR)/IDirectFBImageProvider
+idirectfbinputdevicedir = $(INTERFACES_DIR)/IDirectFBInputDevice
+idirectfbpalettedir = $(INTERFACES_DIR)/IDirectFBPalette
+idirectfbscreendir = $(INTERFACES_DIR)/IDirectFBScreen
+idirectfbsurfacedir = $(INTERFACES_DIR)/IDirectFBSurface
+idirectfbwindowdir = $(INTERFACES_DIR)/IDirectFBWindow
+idirectfbvideoproviderdir = $(INTERFACES_DIR)/IDirectFBVideoProvider
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib			\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/src 		\
+	-I$(top_srcdir)/proxy/requestor	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+idirectfb_LTLIBRARIES = \
+	libidirectfb_dispatcher.la
+
+idirectfbdatabuffer_LTLIBRARIES = \
+	libidirectfbdatabuffer_dispatcher.la
+
+idirectfbdisplaylayer_LTLIBRARIES = \
+	libidirectfbdisplaylayer_dispatcher.la
+
+idirectfbeventbuffer_LTLIBRARIES = \
+	libidirectfbeventbuffer_dispatcher.la
+
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_dispatcher.la
+
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_dispatcher.la
+
+idirectfbinputdevice_LTLIBRARIES = \
+	libidirectfbinputdevice_dispatcher.la
+
+idirectfbpalette_LTLIBRARIES = \
+	libidirectfbpalette_dispatcher.la
+
+idirectfbscreen_LTLIBRARIES = \
+	libidirectfbscreen_dispatcher.la
+
+idirectfbsurface_LTLIBRARIES = \
+	libidirectfbsurface_dispatcher.la
+
+idirectfbwindow_LTLIBRARIES = \
+	libidirectfbwindow_dispatcher.la
+
+@BUILD_STATIC_TRUE@idirectfb_DATA = libidirectfb_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbdatabuffer_DATA = libidirectfbdatabuffer_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbdisplaylayer_DATA = libidirectfbdisplaylayer_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbeventbuffer_DATA = libidirectfbeventbuffer_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbfont_DATA = libidirectfbfont_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbimageprovider_DATA = libidirectfbimageprovider_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbinputdevice_DATA = libidirectfbinputdevice_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbpalette_DATA = libidirectfbpalette_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbscreen_DATA = libidirectfbscreen_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbsurface_DATA = libidirectfbsurface_dispatcher.o
+@BUILD_STATIC_TRUE@idirectfbwindow_DATA = libidirectfbwindow_dispatcher.o
+libidirectfb_dispatcher_la_SOURCES = idirectfb_dispatcher.c idirectfb_dispatcher.h
+libidirectfb_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfb_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbdatabuffer_dispatcher_la_SOURCES = idirectfbdatabuffer_dispatcher.c idirectfbdatabuffer_dispatcher.h
+libidirectfbdatabuffer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbdatabuffer_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbdisplaylayer_dispatcher_la_SOURCES = idirectfbdisplaylayer_dispatcher.c idirectfbdisplaylayer_dispatcher.h
+libidirectfbdisplaylayer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbdisplaylayer_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbeventbuffer_dispatcher_la_SOURCES = idirectfbeventbuffer_dispatcher.c idirectfbeventbuffer_dispatcher.h
+libidirectfbeventbuffer_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbeventbuffer_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbfont_dispatcher_la_SOURCES = idirectfbfont_dispatcher.c idirectfbfont_dispatcher.h
+libidirectfbfont_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbimageprovider_dispatcher_la_SOURCES = idirectfbimageprovider_dispatcher.c idirectfbimageprovider_dispatcher.h
+libidirectfbimageprovider_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbinputdevice_dispatcher_la_SOURCES = idirectfbinputdevice_dispatcher.c idirectfbinputdevice_dispatcher.h
+libidirectfbinputdevice_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbinputdevice_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbpalette_dispatcher_la_SOURCES = idirectfbpalette_dispatcher.c idirectfbpalette_dispatcher.h
+libidirectfbpalette_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbpalette_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbscreen_dispatcher_la_SOURCES = idirectfbscreen_dispatcher.c idirectfbscreen_dispatcher.h
+libidirectfbscreen_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbscreen_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbsurface_dispatcher_la_SOURCES = idirectfbsurface_dispatcher.c idirectfbsurface_dispatcher.h
+libidirectfbsurface_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbsurface_dispatcher_la_LIBADDD = $(LIBS)
+libidirectfbwindow_dispatcher_la_SOURCES = idirectfbwindow_dispatcher.c idirectfbwindow_dispatcher.h
+libidirectfbwindow_dispatcher_la_LDFLAGS = -avoid-version -module
+libidirectfbwindow_dispatcher_la_LIBADDD = $(LIBS)
+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  proxy/dispatcher/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  proxy/dispatcher/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-idirectfbLTLIBRARIES: $(idirectfb_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdir)"
+	@list='$(idirectfb_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfb_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdir)/$$p"; \
+	done
+
+clean-idirectfbLTLIBRARIES:
+	-test -z "$(idirectfb_LTLIBRARIES)" || rm -f $(idirectfb_LTLIBRARIES)
+	@list='$(idirectfb_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
+install-idirectfbdatabufferLTLIBRARIES: $(idirectfbdatabuffer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdatabufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdatabufferdir)"
+	@list='$(idirectfbdatabuffer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdatabufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdatabufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbdatabufferLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdatabuffer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdatabufferdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdatabufferdir)/$$p"; \
+	done
+
+clean-idirectfbdatabufferLTLIBRARIES:
+	-test -z "$(idirectfbdatabuffer_LTLIBRARIES)" || rm -f $(idirectfbdatabuffer_LTLIBRARIES)
+	@list='$(idirectfbdatabuffer_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
+install-idirectfbdisplaylayerLTLIBRARIES: $(idirectfbdisplaylayer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdisplaylayerdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdisplaylayerdir)"
+	@list='$(idirectfbdisplaylayer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdisplaylayerLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdisplaylayerLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbdisplaylayerLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdisplaylayer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$p"; \
+	done
+
+clean-idirectfbdisplaylayerLTLIBRARIES:
+	-test -z "$(idirectfbdisplaylayer_LTLIBRARIES)" || rm -f $(idirectfbdisplaylayer_LTLIBRARIES)
+	@list='$(idirectfbdisplaylayer_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
+install-idirectfbeventbufferLTLIBRARIES: $(idirectfbeventbuffer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbeventbufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbeventbufferdir)"
+	@list='$(idirectfbeventbuffer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbeventbufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbeventbufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbeventbufferLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbeventbuffer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbeventbufferdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbeventbufferdir)/$$p"; \
+	done
+
+clean-idirectfbeventbufferLTLIBRARIES:
+	-test -z "$(idirectfbeventbuffer_LTLIBRARIES)" || rm -f $(idirectfbeventbuffer_LTLIBRARIES)
+	@list='$(idirectfbeventbuffer_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
+install-idirectfbfontLTLIBRARIES: $(idirectfbfont_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbfontLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbfontdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbfontdir)/$$p"; \
+	done
+
+clean-idirectfbfontLTLIBRARIES:
+	-test -z "$(idirectfbfont_LTLIBRARIES)" || rm -f $(idirectfbfont_LTLIBRARIES)
+	@list='$(idirectfbfont_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
+install-idirectfbimageproviderLTLIBRARIES: $(idirectfbimageprovider_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbimageproviderLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$p"; \
+	done
+
+clean-idirectfbimageproviderLTLIBRARIES:
+	-test -z "$(idirectfbimageprovider_LTLIBRARIES)" || rm -f $(idirectfbimageprovider_LTLIBRARIES)
+	@list='$(idirectfbimageprovider_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
+install-idirectfbinputdeviceLTLIBRARIES: $(idirectfbinputdevice_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbinputdevicedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbinputdevicedir)"
+	@list='$(idirectfbinputdevice_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbinputdeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbinputdeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbinputdeviceLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbinputdevice_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbinputdevicedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbinputdevicedir)/$$p"; \
+	done
+
+clean-idirectfbinputdeviceLTLIBRARIES:
+	-test -z "$(idirectfbinputdevice_LTLIBRARIES)" || rm -f $(idirectfbinputdevice_LTLIBRARIES)
+	@list='$(idirectfbinputdevice_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
+install-idirectfbpaletteLTLIBRARIES: $(idirectfbpalette_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbpalettedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbpalettedir)"
+	@list='$(idirectfbpalette_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbpaletteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbpaletteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbpaletteLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbpalette_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbpalettedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbpalettedir)/$$p"; \
+	done
+
+clean-idirectfbpaletteLTLIBRARIES:
+	-test -z "$(idirectfbpalette_LTLIBRARIES)" || rm -f $(idirectfbpalette_LTLIBRARIES)
+	@list='$(idirectfbpalette_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
+install-idirectfbscreenLTLIBRARIES: $(idirectfbscreen_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbscreendir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbscreendir)"
+	@list='$(idirectfbscreen_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbscreenLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbscreenLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbscreenLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbscreen_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbscreendir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbscreendir)/$$p"; \
+	done
+
+clean-idirectfbscreenLTLIBRARIES:
+	-test -z "$(idirectfbscreen_LTLIBRARIES)" || rm -f $(idirectfbscreen_LTLIBRARIES)
+	@list='$(idirectfbscreen_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
+install-idirectfbsurfaceLTLIBRARIES: $(idirectfbsurface_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbsurfacedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbsurfacedir)"
+	@list='$(idirectfbsurface_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbsurfaceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbsurfaceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbsurfaceLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbsurface_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbsurfacedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbsurfacedir)/$$p"; \
+	done
+
+clean-idirectfbsurfaceLTLIBRARIES:
+	-test -z "$(idirectfbsurface_LTLIBRARIES)" || rm -f $(idirectfbsurface_LTLIBRARIES)
+	@list='$(idirectfbsurface_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
+install-idirectfbwindowLTLIBRARIES: $(idirectfbwindow_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbwindowdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbwindowdir)"
+	@list='$(idirectfbwindow_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbwindowLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbwindowLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbwindowdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbwindowLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbwindow_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbwindowdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbwindowdir)/$$p"; \
+	done
+
+clean-idirectfbwindowLTLIBRARIES:
+	-test -z "$(idirectfbwindow_LTLIBRARIES)" || rm -f $(idirectfbwindow_LTLIBRARIES)
+	@list='$(idirectfbwindow_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
+libidirectfb_dispatcher.la: $(libidirectfb_dispatcher_la_OBJECTS) $(libidirectfb_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfb_dispatcher_la_LINK) -rpath $(idirectfbdir) $(libidirectfb_dispatcher_la_OBJECTS) $(libidirectfb_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbdatabuffer_dispatcher.la: $(libidirectfbdatabuffer_dispatcher_la_OBJECTS) $(libidirectfbdatabuffer_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbdatabuffer_dispatcher_la_LINK) -rpath $(idirectfbdatabufferdir) $(libidirectfbdatabuffer_dispatcher_la_OBJECTS) $(libidirectfbdatabuffer_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbdisplaylayer_dispatcher.la: $(libidirectfbdisplaylayer_dispatcher_la_OBJECTS) $(libidirectfbdisplaylayer_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbdisplaylayer_dispatcher_la_LINK) -rpath $(idirectfbdisplaylayerdir) $(libidirectfbdisplaylayer_dispatcher_la_OBJECTS) $(libidirectfbdisplaylayer_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbeventbuffer_dispatcher.la: $(libidirectfbeventbuffer_dispatcher_la_OBJECTS) $(libidirectfbeventbuffer_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbeventbuffer_dispatcher_la_LINK) -rpath $(idirectfbeventbufferdir) $(libidirectfbeventbuffer_dispatcher_la_OBJECTS) $(libidirectfbeventbuffer_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbfont_dispatcher.la: $(libidirectfbfont_dispatcher_la_OBJECTS) $(libidirectfbfont_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbfont_dispatcher_la_LINK) -rpath $(idirectfbfontdir) $(libidirectfbfont_dispatcher_la_OBJECTS) $(libidirectfbfont_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbimageprovider_dispatcher.la: $(libidirectfbimageprovider_dispatcher_la_OBJECTS) $(libidirectfbimageprovider_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_dispatcher_la_LINK) -rpath $(idirectfbimageproviderdir) $(libidirectfbimageprovider_dispatcher_la_OBJECTS) $(libidirectfbimageprovider_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbinputdevice_dispatcher.la: $(libidirectfbinputdevice_dispatcher_la_OBJECTS) $(libidirectfbinputdevice_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbinputdevice_dispatcher_la_LINK) -rpath $(idirectfbinputdevicedir) $(libidirectfbinputdevice_dispatcher_la_OBJECTS) $(libidirectfbinputdevice_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbpalette_dispatcher.la: $(libidirectfbpalette_dispatcher_la_OBJECTS) $(libidirectfbpalette_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbpalette_dispatcher_la_LINK) -rpath $(idirectfbpalettedir) $(libidirectfbpalette_dispatcher_la_OBJECTS) $(libidirectfbpalette_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbscreen_dispatcher.la: $(libidirectfbscreen_dispatcher_la_OBJECTS) $(libidirectfbscreen_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbscreen_dispatcher_la_LINK) -rpath $(idirectfbscreendir) $(libidirectfbscreen_dispatcher_la_OBJECTS) $(libidirectfbscreen_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbsurface_dispatcher.la: $(libidirectfbsurface_dispatcher_la_OBJECTS) $(libidirectfbsurface_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbsurface_dispatcher_la_LINK) -rpath $(idirectfbsurfacedir) $(libidirectfbsurface_dispatcher_la_OBJECTS) $(libidirectfbsurface_dispatcher_la_LIBADD) $(LIBS)
+libidirectfbwindow_dispatcher.la: $(libidirectfbwindow_dispatcher_la_OBJECTS) $(libidirectfbwindow_dispatcher_la_DEPENDENCIES) 
+	$(libidirectfbwindow_dispatcher_la_LINK) -rpath $(idirectfbwindowdir) $(libidirectfbwindow_dispatcher_la_OBJECTS) $(libidirectfbwindow_dispatcher_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfb_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdisplaylayer_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbeventbuffer_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbinputdevice_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbpalette_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbscreen_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbsurface_dispatcher.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbwindow_dispatcher.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-idirectfbDATA: $(idirectfb_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdir)"
+	@list='$(idirectfb_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	  $(idirectfbDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	done
+
+uninstall-idirectfbDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfb_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	done
+install-idirectfbdatabufferDATA: $(idirectfbdatabuffer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdatabufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdatabufferdir)"
+	@list='$(idirectfbdatabuffer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbdatabufferDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	  $(idirectfbdatabufferDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	done
+
+uninstall-idirectfbdatabufferDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdatabuffer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	done
+install-idirectfbdisplaylayerDATA: $(idirectfbdisplaylayer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdisplaylayerdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdisplaylayerdir)"
+	@list='$(idirectfbdisplaylayer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbdisplaylayerDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	  $(idirectfbdisplaylayerDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	done
+
+uninstall-idirectfbdisplaylayerDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdisplaylayer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	done
+install-idirectfbeventbufferDATA: $(idirectfbeventbuffer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbeventbufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbeventbufferdir)"
+	@list='$(idirectfbeventbuffer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbeventbufferDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	  $(idirectfbeventbufferDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	done
+
+uninstall-idirectfbeventbufferDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbeventbuffer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	done
+install-idirectfbfontDATA: $(idirectfbfont_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbfontDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  $(idirectfbfontDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	done
+
+uninstall-idirectfbfontDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	done
+install-idirectfbimageproviderDATA: $(idirectfbimageprovider_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbimageproviderDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  $(idirectfbimageproviderDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	done
+
+uninstall-idirectfbimageproviderDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	done
+install-idirectfbinputdeviceDATA: $(idirectfbinputdevice_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbinputdevicedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbinputdevicedir)"
+	@list='$(idirectfbinputdevice_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbinputdeviceDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	  $(idirectfbinputdeviceDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	done
+
+uninstall-idirectfbinputdeviceDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbinputdevice_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	done
+install-idirectfbpaletteDATA: $(idirectfbpalette_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbpalettedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbpalettedir)"
+	@list='$(idirectfbpalette_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbpaletteDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	  $(idirectfbpaletteDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	done
+
+uninstall-idirectfbpaletteDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbpalette_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	done
+install-idirectfbscreenDATA: $(idirectfbscreen_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbscreendir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbscreendir)"
+	@list='$(idirectfbscreen_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbscreenDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	  $(idirectfbscreenDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	done
+
+uninstall-idirectfbscreenDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbscreen_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	done
+install-idirectfbsurfaceDATA: $(idirectfbsurface_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbsurfacedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbsurfacedir)"
+	@list='$(idirectfbsurface_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbsurfaceDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	  $(idirectfbsurfaceDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	done
+
+uninstall-idirectfbsurfaceDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbsurface_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	done
+install-idirectfbwindowDATA: $(idirectfbwindow_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbwindowdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbwindowdir)"
+	@list='$(idirectfbwindow_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbwindowDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	  $(idirectfbwindowDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbwindowdir)/$$f"; \
+	done
+
+uninstall-idirectfbwindowDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbwindow_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbwindowdir)/$$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)$(idirectfbdir)" "$(DESTDIR)$(idirectfbdatabufferdir)" "$(DESTDIR)$(idirectfbdisplaylayerdir)" "$(DESTDIR)$(idirectfbeventbufferdir)" "$(DESTDIR)$(idirectfbfontdir)" "$(DESTDIR)$(idirectfbimageproviderdir)" "$(DESTDIR)$(idirectfbinputdevicedir)" "$(DESTDIR)$(idirectfbpalettedir)" "$(DESTDIR)$(idirectfbscreendir)" "$(DESTDIR)$(idirectfbsurfacedir)" "$(DESTDIR)$(idirectfbwindowdir)" "$(DESTDIR)$(idirectfbdir)" "$(DESTDIR)$(idirectfbdatabufferdir)" "$(DESTDIR)$(idirectfbdisplaylayerdir)" "$(DESTDIR)$(idirectfbeventbufferdir)" "$(DESTDIR)$(idirectfbfontdir)" "$(DESTDIR)$(idirectfbimageproviderdir)" "$(DESTDIR)$(idirectfbinputdevicedir)" "$(DESTDIR)$(idirectfbpalettedir)" "$(DESTDIR)$(idirectfbscreendir)" "$(DESTDIR)$(idirectfbsurfacedir)" "$(DESTDIR)$(idirectfbwindowdir)"; 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-idirectfbLTLIBRARIES \
+	clean-idirectfbdatabufferLTLIBRARIES \
+	clean-idirectfbdisplaylayerLTLIBRARIES \
+	clean-idirectfbeventbufferLTLIBRARIES \
+	clean-idirectfbfontLTLIBRARIES \
+	clean-idirectfbimageproviderLTLIBRARIES \
+	clean-idirectfbinputdeviceLTLIBRARIES \
+	clean-idirectfbpaletteLTLIBRARIES \
+	clean-idirectfbscreenLTLIBRARIES \
+	clean-idirectfbsurfaceLTLIBRARIES \
+	clean-idirectfbwindowLTLIBRARIES 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-idirectfbDATA install-idirectfbLTLIBRARIES \
+	install-idirectfbdatabufferDATA \
+	install-idirectfbdatabufferLTLIBRARIES \
+	install-idirectfbdisplaylayerDATA \
+	install-idirectfbdisplaylayerLTLIBRARIES \
+	install-idirectfbeventbufferDATA \
+	install-idirectfbeventbufferLTLIBRARIES \
+	install-idirectfbfontDATA install-idirectfbfontLTLIBRARIES \
+	install-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES \
+	install-idirectfbinputdeviceDATA \
+	install-idirectfbinputdeviceLTLIBRARIES \
+	install-idirectfbpaletteDATA \
+	install-idirectfbpaletteLTLIBRARIES \
+	install-idirectfbscreenDATA install-idirectfbscreenLTLIBRARIES \
+	install-idirectfbsurfaceDATA \
+	install-idirectfbsurfaceLTLIBRARIES \
+	install-idirectfbwindowDATA install-idirectfbwindowLTLIBRARIES
+
+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-idirectfbDATA uninstall-idirectfbLTLIBRARIES \
+	uninstall-idirectfbdatabufferDATA \
+	uninstall-idirectfbdatabufferLTLIBRARIES \
+	uninstall-idirectfbdisplaylayerDATA \
+	uninstall-idirectfbdisplaylayerLTLIBRARIES \
+	uninstall-idirectfbeventbufferDATA \
+	uninstall-idirectfbeventbufferLTLIBRARIES \
+	uninstall-idirectfbfontDATA uninstall-idirectfbfontLTLIBRARIES \
+	uninstall-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES \
+	uninstall-idirectfbinputdeviceDATA \
+	uninstall-idirectfbinputdeviceLTLIBRARIES \
+	uninstall-idirectfbpaletteDATA \
+	uninstall-idirectfbpaletteLTLIBRARIES \
+	uninstall-idirectfbscreenDATA \
+	uninstall-idirectfbscreenLTLIBRARIES \
+	uninstall-idirectfbsurfaceDATA \
+	uninstall-idirectfbsurfaceLTLIBRARIES \
+	uninstall-idirectfbwindowDATA \
+	uninstall-idirectfbwindowLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-idirectfbLTLIBRARIES \
+	clean-idirectfbdatabufferLTLIBRARIES \
+	clean-idirectfbdisplaylayerLTLIBRARIES \
+	clean-idirectfbeventbufferLTLIBRARIES \
+	clean-idirectfbfontLTLIBRARIES \
+	clean-idirectfbimageproviderLTLIBRARIES \
+	clean-idirectfbinputdeviceLTLIBRARIES \
+	clean-idirectfbpaletteLTLIBRARIES \
+	clean-idirectfbscreenLTLIBRARIES \
+	clean-idirectfbsurfaceLTLIBRARIES \
+	clean-idirectfbwindowLTLIBRARIES 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-idirectfbDATA \
+	install-idirectfbLTLIBRARIES install-idirectfbdatabufferDATA \
+	install-idirectfbdatabufferLTLIBRARIES \
+	install-idirectfbdisplaylayerDATA \
+	install-idirectfbdisplaylayerLTLIBRARIES \
+	install-idirectfbeventbufferDATA \
+	install-idirectfbeventbufferLTLIBRARIES \
+	install-idirectfbfontDATA install-idirectfbfontLTLIBRARIES \
+	install-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES \
+	install-idirectfbinputdeviceDATA \
+	install-idirectfbinputdeviceLTLIBRARIES \
+	install-idirectfbpaletteDATA \
+	install-idirectfbpaletteLTLIBRARIES \
+	install-idirectfbscreenDATA install-idirectfbscreenLTLIBRARIES \
+	install-idirectfbsurfaceDATA \
+	install-idirectfbsurfaceLTLIBRARIES \
+	install-idirectfbwindowDATA install-idirectfbwindowLTLIBRARIES \
+	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-idirectfbDATA \
+	uninstall-idirectfbLTLIBRARIES \
+	uninstall-idirectfbdatabufferDATA \
+	uninstall-idirectfbdatabufferLTLIBRARIES \
+	uninstall-idirectfbdisplaylayerDATA \
+	uninstall-idirectfbdisplaylayerLTLIBRARIES \
+	uninstall-idirectfbeventbufferDATA \
+	uninstall-idirectfbeventbufferLTLIBRARIES \
+	uninstall-idirectfbfontDATA uninstall-idirectfbfontLTLIBRARIES \
+	uninstall-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES \
+	uninstall-idirectfbinputdeviceDATA \
+	uninstall-idirectfbinputdeviceLTLIBRARIES \
+	uninstall-idirectfbpaletteDATA \
+	uninstall-idirectfbpaletteLTLIBRARIES \
+	uninstall-idirectfbscreenDATA \
+	uninstall-idirectfbscreenLTLIBRARIES \
+	uninstall-idirectfbsurfaceDATA \
+	uninstall-idirectfbsurfaceLTLIBRARIES \
+	uninstall-idirectfbwindowDATA \
+	uninstall-idirectfbwindowLTLIBRARIES
+
+%.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/proxy/dispatcher/idirectfb_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.c
new file mode 100755
index 0000000..e42fb72
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.c
@@ -0,0 +1,1305 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <idirectfb.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include "idirectfb_dispatcher.h"
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFB        *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFB, Dispatcher )
+
+
+/**************************************************************************************************/
+
+typedef struct {
+     DirectLink            link;
+
+     VoodooInstanceID      instance;
+     IDirectFBDataBuffer  *requestor;
+} DataBufferEntry;
+
+/*
+ * private data struct of IDirectFB_Dispatcher
+ */
+typedef struct {
+     int                    ref;          /* reference counter */
+
+     IDirectFB             *real;
+
+     CoreDFB               *core;
+
+     VoodooInstanceID       self;         /* The instance of this dispatcher itself. */
+
+     DirectLink            *data_buffers; /* list of known data buffers */
+} IDirectFB_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFB_Dispatcher_Destruct( IDirectFB *thiz )
+{
+     DirectLink                *l, *n;
+     IDirectFB_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     direct_list_foreach_safe (l, n, data->data_buffers) {
+          DataBufferEntry *entry = (DataBufferEntry*) l;
+
+          entry->requestor->Release( entry->requestor );
+
+          D_FREE( entry );
+     }
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFB_Dispatcher_AddRef( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFB_Dispatcher_Release( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFB_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_SetCooperativeLevel( IDirectFB           *thiz,
+                                          DFBCooperativeLevel  level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetDeviceDescription( IDirectFB                    *thiz,
+                                           DFBGraphicsDeviceDescription *ret_desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!ret_desc)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_EnumVideoModes( IDirectFB            *thiz,
+                                     DFBVideoModeCallback  callbackfunc,
+                                     void                 *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_SetVideoMode( IDirectFB    *thiz,
+                                   int           width,
+                                   int           height,
+                                   int           bpp )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateSurface( IDirectFB                    *thiz,
+                                    const DFBSurfaceDescription  *desc,
+                                    IDirectFBSurface            **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!desc || !interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreatePalette( IDirectFB                    *thiz,
+                                    const DFBPaletteDescription  *desc,
+                                    IDirectFBPalette            **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_EnumScreens( IDirectFB         *thiz,
+                                  DFBScreenCallback  callbackfunc,
+                                  void              *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetScreen( IDirectFB        *thiz,
+                                DFBScreenID       id,
+                                IDirectFBScreen **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_EnumDisplayLayers( IDirectFB               *thiz,
+                                        DFBDisplayLayerCallback  callbackfunc,
+                                        void                    *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetDisplayLayer( IDirectFB              *thiz,
+                                      DFBDisplayLayerID       id,
+                                      IDirectFBDisplayLayer **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_EnumInputDevices( IDirectFB              *thiz,
+                                       DFBInputDeviceCallback  callbackfunc,
+                                       void                   *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetInputDevice( IDirectFB             *thiz,
+                                     DFBInputDeviceID       id,
+                                     IDirectFBInputDevice **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateEventBuffer( IDirectFB             *thiz,
+                                        IDirectFBEventBuffer **interface_ptr)
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateInputEventBuffer( IDirectFB                   *thiz,
+                                             DFBInputDeviceCapabilities   caps,
+                                             DFBBoolean                   global,
+                                             IDirectFBEventBuffer       **interface_ptr)
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateImageProvider( IDirectFB               *thiz,
+                                          const char              *filename,
+                                          IDirectFBImageProvider **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     /* Check arguments */
+     if (!filename || !interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateVideoProvider( IDirectFB               *thiz,
+                                          const char              *filename,
+                                          IDirectFBVideoProvider **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     /* Check arguments */
+     if (!interface_ptr || !filename)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateFont( IDirectFB                 *thiz,
+                                 const char                *filename,
+                                 const DFBFontDescription  *desc,
+                                 IDirectFBFont            **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     /* Check arguments */
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_CreateDataBuffer( IDirectFB                       *thiz,
+                                       const DFBDataBufferDescription  *desc,
+                                       IDirectFBDataBuffer            **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_SetClipboardData( IDirectFB      *thiz,
+                                       const char     *mime_type,
+                                       const void     *data,
+                                       unsigned int    size,
+                                       struct timeval *timestamp )
+{
+     if (!mime_type || !data || !size)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetClipboardData( IDirectFB     *thiz,
+                                       char         **mime_type,
+                                       void         **clip_data,
+                                       unsigned int  *size )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!mime_type && !clip_data && !size)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetClipboardTimeStamp( IDirectFB      *thiz,
+                                            struct timeval *timestamp )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     if (!timestamp)
+          return DFB_INVARG;
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_Suspend( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_Resume( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_WaitIdle( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_WaitForSync( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Dispatcher_GetInterface( IDirectFB   *thiz,
+                                   const char  *type,
+                                   const char  *implementation,
+                                   void        *arg,
+                                   void       **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFB *thiz, IDirectFB *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_SetCooperativeLevel( IDirectFB *thiz, IDirectFB *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     DFBCooperativeLevel level;
+     VoodooMessageParser parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, level );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetCooperativeLevel( real, level );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetDeviceDescription( IDirectFB *thiz, IDirectFB *real,
+                               VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                 ret;
+     DFBGraphicsDeviceDescription desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     ret = real->GetDeviceDescription( real, &desc );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBGraphicsDeviceDescription), &desc,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetVideoMode( IDirectFB *thiz, IDirectFB *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     int                 width;
+     int                 height;
+     int                 bpp;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, width );
+     VOODOO_PARSER_GET_INT( parser, height );
+     VOODOO_PARSER_GET_INT( parser, bpp );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetVideoMode( real, width, height, bpp );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+#define MAX_MODES 128
+
+typedef struct {
+     int                                      num;
+     IDirectFB_Dispatcher_EnumVideoModes_Item items[MAX_MODES];
+} EnumVideoModes_Context;
+
+static DFBEnumerationResult
+EnumVideoModes_Callback( int   width,
+                         int   height,
+                         int   bpp,
+                         void *callbackdata )
+{
+     int                     index;
+     EnumVideoModes_Context *context = callbackdata;
+
+     if (context->num == MAX_MODES) {
+          D_WARN( "maximum number of %d modes reached", MAX_MODES );
+          return DFENUM_CANCEL;
+     }
+
+     index = context->num++;
+
+     context->items[index].width  = width;
+     context->items[index].height = height;
+     context->items[index].bpp    = bpp;
+
+     return DFENUM_OK;
+}
+
+static DirectResult
+Dispatch_EnumVideoModes( IDirectFB *thiz, IDirectFB *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult           ret;
+     EnumVideoModes_Context context = { 0 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     ret = real->EnumVideoModes( real, EnumVideoModes_Callback, &context );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, context.num,
+                                    VMBT_DATA, context.num * sizeof(IDirectFB_Dispatcher_EnumVideoModes_Item), context.items,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateEventBuffer( IDirectFB *thiz, IDirectFB *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     IDirectFBEventBuffer *buffer;
+     VoodooInstanceID      instance;
+     VoodooMessageParser   parser;
+     void                 *requestor;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->CreateEventBuffer( real, &buffer );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_requestor( manager, "IDirectFBEventBuffer",
+                                       instance, buffer, &requestor );
+
+     buffer->Release( buffer );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_CreateInputEventBuffer( IDirectFB *thiz, IDirectFB *real,
+                                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                ret;
+     IDirectFBEventBuffer       *buffer;
+     VoodooInstanceID            instance;
+     DFBInputDeviceCapabilities  caps;
+     DFBBoolean                  global;
+     VoodooMessageParser         parser;
+     void                       *requestor;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_INT( parser, caps );
+     VOODOO_PARSER_GET_INT( parser, global );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->CreateInputEventBuffer( real, caps, global, &buffer );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_requestor( manager, "IDirectFBEventBuffer",
+                                       instance, buffer, &requestor );
+
+     buffer->Release( buffer );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_CreateImageProvider( IDirectFB *thiz, IDirectFB *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult            ret;
+     DirectLink             *l;
+     VoodooMessageParser     parser;
+     VoodooInstanceID        instance;
+     IDirectFBImageProvider *provider;
+     IDirectFBDataBuffer    *buffer = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     if (1) {
+          ret = voodoo_manager_check_allocation( manager, 0x100000 /*FIXME*/ );
+          if (ret) {
+               D_ERROR( "Allocation not permitted!\n" );
+               return ret;
+          }
+     }
+
+     direct_list_foreach (l, data->data_buffers) {
+          DataBufferEntry *entry = (DataBufferEntry*) l;
+
+          if (entry->instance == instance) {
+               buffer = entry->requestor;
+               break;
+          }
+     }
+
+     ret = buffer->CreateImageProvider( buffer, &provider );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBImageProvider",
+                                        provider, data->self, NULL, &instance, NULL );
+     if (ret) {
+          provider->Release( provider );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateSurface( IDirectFB *thiz, IDirectFB *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult           ret;
+     DFBSurfaceDescription  desc;
+     IDirectFBSurface      *surface;
+     VoodooInstanceID       instance;
+     VoodooMessageParser    parser;
+     bool                   force_system = (voodoo_config->resource_id != 0);
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_READ_DFBSurfaceDescription( parser, desc );
+     VOODOO_PARSER_END( parser );
+
+     if (1) {
+          unsigned int w = 256, h = 256, b = 2, size;
+
+          if (desc.flags & DSDESC_WIDTH)
+               w = desc.width;
+
+          if (desc.flags & DSDESC_HEIGHT)
+               h = desc.height;
+
+          if (desc.flags & DSDESC_PIXELFORMAT)
+               b = DFB_BYTES_PER_PIXEL( desc.pixelformat ) ? DFB_BYTES_PER_PIXEL( desc.pixelformat ) : 2;
+
+          size = w * h * b;
+
+          D_INFO( "Checking creation of %u kB surface\n", size / 1024 );
+
+          if (voodoo_config->surface_max && voodoo_config->surface_max < size) {
+               D_ERROR( "Allocation of %u kB surface not permitted (limit %u kB)\n",
+                        size / 1024, voodoo_config->surface_max / 1024 );
+               return DR_LIMITEXCEEDED;
+          }
+
+          ret = voodoo_manager_check_allocation( manager, size );
+          if (ret) {
+               D_ERROR( "Allocation not permitted!\n" );
+               return ret;
+          }
+     }
+
+     if (voodoo_config->resource_id) {
+          if (desc.flags & DSDESC_RESOURCE_ID) {
+               if (desc.resource_id == voodoo_config->resource_id) {
+                    force_system = false;
+               }
+          }
+     }
+
+     if (force_system) {
+          DFBSurfaceDescription sd = desc;
+
+          if (sd.flags & DSDESC_CAPS) {
+               sd.caps &= ~DSCAPS_VIDEOONLY;
+               sd.caps |=  DSCAPS_SYSTEMONLY;
+          }
+          else {
+               sd.flags |= DSDESC_CAPS;
+               sd.caps   = DSCAPS_SYSTEMONLY;
+          }
+
+          ret = real->CreateSurface( real, &sd, &surface );
+     }
+     else if (desc.flags & (DSDESC_PALETTE | DSDESC_PREALLOCATED)) {
+          DFBSurfaceDescription sd = desc;
+          sd.flags &= ~(DSDESC_PALETTE | DSDESC_PREALLOCATED);
+
+          ret = real->CreateSurface( real, &sd, &surface );
+     }
+     else {
+          ret = real->CreateSurface( real, &desc, &surface );
+     }
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBSurface",
+                                        surface, data->self, NULL, &instance, NULL );
+     if (ret) {
+          surface->Release( surface );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+typedef struct {
+     int                                   num;
+     IDirectFB_Dispatcher_EnumScreens_Item items[MAX_SCREENS];
+} EnumScreens_Context;
+
+static DFBEnumerationResult
+EnumScreens_Callback( DFBScreenID           screen_id,
+                      DFBScreenDescription  desc,
+                      void                 *callbackdata )
+{
+     int                  index;
+     EnumScreens_Context *context = callbackdata;
+
+     if (context->num == MAX_SCREENS) {
+          D_WARN( "maximum number of %d screens reached", MAX_SCREENS );
+          return DFENUM_CANCEL;
+     }
+
+     index = context->num++;
+
+     context->items[index].screen_id = screen_id;
+     context->items[index].desc      = desc;
+
+     return DFENUM_OK;
+}
+
+static DirectResult
+Dispatch_EnumScreens( IDirectFB *thiz, IDirectFB *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     EnumScreens_Context context = { 0 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     ret = real->EnumScreens( real, EnumScreens_Callback, &context );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, context.num,
+                                    VMBT_DATA, context.num * sizeof(IDirectFB_Dispatcher_EnumScreens_Item), context.items,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetDisplayLayer( IDirectFB *thiz, IDirectFB *real,
+                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult             ret;
+     DFBDisplayLayerID        id;
+     IDirectFBDisplayLayer   *layer;
+     VoodooInstanceID         instance;
+     VoodooMessageParser      parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     if (voodoo_config->layer_mask && !(voodoo_config->layer_mask & (1 << id))) {
+          D_ERROR( "Layer with id %u not allowed!\n", id );
+          return DR_ACCESSDENIED;
+     }
+
+     ret = real->GetDisplayLayer( real, id, &layer );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBDisplayLayer",
+                                        layer, data->self, NULL, &instance, NULL );
+     if (ret) {
+          layer->Release( layer );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+#define MAX_INPUT_DEVICES 64
+
+typedef struct {
+     int                                        num;
+     IDirectFB_Dispatcher_EnumInputDevices_Item items[MAX_INPUT_DEVICES];
+} EnumInputDevices_Context;
+
+static DFBEnumerationResult
+EnumInputDevices_Callback( DFBInputDeviceID           device_id,
+                           DFBInputDeviceDescription  desc,
+                           void                      *callbackdata )
+{
+     int                       index;
+     EnumInputDevices_Context *context = callbackdata;
+
+     if (context->num == MAX_INPUT_DEVICES) {
+          D_WARN( "maximum number of %d input devices reached", MAX_INPUT_DEVICES );
+          return DFENUM_CANCEL;
+     }
+
+     index = context->num++;
+
+     context->items[index].device_id = device_id;
+     context->items[index].desc      = desc;
+
+     return DFENUM_OK;
+}
+
+static DirectResult
+Dispatch_EnumInputDevices( IDirectFB *thiz, IDirectFB *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult             ret;
+     EnumInputDevices_Context context = { 0 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     ret = real->EnumInputDevices( real, EnumInputDevices_Callback, &context );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, context.num,
+                                    VMBT_DATA, context.num * sizeof(IDirectFB_Dispatcher_EnumInputDevices_Item), context.items,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetInputDevice( IDirectFB *thiz, IDirectFB *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     DFBScreenID           device_id;
+     IDirectFBInputDevice *device;
+     VoodooInstanceID      instance;
+     VoodooMessageParser   parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, device_id );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetInputDevice( real, device_id, &device );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBInputDevice",
+                                        device, data->self, NULL, &instance, NULL );
+     if (ret) {
+          device->Release( device );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetScreen( IDirectFB *thiz, IDirectFB *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     DFBScreenID          screen_id;
+     IDirectFBScreen     *screen;
+     VoodooInstanceID     instance;
+     VoodooMessageParser  parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, screen_id );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetScreen( real, screen_id, &screen );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBScreen",
+                                        screen, data->self, NULL, &instance, NULL );
+     if (ret) {
+          screen->Release( screen );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateFont( IDirectFB *thiz, IDirectFB *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult            ret;
+     DirectLink             *l;
+     VoodooMessageParser     parser;
+     VoodooInstanceID        instance;
+     IDirectFBFont          *font;
+     IDirectFBDataBuffer    *buffer = NULL;
+     const DFBFontDescription *desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_DATA( parser, desc );
+     VOODOO_PARSER_END( parser );
+
+     direct_list_foreach (l, data->data_buffers) {
+          DataBufferEntry *entry = (DataBufferEntry*) l;
+
+          if (entry->instance == instance) {
+               buffer = entry->requestor;
+               break;
+          }
+     }
+
+     if (1) {
+          unsigned int size;
+
+          buffer->GetLength( buffer, &size );
+
+          ret = voodoo_manager_check_allocation( manager, size );
+          if (ret) {
+               D_ERROR( "Allocation not permitted!\n" );
+               return ret;
+          }
+     }
+
+     ret = buffer->CreateFont( buffer, desc, &font );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBFont",
+                                        font, data->self, NULL, &instance, NULL );
+     if (ret) {
+          font->Release( font );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateDataBuffer( IDirectFB *thiz, IDirectFB *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     IDirectFBDataBuffer *requestor;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     DataBufferEntry     *entry;
+     void                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_construct_requestor( manager, "IDirectFBDataBuffer",
+                                       instance, data->real, &ptr );
+     if (ret)
+          return ret;
+
+     requestor = ptr;
+
+     entry = D_CALLOC( 1, sizeof(DataBufferEntry) );
+     if (!entry) {
+          D_WARN( "out of memory" );
+          requestor->Release( requestor );
+          return DFB_NOSYSTEMMEMORY;
+     }
+
+     entry->instance  = instance;
+     entry->requestor = requestor;
+
+     entry->requestor->AddRef( entry->requestor );
+
+     direct_list_prepend( &data->data_buffers, &entry->link );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_WaitIdle( IDirectFB *thiz, IDirectFB *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     ret = real->WaitIdle( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetInterface( IDirectFB *thiz, IDirectFB *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const char          *type;
+     IAny                *interface_ptr;
+     VoodooInstanceID     instance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_STRING( parser, type );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetInterface( real, type, NULL, NULL, (void**) &interface_ptr );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, type, interface_ptr, data->self, NULL, &instance, NULL );
+     if (ret) {
+          interface_ptr->Release( interface_ptr );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFB/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFB_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_SetCooperativeLevel:
+               return Dispatch_SetCooperativeLevel( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_GetDeviceDescription:
+               return Dispatch_GetDeviceDescription( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_SetVideoMode:
+               return Dispatch_SetVideoMode( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_EnumVideoModes:
+               return Dispatch_EnumVideoModes( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateSurface:
+               return Dispatch_CreateSurface( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_EnumScreens:
+               return Dispatch_EnumScreens( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_GetScreen:
+               return Dispatch_GetScreen( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_GetDisplayLayer:
+               return Dispatch_GetDisplayLayer( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_EnumInputDevices:
+               return Dispatch_EnumInputDevices( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_GetInputDevice:
+               return Dispatch_GetInputDevice( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateEventBuffer:
+               return Dispatch_CreateEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateInputEventBuffer:
+               return Dispatch_CreateInputEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateImageProvider:
+               return Dispatch_CreateImageProvider( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateFont:
+               return Dispatch_CreateFont( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_CreateDataBuffer:
+               return Dispatch_CreateDataBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_WaitIdle:
+               return Dispatch_WaitIdle( dispatcher, real, manager, msg );
+
+          case IDIRECTFB_METHOD_ID_GetInterface:
+               return Dispatch_GetInterface( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DFBResult
+Construct( IDirectFB *thiz, VoodooManager *manager, VoodooInstanceID *ret_instance )
+{
+     DFBResult         ret;
+     IDirectFB        *real;
+     VoodooInstanceID  instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFB_Dispatcher)
+
+     ret = DirectFBCreate( &real );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, thiz, real, Dispatch, &instance );
+     if (ret) {
+          real->Release( real );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     data->ref  = 1;
+     data->real = real;
+     data->core = ((IDirectFB_data*)(real->priv))->core;
+     data->self = instance;
+
+     thiz->AddRef                  = IDirectFB_Dispatcher_AddRef;
+     thiz->Release                 = IDirectFB_Dispatcher_Release;
+     thiz->SetCooperativeLevel     = IDirectFB_Dispatcher_SetCooperativeLevel;
+     thiz->GetDeviceDescription    = IDirectFB_Dispatcher_GetDeviceDescription;
+     thiz->EnumVideoModes          = IDirectFB_Dispatcher_EnumVideoModes;
+     thiz->SetVideoMode            = IDirectFB_Dispatcher_SetVideoMode;
+     thiz->CreateSurface           = IDirectFB_Dispatcher_CreateSurface;
+     thiz->CreatePalette           = IDirectFB_Dispatcher_CreatePalette;
+     thiz->EnumScreens             = IDirectFB_Dispatcher_EnumScreens;
+     thiz->GetScreen               = IDirectFB_Dispatcher_GetScreen;
+     thiz->EnumDisplayLayers       = IDirectFB_Dispatcher_EnumDisplayLayers;
+     thiz->GetDisplayLayer         = IDirectFB_Dispatcher_GetDisplayLayer;
+     thiz->EnumInputDevices        = IDirectFB_Dispatcher_EnumInputDevices;
+     thiz->GetInputDevice          = IDirectFB_Dispatcher_GetInputDevice;
+     thiz->CreateEventBuffer       = IDirectFB_Dispatcher_CreateEventBuffer;
+     thiz->CreateInputEventBuffer  = IDirectFB_Dispatcher_CreateInputEventBuffer;
+     thiz->CreateImageProvider     = IDirectFB_Dispatcher_CreateImageProvider;
+     thiz->CreateVideoProvider     = IDirectFB_Dispatcher_CreateVideoProvider;
+     thiz->CreateFont              = IDirectFB_Dispatcher_CreateFont;
+     thiz->CreateDataBuffer        = IDirectFB_Dispatcher_CreateDataBuffer;
+     thiz->SetClipboardData        = IDirectFB_Dispatcher_SetClipboardData;
+     thiz->GetClipboardData        = IDirectFB_Dispatcher_GetClipboardData;
+     thiz->GetClipboardTimeStamp   = IDirectFB_Dispatcher_GetClipboardTimeStamp;
+     thiz->Suspend                 = IDirectFB_Dispatcher_Suspend;
+     thiz->Resume                  = IDirectFB_Dispatcher_Resume;
+     thiz->WaitIdle                = IDirectFB_Dispatcher_WaitIdle;
+     thiz->WaitForSync             = IDirectFB_Dispatcher_WaitForSync;
+     thiz->GetInterface            = IDirectFB_Dispatcher_GetInterface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.h
new file mode 100755
index 0000000..419f6cb
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfb_dispatcher.h
@@ -0,0 +1,110 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFB_DISPATCHER_H__
+#define __IDIRECTFB_DISPATCHER_H__
+
+#include <directfb.h>
+
+#define IDIRECTFB_METHOD_ID_AddRef                     1
+#define IDIRECTFB_METHOD_ID_Release                    2
+#define IDIRECTFB_METHOD_ID_SetCooperativeLevel        3
+#define IDIRECTFB_METHOD_ID_GetDeviceDescription       4
+#define IDIRECTFB_METHOD_ID_EnumVideoModes             5
+#define IDIRECTFB_METHOD_ID_SetVideoMode               6
+#define IDIRECTFB_METHOD_ID_CreateSurface              7
+#define IDIRECTFB_METHOD_ID_CreatePalette              8
+#define IDIRECTFB_METHOD_ID_EnumScreens                9
+#define IDIRECTFB_METHOD_ID_GetScreen                 10
+#define IDIRECTFB_METHOD_ID_EnumDisplayLayers         11
+#define IDIRECTFB_METHOD_ID_GetDisplayLayer           12
+#define IDIRECTFB_METHOD_ID_EnumInputDevices          13
+#define IDIRECTFB_METHOD_ID_GetInputDevice            14
+#define IDIRECTFB_METHOD_ID_CreateEventBuffer         15
+#define IDIRECTFB_METHOD_ID_CreateInputEventBuffer    16
+#define IDIRECTFB_METHOD_ID_CreateImageProvider       17
+#define IDIRECTFB_METHOD_ID_CreateVideoProvider       18
+#define IDIRECTFB_METHOD_ID_CreateFont                19
+#define IDIRECTFB_METHOD_ID_CreateDataBuffer          20
+#define IDIRECTFB_METHOD_ID_SetClipboardData          21
+#define IDIRECTFB_METHOD_ID_GetClipboardData          22
+#define IDIRECTFB_METHOD_ID_GetClipboardTimeStamp     23
+#define IDIRECTFB_METHOD_ID_Suspend                   24
+#define IDIRECTFB_METHOD_ID_Resume                    25
+#define IDIRECTFB_METHOD_ID_WaitIdle                  26
+#define IDIRECTFB_METHOD_ID_WaitForSync               27
+#define IDIRECTFB_METHOD_ID_GetInterface              28
+
+typedef struct {
+     int  width;
+     int  height;
+     int  bpp;
+} IDirectFB_Dispatcher_EnumVideoModes_Item;
+
+typedef struct {
+     DFBScreenID          screen_id;
+     DFBScreenDescription desc;
+} IDirectFB_Dispatcher_EnumScreens_Item;
+
+typedef struct {
+     DFBInputDeviceID          device_id;
+     DFBInputDeviceDescription desc;
+} IDirectFB_Dispatcher_EnumInputDevices_Item;
+
+
+#if 0
+#define VOODOO_PARSER_READ_DFBSurfaceDescription( p, desc ) \
+	do { \
+	     VOODOO_PARSER_GET_INT( p, (desc).flags ); \
+	     VOODOO_PARSER_GET_INT( p, (desc).caps ); \
+	     VOODOO_PARSER_GET_INT( p, (desc).width ); \
+	     VOODOO_PARSER_GET_INT( p, (desc).height ); \
+	     VOODOO_PARSER_GET_INT( p, (desc).pixelformat ); \
+	     VOODOO_PARSER_GET_UINT( p, (desc).resource_id ); \
+	     VOODOO_PARSER_GET_INT( p, (desc).hints ); \
+	} while (0)
+
+#define VMBT_DFBSurfaceDescription( desc ) \
+	VMBT_INT, (desc).flags, \
+	VMBT_INT, (desc).caps, \
+	VMBT_INT, (desc).width, \
+	VMBT_INT, (desc).height, \
+	VMBT_INT, (desc).pixelformat, \
+	VMBT_UINT, (desc).resource_id, \
+	VMBT_INT, (desc).hints
+#else
+#define VOODOO_PARSER_READ_DFBSurfaceDescription( p, desc ) \
+	do { \
+	     VOODOO_PARSER_READ_DATA( p, &(desc), sizeof(DFBSurfaceDescription) ); \
+	} while (0)
+
+#define VMBT_DFBSurfaceDescription( desc ) \
+	VMBT_DATA, sizeof(DFBSurfaceDescription), &(desc)
+#endif
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.c
new file mode 100755
index 0000000..b4c376a
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.c
@@ -0,0 +1,673 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <media/idirectfbdatabuffer.h>
+
+#include "idirectfb_dispatcher.h"
+#include "idirectfbdatabuffer_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBDataBuffer *thiz,
+                            IDirectFBDataBuffer *real,
+                            VoodooManager       *manager,
+                            VoodooInstanceID     super,
+                            void                *arg,
+                            VoodooInstanceID    *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBDataBuffer, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBDataBuffer_Dispatcher
+ */
+typedef struct {
+     IDirectFBDataBuffer_data  base;
+
+     IDirectFBDataBuffer      *real;
+
+     VoodooInstanceID          self;         /* The instance of this dispatcher itself. */
+     VoodooInstanceID          super;        /* The instance of the super interface. */
+
+     VoodooManager            *manager;
+
+     IDirectFB                *idirectfb;
+} IDirectFBDataBuffer_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBDataBuffer_Dispatcher_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     IDirectFBDataBuffer_Destruct( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBDataBuffer_Dispatcher_AddRef( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     data->base.ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBDataBuffer_Dispatcher_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     if (--data->base.ref == 0)
+          IDirectFBDataBuffer_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_Flush( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->Flush( data->real );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_Finish( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->Finish( data->real );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_SeekTo( IDirectFBDataBuffer *thiz,
+                                       unsigned int         offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->SeekTo( data->real, offset );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_GetPosition( IDirectFBDataBuffer *thiz,
+                                            unsigned int        *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->GetPosition( data->real, offset );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_GetLength( IDirectFBDataBuffer *thiz,
+                                          unsigned int        *length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->GetLength( data->real, length );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_WaitForData( IDirectFBDataBuffer *thiz,
+                                            unsigned int         length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->WaitForData( data->real, length );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                                       unsigned int         length,
+                                                       unsigned int         seconds,
+                                                       unsigned int         milli_seconds )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->WaitForDataWithTimeout( data->real, length, seconds, milli_seconds );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_GetData( IDirectFBDataBuffer *thiz,
+                                        unsigned int         length,
+                                        void                *dest,
+                                        unsigned int        *read )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->GetData( data->real, length, dest, read );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_PeekData( IDirectFBDataBuffer *thiz,
+                                         unsigned int         length,
+                                         int                  offset,
+                                         void                *dest,
+                                         unsigned int        *read )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->PeekData( data->real, length, offset, dest, read );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_HasData( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->HasData( data->real );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_PutData( IDirectFBDataBuffer *thiz,
+                                        const void          *source,
+                                        unsigned int         length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return data->real->PutData( data->real, source, length );
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_CreateImageProvider( IDirectFBDataBuffer     *thiz,
+                                                    IDirectFBImageProvider **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->super,
+                                   IDIRECTFB_METHOD_ID_CreateImageProvider,
+                                   VREQ_RESPOND | VREQ_ASYNC, &response,
+                                   VMBT_ID, data->self,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBImageProvider",
+                                            response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_CreateVideoProvider( IDirectFBDataBuffer     *thiz,
+                                                    IDirectFBVideoProvider **ret_interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Dispatcher_CreateFont( IDirectFBDataBuffer       *thiz,
+                                           const DFBFontDescription  *desc,
+                                           IDirectFBFont            **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->super,
+                                   IDIRECTFB_METHOD_ID_CreateFont,
+                                   VREQ_RESPOND | VREQ_ASYNC, &response,
+                                   VMBT_ID, data->self,
+                                   VMBT_DATA, sizeof(DFBFontDescription), desc,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBFont",
+                                            response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_Flush( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     ret = real->Flush( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_Finish( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     ret = real->Finish( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SeekTo( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     unsigned int        offset;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, offset );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SeekTo( real, offset );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetPosition( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     unsigned int offset;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     ret = real->GetPosition( real, &offset );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, offset,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetLength( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     unsigned int length;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     ret = real->GetLength( real, &length );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, length,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_WaitForData( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     unsigned int        length;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->WaitForData( real, length );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     unsigned int        length;
+     unsigned int        seconds;
+     unsigned int        milli_seconds;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_GET_UINT( parser, seconds );
+     VOODOO_PARSER_GET_UINT( parser, milli_seconds );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->WaitForDataWithTimeout( real, length, seconds, milli_seconds );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetData( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     unsigned int         length;
+     unsigned int         read;
+     void                *tmp;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_END( parser );
+
+     if (length > 16384)
+          length = 16384;
+
+     tmp = D_MALLOC( length );
+     if (!tmp)
+          return D_OOM();
+
+     ret = real->GetData( real, length, tmp, &read );
+     if (ret) {
+          D_FREE( tmp );
+          return ret;
+     }
+
+     ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                   ret, VOODOO_INSTANCE_NONE,
+                                   VMBT_UINT, read,
+                                   VMBT_DATA, read, tmp,
+                                   VMBT_NONE );
+
+     D_FREE( tmp );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_PeekData( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     unsigned int         length;
+     int                  offset;
+     unsigned int         read;
+     void                *tmp;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_GET_INT( parser, offset );
+     VOODOO_PARSER_END( parser );
+
+     if (length > 16384)
+          length = 16384;
+
+     tmp = D_MALLOC( length );
+     if (!tmp)
+          return D_OOM();
+
+     ret = real->PeekData( real, length, offset, tmp, &read );
+     if (ret) {
+          D_FREE( tmp );
+          return ret;
+     }
+
+     ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                   ret, VOODOO_INSTANCE_NONE,
+                                   VMBT_UINT, read,
+                                   VMBT_DATA, read, tmp,
+                                   VMBT_NONE );
+
+     D_FREE( tmp );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_HasData( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     ret = real->HasData( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_PutData( IDirectFBDataBuffer *thiz, IDirectFBDataBuffer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     unsigned int         length;
+     const void          *source;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_GET_DATA( parser, source );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->PutData( real, source, length );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBDataBuffer/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBDATABUFFER_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_Flush:
+               return Dispatch_Flush( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_Finish:
+               return Dispatch_Finish( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_SeekTo:
+               return Dispatch_SeekTo( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_GetPosition:
+               return Dispatch_GetPosition( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_GetLength:
+               return Dispatch_GetLength( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_WaitForData:
+               return Dispatch_WaitForData( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_WaitForDataWithTimeout:
+               return Dispatch_WaitForDataWithTimeout( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_GetData:
+               return Dispatch_GetData( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_PeekData:
+               return Dispatch_PeekData( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_HasData:
+               return Dispatch_HasData( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDATABUFFER_METHOD_ID_PutData:
+               return Dispatch_PutData( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBDataBuffer *thiz,
+           IDirectFBDataBuffer *real,
+           VoodooManager       *manager,
+           VoodooInstanceID     super,
+           void                *arg,
+           VoodooInstanceID    *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDataBuffer_Dispatcher)
+
+     ret = IDirectFBDataBuffer_Construct( thiz, NULL, NULL );
+     if (ret)
+          return ret;
+
+     ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, thiz, real, Dispatch, &instance );
+     if (ret) {
+          IDirectFBDataBuffer_Destruct( thiz );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     data->real      = real;
+     data->self      = instance;
+     data->super     = super;
+     data->manager   = manager;
+     data->idirectfb = arg;
+
+     thiz->AddRef                 = IDirectFBDataBuffer_Dispatcher_AddRef;
+     thiz->Release                = IDirectFBDataBuffer_Dispatcher_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_Dispatcher_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_Dispatcher_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_Dispatcher_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_Dispatcher_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_Dispatcher_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_Dispatcher_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_Dispatcher_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_Dispatcher_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_Dispatcher_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_Dispatcher_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_Dispatcher_PutData;
+     thiz->CreateImageProvider    = IDirectFBDataBuffer_Dispatcher_CreateImageProvider;
+     thiz->CreateVideoProvider    = IDirectFBDataBuffer_Dispatcher_CreateVideoProvider;
+     thiz->CreateFont             = IDirectFBDataBuffer_Dispatcher_CreateFont;
+     
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.h
new file mode 100755
index 0000000..c9b8c24
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbdatabuffer_dispatcher.h
@@ -0,0 +1,47 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBDATABUFFER_DISPATCHER_H__
+#define __IDIRECTFBDATABUFFER_DISPATCHER_H__
+
+#define IDIRECTFBDATABUFFER_METHOD_ID_AddRef                     1
+#define IDIRECTFBDATABUFFER_METHOD_ID_Release                    2
+#define IDIRECTFBDATABUFFER_METHOD_ID_Flush                      3
+#define IDIRECTFBDATABUFFER_METHOD_ID_Finish                     4
+#define IDIRECTFBDATABUFFER_METHOD_ID_SeekTo                     5
+#define IDIRECTFBDATABUFFER_METHOD_ID_GetPosition                6
+#define IDIRECTFBDATABUFFER_METHOD_ID_GetLength                  7
+#define IDIRECTFBDATABUFFER_METHOD_ID_WaitForData                8
+#define IDIRECTFBDATABUFFER_METHOD_ID_WaitForDataWithTimeout     9
+#define IDIRECTFBDATABUFFER_METHOD_ID_GetData                   10
+#define IDIRECTFBDATABUFFER_METHOD_ID_PeekData                  11
+#define IDIRECTFBDATABUFFER_METHOD_ID_HasData                   12
+#define IDIRECTFBDATABUFFER_METHOD_ID_PutData                   13
+#define IDIRECTFBDATABUFFER_METHOD_ID_CreateImageProvider       14
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.c
new file mode 100755
index 0000000..16c41d4
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.c
@@ -0,0 +1,900 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbdisplaylayer_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBDisplayLayer *thiz,
+                            IDirectFBDisplayLayer *real,
+                            VoodooManager         *manager,
+                            VoodooInstanceID       super,
+                            void                  *arg,
+                            VoodooInstanceID      *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBDisplayLayer, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBDisplayLayer_Dispatcher_Destruct( IDirectFBDisplayLayer *thiz )
+{
+     IDirectFBDisplayLayer_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBDisplayLayer_Dispatcher_AddRef( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBDisplayLayer_Dispatcher_Release( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBDisplayLayer_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetID( IDirectFBDisplayLayer *thiz,
+                                        DFBDisplayLayerID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetDescription( IDirectFBDisplayLayer      *thiz,
+                                                 DFBDisplayLayerDescription *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetSurface( IDirectFBDisplayLayer  *thiz,
+                                             IDirectFBSurface      **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetScreen( IDirectFBDisplayLayer  *thiz,
+                                            IDirectFBScreen       **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetCooperativeLevel( IDirectFBDisplayLayer           *thiz,
+                                                      DFBDisplayLayerCooperativeLevel  level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetOpacity( IDirectFBDisplayLayer *thiz,
+                                             u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetCurrentOutputField( IDirectFBDisplayLayer *thiz, int *field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetFieldParity( IDirectFBDisplayLayer *thiz, int field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetScreenLocation( IDirectFBDisplayLayer *thiz,
+                                                    float                  x,
+                                                    float                  y,
+                                                    float                  width,
+                                                    float                  height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetSrcColorKey( IDirectFBDisplayLayer *thiz,
+                                                 u8                     r,
+                                                 u8                     g,
+                                                 u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetDstColorKey( IDirectFBDisplayLayer *thiz,
+                                                 u8                     r,
+                                                 u8                     g,
+                                                 u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetLevel( IDirectFBDisplayLayer *thiz,
+                                           int                   *level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetLevel( IDirectFBDisplayLayer *thiz,
+                                           int                    level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetConfiguration( IDirectFBDisplayLayer *thiz,
+                                                   DFBDisplayLayerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_TestConfiguration( IDirectFBDisplayLayer       *thiz,
+                                                    const DFBDisplayLayerConfig *config,
+                                                    DFBDisplayLayerConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetConfiguration( IDirectFBDisplayLayer       *thiz,
+                                                   const DFBDisplayLayerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetBackgroundMode( IDirectFBDisplayLayer         *thiz,
+                                                    DFBDisplayLayerBackgroundMode  background_mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetBackgroundImage( IDirectFBDisplayLayer *thiz,
+                                                     IDirectFBSurface      *surface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetBackgroundColor( IDirectFBDisplayLayer *thiz,
+                                                     u8 r, u8 g, u8 b, u8 a )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_CreateWindow( IDirectFBDisplayLayer       *thiz,
+                                               const DFBWindowDescription  *desc,
+                                               IDirectFBWindow            **window )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetWindow( IDirectFBDisplayLayer  *thiz,
+                                            DFBWindowID             id,
+                                            IDirectFBWindow       **window )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_EnableCursor( IDirectFBDisplayLayer *thiz, int enable )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetCursorPosition( IDirectFBDisplayLayer *thiz,
+                                                    int *x, int *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_WarpCursor( IDirectFBDisplayLayer *thiz, int x, int y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetCursorAcceleration( IDirectFBDisplayLayer *thiz,
+                                                        int                    numerator,
+                                                        int                    denominator,
+                                                        int                    threshold )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetCursorShape( IDirectFBDisplayLayer *thiz,
+                                                 IDirectFBSurface      *shape,
+                                                 int                    hot_x,
+                                                 int                    hot_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetCursorOpacity( IDirectFBDisplayLayer *thiz,
+                                                   u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_GetColorAdjustment( IDirectFBDisplayLayer *thiz,
+                                                     DFBColorAdjustment    *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_SetColorAdjustment( IDirectFBDisplayLayer    *thiz,
+                                                     const DFBColorAdjustment *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Dispatcher_WaitForSync( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetID( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult      ret;
+     DFBDisplayLayerID id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     ret = real->GetID( real, &id );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_ID, id,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetScreen( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult      ret;
+     IDirectFBScreen  *screen;
+     VoodooInstanceID  instance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     ret = real->GetScreen( real, &screen );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBScreen",
+                                        screen, data->super, NULL, &instance, NULL );
+     if (ret) {
+          screen->Release( screen );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetConfiguration( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     DFBDisplayLayerConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     ret = real->GetConfiguration( real, &config );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBDisplayLayerConfig), &config,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_TestConfiguration( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                 ret;
+     const DFBDisplayLayerConfig *config;
+     VoodooMessageParser          parser;
+     DFBDisplayLayerConfigFlags   failed;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, config );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->TestConfiguration( real, config, &failed );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, failed,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetCooperativeLevel( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                    ret;
+     VoodooMessageParser             parser;
+     DFBDisplayLayerCooperativeLevel level;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, level );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetCooperativeLevel( real, level );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateWindow( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                ret;
+     const DFBWindowDescription *desc;
+     IDirectFBWindow            *window;
+     VoodooInstanceID            instance;
+     VoodooMessageParser         parser;
+     bool                        force_system = (voodoo_config->resource_id != 0);
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, desc );
+     VOODOO_PARSER_END( parser );
+
+     if (1) {
+          unsigned int w = 256, h = 256, b = 2, size;
+
+          if (desc->flags & DWDESC_WIDTH)
+               w = desc->width;
+
+          if (desc->flags & DWDESC_HEIGHT)
+               h = desc->height;
+
+          if (desc->flags & DWDESC_PIXELFORMAT)
+               b = DFB_BYTES_PER_PIXEL( desc->pixelformat ) ? DFB_BYTES_PER_PIXEL( desc->pixelformat ) : 2;
+
+          size = w * h * b;
+
+          D_INFO( "Checking creation of %u kB window\n", size / 1024 );
+
+          if (voodoo_config->surface_max && voodoo_config->surface_max < size) {
+               D_ERROR( "Allocation of %u kB window not permitted (limit %u kB)\n",
+                        size / 1024, voodoo_config->surface_max / 1024 );
+               return DR_LIMITEXCEEDED;
+          }
+
+          ret = voodoo_manager_check_allocation( manager, size );
+          if (ret) {
+               D_ERROR( "Allocation not permitted!\n" );
+               return ret;
+          }
+     }
+
+     if (voodoo_config->resource_id) {
+          if (desc->flags & DWDESC_RESOURCE_ID) {
+               if (desc->resource_id == voodoo_config->resource_id) {
+                    force_system = false;
+               }
+          }
+     }
+
+     if (force_system) {
+          DFBWindowDescription wd = *desc;
+
+          if (wd.flags & DWDESC_SURFACE_CAPS) {
+               wd.surface_caps &= ~DSCAPS_VIDEOONLY;
+               wd.surface_caps |=  DSCAPS_SYSTEMONLY;
+          }
+          else {
+               wd.flags        |= DWDESC_SURFACE_CAPS;
+               wd.surface_caps  = DSCAPS_SYSTEMONLY;
+          }
+
+          if (wd.flags & DWDESC_STACKING) {
+               if (voodoo_config->stacking_mask && !(voodoo_config->stacking_mask & (1 << wd.stacking))) {
+                    D_ERROR( "Stacking class not permitted!\n" );
+                    return DR_ACCESSDENIED;
+               }
+          }
+
+          ret = real->CreateWindow( real, &wd, &window );
+     }
+     else {
+          ret = real->CreateWindow( real, desc, &window );
+     }
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBWindow",
+                                        window, data->super, NULL, &instance, NULL );
+     if (ret) {
+          window->Release( window );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetWindow( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     DFBWindowID          id;
+     IDirectFBWindow     *window;
+     VoodooInstanceID     instance;
+     VoodooMessageParser  parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetWindow( real, id, &window );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBWindow",
+                                        window, data->super, NULL, &instance, NULL );
+     if (ret) {
+          window->Release( window );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetWindowByResourceID( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     DFBWindowID          id;
+     IDirectFBWindow     *window;
+     VoodooInstanceID     instance;
+     VoodooMessageParser  parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetWindowByResourceID( real, id, &window );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBWindow",
+                                        window, data->super, NULL, &instance, NULL );
+     if (ret) {
+          window->Release( window );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetRotation( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     int          rotation;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     ret = real->GetRotation( real, &rotation );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DR_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, rotation,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetBackgroundMode( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser           parser;
+     DFBDisplayLayerBackgroundMode background_mode;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, background_mode );
+     VOODOO_PARSER_END( parser );
+
+     real->SetBackgroundMode( real, background_mode );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetBackgroundImage( IDirectFBDisplayLayer *thiz, IDirectFBDisplayLayer *real,
+                             VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->SetBackgroundImage( real, surface );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBDisplayLayer/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetID:
+               return Dispatch_GetID( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetScreen:
+               return Dispatch_GetScreen( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCooperativeLevel:
+               return Dispatch_SetCooperativeLevel( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetConfiguration:
+               return Dispatch_GetConfiguration( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_TestConfiguration:
+               return Dispatch_TestConfiguration( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_CreateWindow:
+               return Dispatch_CreateWindow( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindow:
+               return Dispatch_GetWindow( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindowByResourceID:
+               return Dispatch_GetWindowByResourceID( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_GetRotation:
+               return Dispatch_GetRotation( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundMode:
+               return Dispatch_SetBackgroundMode( dispatcher, real, manager, msg );
+
+          case IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundImage:
+               return Dispatch_SetBackgroundImage( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBDisplayLayer *thiz,     /* Dispatcher interface */
+           IDirectFBDisplayLayer *real,     /* Real interface implementation */
+           VoodooManager         *manager,  /* Manager of the Voodoo framework */
+           VoodooInstanceID       super,    /* Instance ID of the super interface */
+           void                  *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID      *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDisplayLayer_Dispatcher)
+
+     D_ASSERT( real != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     /* Register the dispatcher, getting a new instance ID that refers to it. */
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     /* Return the new instance. */
+     *ret_instance = instance;
+
+     /* Initialize interface data. */
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+
+     /* Initialize interface methods. */
+     thiz->AddRef                = IDirectFBDisplayLayer_Dispatcher_AddRef;
+     thiz->Release               = IDirectFBDisplayLayer_Dispatcher_Release;
+     thiz->GetID                 = IDirectFBDisplayLayer_Dispatcher_GetID;
+     thiz->GetDescription        = IDirectFBDisplayLayer_Dispatcher_GetDescription;
+     thiz->GetSurface            = IDirectFBDisplayLayer_Dispatcher_GetSurface;
+     thiz->GetScreen             = IDirectFBDisplayLayer_Dispatcher_GetScreen;
+     thiz->SetCooperativeLevel   = IDirectFBDisplayLayer_Dispatcher_SetCooperativeLevel;
+     thiz->SetOpacity            = IDirectFBDisplayLayer_Dispatcher_SetOpacity;
+     thiz->GetCurrentOutputField = IDirectFBDisplayLayer_Dispatcher_GetCurrentOutputField;
+     thiz->SetScreenLocation     = IDirectFBDisplayLayer_Dispatcher_SetScreenLocation;
+     thiz->SetSrcColorKey        = IDirectFBDisplayLayer_Dispatcher_SetSrcColorKey;
+     thiz->SetDstColorKey        = IDirectFBDisplayLayer_Dispatcher_SetDstColorKey;
+     thiz->GetLevel              = IDirectFBDisplayLayer_Dispatcher_GetLevel;
+     thiz->SetLevel              = IDirectFBDisplayLayer_Dispatcher_SetLevel;
+     thiz->GetConfiguration      = IDirectFBDisplayLayer_Dispatcher_GetConfiguration;
+     thiz->TestConfiguration     = IDirectFBDisplayLayer_Dispatcher_TestConfiguration;
+     thiz->SetConfiguration      = IDirectFBDisplayLayer_Dispatcher_SetConfiguration;
+     thiz->SetBackgroundMode     = IDirectFBDisplayLayer_Dispatcher_SetBackgroundMode;
+     thiz->SetBackgroundColor    = IDirectFBDisplayLayer_Dispatcher_SetBackgroundColor;
+     thiz->SetBackgroundImage    = IDirectFBDisplayLayer_Dispatcher_SetBackgroundImage;
+     thiz->GetColorAdjustment    = IDirectFBDisplayLayer_Dispatcher_GetColorAdjustment;
+     thiz->SetColorAdjustment    = IDirectFBDisplayLayer_Dispatcher_SetColorAdjustment;
+     thiz->CreateWindow          = IDirectFBDisplayLayer_Dispatcher_CreateWindow;
+     thiz->GetWindow             = IDirectFBDisplayLayer_Dispatcher_GetWindow;
+     thiz->WarpCursor            = IDirectFBDisplayLayer_Dispatcher_WarpCursor;
+     thiz->SetCursorAcceleration = IDirectFBDisplayLayer_Dispatcher_SetCursorAcceleration;
+     thiz->EnableCursor          = IDirectFBDisplayLayer_Dispatcher_EnableCursor;
+     thiz->GetCursorPosition     = IDirectFBDisplayLayer_Dispatcher_GetCursorPosition;
+     thiz->SetCursorShape        = IDirectFBDisplayLayer_Dispatcher_SetCursorShape;
+     thiz->SetCursorOpacity      = IDirectFBDisplayLayer_Dispatcher_SetCursorOpacity;
+     thiz->SetFieldParity        = IDirectFBDisplayLayer_Dispatcher_SetFieldParity;
+     thiz->WaitForSync           = IDirectFBDisplayLayer_Dispatcher_WaitForSync;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.h
new file mode 100755
index 0000000..6808a14
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbdisplaylayer_dispatcher.h
@@ -0,0 +1,79 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBDISPLAYLAYER_DISPATCHER_H__
+#define __IDIRECTFBDISPLAYLAYER_DISPATCHER_H__
+
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_AddRef                     1
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_Release                    2
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetID                      3
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetDescription             4
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetSurface                 5
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetScreen                  6
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCooperativeLevel        7
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetOpacity                 8
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetCurrentOutputField      9
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetScreenLocation         10
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetSrcColorKey            11
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetDstColorKey            12
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetLevel                  13
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetLevel                  14
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetConfiguration          15
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_TestConfiguration         16
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetConfiguration          17
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundMode         18
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundColor        19
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundImage        20
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetColorAdjustment        21
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetColorAdjustment        22
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_CreateWindow              23
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindow                 24
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_WarpCursor                25
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCursorAcceleration     26
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_EnableCursor              27
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetCursorPosition         28
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCursorShape            29
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCursorOpacity          30
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_SetFieldParity            31
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_WaitForSync               32
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindowByResourceID     33
+#define IDIRECTFBDISPLAYLAYER_METHOD_ID_GetRotation               34
+
+/*
+ * private data struct of IDirectFBDisplayLayer_Dispatcher
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     IDirectFBDisplayLayer *real;
+
+     VoodooInstanceID       self;
+     VoodooInstanceID       super;
+} IDirectFBDisplayLayer_Dispatcher_data;
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.c
new file mode 100755
index 0000000..6a406aa
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.c
@@ -0,0 +1,272 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbeventbuffer_dispatcher.h"
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBEventBuffer *thiz,
+                            IDirectFBEventBuffer *real,
+                            VoodooManager        *manager,
+                            VoodooInstanceID      super,
+                            void                 *arg,
+                            VoodooInstanceID     *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBEventBuffer, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBEventBuffer_Dispatcher_Destruct( IDirectFBEventBuffer *thiz )
+{
+     IDirectFBEventBuffer_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBEventBuffer_Dispatcher_AddRef( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBEventBuffer_Dispatcher_Release( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBEventBuffer_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_Reset( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->Reset( data->real );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_WaitForEvent( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->WaitForEvent( data->real );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_WaitForEventWithTimeout( IDirectFBEventBuffer *thiz,
+                                                         unsigned int          seconds,
+                                                         unsigned int          milli_seconds )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->WaitForEventWithTimeout( data->real, seconds, milli_seconds );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_WakeUp( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->WakeUp( data->real );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_GetEvent( IDirectFBEventBuffer *thiz,
+                                          DFBEvent             *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->GetEvent( data->real, event );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_PeekEvent( IDirectFBEventBuffer *thiz,
+                                           DFBEvent             *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->PeekEvent( data->real, event );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_HasEvent( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->HasEvent( data->real );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_PostEvent( IDirectFBEventBuffer *thiz,
+                                           const DFBEvent       *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->PostEvent( data->real, event );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Dispatcher_CreateFileDescriptor( IDirectFBEventBuffer *thiz,
+                                                      int                  *fd )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return data->real->CreateFileDescriptor( data->real, fd );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBEventBuffer *thiz, IDirectFBEventBuffer *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_PostEvent( IDirectFBEventBuffer *thiz, IDirectFBEventBuffer *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     const DFBEvent      *event;
+     VoodooMessageParser  parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, event );
+     VOODOO_PARSER_END( parser );
+
+     real->PostEvent( real, event );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBEventBuffer/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBEVENTBUFFER_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBEVENTBUFFER_METHOD_ID_PostEvent:
+               return Dispatch_PostEvent( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBEventBuffer *thiz,
+           IDirectFBEventBuffer *real,
+           VoodooManager        *manager,
+           VoodooInstanceID      super,
+           void                 *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID     *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBEventBuffer_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     data->real    = real;
+     data->self    = instance;
+     data->super   = super;
+     data->manager = manager;
+
+     thiz->AddRef                  = IDirectFBEventBuffer_Dispatcher_AddRef;
+     thiz->Release                 = IDirectFBEventBuffer_Dispatcher_Release;
+     thiz->Reset                   = IDirectFBEventBuffer_Dispatcher_Reset;
+     thiz->WaitForEvent            = IDirectFBEventBuffer_Dispatcher_WaitForEvent;
+     thiz->WaitForEventWithTimeout = IDirectFBEventBuffer_Dispatcher_WaitForEventWithTimeout;
+     thiz->GetEvent                = IDirectFBEventBuffer_Dispatcher_GetEvent;
+     thiz->PeekEvent               = IDirectFBEventBuffer_Dispatcher_PeekEvent;
+     thiz->HasEvent                = IDirectFBEventBuffer_Dispatcher_HasEvent;
+     thiz->PostEvent               = IDirectFBEventBuffer_Dispatcher_PostEvent;
+     thiz->WakeUp                  = IDirectFBEventBuffer_Dispatcher_WakeUp;
+     thiz->CreateFileDescriptor    = IDirectFBEventBuffer_Dispatcher_CreateFileDescriptor;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.h
new file mode 100755
index 0000000..b4aab95
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbeventbuffer_dispatcher.h
@@ -0,0 +1,63 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBEVENTBUFFER_DISPATCHER_H__
+#define __IDIRECTFBEVENTBUFFER_DISPATCHER_H__
+
+#include <voodoo/types.h>
+
+#include <directfb.h>
+
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_AddRef                     1
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_Release                    2
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_Reset                      3
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_WaitForEvent               4
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_WaitForEventWithTimeout    5
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_GetEvent                   6
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_PeekEvent                  7
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_HasEvent                   8
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_PostEvent                  9
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_WakeUp                    10
+#define IDIRECTFBEVENTBUFFER_METHOD_ID_CreateFileDescriptor      11
+
+/*
+ * private data struct of IDirectFBEventBuffer_Dispatcher
+ */
+typedef struct {
+     int                   ref;      /* reference counter */
+
+     IDirectFBEventBuffer *real;
+
+     VoodooInstanceID      self;         /* The instance of this dispatcher itself. */
+     VoodooInstanceID      super;        /* The instance of the super interface. */
+
+     VoodooManager        *manager;
+} IDirectFBEventBuffer_Dispatcher_data;
+
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.c
new file mode 100755
index 0000000..bdb2045
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.c
@@ -0,0 +1,532 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbfont_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBFont    *thiz,
+                            IDirectFBFont    *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBFont_Dispatcher
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBFont       *real;
+
+     VoodooInstanceID     self;
+} IDirectFBFont_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBFont_Dispatcher_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBFont_Dispatcher_AddRef( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBFont_Dispatcher_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBFont_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetAscender( IDirectFBFont *thiz, int *ascender )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetDescender( IDirectFBFont *thiz, int *descender )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!descender)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetHeight( IDirectFBFont *thiz, int *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!height)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetMaxAdvance( IDirectFBFont *thiz, int *maxadvance )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!maxadvance)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetKerning( IDirectFBFont *thiz,
+                                     unsigned int prev_index, unsigned int current_index,
+                                     int *kern_x, int *kern_y)
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!kern_x && !kern_y)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetStringExtents( IDirectFBFont *thiz,
+                                           const char *text, int bytes,
+                                           DFBRectangle *logical_rect,
+                                           DFBRectangle *ink_rect )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!text || (!logical_rect && !ink_rect))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetStringWidth( IDirectFBFont *thiz,
+                                         const char *text, int bytes,
+                                         int *width )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+     
+     if (!text || !width)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetGlyphExtents( IDirectFBFont *thiz,
+                                          unsigned int   index,
+                                          DFBRectangle  *rect,
+                                          int           *advance )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     if (!rect && !advance)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_GetStringBreak( IDirectFBFont *thiz,
+                                         const char    *text, 
+                                         int            bytes,
+                                         int            max_width,
+                                         int           *ret_width,
+                                         int           *ret_str_length,
+                                         const char   **ret_next_line )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_SetEncoding( IDirectFBFont     *thiz,
+                                      DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_EnumEncodings( IDirectFBFont           *thiz,
+                                        DFBTextEncodingCallback  callback,
+                                        void                    *ctx )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Dispatcher_FindEncoding( IDirectFBFont     *thiz,
+                                       const char        *name,
+                                       DFBTextEncodingID *encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBFont *thiz, IDirectFBFont *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetAscender( IDirectFBFont *thiz, IDirectFBFont *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     int          ascender;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     ret = real->GetAscender( real, &ascender );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, ascender,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetDescender( IDirectFBFont *thiz, IDirectFBFont *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     int          descender;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     ret = real->GetDescender( real, &descender );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, descender,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetHeight( IDirectFBFont *thiz, IDirectFBFont *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     int          height;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     ret = real->GetHeight( real, &height );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, height,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetMaxAdvance( IDirectFBFont *thiz, IDirectFBFont *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     int          max_advance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     ret = real->GetMaxAdvance( real, &max_advance );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, max_advance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetKerning( IDirectFBFont *thiz, IDirectFBFont *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     unsigned int         prev;
+     unsigned int         next;
+     int                  kern_x;
+     int                  kern_y;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, prev );
+     VOODOO_PARSER_GET_UINT( parser, next );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetKerning( real, prev, next, &kern_x, &kern_y );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, kern_x,
+                                    VMBT_INT, kern_y,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetStringWidth( IDirectFBFont *thiz, IDirectFBFont *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const char          *text;
+     int                  bytes;
+     int                  width;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, text );
+     VOODOO_PARSER_GET_INT( parser, bytes );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetStringWidth( real, text, bytes, &width );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, width,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetStringExtents( IDirectFBFont *thiz, IDirectFBFont *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const char          *text;
+     int                  bytes;
+     DFBRectangle         logical;
+     DFBRectangle         ink;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, text );
+     VOODOO_PARSER_GET_INT( parser, bytes );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetStringExtents( real, text, bytes, &logical, &ink );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBRectangle), &logical,
+                                    VMBT_DATA, sizeof(DFBRectangle), &ink,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetGlyphExtents( IDirectFBFont *thiz, IDirectFBFont *real,
+                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     unsigned int        index;
+     DFBRectangle        extents;
+     int                 advance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetGlyphExtents( real, index, &extents, &advance );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(extents), &extents,
+                                    VMBT_INT, advance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBFont/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBFONT_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetAscender:
+               return Dispatch_GetAscender( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetDescender:
+               return Dispatch_GetDescender( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetHeight:
+               return Dispatch_GetHeight( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetMaxAdvance:
+               return Dispatch_GetMaxAdvance( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetKerning:
+               return Dispatch_GetKerning( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetStringWidth:
+               return Dispatch_GetStringWidth( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetStringExtents:
+               return Dispatch_GetStringExtents( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFONT_METHOD_ID_GetGlyphExtents:
+               return Dispatch_GetGlyphExtents( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBFont    *thiz,
+           IDirectFBFont    *real,
+           VoodooManager    *manager,
+           VoodooInstanceID  super,
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBFont_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, ret_instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->ref  = 1;
+     data->real = real;
+     data->self = *ret_instance;
+
+     thiz->AddRef           = IDirectFBFont_Dispatcher_AddRef;
+     thiz->Release          = IDirectFBFont_Dispatcher_Release;
+     thiz->GetAscender      = IDirectFBFont_Dispatcher_GetAscender;
+     thiz->GetDescender     = IDirectFBFont_Dispatcher_GetDescender;
+     thiz->GetHeight        = IDirectFBFont_Dispatcher_GetHeight;
+     thiz->GetMaxAdvance    = IDirectFBFont_Dispatcher_GetMaxAdvance;
+     thiz->GetKerning       = IDirectFBFont_Dispatcher_GetKerning;
+     thiz->GetStringWidth   = IDirectFBFont_Dispatcher_GetStringWidth;
+     thiz->GetStringExtents = IDirectFBFont_Dispatcher_GetStringExtents;
+     thiz->GetGlyphExtents  = IDirectFBFont_Dispatcher_GetGlyphExtents;
+     thiz->GetStringBreak   = IDirectFBFont_Dispatcher_GetStringBreak;
+     thiz->SetEncoding      = IDirectFBFont_Dispatcher_SetEncoding;
+     thiz->EnumEncodings    = IDirectFBFont_Dispatcher_EnumEncodings;
+     thiz->FindEncoding     = IDirectFBFont_Dispatcher_FindEncoding;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.h
new file mode 100755
index 0000000..253ab3f
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbfont_dispatcher.h
@@ -0,0 +1,43 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBFONT_DISPATCHER_H__
+#define __IDIRECTFBFONT_DISPATCHER_H__
+
+#define IDIRECTFBFONT_METHOD_ID_AddRef                     1
+#define IDIRECTFBFONT_METHOD_ID_Release                    2
+#define IDIRECTFBFONT_METHOD_ID_GetAscender                3
+#define IDIRECTFBFONT_METHOD_ID_GetDescender               4
+#define IDIRECTFBFONT_METHOD_ID_GetHeight                  5
+#define IDIRECTFBFONT_METHOD_ID_GetMaxAdvance              6
+#define IDIRECTFBFONT_METHOD_ID_GetKerning                 7
+#define IDIRECTFBFONT_METHOD_ID_GetStringWidth             8
+#define IDIRECTFBFONT_METHOD_ID_GetStringExtents           9
+#define IDIRECTFBFONT_METHOD_ID_GetGlyphExtents           10
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.c
new file mode 100755
index 0000000..2d86627
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.c
@@ -0,0 +1,194 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbfoo_dispatcher.h"
+
+
+static DFBResult Probe();
+static DFBResult Construct( IDirectFBFoo     *thiz,
+                            IDirectFBFoo     *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFoo, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBFoo_Dispatcher_Destruct( IDirectFBFoo *thiz )
+{
+     IDirectFBFoo_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+IDirectFBFoo_Dispatcher_AddRef( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFoo_Dispatcher_Release( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBFoo_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFoo_Dispatcher_Bar( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBFoo *thiz, IDirectFBFoo *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_Bar( IDirectFBFoo *thiz, IDirectFBFoo *real,
+              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBFoo/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBFOO_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBFOO_METHOD_ID_Bar:
+               return Dispatch_Bar( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBFoo     *thiz,     /* Dispatcher interface */
+           IDirectFBFoo     *real,     /* Real interface implementation */
+           VoodooManager    *manager,  /* Manager of the Voodoo framework */
+           VoodooInstanceID  super,    /* Instance ID of the super interface */
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBFoo_Dispatcher)
+
+     D_ASSERT( real != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     /* Register the dispatcher, getting a new instance ID that refers to it. */
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     /* Return the new instance. */
+     *ret_instance = instance;
+
+     /* Initialize interface data. */
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+
+     /* Initialize interface methods. */
+     thiz->AddRef  = IDirectFBFoo_Dispatcher_AddRef;
+     thiz->Release = IDirectFBFoo_Dispatcher_Release;
+     thiz->Bar     = IDirectFBFoo_Dispatcher_Bar;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.h
new file mode 100755
index 0000000..4f9e062
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbfoo_dispatcher.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBFOO_DISPATCHER_H__
+#define __IDIRECTFBFOO_DISPATCHER_H__
+
+#define IDIRECTFBFOO_METHOD_ID_AddRef                     1
+#define IDIRECTFBFOO_METHOD_ID_Release                    2
+#define IDIRECTFBFOO_METHOD_ID_Bar                        3
+
+/*
+ * private data struct of IDirectFBFoo_Dispatcher
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBFoo        *real;
+
+     VoodooInstanceID     self;
+     VoodooInstanceID     super;
+} IDirectFBFoo_Dispatcher_data;
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.c
new file mode 100755
index 0000000..b18079b
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.c
@@ -0,0 +1,296 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfb_dispatcher.h>
+
+#include "idirectfbimageprovider_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBImageProvider *thiz,
+                            IDirectFBImageProvider *real,
+                            VoodooManager          *manager,
+                            VoodooInstanceID        super,
+                            void                   *arg,
+                            VoodooInstanceID       *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBImageProvider_Dispatcher
+ */
+typedef struct {
+     int                     ref;      /* reference counter */
+
+     IDirectFBImageProvider *real;
+     VoodooInstanceID        self;
+} IDirectFBImageProvider_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBImageProvider_Dispatcher_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBImageProvider_Dispatcher_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_Dispatcher_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBImageProvider_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_Dispatcher_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                         DFBSurfaceDescription  *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_Dispatcher_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                       DFBImageDescription    *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_Dispatcher_RenderTo( IDirectFBImageProvider *thiz,
+                                            IDirectFBSurface       *destination,
+                                            const DFBRectangle     *destination_rect )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_Dispatcher_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                                     DIRenderCallback        callback,
+                                                     void                   *callback_data )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBImageProvider *thiz, IDirectFBImageProvider *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetSurfaceDescription( IDirectFBImageProvider *thiz, IDirectFBImageProvider *real,
+                                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     DFBSurfaceDescription desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     ret = real->GetSurfaceDescription( real, &desc );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DFBSurfaceDescription( desc ),
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetImageDescription( IDirectFBImageProvider *thiz, IDirectFBImageProvider *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     DFBImageDescription desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     ret = real->GetImageDescription( real, &desc );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBImageDescription), &desc,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_RenderTo( IDirectFBImageProvider *thiz, IDirectFBImageProvider *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     const DFBRectangle  *rect;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_ODATA( parser, rect );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     ret = real->RenderTo( real, surface, rect );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBImageProvider/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBIMAGEPROVIDER_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetSurfaceDescription:
+               return Dispatch_GetSurfaceDescription( dispatcher, real, manager, msg );
+
+          case IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetImageDescription:
+               return Dispatch_GetImageDescription( dispatcher, real, manager, msg );
+
+          case IDIRECTFBIMAGEPROVIDER_METHOD_ID_RenderTo:
+               return Dispatch_RenderTo( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           IDirectFBImageProvider *real,
+           VoodooManager          *manager,
+           VoodooInstanceID        super,
+           void                   *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID       *ret_instance )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, ret_instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->ref  = 1;
+     data->real = real;
+     data->self = *ret_instance;
+
+     thiz->AddRef                = IDirectFBImageProvider_Dispatcher_AddRef;
+     thiz->Release               = IDirectFBImageProvider_Dispatcher_Release;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_Dispatcher_GetSurfaceDescription;
+     thiz->GetImageDescription   = IDirectFBImageProvider_Dispatcher_GetImageDescription;
+     thiz->RenderTo              = IDirectFBImageProvider_Dispatcher_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_Dispatcher_SetRenderCallback;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.h
new file mode 100755
index 0000000..752bbe9
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbimageprovider_dispatcher.h
@@ -0,0 +1,39 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBIMAGEPROVIDER_DISPATCHER_H__
+#define __IDIRECTFBIMAGEPROVIDER_DISPATCHER_H__
+
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_AddRef                     1
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_Release                    2
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetSurfaceDescription      3
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetImageDescription        4
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_RenderTo                   5
+#define IDIRECTFBIMAGEPROVIDER_METHOD_ID_SetRenderCallback          6
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.c
new file mode 100755
index 0000000..c363e50
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.c
@@ -0,0 +1,635 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbinputdevice_dispatcher.h"
+
+#include <idirectfbeventbuffer_requestor.h>
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBInputDevice *thiz,
+                            IDirectFBInputDevice *real,
+                            VoodooManager        *manager,
+                            VoodooInstanceID      super,
+                            void                 *arg,
+                            VoodooInstanceID     *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBInputDevice, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBInputDevice_Dispatcher_Destruct( IDirectFBInputDevice *thiz )
+{
+     IDirectFBInputDevice_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBInputDevice_Dispatcher_AddRef( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBInputDevice_Dispatcher_Release( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBInputDevice_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetID( IDirectFBInputDevice *thiz,
+                                       DFBInputDeviceID     *ret_id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_id)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_CreateEventBuffer( IDirectFBInputDevice  *thiz,
+                                                   IDirectFBEventBuffer **ret_interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_AttachEventBuffer( IDirectFBInputDevice *thiz,
+                                                   IDirectFBEventBuffer *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_DetachEventBuffer( IDirectFBInputDevice *thiz,
+                                                   IDirectFBEventBuffer *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetDescription( IDirectFBInputDevice      *thiz,
+                                                DFBInputDeviceDescription *ret_desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_desc)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetKeymapEntry( IDirectFBInputDevice      *thiz,
+                                                int                        keycode,
+                                                DFBInputDeviceKeymapEntry *ret_entry )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_entry)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetKeyState( IDirectFBInputDevice        *thiz,
+                                             DFBInputDeviceKeyIdentifier  key_id,
+                                             DFBInputDeviceKeyState      *ret_state )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_state)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetModifiers( IDirectFBInputDevice       *thiz,
+                                              DFBInputDeviceModifierMask *ret_modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_modifiers)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetLockState( IDirectFBInputDevice    *thiz,
+                                              DFBInputDeviceLockState *ret_locks )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_locks)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetButtons( IDirectFBInputDevice     *thiz,
+                                            DFBInputDeviceButtonMask *ret_buttons )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_buttons)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetButtonState( IDirectFBInputDevice           *thiz,
+                                                DFBInputDeviceButtonIdentifier  button,
+                                                DFBInputDeviceButtonState      *ret_state )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_state || (int)button < DIBI_FIRST || button > DIBI_LAST)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetAxis( IDirectFBInputDevice         *thiz,
+                                         DFBInputDeviceAxisIdentifier  axis,
+                                         int                          *ret_pos )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_pos || (int)axis < DIAI_FIRST || axis > DIAI_LAST)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Dispatcher_GetXY( IDirectFBInputDevice *thiz,
+                                       int                  *ret_x,
+                                       int                  *ret_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     if (!ret_x && !ret_y)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetID( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult     ret;
+     DFBInputDeviceID id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     ret = real->GetID( real, &id );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_ID, id,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetDescription( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult              ret;
+     DFBInputDeviceDescription desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     ret = real->GetDescription( real, &desc );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(desc), &desc,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetKeymapEntry( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult              ret;
+     VoodooMessageParser       parser;
+     int                       keycode;
+     DFBInputDeviceKeymapEntry entry;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, keycode );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetKeymapEntry( real, keycode, &entry );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(entry), &entry,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateEventBuffer( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     IDirectFBEventBuffer *buffer;
+     VoodooInstanceID      instance;
+     VoodooMessageParser   parser;
+     void                 *requestor;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->CreateEventBuffer( real, &buffer );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_requestor( manager, "IDirectFBEventBuffer",
+                                       instance, buffer, &requestor );
+
+     buffer->Release( buffer );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_AttachEventBuffer( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                         ret;
+     IDirectFBEventBuffer                *buffer;
+     IDirectFBEventBuffer_Requestor_data *buffer_data;
+     VoodooInstanceID                     instance;
+     VoodooMessageParser                  parser;
+     void                                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_remote( manager, instance, &ptr );
+     if (ret)
+          return ret;
+
+     buffer = ptr;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Requestor );
+
+     ret = real->AttachEventBuffer( real, buffer_data->src );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_DetachEventBuffer( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                         ret;
+     IDirectFBEventBuffer                *buffer;
+     IDirectFBEventBuffer_Requestor_data *buffer_data;
+     VoodooInstanceID                     instance;
+     VoodooMessageParser                  parser;
+     void                                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_remote( manager, instance, &ptr );
+     if (ret)
+          return ret;
+
+     buffer = ptr;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Requestor );
+
+     ret = real->DetachEventBuffer( real, buffer_data->src );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetKeyState( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetModifiers( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetLockState( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetButtons( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetButtonState( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetAxis( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch_GetXY( IDirectFBInputDevice *thiz, IDirectFBInputDevice *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBInputDevice/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetID:
+               return Dispatch_GetID( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetDescription:
+               return Dispatch_GetDescription( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeymapEntry:
+               return Dispatch_GetKeymapEntry( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_CreateEventBuffer:
+               return Dispatch_CreateEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_AttachEventBuffer:
+               return Dispatch_AttachEventBuffer( dispatcher, real, manager, msg );
+               
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_DetachEventBuffer:
+               return Dispatch_DetachEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeyState:
+               return Dispatch_GetKeyState( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetModifiers:
+               return Dispatch_GetModifiers( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetLockState:
+               return Dispatch_GetLockState( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtons:
+               return Dispatch_GetButtons( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtonState:
+               return Dispatch_GetButtonState( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetAxis:
+               return Dispatch_GetAxis( dispatcher, real, manager, msg );
+
+          case IDIRECTFBINPUTDEVICE_METHOD_ID_GetXY:
+               return Dispatch_GetXY( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBInputDevice *thiz,     /* Dispatcher interface */
+           IDirectFBInputDevice *real,     /* Real interface implementation */
+           VoodooManager        *manager,  /* Manager of the Voodoo framework */
+           VoodooInstanceID      super,    /* Instance ID of the super interface */
+           void                 *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID     *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBInputDevice_Dispatcher)
+
+     D_ASSERT( real != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     /* Register the dispatcher, getting a new instance ID that refers to it. */
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     /* Return the new instance. */
+     *ret_instance = instance;
+
+     /* Initialize interface data. */
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+
+     /* Initialize interface methods. */
+     thiz->AddRef             = IDirectFBInputDevice_Dispatcher_AddRef;
+     thiz->Release            = IDirectFBInputDevice_Dispatcher_Release;
+     thiz->GetID              = IDirectFBInputDevice_Dispatcher_GetID;
+     thiz->GetDescription     = IDirectFBInputDevice_Dispatcher_GetDescription;
+     thiz->GetKeymapEntry     = IDirectFBInputDevice_Dispatcher_GetKeymapEntry;
+     thiz->CreateEventBuffer  = IDirectFBInputDevice_Dispatcher_CreateEventBuffer;
+     thiz->AttachEventBuffer  = IDirectFBInputDevice_Dispatcher_AttachEventBuffer;
+     thiz->DetachEventBuffer  = IDirectFBInputDevice_Dispatcher_DetachEventBuffer;
+     thiz->GetKeyState        = IDirectFBInputDevice_Dispatcher_GetKeyState;
+     thiz->GetModifiers       = IDirectFBInputDevice_Dispatcher_GetModifiers;
+     thiz->GetLockState       = IDirectFBInputDevice_Dispatcher_GetLockState;
+     thiz->GetButtons         = IDirectFBInputDevice_Dispatcher_GetButtons;
+     thiz->GetButtonState     = IDirectFBInputDevice_Dispatcher_GetButtonState;
+     thiz->GetAxis            = IDirectFBInputDevice_Dispatcher_GetAxis;
+     thiz->GetXY              = IDirectFBInputDevice_Dispatcher_GetXY;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h
new file mode 100755
index 0000000..b3442f7
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbinputdevice_dispatcher.h
@@ -0,0 +1,60 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBINPUTDEVICE_DISPATCHER_H__
+#define __IDIRECTFBINPUTDEVICE_DISPATCHER_H__
+
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_AddRef                     1
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_Release                    2
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetID                      3
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetDescription             4
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeymapEntry             5
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_CreateEventBuffer          6
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_AttachEventBuffer          7
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeyState                8
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetModifiers               9
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetLockState              10
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtons                11
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetButtonState            12
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetAxis                   13
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_GetXY                     14
+#define IDIRECTFBINPUTDEVICE_METHOD_ID_DetachEventBuffer         15
+
+/*
+ * private data struct of IDirectFBInputDevice_Dispatcher
+ */
+typedef struct {
+     int                   ref;      /* reference counter */
+
+     IDirectFBInputDevice *real;
+
+     VoodooInstanceID      self;
+     VoodooInstanceID      super;
+} IDirectFBInputDevice_Dispatcher_data;
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.c
new file mode 100755
index 0000000..496df2b
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.c
@@ -0,0 +1,408 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include "idirectfbpalette_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBPalette *thiz,
+                            IDirectFBPalette *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBPalette, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBPalette_Dispatcher
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBPalette    *real;
+
+     VoodooInstanceID     self;
+     VoodooInstanceID     super;
+} IDirectFBPalette_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBPalette_Dispatcher_Destruct( IDirectFBPalette *thiz )
+{
+     IDirectFBPalette_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBPalette_Dispatcher_AddRef( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBPalette_Dispatcher_Release( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBPalette_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_GetCapabilities( IDirectFBPalette       *thiz,
+                                             DFBPaletteCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_GetSize( IDirectFBPalette *thiz,
+                                     unsigned int     *size )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_SetEntries( IDirectFBPalette *thiz,
+                                        const DFBColor   *entries,
+                                        unsigned int      num_entries,
+                                        unsigned int      offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_GetEntries( IDirectFBPalette *thiz,
+                                        DFBColor         *entries,
+                                        unsigned int      num_entries,
+                                        unsigned int      offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_FindBestMatch( IDirectFBPalette *thiz,
+                                           u8                r,
+                                           u8                g,
+                                           u8                b,
+                                           u8                a,
+                                           unsigned int     *index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBPalette_Dispatcher_CreateCopy( IDirectFBPalette  *thiz,
+                                        IDirectFBPalette **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetCapabilities( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult           ret;
+     DFBPaletteCapabilities caps;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     ret = real->GetCapabilities( real, &caps );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, caps,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetSize( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     unsigned int size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     ret = real->GetSize( real, &size );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, size,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetEntries( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const DFBColor      *entries;
+     unsigned int         num_entries;
+     unsigned int         offset;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, entries );
+     VOODOO_PARSER_GET_UINT( parser, num_entries );
+     VOODOO_PARSER_GET_UINT( parser, offset );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetEntries( real, entries, num_entries, offset );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetEntries( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     DFBColor            *entries;
+     unsigned int         num_entries;
+     unsigned int         offset;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, num_entries );
+     VOODOO_PARSER_GET_UINT( parser, offset );
+     VOODOO_PARSER_END( parser );
+
+     entries = D_MALLOC( num_entries * sizeof(DFBColor) );
+     if (!entries) {
+          D_WARN( "out of memory" );
+          return DFB_NOSYSTEMMEMORY;
+     }
+
+     ret = real->GetEntries( real, entries, num_entries, offset );
+     if (ret) {
+          D_FREE( entries );
+          return ret;
+     }
+
+     ret = voodoo_manager_respond( manager, true, msg->header.serial,
+                                   DFB_OK, VOODOO_INSTANCE_NONE,
+                                   VMBT_DATA, num_entries * sizeof(DFBColor), entries,
+                                   VMBT_NONE );
+
+     D_FREE( entries );
+
+     return ret;
+}
+
+static DirectResult
+Dispatch_FindBestMatch( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const DFBColor      *color;
+     unsigned int         index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, color );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->FindBestMatch( real, color->r, color->g, color->b, color->a, &index );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, index,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_CreateCopy( IDirectFBPalette *thiz, IDirectFBPalette *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBPalette/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBPALETTE_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_GetCapabilities:
+               return Dispatch_GetCapabilities( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_GetSize:
+               return Dispatch_GetSize( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_SetEntries:
+               return Dispatch_SetEntries( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_GetEntries:
+               return Dispatch_GetEntries( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_FindBestMatch:
+               return Dispatch_FindBestMatch( dispatcher, real, manager, msg );
+
+          case IDIRECTFBPALETTE_METHOD_ID_CreateCopy:
+               return Dispatch_CreateCopy( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBPalette *thiz,
+           IDirectFBPalette *real,
+           VoodooManager    *manager,
+           VoodooInstanceID  super,
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBPalette_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, ret_instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = *ret_instance;
+     data->super = super;
+
+     thiz->AddRef          = IDirectFBPalette_Dispatcher_AddRef;
+     thiz->Release         = IDirectFBPalette_Dispatcher_Release;
+     thiz->GetCapabilities = IDirectFBPalette_Dispatcher_GetCapabilities;
+     thiz->GetSize         = IDirectFBPalette_Dispatcher_GetSize;
+     thiz->SetEntries      = IDirectFBPalette_Dispatcher_SetEntries;
+     thiz->GetEntries      = IDirectFBPalette_Dispatcher_GetEntries;
+     thiz->FindBestMatch   = IDirectFBPalette_Dispatcher_FindBestMatch;
+     thiz->CreateCopy      = IDirectFBPalette_Dispatcher_CreateCopy;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.h
new file mode 100755
index 0000000..8caab58
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbpalette_dispatcher.h
@@ -0,0 +1,41 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBPALETTE_DISPATCHER_H__
+#define __IDIRECTFBPALETTE_DISPATCHER_H__
+
+#define IDIRECTFBPALETTE_METHOD_ID_AddRef                     1
+#define IDIRECTFBPALETTE_METHOD_ID_Release                    2
+#define IDIRECTFBPALETTE_METHOD_ID_GetCapabilities            3
+#define IDIRECTFBPALETTE_METHOD_ID_GetSize                    4
+#define IDIRECTFBPALETTE_METHOD_ID_SetEntries                 5
+#define IDIRECTFBPALETTE_METHOD_ID_GetEntries                 6
+#define IDIRECTFBPALETTE_METHOD_ID_FindBestMatch              7
+#define IDIRECTFBPALETTE_METHOD_ID_CreateCopy                 8
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.c
new file mode 100755
index 0000000..a2f58d9
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.c
@@ -0,0 +1,572 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <core/coredefs.h>
+
+#include "idirectfbscreen_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBScreen  *thiz,
+                            IDirectFBScreen  *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBScreen, Dispatcher )
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBScreen_Dispatcher
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     IDirectFBScreen       *real;
+
+     VoodooInstanceID       self;         /* The instance of this dispatcher itself. */
+     VoodooInstanceID       super;        /* The instance of the creator. */
+} IDirectFBScreen_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBScreen_Dispatcher_Destruct( IDirectFBScreen *thiz )
+{
+     IDirectFBScreen_Dispatcher_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBScreen_Dispatcher_AddRef( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBScreen_Dispatcher_Release( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBScreen_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetID( IDirectFBScreen *thiz,
+                                  DFBScreenID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!id)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetDescription( IDirectFBScreen      *thiz,
+                                           DFBScreenDescription *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetSize( IDirectFBScreen *thiz,
+                                    int             *width,
+                                    int             *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+     
+     if (!width && !height)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_EnumDisplayLayers( IDirectFBScreen         *thiz,
+                                              DFBDisplayLayerCallback  callbackfunc,
+                                              void                    *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_SetPowerMode( IDirectFBScreen    *thiz,
+                                         DFBScreenPowerMode  mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_WaitForSync( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetMixerDescriptions( IDirectFBScreen           *thiz,
+                                                 DFBScreenMixerDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetMixerConfiguration( IDirectFBScreen      *thiz,
+                                                  int                   mixer,
+                                                  DFBScreenMixerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_TestMixerConfiguration( IDirectFBScreen            *thiz,
+                                                   int                         mixer,
+                                                   const DFBScreenMixerConfig *config,
+                                                   DFBScreenMixerConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_SetMixerConfiguration( IDirectFBScreen            *thiz,
+                                                  int                         mixer,
+                                                  const DFBScreenMixerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetEncoderDescriptions( IDirectFBScreen             *thiz,
+                                                   DFBScreenEncoderDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetEncoderConfiguration( IDirectFBScreen        *thiz,
+                                                    int                     encoder,
+                                                    DFBScreenEncoderConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_TestEncoderConfiguration( IDirectFBScreen              *thiz,
+                                                     int                           encoder,
+                                                     const DFBScreenEncoderConfig *config,
+                                                     DFBScreenEncoderConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_SetEncoderConfiguration( IDirectFBScreen              *thiz,
+                                                    int                           encoder,
+                                                    const DFBScreenEncoderConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetOutputDescriptions( IDirectFBScreen            *thiz,
+                                                  DFBScreenOutputDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_GetOutputConfiguration( IDirectFBScreen       *thiz,
+                                                   int                    output,
+                                                   DFBScreenOutputConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_TestOutputConfiguration( IDirectFBScreen             *thiz,
+                                                    int                          output,
+                                                    const DFBScreenOutputConfig *config,
+                                                    DFBScreenOutputConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Dispatcher_SetOutputConfiguration( IDirectFBScreen             *thiz,
+                                                   int                          output,
+                                                   const DFBScreenOutputConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetID( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     DFBScreenID  id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     ret = real->GetID( real, &id );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_ID, id,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetDescription( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     DFBScreenDescription desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     ret = real->GetDescription( real, &desc );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBScreenDescription), &desc,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetSize( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     DFBDimension size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     ret = real->GetSize( real, &size.w, &size.h );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBDimension), &size,
+                                    VMBT_NONE );
+}
+
+typedef struct {
+     int                                               num;
+     IDirectFBScreen_Dispatcher_EnumDisplayLayers_Item items[MAX_LAYERS];
+} EnumDisplayLayers_Context;
+
+static DFBEnumerationResult
+EnumDisplayLayers_Callback( DFBDisplayLayerID           layer_id,
+                            DFBDisplayLayerDescription  desc,
+                            void                       *callbackdata )
+{
+     int                        index;
+     EnumDisplayLayers_Context *context = callbackdata;
+
+     if (context->num == MAX_LAYERS) {
+          D_WARN( "maximum number of %d layers reached", MAX_LAYERS );
+          return DFENUM_CANCEL;
+     }
+
+     index = context->num++;
+
+     context->items[index].layer_id = layer_id;
+     context->items[index].desc     = desc;
+
+     return DFENUM_OK;
+}
+
+static DirectResult
+Dispatch_EnumDisplayLayers( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult              ret;
+     EnumDisplayLayers_Context context = { 0 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     ret = real->EnumDisplayLayers( real, EnumDisplayLayers_Callback, &context );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, context.num,
+                                    VMBT_DATA, context.num * sizeof(IDirectFBScreen_Dispatcher_EnumDisplayLayers_Item), context.items,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetPowerMode( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult        ret;
+     VoodooMessageParser parser;
+     DFBScreenPowerMode  mode;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+     
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, mode );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetPowerMode( real, mode );
+     
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_WaitForSync( IDirectFBScreen *thiz, IDirectFBScreen *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Dispatcher)
+
+     ret = real->WaitForSync( real );
+     
+     return DFB_OK;
+}
+
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBScreen/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBSCREEN_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSCREEN_METHOD_ID_GetID:
+               return Dispatch_GetID( dispatcher, real, manager, msg );
+               
+          case IDIRECTFBSCREEN_METHOD_ID_GetDescription:
+               return Dispatch_GetDescription( dispatcher, real, manager, msg );
+               
+          case IDIRECTFBSCREEN_METHOD_ID_GetSize:
+               return Dispatch_GetSize( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSCREEN_METHOD_ID_EnumDisplayLayers:
+               return Dispatch_EnumDisplayLayers( dispatcher, real, manager, msg );
+               
+          case IDIRECTFBSCREEN_METHOD_ID_SetPowerMode:
+               return Dispatch_SetPowerMode( dispatcher, real, manager, msg );
+               
+          case IDIRECTFBSCREEN_METHOD_ID_WaitForSync:
+               return Dispatch_WaitForSync( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBScreen  *thiz,
+           IDirectFBScreen  *real,
+           VoodooManager    *manager,
+           VoodooInstanceID  super,
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBScreen_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     *ret_instance = instance;
+
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+
+     thiz->AddRef                   = IDirectFBScreen_Dispatcher_AddRef;
+     thiz->Release                  = IDirectFBScreen_Dispatcher_Release;
+     thiz->GetID                    = IDirectFBScreen_Dispatcher_GetID;
+     thiz->GetDescription           = IDirectFBScreen_Dispatcher_GetDescription;
+     thiz->GetSize                  = IDirectFBScreen_Dispatcher_GetSize;
+     thiz->EnumDisplayLayers        = IDirectFBScreen_Dispatcher_EnumDisplayLayers;
+     thiz->SetPowerMode             = IDirectFBScreen_Dispatcher_SetPowerMode;
+     thiz->WaitForSync              = IDirectFBScreen_Dispatcher_WaitForSync;
+     thiz->GetMixerDescriptions     = IDirectFBScreen_Dispatcher_GetMixerDescriptions;
+     thiz->GetMixerConfiguration    = IDirectFBScreen_Dispatcher_GetMixerConfiguration;
+     thiz->TestMixerConfiguration   = IDirectFBScreen_Dispatcher_TestMixerConfiguration;
+     thiz->SetMixerConfiguration    = IDirectFBScreen_Dispatcher_SetMixerConfiguration;
+     thiz->GetEncoderDescriptions   = IDirectFBScreen_Dispatcher_GetEncoderDescriptions;
+     thiz->GetEncoderConfiguration  = IDirectFBScreen_Dispatcher_GetEncoderConfiguration;
+     thiz->TestEncoderConfiguration = IDirectFBScreen_Dispatcher_TestEncoderConfiguration;
+     thiz->SetEncoderConfiguration  = IDirectFBScreen_Dispatcher_SetEncoderConfiguration;
+     thiz->GetOutputDescriptions    = IDirectFBScreen_Dispatcher_GetOutputDescriptions;
+     thiz->GetOutputConfiguration   = IDirectFBScreen_Dispatcher_GetOutputConfiguration;
+     thiz->TestOutputConfiguration  = IDirectFBScreen_Dispatcher_TestOutputConfiguration;
+     thiz->SetOutputConfiguration   = IDirectFBScreen_Dispatcher_SetOutputConfiguration;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.h
new file mode 100755
index 0000000..e920f30
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbscreen_dispatcher.h
@@ -0,0 +1,58 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBSCREEN_DISPATCHER_H__
+#define __IDIRECTFBSCREEN_DISPATCHER_H__
+
+#define IDIRECTFBSCREEN_METHOD_ID_AddRef                     1
+#define IDIRECTFBSCREEN_METHOD_ID_Release                    2
+#define IDIRECTFBSCREEN_METHOD_ID_GetID                      3
+#define IDIRECTFBSCREEN_METHOD_ID_GetDescription             4
+#define IDIRECTFBSCREEN_METHOD_ID_GetSize                    5
+#define IDIRECTFBSCREEN_METHOD_ID_EnumDisplayLayers          6
+#define IDIRECTFBSCREEN_METHOD_ID_SetPowerMode               7
+#define IDIRECTFBSCREEN_METHOD_ID_WaitForSync                8
+#define IDIRECTFBSCREEN_METHOD_ID_GetMixerDescriptions       9
+#define IDIRECTFBSCREEN_METHOD_ID_GetMixerConfiguration     10
+#define IDIRECTFBSCREEN_METHOD_ID_TestMixerConfiguration    11
+#define IDIRECTFBSCREEN_METHOD_ID_SetMixerConfiguration     12
+#define IDIRECTFBSCREEN_METHOD_ID_GetEncoderDescriptions    13
+#define IDIRECTFBSCREEN_METHOD_ID_GetEncoderConfiguration   14
+#define IDIRECTFBSCREEN_METHOD_ID_TestEncoderConfiguration  15
+#define IDIRECTFBSCREEN_METHOD_ID_SetEncoderConfiguration   16
+#define IDIRECTFBSCREEN_METHOD_ID_GetOutputDescriptions     17
+#define IDIRECTFBSCREEN_METHOD_ID_GetOutputConfiguration    18
+#define IDIRECTFBSCREEN_METHOD_ID_TestOutputConfiguration   19
+#define IDIRECTFBSCREEN_METHOD_ID_SetOutputConfiguration    20
+
+typedef struct {
+     DFBDisplayLayerID          layer_id;
+     DFBDisplayLayerDescription desc;
+} IDirectFBScreen_Dispatcher_EnumDisplayLayers_Item;
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.c
new file mode 100755
index 0000000..9c38dcc
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.c
@@ -0,0 +1,2149 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <math.h>
+
+
+#include <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <idirectfbsurface_requestor.h>
+
+#include "idirectfbsurface_dispatcher.h"
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBSurface *thiz,
+                            IDirectFBSurface *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBSurface, Dispatcher )
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBSurface_Dispatcher
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     IDirectFBSurface      *real;
+
+     VoodooInstanceID       super;
+     VoodooInstanceID       self;
+
+     VoodooManager         *manager;
+
+     VoodooInstanceID       remote;
+} IDirectFBSurface_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBSurface_Dispatcher_Destruct( IDirectFBSurface *thiz )
+{
+     IDirectFBSurface_Dispatcher_data *data;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data = thiz->priv;
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBSurface_Dispatcher_AddRef( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBSurface_Dispatcher_Release( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBSurface_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetCapabilities( IDirectFBSurface       *thiz,
+                                             DFBSurfaceCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!caps)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetPosition( IDirectFBSurface *thiz,
+                                         int              *x,
+                                         int              *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetSize( IDirectFBSurface *thiz,
+                                     int              *width,
+                                     int              *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetVisibleRectangle( IDirectFBSurface *thiz,
+                                                 DFBRectangle     *rect )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!rect)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetPixelFormat( IDirectFBSurface      *thiz,
+                                            DFBSurfacePixelFormat *format )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!format)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetAccelerationMask( IDirectFBSurface    *thiz,
+                                                 IDirectFBSurface    *source,
+                                                 DFBAccelerationMask *mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!mask)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetPalette( IDirectFBSurface  *thiz,
+                                        IDirectFBPalette **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetPalette( IDirectFBSurface *thiz,
+                                        IDirectFBPalette *palette )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!palette)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetAlphaRamp( IDirectFBSurface *thiz,
+                                          u8 a0, u8 a1, u8 a2, u8 a3 )
+
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Lock( IDirectFBSurface *thiz,
+                                  DFBSurfaceLockFlags flags,
+                                  void **ret_ptr, int *ret_pitch )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!flags || !ret_ptr || !ret_pitch)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetFramebufferOffset( IDirectFBSurface *thiz,
+                                                  int              *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!offset)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Unlock( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Flip( IDirectFBSurface    *thiz,
+                                  const DFBRegion     *region,
+                                  DFBSurfaceFlipFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetField( IDirectFBSurface    *thiz,
+                                      int                  field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (field < 0 || field > 1)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Clear( IDirectFBSurface *thiz,
+                                   u8 r, u8 g, u8 b, u8 a )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetClip( IDirectFBSurface *thiz,
+                                     const DFBRegion  *clip )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetClip( IDirectFBSurface *thiz,
+                                     DFBRegion        *clip )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!clip)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetColor( IDirectFBSurface *thiz,
+                                      u8 r, u8 g, u8 b, u8 a )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetColorIndex( IDirectFBSurface *thiz,
+                                           unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetSrcBlendFunction( IDirectFBSurface        *thiz,
+                                                 DFBSurfaceBlendFunction  src )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetDstBlendFunction( IDirectFBSurface        *thiz,
+                                                 DFBSurfaceBlendFunction  dst )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetPorterDuff( IDirectFBSurface         *thiz,
+                                           DFBSurfacePorterDuffRule  rule )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetSrcColorKey( IDirectFBSurface *thiz,
+                                            u8                r,
+                                            u8                g,
+                                            u8                b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetSrcColorKeyIndex( IDirectFBSurface *thiz,
+                                                 unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetDstColorKey( IDirectFBSurface *thiz,
+                                            u8                r,
+                                            u8                g,
+                                            u8                b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetDstColorKeyIndex( IDirectFBSurface *thiz,
+                                                 unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetFont( IDirectFBSurface *thiz,
+                                     IDirectFBFont    *font )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetFont( IDirectFBSurface  *thiz,
+                                     IDirectFBFont    **font )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetDrawingFlags( IDirectFBSurface       *thiz,
+                                             DFBSurfaceDrawingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_FillRectangle( IDirectFBSurface *thiz,
+                                           int x, int y, int w, int h )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_FillRectangles( IDirectFBSurface   *thiz,
+                                            const DFBRectangle *rects,
+                                            unsigned int        num_rects )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_FillSpans( IDirectFBSurface *thiz,
+                                       int               y,
+                                       const DFBSpan    *spans,
+                                       unsigned int      num_spans )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DrawLine( IDirectFBSurface *thiz,
+                                      int x1, int y1, int x2, int y2 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DrawLines( IDirectFBSurface *thiz,
+                                       const DFBRegion  *lines,
+                                       unsigned int      num_lines )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!lines || !num_lines)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DrawRectangle( IDirectFBSurface *thiz,
+                                           int x, int y, int w, int h )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (w<=0 || h<=0)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_FillTriangle( IDirectFBSurface *thiz,
+                                          int x1, int y1,
+                                          int x2, int y2,
+                                          int x3, int y3 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetBlittingFlags( IDirectFBSurface        *thiz,
+                                              DFBSurfaceBlittingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Blit( IDirectFBSurface   *thiz,
+                                  IDirectFBSurface   *source,
+                                  const DFBRectangle *rect,
+                                  int                 x,
+                                  int                 y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!source)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_TileBlit( IDirectFBSurface   *thiz,
+                                      IDirectFBSurface   *source,
+                                      const DFBRectangle *rect,
+                                      int                 x,
+                                      int                 y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!source)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_BatchBlit( IDirectFBSurface   *thiz,
+                                       IDirectFBSurface   *source,
+                                       const DFBRectangle *source_rects,
+                                       const DFBPoint     *dest_points,
+                                       int                 num )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!source || !source_rects || !dest_points || num < 1)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_StretchBlit( IDirectFBSurface   *thiz,
+                                         IDirectFBSurface   *source,
+                                         const DFBRectangle *source_rect,
+                                         const DFBRectangle *destination_rect )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!source)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_TextureTriangles( IDirectFBSurface     *thiz,
+                                              IDirectFBSurface     *source,
+                                              const DFBVertex      *vertices,
+                                              const int            *indices,
+                                              int                   num,
+                                              DFBTriangleFormation  formation )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!source || !vertices || num < 3)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DrawString( IDirectFBSurface *thiz,
+                                        const char *text, int bytes,
+                                        int x, int y,
+                                        DFBSurfaceTextFlags flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!text)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DrawGlyph( IDirectFBSurface *thiz,
+                                       unsigned int index, int x, int y,
+                                       DFBSurfaceTextFlags flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!index)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetEncoding( IDirectFBSurface  *thiz,
+                                         DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetSubSurface( IDirectFBSurface    *thiz,
+                                           const DFBRectangle  *rect,
+                                           IDirectFBSurface   **surface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!surface)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_GetGL( IDirectFBSurface   *thiz,
+                                   IDirectFBGL       **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_Dump( IDirectFBSurface   *thiz,
+                                  const char         *directory,
+                                  const char         *prefix )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     if (!directory || !prefix)
+          return DFB_INVARG;
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_DisableAcceleration( IDirectFBSurface   *thiz,
+                                                 DFBAccelerationMask mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_ReleaseSource( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Dispatcher_SetIndexTranslation( IDirectFBSurface *thiz,
+                                                 const int        *indices,
+                                                 int               num_indices )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     return voodoo_manager_unregister_local( manager, data->self );
+}
+
+static DirectResult
+Dispatch_GetPosition( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult ret;
+     DFBPoint  position;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     ret = real->GetPosition( real, &position.x, &position.y );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBPoint), &position,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetSize( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult    ret;
+     DFBDimension dimension;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     ret = real->GetSize( real, &dimension.w, &dimension.h );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBDimension), &dimension,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetVisibleRectangle( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult    ret;
+     DFBRectangle rect;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     ret = real->GetVisibleRectangle( real, &rect );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBRectangle), &rect,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetPixelFormat( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult             ret;
+     DFBSurfacePixelFormat format;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     ret = real->GetPixelFormat( real, &format );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, format,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetAccelerationMask( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     void                *surface = NULL;
+     DFBAccelerationMask  mask;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     if (instance != VOODOO_INSTANCE_NONE) {
+          ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+          if (ret)
+               return ret;
+     }
+
+     ret = real->GetAccelerationMask( real, surface, &mask );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, mask,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetPalette( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult      ret;
+     IDirectFBPalette *palette;
+     VoodooInstanceID  instance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     ret = real->GetPalette( real, &palette );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBPalette", palette,
+                                        data->super, NULL, &instance, NULL );
+     if (ret) {
+          palette->Release( palette );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetPalette( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     void                *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &palette );
+     if (ret)
+          return ret;
+
+     real->SetPalette( real, palette );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Flip( IDirectFBSurface *thiz, IDirectFBSurface *real,
+               VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const DFBRegion     *region;
+     DFBSurfaceFlipFlags  flags;
+     unsigned int         millis;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ODATA( parser, region );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     if (data->remote)
+          VOODOO_PARSER_GET_UINT( parser, millis );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->Flip( real, region, flags );
+
+     if (data->remote)
+          voodoo_manager_request( manager, data->remote,
+                                  IDIRECTFBSURFACE_REQUESTOR_METHOD_ID_FlipNotify, VREQ_NONE, NULL,
+                                  VMBT_UINT, millis,
+                                  VMBT_NONE );
+
+     if (flags & DSFLIP_WAIT)
+          return voodoo_manager_respond( manager, true, msg->header.serial,
+                                         ret, VOODOO_INSTANCE_NONE,
+                                         VMBT_NONE );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Clear( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBColor      *color;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, color );
+     VOODOO_PARSER_END( parser );
+
+     real->Clear( real, color->r, color->g, color->b, color->a );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetClip( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBRegion     *clip;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ODATA( parser, clip );
+     VOODOO_PARSER_END( parser );
+
+     real->SetClip( real, clip );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetColor( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBColor      *color;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, color );
+     VOODOO_PARSER_END( parser );
+
+     real->SetColor( real, color->r, color->g, color->b, color->a );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetSrcColorKey( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBColor      *color;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, color );
+     VOODOO_PARSER_END( parser );
+
+     real->SetSrcColorKey( real, color->r, color->g, color->b );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetSrcColorKeyIndex( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     unsigned int        index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_END( parser );
+
+     real->SetSrcColorKeyIndex( real, index );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetDstColorKey( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBColor      *color;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, color );
+     VOODOO_PARSER_END( parser );
+
+     real->SetDstColorKey( real, color->r, color->g, color->b );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetDstColorKeyIndex( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     unsigned int        index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_END( parser );
+
+     real->SetDstColorKeyIndex( real, index );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetBlittingFlags( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser     parser;
+     DFBSurfaceBlittingFlags flags;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     VOODOO_PARSER_END( parser );
+
+     real->SetBlittingFlags( real, flags );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Blit( IDirectFBSurface *thiz, IDirectFBSurface *real,
+               VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     const DFBRectangle  *rect;
+     const DFBPoint      *point;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_ODATA( parser, rect );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->Blit( real, surface, rect, point->x, point->y );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_TileBlit( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     const DFBRectangle  *rect;
+     const DFBPoint      *point;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_ODATA( parser, rect );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->TileBlit( real, surface, rect, point->x, point->y );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_BatchBlit( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     unsigned int         num;
+     const DFBRectangle  *source_rects;
+     const DFBPoint      *dest_points;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_UINT( parser, num );
+     VOODOO_PARSER_GET_DATA( parser, source_rects );
+     VOODOO_PARSER_GET_DATA( parser, dest_points );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->BatchBlit( real, surface, source_rects, dest_points, num );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_StretchBlit( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     const DFBRectangle  *srect;
+     const DFBRectangle  *drect;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_ODATA( parser, srect );
+     VOODOO_PARSER_GET_ODATA( parser, drect );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->StretchBlit( real, surface, srect, drect );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_TextureTriangles( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult          ret;
+     VoodooMessageParser   parser;
+     VoodooInstanceID      instance;
+     const DFBVertex      *vertices;
+     const int            *indices;
+     int                   num;
+     DFBTriangleFormation  formation;
+     void                 *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_DATA( parser, vertices );
+     VOODOO_PARSER_GET_ODATA( parser, indices );
+     VOODOO_PARSER_GET_INT( parser, num );
+     VOODOO_PARSER_GET_INT( parser, formation );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     real->TextureTriangles( real, surface, vertices, indices, num, formation );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetDrawingFlags( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                          VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser    parser;
+     DFBSurfaceDrawingFlags flags;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     VOODOO_PARSER_END( parser );
+
+     real->SetDrawingFlags( real, flags );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_FillRectangle( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBRectangle  *rect;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, rect );
+     VOODOO_PARSER_END( parser );
+
+     real->FillRectangle( real, rect->x, rect->y, rect->w, rect->h );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_FillRectangles( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     unsigned int         num_rects;
+     const DFBRectangle  *rects;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, num_rects );
+     VOODOO_PARSER_GET_DATA( parser, rects );
+     VOODOO_PARSER_END( parser );
+
+     real->FillRectangles( real, rects, num_rects );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_FillSpans( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     int                  y;
+     unsigned int         num_spans;
+     const DFBSpan       *spans;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, y );
+     VOODOO_PARSER_GET_UINT( parser, num_spans );
+     VOODOO_PARSER_GET_DATA( parser, spans );
+     VOODOO_PARSER_END( parser );
+
+     real->FillSpans( real, y, spans, num_spans );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_DrawLine( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                   VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBRegion     *line;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, line );
+     VOODOO_PARSER_END( parser );
+
+     real->DrawLine( real, line->x1, line->y1, line->x2, line->y2 );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_DrawLines( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     unsigned int         num_lines;
+     const DFBRegion     *lines;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, num_lines );
+     VOODOO_PARSER_GET_DATA( parser, lines );
+     VOODOO_PARSER_END( parser );
+
+     real->DrawLines( real, lines, num_lines );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_DrawRectangle( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBRectangle  *rect;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, rect );
+     VOODOO_PARSER_END( parser );
+
+     real->DrawRectangle( real, rect->x, rect->y, rect->w, rect->h );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_FillTriangle( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBTriangle   *tri;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, tri );
+     VOODOO_PARSER_END( parser );
+
+     real->FillTriangle( real, tri->x1, tri->y1, tri->x2, tri->y2, tri->x3, tri->y3 );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetFont( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     void                *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     if (instance == VOODOO_INSTANCE_NONE) {
+          real->SetFont( real, NULL );
+
+          return DFB_OK;
+     }
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &font );
+     if (ret)
+          return ret;
+
+     real->SetFont( real, font );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_DrawString( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const char          *text;
+     int                  bytes;
+     const DFBPoint      *point;
+     DFBSurfaceTextFlags  flags;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, text );
+     VOODOO_PARSER_GET_INT( parser, bytes );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     VOODOO_PARSER_END( parser );
+
+     real->DrawString( real, text, bytes, point->x, point->y, flags );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_DrawGlyph( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     unsigned int         index;
+     const DFBPoint      *point;
+     DFBSurfaceTextFlags  flags;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_GET_INT( parser, flags );
+     VOODOO_PARSER_END( parser );
+
+     real->DrawGlyph( real, index, point->x, point->y, flags );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetEncoding( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     DFBTextEncodingID   encoding;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, encoding );
+     VOODOO_PARSER_END( parser );
+
+     real->SetEncoding( real, encoding );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_GetSubSurface( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const DFBRectangle  *rect;
+     IDirectFBSurface    *surface;
+     VoodooInstanceID     instance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ODATA( parser, rect );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetSubSurface( real, rect, &surface );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBSurface", surface,
+                                        data->super, NULL, &instance, NULL );
+     if (ret) {
+          surface->Release( surface );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_DisableAcceleration( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                              VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     DFBAccelerationMask mask;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, mask );
+     VOODOO_PARSER_END( parser );
+
+     real->DisableAcceleration( real, mask );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_ReleaseSource( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     real->ReleaseSource( real );
+
+     return DFB_OK;
+}
+
+#define RLE16_KEY   0xf001
+
+static void
+rle16_decode( const u16    *src,
+              u16          *dst,
+              unsigned int  num )
+{
+     unsigned int n = 0, last, count, out = 0;
+
+     while (out < num) {
+          last = src[n++];
+
+          if (last == RLE16_KEY) {
+               count = src[n++];
+
+               if (count == RLE16_KEY) {
+                    dst[out++] = RLE16_KEY;
+               }
+               else {
+                    last = src[n++];
+
+                    while (count >= 4) {
+                         dst[out+0] =
+                         dst[out+1] =
+                         dst[out+2] =
+                         dst[out+3] = last;
+
+                         out   += 4;
+                         count -= 4;
+                    }
+
+                    while (count >= 2) {
+                         dst[out+0] =
+                         dst[out+1] = last;
+
+                         out   += 2;
+                         count -= 2;
+                    }
+
+                    while (count--)
+                         dst[out++] = last;
+               }
+          }
+          else
+               dst[out++] = last;
+     }
+
+     D_ASSERT( out == num );
+}
+
+#define RLE32_KEY   0xf0012345
+
+static void
+rle32_decode( const u32    *src,
+              u32          *dst,
+              unsigned int  num )
+{
+     unsigned int n = 0, last, count, out = 0;
+
+     while (out < num) {
+          last = src[n++];
+
+          if (last == RLE32_KEY) {
+               count = src[n++];
+
+               if (count == RLE32_KEY) {
+                    dst[out++] = RLE32_KEY;
+               }
+               else {
+                    last = src[n++];
+
+                    while (count >= 4) {
+                         dst[out+0] =
+                         dst[out+1] =
+                         dst[out+2] =
+                         dst[out+3] = last;
+
+                         out   += 4;
+                         count -= 4;
+                    }
+
+                    while (count >= 2) {
+                         dst[out+0] =
+                         dst[out+1] = last;
+
+                         out   += 2;
+                         count -= 2;
+                    }
+
+                    while (count--)
+                         dst[out++] = last;
+               }
+          }
+          else
+               dst[out++] = last;
+     }
+
+     D_ASSERT( out == num );
+}
+
+static DirectResult
+Dispatch_Write( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     unsigned int         encoded;
+     const DFBRectangle  *rect;
+     const void          *ptr;
+     int                  pitch;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, encoded );
+     VOODOO_PARSER_GET_DATA( parser, rect );
+     VOODOO_PARSER_GET_DATA( parser, ptr );
+     VOODOO_PARSER_GET_INT( parser, pitch );
+     VOODOO_PARSER_END( parser );
+
+     if (encoded) {
+          switch (encoded) {
+               case 2: {
+                    if (rect->w > 2048) {
+                         u16 *buf = D_MALLOC( rect->w * 2 );
+
+                         if (buf) {
+                              rle16_decode( ptr, buf, rect->w );
+
+                              real->Write( real, rect, buf, pitch );
+
+                              D_FREE( buf );
+                         }
+                         else
+                              D_OOM();
+                    }
+                    else {
+                         u16 buf[2048];
+
+                         rle16_decode( ptr, buf, rect->w );
+
+                         real->Write( real, rect, buf, pitch );
+                    }
+                    break;
+               }
+
+               case 4: {
+                    if (rect->w > 1024) {
+                         u32 *buf = D_MALLOC( rect->w * 4 );
+
+                         if (buf) {
+                              rle32_decode( ptr, buf, rect->w );
+
+                              real->Write( real, rect, buf, pitch );
+
+                              D_FREE( buf );
+                         }
+                         else
+                              D_OOM();
+                    }
+                    else {
+                         u32 buf[1024];
+
+                         rle32_decode( ptr, buf, rect->w );
+
+                         real->Write( real, rect, buf, pitch );
+                    }
+                    break;
+               }
+
+               default:
+                    D_UNIMPLEMENTED();
+                    break;
+          }
+     }
+     else
+          real->Write( real, rect, ptr, pitch );
+
+     return DFB_OK;
+}
+
+#define RLE16_KEY   0xf001
+
+static bool
+rle16_encode( const u16    *src,
+              u16          *dst,
+              unsigned int  num,
+              unsigned int *ret_num )
+{
+     unsigned int n, last, count = 0, out = 0;
+
+     for (n=0; n<num; n++) {
+          if (out + 3 > num) {
+               *ret_num = num;
+               return false;
+          }
+
+          if (count > 0) {
+               D_ASSERT( src[n] == last );
+
+               count++;
+          }
+          else {
+               count = 1;
+               last  = src[n];
+          }
+
+          if (n == num-1 || src[n+1] != last) {
+               if (count > 2 || (count > 1 && last == RLE16_KEY)) {
+                    dst[out++] = RLE16_KEY;
+                    dst[out++] = count;
+                    dst[out++] = last;
+               }
+               else {
+                    if (count > 1 || last == RLE16_KEY)
+                         dst[out++] = last;
+
+                    dst[out++] = last;
+               }
+
+               count = 0;
+          }
+     }
+
+     *ret_num = out;
+
+     return true;
+}
+
+#define RLE32_KEY   0xf0012345
+
+static bool
+rle32_encode( const u32    *src,
+              u32          *dst,
+              unsigned int  num,
+              unsigned int *ret_num )
+{
+     unsigned int n, last, count = 0, out = 0;
+
+     for (n=0; n<num; n++) {
+          if (out + 3 > num) {
+               *ret_num = num;
+               return false;
+          }
+
+          if (count > 0) {
+               D_ASSERT( src[n] == last );
+
+               count++;
+          }
+          else {
+               count = 1;
+               last  = src[n];
+          }
+
+          if (n == num-1 || src[n+1] != last) {
+               if (count > 2 || (count > 1 && last == RLE32_KEY)) {
+                    dst[out++] = RLE32_KEY;
+                    dst[out++] = count;
+                    dst[out++] = last;
+               }
+               else {
+                    if (count > 1 || last == RLE32_KEY)
+                         dst[out++] = last;
+
+                    dst[out++] = last;
+               }
+
+               count = 0;
+          }
+     }
+
+     *ret_num = out;
+
+     return true;
+}
+
+static DirectResult
+Dispatch_Read( IDirectFBSurface *thiz, IDirectFBSurface *real,
+               VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult           ret;
+     VoodooMessageParser    parser;
+     const DFBRectangle    *rect;
+     int                    len;
+     int                    y;
+     void                  *buf;
+     DFBSurfacePixelFormat  format;
+     unsigned int           encoded;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, rect );
+     VOODOO_PARSER_END( parser );
+
+     real->GetPixelFormat( real, &format );
+
+     len = DFB_BYTES_PER_LINE( format, rect->w );
+     buf = alloca( len );
+
+
+     switch (voodoo_config->compression_min ? DSPF_UNKNOWN : format) {
+          case DSPF_RGB16: {
+               u16 tmp[rect->w];
+
+               for (y=0; y<rect->h; y++) {
+                    unsigned int num;
+                    DFBRectangle r = { rect->x, rect->y + y, rect->w, 1 };
+
+                    real->Read( real, &r, buf, len );
+
+                    encoded = rle16_encode( buf, tmp, rect->w, &num );
+
+                    ret = voodoo_manager_respond( manager, y == rect->h - 1, msg->header.serial,
+                                                  DFB_OK, VOODOO_INSTANCE_NONE,
+                                                  VMBT_UINT, encoded ? 2 : 0,
+                                                  VMBT_DATA, DFB_BYTES_PER_LINE( format, num ),
+                                                             encoded ? tmp : buf,
+                                                  VMBT_NONE );
+                    if (ret)
+                         break;
+               }
+               break;
+          }
+
+          case DSPF_RGB32:
+          case DSPF_ARGB: {
+               u32 tmp[rect->w];
+
+               for (y=0; y<rect->h; y++) {
+                    unsigned int num;
+                    DFBRectangle r = { rect->x, rect->y + y, rect->w, 1 };
+
+                    real->Read( real, &r, buf, len );
+
+                    encoded = rle32_encode( buf, tmp, rect->w, &num );
+
+                    ret = voodoo_manager_respond( manager, y == rect->h - 1, msg->header.serial,
+                                                  DFB_OK, VOODOO_INSTANCE_NONE,
+                                                  VMBT_UINT, encoded ? 4 : 0,
+                                                  VMBT_DATA, DFB_BYTES_PER_LINE( format, num ),
+                                                             encoded ? tmp : buf,
+                                                  VMBT_NONE );
+                    if (ret)
+                         break;
+               }
+               break;
+          }
+
+          default:
+               for (y=0; y<rect->h; y++) {
+                    DFBRectangle r = { rect->x, rect->y + y, rect->w, 1 };
+
+                    real->Read( real, &r, buf, len );
+
+                    voodoo_manager_respond( manager, y == rect->h - 1, msg->header.serial,
+                                            DFB_OK, VOODOO_INSTANCE_NONE,
+                                            VMBT_UINT, 0,
+                                            VMBT_DATA, len, buf,
+                                            VMBT_NONE );
+               }
+               break;
+     }
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetRenderOptions( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser     parser;
+     DFBSurfaceRenderOptions options;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, options );
+     VOODOO_PARSER_END( parser );
+
+     real->SetRenderOptions( real, options );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetMatrix( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const s32           *matrix;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, matrix );
+     VOODOO_PARSER_END( parser );
+
+     real->SetMatrix( real, matrix );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_SetRemoteInstance( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, data->remote );
+     VOODOO_PARSER_END( parser );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial, DR_OK, VOODOO_INSTANCE_NONE, VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBSurface/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBSURFACE_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetPosition:
+               return Dispatch_GetPosition( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetSize:
+               return Dispatch_GetSize( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetVisibleRectangle:
+               return Dispatch_GetVisibleRectangle( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetPixelFormat:
+               return Dispatch_GetPixelFormat( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetAccelerationMask:
+               return Dispatch_GetAccelerationMask( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetPalette:
+               return Dispatch_GetPalette( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetPalette:
+               return Dispatch_SetPalette( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_Flip:
+               return Dispatch_Flip( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_Clear:
+               return Dispatch_Clear( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetClip:
+               return Dispatch_SetClip( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetColor:
+               return Dispatch_SetColor( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKey:
+               return Dispatch_SetSrcColorKey( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKeyIndex:
+               return Dispatch_SetSrcColorKeyIndex( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetDstColorKey:
+               return Dispatch_SetDstColorKey( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetDstColorKeyIndex:
+               return Dispatch_SetDstColorKeyIndex( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetBlittingFlags:
+               return Dispatch_SetBlittingFlags( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_Blit:
+               return Dispatch_Blit( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_TileBlit:
+               return Dispatch_TileBlit( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_BatchBlit:
+               return Dispatch_BatchBlit( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_StretchBlit:
+               return Dispatch_StretchBlit( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_TextureTriangles:
+               return Dispatch_TextureTriangles( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetDrawingFlags:
+               return Dispatch_SetDrawingFlags( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_FillRectangle:
+               return Dispatch_FillRectangle( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DrawLine:
+               return Dispatch_DrawLine( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DrawLines:
+               return Dispatch_DrawLines( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DrawRectangle:
+               return Dispatch_DrawRectangle( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_FillTriangle:
+               return Dispatch_FillTriangle( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetFont:
+               return Dispatch_SetFont( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DrawString:
+               return Dispatch_DrawString( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DrawGlyph:
+               return Dispatch_DrawGlyph( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetEncoding:
+               return Dispatch_SetEncoding( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_GetSubSurface:
+               return Dispatch_GetSubSurface( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_FillRectangles:
+               return Dispatch_FillRectangles( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_FillSpans:
+               return Dispatch_FillSpans( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_DisableAcceleration:
+               return Dispatch_DisableAcceleration( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_ReleaseSource:
+               return Dispatch_ReleaseSource( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_Write:
+               return Dispatch_Write( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_Read:
+               return Dispatch_Read( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetRenderOptions:
+               return Dispatch_SetRenderOptions( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetMatrix:
+               return Dispatch_SetMatrix( dispatcher, real, manager, msg );
+
+          case IDIRECTFBSURFACE_METHOD_ID_SetRemoteInstance:
+               return Dispatch_SetRemoteInstance( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBSurface *thiz,
+           IDirectFBSurface *real,
+           VoodooManager    *manager,
+           VoodooInstanceID  super,
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBSurface_Dispatcher)
+
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, ret_instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->ref   = 1;
+     data->real  = real;
+     data->super = super;
+     data->self    = *ret_instance;
+     data->manager = manager;
+
+     thiz->AddRef = IDirectFBSurface_Dispatcher_AddRef;
+     thiz->Release = IDirectFBSurface_Dispatcher_Release;
+
+     thiz->GetCapabilities = IDirectFBSurface_Dispatcher_GetCapabilities;
+     thiz->GetPosition = IDirectFBSurface_Dispatcher_GetPosition;
+     thiz->GetSize = IDirectFBSurface_Dispatcher_GetSize;
+     thiz->GetVisibleRectangle = IDirectFBSurface_Dispatcher_GetVisibleRectangle;
+     thiz->GetPixelFormat = IDirectFBSurface_Dispatcher_GetPixelFormat;
+     thiz->GetAccelerationMask = IDirectFBSurface_Dispatcher_GetAccelerationMask;
+
+     thiz->GetPalette = IDirectFBSurface_Dispatcher_GetPalette;
+     thiz->SetPalette = IDirectFBSurface_Dispatcher_SetPalette;
+     thiz->SetAlphaRamp = IDirectFBSurface_Dispatcher_SetAlphaRamp;
+
+     thiz->Lock = IDirectFBSurface_Dispatcher_Lock;
+     thiz->GetFramebufferOffset = IDirectFBSurface_Dispatcher_GetFramebufferOffset;
+     thiz->Unlock = IDirectFBSurface_Dispatcher_Unlock;
+     thiz->Flip = IDirectFBSurface_Dispatcher_Flip;
+     thiz->SetField = IDirectFBSurface_Dispatcher_SetField;
+     thiz->Clear = IDirectFBSurface_Dispatcher_Clear;
+
+     thiz->SetClip = IDirectFBSurface_Dispatcher_SetClip;
+     thiz->GetClip = IDirectFBSurface_Dispatcher_GetClip;
+     thiz->SetColor = IDirectFBSurface_Dispatcher_SetColor;
+     thiz->SetColorIndex = IDirectFBSurface_Dispatcher_SetColorIndex;
+     thiz->SetSrcBlendFunction = IDirectFBSurface_Dispatcher_SetSrcBlendFunction;
+     thiz->SetDstBlendFunction = IDirectFBSurface_Dispatcher_SetDstBlendFunction;
+     thiz->SetPorterDuff = IDirectFBSurface_Dispatcher_SetPorterDuff;
+     thiz->SetSrcColorKey = IDirectFBSurface_Dispatcher_SetSrcColorKey;
+     thiz->SetSrcColorKeyIndex = IDirectFBSurface_Dispatcher_SetSrcColorKeyIndex;
+     thiz->SetDstColorKey = IDirectFBSurface_Dispatcher_SetDstColorKey;
+     thiz->SetDstColorKeyIndex = IDirectFBSurface_Dispatcher_SetDstColorKeyIndex;
+
+     thiz->SetBlittingFlags = IDirectFBSurface_Dispatcher_SetBlittingFlags;
+     thiz->Blit = IDirectFBSurface_Dispatcher_Blit;
+     thiz->TileBlit = IDirectFBSurface_Dispatcher_TileBlit;
+     thiz->BatchBlit = IDirectFBSurface_Dispatcher_BatchBlit;
+     thiz->StretchBlit = IDirectFBSurface_Dispatcher_StretchBlit;
+     thiz->TextureTriangles = IDirectFBSurface_Dispatcher_TextureTriangles;
+
+     thiz->SetDrawingFlags = IDirectFBSurface_Dispatcher_SetDrawingFlags;
+     thiz->FillRectangle = IDirectFBSurface_Dispatcher_FillRectangle;
+     thiz->FillRectangles = IDirectFBSurface_Dispatcher_FillRectangles;
+     thiz->FillSpans = IDirectFBSurface_Dispatcher_FillSpans;
+     thiz->DrawLine = IDirectFBSurface_Dispatcher_DrawLine;
+     thiz->DrawLines = IDirectFBSurface_Dispatcher_DrawLines;
+     thiz->DrawRectangle = IDirectFBSurface_Dispatcher_DrawRectangle;
+     thiz->FillTriangle = IDirectFBSurface_Dispatcher_FillTriangle;
+
+     thiz->SetFont = IDirectFBSurface_Dispatcher_SetFont;
+     thiz->GetFont = IDirectFBSurface_Dispatcher_GetFont;
+     thiz->DrawString = IDirectFBSurface_Dispatcher_DrawString;
+     thiz->DrawGlyph = IDirectFBSurface_Dispatcher_DrawGlyph;
+     thiz->SetEncoding = IDirectFBSurface_Dispatcher_SetEncoding;
+
+     thiz->GetSubSurface = IDirectFBSurface_Dispatcher_GetSubSurface;
+
+     thiz->GetGL = IDirectFBSurface_Dispatcher_GetGL;
+
+     thiz->Dump = IDirectFBSurface_Dispatcher_Dump;
+
+     thiz->DisableAcceleration = IDirectFBSurface_Dispatcher_DisableAcceleration;
+
+     thiz->ReleaseSource = IDirectFBSurface_Dispatcher_ReleaseSource;
+
+     thiz->SetIndexTranslation = IDirectFBSurface_Dispatcher_SetIndexTranslation;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.h
new file mode 100755
index 0000000..5b2c7dc
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbsurface_dispatcher.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.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBSURFACE_DISPATCHER_H__
+#define __IDIRECTFBSURFACE_DISPATCHER_H__
+
+#define IDIRECTFBSURFACE_METHOD_ID_AddRef                     1
+#define IDIRECTFBSURFACE_METHOD_ID_Release                    2
+#define IDIRECTFBSURFACE_METHOD_ID_GetCapabilities            3
+#define IDIRECTFBSURFACE_METHOD_ID_GetSize                    4
+#define IDIRECTFBSURFACE_METHOD_ID_GetVisibleRectangle        5
+#define IDIRECTFBSURFACE_METHOD_ID_GetPixelFormat             6
+#define IDIRECTFBSURFACE_METHOD_ID_GetAccelerationMask        7
+#define IDIRECTFBSURFACE_METHOD_ID_GetPalette                 8
+#define IDIRECTFBSURFACE_METHOD_ID_SetPalette                 9
+#define IDIRECTFBSURFACE_METHOD_ID_Lock                      10
+#define IDIRECTFBSURFACE_METHOD_ID_Unlock                    11
+#define IDIRECTFBSURFACE_METHOD_ID_Flip                      12
+#define IDIRECTFBSURFACE_METHOD_ID_SetField                  13
+#define IDIRECTFBSURFACE_METHOD_ID_Clear                     14
+#define IDIRECTFBSURFACE_METHOD_ID_SetClip                   15
+#define IDIRECTFBSURFACE_METHOD_ID_SetColor                  16
+#define IDIRECTFBSURFACE_METHOD_ID_SetColorIndex             17
+#define IDIRECTFBSURFACE_METHOD_ID_SetSrcBlendFunction       18
+#define IDIRECTFBSURFACE_METHOD_ID_SetDstBlendFunction       19
+#define IDIRECTFBSURFACE_METHOD_ID_SetPorterDuff             20
+#define IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKey            21
+#define IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKeyIndex       22
+#define IDIRECTFBSURFACE_METHOD_ID_SetDstColorKey            23
+#define IDIRECTFBSURFACE_METHOD_ID_SetDstColorKeyIndex       24
+#define IDIRECTFBSURFACE_METHOD_ID_SetBlittingFlags          25
+#define IDIRECTFBSURFACE_METHOD_ID_Blit                      26
+#define IDIRECTFBSURFACE_METHOD_ID_TileBlit                  27
+#define IDIRECTFBSURFACE_METHOD_ID_BatchBlit                 28
+#define IDIRECTFBSURFACE_METHOD_ID_StretchBlit               29
+#define IDIRECTFBSURFACE_METHOD_ID_TextureTriangles          30
+#define IDIRECTFBSURFACE_METHOD_ID_SetDrawingFlags           31
+#define IDIRECTFBSURFACE_METHOD_ID_FillRectangle             32
+#define IDIRECTFBSURFACE_METHOD_ID_DrawLine                  33
+#define IDIRECTFBSURFACE_METHOD_ID_DrawLines                 34
+#define IDIRECTFBSURFACE_METHOD_ID_DrawRectangle             35
+#define IDIRECTFBSURFACE_METHOD_ID_FillTriangle              36
+#define IDIRECTFBSURFACE_METHOD_ID_SetFont                   37
+#define IDIRECTFBSURFACE_METHOD_ID_GetFont                   38
+#define IDIRECTFBSURFACE_METHOD_ID_DrawString                39
+#define IDIRECTFBSURFACE_METHOD_ID_DrawGlyph                 40
+#define IDIRECTFBSURFACE_METHOD_ID_GetSubSurface             41
+#define IDIRECTFBSURFACE_METHOD_ID_GetGL                     42
+#define IDIRECTFBSURFACE_METHOD_ID_Dump                      43
+#define IDIRECTFBSURFACE_METHOD_ID_FillRectangles            44
+#define IDIRECTFBSURFACE_METHOD_ID_FillSpans                 45
+#define IDIRECTFBSURFACE_METHOD_ID_GetPosition               46
+#define IDIRECTFBSURFACE_METHOD_ID_SetEncoding               47
+#define IDIRECTFBSURFACE_METHOD_ID_DisableAcceleration       48
+#define IDIRECTFBSURFACE_METHOD_ID_ReleaseSource             49
+#define IDIRECTFBSURFACE_METHOD_ID_SetIndexTranslation       50
+#define IDIRECTFBSURFACE_METHOD_ID_SetRenderOptions          51
+#define IDIRECTFBSURFACE_METHOD_ID_SetMatrix                 52
+#define IDIRECTFBSURFACE_METHOD_ID_SetSourceMask             53
+#define IDIRECTFBSURFACE_METHOD_ID_MakeSubSurface            54
+#define IDIRECTFBSURFACE_METHOD_ID_Write                     55
+#define IDIRECTFBSURFACE_METHOD_ID_Read                      56
+#define IDIRECTFBSURFACE_METHOD_ID_SetColors                 57
+#define IDIRECTFBSURFACE_METHOD_ID_BatchBlit2                58
+#define IDIRECTFBSURFACE_METHOD_ID_SetRemoteInstance         59
+#define IDIRECTFBSURFACE_METHOD_ID_FillTrapezoids            60
+
+#endif
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.c b/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.c
new file mode 100755
index 0000000..d3115f5
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.c
@@ -0,0 +1,1391 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbeventbuffer_requestor.h>
+
+#include "idirectfbwindow_dispatcher.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBWindow  *thiz,
+                            IDirectFBWindow  *real,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  super,
+                            void             *arg,
+                            VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBWindow, Dispatcher )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBWindow_Dispatcher_Destruct( IDirectFBWindow *thiz )
+{
+     IDirectFBWindow_Dispatcher_data *data;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data = thiz->priv;
+
+     data->real->Release( data->real );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBWindow_Dispatcher_AddRef( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindow_Dispatcher_Release( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     if (--data->ref == 0)
+          IDirectFBWindow_Dispatcher_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_CreateEventBuffer( IDirectFBWindow       *thiz,
+                                              IDirectFBEventBuffer **buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_AttachEventBuffer( IDirectFBWindow       *thiz,
+                                              IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_DetachEventBuffer( IDirectFBWindow       *thiz,
+                                              IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_EnableEvents( IDirectFBWindow       *thiz,
+                                         DFBWindowEventType     mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_DisableEvents( IDirectFBWindow    *thiz,
+                                          DFBWindowEventType  mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetID( IDirectFBWindow *thiz,
+                                  DFBWindowID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetPosition( IDirectFBWindow *thiz,
+                                        int             *x,
+                                        int             *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetSize( IDirectFBWindow *thiz,
+                                    int             *width,
+                                    int             *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetSurface( IDirectFBWindow   *thiz,
+                                       IDirectFBSurface **surface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetProperty( IDirectFBWindow  *thiz,
+                                        const char       *key,
+                                        void             *value,
+                                        void            **old_value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetProperty( IDirectFBWindow  *thiz,
+                                        const char       *key,
+                                        void            **value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_RemoveProperty( IDirectFBWindow  *thiz,
+                                           const char       *key,
+                                           void            **value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetOptions( IDirectFBWindow  *thiz,
+                                       DFBWindowOptions  options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetOptions( IDirectFBWindow  *thiz,
+                                       DFBWindowOptions *options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetColorKey( IDirectFBWindow *thiz,
+                                        u8               r,
+                                        u8               g,
+                                        u8               b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetColorKeyIndex( IDirectFBWindow *thiz,
+                                             unsigned int     index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetOpaqueRegion( IDirectFBWindow *thiz,
+                                            int              x1,
+                                            int              y1,
+                                            int              x2,
+                                            int              y2 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetOpacity( IDirectFBWindow *thiz,
+                                       u8               opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GetOpacity( IDirectFBWindow *thiz,
+                                       u8              *opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetCursorShape( IDirectFBWindow  *thiz,
+                                           IDirectFBSurface *shape,
+                                           int               hot_x,
+                                           int               hot_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_RequestFocus( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_UngrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GrabPointer( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_UngrabPointer( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_GrabKey( IDirectFBWindow            *thiz,
+                                    DFBInputDeviceKeySymbol     symbol,
+                                    DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_UngrabKey( IDirectFBWindow            *thiz,
+                                      DFBInputDeviceKeySymbol     symbol,
+                                      DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Move( IDirectFBWindow *thiz, int dx, int dy )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_MoveTo( IDirectFBWindow *thiz, int x, int y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Resize( IDirectFBWindow *thiz,
+                                   int              width,
+                                   int              height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Raise( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetStackingClass( IDirectFBWindow        *thiz,
+                                             DFBWindowStackingClass  stacking_class )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Lower( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_RaiseToTop( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_LowerToBottom( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_PutAtop( IDirectFBWindow *thiz,
+                                    IDirectFBWindow *lower )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_PutBelow( IDirectFBWindow *thiz,
+                                     IDirectFBWindow *upper )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Close( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_Destroy( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_SetBounds( IDirectFBWindow *thiz,
+                                      int x, int y, int w, int h )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Dispatcher_ResizeSurface( IDirectFBWindow *thiz,
+                                          int              width,
+                                          int              height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Release( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     return voodoo_manager_unregister_local( data->manager, data->self );
+}
+
+static DirectResult
+Dispatch_CreateEventBuffer( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                ret;
+     IDirectFBEventBuffer       *buffer;
+     VoodooInstanceID            instance;
+     VoodooMessageParser         parser;
+     void                       *requestor;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->CreateEventBuffer( real, &buffer );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_requestor( manager, "IDirectFBEventBuffer",
+                                       instance, buffer, &requestor );
+
+     buffer->Release( buffer );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_AttachEventBuffer( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                         ret;
+     IDirectFBEventBuffer                *buffer;
+     IDirectFBEventBuffer_Requestor_data *buffer_data;
+     VoodooInstanceID                     instance;
+     VoodooMessageParser                  parser;
+     void                                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_remote( manager, instance, &ptr );
+     if (ret)
+          return ret;
+
+     buffer = ptr;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Requestor );
+
+     ret = real->AttachEventBuffer( real, buffer_data->src );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_EnableEvents( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     DFBWindowEventType  mask;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, mask );
+     VOODOO_PARSER_END( parser );
+
+     return real->EnableEvents( real, mask );
+}
+
+static DirectResult
+Dispatch_DetachEventBuffer( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                            VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult                         ret;
+     IDirectFBEventBuffer                *buffer;
+     IDirectFBEventBuffer_Requestor_data *buffer_data;
+     VoodooInstanceID                     instance;
+     VoodooMessageParser                  parser;
+     void                                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_remote( manager, instance, &ptr );
+     if (ret)
+          return ret;
+
+     buffer = ptr;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Requestor );
+
+     ret = real->DetachEventBuffer( real, buffer_data->src );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetID( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     DFBWindowID  id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetID( real, &id );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_ID, id,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetPosition( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     DFBPoint     position;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetPosition( real, &position.x, &position.y );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBPoint), &position,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetSize( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+     DFBDimension size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetSize( real, &size.w, &size.h );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_DATA, sizeof(DFBDimension), &size,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetSurface( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult      ret;
+     IDirectFBSurface *surface;
+     VoodooInstanceID  instance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetSurface( real, &surface );
+     if (ret)
+          return ret;
+
+     ret = voodoo_construct_dispatcher( manager, "IDirectFBSurface",
+                                        surface, data->super, NULL, &instance, NULL );
+     if (ret) {
+          surface->Release( surface );
+          return ret;
+     }
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, instance,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetOptions( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult           ret;
+     VoodooMessageParser parser;
+     DFBWindowOptions    options;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, options );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetOptions( real, options );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_GetOptions( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult     ret;
+     DFBWindowOptions options;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetOptions( real, &options );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_INT, options,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetOpacity( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     u8                  opacity;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, opacity );
+     VOODOO_PARSER_END( parser );
+
+     real->SetOpacity( real, opacity );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_GetOpacity( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult     ret;
+     u8               opacity;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GetOpacity( real, &opacity );
+     if (ret)
+          return ret;
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_UINT, opacity,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetCursorShape( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     VoodooInstanceID     instance;
+     const DFBPoint      *hot;
+     void                *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_ID( parser, instance );
+     VOODOO_PARSER_GET_DATA( parser, hot );
+     VOODOO_PARSER_END( parser );
+
+     ret = voodoo_manager_lookup_local( manager, instance, NULL, &surface );
+     if (ret)
+          return ret;
+
+     ret = real->SetCursorShape( real, surface, hot->x, hot->y );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_RequestFocus( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                       VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->RequestFocus( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GrabPointer( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->GrabPointer( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_UngrabPointer( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->UngrabPointer( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_Move( IDirectFBWindow *thiz, IDirectFBWindow *real,
+               VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBPoint      *point;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_END( parser );
+
+     real->Move( real, point->x, point->y );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_MoveTo( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser  parser;
+     const DFBPoint      *point;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, point );
+     VOODOO_PARSER_END( parser );
+
+     real->MoveTo( real, point->x, point->y );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Resize( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                 VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult            ret;
+     VoodooMessageParser  parser;
+     const DFBDimension  *size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, size );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->Resize( real, size->w, size->h );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetStackingClass( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                           VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult              ret;
+     VoodooMessageParser    parser;
+     DFBWindowStackingClass stacking_class;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_INT( parser, stacking_class );
+     VOODOO_PARSER_END( parser );
+
+     if (1) {
+          if (voodoo_config->stacking_mask && !(voodoo_config->stacking_mask & (1 << stacking_class))) {
+               D_ERROR( "Stacking class not permitted!\n" );
+               return DR_ACCESSDENIED;
+          }
+     }
+
+     ret = real->SetStackingClass( real, stacking_class );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Raise( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     real->Raise( real );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Lower( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     real->Lower( real );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_RaiseToTop( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     real->RaiseToTop( real );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_LowerToBottom( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     real->LowerToBottom( real );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Close( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     real->Close( real );
+
+     return DFB_OK;
+}
+
+static DirectResult
+Dispatch_Destroy( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                  VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     ret = real->Destroy( real );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetBounds( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult           ret;
+     VoodooMessageParser parser;
+     const DFBRectangle *bounds;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, bounds );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetBounds( real, bounds->x, bounds->y, bounds->w, bounds->h );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_ResizeSurface( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                        VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult           ret;
+     VoodooMessageParser parser;
+     const DFBDimension *size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, size );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->ResizeSurface( real, size->w, size->h );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetSrcGeometry( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult                ret;
+     VoodooMessageParser      parser;
+     const DFBWindowGeometry *geometry;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, geometry );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetSrcGeometry( real, geometry );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SetDstGeometry( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                         VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DFBResult                ret;
+     VoodooMessageParser      parser;
+     const DFBWindowGeometry *geometry;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, geometry );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->SetDstGeometry( real, geometry );
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    ret, VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_GetProperty( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                      VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     DirectResult         ret;
+     VoodooMessageParser  parser;
+     const char          *key;
+     void                *value = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_STRING( parser, key );
+     VOODOO_PARSER_END( parser );
+
+     ret = real->GetProperty( real, key, &value );
+     if (ret)
+          return ret;
+
+     if (!value)
+          value = (void*) "";
+
+     return voodoo_manager_respond( manager, true, msg->header.serial,
+                                    DFB_OK, VOODOO_INSTANCE_NONE,
+                                    VMBT_STRING, value,
+                                    VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_SendEvent( IDirectFBWindow *thiz, IDirectFBWindow *real,
+                    VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser   parser;
+     const DFBWindowEvent *event;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Dispatcher)
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_DATA( parser, event );
+     VOODOO_PARSER_END( parser );
+
+     return real->SendEvent( real, event );
+}
+
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBWindow/Dispatcher: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBWINDOW_METHOD_ID_Release:
+               return Dispatch_Release( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_CreateEventBuffer:
+               return Dispatch_CreateEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_AttachEventBuffer:
+               return Dispatch_AttachEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_EnableEvents:
+               return Dispatch_EnableEvents( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_DetachEventBuffer:
+               return Dispatch_DetachEventBuffer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetID:
+               return Dispatch_GetID( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetPosition:
+               return Dispatch_GetPosition( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetSize:
+               return Dispatch_GetSize( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetSurface:
+               return Dispatch_GetSurface( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetOptions:
+               return Dispatch_SetOptions( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetOptions:
+               return Dispatch_GetOptions( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetOpacity:
+               return Dispatch_SetOpacity( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetOpacity:
+               return Dispatch_GetOpacity( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetCursorShape:
+               return Dispatch_SetCursorShape( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_RequestFocus:
+               return Dispatch_RequestFocus( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GrabPointer:
+               return Dispatch_GrabPointer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_UngrabPointer:
+               return Dispatch_UngrabPointer( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Move:
+               return Dispatch_Move( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_MoveTo:
+               return Dispatch_MoveTo( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Resize:
+               return Dispatch_Resize( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetStackingClass:
+               return Dispatch_SetStackingClass( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Raise:
+               return Dispatch_Raise( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Lower:
+               return Dispatch_Lower( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_RaiseToTop:
+               return Dispatch_RaiseToTop( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_LowerToBottom:
+               return Dispatch_LowerToBottom( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Close:
+               return Dispatch_Close( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_Destroy:
+               return Dispatch_Destroy( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetBounds:
+               return Dispatch_SetBounds( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_ResizeSurface:
+               return Dispatch_ResizeSurface( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetSrcGeometry:
+               return Dispatch_SetSrcGeometry( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SetDstGeometry:
+               return Dispatch_SetDstGeometry( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_GetProperty:
+               return Dispatch_GetProperty( dispatcher, real, manager, msg );
+
+          case IDIRECTFBWINDOW_METHOD_ID_SendEvent:
+               return Dispatch_SendEvent( dispatcher, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBWindow  *thiz,     /* Dispatcher interface */
+           IDirectFBWindow  *real,     /* Real interface implementation */
+           VoodooManager    *manager,  /* Manager of the Voodoo framework */
+           VoodooInstanceID  super,    /* Instance ID of the super interface */
+           void             *arg,      /* Optional arguments to constructor */
+           VoodooInstanceID *ret_instance )
+{
+     DFBResult        ret;
+     VoodooInstanceID instance;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindow_Dispatcher)
+
+     D_ASSERT( real != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( super != VOODOO_INSTANCE_NONE );
+     D_ASSERT( ret_instance != NULL );
+
+     /* Register the dispatcher, getting a new instance ID that refers to it. */
+     ret = voodoo_manager_register_local( manager, super, thiz, real, Dispatch, &instance );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     /* Return the new instance. */
+     *ret_instance = instance;
+
+     /* Initialize interface data. */
+     data->ref   = 1;
+     data->real  = real;
+     data->self  = instance;
+     data->super = super;
+     data->manager = manager;
+
+     /* Initialize interface methods. */
+     thiz->AddRef             = IDirectFBWindow_Dispatcher_AddRef;
+     thiz->Release            = IDirectFBWindow_Dispatcher_Release;
+     thiz->GetID              = IDirectFBWindow_Dispatcher_GetID;
+     thiz->GetPosition        = IDirectFBWindow_Dispatcher_GetPosition;
+     thiz->GetSize            = IDirectFBWindow_Dispatcher_GetSize;
+     thiz->CreateEventBuffer  = IDirectFBWindow_Dispatcher_CreateEventBuffer;
+     thiz->AttachEventBuffer  = IDirectFBWindow_Dispatcher_AttachEventBuffer;
+     thiz->DetachEventBuffer  = IDirectFBWindow_Dispatcher_DetachEventBuffer;
+     thiz->EnableEvents       = IDirectFBWindow_Dispatcher_EnableEvents;
+     thiz->DisableEvents      = IDirectFBWindow_Dispatcher_DisableEvents;
+     thiz->GetSurface         = IDirectFBWindow_Dispatcher_GetSurface;
+     thiz->SetProperty        = IDirectFBWindow_Dispatcher_SetProperty;
+     thiz->GetProperty        = IDirectFBWindow_Dispatcher_GetProperty;
+     thiz->RemoveProperty     = IDirectFBWindow_Dispatcher_RemoveProperty;
+     thiz->SetOptions         = IDirectFBWindow_Dispatcher_SetOptions;
+     thiz->GetOptions         = IDirectFBWindow_Dispatcher_GetOptions;
+     thiz->SetColorKey        = IDirectFBWindow_Dispatcher_SetColorKey;
+     thiz->SetColorKeyIndex   = IDirectFBWindow_Dispatcher_SetColorKeyIndex;
+     thiz->SetOpaqueRegion    = IDirectFBWindow_Dispatcher_SetOpaqueRegion;
+     thiz->SetOpacity         = IDirectFBWindow_Dispatcher_SetOpacity;
+     thiz->GetOpacity         = IDirectFBWindow_Dispatcher_GetOpacity;
+     thiz->SetCursorShape     = IDirectFBWindow_Dispatcher_SetCursorShape;
+     thiz->RequestFocus       = IDirectFBWindow_Dispatcher_RequestFocus;
+     thiz->GrabKeyboard       = IDirectFBWindow_Dispatcher_GrabKeyboard;
+     thiz->UngrabKeyboard     = IDirectFBWindow_Dispatcher_UngrabKeyboard;
+     thiz->GrabPointer        = IDirectFBWindow_Dispatcher_GrabPointer;
+     thiz->UngrabPointer      = IDirectFBWindow_Dispatcher_UngrabPointer;
+     thiz->GrabKey            = IDirectFBWindow_Dispatcher_GrabKey;
+     thiz->UngrabKey          = IDirectFBWindow_Dispatcher_UngrabKey;
+     thiz->Move               = IDirectFBWindow_Dispatcher_Move;
+     thiz->MoveTo             = IDirectFBWindow_Dispatcher_MoveTo;
+     thiz->Resize             = IDirectFBWindow_Dispatcher_Resize;
+     thiz->SetStackingClass   = IDirectFBWindow_Dispatcher_SetStackingClass;
+     thiz->Raise              = IDirectFBWindow_Dispatcher_Raise;
+     thiz->Lower              = IDirectFBWindow_Dispatcher_Lower;
+     thiz->RaiseToTop         = IDirectFBWindow_Dispatcher_RaiseToTop;
+     thiz->LowerToBottom      = IDirectFBWindow_Dispatcher_LowerToBottom;
+     thiz->PutAtop            = IDirectFBWindow_Dispatcher_PutAtop;
+     thiz->PutBelow           = IDirectFBWindow_Dispatcher_PutBelow;
+     thiz->Close              = IDirectFBWindow_Dispatcher_Close;
+     thiz->Destroy            = IDirectFBWindow_Dispatcher_Destroy;
+     thiz->SetBounds          = IDirectFBWindow_Dispatcher_SetBounds;
+     thiz->ResizeSurface      = IDirectFBWindow_Dispatcher_ResizeSurface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.h b/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.h
new file mode 100755
index 0000000..75a10c6
--- /dev/null
+++ b/Source/DirectFB/proxy/dispatcher/idirectfbwindow_dispatcher.h
@@ -0,0 +1,104 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOW_DISPATCHER_H__
+#define __IDIRECTFBWINDOW_DISPATCHER_H__
+
+#define IDIRECTFBWINDOW_METHOD_ID_AddRef                     1
+#define IDIRECTFBWINDOW_METHOD_ID_Release                    2
+#define IDIRECTFBWINDOW_METHOD_ID_CreateEventBuffer          3
+#define IDIRECTFBWINDOW_METHOD_ID_AttachEventBuffer          4
+#define IDIRECTFBWINDOW_METHOD_ID_EnableEvents               5
+#define IDIRECTFBWINDOW_METHOD_ID_DisableEvents              6
+#define IDIRECTFBWINDOW_METHOD_ID_GetID                      7
+#define IDIRECTFBWINDOW_METHOD_ID_GetPosition                8
+#define IDIRECTFBWINDOW_METHOD_ID_GetSize                    9
+#define IDIRECTFBWINDOW_METHOD_ID_GetSurface                10
+#define IDIRECTFBWINDOW_METHOD_ID_SetOptions                11
+#define IDIRECTFBWINDOW_METHOD_ID_GetOptions                12
+#define IDIRECTFBWINDOW_METHOD_ID_SetColorKey               13
+#define IDIRECTFBWINDOW_METHOD_ID_SetColorKeyIndex          14
+#define IDIRECTFBWINDOW_METHOD_ID_SetOpaqueRegion           15
+#define IDIRECTFBWINDOW_METHOD_ID_SetOpacity                16
+#define IDIRECTFBWINDOW_METHOD_ID_GetOpacity                17
+#define IDIRECTFBWINDOW_METHOD_ID_SetCursorShape            18
+#define IDIRECTFBWINDOW_METHOD_ID_RequestFocus              19
+#define IDIRECTFBWINDOW_METHOD_ID_GrabKeyboard              20
+#define IDIRECTFBWINDOW_METHOD_ID_UngrabKeyboard            21
+#define IDIRECTFBWINDOW_METHOD_ID_GrabPointer               22
+#define IDIRECTFBWINDOW_METHOD_ID_UngrabPointer             23
+#define IDIRECTFBWINDOW_METHOD_ID_GrabKey                   24
+#define IDIRECTFBWINDOW_METHOD_ID_UngrabKey                 25
+#define IDIRECTFBWINDOW_METHOD_ID_Move                      26
+#define IDIRECTFBWINDOW_METHOD_ID_MoveTo                    27
+#define IDIRECTFBWINDOW_METHOD_ID_Resize                    28
+#define IDIRECTFBWINDOW_METHOD_ID_SetStackingClass          29
+#define IDIRECTFBWINDOW_METHOD_ID_Raise                     30
+#define IDIRECTFBWINDOW_METHOD_ID_Lower                     31
+#define IDIRECTFBWINDOW_METHOD_ID_RaiseToTop                32
+#define IDIRECTFBWINDOW_METHOD_ID_LowerToBottom             33
+#define IDIRECTFBWINDOW_METHOD_ID_PutAtop                   34
+#define IDIRECTFBWINDOW_METHOD_ID_PutBelow                  35
+#define IDIRECTFBWINDOW_METHOD_ID_Close                     36
+#define IDIRECTFBWINDOW_METHOD_ID_Destroy                   37
+#define IDIRECTFBWINDOW_METHOD_ID_DetachEventBuffer         38
+#define IDIRECTFBWINDOW_METHOD_ID_SetBounds                 39
+#define IDIRECTFBWINDOW_METHOD_ID_ResizeSurface             40
+#define IDIRECTFBWINDOW_METHOD_ID_Bind                      41
+#define IDIRECTFBWINDOW_METHOD_ID_Unbind                    42
+#define IDIRECTFBWINDOW_METHOD_ID_SetKeySelection           43
+#define IDIRECTFBWINDOW_METHOD_ID_GrabUnselectedKeys        44
+#define IDIRECTFBWINDOW_METHOD_ID_UngrabUnselectedKeys      45
+#define IDIRECTFBWINDOW_METHOD_ID_SetSrcGeometry            46
+#define IDIRECTFBWINDOW_METHOD_ID_SetDstGeometry            47
+#define IDIRECTFBWINDOW_METHOD_ID_SetProperty               48
+#define IDIRECTFBWINDOW_METHOD_ID_GetProperty               49
+#define IDIRECTFBWINDOW_METHOD_ID_RemoveProperty            50
+#define IDIRECTFBWINDOW_METHOD_ID_SetRotation               51
+#define IDIRECTFBWINDOW_METHOD_ID_SetAssociation            52
+#define IDIRECTFBWINDOW_METHOD_ID_BeginUpdates              53
+#define IDIRECTFBWINDOW_METHOD_ID_SetCursorFlags            54
+#define IDIRECTFBWINDOW_METHOD_ID_SetCursorResolution       55
+#define IDIRECTFBWINDOW_METHOD_ID_SetCursorPosition         56
+#define IDIRECTFBWINDOW_METHOD_ID_SendEvent                 57
+
+/*
+ * private data struct of IDirectFBWindow_Dispatcher
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFBWindow     *real;
+
+     VoodooInstanceID     self;
+     VoodooInstanceID     super;
+
+     VoodooManager       *manager;
+} IDirectFBWindow_Dispatcher_data;
+
+#endif
diff --git a/Source/DirectFB/proxy/requestor/Makefile.am b/Source/DirectFB/proxy/requestor/Makefile.am
new file mode 100755
index 0000000..e64f78d
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/Makefile.am
@@ -0,0 +1,125 @@
+## Makefile.am for DirectFB/proxy/requestor
+
+INTERFACES_DIR = $(MODULEDIR)/interfaces
+
+idirectfbdir              = $(INTERFACES_DIR)/IDirectFB
+idirectfbdatabufferdir    = $(INTERFACES_DIR)/IDirectFBDataBuffer
+idirectfbdisplaylayerdir  = $(INTERFACES_DIR)/IDirectFBDisplayLayer
+idirectfbeventbufferdir   = $(INTERFACES_DIR)/IDirectFBEventBuffer
+idirectfbfontdir          = $(INTERFACES_DIR)/IDirectFBFont
+idirectfbimageproviderdir = $(INTERFACES_DIR)/IDirectFBImageProvider
+idirectfbinputdevicedir   = $(INTERFACES_DIR)/IDirectFBInputDevice
+idirectfbpalettedir       = $(INTERFACES_DIR)/IDirectFBPalette
+idirectfbscreendir        = $(INTERFACES_DIR)/IDirectFBScreen
+idirectfbsurfacedir       = $(INTERFACES_DIR)/IDirectFBSurface
+idirectfbwindowdir        = $(INTERFACES_DIR)/IDirectFBWindow
+idirectfbvideoproviderdir = $(INTERFACES_DIR)/IDirectFBVideoProvider
+
+INCLUDES = \
+	-I$(top_builddir)/include		\
+	-I$(top_srcdir)/include			\
+	-I$(top_srcdir)/lib				\
+	-I$(top_builddir)/lib			\
+	-I$(top_srcdir)/src 			\
+	-I$(top_srcdir)/proxy/dispatcher	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+LIBS = \
+	$(top_builddir)/lib/voodoo/libvoodoo.la	\
+	$(top_builddir)/lib/direct/libdirect.la
+
+
+idirectfb_LTLIBRARIES = \
+	libidirectfb_requestor.la
+
+idirectfbdatabuffer_LTLIBRARIES = \
+	libidirectfbdatabuffer_requestor.la
+
+idirectfbdisplaylayer_LTLIBRARIES = \
+	libidirectfbdisplaylayer_requestor.la
+
+idirectfbeventbuffer_LTLIBRARIES = \
+	libidirectfbeventbuffer_requestor.la
+
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_requestor.la
+
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_requestor.la
+
+idirectfbinputdevice_LTLIBRARIES = \
+	libidirectfbinputdevice_requestor.la
+
+idirectfbpalette_LTLIBRARIES = \
+	libidirectfbpalette_requestor.la
+
+idirectfbscreen_LTLIBRARIES = \
+	libidirectfbscreen_requestor.la
+
+idirectfbsurface_LTLIBRARIES = \
+	libidirectfbsurface_requestor.la
+
+idirectfbwindow_LTLIBRARIES = \
+	libidirectfbwindow_requestor.la
+
+if BUILD_STATIC
+idirectfb_DATA              = libidirectfb_requestor.o
+idirectfbdatabuffer_DATA    = libidirectfbdatabuffer_requestor.o
+idirectfbdisplaylayer_DATA  = libidirectfbdisplaylayer_requestor.o
+idirectfbeventbuffer_DATA   = libidirectfbeventbuffer_requestor.o
+idirectfbfont_DATA          = libidirectfbfont_requestor.o
+idirectfbimageprovider_DATA = libidirectfbimageprovider_requestor.o
+idirectfbinputdevice_DATA   = libidirectfbinputdevice_requestor.o
+idirectfbpalette_DATA       = libidirectfbpalette_requestor.o
+idirectfbscreen_DATA        = libidirectfbscreen_requestor.o
+idirectfbsurface_DATA       = libidirectfbsurface_requestor.o
+idirectfbwindow_DATA        = libidirectfbwindow_requestor.o
+endif
+
+
+libidirectfb_requestor_la_SOURCES = idirectfb_requestor.c
+libidirectfb_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfb_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbdatabuffer_requestor_la_SOURCES = idirectfbdatabuffer_requestor.c
+libidirectfbdatabuffer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbdatabuffer_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbdisplaylayer_requestor_la_SOURCES = idirectfbdisplaylayer_requestor.c idirectfbdisplaylayer_requestor.h
+libidirectfbdisplaylayer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbdisplaylayer_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbeventbuffer_requestor_la_SOURCES = idirectfbeventbuffer_requestor.c idirectfbeventbuffer_requestor.h
+libidirectfbeventbuffer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbeventbuffer_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbfont_requestor_la_SOURCES = idirectfbfont_requestor.c idirectfbfont_requestor.h
+libidirectfbfont_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbimageprovider_requestor_la_SOURCES = idirectfbimageprovider_requestor.c
+libidirectfbimageprovider_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbinputdevice_requestor_la_SOURCES = idirectfbinputdevice_requestor.c idirectfbinputdevice_requestor.h
+libidirectfbinputdevice_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbinputdevice_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbpalette_requestor_la_SOURCES = idirectfbpalette_requestor.c idirectfbpalette_requestor.h
+libidirectfbpalette_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbpalette_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbscreen_requestor_la_SOURCES = idirectfbscreen_requestor.c
+libidirectfbscreen_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbscreen_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbsurface_requestor_la_SOURCES = idirectfbsurface_requestor.c idirectfbsurface_requestor.h
+libidirectfbsurface_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbsurface_requestor_la_LIBADD  = $(LIBS)
+
+libidirectfbwindow_requestor_la_SOURCES = idirectfbwindow_requestor.c idirectfbwindow_requestor.h
+libidirectfbwindow_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbwindow_requestor_la_LIBADD  = $(LIBS)
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/proxy/requestor/Makefile.in b/Source/DirectFB/proxy/requestor/Makefile.in
new file mode 100755
index 0000000..6d7891c
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/Makefile.in
@@ -0,0 +1,1401 @@
+# 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 = proxy/requestor
+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)$(idirectfbdir)" \
+	"$(DESTDIR)$(idirectfbdatabufferdir)" \
+	"$(DESTDIR)$(idirectfbdisplaylayerdir)" \
+	"$(DESTDIR)$(idirectfbeventbufferdir)" \
+	"$(DESTDIR)$(idirectfbfontdir)" \
+	"$(DESTDIR)$(idirectfbimageproviderdir)" \
+	"$(DESTDIR)$(idirectfbinputdevicedir)" \
+	"$(DESTDIR)$(idirectfbpalettedir)" \
+	"$(DESTDIR)$(idirectfbscreendir)" \
+	"$(DESTDIR)$(idirectfbsurfacedir)" \
+	"$(DESTDIR)$(idirectfbwindowdir)" "$(DESTDIR)$(idirectfbdir)" \
+	"$(DESTDIR)$(idirectfbdatabufferdir)" \
+	"$(DESTDIR)$(idirectfbdisplaylayerdir)" \
+	"$(DESTDIR)$(idirectfbeventbufferdir)" \
+	"$(DESTDIR)$(idirectfbfontdir)" \
+	"$(DESTDIR)$(idirectfbimageproviderdir)" \
+	"$(DESTDIR)$(idirectfbinputdevicedir)" \
+	"$(DESTDIR)$(idirectfbpalettedir)" \
+	"$(DESTDIR)$(idirectfbscreendir)" \
+	"$(DESTDIR)$(idirectfbsurfacedir)" \
+	"$(DESTDIR)$(idirectfbwindowdir)"
+idirectfbLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbdatabufferLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbdisplaylayerLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbeventbufferLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbfontLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbimageproviderLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbinputdeviceLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbpaletteLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbscreenLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbsurfaceLTLIBRARIES_INSTALL = $(INSTALL)
+idirectfbwindowLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(idirectfb_LTLIBRARIES) \
+	$(idirectfbdatabuffer_LTLIBRARIES) \
+	$(idirectfbdisplaylayer_LTLIBRARIES) \
+	$(idirectfbeventbuffer_LTLIBRARIES) \
+	$(idirectfbfont_LTLIBRARIES) \
+	$(idirectfbimageprovider_LTLIBRARIES) \
+	$(idirectfbinputdevice_LTLIBRARIES) \
+	$(idirectfbpalette_LTLIBRARIES) $(idirectfbscreen_LTLIBRARIES) \
+	$(idirectfbsurface_LTLIBRARIES) $(idirectfbwindow_LTLIBRARIES)
+libidirectfb_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfb_requestor_la_OBJECTS = idirectfb_requestor.lo
+libidirectfb_requestor_la_OBJECTS =  \
+	$(am_libidirectfb_requestor_la_OBJECTS)
+libidirectfb_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libidirectfb_requestor_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+libidirectfbdatabuffer_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbdatabuffer_requestor_la_OBJECTS =  \
+	idirectfbdatabuffer_requestor.lo
+libidirectfbdatabuffer_requestor_la_OBJECTS =  \
+	$(am_libidirectfbdatabuffer_requestor_la_OBJECTS)
+libidirectfbdatabuffer_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbdatabuffer_requestor_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbdisplaylayer_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbdisplaylayer_requestor_la_OBJECTS =  \
+	idirectfbdisplaylayer_requestor.lo
+libidirectfbdisplaylayer_requestor_la_OBJECTS =  \
+	$(am_libidirectfbdisplaylayer_requestor_la_OBJECTS)
+libidirectfbdisplaylayer_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbdisplaylayer_requestor_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbeventbuffer_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbeventbuffer_requestor_la_OBJECTS =  \
+	idirectfbeventbuffer_requestor.lo
+libidirectfbeventbuffer_requestor_la_OBJECTS =  \
+	$(am_libidirectfbeventbuffer_requestor_la_OBJECTS)
+libidirectfbeventbuffer_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbeventbuffer_requestor_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbfont_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbfont_requestor_la_OBJECTS = idirectfbfont_requestor.lo
+libidirectfbfont_requestor_la_OBJECTS =  \
+	$(am_libidirectfbfont_requestor_la_OBJECTS)
+libidirectfbfont_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbfont_requestor_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbimageprovider_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbimageprovider_requestor_la_OBJECTS =  \
+	idirectfbimageprovider_requestor.lo
+libidirectfbimageprovider_requestor_la_OBJECTS =  \
+	$(am_libidirectfbimageprovider_requestor_la_OBJECTS)
+libidirectfbimageprovider_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbimageprovider_requestor_la_LDFLAGS) $(LDFLAGS) \
+	-o $@
+libidirectfbinputdevice_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbinputdevice_requestor_la_OBJECTS =  \
+	idirectfbinputdevice_requestor.lo
+libidirectfbinputdevice_requestor_la_OBJECTS =  \
+	$(am_libidirectfbinputdevice_requestor_la_OBJECTS)
+libidirectfbinputdevice_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbinputdevice_requestor_la_LDFLAGS) $(LDFLAGS) -o \
+	$@
+libidirectfbpalette_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbpalette_requestor_la_OBJECTS =  \
+	idirectfbpalette_requestor.lo
+libidirectfbpalette_requestor_la_OBJECTS =  \
+	$(am_libidirectfbpalette_requestor_la_OBJECTS)
+libidirectfbpalette_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbpalette_requestor_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbscreen_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbscreen_requestor_la_OBJECTS =  \
+	idirectfbscreen_requestor.lo
+libidirectfbscreen_requestor_la_OBJECTS =  \
+	$(am_libidirectfbscreen_requestor_la_OBJECTS)
+libidirectfbscreen_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbscreen_requestor_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbsurface_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbsurface_requestor_la_OBJECTS =  \
+	idirectfbsurface_requestor.lo
+libidirectfbsurface_requestor_la_OBJECTS =  \
+	$(am_libidirectfbsurface_requestor_la_OBJECTS)
+libidirectfbsurface_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbsurface_requestor_la_LDFLAGS) $(LDFLAGS) -o $@
+libidirectfbwindow_requestor_la_DEPENDENCIES = $(LIBS)
+am_libidirectfbwindow_requestor_la_OBJECTS =  \
+	idirectfbwindow_requestor.lo
+libidirectfbwindow_requestor_la_OBJECTS =  \
+	$(am_libidirectfbwindow_requestor_la_OBJECTS)
+libidirectfbwindow_requestor_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) \
+	$(libidirectfbwindow_requestor_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 = $(libidirectfb_requestor_la_SOURCES) \
+	$(libidirectfbdatabuffer_requestor_la_SOURCES) \
+	$(libidirectfbdisplaylayer_requestor_la_SOURCES) \
+	$(libidirectfbeventbuffer_requestor_la_SOURCES) \
+	$(libidirectfbfont_requestor_la_SOURCES) \
+	$(libidirectfbimageprovider_requestor_la_SOURCES) \
+	$(libidirectfbinputdevice_requestor_la_SOURCES) \
+	$(libidirectfbpalette_requestor_la_SOURCES) \
+	$(libidirectfbscreen_requestor_la_SOURCES) \
+	$(libidirectfbsurface_requestor_la_SOURCES) \
+	$(libidirectfbwindow_requestor_la_SOURCES)
+DIST_SOURCES = $(libidirectfb_requestor_la_SOURCES) \
+	$(libidirectfbdatabuffer_requestor_la_SOURCES) \
+	$(libidirectfbdisplaylayer_requestor_la_SOURCES) \
+	$(libidirectfbeventbuffer_requestor_la_SOURCES) \
+	$(libidirectfbfont_requestor_la_SOURCES) \
+	$(libidirectfbimageprovider_requestor_la_SOURCES) \
+	$(libidirectfbinputdevice_requestor_la_SOURCES) \
+	$(libidirectfbpalette_requestor_la_SOURCES) \
+	$(libidirectfbscreen_requestor_la_SOURCES) \
+	$(libidirectfbsurface_requestor_la_SOURCES) \
+	$(libidirectfbwindow_requestor_la_SOURCES)
+idirectfbDATA_INSTALL = $(INSTALL_DATA)
+idirectfbdatabufferDATA_INSTALL = $(INSTALL_DATA)
+idirectfbdisplaylayerDATA_INSTALL = $(INSTALL_DATA)
+idirectfbeventbufferDATA_INSTALL = $(INSTALL_DATA)
+idirectfbfontDATA_INSTALL = $(INSTALL_DATA)
+idirectfbimageproviderDATA_INSTALL = $(INSTALL_DATA)
+idirectfbinputdeviceDATA_INSTALL = $(INSTALL_DATA)
+idirectfbpaletteDATA_INSTALL = $(INSTALL_DATA)
+idirectfbscreenDATA_INSTALL = $(INSTALL_DATA)
+idirectfbsurfaceDATA_INSTALL = $(INSTALL_DATA)
+idirectfbwindowDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idirectfb_DATA) $(idirectfbdatabuffer_DATA) \
+	$(idirectfbdisplaylayer_DATA) $(idirectfbeventbuffer_DATA) \
+	$(idirectfbfont_DATA) $(idirectfbimageprovider_DATA) \
+	$(idirectfbinputdevice_DATA) $(idirectfbpalette_DATA) \
+	$(idirectfbscreen_DATA) $(idirectfbsurface_DATA) \
+	$(idirectfbwindow_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 = \
+	$(top_builddir)/lib/voodoo/libvoodoo.la	\
+	$(top_builddir)/lib/direct/libdirect.la
+
+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@
+INTERFACES_DIR = $(MODULEDIR)/interfaces
+idirectfbdir = $(INTERFACES_DIR)/IDirectFB
+idirectfbdatabufferdir = $(INTERFACES_DIR)/IDirectFBDataBuffer
+idirectfbdisplaylayerdir = $(INTERFACES_DIR)/IDirectFBDisplayLayer
+idirectfbeventbufferdir = $(INTERFACES_DIR)/IDirectFBEventBuffer
+idirectfbfontdir = $(INTERFACES_DIR)/IDirectFBFont
+idirectfbimageproviderdir = $(INTERFACES_DIR)/IDirectFBImageProvider
+idirectfbinputdevicedir = $(INTERFACES_DIR)/IDirectFBInputDevice
+idirectfbpalettedir = $(INTERFACES_DIR)/IDirectFBPalette
+idirectfbscreendir = $(INTERFACES_DIR)/IDirectFBScreen
+idirectfbsurfacedir = $(INTERFACES_DIR)/IDirectFBSurface
+idirectfbwindowdir = $(INTERFACES_DIR)/IDirectFBWindow
+idirectfbvideoproviderdir = $(INTERFACES_DIR)/IDirectFBVideoProvider
+INCLUDES = \
+	-I$(top_builddir)/include		\
+	-I$(top_srcdir)/include			\
+	-I$(top_srcdir)/lib				\
+	-I$(top_builddir)/lib			\
+	-I$(top_srcdir)/src 			\
+	-I$(top_srcdir)/proxy/dispatcher	\
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+idirectfb_LTLIBRARIES = \
+	libidirectfb_requestor.la
+
+idirectfbdatabuffer_LTLIBRARIES = \
+	libidirectfbdatabuffer_requestor.la
+
+idirectfbdisplaylayer_LTLIBRARIES = \
+	libidirectfbdisplaylayer_requestor.la
+
+idirectfbeventbuffer_LTLIBRARIES = \
+	libidirectfbeventbuffer_requestor.la
+
+idirectfbfont_LTLIBRARIES = \
+	libidirectfbfont_requestor.la
+
+idirectfbimageprovider_LTLIBRARIES = \
+	libidirectfbimageprovider_requestor.la
+
+idirectfbinputdevice_LTLIBRARIES = \
+	libidirectfbinputdevice_requestor.la
+
+idirectfbpalette_LTLIBRARIES = \
+	libidirectfbpalette_requestor.la
+
+idirectfbscreen_LTLIBRARIES = \
+	libidirectfbscreen_requestor.la
+
+idirectfbsurface_LTLIBRARIES = \
+	libidirectfbsurface_requestor.la
+
+idirectfbwindow_LTLIBRARIES = \
+	libidirectfbwindow_requestor.la
+
+@BUILD_STATIC_TRUE@idirectfb_DATA = libidirectfb_requestor.o
+@BUILD_STATIC_TRUE@idirectfbdatabuffer_DATA = libidirectfbdatabuffer_requestor.o
+@BUILD_STATIC_TRUE@idirectfbdisplaylayer_DATA = libidirectfbdisplaylayer_requestor.o
+@BUILD_STATIC_TRUE@idirectfbeventbuffer_DATA = libidirectfbeventbuffer_requestor.o
+@BUILD_STATIC_TRUE@idirectfbfont_DATA = libidirectfbfont_requestor.o
+@BUILD_STATIC_TRUE@idirectfbimageprovider_DATA = libidirectfbimageprovider_requestor.o
+@BUILD_STATIC_TRUE@idirectfbinputdevice_DATA = libidirectfbinputdevice_requestor.o
+@BUILD_STATIC_TRUE@idirectfbpalette_DATA = libidirectfbpalette_requestor.o
+@BUILD_STATIC_TRUE@idirectfbscreen_DATA = libidirectfbscreen_requestor.o
+@BUILD_STATIC_TRUE@idirectfbsurface_DATA = libidirectfbsurface_requestor.o
+@BUILD_STATIC_TRUE@idirectfbwindow_DATA = libidirectfbwindow_requestor.o
+libidirectfb_requestor_la_SOURCES = idirectfb_requestor.c
+libidirectfb_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfb_requestor_la_LIBADD = $(LIBS)
+libidirectfbdatabuffer_requestor_la_SOURCES = idirectfbdatabuffer_requestor.c
+libidirectfbdatabuffer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbdatabuffer_requestor_la_LIBADD = $(LIBS)
+libidirectfbdisplaylayer_requestor_la_SOURCES = idirectfbdisplaylayer_requestor.c idirectfbdisplaylayer_requestor.h
+libidirectfbdisplaylayer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbdisplaylayer_requestor_la_LIBADD = $(LIBS)
+libidirectfbeventbuffer_requestor_la_SOURCES = idirectfbeventbuffer_requestor.c idirectfbeventbuffer_requestor.h
+libidirectfbeventbuffer_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbeventbuffer_requestor_la_LIBADD = $(LIBS)
+libidirectfbfont_requestor_la_SOURCES = idirectfbfont_requestor.c idirectfbfont_requestor.h
+libidirectfbfont_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbfont_requestor_la_LIBADD = $(LIBS)
+libidirectfbimageprovider_requestor_la_SOURCES = idirectfbimageprovider_requestor.c
+libidirectfbimageprovider_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbimageprovider_requestor_la_LIBADD = $(LIBS)
+libidirectfbinputdevice_requestor_la_SOURCES = idirectfbinputdevice_requestor.c idirectfbinputdevice_requestor.h
+libidirectfbinputdevice_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbinputdevice_requestor_la_LIBADD = $(LIBS)
+libidirectfbpalette_requestor_la_SOURCES = idirectfbpalette_requestor.c idirectfbpalette_requestor.h
+libidirectfbpalette_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbpalette_requestor_la_LIBADD = $(LIBS)
+libidirectfbscreen_requestor_la_SOURCES = idirectfbscreen_requestor.c
+libidirectfbscreen_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbscreen_requestor_la_LIBADD = $(LIBS)
+libidirectfbsurface_requestor_la_SOURCES = idirectfbsurface_requestor.c idirectfbsurface_requestor.h
+libidirectfbsurface_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbsurface_requestor_la_LIBADD = $(LIBS)
+libidirectfbwindow_requestor_la_SOURCES = idirectfbwindow_requestor.c idirectfbwindow_requestor.h
+libidirectfbwindow_requestor_la_LDFLAGS = -avoid-version -module
+libidirectfbwindow_requestor_la_LIBADD = $(LIBS)
+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  proxy/requestor/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  proxy/requestor/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-idirectfbLTLIBRARIES: $(idirectfb_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdir)"
+	@list='$(idirectfb_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfb_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdir)/$$p"; \
+	done
+
+clean-idirectfbLTLIBRARIES:
+	-test -z "$(idirectfb_LTLIBRARIES)" || rm -f $(idirectfb_LTLIBRARIES)
+	@list='$(idirectfb_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
+install-idirectfbdatabufferLTLIBRARIES: $(idirectfbdatabuffer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdatabufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdatabufferdir)"
+	@list='$(idirectfbdatabuffer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdatabufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdatabufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbdatabufferLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdatabuffer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdatabufferdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdatabufferdir)/$$p"; \
+	done
+
+clean-idirectfbdatabufferLTLIBRARIES:
+	-test -z "$(idirectfbdatabuffer_LTLIBRARIES)" || rm -f $(idirectfbdatabuffer_LTLIBRARIES)
+	@list='$(idirectfbdatabuffer_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
+install-idirectfbdisplaylayerLTLIBRARIES: $(idirectfbdisplaylayer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdisplaylayerdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdisplaylayerdir)"
+	@list='$(idirectfbdisplaylayer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdisplaylayerLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbdisplaylayerLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbdisplaylayerLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdisplaylayer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$p"; \
+	done
+
+clean-idirectfbdisplaylayerLTLIBRARIES:
+	-test -z "$(idirectfbdisplaylayer_LTLIBRARIES)" || rm -f $(idirectfbdisplaylayer_LTLIBRARIES)
+	@list='$(idirectfbdisplaylayer_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
+install-idirectfbeventbufferLTLIBRARIES: $(idirectfbeventbuffer_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbeventbufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbeventbufferdir)"
+	@list='$(idirectfbeventbuffer_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbeventbufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbeventbufferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbeventbufferLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbeventbuffer_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbeventbufferdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbeventbufferdir)/$$p"; \
+	done
+
+clean-idirectfbeventbufferLTLIBRARIES:
+	-test -z "$(idirectfbeventbuffer_LTLIBRARIES)" || rm -f $(idirectfbeventbuffer_LTLIBRARIES)
+	@list='$(idirectfbeventbuffer_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
+install-idirectfbfontLTLIBRARIES: $(idirectfbfont_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbfontLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbfontLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbfontdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbfontdir)/$$p"; \
+	done
+
+clean-idirectfbfontLTLIBRARIES:
+	-test -z "$(idirectfbfont_LTLIBRARIES)" || rm -f $(idirectfbfont_LTLIBRARIES)
+	@list='$(idirectfbfont_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
+install-idirectfbimageproviderLTLIBRARIES: $(idirectfbimageprovider_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbimageproviderLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbimageproviderLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$p"; \
+	done
+
+clean-idirectfbimageproviderLTLIBRARIES:
+	-test -z "$(idirectfbimageprovider_LTLIBRARIES)" || rm -f $(idirectfbimageprovider_LTLIBRARIES)
+	@list='$(idirectfbimageprovider_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
+install-idirectfbinputdeviceLTLIBRARIES: $(idirectfbinputdevice_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbinputdevicedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbinputdevicedir)"
+	@list='$(idirectfbinputdevice_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbinputdeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbinputdeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbinputdeviceLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbinputdevice_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbinputdevicedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbinputdevicedir)/$$p"; \
+	done
+
+clean-idirectfbinputdeviceLTLIBRARIES:
+	-test -z "$(idirectfbinputdevice_LTLIBRARIES)" || rm -f $(idirectfbinputdevice_LTLIBRARIES)
+	@list='$(idirectfbinputdevice_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
+install-idirectfbpaletteLTLIBRARIES: $(idirectfbpalette_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbpalettedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbpalettedir)"
+	@list='$(idirectfbpalette_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbpaletteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbpaletteLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbpaletteLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbpalette_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbpalettedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbpalettedir)/$$p"; \
+	done
+
+clean-idirectfbpaletteLTLIBRARIES:
+	-test -z "$(idirectfbpalette_LTLIBRARIES)" || rm -f $(idirectfbpalette_LTLIBRARIES)
+	@list='$(idirectfbpalette_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
+install-idirectfbscreenLTLIBRARIES: $(idirectfbscreen_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbscreendir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbscreendir)"
+	@list='$(idirectfbscreen_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbscreenLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbscreenLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbscreenLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbscreen_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbscreendir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbscreendir)/$$p"; \
+	done
+
+clean-idirectfbscreenLTLIBRARIES:
+	-test -z "$(idirectfbscreen_LTLIBRARIES)" || rm -f $(idirectfbscreen_LTLIBRARIES)
+	@list='$(idirectfbscreen_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
+install-idirectfbsurfaceLTLIBRARIES: $(idirectfbsurface_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbsurfacedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbsurfacedir)"
+	@list='$(idirectfbsurface_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbsurfaceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbsurfaceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbsurfaceLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbsurface_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbsurfacedir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbsurfacedir)/$$p"; \
+	done
+
+clean-idirectfbsurfaceLTLIBRARIES:
+	-test -z "$(idirectfbsurface_LTLIBRARIES)" || rm -f $(idirectfbsurface_LTLIBRARIES)
+	@list='$(idirectfbsurface_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
+install-idirectfbwindowLTLIBRARIES: $(idirectfbwindow_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbwindowdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbwindowdir)"
+	@list='$(idirectfbwindow_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbwindowLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(idirectfbwindowLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(idirectfbwindowdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-idirectfbwindowLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbwindow_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(idirectfbwindowdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(idirectfbwindowdir)/$$p"; \
+	done
+
+clean-idirectfbwindowLTLIBRARIES:
+	-test -z "$(idirectfbwindow_LTLIBRARIES)" || rm -f $(idirectfbwindow_LTLIBRARIES)
+	@list='$(idirectfbwindow_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
+libidirectfb_requestor.la: $(libidirectfb_requestor_la_OBJECTS) $(libidirectfb_requestor_la_DEPENDENCIES) 
+	$(libidirectfb_requestor_la_LINK) -rpath $(idirectfbdir) $(libidirectfb_requestor_la_OBJECTS) $(libidirectfb_requestor_la_LIBADD) $(LIBS)
+libidirectfbdatabuffer_requestor.la: $(libidirectfbdatabuffer_requestor_la_OBJECTS) $(libidirectfbdatabuffer_requestor_la_DEPENDENCIES) 
+	$(libidirectfbdatabuffer_requestor_la_LINK) -rpath $(idirectfbdatabufferdir) $(libidirectfbdatabuffer_requestor_la_OBJECTS) $(libidirectfbdatabuffer_requestor_la_LIBADD) $(LIBS)
+libidirectfbdisplaylayer_requestor.la: $(libidirectfbdisplaylayer_requestor_la_OBJECTS) $(libidirectfbdisplaylayer_requestor_la_DEPENDENCIES) 
+	$(libidirectfbdisplaylayer_requestor_la_LINK) -rpath $(idirectfbdisplaylayerdir) $(libidirectfbdisplaylayer_requestor_la_OBJECTS) $(libidirectfbdisplaylayer_requestor_la_LIBADD) $(LIBS)
+libidirectfbeventbuffer_requestor.la: $(libidirectfbeventbuffer_requestor_la_OBJECTS) $(libidirectfbeventbuffer_requestor_la_DEPENDENCIES) 
+	$(libidirectfbeventbuffer_requestor_la_LINK) -rpath $(idirectfbeventbufferdir) $(libidirectfbeventbuffer_requestor_la_OBJECTS) $(libidirectfbeventbuffer_requestor_la_LIBADD) $(LIBS)
+libidirectfbfont_requestor.la: $(libidirectfbfont_requestor_la_OBJECTS) $(libidirectfbfont_requestor_la_DEPENDENCIES) 
+	$(libidirectfbfont_requestor_la_LINK) -rpath $(idirectfbfontdir) $(libidirectfbfont_requestor_la_OBJECTS) $(libidirectfbfont_requestor_la_LIBADD) $(LIBS)
+libidirectfbimageprovider_requestor.la: $(libidirectfbimageprovider_requestor_la_OBJECTS) $(libidirectfbimageprovider_requestor_la_DEPENDENCIES) 
+	$(libidirectfbimageprovider_requestor_la_LINK) -rpath $(idirectfbimageproviderdir) $(libidirectfbimageprovider_requestor_la_OBJECTS) $(libidirectfbimageprovider_requestor_la_LIBADD) $(LIBS)
+libidirectfbinputdevice_requestor.la: $(libidirectfbinputdevice_requestor_la_OBJECTS) $(libidirectfbinputdevice_requestor_la_DEPENDENCIES) 
+	$(libidirectfbinputdevice_requestor_la_LINK) -rpath $(idirectfbinputdevicedir) $(libidirectfbinputdevice_requestor_la_OBJECTS) $(libidirectfbinputdevice_requestor_la_LIBADD) $(LIBS)
+libidirectfbpalette_requestor.la: $(libidirectfbpalette_requestor_la_OBJECTS) $(libidirectfbpalette_requestor_la_DEPENDENCIES) 
+	$(libidirectfbpalette_requestor_la_LINK) -rpath $(idirectfbpalettedir) $(libidirectfbpalette_requestor_la_OBJECTS) $(libidirectfbpalette_requestor_la_LIBADD) $(LIBS)
+libidirectfbscreen_requestor.la: $(libidirectfbscreen_requestor_la_OBJECTS) $(libidirectfbscreen_requestor_la_DEPENDENCIES) 
+	$(libidirectfbscreen_requestor_la_LINK) -rpath $(idirectfbscreendir) $(libidirectfbscreen_requestor_la_OBJECTS) $(libidirectfbscreen_requestor_la_LIBADD) $(LIBS)
+libidirectfbsurface_requestor.la: $(libidirectfbsurface_requestor_la_OBJECTS) $(libidirectfbsurface_requestor_la_DEPENDENCIES) 
+	$(libidirectfbsurface_requestor_la_LINK) -rpath $(idirectfbsurfacedir) $(libidirectfbsurface_requestor_la_OBJECTS) $(libidirectfbsurface_requestor_la_LIBADD) $(LIBS)
+libidirectfbwindow_requestor.la: $(libidirectfbwindow_requestor_la_OBJECTS) $(libidirectfbwindow_requestor_la_DEPENDENCIES) 
+	$(libidirectfbwindow_requestor_la_LINK) -rpath $(idirectfbwindowdir) $(libidirectfbwindow_requestor_la_OBJECTS) $(libidirectfbwindow_requestor_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfb_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdisplaylayer_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbeventbuffer_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbinputdevice_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbpalette_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbscreen_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbsurface_requestor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbwindow_requestor.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-idirectfbDATA: $(idirectfb_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdir)"
+	@list='$(idirectfb_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	  $(idirectfbDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	done
+
+uninstall-idirectfbDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfb_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdir)/$$f"; \
+	done
+install-idirectfbdatabufferDATA: $(idirectfbdatabuffer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdatabufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdatabufferdir)"
+	@list='$(idirectfbdatabuffer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbdatabufferDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	  $(idirectfbdatabufferDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	done
+
+uninstall-idirectfbdatabufferDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdatabuffer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdatabufferdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdatabufferdir)/$$f"; \
+	done
+install-idirectfbdisplaylayerDATA: $(idirectfbdisplaylayer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbdisplaylayerdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbdisplaylayerdir)"
+	@list='$(idirectfbdisplaylayer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbdisplaylayerDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	  $(idirectfbdisplaylayerDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	done
+
+uninstall-idirectfbdisplaylayerDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbdisplaylayer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbdisplaylayerdir)/$$f"; \
+	done
+install-idirectfbeventbufferDATA: $(idirectfbeventbuffer_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbeventbufferdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbeventbufferdir)"
+	@list='$(idirectfbeventbuffer_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbeventbufferDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	  $(idirectfbeventbufferDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	done
+
+uninstall-idirectfbeventbufferDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbeventbuffer_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbeventbufferdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbeventbufferdir)/$$f"; \
+	done
+install-idirectfbfontDATA: $(idirectfbfont_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbfontdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbfontdir)"
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbfontDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  $(idirectfbfontDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	done
+
+uninstall-idirectfbfontDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbfont_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbfontdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbfontdir)/$$f"; \
+	done
+install-idirectfbimageproviderDATA: $(idirectfbimageprovider_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbimageproviderdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbimageproviderdir)"
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbimageproviderDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  $(idirectfbimageproviderDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	done
+
+uninstall-idirectfbimageproviderDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbimageprovider_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbimageproviderdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbimageproviderdir)/$$f"; \
+	done
+install-idirectfbinputdeviceDATA: $(idirectfbinputdevice_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbinputdevicedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbinputdevicedir)"
+	@list='$(idirectfbinputdevice_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbinputdeviceDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	  $(idirectfbinputdeviceDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	done
+
+uninstall-idirectfbinputdeviceDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbinputdevice_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbinputdevicedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbinputdevicedir)/$$f"; \
+	done
+install-idirectfbpaletteDATA: $(idirectfbpalette_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbpalettedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbpalettedir)"
+	@list='$(idirectfbpalette_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbpaletteDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	  $(idirectfbpaletteDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	done
+
+uninstall-idirectfbpaletteDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbpalette_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbpalettedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbpalettedir)/$$f"; \
+	done
+install-idirectfbscreenDATA: $(idirectfbscreen_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbscreendir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbscreendir)"
+	@list='$(idirectfbscreen_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbscreenDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	  $(idirectfbscreenDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	done
+
+uninstall-idirectfbscreenDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbscreen_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbscreendir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbscreendir)/$$f"; \
+	done
+install-idirectfbsurfaceDATA: $(idirectfbsurface_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbsurfacedir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbsurfacedir)"
+	@list='$(idirectfbsurface_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbsurfaceDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	  $(idirectfbsurfaceDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	done
+
+uninstall-idirectfbsurfaceDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbsurface_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbsurfacedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbsurfacedir)/$$f"; \
+	done
+install-idirectfbwindowDATA: $(idirectfbwindow_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(idirectfbwindowdir)" || $(MKDIR_P) "$(DESTDIR)$(idirectfbwindowdir)"
+	@list='$(idirectfbwindow_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(idirectfbwindowDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	  $(idirectfbwindowDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idirectfbwindowdir)/$$f"; \
+	done
+
+uninstall-idirectfbwindowDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(idirectfbwindow_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(idirectfbwindowdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(idirectfbwindowdir)/$$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)$(idirectfbdir)" "$(DESTDIR)$(idirectfbdatabufferdir)" "$(DESTDIR)$(idirectfbdisplaylayerdir)" "$(DESTDIR)$(idirectfbeventbufferdir)" "$(DESTDIR)$(idirectfbfontdir)" "$(DESTDIR)$(idirectfbimageproviderdir)" "$(DESTDIR)$(idirectfbinputdevicedir)" "$(DESTDIR)$(idirectfbpalettedir)" "$(DESTDIR)$(idirectfbscreendir)" "$(DESTDIR)$(idirectfbsurfacedir)" "$(DESTDIR)$(idirectfbwindowdir)" "$(DESTDIR)$(idirectfbdir)" "$(DESTDIR)$(idirectfbdatabufferdir)" "$(DESTDIR)$(idirectfbdisplaylayerdir)" "$(DESTDIR)$(idirectfbeventbufferdir)" "$(DESTDIR)$(idirectfbfontdir)" "$(DESTDIR)$(idirectfbimageproviderdir)" "$(DESTDIR)$(idirectfbinputdevicedir)" "$(DESTDIR)$(idirectfbpalettedir)" "$(DESTDIR)$(idirectfbscreendir)" "$(DESTDIR)$(idirectfbsurfacedir)" "$(DESTDIR)$(idirectfbwindowdir)"; 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-idirectfbLTLIBRARIES \
+	clean-idirectfbdatabufferLTLIBRARIES \
+	clean-idirectfbdisplaylayerLTLIBRARIES \
+	clean-idirectfbeventbufferLTLIBRARIES \
+	clean-idirectfbfontLTLIBRARIES \
+	clean-idirectfbimageproviderLTLIBRARIES \
+	clean-idirectfbinputdeviceLTLIBRARIES \
+	clean-idirectfbpaletteLTLIBRARIES \
+	clean-idirectfbscreenLTLIBRARIES \
+	clean-idirectfbsurfaceLTLIBRARIES \
+	clean-idirectfbwindowLTLIBRARIES 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-idirectfbDATA install-idirectfbLTLIBRARIES \
+	install-idirectfbdatabufferDATA \
+	install-idirectfbdatabufferLTLIBRARIES \
+	install-idirectfbdisplaylayerDATA \
+	install-idirectfbdisplaylayerLTLIBRARIES \
+	install-idirectfbeventbufferDATA \
+	install-idirectfbeventbufferLTLIBRARIES \
+	install-idirectfbfontDATA install-idirectfbfontLTLIBRARIES \
+	install-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES \
+	install-idirectfbinputdeviceDATA \
+	install-idirectfbinputdeviceLTLIBRARIES \
+	install-idirectfbpaletteDATA \
+	install-idirectfbpaletteLTLIBRARIES \
+	install-idirectfbscreenDATA install-idirectfbscreenLTLIBRARIES \
+	install-idirectfbsurfaceDATA \
+	install-idirectfbsurfaceLTLIBRARIES \
+	install-idirectfbwindowDATA install-idirectfbwindowLTLIBRARIES
+
+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-idirectfbDATA uninstall-idirectfbLTLIBRARIES \
+	uninstall-idirectfbdatabufferDATA \
+	uninstall-idirectfbdatabufferLTLIBRARIES \
+	uninstall-idirectfbdisplaylayerDATA \
+	uninstall-idirectfbdisplaylayerLTLIBRARIES \
+	uninstall-idirectfbeventbufferDATA \
+	uninstall-idirectfbeventbufferLTLIBRARIES \
+	uninstall-idirectfbfontDATA uninstall-idirectfbfontLTLIBRARIES \
+	uninstall-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES \
+	uninstall-idirectfbinputdeviceDATA \
+	uninstall-idirectfbinputdeviceLTLIBRARIES \
+	uninstall-idirectfbpaletteDATA \
+	uninstall-idirectfbpaletteLTLIBRARIES \
+	uninstall-idirectfbscreenDATA \
+	uninstall-idirectfbscreenLTLIBRARIES \
+	uninstall-idirectfbsurfaceDATA \
+	uninstall-idirectfbsurfaceLTLIBRARIES \
+	uninstall-idirectfbwindowDATA \
+	uninstall-idirectfbwindowLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-idirectfbLTLIBRARIES \
+	clean-idirectfbdatabufferLTLIBRARIES \
+	clean-idirectfbdisplaylayerLTLIBRARIES \
+	clean-idirectfbeventbufferLTLIBRARIES \
+	clean-idirectfbfontLTLIBRARIES \
+	clean-idirectfbimageproviderLTLIBRARIES \
+	clean-idirectfbinputdeviceLTLIBRARIES \
+	clean-idirectfbpaletteLTLIBRARIES \
+	clean-idirectfbscreenLTLIBRARIES \
+	clean-idirectfbsurfaceLTLIBRARIES \
+	clean-idirectfbwindowLTLIBRARIES 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-idirectfbDATA \
+	install-idirectfbLTLIBRARIES install-idirectfbdatabufferDATA \
+	install-idirectfbdatabufferLTLIBRARIES \
+	install-idirectfbdisplaylayerDATA \
+	install-idirectfbdisplaylayerLTLIBRARIES \
+	install-idirectfbeventbufferDATA \
+	install-idirectfbeventbufferLTLIBRARIES \
+	install-idirectfbfontDATA install-idirectfbfontLTLIBRARIES \
+	install-idirectfbimageproviderDATA \
+	install-idirectfbimageproviderLTLIBRARIES \
+	install-idirectfbinputdeviceDATA \
+	install-idirectfbinputdeviceLTLIBRARIES \
+	install-idirectfbpaletteDATA \
+	install-idirectfbpaletteLTLIBRARIES \
+	install-idirectfbscreenDATA install-idirectfbscreenLTLIBRARIES \
+	install-idirectfbsurfaceDATA \
+	install-idirectfbsurfaceLTLIBRARIES \
+	install-idirectfbwindowDATA install-idirectfbwindowLTLIBRARIES \
+	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-idirectfbDATA \
+	uninstall-idirectfbLTLIBRARIES \
+	uninstall-idirectfbdatabufferDATA \
+	uninstall-idirectfbdatabufferLTLIBRARIES \
+	uninstall-idirectfbdisplaylayerDATA \
+	uninstall-idirectfbdisplaylayerLTLIBRARIES \
+	uninstall-idirectfbeventbufferDATA \
+	uninstall-idirectfbeventbufferLTLIBRARIES \
+	uninstall-idirectfbfontDATA uninstall-idirectfbfontLTLIBRARIES \
+	uninstall-idirectfbimageproviderDATA \
+	uninstall-idirectfbimageproviderLTLIBRARIES \
+	uninstall-idirectfbinputdeviceDATA \
+	uninstall-idirectfbinputdeviceLTLIBRARIES \
+	uninstall-idirectfbpaletteDATA \
+	uninstall-idirectfbpaletteLTLIBRARIES \
+	uninstall-idirectfbscreenDATA \
+	uninstall-idirectfbscreenLTLIBRARIES \
+	uninstall-idirectfbsurfaceDATA \
+	uninstall-idirectfbsurfaceLTLIBRARIES \
+	uninstall-idirectfbwindowDATA \
+	uninstall-idirectfbwindowLTLIBRARIES
+
+%.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/proxy/requestor/idirectfb_requestor.c b/Source/DirectFB/proxy/requestor/idirectfb_requestor.c
new file mode 100755
index 0000000..5e0796c
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfb_requestor.c
@@ -0,0 +1,1045 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <misc/conf.h>
+
+#include <input/idirectfbinputbuffer.h>
+#include <media/idirectfbdatabuffer.h>
+
+#include <idirectfb.h>
+#include <idirectfb_dispatcher.h>
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFB *thiz, const char *host, int session );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFB, Requestor )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFB_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooClient        *client;
+     VoodooManager       *manager;
+
+     VoodooInstanceID     instance;
+
+     DFBCooperativeLevel  level;    /* current cooperative level */
+} IDirectFB_Requestor_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFB_Requestor_Destruct( IDirectFB *thiz )
+{
+     IDirectFB_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFB_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     voodoo_client_destroy( data->client );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFB_Requestor_AddRef( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFB_Requestor_Release( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFB_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_Requestor_SetCooperativeLevel( IDirectFB           *thiz,
+                                         DFBCooperativeLevel  level )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (level == data->level)
+          return DFB_OK;
+
+     switch (level) {
+          case DFSCL_NORMAL:
+               break;
+
+          case DFSCL_FULLSCREEN:
+          case DFSCL_EXCLUSIVE:
+               if (dfb_config->force_windowed || dfb_config->force_desktop)
+                    return DFB_ACCESSDENIED;
+
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_SetCooperativeLevel, VREQ_RESPOND, &response,
+                                   VMBT_INT, level,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          data->level = level;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetDeviceDescription( IDirectFB                    *thiz,
+                                          DFBGraphicsDeviceDescription *ret_desc )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_GetDeviceDescription, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_READ_DATA( parser, ret_desc, sizeof(DFBGraphicsDeviceDescription) );
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_EnumVideoModes( IDirectFB            *thiz,
+                                    DFBVideoModeCallback  callbackfunc,
+                                    void                 *callbackdata )
+{
+     DirectResult                              ret;
+     VoodooResponseMessage                    *response;
+     VoodooMessageParser                       parser;
+     int                                       i, num;
+     IDirectFB_Dispatcher_EnumVideoModes_Item *items;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_EnumVideoModes, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, num );
+
+     items = D_MALLOC( sizeof(*items) * num );
+     if (items)
+          VOODOO_PARSER_READ_DATA( parser, items, sizeof(*items) * num );
+     else
+          ret = D_OOM();
+
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (items) {
+          for (i=0; i<num; i++) {
+               if (callbackfunc( items[i].width, items[i].height, items[i].bpp, callbackdata ) == DFENUM_CANCEL)
+                    break;
+          }
+
+          D_FREE( items );
+     }
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_SetVideoMode( IDirectFB    *thiz,
+                                  int           width,
+                                  int           height,
+                                  int           bpp )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (width < 1 || height < 1 || bpp < 1)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_SetVideoMode, VREQ_RESPOND, &response,
+                                   VMBT_INT, width,
+                                   VMBT_INT, height,
+                                   VMBT_INT, bpp,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateSurface( IDirectFB                    *thiz,
+                                   const DFBSurfaceDescription  *real_desc,
+                                   IDirectFBSurface            **ret_interface )
+{
+     DirectResult            ret;
+     VoodooResponseMessage  *response;
+     VoodooInstanceID        instance_id;
+     DFBSurfaceDescription   desc;
+     DFBSurfaceCapabilities  caps          = DSCAPS_NONE;
+     void                   *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!real_desc || !ret_interface)
+          return DFB_INVARG;
+
+     direct_memcpy( &desc, real_desc, sizeof(DFBSurfaceDescription) );
+
+     if (desc.flags & (DSDESC_PALETTE | DSDESC_PREALLOCATED))
+          D_ONCE( "DSDESC_PALETTE and DSDESC_PREALLOCATED not supported yet" );
+
+     if (desc.flags & DSDESC_CAPS)
+          caps = desc.caps;
+
+     if (caps & DSCAPS_PRIMARY) {
+          if (!(desc.flags & DSDESC_WIDTH) && dfb_config->mode.width) {
+               desc.flags |= DSDESC_WIDTH;
+               desc.width  = dfb_config->mode.width;
+          }
+
+          if (!(desc.flags & DSDESC_HEIGHT) && dfb_config->mode.height) {
+               desc.flags  |= DSDESC_HEIGHT;
+               desc.height  = dfb_config->mode.height;
+          }
+     }
+
+     if (!(desc.flags & DSDESC_PIXELFORMAT) && dfb_config->mode.format != DSPF_UNKNOWN) {
+          desc.flags       |= DSDESC_PIXELFORMAT;
+          desc.pixelformat  = dfb_config->mode.format;
+     }
+
+     if (!(desc.flags & DSDESC_RESOURCE_ID)) {
+          desc.flags       |= DSDESC_RESOURCE_ID;
+          desc.resource_id  = 1100;
+     }
+
+     D_INFO( "IDirectFB_Requestor_CreateSurface: Using resource ID %lu\n", desc.resource_id );
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_CreateSurface, VREQ_RESPOND, &response,
+                                   VMBT_DFBSurfaceDescription( desc ),
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     /* Copy and finish as we do our next request in surface constructor already! */
+     instance_id = response->instance;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBSurface",
+                                            instance_id, thiz, &interface_ptr );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreatePalette( IDirectFB                    *thiz,
+                                   const DFBPaletteDescription  *desc,
+                                   IDirectFBPalette            **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_EnumScreens( IDirectFB         *thiz,
+                                 DFBScreenCallback  callbackfunc,
+                                 void              *callbackdata )
+{
+     DirectResult                           ret;
+     VoodooResponseMessage                 *response;
+     VoodooMessageParser                    parser;
+     int                                    i, num;
+     IDirectFB_Dispatcher_EnumScreens_Item *items;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_EnumScreens, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, num );
+
+     items = D_MALLOC( sizeof(*items) * num );
+     if (items)
+          VOODOO_PARSER_READ_DATA( parser, items, sizeof(*items) * num );
+     else
+          ret = D_OOM();
+
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (items) {
+          for (i=0; i<num; i++) {
+               if (callbackfunc( items[i].screen_id, items[i].desc, callbackdata ) == DFENUM_CANCEL)
+                    break;
+          }
+
+          D_FREE( items );
+     }
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetScreen( IDirectFB        *thiz,
+                               DFBScreenID       id,
+                               IDirectFBScreen **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_GetScreen, VREQ_RESPOND, &response,
+                                   VMBT_ID, id,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBScreen",
+                                            response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_EnumDisplayLayers( IDirectFB               *thiz,
+                                       DFBDisplayLayerCallback  callbackfunc,
+                                       void                    *callbackdata )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetDisplayLayer( IDirectFB              *thiz,
+                                     DFBDisplayLayerID       id,
+                                     IDirectFBDisplayLayer **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_GetDisplayLayer, VREQ_RESPOND, &response,
+                                   VMBT_ID, id,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBDisplayLayer",
+                                            response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_EnumInputDevices( IDirectFB              *thiz,
+                                      DFBInputDeviceCallback  callbackfunc,
+                                      void                   *callbackdata )
+{
+     DirectResult                                ret;
+     VoodooResponseMessage                      *response;
+     VoodooMessageParser                         parser;
+     int                                         i, num;
+     IDirectFB_Dispatcher_EnumInputDevices_Item *items;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_EnumInputDevices, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     if (response->result) {
+          voodoo_manager_finish_request( data->manager, response );
+          return response->result;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, num );
+
+     items = D_MALLOC( sizeof(*items) * num );
+     if (items)
+          VOODOO_PARSER_READ_DATA( parser, items, sizeof(*items) * num );
+     else
+          ret = D_OOM();
+
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (items) {
+          for (i=0; i<num; i++) {
+               if (callbackfunc( items[i].device_id, items[i].desc, callbackdata ) == DFENUM_CANCEL)
+                    break;
+          }
+
+          D_FREE( items );
+     }
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetInputDevice( IDirectFB             *thiz,
+                                    DFBInputDeviceID       id,
+                                    IDirectFBInputDevice **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_GetInputDevice, VREQ_RESPOND, &response,
+                                   VMBT_ID, id,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBInputDevice",
+                                            response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateEventBuffer( IDirectFB             *thiz,
+                                       IDirectFBEventBuffer **ret_interface)
+{
+     DFBResult             ret;
+     IDirectFBEventBuffer *buffer;
+     IDirectFBEventBuffer *dispatcher;
+     VoodooInstanceID      instance;
+     void                 *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     /* Create the real interface. */
+     DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( buffer, NULL, NULL );
+
+     /* Create the dispatcher. */
+     ret = voodoo_construct_dispatcher( data->manager, "IDirectFBEventBuffer", buffer,
+                                        data->instance, NULL, &instance, &ptr );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     dispatcher = ptr;
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_CreateEventBuffer, VREQ_NONE, NULL,
+                                   VMBT_ID,  instance,
+                                   VMBT_NONE );
+     if (ret) {
+          dispatcher->Release( dispatcher );
+          return ret;
+     }
+
+     /* Return the dispatcher interface. */
+     *ret_interface = dispatcher;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateInputEventBuffer( IDirectFB                   *thiz,
+                                            DFBInputDeviceCapabilities   caps,
+                                            DFBBoolean                   global,
+                                            IDirectFBEventBuffer       **ret_interface)
+{
+     DFBResult             ret;
+     IDirectFBEventBuffer *buffer;
+     IDirectFBEventBuffer *dispatcher;
+     VoodooInstanceID      instance;
+     void                 *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     /* Create the real interface. */
+     DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( buffer, NULL, NULL );
+
+     /* Create the dispatcher. */
+     ret = voodoo_construct_dispatcher( data->manager, "IDirectFBEventBuffer", buffer,
+                                        data->instance, NULL, &instance, &ptr );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     dispatcher = ptr;
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_CreateInputEventBuffer, VREQ_NONE, NULL,
+                                   VMBT_ID,  instance,
+                                   VMBT_INT, caps,
+                                   VMBT_INT, global,
+                                   VMBT_NONE );
+     if (ret) {
+          dispatcher->Release( dispatcher );
+          return ret;
+     }
+
+     /* Return the dispatcher interface. */
+     *ret_interface = dispatcher;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateImageProvider( IDirectFB               *thiz,
+                                         const char              *filename,
+                                         IDirectFBImageProvider **ret_interface )
+{
+     DFBResult                 ret;
+     DFBDataBufferDescription  desc;
+     IDirectFBDataBuffer      *buffer;
+     IDirectFBImageProvider   *provider;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     /* Check arguments */
+     if (!filename || !ret_interface)
+          return DFB_INVARG;
+
+     /* Create a data buffer. */
+     desc.flags = DBDESC_FILE;
+     desc.file  = filename;
+
+     ret = thiz->CreateDataBuffer( thiz, &desc, &buffer );
+     if (ret)
+          return ret;
+
+     /* Create (probing) the image provider. */
+     ret = buffer->CreateImageProvider( buffer, &provider );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     /* We don't need it anymore, image provider has its own reference. */
+     buffer->Release( buffer );
+
+     /* Return the new provider. */
+     *ret_interface = provider;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateVideoProvider( IDirectFB               *thiz,
+                                         const char              *filename,
+                                         IDirectFBVideoProvider **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     /* Check arguments */
+     if (!interface_ptr || !filename)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateFont( IDirectFB                 *thiz,
+                                const char                *filename,
+                                const DFBFontDescription  *desc,
+                                IDirectFBFont            **ret_interface )
+{
+     DFBResult                 ret;
+     DFBDataBufferDescription  bdesc;
+     IDirectFBDataBuffer      *buffer;
+     IDirectFBFont            *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     /* Check arguments */
+     if (!filename || !ret_interface)
+          return DFB_INVARG;
+
+     /* Create a data buffer. */
+     bdesc.flags = DBDESC_FILE;
+     bdesc.file  = filename;
+
+     ret = thiz->CreateDataBuffer( thiz, &bdesc, &buffer );
+     if (ret)
+          return ret;
+
+     /* Create (probing) the font. */
+     ret = buffer->CreateFont( buffer, desc, &font );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     /* We don't need it anymore, font has its own reference. */
+     buffer->Release( buffer );
+
+     /* Return the new font. */
+     *ret_interface = font;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_CreateDataBuffer( IDirectFB                       *thiz,
+                                      const DFBDataBufferDescription  *desc,
+                                      IDirectFBDataBuffer            **ret_interface )
+{
+     DFBResult            ret;
+     IDirectFBDataBuffer *buffer;
+     IDirectFBDataBuffer *dispatcher;
+     VoodooInstanceID     instance;
+     void                *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     /* Create the real interface. */
+     if (!desc) {
+          DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_Streamed_Construct( buffer, NULL );
+     }
+     else if (desc->flags & DBDESC_FILE) {
+          if (!desc->file)
+               return DFB_INVARG;
+
+          DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_File_Construct( buffer, desc->file, NULL );
+     }
+     else if (desc->flags & DBDESC_MEMORY) {
+          if (!desc->memory.data || !desc->memory.length)
+               return DFB_INVARG;
+
+          DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_Memory_Construct( buffer,
+                                                      desc->memory.data,
+                                                      desc->memory.length,
+                                                      NULL );
+     }
+     else
+          return DFB_INVARG;
+
+     if (ret)
+          return ret;
+
+     /* Create the dispatcher. */
+     ret = voodoo_construct_dispatcher( data->manager, "IDirectFBDataBuffer",
+                                        buffer, data->instance, thiz, &instance, &ptr );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     dispatcher = ptr;
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_CreateDataBuffer, VREQ_NONE, NULL,
+                                   VMBT_ID, instance,
+                                   VMBT_NONE );
+     if (ret) {
+          dispatcher->Release( dispatcher );
+          return ret;
+     }
+
+     /* Return the dispatcher(!) interface. */
+     *ret_interface = dispatcher;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_Requestor_SetClipboardData( IDirectFB      *thiz,
+                                      const char     *mime_type,
+                                      const void     *data,
+                                      unsigned int    size,
+                                      struct timeval *timestamp )
+{
+     if (!mime_type || !data || !size)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetClipboardData( IDirectFB     *thiz,
+                                      char         **mime_type,
+                                      void         **clip_data,
+                                      unsigned int  *size )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!mime_type && !clip_data && !size)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetClipboardTimeStamp( IDirectFB      *thiz,
+                                           struct timeval *timestamp )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!timestamp)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_Suspend( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_Resume( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_WaitIdle( IDirectFB *thiz )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_WaitIdle, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_Requestor_WaitForSync( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFB_Requestor_GetInterface( IDirectFB   *thiz,
+                                  const char  *type,
+                                  const char  *implementation,
+                                  void        *arg,
+                                  void       **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB_Requestor)
+
+     if (!type || !ret_interface)
+          return DFB_INVARG;
+
+     if (implementation || arg)
+          return DFB_UNSUPPORTED;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFB_METHOD_ID_GetInterface, VREQ_RESPOND, &response,
+                                   VMBT_STRING, type,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, type, response->instance, thiz, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DFBResult
+Construct( IDirectFB *thiz, const char *host, int port )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFB_Requestor)
+
+     data->ref   = 1;
+     data->level = DFSCL_NORMAL;
+
+     ret = voodoo_client_create( host, port, &data->client );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     data->manager = voodoo_client_manager( data->client );
+
+     ret = voodoo_manager_super( data->manager, "IDirectFB", &data->instance );
+     if (ret) {
+          voodoo_client_destroy( data->client );
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     thiz->AddRef                  = IDirectFB_Requestor_AddRef;
+     thiz->Release                 = IDirectFB_Requestor_Release;
+     thiz->SetCooperativeLevel     = IDirectFB_Requestor_SetCooperativeLevel;
+     thiz->GetDeviceDescription    = IDirectFB_Requestor_GetDeviceDescription;
+     thiz->EnumVideoModes          = IDirectFB_Requestor_EnumVideoModes;
+     thiz->SetVideoMode            = IDirectFB_Requestor_SetVideoMode;
+     thiz->CreateSurface           = IDirectFB_Requestor_CreateSurface;
+     thiz->CreatePalette           = IDirectFB_Requestor_CreatePalette;
+     thiz->EnumScreens             = IDirectFB_Requestor_EnumScreens;
+     thiz->GetScreen               = IDirectFB_Requestor_GetScreen;
+     thiz->EnumDisplayLayers       = IDirectFB_Requestor_EnumDisplayLayers;
+     thiz->GetDisplayLayer         = IDirectFB_Requestor_GetDisplayLayer;
+     thiz->EnumInputDevices        = IDirectFB_Requestor_EnumInputDevices;
+     thiz->GetInputDevice          = IDirectFB_Requestor_GetInputDevice;
+     thiz->CreateEventBuffer       = IDirectFB_Requestor_CreateEventBuffer;
+     thiz->CreateInputEventBuffer  = IDirectFB_Requestor_CreateInputEventBuffer;
+     thiz->CreateImageProvider     = IDirectFB_Requestor_CreateImageProvider;
+     thiz->CreateVideoProvider     = IDirectFB_Requestor_CreateVideoProvider;
+     thiz->CreateFont              = IDirectFB_Requestor_CreateFont;
+     thiz->CreateDataBuffer        = IDirectFB_Requestor_CreateDataBuffer;
+     thiz->SetClipboardData        = IDirectFB_Requestor_SetClipboardData;
+     thiz->GetClipboardData        = IDirectFB_Requestor_GetClipboardData;
+     thiz->GetClipboardTimeStamp   = IDirectFB_Requestor_GetClipboardTimeStamp;
+     thiz->Suspend                 = IDirectFB_Requestor_Suspend;
+     thiz->Resume                  = IDirectFB_Requestor_Resume;
+     thiz->WaitIdle                = IDirectFB_Requestor_WaitIdle;
+     thiz->WaitForSync             = IDirectFB_Requestor_WaitForSync;
+     thiz->GetInterface            = IDirectFB_Requestor_GetInterface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbdatabuffer_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbdatabuffer_requestor.c
new file mode 100755
index 0000000..eebe877
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbdatabuffer_requestor.c
@@ -0,0 +1,484 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <media/idirectfbdatabuffer.h>
+
+#include <idirectfb.h>
+
+#include <idirectfbdatabuffer_dispatcher.h>
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBDataBuffer *thiz,
+                            VoodooManager       *manager,
+                            VoodooInstanceID     instance,
+                            void                *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBDataBuffer, Requestor )
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBDataBuffer_Requestor
+ */
+typedef struct {
+     IDirectFBDataBuffer_data  base;
+
+     VoodooManager            *manager;
+     VoodooInstanceID          instance;
+} IDirectFBDataBuffer_Requestor_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBDataBuffer_Requestor_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBDATABUFFER_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     IDirectFBDataBuffer_Destruct( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBDataBuffer_Requestor_AddRef( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     data->base.ref++;
+
+     return DR_OK;
+}
+
+static DirectResult
+IDirectFBDataBuffer_Requestor_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (--data->base.ref == 0)
+          IDirectFBDataBuffer_Requestor_Destruct( thiz );
+
+     return DR_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_Flush( IDirectFBDataBuffer *thiz )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_Flush, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_Finish( IDirectFBDataBuffer *thiz )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_Finish, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_SeekTo( IDirectFBDataBuffer *thiz,
+                                      unsigned int         offset )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_SeekTo, VREQ_RESPOND, &response,
+                                   VMBT_UINT, offset,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_GetPosition( IDirectFBDataBuffer *thiz,
+                                           unsigned int        *ret_offset )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     unsigned int           offset;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (!ret_offset)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_GetPosition, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, offset );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_offset = offset;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_GetLength( IDirectFBDataBuffer *thiz,
+                                         unsigned int        *ret_length )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     unsigned int           length;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (!ret_length)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_GetLength, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, length );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_length = length;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_WaitForData( IDirectFBDataBuffer *thiz,
+                                           unsigned int         length )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_WaitForData, VREQ_RESPOND, &response,
+                                   VMBT_UINT, length,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                                      unsigned int         length,
+                                                      unsigned int         seconds,
+                                                      unsigned int         milli_seconds )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_WaitForDataWithTimeout, VREQ_RESPOND, &response,
+                                   VMBT_UINT, length,
+                                   VMBT_UINT, seconds,
+                                   VMBT_UINT, milli_seconds,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_GetData( IDirectFBDataBuffer *thiz,
+                                       unsigned int         length,
+                                       void                *dest,
+                                       unsigned int        *ret_read )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     unsigned int           read;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (!length || !dest)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_GetData, VREQ_RESPOND, &response,
+                                   VMBT_UINT, length,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, read );
+     VOODOO_PARSER_READ_DATA( parser, dest, length );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (ret_read)
+          *ret_read = read;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_PeekData( IDirectFBDataBuffer *thiz,
+                                        unsigned int         length,
+                                        int                  offset,
+                                        void                *dest,
+                                        unsigned int        *ret_read )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     unsigned int           read;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (!length || !dest)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_PeekData, VREQ_RESPOND, &response,
+                                   VMBT_UINT, length,
+                                   VMBT_INT, offset,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, read );
+     VOODOO_PARSER_READ_DATA( parser, dest, length );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (ret_read)
+          *ret_read = read;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_HasData( IDirectFBDataBuffer *thiz )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_HasData, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Requestor_PutData( IDirectFBDataBuffer *thiz,
+                                       const void          *source,
+                                       unsigned int         length )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Requestor)
+
+     if (!source || !length)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDATABUFFER_METHOD_ID_PutData, VREQ_RESPOND, &response,
+                                   VMBT_UINT, length,
+                                   VMBT_DATA, length, source,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBDataBuffer *thiz,
+           VoodooManager       *manager,
+           VoodooInstanceID     instance,
+           void                *arg )
+{
+     DFBResult       ret;
+     IDirectFB      *idirectfb = arg;
+     IDirectFB_data *idirectfb_data;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( idirectfb, idirectfb_data, IDirectFB );
+
+     DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IDirectFBDataBuffer_Requestor );
+
+     ret = IDirectFBDataBuffer_Construct( thiz, NULL, idirectfb_data->core );
+     if (ret)
+          return ret;
+
+     data->manager  = manager;
+     data->instance = instance;
+
+     data->base.filename = "";
+
+     thiz->AddRef                 = IDirectFBDataBuffer_Requestor_AddRef;
+     thiz->Release                = IDirectFBDataBuffer_Requestor_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_Requestor_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_Requestor_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_Requestor_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_Requestor_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_Requestor_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_Requestor_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_Requestor_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_Requestor_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_Requestor_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_Requestor_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_Requestor_PutData;
+     
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.c
new file mode 100755
index 0000000..4867f06
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.c
@@ -0,0 +1,721 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbdisplaylayer_dispatcher.h>
+
+#include "idirectfbdisplaylayer_requestor.h"
+#include "idirectfbsurface_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBDisplayLayer *thiz,
+                            VoodooManager         *manager,
+                            VoodooInstanceID       instance,
+                            void                  *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBDisplayLayer, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBDisplayLayer_Requestor_Destruct( IDirectFBDisplayLayer *thiz )
+{
+     IDirectFBDisplayLayer_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBDISPLAYLAYER_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBDisplayLayer_Requestor_AddRef( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBDisplayLayer_Requestor_Release( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBDisplayLayer_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetID( IDirectFBDisplayLayer *thiz,
+                                       DFBDisplayLayerID     *ret_id )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBDisplayLayerID      id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_id)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetID, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_id = id;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetDescription( IDirectFBDisplayLayer      *thiz,
+                                                DFBDisplayLayerDescription *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetSurface( IDirectFBDisplayLayer  *thiz,
+                                            IDirectFBSurface      **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetScreen( IDirectFBDisplayLayer  *thiz,
+                                           IDirectFBScreen       **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetScreen, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBScreen",
+                                            response->instance, data->idirectfb, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetCooperativeLevel( IDirectFBDisplayLayer           *thiz,
+                                                     DFBDisplayLayerCooperativeLevel  level )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_SetCooperativeLevel, VREQ_RESPOND, &response,
+                                   VMBT_UINT, level,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetOpacity( IDirectFBDisplayLayer *thiz,
+                                            u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetCurrentOutputField( IDirectFBDisplayLayer *thiz, int *field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetFieldParity( IDirectFBDisplayLayer *thiz, int field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetScreenLocation( IDirectFBDisplayLayer *thiz,
+                                                   float                  x,
+                                                   float                  y,
+                                                   float                  width,
+                                                   float                  height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetSrcColorKey( IDirectFBDisplayLayer *thiz,
+                                                u8                     r,
+                                                u8                     g,
+                                                u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetDstColorKey( IDirectFBDisplayLayer *thiz,
+                                                u8                     r,
+                                                u8                     g,
+                                                u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetLevel( IDirectFBDisplayLayer *thiz,
+                                          int                   *level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetLevel( IDirectFBDisplayLayer *thiz,
+                                          int                    level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetConfiguration( IDirectFBDisplayLayer *thiz,
+                                                  DFBDisplayLayerConfig *ret_config )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetConfiguration, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_READ_DATA( parser, ret_config, sizeof(DFBDisplayLayerConfig) );
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_TestConfiguration( IDirectFBDisplayLayer       *thiz,
+                                                   const DFBDisplayLayerConfig *config,
+                                                   DFBDisplayLayerConfigFlags  *ret_failed )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!config)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_TestConfiguration, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(DFBDisplayLayerConfig), config,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     if (ret_failed) {
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_UINT( parser, *ret_failed );
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetConfiguration( IDirectFBDisplayLayer       *thiz,
+                                                  const DFBDisplayLayerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetBackgroundMode( IDirectFBDisplayLayer         *thiz,
+                                                   DFBDisplayLayerBackgroundMode  background_mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundMode, VREQ_NONE, NULL,
+                                    VMBT_INT, background_mode,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetBackgroundImage( IDirectFBDisplayLayer *thiz,
+                                                    IDirectFBSurface      *surface )
+{
+     IDirectFBSurface_Requestor_data *surface_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!surface)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( surface, surface_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBDISPLAYLAYER_METHOD_ID_SetBackgroundImage, VREQ_NONE, NULL,
+                                    VMBT_ID, surface_data->instance,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetBackgroundColor( IDirectFBDisplayLayer *thiz,
+                                                    u8 r, u8 g, u8 b, u8 a )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_CreateWindow( IDirectFBDisplayLayer       *thiz,
+                                              const DFBWindowDescription  *real_desc,
+                                              IDirectFBWindow            **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     DFBWindowDescription   desc;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     direct_memcpy( &desc, real_desc, sizeof(DFBWindowDescription) );
+
+     if (!(desc.flags & DWDESC_RESOURCE_ID)) {
+          desc.flags       |= DWDESC_RESOURCE_ID;
+          desc.resource_id  = 1100;
+     }
+
+     D_INFO( "IDirectFBDisplayLayer_Requestor_CreateWindow: Using resource ID %lu\n", desc.resource_id );
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_CreateWindow, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(DFBWindowDescription), &desc,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBWindow",
+                                            response->instance, data->idirectfb, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetWindow( IDirectFBDisplayLayer  *thiz,
+                                           DFBWindowID             id,
+                                           IDirectFBWindow       **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindow, VREQ_RESPOND, &response,
+                                   VMBT_ID, id,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBWindow",
+                                            response->instance, data->idirectfb, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_EnableCursor( IDirectFBDisplayLayer *thiz, int enable )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetCursorPosition( IDirectFBDisplayLayer *thiz,
+                                                   int *x, int *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_WarpCursor( IDirectFBDisplayLayer *thiz, int x, int y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetCursorAcceleration( IDirectFBDisplayLayer *thiz,
+                                                       int                    numerator,
+                                                       int                    denominator,
+                                                       int                    threshold )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetCursorShape( IDirectFBDisplayLayer *thiz,
+                                                IDirectFBSurface      *shape,
+                                                int                    hot_x,
+                                                int                    hot_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetCursorOpacity( IDirectFBDisplayLayer *thiz,
+                                                  u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetColorAdjustment( IDirectFBDisplayLayer *thiz,
+                                                    DFBColorAdjustment    *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_SetColorAdjustment( IDirectFBDisplayLayer    *thiz,
+                                                    const DFBColorAdjustment *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_WaitForSync( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetWindowByResourceID( IDirectFBDisplayLayer  *thiz,
+                                                       unsigned long           resource_id,
+                                                       IDirectFBWindow       **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetWindowByResourceID, VREQ_RESPOND, &response,
+                                   VMBT_ID, resource_id,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBWindow",
+                                            response->instance, data->idirectfb, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_Requestor_GetRotation( IDirectFBDisplayLayer *thiz,
+                                             int                   *ret_rotation )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer_Requestor)
+
+     if (!ret_rotation)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBDISPLAYLAYER_METHOD_ID_GetRotation, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK) {
+          VoodooMessageParser parser;
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_INT( parser, *ret_rotation );
+          VOODOO_PARSER_END( parser );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBDisplayLayer *thiz,
+           VoodooManager         *manager,
+           VoodooInstanceID       instance,
+           void                  *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDisplayLayer_Requestor)
+
+     data->ref       = 1;
+     data->manager   = manager;
+     data->instance  = instance;
+     data->idirectfb = arg;
+
+     thiz->AddRef                = IDirectFBDisplayLayer_Requestor_AddRef;
+     thiz->Release               = IDirectFBDisplayLayer_Requestor_Release;
+     thiz->GetID                 = IDirectFBDisplayLayer_Requestor_GetID;
+     thiz->GetDescription        = IDirectFBDisplayLayer_Requestor_GetDescription;
+     thiz->GetSurface            = IDirectFBDisplayLayer_Requestor_GetSurface;
+     thiz->GetScreen             = IDirectFBDisplayLayer_Requestor_GetScreen;
+     thiz->SetCooperativeLevel   = IDirectFBDisplayLayer_Requestor_SetCooperativeLevel;
+     thiz->SetOpacity            = IDirectFBDisplayLayer_Requestor_SetOpacity;
+     thiz->GetCurrentOutputField = IDirectFBDisplayLayer_Requestor_GetCurrentOutputField;
+     thiz->SetScreenLocation     = IDirectFBDisplayLayer_Requestor_SetScreenLocation;
+     thiz->SetSrcColorKey        = IDirectFBDisplayLayer_Requestor_SetSrcColorKey;
+     thiz->SetDstColorKey        = IDirectFBDisplayLayer_Requestor_SetDstColorKey;
+     thiz->GetLevel              = IDirectFBDisplayLayer_Requestor_GetLevel;
+     thiz->SetLevel              = IDirectFBDisplayLayer_Requestor_SetLevel;
+     thiz->GetConfiguration      = IDirectFBDisplayLayer_Requestor_GetConfiguration;
+     thiz->TestConfiguration     = IDirectFBDisplayLayer_Requestor_TestConfiguration;
+     thiz->SetConfiguration      = IDirectFBDisplayLayer_Requestor_SetConfiguration;
+     thiz->SetBackgroundMode     = IDirectFBDisplayLayer_Requestor_SetBackgroundMode;
+     thiz->SetBackgroundColor    = IDirectFBDisplayLayer_Requestor_SetBackgroundColor;
+     thiz->SetBackgroundImage    = IDirectFBDisplayLayer_Requestor_SetBackgroundImage;
+     thiz->GetColorAdjustment    = IDirectFBDisplayLayer_Requestor_GetColorAdjustment;
+     thiz->SetColorAdjustment    = IDirectFBDisplayLayer_Requestor_SetColorAdjustment;
+     thiz->CreateWindow          = IDirectFBDisplayLayer_Requestor_CreateWindow;
+     thiz->GetWindow             = IDirectFBDisplayLayer_Requestor_GetWindow;
+     thiz->WarpCursor            = IDirectFBDisplayLayer_Requestor_WarpCursor;
+     thiz->SetCursorAcceleration = IDirectFBDisplayLayer_Requestor_SetCursorAcceleration;
+     thiz->EnableCursor          = IDirectFBDisplayLayer_Requestor_EnableCursor;
+     thiz->GetCursorPosition     = IDirectFBDisplayLayer_Requestor_GetCursorPosition;
+     thiz->SetCursorShape        = IDirectFBDisplayLayer_Requestor_SetCursorShape;
+     thiz->SetCursorOpacity      = IDirectFBDisplayLayer_Requestor_SetCursorOpacity;
+     thiz->SetFieldParity        = IDirectFBDisplayLayer_Requestor_SetFieldParity;
+     thiz->WaitForSync           = IDirectFBDisplayLayer_Requestor_WaitForSync;
+     thiz->GetWindowByResourceID = IDirectFBDisplayLayer_Requestor_GetWindowByResourceID;
+     thiz->GetRotation           = IDirectFBDisplayLayer_Requestor_GetRotation;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.h
new file mode 100755
index 0000000..c0fa8f7
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbdisplaylayer_requestor.h
@@ -0,0 +1,47 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBDISPLAYLAYER_REQUESTOR_H__
+#define __IDIRECTFBDISPLAYLAYER_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBDisplayLayer_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFB           *idirectfb;
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+} IDirectFBDisplayLayer_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.c
new file mode 100755
index 0000000..5d23d42
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.c
@@ -0,0 +1,300 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbeventbuffer_dispatcher.h>
+
+#include "idirectfbeventbuffer_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBEventBuffer *thiz,
+                            VoodooManager        *manager,
+                            VoodooInstanceID      instance,
+                            void                 *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBEventBuffer, Requestor )
+
+
+/**************************************************************************************************/
+
+static void *feed_thread( DirectThread *thread, void *arg );
+
+/**************************************************************************************************/
+
+static void
+IDirectFBEventBuffer_Requestor_Destruct( IDirectFBEventBuffer *thiz )
+{
+     IDirectFBEventBuffer_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->stop = true;
+
+     data->src->WakeUp( data->src );
+
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     data->src->Release( data->src );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBEVENTBUFFER_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBEventBuffer_Requestor_AddRef( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBEventBuffer_Requestor_Release( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBEventBuffer_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_Reset( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_WaitForEvent( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_WaitForEventWithTimeout( IDirectFBEventBuffer *thiz,
+                                                        unsigned int          seconds,
+                                                        unsigned int          milli_seconds )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_WakeUp( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_GetEvent( IDirectFBEventBuffer *thiz,
+                                         DFBEvent             *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_PeekEvent( IDirectFBEventBuffer *thiz,
+                                          DFBEvent             *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_HasEvent( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_PostEvent( IDirectFBEventBuffer *thiz,
+                                          const DFBEvent       *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     if (!event)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBEVENTBUFFER_METHOD_ID_PostEvent, VREQ_NONE, NULL,
+                                    VMBT_DATA, sizeof(DFBEvent), event,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBEventBuffer_Requestor_CreateFileDescriptor( IDirectFBEventBuffer *thiz,
+                                                     int                  *fd )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBEventBuffer *thiz,
+           VoodooManager        *manager,
+           VoodooInstanceID      instance,
+           void                 *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBEventBuffer_Requestor)
+
+     voodoo_manager_register_remote( manager, false, thiz, instance );
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+
+     data->src      = arg;
+     data->dst      = thiz;
+
+     data->src->AddRef( data->src );
+
+     thiz->AddRef                  = IDirectFBEventBuffer_Requestor_AddRef;
+     thiz->Release                 = IDirectFBEventBuffer_Requestor_Release;
+     thiz->Reset                   = IDirectFBEventBuffer_Requestor_Reset;
+     thiz->WaitForEvent            = IDirectFBEventBuffer_Requestor_WaitForEvent;
+     thiz->WaitForEventWithTimeout = IDirectFBEventBuffer_Requestor_WaitForEventWithTimeout;
+     thiz->GetEvent                = IDirectFBEventBuffer_Requestor_GetEvent;
+     thiz->PeekEvent               = IDirectFBEventBuffer_Requestor_PeekEvent;
+     thiz->HasEvent                = IDirectFBEventBuffer_Requestor_HasEvent;
+     thiz->PostEvent               = IDirectFBEventBuffer_Requestor_PostEvent;
+     thiz->WakeUp                  = IDirectFBEventBuffer_Requestor_WakeUp;
+     thiz->CreateFileDescriptor    = IDirectFBEventBuffer_Requestor_CreateFileDescriptor;
+
+     data->thread = direct_thread_create( DTT_INPUT, feed_thread, data, "Event Feed" );
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static void *
+feed_thread( DirectThread *thread, void *arg )
+{
+     DFBResult                            ret;
+     IDirectFBEventBuffer_Requestor_data *data = arg;
+     IDirectFBEventBuffer                *src  = data->src;
+     IDirectFBEventBuffer                *dst  = data->dst;
+
+     while (!data->stop) {
+          DFBEvent event;
+
+          ret = src->WaitForEvent( src );
+          if (ret) {
+               if (ret == DFB_INTERRUPTED)
+                    continue;
+
+               DirectFBError( "IDirectFBEventBuffer::WaitForEvent", ret );
+               return NULL;
+          }
+
+          if (data->stop)
+               return NULL;
+
+          while (src->GetEvent( src, &event ) == DFB_OK) {
+               ret = dst->PostEvent( dst, &event );
+               if (ret) {
+                    DirectFBError( "IDirectFBEventBuffer::PostEvent", ret );
+                    return NULL;
+               }
+
+               if (data->stop)
+                    return NULL;
+          }
+     }
+
+     return NULL;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.h
new file mode 100755
index 0000000..001732a
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbeventbuffer_requestor.h
@@ -0,0 +1,54 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBEVENTBUFFER_REQUESTOR_H__
+#define __IDIRECTFBEVENTBUFFER_REQUESTOR_H__
+
+#include <direct/types.h>
+#include <voodoo/types.h>
+
+#include <directfb.h>
+
+/*
+ * private data struct of IDirectFBEventBuffer_Requestor
+ */
+typedef struct {
+     int                   ref;      /* reference counter */
+
+     VoodooManager        *manager;
+     VoodooInstanceID      instance;
+
+     IDirectFBEventBuffer *src;
+     IDirectFBEventBuffer *dst;
+
+     bool                  stop;
+     DirectThread         *thread;
+} IDirectFBEventBuffer_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.c
new file mode 100755
index 0000000..392901d
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.c
@@ -0,0 +1,530 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbfont_dispatcher.h>
+
+#include "idirectfbfont_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBFont    *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFont, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBFont_Requestor_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->buffer->Release( data->buffer );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBFONT_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBFont_Requestor_AddRef( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBFont_Requestor_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBFont_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetAscender( IDirectFBFont *thiz, int *ret_ascender )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    ascender;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!ret_ascender)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetAscender, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, ascender );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_ascender = ascender;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetDescender( IDirectFBFont *thiz, int *ret_descender )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    descender;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!ret_descender)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetDescender, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, descender );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_descender = descender;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetHeight( IDirectFBFont *thiz,
+                                   int           *ret_height )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    height;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!ret_height)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetHeight, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, height );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_height = height;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetMaxAdvance( IDirectFBFont *thiz, int *ret_maxadvance )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    maxadvance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!ret_maxadvance)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetMaxAdvance, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, maxadvance );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_maxadvance = maxadvance;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetKerning( IDirectFBFont *thiz,
+                                    unsigned int prev_index, unsigned int current_index,
+                                    int *ret_kern_x, int *ret_kern_y)
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    kern_x;
+     int                    kern_y;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!ret_kern_x && !ret_kern_y)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetMaxAdvance, VREQ_RESPOND, &response,
+                                   VMBT_UINT, prev_index,
+                                   VMBT_UINT, current_index,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, kern_x );
+     VOODOO_PARSER_GET_INT( parser, kern_y );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_kern_x = kern_x;
+     *ret_kern_y = kern_y;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetStringExtents( IDirectFBFont *thiz,
+                                          const char *text, int bytes,
+                                          DFBRectangle *logical_rect,
+                                          DFBRectangle *ink_rect )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBRectangle    *logical;
+     const DFBRectangle    *ink;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!text || (!logical_rect && !ink_rect))
+          return DFB_INVARG;
+
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (bytes == 0) {
+          if (logical_rect)
+               memset( logical_rect, 0, sizeof(DFBRectangle) );
+
+          if (ink_rect)
+               memset( ink_rect, 0, sizeof(DFBRectangle) );
+
+          return DFB_OK;
+     }
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetStringExtents, VREQ_RESPOND, &response,
+                                   VMBT_DATA, bytes, text,
+                                   VMBT_INT, bytes,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, logical );
+     VOODOO_PARSER_GET_DATA( parser, ink );
+     VOODOO_PARSER_END( parser );
+
+     if (logical_rect)
+          *logical_rect = *logical;
+
+     if (ink_rect)
+          *ink_rect = *ink;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetStringWidth( IDirectFBFont *thiz,
+                                        const char    *text,
+                                        int            bytes,
+                                        int           *ret_width )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     int                    width;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!text || !ret_width)
+          return DFB_INVARG;
+
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (bytes == 0)
+          return DFB_OK;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetStringWidth, VREQ_RESPOND, &response,
+                                   VMBT_DATA, bytes, text,
+                                   VMBT_INT, bytes,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, width );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_width = width;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetGlyphExtents( IDirectFBFont *thiz,
+                                         unsigned int   index,
+                                         DFBRectangle  *rect,
+                                         int           *ret_advance )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBRectangle    *extents;
+     int                    advance;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     if (!rect && !ret_advance)
+          return DFB_INVARG;
+
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBFONT_METHOD_ID_GetGlyphExtents, VREQ_RESPOND, &response,
+                                   VMBT_UINT, index,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, extents );
+     VOODOO_PARSER_GET_INT( parser, advance );
+     VOODOO_PARSER_END( parser );
+
+     if (rect)
+          *rect = *extents;
+
+     if (advance)
+          *ret_advance = advance;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_GetStringBreak( IDirectFBFont *thiz,
+                                        const char    *text, 
+                                        int            bytes,
+                                        int            max_width,
+                                        int           *ret_width,
+                                        int           *ret_str_length,
+                                        const char   **ret_next_line )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_SetEncoding( IDirectFBFont     *thiz,
+                                     DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_EnumEncodings( IDirectFBFont           *thiz,
+                                       DFBTextEncodingCallback  callback,
+                                       void                    *ctx )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBFont_Requestor_FindEncoding( IDirectFBFont     *thiz,
+                                      const char        *name,
+                                      DFBTextEncodingID *encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont_Requestor)
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBFont    *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     IDirectFBDataBuffer *buffer = arg;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBFont_Requestor)
+
+     buffer->AddRef( buffer );
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+     data->buffer   = buffer;
+
+     thiz->AddRef           = IDirectFBFont_Requestor_AddRef;
+     thiz->Release          = IDirectFBFont_Requestor_Release;
+     thiz->GetAscender      = IDirectFBFont_Requestor_GetAscender;
+     thiz->GetDescender     = IDirectFBFont_Requestor_GetDescender;
+     thiz->GetHeight        = IDirectFBFont_Requestor_GetHeight;
+     thiz->GetMaxAdvance    = IDirectFBFont_Requestor_GetMaxAdvance;
+     thiz->GetKerning       = IDirectFBFont_Requestor_GetKerning;
+     thiz->GetStringWidth   = IDirectFBFont_Requestor_GetStringWidth;
+     thiz->GetStringExtents = IDirectFBFont_Requestor_GetStringExtents;
+     thiz->GetGlyphExtents  = IDirectFBFont_Requestor_GetGlyphExtents;
+     thiz->GetStringBreak   = IDirectFBFont_Requestor_GetStringBreak;
+     thiz->SetEncoding      = IDirectFBFont_Requestor_SetEncoding;
+     thiz->EnumEncodings    = IDirectFBFont_Requestor_EnumEncodings;
+     thiz->FindEncoding     = IDirectFBFont_Requestor_FindEncoding;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.h
new file mode 100755
index 0000000..5c2b203
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbfont_requestor.h
@@ -0,0 +1,47 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBFONT_REQUESTOR_H__
+#define __IDIRECTFBFONT_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBFont_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+
+     IDirectFBDataBuffer *buffer;
+} IDirectFBFont_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.c
new file mode 100755
index 0000000..9574354
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.c
@@ -0,0 +1,135 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbfoo_dispatcher.h>
+
+#include "idirectfbfoo_requestor.h"
+
+
+static DFBResult Probe();
+static DFBResult Construct( IDirectFBFoo     *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBFoo, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBFoo_Requestor_Destruct( IDirectFBFoo *thiz )
+{
+     IDirectFBFoo_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBFOO_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+IDirectFBFoo_Requestor_AddRef( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFoo_Requestor_Release( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBFoo_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFoo_Requestor_Bar( IDirectFBFoo *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFoo_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBFoo     *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBFoo_Requestor)
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+
+     thiz->AddRef  = IDirectFBFoo_Requestor_AddRef;
+     thiz->Release = IDirectFBFoo_Requestor_Release;
+     thiz->Bar     = IDirectFBFoo_Requestor_Bar;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.h
new file mode 100755
index 0000000..1b125bb
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbfoo_requestor.h
@@ -0,0 +1,45 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBFOO_REQUESTOR_H__
+#define __IDIRECTFBFOO_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBFoo_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+} IDirectFBFoo_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbimageprovider_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbimageprovider_requestor.c
new file mode 100755
index 0000000..b0ce08e
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbimageprovider_requestor.c
@@ -0,0 +1,264 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfb_dispatcher.h>
+#include <idirectfbimageprovider_dispatcher.h>
+
+#include "idirectfbsurface_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBImageProvider *thiz,
+                            VoodooManager          *manager,
+                            VoodooInstanceID        instance,
+                            void                   *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBImageProvider, Requestor )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBImageProvider_Requestor
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     VoodooManager         *manager;
+     VoodooInstanceID       instance;
+
+     IDirectFBDataBuffer   *buffer;
+} IDirectFBImageProvider_Requestor_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBImageProvider_Requestor_Destruct( IDirectFBImageProvider *thiz )
+{
+     IDirectFBImageProvider_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     data->buffer->Release( data->buffer );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBIMAGEPROVIDER_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBImageProvider_Requestor_AddRef( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBImageProvider_Requestor_Release( IDirectFBImageProvider *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBImageProvider_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_Requestor_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                                        DFBSurfaceDescription  *desc )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetSurfaceDescription,
+                                   VREQ_RESPOND | VREQ_ASYNC, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DFBSurfaceDescription( parser, *desc );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_Requestor_GetImageDescription( IDirectFBImageProvider *thiz,
+                                                      DFBImageDescription    *desc )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBIMAGEPROVIDER_METHOD_ID_GetImageDescription,
+                                   VREQ_RESPOND | VREQ_ASYNC, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DATA( parser, desc, sizeof(DFBImageDescription) );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBImageProvider_Requestor_RenderTo( IDirectFBImageProvider *thiz,
+                                           IDirectFBSurface       *destination,
+                                           const DFBRectangle     *destination_rect )
+{
+     DirectResult                     ret;
+     VoodooResponseMessage           *response;
+     IDirectFBSurface_Requestor_data *destination_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     if (!destination)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( destination, destination_data, IDirectFBSurface_Requestor);
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBIMAGEPROVIDER_METHOD_ID_RenderTo,
+                                   VREQ_RESPOND | VREQ_ASYNC, &response,
+                                   VMBT_ID, destination_data->instance,
+                                   VMBT_ODATA, sizeof(DFBRectangle), destination_rect,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBImageProvider_Requestor_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                                    DIRenderCallback        callback,
+                                                    void                   *callback_data )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBImageProvider_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBImageProvider *thiz,
+           VoodooManager          *manager,
+           VoodooInstanceID        instance,
+           void                   *arg )
+{
+     IDirectFBDataBuffer *buffer = arg;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBImageProvider_Requestor)
+
+     buffer->AddRef( buffer );
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+     data->buffer   = buffer;
+
+     thiz->AddRef                = IDirectFBImageProvider_Requestor_AddRef;
+     thiz->Release               = IDirectFBImageProvider_Requestor_Release;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_Requestor_GetSurfaceDescription;
+     thiz->GetImageDescription   = IDirectFBImageProvider_Requestor_GetImageDescription;
+     thiz->RenderTo              = IDirectFBImageProvider_Requestor_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_Requestor_SetRenderCallback;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.c
new file mode 100755
index 0000000..3193467
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.c
@@ -0,0 +1,469 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <input/idirectfbinputbuffer.h>
+
+#include <idirectfbeventbuffer_dispatcher.h>
+#include <idirectfbinputdevice_dispatcher.h>
+
+#include "idirectfbinputdevice_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBInputDevice *thiz,
+                            VoodooManager        *manager,
+                            VoodooInstanceID      instance,
+                            void                 *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBInputDevice, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBInputDevice_Requestor_Destruct( IDirectFBInputDevice *thiz )
+{
+     IDirectFBInputDevice_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBINPUTDEVICE_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBInputDevice_Requestor_AddRef( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBInputDevice_Requestor_Release( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBInputDevice_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetID( IDirectFBInputDevice *thiz,
+                                      DFBInputDeviceID     *ret_id )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBInputDeviceID       id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_id)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_GetID, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_id = id;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_CreateEventBuffer( IDirectFBInputDevice  *thiz,
+                                                  IDirectFBEventBuffer **ret_interface )
+{
+     DFBResult              ret;
+     IDirectFBEventBuffer  *buffer;
+     IDirectFBEventBuffer  *dispatcher;
+     VoodooInstanceID       instance;
+     VoodooResponseMessage *response;
+     void                  *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     /* Create the real interface. */
+     DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( buffer, NULL, NULL );
+
+     /* Create the dispatcher. */
+     ret = voodoo_construct_dispatcher( data->manager, "IDirectFBEventBuffer",
+                                        buffer, data->instance, NULL, &instance, &ptr );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     dispatcher = ptr;
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_CreateEventBuffer,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_ID,  instance,
+                                   VMBT_NONE );
+     if (ret) {
+          dispatcher->Release( dispatcher );
+          return ret;
+     }
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     /* Return the dispatcher interface. */
+     *ret_interface = dispatcher;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_AttachEventBuffer( IDirectFBInputDevice *thiz,
+                                                  IDirectFBEventBuffer *buffer )
+{
+     DFBResult                             ret;
+     IDirectFBEventBuffer_Dispatcher_data *buffer_data;
+     VoodooResponseMessage                *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!buffer)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Dispatcher );
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_AttachEventBuffer,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_ID, buffer_data->self,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_DetachEventBuffer( IDirectFBInputDevice *thiz,
+                                                  IDirectFBEventBuffer *buffer )
+{
+     DFBResult                             ret;
+     IDirectFBEventBuffer_Dispatcher_data *buffer_data;
+     VoodooResponseMessage                *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!buffer)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Dispatcher );
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_DetachEventBuffer,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_ID, buffer_data->self,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetDescription( IDirectFBInputDevice      *thiz,
+                                               DFBInputDeviceDescription *ret_desc )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_desc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_GetDescription,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DATA( parser, ret_desc, sizeof(DFBInputDeviceDescription) );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetKeymapEntry( IDirectFBInputDevice      *thiz,
+                                               int                        keycode,
+                                               DFBInputDeviceKeymapEntry *ret_entry )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_entry)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBINPUTDEVICE_METHOD_ID_GetKeymapEntry,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_INT, keycode,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DATA( parser, ret_entry, sizeof(DFBInputDeviceKeymapEntry) );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetKeyState( IDirectFBInputDevice        *thiz,
+                                            DFBInputDeviceKeyIdentifier  key_id,
+                                            DFBInputDeviceKeyState      *ret_state )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_state)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetModifiers( IDirectFBInputDevice       *thiz,
+                                             DFBInputDeviceModifierMask *ret_modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_modifiers)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetLockState( IDirectFBInputDevice    *thiz,
+                                             DFBInputDeviceLockState *ret_locks )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_locks)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetButtons( IDirectFBInputDevice     *thiz,
+                                           DFBInputDeviceButtonMask *ret_buttons )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_buttons)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetButtonState( IDirectFBInputDevice           *thiz,
+                                               DFBInputDeviceButtonIdentifier  button,
+                                               DFBInputDeviceButtonState      *ret_state )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_state || (int)button < DIBI_FIRST || button > DIBI_LAST)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetAxis( IDirectFBInputDevice         *thiz,
+                                        DFBInputDeviceAxisIdentifier  axis,
+                                        int                          *ret_pos )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_pos || (int)axis < DIAI_FIRST || axis > DIAI_LAST)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBInputDevice_Requestor_GetXY( IDirectFBInputDevice *thiz,
+                                      int                  *ret_x,
+                                      int                  *ret_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice_Requestor)
+
+     if (!ret_x && !ret_y)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBInputDevice *thiz,
+           VoodooManager        *manager,
+           VoodooInstanceID      instance,
+           void                 *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBInputDevice_Requestor)
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+
+     thiz->AddRef             = IDirectFBInputDevice_Requestor_AddRef;
+     thiz->Release            = IDirectFBInputDevice_Requestor_Release;
+     thiz->GetID              = IDirectFBInputDevice_Requestor_GetID;
+     thiz->GetDescription     = IDirectFBInputDevice_Requestor_GetDescription;
+     thiz->GetKeymapEntry     = IDirectFBInputDevice_Requestor_GetKeymapEntry;
+     thiz->CreateEventBuffer  = IDirectFBInputDevice_Requestor_CreateEventBuffer;
+     thiz->AttachEventBuffer  = IDirectFBInputDevice_Requestor_AttachEventBuffer;
+     thiz->DetachEventBuffer  = IDirectFBInputDevice_Requestor_DetachEventBuffer;
+     thiz->GetKeyState        = IDirectFBInputDevice_Requestor_GetKeyState;
+     thiz->GetModifiers       = IDirectFBInputDevice_Requestor_GetModifiers;
+     thiz->GetLockState       = IDirectFBInputDevice_Requestor_GetLockState;
+     thiz->GetButtons         = IDirectFBInputDevice_Requestor_GetButtons;
+     thiz->GetButtonState     = IDirectFBInputDevice_Requestor_GetButtonState;
+     thiz->GetAxis            = IDirectFBInputDevice_Requestor_GetAxis;
+     thiz->GetXY              = IDirectFBInputDevice_Requestor_GetXY;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.h
new file mode 100755
index 0000000..20eb4b6
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbinputdevice_requestor.h
@@ -0,0 +1,45 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBINPUTDEVICE_REQUESTOR_H__
+#define __IDIRECTFBINPUTDEVICE_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBInputDevice_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+} IDirectFBInputDevice_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.c
new file mode 100755
index 0000000..858460c
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.c
@@ -0,0 +1,335 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <idirectfbpalette_dispatcher.h>
+
+#include "idirectfbpalette_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBPalette *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBPalette, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBPalette_Requestor_Destruct( IDirectFBPalette *thiz )
+{
+     IDirectFBPalette_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBPALETTE_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBPalette_Requestor_AddRef( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBPalette_Requestor_Release( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBPalette_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_GetCapabilities( IDirectFBPalette       *thiz,
+                                            DFBPaletteCapabilities *ret_caps )
+{
+     DirectResult            ret;
+     VoodooResponseMessage  *response;
+     VoodooMessageParser     parser;
+     DFBPaletteCapabilities  caps;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!ret_caps)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBPALETTE_METHOD_ID_GetCapabilities, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, caps );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_caps = caps;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_GetSize( IDirectFBPalette *thiz,
+                                    unsigned int     *ret_size )
+{
+     DirectResult            ret;
+     VoodooResponseMessage  *response;
+     VoodooMessageParser     parser;
+     unsigned int            size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!ret_size)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBPALETTE_METHOD_ID_GetSize, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, size );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_size = size;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_SetEntries( IDirectFBPalette *thiz,
+                                       const DFBColor   *entries,
+                                       unsigned int      num_entries,
+                                       unsigned int      offset )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!entries)
+          return DFB_INVARG;
+
+     if (!num_entries)
+          return DFB_OK;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBPALETTE_METHOD_ID_SetEntries, VREQ_RESPOND, &response,
+                                   VMBT_DATA, num_entries * sizeof(DFBColor), entries,
+                                   VMBT_UINT, num_entries,
+                                   VMBT_UINT, offset,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_GetEntries( IDirectFBPalette *thiz,
+                                       DFBColor         *entries,
+                                       unsigned int      num_entries,
+                                       unsigned int      offset )
+{
+     DirectResult            ret;
+     VoodooResponseMessage  *response;
+     VoodooMessageParser     parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!entries)
+          return DFB_INVARG;
+
+     if (!num_entries)
+          return DFB_OK;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBPALETTE_METHOD_ID_GetEntries, VREQ_RESPOND, &response,
+                                   VMBT_UINT, num_entries,
+                                   VMBT_UINT, offset,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DATA( parser, entries, num_entries * sizeof(DFBColor) );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_FindBestMatch( IDirectFBPalette *thiz,
+                                          u8                r,
+                                          u8                g,
+                                          u8                b,
+                                          u8                a,
+                                          unsigned int     *ret_index )
+{
+     DirectResult            ret;
+     VoodooResponseMessage  *response;
+     VoodooMessageParser     parser;
+     unsigned int            index;
+     DFBColor                color = { a, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!ret_index)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBPALETTE_METHOD_ID_FindBestMatch, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(color), &color,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, index );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_index = index;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_Requestor_CreateCopy( IDirectFBPalette  *thiz,
+                                       IDirectFBPalette **ret_interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBPalette *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBPalette_Requestor)
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+
+     thiz->AddRef          = IDirectFBPalette_Requestor_AddRef;
+     thiz->Release         = IDirectFBPalette_Requestor_Release;
+     thiz->GetCapabilities = IDirectFBPalette_Requestor_GetCapabilities;
+     thiz->GetSize         = IDirectFBPalette_Requestor_GetSize;
+     thiz->SetEntries      = IDirectFBPalette_Requestor_SetEntries;
+     thiz->GetEntries      = IDirectFBPalette_Requestor_GetEntries;
+     thiz->FindBestMatch   = IDirectFBPalette_Requestor_FindBestMatch;
+     thiz->CreateCopy      = IDirectFBPalette_Requestor_CreateCopy;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.h
new file mode 100755
index 0000000..01c1946
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbpalette_requestor.h
@@ -0,0 +1,45 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBPALETTE_REQUESTOR_H__
+#define __IDIRECTFBPALETTE_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBPalette_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+} IDirectFBPalette_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbscreen_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbscreen_requestor.c
new file mode 100755
index 0000000..d86dbd9
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbscreen_requestor.c
@@ -0,0 +1,524 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <idirectfbscreen_dispatcher.h>
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBScreen  *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBScreen, Requestor )
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBScreen_Requestor
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     VoodooManager         *manager;
+     VoodooInstanceID       instance;
+} IDirectFBScreen_Requestor_data;
+
+/**************************************************************************************************/
+
+static void
+IDirectFBScreen_Requestor_Destruct( IDirectFBScreen *thiz )
+{
+     IDirectFBScreen_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBSCREEN_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBScreen_Requestor_AddRef( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBScreen_Requestor_Release( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBScreen_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetID( IDirectFBScreen *thiz,
+                                 DFBScreenID     *ret_id )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBScreenID            id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!ret_id)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSCREEN_METHOD_ID_GetID, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_id = id;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetDescription( IDirectFBScreen      *thiz,
+                                          DFBScreenDescription *ret_desc )
+{
+     DirectResult                ret;
+     VoodooResponseMessage      *response;
+     VoodooMessageParser         parser;
+     const DFBScreenDescription *desc; 
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!ret_desc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSCREEN_METHOD_ID_GetDescription,
+                                   VREQ_RESPOND, &response, VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, desc );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_desc = *desc;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetSize( IDirectFBScreen *thiz,
+                                   int             *width,
+                                   int             *height )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBDimension    *size; 
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSCREEN_METHOD_ID_GetSize,
+                                   VREQ_RESPOND, &response, VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, size );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (width)
+          *width = size->w;
+          
+     if (height)
+          *height = size->h;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_EnumDisplayLayers( IDirectFBScreen         *thiz,
+                                             DFBDisplayLayerCallback  callbackfunc,
+                                             void                    *callbackdata )
+{
+     DirectResult                                       ret;
+     VoodooResponseMessage                             *response;
+     VoodooMessageParser                                parser;
+     int                                                i, num;
+     IDirectFBScreen_Dispatcher_EnumDisplayLayers_Item *items;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSCREEN_METHOD_ID_EnumDisplayLayers, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, num );
+
+     items = D_MALLOC( sizeof(*items) * num );
+     if (items)
+          VOODOO_PARSER_READ_DATA( parser, items, sizeof(*items) * num );
+     else
+          ret = D_OOM();
+
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (items) {
+          for (i=0; i<num; i++) {
+               if (callbackfunc( items[i].layer_id, items[i].desc, callbackdata ) == DFENUM_CANCEL)
+                    break;
+          }
+
+          D_FREE( items );
+     }
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_SetPowerMode( IDirectFBScreen    *thiz,
+                                        DFBScreenPowerMode  mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSCREEN_METHOD_ID_SetPowerMode, VREQ_NONE, NULL,
+                                    VMBT_INT, mode,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_WaitForSync( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSCREEN_METHOD_ID_WaitForSync, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetMixerDescriptions( IDirectFBScreen           *thiz,
+                                      DFBScreenMixerDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetMixerConfiguration( IDirectFBScreen      *thiz,
+                                       int                   mixer,
+                                       DFBScreenMixerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_TestMixerConfiguration( IDirectFBScreen            *thiz,
+                                        int                         mixer,
+                                        const DFBScreenMixerConfig *config,
+                                        DFBScreenMixerConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_SetMixerConfiguration( IDirectFBScreen            *thiz,
+                                       int                         mixer,
+                                       const DFBScreenMixerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetEncoderDescriptions( IDirectFBScreen             *thiz,
+                                        DFBScreenEncoderDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetEncoderConfiguration( IDirectFBScreen        *thiz,
+                                         int                     encoder,
+                                         DFBScreenEncoderConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_TestEncoderConfiguration( IDirectFBScreen              *thiz,
+                                          int                           encoder,
+                                          const DFBScreenEncoderConfig *config,
+                                          DFBScreenEncoderConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_SetEncoderConfiguration( IDirectFBScreen              *thiz,
+                                         int                           encoder,
+                                         const DFBScreenEncoderConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetOutputDescriptions( IDirectFBScreen            *thiz,
+                                       DFBScreenOutputDescription *descriptions )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_GetOutputConfiguration( IDirectFBScreen       *thiz,
+                                        int                    output,
+                                        DFBScreenOutputConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_TestOutputConfiguration( IDirectFBScreen             *thiz,
+                                         int                          output,
+                                         const DFBScreenOutputConfig *config,
+                                         DFBScreenOutputConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBScreen_Requestor_SetOutputConfiguration( IDirectFBScreen             *thiz,
+                                        int                          output,
+                                        const DFBScreenOutputConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen_Requestor)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBScreen  *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBScreen_Requestor)
+
+     data->ref      = 1;
+     data->manager  = manager;
+     data->instance = instance;
+
+     thiz->AddRef                   = IDirectFBScreen_Requestor_AddRef;
+     thiz->Release                  = IDirectFBScreen_Requestor_Release;
+     thiz->GetID                    = IDirectFBScreen_Requestor_GetID;
+     thiz->GetDescription           = IDirectFBScreen_Requestor_GetDescription;
+     thiz->GetSize                  = IDirectFBScreen_Requestor_GetSize;
+     thiz->EnumDisplayLayers        = IDirectFBScreen_Requestor_EnumDisplayLayers;
+     thiz->SetPowerMode             = IDirectFBScreen_Requestor_SetPowerMode;
+     thiz->WaitForSync              = IDirectFBScreen_Requestor_WaitForSync;
+     thiz->GetMixerDescriptions     = IDirectFBScreen_Requestor_GetMixerDescriptions;
+     thiz->GetMixerConfiguration    = IDirectFBScreen_Requestor_GetMixerConfiguration;
+     thiz->TestMixerConfiguration   = IDirectFBScreen_Requestor_TestMixerConfiguration;
+     thiz->SetMixerConfiguration    = IDirectFBScreen_Requestor_SetMixerConfiguration;
+     thiz->GetEncoderDescriptions   = IDirectFBScreen_Requestor_GetEncoderDescriptions;
+     thiz->GetEncoderConfiguration  = IDirectFBScreen_Requestor_GetEncoderConfiguration;
+     thiz->TestEncoderConfiguration = IDirectFBScreen_Requestor_TestEncoderConfiguration;
+     thiz->SetEncoderConfiguration  = IDirectFBScreen_Requestor_SetEncoderConfiguration;
+     thiz->GetOutputDescriptions    = IDirectFBScreen_Requestor_GetOutputDescriptions;
+     thiz->GetOutputConfiguration   = IDirectFBScreen_Requestor_GetOutputConfiguration;
+     thiz->TestOutputConfiguration  = IDirectFBScreen_Requestor_TestOutputConfiguration;
+     thiz->SetOutputConfiguration   = IDirectFBScreen_Requestor_SetOutputConfiguration;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.c
new file mode 100755
index 0000000..49984c0
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.c
@@ -0,0 +1,1852 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <math.h>
+
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <voodoo/conf.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <misc/conf.h>
+
+#include <idirectfbsurface_dispatcher.h>
+
+#include "idirectfbfont_requestor.h"
+#include "idirectfbpalette_requestor.h"
+#include "idirectfbsurface_requestor.h"
+
+
+D_DEBUG_DOMAIN( IDirectFBSurface_Requestor_,    "IDirectFBSurface/Requestor",      "IDirectFBSurface Requestor" );
+D_DEBUG_DOMAIN( IDirectFBSurface_RequestorFlip, "IDirectFBSurface/Requestor/Flip", "IDirectFBSurface Requestor Flip" );
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBSurface *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBSurface, Requestor )
+
+/**************************************************************************************************/
+
+static void
+IDirectFBSurface_Requestor_Destruct( IDirectFBSurface *thiz )
+{
+     IDirectFBSurface_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     direct_mutex_deinit( &data->flip.lock );
+     direct_waitqueue_deinit( &data->flip.queue );
+
+     if (data->flip.window)
+          data->flip.window->Release( data->flip.window );
+          
+     if (data->flip.buffer)
+          data->flip.buffer->Release( data->flip.buffer );
+
+     if (data->local != VOODOO_INSTANCE_NONE)
+          voodoo_manager_unregister_local( data->manager, data->local );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBSURFACE_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBSurface_Requestor_AddRef( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBSurface_Requestor_Release( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBSurface_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+IDirectFBSurface_Requestor_GetPixelFormat( IDirectFBSurface      *thiz,
+                                           DFBSurfacePixelFormat *ret_format )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!ret_format)
+          return DFB_INVARG;
+
+     if (!data->format) {
+          DFBResult              ret;
+          VoodooResponseMessage *response;
+          VoodooMessageParser    parser;
+
+          ret = voodoo_manager_request( data->manager, data->instance,
+                                        IDIRECTFBSURFACE_METHOD_ID_GetPixelFormat, VREQ_RESPOND, &response,
+                                        VMBT_NONE );
+          if (ret)
+               return ret;
+
+          ret = response->result;
+          if (ret) {
+               voodoo_manager_finish_request( data->manager, response );
+               return ret;
+          }
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_INT( parser, data->format );
+          VOODOO_PARSER_END( parser );
+
+          voodoo_manager_finish_request( data->manager, response );
+     }
+
+     *ret_format = data->format;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetAccelerationMask( IDirectFBSurface    *thiz,
+                                                IDirectFBSurface    *source,
+                                                DFBAccelerationMask *ret_mask )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBAccelerationMask    mask;
+
+     IDirectFBSurface_Requestor_data *source_data = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (source)
+          DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetAccelerationMask, VREQ_RESPOND, &response,
+                                   VMBT_ID, source_data ? source_data->instance : VOODOO_INSTANCE_NONE,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, mask );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_mask = mask;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetPosition( IDirectFBSurface *thiz,
+                                        int              *x,
+                                        int              *y )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBPoint        *position;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetPosition,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, position );
+     VOODOO_PARSER_END( parser );
+
+     if (x)
+          *x = position->x;
+
+     if (y)
+          *y = position->y;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetSize( IDirectFBSurface *thiz,
+                                    int              *width,
+                                    int              *height )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBDimension    *dimension;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetSize, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, dimension );
+     VOODOO_PARSER_END( parser );
+
+     if (width)
+          *width = dimension->w;
+
+     if (height)
+          *height = dimension->h;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetVisibleRectangle( IDirectFBSurface *thiz,
+                                                DFBRectangle     *rect )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!rect)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetVisibleRectangle,
+                                   VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_READ_DATA( parser, rect, sizeof(DFBRectangle) );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetCapabilities( IDirectFBSurface       *thiz,
+                                            DFBSurfaceCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!caps)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetPalette( IDirectFBSurface  *thiz,
+                                       IDirectFBPalette **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetPalette, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBPalette",
+                                            response->instance, data->idirectfb, &interface_ptr );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetPalette( IDirectFBSurface *thiz,
+                                       IDirectFBPalette *palette )
+{
+     IDirectFBPalette_Requestor_data *palette_data = NULL;
+
+     DIRECT_INTERFACE_GET_DATA( IDirectFBSurface_Requestor )
+
+     if (!palette)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( palette, palette_data, IDirectFBPalette_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetPalette, VREQ_QUEUE, NULL,
+                                    VMBT_ID, palette_data->instance,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetAlphaRamp( IDirectFBSurface *thiz,
+                                         u8 a0, u8 a1, u8 a2, u8 a3 )
+{
+     DIRECT_INTERFACE_GET_DATA( IDirectFBSurface_Requestor )
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Lock( IDirectFBSurface *thiz,
+                                 DFBSurfaceLockFlags flags,
+                                 void **ret_ptr, int *ret_pitch )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!flags || !ret_ptr || !ret_pitch)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetFramebufferOffset( IDirectFBSurface *thiz,
+                                                 int              *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!offset)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Unlock( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+Handle_FlipReturned( IDirectFBSurface *thiz,
+                     unsigned int      millis )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "%s( %p, millis %u )\n", __FUNCTION__, thiz, millis );
+
+     long long now = direct_clock_get_micros();
+
+     data->flip.returned = millis;
+
+     data->flip.fps_count++;
+
+
+     long long    diff   = now - data->flip.fps_stamp;
+     unsigned int frames = data->flip.fps_count - data->flip.fps_old;
+
+     if (diff > 10000000) {
+          long long kfps = frames * 1000000000ULL / diff;
+
+          D_INFO( "IDirectFBSurface_Requestor_FlipNotify: FPS %lld.%03lld\n", kfps / 1000, kfps % 1000 );
+
+          data->flip.fps_stamp = now;
+          data->flip.fps_old   = data->flip.fps_count;
+     }
+
+     return DR_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Flip( IDirectFBSurface    *thiz,
+                                 const DFBRegion     *region,
+                                 DFBSurfaceFlipFlags  flags )
+{
+     DirectResult ret;
+     unsigned int millis;
+     bool         use_notify_or_buffer = false;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "%s( %p, region %p, flags 0x%08x )\n", __FUNCTION__, thiz, region, flags );
+
+     // FIXME: find better heuristic for flip control, or use flag
+     if (!region || (region->x1 == 0 && region->y1 == 0))
+          use_notify_or_buffer = true;
+
+     millis = direct_clock_get_abs_millis();
+
+     if (flags & DSFLIP_WAIT) {
+          VoodooResponseMessage *response;
+
+          if (data->flip.use_notify)
+               ret = voodoo_manager_request( data->manager, data->instance,
+                                             IDIRECTFBSURFACE_METHOD_ID_Flip, VREQ_RESPOND, &response,
+                                             VMBT_ODATA, sizeof(DFBRegion), region,
+                                             VMBT_INT, flags,
+                                             VMBT_UINT, millis,
+                                             VMBT_NONE );
+          else
+               ret = voodoo_manager_request( data->manager, data->instance,
+                                             IDIRECTFBSURFACE_METHOD_ID_Flip, VREQ_RESPOND, &response,
+                                             VMBT_ODATA, sizeof(DFBRegion), region,
+                                             VMBT_INT, flags,
+                                             VMBT_NONE );
+          if (ret)
+               return ret;
+
+          ret = response->result;
+
+          voodoo_manager_finish_request( data->manager, response );
+
+          return ret;
+     }
+
+     if (data->flip.use_notify) {
+          D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "  -> millis %u, using FlipNotify\n", millis );
+
+          ret = voodoo_manager_request( data->manager, data->instance,
+                                         IDIRECTFBSURFACE_METHOD_ID_Flip, VREQ_NONE, NULL,
+                                         VMBT_ODATA, sizeof(DFBRegion), region,
+                                         VMBT_INT, flags,
+                                         VMBT_UINT, millis,
+                                         VMBT_NONE );
+     }
+     else {
+          D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "  -> millis %u, not using FlipNotify\n", millis );
+
+          ret = voodoo_manager_request( data->manager, data->instance,
+                                         IDIRECTFBSURFACE_METHOD_ID_Flip, VREQ_NONE, NULL,
+                                         VMBT_ODATA, sizeof(DFBRegion), region,
+                                         VMBT_INT, flags,
+                                         VMBT_NONE );
+     }
+
+     if (use_notify_or_buffer && data->flip.use_notify) {
+          if (data->flip.end && millis - data->flip.end < 16) {
+               D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "  -> delaying next frame by %d ms\n", 16 - (millis - data->flip.end) );
+
+               direct_thread_sleep( (16 - (millis - data->flip.end)) * 1000 );
+          }
+
+          data->flip.requested = millis;
+          data->flip.end       = direct_clock_get_abs_millis();;
+
+          direct_mutex_lock( &data->flip.lock );
+
+          while (data->flip.requested - data->flip.returned > dfb_config->flip_notify_max_latency)
+               direct_waitqueue_wait( &data->flip.queue, &data->flip.lock );
+
+          direct_mutex_unlock( &data->flip.lock );
+     }
+     else if (use_notify_or_buffer && data->flip.use_buffer) {
+          ret = data->flip.window->MoveTo( data->flip.window, 1 + (millis & 0xffff), 1 + (millis >> 16) );
+          if (ret) {
+               D_DERROR( ret, "IDirectFBSurface_Requestor_Flip: MoveTo() for FlipNotify fallback failed!\n" );
+               data->flip.use_buffer = false;
+               return DFB_OK;
+          }
+
+          if (data->flip.end && millis - data->flip.end < 16) {
+               D_DEBUG_AT( IDirectFBSurface_RequestorFlip, "  -> delaying next frame by %d ms\n", 16 - (millis - data->flip.end) );
+
+               direct_thread_sleep( (16 - (millis - data->flip.end)) * 1000 );
+          }
+
+          data->flip.requested = millis;
+          data->flip.end       = direct_clock_get_abs_millis();;
+
+
+          DFBEvent event;
+
+          while (data->flip.buffer->GetEvent( data->flip.buffer, &event ) == DFB_OK) {
+               if (event.clazz == DFEC_WINDOW && event.window.type == DWET_POSITION)
+                    Handle_FlipReturned( thiz, ((u32)event.window.x - 1) | (((u32)event.window.y - 1) << 16) );
+          }
+
+          while (data->flip.requested - data->flip.returned > dfb_config->flip_notify_max_latency) {
+               data->flip.buffer->WaitForEvent( data->flip.buffer );
+
+               while (data->flip.buffer->GetEvent( data->flip.buffer, &event ) == DFB_OK) {
+                    if (event.clazz == DFEC_WINDOW && event.window.type == DWET_POSITION)
+                         Handle_FlipReturned( thiz, ((u32)event.window.x - 1) | (((u32)event.window.y - 1) << 16) );
+               }
+          }
+     }
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetField( IDirectFBSurface    *thiz,
+                                     int                  field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (field < 0 || field > 1)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Clear( IDirectFBSurface *thiz,
+                                  u8 r, u8 g, u8 b, u8 a )
+{
+     DFBColor color = { a, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_Clear, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBColor), &color,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetClip( IDirectFBSurface *thiz, const DFBRegion *clip )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetClip, VREQ_QUEUE, NULL,
+                                    VMBT_ODATA, sizeof(DFBRegion), clip,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetColor( IDirectFBSurface *thiz,
+                                     u8 r, u8 g, u8 b, u8 a )
+{
+     DFBColor color = { a, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetColor, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBColor), &color,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetColorIndex( IDirectFBSurface *thiz,
+                                          unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetSrcBlendFunction( IDirectFBSurface        *thiz,
+                                                DFBSurfaceBlendFunction  src )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetDstBlendFunction( IDirectFBSurface        *thiz,
+                                                DFBSurfaceBlendFunction  dst )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetPorterDuff( IDirectFBSurface         *thiz,
+                                          DFBSurfacePorterDuffRule  rule )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetSrcColorKey( IDirectFBSurface *thiz,
+                                           u8                r,
+                                           u8                g,
+                                           u8                b )
+{
+     DFBColor color = { 0, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKey, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBColor), &color,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetSrcColorKeyIndex( IDirectFBSurface *thiz,
+                                                unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetSrcColorKeyIndex, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, index,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetDstColorKey( IDirectFBSurface *thiz,
+                                           u8                r,
+                                           u8                g,
+                                           u8                b )
+{
+     DFBColor color = { 0, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetDstColorKey, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBColor), &color,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetDstColorKeyIndex( IDirectFBSurface *thiz,
+                                                unsigned int      index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetDstColorKeyIndex, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, index,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetFont( IDirectFBSurface *thiz,
+                                    IDirectFBFont    *font )
+{
+     IDirectFBFont_Requestor_data *font_data = NULL;
+
+     DIRECT_INTERFACE_GET_DATA( IDirectFBSurface_Requestor )
+
+     if (data->font == font)
+          return DFB_OK;
+
+     if (font) {
+          font->AddRef (font);
+
+          DIRECT_INTERFACE_GET_DATA_FROM( font, font_data, IDirectFBFont_Requestor );
+     }
+
+     if (data->font)
+          data->font->Release (data->font);
+
+     data->font = font;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetFont, VREQ_QUEUE, NULL,
+                                    VMBT_ID, font_data ? font_data->instance : VOODOO_INSTANCE_NONE,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetFont( IDirectFBSurface  *thiz,
+                                    IDirectFBFont    **font )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetDrawingFlags( IDirectFBSurface       *thiz,
+                                            DFBSurfaceDrawingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetDrawingFlags, VREQ_QUEUE, NULL,
+                                    VMBT_INT, flags,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_FillRectangle( IDirectFBSurface *thiz,
+                                          int x, int y, int w, int h )
+{
+     DFBRectangle rect = { x, y, w, h };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (w <= 0 || h <= 0)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_FillRectangle, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBRectangle), &rect,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_FillRectangles( IDirectFBSurface   *thiz,
+                                           const DFBRectangle *rects,
+                                           unsigned int        num_rects )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!rects || !num_rects)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_FillRectangles, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, num_rects,
+                                    VMBT_DATA, num_rects * sizeof(DFBRectangle), rects,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_FillSpans( IDirectFBSurface *thiz,
+                                      int               y,
+                                      const DFBSpan    *spans,
+                                      unsigned int      num_spans )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!spans || !num_spans)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_FillSpans, VREQ_QUEUE, NULL,
+                                    VMBT_INT, y,
+                                    VMBT_UINT, num_spans,
+                                    VMBT_DATA, num_spans * sizeof(DFBSpan), spans,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DrawLine( IDirectFBSurface *thiz,
+                                     int x1, int y1, int x2, int y2 )
+{
+     DFBRegion line = { x1, y1, x2, y2 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DrawLine, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBRegion), &line,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DrawLines( IDirectFBSurface *thiz,
+                                      const DFBRegion  *lines,
+                                      unsigned int      num_lines )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!lines || !num_lines)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DrawLines, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, num_lines,
+                                    VMBT_DATA, num_lines * sizeof(DFBRegion), lines,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DrawRectangle( IDirectFBSurface *thiz,
+                                          int x, int y, int w, int h )
+{
+     DFBRectangle rect = { x, y, w, h };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (w <= 0 || h <= 0)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DrawRectangle, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBRectangle), &rect,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_FillTriangle( IDirectFBSurface *thiz,
+                                         int x1, int y1,
+                                         int x2, int y2,
+                                         int x3, int y3 )
+{
+     DFBTriangle triangle = { x1, y1, x2, y2, x3, y3 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_FillTriangle, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(DFBTriangle), &triangle,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetBlittingFlags( IDirectFBSurface        *thiz,
+                                             DFBSurfaceBlittingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetBlittingFlags, VREQ_QUEUE, NULL,
+                                    VMBT_INT, flags,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Blit( IDirectFBSurface   *thiz,
+                                 IDirectFBSurface   *source,
+                                 const DFBRectangle *rect,
+                                 int                 x,
+                                 int                 y )
+{
+     DFBPoint point = { x, y };
+
+     IDirectFBSurface_Requestor_data *source_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!source)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_Blit, VREQ_QUEUE, NULL,
+                                    VMBT_ID, source_data->instance,
+                                    VMBT_ODATA, sizeof(DFBRectangle), rect,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_TileBlit( IDirectFBSurface   *thiz,
+                                     IDirectFBSurface   *source,
+                                     const DFBRectangle *rect,
+                                     int                 x,
+                                     int                 y )
+{
+     DFBPoint point = { x, y };
+
+     IDirectFBSurface_Requestor_data *source_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!source)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_TileBlit, VREQ_QUEUE, NULL,
+                                    VMBT_ID, source_data->instance,
+                                    VMBT_ODATA, sizeof(DFBRectangle), rect,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_BatchBlit( IDirectFBSurface   *thiz,
+                                      IDirectFBSurface   *source,
+                                      const DFBRectangle *source_rects,
+                                      const DFBPoint     *dest_points,
+                                      int                 num )
+{
+     IDirectFBSurface_Requestor_data *source_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!source || !source_rects || !dest_points || num < 1)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_BatchBlit, VREQ_QUEUE, NULL,
+                                    VMBT_ID, source_data->instance,
+                                    VMBT_UINT, num,
+                                    VMBT_DATA, num * sizeof(DFBRectangle), source_rects,
+                                    VMBT_DATA, num * sizeof(DFBPoint), dest_points,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_StretchBlit( IDirectFBSurface   *thiz,
+                                        IDirectFBSurface   *source,
+                                        const DFBRectangle *source_rect,
+                                        const DFBRectangle *destination_rect )
+{
+     IDirectFBSurface_Requestor_data *source_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!source)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_StretchBlit, VREQ_QUEUE, NULL,
+                                    VMBT_ID, source_data->instance,
+                                    VMBT_ODATA, sizeof(DFBRectangle), source_rect,
+                                    VMBT_ODATA, sizeof(DFBRectangle), destination_rect,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_TextureTriangles( IDirectFBSurface     *thiz,
+                                             IDirectFBSurface     *source,
+                                             const DFBVertex      *vertices,
+                                             const int            *indices,
+                                             int                   num,
+                                             DFBTriangleFormation  formation )
+{
+     int                              i;
+     int                              num_vertices = 0;
+     IDirectFBSurface_Requestor_data *source_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!source || !vertices || num < 3)
+          return DFB_INVARG;
+
+     if (indices) {
+          for (i=0; i<num; i++) {
+               if (num_vertices <= indices[i])
+                    num_vertices = indices[i] + 1;
+          }
+     }
+
+     DIRECT_INTERFACE_GET_DATA_FROM( source, source_data, IDirectFBSurface_Requestor );
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_TextureTriangles, VREQ_QUEUE, NULL,
+                                    VMBT_ID, source_data->instance,
+                                    VMBT_DATA, num_vertices * sizeof(DFBVertex), vertices,
+                                    VMBT_ODATA, num * sizeof(int), indices,
+                                    VMBT_INT, num,
+                                    VMBT_INT, formation,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DrawString( IDirectFBSurface    *thiz,
+                                       const char          *text,
+                                       int                  bytes,
+                                       int                  x,
+                                       int                  y,
+                                       DFBSurfaceTextFlags  flags )
+{
+     DFBPoint point = { x, y };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!text)
+          return DFB_INVARG;
+
+     if (!data->font)
+          return DFB_MISSINGFONT;
+
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (bytes == 0)
+          return DFB_OK;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DrawString, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, bytes, text,
+                                    VMBT_INT, bytes,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_INT, flags,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DrawGlyph( IDirectFBSurface    *thiz,
+                                      unsigned int         index,
+                                      int                  x,
+                                      int                  y,
+                                      DFBSurfaceTextFlags  flags )
+{
+     DFBPoint point = { x, y };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!index)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DrawGlyph, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, index,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_INT, flags,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetEncoding( IDirectFBSurface  *thiz,
+                                        DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetEncoding, VREQ_QUEUE, NULL,
+                                    VMBT_UINT, encoding,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetSubSurface( IDirectFBSurface    *thiz,
+                                          const DFBRectangle  *rect,
+                                          IDirectFBSurface   **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooInstanceID       instance_id;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_GetSubSurface, VREQ_RESPOND, &response,
+                                   VMBT_ODATA, sizeof(DFBRectangle), rect,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     instance_id = response->instance;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBSurface",
+                                            instance_id, data->idirectfb, &interface_ptr );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_GetGL( IDirectFBSurface   *thiz,
+                                  IDirectFBGL       **interface_ptr )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!interface_ptr)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Dump( IDirectFBSurface   *thiz,
+                                 const char         *directory,
+                                 const char         *prefix )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!directory || !prefix)
+          return DFB_INVARG;
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_DisableAcceleration( IDirectFBSurface   *thiz,
+                                                DFBAccelerationMask mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_DisableAcceleration,
+                                    VREQ_QUEUE, NULL,
+                                    VMBT_UINT, mask,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_ReleaseSource( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_ReleaseSource, VREQ_QUEUE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetIndexTranslation( IDirectFBSurface *thiz,
+                                                const int        *indices,
+                                                int               num_indices )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetRenderOptions( IDirectFBSurface        *thiz,
+                                             DFBSurfaceRenderOptions  options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetRenderOptions, VREQ_QUEUE, NULL,
+                                    VMBT_INT, options,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_SetMatrix( IDirectFBSurface *thiz,
+                                      const s32        *matrix )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBSURFACE_METHOD_ID_SetMatrix, VREQ_QUEUE, NULL,
+                                    VMBT_DATA, sizeof(s32) * 9, matrix,
+                                    VMBT_NONE );
+}
+
+#define RLE16_KEY   0xf001
+
+static bool
+rle16_encode( const u16    *src,
+              u16          *dst,
+              unsigned int  num,
+              unsigned int *ret_num )
+{
+     unsigned int n, last, count = 0, out = 0;
+
+     for (n=0; n<num; n++) {
+          if (out + 3 > num) {
+               *ret_num = num;
+               return false;
+          }
+
+          if (count > 0) {
+               D_ASSERT( src[n] == last );
+
+               count++;
+          }
+          else {
+               count = 1;
+               last  = src[n];
+          }
+
+          if (n == num-1 || src[n+1] != last) {
+               if (count > 2 || (count > 1 && last == RLE16_KEY)) {
+                    dst[out++] = RLE16_KEY;
+                    dst[out++] = count;
+                    dst[out++] = last;
+               }
+               else {
+                    if (count > 1 || last == RLE16_KEY)
+                         dst[out++] = last;
+
+                    dst[out++] = last;
+               }
+
+               count = 0;
+          }
+     }
+
+     *ret_num = out;
+
+     return true;
+}
+
+#define RLE32_KEY   0xf0012345
+
+static bool
+rle32_encode( const u32    *src,
+              u32          *dst,
+              unsigned int  num,
+              unsigned int *ret_num )
+{
+     unsigned int n, last, count = 0, out = 0;
+
+     for (n=0; n<num; n++) {
+          if (out + 3 > num) {
+               *ret_num = num;
+               return false;
+          }
+
+          if (count > 0) {
+               D_ASSERT( src[n] == last );
+
+               count++;
+          }
+          else {
+               count = 1;
+               last  = src[n];
+          }
+
+          if (n == num-1 || src[n+1] != last) {
+               if (count > 2 || (count > 1 && last == RLE32_KEY)) {
+                    dst[out++] = RLE32_KEY;
+                    dst[out++] = count;
+                    dst[out++] = last;
+               }
+               else {
+                    if (count > 1 || last == RLE32_KEY)
+                         dst[out++] = last;
+
+                    dst[out++] = last;
+               }
+
+               count = 0;
+          }
+     }
+
+     *ret_num = out;
+
+     return true;
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Write( IDirectFBSurface   *thiz,
+                                  const DFBRectangle *rect,
+                                  const void         *ptr,
+                                  int                 pitch )
+{
+     DFBResult    ret = DFB_OK;
+     int          y;
+     DFBRectangle r;
+     DFBSurfacePixelFormat format;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     if (!rect || !ptr)
+          return DFB_INVARG;
+
+     thiz->GetPixelFormat( thiz, &format );
+
+     r.x = rect->x;
+     r.y = rect->y;
+     r.w = rect->w;
+     r.h = 1;
+
+	 /* Use RLE only if Voodoo is not compressed already */
+     switch (voodoo_config->compression_min ? DSPF_UNKNOWN : format) {
+          case DSPF_RGB16:
+          case DSPF_ARGB1555: {
+               unsigned int  num;
+               u16          *buf = (u16*) D_MALLOC( rect->w * 2 );
+
+               if (buf) {
+                    for (y=0; y<rect->h; y++) {
+                         bool encoded = rle16_encode( (u16*)((char*) ptr + y * pitch), buf, rect->w, &num );
+
+                         //D_INFO( "%3d: %u -> %u\n", r.y, rect->w, num );
+
+                         ret = voodoo_manager_request( data->manager, data->instance,
+                                                       IDIRECTFBSURFACE_METHOD_ID_Write, VREQ_QUEUE, NULL,
+                                                       VMBT_UINT, encoded ? 2 : 0,
+                                                       VMBT_DATA, sizeof(DFBRectangle), &r,
+                                                       VMBT_DATA, DFB_BYTES_PER_LINE( format, num ),
+                                                                  encoded ? buf : (u16*)((char*) ptr + y * pitch),
+                                                       VMBT_INT, ABS(pitch),
+                                                       VMBT_NONE );
+                         if (ret)
+                              break;
+
+                         r.y++;
+                    }
+
+                    D_FREE( buf );
+               }
+               else
+                    D_OOM();
+
+               break;
+          }
+
+          case DSPF_RGB32:
+          case DSPF_ARGB: {
+               unsigned int  num;
+               u32          *buf = (u32*) D_MALLOC( rect->w * 4 );
+
+               if (buf) {
+                    for (y=0; y<rect->h; y++) {
+                         bool encoded = rle32_encode( (u32*)((char*) ptr + y * pitch), buf, rect->w, &num );
+
+                         //D_INFO( "%3d: %u -> %u\n", r.y, rect->w, num );
+
+                         ret = voodoo_manager_request( data->manager, data->instance,
+                                                       IDIRECTFBSURFACE_METHOD_ID_Write, VREQ_QUEUE, NULL,
+                                                       VMBT_UINT, encoded ? 4 : 0,
+                                                       VMBT_DATA, sizeof(DFBRectangle), &r,
+                                                       VMBT_DATA, DFB_BYTES_PER_LINE( format, num ),
+                                                                  encoded ? buf : (u32*)((char*) ptr + y * pitch),
+                                                       VMBT_INT, ABS(pitch),
+                                                       VMBT_NONE );
+                         if (ret)
+                              break;
+
+                         r.y++;
+                    }
+
+                    D_FREE( buf );
+               }
+               else
+                    D_OOM();
+
+               break;
+          }
+
+          default:
+               for (y=0; y<rect->h; y++) {
+                    ret = voodoo_manager_request( data->manager, data->instance,
+                                                  IDIRECTFBSURFACE_METHOD_ID_Write, VREQ_QUEUE, NULL,
+                                                  VMBT_UINT, false,
+                                                  VMBT_DATA, sizeof(DFBRectangle), &r,
+                                                  VMBT_DATA, DFB_BYTES_PER_LINE( format, rect->w ), (char*) ptr + y * pitch,
+                                                  VMBT_INT, ABS(pitch),
+                                                  VMBT_NONE );
+                    if (ret)
+                         break;
+
+                    r.y++;
+               }
+               break;
+     }
+
+     return ret;
+}
+
+
+#define RLE16_KEY   0xf001
+
+static void
+rle16_decode( const u16    *src,
+              u16          *dst,
+              unsigned int  num )
+{
+     unsigned int n = 0, last, count, out = 0;
+
+     while (out < num) {
+          last = src[n++];
+
+          if (last == RLE16_KEY) {
+               count = src[n++];
+
+               if (count == RLE16_KEY) {
+                    dst[out++] = RLE16_KEY;
+               }
+               else {
+                    last = src[n++];
+
+                    while (count >= 4) {
+                         dst[out+0] =
+                         dst[out+1] =
+                         dst[out+2] =
+                         dst[out+3] = last;
+
+                         out   += 4;
+                         count -= 4;
+                    }
+
+                    while (count >= 2) {
+                         dst[out+0] =
+                         dst[out+1] = last;
+
+                         out   += 2;
+                         count -= 2;
+                    }
+
+                    while (count--)
+                         dst[out++] = last;
+               }
+          }
+          else
+               dst[out++] = last;
+     }
+
+     D_ASSERT( out == num );
+}
+
+#define RLE32_KEY   0xf0012345
+
+static void
+rle32_decode( const u32    *src,
+              u32          *dst,
+              unsigned int  num )
+{
+     unsigned int n = 0, last, count, out = 0;
+
+     while (out < num) {
+          last = src[n++];
+
+          if (last == RLE32_KEY) {
+               count = src[n++];
+
+               if (count == RLE32_KEY) {
+                    dst[out++] = RLE32_KEY;
+               }
+               else {
+                    last = src[n++];
+
+                    while (count >= 4) {
+                         dst[out+0] =
+                         dst[out+1] =
+                         dst[out+2] =
+                         dst[out+3] = last;
+
+                         out   += 4;
+                         count -= 4;
+                    }
+
+                    while (count >= 2) {
+                         dst[out+0] =
+                         dst[out+1] = last;
+
+                         out   += 2;
+                         count -= 2;
+                    }
+
+                    while (count--)
+                         dst[out++] = last;
+               }
+          }
+          else
+               dst[out++] = last;
+     }
+
+     D_ASSERT( out == num );
+}
+
+static DFBResult
+IDirectFBSurface_Requestor_Read( IDirectFBSurface   *thiz,
+                                 const DFBRectangle *rect,
+                                 void               *ptr,
+                                 int                 pitch )
+{
+     DFBResult              ret = DFB_OK;
+     int                    y;
+     DFBSurfacePixelFormat  format;
+     VoodooMessageParser    parser;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     D_DEBUG_AT( IDirectFBSurface_Requestor_, "%s( %p, %p, %d )\n", __FUNCTION__, rect, ptr, pitch );
+
+     if (!rect || !ptr)
+          return DFB_INVARG;
+
+     D_DEBUG_AT( IDirectFBSurface_Requestor_, "  -> %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS(rect) );
+
+     thiz->GetPixelFormat( thiz, &format );
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBSURFACE_METHOD_ID_Read, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(DFBRectangle), rect,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     for (y=0; y<rect->h; y++) {
+          unsigned int  encoded;
+          const void   *buf;
+
+          D_DEBUG_AT( IDirectFBSurface_Requestor_, "  -> [%d]\n", y );
+
+          VOODOO_PARSER_BEGIN( parser, response );
+          VOODOO_PARSER_GET_UINT( parser, encoded );
+          VOODOO_PARSER_GET_DATA( parser, buf );
+          VOODOO_PARSER_END( parser );
+
+          ret = response->result;
+          if (ret)
+               break;
+
+
+          if (encoded) {
+               switch (encoded) {
+                    case 2:
+                         rle16_decode( buf, (u16*)((char*) ptr + pitch * y), rect->w );
+                         break;
+
+                    case 4:
+                         rle32_decode( buf, (u32*)((char*) ptr + pitch * y), rect->w );
+                         break;
+
+                    default:
+                         D_UNIMPLEMENTED();
+                         break;
+               }
+          }
+          else
+               direct_memcpy( (char*) ptr + pitch * y, buf, DFB_BYTES_PER_LINE(format, rect->w) );
+
+
+          if (y < rect->h - 1)
+               voodoo_manager_next_response( data->manager, response, &response );
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_FlipNotify( IDirectFBSurface *thiz, IDirectFBSurface *real,
+                     VoodooManager *manager, VoodooRequestMessage *msg )
+{
+     VoodooMessageParser parser;
+     unsigned int        millis;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Requestor)
+
+     direct_mutex_lock( &data->flip.lock );
+
+
+     VOODOO_PARSER_BEGIN( parser, msg );
+     VOODOO_PARSER_GET_UINT( parser, millis );
+     VOODOO_PARSER_END( parser );
+
+
+     Handle_FlipReturned( thiz, millis );
+
+
+     direct_mutex_unlock( &data->flip.lock );
+
+     direct_waitqueue_signal( &data->flip.queue );
+
+     return DR_OK;
+}
+
+static DirectResult
+LocalDispatch( void                 *dispatcher,
+               void                 *real,
+               VoodooManager        *manager,
+               VoodooRequestMessage *msg )
+{
+     D_DEBUG( "IDirectFBSurface_Requestor/LocalDispatch: "
+              "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+     switch (msg->method) {
+          case IDIRECTFBSURFACE_REQUESTOR_METHOD_ID_FlipNotify:
+               return Dispatch_FlipNotify( real, real, manager, msg );
+     }
+
+     return DFB_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBSurface *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DFBResult              ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBSurface_Requestor)
+
+     data->ref       = 1;
+     data->manager   = manager;
+     data->instance  = instance;
+     data->idirectfb = arg;
+
+
+     direct_mutex_init( &data->flip.lock );
+     direct_waitqueue_init( &data->flip.queue );
+
+     if (dfb_config->flip_notify_max_latency) {
+          ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, NULL, thiz, LocalDispatch, &data->local );
+          if (ret) {
+               D_DERROR( ret, "IDirectFBSurface_Requestor: Could not register local dispatch!\n" );
+               DIRECT_DEALLOCATE_INTERFACE( thiz );
+               return ret;
+          }
+
+          ret = voodoo_manager_request( manager, instance,
+                                        IDIRECTFBSURFACE_METHOD_ID_SetRemoteInstance, VREQ_RESPOND, &response,
+                                        VMBT_ID, data->local,
+                                        VMBT_NONE );
+          if (ret)
+               D_DERROR( ret, "IDirectFBSurface_Requestor: Could not set remote instance, FlipNotify not used!\n" );
+          else if (response->result)
+               D_DERROR( response->result, "IDirectFBSurface_Requestor: Could not set remote instance, FlipNotify not used!\n" );
+          else {
+               D_INFO( "IDirectFBSurface_Requestor: Using FlipNotify\n" );
+
+               data->flip.use_notify = true;
+          }
+
+          voodoo_manager_finish_request( manager, response );
+
+          /*
+           * Implement fallback for missing FlipNotify support via event buffer and hidden window
+           */
+          if (!data->flip.use_notify) {
+               DFBWindowDescription   desc;
+               IDirectFBDisplayLayer *layer;
+
+               ret = data->idirectfb->CreateEventBuffer( data->idirectfb, &data->flip.buffer );
+               if (ret) {
+                    D_DERROR( ret, "IDirectFBSurface_Requestor: Could not create event buffer for FlipNotify fallback!\n" );
+                    DIRECT_DEALLOCATE_INTERFACE( thiz );
+                    return ret;
+               }
+
+               ret = data->idirectfb->GetDisplayLayer( data->idirectfb, DLID_PRIMARY, &layer );
+               if (ret) {
+                    D_DERROR( ret, "IDirectFBSurface_Requestor: Could not get display layer for FlipNotify fallback!\n" );
+                    DIRECT_DEALLOCATE_INTERFACE( thiz );
+                    return ret;
+               }
+
+               desc.flags = DWDESC_CAPS;
+               desc.caps  = DWCAPS_INPUTONLY | DWCAPS_NODECORATION;
+
+               ret = layer->CreateWindow( layer, &desc, &data->flip.window );
+               if (ret) {
+                    D_DERROR( ret, "IDirectFBSurface_Requestor: Could not create window for FlipNotify fallback!\n" );
+                    DIRECT_DEALLOCATE_INTERFACE( thiz );
+                    return ret;
+               }
+
+               ret = data->flip.window->AttachEventBuffer( data->flip.window, data->flip.buffer );
+               if (ret) {
+                    D_DERROR( ret, "IDirectFBSurface_Requestor: Could not attach event buffer for FlipNotify fallback!\n" );
+                    DIRECT_DEALLOCATE_INTERFACE( thiz );
+                    return ret;
+               }
+
+               layer->Release( layer );
+
+
+               D_INFO( "IDirectFBSurface_Requestor: Using FlipNotify fallback via event buffer/window!\n" );
+
+               data->flip.use_buffer = true;
+          }
+     }
+
+     thiz->AddRef = IDirectFBSurface_Requestor_AddRef;
+     thiz->Release = IDirectFBSurface_Requestor_Release;
+
+     thiz->GetCapabilities = IDirectFBSurface_Requestor_GetCapabilities;
+     thiz->GetPosition = IDirectFBSurface_Requestor_GetPosition;
+     thiz->GetSize = IDirectFBSurface_Requestor_GetSize;
+     thiz->GetVisibleRectangle = IDirectFBSurface_Requestor_GetVisibleRectangle;
+     thiz->GetPixelFormat = IDirectFBSurface_Requestor_GetPixelFormat;
+     thiz->GetAccelerationMask = IDirectFBSurface_Requestor_GetAccelerationMask;
+
+     thiz->GetPalette = IDirectFBSurface_Requestor_GetPalette;
+     thiz->SetPalette = IDirectFBSurface_Requestor_SetPalette;
+     thiz->SetAlphaRamp = IDirectFBSurface_Requestor_SetAlphaRamp;
+
+     thiz->Lock = IDirectFBSurface_Requestor_Lock;
+     thiz->GetFramebufferOffset = IDirectFBSurface_Requestor_GetFramebufferOffset;
+     thiz->Unlock = IDirectFBSurface_Requestor_Unlock;
+     thiz->Flip = IDirectFBSurface_Requestor_Flip;
+     thiz->SetField = IDirectFBSurface_Requestor_SetField;
+     thiz->Clear = IDirectFBSurface_Requestor_Clear;
+
+     thiz->SetClip = IDirectFBSurface_Requestor_SetClip;
+     thiz->SetColor = IDirectFBSurface_Requestor_SetColor;
+     thiz->SetColorIndex = IDirectFBSurface_Requestor_SetColorIndex;
+     thiz->SetSrcBlendFunction = IDirectFBSurface_Requestor_SetSrcBlendFunction;
+     thiz->SetDstBlendFunction = IDirectFBSurface_Requestor_SetDstBlendFunction;
+     thiz->SetPorterDuff = IDirectFBSurface_Requestor_SetPorterDuff;
+     thiz->SetSrcColorKey = IDirectFBSurface_Requestor_SetSrcColorKey;
+     thiz->SetSrcColorKeyIndex = IDirectFBSurface_Requestor_SetSrcColorKeyIndex;
+     thiz->SetDstColorKey = IDirectFBSurface_Requestor_SetDstColorKey;
+     thiz->SetDstColorKeyIndex = IDirectFBSurface_Requestor_SetDstColorKeyIndex;
+
+     thiz->SetBlittingFlags = IDirectFBSurface_Requestor_SetBlittingFlags;
+     thiz->Blit = IDirectFBSurface_Requestor_Blit;
+     thiz->TileBlit = IDirectFBSurface_Requestor_TileBlit;
+     thiz->BatchBlit = IDirectFBSurface_Requestor_BatchBlit;
+     thiz->StretchBlit = IDirectFBSurface_Requestor_StretchBlit;
+     thiz->TextureTriangles = IDirectFBSurface_Requestor_TextureTriangles;
+
+     thiz->SetDrawingFlags = IDirectFBSurface_Requestor_SetDrawingFlags;
+     thiz->FillRectangle = IDirectFBSurface_Requestor_FillRectangle;
+     thiz->FillRectangles = IDirectFBSurface_Requestor_FillRectangles;
+     thiz->FillSpans = IDirectFBSurface_Requestor_FillSpans;
+     thiz->DrawLine = IDirectFBSurface_Requestor_DrawLine;
+     thiz->DrawLines = IDirectFBSurface_Requestor_DrawLines;
+     thiz->DrawRectangle = IDirectFBSurface_Requestor_DrawRectangle;
+     thiz->FillTriangle = IDirectFBSurface_Requestor_FillTriangle;
+
+     thiz->SetFont = IDirectFBSurface_Requestor_SetFont;
+     thiz->GetFont = IDirectFBSurface_Requestor_GetFont;
+     thiz->DrawString = IDirectFBSurface_Requestor_DrawString;
+     thiz->DrawGlyph = IDirectFBSurface_Requestor_DrawGlyph;
+     thiz->SetEncoding = IDirectFBSurface_Requestor_SetEncoding;
+
+     thiz->GetSubSurface = IDirectFBSurface_Requestor_GetSubSurface;
+
+     thiz->GetGL = IDirectFBSurface_Requestor_GetGL;
+
+     thiz->Dump = IDirectFBSurface_Requestor_Dump;
+
+     thiz->DisableAcceleration = IDirectFBSurface_Requestor_DisableAcceleration;
+
+     thiz->ReleaseSource = IDirectFBSurface_Requestor_ReleaseSource;
+
+     thiz->SetIndexTranslation = IDirectFBSurface_Requestor_SetIndexTranslation;
+
+     thiz->SetRenderOptions = IDirectFBSurface_Requestor_SetRenderOptions;
+     thiz->SetMatrix = IDirectFBSurface_Requestor_SetMatrix;
+
+     thiz->Read  = IDirectFBSurface_Requestor_Read;
+     thiz->Write = IDirectFBSurface_Requestor_Write;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.h
new file mode 100755
index 0000000..27599a9
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbsurface_requestor.h
@@ -0,0 +1,80 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBSURFACE_REQUESTOR_H__
+#define __IDIRECTFBSURFACE_REQUESTOR_H__
+
+#include <directfb.h>
+
+#include <direct/thread.h>
+
+#include <voodoo/manager.h>
+
+#define IDIRECTFBSURFACE_REQUESTOR_METHOD_ID_FlipNotify     1
+
+/*
+ * private data struct of IDirectFBSurface_Requestor
+ */
+typedef struct {
+     int                    ref;      /* reference counter */
+
+     IDirectFB             *idirectfb;
+
+     VoodooManager         *manager;
+     VoodooInstanceID       instance;
+     VoodooInstanceID       local;
+
+     IDirectFBFont         *font;
+
+     DFBSurfacePixelFormat  format;
+
+     struct {
+          bool                   use_notify;
+
+          DirectMutex            lock;
+          DirectWaitQueue        queue;
+
+          unsigned int           requested;
+          unsigned int           returned;
+          unsigned int           end;
+
+          long long              fps_stamp;
+          unsigned int           fps_count;
+          unsigned int           fps_old;
+
+
+
+          bool                   use_buffer;
+
+          IDirectFBEventBuffer  *buffer;
+          IDirectFBWindow       *window;
+     } flip;
+} IDirectFBSurface_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.c b/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.c
new file mode 100755
index 0000000..08e4ff2
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.c
@@ -0,0 +1,1120 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <voodoo/client.h>
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+
+#include <input/idirectfbinputbuffer.h>
+
+#include <idirectfbeventbuffer_dispatcher.h>
+#include <idirectfbwindow_dispatcher.h>
+
+#include "idirectfbsurface_requestor.h"
+#include "idirectfbwindow_requestor.h"
+
+
+static DFBResult Probe( void );
+static DFBResult Construct( IDirectFBWindow  *thiz,
+                            VoodooManager    *manager,
+                            VoodooInstanceID  instance,
+                            void             *arg );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBWindow, Requestor )
+
+
+/**************************************************************************************************/
+
+static void
+IDirectFBWindow_Requestor_Destruct( IDirectFBWindow *thiz )
+{
+     IDirectFBWindow_Requestor_data *data = thiz->priv;
+
+     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+     voodoo_manager_request( data->manager, data->instance,
+                             IDIRECTFBWINDOW_METHOD_ID_Release, VREQ_NONE, NULL,
+                             VMBT_NONE );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IDirectFBWindow_Requestor_AddRef( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindow_Requestor_Release( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (--data->ref == 0)
+          IDirectFBWindow_Requestor_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_CreateEventBuffer( IDirectFBWindow       *thiz,
+                                             IDirectFBEventBuffer **ret_interface )
+{
+     DFBResult              ret;
+     IDirectFBEventBuffer  *buffer;
+     IDirectFBEventBuffer  *dispatcher;
+     VoodooInstanceID       instance;
+     VoodooResponseMessage *response;
+     void                  *ptr;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     /* Create the real interface. */
+     DIRECT_ALLOCATE_INTERFACE( buffer, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( buffer, NULL, NULL );
+
+     /* Create the dispatcher. */
+     ret = voodoo_construct_dispatcher( data->manager, "IDirectFBEventBuffer",
+                                        buffer, data->instance, NULL, &instance, &ptr );
+     if (ret) {
+          buffer->Release( buffer );
+          return ret;
+     }
+
+     dispatcher = ptr;
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_CreateEventBuffer, VREQ_RESPOND, &response,
+                                   VMBT_ID,  instance,
+                                   VMBT_NONE );
+     if (ret) {
+          dispatcher->Release( dispatcher );
+          return ret;
+     }
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     /* Return the dispatcher interface. */
+     *ret_interface = dispatcher;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_AttachEventBuffer( IDirectFBWindow      *thiz,
+                                             IDirectFBEventBuffer *buffer )
+{
+     DFBResult                             ret;
+     IDirectFBEventBuffer_Dispatcher_data *buffer_data;
+     VoodooResponseMessage                *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!buffer)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Dispatcher );
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_AttachEventBuffer, VREQ_RESPOND, &response,
+                                   VMBT_ID, buffer_data->self,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_DetachEventBuffer( IDirectFBWindow      *thiz,
+                                             IDirectFBEventBuffer *buffer )
+{
+     DFBResult                             ret;
+     IDirectFBEventBuffer_Dispatcher_data *buffer_data;
+     VoodooResponseMessage                *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!buffer)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( buffer, buffer_data, IDirectFBEventBuffer_Dispatcher );
+
+     /* Send the request including the instance ID of the dispatcher. */
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_DetachEventBuffer, VREQ_RESPOND, &response,
+                                   VMBT_ID, buffer_data->self,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_EnableEvents( IDirectFBWindow       *thiz,
+                                        DFBWindowEventType     mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_EnableEvents, VREQ_NONE, NULL,
+                                    VMBT_UINT, mask,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_DisableEvents( IDirectFBWindow    *thiz,
+                                         DFBWindowEventType  mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetID( IDirectFBWindow *thiz,
+                                 DFBWindowID     *ret_id )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBWindowID            id;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_id)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetID, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_ID( parser, id );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_id = id;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetPosition( IDirectFBWindow *thiz,
+                                       int             *x,
+                                       int             *y )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBPoint        *position;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetPosition, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, position );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (x)
+          *x = position->x;
+
+     if (y)
+          *y = position->y;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetSize( IDirectFBWindow *thiz,
+                                   int             *width,
+                                   int             *height )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const DFBDimension    *size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetSize, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_DATA( parser, size );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     if (width)
+          *width = size->w;
+
+     if (height)
+          *height = size->h;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetSurface( IDirectFBWindow   *thiz,
+                                      IDirectFBSurface **ret_interface )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooInstanceID       instance_id;
+     void                  *interface_ptr = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_interface)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetSurface, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     /* Copy and finish as we do our next request in surface constructor already! */
+     instance_id = response->instance;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     ret = response->result;
+     if (ret == DR_OK)
+          ret = voodoo_construct_requestor( data->manager, "IDirectFBSurface",
+                                            instance_id, data->idirectfb, &interface_ptr );
+
+     *ret_interface = interface_ptr;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetProperty( IDirectFBWindow  *thiz,
+                                       const char       *key,
+                                       void             *value,
+                                       void            **old_value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetProperty( IDirectFBWindow  *thiz,
+                                       const char       *key,
+                                       void            **ret_value )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     const char            *value;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_value)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetProperty, VREQ_RESPOND, &response,
+                                   VMBT_STRING, key,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_STRING( parser, value );
+     VOODOO_PARSER_END( parser );
+
+     *ret_value = D_STRDUP( value );    // FIXME: LEAK
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_RemoveProperty( IDirectFBWindow  *thiz,
+                                          const char       *key,
+                                          void            **value )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetOptions( IDirectFBWindow  *thiz,
+                                      DFBWindowOptions  options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (options & ~DWOP_ALL)
+          return DFB_INVARG;
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_SetOptions, VREQ_NONE, NULL,
+                                    VMBT_INT, options,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetOptions( IDirectFBWindow  *thiz,
+                                      DFBWindowOptions *ret_options )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     DFBWindowOptions       options;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_options)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetOptions, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_INT( parser, options );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_options = options;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetColorKey( IDirectFBWindow *thiz,
+                                       u8               r,
+                                       u8               g,
+                                       u8               b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetColorKeyIndex( IDirectFBWindow *thiz,
+                                            unsigned int     index )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetOpaqueRegion( IDirectFBWindow *thiz,
+                                           int              x1,
+                                           int              y1,
+                                           int              x2,
+                                           int              y2 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetOpacity( IDirectFBWindow *thiz,
+                                      u8               opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_SetOpacity, VREQ_NONE, NULL,
+                                    VMBT_UINT, opacity,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GetOpacity( IDirectFBWindow *thiz,
+                                      u8              *ret_opacity )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+     VoodooMessageParser    parser;
+     u8                     opacity;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!ret_opacity)
+          return DFB_INVARG;
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GetOpacity, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+     if (ret) {
+          voodoo_manager_finish_request( data->manager, response );
+          return ret;
+     }
+
+     VOODOO_PARSER_BEGIN( parser, response );
+     VOODOO_PARSER_GET_UINT( parser, opacity );
+     VOODOO_PARSER_END( parser );
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     *ret_opacity = opacity;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetCursorShape( IDirectFBWindow  *thiz,
+                                          IDirectFBSurface *shape,
+                                          int               hot_x,
+                                          int               hot_y )
+{
+     DFBPoint                         hot = { hot_x, hot_y };
+     DirectResult                     ret;
+     VoodooResponseMessage           *response;
+     IDirectFBSurface_Requestor_data *shape_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     if (!shape)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( shape, shape_data, IDirectFBSurface_Requestor);
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_SetCursorShape, VREQ_RESPOND, &response,
+                                   VMBT_ID, shape_data->instance,
+                                   VMBT_DATA, sizeof(DFBPoint), &hot,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_RequestFocus( IDirectFBWindow *thiz )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_RequestFocus, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_UngrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GrabPointer( IDirectFBWindow *thiz )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_GrabPointer, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_UngrabPointer( IDirectFBWindow *thiz )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_UngrabPointer, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GrabKey( IDirectFBWindow            *thiz,
+                                   DFBInputDeviceKeySymbol     symbol,
+                                   DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_UngrabKey( IDirectFBWindow            *thiz,
+                                     DFBInputDeviceKeySymbol     symbol,
+                                     DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Move( IDirectFBWindow *thiz, int dx, int dy )
+{
+     DFBPoint point = { dx, dy };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_Move, VREQ_NONE, NULL,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_MoveTo( IDirectFBWindow *thiz, int x, int y )
+{
+     DFBPoint point = { x, y };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_MoveTo, VREQ_NONE, NULL,
+                                    VMBT_DATA, sizeof(point), &point,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Resize( IDirectFBWindow *thiz,
+                                  int              width,
+                                  int              height )
+{
+     DirectResult           ret;
+     DFBDimension           size = { width, height };
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_Resize, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(size), &size,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Raise( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_Raise, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetStackingClass( IDirectFBWindow        *thiz,
+                                            DFBWindowStackingClass  stacking_class )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_SetStackingClass, VREQ_NONE, NULL,
+                                    VMBT_INT, stacking_class,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Lower( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_Lower, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_RaiseToTop( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_RaiseToTop, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_LowerToBottom( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_LowerToBottom, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_PutAtop( IDirectFBWindow *thiz,
+                                   IDirectFBWindow *lower )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_PutBelow( IDirectFBWindow *thiz,
+                                    IDirectFBWindow *upper )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     D_UNIMPLEMENTED();
+
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Close( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_Close, VREQ_NONE, NULL,
+                                    VMBT_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Destroy( IDirectFBWindow *thiz )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_Destroy, VREQ_RESPOND, &response,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetBounds( IDirectFBWindow *thiz,
+                                     int x, int y, int w, int h )
+{
+     DirectResult           ret;
+     DFBRectangle           bounds = { x, y, w, h };
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_SetBounds, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(bounds), &bounds,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_ResizeSurface( IDirectFBWindow *thiz,
+                                         int              width,
+                                         int              height )
+{
+     DirectResult           ret;
+     DFBDimension           size = { width, height };
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_ResizeSurface, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(size), &size,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Bind( IDirectFBWindow *thiz,
+                                IDirectFBWindow *source,
+                                int              x,
+                                int              y )
+{
+     D_UNIMPLEMENTED();
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_Unbind( IDirectFBWindow *thiz,
+                                  IDirectFBWindow *source )
+{
+     D_UNIMPLEMENTED();
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetKeySelection( IDirectFBWindow               *thiz,
+                                           DFBWindowKeySelection          selection,
+                                           const DFBInputDeviceKeySymbol *keys,
+                                           unsigned int                   num_keys )
+{
+     D_UNIMPLEMENTED();
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_GrabUnselectedKeys( IDirectFBWindow *thiz )
+{
+     D_UNIMPLEMENTED();
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_UngrabUnselectedKeys( IDirectFBWindow *thiz )
+{
+     D_UNIMPLEMENTED();
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetSrcGeometry( IDirectFBWindow         *thiz,
+                                          const DFBWindowGeometry *geometry )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_SetSrcGeometry, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(DFBWindowGeometry), geometry,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SetDstGeometry( IDirectFBWindow         *thiz,
+                                          const DFBWindowGeometry *geometry )
+{
+     DirectResult           ret;
+     VoodooResponseMessage *response;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     ret = voodoo_manager_request( data->manager, data->instance,
+                                   IDIRECTFBWINDOW_METHOD_ID_SetDstGeometry, VREQ_RESPOND, &response,
+                                   VMBT_DATA, sizeof(DFBWindowGeometry), geometry,
+                                   VMBT_NONE );
+     if (ret)
+          return ret;
+
+     ret = response->result;
+
+     voodoo_manager_finish_request( data->manager, response );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Requestor_SendEvent( IDirectFBWindow      *thiz,
+                                     const DFBWindowEvent *event )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow_Requestor)
+
+     return voodoo_manager_request( data->manager, data->instance,
+                                    IDIRECTFBWINDOW_METHOD_ID_SendEvent, VREQ_NONE, NULL,
+                                    VMBT_DATA, sizeof(DFBWindowEvent), event,
+                                    VMBT_NONE );
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+Probe()
+{
+     /* This implementation has to be loaded explicitly. */
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+Construct( IDirectFBWindow  *thiz,
+           VoodooManager    *manager,
+           VoodooInstanceID  instance,
+           void             *arg )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindow_Requestor)
+
+     data->ref       = 1;
+     data->manager   = manager;
+     data->instance  = instance;
+     data->idirectfb = arg;
+
+     thiz->AddRef             = IDirectFBWindow_Requestor_AddRef;
+     thiz->Release            = IDirectFBWindow_Requestor_Release;
+     thiz->GetID              = IDirectFBWindow_Requestor_GetID;
+     thiz->GetPosition        = IDirectFBWindow_Requestor_GetPosition;
+     thiz->GetSize            = IDirectFBWindow_Requestor_GetSize;
+     thiz->CreateEventBuffer  = IDirectFBWindow_Requestor_CreateEventBuffer;
+     thiz->AttachEventBuffer  = IDirectFBWindow_Requestor_AttachEventBuffer;
+     thiz->DetachEventBuffer  = IDirectFBWindow_Requestor_DetachEventBuffer;
+     thiz->EnableEvents       = IDirectFBWindow_Requestor_EnableEvents;
+     thiz->DisableEvents      = IDirectFBWindow_Requestor_DisableEvents;
+     thiz->GetSurface         = IDirectFBWindow_Requestor_GetSurface;
+     thiz->SetProperty        = IDirectFBWindow_Requestor_SetProperty;
+     thiz->GetProperty        = IDirectFBWindow_Requestor_GetProperty;
+     thiz->RemoveProperty     = IDirectFBWindow_Requestor_RemoveProperty;
+     thiz->SetOptions         = IDirectFBWindow_Requestor_SetOptions;
+     thiz->GetOptions         = IDirectFBWindow_Requestor_GetOptions;
+     thiz->SetColorKey        = IDirectFBWindow_Requestor_SetColorKey;
+     thiz->SetColorKeyIndex   = IDirectFBWindow_Requestor_SetColorKeyIndex;
+     thiz->SetOpaqueRegion    = IDirectFBWindow_Requestor_SetOpaqueRegion;
+     thiz->SetOpacity         = IDirectFBWindow_Requestor_SetOpacity;
+     thiz->GetOpacity         = IDirectFBWindow_Requestor_GetOpacity;
+     thiz->SetCursorShape     = IDirectFBWindow_Requestor_SetCursorShape;
+     thiz->RequestFocus       = IDirectFBWindow_Requestor_RequestFocus;
+     thiz->GrabKeyboard       = IDirectFBWindow_Requestor_GrabKeyboard;
+     thiz->UngrabKeyboard     = IDirectFBWindow_Requestor_UngrabKeyboard;
+     thiz->GrabPointer        = IDirectFBWindow_Requestor_GrabPointer;
+     thiz->UngrabPointer      = IDirectFBWindow_Requestor_UngrabPointer;
+     thiz->GrabKey            = IDirectFBWindow_Requestor_GrabKey;
+     thiz->UngrabKey          = IDirectFBWindow_Requestor_UngrabKey;
+     thiz->Move               = IDirectFBWindow_Requestor_Move;
+     thiz->MoveTo             = IDirectFBWindow_Requestor_MoveTo;
+     thiz->Resize             = IDirectFBWindow_Requestor_Resize;
+     thiz->SetStackingClass   = IDirectFBWindow_Requestor_SetStackingClass;
+     thiz->Raise              = IDirectFBWindow_Requestor_Raise;
+     thiz->Lower              = IDirectFBWindow_Requestor_Lower;
+     thiz->RaiseToTop         = IDirectFBWindow_Requestor_RaiseToTop;
+     thiz->LowerToBottom      = IDirectFBWindow_Requestor_LowerToBottom;
+     thiz->PutAtop            = IDirectFBWindow_Requestor_PutAtop;
+     thiz->PutBelow           = IDirectFBWindow_Requestor_PutBelow;
+     thiz->Close              = IDirectFBWindow_Requestor_Close;
+     thiz->Destroy            = IDirectFBWindow_Requestor_Destroy;
+     thiz->SetBounds          = IDirectFBWindow_Requestor_SetBounds;
+     thiz->ResizeSurface      = IDirectFBWindow_Requestor_ResizeSurface;
+     thiz->Bind               = IDirectFBWindow_Requestor_Bind;
+     thiz->Unbind             = IDirectFBWindow_Requestor_Unbind;
+     thiz->SetKeySelection    = IDirectFBWindow_Requestor_SetKeySelection;
+     thiz->GrabUnselectedKeys = IDirectFBWindow_Requestor_GrabUnselectedKeys;
+     thiz->UngrabUnselectedKeys = IDirectFBWindow_Requestor_UngrabUnselectedKeys;
+     thiz->SetSrcGeometry      = IDirectFBWindow_Requestor_SetSrcGeometry;
+     thiz->SetDstGeometry      = IDirectFBWindow_Requestor_SetDstGeometry;
+     thiz->SendEvent          = IDirectFBWindow_Requestor_SendEvent;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.h b/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.h
new file mode 100755
index 0000000..8499a69
--- /dev/null
+++ b/Source/DirectFB/proxy/requestor/idirectfbwindow_requestor.h
@@ -0,0 +1,47 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOW_REQUESTOR_H__
+#define __IDIRECTFBWINDOW_REQUESTOR_H__
+
+#include <voodoo/manager.h>
+
+/*
+ * private data struct of IDirectFBWindow_Requestor
+ */
+typedef struct {
+     int                  ref;      /* reference counter */
+
+     IDirectFB           *idirectfb;
+
+     VoodooManager       *manager;
+     VoodooInstanceID     instance;
+} IDirectFBWindow_Requestor_data;
+
+#endif
+
diff --git a/Source/DirectFB/rules/Makefile.am b/Source/DirectFB/rules/Makefile.am
new file mode 100755
index 0000000..55e6061
--- /dev/null
+++ b/Source/DirectFB/rules/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = libobject.make
diff --git a/Source/DirectFB/rules/Makefile.in b/Source/DirectFB/rules/Makefile.in
new file mode 100755
index 0000000..a1a87ea
--- /dev/null
+++ b/Source/DirectFB/rules/Makefile.in
@@ -0,0 +1,398 @@
+# 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@
+subdir = rules
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+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@
+EXTRA_DIST = libobject.make
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  rules/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  rules/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# 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/rules/libobject.make b/Source/DirectFB/rules/libobject.make
new file mode 100755
index 0000000..bc670da
--- /dev/null
+++ b/Source/DirectFB/rules/libobject.make
@@ -0,0 +1,9 @@
+%.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)
diff --git a/Source/DirectFB/rules/nmfile.make b/Source/DirectFB/rules/nmfile.make
new file mode 100755
index 0000000..bd435de
--- /dev/null
+++ b/Source/DirectFB/rules/nmfile.make
@@ -0,0 +1,11 @@
+if BUILD_SHARED
+if ENABLE_TRACE
+
+LIBTONM = $(LTLIBRARIES:.la=-$(LT_RELEASE).so.$(LT_BINARY))
+
+install-data-local:
+	mkdir -p -- "$(DESTDIR)$(libdir)"
+	nm -n ".libs/$(LIBTONM)" > "$(DESTDIR)$(libdir)/nm-n.$(LIBTONM)"
+
+endif
+endif
diff --git a/Source/DirectFB/src/Makefile.am b/Source/DirectFB/src/Makefile.am
new file mode 100755
index 0000000..8f506e6
--- /dev/null
+++ b/Source/DirectFB/src/Makefile.am
@@ -0,0 +1,73 @@
+## Makefile.am for DirectFB/src
+
+SUBDIRS = core display gfx input media misc windows
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)
+
+internalinclude_HEADERS = \
+	idirectfb.h
+
+
+lib_LTLIBRARIES = libdirectfb.la
+
+libdirectfb_la_SOURCES = 	\
+	directfb.c		\
+	idirectfb.c
+
+libdirectfb_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+libdirectfb_la_LIBADD = \
+	display/libdirectfb_display.la	\
+	media/libdirectfb_media.la	\
+	windows/libdirectfb_windows.la	\
+	input/libdirectfb_input.la	\
+	misc/libdirectfb_misc.la	\
+	gfx/libdirectfb_gfx.la		\
+	core/libdirectfb_core.la	\
+	../lib/direct/libdirect.la	\
+	../lib/fusion/libfusion.la
+
+
+#
+## and now rebuild the static version with the *correct* object files
+#
+if BUILD_STATIC
+
+clean-local:
+	rm -f libdirectfb_fixed.a
+
+all-local: libdirectfb_fixed.a
+
+libdirectfb_fixed.a: .libs/libdirectfb.a
+	rm -f libdirectfb_fixed.a
+	${AR} cru libdirectfb_fixed.a `find . -name "*.o" | grep -v '.libs'`
+	${RANLIB} libdirectfb_fixed.a
+	cp -pf libdirectfb_fixed.a .libs/libdirectfb.a
+
+.libs/libdirectfb.a: libdirectfb.la
+
+else
+
+clean-local:
+
+all-local:
+
+endif
+
+
+include $(top_srcdir)/rules/nmfile.make
diff --git a/Source/DirectFB/src/Makefile.in b/Source/DirectFB/src/Makefile.in
new file mode 100755
index 0000000..9fb3b04
--- /dev/null
+++ b/Source/DirectFB/src/Makefile.in
@@ -0,0 +1,745 @@
+# 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 = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/rules/nmfile.make
+subdir = src
+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)$(libdir)" \
+	"$(DESTDIR)$(internalincludedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libdirectfb_la_DEPENDENCIES = display/libdirectfb_display.la \
+	media/libdirectfb_media.la windows/libdirectfb_windows.la \
+	input/libdirectfb_input.la misc/libdirectfb_misc.la \
+	gfx/libdirectfb_gfx.la core/libdirectfb_core.la \
+	../lib/direct/libdirect.la ../lib/fusion/libfusion.la
+am_libdirectfb_la_OBJECTS = directfb.lo idirectfb.lo
+libdirectfb_la_OBJECTS = $(am_libdirectfb_la_OBJECTS)
+libdirectfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_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_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = core display gfx input media misc windows
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"	\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"
+
+internalincludedir = $(INTERNALINCLUDEDIR)
+internalinclude_HEADERS = \
+	idirectfb.h
+
+lib_LTLIBRARIES = libdirectfb.la
+libdirectfb_la_SOURCES = \
+	directfb.c		\
+	idirectfb.c
+
+libdirectfb_la_LDFLAGS = \
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
+	-release $(LT_RELEASE)					\
+	$(DFB_LDFLAGS)
+
+libdirectfb_la_LIBADD = \
+	display/libdirectfb_display.la	\
+	media/libdirectfb_media.la	\
+	windows/libdirectfb_windows.la	\
+	input/libdirectfb_input.la	\
+	misc/libdirectfb_misc.la	\
+	gfx/libdirectfb_gfx.la		\
+	core/libdirectfb_core.la	\
+	../lib/direct/libdirect.la	\
+	../lib/fusion/libfusion.la
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@LIBTONM = $(LTLIBRARIES:.la=-$(LT_RELEASE).so.$(LT_BINARY))
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/nmfile.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  src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/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-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_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.la: $(libdirectfb_la_OBJECTS) $(libdirectfb_la_DEPENDENCIES) 
+	$(libdirectfb_la_LINK) -rpath $(libdir) $(libdirectfb_la_OBJECTS) $(libdirectfb_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/directfb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfb.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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."
+@BUILD_SHARED_FALSE@install-data-local:
+@ENABLE_TRACE_FALSE@install-data-local:
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-internalincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-internalincludeHEADERS \
+	uninstall-libLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am all-local check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool clean-local ctags \
+	ctags-recursive 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-data-local install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-internalincludeHEADERS \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am \
+	uninstall-internalincludeHEADERS uninstall-libLTLIBRARIES
+
+
+#
+#
+
+@BUILD_STATIC_TRUE@clean-local:
+@BUILD_STATIC_TRUE@	rm -f libdirectfb_fixed.a
+
+@BUILD_STATIC_TRUE@all-local: libdirectfb_fixed.a
+
+@BUILD_STATIC_TRUE@libdirectfb_fixed.a: .libs/libdirectfb.a
+@BUILD_STATIC_TRUE@	rm -f libdirectfb_fixed.a
+@BUILD_STATIC_TRUE@	${AR} cru libdirectfb_fixed.a `find . -name "*.o" | grep -v '.libs'`
+@BUILD_STATIC_TRUE@	${RANLIB} libdirectfb_fixed.a
+@BUILD_STATIC_TRUE@	cp -pf libdirectfb_fixed.a .libs/libdirectfb.a
+
+@BUILD_STATIC_TRUE@.libs/libdirectfb.a: libdirectfb.la
+
+@BUILD_STATIC_FALSE@clean-local:
+
+@BUILD_STATIC_FALSE@all-local:
+
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@install-data-local:
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	mkdir -p -- "$(DESTDIR)$(libdir)"
+@BUILD_SHARED_TRUE@@ENABLE_TRACE_TRUE@	nm -n ".libs/$(LIBTONM)" > "$(DESTDIR)$(libdir)/nm-n.$(LIBTONM)"
+# 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/src/core/Makefile.am b/Source/DirectFB/src/core/Makefile.am
new file mode 100755
index 0000000..e387345
--- /dev/null
+++ b/Source/DirectFB/src/core/Makefile.am
@@ -0,0 +1,84 @@
+## Makefile.am for DirectFB/src/core
+
+INCLUDES = \
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"		\
+	-DSOPATH=\"@SOPATH@\"		\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"	\
+	"-DBUILDTIME=\"`date -u "+%Y-%m-%d %H:%M"`\""
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/core
+
+internalinclude_HEADERS = \
+	clipboard.h		\
+	colorhash.h		\
+	coredefs.h		\
+	coretypes.h		\
+	core_parts.h		\
+	core_system.h		\
+	core.h			\
+	fonts.h			\
+	gfxcard.h		\
+	graphics_driver.h	\
+	input.h			\
+	input_driver.h		\
+	layer_context.h		\
+	layer_control.h		\
+	layer_region.h		\
+	layers.h		\
+	layers_internal.h	\
+	palette.h		\
+	screen.h		\
+	screens.h		\
+	screens_internal.h	\
+	state.h			\
+	surface.h		\
+	surface_buffer.h	\
+	surface_pool.h		\
+	surface_pool_bridge.h	\
+	system.h		\
+	windows.h		\
+	windows_internal.h	\
+	windowstack.h		\
+	wm.h			\
+	wm_module.h
+
+
+noinst_LTLIBRARIES = libdirectfb_core.la
+
+
+libdirectfb_core_la_SOURCES = \
+	clipboard.c		\
+	colorhash.c		\
+	core.c			\
+	core_parts.c		\
+	fonts.c			\
+	gfxcard.c		\
+	input.c			\
+	layer_context.c		\
+	layer_control.c		\
+	layer_region.c		\
+	layers.c		\
+	local_surface_pool.c	\
+	palette.c		\
+	prealloc_surface_pool.c	\
+	screen.c		\
+	screens.c		\
+	shared_surface_pool.c	\
+	state.c			\
+	surface.c		\
+	surface_buffer.c	\
+	surface_core.c		\
+	surface_pool.c		\
+	surface_pool_bridge.c	\
+	system.c		\
+	windows.c		\
+	windowstack.c		\
+	wm.c
diff --git a/Source/DirectFB/src/core/Makefile.in b/Source/DirectFB/src/core/Makefile.in
new file mode 100755
index 0000000..9955d0b
--- /dev/null
+++ b/Source/DirectFB/src/core/Makefile.in
@@ -0,0 +1,648 @@
+# 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@
+subdir = src/core
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_core_la_LIBADD =
+am_libdirectfb_core_la_OBJECTS = clipboard.lo colorhash.lo core.lo \
+	core_parts.lo fonts.lo gfxcard.lo input.lo layer_context.lo \
+	layer_control.lo layer_region.lo layers.lo \
+	local_surface_pool.lo palette.lo prealloc_surface_pool.lo \
+	screen.lo screens.lo shared_surface_pool.lo state.lo \
+	surface.lo surface_buffer.lo surface_core.lo surface_pool.lo \
+	surface_pool_bridge.lo system.lo windows.lo windowstack.lo \
+	wm.lo
+libdirectfb_core_la_OBJECTS = $(am_libdirectfb_core_la_OBJECTS)
+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_core_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_core_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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_builddir)/lib		\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"		\
+	-DSOPATH=\"@SOPATH@\"		\
+	-DMODULEDIR=\"${RUNTIME_SYSROOT}@MODULEDIR@\"	\
+	"-DBUILDTIME=\"`date -u "+%Y-%m-%d %H:%M"`\""
+
+internalincludedir = $(INTERNALINCLUDEDIR)/core
+internalinclude_HEADERS = \
+	clipboard.h		\
+	colorhash.h		\
+	coredefs.h		\
+	coretypes.h		\
+	core_parts.h		\
+	core_system.h		\
+	core.h			\
+	fonts.h			\
+	gfxcard.h		\
+	graphics_driver.h	\
+	input.h			\
+	input_driver.h		\
+	layer_context.h		\
+	layer_control.h		\
+	layer_region.h		\
+	layers.h		\
+	layers_internal.h	\
+	palette.h		\
+	screen.h		\
+	screens.h		\
+	screens_internal.h	\
+	state.h			\
+	surface.h		\
+	surface_buffer.h	\
+	surface_pool.h		\
+	surface_pool_bridge.h	\
+	system.h		\
+	windows.h		\
+	windows_internal.h	\
+	windowstack.h		\
+	wm.h			\
+	wm_module.h
+
+noinst_LTLIBRARIES = libdirectfb_core.la
+libdirectfb_core_la_SOURCES = \
+	clipboard.c		\
+	colorhash.c		\
+	core.c			\
+	core_parts.c		\
+	fonts.c			\
+	gfxcard.c		\
+	input.c			\
+	layer_context.c		\
+	layer_control.c		\
+	layer_region.c		\
+	layers.c		\
+	local_surface_pool.c	\
+	palette.c		\
+	prealloc_surface_pool.c	\
+	screen.c		\
+	screens.c		\
+	shared_surface_pool.c	\
+	state.c			\
+	surface.c		\
+	surface_buffer.c	\
+	surface_core.c		\
+	surface_pool.c		\
+	surface_pool_bridge.c	\
+	system.c		\
+	windows.c		\
+	windowstack.c		\
+	wm.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/core/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/core/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_core.la: $(libdirectfb_core_la_OBJECTS) $(libdirectfb_core_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_core_la_OBJECTS) $(libdirectfb_core_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clipboard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colorhash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core_parts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfxcard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer_context.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer_control.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer_region.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layers.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/palette.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prealloc_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screens.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shared_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_buffer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_core.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface_pool_bridge.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowstack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wm.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/core/clipboard.c b/Source/DirectFB/src/core/clipboard.c
new file mode 100755
index 0000000..53fde34
--- /dev/null
+++ b/Source/DirectFB/src/core/clipboard.c
@@ -0,0 +1,298 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/core_parts.h>
+#include <core/clipboard.h>
+
+
+D_DEBUG_DOMAIN( Core_Clipboard, "Core/Clipboard", "DirectFB Clipboard Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                     magic;
+
+     FusionSkirmish          lock;
+     char                   *mime_type;
+     void                   *data;
+     unsigned int            size;
+     struct timeval          timestamp;
+
+     FusionSHMPoolShared    *shmpool;
+} DFBClipboardCoreShared;
+
+struct __DFB_DFBClipboardCore {
+     int                     magic;
+
+     CoreDFB                *core;
+
+     DFBClipboardCoreShared *shared;
+};
+
+
+DFB_CORE_PART( clipboard_core, ClipboardCore );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+dfb_clipboard_core_initialize( CoreDFB                *core,
+                               DFBClipboardCore       *data,
+                               DFBClipboardCoreShared *shared )
+{
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+     shared->shmpool = dfb_core_shmpool( core );
+
+     fusion_skirmish_init( &shared->lock, "Clipboard Core", dfb_core_world(core) );
+
+     D_MAGIC_SET( data, DFBClipboardCore );
+     D_MAGIC_SET( shared, DFBClipboardCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_clipboard_core_join( CoreDFB                *core,
+                         DFBClipboardCore       *data,
+                         DFBClipboardCoreShared *shared )
+{
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+     D_MAGIC_SET( data, DFBClipboardCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_clipboard_core_shutdown( DFBClipboardCore *data,
+                             bool              emergency )
+{
+     DFBClipboardCoreShared *shared;
+
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBClipboardCore );
+
+     shared = data->shared;
+
+     D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
+
+     fusion_skirmish_destroy( &shared->lock );
+
+     if (shared->data)
+          SHFREE( shared->shmpool, shared->data );
+
+     if (shared->mime_type)
+          SHFREE( shared->shmpool, shared->mime_type );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_clipboard_core_leave( DFBClipboardCore *data,
+                          bool              emergency )
+{
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBClipboardCore );
+     D_MAGIC_ASSERT( data->shared, DFBClipboardCoreShared );
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_clipboard_core_suspend( DFBClipboardCore *data )
+{
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBClipboardCore );
+     D_MAGIC_ASSERT( data->shared, DFBClipboardCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_clipboard_core_resume( DFBClipboardCore *data )
+{
+     D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBClipboardCore );
+     D_MAGIC_ASSERT( data->shared, DFBClipboardCoreShared );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_clipboard_set( DFBClipboardCore *core,
+                   const char       *mime_type,
+                   const void       *data,
+                   unsigned int      size,
+                   struct timeval   *timestamp )
+{
+     DFBClipboardCoreShared *shared;
+
+     char *new_mime;
+     void *new_data;
+
+     D_MAGIC_ASSERT( core, DFBClipboardCore );
+     D_ASSERT( mime_type != NULL );
+     D_ASSERT( data != NULL );
+     D_ASSERT( size > 0 );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
+
+     new_mime = SHSTRDUP( shared->shmpool, mime_type );
+     if (!new_mime)
+          return D_OOSHM();
+
+     new_data = SHMALLOC( shared->shmpool, size );
+     if (!new_data) {
+          SHFREE( shared->shmpool, new_mime );
+          return D_OOSHM();
+     }
+
+     direct_memcpy( new_data, data, size );
+
+     if (fusion_skirmish_prevail( &shared->lock )) {
+          SHFREE( shared->shmpool, new_data );
+          SHFREE( shared->shmpool, new_mime );
+          return DFB_FUSION;
+     }
+
+     if (shared->data)
+          SHFREE( shared->shmpool, shared->data );
+
+     if (shared->mime_type)
+          SHFREE( shared->shmpool, shared->mime_type );
+
+     shared->mime_type = new_mime;
+     shared->data      = new_data;
+     shared->size      = size;
+
+     gettimeofday( &shared->timestamp, NULL );
+
+     if (timestamp)
+          *timestamp = shared->timestamp;
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_clipboard_get( DFBClipboardCore  *core,
+                   char             **mime_type,
+                   void             **data,
+                   unsigned int      *size )
+{
+     DFBClipboardCoreShared *shared;
+
+     D_MAGIC_ASSERT( core, DFBClipboardCore );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
+
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     if (!shared->mime_type || !shared->data) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_BUFFEREMPTY;
+     }
+
+     if (mime_type)
+          *mime_type = strdup( shared->mime_type );
+
+     if (data) {
+          *data = malloc( shared->size );
+          direct_memcpy( *data, shared->data, shared->size );
+     }
+
+     if (size)
+          *size = shared->size;
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_clipboard_get_timestamp( DFBClipboardCore *core,
+                             struct timeval   *timestamp )
+{
+     DFBClipboardCoreShared *shared;
+
+     D_MAGIC_ASSERT( core, DFBClipboardCore );
+     D_ASSERT( timestamp != NULL );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
+
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     *timestamp = shared->timestamp;
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/clipboard.h b/Source/DirectFB/src/core/clipboard.h
new file mode 100755
index 0000000..ffb9c43
--- /dev/null
+++ b/Source/DirectFB/src/core/clipboard.h
@@ -0,0 +1,53 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__CLIPBOARD_H__
+#define __CORE__CLIPBOARD_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+
+DFBResult dfb_clipboard_set( DFBClipboardCore  *core,
+                             const char        *mime_type,
+                             const void        *data,
+                             unsigned int       size,
+                             struct timeval    *timestamp );
+
+DFBResult dfb_clipboard_get( DFBClipboardCore  *core,
+                             char             **mime_type,
+                             void             **data,
+                             unsigned int      *size );
+
+
+DFBResult dfb_clipboard_get_timestamp( DFBClipboardCore *core,
+                                       struct timeval   *timestamp );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/colorhash.c b/Source/DirectFB/src/core/colorhash.c
new file mode 100755
index 0000000..370697d
--- /dev/null
+++ b/Source/DirectFB/src/core/colorhash.c
@@ -0,0 +1,366 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/memcpy.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/core_parts.h>
+#include <core/palette.h>
+#include <core/colorhash.h>
+
+#include <misc/util.h>
+#include <gfx/convert.h>
+
+
+D_DEBUG_DOMAIN( Core_ColorHash, "Core/ColorHash", "DirectFB ColorHash Core" );
+
+
+#define HASH_SIZE 823
+
+typedef struct {
+     unsigned int  pixel;
+     unsigned int  index;
+     CorePalette  *palette;
+} Colorhash;
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                     magic;
+
+     Colorhash              *hash;
+     unsigned int            hash_users;
+     FusionSkirmish          hash_lock;
+
+     FusionSHMPoolShared    *shmpool;
+} DFBColorHashCoreShared;
+
+struct __DFB_DFBColorHashCore {
+     int                     magic;
+
+     CoreDFB                *core;
+
+     DFBColorHashCoreShared *shared;
+};
+
+DFB_CORE_PART( colorhash_core, ColorHashCore );
+
+/**********************************************************************************************************************/
+
+static DFBColorHashCore *core_colorhash; /* FIXME */
+
+
+static DFBResult
+dfb_colorhash_core_initialize( CoreDFB                *core,
+                               DFBColorHashCore       *data,
+                               DFBColorHashCoreShared *shared )
+{
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     core_colorhash = data; /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+     shared->shmpool = dfb_core_shmpool( core );
+
+     fusion_skirmish_init( &shared->hash_lock, "Colorhash Core", dfb_core_world(core) );
+
+     D_MAGIC_SET( data, DFBColorHashCore );
+     D_MAGIC_SET( shared, DFBColorHashCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_colorhash_core_join( CoreDFB                *core,
+                         DFBColorHashCore       *data,
+                         DFBColorHashCoreShared *shared )
+{
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBColorHashCoreShared );
+
+     core_colorhash = data; /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+     D_MAGIC_SET( data, DFBColorHashCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_colorhash_core_shutdown( DFBColorHashCore *data,
+                             bool              emergency )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBColorHashCore );
+     D_MAGIC_ASSERT( data->shared, DFBColorHashCoreShared );
+
+     shared = data->shared;
+
+     fusion_skirmish_destroy( &shared->hash_lock );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_colorhash_core_leave( DFBColorHashCore *data,
+                          bool              emergency )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBColorHashCore );
+     D_MAGIC_ASSERT( data->shared, DFBColorHashCoreShared );
+
+     shared = data->shared;
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_colorhash_core_suspend( DFBColorHashCore *data )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBColorHashCore );
+     D_MAGIC_ASSERT( data->shared, DFBColorHashCoreShared );
+
+     shared = data->shared;
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_colorhash_core_resume( DFBColorHashCore *data )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBColorHashCore );
+     D_MAGIC_ASSERT( data->shared, DFBColorHashCoreShared );
+
+     shared = data->shared;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+void
+dfb_colorhash_attach( DFBColorHashCore *core,
+                      CorePalette      *palette )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (core) {
+          D_MAGIC_ASSERT( core, DFBColorHashCore );
+          D_MAGIC_ASSERT( core->shared, DFBColorHashCoreShared );
+     }
+     else
+          core = core_colorhash;
+
+     shared = core->shared;
+
+     fusion_skirmish_prevail( &shared->hash_lock );
+
+     if (!shared->hash) {
+          D_ASSERT( shared->hash_users == 0 );
+
+          shared->hash = SHCALLOC( shared->shmpool, HASH_SIZE, sizeof (Colorhash) );
+     }
+
+     shared->hash_users++;
+
+     fusion_skirmish_dismiss( &shared->hash_lock );
+}
+
+void
+dfb_colorhash_detach( DFBColorHashCore *core,
+                      CorePalette      *palette )
+{
+     DFBColorHashCoreShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (core) {
+          D_MAGIC_ASSERT( core, DFBColorHashCore );
+          D_MAGIC_ASSERT( core->shared, DFBColorHashCoreShared );
+     }
+     else
+          core = core_colorhash;
+
+     shared = core->shared;
+
+     D_ASSERT( shared->hash_users > 0 );
+     D_ASSERT( shared->hash != NULL );
+
+     fusion_skirmish_prevail( &shared->hash_lock );
+
+     shared->hash_users--;
+
+     if (!shared->hash_users) {
+          /* no more users, free allocated resources */
+          SHFREE( shared->shmpool, shared->hash );
+          shared->hash = NULL;
+     }
+
+     fusion_skirmish_dismiss( &shared->hash_lock );
+}
+
+unsigned int
+dfb_colorhash_lookup( DFBColorHashCore *core,
+                      CorePalette      *palette,
+                      u8                r,
+                      u8                g,
+                      u8                b,
+                      u8                a )
+{
+     unsigned int            pixel = PIXEL_ARGB(a, r, g, b);
+     unsigned int            index = (pixel ^ (unsigned long) palette) % HASH_SIZE;
+     DFBColorHashCoreShared *shared;
+
+//     D_ASSUME( core != NULL );
+
+     if (core) {
+          D_MAGIC_ASSERT( core, DFBColorHashCore );
+          D_MAGIC_ASSERT( core->shared, DFBColorHashCoreShared );
+     }
+     else
+          core = core_colorhash;
+
+     shared = core->shared;
+
+     D_ASSERT( shared->hash != NULL );
+
+     fusion_skirmish_prevail( &shared->hash_lock );
+
+     /* try a lookup in the hash table */
+     if (shared->hash[index].palette == palette && shared->hash[index].pixel == pixel) {
+          /* set the return value */
+          index = shared->hash[index].index;
+     } else { /* look for the closest match */
+          DFBColor *entries = palette->entries;
+          int min_diff = 0;
+          unsigned int i, min_index = 0;
+
+          for (i = 0; i < palette->num_entries; i++) {
+               int diff;
+
+               int r_diff = (int) entries[i].r - (int) r;
+               int g_diff = (int) entries[i].g - (int) g;
+               int b_diff = (int) entries[i].b - (int) b;
+               int a_diff = (int) entries[i].a - (int) a;
+
+               if (a)
+                    diff = (r_diff * r_diff + g_diff * g_diff +
+                            b_diff * b_diff + ((a_diff * a_diff) >> 6));
+               else
+                    diff = (r_diff + g_diff + b_diff + (a_diff * a_diff));
+
+               if (i == 0 || diff < min_diff) {
+                    min_diff = diff;
+                    min_index = i;
+               }
+
+               if (!diff)
+                    break;
+          }
+
+          /* store the matching entry in the hash table */
+          shared->hash[index].pixel   = pixel;
+          shared->hash[index].index   = min_index;
+          shared->hash[index].palette = palette;
+
+          /* set the return value */
+          index = min_index;
+     }
+
+     fusion_skirmish_dismiss( &shared->hash_lock );
+
+     return index;
+}
+
+void
+dfb_colorhash_invalidate( DFBColorHashCore *core,
+                          CorePalette      *palette )
+{
+     unsigned int            index = HASH_SIZE - 1;
+     DFBColorHashCoreShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (core) {
+          D_MAGIC_ASSERT( core, DFBColorHashCore );
+          D_MAGIC_ASSERT( core->shared, DFBColorHashCoreShared );
+     }
+     else
+          core = core_colorhash;
+
+     shared = core->shared;
+
+     D_ASSERT( shared->hash != NULL );
+
+     fusion_skirmish_prevail( &shared->hash_lock );
+
+     /* invalidate all entries owned by this palette */
+     do {
+          if (shared->hash[index].palette == palette)
+               shared->hash[index].palette = NULL;
+     } while (index--);
+
+     fusion_skirmish_dismiss( &shared->hash_lock );
+}
+
diff --git a/Source/DirectFB/src/core/colorhash.h b/Source/DirectFB/src/core/colorhash.h
new file mode 100755
index 0000000..d321000
--- /dev/null
+++ b/Source/DirectFB/src/core/colorhash.h
@@ -0,0 +1,54 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__COLORHASH_H__
+#define __CORE__COLORHASH_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+
+void          dfb_colorhash_attach    ( DFBColorHashCore *core,
+                                        CorePalette      *palette );
+
+void          dfb_colorhash_detach    ( DFBColorHashCore *core,
+                                        CorePalette      *palette );
+
+unsigned int  dfb_colorhash_lookup    ( DFBColorHashCore *core,
+                                        CorePalette      *palette,
+                                        u8                r,
+                                        u8                g,
+                                        u8                b,
+                                        u8                a);
+
+void          dfb_colorhash_invalidate( DFBColorHashCore *core,
+                                        CorePalette      *palette );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/core.c b/Source/DirectFB/src/core/core.c
new file mode 100755
index 0000000..ca20152
--- /dev/null
+++ b/Source/DirectFB/src/core/core.c
@@ -0,0 +1,1160 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <dlfcn.h>
+#include <errno.h>
+
+#include <pthread.h>
+
+#include <fusion/fusion.h>
+#include <fusion/arena.h>
+#include <direct/list.h>
+#include <fusion/shmalloc.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core.h>
+#include <core/core_parts.h>
+#include <core/layer_context.h>
+#include <core/layer_region.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+#include <core/windows.h>
+#include <core/windows_internal.h>
+
+#include <direct/build.h>
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <fusion/build.h>
+#include <fusion/conf.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+D_DEBUG_DOMAIN( DirectFB_Core, "DirectFB/Core", "DirectFB Core" );
+
+/******************************************************************************/
+
+extern CorePart dfb_clipboard_core;
+extern CorePart dfb_colorhash_core;
+extern CorePart dfb_graphics_core;
+extern CorePart dfb_input_core;
+extern CorePart dfb_layer_core;
+extern CorePart dfb_screen_core;
+extern CorePart dfb_surface_core;
+extern CorePart dfb_system_core;
+extern CorePart dfb_wm_core;
+
+static CorePart *core_parts[] = {
+     &dfb_clipboard_core,
+     &dfb_colorhash_core,
+     &dfb_surface_core,
+     &dfb_system_core,
+     &dfb_input_core,
+     &dfb_graphics_core,
+     &dfb_screen_core,
+     &dfb_layer_core,
+     &dfb_wm_core
+};
+
+void *
+dfb_core_get_part( CoreDFB        *core,
+                   DFBCorePartID   part_id )
+{
+     switch (part_id) {
+          case DFCP_CLIPBOARD:
+               return dfb_clipboard_core.data_local;
+
+          case DFCP_COLORHASH:
+               return dfb_colorhash_core.data_local;
+
+          case DFCP_GRAPHICS:
+               return dfb_graphics_core.data_local;
+
+          case DFCP_INPUT:
+               return dfb_input_core.data_local;
+
+          case DFCP_LAYER:
+               return dfb_layer_core.data_local;
+
+          case DFCP_SCREEN:
+               return dfb_screen_core.data_local;
+
+          case DFCP_SURFACE:
+               return dfb_surface_core.data_local;
+
+          case DFCP_SYSTEM:
+               return dfb_system_core.data_local;
+
+          case DFCP_WM:
+               return dfb_wm_core.data_local;
+
+          default:
+               D_BUG( "unknown core part" );
+     }
+
+     return NULL;
+}
+
+/******************************************************************************/
+
+/*
+ * one entry in the cleanup stack
+ */
+struct _CoreCleanup {
+     DirectLink       link;
+
+     CoreCleanupFunc  func;        /* the cleanup function to be called */
+     void            *data;        /* context of the cleanup function */
+     bool             emergency;   /* if true, cleanup is also done during
+                                      emergency shutdown (from signal hadler) */
+};
+
+/******************************************************************************/
+
+struct __DFB_CoreDFBShared {
+     int                  magic;
+
+     FusionSkirmish       lock;
+     bool                 active;
+
+     FusionObjectPool    *layer_context_pool;
+     FusionObjectPool    *layer_region_pool;
+     FusionObjectPool    *palette_pool;
+     FusionObjectPool    *surface_pool;
+     FusionObjectPool    *window_pool;
+
+     FusionSHMPoolShared *shmpool;
+     FusionSHMPoolShared *shmpool_data; /* for raw data, e.g. surface buffers */
+};
+
+struct __DFB_CoreDFB {
+     int                      magic;
+
+     int                      refs;
+
+     int                      fusion_id;
+
+     FusionWorld             *world;
+     FusionArena             *arena;
+
+     CoreDFBShared           *shared;
+
+     bool                     master;
+     bool                     suspended;
+
+     DirectLink              *cleanups;
+
+     DirectThreadInitHandler *init_handler;
+
+     DirectSignalHandler     *signal_handler;
+     
+     DirectCleanupHandler    *cleanup_handler;
+};
+
+/******************************************************************************/
+
+/*
+ * ckecks if stack is clean, otherwise prints warning, then calls core_deinit()
+ */
+static void dfb_core_deinit_check( void *ctx );
+
+static void dfb_core_thread_init_handler( DirectThread *thread, void *arg );
+
+static void dfb_core_process_cleanups( CoreDFB *core, bool emergency );
+
+static DirectSignalHandlerResult dfb_core_signal_handler( int   num,
+                                                          void *addr,
+                                                          void *ctx );
+
+/******************************************************************************/
+
+static int dfb_core_arena_initialize( FusionArena *arena,
+                                      void        *ctx );
+static int dfb_core_arena_shutdown  ( FusionArena *arena,
+                                      void        *ctx,
+                                      bool         emergency );
+static int dfb_core_arena_join      ( FusionArena *arena,
+                                      void        *ctx );
+static int dfb_core_arena_leave     ( FusionArena *arena,
+                                      void        *ctx,
+                                      bool         emergency );
+
+/******************************************************************************/
+
+#if defined(DFB_DYNAMIC_LINKING) && defined(SOPATH)
+/*
+ * the library handle for dlopen'ing ourselves
+ */
+static void* dfb_lib_handle = NULL;
+#endif
+
+/******************************************************************************/
+
+static CoreDFB         *core_dfb      = NULL;
+static pthread_mutex_t  core_dfb_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/******************************************************************************/
+
+DFBResult
+dfb_core_create( CoreDFB **ret_core )
+{
+     int      ret;
+#if FUSION_BUILD_MULTI
+     char     buf[16];
+#endif
+     CoreDFB       *core   = NULL;
+     CoreDFBShared *shared = NULL;
+
+     D_ASSERT( ret_core != NULL );
+     D_ASSERT( dfb_config != NULL );
+
+     D_DEBUG_AT( DirectFB_Core, "%s...\n", __FUNCTION__ );
+
+     pthread_mutex_lock( &core_dfb_lock );
+
+     D_ASSERT( core_dfb == NULL || core_dfb->refs > 0 );
+
+     if (core_dfb) {
+          D_MAGIC_ASSERT( core_dfb, CoreDFB );
+
+          core_dfb->refs++;
+
+          *ret_core = core_dfb;
+
+          pthread_mutex_unlock( &core_dfb_lock );
+
+          return DFB_OK;
+     }
+
+     direct_initialize();
+
+
+     D_INFO( "DirectFB/Core: %s Application Core. ("BUILDTIME") %s%s\n",
+             FUSION_BUILD_MULTI ? "Multi" : "Single",
+             DIRECT_BUILD_DEBUG ? "[ DEBUG ]" : "",
+             DIRECT_BUILD_TRACE ? "[ TRACE ]" : "" );
+
+
+#if defined(DFB_DYNAMIC_LINKING) && defined(SOPATH)
+     if (!dfb_lib_handle)
+#ifdef RTLD_GLOBAL
+          dfb_lib_handle = dlopen(SOPATH, RTLD_GLOBAL|RTLD_LAZY);
+#else
+          /* RTLD_GLOBAL is not defined on OpenBSD */
+          dfb_lib_handle = dlopen(SOPATH, RTLD_LAZY);
+#endif
+#endif
+
+     ret = dfb_system_lookup();
+     if (ret)
+          goto error;
+
+
+     /* Allocate local core structure. */
+     core = D_CALLOC( 1, sizeof(CoreDFB) );
+     if (!core) {
+          ret = D_OOM();
+          goto error;
+     }
+
+     core->refs = 1;
+
+     core->init_handler = direct_thread_add_init_handler( dfb_core_thread_init_handler, core );
+
+#if FUSION_BUILD_MULTI
+     dfb_system_thread_init();
+#endif
+
+     direct_find_best_memcpy();
+
+     D_MAGIC_SET( core, CoreDFB );
+
+     core_dfb = core;
+
+     ret = fusion_enter( dfb_config->session, DIRECTFB_CORE_ABI, FER_ANY, &core->world );
+     if (ret)
+          goto error;
+
+     core->fusion_id = fusion_id( core->world );
+
+#if FUSION_BUILD_MULTI
+     D_DEBUG_AT( DirectFB_Core, "world %d, fusion id %d\n", fusion_world_index(core->world), core->fusion_id );
+
+     snprintf( buf, sizeof(buf), "%d", fusion_world_index(core->world) );
+
+     setenv( "DIRECTFB_SESSION", buf, true );
+#endif
+
+     if (dfb_config->sync) {
+          D_INFO( "DirectFB/Core: calling sync()...\n" );
+          sync();
+     }
+
+     direct_signal_handler_add( DIRECT_SIGNAL_ANY, dfb_core_signal_handler, core, &core->signal_handler );
+
+     if (fusion_arena_enter( core->world, "DirectFB/Core",
+                             dfb_core_arena_initialize, dfb_core_arena_join,
+                             core, &core->arena, &ret ) || ret)
+     {
+          ret = ret ? ret : DFB_FUSION;
+          goto error;
+     }
+
+     shared = core->shared;
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     if (dfb_config->block_all_signals)
+          direct_signals_block_all();
+
+     if (dfb_config->deinit_check)
+          direct_cleanup_handler_add( dfb_core_deinit_check, NULL, &core->cleanup_handler );
+
+
+     fusion_skirmish_prevail( &shared->lock );
+
+     if (!core->master) {
+          while (!shared->active)
+               fusion_skirmish_wait( &shared->lock, 0 );
+     }
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+
+     *ret_core = core;
+
+     pthread_mutex_unlock( &core_dfb_lock );
+
+     D_DEBUG_AT( DirectFB_Core, "Core successfully created.\n" );
+
+     return DFB_OK;
+
+
+error:
+     if (core) {
+          if (core->world)
+               fusion_exit( core->world, false );
+
+          if (core->init_handler)
+               direct_thread_remove_init_handler( core->init_handler );
+
+          if (core->signal_handler)
+               direct_signal_handler_remove( core->signal_handler );
+
+          D_MAGIC_CLEAR( core );
+
+          D_FREE( core );
+          core_dfb = NULL;
+     }
+
+     pthread_mutex_unlock( &core_dfb_lock );
+
+     direct_shutdown();
+
+     return ret;
+}
+
+DFBResult
+dfb_core_destroy( CoreDFB *core, bool emergency )
+{
+     D_MAGIC_ASSERT( core, CoreDFB );
+     D_ASSERT( core->refs > 0 );
+     D_ASSERT( core == core_dfb );
+
+     D_DEBUG_AT( DirectFB_Core, "%s...\n", __FUNCTION__ );
+
+     if (!emergency) {
+          pthread_mutex_lock( &core_dfb_lock );
+
+          if (--core->refs) {
+               pthread_mutex_unlock( &core_dfb_lock );
+               return DFB_OK;
+          }
+     }
+
+     direct_signal_handler_remove( core->signal_handler );
+     
+     if (core->cleanup_handler)
+          direct_cleanup_handler_remove( core->cleanup_handler );
+
+     if (core->master) {
+          if (emergency) {
+               fusion_kill( core->world, 0, SIGKILL, 1000 );
+          }
+          else {
+               fusion_kill( core->world, 0, SIGTERM, 5000 );
+               fusion_kill( core->world, 0, SIGKILL, 2000 );
+          }
+     }
+
+     dfb_core_process_cleanups( core, emergency );
+
+     while (fusion_arena_exit( core->arena, dfb_core_arena_shutdown,
+                               core->master ? NULL : dfb_core_arena_leave,
+                               core, emergency, NULL ) == DFB_BUSY)
+     {
+          D_ONCE( "waiting for DirectFB slaves to terminate" );
+          usleep( 100000 );
+     }
+
+     fusion_exit( core->world, emergency );
+
+     if (!emergency)
+          direct_thread_remove_init_handler( core->init_handler );
+
+     D_MAGIC_CLEAR( core );
+
+     D_FREE( core );
+     core_dfb = NULL;
+
+     if (!emergency) {
+          pthread_mutex_unlock( &core_dfb_lock );
+
+          direct_shutdown();
+     }
+
+     return DFB_OK;
+}
+
+CoreLayerContext *
+dfb_core_create_layer_context( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+     D_ASSERT( shared->layer_context_pool != NULL );
+
+     return (CoreLayerContext*) fusion_object_create( shared->layer_context_pool, core->world );
+}
+
+CoreLayerRegion *
+dfb_core_create_layer_region( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+     D_ASSERT( core->shared->layer_region_pool != NULL );
+
+     return (CoreLayerRegion*) fusion_object_create( core->shared->layer_region_pool, core->world );
+}
+
+CorePalette *
+dfb_core_create_palette( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+     D_ASSERT( core->shared->palette_pool != NULL );
+
+     return (CorePalette*) fusion_object_create( core->shared->palette_pool, core->world );
+}
+
+CoreSurface *
+dfb_core_create_surface( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+     D_ASSERT( core->shared->surface_pool != NULL );
+
+     return (CoreSurface*) fusion_object_create( core->shared->surface_pool, core->world );
+}
+
+CoreWindow *
+dfb_core_create_window( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+     D_ASSERT( core->shared->window_pool != NULL );
+
+     return (CoreWindow*) fusion_object_create( core->shared->window_pool, core->world );
+}
+
+DirectResult
+dfb_core_enum_surfaces( CoreDFB               *core,
+                        FusionObjectCallback   callback,
+                        void                  *ctx )
+{
+     CoreDFBShared *shared;
+
+     D_ASSERT( core != NULL || core_dfb != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     return fusion_object_pool_enum( shared->surface_pool, callback, ctx );
+}
+
+DirectResult
+dfb_core_enum_layer_contexts( CoreDFB               *core,
+                              FusionObjectCallback   callback,
+                              void                  *ctx )
+{
+     CoreDFBShared *shared;
+
+     D_ASSERT( core != NULL || core_dfb != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     return fusion_object_pool_enum( shared->layer_context_pool, callback, ctx );
+}
+
+DirectResult
+dfb_core_enum_layer_regions( CoreDFB               *core,
+                             FusionObjectCallback   callback,
+                             void                  *ctx )
+{
+     CoreDFBShared *shared;
+
+     D_ASSERT( core != NULL || core_dfb != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     return fusion_object_pool_enum( shared->layer_region_pool, callback, ctx );
+}
+
+bool
+dfb_core_is_master( CoreDFB *core )
+{
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     return core->master;
+}
+
+void
+dfb_core_activate( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     fusion_skirmish_prevail( &shared->lock );
+
+     shared->active = true;
+
+     fusion_skirmish_notify( &shared->lock );
+
+     fusion_skirmish_dismiss( &shared->lock );
+}
+
+FusionWorld *
+dfb_core_world( CoreDFB *core )
+{
+//     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     return core->world;
+}
+
+FusionArena *
+dfb_core_arena( CoreDFB *core )
+{
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     return core->arena;
+}
+
+FusionSHMPoolShared *
+dfb_core_shmpool( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     return shared->shmpool;
+}
+
+FusionSHMPoolShared *
+dfb_core_shmpool_data( CoreDFB *core )
+{
+     CoreDFBShared *shared;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     return shared->shmpool_data;
+}
+
+DFBResult
+dfb_core_suspend( CoreDFB *core )
+{
+     DFBResult ret;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     if (!core->master)
+          return DFB_ACCESSDENIED;
+
+     if (core->suspended)
+          return DFB_BUSY;
+
+     ret = dfb_input_core.Suspend( dfb_input_core.data_local );
+     if (ret)
+          goto error_input;
+
+     ret = dfb_layer_core.Suspend( dfb_layer_core.data_local );
+     if (ret)
+          goto error_layers;
+
+     ret = dfb_screen_core.Suspend( dfb_screen_core.data_local );
+     if (ret)
+          goto error_screens;
+
+     ret = dfb_graphics_core.Suspend( dfb_graphics_core.data_local );
+     if (ret)
+          goto error_graphics;
+
+     core->suspended = true;
+
+     return DFB_OK;
+
+error_graphics:
+     dfb_screen_core.Resume( dfb_screen_core.data_local );
+error_screens:
+     dfb_layer_core.Resume( dfb_layer_core.data_local );
+error_layers:
+     dfb_input_core.Resume( dfb_input_core.data_local );
+error_input:
+     return ret;
+}
+
+DFBResult
+dfb_core_resume( CoreDFB *core )
+{
+     DFBResult ret;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     if (!core->master)
+          return DFB_ACCESSDENIED;
+
+     if (!core->suspended)
+          return DFB_BUSY;
+
+     ret = dfb_graphics_core.Resume( dfb_graphics_core.data_local );
+     if (ret)
+          goto error_graphics;
+
+     ret = dfb_screen_core.Resume( dfb_screen_core.data_local );
+     if (ret)
+          goto error_screens;
+
+     ret = dfb_layer_core.Resume( dfb_layer_core.data_local );
+     if (ret)
+          goto error_layers;
+
+     ret = dfb_input_core.Resume( dfb_input_core.data_local );
+     if (ret)
+          goto error_input;
+
+     core->suspended = false;
+
+     return DFB_OK;
+
+error_input:
+     dfb_layer_core.Suspend( dfb_layer_core.data_local );
+error_layers:
+     dfb_screen_core.Suspend( dfb_screen_core.data_local );
+error_screens:
+     dfb_graphics_core.Suspend( dfb_graphics_core.data_local );
+error_graphics:
+     return ret;
+}
+
+CoreCleanup *
+dfb_core_cleanup_add( CoreDFB         *core,
+                      CoreCleanupFunc  func,
+                      void            *data,
+                      bool             emergency )
+{
+     CoreCleanup *cleanup;
+
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     cleanup = D_CALLOC( 1, sizeof(CoreCleanup) );
+
+     cleanup->func      = func;
+     cleanup->data      = data;
+     cleanup->emergency = emergency;
+
+     direct_list_prepend( &core->cleanups, &cleanup->link );
+
+     return cleanup;
+}
+
+void
+dfb_core_cleanup_remove( CoreDFB     *core,
+                         CoreCleanup *cleanup )
+{
+     D_ASSUME( core != NULL );
+
+     if (!core)
+          core = core_dfb;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     direct_list_remove( &core->cleanups, &cleanup->link );
+
+     D_FREE( cleanup );
+}
+
+/******************************************************************************/
+
+static void
+dfb_core_deinit_check( void *ctx )
+{
+     if (core_dfb && core_dfb->refs) {
+          D_WARN( "Application exited without deinitialization of DirectFB!" );
+          dfb_core_destroy( core_dfb, true );
+     }
+}
+
+static void
+dfb_core_thread_init_handler( DirectThread *thread, void *arg )
+{
+     dfb_system_thread_init();
+}
+
+static void
+dfb_core_process_cleanups( CoreDFB *core, bool emergency )
+{
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     while (core->cleanups) {
+          CoreCleanup *cleanup = (CoreCleanup*) core->cleanups;
+
+          core->cleanups = core->cleanups->next;
+
+          if (cleanup->emergency || !emergency)
+               cleanup->func( cleanup->data, emergency );
+
+          D_FREE( cleanup );
+     }
+}
+
+static DirectSignalHandlerResult
+dfb_core_signal_handler( int   num,
+                         void *addr,
+                         void *ctx )
+{
+     CoreDFB *core = ctx;
+
+     D_ASSERT( core == core_dfb );
+
+     dfb_core_destroy( core, true );
+
+     return DSHR_OK;
+}
+
+/******************************************************************************/
+
+static int
+dfb_core_shutdown( CoreDFB *core, bool emergency )
+{
+     CoreDFBShared *shared;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     /* Suspend input core to stop all input threads before shutting down. */
+     if (dfb_input_core.initialized)
+          dfb_input_core.Suspend( dfb_input_core.data_local );
+
+     fusion_stop_dispatcher( core->world, emergency );
+
+     /* Destroy window objects. */
+     fusion_object_pool_destroy( shared->window_pool, core->world );
+
+     /* Close window stacks. */
+     if (dfb_wm_core.initialized)
+          dfb_wm_close_all_stacks( dfb_wm_core.data_local );
+
+     /* Destroy layer context and region objects. */
+     fusion_object_pool_destroy( shared->layer_region_pool, core->world );
+     fusion_object_pool_destroy( shared->layer_context_pool, core->world );
+
+     /* Shutdown WM core. */
+     dfb_core_part_shutdown( core, &dfb_wm_core, emergency );
+
+     /* Shutdown layer core. */
+     dfb_core_part_shutdown( core, &dfb_layer_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_screen_core, emergency );
+
+     /* Destroy surface and palette objects. */
+     fusion_object_pool_destroy( shared->surface_pool, core->world );
+     fusion_object_pool_destroy( shared->palette_pool, core->world );
+
+     /* Destroy remaining core parts. */
+     dfb_core_part_shutdown( core, &dfb_graphics_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_surface_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_input_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_system_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_colorhash_core, emergency );
+     dfb_core_part_shutdown( core, &dfb_clipboard_core, emergency );
+
+     /* Destroy shared memory pool for surface data. */
+     fusion_shm_pool_destroy( core->world, shared->shmpool_data );
+
+     return 0;
+}
+
+static DFBResult
+dfb_core_initialize( CoreDFB *core )
+{
+     int            i;
+     DFBResult      ret;
+     CoreDFBShared *shared;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     ret = fusion_shm_pool_create( core->world, "DirectFB Data Pool", 0x1000000,
+                                   fusion_config->debugshm, &shared->shmpool_data );
+     if (ret)
+          return ret;
+
+     shared->layer_context_pool = dfb_layer_context_pool_create( core->world );
+     shared->layer_region_pool  = dfb_layer_region_pool_create( core->world );
+     shared->palette_pool       = dfb_palette_pool_create( core->world );
+     shared->surface_pool       = dfb_surface_pool_create( core->world );
+     shared->window_pool        = dfb_window_pool_create( core->world );
+
+     for (i=0; i<D_ARRAY_SIZE(core_parts); i++) {
+          DFBResult ret;
+
+          if ((ret = dfb_core_part_initialize( core, core_parts[i] ))) {
+               dfb_core_shutdown( core, true );
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static int
+dfb_core_leave( CoreDFB *core, bool emergency )
+{
+     int i;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     for (i=D_ARRAY_SIZE(core_parts)-1; i>=0; i--)
+          dfb_core_part_leave( core, core_parts[i], emergency );
+
+     return DFB_OK;
+}
+
+static int
+dfb_core_join( CoreDFB *core )
+{
+     int i;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     for (i=0; i<D_ARRAY_SIZE(core_parts); i++) {
+          DFBResult ret;
+
+          if ((ret = dfb_core_part_join( core, core_parts[i] ))) {
+               dfb_core_leave( core, true );
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static int
+dfb_core_arena_initialize( FusionArena *arena,
+                           void        *ctx )
+{
+     DFBResult            ret;
+     CoreDFB             *core = ctx;
+     CoreDFBShared       *shared;
+     FusionSHMPoolShared *pool;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     D_DEBUG_AT( DirectFB_Core, "Initializing...\n" );
+
+     /* Create the shared memory pool first! */
+     ret = fusion_shm_pool_create( core->world, "DirectFB Main Pool", 0x400000,
+                                   fusion_config->debugshm, &pool );
+     if (ret)
+          return ret;
+
+     /* Allocate shared structure in the new pool. */
+     shared = SHCALLOC( pool, 1, sizeof(CoreDFBShared) );
+     if (!shared) {
+          fusion_shm_pool_destroy( core->world, pool );
+          return D_OOSHM();
+     }
+
+     core->shared = shared;
+     core->master = true;
+
+     shared->shmpool = pool;
+
+     D_MAGIC_SET( shared, CoreDFBShared );
+
+     /* Initialize. */
+     ret = dfb_core_initialize( core );
+     if (ret) {
+          D_MAGIC_CLEAR( shared );
+          SHFREE( pool, shared );
+          fusion_shm_pool_destroy( core->world, pool );
+          return ret;
+     }
+
+     fusion_skirmish_init( &shared->lock, "DirectFB Core", core->world );
+
+     /* Register shared data. */
+     fusion_arena_add_shared_field( arena, "Core/Shared", shared );
+
+     return DFB_OK;
+}
+
+static int
+dfb_core_arena_shutdown( FusionArena *arena,
+                         void        *ctx,
+                         bool         emergency)
+{
+     DFBResult            ret;
+     CoreDFB             *core = ctx;
+     CoreDFBShared       *shared;
+     FusionSHMPoolShared *pool;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     shared = core->shared;
+
+     D_MAGIC_ASSERT( shared, CoreDFBShared );
+
+     pool = shared->shmpool;
+
+     D_DEBUG_AT( DirectFB_Core, "Shutting down...\n" );
+
+     if (!core->master) {
+          D_WARN( "refusing shutdown in slave" );
+          return dfb_core_leave( core, emergency );
+     }
+
+     /* Shutdown. */
+     ret = dfb_core_shutdown( core, emergency );
+
+     fusion_skirmish_destroy( &shared->lock );
+
+     D_MAGIC_CLEAR( shared );
+
+     SHFREE( pool, shared );
+
+     fusion_shm_pool_destroy( core->world, pool );
+
+     return ret;
+}
+
+static int
+dfb_core_arena_join( FusionArena *arena,
+                     void        *ctx )
+{
+     DFBResult  ret;
+     CoreDFB   *core = ctx;
+     void      *field;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     D_DEBUG_AT( DirectFB_Core, "Joining...\n" );
+
+     /* Get shared data. */
+     if (fusion_arena_get_shared_field( arena, "Core/Shared", &field ))
+          return DFB_FUSION;
+
+     core->shared = field;
+
+     /* Join. */
+     ret = dfb_core_join( core );
+     if (ret)
+          return ret;
+
+     return DFB_OK;
+}
+
+static int
+dfb_core_arena_leave( FusionArena *arena,
+                      void        *ctx,
+                      bool         emergency)
+{
+     DFBResult  ret;
+     CoreDFB   *core = ctx;
+
+     D_MAGIC_ASSERT( core, CoreDFB );
+
+     D_DEBUG_AT( DirectFB_Core, "Leaving...\n" );
+
+     /* Leave. */
+     ret = dfb_core_leave( core, emergency );
+     if (ret)
+          return ret;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/core.h b/Source/DirectFB/src/core/core.h
new file mode 100755
index 0000000..7116e8c
--- /dev/null
+++ b/Source/DirectFB/src/core/core.h
@@ -0,0 +1,162 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE_H__
+#define __CORE_H__
+
+#include <fusion/types.h>
+#include <fusion/lock.h>
+#include <fusion/object.h>
+
+#include <directfb.h>
+
+#include "coretypes.h"
+#include "coredefs.h"
+
+
+#define DIRECTFB_CORE_ABI     45
+
+
+typedef enum {
+     DFCP_CLIPBOARD,
+     DFCP_COLORHASH,
+     DFCP_GRAPHICS,
+     DFCP_INPUT,
+     DFCP_LAYER,
+     DFCP_SCREEN,
+     DFCP_SURFACE,
+     DFCP_SYSTEM,
+     DFCP_WM,
+
+     _DFCP_NUM
+} DFBCorePartID;
+
+
+/*
+ * Cleanup function, callback of a cleanup stack entry.
+ */
+typedef void (*CoreCleanupFunc)(void *data, int emergency);
+
+
+
+/*
+ * Core initialization and deinitialization
+ */
+DFBResult  dfb_core_create  ( CoreDFB       **ret_core );
+
+DFBResult  dfb_core_destroy ( CoreDFB        *core,
+                              bool            emergency );
+
+void      *dfb_core_get_part( CoreDFB        *core,
+                              DFBCorePartID   part_id );
+
+
+#define DFB_CORE(core,PART)   dfb_core_get_part( core, DFCP_##PART )
+
+
+/*
+ * Object creation
+ */
+CoreLayerContext *dfb_core_create_layer_context( CoreDFB *core );
+CoreLayerRegion  *dfb_core_create_layer_region ( CoreDFB *core );
+CorePalette      *dfb_core_create_palette      ( CoreDFB *core );
+CoreSurface      *dfb_core_create_surface      ( CoreDFB *core );
+CoreWindow       *dfb_core_create_window       ( CoreDFB *core );
+
+/*
+ * Debug
+ */
+DirectResult dfb_core_enum_surfaces      ( CoreDFB               *core,
+                                           FusionObjectCallback   callback,
+                                           void                  *ctx );
+DirectResult dfb_core_enum_layer_contexts( CoreDFB               *core,
+                                           FusionObjectCallback   callback,
+                                           void                  *ctx );
+DirectResult dfb_core_enum_layer_regions ( CoreDFB               *core,
+                                           FusionObjectCallback   callback,
+                                           void                  *ctx );
+
+
+/*
+ * Returns true if the calling process is the master fusionee,
+ * i.e. handles input drivers running their threads.
+ */
+bool         dfb_core_is_master( CoreDFB *core );
+
+/*
+ * Allows other (blocking) Fusionees to enter the DirectFB session.
+ */
+void         dfb_core_activate( CoreDFB *core );
+
+/*
+ * Returns the core's fusion world.
+ */
+FusionWorld *dfb_core_world( CoreDFB *core );
+
+/*
+ * Returns the core arena.
+ */
+FusionArena *dfb_core_arena( CoreDFB *core );
+
+/*
+ * Returns the shared memory pool of the core.
+ */
+FusionSHMPoolShared *dfb_core_shmpool( CoreDFB *core );
+
+/*
+ * Returns the shared memory pool for raw data, e.g. surface buffers.
+ */
+FusionSHMPoolShared *dfb_core_shmpool_data( CoreDFB *core );
+
+/*
+ * Suspends all core parts, stopping input threads, closing devices...
+ */
+DFBResult    dfb_core_suspend( CoreDFB *core );
+
+/*
+ * Resumes all core parts, reopening devices, starting input threads...
+ */
+DFBResult    dfb_core_resume( CoreDFB *core );
+
+/*
+ * Adds a function to the cleanup stack that is called during deinitialization.
+ * If emergency is true, the cleanup is even called by core_deinit_emergency().
+ */
+CoreCleanup *dfb_core_cleanup_add( CoreDFB         *core,
+                                   CoreCleanupFunc  func,
+                                   void            *data,
+                                   bool             emergency );
+
+/*
+ * Removes a function from the cleanup stack.
+ */
+void         dfb_core_cleanup_remove( CoreDFB     *core,
+                                      CoreCleanup *cleanup );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/core_parts.c b/Source/DirectFB/src/core/core_parts.c
new file mode 100755
index 0000000..1b5f944
--- /dev/null
+++ b/Source/DirectFB/src/core/core_parts.c
@@ -0,0 +1,202 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core.h>
+#include <core/core_parts.h>
+
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+
+D_DEBUG_DOMAIN( Core_Parts, "Core/Parts", "DirectFB Core Parts" );
+
+
+DFBResult
+dfb_core_part_initialize( CoreDFB  *core,
+                          CorePart *core_part )
+{
+     DFBResult            ret;
+     void                *local  = NULL;
+     void                *shared = NULL;
+     FusionSHMPoolShared *pool;
+
+     pool = dfb_core_shmpool( core );
+
+     if (core_part->initialized) {
+          D_BUG( "%s already initialized", core_part->name );
+          return DFB_BUG;
+     }
+
+     D_DEBUG_AT( Core_Parts, "Going to initialize '%s' core...\n", core_part->name );
+
+     if (core_part->size_local)
+          local = D_CALLOC( 1, core_part->size_local );
+
+     if (core_part->size_shared)
+          shared = SHCALLOC( pool, 1, core_part->size_shared );
+
+     ret = core_part->Initialize( core, local, shared );
+     if (ret) {
+          D_ERROR( "DirectFB/Core: Could not initialize '%s' core!\n"
+                    "    --> %s\n", core_part->name,
+                    DirectFBErrorString( ret ) );
+
+          if (shared)
+               SHFREE( pool, shared );
+
+          if (local)
+               D_FREE( local );
+
+          return ret;
+     }
+
+     if (shared)
+          fusion_arena_add_shared_field( dfb_core_arena( core ),
+                                         core_part->name, shared );
+
+     core_part->data_local  = local;
+     core_part->data_shared = shared;
+     core_part->initialized = true;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_core_part_join( CoreDFB  *core,
+                    CorePart *core_part )
+{
+     DFBResult  ret;
+     void      *local  = NULL;
+     void      *shared = NULL;
+
+     if (core_part->initialized) {
+          D_BUG( "%s already joined", core_part->name );
+          return DFB_BUG;
+     }
+
+     D_DEBUG_AT( Core_Parts, "Going to join '%s' core...\n", core_part->name );
+
+     if (core_part->size_shared &&
+         fusion_arena_get_shared_field( dfb_core_arena( core ),
+                                        core_part->name, &shared ))
+          return DFB_FUSION;
+
+     if (core_part->size_local)
+          local = D_CALLOC( 1, core_part->size_local );
+
+     ret = core_part->Join( core, local, shared );
+     if (ret) {
+          D_ERROR( "DirectFB/Core: Could not join '%s' core!\n"
+                    "    --> %s\n", core_part->name,
+                    DirectFBErrorString( ret ) );
+
+          if (local)
+               D_FREE( local );
+
+          return ret;
+     }
+
+     core_part->data_local  = local;
+     core_part->data_shared = shared;
+     core_part->initialized = true;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_core_part_shutdown( CoreDFB  *core,
+                        CorePart *core_part,
+                        bool      emergency )
+{
+     DFBResult            ret;
+     FusionSHMPoolShared *pool;
+
+     pool = dfb_core_shmpool( core );
+
+     if (!core_part->initialized)
+          return DFB_OK;
+
+     D_DEBUG_AT( Core_Parts, "Going to shutdown '%s' core...\n", core_part->name );
+
+     ret = core_part->Shutdown( core_part->data_local, emergency );
+     if (ret)
+          D_ERROR( "DirectFB/Core: Could not shutdown '%s' core!\n"
+                    "    --> %s\n", core_part->name,
+                    DirectFBErrorString( ret ) );
+
+     if (core_part->data_shared)
+          SHFREE( pool, core_part->data_shared );
+
+     if (core_part->data_local)
+          D_FREE( core_part->data_local );
+
+     core_part->data_local  = NULL;
+     core_part->data_shared = NULL;
+     core_part->initialized = false;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_core_part_leave( CoreDFB  *core,
+                     CorePart *core_part,
+                     bool      emergency )
+{
+     DFBResult ret;
+
+     if (!core_part->initialized)
+          return DFB_OK;
+
+     D_DEBUG_AT( Core_Parts, "Going to leave '%s' core...\n", core_part->name );
+
+     ret = core_part->Leave( core_part->data_local, emergency );
+     if (ret)
+          D_ERROR( "DirectFB/Core: Could not leave '%s' core!\n"
+                    "    --> %s\n", core_part->name,
+                    DirectFBErrorString( ret ) );
+
+     if (core_part->data_local)
+          D_FREE( core_part->data_local );
+
+     core_part->data_local  = NULL;
+     core_part->data_shared = NULL;
+     core_part->initialized = false;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/core_parts.h b/Source/DirectFB/src/core/core_parts.h
new file mode 100755
index 0000000..31b7563
--- /dev/null
+++ b/Source/DirectFB/src/core/core_parts.h
@@ -0,0 +1,131 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE_PARTS_H__
+#define __CORE_PARTS_H__
+
+#include <fusion/types.h>
+#include <fusion/lock.h>
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+#include <core/coredefs.h>
+
+
+typedef DFBResult (*CoreInitialize)( CoreDFB *core,
+                                     void    *data_local,
+                                     void    *data_shared );
+
+typedef DFBResult (*CoreJoin)      ( CoreDFB *core,
+                                     void    *data_local,
+                                     void    *data_shared );
+
+typedef DFBResult (*CoreShutdown)  ( void    *data_local,
+                                     bool     emergency );
+
+typedef DFBResult (*CoreLeave)     ( void    *data_local,
+                                     bool     emergency );
+
+typedef DFBResult (*CoreSuspend)   ( void    *data_local );
+
+typedef DFBResult (*CoreResume)    ( void    *data_local );
+
+
+typedef struct {
+     const char     *name;
+
+     int             size_local;
+     int             size_shared;
+
+     CoreInitialize  Initialize;
+     CoreJoin        Join;
+     CoreShutdown    Shutdown;
+     CoreLeave       Leave;
+     CoreSuspend     Suspend;
+     CoreResume      Resume;
+
+     void           *data_local;
+     void           *data_shared;
+
+     bool            initialized;
+} CorePart;
+
+
+DFBResult dfb_core_part_initialize( CoreDFB  *core,
+                                    CorePart *core_part );
+
+DFBResult dfb_core_part_join      ( CoreDFB  *core,
+                                    CorePart *core_part );
+
+DFBResult dfb_core_part_shutdown  ( CoreDFB  *core,
+                                    CorePart *core_part,
+                                    bool      emergency );
+
+DFBResult dfb_core_part_leave     ( CoreDFB  *core,
+                                    CorePart *core_part,
+                                    bool      emergency );
+
+
+#define DFB_CORE_PART(part,Type)                                               \
+                                                                               \
+static DFBResult dfb_##part##_initialize( CoreDFB           *core,             \
+                                          DFB##Type         *local,            \
+                                          DFB##Type##Shared *shared );         \
+                                                                               \
+static DFBResult dfb_##part##_join      ( CoreDFB           *core,             \
+                                          DFB##Type         *local,            \
+                                          DFB##Type##Shared *shared );         \
+                                                                               \
+static DFBResult dfb_##part##_shutdown  ( DFB##Type         *local,            \
+                                          bool               emergency );      \
+                                                                               \
+static DFBResult dfb_##part##_leave     ( DFB##Type         *local,            \
+                                          bool               emergency );      \
+                                                                               \
+static DFBResult dfb_##part##_suspend   ( DFB##Type         *local );          \
+                                                                               \
+static DFBResult dfb_##part##_resume    ( DFB##Type         *local );          \
+                                                                               \
+CorePart dfb_##part = {                                                        \
+     .name        = #part,                                                     \
+                                                                               \
+     .size_local  = sizeof(DFB##Type),                                         \
+     .size_shared = sizeof(DFB##Type##Shared),                                 \
+                                                                               \
+     .Initialize  = (void*)dfb_##part##_initialize,                            \
+     .Join        = (void*)dfb_##part##_join,                                  \
+     .Shutdown    = (void*)dfb_##part##_shutdown,                              \
+     .Leave       = (void*)dfb_##part##_leave,                                 \
+     .Suspend     = (void*)dfb_##part##_suspend,                               \
+     .Resume      = (void*)dfb_##part##_resume,                                \
+}
+
+
+#endif
+
diff --git a/Source/DirectFB/src/core/core_system.h b/Source/DirectFB/src/core/core_system.h
new file mode 100755
index 0000000..dfa2abc
--- /dev/null
+++ b/Source/DirectFB/src/core/core_system.h
@@ -0,0 +1,141 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__CORE_SYSTEM_H__
+#define __DFB__CORE__CORE_SYSTEM_H__
+
+#include <core/system.h>
+
+static void
+system_get_info( CoreSystemInfo *info );
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data );
+
+static DFBResult
+system_join( CoreDFB *core, void **data );
+
+static DFBResult
+system_shutdown( bool emergency );
+
+static DFBResult
+system_leave( bool emergency );
+
+static DFBResult
+system_suspend( void );
+
+static DFBResult
+system_resume( void );
+
+static VideoMode*
+system_get_modes( void );
+
+static VideoMode*
+system_get_current_mode( void );
+
+static DFBResult
+system_thread_init( void );
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event );
+
+static volatile void*
+system_map_mmio( unsigned int    offset,
+                 int             length );
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length );
+
+static int
+system_get_accelerator( void );
+
+static unsigned long
+system_video_memory_physical( unsigned int offset );
+
+static void*
+system_video_memory_virtual( unsigned int offset );
+
+static unsigned int
+system_videoram_length( void );
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset );
+
+static void*
+system_aux_memory_virtual( unsigned int offset );
+
+static unsigned int
+system_auxram_length( void );
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func );
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id, unsigned int *ret_device_id );
+
+
+static CoreSystemFuncs system_funcs = {
+     .GetSystemInfo       = system_get_info,
+     .Initialize          = system_initialize,
+     .Join                = system_join,
+     .Shutdown            = system_shutdown,
+     .Leave               = system_leave,
+     .Suspend             = system_suspend,
+     .Resume              = system_resume,
+     .GetModes            = system_get_modes,
+     .GetCurrentMode      = system_get_current_mode,
+     .ThreadInit          = system_thread_init,
+     .InputFilter         = system_input_filter,
+     .MapMMIO             = system_map_mmio,
+     .UnmapMMIO           = system_unmap_mmio,
+     .GetAccelerator      = system_get_accelerator,
+     .VideoMemoryPhysical = system_video_memory_physical,
+     .VideoMemoryVirtual  = system_video_memory_virtual,
+     .VideoRamLength      = system_videoram_length,
+     .AuxMemoryPhysical   = system_aux_memory_physical,
+     .AuxMemoryVirtual    = system_aux_memory_virtual,
+     .AuxRamLength        = system_auxram_length,
+     .GetBusID            = system_get_busid,
+     .GetDeviceID         = system_get_deviceid
+};
+
+#define DFB_CORE_SYSTEM(shortname)                              \
+__attribute__((constructor)) void directfb_##shortname( void ); \
+                                                                \
+void                                                            \
+directfb_##shortname( void )                                    \
+{                                                               \
+     direct_modules_register( &dfb_core_systems,                \
+                              DFB_CORE_SYSTEM_ABI_VERSION,      \
+                              #shortname, &system_funcs );      \
+}
+
+#endif
+
diff --git a/Source/DirectFB/src/core/coredefs.h b/Source/DirectFB/src/core/coredefs.h
new file mode 100755
index 0000000..3354cfa
--- /dev/null
+++ b/Source/DirectFB/src/core/coredefs.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__COREDEFS_H__
+#define __CORE__COREDEFS_H__
+
+
+#ifdef PIC
+#define DFB_DYNAMIC_LINKING
+#endif
+
+#define MAX_INPUTDEVICES          64
+#define MAX_LAYERS                16
+#define MAX_SCREENS                4
+
+#define MAX_INPUT_GLOBALS          8
+
+#define MAX_SURFACE_BUFFERS        6
+#define MAX_SURFACE_POOLS          8
+#define MAX_SURFACE_POOL_BRIDGES   4
+
+#endif
+
diff --git a/Source/DirectFB/src/core/coretypes.h b/Source/DirectFB/src/core/coretypes.h
new file mode 100755
index 0000000..a5df62d
--- /dev/null
+++ b/Source/DirectFB/src/core/coretypes.h
@@ -0,0 +1,89 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORETYPES_H__
+#define __CORETYPES_H__
+
+#include <dfb_types.h>
+
+typedef struct __DFB_CoreDFB                 CoreDFB;
+typedef struct __DFB_CoreDFBShared           CoreDFBShared;
+
+
+typedef struct __DFB_DFBClipboardCore        DFBClipboardCore;
+typedef struct __DFB_DFBColorHashCore        DFBColorHashCore;
+typedef struct __DFB_DFBGraphicsCore         DFBGraphicsCore;
+typedef struct __DFB_DFBInputCore            DFBInputCore;
+typedef struct __DFB_DFBLayerCore            DFBLayerCore;
+typedef struct __DFB_DFBScreenCore           DFBScreenCore;
+typedef struct __DFB_DFBSystemCore           DFBSystemCore;
+typedef struct __DFB_DFBWMCore               DFBWMCore;
+
+
+typedef struct __DFB_DFBGraphicsCore         CoreGraphicsDevice; /* FIXME */
+
+
+typedef struct _CoreCleanup                  CoreCleanup;
+
+typedef struct _CoreFont                     CoreFont;
+typedef struct _CoreGlyphData                CoreGlyphData;
+typedef struct _CorePalette                  CorePalette;
+
+typedef struct _CardState                    CardState;
+
+
+typedef struct __DFB_CoreGraphicsSerial      CoreGraphicsSerial;
+
+typedef struct __DFB_CoreScreen              CoreScreen;
+
+typedef struct __DFB_CoreInputDevice         CoreInputDevice;
+
+typedef struct __DFB_CoreLayer               CoreLayer;
+typedef struct __DFB_CoreLayerContext        CoreLayerContext;
+typedef struct __DFB_CoreLayerRegion         CoreLayerRegion;
+typedef struct __DFB_CoreLayerRegionConfig   CoreLayerRegionConfig;
+
+typedef struct __DFB_CoreSurface             CoreSurface;
+typedef struct __DFB_CoreSurfaceAccessor     CoreSurfaceAccessor;
+typedef struct __DFB_CoreSurfaceAllocation   CoreSurfaceAllocation;
+typedef struct __DFB_CoreSurfaceBuffer       CoreSurfaceBuffer;
+typedef struct __DFB_CoreSurfaceBufferLock   CoreSurfaceBufferLock;
+typedef struct __DFB_CoreSurfacePool         CoreSurfacePool;
+typedef struct __DFB_CoreSurfacePoolBridge   CoreSurfacePoolBridge;
+typedef struct __DFB_CoreSurfacePoolTransfer CoreSurfacePoolTransfer;
+
+typedef struct __DFB_CoreWindow              CoreWindow;
+typedef struct __DFB_CoreWindowConfig        CoreWindowConfig;
+typedef struct __DFB_CoreWindowStack         CoreWindowStack;
+
+
+typedef unsigned int CoreSurfacePoolID;
+typedef unsigned int CoreSurfacePoolBridgeID;
+
+#endif
+
diff --git a/Source/DirectFB/src/core/fonts.c b/Source/DirectFB/src/core/fonts.c
new file mode 100755
index 0000000..2e6b599
--- /dev/null
+++ b/Source/DirectFB/src/core/fonts.c
@@ -0,0 +1,660 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+#include <direct/debug.h>
+#include <direct/hash.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/utf8.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+
+D_DEBUG_DOMAIN( Core_Font,         "Core/Font",      "DirectFB Core Font" );
+D_DEBUG_DOMAIN( Core_FontSurfaces, "Core/Font/Surf", "DirectFB Core Font Surfaces" );
+
+/**********************************************************************************************************************/
+
+static bool free_glyphs( DirectHash    *hash,
+                         unsigned long  key,
+                         void          *value,
+                         void          *ctx );
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_font_create( CoreDFB                   *core,
+                 const DFBFontDescription  *description,
+                 const char                *url,
+                 CoreFont                 **ret_font )
+{
+     DFBResult  ret;
+     int        i;
+     CoreFont  *font;
+
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( ret_font != NULL );
+
+     font = D_CALLOC( 1, sizeof(CoreFont) );
+     if (!font)
+          return D_OOM();
+
+     for (i=0; i<DFB_FONT_MAX_LAYERS; i++) {
+          ret = direct_hash_create( 163, &font->layers[i].glyph_hash );
+          if (ret) {
+               while (i--)
+                    direct_hash_destroy( font->layers[i].glyph_hash );
+
+               D_FREE( font );
+               return ret;
+          }
+     }
+
+     font->description = *description;
+     font->url         = D_STRDUP( url );
+
+     font->core     = core;
+     font->max_rows = 2;
+
+     direct_util_recursive_pthread_mutex_init( &font->lock );
+
+     /* the proposed pixel_format, may be changed by the font provider */
+     font->pixel_format = dfb_config->font_format ? : DSPF_A8;
+
+     if ((font->pixel_format == DSPF_ARGB || font->pixel_format == DSPF_ARGB4444) && dfb_config->font_premult)
+          font->surface_caps = DSCAPS_PREMULTIPLIED;
+
+     font->blittingflags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
+
+     D_MAGIC_SET( font, CoreFont );
+
+     *ret_font = font;
+
+     return DFB_OK;
+}
+
+void
+dfb_font_destroy( CoreFont *font )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( font, CoreFont );
+
+     D_MAGIC_CLEAR( font );
+
+     D_FREE( font->url );
+
+     pthread_mutex_lock( &font->lock );
+
+     for (i=0; i<DFB_FONT_MAX_LAYERS; i++) {
+          direct_hash_iterate( font->layers[i].glyph_hash, free_glyphs, NULL );
+
+          direct_hash_destroy( font->layers[i].glyph_hash );
+     }
+
+     if (font->rows) {
+          for (i = 0; i < font->num_rows; i++) {
+               CoreFontCacheRow *row = font->rows[i];
+
+               D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+               dfb_surface_unref( row->surface );
+
+               D_MAGIC_CLEAR( row );
+
+               D_FREE( row );
+          }
+
+          D_FREE( font->rows );
+     }
+
+     D_ASSERT( font->encodings != NULL || !font->last_encoding );
+
+     for (i=DTEID_OTHER; i<=font->last_encoding; i++) {
+          CoreFontEncoding *encoding = font->encodings[i];
+
+          D_ASSERT( encoding != NULL );
+          D_ASSERT( encoding->name != NULL );
+
+          D_MAGIC_CLEAR( encoding );
+
+          D_FREE( encoding->name );
+          D_FREE( encoding );
+     }
+
+     if (font->encodings)
+          D_FREE( font->encodings );
+
+     pthread_mutex_unlock( &font->lock );
+     pthread_mutex_destroy( &font->lock );
+
+     D_FREE( font );
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_font_get_glyph_data( CoreFont        *font,
+                         unsigned int     index,
+                         unsigned int     layer,
+                         CoreGlyphData  **ret_data )
+{
+     DFBResult         ret;
+     CoreGlyphData    *data;
+     int               i;
+     int               align;
+     CoreFontCacheRow *row = NULL;
+
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( font, CoreFont );
+     D_ASSERT( ret_data != NULL );
+
+     D_ASSERT( layer < D_ARRAY_SIZE(font->layers) );
+     D_ASSERT( font->num_rows >= 0 );
+
+     if (font->num_rows) {
+          D_ASSERT( font->num_rows <= font->max_rows || font->max_rows < 0 );
+          D_ASSERT( font->active_row >= 0 );
+          D_ASSERT( font->active_row < font->num_rows );
+     }
+
+     if (index < 128 && font->layers[layer].glyph_data[index]) {
+          data = font->layers[layer].glyph_data[index];
+          if (data->failed)
+               goto retry;
+
+          *ret_data = font->layers[layer].glyph_data[index];
+          return DFB_OK;
+     }
+
+     data = direct_hash_lookup( font->layers[layer].glyph_hash, index );
+     if (data) {
+          D_MAGIC_ASSERT( data, CoreGlyphData );
+
+          if (font->rows) {
+               D_ASSERT( data->row >= 0 );
+               D_ASSERT( data->row < font->num_rows );
+
+               row = font->rows[data->row];
+
+               D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+               row->stamp = font->row_stamp++;
+          }
+
+          if (data->failed)
+               goto retry;
+
+          *ret_data = data;
+          return DFB_OK;
+     }
+
+     if (!font->GetGlyphData)
+          return DFB_UNSUPPORTED;
+
+     data = D_CALLOC( 1, sizeof(CoreGlyphData) );
+     if (!data)
+          return D_OOM();
+
+     D_MAGIC_SET( data, CoreGlyphData );
+
+     data->index = index;
+     data->layer = layer;
+
+retry:
+     data->failed = false;
+
+     ret = font->GetGlyphData( font, index, data );
+     if (ret) {
+          D_DERROR( ret, "Core/Font: Could not get glyph info for index %d!\n", index );
+          data->start = data->width = data->height = 0;
+          data->failed = true;
+          goto out;
+     }
+
+     if (data->width < 1 || data->height < 1) {
+          data->start = data->width = data->height = 0;
+          goto out;
+     }
+
+     if (font->rows) {
+          D_ASSERT( font->active_row >= 0 );
+          D_ASSERT( font->active_row < font->num_rows );
+
+          row = font->rows[font->active_row];
+
+          D_MAGIC_ASSERT( row, CoreFontCacheRow );
+     }
+     else {
+          /* Calculate row width? */
+          if (font->row_width == 0) {
+               int width = 2048 * font->height / 64;
+
+               if (width > 2048)
+                    width = 2048;
+
+               if (width < font->maxadvance)
+                    width = font->maxadvance;
+
+               font->row_width = (width + 7) & ~7;
+          }
+     }
+
+     /* Need another font surface? */
+     if (!row || (row->next_x + data->width > font->row_width)) {
+          D_ASSERT( font->max_rows != 0 );
+
+          /* Maximum number of rows reached? */
+          if (font->num_rows == font->max_rows) {
+               int          best_row = -1;
+               unsigned int best_val = 0;
+
+               /* Check for trailing space first. */
+               for (i=0; i<font->num_rows; i++) {
+                    row = font->rows[i];
+
+                    D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+                    if (row->next_x + data->width <= font->row_width) {
+                         if (best_row == -1 || best_val < row->next_x) {
+                              best_row = i;
+                              best_val = row->next_x;
+                         }
+                    }
+               }
+
+               /* Found a row with enough trailing space? */
+               if (best_row != -1) {
+                    font->active_row = best_row;
+                    row = font->rows[best_row];
+
+                    D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+                    D_DEBUG_AT( Core_FontSurfaces, "  -> using trailing space of row %d - %dx%d %s\n",
+                                font->active_row, row->surface->config.size.w, row->surface->config.size.h,
+                                dfb_pixelformat_name(row->surface->config.format) );
+               }
+               else {
+                    CoreGlyphData *d, *n;
+
+                    D_ASSERT( best_row == -1 );
+                    D_ASSERT( best_val == 0 );
+
+                    /* Reuse the least recently used row. */
+                    for (i=0; i<font->num_rows; i++) {
+                         row = font->rows[i];
+
+                         D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+                         if (best_row == -1 || best_val > row->stamp) {
+                              best_row = i;
+                              best_val = row->stamp;
+                         }
+                    }
+
+                    D_ASSERT( best_row != -1 );
+
+                    font->active_row = best_row;
+                    row = font->rows[best_row];
+
+                    D_MAGIC_ASSERT( row, CoreFontCacheRow );
+
+                    D_DEBUG_AT( Core_FontSurfaces, "  -> reusing row %d - %dx%d %s\n",
+                                font->active_row, row->surface->config.size.w, row->surface->config.size.h,
+                                dfb_pixelformat_name(row->surface->config.format) );
+
+                    /* Kick out all glyphs. */
+                    direct_list_foreach_safe (d, n, row->glyphs) {
+                         D_MAGIC_ASSERT( d, CoreGlyphData );
+                         D_ASSERT( d->layer < D_ARRAY_SIZE(font->layers) );
+
+                         /*ret =*/ direct_hash_remove( font->layers[d->layer].glyph_hash, d->index );
+                         //FIXME: use D_ASSERT( ret == DFB_OK );
+
+                         if (d->index < 128)
+                              font->layers[d->layer].glyph_data[d->index] = NULL;
+
+                         D_MAGIC_CLEAR( d );
+                         D_FREE( d );
+                    }
+
+                    /* Reset row. */
+                    row->glyphs = NULL;
+                    row->next_x = 0;
+               }
+          }
+          else {
+               /* Allocate new font cache row structure. */
+               row = D_CALLOC( 1, sizeof(CoreFontCacheRow) );
+               if (!row) {
+                    ret = D_OOM();
+                    goto error;
+               }
+
+               /* Create a new font surface. */
+               ret = dfb_surface_create_simple( font->core,
+                                                font->row_width,
+                                                MAX( font->height + 1, 8 ),
+                                                font->pixel_format,
+                                                font->surface_caps, CSTF_FONT,
+                                                0 /* FIXME: no shared fonts, no font id */,
+                                                NULL, &row->surface );
+               if (ret) {
+                    D_DERROR( ret, "Core/Font: Could not create font surface!\n" );
+                    D_FREE( row );
+                    goto error;
+               }
+
+               D_DEBUG_AT( Core_FontSurfaces, "  -> new row %d - %dx%d %s\n", font->num_rows,
+                           row->surface->config.size.w, row->surface->config.size.h,
+                           dfb_pixelformat_name(row->surface->config.format) );
+
+               D_MAGIC_SET( row, CoreFontCacheRow );
+
+
+               /* Append to array. FIXME: Use vector to avoid realloc each time! */
+               font->rows = D_REALLOC( font->rows, sizeof(void*) * (font->num_rows + 1) );
+               D_ASSERT( font->rows != NULL );
+
+               font->rows[font->num_rows] = row;
+
+               /* Set new row to use. */
+               font->active_row = font->num_rows++;
+          }
+     }
+
+     D_MAGIC_ASSERT( row, CoreFontCacheRow );
+     D_ASSERT( font->num_rows > 0 );
+     D_ASSERT( font->num_rows <= font->max_rows || font->max_rows < 0 );
+     D_ASSERT( font->active_row >= 0 );
+     D_ASSERT( font->active_row < font->num_rows );
+     D_ASSERT( row == font->rows[font->active_row] );
+
+     D_DEBUG_AT( Core_FontSurfaces, "  -> render %2d - %2dx%2d at %d:%03d font <%p>\n",
+                 index, data->width, data->height, font->active_row, row->next_x, font );
+
+     data->row     = font->active_row;
+     data->start   = row->next_x;
+     data->surface = row->surface;
+
+     align = (8 / (DFB_BYTES_PER_PIXEL( font->pixel_format ) ? : 1)) *
+                  (DFB_PIXELFORMAT_ALIGNMENT( font->pixel_format ) + 1) - 1;
+
+     row->next_x  += (data->width + align) & ~align;
+
+     row->stamp = font->row_stamp++;
+
+     /* Render the glyph data into the surface. */
+     ret = font->RenderGlyph( font, index, data );
+     if (ret) {
+          data->start = data->width = data->height = 0;
+          data->failed = true;
+          goto out;
+     }
+
+     dfb_gfxcard_flush_texture_cache();
+
+
+out:
+     if (!data->inserted) {
+          if (row)
+               direct_list_append( &row->glyphs, &data->link );
+
+          direct_hash_insert( font->layers[layer].glyph_hash, index, data );
+
+          if (index < 128)
+               font->layers[layer].glyph_data[index] = data;
+          
+          data->inserted = true;
+     }
+
+     *ret_data = data;
+
+     return DFB_OK;
+
+
+error:
+     D_MAGIC_CLEAR( data );
+     D_FREE( data );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_font_register_encoding( CoreFont                    *font,
+                            const char                  *name,
+                            const CoreFontEncodingFuncs *funcs,
+                            DFBTextEncodingID            encoding_id )
+{
+     CoreFontEncoding  *encoding;
+     CoreFontEncoding **encodings;
+
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( font, CoreFont );
+     D_ASSERT( encoding_id == DTEID_UTF8 || name != NULL );
+     D_ASSERT( funcs != NULL );
+
+     if (!funcs->GetCharacterIndex)
+          return DFB_INVARG;
+
+     /* Special case for default, native format. */
+     if (encoding_id == DTEID_UTF8) {
+          font->utf8 = funcs;
+
+          return DFB_OK;
+     }
+
+     if (!funcs->DecodeText)
+          return DFB_INVARG;
+
+     /* Setup new encoding information. */
+     encoding = D_CALLOC( 1, sizeof(CoreFontEncoding) );
+     if (!encoding)
+          return D_OOM();
+
+     encoding->encoding = font->last_encoding + 1;
+     encoding->funcs    = funcs;
+     encoding->name     = D_STRDUP( name );
+
+     if (!encoding->name) {
+          D_FREE( encoding );
+          return D_OOM();
+     }
+
+     /* Add to array. */
+     encodings = D_REALLOC( font->encodings,
+                            (encoding->encoding + 1) * sizeof(CoreFontEncoding*) );
+     if (!encodings) {
+          D_FREE( encoding->name );
+          D_FREE( encoding );
+          return D_OOM();
+     }
+
+     font->encodings = encodings;
+
+     font->last_encoding++;
+
+     D_ASSERT( font->last_encoding == encoding->encoding );
+
+     encodings[encoding->encoding] = encoding;
+
+     D_MAGIC_SET( encoding, CoreFontEncoding );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_font_decode_text( CoreFont          *font,
+                      DFBTextEncodingID  encoding,
+                      const void        *text,
+                      int                length,
+                      unsigned int      *ret_indices,
+                      int               *ret_num )
+{
+     int pos = 0, num = 0;
+     const u8 *bytes = text;
+
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( font, CoreFont );
+     D_ASSERT( text != NULL );
+     D_ASSERT( length >= 0 );  /* TODO: handle -1 here? */
+     D_ASSERT( ret_indices != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     if (encoding != DTEID_UTF8) {
+          if (encoding > font->last_encoding)
+               return DFB_IDNOTFOUND;
+
+          D_ASSERT( font->encodings[encoding] != NULL );
+          D_ASSERT( font->encodings[encoding]->funcs != NULL );
+          D_ASSERT( font->encodings[encoding]->funcs->DecodeText != NULL );
+
+          return font->encodings[encoding]->funcs->DecodeText( font, text, length,
+                                                               ret_indices, ret_num );
+     }
+     else if (font->utf8) {
+          const CoreFontEncodingFuncs *funcs = font->utf8;
+
+          if (funcs->DecodeText)
+               return funcs->DecodeText( font, text, length, ret_indices, ret_num );
+
+          D_ASSERT( funcs->GetCharacterIndex != NULL );
+
+          while (pos < length) {
+               unsigned int c;
+
+               if (bytes[pos] < 128)
+                    c = bytes[pos++];
+               else {
+                    c = DIRECT_UTF8_GET_CHAR( &bytes[pos] );
+                    pos += DIRECT_UTF8_SKIP(bytes[pos]);
+               }
+
+               if (funcs->GetCharacterIndex( font, c, &ret_indices[num] ) == DFB_OK)
+                    num++;
+          }
+
+     }
+     else {
+          while (pos < length) {
+               if (bytes[pos] < 128)
+                    ret_indices[num++] = bytes[pos++];
+               else {
+                    ret_indices[num++] = DIRECT_UTF8_GET_CHAR( &bytes[pos] );
+                    pos += DIRECT_UTF8_SKIP(bytes[pos]);
+               }
+          }
+     }
+
+     *ret_num = num;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_font_decode_character( CoreFont          *font,
+                           DFBTextEncodingID  encoding,
+                           u32                character,
+                           unsigned int      *ret_index )
+{
+     D_DEBUG_AT( Core_Font, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( font, CoreFont );
+     D_ASSERT( ret_index != NULL );
+
+     if (encoding > font->last_encoding)
+          return DFB_IDNOTFOUND;
+
+     if (encoding != DTEID_UTF8) {
+          D_ASSERT( font->encodings[encoding] != NULL );
+          D_ASSERT( font->encodings[encoding]->funcs != NULL );
+          D_ASSERT( font->encodings[encoding]->funcs->GetCharacterIndex != NULL );
+
+          return font->encodings[encoding]->funcs->GetCharacterIndex( font, character, ret_index );
+     }
+     else if (font->utf8) {
+          const CoreFontEncodingFuncs *funcs = font->utf8;
+
+          D_ASSERT( funcs->GetCharacterIndex != NULL );
+
+          return funcs->GetCharacterIndex( font, character, ret_index );
+     }
+     else
+          *ret_index = character;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static bool
+free_glyphs( DirectHash    *hash,
+             unsigned long  key,
+             void          *value,
+             void          *ctx )
+{
+     CoreGlyphData *data = value;
+
+     D_MAGIC_ASSERT( data, CoreGlyphData );
+
+     D_MAGIC_CLEAR( data );
+     D_FREE( data );
+
+     return true;
+}
+
diff --git a/Source/DirectFB/src/core/fonts.h b/Source/DirectFB/src/core/fonts.h
new file mode 100755
index 0000000..4dc04fa
--- /dev/null
+++ b/Source/DirectFB/src/core/fonts.h
@@ -0,0 +1,250 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __FONTS_H__
+#define __FONTS_H__
+
+#include <pthread.h>
+
+#include <fusion/lock.h>
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+#include <core/state.h>
+
+/*
+ * glyph struct
+ */
+struct _CoreGlyphData {
+     DirectLink     link;
+
+     unsigned int   index;
+     unsigned int   layer;
+     unsigned int   row;
+
+     CoreSurface   *surface;              /* contains bitmap of glyph         */
+     int            start;                /* x offset of glyph in surface     */
+     int            width;                /* width of the glyphs bitmap       */
+     int            height;               /* height of the glyphs bitmap      */
+     int            left;                 /* x offset of the glyph            */
+     int            top;                  /* y offset of the glyph            */
+     int            xadvance;             /* placement of next glyph          */
+     int            yadvance;
+
+     bool           inserted;
+     bool           failed;
+
+     int            magic;
+};
+
+typedef struct {
+     DFBResult   (* GetCharacterIndex) ( CoreFont       *thiz,
+                                         unsigned int    character,
+                                         unsigned int   *ret_index );
+
+     DFBResult   (* DecodeText)        ( CoreFont       *thiz,
+                                         const void     *text,
+                                         int             length,
+                                         unsigned int   *ret_indices,
+                                         int            *ret_num );
+} CoreFontEncodingFuncs;
+
+typedef struct {
+     DirectLink                   link;
+
+     DFBTextEncodingID            encoding;
+     char                        *name;
+     const CoreFontEncodingFuncs *funcs;
+
+     int                          magic;
+} CoreFontEncoding;
+
+typedef struct {
+     unsigned int                 stamp;
+
+     CoreSurface                 *surface;
+     int                          next_x;
+
+     DirectLink                  *glyphs;
+
+     int                          magic;
+} CoreFontCacheRow;
+
+
+#define DFB_FONT_MAX_LAYERS 2
+
+/*
+ * font struct
+ */
+
+struct _CoreFont {
+     CoreDFB                      *core;
+
+     DFBFontDescription            description;   /* original description used to create the font */
+     char                         *url;
+
+     DFBSurfaceBlittingFlags       blittingflags;
+     DFBSurfacePixelFormat         pixel_format;
+     DFBSurfaceCapabilities        surface_caps;
+     int                           row_width;
+     int                           max_rows;
+
+     DFBFontAttributes             attributes;
+
+     CoreFontCacheRow            **rows;          /* contain bitmaps of loaded glyphs */
+     int                           num_rows;
+     int                           active_row;
+     unsigned int                  row_stamp;
+
+     struct {
+          DirectHash              *glyph_hash;    /* infos about loaded glyphs        */
+          CoreGlyphData           *glyph_data[128];
+     } layers[DFB_FONT_MAX_LAYERS];
+
+     int                           height;        /* font height                      */
+
+     int                           ascender;      /* a positive value, the distance
+                                                     from the baseline to the top     */
+     int                           descender;     /* a negative value, the distance
+                                                     from the baseline to the bottom  */
+     int                           maxadvance;    /* width of largest character       */
+
+     float                         up_unit_x;     /* unit vector pointing 'up' in for */
+     float                         up_unit_y;     /* this font's rotation             */
+
+     pthread_mutex_t               lock;          /* lock during access to the font   */
+
+     const CoreFontEncodingFuncs  *utf8;          /* for default encoding, DTEID_UTF8 */
+     CoreFontEncoding            **encodings;     /* for other encodings              */
+     DFBTextEncodingID             last_encoding; /* dynamic allocation impl. helper  */
+
+     void                         *impl_data;     /* a pointer used by the impl.      */
+
+     DFBResult                  (* GetGlyphData) ( CoreFont      *thiz,
+                                                   unsigned int   index,
+                                                   CoreGlyphData *data );
+
+     DFBResult                  (* RenderGlyph)  ( CoreFont      *thiz,
+                                                   unsigned int   index,
+                                                   CoreGlyphData *data );
+
+     DFBResult                  (* GetKerning)   ( CoreFont      *thiz,
+                                                   unsigned int   prev,
+                                                   unsigned int   current,
+                                                   int           *ret_x,
+                                                   int           *ret_y );
+
+
+     int                           magic;
+};
+
+/*
+ * allocates and initializes a new font structure
+ */
+DFBResult dfb_font_create( CoreDFB                   *core,
+                           const DFBFontDescription  *description,
+                           const char                *url,
+                           CoreFont                 **ret_font );
+
+/*
+ * destroy all data in the CoreFont struct
+ */
+void dfb_font_destroy( CoreFont *font );
+
+/*
+ * lock the font before accessing it
+ */
+static inline void
+dfb_font_lock( CoreFont *font )
+{
+     D_MAGIC_ASSERT( font, CoreFont );
+
+     pthread_mutex_lock( &font->lock );
+}
+
+/*
+ * unlock the font after access
+ */
+static inline void
+dfb_font_unlock( CoreFont *font )
+{
+     D_MAGIC_ASSERT( font, CoreFont );
+
+     pthread_mutex_unlock( &font->lock );
+}
+
+/*
+ * loads glyph data from font
+ */
+DFBResult dfb_font_get_glyph_data( CoreFont        *font,
+                                   unsigned int     index,
+                                   unsigned int     layer,
+                                   CoreGlyphData  **glyph_data );
+
+
+/*
+ * Called by font module to register encoding implementations.
+ *
+ * The encoding can be DTEID_UTF8 or DTEID_OTHER, where in the
+ * latter case the actual id will be allocated dynamically.
+ *
+ * In the case of DTEID_UTF8 it's allowed to only provide
+ * GetCharacterIndex() and let the core do the DecodeText(),
+ * but that would cause a GetCharacterIndex() call per decoded
+ * unicode character. So implementing both is advisable.
+ *
+ * If nothing is registered for DTEID_UTF8 at all, the core will
+ * pass the raw unicode characters to GetGlyphInfo(), RenderGlyph() etc.
+ * That's the old behaviour, fully compatible with old modules. It's
+ * also a good choice if you want to avoid the character translation,
+ * having an efficient font module which is based natively on unicode
+ * characters.
+ *
+ * For registering an encoding as DTEID_OTHER both GetCharacterIndex()
+ * and DecodeText() must be provided.
+ */
+DFBResult dfb_font_register_encoding( CoreFont                    *font,
+                                      const char                  *name,
+                                      const CoreFontEncodingFuncs *funcs,
+                                      DFBTextEncodingID            encoding );
+
+DFBResult dfb_font_decode_text( CoreFont          *font,
+                                DFBTextEncodingID  encoding,
+                                const void        *text,
+                                int                length,
+                                unsigned int      *ret_indices,
+                                int               *ret_num );
+
+DFBResult dfb_font_decode_character( CoreFont          *font,
+                                     DFBTextEncodingID  encoding,
+                                     u32                character,
+                                     unsigned int      *ret_index );
+
+#endif
diff --git a/Source/DirectFB/src/core/gfxcard.c b/Source/DirectFB/src/core/gfxcard.c
new file mode 100755
index 0000000..84e725c
--- /dev/null
+++ b/Source/DirectFB/src/core/gfxcard.c
@@ -0,0 +1,2921 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <limits.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+#include <fusion/arena.h>
+#include <fusion/property.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core_parts.h>
+#include <core/gfxcard.h>
+#include <core/fonts.h>
+#include <core/state.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/system.h>
+
+#include <gfx/generic/generic.h>
+#include <gfx/clip.h>
+#include <gfx/util.h>
+
+#include <direct/hash.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/modules.h>
+#include <direct/utf8.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+
+D_DEBUG_DOMAIN( Core_Graphics,    "Core/Graphics",    "DirectFB Graphics Core" );
+D_DEBUG_DOMAIN( Core_GraphicsOps, "Core/GraphicsOps", "DirectFB Graphics Core Operations" );
+D_DEBUG_DOMAIN( Core_GfxState,    "Core/GfxState",    "DirectFB Graphics Core State" );
+
+
+DEFINE_MODULE_DIRECTORY( dfb_graphics_drivers, "gfxdrivers", DFB_GRAPHICS_DRIVER_ABI_VERSION );
+
+/**********************************************************************************************************************/
+
+static void dfb_gfxcard_find_driver( CoreDFB *core );
+static void dfb_gfxcard_load_driver( void );
+
+static void fill_tri( DFBTriangle *tri, CardState *state, bool accelerated );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                      magic;
+
+     /* amount of usable memory */
+     unsigned int             videoram_length;
+     unsigned int             auxram_length;
+     unsigned int             auxram_offset;
+
+     char                    *module_name;
+
+     GraphicsDriverInfo       driver_info;
+     GraphicsDeviceInfo       device_info;
+     void                    *device_data;
+
+     FusionProperty           lock;
+     GraphicsDeviceLockFlags  lock_flags;
+
+     /*
+      * Points to the current state of the graphics card.
+      */
+     CardState               *state;
+     FusionID                 holder; /* Fusion ID of state owner. */
+} DFBGraphicsCoreShared;
+
+struct __DFB_DFBGraphicsCore {
+     int                        magic;
+
+     CoreDFB                   *core;
+
+     DFBGraphicsCoreShared     *shared;
+
+     DirectModuleEntry         *module;
+     const GraphicsDriverFuncs *driver_funcs;
+
+     void                      *driver_data;
+     void                      *device_data; /* copy of shared->device_data */
+
+     CardCapabilities           caps;        /* local caps */
+     CardLimitations            limits;      /* local limits */
+
+     GraphicsDeviceFuncs        funcs;
+};
+
+
+DFB_CORE_PART( graphics_core, GraphicsCore );
+
+/**********************************************************************************************************************/
+
+static CoreGraphicsDevice *card;   /* FIXME */
+
+/* Hook for registering additional screen(s) and layer(s) in app or lib initializing DirectFB. */
+void (*__DFB_CoreRegisterHook)( CoreDFB *core, CoreGraphicsDevice *device, void *ctx ) = NULL;
+void  *__DFB_CoreRegisterHookCtx = NULL;
+
+
+/** public **/
+
+static DFBResult
+dfb_graphics_core_initialize( CoreDFB               *core,
+                              DFBGraphicsCore       *data,
+                              DFBGraphicsCoreShared *shared )
+{
+     DFBResult            ret;
+     int                  videoram_length;
+     int                  auxram_length;
+     FusionSHMPoolShared *pool = dfb_core_shmpool( core );
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+
+     card = data;   /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     /* fill generic driver info */
+     gGetDriverInfo( &shared->driver_info );
+
+     /* fill generic device info */
+     gGetDeviceInfo( &shared->device_info );
+
+     if (!shared->device_info.limits.dst_max.w)
+          shared->device_info.limits.dst_max.w = INT_MAX;
+
+     if (!shared->device_info.limits.dst_max.h)
+          shared->device_info.limits.dst_max.h = INT_MAX;
+
+     /* Limit video ram length */
+     videoram_length = dfb_system_videoram_length();
+     if (videoram_length) {
+          if (dfb_config->videoram_limit > 0 &&
+              dfb_config->videoram_limit < videoram_length)
+               shared->videoram_length = dfb_config->videoram_limit;
+          else
+               shared->videoram_length = videoram_length;
+     }
+
+     /* Limit auxiliary memory length (currently only AGP) */
+     auxram_length = dfb_system_auxram_length();
+     if (auxram_length) {
+          if (dfb_config->agpmem_limit > 0 &&
+              dfb_config->agpmem_limit < auxram_length)
+               shared->auxram_length = dfb_config->agpmem_limit;
+          else
+               shared->auxram_length = auxram_length;
+     }
+
+     /* Build a list of available drivers. */
+     direct_modules_explore_directory( &dfb_graphics_drivers );
+
+     /* Load driver */
+     if (dfb_system_caps() & CSCAPS_ACCELERATION)
+          dfb_gfxcard_find_driver( core );
+
+     if (data->driver_funcs) {
+          const GraphicsDriverFuncs *funcs = data->driver_funcs;
+
+          data->driver_data = D_CALLOC( 1, shared->driver_info.driver_data_size );
+
+          card->device_data   =
+          shared->device_data = SHCALLOC( pool, 1, shared->driver_info.device_data_size );
+
+          ret = funcs->InitDriver( card, &card->funcs,
+                                   card->driver_data, card->device_data, core );
+          if (ret) {
+               SHFREE( pool, shared->device_data );
+               SHFREE( pool, shared->module_name );
+               D_FREE( card->driver_data );
+               card = NULL;
+               return ret;
+          }
+
+          ret = funcs->InitDevice( data, &shared->device_info,
+                                   data->driver_data, data->device_data );
+          if (ret) {
+               funcs->CloseDriver( card, card->driver_data );
+               SHFREE( pool, shared->device_data );
+               SHFREE( pool, shared->module_name );
+               D_FREE( card->driver_data );
+               card = NULL;
+               return ret;
+          }
+
+          if (data->funcs.EngineReset)
+               data->funcs.EngineReset( data->driver_data, data->device_data );
+     }
+
+     D_INFO( "DirectFB/Graphics: %s %s %d.%d (%s)\n",
+             shared->device_info.vendor, shared->device_info.name,
+             shared->driver_info.version.major,
+             shared->driver_info.version.minor, shared->driver_info.vendor );
+
+     if (dfb_config->software_only) {
+          if (data->funcs.CheckState) {
+               data->funcs.CheckState = NULL;
+
+               D_INFO( "DirectFB/Graphics: Acceleration disabled (by 'no-hardware')\n" );
+          }
+     }
+     else {
+          data->caps   = shared->device_info.caps;
+          data->limits = shared->device_info.limits;
+     }
+
+     fusion_property_init( &shared->lock, dfb_core_world(core) );
+
+     if (__DFB_CoreRegisterHook)
+         __DFB_CoreRegisterHook( core, card, __DFB_CoreRegisterHookCtx );
+
+     D_MAGIC_SET( data, DFBGraphicsCore );
+     D_MAGIC_SET( shared, DFBGraphicsCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_graphics_core_join( CoreDFB               *core,
+                        DFBGraphicsCore       *data,
+                        DFBGraphicsCoreShared *shared )
+{
+     DFBResult          ret;
+     GraphicsDriverInfo driver_info;
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBGraphicsCoreShared );
+
+     card = data;   /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+     /* Initialize software rasterizer. */
+     gGetDriverInfo( &driver_info );
+
+     /* Build a list of available drivers. */
+     direct_modules_explore_directory( &dfb_graphics_drivers );
+
+     /* Load driver. */
+     if (dfb_system_caps() & CSCAPS_ACCELERATION)
+          dfb_gfxcard_load_driver();
+
+     if (data->driver_funcs) {
+          const GraphicsDriverFuncs *funcs = data->driver_funcs;
+
+          data->driver_data = D_CALLOC( 1, shared->driver_info.driver_data_size );
+
+          data->device_data = shared->device_data;
+
+          ret = funcs->InitDriver( card, &card->funcs,
+                                   card->driver_data, card->device_data, core );
+          if (ret) {
+               D_FREE( data->driver_data );
+               data = NULL;
+               return ret;
+          }
+     }
+     else if (shared->module_name) {
+          D_ERROR( "DirectFB/Graphics: Could not load driver used by the running session!\n" );
+          data = NULL;
+          return DFB_UNSUPPORTED;
+     }
+
+
+     D_INFO( "DirectFB/Graphics: %s %s %d.%d (%s)\n",
+             shared->device_info.vendor, shared->device_info.name,
+             shared->driver_info.version.major,
+             shared->driver_info.version.minor, shared->driver_info.vendor );
+
+     if (dfb_config->software_only) {
+          if (data->funcs.CheckState) {
+               data->funcs.CheckState = NULL;
+
+               D_INFO( "DirectFB/Graphics: Acceleration disabled (by 'no-hardware')\n" );
+          }
+     }
+     else {
+          data->caps   = shared->device_info.caps;
+          data->limits = shared->device_info.limits;
+     }
+
+     D_MAGIC_SET( data, DFBGraphicsCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_graphics_core_shutdown( DFBGraphicsCore *data,
+                            bool             emergency )
+{
+     DFBGraphicsCoreShared *shared;
+     FusionSHMPoolShared   *pool = dfb_core_shmpool( data->core );
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBGraphicsCore );
+     D_MAGIC_ASSERT( data->shared, DFBGraphicsCoreShared );
+
+     shared = data->shared;
+
+
+     dfb_gfxcard_lock( GDLF_SYNC );
+
+     if (data->driver_funcs) {
+          const GraphicsDriverFuncs *funcs = data->driver_funcs;
+
+          funcs->CloseDevice( data, data->driver_data, data->device_data );
+          funcs->CloseDriver( data, data->driver_data );
+
+          direct_module_unref( data->module );
+
+          SHFREE( pool, card->device_data );
+          D_FREE( card->driver_data );
+     }
+
+     fusion_property_destroy( &shared->lock );
+
+     if (shared->module_name)
+          SHFREE( pool, shared->module_name );
+
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_graphics_core_leave( DFBGraphicsCore *data,
+                         bool             emergency )
+{
+     DFBGraphicsCoreShared *shared;
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBGraphicsCore );
+     D_MAGIC_ASSERT( data->shared, DFBGraphicsCoreShared );
+
+     shared = data->shared;
+
+     if (data->driver_funcs) {
+          data->driver_funcs->CloseDriver( data, data->driver_data );
+
+          direct_module_unref( data->module );
+
+          D_FREE( data->driver_data );
+     }
+
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_graphics_core_suspend( DFBGraphicsCore *data )
+{
+     DFBGraphicsCoreShared *shared;
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBGraphicsCore );
+     D_MAGIC_ASSERT( data->shared, DFBGraphicsCoreShared );
+
+     shared = data->shared;
+
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC | GDLF_RESET | GDLF_INVALIDATE );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_graphics_core_resume( DFBGraphicsCore *data )
+{
+     DFBGraphicsCoreShared *shared;
+
+     D_DEBUG_AT( Core_Graphics, "dfb_graphics_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBGraphicsCore );
+     D_MAGIC_ASSERT( data->shared, DFBGraphicsCoreShared );
+
+     shared = data->shared;
+
+     dfb_gfxcard_unlock();
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_gfxcard_lock( GraphicsDeviceLockFlags flags )
+{
+     DFBResult              ret;
+     DFBGraphicsCoreShared *shared;
+     GraphicsDeviceFuncs   *funcs;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     shared = card->shared;
+     funcs  = &card->funcs;
+
+     if ( ((flags & GDLF_WAIT) ?
+           fusion_property_purchase( &shared->lock ) :
+           fusion_property_lease( &shared->lock )) )
+          return DFB_FAILURE;
+
+     if ((flags & GDLF_SYNC) && funcs->EngineSync) {
+          ret = funcs->EngineSync( card->driver_data, card->device_data );
+          if (ret) {
+               if (funcs->EngineReset)
+                    funcs->EngineReset( card->driver_data, card->device_data );
+
+               shared->state = NULL;
+
+               fusion_property_cede( &shared->lock );
+
+               return ret;
+          }
+     }
+
+     if ((shared->lock_flags & GDLF_RESET) && funcs->EngineReset)
+          funcs->EngineReset( card->driver_data, card->device_data );
+
+     if (shared->lock_flags & GDLF_INVALIDATE) {
+          if (funcs->InvalidateState)
+               funcs->InvalidateState( card->driver_data, card->device_data );
+          shared->state = NULL;
+     }
+
+     shared->lock_flags = flags;
+
+     return DFB_OK;
+}
+
+void
+dfb_gfxcard_unlock( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     fusion_property_cede( &card->shared->lock );
+}
+
+void
+dfb_gfxcard_holdup( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     fusion_property_holdup( &card->shared->lock );
+}
+
+/*
+ * Signal beginning of a sequence of operations using this state.
+ * Any number of states can be 'drawing'.
+ */
+void
+dfb_gfxcard_start_drawing( CoreGraphicsDevice *device, CardState *state )
+{
+     D_ASSERT( device != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+
+     if (device->funcs.StartDrawing)
+          device->funcs.StartDrawing( device->driver_data, device->device_data, state );
+}
+
+/*
+ * Signal end of sequence, i.e. destination surface is consistent again.
+ */
+void
+dfb_gfxcard_stop_drawing( CoreGraphicsDevice *device, CardState *state )
+{
+     D_ASSERT( device != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+
+     if (device->funcs.StopDrawing)
+          device->funcs.StopDrawing( device->driver_data, device->device_data, state );
+}
+
+/*
+ * This function returns non zero if acceleration is available
+ * for the specific function using the given state.
+ */
+bool
+dfb_gfxcard_state_check( CardState *state, DFBAccelerationMask accel )
+{
+     CoreSurface       *dst;
+     CoreSurface       *src;
+     CoreSurfaceBuffer *dst_buffer;
+     CoreSurfaceBuffer *src_buffer;
+
+     int cx2, cy2;
+
+     D_ASSERT( card != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_MAGIC_ASSERT_IF( state->destination, CoreSurface );
+     D_MAGIC_ASSERT_IF( state->source, CoreSurface );
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p, 0x%08x ) [%d,%d - %d,%d]\n",
+                 __FUNCTION__, state, accel, DFB_REGION_VALS( &state->clip ) );
+
+     D_ASSERT( state->clip.x2 >= state->clip.x1 );
+     D_ASSERT( state->clip.y2 >= state->clip.y1 );
+     D_ASSERT( state->clip.x1 >= 0 );
+     D_ASSERT( state->clip.y1 >= 0 );
+
+     if (DFB_BLITTING_FUNCTION(accel)) {
+          D_DEBUG_AT( Core_GfxState, "%s( %p, 0x%08x )  blitting %p -> %p\n", __FUNCTION__,
+                      state, accel, state->source, state->destination );
+     }
+     else {
+          D_DEBUG_AT( Core_GfxState, "%s( %p, 0x%08x )  drawing -> %p\n", __FUNCTION__,
+                      state, accel, state->destination );
+     }
+
+     if (state->clip.x1 < 0) {
+          state->clip.x1   = 0;
+          state->modified |= SMF_CLIP;
+     }
+
+     if (state->clip.y1 < 0) {
+          state->clip.y1   = 0;
+          state->modified |= SMF_CLIP;
+     }
+
+     D_DEBUG_AT( Core_GfxState, "  <- checked 0x%08x, accel 0x%08x, modified 0x%08x, mod_hw 0x%08x\n",
+                 state->checked, state->accel, state->modified, state->mod_hw );
+
+     dst = state->destination;
+     src = state->source;
+
+     /* Destination may have been destroyed. */
+     if (!dst) {
+          D_BUG( "no destination" );
+          return false;
+     }
+
+     /* Source may have been destroyed. */
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if (!src) {
+               D_BUG( "no source" );
+               return false;
+          }
+
+          /* Mask may have been destroyed. */
+          if (state->blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR) && !state->source_mask) {
+               D_BUG( "no mask" );
+               return false;
+          }
+     }
+
+     dst_buffer = dfb_surface_get_buffer( dst, state->to );
+     D_MAGIC_ASSERT( dst_buffer, CoreSurfaceBuffer );
+
+     D_ASSUME( state->clip.x2 < dst->config.size.w );
+     D_ASSUME( state->clip.y2 < dst->config.size.h );
+
+     cx2 = state->destination->config.size.w  - 1;
+     cy2 = state->destination->config.size.h - 1;
+
+     if (state->clip.x2 > cx2) {
+          state->clip.x2 = cx2;
+
+          if (state->clip.x1 > cx2)
+               state->clip.x1 = cx2;
+
+          state->modified |= SMF_CLIP;
+     }
+
+     if (state->clip.y2 > cy2) {
+          state->clip.y2 = cy2;
+
+          if (state->clip.y1 > cy2)
+               state->clip.y1 = cy2;
+
+          state->modified |= SMF_CLIP;
+     }
+
+
+     /*
+      * If there's no CheckState function there's no acceleration at all.
+      */
+     if (!card->funcs.CheckState)
+          return false;
+
+     /*
+      * Check if this function has been disabled temporarily.
+      */
+     if (state->disabled & accel)
+          return false;
+
+     /* If destination or blend functions have been changed... */
+     if (state->modified & (SMF_DESTINATION | SMF_SRC_BLEND | SMF_DST_BLEND | SMF_RENDER_OPTIONS)) {
+          /* ...force rechecking for all functions. */
+          state->checked = DFXL_NONE;
+     }
+     else {
+          /* If source/mask or blitting flags have been changed... */
+          if (state->modified & (SMF_SOURCE | SMF_BLITTING_FLAGS | SMF_SOURCE_MASK | SMF_SOURCE_MASK_VALS)) {
+               /* ...force rechecking for all blitting functions. */
+               state->checked &= ~DFXL_ALL_BLIT;
+          }
+
+          /* If drawing flags have been changed... */
+          if (state->modified & SMF_DRAWING_FLAGS) {
+               /* ...force rechecking for all drawing functions. */
+               state->checked &= ~DFXL_ALL_DRAW;
+          }
+     }
+
+     D_DEBUG_AT( Core_GfxState, "  -> checked 0x%08x, accel 0x%08x, modified 0x%08x, mod_hw 0x%08x\n",
+                 state->checked, state->accel, state->modified, state->mod_hw );
+
+     /* If the function needs to be checked... */
+     if (!(state->checked & accel)) {
+          /* Unset unchecked functions. */
+          state->accel &= state->checked;
+
+          /* Call driver to (re)set the bit if the function is supported. */
+          card->funcs.CheckState( card->driver_data, card->device_data, state, accel );
+
+          /* Add the function to 'checked functions'. */
+          state->checked |= accel;
+
+          /* Add additional functions the driver might have checked, too. */
+          state->checked |= state->accel;
+     }
+
+     D_DEBUG_AT( Core_GfxState, "  -> checked 0x%08x, accel 0x%08x, modified 0x%08x, mod_hw 0x%08x\n",
+                 state->checked, state->accel, state->modified, state->mod_hw );
+
+     /* Move modification flags to the set for drivers. */
+     state->mod_hw   |= state->modified;
+     state->modified  = 0;
+
+     /*
+      * If back_buffer policy is 'system only' there's no acceleration
+      * available.
+      */
+     if (dst_buffer->policy == CSP_SYSTEMONLY || /* Special check required if driver does not check itself. */
+                                                 ( !(card->caps.flags & CCF_RENDEROPTS) &&
+                                                    (state->render_options & DSRO_MATRIX) ))
+     {
+          /* Clear 'accelerated functions'. */
+          state->accel   = DFXL_NONE;
+          state->checked = DFXL_ALL;
+     }
+     else if (DFB_BLITTING_FUNCTION( accel )) {
+          /*
+           * If the front buffer policy of the source is 'system only'
+           * no accelerated blitting is available.
+           */
+          src_buffer = dfb_surface_get_buffer( src, state->from );
+
+          D_MAGIC_ASSERT( src_buffer, CoreSurfaceBuffer );
+
+          if (src_buffer->policy == CSP_SYSTEMONLY && !(card->caps.flags & CCF_READSYSMEM)) {
+               /* Clear 'accelerated blitting functions'. */
+               state->accel   &= ~DFXL_ALL_BLIT;
+               state->checked |=  DFXL_ALL_BLIT;
+          }
+     }
+
+     D_DEBUG_AT( Core_GfxState, "  => checked 0x%08x, accel 0x%08x, modified 0x%08x, mod_hw 0x%08x\n",
+                 state->checked, state->accel, state->modified, state->mod_hw );
+
+     /* Return whether the function bit is set. */
+     return !!(state->accel & accel);
+}
+
+/*
+ * This function returns non zero after successful locking the surface(s)
+ * for access by hardware. Propagate state changes to driver.
+ */
+static bool
+dfb_gfxcard_state_acquire( CardState *state, DFBAccelerationMask accel )
+{
+     DFBResult               ret;
+     CoreSurface            *dst;
+     CoreSurface            *src;
+     DFBGraphicsCoreShared  *shared;
+     CoreSurfaceAccessFlags  access = CSAF_WRITE;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     D_MAGIC_ASSERT( state, CardState );
+     D_MAGIC_ASSERT_IF( state->destination, CoreSurface );
+     D_MAGIC_ASSERT_IF( state->source, CoreSurface );
+
+     dst    = state->destination;
+     src    = state->source;
+     shared = card->shared;
+
+     /* find locking flags */
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                      DSBLIT_BLEND_COLORALPHA   |
+                                      DSBLIT_DST_COLORKEY))
+               access |= CSAF_READ;
+     }
+     else if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_DST_COLORKEY))
+          access |= CSAF_READ;
+
+     if (DFB_BLITTING_FUNCTION(accel)) {
+          D_DEBUG_AT( Core_GfxState, "%s( %p, 0x%08x )  blitting %p -> %p\n", __FUNCTION__,
+                      state, accel, state->source, state->destination );
+     }
+     else {
+          D_DEBUG_AT( Core_GfxState, "%s( %p, 0x%08x )  drawing -> %p\n", __FUNCTION__,
+                      state, accel, state->destination );
+     }
+
+     /* lock destination */
+     ret = dfb_surface_lock_buffer( dst, state->to, CSAID_GPU, access, &state->dst );
+     if (ret) {
+          D_DEBUG_AT( Core_Graphics, "Could not lock destination for GPU access!\n" );
+          return false;
+     }
+
+     /* if blitting... */
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          /* ...lock source for reading */
+          ret = dfb_surface_lock_buffer( src, state->from, CSAID_GPU, CSAF_READ, &state->src );
+          if (ret) {
+               D_DEBUG_AT( Core_Graphics, "Could not lock source for GPU access!\n" );
+               dfb_surface_unlock_buffer( dst, &state->dst );
+               return false;
+          }
+
+          state->flags |= CSF_SOURCE_LOCKED;
+
+          /* if using a mask... */
+          if (state->blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR)) {
+               /* ...lock source mask for reading */
+               ret = dfb_surface_lock_buffer( state->source_mask, state->from, CSAID_GPU, CSAF_READ, &state->src_mask );
+               if (ret) {
+                    D_DEBUG_AT( Core_Graphics, "Could not lock source mask for GPU access!\n" );
+                    dfb_surface_unlock_buffer( src, &state->src );
+                    dfb_surface_unlock_buffer( dst, &state->dst );
+                    return false;
+               }
+
+               state->flags |= CSF_SOURCE_MASK_LOCKED;
+          }
+     }
+
+     /*
+      * Make sure that state setting with subsequent command execution
+      * isn't done by two processes simultaneously.
+      *
+      * This will timeout if the hardware is locked by another party with
+      * the first argument being true (e.g. DRI).
+      */
+     if (dfb_gfxcard_lock( GDLF_NONE )) {
+          D_DERROR( ret, "Core/Graphics: Could not lock GPU!\n" );
+
+          dfb_surface_unlock_buffer( dst, &state->dst );
+
+          if (state->flags & CSF_SOURCE_LOCKED) {
+               dfb_surface_unlock_buffer( src, &state->src );
+               state->flags &= ~CSF_SOURCE_LOCKED;
+          }
+
+          /* if source mask got locked this value is true */
+          if (state->flags & CSF_SOURCE_MASK_LOCKED) {
+               dfb_surface_unlock_buffer( state->source_mask, &state->src_mask );
+
+               state->flags &= ~CSF_SOURCE_MASK_LOCKED;
+          }
+
+          return false;
+     }
+
+     /* if we are switching to another state... */
+     if (state != shared->state || state->fusion_id != shared->holder) {
+          D_DEBUG_AT( Core_GfxState, "  -> switch from %p [%lu] to %p [%lu]\n",
+                      shared->state, shared->holder, state, state->fusion_id );
+
+          /* ...set all modification bits and clear 'set functions' */
+          state->mod_hw |= SMF_ALL;
+          state->set     = 0;
+
+          shared->state  = state;
+          shared->holder = state->fusion_id;
+     }
+
+     dfb_state_update( state, state->flags & (CSF_SOURCE_LOCKED | CSF_SOURCE_MASK_LOCKED) );
+
+     D_DEBUG_AT( Core_GfxState, "  -> mod_hw 0x%08x, modified 0x%08x\n", state->mod_hw, state->modified );
+
+     /* Move modification flags to the set for drivers. */
+     state->mod_hw   |= state->modified;
+     state->modified  = SMF_ALL;
+
+     /*
+      * If function hasn't been set or state is modified,
+      * call the driver function to propagate the state changes.
+      */
+     D_DEBUG_AT( Core_GfxState, "  -> mod_hw 0x%08x, set 0x%08x\n", state->mod_hw, state->set );
+     if (state->mod_hw || !(state->set & accel)) {
+          card->funcs.SetState( card->driver_data, card->device_data,
+                                &card->funcs, state, accel );
+
+          D_DEBUG_AT( Core_GfxState, "  => mod_hw 0x%08x, set 0x%08x\n", state->mod_hw, state->set );
+     }
+
+     if (state->modified != SMF_ALL)
+          D_ONCE( "USING OLD DRIVER! *** Use 'state->mod_hw' NOT 'modified'." );
+
+     state->modified = 0;
+
+     return true;
+}
+
+/*
+ * Unlock destination and possibly the source.
+ */
+static void
+dfb_gfxcard_state_release( CardState *state )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( state->destination != NULL );
+
+     /* start command processing if not already running */
+     if (card->funcs.EmitCommands)
+          card->funcs.EmitCommands( card->driver_data, card->device_data );
+
+     /* Store the serial of the operation. */
+#if FIXME_SC_2
+     if (card->funcs.GetSerial) {
+          card->funcs.GetSerial( card->driver_data, card->device_data, &state->serial );
+
+          state->destination->back_buffer->video.serial = state->serial;
+     }
+#endif
+
+     /* allow others to use the hardware */
+     dfb_gfxcard_unlock();
+
+     /* destination always gets locked during acquisition */
+     dfb_surface_unlock_buffer( state->destination, &state->dst );
+
+     /* if source got locked this value is true */
+     if (state->flags & CSF_SOURCE_LOCKED) {
+          dfb_surface_unlock_buffer( state->source, &state->src );
+
+          state->flags &= ~CSF_SOURCE_LOCKED;
+     }
+
+     /* if source mask got locked this value is true */
+     if (state->flags & CSF_SOURCE_MASK_LOCKED) {
+          dfb_surface_unlock_buffer( state->source_mask, &state->src_mask );
+
+          state->flags &= ~CSF_SOURCE_MASK_LOCKED;
+     }
+}
+
+/** DRAWING FUNCTIONS **/
+
+#define DFB_TRANSFORM(x, y, m, affine) \
+do { \
+     s32 _x, _y, _w; \
+     if (affine) { \
+          _x = ((x) * (m)[0] + (y) * (m)[1] + (m)[2] + 0x8000) >> 16; \
+          _y = ((x) * (m)[3] + (y) * (m)[4] + (m)[5] + 0x8000) >> 16; \
+     } \
+     else { \
+          _x = ((x) * (m)[0] + (y) * (m)[1] + (m)[2]); \
+          _y = ((x) * (m)[3] + (y) * (m)[4] + (m)[5]); \
+          _w = ((x) * (m)[6] + (y) * (m)[7] + (m)[8]); \
+          if (!_w) { \
+               _x = (_x < 0) ? -0x7fffffff : 0x7fffffff; \
+               _y = (_y < 0) ? -0x7fffffff : 0x7fffffff; \
+          } \
+          else { \
+               _x /= _w; \
+               _y /= _w; \
+          } \
+     } \
+     (x) = _x; \
+     (y) = _y; \
+} while (0)
+
+void
+dfb_gfxcard_fillrectangles( const DFBRectangle *rects, int num, CardState *state )
+{
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %p )\n", __FUNCTION__, rects, num, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( rects != NULL );
+     D_ASSERT( num > 0 );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (!(state->render_options & DSRO_MATRIX)) {
+          while (num > 0) {
+               if (dfb_rectangle_region_intersects( rects, &state->clip ))
+                    break;
+
+               rects++;
+               num--;
+          }
+     }
+
+     if (num > 0) {
+          int          i = 0;
+          DFBRectangle rect;
+
+          /* Check for acceleration and setup execution. */
+          if (dfb_gfxcard_state_check( state, DFXL_FILLRECTANGLE ) &&
+              dfb_gfxcard_state_acquire( state, DFXL_FILLRECTANGLE ))
+          {
+               /*
+                * Now everything is prepared for execution of the
+                * FillRectangle driver function.
+                */
+               for (; i<num; i++) {
+                    if (!(state->render_options & DSRO_MATRIX) &&
+                        !dfb_rectangle_region_intersects( &rects[i], &state->clip ))
+                         continue;
+
+                    rect = rects[i];
+
+                    if (rect.w > card->limits.dst_max.w || rect.h > card->limits.dst_max.h) {
+                         dfb_clip_rectangle( &state->clip, &rect );
+
+                         if (rect.w > card->limits.dst_max.w || rect.h > card->limits.dst_max.h)
+                              break;
+                    }
+                    else if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+                             !D_FLAGS_IS_SET( card->caps.clip, DFXL_FILLRECTANGLE ))
+                         dfb_clip_rectangle( &state->clip, &rect );
+
+                    if (!card->funcs.FillRectangle( card->driver_data,
+                                                    card->device_data, &rect ))
+                         break;
+               }
+
+               /* Release after state acquisition. */
+               dfb_gfxcard_state_release( state );
+          }
+
+          if (i < num) {
+               /* Use software fallback. */
+               if (gAcquire( state, DFXL_FILLRECTANGLE )) {
+                    if (!(state->render_options & DSRO_MATRIX)) {
+                         for (; i<num; i++) {
+                              rect = rects[i];
+
+                              if (dfb_clip_rectangle( &state->clip, &rect ))
+                                   gFillRectangle( state, &rect );
+                         }
+                    }
+                    else if (state->matrix[1] == 0 && state->matrix[3] == 0) {
+                         /* Scaled/Translated Rectangle. */
+                         for (; i<num; i++) {
+                              int x1, y1, x2, y2;
+                              
+                              x1 = rects[i].x;    y1 = rects[i].y;
+                              x2 = x1+rects[i].w; y2 = y1+rects[i].h;
+                              DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                              
+                              if (x1 < x2) {
+                                   rect.x = x1;
+                                   rect.w = x2-x1;
+                              } else {
+                                   rect.x = x2;
+                                   rect.w = x1-x2;
+                              }
+                              if (y1 < y2) {
+                                   rect.y = y1;
+                                   rect.h = y2-y1;
+                              }
+                              else {
+                                   rect.y = y2;
+                                   rect.h = y1-y2;
+                              }
+
+                              if (dfb_clip_rectangle( &state->clip, &rect ))
+                                   gFillRectangle( state, &rect );
+                         }
+                    }
+                    else {
+                         /* Rotated rectangle. Split into triangles. */
+                         for (; i<num; i++) {
+                              DFBTriangle tri;
+                              
+                              tri.x1 = rects[i].x;            tri.y1 = rects[i].y;
+                              tri.x2 = rects[i].x+rects[i].w; tri.y2 = rects[i].y;
+                              tri.x3 = rects[i].x+rects[i].w; tri.y3 = rects[i].y+rects[i].h;
+                              DFB_TRANSFORM(tri.x1, tri.y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x2, tri.y2, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x3, tri.y3, state->matrix, state->affine_matrix);
+                              
+                              dfb_sort_triangle( &tri );
+                              if (tri.y3 - tri.y1 > 0)
+                                   fill_tri( &tri, state, false );
+                                   
+                              tri.x1 = rects[i].x;            tri.y1 = rects[i].y;
+                              tri.x2 = rects[i].x+rects[i].w; tri.y2 = rects[i].y+rects[i].h;
+                              tri.x3 = rects[i].x;            tri.y3 = rects[i].y+rects[i].h;
+                              DFB_TRANSFORM(tri.x1, tri.y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x2, tri.y2, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x3, tri.y3, state->matrix, state->affine_matrix);
+                              
+                              dfb_sort_triangle( &tri );
+                              if (tri.y3 - tri.y1 > 0)
+                                   fill_tri( &tri, state, false );
+                         }
+                    }
+
+                    gRelease( state );
+               }
+          }
+     }
+
+     /* Unlock after execution. */
+     dfb_state_unlock( state );
+}
+
+static void
+build_clipped_rectangle_outlines( DFBRectangle    *rect,
+                                  const DFBRegion *clip,
+                                  DFBRectangle    *ret_outlines,
+                                  int             *ret_num )
+{
+     DFBEdgeFlags edges = dfb_clip_edges( clip, rect );
+     int          t     = (edges & DFEF_TOP ? 1 : 0);
+     int          tb    = t + (edges & DFEF_BOTTOM ? 1 : 0);
+     int          num   = 0;
+
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_ASSERT( ret_outlines != NULL );
+     D_ASSERT( ret_num != NULL );
+
+     if (edges & DFEF_TOP) {
+          DFBRectangle *out = &ret_outlines[num++];
+
+          out->x = rect->x;
+          out->y = rect->y;
+          out->w = rect->w;
+          out->h = 1;
+     }
+
+     if (rect->h > t) {
+          if (edges & DFEF_BOTTOM) {
+               DFBRectangle *out = &ret_outlines[num++];
+
+               out->x = rect->x;
+               out->y = rect->y + rect->h - 1;
+               out->w = rect->w;
+               out->h = 1;
+          }
+
+          if (rect->h > tb) {
+               if (edges & DFEF_LEFT) {
+                    DFBRectangle *out = &ret_outlines[num++];
+
+                    out->x = rect->x;
+                    out->y = rect->y + t;
+                    out->w = 1;
+                    out->h = rect->h - tb;
+               }
+
+               if (rect->w > 1 || !(edges & DFEF_LEFT)) {
+                    if (edges & DFEF_RIGHT) {
+                         DFBRectangle *out = &ret_outlines[num++];
+
+                         out->x = rect->x + rect->w - 1;
+                         out->y = rect->y + t;
+                         out->w = 1;
+                         out->h = rect->h - tb;
+                    }
+               }
+          }
+     }
+
+     *ret_num = num;
+}
+
+void dfb_gfxcard_drawrectangle( DFBRectangle *rect, CardState *state )
+{
+     DFBRectangle rects[4];
+     bool         hw = false;
+     int          i = 0, num = 0;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %d,%d - %dx%d, %p )\n", __FUNCTION__, DFB_RECTANGLE_VALS(rect), state );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (!dfb_rectangle_region_intersects( rect, &state->clip )) {
+          dfb_state_unlock( state );
+          return;
+     }
+
+     if (D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) ||
+         D_FLAGS_IS_SET( card->caps.clip, DFXL_DRAWRECTANGLE ) ||
+         !dfb_clip_needed( &state->clip, rect ))
+     {
+          if (rect->w <= card->limits.dst_max.w && rect->h <= card->limits.dst_max.h &&
+              dfb_gfxcard_state_check( state, DFXL_DRAWRECTANGLE ) &&
+              dfb_gfxcard_state_acquire( state, DFXL_DRAWRECTANGLE ))
+          {
+               hw = card->funcs.DrawRectangle( card->driver_data,
+                                               card->device_data, rect );
+
+               dfb_gfxcard_state_release( state );
+          }
+     }
+
+     if (!hw && !(state->render_options & DSRO_MATRIX)) {
+          build_clipped_rectangle_outlines( rect, &state->clip, rects, &num );
+
+          if (!num) {
+               dfb_state_unlock( state );
+               return;
+          }
+
+          if (dfb_gfxcard_state_check( state, DFXL_FILLRECTANGLE ) &&
+              dfb_gfxcard_state_acquire( state, DFXL_FILLRECTANGLE ))
+          {
+               for (; i<num; i++) {
+                    hw = rects[i].w <= card->limits.dst_max.w && rects[i].h <= card->limits.dst_max.h
+                         && card->funcs.FillRectangle( card->driver_data,
+                                                       card->device_data, &rects[i] );
+                    if (!hw)
+                         break;
+               }
+
+               dfb_gfxcard_state_release( state );
+          }
+     }
+
+     if (!hw) {
+          if (!(state->render_options & DSRO_MATRIX)) {
+               if (gAcquire( state, DFXL_FILLRECTANGLE )) {
+                    for (; i<num; i++)
+                         gFillRectangle( state, &rects[i] );
+
+                    gRelease( state );
+               }
+          }
+          else {
+                if (gAcquire( state, DFXL_DRAWLINE )) {
+                    DFBRegion line;
+                    int       x1, x2, x3, x4;
+                    int       y1, y2, y3, y4;
+                    
+                    x1 = rect->x;         y1 = rect->y;
+                    x2 = rect->x+rect->w; y2 = rect->y;
+                    x3 = rect->x+rect->w; y3 = rect->y+rect->h;
+                    x4 = rect->x;         y4 = rect->y+rect->h;
+                    DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                    DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                    DFB_TRANSFORM(x3, y3, state->matrix, state->affine_matrix);
+                    DFB_TRANSFORM(x4, y4, state->matrix, state->affine_matrix);
+                    
+                    line = (DFBRegion) { x1, y1, x2, y2 };
+                    if (dfb_clip_line( &state->clip, &line ))
+                         gDrawLine( state, &line );
+                    
+                    line = (DFBRegion) { x2, y2, x3, y3 };
+                    if (dfb_clip_line( &state->clip, &line ))
+                         gDrawLine( state, &line );
+                         
+                    line = (DFBRegion) { x3, y3, x4, y4 };
+                    if (dfb_clip_line( &state->clip, &line ))
+                         gDrawLine( state, &line );
+                         
+                    line = (DFBRegion) { x4, y4, x1, y1 };
+                    if (dfb_clip_line( &state->clip, &line ))
+                         gDrawLine( state, &line );
+                    
+                    gRelease( state );
+               }
+          }    
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_drawlines( DFBRegion *lines, int num_lines, CardState *state )
+{
+     int i = 0;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %p )\n", __FUNCTION__, lines, num_lines, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( lines != NULL );
+     D_ASSERT( num_lines > 0 );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (dfb_gfxcard_state_check( state, DFXL_DRAWLINE ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_DRAWLINE ))
+     {
+          for (; i<num_lines; i++) {
+               if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+                   !D_FLAGS_IS_SET( card->caps.clip, DFXL_DRAWLINE ) &&
+                   !dfb_clip_line( &state->clip, &lines[i] ))
+                    continue;
+
+               if (!card->funcs.DrawLine( card->driver_data,
+                                          card->device_data, &lines[i] ))
+                    break;
+          }
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (i < num_lines) {
+          if (gAcquire( state, DFXL_DRAWLINE )) {
+               for (; i<num_lines; i++) {
+                    if (state->render_options & DSRO_MATRIX) {
+                         DFB_TRANSFORM(lines[i].x1, lines[i].y1, state->matrix, state->affine_matrix);
+                         DFB_TRANSFORM(lines[i].x2, lines[i].y2, state->matrix, state->affine_matrix);
+                    }
+                    
+                    if (dfb_clip_line( &state->clip, &lines[i] ))
+                         gDrawLine( state, &lines[i] );
+               }
+
+               gRelease( state );
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_fillspans( int y, DFBSpan *spans, int num_spans, CardState *state )
+{
+     int i = 0;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %d, %p [%d], %p )\n", __FUNCTION__, y, spans, num_spans, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( spans != NULL );
+     D_ASSERT( num_spans > 0 );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (dfb_gfxcard_state_check( state, DFXL_FILLRECTANGLE ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_FILLRECTANGLE ))
+     {
+          for (; i<num_spans; i++) {
+               DFBRectangle rect = { spans[i].x, y + i, spans[i].w, 1 };
+
+               if (rect.w > card->limits.dst_max.w || rect.h > card->limits.dst_max.h) {
+                    if (!dfb_clip_rectangle( &state->clip, &rect ))
+                         continue;
+
+                    if (rect.w > card->limits.dst_max.w || rect.h > card->limits.dst_max.h)
+                         break;
+               }
+               else if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+                        !D_FLAGS_IS_SET( card->caps.clip, DFXL_FILLRECTANGLE ) &&
+                        !dfb_clip_rectangle( &state->clip, &rect ))
+                         continue;
+
+               if (!card->funcs.FillRectangle( card->driver_data,
+                                               card->device_data, &rect ))
+                    break;
+          }
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (i < num_spans) {
+          if (gAcquire( state, DFXL_FILLRECTANGLE )) {
+               for (; i<num_spans; i++) {
+                    DFBRectangle rect = { spans[i].x, y + i, spans[i].w, 1 };
+                    
+                    if (state->render_options & DSRO_MATRIX) {
+                         if (state->matrix[1] == 0 && state->matrix[3] == 0) {
+                              int x1, y1, x2, y2;
+                              
+                              x1 = rect.x;    y1 = rect.y;
+                              x2 = x1+rect.w; y2 = y1+rect.h;
+                              DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                              
+                              if (x1 < x2) {
+                                   rect.x = x1;
+                                   rect.w = x2-x1;
+                              } else {
+                                   rect.x = x2;
+                                   rect.w = x1-x2;
+                              }
+                              if (y1 < y2) {
+                                   rect.y = y1;
+                                   rect.h = y2-y1;
+                              }
+                              else {
+                                   rect.y = y2;
+                                   rect.h = y1-y2;
+                              }
+
+                              if (dfb_clip_rectangle( &state->clip, &rect ))
+                                   gFillRectangle( state, &rect );
+                         }
+                         else {
+                              DFBTriangle tri;
+                              
+                              tri.x1 = rect.x;        tri.y1 = rect.y;
+                              tri.x2 = rect.x+rect.w; tri.y2 = rect.y;
+                              tri.x3 = rect.x+rect.w; tri.y3 = rect.y+rect.h;
+                              DFB_TRANSFORM(tri.x1, tri.y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x2, tri.y2, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x3, tri.y3, state->matrix, state->affine_matrix);
+                              
+                              dfb_sort_triangle( &tri );
+                              if (tri.y3 - tri.y1 > 0)
+                                   fill_tri( &tri, state, false );
+                                   
+                              tri.x1 = rect.x;        tri.y1 = rect.y;
+                              tri.x2 = rect.x+rect.w; tri.y2 = rect.y+rect.h;
+                              tri.x3 = rect.x;        tri.y3 = rect.y+rect.h;
+                              DFB_TRANSFORM(tri.x1, tri.y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x2, tri.y2, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(tri.x3, tri.y3, state->matrix, state->affine_matrix);
+                              
+                              dfb_sort_triangle( &tri );
+                              if (tri.y3 - tri.y1 > 0)
+                                   fill_tri( &tri, state, false );
+                         }
+                    }
+                    else {
+                         if (dfb_clip_rectangle( &state->clip, &rect ))
+                              gFillRectangle( state, &rect );
+                    }
+               }
+
+               gRelease( state );
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+
+typedef struct {
+   int xi;
+   int xf;
+   int mi;
+   int mf;
+   int _2dy;
+} DDA;
+
+#define SETUP_DDA(xs,ys,xe,ye,dda)         \
+     do {                                  \
+          int dx = xe - xs;                \
+          int dy = ye - ys;                \
+          dda.xi = xs;                     \
+          if (dy != 0) {                   \
+               dda.mi = dx / dy;           \
+               dda.mf = 2*(dx % dy);       \
+               dda.xf = -dy;               \
+               dda._2dy = 2 * dy;          \
+               if (dda.mf < 0) {           \
+                    dda.mf += 2 * ABS(dy); \
+                    dda.mi--;              \
+               }                           \
+          }                                \
+          else {                           \
+               dda.mi = 0;                 \
+               dda.mf = 0;                 \
+               dda.xf = 0;                 \
+               dda._2dy = 0;               \
+          }                                \
+     } while (0)
+
+
+#define INC_DDA(dda)                       \
+     do {                                  \
+          dda.xi += dda.mi;                \
+          dda.xf += dda.mf;                \
+          if (dda.xf > 0) {                \
+               dda.xi++;                   \
+               dda.xf -= dda._2dy;         \
+          }                                \
+     } while (0)
+
+
+/**
+ *  render a triangle using two parallel DDA's
+ */
+static void
+fill_tri( DFBTriangle *tri, CardState *state, bool accelerated )
+{
+     int y, yend;
+     DDA dda1 = { .xi = 0 }, dda2 = { .xi = 0 };
+     int clip_x1 = state->clip.x1;
+     int clip_x2 = state->clip.x2;
+
+     D_MAGIC_ASSERT( state, CardState );
+
+     y = tri->y1;
+     yend = tri->y3;
+
+     if (yend > state->clip.y2)
+          yend = state->clip.y2;
+
+     SETUP_DDA(tri->x1, tri->y1, tri->x3, tri->y3, dda1);
+     SETUP_DDA(tri->x1, tri->y1, tri->x2, tri->y2, dda2);
+
+     while (y <= yend) {
+          DFBRectangle rect;
+
+          if (y == tri->y2) {
+               if (tri->y2 == tri->y3)
+                    return;
+               SETUP_DDA(tri->x2, tri->y2, tri->x3, tri->y3, dda2);
+          }
+
+          rect.w = ABS(dda1.xi - dda2.xi);
+          rect.x = MIN(dda1.xi, dda2.xi);
+
+          if (clip_x2 < rect.x + rect.w)
+               rect.w = clip_x2 - rect.x + 1;
+
+          if (rect.w > 0) {
+               if (clip_x1 > rect.x) {
+                    rect.w -= (clip_x1 - rect.x);
+                    rect.x = clip_x1;
+               }
+               rect.y = y;
+               rect.h = 1;
+
+               if (rect.w > 0 && rect.y >= state->clip.y1) {
+                    if (accelerated)
+                         card->funcs.FillRectangle( card->driver_data,
+                                                    card->device_data, &rect );
+                    else
+                         gFillRectangle( state, &rect );
+               }
+          }
+
+          INC_DDA(dda1);
+          INC_DDA(dda2);
+
+          y++;
+     }
+}
+
+
+void dfb_gfxcard_filltriangles( const DFBTriangle *tris, int num, CardState *state )
+{
+     bool hw = false;
+     int  i  = 0;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( tris != NULL );
+     D_ASSERT( num > 0 );
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %p )\n", __FUNCTION__, tris, num, state );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (dfb_gfxcard_state_check( state, DFXL_FILLTRIANGLE ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_FILLTRIANGLE ))
+     {
+          if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+              !D_FLAGS_IS_SET( card->caps.clip, DFXL_FILLTRIANGLE ))
+          {
+               DFBPoint p[6];
+               int      n;
+               
+               for (; i < num; i++) {               
+                    /* FIXME: DSRO_MATRIX. */
+                    if (dfb_clip_triangle( &state->clip, &tris[i], p, &n )) {
+                         DFBTriangle tri;
+                         int         j;
+                         
+                         tri.x1 = p[0].x; tri.y1 = p[0].y;
+                         tri.x2 = p[1].x; tri.y2 = p[1].y;
+                         tri.x3 = p[2].x; tri.y3 = p[2].y;
+                         hw = card->funcs.FillTriangle( card->driver_data,
+                                                        card->device_data, &tri );
+                         if (!hw)
+                              break;
+   
+                         /* FIXME: return value. */
+                         for (j = 3; j < n; j++) {
+                              tri.x1 = p[0].x;   tri.y1 = p[0].y;
+                              tri.x2 = p[j-1].x; tri.y2 = p[j-1].y;
+                              tri.x3 = p[j].x;   tri.y3 = p[j].y;
+                              card->funcs.FillTriangle( card->driver_data,
+                                                        card->device_data, &tri );
+                         }
+                    }
+               }
+          }
+          else {
+               for (; i < num; i++) {
+                    DFBTriangle tri = tris[i];
+                    
+                    hw = card->funcs.FillTriangle( card->driver_data,
+                                                   card->device_data, &tri );
+                    if (!hw)
+                         break;
+               }
+                    
+          }
+                  
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (!hw && i < num) {
+          /* otherwise use the spanline rasterizer (fill_tri)
+             and fill the triangle using a rectangle for each spanline */
+
+          /* try hardware accelerated rectangle filling */
+          if (!(card->caps.flags & CCF_NOTRIEMU) &&
+              dfb_gfxcard_state_check( state, DFXL_FILLRECTANGLE ) &&
+              dfb_gfxcard_state_acquire( state, DFXL_FILLRECTANGLE ))
+          {
+               for (; i < num; i++) {
+                    DFBTriangle tri = tris[i];
+               
+                    dfb_sort_triangle( &tri );
+               
+                    if (tri.y3 - tri.y1 > 0)
+                         fill_tri( &tri, state, true );
+               }
+               
+               dfb_gfxcard_state_release( state );
+          }
+          else if (gAcquire( state, DFXL_FILLRECTANGLE )) {
+               for (; i < num; i++) {
+                    DFBTriangle tri = tris[i];
+                    
+                    if (state->render_options & DSRO_MATRIX) {
+                         DFB_TRANSFORM(tri.x1, tri.y1, state->matrix, state->affine_matrix);
+                         DFB_TRANSFORM(tri.x2, tri.y2, state->matrix, state->affine_matrix);
+                         DFB_TRANSFORM(tri.x3, tri.y3, state->matrix, state->affine_matrix);
+                    }
+               
+                    dfb_sort_triangle( &tri );
+                    
+                    if (tri.y3 - tri.y1 > 0)
+                         fill_tri( &tri, state, false );
+               }
+
+               gRelease( state );
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+static void
+clip_blit_rotated( DFBRectangle *srect, DFBRectangle *drect, const DFBRegion *clip, DFBSurfaceBlittingFlags flags )
+{
+     DFBRegion dest    = DFB_REGION_INIT_FROM_RECTANGLE( drect );
+     DFBRegion clipped = dest;
+
+     if (flags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) {
+          D_ASSERT( srect->w == drect->h );
+          D_ASSERT( srect->h == drect->w );
+     }
+     else {
+          D_ASSERT( srect->w == drect->w );
+          D_ASSERT( srect->h == drect->h );
+     }
+
+     dfb_region_region_intersect( &clipped, clip );
+     dfb_rectangle_from_region( drect, &clipped );
+
+     if (flags & DSBLIT_ROTATE90) {
+          srect->x += dest.y2 - clipped.y2;
+          srect->y += clipped.x1 - dest.x1;
+          srect->w  = drect->h;
+          srect->h  = drect->w;
+
+          D_DEBUG_AT( Core_GraphicsOps, "  => %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d (90°)\n",
+                      DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect) );
+     }
+     else if (flags & DSBLIT_ROTATE180) {
+          srect->x += dest.x2 - clipped.x2;
+          srect->y += dest.y2 - clipped.y2;
+          srect->w  = drect->w;
+          srect->h  = drect->h;
+
+          D_DEBUG_AT( Core_GraphicsOps, "  => %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d (180°)\n",
+                      DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect) );
+     }
+     else if (flags & DSBLIT_ROTATE270) {
+          srect->x += clipped.y1 - dest.y1;
+          srect->y += dest.x2 - clipped.x2;
+          srect->w  = drect->h;
+          srect->h  = drect->w;
+
+          D_DEBUG_AT( Core_GraphicsOps, "  => %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d (270°)\n",
+                      DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect) );
+     }
+     else {
+          srect->x += clipped.x1 - dest.x1;
+          srect->y += clipped.y1 - dest.y1;
+          srect->w  = drect->w;
+          srect->h  = drect->h;
+
+          D_DEBUG_AT( Core_GraphicsOps, "  => %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d\n",
+                      DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect) );
+     }
+}
+
+void dfb_gfxcard_blit( DFBRectangle *rect, int dx, int dy, CardState *state )
+{
+     bool         hw    = false;
+     DFBRectangle drect = { dx, dy, rect->w, rect->h };
+
+     if (state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270))
+          D_UTIL_SWAP( drect.w, drect.h );
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d, %p )\n",
+                 __FUNCTION__, DFB_RECTANGLE_VALS(rect), DFB_RECTANGLE_VALS(&drect), state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( state->source != NULL );
+     D_ASSERT( rect != NULL );
+     D_ASSERT( rect->x >= 0 );
+     D_ASSERT( rect->y >= 0 );
+     D_ASSERT( rect->x < state->source->config.size.w );
+     D_ASSERT( rect->y < state->source->config.size.h );
+     D_ASSERT( rect->x + rect->w - 1 < state->source->config.size.w );
+     D_ASSERT( rect->y + rect->h - 1 < state->source->config.size.h );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (!(state->render_options & DSRO_MATRIX) &&
+         !dfb_clip_blit_precheck( &state->clip, drect.w, drect.h, drect.x, drect.y ))
+     {
+          /* no work at all */
+          dfb_state_unlock( state );
+          return;
+     }
+
+     if (dfb_gfxcard_state_check( state, DFXL_BLIT ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_BLIT ))
+     {
+          if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+              !D_FLAGS_IS_SET( card->caps.clip, DFXL_BLIT ))
+               clip_blit_rotated( rect, &drect, &state->clip, state->blittingflags );
+
+          hw = card->funcs.Blit( card->driver_data, card->device_data, rect, drect.x, drect.y );
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (!hw) {
+          if (state->render_options & DSRO_MATRIX) {
+               if (state->matrix[0] < 0  || state->matrix[1] != 0 ||
+                   state->matrix[3] != 0 || state->matrix[4] < 0  ||
+                   state->matrix[6] != 0 || state->matrix[7] != 0) {
+                    D_WARN( "rotation not yet implemented" );
+                    dfb_state_unlock( state );
+                    return;
+               }
+               
+               if (gAcquire( state, DFXL_STRETCHBLIT )) {
+                    DFBRectangle drect;
+                    int          x1, y1, x2, y2;
+                    
+                    x1 = dx;         y1 = dy;
+                    x2 = dx+rect->w; y2 = dy+rect->h;
+                    DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                    DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                    
+                    drect = (DFBRectangle) { x1, y1, x2-x1, y2-y1 };
+                    if (dfb_clip_blit_precheck( &state->clip, 
+                                                drect.w, drect.h, drect.x, drect.y ))
+                         gStretchBlit( state, rect, &drect );
+                         
+                    gRelease( state );
+               }
+          }
+          else {
+               if (gAcquire( state, DFXL_BLIT )) {
+                    clip_blit_rotated( rect, &drect, &state->clip, state->blittingflags );
+
+                    gBlit( state, rect, drect.x, drect.y );
+
+                    gRelease( state );
+               }
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_batchblit( DFBRectangle *rects, DFBPoint *points,
+                            int num, CardState *state )
+{
+     int i = 0;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p, %p [%d], %p )\n", __FUNCTION__, rects, points, num, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( rects != NULL );
+     D_ASSERT( points != NULL );
+     D_ASSERT( num > 0 );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (dfb_gfxcard_state_check( state, DFXL_BLIT ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_BLIT ))
+     {
+          for (; i<num; i++) {
+               if ((state->render_options & DSRO_MATRIX) ||
+                   dfb_clip_blit_precheck( &state->clip,
+                                           rects[i].w, rects[i].h,
+                                           points[i].x, points[i].y ))
+               {
+                    if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+                        !D_FLAGS_IS_SET( card->caps.clip, DFXL_BLIT ))
+                         dfb_clip_blit( &state->clip, &rects[i],
+                                        &points[i].x, &points[i].y );
+
+                    if (!card->funcs.Blit( card->driver_data, card->device_data,
+                                           &rects[i], points[i].x, points[i].y ))
+                         break;
+               }
+          }
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (i < num) {
+          if (state->render_options & DSRO_MATRIX) {
+               if (state->matrix[0] < 0  || state->matrix[1] != 0 ||
+                   state->matrix[3] != 0 || state->matrix[4] < 0  ||
+                   state->matrix[6] != 0 || state->matrix[7] != 0) {
+                    D_WARN( "rotation not yet implemented" );
+                    dfb_state_unlock( state );
+                    return;
+               }
+               
+               if (gAcquire( state, DFXL_STRETCHBLIT )) {
+                    for (; i<num; i++) {
+                         DFBRectangle drect;
+                         int          x1, y1, x2, y2;
+                    
+                         x1 = points[i].x;   y1 = points[i].y;
+                         x2 = x1+rects[i].w; y2 = y1+rects[i].h;
+                         DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                         DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                    
+                         drect = (DFBRectangle) { x1, y1, x2-x1, y2-y1 };
+                         if (dfb_clip_blit_precheck( &state->clip, 
+                                                     drect.w, drect.h, drect.x, drect.y ))
+                              gStretchBlit( state, &rects[i], &drect );
+                    }
+                    
+                    gRelease( state );
+               }
+          }
+          else {    
+               if (gAcquire( state, DFXL_BLIT )) {
+                    for (; i<num; i++) {
+                         if (dfb_clip_blit_precheck( &state->clip,
+                                                     rects[i].w, rects[i].h,
+                                                     points[i].x, points[i].y ))
+                         {
+                              dfb_clip_blit( &state->clip, &rects[i],
+                                             &points[i].x, &points[i].y );
+
+                              gBlit( state, &rects[i], points[i].x, points[i].y );
+                         }
+                    }
+
+                    gRelease( state );
+               }
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_tileblit( DFBRectangle *rect, int dx1, int dy1, int dx2, int dy2,
+                           CardState *state )
+{
+     int           x, y;
+     int           odx;
+     DFBRectangle  srect;
+     DFBRegion    *clip;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %d,%d - %d,%d, %p )\n", __FUNCTION__, dx1, dy1, dx2, dy2, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( rect != NULL );
+
+     /* If called with an invalid rectangle, the algorithm goes into an
+        infinite loop. This should never happen but it's safer to check. */
+     D_ASSERT( rect->w >= 1 );
+     D_ASSERT( rect->h >= 1 );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     clip = &state->clip;
+
+     /* Check if anything is drawn at all. */
+     if (!(state->render_options & DSRO_MATRIX) &&
+         !dfb_clip_blit_precheck( clip, dx2-dx1+1, dy2-dy1+1, dx1, dy1 )) {
+          dfb_state_unlock( state );
+          return;
+     }
+
+     /* Remove clipped tiles. */
+     if (dx1 < clip->x1) {
+          int outer = clip->x1 - dx1;
+
+          dx1 += outer - (outer % rect->w);
+     }
+
+     if (dy1 < clip->y1) {
+          int outer = clip->y1 - dy1;
+
+          dy1 += outer - (outer % rect->h);
+     }
+
+     if (dx2 > clip->x2) {
+          int outer = clip->x2 - dx2;
+
+          dx2 -= outer - (outer % rect->w);
+     }
+
+     if (dy2 > clip->y2) {
+          int outer = clip->y2 - dy2;
+
+          dy2 -= outer - (outer % rect->h);
+     }
+
+     odx = dx1;
+
+     if (dfb_gfxcard_state_check( state, DFXL_BLIT ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_BLIT )) {
+          bool hw = true;
+
+          for (; dy1 < dy2; dy1 += rect->h) {
+               for (; dx1 < dx2; dx1 += rect->w) {
+
+                    if (!dfb_clip_blit_precheck( clip, rect->w, rect->h, dx1, dy1 ))
+                         continue;
+
+                    x = dx1;
+                    y = dy1;
+                    srect = *rect;
+
+                    if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+                        !D_FLAGS_IS_SET( card->caps.clip, DFXL_BLIT ))
+                         dfb_clip_blit( clip, &srect, &x, &y );
+
+                    hw = card->funcs.Blit( card->driver_data,
+                                           card->device_data, &srect, x, y );
+                    if (!hw)
+                         break;
+               }
+               if (!hw)
+                    break;
+               dx1 = odx;
+          }
+          
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (dy1 < dy2) {
+          if (state->render_options & DSRO_MATRIX) {
+               if (state->matrix[0] < 0  || state->matrix[1] != 0 ||
+                   state->matrix[3] != 0 || state->matrix[4] < 0  ||
+                   state->matrix[6] != 0 || state->matrix[7] != 0) {
+                    D_WARN( "rotation not yet implemented" );
+                    dfb_state_unlock( state );
+                    return;
+               }
+               
+               if (gAcquire( state, DFXL_STRETCHBLIT )) {
+                    for (; dy1 < dy2; dy1 += rect->h) {
+                         for (; dx1 < dx2; dx1 += rect->w) {
+                              DFBRectangle drect;
+                              int          x1, y1, x2, y2;
+                    
+                              x1 = dx1;         y1 = dy1;
+                              x2 = dx1+rect->w; y2 = dy1+rect->h;
+                              DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+                              DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);
+                    
+                              drect = (DFBRectangle) { x1, y1, x2-x1, y2-y1 };
+                              if (dfb_clip_blit_precheck( &state->clip, 
+                                                          drect.w, drect.h, drect.x, drect.y ))
+                                   gStretchBlit( state, rect, &drect );
+                         }
+                         dx1 = odx;
+                    }
+                    
+                    gRelease( state );
+               }
+          }
+          else {
+               if (gAcquire( state, DFXL_BLIT )) {
+                    for (; dy1 < dy2; dy1 += rect->h) {
+                         for (; dx1 < dx2; dx1 += rect->w) {
+
+                              if (!dfb_clip_blit_precheck( clip, rect->w, rect->h, dx1, dy1 ))
+                                   continue;
+
+                              x = dx1;
+                              y = dy1;
+                              srect = *rect;
+
+                              dfb_clip_blit( clip, &srect, &x, &y );
+
+                              gBlit( state, &srect, x, y );
+                         }
+                         dx1 = odx;
+                    }
+               
+                    gRelease( state );
+               }
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_stretchblit( DFBRectangle *srect, DFBRectangle *drect,
+                              CardState *state )
+{
+     bool hw = false;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( srect != NULL );
+     D_ASSERT( drect != NULL );
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %d,%d - %dx%d -> %d,%d - %dx%d, %p )\n",
+                 __FUNCTION__, DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect), state );
+
+     if (state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) {
+          if (srect->w == drect->h && srect->h == drect->w) {
+               dfb_gfxcard_blit( srect, drect->x, drect->y, state );
+               return;
+          }
+     }
+     else {
+          if (srect->w == drect->w && srect->h == drect->h) {
+               dfb_gfxcard_blit( srect, drect->x, drect->y, state );
+               return;
+          }
+     }
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if (!(state->render_options & DSRO_MATRIX) &&
+         !dfb_clip_blit_precheck( &state->clip, drect->w, drect->h,
+                                  drect->x, drect->y ))
+     {
+          dfb_state_unlock( state );
+          return;
+     }
+
+     if (dfb_gfxcard_state_check( state, DFXL_STRETCHBLIT ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_STRETCHBLIT ))
+     {
+          if (!D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) &&
+              !D_FLAGS_IS_SET( card->caps.clip, DFXL_STRETCHBLIT ))
+               dfb_clip_stretchblit( &state->clip, srect, drect );
+
+          hw = card->funcs.StretchBlit( card->driver_data, card->device_data, srect, drect );
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (!hw) {
+          if (state->render_options & DSRO_MATRIX) {
+               int x1, y1, x2, y2;
+               
+               if (state->matrix[0] < 0  || state->matrix[1] != 0 ||
+                   state->matrix[3] != 0 || state->matrix[4] < 0  ||
+                   state->matrix[6] != 0 || state->matrix[7] != 0) {
+                    D_WARN( "rotation not yet implemented" );
+                    dfb_state_unlock( state );
+                    return;
+               }
+               
+               x1 = drect->x;    y1 = drect->y;
+               x2 = x1+drect->w; y2 = y1+drect->h;
+               DFB_TRANSFORM(x1, y1, state->matrix, state->affine_matrix);
+               DFB_TRANSFORM(x2, y2, state->matrix, state->affine_matrix);        
+               drect->x = x1;    drect->y = y1;
+               drect->w = x2-x1; drect->h = y2-y1;
+                    
+               if (!dfb_clip_blit_precheck( &state->clip, 
+                                            drect->w, drect->h, drect->x, drect->y )) {
+                    dfb_state_unlock( state );
+                    return;
+               }
+          }
+          
+          if (gAcquire( state, DFXL_STRETCHBLIT )) {                  
+               /* Clipping is performed in the following function. */
+               gStretchBlit( state, srect, drect );
+               gRelease( state );
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void dfb_gfxcard_texture_triangles( DFBVertex *vertices, int num,
+                                    DFBTriangleFormation formation,
+                                    CardState *state )
+{
+     bool hw = false;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %s, %p )\n", __FUNCTION__, vertices, num,
+                 (formation == DTTF_LIST)  ? "LIST"  :
+                 (formation == DTTF_STRIP) ? "STRIP" :
+                 (formation == DTTF_FAN)   ? "FAN"   : "unknown formation", state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_ASSERT( vertices != NULL );
+     D_ASSERT( num >= 3 );
+     D_MAGIC_ASSERT( state, CardState );
+
+     /* The state is locked during graphics operations. */
+     dfb_state_lock( state );
+
+     /* Signal beginning of sequence of operations if not already done. */
+     dfb_state_start_drawing( state, card );
+
+     if ((D_FLAGS_IS_SET( card->caps.flags, CCF_CLIPPING ) || D_FLAGS_IS_SET( card->caps.clip, DFXL_TEXTRIANGLES )) &&
+         dfb_gfxcard_state_check( state, DFXL_TEXTRIANGLES ) &&
+         dfb_gfxcard_state_acquire( state, DFXL_TEXTRIANGLES ))
+     {
+          hw = card->funcs.TextureTriangles( card->driver_data,
+                                             card->device_data,
+                                             vertices, num, formation );
+
+          dfb_gfxcard_state_release( state );
+     }
+
+     if (!hw) {
+          if (gAcquire( state, DFXL_TEXTRIANGLES )) {
+               //dfb_clip_stretchblit( &state->clip, srect, drect );
+               //gStretchBlit( state, srect, drect );
+               gRelease( state );
+          }
+     }
+
+     dfb_state_unlock( state );
+}
+
+void
+dfb_gfxcard_drawstring( const u8 *text, int bytes,
+                        DFBTextEncodingID encoding, int x, int y,
+                        CoreFont *font, unsigned int layers, CardState *state )
+{
+     unsigned int             prev = 0;
+     unsigned int             indices[bytes];
+     int                      i, l, num;
+     int                      kern_x;
+     int                      kern_y;
+     CoreSurface             *surface;
+     DFBSurfaceBlittingFlags  orig_flags;
+     DFBSurfaceBlendFunction  orig_srcblend;
+     DFBSurfaceBlendFunction  orig_dstblend;
+     DFBPoint                 points[50];
+     DFBRectangle             rects[50];
+     int                      num_blits = 0;
+     int                      ox = x;
+     int                      oy = y;
+
+     if (encoding == DTEID_UTF8)
+          D_DEBUG_AT( Core_GraphicsOps, "%s( '%s' [%d], %d,%d, %p, %p )\n",
+                      __FUNCTION__, text, bytes, x, y, font, state );
+     else
+          D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %d, %d,%d, %p, %p )\n",
+                      __FUNCTION__, text, bytes, encoding, x, y, font, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( text != NULL );
+     D_ASSERT( bytes > 0 );
+     D_ASSERT( font != NULL );
+
+     surface = state->destination;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     /* simple prechecks */
+     if (!(state->render_options & DSRO_MATRIX) &&
+         (x > state->clip.x2 || y > state->clip.y2 ||
+          y + font->ascender - font->descender <= state->clip.y1)) {
+          return;
+     }
+
+     dfb_font_lock( font );
+
+     /* Decode string to character indices. */
+     dfb_font_decode_text( font, encoding, text, bytes, indices, &num );
+
+     orig_flags    = state->blittingflags;
+     orig_srcblend = state->src_blend;
+     orig_dstblend = state->dst_blend;
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          DFBSurfaceBlittingFlags flags = font->blittingflags;
+
+          /* additional blending? */
+          if ((state->drawingflags & DSDRAW_BLEND) && (state->color.a != 0xff))
+               flags |= DSBLIT_BLEND_COLORALPHA;
+
+          if (state->drawingflags & DSDRAW_DST_COLORKEY)
+               flags |= DSBLIT_DST_COLORKEY;
+
+          if (state->drawingflags & DSDRAW_XOR)
+               flags |= DSBLIT_XOR;
+
+          if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+          /* Porter/Duff SRC_OVER composition */
+               if ((DFB_PIXELFORMAT_HAS_ALPHA( surface->config.format ) && (surface->config.caps & DSCAPS_PREMULTIPLIED))
+              ||
+              (font->surface_caps & DSCAPS_PREMULTIPLIED))
+          {
+               if (font->surface_caps & DSCAPS_PREMULTIPLIED) {
+                    if (flags & DSBLIT_BLEND_COLORALPHA)
+                         flags |= DSBLIT_SRC_PREMULTCOLOR;
+               }
+               else
+                    flags |= DSBLIT_SRC_PREMULTIPLY;
+
+                    dfb_state_set_src_blend( state, DSBF_ONE );
+          }
+          else
+                    dfb_state_set_src_blend( state, DSBF_SRCALPHA );
+
+               dfb_state_set_dst_blend( state, DSBF_INVSRCALPHA );
+     }
+
+          dfb_state_set_blitting_flags( state, flags );
+     }
+
+     for (l=layers-1; l>=0; l--) {
+          x = ox;
+          y = oy;
+
+          if (layers > 1) {
+               if (num_blits) {
+                    dfb_gfxcard_batchblit( rects, points, num_blits, state );
+                    num_blits = 0;
+               }
+
+               dfb_state_set_color( state, &state->colors[l] );
+          }
+
+     /* blit glyphs */
+     for (i=0; i<num; i++) {
+               DFBResult      ret;
+          CoreGlyphData *glyph;
+          unsigned int   current = indices[i];
+
+               ret = dfb_font_get_glyph_data( font, current, l, &glyph );
+               if (ret) {
+                    D_DEBUG_AT( Core_GraphicsOps, "  -> dfb_font_get_glyph_data() failed! [%s]\n", DirectFBErrorString( ret ) );
+                    prev = current;
+                    continue;
+               }
+
+               if (prev && font->GetKerning && font->GetKerning( font, prev, current, &kern_x, &kern_y) == DFB_OK) {
+               x += kern_x;
+               y += kern_y;
+          }
+
+          if (glyph->width) {
+                    if (glyph->surface != state->source || num_blits == D_ARRAY_SIZE(rects)) {
+                         if (num_blits) {
+                              dfb_gfxcard_batchblit( rects, points, num_blits, state );
+                              num_blits = 0;
+                    }
+
+                         if (glyph->surface != state->source)
+                              dfb_state_set_source( state, glyph->surface );
+               }
+
+                    points[num_blits] = (DFBPoint){ x + glyph->left, y + glyph->top };
+                    rects[num_blits]  = (DFBRectangle){ glyph->start, 0, glyph->width, glyph->height };
+               
+                    num_blits++;
+                                   }
+               
+               x   += glyph->xadvance;
+               y   += glyph->yadvance;
+               prev = current;
+               }
+          }
+
+     if (num_blits) {
+          dfb_gfxcard_batchblit( rects, points, num_blits, state );
+          num_blits = 0;
+     }
+
+     dfb_font_unlock( font );
+
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          dfb_state_set_blitting_flags( state, orig_flags );
+          dfb_state_set_src_blend( state, orig_srcblend );
+          dfb_state_set_dst_blend( state, orig_dstblend );
+     }
+}
+
+void dfb_gfxcard_drawglyph( CoreGlyphData **glyph, int x, int y,
+                            CoreFont *font, unsigned int layers, CardState *state )
+{
+     int                      l;
+     CoreSurface             *surface;
+     DFBSurfaceBlittingFlags  orig_flags;
+     DFBSurfaceBlendFunction  orig_srcblend;
+     DFBSurfaceBlendFunction  orig_dstblend;
+
+     D_DEBUG_AT( Core_GraphicsOps, "%s( %u, %d,%d, %p, %p )\n",
+                 __FUNCTION__, index, x, y, font, state );
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( font != NULL );
+
+     surface = state->destination;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     orig_flags    = state->blittingflags;
+     orig_srcblend = state->src_blend;
+     orig_dstblend = state->dst_blend;
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          DFBSurfaceBlittingFlags flags = font->blittingflags;
+
+          /* additional blending? */
+          if ((state->drawingflags & DSDRAW_BLEND) && (state->color.a != 0xff))
+               flags |= DSBLIT_BLEND_COLORALPHA;
+
+          if (state->drawingflags & DSDRAW_DST_COLORKEY)
+               flags |= DSBLIT_DST_COLORKEY;
+
+          if (state->drawingflags & DSDRAW_XOR)
+               flags |= DSBLIT_XOR;
+
+          if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               /* Porter/Duff SRC_OVER composition */
+               if ((DFB_PIXELFORMAT_HAS_ALPHA( surface->config.format ) && (surface->config.caps & DSCAPS_PREMULTIPLIED))
+                   ||
+                   (font->surface_caps & DSCAPS_PREMULTIPLIED))
+               {
+                    if (font->surface_caps & DSCAPS_PREMULTIPLIED) {
+                         if (flags & DSBLIT_BLEND_COLORALPHA)
+                              flags |= DSBLIT_SRC_PREMULTCOLOR;
+                    }
+                    else
+                         flags |= DSBLIT_SRC_PREMULTIPLY;
+
+                    dfb_state_set_src_blend( state, DSBF_ONE );
+               }
+               else
+                    dfb_state_set_src_blend( state, DSBF_SRCALPHA );
+
+               dfb_state_set_dst_blend( state, DSBF_INVSRCALPHA );
+          }
+
+          dfb_state_set_blitting_flags( state, flags );
+     }
+
+     for (l=layers-1; l>=0; l--) {
+          if (layers > 1)
+               dfb_state_set_color( state, &state->colors[l] );
+
+          /* blit glyph */
+          if (glyph[l]->width) {
+               DFBRectangle rect = { glyph[l]->start, 0, glyph[l]->width, glyph[l]->height };
+
+               dfb_state_set_source( state, glyph[l]->surface );
+
+               dfb_gfxcard_blit( &rect, x + glyph[l]->left, y + glyph[l]->top, state );
+          }
+     }
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          dfb_state_set_blitting_flags( state, orig_flags );
+          dfb_state_set_src_blend( state, orig_srcblend );
+          dfb_state_set_dst_blend( state, orig_dstblend );
+     }
+}
+
+bool dfb_gfxcard_drawstring_check_state( CoreFont *font, CardState *state )
+{
+     int            i;
+     bool                     result;
+     CoreSurface             *surface;
+     DFBSurfaceBlittingFlags  orig_flags;
+     DFBSurfaceBlendFunction  orig_srcblend;
+     DFBSurfaceBlendFunction  orig_dstblend;
+     CoreGlyphData *data = NULL;
+
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( font != NULL );
+
+     D_DEBUG_AT( Core_GfxState, "%s( %p, %p )\n", __FUNCTION__, font, state );
+
+     surface = state->destination;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     dfb_font_lock( font );
+
+     for (i=0; i<128; i++) {
+          if (dfb_font_get_glyph_data (font, i, 0, &data) == DFB_OK)
+               break;
+     }
+
+     if (!data) {
+          D_DEBUG_AT( Core_GfxState, "  -> No font data!\n" );
+          dfb_font_unlock( font );
+          return;
+     }
+
+     orig_flags    = state->blittingflags;
+     orig_srcblend = state->src_blend;
+     orig_dstblend = state->dst_blend;
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          DFBSurfaceBlittingFlags flags = font->blittingflags;
+
+          /* additional blending? */
+          if ((state->drawingflags & DSDRAW_BLEND) && (state->color.a != 0xff))
+               flags |= DSBLIT_BLEND_COLORALPHA;
+
+          if (state->drawingflags & DSDRAW_DST_COLORKEY)
+               flags |= DSBLIT_DST_COLORKEY;
+
+          if (state->drawingflags & DSDRAW_XOR)
+               flags |= DSBLIT_XOR;
+
+          if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+               /* Porter/Duff SRC_OVER composition */
+               if ((DFB_PIXELFORMAT_HAS_ALPHA( surface->config.format ) && (surface->config.caps & DSCAPS_PREMULTIPLIED))
+                   ||
+                   (font->surface_caps & DSCAPS_PREMULTIPLIED))
+               {
+                    if (font->surface_caps & DSCAPS_PREMULTIPLIED) {
+                         if (flags & DSBLIT_BLEND_COLORALPHA)
+                              flags |= DSBLIT_SRC_PREMULTCOLOR;
+                    }
+                    else
+                         flags |= DSBLIT_SRC_PREMULTIPLY;
+
+                    dfb_state_set_src_blend( state, DSBF_ONE );
+               }
+               else
+                    dfb_state_set_src_blend( state, DSBF_SRCALPHA );
+
+               dfb_state_set_dst_blend( state, DSBF_INVSRCALPHA );
+          }
+
+          dfb_state_set_blitting_flags( state, flags );
+     }
+
+     /* set the source */
+     dfb_state_set_source( state, data->surface );
+
+     dfb_state_lock( state );
+
+     /* check for blitting and report */
+     result = dfb_gfxcard_state_check( state, DFXL_BLIT );
+
+     dfb_state_unlock( state );
+
+     dfb_font_unlock( font );
+
+     if (orig_flags != DSBLIT_INDEX_TRANSLATION) {
+          dfb_state_set_blitting_flags( state, orig_flags );
+          dfb_state_set_src_blend( state, orig_srcblend );
+          dfb_state_set_dst_blend( state, orig_dstblend );
+     }
+
+     return result;
+}
+
+DFBResult dfb_gfxcard_sync( void )
+{
+     DFBResult ret;
+
+     D_ASSUME( card != NULL );
+
+     if (!card)
+          return DFB_OK;
+
+     ret = dfb_gfxcard_lock( GDLF_SYNC );
+     if (ret)
+          return ret;
+
+     dfb_gfxcard_unlock();
+
+     return DFB_OK;
+}
+
+void dfb_gfxcard_invalidate_state( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     card->shared->state = NULL;
+}
+
+DFBResult dfb_gfxcard_wait_serial( const CoreGraphicsSerial *serial )
+{
+     DFBResult ret;
+
+     D_ASSERT( serial != NULL );
+     D_ASSUME( card != NULL );
+
+     if (!card)
+          return DFB_OK;
+
+     D_ASSERT( card->shared != NULL );
+
+     ret = dfb_gfxcard_lock( GDLF_NONE );
+     if (ret)
+          return ret;
+
+/* FIXME_SC_2     if (card->funcs.WaitSerial)
+          ret = card->funcs.WaitSerial( card->driver_data, card->device_data, serial );
+     else*/ if (card->funcs.EngineSync)
+          ret = card->funcs.EngineSync( card->driver_data, card->device_data );
+
+     if (ret) {
+          if (card->funcs.EngineReset)
+               card->funcs.EngineReset( card->driver_data, card->device_data );
+
+          card->shared->state = NULL;
+     }
+
+     dfb_gfxcard_unlock();
+
+     return ret;
+}
+
+void dfb_gfxcard_flush_texture_cache( void )
+{
+     D_ASSUME( card != NULL );
+
+     if (card && card->funcs.FlushTextureCache)
+          card->funcs.FlushTextureCache( card->driver_data, card->device_data );
+}
+
+void dfb_gfxcard_flush_read_cache( void )
+{
+     D_ASSUME( card != NULL );
+
+     if (card && card->funcs.FlushReadCache)
+          card->funcs.FlushReadCache( card->driver_data, card->device_data );
+}
+
+void dfb_gfxcard_after_set_var( void )
+{
+     D_ASSUME( card != NULL );
+
+     if (card && card->funcs.AfterSetVar)
+          card->funcs.AfterSetVar( card->driver_data, card->device_data );
+}
+
+void dfb_gfxcard_surface_enter( CoreSurfaceBuffer *buffer, DFBSurfaceLockFlags flags )
+{
+     D_ASSUME( card != NULL );
+
+     if (card && card->funcs.SurfaceEnter)
+          card->funcs.SurfaceEnter( card->driver_data, card->device_data, buffer, flags );
+}
+
+void dfb_gfxcard_surface_leave( CoreSurfaceBuffer *buffer )
+{
+     D_ASSUME( card != NULL );
+
+     if (card && card->funcs.SurfaceLeave)
+          card->funcs.SurfaceLeave( card->driver_data, card->device_data, buffer );
+}
+
+DFBResult
+dfb_gfxcard_adjust_heap_offset( int offset )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+//FIXME_SMAN     return dfb_surfacemanager_adjust_heap_offset( card->shared->surface_manager, offset );
+     return DFB_OK;
+}
+
+void
+dfb_gfxcard_get_capabilities( CardCapabilities *ret_caps )
+{
+     D_ASSERT( card != NULL );
+
+     D_ASSERT( ret_caps != NULL );
+
+     *ret_caps = card->caps;
+}
+
+void
+dfb_gfxcard_get_device_info( GraphicsDeviceInfo *ret_info )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     D_ASSERT( ret_info != NULL );
+
+     *ret_info = card->shared->device_info;
+}
+
+void
+dfb_gfxcard_get_driver_info( GraphicsDriverInfo *ret_info )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     D_ASSERT( ret_info != NULL );
+
+     *ret_info = card->shared->driver_info;
+}
+
+
+int
+dfb_gfxcard_reserve_memory( CoreGraphicsDevice *device, unsigned int size )
+{
+     DFBGraphicsCoreShared *shared;
+
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     shared = device->shared;
+
+     if (shared->device_info.limits.surface_byteoffset_alignment) {
+          size += shared->device_info.limits.surface_byteoffset_alignment - 1;
+          size -= (size % shared->device_info.limits.surface_byteoffset_alignment);
+     }
+     else
+          D_WARN( "no alignment specified yet?" );
+
+     if (shared->videoram_length < size) {
+          D_WARN( "not enough video memory (%u < %u)", shared->videoram_length, size );
+          return -1;
+     }
+
+     shared->videoram_length -= size;
+
+     return shared->videoram_length;
+}
+
+int
+dfb_gfxcard_reserve_auxmemory( CoreGraphicsDevice *device, unsigned int size )
+{
+     DFBGraphicsCoreShared *shared;
+     int                    offset;
+
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     shared = device->shared;
+
+     /* Reserve memory at the beginning of the aperture
+      * to prevent overflows on DMA buffers. */
+
+     offset = shared->auxram_offset;
+
+     if (shared->auxram_length < (offset + size))
+          return -1;
+
+     shared->auxram_offset += size;
+
+     return offset;
+}
+
+unsigned int
+dfb_gfxcard_memory_length( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     return card->shared->videoram_length;
+}
+
+unsigned int
+dfb_gfxcard_auxmemory_length( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     return card->shared->auxram_length;
+}
+
+volatile void *
+dfb_gfxcard_map_mmio( CoreGraphicsDevice *device,
+                      unsigned int        offset,
+                      int                 length )
+{
+     return dfb_system_map_mmio( offset, length );
+}
+
+void
+dfb_gfxcard_unmap_mmio( CoreGraphicsDevice *device,
+                        volatile void      *addr,
+                        int                 length )
+{
+     dfb_system_unmap_mmio( addr, length );
+}
+
+int
+dfb_gfxcard_get_accelerator( CoreGraphicsDevice *device )
+{
+     return dfb_system_get_accelerator();
+}
+
+void
+dfb_gfxcard_get_limits( CoreGraphicsDevice *device,
+                        CardLimitations    *ret_limits )
+{
+     D_ASSERT( device != NULL );
+     D_ASSERT( ret_limits != NULL );
+
+     if (!device)
+          device = card;
+
+     *ret_limits = device->limits;
+}
+
+void
+dfb_gfxcard_calc_buffer_size( CoreGraphicsDevice *device,
+                              CoreSurfaceBuffer  *buffer,
+                              int                *ret_pitch,
+                              int                *ret_length )
+{
+     int          pitch;
+     int          length;
+     CoreSurface *surface;
+
+     D_ASSERT( device != NULL );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     /* calculate the required length depending on limitations */
+     pitch = MAX( surface->config.size.w, surface->config.min_size.w );
+
+     if (pitch < device->limits.surface_max_power_of_two_pixelpitch &&
+         surface->config.size.h < device->limits.surface_max_power_of_two_height)
+          pitch = 1 << direct_log2( pitch );
+
+     if (device->limits.surface_pixelpitch_alignment > 1) {
+          pitch += device->limits.surface_pixelpitch_alignment - 1;
+          pitch -= pitch % device->limits.surface_pixelpitch_alignment;
+     }
+
+     pitch = DFB_BYTES_PER_LINE( buffer->format, pitch );
+
+     if (pitch < device->limits.surface_max_power_of_two_bytepitch &&
+         surface->config.size.h < device->limits.surface_max_power_of_two_height)
+          pitch = 1 << direct_log2( pitch );
+
+     if (device->limits.surface_bytepitch_alignment > 1) {
+          pitch += device->limits.surface_bytepitch_alignment - 1;
+          pitch -= pitch % device->limits.surface_bytepitch_alignment;
+     }
+
+     length = DFB_PLANE_MULTIPLY( buffer->format,
+                                  MAX( surface->config.size.h, surface->config.min_size.h ) * pitch );
+
+     /* Add extra space for optimized routines which are now allowed to overrun, e.g. prefetching. */
+     length += 16;
+
+     if (device->limits.surface_byteoffset_alignment > 1) {
+          length += device->limits.surface_byteoffset_alignment - 1;
+          length -= length % device->limits.surface_byteoffset_alignment;
+     }
+
+     if (ret_pitch)
+          *ret_pitch = pitch;
+
+     if (ret_length)
+          *ret_length = length;
+}
+
+unsigned long
+dfb_gfxcard_memory_physical( CoreGraphicsDevice *device,
+                             unsigned int        offset )
+{
+     return dfb_system_video_memory_physical( offset );
+}
+
+void *
+dfb_gfxcard_memory_virtual( CoreGraphicsDevice *device,
+                            unsigned int        offset )
+{
+     return dfb_system_video_memory_virtual( offset );
+}
+
+unsigned long
+dfb_gfxcard_auxmemory_physical( CoreGraphicsDevice *device,
+                                unsigned int        offset )
+{
+     return dfb_system_aux_memory_physical( offset );
+}
+
+void *
+dfb_gfxcard_auxmemory_virtual( CoreGraphicsDevice *device,
+                               unsigned int        offset )
+{
+     return dfb_system_aux_memory_virtual( offset );
+}
+
+void *
+dfb_gfxcard_get_device_data( void )
+{
+     D_ASSERT( card != NULL );
+     D_ASSERT( card->shared != NULL );
+
+     return card->shared->device_data;
+}
+
+void *
+dfb_gfxcard_get_driver_data( void )
+{
+     D_ASSERT( card != NULL );
+
+     return card->driver_data;
+}
+
+CoreGraphicsDevice *
+dfb_gfxcard_get_primary( void )
+{
+     return card;
+}
+
+
+/** internal **/
+
+/*
+ * loads/probes/unloads one driver module after another until a suitable
+ * driver is found and returns its symlinked functions
+ */
+static void dfb_gfxcard_find_driver( CoreDFB *core )
+{
+     DirectLink          *link;
+     FusionSHMPoolShared *pool = dfb_core_shmpool( core );
+
+     direct_list_foreach (link, dfb_graphics_drivers.entries) {
+          DirectModuleEntry *module = (DirectModuleEntry*) link;
+
+          const GraphicsDriverFuncs *funcs = direct_module_ref( module );
+
+          if (!funcs)
+               continue;
+
+          if (!card->module && funcs->Probe( card )) {
+               funcs->GetDriverInfo( card, &card->shared->driver_info );
+
+               card->module       = module;
+               card->driver_funcs = funcs;
+
+               card->shared->module_name = SHSTRDUP( pool, module->name );
+          }
+          else
+               direct_module_unref( module );
+     }
+}
+
+/*
+ * loads the driver module used by the session
+ */
+static void dfb_gfxcard_load_driver( void )
+{
+     DirectLink *link;
+
+     if (!card->shared->module_name)
+          return;
+
+     direct_list_foreach (link, dfb_graphics_drivers.entries) {
+          DirectModuleEntry *module = (DirectModuleEntry*) link;
+
+          const GraphicsDriverFuncs *funcs = direct_module_ref( module );
+
+          if (!funcs)
+               continue;
+
+          if (!card->module &&
+              !strcmp( module->name, card->shared->module_name ))
+          {
+               card->module       = module;
+               card->driver_funcs = funcs;
+          }
+          else
+               direct_module_unref( module );
+     }
+}
+
diff --git a/Source/DirectFB/src/core/gfxcard.h b/Source/DirectFB/src/core/gfxcard.h
new file mode 100755
index 0000000..6e723d0
--- /dev/null
+++ b/Source/DirectFB/src/core/gfxcard.h
@@ -0,0 +1,470 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GFXCARD_H__
+#define __GFXCARD_H__
+
+#include <pthread.h>
+
+#include <direct/modules.h>
+
+#include <fusion/lock.h>
+
+#include <directfb.h>
+#include <core/coretypes.h>
+
+
+typedef enum {
+     CCF_CLIPPING   = 0x00000001,
+     CCF_NOTRIEMU   = 0x00000002,
+     CCF_READSYSMEM = 0x00000004,
+     /* CCF_WRITESYSMEM ?! */
+     CCF_AUXMEMORY  = 0x00000010,
+     CCF_RENDEROPTS = 0x00000020
+} CardCapabilitiesFlags;
+
+struct __DFB_CoreGraphicsSerial {
+     unsigned int serial;
+     unsigned int generation;
+};
+
+typedef struct {
+     CardCapabilitiesFlags   flags;
+
+     DFBAccelerationMask     accel;
+     DFBSurfaceBlittingFlags blitting;
+     DFBSurfaceDrawingFlags  drawing;
+     DFBAccelerationMask     clip;
+} CardCapabilities;
+
+typedef struct {
+     unsigned int            surface_byteoffset_alignment;
+     unsigned int            surface_pixelpitch_alignment;
+     unsigned int            surface_bytepitch_alignment;
+
+     unsigned int            surface_max_power_of_two_pixelpitch;
+     unsigned int            surface_max_power_of_two_bytepitch;
+     unsigned int            surface_max_power_of_two_height;
+
+     DFBDimension            dst_min;
+     DFBDimension            dst_max;
+     DFBDimension            src_min;
+     DFBDimension            src_max;
+} CardLimitations;
+
+DECLARE_MODULE_DIRECTORY( dfb_graphics_drivers );
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_GRAPHICS_DRIVER_ABI_VERSION          34
+
+#define DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH     40
+#define DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH   60
+#define DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH     100
+#define DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH  40
+
+#define DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH     48
+#define DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH   64
+
+
+typedef struct {
+     int          major;        /* major version */
+     int          minor;        /* minor version */
+} GraphicsDriverVersion;        /* major.minor, e.g. 0.1 */
+
+typedef struct {
+     GraphicsDriverVersion version;
+
+     char               name[DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH];
+                                /* Name of driver, e.g. 'Matrox Driver' */
+
+     char               vendor[DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH];
+                                /* Vendor (or author) of the driver,
+                                   e.g. 'directfb.org' or 'Denis Oliver Kropp' */
+
+     char               url[DFB_GRAPHICS_DRIVER_INFO_URL_LENGTH];
+                                /* URL for driver updates,
+                                   e.g. 'http://www.directfb.org/' */
+
+     char               license[DFB_GRAPHICS_DRIVER_INFO_LICENSE_LENGTH];
+                                /* License, e.g. 'LGPL' or 'proprietary' */
+
+     unsigned int       driver_data_size;
+     unsigned int       device_data_size;
+} GraphicsDriverInfo;
+
+typedef struct {
+     char               name[DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH];
+                                /* Device name, e.g. 'G400' */
+
+     char               vendor[DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH];
+                                /* Vendor of the device,
+                                   e.g. 'Matrox' or 'ATI' */
+
+     /* hardware acceleration capabilities */
+     CardCapabilities   caps;
+
+     /* hardware limitations */
+     CardLimitations    limits;
+} GraphicsDeviceInfo;
+
+typedef struct _GraphicsDeviceFuncs {
+     /*
+      * function that is called after variable screeninfo is changed
+      * (used for buggy fbdev drivers, that reinitialize something when
+      * calling FBIO_PUT_VSCREENINFO)
+      */
+     void (*AfterSetVar)( void *driver_data, void *device_data );
+
+     /*
+      * Called after driver->InitDevice() and during dfb_gfxcard_unlock( true ).
+      * The driver should do the one time initialization of the engine,
+      * e.g. writing some registers that are supposed to have a fixed value.
+      *
+      * This happens after mode switching or after returning from
+      * OpenGL state (e.g. DRI driver).
+      */
+     void (*EngineReset)( void *driver_data, void *device_data );
+
+     /*
+      * Makes sure that graphics hardware has finished all operations.
+      *
+      * This method is called before the CPU accesses a surface' buffer
+      * that had been written to by the hardware after this method has been
+      * called the last time.
+      *
+      * It's also called before entering the OpenGL state (e.g. DRI driver).
+      */
+     DFBResult (*EngineSync)( void *driver_data, void *device_data );
+     
+     /*
+      * Called during dfb_gfxcard_lock() to notify the driver that
+      * the current rendering state is no longer valid.
+      */
+     void (*InvalidateState)( void *driver_data, void *device_data );
+
+     /*
+      * after the video memory has been written to by the CPU (e.g. modification
+      * of a texture) make sure the accelerator won't use cached texture data
+      */
+     void (*FlushTextureCache)( void *driver_data, void *device_data );
+
+     /*
+      * After the video memory has been written to by the accelerator
+      * make sure the CPU won't read back cached data.
+      */
+     void (*FlushReadCache)( void *driver_data, void *device_data );
+
+     /*
+      * Called before a software access to a video surface buffer.
+      */
+     void (*SurfaceEnter)( void *driver_data, void *device_data,
+                           CoreSurfaceBuffer *buffer, DFBSurfaceLockFlags flags );
+
+     /*
+      * Called after a software access to a video surface buffer.
+      */
+     void (*SurfaceLeave)( void *driver_data, void *device_data, CoreSurfaceBuffer *buffer );
+
+     /*
+      * Return the serial of the last (queued) operation.
+      *
+      * The serial is used to wait for finishing a specific graphics
+      * operation instead of the whole engine being idle.
+      */
+     void (*GetSerial)( void *driver_data, void *device_data, CoreGraphicsSerial *serial );
+
+     /*
+      * Makes sure that graphics hardware has finished the specified operation.
+      */
+     DFBResult (*WaitSerial)( void *driver_data, void *device_data, const CoreGraphicsSerial *serial );
+
+     /*
+      * emit any buffered commands, i.e. trigger processing
+      */
+     void (*EmitCommands)  ( void *driver_data, void *device_data );
+
+     /*
+      * Check if the function 'accel' can be accelerated with the 'state'.
+      * If that's true, the function sets the 'accel' bit in 'state->accel'.
+      * Otherwise the function just returns, no need to clear the bit.
+      */
+     void (*CheckState)( void *driver_data, void *device_data,
+                         CardState *state, DFBAccelerationMask accel );
+
+     /*
+      * Program card for execution of the function 'accel' with the 'state'.
+      * 'state->modified' contains information about changed entries.
+      * This function has to set at least 'accel' in 'state->set'.
+      * The driver should remember 'state->modified' and clear it.
+      * The driver may modify 'funcs' depending on 'state' settings.
+      */
+     void (*SetState)  ( void *driver_data, void *device_data,
+                         struct _GraphicsDeviceFuncs *funcs,
+                         CardState *state, DFBAccelerationMask accel );
+
+     /*
+      * drawing functions
+      */
+     bool (*FillRectangle) ( void *driver_data, void *device_data,
+                             DFBRectangle *rect );
+
+     bool (*DrawRectangle) ( void *driver_data, void *device_data,
+                             DFBRectangle *rect );
+
+     bool (*DrawLine)      ( void *driver_data, void *device_data,
+                             DFBRegion *line );
+
+     bool (*FillTriangle)  ( void *driver_data, void *device_data,
+                             DFBTriangle *tri );
+
+     /*
+      * blitting functions
+      */
+     bool (*Blit)            ( void *driver_data, void *device_data,
+                               DFBRectangle *rect, int dx, int dy );
+
+     bool (*StretchBlit)     ( void *driver_data, void *device_data,
+                               DFBRectangle *srect, DFBRectangle *drect );
+
+     bool (*TextureTriangles)( void *driver_data, void *device_data,
+                               DFBVertex *vertices, int num,
+                               DFBTriangleFormation formation );
+
+     /*
+      * Signal beginning of a sequence of operations using this state.
+      * Any number of states can be 'drawing'.
+      */
+     void (*StartDrawing)( void *driver_data, void *device_data, CardState *state );
+
+     /*
+      * Signal end of sequence, i.e. destination surface is consistent again.
+      */
+     void (*StopDrawing)( void *driver_data, void *device_data, CardState *state );
+} GraphicsDeviceFuncs;
+
+typedef struct {
+     int       (*Probe)          (CoreGraphicsDevice  *device);
+     void      (*GetDriverInfo)  (CoreGraphicsDevice  *device,
+                                  GraphicsDriverInfo  *driver_info);
+
+     DFBResult (*InitDriver)     (CoreGraphicsDevice  *device,
+                                  GraphicsDeviceFuncs *funcs,
+                                  void                *driver_data,
+                                  void                *device_data,
+                                  CoreDFB             *core);
+
+     DFBResult (*InitDevice)     (CoreGraphicsDevice  *device,
+                                  GraphicsDeviceInfo  *device_info,
+                                  void                *driver_data,
+                                  void                *device_data);
+
+     void      (*CloseDevice)    (CoreGraphicsDevice  *device,
+                                  void                *driver_data,
+                                  void                *device_data);
+     void      (*CloseDriver)    (CoreGraphicsDevice  *device,
+                                  void                *driver_data);
+} GraphicsDriverFuncs;
+
+typedef enum {
+     GDLF_NONE       = 0x00000000,
+
+     GDLF_WAIT       = 0x00000001,
+     GDLF_SYNC       = 0x00000002,
+     GDLF_INVALIDATE = 0x00000004,
+     GDLF_RESET      = 0x00000008
+} GraphicsDeviceLockFlags;
+
+DFBResult dfb_gfxcard_lock( GraphicsDeviceLockFlags flags );
+void dfb_gfxcard_unlock( void );
+void dfb_gfxcard_holdup( void );
+
+bool dfb_gfxcard_state_check( CardState *state, DFBAccelerationMask accel );
+
+/*
+ * Signal beginning of a sequence of operations using this state.
+ * Any number of states can be 'drawing'.
+ */
+void dfb_gfxcard_start_drawing( CoreGraphicsDevice *device,
+                                CardState          *state );
+
+/*
+ * Signal end of sequence, i.e. destination surface is consistent again.
+ */
+void dfb_gfxcard_stop_drawing ( CoreGraphicsDevice *device,
+                                CardState          *state );
+
+/*
+ * drawing functions, lock source and destination surfaces,
+ * handle clipping and drawing method (hardware/software)
+ */
+void dfb_gfxcard_fillrectangles         ( const DFBRectangle   *rects,
+                                          int                   num,
+                                          CardState            *state );
+
+void dfb_gfxcard_drawrectangle          ( DFBRectangle         *rect,
+                                          CardState            *state );
+
+void dfb_gfxcard_drawlines              ( DFBRegion            *lines,
+                                          int                   num_lines,
+                                          CardState            *state );
+
+void dfb_gfxcard_fillspans              ( int                   y,
+                                          DFBSpan              *spans,
+                                          int                   num_spans,
+                                          CardState            *state );
+
+void dfb_gfxcard_filltriangles          ( const DFBTriangle    *tris,
+                                          int                   num,
+                                          CardState            *state );
+
+void dfb_gfxcard_blit                   ( DFBRectangle         *rect,
+                                          int                   dx,
+                                          int                   dy,
+                                          CardState            *state );
+
+void dfb_gfxcard_batchblit              ( DFBRectangle         *rects,
+                                          DFBPoint             *points,
+                                          int                   num,
+                                          CardState            *state );
+
+void dfb_gfxcard_tileblit               ( DFBRectangle         *rect,
+                                          int                   dx1,
+                                          int                   dy1,
+                                          int                   dx2,
+                                          int                   dy2,
+                                          CardState            *state );
+
+void dfb_gfxcard_stretchblit            ( DFBRectangle         *srect,
+                                          DFBRectangle         *drect,
+                                          CardState            *state );
+
+void dfb_gfxcard_texture_triangles      ( DFBVertex            *vertices,
+                                          int                   num,
+                                          DFBTriangleFormation  formation,
+                                          CardState            *state );
+
+void dfb_gfxcard_drawstring             ( const u8             *text,
+                                          int                   bytes,
+                                          DFBTextEncodingID     encoding,
+                                          int                   x,
+                                          int                   y,
+                                          CoreFont             *font,
+                                          unsigned int          layers, 
+                                          CardState            *state );
+
+void dfb_gfxcard_drawglyph              ( CoreGlyphData       **glyph,
+                                          int                   x,
+                                          int                   y,
+                                          CoreFont             *font,
+                                          unsigned int          layers, 
+                                          CardState            *state );
+
+bool dfb_gfxcard_drawstring_check_state ( CoreFont             *font,
+                                          CardState            *state );
+
+DFBResult dfb_gfxcard_sync( void );
+void dfb_gfxcard_invalidate_state( void );
+DFBResult dfb_gfxcard_wait_serial( const CoreGraphicsSerial *serial );
+void dfb_gfxcard_flush_texture_cache( void );
+void dfb_gfxcard_flush_read_cache( void );
+void dfb_gfxcard_after_set_var( void );
+void dfb_gfxcard_surface_enter( CoreSurfaceBuffer *buffer, DFBSurfaceLockFlags flags );
+void dfb_gfxcard_surface_leave( CoreSurfaceBuffer *buffer );
+
+DFBResult dfb_gfxcard_adjust_heap_offset( int offset );
+
+void            dfb_gfxcard_get_capabilities  ( CardCapabilities   *ret_caps );
+void            dfb_gfxcard_get_device_info   ( GraphicsDeviceInfo *ret_info );
+void            dfb_gfxcard_get_driver_info   ( GraphicsDriverInfo *ret_info );
+
+int             dfb_gfxcard_reserve_memory    ( CoreGraphicsDevice  *device,
+                                                unsigned int         size );
+int             dfb_gfxcard_reserve_auxmemory ( CoreGraphicsDevice  *device,
+                                                unsigned int         size );
+
+unsigned int    dfb_gfxcard_memory_length     ( void );
+unsigned int    dfb_gfxcard_auxmemory_length  ( void );
+
+void           *dfb_gfxcard_get_device_data   ( void );
+void           *dfb_gfxcard_get_driver_data   ( void );
+
+CoreGraphicsDevice *dfb_gfxcard_get_primary   ( void );
+
+/*
+ * Graphics drivers call this function to get access to MMIO regions.
+ *
+ * device: Graphics device to map
+ * offset: Offset from MMIO base (default offset is 0)
+ * length: Length of mapped region (-1 uses default length)
+ *
+ * Returns the virtual address or NULL if mapping failed.
+ */
+volatile void *dfb_gfxcard_map_mmio( CoreGraphicsDevice *device,
+                                     unsigned int        offset,
+                                     int                 length );
+
+/*
+ * Graphics drivers call this function to unmap MMIO regions.
+ *
+ * addr:   Virtual address returned by gfxcard_map_mmio
+ * length: Length of mapped region (-1 uses default length)
+ */
+void dfb_gfxcard_unmap_mmio( CoreGraphicsDevice *device,
+                             volatile void      *addr,
+                             int                 length );
+
+int dfb_gfxcard_get_accelerator( CoreGraphicsDevice *device );
+
+void dfb_gfxcard_get_limits( CoreGraphicsDevice *device,
+                             CardLimitations    *ret_limits );
+
+void dfb_gfxcard_calc_buffer_size( CoreGraphicsDevice *device,
+                                   CoreSurfaceBuffer  *buffer,
+                                   int                *ret_pitch,
+                                   int                *ret_length );
+
+unsigned long  dfb_gfxcard_memory_physical   ( CoreGraphicsDevice *device,
+                                               unsigned int        offset );
+void          *dfb_gfxcard_memory_virtual    ( CoreGraphicsDevice *device,
+                                               unsigned int        offset );
+
+unsigned long  dfb_gfxcard_auxmemory_physical( CoreGraphicsDevice *device,
+                                               unsigned int        offset );
+void          *dfb_gfxcard_auxmemory_virtual ( CoreGraphicsDevice *device,
+                                               unsigned int        offset );
+
+
+/* Hook for registering additional screen(s) and layer(s) in app or lib initializing DirectFB. */
+extern void (*__DFB_CoreRegisterHook)( CoreDFB *core, CoreGraphicsDevice *device, void *ctx );
+extern void  *__DFB_CoreRegisterHookCtx;
+
+
+#endif
+
diff --git a/Source/DirectFB/src/core/graphics_driver.h b/Source/DirectFB/src/core/graphics_driver.h
new file mode 100755
index 0000000..de03234
--- /dev/null
+++ b/Source/DirectFB/src/core/graphics_driver.h
@@ -0,0 +1,86 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GRAPHICS_DRIVER_H__
+#define __GRAPHICS_DRIVER_H__
+
+#include <direct/modules.h>
+
+#include <core/gfxcard.h>
+
+
+static int
+driver_probe( CoreGraphicsDevice *device );
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info );
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core );
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data );
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+                     void               *driver_data,
+                     void               *device_data );
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+                     void               *driver_data );
+
+static GraphicsDriverFuncs driver_funcs = {
+     .Probe              = driver_probe,
+     .GetDriverInfo      = driver_get_info,
+     .InitDriver         = driver_init_driver,
+     .InitDevice         = driver_init_device,
+     .CloseDevice        = driver_close_device,
+     .CloseDriver        = driver_close_driver
+};
+
+#define DFB_GRAPHICS_DRIVER(shortname)                           \
+__attribute__((constructor)) void directfb_##shortname( void );  \
+                                                                 \
+void                                                             \
+directfb_##shortname( void )                                     \
+{                                                                \
+     direct_modules_register( &dfb_graphics_drivers,             \
+                              DFB_GRAPHICS_DRIVER_ABI_VERSION,   \
+                              #shortname, &driver_funcs );       \
+}
+
+#endif
diff --git a/Source/DirectFB/src/core/input.c b/Source/DirectFB/src/core/input.c
new file mode 100755
index 0000000..c8eee18
--- /dev/null
+++ b/Source/DirectFB/src/core/input.c
@@ -0,0 +1,2668 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <directfb.h>
+#include <directfb_keynames.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+
+#include <fusion/shmalloc.h>
+#include <fusion/reactor.h>
+#include <fusion/arena.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core_parts.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers.h>
+#include <core/input.h>
+#include <core/windows.h>
+#include <core/windows_internal.h>
+
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/modules.h>
+#include <direct/trace.h>
+
+#include <fusion/build.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <gfx/convert.h>
+
+
+D_DEBUG_DOMAIN( Core_Input,    "Core/Input",     "DirectFB Input Core" );
+D_DEBUG_DOMAIN( Core_InputEvt, "Core/Input/Evt", "DirectFB Input Core Events & Dispatch" );
+
+
+DEFINE_MODULE_DIRECTORY( dfb_input_modules, "inputdrivers", DFB_INPUT_DRIVER_ABI_VERSION );
+
+/**********************************************************************************************************************/
+
+typedef enum {
+     CICC_RESCAN_DEVICES
+} CoreInputCoreCommand;
+
+typedef enum {
+     CIDC_RELOAD_KEYMAP,
+     CIDC_SET_SENSITIVITY
+} CoreInputDeviceCommand;
+
+
+typedef struct {
+     DirectLink               link;
+
+     int                      magic;
+
+     DirectModuleEntry       *module;
+
+     const InputDriverFuncs  *funcs;
+
+     InputDriverInfo          info;
+
+     int                      nr_devices;
+} InputDriver;
+
+typedef struct {
+     int                          min_keycode;
+     int                          max_keycode;
+     int                          num_entries;
+     DFBInputDeviceKeymapEntry   *entries;
+} InputDeviceKeymap;
+
+typedef struct {
+     int                          magic;
+
+     DFBInputDeviceID             id;            /* unique device id */
+
+     int                          num;
+
+     InputDeviceInfo              device_info;
+
+     InputDeviceKeymap            keymap;
+
+     DFBInputDeviceModifierMask   modifiers_l;
+     DFBInputDeviceModifierMask   modifiers_r;
+     DFBInputDeviceLockState      locks;
+     DFBInputDeviceButtonMask     buttons;
+
+     DFBInputDeviceKeyIdentifier  last_key;      /* last key pressed */
+     DFBInputDeviceKeySymbol      last_symbol;   /* last symbol pressed */
+     bool                         first_press;   /* first press of key */
+
+     FusionReactor               *reactor;       /* event dispatcher */
+     FusionSkirmish               lock;
+
+     FusionCall                   call;          /* driver call via master */
+
+     unsigned int                 axis_num;
+     DFBInputDeviceAxisInfo      *axis_info;
+
+
+     DFBInputDeviceState          state;
+} InputDeviceShared;
+
+struct __DFB_CoreInputDevice {
+     int                 magic;
+
+     InputDeviceShared  *shared;
+
+     InputDriver        *driver;
+     void               *driver_data;
+
+     CoreDFB            *core;
+};
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                 magic;
+
+     int                 num;
+     InputDeviceShared  *devices[MAX_INPUTDEVICES];
+
+     FusionCall          call;
+     FusionReactor      *reactor;
+} DFBInputCoreShared;
+
+struct __DFB_DFBInputCore {
+     int                 magic;
+
+     CoreDFB            *core;
+
+     DFBInputCoreShared *shared;
+
+     DirectLink         *drivers;
+
+     int                 num;
+     CoreInputDevice    *devices[MAX_INPUTDEVICES];
+
+     Reaction            reaction;
+};
+
+
+DFB_CORE_PART( input_core, InputCore );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DFBInputDeviceKeySymbol      target;
+     DFBInputDeviceKeySymbol      result;
+} DeadKeyCombo;
+
+typedef struct {
+     DFBInputDeviceKeySymbol      deadkey;
+     const DeadKeyCombo          *combos;
+} DeadKeyMap;
+
+/**********************************************************************************************************************/
+
+static const DeadKeyCombo combos_grave[] = {         
+     { DIKS_SPACE,     (unsigned char) '`' },        
+     { DIKS_SMALL_A,   (unsigned char) 'à' },        
+     { DIKS_SMALL_E,   (unsigned char) 'è' },        
+     { DIKS_SMALL_I,   (unsigned char) 'ì' },        
+     { DIKS_SMALL_O,   (unsigned char) 'ò' },        
+     { DIKS_SMALL_U,   (unsigned char) 'ù' },        
+     { DIKS_CAPITAL_A, (unsigned char) 'À' },        
+     { DIKS_CAPITAL_E, (unsigned char) 'È' },        
+     { DIKS_CAPITAL_I, (unsigned char) 'Ì' },        
+     { DIKS_CAPITAL_O, (unsigned char) 'Ò' },        
+     { DIKS_CAPITAL_U, (unsigned char) 'Ù' },        
+     { 0, 0 }                                        
+};                                                   
+                                                     
+static const DeadKeyCombo combos_acute[] = {         
+     { DIKS_SPACE,     (unsigned char) '\'' },       
+     { DIKS_SMALL_A,   (unsigned char) 'á' },        
+     { DIKS_SMALL_E,   (unsigned char) 'é' },        
+     { DIKS_SMALL_I,   (unsigned char) 'í' },        
+     { DIKS_SMALL_O,   (unsigned char) 'ó' },        
+     { DIKS_SMALL_U,   (unsigned char) 'ú' },        
+     { DIKS_SMALL_Y,   (unsigned char) 'ý' },        
+     { DIKS_CAPITAL_A, (unsigned char) 'Á' },        
+     { DIKS_CAPITAL_E, (unsigned char) 'É' },        
+     { DIKS_CAPITAL_I, (unsigned char) 'Í' },        
+     { DIKS_CAPITAL_O, (unsigned char) 'Ó' },        
+     { DIKS_CAPITAL_U, (unsigned char) 'Ú' },        
+     { DIKS_CAPITAL_Y, (unsigned char) 'Ý' },        
+     { 0, 0 }                                        
+};                                                   
+                                                     
+static const DeadKeyCombo combos_circumflex[] = {    
+     { DIKS_SPACE,     (unsigned char) '^' },        
+     { DIKS_SMALL_A,   (unsigned char) 'â' },        
+     { DIKS_SMALL_E,   (unsigned char) 'ê' },        
+     { DIKS_SMALL_I,   (unsigned char) 'î' },        
+     { DIKS_SMALL_O,   (unsigned char) 'ô' },        
+     { DIKS_SMALL_U,   (unsigned char) 'û' },        
+     { DIKS_CAPITAL_A, (unsigned char) 'Â' },        
+     { DIKS_CAPITAL_E, (unsigned char) 'Ê' },        
+     { DIKS_CAPITAL_I, (unsigned char) 'Î' },        
+     { DIKS_CAPITAL_O, (unsigned char) 'Ô' },        
+     { DIKS_CAPITAL_U, (unsigned char) 'Û' },        
+     { 0, 0 }                                        
+};                                                   
+                                                     
+static const DeadKeyCombo combos_diaeresis[] = {     
+     { DIKS_SPACE,     (unsigned char) '¨' },        
+     { DIKS_SMALL_A,   (unsigned char) 'ä' },        
+     { DIKS_SMALL_E,   (unsigned char) 'ë' },        
+     { DIKS_SMALL_I,   (unsigned char) 'ï' },        
+     { DIKS_SMALL_O,   (unsigned char) 'ö' },        
+     { DIKS_SMALL_U,   (unsigned char) 'ü' },        
+     { DIKS_CAPITAL_A, (unsigned char) 'Ä' },        
+     { DIKS_CAPITAL_E, (unsigned char) 'Ë' },        
+     { DIKS_CAPITAL_I, (unsigned char) 'Ï' },        
+     { DIKS_CAPITAL_O, (unsigned char) 'Ö' },        
+     { DIKS_CAPITAL_U, (unsigned char) 'Ü' },        
+     { 0, 0 }                                        
+};                                                   
+                                                     
+static const DeadKeyCombo combos_tilde[] = {         
+     { DIKS_SPACE,     (unsigned char) '~' },        
+     { DIKS_SMALL_A,   (unsigned char) 'ã' },        
+     { DIKS_SMALL_N,   (unsigned char) 'ñ' },        
+     { DIKS_SMALL_O,   (unsigned char) 'õ' },        
+     { DIKS_CAPITAL_A, (unsigned char) 'Ã' },        
+     { DIKS_CAPITAL_N, (unsigned char) 'Ñ' },        
+     { DIKS_CAPITAL_O, (unsigned char) 'Õ' },        
+     { 0, 0 }                                        
+};
+
+static const DeadKeyMap deadkey_maps[] = {           
+     { DIKS_DEAD_GRAVE,      combos_grave },         
+     { DIKS_DEAD_ACUTE,      combos_acute },         
+     { DIKS_DEAD_CIRCUMFLEX, combos_circumflex },    
+     { DIKS_DEAD_DIAERESIS,  combos_diaeresis },     
+     { DIKS_DEAD_TILDE,      combos_tilde }          
+};
+
+/* define a lookup table to go from key IDs to names.
+ * This is used to look up the names provided in a loaded key table */
+/* this table is roughly 4Kb in size */
+DirectFBKeySymbolNames(KeySymbolNames);
+DirectFBKeyIdentifierNames(KeyIdentifierNames);
+
+/**********************************************************************************************************************/
+
+static void      init_drivers  ( CoreDFB *core );
+static DFBResult rescan_devices( CoreDFB *core );
+
+static void allocate_device_keymap( CoreDFB *core, CoreInputDevice *device );
+
+static DFBInputDeviceKeymapEntry *get_keymap_entry( CoreInputDevice *device,
+                                                    int              code );
+
+static DFBResult set_keymap_entry( CoreInputDevice           *device,
+                                   int                        code,
+                                   DFBInputDeviceKeymapEntry *entry );
+
+static DFBResult load_keymap( CoreInputDevice           *device,
+                              char                      *filename );
+
+static DFBInputDeviceKeySymbol     lookup_keysymbol( char *symbolname );
+static DFBInputDeviceKeyIdentifier lookup_keyidentifier( char *identifiername );
+
+/**********************************************************************************************************************/
+
+static bool lookup_from_table( CoreInputDevice    *device,
+                               DFBInputEvent      *event,
+                               DFBInputEventFlags  lookup );
+
+static void fixup_key_event  ( CoreInputDevice    *device,
+                               DFBInputEvent      *event );
+
+static void fixup_mouse_event( CoreInputDevice    *device,
+                               DFBInputEvent      *event );
+
+static void flush_keys       ( CoreInputDevice    *device );
+
+static bool core_input_filter( CoreInputDevice    *device,
+                               DFBInputEvent      *event );
+
+/**********************************************************************************************************************/
+
+static DFBInputDeviceKeyIdentifier symbol_to_id( DFBInputDeviceKeySymbol     symbol );
+
+static DFBInputDeviceKeySymbol     id_to_symbol( DFBInputDeviceKeyIdentifier id,
+                                                 DFBInputDeviceModifierMask  modifiers,
+                                                 DFBInputDeviceLockState     locks );
+
+/**********************************************************************************************************************/
+
+static ReactionFunc dfb_input_globals[MAX_INPUT_GLOBALS+1] = {
+/* 0 */   _dfb_windowstack_inputdevice_listener,
+          NULL
+};
+
+DFBResult
+dfb_input_add_global( ReactionFunc  func,
+                      int          *ret_index )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, func, ret_index );
+
+     D_ASSERT( func != NULL );
+     D_ASSERT( ret_index != NULL );
+
+     for (i=0; i<MAX_INPUT_GLOBALS; i++) {
+          if (!dfb_input_globals[i]) {
+               dfb_input_globals[i] = func;
+
+               D_DEBUG_AT( Core_Input, "  -> index %d\n", i );
+
+               *ret_index = i;
+
+               return DFB_OK;
+          }
+     }
+
+     return DFB_LIMITEXCEEDED;
+}
+
+DFBResult
+dfb_input_set_global( ReactionFunc func,
+                      int          index )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %d )\n", __FUNCTION__, func, index );
+
+     D_ASSERT( func != NULL );
+     D_ASSERT( index >= 0 );
+     D_ASSERT( index < MAX_INPUT_GLOBALS );
+
+     D_ASSUME( dfb_input_globals[index] == NULL );
+
+     dfb_input_globals[index] = func;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DFBInputCore       *core_local; /* FIXME */
+static DFBInputCoreShared *core_input; /* FIXME */
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult
+core_input_call_handler( int           caller,   /* fusion id of the caller */
+                         int           call_arg, /* optional call parameter */
+                         void         *call_ptr, /* optional call parameter */
+                         void         *ctx,      /* optional handler context */
+                         unsigned int  serial,
+                         int          *ret_val )
+{
+     CoreDFB *core = ctx;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     switch (call_arg) {
+          case CICC_RESCAN_DEVICES:
+               *ret_val = rescan_devices( core );
+               break;
+
+          default:
+               D_BUG( "unknown command %d", call_arg );
+               *ret_val = DFB_BUG;
+     }
+
+     return FCHR_RETURN;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+dfb_input_core_initialize( CoreDFB            *core,
+                           DFBInputCore       *data,
+                           DFBInputCoreShared *shared )
+{
+     D_DEBUG_AT( Core_Input, "dfb_input_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     core_local = data;   /* FIXME */
+     core_input = shared; /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     fusion_call_init( &core_input->call, core_input_call_handler, core, dfb_core_world( core ) );
+
+     core_input->reactor = fusion_reactor_new( sizeof(CoreInputCoreNotification), "Input Core", dfb_core_world( core ) );
+
+     fusion_reactor_direct( core_input->reactor, false );
+
+     direct_modules_explore_directory( &dfb_input_modules );
+
+     init_drivers( core );
+     rescan_devices( core );
+
+     D_MAGIC_SET( data, DFBInputCore );
+     D_MAGIC_SET( shared, DFBInputCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+rejoin_devices( CoreDFB *core )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( core_local, DFBInputCore );
+     D_ASSERT( core_input != NULL );
+
+     for (i=core_local->num; i<core_input->num; i++) {
+          CoreInputDevice *device;
+
+          D_DEBUG_AT( Core_Input, "  -> adding %d (%s)\n",
+                      core_input->devices[i]->id,
+                      core_input->devices[i]->device_info.desc.name );
+
+          device = D_CALLOC( 1, sizeof(CoreInputDevice) );
+          if (!device) {
+               D_OOM();
+               continue;
+          }
+
+          device->shared = core_input->devices[i];
+
+          D_MAGIC_SET( device, CoreInputDevice );
+
+          /* add it to the list */
+          core_local->devices[core_local->num++] = device;
+     }
+
+     return DFB_OK;
+}
+
+static ReactionResult
+core_input_core_reaction( const void *msg_data,
+                          void       *ctx )
+{
+     const CoreInputCoreNotification *notification = msg_data;
+     CoreDFB                         *core         = ctx;
+
+     if (notification->flags & CICNF_NEW_DEVICE)
+          rejoin_devices( core );
+
+     return RS_OK;
+}
+
+static DFBResult
+dfb_input_core_join( CoreDFB            *core,
+                     DFBInputCore       *data,
+                     DFBInputCoreShared *shared )
+{
+     D_DEBUG_AT( Core_Input, "dfb_input_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBInputCoreShared );
+
+     core_local = data;   /* FIXME */
+     core_input = shared; /* FIXME */
+
+     data->core   = core;
+     data->shared = shared;
+
+     D_MAGIC_SET( data, DFBInputCore );
+
+
+     rejoin_devices( core );
+
+     fusion_reactor_attach( core_input->reactor, core_input_core_reaction, core, &core_local->reaction );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_input_core_shutdown( DFBInputCore *data,
+                         bool          emergency )
+{
+     int                  i;
+     DFBInputCoreShared  *shared;
+     FusionSHMPoolShared *pool = dfb_core_shmpool( data->core );
+
+     D_DEBUG_AT( Core_Input, "dfb_input_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBInputCore );
+     D_MAGIC_ASSERT( data->shared, DFBInputCoreShared );
+
+     shared = data->shared;
+
+
+     for (i=0; i<data->num; i++) {
+          CoreInputDevice   *device = data->devices[i];
+          InputDriver       *driver;
+          InputDeviceShared *devshared;
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+
+          driver = device->driver;
+          D_ASSERT( driver != NULL );
+
+          devshared = device->shared;
+          D_ASSERT( devshared != NULL );
+
+          fusion_call_destroy( &devshared->call );
+          fusion_skirmish_destroy( &devshared->lock );
+
+          if (device->driver_data != NULL) {
+               void *driver_data;
+
+               D_ASSERT( driver->funcs != NULL );
+               D_ASSERT( driver->funcs->CloseDevice != NULL );
+
+               D_DEBUG_AT( Core_Input, "  -> closing '%s' (%d) %d.%d (%s)\n",
+                           devshared->device_info.desc.name, devshared->num + 1,
+                           driver->info.version.major,
+                           driver->info.version.minor, driver->info.vendor );
+
+               driver_data = device->driver_data;
+               device->driver_data = NULL;
+               driver->funcs->CloseDevice( driver_data );
+          }
+
+          if (!--driver->nr_devices) {
+               direct_module_unref( driver->module );
+               D_FREE( driver );
+          }
+
+          fusion_reactor_free( devshared->reactor );
+
+          if (devshared->keymap.entries)
+               SHFREE( pool, devshared->keymap.entries );
+  
+          if (devshared->axis_info)
+               SHFREE( pool, devshared->axis_info );
+
+          SHFREE( pool, devshared );
+
+          D_MAGIC_CLEAR( device );
+
+          D_FREE( device );
+     }
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_input_core_leave( DFBInputCore *data,
+                      bool          emergency )
+{
+     int                 i;
+     DFBInputCoreShared *shared;
+
+     D_DEBUG_AT( Core_Input, "dfb_input_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBInputCore );
+     D_MAGIC_ASSERT( data->shared, DFBInputCoreShared );
+
+     shared = data->shared;
+
+
+     for (i=0; i<data->num; i++) {
+          CoreInputDevice *device = data->devices[i];
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+
+          D_FREE( device );
+     }
+
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_input_core_suspend( DFBInputCore *data )
+{
+     int                 i;
+     DFBInputCoreShared *shared;
+
+     D_DEBUG_AT( Core_Input, "dfb_input_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBInputCore );
+     D_MAGIC_ASSERT( data->shared, DFBInputCoreShared );
+
+     shared = data->shared;
+
+     D_DEBUG_AT( Core_Input, "  -> suspending...\n" );
+
+     for (i=0; i<data->num; i++) {
+          CoreInputDevice   *device = data->devices[i];
+          InputDriver       *driver;
+          InputDeviceShared *devshared;
+          
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+          
+          driver = device->driver;
+          D_ASSERT( driver != NULL );
+          
+          devshared = device->shared;
+          D_ASSERT( devshared != NULL );
+
+          if (device->driver_data != NULL) {
+               void *driver_data;
+
+               D_ASSERT( driver->funcs != NULL );
+               D_ASSERT( driver->funcs->CloseDevice != NULL );
+
+               D_DEBUG_AT( Core_Input, "  -> closing '%s' (%d) %d.%d (%s)\n",
+                           devshared->device_info.desc.name, devshared->num + 1,
+                           driver->info.version.major,
+                           driver->info.version.minor, driver->info.vendor );
+
+               driver_data = device->driver_data;
+               device->driver_data = NULL;
+               driver->funcs->CloseDevice( driver_data );
+          }
+
+          flush_keys( device );
+     }
+
+     D_DEBUG_AT( Core_Input, "  -> suspended.\n" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_input_core_resume( DFBInputCore *data )
+{
+     DFBInputCoreShared *shared;
+     DFBResult           ret;
+     int                 i;
+
+     D_DEBUG_AT( Core_Input, "dfb_input_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBInputCore );
+     D_MAGIC_ASSERT( data->shared, DFBInputCoreShared );
+
+     shared = data->shared;
+
+     D_DEBUG_AT( Core_Input, "  -> resuming...\n" );
+
+     for (i=0; i<data->num; i++) {
+          CoreInputDevice *device = data->devices[i];
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+
+          D_DEBUG_AT( Core_Input, "  -> reopening '%s' (%d) %d.%d (%s)\n",
+                      device->shared->device_info.desc.name, device->shared->num + 1,
+                      device->driver->info.version.major,
+                      device->driver->info.version.minor,
+                      device->driver->info.vendor );
+
+          D_ASSERT( device->driver_data == NULL );
+
+          ret = device->driver->funcs->OpenDevice( device, device->shared->num,
+                                                   &device->shared->device_info,
+                                                   &device->driver_data );
+          if (ret) {
+               D_DERROR( ret, "DirectFB/Input: Failed reopening device "
+                         "during resume (%s)!\n", device->shared->device_info.desc.name );
+               device->driver_data = NULL;
+          }
+     }
+
+     D_DEBUG_AT( Core_Input, "  -> resumed.\n" );
+
+     return DFB_OK;
+}
+
+void
+dfb_input_enumerate_devices( InputDeviceCallback         callback,
+                             void                       *ctx,
+                             DFBInputDeviceCapabilities  caps )
+{
+     int i;
+
+     D_ASSERT( core_input != NULL );
+
+     for (i=0; i<core_local->num; i++) {
+          CoreInputDevice *device = core_local->devices[i];
+
+          DFBInputDeviceCapabilities dev_caps;
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+          D_ASSERT( device->shared != NULL );
+
+          dev_caps = device->shared->device_info.desc.caps;
+
+          /* Always match if unclassified */
+          if (!dev_caps)
+               dev_caps = DICAPS_ALL;
+
+          if ((dev_caps & caps) && callback( device, ctx ) == DFENUM_CANCEL)
+               break;
+     }
+}
+
+DirectResult
+dfb_input_attach( CoreInputDevice *device,
+                  ReactionFunc     func,
+                  void            *ctx,
+                  Reaction        *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %p, %p, %p )\n", __FUNCTION__, device, func, ctx, reaction );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     return fusion_reactor_attach( device->shared->reactor, func, ctx, reaction );
+}
+
+DirectResult
+dfb_input_detach( CoreInputDevice *device,
+                  Reaction        *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, reaction );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     return fusion_reactor_detach( device->shared->reactor, reaction );
+}
+
+DirectResult
+dfb_input_attach_global( CoreInputDevice *device,
+                         int              index,
+                         void            *ctx,
+                         GlobalReaction  *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %d, %p, %p )\n", __FUNCTION__, device, index, ctx, reaction );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     return fusion_reactor_attach_global( device->shared->reactor, index, ctx, reaction );
+}
+
+DirectResult
+dfb_input_detach_global( CoreInputDevice *device,
+                         GlobalReaction  *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, reaction );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     return fusion_reactor_detach_global( device->shared->reactor, reaction );
+}
+
+const char *
+dfb_input_event_type_name( DFBInputEventType type )
+{
+     switch (type) {
+          case DIET_UNKNOWN:
+               return "UNKNOWN";
+
+          case DIET_KEYPRESS:
+               return "KEYPRESS";
+
+          case DIET_KEYRELEASE:
+               return "KEYRELEASE";
+
+          case DIET_BUTTONPRESS:
+               return "BUTTONPRESS";
+
+          case DIET_BUTTONRELEASE:
+               return "BUTTONRELEASE";
+
+          case DIET_AXISMOTION:
+               return "AXISMOTION";
+
+          default:
+               break;
+     }
+
+     return "<invalid>";
+}
+
+void
+dfb_input_dispatch( CoreInputDevice *device, DFBInputEvent *event )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, event );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( event != NULL );
+
+     D_ASSUME( device->shared != NULL );
+
+     /*
+      * 0. Sanity checks & debugging...
+      */
+     if (!device->shared) {
+          D_DEBUG_AT( Core_Input, "  -> No shared data!\n" );
+          return;
+     }
+
+     D_ASSUME( device->shared->reactor != NULL );
+
+     if (!device->shared->reactor) {
+          D_DEBUG_AT( Core_Input, "  -> No reactor!\n" );
+          return;
+     }
+
+     D_DEBUG_AT( Core_InputEvt, "  -> (%02x) %s%s%s\n", event->type,
+                 dfb_input_event_type_name( event->type ),
+                 (event->flags & DIEF_FOLLOW) ? " [FOLLOW]" : "",
+                 (event->flags & DIEF_REPEAT) ? " [REPEAT]" : "" );
+
+#if D_DEBUG_ENABLED
+     if (event->flags & DIEF_TIMESTAMP)
+          D_DEBUG_AT( Core_InputEvt, "  -> TIMESTAMP  %lu.%06lu\n", event->timestamp.tv_sec, event->timestamp.tv_usec );
+     if (event->flags & DIEF_AXISABS)
+          D_DEBUG_AT( Core_InputEvt, "  -> AXISABS    %d at %d\n",  event->axis, event->axisabs );
+     if (event->flags & DIEF_AXISREL)
+          D_DEBUG_AT( Core_InputEvt, "  -> AXISREL    %d by %d\n",  event->axis, event->axisrel );
+     if (event->flags & DIEF_KEYCODE)
+          D_DEBUG_AT( Core_InputEvt, "  -> KEYCODE    %d\n",        event->key_code );
+     if (event->flags & DIEF_KEYID)
+          D_DEBUG_AT( Core_InputEvt, "  -> KEYID      0x%04x\n",    event->key_id );
+     if (event->flags & DIEF_KEYSYMBOL)
+          D_DEBUG_AT( Core_InputEvt, "  -> KEYSYMBOL  0x%04x\n",    event->key_symbol );
+     if (event->flags & DIEF_MODIFIERS)
+          D_DEBUG_AT( Core_InputEvt, "  -> MODIFIERS  0x%04x\n",    event->modifiers );
+     if (event->flags & DIEF_LOCKS)
+          D_DEBUG_AT( Core_InputEvt, "  -> LOCKS      0x%04x\n",    event->locks );
+     if (event->flags & DIEF_BUTTONS)
+          D_DEBUG_AT( Core_InputEvt, "  -> BUTTONS    0x%04x\n",    event->buttons );
+     if (event->flags & DIEF_GLOBAL)
+          D_DEBUG_AT( Core_InputEvt, "  -> GLOBAL\n" );
+#endif
+
+     /*
+      * 1. Fixup event...
+      */
+     event->clazz     = DFEC_INPUT;
+     event->device_id = device->shared->id;
+
+     if (!(event->flags & DIEF_TIMESTAMP)) {
+          gettimeofday( &event->timestamp, NULL );
+          event->flags |= DIEF_TIMESTAMP;
+     }
+
+     switch (event->type) {
+          case DIET_BUTTONPRESS:
+          case DIET_BUTTONRELEASE:
+               D_DEBUG_AT( Core_InputEvt, "  -> BUTTON     0x%04x\n", event->button );
+
+               if (dfb_config->lefty) {
+                    if (event->button == DIBI_LEFT)
+                         event->button = DIBI_RIGHT;
+                    else if (event->button == DIBI_RIGHT)
+                         event->button = DIBI_LEFT;
+
+                    D_DEBUG_AT( Core_InputEvt, "  -> lefty!  => 0x%04x <=\n", event->button );
+               }
+               /* fallthru */
+
+          case DIET_AXISMOTION:
+               fixup_mouse_event( device, event );
+               break;
+
+          case DIET_KEYPRESS:
+          case DIET_KEYRELEASE:
+               if (dfb_config->capslock_meta) {
+                    if (device->shared->keymap.num_entries && (event->flags & DIEF_KEYCODE))
+                         lookup_from_table( device, event, (DIEF_KEYID |
+                                                            DIEF_KEYSYMBOL) & ~event->flags );
+
+                    if (event->key_id == DIKI_CAPS_LOCK || event->key_symbol == DIKS_CAPS_LOCK) {
+                         event->flags     |= DIEF_KEYID | DIEF_KEYSYMBOL;
+                         event->key_code   = -1;
+                         event->key_id     = DIKI_META_L;
+                         event->key_symbol = DIKS_META;
+                    }
+               }
+
+               fixup_key_event( device, event );
+               break;
+
+          default:
+               ;
+     }
+
+#if D_DEBUG_ENABLED
+     if (event->flags & DIEF_TIMESTAMP)
+          D_DEBUG_AT( Core_InputEvt, "  => TIMESTAMP  %lu.%06lu\n", event->timestamp.tv_sec, event->timestamp.tv_usec );
+     if (event->flags & DIEF_AXISABS)
+          D_DEBUG_AT( Core_InputEvt, "  => AXISABS    %d at %d\n",  event->axis, event->axisabs );
+     if (event->flags & DIEF_AXISREL)
+          D_DEBUG_AT( Core_InputEvt, "  => AXISREL    %d by %d\n",  event->axis, event->axisrel );
+     if (event->flags & DIEF_KEYCODE)
+          D_DEBUG_AT( Core_InputEvt, "  => KEYCODE    %d\n",        event->key_code );
+     if (event->flags & DIEF_KEYID)
+          D_DEBUG_AT( Core_InputEvt, "  => KEYID      0x%04x\n",    event->key_id );
+     if (event->flags & DIEF_KEYSYMBOL)
+          D_DEBUG_AT( Core_InputEvt, "  => KEYSYMBOL  0x%04x\n",    event->key_symbol );
+     if (event->flags & DIEF_MODIFIERS)
+          D_DEBUG_AT( Core_InputEvt, "  => MODIFIERS  0x%04x\n",    event->modifiers );
+     if (event->flags & DIEF_LOCKS)
+          D_DEBUG_AT( Core_InputEvt, "  => LOCKS      0x%04x\n",    event->locks );
+     if (event->flags & DIEF_BUTTONS)
+          D_DEBUG_AT( Core_InputEvt, "  => BUTTONS    0x%04x\n",    event->buttons );
+     if (event->flags & DIEF_GLOBAL)
+          D_DEBUG_AT( Core_InputEvt, "  => GLOBAL\n" );
+#endif
+
+     if (core_input_filter( device, event ))
+          D_DEBUG_AT( Core_InputEvt, "  ****>> FILTERED\n" );
+     else
+          fusion_reactor_dispatch( device->shared->reactor, event, true, dfb_input_globals );
+}
+
+DFBInputDeviceID
+dfb_input_device_id( const CoreInputDevice *device )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     return device->shared->id;
+}
+
+CoreInputDevice *
+dfb_input_device_at( DFBInputDeviceID id )
+{
+     int i;
+
+     D_ASSERT( core_input != NULL );
+
+     for (i=0; i<core_local->num; i++) {
+          CoreInputDevice *device = core_local->devices[i];
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+
+          if (device->shared->id == id)
+               return device;
+     }
+
+     return NULL;
+}
+
+void
+dfb_input_device_description( const CoreInputDevice     *device,
+                              DFBInputDeviceDescription *desc )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     *desc = device->shared->device_info.desc;
+}
+
+DFBResult
+dfb_input_device_get_keymap_entry( CoreInputDevice           *device,
+                                   int                        keycode,
+                                   DFBInputDeviceKeymapEntry *entry )
+{
+     DFBInputDeviceKeymapEntry *keymap_entry;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( entry != NULL );
+
+     keymap_entry = get_keymap_entry( device, keycode );
+     if (!keymap_entry)
+          return DFB_FAILURE;
+
+     *entry = *keymap_entry;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_input_device_set_keymap_entry( CoreInputDevice           *device,
+                                   int                        keycode,
+                                   DFBInputDeviceKeymapEntry *entry )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( entry != NULL );
+
+     return set_keymap_entry( device, keycode, entry );
+}
+
+DFBResult
+dfb_input_device_load_keymap   ( CoreInputDevice           *device,
+                                 char                      *filename )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( filename != NULL );
+
+     return load_keymap( device, filename );
+}
+
+DFBResult
+dfb_input_device_reload_keymap( CoreInputDevice *device )
+{
+     int                ret;
+     InputDeviceShared *shared;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     shared = device->shared;
+
+     D_ASSERT( shared != NULL );
+
+     D_INFO( "DirectFB/Input: Reloading keymap for '%s' [0x%02x]...\n",
+             shared->device_info.desc.name, shared->id );
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, CIDC_RELOAD_KEYMAP, NULL, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+DFBResult
+dfb_input_device_set_sensitivity( CoreInputDevice *device,
+                                  int              sensitivity )
+{
+     int                ret;
+     InputDeviceShared *shared;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     shared = device->shared;
+     D_ASSERT( shared != NULL );
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, CIDC_SET_SENSITIVITY, (void*)(long)sensitivity, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+DFBResult
+dfb_input_rescan_devices( CoreDFB *core )
+{
+     int ret;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core_input != NULL );
+
+     if (fusion_call_execute( &core_input->call, FCEF_NODIRECT, CICC_RESCAN_DEVICES, NULL, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+DFBResult
+dfb_input_device_disconnected( CoreInputDevice *device )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( device->shared != NULL );
+
+     D_ASSUME( !(device->shared->state.flags & DISTATE_DISCONNECTED) );
+
+     device->shared->state.flags |= DISTATE_DISCONNECTED;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_input_device_reconnected( CoreInputDevice *device )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( device->shared != NULL );
+
+     D_ASSUME( device->shared->state.flags & DISTATE_DISCONNECTED );
+
+     device->shared->state.flags &= ~DISTATE_DISCONNECTED;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_input_device_get_state( const CoreInputDevice *device,
+                            DFBInputDeviceState   *ret_state )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( device->shared != NULL );
+
+     *ret_state = device->shared->state;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_input_core_attach( CoreDFB      *core,
+                       ReactionFunc  func,
+                       void         *ctx,
+                       Reaction     *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core_input != NULL );
+
+     return fusion_reactor_attach( core_input->reactor, func, ctx, reaction );
+}
+
+DFBResult
+dfb_input_core_detach( CoreDFB      *core,
+                       Reaction     *reaction )
+{
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core_input != NULL );
+
+     return fusion_reactor_detach( core_input->reactor, reaction );
+}
+
+/** internal **/
+
+static void
+input_add_device( CoreInputDevice *device )
+{
+     CoreInputCoreNotification notification;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     if (core_input->num == MAX_INPUTDEVICES) {
+          D_ERROR( "DirectFB/Input: Maximum number of devices reached!\n" );
+          return;
+     }
+
+     core_local->devices[ core_local->num++ ] = device;
+
+     core_input->devices[ core_input->num++ ] = device->shared;
+
+     notification.flags     = CICNF_NEW_DEVICE;
+     notification.device_id = device->shared->id;
+
+     fusion_reactor_dispatch( core_input->reactor, ¬ification, true, NULL );
+}
+
+static void
+allocate_device_keymap( CoreDFB *core, CoreInputDevice *device )
+{
+     int                        i;
+     DFBInputDeviceKeymapEntry *entries;
+     FusionSHMPoolShared       *pool        = dfb_core_shmpool( core );
+     InputDeviceShared         *shared      = device->shared;
+     DFBInputDeviceDescription *desc        = &shared->device_info.desc;
+     int                        num_entries = desc->max_keycode -
+                                              desc->min_keycode + 1;
+
+     D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, core, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+
+     entries = SHCALLOC( pool, num_entries, sizeof(DFBInputDeviceKeymapEntry) );
+     if (!entries) {
+          D_OOSHM();
+          return;
+     }
+
+     /* write -1 indicating entry is not fetched yet from driver */
+     for (i=0; i<num_entries; i++)
+          entries[i].code = -1;
+
+     shared->keymap.min_keycode = desc->min_keycode;
+     shared->keymap.max_keycode = desc->max_keycode;
+     shared->keymap.num_entries = num_entries;
+     shared->keymap.entries     = entries;
+
+#if FUSION_BUILD_MULTI
+     /* we need to fetch the whole map, otherwise a slave would try to */
+     for (i=desc->min_keycode; i<=desc->max_keycode; i++)
+          get_keymap_entry( device, i );
+#endif
+}
+
+static int
+make_id( DFBInputDeviceID prefered )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Input, "%s( 0x%02x )\n", __FUNCTION__, prefered );
+
+     D_ASSERT( core_input != NULL );
+
+     for (i=0; i<core_local->num; i++) {
+          CoreInputDevice *device = core_local->devices[i];
+
+          D_MAGIC_ASSERT( device, CoreInputDevice );
+
+          if (device->shared->id == prefered)
+               return make_id( (prefered < DIDID_ANY) ? DIDID_ANY : (prefered + 1) );
+     }
+
+     return prefered;
+}
+
+static DFBResult
+reload_keymap( CoreInputDevice *device )
+{
+     int                i;
+     InputDeviceShared *shared;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     shared = device->shared;
+
+     D_ASSERT( shared != NULL );
+
+     if (shared->device_info.desc.min_keycode < 0 ||
+         shared->device_info.desc.max_keycode < 0)
+          return DFB_UNSUPPORTED;
+
+     /* write -1 indicating entry is not fetched yet from driver */
+     for (i=0; i<shared->keymap.num_entries; i++)
+          shared->keymap.entries[i].code = -1;
+
+     /* fetch the whole map */
+     for (i=shared->keymap.min_keycode; i<=shared->keymap.max_keycode; i++)
+          get_keymap_entry( device, i );
+
+     D_INFO( "DirectFB/Input: Reloaded keymap for '%s' [0x%02x]\n",
+             shared->device_info.desc.name, shared->id );
+
+     return DFB_OK;
+}
+
+static DFBResult
+set_sensitivity( CoreInputDevice *device,
+                 int              sensitivity )
+{
+     InputDriver *driver;
+
+     D_DEBUG_AT( Core_Input, "%s( %p, %d )\n", __FUNCTION__, device, sensitivity );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     driver = device->driver;
+     D_ASSERT( driver != NULL );
+
+     if (!driver->funcs->SetSensitivity)
+          return DFB_UNSUPPORTED;
+
+     return driver->funcs->SetSensitivity( device, device->driver_data, sensitivity );
+}
+
+static FusionCallHandlerResult
+input_device_call_handler( int           caller,   /* fusion id of the caller */
+                           int           call_arg, /* optional call parameter */
+                           void         *call_ptr, /* optional call parameter */
+                           void         *ctx,      /* optional handler context */
+                           unsigned int  serial,
+                           int          *ret_val )
+{
+     CoreInputDeviceCommand  command = call_arg;
+     CoreInputDevice        *device  = ctx;
+
+     D_DEBUG_AT( Core_Input, "%s( %d, %d, %p, %p )\n", __FUNCTION__, caller, call_arg, call_ptr, ctx );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     switch (command) {
+          case CIDC_RELOAD_KEYMAP:
+               *ret_val = reload_keymap( device );
+               break;
+
+          case CIDC_SET_SENSITIVITY:
+               *ret_val = set_sensitivity( device, (long) call_ptr );
+               break;
+
+          default:
+               D_BUG( "unknown Core Input Device Command '%d'", command );
+               *ret_val = DFB_BUG;
+     }
+
+     return FCHR_RETURN;
+}
+
+static DFBResult
+init_axes( CoreInputDevice *device )
+{
+     int                     i, num;
+     DFBResult               ret;
+     InputDeviceShared      *shared;
+     const InputDriverFuncs *funcs;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device );
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+     D_ASSERT( device->driver != NULL );
+
+     funcs = device->driver->funcs;
+     D_ASSERT( funcs != NULL );
+
+     shared = device->shared;
+     D_ASSERT( shared != NULL );
+
+     if (shared->device_info.desc.max_axis < 0)
+          return DFB_OK;
+
+     num = shared->device_info.desc.max_axis + 1;
+
+     shared->axis_info = SHCALLOC( dfb_core_shmpool(device->core), num, sizeof(DFBInputDeviceAxisInfo) );
+     if (!shared->axis_info)
+          return D_OOSHM();
+
+     shared->axis_num = num;
+
+     if (funcs->GetAxisInfo) {
+          for (i=0; i<num; i++) {
+               ret = funcs->GetAxisInfo( device, device->driver_data, i, &shared->axis_info[i] );
+               if (ret)
+                    D_DERROR( ret, "Core/Input: GetAxisInfo() failed for '%s' [%d] on axis %d!\n",
+                              shared->device_info.desc.name, shared->id, i );
+          }
+     }
+
+     return DFB_OK;
+}
+
+static void
+init_drivers( CoreDFB *core )
+{
+     DirectLink          *next;
+     DirectModuleEntry   *module;
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core_input != NULL );
+
+     direct_list_foreach_safe (module, next, dfb_input_modules.entries) {
+          InputDriver            *driver;
+          const InputDriverFuncs *funcs;
+
+          funcs = direct_module_ref( module );
+          if (!funcs)
+               continue;
+
+          driver = D_CALLOC( 1, sizeof(InputDriver) );
+          if (!driver) {
+               D_OOM();
+               direct_module_unref( module );
+               continue;
+          }
+
+          D_ASSERT( funcs->GetDriverInfo != NULL );
+
+          funcs->GetDriverInfo( &driver->info );
+
+          driver->module = module;
+          driver->funcs  = funcs;
+
+          direct_list_prepend( &core_local->drivers, &driver->link );
+          }
+}
+
+static DFBResult
+rescan_devices( CoreDFB *core )
+{
+     InputDriver         *driver;
+     FusionSHMPoolShared *pool = dfb_core_shmpool( core );
+
+     D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core );
+
+     D_ASSERT( core_input != NULL );
+
+     direct_list_foreach (driver, core_local->drivers) {
+          int                     i, num;
+          const InputDriverFuncs *funcs = driver->funcs;
+
+          D_DEBUG_AT( Core_Input, "  -> probing '%s'...\n", driver->info.name );
+
+          num = funcs->GetAvailable();
+
+          D_DEBUG_AT( Core_Input, "  -> %d available device(s) provided by '%s'.\n", num, driver->info.name );
+
+
+          for (i=driver->nr_devices; i<num; i++) {
+               char               buf[128];
+               CoreInputDevice   *device;
+               InputDeviceInfo    device_info;
+               InputDeviceShared *shared;
+               void              *driver_data;
+
+               device = D_CALLOC( 1, sizeof(CoreInputDevice) );
+               if (!device) {
+                    D_OOM();
+                    continue;
+               }
+
+               shared = SHCALLOC( pool, 1, sizeof(InputDeviceShared) );
+               if (!shared) {
+                    D_OOSHM();
+                    D_FREE( device );
+                    continue;
+               }
+
+               device->core = core;
+
+               memset( &device_info, 0, sizeof(InputDeviceInfo) );
+
+               device_info.desc.min_keycode = -1;
+               device_info.desc.max_keycode = -1;
+
+               D_MAGIC_SET( device, CoreInputDevice );
+
+               if (funcs->OpenDevice( device, i, &device_info, &driver_data )) {
+                    SHFREE( pool, shared );
+                    D_MAGIC_CLEAR( device );
+                    D_FREE( device );
+                    continue;
+               }
+
+               D_DEBUG_AT( Core_Input, "  -> opened '%s' (%d) %d.%d (%s)\n",
+                           device_info.desc.name, i + 1, driver->info.version.major,
+                           driver->info.version.minor, driver->info.vendor );
+
+               if (num > 1)
+                    snprintf( buf, sizeof(buf), "%s (%d)", device_info.desc.name, i+1 );
+               else
+                    snprintf( buf, sizeof(buf), "%s", device_info.desc.name );
+
+               /* init skirmish */
+               fusion_skirmish_init( &shared->lock, buf, dfb_core_world(core) );
+
+               /* create reactor */
+               shared->reactor = fusion_reactor_new( sizeof(DFBInputEvent), buf, dfb_core_world(core) );
+
+               fusion_reactor_set_lock( shared->reactor, &shared->lock );
+
+               /* init call */
+               fusion_call_init( &shared->call, input_device_call_handler, device, dfb_core_world(core) );
+
+               /* initialize shared data */
+               shared->id          = make_id(device_info.prefered_id);
+               shared->num         = i;
+               shared->device_info = device_info;
+               shared->last_key    = DIKI_UNKNOWN;
+               shared->first_press = true;
+
+               /* initialize local data */
+               device->shared      = shared;
+               device->driver      = driver;
+               device->driver_data = driver_data;
+
+               D_INFO( "DirectFB/Input: %s %d.%d (%s)\n",
+                       buf, driver->info.version.major,
+                       driver->info.version.minor, driver->info.vendor );
+
+               if (device_info.desc.min_keycode > device_info.desc.max_keycode) {
+                    D_BUG("min_keycode > max_keycode");
+                    device_info.desc.min_keycode = -1;
+                    device_info.desc.max_keycode = -1;
+               }
+               else if (device_info.desc.min_keycode >= 0 &&
+                        device_info.desc.max_keycode >= 0)
+                    allocate_device_keymap( core, device );
+
+               init_axes( device );
+
+               /* add it to the list */
+               input_add_device( device );
+          }
+
+          driver->nr_devices = num;
+     }
+
+     return DFB_OK;
+}
+
+static DFBInputDeviceKeymapEntry *
+get_keymap_entry( CoreInputDevice *device,
+                  int              code )
+{
+     InputDeviceKeymap         *map;
+     DFBInputDeviceKeymapEntry *entry;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     map = &device->shared->keymap;
+
+     /* safety check */
+     if (code < map->min_keycode || code > map->max_keycode)
+          return NULL;
+
+     /* point to right array index */
+     entry = &map->entries[code - map->min_keycode];
+
+     /* need to initialize? */
+     if (entry->code != code) {
+          DFBResult    ret;
+          InputDriver *driver = device->driver;
+
+          if (!driver) {
+               D_BUG("seem to be a slave with an empty keymap");
+               return NULL;
+          }
+
+          /* write keycode to entry */
+          entry->code = code;
+
+          /* fetch entry from driver */
+          ret = driver->funcs->GetKeymapEntry( device,
+                                               device->driver_data, entry );
+          if (ret)
+               return NULL;
+
+          /* drivers may leave this blank */
+          if (entry->identifier == DIKI_UNKNOWN)
+               entry->identifier = symbol_to_id( entry->symbols[DIKSI_BASE] );
+
+          if (entry->symbols[DIKSI_BASE_SHIFT] == DIKS_NULL)
+               entry->symbols[DIKSI_BASE_SHIFT] = entry->symbols[DIKSI_BASE];
+
+          if (entry->symbols[DIKSI_ALT] == DIKS_NULL)
+               entry->symbols[DIKSI_ALT] = entry->symbols[DIKSI_BASE];
+
+          if (entry->symbols[DIKSI_ALT_SHIFT] == DIKS_NULL)
+               entry->symbols[DIKSI_ALT_SHIFT] = entry->symbols[DIKSI_ALT];
+     }
+
+     return entry;
+}
+
+/* replace a single keymap entry with the code-entry pair */
+static DFBResult
+set_keymap_entry( CoreInputDevice           *device,
+                  int                        code,
+                  DFBInputDeviceKeymapEntry *entry )
+{
+     InputDeviceKeymap         *map;
+
+     D_ASSERT( device->shared != NULL );
+     D_ASSERT( device->shared->keymap.entries != NULL );
+
+     map = &device->shared->keymap;
+
+     /* sanity check */
+     if (code < map->min_keycode || code > map->max_keycode)
+          return DFB_FAILURE;
+
+     /* copy the entry to the map */
+     map->entries[code - map->min_keycode] = *entry;
+     
+     return DFB_OK;
+}
+
+/* replace the complete current keymap with a keymap from a file.
+ * the minimum-maximum keycodes of the driver are to be respected. 
+ */
+static DFBResult
+load_keymap( CoreInputDevice           *device,
+             char                      *filename )
+{
+     DFBResult                  ret       = DFB_OK;
+     InputDeviceKeymap         *map       = 0;
+     FILE                      *file      = 0;
+     DFBInputDeviceLockState    lockstate = 0;
+
+     D_ASSERT( device->shared != NULL );
+     D_ASSERT( device->shared->keymap.entries != NULL );
+
+     map = &device->shared->keymap;
+
+     /* open the file */
+     file = fopen( filename, "r" );
+     if( !file )
+     {
+          return errno2result( errno );
+     }
+
+     /* read the file, line by line, and consume the mentioned scancodes */
+     while(1)
+     {
+          int   i;
+          int   dummy;
+          char  buffer[201];
+          int   keycode;
+          char  diki[201];
+          char  diks[4][201];
+          char *b;
+          
+          DFBInputDeviceKeymapEntry entry = { .code = 0 };
+          
+          b = fgets( buffer, 200, file );
+          if( !b ) {
+               if( feof(file) ) {
+                    fclose(file);
+                    return DFB_OK;
+               }
+               fclose(file);
+               return errno2result(errno);
+          }
+
+          /* comment or empty line */
+          if( buffer[0]=='#' || strcmp(buffer,"\n")==0 )
+               continue;
+
+          /* check for lock state change */
+          if( !strncmp(buffer,"capslock:",9) ) { lockstate |=  DILS_CAPS; continue; }
+          if( !strncmp(buffer,":capslock",9) ) { lockstate &= ~DILS_CAPS; continue; }
+          if( !strncmp(buffer,"numlock:",8)  ) { lockstate |=  DILS_NUM;  continue; }
+          if( !strncmp(buffer,":numlock",8)  ) { lockstate &= ~DILS_NUM;  continue; }
+
+          i = sscanf( buffer, " keycode %i = %s = %s %s %s %s %i\n",
+                    &keycode, diki, diks[0], diks[1], diks[2], diks[3], &dummy );
+
+          if( i < 3 || i > 6 ) {
+               /* we want 1 to 4 key symbols */
+               D_INFO( "DirectFB/Input: skipped erroneous input line %s\n", buffer );
+               continue;
+          }
+
+          if( keycode > map->max_keycode || keycode < map->min_keycode ) {
+               D_INFO( "DirectFB/Input: skipped keycode %d out of range\n", keycode );
+               continue;
+          }
+
+          entry.code       = keycode;
+          entry.locks      = lockstate;
+          entry.identifier = lookup_keyidentifier( diki );
+
+          switch( i ) {
+               case 6:  entry.symbols[3] = lookup_keysymbol( diks[3] );
+               case 5:  entry.symbols[2] = lookup_keysymbol( diks[2] );
+               case 4:  entry.symbols[1] = lookup_keysymbol( diks[1] );
+               case 3:  entry.symbols[0] = lookup_keysymbol( diks[0] );
+
+                    /* fall through */
+          }
+
+          switch( i ) {
+               case 3:  entry.symbols[1] = entry.symbols[0];
+               case 4:  entry.symbols[2] = entry.symbols[0];
+               case 5:  entry.symbols[3] = entry.symbols[1];
+
+               /* fall through */
+          }
+
+          ret = set_keymap_entry( device, keycode, &entry );
+          if( ret )
+               return ret;
+     }
+}
+
+static DFBInputDeviceKeySymbol lookup_keysymbol( char *symbolname )
+{
+     int i;
+
+     /* we want uppercase */  
+     for( i=0; i<strlen(symbolname); i++ )
+          if( symbolname[i] >= 'a' && symbolname[i] <= 'z' )
+               symbolname[i] = symbolname[i] - 'a' + 'A';
+
+     for( i=0; i < sizeof (KeySymbolNames) / sizeof (KeySymbolNames[0]); i++ ) {
+          if( strcmp( symbolname, KeySymbolNames[i].name ) == 0 )
+               return KeySymbolNames[i].symbol;
+     }
+     
+     /* not found, maybe starting with 0x for raw conversion.
+      * We are already at uppercase.
+      */
+     if( symbolname[0]=='0' && symbolname[1]=='X' ) {
+          int code=0;
+          symbolname+=2;
+          while(*symbolname) {
+               if( *symbolname >= '0' && *symbolname <= '9' ) {
+                    code = code*16 + *symbolname - '0';
+               } else if( *symbolname >= 'A' && *symbolname <= 'F' ) {
+                    code = code*16 + *symbolname - 'A' + 10;
+               } else {
+                    /* invalid character */
+                    return DIKS_NULL;
+               }
+               symbolname++;
+          }
+          return code;
+     }
+     
+     return DIKS_NULL;
+}
+
+static DFBInputDeviceKeyIdentifier lookup_keyidentifier( char *identifiername )
+{
+     int i;
+
+     /* we want uppercase */  
+     for( i=0; i<strlen(identifiername); i++ )
+          if( identifiername[i] >= 'a' && identifiername[i] <= 'z' )
+               identifiername[i] = identifiername[i] - 'a' + 'A';
+
+     for( i=0; i < sizeof (KeyIdentifierNames) / sizeof (KeyIdentifierNames[0]); i++ ) {
+          if( strcmp( identifiername, KeyIdentifierNames[i].name ) == 0 )
+               return KeyIdentifierNames[i].identifier;
+     }
+     
+     return DIKI_UNKNOWN;
+}
+
+static bool
+lookup_from_table( CoreInputDevice    *device,
+                   DFBInputEvent      *event,
+                   DFBInputEventFlags  lookup )
+{
+     DFBInputDeviceKeymapEntry *entry;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+     D_ASSERT( event != NULL );
+
+     /* fetch the entry from the keymap, possibly calling the driver */
+     entry = get_keymap_entry( device, event->key_code );
+     if (!entry)
+          return false;
+
+     /* lookup identifier */
+     if (lookup & DIEF_KEYID)
+          event->key_id = entry->identifier;
+
+     /* lookup symbol */
+     if (lookup & DIEF_KEYSYMBOL) {
+          DFBInputDeviceKeymapSymbolIndex index =
+               (event->modifiers & DIMM_ALTGR) ? DIKSI_ALT : DIKSI_BASE;
+
+          if (!(event->modifiers & DIMM_SHIFT) ^ !(entry->locks & event->locks))
+               index++;
+
+          /* don't modify modifiers */
+          if (DFB_KEY_TYPE( entry->symbols[DIKSI_BASE] ) == DIKT_MODIFIER)
+               event->key_symbol = entry->symbols[DIKSI_BASE];
+          else
+               event->key_symbol = entry->symbols[index];
+     }
+
+     return true;
+}
+
+static int
+find_key_code_by_id( CoreInputDevice             *device,
+                     DFBInputDeviceKeyIdentifier  id )
+{
+     int                i;
+     InputDeviceKeymap *map;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     map = &device->shared->keymap;
+
+     for (i=0; i<map->num_entries; i++) {
+          DFBInputDeviceKeymapEntry *entry = &map->entries[i];
+
+          if (entry->identifier == id)
+               return entry->code;
+     }
+
+     return -1;
+}
+
+static int
+find_key_code_by_symbol( CoreInputDevice         *device,
+                         DFBInputDeviceKeySymbol  symbol )
+{
+     int                i;
+     InputDeviceKeymap *map;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     D_ASSERT( core_input != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( device->shared != NULL );
+
+     map = &device->shared->keymap;
+
+     for (i=0; i<map->num_entries; i++) {
+          int                        n;
+          DFBInputDeviceKeymapEntry *entry = &map->entries[i];
+
+          for (n=0; n<=DIKSI_LAST; n++)
+               if (entry->symbols[n] == symbol)
+                    return entry->code;
+     }
+
+     return -1;
+}
+
+#define FIXUP_KEY_FIELDS     (DIEF_MODIFIERS | DIEF_LOCKS | \
+                              DIEF_KEYCODE | DIEF_KEYID | DIEF_KEYSYMBOL)
+
+/*
+ * Fill partially missing values for key_code, key_id and key_symbol by
+ * translating those that are set. Fix modifiers/locks before if not set.
+ *
+ *
+ * There are five valid constellations that give reasonable values.
+ * (not counting the constellation where everything is set)
+ *
+ * Device has no translation table
+ *   1. key_id is set, key_symbol not
+ *      -> key_code defaults to -1, key_symbol from key_id (up-translation)
+ *   2. key_symbol is set, key_id not
+ *      -> key_code defaults to -1, key_id from key_symbol (down-translation)
+ *
+ * Device has a translation table
+ *   3. key_code is set
+ *      -> look up key_id and/or key_symbol (key_code being the index)
+ *   4. key_id is set
+ *      -> look up key_code and possibly key_symbol (key_id being searched for)
+ *   5. key_symbol is set
+ *      -> look up key_code and key_id (key_symbol being searched for)
+ *
+ * Fields remaining will be set to the default, e.g. key_code to -1.
+ */
+static void
+fixup_key_event( CoreInputDevice *device, DFBInputEvent *event )
+{
+     int                 i;
+     DFBInputEventFlags  valid   = event->flags & FIXUP_KEY_FIELDS;
+     DFBInputEventFlags  missing = valid ^ FIXUP_KEY_FIELDS;
+     InputDeviceShared  *shared  = device->shared;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     /* Add missing flags */
+     event->flags |= missing;
+
+     /*
+      * Use cached values for modifiers/locks if they are missing.
+      */
+     if (missing & DIEF_MODIFIERS)
+          event->modifiers = shared->modifiers_l | shared->modifiers_r;
+
+     if (missing & DIEF_LOCKS)
+          event->locks = shared->locks;
+
+     /*
+      * With translation table
+      */
+     if (device->shared->keymap.num_entries) {
+          if (valid & DIEF_KEYCODE) {
+               lookup_from_table( device, event, missing );
+
+               missing &= ~(DIEF_KEYID | DIEF_KEYSYMBOL);
+          }
+          else if (valid & DIEF_KEYID) {
+               event->key_code = find_key_code_by_id( device, event->key_id );
+
+               if (event->key_code != -1) {
+                    lookup_from_table( device, event, missing );
+
+                    missing &= ~(DIEF_KEYCODE | DIEF_KEYSYMBOL);
+               }
+               else if (missing & DIEF_KEYSYMBOL) {
+                    event->key_symbol = id_to_symbol( event->key_id,
+                                                      event->modifiers,
+                                                      event->locks );
+                    missing &= ~DIEF_KEYSYMBOL;
+               }
+          }
+          else if (valid & DIEF_KEYSYMBOL) {
+               event->key_code = find_key_code_by_symbol( device,
+                                                          event->key_symbol );
+
+               if (event->key_code != -1) {
+                    lookup_from_table( device, event, missing );
+
+                    missing &= ~(DIEF_KEYCODE | DIEF_KEYID);
+               }
+               else {
+                    event->key_symbol = symbol_to_id( event->key_symbol );
+                    missing &= ~DIEF_KEYSYMBOL;
+               }
+          }
+     }
+     else {
+          /*
+           * Without translation table
+           */
+          if (valid & DIEF_KEYID) {
+               if (missing & DIEF_KEYSYMBOL) {
+                    event->key_symbol = id_to_symbol( event->key_id,
+                                                      event->modifiers,
+                                                      event->locks );
+                    missing &= ~DIEF_KEYSYMBOL;
+               }
+          }
+          else if (valid & DIEF_KEYSYMBOL) {
+               event->key_id = symbol_to_id( event->key_symbol );
+               missing &= ~DIEF_KEYID;
+          }
+     }
+
+     /*
+      * Clear remaining fields.
+      */
+     if (missing & DIEF_KEYCODE)
+          event->key_code = -1;
+
+     if (missing & DIEF_KEYID)
+          event->key_id = DIKI_UNKNOWN;
+
+     if (missing & DIEF_KEYSYMBOL)
+          event->key_symbol = DIKS_NULL;
+
+     /*
+      * Update cached values for modifiers.
+      */
+     if (DFB_KEY_TYPE(event->key_symbol) == DIKT_MODIFIER) {
+          if (event->type == DIET_KEYPRESS) {
+               switch (event->key_id) {
+                    case DIKI_SHIFT_L:
+                         shared->modifiers_l |= DIMM_SHIFT;
+                         break;
+                    case DIKI_SHIFT_R:
+                         shared->modifiers_r |= DIMM_SHIFT;
+                         break;
+                    case DIKI_CONTROL_L:
+                         shared->modifiers_l |= DIMM_CONTROL;
+                         break;
+                    case DIKI_CONTROL_R:
+                         shared->modifiers_r |= DIMM_CONTROL;
+                         break;
+                    case DIKI_ALT_L:
+                         shared->modifiers_l |= DIMM_ALT;
+                         break;
+                    case DIKI_ALT_R:
+                         shared->modifiers_r |= (event->key_symbol == DIKS_ALTGR) ? DIMM_ALTGR : DIMM_ALT;
+                         break;
+                    case DIKI_META_L:
+                         shared->modifiers_l |= DIMM_META;
+                         break;
+                    case DIKI_META_R:
+                         shared->modifiers_r |= DIMM_META;
+                         break;
+                    case DIKI_SUPER_L:
+                         shared->modifiers_l |= DIMM_SUPER;
+                         break;
+                    case DIKI_SUPER_R:
+                         shared->modifiers_r |= DIMM_SUPER;
+                         break;
+                    case DIKI_HYPER_L:
+                         shared->modifiers_l |= DIMM_HYPER;
+                         break;
+                    case DIKI_HYPER_R:
+                         shared->modifiers_r |= DIMM_HYPER;
+                         break;
+                    default:
+                         ;
+               }
+          }
+          else {
+               switch (event->key_id) {
+                    case DIKI_SHIFT_L:
+                         shared->modifiers_l &= ~DIMM_SHIFT;
+                         break;
+                    case DIKI_SHIFT_R:
+                         shared->modifiers_r &= ~DIMM_SHIFT;
+                         break;
+                    case DIKI_CONTROL_L:
+                         shared->modifiers_l &= ~DIMM_CONTROL;
+                         break;
+                    case DIKI_CONTROL_R:
+                         shared->modifiers_r &= ~DIMM_CONTROL;
+                         break;
+                    case DIKI_ALT_L:
+                         shared->modifiers_l &= ~DIMM_ALT;
+                         break;
+                    case DIKI_ALT_R:
+                         shared->modifiers_r &= (event->key_symbol == DIKS_ALTGR) ? ~DIMM_ALTGR : ~DIMM_ALT;
+                         break;
+                    case DIKI_META_L:
+                         shared->modifiers_l &= ~DIMM_META;
+                         break;
+                    case DIKI_META_R:
+                         shared->modifiers_r &= ~DIMM_META;
+                         break;
+                    case DIKI_SUPER_L:
+                         shared->modifiers_l &= ~DIMM_SUPER;
+                         break;
+                    case DIKI_SUPER_R:
+                         shared->modifiers_r &= ~DIMM_SUPER;
+                         break;
+                    case DIKI_HYPER_L:
+                         shared->modifiers_l &= ~DIMM_HYPER;
+                         break;
+                    case DIKI_HYPER_R:
+                         shared->modifiers_r &= ~DIMM_HYPER;
+                         break;
+                    default:
+                         ;
+               }
+          }
+
+          /* write back to event */
+          if (missing & DIEF_MODIFIERS)
+               event->modifiers = shared->modifiers_l | shared->modifiers_r;
+     }
+
+     /*
+      * Update cached values for locks.
+      */
+     if (event->type == DIET_KEYPRESS) {
+
+          /* When we receive a new key press, toggle lock flags */
+          if (shared->first_press || shared->last_key != event->key_id) {
+              switch (event->key_id) {
+                   case DIKI_CAPS_LOCK:
+                        shared->locks ^= DILS_CAPS;
+                        break;
+                   case DIKI_NUM_LOCK:
+                        shared->locks ^= DILS_NUM;
+                        break;
+                   case DIKI_SCROLL_LOCK:
+                        shared->locks ^= DILS_SCROLL;
+                        break;
+                   default:
+                        ;
+              }
+          }
+
+          /* write back to event */
+          if (missing & DIEF_LOCKS)
+               event->locks = shared->locks;
+
+          /* store last pressed key */
+          shared->last_key = event->key_id;
+          shared->first_press = false;
+     }
+     else if (event->type == DIET_KEYRELEASE) {
+          
+          shared->first_press = true;
+     }
+
+     /* Handle dead keys. */
+     if (DFB_KEY_TYPE(shared->last_symbol) == DIKT_DEAD) {
+          for (i=0; i<D_ARRAY_SIZE(deadkey_maps); i++) {
+               const DeadKeyMap *map = &deadkey_maps[i];
+
+               if (map->deadkey == shared->last_symbol) {
+                    for (i=0; map->combos[i].target; i++) {
+                         if (map->combos[i].target == event->key_symbol) {
+                              event->key_symbol = map->combos[i].result;
+                              break;
+                         }
+                    }
+                    break;
+               }
+          }
+
+          if (event->type == DIET_KEYRELEASE &&
+              DFB_KEY_TYPE(event->key_symbol) != DIKT_MODIFIER)
+               shared->last_symbol = event->key_symbol;
+     }
+     else
+          shared->last_symbol = event->key_symbol;
+}
+
+static void
+fixup_mouse_event( CoreInputDevice *device, DFBInputEvent *event )
+{
+     InputDeviceShared *shared = device->shared;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     if (event->flags & DIEF_BUTTONS) {
+          shared->buttons = event->buttons;
+     }
+     else {
+          switch (event->type) {
+               case DIET_BUTTONPRESS:
+                    shared->buttons |= (1 << event->button);
+                    break;
+               case DIET_BUTTONRELEASE:
+                    shared->buttons &= ~(1 << event->button);
+                    break;
+               default:
+                    ;
+          }
+
+          /* Add missing flag */
+          event->flags |= DIEF_BUTTONS;
+
+          event->buttons = shared->buttons;
+     }
+
+     switch (event->type) {
+          case DIET_AXISMOTION:
+               if ((event->flags & DIEF_AXISABS) && event->axis >= 0 && event->axis < shared->axis_num) {
+                    if (!(event->flags & DIEF_MIN) && (shared->axis_info[event->axis].flags & DIAIF_ABS_MIN)) {
+                         event->min = shared->axis_info[event->axis].abs_min;
+
+                         event->flags |= DIEF_MIN;
+                    }
+                         
+                    if (!(event->flags & DIEF_MAX) && (shared->axis_info[event->axis].flags & DIAIF_ABS_MAX)) {
+                         event->max = shared->axis_info[event->axis].abs_max;
+
+                         event->flags |= DIEF_MAX;
+                    }
+               }
+               break;
+
+          default:
+               break;
+     }
+}
+
+static DFBInputDeviceKeyIdentifier
+symbol_to_id( DFBInputDeviceKeySymbol symbol )
+{
+     if (symbol >= 'a' && symbol <= 'z')
+          return DIKI_A + symbol - 'a';
+
+     if (symbol >= 'A' && symbol <= 'Z')
+          return DIKI_A + symbol - 'A';
+
+     if (symbol >= '0' && symbol <= '9')
+          return DIKI_0 + symbol - '0';
+
+     if (symbol >= DIKS_F1 && symbol <= DIKS_F12)
+          return DIKI_F1 + symbol - DIKS_F1;
+
+     switch (symbol) {
+          case DIKS_ESCAPE:
+               return DIKI_ESCAPE;
+
+          case DIKS_CURSOR_LEFT:
+               return DIKI_LEFT;
+
+          case DIKS_CURSOR_RIGHT:
+               return DIKI_RIGHT;
+
+          case DIKS_CURSOR_UP:
+               return DIKI_UP;
+
+          case DIKS_CURSOR_DOWN:
+               return DIKI_DOWN;
+
+          case DIKS_ALTGR:
+               return DIKI_ALT_R;
+
+          case DIKS_CONTROL:
+               return DIKI_CONTROL_L;
+
+          case DIKS_SHIFT:
+               return DIKI_SHIFT_L;
+
+          case DIKS_ALT:
+               return DIKI_ALT_L;
+
+          case DIKS_META:
+               return DIKI_META_L;
+
+          case DIKS_SUPER:
+               return DIKI_SUPER_L;
+
+          case DIKS_HYPER:
+               return DIKI_HYPER_L;
+
+          case DIKS_TAB:
+               return DIKI_TAB;
+
+          case DIKS_ENTER:
+               return DIKI_ENTER;
+
+          case DIKS_SPACE:
+               return DIKI_SPACE;
+
+          case DIKS_BACKSPACE:
+               return DIKI_BACKSPACE;
+
+          case DIKS_INSERT:
+               return DIKI_INSERT;
+
+          case DIKS_DELETE:
+               return DIKI_DELETE;
+
+          case DIKS_HOME:
+               return DIKI_HOME;
+
+          case DIKS_END:
+               return DIKI_END;
+
+          case DIKS_PAGE_UP:
+               return DIKI_PAGE_UP;
+
+          case DIKS_PAGE_DOWN:
+               return DIKI_PAGE_DOWN;
+
+          case DIKS_CAPS_LOCK:
+               return DIKI_CAPS_LOCK;
+
+          case DIKS_NUM_LOCK:
+               return DIKI_NUM_LOCK;
+
+          case DIKS_SCROLL_LOCK:
+               return DIKI_SCROLL_LOCK;
+
+          case DIKS_PRINT:
+               return DIKI_PRINT;
+
+          case DIKS_PAUSE:
+               return DIKI_PAUSE;
+
+          case DIKS_BACKSLASH:
+               return DIKI_BACKSLASH;
+
+          case DIKS_PERIOD:
+               return DIKI_PERIOD;
+
+          case DIKS_COMMA:
+               return DIKI_COMMA;
+
+          default:
+               ;
+     }
+
+     return DIKI_UNKNOWN;
+}
+
+static DFBInputDeviceKeySymbol
+id_to_symbol( DFBInputDeviceKeyIdentifier id,
+              DFBInputDeviceModifierMask  modifiers,
+              DFBInputDeviceLockState     locks )
+{
+     bool shift = !(modifiers & DIMM_SHIFT) ^ !(locks & DILS_CAPS);
+
+     if (id >= DIKI_A && id <= DIKI_Z)
+          return (shift ? DIKS_CAPITAL_A : DIKS_SMALL_A) + id - DIKI_A;
+
+     if (id >= DIKI_0 && id <= DIKI_9)
+          return DIKS_0 + id - DIKI_0;
+
+     if (id >= DIKI_KP_0 && id <= DIKI_KP_9)
+          return DIKS_0 + id - DIKI_KP_0;
+
+     if (id >= DIKI_F1 && id <= DIKI_F12)
+          return DIKS_F1 + id - DIKI_F1;
+
+     switch (id) {
+          case DIKI_ESCAPE:
+               return DIKS_ESCAPE;
+
+          case DIKI_LEFT:
+               return DIKS_CURSOR_LEFT;
+
+          case DIKI_RIGHT:
+               return DIKS_CURSOR_RIGHT;
+
+          case DIKI_UP:
+               return DIKS_CURSOR_UP;
+
+          case DIKI_DOWN:
+               return DIKS_CURSOR_DOWN;
+
+          case DIKI_CONTROL_L:
+          case DIKI_CONTROL_R:
+               return DIKS_CONTROL;
+
+          case DIKI_SHIFT_L:
+          case DIKI_SHIFT_R:
+               return DIKS_SHIFT;
+
+          case DIKI_ALT_L:
+          case DIKI_ALT_R:
+               return DIKS_ALT;
+
+          case DIKI_META_L:
+          case DIKI_META_R:
+               return DIKS_META;
+
+          case DIKI_SUPER_L:
+          case DIKI_SUPER_R:
+               return DIKS_SUPER;
+
+          case DIKI_HYPER_L:
+          case DIKI_HYPER_R:
+               return DIKS_HYPER;
+
+          case DIKI_TAB:
+               return DIKS_TAB;
+
+          case DIKI_ENTER:
+               return DIKS_ENTER;
+
+          case DIKI_SPACE:
+               return DIKS_SPACE;
+
+          case DIKI_BACKSPACE:
+               return DIKS_BACKSPACE;
+
+          case DIKI_INSERT:
+               return DIKS_INSERT;
+
+          case DIKI_DELETE:
+               return DIKS_DELETE;
+
+          case DIKI_HOME:
+               return DIKS_HOME;
+
+          case DIKI_END:
+               return DIKS_END;
+
+          case DIKI_PAGE_UP:
+               return DIKS_PAGE_UP;
+
+          case DIKI_PAGE_DOWN:
+               return DIKS_PAGE_DOWN;
+
+          case DIKI_CAPS_LOCK:
+               return DIKS_CAPS_LOCK;
+
+          case DIKI_NUM_LOCK:
+               return DIKS_NUM_LOCK;
+
+          case DIKI_SCROLL_LOCK:
+               return DIKS_SCROLL_LOCK;
+
+          case DIKI_PRINT:
+               return DIKS_PRINT;
+
+          case DIKI_PAUSE:
+               return DIKS_PAUSE;
+
+          case DIKI_KP_DIV:
+               return DIKS_SLASH;
+
+          case DIKI_KP_MULT:
+               return DIKS_ASTERISK;
+
+          case DIKI_KP_MINUS:
+               return DIKS_MINUS_SIGN;
+
+          case DIKI_KP_PLUS:
+               return DIKS_PLUS_SIGN;
+
+          case DIKI_KP_ENTER:
+               return DIKS_ENTER;
+
+          case DIKI_KP_SPACE:
+               return DIKS_SPACE;
+
+          case DIKI_KP_TAB:
+               return DIKS_TAB;
+
+          case DIKI_KP_EQUAL:
+               return DIKS_EQUALS_SIGN;
+
+          case DIKI_KP_DECIMAL:
+               return DIKS_PERIOD;
+
+          case DIKI_KP_SEPARATOR:
+               return DIKS_COMMA;
+
+          case DIKI_BACKSLASH:
+               return DIKS_BACKSLASH;
+
+          case DIKI_EQUALS_SIGN:
+               return DIKS_EQUALS_SIGN;
+
+          case DIKI_LESS_SIGN:
+               return DIKS_LESS_THAN_SIGN;
+
+          case DIKI_MINUS_SIGN:
+               return DIKS_MINUS_SIGN;
+
+          case DIKI_PERIOD:
+               return DIKS_PERIOD;
+
+          case DIKI_QUOTE_LEFT:
+          case DIKI_QUOTE_RIGHT:
+               return DIKS_QUOTATION;
+
+          case DIKI_SEMICOLON:
+               return DIKS_SEMICOLON;
+
+          case DIKI_SLASH:
+               return DIKS_SLASH;
+
+          default:
+               ;
+     }
+
+     return DIKS_NULL;
+}
+
+static void
+release_key( CoreInputDevice *device, DFBInputDeviceKeyIdentifier id )
+{
+     DFBInputEvent evt;
+
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     evt.type = DIET_KEYRELEASE;
+
+     if (DFB_KEY_TYPE(id) == DIKT_IDENTIFIER) {
+          evt.flags  = DIEF_KEYID;
+          evt.key_id = id;
+     }
+     else {
+          evt.flags      = DIEF_KEYSYMBOL;
+          evt.key_symbol = id;
+     }
+
+     dfb_input_dispatch( device, &evt );
+}
+
+static void
+flush_keys( CoreInputDevice *device )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     if (device->shared->modifiers_l) {
+          if (device->shared->modifiers_l & DIMM_ALT)
+               release_key( device, DIKI_ALT_L );
+
+          if (device->shared->modifiers_l & DIMM_CONTROL)
+               release_key( device, DIKI_CONTROL_L );
+
+          if (device->shared->modifiers_l & DIMM_HYPER)
+               release_key( device, DIKI_HYPER_L );
+
+          if (device->shared->modifiers_l & DIMM_META)
+               release_key( device, DIKI_META_L );
+
+          if (device->shared->modifiers_l & DIMM_SHIFT)
+               release_key( device, DIKI_SHIFT_L );
+
+          if (device->shared->modifiers_l & DIMM_SUPER)
+               release_key( device, DIKI_SUPER_L );
+     }
+
+     if (device->shared->modifiers_r) {
+          if (device->shared->modifiers_r & DIMM_ALTGR)
+               release_key( device, DIKS_ALTGR );
+
+          if (device->shared->modifiers_r & DIMM_ALT)
+               release_key( device, DIKI_ALT_R );
+
+          if (device->shared->modifiers_r & DIMM_CONTROL)
+               release_key( device, DIKI_CONTROL_R );
+
+          if (device->shared->modifiers_r & DIMM_HYPER)
+               release_key( device, DIKI_HYPER_R );
+
+          if (device->shared->modifiers_r & DIMM_META)
+               release_key( device, DIKI_META_R );
+
+          if (device->shared->modifiers_r & DIMM_SHIFT)
+               release_key( device, DIKI_SHIFT_R );
+
+          if (device->shared->modifiers_r & DIMM_SUPER)
+               release_key( device, DIKI_SUPER_R );
+     }
+}
+
+static void
+dump_primary_layer_surface( CoreDFB *core )
+{
+     CoreLayer        *layer = dfb_layer_at( DLID_PRIMARY );
+     CoreLayerContext *context;
+
+     /* Get the currently active context. */
+     if (dfb_layer_get_active_context( layer, &context ) == DFB_OK) {
+          CoreLayerRegion *region;
+
+          /* Get the first region. */
+          if (dfb_layer_context_get_primary_region( context,
+                                                    false, ®ion ) == DFB_OK)
+          {
+               CoreSurface *surface;
+
+               /* Lock the region to avoid tearing due to concurrent updates. */
+               dfb_layer_region_lock( region );
+
+               /* Get the surface of the region. */
+               if (dfb_layer_region_get_surface( region, &surface ) == DFB_OK) {
+                    /* Dump the surface contents. */
+                    dfb_surface_dump_buffer( surface, CSBR_FRONT, dfb_config->screenshot_dir, "dfb" );
+
+                    /* Release the surface. */
+                    dfb_surface_unref( surface );
+               }
+
+               /* Unlock the region. */
+               dfb_layer_region_unlock( region );
+
+               /* Release the region. */
+               dfb_layer_region_unref( region );
+          }
+
+          /* Release the context. */
+          dfb_layer_context_unref( context );
+     }
+}
+
+static bool
+core_input_filter( CoreInputDevice *device, DFBInputEvent *event )
+{
+     D_MAGIC_ASSERT( device, CoreInputDevice );
+
+     if (dfb_system_input_filter( device, event ))
+          return true;
+
+     if (event->type == DIET_KEYPRESS) {
+          switch (event->key_symbol) {
+               case DIKS_PRINT:
+                    if (!event->modifiers && dfb_config->screenshot_dir) {
+                         dump_primary_layer_surface( device->core );
+                         return true;
+                    }
+                    break;
+
+               case DIKS_BACKSPACE:
+                    if (event->modifiers == DIMM_META)
+                         direct_trace_print_stacks();
+
+                    break;
+
+               case DIKS_ESCAPE:
+                    if (event->modifiers == DIMM_META) {
+#if FUSION_BUILD_MULTI
+                         DFBResult         ret;
+                         CoreLayer        *layer = dfb_layer_at( DLID_PRIMARY );
+                         CoreLayerContext *context;
+
+                         /* Get primary (shared) context. */
+                         ret = dfb_layer_get_primary_context( layer,
+                                                              false, &context );
+                         if (ret)
+                              return false;
+
+                         /* Activate the context. */
+                         dfb_layer_activate_context( layer, context );
+
+                         /* Release the context. */
+                         dfb_layer_context_unref( context );
+
+#else
+                         kill( 0, SIGINT );
+#endif
+
+                         return true;
+                    }
+                    break;
+
+               default:
+                    break;
+          }
+     }
+
+     return false;
+}
+
diff --git a/Source/DirectFB/src/core/input.h b/Source/DirectFB/src/core/input.h
new file mode 100755
index 0000000..0e21e2c
--- /dev/null
+++ b/Source/DirectFB/src/core/input.h
@@ -0,0 +1,203 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __INPUT_H__
+#define __INPUT_H__
+
+#include <pthread.h>
+#include <directfb.h>
+
+#include <direct/modules.h>
+
+#include <fusion/reactor.h>
+
+#include <core/coretypes.h>
+
+
+
+DECLARE_MODULE_DIRECTORY( dfb_input_modules );
+
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_INPUT_DRIVER_ABI_VERSION         7
+
+#define DFB_INPUT_DRIVER_INFO_NAME_LENGTH   48
+#define DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH 64
+
+
+typedef struct {
+     int          major;              /* major version */
+     int          minor;              /* minor version */
+} InputDriverVersion;                 /* major.minor, e.g. 0.1 */
+
+typedef struct {
+     InputDriverVersion version;
+
+     char               name[DFB_INPUT_DRIVER_INFO_NAME_LENGTH];
+                                      /* Name of driver,
+                                         e.g. 'Serial Mouse Driver' */
+
+     char               vendor[DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH];
+                                      /* Vendor (or author) of the driver,
+                                         e.g. 'directfb.org' or 'Sven Neumann' */
+} InputDriverInfo;
+
+typedef struct {
+     unsigned int       prefered_id;  /* Prefered predefined input device id,
+                                         e.g. DIDID_MOUSE */
+
+     DFBInputDeviceDescription desc;  /* Capabilities, type, etc. */
+     DFBInputDeviceState       state;
+} InputDeviceInfo;
+
+typedef struct {
+     int       (*GetAvailable)   (void);
+     void      (*GetDriverInfo)  (InputDriverInfo              *driver_info);
+     DFBResult (*OpenDevice)     (CoreInputDevice              *device,
+                                  unsigned int                  number,
+                                  InputDeviceInfo              *device_info,
+                                  void                        **driver_data);
+     DFBResult (*GetKeymapEntry) (CoreInputDevice              *device,
+                                  void                         *driver_data,
+                                  DFBInputDeviceKeymapEntry    *entry);
+     void      (*CloseDevice)    (void                         *driver_data);
+
+     DFBResult (*GetAxisInfo)    (CoreInputDevice              *device,
+                                  void                         *driver_data,
+                                  DFBInputDeviceAxisIdentifier  axis,
+                                  DFBInputDeviceAxisInfo       *ret_info);
+
+     DFBResult (*SetSensitivity) (CoreInputDevice              *device,
+                                  void                         *driver_data,
+                                  int                           sensitivity );
+} InputDriverFuncs;
+
+
+typedef DFBEnumerationResult (*InputDeviceCallback) (CoreInputDevice *device,
+                                                     void            *ctx);
+
+void dfb_input_enumerate_devices( InputDeviceCallback         callback,
+                                  void                       *ctx,
+                                  DFBInputDeviceCapabilities  caps );
+
+
+DirectResult dfb_input_attach       ( CoreInputDevice *device,
+                                      ReactionFunc     func,
+                                      void            *ctx,
+                                      Reaction        *reaction );
+
+DirectResult dfb_input_detach       ( CoreInputDevice *device,
+                                      Reaction        *reaction );
+
+DirectResult dfb_input_attach_global( CoreInputDevice *device,
+                                      int              index,
+                                      void            *ctx,
+                                      GlobalReaction  *reaction );
+
+DirectResult dfb_input_detach_global( CoreInputDevice *device,
+                                      GlobalReaction  *reaction );
+
+
+DFBResult    dfb_input_add_global   ( ReactionFunc     func,
+                                      int             *ret_index );
+
+DFBResult    dfb_input_set_global   ( ReactionFunc     func,
+                                      int              index );
+
+
+void         dfb_input_dispatch     ( CoreInputDevice *device,
+                                      DFBInputEvent   *event );
+
+
+
+void              dfb_input_device_description( const CoreInputDevice     *device,
+                                                DFBInputDeviceDescription *desc );
+
+DFBInputDeviceID  dfb_input_device_id         ( const CoreInputDevice     *device );
+
+CoreInputDevice  *dfb_input_device_at         ( DFBInputDeviceID           id );
+
+
+
+DFBResult         dfb_input_device_get_keymap_entry( CoreInputDevice           *device,
+                                                     int                        keycode,
+                                                     DFBInputDeviceKeymapEntry *entry );
+
+DFBResult         dfb_input_device_set_keymap_entry( CoreInputDevice           *device,
+                                                     int                        keycode,
+                                                     DFBInputDeviceKeymapEntry *entry );
+
+DFBResult         dfb_input_device_load_keymap   ( CoreInputDevice           *device,
+                                                   char                      *filename );
+
+DFBResult         dfb_input_device_reload_keymap   ( CoreInputDevice           *device );
+
+DFBResult         dfb_input_device_set_sensitivity( CoreInputDevice *device,
+                                                    int              sensitivity );
+
+DFBResult         dfb_input_rescan_devices( CoreDFB *core );
+
+DFBResult         dfb_input_device_disconnected( CoreInputDevice *device );
+DFBResult         dfb_input_device_reconnected ( CoreInputDevice *device );
+
+DFBResult         dfb_input_device_get_state( const CoreInputDevice *device,
+                                              DFBInputDeviceState   *ret_state );
+
+
+
+typedef enum {
+     CICNF_NONE          = 0x00000000,
+
+     CICNF_NEW_DEVICE    = 0x00000001,
+
+     CICNF_ALL           = 0x00000001,
+} CoreInputCoreNotificationFlags;
+
+typedef struct {
+     CoreInputCoreNotificationFlags flags;
+
+     DFBInputDeviceID               device_id;
+} CoreInputCoreNotification;
+
+
+DFBResult         dfb_input_core_attach( CoreDFB      *core,
+                                         ReactionFunc  func,
+                                         void         *ctx,
+                                         Reaction     *reaction );
+
+DFBResult         dfb_input_core_detach( CoreDFB      *core,
+                                         Reaction     *reaction );
+/* global reactions */
+
+typedef enum {
+     DFB_WINDOWSTACK_INPUTDEVICE_LISTENER
+} DFB_INPUT_GLOBALS;
+
+#endif
diff --git a/Source/DirectFB/src/core/input_driver.h b/Source/DirectFB/src/core/input_driver.h
new file mode 100755
index 0000000..41c4e0e
--- /dev/null
+++ b/Source/DirectFB/src/core/input_driver.h
@@ -0,0 +1,103 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __INPUT_DRIVER_H__
+#define __INPUT_DRIVER_H__
+
+#include <core/input.h>
+
+
+static int
+driver_get_available( void );
+
+static void
+driver_get_info( InputDriverInfo *info );
+
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data );
+
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry );
+
+#ifdef DFB_INPUTDRIVER_HAS_AXIS_INFO
+static DFBResult
+driver_get_axis_info( CoreInputDevice              *device,
+                      void                         *driver_data,
+                      DFBInputDeviceAxisIdentifier  axis,
+                      DFBInputDeviceAxisInfo       *ret_info );
+#endif
+
+static void
+driver_close_device( void *driver_data );
+
+#ifdef DFB_INPUTDRIVER_HAS_SENSITIVITY
+static DFBResult
+driver_set_sensitivity( CoreInputDevice              *device,
+                        void                         *driver_data,
+                        int                           sensitivity );
+#endif
+
+static const InputDriverFuncs driver_funcs = {
+     .GetAvailable       = driver_get_available,
+     .GetDriverInfo      = driver_get_info,
+     .OpenDevice         = driver_open_device,
+     .GetKeymapEntry     = driver_get_keymap_entry,
+     .CloseDevice        = driver_close_device,
+
+#ifdef DFB_INPUTDRIVER_HAS_AXIS_INFO
+     .GetAxisInfo        = driver_get_axis_info,
+#endif
+
+#ifdef DFB_INPUTDRIVER_HAS_SENSITIVITY
+     .SetSensitivity     = driver_set_sensitivity,
+#endif
+};
+
+#define DFB_INPUT_DRIVER(shortname)                                             \
+__attribute__((constructor)) void directfb_##shortname##_ctor( void );          \
+__attribute__((destructor))  void directfb_##shortname##_dtor( void );          \
+                                                                                \
+void                                                                            \
+directfb_##shortname##_ctor( void )                                             \
+{                                                                               \
+     direct_modules_register( &dfb_input_modules, DFB_INPUT_DRIVER_ABI_VERSION, \
+                              #shortname, &driver_funcs );                      \
+}                                                                               \
+                                                                                \
+void                                                                            \
+directfb_##shortname##_dtor( void )                                             \
+{                                                                               \
+     direct_modules_unregister( &dfb_input_modules, #shortname );               \
+}
+
+#endif
diff --git a/Source/DirectFB/src/core/layer_context.c b/Source/DirectFB/src/core/layer_context.c
new file mode 100755
index 0000000..1dcccc8
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_context.c
@@ -0,0 +1,1947 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <unistd.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/screen.h>
+#include <core/surface.h>
+#include <core/system.h>
+#include <core/windows.h>
+#include <core/windowstack.h>
+#include <core/wm.h>
+
+#include <core/layers_internal.h>
+#include <core/windows_internal.h>
+
+#include <fusion/shmalloc.h>
+
+
+D_DEBUG_DOMAIN( Core_LayerContext, "Core/LayerContext", "DirectFB Display Layer Context" );
+
+/**********************************************************************************************************************/
+
+static void      init_region_config  ( CoreLayerContext            *context,
+                                       CoreLayerRegionConfig       *config );
+
+static void      build_updated_config( CoreLayer                   *layer,
+                                       CoreLayerContext            *context,
+                                       const DFBDisplayLayerConfig *update,
+                                       CoreLayerRegionConfig       *ret_config,
+                                       CoreLayerRegionConfigFlags  *ret_flags );
+
+static DFBResult allocate_surface    ( CoreLayer                   *layer,
+                                       CoreLayerRegion             *region,
+                                       CoreLayerRegionConfig       *config );
+
+static DFBResult reallocate_surface  ( CoreLayer                   *layer,
+                                       CoreLayerRegion             *region,
+                                       CoreLayerRegionConfig       *config );
+
+static DFBResult deallocate_surface  ( CoreLayer                   *layer,
+                                       CoreLayerRegion             *region );
+
+static void      screen_rectangle    ( CoreLayerContext            *context,
+                                       const DFBLocation           *location,
+                                       DFBRectangle                *rect );
+
+/**********************************************************************************************************************/
+
+static void
+context_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+     CoreLayerContext *context = (CoreLayerContext*) object;
+     CoreLayer        *layer   = dfb_layer_at( context->layer_id );
+     CoreLayerShared  *shared  = layer->shared;
+
+     (void) shared;
+
+     D_DEBUG_AT( Core_LayerContext, "*~ destroying context %p (%s, %sactive%s)\n",
+                 context, shared->description.name, context->active ? "" : "in",
+                 zombie ? " - ZOMBIE" : "");
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Remove the context from the layer's context stack. */
+     dfb_layer_remove_context( layer, context );
+
+     /*
+      * Detach input devices before taking the context lock to prevent a
+      * deadlock between windowstack destruction and input event processing.
+      */
+     if (context->stack)
+          dfb_windowstack_detach_devices( context->stack );
+
+     dfb_layer_context_lock( context );
+
+     /* Destroy the window stack. */
+     if (context->stack) {
+          dfb_windowstack_destroy( context->stack );
+          context->stack = NULL;
+     }
+
+     /* Destroy the region vector. */
+     fusion_vector_destroy( &context->regions );
+
+     /* Deinitialize the lock. */
+     fusion_skirmish_destroy( &context->lock );
+
+     /* Free clip regions. */
+     if (context->primary.config.clips)
+          SHFREE( context->shmpool, context->primary.config.clips );
+
+     D_MAGIC_CLEAR( context );
+
+     /* Destroy the object. */
+     fusion_object_destroy( object );
+}
+
+/**********************************************************************************************************************/
+
+FusionObjectPool *
+dfb_layer_context_pool_create( const FusionWorld *world )
+{
+     return fusion_object_pool_create( "Layer Context Pool",
+                                       sizeof(CoreLayerContext),
+                                       sizeof(CoreLayerContextNotification),
+                                       context_destructor, NULL, world );
+}
+
+/**********************************************************************************************************************/
+
+static void
+update_stack_geometry( CoreLayerContext *context )
+{
+     DFBDimension     size;
+     int              rotation;
+     CoreLayerRegion *region;
+     CoreSurface     *surface;
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     rotation = context->rotation;
+
+     switch (rotation) {
+          default:
+               D_BUG( "invalid rotation %d", rotation );
+          case 0:
+          case 180:
+               size.w = context->config.width;
+               size.h = context->config.height;
+               break;
+
+          case 90:
+          case 270:
+               size.w = context->config.height;
+               size.h = context->config.width;
+               break;
+     }
+
+     region = context->primary.region;
+     if (region) {
+          surface = region->surface;
+          if (surface) {
+               D_MAGIC_ASSERT( surface, CoreSurface );
+
+               rotation -= surface->rotation;
+               if (rotation < 0)
+                    rotation += 360;
+          }
+     }
+
+     dfb_windowstack_resize( context->stack, size.w, size.h, rotation );
+}
+
+DFBResult
+dfb_layer_context_init( CoreLayerContext *context,
+                        CoreLayer        *layer )
+{
+     CoreLayerShared *shared;
+
+     D_ASSERT( context != NULL );
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     shared = layer->shared;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p [%s] )\n", __FUNCTION__, context, layer, shared->description.name );
+
+     context->shmpool = shared->shmpool;
+
+     /* Initialize the lock. */
+     if (fusion_skirmish_init( &context->lock, "Layer Context", dfb_core_world(layer->core) )) {
+          fusion_object_destroy( &context->object );
+          return DFB_FUSION;
+     }
+
+     /* Initialize the region vector. */
+     fusion_vector_init( &context->regions, 4, context->shmpool );
+
+     /* Store layer ID, default configuration and default color adjustment. */
+     context->layer_id   = shared->layer_id;
+     context->config     = shared->default_config;
+     context->adjustment = shared->default_adjustment;
+     context->rotation   = dfb_config->layers[dfb_layer_id_translated(layer)].rotate;
+
+     /* Initialize screen location. */
+     context->screen.location.x = 0.0f;
+     context->screen.location.y = 0.0f;
+     context->screen.location.w = 1.0f;
+     context->screen.location.h = 1.0f;
+
+     if (D_FLAGS_IS_SET( shared->description.caps, DLCAPS_SCREEN_LOCATION ))
+          context->screen.mode = CLLM_LOCATION;
+     else if (D_FLAGS_IS_SET( shared->description.caps, DLCAPS_SCREEN_POSITION ))
+          context->screen.mode = CLLM_CENTER;
+
+     /* Change global reaction lock. */
+     fusion_object_set_lock( &context->object, &context->lock );
+
+     D_MAGIC_SET( context, CoreLayerContext );
+
+     /* Initialize the primary region's configuration. */
+     init_region_config( context, &context->primary.config );
+
+     /* Activate the object. */
+     fusion_object_activate( &context->object );
+
+
+     dfb_layer_context_lock( context );
+
+     /* Create the window stack. */
+     context->stack = dfb_windowstack_create( context );
+     if (!context->stack) {
+          dfb_layer_context_unlock( context );
+          dfb_layer_context_unref( context );
+          return D_OOSHM();
+     }
+
+     /* Tell the window stack about its size. */
+     update_stack_geometry( context );
+
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_activate( CoreLayerContext *context )
+{
+     DFBResult        ret;
+     int              index;
+     CoreLayer       *layer;
+     CoreLayerRegion *region;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p )\n", __FUNCTION__, context );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     D_ASSUME( !context->active );
+
+     if (context->active) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Iterate through all regions. */
+     fusion_vector_foreach (region, index, context->regions) {
+          /* Activate each region. */
+          if (dfb_layer_region_activate( region ))
+               D_WARN( "could not activate region!" );
+
+          if (region->surface && region->surface->num_buffers == 0) {
+               D_ASSERT( region->surface_lock.buffer == NULL );
+
+               ret = reallocate_surface( layer, region, ®ion->config );
+               if (ret)
+                    D_DERROR( ret, "Core/Layers: Reallocation of layer surface failed!\n" );
+          }
+     }
+
+     context->active = true;
+
+     /* set new adjustment */
+     if (layer->funcs->SetColorAdjustment)
+          layer->funcs->SetColorAdjustment( layer, layer->driver_data,
+                                            layer->layer_data, &context->adjustment );
+
+     /* Resume window stack. */
+     if (context->stack) {
+          CoreWindowStack *stack = context->stack;
+
+          D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+          if (stack->flags & CWSF_INITIALIZED)
+               dfb_wm_set_active( stack, true );
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_deactivate( CoreLayerContext *context )
+{
+     int              index;
+     CoreLayerRegion *region;
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p )\n", __FUNCTION__, context );
+
+     D_ASSUME( context->active );
+
+     if (!context->active) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Iterate through all regions. */
+     fusion_vector_foreach (region, index, context->regions) {
+          /* Deactivate each region. */
+          dfb_layer_region_deactivate( region );
+     }
+
+     context->active = false;
+
+     /* Suspend window stack. */
+     if (context->stack) {
+          CoreWindowStack *stack = context->stack;
+
+          D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+          if (stack->flags & CWSF_ACTIVATED)
+               dfb_wm_set_active( stack, false );
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_add_region( CoreLayerContext *context,
+                              CoreLayerRegion  *region )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, region );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( region != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     D_ASSUME( ! fusion_vector_contains( &context->regions, region ) );
+
+     if (fusion_vector_contains( &context->regions, region )) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Add region to vector. */
+     if (fusion_vector_add( &context->regions, region )) {
+          dfb_layer_context_unlock( context );
+          return DFB_FUSION;
+     }
+
+     /* Inherit state from context. */
+     if (context->active)
+          region->state |= CLRSF_ACTIVE;
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_remove_region( CoreLayerContext *context,
+                                 CoreLayerRegion  *region )
+{
+     int index;
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( region != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     D_ASSUME( fusion_vector_contains( &context->regions, region ) );
+
+     /* Lookup region. */
+     index = fusion_vector_index_of( &context->regions, region );
+     if (index < 0) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Remove region from vector. */
+     fusion_vector_remove( &context->regions, index );
+
+     /* Check if the primary region is removed. */
+     if (region == context->primary.region)
+          context->primary.region = NULL;
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_get_primary_region( CoreLayerContext  *context,
+                                      bool               create,
+                                      CoreLayerRegion  **ret_region )
+{
+     DFBResult ret = DFB_OK;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %screate )\n", __FUNCTION__, context, create ? "" : "DON'T " );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( ret_region != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+restart:
+     while (context->primary.region) {
+         /* Increase the primary region's reference counter. */
+         ret = dfb_layer_region_ref( context->primary.region );
+         if (ret == DFB_OK)
+              break;
+
+         dfb_layer_context_unlock( context );
+
+         if (ret == DFB_LOCKED) {
+              //sched_yield();
+              usleep( 10000 );
+
+              if (dfb_layer_context_lock( context ))
+                   return DFB_FUSION;
+         }
+         else
+              return DFB_FUSION;
+     }
+
+     if (!context->primary.region) {
+          if (create) {
+              CoreLayerRegion *region;
+
+              /* Unlock the context. */
+              dfb_layer_context_unlock( context );
+
+              /* Create the primary region. */
+              ret = dfb_layer_region_create( context, ®ion );
+              if (ret) {
+                   D_ERROR( "DirectFB/core/layers: Could not create primary region!\n" );
+                   return ret;
+              }
+
+              /* Lock the context again. */
+              if (dfb_layer_context_lock( context )) {
+                   dfb_layer_region_unref( region );
+                   return DFB_FUSION;
+              }
+
+              /* Check for race. */
+              if (context->primary.region) {
+                   dfb_layer_region_unref( region );
+                   goto restart;
+              }
+
+              /* Set the region configuration. */
+              ret = dfb_layer_region_set_configuration( region,
+                                                        &context->primary.config,
+                                                        CLRCF_ALL );
+              if (ret) {
+                   D_DERROR( ret, "DirectFB/core/layers: "
+                             "Could not set primary region config!\n" );
+                   dfb_layer_region_unref( region );
+                   dfb_layer_context_unlock( context );
+                   return ret;
+              }
+
+              /* Remember the primary region. */
+              context->primary.region = region;
+
+              /* Allocate surface, enable region etc. */
+              ret = dfb_layer_context_set_configuration( context, &context->config );
+              if (ret) {
+                   D_DERROR( ret, "DirectFB/core/layers: "
+                             "Could not set layer context config!\n" );
+                   context->primary.region = NULL;
+                   dfb_layer_region_unref( region );
+                   dfb_layer_context_unlock( context );
+                   return ret;
+              }
+          }
+          else {
+               dfb_layer_context_unlock( context );
+               return DFB_TEMPUNAVAIL;
+          }
+     }
+
+     /* Return region. */
+     *ret_region = context->primary.region;
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+/*
+ * configuration management
+ */
+DFBResult
+dfb_layer_context_test_configuration( CoreLayerContext            *context,
+                                      const DFBDisplayLayerConfig *config,
+                                      DFBDisplayLayerConfigFlags  *ret_failed )
+{
+     DFBResult                   ret = DFB_OK;
+     CoreLayer                  *layer;
+     CoreLayerRegionConfig       region_config;
+     CoreLayerRegionConfigFlags  failed;
+     const DisplayLayerFuncs    *funcs;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p )\n", __FUNCTION__, context, config, ret_failed );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( config != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     layer = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( layer->funcs->TestRegion != NULL );
+
+     funcs = layer->funcs;
+
+     /* Build a new region configuration with the changes. */
+     build_updated_config( layer, context, config, ®ion_config, NULL );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+
+     /* Test the region configuration. */
+     if (region_config.buffermode == DLBM_WINDOWS) {
+          if (! D_FLAGS_IS_SET( layer->shared->description.caps, DLCAPS_WINDOWS )) {
+               failed = CLRCF_BUFFERMODE;
+               ret = DFB_UNSUPPORTED;
+          }
+     }
+     else {
+          /* Let the driver examine the modified configuration. */
+          ret = funcs->TestRegion( layer, layer->driver_data, layer->layer_data,
+                                   ®ion_config, &failed );
+     }
+
+     /* Return flags for failing entries. */
+     if (ret_failed) {
+          DFBDisplayLayerConfigFlags flags = DLCONF_NONE;
+
+          /* Translate flags. */
+          if (ret != DFB_OK) {
+               if (failed & CLRCF_WIDTH)
+                    flags |= DLCONF_WIDTH;
+
+               if (failed & CLRCF_HEIGHT)
+                    flags |= DLCONF_HEIGHT;
+
+               if (failed & CLRCF_FORMAT)
+                    flags |= DLCONF_PIXELFORMAT;
+
+               if (failed & CLRCF_BUFFERMODE)
+                    flags |= DLCONF_BUFFERMODE;
+
+               if (failed & CLRCF_OPTIONS)
+                    flags |= DLCONF_OPTIONS;
+
+               if (failed & CLRCF_SOURCE_ID)
+                    flags |= DLCONF_SOURCE;
+
+               if (failed & CLRCF_SURFACE_CAPS)
+                    flags |= DLCONF_SURFACE_CAPS;
+          }
+
+          *ret_failed = flags;
+     }
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_configuration( CoreLayerContext            *context,
+                                     const DFBDisplayLayerConfig *config )
+{
+     int                         i;
+     DFBResult                   ret;
+     CoreLayer                  *layer;
+     CoreLayerShared            *shared;
+     CoreLayerRegionConfig       region_config;
+     CoreLayerRegionConfigFlags  flags;
+     const DisplayLayerFuncs    *funcs;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, config );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( config != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     layer  = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( layer->funcs->TestRegion != NULL );
+
+     shared = layer->shared;
+     funcs  = layer->funcs;
+
+     /* Build a new region configuration with the changes. */
+     build_updated_config( layer, context, config, ®ion_config, &flags );
+
+     /* Test the region configuration first. */
+     if (region_config.buffermode == DLBM_WINDOWS) {
+          if (! D_FLAGS_IS_SET( shared->description.caps, DLCAPS_WINDOWS )) {
+               dfb_layer_context_unlock( context );
+               return DFB_UNSUPPORTED;
+          }
+     }
+     else {
+          ret = funcs->TestRegion( layer, layer->driver_data, layer->layer_data,
+                                   ®ion_config, NULL );
+          if (ret) {
+               dfb_layer_context_unlock( context );
+               return ret;
+          }
+     }
+
+     /* Set the region configuration. */
+     if (context->primary.region) {
+          CoreLayerRegion *region = context->primary.region;
+
+          /* Add local reference. */
+          if (dfb_layer_region_ref( region )) {
+               dfb_layer_context_unlock( context );
+               return DFB_FUSION;
+          }
+
+          /* Lock the region. */
+          if (dfb_layer_region_lock( region )) {
+               dfb_layer_region_unref( region );
+               dfb_layer_context_unlock( context );
+               return DFB_FUSION;
+          }
+
+          /* Normal buffer mode? */
+          if (region_config.buffermode != DLBM_WINDOWS) {
+               bool                      surface    = shared->description.caps & DLCAPS_SURFACE;
+               CoreLayerRegionStateFlags configured = region->state & CLRSF_CONFIGURED;
+
+               if (shared->description.caps & DLCAPS_SOURCES) {
+                    for (i=0; i<shared->description.sources; i++) {
+                         if (shared->sources[i].description.source_id == region_config.source_id)
+                              break;
+                    }
+
+                    D_ASSERT( i < shared->description.sources );
+
+                    surface = shared->sources[i].description.caps & DDLSCAPS_SURFACE;
+               }
+
+               D_FLAGS_CLEAR( region->state, CLRSF_CONFIGURED );
+
+               /* Unlock the region surface */
+               if (region->surface) {
+                    if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+                         if (!D_FLAGS_IS_SET( region->state, CLRSF_FROZEN ))
+                              D_ASSUME( region->surface_lock.buffer != NULL );
+
+                         if (region->surface_lock.buffer)
+                              dfb_surface_unlock_buffer( region->surface, ®ion->surface_lock );
+                    }
+               }
+
+               /* (Re)allocate the region's surface. */
+               if (surface) {
+                    flags |= CLRCF_SURFACE | CLRCF_PALETTE;
+
+                    if (region->surface) {
+                         ret = reallocate_surface( layer, region, ®ion_config );
+                         if (ret)
+                              D_DERROR( ret, "Core/Layers: Reallocation of layer surface failed!\n" );
+                    }
+                    else {
+                         ret = allocate_surface( layer, region, ®ion_config );
+                         if (ret)
+                              D_DERROR( ret, "Core/Layers: Allocation of layer surface failed!\n" );
+                    }
+
+                    if (ret) {
+                         dfb_layer_region_unlock( region );
+                         dfb_layer_region_unref( region );
+                         dfb_layer_context_unlock( context );
+                         return ret;
+                    }
+               }
+               else if (region->surface)
+                    deallocate_surface( layer, region );
+
+               region->state |= configured;
+
+               /* Set the new region configuration. */
+               dfb_layer_region_set_configuration( region, ®ion_config, flags );
+
+               /* Enable the primary region. */
+               if (! D_FLAGS_IS_SET( region->state, CLRSF_ENABLED ))
+                    dfb_layer_region_enable( region );
+          }
+          else {
+               /* Disable and deallocate the primary region. */
+               if (D_FLAGS_IS_SET( region->state, CLRSF_ENABLED )) {
+                    dfb_layer_region_disable( region );
+
+                    if (region->surface)
+                         deallocate_surface( layer, region );
+               }
+          }
+
+          /* Unlock the region and give up the local reference. */
+          dfb_layer_region_unlock( region );
+          dfb_layer_region_unref( region );
+     }
+
+     /* Remember new region config. */
+     context->primary.config = region_config;
+
+     /*
+      * Write back modified entries.
+      */
+     if (config->flags & DLCONF_WIDTH)
+          context->config.width = config->width;
+
+     if (config->flags & DLCONF_HEIGHT)
+          context->config.height = config->height;
+
+     if (config->flags & DLCONF_PIXELFORMAT)
+          context->config.pixelformat = config->pixelformat;
+
+     if (config->flags & DLCONF_BUFFERMODE)
+          context->config.buffermode = config->buffermode;
+
+     if (config->flags & DLCONF_OPTIONS)
+          context->config.options = config->options;
+
+     if (config->flags & DLCONF_SOURCE)
+          context->config.source = config->source;
+
+     if (config->flags & DLCONF_SURFACE_CAPS)
+          context->config.surface_caps = config->surface_caps;
+
+     /* Update the window stack. */
+     if (context->stack) {
+          CoreWindowStack *stack = context->stack;
+
+          /* Update hardware flag. */
+          stack->hw_mode = (region_config.buffermode == DLBM_WINDOWS);
+
+          /* Tell the windowing core about the new size. */
+          if (config->flags & (DLCONF_WIDTH | DLCONF_HEIGHT |
+                               DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_SURFACE_CAPS))
+          {
+               update_stack_geometry( context );
+
+               /* FIXME: call only if really needed */
+               dfb_windowstack_repaint_all( stack );
+          }
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_get_configuration( CoreLayerContext      *context,
+                                     DFBDisplayLayerConfig *config )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, config );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( config != NULL );
+
+     *config = context->config;
+
+     return DFB_OK;
+}
+
+static DFBResult
+update_primary_region_config( CoreLayerContext           *context,
+                              CoreLayerRegionConfig      *config,
+                              CoreLayerRegionConfigFlags  flags )
+{
+     DFBResult ret = DFB_OK;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, 0x%08x )\n", __FUNCTION__, context, config, flags );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( config != NULL );
+
+     if (context->primary.region) {
+          /* Set the new configuration. */
+          ret = dfb_layer_region_set_configuration( context->primary.region, config, flags );
+     }
+     else {
+          CoreLayer *layer = dfb_layer_at( context->layer_id );
+
+          D_ASSERT( layer->funcs != NULL );
+          D_ASSERT( layer->funcs->TestRegion != NULL );
+
+          /* Just test the new configuration. */
+          ret = layer->funcs->TestRegion( layer, layer->driver_data,
+                                          layer->layer_data, config, NULL );
+     }
+
+     if (ret)
+          return ret;
+
+     /* Remember the configuration. */
+     context->primary.config = *config;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_set_src_colorkey( CoreLayerContext *context,
+                                    u8 r, u8 g, u8 b, int index )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %02x %02x %02x - %d )\n", __FUNCTION__, context, r, g, b, index );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Change the color key. */
+     config.src_key.r = r;
+     config.src_key.g = g;
+     config.src_key.b = b;
+
+     if (index >= 0)
+          config.src_key.index = index & 0xff;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_SRCKEY );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_dst_colorkey( CoreLayerContext *context,
+                                    u8 r, u8 g, u8 b, int index )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %02x %02x %02x - %d )\n", __FUNCTION__, context, r, g, b, index );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Change the color key. */
+     config.dst_key.r = r;
+     config.dst_key.g = g;
+     config.dst_key.b = b;
+
+     if (index >= 0)
+          config.dst_key.index = index & 0xff;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_DSTKEY );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_sourcerectangle( CoreLayerContext   *context,
+                                       const DFBRectangle *source )
+{
+     DFBResult                   ret;
+     CoreLayerRegionConfig       config;
+     CoreLayerRegionConfigFlags  flags;
+     CoreLayer                  *layer;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, source );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( source != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Do nothing if the source rectangle didn't change. */
+     if (DFB_RECTANGLE_EQUAL( config.source, *source )) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Check if the new source rectangle is valid. */
+     if (source->x < 0 || source->y < 0 ||
+         source->x + source->w > config.width ||
+         source->y + source->h > config.height) {
+          dfb_layer_context_unlock( context );
+          return DFB_INVAREA;
+     }
+
+     /* Change the source rectangle. */
+     config.source = *source;
+   
+     flags = CLRCF_SOURCE;
+     layer = dfb_layer_at( context->layer_id );
+
+     /*  If the display layer does not support scaling and the destination 
+         rectangle size is not the same as the source, change it to match.  The 
+         origin is left alone to allow the driver to handle it.  */
+     if ( !D_FLAGS_IS_SET( layer->shared->description.caps, DLCAPS_SCREEN_SIZE ) && 
+          ( config.dest.w != config.source.w || 
+            config.dest.h != config.source.h ) )
+     {
+          config.dest.w = config.source.w;
+          config.dest.h = config.source.h;
+
+          flags |= CLRCF_DEST;
+     }
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, flags );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_screenlocation( CoreLayerContext  *context,
+                                      const DFBLocation *location )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, location );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( location != NULL );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the location didn't change. */
+/*     if (context->screen.mode == CLLM_LOCATION &&
+         DFB_LOCATION_EQUAL( context->screen.location, *location ))
+     {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }*/
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Calculate new absolute screen coordinates. */
+     screen_rectangle( context, location, &config.dest );
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_DEST );
+     if (ret == DFB_OK) {
+          context->screen.location  = *location;
+          context->screen.rectangle = config.dest;
+          context->screen.mode      = CLLM_LOCATION;
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_screenrectangle( CoreLayerContext   *context,
+                                       const DFBRectangle *rectangle )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, rectangle );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     DFB_RECTANGLE_ASSERT( rectangle );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the location didn't change. */
+/*     if (context->screen.mode == CLLM_RECTANGLE &&
+         DFB_RECTANGLE_EQUAL( context->screen.rectangle, *rectangle ))
+     {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }*/
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Use supplied absolute screen coordinates. */
+     config.dest = *rectangle;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_DEST );
+     if (ret == DFB_OK) {
+          context->screen.rectangle = config.dest;
+          context->screen.mode      = CLLM_RECTANGLE;
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_screenposition( CoreLayerContext  *context,
+                                      int                x,
+                                      int                y )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %4d,%4d )\n", __FUNCTION__, context, x, y );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the location didn't change. */
+     if (context->primary.config.dest.x == x && context->primary.config.dest.y == y) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Set new absolute screen coordinates. */
+     config.dest.x = x;
+     config.dest.y = y;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_DEST );
+     if (ret == DFB_OK) {
+          context->screen.rectangle = config.dest;
+          context->screen.mode      = CLLM_POSITION;
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_opacity( CoreLayerContext *context,
+                               u8                opacity )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %u )\n", __FUNCTION__, context, opacity );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the opacity didn't change. */
+     if (context->primary.config.opacity == opacity) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Change the opacity. */
+     config.opacity = opacity;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_OPACITY );
+     if (ret == DFB_OK)
+          context->primary.config.opacity = opacity;
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_rotation( CoreLayerContext *context,
+                                int               rotation )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %d )\n", __FUNCTION__, context, rotation );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the rotation didn't change. */
+     if (context->rotation != rotation) {
+          context->rotation = rotation;
+
+          update_stack_geometry( context );
+
+          dfb_windowstack_repaint_all( context->stack );
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_set_coloradjustment( CoreLayerContext         *context,
+                                       const DFBColorAdjustment *adjustment )
+{
+     DFBResult           ret;
+     DFBColorAdjustment  adj;
+     CoreLayer          *layer;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, adjustment );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( adjustment != NULL );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     adj = context->adjustment;
+
+     if (!layer->funcs->SetColorAdjustment)
+          return DFB_UNSUPPORTED;
+
+     /* if flags are set that are not in the default adjustment */
+     if (adjustment->flags & ~context->adjustment.flags)
+          return DFB_UNSUPPORTED;
+
+     /* take over changed values */
+     if (adjustment->flags & DCAF_BRIGHTNESS)  adj.brightness = adjustment->brightness;
+     if (adjustment->flags & DCAF_CONTRAST)    adj.contrast   = adjustment->contrast;
+     if (adjustment->flags & DCAF_HUE)         adj.hue        = adjustment->hue;
+     if (adjustment->flags & DCAF_SATURATION)  adj.saturation = adjustment->saturation;
+
+     /* set new adjustment */
+     ret = layer->funcs->SetColorAdjustment( layer, layer->driver_data,
+                                             layer->layer_data, &adj );
+     if (ret)
+          return ret;
+
+     /* keep new adjustment */
+     context->adjustment = adj;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_get_coloradjustment( CoreLayerContext   *context,
+                                       DFBColorAdjustment *ret_adjustment )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, ret_adjustment );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( ret_adjustment != NULL );
+
+     *ret_adjustment = context->adjustment;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_context_set_field_parity( CoreLayerContext *context,
+                                    int               field )
+{
+     DFBResult             ret;
+     CoreLayerRegionConfig config;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %d )\n", __FUNCTION__, context, field );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     /* Do nothing if the parity didn't change. */
+     if (context->primary.config.parity == field) {
+          dfb_layer_context_unlock( context );
+          return DFB_OK;
+     }
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Change the parity. */
+     config.parity = field;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_PARITY );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_set_clip_regions( CoreLayerContext *context,
+                                    const DFBRegion  *regions,
+                                    int               num_regions,
+                                    DFBBoolean        positive )
+{
+     DFBResult              ret;
+     CoreLayerRegionConfig  config;
+     DFBRegion             *clips;
+     DFBRegion             *old_clips;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p [%d], %s )\n", __FUNCTION__,
+                 context, regions, num_regions, positive ? "positive" : "negative" );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     clips = SHMALLOC( context->shmpool, sizeof(DFBRegion) * num_regions );
+     if (!clips)
+          return D_OOSHM();
+
+     direct_memcpy( clips, regions, sizeof(DFBRegion) * num_regions );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context )) {
+          SHFREE( context->shmpool, clips );
+          return DFB_FUSION;
+     }
+
+     /* Take the current configuration. */
+     config = context->primary.config;
+
+     /* Remember for freeing later on. */
+     old_clips = config.clips;
+
+     /* Change the clip regions. */
+     config.clips     = clips;
+     config.num_clips = num_regions;
+     config.positive  = positive;
+
+     /* Try to set the new configuration. */
+     ret = update_primary_region_config( context, &config, CLRCF_CLIPS );
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     if (ret)
+          SHFREE( context->shmpool, clips );
+     else if (old_clips)
+          SHFREE( context->shmpool, old_clips );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_context_create_window( CoreDFB                     *core,
+                                 CoreLayerContext            *context,
+                                 const DFBWindowDescription  *desc,
+                                 CoreWindow                 **ret_window )
+{
+     DFBResult        ret;
+     CoreWindow      *window;
+     CoreWindowStack *stack;
+     CoreLayer       *layer;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p, %p )\n", __FUNCTION__, core, context, desc, ret_window );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( context->stack != NULL );
+     D_ASSERT( desc != NULL );
+     D_ASSERT( ret_window != NULL );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     if (dfb_layer_context_lock( context ))
+         return DFB_FUSION;
+
+     stack = context->stack;
+
+     if (!stack->cursor.set) {
+          ret = dfb_windowstack_cursor_enable( core, stack, true );
+          if (ret) {
+               dfb_layer_context_unlock( context );
+               return ret;
+          }
+     }
+
+     ret = dfb_window_create( stack, desc, &window );
+     if (ret) {
+          dfb_layer_context_unlock( context );
+          return ret;
+     }
+
+     *ret_window = window;
+
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+CoreWindow *
+dfb_layer_context_find_window( CoreLayerContext *context, DFBWindowID id )
+{
+     CoreWindowStack *stack;
+     CoreWindow      *window;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %u )\n", __FUNCTION__, context, id );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( context->stack != NULL );
+
+     stack = context->stack;
+
+     if (dfb_layer_context_lock( context ))
+         return NULL;
+
+     if (dfb_wm_window_lookup( stack, id, &window ) || dfb_window_ref( window ))
+          window = NULL;
+
+     dfb_layer_context_unlock( context );
+
+     return window;
+}
+
+CoreWindowStack *
+dfb_layer_context_windowstack( const CoreLayerContext *context )
+{
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     return context->stack;
+}
+
+bool
+dfb_layer_context_active( const CoreLayerContext *context )
+{
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     return context->active;
+}
+
+DirectResult
+dfb_layer_context_lock( CoreLayerContext *context )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p )\n", __FUNCTION__, context );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     ret = fusion_skirmish_prevail( &context->lock );
+     if (ret == DFB_OK) {
+          int locked;
+
+          ret = fusion_skirmish_lock_count( &context->lock, &locked );
+          if (ret == DFB_OK)
+               D_DEBUG_AT( Core_LayerContext, "  -> locked %dx now\n", locked );
+     }
+
+     return ret;
+}
+
+DirectResult
+dfb_layer_context_unlock( CoreLayerContext *context )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p )\n", __FUNCTION__, context );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     return fusion_skirmish_dismiss( &context->lock );
+}
+
+/**************************************************************************************************/
+
+/*
+ * region config construction
+ */
+static void
+init_region_config( CoreLayerContext      *context,
+                    CoreLayerRegionConfig *config )
+{
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, context, config );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( config  != NULL );
+
+     memset( config, 0, sizeof(CoreLayerRegionConfig) );
+
+     /* Initialize values from layer config. */
+     config->width        = context->config.width;
+     config->height       = context->config.height;
+     config->format       = context->config.pixelformat;
+     config->buffermode   = context->config.buffermode;
+     config->options      = context->config.options;
+     config->source_id    = context->config.source;
+     config->surface_caps = context->config.surface_caps;
+
+     /* Initialize source rectangle. */
+     config->source.x   = 0;
+     config->source.y   = 0;
+     config->source.w   = config->width;
+     config->source.h   = config->height;
+
+     /* Initialize screen rectangle. */
+     screen_rectangle( context, &context->screen.location, &config->dest );
+
+     /* Set default opacity. */
+     config->opacity = 0xff;
+
+     /* Set default alpha ramp. */
+     config->alpha_ramp[0] = 0x00;
+     config->alpha_ramp[1] = 0x55;
+     config->alpha_ramp[2] = 0xaa;
+     config->alpha_ramp[3] = 0xff;
+}
+
+static void
+build_updated_config( CoreLayer                   *layer,
+                      CoreLayerContext            *context,
+                      const DFBDisplayLayerConfig *update,
+                      CoreLayerRegionConfig       *ret_config,
+                      CoreLayerRegionConfigFlags  *ret_flags )
+{
+     CoreLayerRegionConfigFlags flags = CLRCF_NONE;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p, %p, %p )\n",
+                 __FUNCTION__, layer, context, update, ret_config, ret_flags );
+
+     D_ASSERT( layer != NULL );
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( update != NULL );
+     D_ASSERT( ret_config != NULL );
+
+     /* Get the current region configuration. */
+     *ret_config = context->primary.config;
+
+     /* Change width. */
+     if (update->flags & DLCONF_WIDTH) {
+          flags |= CLRCF_WIDTH;
+          ret_config->width  = update->width;
+     }
+
+     /* Change height. */
+     if (update->flags & DLCONF_HEIGHT) {
+          flags |= CLRCF_HEIGHT;
+          ret_config->height = update->height;
+     }
+
+     /* Update source and destination rectangle. */
+     if (update->flags & (DLCONF_WIDTH | DLCONF_HEIGHT)) {
+          int width, height;
+          DFBResult ret;
+
+          flags |= CLRCF_SOURCE | CLRCF_DEST;
+
+          ret_config->source.x = 0;
+          ret_config->source.y = 0;
+          ret_config->source.w = ret_config->width;
+          ret_config->source.h = ret_config->height;
+
+          switch (context->screen.mode) {
+               case CLLM_CENTER:
+                    ret = dfb_screen_get_layer_dimension( layer->screen, layer, &width, &height );
+                    if( ret == DFB_OK ) {
+                         ret_config->dest.x = (width  - ret_config->width)  / 2;
+                         ret_config->dest.y = (height - ret_config->height) / 2;
+                    }
+                    /* fall through */
+
+               case CLLM_POSITION:
+                    ret_config->dest.w = ret_config->width;
+                    ret_config->dest.h = ret_config->height;
+                    break;
+
+               case CLLM_LOCATION:
+               case CLLM_RECTANGLE:
+                    D_ASSERT( layer->shared != NULL );
+                         
+                    /*  If the display layer does not support scaling and the 
+                        destination rectangle size is not the same as the 
+                        source rectangle, change it to match.  The origin is 
+                        left alone to allow the driver to handle it. */
+                    if (     !D_FLAGS_IS_SET( layer->shared->description.caps, DLCAPS_SCREEN_SIZE )
+                         &&  ( ret_config->dest.w != ret_config->source.w || 
+                               ret_config->dest.h != ret_config->source.h ) )
+                    {
+                         ret_config->dest.w = ret_config->width;
+                         ret_config->dest.h = ret_config->height;
+                    }
+                    break;
+
+               default:
+                    D_BREAK( "invalid layout mode" );
+          }
+     }
+
+     /* Change pixel format. */
+     if (update->flags & DLCONF_PIXELFORMAT) {
+          flags |= CLRCF_FORMAT;
+          ret_config->format = update->pixelformat;
+     }
+
+     /* Change buffer mode. */
+     if (update->flags & DLCONF_BUFFERMODE) {
+          flags |= CLRCF_BUFFERMODE;
+          ret_config->buffermode = update->buffermode;
+     }
+
+     /* Change options. */
+     if (update->flags & DLCONF_OPTIONS) {
+          flags |= CLRCF_OPTIONS;
+          ret_config->options = update->options;
+     }
+
+     /* Change source id. */
+     if (update->flags & DLCONF_SOURCE) {
+          flags |= CLRCF_SOURCE_ID;
+          ret_config->source_id = update->source;
+     }
+
+     /* Change surface caps. */
+     if (update->flags & DLCONF_SURFACE_CAPS) {
+          flags |= CLRCF_SURFACE_CAPS;
+          ret_config->surface_caps = update->surface_caps;
+     }
+
+     /* Return translated flags. */
+     if (ret_flags)
+          *ret_flags = flags;
+}
+
+/*
+ * region surface (re/de)allocation
+ */
+static DFBResult
+allocate_surface( CoreLayer             *layer,
+                  CoreLayerRegion       *region,
+                  CoreLayerRegionConfig *config )
+{
+     DFBResult                ret;
+     const DisplayLayerFuncs *funcs;
+     CoreLayerContext        *context;
+     CoreSurface             *surface = NULL;
+     DFBSurfaceCapabilities   caps    = DSCAPS_VIDEOONLY;
+     CoreSurfaceTypeFlags     type    = CSTF_LAYER;
+     CoreSurfaceConfig        scon;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p )\n", __FUNCTION__, layer, region, config );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->surface == NULL );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->buffermode != DLBM_WINDOWS );
+
+     context = region->context;
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     funcs = layer->funcs;
+
+     /*
+      * Create a new surface for the region.
+      * Drivers may provide their own surface creation (unusual).
+      */
+     if (funcs->AllocateSurface) {
+          /* Let the driver create the surface. */
+          ret = funcs->AllocateSurface( layer, layer->driver_data,
+                                        layer->layer_data, region->region_data,
+                                        config, &surface );
+          if (ret) {
+               D_ERROR( "DirectFB/core/layers: AllocateSurface() failed!\n" );
+               return ret;
+          }
+     }
+     else {
+          CoreLayerShared *shared = layer->shared;
+
+          /* Choose surface capabilities depending on the buffer mode. */
+          switch (config->buffermode) {
+               case DLBM_FRONTONLY:
+                    break;
+
+               case DLBM_BACKVIDEO:
+               case DLBM_BACKSYSTEM:
+                    caps |= DSCAPS_DOUBLE;
+                    break;
+
+               case DLBM_TRIPLE:
+                    caps |= DSCAPS_TRIPLE;
+                    break;
+
+               default:
+                    D_BUG("unknown buffermode");
+                    break;
+          }
+
+          if (context->rotation == 90 || context->rotation == 270)
+               caps |= DSCAPS_ROTATED;
+
+          /* FIXME: remove this? */
+          if (config->options & DLOP_DEINTERLACING)
+               caps |= DSCAPS_INTERLACED;
+
+          /* Add available surface capabilities. */
+          caps |= config->surface_caps & (DSCAPS_INTERLACED |
+                                          DSCAPS_SEPARATED  |
+                                          DSCAPS_PREMULTIPLIED);
+
+          scon.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+          scon.size.w = config->width;
+          scon.size.h = config->height;
+          scon.format = config->format;
+          scon.caps   = caps;
+
+          if (shared->contexts.primary == region->context)
+               type |= CSTF_SHARED;
+
+          /* Use the default surface creation. */
+          ret = dfb_surface_create( layer->core, &scon, type, shared->layer_id, NULL, &surface );
+          if (ret) {
+               D_DERROR( ret, "Core/layers: Surface creation failed!\n" );
+               return ret;
+          }
+
+          if (config->buffermode == DLBM_BACKSYSTEM)
+               surface->buffers[1]->policy = CSP_SYSTEMONLY;
+     }
+
+     if (surface->config.caps & DSCAPS_ROTATED)
+          surface->rotation = context->rotation;
+     else
+          surface->rotation = (context->rotation == 180) ? 180 : 0;
+
+     /* Tell the region about its new surface (adds a global reference). */
+     ret = dfb_layer_region_set_surface( region, surface );
+
+     /* Remove local reference of dfb_surface_create(). */
+     dfb_surface_unref( surface );
+
+     return ret;
+}
+
+static DFBResult
+reallocate_surface( CoreLayer             *layer,
+                    CoreLayerRegion       *region,
+                    CoreLayerRegionConfig *config )
+{
+     DFBResult                ret;
+     const DisplayLayerFuncs *funcs;
+     CoreLayerContext        *context;
+     CoreSurface             *surface;
+     CoreSurfaceConfig        sconfig;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p )\n", __FUNCTION__, layer, region, config );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->surface != NULL );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->buffermode != DLBM_WINDOWS );
+
+     context = region->context;
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     funcs   = layer->funcs;
+     surface = region->surface;
+
+     if (funcs->ReallocateSurface)
+          return funcs->ReallocateSurface( layer, layer->driver_data,
+                                           layer->layer_data,
+                                           region->region_data,
+                                           config, surface );
+
+     sconfig.flags = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+
+     sconfig.caps = surface->config.caps & ~(DSCAPS_FLIPPING  | DSCAPS_INTERLACED |
+                                             DSCAPS_SEPARATED | DSCAPS_PREMULTIPLIED | DSCAPS_ROTATED);
+
+     switch (config->buffermode) {
+          case DLBM_TRIPLE:
+               sconfig.caps |= DSCAPS_TRIPLE;
+               break;
+
+          case DLBM_BACKVIDEO:
+          case DLBM_BACKSYSTEM:
+               sconfig.caps |= DSCAPS_DOUBLE;
+               break;
+
+          case DLBM_FRONTONLY:
+               break;
+
+          default:
+               D_BUG("unknown buffermode");
+               return DFB_BUG;
+     }
+
+     if (context->rotation == 90 || context->rotation == 270)
+          sconfig.caps |= DSCAPS_ROTATED;
+
+     /* Add available surface capabilities. */
+     sconfig.caps |= config->surface_caps & (DSCAPS_INTERLACED |
+                                             DSCAPS_SEPARATED  |
+                                             DSCAPS_PREMULTIPLIED); 
+
+     if (config->options & DLOP_DEINTERLACING)
+          sconfig.caps |= DSCAPS_INTERLACED;
+
+     sconfig.size.w = config->width;
+     sconfig.size.h = config->height;
+     sconfig.format = config->format;
+
+     ret = dfb_surface_lock( surface );
+     if (ret)
+          return ret;
+
+     ret = dfb_surface_reconfig( surface, &sconfig );
+     if (ret) {
+          dfb_surface_unlock( surface );
+          return ret;
+     }
+
+     if (DFB_PIXELFORMAT_IS_INDEXED(surface->config.format) && !surface->palette) {
+          ret = dfb_surface_init_palette( layer->core, surface );
+          if (ret)
+               D_DERROR( ret, "Core/Layers: Could not initialize palette while switching to indexed mode!\n" );
+     }
+
+     switch (config->buffermode) {
+          case DLBM_TRIPLE:
+          case DLBM_BACKVIDEO:
+               surface->buffers[1]->policy = CSP_VIDEOONLY;
+               break;
+
+          case DLBM_BACKSYSTEM:
+               surface->buffers[1]->policy = CSP_SYSTEMONLY;
+               break;
+
+          case DLBM_FRONTONLY:
+               break;
+
+          default:
+               D_BUG("unknown buffermode");
+               return DFB_BUG;
+     }
+
+     if (surface->config.caps & DSCAPS_ROTATED)
+          surface->rotation = context->rotation;
+     else
+          surface->rotation = (context->rotation == 180) ? 180 : 0;
+
+     dfb_surface_unlock( surface );
+     
+     return DFB_OK;
+}
+
+static DFBResult
+deallocate_surface( CoreLayer *layer, CoreLayerRegion *region )
+{
+     DFBResult                ret;
+     const DisplayLayerFuncs *funcs;
+     CoreSurface             *surface;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p )\n", __FUNCTION__, layer, region );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( region != NULL );
+
+     D_ASSUME( region->surface != NULL );
+
+     funcs   = layer->funcs;
+     surface = region->surface;
+
+     if (surface) {
+          /* Special deallocation by the driver. */
+          if (funcs->DeallocateSurface) {
+               ret = funcs->DeallocateSurface( layer, layer->driver_data,
+                                               layer->layer_data,
+                                               region->region_data, surface );
+               if (ret)
+                    return ret;
+          }
+
+          /* Detach the global listener. */
+          dfb_surface_detach_global( surface, ®ion->surface_reaction );
+
+          /* Unlink from structure. */
+          dfb_surface_unlink( ®ion->surface );
+     }
+
+     return DFB_OK;
+}
+
+static void
+screen_rectangle( CoreLayerContext  *context,
+                  const DFBLocation *location,
+                  DFBRectangle      *rect )
+{
+     DFBResult  ret;
+     int        width;
+     int        height;
+     CoreLayer *layer;
+
+     D_DEBUG_AT( Core_LayerContext, "%s( %p, %p, %p )\n", __FUNCTION__, context, location, rect );
+
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+     D_ASSERT( location != NULL );
+     D_ASSERT( rect != NULL );
+
+     D_DEBUG_AT( Core_LayerContext, "  <- %4.2f,%4.2f-%4.2f,%4.2f\n",
+                 location->x, location->y, location->w, location->h );
+
+     layer = dfb_layer_at( context->layer_id );
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->screen != NULL );
+
+     ret = dfb_screen_get_layer_dimension( layer->screen, layer, &width, &height );
+     if (ret) {
+          D_WARN( "could not determine mixer/screen dimension of layer %d", context->layer_id );
+
+          rect->x = location->x * 720;
+          rect->y = location->y * 576;
+          rect->w = location->w * 720;
+          rect->h = location->h * 576;
+     }
+     else {
+          rect->x = location->x * width;
+          rect->y = location->y * height;
+          rect->w = location->w * width;
+          rect->h = location->h * height;
+     }
+
+     D_DEBUG_AT( Core_LayerContext, "  => %4d,%4d-%4d,%4d\n", DFB_RECTANGLE_VALS(rect) );
+}
+
diff --git a/Source/DirectFB/src/core/layer_context.h b/Source/DirectFB/src/core/layer_context.h
new file mode 100755
index 0000000..ab9d2fb
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_context.h
@@ -0,0 +1,149 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__LAYER_CONTEXT_H__
+#define __CORE__LAYER_CONTEXT_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+#include <fusion/object.h>
+
+typedef enum {
+     CLCNF_ACTIVATED   = 0x00000001,
+     CLCNF_DEACTIVATED = 0x00000002
+} CoreLayerContextNotificationFlags;
+
+typedef struct {
+     CoreLayerContextNotificationFlags  flags;
+     CoreLayerContext                  *context;
+} CoreLayerContextNotification;
+
+/*
+ * Creates a pool of layer context objects.
+ */
+FusionObjectPool *dfb_layer_context_pool_create( const FusionWorld *world );
+
+/*
+ * Generates dfb_layer_context_ref(), dfb_layer_context_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreLayerContext, dfb_layer_context )
+
+
+DFBResult dfb_layer_context_init( CoreLayerContext *context,
+                                  CoreLayer        *layer );
+
+DFBResult dfb_layer_context_get_primary_region( CoreLayerContext  *context,
+                                                bool               create,
+                                                CoreLayerRegion  **ret_region );
+
+/*
+ * configuration testing/setting/getting
+ */
+DFBResult dfb_layer_context_test_configuration ( CoreLayerContext            *context,
+                                                 const DFBDisplayLayerConfig *config,
+                                                 DFBDisplayLayerConfigFlags  *ret_failed );
+
+DFBResult dfb_layer_context_set_configuration  ( CoreLayerContext            *context,
+                                                 const DFBDisplayLayerConfig *config );
+
+DFBResult dfb_layer_context_get_configuration  ( CoreLayerContext            *context,
+                                                 DFBDisplayLayerConfig       *ret_config );
+
+
+/*
+ * configuration details
+ */
+DFBResult dfb_layer_context_set_src_colorkey   ( CoreLayerContext            *context,
+                                                 u8                           r,
+                                                 u8                           g,
+                                                 u8                           b,
+                                                 int                          index );
+
+DFBResult dfb_layer_context_set_dst_colorkey   ( CoreLayerContext            *context,
+                                                 u8                           r,
+                                                 u8                           g,
+                                                 u8                           b,
+                                                 int                          index );
+
+DFBResult dfb_layer_context_set_sourcerectangle( CoreLayerContext            *context,
+                                                 const DFBRectangle          *source );
+
+DFBResult dfb_layer_context_set_screenlocation ( CoreLayerContext            *context,
+                                                 const DFBLocation           *location );
+
+DFBResult dfb_layer_context_set_screenrectangle( CoreLayerContext            *context,
+                                                 const DFBRectangle          *rectangle );
+
+DFBResult dfb_layer_context_set_screenposition ( CoreLayerContext            *context,
+                                                 int                          x,
+                                                 int                          y );
+
+DFBResult dfb_layer_context_set_opacity        ( CoreLayerContext            *context,
+                                                 u8                           opacity );
+
+DFBResult dfb_layer_context_set_rotation       ( CoreLayerContext            *context,
+                                                 int                          rotation );
+
+DFBResult dfb_layer_context_set_coloradjustment( CoreLayerContext            *context,
+                                                 const DFBColorAdjustment    *adjustment );
+
+DFBResult dfb_layer_context_get_coloradjustment( CoreLayerContext            *context,
+                                                 DFBColorAdjustment          *ret_adjustment );
+
+DFBResult dfb_layer_context_set_field_parity   ( CoreLayerContext            *context,
+                                                 int                          field );
+
+DFBResult dfb_layer_context_set_clip_regions   ( CoreLayerContext            *context,
+                                                 const DFBRegion             *regions,
+                                                 int                          num_regions,
+                                                 DFBBoolean                   positive );
+
+
+/*
+ * window control
+ */
+DFBResult dfb_layer_context_create_window( CoreDFB                     *core,
+                                           CoreLayerContext            *context,
+                                           const DFBWindowDescription  *desc,
+                                           CoreWindow                 **ret_window );
+
+CoreWindow      *dfb_layer_context_find_window( CoreLayerContext       *context,
+                                                DFBWindowID             id );
+
+CoreWindowStack *dfb_layer_context_windowstack( const CoreLayerContext *context );
+
+bool             dfb_layer_context_active     ( const CoreLayerContext *context );
+
+/*
+ * Locking
+ */
+DirectResult dfb_layer_context_lock  ( CoreLayerContext *context );
+DirectResult dfb_layer_context_unlock( CoreLayerContext *context );
+
+#endif
diff --git a/Source/DirectFB/src/core/layer_control.c b/Source/DirectFB/src/core/layer_control.c
new file mode 100755
index 0000000..b190cc5
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_control.c
@@ -0,0 +1,589 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <fusion/shmalloc.h>
+#include <fusion/arena.h>
+#include <fusion/property.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core_parts.h>
+
+#include <core/input.h>
+#include <core/gfxcard.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers.h>
+#include <core/screen.h>
+#include <core/state.h>
+#include <core/palette.h>
+#include <core/system.h>
+#include <core/windows.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <core/layers_internal.h>
+
+
+D_DEBUG_DOMAIN( Core_Layers, "Core/Layers", "DirectFB Display Layer Core" );
+
+/** public **/
+
+DFBResult
+dfb_layer_suspend( CoreLayer *layer )
+{
+     CoreLayerShared   *shared;
+     CoreLayerContexts *contexts;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     shared   = layer->shared;
+     contexts = &shared->contexts;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     D_ASSUME( !shared->suspended );
+
+     if (shared->suspended) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_OK;
+     }
+
+     /* Deactivate current context. */
+     if (contexts->active >= 0) {
+          DFBResult         ret;
+          CoreLayerContext *current = fusion_vector_at( &contexts->stack,
+                                                         contexts->active );
+
+          ret = dfb_layer_context_deactivate( current );
+          if (ret) {
+               D_ERROR("DirectFB/Core/layer: "
+                        "Could not deactivate current context of '%s'! (%s)\n",
+                        shared->description.name, DirectFBErrorString( ret ));
+          }
+     }
+
+     shared->suspended = true;
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_resume( CoreLayer *layer )
+{
+     CoreLayerShared   *shared;
+     CoreLayerContexts *contexts;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     shared   = layer->shared;
+     contexts = &shared->contexts;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     D_ASSUME( shared->suspended );
+
+     if (!shared->suspended) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_OK;
+     }
+
+     /* (Re)Activate current context. */
+     if (contexts->active >= 0) {
+          DFBResult         ret;
+          CoreLayerContext *current = fusion_vector_at( &contexts->stack,
+                                                         contexts->active );
+
+          ret = dfb_layer_context_activate( current );
+          if (ret) {
+               D_ERROR("DirectFB/Core/layer: "
+                        "Could not activate current context of '%s'! (%s)\n",
+                        shared->description.name, DirectFBErrorString( ret ));
+          }
+     }
+
+     shared->suspended = false;
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_create_context( CoreLayer         *layer,
+                          CoreLayerContext **ret_context )
+{
+     DFBResult          ret;
+     CoreLayerShared   *shared;
+     CoreLayerContexts *contexts;
+     CoreLayerContext  *context = NULL;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( ret_context != NULL );
+
+     shared   = layer->shared;
+     contexts = &shared->contexts;
+
+     D_DEBUG_AT( Core_Layers, "%s (%s)\n", __FUNCTION__, shared->description.name );
+
+     /* Create the object. */
+     context = dfb_core_create_layer_context( layer->core );
+     if (!context)
+          return DFB_FUSION;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock )) {
+          fusion_object_destroy( &context->object );
+          return DFB_FUSION;
+     }
+
+     /* Initialize the new context. */
+     ret = dfb_layer_context_init( context, layer );
+     if (ret) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return ret;
+     }
+
+     /* Add it to the context stack. */
+     if (fusion_vector_add( &contexts->stack, context )) {
+          dfb_layer_context_unref( context );
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_FUSION;
+     }
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     /* Return the context. */
+     *ret_context = context;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_get_active_context( CoreLayer         *layer,
+                              CoreLayerContext **ret_context )
+{
+     CoreLayerShared   *shared;
+     CoreLayerContexts *contexts;
+     CoreLayerContext  *context;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( ret_context != NULL );
+
+     shared   = layer->shared;
+     contexts = &shared->contexts;
+
+     D_DEBUG_AT( Core_Layers, "%s (%s)\n", __FUNCTION__, shared->description.name );
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     /* Check for active context. */
+     if (contexts->active < 0) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_NOCONTEXT;
+     }
+
+     /* Fetch active context. */
+     context = fusion_vector_at( &contexts->stack, contexts->active );
+
+     /* Increase the context's reference counter. */
+     if (dfb_layer_context_ref( context )) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_FUSION;
+     }
+
+     D_DEBUG_AT( Core_Layers, "  => %p [%4dx%4d %8s]\n", context,
+                 context->config.width, context->config.height,
+                 dfb_pixelformat_name( context->config.pixelformat ) );
+
+     /* Return the context. */
+     *ret_context = context;
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_get_primary_context( CoreLayer         *layer,
+                               bool               activate,
+                               CoreLayerContext **ret_context )
+{
+     DFBResult          ret;
+     CoreLayerShared   *shared;
+     CoreLayerContexts *contexts;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( ret_context != NULL );
+
+     shared   = layer->shared;
+     contexts = &shared->contexts;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     D_DEBUG_AT( Core_Layers, "%s (%s, %sactivate) <- active: %d\n",
+                 __FUNCTION__, shared->description.name,
+                 activate ? "" : "don't ", contexts->active );
+
+     /* Check for primary context. */
+     if (contexts->primary) {
+          /* Increase the context's reference counter. */
+          if (dfb_layer_context_ref( contexts->primary )) {
+               fusion_skirmish_dismiss( &shared->lock );
+               return DFB_FUSION;
+          }
+     }
+     else {
+          CoreLayerContext *primary;
+
+          /* Unlock the layer. */
+          fusion_skirmish_dismiss( &shared->lock );
+
+          /* Create the primary (shared) context. */
+          ret = dfb_layer_create_context( layer, &primary );
+          if (ret)
+               return ret;
+
+          /* Lock the layer again. */
+          if (fusion_skirmish_prevail( &shared->lock )) {
+               dfb_layer_context_unref( primary );
+               return DFB_FUSION;
+          }
+
+          /* Check if there was a race. */
+          if (contexts->primary) {
+               /* Throw away ours, the other was faster. */
+               dfb_layer_context_unref( primary );
+
+               /* Increase the context's reference counter. */
+               if (dfb_layer_context_ref( contexts->primary )) {
+                    fusion_skirmish_dismiss( &shared->lock );
+                    return DFB_FUSION;
+               }
+          }
+          else
+               contexts->primary = primary;
+     }
+
+     /* Activate if no context is active? */
+     if (contexts->active < 0 && activate) {
+          ret = dfb_layer_activate_context( layer, contexts->primary );
+          if (ret) {
+               dfb_layer_context_unref( contexts->primary );
+               fusion_skirmish_dismiss( &shared->lock );
+               return ret;
+          }
+     }
+
+     /* Return the context. */
+     *ret_context = contexts->primary;
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_activate_context( CoreLayer        *layer,
+                            CoreLayerContext *context )
+{
+     DFBResult          ret = DFB_OK;
+     int                index;
+     CoreLayerShared   *shared;
+     CoreLayerContexts *ctxs;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( context != NULL );
+
+     shared = layer->shared;
+     ctxs   = &shared->contexts;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     D_DEBUG_AT( Core_Layers, "%s (%s, %p)\n", __FUNCTION__, shared->description.name, context );
+
+     D_ASSERT( fusion_vector_contains( &ctxs->stack, context ) );
+
+     /* Lookup the context in the context stack. */
+     index = fusion_vector_index_of( &ctxs->stack, context );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context )) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_FUSION;
+     }
+
+     /* Need to activate? */
+     if (ctxs->active != index) {
+          DFBResult ret;
+
+          /* Another context currently active? */
+          if (ctxs->active >= 0) {
+               CoreLayerContext *current = fusion_vector_at( &ctxs->stack,
+                                                              ctxs->active );
+
+               /* Deactivate current context. */
+               if (!shared->suspended) {
+                    ret = dfb_layer_context_deactivate( current );
+                    if (ret)
+                         goto error;
+               }
+
+               /* No active context. */
+               ctxs->active = -1;
+          }
+
+          /* Activate context now. */
+          if (!shared->suspended) {
+               ret = dfb_layer_context_activate( context );
+               if (ret)
+                    goto error;
+          }
+
+          ctxs->active = index;
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+
+error:
+     dfb_layer_context_unlock( context );
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_remove_context( CoreLayer        *layer,
+                          CoreLayerContext *context )
+{
+     int                index;
+     CoreLayerShared   *shared;
+     CoreLayerContexts *ctxs;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( context != NULL );
+
+     shared = layer->shared;
+     ctxs   = &shared->contexts;
+
+     /* Lock the layer. */
+     if (fusion_skirmish_prevail( &shared->lock ))
+          return DFB_FUSION;
+
+     D_DEBUG_AT( Core_Layers, "%s (%s, %p)\n", __FUNCTION__, shared->description.name, context );
+
+     D_ASSUME( fusion_vector_contains( &ctxs->stack, context ) );
+
+     /* Lookup the context in the context stack. */
+     index = fusion_vector_index_of( &ctxs->stack, context );
+     if (index < 0) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_OK;
+     }
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context )) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return DFB_FUSION;
+     }
+
+     /* Remove context from context stack. */
+     fusion_vector_remove( &ctxs->stack, index );
+
+     /* Check if the primary context is removed. */
+     if (context == ctxs->primary)
+          ctxs->primary = NULL;
+
+     /* Need to deactivate? */
+     if (ctxs->active == index) {
+          /* Deactivate the context. */
+          if (!shared->suspended)
+               dfb_layer_context_deactivate( context );
+
+          /* There's no active context anymore. */
+          ctxs->active = -1;
+
+          if (ctxs->primary)
+               D_ASSERT( fusion_vector_contains( &ctxs->stack, ctxs->primary ) );
+
+          if (fusion_vector_has_elements( &ctxs->stack )) {
+               CoreLayerContext *ctx;
+
+               /* Activate most recent context. */
+               index = fusion_vector_size( &ctxs->stack ) - 1;
+               ctx   = fusion_vector_at( &ctxs->stack, index );
+
+               if (shared->suspended || dfb_layer_context_activate( ctx ) == DFB_OK)
+                    ctxs->active = index;
+          }
+     }
+     else if (ctxs->active > index) {
+          /* Adjust index of active context due to the removed context. */
+          ctxs->active--;
+     }
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     /* Unlock the layer. */
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_get_current_output_field( CoreLayer *layer, int *field )
+{
+     DFBResult ret;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( field != NULL );
+
+     if (!layer->funcs->GetCurrentOutputField)
+          return DFB_UNSUPPORTED;
+
+     ret = layer->funcs->GetCurrentOutputField( layer, layer->driver_data,
+                                                layer->layer_data, field );
+     if (ret)
+          return ret;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_get_level( CoreLayer *layer, int *ret_level )
+{
+     const DisplayLayerFuncs *funcs;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( ret_level != NULL );
+
+     funcs = layer->funcs;
+
+     if (!funcs->GetLevel)
+          return DFB_UNSUPPORTED;
+
+     return funcs->GetLevel( layer, layer->driver_data,
+                             layer->layer_data, ret_level );
+}
+
+DFBResult
+dfb_layer_set_level( CoreLayer *layer, int level )
+{
+     const DisplayLayerFuncs *funcs;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     funcs = layer->funcs;
+
+     if (!funcs->SetLevel)
+          return DFB_UNSUPPORTED;
+
+     return funcs->SetLevel( layer, layer->driver_data,
+                             layer->layer_data, level );
+}
+
+DFBResult
+dfb_layer_wait_vsync( CoreLayer *layer )
+{
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->screen != NULL );
+
+     return dfb_screen_wait_vsync( layer->screen );
+}
+
+DFBResult
+dfb_layer_get_source_info( CoreLayer                        *layer,
+                           int                               source,
+                           DFBDisplayLayerSourceDescription *ret_desc )
+{
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( source >= 0 );
+     D_ASSERT( source < layer->shared->description.sources );
+     D_ASSERT( ret_desc != NULL );
+
+     *ret_desc = layer->shared->sources[source].description;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/layer_control.h b/Source/DirectFB/src/core/layer_control.h
new file mode 100755
index 0000000..51b7ae2
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_control.h
@@ -0,0 +1,72 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__LAYER_CONTROL_H__
+#define __CORE__LAYER_CONTROL_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+
+DFBResult dfb_layer_create_context          ( CoreLayer          *layer,
+                                              CoreLayerContext  **ret_context );
+
+DFBResult dfb_layer_get_active_context      ( CoreLayer          *layer,
+                                              CoreLayerContext  **ret_context );
+
+DFBResult dfb_layer_get_primary_context     ( CoreLayer          *layer,
+                                              bool                activate,
+                                              CoreLayerContext  **ret_context );
+
+DFBResult dfb_layer_activate_context        ( CoreLayer          *layer,
+                                              CoreLayerContext   *context );
+
+DFBResult dfb_layer_remove_context          ( CoreLayer          *layer,
+                                              CoreLayerContext   *context );
+
+DFBResult dfb_layer_suspend                 ( CoreLayer          *layer );
+DFBResult dfb_layer_resume                  ( CoreLayer          *layer );
+
+
+DFBResult dfb_layer_get_current_output_field( CoreLayer          *layer,
+                                              int                *field );
+
+DFBResult dfb_layer_get_level               ( CoreLayer          *layer,
+                                              int                *ret_level );
+
+DFBResult dfb_layer_set_level               ( CoreLayer          *layer,
+                                              int                 level );
+
+DFBResult dfb_layer_wait_vsync              ( CoreLayer          *layer );
+
+DFBResult dfb_layer_get_source_info         ( CoreLayer                        *layer,
+                                              int                               source,
+                                              DFBDisplayLayerSourceDescription *ret_desc );
+
+#endif
diff --git a/Source/DirectFB/src/core/layer_region.c b/Source/DirectFB/src/core/layer_region.c
new file mode 100755
index 0000000..b96e742
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_region.c
@@ -0,0 +1,1129 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/gfxcard.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers_internal.h>
+#include <core/surface.h>
+
+#include <gfx/util.h>
+
+
+D_DEBUG_DOMAIN( Core_Layers, "Core/Layers", "DirectFB Display Layer Core" );
+
+
+static DFBResult region_buffer_lock( CoreLayerRegion       *region,
+                                     CoreSurface           *surface,
+                                     CoreSurfaceBufferRole  role );
+
+static DFBResult set_region      ( CoreLayerRegion            *region,
+                                   CoreLayerRegionConfig      *config,
+                                   CoreLayerRegionConfigFlags  flags,
+                                   CoreSurface                *surface );
+
+static DFBResult realize_region  ( CoreLayerRegion            *region );
+
+static DFBResult unrealize_region( CoreLayerRegion            *region );
+
+/******************************************************************************/
+
+static void
+region_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+     CoreLayerRegion  *region  = (CoreLayerRegion*) object;
+     CoreLayerContext *context = region->context;
+     CoreLayer        *layer   = dfb_layer_at( context->layer_id );
+     CoreLayerShared  *shared  = layer->shared;
+
+     D_DEBUG_AT( Core_Layers, "destroying region %p (%s, %dx%d, "
+                 "%s, %s, %s, %s%s)\n", region, shared->description.name,
+                 region->config.width, region->config.height,
+                 D_FLAGS_IS_SET( region->state,
+                                 CLRSF_CONFIGURED ) ? "configured" : "unconfigured",
+                 D_FLAGS_IS_SET( region->state,
+                                 CLRSF_ENABLED ) ? "enabled" : "disabled",
+                 D_FLAGS_IS_SET( region->state,
+                                 CLRSF_ACTIVE ) ? "active" : "inactive",
+                 D_FLAGS_IS_SET( region->state,
+                                 CLRSF_REALIZED ) ? "realized" : "not realized",
+                 zombie ? " - ZOMBIE" : "" );
+
+     /* Hide region etc. */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_ENABLED ))
+          dfb_layer_region_disable( region );
+
+     /* Remove the region from the context. */
+     dfb_layer_context_remove_region( region->context, region );
+
+     /* Throw away its surface. */
+     if (region->surface) {
+          /* Detach the global listener. */
+          dfb_surface_detach_global( region->surface,
+                                     ®ion->surface_reaction );
+
+          /* Unlink from structure. */
+          dfb_surface_unlink( ®ion->surface );
+     }
+
+     /* Unlink the context from the structure. */
+     dfb_layer_context_unlink( ®ion->context );
+
+     /* Free driver's region data. */
+     if (region->region_data)
+          SHFREE( shared->shmpool, region->region_data );
+
+     /* Deinitialize the lock. */
+     fusion_skirmish_destroy( ®ion->lock );
+
+     /* Destroy the object. */
+     fusion_object_destroy( object );
+}
+
+/******************************************************************************/
+
+FusionObjectPool *
+dfb_layer_region_pool_create( const FusionWorld *world )
+{
+     return fusion_object_pool_create( "Layer Region Pool",
+                                       sizeof(CoreLayerRegion),
+                                       sizeof(CoreLayerRegionNotification),
+                                       region_destructor, NULL, world );
+}
+
+/******************************************************************************/
+
+DFBResult
+dfb_layer_region_create( CoreLayerContext  *context,
+                         CoreLayerRegion  **ret_region )
+{
+     CoreLayer       *layer;
+     CoreLayerRegion *region;
+
+     D_ASSERT( context != NULL );
+     D_ASSERT( ret_region != NULL );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     /* Create the object. */
+     region = dfb_core_create_layer_region( layer->core );
+     if (!region)
+          return DFB_FUSION;
+
+     /* Link the context into the structure. */
+     if (dfb_layer_context_link( ®ion->context, context )) {
+          fusion_object_destroy( ®ion->object );
+          return DFB_FUSION;
+     }
+
+     /* Initialize the lock. */
+     if (fusion_skirmish_init( ®ion->lock, "Layer Region", dfb_core_world(layer->core) )) {
+          dfb_layer_context_unlink( ®ion->context );
+          fusion_object_destroy( ®ion->object );
+          return DFB_FUSION;
+     }
+
+     /* Change global reaction lock. */
+     fusion_object_set_lock( ®ion->object, ®ion->lock );
+
+     region->state = CLRSF_FROZEN;
+
+     /* Activate the object. */
+     fusion_object_activate( ®ion->object );
+
+     /* Add the region to the context. */
+     dfb_layer_context_add_region( context, region );
+
+     /* Return the new region. */
+     *ret_region = region;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_activate( CoreLayerRegion *region )
+{
+     DFBResult ret;
+
+     D_ASSERT( region != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( ! D_FLAGS_IS_SET( region->state, CLRSF_ACTIVE ) );
+
+     if (D_FLAGS_IS_SET( region->state, CLRSF_ACTIVE )) {
+          dfb_layer_region_unlock( region );
+          return DFB_OK;
+     }
+
+     /* Realize the region if it's enabled. */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_ENABLED )) {
+          ret = realize_region( region );
+          if (ret) {
+               dfb_layer_region_unlock( region );
+               return ret;
+          }
+     }
+
+     /* Update the region's state. */
+     D_FLAGS_SET( region->state, CLRSF_ACTIVE );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_deactivate( CoreLayerRegion *region )
+{
+     DFBResult ret;
+
+     D_ASSERT( region != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( D_FLAGS_IS_SET( region->state, CLRSF_ACTIVE ) );
+
+     if (! D_FLAGS_IS_SET( region->state, CLRSF_ACTIVE )) {
+          dfb_layer_region_unlock( region );
+          return DFB_OK;
+     }
+
+     /* Unrealize the region? */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+          ret = unrealize_region( region );
+          if (ret)
+               return ret;
+     }
+
+     /* Update the region's state. */
+     D_FLAGS_CLEAR( region->state, CLRSF_ACTIVE );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_enable( CoreLayerRegion *region )
+{
+     DFBResult ret;
+
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->context != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( ! D_FLAGS_IS_SET( region->state, CLRSF_ENABLED ) );
+
+     if (D_FLAGS_IS_SET( region->state, CLRSF_ENABLED )) {
+          dfb_layer_region_unlock( region );
+          return DFB_OK;
+     }
+
+     /* Realize the region if it's active. */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_ACTIVE )) {
+          ret = realize_region( region );
+          if (ret) {
+               dfb_layer_region_unlock( region );
+               return ret;
+          }
+     }
+
+     /* Update the region's state. */
+     D_FLAGS_SET( region->state, CLRSF_ENABLED );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_disable( CoreLayerRegion *region )
+{
+     DFBResult ret;
+
+     D_ASSERT( region != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( D_FLAGS_IS_SET( region->state, CLRSF_ENABLED ) );
+
+     if (! D_FLAGS_IS_SET( region->state, CLRSF_ENABLED )) {
+          dfb_layer_region_unlock( region );
+          return DFB_OK;
+     }
+
+     /* Unrealize the region? */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+          ret = unrealize_region( region );
+          if (ret)
+               return ret;
+     }
+
+     /* Update the region's state. */
+     D_FLAGS_CLEAR( region->state, CLRSF_ENABLED );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_set_surface( CoreLayerRegion *region,
+                              CoreSurface     *surface )
+{
+     DFBResult ret;
+
+     D_ASSERT( region != NULL );
+     D_ASSERT( surface != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     if (region->surface != surface) {
+          /* Setup hardware for the new surface if the region is realized. */
+          if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+               ret = set_region( region, ®ion->config, CLRCF_SURFACE | CLRCF_PALETTE, surface );
+               if (ret) {
+                    dfb_layer_region_unlock( region );
+                    return ret;
+               }
+          }
+
+          /* Throw away the old surface. */
+          if (region->surface) {
+               /* Detach the global listener. */
+               dfb_surface_detach_global( region->surface,
+                                          ®ion->surface_reaction );
+
+               /* Unlink surface from structure. */
+               dfb_surface_unlink( ®ion->surface );
+          }
+
+          /* Take the new surface. */
+          if (surface) {
+               /* Link surface into structure. */
+               if (dfb_surface_link( ®ion->surface, surface )) {
+                    D_WARN( "region lost it's surface" );
+                    dfb_layer_region_unlock( region );
+                    return DFB_FUSION;
+               }
+
+               /* Attach the global listener. */
+               dfb_surface_attach_global( region->surface,
+                                          DFB_LAYER_REGION_SURFACE_LISTENER,
+                                          region, ®ion->surface_reaction );
+          }
+     }
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_get_surface( CoreLayerRegion  *region,
+                              CoreSurface     **ret_surface )
+{
+     D_ASSERT( region != NULL );
+     D_ASSERT( ret_surface != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( region->surface != NULL );
+
+     /* Check for NULL surface. */
+     if (!region->surface) {
+          dfb_layer_region_unlock( region );
+          return DFB_UNSUPPORTED;
+     }
+
+     /* Increase the surface's reference counter. */
+     if (dfb_surface_ref( region->surface )) {
+          dfb_layer_region_unlock( region );
+          return DFB_FUSION;
+     }
+
+     /* Return the surface. */
+     *ret_surface = region->surface;
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_flip_update( CoreLayerRegion     *region,
+                              const DFBRegion     *update,
+                              DFBSurfaceFlipFlags  flags )
+{
+     DFBResult                ret = DFB_OK;
+     DFBRegion                unrotated;
+     DFBRegion                rotated;
+     CoreLayer               *layer;
+     CoreLayerContext        *context;
+     CoreSurface             *surface;
+     const DisplayLayerFuncs *funcs;
+
+     if (update)
+          D_DEBUG_AT( Core_Layers,
+                      "dfb_layer_region_flip_update( %p, %p, 0x%08x ) <- [%d, %d - %dx%d]\n",
+                      region, update, flags, DFB_RECTANGLE_VALS_FROM_REGION( update ) );
+     else
+          D_DEBUG_AT( Core_Layers,
+                      "dfb_layer_region_flip_update( %p, %p, 0x%08x )\n", region, update, flags );
+
+
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->context != NULL );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     D_ASSUME( region->surface != NULL );
+
+     /* Check for NULL surface. */
+     if (!region->surface) {
+          D_DEBUG_AT( Core_Layers, "  -> No surface => no update!\n" );
+          dfb_layer_region_unlock( region );
+          return DFB_UNSUPPORTED;
+     }
+
+     context = region->context;
+     surface = region->surface;
+     layer   = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer->funcs != NULL );
+
+     funcs = layer->funcs;
+
+     /* Unfreeze region? */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_FROZEN )) {
+          D_FLAGS_CLEAR( region->state, CLRSF_FROZEN );
+
+          if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+               ret = set_region( region, ®ion->config, CLRCF_ALL, surface );
+               if (ret)
+                    D_DERROR( ret, "Core/LayerRegion: set_region() in dfb_layer_region_flip_update() failed!\n" );
+          }
+          else if (D_FLAGS_ARE_SET( region->state, CLRSF_ENABLED | CLRSF_ACTIVE )) {
+               ret = realize_region( region );
+               if (ret)
+                    D_DERROR( ret, "Core/LayerRegion: realize_region() in dfb_layer_region_flip_update() failed!\n" );
+          }
+
+          if (ret) {
+               dfb_layer_region_unlock( region );
+               return ret;
+          }
+     }
+
+     /* Depending on the buffer mode... */
+     switch (region->config.buffermode) {
+          case DLBM_TRIPLE:
+          case DLBM_BACKVIDEO:
+               /* Check if simply swapping the buffers is possible... */
+               if (!(flags & DSFLIP_BLIT) && !surface->rotation &&
+                   (!update || (update->x1 == 0 &&
+                                update->y1 == 0 &&
+                                update->x2 == surface->config.size.w - 1 &&
+                                update->y2 == surface->config.size.h - 1)))
+               {
+                    D_DEBUG_AT( Core_Layers, "  -> Going to swap buffers...\n" );
+
+                    /* Use the driver's routine if the region is realized. */
+                    if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+                         D_ASSUME( funcs->FlipRegion != NULL );
+
+                         ret = region_buffer_lock( region, surface, CSBR_BACK );
+                         if (ret) {
+                              dfb_layer_region_unlock( region );
+                              return ret;
+                         }
+
+                         D_DEBUG_AT( Core_Layers, "  -> Flipping region using driver...\n" );
+
+                         if (funcs->FlipRegion)
+                              ret = funcs->FlipRegion( layer,
+                                                       layer->driver_data,
+                                                       layer->layer_data,
+                                                       region->region_data,
+                                                       surface, flags, ®ion->surface_lock );
+
+                         dfb_surface_unlock( surface );
+                    }
+                    else {
+                         D_DEBUG_AT( Core_Layers, "  -> Flipping region not using driver...\n" );
+
+                         /* Just do the hardware independent work. */
+                         dfb_surface_lock( surface );
+                         dfb_surface_flip( surface, false );
+                         dfb_surface_unlock( surface );
+                    }
+                    break;
+               }
+
+               /* fall through */
+
+          case DLBM_BACKSYSTEM:
+               D_DEBUG_AT( Core_Layers, "  -> Going to copy portion...\n" );
+
+               if ((flags & DSFLIP_WAITFORSYNC) == DSFLIP_WAITFORSYNC) {
+                    D_DEBUG_AT( Core_Layers, "  -> Waiting for VSync...\n" );
+
+                    dfb_layer_wait_vsync( layer );
+               }
+
+               D_DEBUG_AT( Core_Layers, "  -> Copying content from back to front buffer...\n" );
+
+               /* ...or copy updated contents from back to front buffer. */
+               dfb_back_to_front_copy_rotation( surface, update, surface->rotation );
+
+               if ((flags & DSFLIP_WAITFORSYNC) == DSFLIP_WAIT) {
+                    D_DEBUG_AT( Core_Layers, "  -> Waiting for VSync...\n" );
+
+                    dfb_layer_wait_vsync( layer );
+               }
+
+               /* fall through */
+
+          case DLBM_FRONTONLY:
+               /* Tell the driver about the update if the region is realized. */
+               if (funcs->UpdateRegion && D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+                    if (surface) {
+                         CoreSurfaceAllocation *allocation;
+
+                         allocation = region->surface_lock.allocation;
+                         D_ASSERT( allocation != NULL );
+
+                         /* If hardware has written or is writing... */
+                         if (allocation->accessed[CSAID_GPU] & CSAF_WRITE) {
+                              D_DEBUG_AT( Core_Layers, "  -> Waiting for pending writes...\n" );
+
+                              /* ...wait for the operation to finish. */
+                              if (!(flags & DSFLIP_PIPELINE))
+                                   dfb_gfxcard_sync(); /* TODO: wait for serial instead */
+
+                              allocation->accessed[CSAID_GPU] &= ~CSAF_WRITE;
+                         }
+
+                         dfb_surface_lock( surface );
+                         dfb_surface_allocation_update( allocation, CSAF_READ );
+                         dfb_surface_unlock( surface );
+                    }
+
+                    D_DEBUG_AT( Core_Layers, "  -> Notifying driver about updated content...\n" );
+                    
+                    if( !update ) {
+                         unrotated = DFB_REGION_INIT_FROM_RECTANGLE_VALS( 0, 0,
+                                        region->config.width, region->config.height );
+                         update    = &unrotated;
+                    }
+                    dfb_region_from_rotated( &rotated, update, &surface->config.size, surface->rotation );
+
+                    ret = funcs->UpdateRegion( layer,
+                                               layer->driver_data,
+                                               layer->layer_data,
+                                               region->region_data,
+                                               surface, &rotated, ®ion->surface_lock );
+               }
+               break;
+
+          default:
+               D_BUG("unknown buffer mode");
+               ret = DFB_BUG;
+     }
+
+     D_DEBUG_AT( Core_Layers, "  -> done.\n" );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return ret;
+}
+
+DFBResult
+dfb_layer_region_set_configuration( CoreLayerRegion            *region,
+                                    CoreLayerRegionConfig      *config,
+                                    CoreLayerRegionConfigFlags  flags )
+{
+     DFBResult                ret;
+     CoreLayer               *layer;
+     const DisplayLayerFuncs *funcs;
+     CoreLayerRegionConfig    new_config;
+
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->context != NULL );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->buffermode != DLBM_WINDOWS );
+     D_ASSERT( (flags == CLRCF_ALL) || (region->state & CLRSF_CONFIGURED) );
+
+     D_ASSUME( flags != CLRCF_NONE );
+     D_ASSUME( ! (flags & ~CLRCF_ALL) );
+
+     layer = dfb_layer_at( region->context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( layer->funcs->TestRegion != NULL );
+
+     funcs = layer->funcs;
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     /* Full configuration supplied? */
+     if (flags == CLRCF_ALL) {
+          new_config = *config;
+     }
+     else {
+          /* Use the current configuration. */
+          new_config = region->config;
+
+          /* Update each modified entry. */
+          if (flags & CLRCF_WIDTH)
+               new_config.width = config->width;
+
+          if (flags & CLRCF_HEIGHT)
+               new_config.height = config->height;
+
+          if (flags & CLRCF_FORMAT)
+               new_config.format = config->format;
+
+          if (flags & CLRCF_SURFACE_CAPS)
+               new_config.surface_caps = config->surface_caps;
+
+          if (flags & CLRCF_BUFFERMODE)
+               new_config.buffermode = config->buffermode;
+
+          if (flags & CLRCF_OPTIONS)
+               new_config.options = config->options;
+
+          if (flags & CLRCF_SOURCE_ID)
+               new_config.source_id = config->source_id;
+
+          if (flags & CLRCF_SOURCE)
+               new_config.source = config->source;
+
+          if (flags & CLRCF_DEST)
+               new_config.dest = config->dest;
+
+          if (flags & CLRCF_OPACITY)
+               new_config.opacity = config->opacity;
+
+          if (flags & CLRCF_ALPHA_RAMP) {
+               new_config.alpha_ramp[0] = config->alpha_ramp[0];
+               new_config.alpha_ramp[1] = config->alpha_ramp[1];
+               new_config.alpha_ramp[2] = config->alpha_ramp[2];
+               new_config.alpha_ramp[3] = config->alpha_ramp[3];
+          }
+
+          if (flags & CLRCF_SRCKEY)
+               new_config.src_key = config->src_key;
+
+          if (flags & CLRCF_DSTKEY)
+               new_config.dst_key = config->dst_key;
+
+          if (flags & CLRCF_PARITY)
+               new_config.parity = config->parity;
+
+          if (flags & CLRCF_CLIPS) {
+               new_config.clips     = config->clips;
+               new_config.num_clips = config->num_clips;
+               new_config.positive  = config->positive;
+          }
+     }
+
+     /* Check if the new configuration is supported. */
+     ret = funcs->TestRegion( layer, layer->driver_data, layer->layer_data,
+                              &new_config, NULL );
+     if (ret) {
+          dfb_layer_region_unlock( region );
+          return ret;
+     }
+
+     /* Check if the region should be frozen, thus requiring to apply changes explicitly. */
+     if (flags & CLRCF_FREEZE)
+          region->state |= CLRSF_FROZEN;
+
+     /* Propagate new configuration to the driver if the region is realized. */
+     if (D_FLAGS_IS_SET( region->state, CLRSF_REALIZED )) {
+          ret = set_region( region, &new_config, flags, region->surface );
+          if (ret) {
+               dfb_layer_region_unlock( region );
+               return ret;
+          }
+     }
+
+     /* Update the region's current configuration. */
+     region->config = new_config;
+
+     /* Update the region's state. */
+     D_FLAGS_SET( region->state, CLRSF_CONFIGURED );
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_layer_region_get_configuration( CoreLayerRegion       *region,
+                                    CoreLayerRegionConfig *config )
+{
+     D_ASSERT( region != NULL );
+     D_ASSERT( config != NULL );
+
+     D_ASSERT( D_FLAGS_IS_SET( region->state, CLRSF_CONFIGURED ) );
+
+     /* Lock the region. */
+     if (dfb_layer_region_lock( region ))
+          return DFB_FUSION;
+
+     /* Return the current configuration. */
+     *config = region->config;
+
+     /* Unlock the region. */
+     dfb_layer_region_unlock( region );
+
+     return DFB_OK;
+}
+
+DirectResult
+dfb_layer_region_lock( CoreLayerRegion *region )
+{
+     D_ASSERT( region != NULL );
+
+     return fusion_skirmish_prevail( ®ion->lock );
+}
+
+DirectResult
+dfb_layer_region_unlock( CoreLayerRegion *region )
+{
+     D_ASSERT( region != NULL );
+
+     return fusion_skirmish_dismiss( ®ion->lock );
+}
+
+/******************************************************************************/
+
+/*
+ * listen to the layer's surface
+ */
+ReactionResult
+_dfb_layer_region_surface_listener( const void *msg_data, void *ctx )
+{
+     CoreSurfaceNotificationFlags   flags;
+     CoreSurface                   *surface;
+     CoreLayer                     *layer;
+     CoreLayerShared               *shared;
+     const DisplayLayerFuncs       *funcs;
+     const CoreSurfaceNotification *notification = msg_data;
+     CoreLayerRegion               *region       = ctx;
+
+     D_ASSERT( notification != NULL );
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->context != NULL );
+
+     D_DEBUG_AT( Core_Layers, "_dfb_layer_region_surface_listener( %p, %p ) <- 0x%08x\n",
+                 notification, region, notification->flags );
+
+     D_ASSERT( notification->surface != NULL );
+
+     D_ASSUME( notification->surface == region->surface );
+
+     if (notification->surface != region->surface)
+          return RS_OK;
+
+     layer = dfb_layer_at( region->context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( layer->funcs->SetRegion != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     funcs   = layer->funcs;
+     shared  = layer->shared;
+
+     flags   = notification->flags;
+     surface = notification->surface;
+
+     if (flags & CSNF_DESTROY) {
+          D_WARN( "layer region surface destroyed" );
+          region->surface = NULL;
+          return RS_REMOVE;
+     }
+
+     if (dfb_layer_region_lock( region ))
+          return RS_OK;
+
+     if (D_FLAGS_ARE_SET( region->state, CLRSF_REALIZED | CLRSF_CONFIGURED ) &&
+         !D_FLAGS_IS_SET( region->state, CLRSF_FROZEN ))
+     {
+          if (D_FLAGS_IS_SET( flags, CSNF_PALETTE_CHANGE | CSNF_PALETTE_UPDATE )) {
+               if (surface->palette)
+                    funcs->SetRegion( layer,
+                                      layer->driver_data, layer->layer_data,
+                                      region->region_data, ®ion->config,
+                                      CLRCF_PALETTE, surface, surface->palette,
+                                      ®ion->surface_lock );
+          }
+
+          if ((flags & CSNF_FIELD) && funcs->SetInputField)
+               funcs->SetInputField( layer,
+                                     layer->driver_data, layer->layer_data,
+                                     region->region_data, surface->field );
+
+          if ((flags & CSNF_ALPHA_RAMP) && (shared->description.caps & DLCAPS_ALPHA_RAMP)) {
+               region->config.alpha_ramp[0] = surface->alpha_ramp[0];
+               region->config.alpha_ramp[1] = surface->alpha_ramp[1];
+               region->config.alpha_ramp[2] = surface->alpha_ramp[2];
+               region->config.alpha_ramp[3] = surface->alpha_ramp[3];
+
+               funcs->SetRegion( layer,
+                                 layer->driver_data, layer->layer_data,
+                                 region->region_data, ®ion->config,
+                                 CLRCF_ALPHA_RAMP, surface, surface->palette,
+                                 ®ion->surface_lock );
+          }
+     }
+
+     dfb_layer_region_unlock( region );
+
+     return RS_OK;
+}
+
+/******************************************************************************/
+
+static DFBResult
+region_buffer_lock( CoreLayerRegion       *region,
+                    CoreSurface           *surface,
+                    CoreSurfaceBufferRole  role )
+{
+     DFBResult              ret;
+     CoreSurfaceBuffer     *buffer;
+     CoreSurfaceAllocation *allocation;
+     CoreLayerContext      *context;
+
+     D_ASSERT( region != NULL );
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     context = region->context;
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* First unlock any previously locked buffer. */
+     if (region->surface_lock.buffer) {
+          D_MAGIC_ASSERT( region->surface_lock.buffer, CoreSurfaceBuffer );
+
+          dfb_surface_unlock_buffer( region->surface_lock.buffer->surface, ®ion->surface_lock );
+     }
+
+     if (dfb_surface_lock( surface ))
+          return DFB_FUSION;
+
+     buffer = dfb_surface_get_buffer( surface, role );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     /* Lock the surface buffer. */
+     ret = dfb_surface_buffer_lock( buffer, CSAID_LAYER0 + context->layer_id, CSAF_READ, ®ion->surface_lock );
+     if (ret) {
+          D_DERROR( ret, "Core/LayerRegion: Could not lock region surface for SetRegion()!\n" );
+          dfb_surface_unlock( surface );
+          return ret;
+     }
+
+     allocation = region->surface_lock.allocation;
+     D_ASSERT( allocation != NULL );
+
+     /* If hardware has written or is writing... */
+     if (allocation->accessed[CSAID_GPU] & CSAF_WRITE) {
+          D_DEBUG_AT( Core_Layers, "  -> Waiting for pending writes...\n" );
+
+          /* ...wait for the operation to finish. */
+          dfb_gfxcard_sync(); /* TODO: wait for serial instead */
+
+          allocation->accessed[CSAID_GPU] &= ~CSAF_WRITE;
+     }
+
+     /* surface is unlocked by caller */
+
+     return DFB_OK;
+}
+
+static DFBResult
+set_region( CoreLayerRegion            *region,
+            CoreLayerRegionConfig      *config,
+            CoreLayerRegionConfigFlags  flags,
+            CoreSurface                *surface )
+{
+     DFBResult                ret;
+     CoreLayer               *layer;
+     CoreLayerShared         *shared;
+     const DisplayLayerFuncs *funcs;
+
+     D_DEBUG_AT( Core_Layers, "%s( %p, %p, 0x%08x, %p )\n", __FUNCTION__, region, config, flags, surface );
+
+     DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( Core_Layers, config );
+
+     D_DEBUG_AT( Core_Layers, "  -> state    0x%08x\n", region->state );
+
+     D_ASSERT( region != NULL );
+     D_ASSERT( region->context != NULL );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->buffermode != DLBM_WINDOWS );
+
+     D_ASSERT( D_FLAGS_IS_SET( region->state, CLRSF_REALIZED ) );
+
+     layer = dfb_layer_at( region->context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+     D_ASSERT( layer->funcs->SetRegion != NULL );
+
+     if (region->state & CLRSF_FROZEN) {
+          D_DEBUG_AT( Core_Layers, "  -> FROZEN!\n" );
+          return DFB_OK;
+     }
+
+     shared = layer->shared;
+     funcs  = layer->funcs;
+
+     if (surface) {
+          if (flags & (CLRCF_SURFACE | CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT)) {
+               ret = region_buffer_lock( region, surface, CSBR_FRONT );
+               if (ret)
+                    return ret;
+
+               dfb_surface_unlock( surface );
+          }
+
+          D_ASSERT( region->surface_lock.buffer != NULL );
+     }
+     else if (region->surface_lock.buffer) {
+          D_MAGIC_ASSERT( region->surface_lock.buffer, CoreSurfaceBuffer );
+
+          dfb_surface_unlock_buffer( region->surface_lock.buffer->surface, ®ion->surface_lock );
+     }
+
+     D_DEBUG_AT( Core_Layers, "  => setting region of '%s'\n", shared->description.name );
+
+     /* Setup hardware. */
+     return funcs->SetRegion( layer, layer->driver_data, layer->layer_data,
+                              region->region_data, config, flags,
+                              surface, surface ? surface->palette : NULL, ®ion->surface_lock );
+}
+
+static DFBResult
+realize_region( CoreLayerRegion *region )
+{
+     DFBResult                ret;
+     CoreLayer               *layer;
+     CoreLayerShared         *shared;
+     const DisplayLayerFuncs *funcs;
+
+     D_DEBUG_AT( Core_Layers, "%s( %p )\n", __FUNCTION__, region );
+
+     D_ASSERT( region != NULL );
+
+     DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( Core_Layers, ®ion->config );
+
+     D_DEBUG_AT( Core_Layers, "  -> state    0x%08x\n", region->state );
+
+     D_ASSERT( region->context != NULL );
+     D_ASSERT( D_FLAGS_IS_SET( region->state, CLRSF_CONFIGURED ) );
+     D_ASSERT( ! D_FLAGS_IS_SET( region->state, CLRSF_REALIZED ) );
+
+     layer = dfb_layer_at( region->context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     shared = layer->shared;
+     funcs  = layer->funcs;
+
+     D_ASSERT( ! fusion_vector_contains( &shared->added_regions, region ) );
+
+     if (region->state & CLRSF_FROZEN) {
+          D_DEBUG_AT( Core_Layers, "  -> FROZEN!\n" );
+          return DFB_OK;
+     }
+
+     /* Allocate the driver's region data. */
+     if (funcs->RegionDataSize) {
+          int size = funcs->RegionDataSize();
+
+          if (size > 0) {
+               region->region_data = SHCALLOC( shared->shmpool, 1, size );
+               if (!region->region_data)
+                    return D_OOSHM();
+          }
+     }
+
+     D_DEBUG_AT( Core_Layers, "  => adding region to '%s'\n", shared->description.name );
+
+     /* Add the region to the driver. */
+     if (funcs->AddRegion) {
+          ret = funcs->AddRegion( layer,
+                                  layer->driver_data, layer->layer_data,
+                                  region->region_data, ®ion->config );
+          if (ret) {
+               D_DERROR( ret, "Core/Layers: Could not add region!\n" );
+
+               if (region->region_data) {
+                    SHFREE( shared->shmpool, region->region_data );
+                    region->region_data = NULL;
+               }
+
+               return ret;
+          }
+     }
+
+     /* Add the region to the 'added' list. */
+     fusion_vector_add( &shared->added_regions, region );
+
+     /* Update the region's state. */
+     D_FLAGS_SET( region->state, CLRSF_REALIZED );
+
+     /* Initially setup hardware. */
+     ret = set_region( region, ®ion->config, CLRCF_ALL, region->surface );
+     if (ret) {
+          unrealize_region( region );
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+unrealize_region( CoreLayerRegion *region )
+{
+     DFBResult                ret;
+     int                      index;
+     CoreLayer               *layer;
+     CoreLayerShared         *shared;
+     const DisplayLayerFuncs *funcs;
+
+     D_DEBUG_AT( Core_Layers, "%s( %p )\n", __FUNCTION__, region );
+
+     D_ASSERT( region != NULL );
+
+     DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( Core_Layers, ®ion->config );
+
+     D_DEBUG_AT( Core_Layers, "  -> state    0x%08x\n", region->state );
+
+     D_ASSERT( region->context != NULL );
+     D_ASSERT( D_FLAGS_IS_SET( region->state, CLRSF_REALIZED ) );
+
+     layer = dfb_layer_at( region->context->layer_id );
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( layer->funcs != NULL );
+
+     shared = layer->shared;
+     funcs  = layer->funcs;
+
+     D_ASSERT( fusion_vector_contains( &shared->added_regions, region ) );
+
+     index = fusion_vector_index_of( &shared->added_regions, region );
+
+     D_DEBUG_AT( Core_Layers, "  => removing region from '%s'\n", shared->description.name );
+
+     /* Remove the region from hardware and driver. */
+     if (funcs->RemoveRegion) {
+          ret = funcs->RemoveRegion( layer, layer->driver_data,
+                                     layer->layer_data, region->region_data );
+          if (ret) {
+               D_DERROR( ret, "Core/Layers: Could not remove region!\n" );
+               return ret;
+          }
+     }
+
+     /* Remove the region from the 'added' list. */
+     fusion_vector_remove( &shared->added_regions, index );
+
+     /* Deallocate the driver's region data. */
+     if (region->region_data) {
+          SHFREE( shared->shmpool, region->region_data );
+          region->region_data = NULL;
+     }
+
+     /* Update the region's state. */
+     D_FLAGS_CLEAR( region->state, CLRSF_REALIZED );
+     D_FLAGS_SET( region->state, CLRSF_FROZEN );
+
+     if (region->surface && region->surface_lock.buffer) {
+          dfb_surface_unlock_buffer( region->surface, ®ion->surface_lock );
+          // PR brg36mgr#147044: [550r3cr1][CRASH][UI]set crashes when going through settings assistant
+          // This is because the YUV layer buffer is allocated in memory recuperated from the video flow
+          // and is only valid in the JPEG usecase.
+          // When the application destroys its window (on leaving the usecase),the layer buffer must
+          // also be removed.
+          dfb_surface_destroy_buffers( region->surface );
+     }
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/layer_region.h b/Source/DirectFB/src/core/layer_region.h
new file mode 100755
index 0000000..29221a9
--- /dev/null
+++ b/Source/DirectFB/src/core/layer_region.h
@@ -0,0 +1,100 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__LAYER_REGION_H__
+#define __CORE__LAYER_REGION_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+#include <core/layers.h>
+
+#include <fusion/object.h>
+
+
+typedef enum {
+     CLRNF_NONE        = 0x00000000
+} CoreLayerRegionNotificationFlags;
+
+typedef struct {
+     CoreLayerRegionNotificationFlags  flags;
+     CoreLayerRegion                  *region;
+} CoreLayerRegionNotification;
+
+/*
+ * Creates a pool of layer region objects.
+ */
+FusionObjectPool *dfb_layer_region_pool_create( const FusionWorld *world );
+
+/*
+ * Generates dfb_layer_region_ref(), dfb_layer_region_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreLayerRegion, dfb_layer_region )
+
+
+DFBResult dfb_layer_region_create       ( CoreLayerContext     *context,
+                                          CoreLayerRegion     **ret_region );
+
+DFBResult dfb_layer_region_activate     ( CoreLayerRegion      *region );
+
+DFBResult dfb_layer_region_deactivate   ( CoreLayerRegion      *region );
+
+DFBResult dfb_layer_region_enable       ( CoreLayerRegion      *region );
+
+DFBResult dfb_layer_region_disable      ( CoreLayerRegion      *region );
+
+DFBResult dfb_layer_region_set_surface  ( CoreLayerRegion      *region,
+                                          CoreSurface          *surface );
+
+DFBResult dfb_layer_region_get_surface  ( CoreLayerRegion      *region,
+                                          CoreSurface         **ret_surface );
+
+DFBResult dfb_layer_region_flip_update  ( CoreLayerRegion      *region,
+                                          const DFBRegion      *update,
+                                          DFBSurfaceFlipFlags   flags );
+
+
+/*
+ * Configuration
+ */
+DFBResult dfb_layer_region_set_configuration( CoreLayerRegion            *region,
+                                              CoreLayerRegionConfig      *config,
+                                              CoreLayerRegionConfigFlags  flags );
+
+DFBResult dfb_layer_region_get_configuration( CoreLayerRegion       *region,
+                                              CoreLayerRegionConfig *config );
+
+
+/*
+ * Locking
+ */
+DirectResult dfb_layer_region_lock  ( CoreLayerRegion   *region );
+DirectResult dfb_layer_region_unlock( CoreLayerRegion   *region );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/layers.c b/Source/DirectFB/src/core/layers.c
new file mode 100755
index 0000000..29c0de8
--- /dev/null
+++ b/Source/DirectFB/src/core/layers.c
@@ -0,0 +1,640 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <fusion/shmalloc.h>
+#include <fusion/arena.h>
+#include <fusion/property.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core_parts.h>
+
+#include <core/input.h>
+#include <core/gfxcard.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers.h>
+#include <core/state.h>
+#include <core/palette.h>
+#include <core/system.h>
+#include <core/windows.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <core/layers_internal.h>
+#include <core/screens_internal.h>
+
+
+D_DEBUG_DOMAIN( Core_Layer, "Core/Layer", "DirectFB Display Layer Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int               magic;
+
+     int               num;
+     CoreLayerShared  *layers[MAX_LAYERS];
+} DFBLayerCoreShared;
+
+struct __DFB_DFBLayerCore {
+     int                 magic;
+
+     CoreDFB            *core;
+
+     DFBLayerCoreShared *shared;
+};
+
+
+DFB_CORE_PART( layer_core, LayerCore );
+
+/**********************************************************************************************************************/
+
+static int           dfb_num_layers;
+static CoreLayer    *dfb_layers[MAX_LAYERS];
+
+/** FIXME: Add proper error paths! **/
+
+static DFBResult
+dfb_layer_core_initialize( CoreDFB            *core,
+                           DFBLayerCore       *data,
+                           DFBLayerCoreShared *shared )
+{
+     int                  i;
+     DFBResult            ret;
+     FusionSHMPoolShared *pool;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     pool = dfb_core_shmpool( core );
+
+     /* Initialize all registered layers. */
+     for (i=0; i<dfb_num_layers; i++) {
+          char                     buf[24];
+          CoreLayerShared         *lshared;
+          CoreLayer               *layer = dfb_layers[i];
+          const DisplayLayerFuncs *funcs = layer->funcs;
+
+          /* Allocate shared data. */
+          lshared = SHCALLOC( pool, 1, sizeof(CoreLayerShared) );
+
+          /* Assign ID (zero based index). */
+          lshared->layer_id = i;
+          lshared->shmpool  = pool;
+
+          snprintf( buf, sizeof(buf), "Display Layer %d", i );
+
+          /* Initialize the lock. */
+          ret = fusion_skirmish_init( &lshared->lock, buf, dfb_core_world(core) );
+          if (ret)
+               return ret;
+
+          /* Allocate driver's layer data. */
+          if (funcs->LayerDataSize) {
+               int size = funcs->LayerDataSize();
+
+               if (size > 0) {
+                    lshared->layer_data = SHCALLOC( pool, 1, size );
+                    if (!lshared->layer_data)
+                         return D_OOSHM();
+               }
+          }
+
+          /* Initialize the layer, get the layer description,
+             the default configuration and default color adjustment. */
+          ret = funcs->InitLayer( layer,
+                                  layer->driver_data,
+                                  lshared->layer_data,
+                                  &lshared->description,
+                                  &lshared->default_config,
+                                  &lshared->default_adjustment );
+          if (ret) {
+               D_DERROR( ret, "DirectFB/Core/layers: "
+                         "Failed to initialize layer %d!\n", lshared->layer_id );
+               return ret;
+          }
+
+          if (lshared->description.caps & DLCAPS_SOURCES) {
+               int n;
+
+               lshared->sources = SHCALLOC( pool, lshared->description.sources, sizeof(CoreLayerSource) );
+               if (!lshared->sources)
+                    return D_OOSHM();
+
+               for (n=0; n<lshared->description.sources; n++) {
+                    CoreLayerSource *source = &lshared->sources[n];
+
+                    source->index = n;
+
+                    ret = funcs->InitSource( layer, layer->driver_data,
+                                             lshared->layer_data, n, &source->description );
+                    if (ret) {
+                         D_DERROR( ret, "DirectFB/Core/layers: Failed to initialize source %d "
+                                   "of layer %d!\n", n, lshared->layer_id );
+                         return ret;
+                    }
+               }
+          }
+
+          if (D_FLAGS_IS_SET( lshared->description.caps, DLCAPS_SCREEN_LOCATION ))
+               D_FLAGS_SET( lshared->description.caps, DLCAPS_SCREEN_POSITION | DLCAPS_SCREEN_SIZE );
+
+          if (D_FLAGS_ARE_SET( lshared->description.caps,
+                               DLCAPS_SCREEN_POSITION | DLCAPS_SCREEN_SIZE ))
+               D_FLAGS_SET( lshared->description.caps, DLCAPS_SCREEN_LOCATION );
+
+          /* Initialize the vector for the contexts. */
+          fusion_vector_init( &lshared->contexts.stack, 4, pool );
+
+          /* Initialize the vector for realized (added) regions. */
+          fusion_vector_init( &lshared->added_regions, 4, pool );
+
+          /* No active context by default. */
+          lshared->contexts.active = -1;
+
+          /* Store layer data. */
+          layer->layer_data = lshared->layer_data;
+
+          /* Store pointer to shared data and core. */
+          layer->shared = lshared;
+          layer->core   = core;
+
+          /* Add the layer to the shared list. */
+          shared->layers[ shared->num++ ] = lshared;
+     }
+
+
+     D_MAGIC_SET( data, DFBLayerCore );
+     D_MAGIC_SET( shared, DFBLayerCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_layer_core_join( CoreDFB            *core,
+                     DFBLayerCore       *data,
+                     DFBLayerCoreShared *shared )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBLayerCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     if (dfb_num_layers != shared->num) {
+          D_ERROR("DirectFB/core/layers: Number of layers does not match!\n");
+          return DFB_BUG;
+     }
+
+     for (i=0; i<dfb_num_layers; i++) {
+          CoreLayer       *layer   = dfb_layers[i];
+          CoreLayerShared *lshared = shared->layers[i];
+
+          /* make a copy for faster access */
+          layer->layer_data = lshared->layer_data;
+
+          /* store pointer to shared data and core */
+          layer->shared = lshared;
+          layer->core   = core;
+     }
+
+
+     D_MAGIC_SET( data, DFBLayerCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_layer_core_shutdown( DFBLayerCore *data,
+                         bool          emergency )
+{
+     int                 i;
+     DFBResult           ret;
+     DFBLayerCoreShared *shared;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBLayerCore );
+     D_MAGIC_ASSERT( data->shared, DFBLayerCoreShared );
+
+     shared = data->shared;
+
+
+     /* Begin with the most recently added layer. */
+     for (i=dfb_num_layers-1; i>=0; i--) {
+          CoreLayer               *layer  = dfb_layers[i];
+          CoreLayerShared         *shared = layer->shared;
+          const DisplayLayerFuncs *funcs  = layer->funcs;
+
+          D_ASSUME( emergency || fusion_vector_is_empty( &shared->added_regions ) );
+
+          /* Remove all regions during emergency shutdown. */
+          if (emergency && funcs->RemoveRegion) {
+               int              n;
+               CoreLayerRegion *region;
+
+               fusion_vector_foreach( region, n, shared->added_regions ) {
+                   D_DEBUG_AT( Core_Layer, "Removing region (%d, %d - %dx%d) from '%s'.\n",
+                               DFB_RECTANGLE_VALS( ®ion->config.dest ),
+                               shared->description.name );
+
+                   ret = funcs->RemoveRegion( layer, layer->driver_data,
+                                              layer->layer_data, region->region_data );
+                   if (ret)
+                        D_DERROR( ret, "Core/Layers: Could not remove region!\n" );
+               }
+          }
+
+          /* Deinitialize the lock. */
+          fusion_skirmish_destroy( &shared->lock );
+
+          /* Deinitialize the state for window stack repaints. */
+          dfb_state_destroy( &layer->state );
+
+          /* Deinitialize the vector for the contexts. */
+          fusion_vector_destroy( &shared->contexts.stack );
+
+          /* Deinitialize the vector for the realized (added) regions. */
+          fusion_vector_destroy( &shared->added_regions );
+
+          /* Free the driver's layer data. */
+          if (shared->layer_data)
+               SHFREE( shared->shmpool, shared->layer_data );
+
+          /* Free the shared layer data. */
+          SHFREE( shared->shmpool, shared );
+
+          /* Free the local layer data. */
+          D_FREE( layer );
+     }
+
+     dfb_num_layers = 0;
+
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_layer_core_leave( DFBLayerCore *data,
+                      bool          emergency )
+{
+     int                 i;
+     DFBLayerCoreShared *shared;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBLayerCore );
+     D_MAGIC_ASSERT( data->shared, DFBLayerCoreShared );
+
+     shared = data->shared;
+
+
+     /* Deinitialize all local stuff. */
+     for (i=0; i<dfb_num_layers; i++) {
+          CoreLayer *layer = dfb_layers[i];
+
+          /* Deinitialize the state for window stack repaints. */
+          dfb_state_destroy( &layer->state );
+
+          /* Free local layer data. */
+          D_FREE( layer );
+     }
+
+     dfb_num_layers = 0;
+
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_layer_core_suspend( DFBLayerCore *data )
+{
+     int                 i;
+     DFBLayerCoreShared *shared;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBLayerCore );
+     D_MAGIC_ASSERT( data->shared, DFBLayerCoreShared );
+
+     shared = data->shared;
+
+     for (i=dfb_num_layers-1; i>=0; i--)
+          dfb_layer_suspend( dfb_layers[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_layer_core_resume( DFBLayerCore *data )
+{
+     int                 i;
+     DFBLayerCoreShared *shared;
+
+     D_DEBUG_AT( Core_Layer, "dfb_layer_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBLayerCore );
+     D_MAGIC_ASSERT( data->shared, DFBLayerCoreShared );
+
+     shared = data->shared;
+
+     for (i=0; i<dfb_num_layers; i++)
+          dfb_layer_resume( dfb_layers[i] );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+CoreLayer *
+dfb_layers_register( CoreScreen              *screen,
+                     void                    *driver_data,
+                     const DisplayLayerFuncs *funcs )
+{
+     CoreLayer *layer;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( funcs != NULL );
+
+     if (dfb_num_layers == MAX_LAYERS) {
+          D_ERROR( "DirectFB/Core/Layers: "
+                    "Maximum number of layers reached!\n" );
+          return NULL;
+     }
+
+     /* allocate local data */
+     layer = D_CALLOC( 1, sizeof(CoreLayer) );
+
+     /* assign local pointers */
+     layer->device      = screen->device;
+     layer->screen      = screen;
+     layer->driver_data = driver_data;
+     layer->funcs       = funcs;
+
+     /* Initialize the state for window stack repaints */
+     dfb_state_init( &layer->state, NULL );
+
+     /* add it to the local list */
+     dfb_layers[dfb_num_layers++] = layer;
+
+     return layer;
+}
+
+typedef void (*AnyFunc)( void );
+
+CoreLayer *
+dfb_layers_hook_primary( CoreGraphicsDevice *device,
+                         void               *driver_data,
+                         DisplayLayerFuncs  *funcs,
+                         DisplayLayerFuncs  *primary_funcs,
+                         void              **primary_driver_data )
+{
+     int        i;
+     int        entries;
+     CoreLayer *primary = dfb_layers[0];
+
+     D_ASSERT( primary != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( funcs != NULL );
+
+     /* copy content of original function table */
+     if (primary_funcs)
+          direct_memcpy( primary_funcs, primary->funcs, sizeof(DisplayLayerFuncs) );
+
+     /* copy pointer to original driver data */
+     if (primary_driver_data)
+          *primary_driver_data = primary->driver_data;
+
+     /* replace all entries in the old table that aren't NULL in the new one */
+     entries = sizeof(DisplayLayerFuncs) / sizeof(void(*)( void ));
+     for (i=0; i<entries; i++) {
+          AnyFunc *newfuncs = (AnyFunc*) funcs;
+          AnyFunc *oldfuncs = (AnyFunc*) primary->funcs;
+
+          if (newfuncs[i])
+               oldfuncs[i] = newfuncs[i];
+     }
+
+     /* replace device and driver data pointer */
+     primary->device      = device;
+     primary->driver_data = driver_data;
+
+     return primary;
+}
+
+CoreLayer *
+dfb_layers_replace_primary( CoreGraphicsDevice *device,
+                            void               *driver_data,
+                            DisplayLayerFuncs  *funcs )
+{
+     CoreLayer *primary = dfb_layers[0];
+
+     D_ASSERT( primary != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( funcs != NULL );
+
+     /* replace device, function table and driver data pointer */
+     primary->device      = device;
+     primary->funcs       = funcs;
+     primary->driver_data = driver_data;
+
+     return primary;
+}
+
+void
+dfb_layers_enumerate( DisplayLayerCallback  callback,
+                      void                 *ctx )
+{
+     int i;
+
+     D_ASSERT( callback != NULL );
+
+     for (i=0; i<dfb_num_layers; i++) {
+          if (callback( dfb_layers[i], ctx ) == DFENUM_CANCEL)
+               break;
+     }
+}
+
+int
+dfb_layer_num( void )
+{
+     return dfb_num_layers;
+}
+
+CoreLayer *
+dfb_layer_at( DFBDisplayLayerID id )
+{
+     D_ASSERT( id >= 0);
+     D_ASSERT( id < dfb_num_layers);
+
+     return dfb_layers[id];
+}
+
+CoreLayer *
+dfb_layer_at_translated( DFBDisplayLayerID id )
+{
+     D_ASSERT( id >= 0);
+     D_ASSERT( id < dfb_num_layers);
+     D_ASSERT( dfb_config != NULL );
+
+     if (dfb_config->primary_layer > 0 &&
+         dfb_config->primary_layer < dfb_num_layers)
+     {
+          if (id == DLID_PRIMARY)
+               return dfb_layer_at( dfb_config->primary_layer );
+
+          if (id == dfb_config->primary_layer)
+               return dfb_layer_at( DLID_PRIMARY );
+     }
+
+     return dfb_layer_at( id );
+}
+
+void
+dfb_layer_get_description( const CoreLayer            *layer,
+                           DFBDisplayLayerDescription *desc )
+{
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( desc != NULL );
+
+     *desc = layer->shared->description;
+}
+
+CoreScreen *
+dfb_layer_screen( const CoreLayer *layer )
+{
+     D_ASSERT( layer != NULL );
+
+     return layer->screen;
+}
+
+CardState *
+dfb_layer_state( CoreLayer *layer )
+{
+     D_ASSERT( layer != NULL );
+
+     return &layer->state;
+}
+
+DFBDisplayLayerID
+dfb_layer_id( const CoreLayer *layer )
+{
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     return layer->shared->layer_id;
+}
+
+DFBDisplayLayerID
+dfb_layer_id_translated( const CoreLayer *layer )
+{
+     CoreLayerShared *shared;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+     D_ASSERT( dfb_config != NULL );
+
+     shared = layer->shared;
+
+     if (dfb_config->primary_layer > 0 &&
+         dfb_config->primary_layer < dfb_num_layers)
+     {
+          if (shared->layer_id == DLID_PRIMARY)
+               return dfb_config->primary_layer;
+
+          if (shared->layer_id == dfb_config->primary_layer)
+               return DLID_PRIMARY;
+     }
+
+     return shared->layer_id;
+}
+
+DFBSurfacePixelFormat
+dfb_primary_layer_pixelformat( void )
+{
+     CoreLayerShared       *shared;
+     CoreLayerContext      *context;
+     CoreLayer             *layer  = dfb_layer_at_translated(DLID_PRIMARY);
+     DFBSurfacePixelFormat  format = DSPF_UNKNOWN;
+
+     D_ASSERT( layer != NULL );
+     D_ASSERT( layer->shared != NULL );
+
+     shared = layer->shared;
+
+     /* If no context is active, return the default format. */
+     if (dfb_layer_get_active_context( layer, &context ) != DFB_OK)
+          return shared->default_config.pixelformat;
+
+     /* Use the format from the current configuration. */
+     format = context->config.pixelformat;
+
+     /* Decrease the context's reference counter. */
+     dfb_layer_context_unref( context );
+
+     return format;
+}
+
diff --git a/Source/DirectFB/src/core/layers.h b/Source/DirectFB/src/core/layers.h
new file mode 100755
index 0000000..68a1d9e
--- /dev/null
+++ b/Source/DirectFB/src/core/layers.h
@@ -0,0 +1,359 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__LAYERS_H__
+#define __CORE__LAYERS_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/surface_buffer.h>
+
+
+struct __DFB_CoreLayerRegionConfig {
+     int                        width;            /* width of the source in pixels */
+     int                        height;           /* height of the source in pixels */
+     DFBSurfacePixelFormat      format;           /* pixel format of the source surface */
+     DFBSurfaceCapabilities     surface_caps;     /* capabilities of the source surface */
+     DFBDisplayLayerBufferMode  buffermode;       /* surface buffer configuration */
+
+     DFBDisplayLayerOptions     options;          /* various configuration options */
+
+     DFBDisplayLayerSourceID    source_id;        /* selected source */
+
+     DFBRectangle               source;           /* viewport within source (input) */
+     DFBRectangle               dest;             /* viewport on screen (output) */
+
+     u8                         opacity;          /* global region alpha */
+
+     DFBColorKey                src_key;          /* source color key */
+     DFBColorKey                dst_key;          /* destination color key */
+
+     int                        parity;           /* field parity (for interlaced) */
+
+     u8                         alpha_ramp[4];    /* alpha values for 1 or 2 bit lookup */
+
+     DFBRegion                 *clips;            /* clip regions */
+     int                        num_clips;        /* number of clip regions */
+     DFBBoolean                 positive;         /* show or cut out regions */
+};
+
+#if D_DEBUG_ENABLED
+#define DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( domain, config )                                                    \
+     do {                                                                                                          \
+          const CoreLayerRegionConfig *_config = config;                                                           \
+                                                                                                                   \
+          D_DEBUG_AT( domain, "  -> size       %dx%d\n", _config->width, _config->height );                        \
+          D_DEBUG_AT( domain, "  -> format     %s\n", dfb_pixelformat_name( _config->format ) );                   \
+          D_DEBUG_AT( domain, "  -> surf caps  0x%08x\n", _config->surface_caps );                                 \
+          D_DEBUG_AT( domain, "  -> buffermode %d\n", _config->buffermode );                                       \
+          D_DEBUG_AT( domain, "  -> options    0x%08x\n", _config->options );                                      \
+          D_DEBUG_AT( domain, "  -> source     %d,%d-%dx%d\n", DFB_RECTANGLE_VALS(&_config->source) );             \
+          D_DEBUG_AT( domain, "  -> dest       %d,%d-%dx%d\n", DFB_RECTANGLE_VALS(&_config->dest) );               \
+          D_DEBUG_AT( domain, "  -> opacity    %d\n", _config->opacity );                                          \
+          D_DEBUG_AT( domain, "  -> src_key    %02x%02x%02x (index %d)\n", DFB_COLORKEY_VALS(&_config->src_key) ); \
+          D_DEBUG_AT( domain, "  -> dst_key    %02x%02x%02x (index %d)\n", DFB_COLORKEY_VALS(&_config->dst_key) ); \
+     } while (0)
+#else
+#define DFB_CORE_LAYER_REGION_CONFIG_DEBUG_AT( domain, config )                                                    \
+     do {                                                                                                          \
+     } while (0)
+#endif
+
+typedef enum {
+     CLRCF_NONE         = 0x00000000,
+
+     CLRCF_WIDTH        = 0x00000001,
+     CLRCF_HEIGHT       = 0x00000002,
+     CLRCF_FORMAT       = 0x00000004,
+     CLRCF_SURFACE_CAPS = 0x00000008,
+
+     CLRCF_BUFFERMODE   = 0x00000010,
+     CLRCF_OPTIONS      = 0x00000020,
+     CLRCF_SOURCE_ID    = 0x00000040,
+
+     CLRCF_SOURCE       = 0x00000100,
+     CLRCF_DEST         = 0x00000200,
+     CLRCF_CLIPS        = 0x00000400,
+
+     CLRCF_OPACITY      = 0x00001000,
+     CLRCF_ALPHA_RAMP   = 0x00002000,
+
+     CLRCF_SRCKEY       = 0x00010000,
+     CLRCF_DSTKEY       = 0x00020000,
+
+     CLRCF_PARITY       = 0x00100000,
+
+     CLRCF_SURFACE      = 0x10000000,
+     CLRCF_PALETTE      = 0x20000000,
+
+     CLRCF_FREEZE       = 0x80000000,
+
+     CLRCF_ALL          = 0xB013377F
+} CoreLayerRegionConfigFlags;
+
+typedef struct {
+   /** Driver Control **/
+
+     /*
+      * Return size of layer data (shared memory).
+      */
+     int       (*LayerDataSize) ( void );
+
+     /*
+      * Return size of region data (shared memory).
+      */
+     int       (*RegionDataSize)( void );
+
+     /*
+      * Called once by the master to initialize layer data and reset hardware.
+      * Return layer description, default configuration and color adjustment.
+      */
+     DFBResult (*InitLayer)     ( CoreLayer                  *layer,
+                                  void                       *driver_data,
+                                  void                       *layer_data,
+                                  DFBDisplayLayerDescription *description,
+                                  DFBDisplayLayerConfig      *config,
+                                  DFBColorAdjustment         *adjustment );
+
+     /*
+      * Called once by the master for each source.
+      * Driver fills description.
+      */
+     DFBResult (*InitSource)    ( CoreLayer                         *layer,
+                                  void                              *driver_data,
+                                  void                              *layer_data,
+                                  int                                source,
+                                  DFBDisplayLayerSourceDescription  *description );
+
+
+   /** Layer Control **/
+
+     /*
+      * Return the currently displayed field (interlaced only).
+      */
+     DFBResult (*GetCurrentOutputField)( CoreLayer              *layer,
+                                         void                   *driver_data,
+                                         void                   *layer_data,
+                                         int                    *field );
+
+     /*
+      * Return the z position of the layer.
+      */
+     DFBResult (*GetLevel)             ( CoreLayer              *layer,
+                                         void                   *driver_data,
+                                         void                   *layer_data,
+                                         int                    *level );
+
+     /*
+      * Move the layer below or on top of others (z position).
+      */
+     DFBResult (*SetLevel)             ( CoreLayer              *layer,
+                                         void                   *driver_data,
+                                         void                   *layer_data,
+                                         int                     level );
+
+
+   /** Configuration **/
+
+     /*
+      * Adjust brightness, contrast, saturation etc.
+      */
+     DFBResult (*SetColorAdjustment)   ( CoreLayer              *layer,
+                                         void                   *driver_data,
+                                         void                   *layer_data,
+                                         DFBColorAdjustment     *adjustment );
+
+
+   /** Region Control **/
+
+     /*
+      * Check all parameters and return if this region is supported.
+      */
+     DFBResult (*TestRegion)   ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 CoreLayerRegionConfig      *config,
+                                 CoreLayerRegionConfigFlags *failed );
+
+     /*
+      * Add a new region to the layer, but don't program hardware, yet.
+      */
+     DFBResult (*AddRegion)    ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data,
+                                 CoreLayerRegionConfig      *config );
+
+     /*
+      * Setup hardware, called once after AddRegion() or when parameters
+      * have changed. Surface and palette are only set if updated or new.
+      */
+     DFBResult (*SetRegion)    ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data,
+                                 CoreLayerRegionConfig      *config,
+                                 CoreLayerRegionConfigFlags  updated,
+                                 CoreSurface                *surface,
+                                 CorePalette                *palette,
+                                 CoreSurfaceBufferLock      *lock );
+
+     /*
+      * Remove a region from the layer.
+      */
+     DFBResult (*RemoveRegion) ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data );
+
+     /*
+      * Flip the surface of the region.
+      */
+     DFBResult (*FlipRegion)   ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data,
+                                 CoreSurface                *surface,
+                                 DFBSurfaceFlipFlags         flags,
+                                 CoreSurfaceBufferLock      *lock );
+
+     /*
+      * Indicate updates to the front buffer content.
+      */
+     DFBResult (*UpdateRegion) ( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data,
+                                 CoreSurface                *surface,
+                                 const DFBRegion            *update,
+                                 CoreSurfaceBufferLock      *lock );
+
+     /*
+      * Control hardware deinterlacing.
+      */
+     DFBResult (*SetInputField)( CoreLayer                  *layer,
+                                 void                       *driver_data,
+                                 void                       *layer_data,
+                                 void                       *region_data,
+                                 int                         field );
+
+
+   /** Override defaults. Subject to change. **/
+
+     /*
+      * Allocate the surface of the region.
+      */
+     DFBResult (*AllocateSurface)  ( CoreLayer              *layer,
+                                     void                   *driver_data,
+                                     void                   *layer_data,
+                                     void                   *region_data,
+                                     CoreLayerRegionConfig  *config,
+                                     CoreSurface           **ret_surface );
+
+     /*
+      * Reallocate the surface of the region.
+      */
+     DFBResult (*ReallocateSurface)( CoreLayer              *layer,
+                                     void                   *driver_data,
+                                     void                   *layer_data,
+                                     void                   *region_data,
+                                     CoreLayerRegionConfig  *config,
+                                     CoreSurface            *surface );
+
+     /*
+      * Deallocate the surface of the region.
+      */
+     DFBResult (*DeallocateSurface)( CoreLayer              *layer,
+                                     void                   *driver_data,
+                                     void                   *layer_data,
+                                     void                   *region_data,
+                                     CoreSurface            *surface );
+} DisplayLayerFuncs;
+
+
+/*
+ * Add a layer to a graphics device by pointing to a table
+ * containing driver functions. The supplied driver data
+ * will be passed to these functions.
+ */
+CoreLayer *dfb_layers_register( CoreScreen              *screen,
+                                void                    *driver_data,
+                                const DisplayLayerFuncs *funcs );
+
+/*
+ * Replace functions of the primary layer implementation by passing
+ * an alternative driver function table. All non-NULL functions in the new
+ * table replace the functions in the original function table.
+ * The original function table is written to 'primary_funcs' before to allow
+ * drivers to use existing functionality from the original implementation.
+ */
+CoreLayer *dfb_layers_hook_primary( CoreGraphicsDevice *device,
+                                    void               *driver_data,
+                                    DisplayLayerFuncs  *funcs,
+                                    DisplayLayerFuncs  *primary_funcs,
+                                    void              **primary_driver_data );
+
+/*
+ * Replace functions of the primary layer implementation completely by passing
+ * an alternative driver function table.
+ */
+CoreLayer *dfb_layers_replace_primary( CoreGraphicsDevice *device,
+                                       void               *driver_data,
+                                       DisplayLayerFuncs  *funcs );
+
+typedef DFBEnumerationResult (*DisplayLayerCallback) (CoreLayer *layer,
+                                                      void      *ctx);
+
+void dfb_layers_enumerate( DisplayLayerCallback  callback,
+                           void                 *ctx );
+
+
+int        dfb_layer_num( void );
+
+CoreLayer *dfb_layer_at( DFBDisplayLayerID id );
+
+CoreLayer *dfb_layer_at_translated( DFBDisplayLayerID id );
+
+
+void dfb_layer_get_description( const CoreLayer            *layer,
+                                DFBDisplayLayerDescription *desc );
+
+CoreScreen *dfb_layer_screen( const CoreLayer *layer );
+
+CardState  *dfb_layer_state( CoreLayer *layer );
+
+DFBDisplayLayerID dfb_layer_id( const CoreLayer *layer );
+
+DFBDisplayLayerID dfb_layer_id_translated( const CoreLayer *layer );
+
+DFBSurfacePixelFormat dfb_primary_layer_pixelformat( void );
+
+#endif
diff --git a/Source/DirectFB/src/core/layers_internal.h b/Source/DirectFB/src/core/layers_internal.h
new file mode 100755
index 0000000..c546a33
--- /dev/null
+++ b/Source/DirectFB/src/core/layers_internal.h
@@ -0,0 +1,196 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__LAYERS_INTERNAL_H__
+#define __CORE__LAYERS_INTERNAL_H__
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <fusion/object.h>
+#include <fusion/property.h>
+#include <fusion/vector.h>
+
+#include <core/layers.h>
+#include <core/layer_region.h>
+#include <core/state.h>
+
+typedef struct {
+     FusionVector      stack;
+     int               active;
+
+     CoreLayerContext *primary;
+} CoreLayerContexts;
+
+typedef struct {
+     int                                index;
+     DFBDisplayLayerSourceDescription   description;
+} CoreLayerSource;
+
+typedef struct {
+     DFBDisplayLayerID                  layer_id;
+
+     DFBDisplayLayerDescription         description;
+     DFBDisplayLayerConfig              default_config;
+     DFBColorAdjustment                 default_adjustment;
+
+     CoreLayerSource                   *sources;
+
+     void                              *layer_data;
+
+     FusionSkirmish                     lock;
+
+     CoreLayerContexts                  contexts;
+
+     bool                               suspended;
+
+     FusionVector                       added_regions;
+
+     FusionSHMPoolShared               *shmpool;
+} CoreLayerShared;
+
+struct __DFB_CoreLayer {
+     CoreLayerShared         *shared;
+
+     CoreDFB                 *core;
+
+     CoreGraphicsDevice      *device;
+
+     CoreScreen              *screen;
+
+     void                    *driver_data;
+     void                    *layer_data;   /* copy of shared->layer_data */
+
+     const DisplayLayerFuncs *funcs;
+
+     CardState                state;
+};
+
+typedef enum {
+     CLLM_LOCATION,      /* Keep normalized area. */
+     CLLM_CENTER,        /* Center layer after resizing destination area. */
+     CLLM_POSITION,      /* Keep pixel position, but resize area. */
+     CLLM_RECTANGLE      /* Keep pixel based area. */
+} CoreLayerLayoutMode;
+
+struct __DFB_CoreLayerContext {
+     FusionObject                object;
+
+     int                         magic;
+
+     DFBDisplayLayerID           layer_id;
+
+     FusionSkirmish              lock;
+
+     bool                        active;     /* Is this the active context? */
+
+     DFBDisplayLayerConfig       config;     /* Current layer configuration. */
+     int                         rotation;
+
+     FusionVector                regions;    /* All regions created within
+                                                this context. */
+
+     struct {
+          CoreLayerRegion       *region;     /* Region of layer config if buffer
+                                                mode is not DLBM_WINDOWS. */
+          CoreLayerRegionConfig  config;     /* Region config used to implement
+                                                layer config and settings. */
+     } primary;
+
+     struct {
+          DFBLocation            location;   /* Normalized screen location. */
+          DFBRectangle           rectangle;  /* Pixel based position and size. */
+
+          CoreLayerLayoutMode    mode;       /* ...and how resizing influences them. */
+     } screen;
+
+     DFBColorAdjustment          adjustment; /* Color adjustment of the layer.*/
+
+     CoreWindowStack            *stack;      /* Every layer has its own
+                                                windowstack as every layer has
+                                                its own pixel buffer. */
+
+     FusionSHMPoolShared        *shmpool;
+};
+
+typedef enum {
+     CLRSF_NONE       = 0x00000000,
+
+     CLRSF_CONFIGURED = 0x00000001,
+     CLRSF_ENABLED    = 0x00000002,
+     CLRSF_ACTIVE     = 0x00000004,
+     CLRSF_REALIZED   = 0x00000008,
+
+     CLRSF_FROZEN     = 0x00000010,
+
+     CLRSF_ALL        = 0x0000001F
+} CoreLayerRegionStateFlags;
+
+struct __DFB_CoreLayerRegion {
+     FusionObject                object;
+
+     CoreLayerContext           *context;
+
+     FusionSkirmish              lock;
+
+     CoreLayerRegionStateFlags   state;
+
+     CoreLayerRegionConfig       config;
+
+     CoreSurface                *surface;
+     CoreSurfaceBufferLock       surface_lock;
+     GlobalReaction              surface_reaction;
+
+     void                       *region_data;
+};
+
+
+/* Called at the end of dfb_layer_region_create(). */
+DFBResult dfb_layer_context_add_region( CoreLayerContext *context,
+                                        CoreLayerRegion  *region );
+
+/* Called early in the region_destructor(). */
+DFBResult dfb_layer_context_remove_region( CoreLayerContext *context,
+                                           CoreLayerRegion  *region );
+
+/* Called by dfb_layer_activate_context(),
+   dfb_layer_remove_context() and dfb_layer_resume(). */
+DFBResult dfb_layer_context_activate  ( CoreLayerContext *context );
+
+/* Called by dfb_layer_deactivate_context(),
+   dfb_layer_remove_context() and dfb_layer_suspend(). */
+DFBResult dfb_layer_context_deactivate( CoreLayerContext *context );
+
+/* global reactions */
+ReactionResult _dfb_layer_region_surface_listener( const void *msg_data,
+                                                   void       *ctx );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/local_surface_pool.c b/Source/DirectFB/src/core/local_surface_pool.c
new file mode 100755
index 0000000..8da06de
--- /dev/null
+++ b/Source/DirectFB/src/core/local_surface_pool.c
@@ -0,0 +1,313 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/mem.h>
+
+#include <fusion/fusion.h>
+
+#include <core/core.h>
+#include <core/surface_pool.h>
+
+
+/**********************************************************************************************************************/
+
+typedef struct {
+} LocalPoolData;
+
+typedef struct {
+     FusionCall  call;
+} LocalPoolLocalData;
+
+typedef struct {
+     int         magic;
+
+     void       *addr;
+     int         pitch;
+     int         size;
+
+     FusionCall  call;
+     FusionID    fid;
+} LocalAllocationData;
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult
+local_surface_pool_call_handler( int           caller,
+                                 int           call_arg,
+                                 void         *call_ptr,
+                                 void         *ctx,
+                                 unsigned int  serial,
+                                 int          *ret_val )
+{
+     D_FREE( call_ptr );
+
+     *ret_val = 0;
+
+     return FCHR_RETURN;
+}
+
+/**********************************************************************************************************************/
+
+static int
+localPoolDataSize( void )
+{
+     return sizeof(LocalPoolData);
+}
+
+static int
+localPoolLocalDataSize( void )
+{
+     return sizeof(LocalPoolLocalData);
+}
+
+static int
+localAllocationDataSize( void )
+{
+     return sizeof(LocalAllocationData);
+}
+
+static DFBResult
+localInitPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data,
+               CoreSurfacePoolDescription *ret_desc )
+{
+     LocalPoolLocalData *local = pool_local;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( pool_local != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps              = CSPCAPS_NONE;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE;
+     ret_desc->types             = CSTF_FONT | CSTF_INTERNAL;
+     ret_desc->priority          = CSPP_PREFERED;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "System Memory" );
+
+     fusion_call_init( &local->call, local_surface_pool_call_handler, local, dfb_core_world(core) );
+
+     return DFB_OK;
+}
+
+static DFBResult
+localJoinPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data )
+{
+     LocalPoolLocalData *local = pool_local;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( pool_local != NULL );
+
+     return fusion_call_init( &local->call, local_surface_pool_call_handler, local, dfb_core_world(core) );
+}
+
+static DFBResult
+localDestroyPool( CoreSurfacePool *pool,
+                  void            *pool_data,
+                  void            *pool_local )
+{
+     CoreSurfaceAllocation *allocation;
+     LocalPoolLocalData    *local = pool_local;
+     LocalAllocationData   *data;
+     FusionID               fid;
+
+     DFBResult res;
+     int       i;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( pool_local != NULL );
+
+     res = fusion_call_destroy( &local->call );
+     fid = fusion_id( dfb_core_world(NULL) );
+
+     /* remove the local allocations */
+     fusion_vector_foreach (allocation, i, pool->allocs) {
+          data = allocation->data;
+          if( data->fid == fid )
+               D_FREE( data->addr );
+     }
+
+     return res;    
+}
+
+static DFBResult
+localLeavePool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     CoreSurfaceAllocation *allocation;
+     LocalPoolLocalData    *local = pool_local;
+     LocalAllocationData   *data;
+     FusionID               fid;
+     
+     DFBResult res;
+     int       i;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( pool_local != NULL );
+
+     res = fusion_call_destroy( &local->call );
+     fid = fusion_id( dfb_core_world(NULL) );
+
+     /* remove the local allocations */
+     fusion_vector_foreach (allocation, i, pool->allocs) {
+          data = allocation->data;
+          if( data->fid == fid )
+               D_FREE( data->addr );
+     }
+
+     return res;    
+}
+
+static DFBResult
+localAllocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     CoreSurface         *surface;
+     LocalPoolLocalData  *local = pool_local;
+     LocalAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_ASSERT( alloc != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     dfb_surface_calc_buffer_size( surface, 8, 0, &alloc->pitch, &alloc->size );
+
+     alloc->addr = D_MALLOC( alloc->size );
+     if (!alloc->addr)
+          return D_OOM();
+
+     alloc->call = local->call;
+     alloc->fid  = fusion_id( dfb_core_world(NULL) );
+
+     D_MAGIC_SET( alloc, LocalAllocationData );
+
+     allocation->flags = CSALF_VOLATILE;
+     allocation->size  = alloc->size;
+
+     return DFB_OK;
+}
+
+static DFBResult
+localDeallocateBuffer( CoreSurfacePool       *pool,
+                       void                  *pool_data,
+                       void                  *pool_local,
+                       CoreSurfaceBuffer     *buffer,
+                       CoreSurfaceAllocation *allocation,
+                       void                  *alloc_data )
+{
+     DFBResult            ret;
+     LocalAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, LocalAllocationData );
+
+     ret = fusion_call_execute( &alloc->call, FCEF_ONEWAY, 0, alloc->addr, NULL );
+//     if (ret)
+//          D_DERROR( ret, "SurfPool/Local: Could not call buffer owner to free it there!\n" );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+localLock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     LocalAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+     D_MAGIC_ASSERT( alloc, LocalAllocationData );
+
+     lock->addr  = alloc->addr;
+     lock->pitch = alloc->pitch;
+
+     return DFB_OK;
+}
+
+static DFBResult
+localUnlock( CoreSurfacePool       *pool,
+             void                  *pool_data,
+             void                  *pool_local,
+             CoreSurfaceAllocation *allocation,
+             void                  *alloc_data,
+             CoreSurfaceBufferLock *lock )
+{
+     LocalAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+     D_MAGIC_ASSERT( alloc, LocalAllocationData );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs localSurfacePoolFuncs = {
+     .PoolDataSize       = localPoolDataSize,
+     .PoolLocalDataSize  = localPoolLocalDataSize,
+     .AllocationDataSize = localAllocationDataSize,
+
+     .InitPool           = localInitPool,
+     .JoinPool           = localJoinPool,
+     .DestroyPool        = localDestroyPool,
+     .LeavePool          = localLeavePool,
+
+     .AllocateBuffer     = localAllocateBuffer,
+     .DeallocateBuffer   = localDeallocateBuffer,
+
+     .Lock               = localLock,
+     .Unlock             = localUnlock,
+};
+
diff --git a/Source/DirectFB/src/core/palette.c b/Source/DirectFB/src/core/palette.c
new file mode 100755
index 0000000..3d66a54
--- /dev/null
+++ b/Source/DirectFB/src/core/palette.c
@@ -0,0 +1,317 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core.h>
+#include <core/surface.h>
+#include <core/gfxcard.h>
+#include <core/palette.h>
+#include <core/colorhash.h>
+
+#include <gfx/convert.h>
+
+#include <misc/util.h>
+
+D_DEBUG_DOMAIN( Core_Palette, "Core/Palette", "DirectFB Palette Core" );
+
+/**********************************************************************************************************************/
+
+static const u8 lookup3to8[] = { 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff };
+static const u8 lookup2to8[] = { 0x00, 0x55, 0xaa, 0xff };
+
+static const ReactionFunc dfb_palette_globals[] = {
+/* 0 */   _dfb_surface_palette_listener,
+          NULL
+};
+
+/**********************************************************************************************************************/
+
+static void palette_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+     CorePaletteNotification  notification;
+     CorePalette             *palette = (CorePalette*) object;
+
+     D_MAGIC_ASSERT( palette, CorePalette );
+
+     D_DEBUG_AT( Core_Palette, "destroying %p (%d)%s\n", palette,
+                 palette->num_entries, zombie ? " (ZOMBIE)" : "");
+
+     D_ASSERT( palette->entries != NULL );
+     D_ASSERT( palette->entries_yuv != NULL );
+
+     notification.flags   = CPNF_DESTROY;
+     notification.palette = palette;
+
+     dfb_palette_dispatch( palette, ¬ification, dfb_palette_globals );
+
+     if (palette->hash_attached) {
+          dfb_colorhash_invalidate( NULL, palette );
+          dfb_colorhash_detach( NULL, palette );
+     }
+
+     SHFREE( palette->shmpool, palette->entries_yuv );
+     SHFREE( palette->shmpool, palette->entries );
+
+     D_MAGIC_CLEAR( palette );
+
+     fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+dfb_palette_pool_create( const FusionWorld *world )
+{
+     FusionObjectPool *pool;
+
+     pool = fusion_object_pool_create( "Palette Pool",
+                                       sizeof(CorePalette),
+                                       sizeof(CorePaletteNotification),
+                                       palette_destructor, NULL, world );
+
+     return pool;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_palette_create( CoreDFB       *core,
+                    unsigned int   size,
+                    CorePalette  **ret_palette )
+{
+     CorePalette *palette;
+
+     D_DEBUG_AT( Core_Palette, "%s( %d )\n", __FUNCTION__, size );
+
+     D_ASSERT( ret_palette );
+
+     palette = dfb_core_create_palette( core );
+     if (!palette)
+          return DFB_FUSION;
+
+     palette->shmpool = dfb_core_shmpool( core );
+
+     if (size) {
+          palette->entries = SHCALLOC( palette->shmpool, size, sizeof(DFBColor) );
+          if (!palette->entries) {
+               fusion_object_destroy( &palette->object );
+               return D_OOSHM();
+          }
+
+          palette->entries_yuv = SHCALLOC( palette->shmpool, size, sizeof(DFBColorYUV) );
+          if (!palette->entries_yuv) {
+               SHFREE( palette->shmpool, palette->entries );
+               fusion_object_destroy( &palette->object );
+               return D_OOSHM();
+          }
+     }
+
+     palette->num_entries = size;
+
+     /* reset cache */
+     palette->search_cache.index = -1;
+
+     D_MAGIC_SET( palette, CorePalette );
+
+     /* activate object */
+     fusion_object_activate( &palette->object );
+
+     /* return the new palette */
+     *ret_palette = palette;
+
+     D_DEBUG_AT( Core_Palette, "  -> %p\n", palette );
+
+     return DFB_OK;
+}
+
+void
+dfb_palette_generate_rgb332_map( CorePalette *palette )
+{
+     unsigned int i;
+
+     D_DEBUG_AT( Core_Palette, "%s( %p )\n", __FUNCTION__, palette );
+
+     D_MAGIC_ASSERT( palette, CorePalette );
+
+     if (!palette->num_entries)
+          return;
+
+     for (i=0; i<palette->num_entries; i++) {
+          palette->entries[i].a = i ? 0xff : 0x00;
+          palette->entries[i].r = lookup3to8[ (i & 0xE0) >> 5 ];
+          palette->entries[i].g = lookup3to8[ (i & 0x1C) >> 2 ];
+          palette->entries[i].b = lookup2to8[ (i & 0x03) ];
+
+          palette->entries_yuv[i].a = palette->entries[i].a;
+
+          RGB_TO_YCBCR( palette->entries[i].r, palette->entries[i].g, palette->entries[i].b,
+                        palette->entries_yuv[i].y, palette->entries_yuv[i].u, palette->entries_yuv[i].v );
+     }
+
+     dfb_palette_update( palette, 0, palette->num_entries - 1 );
+}
+
+void
+dfb_palette_generate_rgb121_map( CorePalette *palette )
+{
+     unsigned int i;
+
+     D_DEBUG_AT( Core_Palette, "%s( %p )\n", __FUNCTION__, palette );
+
+     D_MAGIC_ASSERT( palette, CorePalette );
+
+     if (!palette->num_entries)
+          return;
+
+     for (i=0; i<palette->num_entries; i++) {
+          palette->entries[i].a = i ? 0xff : 0x00;
+          palette->entries[i].r = (i & 0x8) ? 0xff : 0x00;
+          palette->entries[i].g = lookup2to8[ (i & 0x6) >> 1 ];
+          palette->entries[i].b = (i & 0x1) ? 0xff : 0x00;
+
+          palette->entries_yuv[i].a = palette->entries[i].a;
+
+          RGB_TO_YCBCR( palette->entries[i].r, palette->entries[i].g, palette->entries[i].b,
+                        palette->entries_yuv[i].y, palette->entries_yuv[i].u, palette->entries_yuv[i].v );
+     }
+
+     dfb_palette_update( palette, 0, palette->num_entries - 1 );
+}
+
+unsigned int
+dfb_palette_search( CorePalette *palette,
+                    u8           r,
+                    u8           g,
+                    u8           b,
+                    u8           a )
+{
+     unsigned int index;
+
+     D_MAGIC_ASSERT( palette, CorePalette );
+
+     /* check local cache first */
+     if (palette->search_cache.index != -1 &&
+         palette->search_cache.color.a == a &&
+         palette->search_cache.color.r == r &&
+         palette->search_cache.color.g == g &&
+         palette->search_cache.color.b == b)
+          return palette->search_cache.index;
+
+     /* check the global color hash table, returns the closest match */
+     if (!palette->hash_attached) {
+          dfb_colorhash_attach( NULL, palette );
+          palette->hash_attached = true;
+     }
+
+     index = dfb_colorhash_lookup( NULL, palette, r, g, b, a );
+
+     /* write into local cache */
+     palette->search_cache.index = index;
+     palette->search_cache.color.a = a;
+     palette->search_cache.color.r = r;
+     palette->search_cache.color.g = g;
+     palette->search_cache.color.b = b;
+
+     return index;
+}
+
+void
+dfb_palette_update( CorePalette *palette, int first, int last )
+{
+     CorePaletteNotification notification;
+
+     D_DEBUG_AT( Core_Palette, "%s( %p, %d, %d )\n", __FUNCTION__, palette, first, last );
+
+     D_MAGIC_ASSERT( palette, CorePalette );
+     D_ASSERT( first >= 0 );
+     D_ASSERT( first < palette->num_entries );
+     D_ASSERT( last >= 0 );
+     D_ASSERT( last < palette->num_entries );
+     D_ASSERT( first <= last );
+
+     notification.flags   = CPNF_ENTRIES;
+     notification.palette = palette;
+     notification.first   = first;
+     notification.last    = last;
+
+     /* reset cache */
+     if (palette->search_cache.index >= first &&
+         palette->search_cache.index <= last)
+          palette->search_cache.index = -1;
+
+     /* invalidate entries in colorhash */
+     if (palette->hash_attached)
+          dfb_colorhash_invalidate( NULL, palette );
+
+     /* post message about palette update */
+     dfb_palette_dispatch( palette, ¬ification, dfb_palette_globals );
+}
+
+bool
+dfb_palette_equal( CorePalette *palette1, CorePalette *palette2 )
+{
+     u32 *entries1;
+     u32 *entries2;
+     int    i;
+     
+     D_DEBUG_AT( Core_Palette, "%s( %p, %p )\n", __FUNCTION__, palette1, palette2 );
+
+     D_ASSERT( palette1 != NULL );
+     D_ASSERT( palette2 != NULL );
+
+     if (palette1 == palette2) {
+          D_DEBUG_AT( Core_Palette, "  -> SAME\n" );
+          return true;
+     }
+
+     if (palette1->num_entries != palette2->num_entries) {
+          D_DEBUG_AT( Core_Palette, "  -> NOT EQUAL (%d/%d)\n", palette1->num_entries, palette2->num_entries );
+          return false;
+     }
+
+     entries1 = (u32*)palette1->entries;
+     entries2 = (u32*)palette2->entries;
+
+     for (i = 0; i < palette1->num_entries; i++) {
+          if (entries1[i] != entries2[i]) {
+               D_DEBUG_AT( Core_Palette, "  -> NOT EQUAL (%d)\n", i );
+               return false;
+          }
+     }
+
+     D_DEBUG_AT( Core_Palette, "  -> EQUAL\n" );
+
+     return true;
+}
+
diff --git a/Source/DirectFB/src/core/palette.h b/Source/DirectFB/src/core/palette.h
new file mode 100755
index 0000000..10886be
--- /dev/null
+++ b/Source/DirectFB/src/core/palette.h
@@ -0,0 +1,106 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __PALETTE_H__
+#define __PALETTE_H__
+
+#include <directfb.h>
+#include <core/coretypes.h>
+#include <fusion/object.h>
+
+struct _CorePalette {
+     FusionObject  object;
+     int           magic;
+
+     unsigned int  num_entries;
+     DFBColor     *entries;
+     DFBColorYUV  *entries_yuv;
+
+     struct {
+          int      index;
+          DFBColor color;
+     } search_cache;
+
+     bool          hash_attached;
+
+     FusionSHMPoolShared *shmpool;
+};
+
+typedef enum {
+     CPNF_ENTRIES = 0x00000001,
+     CPNF_DESTROY = 0x00000002
+} CorePaletteNotificationFlags;
+
+typedef struct {
+     CorePaletteNotificationFlags  flags;
+     CorePalette                  *palette;
+     int                           first;
+     int                           last;
+} CorePaletteNotification;
+
+
+DFBResult    dfb_palette_create             ( CoreDFB       *core,
+                                              unsigned int   size,
+                                              CorePalette  **ret_palette );
+
+void         dfb_palette_generate_rgb332_map( CorePalette   *palette );
+void         dfb_palette_generate_rgb121_map( CorePalette   *palette );
+
+unsigned int dfb_palette_search             ( CorePalette   *palette,
+                                              u8             r,
+                                              u8             g,
+                                              u8             b,
+                                              u8             a );
+
+void         dfb_palette_update             ( CorePalette   *palette,
+                                              int            first,
+                                              int            last );
+
+bool         dfb_palette_equal              ( CorePalette   *palette1,
+                                              CorePalette   *palette2 );
+
+
+/*
+ * Creates a pool of palette objects.
+ */
+FusionObjectPool *dfb_palette_pool_create( const FusionWorld *world );
+
+/*
+ * Generates dfb_palette_ref(), dfb_palette_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CorePalette, dfb_palette )
+
+
+/* global reactions */
+
+typedef enum {
+     DFB_SURFACE_PALETTE_LISTENER
+} DFB_PALETTE_GLOBALS;
+
+#endif
+
diff --git a/Source/DirectFB/src/core/prealloc_surface_pool.c b/Source/DirectFB/src/core/prealloc_surface_pool.c
new file mode 100755
index 0000000..f7d9051
--- /dev/null
+++ b/Source/DirectFB/src/core/prealloc_surface_pool.c
@@ -0,0 +1,192 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+
+#include <fusion/conf.h>
+#include <fusion/shmalloc.h>
+#include <fusion/shm/pool.h>
+
+#include <core/core.h>
+#include <core/surface_pool.h>
+
+typedef struct {
+     void *addr;
+     int   pitch;
+} PreallocAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+preallocAllocationDataSize( void )
+{
+     return sizeof(PreallocAllocationData);
+}
+
+static DFBResult
+preallocInitPool( CoreDFB                    *core,
+                  CoreSurfacePool            *pool,
+                  void                       *pool_data,
+                  void                       *pool_local,
+                  void                       *system_data,
+                  CoreSurfacePoolDescription *ret_desc )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps              = CSPCAPS_NONE;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE;
+     ret_desc->types             = CSTF_PREALLOCATED | CSTF_INTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Preallocated Memory" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+preallocTestConfig( CoreSurfacePool         *pool,
+                    void                    *pool_data,
+                    void                    *pool_local,
+                    CoreSurfaceBuffer       *buffer,
+                    const CoreSurfaceConfig *config )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( config != NULL );
+
+     return (config->flags & CSCONF_PREALLOCATED) ? DFB_OK : DFB_UNSUPPORTED;
+}
+
+static DFBResult
+preallocAllocateBuffer( CoreSurfacePool       *pool,
+                        void                  *pool_data,
+                        void                  *pool_local,
+                        CoreSurfaceBuffer     *buffer,
+                        CoreSurfaceAllocation *allocation,
+                        void                  *alloc_data )
+{
+     int                     index;
+     CoreSurface            *surface;
+     PreallocAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     for (index=0; index<MAX_SURFACE_BUFFERS; index++) {
+          if (surface->buffers[index] == buffer)
+               break;
+     }
+
+     if (index == MAX_SURFACE_BUFFERS)
+          return DFB_BUG;
+
+     if (!(surface->config.flags & CSCONF_PREALLOCATED))
+          return DFB_BUG;
+
+     if (!surface->config.preallocated[index].addr ||
+          surface->config.preallocated[index].pitch < DFB_BYTES_PER_LINE(surface->config.format,
+                                                                         surface->config.size.w))
+          return DFB_INVARG;
+
+     alloc->addr  = surface->config.preallocated[index].addr;
+     alloc->pitch = surface->config.preallocated[index].pitch;
+
+     allocation->flags = CSALF_PREALLOCATED | CSALF_VOLATILE;
+     allocation->size  = surface->config.preallocated[index].pitch *
+                         DFB_PLANE_MULTIPLY( surface->config.format, surface->config.size.h );
+
+     return DFB_OK;
+}
+
+static DFBResult
+preallocDeallocateBuffer( CoreSurfacePool       *pool,
+                          void                  *pool_data,
+                          void                  *pool_local,
+                          CoreSurfaceBuffer     *buffer,
+                          CoreSurfaceAllocation *allocation,
+                          void                  *alloc_data )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+
+     return DFB_OK;
+}
+
+static DFBResult
+preallocLock( CoreSurfacePool       *pool,
+              void                  *pool_data,
+              void                  *pool_local,
+              CoreSurfaceAllocation *allocation,
+              void                  *alloc_data,
+              CoreSurfaceBufferLock *lock )
+{
+     PreallocAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     lock->addr  = alloc->addr;
+     lock->pitch = alloc->pitch;
+
+     return DFB_OK;
+}
+
+static DFBResult
+preallocUnlock( CoreSurfacePool       *pool,
+                void                  *pool_data,
+                void                  *pool_local,
+                CoreSurfaceAllocation *allocation,
+                void                  *alloc_data,
+                CoreSurfaceBufferLock *lock )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs preallocSurfacePoolFuncs = {
+     .AllocationDataSize = preallocAllocationDataSize,
+     .InitPool           = preallocInitPool,
+
+     .TestConfig         = preallocTestConfig,
+
+     .AllocateBuffer     = preallocAllocateBuffer,
+     .DeallocateBuffer   = preallocDeallocateBuffer,
+
+     .Lock               = preallocLock,
+     .Unlock             = preallocUnlock,
+};
+
diff --git a/Source/DirectFB/src/core/screen.c b/Source/DirectFB/src/core/screen.c
new file mode 100755
index 0000000..4b233e0
--- /dev/null
+++ b/Source/DirectFB/src/core/screen.c
@@ -0,0 +1,540 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/debug.h>
+
+#include <core/layers.h>
+#include <core/screen.h>
+#include <core/screens_internal.h>
+
+
+DFBResult
+dfb_screen_get_info( CoreScreen           *screen,
+                     DFBScreenID          *ret_id,
+                     DFBScreenDescription *ret_desc )
+{
+     CoreScreenShared *shared;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+
+     shared = screen->shared;
+
+     if (ret_id)
+          *ret_id = shared->screen_id;
+
+     if (ret_desc)
+          *ret_desc = shared->description;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_suspend( CoreScreen *screen )
+{
+     D_ASSERT( screen != NULL );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_resume( CoreScreen *screen )
+{
+     D_ASSERT( screen != NULL );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_set_powermode( CoreScreen         *screen,
+                          DFBScreenPowerMode  mode )
+{
+     ScreenFuncs *funcs;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->funcs != NULL );
+
+     funcs = screen->funcs;
+
+     if (funcs->SetPowerMode)
+          return funcs->SetPowerMode( screen,
+                                      screen->driver_data,
+                                      screen->screen_data,
+                                      mode );
+
+     return DFB_UNSUPPORTED;
+}
+
+DFBResult
+dfb_screen_wait_vsync( CoreScreen *screen )
+{
+     ScreenFuncs *funcs;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->funcs != NULL );
+
+     funcs = screen->funcs;
+
+     if (funcs->WaitVSync)
+          return funcs->WaitVSync( screen,
+                                   screen->driver_data, screen->screen_data );
+
+     return DFB_UNSUPPORTED;
+}
+
+
+/*********************************** Mixers ***********************************/
+
+DFBResult
+dfb_screen_get_mixer_info( CoreScreen                *screen,
+                           int                        mixer,
+                           DFBScreenMixerDescription *ret_desc )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( mixer >= 0 );
+     D_ASSERT( mixer < screen->shared->description.mixers );
+     D_ASSERT( ret_desc != NULL );
+
+     /* Return mixer description. */
+     *ret_desc = screen->shared->mixers[mixer].description;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_get_mixer_config( CoreScreen           *screen,
+                             int                   mixer,
+                             DFBScreenMixerConfig *ret_config )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( mixer >= 0 );
+     D_ASSERT( mixer < screen->shared->description.mixers );
+     D_ASSERT( ret_config != NULL );
+
+     /* Return current mixer configuration. */
+     *ret_config = screen->shared->mixers[mixer].configuration;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_test_mixer_config( CoreScreen                 *screen,
+                              int                         mixer,
+                              const DFBScreenMixerConfig *config,
+                              DFBScreenMixerConfigFlags  *ret_failed )
+{
+     DFBResult                 ret;
+     DFBScreenMixerConfigFlags failed = DSMCONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestMixerConfig != NULL );
+     D_ASSERT( mixer >= 0 );
+     D_ASSERT( mixer < screen->shared->description.mixers );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->mixers[mixer].configuration.flags );
+
+     /* Test the mixer configuration. */
+     ret = screen->funcs->TestMixerConfig( screen,
+                                           screen->driver_data,
+                                           screen->screen_data,
+                                           mixer, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK) );
+
+     if (ret_failed)
+          *ret_failed = failed;
+
+     return ret;
+}
+
+DFBResult
+dfb_screen_set_mixer_config( CoreScreen                 *screen,
+                             int                         mixer,
+                             const DFBScreenMixerConfig *config )
+{
+     DFBResult                 ret;
+     DFBScreenMixerConfigFlags failed = DSOCONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestMixerConfig != NULL );
+     D_ASSERT( screen->funcs->SetMixerConfig != NULL );
+     D_ASSERT( mixer >= 0 );
+     D_ASSERT( mixer < screen->shared->description.mixers );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->mixers[mixer].configuration.flags );
+
+     /* Test configuration first. */
+     ret = screen->funcs->TestMixerConfig( screen,
+                                           screen->driver_data,
+                                           screen->screen_data,
+                                           mixer, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK && failed) );
+
+     if (ret)
+          return ret;
+
+     /* Set configuration afterwards. */
+     ret = screen->funcs->SetMixerConfig( screen,
+                                          screen->driver_data,
+                                          screen->screen_data,
+                                          mixer, config );
+     if (ret)
+          return ret;
+
+     /* Store current configuration. */
+     screen->shared->mixers[mixer].configuration = *config;
+
+     return DFB_OK;
+}
+
+
+/********************************** Encoders **********************************/
+
+DFBResult
+dfb_screen_get_encoder_info( CoreScreen                  *screen,
+                             int                          encoder,
+                             DFBScreenEncoderDescription *ret_desc )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( encoder >= 0 );
+     D_ASSERT( encoder < screen->shared->description.encoders );
+     D_ASSERT( ret_desc != NULL );
+
+     /* Return encoder description. */
+     *ret_desc = screen->shared->encoders[encoder].description;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_get_encoder_config( CoreScreen             *screen,
+                               int                     encoder,
+                               DFBScreenEncoderConfig *ret_config )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( encoder >= 0 );
+     D_ASSERT( encoder < screen->shared->description.encoders );
+     D_ASSERT( ret_config != NULL );
+
+     /* Return current encoder configuration. */
+     *ret_config = screen->shared->encoders[encoder].configuration;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_test_encoder_config( CoreScreen                   *screen,
+                                int                           encoder,
+                                const DFBScreenEncoderConfig *config,
+                                DFBScreenEncoderConfigFlags  *ret_failed )
+{
+     DFBResult                   ret;
+     DFBScreenEncoderConfigFlags failed = DSECONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestEncoderConfig != NULL );
+     D_ASSERT( encoder >= 0 );
+     D_ASSERT( encoder < screen->shared->description.encoders );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->encoders[encoder].configuration.flags );
+
+     /* Test the encoder configuration. */
+     ret = screen->funcs->TestEncoderConfig( screen,
+                                             screen->driver_data,
+                                             screen->screen_data,
+                                             encoder, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK && failed) );
+
+     if (ret_failed)
+          *ret_failed = failed;
+
+     return ret;
+}
+
+DFBResult
+dfb_screen_set_encoder_config( CoreScreen                   *screen,
+                               int                           encoder,
+                               const DFBScreenEncoderConfig *config )
+{
+     DFBResult                   ret;
+     DFBScreenEncoderConfigFlags failed = DSECONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestEncoderConfig != NULL );
+     D_ASSERT( screen->funcs->SetEncoderConfig != NULL );
+     D_ASSERT( encoder >= 0 );
+     D_ASSERT( encoder < screen->shared->description.encoders );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->encoders[encoder].configuration.flags );
+
+     /* Test configuration first. */
+     ret = screen->funcs->TestEncoderConfig( screen,
+                                             screen->driver_data,
+                                             screen->screen_data,
+                                             encoder, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK && failed) );
+
+     if (ret)
+          return ret;
+
+     /* Set configuration afterwards. */
+     ret = screen->funcs->SetEncoderConfig( screen,
+                                            screen->driver_data,
+                                            screen->screen_data,
+                                            encoder, config );
+     if (ret)
+          return ret;
+
+     /* Store current configuration. */
+     screen->shared->encoders[encoder].configuration = *config;
+
+     return DFB_OK;
+}
+
+
+/********************************** Outputs ***********************************/
+
+DFBResult
+dfb_screen_get_output_info( CoreScreen                 *screen,
+                            int                         output,
+                            DFBScreenOutputDescription *ret_desc )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( output >= 0 );
+     D_ASSERT( output < screen->shared->description.outputs );
+     D_ASSERT( ret_desc != NULL );
+
+     /* Return output description. */
+     *ret_desc = screen->shared->outputs[output].description;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_get_output_config( CoreScreen            *screen,
+                              int                    output,
+                              DFBScreenOutputConfig *ret_config )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( output >= 0 );
+     D_ASSERT( output < screen->shared->description.outputs );
+     D_ASSERT( ret_config != NULL );
+
+     /* Return current output configuration. */
+     *ret_config = screen->shared->outputs[output].configuration;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_test_output_config( CoreScreen                  *screen,
+                               int                          output,
+                               const DFBScreenOutputConfig *config,
+                               DFBScreenOutputConfigFlags  *ret_failed )
+{
+     DFBResult                  ret;
+     DFBScreenOutputConfigFlags failed = DSOCONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestOutputConfig != NULL );
+     D_ASSERT( output >= 0 );
+     D_ASSERT( output < screen->shared->description.outputs );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->outputs[output].configuration.flags );
+
+     /* Test the output configuration. */
+     ret = screen->funcs->TestOutputConfig( screen,
+                                            screen->driver_data,
+                                            screen->screen_data,
+                                            output, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK && failed) );
+
+     if (ret_failed)
+          *ret_failed = failed;
+
+     return ret;
+}
+
+DFBResult
+dfb_screen_set_output_config( CoreScreen                  *screen,
+                              int                          output,
+                              const DFBScreenOutputConfig *config )
+{
+     DFBResult                  ret;
+     DFBScreenOutputConfigFlags failed = DSOCONF_NONE;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->TestOutputConfig != NULL );
+     D_ASSERT( screen->funcs->SetOutputConfig != NULL );
+     D_ASSERT( output >= 0 );
+     D_ASSERT( output < screen->shared->description.outputs );
+     D_ASSERT( config != NULL );
+     D_ASSERT( config->flags == screen->shared->outputs[output].configuration.flags );
+
+     /* Test configuration first. */
+     ret = screen->funcs->TestOutputConfig( screen,
+                                            screen->driver_data,
+                                            screen->screen_data,
+                                            output, config, &failed );
+
+     D_ASSUME( (ret == DFB_OK && !failed) || (ret != DFB_OK && failed) );
+
+     if (ret)
+          return ret;
+
+     /* Set configuration afterwards. */
+     ret = screen->funcs->SetOutputConfig( screen,
+                                           screen->driver_data,
+                                           screen->screen_data,
+                                           output, config );
+     if (ret)
+          return ret;
+
+     /* Store current configuration. */
+     screen->shared->outputs[output].configuration = *config;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_screen_get_screen_size( CoreScreen *screen,
+                            int        *ret_width,
+                            int        *ret_height )
+{
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( screen->funcs->GetScreenSize != NULL );
+     D_ASSERT( ret_width != NULL );
+     D_ASSERT( ret_height != NULL );
+
+     return screen->funcs->GetScreenSize( screen,
+                                          screen->driver_data, screen->screen_data,
+                                          ret_width, ret_height );
+}
+
+DFBResult
+dfb_screen_get_layer_dimension( CoreScreen *screen,
+                                CoreLayer  *layer,
+                                int        *ret_width,
+                                int        *ret_height )
+{
+     int               i;
+     DFBResult         ret = DFB_UNSUPPORTED;
+     CoreScreenShared *shared;
+     ScreenFuncs      *funcs;
+
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     D_ASSERT( screen->funcs != NULL );
+     D_ASSERT( layer != NULL );
+     D_ASSERT( ret_width != NULL );
+     D_ASSERT( ret_height != NULL );
+
+     shared = screen->shared;
+     funcs  = screen->funcs;
+
+     if (funcs->GetMixerState) {
+          for (i=0; i<shared->description.mixers; i++) {
+               const DFBScreenMixerConfig *config = &shared->mixers[i].configuration;
+
+               if ((config->flags & DSMCONF_LAYERS) &&
+                   DFB_DISPLAYLAYER_IDS_HAVE( config->layers, dfb_layer_id(layer) ))
+               {
+                    CoreMixerState state;
+
+                    ret = funcs->GetMixerState( screen, screen->driver_data, screen->screen_data, i, &state );
+                    if (ret == DFB_OK) {
+                         if (state.flags & CMSF_DIMENSION) {
+                              *ret_width  = state.dimension.w;
+                              *ret_height = state.dimension.h;
+
+                              return DFB_OK;
+                         }
+
+                         ret = DFB_UNSUPPORTED;
+                    }
+               }
+          }
+
+          for (i=0; i<shared->description.mixers; i++) {
+               const DFBScreenMixerDescription *desc = &shared->mixers[i].description;
+
+               if ((desc->caps & DSMCAPS_SUB_LAYERS) &&
+                   DFB_DISPLAYLAYER_IDS_HAVE( desc->sub_layers, dfb_layer_id(layer) ))
+               {
+                    CoreMixerState state;
+
+                    ret = funcs->GetMixerState( screen, screen->driver_data, screen->screen_data, i, &state );
+                    if (ret == DFB_OK) {
+                         if (state.flags & CMSF_DIMENSION) {
+                              *ret_width  = state.dimension.w;
+                              *ret_height = state.dimension.h;
+
+                              return DFB_OK;
+                         }
+
+                         ret = DFB_UNSUPPORTED;
+                    }
+               }
+          }
+     }
+
+     if (funcs->GetScreenSize)
+          ret = funcs->GetScreenSize( screen,
+                                      screen->driver_data, screen->screen_data,
+                                      ret_width, ret_height );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/src/core/screen.h b/Source/DirectFB/src/core/screen.h
new file mode 100755
index 0000000..b5491f4
--- /dev/null
+++ b/Source/DirectFB/src/core/screen.h
@@ -0,0 +1,122 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__SCREEN_H__
+#define __DFB__CORE__SCREEN_H__
+
+#include <core/coretypes.h>
+
+DFBResult dfb_screen_get_info        ( CoreScreen                  *screen,
+                                       DFBScreenID                 *ret_id,
+                                       DFBScreenDescription        *ret_desc );
+
+
+/* Misc */
+
+DFBResult dfb_screen_suspend         ( CoreScreen                  *screen );
+DFBResult dfb_screen_resume          ( CoreScreen                  *screen );
+
+DFBResult dfb_screen_set_powermode   ( CoreScreen                  *screen,
+                                       DFBScreenPowerMode           mode );
+
+DFBResult dfb_screen_wait_vsync      ( CoreScreen                  *screen );
+
+
+/* Mixers */
+
+DFBResult dfb_screen_get_mixer_info   ( CoreScreen                 *screen,
+                                        int                         mixer,
+                                        DFBScreenMixerDescription  *ret_desc );
+
+DFBResult dfb_screen_get_mixer_config ( CoreScreen                 *screen,
+                                        int                         mixer,
+                                        DFBScreenMixerConfig       *ret_config );
+
+DFBResult dfb_screen_test_mixer_config( CoreScreen                 *screen,
+                                        int                         mixer,
+                                        const DFBScreenMixerConfig *config,
+                                        DFBScreenMixerConfigFlags  *ret_failed );
+
+DFBResult dfb_screen_set_mixer_config ( CoreScreen                 *screen,
+                                        int                         mixer,
+                                        const DFBScreenMixerConfig *config );
+
+
+/* Encoders */
+
+DFBResult dfb_screen_get_encoder_info   ( CoreScreen                   *screen,
+                                          int                           encoder,
+                                          DFBScreenEncoderDescription  *ret_desc );
+
+DFBResult dfb_screen_get_encoder_config ( CoreScreen                   *screen,
+                                          int                           encoder,
+                                          DFBScreenEncoderConfig       *ret_config );
+
+DFBResult dfb_screen_test_encoder_config( CoreScreen                   *screen,
+                                          int                           encoder,
+                                          const DFBScreenEncoderConfig *config,
+                                          DFBScreenEncoderConfigFlags  *ret_failed );
+
+DFBResult dfb_screen_set_encoder_config ( CoreScreen                   *screen,
+                                          int                           encoder,
+                                          const DFBScreenEncoderConfig *config );
+
+
+/* Outputs */
+
+DFBResult dfb_screen_get_output_info   ( CoreScreen                  *screen,
+                                         int                          output,
+                                         DFBScreenOutputDescription  *ret_desc );
+
+DFBResult dfb_screen_get_output_config ( CoreScreen                  *screen,
+                                         int                          output,
+                                         DFBScreenOutputConfig       *ret_config );
+
+DFBResult dfb_screen_test_output_config( CoreScreen                  *screen,
+                                         int                          output,
+                                         const DFBScreenOutputConfig *config,
+                                         DFBScreenOutputConfigFlags  *ret_failed );
+
+DFBResult dfb_screen_set_output_config ( CoreScreen                  *screen,
+                                         int                          output,
+                                         const DFBScreenOutputConfig *config );
+
+
+/* Screen configuration */
+
+DFBResult dfb_screen_get_screen_size    ( CoreScreen                 *screen,
+                                          int                        *ret_width,
+                                          int                        *ret_height );
+
+DFBResult dfb_screen_get_layer_dimension( CoreScreen                 *screen,
+                                          CoreLayer                  *layer,
+                                          int                        *ret_width,
+                                          int                        *ret_height );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/screens.c b/Source/DirectFB/src/core/screens.c
new file mode 100755
index 0000000..708f5e8
--- /dev/null
+++ b/Source/DirectFB/src/core/screens.c
@@ -0,0 +1,591 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/core_parts.h>
+
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/screens_internal.h>
+
+#include <core/layers.h>
+
+#include <misc/conf.h>
+
+
+D_DEBUG_DOMAIN( Core_Screen, "Core/Screen", "DirectFB Screen Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                  magic;
+
+
+     int                  num;
+     CoreScreenShared    *screens[MAX_SCREENS];
+} DFBScreenCoreShared;
+
+struct __DFB_DFBScreenCore {
+     int                  magic;
+
+     CoreDFB             *core;
+
+     DFBScreenCoreShared *shared;
+};
+
+
+DFB_CORE_PART( screen_core, ScreenCore );
+
+/**********************************************************************************************************************/
+
+static DFBScreenCoreShared *core_screens = NULL;       /* FIXME */
+
+static int          num_screens          = 0;          /* FIXME */
+static CoreScreen  *screens[MAX_SCREENS] = { NULL };   /* FIXME */
+
+
+static DFBResult
+dfb_screen_core_initialize( CoreDFB             *core,
+                            DFBScreenCore       *data,
+                            DFBScreenCoreShared *shared )
+{
+     int                  i;
+     DFBResult            ret;
+     FusionSHMPoolShared *pool;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+     core_screens = shared;   /* FIXME */
+
+     pool = dfb_core_shmpool( core );
+
+     /* Initialize all registered screens. */
+     for (i=0; i<num_screens; i++) {
+          char                  buf[24];
+          CoreScreenShared     *sshared;
+          CoreScreen           *screen = screens[i];
+          ScreenFuncs          *funcs  = screen->funcs;
+          DFBScreenDescription  desc   = { .caps = DSCCAPS_NONE };
+
+          /* Allocate shared data. */
+          sshared = SHCALLOC( pool, 1, sizeof(CoreScreenShared) );
+
+          /* Assign ID (zero based index). */
+          sshared->screen_id = i;
+
+          snprintf( buf, sizeof(buf), "Screen %d", i );
+
+          /* Initialize the lock. */
+          if (fusion_skirmish_init( &sshared->lock, buf, dfb_core_world(core) )) {
+               SHFREE( pool, sshared );
+               return DFB_FUSION;
+          }
+
+          /* Allocate driver's screen data. */
+          if (funcs->ScreenDataSize) {
+               int size = funcs->ScreenDataSize();
+
+               if (size > 0) {
+                    sshared->screen_data = SHCALLOC( pool, 1, size );
+                    if (!sshared->screen_data) {
+                         fusion_skirmish_destroy( &sshared->lock );
+                         SHFREE( pool, sshared );
+                         return D_OOSHM();
+                    }
+               }
+          }
+
+          /* Initialize the screen and get the screen description. */
+          ret = funcs->InitScreen( screen,
+                                   screen->device,
+                                   screen->driver_data,
+                                   sshared->screen_data,
+                                   &desc );
+          if (ret) {
+               D_ERROR("DirectFB/Core/screens: "
+                        "Failed to initialize screen %d!\n", sshared->screen_id);
+
+               fusion_skirmish_destroy( &sshared->lock );
+
+               if (sshared->screen_data)
+                    SHFREE( pool, sshared->screen_data );
+
+               SHFREE( pool, sshared );
+
+               return ret;
+          }
+
+          D_ASSUME( desc.mixers  > 0 || !(desc.caps & DSCCAPS_MIXERS) );
+          D_ASSUME( desc.mixers == 0 ||  (desc.caps & DSCCAPS_MIXERS) );
+
+          D_ASSUME( desc.encoders  > 0 || !(desc.caps & DSCCAPS_ENCODERS) );
+          D_ASSUME( desc.encoders == 0 ||  (desc.caps & DSCCAPS_ENCODERS) );
+
+          D_ASSUME( desc.outputs  > 0 || !(desc.caps & DSCCAPS_OUTPUTS) );
+          D_ASSUME( desc.outputs == 0 ||  (desc.caps & DSCCAPS_OUTPUTS) );
+
+          D_ASSERT( desc.mixers >= 0 );
+          D_ASSERT( desc.mixers <= 32 );
+          D_ASSERT( desc.encoders >= 0 );
+          D_ASSERT( desc.encoders <= 32 );
+          D_ASSERT( desc.outputs >= 0 );
+          D_ASSERT( desc.outputs <= 32 );
+
+          /* Store description in sshared memory. */
+          sshared->description = desc;
+
+          /* Initialize mixers. */
+          if (sshared->description.mixers) {
+               int i;
+
+               D_ASSERT( funcs->InitMixer != NULL );
+               D_ASSERT( funcs->SetMixerConfig != NULL );
+
+               sshared->mixers = SHCALLOC( pool, sshared->description.mixers,
+                                           sizeof(CoreScreenMixer) );
+               for (i=0; i<sshared->description.mixers; i++) {
+                    funcs->InitMixer( screen,
+                                      screen->driver_data,
+                                      sshared->screen_data, i,
+                                      &sshared->mixers[i].description,
+                                      &sshared->mixers[i].configuration );
+                    funcs->SetMixerConfig( screen,
+                                           screen->driver_data,
+                                           sshared->screen_data, i,
+                                           &sshared->mixers[i].configuration );
+               }
+          }
+
+          /* Initialize encoders. */
+          if (sshared->description.encoders) {
+               int i;
+
+               D_ASSERT( funcs->InitEncoder != NULL );
+               D_ASSERT( funcs->SetEncoderConfig != NULL );
+
+               sshared->encoders = SHCALLOC( pool, sshared->description.encoders,
+                                             sizeof(CoreScreenEncoder) );
+               for (i=0; i<sshared->description.encoders; i++) {
+                    funcs->InitEncoder( screen,
+                                        screen->driver_data,
+                                        sshared->screen_data, i,
+                                        &sshared->encoders[i].description,
+                                        &sshared->encoders[i].configuration );
+                    funcs->SetEncoderConfig( screen,
+                                             screen->driver_data,
+                                             sshared->screen_data, i,
+                                             &sshared->encoders[i].configuration );
+               }
+          }
+
+          /* Initialize outputs. */
+          if (sshared->description.outputs) {
+               int i;
+
+               D_ASSERT( funcs->InitOutput != NULL );
+               D_ASSERT( funcs->SetOutputConfig != NULL );
+
+               sshared->outputs = SHCALLOC( pool, sshared->description.outputs,
+                                            sizeof(CoreScreenOutput) );
+               for (i=0; i<sshared->description.outputs; i++) {
+                    funcs->InitOutput( screen,
+                                       screen->driver_data,
+                                       sshared->screen_data, i,
+                                       &sshared->outputs[i].description,
+                                       &sshared->outputs[i].configuration );
+                    funcs->SetOutputConfig( screen,
+                                            screen->driver_data,
+                                            sshared->screen_data, i,
+                                            &sshared->outputs[i].configuration );
+               }
+          }
+
+          /* Make a copy for faster access. */
+          screen->screen_data = sshared->screen_data;
+
+          /* Store pointer to sshared data and core. */
+          screen->shared = sshared;
+          screen->core   = core;
+
+          /* Add the screen to the sshared list. */
+          core_screens->screens[ core_screens->num++ ] = sshared;
+     }
+
+
+     D_MAGIC_SET( data, DFBScreenCore );
+     D_MAGIC_SET( shared, DFBScreenCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_screen_core_join( CoreDFB             *core,
+                      DFBScreenCore       *data,
+                      DFBScreenCoreShared *shared )
+{
+     int i;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBScreenCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+     core_screens = shared;   /* FIXME */
+
+     if (num_screens != core_screens->num) {
+          D_ERROR("DirectFB/core/screens: Number of screens does not match!\n");
+          return DFB_BUG;
+     }
+
+     for (i=0; i<num_screens; i++) {
+          CoreScreen       *screen = screens[i];
+          CoreScreenShared *shared = core_screens->screens[i];
+
+          /* Make a copy for faster access. */
+          screen->screen_data = shared->screen_data;
+
+          /* Store pointer to shared data and core. */
+          screen->shared = shared;
+          screen->core   = core;
+     }
+
+
+     D_MAGIC_SET( data, DFBScreenCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_screen_core_shutdown( DFBScreenCore *data,
+                          bool           emergency )
+{
+     int                  i;
+     FusionSHMPoolShared *pool;
+     DFBScreenCoreShared *shared;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBScreenCore );
+     D_MAGIC_ASSERT( data->shared, DFBScreenCoreShared );
+
+     shared = data->shared;
+
+     pool = dfb_core_shmpool( data->core );
+
+     /* Begin with the most recently added screen. */
+     for (i=num_screens-1; i>=0; i--) {
+          CoreScreen       *screen = screens[i];
+          CoreScreenShared *shared = screen->shared;
+
+          /* Deinitialize the lock. */
+          fusion_skirmish_destroy( &shared->lock );
+
+          /* Free the driver's screen data. */
+          if (shared->screen_data)
+               SHFREE( pool, shared->screen_data );
+
+          /* Free mixer data. */
+          if (shared->mixers)
+               SHFREE( pool, shared->mixers );
+
+          /* Free encoder data. */
+          if (shared->encoders)
+               SHFREE( pool, shared->encoders );
+
+          /* Free output data. */
+          if (shared->outputs)
+               SHFREE( pool, shared->outputs );
+
+          /* Free the shared screen data. */
+          SHFREE( pool, shared );
+
+          /* Free the local screen data. */
+          D_FREE( screen );
+     }
+
+     core_screens = NULL;
+     num_screens  = 0;
+
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_screen_core_leave( DFBScreenCore *data,
+                       bool           emergency )
+{
+     int                  i;
+     DFBScreenCoreShared *shared;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBScreenCore );
+     D_MAGIC_ASSERT( data->shared, DFBScreenCoreShared );
+
+     shared = data->shared;
+
+
+     /* Deinitialize all local stuff only. */
+     for (i=0; i<num_screens; i++) {
+          CoreScreen *screen = screens[i];
+
+          /* Free local screen data. */
+          D_FREE( screen );
+     }
+
+     core_screens = NULL;
+     num_screens  = 0;
+
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_screen_core_suspend( DFBScreenCore *data )
+{
+     int                  i;
+     DFBScreenCoreShared *shared;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBScreenCore );
+     D_MAGIC_ASSERT( data->shared, DFBScreenCoreShared );
+
+     shared = data->shared;
+
+     for (i=num_screens-1; i>=0; i--)
+          dfb_screen_suspend( screens[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_screen_core_resume( DFBScreenCore *data )
+{
+     int                  i;
+     DFBScreenCoreShared *shared;
+
+     D_DEBUG_AT( Core_Screen, "dfb_screen_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBScreenCore );
+     D_MAGIC_ASSERT( data->shared, DFBScreenCoreShared );
+
+     shared = data->shared;
+
+     for (i=0; i<num_screens; i++)
+          dfb_screen_resume( screens[i] );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+CoreScreen *
+dfb_screens_register( CoreGraphicsDevice *device,
+                      void               *driver_data,
+                      ScreenFuncs        *funcs )
+{
+     CoreScreen *screen;
+
+     D_ASSERT( funcs != NULL );
+
+     if (num_screens == MAX_SCREENS) {
+          D_ERROR( "DirectFB/Core/screen: "
+                    "Maximum number of screens reached!\n" );
+          return NULL;
+     }
+
+     /* allocate local data */
+     screen = D_CALLOC( 1, sizeof(CoreScreen) );
+
+     /* assign local pointers */
+     screen->device      = device;
+     screen->driver_data = driver_data;
+     screen->funcs       = funcs;
+
+     /* add it to the local list */
+     screens[num_screens++] = screen;
+
+     return screen;
+}
+
+typedef void (*AnyFunc)( void );
+
+CoreScreen *
+dfb_screens_hook_primary( CoreGraphicsDevice  *device,
+                          void                *driver_data,
+                          ScreenFuncs         *funcs,
+                          ScreenFuncs         *primary_funcs,
+                          void               **primary_driver_data )
+{
+     int         i;
+     int         entries;
+     CoreScreen *primary = screens[0];
+
+     D_ASSERT( primary != NULL );
+     D_ASSERT( device != NULL );
+     D_ASSERT( funcs != NULL );
+
+     /* copy content of original function table */
+     if (primary_funcs)
+          direct_memcpy( primary_funcs, primary->funcs, sizeof(ScreenFuncs) );
+
+     /* copy pointer to original driver data */
+     if (primary_driver_data)
+          *primary_driver_data = primary->driver_data;
+
+     /* replace all entries in the old table that aren't NULL in the new one */
+     entries = sizeof(ScreenFuncs) / sizeof(void(*)( void ));
+     for (i=0; i<entries; i++) {
+          AnyFunc *newfuncs = (AnyFunc*) funcs;
+          AnyFunc *oldfuncs = (AnyFunc*) primary->funcs;
+
+          if (newfuncs[i])
+               oldfuncs[i] = newfuncs[i];
+     }
+
+     /* replace device and driver data pointer */
+     primary->device      = device;
+     primary->driver_data = driver_data;
+
+     return primary;
+}
+
+CoreScreen *
+dfb_screens_register_primary( CoreGraphicsDevice *device,
+                              void               *driver_data,
+                              ScreenFuncs        *funcs )
+{
+     CoreScreen *primary = screens[0];
+
+     D_ASSERT( primary != NULL );
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( num_screens > 0 );
+
+     /* replace device, function table and driver data pointer */
+     primary->device      = device;
+     primary->funcs       = funcs;
+     primary->driver_data = driver_data;
+
+     return primary;
+}
+
+void
+dfb_screens_enumerate( CoreScreenCallback  callback,
+                       void               *ctx )
+{
+     int i;
+
+     D_ASSERT( core_screens != NULL );
+     D_ASSERT( callback != NULL );
+
+     for (i=0; i<num_screens; i++) {
+          if (callback( screens[i], ctx ) == DFENUM_CANCEL)
+               break;
+     }
+}
+
+CoreScreen *
+dfb_screens_at( DFBScreenID screen_id )
+{
+     D_ASSERT( screen_id >= 0);
+     D_ASSERT( screen_id < num_screens);
+
+     return screens[screen_id];
+}
+
+CoreScreen *
+dfb_screens_at_translated( DFBScreenID screen_id )
+{
+     CoreScreen *primary;
+     
+     D_ASSERT( screen_id >= 0);
+     D_ASSERT( screen_id < num_screens);
+     
+     if (dfb_config->primary_layer > 0) {
+          primary = dfb_layer_screen( dfb_layer_at_translated( DLID_PRIMARY ) );
+          
+          if (screen_id == DSCID_PRIMARY)
+               return primary;
+               
+          if (screen_id == primary->shared->screen_id)
+               return dfb_screens_at( DSCID_PRIMARY );
+     }
+     
+     return dfb_screens_at( screen_id );
+}
+
+DFBScreenID
+dfb_screen_id_translated( CoreScreen *screen )
+{
+     CoreScreenShared *shared;
+     CoreScreen       *primary;
+     
+     D_ASSERT( screen != NULL );
+     D_ASSERT( screen->shared != NULL );
+     
+     shared = screen->shared;
+     
+     if (dfb_config->primary_layer > 0) {
+          primary = dfb_layer_screen( dfb_layer_at_translated( DLID_PRIMARY ) );
+          
+          if (shared->screen_id == DSCID_PRIMARY)
+               return primary->shared->screen_id;
+               
+          if (shared->screen_id == primary->shared->screen_id)
+               return DSCID_PRIMARY;
+     }
+     
+     return shared->screen_id;
+}
+
diff --git a/Source/DirectFB/src/core/screens.h b/Source/DirectFB/src/core/screens.h
new file mode 100755
index 0000000..1ebaa4e
--- /dev/null
+++ b/Source/DirectFB/src/core/screens.h
@@ -0,0 +1,263 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__SCREENS_H__
+#define __DFB__CORE__SCREENS_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+
+typedef DFBEnumerationResult (*CoreScreenCallback) (CoreScreen *screen,
+                                                    void       *ctx);
+
+typedef enum {
+     CMSF_NONE      = 0x00000000,  /* none of these */
+
+     CMSF_DIMENSION = 0x00000001,  /* dimension is set */
+
+     CMSF_ALL       = 0x00000001,  /* all of these */
+} CoreMixerStateFlags;
+
+typedef struct {
+     CoreMixerStateFlags flags;
+
+     DFBDimension        dimension;
+} CoreMixerState;
+
+typedef struct {
+   /** Driver Control **/
+
+     /*
+      * Return size of screen data (shared memory).
+      */
+     int       (*ScreenDataSize)(void);
+
+     /*
+      * Called once by the master to initialize screen data and reset hardware.
+      * Driver has to fill the screen description.
+      */
+     DFBResult (*InitScreen)    ( CoreScreen                   *screen,
+                                  CoreGraphicsDevice           *device,
+                                  void                         *driver_data,
+                                  void                         *screen_data,
+                                  DFBScreenDescription         *description );
+
+     /*
+      * Called once by the master for each mixer.
+      * Driver fills description and default config.
+      */
+     DFBResult (*InitMixer)     ( CoreScreen                   *screen,
+                                  void                         *driver_data,
+                                  void                         *screen_data,
+                                  int                           mixer,
+                                  DFBScreenMixerDescription    *description,
+                                  DFBScreenMixerConfig         *config );
+
+     /*
+      * Called once by the master for each encoder.
+      * Driver fills description and default config.
+      */
+     DFBResult (*InitEncoder)   ( CoreScreen                   *screen,
+                                  void                         *driver_data,
+                                  void                         *screen_data,
+                                  int                           encoder,
+                                  DFBScreenEncoderDescription  *description,
+                                  DFBScreenEncoderConfig       *config );
+
+     /*
+      * Called once by the master for each output.
+      * Driver fills description and default config.
+      */
+     DFBResult (*InitOutput)    ( CoreScreen                   *screen,
+                                  void                         *driver_data,
+                                  void                         *screen_data,
+                                  int                           output,
+                                  DFBScreenOutputDescription   *description,
+                                  DFBScreenOutputConfig        *config );
+
+
+   /** Power management **/
+
+     /*
+      * Switch between "on", "standby", "suspend" and "off".
+      */
+     DFBResult (*SetPowerMode)   ( CoreScreen             *screen,
+                                   void                   *driver_data,
+                                   void                   *screen_data,
+                                   DFBScreenPowerMode      mode );
+
+
+   /** Synchronization **/
+
+     /*
+      * Wait for the vertical retrace.
+      */
+     DFBResult (*WaitVSync)      ( CoreScreen             *screen,
+                                   void                   *driver_data,
+                                   void                   *screen_data );
+
+
+   /** Mixer configuration **/
+
+     /*
+      * Test if configuration is supported. Store failing fields in 'failed'.
+      */
+     DFBResult (*TestMixerConfig)( CoreScreen                  *screen,
+                                   void                        *driver_data,
+                                   void                        *screen_data,
+                                   int                          mixer,
+                                   const DFBScreenMixerConfig  *config,
+                                   DFBScreenMixerConfigFlags   *failed );
+
+     /*
+      * Set new configuration.
+      */
+     DFBResult (*SetMixerConfig) ( CoreScreen                  *screen,
+                                   void                        *driver_data,
+                                   void                        *screen_data,
+                                   int                          mixer,
+                                   const DFBScreenMixerConfig  *config );
+
+
+   /** Encoder configuration **/
+
+     /*
+      * Test if configuration is supported. Store failing fields in 'failed'.
+      */
+     DFBResult (*TestEncoderConfig)( CoreScreen                   *screen,
+                                     void                         *driver_data,
+                                     void                         *screen_data,
+                                     int                           encoder,
+                                     const DFBScreenEncoderConfig *config,
+                                     DFBScreenEncoderConfigFlags  *failed );
+
+     /*
+      * Set new configuration.
+      */
+     DFBResult (*SetEncoderConfig) ( CoreScreen                   *screen,
+                                     void                         *driver_data,
+                                     void                         *screen_data,
+                                     int                           encoder,
+                                     const DFBScreenEncoderConfig *config );
+
+
+   /** Output configuration **/
+
+     /*
+      * Test if configuration is supported. Store failing fields in 'failed'.
+      */
+     DFBResult (*TestOutputConfig)( CoreScreen                  *screen,
+                                    void                        *driver_data,
+                                    void                        *screen_data,
+                                    int                          output,
+                                    const DFBScreenOutputConfig *config,
+                                    DFBScreenOutputConfigFlags  *failed );
+
+     /*
+      * Set new configuration.
+      */
+     DFBResult (*SetOutputConfig) ( CoreScreen                  *screen,
+                                    void                        *driver_data,
+                                    void                        *screen_data,
+                                    int                          output,
+                                    const DFBScreenOutputConfig *config );
+
+
+   /** Screen configuration **/
+
+     /*
+      * Return the screen size, e.g. as a basis for positioning a layer.
+      *
+      * This function might be replaced soon.
+      */
+     DFBResult (*GetScreenSize)   ( CoreScreen                  *screen,
+                                    void                        *driver_data,
+                                    void                        *screen_data,
+                                    int                         *ret_width,
+                                    int                         *ret_height );
+
+
+   /** States **/
+
+     DFBResult (*GetMixerState)   ( CoreScreen                  *screen,
+                                    void                        *driver_data,
+                                    void                        *screen_data,
+                                    int                          mixer,
+                                    CoreMixerState              *ret_state );
+} ScreenFuncs;
+
+
+/*
+ * Add a screen to a graphics device by pointing to a table containing
+ * driver functions. The driver data will be passed to these functions.
+ */
+CoreScreen *dfb_screens_register( CoreGraphicsDevice *device,
+                                  void               *driver_data,
+                                  ScreenFuncs        *funcs );
+
+/*
+ * Replace functions of the primary screen implementation by passing
+ * an alternative driver function table. All non-NULL functions in the new
+ * table replace the functions in the original function table.
+ * The original function table is written to 'primary_funcs' before to allow
+ * drivers to use existing functionality from the original implementation.
+ */
+CoreScreen *dfb_screens_hook_primary( CoreGraphicsDevice  *device,
+                                      void                *driver_data,
+                                      ScreenFuncs         *funcs,
+                                      ScreenFuncs         *primary_funcs,
+                                      void               **primary_driver_data );
+
+/*
+ * Replace the default implementation for the primary screen.
+ */
+CoreScreen *dfb_screens_register_primary( CoreGraphicsDevice *device,
+                                          void               *driver_data,
+                                          ScreenFuncs        *funcs );
+
+/*
+ * Enumerate all registered screens by invoking the callback for each screen.
+ */
+void dfb_screens_enumerate( CoreScreenCallback  callback,
+                            void               *ctx );
+
+/*
+ * Returns the screen with the specified ID.
+ */
+CoreScreen *dfb_screens_at( DFBScreenID screen_id );
+
+CoreScreen *dfb_screens_at_translated( DFBScreenID screen_id );
+
+/*
+ * Return the (translated) ID of the specified screen.
+ */
+DFBScreenID dfb_screen_id_translated( CoreScreen *screen );
+
+#endif
diff --git a/Source/DirectFB/src/core/screens_internal.h b/Source/DirectFB/src/core/screens_internal.h
new file mode 100755
index 0000000..361b571
--- /dev/null
+++ b/Source/DirectFB/src/core/screens_internal.h
@@ -0,0 +1,81 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__SCREENS_INTERNAL_H__
+#define __DFB__CORE__SCREENS_INTERNAL_H__
+
+#include <directfb.h>
+
+#include <fusion/lock.h>
+
+#include <core/coretypes.h>
+#include <core/screens.h>
+
+typedef struct {
+     DFBScreenMixerDescription   description;
+     DFBScreenMixerConfig        configuration;
+} CoreScreenMixer;
+
+typedef struct {
+     DFBScreenEncoderDescription description;
+     DFBScreenEncoderConfig      configuration;
+} CoreScreenEncoder;
+
+typedef struct {
+     DFBScreenOutputDescription  description;
+     DFBScreenOutputConfig       configuration;
+} CoreScreenOutput;
+
+typedef struct {
+     FusionSkirmish        lock;
+
+     DFBScreenID           screen_id;
+
+     DFBScreenDescription  description;
+
+     CoreScreenMixer      *mixers;
+     CoreScreenEncoder    *encoders;
+     CoreScreenOutput     *outputs;
+
+     void                 *screen_data;
+} CoreScreenShared;
+
+struct __DFB_CoreScreen {
+     CoreScreenShared     *shared;
+
+     CoreDFB              *core;
+     CoreGraphicsDevice   *device;
+
+     ScreenFuncs          *funcs;
+
+     void                 *driver_data;
+     void                 *screen_data;   /* copy of shared->screen_data */
+};
+
+#endif
+
diff --git a/Source/DirectFB/src/core/shared_surface_pool.c b/Source/DirectFB/src/core/shared_surface_pool.c
new file mode 100755
index 0000000..5199a84
--- /dev/null
+++ b/Source/DirectFB/src/core/shared_surface_pool.c
@@ -0,0 +1,227 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+
+#include <fusion/conf.h>
+#include <fusion/shmalloc.h>
+#include <fusion/shm/pool.h>
+
+#include <core/core.h>
+#include <core/surface_pool.h>
+
+#include <misc/conf.h>
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     FusionSHMPoolShared *shmpool;
+} SharedPoolData;
+
+typedef struct {
+     CoreDFB     *core;
+     FusionWorld *world;
+} SharedPoolLocalData;
+
+typedef struct {
+     void *addr;
+     int   pitch;
+     int   size;
+} SharedAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+sharedPoolDataSize( void )
+{
+     return sizeof(SharedPoolData);
+}
+
+static int
+sharedPoolLocalDataSize( void )
+{
+     return sizeof(SharedPoolLocalData);
+}
+
+static int
+sharedAllocationDataSize( void )
+{
+     return sizeof(SharedAllocationData);
+}
+
+static DFBResult
+sharedInitPool( CoreDFB                    *core,
+                CoreSurfacePool            *pool,
+                void                       *pool_data,
+                void                       *pool_local,
+                void                       *system_data,
+                CoreSurfacePoolDescription *ret_desc )
+{
+     DFBResult            ret;
+     SharedPoolData      *data  = pool_data;
+     SharedPoolLocalData *local = pool_local;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( ret_desc != NULL );
+
+     local->core  = core;
+     local->world = dfb_core_world( core );
+
+     ret = fusion_shm_pool_create( local->world, "Surface Memory Pool", dfb_config->surface_shmpool_size,
+                                   fusion_config->debugshm, &data->shmpool );
+     if (ret)
+          return ret;
+
+     ret_desc->caps              = CSPCAPS_NONE;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ | CSAF_SHARED;
+     ret_desc->access[CSAID_LAYER1] = CSAF_READ | CSAF_SHARED;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_INTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Shared Memory" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sharedDestroyPool( CoreSurfacePool *pool,
+                   void            *pool_data,
+                   void            *pool_local )
+{
+     SharedPoolData      *data  = pool_data;
+     SharedPoolLocalData *local = pool_local;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     fusion_shm_pool_destroy( local->world, data->shmpool );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sharedAllocateBuffer( CoreSurfacePool       *pool,
+                      void                  *pool_data,
+                      void                  *pool_local,
+                      CoreSurfaceBuffer     *buffer,
+                      CoreSurfaceAllocation *allocation,
+                      void                  *alloc_data )
+{
+     CoreSurface          *surface;
+     SharedPoolData       *data  = pool_data;
+     SharedAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     dfb_surface_calc_buffer_size( surface, 8, 0, &alloc->pitch, &alloc->size );
+
+     alloc->addr = SHMALLOC( data->shmpool, alloc->size );
+     if (!alloc->addr)
+          return D_OOSHM();
+
+     allocation->flags = CSALF_VOLATILE;
+     allocation->size  = alloc->size;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sharedDeallocateBuffer( CoreSurfacePool       *pool,
+                        void                  *pool_data,
+                        void                  *pool_local,
+                        CoreSurfaceBuffer     *buffer,
+                        CoreSurfaceAllocation *allocation,
+                        void                  *alloc_data )
+{
+     SharedPoolData       *data  = pool_data;
+     SharedAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     SHFREE( data->shmpool, alloc->addr );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sharedLock( CoreSurfacePool       *pool,
+            void                  *pool_data,
+            void                  *pool_local,
+            CoreSurfaceAllocation *allocation,
+            void                  *alloc_data,
+            CoreSurfaceBufferLock *lock )
+{
+     SharedAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     lock->addr  = alloc->addr;
+     lock->pitch = alloc->pitch;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sharedUnlock( CoreSurfacePool       *pool,
+              void                  *pool_data,
+              void                  *pool_local,
+              CoreSurfaceAllocation *allocation,
+              void                  *alloc_data,
+              CoreSurfaceBufferLock *lock )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs sharedSurfacePoolFuncs = {
+     .PoolDataSize       = sharedPoolDataSize,
+     .PoolLocalDataSize  = sharedPoolLocalDataSize,
+     .AllocationDataSize = sharedAllocationDataSize,
+     .InitPool           = sharedInitPool,
+     .DestroyPool        = sharedDestroyPool,
+
+     .AllocateBuffer     = sharedAllocateBuffer,
+     .DeallocateBuffer   = sharedDeallocateBuffer,
+
+     .Lock               = sharedLock,
+     .Unlock             = sharedUnlock,
+};
+
diff --git a/Source/DirectFB/src/core/state.c b/Source/DirectFB/src/core/state.c
new file mode 100755
index 0000000..8ae97e0
--- /dev/null
+++ b/Source/DirectFB/src/core/state.c
@@ -0,0 +1,416 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+
+#include <pthread.h>
+
+#include <fusion/fusion.h>
+#include <fusion/reactor.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coretypes.h>
+
+#include <core/palette.h>
+#include <core/state.h>
+#include <core/surface.h>
+
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+
+
+static inline void
+validate_clip( CardState *state,
+               int        xmax,
+               int        ymax,
+               bool       warn )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     DFB_REGION_ASSERT( &state->clip );
+
+     D_ASSERT( xmax >= 0 );
+     D_ASSERT( ymax >= 0 );
+     D_ASSERT( state->clip.x1 <= state->clip.x2 );
+     D_ASSERT( state->clip.y1 <= state->clip.y2 );
+
+     if (state->clip.x1 <= xmax &&
+         state->clip.y1 <= ymax &&
+         state->clip.x2 <= xmax &&
+         state->clip.y2 <= ymax)
+          return;
+
+     if (warn)
+          D_WARN( "Clip %d,%d-%dx%d invalid, adjusting to fit %dx%d",
+                  DFB_RECTANGLE_VALS_FROM_REGION( &state->clip ), xmax+1, ymax+1 );
+
+     if (state->clip.x1 > xmax)
+          state->clip.x1 = xmax;
+
+     if (state->clip.y1 > ymax)
+          state->clip.y1 = ymax;
+
+     if (state->clip.x2 > xmax)
+          state->clip.x2 = xmax;
+
+     if (state->clip.y2 > ymax)
+          state->clip.y2 = ymax;
+
+     state->modified |= SMF_CLIP;
+}
+
+int
+dfb_state_init( CardState *state, CoreDFB *core )
+{
+     D_ASSERT( state != NULL );
+
+     memset( state, 0, sizeof(CardState) );
+
+     state->core           = core;
+     state->fusion_id      = fusion_id( dfb_core_world(core) );
+     state->modified       = SMF_ALL;
+     state->src_blend      = DSBF_SRCALPHA;
+     state->dst_blend      = DSBF_INVSRCALPHA;
+     state->render_options = dfb_config->render_options;
+
+     state->matrix[0] = 0x10000; 
+     state->matrix[1] = 0x00000; 
+     state->matrix[2] = 0x00000;
+     state->matrix[3] = 0x00000; 
+     state->matrix[4] = 0x10000; 
+     state->matrix[5] = 0x00000;
+     state->matrix[6] = 0x00000; 
+     state->matrix[7] = 0x00000; 
+     state->matrix[8] = 0x10000;
+     state->affine_matrix = DFB_TRUE;
+
+     state->from      = CSBR_FRONT;
+     state->to        = CSBR_BACK;
+
+     direct_util_recursive_pthread_mutex_init( &state->lock );
+
+     direct_serial_init( &state->dst_serial );
+     direct_serial_init( &state->src_serial );
+     direct_serial_init( &state->src_mask_serial );
+
+     D_MAGIC_SET( state, CardState );
+
+     return 0;
+}
+
+void
+dfb_state_destroy( CardState *state )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     D_ASSUME( !(state->flags & CSF_DRAWING) );
+
+     D_ASSERT( state->destination == NULL );
+     D_ASSERT( state->source == NULL );
+     D_ASSERT( state->source_mask == NULL );
+
+     D_MAGIC_CLEAR( state );
+
+     direct_serial_deinit( &state->dst_serial );
+     direct_serial_deinit( &state->src_serial );
+     direct_serial_deinit( &state->src_mask_serial );
+
+     if (state->gfxs) {
+          GenefxState *gfxs = state->gfxs;
+
+          if (gfxs->ABstart)
+               D_FREE( gfxs->ABstart );
+
+          D_FREE( gfxs );
+     }
+
+     if (state->num_translation) {
+          D_ASSERT( state->index_translation != NULL );
+
+          D_FREE( state->index_translation );
+     }
+     else
+          D_ASSERT( state->index_translation == NULL );
+
+     pthread_mutex_destroy( &state->lock );
+}
+
+DFBResult
+dfb_state_set_destination( CardState *state, CoreSurface *destination )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     dfb_state_lock( state );
+
+     D_ASSUME( !(state->flags & CSF_DRAWING) );
+
+     if (state->destination != destination) {
+          if (destination) {
+               if (dfb_surface_ref( destination )) {
+                    D_WARN( "could not ref() destination" );
+                    dfb_state_unlock( state );
+                    return DFB_DEAD;
+               }
+
+               validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, false );
+          }
+
+          if (state->destination) {
+               D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_DESTINATION ) );
+               dfb_surface_unref( state->destination );
+          }
+
+          state->destination  = destination;
+          state->modified    |= SMF_DESTINATION;
+
+          if (destination) {
+               direct_serial_copy( &state->dst_serial, &destination->serial );
+
+               D_FLAGS_SET( state->flags, CSF_DESTINATION );
+          }
+          else
+               D_FLAGS_CLEAR( state->flags, CSF_DESTINATION );
+     }
+
+     dfb_state_unlock( state );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_state_set_source( CardState *state, CoreSurface *source )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     dfb_state_lock( state );
+
+     if (state->source != source) {
+          if (source && dfb_surface_ref( source )) {
+               D_WARN( "could not ref() source" );
+               dfb_state_unlock( state );
+               return DFB_DEAD;
+          }
+
+          if (state->source) {
+               D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_SOURCE ) );
+               dfb_surface_unref( state->source );
+          }
+
+          state->source    = source;
+          state->modified |= SMF_SOURCE;
+
+          if (source) {
+               direct_serial_copy( &state->src_serial, &source->serial );
+
+               D_FLAGS_SET( state->flags, CSF_SOURCE );
+          }
+          else
+               D_FLAGS_CLEAR( state->flags, CSF_SOURCE );
+     }
+
+     dfb_state_unlock( state );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_state_set_source_mask( CardState *state, CoreSurface *source_mask )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     dfb_state_lock( state );
+
+     if (state->source_mask != source_mask) {
+          if (source_mask && dfb_surface_ref( source_mask )) {
+               D_WARN( "could not ref() source mask" );
+               dfb_state_unlock( state );
+               return DFB_DEAD;
+          }
+
+          if (state->source_mask) {
+               D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_SOURCE_MASK ) );
+               dfb_surface_unref( state->source_mask );
+          }
+
+          state->source_mask  = source_mask;
+          state->modified    |= SMF_SOURCE_MASK;
+
+          if (source_mask) {
+               direct_serial_copy( &state->src_mask_serial, &source_mask->serial );
+
+               D_FLAGS_SET( state->flags, CSF_SOURCE_MASK );
+          }
+          else
+               D_FLAGS_CLEAR( state->flags, CSF_SOURCE_MASK );
+     }
+
+     dfb_state_unlock( state );
+
+     return DFB_OK;
+}
+
+void
+dfb_state_update( CardState *state, bool update_sources )
+{
+     CoreSurface *destination;
+
+     D_MAGIC_ASSERT( state, CardState );
+     DFB_REGION_ASSERT( &state->clip );
+
+     destination = state->destination;
+
+     if (D_FLAGS_IS_SET( state->flags, CSF_DESTINATION )) {
+
+          D_ASSERT( destination != NULL );
+
+          if (direct_serial_update( &state->dst_serial, &destination->serial )) {
+               validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true );
+
+               state->modified |= SMF_DESTINATION;
+          }
+     }
+     else if (destination)
+          validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true );
+
+     if (update_sources && D_FLAGS_IS_SET( state->flags, CSF_SOURCE )) {
+          CoreSurface *source = state->source;
+
+          D_ASSERT( source != NULL );
+
+          if (direct_serial_update( &state->src_serial, &source->serial ))
+               state->modified |= SMF_SOURCE;
+     }
+
+     if (update_sources && D_FLAGS_IS_SET( state->flags, CSF_SOURCE_MASK )) {
+          CoreSurface *source_mask = state->source_mask;
+
+          D_ASSERT( source_mask != NULL );
+
+          if (direct_serial_update( &state->src_mask_serial, &source_mask->serial ))
+               state->modified |= SMF_SOURCE_MASK;
+     }
+}
+
+DFBResult
+dfb_state_set_index_translation( CardState *state,
+                                 const int *indices,
+                                 int        num_indices )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     D_ASSERT( indices != NULL || num_indices == 0 );
+
+     dfb_state_lock( state );
+
+     if (state->num_translation != num_indices) {
+          int *new_trans = D_REALLOC( state->index_translation,
+                                      num_indices * sizeof(int) );
+
+          D_ASSERT( num_indices || new_trans == NULL );
+
+          if (num_indices && !new_trans) {
+               dfb_state_unlock( state );
+               return D_OOM();
+          }
+
+          state->index_translation = new_trans;
+          state->num_translation   = num_indices;
+     }
+
+     if (num_indices)
+          direct_memcpy( state->index_translation, indices, num_indices * sizeof(int) );
+
+     state->modified |= SMF_INDEX_TRANSLATION;
+
+     dfb_state_unlock( state );
+
+     return DFB_OK;
+}
+
+void
+dfb_state_set_matrix( CardState *state,
+                      const s32 *matrix )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     D_ASSERT( matrix != NULL );
+
+     if (memcmp( state->matrix, matrix, sizeof(state->matrix) )) {
+          direct_memcpy( state->matrix, matrix, sizeof(state->matrix) );
+          
+          state->affine_matrix = (matrix[6] == 0x00000 && 
+                                  matrix[7] == 0x00000 &&
+                                  matrix[8] == 0x10000);
+
+          state->modified |= SMF_MATRIX;
+     }
+}
+
+void
+dfb_state_set_color_or_index( CardState      *state,
+                              const DFBColor *color,
+                              int             index )
+{
+     CoreSurface *destination;
+     CorePalette *palette = NULL;
+
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( color != NULL );
+
+     destination = state->destination;
+     if (destination)
+          palette = destination->palette;
+
+     if (index < 0) {
+          D_ASSERT( color != NULL );
+
+          if (palette)
+               dfb_state_set_color_index( state, dfb_palette_search( palette,
+                                                                     color->r, color->g,
+                                                                     color->b, color->a ) );
+
+          dfb_state_set_color( state, color );
+     }
+     else {
+          dfb_state_set_color_index( state, index );
+
+          if (palette) {
+               D_ASSERT( palette->num_entries > 0 );
+               D_ASSUME( palette->num_entries > index );
+
+               dfb_state_set_color( state, &palette->entries[index % palette->num_entries] );
+          }
+     }
+}
+
diff --git a/Source/DirectFB/src/core/state.h b/Source/DirectFB/src/core/state.h
new file mode 100755
index 0000000..7eb7667
--- /dev/null
+++ b/Source/DirectFB/src/core/state.h
@@ -0,0 +1,362 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__STATE_H__
+#define __CORE__STATE_H__
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <direct/serial.h>
+
+#include <fusion/reactor.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/gfxcard.h>
+#include <core/surface_buffer.h>
+
+#include <gfx/generic/generic.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+
+typedef enum {
+     SMF_DRAWING_FLAGS     = 0x00000001,
+     SMF_BLITTING_FLAGS    = 0x00000002,
+     SMF_CLIP              = 0x00000004,
+     SMF_COLOR             = 0x00000008,
+     SMF_SRC_BLEND         = 0x00000010,
+     SMF_DST_BLEND         = 0x00000020,
+     SMF_SRC_COLORKEY      = 0x00000040,
+     SMF_DST_COLORKEY      = 0x00000080,
+
+     SMF_DESTINATION       = 0x00000100,
+     SMF_SOURCE            = 0x00000200,
+     SMF_SOURCE_MASK       = 0x00000400,
+     SMF_SOURCE_MASK_VALS  = 0x00000800,
+
+     SMF_INDEX_TRANSLATION = 0x00001000,
+     SMF_COLORKEY          = 0x00002000,
+
+     SMF_RENDER_OPTIONS    = 0x00010000,
+     SMF_MATRIX            = 0x00020000,
+
+     SMF_ALL               = 0x00033FFF
+} StateModificationFlags;
+
+typedef enum {
+     CSF_NONE                 = 0x00000000,
+
+     CSF_DESTINATION          = 0x00000001,  /* destination is set using dfb_state_set_destination() */
+     CSF_SOURCE               = 0x00000002,  /* source is set using dfb_state_set_source() */
+     CSF_SOURCE_MASK          = 0x00000008,  /* source mask is set using dfb_state_set_source_mask() */
+
+     CSF_SOURCE_LOCKED        = 0x00000010,  /* source surface is locked */
+     CSF_SOURCE_MASK_LOCKED   = 0x00000020,  /* source mask surface is locked */
+
+     CSF_DRAWING              = 0x00010000,  /* something has been rendered with this state,
+                                                this is cleared by flushing the state, e.g. upon flip */
+
+     CSF_ALL                  = 0x0001003B
+} CardStateFlags;
+
+struct _CardState {
+     int                      magic;
+
+     CoreDFB                 *core;
+     CoreGraphicsDevice      *device;
+     FusionID                 fusion_id;
+
+     pthread_mutex_t          lock;          /* lock for state handling */
+
+     CardStateFlags           flags;
+
+     StateModificationFlags   modified;      /* indicate which fields have been
+                                                modified, these flags will be
+                                                cleared by the gfx drivers */
+     StateModificationFlags   mod_hw;
+
+     /* values forming the state for graphics operations */
+
+     DFBSurfaceDrawingFlags   drawingflags;  /* drawing flags */
+     DFBSurfaceBlittingFlags  blittingflags; /* blitting flags */
+
+     DFBRegion                clip;          /* clipping rectangle */
+     DFBColor                 color;         /* color for drawing or modulation */
+     unsigned int             color_index;   /* index to color in palette */
+     DFBSurfaceBlendFunction  src_blend;     /* blend function for source */
+     DFBSurfaceBlendFunction  dst_blend;     /* blend function for destination */
+     u32                      src_colorkey;  /* colorkey for source */
+     u32                      dst_colorkey;  /* colorkey for destination */
+
+     CoreSurface             *destination;   /* destination surface */
+     CoreSurface             *source;        /* source surface */
+
+     DirectSerial             dst_serial;    /* last destination surface serial */
+     DirectSerial             src_serial;    /* last source surface serial */
+
+     int                     *index_translation;
+     int                      num_translation;
+
+     /* hardware abstraction and state handling helpers */
+
+     DFBAccelerationMask      accel;         /* remember checked commands if they are accelerated */
+     DFBAccelerationMask      checked;       /* commands for which a state has been checked */
+     DFBAccelerationMask      set;           /* commands for which a state is valid */
+     DFBAccelerationMask      disabled;      /* commands which are disabled temporarily */
+
+     CoreGraphicsSerial       serial;        /* hardware serial of the last operation */
+
+     /* from/to buffers */
+
+     CoreSurfaceBufferRole    from;          /* usually CSBR_FRONT */
+     CoreSurfaceBufferRole    to;            /* usually CSBR_BACK */
+
+     /* read/write locks during operation */
+     
+     CoreSurfaceBufferLock    dst;
+     CoreSurfaceBufferLock    src;
+
+     /* software driver */
+
+     GenefxState             *gfxs;
+
+
+     /* extended state */
+
+     DFBSurfaceRenderOptions  render_options;
+
+     DFBColorKey              colorkey;           /* key for color key protection */
+
+     s32                      matrix[9];          /* transformation matrix for DSRO_MATRIX (fixed 16.16) */
+     DFBBoolean               affine_matrix;
+
+     CoreSurface             *source_mask;        /* source mask surface */
+     CoreSurfaceBufferLock    src_mask;           /* source mask surface lock */
+     DirectSerial             src_mask_serial;    /* last source mask surface serial */
+     DFBPoint                 src_mask_offset;    /* relative or absolute coordinates */
+     DFBSurfaceMaskFlags      src_mask_flags;     /* controls coordinate mode and more */
+
+     DFBColor                 colors[DFB_COLOR_IDS_MAX];         /* colors for drawing or modulation */
+     unsigned int             color_indices[DFB_COLOR_IDS_MAX];  /* indices to colors in palette */
+};
+
+int  dfb_state_init( CardState *state, CoreDFB *core );
+void dfb_state_destroy( CardState *state );
+
+DFBResult dfb_state_set_destination( CardState *state, CoreSurface *destination );
+DFBResult dfb_state_set_source( CardState *state, CoreSurface *source );
+DFBResult dfb_state_set_source_mask( CardState *state, CoreSurface *source_mask );
+
+void dfb_state_update( CardState *state, bool update_source );
+
+DFBResult dfb_state_set_index_translation( CardState *state,
+                                           const int *indices,
+                                           int        num_indices );
+
+void dfb_state_set_matrix( CardState *state,
+                           const s32 *matrix );
+
+static inline void
+dfb_state_get_serial( const CardState *state, CoreGraphicsSerial *ret_serial )
+{
+     D_ASSERT( state != NULL );
+     D_ASSERT( ret_serial != NULL );
+
+     *ret_serial = state->serial;
+}
+
+static inline void
+dfb_state_lock( CardState *state )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     DFB_REGION_ASSERT( &state->clip );
+
+     pthread_mutex_lock( &state->lock );
+}
+
+static inline void
+dfb_state_start_drawing( CardState *state, CoreGraphicsDevice *device )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( device != NULL );
+     D_ASSERT( state->destination != NULL );
+
+     if (dfb_config->startstop) {
+          if (state->flags & CSF_DRAWING)
+               D_ASSERT( state->device == device );
+          else {
+               dfb_gfxcard_start_drawing( device, state );
+
+               state->flags  = (CardStateFlags)(state->flags | CSF_DRAWING);
+               state->device = device;
+          }
+     }
+}
+
+static inline void
+dfb_state_stop_drawing( CardState *state )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( state->destination != NULL );
+
+     if (dfb_config->startstop) {
+          if (state->flags & CSF_DRAWING) {
+               D_ASSERT( state->device != NULL );
+     
+               dfb_gfxcard_stop_drawing( state->device, state );
+     
+               state->flags  = (CardStateFlags)(state->flags & ~CSF_DRAWING);
+               state->device = NULL;
+          }
+          else
+               D_ASSERT( state->device == NULL );
+     }
+}
+
+static inline void
+dfb_state_unlock( CardState *state )
+{
+     D_MAGIC_ASSERT( state, CardState );
+
+     DFB_REGION_ASSERT( &state->clip );
+
+     pthread_mutex_unlock( &state->lock );
+}
+
+
+#define _dfb_state_set_checked(member,flag,state,value)     \
+do {                                                        \
+     D_MAGIC_ASSERT( state, CardState );                    \
+                                                            \
+     if ((value) != (state)->member) {                      \
+          (state)->member    = (value);                     \
+          (state)->modified |= SMF_##flag;                  \
+     }                                                      \
+} while (0)
+
+
+#define dfb_state_set_blitting_flags(state,flags) _dfb_state_set_checked( blittingflags,  \
+                                                                          BLITTING_FLAGS, \
+                                                                          state, flags )
+
+#define dfb_state_set_drawing_flags(state,flags)  _dfb_state_set_checked( drawingflags,   \
+                                                                          DRAWING_FLAGS,  \
+                                                                          state, flags )
+
+#define dfb_state_set_color_index(state,index)    _dfb_state_set_checked( color_index,    \
+                                                                          COLOR,          \
+                                                                          state, index )
+
+#define dfb_state_set_src_blend(state,blend)      _dfb_state_set_checked( src_blend,      \
+                                                                          SRC_BLEND,      \
+                                                                          state, blend )
+
+#define dfb_state_set_dst_blend(state,blend)      _dfb_state_set_checked( dst_blend,      \
+                                                                          DST_BLEND,      \
+                                                                          state, blend )
+
+#define dfb_state_set_src_colorkey(state,key)     _dfb_state_set_checked( src_colorkey,   \
+                                                                          SRC_COLORKEY,   \
+                                                                          state, key )
+
+#define dfb_state_set_dst_colorkey(state,key)     _dfb_state_set_checked( dst_colorkey,   \
+                                                                          DST_COLORKEY,   \
+                                                                          state, key )
+
+#define dfb_state_set_render_options(state,opts)  _dfb_state_set_checked( render_options, \
+                                                                          RENDER_OPTIONS, \
+                                                                          state, opts )
+
+static inline void dfb_state_set_clip( CardState *state, const DFBRegion *clip )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     DFB_REGION_ASSERT( clip );
+
+     if (! DFB_REGION_EQUAL( state->clip, *clip )) {
+          state->clip     = *clip;
+          state->modified = (StateModificationFlags)( state->modified | SMF_CLIP );
+     }
+}
+
+static inline void dfb_state_set_color( CardState *state, const DFBColor *color )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( color != NULL );
+
+     if (! DFB_COLOR_EQUAL( state->color, *color )) {
+          state->color    = *color;
+          state->modified = (StateModificationFlags)( state->modified | SMF_COLOR );
+     }
+}
+
+static inline void dfb_state_set_colorkey( CardState *state, const DFBColorKey *key )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( key != NULL );
+
+     if (! DFB_COLORKEY_EQUAL( state->colorkey, *key )) {
+          state->colorkey = *key;
+          state->modified = (StateModificationFlags)( state->modified | SMF_COLOR );
+     }
+}
+
+static inline void dfb_state_set_source_mask_vals( CardState           *state,
+                                                   const DFBPoint      *offset,
+                                                   DFBSurfaceMaskFlags  flags )
+{
+     D_MAGIC_ASSERT( state, CardState );
+     D_ASSERT( offset != NULL );
+     D_FLAGS_ASSERT( flags, DSMF_ALL );
+
+     if (! DFB_POINT_EQUAL( state->src_mask_offset, *offset ) || state->src_mask_flags != flags) {
+          state->src_mask_offset = *offset;
+          state->src_mask_flags  = flags;
+
+          state->modified = (StateModificationFlags)( state->modified | SMF_SOURCE_MASK_VALS );
+     }
+}
+
+/*
+ * Multifunctional color configuration function.
+ *
+ * Always tries to set both color and index.
+ *
+ * If color index is -1, color is used and searched in palette of destination surface if present.
+ * If color index is valid the color is looked up in palette if present.
+ */
+void dfb_state_set_color_or_index( CardState      *state,
+                                   const DFBColor *color,
+                                   int             index );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/surface.c b/Source/DirectFB/src/core/surface.c
new file mode 100755
index 0000000..7b8e4fc
--- /dev/null
+++ b/Source/DirectFB/src/core/surface.c
@@ -0,0 +1,768 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+
+#include <core/core.h>
+#include <core/palette.h>
+#include <core/surface.h>
+
+#include <core/layers_internal.h>
+#include <core/windows_internal.h>
+
+#include <gfx/convert.h>
+
+
+D_DEBUG_DOMAIN( Core_Surface, "Core/Surface", "DirectFB Core Surface" );
+
+/**********************************************************************************************************************/
+
+static const ReactionFunc dfb_surface_globals[] = {
+/* 0 */   _dfb_layer_region_surface_listener,
+/* 1 */   _dfb_windowstack_background_image_listener,
+          NULL
+};
+
+static void
+surface_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+     int          i;
+     CoreSurface *surface = (CoreSurface*) object;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     D_DEBUG_AT( Core_Surface, "destroying %p (%dx%d%s)\n", surface,
+                 surface->config.size.w, surface->config.size.h, zombie ? " ZOMBIE" : "");
+
+     dfb_surface_lock( surface );
+
+     surface->state |= CSSF_DESTROYED;
+
+     /* announce surface destruction */
+     dfb_surface_notify( surface, CSNF_DESTROY );
+
+     /* unlink palette */
+     if (surface->palette) {
+          dfb_palette_detach_global( surface->palette, &surface->palette_reaction );
+          dfb_palette_unlink( &surface->palette );
+     }
+
+     /* destroy buffers */
+     for (i=0; i<MAX_SURFACE_BUFFERS; i++) {
+          if (surface->buffers[i])
+               dfb_surface_buffer_destroy( surface->buffers[i] );
+     }
+
+     direct_serial_deinit( &surface->serial );
+
+     dfb_surface_unlock( surface );
+
+     fusion_skirmish_destroy( &surface->lock );
+
+     D_MAGIC_CLEAR( surface );
+
+     fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+dfb_surface_pool_create( const FusionWorld *world )
+{
+     FusionObjectPool *pool;
+
+     pool = fusion_object_pool_create( "Surface Pool",
+                                       sizeof(CoreSurface),
+                                       sizeof(CoreSurfaceNotification),
+                                       surface_destructor, NULL, world );
+
+     return pool;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_create( CoreDFB                  *core,
+                    const CoreSurfaceConfig  *config,
+                    CoreSurfaceTypeFlags      type,
+                    unsigned long             resource_id,
+                    CorePalette              *palette,
+                    CoreSurface             **ret_surface )
+{
+     DFBResult    ret = DFB_BUG;
+     int          i;
+     int          buffers;
+     CoreSurface *surface;
+     char         buf[64];
+
+     D_ASSERT( core != NULL );
+     D_FLAGS_ASSERT( type, CSTF_ALL );
+     D_MAGIC_ASSERT_IF( palette, CorePalette );
+     D_ASSERT( ret_surface != NULL );
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_create( %p, %p, %p )\n", core, config, ret_surface );
+
+     surface = dfb_core_create_surface( core );
+     if (!surface)
+          return DFB_FUSION;
+
+     if (config) {
+          D_FLAGS_ASSERT( config->flags, CSCONF_ALL );
+
+          surface->config.flags = config->flags;
+
+          if (config->flags & CSCONF_SIZE) {
+               D_DEBUG_AT( Core_Surface, "  -> %dx%d\n", config->size.w, config->size.h );
+
+               surface->config.size = config->size;
+          }
+
+          if (config->flags & CSCONF_FORMAT) {
+               D_DEBUG_AT( Core_Surface, "  -> %s\n", dfb_pixelformat_name( config->format ) );
+
+               surface->config.format = config->format;
+          }
+
+          if (config->flags & CSCONF_CAPS) {
+               D_DEBUG_AT( Core_Surface, "  -> caps 0x%08x\n", config->caps );
+
+               if (config->caps & DSCAPS_ROTATED)
+                    D_UNIMPLEMENTED();
+
+               surface->config.caps = config->caps & ~DSCAPS_ROTATED;
+          }
+
+          if (config->flags & CSCONF_PREALLOCATED) {
+               D_DEBUG_AT( Core_Surface, "  -> prealloc %p [%d]\n",
+                           config->preallocated[0].addr,
+                           config->preallocated[0].pitch );
+
+               direct_memcpy( surface->config.preallocated, config->preallocated, sizeof(config->preallocated) );
+
+               type |= CSTF_PREALLOCATED;
+          }
+     }
+
+     if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          surface->type = (type & ~CSTF_EXTERNAL) | CSTF_INTERNAL;
+     else if (surface->config.caps & DSCAPS_VIDEOONLY)
+          surface->type = (type & ~CSTF_INTERNAL) | CSTF_EXTERNAL;
+     else
+          surface->type = type & ~(CSTF_INTERNAL | CSTF_EXTERNAL);
+
+     if (surface->config.caps & DSCAPS_SHARED)
+          surface->type |= CSTF_SHARED;
+
+     surface->resource_id = resource_id;
+
+     if (surface->config.caps & DSCAPS_TRIPLE)
+          buffers = 3;
+     else if (surface->config.caps & DSCAPS_DOUBLE)
+          buffers = 2;
+     else {
+          buffers = 1;
+
+          surface->config.caps &= ~DSCAPS_ROTATED;
+     }
+
+     surface->notifications = CSNF_ALL & ~CSNF_FLIP;
+
+     surface->alpha_ramp[0] = 0x00;
+     surface->alpha_ramp[1] = 0x55;
+     surface->alpha_ramp[2] = 0xaa;
+     surface->alpha_ramp[3] = 0xff;
+
+
+     if (surface->config.caps & DSCAPS_STATIC_ALLOC)
+          surface->config.min_size = surface->config.size;
+
+     surface->shmpool = dfb_core_shmpool( core );
+
+     direct_serial_init( &surface->serial );
+
+     snprintf( buf, sizeof(buf), "Surface %dx%d %s", surface->config.size.w,
+               surface->config.size.h, dfb_pixelformat_name(surface->config.format) );
+
+     fusion_ref_set_name( &surface->object.ref, buf );
+
+     fusion_skirmish_init( &surface->lock, buf, dfb_core_world(core) );
+
+     fusion_object_set_lock( &surface->object, &surface->lock );
+
+     D_MAGIC_SET( surface, CoreSurface );
+
+
+     if (dfb_config->warn.flags & DCWF_CREATE_SURFACE &&
+         dfb_config->warn.create_surface.min_size.w <= surface->config.size.w &&
+         dfb_config->warn.create_surface.min_size.h <= surface->config.size.h)
+          D_WARN( "create-surface  %4dx%4d %6s, buffers %d, caps 0x%08x, type 0x%08x",
+                  surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(surface->config.format),
+                  buffers, surface->config.caps, surface->type );
+
+
+     if (palette) {
+          dfb_surface_set_palette( surface, palette );
+     }
+     else if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format )) {
+          ret = dfb_surface_init_palette( core, surface );
+          if (ret)
+               goto error;
+     }
+
+     /* Create the Surface Buffers. */
+     for (i=0; i<buffers; i++) {
+          CoreSurfaceBuffer *buffer;
+
+          ret = dfb_surface_buffer_new( surface, CSBF_NONE, &buffer );
+          if (ret) {
+               D_DERROR( ret, "Core/Surface: Error creating surface buffer!\n" );
+               goto error;
+          }
+
+          surface->buffers[surface->num_buffers++] = buffer;
+
+          switch (i) {
+               case 0:
+                    surface->buffer_indices[CSBR_FRONT] = i;
+               case 1:
+                    surface->buffer_indices[CSBR_BACK] = i;
+               case 2:
+                    surface->buffer_indices[CSBR_IDLE] = i;
+          }
+     }
+
+     fusion_object_activate( &surface->object );
+
+     *ret_surface = surface;
+
+     return DFB_OK;
+
+error:
+     D_MAGIC_CLEAR( surface );
+
+     for (i=0; i<MAX_SURFACE_BUFFERS; i++) {
+          if (surface->buffers[i])
+               dfb_surface_buffer_destroy( surface->buffers[i] );
+     }
+
+     fusion_skirmish_destroy( &surface->lock );
+
+     direct_serial_deinit( &surface->serial );
+
+     fusion_object_destroy( &surface->object );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_create_simple ( CoreDFB                 *core,
+                            int                      width,
+                            int                      height,
+                            DFBSurfacePixelFormat    format,
+                            DFBSurfaceCapabilities   caps,
+                            CoreSurfaceTypeFlags     type,
+                            unsigned long            resource_id,
+                            CorePalette             *palette,
+                            CoreSurface            **ret_surface )
+{
+     CoreSurfaceConfig config;
+
+     D_DEBUG_AT( Core_Surface, "%s( %p, %dx%d %s, %p )\n", __FUNCTION__, core, width, height,
+                 dfb_pixelformat_name( format ), ret_surface );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( ret_surface != NULL );
+
+     config.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+     config.size.w = width;
+     config.size.h = height;
+     config.format = format;
+     config.caps   = caps;
+
+     return dfb_surface_create( core, &config, type, resource_id, palette, ret_surface );
+}
+
+DFBResult
+dfb_surface_init_palette( CoreDFB     *core,
+                          CoreSurface *surface )
+{
+     DFBResult    ret;
+     CorePalette *palette;
+
+     ret = dfb_palette_create( core,
+                               1 << DFB_COLOR_BITS_PER_PIXEL( surface->config.format ),
+                               &palette );
+     if (ret) {
+          D_DERROR( ret, "Core/Surface: Error creating palette!\n" );
+          return ret;
+     }
+
+     switch (surface->config.format) {
+          case DSPF_LUT8:
+               dfb_palette_generate_rgb332_map( palette );
+               break;
+
+          case DSPF_ALUT44:
+               dfb_palette_generate_rgb121_map( palette );
+               break;
+
+          default:
+               break;
+     }
+
+     dfb_surface_set_palette( surface, palette );
+
+     dfb_palette_unref( palette );
+
+     return DFB_OK;
+}
+
+
+DFBResult
+dfb_surface_notify( CoreSurface                  *surface,
+                    CoreSurfaceNotificationFlags  flags)
+{
+     CoreSurfaceNotification notification;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+     D_FLAGS_ASSERT( flags, CSNF_ALL );
+
+     direct_serial_increase( &surface->serial );
+
+     if (!(surface->state & CSSF_DESTROYED)) {
+          if (!(surface->notifications & flags))
+               return DFB_OK;
+     }
+
+     notification.flags   = flags;
+     notification.surface = surface;
+
+     return dfb_surface_dispatch( surface, ¬ification, dfb_surface_globals );
+}
+
+DFBResult
+dfb_surface_flip( CoreSurface *surface, bool swap )
+{
+     unsigned int back, front;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     back  = (surface->flips + CSBR_BACK)  % surface->num_buffers;
+     front = (surface->flips + CSBR_FRONT) % surface->num_buffers;
+
+     D_ASSERT( surface->buffer_indices[back]  < surface->num_buffers );
+     D_ASSERT( surface->buffer_indices[front] < surface->num_buffers );
+
+     if (surface->buffers[surface->buffer_indices[back]]->policy !=
+         surface->buffers[surface->buffer_indices[front]]->policy || (surface->config.caps & DSCAPS_ROTATED))
+          return DFB_UNSUPPORTED;
+
+     if (swap) {
+          int tmp = surface->buffer_indices[back];
+          surface->buffer_indices[back] = surface->buffer_indices[front];
+          surface->buffer_indices[front] = tmp;
+     }
+     else
+          surface->flips++;
+
+     dfb_surface_notify( surface, CSNF_FLIP );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_reconfig( CoreSurface             *surface,
+                      const CoreSurfaceConfig *config )
+{
+     int i, buffers;
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_Surface, "%s( %p, %dx%d %s -> %dx%d %s )\n", __FUNCTION__, surface,
+                 surface->config.size.w, surface->config.size.h, dfb_pixelformat_name( surface->config.format ),
+                 (config->flags & CSCONF_SIZE) ? config->size.w : surface->config.size.w,
+                 (config->flags & CSCONF_SIZE) ? config->size.h : surface->config.size.h,
+                 (config->flags & CSCONF_FORMAT) ? dfb_pixelformat_name( config->format ) :
+                                                   dfb_pixelformat_name( surface->config.format ) );
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( config != NULL );
+
+     if (surface->type & CSTF_PREALLOCATED)
+          return DFB_UNSUPPORTED;
+
+     if (config->flags & CSCONF_PREALLOCATED)
+          return DFB_UNSUPPORTED;
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     if (  (config->flags == CSCONF_SIZE ||
+          ((config->flags == (CSCONF_SIZE | CSCONF_FORMAT)) && (config->format == surface->config.format)))  &&
+         config->size.w <= surface->config.min_size.w &&
+         config->size.h <= surface->config.min_size.h)
+     {
+          surface->config.size = config->size;
+
+          fusion_skirmish_dismiss( &surface->lock );
+          return DFB_OK;
+     }
+
+#if 1
+     /* Precheck the Surface Buffers. */
+     for (i=0; i<surface->num_buffers; i++) {
+          if (surface->buffers[i]->locked) {
+               D_DEBUG_AT( Core_Surface, "  -> surface is locked, cannot reconfigure!\n" );
+
+               fusion_skirmish_dismiss( &surface->lock );
+               return DFB_LOCKED;
+          }
+     }
+#endif
+
+     /* Destroy the Surface Buffers. */
+     for (i=0; i<surface->num_buffers; i++) {
+          dfb_surface_buffer_destroy( surface->buffers[i] );
+          surface->buffers[i] = NULL;
+     }
+
+     surface->num_buffers = 0;
+
+     if (config->flags & CSCONF_SIZE)
+          surface->config.size = config->size;
+
+     if (config->flags & CSCONF_FORMAT)
+          surface->config.format = config->format;
+
+     if (config->flags & CSCONF_CAPS) {
+          if (config->caps & DSCAPS_ROTATED)
+               D_UNIMPLEMENTED();
+
+          surface->config.caps = config->caps & ~DSCAPS_ROTATED;
+     }
+
+     if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          surface->type = (surface->type & ~CSTF_EXTERNAL) | CSTF_INTERNAL;
+     else if (surface->config.caps & DSCAPS_VIDEOONLY)
+          surface->type = (surface->type & ~CSTF_INTERNAL) | CSTF_EXTERNAL;
+     else
+          surface->type = surface->type & ~(CSTF_INTERNAL | CSTF_EXTERNAL);
+
+     if (surface->config.caps & DSCAPS_TRIPLE)
+          buffers = 3;
+     else if (surface->config.caps & DSCAPS_DOUBLE)
+          buffers = 2;
+     else {
+          buffers = 1;
+
+          surface->config.caps &= ~DSCAPS_ROTATED;
+     }
+
+     /* Recreate the Surface Buffers. */
+     for (i=0; i<buffers; i++) {
+          CoreSurfaceBuffer *buffer;
+
+          ret = dfb_surface_buffer_new( surface, CSBF_NONE, &buffer );
+          if (ret) {
+               D_DERROR( ret, "Core/Surface: Error creating surface buffer!\n" );
+               goto error;
+          }
+
+          surface->buffers[surface->num_buffers++] = buffer;
+
+          switch (i) {
+               case 0:
+                    surface->buffer_indices[CSBR_FRONT] = i;
+               case 1:
+                    surface->buffer_indices[CSBR_BACK] = i;
+               case 2:
+                    surface->buffer_indices[CSBR_IDLE] = i;
+          }
+     }
+
+     dfb_surface_notify( surface, CSNF_SIZEFORMAT );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return DFB_OK;
+
+error:
+     D_UNIMPLEMENTED();
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_destroy_buffers( CoreSurface *surface )
+{
+     int i;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (surface->type & CSTF_PREALLOCATED)
+          return DFB_UNSUPPORTED;
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     /* Destroy the Surface Buffers. */
+     for (i=0; i<surface->num_buffers; i++) {
+          dfb_surface_buffer_destroy( surface->buffers[i] );
+          surface->buffers[i] = NULL;
+     }
+
+     surface->num_buffers = 0;
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_lock_buffer( CoreSurface            *surface,
+                         CoreSurfaceBufferRole   role,
+                         CoreSurfaceAccessorID   accessor,
+                         CoreSurfaceAccessFlags  access,
+                         CoreSurfaceBufferLock  *ret_lock )
+{
+     DFBResult          ret;
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     buffer = dfb_surface_get_buffer( surface, role );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     ret = dfb_surface_buffer_lock( buffer, accessor, access, ret_lock );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_unlock_buffer( CoreSurface           *surface,
+                           CoreSurfaceBufferLock *lock )
+{
+     DFBResult ret;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     ret = dfb_surface_buffer_unlock( lock );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_read_buffer( CoreSurface            *surface,
+                         CoreSurfaceBufferRole   role,
+                         void                   *destination,
+                         int                     pitch,
+                         const DFBRectangle     *rect )
+{
+     DFBResult          ret;
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( destination != NULL );
+     D_ASSERT( pitch > 0 );
+     DFB_RECTANGLE_ASSERT_IF( rect );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     buffer = dfb_surface_get_buffer( surface, role );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     ret = dfb_surface_buffer_read( buffer, destination, pitch, rect );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_write_buffer( CoreSurface            *surface,
+                          CoreSurfaceBufferRole   role,
+                          const void             *source,
+                          int                     pitch,
+                          const DFBRectangle     *rect )
+{
+     DFBResult          ret;
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( source != NULL );
+     D_ASSERT( pitch > 0 );
+     DFB_RECTANGLE_ASSERT_IF( rect );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     buffer = dfb_surface_get_buffer( surface, role );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     ret = dfb_surface_buffer_write( buffer, source, pitch, rect );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_dump_buffer( CoreSurface           *surface,
+                         CoreSurfaceBufferRole  role,
+                         const char            *path,
+                         const char            *prefix )
+{
+     DFBResult          ret;
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( path != NULL );
+     D_ASSERT( prefix != NULL );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     buffer = dfb_surface_get_buffer( surface, role );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     ret = dfb_surface_buffer_dump( buffer, path, prefix );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_set_palette( CoreSurface *surface,
+                         CorePalette *palette )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_MAGIC_ASSERT_IF( palette, CorePalette );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     if (surface->palette != palette) {
+          if (surface->palette) {
+               dfb_palette_detach_global( surface->palette, &surface->palette_reaction );
+               dfb_palette_unlink( &surface->palette );
+          }
+
+          if (palette) {
+               dfb_palette_link( &surface->palette, palette );
+               dfb_palette_attach_global( palette, DFB_SURFACE_PALETTE_LISTENER,
+                                          surface, &surface->palette_reaction );
+          }
+
+          dfb_surface_notify( surface, CSNF_PALETTE_CHANGE );
+     }
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_set_field( CoreSurface *surface,
+                       int          field )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     surface->field = field;
+
+     dfb_surface_notify( surface, CSNF_FIELD );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_set_alpha_ramp( CoreSurface *surface,
+                            u8           a0,
+                            u8           a1,
+                            u8           a2,
+                            u8           a3 )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (fusion_skirmish_prevail( &surface->lock ))
+          return DFB_FUSION;
+
+     surface->alpha_ramp[0] = a0;
+     surface->alpha_ramp[1] = a1;
+     surface->alpha_ramp[2] = a2;
+     surface->alpha_ramp[3] = a3;
+
+     dfb_surface_notify( surface, CSNF_ALPHA_RAMP );
+
+     fusion_skirmish_dismiss( &surface->lock );
+
+     return DFB_OK;
+}
+
+ReactionResult
+_dfb_surface_palette_listener( const void *msg_data,
+                               void       *ctx )
+{
+     const CorePaletteNotification *notification = msg_data;
+     CoreSurface                   *surface      = ctx;
+
+     if (notification->flags & CPNF_DESTROY)
+          return RS_REMOVE;
+
+     if (notification->flags & CPNF_ENTRIES) {
+          if (fusion_skirmish_prevail( &surface->lock ))
+               return RS_OK;
+
+          dfb_surface_notify( surface, CSNF_PALETTE_UPDATE );
+
+          fusion_skirmish_dismiss( &surface->lock );
+     }
+
+     return RS_OK;
+}
+
diff --git a/Source/DirectFB/src/core/surface.h b/Source/DirectFB/src/core/surface.h
new file mode 100755
index 0000000..1d2d452
--- /dev/null
+++ b/Source/DirectFB/src/core/surface.h
@@ -0,0 +1,446 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__SURFACE_H__
+#define __CORE__SURFACE_H__
+
+#include <directfb.h>
+
+#include <direct/list.h>
+#include <direct/serial.h>
+#include <direct/util.h>
+
+#include <fusion/object.h>
+#include <fusion/reactor.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+
+typedef enum {
+     CSNF_NONE           = 0x00000000,
+
+     CSNF_SIZEFORMAT     = 0x00000001,  /* width, height, format */
+     CSNF_SYSTEM         = 0x00000002,  /* system instance information */
+     CSNF_VIDEO          = 0x00000004,  /* video instance information */
+     CSNF_DESTROY        = 0x00000008,  /* surface is about to be destroyed */
+     CSNF_FLIP           = 0x00000010,  /* surface buffer pointer swapped */
+     CSNF_FIELD          = 0x00000020,  /* active (displayed) field switched */
+     CSNF_PALETTE_CHANGE = 0x00000040,  /* another palette has been set */
+     CSNF_PALETTE_UPDATE = 0x00000080,  /* current palette has been altered */
+     CSNF_ALPHA_RAMP     = 0x00000100,  /* alpha ramp was modified */
+
+     CSNF_ALL            = 0x000001FF
+} CoreSurfaceNotificationFlags;
+
+typedef struct {
+     CoreSurfaceNotificationFlags  flags;
+     CoreSurface                  *surface;
+} CoreSurfaceNotification;
+
+
+typedef enum {
+     CSCONF_NONE         = 0x00000000,
+
+     CSCONF_SIZE         = 0x00000001,
+     CSCONF_FORMAT       = 0x00000002,
+     CSCONF_CAPS         = 0x00000004,
+
+     CSCONF_PREALLOCATED = 0x00000010,
+
+     CSCONF_ALL          = 0x00000017
+} CoreSurfaceConfigFlags;
+
+typedef enum {
+     CSTF_NONE           = 0x00000000,
+
+     CSTF_LAYER          = 0x00000001,  /* surface for layer */
+     CSTF_WINDOW         = 0x00000002,  /* surface for window */
+     CSTF_CURSOR         = 0x00000004,  /* surface for cursor */
+     CSTF_FONT           = 0x00000008,  /* surface for font */
+
+     CSTF_SHARED         = 0x00000010,  /* accessable by other processes */
+
+     CSTF_INTERNAL       = 0x00000100,  /* system memory */
+     CSTF_EXTERNAL       = 0x00000200,  /* video memory */
+
+     CSTF_PREALLOCATED   = 0x00000400,  /* preallocated memory */
+
+     CSTF_ALL            = 0x0000071F
+} CoreSurfaceTypeFlags;
+
+typedef struct {
+     CoreSurfaceConfigFlags   flags;
+
+     DFBDimension             size;
+     DFBSurfacePixelFormat    format;
+     DFBSurfaceCapabilities   caps;
+
+     struct {
+          void *addr;
+          int   pitch;
+     }                        preallocated[MAX_SURFACE_BUFFERS];
+
+     DFBDimension             min_size;
+} CoreSurfaceConfig;
+
+typedef enum {
+     CSP_SYSTEMONLY      = 0x00000000,  /* never try to swap
+                                           into video memory */
+     CSP_VIDEOLOW        = 0x00000001,  /* try to store in video memory,
+                                           low priority */
+     CSP_VIDEOHIGH       = 0x00000002,  /* try to store in video memory,
+                                           high priority */
+     CSP_VIDEOONLY       = 0x00000003   /* always and only
+                                           store in video memory */
+} CoreSurfacePolicy;
+
+typedef enum {
+     CSAF_NONE           = 0x00000000,
+
+     CSAF_READ           = 0x00000001,  /* accessor may read */
+     CSAF_WRITE          = 0x00000002,  /* accessor may write */
+
+     CSAF_SHARED         = 0x00000010,  /* other processes can read/write at the same time (shared mapping) */
+
+     CSAF_ALL            = 0x00000013
+} CoreSurfaceAccessFlags;
+
+typedef enum {
+     CSAID_NONE          = 0x00000000,  /* none or unknown accessor */
+
+     CSAID_CPU           = 0x00000001,  /* local processor, where DirectFB is running on, could be app or sw fallback */
+
+     CSAID_GPU           = 0x00000002,  /* primary accelerator, as in traditional 'gfxcard' core (ACCEL0) */
+
+     CSAID_ACCEL0        = 0x00000002,  /* accelerators, decoders etc. (CSAID_ACCEL0 + accel_id<0-5>) */
+     CSAID_ACCEL1        = 0x00000003,
+     CSAID_ACCEL2        = 0x00000004,
+     CSAID_ACCEL3        = 0x00000005,
+     CSAID_ACCEL4        = 0x00000006,
+     CSAID_ACCEL5        = 0x00000007,
+
+     CSAID_LAYER0        = 0x00000008,  /* display layers, registered by layer core (CSAID_LAYER0 + layer_id<0-7>) */
+     CSAID_LAYER1        = 0x00000009,
+     CSAID_LAYER2        = 0x0000000a,
+     CSAID_LAYER3        = 0x0000000b,
+     CSAID_LAYER4        = 0x0000000c,
+     CSAID_LAYER5        = 0x0000000d,
+     CSAID_LAYER6        = 0x0000000e,
+     CSAID_LAYER7        = 0x0000000f,
+
+     _CSAID_NUM          = 0x00000010,  /* number of statically assigned IDs for usage in static arrays */
+
+     CSAID_ANY           = 0x00000100,  /* any other accessor needs to be registered using IDs starting from here */
+} CoreSurfaceAccessorID;
+
+typedef enum {
+     CSBR_FRONT          = 0,
+     CSBR_BACK           = 1,
+     CSBR_IDLE           = 2
+} CoreSurfaceBufferRole;
+
+typedef enum {
+     CSSF_NONE           = 0x00000000,
+
+     CSSF_DESTROYED      = 0x00000001,  /* surface is being or has been destroyed */
+
+     CSSF_ALL            = 0x00000001
+} CoreSurfaceStateFlags;
+
+struct __DFB_CoreSurface
+{
+     FusionObject             object;
+     int                      magic;
+
+     FusionSkirmish           lock;
+
+     CoreSurfaceStateFlags    state;
+
+     CoreSurfaceConfig        config;
+     CoreSurfaceTypeFlags     type;
+     unsigned long            resource_id;   /* layer id, window id, or user specified */
+
+     int                      rotation;
+
+     CoreSurfaceNotificationFlags notifications;
+
+     DirectSerial             serial;
+
+     int                      field;
+     u8                       alpha_ramp[4];
+
+     CoreSurfaceBuffer       *buffers[MAX_SURFACE_BUFFERS];
+     int                      num_buffers;
+
+     int                      buffer_indices[MAX_SURFACE_BUFFERS];
+
+     unsigned int             flips;
+
+     CorePalette             *palette;
+     GlobalReaction           palette_reaction;
+
+     FusionSHMPoolShared     *shmpool;
+};
+
+
+/*
+ * Creates a pool of surface objects.
+ */
+FusionObjectPool *dfb_surface_pool_create( const FusionWorld *world );
+
+/*
+ * Generates dfb_surface_ref(), dfb_surface_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreSurface, dfb_surface )
+
+
+DFBResult dfb_surface_create        ( CoreDFB                      *core,
+                                      const CoreSurfaceConfig      *config,
+                                      CoreSurfaceTypeFlags          type,
+                                      unsigned long                 resource_id,
+                                      CorePalette                  *palette,
+                                      CoreSurface                 **ret_surface );
+
+DFBResult dfb_surface_create_simple ( CoreDFB                      *core,
+                                      int                           width,
+                                      int                           height,
+                                      DFBSurfacePixelFormat         format,
+                                      DFBSurfaceCapabilities        caps,
+                                      CoreSurfaceTypeFlags          type,
+                                      unsigned long                 resource_id,
+                                      CorePalette                  *palette,
+                                      CoreSurface                 **ret_surface );
+
+DFBResult dfb_surface_init_palette  ( CoreDFB                      *core,
+                                      CoreSurface                  *surface );
+
+DFBResult dfb_surface_notify        ( CoreSurface                  *surface,
+                                      CoreSurfaceNotificationFlags  flags);
+
+DFBResult dfb_surface_flip          ( CoreSurface                  *surface,
+                                      bool                          swap );
+
+DFBResult dfb_surface_reconfig      ( CoreSurface                  *surface,
+                                      const CoreSurfaceConfig      *config );
+
+DFBResult dfb_surface_destroy_buffers( CoreSurface                 *surface );
+
+DFBResult dfb_surface_lock_buffer   ( CoreSurface                  *surface,
+                                      CoreSurfaceBufferRole         role,
+                                      CoreSurfaceAccessorID         accessor,
+                                      CoreSurfaceAccessFlags        access,
+                                      CoreSurfaceBufferLock        *ret_lock );
+
+DFBResult dfb_surface_unlock_buffer ( CoreSurface                  *surface,
+                                      CoreSurfaceBufferLock        *lock );
+
+DFBResult dfb_surface_read_buffer   ( CoreSurface                  *surface,
+                                      CoreSurfaceBufferRole         role,
+                                      void                         *destination,
+                                      int                           pitch,
+                                      const DFBRectangle           *rect );
+
+DFBResult dfb_surface_write_buffer  ( CoreSurface                  *surface,
+                                      CoreSurfaceBufferRole         role,
+                                      const void                   *source,
+                                      int                           pitch,
+                                      const DFBRectangle           *rect );
+
+DFBResult dfb_surface_dump_buffer   ( CoreSurface                  *surface,
+                                      CoreSurfaceBufferRole         role,
+                                      const char                   *path,
+                                      const char                   *prefix );
+
+DFBResult dfb_surface_set_palette   ( CoreSurface                  *surface,
+                                      CorePalette                  *palette );
+
+DFBResult dfb_surface_set_field     ( CoreSurface                  *surface,
+                                      int                           field );
+
+DFBResult dfb_surface_set_alpha_ramp( CoreSurface                  *surface,
+                                      u8                            a0,
+                                      u8                            a1,
+                                      u8                            a2,
+                                      u8                            a3 );
+
+
+static inline DirectResult
+dfb_surface_lock( CoreSurface *surface )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     return fusion_skirmish_prevail( &surface->lock );
+}
+
+static inline DirectResult
+dfb_surface_trylock( CoreSurface *surface )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     return fusion_skirmish_swoop( &surface->lock );
+}
+
+static inline DirectResult
+dfb_surface_unlock( CoreSurface *surface )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     return fusion_skirmish_dismiss( &surface->lock );
+}
+
+static inline CoreSurfaceBuffer *
+dfb_surface_get_buffer( CoreSurface           *surface,
+                        CoreSurfaceBufferRole  role )
+{
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( role == CSBR_FRONT || role == CSBR_BACK || role == CSBR_IDLE );
+
+     D_ASSERT( surface->num_buffers > 0 );
+
+     return surface->buffers[ surface->buffer_indices[(surface->flips + role) % surface->num_buffers] ];
+}
+
+static inline void *
+dfb_surface_data_offset( const CoreSurface *surface,
+                         void              *data,
+                         int                pitch,
+                         int                x,
+                         int                y )
+{
+     D_ASSERT( surface != NULL );
+     D_ASSERT( data != NULL );
+     D_ASSERT( pitch > 0 );
+     D_ASSERT( x >= 0 );
+     D_ASSERT( x < surface->config.size.w );
+     D_ASSERT( y >= 0 );
+     D_ASSERT( y < surface->config.size.h );
+
+     if (surface->config.caps & DSCAPS_SEPARATED) {
+          if (y & 1)
+               y += surface->config.size.h;
+
+          y >>= 1;
+     }
+
+     return (u8*)data + pitch * y + DFB_BYTES_PER_LINE( surface->config.format, x );
+}
+
+static inline void
+dfb_surface_calc_buffer_size( CoreSurface *surface,
+                              int          byte_align,
+                              int          pixel_align,
+                              int         *ret_pitch,
+                              int         *ret_size )
+{
+     DFBSurfacePixelFormat format;
+     int                   width;
+     int                   pitch;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     format = surface->config.format;
+
+     width = direct_util_align( surface->config.size.w, pixel_align );
+     pitch = direct_util_align( DFB_BYTES_PER_LINE( format, width ), byte_align );
+
+     if (ret_pitch)
+          *ret_pitch = pitch;
+
+     if (ret_size)
+          *ret_size = pitch * DFB_PLANE_MULTIPLY( format, surface->config.size.h );
+}
+
+static inline void
+dfb_surface_caps_apply_policy( CoreSurfacePolicy       policy,
+                               DFBSurfaceCapabilities *caps )
+{
+     switch (policy) {
+          case CSP_SYSTEMONLY:
+               *caps = (DFBSurfaceCapabilities)((*caps & ~DSCAPS_VIDEOONLY) | DSCAPS_SYSTEMONLY);
+               break;
+
+          case CSP_VIDEOONLY:
+               *caps = (DFBSurfaceCapabilities)((*caps & ~DSCAPS_SYSTEMONLY) | DSCAPS_VIDEOONLY);
+               break;
+
+          default:
+               *caps = (DFBSurfaceCapabilities)(*caps & ~(DSCAPS_SYSTEMONLY | DSCAPS_VIDEOONLY));
+               break;
+     }
+}
+
+static inline DFBResult
+dfb_surface_resize( CoreSurface *surface,
+                    int          width,
+                    int          height )
+{
+     CoreSurfaceConfig config;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( width > 0 );
+     D_ASSERT( height > 0 );
+
+     config.flags  = CSCONF_SIZE;
+     config.size.w = width;
+     config.size.h = height;
+
+     return dfb_surface_reconfig( surface, &config );
+}
+
+static inline DFBResult
+dfb_surface_reformat( CoreSurface           *surface,
+                      int                    width,
+                      int                    height,
+                      DFBSurfacePixelFormat  format )
+{
+     CoreSurfaceConfig config;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_ASSERT( width > 0 );
+     D_ASSERT( height > 0 );
+
+     config.flags  = (CoreSurfaceConfigFlags)(CSCONF_SIZE | CSCONF_FORMAT);
+     config.size.w = width;
+     config.size.h = height;
+     config.format = format;
+
+     return dfb_surface_reconfig( surface, &config );
+}
+
+/* global reactions */
+ReactionResult _dfb_surface_palette_listener( const void *msg_data,
+                                              void       *ctx );
+
+typedef enum {
+     DFB_LAYER_REGION_SURFACE_LISTENER,
+     DFB_WINDOWSTACK_BACKGROUND_IMAGE_LISTENER
+} DFB_SURFACE_GLOBALS;
+
+#endif
+
diff --git a/Source/DirectFB/src/core/surface_buffer.c b/Source/DirectFB/src/core/surface_buffer.c
new file mode 100755
index 0000000..da477df
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_buffer.c
@@ -0,0 +1,1206 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef USE_ZLIB
+#include <zlib.h>
+#endif
+
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/gfxcard.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/surface_pool_bridge.h>
+
+#include <misc/conf.h>
+
+#include <gfx/convert.h>
+
+static const u8 lookup3to8[] = { 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff };
+static const u8 lookup2to8[] = { 0x00, 0x55, 0xaa, 0xff };
+
+
+D_DEBUG_DOMAIN( Core_SurfBuffer, "Core/SurfBuffer", "DirectFB Core Surface Buffer" );
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_buffer_new( CoreSurface             *surface,
+                        CoreSurfaceBufferFlags   flags,
+                        CoreSurfaceBuffer      **ret_buffer )
+{
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     D_FLAGS_ASSERT( flags, CSBF_ALL );
+     D_ASSERT( ret_buffer != NULL );
+
+#if DIRECT_BUILD_DEBUG
+     D_DEBUG_AT( Core_SurfBuffer, "dfb_surface_buffer_new( %s )\n", dfb_pixelformat_name( surface->config.format ) );
+
+     if (flags & CSBF_STICKED)
+          D_DEBUG_AT( Core_SurfBuffer, "  -> STICKED\n" );
+#endif
+
+     buffer = SHCALLOC( surface->shmpool, 1, sizeof(CoreSurfaceBuffer) );
+     if (!buffer)
+          return D_OOSHM();
+
+     direct_serial_init( &buffer->serial );
+     direct_serial_increase( &buffer->serial );
+
+     buffer->surface = surface;
+     buffer->flags   = flags;
+     buffer->format  = surface->config.format;
+
+     if (surface->config.caps & DSCAPS_VIDEOONLY)
+          buffer->policy = CSP_VIDEOONLY;
+     else if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          buffer->policy = CSP_SYSTEMONLY;
+     else
+          buffer->policy = CSP_VIDEOLOW;
+
+     fusion_vector_init( &buffer->allocs, 2, surface->shmpool );
+
+     D_MAGIC_SET( buffer, CoreSurfaceBuffer );
+
+     *ret_buffer = buffer;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_buffer_destroy( CoreSurfaceBuffer *buffer )
+{
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation;
+     int                    i;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     D_DEBUG_AT( Core_SurfBuffer, "dfb_surface_buffer_destroy( %p [%dx%d] )\n",
+                 buffer, surface->config.size.w, surface->config.size.h );
+
+     fusion_vector_foreach_reverse (allocation, i, buffer->allocs)
+          dfb_surface_pool_deallocate( allocation->pool, allocation );
+
+     fusion_vector_destroy( &buffer->allocs );
+
+     direct_serial_deinit( &buffer->serial );
+
+     D_MAGIC_CLEAR( buffer );
+
+     SHFREE( surface->shmpool, buffer );
+
+     return DFB_OK;
+}
+
+static CoreSurfaceAllocation *
+find_allocation( CoreSurfaceBuffer       *buffer,
+                 CoreSurfaceAccessorID    accessor,
+                 CoreSurfaceAccessFlags   flags,
+                 bool                     lock )
+{
+     int                    i;
+     CoreSurfaceAllocation *alloc;
+     CoreSurfaceAllocation *uptodate = NULL;
+     CoreSurfaceAllocation *outdated = NULL;
+
+     /* Prefer allocations which are up to date. */
+     fusion_vector_foreach (alloc, i, buffer->allocs) {
+          if (direct_serial_check( &alloc->serial, &buffer->serial )) {
+               /* Return immediately if up to date allocation has required flags. */
+               if (D_FLAGS_ARE_SET( alloc->access[accessor], flags ))
+                    return alloc;
+
+               /* Remember up to date allocation in case none has supported flags. */
+               uptodate = alloc;
+          }
+          else if (D_FLAGS_ARE_SET( alloc->access[accessor], flags )) {
+               /* Remember outdated allocation which has supported flags though. */
+               outdated = alloc;
+          }
+     }
+
+     /* In case of a lock the flags are mandatory and the outdated allocation has to be used... */
+     if (lock)
+          return outdated;
+
+     /* ...otherwise we can still prefer the up to date allocation for Read/Write()! */
+     return uptodate ?: outdated;
+}
+
+DFBResult
+dfb_surface_buffer_lock( CoreSurfaceBuffer      *buffer,
+                         CoreSurfaceAccessorID   accessor,
+                         CoreSurfaceAccessFlags  access,
+                         CoreSurfaceBufferLock  *lock )
+{
+     DFBResult              ret;
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation = NULL;
+     bool                   allocated  = false;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_FLAGS_ASSERT( access, CSAF_ALL );
+     D_ASSERT( lock != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     D_ASSERT( accessor >= CSAID_CPU );
+     D_ASSUME( accessor < _CSAID_NUM );
+     if (accessor >= CSAID_ANY) {
+          D_UNIMPLEMENTED();
+          return DFB_UNIMPLEMENTED;
+     }
+
+     if (accessor < 0 || accessor >= _CSAID_NUM)
+          return DFB_INVARG;
+
+#if DIRECT_BUILD_DEBUG
+     D_DEBUG_AT( Core_SurfBuffer, "dfb_surface_buffer_lock( %p, 0x%02x, %p ) <- %dx%d %s [%d]\n", buffer, access, lock,
+                 surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(buffer->format),
+                 dfb_surface_buffer_index(buffer) );
+
+     switch (accessor) {
+          case CSAID_CPU:
+               D_DEBUG_AT( Core_SurfBuffer, "  -> CPU %s%s\n",
+                           (access & CSAF_READ) ? "READ" : "", (access & CSAF_WRITE) ? "WRITE" : "" );
+               break;
+
+          case CSAID_GPU:
+               D_DEBUG_AT( Core_SurfBuffer, "  -> GPU %s%s\n",
+                           (access & CSAF_READ) ? "READ" : "", (access & CSAF_WRITE) ? "WRITE" : "" );
+               break;
+
+          case CSAID_LAYER0:
+          case CSAID_LAYER1:
+          case CSAID_LAYER2:
+          case CSAID_LAYER3:
+          case CSAID_LAYER4:
+          case CSAID_LAYER5:
+          case CSAID_LAYER6:
+          case CSAID_LAYER7:
+               D_DEBUG_AT( Core_SurfBuffer, "  -> LAYER %d %s%s\n", accessor - CSAID_LAYER0,
+                           (access & CSAF_READ) ? "READ" : "", (access & CSAF_WRITE) ? "WRITE" : "" );
+               break;
+
+          default:
+               D_DEBUG_AT( Core_SurfBuffer, "  -> other\n" );
+               break;
+     }
+
+     if (access & CSAF_SHARED)
+          D_DEBUG_AT( Core_SurfBuffer, "  -> SHARED\n" );
+#endif
+
+     /* Look for allocation with proper access. */
+     allocation = find_allocation( buffer, accessor, access, true );
+     if (!allocation) {
+          /* If no allocation exists, create one. */
+          ret = dfb_surface_pools_allocate( buffer, accessor, access, &allocation );
+          if (ret) {
+                    D_DERROR( ret, "Core/SurfBuffer: Buffer allocation failed!\n" );
+               return ret;
+          }
+
+          allocated = true;
+     }
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     /* Synchronize with other allocations. */
+     ret = dfb_surface_allocation_update( allocation, access );
+     if (ret) {
+          /* Destroy if newly created. */
+          if (allocated)
+               dfb_surface_pool_deallocate( allocation->pool, allocation );
+          return ret;
+     }
+
+     /* Lock the allocation. */
+     dfb_surface_buffer_lock_init( lock, accessor, access );
+
+     ret = dfb_surface_pool_lock( allocation->pool, allocation, lock );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Locking allocation failed! [%s]\n",
+                    allocation->pool->desc.name );
+          dfb_surface_buffer_lock_deinit( lock );
+
+          /* Destroy if newly created. */
+          if (allocated)
+               dfb_surface_pool_deallocate( allocation->pool, allocation );
+
+          return ret;
+     }
+
+#if 1
+     /*
+      * Manage access interlocks.
+      *
+      * SOON FIXME: Clearing flags only when not locked yet. Otherwise nested GPU/CPU locks are a problem.
+      */
+     /* Software read/write access... */
+     if (accessor == CSAID_CPU) {
+          /* If hardware has written or is writing... */
+          if (allocation->accessed[CSAID_GPU] & CSAF_WRITE) {
+               /* ...wait for the operation to finish. */
+               dfb_gfxcard_sync(); /* TODO: wait for serial instead */
+
+               /* Software read access after hardware write requires flush of the (bus) read cache. */
+               dfb_gfxcard_flush_read_cache();
+
+               if (!buffer->locked) {
+                    /* ...clear hardware write access. */
+                    allocation->accessed[CSAID_GPU] &= ~CSAF_WRITE;
+
+                    /* ...clear hardware read access (to avoid syncing twice). */
+                    allocation->accessed[CSAID_GPU] &= ~CSAF_READ;
+               }
+          }
+
+          /* Software write access... */
+          if (access & CSAF_WRITE) {
+               /* ...if hardware has (to) read... */
+               if (allocation->accessed[CSAID_GPU] & CSAF_READ) {
+                    /* ...wait for the operation to finish. */
+                    dfb_gfxcard_sync(); /* TODO: wait for serial instead */
+
+                    /* ...clear hardware read access. */
+                    if (!buffer->locked)
+                         allocation->accessed[CSAID_GPU] &= ~CSAF_READ;
+               }
+          }
+     }
+
+     /* Hardware read access... */
+     if (accessor == CSAID_GPU && access & CSAF_READ) {
+          /* ...if software has written before... */
+          if (allocation->accessed[CSAID_CPU] & CSAF_WRITE) {
+               /* ...flush texture cache. */
+               dfb_gfxcard_flush_texture_cache();
+
+               /* ...clear software write access. */
+               if (!buffer->locked)
+                    allocation->accessed[CSAID_CPU] &= ~CSAF_WRITE;
+          }
+     }
+
+     if (! D_FLAGS_ARE_SET( allocation->accessed[accessor], access )) {
+          /* FIXME: surface_enter */
+     }
+#endif
+
+     /* Collect... */
+     allocation->accessed[accessor] |= access;
+
+#if 1
+     /* FIXME: don't use weak counter */
+     buffer->locked++;
+
+     D_DEBUG_AT( Core_SurfBuffer, "  -> locked %dx now\n", buffer->locked );
+#endif
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_buffer_unlock( CoreSurfaceBufferLock *lock )
+{
+     DFBResult              ret;
+     CoreSurfacePool       *pool;
+     CoreSurfaceBuffer     *buffer;
+     CoreSurfaceAllocation *allocation;
+
+     D_DEBUG_AT( Core_SurfBuffer, "dfb_surface_buffer_unlock( %p )\n", lock );
+
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_MAGIC_ASSERT( lock->buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( lock->buffer->surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &lock->buffer->surface->lock );
+
+     allocation = lock->allocation;
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     buffer = lock->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     pool = allocation->pool;
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     /*
+      * FIXME: This should fail with a nested GPU Lock during a CPU Lock and/or vice versa?
+      */
+//     D_ASSUME( D_FLAGS_ARE_SET( allocation->accessed, lock->access ) );
+
+     ret = dfb_surface_pool_unlock( pool, lock->allocation, lock );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Unlocking allocation failed! [%s]\n", pool->desc.name );
+          return ret;
+     }
+
+#if 1
+     buffer->locked--;
+#endif
+
+     dfb_surface_buffer_lock_reset( lock );
+
+     dfb_surface_buffer_lock_deinit( lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_buffer_read( CoreSurfaceBuffer  *buffer,
+                         void               *destination,
+                         int                 pitch,
+                         const DFBRectangle *prect )
+{
+     DFBResult              ret;
+     int                    y;
+     int                    bytes;
+     DFBRectangle           rect;
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation = NULL;
+     bool                   allocated  = false;
+     DFBSurfacePixelFormat  format;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s( %p, %p [%d] )\n", __FUNCTION__, buffer, destination, pitch );
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_ASSERT( destination != NULL );
+     D_ASSERT( pitch > 0 );
+     DFB_RECTANGLE_ASSERT_IF( prect );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     /* Determine area. */
+     rect.x = 0;
+     rect.y = 0;
+     rect.w = surface->config.size.w;
+     rect.h = surface->config.size.h;
+
+     if (prect && (!dfb_rectangle_intersect( &rect, prect ) || !DFB_RECTANGLE_EQUAL( rect, *prect )))
+          return DFB_INVAREA;
+
+     /* Calculate bytes per read line. */
+     format = surface->config.format;
+     bytes  = DFB_BYTES_PER_LINE( format, rect.w );
+
+     D_DEBUG_AT( Core_SurfBuffer, "  -> %d,%d - %dx%d (%s)\n", DFB_RECTANGLE_VALS(&rect),
+                 dfb_pixelformat_name( format ) );
+
+     /* If no allocations exists, simply clear the destination. */
+     if (fusion_vector_is_empty( &buffer->allocs )) {
+          for (y=0; y<rect.h; y++) {
+               memset( destination, 0, bytes );
+
+               destination += pitch;
+          }
+
+          return DFB_OK;
+     }
+
+     /* Use last written allocation if it's up to date... */
+     if (buffer->written && direct_serial_check( &buffer->written->serial, &buffer->serial ))
+          allocation = buffer->written;
+     else {
+          /* ...otherwise look for allocation with CPU access. */
+          allocation = find_allocation( buffer, CSAID_CPU, CSAF_READ, false );
+          if (!allocation) {
+               /* If no allocation exists, create one. */
+               ret = dfb_surface_pools_allocate( buffer, CSAID_CPU, CSAF_READ, &allocation );
+               if (ret) {
+                    D_DERROR( ret, "Core/SurfBuffer: Buffer allocation failed!\n" );
+                    return ret;
+               }
+
+               allocated = true;
+          }
+     }
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     /* Synchronize with other allocations. */
+     ret = dfb_surface_allocation_update( allocation, CSAF_READ );
+     if (ret) {
+          /* Destroy if newly created. */
+          if (allocated)
+               dfb_surface_pool_deallocate( allocation->pool, allocation );
+          return ret;
+     }
+
+     /* Try reading from allocation directly... */
+     ret = dfb_surface_pool_read( allocation->pool, allocation, destination, pitch, &rect );
+     if (ret) {
+          /* ...otherwise use fallback method via locking if possible. */
+          if (allocation->access[CSAID_CPU] & CSAF_READ) {
+               CoreSurfaceBufferLock lock;
+
+               /* Lock the allocation. */
+               dfb_surface_buffer_lock_init( &lock, CSAID_CPU, CSAF_READ );
+
+               ret = dfb_surface_pool_lock( allocation->pool, allocation, &lock );
+               if (ret) {
+                    D_DERROR( ret, "Core/SurfBuffer: Locking allocation failed! [%s]\n",
+                              allocation->pool->desc.name );
+                    dfb_surface_buffer_lock_deinit( &lock );
+                    return ret;
+               }
+
+               /* Move to start of read. */
+               lock.addr += DFB_BYTES_PER_LINE( format, rect.x ) + rect.y * lock.pitch;
+
+               /* Copy the data. */
+               for (y=0; y<rect.h; y++) {
+                    direct_memcpy( destination, lock.addr, bytes );
+
+                    destination += pitch;
+                    lock.addr   += lock.pitch;
+               }
+
+               /* Unlock the allocation. */
+               ret = dfb_surface_pool_unlock( allocation->pool, allocation, &lock );
+               if (ret)
+                    D_DERROR( ret, "Core/SurfBuffer: Unlocking allocation failed! [%s]\n", allocation->pool->desc.name );
+
+               dfb_surface_buffer_lock_deinit( &lock );
+          }
+     }
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_buffer_write( CoreSurfaceBuffer  *buffer,
+                          const void         *source,
+                          int                 pitch,
+                          const DFBRectangle *prect )
+{
+     DFBResult              ret;
+     DFBRectangle           rect;
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation = NULL;
+     bool                   allocated  = false;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s( %p, %p [%d] )\n", __FUNCTION__, buffer, source, pitch );
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_ASSERT( pitch > 0 || source == NULL );
+     DFB_RECTANGLE_ASSERT_IF( prect );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     /* Determine area. */
+     rect.x = 0;
+     rect.y = 0;
+     rect.w = surface->config.size.w;
+     rect.h = surface->config.size.h;
+
+     if (prect && (!dfb_rectangle_intersect( &rect, prect ) || !DFB_RECTANGLE_EQUAL( rect, *prect )))
+          return DFB_INVAREA;
+
+     D_DEBUG_AT( Core_SurfBuffer, "  -> %d,%d - %dx%d (%s)\n", DFB_RECTANGLE_VALS(&rect),
+                 dfb_pixelformat_name( surface->config.format ) );
+
+     /* Use last read allocation if it's up to date... */
+     if (buffer->read && direct_serial_check( &buffer->read->serial, &buffer->serial ))
+          allocation = buffer->read;
+     else {
+          /* ...otherwise look for allocation with CPU access. */
+          allocation = find_allocation( buffer, CSAID_CPU, CSAF_WRITE, false );
+          if (!allocation) {
+               /* If no allocation exists, create one. */
+               ret = dfb_surface_pools_allocate( buffer, CSAID_CPU, CSAF_WRITE, &allocation );
+               if (ret) {
+                    D_DERROR( ret, "Core/SurfBuffer: Buffer allocation failed!\n" );
+                    return ret;
+               }
+
+               allocated = true;
+          }
+     }
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     /* Synchronize with other allocations. */
+     ret = dfb_surface_allocation_update( allocation, CSAF_WRITE );
+     if (ret) {
+          /* Destroy if newly created. */
+          if (allocated)
+               dfb_surface_pool_deallocate( allocation->pool, allocation );
+          return ret;
+     }
+
+     /* Try writing to allocation directly... */
+     ret = source ? dfb_surface_pool_write( allocation->pool, allocation, source, pitch, &rect ) : DFB_UNSUPPORTED;
+     if (ret) {
+          /* ...otherwise use fallback method via locking if possible. */
+          if (allocation->access[CSAID_CPU] & CSAF_WRITE) {
+               int                   y;
+               int                   bytes;
+               DFBSurfacePixelFormat format;
+               CoreSurfaceBufferLock lock;
+
+               /* Calculate bytes per written line. */
+               format = surface->config.format;
+               bytes  = DFB_BYTES_PER_LINE( format, rect.w );
+
+               /* Lock the allocation. */
+               dfb_surface_buffer_lock_init( &lock, CSAID_CPU, CSAF_WRITE );
+
+               ret = dfb_surface_pool_lock( allocation->pool, allocation, &lock );
+               if (ret) {
+                    D_DERROR( ret, "Core/SurfBuffer: Locking allocation failed! [%s]\n",
+                              allocation->pool->desc.name );
+                    dfb_surface_buffer_lock_deinit( &lock );
+                    return ret;
+               }
+
+               /* Move to start of write. */
+               lock.addr += DFB_BYTES_PER_LINE( format, rect.x ) + rect.y * lock.pitch;
+
+               /* Copy the data. */
+               for (y=0; y<rect.h; y++) {
+                    if (source) {
+                         direct_memcpy( lock.addr, source, bytes );
+
+                         source += pitch;
+                    }
+                    else
+                         memset( lock.addr, 0, bytes );
+
+                    lock.addr += lock.pitch;
+               }
+
+               /* Unlock the allocation. */
+               ret = dfb_surface_pool_unlock( allocation->pool, allocation, &lock );
+               if (ret)
+                    D_DERROR( ret, "Core/SurfBuffer: Unlocking allocation failed! [%s]\n", allocation->pool->desc.name );
+
+               dfb_surface_buffer_lock_deinit( &lock );
+          }
+     }
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_buffer_dump( CoreSurfaceBuffer *buffer,
+                         const char        *directory,
+                         const char        *prefix )
+{
+     DFBResult              ret;
+     int                    num  = -1;
+     int                    fd_p = -1;
+     int                    fd_g = -1;
+     int                    i, n;
+     int                    len = (directory ? strlen(directory) : 0) + (prefix ? strlen(prefix) : 0) + 40;
+     char                   filename[len];
+     char                   head[30];
+     bool                   rgb   = false;
+     bool                   alpha = false;
+#ifdef USE_ZLIB
+     gzFile                 gz_p = NULL, gz_g = NULL;
+     static const char     *gz_ext = ".gz";
+#else
+     static const char     *gz_ext = "";
+#endif
+     CoreSurface           *surface;
+     CorePalette           *palette = NULL;
+     CoreSurfaceBufferLock  lock;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s( %p, %p, %p )\n", __FUNCTION__, buffer, directory, prefix );
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_ASSERT( directory != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     /* Check pixel format. */
+     switch (buffer->format) {
+          case DSPF_LUT8:
+               palette = surface->palette;
+
+               if (!palette) {
+                    D_BUG( "no palette" );
+                    return DFB_BUG;
+               }
+
+               if (dfb_palette_ref( palette ))
+                    return DFB_FUSION;
+
+               rgb = true;
+
+               /* fall through */
+
+          case DSPF_A8:
+               alpha = true;
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_ARGB1555:
+          case DSPF_ARGB2554:
+          case DSPF_ARGB4444:
+          case DSPF_AiRGB:
+               alpha = true;
+
+               /* fall through */
+
+          case DSPF_RGB332:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_NV16:
+          case DSPF_RGB444:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+               rgb   = true;
+               break;
+
+
+          default:
+               D_ERROR( "DirectFB/core/surfaces: surface dump for format "
+                         "'%s' is not implemented!\n",
+                        dfb_pixelformat_name( buffer->format ) );
+               return DFB_UNSUPPORTED;
+     }
+
+     /* Lock the surface buffer, get the data pointer and pitch. */
+     ret = dfb_surface_buffer_lock( buffer, CSAID_CPU, CSAF_READ, &lock );
+     if (ret) {
+          if (palette)
+               dfb_palette_unref( palette );
+          return ret;
+     }
+
+     if (prefix) {
+          /* Find the lowest unused index. */
+          while (++num < 10000) {
+               snprintf( filename, len, "%s/%s_%04d.ppm%s",
+                         directory, prefix, num, gz_ext );
+
+               if (access( filename, F_OK ) != 0) {
+                    snprintf( filename, len, "%s/%s_%04d.pgm%s",
+                              directory, prefix, num, gz_ext );
+
+                    if (access( filename, F_OK ) != 0)
+                         break;
+               }
+          }
+
+          if (num == 10000) {
+               D_ERROR( "DirectFB/core/surfaces: "
+                        "couldn't find an unused index for surface dump!\n" );
+               dfb_surface_buffer_unlock( &lock );
+               if (palette)
+                    dfb_palette_unref( palette );
+               return DFB_FAILURE;
+          }
+     }
+
+     /* Create a file with the found index. */
+     if (rgb) {
+          if (prefix)
+               snprintf( filename, len, "%s/%s_%04d.ppm%s", directory, prefix, num, gz_ext );
+          else
+               snprintf( filename, len, "%s.ppm%s", directory, gz_ext );
+
+          fd_p = open( filename, O_EXCL | O_CREAT | O_WRONLY, 0644 );
+          if (fd_p < 0) {
+               D_PERROR("DirectFB/core/surfaces: "
+                        "could not open %s!\n", filename);
+               dfb_surface_buffer_unlock( &lock );
+               if (palette)
+                    dfb_palette_unref( palette );
+               return DFB_IO;
+          }
+     }
+
+     /* Create a graymap for the alpha channel using the found index. */
+     if (alpha) {
+          if (prefix)
+               snprintf( filename, len, "%s/%s_%04d.pgm%s", directory, prefix, num, gz_ext );
+          else
+               snprintf( filename, len, "%s.pgm%s", directory, gz_ext );
+
+          fd_g = open( filename, O_EXCL | O_CREAT | O_WRONLY, 0644 );
+          if (fd_g < 0) {
+               D_PERROR("DirectFB/core/surfaces: "
+                         "could not open %s!\n", filename);
+
+               dfb_surface_buffer_unlock( &lock );
+               if (palette)
+                    dfb_palette_unref( palette );
+
+               if (rgb) {
+                    close( fd_p );
+                    snprintf( filename, len, "%s/%s_%04d.ppm%s",
+                              directory, prefix, num, gz_ext );
+                    unlink( filename );
+               }
+
+               return DFB_IO;
+          }
+     }
+
+#ifdef USE_ZLIB
+     if (rgb)
+          gz_p = gzdopen( fd_p, "wb" );
+
+     if (alpha)
+          gz_g = gzdopen( fd_g, "wb" );
+#endif
+
+     if (rgb) {
+          /* Write the pixmap header. */
+          snprintf( head, 30,
+                    "P6\n%d %d\n255\n", surface->config.size.w, surface->config.size.h );
+#ifdef USE_ZLIB
+          gzwrite( gz_p, head, strlen(head) );
+#else
+          write( fd_p, head, strlen(head) );
+#endif
+     }
+
+     /* Write the graymap header. */
+     if (alpha) {
+          snprintf( head, 30,
+                    "P5\n%d %d\n255\n", surface->config.size.w, surface->config.size.h );
+#ifdef USE_ZLIB
+          gzwrite( gz_g, head, strlen(head) );
+#else
+          write( fd_g, head, strlen(head) );
+#endif
+     }
+
+     /* Write the pixmap (and graymap) data. */
+     for (i=0; i<surface->config.size.h; i++) {
+          int n3;
+
+          /* Prepare one row. */
+          u8 *src8 = dfb_surface_data_offset( surface, lock.addr, lock.pitch, 0, i );
+
+          /* Write color buffer to pixmap file. */
+          if (rgb) {
+               u8 buf_p[surface->config.size.w * 3];
+
+               if (buffer->format == DSPF_LUT8) {
+                    for (n=0, n3=0; n<surface->config.size.w; n++, n3+=3) {
+                         buf_p[n3+0] = palette->entries[src8[n]].r;
+                         buf_p[n3+1] = palette->entries[src8[n]].g;
+                         buf_p[n3+2] = palette->entries[src8[n]].b;
+                    }
+               }
+               else
+                    dfb_convert_to_rgb24( buffer->format, src8, lock.pitch, surface->config.size.h,
+                                          buf_p, surface->config.size.w * 3, surface->config.size.w, 1 );
+#ifdef USE_ZLIB
+               gzwrite( gz_p, buf_p, surface->config.size.w * 3 );
+#else
+               write( fd_p, buf_p, surface->config.size.w * 3 );
+#endif
+          }
+
+          /* Write alpha buffer to graymap file. */
+          if (alpha) {
+               u8 buf_g[surface->config.size.w];
+
+               if (buffer->format == DSPF_LUT8) {
+                    for (n=0; n<surface->config.size.w; n++)
+                         buf_g[n] = palette->entries[src8[n]].a;
+               }
+               else
+                    dfb_convert_to_a8( buffer->format, src8, lock.pitch, surface->config.size.h,
+                                       buf_g, surface->config.size.w, surface->config.size.w, 1 );
+#ifdef USE_ZLIB
+               gzwrite( gz_g, buf_g, surface->config.size.w );
+#else
+               write( fd_g, buf_g, surface->config.size.w );
+#endif
+          }
+     }
+
+     /* Unlock the surface buffer. */
+     dfb_surface_buffer_unlock( &lock );
+
+     /* Release the palette. */
+     if (palette)
+          dfb_palette_unref( palette );
+
+#ifdef USE_ZLIB
+     if (rgb)
+          gzclose( gz_p );
+
+     if (alpha)
+          gzclose( gz_g );
+#endif
+
+     /* Close pixmap file. */
+     if (rgb)
+          close( fd_p );
+
+     /* Close graymap file. */
+     if (alpha)
+          close( fd_g );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void
+transfer_buffer( CoreSurfaceBuffer *buffer,
+                 const void        *src,
+                 void              *dst,
+                 int                srcpitch,
+                 int                dstpitch )
+{
+     int          i;
+     CoreSurface *surface;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s( %p, %p [%d] -> %p [%d] ) * %d\n",
+                 __FUNCTION__, buffer, src, srcpitch, dst, dstpitch, surface->config.size.h );
+
+     D_ASSERT( src != NULL );
+     D_ASSERT( dst != NULL );
+     D_ASSERT( srcpitch > 0 );
+     D_ASSERT( dstpitch > 0 );
+
+     D_ASSERT( srcpitch >= DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w ) );
+     D_ASSERT( dstpitch >= DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w ) );
+
+     for (i=0; i<surface->config.size.h; i++) {
+          direct_memcpy( dst, src, DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w ) );
+
+          src += srcpitch;
+          dst += dstpitch;
+     }
+
+     switch (buffer->format) {
+          case DSPF_YV12:
+          case DSPF_I420:
+               for (i=0; i<surface->config.size.h; i++) {
+                    direct_memcpy( dst, src,
+                                   DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w / 2 ) );
+                    src += srcpitch / 2;
+                    dst += dstpitch / 2;
+               }
+               break;
+
+          case DSPF_NV12:
+          case DSPF_NV21:
+               for (i=0; i<surface->config.size.h/2; i++) {
+                    direct_memcpy( dst, src,
+                                   DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w ) );
+                    src += srcpitch;
+                    dst += dstpitch;
+               }
+               break;
+
+          case DSPF_NV16:
+               for (i=0; i<surface->config.size.h; i++) {
+                    direct_memcpy( dst, src,
+                                   DFB_BYTES_PER_LINE( buffer->format, surface->config.size.w ) );
+                    src += srcpitch;
+                    dst += dstpitch;
+               }
+               break;
+
+          default:
+               break;
+     }
+}
+
+static DFBResult
+allocation_update_copy( CoreSurfaceAllocation *allocation,
+                        CoreSurfaceAllocation *source )
+{
+     DFBResult              ret;
+     CoreSurfaceBufferLock  src;
+     CoreSurfaceBufferLock  dst;
+     CoreSurfaceBuffer     *buffer;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( allocation != source );
+
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( source, CoreSurfaceAllocation );
+
+     D_ASSERT( source->buffer == allocation->buffer );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     /* Lock the source allocation. */
+     dfb_surface_buffer_lock_init( &src, CSAID_CPU, CSAF_READ );
+
+     ret = dfb_surface_pool_lock( source->pool, source, &src );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Could not lock source for transfer!\n" );
+          dfb_surface_buffer_lock_deinit( &src );
+          return ret;
+     }
+
+     /* Lock the destination allocation. */
+     dfb_surface_buffer_lock_init( &dst, CSAID_CPU, CSAF_WRITE );
+
+     ret = dfb_surface_pool_lock( allocation->pool, allocation, &dst );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Could not lock destination for transfer!\n" );
+          dfb_surface_pool_unlock( source->pool, source, &src );
+          return ret;
+     }
+
+     transfer_buffer( buffer, src.addr, dst.addr, src.pitch, dst.pitch );
+
+     dfb_surface_pool_unlock( allocation->pool, allocation, &dst );
+     dfb_surface_pool_unlock( source->pool, source, &src );
+
+     dfb_surface_buffer_lock_deinit( &dst );
+     dfb_surface_buffer_lock_deinit( &src );
+
+     return DFB_OK;
+}
+
+static DFBResult
+allocation_update_write( CoreSurfaceAllocation *allocation,
+                         CoreSurfaceAllocation *source )
+{
+     DFBResult              ret;
+     CoreSurfaceBufferLock  src;
+     CoreSurfaceBuffer     *buffer;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( allocation != source );
+
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( source, CoreSurfaceAllocation );
+
+     D_ASSERT( source->buffer == allocation->buffer );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     /* Lock the source allocation. */
+     dfb_surface_buffer_lock_init( &src, CSAID_CPU, CSAF_READ );
+
+     ret = dfb_surface_pool_lock( source->pool, source, &src );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Could not lock source for transfer!\n" );
+          dfb_surface_buffer_lock_deinit( &src );
+          return ret;
+     }
+
+     /* Write to the destination allocation. */
+     ret = dfb_surface_pool_write( allocation->pool, allocation, src.addr, src.pitch, NULL );
+     if (ret)
+          D_DERROR( ret, "Core/SurfBuffer: Could not write from destination allocation!\n" );
+
+     dfb_surface_pool_unlock( source->pool, source, &src );
+
+     dfb_surface_buffer_lock_deinit( &src );
+
+     return ret;
+}
+
+static DFBResult
+allocation_update_read( CoreSurfaceAllocation *allocation,
+                        CoreSurfaceAllocation *source )
+{
+     DFBResult              ret;
+     CoreSurfaceBufferLock  dst;
+     CoreSurfaceBuffer     *buffer;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( allocation != source );
+
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( source, CoreSurfaceAllocation );
+
+     D_ASSERT( source->buffer == allocation->buffer );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     /* Lock the destination allocation. */
+     dfb_surface_buffer_lock_init( &dst, CSAID_CPU, CSAF_WRITE );
+
+     ret = dfb_surface_pool_lock( allocation->pool, allocation, &dst );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfBuffer: Could not lock destination for transfer!\n" );
+          dfb_surface_buffer_lock_deinit( &dst );
+          return ret;
+     }
+
+     /* Read from the source allocation. */
+     ret = dfb_surface_pool_read( source->pool, source, dst.addr, dst.pitch, NULL );
+     if (ret)
+          D_DERROR( ret, "Core/SurfBuffer: Could not read from source allocation!\n" );
+
+     dfb_surface_pool_unlock( allocation->pool, allocation, &dst );
+
+     dfb_surface_buffer_lock_deinit( &dst );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_allocation_update( CoreSurfaceAllocation  *allocation,
+                               CoreSurfaceAccessFlags  access )
+{
+     DFBResult              ret;
+     int                    i;
+     CoreSurfaceAllocation *alloc;
+     CoreSurfaceBuffer     *buffer;
+
+     D_DEBUG_AT( Core_SurfBuffer, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_FLAGS_ASSERT( access, CSAF_ALL );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     if (direct_serial_update( &allocation->serial, &buffer->serial ) && buffer->written) {
+          CoreSurfaceAllocation *source = buffer->written;
+
+          D_ASSUME( allocation != source );
+
+          D_DEBUG_AT( Core_SurfBuffer, "  -> updating allocation...\n" );
+
+          D_MAGIC_ASSERT( source, CoreSurfaceAllocation );
+          D_ASSERT( source->buffer == allocation->buffer );
+
+          ret = dfb_surface_pool_bridges_transfer( buffer, source, allocation, NULL, 0 );
+          if (ret) {
+               if ((source->access[CSAID_CPU] & CSAF_READ) && (allocation->access[CSAID_CPU] & CSAF_WRITE))
+                    ret = allocation_update_copy( allocation, source );
+               else if (source->access[CSAID_CPU] & CSAF_READ)
+                    ret = allocation_update_write( allocation, source );
+               else if (allocation->access[CSAID_CPU] & CSAF_WRITE)
+                    ret = allocation_update_read( allocation, source );
+               else {
+                    D_UNIMPLEMENTED();
+                    ret = DFB_UNSUPPORTED;
+               }
+          }
+
+          if (ret) {
+               D_DERROR( ret, "Core/SurfaceBuffer: Updating allocation failed!\n" );
+               return ret;
+          }
+     }
+
+     if (access & CSAF_WRITE) {
+          D_DEBUG_AT( Core_SurfBuffer, "  -> increasing serial...\n" );
+
+          direct_serial_increase( &buffer->serial );
+
+          direct_serial_copy( &allocation->serial, &buffer->serial );
+
+          buffer->written = allocation;
+          buffer->read    = NULL;
+
+          /* Zap volatile allocations (freed when no longer up to date). */
+          fusion_vector_foreach (alloc, i, buffer->allocs) {
+               D_MAGIC_ASSERT( alloc, CoreSurfaceAllocation );
+
+               if (alloc != allocation && (alloc->flags & CSALF_VOLATILE)) {
+                    dfb_surface_pool_deallocate( alloc->pool, alloc );
+                    i--;
+               }
+          }
+     }
+     else
+          buffer->read = allocation;
+
+     /* Zap all other allocations? */
+     if (dfb_config->thrifty_surface_buffers) {
+          buffer->written = buffer->read = allocation;
+
+          fusion_vector_foreach (alloc, i, buffer->allocs) {
+               D_MAGIC_ASSERT( alloc, CoreSurfaceAllocation );
+
+               /* Don't zap preallocated which would not really free up memory, but just loose the handle. */
+               if (alloc != allocation && !(alloc->flags & (CSALF_PREALLOCATED | CSALF_MUCKOUT))) {
+                    dfb_surface_pool_deallocate( alloc->pool, alloc );
+                    i--;
+               }
+          }
+     }
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/surface_buffer.h b/Source/DirectFB/src/core/surface_buffer.h
new file mode 100755
index 0000000..4acf65a
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_buffer.h
@@ -0,0 +1,257 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__SURFACE_BUFFER_H__
+#define __CORE__SURFACE_BUFFER_H__
+
+#include <direct/debug.h>
+#include <direct/list.h>
+
+#include <fusion/vector.h>
+
+#include <core/surface.h>
+
+#include <directfb.h>
+
+
+/*
+ * Configuration and State flags of a Surface Buffer
+ */
+typedef enum {
+     CSBF_NONE      = 0x00000000,  /* None of these. */
+
+     CSBF_STICKED   = 0x00000001,  /* Sticked to one Surface Pool, e.g. system only. */
+
+     CSBF_ALL       = 0x00000001   /* All of these. */
+} CoreSurfaceBufferFlags;
+
+/*
+ * Configuration and State flags of a Surface Buffer Allocation
+ */
+typedef enum {
+     CSALF_NONE          = 0x00000000,  /* None of these. */
+
+     CSALF_ONEFORALL     = 0x00000001,  /* Only one allocation in pool for all buffers. */
+     CSALF_VOLATILE      = 0x00000002,  /* Allocation should be freed when no longer up to date. */
+     CSALF_PREALLOCATED  = 0x00000004,  /* Preallocated memory, don't zap when "thrifty-surface-buffers" is active. */
+
+     CSALF_MUCKOUT       = 0x00001000,  /* Indicates surface pool being in the progress of mucking out this and possibly
+                                           other allocations to have enough space for a new allocation to be made. */
+
+     CSALF_ALL           = 0x00001007   /* All of these. */
+} CoreSurfaceAllocationFlags;
+
+/*
+ * An Allocation of a Surface Buffer
+ */
+struct __DFB_CoreSurfaceAllocation {
+     int                            magic;
+
+     DirectSerial                   serial;       /* Equals serial of buffer if content is up to date. */
+
+     CoreSurfaceBuffer             *buffer;       /* Surface Buffer owning this allocation. */
+     CoreSurface                   *surface;      /* Surface owning the Buffer of this allocation. */
+     CoreSurfacePool               *pool;         /* Surface Pool providing the allocation. */
+     void                          *data;         /* Pool's private data for this allocation. */
+     int                            size;         /* Amount of data used by this allocation. */
+     unsigned long                  offset;       /* Offset within address range of pool if contiguous. */
+
+     CoreSurfaceAllocationFlags     flags;        /* Pool can return CSALF_ONEFORALL upon allocation of first buffer. */
+
+     const CoreSurfaceAccessFlags  *access;                 /* Possible access flags (pointer to pool description). */
+     CoreSurfaceAccessFlags         accessed[_CSAID_NUM];   /* Access since last synchronization. */
+};
+
+#define CORE_SURFACE_ALLOCATION_ASSERT(alloc)                                                  \
+     do {                                                                                      \
+          D_MAGIC_ASSERT( alloc, CoreSurfaceAllocation );                                      \
+          D_ASSUME( (alloc)->size > 0 );                                                       \
+          D_ASSERT( (alloc)->size >= 0 );                                                      \
+          D_ASSERT( (alloc)->offset + (alloc)->size <= ((alloc)->pool->desc.size ?:~0UL) );    \
+          D_FLAGS_ASSERT( (alloc)->access[CSAID_CPU], CSAF_ALL );                              \
+          D_FLAGS_ASSERT( (alloc)->access[CSAID_GPU], CSAF_ALL );                              \
+          D_FLAGS_ASSERT( (alloc)->flags, CSALF_ALL );                                         \
+          D_FLAGS_ASSERT( (alloc)->accessed[CSAID_CPU], CSAF_ALL );                            \
+          D_FLAGS_ASSERT( (alloc)->accessed[CSAID_GPU], CSAF_ALL );                            \
+     } while (0)
+
+/*
+ * A Lock on a Surface Buffer
+ */
+struct __DFB_CoreSurfaceBufferLock {
+     int                      magic;              /* Must be valid before calling dfb_surface_pool_lock() */
+
+     CoreSurfaceAccessorID    accessor;           /* " */
+     CoreSurfaceAccessFlags   access;             /* " */
+
+     CoreSurfaceBuffer       *buffer;             /* Set by dfb_surface_pool_lock() */
+     CoreSurfaceAllocation   *allocation;         /* " */
+
+     void                    *addr;               /* " */
+     unsigned long            phys;               /* " */
+     unsigned long            offset;             /* " */
+     unsigned int             pitch;              /* " */
+
+     void                    *handle;             /* " */
+};
+
+static inline void
+dfb_surface_buffer_lock_reset( CoreSurfaceBufferLock *lock )
+{
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     lock->buffer     = NULL;
+     lock->allocation = NULL;
+     lock->addr       = NULL;
+     lock->phys       = 0;
+     lock->offset     = ~0;
+     lock->pitch      = 0;
+     lock->handle     = NULL;
+}
+
+static inline void
+dfb_surface_buffer_lock_init( CoreSurfaceBufferLock *lock, CoreSurfaceAccessorID accessor, CoreSurfaceAccessFlags access )
+{
+     D_MAGIC_SET( lock, CoreSurfaceBufferLock );
+
+     lock->accessor = accessor;
+     lock->access   = access;
+
+     dfb_surface_buffer_lock_reset( lock );
+}
+
+static inline void
+dfb_surface_buffer_lock_deinit( CoreSurfaceBufferLock *lock )
+{
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     lock->accessor = CSAID_NONE;
+     lock->access   = CSAF_NONE;
+
+     D_MAGIC_CLEAR( lock );
+}
+
+#define CORE_SURFACE_BUFFER_LOCK_ASSERT(lock)                                                       \
+     do {                                                                                           \
+          D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );                                            \
+          D_FLAGS_ASSERT( (lock)->access, CSAF_ALL );                                               \
+          if ((lock)->buffer) {                                                                     \
+               D_ASSERT( (lock)->allocation != NULL );                                              \
+               D_ASSERT( (lock)->buffer == (lock)->allocation->buffer );                            \
+               D_ASSUME( (lock)->addr != NULL || (lock)->phys != 0 || (lock)->offset != ~0 || (lock)->handle != NULL );\
+               D_ASSUME( (lock)->offset == (lock)->allocation->offset || (lock)->offset == ~0 );    \
+               D_ASSERT( (lock)->pitch > 0 || ((lock)->addr == NULL && (lock)->phys == 0) );        \
+          }                                                                                         \
+          else {                                                                                    \
+               D_ASSERT( (lock)->allocation == NULL );                                              \
+               D_ASSERT( (lock)->addr == NULL );                                                    \
+               D_ASSERT( (lock)->phys == 0 );                                                       \
+               D_ASSERT( (lock)->offset == ~0 );                                                    \
+               D_ASSERT( (lock)->pitch == 0 );                                                      \
+               D_ASSERT( (lock)->handle == NULL );                                                  \
+          }                                                                                         \
+     } while (0)
+
+/*
+ * A Surface Buffer of a Surface
+ */
+struct __DFB_CoreSurfaceBuffer {
+     int                      magic;
+
+     DirectSerial             serial;        /* Increased when content is written. */
+     CoreSurfaceAllocation   *written;       /* Allocation with the last write access. */
+     CoreSurfaceAllocation   *read;          /* Allocation with the last read access. */
+
+     CoreSurface             *surface;       /* Surface owning this Surface Buffer. */
+     CoreSurfacePolicy        policy;
+
+     CoreSurfaceBufferFlags   flags;         /* Configuration and State flags. */
+     DFBSurfacePixelFormat    format;        /* Pixel format of buffer data. */
+
+     FusionVector             allocs;        /* Allocations within Surface Pools. */
+
+#if 1
+     unsigned int             locked;        /* Lock count. FIXME: Add fail safe cleanup! */
+#endif
+};
+
+
+DFBResult dfb_surface_buffer_new    ( CoreSurface             *surface,
+                                      CoreSurfaceBufferFlags   flags,
+                                      CoreSurfaceBuffer      **ret_buffer );
+
+DFBResult dfb_surface_buffer_destroy( CoreSurfaceBuffer       *buffer );
+
+
+DFBResult dfb_surface_buffer_lock   ( CoreSurfaceBuffer       *buffer,
+                                      CoreSurfaceAccessorID    accessor,
+                                      CoreSurfaceAccessFlags   access,
+                                      CoreSurfaceBufferLock   *ret_lock );
+
+DFBResult dfb_surface_buffer_unlock ( CoreSurfaceBufferLock   *lock );
+
+DFBResult dfb_surface_buffer_read   ( CoreSurfaceBuffer       *buffer,
+                                      void                    *destination,
+                                      int                      pitch,
+                                      const DFBRectangle      *rect );
+
+DFBResult dfb_surface_buffer_write  ( CoreSurfaceBuffer       *buffer,
+                                      const void              *source,
+                                      int                      pitch,
+                                      const DFBRectangle      *rect );
+
+DFBResult dfb_surface_buffer_dump   ( CoreSurfaceBuffer       *buffer,
+                                      const char              *directory,
+                                      const char              *prefix );
+
+static inline int
+dfb_surface_buffer_index( CoreSurfaceBuffer *buffer )
+{
+     int          index;
+     CoreSurface *surface;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     for (index=0; index<MAX_SURFACE_BUFFERS; index++) {
+          if (surface->buffers[index] == buffer)
+               return index;
+     }
+
+     D_ASSERT( index<MAX_SURFACE_BUFFERS );
+
+     return 0;
+}
+
+DFBResult dfb_surface_allocation_update( CoreSurfaceAllocation  *allocation,
+                                         CoreSurfaceAccessFlags  access );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/surface_core.c b/Source/DirectFB/src/core/surface_core.c
new file mode 100755
index 0000000..11aa286
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_core.c
@@ -0,0 +1,214 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core_parts.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+
+
+extern SurfacePoolFuncs localSurfacePoolFuncs;
+extern SurfacePoolFuncs sharedSurfacePoolFuncs;
+extern SurfacePoolFuncs preallocSurfacePoolFuncs;
+
+
+
+D_DEBUG_DOMAIN( Core_Surface, "Core/SurfaceCore", "DirectFB Surface Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                   magic;
+
+     CoreSurfacePool      *local_pool;
+     CoreSurfacePool      *shared_pool;
+     CoreSurfacePool      *prealloc_pool;
+} DFBSurfaceCoreShared;
+
+typedef struct {
+     int                   magic;
+
+     CoreDFB              *core;
+
+     DFBSurfaceCoreShared *shared;
+} DFBSurfaceCore;
+
+
+DFB_CORE_PART( surface_core, SurfaceCore );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+dfb_surface_core_initialize( CoreDFB              *core,
+                             DFBSurfaceCore       *data,
+                             DFBSurfaceCoreShared *shared )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+     ret = dfb_surface_pool_initialize( core, &sharedSurfacePoolFuncs, &shared->shared_pool );
+     if (ret) {
+          D_DERROR( ret, "Core/Surface: Could not register 'shared' surface pool!\n" );
+          return ret;
+     }
+
+     ret = dfb_surface_pool_initialize( core, &localSurfacePoolFuncs, &shared->local_pool );
+     if (ret) {
+          D_DERROR( ret, "Core/Surface: Could not register 'local' surface pool!\n" );
+          dfb_surface_pool_destroy( shared->shared_pool );
+          return ret;
+     }
+
+     ret = dfb_surface_pool_initialize( core, &preallocSurfacePoolFuncs, &shared->prealloc_pool );
+     if (ret) {
+          D_DERROR( ret, "Core/Surface: Could not register 'prealloc' surface pool!\n" );
+          dfb_surface_pool_destroy( shared->local_pool );
+          dfb_surface_pool_destroy( shared->shared_pool );
+          return ret;
+     }
+
+     D_MAGIC_SET( data, DFBSurfaceCore );
+     D_MAGIC_SET( shared, DFBSurfaceCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_surface_core_join( CoreDFB              *core,
+                       DFBSurfaceCore       *data,
+                       DFBSurfaceCoreShared *shared )
+{
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBSurfaceCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+     dfb_surface_pool_join( core, shared->shared_pool, &sharedSurfacePoolFuncs );
+     dfb_surface_pool_join( core, shared->local_pool, &localSurfacePoolFuncs );
+     dfb_surface_pool_join( core, shared->prealloc_pool, &preallocSurfacePoolFuncs );
+
+     D_MAGIC_SET( data, DFBSurfaceCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_surface_core_shutdown( DFBSurfaceCore *data,
+                           bool            emergency )
+{
+     DFBSurfaceCoreShared *shared;
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBSurfaceCore );
+     D_MAGIC_ASSERT( data->shared, DFBSurfaceCoreShared );
+
+     shared = data->shared;
+
+     dfb_surface_pool_destroy( shared->prealloc_pool );
+     dfb_surface_pool_destroy( shared->local_pool );
+     dfb_surface_pool_destroy( shared->shared_pool );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_surface_core_leave( DFBSurfaceCore *data,
+                        bool            emergency )
+{
+     DFBSurfaceCoreShared *shared;
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBSurfaceCore );
+     D_MAGIC_ASSERT( data->shared, DFBSurfaceCoreShared );
+
+     shared = data->shared;
+
+     dfb_surface_pool_leave( shared->shared_pool );
+     dfb_surface_pool_leave( shared->local_pool );
+     dfb_surface_pool_leave( shared->prealloc_pool );
+
+     D_MAGIC_CLEAR( data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_surface_core_suspend( DFBSurfaceCore *data )
+{
+     DFBSurfaceCoreShared *shared;
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBSurfaceCore );
+     D_MAGIC_ASSERT( data->shared, DFBSurfaceCoreShared );
+
+     shared = data->shared;
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_surface_core_resume( DFBSurfaceCore *data )
+{
+     DFBSurfaceCoreShared *shared;
+
+     D_DEBUG_AT( Core_Surface, "dfb_surface_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBSurfaceCore );
+     D_MAGIC_ASSERT( data->shared, DFBSurfaceCoreShared );
+
+     shared = data->shared;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/surface_pool.c b/Source/DirectFB/src/core/surface_pool.c
new file mode 100755
index 0000000..0518df2
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_pool.c
@@ -0,0 +1,1263 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+
+D_DEBUG_DOMAIN( Core_SurfacePool,  "Core/SurfacePool",  "DirectFB Core Surface Pool" );
+D_DEBUG_DOMAIN( Core_SurfPoolLock, "Core/SurfPoolLock", "DirectFB Core Surface Pool Lock" );
+
+/**********************************************************************************************************************/
+
+static const SurfacePoolFuncs *pool_funcs[MAX_SURFACE_POOLS];
+static void                   *pool_locals[MAX_SURFACE_POOLS];
+static int                     pool_count;
+static CoreSurfacePool        *pool_array[MAX_SURFACE_POOLS];
+static unsigned int            pool_order[MAX_SURFACE_POOLS];
+
+/**********************************************************************************************************************/
+
+static inline const SurfacePoolFuncs *
+get_funcs( const CoreSurfacePool *pool )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_ASSERT( pool->pool_id >= 0 );
+     D_ASSERT( pool->pool_id < MAX_SURFACE_POOLS );
+     D_ASSERT( pool_funcs[pool->pool_id] != NULL );
+
+     /* Return function table of the pool. */
+     return pool_funcs[pool->pool_id];
+}
+
+static inline void *
+get_local( const CoreSurfacePool *pool )
+{
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_ASSERT( pool->pool_id >= 0 );
+     D_ASSERT( pool->pool_id < MAX_SURFACE_POOLS );
+
+     /* Return local data of the pool. */
+     return pool_locals[pool->pool_id];
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult init_pool( CoreDFB                *core,
+                            CoreSurfacePool        *pool,
+                            const SurfacePoolFuncs *funcs );
+
+/**********************************************************************************************************************/
+
+static void insert_pool_local( CoreSurfacePool   *pool );
+static void remove_pool_local( CoreSurfacePoolID  pool_id );
+
+/**********************************************************************************************************************/
+
+static void      remove_allocation( CoreSurfacePool       *pool,
+                                    CoreSurfaceBuffer     *buffer,
+                                    CoreSurfaceAllocation *allocation );
+
+static DFBResult backup_allocation( CoreSurfacePool       *pool,
+                                    CoreSurfaceBuffer     *buffer,
+                                    CoreSurfaceAllocation *allocation );
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_pool_initialize( CoreDFB                 *core,
+                             const SurfacePoolFuncs  *funcs,
+                             CoreSurfacePool        **ret_pool )
+{
+     DFBResult            ret;
+     CoreSurfacePool     *pool;
+     FusionSHMPoolShared *shmpool;
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p )\n", __FUNCTION__, funcs );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( ret_pool != NULL );
+
+     /* Check against pool limit. */
+     if (pool_count == MAX_SURFACE_POOLS) {
+          D_ERROR( "Core/SurfacePool: Maximum number of pools (%d) reached!\n", MAX_SURFACE_POOLS );
+          return DFB_LIMITEXCEEDED;
+     }
+
+     D_ASSERT( pool_funcs[pool_count] == NULL );
+
+     shmpool = dfb_core_shmpool( core );
+
+     /* Allocate pool structure. */
+     pool = SHCALLOC( shmpool, 1, sizeof(CoreSurfacePool) );
+     if (!pool)
+          return D_OOSHM();
+
+     /* Assign a pool ID. */
+     pool->pool_id = pool_count++;
+
+     /* Remember shared memory pool. */
+     pool->shmpool = shmpool;
+
+     /* Set function table of the pool. */
+     pool_funcs[pool->pool_id] = funcs;
+
+     /* Add to global pool list. */
+     pool_array[pool->pool_id] = pool;
+
+     D_MAGIC_SET( pool, CoreSurfacePool );
+
+     ret = init_pool( core, pool, funcs );
+     if (ret) {
+          pool_funcs[pool->pool_id] = NULL;
+          pool_array[pool->pool_id] = NULL;
+          pool_count--;
+          D_MAGIC_CLEAR( pool );
+          SHFREE( shmpool, pool );
+          return ret;
+     }
+
+     /* Set default backup pool being the shared memory surface pool */
+     if (!pool->backup && pool_count > 1)
+          pool->backup = pool_array[0];
+
+     /* Insert new pool into priority order */
+     insert_pool_local( pool );
+
+     /* Return the new pool. */
+     *ret_pool = pool;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_join( CoreDFB                *core,
+                       CoreSurfacePool        *pool,
+                       const SurfacePoolFuncs *funcs )
+{
+     DFBResult ret;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, funcs );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( funcs != NULL );
+
+     D_ASSERT( pool->pool_id < MAX_SURFACE_POOLS );
+     D_ASSERT( pool->pool_id == pool_count );
+     D_ASSERT( pool_funcs[pool->pool_id] == NULL );
+
+     /* Enforce same order as initialization to be used during join. */
+     if (pool->pool_id != pool_count) {
+          D_ERROR( "Core/SurfacePool: Wrong order of joining pools, got %d, should be %d!\n",
+                   pool->pool_id, pool_count );
+          return DFB_BUG;
+     }
+
+     /* Allocate local pool data. */
+     if (pool->pool_local_data_size &&
+         !(pool_locals[pool->pool_id] = D_CALLOC( 1, pool->pool_local_data_size )))
+         return D_OOM();
+
+     /* Set function table of the pool. */
+     pool_funcs[pool->pool_id] = funcs;
+
+     /* Add to global pool list. */
+     pool_array[pool->pool_id] = pool;
+
+     /* Adjust pool count. */
+     if (pool_count < pool->pool_id + 1)
+          pool_count = pool->pool_id + 1;
+
+     funcs = get_funcs( pool );
+
+     if (funcs->JoinPool) {
+          ret = funcs->JoinPool( core, pool, pool->data, get_local(pool), dfb_system_data() );
+          if (ret) {
+               D_DERROR( ret, "Core/SurfacePool: Joining '%s' failed!\n", pool->desc.name );
+
+               if (pool_locals[pool->pool_id]) {
+                    D_FREE( pool_locals[pool->pool_id] );
+                    pool_locals[pool->pool_id] = NULL;
+               }
+
+               pool_count--;
+
+               return ret;
+          }
+     }
+
+     /* Insert new pool into priority order */
+     insert_pool_local( pool );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_destroy( CoreSurfacePool *pool )
+{
+     CoreSurfacePoolID       pool_id;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     pool_id = pool->pool_id;
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, '%s' [%d] )\n", __FUNCTION__, pool, pool->desc.name, pool_id );
+
+     D_ASSERT( pool->pool_id >= 0 );
+     D_ASSERT( pool_id < MAX_SURFACE_POOLS );
+     D_ASSERT( pool_array[pool_id] == pool );
+
+     funcs = get_funcs( pool );
+
+     if (funcs->DestroyPool)
+          funcs->DestroyPool( pool, pool->data, get_local(pool) );
+
+     /* Free shared pool data. */
+     if (pool->data)
+          SHFREE( pool->shmpool, pool->data );
+
+     /* Free local pool data and remove from lists */
+     remove_pool_local( pool_id );
+
+     fusion_skirmish_destroy( &pool->lock );
+
+     fusion_vector_destroy( &pool->allocs );
+
+     D_MAGIC_CLEAR( pool );
+
+     SHFREE( pool->shmpool, pool );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_leave( CoreSurfacePool *pool )
+{
+     CoreSurfacePoolID       pool_id;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     pool_id = pool->pool_id;
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, '%s' [%d] )\n", __FUNCTION__, pool, pool->desc.name, pool_id );
+
+     D_ASSERT( pool->pool_id >= 0 );
+     D_ASSERT( pool_id < MAX_SURFACE_POOLS );
+     D_ASSERT( pool_array[pool_id] == pool );
+
+     funcs = get_funcs( pool );
+
+     if (funcs->LeavePool)
+          funcs->LeavePool( pool, pool->data, get_local(pool) );
+
+     /* Free local pool data and remove from lists */
+     remove_pool_local( pool_id );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_pools_negotiate( CoreSurfaceBuffer       *buffer,
+                             CoreSurfaceAccessorID    accessor,
+                             CoreSurfaceAccessFlags   access,
+                             CoreSurfacePool        **ret_pools,
+                             unsigned int             max_pools,
+                             unsigned int            *ret_num )
+{
+     DFBResult             ret;
+     int                   i;
+     unsigned int          num = 0;
+     CoreSurface          *surface;
+     CoreSurfaceTypeFlags  type;
+     unsigned int          free_count = 0;
+     CoreSurfacePool      *free_pools[pool_count];
+     unsigned int          oom_count = 0;
+     CoreSurfacePool      *oom_pools[pool_count];
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p [%s], 0x%02x, 0x%02x, max %d )\n", __FUNCTION__,
+                 buffer, dfb_pixelformat_name( buffer->format ), accessor, access, max_pools );
+
+     D_ASSERT( ret_pools != NULL );
+     D_ASSERT( max_pools > 0 );
+     D_ASSERT( ret_num != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     D_ASSERT( accessor >= CSAID_CPU );
+     D_ASSUME( accessor < _CSAID_NUM );
+     if (accessor >= CSAID_ANY) {
+          D_UNIMPLEMENTED();
+          return DFB_UNIMPLEMENTED;
+     }
+
+     if (accessor < 0 || accessor >= _CSAID_NUM)
+          return DFB_INVARG;
+
+     type = surface->type & ~(CSTF_INTERNAL | CSTF_EXTERNAL);
+
+     switch (buffer->policy) {
+          case CSP_SYSTEMONLY:
+               type |= CSTF_INTERNAL;
+               break;
+
+          case CSP_VIDEOONLY:
+               type |= CSTF_EXTERNAL;
+               break;
+
+          default:
+               break;
+     }
+
+     D_DEBUG_AT( Core_SurfacePool, "  ->     0x%02x 0x%03x required\n", access, type );
+
+     for (i=0; i<pool_count; i++) {
+          CoreSurfacePool *pool;
+
+          D_ASSERT( pool_order[i] >= 0 );
+          D_ASSERT( pool_order[i] < pool_count );
+
+          pool = pool_array[pool_order[i]];
+          D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+          if (D_FLAGS_ARE_SET( pool->desc.access[accessor], access ) &&
+              D_FLAGS_ARE_SET( pool->desc.types, type ))
+          {
+               const SurfacePoolFuncs *funcs;
+
+               D_DEBUG_AT( Core_SurfacePool, "  -> [%d] 0x%02x 0x%03x (%d) [%s]\n", pool->pool_id,
+                           pool->desc.caps, pool->desc.types, pool->desc.priority, pool->desc.name );
+
+               funcs = get_funcs( pool );
+
+               ret = funcs->TestConfig ? funcs->TestConfig( pool, pool->data, get_local(pool),
+                                                            buffer, &surface->config ) : DFB_OK;
+               switch (ret) {
+                    case DFB_OK:
+                         D_DEBUG_AT( Core_SurfacePool, "    => OK\n" );
+                         free_pools[free_count++] = pool;
+                         break;
+
+                    case DFB_NOVIDEOMEMORY:
+                         D_DEBUG_AT( Core_SurfacePool, "    => OUT OF MEMORY\n" );
+                         oom_pools[oom_count++] = pool;
+                         break;
+
+                    default:
+                         continue;
+               }
+          }
+     }
+
+     D_DEBUG_AT( Core_SurfacePool, "  => %d pools available\n", free_count );
+     D_DEBUG_AT( Core_SurfacePool, "  => %d pools out of memory\n", oom_count );
+
+     for (i=0; i<free_count && num<max_pools; i++)
+          ret_pools[num++] = free_pools[i];
+
+     for (i=0; i<oom_count && num<max_pools; i++)
+          ret_pools[num++] = oom_pools[i];
+
+     *ret_num = num;
+
+     return free_count ? DFB_OK : oom_count ? DFB_NOVIDEOMEMORY : DFB_UNSUPPORTED;
+}
+
+DFBResult
+dfb_surface_pools_enumerate( CoreSurfacePoolCallback  callback,
+                             void                    *ctx )
+{
+     int i;
+
+     D_ASSERT( callback != NULL );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, %p )\n", __FUNCTION__, callback, ctx );
+
+     for (i=0; i<pool_count; i++) {
+          CoreSurfacePool *pool = pool_array[i];
+
+          D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+          if (callback( pool, ctx ) == DFENUM_CANCEL)
+               break;
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pools_allocate( CoreSurfaceBuffer       *buffer,
+                            CoreSurfaceAccessorID    accessor,
+                            CoreSurfaceAccessFlags   access,
+                            CoreSurfaceAllocation  **ret_allocation )
+{
+     DFBResult              ret;
+     int                    i;
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation = NULL;
+     CoreSurfacePool       *pools[pool_count];
+     unsigned int           num_pools;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_FLAGS_ASSERT( access, CSAF_ALL );
+     D_ASSERT( ret_allocation != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, 0x%x )\n", __FUNCTION__, buffer, access );
+
+     D_DEBUG_AT( Core_SurfacePool, " -> %dx%d %s - %s%s%s%s%s%s%s%s\n",
+                 surface->config.size.w, surface->config.size.h,
+                 dfb_pixelformat_name( surface->config.format ),
+                 (surface->type & CSTF_SHARED)       ? "SHARED"        : "PRIVATE",
+                 (surface->type & CSTF_LAYER)        ? " LAYER"        : "",
+                 (surface->type & CSTF_WINDOW)       ? " WINDOW"       : "",
+                 (surface->type & CSTF_CURSOR)       ? " CURSOR"       : "",
+                 (surface->type & CSTF_FONT)         ? " FONT"         : "",
+                 (surface->type & CSTF_INTERNAL)     ? " INTERNAL"     : "",
+                 (surface->type & CSTF_EXTERNAL)     ? " EXTERNAL"     : "",
+                 (surface->type & CSTF_PREALLOCATED) ? " PREALLOCATED" : "" );
+
+     D_ASSERT( accessor >= CSAID_CPU );
+     D_ASSUME( accessor < _CSAID_NUM );
+     if (accessor >= CSAID_ANY) {
+          D_UNIMPLEMENTED();
+          return DFB_UNIMPLEMENTED;
+     }
+
+     if (accessor < 0 || accessor >= _CSAID_NUM)
+          return DFB_INVARG;
+
+     /* Build a list of possible pools being free or out of memory */
+     ret = dfb_surface_pools_negotiate( buffer, accessor, access, pools, pool_count, &num_pools );
+     if (ret && ret != DFB_NOVIDEOMEMORY) {
+          D_DEBUG_AT( Core_SurfacePool, "  -> NEGOTIATION FAILED! (%s)\n", DirectFBErrorString( ret ) );
+          return ret;
+     }
+
+     /* Try to do the allocation in one of the pools */
+     for (i=0; i<num_pools; i++) {
+          CoreSurfacePool *pool = pools[i];
+
+          D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+          ret = dfb_surface_pool_allocate( pool, buffer, &allocation );
+
+          if (ret == DFB_OK)
+               break;
+
+          /* When an error other than out of memory happens... */
+          if (ret != DFB_NOVIDEOMEMORY) {
+               D_DEBUG_AT( Core_SurfacePool, "  -> Allocation in '%s' failed!\n", pool->desc.name );
+
+               /* ...forget about the pool for now */
+               pools[i] = NULL;
+          }
+     }
+
+     /* Check if none of the pools could do the allocation */
+     if (!allocation) {
+          /* Try to find a pool with "older" allocations to muck out */
+          for (i=0; i<num_pools; i++) {
+               CoreSurfacePool *pool = pools[i];
+
+               /* Pools with non-oom errors were sorted out above */
+               if (!pool)
+                    continue;
+
+               D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+               ret = dfb_surface_pool_displace( pool, buffer, &allocation );
+
+               if (ret == DFB_OK)
+                    break;
+          }
+     }
+
+     /* Still no luck? */
+     if (!allocation) {
+          D_DEBUG_AT( Core_SurfacePool, "  -> FAILED!\n" );
+          return DFB_FAILURE;
+     }
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     D_DEBUG_AT( Core_SurfacePool, "  -> %p\n", allocation );
+
+     *ret_allocation = allocation;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_pool_allocate( CoreSurfacePool        *pool,
+                           CoreSurfaceBuffer      *buffer,
+                           CoreSurfaceAllocation **ret_allocation )
+{
+     DFBResult               ret;
+     int                     i;
+     CoreSurface            *surface;
+     CoreSurfaceAllocation  *allocation = NULL;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, buffer );
+
+     D_ASSERT( ret_allocation != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     funcs = get_funcs( pool );
+
+     D_ASSERT( funcs->AllocateBuffer != NULL );
+
+     allocation = SHCALLOC( pool->shmpool, 1, sizeof(CoreSurfaceAllocation) );
+     if (!allocation)
+          return D_OOSHM();
+
+     allocation->buffer  = buffer;
+     allocation->surface = surface;
+     allocation->pool    = pool;
+     allocation->access  = pool->desc.access;
+
+     if (pool->alloc_data_size) {
+          allocation->data = SHCALLOC( pool->shmpool, 1, pool->alloc_data_size );
+          if (!allocation->data) {
+               ret = D_OOSHM();
+               goto error;
+          }
+     }
+
+     D_MAGIC_SET( allocation, CoreSurfaceAllocation );
+
+     if (fusion_skirmish_prevail( &pool->lock )) {
+          ret = DFB_FUSION;
+          goto error;
+     }
+
+     if (dfb_config->warn.flags & DCWF_ALLOCATE_BUFFER &&
+         dfb_config->warn.allocate_buffer.min_size.w <= surface->config.size.w &&
+         dfb_config->warn.allocate_buffer.min_size.h <= surface->config.size.h)
+          D_WARN( "allocate-buffer %4dx%4d %6s, surface-caps 0x%08x",
+                  surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(buffer->format),
+                  surface->config.caps );
+
+     ret = funcs->AllocateBuffer( pool, pool->data, get_local(pool), buffer, allocation, allocation->data );
+     if (ret) {
+          D_DEBUG_AT( Core_SurfacePool, "  -> %s\n", DirectFBErrorString( ret ) );
+          D_MAGIC_CLEAR( allocation );
+          fusion_skirmish_dismiss( &pool->lock );
+          goto error;
+     }
+
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+
+     if (allocation->flags & CSALF_ONEFORALL) {
+          for (i=0; i<surface->num_buffers; i++) {
+               buffer = surface->buffers[i];
+
+               D_ASSUME( fusion_vector_is_empty( &buffer->allocs ) );
+
+               D_DEBUG_AT( Core_SurfacePool, "  -> %p (%d)\n", allocation, i );
+               fusion_vector_add( &buffer->allocs, allocation );
+               fusion_vector_add( &pool->allocs, allocation );
+          }
+     }
+     else {
+          D_DEBUG_AT( Core_SurfacePool, "  -> %p\n", allocation );
+          fusion_vector_add( &buffer->allocs, allocation );
+          fusion_vector_add( &pool->allocs, allocation );
+     }
+
+     direct_serial_init( &allocation->serial );
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     *ret_allocation = allocation;
+
+     return DFB_OK;
+
+error:
+     if (allocation->data)
+          SHFREE( pool->shmpool, allocation->data );
+
+     SHFREE( pool->shmpool, allocation );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_pool_deallocate( CoreSurfacePool       *pool,
+                             CoreSurfaceAllocation *allocation )
+{
+     DFBResult               ret;
+     int                     i;
+     const SurfacePoolFuncs *funcs;
+     CoreSurfaceBuffer      *buffer;
+     CoreSurface            *surface;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, allocation );
+
+     D_ASSERT( pool == allocation->pool );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     funcs = get_funcs( pool );
+
+     D_ASSERT( funcs->DeallocateBuffer != NULL );
+
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return DFB_FUSION;
+
+     ret = funcs->DeallocateBuffer( pool, pool->data, get_local(pool), allocation->buffer, allocation, allocation->data );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfacePool: Could not deallocate buffer!\n" );
+          fusion_skirmish_dismiss( &pool->lock );
+          return ret;
+     }
+
+     if (allocation->flags & CSALF_ONEFORALL) {
+          for (i=0; i<surface->num_buffers; i++)
+               remove_allocation( pool, surface->buffers[i], allocation );
+     }
+     else
+          remove_allocation( pool, buffer, allocation );
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     if (allocation->data)
+          SHFREE( pool->shmpool, allocation->data );
+
+     direct_serial_deinit( &allocation->serial );
+
+     D_MAGIC_CLEAR( allocation );
+
+     SHFREE( pool->shmpool, allocation );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_displace( CoreSurfacePool        *pool,
+                           CoreSurfaceBuffer      *buffer,
+                           CoreSurfaceAllocation **ret_allocation )
+{
+     DFBResult               ret, ret_lock = DFB_OK;
+     int                     i, retries = 3;
+     CoreSurface            *surface;
+     CoreSurfaceAllocation  *allocation;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, buffer );
+
+     D_ASSERT( ret_allocation != NULL );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     funcs = get_funcs( pool );
+
+     if (fusion_skirmish_prevail( &pool->lock ))
+          return DFB_FUSION;
+
+     /* Check for integrated method to muck out "older" allocations for a new one */
+     if (funcs->MuckOut) {
+          ret = funcs->MuckOut( pool, pool->data, get_local(pool), buffer );
+          if (ret) {
+               fusion_skirmish_dismiss( &pool->lock );
+               return ret;
+          }
+     }
+     else {
+          /* Or take the generic approach via allocation list */
+          D_UNIMPLEMENTED();
+     }
+
+     /* FIXME: Solve potential dead lock, until then do a few retries... */
+fixme_retry:
+     fusion_vector_foreach (allocation, i, pool->allocs) {
+          CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+          if (allocation->flags & CSALF_MUCKOUT) {
+               CoreSurface       *alloc_surface;
+               CoreSurfaceBuffer *alloc_buffer;
+
+               alloc_buffer = allocation->buffer;
+               D_MAGIC_ASSERT( alloc_buffer, CoreSurfaceBuffer );
+
+               alloc_surface = alloc_buffer->surface;
+               D_MAGIC_ASSERT( alloc_surface, CoreSurface );
+
+               D_DEBUG_AT( Core_SurfacePool, "  <= %p %5dk, %lu\n",
+                           allocation, allocation->size / 1024, allocation->offset );
+
+               /* FIXME: Solve potential dead lock, until then only try to lock... */
+               ret = dfb_surface_trylock( alloc_surface );
+               if (ret) {
+                    D_WARN( "could not lock surface (%s)", DirectFBErrorString(ret) );
+                    ret_lock = ret;
+                    continue;
+               }
+
+               /* Ensure mucked out allocation is backed up in another pool */
+               ret = backup_allocation( pool, buffer, allocation );
+               if (ret) {
+                    D_WARN( "could not backup allocation (%s)", DirectFBErrorString(ret) );
+                    dfb_surface_unlock( alloc_surface );
+                    goto error_cleanup;
+               }
+
+               /* Deallocate mucked out allocation */
+               dfb_surface_pool_deallocate( pool, allocation );
+               i--;
+
+               dfb_surface_unlock( alloc_surface );
+          }
+     }
+
+     /* FIXME: Solve potential dead lock, until then do a few retries... */
+     if (ret_lock) {
+          if (retries--)
+               goto fixme_retry;
+
+          ret = DFB_LOCKED;
+
+          goto error_cleanup;
+     }
+     else
+          ret = dfb_surface_pool_allocate( pool, buffer, ret_allocation );
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return ret;
+
+
+error_cleanup:
+     fusion_vector_foreach (allocation, i, pool->allocs) {
+          CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+          if (allocation->flags & CSALF_MUCKOUT)
+               allocation->flags &= ~CSALF_MUCKOUT;
+     }
+
+     fusion_skirmish_dismiss( &pool->lock );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_pool_lock( CoreSurfacePool       *pool,
+                       CoreSurfaceAllocation *allocation,
+                       CoreSurfaceBufferLock *lock )
+{
+     DFBResult               ret;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_DEBUG_AT( Core_SurfPoolLock, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, allocation );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     CORE_SURFACE_BUFFER_LOCK_ASSERT( lock );
+     D_ASSERT( lock->buffer == NULL );
+
+     D_ASSERT( pool == allocation->pool );
+
+     funcs = get_funcs( pool );
+
+     D_ASSERT( funcs->Lock != NULL );
+
+     lock->allocation = allocation;
+     lock->buffer     = allocation->buffer;
+
+     ret = funcs->Lock( pool, pool->data, get_local(pool), allocation, allocation->data, lock );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfacePool: Could not lock allocation!\n" );
+          dfb_surface_buffer_lock_reset( lock );
+          return ret;
+     }
+
+     CORE_SURFACE_BUFFER_LOCK_ASSERT( lock );
+     D_ASSERT( lock->buffer != NULL );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_unlock( CoreSurfacePool       *pool,
+                         CoreSurfaceAllocation *allocation,
+                         CoreSurfaceBufferLock *lock )
+{
+     DFBResult               ret;
+     const SurfacePoolFuncs *funcs;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_DEBUG_AT( Core_SurfPoolLock, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, allocation );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     CORE_SURFACE_BUFFER_LOCK_ASSERT( lock );
+     D_ASSERT( lock->buffer != NULL );
+
+     D_ASSERT( pool == allocation->pool );
+
+     funcs = get_funcs( pool );
+
+     D_ASSERT( funcs->Unlock != NULL );
+
+     ret = funcs->Unlock( pool, pool->data, get_local(pool), allocation, allocation->data, lock );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfacePool: Could not unlock allocation!\n" );
+          return ret;
+     }
+
+     CORE_SURFACE_BUFFER_LOCK_ASSERT( lock );
+     D_ASSERT( lock->buffer != NULL );
+
+     dfb_surface_buffer_lock_reset( lock );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_read( CoreSurfacePool       *pool,
+                       CoreSurfaceAllocation *allocation,
+                       void                  *data,
+                       int                    pitch,
+                       const DFBRectangle    *rect )
+{
+     DFBResult               ret;
+     const SurfacePoolFuncs *funcs;
+     CoreSurface            *surface;
+     DFBRectangle            area;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_DEBUG_AT( Core_SurfPoolLock, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, allocation );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     D_ASSERT( data != NULL );
+     D_ASSERT( pitch >= 0 );
+     DFB_RECTANGLE_ASSERT_IF( rect );
+
+     D_ASSERT( pool == allocation->pool );
+
+     funcs = get_funcs( pool );
+     D_ASSERT( funcs != NULL );
+
+     if (!funcs->Read)
+          return DFB_UNSUPPORTED;
+
+     surface = allocation->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     area.x = 0;
+     area.y = 0;
+     area.w = surface->config.size.w;
+     area.h = surface->config.size.h;
+
+     if (rect && !dfb_rectangle_intersect( &area, rect ))
+          return DFB_INVAREA;
+
+     ret = funcs->Read( pool, pool->data, get_local(pool), allocation, allocation->data, data, pitch, &area );
+     if (ret)
+          D_DERROR( ret, "Core/SurfacePool: Could not read from allocation!\n" );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_pool_write( CoreSurfacePool       *pool,
+                        CoreSurfaceAllocation *allocation,
+                        const void            *data,
+                        int                    pitch,
+                        const DFBRectangle    *rect )
+{
+     DFBResult               ret;
+     const SurfacePoolFuncs *funcs;
+     CoreSurface            *surface;
+     DFBRectangle            area;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     D_DEBUG_AT( Core_SurfPoolLock, "%s( %p [%d], %p )\n", __FUNCTION__, pool, pool->pool_id, allocation );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     D_ASSERT( data != NULL );
+     D_ASSERT( pitch >= 0 );
+     DFB_RECTANGLE_ASSERT_IF( rect );
+
+     D_ASSERT( pool == allocation->pool );
+
+     funcs = get_funcs( pool );
+     D_ASSERT( funcs != NULL );
+
+     if (!funcs->Write)
+          return DFB_UNSUPPORTED;
+
+     surface = allocation->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     area.x = 0;
+     area.y = 0;
+     area.w = surface->config.size.w;
+     area.h = surface->config.size.h;
+
+     if (rect && !dfb_rectangle_intersect( &area, rect ))
+          return DFB_INVAREA;
+
+     ret = funcs->Write( pool, pool->data, get_local(pool), allocation, allocation->data, data, pitch, &area );
+     if (ret)
+          D_DERROR( ret, "Core/SurfacePool: Could not write to allocation!\n" );
+
+     return ret;
+}
+
+DFBResult
+dfb_surface_pool_enumerate ( CoreSurfacePool          *pool,
+                             CoreSurfaceAllocCallback  callback,
+                             void                     *ctx )
+{
+     int                    i;
+     CoreSurfaceAllocation *allocation;
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, %p, %p )\n", __FUNCTION__, pool, callback, ctx );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( callback != NULL );
+
+     fusion_vector_foreach (allocation, i, pool->allocs) {
+          if (callback( allocation, ctx ) == DFENUM_CANCEL)
+               break;
+     }
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+init_pool( CoreDFB                *core,
+           CoreSurfacePool        *pool,
+           const SurfacePoolFuncs *funcs )
+{
+     DFBResult ret;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( funcs->InitPool != NULL );
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, %p )\n", __FUNCTION__, pool, funcs );
+
+     if (funcs->PoolDataSize)
+          pool->pool_data_size = funcs->PoolDataSize();
+
+     if (funcs->PoolLocalDataSize)
+          pool->pool_local_data_size = funcs->PoolLocalDataSize();
+
+     if (funcs->AllocationDataSize)
+          pool->alloc_data_size = funcs->AllocationDataSize();
+
+     /* Allocate shared pool data. */
+     if (pool->pool_data_size) {
+          pool->data = SHCALLOC( pool->shmpool, 1, pool->pool_data_size );
+          if (!pool->data)
+               return D_OOSHM();
+     }
+
+     /* Allocate local pool data. */
+     if (pool->pool_local_data_size &&
+         !(pool_locals[pool->pool_id] = D_CALLOC( 1, pool->pool_local_data_size )))
+     {
+          SHFREE( pool->shmpool, pool->data );
+          return D_OOM();
+     }
+
+     fusion_vector_init( &pool->allocs, 4, pool->shmpool );
+
+     ret = funcs->InitPool( core, pool, pool->data, get_local(pool), dfb_system_data(), &pool->desc );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfacePool: Initializing '%s' failed!\n", pool->desc.name );
+
+          if (pool_locals[pool->pool_id]) {
+               D_FREE( pool_locals[pool->pool_id] );
+               pool_locals[pool->pool_id] = NULL;
+          }
+          if (pool->data) {
+               SHFREE( pool->shmpool, pool->data );
+               pool->data = NULL;
+          }
+          return ret;
+     }
+
+     fusion_skirmish_init( &pool->lock, pool->desc.name, dfb_core_world(core) );
+
+     return DFB_OK;
+}
+
+static void
+insert_pool_local( CoreSurfacePool *pool )
+{
+     int i, n;
+
+     for (i=0; i<pool_count-1; i++) {
+          D_ASSERT( pool_order[i] >= 0 );
+          D_ASSERT( pool_order[i] < pool_count-1 );
+
+          D_MAGIC_ASSERT( pool_array[pool_order[i]], CoreSurfacePool );
+
+          if (pool_array[pool_order[i]]->desc.priority < pool->desc.priority)
+               break;
+     }
+
+     for (n=pool_count-1; n>i; n--) {
+          D_ASSERT( pool_order[n-1] >= 0 );
+          D_ASSERT( pool_order[n-1] < pool_count-1 );
+
+          D_MAGIC_ASSERT( pool_array[pool_order[n-1]], CoreSurfacePool );
+
+          pool_order[n] = pool_order[n-1];
+     }
+
+     pool_order[n] = pool_count - 1;
+
+#if D_DEBUG_ENABLED
+     for (i=0; i<pool_count; i++) {
+          D_DEBUG_AT( Core_SurfacePool, "  %c> [%d] %p - '%s' [%d] (%d), %p\n",
+                      (i == n) ? '=' : '-', i, pool_array[pool_order[i]], pool_array[pool_order[i]]->desc.name,
+                      pool_array[pool_order[i]]->pool_id, pool_array[pool_order[i]]->desc.priority,
+                      pool_funcs[pool_order[i]] );
+          D_ASSERT( pool_order[i] == pool_array[pool_order[i]]->pool_id );
+     }
+#endif
+}
+
+static void
+remove_pool_local( CoreSurfacePoolID pool_id )
+{
+     int i;
+
+     /* Free local pool data. */
+     if (pool_locals[pool_id]) {
+          D_FREE( pool_locals[pool_id] );
+          pool_locals[pool_id] = NULL;
+     }
+
+     /* Erase entries of the pool. */
+     pool_array[pool_id] = NULL;
+     pool_funcs[pool_id] = NULL;
+
+     while (pool_count > 0 && !pool_array[pool_count-1]) {
+          pool_count--;
+
+          for (i=0; i<pool_count; i++) {
+               if (pool_order[i] == pool_count) {
+                    direct_memmove( &pool_order[i], &pool_order[i+1], sizeof(pool_order[0]) * (pool_count - i) );
+                    break;
+               }
+          }
+     }
+}
+
+/**********************************************************************************************************************/
+
+static void
+remove_allocation( CoreSurfacePool       *pool,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation )
+{
+     int index_buffer;
+     int index_pool;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &buffer->surface->lock );
+     FUSION_SKIRMISH_ASSERT( &pool->lock );
+     D_ASSERT( pool == allocation->pool );
+
+     /* Lookup indices within vectors */
+     index_buffer = fusion_vector_index_of( &buffer->allocs, allocation );
+     index_pool   = fusion_vector_index_of( &pool->allocs,   allocation );
+
+     D_ASSERT( index_buffer >= 0 );
+     D_ASSERT( index_pool >= 0 );
+
+     /* Remove allocation from buffer and pool */
+     fusion_vector_remove( &buffer->allocs, index_buffer );
+     fusion_vector_remove( &pool->allocs,   index_pool );
+
+     /* Update 'written' allocation pointer of buffer */
+     if (buffer->written == allocation) {
+          /* Reset pointer first */
+          buffer->written = NULL;
+
+          /* Iterate through remaining allocations */
+          fusion_vector_foreach (allocation, index_buffer, buffer->allocs) {
+               CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+               /* Check if allocation is up to date and set it as 'written' allocation */
+               if (direct_serial_check( &allocation->serial, &buffer->serial )) {
+                    buffer->written = allocation;
+                    break;
+               }
+          }
+     }
+
+     /* Reset 'read' allocation pointer of buffer */
+     if (buffer->read == allocation)
+          buffer->read = NULL;
+}
+
+static DFBResult
+backup_allocation( CoreSurfacePool       *pool,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation )
+{
+     DFBResult              ret = DFB_OK;
+     int                    i;
+     CoreSurfaceAllocation *backup = NULL;
+
+     D_DEBUG_AT( Core_SurfacePool, "%s( %p, %p )\n", __FUNCTION__, pool, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &buffer->surface->lock );
+     FUSION_SKIRMISH_ASSERT( &pool->lock );
+     D_ASSERT( pool == allocation->pool );
+
+     /* Check if allocation is the only up to date (requiring a backup) */
+     if (direct_serial_check( &allocation->serial, &buffer->serial )) {
+          CoreSurfacePool *backup_pool = pool->backup;
+
+          /* First check if any of the existing allocations is up to date */
+          fusion_vector_foreach (backup, i, buffer->allocs) {
+               D_MAGIC_ASSERT( backup, CoreSurfaceAllocation );
+               D_MAGIC_ASSERT( backup->pool, CoreSurfacePool );
+
+               if (backup->pool != pool && direct_serial_check( &backup->serial, &buffer->serial )) {
+                    D_DEBUG_AT( Core_SurfacePool, "  -> up to date in '%s'\n", backup->pool->desc.name );
+                    return DFB_OK;
+               }
+          }
+
+          /* Try to update one of the existing allocations */
+          fusion_vector_foreach (backup, i, buffer->allocs) {
+               D_MAGIC_ASSERT( backup, CoreSurfaceAllocation );
+               D_MAGIC_ASSERT( backup->pool, CoreSurfacePool );
+
+               if (backup->pool != pool && dfb_surface_allocation_update( backup, CSAF_NONE ) == DFB_OK) {
+                    D_DEBUG_AT( Core_SurfacePool, "  -> updated in '%s'\n", backup->pool->desc.name );
+                    return DFB_OK;
+               }
+          }
+
+          /* Try the designated backup pool and theirs if failing */
+          while (backup_pool) {
+               D_MAGIC_ASSERT( backup_pool, CoreSurfacePool );
+
+               D_DEBUG_AT( Core_SurfacePool, "  -> allocating in '%s'\n", backup_pool->desc.name );
+
+               /* Allocate in backup pool */
+               ret = dfb_surface_pool_allocate( backup_pool, buffer, &backup );
+               if (ret == DFB_OK) {
+                    /* Update new allocation */
+                    ret = dfb_surface_allocation_update( backup, CSAF_NONE );
+                    if (ret) {
+                         D_DEBUG_AT( Core_SurfacePool, "  -> update failed! (%s)\n", DirectFBErrorString(ret) );
+                         dfb_surface_pool_deallocate( backup_pool, backup );
+                         backup = NULL;
+                    }
+                    else
+                         return DFB_OK;
+               }
+               else
+                    D_DEBUG_AT( Core_SurfacePool, "  -> allocation failed! (%s)\n", DirectFBErrorString(ret) );
+
+               backup_pool = backup_pool->backup;
+          }
+     }
+     else
+          D_DEBUG_AT( Core_SurfacePool, "  -> not up to date anyhow\n" );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/src/core/surface_pool.h b/Source/DirectFB/src/core/surface_pool.h
new file mode 100755
index 0000000..fc049e0
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_pool.h
@@ -0,0 +1,272 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__SURFACE_POOL_H__
+#define __CORE__SURFACE_POOL_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+
+typedef enum {
+     CSPCAPS_NONE        = 0x00000000,
+
+     CSPCAPS_PHYSICAL    = 0x00000001,  /* pool provides physical address to buffer */
+     CSPCAPS_VIRTUAL     = 0x00000002,  /* pool provides virtual address to buffer */
+
+     CSPCAPS_ALL         = 0x00000003
+} CoreSurfacePoolCapabilities;
+
+typedef enum {
+     CSPP_DEFAULT,
+     CSPP_PREFERED,
+     CSPP_ULTIMATE
+} CoreSurfacePoolPriority;
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_SURFACE_POOL_ABI_VERSION           1
+
+#define DFB_SURFACE_POOL_DESC_NAME_LENGTH     44
+
+
+typedef struct {
+     CoreSurfacePoolCapabilities   caps;
+     CoreSurfaceAccessFlags        access[_CSAID_NUM];
+     CoreSurfaceTypeFlags          types;
+     CoreSurfacePoolPriority       priority;
+     char                          name[DFB_SURFACE_POOL_DESC_NAME_LENGTH];
+     unsigned long                 size;
+} CoreSurfacePoolDescription;
+
+
+typedef struct {
+     int       (*PoolDataSize)( void );
+     int       (*PoolLocalDataSize)( void );
+     int       (*AllocationDataSize)( void );
+
+     /*
+      * Pool init/destroy
+      */
+     DFBResult (*InitPool)   ( CoreDFB                    *core,
+                               CoreSurfacePool            *pool,
+                               void                       *pool_data,
+                               void                       *pool_local,
+                               void                       *system_data,
+                               CoreSurfacePoolDescription *ret_desc );
+
+     DFBResult (*JoinPool)   ( CoreDFB                    *core,
+                               CoreSurfacePool            *pool,
+                               void                       *pool_data,
+                               void                       *pool_local,
+                               void                       *system_data );
+
+     DFBResult (*DestroyPool)( CoreSurfacePool            *pool,
+                               void                       *pool_data,
+                               void                       *pool_local );
+
+     DFBResult (*LeavePool)  ( CoreSurfacePool            *pool,
+                               void                       *pool_data,
+                               void                       *pool_local );
+
+
+
+     DFBResult (*TestConfig) ( CoreSurfacePool            *pool,
+                               void                       *pool_data,
+                               void                       *pool_local,
+                               CoreSurfaceBuffer          *buffer,
+                               const CoreSurfaceConfig    *config );
+     /*
+      * Buffer management
+      */
+     DFBResult (*AllocateBuffer)  ( CoreSurfacePool       *pool,
+                                    void                  *pool_data,
+                                    void                  *pool_local,
+                                    CoreSurfaceBuffer     *buffer,
+                                    CoreSurfaceAllocation *allocation,
+                                    void                  *alloc_data );
+
+     DFBResult (*DeallocateBuffer)( CoreSurfacePool       *pool,
+                                    void                  *pool_data,
+                                    void                  *pool_local,
+                                    CoreSurfaceBuffer     *buffer,
+                                    CoreSurfaceAllocation *allocation,
+                                    void                  *alloc_data );
+
+     /*
+      * Locking
+      */
+     DFBResult (*Lock)  ( CoreSurfacePool       *pool,
+                          void                  *pool_data,
+                          void                  *pool_local,
+                          CoreSurfaceAllocation *allocation,
+                          void                  *alloc_data,
+                          CoreSurfaceBufferLock *lock );
+
+     DFBResult (*Unlock)( CoreSurfacePool       *pool,
+                          void                  *pool_data,
+                          void                  *pool_local,
+                          CoreSurfaceAllocation *allocation,
+                          void                  *alloc_data,
+                          CoreSurfaceBufferLock *lock );
+
+     /*
+      * Read/write
+      */
+     DFBResult (*Read)  ( CoreSurfacePool       *pool,
+                          void                  *pool_data,
+                          void                  *pool_local,
+                          CoreSurfaceAllocation *allocation,
+                          void                  *alloc_data,
+                          void                  *destination,
+                          int                    pitch,
+                          const DFBRectangle    *rect );
+
+     DFBResult (*Write) ( CoreSurfacePool       *pool,
+                          void                  *pool_data,
+                          void                  *pool_local,
+                          CoreSurfaceAllocation *allocation,
+                          void                  *alloc_data,
+                          const void            *source,
+                          int                    pitch,
+                          const DFBRectangle    *rect );
+
+     /*
+      * Muck out
+      */
+     DFBResult (*MuckOut) ( CoreSurfacePool        *pool,
+                            void                   *pool_data,
+                            void                   *pool_local,
+                            CoreSurfaceBuffer      *buffer );
+} SurfacePoolFuncs;
+
+
+struct __DFB_CoreSurfacePool {
+     int                         magic;
+
+     FusionSkirmish              lock;
+
+     CoreSurfacePoolID           pool_id;
+
+     CoreSurfacePoolDescription  desc;
+
+     int                         pool_data_size;
+     int                         pool_local_data_size;
+     int                         alloc_data_size;
+
+     void                       *data;
+
+     FusionVector                allocs;
+
+     FusionSHMPoolShared        *shmpool;
+
+     CoreSurfacePool            *backup;
+};
+
+
+typedef DFBEnumerationResult (*CoreSurfacePoolCallback)( CoreSurfacePool *pool,
+                                                         void            *ctx );
+
+typedef DFBEnumerationResult (*CoreSurfaceAllocCallback)( CoreSurfaceAllocation *allocation,
+                                                          void                  *ctx );
+
+
+
+DFBResult dfb_surface_pools_negotiate( CoreSurfaceBuffer       *buffer,
+                                       CoreSurfaceAccessorID    accessor,
+                                       CoreSurfaceAccessFlags   access,
+                                       CoreSurfacePool        **ret_pools,
+                                       unsigned int             max_pools,
+                                       unsigned int            *ret_num );
+
+DFBResult dfb_surface_pools_enumerate( CoreSurfacePoolCallback  callback,
+                                       void                    *ctx );
+
+DFBResult dfb_surface_pools_allocate ( CoreSurfaceBuffer       *buffer,
+                                       CoreSurfaceAccessorID    accessor,
+                                       CoreSurfaceAccessFlags   access,
+                                       CoreSurfaceAllocation  **ret_allocation );
+
+
+DFBResult dfb_surface_pool_initialize( CoreDFB                 *core,
+                                       const SurfacePoolFuncs  *funcs,
+                                       CoreSurfacePool        **ret_pool );
+
+DFBResult dfb_surface_pool_join      ( CoreDFB                 *core,
+                                       CoreSurfacePool         *pool,
+                                       const SurfacePoolFuncs  *funcs );
+
+DFBResult dfb_surface_pool_destroy   ( CoreSurfacePool         *pool );
+
+DFBResult dfb_surface_pool_leave     ( CoreSurfacePool         *pool );
+
+
+
+DFBResult dfb_surface_pool_allocate  ( CoreSurfacePool         *pool,
+                                       CoreSurfaceBuffer       *buffer,
+                                       CoreSurfaceAllocation  **ret_allocation );
+
+DFBResult dfb_surface_pool_deallocate( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocation   *allocation );
+
+DFBResult dfb_surface_pool_displace  ( CoreSurfacePool         *pool,
+                                       CoreSurfaceBuffer       *buffer,
+                                       CoreSurfaceAllocation  **ret_allocation );
+
+DFBResult dfb_surface_pool_lock      ( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocation   *allocation,
+                                       CoreSurfaceBufferLock   *lock );
+
+DFBResult dfb_surface_pool_unlock    ( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocation   *allocation,
+                                       CoreSurfaceBufferLock   *lock );
+
+DFBResult dfb_surface_pool_read      ( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocation   *allocation,
+                                       void                    *data,
+                                       int                      pitch,
+                                       const DFBRectangle      *rect );
+
+DFBResult dfb_surface_pool_write     ( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocation   *allocation,
+                                       const void              *data,
+                                       int                      pitch,
+                                       const DFBRectangle      *rect );
+
+DFBResult dfb_surface_pool_enumerate ( CoreSurfacePool         *pool,
+                                       CoreSurfaceAllocCallback  callback,
+                                       void                    *ctx );
+
+
+#endif
+
diff --git a/Source/DirectFB/src/core/surface_pool_bridge.c b/Source/DirectFB/src/core/surface_pool_bridge.c
new file mode 100755
index 0000000..244ca2d
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_pool_bridge.c
@@ -0,0 +1,531 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/surface_pool_bridge.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+
+D_DEBUG_DOMAIN( Core_SurfPoolBridge, "Core/SurfPoolBridge", "DirectFB Core Surface Pool Bridge" );
+
+/**********************************************************************************************************************/
+
+static const SurfacePoolBridgeFuncs *bridge_funcs[MAX_SURFACE_POOL_BRIDGES];
+static void                         *bridge_locals[MAX_SURFACE_POOL_BRIDGES];
+static int                           bridge_count;
+static CoreSurfacePoolBridge        *bridge_array[MAX_SURFACE_POOL_BRIDGES];
+
+/**********************************************************************************************************************/
+
+static inline const SurfacePoolBridgeFuncs *
+get_funcs( const CoreSurfacePoolBridge *bridge )
+{
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     D_ASSERT( bridge->bridge_id >= 0 );
+     D_ASSERT( bridge->bridge_id < MAX_SURFACE_POOL_BRIDGES );
+     D_ASSERT( bridge_funcs[bridge->bridge_id] != NULL );
+
+     /* Return function table of the bridge. */
+     return bridge_funcs[bridge->bridge_id];
+}
+
+static inline void *
+get_local( const CoreSurfacePoolBridge *bridge )
+{
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     D_ASSERT( bridge->bridge_id >= 0 );
+     D_ASSERT( bridge->bridge_id < MAX_SURFACE_POOL_BRIDGES );
+
+     /* Return local data of the bridge. */
+     return bridge_locals[bridge->bridge_id];
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult init_bridge( CoreDFB                      *core,
+                              CoreSurfacePoolBridge        *bridge,
+                              const SurfacePoolBridgeFuncs *funcs,
+                              void                         *context );
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_pool_bridge_initialize( CoreDFB                       *core,
+                                    const SurfacePoolBridgeFuncs  *funcs,
+                                    void                          *context,
+                                    CoreSurfacePoolBridge        **ret_bridge )
+{
+     DFBResult              ret;
+     CoreSurfacePoolBridge *bridge;
+     FusionSHMPoolShared   *shmpool;
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p, %p )\n", __FUNCTION__, funcs, context );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( ret_bridge != NULL );
+
+     /* Check against bridge limit. */
+     if (bridge_count == MAX_SURFACE_POOL_BRIDGES) {
+          D_ERROR( "Core/SurfacePoolBridge: Maximum number of bridges (%d) reached!\n", MAX_SURFACE_POOL_BRIDGES );
+          return DFB_LIMITEXCEEDED;
+     }
+
+     D_ASSERT( bridge_funcs[bridge_count] == NULL );
+
+     shmpool = dfb_core_shmpool( core );
+
+     /* Allocate bridge structure. */
+     bridge = SHCALLOC( shmpool, 1, sizeof(CoreSurfacePoolBridge) );
+     if (!bridge)
+          return D_OOSHM();
+
+     /* Assign a bridge ID. */
+     bridge->bridge_id = bridge_count++;
+
+     /* Remember shared memory pool. */
+     bridge->shmpool = shmpool;
+
+     /* Set function table of the bridge. */
+     bridge_funcs[bridge->bridge_id] = funcs;
+
+     /* Add to global bridge list. */
+     bridge_array[bridge->bridge_id] = bridge;
+
+     D_MAGIC_SET( bridge, CoreSurfacePoolBridge );
+
+     ret = init_bridge( core, bridge, funcs, context );
+     if (ret) {
+          bridge_count--;
+          D_MAGIC_CLEAR( bridge );
+          SHFREE( shmpool, bridge );
+          return ret;
+     }
+
+     /* Return the new bridge. */
+     *ret_bridge = bridge;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_bridge_join( CoreDFB                      *core,
+                              CoreSurfacePoolBridge        *bridge,
+                              const SurfacePoolBridgeFuncs *funcs,
+                              void                         *context )
+{
+     DFBResult ret;
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p [%d], %p, %p )\n", __FUNCTION__, bridge, bridge->bridge_id, funcs, context );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( funcs != NULL );
+
+     D_ASSERT( bridge->bridge_id < MAX_SURFACE_POOL_BRIDGES );
+     D_ASSERT( bridge->bridge_id == bridge_count );
+     D_ASSERT( bridge_funcs[bridge->bridge_id] == NULL );
+
+     /* Enforce same order as initialization to be used during join. */
+     if (bridge->bridge_id != bridge_count) {
+          D_ERROR( "Core/SurfacePoolBridge: Wrong order of joining bridges, got %d, should be %d!\n",
+                   bridge->bridge_id, bridge_count );
+          return DFB_BUG;
+     }
+
+     /* Allocate local bridge data. */
+     if (bridge->bridge_local_data_size &&
+         !(bridge_locals[bridge->bridge_id] = D_CALLOC( 1, bridge->bridge_local_data_size )))
+         return D_OOM();
+
+     /* Set function table of the bridge. */
+     bridge_funcs[bridge->bridge_id] = funcs;
+
+     /* Add to global bridge list. */
+     bridge_array[bridge->bridge_id] = bridge;
+
+     /* Adjust bridge count. */
+     if (bridge_count < bridge->bridge_id + 1)
+          bridge_count = bridge->bridge_id + 1;
+
+     funcs = get_funcs( bridge );
+
+     if (funcs->JoinPoolBridge) {
+          ret = funcs->JoinPoolBridge( core, bridge, bridge->data, get_local(bridge), context );
+          if (ret) {
+               D_DERROR( ret, "Core/SurfacePoolBridge: Joining '%s' failed!\n", bridge->desc.name );
+
+               if (bridge_locals[bridge->bridge_id]) {
+                    D_FREE( bridge_locals[bridge->bridge_id] );
+                    bridge_locals[bridge->bridge_id] = NULL;
+               }
+
+               bridge_array[bridge->bridge_id] = NULL;
+               bridge_funcs[bridge->bridge_id] = NULL;
+
+               bridge_count--;
+
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_bridge_destroy( CoreSurfacePoolBridge *bridge )
+{
+     CoreSurfacePoolBridgeID       bridge_id;
+     const SurfacePoolBridgeFuncs *funcs;
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     bridge_id = bridge->bridge_id;
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p, '%s' [%d] )\n", __FUNCTION__, bridge, bridge->desc.name, bridge_id );
+
+     D_ASSERT( bridge->bridge_id >= 0 );
+     D_ASSERT( bridge_id < MAX_SURFACE_POOL_BRIDGES );
+     D_ASSERT( bridge_array[bridge_id] == bridge );
+
+     funcs = get_funcs( bridge );
+
+     if (funcs->DestroyPoolBridge)
+          funcs->DestroyPoolBridge( bridge, bridge->data, get_local(bridge) );
+
+     /* Free shared bridge data. */
+     if (bridge->data)
+          SHFREE( bridge->shmpool, bridge->data );
+
+     /* Free local bridge data. */
+     if (bridge_locals[bridge_id])
+          D_FREE( bridge_locals[bridge_id] );
+
+     /* Remove from arrays. */
+     bridge_array[bridge_id]  = NULL;
+     bridge_funcs[bridge_id]  = NULL;
+     bridge_locals[bridge_id] = NULL;
+
+     fusion_skirmish_destroy( &bridge->lock );
+
+     D_MAGIC_CLEAR( bridge );
+
+     SHFREE( bridge->shmpool, bridge );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_surface_pool_bridge_leave( CoreSurfacePoolBridge *bridge )
+{
+     CoreSurfacePoolBridgeID       bridge_id;
+     const SurfacePoolBridgeFuncs *funcs;
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     bridge_id = bridge->bridge_id;
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p, '%s' [%d] )\n", __FUNCTION__, bridge, bridge->desc.name, bridge_id );
+
+     D_ASSERT( bridge->bridge_id >= 0 );
+     D_ASSERT( bridge_id < MAX_SURFACE_POOL_BRIDGES );
+     D_ASSERT( bridge_array[bridge_id] == bridge );
+
+     funcs = get_funcs( bridge );
+
+     if (funcs->LeavePoolBridge)
+          funcs->LeavePoolBridge( bridge, bridge->data, get_local(bridge) );
+
+     /* Free local bridge data. */
+     if (bridge_locals[bridge_id])
+          D_FREE( bridge_locals[bridge_id] );
+
+     /* Remove from arrays. */
+     bridge_array[bridge_id]  = NULL;
+     bridge_funcs[bridge_id]  = NULL;
+     bridge_locals[bridge_id] = NULL;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_surface_pool_bridges_enumerate( CoreSurfacePoolBridgeCallback  callback,
+                                    void                          *ctx )
+{
+     int i;
+
+     D_ASSERT( callback != NULL );
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p, %p )\n", __FUNCTION__, callback, ctx );
+
+     for (i=0; i<bridge_count; i++) {
+          CoreSurfacePoolBridge *bridge = bridge_array[i];
+
+          D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+          if (callback( bridge, ctx ) == DFENUM_CANCEL)
+               break;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+allocate_transfer( CoreSurfacePoolBridge    *bridge,
+                   CoreSurfaceBuffer        *buffer,
+                   CoreSurfaceAllocation    *from,
+                   CoreSurfaceAllocation    *to,
+                   const DFBRectangle       *rects,
+                   unsigned int              num_rects,
+                   CoreSurfacePoolTransfer **ret_transfer )
+{
+     CoreSurfacePoolTransfer *transfer;
+     unsigned int             alloc_size;
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     CORE_SURFACE_ALLOCATION_ASSERT( from );
+     CORE_SURFACE_ALLOCATION_ASSERT( to );
+     D_ASSERT( rects != NULL );
+     D_ASSERT( num_rects > 0 );
+     D_ASSERT( ret_transfer != NULL );
+
+     alloc_size = sizeof(CoreSurfacePoolTransfer) + num_rects * sizeof(DFBRectangle) + bridge->transfer_data_size;
+
+     transfer = SHCALLOC( bridge->shmpool, 1, alloc_size );
+     if (!transfer)
+          return D_OOSHM();
+          
+     transfer->bridge = bridge;
+     transfer->buffer = buffer;
+     transfer->from   = from;
+     transfer->to     = to;
+
+     transfer->rects  = (DFBRectangle*)(transfer + 1);
+
+     if (bridge->transfer_data_size)
+          transfer->data = transfer->rects + num_rects;
+
+     transfer->num_rects = num_rects;
+
+     direct_memcpy( transfer->rects, rects, num_rects * sizeof(DFBRectangle) );
+
+     D_MAGIC_SET( transfer, CoreSurfacePoolTransfer );
+
+     *ret_transfer = transfer;
+
+     return DFB_OK;
+}
+
+static void
+deallocate_transfer( CoreSurfacePoolTransfer *transfer )
+{
+     CoreSurfacePoolBridge *bridge;
+
+     D_MAGIC_ASSERT( transfer, CoreSurfacePoolTransfer );
+
+     bridge = transfer->bridge;
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     D_MAGIC_CLEAR( transfer );
+
+     SHFREE( bridge->shmpool, transfer );
+}
+
+DFBResult
+dfb_surface_pool_bridges_transfer( CoreSurfaceBuffer     *buffer,
+                                   CoreSurfaceAllocation *from,
+                                   CoreSurfaceAllocation *to,
+                                   const DFBRectangle    *rects,
+                                   unsigned int           num_rects )
+{
+     DFBResult                     ret;
+     int                           i;
+     DFBRectangle                  rect;
+     CoreSurface                  *surface;
+     CoreSurfacePoolBridge        *bridge = NULL;
+     const SurfacePoolBridgeFuncs *funcs;
+     CoreSurfacePoolTransfer      *transfer;
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     CORE_SURFACE_ALLOCATION_ASSERT( from );
+     CORE_SURFACE_ALLOCATION_ASSERT( to );
+     D_ASSERT( rects != NULL || num_rects == 0 );
+     D_ASSERT( num_rects > 0 || rects == NULL );
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p [%s], %p -> %p, %d rects )\n", __FUNCTION__,
+                 buffer, dfb_pixelformat_name( buffer->format ), from, to, num_rects );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+     FUSION_SKIRMISH_ASSERT( &surface->lock );
+
+     if (!rects) {
+          rect.x = rect.y = 0;
+          rect.w = surface->config.size.w;
+          rect.h = surface->config.size.h;
+
+          rects = ▭
+          num_rects = 1;
+     }
+
+     for (i=0; i<bridge_count; i++) {
+          bridge = bridge_array[i];
+          D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+          funcs = get_funcs( bridge );
+          D_ASSERT( funcs->CheckTransfer != NULL );
+
+          ret = funcs->CheckTransfer( bridge, bridge->data, get_local(bridge), buffer, from, to );
+          if (ret)
+               bridge = NULL;
+          else
+               break;
+     }
+
+     if (!bridge)
+          return DFB_UNSUPPORTED;
+          
+     D_DEBUG_AT( Core_SurfPoolBridge, "  -> using '%s'\n", bridge->desc.name );
+
+     ret = allocate_transfer( bridge, buffer, from, to, rects, num_rects, &transfer );
+     if (ret)
+          return ret;
+
+     D_ASSERT( funcs->StartTransfer != NULL );
+          
+     D_DEBUG_AT( Core_SurfPoolBridge, "  -> start...\n" );
+
+     ret = funcs->StartTransfer( bridge, bridge->data, get_local(bridge), transfer, transfer->data );
+     if (ret)
+          D_DERROR( ret, "Core/SurfacePoolBridge: Starting transfer via '%s' failed!\n", bridge->desc.name );
+     else if (funcs->FinishTransfer) {
+          D_DEBUG_AT( Core_SurfPoolBridge, "  -> finish...\n" );
+
+          ret = funcs->FinishTransfer( bridge, bridge->data, get_local(bridge), transfer, transfer->data );
+          if (ret)
+               D_DERROR( ret, "Core/SurfacePoolBridge: Finishing transfer via '%s' failed!\n", bridge->desc.name );
+     }
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "  => %s\n", DirectResultString(ret) );
+
+     deallocate_transfer( transfer );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+init_bridge( CoreDFB                      *core,
+             CoreSurfacePoolBridge        *bridge,
+             const SurfacePoolBridgeFuncs *funcs,
+             void                         *context )
+{
+     DFBResult ret;
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( funcs->InitPoolBridge != NULL );
+
+     D_DEBUG_AT( Core_SurfPoolBridge, "%s( %p, %p )\n", __FUNCTION__, bridge, funcs );
+
+     if (funcs->PoolBridgeDataSize)
+          bridge->bridge_data_size = funcs->PoolBridgeDataSize();
+
+     if (funcs->PoolBridgeLocalDataSize)
+          bridge->bridge_local_data_size = funcs->PoolBridgeLocalDataSize();
+
+     if (funcs->PoolTransferDataSize)
+          bridge->transfer_data_size = funcs->PoolTransferDataSize();
+
+     /* Allocate shared bridge data. */
+     if (bridge->bridge_data_size) {
+          bridge->data = SHCALLOC( bridge->shmpool, 1, bridge->bridge_data_size );
+          if (!bridge->data)
+               return D_OOSHM();
+     }
+
+     /* Allocate local bridge data. */
+     if (bridge->bridge_local_data_size &&
+         !(bridge_locals[bridge->bridge_id] = D_CALLOC( 1, bridge->bridge_local_data_size )))
+     {
+          SHFREE( bridge->shmpool, bridge->data );
+          return D_OOM();
+     }
+
+     ret = funcs->InitPoolBridge( core, bridge, bridge->data, get_local(bridge), context, &bridge->desc );
+     if (ret) {
+          D_DERROR( ret, "Core/SurfacePoolBridge: Initializing '%s' failed!\n", bridge->desc.name );
+
+          if (bridge_locals[bridge->bridge_id]) {
+               D_FREE( bridge_locals[bridge->bridge_id] );
+               bridge_locals[bridge->bridge_id] = NULL;
+          }
+
+          if (bridge->data) {
+               SHFREE( bridge->shmpool, bridge->data );
+               bridge->data = NULL;
+          }
+
+          bridge_array[bridge->bridge_id] = NULL;
+          bridge_funcs[bridge->bridge_id] = NULL;
+
+          return ret;
+     }
+
+     fusion_skirmish_init( &bridge->lock, bridge->desc.name, dfb_core_world(core) );
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/surface_pool_bridge.h b/Source/DirectFB/src/core/surface_pool_bridge.h
new file mode 100755
index 0000000..8fb6dda
--- /dev/null
+++ b/Source/DirectFB/src/core/surface_pool_bridge.h
@@ -0,0 +1,187 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__SURFACE_POOL_BRIDGE_H__
+#define __CORE__SURFACE_POOL_BRIDGE_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+
+typedef enum {
+     CSPBCAPS_NONE       = 0x00000000,
+
+     CSPBCAPS_ALL        = 0x00000000
+} CoreSurfacePoolBridgeCapabilities;
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_SURFACE_POOL_BRIDGE_ABI_VERSION        1
+
+#define DFB_SURFACE_POOL_BRIDGE_DESC_NAME_LENGTH  44
+
+
+typedef struct {
+     CoreSurfacePoolBridgeCapabilities  caps;
+     char                               name[DFB_SURFACE_POOL_BRIDGE_DESC_NAME_LENGTH];
+} CoreSurfacePoolBridgeDescription;
+
+
+typedef struct {
+     int       (*PoolBridgeDataSize)( void );
+     int       (*PoolBridgeLocalDataSize)( void );
+
+     int       (*PoolTransferDataSize)( void );
+
+     /*
+      * Bridge init/destroy
+      */
+     DFBResult (*InitPoolBridge)   ( CoreDFB                          *core,
+                                     CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local,
+                                     void                             *context,
+                                     CoreSurfacePoolBridgeDescription *ret_desc );
+
+     DFBResult (*JoinPoolBridge)   ( CoreDFB                          *core,
+                                     CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local,
+                                     void                             *context );
+
+     DFBResult (*DestroyPoolBridge)( CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local );
+
+     DFBResult (*LeavePoolBridge)  ( CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local );
+
+
+     /*
+      * Probe
+      */
+     DFBResult (*CheckTransfer)    ( CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local,
+                                     CoreSurfaceBuffer                *buffer,
+                                     CoreSurfaceAllocation            *from,
+                                     CoreSurfaceAllocation            *to );
+
+     /*
+      * Transfer
+      */
+     DFBResult (*StartTransfer)    ( CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local,
+                                     CoreSurfacePoolTransfer          *transfer,
+                                     void                             *transfer_data );
+
+     DFBResult (*FinishTransfer)   ( CoreSurfacePoolBridge            *bridge,
+                                     void                             *bridge_data,
+                                     void                             *bridge_local,
+                                     CoreSurfacePoolTransfer          *transfer,
+                                     void                             *transfer_data );
+} SurfacePoolBridgeFuncs;
+
+
+struct __DFB_CoreSurfacePoolBridge {
+     int                                magic;
+
+     FusionSkirmish                     lock;
+
+     CoreSurfacePoolBridgeID            bridge_id;
+
+     CoreSurfacePoolBridgeDescription   desc;
+
+     int                                bridge_data_size;
+     int                                bridge_local_data_size;
+     int                                transfer_data_size;
+
+     void                              *data;
+
+     FusionSHMPoolShared               *shmpool;
+
+     DirectLink                        *transfers;
+};
+
+struct __DFB_CoreSurfacePoolTransfer {
+     DirectLink                         link;
+
+     int                                magic;
+
+     CoreSurfacePoolBridge             *bridge;
+
+     CoreSurfaceBuffer                 *buffer;
+     CoreSurfaceAllocation             *from;
+     CoreSurfaceAllocation             *to;
+
+     DFBRectangle                      *rects;
+     unsigned int                       num_rects;
+
+     void                              *data;
+};
+
+
+typedef DFBEnumerationResult (*CoreSurfacePoolBridgeCallback)( CoreSurfacePoolBridge *bridge,
+                                                               void                  *ctx );
+
+
+
+DFBResult dfb_surface_pool_bridges_enumerate( CoreSurfacePoolBridgeCallback  callback,
+                                              void                          *ctx );
+
+DFBResult dfb_surface_pool_bridges_transfer ( CoreSurfaceBuffer             *buffer,
+                                              CoreSurfaceAllocation         *from,
+                                              CoreSurfaceAllocation         *to,
+                                              const DFBRectangle            *rects,
+                                              unsigned int                   num_rects );
+
+
+DFBResult dfb_surface_pool_bridge_initialize( CoreDFB                       *core,
+                                              const SurfacePoolBridgeFuncs  *funcs,
+                                              void                          *context,
+                                              CoreSurfacePoolBridge        **ret_bridge );
+
+DFBResult dfb_surface_pool_bridge_join      ( CoreDFB                       *core,
+                                              CoreSurfacePoolBridge         *pool,
+                                              const SurfacePoolBridgeFuncs  *funcs,
+                                              void                          *context );
+
+DFBResult dfb_surface_pool_bridge_destroy   ( CoreSurfacePoolBridge         *bridge );
+
+DFBResult dfb_surface_pool_bridge_leave     ( CoreSurfacePoolBridge         *bridge );
+
+
+#endif
+
diff --git a/Source/DirectFB/src/core/system.c b/Source/DirectFB/src/core/system.c
new file mode 100755
index 0000000..6a78eb0
--- /dev/null
+++ b/Source/DirectFB/src/core/system.c
@@ -0,0 +1,464 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/list.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/core_parts.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/modules.h>
+
+DEFINE_MODULE_DIRECTORY( dfb_core_systems, "systems", DFB_CORE_SYSTEM_ABI_VERSION );
+
+
+D_DEBUG_DOMAIN( Core_System, "Core/System", "DirectFB System Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                  magic;
+
+     CoreSystemInfo       system_info;
+} DFBSystemCoreShared;
+
+struct __DFB_DFBSystemCore {
+     int                  magic;
+
+     CoreDFB             *core;
+
+     DFBSystemCoreShared *shared;
+};
+
+
+DFB_CORE_PART( system_core, SystemCore );
+
+/**********************************************************************************************************************/
+
+static DFBSystemCoreShared   *system_field  = NULL;    /* FIXME */
+
+static DirectModuleEntry     *system_module = NULL;    /* FIXME */
+static const CoreSystemFuncs *system_funcs  = NULL;    /* FIXME */
+static CoreSystemInfo         system_info;             /* FIXME */
+static void                  *system_data   = NULL;    /* FIXME */
+
+/**********************************************************************************************************************/
+
+static DFBResult
+dfb_system_core_initialize( CoreDFB             *core,
+                            DFBSystemCore       *data,
+                            DFBSystemCoreShared *shared )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     system_field = shared;    /* FIXME */
+
+     system_field->system_info = system_info;
+
+     ret = system_funcs->Initialize( core, &system_data );
+     if (ret)
+          return ret;
+
+
+     D_MAGIC_SET( data, DFBSystemCore );
+     D_MAGIC_SET( shared, DFBSystemCoreShared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_system_core_join( CoreDFB             *core,
+                      DFBSystemCore       *data,
+                      DFBSystemCoreShared *shared )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBSystemCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     system_field = shared;    /* FIXME */
+
+     if (system_field->system_info.type != system_info.type ||
+         strcmp( system_field->system_info.name, system_info.name ))
+     {
+          D_ERROR( "DirectFB/core/system: "
+                    "running system '%s' doesn't match system '%s'!\n",
+                    system_field->system_info.name, system_info.name );
+
+          system_field = NULL;
+
+          return DFB_UNSUPPORTED;
+     }
+
+     if (system_field->system_info.version.major != system_info.version.major ||
+         system_field->system_info.version.minor != system_info.version.minor)
+     {
+          D_ERROR( "DirectFB/core/system: running system version '%d.%d' "
+                    "doesn't match version '%d.%d'!\n",
+                    system_field->system_info.version.major,
+                    system_field->system_info.version.minor,
+                    system_info.version.major,
+                    system_info.version.minor );
+
+          system_field = NULL;
+
+          return DFB_UNSUPPORTED;
+     }
+
+     ret = system_funcs->Join( core, &system_data );
+     if (ret)
+          return ret;
+
+
+     D_MAGIC_SET( data, DFBSystemCore );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_system_core_shutdown( DFBSystemCore *data,
+                          bool           emergency )
+{
+     DFBResult         ret;
+     DFBSystemCoreShared *shared;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBSystemCore );
+     D_MAGIC_ASSERT( data->shared, DFBSystemCoreShared );
+
+     shared = data->shared;
+
+
+     ret = system_funcs->Shutdown( emergency );
+
+     direct_module_unref( system_module );
+
+     system_module = NULL;
+     system_funcs  = NULL;
+     system_field  = NULL;
+     system_data   = NULL;
+
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return ret;
+}
+
+static DFBResult
+dfb_system_core_leave( DFBSystemCore *data,
+                       bool           emergency )
+{
+     DFBResult         ret;
+     DFBSystemCoreShared *shared;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBSystemCore );
+     D_MAGIC_ASSERT( data->shared, DFBSystemCoreShared );
+
+     shared = data->shared;
+
+
+     ret = system_funcs->Leave( emergency );
+
+     direct_module_unref( system_module );
+
+     system_module = NULL;
+     system_funcs  = NULL;
+     system_field  = NULL;
+     system_data   = NULL;
+
+
+     D_MAGIC_CLEAR( data );
+
+     return ret;
+}
+
+static DFBResult
+dfb_system_core_suspend( DFBSystemCore *data )
+{
+     DFBSystemCoreShared *shared;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_suspend( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBSystemCore );
+     D_MAGIC_ASSERT( data->shared, DFBSystemCoreShared );
+
+     shared = data->shared;
+
+     return system_funcs->Suspend();
+}
+
+static DFBResult
+dfb_system_core_resume( DFBSystemCore *data )
+{
+     DFBSystemCoreShared *shared;
+
+     D_DEBUG_AT( Core_System, "dfb_system_core_resume( %p )\n", data );
+
+     D_MAGIC_ASSERT( data, DFBSystemCore );
+     D_MAGIC_ASSERT( data->shared, DFBSystemCoreShared );
+
+     shared = data->shared;
+
+     return system_funcs->Resume();
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_system_lookup( void )
+{
+     DirectLink *l;
+
+     direct_modules_explore_directory( &dfb_core_systems );
+
+     direct_list_foreach( l, dfb_core_systems.entries ) {
+          DirectModuleEntry     *module = (DirectModuleEntry*) l;
+          const CoreSystemFuncs *funcs;
+
+          funcs = direct_module_ref( module );
+          if (!funcs)
+               continue;
+
+          if (!system_module || (!dfb_config->system ||
+              !strcasecmp( dfb_config->system, module->name )))
+          {
+               if (system_module)
+                    direct_module_unref( system_module );
+
+               system_module = module;
+               system_funcs  = funcs;
+
+               funcs->GetSystemInfo( &system_info );
+          }
+          else
+               direct_module_unref( module );
+     }
+
+     if (!system_module) {
+          D_ERROR("DirectFB/core/system: No system found!\n");
+
+          return DFB_NOIMPL;
+     }
+
+     return DFB_OK;
+}
+
+CoreSystemType
+dfb_system_type( void )
+{
+     return system_info.type;
+}
+
+CoreSystemCapabilities
+dfb_system_caps( void )
+{
+     return system_info.caps;
+}
+
+void *
+dfb_system_data( void )
+{
+     return system_data;
+}
+
+volatile void *
+dfb_system_map_mmio( unsigned int    offset,
+                     int             length )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->MapMMIO( offset, length );
+}
+
+void
+dfb_system_unmap_mmio( volatile void  *addr,
+                       int             length )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     system_funcs->UnmapMMIO( addr, length );
+}
+
+int
+dfb_system_get_accelerator( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->GetAccelerator();
+}
+
+VideoMode *
+dfb_system_modes( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->GetModes();
+}
+
+VideoMode *
+dfb_system_current_mode( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->GetCurrentMode();
+}
+
+DFBResult
+dfb_system_thread_init( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->ThreadInit();
+}
+
+bool
+dfb_system_input_filter( CoreInputDevice *device,
+                         DFBInputEvent   *event )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->InputFilter( device, event );
+}
+
+unsigned long
+dfb_system_video_memory_physical( unsigned int offset )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->VideoMemoryPhysical( offset );
+}
+
+void *
+dfb_system_video_memory_virtual( unsigned int offset )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->VideoMemoryVirtual( offset );
+}
+
+unsigned int
+dfb_system_videoram_length( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->VideoRamLength();
+}
+
+unsigned long
+dfb_system_aux_memory_physical( unsigned int offset )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->AuxMemoryPhysical( offset );
+}
+
+void *
+dfb_system_aux_memory_virtual( unsigned int offset )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->AuxMemoryVirtual( offset );
+}
+
+unsigned int
+dfb_system_auxram_length( void )
+{
+     D_ASSERT( system_funcs != NULL );
+
+     return system_funcs->AuxRamLength();
+}
+
+void
+dfb_system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     int bus = -1, dev = -1, func = -1;
+     
+     D_ASSERT( system_funcs != NULL );
+
+     system_funcs->GetBusID( &bus, &dev, &func );
+
+     if (ret_bus)
+          *ret_bus = bus;
+     if (ret_dev)
+          *ret_dev = dev;
+     if (ret_func)
+          *ret_func = func;
+}
+
+void
+dfb_system_get_deviceid( unsigned int *ret_vendor_id,
+                         unsigned int *ret_device_id )
+{
+     unsigned int vendor_id = 0, device_id = 0;
+
+     D_ASSERT( system_funcs != NULL );
+
+     system_funcs->GetDeviceID( &vendor_id, &device_id );
+
+     if (ret_vendor_id)
+          *ret_vendor_id = vendor_id;
+     if (ret_device_id)
+          *ret_device_id = device_id;
+}
+
diff --git a/Source/DirectFB/src/core/system.h b/Source/DirectFB/src/core/system.h
new file mode 100755
index 0000000..f6d4df1
--- /dev/null
+++ b/Source/DirectFB/src/core/system.h
@@ -0,0 +1,258 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__SYSTEM_H__
+#define __DFB__CORE__SYSTEM_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+#include <direct/modules.h>
+
+#include <fusion/types.h>
+
+typedef enum {
+     CORE_ANY,
+     CORE_FBDEV,
+     CORE_X11,
+     CORE_OSX,
+     CORE_SDL,
+     CORE_VNC,
+     CORE_DEVMEM,
+     CORE_TI_CMEM
+} CoreSystemType;
+
+typedef enum {
+     CSCAPS_NONE         = 0x00000000,  /* None of these. */
+
+     CSCAPS_ACCELERATION = 0x00000001,  /* HW acceleration supported, so probe graphics drivers. */
+
+     CSCAPS_ALL          = 0x00000001   /* All of these. */
+} CoreSystemCapabilities;
+
+/*
+ * hold information of a Videomode read from /etc/fb.modes
+ * (to be replaced by DirectFB's own config system)
+ */
+typedef struct _VideoMode {
+     int xres;
+     int yres;
+     int bpp;
+
+     int priority;
+
+     int pixclock;
+     int left_margin;
+     int right_margin;
+     int upper_margin;
+     int lower_margin;
+     int hsync_len;
+     int vsync_len;
+     int hsync_high;
+     int vsync_high;
+     int csync_high;
+
+     int laced;
+     int doubled;
+
+     int sync_on_green;
+     int external_sync;
+     int broadcast;
+
+     struct _VideoMode *next;
+} VideoMode;
+
+DECLARE_MODULE_DIRECTORY( dfb_core_systems );
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_CORE_SYSTEM_ABI_VERSION           9
+
+#define DFB_CORE_SYSTEM_INFO_NAME_LENGTH     60
+#define DFB_CORE_SYSTEM_INFO_VENDOR_LENGTH   80
+#define DFB_CORE_SYSTEM_INFO_URL_LENGTH     120
+#define DFB_CORE_SYSTEM_INFO_LICENSE_LENGTH  40
+
+
+typedef struct {
+     int          major;        /* major version */
+     int          minor;        /* minor version */
+} CoreSystemVersion;        /* major.minor, e.g. 0.1 */
+
+typedef struct {
+     CoreSystemVersion        version;
+
+     CoreSystemType           type;
+     CoreSystemCapabilities   caps;
+
+     char                     name[DFB_CORE_SYSTEM_INFO_NAME_LENGTH];
+                                   /* Name of system, e.g. 'FBDev' */
+
+     char                     vendor[DFB_CORE_SYSTEM_INFO_VENDOR_LENGTH];
+                                   /* Vendor (or author) of the driver,
+                                      e.g. 'directfb.org' or 'Denis Oliver Kropp' */
+
+     char                     url[DFB_CORE_SYSTEM_INFO_URL_LENGTH];
+                                   /* URL for driver updates,
+                                      e.g. 'http://www.directfb.org/' */
+
+     char                     license[DFB_CORE_SYSTEM_INFO_LICENSE_LENGTH];
+                                   /* License, e.g. 'LGPL' or 'proprietary' */
+} CoreSystemInfo;
+
+typedef struct {
+     void           (*GetSystemInfo)( CoreSystemInfo *info );
+
+     DFBResult      (*Initialize)( CoreDFB *core, void **data );
+     DFBResult      (*Join)( CoreDFB *core, void **data );
+
+     DFBResult      (*Shutdown)( bool emergency );
+     DFBResult      (*Leave)( bool emergency );
+
+     DFBResult      (*Suspend)( void );
+     DFBResult      (*Resume)( void );
+
+     VideoMode*     (*GetModes)( void );
+     VideoMode*     (*GetCurrentMode)( void );
+
+     /*
+      * Called at the beginning of a new thread.
+      */
+     DFBResult      (*ThreadInit)( void );
+
+     /*
+      * Called upon incoming input events.
+      * Return true to drop the event, e.g. after doing special handling of it.
+      */
+     bool           (*InputFilter)( CoreInputDevice *device, DFBInputEvent *event );
+
+     /*
+      * Graphics drivers call this function to get access to MMIO regions.
+      *
+      * device: Graphics device to map
+      * offset: Offset from MMIO base (default offset is 0)
+      * length: Length of mapped region (-1 uses default length)
+      *
+      * Returns the virtual address or NULL if mapping failed.
+      */
+     volatile void* (*MapMMIO)( unsigned int    offset,
+                                int             length );
+
+     /*
+      * Graphics drivers call this function to unmap MMIO regions.
+      *
+      * addr:   Virtual address returned by gfxcard_map_mmio
+      * length: Length of mapped region (-1 uses default length)
+      */
+     void           (*UnmapMMIO)( volatile void  *addr,
+                                  int             length );
+
+     int            (*GetAccelerator)( void );
+
+     unsigned long  (*VideoMemoryPhysical)( unsigned int offset );
+     void*          (*VideoMemoryVirtual)( unsigned int offset );
+
+     unsigned int   (*VideoRamLength)( void );
+
+     unsigned long  (*AuxMemoryPhysical)( unsigned int offset );
+     void*          (*AuxMemoryVirtual)( unsigned int offset );
+     
+     unsigned int   (*AuxRamLength)( void );
+     
+     void           (*GetBusID)( int *ret_bus, int *ret_dev, int *ret_func );
+     void           (*GetDeviceID)( unsigned int *ret_vendor_id,
+                                    unsigned int *ret_device_id );
+} CoreSystemFuncs;
+
+
+
+DFBResult
+dfb_system_lookup( void );
+
+CoreSystemType
+dfb_system_type( void );
+
+CoreSystemCapabilities
+dfb_system_caps( void );
+
+void *
+dfb_system_data( void );
+
+volatile void *
+dfb_system_map_mmio( unsigned int    offset,
+                     int             length );
+
+void
+dfb_system_unmap_mmio( volatile void  *addr,
+                       int             length );
+
+int
+dfb_system_get_accelerator( void );
+
+VideoMode *
+dfb_system_modes( void );
+
+VideoMode *
+dfb_system_current_mode( void );
+
+DFBResult
+dfb_system_thread_init( void );
+
+bool
+dfb_system_input_filter( CoreInputDevice *device,
+                         DFBInputEvent   *event );
+
+unsigned long
+dfb_system_video_memory_physical( unsigned int offset );
+
+void *
+dfb_system_video_memory_virtual( unsigned int offset );
+
+unsigned int
+dfb_system_videoram_length( void );
+
+unsigned long
+dfb_system_aux_memory_physical( unsigned int offset );
+
+void *
+dfb_system_aux_memory_virtual( unsigned int offset );
+
+unsigned int
+dfb_system_auxram_length( void );
+
+void
+dfb_system_get_busid( int *ret_bus, int *ret_dev, int *ret_func );
+
+void
+dfb_system_get_deviceid( unsigned int *ret_vendor_id,
+                         unsigned int *ret_device_id );
+
+#endif
+
diff --git a/Source/DirectFB/src/core/windows.c b/Source/DirectFB/src/core/windows.c
new file mode 100755
index 0000000..6d60925
--- /dev/null
+++ b/Source/DirectFB/src/core/windows.c
@@ -0,0 +1,1908 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+
+#include <pthread.h>
+
+#include <fusion/shmalloc.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/core.h>
+#include <core/layers.h>
+#include <core/layer_context.h>
+#include <core/gfxcard.h>
+#include <core/input.h>
+#include <core/palette.h>
+#include <core/state.h>
+#include <core/system.h>
+#include <core/windows.h>
+#include <core/windowstack.h>
+#include <core/wm.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/trace.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <core/layers_internal.h>
+#include <core/windows_internal.h>
+
+
+D_DEBUG_DOMAIN( Core_Windows, "Core/Windows", "DirectFB Window Core" );
+
+
+typedef struct {
+     DirectLink       link;
+
+     DFBInputDeviceID id;
+     GlobalReaction   reaction;
+} StackDevice;
+
+/**************************************************************************************************/
+
+static bool
+core_window_filter( CoreWindow *window, const DFBWindowEvent *event );
+
+/**************************************************************************************************/
+
+static const ReactionFunc dfb_window_globals[] = {
+     NULL
+};
+
+/**************************************************************************************************/
+
+/*
+ * Window destructor.
+ */
+static void
+window_destructor( FusionObject *object, bool zombie, void *ctx )
+{
+     CoreWindow      *window = (CoreWindow*) object;
+     CoreWindowStack *stack  = window->stack;
+
+     D_DEBUG_AT( Core_Windows, "destroying %p (%d,%d - %dx%d%s)\n", window,
+                 DFB_RECTANGLE_VALS( &window->config.bounds ), zombie ? " ZOMBIE" : "");
+
+     D_ASSUME( window->stack != NULL );
+
+     if (!stack) {
+          fusion_object_destroy( object );
+          return;
+     }
+
+     dfb_windowstack_lock( stack );
+
+     dfb_window_destroy( window );
+
+
+     if (window->cursor.surface)
+          dfb_surface_unlink( &window->cursor.surface );
+
+     if (window->caps & DWCAPS_SUBWINDOW) {
+          int         index;
+          CoreWindow *toplevel;
+
+          toplevel = window->toplevel;
+          D_ASSERT( toplevel != NULL );
+
+          index = fusion_vector_index_of( &toplevel->subwindows, window );
+          D_ASSERT( index >= 0 );
+
+          fusion_vector_remove( &toplevel->subwindows, index );
+
+          dfb_window_unlink( &window->toplevel );
+     }
+     else {
+          D_ASSERT( fusion_vector_size(&window->subwindows) == 0 );
+
+          fusion_vector_destroy( &window->subwindows );
+     }
+
+     dfb_windowstack_unlock( stack );
+
+
+     /* Unlink the primary region of the context. */
+     if (window->primary_region)
+          dfb_layer_region_unlink( &window->primary_region );
+
+     D_MAGIC_CLEAR( window );
+
+     fusion_object_destroy( object );
+}
+
+FusionObjectPool *
+dfb_window_pool_create( const FusionWorld *world )
+{
+     return fusion_object_pool_create( "Window Pool",
+                                       sizeof(CoreWindow),
+                                       sizeof(DFBWindowEvent),
+                                       window_destructor, NULL, world );
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+create_region( CoreDFB                 *core,
+               CoreLayerContext        *context,
+               CoreWindow              *window,
+               DFBSurfacePixelFormat    format,
+               DFBSurfaceCapabilities   surface_caps,
+               CoreLayerRegion        **ret_region,
+               CoreSurface            **ret_surface )
+{
+     DFBResult              ret;
+     CoreLayerRegionConfig  config;
+     CoreLayerRegion       *region;
+     CoreSurface           *surface;
+     CoreSurfaceConfig      scon;
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( context != NULL );
+     D_ASSERT( window != NULL );
+     D_ASSERT( ret_region != NULL );
+     D_ASSERT( ret_surface != NULL );
+
+     memset( &config, 0, sizeof(CoreLayerRegionConfig) );
+
+     config.width         = window->config.bounds.w;
+     config.height        = window->config.bounds.h;
+     config.format        = format;
+     config.options       = context->config.options & DLOP_FLICKER_FILTERING;
+     config.source        = (DFBRectangle) { 0, 0, config.width, config.height };
+     config.dest          = window->config.bounds;
+     config.opacity       = 0;
+     config.alpha_ramp[0] = 0x00;
+     config.alpha_ramp[1] = 0x55;
+     config.alpha_ramp[2] = 0xaa;
+     config.alpha_ramp[3] = 0xff;
+
+     if (surface_caps & DSCAPS_DOUBLE)
+          config.buffermode = DLBM_BACKVIDEO;
+     else if (surface_caps & DSCAPS_TRIPLE)
+          config.buffermode = DLBM_TRIPLE;
+     else
+          config.buffermode = DLBM_FRONTONLY;
+
+     if (((context->config.options & DLOP_ALPHACHANNEL) ||
+          (window->config.options & DWOP_ALPHACHANNEL)) && DFB_PIXELFORMAT_HAS_ALPHA(format))
+          config.options |= DLOP_ALPHACHANNEL;
+
+     config.options |= DLOP_OPACITY;
+
+     config.surface_caps = surface_caps & (DSCAPS_INTERLACED |
+                                           DSCAPS_SEPARATED  |
+                                           DSCAPS_PREMULTIPLIED);
+
+     ret = dfb_layer_region_create( context, ®ion );
+     if (ret)
+          return ret;
+
+
+     do {
+          ret = dfb_layer_region_set_configuration( region, &config, CLRCF_ALL );
+          if (ret) {
+               if (config.options & DLOP_OPACITY)
+                    config.options &= ~DLOP_OPACITY;
+               else if (config.options & DLOP_ALPHACHANNEL)
+                    config.options = (config.options & ~DLOP_ALPHACHANNEL) | DLOP_OPACITY;
+               else {
+                    D_DERROR( ret, "DirectFB/Core/Windows: Unable to set region configuration!\n" );
+                    dfb_layer_region_unref( region );
+                    return ret;
+               }
+          }
+     } while (ret);
+
+     scon.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+     scon.size.w = config.width;
+     scon.size.h = config.height;
+     scon.format = format;
+     scon.caps   = surface_caps | DSCAPS_VIDEOONLY;
+
+     ret = dfb_surface_create( core, &scon, CSTF_SHARED | CSTF_LAYER, context->layer_id, NULL, &surface );
+     if (ret) {
+          dfb_layer_region_unref( region );
+          return ret;
+     }
+
+     ret = dfb_layer_region_set_surface( region, surface );
+     if (ret) {
+          dfb_surface_unref( surface );
+          dfb_layer_region_unref( region );
+          return ret;
+     }
+
+     ret = dfb_layer_region_enable( region );
+     if (ret) {
+          dfb_surface_unref( surface );
+          dfb_layer_region_unref( region );
+          return ret;
+     }
+
+     *ret_region  = region;
+     *ret_surface = surface;
+
+     return DFB_OK;
+}
+
+static DFBResult
+init_subwindow( CoreWindow      *window,
+                CoreWindowStack *stack,
+                DFBWindowID      toplevel_id )
+{
+     DFBResult   ret;
+     CoreWindow *toplevel;
+
+     /* Lookup top level window */
+     ret = dfb_wm_window_lookup( stack, toplevel_id, &toplevel );
+     if (ret)
+          return ret;
+
+     /* Make sure chosen top level window is not a sub window */
+     if (toplevel->caps & DWCAPS_SUBWINDOW) {
+          D_ASSERT( toplevel->toplevel != NULL );
+          D_ASSERT( toplevel->toplevel_id != 0 );
+
+          return DFB_INVARG;
+     }
+     else {
+          D_ASSERT( toplevel->toplevel == NULL );
+          D_ASSERT( toplevel->toplevel_id == 0 );
+     }
+
+     /* Link top level window into sub window structure */
+     ret = dfb_window_link( &window->toplevel, toplevel );
+     if (ret)
+          return ret;
+
+     /* Add window to sub window list of top level window */
+     ret = fusion_vector_add( &toplevel->subwindows, window );
+     if (ret) {
+          dfb_window_unlink( &window->toplevel );
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_window_create( CoreWindowStack             *stack,
+                   const DFBWindowDescription  *desc,
+                   CoreWindow                 **ret_window )
+{
+     DFBResult               ret;
+     CoreSurface            *surface;
+     CoreSurfacePolicy       surface_policy = CSP_SYSTEMONLY;
+     CoreLayer              *layer;
+     CoreLayerContext       *context;
+     CoreWindow             *window;
+     CardCapabilities        card_caps;
+     CoreWindowConfig        config;
+     DFBWindowCapabilities   caps;
+     DFBSurfaceCapabilities  surface_caps;
+     DFBSurfacePixelFormat   pixelformat;
+     DFBWindowID             toplevel_id;
+
+     D_DEBUG_AT( Core_Windows, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_ASSERT( stack != NULL );
+     D_ASSERT( stack->context != NULL );
+     D_ASSERT( desc != NULL );
+     D_ASSERT( desc->width > 0 );
+     D_ASSERT( desc->height > 0 );
+     D_ASSERT( ret_window != NULL );
+
+     if (desc->width > 4096 || desc->height > 4096)
+          return DFB_LIMITEXCEEDED;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     context = stack->context;
+     layer   = dfb_layer_at( context->layer_id );
+
+
+     caps         = desc->caps;
+     pixelformat  = desc->pixelformat;
+     surface_caps = desc->surface_caps & (DSCAPS_INTERLACED    | DSCAPS_SEPARATED  |
+                                          DSCAPS_PREMULTIPLIED | DSCAPS_DEPTH      |
+                                          DSCAPS_STATIC_ALLOC  | DSCAPS_SYSTEMONLY |
+                                          DSCAPS_VIDEOONLY);
+     toplevel_id  = (desc->flags & DWDESC_TOPLEVEL_ID) ? desc->toplevel_id : 0;
+
+     if (toplevel_id != 0)
+          caps |= DWCAPS_SUBWINDOW;
+     else
+          caps &= ~DWCAPS_SUBWINDOW;
+
+
+     if (!dfb_config->translucent_windows) {
+          caps &= ~DWCAPS_ALPHACHANNEL;
+
+          /*if (DFB_PIXELFORMAT_HAS_ALPHA(pixelformat))
+               pixelformat = DSPF_UNKNOWN;*/
+     }
+
+     /* Choose pixel format. */
+     if (caps & DWCAPS_ALPHACHANNEL) {
+          if (pixelformat == DSPF_UNKNOWN) {
+               if (context->config.flags & DLCONF_PIXELFORMAT)
+                    pixelformat = context->config.pixelformat;
+
+               if (! DFB_PIXELFORMAT_HAS_ALPHA(pixelformat))
+                    pixelformat = DSPF_ARGB;
+          }
+          else if (! DFB_PIXELFORMAT_HAS_ALPHA(pixelformat)) {
+               dfb_windowstack_unlock( stack );
+               return DFB_INVARG;
+          }
+     }
+     else if (pixelformat == DSPF_UNKNOWN) {
+          if (context->config.flags & DLCONF_PIXELFORMAT)
+               pixelformat = context->config.pixelformat;
+          else {
+               D_WARN( "layer config has no pixel format, using RGB16" );
+
+               pixelformat = DSPF_RGB16;
+          }
+     }
+
+     /* Choose window surface policy */
+     if ((surface_caps & DSCAPS_VIDEOONLY) ||
+         (context->config.buffermode == DLBM_WINDOWS))
+     {
+          surface_policy = CSP_VIDEOONLY;
+     }
+     else if (!(surface_caps & DSCAPS_SYSTEMONLY) &&
+              context->config.buffermode != DLBM_BACKSYSTEM)
+     {
+          if (dfb_config->window_policy != -1) {
+               /* Use the explicitly specified policy. */
+               surface_policy = dfb_config->window_policy;
+          }
+          else {
+               /* Examine the hardware capabilities. */
+               dfb_gfxcard_get_capabilities( &card_caps );
+
+               if (card_caps.accel & DFXL_BLIT) {
+                    if ((card_caps.blitting & DSBLIT_BLEND_ALPHACHANNEL) ||
+                        !(caps & DWCAPS_ALPHACHANNEL))
+                         surface_policy = CSP_VIDEOHIGH;
+               }
+          }
+     }
+
+     dfb_surface_caps_apply_policy( surface_policy, &surface_caps );
+
+     if (caps & DWCAPS_DOUBLEBUFFER)
+          surface_caps |= DSCAPS_DOUBLE;
+
+
+     memset( &config, 0, sizeof(CoreWindowConfig) );
+
+     config.bounds.x = desc->posx;
+     config.bounds.y = desc->posy;
+     config.bounds.w = desc->width;
+     config.bounds.h = desc->height;
+     config.stacking = (desc->flags & DWDESC_STACKING) ? desc->stacking : DWSC_MIDDLE;
+
+     config.events   = DWET_ALL;
+
+     /* Auto enable blending for ARGB only, not indexed. */
+     if ((caps & DWCAPS_ALPHACHANNEL) &&
+          DFB_PIXELFORMAT_HAS_ALPHA (pixelformat) &&
+         !DFB_PIXELFORMAT_IS_INDEXED(pixelformat))
+          config.options |= DWOP_ALPHACHANNEL;
+
+     /* Override automatic settings. */
+     if (desc->flags & DWDESC_OPTIONS)
+          config.options = desc->options;
+
+     /* Create the window object. */
+     window = dfb_core_create_window( layer->core );
+
+     window->id                  = ++stack->id_pool;
+     window->caps                = caps;
+     window->stack               = stack;
+     window->config              = config;
+     window->config.association  = (desc->flags & DWDESC_PARENT) ? desc->parent_id : 0;
+     window->config.cursor_flags = dfb_config->default_cursor_flags;
+
+     /* Set toplevel window ID (new sub window feature) */
+     window->toplevel_id = toplevel_id;
+
+     if (desc->flags & DWDESC_RESOURCE_ID)
+          window->resource_id = desc->resource_id;
+
+     D_MAGIC_SET( window, CoreWindow );
+
+     ret = dfb_wm_preconfigure_window( stack, window );
+     if(ret) {
+          D_MAGIC_CLEAR( window );
+          fusion_object_destroy( &window->object );
+          dfb_windowstack_unlock( stack );
+          return ret;
+     }
+
+     /* wm may have changed values */
+     config = window->config;
+     caps   = window->caps;
+
+     /* Initialize sub window... */
+     if (caps & DWCAPS_SUBWINDOW) {
+          ret = init_subwindow( window, stack, toplevel_id );
+          if (ret) {
+               D_MAGIC_CLEAR( window );
+               fusion_object_destroy( &window->object );
+               dfb_windowstack_unlock( stack );
+               return ret;
+          }
+     }
+     else {
+          /* ...or initialize top level window */
+          fusion_vector_init( &window->subwindows, 3, stack->shmpool );
+
+          /* In case WM forbids sub window request, clear the toplevel window ID */
+          window->toplevel_id = 0;
+     }
+
+     if (dfb_config->warn.flags & DCWF_CREATE_WINDOW)
+          D_WARN( "create-window   %4dx%4d %6s, caps 0x%08x, surface-caps 0x%08x, ID %u",
+                  window->config.bounds.w, window->config.bounds.h, dfb_pixelformat_name(pixelformat),
+                  window->caps, surface_caps, window->id );
+
+     /* Create the window's surface using the layer's palette if possible. */
+     if (! (caps & (DWCAPS_INPUTONLY | DWCAPS_COLOR))) {
+          if (context->config.buffermode == DLBM_WINDOWS) {
+               CoreLayerRegion *region = NULL;
+
+               /* Create a region for the window. */
+               ret = create_region( layer->core, context, window,
+                                    pixelformat, surface_caps, ®ion, &surface );
+               if (ret) {
+                    D_MAGIC_CLEAR( window );
+                    fusion_object_destroy( &window->object );
+                    dfb_windowstack_unlock( stack );
+                    return ret;
+               }
+
+               /* Link the region into the window structure. */
+               dfb_layer_region_link( &window->region, region );
+               dfb_layer_region_unref( region );
+
+               /* Link the surface into the window structure. */
+               dfb_surface_link( &window->surface, surface );
+               dfb_surface_unref( surface );
+          }
+          else {
+               CoreLayerRegion *region;
+
+               /* Get the primary region of the layer context. */
+               ret = dfb_layer_context_get_primary_region( context, true, ®ion );
+               if (ret) {
+                    D_MAGIC_CLEAR( window );
+                    fusion_object_destroy( &window->object );
+                    dfb_windowstack_unlock( stack );
+                    return ret;
+               }
+
+               /* Link the primary region into the window structure. */
+               dfb_layer_region_link( &window->primary_region, region );
+               dfb_layer_region_unref( region );
+
+               D_DEBUG_AT( Core_Windows, "  -> %dx%d %s %s\n",
+                           window->config.bounds.w, window->config.bounds.h,
+                           dfb_pixelformat_name(pixelformat),
+                           (surface_policy == CSP_VIDEOONLY) ?
+                              "VIDEOONLY" :
+                              ((surface_policy == CSP_SYSTEMONLY) ?
+                                   "SYSTEM ONLY" :
+                                   "AUTO VIDEO") );
+
+               /* Give the WM a chance to provide its own surface. */
+               if (!window->surface) {
+                    /* Create the surface for the window. */
+                    ret = dfb_surface_create_simple( layer->core, config.bounds.w, config.bounds.h,
+                                                     pixelformat, surface_caps, CSTF_SHARED | CSTF_WINDOW,
+                                                     (desc->flags & DWDESC_RESOURCE_ID) ?
+                                                     desc->resource_id : window->id,
+                                                     region->surface ?
+                                                     region->surface->palette : NULL, &surface );
+                    if (ret) {
+                         D_DERROR( ret, "Core/Windows: Failed to create window surface!\n" );
+                         D_MAGIC_CLEAR( window );
+                         dfb_layer_region_unlink( &window->primary_region );
+                         fusion_object_destroy( &window->object );
+                         dfb_windowstack_unlock( stack );
+                         return ret;
+                    }
+
+                    /* Link the surface into the window structure. */
+                    dfb_surface_link( &window->surface, surface );
+                    dfb_surface_unref( surface );
+               }
+          }
+     }
+     else
+          D_DEBUG_AT( Core_Windows, "  -> %dx%d - INPUT ONLY!\n",
+                      window->config.bounds.w, window->config.bounds.h );
+
+     D_DEBUG_AT( Core_Windows, "  -> %p\n", window );
+
+     /* Pass the new window to the window manager. */
+     ret = dfb_wm_add_window( stack, window );
+     if (ret) {
+          D_DERROR( ret, "Core/Windows: Failed to add window to manager!\n" );
+
+          D_MAGIC_CLEAR( window );
+
+          if (window->surface)
+               dfb_surface_unlink( &window->surface );
+
+          if (window->primary_region)
+               dfb_layer_region_unlink( &window->primary_region );
+
+          if (window->region)
+               dfb_layer_region_unlink( &window->region );
+
+          fusion_object_destroy( &window->object );
+          dfb_windowstack_unlock( stack );
+          return ret;
+     }
+
+     /* Indicate that initialization is complete. */
+     D_FLAGS_SET( window->flags, CWF_INITIALIZED );
+
+     /* Increase number of windows. */
+     stack->num++;
+
+     /* Finally activate the object. */
+     fusion_object_activate( &window->object );
+
+     fusion_reactor_direct( window->object.reactor, true );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     /* Return the new window. */
+     *ret_window = window;
+
+     return DFB_OK;;
+}
+
+void
+dfb_window_destroy( CoreWindow *window )
+{
+     int              i;
+     DFBWindowEvent   evt;
+     CoreWindowStack *stack;
+     BoundWindow     *bound, *next;
+     CoreWindow      *subwindow;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( DFB_WINDOW_INITIALIZED( window ) );
+
+     D_DEBUG_AT( Core_Windows, "dfb_window_destroy (%p) [%4d,%4d - %4dx%4d]\n",
+                 window, DFB_RECTANGLE_VALS( &window->config.bounds ) );
+
+     D_ASSUME( window->stack != NULL );
+
+     stack = window->stack;
+     if (!stack)
+          return;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return;
+
+     /* Destroy sub windows first. */
+     fusion_vector_foreach_reverse (subwindow, i, window->subwindows) {
+          D_ASSERT( subwindow != NULL );
+          D_ASSERT( DFB_WINDOW_INITIALIZED( subwindow ) );
+
+          dfb_window_destroy( subwindow );
+     }
+
+     /* Avoid multiple destructions. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          D_DEBUG_AT( Core_Windows, "%p already destroyed.\n", window );
+          dfb_windowstack_unlock( stack );
+          return;
+     }
+
+     /* Unbind bound windows. */
+     direct_list_foreach_safe (bound, next, window->bound_windows) {
+          direct_list_remove( &window->bound_windows, &bound->link );
+
+          bound->window->boundto = NULL;
+
+          SHFREE( stack->shmpool, bound );
+     }
+
+     /* Unbind this window. */
+     if (window->boundto)
+          dfb_window_unbind( window->boundto, window );
+
+     /* Make sure the window is no longer visible. */
+     dfb_window_set_opacity( window, 0 );
+
+     /* Stop managing the window. */
+     dfb_wm_remove_window( stack, window );
+
+     /* Indicate destruction. */
+     D_FLAGS_SET( window->flags, CWF_DESTROYED );
+
+     /* Hardware allocated? */
+     if (window->region) {
+          /* Disable region (removing it from hardware). */
+          dfb_layer_region_disable( window->region );
+
+          /* Unlink from structure. */
+          dfb_layer_region_unlink( &window->region );
+     }
+
+     /* Unlink the window's surface. */
+     if (window->surface) {
+          dfb_surface_unlink( &window->surface );
+     }
+
+     /* Decrease number of windows. */
+     stack->num--;
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+
+     /* Notify listeners. */
+     evt.type = DWET_DESTROYED;
+     dfb_window_post_event( window, &evt );
+}
+
+DFBResult
+dfb_window_change_stacking( CoreWindow             *window,
+                            DFBWindowStackingClass  stacking )
+{
+     DFBResult         ret;
+     CoreWindowStack  *stack;
+     CoreWindowConfig  config;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     config.stacking = stacking;
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_set_window_config( window, &config, CWCF_STACKING );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_raise( CoreWindow *window )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, window, 1 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_lower( CoreWindow *window )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, window, -1 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_raisetotop( CoreWindow *window )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, NULL, 1 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_lowertobottom( CoreWindow *window )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, NULL, 0 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_putatop( CoreWindow *window,
+                    CoreWindow *lower )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, lower, 1 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_putbelow( CoreWindow *window,
+                     CoreWindow *upper )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     /* Let the window manager do its work. */
+     ret = dfb_wm_restack_window( window, upper, -1 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_config( CoreWindow             *window,
+                       const CoreWindowConfig *config,
+                       CoreWindowConfigFlags   flags )
+{
+     DFBResult         ret;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     ret = dfb_wm_set_window_config( window, config, flags );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_cursor_shape( CoreWindow   *window,
+                             CoreSurface  *surface,
+                             unsigned int  hot_x,
+                             unsigned int  hot_y )
+{
+     DFBResult         ret   = DFB_OK;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     window->cursor.hot_x = hot_x;
+     window->cursor.hot_y = hot_y;
+
+     if (window->cursor.surface)
+          dfb_surface_unlink( &window->cursor.surface );
+
+     if (surface) {
+          ret = dfb_surface_link( &window->cursor.surface, surface );
+          if (ret == DFB_OK) {
+               if (window->flags & CWF_FOCUSED)
+                    dfb_windowstack_cursor_set_shape( stack, surface, hot_x, hot_y );
+          }
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+static DFBResult
+move_window( CoreWindow *window,
+             int         x,
+             int         y )
+{
+     DFBResult         ret; 
+     CoreWindowConfig  config;
+     BoundWindow      *bound;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     config.bounds.x = x;
+     config.bounds.y = y;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_POSITION );
+     if (ret)
+          return ret;
+
+     direct_list_foreach (bound, window->bound_windows) {
+          move_window( bound->window,
+                       window->config.bounds.x + bound->x,
+                       window->config.bounds.y + bound->y );
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_window_move( CoreWindow *window,
+                 int         x,
+                 int         y,
+                 bool        relative )
+{
+     DFBResult        ret;    
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (window->boundto) {
+          dfb_windowstack_unlock( stack );
+          return DFB_UNSUPPORTED;
+     }
+
+     if (relative) {
+          x += window->config.bounds.x;
+          y += window->config.bounds.y;
+     }
+
+     if (x == window->config.bounds.x && y == window->config.bounds.y) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     ret = move_window( window, x, y );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_bounds( CoreWindow *window,
+                       int         x,
+                       int         y,
+                       int         width,
+                       int         height )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+     int               old_x;
+     int               old_y;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     old_x = window->config.bounds.x;
+     old_y = window->config.bounds.y;
+
+     if (window->boundto) {
+          if (old_x != x || old_y != y) {
+               dfb_windowstack_unlock( stack );
+               return DFB_UNSUPPORTED;
+          }
+     }
+
+     config.bounds.x = x;
+     config.bounds.y = y;
+     config.bounds.w = width;
+     config.bounds.h = height;
+
+     if (window->config.bounds.x == x &&
+         window->config.bounds.y == y &&
+         window->config.bounds.w == width &&
+         window->config.bounds.h == height)
+     {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_POSITION | CWCF_SIZE );
+     if (ret) {
+          dfb_windowstack_unlock( stack );
+          return ret;
+     }
+
+     if (old_x != x || old_y != y) {
+          BoundWindow *bound;
+
+          direct_list_foreach (bound, window->bound_windows) {
+               move_window( bound->window,
+                            window->config.bounds.x + bound->x,
+                            window->config.bounds.y + bound->y );
+          }
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_window_resize( CoreWindow   *window,
+                   int           width,
+                   int           height )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     D_DEBUG_AT( Core_Windows, "dfb_window_resize (%p) [%4d,%4d - %4dx%4d -> %dx%d]\n",
+                 window, DFB_RECTANGLE_VALS( &window->config.bounds ), width, height );
+
+     D_ASSERT( width > 0 );
+     D_ASSERT( height > 0 );
+
+     if (width > 4096 || height > 4096)
+          return DFB_LIMITEXCEEDED;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (window->config.bounds.w == width && window->config.bounds.h == height) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     config.bounds.w = width;
+     config.bounds.h = height;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_SIZE );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_bind( CoreWindow *window,
+                 CoreWindow *source,
+                 int         x,
+                 int         y )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack = window->stack;
+     BoundWindow     *bound;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     if (window == source)
+          return DFB_UNSUPPORTED;
+     
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (DFB_WINDOW_DESTROYED( source )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     bound = SHCALLOC( stack->shmpool, 1, sizeof(BoundWindow) );
+     if (!bound) {
+          dfb_windowstack_unlock( stack );
+          return DFB_NOSHAREDMEMORY;
+     }                    
+
+     if (source->boundto)
+          dfb_window_unbind( source->boundto, source );
+
+     ret = move_window( source,
+                        window->config.bounds.x + x,
+                        window->config.bounds.y + y );
+     if (ret) {
+          SHFREE( stack->shmpool, bound );
+          dfb_windowstack_unlock( stack );
+          return ret;
+     }
+
+     bound->window = source;
+     bound->x      = x;
+     bound->y      = y;
+
+     direct_list_append( &window->bound_windows, &bound->link );
+
+     source->boundto = window;
+
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_window_unbind( CoreWindow *window,
+                   CoreWindow *source )
+{
+     CoreWindowStack *stack = window->stack;
+     BoundWindow     *bound;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (DFB_WINDOW_DESTROYED( source )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (source->boundto != window) {
+          dfb_windowstack_unlock( stack );
+          return DFB_UNSUPPORTED;
+     }
+
+     direct_list_foreach (bound, window->bound_windows) {
+          if (bound->window == source) {
+               direct_list_remove( &window->bound_windows, &bound->link );
+
+               bound->window->boundto = NULL;
+
+               SHFREE( stack->shmpool, bound );
+
+               break;
+          }
+     }
+
+     if (!bound)
+          D_BUG( "window not found" );
+
+     dfb_windowstack_unlock( stack );
+
+     return bound ? DFB_OK : DFB_ITEMNOTFOUND;
+}
+     
+/*
+ * sets the source color key
+ */
+DFBResult
+dfb_window_set_color( CoreWindow *window,
+                      DFBColor    color )
+{
+     DFBResult         ret;
+     DFBColor          cc;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     cc = window->config.color;
+     if ( (cc.a==color.a) && (cc.r==color.r) && (cc.g==color.g) && (cc.b==color.b) ) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     config.color = color;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_COLOR );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_colorkey( CoreWindow *window,
+                         u32         color_key )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (window->config.color_key == color_key) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     config.color_key = color_key;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_COLOR_KEY );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_opacity( CoreWindow *window,
+                        u8          opacity )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     if (window->config.opacity == opacity) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     config.opacity = opacity;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_OPACITY );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_change_options( CoreWindow       *window,
+                           DFBWindowOptions  disable,
+                           DFBWindowOptions  enable )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     D_ASSUME( disable | enable );
+
+     if (!disable && !enable)
+          return DFB_OK;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     config.options = (window->config.options & ~disable) | enable;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_OPTIONS );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_opaque( CoreWindow      *window,
+                       const DFBRegion *region )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     DFB_REGION_ASSERT_IF( region );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     config.opaque.x1 = 0;
+     config.opaque.y1 = 0;
+     config.opaque.x2 = window->config.bounds.w - 1;
+     config.opaque.y2 = window->config.bounds.h - 1;
+
+     if (region && !dfb_region_region_intersect( &config.opaque, region ))
+          ret = DFB_INVAREA;
+     else
+          ret = dfb_wm_set_window_config( window, &config, CWCF_OPAQUE );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_change_events( CoreWindow         *window,
+                          DFBWindowEventType  disable,
+                          DFBWindowEventType  enable )
+{
+     DFBResult         ret;
+     CoreWindowConfig  config;
+     CoreWindowStack  *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     D_ASSUME( disable | enable );
+
+     if (!disable && !enable)
+          return DFB_OK;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     config.events = (window->config.events & ~disable) | enable;
+
+     ret = dfb_wm_set_window_config( window, &config, CWCF_EVENTS );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_set_key_selection( CoreWindow                    *window,
+                              DFBWindowKeySelection          selection,
+                              const DFBInputDeviceKeySymbol *keys,
+                              unsigned int                   num_keys )
+{
+    DFBResult         ret;
+    CoreWindowConfig  config;
+    CoreWindowStack  *stack = window->stack;
+
+    D_MAGIC_ASSERT( window, CoreWindow );
+
+    D_ASSERT( selection == DWKS_ALL || selection == DWKS_NONE || selection == DWKS_LIST );
+    D_ASSERT( keys != NULL || selection != DWKS_LIST );
+    D_ASSERT( num_keys > 0 || selection != DWKS_LIST );
+
+    /* Lock the window stack. */
+    if (dfb_windowstack_lock( stack ))
+         return DFB_FUSION;
+
+    /* Never call WM after destroying the window. */
+    if (DFB_WINDOW_DESTROYED( window )) {
+         dfb_windowstack_unlock( stack );
+         return DFB_DESTROYED;
+    }
+
+    config.key_selection = selection;
+    config.keys          = (DFBInputDeviceKeySymbol*) keys; /* FIXME */
+    config.num_keys      = num_keys;
+
+    ret = dfb_wm_set_window_config( window, &config, CWCF_KEY_SELECTION );
+
+    /* Unlock the window stack. */
+    dfb_windowstack_unlock( stack );
+
+    return ret;
+}
+
+DFBResult
+dfb_window_change_grab( CoreWindow       *window,
+                        CoreWMGrabTarget  target,
+                        bool              grab )
+{
+     DFBResult        ret;
+     CoreWMGrab       wmgrab;
+     CoreWindowStack *stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     stack = window->stack;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     wmgrab.target = target;
+
+     if (grab)
+         ret = dfb_wm_grab( window, &wmgrab );
+     else
+         ret = dfb_wm_ungrab( window, &wmgrab );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_grab_key( CoreWindow                 *window,
+                     DFBInputDeviceKeySymbol     symbol,
+                     DFBInputDeviceModifierMask  modifiers )
+{
+     DFBResult        ret;
+     CoreWMGrab       grab;
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     grab.target    = CWMGT_KEY;
+     grab.symbol    = symbol;
+     grab.modifiers = modifiers;
+
+     ret = dfb_wm_grab( window, &grab );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_ungrab_key( CoreWindow                 *window,
+                       DFBInputDeviceKeySymbol     symbol,
+                       DFBInputDeviceModifierMask  modifiers )
+{
+     DFBResult        ret;
+     CoreWMGrab       grab;
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     grab.target    = CWMGT_KEY;
+     grab.symbol    = symbol;
+     grab.modifiers = modifiers;
+
+     ret = dfb_wm_ungrab( window, &grab );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBResult
+dfb_window_repaint( CoreWindow          *window,
+                    const DFBRegion     *region,
+                    DFBSurfaceFlipFlags  flags )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( window->stack != NULL );
+
+     DFB_REGION_ASSERT_IF( region );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     ret = dfb_wm_update_window( window, region, flags );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+const char *
+dfb_window_event_type_name( DFBWindowEventType type )
+{
+     switch (type) {
+          case DWET_POSITION:
+               return "POSITION";
+
+          case DWET_SIZE:
+               return "SIZE";
+
+          case DWET_CLOSE:
+               return "CLOSE";
+
+          case DWET_DESTROYED:
+               return "DESTROYED";
+
+          case DWET_GOTFOCUS:
+               return "GOTFOCUS";
+
+          case DWET_LOSTFOCUS:
+               return "LOSTFOCUS";
+
+          case DWET_KEYDOWN:
+               return "KEYDOWN";
+
+          case DWET_KEYUP:
+               return "KEYUP";
+
+          case DWET_BUTTONDOWN:
+               return "BUTTONDOWN";
+
+          case DWET_BUTTONUP:
+               return "BUTTONUP";
+
+          case DWET_MOTION:
+               return "MOTION";
+
+          case DWET_ENTER:
+               return "ENTER";
+
+          case DWET_LEAVE:
+               return "LEAVE";
+
+          case DWET_WHEEL:
+               return "WHEEL";
+
+          case DWET_POSITION_SIZE:
+               return "POSITION_SIZE";
+
+          default:
+               break;
+     }
+
+     return "<invalid>";
+}
+
+void
+dfb_window_post_event( CoreWindow     *window,
+                       DFBWindowEvent *event )
+{
+     D_MAGIC_ASSERT( window, CoreWindow );
+     D_ASSERT( event != NULL );
+
+     D_ASSUME( !DFB_WINDOW_DESTROYED( window ) || event->type == DWET_DESTROYED );
+
+     if (! (event->type & window->config.events))
+          return;
+
+     gettimeofday( &event->timestamp, NULL );
+
+     event->clazz     = DFEC_WINDOW;
+     event->window_id = window->id;
+
+     D_ASSUME( window->stack != NULL );
+/*
+     if (window->stack) {
+          CoreWindowStack *stack = window->stack;
+
+          event->cx = stack->cursor.x;
+          event->cy = stack->cursor.y;
+     }
+*/
+     if (!core_window_filter( window, event ))
+          dfb_window_dispatch( window, event, dfb_window_globals );
+}
+
+DFBResult
+dfb_window_send_configuration( CoreWindow *window )
+{
+     DFBWindowEvent event;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     D_ASSUME( !DFB_WINDOW_DESTROYED( window ) );
+
+     event.type = DWET_POSITION_SIZE;
+     event.x    = window->config.bounds.x;
+     event.y    = window->config.bounds.y;
+     event.w    = window->config.bounds.w;
+     event.h    = window->config.bounds.h;
+
+     dfb_window_post_event( window, &event );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_window_request_focus( CoreWindow *window )
+{
+     DFBResult        ret;
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+
+     ret = dfb_wm_request_focus( window );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+DFBWindowID
+dfb_window_id( const CoreWindow *window )
+{
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     return window->id;
+}
+
+/* 
+ * Returns window surface.
+ * For windows with DWCAPS_COLOR this returns 0.
+ */
+CoreSurface *
+dfb_window_surface( const CoreWindow *window )
+{
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     return window->surface;
+}
+
+/******************************************************************************/
+
+static bool
+core_window_filter( CoreWindow *window, const DFBWindowEvent *event )
+{
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     switch (event->type) {
+          case DWET_GOTFOCUS:
+               D_FLAGS_SET( window->flags, CWF_FOCUSED );
+               break;
+
+          case DWET_LOSTFOCUS:
+               D_FLAGS_CLEAR( window->flags, CWF_FOCUSED );
+               break;
+
+          case DWET_ENTER:
+               D_FLAGS_SET( window->flags, CWF_ENTERED );
+               break;
+
+          case DWET_LEAVE:
+               D_FLAGS_CLEAR( window->flags, CWF_ENTERED );
+               break;
+
+          default:
+               break;
+     }
+
+     return false;
+}
+
+DFBResult
+dfb_window_set_rotation( CoreWindow *window,
+                         int         rotation )
+{
+     DFBResult        ret   = DFB_OK;
+     CoreWindowStack *stack = window->stack;
+
+     D_MAGIC_ASSERT( window, CoreWindow );
+
+     stack = window->stack;
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* Never call WM after destroying the window. */
+     if (DFB_WINDOW_DESTROYED( window )) {
+          dfb_windowstack_unlock( stack );
+          return DFB_DESTROYED;
+     }
+     
+     /* Do nothing if the rotation didn't change. */
+     if (window->config.rotation != rotation) {
+          CoreWindowConfig config;
+
+          switch (rotation) {
+               case 0:
+               case 90:
+               case 180:
+               case 270:
+                    config.rotation = rotation;
+
+                    dfb_wm_set_window_config( window, &config, CWCF_ROTATION );
+                    break;
+
+               default:
+                    ret = DFB_UNSUPPORTED;
+          }
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/src/core/windows.h b/Source/DirectFB/src/core/windows.h
new file mode 100755
index 0000000..4b9e2a4
--- /dev/null
+++ b/Source/DirectFB/src/core/windows.h
@@ -0,0 +1,316 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __WINDOWS_H__
+#define __WINDOWS_H__
+
+#include <directfb.h>
+#include <directfb_windows.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <fusion/object.h>
+
+typedef enum {
+     CWMGT_KEYBOARD,
+     CWMGT_POINTER,
+     CWMGT_KEY,
+     CWMGT_UNSELECTED_KEYS,
+} CoreWMGrabTarget;
+
+
+#define CoreWindowConfigFlags DFBWindowConfigFlags
+
+#define CWCF_NONE                  DWCONF_NONE
+#define CWCF_POSITION              DWCONF_POSITION
+#define CWCF_SIZE                  DWCONF_SIZE
+#define CWCF_OPACITY               DWCONF_OPACITY
+#define CWCF_STACKING              DWCONF_STACKING
+#define CWCF_OPTIONS               DWCONF_OPTIONS
+#define CWCF_EVENTS                DWCONF_EVENTS
+#define CWCF_ASSOCIATION           DWCONF_ASSOCIATION
+#define CWCF_COLOR_KEY             DWCONF_COLOR_KEY
+#define CWCF_OPAQUE                DWCONF_OPAQUE
+#define CWCF_COLOR                 DWCONF_COLOR
+#define CWCF_KEY_SELECTION         DWCONF_KEY_SELECTION
+#define CWCF_CURSOR_FLAGS          DWCONF_CURSOR_FLAGS
+#define CWCF_CURSOR_RESOLUTION     DWCONF_CURSOR_RESOLUTION
+#define CWCF_SRC_GEOMETRY          DWCONF_SRC_GEOMETRY
+#define CWCF_DST_GEOMETRY          DWCONF_DST_GEOMETRY
+#define CWCF_ROTATION              DWCONF_ROTATION
+#define CWCF_ALL                   DWCONF_ALL
+
+
+
+struct __DFB_CoreWindowConfig {
+     DFBRectangle             bounds;         /* position and size */
+     int                      opacity;        /* global alpha factor */
+     DFBWindowStackingClass   stacking;       /* level boundaries */
+     DFBWindowOptions         options;        /* flags for appearance/behaviour */
+     DFBWindowEventType       events;         /* mask of enabled events */
+     DFBColor                 color;          /* color for DWCAPS_COLOR */
+     u32                      color_key;      /* transparent pixel */
+     DFBRegion                opaque;         /* region of the window forced to be opaque */
+
+     DFBWindowKeySelection    key_selection;  /* how to filter keys in focus */
+     DFBInputDeviceKeySymbol *keys;           /* list of keys for DWKS_LIST */
+     unsigned int             num_keys;       /* number of entries in key array */
+
+     DFBWindowGeometry        src_geometry;   /* advanced source geometry */
+     DFBWindowGeometry        dst_geometry;   /* advanced destination geometry */
+
+     int                      rotation;
+
+     DFBWindowID              association;
+
+     DFBWindowCursorFlags     cursor_flags;
+     DFBDimension             cursor_resolution;
+};
+
+
+#define TRANSLUCENT_WINDOW(w) ((w)->config.opacity < 0xff || \
+                               (w)->config.options & (DWOP_ALPHACHANNEL | DWOP_COLORKEYING))
+
+#define VISIBLE_WINDOW(w)     (!((w)->caps & DWCAPS_INPUTONLY) && \
+                               (w)->config.opacity > 0 && !DFB_WINDOW_DESTROYED((w)))
+
+
+/*
+ * Creates a pool of window objects.
+ */
+FusionObjectPool *dfb_window_pool_create( const FusionWorld *world );
+
+/*
+ * Generates dfb_window_ref(), dfb_window_attach() etc.
+ */
+FUSION_OBJECT_METHODS( CoreWindow, dfb_window )
+
+/*
+ * creates a window on a given stack
+ */
+DFBResult
+dfb_window_create( CoreWindowStack             *stack,
+                   const DFBWindowDescription  *desc,
+                   CoreWindow                 **ret_window );
+
+/*
+ * deinitializes a window and removes it from the window stack
+ */
+void
+dfb_window_destroy( CoreWindow *window );
+
+/*
+ * moves a window relative to its current position
+ */
+DFBResult
+dfb_window_move( CoreWindow *window,
+                 int         x,
+                 int         y,
+                 bool        relative );
+
+/*
+ * set position and size
+ */
+DFBResult
+dfb_window_set_bounds( CoreWindow *window,
+                       int         x,
+                       int         y,
+                       int         width,
+                       int         height );
+
+/*
+ * resizes a window
+ */
+DFBResult
+dfb_window_resize( CoreWindow   *window,
+                   int           width,
+                   int           height );
+
+/*
+ * binds a window to this window
+ */
+DFBResult
+dfb_window_bind( CoreWindow *window,
+                 CoreWindow *source,
+                 int         x,
+                 int         y );
+
+/*
+ * unbinds a window from this window
+ */
+DFBResult
+dfb_window_unbind( CoreWindow *window,
+                   CoreWindow *source );
+
+/*
+ * changes stacking class
+ */
+DFBResult
+dfb_window_change_stacking( CoreWindow             *window,
+                            DFBWindowStackingClass  stacking );
+
+/*
+ * move a window up one step in window stack
+ */
+DFBResult
+dfb_window_raise( CoreWindow *window );
+
+/*
+ * move a window down one step in window stack
+ */
+DFBResult
+dfb_window_lower( CoreWindow *window );
+
+/*
+ * makes a window the first (topmost) window in the window stack
+ */
+DFBResult
+dfb_window_raisetotop( CoreWindow *window );
+
+/*
+ * makes a window the last (downmost) window in the window stack
+ */
+DFBResult
+dfb_window_lowertobottom( CoreWindow *window );
+
+/*
+ * stacks the window on top of another one
+ */
+DFBResult
+dfb_window_putatop( CoreWindow *window,
+                    CoreWindow *lower );
+
+/*
+ * stacks the window below another one
+ */
+DFBResult
+dfb_window_putbelow( CoreWindow *window,
+                     CoreWindow *upper );
+
+/*
+ * sets the source color key
+ */
+DFBResult
+dfb_window_set_color( CoreWindow *window,
+                      DFBColor    color );
+
+/*
+ * sets the source color key
+ */
+DFBResult
+dfb_window_set_colorkey( CoreWindow *window,
+                         u32         color_key );
+
+/*
+ * change window configuration
+ */
+DFBResult
+dfb_window_set_config( CoreWindow             *window,
+                       const CoreWindowConfig *config,
+                       CoreWindowConfigFlags   flags );
+
+/*
+ * change window cursor
+ */
+DFBResult
+dfb_window_set_cursor_shape( CoreWindow   *window,
+                             CoreSurface  *surface,
+                             unsigned int  hot_x,
+                             unsigned int  hot_y );
+
+/*
+ * sets the global alpha factor
+ */
+DFBResult
+dfb_window_set_opacity( CoreWindow *window,
+                        u8          opacity );
+
+/*
+ * sets the window options
+ */
+DFBResult
+dfb_window_change_options( CoreWindow       *window,
+                           DFBWindowOptions  disable,
+                           DFBWindowOptions  enable );
+
+/*
+ * sets the window options
+ */
+DFBResult
+dfb_window_set_opaque( CoreWindow      *window,
+                       const DFBRegion *region );
+
+/*
+ * manipulates the event mask
+ */
+DFBResult
+dfb_window_change_events( CoreWindow         *window,
+                          DFBWindowEventType  disable,
+                          DFBWindowEventType  enable );
+
+/*
+ * repaints part of a window, if region is NULL the whole window is repainted
+ */
+DFBResult
+dfb_window_repaint( CoreWindow          *window,
+                    const DFBRegion     *region,
+                    DFBSurfaceFlipFlags  flags );
+
+/*
+ * request a window to gain focus
+ */
+DFBResult
+dfb_window_request_focus( CoreWindow *window );
+
+DFBResult dfb_window_set_key_selection( CoreWindow                    *window,
+                                        DFBWindowKeySelection          selection,
+                                        const DFBInputDeviceKeySymbol *keys,
+                                        unsigned int                   num_keys );
+
+DFBResult dfb_window_change_grab    ( CoreWindow                 *window,
+                                      CoreWMGrabTarget            target,
+                                      bool                        grab );
+DFBResult dfb_window_grab_key       ( CoreWindow                 *window,
+                                      DFBInputDeviceKeySymbol     symbol,
+                                      DFBInputDeviceModifierMask  modifiers );
+DFBResult dfb_window_ungrab_key     ( CoreWindow                 *window,
+                                      DFBInputDeviceKeySymbol     symbol,
+                                      DFBInputDeviceModifierMask  modifiers );
+
+void dfb_window_post_event( CoreWindow *window, DFBWindowEvent *event );
+
+DFBResult dfb_window_send_configuration( CoreWindow *window );
+
+DFBWindowID dfb_window_id( const CoreWindow *window );
+
+CoreSurface *dfb_window_surface( const CoreWindow *window );
+
+DFBResult
+dfb_window_set_rotation( CoreWindow *window, int rotation );
+#endif
diff --git a/Source/DirectFB/src/core/windows_internal.h b/Source/DirectFB/src/core/windows_internal.h
new file mode 100755
index 0000000..cededef
--- /dev/null
+++ b/Source/DirectFB/src/core/windows_internal.h
@@ -0,0 +1,211 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__WINDOWS_INTERNAL_H__
+#define __CORE__WINDOWS_INTERNAL_H__
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/windows.h>
+
+#include <direct/list.h>
+#include <fusion/lock.h>
+#include <fusion/object.h>
+
+
+typedef enum {
+     CWF_NONE        = 0x00000000,
+
+     CWF_INITIALIZED = 0x00000001,
+     CWF_FOCUSED     = 0x00000002,
+     CWF_ENTERED     = 0x00000004,
+     CWF_DESTROYED   = 0x00000008,
+
+     CWF_INSERTED    = 0x00000010,
+
+     CWF_ALL         = 0x0000001F
+} CoreWindowFlags;
+
+#define DFB_WINDOW_INITIALIZED(w)  ((w)->flags & CWF_INITIALIZED)
+#define DFB_WINDOW_FOCUSED(w)      ((w)->flags & CWF_FOCUSED)
+#define DFB_WINDOW_ENTERED(w)      ((w)->flags & CWF_ENTERED)
+#define DFB_WINDOW_DESTROYED(w)    ((w)->flags & CWF_DESTROYED)
+
+typedef struct {
+     DirectLink              link;
+
+     CoreWindow             *window;
+     int                     x;
+     int                     y;
+} BoundWindow;
+
+/*
+ * Core data of a window.
+ */
+struct __DFB_CoreWindow {
+     FusionObject            object;
+
+     int                     magic;
+
+     DFBWindowID             id;
+
+     CoreWindowFlags         flags;
+
+     DFBWindowCapabilities   caps;           /* window capabilities, to enable blending etc. */
+
+     CoreWindowConfig        config;
+
+     CoreSurface            *surface;        /* backing store surface */
+     GlobalReaction          surface_reaction;
+
+     CoreWindowStack        *stack;          /* window stack the window belongs */
+
+     CoreLayerRegion        *primary_region; /* default region of context */
+
+     CoreLayerRegion        *region;         /* hardware allocated window */
+
+     void                   *window_data;    /* private data of window manager */
+
+     CoreGraphicsSerial      serial1;
+     CoreGraphicsSerial      serial2;
+
+     DirectLink             *bound_windows;  /* list of bound windows */
+     CoreWindow             *boundto;        /* window to which this window is bound (window binding) */
+
+     DFBWindowID             toplevel_id;    /* in case of a sub window toplevel_id != 0 */
+     CoreWindow             *toplevel;       /* for top level windows this will be NULL */
+     FusionVector            subwindows;     /* list of sub windows (only valid for top level windows) */
+
+     CoreWindow             *subfocus;       /* which of the sub windows has the focus? */
+
+     unsigned long           resource_id;
+
+     struct {
+          unsigned int       hot_x;
+          unsigned int       hot_y;
+          CoreSurface       *surface;
+     } cursor;
+};
+
+typedef enum {
+     CWSF_NONE           = 0x00000000,
+
+     CWSF_INITIALIZED    = 0x00000001,
+     CWSF_ACTIVATED      = 0x00000002,
+
+     CWSF_ALL            = 0x00000003
+} CoreWindowStackFlags;
+
+/*
+ * Core data of a window stack.
+ */
+struct __DFB_CoreWindowStack {
+     DirectLink          link;
+
+     int                 magic;
+
+     CoreLayerContext   *context;
+
+     int                 width;
+     int                 height;
+
+     int                 rotation;
+
+     int                      rotated_width;
+     int                      rotated_height;
+     DFBSurfaceBlittingFlags  rotated_blit;
+
+     DFBWindowID         id_pool;
+
+     int                 num;
+
+     struct {
+          int                enabled;     /* is cursor enabled ? */
+          int                x, y;        /* cursor position */
+          DFBDimension       size;        /* cursor shape size */
+          DFBPoint           hot;         /* hot spot */
+          CoreSurface       *surface;     /* shape */
+          u8                 opacity;     /* cursor opacity */
+          DFBRegion          region;      /* cursor is clipped by this region */
+
+          int                numerator;   /* cursor acceleration */
+          int                denominator;
+          int                threshold;
+
+          bool               set;         /* cursor enable/disable has
+                                             been called at least one time */
+
+          CoreSurfacePolicy  policy;
+     } cursor;
+
+     /* stores information on handling the background on exposure */
+     struct {
+          DFBDisplayLayerBackgroundMode mode;
+                                        /* background handling mode:
+                                           don't care, solid color or image */
+
+          DFBColor            color;    /* color for solid background mode */
+          int                 color_index;
+
+
+          CoreSurface        *image;    /* surface for background image mode */
+
+          GlobalReaction      image_reaction;
+     } bg;
+
+     DirectLink          *devices;      /* input devices attached to the stack */
+
+     bool                 hw_mode;      /* recompositing is done by hardware */
+
+     void                *stack_data;   /* private data of window manager */
+
+     FusionSHMPoolShared *shmpool;
+
+     CoreWindowStackFlags flags;
+
+     Reaction             input_core_reaction;
+};
+
+
+DFBResult dfb_wm_close_all_stacks( void *data );
+
+
+/* global reactions */
+ReactionResult _dfb_windowstack_inputdevice_listener     ( const void *msg_data,
+                                                           void       *ctx );
+
+ReactionResult _dfb_windowstack_background_image_listener( const void *msg_data,
+                                                           void       *ctx );
+
+#endif
diff --git a/Source/DirectFB/src/core/windowstack.c b/Source/DirectFB/src/core/windowstack.c
new file mode 100755
index 0000000..7a19f1c
--- /dev/null
+++ b/Source/DirectFB/src/core/windowstack.c
@@ -0,0 +1,998 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/messages.h>
+
+#include <fusion/reactor.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/input.h>
+#include <core/layer_context.h>
+#include <core/layers_internal.h>
+#include <core/surface.h>
+#include <core/windows_internal.h>
+#include <core/windowstack.h>
+#include <core/wm.h>
+
+#include <misc/conf.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+
+#define CURSORFILE  DATADIR"/cursor.dat"
+
+
+D_DEBUG_DOMAIN( Core_WindowStack, "Core/WindowStack", "DirectFB Core WindowStack" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DirectLink       link;
+
+     DFBInputDeviceID id;
+     Reaction   reaction;
+} StackDevice;
+
+typedef struct {
+     DirectLink                  link;
+
+     DFBInputDeviceKeySymbol     symbol;
+     DFBInputDeviceModifierMask  modifiers;
+
+     CoreWindow                 *owner;
+} GrabbedKey;
+
+/**********************************************************************************************************************/
+
+static DFBResult load_default_cursor  ( CoreDFB         *core,
+                                        CoreWindowStack *stack );
+static DFBResult create_cursor_surface( CoreWindowStack *stack,
+                                        int              width,
+                                        int              height );
+
+/**********************************************************************************************************************/
+
+static DFBEnumerationResult stack_attach_devices( CoreInputDevice *device,
+                                                  void            *ctx );
+
+static ReactionResult stack_input_core_listener( const void *msg_data,
+                                                 void       *ctx );
+
+/**********************************************************************************************************************/
+
+/*
+ * Allocates and initializes a window stack.
+ */
+CoreWindowStack*
+dfb_windowstack_create( CoreLayerContext *context )
+{
+     DFBResult          ret;
+     CoreWindowStack   *stack;
+     CoreSurfacePolicy  policy = CSP_SYSTEMONLY;
+     CoreLayer         *layer;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p )\n", __FUNCTION__, context );
+
+     D_ASSERT( context != NULL );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     /* Allocate window stack data (completely shared) */
+     stack = (CoreWindowStack*) SHCALLOC( context->shmpool, 1, sizeof(CoreWindowStack) );
+     if (!stack) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     stack->shmpool = context->shmpool;
+
+     /* Store context which we belong to. */
+     stack->context = context;
+
+     /* Set default acceleration */
+     stack->cursor.numerator   = 2;
+     stack->cursor.denominator = 1;
+     stack->cursor.threshold   = 4;
+
+     /* Choose cursor surface policy. */
+     if (context->config.buffermode != DLBM_BACKSYSTEM) {
+          CardCapabilities card_caps;
+
+          /* Use the explicitly specified policy? */
+          if (dfb_config->window_policy != -1)
+               policy = dfb_config->window_policy;
+          else {
+               /* Examine the hardware capabilities. */
+               dfb_gfxcard_get_capabilities( &card_caps );
+
+               if (card_caps.accel & DFXL_BLIT && card_caps.blitting & DSBLIT_BLEND_ALPHACHANNEL)
+                    policy = CSP_VIDEOHIGH;
+          }
+     }
+
+     stack->cursor.policy  = policy;
+     stack->cursor.opacity = 0xFF;
+
+     /* Set default background mode. */
+     stack->bg.mode        = DLBM_DONTCARE;
+     stack->bg.color_index = -1;
+
+     D_MAGIC_SET( stack, CoreWindowStack );
+
+     /* Initialize window manager */
+     ret = dfb_wm_init_stack( stack );
+     if (ret) {
+          D_MAGIC_CLEAR( stack );
+          SHFREE( context->shmpool, stack );
+          return NULL;
+     }
+
+     if (dfb_core_is_master( layer->core ))
+          dfb_input_core_attach( layer->core, stack_input_core_listener, stack, &stack->input_core_reaction );
+
+     /* Attach to all input devices */
+     dfb_input_enumerate_devices( stack_attach_devices, stack, DICAPS_ALL );
+
+     D_DEBUG_AT( Core_WindowStack, "  -> %p\n", stack );
+
+     return stack;
+}
+
+void
+dfb_windowstack_detach_devices( CoreWindowStack *stack )
+{
+     DirectLink *l;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Detach all input devices. */
+     l = stack->devices;
+     while (l) {
+          DirectLink  *next   = l->next;
+          StackDevice *device = (StackDevice*) l;
+
+          dfb_input_detach( dfb_input_device_at( device->id ),
+                                   &device->reaction );
+
+          SHFREE( stack->shmpool, device );
+
+          l = next;
+     }
+}
+
+void
+dfb_windowstack_destroy( CoreWindowStack *stack )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     if (stack->input_core_reaction.func)
+          dfb_input_core_detach( NULL, &stack->input_core_reaction );
+
+     /* Unlink cursor surface. */
+     if (stack->cursor.surface)
+          dfb_surface_unlink( &stack->cursor.surface );
+
+     /* Shutdown window manager? */
+     if (stack->flags & CWSF_INITIALIZED)
+          dfb_wm_close_stack( stack );
+
+     /* detach listener from background surface and unlink it */
+     if (stack->bg.image) {
+          dfb_surface_detach_global( stack->bg.image,
+                                     &stack->bg.image_reaction );
+
+          dfb_surface_unlink( &stack->bg.image );
+     }
+
+     /* Deallocate shared stack data. */
+     if (stack->stack_data) {
+          SHFREE( stack->shmpool, stack->stack_data );
+          stack->stack_data = NULL;
+     }
+
+     D_MAGIC_CLEAR( stack );
+
+     /* Free stack data. */
+     SHFREE( stack->shmpool, stack );
+}
+
+void
+dfb_windowstack_resize( CoreWindowStack *stack,
+                        int              width,
+                        int              height,
+                        int              rotation )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %dx%d, %d )\n", __FUNCTION__, stack, width, height, rotation );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return;
+
+     /* Store the width and height of the stack */
+     stack->width    = width;
+     stack->height   = height;
+     stack->rotation = rotation;
+
+     switch (stack->rotation) {
+          default:
+               D_BUG( "invalid rotation %d", stack->rotation );
+          case 0:
+               stack->rotated_blit   = DSBLIT_NOFX;
+               stack->rotated_width  = stack->width;
+               stack->rotated_height = stack->height;
+               break;
+
+          case 90:
+               stack->rotated_blit   = DSBLIT_ROTATE90;
+               stack->rotated_width  = stack->height;
+               stack->rotated_height = stack->width;
+               break;
+
+          case 180:
+               stack->rotated_blit   = DSBLIT_ROTATE180;
+               stack->rotated_width  = stack->width;
+               stack->rotated_height = stack->height;
+               break;
+
+          case 270:
+               stack->rotated_blit   = DSBLIT_ROTATE270;
+               stack->rotated_width  = stack->height;
+               stack->rotated_height = stack->width;
+               break;
+     }
+
+     /* Setup new cursor clipping region */
+     stack->cursor.region.x1 = 0;
+     stack->cursor.region.y1 = 0;
+     stack->cursor.region.x2 = width - 1;
+     stack->cursor.region.y2 = height - 1;
+
+     /* Notify the window manager. */
+     dfb_wm_resize_stack( stack, width, height );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+}
+
+/*
+ * Prohibit access to the window stack data.
+ * Waits until stack is accessible.
+ */
+DirectResult
+dfb_windowstack_lock( CoreWindowStack *stack )
+{
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->context != NULL );
+
+     return dfb_layer_context_lock( stack->context );
+}
+
+/*
+ * Allow access to the window stack data.
+ */
+DirectResult
+dfb_windowstack_unlock( CoreWindowStack *stack )
+{
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->context != NULL );
+
+     return dfb_layer_context_unlock( stack->context );
+}
+
+DFBResult
+dfb_windowstack_repaint_all( CoreWindowStack *stack )
+{
+     DFBResult ret;
+     DFBRegion region;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     region.x1 = 0;
+     region.y1 = 0;
+     region.x2 = stack->rotated_width  - 1;
+     region.y2 = stack->rotated_height - 1;
+
+     ret = dfb_wm_update_stack( stack, ®ion, 0 );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * background handling
+ */
+
+DFBResult
+dfb_windowstack_set_background_mode ( CoreWindowStack               *stack,
+                                      DFBDisplayLayerBackgroundMode  mode )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %d )\n", __FUNCTION__, stack, mode );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* nothing to do if mode is the same */
+     if (mode != stack->bg.mode) {
+          /* for these modes a surface is required */
+          if ((mode == DLBM_IMAGE || mode == DLBM_TILE) && !stack->bg.image) {
+               dfb_windowstack_unlock( stack );
+               return DFB_MISSINGIMAGE;
+          }
+
+          /* set new mode */
+          stack->bg.mode = mode;
+
+          /* force an update of the window stack */
+          if (mode != DLBM_DONTCARE)
+               dfb_windowstack_repaint_all( stack );
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_set_background_image( CoreWindowStack *stack,
+                                      CoreSurface     *image )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p )\n", __FUNCTION__, stack, image );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( image != NULL );
+
+     if (!(image->type & CSTF_SHARED))
+          return DFB_INVARG;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* if the surface is changed */
+     if (stack->bg.image != image) {
+          /* detach listener from old surface and unlink it */
+          if (stack->bg.image) {
+               dfb_surface_detach_global( stack->bg.image,
+                                          &stack->bg.image_reaction );
+
+               dfb_surface_unlink( &stack->bg.image );
+          }
+
+          /* link surface object */
+          dfb_surface_link( &stack->bg.image, image );
+
+          /* attach listener to new surface */
+          dfb_surface_attach_global( image,
+                                     DFB_WINDOWSTACK_BACKGROUND_IMAGE_LISTENER,
+                                     stack, &stack->bg.image_reaction );
+     }
+
+     /* force an update of the window stack */
+     if (stack->bg.mode == DLBM_IMAGE || stack->bg.mode == DLBM_TILE)
+          dfb_windowstack_repaint_all( stack );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_set_background_color( CoreWindowStack *stack,
+                                      const DFBColor  *color )
+{
+     D_ASSERT( color != NULL );
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, 0x%08x )\n", __FUNCTION__, stack,
+                 PIXEL_ARGB( color->a, color->r, color->g, color->b ) );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* do nothing if color didn't change */
+     if (!DFB_COLOR_EQUAL( stack->bg.color, *color )) {
+          /* set new color */
+          stack->bg.color = *color;
+
+          /* force an update of the window stack */
+          if (stack->bg.mode == DLBM_COLOR)
+               dfb_windowstack_repaint_all( stack );
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_set_background_color_index( CoreWindowStack *stack,
+                                            int              index )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %d )\n", __FUNCTION__, stack, index );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     /* do nothing if color didn't change */
+     if (stack->bg.color_index != index) {
+          /* set new color index */
+          stack->bg.color_index = index;
+
+          /* force an update of the window stack */
+          if (stack->bg.mode == DLBM_COLOR)
+               dfb_windowstack_repaint_all( stack );
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * cursor control
+ */
+
+DFBResult
+dfb_windowstack_cursor_enable( CoreDFB *core, CoreWindowStack *stack, bool enable )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %s )\n", __FUNCTION__, stack, enable ? "enable" : "disable" );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     stack->cursor.set = true;
+
+     if (dfb_config->no_cursor || stack->cursor.enabled == enable) {
+          dfb_windowstack_unlock( stack );
+          return DFB_OK;
+     }
+
+     if (enable && !stack->cursor.surface) {
+          ret = load_default_cursor( core, stack );
+          if (ret) {
+               dfb_windowstack_unlock( stack );
+               return ret;
+          }
+     }
+
+     /* Keep state. */
+     stack->cursor.enabled = enable;
+
+     /* Notify WM. */
+     dfb_wm_update_cursor( stack, enable ? CCUF_ENABLE : CCUF_DISABLE );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_cursor_set_opacity( CoreWindowStack *stack, u8 opacity )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, 0x%02x )\n", __FUNCTION__, stack, opacity );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     if (stack->cursor.opacity != opacity) {
+          /* Set new opacity. */
+          stack->cursor.opacity = opacity;
+          
+          /* Notify WM. */
+          if (stack->cursor.enabled)
+               dfb_wm_update_cursor( stack, CCUF_OPACITY );
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_cursor_set_shape( CoreWindowStack *stack,
+                                  CoreSurface     *shape,
+                                  int              hot_x,
+                                  int              hot_y )
+{
+     DFBResult              ret;
+     CoreSurface           *cursor;
+     CoreCursorUpdateFlags  flags = CCUF_SHAPE;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p, hot %d, %d ) <- size %dx%d\n",
+                 __FUNCTION__, stack, shape, hot_x, hot_y,
+                 shape->config.size.w, shape->config.size.h );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( shape != NULL );
+
+     if (dfb_config->no_cursor)
+          return DFB_OK;
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     cursor = stack->cursor.surface;
+     if (!cursor) {
+          D_ASSUME( !stack->cursor.enabled );
+
+          /* Create the a surface for the shape. */
+          ret = create_cursor_surface( stack, shape->config.size.w, shape->config.size.h );
+          if (ret) {
+               dfb_windowstack_unlock( stack );
+               return ret;
+          }
+
+          cursor = stack->cursor.surface;
+     }
+     else if (stack->cursor.size.w != shape->config.size.w || stack->cursor.size.h != shape->config.size.h) {
+          dfb_surface_unlink( &stack->cursor.surface );
+
+          /* Recreate the surface for the shape. */
+          ret = create_cursor_surface( stack, shape->config.size.w, shape->config.size.h );
+          if (ret) {
+               dfb_windowstack_unlock( stack );
+               return ret;
+          }
+
+          cursor = stack->cursor.surface;
+
+
+          stack->cursor.size.w = shape->config.size.w;
+          stack->cursor.size.h = shape->config.size.h;
+
+          /* Notify about new size/shape. */
+          flags |= CCUF_SIZE | CCUF_SHAPE;
+     }
+
+     if (stack->cursor.hot.x != hot_x || stack->cursor.hot.y != hot_y) {
+          stack->cursor.hot.x = hot_x;
+          stack->cursor.hot.y = hot_y;
+
+          /* Notify about new position. */
+          flags |= CCUF_POSITION;
+     }
+
+     /* Copy the content of the new shape. */
+     dfb_gfx_copy( shape, cursor, NULL );
+
+     cursor->config.caps = ((cursor->config.caps & ~DSCAPS_PREMULTIPLIED) | (shape->config.caps & DSCAPS_PREMULTIPLIED));
+
+     /* Notify the WM. */
+     if (stack->cursor.enabled)
+          dfb_wm_update_cursor( stack, flags );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_cursor_warp( CoreWindowStack *stack, int x, int y )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %d, %d )\n", __FUNCTION__, stack, x, y );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     if (x < 0)
+          x = 0;
+     else if (x > stack->width - 1)
+          x = stack->width - 1;
+
+     if (y < 0)
+          y = 0;
+     else if (y > stack->height - 1)
+          y = stack->height - 1;
+
+     if (stack->cursor.x != x || stack->cursor.y != y) {
+          stack->cursor.x = x;
+          stack->cursor.y = y;
+
+          /* Notify the WM. */
+          if (stack->cursor.enabled)
+               dfb_wm_update_cursor( stack, CCUF_POSITION );
+     }
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_cursor_set_acceleration( CoreWindowStack *stack,
+                                         int              numerator,
+                                         int              denominator,
+                                         int              threshold )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %d, %d, %d )\n",
+                 __FUNCTION__, stack, numerator, denominator, threshold );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     stack->cursor.numerator   = numerator;
+     stack->cursor.denominator = denominator;
+     stack->cursor.threshold   = threshold;
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_windowstack_get_cursor_position( CoreWindowStack *stack, int *ret_x, int *ret_y )
+{
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p, %p )\n", __FUNCTION__, stack, ret_x, ret_y );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSUME( ret_x != NULL || ret_y != NULL );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return DFB_FUSION;
+
+     if (ret_x)
+          *ret_x = stack->cursor.x;
+
+     if (ret_y)
+          *ret_y = stack->cursor.y;
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static ReactionResult
+stack_input_core_listener( const void *msg_data,
+                           void       *ctx )
+{
+     const CoreInputCoreNotification *notification = msg_data;
+     CoreWindowStack                 *stack        = ctx;
+
+     (void) notification;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p, %d )\n", __FUNCTION__, msg_data, ctx, notification->device_id );
+
+     D_ASSERT( msg_data != NULL );
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return RS_REMOVE;
+
+     /* Attach to all input devices */
+     dfb_input_enumerate_devices( stack_attach_devices, stack, DICAPS_ALL );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return RS_OK;
+}
+
+ReactionResult
+_dfb_windowstack_inputdevice_listener( const void *msg_data,
+                                       void       *ctx )
+{
+     const DFBInputEvent *event = msg_data;
+     CoreWindowStack     *stack = ctx;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( msg_data != NULL );
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     /* Lock the window stack. */
+     if (dfb_windowstack_lock( stack ))
+          return RS_REMOVE;
+
+     /* Call the window manager to dispatch the event. */
+     if (dfb_layer_context_active( stack->context ))
+          dfb_wm_process_input( stack, event );
+
+     /* Unlock the window stack. */
+     dfb_windowstack_unlock( stack );
+
+     return RS_OK;
+}
+
+/*
+ * listen to the background image
+ */
+ReactionResult
+_dfb_windowstack_background_image_listener( const void *msg_data,
+                                            void       *ctx )
+{
+     const CoreSurfaceNotification *notification = msg_data;
+     CoreWindowStack               *stack        = ctx;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %p )\n", __FUNCTION__, msg_data, ctx );
+
+     D_ASSERT( notification != NULL );
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     if (notification->flags & CSNF_DESTROY) {
+          if (stack->bg.image == notification->surface) {
+               D_ERROR( "Core/WindowStack: Surface for background vanished.\n" );
+
+               stack->bg.mode  = DLBM_COLOR;
+               stack->bg.image = NULL;
+
+               dfb_windowstack_repaint_all( stack );
+          }
+
+          return RS_REMOVE;
+     }
+
+     if (notification->flags & (CSNF_FLIP | CSNF_SIZEFORMAT))
+          dfb_windowstack_repaint_all( stack );
+
+     return RS_OK;
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * internals
+ */
+
+static DFBEnumerationResult
+stack_attach_devices( CoreInputDevice *device,
+                      void            *ctx )
+{
+     StackDevice     *dev;
+     DFBInputDeviceID  id    = dfb_input_device_id( device );
+     CoreWindowStack *stack = (CoreWindowStack*) ctx;
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     direct_list_foreach (dev, stack->devices) {
+          if (dev->id == id)
+               return DFENUM_OK;
+     }
+
+     dev = SHCALLOC( stack->shmpool, 1, sizeof(StackDevice) );
+     if (!dev) {
+          D_ERROR( "Core/WindowStack: Could not allocate %zu bytes\n", sizeof(StackDevice) );
+          return DFENUM_CANCEL;
+     }
+
+     dev->id = id;
+
+     direct_list_prepend( &stack->devices, &dev->link );
+
+     dfb_input_attach( device, _dfb_windowstack_inputdevice_listener, ctx, &dev->reaction );
+
+     return DFENUM_OK;
+}
+
+/*
+ * internal function that installs the cursor window
+ * and fills it with data from 'cursor.dat'
+ */
+static DFBResult
+load_default_cursor( CoreDFB *core, CoreWindowStack *stack )
+{
+     DFBResult              ret;
+     int                    i;
+     FILE                  *f;
+     CoreSurfaceBufferLock  lock;
+     void                  *data;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     if (!stack->cursor.surface) {
+          ret = create_cursor_surface( stack, 40, 40 );
+          if (ret)
+               return ret;
+     }
+     else {
+          stack->cursor.hot.x  = 0;
+          stack->cursor.hot.y  = 0;
+          stack->cursor.size.w = 40;
+          stack->cursor.size.h = 40;
+     }
+
+     /* lock the cursor surface */
+     ret = dfb_surface_lock_buffer( stack->cursor.surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock );
+     if (ret) {
+          D_ERROR( "Core/WindowStack: cannot lock the cursor surface!\n" );
+          return ret;
+     }
+
+     data = lock.addr;
+
+     /* initialize as empty cursor */
+     memset( data, 0, 40 * lock.pitch );
+
+     /* open the file containing the cursors image data */
+     f = fopen( CURSORFILE, "rb" );
+     if (!f) {
+          ret = errno2result( errno );
+
+          /* ignore a missing cursor file */
+          if (ret == DFB_FILENOTFOUND)
+               ret = DFB_OK;
+          else
+               D_PERROR( "Core/WindowStack: `" CURSORFILE "` could not be opened!\n" );
+
+          goto finish;
+     }
+
+     /* read from file directly into the cursor window surface */
+     for (i=0; i<40; i++) {
+          if (fread( data, MIN (40*4, lock.pitch), 1, f ) != 1) {
+               ret = errno2result( errno );
+
+               D_ERROR( "Core/WindowStack: unexpected end or read error of cursor data!\n" );
+
+               goto finish;
+          }
+#ifdef WORDS_BIGENDIAN
+          {
+               int i = MIN (40, lock.pitch/4);
+               u32 *tmp_data = data;
+
+               while (i--) {
+                    *tmp_data = (*tmp_data & 0xFF000000) >> 24 |
+                                (*tmp_data & 0x00FF0000) >>  8 |
+                                (*tmp_data & 0x0000FF00) <<  8 |
+                                (*tmp_data & 0x000000FF) << 24;
+                    ++tmp_data;
+               }
+          }
+#endif
+          data += lock.pitch;
+     }
+
+finish:
+     if (f)
+          fclose( f );
+
+     dfb_surface_unlock_buffer( stack->cursor.surface, &lock );
+
+     return ret;
+}
+
+static DFBResult
+create_cursor_surface( CoreWindowStack *stack,
+                       int              width,
+                       int              height )
+{
+     DFBResult               ret;
+     CoreSurface            *surface;
+     CoreLayer              *layer;
+     CoreLayerContext       *context;
+     DFBSurfaceCapabilities  surface_caps = DSCAPS_NONE;
+
+     D_DEBUG_AT( Core_WindowStack, "%s( %p, %dx%d )\n", __FUNCTION__, stack, width, height );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->cursor.surface == NULL );
+
+     context = stack->context;
+
+     D_ASSERT( context != NULL );
+
+     layer = dfb_layer_at( context->layer_id );
+
+     D_ASSERT( layer != NULL );
+
+     stack->cursor.x       = stack->width  / 2;
+     stack->cursor.y       = stack->height / 2;
+     stack->cursor.hot.x   = 0;
+     stack->cursor.hot.y   = 0;
+     stack->cursor.size.w  = width;
+     stack->cursor.size.h  = height;
+
+     if (context->config.buffermode == DLBM_WINDOWS)
+          D_WARN( "cursor not yet visible with DLBM_WINDOWS" );
+
+     dfb_surface_caps_apply_policy( stack->cursor.policy, &surface_caps );
+
+     /* Create the cursor surface. */
+     ret = dfb_surface_create_simple( layer->core, width, height, DSPF_ARGB,
+                                      surface_caps, CSTF_SHARED | CSTF_CURSOR,
+                                      0, /* FIXME: no shared cursor objects, no cursor id */
+                                      NULL, &surface );
+     if (ret) {
+          D_ERROR( "Core/WindowStack: Failed creating a surface for software cursor!\n" );
+          return ret;
+     }
+
+     dfb_surface_globalize( surface );
+
+     stack->cursor.surface = surface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/core/windowstack.h b/Source/DirectFB/src/core/windowstack.h
new file mode 100755
index 0000000..6d7bed5
--- /dev/null
+++ b/Source/DirectFB/src/core/windowstack.h
@@ -0,0 +1,105 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__WINDOWSTACK_H__
+#define __CORE__WINDOWSTACK_H__
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <fusion/lock.h>
+
+/*
+ * allocates a WindowStack, initializes it, registers it for input events
+ */
+CoreWindowStack *dfb_windowstack_create ( CoreLayerContext *context );
+
+void             dfb_windowstack_detach_devices( CoreWindowStack  *stack );
+
+void             dfb_windowstack_destroy( CoreWindowStack  *stack );
+
+void             dfb_windowstack_resize ( CoreWindowStack  *stack,
+                                          int               width,
+                                          int               height,
+                                          int               rotation );
+
+DirectResult     dfb_windowstack_lock   ( CoreWindowStack  *stack );
+
+DirectResult     dfb_windowstack_unlock ( CoreWindowStack  *stack );
+
+/*
+ * repaints all window on a window stack
+ */
+DFBResult dfb_windowstack_repaint_all( CoreWindowStack *stack );
+
+/*
+ * background handling
+ */
+DFBResult dfb_windowstack_set_background_mode ( CoreWindowStack               *stack,
+                                                DFBDisplayLayerBackgroundMode  mode );
+
+DFBResult dfb_windowstack_set_background_image( CoreWindowStack               *stack,
+                                                CoreSurface                   *image );
+
+DFBResult dfb_windowstack_set_background_color( CoreWindowStack               *stack,
+                                                const DFBColor                *color );
+
+DFBResult dfb_windowstack_set_background_color_index( CoreWindowStack         *stack,
+                                                      int                      index );
+
+
+/*
+ * cursor control
+ */
+DFBResult dfb_windowstack_cursor_enable( CoreDFB         *core,
+                                         CoreWindowStack *stack,
+                                         bool             enable );
+
+DFBResult dfb_windowstack_cursor_set_shape( CoreWindowStack *stack,
+                                            CoreSurface     *shape,
+                                            int              hot_x,
+                                            int              hot_y );
+
+DFBResult dfb_windowstack_cursor_set_opacity( CoreWindowStack *stack,
+                                              u8               opacity );
+
+DFBResult dfb_windowstack_cursor_set_acceleration( CoreWindowStack *stack,
+                                                   int              numerator,
+                                                   int              denominator,
+                                                   int              threshold );
+
+DFBResult dfb_windowstack_cursor_warp( CoreWindowStack *stack,
+                                       int              x,
+                                       int              y );
+
+
+DFBResult dfb_windowstack_get_cursor_position (CoreWindowStack *stack,
+                                               int             *x,
+                                               int             *y);
+
+#endif
diff --git a/Source/DirectFB/src/core/wm.c b/Source/DirectFB/src/core/wm.c
new file mode 100755
index 0000000..fb9148c
--- /dev/null
+++ b/Source/DirectFB/src/core/wm.c
@@ -0,0 +1,1440 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/modules.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/core_parts.h>
+#include <core/layer_context.h>
+#include <core/layers_internal.h>
+#include <core/windowstack.h>
+#include <core/windows_internal.h>
+#include <core/wm.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+
+DEFINE_MODULE_DIRECTORY( dfb_core_wm_modules, "wm", DFB_CORE_WM_ABI_VERSION );
+
+
+D_DEBUG_DOMAIN( Core_WM, "Core/WM", "DirectFB WM Core" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                  magic;
+
+     DirectLink          *stacks;
+
+     int                  abi;
+
+     char                *name;
+     CoreWMInfo           info;
+     void                *data;
+
+     FusionSHMPoolShared *shmpool;
+
+     FusionReactor       *reactor;
+} DFBWMCoreShared;
+
+struct __DFB_DFBWMCore {
+     int                magic;
+
+     CoreDFB           *core;
+
+     DFBWMCoreShared   *shared;
+
+
+     DirectModuleEntry *module;
+     const CoreWMFuncs *funcs;
+     void              *data;
+};
+
+
+DFB_CORE_PART( wm_core, WMCore );
+
+/**********************************************************************************************************************/
+
+static DFBResult load_module( const char *name );
+
+/**********************************************************************************************************************/
+
+static DFBWMCore       *wm_local  = NULL;  /* FIXME */
+static DFBWMCoreShared *wm_shared = NULL;  /* FIXME */
+
+
+static DFBResult
+dfb_wm_core_initialize( CoreDFB         *core,
+                        DFBWMCore       *data,
+                        DFBWMCoreShared *shared )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_WM, "dfb_wm_core_initialize( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( shared != NULL );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     wm_local  = data;   /* FIXME */
+     wm_shared = shared; /* FIXME */
+
+     wm_shared->shmpool = dfb_core_shmpool( core );
+
+     /* Set ABI version for the session. */
+     wm_shared->abi = DFB_CORE_WM_ABI_VERSION;
+
+     /* Load the module. */
+     ret = load_module( dfb_config->wm );
+     if (ret)
+          goto error;
+
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->GetWMInfo != NULL );
+     D_ASSERT( wm_local->funcs->Initialize != NULL );
+
+     /* Query module information. */
+     wm_local->funcs->GetWMInfo( &wm_shared->info );
+
+     D_INFO( "DirectFB/Core/WM: %s %d.%d (%s)\n",
+             wm_shared->info.name, wm_shared->info.version.major,
+             wm_shared->info.version.minor, wm_shared->info.vendor );
+
+     ret = DFB_NOSHAREDMEMORY;
+
+     /* Store module name in shared memory. */
+     wm_shared->name = SHSTRDUP( wm_shared->shmpool, wm_local->module->name );
+     if (!wm_shared->name) {
+          D_OOSHM();
+          goto error;
+     }
+
+     /* Allocate shared window manager data. */
+     if (wm_shared->info.wm_shared_size) {
+          wm_shared->data = SHCALLOC( wm_shared->shmpool, 1, wm_shared->info.wm_shared_size );
+          if (!wm_shared->data) {
+               D_OOSHM();
+               goto error;
+          }
+     }
+
+     ret = DFB_NOSYSTEMMEMORY;
+
+     /* Allocate local window manager data. */
+     if (wm_shared->info.wm_data_size) {
+          wm_local->data = D_CALLOC( 1, wm_shared->info.wm_data_size );
+          if (!wm_local->data) {
+               D_OOM();
+               goto error;
+          }
+     }
+
+     wm_shared->reactor = fusion_reactor_new( 0, "WM", dfb_core_world(core) );
+
+     /* Initialize window manager. */
+     ret = wm_local->funcs->Initialize( core, wm_local->data, wm_shared->data );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/Core/WM: Could not initialize window manager!\n" );
+          goto error;
+     }
+
+     D_MAGIC_SET( data, DFBWMCore );
+     D_MAGIC_SET( shared, DFBWMCoreShared );
+
+     return DFB_OK;
+
+error:
+     if (wm_local->data)
+          D_FREE( wm_local->data );
+
+     if (wm_shared->data)
+          SHFREE( wm_shared->shmpool, wm_shared->data );
+
+     if (wm_shared->name)
+          SHFREE( wm_shared->shmpool, wm_shared->name );
+
+     wm_local = NULL;
+     wm_shared = NULL;
+
+     return ret;
+}
+
+static DFBResult
+dfb_wm_core_join( CoreDFB         *core,
+                  DFBWMCore       *data,
+                  DFBWMCoreShared *shared )
+{
+     DFBResult  ret;
+     CoreWMInfo info;
+
+     D_DEBUG_AT( Core_WM, "dfb_wm_core_join( %p, %p, %p )\n", core, data, shared );
+
+     D_ASSERT( data != NULL );
+     D_MAGIC_ASSERT( shared, DFBWMCoreShared );
+
+     data->core   = core;
+     data->shared = shared;
+
+
+     wm_local  = data;   /* FIXME */
+     wm_shared = shared; /* FIXME */
+
+     /* Check binary version numbers. */
+     if (wm_shared->abi != DFB_CORE_WM_ABI_VERSION) {
+          D_ERROR( "DirectFB/Core/WM: ABI version of running core instance (%d) doesn't match %d!\n",
+                   wm_shared->abi, DFB_CORE_WM_ABI_VERSION );
+          ret = DFB_VERSIONMISMATCH;
+          goto error;
+     }
+
+     /* Load the module that is used by the running session. */
+     ret = load_module( wm_shared->name );
+     if (ret)
+          goto error;
+
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->GetWMInfo != NULL );
+     D_ASSERT( wm_local->funcs->Join != NULL );
+
+     /* Query module information. */
+     wm_local->funcs->GetWMInfo( &info );
+
+     /* Check binary version numbers. */
+     if (info.version.binary != wm_shared->info.version.binary) {
+          D_ERROR( "DirectFB/Core/WM: ABI version of running module instance (%d) doesn't match %d!\n",
+                   wm_shared->info.version.binary, info.version.binary );
+          ret = DFB_VERSIONMISMATCH;
+          goto error;
+     }
+
+     /* Allocate window manager data. */
+     if (wm_shared->info.wm_data_size) {
+          wm_local->data = D_CALLOC( 1, wm_shared->info.wm_data_size );
+          if (!wm_local->data) {
+               D_WARN( "out of memory" );
+               ret = DFB_NOSYSTEMMEMORY;
+               goto error;
+          }
+     }
+
+     /* Join window manager. */
+     ret = wm_local->funcs->Join( core, wm_local->data, wm_shared->data );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/Core/WM: Could not join window manager!\n" );
+          goto error;
+     }
+
+     D_MAGIC_SET( data, DFBWMCore );
+
+     return DFB_OK;
+
+error:
+     if (wm_local->data)
+          D_FREE( wm_local->data );
+
+     wm_local = NULL;
+     wm_shared = NULL;
+
+     return ret;
+}
+
+static DFBResult
+dfb_wm_core_shutdown( DFBWMCore *data,
+                      bool       emergency )
+{
+     DFBResult        ret;
+     DFBWMCoreShared *shared;
+
+     D_DEBUG_AT( Core_WM, "dfb_wm_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBWMCore );
+     D_MAGIC_ASSERT( data->shared, DFBWMCoreShared );
+
+     shared = data->shared;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Shutdown != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     fusion_reactor_destroy( wm_shared->reactor );
+
+     /* Shutdown window manager. */
+     ret = wm_local->funcs->Shutdown( emergency, wm_local->data, wm_shared->data );
+
+     /* Unload the module. */
+     direct_module_unref( wm_local->module );
+
+     /* Deallocate local window manager data. */
+     if (wm_local->data)
+          D_FREE( wm_local->data );
+
+     /* Deallocate shared window manager data. */
+     if (wm_shared->data)
+          SHFREE( wm_shared->shmpool, wm_shared->data );
+
+     /* Free module name in shared memory. */
+     SHFREE( wm_shared->shmpool, wm_shared->name );
+
+     wm_local = NULL;
+     wm_shared = NULL;
+
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( shared );
+
+     return ret;
+}
+
+static DFBResult
+dfb_wm_core_leave( DFBWMCore *data,
+                    bool        emergency )
+{
+     DFBResult         ret;
+     DFBWMCoreShared *shared;
+
+     D_DEBUG_AT( Core_WM, "dfb_wm_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );
+
+     D_MAGIC_ASSERT( data, DFBWMCore );
+     D_MAGIC_ASSERT( data->shared, DFBWMCoreShared );
+
+     shared = data->shared;
+
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Leave != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     /* Leave window manager. */
+     ret = wm_local->funcs->Leave( emergency, wm_local->data, wm_shared->data );
+
+     /* Unload the module. */
+     direct_module_unref( wm_local->module );
+
+     /* Deallocate local window manager data. */
+     if (wm_local->data)
+          D_FREE( wm_local->data );
+
+     wm_local = NULL;
+     wm_shared = NULL;
+
+
+     D_MAGIC_CLEAR( data );
+
+     return ret;
+}
+
+static DFBResult
+dfb_wm_core_suspend( DFBWMCore *data )
+{
+     DFBWMCoreShared *shared;
+
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, data );
+
+     D_MAGIC_ASSERT( data, DFBWMCore );
+     D_MAGIC_ASSERT( data->shared, DFBWMCoreShared );
+
+     shared = data->shared;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Suspend != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     return wm_local->funcs->Suspend( wm_local->data, wm_shared->data );
+}
+
+static DFBResult
+dfb_wm_core_resume( DFBWMCore *data )
+{
+     DFBWMCoreShared *shared;
+
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, data );
+
+     D_MAGIC_ASSERT( data, DFBWMCore );
+     D_MAGIC_ASSERT( data->shared, DFBWMCoreShared );
+
+     shared = data->shared;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Resume != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     return wm_local->funcs->Resume( wm_local->data, wm_shared->data );
+}
+
+DFBResult
+dfb_wm_close_all_stacks( void *data )
+{
+     CoreLayerContext *context;
+     CoreWindowStack  *stack, *next;
+     DFBWMCore        *local;
+     DFBWMCoreShared  *shared;
+
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, data );
+
+     local = data;
+
+     D_MAGIC_ASSERT( local, DFBWMCore );
+     D_ASSERT( local->funcs != NULL );
+     D_ASSERT( local->funcs->CloseStack != NULL );
+
+     shared = local->shared;
+
+     D_MAGIC_ASSERT( shared, DFBWMCoreShared );
+
+     D_DEBUG_AT( Core_WM, "  -> checking %d stacks...\n", direct_list_count_elements_EXPENSIVE(shared->stacks) );
+
+     direct_list_foreach_safe (stack, next, shared->stacks) {
+          D_DEBUG_AT( Core_WM, "  -> checking %p...\n", stack );
+
+          D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+          context = stack->context;
+          D_MAGIC_ASSERT( context, CoreLayerContext );
+
+          D_DEBUG_AT( Core_WM, "  -> ref context %p...\n", context );
+
+          dfb_layer_context_ref( context );
+
+          dfb_layer_context_lock( context );
+
+          if (stack->flags & CWSF_INITIALIZED) {
+               D_DEBUG_AT( Core_WM, "  => CLOSING %p\n", stack );
+               dfb_wm_close_stack( stack );
+          }
+
+          dfb_layer_context_unlock( context );
+
+          D_DEBUG_AT( Core_WM, "  -> unref context %p...\n", context );
+
+          dfb_layer_context_unref( context );
+     }
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+load_module( const char *name )
+{
+     DirectLink *l;
+
+     D_ASSERT( wm_local != NULL );
+
+     direct_modules_explore_directory( &dfb_core_wm_modules );
+
+     direct_list_foreach( l, dfb_core_wm_modules.entries ) {
+          DirectModuleEntry *module = (DirectModuleEntry*) l;
+          const CoreWMFuncs *funcs;
+
+          funcs = direct_module_ref( module );
+          if (!funcs)
+               continue;
+
+          if (!name || !strcasecmp( name, module->name )) {
+               if (wm_local->module)
+                    direct_module_unref( wm_local->module );
+
+               wm_local->module = module;
+               wm_local->funcs  = funcs;
+          }
+          else
+               direct_module_unref( module );
+     }
+
+     if (!wm_local->module) {
+          if (name)
+               D_ERROR( "DirectFB/WM: Window manager module '%s' not found!\n", name );
+          else
+               D_ERROR( "DirectFB/WM: No window manager module found!\n" );
+
+          return DFB_NOIMPL;
+     }
+
+     return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static void
+convert_config( DFBWindowConfig        *config,
+                const CoreWindowConfig *from )
+{
+     config->bounds            = from->bounds;
+     config->opacity           = from->opacity;
+     config->stacking          = from->stacking;
+     config->options           = from->options;
+     config->events            = from->events;
+     config->color             = from->color;
+     config->color_key         = from->color_key;
+     config->opaque            = from->opaque;
+//     config->key_selection     = DWKS_ALL;    // FIXME: implement
+//     config->keys              = NULL;        // FIXME: implement
+//     config->num_keys          = 0;           // FIXME: implement
+     config->association       = from->association;
+     config->src_geometry      = from->src_geometry;
+     config->dst_geometry      = from->dst_geometry;
+     config->cursor_flags      = from->cursor_flags;
+     config->cursor_resolution = from->cursor_resolution;
+}
+
+static void
+convert_state( DFBWindowState        *state,
+               const CoreWindowFlags  flags )
+{
+     state->flags = DWSTATE_NONE;
+
+     if (flags & CWF_INSERTED)
+          state->flags |= DWSTATE_INSERTED;
+
+     if (flags & CWF_FOCUSED)
+          state->flags |= DWSTATE_FOCUSED;
+
+     if (flags & CWF_ENTERED)
+          state->flags |= DWSTATE_ENTERED;
+}
+
+/**************************************************************************************************/
+
+typedef struct {
+     ReactionFunc        func;
+     void               *ctx;
+} AttachContext;
+
+static DFBEnumerationResult
+wm_window_attach_callback( CoreWindow *window,
+                           void       *ctx )
+{
+     AttachContext *context = ctx;
+
+     CoreWM_WindowAdd add;
+
+     add.info.window_id   = window->id;
+     add.info.caps        = window->caps;
+     add.info.resource_id = window->resource_id;
+
+     convert_config( &add.info.config, &window->config );
+
+     convert_state( &add.info.state, window->flags );
+
+     context->func( &add, context->ctx );
+
+     return DFENUM_OK;
+}
+
+DFBResult
+dfb_wm_attach( CoreDFB            *core,
+               int                 channel,
+               ReactionFunc        func,
+               void               *ctx,
+               Reaction           *reaction )
+{
+     D_ASSERT( wm_shared != NULL );
+
+     if (channel == CORE_WM_WINDOW_ADD) {
+          CoreWindowStack *stack = (CoreWindowStack *) wm_shared->stacks;
+
+          if (stack) {
+               DFBResult     ret;
+               AttachContext context = { func, ctx };
+
+               dfb_windowstack_lock( stack );
+
+               ret = dfb_wm_enum_windows( stack, wm_window_attach_callback, &context );
+               if (ret)
+                    D_WARN( "could not enumerate windows" );
+
+               ret = fusion_reactor_attach_channel( wm_shared->reactor, channel, func, ctx, reaction );
+
+               dfb_windowstack_unlock( stack );
+
+               return ret;
+          }
+     }
+
+     return fusion_reactor_attach_channel( wm_shared->reactor, channel, func, ctx, reaction );
+}
+
+DFBResult
+dfb_wm_detach( CoreDFB            *core,
+               Reaction           *reaction )
+{
+     D_ASSERT( wm_shared != NULL );
+
+     return fusion_reactor_detach( wm_shared->reactor, reaction );
+}
+
+DFBResult
+dfb_wm_dispatch( CoreDFB            *core,
+                 int                 channel,
+                 const void         *data,
+                 int                 size )
+{
+     D_ASSERT( wm_shared != NULL );
+
+     return fusion_reactor_dispatch_channel( wm_shared->reactor, channel, data, size, true, NULL );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowAdd( CoreDFB    *core,
+                           CoreWindow *window )
+{
+     CoreWM_WindowAdd add;
+
+     add.info.window_id   = window->id;
+     add.info.caps        = window->caps;
+     add.info.resource_id = window->resource_id;
+
+     convert_config( &add.info.config, &window->config );
+
+     convert_state( &add.info.state, window->flags );
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_ADD, &add, sizeof(add) );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowRemove( CoreDFB    *core,
+                              CoreWindow *window )
+{
+     CoreWM_WindowRemove remove;
+
+     remove.window_id = window->id;
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_REMOVE, &remove, sizeof(remove) );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowConfig( CoreDFB              *core,
+                              CoreWindow           *window,
+                              DFBWindowConfigFlags  flags )
+{
+     CoreWM_WindowConfig config;
+
+     config.window_id = window->id;
+     config.flags     = flags;
+
+     convert_config( &config.config, &window->config );
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_CONFIG, &config, sizeof(config) );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowState( CoreDFB    *core,
+                             CoreWindow *window )
+{
+     CoreWM_WindowState state;
+
+     state.window_id = window->id;
+
+     convert_state( &state.state, window->flags );
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_STATE, &state, sizeof(state) );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowRestack( CoreDFB      *core,
+                               CoreWindow   *window,
+                               unsigned int  index )
+{
+     CoreWM_WindowRestack restack;
+
+     restack.window_id = window->id;
+     restack.index     = index;
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_RESTACK, &restack, sizeof(restack) );
+}
+
+DFBResult
+dfb_wm_dispatch_WindowFocus( CoreDFB    *core,
+                             CoreWindow *window )
+{
+     CoreWM_WindowFocus focus;
+
+     focus.window_id = window->id;
+
+     return dfb_wm_dispatch( core, CORE_WM_WINDOW_FOCUS, &focus, sizeof(focus) );
+}
+
+/**************************************************************************************************/
+
+void
+dfb_wm_get_info( CoreWMInfo *info )
+{
+     D_ASSERT( wm_shared != NULL );
+
+     D_ASSERT( info != NULL );
+
+     *info = wm_shared->info;
+}
+
+DFBResult
+dfb_wm_post_init( CoreDFB *core )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Resume != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     return wm_local->funcs->PostInit( wm_local->data, wm_shared->data );
+}
+
+/**************************************************************************************************/
+
+DFBResult
+dfb_wm_init_stack( CoreWindowStack *stack )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->InitStack != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( !(stack->flags & CWSF_INITIALIZED) );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     /* Allocate shared stack data. */
+     if (wm_shared->info.stack_data_size) {
+          if (stack->stack_data)
+               SHFREE( stack->shmpool, stack->stack_data );
+               
+          stack->stack_data = SHCALLOC( stack->shmpool, 1, wm_shared->info.stack_data_size );
+          if (!stack->stack_data) {
+               D_WARN( "out of (shared) memory" );
+               return D_OOSHM();
+          }
+     }
+
+     /* Window manager specific initialization. */
+     ret = wm_local->funcs->InitStack( stack, wm_local->data, stack->stack_data );
+     if (ret) {
+          if (stack->stack_data) {
+               SHFREE( wm_shared->shmpool, stack->stack_data );
+               stack->stack_data = NULL;
+          }
+
+          return ret;
+     }
+
+     stack->flags |= CWSF_INITIALIZED;
+
+     /* Add window stack to list. */
+     direct_list_append( &wm_shared->stacks, &stack->link );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_wm_close_stack( CoreWindowStack *stack )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->CloseStack != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     D_ASSUME( stack->flags & CWSF_INITIALIZED );
+
+     if (!(stack->flags & CWSF_INITIALIZED)) {
+          D_ASSUME( !(stack->flags & CWSF_ACTIVATED) );
+          return DFB_OK;
+     }
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     /* Deactivate before deinitialization. */
+     if (stack->flags & CWSF_ACTIVATED)
+          dfb_wm_set_active( stack, false );
+
+     /*
+      * Clear flag and remove stack first, because
+      * CloseStack() may cause the stack to be destroyed!
+      */
+     stack->flags &= ~CWSF_INITIALIZED;
+
+     /* Remove window stack from list. */
+     direct_list_remove( &wm_shared->stacks, &stack->link );
+
+     /* Window manager specific deinitialization. */
+     return wm_local->funcs->CloseStack( stack, wm_local->data, stack->stack_data );
+}
+
+DFBResult
+dfb_wm_set_active( CoreWindowStack *stack,
+                   bool             active )
+{
+     DFBResult ret;
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %sactive )\n", __FUNCTION__, stack, active ? "" : "in" );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->SetActive != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     if (active) {
+          D_ASSUME( !(stack->flags & CWSF_ACTIVATED) );
+
+          if (stack->flags & CWSF_ACTIVATED)
+               return DFB_OK;
+
+          ret = wm_local->funcs->SetActive( stack, wm_local->data, stack->stack_data, true );
+
+          stack->flags |= CWSF_ACTIVATED;
+     }
+     else {
+          D_ASSUME( stack->flags & CWSF_ACTIVATED );
+
+          if (!(stack->flags & CWSF_ACTIVATED))
+               return DFB_OK;
+
+          ret = wm_local->funcs->SetActive( stack, wm_local->data, stack->stack_data, false );
+
+          stack->flags &= ~CWSF_ACTIVATED;
+     }
+
+     return ret;
+}
+
+DFBResult
+dfb_wm_resize_stack( CoreWindowStack *stack,
+                     int              width,
+                     int              height )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p, %dx%d )\n", __FUNCTION__, stack, width, height );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->ResizeStack != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     /* Notify window manager about the new size. */
+     return wm_local->funcs->ResizeStack( stack, wm_local->data, stack->stack_data, width, height );
+}
+
+DFBResult
+dfb_wm_process_input( CoreWindowStack     *stack,
+                      const DFBInputEvent *event )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p, %p )\n", __FUNCTION__, stack, event );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->ProcessInput != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( event != NULL );
+
+     /* Dispatch input event via window manager. */
+     return wm_local->funcs->ProcessInput( stack, wm_local->data, stack->stack_data, event );
+}
+
+DFBResult
+dfb_wm_flush_keys( CoreWindowStack *stack )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p )\n", __FUNCTION__, stack );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->FlushKeys != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     return wm_local->funcs->FlushKeys( stack, wm_local->data, stack->stack_data );
+}
+
+DFBResult
+dfb_wm_window_at( CoreWindowStack  *stack,
+                  int               x,
+                  int               y,
+                  CoreWindow      **ret_window )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p, %d,%d )\n", __FUNCTION__, stack, x, y );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->WindowAt != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( ret_window != NULL );
+
+     return wm_local->funcs->WindowAt( stack, wm_local->data, stack->stack_data, x, y, ret_window );
+}
+
+DFBResult
+dfb_wm_window_lookup( CoreWindowStack  *stack,
+                      DFBWindowID       window_id,
+                      CoreWindow      **ret_window )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p, %u )\n", __FUNCTION__, stack, window_id );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->WindowLookup != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( ret_window != NULL );
+
+     return wm_local->funcs->WindowLookup( stack, wm_local->data,
+                                           stack->stack_data, window_id, ret_window );
+}
+
+DFBResult
+dfb_wm_enum_windows( CoreWindowStack      *stack,
+                     CoreWMWindowCallback  callback,
+                     void                 *callback_ctx )
+{
+     D_DEBUG_AT( Core_WM, "%s( %p, %p, %p )\n", __FUNCTION__, stack, callback, callback_ctx );
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->EnumWindows != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( callback != NULL );
+
+     return wm_local->funcs->EnumWindows( stack, wm_local->data,
+                                          stack->stack_data, callback, callback_ctx );
+}
+
+/**
+ * Give the wm a chance to specifiy a border
+ */
+DFBResult
+dfb_wm_get_insets( CoreWindowStack *stack,
+                   CoreWindow      *window,
+                   DFBInsets       *insets)
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->GetInsets != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+     D_ASSERT( insets != NULL );
+
+     return wm_local->funcs->GetInsets( stack, window, insets );
+}
+
+/**
+ * Give the wm a chance to override the windows configuration 
+ */
+DFBResult
+dfb_wm_preconfigure_window( CoreWindowStack *stack,
+                            CoreWindow      *window )
+{
+     DFBResult  ret;
+     void      *window_data = NULL;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_shared != NULL );
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+     D_ASSERT( window != NULL );
+     D_ASSERT( wm_local->funcs->PreConfigureWindow != NULL );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d] )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds) );
+
+     /* Allocate shared window data. */
+     if (wm_shared->info.window_data_size) {
+          window_data = SHCALLOC( wm_shared->shmpool, 1, wm_shared->info.window_data_size );
+          if (!window_data) {
+               D_WARN( "out of (shared) memory" );
+               return D_OOSHM();
+          }
+     }
+
+     /* Keep shared window data. */
+     window->window_data = window_data;
+
+     /* Tell window manager about the new window. */
+     ret = wm_local->funcs->PreConfigureWindow( stack, wm_local->data,
+                                       stack->stack_data, window, window_data );
+     if (ret) {
+          if (window_data) {
+               SHFREE( wm_shared->shmpool, window_data );
+               window->window_data = NULL;
+          }
+
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_wm_add_window( CoreWindowStack *stack,
+                   CoreWindow      *window )
+{
+     DFBResult  ret;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->AddWindow != NULL );
+     D_ASSERT( wm_shared != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d] )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds) );
+
+     /* Tell window manager about the new window. */
+     ret = wm_local->funcs->AddWindow( stack, wm_local->data,
+                                       stack->stack_data, window, window->window_data );
+     if (ret) {
+          if (window->window_data)
+               SHFREE( wm_shared->shmpool, window->window_data );
+          return ret;
+     }
+     return DFB_OK;
+}
+
+DFBResult
+dfb_wm_remove_window( CoreWindowStack *stack,
+                      CoreWindow      *window )
+{
+     DFBResult ret;
+
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RemoveWindow != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d] )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds) );
+
+     /* Remove window from window manager. */
+     ret = wm_local->funcs->RemoveWindow( stack, wm_local->data,
+                                          stack->stack_data, window, window->window_data );
+
+     /* Deallocate shared stack data. */
+     if (window->window_data)
+          SHFREE( wm_shared->shmpool, window->window_data );
+
+     return ret;
+}
+
+/**
+ * Let the wm set a property on a window 
+ */
+DFBResult
+dfb_wm_set_window_property( CoreWindowStack  *stack,
+                            CoreWindow       *window,
+                            const char       *key,
+                            void             *value,
+                            void            **ret_old_value )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->SetWindowProperty != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+     D_ASSERT( key != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d], '%s' = %p )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds), key, value );
+
+     return wm_local->funcs->SetWindowProperty( stack, wm_local->data, stack->stack_data,
+                                                window, window->window_data,
+                                                key, value, ret_old_value );
+}
+
+/**
+ * get the wm  property on a window 
+ */
+DFBResult
+dfb_wm_get_window_property( CoreWindowStack  *stack,
+                            CoreWindow       *window,
+                            const char       *key,
+                            void            **ret_value )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->GetWindowProperty != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+     D_ASSERT( key != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d], '%s' )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds), key );
+
+     return wm_local->funcs->GetWindowProperty( stack, wm_local->data, stack->stack_data,
+                                                window, window->window_data, key, ret_value );
+}
+
+/**
+ * remove th wm  property on a window 
+ */
+DFBResult
+dfb_wm_remove_window_property( CoreWindowStack  *stack,
+                               CoreWindow       *window,
+                               const char       *key,
+                               void            **ret_value )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RemoveWindowProperty != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_ASSERT( window != NULL );
+     D_ASSERT( key != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, %p [%d,%d-%dx%d], '%s' )\n", __FUNCTION__,
+                 stack, window, DFB_RECTANGLE_VALS(&window->config.bounds), key );
+
+     return wm_local->funcs->RemoveWindowProperty( stack, wm_local->data, stack->stack_data,
+                                                   window, window->window_data, key, ret_value );
+}
+
+DFBResult
+dfb_wm_set_window_config( CoreWindow             *window,
+                          const CoreWindowConfig *config,
+                          CoreWindowConfigFlags   flags )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->SetWindowConfig != NULL );
+
+     D_ASSERT( window != NULL );
+     D_ASSERT( config != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d], %p, 0x%x )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds), config, flags );
+
+     return wm_local->funcs->SetWindowConfig( window, wm_local->data,
+                                              window->window_data, config, flags );
+}
+
+DFBResult
+dfb_wm_restack_window( CoreWindow *window,
+                       CoreWindow *relative,
+                       int         relation )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RestackWindow != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_ASSERT( relative == NULL || relative == window || relation != 0);
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d], %p, %d )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds), relative, relation );
+
+     return wm_local->funcs->RestackWindow( window, wm_local->data, window->window_data, relative,
+                                            relative ? relative->window_data : NULL, relation );
+}
+
+DFBResult
+dfb_wm_grab( CoreWindow *window,
+             CoreWMGrab *grab )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Grab != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_ASSERT( grab != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d], %d )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds), grab->target );
+
+     return wm_local->funcs->Grab( window, wm_local->data, window->window_data, grab );
+}
+
+DFBResult
+dfb_wm_ungrab( CoreWindow *window,
+               CoreWMGrab *grab )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->Ungrab != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_ASSERT( grab != NULL );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d], %d )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds), grab->target );
+
+     return wm_local->funcs->Ungrab( window, wm_local->data, window->window_data, grab );
+}
+
+DFBResult
+dfb_wm_request_focus( CoreWindow *window )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RequestFocus != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d] )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds) );
+
+     return wm_local->funcs->RequestFocus( window, wm_local->data, window->window_data );
+}
+
+DFBResult
+dfb_wm_begin_updates( CoreWindow      *window,
+                      const DFBRegion *update )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->RequestFocus != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d] )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds) );
+
+     return wm_local->funcs->BeginUpdates( window, wm_local->data, window->window_data, update );
+}
+
+DFBResult
+dfb_wm_set_cursor_position( CoreWindow *window,
+                            int         x,
+                            int         y )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->SetCursorPosition != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d] )\n", __FUNCTION__, window, x, y );
+
+     return wm_local->funcs->SetCursorPosition( window, wm_local->data, window->window_data, x, y );
+}
+
+DFBResult
+dfb_wm_update_stack( CoreWindowStack     *stack,
+                     const DFBRegion     *region,
+                     DFBSurfaceFlipFlags  flags )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->UpdateStack != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     DFB_REGION_ASSERT( region );
+
+     D_DEBUG_AT( Core_WM, "%s( %p, [%d,%d-%dx%d], 0x%x )\n", __FUNCTION__,
+                 stack, DFB_RECTANGLE_VALS_FROM_REGION(region), flags );
+
+     return wm_local->funcs->UpdateStack( stack, wm_local->data,
+                                          stack->stack_data, region, flags );
+}
+
+DFBResult
+dfb_wm_update_window( CoreWindow          *window,
+                      const DFBRegion     *region,
+                      DFBSurfaceFlipFlags  flags )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->UpdateWindow != NULL );
+
+     D_ASSERT( window != NULL );
+
+     D_MAGIC_ASSERT( window->stack, CoreWindowStack );
+     D_MAGIC_ASSERT( window->stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &window->stack->context->lock );
+
+     DFB_REGION_ASSERT_IF( region );
+
+     D_DEBUG_AT( Core_WM, "%s( %p [%d,%d-%dx%d], [%d,%d-%dx%d], 0x%x )\n", __FUNCTION__,
+                 window, DFB_RECTANGLE_VALS(&window->config.bounds),
+                 DFB_RECTANGLE_VALS_FROM_REGION(region), flags );
+
+     return wm_local->funcs->UpdateWindow( window, wm_local->data,
+                                           window->window_data, region, flags );
+}
+
+DFBResult
+dfb_wm_update_cursor( CoreWindowStack       *stack,
+                      CoreCursorUpdateFlags  flags )
+{
+     D_ASSERT( wm_local != NULL );
+     D_ASSERT( wm_local->funcs != NULL );
+     D_ASSERT( wm_local->funcs->UpdateStack != NULL );
+
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+     D_ASSERT( stack->flags & CWSF_INITIALIZED );
+
+     D_MAGIC_ASSERT( stack->context, CoreLayerContext );
+     FUSION_SKIRMISH_ASSERT( &stack->context->lock );
+
+     D_FLAGS_ASSERT( flags, CCUF_ALL );
+
+     if (dfb_config->no_cursor_updates)
+          return DFB_OK;
+
+     return wm_local->funcs->UpdateCursor( stack, wm_local->data,
+                                           stack->stack_data, flags );
+}
+
diff --git a/Source/DirectFB/src/core/wm.h b/Source/DirectFB/src/core/wm.h
new file mode 100755
index 0000000..eea4fd9
--- /dev/null
+++ b/Source/DirectFB/src/core/wm.h
@@ -0,0 +1,468 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__WM_H__
+#define __DFB__CORE__WM_H__
+
+#include <directfb.h>
+#include <directfb_windows.h>
+
+#include <direct/modules.h>
+
+#include <core/coretypes.h>
+#include <core/windows.h>
+
+
+DECLARE_MODULE_DIRECTORY( dfb_core_wm_modules );
+
+
+/*
+ * Increase this number when changes result in binary incompatibility!
+ */
+#define DFB_CORE_WM_ABI_VERSION           9
+
+#define DFB_CORE_WM_INFO_NAME_LENGTH     60
+#define DFB_CORE_WM_INFO_VENDOR_LENGTH   80
+#define DFB_CORE_WM_INFO_URL_LENGTH     120
+#define DFB_CORE_WM_INFO_LICENSE_LENGTH  40
+
+
+typedef struct {
+     int            major;
+     int            minor;
+
+     int            binary;
+} CoreWMVersion;
+
+typedef struct {
+     CoreWMVersion  version;
+
+     char           name   [DFB_CORE_WM_INFO_NAME_LENGTH];
+     char           vendor [DFB_CORE_WM_INFO_VENDOR_LENGTH];
+     char           url    [DFB_CORE_WM_INFO_URL_LENGTH];
+     char           license[DFB_CORE_WM_INFO_LICENSE_LENGTH];
+
+     unsigned int   wm_data_size;
+     unsigned int   wm_shared_size;
+     unsigned int   stack_data_size;
+     unsigned int   window_data_size;
+} CoreWMInfo;
+
+typedef struct {
+     CoreWMGrabTarget            target;
+
+     /* Both for CWMGT_KEY only. */
+     DFBInputDeviceKeySymbol     symbol;
+     DFBInputDeviceModifierMask  modifiers;
+} CoreWMGrab;
+
+/* FIXME: move to cursor.h when it's there */
+typedef enum {
+     CCUF_NONE      = 0x00000000,
+
+     CCUF_ENABLE    = 0x00000001,
+     CCUF_DISABLE   = 0x00000002,
+
+     CCUF_POSITION  = 0x00000010,
+     CCUF_SIZE      = 0x00000020,
+     CCUF_SHAPE     = 0x00000040,
+     CCUF_OPACITY   = 0x00000080,
+
+     CCUF_ALL       = 0x000000F3
+} CoreCursorUpdateFlags;
+
+typedef DFBEnumerationResult (*CoreWMWindowCallback) (CoreWindow *window,
+                                                      void       *ctx);
+
+typedef struct {
+
+   /** Module **/
+
+     void      (*GetWMInfo)         ( CoreWMInfo             *info );
+
+     DFBResult (*Initialize)        ( CoreDFB                *core,
+                                      void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*Join)              ( CoreDFB                *core,
+                                      void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*Shutdown)          ( bool                    emergency,
+                                      void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*Leave)             ( bool                    emergency,
+                                      void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*Suspend)           ( void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*Resume)            ( void                   *wm_data,
+                                      void                   *shared_data );
+
+     DFBResult (*PostInit)          ( void                   *wm_data,
+                                      void                   *shared_data );
+
+
+   /** Stack **/
+
+     DFBResult (*InitStack)         ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data );
+
+     DFBResult (*CloseStack)        ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data );
+
+     DFBResult (*SetActive)         ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      bool                    active );
+
+     DFBResult (*ResizeStack)       ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      int                     width,
+                                      int                     height );
+
+     DFBResult (*ProcessInput)      ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      const DFBInputEvent    *event );
+
+     DFBResult (*FlushKeys)         ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data );
+
+     DFBResult (*WindowAt)          ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      int                     x,
+                                      int                     y,
+                                      CoreWindow            **ret_window );
+
+     DFBResult (*WindowLookup)      ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      DFBWindowID             window_id,
+                                      CoreWindow            **ret_window );
+
+     DFBResult (*EnumWindows)       ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      CoreWMWindowCallback    callback,
+                                      void                   *callback_ctx );
+
+
+   /** Window **/
+    DFBResult (*SetWindowProperty)( CoreWindowStack  *stack,
+                                    void             *wm_data,
+                                    void             *stack_data,
+                                    CoreWindow       *window,
+                                    void             *window_data,
+                                    const char       *key,
+                                    void             *value,
+                                    void            **old_value );
+
+    DFBResult (*GetWindowProperty)( CoreWindowStack  *stack,
+                                    void             *wm_data,
+                                    void             *stack_data,
+                                    CoreWindow       *window,
+                                    void             *window_data,
+                                    const char       *key,
+                                    void            **value);
+
+    DFBResult (*RemoveWindowProperty)( CoreWindowStack  *stack,
+                                       void             *wm_data,
+                                       void             *stack_data,
+                                       CoreWindow       *window,
+                                       void             *window_data,
+                                       const char       *key,
+                                       void            **value );
+
+     DFBResult (*GetInsets)         ( CoreWindowStack        *stack,
+                                      CoreWindow             *window,
+                                      DFBInsets              *insets );
+
+     DFBResult (*PreConfigureWindow)( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      CoreWindow             *window,
+                                      void                   *window_data );
+
+     DFBResult (*AddWindow)         ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      CoreWindow             *window,
+                                      void                   *window_data );
+
+     DFBResult (*RemoveWindow)      ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      CoreWindow             *window,
+                                      void                   *window_data );
+
+     DFBResult (*SetWindowConfig)   ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      const CoreWindowConfig *config,
+                                      CoreWindowConfigFlags   flags );
+
+     DFBResult (*RestackWindow)     ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      CoreWindow             *relative,
+                                      void                   *relative_data,
+                                      int                     relation );
+
+     DFBResult (*Grab)              ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      CoreWMGrab             *grab );
+
+     DFBResult (*Ungrab)            ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      CoreWMGrab             *grab );
+
+     DFBResult (*RequestFocus)      ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data );
+
+     DFBResult (*BeginUpdates)      ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      const DFBRegion        *update );
+
+     DFBResult (*SetCursorPosition) ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      int                     x,
+                                      int                     y );
+
+
+   /** Updates **/
+
+     DFBResult (*UpdateStack)       ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      const DFBRegion        *region,
+                                      DFBSurfaceFlipFlags     flags );
+
+     DFBResult (*UpdateWindow)      ( CoreWindow             *window,
+                                      void                   *wm_data,
+                                      void                   *window_data,
+                                      const DFBRegion        *region,
+                                      DFBSurfaceFlipFlags     flags );
+
+     DFBResult (*UpdateCursor)      ( CoreWindowStack        *stack,
+                                      void                   *wm_data,
+                                      void                   *stack_data,
+                                      CoreCursorUpdateFlags   flags );
+} CoreWMFuncs;
+
+
+
+typedef enum {
+     CORE_WM_WINDOW_ADD     = 1,
+     CORE_WM_WINDOW_REMOVE  = 2,
+     CORE_WM_WINDOW_CONFIG  = 3,
+     CORE_WM_WINDOW_STATE   = 4,
+     CORE_WM_WINDOW_RESTACK = 5,
+     CORE_WM_WINDOW_FOCUS   = 6,
+
+     _CORE_WM_NUM_CHANNELS
+} CoreWMChannels;
+
+typedef struct {
+     DFBWindowInfo        info;
+} CoreWM_WindowAdd;
+
+typedef struct {
+     DFBWindowID          window_id;
+} CoreWM_WindowRemove;
+
+typedef struct {
+     DFBWindowID          window_id;
+     DFBWindowConfig      config;
+     DFBWindowConfigFlags flags;
+} CoreWM_WindowConfig;
+
+typedef struct {
+     DFBWindowID          window_id;
+     DFBWindowState       state;
+} CoreWM_WindowState;
+
+typedef struct {
+     DFBWindowID          window_id;
+     unsigned int         index;
+} CoreWM_WindowRestack;
+
+typedef struct {
+     DFBWindowID          window_id;
+} CoreWM_WindowFocus;
+
+
+DFBResult dfb_wm_attach  ( CoreDFB            *core,
+                           int                 channel,
+                           ReactionFunc        func,
+                           void               *ctx,
+                           Reaction           *reaction );
+
+DFBResult dfb_wm_detach  ( CoreDFB            *core,
+                           Reaction           *reaction );
+
+DFBResult dfb_wm_dispatch( CoreDFB            *core,
+                           int                 channel,
+                           const void         *data,
+                           int                 size );
+
+
+DFBResult dfb_wm_dispatch_WindowAdd    ( CoreDFB              *core,
+                                         CoreWindow           *window );
+
+DFBResult dfb_wm_dispatch_WindowRemove ( CoreDFB              *core,
+                                         CoreWindow           *window );
+
+DFBResult dfb_wm_dispatch_WindowConfig ( CoreDFB              *core,
+                                         CoreWindow           *window,
+                                         DFBWindowConfigFlags  flags );
+
+DFBResult dfb_wm_dispatch_WindowState  ( CoreDFB              *core,
+                                         CoreWindow           *window );
+
+DFBResult dfb_wm_dispatch_WindowRestack( CoreDFB              *core,
+                                         CoreWindow           *window,
+                                         unsigned int          index );
+
+DFBResult dfb_wm_dispatch_WindowFocus  ( CoreDFB              *core,
+                                         CoreWindow           *window );
+
+
+
+void dfb_wm_get_info( CoreWMInfo *info );
+
+DFBResult dfb_wm_post_init          ( CoreDFB                *core );
+
+DFBResult dfb_wm_init_stack         ( CoreWindowStack        *stack );
+                                    
+DFBResult dfb_wm_close_stack        ( CoreWindowStack        *stack );
+
+DFBResult dfb_wm_set_active         ( CoreWindowStack        *stack,
+                                      bool                    active );
+                                    
+DFBResult dfb_wm_resize_stack       ( CoreWindowStack        *stack,
+                                      int                     width,
+                                      int                     height );
+                                    
+DFBResult dfb_wm_process_input      ( CoreWindowStack        *stack,
+                                      const DFBInputEvent    *event );
+                                    
+DFBResult dfb_wm_flush_keys         ( CoreWindowStack        *stack );
+                                    
+DFBResult dfb_wm_window_at          ( CoreWindowStack        *stack,
+                                      int                     x,
+                                      int                     y,
+                                      CoreWindow            **ret_window );
+                                    
+DFBResult dfb_wm_window_lookup      ( CoreWindowStack        *stack,
+                                      DFBWindowID             window_id,
+                                      CoreWindow            **ret_window );
+                                    
+DFBResult dfb_wm_enum_windows       ( CoreWindowStack        *stack,
+                                      CoreWMWindowCallback    callback,
+                                      void                   *callback_ctx );
+                                    
+DFBResult dfb_wm_get_insets         ( CoreWindowStack        *stack,
+                                      CoreWindow             *window,
+                                      DFBInsets              *insets );
+
+DFBResult dfb_wm_set_window_property ( CoreWindowStack  *stack,
+                                       CoreWindow       *window,
+                                       const char       *key,
+                                       void             *value,
+                                       void            **ret_old_value );
+
+DFBResult dfb_wm_get_window_property ( CoreWindowStack  *stack,
+                                       CoreWindow       *window,
+                                       const char       *key,
+                                       void            **ret_value );
+
+DFBResult dfb_wm_remove_window_property ( CoreWindowStack  *stack,
+                                          CoreWindow       *window,
+                                          const char       *key,
+                                          void            **ret_value );
+
+DFBResult dfb_wm_preconfigure_window ( CoreWindowStack        *stack,
+                                       CoreWindow             *window );
+
+
+DFBResult dfb_wm_add_window         ( CoreWindowStack        *stack,
+                                      CoreWindow             *window );
+
+DFBResult dfb_wm_remove_window      ( CoreWindowStack        *stack,
+                                      CoreWindow             *window );
+
+DFBResult dfb_wm_set_window_config  ( CoreWindow             *window,
+                                      const CoreWindowConfig *config,
+                                      CoreWindowConfigFlags   flags );
+
+DFBResult dfb_wm_restack_window     ( CoreWindow             *window,
+                                      CoreWindow             *relative,
+                                      int                     relation );
+
+DFBResult dfb_wm_grab               ( CoreWindow             *window,
+                                      CoreWMGrab             *grab );
+
+DFBResult dfb_wm_ungrab             ( CoreWindow             *window,
+                                      CoreWMGrab             *grab );
+
+DFBResult dfb_wm_request_focus      ( CoreWindow             *window );
+
+DFBResult dfb_wm_begin_updates      ( CoreWindow             *window,
+                                      const DFBRegion        *update );
+
+DFBResult dfb_wm_set_cursor_position( CoreWindow             *window,
+                                      int                     x,
+                                      int                     y );
+
+
+DFBResult dfb_wm_update_stack       ( CoreWindowStack        *stack,
+                                      const DFBRegion        *region,
+                                      DFBSurfaceFlipFlags     flags );
+
+DFBResult dfb_wm_update_window      ( CoreWindow             *window,
+                                      const DFBRegion        *region,
+                                      DFBSurfaceFlipFlags     flags );
+
+DFBResult dfb_wm_update_cursor      ( CoreWindowStack        *stack,
+                                      CoreCursorUpdateFlags   flags );
+
+#endif
diff --git a/Source/DirectFB/src/core/wm_module.h b/Source/DirectFB/src/core/wm_module.h
new file mode 100755
index 0000000..b470ebd
--- /dev/null
+++ b/Source/DirectFB/src/core/wm_module.h
@@ -0,0 +1,274 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DFB__CORE__WM_MODULE_H__
+#define __DFB__CORE__WM_MODULE_H__
+
+#include <core/wm.h>
+
+
+/** Module **/
+
+static void      wm_get_info       ( CoreWMInfo             *info );
+
+static DFBResult wm_initialize     ( CoreDFB                *core,
+                                     void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_join           ( CoreDFB                *core,
+                                     void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_shutdown       ( bool                    emergency,
+                                     void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_leave          ( bool                    emergency,
+                                     void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_suspend        ( void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_resume         ( void                   *wm_data,
+                                     void                   *shared_data );
+
+static DFBResult wm_post_init      ( void                   *wm_data,
+                                     void                   *shared_data );
+
+
+/** Stack **/
+
+static DFBResult wm_init_stack     ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data );
+
+static DFBResult wm_close_stack    ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data );
+
+static DFBResult wm_set_active     ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     bool                    active );
+
+static DFBResult wm_resize_stack   ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     int                     width,
+                                     int                     height );
+
+static DFBResult wm_process_input  ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     const DFBInputEvent    *event );
+
+static DFBResult wm_flush_keys     ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data );
+
+static DFBResult wm_window_at      ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     int                     x,
+                                     int                     y,
+                                     CoreWindow            **ret_window );
+
+static DFBResult wm_window_lookup  ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     DFBWindowID             window_id,
+                                     CoreWindow            **ret_window );
+
+static DFBResult wm_enum_windows   ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     CoreWMWindowCallback    callback,
+                                     void                   *callback_ctx );
+
+/** Window **/
+static DFBResult wm_get_insets     ( CoreWindowStack        *stack,
+                                     CoreWindow             *window,
+                                     DFBInsets              *insets );
+
+static DFBResult wm_preconfigure_window     ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     CoreWindow             *window,
+                                     void                   *window_data );
+
+static DFBResult wm_set_window_property( CoreWindowStack        *stack,
+                                         void                   *wm_data,
+                                         void                   *stack_data,
+                                         CoreWindow             *window,
+                                         void                   *window_data,
+                                         const char             *key,
+                                         void                   *value, 
+                                         void                  **ret_old_value );
+
+static DFBResult wm_get_window_property( CoreWindowStack        *stack,
+                                         void                   *wm_data,
+                                         void                   *stack_data,
+                                         CoreWindow             *window,
+                                         void                   *window_data,
+                                         const char             *key,
+                                         void                  **ret_value );
+
+static DFBResult wm_remove_window_property( CoreWindowStack        *stack,
+                                            void                   *wm_data,
+                                            void                   *stack_data,
+                                            CoreWindow             *window,
+                                            void                   *window_data,
+                                            const char             *key,
+                                            void                  **ret_value );
+
+static DFBResult wm_add_window     ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     CoreWindow             *window,
+                                     void                   *window_data );
+
+static DFBResult wm_remove_window  ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     CoreWindow             *window,
+                                     void                   *window_data );
+
+static DFBResult wm_set_window_config( CoreWindow             *window,
+                                       void                   *wm_data,
+                                       void                   *window_data,
+                                       const CoreWindowConfig *config,
+                                       CoreWindowConfigFlags   flags );
+
+static DFBResult wm_restack_window ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data,
+                                     CoreWindow             *relative,
+                                     void                   *relative_data,
+                                     int                     relation );
+
+static DFBResult wm_grab           ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data,
+                                     CoreWMGrab             *grab );
+
+static DFBResult wm_ungrab         ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data,
+                                     CoreWMGrab             *grab );
+
+static DFBResult wm_request_focus  ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data );
+
+static DFBResult wm_begin_updates  ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data,
+                                     const DFBRegion        *update );
+
+static DFBResult wm_set_cursor_position( CoreWindow             *window,
+                                         void                   *wm_data,
+                                         void                   *window_data,
+                                         int                     x,
+                                         int                     y );
+
+/** Updates **/
+
+static DFBResult wm_update_stack   ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     const DFBRegion        *region,
+                                     DFBSurfaceFlipFlags     flags );
+
+static DFBResult wm_update_window  ( CoreWindow             *window,
+                                     void                   *wm_data,
+                                     void                   *window_data,
+                                     const DFBRegion        *region,
+                                     DFBSurfaceFlipFlags     flags );
+
+static DFBResult wm_update_cursor  ( CoreWindowStack        *stack,
+                                     void                   *wm_data,
+                                     void                   *stack_data,
+                                     CoreCursorUpdateFlags   flags );
+
+
+static CoreWMFuncs wm_funcs = {
+     .GetWMInfo            = wm_get_info,
+
+     .Initialize           = wm_initialize,
+     .Join                 = wm_join,
+     .Shutdown             = wm_shutdown,
+     .Leave                = wm_leave,
+     .Suspend              = wm_suspend,
+     .Resume               = wm_resume,
+     .PostInit             = wm_post_init,
+
+     .InitStack            = wm_init_stack,
+     .CloseStack           = wm_close_stack,
+     .SetActive            = wm_set_active,
+     .ResizeStack          = wm_resize_stack,
+     .ProcessInput         = wm_process_input,
+     .FlushKeys            = wm_flush_keys,
+     .WindowAt             = wm_window_at,
+     .WindowLookup         = wm_window_lookup,
+     .EnumWindows          = wm_enum_windows,
+
+     .GetInsets            = wm_get_insets,
+     .PreConfigureWindow   = wm_preconfigure_window,
+     .SetWindowProperty    = wm_set_window_property,
+     .GetWindowProperty    = wm_get_window_property,
+     .RemoveWindowProperty = wm_remove_window_property,
+     .AddWindow            = wm_add_window,
+     .RemoveWindow         = wm_remove_window,
+     .SetWindowConfig      = wm_set_window_config,
+     .RestackWindow        = wm_restack_window,
+     .Grab                 = wm_grab,
+     .Ungrab               = wm_ungrab,
+     .RequestFocus         = wm_request_focus,
+     .BeginUpdates         = wm_begin_updates,
+     .SetCursorPosition    = wm_set_cursor_position,
+
+     .UpdateStack          = wm_update_stack,
+     .UpdateWindow         = wm_update_window,
+     .UpdateCursor         = wm_update_cursor
+};
+
+
+#define DFB_WINDOW_MANAGER(shortname)                             \
+__attribute__((constructor)) void directfbwm_##shortname( void ); \
+                                                                  \
+void                                                              \
+directfbwm_##shortname( void )                                    \
+{                                                                 \
+     direct_modules_register( &dfb_core_wm_modules,               \
+                              DFB_CORE_WM_ABI_VERSION,            \
+                              #shortname, &wm_funcs );            \
+}
+
+#endif
+
diff --git a/Source/DirectFB/src/directfb.c b/Source/DirectFB/src/directfb.c
new file mode 100755
index 0000000..9562811
--- /dev/null
+++ b/Source/DirectFB/src/directfb.c
@@ -0,0 +1,311 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <directfb.h>
+#include <directfb_version.h>
+
+#include <misc/conf.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layers.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/windows.h>
+#include <core/windowstack.h>
+#include <core/wm.h>
+
+#include <gfx/convert.h>
+
+#include <direct/conf.h>
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/log.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <display/idirectfbsurface.h>
+
+#include <idirectfb.h>
+
+
+IDirectFB *idirectfb_singleton = NULL;
+
+static DFBResult CreateRemote( const char *host, int session, IDirectFB **ret_interface );
+
+/*
+ * Version checking
+ */
+const unsigned int directfb_major_version = DIRECTFB_MAJOR_VERSION;
+const unsigned int directfb_minor_version = DIRECTFB_MINOR_VERSION;
+const unsigned int directfb_micro_version = DIRECTFB_MICRO_VERSION;
+const unsigned int directfb_binary_age    = DIRECTFB_BINARY_AGE;
+const unsigned int directfb_interface_age = DIRECTFB_INTERFACE_AGE;
+
+const char *
+DirectFBCheckVersion( unsigned int required_major,
+                      unsigned int required_minor,
+                      unsigned int required_micro )
+{
+     if (required_major > DIRECTFB_MAJOR_VERSION)
+          return "DirectFB version too old (major mismatch)";
+     if (required_major < DIRECTFB_MAJOR_VERSION)
+          return "DirectFB version too new (major mismatch)";
+     if (required_minor > DIRECTFB_MINOR_VERSION)
+          return "DirectFB version too old (minor mismatch)";
+     if (required_minor < DIRECTFB_MINOR_VERSION)
+          return "DirectFB version too new (minor mismatch)";
+     if (required_micro < DIRECTFB_MICRO_VERSION - DIRECTFB_BINARY_AGE)
+          return "DirectFB version too new (micro mismatch)";
+     if (required_micro > DIRECTFB_MICRO_VERSION)
+          return "DirectFB version too old (micro mismatch)";
+
+     return NULL;
+}
+
+const char *
+DirectFBUsageString( void )
+{
+     return dfb_config_usage();
+}
+
+DFBResult
+DirectFBInit( int *argc, char *(*argv[]) )
+{
+     DFBResult ret;
+
+#ifdef DSLINUX
+     IDirectFBEventBuffer_Dispatcher_ctor();
+     IDirectFBDataBuffer_Dispatcher_ctor();
+     IDirectFBWindow_Requestor_ctor();
+     IDirectFBSurface_Requestor_ctor();
+     IDirectFBScreen_Requestor_ctor();
+     IDirectFBPalette_Requestor_ctor();
+     IDirectFBInputDevice_Requestor_ctor();
+     IDirectFBImageProvider_Requestor_ctor();
+     IDirectFBFont_Requestor_ctor();
+     IDirectFBDisplayLayer_Requestor_ctor();
+     IDirectFB_Requestor_ctor();
+#endif
+
+     ret = dfb_config_init( argc, argv );
+     if (ret)
+          return ret;
+
+     return DFB_OK;
+}
+
+DFBResult
+DirectFBSetOption( const char *name, const char *value )
+{
+     DFBResult ret;
+
+     if (dfb_config == NULL) {
+          D_ERROR( "DirectFBSetOption: DirectFBInit has to be "
+                   "called before DirectFBSetOption!\n" );
+          return DFB_INIT;
+     }
+
+     if (idirectfb_singleton) {
+          D_ERROR( "DirectFBSetOption: DirectFBSetOption has to be "
+                   "called before DirectFBCreate!\n" );
+          return DFB_INIT;
+     }
+
+     if (!name)
+          return DFB_INVARG;
+
+     ret = dfb_config_set( name, value );
+     if (ret)
+          return ret;
+
+     return DFB_OK;
+}
+
+/*
+ * Programs have to call this to get the super interface
+ * which is needed to access other functions
+ */
+DFBResult
+DirectFBCreate( IDirectFB **interface )
+{
+     DFBResult  ret;
+     IDirectFB *dfb;
+     CoreDFB   *core_dfb;
+
+     if (!dfb_config) {
+          /*  don't use D_ERROR() here, it uses dfb_config  */
+          direct_log_printf( NULL, "(!) DirectFBCreate: DirectFBInit "
+                             "has to be called before DirectFBCreate!\n" );
+          return DFB_INIT;
+     }
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (idirectfb_singleton) {
+          idirectfb_singleton->AddRef( idirectfb_singleton );
+          *interface = idirectfb_singleton;
+          return DFB_OK;
+     }
+
+     direct_initialize();
+
+     if ( !(direct_config->quiet & DMT_BANNER) && dfb_config->banner) {
+          direct_log_printf( NULL,
+                             "\n"
+                             "   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB " DIRECTFB_VERSION " |~~~~~~~~~~~~~~\n"
+                             "        (c) 2001-2009  The world wide DirectFB Open Source Community\n"
+                             "        (c) 2000-2004  Convergence (integrated media) GmbH\n"
+                             "      ----------------------------------------------------------------\n"
+                             "\n" );
+     }
+
+#ifndef DIRECTFB_PURE_VOODOO
+     if (dfb_config->remote.host)
+          return CreateRemote( dfb_config->remote.host, dfb_config->remote.session, interface );
+
+     ret = dfb_core_create( &core_dfb );
+     if (ret)
+          return ret;
+
+     DIRECT_ALLOCATE_INTERFACE( dfb, IDirectFB );
+
+     ret = IDirectFB_Construct( dfb, core_dfb );
+     if (ret) {
+          dfb_core_destroy( core_dfb, false );
+          return ret;
+     }
+
+     if (dfb_core_is_master( core_dfb )) {
+          /* not fatal */
+          ret = dfb_wm_post_init( core_dfb );
+          if (ret)
+               D_DERROR( ret, "DirectFBCreate: Post initialization of WM failed!\n" );
+
+          dfb_core_activate( core_dfb );
+     }
+
+     *interface = idirectfb_singleton = dfb;
+
+     return DFB_OK;
+#else
+     return CreateRemote( dfb_config->remote.host ?: "", dfb_config->remote.session, interface );
+#endif
+}
+
+DFBResult
+DirectFBError( const char *msg, DFBResult error )
+{
+     if (msg)
+          direct_log_printf( NULL, "(#) DirectFBError [%s]: %s\n", msg,
+                             DirectFBErrorString( error ) );
+     else
+          direct_log_printf( NULL, "(#) DirectFBError: %s\n",
+                             DirectFBErrorString( error ) );
+
+     return error;
+}
+
+const char *
+DirectFBErrorString( DFBResult error )
+{
+     if (D_RESULT_TYPE_IS( error, 'D','F','B' )) {
+          switch (error) {
+               case DFB_NOVIDEOMEMORY:
+                    return "Out of video memory!";
+               case DFB_MISSINGFONT:
+                    return "No font has been set!";
+               case DFB_MISSINGIMAGE:
+                    return "No image has been set!";
+               default:
+                    return "UKNOWN DIRECTFB RESULT!";
+          }
+     }
+
+     return DirectResultString( error );
+}
+
+DFBResult
+DirectFBErrorFatal( const char *msg, DFBResult error )
+{
+     DirectFBError( msg, error );
+
+     //if (idirectfb_singleton)
+          //IDirectFB_Destruct( idirectfb_singleton );
+
+     exit( error );
+}
+
+/**************************************************************************************************/
+
+static DFBResult
+CreateRemote( const char *host, int session, IDirectFB **ret_interface )
+{
+     DFBResult             ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *interface;
+
+     D_ASSERT( host != NULL );
+     D_ASSERT( ret_interface != NULL );
+
+     ret = DirectGetInterface( &funcs, "IDirectFB", "Requestor", NULL, NULL );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( &interface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( interface, host, session );
+     if (ret)
+          return ret;
+
+#ifndef DIRECTFB_PURE_VOODOO
+     *ret_interface = idirectfb_singleton = interface;
+#else	 
+     *ret_interface = interface;
+#endif
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/display/Makefile.am b/Source/DirectFB/src/display/Makefile.am
new file mode 100755
index 0000000..ddb1456
--- /dev/null
+++ b/Source/DirectFB/src/display/Makefile.am
@@ -0,0 +1,30 @@
+## Makefile.am for DirectFB/src/display
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/display
+
+internalinclude_HEADERS = \
+	idirectfbpalette.h		\
+	idirectfbsurface.h		\
+	idirectfbsurface_layer.h 	\
+	idirectfbsurface_window.h 	\
+	idirectfbdisplaylayer.h		\
+	idirectfbscreen.h
+
+
+noinst_LTLIBRARIES = libdirectfb_display.la
+
+libdirectfb_display_la_SOURCES =	\
+	idirectfbpalette.c		\
+	idirectfbsurface.c		\
+	idirectfbsurface_layer.c 	\
+	idirectfbsurface_window.c 	\
+	idirectfbdisplaylayer.c		\
+	idirectfbscreen.c
diff --git a/Source/DirectFB/src/display/Makefile.in b/Source/DirectFB/src/display/Makefile.in
new file mode 100755
index 0000000..312b297
--- /dev/null
+++ b/Source/DirectFB/src/display/Makefile.in
@@ -0,0 +1,570 @@
+# 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@
+subdir = src/display
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_display_la_LIBADD =
+am_libdirectfb_display_la_OBJECTS = idirectfbpalette.lo \
+	idirectfbsurface.lo idirectfbsurface_layer.lo \
+	idirectfbsurface_window.lo idirectfbdisplaylayer.lo \
+	idirectfbscreen.lo
+libdirectfb_display_la_OBJECTS = $(am_libdirectfb_display_la_OBJECTS)
+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_display_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_display_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/display
+internalinclude_HEADERS = \
+	idirectfbpalette.h		\
+	idirectfbsurface.h		\
+	idirectfbsurface_layer.h 	\
+	idirectfbsurface_window.h 	\
+	idirectfbdisplaylayer.h		\
+	idirectfbscreen.h
+
+noinst_LTLIBRARIES = libdirectfb_display.la
+libdirectfb_display_la_SOURCES = \
+	idirectfbpalette.c		\
+	idirectfbsurface.c		\
+	idirectfbsurface_layer.c 	\
+	idirectfbsurface_window.c 	\
+	idirectfbdisplaylayer.c		\
+	idirectfbscreen.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/display/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/display/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_display.la: $(libdirectfb_display_la_OBJECTS) $(libdirectfb_display_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_display_la_OBJECTS) $(libdirectfb_display_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdisplaylayer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbpalette.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbscreen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbsurface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbsurface_layer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbsurface_window.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/display/idirectfbdisplaylayer.c b/Source/DirectFB/src/display/idirectfbdisplaylayer.c
new file mode 100755
index 0000000..014848a
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbdisplaylayer.c
@@ -0,0 +1,1076 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/surface.h>
+#include <core/gfxcard.h>
+#include <core/layers.h>
+#include <core/layers_internal.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/state.h>
+#include <core/windows.h>
+#include <core/windows_internal.h>
+#include <core/windowstack.h>
+#include <core/wm.h>
+
+#include <windows/idirectfbwindow.h>
+
+#include <gfx/convert.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <display/idirectfbdisplaylayer.h>
+#include <display/idirectfbscreen.h>
+#include <display/idirectfbsurface.h>
+#include <display/idirectfbsurface_layer.h>
+
+
+D_DEBUG_DOMAIN( Layer, "IDirectFBDisplayLayer", "Display Layer Interface" );
+
+/*
+ * private data struct of IDirectFB
+ */
+typedef struct {
+     int                              ref;              /* reference counter */
+     DFBDisplayLayerDescription       desc;             /* description of the layer's caps */
+     DFBDisplayLayerCooperativeLevel  level;            /* current cooperative level */
+     CoreScreen                      *screen;           /* layer's screen */
+     CoreLayer                       *layer;            /* core layer data */
+     CoreLayerContext                *context;          /* shared or exclusive context */
+     CoreLayerRegion                 *region;           /* primary region of the context */
+     CoreWindowStack                 *stack;            /* stack of shared context */
+     DFBBoolean                       switch_exclusive; /* switch to exclusive context after creation? */
+     CoreDFB                         *core;
+} IDirectFBDisplayLayer_data;
+
+
+
+static void
+IDirectFBDisplayLayer_Destruct( IDirectFBDisplayLayer *thiz )
+{
+     IDirectFBDisplayLayer_data *data = (IDirectFBDisplayLayer_data*)thiz->priv;
+
+     D_DEBUG_AT( Layer, "IDirectFBDisplayLayer_Destruct()\n" );
+
+     D_DEBUG_AT( Layer, "  -> unref region...\n" );
+
+     dfb_layer_region_unref( data->region );
+
+     D_DEBUG_AT( Layer, "  -> unref context...\n" );
+
+     dfb_layer_context_unref( data->context );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+     D_DEBUG_AT( Layer, "  -> done.\n" );
+}
+
+static DirectResult
+IDirectFBDisplayLayer_AddRef( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBDisplayLayer_Release( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (--data->ref == 0)
+          IDirectFBDisplayLayer_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetID( IDirectFBDisplayLayer *thiz,
+                             DFBDisplayLayerID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!id)
+          return DFB_INVARG;
+
+     *id = dfb_layer_id_translated( data->layer );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetDescription( IDirectFBDisplayLayer      *thiz,
+                                      DFBDisplayLayerDescription *desc )
+{
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     *desc = data->desc;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetSurface( IDirectFBDisplayLayer  *thiz,
+                                  IDirectFBSurface      **interface )
+{
+     DFBResult         ret;
+     CoreLayerRegion  *region;
+     IDirectFBSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED) {
+          D_WARN( "letting unprivileged IDirectFBDisplayLayer::GetSurface() "
+                   "call pass until cooperative level handling is finished" );
+     }
+
+     ret = dfb_layer_context_get_primary_region( data->context, true, ®ion );
+     if (ret)
+          return ret;
+
+     DIRECT_ALLOCATE_INTERFACE( surface, IDirectFBSurface );
+
+     ret = IDirectFBSurface_Layer_Construct( surface, NULL, NULL, NULL,
+                                             region, DSCAPS_NONE, data->core );
+
+     if (region->config.buffermode == DLBM_FRONTONLY && data->level == DLSCL_EXCLUSIVE) {
+          surface->Clear( surface, 0, 0, 0, 0 );
+          dfb_layer_region_flip_update( region, NULL, DSFLIP_NONE );
+     }
+
+     *interface = ret ? NULL : surface;
+
+     dfb_layer_region_unref( region );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetScreen( IDirectFBDisplayLayer  *thiz,
+                                 IDirectFBScreen       **interface )
+{
+     DFBResult        ret;
+     IDirectFBScreen *screen;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!interface)
+          return DFB_INVARG;
+
+     DIRECT_ALLOCATE_INTERFACE( screen, IDirectFBScreen );
+
+     ret = IDirectFBScreen_Construct( screen, data->screen );
+
+     *interface = ret ? NULL : screen;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetCooperativeLevel( IDirectFBDisplayLayer           *thiz,
+                                           DFBDisplayLayerCooperativeLevel  level )
+{
+     DFBResult         ret;
+     CoreLayerContext *context;
+     CoreLayerRegion  *region;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == level)
+          return DFB_OK;
+
+     switch (level) {
+          case DLSCL_SHARED:
+          case DLSCL_ADMINISTRATIVE:
+               if (data->level == DLSCL_EXCLUSIVE) {
+                    ret = dfb_layer_get_primary_context( data->layer, false, &context );
+                    if (ret)
+                         return ret;
+
+                    ret = dfb_layer_context_get_primary_region( context, true, ®ion );
+                    if (ret) {
+                         dfb_layer_context_unref( context );
+                         return ret;
+                    }
+
+                    dfb_layer_region_unref( data->region );
+                    dfb_layer_context_unref( data->context );
+
+                    data->context = context;
+                    data->region  = region;
+                    data->stack   = dfb_layer_context_windowstack( data->context );
+               }
+
+               break;
+
+          case DLSCL_EXCLUSIVE:
+               ret = dfb_layer_create_context( data->layer, &context );
+               if (ret)
+                    return ret;
+
+               if (data->switch_exclusive) {
+                    ret = dfb_layer_activate_context( data->layer, context );
+                    if (ret) {
+                         dfb_layer_context_unref( context );
+                         return ret;
+                    }
+               }
+
+               ret = dfb_layer_context_get_primary_region( context, true, ®ion );
+               if (ret) {
+                    dfb_layer_context_unref( context );
+                    return ret;
+               }
+
+               dfb_layer_region_unref( data->region );
+               dfb_layer_context_unref( data->context );
+
+               data->context = context;
+               data->region  = region;
+               data->stack   = dfb_layer_context_windowstack( data->context );
+
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     data->level = level;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetOpacity( IDirectFBDisplayLayer *thiz,
+                                  u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_opacity( data->context, opacity );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetCurrentOutputField( IDirectFBDisplayLayer *thiz, int *field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     return dfb_layer_get_current_output_field( data->layer, field );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetFieldParity( IDirectFBDisplayLayer *thiz, int field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level != DLSCL_EXCLUSIVE)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_field_parity( data->context, field );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetClipRegions( IDirectFBDisplayLayer *thiz,
+                                      const DFBRegion       *regions,
+                                      int                    num_regions,
+                                      DFBBoolean             positive )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!regions || num_regions < 1)
+          return DFB_INVARG;
+
+     if (num_regions > data->desc.clip_regions)
+          return DFB_UNSUPPORTED;
+
+     if (data->level != DLSCL_EXCLUSIVE)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_clip_regions( data->context, regions, num_regions, positive );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetSourceRectangle( IDirectFBDisplayLayer *thiz,
+                                          int                    x,
+                                          int                    y,
+                                          int                    width,
+                                          int                    height )
+{
+     DFBRectangle source = { x, y, width, height };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (x < 0 || y < 0 || width <= 0 || height <= 0)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_sourcerectangle( data->context, &source );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetScreenLocation( IDirectFBDisplayLayer *thiz,
+                                         float                  x,
+                                         float                  y,
+                                         float                  width,
+                                         float                  height )
+{
+     DFBLocation location = { x, y, width, height };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (! D_FLAGS_IS_SET( data->desc.caps, DLCAPS_SCREEN_LOCATION ))
+          return DFB_UNSUPPORTED;
+
+     if (width <= 0 || height <= 0)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_screenlocation( data->context, &location );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetScreenPosition( IDirectFBDisplayLayer *thiz,
+                                         int                    x,
+                                         int                    y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (! D_FLAGS_IS_SET( data->desc.caps, DLCAPS_SCREEN_POSITION ))
+          return DFB_UNSUPPORTED;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_screenposition( data->context, x, y );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetScreenRectangle( IDirectFBDisplayLayer *thiz,
+                                          int                    x,
+                                          int                    y,
+                                          int                    width,
+                                          int                    height )
+{
+     DFBRectangle rect = { x, y, width, height };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (! D_FLAGS_IS_SET( data->desc.caps, DLCAPS_SCREEN_LOCATION ))
+          return DFB_UNSUPPORTED;
+
+     if (width <= 0 || height <= 0)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_screenrectangle( data->context, &rect );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetSrcColorKey( IDirectFBDisplayLayer *thiz,
+                                      u8                     r,
+                                      u8                     g,
+                                      u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_src_colorkey( data->context, r, g, b, -1 );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetDstColorKey( IDirectFBDisplayLayer *thiz,
+                                      u8                     r,
+                                      u8                     g,
+                                      u8                     b )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_dst_colorkey( data->context, r, g, b, -1 );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetLevel( IDirectFBDisplayLayer *thiz,
+                                int                   *level )
+{
+     DFBResult ret;
+     int       lvl;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!level)
+          return DFB_INVARG;
+
+     ret = dfb_layer_get_level( data->layer, &lvl );
+     if (ret)
+          return ret;
+
+     *level = lvl;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetLevel( IDirectFBDisplayLayer *thiz,
+                                int                    level )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (! D_FLAGS_IS_SET( data->desc.caps, DLCAPS_LEVELS ))
+          return DFB_UNSUPPORTED;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_set_level( data->layer, level );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetConfiguration( IDirectFBDisplayLayer *thiz,
+                                        DFBDisplayLayerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!config)
+          return DFB_INVARG;
+
+     return dfb_layer_context_get_configuration( data->context, config );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_TestConfiguration( IDirectFBDisplayLayer       *thiz,
+                                         const DFBDisplayLayerConfig *config,
+                                         DFBDisplayLayerConfigFlags  *failed )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!config)
+          return DFB_INVARG;
+
+     if (((config->flags & DLCONF_WIDTH) && (config->width < 0)) ||
+         ((config->flags & DLCONF_HEIGHT) && (config->height < 0)))
+          return DFB_INVARG;
+
+     return dfb_layer_context_test_configuration( data->context, config, failed );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetConfiguration( IDirectFBDisplayLayer       *thiz,
+                                        const DFBDisplayLayerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!config)
+          return DFB_INVARG;
+
+     if (((config->flags & DLCONF_WIDTH) && (config->width < 0)) ||
+         ((config->flags & DLCONF_HEIGHT) && (config->height < 0)))
+          return DFB_INVARG;
+
+     switch (data->level) {
+          case DLSCL_EXCLUSIVE:
+          case DLSCL_ADMINISTRATIVE:
+               return dfb_layer_context_set_configuration( data->context, config );
+
+          default:
+               break;
+     }
+
+     return DFB_ACCESSDENIED;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetBackgroundMode( IDirectFBDisplayLayer         *thiz,
+                                         DFBDisplayLayerBackgroundMode  background_mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     switch (background_mode) {
+          case DLBM_DONTCARE:
+          case DLBM_COLOR:
+          case DLBM_IMAGE:
+          case DLBM_TILE:
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     return dfb_windowstack_set_background_mode( data->stack, background_mode );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetBackgroundImage( IDirectFBDisplayLayer *thiz,
+                                          IDirectFBSurface      *surface )
+{
+     IDirectFBSurface_data *surface_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+
+     if (!surface)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     surface_data = (IDirectFBSurface_data*)surface->priv;
+     if (!surface_data)
+          return DFB_DEAD;
+
+     if (!surface_data->surface)
+          return DFB_DESTROYED;
+
+     return dfb_windowstack_set_background_image( data->stack,
+                                                  surface_data->surface );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetBackgroundColor( IDirectFBDisplayLayer *thiz,
+                                          u8 r, u8 g, u8 b, u8 a )
+{
+     DFBColor color = { a: a, r: r, g: g, b: b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_windowstack_set_background_color( data->stack, &color );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_CreateWindow( IDirectFBDisplayLayer       *thiz,
+                                    const DFBWindowDescription  *desc,
+                                    IDirectFBWindow            **window )
+{
+     CoreWindow           *w;
+     DFBResult             ret;
+     DFBWindowDescription  wd;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     memset( &wd, 0, sizeof(wd) );
+
+     wd.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY |
+                DWDESC_PIXELFORMAT | DWDESC_SURFACE_CAPS | DWDESC_CAPS;
+
+     wd.width  = (desc->flags & DWDESC_WIDTH)  ? desc->width  : 480;
+     wd.height = (desc->flags & DWDESC_HEIGHT) ? desc->height : 300;
+     wd.posx   = (desc->flags & DWDESC_POSX)   ? desc->posx   : 100;
+     wd.posy   = (desc->flags & DWDESC_POSY)   ? desc->posy   : 100;
+
+     D_DEBUG_AT( Layer, "CreateWindow() <- %d,%d - %dx%d )\n", wd.posx, wd.posy, wd.width, wd.height );
+
+     if (desc->flags & DWDESC_CAPS)
+          wd.caps = desc->caps;
+
+     wd.caps |= DWCAPS_NOFOCUS;  //no focus patch PR  brg36mgr#118432
+
+     if (desc->flags & DWDESC_PIXELFORMAT)
+          wd.pixelformat = desc->pixelformat;
+
+     if (desc->flags & DWDESC_SURFACE_CAPS)
+          wd.surface_caps = desc->surface_caps;
+
+     if (desc->flags & DWDESC_PARENT) {
+          wd.flags     |= DWDESC_PARENT;
+          wd.parent_id  = desc->parent_id;
+     }
+
+     if (desc->flags & DWDESC_OPTIONS) {
+          wd.flags   |= DWDESC_OPTIONS;
+          wd.options  = desc->options;
+     }
+
+     if (desc->flags & DWDESC_STACKING) {
+          wd.flags    |= DWDESC_STACKING;
+          wd.stacking  = desc->stacking;
+     }
+
+     if (desc->flags & DWDESC_RESOURCE_ID) {
+          wd.flags       |= DWDESC_RESOURCE_ID;
+          wd.resource_id  = desc->resource_id;
+     }
+
+     if (desc->flags & DWDESC_TOPLEVEL_ID) {
+          wd.flags       |= DWDESC_TOPLEVEL_ID;
+          wd.toplevel_id  = desc->toplevel_id;
+     }
+
+
+     if ((wd.caps & ~DWCAPS_ALL) || !window)
+          return DFB_INVARG;
+
+     if (wd.width < 1 || wd.width > 4096 || wd.height < 1 || wd.height > 4096)
+          return DFB_INVARG;
+
+     ret = dfb_layer_context_create_window( data->core, data->context, &wd, &w );
+     if (ret)
+          return ret;
+
+     DIRECT_ALLOCATE_INTERFACE( *window, IDirectFBWindow );
+
+     return IDirectFBWindow_Construct( *window, w, data->layer, data->core );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetWindow( IDirectFBDisplayLayer  *thiz,
+                                 DFBWindowID             id,
+                                 IDirectFBWindow       **window )
+{
+     CoreWindow *w;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!window)
+          return DFB_INVARG;
+   
+      //remove for now
+     //if (data->level == DLSCL_SHARED)
+     //    return DFB_ACCESSDENIED;
+
+     w = dfb_layer_context_find_window( data->context, id );
+     if (!w)
+          return DFB_IDNOTFOUND;
+
+     DIRECT_ALLOCATE_INTERFACE( *window, IDirectFBWindow );
+
+     return IDirectFBWindow_Construct( *window, w, data->layer, data->core );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_EnableCursor( IDirectFBDisplayLayer *thiz, int enable )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_windowstack_cursor_enable( data->core, data->stack, enable );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetCursorPosition( IDirectFBDisplayLayer *thiz,
+                                         int *x, int *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     return dfb_windowstack_get_cursor_position( data->stack, x, y );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_WarpCursor( IDirectFBDisplayLayer *thiz, int x, int y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_windowstack_cursor_warp( data->stack, x, y );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetCursorAcceleration( IDirectFBDisplayLayer *thiz,
+                                             int                    numerator,
+                                             int                    denominator,
+                                             int                    threshold )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (numerator < 0  ||  denominator < 1  ||  threshold < 0)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_windowstack_cursor_set_acceleration( data->stack, numerator,
+                                                     denominator, threshold );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetCursorShape( IDirectFBDisplayLayer *thiz,
+                                      IDirectFBSurface      *shape,
+                                      int                    hot_x,
+                                      int                    hot_y )
+{
+     IDirectFBSurface_data *shape_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!shape)
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     shape_data = (IDirectFBSurface_data*)shape->priv;
+
+     if (hot_x < 0  ||
+         hot_y < 0  ||
+         hot_x >= shape_data->surface->config.size.w  ||
+         hot_y >= shape_data->surface->config.size.h)
+          return DFB_INVARG;
+
+     return dfb_windowstack_cursor_set_shape( data->stack,
+                                              shape_data->surface,
+                                              hot_x, hot_y );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetCursorOpacity( IDirectFBDisplayLayer *thiz,
+                                        u8                     opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_windowstack_cursor_set_opacity( data->stack, opacity );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetColorAdjustment( IDirectFBDisplayLayer *thiz,
+                                          DFBColorAdjustment    *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!adj)
+          return DFB_INVARG;
+
+     return dfb_layer_context_get_coloradjustment( data->context, adj );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetColorAdjustment( IDirectFBDisplayLayer    *thiz,
+                                          const DFBColorAdjustment *adj )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!adj || (adj->flags & ~DCAF_ALL))
+          return DFB_INVARG;
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     if (!adj->flags)
+          return DFB_OK;
+
+     return dfb_layer_context_set_coloradjustment( data->context, adj );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_WaitForSync( IDirectFBDisplayLayer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     return dfb_layer_wait_vsync( data->layer );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetSourceDescriptions( IDirectFBDisplayLayer            *thiz,
+                                             DFBDisplayLayerSourceDescription *ret_descriptions )
+{
+     int i;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!ret_descriptions)
+          return DFB_INVARG;
+
+     if (! D_FLAGS_IS_SET( data->desc.caps, DLCAPS_SOURCES ))
+          return DFB_UNSUPPORTED;
+
+     for (i=0; i<data->desc.sources; i++)
+          dfb_layer_get_source_info( data->layer, i, &ret_descriptions[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SwitchContext( IDirectFBDisplayLayer *thiz,
+                                     DFBBoolean             exclusive )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!exclusive && data->level == DLSCL_EXCLUSIVE) {
+          DFBResult         ret;
+          CoreLayerContext *context;
+
+          ret = dfb_layer_get_primary_context( data->layer, false, &context );
+          if (ret)
+               return ret;
+
+          dfb_layer_activate_context( data->layer, context );
+
+          dfb_layer_context_unref( context );
+     }
+     else
+         dfb_layer_activate_context( data->layer, data->context );
+
+     data->switch_exclusive = exclusive;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_SetRotation( IDirectFBDisplayLayer *thiz,
+                                   int                    rotation )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (data->level == DLSCL_SHARED)
+          return DFB_ACCESSDENIED;
+
+     return dfb_layer_context_set_rotation( data->context, rotation );
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetRotation( IDirectFBDisplayLayer *thiz,
+                                   int                   *ret_rotation )
+{
+     CoreLayerContext *context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!ret_rotation)
+          return DFB_INVARG;
+
+     context = data->context;
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     /* Lock the context. */
+     if (dfb_layer_context_lock( context ))
+          return DFB_FUSION;
+
+     *ret_rotation = context->rotation;
+
+     /* Unlock the context. */
+     dfb_layer_context_unlock( context );
+
+     return DFB_OK;
+}
+
+typedef struct {
+     unsigned long    resource_id;
+     CoreWindow      *window;
+} IDirectFBDisplayLayer_GetWindowByResourceID_Context;
+
+static DFBEnumerationResult
+IDirectFBDisplayLayer_GetWindowByResourceID_WindowCallback( CoreWindow *window,
+                                                            void       *_ctx )
+{
+     IDirectFBDisplayLayer_GetWindowByResourceID_Context *ctx = _ctx;
+
+     if (window->surface) {
+          if (window->surface->resource_id == ctx->resource_id) {
+               ctx->window = window;
+
+               return DFENUM_CANCEL;
+          }
+     }
+
+     return DFENUM_OK;
+}
+
+static DFBResult
+IDirectFBDisplayLayer_GetWindowByResourceID( IDirectFBDisplayLayer  *thiz,
+                                             unsigned long           resource_id,
+                                             IDirectFBWindow       **ret_window )
+{
+     DFBResult                                            ret;
+     CoreLayerContext                                    *context;
+     CoreWindowStack                                     *stack;
+     IDirectFBDisplayLayer_GetWindowByResourceID_Context  ctx;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDisplayLayer)
+
+     if (!ret_window)
+          return DFB_INVARG;
+
+     context = data->context;
+     D_MAGIC_ASSERT( context, CoreLayerContext );
+
+     stack = context->stack;
+     D_ASSERT( stack != NULL );
+
+     ctx.resource_id = resource_id;
+     ctx.window      = NULL;
+
+     ret = dfb_layer_context_lock( context );
+     if (ret)
+         return ret;
+
+     ret = dfb_wm_enum_windows( stack, IDirectFBDisplayLayer_GetWindowByResourceID_WindowCallback, &ctx );
+     if (ret == DFB_OK) {
+          if (ctx.window) {
+               IDirectFBWindow *window;
+
+               ret = dfb_window_ref( ctx.window );
+               if (ret == DFB_OK) {
+                    DIRECT_ALLOCATE_INTERFACE( window, IDirectFBWindow );
+
+                    ret = IDirectFBWindow_Construct( window, ctx.window, data->layer, data->core );
+                    if (ret == DFB_OK)
+                         *ret_window = window;
+               }
+          }
+          else
+               ret = DFB_IDNOTFOUND;
+     }
+
+     dfb_layer_context_unlock( context );
+
+     return ret;
+}
+
+DFBResult
+IDirectFBDisplayLayer_Construct( IDirectFBDisplayLayer *thiz,
+                                 CoreLayer             *layer,
+                                 CoreDFB               *core )
+{
+     DFBResult         ret;
+     CoreLayerContext *context;
+     CoreLayerRegion  *region;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDisplayLayer)
+
+     ret = dfb_layer_get_primary_context( layer, true, &context );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz )
+          return ret;
+     }
+
+     ret = dfb_layer_context_get_primary_region( context, true, ®ion );
+     if (ret) {
+          dfb_layer_context_unref( context );
+          DIRECT_DEALLOCATE_INTERFACE( thiz )
+          return ret;
+     }
+
+     data->ref              = 1;
+     data->core             = core;
+     data->screen           = dfb_layer_screen( layer );
+     data->layer            = layer;
+     data->context          = context;
+     data->region           = region;
+     data->stack            = dfb_layer_context_windowstack( context );
+     data->switch_exclusive = DFB_TRUE;
+
+     dfb_layer_get_description( data->layer, &data->desc );
+
+     thiz->AddRef                = IDirectFBDisplayLayer_AddRef;
+     thiz->Release               = IDirectFBDisplayLayer_Release;
+     thiz->GetID                 = IDirectFBDisplayLayer_GetID;
+     thiz->GetDescription        = IDirectFBDisplayLayer_GetDescription;
+     thiz->GetSurface            = IDirectFBDisplayLayer_GetSurface;
+     thiz->GetScreen             = IDirectFBDisplayLayer_GetScreen;
+     thiz->SetCooperativeLevel   = IDirectFBDisplayLayer_SetCooperativeLevel;
+     thiz->SetOpacity            = IDirectFBDisplayLayer_SetOpacity;
+     thiz->GetCurrentOutputField = IDirectFBDisplayLayer_GetCurrentOutputField;
+     thiz->SetSourceRectangle    = IDirectFBDisplayLayer_SetSourceRectangle;
+     thiz->SetScreenLocation     = IDirectFBDisplayLayer_SetScreenLocation;
+     thiz->SetSrcColorKey        = IDirectFBDisplayLayer_SetSrcColorKey;
+     thiz->SetDstColorKey        = IDirectFBDisplayLayer_SetDstColorKey;
+     thiz->GetLevel              = IDirectFBDisplayLayer_GetLevel;
+     thiz->SetLevel              = IDirectFBDisplayLayer_SetLevel;
+     thiz->GetConfiguration      = IDirectFBDisplayLayer_GetConfiguration;
+     thiz->TestConfiguration     = IDirectFBDisplayLayer_TestConfiguration;
+     thiz->SetConfiguration      = IDirectFBDisplayLayer_SetConfiguration;
+     thiz->SetBackgroundMode     = IDirectFBDisplayLayer_SetBackgroundMode;
+     thiz->SetBackgroundColor    = IDirectFBDisplayLayer_SetBackgroundColor;
+     thiz->SetBackgroundImage    = IDirectFBDisplayLayer_SetBackgroundImage;
+     thiz->GetColorAdjustment    = IDirectFBDisplayLayer_GetColorAdjustment;
+     thiz->SetColorAdjustment    = IDirectFBDisplayLayer_SetColorAdjustment;
+     thiz->CreateWindow          = IDirectFBDisplayLayer_CreateWindow;
+     thiz->GetWindow             = IDirectFBDisplayLayer_GetWindow;
+     thiz->WarpCursor            = IDirectFBDisplayLayer_WarpCursor;
+     thiz->SetCursorAcceleration = IDirectFBDisplayLayer_SetCursorAcceleration;
+     thiz->EnableCursor          = IDirectFBDisplayLayer_EnableCursor;
+     thiz->GetCursorPosition     = IDirectFBDisplayLayer_GetCursorPosition;
+     thiz->SetCursorShape        = IDirectFBDisplayLayer_SetCursorShape;
+     thiz->SetCursorOpacity      = IDirectFBDisplayLayer_SetCursorOpacity;
+     thiz->SetFieldParity        = IDirectFBDisplayLayer_SetFieldParity;
+     thiz->SetClipRegions        = IDirectFBDisplayLayer_SetClipRegions;
+     thiz->WaitForSync           = IDirectFBDisplayLayer_WaitForSync;
+     thiz->GetSourceDescriptions = IDirectFBDisplayLayer_GetSourceDescriptions;
+     thiz->SetScreenPosition     = IDirectFBDisplayLayer_SetScreenPosition;
+     thiz->SetScreenRectangle    = IDirectFBDisplayLayer_SetScreenRectangle;
+     thiz->SwitchContext         = IDirectFBDisplayLayer_SwitchContext;
+     thiz->SetRotation           = IDirectFBDisplayLayer_SetRotation;
+     thiz->GetRotation           = IDirectFBDisplayLayer_GetRotation;
+     thiz->GetWindowByResourceID = IDirectFBDisplayLayer_GetWindowByResourceID;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbdisplaylayer.h b/Source/DirectFB/src/display/idirectfbdisplaylayer.h
new file mode 100755
index 0000000..9b39468
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbdisplaylayer.h
@@ -0,0 +1,43 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBDISPLAYLAYER_H__
+#define __IDIRECTFBDISPLAYLAYER_H__
+
+#include <directfb.h>
+#include <core/coretypes.h>
+
+/*
+ * initializes interface struct and private data
+ */
+DFBResult IDirectFBDisplayLayer_Construct( IDirectFBDisplayLayer *thiz,
+                                           CoreLayer             *layer,
+                                           CoreDFB               *core );
+
+
+#endif
diff --git a/Source/DirectFB/src/display/idirectfbpalette.c b/Source/DirectFB/src/display/idirectfbpalette.c
new file mode 100755
index 0000000..213af4d
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbpalette.c
@@ -0,0 +1,365 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <math.h>
+
+
+#include <directfb.h>
+
+#include <core/surface.h>
+#include <core/palette.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include "idirectfbpalette.h"
+
+
+
+static void
+IDirectFBPalette_Destruct( IDirectFBPalette *thiz )
+{
+     IDirectFBPalette_data *data = (IDirectFBPalette_data*)thiz->priv;
+
+     if (data->palette)
+          dfb_palette_unref( data->palette );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBPalette_AddRef( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBPalette_Release( IDirectFBPalette *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     if (--data->ref == 0)
+          IDirectFBPalette_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_GetCapabilities( IDirectFBPalette       *thiz,
+                                  DFBPaletteCapabilities *caps )
+{
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!caps)
+          return DFB_INVARG;
+
+     /* FIXME: no caps yet */
+     *caps = DPCAPS_NONE;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_GetSize( IDirectFBPalette *thiz,
+                          unsigned int     *size )
+{
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!size)
+          return DFB_INVARG;
+
+     *size = palette->num_entries;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_SetEntries( IDirectFBPalette *thiz,
+                             const DFBColor   *entries,
+                             unsigned int      num_entries,
+                             unsigned int      offset )
+{
+     int          i;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!entries  ||  offset + num_entries > palette->num_entries)
+          return DFB_INVARG;
+
+     if (num_entries) {
+          direct_memcpy( palette->entries + offset, entries, num_entries * sizeof(DFBColor));
+
+          for (i=offset; i<offset+num_entries; i++) {
+               palette->entries_yuv[i].a = palette->entries[i].a;
+
+               RGB_TO_YCBCR( palette->entries[i].r, palette->entries[i].g, palette->entries[i].b,
+                             palette->entries_yuv[i].y, palette->entries_yuv[i].u, palette->entries_yuv[i].v );
+          }
+
+          dfb_palette_update( palette, offset, offset + num_entries - 1 );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_GetEntries( IDirectFBPalette *thiz,
+                             DFBColor         *entries,
+                             unsigned int      num_entries,
+                             unsigned int      offset )
+{
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!entries  ||  offset + num_entries > palette->num_entries)
+          return DFB_INVARG;
+
+     direct_memcpy( entries, palette->entries + offset, num_entries * sizeof(DFBColor));
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_FindBestMatch( IDirectFBPalette *thiz,
+                                u8                r,
+                                u8                g,
+                                u8                b,
+                                u8                a,
+                                unsigned int     *index )
+{
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     if (!index)
+          return DFB_INVARG;
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     *index = dfb_palette_search( palette, r, g, b, a );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_CreateCopy( IDirectFBPalette  *thiz,
+                             IDirectFBPalette **interface )
+{
+     DFBResult         ret;
+     IDirectFBPalette *iface;
+     CorePalette      *palette = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     if (!data->palette)
+          return DFB_DESTROYED;
+
+     if (!interface)
+          return DFB_INVARG;
+
+     ret = dfb_palette_create( NULL,    /* FIXME */
+                               data->palette->num_entries, &palette );
+     if (ret)
+          return ret;
+
+     direct_memcpy( palette->entries, data->palette->entries,
+                    palette->num_entries * sizeof(DFBColor));
+
+     dfb_palette_update( palette, 0, palette->num_entries - 1 );
+
+
+     DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBPalette );
+
+     ret = IDirectFBPalette_Construct( iface, palette );
+
+     dfb_palette_unref( palette );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBPalette_SetEntriesYUV( IDirectFBPalette  *thiz,
+                                const DFBColorYUV *entries,
+                                unsigned int       num_entries,
+                                unsigned int       offset )
+{
+     int          i;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!entries  ||  offset + num_entries > palette->num_entries)
+          return DFB_INVARG;
+
+     if (num_entries) {
+          direct_memcpy( palette->entries_yuv + offset, entries, num_entries * sizeof(DFBColorYUV));
+
+          for (i=offset; i<offset+num_entries; i++) {
+               palette->entries[i].a = palette->entries_yuv[i].a;
+
+               YCBCR_TO_RGB( palette->entries_yuv[i].y, palette->entries_yuv[i].u, palette->entries_yuv[i].v,
+                             palette->entries[i].r, palette->entries[i].g, palette->entries[i].b );
+          }
+
+          dfb_palette_update( palette, offset, offset + num_entries - 1 );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_GetEntriesYUV( IDirectFBPalette *thiz,
+                                DFBColorYUV      *ret_entries,
+                                unsigned int      num_entries,
+                                unsigned int      offset )
+{
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     if (!ret_entries  ||  offset + num_entries > palette->num_entries)
+          return DFB_INVARG;
+
+     direct_memcpy( ret_entries, palette->entries_yuv + offset, num_entries * sizeof(DFBColorYUV));
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBPalette_FindBestMatchYUV( IDirectFBPalette *thiz,
+                                   u8                y,
+                                   u8                u,
+                                   u8                v,
+                                   u8                a,
+                                   unsigned int     *ret_index )
+{
+     int          r, g, b;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBPalette)
+
+     if (!ret_index)
+          return DFB_INVARG;
+
+     palette = data->palette;
+     if (!palette)
+          return DFB_DESTROYED;
+
+     YCBCR_TO_RGB( y, u, v, r, g, b );
+
+     *ret_index = dfb_palette_search( palette, r, g, b, a );
+
+     return DFB_OK;
+}
+
+/******/
+
+DFBResult IDirectFBPalette_Construct( IDirectFBPalette *thiz,
+                                      CorePalette      *palette )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBPalette)
+
+     if (dfb_palette_ref( palette )) {
+          DIRECT_DEALLOCATE_INTERFACE(thiz);
+          return DFB_FAILURE;
+     }
+
+     data->ref     = 1;
+     data->palette = palette;
+
+
+     thiz->AddRef           = IDirectFBPalette_AddRef;
+     thiz->Release          = IDirectFBPalette_Release;
+
+     thiz->GetCapabilities  = IDirectFBPalette_GetCapabilities;
+     thiz->GetSize          = IDirectFBPalette_GetSize;
+
+     thiz->SetEntries       = IDirectFBPalette_SetEntries;
+     thiz->GetEntries       = IDirectFBPalette_GetEntries;
+     thiz->FindBestMatch    = IDirectFBPalette_FindBestMatch;
+
+     thiz->CreateCopy       = IDirectFBPalette_CreateCopy;
+
+     thiz->SetEntriesYUV    = IDirectFBPalette_SetEntriesYUV;
+     thiz->GetEntriesYUV    = IDirectFBPalette_GetEntriesYUV;
+     thiz->FindBestMatchYUV = IDirectFBPalette_FindBestMatchYUV;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbpalette.h b/Source/DirectFB/src/display/idirectfbpalette.h
new file mode 100755
index 0000000..2bedfa2
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbpalette.h
@@ -0,0 +1,51 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBPALETTE_H__
+#define __IDIRECTFBPALETTE_H__
+
+#include <directfb.h>
+#include <core/coretypes.h>
+
+/*
+ * private data struct of IDirectFBPalette
+ */
+typedef struct {
+     int                     ref;            /* reference counter */
+
+     CorePalette            *palette;        /* the palette object */
+} IDirectFBPalette_data;
+
+/*
+ * initializes interface struct and private data
+ */
+DFBResult IDirectFBPalette_Construct( IDirectFBPalette *thiz,
+                                      CorePalette      *palette );
+
+
+#endif
diff --git a/Source/DirectFB/src/display/idirectfbscreen.c b/Source/DirectFB/src/display/idirectfbscreen.c
new file mode 100755
index 0000000..9fcebdc
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbscreen.c
@@ -0,0 +1,722 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <core/layers.h>
+#include <core/screen.h>
+#include <core/screens.h>
+
+#include <misc/conf.h>
+
+#include <direct/interface.h>
+
+#include "idirectfbscreen.h"
+
+/*
+ * private data struct of IDirectFBScreen
+ */
+typedef struct {
+     int                              ref;     /* reference counter */
+
+     CoreScreen                      *screen;
+
+     DFBScreenID                      id;
+     DFBScreenDescription             description;
+} IDirectFBScreen_data;
+
+/******************************************************************************/
+
+static DFBResult PatchMixerConfig  ( DFBScreenMixerConfig         *patched,
+                                     const DFBScreenMixerConfig   *patch );
+static DFBResult PatchEncoderConfig( DFBScreenEncoderConfig       *patched,
+                                     const DFBScreenEncoderConfig *patch );
+static DFBResult PatchOutputConfig ( DFBScreenOutputConfig        *patched,
+                                     const DFBScreenOutputConfig  *patch );
+
+/******************************************************************************/
+
+typedef struct {
+     CoreScreen              *screen;
+
+     DFBDisplayLayerCallback  callback;
+     void                    *callback_ctx;
+} EnumDisplayLayers_Context;
+
+static DFBEnumerationResult EnumDisplayLayers_Callback( CoreLayer   *layer,
+                                                        void        *ctx );
+
+/******************************************************************************/
+
+static void
+IDirectFBScreen_Destruct( IDirectFBScreen *thiz )
+{
+//     IDirectFBScreen_data *data = (IDirectFBScreen_data*)thiz->priv;
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBScreen_AddRef( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBScreen_Release( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (--data->ref == 0)
+          IDirectFBScreen_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetID( IDirectFBScreen *thiz,
+                       DFBScreenID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!id)
+          return DFB_INVARG;
+
+     *id = data->id;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetDescription( IDirectFBScreen      *thiz,
+                                DFBScreenDescription *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     *desc = data->description;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetSize( IDirectFBScreen *thiz,
+                         int             *ret_width,
+                         int             *ret_height )
+{
+     DFBResult ret;
+     int       width  = 0;
+     int       height = 0;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!ret_width && !ret_height)
+          return DFB_INVARG;
+
+     ret = dfb_screen_get_screen_size( data->screen, &width, &height );
+
+     if (ret_width)
+          *ret_width = width;
+
+     if (ret_height)
+          *ret_height = height;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBScreen_EnumDisplayLayers( IDirectFBScreen         *thiz,
+                                   DFBDisplayLayerCallback  callbackfunc,
+                                   void                    *callbackdata )
+{
+     EnumDisplayLayers_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     context.screen       = data->screen;
+     context.callback     = callbackfunc;
+     context.callback_ctx = callbackdata;
+
+     dfb_layers_enumerate( EnumDisplayLayers_Callback, &context );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_SetPowerMode( IDirectFBScreen    *thiz,
+                              DFBScreenPowerMode  mode )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     switch (mode) {
+          case DSPM_ON:
+          case DSPM_STANDBY:
+          case DSPM_SUSPEND:
+          case DSPM_OFF:
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     return dfb_screen_set_powermode( data->screen, mode );
+}
+
+static DFBResult
+IDirectFBScreen_WaitForSync( IDirectFBScreen *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     return dfb_screen_wait_vsync( data->screen );
+}
+
+static DFBResult
+IDirectFBScreen_GetMixerDescriptions( IDirectFBScreen           *thiz,
+                                      DFBScreenMixerDescription *descriptions )
+{
+     int i;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_MIXERS))
+          return DFB_UNSUPPORTED;
+
+     for (i=0; i<data->description.mixers; i++)
+          dfb_screen_get_mixer_info( data->screen, i, &descriptions[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetMixerConfiguration( IDirectFBScreen      *thiz,
+                                       int                   mixer,
+                                       DFBScreenMixerConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config)
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_MIXERS))
+          return DFB_UNSUPPORTED;
+
+     if (mixer < 0 || mixer >= data->description.mixers)
+          return DFB_INVARG;
+
+     return dfb_screen_get_mixer_config( data->screen, mixer, config );
+}
+
+static DFBResult
+IDirectFBScreen_TestMixerConfiguration( IDirectFBScreen            *thiz,
+                                        int                         mixer,
+                                        const DFBScreenMixerConfig *config,
+                                        DFBScreenMixerConfigFlags  *failed )
+{
+     DFBResult            ret;
+     DFBScreenMixerConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_MIXERS))
+          return DFB_UNSUPPORTED;
+
+     if (mixer < 0 || mixer >= data->description.mixers)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_mixer_config( data->screen, mixer, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchMixerConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Test the patched configuration. */
+     return dfb_screen_test_mixer_config( data->screen,
+                                          mixer, &patched, failed );
+}
+
+static DFBResult
+IDirectFBScreen_SetMixerConfiguration( IDirectFBScreen            *thiz,
+                                       int                         mixer,
+                                       const DFBScreenMixerConfig *config )
+{
+     DFBResult            ret;
+     DFBScreenMixerConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSMCONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_MIXERS))
+          return DFB_UNSUPPORTED;
+
+     if (mixer < 0 || mixer >= data->description.mixers)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_mixer_config( data->screen, mixer, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchMixerConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Set the patched configuration. */
+     return dfb_screen_set_mixer_config( data->screen, mixer, &patched );
+}
+
+static DFBResult
+IDirectFBScreen_GetEncoderDescriptions( IDirectFBScreen             *thiz,
+                                        DFBScreenEncoderDescription *descriptions )
+{
+     int i;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_ENCODERS))
+          return DFB_UNSUPPORTED;
+
+     for (i=0; i<data->description.encoders; i++)
+          dfb_screen_get_encoder_info( data->screen, i, &descriptions[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetEncoderConfiguration( IDirectFBScreen        *thiz,
+                                         int                     encoder,
+                                         DFBScreenEncoderConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config)
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_ENCODERS))
+          return DFB_UNSUPPORTED;
+
+     if (encoder < 0 || encoder >= data->description.encoders)
+          return DFB_INVARG;
+
+     return dfb_screen_get_encoder_config( data->screen, encoder, config );
+}
+
+static DFBResult
+IDirectFBScreen_TestEncoderConfiguration( IDirectFBScreen              *thiz,
+                                          int                           encoder,
+                                          const DFBScreenEncoderConfig *config,
+                                          DFBScreenEncoderConfigFlags  *failed )
+{
+     DFBResult              ret;
+     DFBScreenEncoderConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_ENCODERS))
+          return DFB_UNSUPPORTED;
+
+     if (encoder < 0 || encoder >= data->description.encoders)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_encoder_config( data->screen, encoder, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchEncoderConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Test the patched configuration. */
+     return dfb_screen_test_encoder_config( data->screen,
+                                            encoder, &patched, failed );
+}
+
+static DFBResult
+IDirectFBScreen_SetEncoderConfiguration( IDirectFBScreen              *thiz,
+                                         int                           encoder,
+                                         const DFBScreenEncoderConfig *config )
+{
+     DFBResult              ret;
+     DFBScreenEncoderConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSECONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_ENCODERS))
+          return DFB_UNSUPPORTED;
+
+     if (encoder < 0 || encoder >= data->description.encoders)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_encoder_config( data->screen, encoder, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchEncoderConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Set the patched configuration. */
+     return dfb_screen_set_encoder_config( data->screen, encoder, &patched );
+}
+
+static DFBResult
+IDirectFBScreen_GetOutputDescriptions( IDirectFBScreen            *thiz,
+                                       DFBScreenOutputDescription *descriptions )
+{
+     int i;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!descriptions)
+          return DFB_INVARG;
+
+     if (!data->description.caps & DSCCAPS_OUTPUTS)
+          return DFB_UNSUPPORTED;
+
+     for (i=0; i<data->description.outputs; i++)
+          dfb_screen_get_output_info( data->screen, i, &descriptions[i] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBScreen_GetOutputConfiguration( IDirectFBScreen       *thiz,
+                                        int                    output,
+                                        DFBScreenOutputConfig *config )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config)
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_OUTPUTS))
+          return DFB_UNSUPPORTED;
+
+     if (output < 0 || output >= data->description.outputs)
+          return DFB_INVARG;
+
+     return dfb_screen_get_output_config( data->screen, output, config );
+}
+
+static DFBResult
+IDirectFBScreen_TestOutputConfiguration( IDirectFBScreen             *thiz,
+                                         int                          output,
+                                         const DFBScreenOutputConfig *config,
+                                         DFBScreenOutputConfigFlags  *failed )
+{
+     DFBResult             ret;
+     DFBScreenOutputConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_OUTPUTS))
+          return DFB_UNSUPPORTED;
+
+     if (output < 0 || output >= data->description.outputs)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_output_config( data->screen, output, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchOutputConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Test the patched configuration. */
+     return dfb_screen_test_output_config( data->screen,
+                                           output, &patched, failed );
+}
+
+static DFBResult
+IDirectFBScreen_SetOutputConfiguration( IDirectFBScreen             *thiz,
+                                        int                          output,
+                                        const DFBScreenOutputConfig *config )
+{
+     DFBResult             ret;
+     DFBScreenOutputConfig patched;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBScreen)
+
+     if (!config || (config->flags & ~DSOCONF_ALL))
+          return DFB_INVARG;
+
+     if (! (data->description.caps & DSCCAPS_OUTPUTS))
+          return DFB_UNSUPPORTED;
+
+     if (output < 0 || output >= data->description.outputs)
+          return DFB_INVARG;
+
+     /* Get the current configuration. */
+     ret = dfb_screen_get_output_config( data->screen, output, &patched );
+     if (ret)
+          return ret;
+
+     /* Patch the configuration. */
+     ret = PatchOutputConfig( &patched, config );
+     if (ret)
+          return ret;
+
+     /* Set the patched configuration. */
+     return dfb_screen_set_output_config( data->screen, output, &patched );
+}
+
+/******************************************************************************/
+
+DFBResult
+IDirectFBScreen_Construct( IDirectFBScreen *thiz,
+                           CoreScreen      *screen )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBScreen)
+
+     data->ref    = 1;
+     data->screen = screen;
+
+     dfb_screen_get_info( screen, NULL, &data->description );
+     data->id = dfb_screen_id_translated( data->screen );
+
+     thiz->AddRef                   = IDirectFBScreen_AddRef;
+     thiz->Release                  = IDirectFBScreen_Release;
+     thiz->GetID                    = IDirectFBScreen_GetID;
+     thiz->GetDescription           = IDirectFBScreen_GetDescription;
+     thiz->GetSize                  = IDirectFBScreen_GetSize;
+     thiz->EnumDisplayLayers        = IDirectFBScreen_EnumDisplayLayers;
+     thiz->SetPowerMode             = IDirectFBScreen_SetPowerMode;
+     thiz->WaitForSync              = IDirectFBScreen_WaitForSync;
+     thiz->GetMixerDescriptions     = IDirectFBScreen_GetMixerDescriptions;
+     thiz->GetMixerConfiguration    = IDirectFBScreen_GetMixerConfiguration;
+     thiz->TestMixerConfiguration   = IDirectFBScreen_TestMixerConfiguration;
+     thiz->SetMixerConfiguration    = IDirectFBScreen_SetMixerConfiguration;
+     thiz->GetEncoderDescriptions   = IDirectFBScreen_GetEncoderDescriptions;
+     thiz->GetEncoderConfiguration  = IDirectFBScreen_GetEncoderConfiguration;
+     thiz->TestEncoderConfiguration = IDirectFBScreen_TestEncoderConfiguration;
+     thiz->SetEncoderConfiguration  = IDirectFBScreen_SetEncoderConfiguration;
+     thiz->GetOutputDescriptions    = IDirectFBScreen_GetOutputDescriptions;
+     thiz->GetOutputConfiguration   = IDirectFBScreen_GetOutputConfiguration;
+     thiz->TestOutputConfiguration  = IDirectFBScreen_TestOutputConfiguration;
+     thiz->SetOutputConfiguration   = IDirectFBScreen_SetOutputConfiguration;
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static DFBResult
+PatchMixerConfig( DFBScreenMixerConfig       *patched,
+                  const DFBScreenMixerConfig *patch )
+{
+     /* Check for unsupported flags. */
+     if (patch->flags & ~patched->flags)
+          return DFB_UNSUPPORTED;
+
+     if (patch->flags & DSMCONF_TREE)
+          patched->tree = patch->tree;
+
+     if (patch->flags & DSMCONF_LEVEL)
+          patched->level = patch->level;
+
+     if (patch->flags & DSMCONF_LAYERS)
+          patched->layers = patch->layers;
+
+     if (patch->flags & DSMCONF_BACKGROUND)
+          patched->background = patch->background;
+
+     return DFB_OK;
+}
+
+static DFBResult
+PatchEncoderConfig( DFBScreenEncoderConfig       *patched,
+                    const DFBScreenEncoderConfig *patch )
+{
+     /* Check for unsupported flags. */
+     if (patch->flags & ~patched->flags)
+          return DFB_UNSUPPORTED;
+
+     if (patch->flags & DSECONF_RESOLUTION)
+          patched->resolution = patch->resolution;
+
+     if (patch->flags & DSECONF_FREQUENCY)
+          patched->frequency = patch->frequency;
+
+     /**
+      * Need to be backwards compatible with these so that
+      * they specify resolution and frequency as well.
+      * If you have set a TV_STANDARD
+      * (and set the flag) it will override the resolution and
+      * frequency chosen above.*/
+     if (patch->flags & DSECONF_TV_STANDARD) {
+          patched->tv_standard = patch->tv_standard;
+          switch (patched->tv_standard) {
+               case DSETV_PAL:
+               case DSETV_PAL_BG:
+               case DSETV_PAL_I:
+               case DSETV_PAL_N:
+               case DSETV_PAL_NC:
+                    patched->resolution = DSOR_720_576;
+                    patched->frequency = DSEF_50HZ;
+                    break;
+
+               case DSETV_PAL_60:
+               case DSETV_PAL_M:
+                    patched->resolution = DSOR_720_480;
+                    patched->frequency = DSEF_60HZ;
+                    break;
+
+               case DSETV_SECAM:
+                    patched->resolution = DSOR_720_576;
+                    patched->frequency = DSEF_50HZ;
+                    break;
+
+               case DSETV_NTSC:
+               case DSETV_NTSC_M_JPN:
+               case DSETV_NTSC_443:
+                    patched->resolution = DSOR_720_480;
+                    patched->frequency = DSEF_60HZ;
+                    break;
+
+               default:
+                    break;
+          }
+     }
+     if (patch->flags & DSECONF_TEST_PICTURE)
+          patched->test_picture = patch->test_picture;
+
+     if (patch->flags & DSECONF_MIXER)
+          patched->mixer = patch->mixer;
+
+     if (patch->flags & DSECONF_OUT_SIGNALS)
+          patched->out_signals = patch->out_signals;
+
+     if (patch->flags & DSECONF_SCANMODE)
+          patched->scanmode = patch->scanmode;
+
+     if (patch->flags & DSECONF_ADJUSTMENT)
+          patched->adjustment = patch->adjustment;
+
+     if (patch->flags & DSECONF_CONNECTORS)
+          patched->out_connectors = patch->out_connectors;
+
+     if (patch->flags & DSECONF_SLOW_BLANKING)
+          patched->slow_blanking = patch->slow_blanking;
+
+     return DFB_OK;
+}
+
+static DFBResult
+PatchOutputConfig( DFBScreenOutputConfig       *patched,
+                   const DFBScreenOutputConfig *patch )
+{
+     /* Check for unsupported flags. */
+     if (patch->flags & ~patched->flags)
+          return DFB_UNSUPPORTED;
+
+     if (patch->flags & DSOCONF_RESOLUTION)
+          patched->resolution = patch->resolution;
+
+     if (patch->flags & DSOCONF_ENCODER)
+          patched->encoder = patch->encoder;
+
+     if (patch->flags & DSOCONF_SIGNALS)
+          patched->out_signals = patch->out_signals;
+
+     if (patch->flags & DSOCONF_CONNECTORS)
+          patched->out_connectors = patch->out_connectors;
+
+     if (patch->flags & DSOCONF_SLOW_BLANKING)
+          patched->slow_blanking = patch->slow_blanking;
+
+     return DFB_OK;
+}
+
+static DFBEnumerationResult
+EnumDisplayLayers_Callback( CoreLayer *layer, void *ctx )
+{
+     DFBDisplayLayerDescription  desc;
+     DFBDisplayLayerID           id;
+     EnumDisplayLayers_Context  *context = (EnumDisplayLayers_Context*) ctx;
+
+     if (dfb_layer_screen( layer ) != context->screen)
+          return DFENUM_OK;
+
+     id = dfb_layer_id_translated( layer );
+
+     if (dfb_config->primary_only && id != DLID_PRIMARY)
+          return DFENUM_OK;
+
+     dfb_layer_get_description( layer, &desc );
+
+     return context->callback( id, desc, context->callback_ctx );
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbscreen.h b/Source/DirectFB/src/display/idirectfbscreen.h
new file mode 100755
index 0000000..682ee8b
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbscreen.h
@@ -0,0 +1,42 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBSCREEN_H__
+#define __IDIRECTFBSCREEN_H__
+
+#include <directfb.h>
+#include <core/coretypes.h>
+
+/*
+ * initializes interface struct and private data
+ */
+DFBResult IDirectFBScreen_Construct( IDirectFBScreen *thiz,
+                                     CoreScreen      *screen );
+
+
+#endif
diff --git a/Source/DirectFB/src/display/idirectfbsurface.c b/Source/DirectFB/src/display/idirectfbsurface.c
new file mode 100755
index 0000000..bd23975
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface.c
@@ -0,0 +1,2841 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <alloca.h>
+
+#include <math.h>
+
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/fonts.h>
+#include <core/state.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <media/idirectfbfont.h>
+
+#include <display/idirectfbsurface.h>
+#include <display/idirectfbpalette.h>
+
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+
+D_DEBUG_DOMAIN( Surface, "IDirectFBSurface", "IDirectFBSurface Interface" );
+
+/**********************************************************************************************************************/
+
+static ReactionResult IDirectFBSurface_listener( const void *msg_data, void *ctx );
+
+/**********************************************************************************************************************/
+
+void
+IDirectFBSurface_Destruct( IDirectFBSurface *thiz )
+{
+     IDirectFBSurface_data *data;
+     IDirectFBSurface      *parent;
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     D_ASSERT( thiz != NULL );
+
+     data = thiz->priv;
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( data->children_data == NULL );
+
+     parent = data->parent;
+     if (parent) {
+          IDirectFBSurface_data *parent_data;
+
+          D_MAGIC_ASSERT( (IAny*) parent, DirectInterface );
+
+          parent_data = parent->priv;
+          D_ASSERT( parent_data != NULL );
+
+          pthread_mutex_lock( &parent_data->children_lock );
+
+          direct_list_remove( &parent_data->children_data, &data->link );
+
+          pthread_mutex_unlock( &parent_data->children_lock );
+     }
+
+     if (data->surface)
+          dfb_surface_detach( data->surface, &data->reaction );
+
+     dfb_state_stop_drawing( &data->state );
+
+     dfb_state_set_destination( &data->state, NULL );
+     dfb_state_set_source( &data->state, NULL );
+     dfb_state_set_source_mask( &data->state, NULL );
+
+     dfb_state_destroy( &data->state );
+
+     if (data->font)
+          data->font->Release( data->font );
+
+     if (data->surface) {
+          if (data->locked)
+               dfb_surface_unlock_buffer( data->surface, &data->lock );
+
+          dfb_surface_unref( data->surface );
+     }
+
+     pthread_mutex_destroy( &data->children_lock );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+     if (parent)
+          parent->Release( parent );
+}
+
+static DirectResult
+IDirectFBSurface_AddRef( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBSurface_Release( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->ref == 0)
+          IDirectFBSurface_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+IDirectFBSurface_GetPixelFormat( IDirectFBSurface      *thiz,
+                                 DFBSurfacePixelFormat *format )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!format)
+          return DFB_INVARG;
+
+     *format = data->surface->config.format;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetAccelerationMask( IDirectFBSurface    *thiz,
+                                      IDirectFBSurface    *source,
+                                      DFBAccelerationMask *ret_mask )
+{
+     DFBAccelerationMask mask = DFXL_NONE;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!ret_mask)
+          return DFB_INVARG;
+
+     dfb_state_lock( &data->state );
+
+     /* Check drawing functions */
+     if (dfb_gfxcard_state_check( &data->state, DFXL_FILLRECTANGLE ))
+          mask |= DFXL_FILLRECTANGLE;
+
+     if (dfb_gfxcard_state_check( &data->state, DFXL_DRAWRECTANGLE ))
+          mask |= DFXL_DRAWRECTANGLE;
+
+     if (dfb_gfxcard_state_check( &data->state, DFXL_DRAWLINE ))
+          mask |= DFXL_DRAWLINE;
+
+     if (dfb_gfxcard_state_check( &data->state, DFXL_FILLTRIANGLE ))
+          mask |= DFXL_FILLTRIANGLE;
+
+     dfb_state_unlock( &data->state );
+
+     /* Check blitting functions */
+     if (source) {
+          IDirectFBSurface_data *src_data = source->priv;
+
+          dfb_state_set_source( &data->state, src_data->surface );
+
+          dfb_state_lock( &data->state );
+
+          if (dfb_gfxcard_state_check( &data->state, DFXL_BLIT ))
+               mask |= DFXL_BLIT;
+
+          if (dfb_gfxcard_state_check( &data->state, DFXL_STRETCHBLIT ))
+               mask |= DFXL_STRETCHBLIT;
+
+          if (dfb_gfxcard_state_check( &data->state, DFXL_TEXTRIANGLES ))
+               mask |= DFXL_TEXTRIANGLES;
+
+          dfb_state_unlock( &data->state );
+     }
+
+     /* Check text rendering function */
+     if (data->font) {
+          IDirectFBFont_data *font_data = data->font->priv;
+
+          if (dfb_gfxcard_drawstring_check_state( font_data->font, &data->state ))
+               mask |= DFXL_DRAWSTRING;
+     }
+
+     *ret_mask = mask;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetPosition( IDirectFBSurface *thiz,
+                          int              *x,
+                          int              *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     if (x)
+          *x = data->area.wanted.x;
+
+     if (y)
+          *y = data->area.wanted.y;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetSize( IDirectFBSurface *thiz,
+                          int              *width,
+                          int              *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     if (width)
+          *width = data->area.wanted.w;
+
+     if (height)
+          *height = data->area.wanted.h;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetVisibleRectangle( IDirectFBSurface *thiz,
+                                      DFBRectangle     *rect )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!rect)
+          return DFB_INVARG;
+
+     rect->x = data->area.current.x - data->area.wanted.x;
+     rect->y = data->area.current.y - data->area.wanted.y;
+     rect->w = data->area.current.w;
+     rect->h = data->area.current.h;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetCapabilities( IDirectFBSurface       *thiz,
+                                  DFBSurfaceCapabilities *caps )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!caps)
+          return DFB_INVARG;
+
+     *caps = data->caps;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetPalette( IDirectFBSurface  *thiz,
+                             IDirectFBPalette **interface )
+{
+     DFBResult         ret;
+     CoreSurface      *surface;
+     IDirectFBPalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (!surface->palette)
+          return DFB_UNSUPPORTED;
+
+     if (!interface)
+          return DFB_INVARG;
+
+     DIRECT_ALLOCATE_INTERFACE( palette, IDirectFBPalette );
+
+     ret = IDirectFBPalette_Construct( palette, surface->palette );
+     if (ret)
+          return ret;
+
+     *interface = palette;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetPalette( IDirectFBSurface *thiz,
+                             IDirectFBPalette *palette )
+{
+     CoreSurface           *surface;
+     IDirectFBPalette_data *palette_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (!palette)
+          return DFB_INVARG;
+
+     if (! DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          return DFB_UNSUPPORTED;
+
+     palette_data = (IDirectFBPalette_data*) palette->priv;
+     if (!palette_data)
+          return DFB_DEAD;
+
+     if (!palette_data->palette)
+          return DFB_DESTROYED;
+
+     dfb_surface_set_palette( surface, palette_data->palette );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetAlphaRamp( IDirectFBSurface *thiz,
+                               u8                a0,
+                               u8                a1,
+                               u8                a2,
+                               u8                a3 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     dfb_surface_set_alpha_ramp( data->surface, a0, a1, a2, a3 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Lock( IDirectFBSurface *thiz,
+                       DFBSurfaceLockFlags flags,
+                       void **ret_ptr, int *ret_pitch )
+{
+     DFBResult              ret;
+     CoreSurfaceBufferRole  role   = CSBR_FRONT;
+     CoreSurfaceAccessFlags access = CSAF_NONE;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!flags || !ret_ptr || !ret_pitch)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (flags & DSLF_READ)
+          access |= CSAF_READ;
+
+     if (flags & DSLF_WRITE) {
+          access |= CSAF_WRITE;
+          role = CSBR_BACK;
+     }
+
+     ret = dfb_surface_lock_buffer( data->surface, role, CSAID_CPU, access, &data->lock );
+     if (ret)
+          return ret;
+
+     data->locked = true;
+
+     *ret_ptr   = data->lock.addr + data->lock.pitch * data->area.current.y +
+                  DFB_BYTES_PER_LINE( data->surface->config.format, data->area.current.x );
+     *ret_pitch = data->lock.pitch;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetFramebufferOffset( IDirectFBSurface *thiz,
+                                       int *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!offset)
+          return DFB_INVARG;
+
+     if (!data->locked)
+          return DFB_ACCESSDENIED;
+
+     if (!data->lock.phys) {
+          /* The surface is probably in a system buffer if there's no physical address. */
+          return DFB_UNSUPPORTED;
+     }
+
+     *offset = data->lock.offset;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Unlock( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (data->locked) {
+          dfb_surface_unlock_buffer( data->surface, &data->lock );
+
+          data->locked = false;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Write( IDirectFBSurface    *thiz,
+                        const DFBRectangle  *rect,
+                        const void          *ptr,
+                        int                  pitch )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, %p [%d] )\n", __FUNCTION__, thiz, rect, ptr, pitch );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (!rect || !ptr || pitch < DFB_BYTES_PER_LINE(surface->config.format,rect->w ) )
+          return DFB_INVARG;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     D_DEBUG_AT( Surface, "  ->      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS( rect ) );
+
+     //FIXME: check rectangle
+
+     return dfb_surface_write_buffer( data->surface, CSBR_BACK, ptr, pitch, rect );
+}
+
+static DFBResult
+IDirectFBSurface_Read( IDirectFBSurface    *thiz,
+                       const DFBRectangle  *rect,
+                       void                *ptr,
+                       int                  pitch )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, %p [%d] )\n", __FUNCTION__, thiz, rect, ptr, pitch );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (!rect || !ptr || pitch < DFB_BYTES_PER_LINE(surface->config.format,rect->w ) )
+          return DFB_INVARG;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     D_DEBUG_AT( Surface, "  ->      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS( rect ) );
+
+     //FIXME: check rectangle
+
+     return dfb_surface_read_buffer( data->surface, CSBR_FRONT, ptr, pitch, rect );
+}
+
+static DFBResult
+IDirectFBSurface_Flip( IDirectFBSurface    *thiz,
+                       const DFBRegion     *region,
+                       DFBSurfaceFlipFlags  flags )
+{
+     DFBResult    ret;
+     DFBRegion    reg;
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, 0x%08x )\n", __FUNCTION__, thiz, region, flags );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!(surface->config.caps & DSCAPS_FLIPPING))
+          return DFB_UNSUPPORTED;
+
+     if (!data->area.current.w || !data->area.current.h ||
+         (region && (region->x1 > region->x2 || region->y1 > region->y2)))
+          return DFB_INVAREA;
+
+     IDirectFBSurface_StopAll( data );
+
+     /* FIXME: This is a temporary workaround for LiTE. */
+     if (data->parent) {
+          IDirectFBSurface_data *parent_data;
+
+          DIRECT_INTERFACE_GET_DATA_FROM( data->parent, parent_data, IDirectFBSurface );
+
+          /* Signal end of sequence of operations. */
+          dfb_state_lock( &parent_data->state );
+          dfb_state_stop_drawing( &parent_data->state );
+          dfb_state_unlock( &parent_data->state );
+     }
+
+     dfb_region_from_rectangle( ®, &data->area.current );
+
+     if (region) {
+          DFBRegion clip = DFB_REGION_INIT_TRANSLATED( region,
+                                                       data->area.wanted.x,
+                                                       data->area.wanted.y );
+
+          if (!dfb_region_region_intersect( ®, &clip ))
+               return DFB_INVAREA;
+     }
+
+     D_DEBUG_AT( Surface, "  ->      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION( ® ) );
+
+     if (!(flags & DSFLIP_BLIT) && reg.x1 == 0 && reg.y1 == 0 &&
+         reg.x2 == surface->config.size.w - 1 && reg.y2 == surface->config.size.h - 1)
+     {
+          ret = dfb_surface_lock( data->surface );
+          if (ret)
+               return ret;
+
+          dfb_surface_flip( data->surface, false );
+
+          dfb_surface_unlock( data->surface );
+     }
+     else
+          dfb_back_to_front_copy( data->surface, ® );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetField( IDirectFBSurface    *thiz,
+                           int                  field )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!(data->surface->config.caps & DSCAPS_INTERLACED))
+          return DFB_UNSUPPORTED;
+
+     if (field < 0 || field > 1)
+          return DFB_INVARG;
+
+     dfb_surface_set_field( data->surface, field );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Clear( IDirectFBSurface *thiz,
+                        u8 r, u8 g, u8 b, u8 a )
+{
+     DFBColor                old_color;
+     unsigned int            old_index;
+     DFBSurfaceDrawingFlags  old_flags;
+     DFBSurfaceRenderOptions old_options;
+     CoreSurface            *surface;
+     DFBColor                color = { a, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, 0x%08x )\n", __FUNCTION__, thiz, PIXEL_ARGB(a,r,g,b) );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     /* save current color and drawing flags */
+     old_color   = data->state.color;
+     old_index   = data->state.color_index;
+     old_flags   = data->state.drawingflags;
+     old_options = data->state.render_options;
+
+     /* set drawing flags */
+     dfb_state_set_drawing_flags( &data->state, DSDRAW_NOFX );
+
+     /* set render options */
+     dfb_state_set_render_options( &data->state, DSRO_NONE );
+
+     /* set color */
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          dfb_state_set_color_index( &data->state,
+                                     dfb_palette_search( surface->palette, r, g, b, a ) );
+
+     dfb_state_set_color( &data->state, &color );
+
+     /* fill the visible rectangle */
+     dfb_gfxcard_fillrectangles( &data->area.current, 1, &data->state );
+
+     /* clear the depth buffer */
+     if (data->caps & DSCAPS_DEPTH)
+          dfb_clear_depth( data->surface, &data->state.clip );
+
+     /* restore drawing flags */
+     dfb_state_set_drawing_flags( &data->state, old_flags );
+
+     /* restore render options */
+     dfb_state_set_render_options( &data->state, old_options );
+
+     /* restore color */
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          dfb_state_set_color_index( &data->state, old_index );
+
+     dfb_state_set_color( &data->state, &old_color );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetClip( IDirectFBSurface *thiz, const DFBRegion *clip )
+{
+     DFBRegion newclip;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p )\n", __FUNCTION__, thiz, clip );
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (clip) {
+          newclip = DFB_REGION_INIT_TRANSLATED( clip, data->area.wanted.x, data->area.wanted.y );
+
+          D_DEBUG_AT( Surface, "  <-      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION(&newclip) );
+
+          if (!dfb_unsafe_region_rectangle_intersect( &newclip,
+                                                      &data->area.wanted ))
+               return DFB_INVARG;
+
+          D_DEBUG_AT( Surface, "  ->      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION(&newclip) );
+
+          data->clip_set = true;
+          data->clip_wanted = newclip;
+
+          if (!dfb_region_rectangle_intersect( &newclip, &data->area.current ))
+               return DFB_INVAREA;
+     }
+     else {
+          dfb_region_from_rectangle( &newclip, &data->area.current );
+          data->clip_set = false;
+     }
+
+     D_DEBUG_AT( Surface, "  => CLIP %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION(&newclip) );
+
+     dfb_state_set_clip( &data->state, &newclip );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetClip( IDirectFBSurface *thiz, DFBRegion *ret_clip )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!ret_clip)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     *ret_clip = DFB_REGION_INIT_TRANSLATED( &data->state.clip, -data->area.wanted.x, -data->area.wanted.y );
+
+     D_DEBUG_AT( Surface, "  ->      %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION(ret_clip) );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetColor( IDirectFBSurface *thiz,
+                           u8 r, u8 g, u8 b, u8 a )
+{
+     CoreSurface *surface;
+     DFBColor     color = { a, r, g, b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, COLOR 0x%08x )\n", __FUNCTION__, thiz, PIXEL_ARGB(a, r, g, b) );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     dfb_state_set_color( &data->state, &color );
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          dfb_state_set_color_index( &data->state,
+                                     dfb_palette_search( surface->palette, r, g, b, a ) );
+
+     data->state.colors[0]        = data->state.color;
+     data->state.color_indices[0] = data->state.color_index;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetColors( IDirectFBSurface *thiz,
+                            const DFBColorID *ids,
+                            const DFBColor   *colors,
+                            unsigned int      num )
+{
+     unsigned int  i;
+     CoreSurface  *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, %p, %u )\n", __FUNCTION__, thiz, ids, colors, num );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     for (i=0; i<num; i++) {
+          D_DEBUG_AT( Surface, "  -> [%d] id %d = %02x %02x %02x %02x\n",
+                      i, ids[i], colors[i].a, colors[i].r, colors[i].g, colors[i].b );
+
+          if (ids[i] >= DFB_COLOR_IDS_MAX)
+               return DFB_INVARG;
+
+          data->state.colors[ids[i]] = colors[i];
+
+          if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+               data->state.color_indices[ids[i]] = dfb_palette_search( surface->palette,
+                                                                       colors[i].r, colors[i].g, colors[i].b, colors[i].a );
+     }
+
+     dfb_state_set_color( &data->state, &data->state.colors[0] );
+     dfb_state_set_color_index( &data->state, data->state.color_indices[0] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetColorIndex( IDirectFBSurface *thiz,
+                                unsigned int      index )
+{
+     CoreSurface *surface;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, COLOR INDEX %3u )\n", __FUNCTION__, thiz, index );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (! DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          return DFB_UNSUPPORTED;
+
+     palette = surface->palette;
+     if (!palette)
+          return DFB_UNSUPPORTED;
+
+     if (index > palette->num_entries)
+          return DFB_INVARG;
+
+     dfb_state_set_color( &data->state, &palette->entries[index] );
+
+     dfb_state_set_color_index( &data->state, index );
+
+     data->state.colors[0]        = data->state.color;
+     data->state.color_indices[0] = data->state.color_index;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetSrcBlendFunction( IDirectFBSurface        *thiz,
+                                      DFBSurfaceBlendFunction  src )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %d )\n", __FUNCTION__, thiz, src );
+
+     switch (src) {
+          case DSBF_ZERO:
+          case DSBF_ONE:
+          case DSBF_SRCCOLOR:
+          case DSBF_INVSRCCOLOR:
+          case DSBF_SRCALPHA:
+          case DSBF_INVSRCALPHA:
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+          case DSBF_DESTCOLOR:
+          case DSBF_INVDESTCOLOR:
+          case DSBF_SRCALPHASAT:
+               dfb_state_set_src_blend( &data->state, src );
+               return DFB_OK;
+
+          default:
+               break;
+     }
+
+     return DFB_INVARG;
+}
+
+static DFBResult
+IDirectFBSurface_SetDstBlendFunction( IDirectFBSurface        *thiz,
+                                      DFBSurfaceBlendFunction  dst )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %d )\n", __FUNCTION__, thiz, dst );
+
+     switch (dst) {
+          case DSBF_ZERO:
+          case DSBF_ONE:
+          case DSBF_SRCCOLOR:
+          case DSBF_INVSRCCOLOR:
+          case DSBF_SRCALPHA:
+          case DSBF_INVSRCALPHA:
+          case DSBF_DESTALPHA:
+          case DSBF_INVDESTALPHA:
+          case DSBF_DESTCOLOR:
+          case DSBF_INVDESTCOLOR:
+          case DSBF_SRCALPHASAT:
+               dfb_state_set_dst_blend( &data->state, dst );
+               return DFB_OK;
+
+          default:
+               break;
+     }
+
+     return DFB_INVARG;
+}
+
+static DFBResult
+IDirectFBSurface_SetPorterDuff( IDirectFBSurface         *thiz,
+                                DFBSurfacePorterDuffRule  rule )
+{
+     DFBSurfaceBlendFunction src;
+     DFBSurfaceBlendFunction dst;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %d )\n", __FUNCTION__, thiz, rule );
+
+
+     switch (rule) {
+          case DSPD_NONE:
+               src = DSBF_SRCALPHA;
+               dst = DSBF_INVSRCALPHA;
+               break;
+          case DSPD_CLEAR:
+               src = DSBF_ZERO;
+               dst = DSBF_ZERO;
+               break;
+          case DSPD_SRC:
+               src = DSBF_ONE;
+               dst = DSBF_ZERO;
+               break;
+          case DSPD_SRC_OVER:
+               src = DSBF_ONE;
+               dst = DSBF_INVSRCALPHA;
+               break;
+          case DSPD_DST_OVER:
+               src = DSBF_INVDESTALPHA;
+               dst = DSBF_ONE;
+               break;
+          case DSPD_SRC_IN:
+               src = DSBF_DESTALPHA;
+               dst = DSBF_ZERO;
+               break;
+          case DSPD_DST_IN:
+               src = DSBF_ZERO;
+               dst = DSBF_SRCALPHA;
+               break;
+          case DSPD_SRC_OUT:
+               src = DSBF_INVDESTALPHA;
+               dst = DSBF_ZERO;
+               break;
+          case DSPD_DST_OUT:
+               src = DSBF_ZERO;
+               dst = DSBF_INVSRCALPHA;
+               break;
+          case DSPD_SRC_ATOP:
+               src = DSBF_DESTALPHA;
+               dst = DSBF_INVSRCALPHA;
+               break;
+          case DSPD_DST_ATOP:
+               src = DSBF_INVDESTALPHA;
+               dst = DSBF_SRCALPHA;
+               break;
+          case DSPD_ADD:
+               src = DSBF_ONE;
+               dst = DSBF_ONE;
+               break;
+          case DSPD_XOR:
+               src = DSBF_INVDESTALPHA;
+               dst = DSBF_INVSRCALPHA;
+               break;
+          default:
+               return DFB_INVARG;
+     }
+
+     dfb_state_set_src_blend( &data->state, src );
+     dfb_state_set_dst_blend( &data->state, dst );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetSrcColorKey( IDirectFBSurface *thiz,
+                                 u8                r,
+                                 u8                g,
+                                 u8                b )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     data->src_key.r = r;
+     data->src_key.g = g;
+     data->src_key.b = b;
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          data->src_key.value = dfb_palette_search( surface->palette,
+                                                    r, g, b, 0x80 );
+     else
+          data->src_key.value = dfb_color_to_pixel( surface->config.format, r, g, b );
+
+     /* The new key won't be applied to this surface's state.
+        The key will be taken by the destination surface to apply it
+        to its state when source color keying is used. */
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetSrcColorKeyIndex( IDirectFBSurface *thiz,
+                                      unsigned int      index )
+{
+     CoreSurface *surface;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (! DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          return DFB_UNSUPPORTED;
+
+     palette = surface->palette;
+     if (!palette)
+          return DFB_UNSUPPORTED;
+
+     if (index > palette->num_entries)
+          return DFB_INVARG;
+
+     data->src_key.r = palette->entries[index].r;
+     data->src_key.g = palette->entries[index].g;
+     data->src_key.b = palette->entries[index].b;
+
+     data->src_key.value = index;
+
+     /* The new key won't be applied to this surface's state.
+        The key will be taken by the destination surface to apply it
+        to its state when source color keying is used. */
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetDstColorKey( IDirectFBSurface *thiz,
+                                 u8                r,
+                                 u8                g,
+                                 u8                b )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     data->dst_key.r = r;
+     data->dst_key.g = g;
+     data->dst_key.b = b;
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          data->dst_key.value = dfb_palette_search( surface->palette,
+                                                    r, g, b, 0x80 );
+     else
+          data->dst_key.value = dfb_color_to_pixel( surface->config.format, r, g, b );
+
+     dfb_state_set_dst_colorkey( &data->state, data->dst_key.value );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetDstColorKeyIndex( IDirectFBSurface *thiz,
+                                      unsigned int      index )
+{
+     CoreSurface *surface;
+     CorePalette *palette;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (! DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          return DFB_UNSUPPORTED;
+
+     palette = surface->palette;
+     if (!palette)
+          return DFB_UNSUPPORTED;
+
+     if (index > palette->num_entries)
+          return DFB_INVARG;
+
+     data->dst_key.r = palette->entries[index].r;
+     data->dst_key.g = palette->entries[index].g;
+     data->dst_key.b = palette->entries[index].b;
+
+     data->dst_key.value = index;
+
+     dfb_state_set_dst_colorkey( &data->state, data->dst_key.value );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetIndexTranslation( IDirectFBSurface *thiz,
+                                      const int        *indices,
+                                      int               num_indices )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     if (! DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          return DFB_UNSUPPORTED;
+
+     if (!indices && num_indices > 0)
+          return DFB_INVAREA;
+
+     if (num_indices < 0 || num_indices > 256)
+          return DFB_INVARG;
+
+     return dfb_state_set_index_translation( &data->state, indices, num_indices );
+}
+
+static DFBResult
+IDirectFBSurface_SetFont( IDirectFBSurface *thiz,
+                          IDirectFBFont    *font )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p )\n", __FUNCTION__, thiz, font );
+
+     if (data->font != font) {
+         if (font) {
+              IDirectFBFont_data *font_data;
+
+              ret = font->AddRef( font );
+              if (ret)
+                   return ret;
+
+              DIRECT_INTERFACE_GET_DATA_FROM( font, font_data, IDirectFBFont );
+
+              data->encoding = font_data->encoding;
+         }
+
+         if (data->font)
+              data->font->Release( data->font );
+
+         data->font = font;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetFont( IDirectFBSurface  *thiz,
+                          IDirectFBFont    **ret_font )
+{
+     DFBResult      ret;
+     IDirectFBFont *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!ret_font)
+          return DFB_INVARG;
+
+     font = data->font;
+     if (!font) {
+          *ret_font = NULL;
+          return DFB_MISSINGFONT;
+     }
+
+     ret = font->AddRef( font );
+     if (ret)
+          return ret;
+
+     *ret_font = font;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetDrawingFlags( IDirectFBSurface       *thiz,
+                                  DFBSurfaceDrawingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, 0x%08x )\n", __FUNCTION__, thiz, flags );
+
+     dfb_state_set_drawing_flags( &data->state, flags );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_FillRectangle( IDirectFBSurface *thiz,
+                                int x, int y, int w, int h )
+{
+     DFBRectangle rect = { x, y, w, h };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+     D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4dx%4d\n", 0, x, y, w, h );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (w<=0 || h<=0)
+          return DFB_INVARG;
+
+     rect.x += data->area.wanted.x;
+     rect.y += data->area.wanted.y;
+
+     dfb_gfxcard_fillrectangles( &rect, 1, &data->state );
+
+     return DFB_OK;
+}
+
+
+static DFBResult
+IDirectFBSurface_DrawLine( IDirectFBSurface *thiz,
+                           int x1, int y1, int x2, int y2 )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+     D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4d,%4d\n", 0, x1, y1, x2, y2 );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if ((x1 == x2 || y1 == y2) && !(data->state.render_options & DSRO_MATRIX)) {
+          DFBRectangle rect;
+
+          if (x1 <= x2) {
+               rect.x = x1;
+               rect.w = x2 - x1 + 1;
+          }
+          else {
+               rect.x = x2;
+               rect.w = x1 - x2 + 1;
+          }
+
+          if (y1 <= y2) {
+               rect.y = y1;
+               rect.h = y2 - y1 + 1;
+          }
+          else {
+               rect.y = y2;
+               rect.h = y1 - y2 + 1;
+          }
+
+          rect.x += data->area.wanted.x;
+          rect.y += data->area.wanted.y;
+
+          dfb_gfxcard_fillrectangles( &rect, 1, &data->state );
+     }
+     else {
+          DFBRegion line = { x1, y1, x2, y2 };
+
+          line.x1 += data->area.wanted.x;
+          line.x2 += data->area.wanted.x;
+          line.y1 += data->area.wanted.y;
+          line.y2 += data->area.wanted.y;
+
+          dfb_gfxcard_drawlines( &line, 1, &data->state );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_DrawLines( IDirectFBSurface *thiz,
+                            const DFBRegion  *lines,
+                            unsigned int      num_lines )
+{
+     unsigned int i;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p [%d] )\n", __FUNCTION__, thiz, lines, num_lines );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!lines || !num_lines)
+          return DFB_INVARG;
+
+     /* Check if all lines are either horizontal or vertical */
+     for (i=0; i<num_lines; i++) {
+          if (lines[i].x1 != lines[i].x2 && lines[i].y1 != lines[i].y2)
+               break;
+     }
+
+     /* Use real line drawing? */
+     if (i < num_lines) {
+          DFBRegion *local_lines = alloca(sizeof(DFBRegion) * num_lines);
+          
+          if (data->area.wanted.x || data->area.wanted.y) {
+               for (i=0; i<num_lines; i++) {
+                    local_lines[i].x1 = lines[i].x1 + data->area.wanted.x;
+                    local_lines[i].x2 = lines[i].x2 + data->area.wanted.x;
+                    local_lines[i].y1 = lines[i].y1 + data->area.wanted.y;
+                    local_lines[i].y2 = lines[i].y2 + data->area.wanted.y;
+               }
+          }
+          else
+               /* clipping may modify lines, so we copy them */
+               direct_memcpy( local_lines, lines, sizeof(DFBRegion) * num_lines );
+
+          dfb_gfxcard_drawlines( local_lines, num_lines, &data->state );
+     }
+     /* Optimized rectangle drawing */
+     else {
+          DFBRectangle *local_rects = alloca(sizeof(DFBRectangle) * num_lines);
+          
+          for (i=0; i<num_lines; i++) {
+               /* Vertical line? */
+               if (lines[i].x1 == lines[i].x2) {
+                    local_rects[i].x = data->area.wanted.x + lines[i].x1;
+                    local_rects[i].y = data->area.wanted.y + MIN( lines[i].y1, lines[i].y2 );
+                    local_rects[i].w = 1;
+                    local_rects[i].h = ABS( lines[i].y2 - lines[i].y1 ) + 1;
+               }
+               /* Horizontal line */
+               else {
+                    local_rects[i].x = data->area.wanted.x + MIN( lines[i].x1, lines[i].x2 );
+                    local_rects[i].y = data->area.wanted.y + lines[i].y1;
+                    local_rects[i].w = ABS( lines[i].x2 - lines[i].x1 ) + 1;
+                    local_rects[i].h = 1;
+               }
+          }
+
+          dfb_gfxcard_fillrectangles( local_rects, num_lines, &data->state );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_DrawRectangle( IDirectFBSurface *thiz,
+                                int x, int y, int w, int h )
+{
+     DFBRectangle rect = { x, y, w, h };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+     D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4dx%4d\n", 0, x, y, w, h );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (w<=0 || h<=0)
+          return DFB_INVARG;
+
+     rect.x += data->area.wanted.x;
+     rect.y += data->area.wanted.y;
+
+     dfb_gfxcard_drawrectangle( &rect, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_FillTriangle( IDirectFBSurface *thiz,
+                               int x1, int y1,
+                               int x2, int y2,
+                               int x3, int y3 )
+{
+     DFBTriangle tri = { x1, y1, x2, y2, x3, y3 };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+     D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4d,%4d-%4d,%4d\n", 0, x1, y1, x2, y2, x3, y3 );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     tri.x1 += data->area.wanted.x;
+     tri.y1 += data->area.wanted.y;
+     tri.x2 += data->area.wanted.x;
+     tri.y2 += data->area.wanted.y;
+     tri.x3 += data->area.wanted.x;
+     tri.y3 += data->area.wanted.y;
+
+     dfb_gfxcard_filltriangles( &tri, 1, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_FillRectangles( IDirectFBSurface   *thiz,
+                                 const DFBRectangle *rects,
+                                 unsigned int        num_rects )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p [%d] )\n", __FUNCTION__, thiz, rects, num_rects );
+
+     DFB_RECTANGLES_DEBUG_AT( Surface, rects, num_rects );
+
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!rects || !num_rects)
+          return DFB_INVARG;
+
+     if (data->area.wanted.x || data->area.wanted.y) {
+          unsigned int  i;
+          DFBRectangle *local_rects;
+          bool          malloced = (num_rects > 256);
+
+          if (malloced)
+               local_rects = D_MALLOC( sizeof(DFBRectangle) * num_rects );
+          else
+               local_rects = alloca( sizeof(DFBRectangle) * num_rects );
+
+          for (i=0; i<num_rects; i++) {
+               local_rects[i].x = rects[i].x + data->area.wanted.x;
+               local_rects[i].y = rects[i].y + data->area.wanted.y;
+               local_rects[i].w = rects[i].w;
+               local_rects[i].h = rects[i].h;
+          }
+
+          dfb_gfxcard_fillrectangles( local_rects, num_rects, &data->state );
+
+          if (malloced)
+               D_FREE( local_rects );
+     }
+     else
+          dfb_gfxcard_fillrectangles( rects, num_rects, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_FillSpans( IDirectFBSurface *thiz,
+                            int               y,
+                            const DFBSpan    *spans,
+                            unsigned int      num_spans )
+{
+     DFBSpan *local_spans = alloca(sizeof(DFBSpan) * num_spans);
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!spans || !num_spans)
+          return DFB_INVARG;
+
+     if (data->area.wanted.x || data->area.wanted.y) {
+          unsigned int i;
+
+          for (i=0; i<num_spans; i++) {
+               local_spans[i].x = spans[i].x + data->area.wanted.x;
+               local_spans[i].w = spans[i].w;
+          }
+     }
+     else
+          /* clipping may modify spans, so we copy them */
+          direct_memcpy( local_spans, spans, sizeof(DFBSpan) * num_spans );
+
+     dfb_gfxcard_fillspans( y + data->area.wanted.y, local_spans, num_spans, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_FillTriangles( IDirectFBSurface  *thiz,
+                                const DFBTriangle *tris,
+                                unsigned int       num_tris )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!tris || !num_tris)
+          return DFB_INVARG;
+
+     if (data->area.wanted.x || data->area.wanted.y) {
+          unsigned int  i;
+          DFBTriangle  *local_tris;
+          bool          malloced = (num_tris > 170);
+
+          if (malloced)
+               local_tris = D_MALLOC( sizeof(DFBTriangle) * num_tris );
+          else
+               local_tris = alloca( sizeof(DFBTriangle) * num_tris );
+
+          for (i=0; i<num_tris; i++) {
+               local_tris[i].x1 = tris[i].x1 + data->area.wanted.x;
+               local_tris[i].y1 = tris[i].y1 + data->area.wanted.y;
+               local_tris[i].x2 = tris[i].x2 + data->area.wanted.x;
+               local_tris[i].y2 = tris[i].y2 + data->area.wanted.y;
+               local_tris[i].x3 = tris[i].x3 + data->area.wanted.x;
+               local_tris[i].y3 = tris[i].y3 + data->area.wanted.y;
+          }
+
+          dfb_gfxcard_filltriangles( local_tris, num_tris, &data->state );
+
+          if (malloced)
+               D_FREE( local_tris );
+     }
+     else
+          dfb_gfxcard_filltriangles( tris, num_tris, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetBlittingFlags( IDirectFBSurface        *thiz,
+                                   DFBSurfaceBlittingFlags  flags )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_state_set_blitting_flags( &data->state, flags );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Blit( IDirectFBSurface   *thiz,
+                       IDirectFBSurface   *source,
+                       const DFBRectangle *sr,
+                       int dx, int dy )
+{
+     DFBRectangle srect;
+     IDirectFBSurface_data *src_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (sr)
+          D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4dx%4d <- %4d,%4d\n", 0, dx, dy, sr->w, sr->h, sr->x, sr->y );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!source)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+
+     src_data = (IDirectFBSurface_data*)source->priv;
+
+     if (!src_data->area.current.w || !src_data->area.current.h)
+          return DFB_INVAREA;
+
+     if (sr) {
+          if (sr->w < 1  ||  sr->h < 1)
+               return DFB_OK;
+
+          srect = *sr;
+
+          srect.x += src_data->area.wanted.x;
+          srect.y += src_data->area.wanted.y;
+
+          if (!dfb_rectangle_intersect( &srect, &src_data->area.current ))
+               return DFB_INVAREA;
+
+          dx += srect.x - (sr->x + src_data->area.wanted.x);
+          dy += srect.y - (sr->y + src_data->area.wanted.y);
+     }
+     else {
+          srect = src_data->area.current;
+
+          dx += srect.x - src_data->area.wanted.x;
+          dy += srect.y - src_data->area.wanted.y;
+     }
+
+     dfb_state_set_source( &data->state, src_data->surface );
+
+     /* fetch the source color key from the source if necessary */
+     if (data->state.blittingflags & DSBLIT_SRC_COLORKEY)
+          dfb_state_set_src_colorkey( &data->state, src_data->src_key.value );
+
+     dfb_gfxcard_blit( &srect,
+                       data->area.wanted.x + dx,
+                       data->area.wanted.y + dy, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_TileBlit( IDirectFBSurface   *thiz,
+                           IDirectFBSurface   *source,
+                           const DFBRectangle *sr,
+                           int dx, int dy )
+{
+     DFBRectangle srect;
+     IDirectFBSurface_data *src_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (sr)
+          D_DEBUG_AT( Surface, "  -> [%2d] %4d,%4d-%4dx%4d <- %4d,%4d\n", 0, dx, dy, sr->w, sr->h, sr->x, sr->y );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!source)
+          return DFB_INVARG;
+
+
+     src_data = (IDirectFBSurface_data*)source->priv;
+
+     if (!src_data->area.current.w || !src_data->area.current.h)
+          return DFB_INVAREA;
+
+
+     if (sr) {
+          if (sr->w < 1  ||  sr->h < 1)
+               return DFB_OK;
+
+          srect = *sr;
+
+          srect.x += src_data->area.wanted.x;
+          srect.y += src_data->area.wanted.y;
+
+          if (!dfb_rectangle_intersect( &srect, &src_data->area.current ))
+               return DFB_INVAREA;
+
+          dx += srect.x - (sr->x + src_data->area.wanted.x);
+          dy += srect.y - (sr->y + src_data->area.wanted.y);
+     }
+     else {
+          srect = src_data->area.current;
+
+          dx += srect.x - src_data->area.wanted.x;
+          dy += srect.y - src_data->area.wanted.y;
+     }
+
+     dfb_state_set_source( &data->state, src_data->surface );
+
+     /* fetch the source color key from the source if necessary */
+     if (data->state.blittingflags & DSBLIT_SRC_COLORKEY)
+          dfb_state_set_src_colorkey( &data->state, src_data->src_key.value );
+
+     dx %= srect.w;
+     if (dx > 0)
+          dx -= srect.w;
+
+     dy %= srect.h;
+     if (dy > 0)
+          dy -= srect.h;
+
+     dx += data->area.wanted.x;
+     dy += data->area.wanted.y;
+
+     dfb_gfxcard_tileblit( &srect, dx, dy,
+                           dx + data->area.wanted.w + srect.w - 1,
+                           dy + data->area.wanted.h + srect.h - 1, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_BatchBlit( IDirectFBSurface   *thiz,
+                            IDirectFBSurface   *source,
+                            const DFBRectangle *source_rects,
+                            const DFBPoint     *dest_points,
+                            int                 num )
+{
+     int                    i, dx, dy, sx, sy;
+     DFBRectangle          *rects;
+     DFBPoint              *points;
+     IDirectFBSurface_data *src_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!source || !source_rects || !dest_points || num < 1)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+
+     src_data = (IDirectFBSurface_data*)source->priv;
+
+     if (!src_data->area.current.w || !src_data->area.current.h)
+          return DFB_INVAREA;
+
+     dx = data->area.wanted.x;
+     dy = data->area.wanted.y;
+
+     sx = src_data->area.wanted.x;
+     sy = src_data->area.wanted.y;
+
+     rects  = alloca( sizeof(DFBRectangle) * num );
+     points = alloca( sizeof(DFBPoint) * num );
+
+     direct_memcpy( rects, source_rects, sizeof(DFBRectangle) * num );
+     direct_memcpy( points, dest_points, sizeof(DFBPoint) * num );
+
+     for (i=0; i<num; i++) {
+          rects[i].x += sx;
+          rects[i].y += sy;
+
+          points[i].x += dx;
+          points[i].y += dy;
+
+          if (!dfb_rectangle_intersect( &rects[i], &src_data->area.current ))
+               rects[i].w = rects[i].h = 0;
+
+          points[i].x += rects[i].x - (source_rects[i].x + sx);
+          points[i].y += rects[i].y - (source_rects[i].y + sy);
+     }
+
+     dfb_state_set_source( &data->state, src_data->surface );
+
+     /* fetch the source color key from the source if necessary */
+     if (data->state.blittingflags & DSBLIT_SRC_COLORKEY)
+          dfb_state_set_src_colorkey( &data->state, src_data->src_key.value );
+
+     dfb_gfxcard_batchblit( rects, points, num, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_StretchBlit( IDirectFBSurface   *thiz,
+                              IDirectFBSurface   *source,
+                              const DFBRectangle *source_rect,
+                              const DFBRectangle *destination_rect )
+{
+     DFBRectangle srect, drect;
+     IDirectFBSurface_data *src_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!source)
+          return DFB_INVARG;
+
+
+     src_data = (IDirectFBSurface_data*)source->priv;
+
+     if (!src_data->area.current.w || !src_data->area.current.h)
+          return DFB_INVAREA;
+
+
+     /* do destination rectangle */
+     if (destination_rect) {
+          if (destination_rect->w < 1  ||  destination_rect->h < 1)
+               return DFB_INVARG;
+
+          drect = *destination_rect;
+
+          drect.x += data->area.wanted.x;
+          drect.y += data->area.wanted.y;
+     }
+     else
+          drect = data->area.wanted;
+
+     /* do source rectangle */
+     if (source_rect) {
+          if (source_rect->w < 1  ||  source_rect->h < 1)
+               return DFB_INVARG;
+
+          srect = *source_rect;
+
+          srect.x += src_data->area.wanted.x;
+          srect.y += src_data->area.wanted.y;
+     }
+     else
+          srect = src_data->area.wanted;
+
+
+     /* clipping of the source rectangle must be applied to the destination */
+     {
+          DFBRectangle orig_src = srect;
+
+          if (!dfb_rectangle_intersect( &srect, &src_data->area.current ))
+               return DFB_INVAREA;
+
+          if (srect.x != orig_src.x)
+               drect.x += (int)( (srect.x - orig_src.x) *
+                                 (drect.w / (float)orig_src.w) + 0.5f);
+
+          if (srect.y != orig_src.y)
+               drect.y += (int)( (srect.y - orig_src.y) *
+                                 (drect.h / (float)orig_src.h) + 0.5f);
+
+          if (srect.w != orig_src.w)
+               drect.w = D_ICEIL(drect.w * (srect.w / (float)orig_src.w));
+          if (srect.h != orig_src.h)
+               drect.h = D_ICEIL(drect.h * (srect.h / (float)orig_src.h));
+     }
+
+     dfb_state_set_source( &data->state, src_data->surface );
+
+     /* fetch the source color key from the source if necessary */
+     if (data->state.blittingflags & DSBLIT_SRC_COLORKEY)
+          dfb_state_set_src_colorkey( &data->state, src_data->src_key.value );
+
+     dfb_gfxcard_stretchblit( &srect, &drect, &data->state );
+
+     return DFB_OK;
+}
+
+#define SET_VERTEX(v,X,Y,Z,W,S,T)  \
+     do {                          \
+          (v)->x = X;              \
+          (v)->y = Y;              \
+          (v)->z = Z;              \
+          (v)->w = W;              \
+          (v)->s = S;              \
+          (v)->t = T;              \
+     } while (0)
+
+static DFBResult
+IDirectFBSurface_TextureTriangles( IDirectFBSurface     *thiz,
+                                   IDirectFBSurface     *source,
+                                   const DFBVertex      *vertices,
+                                   const int            *indices,
+                                   int                   num,
+                                   DFBTriangleFormation  formation )
+{
+     int                    i;
+     DFBVertex             *translated;
+     IDirectFBSurface_data *src_data;
+     bool                   src_sub;
+     float                  x0 = 0;
+     float                  y0 = 0;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!source || !vertices || num < 3)
+          return DFB_INVARG;
+
+     src_data = (IDirectFBSurface_data*)source->priv;
+
+     if ((src_sub = (src_data->caps & DSCAPS_SUBSURFACE))) {
+          D_ONCE( "sub surface texture not fully working with 'repeated' mapping" );
+
+          x0 = data->area.wanted.x;
+          y0 = data->area.wanted.y;
+     }
+
+     switch (formation) {
+          case DTTF_LIST:
+               if (num % 3)
+                    return DFB_INVARG;
+               break;
+
+          case DTTF_STRIP:
+          case DTTF_FAN:
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     translated = alloca( num * sizeof(DFBVertex) );
+     if (!translated)
+          return DFB_NOSYSTEMMEMORY;
+
+     /* TODO: pass indices through to driver */
+     if (src_sub) {
+          float oowidth  = 1.0f / src_data->surface->config.size.w;
+          float ooheight = 1.0f / src_data->surface->config.size.h;
+
+          float s0 = src_data->area.wanted.x * oowidth;
+          float t0 = src_data->area.wanted.y * ooheight;
+
+          float fs = src_data->area.wanted.w * oowidth;
+          float ft = src_data->area.wanted.h * ooheight;
+
+          for (i=0; i<num; i++) {
+               const DFBVertex *in  = &vertices[ indices ? indices[i] : i ];
+               DFBVertex       *out = &translated[i];
+
+               SET_VERTEX( out, x0 + in->x, y0 + in->y, in->z, in->w,
+                           s0 + fs * in->s, t0 + ft * in->t );
+          }
+     }
+     else {
+          if (indices) {
+               for (i=0; i<num; i++) {
+                    const DFBVertex *in  = &vertices[ indices[i] ];
+                    DFBVertex       *out = &translated[i];
+
+                    SET_VERTEX( out, x0 + in->x, y0 + in->y, in->z, in->w, in->s, in->t );
+               }
+          }
+          else {
+               direct_memcpy( translated, vertices, num * sizeof(DFBVertex) );
+
+               for (i=0; i<num; i++) {
+                    translated[i].x += x0;
+                    translated[i].y += y0;
+               }
+          }
+     }
+
+     dfb_state_set_source( &data->state, src_data->surface );
+
+     /* fetch the source color key from the source if necessary */
+     if (data->state.blittingflags & DSBLIT_SRC_COLORKEY)
+          dfb_state_set_src_colorkey( &data->state, src_data->src_key.value );
+
+     dfb_gfxcard_texture_triangles( translated, num, formation, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_DrawString( IDirectFBSurface *thiz,
+                             const char *text, int bytes,
+                             int x, int y,
+                             DFBSurfaceTextFlags flags )
+{
+     DFBResult           ret;
+     IDirectFBFont      *font;
+     IDirectFBFont_data *font_data;
+     CoreFont           *core_font;
+     unsigned int        layers = 1;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!text)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!data->font)
+          return DFB_MISSINGFONT;
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (bytes == 0)
+          return DFB_OK;
+
+     font = data->font;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( font, font_data, IDirectFBFont );
+
+     core_font = font_data->font;
+
+     if (flags & DSTF_OUTLINE) {
+          if (!(core_font->attributes & DFFA_OUTLINED))
+               return DFB_UNSUPPORTED;
+
+          layers = 2;
+     }
+
+     if (!(flags & DSTF_TOP)) {
+          x += core_font->ascender * core_font->up_unit_x;
+          y += core_font->ascender * core_font->up_unit_y;
+
+          if (flags & DSTF_BOTTOM) {
+               x -= core_font->descender * core_font->up_unit_x;
+               y -= core_font->descender * core_font->up_unit_y;
+          }
+     }
+
+     if (flags & (DSTF_RIGHT | DSTF_CENTER)) {
+          int          i, num, kx, ky;
+          int          xsize = 0;
+          int          ysize = 0;
+          unsigned int prev = 0;
+          unsigned int indices[bytes];
+
+          /* FIXME: Avoid double locking and decoding. */
+          dfb_font_lock( core_font );
+
+          /* Decode string to character indices. */
+          ret = dfb_font_decode_text( core_font, data->encoding, text, bytes, indices, &num );
+          if (ret) {
+               dfb_font_unlock( core_font );
+               return ret;
+          }
+
+          /* Calculate string width. */
+          for (i=0; i<num; i++) {
+               unsigned int   current = indices[i];
+               CoreGlyphData *glyph;
+
+               if (dfb_font_get_glyph_data( core_font, current, 0, &glyph ) == DFB_OK) {
+                    xsize += glyph->xadvance;
+                    ysize += glyph->yadvance;
+
+                    if (prev && core_font->GetKerning &&
+                        core_font->GetKerning( core_font, prev, current, &kx, &ky ) == DFB_OK) {
+                         xsize += kx;
+                         ysize += ky;
+                    }
+               }
+
+               prev = current;
+          }
+
+          dfb_font_unlock( core_font );
+
+          /* Justify. */
+          if (flags & DSTF_RIGHT) {
+               x -= xsize;
+               y -= ysize;
+          }
+          else if (flags & DSTF_CENTER) {
+               x -= xsize >> 1;
+               y -= ysize >> 1;
+          }
+     }
+
+     dfb_gfxcard_drawstring( (const unsigned char*) text, bytes, data->encoding,
+                             data->area.wanted.x + x, data->area.wanted.y + y,
+                             core_font, layers, &data->state );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_DrawGlyph( IDirectFBSurface *thiz,
+                            unsigned int character, int x, int y,
+                            DFBSurfaceTextFlags flags )
+{
+     DFBResult           ret;
+     int                 l;
+     IDirectFBFont      *font;
+     IDirectFBFont_data *font_data;
+     CoreFont           *core_font;
+     CoreGlyphData      *glyph[DFB_FONT_MAX_LAYERS];
+     unsigned int        index;
+     unsigned int        layers = 1;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, 0x%x, %d,%d, 0x%x )\n",
+                 __FUNCTION__, thiz, character, x, y, flags );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!character)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->locked)
+          return DFB_LOCKED;
+
+     if (!data->font)
+          return DFB_MISSINGFONT;
+
+     font = data->font;
+
+     DIRECT_INTERFACE_GET_DATA_FROM( font, font_data, IDirectFBFont );
+
+     core_font = font_data->font;
+
+     if (flags & DSTF_OUTLINE) {
+          if (!(core_font->attributes & DFFA_OUTLINED))
+               return DFB_UNSUPPORTED;
+
+          layers = 2;
+     }
+
+     dfb_font_lock( core_font );
+
+     ret = dfb_font_decode_character( core_font, data->encoding, character, &index );
+     if (ret) {
+          dfb_font_unlock( core_font );
+          return ret;
+     }
+
+     for (l=0; l<layers; l++) {
+          ret = dfb_font_get_glyph_data( core_font, index, l, &glyph[l] );
+          if (ret) {
+               dfb_font_unlock( core_font );
+               return ret;
+          }
+     }
+
+     if (!(flags & DSTF_TOP)) {
+          x += core_font->ascender * core_font->up_unit_x;
+          y += core_font->ascender * core_font->up_unit_y;
+
+          if (flags & DSTF_BOTTOM) {
+               x -= core_font->descender * core_font->up_unit_x;
+               y -= core_font->descender * core_font->up_unit_y;
+          }
+     }
+
+     if (flags & (DSTF_RIGHT | DSTF_CENTER)) {
+          if (flags & DSTF_RIGHT) {
+               x -= glyph[0]->xadvance;
+               y -= glyph[0]->yadvance;
+          }
+          else if (flags & DSTF_CENTER) {
+               x -= glyph[0]->xadvance >> 1;
+               y -= glyph[0]->yadvance >> 1;
+          }
+     }
+
+     dfb_gfxcard_drawglyph( glyph,
+                            data->area.wanted.x + x, data->area.wanted.y + y,
+                            core_font, layers, &data->state );
+
+     dfb_font_unlock( core_font );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetEncoding( IDirectFBSurface  *thiz,
+                              DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %d )\n", __FUNCTION__, thiz, encoding );
+
+     /* TODO: check for support or fail later? */
+     data->encoding = encoding;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetSubSurface( IDirectFBSurface    *thiz,
+                                const DFBRectangle  *rect,
+                                IDirectFBSurface   **surface )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     /* Check arguments */
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!surface)
+          return DFB_INVARG;
+          
+     /* Allocate interface */
+     DIRECT_ALLOCATE_INTERFACE( *surface, IDirectFBSurface );
+
+     if (rect || data->limit_set) {
+          DFBRectangle wanted, granted;
+          
+          /* Compute wanted rectangle */
+          if (rect) {
+               wanted = *rect;
+
+               wanted.x += data->area.wanted.x;
+               wanted.y += data->area.wanted.y;
+
+               if (wanted.w <= 0 || wanted.h <= 0) {
+                    wanted.w = 0;
+                    wanted.h = 0;
+               }
+          }
+          else {
+               wanted = data->area.wanted;
+          }
+          
+          /* Compute granted rectangle */
+          granted = wanted;
+
+          dfb_rectangle_intersect( &granted, &data->area.granted );
+          
+          /* Construct */
+          ret = IDirectFBSurface_Construct( *surface, thiz,
+                                            &wanted, &granted, &data->area.insets,
+                                            data->surface,
+                                            data->caps | DSCAPS_SUBSURFACE, data->core );
+     }
+     else {
+          /* Construct */
+          ret = IDirectFBSurface_Construct( *surface, thiz,
+                                            NULL, NULL, &data->area.insets,
+                                            data->surface, 
+                                            data->caps | DSCAPS_SUBSURFACE, data->core );
+     }
+     
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_MakeSubSurface( IDirectFBSurface   *thiz,
+                                 IDirectFBSurface   *from,
+                                 const DFBRectangle *rect )
+{
+     CoreSurface           *surface;
+     DFBRectangle           wanted, granted;
+     DFBRectangle           full_rect;
+     IDirectFBSurface_data *from_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     /* Check arguments */
+     if (!from)
+          return DFB_INVARG;
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(from, from_data, IDirectFBSurface);
+
+     /* Check if CoreSurface is the same */
+     if (from_data->surface != surface)
+          return DFB_UNSUPPORTED;
+
+
+     full_rect.x = 0;
+     full_rect.y = 0;
+     full_rect.w = surface->config.size.w;
+     full_rect.h = surface->config.size.h;
+
+     if (rect || from_data->limit_set) {
+          /* Compute wanted rectangle */
+          if (rect) {
+               wanted = *rect;
+
+               wanted.x += from_data->area.wanted.x;
+               wanted.y += from_data->area.wanted.y;
+
+               if (wanted.w <= 0 || wanted.h <= 0) {
+                    wanted.w = 0;
+                    wanted.h = 0;
+               }
+          }
+          else {
+               wanted = from_data->area.wanted;
+          }
+          
+          /* Compute granted rectangle */
+          granted = wanted;
+
+          dfb_rectangle_intersect( &granted, &from_data->area.granted );
+     }
+     else {
+          wanted  = full_rect;
+          granted = full_rect;
+     }
+
+
+     data->caps |= DSCAPS_SUBSURFACE;
+
+
+     data->area.wanted  = wanted;
+     data->area.granted = granted;
+
+     data->area.current = data->area.granted;
+     dfb_rectangle_intersect( &data->area.current, &full_rect );
+
+
+     data->state.clip.x1   = data->area.current.x;
+     data->state.clip.y1   = data->area.current.y;
+     data->state.clip.x2   = data->area.current.x + (data->area.current.w ? : 1) - 1;
+     data->state.clip.y2   = data->area.current.y + (data->area.current.h ? : 1) - 1;
+
+     data->state.modified |= SMF_CLIP;
+
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_GetGL( IDirectFBSurface   *thiz,
+                        IDirectFBGL       **interface )
+{
+     DFBResult ret;
+     DirectInterfaceFuncs *funcs = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+
+     ret = DirectGetInterface( &funcs, "IDirectFBGL", NULL, DirectProbeInterface, thiz );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( (void**)interface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( *interface, thiz );
+     if (ret)
+          *interface = NULL;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBSurface_Dump( IDirectFBSurface   *thiz,
+                       const char         *directory,
+                       const char         *prefix )
+{
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!directory)
+          return DFB_INVARG;
+
+     if (!data->area.current.w || !data->area.current.h)
+          return DFB_INVAREA;
+
+     if (data->caps & DSCAPS_SUBSURFACE) {
+          D_ONCE( "sub surface dumping not supported yet" );
+          return DFB_UNSUPPORTED;
+     }
+
+     surface = data->surface;
+     if (!surface)
+          return DFB_DESTROYED;
+
+     return dfb_surface_dump_buffer( surface, CSBR_FRONT, directory, prefix );
+}
+
+static DFBResult
+IDirectFBSurface_DisableAcceleration( IDirectFBSurface    *thiz,
+                                      DFBAccelerationMask  mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (D_FLAGS_INVALID( mask, DFXL_ALL ))
+          return DFB_INVARG;
+
+     data->state.disabled = mask;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_ReleaseSource( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_state_set_source( &data->state, NULL );
+     dfb_state_set_source_mask( &data->state, NULL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetRenderOptions( IDirectFBSurface        *thiz,
+                                   DFBSurfaceRenderOptions  options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_state_set_render_options( &data->state, options );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetMatrix( IDirectFBSurface *thiz,
+                            const s32        *matrix )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p )\n", __FUNCTION__, thiz, matrix );
+
+     if (!matrix)
+          return DFB_INVARG;
+
+     dfb_state_set_matrix( &data->state, matrix );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_SetSourceMask( IDirectFBSurface    *thiz,
+                                IDirectFBSurface    *mask,
+                                int                  x,
+                                int                  y,
+                                DFBSurfaceMaskFlags  flags )
+{
+     DFBResult              ret;
+     DFBPoint               offset = { x, y };
+     IDirectFBSurface_data *mask_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, %d,%d, 0x%04x )\n", __FUNCTION__, thiz, mask, x, y, flags );
+
+     if (!mask || flags & ~DSMF_ALL)
+          return DFB_INVARG;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(mask, mask_data, IDirectFBSurface);
+
+     if (!mask_data->surface)
+          return DFB_DESTROYED;
+
+     ret = dfb_state_set_source_mask( &data->state, mask_data->surface );
+     if (ret)
+          return ret;
+
+     dfb_state_set_source_mask_vals( &data->state, &offset, flags );
+
+     return DFB_OK;
+}
+
+/******/
+
+DFBResult IDirectFBSurface_Construct( IDirectFBSurface       *thiz,
+                                      IDirectFBSurface       *parent,
+                                      DFBRectangle           *wanted,
+                                      DFBRectangle           *granted,
+                                      DFBInsets              *insets,
+                                      CoreSurface            *surface,
+                                      DFBSurfaceCapabilities  caps,
+                                      CoreDFB                *core )
+{
+     DFBRectangle rect = { 0, 0, surface->config.size.w, surface->config.size.h };
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref = 1;
+     data->caps = caps | surface->config.caps;
+     data->core = core;
+
+     if (dfb_surface_ref( surface )) {
+          DIRECT_DEALLOCATE_INTERFACE(thiz);
+          return DFB_FAILURE;
+     }
+
+     if (parent && dfb_config->startstop) {
+          IDirectFBSurface_data *parent_data;
+
+          if (parent->AddRef( parent )) {
+               dfb_surface_unref( surface );
+               DIRECT_DEALLOCATE_INTERFACE(thiz);
+               return DFB_FAILURE;
+          }
+
+          DIRECT_INTERFACE_GET_DATA_FROM( parent, parent_data, IDirectFBSurface );
+
+          pthread_mutex_lock( &parent_data->children_lock );
+
+          direct_list_append( &parent_data->children_data, &data->link );
+
+          pthread_mutex_unlock( &parent_data->children_lock );
+
+          data->parent = parent;
+     }
+
+     pthread_mutex_init( &data->children_lock, NULL );
+
+     /* The area insets */
+     if (insets) {
+          data->area.insets = *insets;
+          dfb_rectangle_subtract( &rect, insets );
+     }
+
+     /* The area that was requested */
+     if (wanted)
+          data->area.wanted = *wanted;
+     else
+          data->area.wanted = rect;
+
+     /* The area that will never be exceeded */
+     if (granted)
+          data->area.granted = *granted;
+     else
+          data->area.granted = data->area.wanted;
+
+     /* The currently accessible rectangle */
+     data->area.current = data->area.granted;
+     dfb_rectangle_intersect( &data->area.current, &rect );
+     
+     /* Whether granted rectangle is meaningful */
+     data->limit_set = (granted != NULL);
+
+     data->surface = surface;
+
+     dfb_state_init( &data->state, NULL );
+     dfb_state_set_destination( &data->state, surface );
+
+     data->state.clip.x1  = data->area.current.x;
+     data->state.clip.y1  = data->area.current.y;
+     data->state.clip.x2  = data->area.current.x + (data->area.current.w ? : 1) - 1;
+     data->state.clip.y2  = data->area.current.y + (data->area.current.h ? : 1) - 1;
+
+     data->state.modified = SMF_ALL;
+
+     thiz->AddRef = IDirectFBSurface_AddRef;
+     thiz->Release = IDirectFBSurface_Release;
+
+     thiz->GetCapabilities = IDirectFBSurface_GetCapabilities;
+     thiz->GetPosition = IDirectFBSurface_GetPosition;
+     thiz->GetSize = IDirectFBSurface_GetSize;
+     thiz->GetVisibleRectangle = IDirectFBSurface_GetVisibleRectangle;
+     thiz->GetPixelFormat = IDirectFBSurface_GetPixelFormat;
+     thiz->GetAccelerationMask = IDirectFBSurface_GetAccelerationMask;
+
+     thiz->GetPalette = IDirectFBSurface_GetPalette;
+     thiz->SetPalette = IDirectFBSurface_SetPalette;
+     thiz->SetAlphaRamp = IDirectFBSurface_SetAlphaRamp;
+
+     thiz->Lock = IDirectFBSurface_Lock;
+     thiz->GetFramebufferOffset = IDirectFBSurface_GetFramebufferOffset;
+     thiz->Unlock = IDirectFBSurface_Unlock;
+     thiz->Flip = IDirectFBSurface_Flip;
+     thiz->SetField = IDirectFBSurface_SetField;
+     thiz->Clear = IDirectFBSurface_Clear;
+
+     thiz->SetClip = IDirectFBSurface_SetClip;
+     thiz->GetClip = IDirectFBSurface_GetClip;
+     thiz->SetColor = IDirectFBSurface_SetColor;
+     thiz->SetColorIndex = IDirectFBSurface_SetColorIndex;
+     thiz->SetSrcBlendFunction = IDirectFBSurface_SetSrcBlendFunction;
+     thiz->SetDstBlendFunction = IDirectFBSurface_SetDstBlendFunction;
+     thiz->SetPorterDuff = IDirectFBSurface_SetPorterDuff;
+     thiz->SetSrcColorKey = IDirectFBSurface_SetSrcColorKey;
+     thiz->SetSrcColorKeyIndex = IDirectFBSurface_SetSrcColorKeyIndex;
+     thiz->SetDstColorKey = IDirectFBSurface_SetDstColorKey;
+     thiz->SetDstColorKeyIndex = IDirectFBSurface_SetDstColorKeyIndex;
+     thiz->SetIndexTranslation = IDirectFBSurface_SetIndexTranslation;
+
+     thiz->SetBlittingFlags = IDirectFBSurface_SetBlittingFlags;
+     thiz->Blit = IDirectFBSurface_Blit;
+     thiz->TileBlit = IDirectFBSurface_TileBlit;
+     thiz->BatchBlit = IDirectFBSurface_BatchBlit;
+     thiz->StretchBlit = IDirectFBSurface_StretchBlit;
+     thiz->TextureTriangles = IDirectFBSurface_TextureTriangles;
+
+     thiz->SetDrawingFlags = IDirectFBSurface_SetDrawingFlags;
+     thiz->FillRectangle = IDirectFBSurface_FillRectangle;
+     thiz->DrawLine = IDirectFBSurface_DrawLine;
+     thiz->DrawLines = IDirectFBSurface_DrawLines;
+     thiz->DrawRectangle = IDirectFBSurface_DrawRectangle;
+     thiz->FillTriangle = IDirectFBSurface_FillTriangle;
+     thiz->FillRectangles = IDirectFBSurface_FillRectangles;
+     thiz->FillSpans = IDirectFBSurface_FillSpans;
+     thiz->FillTriangles = IDirectFBSurface_FillTriangles;
+
+     thiz->SetFont = IDirectFBSurface_SetFont;
+     thiz->GetFont = IDirectFBSurface_GetFont;
+     thiz->DrawString = IDirectFBSurface_DrawString;
+     thiz->DrawGlyph = IDirectFBSurface_DrawGlyph;
+     thiz->SetEncoding = IDirectFBSurface_SetEncoding;
+
+     thiz->GetSubSurface = IDirectFBSurface_GetSubSurface;
+
+     thiz->GetGL = IDirectFBSurface_GetGL;
+
+     thiz->Dump = IDirectFBSurface_Dump;
+     thiz->DisableAcceleration = IDirectFBSurface_DisableAcceleration;
+     thiz->ReleaseSource = IDirectFBSurface_ReleaseSource;
+
+     thiz->SetRenderOptions = IDirectFBSurface_SetRenderOptions;
+     thiz->SetMatrix        = IDirectFBSurface_SetMatrix;
+     thiz->SetSourceMask    = IDirectFBSurface_SetSourceMask;
+
+     thiz->MakeSubSurface = IDirectFBSurface_MakeSubSurface;
+
+     thiz->Write = IDirectFBSurface_Write;
+     thiz->Read  = IDirectFBSurface_Read;
+
+     thiz->SetColors = IDirectFBSurface_SetColors;
+
+     dfb_surface_attach( surface,
+                         IDirectFBSurface_listener, thiz, &data->reaction );
+
+     return DFB_OK;
+}
+
+
+/* internal */
+
+static ReactionResult
+IDirectFBSurface_listener( const void *msg_data, void *ctx )
+{
+     const CoreSurfaceNotification *notification = msg_data;
+     IDirectFBSurface              *thiz         = ctx;
+     IDirectFBSurface_data         *data         = thiz->priv;
+     CoreSurface                   *surface      = data->surface;
+
+     D_DEBUG_AT( Surface, "%s( %p, %p )\n", __FUNCTION__, msg_data, ctx );
+
+     if (notification->flags & CSNF_DESTROY) {
+          if (data->surface) {
+               data->surface = NULL;
+               dfb_surface_unref( surface );
+          }
+          return RS_REMOVE;
+     }
+
+     if (notification->flags & CSNF_SIZEFORMAT) {
+          DFBRectangle rect = { 0, 0, surface->config.size.w, surface->config.size.h };
+          
+          dfb_rectangle_subtract( &rect, &data->area.insets );
+
+          if (data->limit_set) {
+               data->area.current = data->area.granted;
+
+               dfb_rectangle_intersect( &data->area.current, &rect );
+          }
+          else
+               data->area.wanted = data->area.granted = data->area.current = rect;
+
+          /* Reset clip to avoid crashes caused by drawing out of bounds. */
+          if (data->clip_set)
+               thiz->SetClip( thiz, &data->clip_wanted );
+          else
+               thiz->SetClip( thiz, NULL );
+     }
+
+     return RS_OK;
+}
+
+void
+IDirectFBSurface_StopAll( IDirectFBSurface_data *data )
+{
+     if (!dfb_config->startstop)
+          return;
+
+     if (data->children_data) {
+          IDirectFBSurface_data *child;
+
+          pthread_mutex_lock( &data->children_lock );
+
+          direct_list_foreach (child, data->children_data)
+               IDirectFBSurface_StopAll( child );
+
+          pthread_mutex_unlock( &data->children_lock );
+     }
+
+     /* Signal end of sequence of operations. */
+     dfb_state_lock( &data->state );
+     dfb_state_stop_drawing( &data->state );
+     dfb_state_unlock( &data->state );
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbsurface.h b/Source/DirectFB/src/display/idirectfbsurface.h
new file mode 100755
index 0000000..a350054
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface.h
@@ -0,0 +1,123 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBSURFACE_H__
+#define __IDIRECTFBSURFACE_H__
+
+#include <directfb.h>
+
+#include <direct/types.h>
+
+#include <fusion/reactor.h>
+
+#include <core/coretypes.h>
+#include <core/state.h>
+
+
+/*
+ * private data struct of IDirectFBSurface
+ */
+typedef struct {
+     DirectLink             link;
+
+     int                    ref;             /* reference counter */
+
+     DFBSurfaceCapabilities caps;            /* capabilities */
+
+     struct {
+         DFBRectangle       wanted;          /* passed to GetSubSurface */
+         DFBRectangle       granted;         /* clipped by parent on creation */
+         DFBRectangle       current;         /* currently available area */
+         DFBInsets          insets;          /* actually set by the window manager */
+     } area;
+     
+     bool                   limit_set;       /* greanted rectangle set?
+                                                (GetSubSurface called with rect != NULL) */
+
+     bool                   clip_set;        /* fixed clip set? (SetClip called
+                                                with clip != NULL) */
+     DFBRegion              clip_wanted;     /* last region passed to SetClip
+                                                intersected by wanted area,
+                                                only valid if clip_set != 0 */
+
+     CoreSurface           *surface;         /* buffer to show */
+     bool                   locked;          /* which buffer is locked? */
+     CoreSurfaceBufferLock  lock;
+
+     IDirectFBFont         *font;            /* font to use */
+     CardState              state;           /* render state to use */
+     DFBTextEncodingID      encoding;        /* text encoding */
+
+     struct {
+          u8                r;               /* red component */
+          u8                g;               /* green component */
+          u8                b;               /* blue component */
+          u32               value;           /* r/g/b in surface's format */
+     } src_key;                              /* src key for blitting from
+                                                this surface */
+
+     struct {
+          u8                r;               /* red component */
+          u8                g;               /* green component */
+          u8                b;               /* blue component */
+          u32               value;           /* r/g/b in surface's format */
+     } dst_key;                              /* dst key for blitting to
+                                                this surface */
+
+     Reaction               reaction;
+
+     CoreDFB               *core;
+
+     IDirectFBSurface      *parent;
+     DirectLink            *children_data;
+     pthread_mutex_t        children_lock;
+} IDirectFBSurface_data;
+
+/*
+ * initializes interface struct and private data
+ */
+DFBResult IDirectFBSurface_Construct( IDirectFBSurface *thiz,
+                                      IDirectFBSurface *parent,
+                                      DFBRectangle *req_rect,
+                                      DFBRectangle *clip_rect,
+                                      DFBInsets    *insets,
+                                      CoreSurface  *surface,
+                                      DFBSurfaceCapabilities  caps,
+                                      CoreDFB                *core );
+
+/*
+ * destroys surface(s) and frees private data
+ */
+void IDirectFBSurface_Destruct( IDirectFBSurface *thiz );
+
+/*
+ * internal
+ */
+void IDirectFBSurface_StopAll( IDirectFBSurface_data *data );
+
+#endif
diff --git a/Source/DirectFB/src/display/idirectfbsurface_layer.c b/Source/DirectFB/src/display/idirectfbsurface_layer.c
new file mode 100755
index 0000000..4507a56
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface_layer.c
@@ -0,0 +1,244 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/state.h>
+#include <core/layers.h>
+#include <core/layer_region.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include "idirectfbsurface.h"
+#include "idirectfbsurface_layer.h"
+
+#include <misc/util.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <gfx/util.h>
+
+
+D_DEBUG_DOMAIN( Surface, "IDirectFBSurfaceL", "IDirectFBSurface_Layer Interface" );
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBSurface_Layer_Destruct( IDirectFBSurface *thiz )
+{
+     IDirectFBSurface_Layer_data *data = (IDirectFBSurface_Layer_data*) thiz->priv;
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_layer_region_unref( data->region );
+     IDirectFBSurface_Destruct( thiz );
+}
+
+static DirectResult
+IDirectFBSurface_Layer_Release( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Layer)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->base.ref == 0)
+          IDirectFBSurface_Layer_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Layer_Flip( IDirectFBSurface    *thiz,
+                             const DFBRegion     *region,
+                             DFBSurfaceFlipFlags  flags )
+{
+     DFBRegion reg;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Layer)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, 0x%08x )\n", __FUNCTION__, thiz, region, flags );
+
+     if (!data->base.surface)
+          return DFB_DESTROYED;
+
+     if (data->base.locked)
+          return DFB_LOCKED;
+
+     if (!data->base.area.current.w || !data->base.area.current.h ||
+         (region && (region->x1 > region->x2 || region->y1 > region->y2)))
+          return DFB_INVAREA;
+
+
+     IDirectFBSurface_StopAll( &data->base );
+
+     if (data->base.parent) {
+          IDirectFBSurface_data *parent_data;
+
+          DIRECT_INTERFACE_GET_DATA_FROM( data->base.parent, parent_data, IDirectFBSurface );
+
+          /* Signal end of sequence of operations. */
+          dfb_state_lock( &parent_data->state );
+          dfb_state_stop_drawing( &parent_data->state );
+          dfb_state_unlock( &parent_data->state );
+     }
+
+
+     dfb_region_from_rectangle( ®, &data->base.area.current );
+
+     if (region) {
+          DFBRegion clip = DFB_REGION_INIT_TRANSLATED( region,
+                                                       data->base.area.wanted.x,
+                                                       data->base.area.wanted.y );
+
+          if (!dfb_region_region_intersect( ®, &clip ))
+               return DFB_INVAREA;
+     }
+
+     D_DEBUG_AT( Surface, "  -> FLIP %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION( ® ) );
+
+     return dfb_layer_region_flip_update( data->region, ®, flags );
+}
+
+static DFBResult
+IDirectFBSurface_Layer_GetSubSurface( IDirectFBSurface    *thiz,
+                                      const DFBRectangle  *rect,
+                                      IDirectFBSurface   **surface )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Layer)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     /* Check arguments */
+     if (!data->base.surface)
+          return DFB_DESTROYED;
+
+     if (!surface)
+          return DFB_INVARG;
+          
+     /* Allocate interface */
+     DIRECT_ALLOCATE_INTERFACE( *surface, IDirectFBSurface );
+
+     if (rect || data->base.limit_set) {
+          DFBRectangle wanted, granted;
+          
+          /* Compute wanted rectangle */
+          if (rect) {
+               wanted = *rect;
+
+               wanted.x += data->base.area.wanted.x;
+               wanted.y += data->base.area.wanted.y;
+
+               if (wanted.w <= 0 || wanted.h <= 0) {
+                    wanted.w = 0;
+                    wanted.h = 0;
+               }
+          }
+          else {
+               wanted = data->base.area.wanted;
+          }
+          
+          /* Compute granted rectangle */
+          granted = wanted;
+
+          dfb_rectangle_intersect( &granted, &data->base.area.granted );
+          
+          /* Construct */
+          ret = IDirectFBSurface_Layer_Construct( *surface, thiz, &wanted, &granted,
+                                                  data->region, data->base.caps |
+                                                  DSCAPS_SUBSURFACE, data->base.core );
+     }
+     else {
+          /* Construct */
+          ret = IDirectFBSurface_Layer_Construct( *surface, thiz, NULL, NULL,
+                                                  data->region, data->base.caps |
+                                                  DSCAPS_SUBSURFACE, data->base.core );
+     }
+     
+     return ret;
+}
+
+DFBResult
+IDirectFBSurface_Layer_Construct( IDirectFBSurface       *thiz,
+                                  IDirectFBSurface       *parent,
+                                  DFBRectangle           *wanted,
+                                  DFBRectangle           *granted,
+                                  CoreLayerRegion        *region,
+                                  DFBSurfaceCapabilities  caps,
+                                  CoreDFB                *core )
+{
+     DFBResult    ret;
+     CoreSurface *surface;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBSurface_Layer);
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (dfb_layer_region_ref( region ))
+          return DFB_FUSION;
+
+     ret = dfb_layer_region_get_surface( region, &surface );
+     if (ret) {
+          dfb_layer_region_unref( region );
+          DIRECT_DEALLOCATE_INTERFACE(thiz);
+          return ret;
+     }
+
+     ret = IDirectFBSurface_Construct( thiz, parent, wanted, granted, NULL,
+                                       surface, surface->config.caps | caps, core );
+     if (ret) {
+          dfb_surface_unref( surface );
+          dfb_layer_region_unref( region );
+          return ret;
+     }
+
+     dfb_surface_unref( surface );
+
+     data->region = region;
+
+     thiz->Release       = IDirectFBSurface_Layer_Release;
+     thiz->Flip          = IDirectFBSurface_Layer_Flip;
+     thiz->GetSubSurface = IDirectFBSurface_Layer_GetSubSurface;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbsurface_layer.h b/Source/DirectFB/src/display/idirectfbsurface_layer.h
new file mode 100755
index 0000000..c2ddb8c
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface_layer.h
@@ -0,0 +1,57 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFBSURFACE_LAYER_H__
+#define __DIRECTFBSURFACE_LAYER_H__
+
+#include <directfb.h>
+#include <core/coretypes.h>
+
+/*
+ * private data struct of IDirectFBSurface_Layer
+ */
+typedef struct {
+     IDirectFBSurface_data  base;   /* base Surface implementation */
+
+     CoreLayerRegion       *region; /* the region this surface belongs to */
+} IDirectFBSurface_Layer_data;
+
+/*
+ * sets buffer mode according to capabilities, calls base classes
+ * IDirectFBSurface_Construct, reallocates private data and
+ * overloads functions of the interface
+ */
+DFBResult IDirectFBSurface_Layer_Construct( IDirectFBSurface       *thiz,
+                                            IDirectFBSurface       *parent,
+                                            DFBRectangle           *req_rect,
+                                            DFBRectangle           *clip_rect,
+                                            CoreLayerRegion        *region,
+                                            DFBSurfaceCapabilities  caps,
+                                            CoreDFB                *core );
+
+#endif
diff --git a/Source/DirectFB/src/display/idirectfbsurface_window.c b/Source/DirectFB/src/display/idirectfbsurface_window.c
new file mode 100755
index 0000000..c76eb3d
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface_window.c
@@ -0,0 +1,353 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coretypes.h>
+
+#include <core/fonts.h>
+#include <core/gfxcard.h>
+#include <core/layer_context.h>
+#include <core/layer_region.h>
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/windows.h>
+#include <core/windows_internal.h> /* FIXME */
+#include <core/wm.h>
+
+#include <display/idirectfbsurface.h>
+#include <display/idirectfbsurface_window.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <misc/util.h>
+
+#include <gfx/util.h>
+
+
+D_DEBUG_DOMAIN( Surface, "IDirectFBSurfaceW", "IDirectFBSurface_Window Interface" );
+
+/**********************************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBSurface_Window
+ */
+typedef struct {
+     IDirectFBSurface_data base;   /* base Surface implementation */
+
+     CoreWindow           *window; /* pointer to core data */
+
+     pthread_t             flip_thread; /* thread for non-flipping primary
+                                           surfaces, to make changes visible */
+
+//     CoreGraphicsSerial    serial;
+} IDirectFBSurface_Window_data;
+
+/**********************************************************************************************************************/
+
+static void *Flipping_Thread( void *arg );
+
+/**********************************************************************************************************************/
+
+static void
+IDirectFBSurface_Window_Destruct( IDirectFBSurface *thiz )
+{
+     IDirectFBSurface_Window_data *data;
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     D_ASSERT( thiz != NULL );
+
+     data = thiz->priv;
+
+     if ((int) data->flip_thread != -1) {
+          pthread_cancel( data->flip_thread );
+          pthread_join( data->flip_thread, NULL );
+     }
+
+     dfb_window_unref( data->window );
+
+     IDirectFBSurface_Destruct( thiz );
+}
+
+static DirectResult
+IDirectFBSurface_Window_Release( IDirectFBSurface *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Window)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->base.ref == 0)
+          IDirectFBSurface_Window_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Window_Flip( IDirectFBSurface    *thiz,
+                              const DFBRegion     *region,
+                              DFBSurfaceFlipFlags  flags )
+{
+     DFBResult ret;
+     DFBRegion reg;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Window)
+
+     D_DEBUG_AT( Surface, "%s( %p, %p, 0x%08x )\n", __FUNCTION__, thiz, region, flags );
+
+     if (!data->base.surface)
+          return DFB_DESTROYED;
+
+     if (data->base.locked)
+          return DFB_LOCKED;
+
+     if (!data->base.area.current.w || !data->base.area.current.h ||
+         (region && (region->x1 > region->x2 || region->y1 > region->y2)))
+          return DFB_INVAREA;
+
+
+     IDirectFBSurface_StopAll( &data->base );
+
+     if (data->base.parent) {
+          IDirectFBSurface_data *parent_data;
+
+          DIRECT_INTERFACE_GET_DATA_FROM( data->base.parent, parent_data, IDirectFBSurface );
+
+          /* Signal end of sequence of operations. */
+          dfb_state_lock( &parent_data->state );
+          dfb_state_stop_drawing( &parent_data->state );
+          dfb_state_unlock( &parent_data->state );
+     }
+
+
+
+     dfb_region_from_rectangle( ®, &data->base.area.current );
+
+     if (region) {
+          DFBRegion clip = DFB_REGION_INIT_TRANSLATED( region,
+                                                       data->base.area.wanted.x,
+                                                       data->base.area.wanted.y );
+
+          if (!dfb_region_region_intersect( ®, &clip ))
+               return DFB_INVAREA;
+     }
+
+     D_DEBUG_AT( Surface, "  -> FLIP %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS_FROM_REGION( ® ) );
+
+
+     if (flags & DSFLIP_PIPELINE) {
+          dfb_gfxcard_wait_serial( &data->window->serial2 );
+
+          data->window->serial2 = data->window->serial1;
+
+          dfb_state_get_serial( &data->base.state, &data->window->serial1 );
+     }
+
+
+     if (data->window->region) {
+          dfb_layer_region_flip_update( data->window->region, ®, flags );
+     }
+     else {
+          if (data->base.surface->config.caps & DSCAPS_FLIPPING) {
+               if (!(flags & DSFLIP_BLIT) && reg.x1 == 0 && reg.y1 == 0 &&
+                   reg.x2 == data->base.surface->config.size.w  - 1 &&
+                   reg.y2 == data->base.surface->config.size.h - 1)
+               {
+                    ret = dfb_surface_lock( data->base.surface );
+                    if (ret)
+                         return ret;
+
+                    dfb_surface_flip( data->base.surface, false );
+
+                    dfb_surface_unlock( data->base.surface );
+               }
+               else
+                    dfb_back_to_front_copy( data->base.surface, ® );
+          }
+
+          dfb_window_repaint( data->window, ®, flags );
+     }
+
+     if (!data->window->config.opacity && data->base.caps & DSCAPS_PRIMARY)
+          dfb_window_set_opacity( data->window, 0xff );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBSurface_Window_GetSubSurface( IDirectFBSurface    *thiz,
+                                       const DFBRectangle  *rect,
+                                       IDirectFBSurface   **surface )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface_Window)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     /* Check arguments */
+     if (!data->base.surface || !data->window || !data->window->surface)
+          return DFB_DESTROYED;
+
+     if (!surface)
+          return DFB_INVARG;
+          
+     /* Allocate interface */
+     DIRECT_ALLOCATE_INTERFACE( *surface, IDirectFBSurface );
+
+     if (rect || data->base.limit_set) {
+          DFBRectangle wanted, granted;
+          
+          /* Compute wanted rectangle */
+          if (rect) {
+               wanted = *rect;
+
+               wanted.x += data->base.area.wanted.x;
+               wanted.y += data->base.area.wanted.y;
+
+               if (wanted.w <= 0 || wanted.h <= 0) {
+                    wanted.w = 0;
+                    wanted.h = 0;
+               }
+          }
+          else {
+               wanted = data->base.area.wanted;
+          }
+          
+          /* Compute granted rectangle */
+          granted = wanted;
+
+          dfb_rectangle_intersect( &granted, &data->base.area.granted );
+          
+          /* Construct */
+          ret = IDirectFBSurface_Window_Construct( *surface, thiz, &wanted, &granted,
+                                                   data->window, data->base.caps |
+                                                   DSCAPS_SUBSURFACE, data->base.core );
+     }
+     else {
+          /* Construct */
+          ret = IDirectFBSurface_Window_Construct( *surface, thiz, NULL, NULL,
+                                                   data->window, data->base.caps |
+                                                   DSCAPS_SUBSURFACE, data->base.core );
+     }
+     
+     return ret;
+}
+
+DFBResult
+IDirectFBSurface_Window_Construct( IDirectFBSurface       *thiz,
+                                   IDirectFBSurface       *parent,
+                                   DFBRectangle           *wanted,
+                                   DFBRectangle           *granted,
+                                   CoreWindow             *window,
+                                   DFBSurfaceCapabilities  caps,
+                                   CoreDFB                *core )
+{
+     DFBResult        ret;
+     DFBInsets        insets;
+     CoreWindowStack *stack;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBSurface_Window)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     stack = window->stack;
+     D_MAGIC_ASSERT( stack, CoreWindowStack );
+
+     dfb_layer_context_lock( stack->context );
+
+     dfb_wm_get_insets( stack, window, &insets );
+     
+     dfb_layer_context_unlock( stack->context );
+
+     ret = IDirectFBSurface_Construct( thiz, parent, wanted, granted, &insets,
+                                       window->surface, caps, core );
+     if (ret)
+          return ret;
+
+     if (dfb_window_ref( window )) {
+          IDirectFBSurface_Destruct( thiz );
+          return DFB_FAILURE;
+     }
+
+     data->window = window;
+     data->flip_thread = (pthread_t) -1;
+
+     /*
+      * Create an auto flipping thread if the application
+      * requested a (primary) surface that doesn't need to be flipped.
+      * Window surfaces even need to be flipped when they are single buffered.
+      */
+     if (!(caps & DSCAPS_FLIPPING) && !(caps & DSCAPS_SUBSURFACE)) {
+          if (dfb_config->autoflip_window)
+               pthread_create( &data->flip_thread, NULL, Flipping_Thread, thiz );
+          else
+               D_WARN( "Non-flipping window surface and no 'autoflip-window' option used" );
+     }
+
+     thiz->Release = IDirectFBSurface_Window_Release;
+     thiz->Flip = IDirectFBSurface_Window_Flip;
+     thiz->GetSubSurface = IDirectFBSurface_Window_GetSubSurface;
+     
+     return DFB_OK;
+}
+
+
+/* file internal */
+
+static void *
+Flipping_Thread( void *arg )
+{
+     IDirectFBSurface             *thiz = (IDirectFBSurface*) arg;
+     IDirectFBSurface_Window_data *data = (IDirectFBSurface_Window_data*) thiz->priv;
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     while (data->base.surface && data->window->surface) {
+          pthread_testcancel();
+
+          /*
+           * OPTIMIZE: only call if surface has been touched in the meantime
+           */
+          thiz->Flip( thiz, NULL, 0 );
+
+          usleep(40000);
+     }
+
+     return NULL;
+}
+
diff --git a/Source/DirectFB/src/display/idirectfbsurface_window.h b/Source/DirectFB/src/display/idirectfbsurface_window.h
new file mode 100755
index 0000000..92ca56e
--- /dev/null
+++ b/Source/DirectFB/src/display/idirectfbsurface_window.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DIRECTFBSURFACE_WINDOW_H__
+#define __DIRECTFBSURFACE_WINDOW_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+/*
+ * calls base classes IDirectFBSurface_Construct,
+ * reallocates private data and overloads functions of the interface
+ */
+DFBResult IDirectFBSurface_Window_Construct( IDirectFBSurface       *thiz,
+                                             IDirectFBSurface       *parent,
+                                             DFBRectangle           *req_rect,
+                                             DFBRectangle           *clip_rect,
+                                             CoreWindow             *window,
+                                             DFBSurfaceCapabilities  caps,
+                                             CoreDFB                *core );
+
+#endif
diff --git a/Source/DirectFB/src/gfx/Makefile.am b/Source/DirectFB/src/gfx/Makefile.am
new file mode 100755
index 0000000..8cbd6b9
--- /dev/null
+++ b/Source/DirectFB/src/gfx/Makefile.am
@@ -0,0 +1,29 @@
+## Makefile.am for DirectFB/src/misc
+
+SUBDIRS = generic
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/gfx
+
+internalinclude_HEADERS = \
+	clip.h			\
+	convert.h		\
+	util.h
+
+
+noinst_LTLIBRARIES = libdirectfb_gfx.la
+
+libdirectfb_gfx_la_SOURCES = \
+	clip.c			\
+	convert.c		\
+	util.c
+
+libdirectfb_gfx_la_LIBADD = \
+	generic/libdirectfb_generic.la
diff --git a/Source/DirectFB/src/gfx/Makefile.in b/Source/DirectFB/src/gfx/Makefile.in
new file mode 100755
index 0000000..db7dfa4
--- /dev/null
+++ b/Source/DirectFB/src/gfx/Makefile.in
@@ -0,0 +1,676 @@
+# 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@
+subdir = src/gfx
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_gfx_la_DEPENDENCIES = generic/libdirectfb_generic.la
+am_libdirectfb_gfx_la_OBJECTS = clip.lo convert.lo util.lo
+libdirectfb_gfx_la_OBJECTS = $(am_libdirectfb_gfx_la_OBJECTS)
+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_gfx_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_gfx_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = generic
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/gfx
+internalinclude_HEADERS = \
+	clip.h			\
+	convert.h		\
+	util.h
+
+noinst_LTLIBRARIES = libdirectfb_gfx.la
+libdirectfb_gfx_la_SOURCES = \
+	clip.c			\
+	convert.c		\
+	util.c
+
+libdirectfb_gfx_la_LIBADD = \
+	generic/libdirectfb_generic.la
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/gfx/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/gfx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_gfx.la: $(libdirectfb_gfx_la_OBJECTS) $(libdirectfb_gfx_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_gfx_la_OBJECTS) $(libdirectfb_gfx_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-internalincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-internalincludeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-internalincludeHEADERS
+
+# 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/src/gfx/clip.c b/Source/DirectFB/src/gfx/clip.c
new file mode 100755
index 0000000..195dc73
--- /dev/null
+++ b/Source/DirectFB/src/gfx/clip.c
@@ -0,0 +1,379 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+
+#include <directfb.h>
+
+#include <direct/util.h>
+
+#include <misc/util.h>
+
+#include <gfx/clip.h>
+
+#define REGION_CODE(x,y,cx1,cx2,cy1,cy2) ( ( (y) > (cy2) ? 8 : 0) | \
+                                           ( (y) < (cy1) ? 4 : 0) | \
+                                           ( (x) > (cx2) ? 2 : 0) | \
+                                           ( (x) < (cx1) ? 1 : 0) )
+
+
+DFBBoolean
+dfb_clip_line( const DFBRegion *clip, DFBRegion *line )
+{
+     unsigned char region_code1 = REGION_CODE( line->x1, line->y1,
+                                               clip->x1,
+                                               clip->x2,
+                                               clip->y1,
+                                               clip->y2 );
+
+     unsigned char region_code2 = REGION_CODE( line->x2, line->y2,
+                                               clip->x1,
+                                               clip->x2,
+                                               clip->y1,
+                                               clip->y2 );
+
+     while (region_code1 | region_code2) {
+          /* line completely outside the clipping rectangle */
+          if (region_code1 & region_code2)
+               return DFB_FALSE;
+
+
+          if (region_code1) {
+               if (region_code1 & 8) { /* divide line at bottom*/
+                    line->x1 = line->x1 +(line->x2-line->x1) * (clip->y2 - line->y1) / (line->y2-line->y1);
+                    line->y1 = clip->y2;
+               }
+               else
+                    if (region_code1 & 4) { /* divide line at top*/
+                    line->x1 = line->x1 +(line->x2-line->x1) * (clip->y1 - line->y1) / (line->y2-line->y1);
+                    line->y1 = clip->y1;
+               }
+               else
+                    if (region_code1 & 2) { /* divide line at right*/
+                    line->y1 = line->y1 +(line->y2-line->y1) * (clip->x2 - line->x1) / (line->x2-line->x1);
+                    line->x1 = clip->x2;
+               }
+               else
+                    if (region_code1 & 1) { /* divide line at right*/
+                    line->y1 = line->y1 +(line->y2-line->y1) * (clip->x1 - line->x1) / (line->x2-line->x1);
+                    line->x1 = clip->x1;
+               }
+               region_code1 = REGION_CODE( line->x1, line->y1,
+                                           clip->x1,
+                                           clip->x2,
+                                           clip->y1,
+                                           clip->y2 );
+          }
+          else {
+               if (region_code2 & 8) {  /* divide line at bottom*/
+                    line->x2 = line->x1 +(line->x2-line->x1) * (clip->y2 - line->y1) / (line->y2-line->y1);
+                    line->y2 = clip->y2;
+               }
+               else
+                    if (region_code2 & 4) { /* divide line at top*/
+                    line->x2 = line->x1 +(line->x2-line->x1) * (clip->y1 - line->y1) / (line->y2-line->y1);
+                    line->y2 = clip->y1;
+               }
+               else
+                    if (region_code2 & 2) { /* divide line at right*/
+                    line->y2 = line->y1 +(line->y2-line->y1) * (clip->x2 - line->x1) / (line->x2-line->x1);
+                    line->x2 = clip->x2;
+               }
+               else
+                    if (region_code2 & 1) { /* divide line at right*/
+                    line->y2 = line->y1 +(line->y2-line->y1) * (clip->x1 - line->x1) / (line->x2-line->x1);
+                    line->x2 = clip->x1;
+               }
+               region_code2 = REGION_CODE( line->x2, line->y2, clip->x1,
+                                                     clip->x2,
+                                                     clip->y1,
+                                                     clip->y2 );
+          }
+     }
+
+     /* successfully clipped or clipping not neccessary */
+     return DFB_TRUE;
+}
+
+DFBEdgeFlags
+dfb_clip_edges( const DFBRegion *clip, DFBRectangle *rect )
+{
+     DFBEdgeFlags flags = DFEF_ALL;
+
+     if ((clip->x1 >= rect->x + rect->w) ||
+         (clip->x2 < rect->x) ||
+         (clip->y1 >= rect->y + rect->h) ||
+         (clip->y2 < rect->y))
+          return DFEF_NONE;
+
+     if (clip->x1 > rect->x) {
+          rect->w += rect->x - clip->x1;
+          rect->x = clip->x1;
+
+          flags &= ~DFEF_LEFT;
+     }
+
+     if (clip->y1 > rect->y) {
+          rect->h += rect->y - clip->y1;
+          rect->y = clip->y1;
+
+          flags &= ~DFEF_TOP;
+     }
+
+     if (clip->x2 < rect->x + rect->w - 1) {
+          rect->w = clip->x2 - rect->x + 1;
+
+          flags &= ~DFEF_RIGHT;
+     }
+
+     if (clip->y2 < rect->y + rect->h - 1) {
+          rect->h = clip->y2 - rect->y + 1;
+
+          flags &= ~DFEF_BOTTOM;
+     }
+
+     return flags;
+}
+
+DFBBoolean
+dfb_clip_rectangle( const DFBRegion *clip, DFBRectangle *rect )
+{
+     if ((clip->x1 >= rect->x + rect->w) ||
+         (clip->x2 < rect->x) ||
+         (clip->y1 >= rect->y + rect->h) ||
+         (clip->y2 < rect->y))
+          return DFB_FALSE;
+
+     if (clip->x1 > rect->x) {
+          rect->w += rect->x - clip->x1;
+          rect->x = clip->x1;
+     }
+
+     if (clip->y1 > rect->y) {
+          rect->h += rect->y - clip->y1;
+          rect->y = clip->y1;
+     }
+
+     if (clip->x2 < rect->x + rect->w - 1)
+          rect->w = clip->x2 - rect->x + 1;
+
+     if (clip->y2 < rect->y + rect->h - 1)
+          rect->h = clip->y2 - rect->y + 1;
+
+     return DFB_TRUE;
+}
+
+DFBBoolean
+dfb_clip_triangle_precheck( const DFBRegion *clip, const DFBTriangle *tri )
+{
+    int x, y, w, h;
+
+    x = MIN (MIN (tri->x1, tri->x2), tri->x3);
+    y = MIN (MIN (tri->y1, tri->y2), tri->y3);
+    w = MAX (MAX (tri->x1, tri->x2), tri->x3) - x;
+    h = MAX (MAX (tri->y1, tri->y2), tri->y3) - y;
+
+    if (clip->x1 > x ||
+        clip->x2 < x + w ||
+        clip->y1 > y ||
+        clip->y2 < y + h)
+      return DFB_FALSE;
+
+    return DFB_TRUE;
+}
+
+DFBBoolean
+dfb_clip_triangle( const DFBRegion *clip, const DFBTriangle *tri, DFBPoint p[6], int *num )
+{
+     DFBRegion edges[3];
+     int       num_edges;
+     int       i, n;
+     DFBPoint  p1 = {0, 0}, p2 = {0, 0};
+     
+     /* Initialize edges. */
+     edges[0].x1 = tri->x1; edges[0].y1 = tri->y1;
+     edges[0].x2 = tri->x2; edges[0].y2 = tri->y2;
+     edges[1].x1 = tri->x2; edges[1].y1 = tri->y2;
+     edges[1].x2 = tri->x3; edges[1].y2 = tri->y3;
+     edges[2].x1 = tri->x3; edges[2].y1 = tri->y3;
+     edges[2].x2 = tri->x1; edges[2].y2 = tri->y1;
+     num_edges = 3;
+     
+     for (i = 0; i < num_edges; i++) {
+          DFBRegion *reg = &edges[i];
+          DFBRegion  line;
+          bool       i1, i2;
+
+          /* Clip the edge to the clipping region. */
+          line = *reg;
+          if (dfb_clip_line( clip, &line )) {
+               *reg = line;
+               continue;
+          }
+          
+          /* If the edge doesn't intersect clipping region, then
+           * intersect the edge with the diagonals of the clipping
+           * rectangle. If intersection point exits, add the nearest
+           * corner of the clipping region to the list of vertices.
+           */
+         
+          /* Diagonal (x1,y1) (x2,y2). */
+          line = (DFBRegion) { clip->x1, clip->y1, clip->x2, clip->y2 };   
+          i1 = dfb_line_segment_intersect( &line, reg, &p1.x, &p1.y );
+          if (i1) {
+               /* Get nearest corner. */
+               if (p1.x <= clip->x1 || p1.y <= clip->y1) {
+                    p1.x = clip->x1;
+                    p1.y = clip->y1;
+               } else {
+                    p1.x = clip->x2;
+                    p1.y = clip->y2;
+               }
+          }
+          
+          /* Diagonal (x2,y1) (x1,y2). */
+          line = (DFBRegion) { clip->x2, clip->y1, clip->x1, clip->y2 };
+          i2 = dfb_line_segment_intersect( &line, reg, &p2.x, &p2.y );
+          if (i2) {
+               /* Get nearest corner. */
+               if (p2.x >= clip->x2 || p2.y <= clip->y1) {
+                    p2.x = clip->x2;
+                    p2.y = clip->y1;
+               } else {
+                    p2.x = clip->x1;
+                    p2.y = clip->y2;
+               }
+          }  
+          
+          if (i1 && i2) {
+               reg->x1 = p1.x;
+               reg->y1 = p1.y;
+               reg->x2 = p2.x;
+               reg->y2 = p2.y;
+          }
+          else if (i1) {
+               reg->x1 = reg->x2 = p1.x;
+               reg->y1 = reg->y2 = p1.y;
+          }
+          else if (i2) {
+               reg->x1 = reg->x2 = p2.x;
+               reg->y1 = reg->y2 = p2.y;
+          }
+          else {
+               /* Redudant edge. Remote it. */
+               memmove( reg, &edges[i+1], (num_edges-i-1) * sizeof(DFBRegion) );
+               num_edges--;
+               i--;
+          }
+     }
+     
+     if (num_edges < 1) {
+          *num = 0;
+          return DFB_FALSE;
+     }
+     
+     /* Get vertices from edges. */
+     p[0].x = edges[0].x1; p[0].y = edges[0].y1;
+     n = 1;
+     if (edges[0].x2 != edges[0].x1 || edges[0].y2 != edges[0].y1) {
+          p[1].x = edges[0].x2; p[1].y = edges[0].y2;
+          n++;
+     }
+     
+     for (i = 1; i < num_edges; i++) {
+          if (edges[i].x1 != p[n-1].x || edges[i].y1 != p[n-1].y) {
+               p[n].x = edges[i].x1; p[n].y = edges[i].y1;
+               n++;
+          }
+          if (edges[i].x2 != p[n-1].x || edges[i].y2 != p[n-1].y) {
+               p[n].x = edges[i].x2; p[n].y = edges[i].y2;
+               n++;
+          }
+     }
+     
+     if (p[n-1].x == p[0].x && p[n-1].y == p[0].y)
+          n--;
+     
+     *num = n;
+     
+     /* Actually fail if the number of vertices is below 3. */
+     return (n >= 3);
+}
+
+
+void
+dfb_clip_blit( const DFBRegion *clip,
+               DFBRectangle *srect, int *dx, int *dy )
+{
+     if (clip->x1 > *dx ) {
+          srect->w = MIN( (clip->x2 - clip->x1) + 1,
+                    (*dx + srect->w) - clip->x1);
+
+          srect->x+= clip->x1 - *dx;
+          *dx = clip->x1;
+     }
+     else if (clip->x2 < *dx + srect->w - 1) {
+          srect->w = clip->x2 - *dx + 1;
+     }
+
+     if (clip->y1 > *dy ) {
+          srect->h = MIN( (clip->y2 - clip->y1) + 1,
+                          (*dy + srect->h) - clip->y1);
+          srect->y+= clip->y1 - *dy;
+          *dy = clip->y1;
+     }
+     else if (clip->y2 < *dy + srect->h - 1) {
+          srect->h = clip->y2 - *dy + 1;
+     }
+}
+
+void
+dfb_clip_stretchblit( const DFBRegion *clip,
+                      DFBRectangle *srect, DFBRectangle *drect )
+{
+     DFBRectangle orig_dst = *drect;
+
+     dfb_clip_rectangle( clip, drect );
+
+     if (drect->x != orig_dst.x)
+          srect->x += (int)( (drect->x - orig_dst.x) *
+                             (srect->w / (float)orig_dst.w) );
+
+     if (drect->y != orig_dst.y)
+          srect->y += (int)( (drect->y - orig_dst.y) *
+                             (srect->h / (float)orig_dst.h) );
+
+     if (drect->w != orig_dst.w)
+          srect->w = (int)( srect->w * (drect->w / (float)orig_dst.w) );
+
+     if (drect->h != orig_dst.h)
+          srect->h = (int)( srect->h * (drect->h / (float)orig_dst.h) );
+}
+
diff --git a/Source/DirectFB/src/gfx/clip.h b/Source/DirectFB/src/gfx/clip.h
new file mode 100755
index 0000000..e1ea261
--- /dev/null
+++ b/Source/DirectFB/src/gfx/clip.h
@@ -0,0 +1,125 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GFX__CLIP_H__
+#define __GFX__CLIP_H__
+
+#include <directfb.h>
+
+typedef enum {
+     DFEF_NONE      = 0x00000000,
+
+     DFEF_LEFT      = 0x00000001,
+     DFEF_RIGHT     = 0x00000002,
+     DFEF_TOP       = 0x00000004,
+     DFEF_BOTTOM    = 0x00000008,
+
+     DFEF_ALL       = 0x0000000F
+} DFBEdgeFlags;
+
+/*
+ * Clips the line to the clipping region.
+ * Returns DFB_TRUE if at least one pixel of the line resides in the region.
+ */
+DFBBoolean   dfb_clip_line( const DFBRegion *clip, DFBRegion *line );
+
+/*
+ * Clips the rectangle to the clipping region.
+ * Returns true if there was an intersection with the clipping region.
+ */
+DFBBoolean   dfb_clip_rectangle( const DFBRegion *clip, DFBRectangle *rect );
+
+/*
+ * Clips the rectangle to the clipping region.
+ * Returns a flag for each edge that wasn't cut off.
+ */
+DFBEdgeFlags dfb_clip_edges( const DFBRegion *clip, DFBRectangle *rect );
+
+static inline DFBBoolean
+dfb_clip_needed( const DFBRegion *clip, DFBRectangle *rect )
+{
+     return ((clip->x1 > rect->x) ||
+             (clip->y1 > rect->y) ||
+             (clip->x2 < rect->x + rect->w - 1) ||
+             (clip->y2 < rect->y + rect->h - 1));
+}
+
+/*
+ * Simple check if triangle lies outside the clipping region.
+ * Returns true if the triangle may be visible within the region.
+ */
+DFBBoolean   dfb_clip_triangle_precheck( const DFBRegion   *clip,
+                                         const DFBTriangle *tri );
+                                         
+/*
+ * Clips the triangle to the clipping region.
+ * Returns true if the triangle if visible within the region.
+ * The vertices of the polygon resulting from intersection are returned in buf.
+ * The number of vertices is at least 3.
+ */
+DFBBoolean   dfb_clip_triangle( const DFBRegion   *clip,
+                                const DFBTriangle *tri,
+                                DFBPoint           buf[6],
+                                int               *num );                                
+
+/*
+ * Simple check if requested blitting lies outside of the clipping region.
+ * Returns true if blitting may need to be performed.
+ */
+static inline DFBBoolean
+dfb_clip_blit_precheck( const DFBRegion *clip,
+                        int w, int h, int dx, int dy )
+{
+     if (w < 1 || h < 1 ||
+         (clip->x1 >= dx + w) ||
+         (clip->x2 < dx) ||
+         (clip->y1 >= dy + h) ||
+         (clip->y2 < dy))
+          return DFB_FALSE;
+
+     return DFB_TRUE;
+}
+
+/*
+ * Clips the blitting request to the clipping region.
+ * This includes adjustment of source AND destination coordinates.
+ */
+void dfb_clip_blit( const DFBRegion *clip,
+                    DFBRectangle *srect, int *dx, int *dy );
+
+/*
+ * Clips the stretch blit request to the clipping region.
+ * This includes adjustment of source AND destination coordinates
+ * based on the scaling factor.
+ */
+void dfb_clip_stretchblit( const DFBRegion *clip,
+                           DFBRectangle    *srect,
+                           DFBRectangle    *drect );
+
+#endif
+
diff --git a/Source/DirectFB/src/gfx/convert.c b/Source/DirectFB/src/gfx/convert.c
new file mode 100755
index 0000000..484f5a6
--- /dev/null
+++ b/Source/DirectFB/src/gfx/convert.c
@@ -0,0 +1,1427 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <directfb.h>
+#include <directfb_util.h>
+
+#include "convert.h"
+
+/* lookup tables for 2/3bit to 8bit color conversion */
+static const u8 lookup3to8[] = { 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff};
+static const u8 lookup2to8[] = { 0x00, 0x55, 0xaa, 0xff};
+
+#define EXPAND_1to8(v)   ((v) ? 0xff : 0x00)
+#define EXPAND_2to8(v)   (lookup2to8[v])
+#define EXPAND_3to8(v)   (lookup3to8[v])
+#define EXPAND_4to8(v)   (((v) << 4) | ((v)     ))
+#define EXPAND_5to8(v)   (((v) << 3) | ((v) >> 2))
+#define EXPAND_6to8(v)   (((v) << 2) | ((v) >> 4))
+#define EXPAND_7to8(v)   (((v) << 1) | ((v) >> 6))
+
+
+DFBSurfacePixelFormat
+dfb_pixelformat_for_depth( int depth )
+{
+     switch (depth) {
+          case 2:
+               return DSPF_LUT2;
+          case 8:
+               return DSPF_LUT8;
+          case 12:
+               return DSPF_ARGB4444;
+          case 14:
+               return DSPF_ARGB2554;
+          case 15:
+               return DSPF_ARGB1555;
+          case 16:
+               return DSPF_RGB16;
+          case 18:
+               return DSPF_RGB18;
+          case 24:
+               return DSPF_RGB24;
+          case 32:
+               return DSPF_RGB32;
+     }
+
+     return DSPF_UNKNOWN;
+}
+
+void
+dfb_pixel_to_color( DFBSurfacePixelFormat  format,
+                    unsigned long          pixel,
+                    DFBColor              *ret_color )
+{
+     ret_color->a = 0xff;
+
+     switch (format) {
+          case DSPF_RGB332:
+               ret_color->r = EXPAND_3to8( (pixel & 0xe0) >> 5 );
+               ret_color->g = EXPAND_3to8( (pixel & 0x1c) >> 2 );
+               ret_color->b = EXPAND_2to8( (pixel & 0x03)      );
+               break;
+
+          case DSPF_ARGB1555:
+               ret_color->a = EXPAND_1to8(  pixel >> 15 );
+          case DSPF_RGB555:
+               ret_color->r = EXPAND_5to8( (pixel & 0x7c00) >> 10 );
+               ret_color->g = EXPAND_5to8( (pixel & 0x03e0) >>  5 );
+               ret_color->b = EXPAND_5to8( (pixel & 0x001f)       );
+               break;
+
+          case DSPF_BGR555:
+               ret_color->r = EXPAND_5to8( (pixel & 0x001f)       );
+               ret_color->g = EXPAND_5to8( (pixel & 0x03e0) >>  5 );
+               ret_color->b = EXPAND_5to8( (pixel & 0x7c00) >> 10 );
+               break;
+
+          case DSPF_ARGB2554:
+               ret_color->a = EXPAND_2to8(  pixel >> 14 );
+               ret_color->r = EXPAND_5to8( (pixel & 0x3e00) >>  9 );
+               ret_color->g = EXPAND_5to8( (pixel & 0x01f0) >>  4 );
+               ret_color->b = EXPAND_4to8( (pixel & 0x000f)       );
+               break;
+
+          case DSPF_ARGB4444:
+               ret_color->a = EXPAND_4to8(  pixel >> 12 );
+          case DSPF_RGB444:
+               ret_color->r = EXPAND_4to8( (pixel & 0x0f00) >>  8 );
+               ret_color->g = EXPAND_4to8( (pixel & 0x00f0) >>  4 );
+               ret_color->b = EXPAND_4to8( (pixel & 0x000f)       );
+               break;
+
+          case DSPF_RGBA4444:
+               ret_color->r = EXPAND_4to8( (pixel         ) >> 12 );
+               ret_color->g = EXPAND_4to8( (pixel & 0x0f00) >>  8 );
+               ret_color->b = EXPAND_4to8( (pixel & 0x00f0) >>  4 );
+               ret_color->a = EXPAND_4to8( (pixel & 0x000f)       );
+               break;
+
+          case DSPF_RGB16:
+               ret_color->r = EXPAND_5to8( (pixel & 0xf800) >> 11 );
+               ret_color->g = EXPAND_6to8( (pixel & 0x07e0) >>  5 );
+               ret_color->b = EXPAND_5to8( (pixel & 0x001f)       );
+               break;
+
+          case DSPF_ARGB:
+               ret_color->a = pixel >> 24;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+               ret_color->r = (pixel & 0xff0000) >> 16;
+               ret_color->g = (pixel & 0x00ff00) >>  8;
+               ret_color->b = (pixel & 0x0000ff);
+               break;
+
+          case DSPF_AiRGB:
+               ret_color->a = (pixel >> 24) ^ 0xff;
+               ret_color->r = (pixel & 0xff0000) >> 16;
+               ret_color->g = (pixel & 0x00ff00) >>  8;
+               ret_color->b = (pixel & 0x0000ff);
+               break;
+
+          default:
+               ret_color->r = 0;
+               ret_color->g = 0;
+               ret_color->b = 0;
+     }
+}
+
+unsigned long
+dfb_pixel_from_color( DFBSurfacePixelFormat  format,
+                      const DFBColor        *color )
+{
+     u32 y, cb, cr;
+
+     switch (format) {
+          case DSPF_RGB332:
+               return PIXEL_RGB332( color->r, color->g, color->b );
+
+          case DSPF_ARGB1555:
+               return PIXEL_ARGB1555( color->a, color->r, color->g, color->b );
+
+          case DSPF_RGB555:
+               return PIXEL_RGB555( color->r, color->g, color->b );
+
+          case DSPF_BGR555:
+               return PIXEL_BGR555( color->r, color->g, color->b );
+
+          case DSPF_ARGB2554:
+               return PIXEL_ARGB2554( color->a, color->r, color->g, color->b );
+
+          case DSPF_ARGB4444:
+               return PIXEL_ARGB4444( color->a, color->r, color->g, color->b );
+
+          case DSPF_RGBA4444:
+               return PIXEL_RGBA4444( color->a, color->r, color->g, color->b );
+
+          case DSPF_RGB444:
+               return PIXEL_RGB444( color->r, color->g, color->b );
+
+          case DSPF_RGB16:
+               return PIXEL_RGB16( color->r, color->g, color->b );
+
+          case DSPF_RGB18:
+               return PIXEL_RGB18( color->r, color->g, color->b );
+
+          case DSPF_ARGB1666:
+               return PIXEL_ARGB1666( color->a, color->r, color->g, color->b );
+
+          case DSPF_ARGB6666:
+               return PIXEL_ARGB6666( color->a, color->r, color->g, color->b );
+
+          case DSPF_RGB24:
+               return PIXEL_RGB32( color->r, color->g, color->b );
+
+          case DSPF_RGB32:
+               return PIXEL_RGB32( color->r, color->g, color->b );
+
+          case DSPF_ARGB:
+               return PIXEL_ARGB( color->a, color->r, color->g, color->b );
+
+          case DSPF_AiRGB:
+               return PIXEL_AiRGB( color->a, color->r, color->g, color->b );
+
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
+               return PIXEL_AYUV( color->a, y, cb, cr );
+
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
+               return PIXEL_YUY2( y, cb, cr );
+
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
+               return PIXEL_UYVY( y, cb, cr );
+
+          case DSPF_I420:
+          case DSPF_YV12:
+               RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
+               return y | (cb << 8) | (cr << 16);
+
+          default:
+               D_WARN( "unknown format 0x%08x", format );
+     }
+
+     return 0x55555555;
+}
+
+const char *
+dfb_pixelformat_name( DFBSurfacePixelFormat format )
+{
+     int i = 0;
+
+     do {
+          if (format == dfb_pixelformat_names[i].format)
+               return dfb_pixelformat_names[i].name;
+     } while (dfb_pixelformat_names[i++].format != DSPF_UNKNOWN);
+
+     return "<invalid>";
+}
+
+void
+dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
+                      const void            *src,
+                      int                    spitch,
+                      int                    surface_height,
+                      u16                   *dst,
+                      int                    dpitch,
+                      int                    width,
+                      int                    height )
+{
+     const int dp2 = dpitch / 2;
+     int       x;
+
+     switch (format) {
+          case DSPF_RGB16:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 2 );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_NV16:
+               while (height--) {
+                    const u8  *src8  = src;
+                    const u16 *src16 = src + surface_height * spitch;
+     
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] >> 8, src16[x>>1] & 0xff, r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] & 0xff, src16[x>>1] >> 8, r, g, b );
+#endif
+
+                         dst[x] = PIXEL_RGB16( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB16( EXPAND_4to8( (src16[x] & 0x0f00) >> 8 ),
+                                               EXPAND_4to8( (src16[x] & 0x00f0) >> 4 ),
+                                               EXPAND_4to8( (src16[x] & 0x000f)      ) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB16( EXPAND_4to8( (src16[x] & 0xf000) >> 12 ),
+                                               EXPAND_4to8( (src16[x] & 0x0f00) >>  8 ),
+                                               EXPAND_4to8( (src16[x] & 0x00f0) >>  4 ) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+               
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ((src16[x] & 0x7c00) << 1) | ((src16[x] & 0x03e0) << 1) | (src16[x] & 0x003f);
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_BGR555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ((src16[x] & 0x7c00) >> 10) | ((src16[x] & 0x03e0) << 1) | ((src16[x] & 0x001f) << 11 );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB16( (src32[x] & 0xff0000) >> 16,
+                                               (src32[x] & 0x00ff00) >>  8,
+                                               (src32[x] & 0x0000ff) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_AYUV:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 16) & 0xff, (src32[x] >> 8) & 0xff, src32[x] & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_RGB16( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
+                       const void            *src,
+                       int                    spitch,
+                       int                    surface_height,
+                       u16                   *dst,
+                       int                    dpitch,
+                       int                    width,
+                       int                    height )
+{
+     const int dp2 = dpitch / 2;
+     int       x;
+
+     switch (format) {
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 2 );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_NV16:
+               while (height--) {
+                    const u8  *src8  = src;
+                    const u16 *src16 = src + surface_height * spitch;
+     
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+     
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] >> 8, src16[x>>1] & 0xff, r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] & 0xff, src16[x>>1] >> 8, r, g, b );
+#endif
+     
+                         dst[x] = PIXEL_RGB555( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB555( EXPAND_4to8( (src16[x] & 0x0f00) >> 8 ),
+                                                EXPAND_4to8( (src16[x] & 0x00f0) >> 4 ),
+                                                EXPAND_4to8( (src16[x] & 0x000f)      ) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB555( EXPAND_4to8( (src16[x] & 0xf000) >> 12 ),
+                                                EXPAND_4to8( (src16[x] & 0x0f00) >>  8 ),
+                                                EXPAND_4to8( (src16[x] & 0x00f0) >>  4 ) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGB16:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ((src16[x] & 0xffc0) >> 1) | (src16[x] & 0x001f);
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+ 	  case DSPF_BGR555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ((src16[x] & 0x7c00) >> 10) | (src16[x] & 0x03e0) | ((src16[x] & 0x001f) << 10 );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB555( (src32[x] & 0xff0000) >> 16,
+                                                (src32[x] & 0x00ff00) >>  8,
+                                                (src32[x] & 0x0000ff) );
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_AYUV:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 16) & 0xff, (src32[x] >> 8) & 0xff, src32[x] & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_RGB555( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
+                      const void            *src,
+                      int                    spitch,
+                      int                    surface_height,
+                      u32                   *dst,
+                      int                    dpitch,
+                      int                    width,
+                      int                    height )
+{
+     const int dp4 = dpitch / 4;
+     int       x;
+
+     switch (format) {
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 4 );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB24:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0; x<width; x++)
+#ifdef WORDS_BIGENDIAN
+                         dst[x] = ( src8[x*3+0] << 16 ) |
+                                  ( src8[x*3+1] <<  8 ) |
+                                  ( src8[x*3+2]       );
+#else
+                         dst[x] = ( src8[x*3+2] << 16 ) |
+                                  ( src8[x*3+1] <<  8 ) |
+                                  ( src8[x*3+0]       );
+#endif
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_AYUV:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 16) & 0xff, (src32[x] >> 8) & 0xff, src32[x] & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_RGB32( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_NV16:
+               while (height--) {
+                    const u8  *src8  = src;
+                    const u16 *src16 = src + surface_height * spitch;
+     
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+     
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] >> 8, src16[x>>1] & 0xff, r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] & 0xff, src16[x>>1] >> 8, r, g, b );
+#endif
+     
+                         dst[x] = PIXEL_RGB32( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ARGB4444_TO_RGB32( src16[x] );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = RGBA4444_TO_RGB32( src16[x] );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB32( ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12),
+                                               ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                               ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_BGR555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB32( ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2),
+                                               ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                               ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB16:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_RGB32( ((src16[x] & 0xf800) >> 8) | ((src16[x] & 0xe000) >> 13),
+                                               ((src16[x] & 0x07e0) >> 3) | ((src16[x] & 0x0300) >> 8),
+                                               ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_argb( DFBSurfacePixelFormat  format,
+                     const void            *src,
+                     int                    spitch,
+                     int                    surface_height,
+                     u32                   *dst,
+                     int                    dpitch,
+                     int                    width,
+                     int                    height )
+{
+     const int dp4 = dpitch / 4;
+     int       x;
+
+     switch (format) {
+          case DSPF_ARGB:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 4 );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB32:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = src32[x] | 0xff000000;
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB24:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0; x<width; x++)
+#ifdef WORDS_BIGENDIAN
+                         dst[x] = ( src8[x*3+0] << 16 ) |
+                                  ( src8[x*3+1] <<  8 ) |
+                                  ( src8[x*3+2]       ) | 0xff000000;
+#else
+                         dst[x] = ( src8[x*3+2] << 16 ) |
+                                  ( src8[x*3+1] <<  8 ) |
+                                  ( src8[x*3+0]       ) | 0xff000000;
+#endif
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_AYUV:
+               while (height--) {
+                    const u32 *src32 = src;
+     
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+     
+                         YCBCR_TO_RGB( (src32[x] >> 16) & 0xff, (src32[x] >> 8) & 0xff, src32[x] & 0xff, r, g, b );
+     
+                         dst[x] = PIXEL_ARGB( src32[x] >> 24, r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_NV16:
+               while (height--) {
+                    const u8  *src8  = src;
+                    const u16 *src16 = src + surface_height * spitch;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] >> 8, src16[x>>1] & 0xff, r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x], src16[x>>1] & 0xff, src16[x>>1] >> 8, r, g, b );
+#endif
+
+                         dst[x] = PIXEL_ARGB( 0xff, r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = ARGB4444_TO_ARGB( src16[x] );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = RGBA4444_TO_ARGB( src16[x] );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_ARGB( 0xff,
+                                              ((src16[x] & 0x0f00) >> 4) | ((src16[x] & 0x0f00) >> 8),
+                                              ((src16[x] & 0x00f0)     ) | ((src16[x] & 0x00f0) >> 4),
+                                              ((src16[x] & 0x000f) << 4) | ((src16[x] & 0x000f)     ) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_ARGB( (src16[x] & 0x8000) ? 0xff : 0x00,
+                                              ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12),
+                                              ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                              ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_ARGB( 0xff,
+                                              ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12),
+                                              ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                              ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_BGR555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_ARGB( 0xff,
+                                              ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2),
+                                              ((src16[x] & 0x03e0) >> 2) | ((src16[x] & 0x0380) >> 7),
+                                              ((src16[x] & 0x7c00) >> 7) | ((src16[x] & 0x7000) >> 12) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_RGB16:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0; x<width; x++)
+                         dst[x] = PIXEL_ARGB( 0xff,
+                                              ((src16[x] & 0xf800) >> 8) | ((src16[x] & 0xe000) >> 13),
+                                              ((src16[x] & 0x07e0) >> 3) | ((src16[x] & 0x0300) >> 8),
+                                              ((src16[x] & 0x001f) << 3) | ((src16[x] & 0x001c) >> 2) );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
+                      const void            *src,
+                      int                    spitch,
+                      int                    surface_height,
+                      u8                    *dst,
+                      int                    dpitch,
+                      int                    width,
+                      int                    height )
+{
+     int n, n3;
+
+     switch (format) {
+          case DSPF_A8:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = src8[n];
+                         dst[n3+1] = src8[n];
+                         dst[n3+2] = src8[n];
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_AiRGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src32[n] & 0xFF0000) >> 16;
+                         dst[n3+1] = (src32[n] & 0x00FF00) >>  8;
+                         dst[n3+2] = (src32[n] & 0x0000FF);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src32[n] & 0xFF0000) >> 16;
+                         dst[n3+1] = (src32[n] & 0x00FF00) >>  8;
+                         dst[n3+2] = (src32[n] & 0x0000FF);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0x7C00) >> 7;
+                         dst[n3+1] = (src16[n] & 0x03E0) >> 2;
+                         dst[n3+2] = (src16[n] & 0x001F) << 3;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0x7C00) >> 7;
+                         dst[n3+1] = (src16[n] & 0x03E0) >> 2;
+                         dst[n3+2] = (src16[n] & 0x001F) << 3;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_BGR555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+2] = (src16[n] & 0x7C00) >> 7;
+                         dst[n3+1] = (src16[n] & 0x03E0) >> 2;
+                         dst[n3+0] = (src16[n] & 0x001F) << 3;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_ARGB2554:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0x3E00) >> 6;
+                         dst[n3+1] = (src16[n] & 0x01F0) >> 1;
+                         dst[n3+2] = (src16[n] & 0x000F) << 4;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0x0F00) >> 4;
+                         dst[n3+1] = (src16[n] & 0x00F0);
+                         dst[n3+2] = (src16[n] & 0x000F) << 4;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0xF000) >> 8;
+                         dst[n3+1] = (src16[n] & 0x0F00) >> 4;
+                         dst[n3+2] = (src16[n] & 0x00F0);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0x0F00) >> 4;
+                         dst[n3+1] = (src16[n] & 0x00F0);
+                         dst[n3+2] = (src16[n] & 0x000F) << 4;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB332:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = lookup3to8[ (src8[n] >> 5)        ];
+                         dst[n3+1] = lookup3to8[ (src8[n] >> 2) & 0x07 ];
+                         dst[n3+2] = lookup2to8[ (src8[n]     ) & 0x03 ];
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB16:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src16[n] & 0xF800) >> 8;
+                         dst[n3+1] = (src16[n] & 0x07E0) >> 3;
+                         dst[n3+2] = (src16[n] & 0x001F) << 3;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB24:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+#ifdef WORDS_BIGENDIAN
+                         dst[n3+0] = src8[n3+0];
+                         dst[n3+1] = src8[n3+1];
+                         dst[n3+2] = src8[n3+2];
+#else
+                         dst[n3+0] = src8[n3+2];
+                         dst[n3+1] = src8[n3+1];
+                         dst[n3+2] = src8[n3+0];
+#endif
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGB32:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         dst[n3+0] = (src32[n] & 0xFF0000) >> 16;
+                         dst[n3+1] = (src32[n] & 0x00FF00) >>  8;
+                         dst[n3+2] = (src32[n] & 0x0000FF);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_YUY2:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width/2; n++, n3+=6) {
+                         register u32 y0, cb, y1, cr;
+                         y0 = (src32[n] & 0x000000FF);
+                         cb = (src32[n] & 0x0000FF00) >>  8;
+                         y1 = (src32[n] & 0x00FF0000) >> 16;
+                         cr = (src32[n] & 0xFF000000) >> 24;
+                         YCBCR_TO_RGB( y0, cb, cr,
+                                       dst[n3+0], dst[n3+1], dst[n3+2] );
+                         YCBCR_TO_RGB( y1, cb, cr,
+                                       dst[n3+3], dst[n3+4], dst[n3+5] );
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_UYVY:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width/2; n++, n3+=6) {
+                         register u32 y0, cb, y1, cr;
+                         cb = (src32[n] & 0x000000FF);
+                         y0 = (src32[n] & 0x0000FF00) >>  8;
+                         cr = (src32[n] & 0x00FF0000) >> 16;
+                         y1 = (src32[n] & 0xFF000000) >> 24;
+                         YCBCR_TO_RGB( y0, cb, cr,
+                                       dst[n3+0], dst[n3+1], dst[n3+2] );
+                         YCBCR_TO_RGB( y1, cb, cr,
+                                       dst[n3+3], dst[n3+4], dst[n3+5] );
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_NV16: {
+               while (height--) {
+                    const u16 *cbcr = src + surface_height * spitch;
+                    const u8  *src8 = src;
+
+                    for (n=0, n3=0; n<width/2; n++, n3+=6) {
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[n*2+0], cbcr[n] >> 8, cbcr[n] & 0xff,
+                                       dst[n3+0], dst[n3+1], dst[n3+2] );
+     
+                         YCBCR_TO_RGB( src8[n*2+1], cbcr[n] >> 8, cbcr[n] & 0xff,
+                                       dst[n3+3], dst[n3+4], dst[n3+5] );
+#else
+                         YCBCR_TO_RGB( src8[n*2+0], cbcr[n] & 0xff, cbcr[n] >> 8,
+                                       dst[n3+0], dst[n3+1], dst[n3+2] );
+     
+                         YCBCR_TO_RGB( src8[n*2+1], cbcr[n] & 0xff, cbcr[n] >> 8,
+                                       dst[n3+3], dst[n3+4], dst[n3+5] );
+#endif
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          }
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_a8( DFBSurfacePixelFormat  format,
+                   const void            *src,
+                   int                    spitch,
+                   int                    surface_height,
+                   u8                    *dst,
+                   int                    dpitch,
+                   int                    width,
+                   int                    height )
+{
+     int n;
+
+     switch (format) {
+          case DSPF_A8:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    direct_memcpy( dst, src8, width );
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_AiRGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0; n<width; n++) {
+                         dst[n] = ~(src32[n] >> 24);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0; n<width; n++) {
+                         dst[n] = src32[n] >> 24;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0; n<width; n++) {
+                         dst[n] = (src16[n] & 0x8000) ? 0xff : 0x00;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB2554:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0; n<width; n++) {
+                         switch (src16[n] >> 14) {
+                              case 0:
+                                   dst[n] = 0x00;
+                                   break;
+                              case 1:
+                                   dst[n] = 0x55;
+                                   break;
+                              case 2:
+                                   dst[n] = 0xAA;
+                                   break;
+                              case 3:
+                                   dst[n] = 0xFF;
+                                   break;
+                         }
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0; n<width; n++) {
+                         dst[n]  = (src16[n] >> 12);
+                         dst[n] |= dst[n] << 4;
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (n=0; n<width; n++) {
+                         dst[n] = EXPAND_4to8(src16[n] & 0xf);
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_RGB332:
+          case DSPF_RGB444:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+          case DSPF_RGB16:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+          case DSPF_NV16:
+               while (height--) {
+                    memset( dst, 0xff, width );
+
+                    dst += dpitch;
+               }
+               break;
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_a4( DFBSurfacePixelFormat  format,
+                   const void            *src,
+                   int                    spitch,
+                   int                    surface_height,
+                   u8                    *dst,
+                   int                    dpitch,
+                   int                    width,
+                   int                    height )
+{
+     const int w2 = width / 2;
+     int       x, n;
+
+     D_ASSUME( (width & 1) == 0 );
+
+     switch (format) {
+          case DSPF_A8:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0, n=0; x<w2; x++, n+=2)
+                         dst[x] = (src8[n] & 0xf0) | ((src8[n+1] & 0xf0) >> 4);
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_ARGB4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0, n=0; x<w2; x++, n+=2)
+                         dst[x] = ((src16[n] & 0xf000) >> 8) | (src16[n+1] >> 12);
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_RGBA4444:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0, n=0; x<w2; x++, n+=2)
+                         dst[x] = ((src16[n] & 0x000f) << 4) | (src16[n+1] & 0x000f);
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_ARGB1555:
+               while (height--) {
+                    const u16 *src16 = src;
+
+                    for (x=0, n=0; x<w2; x++, n+=2)
+                         dst[x] = ((src16[n] & 0x8000) ? 0xf0 : 0) | ((src16[n+1] & 0x8000) ? 0x0f : 0);
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          case DSPF_ARGB:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0, n=0; x<w2; x++, n+=2)
+                         dst[x] = ((src32[n] & 0xf0000000) >> 24) | ((src32[n+1] & 0xf0000000) >> 28);
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
+
+          default:
+               if (DFB_PIXELFORMAT_HAS_ALPHA( format ))
+                    D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_yuy2( DFBSurfacePixelFormat  format,
+                     const void            *src,
+                     int                    spitch,
+                     int                    surface_height,
+                     u32                   *dst,
+                     int                    dpitch,
+                     int                    width,
+                     int                    height )
+{
+     const int dp4 = dpitch / 4;
+
+     switch (format) {
+          case DSPF_YUY2:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 2 );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
+void
+dfb_convert_to_uyvy( DFBSurfacePixelFormat  format,
+                     const void            *src,
+                     int                    spitch,
+                     int                    surface_height,
+                     u32                   *dst,
+                     int                    dpitch,
+                     int                    width,
+                     int                    height )
+{
+     const int dp4 = dpitch / 4;
+
+     switch (format) {
+          case DSPF_UYVY:
+               while (height--) {
+                    direct_memcpy( dst, src, width * 2 );
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          default:
+               D_ONCE( "unsupported format" );
+     }
+}
+
diff --git a/Source/DirectFB/src/gfx/convert.h b/Source/DirectFB/src/gfx/convert.h
new file mode 100755
index 0000000..a831d8c
--- /dev/null
+++ b/Source/DirectFB/src/gfx/convert.h
@@ -0,0 +1,562 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GFX__CONVERT_H__
+#define __GFX__CONVERT_H__
+
+#include <directfb.h>
+
+#include <direct/memcpy.h>
+#include <direct/util.h>
+
+
+/* pixel packing */
+
+#define PIXEL_RGB332(r,g,b)    ( (((r)&0xE0)     ) | \
+                                 (((g)&0xE0) >> 3) | \
+                                 (((b)&0xC0) >> 6) )
+
+#define PIXEL_ARGB1555(a,r,g,b)( (((a)&0x80) << 8) | \
+                                 (((r)&0xF8) << 7) | \
+                                 (((g)&0xF8) << 2) | \
+                                 (((b)&0xF8) >> 3) )
+
+#define PIXEL_RGB555(r,g,b)  ( (((r)&0xF8) << 7) | \
+                                 (((g)&0xF8) << 2) | \
+                                 (((b)&0xF8) >> 3) )
+
+#define PIXEL_BGR555(r,g,b)  ( (((b)&0xF8) << 7) | \
+                                 (((g)&0xF8) << 2) | \
+                                 (((r)&0xF8) >> 3) )
+
+#define PIXEL_ARGB2554(a,r,g,b)( (((a)&0xC0) << 8) | \
+                                 (((r)&0xF8) << 6) | \
+                                 (((g)&0xF8) << 1) | \
+                                 (((b)&0xF0) >> 4) )
+
+#define PIXEL_ARGB4444(a,r,g,b)( (((a)&0xF0) << 8) | \
+                                 (((r)&0xF0) << 4) | \
+                                 (((g)&0xF0)     ) | \
+                                 (((b)&0xF0) >> 4) )
+
+#define PIXEL_RGBA4444(a,r,g,b)( (((r)&0xF0) << 8) | \
+                                 (((g)&0xF0) << 4) | \
+                                 (((b)&0xF0)     ) | \
+                                 (((a)&0xF0) >> 4) )
+
+#define PIXEL_RGB444(r,g,b)  ( (((r)&0xF0) << 4) | \
+                                 (((g)&0xF0)     ) | \
+                                 (((b)&0xF0) >> 4) )
+
+#define PIXEL_RGB16(r,g,b)     ( (((r)&0xF8) << 8) | \
+                                 (((g)&0xFC) << 3) | \
+                                 (((b)&0xF8) >> 3) )
+
+#define PIXEL_RGB18(r,g,b)     ( (((r)&0xFC) << 10) | \
+                                 (((g)&0xFC) <<  4) | \
+                                 (((b)&0xFC) >>  2) )
+
+#define PIXEL_RGB32(r,g,b)     ( ((r) << 16) | \
+                                 ((g) <<  8) | \
+                                  (b) )
+
+#define PIXEL_ARGB(a,r,g,b)    ( ((a) << 24) | \
+                                 ((r) << 16) | \
+                                 ((g) << 8)  | \
+                                  (b) )
+
+#define PIXEL_ARGB1666(a,r,g,b) ( (((a)&0x80) << 11) | \
+                                  (((r)&0xFC) << 10) | \
+                                  (((g)&0xFC) <<  4) | \
+                                  (((b)&0xFC) >>  2) )
+
+#define PIXEL_ARGB6666(a,r,g,b) ( (((a)&0xFC) << 16) | \
+                                  (((r)&0xFC) << 10) | \
+                                  (((g)&0xFC) <<  4) | \
+                                  (((b)&0xFC) >>  2) )
+
+#define PIXEL_AYUV(a,y,u,v)    ( ((a) << 24) | \
+                                 ((y) << 16) | \
+                                 ((u) << 8)  | \
+                                  (v) )
+
+#define PIXEL_AiRGB(a,r,g,b)   ( (((a) ^ 0xff) << 24) | \
+                                 ((r) << 16) | \
+                                 ((g) << 8)  | \
+                                  (b) )
+
+#ifdef WORDS_BIGENDIAN
+
+#define PIXEL_YUY2(y,u,v)      ( ((u) << 24) | \
+                                 ((y) << 16) | \
+                                 ((v) << 8)  | \
+                                  (y) )
+
+#define PIXEL_UYVY(y,u,v)      ( ((y) << 24) | \
+                                 ((u) << 16) | \
+                                 ((y) << 8)  | \
+                                  (v) )
+#else /* little endian */
+
+#define PIXEL_YUY2(y,u,v)      ( ((v) << 24) | \
+                                 ((y) << 16) | \
+                                 ((u) << 8)  | \
+                                  (y) )
+
+#define PIXEL_UYVY(y,u,v)      ( ((y) << 24) | \
+                                 ((v) << 16) | \
+                                 ((y) << 8)  | \
+                                  (u) )
+
+#endif
+
+
+/* packed pixel conversions */
+
+#define ARGB1555_TO_RGB332(pixel) ( (((pixel) & 0x7000) >> 7) | \
+                                    (((pixel) & 0x0380) >> 5) | \
+                                    (((pixel) & 0x0018) >> 3) )
+
+#define ARGB1555_TO_ARGB2554(pixel) ( (((pixel) & 0x8000)     ) | \
+                                      (((pixel) & 0x7FFF) >> 1) )
+
+#define ARGB1555_TO_ARGB4444(pixel) ( (((pixel) & 0x8000) ? 0xf000 : 0 ) | \
+                                      (((pixel) & 0x7800) >> 3) | \
+                                      (((pixel) & 0x03C0) >> 2) | \
+                                      (((pixel) & 0x0018) >> 1) )
+
+#define ARGB1555_TO_RGBA4444(pixel) ( (((pixel) & 0x8000) ? 0x000f : 0 ) | \
+                                      (((pixel) & 0x7800) << 1) | \
+                                      (((pixel) & 0x03C0) << 2) | \
+                                      (((pixel) & 0x0018) << 3) )
+
+#define ARGB1555_TO_RGB16(pixel)  ( (((pixel) & 0x7C00) << 1) | \
+                                    (((pixel) & 0x03E0) << 1) | \
+                                    (((pixel) & 0x001F)) )
+
+#define ARGB1555_TO_RGB32(pixel)  ( (((pixel) & 0x7C00) << 9) | \
+                                    (((pixel) & 0x03E0) << 6) | \
+                                    (((pixel) & 0x001F) << 3) )
+
+#define ARGB1555_TO_ARGB(pixel)   ( (((pixel) & 0x8000) ? 0xFF000000 : 0) | \
+                                    (((pixel) & 0x7C00) << 9) | \
+                                    (((pixel) & 0x03E0) << 6) | \
+                                    (((pixel) & 0x001F) << 3) )
+
+#define ARGB1555_TO_RGB555(pixel) ( (((pixel) & 0x7C00) << 9) | \
+                                    (((pixel) & 0x03E0) << 6) | \
+                                    (((pixel) & 0x001F) << 3) )
+
+#define ARGB1555_TO_RGB444(pixel) ( (((pixel) & 0x7800) >> 3) | \
+                                    (((pixel) & 0x03C0) >> 2) | \
+                                    (((pixel) & 0x001E) >> 1) )
+
+/* xRGB to xxRRGGBB, so xRxx left 3, xRGx left 2, xxGB left 1, xxxB */
+#define ARGB4444_TO_RGB32(pixel)  ( (((pixel) & 0x0F00) << 12) | \
+                                    (((pixel) & 0x0FF0) <<  8) | \
+                                    (((pixel) & 0x00FF) <<  4) | \
+                                    (((pixel) & 0x000F)      ) )
+
+/* RGBx to xxRRGGBB, so Rxxx left 2, RGxx left 1, xGBx, xxBx right 1 */
+#define RGBA4444_TO_RGB32(pixel)  ( (((pixel) & 0xF000) <<  8) | \
+                                    (((pixel) & 0xFF00) <<  4) | \
+                                    (((pixel) & 0x0FF0)      ) | \
+                                    (((pixel) & 0x00F0) >>  4) )
+
+/* ARGB to AARRGGBB, so Axxx left 4, ARxx left 3, xRGx left 2, xxGB left 1, xxxB */
+#define ARGB4444_TO_ARGB(pixel)  ( (((pixel) & 0xF000) << 16) | \
+                                   (((pixel) & 0xFF00) << 12) | \
+                                   (((pixel) & 0x0FF0) <<  8) | \
+                                   (((pixel) & 0x00FF) <<  4) | \
+                                   (((pixel) & 0x000F)      ) )
+
+/* RGBA to AARRGGBB, so Rxxx left 2, RGxx left 1, xGBx, xxBx right 1, A to the left */
+#define RGBA4444_TO_ARGB(pixel)  ( (((pixel) & 0x000F) << 28) | \
+                                   (((pixel) & 0x000F) << 24) | \
+                                   (((pixel) & 0xF000) <<  8) | \
+                                   (((pixel) & 0xFF00) <<  4) | \
+                                   (((pixel) & 0x0FF0)      ) | \
+                                   (((pixel) & 0x00F0) >>  4) )
+
+#define RGB16_TO_RGB332(pixel) ( (((pixel) & 0xE000) >> 8) | \
+                                 (((pixel) & 0x0700) >> 6) | \
+                                 (((pixel) & 0x0018) >> 3) )
+
+#define RGB16_TO_ARGB1555(pixel)  ( 0x8000 | \
+                                    (((pixel) & 0xF800) >> 1) | \
+                                    (((pixel) & 0x07C0) >> 1) | \
+                                    (((pixel) & 0x001F)) )
+
+#define RGB16_TO_ARGB2554(pixel)  ( 0xC000 |                    \
+                                    (((pixel) & 0xF800) >> 2) | \
+                                    (((pixel) & 0x07C0) >> 2) | \
+                                    (((pixel) & 0x001F) >> 1) )
+
+#define RGB16_TO_ARGB4444(pixel)  ( 0xF000 |                    \
+                                    (((pixel) & 0xF000) >> 4) | \
+                                    (((pixel) & 0x0780) >> 3) | \
+                                    (((pixel) & 0x001E) >> 1) )
+
+#define RGB16_TO_RGBA4444(pixel)  ( 0x000F |                    \
+                                    (((pixel) & 0xF000)     ) | \
+                                    (((pixel) & 0x0780) << 1) | \
+                                    (((pixel) & 0x001E) << 3) )
+
+
+#define RGB16_TO_RGB32(pixel)  ( (((pixel) & 0xF800) << 8) | \
+                                 (((pixel) & 0x07E0) << 5) | \
+                                 (((pixel) & 0x001F) << 3) )
+
+#define RGB16_TO_ARGB(pixel)   ( 0xFF000000 |                \
+                                 (((pixel) & 0xF800) << 8) | \
+                                 (((pixel) & 0x07E0) << 5) | \
+                                 (((pixel) & 0x001F) << 3) )
+
+#define RGB16_TO_RGB555(pixel)  ( (((pixel) & 0xF800) >> 1) | \
+                                    (((pixel) & 0x07C0) >> 1) | \
+                                    (((pixel) & 0x001F)) )
+
+#define RGB16_TO_BGR555(pixel)  ( (((pixel) & 0xF800) >> 12) | \
+                                    (((pixel) & 0x07C0) >> 1) | \
+                                    (((pixel) & 0x001F) << 10 ) )
+
+#define RGB16_TO_RGB444(pixel)  ( (((pixel) & 0xF000) >> 4) | \
+                                    (((pixel) & 0x0780) >> 3) | \
+                                    (((pixel) & 0x001F) >> 1) )
+
+#define RGB18_TO_ARGB(pixel)   ( 0xFF000000 |                \
+                                 (((pixel) & 0xFC00) << 10) | \
+                                 (((pixel) & 0x3F00) << 4) | \
+                                 (((pixel) & 0x00FC) << 2) )
+
+#define RGB32_TO_RGB332(pixel) ( (((pixel) & 0xE00000) >> 16) | \
+                                 (((pixel) & 0x00E000) >> 11) | \
+                                 (((pixel) & 0x0000C0) >> 6) )
+
+#define RGB32_TO_ARGB1555(pixel)  ( 0x8000 | \
+                                    (((pixel) & 0xF80000) >> 9) | \
+                                    (((pixel) & 0x00F800) >> 6) | \
+                                    (((pixel) & 0x0000F8) >> 3) )
+
+#define RGB32_TO_ARGB2554(pixel)  ( 0xC000 |                       \
+                                    (((pixel) & 0xF80000) >> 10) | \
+                                    (((pixel) & 0x00F800) >>  7) | \
+                                    (((pixel) & 0x0000F0) >>  4) )
+
+#define RGB32_TO_ARGB4444(pixel)  ( 0xF000 |                       \
+                                    (((pixel) & 0xF00000) >> 12) | \
+                                    (((pixel) & 0x00F000) >>  8) | \
+                                    (((pixel) & 0x0000F0) >>  4) )
+
+#define RGB32_TO_RGBA4444(pixel)  ( 0x000F |                       \
+                                    (((pixel) & 0xF00000) >>  8) | \
+                                    (((pixel) & 0x00F000) >>  4) | \
+                                    (((pixel) & 0x0000F0)      ) )
+
+#define RGB32_TO_RGB16(pixel)  ( (((pixel) & 0xF80000) >> 8) | \
+                                 (((pixel) & 0x00FC00) >> 5) | \
+                                 (((pixel) & 0x0000F8) >> 3) )
+
+#define RGB32_TO_ARGB1555(pixel) ( 0x8000 | \
+                                   (((pixel) & 0xF80000) >> 9) | \
+                                   (((pixel) & 0x00F800) >> 6) | \
+                                   (((pixel) & 0x0000F8) >> 3) )
+
+#define RGB32_TO_ARGB(pixel)   ( 0xFF000000 | (pixel) )
+
+
+#define RGB32_TO_RGB555(pixel)  ( (((pixel) & 0xF80000) >> 9) | \
+                                    (((pixel) & 0x00F800) >> 6) | \
+                                    (((pixel) & 0x0000F8) >> 3) )
+
+#define RGB32_TO_BGR555(pixel)  ( (((pixel) & 0xF80000) >> 19) | \
+                                    (((pixel) & 0x00F800) >> 6) | \
+                                    (((pixel) & 0x0000F8) << 7) )
+
+#define RGB32_TO_RGB444(pixel)  ( (((pixel) & 0xF00000) >> 12) | \
+                                    (((pixel) & 0x00F000) >>  8) | \
+                                    (((pixel) & 0x0000F0) >>  4) )
+
+#define ARGB_TO_ARGB1555(pixel)  ( (((pixel) & 0x80000000) >> 16) | \
+                                   (((pixel) & 0x00F80000) >>  9) | \
+                                   (((pixel) & 0x0000F800) >>  6) | \
+                                   (((pixel) & 0x000000F8) >>  3) )
+
+#define ARGB_TO_ARGB2554(pixel)  ( (((pixel) & 0xC0000000) >> 16) | \
+                                   (((pixel) & 0x00F80000) >> 10) | \
+                                   (((pixel) & 0x0000F800) >>  7) | \
+                                   (((pixel) & 0x000000F0) >>  4) )
+
+#define ARGB_TO_ARGB4444(pixel)  ( (((pixel) & 0xF0000000) >> 16) | \
+                                   (((pixel) & 0x00F00000) >> 12) | \
+                                   (((pixel) & 0x0000F000) >>  8) | \
+                                   (((pixel) & 0x000000F0) >>  4) )
+
+#define ARGB_TO_RGBA4444(pixel)  ( (((pixel) & 0xF0000000) >> 28) | \
+                                   (((pixel) & 0x00F00000) >>  8) | \
+                                   (((pixel) & 0x0000F000) >>  4) | \
+                                   (((pixel) & 0x000000F0)      ) )
+
+#define ARGB_TO_RGB444(pixel)  ( (((pixel) & 0x00F00000) >> 12) | \
+                                   (((pixel) & 0x0000F000) >>  8) | \
+                                   (((pixel) & 0x000000F0) >>  4) )
+
+#define ARGB_TO_RGB555(pixel)  ( (((pixel) & 0x00F80000) >>  9) | \
+                                   (((pixel) & 0x0000F800) >>  6) | \
+                                   (((pixel) & 0x000000F8) >>  3) )
+
+#define ARGB_TO_BGR555(pixel)  ( (((pixel) & 0x00F80000) >>  19) | \
+                                   (((pixel) & 0x0000F800) >>  6) | \
+                                   (((pixel) & 0x000000F8) <<  7) )
+
+/* RGB <-> YCbCr conversion */
+
+#define YCBCR_TO_RGB( y, cb, cr, r, g, b )                            \
+do {                                                                  \
+     int _y  = (y)  -  16;                                            \
+     int _cb = (cb) - 128;                                            \
+     int _cr = (cr) - 128;                                            \
+                                                                      \
+     int _r = (298 * _y             + 409 * _cr + 128) >> 8;          \
+     int _g = (298 * _y - 100 * _cb - 208 * _cr + 128) >> 8;          \
+     int _b = (298 * _y + 516 * _cb             + 128) >> 8;          \
+                                                                      \
+     (r) = CLAMP( _r, 0, 255 );                                       \
+     (g) = CLAMP( _g, 0, 255 );                                       \
+     (b) = CLAMP( _b, 0, 255 );                                       \
+} while (0)
+
+#define RGB_TO_YCBCR( r, g, b, y, cb, cr )                            \
+do {                                                                  \
+     int _r = (r), _g = (g), _b = (b);                                \
+                                                                      \
+     (y)  = (   66 * _r + 129 * _g +  25 * _b  +  16*256 + 128) >> 8; \
+     (cb) = ( - 38 * _r -  74 * _g + 112 * _b  + 128*256 + 128) >> 8; \
+     (cr) = (  112 * _r -  94 * _g -  18 * _b  + 128*256 + 128) >> 8; \
+} while (0)
+
+
+DFBSurfacePixelFormat dfb_pixelformat_for_depth( int depth );
+
+
+void                  dfb_pixel_to_color  ( DFBSurfacePixelFormat  format,
+                                            unsigned long          pixel,
+                                            DFBColor              *ret_color );
+
+unsigned long         dfb_pixel_from_color( DFBSurfacePixelFormat  format,
+                                            const DFBColor        *color );
+
+
+static inline u32
+dfb_color_to_pixel( DFBSurfacePixelFormat format,
+                    u8 r, u8 g, u8 b )
+{
+     const DFBColor color = { 0, r, g, b };
+
+     return dfb_pixel_from_color( format, &color );
+}
+
+static inline u32
+dfb_color_to_argb( const DFBColor *color )
+{
+     return (color->a << 24) | (color->r << 16) | (color->g << 8) | color->b;
+}
+
+static inline u32
+dfb_color_to_aycbcr( const DFBColor *color )
+{
+     u32 y  = (   66 * color->r + 129 * color->g +  25 * color->b  +  16*256 + 128) >> 8;
+     u32 cb = ( - 38 * color->r -  74 * color->g + 112 * color->b  + 128*256 + 128) >> 8;
+     u32 cr = (  112 * color->r -  94 * color->g -  18 * color->b  + 128*256 + 128) >> 8;
+
+     return (color->a << 24) | (y << 16) | (cb << 8) | cr;
+}
+
+static inline void
+dfb_argb_to_rgb332( const u32 *src, u8 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 argb = src[i];
+
+          dst[i] = RGB32_TO_RGB332( argb );
+     }
+}
+
+static inline void
+dfb_argb_to_argb1555( const u32 *src, u16 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 argb = src[i];
+
+          dst[i] = ARGB_TO_ARGB1555( argb );
+     }
+}
+
+static inline void
+dfb_argb_to_argb2554( const u32 *src, u16 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 argb = src[i];
+
+          dst[i] = ARGB_TO_ARGB2554( argb );
+     }
+}
+
+static inline void
+dfb_argb_to_argb4444( const u32 *src, u16 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 argb = src[i];
+
+          dst[i] = ARGB_TO_ARGB4444( argb );
+     }
+}
+
+static inline void
+dfb_argb_to_rgba4444( const u32 *src, u16 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 rgba = src[i];
+
+          dst[i] = ARGB_TO_RGBA4444( rgba );
+     }
+}
+
+static inline void
+dfb_argb_to_rgb16( const u32 *src, u16 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++) {
+          register u32 argb = src[i];
+
+          dst[i] = RGB32_TO_RGB16( argb );
+     }
+}
+
+static inline void
+dfb_argb_to_a8( const u32 *src, u8 *dst, int len )
+{
+     int i;
+
+     for (i=0; i<len; i++)
+          dst[i] = src[i] >> 24;
+}
+
+void dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
+                           const void            *src,
+                           int                    spitch,
+                           int                    surface_height,
+                           u16                   *dst,
+                           int                    dpitch,
+                           int                    width,
+                           int                    height );
+
+void dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
+                            const void            *src,
+                            int                    spitch,
+                            int                    surface_height,
+                            u16                   *dst,
+                            int                    dpitch,
+                            int                    width,
+                            int                    height );
+
+void dfb_convert_to_argb( DFBSurfacePixelFormat  format,
+                          const void            *src,
+                          int                    spitch,
+                          int                    surface_height,
+                          u32                   *dst,
+                          int                    dpitch,
+                          int                    width,
+                          int                    height );
+
+void dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
+                           const void            *src,
+                           int                    spitch,
+                           int                    surface_height,
+                           u32                   *dst,
+                           int                    dpitch,
+                           int                    width,
+                           int                    height );
+
+void dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
+                           const void            *src,
+                           int                    spitch,
+                           int                    surface_height,
+                           u8                    *dst,
+                           int                    dpitch,
+                           int                    width,
+                           int                    height );
+
+void dfb_convert_to_a8( DFBSurfacePixelFormat  format,
+                        const void            *src,
+                        int                    spitch,
+                        int                    surface_height,
+                        u8                    *dst,
+                        int                    dpitch,
+                        int                    width,
+                        int                    height );
+
+void dfb_convert_to_a4( DFBSurfacePixelFormat  format,
+                        const void            *src,
+                        int                    spitch,
+                        int                    surface_height,
+                        u8                    *dst,
+                        int                    dpitch,
+                        int                    width,
+                        int                    height );
+
+void dfb_convert_to_yuy2( DFBSurfacePixelFormat  format,
+                          const void            *src,
+                          int                    spitch,
+                          int                    surface_height,
+                          u32                   *dst,
+                          int                    dpitch,
+                          int                    width,
+                          int                    height );
+
+void dfb_convert_to_uyvy( DFBSurfacePixelFormat  format,
+                          const void            *src,
+                          int                    spitch,
+                          int                    surface_height,
+                          u32                   *dst,
+                          int                    dpitch,
+                          int                    width,
+                          int                    height );
+
+#endif
diff --git a/Source/DirectFB/src/gfx/generic/Makefile.am b/Source/DirectFB/src/gfx/generic/Makefile.am
new file mode 100755
index 0000000..6d80484
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/Makefile.am
@@ -0,0 +1,62 @@
+## Makefile.am for DirectFB/src/gfx/generic
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CFLAGS = $(DFB_CFLAGS_OMIT_FRAME_POINTER)
+
+EXTRA_DIST = \
+	yuvtbl-gen.c
+
+internalincludedir = $(INTERNALINCLUDEDIR)/gfx/generic
+
+internalinclude_HEADERS = \
+     generic.h
+
+noinst_LTLIBRARIES = libdirectfb_generic.la
+
+if SOFTWARE_RENDERING
+GENERIC_C = generic.c
+else
+GENERIC_C = generic_dummy.c
+endif
+
+libdirectfb_generic_la_SOURCES = \
+	duffs_device.h			\
+	$(GENERIC_C)			\
+	generic.h			\
+	generic_mmx.h			\
+	generic_64.h			\
+	stretch_hvx_N.h			\
+	stretch_hvx_16.h		\
+	stretch_hvx_32.h		\
+	stretch_hvx_8.h			\
+	stretch_hvx_88.h		\
+	stretch_up_down_16.h		\
+	stretch_up_down_32.h		\
+	stretch_up_down_32_indexed.h	\
+	stretch_up_down_8.h		\
+	stretch_up_down_88.h		\
+	stretch_up_down_table.h		\
+	template_acc_16.h		\
+	template_acc_32.h		\
+	template_colorkey_16.h		\
+	template_colorkey_32.h		\
+	yuvtbl.h
+
+generic.c: yuvtbl.h
+generic_dummy.c: yuvtbl.h
+
+yuvtbl-gen: yuvtbl-gen.c
+	$(CC) -O2 yuvtbl-gen.c -o yuvtbl-gen
+
+#yuvtbl.h: yuvtbl-gen
+#	./yuvtbl-gen > $(srcdir)/yuvtbl.h
+
+clean-local:
+	rm -f yuvtbl-gen
+
diff --git a/Source/DirectFB/src/gfx/generic/Makefile.in b/Source/DirectFB/src/gfx/generic/Makefile.in
new file mode 100755
index 0000000..94695ac
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/Makefile.in
@@ -0,0 +1,602 @@
+# 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@
+subdir = src/gfx/generic
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_generic_la_LIBADD =
+am__libdirectfb_generic_la_SOURCES_DIST = duffs_device.h \
+	generic_dummy.c generic.c generic.h generic_mmx.h generic_64.h \
+	stretch_hvx_N.h stretch_hvx_16.h stretch_hvx_32.h \
+	stretch_hvx_8.h stretch_hvx_88.h stretch_up_down_16.h \
+	stretch_up_down_32.h stretch_up_down_32_indexed.h \
+	stretch_up_down_8.h stretch_up_down_88.h \
+	stretch_up_down_table.h template_acc_16.h template_acc_32.h \
+	template_colorkey_16.h template_colorkey_32.h yuvtbl.h
+@SOFTWARE_RENDERING_FALSE@am__objects_1 = generic_dummy.lo
+@SOFTWARE_RENDERING_TRUE@am__objects_1 = generic.lo
+am_libdirectfb_generic_la_OBJECTS = $(am__objects_1)
+libdirectfb_generic_la_OBJECTS = $(am_libdirectfb_generic_la_OBJECTS)
+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_generic_la_SOURCES)
+DIST_SOURCES = $(am__libdirectfb_generic_la_SOURCES_DIST)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CFLAGS = $(DFB_CFLAGS_OMIT_FRAME_POINTER)
+EXTRA_DIST = \
+	yuvtbl-gen.c
+
+internalincludedir = $(INTERNALINCLUDEDIR)/gfx/generic
+internalinclude_HEADERS = \
+     generic.h
+
+noinst_LTLIBRARIES = libdirectfb_generic.la
+@SOFTWARE_RENDERING_FALSE@GENERIC_C = generic_dummy.c
+@SOFTWARE_RENDERING_TRUE@GENERIC_C = generic.c
+libdirectfb_generic_la_SOURCES = \
+	duffs_device.h			\
+	$(GENERIC_C)			\
+	generic.h			\
+	generic_mmx.h			\
+	generic_64.h			\
+	stretch_hvx_N.h			\
+	stretch_hvx_16.h		\
+	stretch_hvx_32.h		\
+	stretch_hvx_8.h			\
+	stretch_hvx_88.h		\
+	stretch_up_down_16.h		\
+	stretch_up_down_32.h		\
+	stretch_up_down_32_indexed.h	\
+	stretch_up_down_8.h		\
+	stretch_up_down_88.h		\
+	stretch_up_down_table.h		\
+	template_acc_16.h		\
+	template_acc_32.h		\
+	template_colorkey_16.h		\
+	template_colorkey_32.h		\
+	yuvtbl.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/gfx/generic/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/gfx/generic/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_generic.la: $(libdirectfb_generic_la_OBJECTS) $(libdirectfb_generic_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_generic_la_OBJECTS) $(libdirectfb_generic_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic_dummy.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local \
+	clean-noinstLTLIBRARIES 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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-local clean-noinstLTLIBRARIES ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-internalincludeHEADERS 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-internalincludeHEADERS
+
+
+generic.c: yuvtbl.h
+generic_dummy.c: yuvtbl.h
+
+yuvtbl-gen: yuvtbl-gen.c
+	$(CC) -O2 yuvtbl-gen.c -o yuvtbl-gen
+
+#yuvtbl.h: yuvtbl-gen
+#	./yuvtbl-gen > $(srcdir)/yuvtbl.h
+
+clean-local:
+	rm -f yuvtbl-gen
+# 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/src/gfx/generic/duffs_device.h b/Source/DirectFB/src/gfx/generic/duffs_device.h
new file mode 100755
index 0000000..4e31089
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/duffs_device.h
@@ -0,0 +1,89 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DUFFS_DEVICE_H__
+#define __DUFFS_DEVICE_H__
+
+#define DUFF_1() \
+               case 1:\
+                    SET_PIXEL( D[0], S[0] );
+
+#define DUFF_2() \
+               case 3:\
+                    SET_PIXEL( D[2], S[2] );\
+               case 2:\
+                    SET_PIXEL( D[1], S[1] );\
+               DUFF_1()
+
+#define DUFF_3() \
+               case 7:\
+                    SET_PIXEL( D[6], S[6] );\
+               case 6:\
+                    SET_PIXEL( D[5], S[5] );\
+               case 5:\
+                    SET_PIXEL( D[4], S[4] );\
+               case 4:\
+                    SET_PIXEL( D[3], S[3] );\
+               DUFF_2()
+
+#define DUFF_4() \
+               case 15:\
+                    SET_PIXEL( D[14], S[14] );\
+               case 14:\
+                    SET_PIXEL( D[13], S[13] );\
+               case 13:\
+                    SET_PIXEL( D[12], S[12] );\
+               case 12:\
+                    SET_PIXEL( D[11], S[11] );\
+               case 11:\
+                    SET_PIXEL( D[10], S[10] );\
+               case 10:\
+                    SET_PIXEL( D[9], S[9] );\
+               case 9:\
+                    SET_PIXEL( D[8], S[8] );\
+               case 8:\
+                    SET_PIXEL( D[7], S[7] );\
+               DUFF_3()
+
+#define SET_PIXEL_DUFFS_DEVICE_N( D, S, w, n ) \
+do {\
+     while (w) {\
+          register int l = w & ((1 << n) - 1);\
+          switch (l) {\
+               default:\
+                    l = (1 << n);\
+                    SET_PIXEL( D[(1 << n)-1], S[(1 << n)-1] );\
+               DUFF_##n()\
+          }\
+          D += l;\
+          S += l;\
+          w -= l;\
+     }\
+} while(0)
+
+#endif
diff --git a/Source/DirectFB/src/gfx/generic/generic.c b/Source/DirectFB/src/gfx/generic/generic.c
new file mode 100755
index 0000000..9b7cdeb
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/generic.c
@@ -0,0 +1,9161 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <dfb_types.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/gfxcard.h>
+#include <core/state.h>
+#include <core/palette.h>
+
+#include <misc/gfx_util.h>
+#include <misc/util.h>
+#include <misc/conf.h>
+
+#include <direct/clock.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include "generic.h"
+#include "duffs_device.h"
+
+
+/* lookup tables for 2/3bit to 8bit color conversion */
+static const u8 lookup3to8[] = { 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff};
+static const u8 lookup2to8[] = { 0x00, 0x55, 0xaa, 0xff};
+
+#define EXPAND_1to8(v)   ((v) ? 0xff : 0x00)
+#define EXPAND_2to8(v)   (lookup2to8[v])
+#define EXPAND_3to8(v)   (lookup3to8[v])
+#define EXPAND_4to8(v)   (((v) << 4) | ((v)     ))
+#define EXPAND_5to8(v)   (((v) << 3) | ((v) >> 2))
+#define EXPAND_6to8(v)   (((v) << 2) | ((v) >> 4))
+#define EXPAND_7to8(v)   (((v) << 1) | ((v) >> 6))
+
+
+static int use_mmx = 0;
+
+#ifdef USE_MMX
+static void gInit_MMX( void );
+#endif
+
+#if SIZEOF_LONG == 8
+static void gInit_64bit( void );
+#endif
+
+/* RGB16 */
+#define RGB_MASK 0xffff
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_16
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_16_##op##_Aop
+#include "template_colorkey_16.h"
+
+/* ARGB1555 / RGB555 / BGR555 */
+#define RGB_MASK 0x7fff
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_15
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_15_##op##_Aop
+#include "template_colorkey_16.h"
+
+/* ARGB2554 */
+#define RGB_MASK 0x3fff
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_14
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_14_##op##_Aop
+#include "template_colorkey_16.h"
+
+/* ARGB4444 / RGB444*/
+#define RGB_MASK 0x0fff
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_12
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_12_##op##_Aop
+#include "template_colorkey_16.h"
+
+/* RGBA4444 */
+#define RGB_MASK 0xfff0
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_12vv
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_12vv_##op##_Aop
+#include "template_colorkey_16.h"
+
+/* ARGB/RGB32/AiRGB */
+#define RGB_MASK 0x00ffffff
+#define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_32
+#define Bop_PFI_OP_Aop_PFI( op ) Bop_32_##op##_Aop
+#include "template_colorkey_32.h"
+
+/* RGB16 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_6to8( g )
+#define EXPAND_Bto8( b ) EXPAND_5to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_RGB16( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_rgb16_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_rgb16
+#define A_SHIFT 0
+#define R_SHIFT 11
+#define G_SHIFT 5
+#define B_SHIFT 0
+#define A_MASK 0
+#define R_MASK 0xf800
+#define G_MASK 0x07e0
+#define B_MASK 0x001f
+#include "template_acc_16.h"
+
+/* ARGB1555 */
+#define EXPAND_Ato8( a ) EXPAND_1to8( a )
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_5to8( g )
+#define EXPAND_Bto8( b ) EXPAND_5to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_ARGB1555( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_argb1555_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_argb1555
+#define A_SHIFT 15
+#define R_SHIFT 10
+#define G_SHIFT 5
+#define B_SHIFT 0
+#define A_MASK 0x8000
+#define R_MASK 0x7c00
+#define G_MASK 0x03e0
+#define B_MASK 0x001f
+#include "template_acc_16.h"
+
+/* RGB555 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_5to8( g )
+#define EXPAND_Bto8( b ) EXPAND_5to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_RGB555( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_xrgb1555_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_xrgb1555
+#define A_SHIFT 0
+#define R_SHIFT 10
+#define G_SHIFT 5
+#define B_SHIFT 0
+#define A_MASK 0
+#define R_MASK 0x7c00
+#define G_MASK 0x03e0
+#define B_MASK 0x001f
+#include "template_acc_16.h"
+
+/* BGR555 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_5to8( g )
+#define EXPAND_Bto8( b ) EXPAND_5to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_BGR555( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_xbgr1555_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_xbgr1555
+#define A_SHIFT 0
+#define B_SHIFT 10
+#define G_SHIFT 5
+#define R_SHIFT 0
+#define A_MASK 0
+#define B_MASK 0x7c00
+#define G_MASK 0x03e0
+#define R_MASK 0x001f
+#include "template_acc_16.h"
+
+/* ARGB2554 */
+#define EXPAND_Ato8( a ) EXPAND_2to8( a )
+#define EXPAND_Rto8( r ) EXPAND_5to8( r )
+#define EXPAND_Gto8( g ) EXPAND_5to8( g )
+#define EXPAND_Bto8( b ) EXPAND_4to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_ARGB2554( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_argb2554_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_argb2554
+#define A_SHIFT 14
+#define R_SHIFT 9
+#define G_SHIFT 4
+#define B_SHIFT 0
+#define A_MASK 0xc000
+#define R_MASK 0x3e00
+#define G_MASK 0x01f0
+#define B_MASK 0x000f
+#include "template_acc_16.h"
+
+/* ARGB4444 */
+#define EXPAND_Ato8( a ) EXPAND_4to8( a )
+#define EXPAND_Rto8( r ) EXPAND_4to8( r )
+#define EXPAND_Gto8( g ) EXPAND_4to8( g )
+#define EXPAND_Bto8( b ) EXPAND_4to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_ARGB4444( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_argb4444_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_argb4444
+#define A_SHIFT 12
+#define R_SHIFT 8
+#define G_SHIFT 4
+#define B_SHIFT 0
+#define A_MASK 0xf000
+#define R_MASK 0x0f00
+#define G_MASK 0x00f0
+#define B_MASK 0x000f
+#include "template_acc_16.h"
+
+/* ARGB4444 */
+#define EXPAND_Ato8( a ) EXPAND_4to8( a )
+#define EXPAND_Rto8( r ) EXPAND_4to8( r )
+#define EXPAND_Gto8( g ) EXPAND_4to8( g )
+#define EXPAND_Bto8( b ) EXPAND_4to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_RGBA4444( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_rgba4444_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_rgba4444
+#define A_SHIFT 0
+#define R_SHIFT 12
+#define G_SHIFT 8
+#define B_SHIFT 4
+#define A_MASK 0x000f
+#define R_MASK 0xf000
+#define G_MASK 0x0f00
+#define B_MASK 0x00f0
+#include "template_acc_16.h"
+
+/* RGB444 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) EXPAND_4to8( r )
+#define EXPAND_Gto8( g ) EXPAND_4to8( g )
+#define EXPAND_Bto8( b ) EXPAND_4to8( b )
+#define PIXEL_OUT( a, r, g, b ) PIXEL_RGB444( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_xrgb4444_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_xrgb4444
+#define A_SHIFT 0
+#define R_SHIFT 8
+#define G_SHIFT 4
+#define B_SHIFT 0
+#define A_MASK 0
+#define R_MASK 0x0f00
+#define G_MASK 0x00f0
+#define B_MASK 0x000f
+#include "template_acc_16.h"
+
+/* ARGB */
+#define EXPAND_Ato8( a ) (a)
+#define EXPAND_Rto8( r ) (r)
+#define EXPAND_Gto8( g ) (g)
+#define EXPAND_Bto8( b ) (b)
+#define PIXEL_OUT( a, r, g, b ) PIXEL_ARGB( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_argb_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_argb
+#define A_SHIFT 24
+#define R_SHIFT 16
+#define G_SHIFT 8
+#define B_SHIFT 0
+#define A_MASK 0xff000000
+#define R_MASK 0x00ff0000
+#define G_MASK 0x0000ff00
+#define B_MASK 0x000000ff
+#include "template_acc_32.h"
+
+/* RGB32 */
+#define EXPAND_Ato8( a ) 0xFF
+#define EXPAND_Rto8( r ) (r)
+#define EXPAND_Gto8( g ) (g)
+#define EXPAND_Bto8( b ) (b)
+#define PIXEL_OUT( a, r, g, b ) PIXEL_RGB32( r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_rgb32_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_rgb32
+#define A_SHIFT 0
+#define R_SHIFT 16
+#define G_SHIFT 8
+#define B_SHIFT 0
+#define A_MASK 0
+#define R_MASK 0x00ff0000
+#define G_MASK 0x0000ff00
+#define B_MASK 0x000000ff
+#include "template_acc_32.h"
+
+/* AiRGB */
+#define EXPAND_Ato8( a ) ((a) ^ 0xff)
+#define EXPAND_Rto8( r ) (r)
+#define EXPAND_Gto8( g ) (g)
+#define EXPAND_Bto8( b ) (b)
+#define PIXEL_OUT( a, r, g, b ) PIXEL_AiRGB( a, r, g, b )
+#define Sop_PFI_OP_Dacc( op ) Sop_airgb_##op##_Dacc
+#define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_airgb
+#define A_SHIFT 24
+#define R_SHIFT 16
+#define G_SHIFT 8
+#define B_SHIFT 0
+#define A_MASK 0xff000000
+#define R_MASK 0x00ff0000
+#define G_MASK 0x0000ff00
+#define B_MASK 0x000000ff
+#include "template_acc_32.h"
+
+/********************************* Cop_to_Aop_PFI *****************************/
+
+static void Cop_to_Aop_8( GenefxState *gfxs )
+{
+     memset( gfxs->Aop[0], gfxs->Cop, gfxs->length );
+}
+
+static void Cop_to_Aop_16( GenefxState *gfxs )
+{
+     int    w;
+     int    l   = gfxs->length;
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+     u32 DCop = ((Cop << 16) | Cop);
+
+     if (((long)D)&2) {         /* align */
+          u16* tmp = (u16*) D;
+          --l;
+          *tmp = Cop;
+          D = (u32*)(tmp+1);
+     }
+
+     w = (l >> 1);
+     while (w) {
+          *D = DCop;
+          --w;
+          ++D;
+     }
+
+     if (l & 1)                 /* do the last ential pixel */
+          *((u16*)D) = (u16)Cop;
+}
+
+static void Cop_to_Aop_18( GenefxState *gfxs )
+{
+     int   w = gfxs->length;
+     u8   *D = gfxs->Aop[0];
+     u32   Cop = gfxs->Cop;
+
+     while (w) {
+          D[0] = Cop;
+          D[1] = Cop >> 8;
+          D[2] = Cop >> 16;
+          D += 3;
+          --w;
+     }
+}
+
+static void Cop_to_Aop_24( GenefxState *gfxs )
+{
+     int   w = gfxs->length;
+     u8   *D = gfxs->Aop[0];
+
+     while (w) {
+          D[0] = gfxs->color.b;
+          D[1] = gfxs->color.g;
+          D[2] = gfxs->color.r;
+
+          D += 3;
+          --w;
+     }
+}
+
+static void Cop_to_Aop_32( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+     while (w--)
+          *D++ = Cop;
+}
+
+static void Cop_to_Aop_yuv422( GenefxState *gfxs )
+{
+     int    l;
+     int    w   = gfxs->length;
+     u16   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+     if ((long)D & 2) {
+#ifdef WORDS_BIGENDIAN
+          *D++ = Cop & 0xffff;
+#else
+          *D++ = Cop >> 16;
+#endif
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          *((u32*)D) = Cop;
+          D += 2;
+     }
+
+     if (w & 1) {
+#ifdef WORDS_BIGENDIAN
+          *D = Cop >> 16;
+#else
+          *D = Cop & 0xffff;
+#endif
+     }
+}
+
+static void Cop_to_Aop_i420( GenefxState *gfxs )
+{
+     memset( gfxs->Aop[0], gfxs->YCop, gfxs->length );
+     if (gfxs->AopY & 1) {
+          memset( gfxs->Aop[1], gfxs->CbCop, gfxs->length>>1 );
+          memset( gfxs->Aop[2], gfxs->CrCop, gfxs->length>>1 );
+     }
+}
+
+static void Cop_to_Aop_nv12( GenefxState *gfxs )
+{
+     memset( gfxs->Aop[0], gfxs->YCop, gfxs->length );
+    
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          u16   *D   = gfxs->Aop[1];
+          int    w   = gfxs->length>>1;
+          u16    Cop = gfxs->CbCop | (gfxs->CrCop << 8);
+          
+          while (w--)
+               *D++ = Cop;
+     }
+}
+
+static void Cop_to_Aop_nv21( GenefxState *gfxs )
+{
+     memset( gfxs->Aop[0], gfxs->YCop, gfxs->length );
+    
+     if (gfxs->AopY & 1) {
+          u16   *D   = gfxs->Aop[1];
+          int    w   = gfxs->length>>1;
+          u16    Cop = gfxs->CrCop | (gfxs->CbCop << 8);
+          
+          while (w--)
+               *D++ = Cop;
+     }
+}
+
+static GenefxFunc Cop_to_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Cop_to_Aop_16,      /* DSPF_ARGB1555 */
+     Cop_to_Aop_16,      /* DSPF_RGB16 */
+     Cop_to_Aop_24,      /* DSPF_RGB24 */
+     Cop_to_Aop_32,      /* DSPF_RGB32 */
+     Cop_to_Aop_32,      /* DSPF_ARGB */
+     Cop_to_Aop_8,       /* DSPF_A8 */
+     Cop_to_Aop_yuv422,  /* DSPF_YUY2 */
+     Cop_to_Aop_8,       /* DSPF_RGB332 */
+     Cop_to_Aop_yuv422,  /* DSPF_UYVY */
+     Cop_to_Aop_i420,    /* DSPF_I420 */
+     Cop_to_Aop_i420,    /* DSPF_YV12 */
+     Cop_to_Aop_8,       /* DSPF_LUT8 */
+     Cop_to_Aop_8,       /* DSPF_ALUT44 */
+     Cop_to_Aop_32,      /* DSPF_AiRGB */
+     NULL,               /* DSPF_A1 */
+     Cop_to_Aop_nv12,    /* DSPF_NV12 */
+     Cop_to_Aop_nv12,    /* DSPF_NV16 */
+     Cop_to_Aop_16,      /* DSPF_ARGB2554 */
+     Cop_to_Aop_16,      /* DSPF_ARGB4444 */
+     Cop_to_Aop_16,      /* DSPF_RGBA4444 */
+     Cop_to_Aop_nv21,    /* DSPF_NV21 */
+     Cop_to_Aop_32,      /* DSPF_AYUV */
+     NULL,               /* DSPF_A4 */
+     Cop_to_Aop_18,      /* DSPF_ARGB1666 */
+     Cop_to_Aop_18,      /* DSPF_ARGB6666 */
+     Cop_to_Aop_18,      /* DSPF_RGB18 */
+     NULL,               /* DSPF_LUT2 */
+     Cop_to_Aop_16,      /* DSPF_RGB444 */
+     Cop_to_Aop_16,      /* DSPF_RGB555 */
+     Cop_to_Aop_16       /* DSPF_BGR555 */
+};
+
+/********************************* Cop_toK_Aop_PFI ****************************/
+
+static void Cop_toK_Aop_8( GenefxState *gfxs )
+{
+     int    w    = gfxs->length;
+     u8    *D    = gfxs->Aop[0];
+     u32    Cop  = gfxs->Cop;
+     u32    Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (Dkey == *D)
+               *D = Cop;
+
+          D++;
+     }
+}
+
+static void Cop_toK_Aop_18( GenefxState *gfxs )
+{
+     int   w   = gfxs->length;
+     u8   *D   = gfxs->Aop[0];
+     u32   Dkey = gfxs->Dkey;
+     u32   Cop  = gfxs->Cop;
+
+     while (w) {
+        if (Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {
+               D[0] = Cop;
+               D[1] = Cop >> 8;
+               D[2] = Cop >> 16;
+        }
+        D += 3;
+        --w;
+     }
+
+}
+
+static void Cop_toK_Aop_24( GenefxState *gfxs )
+{
+     int   w   = gfxs->length;
+     u8   *D   = gfxs->Aop[0];
+     u8    Dkr = (gfxs->Dkey & 0xff0000) >> 16;
+     u8    Dkg = (gfxs->Dkey & 0x00ff00) >>  8;
+     u8    Dkb = (gfxs->Dkey & 0x0000ff);
+
+     while (w--) {
+          if (D[0] == Dkb && D[1] == Dkg && D[2] == Dkr) {
+               D[0] = gfxs->color.b;
+               D[1] = gfxs->color.g;
+               D[2] = gfxs->color.r;
+          }
+
+          D += 3;
+     }
+}
+
+static void Cop_toK_Aop_yuv422( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     u16   *D     = gfxs->Aop[0];
+     u32    Cop   = gfxs->Cop;
+     u32    Dkey  = gfxs->Dkey;
+
+     if ((long)D & 2) {
+#ifdef WORDS_BIGENDIAN
+          if (*D == (Dkey & 0xffff))
+               *D = Cop & 0xffff;
+#else
+          if (*D == (Dkey >> 16))
+               *D = Cop >> 16;
+#endif
+          D++;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (*((u32*)D) == Dkey)
+               *((u32*)D) = Cop;
+          D += 2;
+     }
+
+     if (w & 1) {
+#ifdef WORDS_BIGENDIAN
+          if (*D == (Dkey >> 16))
+               *D = Cop >> 16;
+#else
+          if (*D == (Dkey & 0xffff))
+               *D = Cop & 0xffff;
+#endif
+     }
+}
+
+static void Cop_toK_Aop_alut44( GenefxState *gfxs )
+{
+     int    w    = gfxs->length;
+     u8    *D    = gfxs->Aop[0];
+     u32    Cop  = gfxs->Cop;
+     u32    Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (Dkey == (*D & 0x0F))
+               *D = Cop;
+
+          D++;
+     }
+}
+
+static GenefxFunc Cop_toK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Cop_toK_Aop_15,          /* DSPF_ARGB1555 */
+     Cop_toK_Aop_16,          /* DSPF_RGB16 */
+     Cop_toK_Aop_24,          /* DSPF_RGB24 */
+     Cop_toK_Aop_32,          /* DSPF_RGB32 */
+     Cop_toK_Aop_32,          /* DSPF_ARGB */
+     Cop_toK_Aop_8,           /* DSPF_A8 */
+     Cop_toK_Aop_yuv422,      /* DSPF_YUY2 */
+     Cop_toK_Aop_8,           /* DSPF_RGB332 */
+     Cop_toK_Aop_yuv422,      /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     Cop_toK_Aop_8,           /* DSPF_LUT8 */
+     Cop_toK_Aop_alut44,      /* DSPF_ALUT44 */
+     Cop_toK_Aop_32,          /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Cop_toK_Aop_14,          /* DSPF_ARGB2554 */
+     Cop_toK_Aop_12,          /* DSPF_ARGB4444 */
+     Cop_toK_Aop_12vv,        /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     Cop_toK_Aop_32,          /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     Cop_toK_Aop_18,          /* DSPF_ARGB1666 */
+     Cop_toK_Aop_18,          /* DSPF_ARGB6666 */
+     Cop_toK_Aop_18,          /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Cop_toK_Aop_12,          /* DSPF_RGB444 */
+     Cop_toK_Aop_15,          /* DSPF_RGB555 */
+     Cop_toK_Aop_15           /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_to_Aop_PFI *************************/
+
+static void Bop_4_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length>>1 );
+}
+
+static void Bop_8_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );
+}
+
+static void Bop_16_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*2 );
+}
+
+static void Bop_24_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*3 );
+}
+
+static void Bop_32_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length*4 );
+}
+
+static void Bop_i420_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length ); 
+     if (gfxs->AopY & 1) {
+          direct_memmove( gfxs->Aop[1], gfxs->Bop[1], gfxs->length>>1 );
+          direct_memmove( gfxs->Aop[2], gfxs->Bop[2], gfxs->length>>1 );
+     }
+}             
+
+static void Bop_NV_to_Aop( GenefxState *gfxs )
+{
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1)
+          direct_memmove( gfxs->Aop[1], gfxs->Bop[1], gfxs->length&~1 );
+}
+
+static GenefxFunc Bop_PFI_to_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_16_to_Aop,      /* DSPF_ARGB1555 */
+     Bop_16_to_Aop,      /* DSPF_RGB16 */
+     Bop_24_to_Aop,      /* DSPF_RGB24 */
+     Bop_32_to_Aop,      /* DSPF_RGB32 */
+     Bop_32_to_Aop,      /* DSPF_ARGB */
+     Bop_8_to_Aop,       /* DSPF_A8 */
+     Bop_16_to_Aop,      /* DSPF_YUY2 */
+     Bop_8_to_Aop,       /* DSPF_RGB332 */
+     Bop_16_to_Aop,      /* DSPF_UYVY */
+     Bop_i420_to_Aop,    /* DSPF_I420 */
+     Bop_i420_to_Aop,    /* DSPF_YV12 */
+     Bop_8_to_Aop,       /* DSPF_LUT8 */
+     Bop_8_to_Aop,       /* DSPF_ALUT44 */
+     Bop_32_to_Aop,      /* DSPF_AiRGB */
+     NULL,               /* DSPF_A1 */
+     Bop_NV_to_Aop,      /* DSPF_NV12 */
+     Bop_NV_to_Aop,      /* DSPF_NV16 */
+     Bop_16_to_Aop,      /* DSPF_ARGB2554 */
+     Bop_16_to_Aop,      /* DSPF_ARGB4444 */
+     Bop_16_to_Aop,      /* DSPF_RGBA4444 */
+     Bop_NV_to_Aop,      /* DSPF_NV21 */
+     Bop_32_to_Aop,      /* DSPF_AYUV */
+     Bop_4_to_Aop,       /* DSPF_A4 */
+     Bop_24_to_Aop,      /* DSPF_ARGB1666 */
+     Bop_24_to_Aop,      /* DSPF_ARGB6666 */
+     Bop_24_to_Aop,      /* DSPF_RGB18 */
+     NULL,               /* DSPF_LUT2 */
+     Bop_16_to_Aop,      /* DSPF_RGB444 */
+     Bop_16_to_Aop,      /* DSPF_RGB555 */
+     Bop_16_to_Aop       /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_toR_Aop_PFI *************************/
+
+static void Bop_4_toR_Aop( GenefxState *gfxs )
+{
+     int w = gfxs->length>>1;
+     int Dstep = gfxs->Astep;
+     u8 * S = gfxs->Bop[0];
+     u8 * D = gfxs->Aop[0];
+     while(w--)
+     {
+          *D = *S;
+          D += Dstep;
+          S++;
+     }
+}
+
+static void Bop_8_toR_Aop( GenefxState *gfxs )
+{
+     int w = gfxs->length;
+     int Dstep = gfxs->Astep;
+     u8 * S = gfxs->Bop[0];
+     u8 * D = gfxs->Aop[0];
+     while(w--)
+     {
+          *D = *S;
+          D += Dstep;
+          S++;
+     }
+}
+
+static void Bop_16_toR_Aop( GenefxState *gfxs )
+{
+     int w = gfxs->length;
+     int Dstep = gfxs->Astep;
+     u16 * S = gfxs->Bop[0];
+     u16 * D = gfxs->Aop[0];
+     while(w--)
+     {
+          *D = *S;
+          D += Dstep;
+          S++;
+     }
+}
+
+static void Bop_24_toR_Aop( GenefxState *gfxs )
+{
+     int w = gfxs->length;
+     int Dstep = gfxs->Astep;
+     u8 * S = gfxs->Bop[0];
+     u8 * D = gfxs->Aop[0];
+     while(w--)
+     {
+          D[0] = S[0];
+          D[1] = S[1];
+          D[2] = S[2];
+
+          D += Dstep * 3;
+          S += 3;
+     }
+}
+
+static void Bop_32_toR_Aop( GenefxState *gfxs )
+{
+     int w = gfxs->length;
+     int Dstep = gfxs->Astep;
+     u32 * S = gfxs->Bop[0];
+     u32 * D = gfxs->Aop[0];
+     while(w--)
+     {
+          *D = *S;
+          D += Dstep;
+          S++;
+     }
+}
+
+static void Bop_i420_toR_Aop( GenefxState *gfxs )
+{
+     Bop_8_toR_Aop( gfxs );
+     if (gfxs->AopY & 1) {
+          int w = gfxs->length>>1;
+          int Dstep = gfxs->Astep>>1;
+          u8 * S1 = gfxs->Bop[1];
+          u8 * D1 = gfxs->Aop[1];
+          u8 * S2 = gfxs->Bop[2];
+          u8 * D2 = gfxs->Aop[2];
+          while(w--)
+          {
+               *D1 = *S1++;
+               *D2 = *S2++;
+               D1 += Dstep;
+               D2 += Dstep;
+          }
+     }
+}             
+
+static void Bop_NV_toR_Aop( GenefxState *gfxs )
+{
+     Bop_8_toR_Aop( gfxs );
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          int w = gfxs->length&~1;
+          int Dstep = gfxs->Astep;
+          u8 * S = gfxs->Bop[1];
+          u8 * D = gfxs->Aop[1];
+          while(w--)
+          {
+               *D = *S++;
+               D += Dstep;
+          }
+     }
+}
+
+static GenefxFunc Bop_PFI_toR_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_16_toR_Aop,      /* DSPF_ARGB1555 */
+     Bop_16_toR_Aop,      /* DSPF_RGB16 */
+     Bop_24_toR_Aop,      /* DSPF_RGB24 */
+     Bop_32_toR_Aop,      /* DSPF_RGB32 */
+     Bop_32_toR_Aop,      /* DSPF_ARGB */
+     Bop_8_toR_Aop,       /* DSPF_A8 */
+     Bop_16_toR_Aop,      /* DSPF_YUY2 */
+     Bop_8_toR_Aop,       /* DSPF_RGB332 */
+     Bop_16_toR_Aop,      /* DSPF_UYVY */
+     Bop_i420_toR_Aop,    /* DSPF_I420 */
+     Bop_i420_toR_Aop,    /* DSPF_YV12 */
+     Bop_8_toR_Aop,       /* DSPF_LUT8 */
+     Bop_8_toR_Aop,       /* DSPF_ALUT44 */
+     Bop_32_toR_Aop,      /* DSPF_AiRGB */
+     NULL,               /* DSPF_A1 */
+     Bop_NV_toR_Aop,      /* DSPF_NV12 */
+     Bop_NV_toR_Aop,      /* DSPF_NV16 */
+     Bop_16_toR_Aop,      /* DSPF_ARGB2554 */
+     Bop_16_toR_Aop,      /* DSPF_ARGB4444 */
+     Bop_16_toR_Aop,      /* DSPF_RGBA4444 */
+     Bop_NV_toR_Aop,      /* DSPF_NV21 */
+     Bop_32_toR_Aop,      /* DSPF_AYUV */
+     Bop_4_toR_Aop,       /* DSPF_A4 */
+     Bop_24_toR_Aop,      /* DSPF_ARGB1666 */
+     Bop_24_toR_Aop,      /* DSPF_ARGB6666 */
+     Bop_24_toR_Aop,      /* DSPF_RGB18 */
+     NULL,               /* DSPF_LUT2 */
+     Bop_16_toR_Aop,      /* DSPF_RGB444 */
+     Bop_16_toR_Aop,      /* DSPF_RGB555 */
+     Bop_16_toR_Aop       /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_Kto_Aop_PFI ************************/
+
+static void Bop_rgb18_Kto_Aop( GenefxState *gfxs )
+{
+
+     int    w     = gfxs->length;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    Ostep = gfxs->Ostep;
+
+     if (Ostep < 0) {
+          D += (gfxs->length - 1) * 3;
+          S += (gfxs->length - 1) * 3;
+     }
+
+     while (w--) {
+          u8 s0 = S[0];
+          u8 s1 = S[1];
+          u8 s2 = S[2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               D[0] = s0;
+               D[1] = s1;
+               D[2] = s2;
+          }
+
+          S += Ostep * 3;
+          D += Ostep * 3;
+     }
+}
+
+static void Bop_rgb24_Kto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    Ostep = gfxs->Ostep;
+
+     if (Ostep < 0) {
+          D += (gfxs->length - 1) * 3;
+          S += (gfxs->length - 1) * 3;
+     }
+
+     while (w--) {
+          u8 b = *S;
+          u8 g = *(S+1);
+          u8 r = *(S+2);
+
+          if (Skey != (u32)(r<<16 | g<<8 | b)) {
+               *D     = b;
+               *(D+1) = g;
+               *(D+2) = r;
+          }
+
+          S += Ostep * 3;
+          D += Ostep * 3;
+     }
+}
+
+static void Bop_a8_Kto_Aop( GenefxState *gfxs )
+{
+     /* no color to key */
+     direct_memmove( gfxs->Aop[0], gfxs->Bop[0], gfxs->length );
+}
+
+static void Bop_yuv422_Kto_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     u16   *D     = gfxs->Aop[0];
+     u16   *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    Ostep = gfxs->Ostep;
+
+     if (Ostep < 0) {
+          D += gfxs->length - 1;
+          S += gfxs->length - 1;
+     }
+
+     if ((long)D & 2) {
+          u16 s = *S;
+#ifdef WORDS_BIGENDIAN
+          if (s != (Skey >> 16))
+               *D = s;
+#else
+          if (s != (Skey & 0xffff))
+               *D = s;
+#endif
+          S += Ostep;
+          D += Ostep;
+          w--;
+     }
+
+     if (Ostep < 0) {
+         S--;
+         D--;
+     }
+
+     for (l = w>>1; l--;) {
+          u32 s = *((u32*)S);
+
+          if (s != Skey)
+               *((u32*)D) = s;
+
+          S += Ostep << 1;
+          D += Ostep << 1;
+     }
+
+     if (w & 1) {
+          u16 s = *S;
+#ifdef WORDS_BIGENDIAN
+          if (s != (Skey & 0xffff))
+               *D = s;
+#else
+          if (s != (Skey >> 16))
+               *D = s;
+#endif
+     }
+}
+
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 4 )
+
+#define SET_PIXEL( D, S )               \
+     do {                               \
+          register u32 s = S;           \
+                                        \
+          if (s != Skey)                \
+               D = s;                   \
+     } while (0)
+
+static void Bop_8_Kto_Aop( GenefxState *gfxs )
+{
+     int    i;
+     int    w     = gfxs->length;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+
+     if (gfxs->Ostep > 0) {
+          SET_PIXEL_DUFFS_DEVICE( D, S, w );
+     }
+     else {
+          for (i=w-1; i>=0; i--)
+               if (S[i] != Skey)
+                    D[i] = S[i];
+     }
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+#undef SET_PIXEL
+
+static void Bop_alut44_Kto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    Ostep = gfxs->Ostep;
+
+     if (Ostep < 0) {
+          D += gfxs->length - 1;
+          S += gfxs->length - 1;
+     }
+
+     while (w--) {
+          u8 spixel = *S;
+
+          if ((spixel & 0x0F) != Skey)
+               *D = spixel;
+
+          S += Ostep;
+          D += Ostep;
+     }
+}
+
+static GenefxFunc Bop_PFI_Kto_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_Kto_Aop,          /* DSPF_ARGB1555 */
+     Bop_16_Kto_Aop,          /* DSPF_RGB16 */
+     Bop_rgb24_Kto_Aop,       /* DSPF_RGB24 */
+     Bop_32_Kto_Aop,          /* DSPF_RGB32 */
+     Bop_32_Kto_Aop,          /* DSPF_ARGB */
+     Bop_a8_Kto_Aop,          /* DSPF_A8 */
+     Bop_yuv422_Kto_Aop,      /* DSPF_YUY2 */
+     Bop_8_Kto_Aop,           /* DSPF_RGB332 */
+     Bop_yuv422_Kto_Aop,      /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     Bop_8_Kto_Aop,           /* DSPF_LUT8 */
+     Bop_alut44_Kto_Aop,      /* DSPF_ALUT44 */
+     Bop_32_Kto_Aop,          /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_Kto_Aop,          /* DSPF_ARGB2554 */
+     Bop_12_Kto_Aop,          /* DSPF_ARGB4444 */
+     Bop_12vv_Kto_Aop,        /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     Bop_32_Kto_Aop,          /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     Bop_rgb18_Kto_Aop,       /* DSPF_ARGB1666 */
+     Bop_rgb18_Kto_Aop,       /* DSPF_ARGB6666 */
+     Bop_rgb18_Kto_Aop,       /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_Kto_Aop,          /* DSPF_RGB444 */
+     Bop_15_Kto_Aop,          /* DSPF_RGB555 */
+     Bop_15_Kto_Aop           /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_toK_Aop_PFI ************************/
+
+static void Bop_rgb18_toK_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Dkey  = gfxs->Dkey;
+
+     while (w--) {
+          if (Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {
+               D[0] = S[0];
+               D[1] = S[1];
+               D[2] = S[2];
+          }
+          S +=  3;
+          D +=  3;
+     }
+}
+
+static void Bop_rgb24_toK_Aop( GenefxState *gfxs )
+{
+      int   w    = gfxs->length;
+      u8   *S    = gfxs->Bop[0];
+      u8   *D    = gfxs->Aop[0];
+      u8    Dkr  = (gfxs->Dkey & 0xff0000) >> 16;
+      u8    Dkg  = (gfxs->Dkey & 0x00ff00) >>  8;
+      u8    Dkb  = (gfxs->Dkey & 0x0000ff);
+
+      while (w--) {
+           if (D[0] == Dkb && D[1] == Dkg && D[2] == Dkr) {
+               D[0] = S[0];
+               D[1] = S[1];
+               D[2] = S[2];
+          }
+          S += 3;
+          D += 3;
+     }
+}
+
+static void Bop_yuv422_toK_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     u16   *S     = gfxs->Bop[0];
+     u16   *D     = gfxs->Aop[0];
+     u32    Dkey  = gfxs->Dkey;
+     int    Ostep = gfxs->Ostep;
+
+     if (Ostep < 0) {
+          D += gfxs->length - 1;
+          S += gfxs->length - 1;
+     }
+
+     if ((long)D & 2) {
+#ifdef WORDS_BIGENDIAN
+          if (*D == (Dkey & 0xffff))
+               *D = *S;
+#else
+          if (*D == (Dkey >> 16))
+               *D = *S;
+#endif
+          D += Ostep;
+          S += Ostep;
+          w--;
+     }
+
+     if (Ostep < 0) {
+          S--;
+          D--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (*D == Dkey)
+               *D = *S;
+          D += Ostep << 1;
+          S += Ostep << 1;
+     }
+
+     if (w & 1) {
+#ifdef WORDS_BIGENDIAN
+          if (*D == (Dkey >> 16))
+               *D = *S;
+#else
+          if (*D == (Dkey & 0xffff))
+               *D = *S;
+#endif
+     }
+}
+
+static void Bop_rgb332_toK_Aop( GenefxState *gfxs )
+{
+      int   w    = gfxs->length;
+      u8   *S    = gfxs->Bop[0];
+      u8   *D    = gfxs->Aop[0];
+      u8    Dkey = gfxs->Dkey;
+
+      while (w--) {
+           if (*D == Dkey) {
+                *D = *S;
+           }
+           D++;
+           S++;
+      }
+}
+
+static GenefxFunc Bop_PFI_toK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_toK_Aop,          /* DSPF_ARGB1555 */
+     Bop_16_toK_Aop,          /* DSPF_RGB16 */
+     Bop_rgb24_toK_Aop,       /* DSPF_RGB24 */
+     Bop_32_toK_Aop,          /* DSPF_RGB32 */
+     Bop_32_toK_Aop,          /* DSPF_ARGB */
+     NULL,                    /* DSPF_A8 */
+     Bop_yuv422_toK_Aop,      /* DSPF_YUY2 */
+     Bop_rgb332_toK_Aop,      /* DSPF_RGB332 */
+     Bop_yuv422_toK_Aop,      /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     NULL,                    /* DSPF_LUT8 */
+     NULL,                    /* DSPF_ALUT44 */
+     Bop_32_toK_Aop,          /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_toK_Aop,          /* DSPF_ARGB2554 */
+     Bop_12_toK_Aop,          /* DSPF_ARGB4444 */
+     Bop_12vv_toK_Aop,        /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     Bop_32_toK_Aop,          /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     Bop_rgb18_toK_Aop,       /* DSPF_ARGB1666 */
+     Bop_rgb18_toK_Aop,       /* DSPF_ARGB6666 */
+     Bop_rgb18_toK_Aop,       /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_toK_Aop,          /* DSPF_RGB444 */
+     Bop_15_toK_Aop,          /* DSPF_RGB555 */
+     Bop_15_toK_Aop           /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_KtoK_Aop_PFI ***********************/
+
+static GenefxFunc Bop_PFI_KtoK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_KtoK_Aop,         /* DSPF_ARGB1555 */
+     Bop_16_KtoK_Aop,         /* DSPF_RGB16 */
+     NULL,                    /* DSPF_RGB24 */
+     Bop_32_KtoK_Aop,         /* DSPF_RGB32 */
+     Bop_32_KtoK_Aop,         /* DSPF_ARGB */
+     NULL,                    /* DSPF_A8 */
+     NULL,                    /* DSPF_YUY2 */
+     NULL,                    /* DSPF_RGB332 */
+     NULL,                    /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     NULL,                    /* DSPF_LUT8 */
+     NULL,                    /* DSPF_ALUT44 */
+     Bop_32_KtoK_Aop,         /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_KtoK_Aop,         /* DSPF_ARGB2554 */
+     Bop_12_KtoK_Aop,         /* DSPF_ARGB4444 */
+     Bop_12vv_KtoK_Aop,       /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     NULL,                    /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     NULL,                    /* DSPF_ARGB1666 */
+     NULL,                    /* DSPF_ARGB6666 */
+     NULL,                    /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_KtoK_Aop,         /* DSPF_RGB444 */
+     Bop_15_KtoK_Aop,         /* DSPF_RGB555 */
+     Bop_15_KtoK_Aop          /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_Sto_Aop_PFI ************************/
+
+static void Bop_16_Sto_Aop( GenefxState *gfxs )
+{
+     int    w2;
+     int    w      = gfxs->length;
+     int    i      = gfxs->Xphase;
+     u32   *D      = gfxs->Aop[0];
+     u16   *S      = gfxs->Bop[0];
+     int    SperD  = gfxs->SperD;
+     int    SperD2 = SperD << 1;
+
+     if (((long)D)&2) {
+          *(u16*)D = *S;
+          i += SperD;
+          w--;
+          D = gfxs->Aop[0] + 2;
+     }
+
+     w2 = (w >> 1);
+     while (w2--) {
+#ifdef WORDS_BIGENDIAN
+          *D++ =  S[i>>16] << 16 | S[(i+SperD)>>16];
+#else
+          *D++ = (S[(i+SperD)>>16] << 16) | S[i>>16];
+#endif
+          i += SperD2;
+     }
+     if (w&1) {
+          *(u16*)D = S[i>>16];
+     }
+}
+
+static void Bop_24_Sto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *D     = gfxs->Aop[0];
+     u8   *S     = gfxs->Bop[0];
+     int   SperD = gfxs->SperD;
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          *D++ = S[pixelstart+0];
+          *D++ = S[pixelstart+1];
+          *D++ = S[pixelstart+2];
+
+          i += SperD;
+     }
+}
+
+static void Bop_32_Sto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u32   *D     = gfxs->Aop[0];
+     u32   *S     = gfxs->Bop[0];
+     int    SperD = gfxs->SperD;
+
+     while (w--) {
+          *D++ = S[i>>16];
+
+          i += SperD;
+     }
+}
+
+static void Bop_yuy2_Sto_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u16   *D     = gfxs->Aop[0];
+     u16   *S     = gfxs->Bop[0];
+     int    SperD = gfxs->SperD;
+
+     if ((long)D & 2) {
+          *D++ = *S;
+          i = SperD;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          register u32 d;
+
+          d  = ((u32*)S)[i>>17] & 0xff00ff00;
+#ifdef WORDS_BIGENDIAN
+          d |= (S[i>>16]          & 0x00ff) << 16;
+          d |= (S[(i+SperD)>>16]  & 0x00ff);
+#else
+          d |= (S[i>>16]          & 0x00ff);
+          d |= (S[(i+SperD)>>16]  & 0x00ff) << 16;
+#endif
+          *((u32*)D) = d;
+          D += 2;
+
+          i += SperD << 1;
+     }
+
+     if (w & 1)
+          *D = S[i>>16];
+}
+
+static void Bop_8_Sto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *D     = gfxs->Aop[0];
+     u8   *S     = gfxs->Bop[0];
+     int   SperD = gfxs->SperD;
+
+     while (w--) {
+          *D++ = S[i>>16];
+
+          i += SperD;
+     }
+}
+
+static void Bop_uyvy_Sto_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u16   *D     = gfxs->Aop[0];
+     u16   *S     = gfxs->Bop[0];
+     int    SperD = gfxs->SperD;
+
+     if ((long)D & 2) {
+          *D++ = *S;
+          i = SperD;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          register u32 d;
+
+          d  = ((u32*)S)[i>>17] & 0x00ff00ff;
+#ifdef WORDS_BIGENDIAN
+          d |= (S[i>>16]          & 0xff00) << 16;
+          d |= (S[(i+SperD)>>16]  & 0xff00);
+#else
+          d |= (S[i>>16]          & 0xff00);
+          d |= (S[(i+SperD)>>16]  & 0xff00) << 16;
+#endif
+          *((u32*)D) = d;
+          D += 2;
+
+          i += SperD << 1;
+     }
+
+     if (w & 1)
+          *D = S[i>>16];
+}
+
+static void Bop_i420_Sto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *Dy    = gfxs->Aop[0];
+     u8   *Sy    = gfxs->Bop[0];
+     int   SperD = gfxs->SperD;
+    
+     while (w--) {
+          *Dy++ = Sy[i>>16];
+
+          i += SperD;
+     }
+     
+     if (gfxs->AopY & 1) {
+          u8 *Du = gfxs->Aop[1];
+          u8 *Dv = gfxs->Aop[2];
+          u8 *Su = gfxs->Bop[1];
+          u8 *Sv = gfxs->Bop[2];
+    
+          for (w = gfxs->length>>1, i = 0; w--;) {
+               *Du++ = Su[i>>16];
+
+               i += SperD;
+          }
+
+          for (w = gfxs->length>>1, i = 0; w--;) {
+               *Dv++ = Sv[i>>16];
+
+               i += SperD;
+          }
+     }
+}
+
+static void Bop_NV_Sto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *Dy    = gfxs->Aop[0];
+     u8   *Sy    = gfxs->Bop[0];
+     int   SperD = gfxs->SperD;
+     
+     while (w--) {
+          *Dy++ = Sy[i>>16];
+
+          i += SperD;
+     }
+          
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          u16 *Duv = gfxs->Aop[1];
+          u16 *Suv = gfxs->Bop[1];
+
+          for (w = gfxs->length>>1, i = 0; w--;) {
+               *Duv++ = Suv[i>>16];
+
+               i += SperD;
+          }
+     }
+}
+
+static GenefxFunc Bop_PFI_Sto_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_16_Sto_Aop,          /* DSPF_ARGB1555 */
+     Bop_16_Sto_Aop,          /* DSPF_RGB16 */
+     Bop_24_Sto_Aop,          /* DSPF_RGB24 */
+     Bop_32_Sto_Aop,          /* DSPF_RGB32 */
+     Bop_32_Sto_Aop,          /* DSPF_ARGB */
+     Bop_8_Sto_Aop,           /* DSPF_A8 */
+     Bop_yuy2_Sto_Aop,        /* DSPF_YUY2 */
+     Bop_8_Sto_Aop,           /* DSPF_RGB332 */
+     Bop_uyvy_Sto_Aop,        /* DSPF_UYVY */
+     Bop_i420_Sto_Aop,        /* DSPF_I420 */
+     Bop_i420_Sto_Aop,        /* DSPF_YV12 */
+     Bop_8_Sto_Aop,           /* DSPF_LUT8 */
+     Bop_8_Sto_Aop,           /* DSPF_ALUT44 */
+     Bop_32_Sto_Aop,          /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     Bop_NV_Sto_Aop,          /* DSPF_NV12 */
+     Bop_NV_Sto_Aop,          /* DSPF_NV16 */
+     Bop_16_Sto_Aop,          /* DSPF_ARGB2554 */
+     Bop_16_Sto_Aop,          /* DSPF_ARGB4444 */
+     Bop_16_Sto_Aop,          /* DSPF_RGBA4444 */
+     Bop_NV_Sto_Aop,          /* DSPF_NV21 */
+     Bop_32_Sto_Aop,          /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     Bop_24_Sto_Aop,          /* DSPF_ARGB1666 */
+     Bop_24_Sto_Aop,          /* DSPF_ARGB6666 */
+     Bop_24_Sto_Aop,          /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_16_Sto_Aop,          /* DSPF_ARGB4444 */
+     Bop_16_Sto_Aop,          /* DSPF_ARGB1555 */
+     Bop_16_Sto_Aop           /* DSPF_ARGB1555 */
+};
+
+/********************************* Bop_PFI_SKto_Aop_PFI ***********************/
+
+static void Bop_rgb18_SKto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *D     = gfxs->Aop[0];
+     u8   *S     = gfxs->Bop[0];
+     u32   Skey  = gfxs->Skey;
+     int   SperD = gfxs->SperD;
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 s0 = S[pixelstart+0];
+          u8 s1 = S[pixelstart+1];
+          u8 s2 = S[pixelstart+2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               D[0] = s0;
+               D[1] = s1;
+               D[2] = s2;
+          }
+          i += SperD;
+          D += 3;
+     }
+}
+
+static void Bop_rgb24_SKto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    SperD = gfxs->SperD;
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 b = S[pixelstart+0];
+          u8 g = S[pixelstart+1];
+          u8 r = S[pixelstart+2];
+
+          if (Skey != (u32)(r<<16 | g<<8 | b)) {
+               *D     = b;
+               *(D+1) = g;
+               *(D+2) = r;
+          }
+
+          D += 3;
+          i += SperD;
+     }
+}
+
+static void Bop_a8_SKto_Aop( GenefxState *gfxs )
+{
+     int   w     = gfxs->length;
+     int   i     = gfxs->Xphase;
+     u8   *D     = gfxs->Aop[0];
+     u8   *S     = gfxs->Bop[0];
+     int   SperD = gfxs->SperD;
+
+     /* no color to key */
+     while (w--) {
+          *D++ = S[i>>16];
+
+          i += SperD;
+     }
+}
+
+static void Bop_yuy2_SKto_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u16   *D     = gfxs->Aop[0];
+     u16   *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+#ifdef WORDS_BIGENDIAN
+     u16    Skey0 = gfxs->Skey >> 16;
+     u16    Skey1 = gfxs->Skey & 0xffff;
+#else
+     u16    Skey0 = gfxs->Skey & 0xffff;
+     u16    Skey1 = gfxs->Skey >> 16;
+#endif
+     int    SperD = gfxs->SperD;
+
+     if ((long)D & 2) {
+          u16 s = *S;
+          if (s != Skey0)
+               *D = s;
+          D++;
+          i = SperD;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          register u32 s;
+
+          s  = ((u32*)S)[i>>17] & 0xff00ff00;
+#ifdef WORDS_BIGENDIAN
+          s |= (S[i>>16]          & 0x00ff) << 16;
+          s |= (S[(i+SperD)>>16]  & 0x00ff);
+#else
+          s |= (S[i>>16]          & 0x00ff);
+          s |= (S[(i+SperD)>>16]  & 0x00ff) << 16;
+#endif
+          if (s != Skey)
+               *((u32*)D) = s;
+          D += 2;
+
+          i += SperD << 1;
+     }
+
+     if (w & 1) {
+          u16 s = S[i>>16];
+          if (i & 0x20000) {
+               if (s != Skey1)
+                    *D = s;
+          } else {
+               if (s != Skey0)
+                    *D = s;
+          }
+     }
+}
+
+static void Bop_8_SKto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    SperD = gfxs->SperD;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          if (s != Skey)
+               *D = s;
+
+          D++;
+          i += SperD;
+     }
+}
+
+static void Bop_uyvy_SKto_Aop( GenefxState *gfxs )
+{
+     int    l;
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u16   *D     = gfxs->Aop[0];
+     u16   *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+#ifdef WORDS_BIGENDIAN
+     u16    Skey0 = gfxs->Skey >> 16;
+     u16    Skey1 = gfxs->Skey & 0xffff;
+#else
+     u16    Skey0 = gfxs->Skey & 0xffff;
+     u16    Skey1 = gfxs->Skey >> 16;
+#endif
+     int    SperD = gfxs->SperD;
+
+     if ((long)D & 2) {
+          u16 s = *S;
+          if (s != Skey0)
+               *D = s;
+          D++;
+          i = SperD;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          register u32 s;
+
+          s  = ((u32*)S)[i>>17] & 0x00ff00ff;
+#ifdef WORDS_BIGENDIAN
+          s |= (S[i>>16]          & 0xff00) << 16;
+          s |= (S[(i+SperD)>>16]  & 0xff00);
+#else
+          s |= (S[i>>16]          & 0xff00);
+          s |= (S[(i+SperD)>>16]  & 0xff00) << 16;
+#endif
+          if (s != Skey)
+               *((u32*)D) = s;
+          D += 2;
+
+          i += SperD << 1;
+     }
+
+     if (w & 1) {
+          u16 s = S[i>>16];
+          if (i & 0x20000) {
+               if (s != Skey1)
+                    *D = s;
+          } else {
+               if (s != Skey0)
+                    *D = s;
+          }
+     }
+}
+
+static void Bop_alut44_SKto_Aop( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     int    i     = gfxs->Xphase;
+     u8    *D     = gfxs->Aop[0];
+     u8    *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     int    SperD = gfxs->SperD;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          if ((s & 0x0f) != Skey)
+               *D = s;
+
+          D++;
+          i += SperD;
+     }
+}
+
+static GenefxFunc Bop_PFI_SKto_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_SKto_Aop,         /* DSPF_ARGB1555 */
+     Bop_16_SKto_Aop,         /* DSPF_RGB16 */
+     Bop_rgb24_SKto_Aop,      /* DSPF_RGB24 */
+     Bop_32_SKto_Aop,         /* DSPF_RGB32 */
+     Bop_32_SKto_Aop,         /* DSPF_ARGB */
+     Bop_a8_SKto_Aop,         /* DSPF_A8 */
+     Bop_yuy2_SKto_Aop,       /* DSPF_YUY2 */
+     Bop_8_SKto_Aop,          /* DSPF_RGB332 */
+     Bop_uyvy_SKto_Aop,       /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     Bop_8_SKto_Aop,          /* DSPF_LUT8 */
+     Bop_alut44_SKto_Aop,     /* DSPF_ALUT44 */
+     Bop_32_SKto_Aop,         /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_SKto_Aop,         /* DSPF_ARGB2554 */
+     Bop_12_SKto_Aop,         /* DSPF_ARGB4444 */
+     Bop_12vv_SKto_Aop,       /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     Bop_32_SKto_Aop,         /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     Bop_rgb18_SKto_Aop,      /* DSPF_ARGB1666 */
+     Bop_rgb18_SKto_Aop,      /* DSPF_ARGB6666 */
+     Bop_rgb18_SKto_Aop,      /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_SKto_Aop,         /* DSPF_RGB444 */
+     Bop_15_SKto_Aop,         /* DSPF_RGB555 */
+     Bop_15_SKto_Aop          /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_StoK_Aop_PFI ***********************/
+
+static GenefxFunc Bop_PFI_StoK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_StoK_Aop,         /* DSPF_ARGB1555 */
+     Bop_16_StoK_Aop,         /* DSPF_RGB16 */
+     NULL,                    /* DSPF_RGB24 */
+     Bop_32_StoK_Aop,         /* DSPF_RGB32 */
+     Bop_32_StoK_Aop,         /* DSPF_ARGB */
+     NULL,                    /* DSPF_A8 */
+     NULL,                    /* DSPF_YUY2 */
+     NULL,                    /* DSPF_RGB332 */
+     NULL,                    /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     NULL,                    /* DSPF_LUT8 */
+     NULL,                    /* DSPF_ALUT44 */
+     Bop_32_StoK_Aop,         /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_StoK_Aop,         /* DSPF_ARGB2554 */
+     Bop_12_StoK_Aop,         /* DSPF_ARGB4444 */
+     Bop_12vv_StoK_Aop,       /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     NULL,                    /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     NULL,                    /* DSPF_ARGB1666 */
+     NULL,                    /* DSPF_ARGB6666 */
+     NULL,                    /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_StoK_Aop,         /* DSPF_RGB444 */
+     Bop_15_StoK_Aop,         /* DSPF_RGB555 */
+     Bop_15_StoK_Aop          /* DSPF_BGR555 */
+};
+
+/********************************* Bop_PFI_SKtoK_Aop_PFI **********************/
+
+static GenefxFunc Bop_PFI_SKtoK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_15_SKtoK_Aop,        /* DSPF_ARGB1555 */
+     Bop_16_SKtoK_Aop,        /* DSPF_RGB16 */
+     NULL,                    /* DSPF_RGB24 */
+     Bop_32_SKtoK_Aop,        /* DSPF_RGB32 */
+     Bop_32_SKtoK_Aop,        /* DSPF_ARGB */
+     NULL,                    /* DSPF_A8 */
+     NULL,                    /* DSPF_YUY2 */
+     NULL,                    /* DSPF_RGB332 */
+     NULL,                    /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     NULL,                    /* DSPF_LUT8 */
+     NULL,                    /* DSPF_ALUT44 */
+     Bop_32_SKtoK_Aop,        /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     Bop_14_SKtoK_Aop,        /* DSPF_ARGB2554 */
+     Bop_12_SKtoK_Aop,        /* DSPF_ARGB4444 */
+     Bop_12vv_SKtoK_Aop,      /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     NULL,                    /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     NULL,                    /* DSPF_ARGB1666 */
+     NULL,                    /* DSPF_ARGB6666 */
+     NULL,                    /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     Bop_12_SKtoK_Aop,        /* DSPF_RGB444 */
+     Bop_15_SKtoK_Aop,        /* DSPF_RGB555 */
+     Bop_15_SKtoK_Aop         /* DSPF_BGR555 */
+};
+
+/********************************* Sop_PFI_Sto_Dacc ***************************/
+
+static void Sop_argb6666_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 b = S[pixelstart+0] & 0x3F;
+          u8 g = ((S[pixelstart+0] & 0xC0) >> 6) | ((S[pixelstart+1] & 0x0F) << 2);
+          u8 r = ((S[pixelstart+1] & 0xF0) >> 4) | ((S[pixelstart+2] & 0x03) << 4);
+          u8 a = (S[pixelstart+2] & 0xFC) >> 2;
+
+          D->RGB.a = EXPAND_6to8( a );
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+          i += SperD;
+          D++;
+     }
+}
+  
+static void Sop_argb1666_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 b = S[pixelstart+0] & 0x3F;
+          u8 g = ((S[pixelstart+0] & 0xC0) >> 6) | ((S[pixelstart+1] & 0x0F) << 2);
+          u8 r = ((S[pixelstart+1] & 0xF0) >> 4) | ((S[pixelstart+2] & 0x03) << 4);
+          u8 a = (S[pixelstart+2] & 0x04) >> 2;
+
+          D->RGB.a = EXPAND_1to8( a );
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+          i += SperD;
+          D++;
+    }
+}
+
+static void Sop_rgb18_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 b = S[pixelstart+0] & 0x3F;
+          u8 g = ((S[pixelstart+0] & 0xC0) >> 6) | ((S[pixelstart+1] & 0x0F) << 2);
+          u8 r = ((S[pixelstart+1] & 0xF0) >> 4) | ((S[pixelstart+2] & 0x03) << 4);
+
+          D->RGB.a = 0xFF;
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+          i += SperD;
+          D++;
+     }
+}
+
+static void Sop_rgb24_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          D->RGB.a = 0xFF;
+          D->RGB.r = S[pixelstart+2];
+          D->RGB.g = S[pixelstart+1];
+          D->RGB.b = S[pixelstart+0];
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_a8_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          D->RGB.a = s;
+          D->RGB.r = 0xFF;
+          D->RGB.g = 0xFF;
+          D->RGB.b = 0xFF;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_yuy2_Sto_Dacc( GenefxState *gfxs )
+{
+     int  w     = gfxs->length>>1;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = S[i>>17];
+
+          D[0].YUV.a = D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+          D[0].YUV.u = D[1].YUV.u = (s & 0xFF000000) >> 24;
+          D[0].YUV.v = D[1].YUV.v = (s & 0x0000FF00) >>  8;
+#else
+          D[0].YUV.u = D[1].YUV.u = (s & 0x0000FF00) >>  8;
+          D[0].YUV.v = D[1].YUV.v = (s & 0xFF000000) >> 24;
+#endif
+          D[0].YUV.y = ((u16*)S)[i>>16]         & 0x00FF;
+          D[1].YUV.y = ((u16*)S)[(i+SperD)>>16] & 0x00FF;
+
+          D += 2;
+          i += SperD << 1;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = ((u16*)S)[i>>17];
+
+          D->YUV.a = 0xFF;
+          D->YUV.y = s & 0xFF;
+          D->YUV.u = s >> 8;
+          D->YUV.v = 0x00;
+     }
+}
+
+static void Sop_rgb332_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          D->RGB.a = 0xFF;
+          D->RGB.r = EXPAND_3to8(s >> 5);
+          D->RGB.g = EXPAND_3to8((s & 0x1C) >> 2);
+          D->RGB.b = EXPAND_2to8(s & 0x03);
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_uyvy_Sto_Dacc( GenefxState *gfxs )
+{
+     int  w     = gfxs->length>>1;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = S[i>>17];
+
+          D[0].YUV.a = D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+          D[0].YUV.u = D[1].YUV.u = (s & 0x00FF0000) >> 16;
+          D[0].YUV.v = D[1].YUV.v = (s & 0x000000FF);
+#else
+          D[0].YUV.u = D[1].YUV.u = (s & 0x000000FF);
+          D[0].YUV.v = D[1].YUV.v = (s & 0x00FF0000) >> 16;
+#endif
+          D[0].YUV.y = (((u16*)S)[i>>16]         & 0xFF00) >> 8;
+          D[1].YUV.y = (((u16*)S)[(i+SperD)>>16] & 0xFF00) >> 8;
+
+          D += 2;
+          i += SperD << 1;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = ((u16*)S)[i>>16];
+
+          D->YUV.a = 0xFF;
+          D->YUV.y = s >> 8;
+          D->YUV.u = s & 0xFF;
+          D->YUV.v = 0x00;
+     }
+}
+
+static void Sop_lut8_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          D->RGB.a = entries[s].a;
+          D->RGB.r = entries[s].r;
+          D->RGB.g = entries[s].g;
+          D->RGB.b = entries[s].b;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_alut44_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          D->RGB.a = s & 0xF0;
+          s &= 0x0F;
+          D->RGB.r = entries[s].r;
+          D->RGB.g = entries[s].g;
+          D->RGB.b = entries[s].b;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_i420_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D  = gfxs->Dacc;
+     u8                *Sy = gfxs->Sop[0];
+     u8                *Su = gfxs->Sop[1];
+     u8                *Sv = gfxs->Sop[2];
+
+     while (w--) {
+          D->YUV.a = 0xFF;
+          D->YUV.y = Sy[i>>16];
+          D->YUV.u = Su[i>>17];
+          D->YUV.v = Sv[i>>17];
+          
+          i += SperD;
+          
+          D++;
+     }
+}
+
+static void Sop_nv12_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D   = gfxs->Dacc;
+     u8                *Sy  = gfxs->Sop[0];
+     u16               *Suv = gfxs->Sop[1];
+     
+     while (w--) {
+          D->YUV.a = 0xFF;
+          D->YUV.y = Sy[i>>16];
+          D->YUV.u = Suv[i>>17] & 0xFF;
+          D->YUV.v = Suv[i>>17] >> 8;
+          
+          i += SperD;
+          
+          D++;
+     }
+} 
+
+static void Sop_nv21_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D   = gfxs->Dacc;
+     u8                *Sy  = gfxs->Sop[0];
+     u16               *Svu = gfxs->Sop[1];
+     
+     while (w--) {
+          D->YUV.a = 0xFF;
+          D->YUV.y = Sy[i>>16];
+          D->YUV.u = Svu[i>>17] >> 8;
+          D->YUV.v = Svu[i>>17] & 0xFF;
+          
+          i += SperD;
+          
+          D++;
+     }
+}
+
+static void Sop_ayuv_Sto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = S[i>>16];
+          
+          D->YUV.a = (s >> 24);
+          D->YUV.y = (s >> 16) & 0xff;
+          D->YUV.u = (s >>  8) & 0xff;
+          D->YUV.v = (s      ) & 0xff;
+
+          i += SperD;
+          
+          D++;
+     }
+}
+
+static GenefxFunc Sop_PFI_Sto_Dacc[DFB_NUM_PIXELFORMATS] = {
+     Sop_argb1555_Sto_Dacc,        /* DSPF_ARGB1555 */
+     Sop_rgb16_Sto_Dacc,           /* DSPF_RGB16 */
+     Sop_rgb24_Sto_Dacc,           /* DSPF_RGB24 */
+     Sop_rgb32_Sto_Dacc,           /* DSPF_RGB32 */
+     Sop_argb_Sto_Dacc,            /* DSPF_ARGB */
+     Sop_a8_Sto_Dacc,              /* DSPF_A8 */
+     Sop_yuy2_Sto_Dacc,            /* DSPF_YUY2 */
+     Sop_rgb332_Sto_Dacc,          /* DSPF_RGB332 */
+     Sop_uyvy_Sto_Dacc,            /* DSPF_UYVY */
+     Sop_i420_Sto_Dacc,            /* DSPF_I420 */
+     Sop_i420_Sto_Dacc,            /* DSPF_YV12 */
+     Sop_lut8_Sto_Dacc,            /* DSPF_LUT8 */
+     Sop_alut44_Sto_Dacc,          /* DSPF_ALUT44 */
+     Sop_airgb_Sto_Dacc,           /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     Sop_nv12_Sto_Dacc,            /* DSPF_NV12 */
+     Sop_nv12_Sto_Dacc,            /* DSPF_NV16 */
+     Sop_argb2554_Sto_Dacc,        /* DSPF_ARGB2554 */
+     Sop_argb4444_Sto_Dacc,        /* DSPF_ARGB4444 */
+     Sop_rgba4444_Sto_Dacc,        /* DSPF_RGBA4444 */
+     Sop_nv21_Sto_Dacc,            /* DSPF_NV21 */
+     Sop_ayuv_Sto_Dacc,            /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     Sop_argb1666_Sto_Dacc,        /* DSPF_ARGB1666 */
+     Sop_argb6666_Sto_Dacc,        /* DSPF_ARGB6666 */
+     Sop_rgb18_Sto_Dacc,           /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sop_xrgb4444_Sto_Dacc,        /* DSPF_RGB444 */
+     Sop_xrgb1555_Sto_Dacc,        /* DSPF_RGB555 */
+     Sop_xbgr1555_Sto_Dacc         /* DSPF_BGR555 */
+};
+
+/********************************* Sop_PFI_SKto_Dacc **************************/
+
+static void Sop_argb6666_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+     u32 Skey = gfxs->Skey;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 s0 = S[pixelstart+0];
+          u8 s1 = S[pixelstart+1];
+          u8 s2 = S[pixelstart+2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+               u8 a = (s2 & 0xFC) >> 2;
+
+               D->RGB.a = EXPAND_6to8( a );
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xFF00;
+
+          i += SperD;
+          D++;
+     }
+}
+
+static void Sop_argb1666_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 s0 = S[pixelstart+0];
+          u8 s1 = S[pixelstart+1];
+          u8 s2 = S[pixelstart+2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+               u8 a = (s2 & 0x04) >> 2;
+
+               D->RGB.a = EXPAND_1to8( a );
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xFF00;
+          i += SperD;
+          D++;
+     }
+}
+
+static void Sop_rgb18_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+     u32  Skey = gfxs->Skey;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 s0 = S[pixelstart+0];
+          u8 s1 = S[pixelstart+1];
+          u8 s2 = S[pixelstart+2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+
+               D->RGB.a = 0xFF;
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xFF00;
+
+          i += SperD;
+          D++;
+     }
+}
+
+static void Sop_rgb24_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          int pixelstart = (i>>16)*3;
+
+          u8 b = S[pixelstart+0];
+          u8 g = S[pixelstart+1];
+          u8 r = S[pixelstart+2];
+
+          if (Skey != (u32)(r<<16 | g<<8 | b)) {
+               D->RGB.a = 0xFF;
+               D->RGB.r = r;
+               D->RGB.g = g;
+               D->RGB.b = b;
+          }
+          else
+               D->RGB.a = 0xFF00;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_a8_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     /* no color to key */
+     while (w--) {
+          u8 s = S[i>>16];
+
+          D->RGB.a = s;
+          D->RGB.r = 0xFF;
+          D->RGB.g = 0xFF;
+          D->RGB.b = 0xFF;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_lut8_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          if (s != Skey) {
+               D->RGB.a = entries[s].a;
+               D->RGB.r = entries[s].r;
+               D->RGB.g = entries[s].g;
+               D->RGB.b = entries[s].b;
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_alut44_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          if ((s & 0x0F) != Skey) {
+               D->RGB.a = ((s & 0xF0) >> 4) | (s & 0xF0);
+               s &= 0x0F;
+               D->RGB.r = entries[s].r;
+               D->RGB.g = entries[s].g;
+               D->RGB.b = entries[s].b;
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_yuy2_SKto_Dacc( GenefxState *gfxs )
+{
+     int   w     = gfxs->length>>1;
+     int   i     = gfxs->Xphase;
+     int   SperD = gfxs->SperD;
+     u32   Ky    = (gfxs->Skey & 0x000000FF);
+#ifdef WORDS_BIGENDIAN
+     u32   Kcb   = (gfxs->Skey & 0xFF000000) >> 24;
+     u32   Kcr   = (gfxs->Skey & 0x0000FF00) >>  8;
+#else
+     u32   Kcb   = (gfxs->Skey & 0x0000FF00) >>  8;
+     u32   Kcr   = (gfxs->Skey & 0xFF000000) >> 24;
+#endif
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = S[i>>17];
+          u32 y0, cb, y1, cr;
+
+#ifdef WORDS_BIGENDIAN
+          cb = (s & 0xFF000000) >> 24;
+          cr = (s & 0x0000FF00) >>  8;
+#else
+          cb = (s & 0x0000FF00) >>  8;
+          cr = (s & 0xFF000000) >> 24;
+#endif
+          y0 = ((u16*)S)[i>>16]         & 0x00FF;
+          y1 = ((u16*)S)[(i+SperD)>>16] & 0x00FF;
+
+          if (y0 != Ky || cb != Kcb || cr != Kcr) {
+               D[0].YUV.a = 0xFF;
+               D[0].YUV.y = y0;
+               D[0].YUV.u = cb;
+               D[0].YUV.v = cr;
+          }
+          else
+               D[0].YUV.a = 0xF000;
+
+          if (y0 != Ky || cb != Kcb || cr != Kcr) {
+               D[1].YUV.a = 0xFF;
+               D[1].YUV.y = y1;
+               D[1].YUV.u = cb;
+               D[1].YUV.v = cr;
+          }
+          else
+               D[1].YUV.a = 0xF000;
+
+          D += 2;
+          i += SperD << 1;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = ((u16*)S)[i>>16];
+
+          if (s != (Ky | (Kcb << 8))) {
+               D->YUV.a = 0xFF;
+               D->YUV.y = s & 0xFF;
+               D->YUV.u = s >> 8;
+               D->YUV.v = 0x00;
+          }
+          else
+               D->YUV.a = 0xF000;
+     }
+}
+
+static void Sop_rgb332_SKto_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     int i     = gfxs->Xphase;
+     int SperD = gfxs->SperD;
+
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u8                 Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 s = S[i>>16];
+
+          if (s != Skey) {
+               D->RGB.a = 0xFF;
+               D->RGB.r = EXPAND_3to8(s >> 5);
+               D->RGB.g = EXPAND_3to8((s & 0x1C) >> 2);
+               D->RGB.b = EXPAND_2to8(s & 0x03);
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          i += SperD;
+
+          D++;
+     }
+}
+
+static void Sop_uyvy_SKto_Dacc( GenefxState *gfxs )
+{
+     int   w     = gfxs->length>>1;
+     int   i     = gfxs->Xphase;
+     int   SperD = gfxs->SperD;
+     u32 Ky      = (gfxs->Skey & 0x0000FF00) >>  8;
+#ifdef WORDS_BIGENDIAN
+     u32 Kcb     = (gfxs->Skey & 0x00FF0000) >> 16;
+     u32 Kcr     = (gfxs->Skey & 0x000000FF);
+#else
+     u32 Kcb     = (gfxs->Skey & 0x000000FF);
+     u32 Kcr     = (gfxs->Skey & 0x00FF0000) >> 16;
+#endif
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = S[i>>17];
+          u32 cb, y0, cr, y1;
+
+#ifdef WORDS_BIGENDIAN
+          cb = (s & 0x00FF0000) >> 16;
+          cr = (s & 0x000000FF);
+#else
+          cb = (s & 0x000000FF);
+          cr = (s & 0x00FF0000) >> 16;
+#endif
+          y0 = (((u16*)S)[i>>16]         & 0xFF00) >> 8;
+          y1 = (((u16*)S)[(i+SperD)>>16] & 0xFF00) >> 8;
+
+          if (y0 != Ky || cb != Kcb || cr != Kcr) {
+               D[0].YUV.a = 0xFF;
+               D[0].YUV.y = y0;
+               D[0].YUV.u = cb;
+               D[0].YUV.v = cr;
+          }
+          else
+              D[0].YUV.a = 0xF000;
+
+          if (y0 != Ky || cb != Kcb || cr != Kcr) {
+               D[1].YUV.a = 0xFF;
+               D[1].YUV.y = y1;
+               D[1].YUV.u = cb;
+               D[1].YUV.v = cr;
+          }
+          else
+               D[1].YUV.a = 0xF000;
+
+          D += 2;
+          i += SperD << 1;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = ((u16*)S)[i>>16];
+
+          if (s != (Kcb | (Ky << 8))) {
+               D->YUV.a = 0xFF;
+               D->YUV.y = s >> 8;
+               D->YUV.u = s & 0xFF;
+               D->YUV.v = 0x00;
+          }
+          else
+               D->YUV.a = 0xF000;
+     }
+}
+
+static GenefxFunc Sop_PFI_SKto_Dacc[DFB_NUM_PIXELFORMATS] = {
+     Sop_argb1555_SKto_Dacc,       /* DSPF_ARGB1555 */
+     Sop_rgb16_SKto_Dacc,          /* DSPF_RGB16 */
+     Sop_rgb24_SKto_Dacc,          /* DSPF_RGB24 */
+     Sop_rgb32_SKto_Dacc,          /* DSPF_RGB32 */
+     Sop_argb_SKto_Dacc,           /* DSPF_ARGB */
+     Sop_a8_SKto_Dacc,             /* DSPF_A8 */
+     Sop_yuy2_SKto_Dacc,           /* DSPF_YUY2 */
+     Sop_rgb332_SKto_Dacc,         /* DSPF_RGB332 */
+     Sop_uyvy_SKto_Dacc,           /* DSPF_UYVY */
+     NULL,                         /* DSPF_I420 */
+     NULL,                         /* DSPF_YV12 */
+     Sop_lut8_SKto_Dacc,           /* DSPF_LUT8 */
+     Sop_alut44_SKto_Dacc,         /* DSPF_ALUT44 */
+     Sop_airgb_SKto_Dacc,          /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     NULL,                         /* DSPF_NV12 */
+     NULL,                         /* DSPF_NV16 */
+     Sop_argb2554_SKto_Dacc,       /* DSPF_ARGB2554 */
+     Sop_argb4444_SKto_Dacc,       /* DSPF_ARGB4444 */
+     Sop_rgba4444_SKto_Dacc,       /* DSPF_RGBA4444 */
+     NULL,                         /* DSPF_NV21 */
+     NULL,                         /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     Sop_argb1666_SKto_Dacc,       /* DSPF_ARGB1666 */
+     Sop_argb6666_SKto_Dacc,       /* DSPF_ARGB6666 */
+     Sop_rgb18_SKto_Dacc,          /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sop_xrgb4444_SKto_Dacc,       /* DSPF_RGB444 */
+     Sop_xrgb1555_SKto_Dacc,       /* DSPF_RGB555 */
+     Sop_xbgr1555_SKto_Dacc        /* DSPF_BGR555 */
+};
+
+/********************************* Sop_PFI_to_Dacc ****************************/
+
+static void Sop_argb6666_to_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 b = S[0] & 0x3F;
+          u8 g = ((S[0] & 0xC0) >> 6) | ((S[1] & 0x0F) << 2);
+          u8 r = ((S[1] & 0xF0) >> 4) | ((S[2] & 0x03) << 4);
+          u8 a = (S[2] & 0xFC) >> 2;
+
+          D->RGB.a = EXPAND_6to8( a );
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+
+          S +=3;
+          D++;
+     }
+}
+
+static void Sop_argb1666_to_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 b = S[0] & 0x3F;
+          u8 g = ((S[0] & 0xC0) >> 6) | ((S[1] & 0x0F) << 2);
+          u8 r = ((S[1] & 0xF0) >> 4) | ((S[2] & 0x03) << 4);
+          u8 a = (S[2] & 0x04) >> 2;
+
+          D->RGB.a = EXPAND_1to8( a );
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+
+          S +=3;
+          D++;
+     }
+}
+
+static void Sop_rgb18_to_Dacc( GenefxState *gfxs )
+{
+     int w     = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 b = S[0] & 0x3F;
+          u8 g = ((S[0] & 0xC0) >> 6) | ((S[1] & 0x0F) << 2);
+          u8 r = ((S[1] & 0xF0) >> 4) | ((S[2] & 0x03) << 4);
+
+          D->RGB.a = 0xFF;
+          D->RGB.r = EXPAND_6to8( r );
+          D->RGB.g = EXPAND_6to8( g );
+          D->RGB.b = EXPAND_6to8( b );
+
+          S +=3;
+          D++;
+     }
+}
+
+static void Sop_rgb24_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          D->RGB.a = 0xFF;
+          D->RGB.b = *S++;
+          D->RGB.g = *S++;
+          D->RGB.r = *S++;
+
+          D++;
+     }
+}
+
+static void Sop_a8_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          D->RGB.a = *S++;
+          D->RGB.r = 0xFF;
+          D->RGB.g = 0xFF;
+          D->RGB.b = 0xFF;
+
+          D++;
+     }
+}
+
+static void Sop_a4_to_Dacc( GenefxState *gfxs )
+{
+     int                i, n;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     for (i=0, n=0; i<gfxs->length; i+=2, n++) {
+          register int left  = S[n] & 0xF0;
+          register int right = S[n] & 0x0F;
+
+          D[i].RGB.a = left | (left >> 4);
+          D[i].RGB.r = 0xFF;
+          D[i].RGB.g = 0xFF;
+          D[i].RGB.b = 0xFF;
+
+          D[i+1].RGB.a = right | (right << 4);
+          D[i+1].RGB.r = 0xFF;
+          D[i+1].RGB.g = 0xFF;
+          D[i+1].RGB.b = 0xFF;
+     }
+}
+
+static void Sop_yuy2_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length>>1;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = *S++;
+
+          D[0].YUV.a = D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+          D[0].YUV.y =              (s & 0x00FF0000) >> 16;
+          D[1].YUV.y =              (s & 0x000000FF);
+          D[0].YUV.u = D[1].YUV.u = (s & 0xFF000000) >> 24;
+          D[0].YUV.v = D[1].YUV.v = (s & 0x0000FF00) >>  8;
+#else
+          D[0].YUV.y =              (s & 0x000000FF);
+          D[1].YUV.y =              (s & 0x00FF0000) >> 16;
+          D[0].YUV.u = D[1].YUV.u = (s & 0x0000FF00) >>  8;
+          D[0].YUV.v = D[1].YUV.v = (s & 0xFF000000) >> 24;
+#endif
+
+          D += 2;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = *((u16*)S);
+
+          D->YUV.a = 0xFF;
+          D->YUV.y = s & 0xFF;
+          D->YUV.u = s >> 8;
+          D->YUV.v = 0x00;
+     }
+}
+
+static void Sop_rgb332_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     while (w--) {
+          u8 s = *S++;
+
+          D->RGB.a = 0xFF;
+          D->RGB.r = EXPAND_3to8(s >> 5);
+          D->RGB.g = EXPAND_3to8((s & 0x1C) >> 2);
+          D->RGB.b = EXPAND_2to8(s & 0x03);
+
+          D++;
+     }
+}
+
+static void Sop_uyvy_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length>>1;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = *S++;
+
+          D[0].YUV.a = D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+          D[0].YUV.y =              (s & 0xFF000000) >> 24;
+          D[1].YUV.y =              (s & 0x0000FF00) >> 8;
+          D[0].YUV.u = D[1].YUV.u = (s & 0x00FF0000) >> 16;
+          D[0].YUV.v = D[1].YUV.v = (s & 0x000000FF);
+#else
+          D[0].YUV.y =              (s & 0x0000FF00) >> 8;
+          D[1].YUV.y =              (s & 0xFF000000) >> 24;
+          D[0].YUV.u = D[1].YUV.u = (s & 0x000000FF);
+          D[0].YUV.v = D[1].YUV.v = (s & 0x00FF0000) >> 16;
+#endif
+
+          D += 2;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = *((u16*)S);
+
+          D->YUV.a = 0xFF;
+          D->YUV.y = s >> 8;
+          D->YUV.u = s & 0xFF;
+          D->YUV.v = 0x00;
+     }
+}
+
+static void Sop_lut8_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = *S++;
+
+          D->RGB.a = entries[s].a;
+          D->RGB.r = entries[s].r;
+          D->RGB.g = entries[s].g;
+          D->RGB.b = entries[s].b;
+
+          D++;
+     }
+}
+
+static void Sop_alut44_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = *S++;
+
+          D->RGB.a = s & 0xF0;
+          s &= 0x0F;
+          D->RGB.r = entries[s].r;
+          D->RGB.g = entries[s].g;
+          D->RGB.b = entries[s].b;
+
+          D++;
+     }
+}
+
+static void Sop_i420_to_Dacc( GenefxState *gfxs )
+{
+     int                w  = gfxs->length>>1;
+     GenefxAccumulator *D  = gfxs->Dacc;
+     u8                *Sy = gfxs->Sop[0];
+     u8                *Su = gfxs->Sop[1];
+     u8                *Sv = gfxs->Sop[2];
+     
+     while (w--) {
+          D[1].YUV.a = D[0].YUV.a = 0xFF;
+          D[0].YUV.y = Sy[0];
+          D[1].YUV.y = Sy[1];
+          D[1].YUV.u = D[0].YUV.u = Su[0];
+          D[1].YUV.v = D[0].YUV.v = Sv[0];
+          
+          Sy += 2;
+          Su++;
+          Sv++;
+          
+          D += 2;
+     }
+}
+
+static void Sop_nv12_to_Dacc( GenefxState *gfxs )
+{
+     int                w   = gfxs->length>>1;
+     GenefxAccumulator *D   = gfxs->Dacc;
+     u8                *Sy  = gfxs->Sop[0];
+     u16               *Suv = gfxs->Sop[1];
+     
+     while (w--) {  
+          D[1].YUV.a = D[0].YUV.a = 0xFF;
+          D[0].YUV.y = Sy[0];
+          D[1].YUV.y = Sy[1];
+          D[1].YUV.u = D[0].YUV.u = Suv[0] & 0xFF;
+          D[1].YUV.v = D[0].YUV.v = Suv[0] >> 8;
+          
+          Sy += 2;
+          Suv++;
+          
+          D += 2;
+     }
+}
+
+static void Sop_nv21_to_Dacc( GenefxState *gfxs )
+{
+     int                w   = gfxs->length>>1;
+     GenefxAccumulator *D   = gfxs->Dacc;
+     u8                *Sy  = gfxs->Sop[0];
+     u16               *Svu = gfxs->Sop[1];
+     
+     while (w--) {  
+          D[1].YUV.a = D[0].YUV.a = 0xFF;
+          D[0].YUV.y = Sy[0];
+          D[1].YUV.y = Sy[1];
+          D[1].YUV.u = D[0].YUV.u = Svu[0] >> 8;
+          D[1].YUV.v = D[0].YUV.v = Svu[0] & 0xFF;
+          
+          Sy += 2;
+          Svu++;
+          
+          D += 2;
+     }
+}
+
+static void Sop_ayuv_to_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u32               *S = gfxs->Sop[0];
+
+     while (w--) {
+          u32 s = *S++;
+
+          D->YUV.a = (s >> 24);
+          D->YUV.y = (s >> 16) & 0xff;
+          D->YUV.u = (s >>  8) & 0xff;
+          D->YUV.v = (s      ) & 0xff;
+
+          D++;
+     }
+}
+
+static GenefxFunc Sop_PFI_to_Dacc[DFB_NUM_PIXELFORMATS] = {
+     Sop_argb1555_to_Dacc,         /* DSPF_ARGB1555 */
+     Sop_rgb16_to_Dacc,            /* DSPF_RGB16 */
+     Sop_rgb24_to_Dacc,            /* DSPF_RGB24 */
+     Sop_rgb32_to_Dacc,            /* DSPF_RGB32 */
+     Sop_argb_to_Dacc,             /* DSPF_ARGB */
+     Sop_a8_to_Dacc,               /* DSPF_A8 */
+     Sop_yuy2_to_Dacc,             /* DSPF_YUY2 */
+     Sop_rgb332_to_Dacc,           /* DSPF_RGB332 */
+     Sop_uyvy_to_Dacc,             /* DSPF_UYVY */
+     Sop_i420_to_Dacc,             /* DSPF_I420 */
+     Sop_i420_to_Dacc,             /* DSPF_YV12 */
+     Sop_lut8_to_Dacc,             /* DSPF_LUT8 */
+     Sop_alut44_to_Dacc,           /* DSPF_ALUT44 */
+     Sop_airgb_to_Dacc,            /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     Sop_nv12_to_Dacc,             /* DSPF_NV12 */
+     Sop_nv12_to_Dacc,             /* DSPF_NV16 */
+     Sop_argb2554_to_Dacc,         /* DSPF_ARGB2554 */
+     Sop_argb4444_to_Dacc,         /* DSPF_ARGB4444 */
+     Sop_rgba4444_to_Dacc,         /* DSPF_RGBA4444 */
+     Sop_nv21_to_Dacc,             /* DSPF_NV21 */
+     Sop_ayuv_to_Dacc,             /* DSPF_AYUV */
+     Sop_a4_to_Dacc,               /* DSPF_A4 */
+     Sop_argb1666_to_Dacc,         /* DSPF_ARGB1666 */
+     Sop_argb6666_to_Dacc,         /* DSPF_ARGB6666 */
+     Sop_rgb18_to_Dacc,            /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sop_xrgb4444_to_Dacc,         /* DSPF_RGB444 */
+     Sop_xrgb1555_to_Dacc,         /* DSPF_RGB555 */
+     Sop_xbgr1555_to_Dacc,         /* DSPF_BGR555 */
+};
+
+/********************************* Sop_PFI_Kto_Dacc ***************************/
+
+static void Sop_argb6666_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 s0 = S[0];
+          u8 s1 = S[1];
+          u8 s2 = S[2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+               u8 a = (s2 & 0xFC) >> 2;
+
+               D->RGB.a = EXPAND_6to8( a );
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          S += 3;
+          D++;
+     }
+}
+
+static void Sop_argb1666_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 s0 = S[0];
+          u8 s1 = S[1];
+          u8 s2 = S[2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3FFFF)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+               u8 a = (s2 & 0x04) >> 2;
+
+               D->RGB.a = EXPAND_1to8( a );
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          S += 3;
+          D++;
+     }
+}
+
+static void Sop_rgb18_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 s0 = S[0];
+          u8 s1 = S[1];
+          u8 s2 = S[2];
+
+          if (Skey != ((u32)(s2<<16 | s1<<8 | s0) & 0x3ffff)) {
+               u8 b = s0 & 0x3F;
+               u8 g = ((s0 & 0xC0) >> 6) | ((s1 & 0x0F) << 2);
+               u8 r = ((s1 & 0xF0) >> 4) | ((s2 & 0x03) << 4);
+
+               D->RGB.a = 0xFF;
+               D->RGB.r = EXPAND_6to8( r );
+               D->RGB.g = EXPAND_6to8( g );
+               D->RGB.b = EXPAND_6to8( b );
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          S += 3;
+          D++;
+     }
+}
+
+static void Sop_rgb24_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 b = *S++;
+          u8 g = *S++;
+          u8 r = *S++;
+
+          if (Skey != (u32)(r<<16 | g<<8 | b)) {
+               D->RGB.a = 0xFF;
+               D->RGB.r = r;
+               D->RGB.g = g;
+               D->RGB.b = b;
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+     }
+}
+
+static void Sop_a8_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     u8                *S = gfxs->Sop[0];
+
+     /* no color to key */
+     while (w--) {
+          D->RGB.a = *S++;
+          D->RGB.r = 0xFF;
+          D->RGB.g = 0xFF;
+          D->RGB.b = 0xFF;
+
+          D++;
+     }
+}
+
+static void Sop_yuy2_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w     = gfxs->length>>1;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     u32               *S     = gfxs->Sop[0];
+     u32                Skey  = gfxs->Skey;
+     u32                Skey0 = gfxs->Skey & 0xFF00FFFF;
+     u32                Skey1 = gfxs->Skey & 0xFFFFFF00;
+
+#ifdef WORDS_BIGENDIAN
+#define S0_MASK  0xFFFFFF00
+#define S1_MASK  0xFF00FFFF
+#else
+#define S0_MASK  0xFF00FFFF
+#define S1_MASK  0xFFFFFF00
+#endif
+
+     while (w--) {
+          u32 s = *S++;
+
+          if (s != Skey) {
+               u32 cb, cr;
+
+#ifdef WORDS_BIGENDIAN
+               cb = (s & 0xFF000000) >> 24;
+               cr = (s & 0x0000FF00) >>  8;
+#else
+               cb = (s & 0x0000FF00) >>  8;
+               cr = (s & 0xFF000000) >> 24;
+#endif
+
+               if ((s & S0_MASK) != Skey0) {
+                    D[0].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+                    D[0].YUV.y = (s & 0x00FF0000) >> 16;
+#else
+                    D[0].YUV.y = (s & 0x000000FF);
+#endif
+                    D[0].YUV.u = cb;
+                    D[0].YUV.v = cr;
+               }
+               else
+                    D[0].YUV.a = 0xF000;
+
+               if ((s & S1_MASK) != Skey1) {
+                    D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+                    D[1].YUV.y = (s & 0x000000FF);
+#else
+                    D[1].YUV.y = (s & 0x00FF0000) >> 16;
+#endif
+                    D[1].YUV.u = cb;
+                    D[1].YUV.v = cr;
+               }
+               else
+                    D[1].YUV.a = 0xF000;
+          }
+
+          D += 2;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = *((u16*)S);
+
+          if (s != Skey0) {
+               D->YUV.a = 0xFF;
+               D->YUV.y = s & 0xFF;
+               D->YUV.u = s >> 8;
+               D->YUV.v = 0x00;
+          }
+          else
+               D->YUV.a = 0xF000;
+     }
+#undef S0_MASK
+#undef S1_MASK
+}
+
+static void Sop_rgb332_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     while (w--) {
+          u8 s = *S++;
+
+          if (s != Skey) {
+               D->RGB.a = 0xFF;
+               D->RGB.r = EXPAND_3to8(s >> 5);
+               D->RGB.g = EXPAND_3to8((s & 0x1C) >> 2);
+               D->RGB.b = EXPAND_2to8(s & 0x03);
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+     }
+}
+
+static void Sop_uyvy_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w     = gfxs->length>>1;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     u32               *S     = gfxs->Sop[0];
+     u32                Skey  = gfxs->Skey;
+     u32                Skey0 = gfxs->Skey & 0x00FFFFFF;
+     u32                Skey1 = gfxs->Skey & 0xFFFF00FF;
+
+#ifdef WORDS_BIGENDIAN
+#define S0_MASK 0xFFFF00FF
+#define S1_MASK 0x00FFFFFF
+#else
+#define S0_MASK 0x00FFFFFF
+#define S1_MASK 0xFFFF00FF
+#endif
+
+     while (w--) {
+          u32 s = *S++;
+
+          if (s != Skey) {
+               u32 cb, cr;
+
+#ifdef WORDS_BIGENDIAN
+               cb = (s & 0x00FF0000) >> 16;
+               cr = (s & 0x000000FF);
+#else
+               cb = (s & 0x000000FF);
+               cr = (s & 0x00FF0000) >> 16;
+#endif
+
+               if ((s & S0_MASK) != Skey0) {
+                    D[0].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+                    D[0].YUV.y = (s & 0xFF000000) >> 24;
+#else
+                    D[0].YUV.y = (s & 0x0000FF00) >>  8;
+#endif
+                    D[0].YUV.u = cb;
+                    D[0].YUV.v = cr;
+               }
+               else
+                    D[0].YUV.a = 0xF000;
+
+               if ((s & S1_MASK) != Skey1) {
+                    D[1].YUV.a = 0xFF;
+#ifdef WORDS_BIGENDIAN
+                    D[1].YUV.y = (s & 0x0000FF00) >> 8;
+#else
+                    D[1].YUV.y = (s & 0xFF000000) >>24;
+#endif
+                    D[1].YUV.u = cb;
+                    D[1].YUV.v = cr;
+               }
+               else
+                    D[1].YUV.a = 0xF000;
+          }
+
+          D += 2;
+     }
+
+     if (gfxs->length & 1) {
+          u16 s = *((u16*)S);
+
+          if (s != Skey0) {
+               D->YUV.a = 0xFF;
+               D->YUV.y = s >> 8;
+               D->YUV.u = s & 0xFF;
+               D->YUV.v = 0x00;
+          }
+          else
+               D->YUV.a = 0xF000;
+     }
+#undef S0_MASK
+#undef S1_MASK
+}
+
+static void Sop_lut8_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = *S++;
+
+          if (s != Skey) {
+               D->RGB.a = entries[s].a;
+               D->RGB.r = entries[s].r;
+               D->RGB.g = entries[s].g;
+               D->RGB.b = entries[s].b;
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+     }
+}
+
+static void Sop_alut44_Kto_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u8                *S    = gfxs->Sop[0];
+     u32                Skey = gfxs->Skey;
+
+     DFBColor *entries = gfxs->Slut->entries;
+
+     while (w--) {
+          u8 s = *S++;
+
+          if ((s & 0x0F) != Skey) {
+               D->RGB.a = ((s & 0xF0) >> 4) | (s & 0xF0);
+               s &= 0x0F;
+               D->RGB.r = entries[s].r;
+               D->RGB.g = entries[s].g;
+               D->RGB.b = entries[s].b;
+          }
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+     }
+}
+
+static GenefxFunc Sop_PFI_Kto_Dacc[DFB_NUM_PIXELFORMATS] = {
+     Sop_argb1555_Kto_Dacc,        /* DSPF_ARGB1555 */
+     Sop_rgb16_Kto_Dacc,           /* DSPF_RGB16 */
+     Sop_rgb24_Kto_Dacc,           /* DSPF_RGB24 */
+     Sop_rgb32_Kto_Dacc,           /* DSPF_RGB32 */
+     Sop_argb_Kto_Dacc,            /* DSPF_ARGB */
+     Sop_a8_Kto_Dacc,              /* DSPF_A8 */
+     Sop_yuy2_Kto_Dacc,            /* DSPF_YUY2 */
+     Sop_rgb332_Kto_Dacc,          /* DSPF_RGB332 */
+     Sop_uyvy_Kto_Dacc,            /* DSPF_UYVY */
+     NULL,                         /* DSPF_I420 */
+     NULL,                         /* DSPF_YV12 */
+     Sop_lut8_Kto_Dacc,            /* DSPF_LUT8 */
+     Sop_alut44_Kto_Dacc,          /* DSPF_ALUT44 */
+     Sop_airgb_Kto_Dacc,           /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     NULL,                         /* DSPF_NV12 */
+     NULL,                         /* DSPF_NV16 */
+     Sop_argb2554_Kto_Dacc,        /* DSPF_ARGB2554 */
+     Sop_argb4444_Kto_Dacc,        /* DSPF_ARGB4444 */
+     Sop_rgba4444_Kto_Dacc,        /* DSPF_RGBA4444 */
+     NULL,                         /* DSPF_NV21 */
+     NULL,                         /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     Sop_argb6666_Kto_Dacc,        /* DSPF_ARGB1666 */
+     Sop_argb1666_Kto_Dacc,        /* DSPF_ARGB6666 */
+     Sop_rgb18_Kto_Dacc,           /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sop_xrgb4444_Kto_Dacc,        /* DSPF_RGB444 */
+     Sop_xrgb1555_Kto_Dacc,        /* DSPF_RGB555 */
+     Sop_xbgr1555_Kto_Dacc,        /* DSPF_BGR555 */
+};
+
+/********************************* Sacc_to_Aop_PFI ****************************/
+
+static void Sacc_to_Aop_argb6666( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_ARGB6666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_argb1666( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_ARGB1666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_rgb18( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_RGB18( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_rgb24( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               *D++ = (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b;
+               *D++ = (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g;
+               *D++ = (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r;
+          }
+          else
+               D += 3;
+
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_a8( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000))
+               *D = (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a;
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_yuy2( GenefxState *gfxs )
+{
+     int                l;
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u16               *D = gfxs->Aop[0];
+
+     if ((long)D & 2) {
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.v & 0xFF00) ? 0XFF00 : (S->YUV.v<<8));
+          }
+          S++;
+          D++;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+               u32 y0, cb, y1, cr;
+
+               y0 = (S[0].YUV.y & 0xFF00) ? 0xFF : S[0].YUV.y;
+               y1 = (S[1].YUV.y & 0xFF00) ? 0xFF : S[1].YUV.y;
+
+               cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+               if (cb & 0xFF00)
+                    cb = 0xFF;
+
+               cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+               if (cr & 0xFF00)
+                    cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+               *((u32*)D) = y1 | (cr << 8) | (y0 << 16) | (cb << 24);
+#else
+               *((u32*)D) = y0 | (cb << 8) | (y1 << 16) | (cr << 24);
+#endif
+          }
+          else if (!(S[0].YUV.a & 0xF000)) {
+               D[0] = ((S[0].YUV.y & 0xFF00) ? 0x00FF :  S[0].YUV.y) |
+                      ((S[0].YUV.u & 0xFF00) ? 0xFF00 : (S[0].YUV.u<<8));
+          }
+          else if (!(S[1].YUV.a & 0xF000)) {
+               D[1] = ((S[1].YUV.y & 0xFF00) ? 0x00FF :  S[1].YUV.y) |
+                      ((S[1].YUV.v & 0xFF00) ? 0xFF00 : (S[1].YUV.v<<8));
+          }
+
+          D += 2;
+          S += 2;
+     }
+
+     if (w & 1) {
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.u & 0xFF00) ? 0xFF00 : (S->YUV.u<<8));
+          }
+     }
+}
+
+static void Sacc_to_Aop_rgb332( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               *D = PIXEL_RGB332( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                  (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                  (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_uyvy( GenefxState *gfxs )
+{
+     int                l;
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u16               *D = gfxs->Aop[0];
+
+     if ((long)D & 2) {
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.v & 0xFF00) ? 0x00FF :  S->YUV.v)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+          S++;
+          D++;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+               u32 cb, y0, cr, y1;
+
+               y0 = (S[0].YUV.y & 0xFF00) ? 0xFF : S[0].YUV.y;
+               y1 = (S[1].YUV.y & 0xFF00) ? 0xFF : S[1].YUV.y;
+
+               cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+               if (cb & 0xFF00)
+                    cb = 0xFF;
+
+               cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+               if (cr & 0xFF00)
+                    cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+               *((u32*)D) = cr | (y1 << 8) | (cb << 16) | (y0 << 24);
+#else
+               *((u32*)D) = cb | (y0 << 8) | (cr << 16) | (y1 << 24);
+#endif
+          }
+          else if (!(S[0].YUV.a & 0xF000)) {
+               D[0] = ((S[0].YUV.u & 0xFF00) ? 0x00FF :  S[0].YUV.u) |
+                      ((S[0].YUV.y & 0xFF00) ? 0xFF00 : (S[0].YUV.y<<8));
+          }
+          else if (!(S[1].YUV.a & 0xF000)) {
+               D[1] = ((S[1].YUV.v & 0xFF00) ? 0x00FF :  S[1].YUV.v) |
+                      ((S[1].YUV.y & 0xFF00) ? 0xFF00 : (S[1].YUV.y<<8));
+          }
+
+          D += 2;
+          S += 2;
+     }
+
+     if (w & 1) {
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.u & 0xFF00) ? 0x00FF :  S->YUV.u)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+     }
+}
+
+static void Sacc_to_Aop_lut8( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               *D = dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_alut44( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000)) {
+               *D = (S->RGB.a & 0xFF00) ? 0xF0 : (S->RGB.a & 0xF0) +
+                    dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        0x80 );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_i420( GenefxState *gfxs )
+{
+     int                w  = gfxs->length;
+     GenefxAccumulator *S  = gfxs->Sacc;
+     u8                *Dy = gfxs->Aop[0];
+    
+     while (w--) {
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          S++;
+          Dy++;
+     }
+          
+     if (gfxs->AopY & 1) {
+          u8 *Du = gfxs->Aop[1];
+          u8 *Dv = gfxs->Aop[2];
+          
+          w = gfxs->length>>1;
+          S = gfxs->Sacc;
+          
+          while (w--) {
+               if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+                    u32 tmp;
+
+                    tmp = (S[0].YUV.u + S[1].YUV.u) >> 1;
+                    if (tmp & 0xFF00)
+                         tmp = 0xFF;
+                    *Du = tmp;
+
+                    tmp = (S[0].YUV.v + S[1].YUV.v) >> 1;
+                    if (tmp & 0xFF00)
+                         tmp = 0xFF;
+                    *Dv = tmp;
+               
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    *Du = (*Du + ((S[0].YUV.u & 0xFF00) ? 0xFF : S[0].YUV.u)) >> 1;
+                    *Dv = (*Dv + ((S[0].YUV.v & 0xFF00) ? 0xFF : S[0].YUV.v)) >> 1;
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    *Du = (*Du + ((S[1].YUV.u & 0xFF00) ? 0xFF : S[1].YUV.u)) >> 1;
+                    *Dv = (*Dv + ((S[1].YUV.v & 0xFF00) ? 0xFF : S[1].YUV.v)) >> 1;
+               }
+
+               S  += 2;
+               Du++;
+               Dv++;
+          }
+     }
+}
+
+static void Sacc_to_Aop_nv12( GenefxState *gfxs )
+{
+     int                w  = gfxs->length;
+     GenefxAccumulator *S  = gfxs->Sacc;
+     u8                *Dy = gfxs->Aop[0];
+     
+     while (w--) {
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          S++;
+          Dy++;
+     }
+          
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          u16 *Duv = gfxs->Aop[1];
+          
+          w = gfxs->length>>1;
+          S = gfxs->Sacc;
+          
+          while (w--) {
+               u32 cb, cr;
+               
+               if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+                    cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+                         
+#ifdef WORDS_BIGENDIAN
+                    *Duv = cr | (cb << 8);
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    cb = ((*Duv >> 8)   + ((S[0].YUV.u & 0xFF00) ? 0xFF : S[0].YUV.u)) >> 1;
+                    cr = ((*Duv & 0xFF) + ((S[0].YUV.v & 0xFF00) ? 0xFF : S[0].YUV.v)) >> 1;
+                    *Duv = cr | (cb << 8);
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    cb = ((*Duv >> 8)   + ((S[1].YUV.u & 0xFF00) ? 0xFF : S[1].YUV.u)) >> 1;
+                    cr = ((*Duv & 0xFF) + ((S[1].YUV.v & 0xFF00) ? 0xFF : S[1].YUV.v)) >> 1;
+                    *Duv = cr | (cb << 8);
+               }
+#else
+                    *Duv = cb | (cr << 8);
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    cb = ((*Duv & 0xFF) + ((S[0].YUV.u & 0xFF00) ? 0xFF : S[0].YUV.u)) >> 1;
+                    cr = ((*Duv >> 8)   + ((S[0].YUV.v & 0xFF00) ? 0xFF : S[0].YUV.v)) >> 1;
+                    *Duv = cb | (cr << 8);
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    cb = ((*Duv & 0xFF) + ((S[1].YUV.u & 0xFF00) ? 0xFF : S[1].YUV.u)) >> 1;
+                    cr = ((*Duv >> 8)   + ((S[1].YUV.v & 0xFF00) ? 0xFF : S[1].YUV.v)) >> 1;
+                    *Duv = cb | (cr << 8);
+               }
+#endif
+               
+               S += 2;
+               Duv++;
+          }
+     }
+}
+
+static void Sacc_to_Aop_nv21( GenefxState *gfxs )
+{
+     int                w  = gfxs->length;
+     GenefxAccumulator *S  = gfxs->Sacc;
+     u8                *Dy = gfxs->Aop[0];
+     
+     while (w--) {
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          S++;
+          Dy++;
+     }
+          
+     if (gfxs->AopY & 1) {
+          u16 *Dvu = gfxs->Aop[1];
+          
+          w = gfxs->length>>1;
+          S = gfxs->Sacc;
+          
+          while (w--) {
+               u32 cb, cr;
+               
+               if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+                    cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+                         
+                    *Dvu = cr | (cb << 8);
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    cb = ((*Dvu >> 8)   + ((S[0].YUV.u & 0xFF00) ? 0xFF : S[0].YUV.u)) >> 1;
+                    cr = ((*Dvu & 0xFF) + ((S[0].YUV.v & 0xFF00) ? 0xFF : S[0].YUV.v)) >> 1;
+                    *Dvu = cr | (cb << 8);
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    cb = ((*Dvu >> 8)   + ((S[1].YUV.u & 0xFF00) ? 0xFF : S[1].YUV.u)) >> 1;
+                    cr = ((*Dvu & 0xFF) + ((S[1].YUV.v & 0xFF00) ? 0xFF : S[1].YUV.v)) >> 1;
+                    *Dvu = cr | (cb << 8);
+               }
+               
+               S += 2;
+               Dvu++;
+          }
+     }
+}
+
+static void Sacc_to_Aop_ayuv( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u32               *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S->YUV.a & 0xF000)) {
+               *D = PIXEL_AYUV( (S->YUV.a & 0xFF00) ? 0xFF : S->YUV.a,
+                                (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
+                                (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u,
+                                (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_to_Aop_a4( GenefxState *gfxs )
+{
+     int                w = gfxs->length>>1;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     while (w--) {
+          if (!(S[0].RGB.a & 0xF000) && !(S[1].RGB.a & 0xF000)) {
+               *D = ((S[0].RGB.a & 0xFF00) ? 0xF0 : (S[0].RGB.a & 0xF0)) |
+                    ((S[1].RGB.a & 0XFF00) ? 0x0F : (S[1].RGB.a >> 4));
+          }
+          else if (!(S[0].RGB.a & 0xF000)) {
+               *D = (*D & 0x0F) | ((S[0].RGB.a & 0xFF00) ? 0xF0 : (S[0].RGB.a & 0xF0));
+          }
+          else if (!(S[1].RGB.a & 0xF000)) {
+               *D = (*D & 0xF0) | ((S[1].RGB.a & 0XFF00) ? 0x0F : (S[1].RGB.a >> 4));
+          }
+
+          D++;
+          S += 2;
+     }
+
+     if (gfxs->length & 1) {
+          if (!(S->RGB.a & 0xF000))
+               *D = (*D & 0x0F) | ((S->RGB.a & 0xFF00) ? 0xF0 : (S->RGB.a & 0xF0));
+     }
+}
+
+static GenefxFunc Sacc_to_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Sacc_to_Aop_argb1555,         /* DSPF_ARGB1555 */
+     Sacc_to_Aop_rgb16,            /* DSPF_RGB16 */
+     Sacc_to_Aop_rgb24,            /* DSPF_RGB24 */
+     Sacc_to_Aop_rgb32,            /* DSPF_RGB32 */
+     Sacc_to_Aop_argb,             /* DSPF_ARGB */
+     Sacc_to_Aop_a8,               /* DSPF_A8 */
+     Sacc_to_Aop_yuy2,             /* DSPF_YUY2 */
+     Sacc_to_Aop_rgb332,           /* DSPF_RGB332 */
+     Sacc_to_Aop_uyvy,             /* DSPF_UYVY */
+     Sacc_to_Aop_i420,             /* DSPF_I420 */
+     Sacc_to_Aop_i420,             /* DSPF_YV12 */
+     Sacc_to_Aop_lut8,             /* DSPF_LUT8 */
+     Sacc_to_Aop_alut44,           /* DSPF_ALUT44 */
+     Sacc_to_Aop_airgb,            /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     Sacc_to_Aop_nv12,             /* DSPF_NV12 */
+     Sacc_to_Aop_nv12,             /* DSPF_NV16 */
+     Sacc_to_Aop_argb2554,         /* DSPF_ARGB2554 */
+     Sacc_to_Aop_argb4444,         /* DSPF_ARGB4444 */
+     Sacc_to_Aop_rgba4444,         /* DSPF_RGBA4444 */
+     Sacc_to_Aop_nv21,             /* DSPF_NV21 */
+     Sacc_to_Aop_ayuv,             /* DSPF_AYUV */
+     Sacc_to_Aop_a4,               /* DSPF_A4 */
+     Sacc_to_Aop_argb1666,         /* DSPF_ARGB1666 */
+     Sacc_to_Aop_argb6666,         /* DSPF_ARGB6666 */
+     Sacc_to_Aop_rgb18,            /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sacc_to_Aop_xrgb4444,         /* DSPF_RGB444 */
+     Sacc_to_Aop_xrgb1555,         /* DSPF_RGB555 */
+     Sacc_to_Aop_xbgr1555,         /* DSPF_BGR555 */
+};
+
+/********************************* Sacc_Sto_Aop_PFI ***************************/
+
+static void Sacc_Sto_Aop_argb6666( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_ARGB6666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_argb1666( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_ARGB1666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_rgb18( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               u32 pixel = PIXEL_RGB18( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          i += SperD;
+     }
+}
+ 
+static void Sacc_Sto_Aop_rgb24( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               *D++ = (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b;
+               *D++ = (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g;
+               *D++ = (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r;
+          }
+          else
+               D += 3;
+
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_a8( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000))
+               *D = (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a;
+
+          D++;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_yuy2( GenefxState *gfxs )
+{
+     int                l;
+     int                w      = gfxs->length;
+     int                i      = gfxs->Xphase;
+     GenefxAccumulator *Sacc   = gfxs->Sacc;
+     u16               *D      = gfxs->Aop[0];
+     int                SperD  = gfxs->SperD;
+     int                SperD2 = gfxs->SperD << 1;
+
+     if ((long)D & 2) {
+          GenefxAccumulator *S = Sacc;
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.v & 0xFF00) ? 0XFF00 : (S->YUV.v<<8));
+          }
+          D++;
+          w--;
+          i = SperD;
+     }
+
+     for (l = w>>1; l--;) {
+          GenefxAccumulator *S0 = &Sacc[i>>16];
+          GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+
+          if (!(S0->YUV.a & 0xF000) && !(S1->YUV.a & 0xF000)) {
+               u32 y0, cb, y1, cr;
+
+               y0 = (S0->YUV.y & 0xFF00) ? 0xFF : S0->YUV.y;
+               y1 = (S1->YUV.y & 0xFF00) ? 0xFF : S1->YUV.y;
+
+               cb = (S0->YUV.u + S1->YUV.u) >> 1;
+               if (cb & 0xFF00)
+                    cb = 0xFF;
+
+               cr = (S0->YUV.v + S1->YUV.v) >> 1;
+               if (cr & 0xFF00)
+                    cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+               *((u32*)D) = y1 | (cr << 8) | (y0 << 16) | (cb << 24);
+#else
+               *((u32*)D) = y0 | (cb << 8) | (y1 << 16) | (cr << 24);
+#endif
+          }
+          else if (!(S0->YUV.a & 0xF000)) {
+               D[0] = ((S0->YUV.y & 0xFF00) ? 0x00FF :  S0->YUV.y) |
+                      ((S0->YUV.u & 0xFF00) ? 0xFF00 : (S0->YUV.u<<8));
+          }
+          else if (!(S1->YUV.a & 0xF000)) {
+               D[1] = ((S1->YUV.y & 0xFF00) ? 0x00FF :  S1->YUV.y) |
+                      ((S1->YUV.v & 0xFF00) ? 0xFF00 : (S1->YUV.v<<8));
+          }
+
+          D += 2;
+          i += SperD2;
+     }
+
+     if (w & 1) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.u & 0xFF00) ? 0xFF00 : (S->YUV.u<<8));
+          }
+     }
+}
+
+static void Sacc_Sto_Aop_rgb332( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               *D = PIXEL_RGB332( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                  (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                  (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+          }
+
+          D++;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_uyvy( GenefxState *gfxs )
+{
+     int                l;
+     int                w      = gfxs->length;
+     int                i      = gfxs->Xphase;
+     GenefxAccumulator *Sacc   = gfxs->Sacc;
+     u16               *D      = gfxs->Aop[0];
+     int                SperD  = gfxs->SperD;
+     int                SperD2 = gfxs->SperD << 1;
+
+     if ((long)D & 2) {
+          GenefxAccumulator *S = Sacc;
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.v & 0xFF00) ? 0x00FF :  S->YUV.v)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+          D++;
+          w--;
+          i = SperD;
+     }
+
+     for (l = w>>1; l--;) {
+          GenefxAccumulator *S0 = &Sacc[i>>16];
+          GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+
+          if (!(S0->YUV.a & 0xF000) && !(S1->YUV.a & 0xF000)) {
+               u32 cb, y0, cr, y1;
+
+               y0 = (S0->YUV.y & 0xFF00) ? 0xFF : S0->YUV.y;
+               y1 = (S1->YUV.y & 0xFF00) ? 0xFF : S1->YUV.y;
+
+               cb = (S0->YUV.u + S1->YUV.u) >> 1;
+               if (cb & 0xFF00)
+                    cb = 0xFF;
+
+               cr = (S0->YUV.v + S1->YUV.v) >> 1;
+               if (cr & 0xFF00)
+                    cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+               *((u32*)D) = cr | (y1 << 8) | (cb << 16) | (y0 << 24);
+#else
+               *((u32*)D) = cb | (y0 << 8) | (cr << 16) | (y1 << 24);
+#endif
+          }
+          else if (!(S0->YUV.a & 0xF000)) {
+               D[0] = ((S0->YUV.u & 0xFF00) ? 0x00FF :  S0->YUV.u) |
+                      ((S0->YUV.y & 0xFF00) ? 0xFF00 : (S0->YUV.y<<8));
+          }
+          else if (!(S1->YUV.a & 0xF000)) {
+               D[1] = ((S1->YUV.v & 0xFF00) ? 0x00FF :  S1->YUV.v) |
+                      ((S1->YUV.y & 0xFF00) ? 0xFF00 : (S1->YUV.y<<8));
+          }
+
+          D += 2;
+          i += SperD2;
+     }
+
+     if (w & 1) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+          if (!(S->YUV.a & 0xF00)) {
+               *D = ((S->YUV.u & 0xFF00) ? 0x00FF :  S->YUV.u)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+     }
+}
+
+static void Sacc_Sto_Aop_lut8( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               *D = dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a );
+          }
+
+          D++;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_alut44( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000)) {
+               *D = (S->RGB.a & 0xFF00) ? 0xF0 : (S->RGB.a & 0xF0) +
+                    dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        0x80 );
+          }
+
+          D++;
+          i += SperD;
+     }
+}
+
+static void Sacc_Sto_Aop_i420( GenefxState *gfxs )
+{
+     int                i      = gfxs->Xphase;
+     int                w      = gfxs->length;
+     GenefxAccumulator *Sacc   = gfxs->Sacc;
+     u8                *Dy     = gfxs->Aop[0];
+     int                SperD  = gfxs->SperD;
+     
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+          
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          Dy++;
+          i += SperD;
+     }
+          
+     if (gfxs->AopY & 1) {
+          u8 *Du = gfxs->Aop[1];
+          u8 *Dv = gfxs->Aop[2];
+          
+          w = gfxs->length>>1;
+          i = gfxs->Xphase>>1;
+          
+          while (w--) {
+               GenefxAccumulator *S0 = &Sacc[i>>16];
+               GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+               
+               if (!(S0->YUV.a & 0xF000) && !(S1->YUV.a & 0xF000)) {
+                    u32 tmp;
+
+                    tmp = (S0->YUV.u + S1->YUV.u) >> 1;
+                    if (tmp & 0xFF00)
+                         tmp = 0xFF;
+                    *Du = tmp;
+
+                    tmp = (S0->YUV.v + S1->YUV.v) >> 1;
+                    if (tmp & 0xFF00)
+                         tmp = 0xFF;
+                    *Dv = tmp;
+               
+               }
+               else if (!(S0->YUV.a & 0xF000)) {
+                    *Du = (*Du + ((S0->YUV.u & 0xFF00) ? 0xFF : S0->YUV.u)) >> 1;
+                    *Dv = (*Dv + ((S0->YUV.v & 0xFF00) ? 0xFF : S0->YUV.v)) >> 1;
+               }
+               else if (!(S1->YUV.a & 0xF000)) {
+                    *Du = (*Du + ((S1->YUV.u & 0xFF00) ? 0xFF : S1->YUV.u)) >> 1;
+                    *Dv = (*Dv + ((S1->YUV.v & 0xFF00) ? 0xFF : S1->YUV.v)) >> 1;
+               }
+               
+               Du++;
+               Dv++;
+               i += SperD << 1;
+          }
+     }
+}
+
+static void Sacc_Sto_Aop_nv12( GenefxState *gfxs )
+{
+     int                i     = gfxs->Xphase;
+     int                w     = gfxs->length;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *Dy    = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+     
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+          
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          Dy++;
+          i += SperD;
+     }
+          
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          u16 *Duv = gfxs->Aop[1];
+          
+          w = gfxs->length>>1;
+          i = gfxs->Xphase>>1;
+          
+          while (w--) {
+               GenefxAccumulator *S0 = &Sacc[i>>16];
+               GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+               u32                cb, cr;
+               
+               if (!(S0->YUV.a & 0xF000) && !(S1->YUV.a & 0xF000)) {
+                    cb = (S0->YUV.u + S1->YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S0->YUV.v + S1->YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+                         
+#ifdef WORDS_BIGENDIAN
+                    *Duv = cr | (cb << 8);
+               }
+               else if (!(S0->YUV.a & 0xF000)) {
+                    cb = ((*Duv >> 8)   + ((S0->YUV.u & 0xFF00) ? 0xFF : S0->YUV.u)) >> 1;
+                    cr = ((*Duv & 0xFF) + ((S0->YUV.v & 0xFF00) ? 0xFF : S0->YUV.v)) >> 1;
+                    *Duv = cr | (cb << 8);
+               }
+               else if (!(S1->YUV.a & 0xF000)) {
+                    cb = ((*Duv >> 8)   + ((S1->YUV.u & 0xFF00) ? 0xFF : S1->YUV.u)) >> 1;
+                    cr = ((*Duv & 0xFF) + ((S1->YUV.v & 0xFF00) ? 0xFF : S1->YUV.v)) >> 1;
+                    *Duv = cr | (cb << 8);
+               }
+#else
+                    *Duv = cb | (cr << 8);
+               }
+               else if (!(S0->YUV.a & 0xF000)) {
+                    cb = ((*Duv & 0xFF) + ((S0->YUV.u & 0xFF00) ? 0xFF : S0->YUV.u)) >> 1;
+                    cr = ((*Duv >> 8)   + ((S0->YUV.v & 0xFF00) ? 0xFF : S0->YUV.v)) >> 1;
+                    *Duv = cb | (cr << 8);
+               }
+               else if (!(S1->YUV.a & 0xF000)) {
+                    cb = ((*Duv & 0xFF) + ((S1->YUV.u & 0xFF00) ? 0xFF : S1->YUV.u)) >> 1;
+                    cr = ((*Duv >> 8)   + ((S1->YUV.v & 0xFF00) ? 0xFF : S1->YUV.v)) >> 1;
+                    *Duv = cb | (cr << 8);
+               }
+#endif
+               
+               Duv++;
+
+               i += SperD << 1;
+          }
+     }
+}
+
+static void Sacc_Sto_Aop_nv21( GenefxState *gfxs )
+{
+     int                i     = gfxs->Xphase;
+     int                w     = gfxs->length;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u8                *Dy    = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+     
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+          
+          if (!(S->YUV.a & 0xF000))
+               *Dy = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+          
+          Dy++;
+          i += SperD;
+     }
+          
+     if (gfxs->dst_format == DSPF_NV16 || gfxs->AopY & 1) {
+          u16 *Dvu = gfxs->Aop[1];
+          
+          w = gfxs->length>>1;
+          i = gfxs->Xphase>>1;
+          
+          while (w--) {
+               GenefxAccumulator *S0 = &Sacc[i>>16];
+               GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+               u32                cb, cr;
+               
+               if (!(S0->YUV.a & 0xF000) && !(S1->YUV.a & 0xF000)) {
+                    cb = (S0->YUV.u + S1->YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S0->YUV.v + S1->YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+                         
+#ifdef WORDS_BIGENDIAN
+                    *Dvu = cb | (cr << 8);
+               }
+               else if (!(S0->YUV.a & 0xF000)) {
+                    cb = ((*Dvu & 0xFF) + ((S0->YUV.u & 0xFF00) ? 0xFF : S0->YUV.u)) >> 1;
+                    cr = ((*Dvu >> 8)   + ((S0->YUV.v & 0xFF00) ? 0xFF : S0->YUV.v)) >> 1;
+                    *Dvu = cb | (cr << 8);
+               }
+               else if (!(S1->YUV.a & 0xF000)) {
+                    cb = ((*Dvu & 0xFF) + ((S1->YUV.u & 0xFF00) ? 0xFF : S1->YUV.u)) >> 1;
+                    cr = ((*Dvu >> 8)   + ((S1->YUV.v & 0xFF00) ? 0xFF : S1->YUV.v)) >> 1;
+                    *Dvu = cb | (cr << 8);
+               }
+#else
+                    *Dvu = cr | (cb << 8);
+               }
+               else if (!(S0->YUV.a & 0xF000)) {
+                    cb = ((*Dvu >> 8)   + ((S0->YUV.u & 0xFF00) ? 0xFF : S0->YUV.u)) >> 1;
+                    cr = ((*Dvu & 0xFF) + ((S0->YUV.v & 0xFF00) ? 0xFF : S0->YUV.v)) >> 1;
+                    *Dvu = cr | (cb << 8);
+               }
+               else if (!(S1->YUV.a & 0xF000)) {
+                    cb = ((*Dvu >> 8)   + ((S1->YUV.u & 0xFF00) ? 0xFF : S1->YUV.u)) >> 1;
+                    cr = ((*Dvu & 0xFF) + ((S1->YUV.v & 0xFF00) ? 0xFF : S1->YUV.v)) >> 1;
+                    *Dvu = cr | (cb << 8);
+               }
+#endif
+               
+               Dvu++;
+
+               i += SperD << 1;
+          }
+     }
+}
+
+static void Sacc_Sto_Aop_ayuv( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u32               *D     = gfxs->Aop[0];
+     int                SperD = gfxs->SperD;
+
+     while (w--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->YUV.a & 0xF000)) {
+               *D = PIXEL_AYUV( (S->YUV.a & 0xFF00) ? 0xFF : S->YUV.a,
+                                (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
+                                (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u,
+                                (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v );
+          }
+
+          D++;
+          i += SperD;
+     }
+}
+
+
+static GenefxFunc Sacc_Sto_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Sacc_Sto_Aop_argb1555,        /* DSPF_ARGB1555 */
+     Sacc_Sto_Aop_rgb16,           /* DSPF_RGB16 */
+     Sacc_Sto_Aop_rgb24,           /* DSPF_RGB24 */
+     Sacc_Sto_Aop_rgb32,           /* DSPF_RGB32 */
+     Sacc_Sto_Aop_argb,            /* DSPF_ARGB */
+     Sacc_Sto_Aop_a8,              /* DSPF_A8 */
+     Sacc_Sto_Aop_yuy2,            /* DSPF_YUY2 */
+     Sacc_Sto_Aop_rgb332,          /* DSPF_RGB332 */
+     Sacc_Sto_Aop_uyvy,            /* DSPF_UYVY */
+     Sacc_Sto_Aop_i420,            /* DSPF_I420 */
+     Sacc_Sto_Aop_i420,            /* DSPF_YV12 */
+     Sacc_Sto_Aop_lut8,            /* DSPF_LUT8 */
+     Sacc_Sto_Aop_alut44,          /* DSPF_ALUT44 */
+     Sacc_Sto_Aop_airgb,           /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     Sacc_Sto_Aop_nv12,            /* DSPF_NV12 */
+     Sacc_Sto_Aop_nv12,            /* DSPF_NV16 */
+     Sacc_Sto_Aop_argb2554,        /* DSPF_ARGB2554 */
+     Sacc_Sto_Aop_argb4444,        /* DSPF_ARGB4444 */
+     Sacc_Sto_Aop_rgba4444,        /* DSPF_RGBA4444 */
+     Sacc_Sto_Aop_nv21,            /* DSPF_NV21 */
+     Sacc_Sto_Aop_ayuv,            /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     Sacc_Sto_Aop_argb1666,        /* DSPF_ARGB1666 */
+     Sacc_Sto_Aop_argb6666,        /* DSPF_ARGB6666 */
+     Sacc_Sto_Aop_rgb18,           /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sacc_Sto_Aop_xrgb4444,        /* DSPF_RGB444 */
+     Sacc_Sto_Aop_xrgb1555,        /* DSPF_RGB555 */
+     Sacc_Sto_Aop_xbgr1555,        /* DSPF_BGR555 */
+};
+
+/********************************* Sacc_toK_Aop_PFI ***************************/
+
+static void Sacc_toK_Aop_argb6666( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {
+               u32 pixel = PIXEL_ARGB6666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_argb1666( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {
+               u32 pixel = PIXEL_ARGB1666( (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a,
+                                           (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                           (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                           (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_rgb18( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && Dkey == ((u32)(D[2]<<16 | D[1]<<8 | D[0]) & 0x3FFFF)) {
+               u32 pixel = PIXEL_RGB18( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D +=3;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_rgb24( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+     u8                 r = (gfxs->Dkey >> 16);
+     u8                 g = (gfxs->Dkey >>  8) & 0xff;
+     u8                 b = (gfxs->Dkey      ) & 0xff;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && D[0] == b && D[1] == g && D[2] == r) {
+               *D++ = (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b;
+               *D++ = (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g;
+               *D++ = (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r;
+          }
+          else
+               D += 3;
+
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_a8( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u8                *D = gfxs->Aop[0];
+
+     /* FIXME: do all or do none? */
+     while (w--) {
+          if (!(S->RGB.a & 0xF000))
+               *D = (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a;
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_yuy2( GenefxState *gfxs )
+{
+     int                l;
+     int                w     = gfxs->length;
+     GenefxAccumulator *S     = gfxs->Sacc;
+     u16               *D     = gfxs->Aop[0];
+     u32                Dkey  = gfxs->Dkey;
+#ifdef WORDS_BIGENDIAN
+     u16                Dkey0 = gfxs->Dkey >> 16;
+     u16                Dkey1 = gfxs->Dkey & 0xFFFF;
+#else
+     u16                Dkey0 = gfxs->Dkey & 0xFFFF;
+     u16                Dkey1 = gfxs->Dkey >> 16;
+#endif
+
+     if ((long)D & 2) {
+          if (!(S->YUV.a & 0xF000) && (*D == Dkey1)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.v & 0xFF00) ? 0xFF00 : (S->YUV.v<<8));
+          }
+          S++;
+          D++;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (*D == Dkey) {
+               if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+                    u32 y0, cb, y1, cr;
+
+                    y0 = (S[0].YUV.y & 0xFF00) ? 0xFF : S[0].YUV.y;
+                    y1 = (S[1].YUV.y & 0xFF00) ? 0xFF : S[1].YUV.y;
+
+                    cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+                    *((u32*)D) = y1 | (cr << 8) | (y0 << 16) | (cb << 24);
+#else
+                    *((u32*)D) = y0 | (cb << 8) | (y1 << 16) | (cr << 24);
+#endif
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    D[0] = ((S[0].YUV.y & 0xFF00) ? 0x00FF :  S[0].YUV.y) |
+                           ((S[0].YUV.u & 0xFF00) ? 0xFF00 : (S[0].YUV.u<<8));
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    D[1] = ((S[1].YUV.y & 0xFF00) ? 0x00FF :  S[1].YUV.y) |
+                           ((S[1].YUV.v & 0xFF00) ? 0xFF00 : (S[1].YUV.v<<8));
+               }
+          }
+
+          D += 2;
+          S += 2;
+     }
+
+     if (w & 1) {
+          if (!(S->YUV.a & 0xF000) && (*D == Dkey0)) {
+               *D = ((S->YUV.y & 0xFF00) ? 0x00FF :  S->YUV.y)    |
+                    ((S->YUV.u & 0xFF00) ? 0xFF00 : (S->YUV.u<<8));
+          }
+     }
+}
+
+static void Sacc_toK_Aop_rgb332( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S    = gfxs->Sacc;
+     u8                *D    = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && (*D == Dkey)) {
+               *D = PIXEL_RGB332( (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                  (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                  (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_uyvy( GenefxState *gfxs )
+{
+     int                l;
+     int                w     = gfxs->length;
+     GenefxAccumulator *S     = gfxs->Sacc;
+     u16               *D     = gfxs->Aop[0];
+     u32                Dkey  = gfxs->Dkey;
+#ifdef WORDS_BIGENDIAN
+     u16                Dkey0 = gfxs->Dkey >> 16;
+     u16                Dkey1 = gfxs->Dkey & 0xFFFF;
+#else
+     u16                Dkey0 = gfxs->Dkey & 0xFFFF;
+     u16                Dkey1 = gfxs->Dkey >> 16;
+#endif
+
+     if ((long)D & 2) {
+          if (!(S->YUV.a & 0xF000) && (*D == Dkey1)) {
+               *D = ((S->YUV.v & 0xFF00) ? 0x00FF :  S->YUV.v)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+          S++;
+          D++;
+          w--;
+     }
+
+     for (l = w>>1; l--;) {
+          if (*D == Dkey) {
+               if (!(S[0].YUV.a & 0xF000) && !(S[1].YUV.a & 0xF000)) {
+                    u32 cb, y0, cr, y1;
+
+                    y0 = (S[0].YUV.y & 0xFF00) ? 0xFF : S[0].YUV.y;
+                    y1 = (S[1].YUV.y & 0xFF00) ? 0xFF : S[1].YUV.y;
+
+                    cb = (S[0].YUV.u + S[1].YUV.u) >> 1;
+                    if (cb & 0xFF00)
+                         cb = 0xFF;
+
+                    cr = (S[0].YUV.v + S[1].YUV.v) >> 1;
+                    if (cr & 0xFF00)
+                         cr = 0xFF;
+
+#ifdef WORDS_BIGENDIAN
+                    *((u32*)D) = cr | (y1 << 8) | (cb << 16) | (y0 << 24);
+#else
+                    *((u32*)D) = cb | (y0 << 8) | (cr << 16) | (y1 << 24);
+#endif
+               }
+               else if (!(S[0].YUV.a & 0xF000)) {
+                    D[0] = ((S[0].YUV.u & 0xFF00) ? 0x00FF :  S[0].YUV.u) |
+                           ((S[0].YUV.y & 0xFF00) ? 0xFF00 : (S[0].YUV.y<<8));
+               }
+               else if (!(S[1].YUV.a & 0xF000)) {
+                    D[1] = ((S[1].YUV.v & 0xFF00) ? 0x00FF :  S[1].YUV.v) |
+                           ((S[1].YUV.y & 0xFF00) ? 0xFF00 : (S[1].YUV.y<<8));
+               }
+          }
+
+          D += 2;
+          S += 2;
+     }
+
+     if (w & 1) {
+          if (!(S->YUV.a & 0xF000) && (*D == Dkey0)) {
+               *D = ((S->YUV.u & 0xFF00) ? 0x00FF :  S->YUV.u)    |
+                    ((S->YUV.y & 0xFF00) ? 0xFF00 : (S->YUV.y<<8));
+          }
+     }
+}
+
+static void Sacc_toK_Aop_lut8( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S    = gfxs->Sacc;
+     u8                *D    = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && (*D == Dkey)) {
+               *D = dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        (S->RGB.a & 0xFF00) ? 0xFF : S->RGB.a );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static void Sacc_toK_Aop_alut44( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *S    = gfxs->Sacc;
+     u8                *D    = gfxs->Aop[0];
+     u32                Dkey = gfxs->Dkey;
+
+     while (w--) {
+          if (!(S->RGB.a & 0xF000) && ((*D & 0x0F) == Dkey)) {
+               *D = (S->RGB.a & 0xFF00) ? 0xF0 : (S->RGB.a & 0xF0) +
+                    dfb_palette_search( gfxs->Alut,
+                                        (S->RGB.r & 0xFF00) ? 0xFF : S->RGB.r,
+                                        (S->RGB.g & 0xFF00) ? 0xFF : S->RGB.g,
+                                        (S->RGB.b & 0xFF00) ? 0xFF : S->RGB.b,
+                                        0x80 );
+          }
+
+          D++;
+          S++;
+     }
+}
+
+static GenefxFunc Sacc_toK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Sacc_toK_Aop_argb1555,        /* DSPF_ARGB1555 */
+     Sacc_toK_Aop_rgb16,           /* DSPF_RGB16 */
+     Sacc_toK_Aop_rgb24,           /* DSPF_RGB24 */
+     Sacc_toK_Aop_rgb32,           /* DSPF_RGB32 */
+     Sacc_toK_Aop_argb,            /* DSPF_ARGB */
+     Sacc_toK_Aop_a8,              /* DSPF_A8 */
+     Sacc_toK_Aop_yuy2,            /* DSPF_YUY2 */
+     Sacc_toK_Aop_rgb332,          /* DSPF_RGB332 */
+     Sacc_toK_Aop_uyvy,            /* DSPF_UYVY */
+     NULL,                         /* DSPF_I420 */
+     NULL,                         /* DSPF_YV12 */
+     Sacc_toK_Aop_lut8,            /* DSPF_LUT8 */
+     Sacc_toK_Aop_alut44,          /* DSPF_ALUT44 */
+     Sacc_toK_Aop_airgb,           /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     NULL,                         /* DSPF_NV12 */
+     NULL,                         /* DSPF_NV16 */
+     Sacc_toK_Aop_argb2554,        /* DSPF_ARGB2554 */
+     Sacc_toK_Aop_argb4444,        /* DSPF_ARGB4444 */
+     Sacc_toK_Aop_rgba4444,        /* DSPF_RGBA4444 */
+     NULL,                         /* DSPF_NV21 */
+     NULL,                         /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     Sacc_toK_Aop_argb1666,        /* DSPF_ARGB1666 */
+     Sacc_toK_Aop_argb6666,        /* DSPF_ARGB6666 */
+     Sacc_toK_Aop_rgb18,           /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sacc_toK_Aop_xrgb4444,        /* DSPF_RGB444 */
+     Sacc_toK_Aop_xrgb1555,        /* DSPF_RGB555 */
+     Sacc_toK_Aop_xbgr1555,        /* DSPF_BGR555 */
+};
+
+/********************************* Sacc_StoK_Aop_PFI **************************/
+
+static GenefxFunc Sacc_StoK_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Sacc_StoK_Aop_argb1555,       /* DSPF_ARGB1555 */
+     Sacc_StoK_Aop_rgb16,          /* DSPF_RGB16 */
+     NULL,                         /* DSPF_RGB24 */
+     Sacc_StoK_Aop_rgb32,          /* DSPF_RGB32 */
+     Sacc_StoK_Aop_argb,           /* DSPF_ARGB */
+     NULL,                         /* DSPF_A8 */
+     NULL,                         /* DSPF_YUY2 */
+     NULL,                         /* DSPF_RGB332 */
+     NULL,                         /* DSPF_UYVY */
+     NULL,                         /* DSPF_I420 */
+     NULL,                         /* DSPF_YV12 */
+     NULL,                         /* DSPF_LUT8 */
+     NULL,                         /* DSPF_ALUT44 */
+     Sacc_StoK_Aop_airgb,          /* DSPF_AiRGB */
+     NULL,                         /* DSPF_A1 */
+     NULL,                         /* DSPF_NV12 */
+     NULL,                         /* DSPF_NV16 */
+     Sacc_StoK_Aop_argb2554,       /* DSPF_ARGB2554 */
+     Sacc_StoK_Aop_argb4444,       /* DSPF_ARGB4444 */
+     Sacc_StoK_Aop_rgba4444,       /* DSPF_RGBA4444 */
+     NULL,                         /* DSPF_NV21 */
+     NULL,                         /* DSPF_AYUV */
+     NULL,                         /* DSPF_A4 */
+     NULL,                         /* DSPF_ARGB1666 */
+     NULL,                         /* DSPF_ARGB6666 */
+     NULL,                         /* DSPF_RGB18 */
+     NULL,                         /* DSPF_LUT2 */
+     Sacc_StoK_Aop_xrgb4444,       /* DSPF_RGB444 */
+     Sacc_StoK_Aop_xrgb1555,       /* DSPF_RGB555 */
+     Sacc_StoK_Aop_xbgr1555,       /* DSPF_BGR555 */
+};
+
+/************** Bop_a8_set_alphapixel_Aop_PFI *********************************/
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 3 )
+
+
+static void Bop_a8_set_alphapixel_Aop_argb1555( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0x7c1f;
+     u32    g   = Cop & 0x03e0;
+
+#define SET_PIXEL(d,a) \
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = (a>>3)+1;\
+               register u32 t1 = (d & 0x7c1f);\
+               register u32 t2 = (d & 0x03e0);\
+               d = ((d) & 0x8000) | ((a & 0x80) << 8) | \
+                   ((((rb-t1)*s+(t1<<5)) & 0x000f83e0) + \
+                    ((( g-t2)*s+(t2<<5)) & 0x00007c00)) >> 5;\
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+
+static void Bop_a8_set_alphapixel_Aop_rgb16( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0xf81f;
+     u32    g   = Cop & 0x07e0;
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = (a>>2)+1;\
+               register u32 t1 = (d & 0xf81f);\
+               register u32 t2 = (d & 0x07e0);\
+               d  = ((((rb-t1)*s+(t1<<6)) & 0x003e07c0) + \
+                     ((( g-t2)*s+(t2<<6)) & 0x0001f800)) >> 6;\
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_argb6666( GenefxState *gfxs )
+{
+
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0x3f03f;
+     u32    g   = Cop & 0xfc0;
+
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = (a>>2)+1;\
+               register u32 t1 = (d & 0x3f03f);\
+               register u32 t2 = (d & 0xfc0);\
+               d  = ((((rb-t1)*s+(t1<<6)) & 0xfc0fc0) + \
+                     ((( g-t2)*s+(t2<<6)) & 0xfc000)) >> 6;\
+          }\
+     }
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+
+}
+
+static void Bop_a8_set_alphapixel_Aop_argb1666( GenefxState *gfxs )
+{
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0x3f03f;
+     u32    g   = Cop & 0xfc0;
+
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = (a>>2)+1;\
+               register u32 t1 = (d & 0x3f03f);\
+               register u32 t2 = (d & 0xfc0);\
+               d  = ((((rb-t1)*s+(t1<<6)) & 0xfc0fc0) + \
+                     ((( g-t2)*s+(t2<<6)) & 0xfc000)) >> 6;\
+          }\
+     }
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_rgb18( GenefxState *gfxs )
+{
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0x3f03f;
+     u32    g   = Cop & 0xfc0;
+
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = (a>>2)+1;\
+               register u32 t1 = (d & 0x3f03f);\
+               register u32 t2 = (d & 0xfc0);\
+               d  = ((((rb-t1)*s+(t1<<6)) & 0xfc0fc0) + \
+                     ((( g-t2)*s+(t2<<6)) & 0xfc000)) >> 6;\
+          }\
+     }
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+
+}
+
+static void Bop_a8_set_alphapixel_Aop_rgb24( GenefxState *gfxs )
+{
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+     DFBColor  color = gfxs->color;
+
+#define SET_PIXEL(d,r,g,b,a)\
+     switch (a) {\
+         case 0xff:\
+               d[0] = b;\
+               d[1] = g;\
+               d[2] = r;\
+          case 0: break;\
+          default: {\
+               register u16 s = a+1;\
+               d[0] = ((b-d[0]) * s + (d[0] << 8)) >> 8;\
+               d[1] = ((g-d[1]) * s + (d[1] << 8)) >> 8;\
+               d[2] = ((r-d[2]) * s + (d[2] << 8)) >> 8;\
+          }\
+     }
+
+     while (w>4) {
+          SET_PIXEL( D, color.r, color.g, color.b, *S ); D+=3; S++;
+          SET_PIXEL( D, color.r, color.g, color.b, *S ); D+=3; S++;
+          SET_PIXEL( D, color.r, color.g, color.b, *S ); D+=3; S++;
+          SET_PIXEL( D, color.r, color.g, color.b, *S ); D+=3; S++;
+          w-=4;
+     }
+     while (w--) {
+          SET_PIXEL( D, color.r, color.g, color.b, *S ); D+=3, S++;
+     }
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_rgb32( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0xff00ff;
+     u32    g   = Cop & 0x00ff00;
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 t1 = (d & 0x00ff00ff);\
+               register u32 t2 = (d & 0x0000ff00);\
+               d = ((((rb-t1)*s+(t1<<8)) & 0xff00ff00) + \
+                    ((( g-t2)*s+(t2<<8)) & 0x00ff0000)) >> 8;\
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+
+/* saturating alpha blend */
+
+static void Bop_a8_set_alphapixel_Aop_argb( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop | 0xff000000;
+     u32    rb  = Cop & 0x00ff00ff;
+     u32    g   = gfxs->color.g;
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 s1 = 256-a;\
+               register u32 sa = (((d >> 24) * s1) >> 8) + a;\
+               d = (sa << 24) + \
+                    (((((d & 0x00ff00ff)       * s1) + (rb  * s)) >> 8) & 0x00ff00ff) + \
+                    (((((d & 0x0000ff00) >> 8) * s1) + ((g) * s))       & 0x0000ff00);  \
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_airgb( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+     u32    rb  = Cop & 0x00ff00ff;
+     u32    g   = gfxs->color.g;
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 s1 = 256-s;\
+               register s32 sa = (d >> 24) - a;\
+               if (sa < 0) sa = 0;\
+               d = (sa << 24) + \
+                    (((((d & 0x00ff00ff)       * s1) + (rb  * s)) >> 8) & 0x00ff00ff) + \
+                    (((((d & 0x0000ff00) >> 8) * s1) + ((g) * s))       & 0x0000ff00);  \
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_a8( GenefxState *gfxs )
+{
+     int    w = gfxs->length;
+     u8    *S = gfxs->Bop[0];
+     u8    *D = gfxs->Aop[0];
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = 0xff;\
+          case 0: break; \
+          default: {\
+               register u16 s1 = 255-a;\
+               d = ((d * s1) >> 8) + a;\
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_yuy2( GenefxState *gfxs )
+{
+     int    w    = gfxs->length;
+     u8    *S    = gfxs->Bop[0];
+     u16   *D    = gfxs->Aop[0];
+     u32    y    = gfxs->YCop;
+     u32    u    = gfxs->CbCop;
+     u32    v    = gfxs->CrCop;
+
+#ifdef WORDS_BIGENDIAN
+     u16  Cop0 = u | (y << 8);
+     u16  Cop1 = v | (y << 8);
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff:\
+               d = ((long)&(d) & 2) ? Cop1 : Cop0;\
+          case 0x00: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 t1 = d & 0xff;\
+               register u32 t2 = d >> 8;\
+               if ((long)&(d) & 2)\
+                    d = (((v-t1)*s+(t1<<8)) >> 8) |\
+                        (((y-t2)*s+(t2<<8)) & 0xff00);\
+               else\
+                    d = (((u-t1)*s+(t1<<8)) >> 8) |\
+                        (((y-t2)*s+(t2<<8)) & 0xff00);\
+          } break;\
+     }
+#else
+     u16    Cop0 = y | (u << 8);
+     u16    Cop1 = y | (v << 8);
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff:\
+               d = ((long)&(d) & 2) ? Cop1 : Cop0;\
+          case 0x00: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 t1 = d & 0xff;\
+               register u32 t2 = d >> 8;\
+               if ((long)&(d) & 2)\
+                    d = (((y-t1)*s+(t1<<8)) >> 8) |\
+                        (((v-t2)*s+(t2<<8)) & 0xff00);\
+               else\
+                    d = (((y-t1)*s+(t1<<8)) >> 8) |\
+                        (((u-t2)*s+(t2<<8)) & 0xff00);\
+          } break;\
+     }
+#endif
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_rgb332( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u8    *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+     u32    rgb = ((Cop & 0xe0) << 16) | ((Cop & 0x1c) << 8) | (Cop & 0x03);
+
+#define SET_PIXEL(d,a) \
+     switch (a) {\
+          case 0xff: d = Cop;\
+          case 0: break;\
+          default: {\
+               register u32 s = a + 1;\
+               register u32 t = ((d & 0xe0) << 16) | ((d & 0x1c) << 8) | (d & 0x03);\
+               register u32 c = ((rgb-t)*s + (t<<8)) & 0xe01c0300;\
+               d = (c >> 24) | ((c >> 16) & 0xff) | ((c >> 8) & 0xff);\
+          }\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_uyvy( GenefxState *gfxs )
+{
+     int    w    = gfxs->length;
+     u8    *S    = gfxs->Bop[0];
+     u16   *D    = gfxs->Aop[0];
+     u32    y    = gfxs->YCop;
+     u32    u    = gfxs->CbCop;
+     u32    v    = gfxs->CrCop;
+     u16    Cop0 = u | (y << 8);
+     u16    Cop1 = v | (y << 8);
+
+#define SET_PIXEL(d,a)\
+     switch (a) {\
+          case 0xff: d = ((long)&(d) & 2) ? Cop1 : Cop0;\
+          case 0x00: break;\
+          default: {\
+               register u32  s = a+1;\
+               register u32 t1 = d & 0xff;\
+               register u32 t2 = d >> 8;\
+               if ((long)&(d) & 2)\
+                    d = (((v-t1)*s+(t1<<8)) >> 8) |\
+                        (((y-t2)*s+(t2<<8)) & 0xff00);\
+               else\
+                    d = (((u-t1)*s+(t1<<8)) >> 8) |\
+                        (((y-t2)*s+(t2<<8)) & 0xff00);\
+          } break;\
+     }
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_lut8( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u8    *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+#if 0
+     DFBColor  color   = gfxs->color;
+     DFBColor *entries = gfxs->Alut->entries;
+
+# define SET_PIXEL(d,alpha) \
+     switch (alpha) {\
+          case 0xff: d = Cop;\
+          case 0: break; \
+          default: {\
+               register u16   s = alpha+1;\
+               DFBColor      dc = entries[d];\
+               u16           sa = alpha + dc.a;\
+               dc.r = ((color.r - dc.r) * s + (dc.r << 8)) >> 8;\
+               dc.g = ((color.g - dc.g) * s + (dc.g << 8)) >> 8;\
+               dc.b = ((color.b - dc.b) * s + (dc.b << 8)) >> 8;\
+               d = dfb_palette_search( gfxs->Alut, dc.r, dc.g, dc.b,\
+                                       sa & 0xff00 ? 0xff : sa );\
+          }\
+     }
+#else
+# define SET_PIXEL(d,a) \
+     if (a & 0x80) \
+          d = Cop;
+#endif
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+
+#undef SET_PIXEL
+}
+
+static void Bop_a8_set_alphapixel_Aop_alut44( GenefxState *gfxs )
+{
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u8    *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+     DFBColor  color   = gfxs->color;
+     DFBColor *entries = gfxs->Alut->entries;
+
+#define SET_PIXEL(d,alpha) \
+     switch (alpha) {\
+          case 0xff: d = Cop;\
+          case 0: break; \
+          default: {\
+               register u16   s = alpha+1;\
+               DFBColor      dc = entries[d & 0x0f];\
+               u16           sa = (d & 0xf0) + alpha;\
+               dc.r = ((color.r - dc.r) * s + (dc.r << 8)) >> 8;\
+               dc.g = ((color.g - dc.g) * s + (dc.g << 8)) >> 8;\
+               dc.b = ((color.b - dc.b) * s + (dc.b << 8)) >> 8;\
+               if (sa & 0xff00) sa = 0xf0;\
+               d = (sa & 0xf0) + \
+                    dfb_palette_search( gfxs->Alut, dc.r, dc.g, dc.b, 0x80 );\
+          }\
+     }
+
+     while (w--) {
+          SET_PIXEL( *D, *S );
+          D++, S++;
+     }
+
+#undef SET_PIXEL
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+
+static GenefxFunc Bop_a8_set_alphapixel_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_a8_set_alphapixel_Aop_argb1555,          /* DSPF_ARGB1555 */
+     Bop_a8_set_alphapixel_Aop_rgb16,             /* DSPF_RGB16 */
+     Bop_a8_set_alphapixel_Aop_rgb24,             /* DSPF_RGB24 */
+     Bop_a8_set_alphapixel_Aop_rgb32,             /* DSPF_RGB32 */
+     Bop_a8_set_alphapixel_Aop_argb,              /* DSPF_ARGB */
+     Bop_a8_set_alphapixel_Aop_a8,                /* DSPF_A8 */
+     Bop_a8_set_alphapixel_Aop_yuy2,              /* DSPF_YUY2 */
+     Bop_a8_set_alphapixel_Aop_rgb332,            /* DSPF_RGB332 */
+     Bop_a8_set_alphapixel_Aop_uyvy,              /* DSPF_UYVY */
+     NULL,                                        /* DSPF_I420 */
+     NULL,                                        /* DSPF_YV12 */
+     Bop_a8_set_alphapixel_Aop_lut8,              /* DSPF_LUT8 */
+     Bop_a8_set_alphapixel_Aop_alut44,            /* DSPF_ALUT44 */
+     Bop_a8_set_alphapixel_Aop_airgb,             /* DSPF_AiRGB */
+     NULL,                                        /* DSPF_A1 */
+     NULL,                                        /* DSPF_NV12 */
+     NULL,                                        /* DSPF_NV16 */
+     NULL,                                        /* DSPF_ARGB2554 */
+     NULL,                                        /* DSPF_ARGB4444 */
+     NULL,                                        /* DSPF_RGBA4444 */
+     NULL,                                        /* DSPF_NV21 */
+     Bop_a8_set_alphapixel_Aop_argb,              /* DSPF_AYUV */
+     NULL,                                        /* DSPF_A4 */
+     Bop_a8_set_alphapixel_Aop_argb1666,          /* DSPF_ARGB1666 */
+     Bop_a8_set_alphapixel_Aop_argb6666,          /* DSPF_ARGB6666 */
+     Bop_a8_set_alphapixel_Aop_rgb18,             /* DSPF_RGB18 */
+     NULL,                                        /* DSPF_LUT2 */
+     NULL,                                        /* DSPF_ARGB4444 */
+     NULL,                                        /* DSPF_ARGB1555 */
+     NULL                                         /* DSPF_ARGB1555 */
+};
+
+/************** Bop_a1_set_alphapixel_Aop_PFI *********************************/
+
+static void Bop_a1_set_alphapixel_Aop_argb1555( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u16    Cop = gfxs->Cop | 0x8000;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgb16( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u16    Cop = gfxs->Cop;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_argb6666( GenefxState *gfxs )
+{
+     int       i;
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+     DFBColor  color = gfxs->color;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               u32 pixel = PIXEL_ARGB6666( color.a, color.r, color.g, color.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D += 3;
+     }
+
+}
+
+static void Bop_a1_set_alphapixel_Aop_argb1666( GenefxState *gfxs )
+{
+     int       i;
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+     DFBColor  color = gfxs->color;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               u32 pixel = PIXEL_ARGB1666( color.a, color.r, color.g, color.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D += 3;
+     }
+
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgb18( GenefxState *gfxs )
+{
+     int       i;
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+     DFBColor  color = gfxs->color;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               u32 pixel = PIXEL_RGB18( color.r, color.g, color.b );
+
+               D[0] = pixel;
+               D[1] = pixel >> 8;
+               D[2] = pixel >> 16;
+          }
+          D += 3;
+     }
+
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgb24( GenefxState *gfxs )
+{
+     int       i;
+     int       w     = gfxs->length;
+     u8       *S     = gfxs->Bop[0];
+     u8       *D     = gfxs->Aop[0];
+     DFBColor  color = gfxs->color;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               D[0] = color.b;
+               D[1] = color.g;
+               D[2] = color.r;
+          }
+
+          D += 3;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgb32( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_argb( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop | 0xFF000000;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_airgb( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u32   *D   = gfxs->Aop[0];
+     u32    Cop = gfxs->Cop & 0x00FFFFFF;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_a8( GenefxState *gfxs )
+{
+     int   i;
+     int   w = gfxs->length;
+     u8   *S = gfxs->Bop[0];
+     u8   *D = gfxs->Aop[0];
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = 0xff;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_yuy2( GenefxState *gfxs )
+{
+     int    i;
+     int    w    = gfxs->length;
+     u8    *S    = gfxs->Bop[0];
+     u16   *D    = gfxs->Aop[0];
+     u16    Cop0 = gfxs->YCop | (gfxs->CbCop << 8);
+     u16    Cop1 = gfxs->YCop | (gfxs->CrCop << 8);
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               D[i] = ((long)&D[i] & 2) ? Cop1 : Cop0;
+          }
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgb332( GenefxState *gfxs )
+{
+     int   i;
+     int   w   = gfxs->length;
+     u8   *S   = gfxs->Bop[0];
+     u8   *D   = gfxs->Aop[0];
+     u8    Cop = gfxs->Cop;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_uyvy( GenefxState *gfxs )
+{
+     int    i;
+     int    w    = gfxs->length;
+     u8    *S    = gfxs->Bop[0];
+     u16   *D    = gfxs->Aop[0];
+     u16    Cop0 = gfxs->CbCop | (gfxs->YCop << 8);
+     u16    Cop1 = gfxs->CrCop | (gfxs->YCop << 8);
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7))) {
+               D[i] = ((long)&D[i] & 2) ? Cop1 : Cop0;
+          }
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_lut8( GenefxState *gfxs )
+{
+     int   i;
+     int   w   = gfxs->length;
+     u8   *S   = gfxs->Bop[0];
+     u8   *D   = gfxs->Aop[0];
+     u8    Cop = gfxs->Cop;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_alut44( GenefxState *gfxs )
+{
+     int   i;
+     int   w   = gfxs->length;
+     u8   *S   = gfxs->Bop[0];
+     u8   *D   = gfxs->Aop[0];
+     u8    Cop = gfxs->Cop;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_argb2554( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u16    Cop = gfxs->Cop | 0xC000;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_argb4444( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u16    Cop = gfxs->Cop | 0xF000;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static void Bop_a1_set_alphapixel_Aop_rgba4444( GenefxState *gfxs )
+{
+     int    i;
+     int    w   = gfxs->length;
+     u8    *S   = gfxs->Bop[0];
+     u16   *D   = gfxs->Aop[0];
+     u16    Cop = gfxs->Cop | 0x000F;
+
+     for (i=0; i<w; i++) {
+          if (S[i>>3] & (0x80 >> (i&7)))
+               D[i] = Cop;
+     }
+}
+
+static GenefxFunc Bop_a1_set_alphapixel_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     Bop_a1_set_alphapixel_Aop_argb1555,          /* DSPF_ARGB1555 */
+     Bop_a1_set_alphapixel_Aop_rgb16,             /* DSPF_RGB16 */
+     Bop_a1_set_alphapixel_Aop_rgb24,             /* DSPF_RGB24 */
+     Bop_a1_set_alphapixel_Aop_rgb32,             /* DSPF_RGB32 */
+     Bop_a1_set_alphapixel_Aop_argb,              /* DSPF_ARGB */
+     Bop_a1_set_alphapixel_Aop_a8,                /* DSPF_A8 */
+     Bop_a1_set_alphapixel_Aop_yuy2,              /* DSPF_YUY2 */
+     Bop_a1_set_alphapixel_Aop_rgb332,            /* DSPF_RGB332 */
+     Bop_a1_set_alphapixel_Aop_uyvy,              /* DSPF_UYVY */
+     NULL,                                        /* DSPF_I420 */
+     NULL,                                        /* DSPF_YV12 */
+     Bop_a1_set_alphapixel_Aop_lut8,              /* DSPF_LUT8 */
+     Bop_a1_set_alphapixel_Aop_alut44,            /* DSPF_ALUT44 */
+     Bop_a1_set_alphapixel_Aop_airgb,             /* DSPF_AiRGB */
+     NULL,                                        /* DSPF_A1 */
+     NULL,                                        /* DSPF_NV12 */
+     NULL,                                        /* DSPF_NV16 */
+     Bop_a1_set_alphapixel_Aop_argb2554,          /* DSPF_ARGB2554 */
+     Bop_a1_set_alphapixel_Aop_argb4444,          /* DSPF_ARGB4444 */
+     Bop_a1_set_alphapixel_Aop_rgba4444,          /* DSPF_RGBA4444 */
+     NULL,                                        /* DSPF_NV21 */
+     Bop_a1_set_alphapixel_Aop_argb,              /* DSPF_AYUV */
+     NULL,                                        /* DSPF_A4 */
+     Bop_a1_set_alphapixel_Aop_argb1666,          /* DSPF_ARGB1666 */
+     Bop_a1_set_alphapixel_Aop_argb6666,          /* DSPF_ARGB6666 */
+     Bop_a1_set_alphapixel_Aop_rgb18,             /* DSPF_RGB18 */
+     NULL,                                        /* DSPF_LUT2 */
+     NULL,                                        /* DSPF_RGB444 */
+     NULL,                                        /* DSPF_RGB555 */
+     NULL,                                        /* DSPF_BGR555 */
+};
+
+
+/**************************** Bop_translate_to_Aop ****************************/
+
+static void Bop_lut2_translate_to_Aop_lut8( GenefxState *gfxs )
+{
+     int  i;
+     int  w = gfxs->length;
+     int  W = (w + 3) / 4;
+     u8  *S = gfxs->Bop[0];
+     u8  *D = gfxs->Aop[0];
+
+     for (i=0; i<W; i++, D+=4, w-=4) {
+          u8 index;
+          u8 pixels = S[i];
+
+          switch (w) {
+               default:
+                    index = (pixels & 3);
+                    if (index < gfxs->num_trans && gfxs->trans[index] >= 0)
+                         D[3] = gfxs->trans[index];
+
+               case 3:
+                    index = (pixels >> 2) & 3;
+                    if (index < gfxs->num_trans && gfxs->trans[index] >= 0)
+                         D[2] = gfxs->trans[index];
+
+               case 2:
+                    index = (pixels >> 4) & 3;
+                    if (index < gfxs->num_trans && gfxs->trans[index] >= 0)
+                         D[1] = gfxs->trans[index];
+
+               case 1:
+                    index = (pixels >> 6);
+                    if (index < gfxs->num_trans && gfxs->trans[index] >= 0)
+                         D[0] = gfxs->trans[index];
+          }
+     }
+}
+  
+/********************************* Xacc_blend *********************************/
+
+static void Xacc_blend_zero( GenefxState *gfxs )
+{
+     int                i;
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     for (i=0; i<w; i++) {
+          if (!(Y[i].RGB.a & 0xF000))
+               X[i].RGB.a = X[i].RGB.r = X[i].RGB.g = X[i].RGB.b = 0;
+          else
+               X[i] = Y[i];
+     }
+}
+
+static void Xacc_blend_one( GenefxState *gfxs )
+{
+     int                i;
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     for (i=0; i<w; i++) {
+          X[i] = Y[i];
+     }
+}
+
+static void Xacc_blend_srccolor( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     if (gfxs->Sacc) {
+          GenefxAccumulator *S = gfxs->Sacc;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.r = ((S->RGB.r + 1) * Y->RGB.r) >> 8;
+                    X->RGB.g = ((S->RGB.g + 1) * Y->RGB.g) >> 8;
+                    X->RGB.b = ((S->RGB.b + 1) * Y->RGB.b) >> 8;
+                    X->RGB.a = ((S->RGB.a + 1) * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               S++;
+          }
+     }
+     else {
+          GenefxAccumulator Cacc = gfxs->Cacc;
+          Cacc.RGB.r = Cacc.RGB.r + 1;
+          Cacc.RGB.g = Cacc.RGB.g + 1;
+          Cacc.RGB.b = Cacc.RGB.b + 1;
+          Cacc.RGB.a = Cacc.RGB.a + 1;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.r = (Cacc.RGB.r * Y->RGB.r) >> 8;
+                    X->RGB.g = (Cacc.RGB.g * Y->RGB.g) >> 8;
+                    X->RGB.b = (Cacc.RGB.b * Y->RGB.b) >> 8;
+                    X->RGB.a = (Cacc.RGB.a * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+          }
+     }
+}
+
+static void Xacc_blend_invsrccolor( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     if (gfxs->Sacc) {
+          GenefxAccumulator *S = gfxs->Sacc;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.r = ((0x100 - S->RGB.r) * Y->RGB.r) >> 8;
+                    X->RGB.g = ((0x100 - S->RGB.g) * Y->RGB.g) >> 8;
+                    X->RGB.b = ((0x100 - S->RGB.b) * Y->RGB.b) >> 8;
+                    X->RGB.a = ((0x100 - S->RGB.a) * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               S++;
+          }
+     }
+     else {
+          GenefxAccumulator Cacc = gfxs->Cacc;
+          Cacc.RGB.r = 0x100 - Cacc.RGB.r;
+          Cacc.RGB.g = 0x100 - Cacc.RGB.g;
+          Cacc.RGB.b = 0x100 - Cacc.RGB.b;
+          Cacc.RGB.a = 0x100 - Cacc.RGB.a;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.r = (Cacc.RGB.r * Y->RGB.r) >> 8;
+                    X->RGB.g = (Cacc.RGB.g * Y->RGB.g) >> 8;
+                    X->RGB.b = (Cacc.RGB.b * Y->RGB.b) >> 8;
+                    X->RGB.a = (Cacc.RGB.a * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+          }
+     }
+}
+
+static void Xacc_blend_srcalpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     if (gfxs->Sacc) {
+          GenefxAccumulator *S = gfxs->Sacc;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    register u16 Sa = S->RGB.a + 1;
+
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+                    X->RGB.a = (Sa * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               S++;
+          }
+     }
+     else {
+          register u16 Sa = gfxs->color.a + 1;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+                    X->RGB.a = (Sa * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+          }
+     }
+}
+
+static void Xacc_blend_invsrcalpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+
+     if (gfxs->Sacc) {
+          GenefxAccumulator *S = gfxs->Sacc;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    register u16 Sa = 0x100 - S->RGB.a;
+
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+                    X->RGB.a = (Sa * Y->RGB.a) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               S++;
+          }
+     }
+     else {
+          register u16 Sa = 0x100 - gfxs->color.a;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    X->RGB.a = (Sa * Y->RGB.a) >> 8;
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+          }
+     }
+}
+
+static void Xacc_blend_dstalpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(Y->RGB.a & 0xF000)) {
+               register u16 Da = D->RGB.a + 1;
+
+               X->RGB.r = (Da * Y->RGB.r) >> 8;
+               X->RGB.g = (Da * Y->RGB.g) >> 8;
+               X->RGB.b = (Da * Y->RGB.b) >> 8;
+               X->RGB.a = (Da * Y->RGB.a) >> 8;
+          } else
+               *X = *Y;
+
+          X++;
+          Y++;
+          D++;
+     }
+}
+
+static void Xacc_blend_invdstalpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(Y->RGB.a & 0xF000)) {
+               register u16 Da = 0x100 - D->RGB.a;
+
+               X->RGB.r = (Da * Y->RGB.r) >> 8;
+               X->RGB.g = (Da * Y->RGB.g) >> 8;
+               X->RGB.b = (Da * Y->RGB.b) >> 8;
+               X->RGB.a = (Da * Y->RGB.a) >> 8;
+          } else
+               *X = *Y;
+
+          X++;
+          Y++;
+          D++;
+     }
+}
+
+static void Xacc_blend_destcolor( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(Y->RGB.a & 0xF000)) {
+               X->RGB.r = ((D->RGB.r + 1) * Y->RGB.r) >> 8;
+               X->RGB.g = ((D->RGB.g + 1) * Y->RGB.g) >> 8;
+               X->RGB.b = ((D->RGB.b + 1) * Y->RGB.b) >> 8;
+               X->RGB.a = ((D->RGB.a + 1) * Y->RGB.a) >> 8;
+          } else
+               *X = *Y;
+
+          X++;
+          Y++;
+          D++;
+     }
+}
+
+static void Xacc_blend_invdestcolor( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(Y->RGB.a & 0xF000)) {
+               X->RGB.r = ((0x100 - D->RGB.r) * Y->RGB.r) >> 8;
+               X->RGB.g = ((0x100 - D->RGB.g) * Y->RGB.g) >> 8;
+               X->RGB.b = ((0x100 - D->RGB.b) * Y->RGB.b) >> 8;
+               X->RGB.a = ((0x100 - D->RGB.a) * Y->RGB.a) >> 8;
+          } else
+               *X = *Y;
+
+          X++;
+          Y++;
+          D++;
+     }
+}
+
+static void Xacc_blend_srcalphasat( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *X = gfxs->Xacc;
+     GenefxAccumulator *Y = gfxs->Yacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     if (gfxs->Sacc) {
+          GenefxAccumulator *S = gfxs->Sacc;
+
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    register u16 Sa = MIN( S->RGB.a + 1, 0x100 - D->RGB.a );
+
+                    X->RGB.a =       Y->RGB.a;
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               D++;
+               S++;
+          }
+     }
+     else {
+          while (w--) {
+               if (!(Y->RGB.a & 0xF000)) {
+                    register u16 Sa = MIN( gfxs->color.a + 1, 0x100 - D->RGB.a );
+
+                    X->RGB.a =       Y->RGB.a;
+                    X->RGB.r = (Sa * Y->RGB.r) >> 8;
+                    X->RGB.g = (Sa * Y->RGB.g) >> 8;
+                    X->RGB.b = (Sa * Y->RGB.b) >> 8;
+               } else
+                    *X = *Y;
+
+               X++;
+               Y++;
+               D++;
+          }
+     }
+}
+
+static GenefxFunc Xacc_blend[] = {
+     Xacc_blend_zero,         /* DSBF_ZERO         */
+     Xacc_blend_one,          /* DSBF_ONE          */
+     Xacc_blend_srccolor,     /* DSBF_SRCCOLOR     */
+     Xacc_blend_invsrccolor,  /* DSBF_INVSRCCOLOR  */
+     Xacc_blend_srcalpha,     /* DSBF_SRCALPHA     */
+     Xacc_blend_invsrcalpha,  /* DSBF_INVSRCALPHA  */
+     Xacc_blend_dstalpha,     /* DSBF_DESTALPHA    */
+     Xacc_blend_invdstalpha,  /* DSBF_INVDESTALPHA */
+     Xacc_blend_destcolor,    /* DSBF_DESTCOLOR    */
+     Xacc_blend_invdestcolor, /* DSBF_INVDESTCOLOR */
+     Xacc_blend_srcalphasat   /* DSBF_SRCALPHASAT  */
+};
+
+/********************************* Dacc_modulation ****************************/
+
+static void Dacc_set_alpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     int                a = gfxs->color.a;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a = a;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_modulate_alpha( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     int                a = gfxs->Cacc.RGB.a;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a = (a * D->RGB.a) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_modulate_rgb( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     GenefxAccumulator  Cacc = gfxs->Cacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.r = (Cacc.RGB.r * D->RGB.r) >> 8;
+               D->RGB.g = (Cacc.RGB.g * D->RGB.g) >> 8;
+               D->RGB.b = (Cacc.RGB.b * D->RGB.b) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_modulate_rgb_set_alpha( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     GenefxAccumulator  Cacc = gfxs->Cacc;
+     int                a    = gfxs->color.a;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a = a;
+               D->RGB.r = (Cacc.RGB.r * D->RGB.r) >> 8;
+               D->RGB.g = (Cacc.RGB.g * D->RGB.g) >> 8;
+               D->RGB.b = (Cacc.RGB.b * D->RGB.b) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_modulate_argb( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     GenefxAccumulator  Cacc = gfxs->Cacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a = (Cacc.RGB.a * D->RGB.a) >> 8;
+               D->RGB.r = (Cacc.RGB.r * D->RGB.r) >> 8;
+               D->RGB.g = (Cacc.RGB.g * D->RGB.g) >> 8;
+               D->RGB.b = (Cacc.RGB.b * D->RGB.b) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static GenefxFunc Dacc_modulation[] = {
+     NULL,
+     NULL,
+     Dacc_set_alpha,
+     Dacc_modulate_alpha,
+     Dacc_modulate_rgb,
+     Dacc_modulate_rgb,
+     Dacc_modulate_rgb_set_alpha,
+     Dacc_modulate_argb
+};
+
+/********************************* misc accumulator operations ****************/
+
+static void Dacc_premultiply( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               register u16 Da = D->RGB.a + 1;
+
+               D->RGB.r = (Da * D->RGB.r) >> 8;
+               D->RGB.g = (Da * D->RGB.g) >> 8;
+               D->RGB.b = (Da * D->RGB.b) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_premultiply_color_alpha( GenefxState *gfxs )
+{
+     int                w  = gfxs->length;
+     GenefxAccumulator *D  = gfxs->Dacc;
+     register u16       Ca = gfxs->Cacc.RGB.a;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.r = (Ca * D->RGB.r) >> 8;
+               D->RGB.g = (Ca * D->RGB.g) >> 8;
+               D->RGB.b = (Ca * D->RGB.b) >> 8;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_demultiply( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               register u16 Da = D->RGB.a + 1;
+
+               D->RGB.r = (D->RGB.r << 8) / Da;
+               D->RGB.g = (D->RGB.g << 8) / Da;
+               D->RGB.b = (D->RGB.b << 8) / Da;
+          }
+
+          D++;
+     }
+}
+
+static void Dacc_xor_C( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     DFBColor           color = gfxs->color;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a ^= color.a;
+               D->RGB.r ^= color.r;
+               D->RGB.g ^= color.g;
+               D->RGB.b ^= color.b;
+          }
+
+          D++;
+     }
+}
+
+static GenefxFunc Dacc_xor = Dacc_xor_C;
+
+static void Sacc_xor_Dacc( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a ^= S->RGB.a;
+               D->RGB.r ^= S->RGB.r;
+               D->RGB.g ^= S->RGB.g;
+               D->RGB.b ^= S->RGB.b;
+          }
+          D++;
+          S++;
+     }
+}
+
+static void Cacc_to_Dacc( GenefxState *gfxs )
+{
+     int                w    = gfxs->length;
+     GenefxAccumulator *D    = gfxs->Dacc;
+     GenefxAccumulator  Cacc = gfxs->Cacc;
+
+     while (w--)
+          *D++ = Cacc;
+}
+
+static void SCacc_add_to_Dacc_C( GenefxState *gfxs )
+{
+     int                w     = gfxs->length;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     GenefxAccumulator  SCacc = gfxs->SCacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a += SCacc.RGB.a;
+               D->RGB.r += SCacc.RGB.r;
+               D->RGB.g += SCacc.RGB.g;
+               D->RGB.b += SCacc.RGB.b;
+          }
+          D++;
+     }
+}
+
+static GenefxFunc SCacc_add_to_Dacc = SCacc_add_to_Dacc_C;
+
+static void Sacc_add_to_Dacc_C( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->RGB.a += S->RGB.a;
+               D->RGB.r += S->RGB.r;
+               D->RGB.g += S->RGB.g;
+               D->RGB.b += S->RGB.b;
+          }
+          D++;
+          S++;
+     }
+}
+
+static GenefxFunc Sacc_add_to_Dacc = Sacc_add_to_Dacc_C;
+
+/**********************************************************************************************************************/
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 3 )
+
+#define SET_PIXEL( D, S )                              \
+     if (!(S.RGB.a & 0xF000)) {                        \
+          RGB_TO_YCBCR( S.RGB.r, S.RGB.g, S.RGB.b,     \
+                        D.YUV.y, D.YUV.u, D.YUV.v );   \
+     }
+
+static void Dacc_RGB_to_YCbCr_C( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     GenefxAccumulator *S = gfxs->Dacc;
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+#undef SET_PIXEL
+
+static GenefxFunc Dacc_RGB_to_YCbCr = Dacc_RGB_to_YCbCr_C;
+
+/**********************************************************************************************************************/
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 2 )
+
+#define SET_PIXEL( D, S )                              \
+     if (!(S.YUV.a & 0xF000)) {                        \
+          YCBCR_TO_RGB( S.YUV.y, S.YUV.u, S.YUV.v,     \
+                        D.RGB.r, D.RGB.g, D.RGB.b );   \
+     }
+
+static void Dacc_YCbCr_to_RGB_C( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+     GenefxAccumulator *S = gfxs->Dacc;
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+#undef SET_PIXEL
+
+static GenefxFunc Dacc_YCbCr_to_RGB = Dacc_YCbCr_to_RGB_C;
+
+/**********************************************************************************************************************/
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 3 )
+
+#define SET_PIXEL( D, S )               \
+     switch (S >> 26) {                 \
+          case 0:                       \
+               break;                   \
+          case 0x3f:                    \
+               D = RGB32_TO_RGB16( S ); \
+               break;                   \
+          default:                      \
+               D = (((( (((S>>8) & 0xf800) | ((S>>3) & 0x001f))                                     \
+                        - (D & 0xf81f)) * ((S>>26)+1) + ((D & 0xf81f)<<6)) & 0x003e07c0)            \
+                      +                                                                             \
+                    ((( ((S>>5) & 0x07e0)                                                           \
+                        - (D & 0x07e0)) * ((S>>26)+1) + ((D & 0x07e0)<<6)) & 0x0001f800)) >> 6;     \
+     } while (0)
+
+static void Bop_argb_blend_alphachannel_src_invsrc_Aop_rgb16( GenefxState *gfxs )
+{
+     int  w = gfxs->length;
+     u32 *S = gfxs->Bop[0];
+     u16 *D = gfxs->Aop[0];
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+#undef SET_PIXEL
+
+static void Bop_argb_blend_alphachannel_src_invsrc_Aop_rgb32( GenefxState *gfxs )
+{
+     int  w = gfxs->length;
+     int Dstep = gfxs->Astep;
+     u32 *S = gfxs->Bop[0];
+     u32 *D = gfxs->Aop[0];
+
+     while (w--) {
+          u32 dp32   = *D;
+          u32 sp32   = *S++;
+          int salpha = (sp32 >> 25) + 1;
+
+#define rb (sp32 & 0xff00ff)
+#define g  (sp32 & 0x00ff00)
+
+          *D = ((((rb-(dp32 & 0xff00ff))*salpha+((dp32 & 0xff00ff)<<7)) & 0x7f807f80) +
+                  ((( g-(dp32 & 0x00ff00))*salpha+((dp32 & 0x00ff00)<<7)) & 0x007f8000)) >> 7;
+          D += Dstep;
+
+#undef rb
+#undef g
+     }
+}
+
+static GenefxFunc Bop_argb_blend_alphachannel_src_invsrc_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     NULL,                                             /* DSPF_ARGB1555 */
+     Bop_argb_blend_alphachannel_src_invsrc_Aop_rgb16, /* DSPF_RGB16 */
+     NULL,                                             /* DSPF_RGB24 */
+     Bop_argb_blend_alphachannel_src_invsrc_Aop_rgb32, /* DSPF_RGB32 */
+     NULL,                                             /* DSPF_ARGB */
+     NULL,                                             /* DSPF_A8 */
+     NULL,                                             /* DSPF_YUY2 */
+     NULL,                                             /* DSPF_RGB332 */
+     NULL,                                             /* DSPF_UYVY */
+     NULL,                                             /* DSPF_I420 */
+     NULL,                                             /* DSPF_YV12 */
+     NULL,                                             /* DSPF_LUT8 */
+     NULL,                                             /* DSPF_ALUT44 */
+     NULL,                                             /* DSPF_AiRGB */
+     NULL,                                             /* DSPF_A1 */
+     NULL,                                             /* DSPF_NV12 */
+     NULL,                                             /* DSPF_NV16 */
+     NULL,                                             /* DSPF_ARGB2554 */
+     NULL,                                             /* DSPF_ARGB4444 */
+     NULL,                                             /* DSPF_RGBA4444 */
+     NULL,                                             /* DSPF_NV21 */
+     NULL,                                             /* DSPF_AYUV */
+     NULL,                                             /* DSPF_A4 */
+     NULL,                                             /* DSPF_ARGB1666 */
+     NULL,                                             /* DSPF_ARGB6666 */
+     NULL,                                             /* DSPF_RGB18 */
+     NULL,                                             /* DSPF_LUT2 */
+     NULL,                                             /* DSPF_RGB444 */
+     NULL,                                             /* DSPF_RGB555 */
+     NULL                                              /* DSPF_BGR555 */
+};
+
+/**********************************************************************************************************************/
+
+/* change the last value to adjust the size of the device (1-4) */
+#define SET_PIXEL_DUFFS_DEVICE( D, S, w ) \
+     SET_PIXEL_DUFFS_DEVICE_N( D, S, w, 3 )
+
+#define SET_PIXEL( D, S )                                   \
+do {                                                        \
+     int invsrc = 256 - (S >> 24);                          \
+                                                            \
+     u32 Drb = ((D & 0x00ff00ff) * invsrc) >> 8;            \
+     u32 Dag = ((D & 0xff00ff00) >> 8) * invsrc;            \
+                                                            \
+     D = S + (Drb & 0x00ff00ff) + (Dag & 0xff00ff00);       \
+} while (0)
+
+static void Bop_argb_blend_alphachannel_one_invsrc_Aop_argb( GenefxState *gfxs )
+{
+     int  w = gfxs->length;
+     u32 *S = gfxs->Bop[0];
+     u32 *D = gfxs->Aop[0];
+
+     SET_PIXEL_DUFFS_DEVICE( D, S, w );
+}
+
+#undef SET_PIXEL_DUFFS_DEVICE
+#undef SET_PIXEL
+
+static GenefxFunc Bop_argb_blend_alphachannel_one_invsrc_Aop_PFI[DFB_NUM_PIXELFORMATS] = {
+     NULL,                                             /* DSPF_ARGB1555 */
+     NULL,                                             /* DSPF_RGB16 */
+     NULL,                                             /* DSPF_RGB24 */
+     Bop_argb_blend_alphachannel_one_invsrc_Aop_argb,  /* DSPF_RGB32 */
+     Bop_argb_blend_alphachannel_one_invsrc_Aop_argb,  /* DSPF_ARGB */
+     NULL,                                             /* DSPF_A8 */
+     NULL,                                             /* DSPF_YUY2 */
+     NULL,                                             /* DSPF_RGB332 */
+     NULL,                                             /* DSPF_UYVY */
+     NULL,                                             /* DSPF_I420 */
+     NULL,                                             /* DSPF_YV12 */
+     NULL,                                             /* DSPF_LUT8 */
+     NULL,                                             /* DSPF_ALUT44 */
+     NULL,                                             /* DSPF_AiRGB */
+     NULL,                                             /* DSPF_A1 */
+     NULL,                                             /* DSPF_NV12 */
+     NULL,                                             /* DSPF_NV16 */
+     NULL,                                             /* DSPF_ARGB2554 */
+     NULL,                                             /* DSPF_ARGB4444 */
+     NULL,                                             /* DSPF_RGBA4444 */
+     NULL,                                             /* DSPF_NV21 */
+     NULL,                                             /* DSPF_AYUV */
+     NULL,                                             /* DSPF_A4 */
+     NULL,                                             /* DSPF_ARGB1666 */
+     NULL,                                             /* DSPF_ARGB6666 */
+     NULL,                                             /* DSPF_RGB18 */
+     NULL,                                             /* DSPF_LUT2 */
+     NULL,                                             /* DSPF_RGB444 */
+     NULL,                                             /* DSPF_RGB555 */
+     NULL                                              /* DSPF_BGR555 */
+};
+
+/**********************************************************************************************************************/
+
+/* A8/A1 to YCbCr */
+static void Dacc_Alpha_to_YCbCr( GenefxState *gfxs )
+{
+     int                w = gfxs->length;
+     GenefxAccumulator *D = gfxs->Dacc;
+
+     while (w--) {
+          if (!(D->RGB.a & 0xF000)) {
+               D->YUV.y = 235;
+               D->YUV.u = 128;
+               D->YUV.v = 128;
+          }
+
+          D++;
+     }
+}
+
+/**********************************************************************************************************************/
+
+static void Sop_is_Aop( GenefxState *gfxs ) { gfxs->Sop = gfxs->Aop; gfxs->Ostep = gfxs->Astep; }
+static void Sop_is_Bop( GenefxState *gfxs ) { gfxs->Sop = gfxs->Bop; gfxs->Ostep = gfxs->Bstep; }
+
+static void Slut_is_Alut( GenefxState *gfxs ) { gfxs->Slut = gfxs->Alut;}
+static void Slut_is_Blut( GenefxState *gfxs ) { gfxs->Slut = gfxs->Blut;}
+
+static void Sacc_is_NULL( GenefxState *gfxs ) { gfxs->Sacc = NULL;}
+static void Sacc_is_Aacc( GenefxState *gfxs ) { gfxs->Sacc = gfxs->Aacc;}
+static void Sacc_is_Bacc( GenefxState *gfxs ) { gfxs->Sacc = gfxs->Bacc;}
+static void Sacc_is_Tacc( GenefxState *gfxs ) { gfxs->Sacc = gfxs->Tacc;}
+
+static void Dacc_is_Aacc( GenefxState *gfxs ) { gfxs->Dacc = gfxs->Aacc;}
+static void Dacc_is_Bacc( GenefxState *gfxs ) { gfxs->Dacc = gfxs->Bacc;}
+
+static void Xacc_is_Aacc( GenefxState *gfxs ) { gfxs->Xacc = gfxs->Aacc;}
+static void Xacc_is_Bacc( GenefxState *gfxs ) { gfxs->Xacc = gfxs->Bacc;}
+static void Xacc_is_Tacc( GenefxState *gfxs ) { gfxs->Xacc = gfxs->Tacc;}
+
+static void Yacc_is_Aacc( GenefxState *gfxs ) { gfxs->Yacc = gfxs->Aacc;}
+static void Yacc_is_Bacc( GenefxState *gfxs ) { gfxs->Yacc = gfxs->Bacc;}
+
+static void Len_is_Slen( GenefxState *gfxs )  { gfxs->length = gfxs->Slen;}
+static void Len_is_Dlen( GenefxState *gfxs )  { gfxs->length = gfxs->Dlen;}
+
+/******************************************************************************/
+
+#ifdef USE_MMX
+static bool has_mmx( void )
+{
+#ifdef ARCH_X86_64
+     return true;
+#else
+     u32 a, b, c, d;
+
+     asm( "pushfl             \n"
+          "pushfl             \n"
+          "popl %0            \n"
+          "movl %0, %1        \n"
+          "xorl $0x200000, %0 \n"
+          "pushl %0           \n"
+          "popfl              \n"
+          "pushfl             \n"
+          "popl %0            \n"
+          "popfl"
+          : "=a" (a), "=r" (b)
+          :
+          : "cc" );
+
+     if (a == b)
+          return false;
+
+     asm( "pushl %%ebx        \n"
+          "cpuid              \n"
+          "movl %%ebx, %1     \n"
+          "popl %%ebx"
+          : "=a" (a), "=r" (b), "=c" (c), "=d" (d)
+          : "a" (0)
+          : "cc" );
+
+     if (!a)
+          return false;
+
+     asm( "pushl %%ebx        \n"
+          "cpuid              \n"
+          "movl %%ebx, %1     \n"
+          "popl %%ebx"
+          : "=a" (a), "=r" (b), "=c" (c), "=d" (d)
+          : "a" (1)
+          : "cc" );
+
+     return (d & 0x800000) ? true : false;
+#endif /* !ARCH_X86_64 */
+}
+#endif
+
+void gGetDriverInfo( GraphicsDriverInfo *info )
+{
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, "Software Driver" );
+
+#if SIZEOF_LONG == 8
+     gInit_64bit();
+#endif
+
+#ifdef USE_MMX
+     if (has_mmx()) {
+          if (!dfb_config->mmx) {
+               D_INFO( "DirectFB/Genefx: MMX detected, but disabled by option 'no-mmx'\n");
+          }
+          else {
+               gInit_MMX();
+
+               snprintf( info->name, DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+                         "MMX Software Driver" );
+
+               D_INFO( "DirectFB/Genefx: MMX detected and enabled\n");
+          }
+     }
+     else {
+          D_INFO( "DirectFB/Genefx: No MMX detected\n" );
+     }
+#endif
+
+     snprintf( info->vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 6;
+}
+
+void gGetDeviceInfo( GraphicsDeviceInfo *info )
+{
+     snprintf( info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,
+               "Software Rasterizer" );
+
+     snprintf( info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH,
+               use_mmx ? "MMX" : "Generic" );
+
+     info->caps.accel    = DFXL_NONE;
+     info->caps.flags    = 0;
+     info->caps.drawing  = DSDRAW_NOFX;
+     info->caps.blitting = DSBLIT_NOFX;
+}
+
+#define MODULATION_FLAGS (DSBLIT_BLEND_ALPHACHANNEL |  \
+                          DSBLIT_BLEND_COLORALPHA |    \
+                          DSBLIT_COLORIZE |            \
+                          DSBLIT_DST_PREMULTIPLY  |    \
+                          DSBLIT_SRC_PREMULTIPLY  |    \
+                          DSBLIT_SRC_PREMULTCOLOR |    \
+                          DSBLIT_DEMULTIPLY       |    \
+                          DSBLIT_XOR)
+
+#ifndef WORDS_BIGENDIAN
+#define BGR_TO_RGB16(pixel)  ( (((pixel) <<  8) & 0xF800) | \
+                               (((pixel) >>  5) & 0x07E0) | \
+                               (((pixel) >> 19) & 0x001F) )
+
+/*
+ * Fast RGB24 to RGB16 conversion.
+ */
+static void
+Bop_rgb24_to_Aop_rgb16_LE( GenefxState *gfxs )
+{
+     int  w = gfxs->length;
+     u8  *S = gfxs->Bop[0];
+     u16 *D = gfxs->Aop[0];
+
+     while ((unsigned long)S & 3) {
+          *D++ = PIXEL_RGB16( S[0], S[1], S[2] );
+
+          S += 3;
+          w -= 1;
+     }
+
+     if ((unsigned long)D & 2) {
+          *D++ = PIXEL_RGB16( S[0], S[1], S[2] );
+
+          w -= 1;
+          S += 3;
+
+          while (w > 1) {
+               *(u32*)D = PIXEL_RGB16( S[0], S[1], S[2] ) | (PIXEL_RGB16( S[3], S[4], S[5] ) << 16);
+
+               w -= 2;
+               D += 2;
+               S += 6;
+          }
+     }
+     else {
+          u32 *S32 = (u32*)S;
+          u32 *D32 = (u32*)D;
+
+          while (w > 3) {
+               D32[0] = BGR_TO_RGB16(  S32[0] ) | (BGR_TO_RGB16( (S32[0] >> 24) | (S32[1] <<  8) ) << 16);
+               D32[1] = BGR_TO_RGB16( (S32[1] >> 16) | (S32[2] << 16) ) | (BGR_TO_RGB16( S32[2] >> 8 ) << 16);
+
+               D32 += 2;
+               S32 += 3;
+               w   -= 4;
+          }
+
+          S = (u8*)  S32;
+          D = (u16*) D32;
+     }
+
+     while (w > 0) {
+          *D++ = PIXEL_RGB16( S[0], S[1], S[2] );
+
+          w -= 1;
+          S += 3;
+     }
+}
+
+/*
+ * Fast RGB32 to RGB16 conversion.
+ */
+static void
+Bop_rgb32_to_Aop_rgb16_LE( GenefxState *gfxs )
+{
+     int  w = gfxs->length;
+     u32 *S = gfxs->Bop[0];
+     u32 *D = gfxs->Aop[0];
+
+     if ((unsigned long)D & 2) {
+          u16 *d = (u16*)D;
+
+          d[0] = RGB32_TO_RGB16( S[0] );
+
+          w--;
+          S++;
+
+          D = (u32*)(d+1);
+     }
+
+     while (w > 1) {
+          D[0] = RGB32_TO_RGB16( S[0] ) | (RGB32_TO_RGB16( S[1] ) << 16);
+
+          w -= 2;
+          S += 2;
+          D += 1;
+     }
+
+     if (w > 0) {
+          u16 *d = (u16*)D;
+
+          d[0] = RGB32_TO_RGB16( S[0] );
+     }
+}
+#endif  /* #ifndef WORDS_BIGENDIAN */
+
+bool gAcquire( CardState *state, DFBAccelerationMask accel )
+{
+     DFBResult    ret;
+     GenefxState *gfxs;
+     GenefxFunc  *funcs;
+     int          dst_pfi;
+     int          src_pfi     = 0;
+     CoreSurface *destination = state->destination;
+     CoreSurface *source      = state->source;
+     DFBColor     color       = state->color;
+     bool         src_ycbcr   = false;
+     bool         dst_ycbcr   = false;
+
+     CoreSurfaceAccessFlags access = CSAF_WRITE;
+
+     if (dfb_config->hardware_only) {
+          if (dfb_config->software_warn) {
+               if (DFB_BLITTING_FUNCTION( accel ))
+                    D_WARN( "Ignoring blit (%x) from %s to %s, flags 0x%08x, funcs %d %d", accel,
+                            source ? dfb_pixelformat_name(source->config.format) : "NULL SOURCE",
+                            destination ? dfb_pixelformat_name(destination->config.format) : "NULL DESTINATION",
+                            state->blittingflags, state->src_blend, state->dst_blend );
+               else
+                    D_WARN( "Ignoring draw (%x) to %s, flags 0x%08x", accel,
+                            destination ? dfb_pixelformat_name(destination->config.format) : "NULL DESTINATION",
+                            state->drawingflags );
+          }
+
+          return false;
+     }
+
+     if (!state->gfxs) {
+          gfxs = D_CALLOC( 1, sizeof(GenefxState) );
+          if (!gfxs) {
+               D_ERROR( "DirectFB/Genefx: Couldn't allocate state struct!\n" );
+               return false;
+          }
+
+          state->gfxs = gfxs;
+     }
+
+     gfxs  = state->gfxs;
+     funcs = gfxs->funcs;
+
+     /* Destination may have been destroyed. */
+     if (!destination)
+          return false;
+
+     /* Source may have been destroyed. */
+     if (DFB_BLITTING_FUNCTION( accel ) && !source)
+          return false;
+
+     /*
+      * Destination setup
+      */
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                      DSBLIT_BLEND_COLORALPHA   |
+                                      DSBLIT_DST_COLORKEY))
+               access |= CSAF_READ;
+     }
+     else if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_DST_COLORKEY))
+          access |= CSAF_READ;
+
+     /* Lock destination */
+     ret = dfb_surface_lock_buffer( destination, state->to, CSAID_CPU, access, &state->dst );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/Genefx: Could not lock destination!\n" );
+          return false;
+     }
+
+     gfxs->dst_caps   = destination->config.caps;
+     gfxs->dst_height = destination->config.size.h;
+     gfxs->dst_format = destination->config.format;
+     gfxs->dst_bpp    = DFB_BYTES_PER_PIXEL( gfxs->dst_format );
+     dst_pfi          = DFB_PIXELFORMAT_INDEX( gfxs->dst_format );
+
+     gfxs->dst_org[0] = state->dst.addr;
+     gfxs->dst_pitch  = state->dst.pitch;
+
+     switch (gfxs->dst_format) {
+          case DSPF_I420:
+               gfxs->dst_org[1] = gfxs->dst_org[0] + gfxs->dst_height * gfxs->dst_pitch;
+               gfxs->dst_org[2] = gfxs->dst_org[1] + gfxs->dst_height/2 * gfxs->dst_pitch/2;
+               break;
+          case DSPF_YV12:
+               gfxs->dst_org[2] = gfxs->dst_org[0] + gfxs->dst_height * gfxs->dst_pitch;
+               gfxs->dst_org[1] = gfxs->dst_org[2] + gfxs->dst_height/2 * gfxs->dst_pitch/2;
+               break;
+          case DSPF_NV12:
+          case DSPF_NV21:
+          case DSPF_NV16:
+               gfxs->dst_org[1] = gfxs->dst_org[0] + gfxs->dst_height * gfxs->dst_pitch;
+               break;
+          default:
+               break;
+     }
+
+     gfxs->dst_field_offset = gfxs->dst_height/2 * gfxs->dst_pitch;
+
+
+     /*
+      * Source setup
+      */
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+#if FIXME_SC_3
+          DFBSurfaceLockFlags flags = DSLF_READ;
+
+          if (accel == DFXL_STRETCHBLIT)
+               flags |= CSLF_FORCE;
+#endif
+
+          /* Lock source */
+          ret = dfb_surface_lock_buffer( source, state->from, CSAID_CPU, CSAF_READ, &state->src );
+          if (ret) {
+               D_DERROR( ret, "DirectFB/Genefx: Could not lock source!\n" );
+               dfb_surface_unlock_buffer( destination, &state->dst );
+               return false;
+          }
+
+          gfxs->src_caps   = source->config.caps;
+          gfxs->src_height = source->config.size.h;
+          gfxs->src_format = source->config.format;
+          gfxs->src_bpp    = DFB_BYTES_PER_PIXEL( gfxs->src_format );
+          src_pfi          = DFB_PIXELFORMAT_INDEX( gfxs->src_format );
+
+          gfxs->src_org[0] = state->src.addr;
+          gfxs->src_pitch  = state->src.pitch;
+
+          switch (gfxs->src_format) {
+               case DSPF_I420:
+                    gfxs->src_org[1] = gfxs->src_org[0] + gfxs->src_height * gfxs->src_pitch;
+                    gfxs->src_org[2] = gfxs->src_org[1] + gfxs->src_height/2 * gfxs->src_pitch/2;
+                    break;
+               case DSPF_YV12:
+                    gfxs->src_org[2] = gfxs->src_org[0] + gfxs->src_height * gfxs->src_pitch;
+                    gfxs->src_org[1] = gfxs->src_org[2] + gfxs->src_height/2 * gfxs->src_pitch/2;
+                    break;
+               case DSPF_NV12:
+               case DSPF_NV21:
+               case DSPF_NV16:
+                    gfxs->src_org[1] = gfxs->src_org[0] + gfxs->src_height * gfxs->src_pitch;
+                    break;
+               default:
+                    break;
+          }
+
+          gfxs->src_field_offset = gfxs->src_height/2 * gfxs->src_pitch;
+
+          state->flags |= CSF_SOURCE_LOCKED;
+     }
+
+
+     /* premultiply source (color) */
+     if (DFB_DRAWING_FUNCTION(accel) && (state->drawingflags & DSDRAW_SRC_PREMULTIPLY)) {
+          u16 ca = color.a + 1;
+
+          color.r = (color.r * ca) >> 8;
+          color.g = (color.g * ca) >> 8;
+          color.b = (color.b * ca) >> 8;
+     }
+
+
+     gfxs->color = color;
+
+
+     switch (gfxs->dst_format) {
+          case DSPF_ARGB1555:
+               gfxs->Cop = PIXEL_ARGB1555( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_RGB16:
+               gfxs->Cop = PIXEL_RGB16( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB18:
+               gfxs->Cop = PIXEL_RGB18( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB24:
+               gfxs->Cop = PIXEL_RGB32( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB32:
+               gfxs->Cop = PIXEL_RGB32( color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB:
+               gfxs->Cop = PIXEL_ARGB( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_AiRGB:
+               gfxs->Cop = PIXEL_AiRGB( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB6666:
+               gfxs->Cop = PIXEL_ARGB6666( color.a, color.r, color.g, color.b ); 
+               break;
+          case DSPF_ARGB1666:
+               gfxs->Cop = PIXEL_ARGB1666( color.a, color.r, color.g, color.b ); 
+               break;
+          case DSPF_A1:
+               gfxs->Cop = color.a >> 7;
+               break;
+          case DSPF_A4:
+               gfxs->Cop = color.a >> 4;
+               break;
+          case DSPF_A8:
+               gfxs->Cop = color.a;
+               break;
+          case DSPF_YUY2:
+               RGB_TO_YCBCR( color.r, color.g, color.b,
+                             gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               gfxs->Cop = PIXEL_YUY2( gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               dst_ycbcr = true;
+               break;
+          case DSPF_RGB332:
+               gfxs->Cop = PIXEL_RGB332( color.r, color.g, color.b );
+               break;
+          case DSPF_UYVY:
+               RGB_TO_YCBCR( color.r, color.g, color.b,
+                             gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               gfxs->Cop = PIXEL_UYVY( gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               dst_ycbcr = true;
+               break;
+          case DSPF_I420:
+          case DSPF_YV12:
+          case DSPF_NV12:
+          case DSPF_NV16:
+               RGB_TO_YCBCR( color.r, color.g, color.b,
+                             gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               gfxs->Cop = gfxs->YCop;
+               dst_ycbcr = true;
+               break;
+          case DSPF_NV21:
+               RGB_TO_YCBCR( color.r, color.g, color.b,
+                             gfxs->YCop, gfxs->CrCop, gfxs->CbCop );
+               gfxs->Cop = gfxs->YCop;
+               dst_ycbcr = true;
+               break;
+          case DSPF_LUT2:
+          case DSPF_LUT8:
+               gfxs->Cop  = state->color_index;
+               gfxs->Alut = destination->palette;
+               break;
+          case DSPF_ALUT44:
+               gfxs->Cop  = (color.a & 0xF0) + state->color_index;
+               gfxs->Alut = destination->palette;
+               break;
+          case DSPF_ARGB2554:
+               gfxs->Cop = PIXEL_ARGB2554( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_ARGB4444:
+               gfxs->Cop = PIXEL_ARGB4444( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_RGBA4444:
+               gfxs->Cop = PIXEL_RGBA4444( color.a, color.r, color.g, color.b );
+               break;
+          case DSPF_AYUV:
+               RGB_TO_YCBCR( color.r, color.g, color.b,
+                             gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               gfxs->Cop = PIXEL_AYUV( color.a, gfxs->YCop, gfxs->CbCop, gfxs->CrCop );
+               dst_ycbcr = true;
+               break;
+          case DSPF_RGB444:
+               gfxs->Cop = PIXEL_RGB444( color.r, color.g, color.b );
+               break;
+          case DSPF_RGB555:
+               gfxs->Cop = PIXEL_RGB555( color.r, color.g, color.b );
+               break;
+          case DSPF_BGR555:
+               gfxs->Cop = PIXEL_BGR555( color.r, color.g, color.b );
+               break;
+          default:
+               D_ONCE("unsupported destination format");
+               return false;
+     }
+
+     if (DFB_BLITTING_FUNCTION( accel )) {
+          switch (gfxs->src_format) {
+               case DSPF_LUT2:
+               case DSPF_LUT8:
+               case DSPF_ALUT44:
+                    gfxs->Blut = source->palette;
+               case DSPF_ARGB1555:
+               case DSPF_ARGB2554:
+               case DSPF_ARGB4444:
+               case DSPF_RGBA4444:
+               case DSPF_ARGB1666:
+               case DSPF_ARGB6666:
+               case DSPF_RGB16:
+               case DSPF_RGB18:
+               case DSPF_RGB24:
+               case DSPF_RGB32:
+               case DSPF_ARGB:
+               case DSPF_AiRGB:
+               case DSPF_RGB332:
+               case DSPF_RGB444:
+               case DSPF_RGB555:
+               case DSPF_BGR555:
+                    if (dst_ycbcr &&
+                        state->blittingflags & (DSBLIT_COLORIZE |
+                                                DSBLIT_SRC_PREMULTCOLOR))
+                         return false;
+               case DSPF_A1:
+               case DSPF_A4:
+               case DSPF_A8:
+                    if (DFB_PLANAR_PIXELFORMAT(gfxs->dst_format) &&
+                        state->blittingflags & DSBLIT_DST_COLORKEY)
+                         return false;
+                    break;
+               case DSPF_I420:
+               case DSPF_YV12:
+               case DSPF_NV12:
+               case DSPF_NV21:
+               case DSPF_NV16:
+                    if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+                         return false;
+               case DSPF_YUY2:
+               case DSPF_UYVY:
+               case DSPF_AYUV:
+                    if (dst_ycbcr) {
+                         if (state->blittingflags & (DSBLIT_COLORIZE     |
+                                                     DSBLIT_SRC_PREMULTCOLOR))
+                              return false;
+
+                         if (DFB_PLANAR_PIXELFORMAT(gfxs->dst_format) &&
+                             state->blittingflags & DSBLIT_DST_COLORKEY)
+                              return false;
+                    }
+                    src_ycbcr = true;
+                    break;
+               default:
+                    D_ONCE("unsupported source format");
+                    return false;
+          }
+     }
+
+     gfxs->need_accumulator = true;
+
+     /* Initialization */
+     gfxs->Astep = gfxs->Bstep = gfxs->Ostep = 1;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+          case DFXL_DRAWRECTANGLE:
+          case DFXL_DRAWLINE:
+          case DFXL_FILLTRIANGLE:
+               if (state->drawingflags & ~(DSDRAW_DST_COLORKEY | DSDRAW_SRC_PREMULTIPLY)) {
+                    GenefxAccumulator Cacc, SCacc;
+
+                    /* not yet completed optimizing checks */
+                    if (state->drawingflags & DSDRAW_BLEND) {
+                         if (state->src_blend == DSBF_ZERO) {
+                              if (state->dst_blend == DSBF_ZERO) {
+                                   gfxs->Cop = 0;
+                                   if (state->drawingflags & DSDRAW_DST_COLORKEY) {
+                                        gfxs->Dkey = state->dst_colorkey;
+                                        *funcs++ = Cop_toK_Aop_PFI[dst_pfi];
+                                   }
+                                   else
+                                        *funcs++ = Cop_to_Aop_PFI[dst_pfi];
+                                   break;
+                              }
+                              else if (state->dst_blend == DSBF_ONE) {
+                                   break;
+                              }
+                         }
+                         else if (state->src_blend == DSBF_ONE && state->dst_blend == DSBF_ZERO) {
+                              if (state->drawingflags & DSDRAW_DST_COLORKEY) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Cop_toK_Aop_PFI[dst_pfi];
+                              }
+                              else
+                                   *funcs++ = Cop_to_Aop_PFI[dst_pfi];
+                              break;
+                         }
+                    }
+
+                    /* load from destination */
+                    *funcs++ = Sop_is_Aop;
+                    if (DFB_PIXELFORMAT_IS_INDEXED(gfxs->dst_format))
+                         *funcs++ = Slut_is_Alut;
+                    *funcs++ = Dacc_is_Aacc;
+                    *funcs++ = Sop_PFI_to_Dacc[dst_pfi];
+
+                    /* premultiply destination */
+                    if (state->drawingflags & DSDRAW_DST_PREMULTIPLY)
+                         *funcs++ = Dacc_premultiply;
+
+                    /* xor destination */
+                    if (state->drawingflags & DSDRAW_XOR)
+                         *funcs++ = Dacc_xor;
+
+                    /* load source (color) */
+                    Cacc.RGB.a = color.a;
+                    if (!dst_ycbcr) {
+                         Cacc.RGB.r = color.r;
+                         Cacc.RGB.g = color.g;
+                         Cacc.RGB.b = color.b;
+                    } else {
+                         Cacc.YUV.y = gfxs->YCop;
+                         Cacc.YUV.u = gfxs->CbCop;
+                         Cacc.YUV.v = gfxs->CrCop;
+                    }
+
+                    /* premultiply source (color) */
+                    /*if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) {
+                         u16 ca = color.a + 1;
+
+                         Cacc.r = (Cacc.r * ca) >> 8;
+                         Cacc.g = (Cacc.g * ca) >> 8;
+                         Cacc.b = (Cacc.b * ca) >> 8;
+                    }*/
+
+                    if (state->drawingflags & DSDRAW_BLEND) {
+                         /* source blending */
+                         switch (state->src_blend) {
+                              case DSBF_ZERO:
+                                   break;
+                              case DSBF_ONE:
+                                   SCacc = Cacc;
+                                   break;
+                              case DSBF_SRCCOLOR:
+                                   SCacc.RGB.a = (Cacc.RGB.a * (Cacc.RGB.a + 1)) >> 8;
+                                   SCacc.RGB.r = (Cacc.RGB.r * (Cacc.RGB.r + 1)) >> 8;
+                                   SCacc.RGB.g = (Cacc.RGB.g * (Cacc.RGB.g + 1)) >> 8;
+                                   SCacc.RGB.b = (Cacc.RGB.b * (Cacc.RGB.b + 1)) >> 8;
+                                   break;
+                              case DSBF_INVSRCCOLOR:
+                                   SCacc.RGB.a = (Cacc.RGB.a * (0x100 - Cacc.RGB.a)) >> 8;
+                                   SCacc.RGB.r = (Cacc.RGB.r * (0x100 - Cacc.RGB.r)) >> 8;
+                                   SCacc.RGB.g = (Cacc.RGB.g * (0x100 - Cacc.RGB.g)) >> 8;
+                                   SCacc.RGB.b = (Cacc.RGB.b * (0x100 - Cacc.RGB.b)) >> 8;
+                                   break;
+                              case DSBF_SRCALPHA: {
+                                        u16 ca = color.a + 1;
+
+                                        SCacc.RGB.a = (Cacc.RGB.a * ca) >> 8;
+                                        SCacc.RGB.r = (Cacc.RGB.r * ca) >> 8;
+                                        SCacc.RGB.g = (Cacc.RGB.g * ca) >> 8;
+                                        SCacc.RGB.b = (Cacc.RGB.b * ca) >> 8;
+                                        break;
+                                   }
+                              case DSBF_INVSRCALPHA: {
+                                        u16 ca = 0x100 - color.a;
+
+                                        SCacc.RGB.a = (Cacc.RGB.a * ca) >> 8;
+                                        SCacc.RGB.r = (Cacc.RGB.r * ca) >> 8;
+                                        SCacc.RGB.g = (Cacc.RGB.g * ca) >> 8;
+                                        SCacc.RGB.b = (Cacc.RGB.b * ca) >> 8;
+                                        break;
+                                   }
+                              case DSBF_SRCALPHASAT:
+                                   *funcs++ = Sacc_is_NULL;
+                              case DSBF_DESTALPHA:
+                              case DSBF_INVDESTALPHA:
+                              case DSBF_DESTCOLOR:
+                              case DSBF_INVDESTCOLOR:
+                                   *funcs++ = Dacc_is_Bacc;
+                                   *funcs++ = Cacc_to_Dacc;
+
+                                   *funcs++ = Dacc_is_Aacc;
+                                   *funcs++ = Xacc_is_Bacc;
+                                   *funcs++ = Yacc_is_Bacc;
+                                   *funcs++ = Xacc_blend[state->src_blend - 1];
+
+                                   break;
+
+                              default:
+                                   D_BUG( "unknown src_blend %d", state->src_blend );
+                         }
+
+
+                         /* destination blending */
+                         *funcs++ = Sacc_is_NULL;
+                         *funcs++ = Xacc_is_Aacc;
+                         *funcs++ = Yacc_is_Aacc;
+
+                         if (state->dst_blend > D_ARRAY_SIZE(Xacc_blend) || state->dst_blend < 1)
+                              D_BUG( "unknown dst_blend %d", state->dst_blend );
+                         else
+                              *funcs++ = Xacc_blend[state->dst_blend - 1];
+
+                         /* add source to destination accumulator */
+                         switch (state->src_blend) {
+                              case DSBF_ZERO:
+                                   break;
+                              case DSBF_ONE:
+                              case DSBF_SRCCOLOR:
+                              case DSBF_INVSRCCOLOR:
+                              case DSBF_SRCALPHA:
+                              case DSBF_INVSRCALPHA:
+                                   if (SCacc.RGB.a || SCacc.RGB.r ||
+                                       SCacc.RGB.g || SCacc.RGB.b)
+                                        *funcs++ = SCacc_add_to_Dacc;
+                                   break;
+                              case DSBF_DESTALPHA:
+                              case DSBF_INVDESTALPHA:
+                              case DSBF_DESTCOLOR:
+                              case DSBF_INVDESTCOLOR:
+                              case DSBF_SRCALPHASAT:
+                                   *funcs++ = Sacc_is_Bacc;
+                                   *funcs++ = Sacc_add_to_Dacc;
+                                   break;
+
+                              default:
+                                   D_BUG( "unknown src_blend %d", state->src_blend );
+                         }
+                    }
+
+                    /* demultiply result */
+                    if (state->drawingflags & DSDRAW_DEMULTIPLY)
+                         *funcs++ = Dacc_demultiply;
+
+                    /* write to destination */
+                    *funcs++ = Sacc_is_Aacc;
+                    if (state->drawingflags & DSDRAW_DST_COLORKEY) {
+                         gfxs->Dkey = state->dst_colorkey;
+                         *funcs++ = Sacc_toK_Aop_PFI[dst_pfi];
+                    }
+                    else
+                         *funcs++ = Sacc_to_Aop_PFI[dst_pfi];
+
+                    /* store computed Cacc */
+                    gfxs->Cacc  = Cacc;
+                    gfxs->SCacc = SCacc;
+               }
+               else {
+                    gfxs->need_accumulator = false;
+                    
+                    if (state->drawingflags & DSDRAW_DST_COLORKEY) {
+                         gfxs->Dkey = state->dst_colorkey;
+                         *funcs++ = Cop_toK_Aop_PFI[dst_pfi];
+                    }
+                    else
+                         *funcs++ = Cop_to_Aop_PFI[dst_pfi];
+               }
+               break;
+          case DFXL_BLIT:
+               if (state->blittingflags == DSBLIT_BLEND_ALPHACHANNEL &&
+                   state->src_blend     == DSBF_SRCALPHA             &&
+                   state->dst_blend     == DSBF_INVSRCALPHA)
+               {
+                    if (gfxs->src_format == DSPF_ARGB &&
+                        Bop_argb_blend_alphachannel_src_invsrc_Aop_PFI[dst_pfi])
+                    {
+                         *funcs++ = Bop_argb_blend_alphachannel_src_invsrc_Aop_PFI[dst_pfi];
+                         break;
+                    }
+               }
+               if (state->blittingflags == DSBLIT_BLEND_ALPHACHANNEL &&
+                   state->src_blend     == DSBF_ONE                  &&
+                   state->dst_blend     == DSBF_INVSRCALPHA)
+               {
+                    if (gfxs->src_format == DSPF_ARGB &&
+                        Bop_argb_blend_alphachannel_one_invsrc_Aop_PFI[dst_pfi])
+                    {
+                         *funcs++ = Bop_argb_blend_alphachannel_one_invsrc_Aop_PFI[dst_pfi];
+                         break;
+                    }
+               }
+               if (((state->blittingflags == (DSBLIT_COLORIZE | DSBLIT_BLEND_ALPHACHANNEL |
+                                              DSBLIT_SRC_PREMULTIPLY) &&
+                     state->src_blend == DSBF_ONE)
+                    ||
+                    (state->blittingflags == (DSBLIT_COLORIZE | DSBLIT_BLEND_ALPHACHANNEL) &&
+                     state->src_blend == DSBF_SRCALPHA))
+                   &&
+                   state->dst_blend == DSBF_INVSRCALPHA)
+               {
+                    if (gfxs->src_format == DSPF_A8 && Bop_a8_set_alphapixel_Aop_PFI[dst_pfi]) {
+                         *funcs++ = Bop_a8_set_alphapixel_Aop_PFI[dst_pfi];
+                         break;
+                    }
+                    if (gfxs->src_format == DSPF_A1 && Bop_a1_set_alphapixel_Aop_PFI[dst_pfi]) {
+                         *funcs++ = Bop_a1_set_alphapixel_Aop_PFI[dst_pfi];
+                         break;
+                    }
+               }
+#ifndef WORDS_BIGENDIAN
+               if (state->blittingflags       == DSBLIT_NOFX &&
+                   source->config.format      == DSPF_RGB24 &&
+                   destination->config.format == DSPF_RGB16)
+               {
+                    *funcs++ = Bop_rgb24_to_Aop_rgb16_LE;
+                    break;
+               }
+               if (state->blittingflags == DSBLIT_NOFX &&
+                   (source->config.format == DSPF_RGB32 || source->config.format == DSPF_ARGB) &&
+                   destination->config.format == DSPF_RGB16)
+               {
+                    *funcs++ = Bop_rgb32_to_Aop_rgb16_LE;
+                    break;
+               }
+#endif
+               /* fallthru */
+          case DFXL_STRETCHBLIT: {
+                    int  modulation = state->blittingflags & MODULATION_FLAGS;
+
+                    if (modulation) {
+                         bool read_destination = false;
+                         bool source_needs_destination = false;
+                         bool scale_from_accumulator;
+
+                         /* check if destination has to be read */
+                         if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL |
+                                                     DSBLIT_BLEND_COLORALPHA)) {
+                              switch (state->src_blend) {
+                                   case DSBF_DESTALPHA:
+                                   case DSBF_DESTCOLOR:
+                                   case DSBF_INVDESTALPHA:
+                                   case DSBF_INVDESTCOLOR:
+                                   case DSBF_SRCALPHASAT:
+                                        source_needs_destination = true;
+                                   default:
+                                        ;
+                              }
+
+                              read_destination = source_needs_destination        ||
+                                                 (state->dst_blend != DSBF_ZERO) ||
+                                                 (state->blittingflags & DSBLIT_XOR);
+                         }
+                         else if (state->blittingflags & DSBLIT_XOR) {
+                              read_destination = true;
+                         }
+
+                         scale_from_accumulator = !read_destination &&
+                                                  (accel == DFXL_STRETCHBLIT);
+
+                         /* read the destination if needed */
+                         if (read_destination) {
+                              *funcs++ = Sop_is_Aop;
+                              if (DFB_PIXELFORMAT_IS_INDEXED(gfxs->dst_format))
+                                   *funcs++ = Slut_is_Alut;
+                              *funcs++ = Dacc_is_Aacc;
+                              *funcs++ = Sop_PFI_to_Dacc[dst_pfi];
+
+                              if (state->blittingflags & DSBLIT_DST_PREMULTIPLY)
+                                   *funcs++ = Dacc_premultiply;
+                         }
+                         else if (scale_from_accumulator) {
+                              *funcs++ = Len_is_Slen;
+                         }
+
+                         /* read the source */
+                         *funcs++ = Sop_is_Bop;
+                         if (DFB_PIXELFORMAT_IS_INDEXED(gfxs->src_format))
+                              *funcs++ = Slut_is_Blut;
+                         *funcs++ = Dacc_is_Bacc;
+                         if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+                              gfxs->Skey = state->src_colorkey;
+                              if (accel == DFXL_BLIT || scale_from_accumulator)
+                                   *funcs++ = Sop_PFI_Kto_Dacc[src_pfi];
+                              else
+                                   *funcs++ = Sop_PFI_SKto_Dacc[src_pfi];
+                         }
+                         else {
+                              if (accel == DFXL_BLIT || scale_from_accumulator)
+                                   *funcs++ = Sop_PFI_to_Dacc[src_pfi];
+                              else
+                                   *funcs++ = Sop_PFI_Sto_Dacc[src_pfi];
+                         }
+
+                         if (!src_ycbcr && dst_ycbcr) {
+                              if (DFB_COLOR_BITS_PER_PIXEL(gfxs->src_format))
+                                   *funcs++ = Dacc_RGB_to_YCbCr;
+                              /*else
+                                   *funcs++ = Dacc_Alpha_to_YCbCr;*/
+                         }
+                         else if (src_ycbcr && !dst_ycbcr) {
+                              if (DFB_COLOR_BITS_PER_PIXEL(gfxs->dst_format))
+                                   *funcs++ = Dacc_YCbCr_to_RGB;
+                         }
+
+                         /* Premultiply color alpha? */
+                         if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+                              gfxs->Cacc.RGB.a = color.a + 1;
+                              *funcs++ = Dacc_premultiply_color_alpha;
+                         }
+
+                         /* modulate the source if requested */
+                         if (Dacc_modulation[modulation & 0x7]) {
+                              /* modulation source */
+                              gfxs->Cacc.RGB.a = color.a + 1;
+                              if (!dst_ycbcr) {
+                                   gfxs->Cacc.RGB.r = color.r + 1;
+                                   gfxs->Cacc.RGB.g = color.g + 1;
+                                   gfxs->Cacc.RGB.b = color.b + 1;
+                              } else {
+                                   gfxs->Cacc.YUV.y = gfxs->YCop  + 1;
+                                   gfxs->Cacc.YUV.u = gfxs->CbCop + 1;
+                                   gfxs->Cacc.YUV.v = gfxs->CrCop + 1;
+                              }
+
+                              *funcs++ = Dacc_modulation[modulation & 0x7];
+                         }
+
+                         /* Premultiply (modulated) source alpha? */
+                         if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY)
+                              *funcs++ = Dacc_premultiply;
+
+                         /* Xor source with destination */
+                         if (state->blittingflags & DSBLIT_XOR) {
+                              *funcs++ = Sacc_is_Aacc;
+                              *funcs++ = Dacc_is_Bacc;
+                              *funcs++ = Sacc_xor_Dacc;
+                         }
+
+                         /* do blend functions and combine both accumulators */
+                         if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+                              /* Xacc will be blended and written to while
+                                 Sacc and Dacc point to the SRC and DST
+                                 as referenced by the blending functions */
+                              *funcs++ = Sacc_is_Bacc;
+                              *funcs++ = Dacc_is_Aacc;
+
+                              if (source_needs_destination &&
+                                  state->dst_blend != DSBF_ONE) {
+                                   /* blend the destination */
+                                   *funcs++ = Yacc_is_Aacc;
+                                   *funcs++ = Xacc_is_Tacc;
+                                   *funcs++ = Xacc_blend[state->dst_blend - 1];
+
+                                   /* blend the source */
+                                   *funcs++ = Xacc_is_Bacc;
+                                   *funcs++ = Yacc_is_Bacc;
+                                   *funcs++ = Xacc_blend[state->src_blend - 1];
+                              }
+                              else {
+                                   /* blend the destination if needed */
+                                   if (read_destination) {
+                                        *funcs++ = Yacc_is_Aacc;
+                                        *funcs++ = Xacc_is_Tacc;
+                                        *funcs++ = Xacc_blend[state->dst_blend - 1];
+                                   }
+
+                                   /* blend the source */
+                                   *funcs++ = Xacc_is_Bacc;
+                                   *funcs++ = Yacc_is_Bacc;
+                                   *funcs++ = Xacc_blend[state->src_blend - 1];
+                              }
+
+                              /* add the destination to the source */
+                              if (read_destination) {
+                                   *funcs++ = Sacc_is_Tacc;
+                                   *funcs++ = Dacc_is_Bacc;
+                                   *funcs++ = Sacc_add_to_Dacc;
+                              }
+                         }
+
+                         if (state->blittingflags & DSBLIT_DEMULTIPLY) {
+                              *funcs++ = Dacc_is_Bacc;
+                              *funcs++ = Dacc_demultiply;
+                         }
+
+                         /* write source to destination */
+                         *funcs++ = Sacc_is_Bacc;
+                         if (scale_from_accumulator) {
+                              *funcs++ = Len_is_Dlen;
+                              if (state->blittingflags & DSBLIT_DST_COLORKEY ) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Sacc_StoK_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Sacc_Sto_Aop_PFI[dst_pfi];
+                         } else {
+                              if (state->blittingflags & DSBLIT_DST_COLORKEY ) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Sacc_toK_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Sacc_to_Aop_PFI[dst_pfi];
+                         }
+                    }
+                    else if (state->blittingflags == DSBLIT_INDEX_TRANSLATION &&
+                             DFB_PIXELFORMAT_IS_INDEXED(gfxs->src_format) &&
+                             DFB_PIXELFORMAT_IS_INDEXED(gfxs->dst_format))
+                    {
+                         gfxs->trans     = state->index_translation;
+                         gfxs->num_trans = state->num_translation;
+
+                         switch (gfxs->src_format) {
+                              case DSPF_LUT2:
+                                   switch (gfxs->dst_format) {
+                                        case DSPF_LUT8:
+                                             *funcs++ = Bop_lut2_translate_to_Aop_lut8;
+                                             break;
+
+                                        default:
+                                             D_ONCE( "no index translation to %s implemented",
+                                                     dfb_pixelformat_name( gfxs->dst_format ) );
+                                             break;
+                                   }
+                                   break;
+
+                              default:
+                                   D_ONCE( "no index translation from %s implemented",
+                                           dfb_pixelformat_name( gfxs->src_format ) );
+                                   break;
+                         }
+                    }
+                    else if ((gfxs->src_format == gfxs->dst_format && 
+                              (!DFB_PIXELFORMAT_IS_INDEXED(gfxs->src_format) ||
+                               dfb_palette_equal( gfxs->Alut, gfxs->Blut )))   ||
+                             ((gfxs->src_format == DSPF_I420 || gfxs->src_format == DSPF_YV12) &&
+                              (gfxs->dst_format == DSPF_I420 || gfxs->dst_format == DSPF_YV12)))
+                    {
+                         gfxs->need_accumulator = false;
+                         
+                         if (accel == DFXL_BLIT) {
+                              if (state->blittingflags & DSBLIT_SRC_COLORKEY &&
+                                  state->blittingflags & DSBLIT_DST_COLORKEY) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Bop_PFI_KtoK_Aop_PFI[dst_pfi];
+                              } else if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   *funcs++ = Bop_PFI_Kto_Aop_PFI[dst_pfi];
+                              } else if (state->blittingflags & DSBLIT_DST_COLORKEY) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Bop_PFI_toK_Aop_PFI[dst_pfi];
+                              } else if (state->blittingflags & (DSBLIT_ROTATE90  |
+                                                                 DSBLIT_ROTATE180 |
+                                                                 DSBLIT_ROTATE270)) {
+                                   *funcs++ = Bop_PFI_toR_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Bop_PFI_to_Aop_PFI[dst_pfi];
+                         }
+                         else {
+                              if (state->blittingflags & DSBLIT_SRC_COLORKEY &&
+                                  state->blittingflags & DSBLIT_DST_COLORKEY) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Bop_PFI_SKtoK_Aop_PFI[dst_pfi];
+                              } else if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   *funcs++ = Bop_PFI_SKto_Aop_PFI[dst_pfi];
+                              } else if (state->blittingflags & DSBLIT_DST_COLORKEY) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Bop_PFI_StoK_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Bop_PFI_Sto_Aop_PFI[dst_pfi];
+                         }
+                    }
+                    else {
+                         bool scale_from_accumulator = (src_ycbcr != dst_ycbcr) &&
+                                                       (accel == DFXL_STRETCHBLIT);
+
+                         if (scale_from_accumulator)
+                              *funcs++ = Len_is_Slen;
+
+                         gfxs->Sop = gfxs->Bop;
+
+                         if (DFB_PIXELFORMAT_IS_INDEXED(gfxs->src_format))
+                              *funcs++ = Slut_is_Blut;
+
+                         if (accel == DFXL_BLIT || scale_from_accumulator) {
+                              if (state->blittingflags & DSBLIT_SRC_COLORKEY ) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   *funcs++ = Sop_PFI_Kto_Dacc[src_pfi];
+                              }
+                              else
+                                   *funcs++ = Sop_PFI_to_Dacc[src_pfi];
+                         }
+                         else { /* DFXL_STRETCHBLIT */
+
+                              if (state->blittingflags & DSBLIT_SRC_COLORKEY ) {
+                                   gfxs->Skey = state->src_colorkey;
+                                   *funcs++ = Sop_PFI_SKto_Dacc[src_pfi];
+                              }
+                              else
+                                   *funcs++ = Sop_PFI_Sto_Dacc[src_pfi];
+
+                         }
+
+                         if (!src_ycbcr && dst_ycbcr) {
+                              if (DFB_COLOR_BITS_PER_PIXEL(gfxs->src_format))
+                                   *funcs++ = Dacc_RGB_to_YCbCr;
+                              else
+                                   *funcs++ = Dacc_Alpha_to_YCbCr;
+                         }
+                         else if (src_ycbcr && !dst_ycbcr) {
+                              if (DFB_COLOR_BITS_PER_PIXEL(gfxs->dst_format))
+                                   *funcs++ = Dacc_YCbCr_to_RGB;
+                         }
+
+                         if (scale_from_accumulator) {
+                              *funcs++ = Len_is_Dlen;
+                              if (state->blittingflags & DSBLIT_DST_COLORKEY ) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Sacc_StoK_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Sacc_Sto_Aop_PFI[dst_pfi];
+                         } else {
+                              if (state->blittingflags & DSBLIT_DST_COLORKEY ) {
+                                   gfxs->Dkey = state->dst_colorkey;
+                                   *funcs++ = Sacc_toK_Aop_PFI[dst_pfi];
+                              } else
+                                   *funcs++ = Sacc_to_Aop_PFI[dst_pfi];
+                         }
+                    }
+                    break;
+               }
+          default:
+               D_ONCE("unimplemented drawing/blitting function");
+               gRelease( state );
+               return false;
+     }
+
+     *funcs = NULL;
+
+     dfb_state_update( state, state->flags & CSF_SOURCE_LOCKED );
+
+     return true;
+}
+
+void gRelease( CardState *state )
+{
+     dfb_surface_unlock_buffer( state->destination, &state->dst );
+
+     if (state->flags & CSF_SOURCE_LOCKED) {
+          dfb_surface_unlock_buffer( state->source, &state->src );
+          state->flags &= ~CSF_SOURCE_LOCKED;
+     }
+}
+
+#define CHECK_PIPELINE()                                                             \
+     {                                                                               \
+          if (!gfxs->funcs[0])                                                       \
+               return;                                                               \
+                                                                                     \
+          if (dfb_config->software_trace) {                                          \
+               int         i;                                                        \
+               GenefxFunc *funcs = gfxs->funcs;                                      \
+                                                                                     \
+               direct_log_lock( NULL );                                              \
+               direct_log_printf( NULL, "  Software Fallback Pipeline:\n" );         \
+                                                                                     \
+               for (i=0; funcs[i]; ++i)                                              \
+                    direct_log_printf( NULL, "    [%2d] %s\n", i,                    \
+                                       direct_trace_lookup_symbol_at( funcs[i] ) );  \
+                                                                                     \
+               direct_log_printf( NULL, "\n" );                                      \
+               direct_log_unlock( NULL );                                            \
+          }                                                                          \
+     }
+
+#define RUN_PIPELINE()                     \
+     {                                     \
+          int         i;                   \
+          GenefxFunc *funcs = gfxs->funcs; \
+                                           \
+          for (i=0; funcs[i]; ++i)         \
+               funcs[i]( gfxs );           \
+     }
+
+
+static inline void Aop_xy( GenefxState *gfxs, int x, int y )
+{
+     int pitch = gfxs->dst_pitch;
+     
+     gfxs->Aop[0] = gfxs->dst_org[0];
+     gfxs->AopY   = y;
+
+     if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+          gfxs->Aop_field = y & 1;
+          if (gfxs->Aop_field)
+               gfxs->Aop[0] += gfxs->dst_field_offset;
+
+          y /= 2;
+     }
+
+     D_ASSUME( !(x & DFB_PIXELFORMAT_ALIGNMENT(gfxs->dst_format)) );
+
+     gfxs->Aop[0] += y * pitch + DFB_BYTES_PER_LINE( gfxs->dst_format, x );
+     
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->dst_format)) {
+          int dst_field_offset = gfxs->dst_field_offset;
+          
+          switch (gfxs->dst_format) {
+               case DSPF_YV12:
+               case DSPF_I420:
+                    dst_field_offset /= 4;
+                    pitch /= 2;
+                    y /= 2;
+                    x /= 2;
+                    break;
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    dst_field_offset /= 2;
+                    y /= 2;
+               case DSPF_NV16:
+                    x &= ~1;
+                    break;
+               default:
+                    break;
+          }
+          
+          gfxs->Aop[1] = gfxs->dst_org[1];
+          gfxs->Aop[2] = gfxs->dst_org[2];
+                    
+          if (gfxs->dst_caps & DSCAPS_SEPARATED && gfxs->Aop_field) {
+               gfxs->Aop[1] += dst_field_offset;
+               gfxs->Aop[2] += dst_field_offset;
+          }
+          
+          gfxs->Aop[1] += y * pitch + x;
+          gfxs->Aop[2] += y * pitch + x;
+     }
+}
+
+static inline void Aop_crab( GenefxState *gfxs )
+{
+     gfxs->Aop[0] += gfxs->dst_bpp;
+     gfxs->AopY++;
+}
+
+static inline void Aop_next( GenefxState *gfxs )
+{
+     int pitch = gfxs->dst_pitch;
+     
+     if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+          gfxs->Aop_field++;
+
+          if (gfxs->Aop_field & 1)
+               gfxs->Aop[0] += gfxs->dst_field_offset;
+          else
+               gfxs->Aop[0] += pitch - gfxs->dst_field_offset;
+     }
+     else
+          gfxs->Aop[0] += pitch;
+          
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->dst_format)) {
+          if (gfxs->dst_format == DSPF_YV12 || gfxs->dst_format == DSPF_I420) {
+               if (gfxs->AopY & 1) { 
+                    if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Aop_field & 2) {
+                              gfxs->Aop[1] += gfxs->dst_field_offset/4;
+                              gfxs->Aop[2] += gfxs->dst_field_offset/4;
+                         }
+                         else {
+                              gfxs->Aop[1] += pitch/2 - gfxs->dst_field_offset/4;
+                              gfxs->Aop[2] += pitch/2 - gfxs->dst_field_offset/4;
+                         }
+                    }
+                    else {
+                         gfxs->Aop[1] += pitch/2;
+                         gfxs->Aop[2] += pitch/2;
+                    }
+               }
+          }
+          else if (gfxs->dst_format == DSPF_NV12 || gfxs->dst_format == DSPF_NV21) { 
+               if (gfxs->AopY & 1) { 
+                    if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Aop_field & 2)
+                              gfxs->Aop[1] += gfxs->dst_field_offset/2;
+                         else
+                              gfxs->Aop[1] += pitch - gfxs->dst_field_offset/2;
+                    }
+                    else {
+                         gfxs->Aop[1] += pitch;
+                    }
+               }
+          }
+          else { /* NV16 */
+               if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                    if (gfxs->Aop_field & 1)
+                         gfxs->Aop[1] += gfxs->dst_field_offset;
+                    else
+                         gfxs->Aop[1] += pitch - gfxs->dst_field_offset;
+               }
+               else {
+                    gfxs->Aop[1] += pitch;
+               }
+          }
+     }
+     
+     gfxs->AopY++;
+}
+
+static inline void Aop_prev( GenefxState *gfxs )
+{
+     int pitch = gfxs->dst_pitch;
+     
+     if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+          gfxs->Aop_field++;
+
+          if (gfxs->Aop_field & 1)
+               gfxs->Aop[0] += gfxs->dst_field_offset - pitch;
+          else
+               gfxs->Aop[0] -= gfxs->dst_field_offset;
+     }
+     else
+          gfxs->Aop[0] -= pitch;
+          
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->dst_format)) {
+          if (gfxs->dst_format == DSPF_YV12 || gfxs->dst_format == DSPF_I420) { 
+               if (gfxs->AopY & 1) {
+                    if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Aop_field & 2) {
+                              gfxs->Aop[1] += gfxs->dst_field_offset/4 - pitch/2;
+                              gfxs->Aop[2] += gfxs->dst_field_offset/4 - pitch/2;
+                         }
+                         else {
+                              gfxs->Aop[1] -= gfxs->dst_field_offset/4;
+                              gfxs->Aop[2] -= gfxs->dst_field_offset/4;
+                         }
+                    }
+                    else {
+                         gfxs->Aop[1] -= pitch/2;
+                         gfxs->Aop[2] -= pitch/2;
+                    }
+               }
+          }
+          else if (gfxs->dst_format == DSPF_NV12 || gfxs->dst_format == DSPF_NV21) {
+               if (gfxs->AopY & 1) { 
+                    if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Aop_field & 2)
+                              gfxs->Aop[1] += gfxs->dst_field_offset/2 - pitch;
+                         else
+                              gfxs->Aop[1] -= gfxs->dst_field_offset/2;
+                    }
+                    else {
+                         gfxs->Aop[1] -= pitch;
+                    }
+               }
+          }
+          else { /* NV16 */
+               if (gfxs->dst_caps & DSCAPS_SEPARATED) {
+                    if (gfxs->Aop_field & 1)
+                         gfxs->Aop[1] += gfxs->dst_field_offset - pitch;
+                    else
+                         gfxs->Aop[1] -= gfxs->dst_field_offset;
+               }
+               else {
+                    gfxs->Aop[1] -= pitch;
+               }
+          }
+     }
+     
+     gfxs->AopY--;
+}
+
+
+static inline void Bop_xy( GenefxState *gfxs, int x, int y )
+{
+     int pitch = gfxs->src_pitch;
+     
+     gfxs->Bop[0] = gfxs->src_org[0];
+     gfxs->BopY   = y;
+
+     if (gfxs->src_caps & DSCAPS_SEPARATED) {
+          gfxs->Bop_field = y & 1;
+          if (gfxs->Bop_field)
+               gfxs->Bop[0] += gfxs->src_field_offset;
+
+          y /= 2;
+     }
+
+     D_ASSUME( !(x & DFB_PIXELFORMAT_ALIGNMENT(gfxs->src_format)) );
+
+     gfxs->Bop[0] += y * pitch + DFB_BYTES_PER_LINE( gfxs->src_format, x );
+     
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->src_format)) {
+          int src_field_offset = gfxs->src_field_offset;
+          
+          switch (gfxs->src_format) {
+               case DSPF_YV12:
+               case DSPF_I420:
+                    src_field_offset /= 4;
+                    pitch /= 2;
+                    y /= 2;
+                    x /= 2;
+                    break;
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    src_field_offset /= 2;
+                    y /= 2;
+               case DSPF_NV16:
+                    x &= ~1;
+                    break;
+               default:
+                    break;
+          }
+          
+          gfxs->Bop[1] = gfxs->src_org[1];
+          gfxs->Bop[2] = gfxs->src_org[2];
+          
+          if (gfxs->src_caps & DSCAPS_SEPARATED && gfxs->Bop_field) {
+               gfxs->Bop[1] += src_field_offset;
+               gfxs->Bop[2] += src_field_offset;
+          }
+          
+          gfxs->Bop[1] += y * pitch + x;
+          gfxs->Bop[2] += y * pitch + x;
+     }
+}
+
+static inline void Bop_next( GenefxState *gfxs )
+{
+     int pitch = gfxs->src_pitch;
+     
+     if (gfxs->src_caps & DSCAPS_SEPARATED) {
+          gfxs->Bop_field++;
+
+          if (gfxs->Bop_field & 1)
+               gfxs->Bop[0] += gfxs->src_field_offset;
+          else
+               gfxs->Bop[0] += pitch - gfxs->src_field_offset;
+     }
+     else
+          gfxs->Bop[0] += pitch;
+               
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->src_format)) {
+          if (gfxs->src_format == DSPF_YV12 || gfxs->src_format == DSPF_I420) {
+               if (gfxs->BopY & 1) {
+                    if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Bop_field & 2) {
+                              gfxs->Bop[1] += gfxs->src_field_offset/4;
+                              gfxs->Bop[2] += gfxs->src_field_offset/4;
+                         }
+                         else {
+                              gfxs->Bop[1] += pitch/2 - gfxs->src_field_offset/4;
+                              gfxs->Bop[2] += pitch/2 - gfxs->src_field_offset/4;
+                         }
+                    }
+                    else {
+                         gfxs->Bop[1] += pitch/2;
+                         gfxs->Bop[2] += pitch/2;
+                    }
+               }
+          }
+          else if (gfxs->src_format == DSPF_NV12 || gfxs->src_format == DSPF_NV21) {
+               if (gfxs->BopY & 1) {
+                    if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Bop_field & 2)
+                              gfxs->Bop[1] += gfxs->src_field_offset/2;
+                         else
+                              gfxs->Bop[1] += pitch - gfxs->src_field_offset/2;
+                    }
+                    else {
+                         gfxs->Bop[1] += pitch;
+                    }
+               }
+          }
+          else { /* NV16 */
+               if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                    if (gfxs->Bop_field & 1)
+                         gfxs->Bop[1] += gfxs->src_field_offset;
+                    else
+                         gfxs->Bop[1] += pitch - gfxs->src_field_offset;
+               }
+               else {
+                    gfxs->Bop[1] += pitch;
+               }
+          }
+     }
+     
+     gfxs->BopY++;
+}
+
+static inline void Bop_prev( GenefxState *gfxs )
+{
+     int pitch = gfxs->src_pitch;
+     
+     if (gfxs->src_caps & DSCAPS_SEPARATED) {
+          gfxs->Bop_field++;
+
+          if (gfxs->Bop_field & 1)
+               gfxs->Bop[0] += gfxs->src_field_offset - pitch;
+          else
+               gfxs->Bop[0] -= gfxs->src_field_offset;
+     }
+     else
+          gfxs->Bop[0] -= pitch;
+          
+     if (DFB_PLANAR_PIXELFORMAT(gfxs->src_format)) {
+          if (gfxs->src_format == DSPF_YV12 || gfxs->src_format == DSPF_I420) {
+               if (gfxs->BopY & 1) {
+                    if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Bop_field & 2) {
+                              gfxs->Bop[1] += gfxs->src_field_offset/4 - pitch/2;
+                              gfxs->Bop[2] += gfxs->src_field_offset/4 - pitch/2;
+                         }
+                         else {
+                              gfxs->Bop[1] -= gfxs->src_field_offset/4;
+                              gfxs->Bop[2] -= gfxs->src_field_offset/4;
+                         }
+                    }
+                    else {
+                         gfxs->Bop[1] -= pitch/2;
+                         gfxs->Bop[2] -= pitch/2;
+                    }
+               }
+          }
+          else if (gfxs->src_format == DSPF_NV12 || gfxs->src_format == DSPF_NV21) { 
+               if (gfxs->BopY & 1) {
+                    if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                         if (gfxs->Bop_field & 2)
+                              gfxs->Bop[1] += gfxs->src_field_offset/2 - pitch;
+                         else
+                              gfxs->Bop[1] -= gfxs->src_field_offset/2;
+                    }
+                    else {
+                         gfxs->Bop[1] -= pitch;
+                    }
+               }
+          }
+          else { /* NV16 */
+               if (gfxs->src_caps & DSCAPS_SEPARATED) {
+                    if (gfxs->Bop_field & 1)
+                         gfxs->Bop[1] += gfxs->src_field_offset - pitch;
+                    else
+                         gfxs->Bop[1] -= gfxs->src_field_offset;
+               }
+               else {
+                    gfxs->Bop[1] -= pitch;
+               }
+          }
+     }
+     
+     gfxs->BopY--;
+}
+
+static bool
+ABacc_prepare( GenefxState *gfxs, int width )
+{
+     int size;
+
+     if (!gfxs->need_accumulator)
+          return true;
+
+     size = (width + 31) & ~31;
+
+     if (gfxs->ABsize < size) {
+          void *ABstart = D_MALLOC( size * sizeof(GenefxAccumulator) * 3 + 31 );
+
+          if (!ABstart) {
+               D_WARN( "out of memory" );
+               return false;
+          }
+
+          if (gfxs->ABstart)
+               D_FREE( gfxs->ABstart );
+
+          gfxs->ABstart = ABstart;
+          gfxs->ABsize  = size;
+          gfxs->Aacc    = (GenefxAccumulator*) (((unsigned long)ABstart+31) & ~31);
+          gfxs->Bacc    = gfxs->Aacc + size;
+          gfxs->Tacc    = gfxs->Aacc + size + size;
+     }
+
+     gfxs->Sacc = gfxs->Dacc = gfxs->Aacc;
+
+     return true;
+}
+
+static void
+ABacc_flush( GenefxState *gfxs )
+{
+     if (dfb_config->keep_accumulators >= 0 && gfxs->ABsize > dfb_config->keep_accumulators) {
+          D_FREE( gfxs->ABstart );
+
+          gfxs->ABsize  = 0;
+          gfxs->ABstart = NULL;
+          gfxs->Aacc    = NULL;
+          gfxs->Bacc    = NULL;
+          gfxs->Sacc    = NULL;
+          gfxs->Dacc    = NULL;
+     }
+}
+
+void gFillRectangle( CardState *state, DFBRectangle *rect )
+{
+     int          h;
+     GenefxState *gfxs = state->gfxs;
+
+     D_ASSERT( gfxs != NULL );
+
+     if (dfb_config->software_warn) {
+          D_WARN( "FillRectangle (%4d,%4d-%4dx%4d) %6s, flags 0x%08x, color 0x%02x%02x%02x%02x",
+                  DFB_RECTANGLE_VALS(rect), dfb_pixelformat_name(gfxs->dst_format), state->drawingflags,
+                  state->color.a, state->color.r, state->color.g, state->color.b );
+     }
+
+     D_ASSERT( state->clip.x1 <= rect->x );
+     D_ASSERT( state->clip.y1 <= rect->y );
+     D_ASSERT( state->clip.x2 >= (rect->x + rect->w - 1) );
+     D_ASSERT( state->clip.y2 >= (rect->y + rect->h - 1) );
+
+     CHECK_PIPELINE();
+
+     if (!ABacc_prepare( gfxs, rect->w ))
+          return;
+
+     gfxs->length = rect->w;
+
+     Aop_xy( gfxs, rect->x, rect->y );
+
+     h = rect->h;
+     while (h--) {
+          RUN_PIPELINE();
+
+          Aop_next( gfxs );
+     }
+
+     ABacc_flush( gfxs );
+}
+
+void gDrawLine( CardState *state, DFBRegion *line )
+{
+     GenefxState *gfxs = state->gfxs;
+
+     int i,dx,dy,sdy,dxabs,dyabs,x,y,px,py;
+
+     D_ASSERT( gfxs != NULL );
+
+     CHECK_PIPELINE();
+
+     /* the horizontal distance of the line */
+     dx = line->x2 - line->x1;
+     dxabs = abs(dx);
+
+     if (!ABacc_prepare( gfxs, dxabs ))
+          return;
+
+     /* the vertical distance of the line */
+     dy = line->y2 - line->y1;
+     dyabs = abs(dy);
+
+     if (!dx || !dy) {              /* draw horizontal/vertical line */
+          DFBRectangle rect = {
+               MIN (line->x1, line->x2),
+               MIN (line->y1, line->y2),
+               dxabs + 1, dyabs + 1};
+
+          gFillRectangle( state, &rect );
+          return;
+     }
+
+     if (dfb_config->software_warn) {
+          D_WARN( "DrawLine      (%4d,%4d-%4d,%4d) %6s, flags 0x%08x, color 0x%02x%02x%02x%02x",
+                  DFB_RECTANGLE_VALS_FROM_REGION(line), dfb_pixelformat_name(gfxs->dst_format), state->drawingflags,
+                  state->color.a, state->color.r, state->color.g, state->color.b );
+     }
+
+     sdy = SIGN(dy) * SIGN(dx);
+     x = dyabs >> 1;
+     y = dxabs >> 1;
+
+     if (dx > 0) {
+          px  = line->x1;
+          py  = line->y1;
+     }
+     else {
+          px  = line->x2;
+          py  = line->y2;
+     }
+
+     if (dxabs >= dyabs) { /* the line is more horizontal than vertical */
+
+          for (i=0, gfxs->length=1; i<dxabs; i++, gfxs->length++) {
+               y += dyabs;
+               if (y >= dxabs) {
+                    Aop_xy( gfxs, px, py );
+                    RUN_PIPELINE();
+                    px += gfxs->length;
+                    gfxs->length = 0;
+                    y -= dxabs;
+                    py += sdy;
+               }
+          }
+          Aop_xy( gfxs, px, py );
+          RUN_PIPELINE();
+     }
+     else { /* the line is more vertical than horizontal */
+
+          gfxs->length = 1;
+          Aop_xy( gfxs, px, py );
+          RUN_PIPELINE();
+
+          for (i=0; i<dyabs; i++) {
+               x += dxabs;
+               if (x >= dyabs) {
+                    x -= dyabs;
+                    px++;
+               }
+               py += sdy;
+
+               Aop_xy( gfxs, px, py );
+               RUN_PIPELINE();
+          }
+     }
+
+     ABacc_flush( gfxs );
+}
+
+void gBlit( CardState *state, DFBRectangle *rect, int dx, int dy )
+{
+     GenefxState *gfxs = state->gfxs;
+     int          x, h;
+
+     D_ASSERT( gfxs != NULL );
+
+     if (dfb_config->software_warn) {
+          D_WARN( "Blit          (%4d,%4d-%4dx%4d) %6s, flags 0x%08x, funcs %d/%d, color 0x%02x%02x%02x%02x, source (%4d,%4d) %6s",
+                  dx, dy, rect->w, rect->h, dfb_pixelformat_name(gfxs->dst_format), state->blittingflags,
+                  state->src_blend, state->dst_blend,
+                  state->color.a, state->color.r, state->color.g, state->color.b, rect->x, rect->y,
+                  dfb_pixelformat_name(gfxs->src_format) );
+     }
+
+     D_ASSERT( state->clip.x1 <= dx );
+     D_ASSERT( state->clip.y1 <= dy );
+     D_ASSERT( (state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) || state->clip.x2 >= (dx + rect->w - 1) );
+     D_ASSERT( (state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) || state->clip.y2 >= (dy + rect->h - 1) );
+     D_ASSERT( !(state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) || state->clip.x2 >= (dx + rect->h - 1) );
+     D_ASSERT( !(state->blittingflags & (DSBLIT_ROTATE90 | DSBLIT_ROTATE270)) || state->clip.y2 >= (dy + rect->w - 1) );
+
+     CHECK_PIPELINE();
+
+     if (!ABacc_prepare( gfxs, rect->w ))
+          return;
+
+     if (gfxs->src_org[0] == gfxs->dst_org[0] && dy == rect->y && dx > rect->x)
+          /* we must blit from right to left */
+          gfxs->Astep = gfxs->Bstep = -1;
+     else
+          /* we must blit from left to right*/
+          gfxs->Astep = gfxs->Bstep = 1;
+     
+     if (state->blittingflags & DSBLIT_ROTATE90)
+          gfxs->Astep *= -gfxs->dst_pitch / gfxs->dst_bpp;
+     else if (state->blittingflags & DSBLIT_ROTATE180)
+          gfxs->Astep *= -1;
+     else if (state->blittingflags & DSBLIT_ROTATE270)
+          gfxs->Astep *= gfxs->dst_pitch / gfxs->dst_bpp;
+
+     switch (gfxs->src_format) {
+          case DSPF_A4:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               rect->x &= ~1;
+               break;
+          default:
+               break;
+     }
+
+     switch (gfxs->dst_format) {
+          case DSPF_A4:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               dx &= ~1;
+               break;
+          default:
+               break;
+     }               
+
+     gfxs->length = rect->w;
+
+     if (state->blittingflags == DSBLIT_ROTATE180 && gfxs->src_format == gfxs->dst_format) {
+          Aop_xy( gfxs, dx, dy );
+          Bop_xy( gfxs, rect->x + rect->w - 1, rect->y + rect->h - 1 );
+
+          switch (DFB_BYTES_PER_PIXEL(gfxs->dst_format)) {
+               case 4: {
+                    for (h = rect->h; h; h--) {
+                         u32 *src = gfxs->Bop[0];
+                         u32 *dst = gfxs->Aop[0];
+
+                         for (x=0; x<rect->w; x++)
+                              dst[x] = src[-x];
+
+                         Aop_next( gfxs );
+                         Bop_prev( gfxs );
+                    }
+                    return;
+               }
+               case 2: {
+                    for (h = rect->h; h; h--) {
+                         u16 *src = gfxs->Bop[0];
+                         u16 *dst = gfxs->Aop[0];
+
+                         for (x=0; x<rect->w; x++)
+                              dst[x] = src[-x];
+
+                         Aop_next( gfxs );
+                         Bop_prev( gfxs );
+                    }
+                    return;
+               }
+               case 1: {
+                    for (h = rect->h; h; h--) {
+                         u8 *src = gfxs->Bop[0];
+                         u8 *dst = gfxs->Aop[0];
+
+                         for (x=0; x<rect->w; x++)
+                              dst[x] = src[-x];
+
+                         Aop_next( gfxs );
+                         Bop_prev( gfxs );
+                    }
+                    return;
+               }
+
+               default:
+                    break;
+          }
+     }
+
+     if (state->blittingflags & DSBLIT_ROTATE180) {
+          Aop_xy( gfxs, dx + rect->w - 1, dy );
+          Bop_xy( gfxs, rect->x, rect->y + rect->h - 1 );
+          
+          for (h = rect->h; h; h--) {
+               RUN_PIPELINE();
+
+               Aop_next( gfxs );
+               Bop_prev( gfxs );
+          }
+          return;
+     }
+     else if( state->blittingflags & DSBLIT_ROTATE270 )
+     {
+          Aop_xy( gfxs, dx, dy );
+          Bop_xy( gfxs, rect->x, rect->y + rect->h - 1 );
+
+          for( h = rect->h; h; h-- )
+          {
+               RUN_PIPELINE();
+
+               Aop_crab( gfxs );
+               Bop_prev( gfxs );
+          }
+          return;
+     }
+     else if( state->blittingflags & DSBLIT_ROTATE90 )
+     {
+          Aop_xy( gfxs, dx, dy + rect->w - 1 );
+          Bop_xy( gfxs, rect->x, rect->y );
+
+          for( h = rect->h; h; h-- )
+          {
+               RUN_PIPELINE();
+
+               Aop_crab( gfxs );
+               Bop_next( gfxs );
+          }
+          return;
+     }
+
+     if (gfxs->src_org[0] == gfxs->dst_org[0] && dy > rect->y &&
+         !(state->blittingflags & DSBLIT_DEINTERLACE)) {
+          /* we must blit from bottom to top */
+          Aop_xy( gfxs, dx, dy + rect->h - 1 );
+          Bop_xy( gfxs, rect->x, rect->y + rect->h - 1 );
+
+          for (h = rect->h; h; h--) {
+               RUN_PIPELINE();
+
+               Aop_prev( gfxs );
+               Bop_prev( gfxs );
+          }
+     }
+     else {
+          /* we must blit from top to bottom */
+          Aop_xy( gfxs, dx, dy );
+          Bop_xy( gfxs, rect->x, rect->y );
+
+          if (state->blittingflags & DSBLIT_DEINTERLACE) {
+               if (state->source->field) {
+                    Aop_next( gfxs );
+                    Bop_next( gfxs );
+                    rect->h--;
+               }
+
+               for (h = rect->h/2; h; h--) {
+                    RUN_PIPELINE();
+
+                    Aop_next( gfxs );
+
+                    RUN_PIPELINE();
+
+                    Aop_next( gfxs );
+
+                    Bop_next( gfxs );
+                    Bop_next( gfxs );
+               }
+          } /* ! DSBLIT_DEINTERLACE */
+          else {
+               for (h = rect->h; h; h--) {
+                    RUN_PIPELINE();
+
+                    Aop_next( gfxs );
+                    Bop_next( gfxs );
+               }
+          }
+     }
+
+     ABacc_flush( gfxs );
+}
+
+/**********************************************************************************************************************/
+/*********           **************************************************************************************************/
+/*** Smooth scaling routines ******************************************************************************************/
+/*********           **************************************************************************************************/
+/**********************************************************************************************************************/
+
+#if DFB_SMOOTH_SCALING
+
+typedef struct {
+     DFBRegion   clip;
+     const void *colors;
+     ulong       protect;
+     ulong       key;
+} StretchCtx;
+
+typedef void (*StretchHVx)( void             *dst,
+                            int               dpitch,
+                            const void       *src,
+                            int               spitch,
+                            int               width,
+                            int               height,
+                            int               dst_width,
+                            int               dst_height,
+                            const StretchCtx *ctx );
+
+#define STRETCH_NONE           0
+#define STRETCH_SRCKEY         1
+#define STRETCH_PROTECT        2
+#define STRETCH_SRCKEY_PROTECT 3
+#define STRETCH_NUM            4
+
+typedef struct {
+     struct {
+          StretchHVx     up[STRETCH_NUM];
+          StretchHVx     down[STRETCH_NUM];
+     } f[DFB_NUM_PIXELFORMATS];
+} StretchFunctionTable;
+
+/**********************************************************************************************************************/
+/*** 16 bit RGB 565 scalers *******************************************************************************************/
+/**********************************************************************************************************************/
+
+#define DST_FORMAT              DSPF_RGB16
+#define TABLE_NAME              stretch_hvx_RGB16
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_hvx_RGB16_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R5                5
+#define SHIFT_R6                6
+#define X_F81F                  0xf81f
+#define X_07E0                  0x07e0
+#define MASK_RGB                0xffff
+
+#define FORMAT_RGB16
+#include "stretch_up_down_16.h"
+#undef FORMAT_RGB16
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R5
+#undef SHIFT_R6
+#undef X_F81F
+#undef X_07E0
+#undef MASK_RGB
+
+/**********************************************************************************************************************/
+/*** 16 bit ARGB 4444 scalers *****************************************************************************************/
+/**********************************************************************************************************************/
+
+#define DST_FORMAT              DSPF_ARGB4444
+#define TABLE_NAME              stretch_hvx_ARGB4444
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_hvx_ARGB4444_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R5          4
+#define SHIFT_R6          4
+#define X_F81F            0x0f0f
+#define X_07E0            0xf0f0
+#define MASK_RGB          0x0fff
+#define HAS_ALPHA
+
+#define FORMAT_ARGB4444
+#include "stretch_up_down_16.h"
+#undef FORMAT_ARGB4444
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R5
+#undef SHIFT_R6
+#undef X_F81F
+#undef X_07E0
+#undef MASK_RGB
+#undef HAS_ALPHA
+
+/**********************************************************************************************************************/
+/*** 16 bit RGBA 4444 scalers *****************************************************************************************/
+/**********************************************************************************************************************/
+
+#define DST_FORMAT              DSPF_RGBA4444
+#define TABLE_NAME              stretch_hvx_RGBA4444
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_hvx_RGBA4444_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R5          4
+#define SHIFT_R6          4
+#define X_F81F            0x0f0f
+#define X_07E0            0xf0f0
+#define MASK_RGB          0xfff0
+#define HAS_ALPHA
+
+#define FORMAT_RGBA4444
+#include "stretch_up_down_16.h"
+#undef FORMAT_RGBA4444
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R5
+#undef SHIFT_R6
+#undef X_F81F
+#undef X_07E0
+#undef MASK_RGB
+#undef HAS_ALPHA
+
+/**********************************************************************************************************************/
+/*** 32 bit ARGB 8888 scalers *****************************************************************************************/
+/**********************************************************************************************************************/
+
+#define DST_FORMAT              DSPF_ARGB
+#define TABLE_NAME              stretch_hvx_ARGB
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_hvx_ARGB_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R8                8
+#define SHIFT_L8                8
+#define X_00FF00FF              0x00ff00ff
+#define X_FF00FF00              0xff00ff00
+#define MASK_RGB                0x00ffffff
+#define HAS_ALPHA
+
+#include "stretch_up_down_32.h"
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R8
+#undef SHIFT_L8
+#undef X_00FF00FF
+#undef X_FF00FF00
+#undef MASK_RGB
+#undef HAS_ALPHA
+
+/**********************************************************************************************************************/
+/*** 32 bit RGB 888 scalers *******************************************************************************************/
+/**********************************************************************************************************************/
+
+#define DST_FORMAT              DSPF_RGB32
+#define TABLE_NAME              stretch_hvx_RGB32
+#define FUNC_NAME(UPDOWN,K,P,F) stretch_hvx_RGB32_ ## UPDOWN ## _ ## K ## P ## _ ## F
+#define SHIFT_R8                8
+#define SHIFT_L8                8
+#define X_00FF00FF              0x00ff00ff
+#define X_FF00FF00              0x0000ff00
+#define MASK_RGB                0x00ffffff
+
+#include "stretch_up_down_32.h"
+
+#undef DST_FORMAT
+#undef TABLE_NAME
+#undef FUNC_NAME
+#undef SHIFT_R8
+#undef SHIFT_L8
+#undef X_00FF00FF
+#undef X_FF00FF00
+#undef MASK_RGB
+
+#if 0
+/**********************************************************************************************************************/
+/*** 16 bit YUV 422 scalers *******************************************************************************************/
+/**********************************************************************************************************************/
+
+#define FUNC_NAME(UPDOWN) stretch_hvx_nv16_ ## UPDOWN
+
+#include "stretch_up_down_8.h"
+
+#undef FUNC_NAME
+
+/**********************************************************************************************************************/
+
+#define FUNC_NAME(UPDOWN) stretch_hvx_nv16_uv_ ## UPDOWN
+
+#include "stretch_up_down_88.h"
+
+#undef FUNC_NAME
+
+#endif
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+
+static const StretchFunctionTable *stretch_tables[DFB_NUM_PIXELFORMATS] = {
+     NULL,                    /* DSPF_ARGB1555 */
+     &stretch_hvx_RGB16,      /* DSPF_RGB16 */
+     NULL,                    /* DSPF_RGB24 */
+     &stretch_hvx_RGB32,      /* DSPF_RGB32 */
+     &stretch_hvx_ARGB,       /* DSPF_ARGB */
+     NULL,                    /* DSPF_A8 */
+     NULL,                    /* DSPF_YUY2 */
+     NULL,                    /* DSPF_RGB332 */
+     NULL,                    /* DSPF_UYVY */
+     NULL,                    /* DSPF_I420 */
+     NULL,                    /* DSPF_YV12 */
+     NULL,                    /* DSPF_LUT8 */
+     NULL,                    /* DSPF_ALUT44 */
+     NULL,                    /* DSPF_AiRGB */
+     NULL,                    /* DSPF_A1 */
+     NULL,                    /* DSPF_NV12 */
+     NULL,                    /* DSPF_NV16 */
+     NULL,                    /* DSPF_ARGB2554 */
+     &stretch_hvx_ARGB4444,   /* DSPF_ARGB4444 */
+     &stretch_hvx_RGBA4444,   /* DSPF_RGBA4444 */
+     NULL,                    /* DSPF_NV21 */
+     NULL,                    /* DSPF_AYUV */
+     NULL,                    /* DSPF_A4 */
+     NULL,                    /* DSPF_ARGB1666 */
+     NULL,                    /* DSPF_ARGB6666 */
+     NULL,                    /* DSPF_RGB18 */
+     NULL,                    /* DSPF_LUT2 */
+     NULL,                    /* DSPF_RGB444 */
+     NULL,                    /* DSPF_RGB555 */
+     NULL                     /* DSPF_BGR555 */
+};
+
+/**********************************************************************************************************************/
+
+__attribute__((noinline))
+static bool
+stretch_hvx( CardState *state, DFBRectangle *srect, DFBRectangle *drect )
+{
+     GenefxState                *gfxs;
+     const StretchFunctionTable *table;
+     StretchHVx                  stretch;
+     bool                        down = false;
+     void                       *dst;
+     void                       *src;
+     StretchCtx                  ctx;
+     int                         idx = STRETCH_NONE;
+     u32                         colors[256];
+
+     D_ASSERT( state != NULL );
+     DFB_RECTANGLE_ASSERT( srect );
+     DFB_RECTANGLE_ASSERT( drect );
+
+     gfxs = state->gfxs;
+
+     if (state->blittingflags & ~(DSBLIT_COLORKEY_PROTECT | DSBLIT_SRC_COLORKEY | DSBLIT_SRC_PREMULTIPLY))
+          return false;
+
+     if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY && !DFB_PIXELFORMAT_IS_INDEXED( gfxs->src_format ))
+          return false;
+
+     if (DFB_PIXELFORMAT_INDEX(gfxs->dst_format) >= D_ARRAY_SIZE(stretch_tables))
+          return false;
+
+     if (DFB_PIXELFORMAT_INDEX(gfxs->src_format) >= D_ARRAY_SIZE((stretch_tables[0])->f))
+          return false;
+
+     table = stretch_tables[DFB_PIXELFORMAT_INDEX(gfxs->dst_format)];
+     if (!table)
+          return false;
+
+     if (srect->w > drect->w && srect->h > drect->h)
+          down = true;
+
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY)
+          idx |= STRETCH_SRCKEY;
+
+     if (state->blittingflags & DSBLIT_COLORKEY_PROTECT)
+          idx |= STRETCH_PROTECT;
+
+     if (down) {
+          if (!(state->render_options & DSRO_SMOOTH_DOWNSCALE))
+               return false;
+
+          stretch = table->f[DFB_PIXELFORMAT_INDEX(gfxs->src_format)].down[idx];
+     }
+     else {
+          if (!(state->render_options & DSRO_SMOOTH_UPSCALE))
+               return false;
+
+          stretch = table->f[DFB_PIXELFORMAT_INDEX(gfxs->src_format)].up[idx];
+     }
+
+     if (!stretch)
+          return false;
+
+     ctx.clip = state->clip;
+
+     if (!dfb_region_rectangle_intersect( &ctx.clip, drect ))
+          return false;
+
+     dfb_region_translate( &ctx.clip, - drect->x, - drect->y );
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( gfxs->src_format )) {
+          int             i;
+          const DFBColor *entries;
+          u16            *colors16 = (void*) colors;
+
+          D_ASSERT( gfxs->Blut != NULL );
+
+          entries = gfxs->Blut->entries;
+
+          switch (gfxs->dst_format) {
+               case DSPF_ARGB:
+                    if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+                         for (i=0; i<gfxs->Blut->num_entries; i++) {
+                              int alpha = entries[i].a + 1;
+
+                              switch (alpha) {
+                                   case 0:
+                                        colors[i] = 0;
+                                        break;
+
+                                   case 255:
+                                        colors[i] = PIXEL_ARGB( entries[i].a,
+                                                                entries[i].r,
+                                                                entries[i].g,
+                                                                entries[i].b );
+                                        break;
+
+                                   default:
+                                        colors[i] = PIXEL_ARGB( entries[i].a,
+                                                                (alpha * entries[i].r) >> 8,
+                                                                (alpha * entries[i].g) >> 8,
+                                                                (alpha * entries[i].b) >> 8 );
+                              }
+                         }
+                    }
+                    else {
+                         for (i=0; i<gfxs->Blut->num_entries; i++)
+                              colors[i] = PIXEL_ARGB( entries[i].a, entries[i].r, entries[i].g, entries[i].b );
+                    }
+                    break;
+
+               case DSPF_RGB32:
+                    for (i=0; i<gfxs->Blut->num_entries; i++)
+                         colors[i] = PIXEL_RGB32( entries[i].r, entries[i].g, entries[i].b );
+                    break;
+
+               case DSPF_RGB16:
+                    for (i=0; i<gfxs->Blut->num_entries; i++)
+                         colors16[i] = PIXEL_RGB16( entries[i].r, entries[i].g, entries[i].b );
+                    break;
+
+               case DSPF_ARGB4444:
+                    if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+                         for (i=0; i<gfxs->Blut->num_entries; i++) {
+                              int alpha = entries[i].a + 1;
+
+                              switch (alpha) {
+                                   case 0:
+                                        colors16[i] = 0;
+                                        break;
+
+                                   case 255:
+                                        colors16[i] = PIXEL_ARGB4444( entries[i].a,
+                                                                      entries[i].r,
+                                                                      entries[i].g,
+                                                                      entries[i].b );
+                                        break;
+
+                                   default:
+                                        colors16[i] = PIXEL_ARGB4444( entries[i].a,
+                                                                      (alpha * entries[i].r) >> 8,
+                                                                      (alpha * entries[i].g) >> 8,
+                                                                      (alpha * entries[i].b) >> 8 );
+                              }
+                         }
+                    }
+                    else {
+                         for (i=0; i<gfxs->Blut->num_entries; i++)
+                              colors16[i] = PIXEL_ARGB4444( entries[i].a, entries[i].r, entries[i].g, entries[i].b );
+                    }
+                    break;
+
+               case DSPF_RGBA4444:
+                    if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+                         for (i=0; i<gfxs->Blut->num_entries; i++) {
+                              int alpha = entries[i].a + 1;
+
+                              switch (alpha) {
+                                   case 0:
+                                        colors16[i] = 0;
+                                        break;
+
+                                   case 255:
+                                        colors16[i] = PIXEL_RGBA4444( entries[i].a,
+                                                                      entries[i].r,
+                                                                      entries[i].g,
+                                                                      entries[i].b );
+                                        break;
+
+                                   default:
+                                        colors16[i] = PIXEL_RGBA4444( entries[i].a,
+                                                                      (alpha * entries[i].r) >> 8,
+                                                                      (alpha * entries[i].g) >> 8,
+                                                                      (alpha * entries[i].b) >> 8 );
+                              }
+                         }
+                    }
+                    else {
+                         for (i=0; i<gfxs->Blut->num_entries; i++)
+                              colors16[i] = PIXEL_RGBA4444( entries[i].a, entries[i].r, entries[i].g, entries[i].b );
+                    }
+                    break;
+
+               case DSPF_RGB444:
+                    for (i=0; i<gfxs->Blut->num_entries; i++)
+                         colors16[i] = PIXEL_RGB444( entries[i].r, entries[i].g, entries[i].b );
+                    break;
+
+               default:
+                    D_UNIMPLEMENTED();
+          }
+
+          ctx.colors = colors;
+
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+               if (DFB_PIXELFORMAT_IS_INDEXED( gfxs->dst_format ))
+                    ctx.key = state->src_colorkey;
+               else {
+                    const DFBColor *color = &entries[state->src_colorkey % gfxs->Blut->num_entries];
+
+                    ctx.key = dfb_color_to_pixel( gfxs->dst_format, color->r, color->g, color->b );
+               }
+          }
+     }
+     else {
+          ctx.colors = NULL;
+
+          if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+               DFBColor color;
+
+               dfb_pixel_to_color( gfxs->src_format, state->src_colorkey, &color );
+
+               ctx.key = dfb_color_to_pixel( gfxs->dst_format, color.r, color.g, color.b );
+          }
+     }
+
+     if (state->blittingflags & DSBLIT_COLORKEY_PROTECT) {
+          if (DFB_PIXELFORMAT_IS_INDEXED( gfxs->dst_format ))
+               ctx.protect = state->colorkey.index;
+          else
+               ctx.protect = dfb_color_to_pixel( gfxs->dst_format,
+                                                 state->colorkey.r,
+                                                 state->colorkey.g,
+                                                 state->colorkey.b );
+     }
+
+     dst = gfxs->dst_org[0] + drect->y * gfxs->dst_pitch + DFB_BYTES_PER_LINE( gfxs->dst_format, drect->x );
+     src = gfxs->src_org[0] + srect->y * gfxs->src_pitch + DFB_BYTES_PER_LINE( gfxs->src_format, srect->x );
+
+     stretch( dst, gfxs->dst_pitch, src, gfxs->src_pitch,
+              srect->w, srect->h, drect->w, drect->h, &ctx );
+
+#if 0     /* FIXME: repair */
+     switch (gfxs->dst_format) {
+          case DSPF_NV16:
+               ctx.clip.x1 /= 2;
+               ctx.clip.x2 /= 2;
+               if (srect->w < drect->w || srect->h < drect->h) {
+                    stretch_hvx_nv16_uv_up( dst, gfxs->dst_pitch, src, gfxs->src_pitch,
+                                            srect->w/2, srect->h, drect->w/2, drect->h, &ctx );
+               }
+               else {
+                    stretch_hvx_nv16_uv_down( dst, gfxs->dst_pitch, src, gfxs->src_pitch,
+                                              srect->w/2, srect->h, drect->w/2, drect->h, &ctx );
+               }
+               break;
+
+          default:
+               break;
+     }
+#endif
+
+     return true;
+}
+#endif /* DFB_SMOOTH_SCALING */
+
+void gStretchBlit( CardState *state, DFBRectangle *srect, DFBRectangle *drect )
+{
+     GenefxState  *gfxs  = state->gfxs;
+     DFBRectangle  orect = *drect;
+
+     int fx, fy;
+     int ix, iy;
+     int h;
+
+     D_ASSERT( gfxs != NULL );
+
+     if (dfb_config->software_warn) {
+          D_WARN( "StretchBlit   (%4d,%4d-%4dx%4d) %6s, flags 0x%08x, color 0x%02x%02x%02x%02x, source (%4d,%4d-%4dx%4d) %6s",
+                  drect->x, drect->y, drect->w, drect->h, dfb_pixelformat_name(gfxs->dst_format), state->blittingflags,
+                  state->color.a, state->color.r, state->color.g, state->color.b, srect->x, srect->y, srect->w, srect->h,
+                  dfb_pixelformat_name(gfxs->src_format) );
+     }
+
+     CHECK_PIPELINE();
+
+#if DFB_SMOOTH_SCALING
+     if (state->render_options & (DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE) &&
+         stretch_hvx( state, srect, drect ))
+          return;
+#endif
+
+     /* Clip destination rectangle. */
+     if (!dfb_rectangle_intersect_by_region( drect, &state->clip ))
+          return;
+
+     /* Calculate fractions. */
+     fx = (srect->w << 16) / orect.w;
+     fy = (srect->h << 16) / orect.h;
+
+     /* Calculate horizontal phase and offset. */
+     ix = fx * (drect->x - orect.x);
+     srect->x += ix >> 16;
+     ix &= 0xFFFF;
+
+     /* Calculate vertical phase and offset. */
+     iy = fy * (drect->y - orect.y);
+     srect->y += iy >> 16;
+     iy &= 0xFFFF;
+
+     /* Adjust source size. */
+     srect->w = ((drect->w * fx + ix) + 0xFFFF) >> 16;
+     srect->h = ((drect->h * fy + iy) + 0xFFFF) >> 16;
+
+     D_ASSERT( srect->x + srect->w <= state->source->config.size.w );
+     D_ASSERT( srect->y + srect->h <= state->source->config.size.h );
+     D_ASSERT( drect->x + drect->w <= state->clip.x2 + 1 );
+     D_ASSERT( drect->y + drect->h <= state->clip.y2 + 1 );
+
+
+     if (!ABacc_prepare( gfxs, MAX( srect->w, drect->w ) ))
+          return;
+
+
+     switch (gfxs->src_format) {
+          case DSPF_A4:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               srect->x &= ~1;
+               break;
+          default:
+               break;
+     }
+
+     switch (gfxs->dst_format) {
+          case DSPF_A4:
+          case DSPF_YUY2:
+          case DSPF_UYVY:
+               drect->x &= ~1;
+               break;
+          default:
+               break;
+     }
+
+     gfxs->Slen   = srect->w;
+     gfxs->Dlen   = drect->w;
+     gfxs->length = gfxs->Dlen;
+     gfxs->SperD  = fx;
+     gfxs->Xphase = ix;
+
+     h = drect->h;
+
+     Aop_xy( gfxs, drect->x, drect->y );
+     Bop_xy( gfxs, srect->x, srect->y );
+
+     while (h--) {
+          RUN_PIPELINE();
+
+          Aop_next( gfxs );
+
+          iy += fy;
+
+          while (iy > 0xFFFF) {
+               iy -= 0x10000;
+               Bop_next( gfxs );
+          }
+     }
+
+     ABacc_flush( gfxs );
+}
+
+
+#ifdef USE_MMX
+
+#include "generic_mmx.h"
+
+/*
+ * patches function pointers to MMX functions
+ */
+static void gInit_MMX( void )
+{
+     use_mmx = 1;
+
+/********************************* Sop_PFI_Sto_Dacc ***************************/
+//     Sop_PFI_Sto_Dacc[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)] = Sop_argb_Sto_Dacc_MMX;
+/********************************* Sop_PFI_to_Dacc ****************************/
+//     Sop_PFI_to_Dacc[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)] = Sop_rgb16_to_Dacc_MMX;
+//     Sop_PFI_to_Dacc[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Sop_rgb32_to_Dacc_MMX;
+//     Sop_PFI_to_Dacc[DFB_PIXELFORMAT_INDEX(DSPF_ARGB )] = Sop_argb_to_Dacc_MMX;
+/********************************* Sacc_to_Aop_PFI ****************************/
+//     Sacc_to_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)] = Sacc_to_Aop_rgb16_MMX;
+//     Sacc_to_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Sacc_to_Aop_rgb32_MMX;
+/********************************* Xacc_blend *********************************/
+     Xacc_blend[DSBF_SRCALPHA-1] = Xacc_blend_srcalpha_MMX;
+     Xacc_blend[DSBF_INVSRCALPHA-1] = Xacc_blend_invsrcalpha_MMX;
+/********************************* Dacc_modulation ****************************/
+     Dacc_modulation[DSBLIT_BLEND_ALPHACHANNEL |
+                     DSBLIT_BLEND_COLORALPHA |
+                     DSBLIT_COLORIZE] = Dacc_modulate_argb_MMX;
+/********************************* misc accumulator operations ****************/
+     SCacc_add_to_Dacc = SCacc_add_to_Dacc_MMX;
+     Sacc_add_to_Dacc  = Sacc_add_to_Dacc_MMX;
+     Dacc_YCbCr_to_RGB = Dacc_YCbCr_to_RGB_MMX;
+     Dacc_RGB_to_YCbCr = Dacc_RGB_to_YCbCr_MMX;
+}
+
+#endif
+
+
+#if SIZEOF_LONG == 8
+
+#include "generic_64.h"
+
+/*
+ * patches function pointers to 64bit functions
+ */
+static void gInit_64bit( void )
+{
+/********************************* Cop_to_Aop_PFI ********************************/
+     Cop_to_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Cop_to_Aop_32_64;
+     Cop_to_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)]  = Cop_to_Aop_32_64;
+     Cop_to_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_AiRGB)] = Cop_to_Aop_32_64;
+/********************************* Bop_PFI_Kto_Aop_PFI ***************************/
+     Bop_PFI_Kto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Bop_rgb32_Kto_Aop_64;
+     Bop_PFI_Kto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)]  = Bop_rgb32_Kto_Aop_64;
+     Bop_PFI_Kto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_AiRGB)] = Bop_rgb32_Kto_Aop_64;
+/********************************* Bop_PFI_tKo_Aop_PFI ***************************/
+     Bop_PFI_toK_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Bop_rgb32_toK_Aop_64;
+     Bop_PFI_toK_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)]  = Bop_rgb32_toK_Aop_64;
+     Bop_PFI_toK_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_AiRGB)] = Bop_rgb32_toK_Aop_64;
+/********************************* Bop_PFI_Sto_Aop_PFI ***************************/
+     Bop_PFI_Sto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = Bop_32_Sto_Aop_64;
+     Bop_PFI_Sto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)]  = Bop_32_Sto_Aop_64;
+     Bop_PFI_Sto_Aop_PFI[DFB_PIXELFORMAT_INDEX(DSPF_AiRGB)] = Bop_32_Sto_Aop_64;
+/********************************* misc accumulator operations *******************/
+     Dacc_xor = Dacc_xor_64;
+}
+
+#endif
diff --git a/Source/DirectFB/src/gfx/generic/generic.h b/Source/DirectFB/src/gfx/generic/generic.h
new file mode 100755
index 0000000..7c73c40
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/generic.h
@@ -0,0 +1,174 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GENERIC_H__
+#define __GENERIC_H__
+
+#include <dfb_types.h>
+
+#include <directfb.h>
+#include <core/coretypes.h>
+#include <core/gfxcard.h>
+
+/* this order is required for Intel with MMX, how about bigendian? */
+
+typedef union {
+     struct {
+          u16 b;
+          u16 g;
+          u16 r;
+          u16 a;
+     } RGB;
+     struct {
+          u16 u;
+          u16 v;
+          u16 y;
+          u16 a;
+     } YUV;
+} GenefxAccumulator;
+
+
+typedef struct _GenefxState GenefxState;
+
+typedef void (*GenefxFunc)(GenefxState *gfxs);
+
+/*
+ * State of the virtual graphics processing unit "Genefx" (pron. 'genie facts').
+ */
+struct _GenefxState {
+     GenefxFunc funcs[32];
+
+     int length;    /* span length */
+     int Slen;      /* span length (source) */
+     int Dlen;      /* span length (destination) */
+
+     /*
+      * state values
+      */
+     void *dst_org[3];
+     void *src_org[3];
+     int dst_pitch;
+     int src_pitch;
+
+     int dst_bpp;
+     int src_bpp;
+
+     DFBSurfaceCapabilities dst_caps;
+     DFBSurfaceCapabilities src_caps;
+
+     DFBSurfacePixelFormat src_format;
+     DFBSurfacePixelFormat dst_format;
+
+     int dst_height;
+     int src_height;
+
+     int dst_field_offset;
+     int src_field_offset;
+
+     DFBColor color;
+
+     /*
+      * operands
+      */
+     void *Aop[3];
+     void *Bop[3];
+     u32   Cop;
+
+     int   Astep;
+     int   Bstep;
+
+     u8 YCop;
+     u8 CbCop;
+     u8 CrCop;
+
+     int Aop_field;
+     int Bop_field;
+     
+     int AopY;
+     int BopY;
+
+     /*
+      * color keys
+      */
+     u32 Dkey;
+     u32 Skey;
+
+     /*
+      * color lookup tables
+      */
+     CorePalette *Alut;
+     CorePalette *Blut;
+
+     /*
+      * accumulators
+      */
+     void              *ABstart;
+     int                ABsize;
+     GenefxAccumulator *Aacc;
+     GenefxAccumulator *Bacc;
+     GenefxAccumulator *Tacc; /* for simultaneous S+D blending */
+     GenefxAccumulator  Cacc;
+     GenefxAccumulator  SCacc;
+
+     /*
+      * dataflow control
+      */
+     GenefxAccumulator *Xacc; /* writing pointer for blending */
+     GenefxAccumulator *Yacc; /* input pointer for blending */
+     GenefxAccumulator *Dacc;
+     GenefxAccumulator *Sacc;
+
+     void        **Sop;
+     CorePalette  *Slut;
+
+     int Ostep; /* controls horizontal blitting direction */
+
+     int SperD;     /* for scaled routines only */
+     int Xphase;    /* initial value for fractional steps (zero if not clipped) */
+
+     bool need_accumulator;
+
+     int *trans;
+     int  num_trans;
+};
+
+
+void gGetDriverInfo( GraphicsDriverInfo *info );
+void gGetDeviceInfo( GraphicsDeviceInfo *info );
+
+bool gAcquire  ( CardState *state, DFBAccelerationMask accel );
+void gRelease ( CardState *state );
+
+void gFillRectangle ( CardState *state, DFBRectangle *rect );
+void gDrawLine      ( CardState *state, DFBRegion    *line );
+
+void gBlit          ( CardState *state, DFBRectangle *rect, int dx, int dy );
+void gStretchBlit   ( CardState *state, DFBRectangle *srect, DFBRectangle *drect );
+
+
+#endif
diff --git a/Source/DirectFB/src/gfx/generic/generic_64.h b/Source/DirectFB/src/gfx/generic/generic_64.h
new file mode 100755
index 0000000..b0079ce
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/generic_64.h
@@ -0,0 +1,207 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+
+static void Cop_to_Aop_32_64( GenefxState *gfxs )
+{
+     int    w, l = gfxs->length;
+     u32   *D    = gfxs->Aop[0];
+     u32    Cop  = gfxs->Cop;
+     u64    DCop = ((u64)Cop << 32) | Cop;
+     
+     if ((long)D & 4) {
+          *D++ = Cop;
+          l--;
+     }
+
+     for (w = l >> 1; w; w--) {
+          *((u64*)D) = DCop;
+          D += 2;
+     }
+     
+     if (l & 1)
+          *D = Cop;
+}
+
+static void Bop_rgb32_Kto_Aop_64( GenefxState *gfxs )
+{
+     int    w, l  = gfxs->length;
+     u32   *D     = gfxs->Aop[0];
+     u32   *S     = gfxs->Bop[0];
+     u32    Skey  = gfxs->Skey;
+     u64    DSkey = ((u64)Skey << 32) | Skey;
+     
+     if ((long)D & 4) {
+          if ((*S & 0x00ffffff) != Skey)
+               *D = *S;
+          D++;
+          S++;
+          l--;
+     }               
+
+     for (w = l >> 1; w; w--) {
+          u64 s = *((u64*)S);
+
+          if ((s & 0x00ffffff00ffffffull) != DSkey) {
+               if ((s & 0x00ffffff00000000ull) != 
+                    (DSkey & 0x00ffffff00000000ull)) {
+                    if ((s & 0x0000000000ffffffull) != 
+                         (DSkey & 0x0000000000ffffffull)) {
+                         *((u64*)D) = s;
+                    }
+                    else {
+#ifdef WORDS_BIGENDIAN
+                         D[0] = (u32)(s >> 32);
+#else
+                         D[1] = (u32)(s >> 32);
+#endif
+                    }
+               }
+               else {
+#ifdef WORDS_BIGENDIAN
+                    D[1] = (u32)s;
+#else
+                    D[0] = (u32)s;
+#endif
+               }
+          }
+          S += 2;
+          D += 2;
+     }
+     
+     if (l & 1) {                 /* do the last potential pixel */
+          if ((*S & 0x00ffffff) != Skey)
+               *D = *S;
+     }
+}
+
+static void Bop_rgb32_toK_Aop_64( GenefxState *gfxs )
+{
+     int    w, l  = gfxs->length;
+     u32   *D     = gfxs->Aop[0];
+     u32   *S     = gfxs->Bop[0];
+     u32    Dkey  = gfxs->Dkey;
+     u64    DDkey = ((u64)Dkey << 32) | Dkey;
+     
+     if ((long)D & 4) {
+          if ((*D & 0x00ffffff) == Dkey)
+               *D = *S;
+          D++;
+          S++;
+          l--;
+     }               
+
+     for (w = l >> 1; w; w--) {
+          u64 d = *((u64*)D);
+
+          if ((d & 0x00ffffff00ffffffull) != DDkey) {
+               if ((d & 0x00ffffff00000000ull) ==
+                    (DDkey & 0x00ffffff00000000ull)) {
+                    if ((d & 0x0000000000ffffffull) ==
+                         (DDkey & 0x0000000000ffffffull)) {
+                         *((u64*)D) = *((u64*)S);
+                    }
+                    else {
+#ifdef WORDS_BIGENDIAN
+                         D[0] = S[0];
+#else
+                         D[1] = S[1];
+#endif
+                    }
+               }
+               else {
+#ifdef WORDS_BIGENDIAN
+                    D[1] = S[1];
+#else
+                    D[0] = S[0];
+#endif
+               }
+          }
+          S += 2;
+          D += 2;
+     }
+     
+     if (l & 1) {                 /* do the last potential pixel */
+          if ((*D & 0x00ffffff) == Dkey)
+               *D = *S;
+     }
+}
+
+static void Bop_32_Sto_Aop_64( GenefxState *gfxs )
+{
+     int    w, l   = gfxs->length;
+     int    i      = 0;
+     u32   *D      = gfxs->Aop[0];
+     u32   *S      = gfxs->Bop[0];
+     int    SperD  = gfxs->SperD;
+     int    SperD2 = SperD << 1;
+     
+     if ((long)D & 4) {
+          *D++ = *S;
+          i += SperD;
+          l--;
+     }
+     
+     for (w = l >> 1; w; w--) {
+#ifdef WORDS_BIGENDIAN
+          *((u64*)D) = ((u64)S[i>>16] << 32) | S[(i+SperD)>>16];
+#else
+          *((u64*)D) = ((u64)S[(i+SperD)>>16] << 32) | S[i>>16];
+#endif
+          D += 2;
+          i += SperD2;
+     }
+     
+     if (l & 1)
+          *D = S[i>>16];
+}
+
+static void Dacc_xor_64( GenefxState *gfxs )
+{
+     int    w     = gfxs->length;
+     u64   *D     = (u64*)gfxs->Dacc;
+     u64    color;
+
+#ifdef WORDS_BIGENDIAN
+     color = ((u64)gfxs->color.b << 48) |
+             ((u64)gfxs->color.g << 32) |
+             ((u64)gfxs->color.r << 16) |
+             ((u64)gfxs->color.a);
+#else
+     color = ((u64)gfxs->color.a << 48) |
+             ((u64)gfxs->color.r << 32) |
+             ((u64)gfxs->color.g << 16) |
+             ((u64)gfxs->color.b);
+#endif
+
+     for (; w; w--) {
+          *D ^= color;
+          D++;
+     }
+}
+
diff --git a/Source/DirectFB/src/gfx/generic/generic_dummy.c b/Source/DirectFB/src/gfx/generic/generic_dummy.c
new file mode 100755
index 0000000..00032a7
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/generic_dummy.c
@@ -0,0 +1,94 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <directfb.h>
+
+#include <core/gfxcard.h>
+
+#include <direct/messages.h>
+
+
+void
+gGetDriverInfo( GraphicsDriverInfo *info )
+{
+     D_INFO( "DirectFB/Genefx: No software fallbacks supported\n" );
+
+     snprintf( info->name, DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, "Software Driver" );
+     snprintf( info->vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 0;
+}
+
+void
+gGetDeviceInfo( GraphicsDeviceInfo *info )
+{
+     snprintf( info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Software Rasterizer" );
+     snprintf( info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Dummy" );
+
+     info->caps.accel    = DFXL_NONE;
+     info->caps.flags    = 0;
+     info->caps.drawing  = DSDRAW_NOFX;
+     info->caps.blitting = DSBLIT_NOFX;
+}
+
+bool
+gAcquire( CardState *state, DFBAccelerationMask accel )
+{
+     return false;
+}
+
+void
+gRelease( CardState *state )
+{
+}
+
+void
+gFillRectangle( CardState *state, DFBRectangle *rect )
+{
+}
+
+void
+gDrawLine( CardState *state, DFBRegion *line )
+{
+}
+
+void
+gBlit( CardState *state, DFBRectangle *rect, int dx, int dy )
+{
+}
+
+void
+gStretchBlit( CardState *state, DFBRectangle *srect, DFBRectangle *drect )
+{
+}
+
diff --git a/Source/DirectFB/src/gfx/generic/generic_mmx.h b/Source/DirectFB/src/gfx/generic/generic_mmx.h
new file mode 100755
index 0000000..57757f3
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/generic_mmx.h
@@ -0,0 +1,659 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+
+#define __aligned( n )  __attribute__ ((aligned((n))))
+
+
+static void SCacc_add_to_Dacc_MMX( GenefxState *gfxs )
+{
+     __asm__ __volatile__ (
+               "    movq     %2, %%mm0\n"
+               ".align   16\n"
+               "1:\n"
+               "    movq     (%0), %%mm1\n"
+               "    paddw    %%mm0, %%mm1\n"
+               "    movq     %%mm1, (%0)\n"
+               "    add      $8, %0\n"
+               "    dec      %1\n"
+               "    jnz      1b\n"
+               "    emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "m" (gfxs->SCacc)
+               : "%st", "memory");
+}
+
+static void Dacc_modulate_argb_MMX( GenefxState *gfxs )
+{
+     __asm__ __volatile__ (
+               "movq     %2, %%mm0\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "testw    $0xF000, 6(%0)\n\t"
+               "jnz      2f\n\t"
+               "movq     (%0), %%mm1\n\t"
+               "pmullw   %%mm0, %%mm1\n\t"
+               "psrlw    $8, %%mm1\n\t"
+               "movq     %%mm1, (%0)\n"
+               ".align   16\n"
+               "2:\n\t"
+               "add      $8, %0\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "m" (gfxs->Cacc)
+               : "%st", "memory");
+}
+
+static void Sacc_add_to_Dacc_MMX( GenefxState *gfxs )
+{
+     __asm__ __volatile__ (
+               ".align   16\n"
+               "1:\n\t"
+               "movq     (%2), %%mm0\n\t"
+               "movq     (%0), %%mm1\n\t"
+               "paddw    %%mm1, %%mm0\n\t"
+               "movq     %%mm0, (%0)\n\t"
+               "add      $8, %0\n\t"
+               "add      $8, %2\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "S" (gfxs->Sacc)
+               : "%st", "memory");
+}
+
+static void Sacc_to_Aop_rgb16_MMX( GenefxState *gfxs )
+{
+     static const u32 preload[] = { 0xFF00FF00, 0x0000FF00 };
+     static const u32 mask[]    = { 0x00FC00F8, 0x000000F8 };
+     static const u32 pm[]      = { 0x01000004, 0x00000004 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm7\n\t"
+	       "movq     %4, %%mm5\n\t"
+	       "movq     %5, %%mm4\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "testw    $0xF000, 6(%2)\n\t"
+               "jnz      2f\n\t"
+               "movq     (%2), %%mm0\n\t"
+               "paddusw  %%mm7, %%mm0\n\t"
+               "pand     %%mm5, %%mm0\n\t"
+               "pmaddwd  %%mm4, %%mm0\n\t"
+               "psrlq    $5, %%mm0\n\t"
+               "movq     %%mm0, %%mm1\n\t"
+               "psrlq    $21, %%mm0\n\t"
+               "por      %%mm1, %%mm0\n\t"
+               "movd     %%mm0, %%eax\n\t"
+               "movw     %%ax, (%0)\n\t"
+               ".align 16\n"
+               "2:\n\t"
+               "add      $8, %2\n\t"
+	       "add      $2, %0\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Aop[0]), "c" (gfxs->length), "S" (gfxs->Sacc),
+                 "m" (*preload), "m" (*mask), "m" (*pm)
+               : "%eax", "%st", "memory");
+}
+
+static void Sacc_to_Aop_rgb32_MMX( GenefxState *gfxs )
+{
+     static const u32 preload[]  = { 0xFF00FF00, 0x0000FF00 };
+     static const u32 postload[] = { 0x00FF00FF, 0x000000FF };
+     static const u32 pm[]       = { 0x01000001, 0x00000001 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm1\n\t"
+	       "movq     %4, %%mm2\n\t"
+	       "movq     %5, %%mm3\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "testw    $0xF000, 6(%2)\n\t"
+               "jnz      2f\n\t"
+               "movq     (%2), %%mm0\n\t"
+               "paddusw  %%mm1, %%mm0\n\t"
+               "pand     %%mm2, %%mm0\n\t"
+               "pmaddwd  %%mm3, %%mm0\n\t"
+               "movq     %%mm0, %%mm4\n\t"
+               "psrlq    $16, %%mm0\n\t"
+               "por      %%mm0, %%mm4\n\t"
+               "movd     %%mm4, (%0)\n\t"
+               ".align 16\n"
+               "2:\n\t"
+               "add      $8, %2\n\t"
+	       "add      $4, %0\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Aop[0]), "c" (gfxs->length), "S" (gfxs->Sacc),
+                 "m" (*preload), "m" (*postload), "m" (*pm)
+               : "%st", "memory");
+}
+
+__attribute__((no_instrument_function))
+static void Sop_argb_Sto_Dacc_MMX( GenefxState *gfxs )
+{
+     static const u32 zeros[]  = { 0, 0 };
+     int i = 0;
+
+     __asm__ __volatile__ (
+	       "movq     %5, %%mm0\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "movd     (%3), %%mm1\n\t"
+               "punpcklbw %%mm0, %%mm1\n\t"
+               ".align   16\n"
+               "2:\n\t"
+               "movq     %%mm1, (%1)\n\t"
+               "dec      %2\n\t"
+               "jz       3f\n\t"
+               "add      $8, %1\n\t"
+               "add      %4, %0\n\t"
+               "testl    $0xFFFF0000, %0\n\t"
+               "jz       2b\n\t"
+               "movl     %0, %%edx\n\t"
+               "andl     $0xFFFF0000, %%edx\n\t"
+               "shrl     $14, %%edx\n\t"
+#ifdef ARCH_X86_64
+               "addq     %%rdx, %3\n\t"
+#else
+               "addl     %%edx, %3\n\t"
+#endif
+               "andl     $0xFFFF, %0\n\t"
+               "jmp      1b\n"
+               "3:\n\t"
+               "emms"
+               : "=r" (i)
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "S" (gfxs->Sop[0]),
+                 "a" (gfxs->SperD), "m" (*zeros), "0" (i)
+               : "%edx", "%st", "memory");
+}
+
+static void Sop_argb_to_Dacc_MMX( GenefxState *gfxs )
+{
+     static const u32 zeros[]  = { 0, 0 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm0\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "movd     (%2), %%mm1\n\t"
+               "punpcklbw %%mm0, %%mm1\n\t"
+               "movq     %%mm1, (%0)\n\t"
+               "add      $4, %2\n\t"
+               "add      $8, %0\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length),
+                 "S" (gfxs->Sop[0]), "m" (*zeros)
+               : "%st", "memory");
+}
+
+static void Sop_rgb16_to_Dacc_MMX( GenefxState *gfxs )
+{
+     static const u32 mask[]  = { 0x07E0001F, 0x0000F800 };
+     static const u32 smul[]  = { 0x00200800, 0x00000001 };
+     static const u32 alpha[] = { 0x00000000, 0x00FF0000 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm4\n\t"
+	       "movq     %4, %%mm5\n\t"
+	       "movq     %5, %%mm7\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "movq     (%2), %%mm0\n\t"
+               /* 1. Konvertierung nach 24 bit interleaved */
+	       "movq     %%mm0, %%mm3\n\t"
+               "punpcklwd %%mm3, %%mm3\n\t"
+               "punpckldq %%mm3, %%mm3\n\t"
+               "pand     %%mm4, %%mm3\n\t"
+               "pmullw   %%mm5, %%mm3\n\t"
+               "psrlw    $8, %%mm3\n\t"
+               /* mm3 enthaelt jetzt: 0000 00rr 00gg 00bb des alten pixels */
+               "por      %%mm7, %%mm3\n\t"
+               "movq     %%mm3, (%0)\n\t"
+               "dec      %1\n\t"
+               "jz       2f\n\t"
+               "psrlq    $16, %%mm0\n\t"
+	       "add      $8, %0\n\t"
+               /* 2. Konvertierung nach 24 bit interleaved */
+	       "movq     %%mm0, %%mm3\n\t"
+               "punpcklwd %%mm3, %%mm3\n\t"
+               "punpckldq %%mm3, %%mm3\n\t"
+               "pand     %%mm4, %%mm3\n\t"
+               "pmullw   %%mm5, %%mm3\n\t"
+               "psrlw    $8, %%mm3\n\t"
+               /* mm3 enthaelt jetzt: 0000 00rr 00gg 00bb des alten pixels */
+               "por      %%mm7, %%mm3\n\t"
+               "movq     %%mm3, (%0)\n\t"
+               "dec      %1\n\t"
+               "jz       2f\n\t"
+               "psrlq    $16, %%mm0\n\t"
+	       "add      $8, %0\n\t"
+               /* 3. Konvertierung nach 24 bit interleaved */
+	       "movq     %%mm0, %%mm3\n\t"
+               "punpcklwd %%mm3, %%mm3\n\t"
+               "punpckldq %%mm3, %%mm3\n\t"
+               "pand     %%mm4, %%mm3\n\t"
+               "pmullw   %%mm5, %%mm3\n\t"
+               "psrlw    $8, %%mm3\n\t"
+               /* mm3 enthaelt jetzt: 0000 00rr 00gg 00bb des alten pixels */
+               "por      %%mm7, %%mm3\n\t"
+               "movq     %%mm3, (%0)\n\t"
+               "dec      %1\n\t"
+               "jz       2f\n\t"
+               "psrlq    $16, %%mm0\n\t"
+	       "add      $8, %0\n\t"
+               /* 4. Konvertierung nach 24 bit interleaved */
+	       "movq     %%mm0, %%mm3\n\t"
+               "punpcklwd %%mm3, %%mm3\n\t"
+               "punpckldq %%mm3, %%mm3\n\t"
+               "pand     %%mm4, %%mm3\n\t"
+               "pmullw   %%mm5, %%mm3\n\t"
+               "psrlw    $8, %%mm3\n\t"
+               /* mm3 enthaelt jetzt: 0000 00rr 00gg 00bb des alten pixels */
+               "por      %%mm7, %%mm3\n\t"
+               "movq     %%mm3, (%0)\n\t"
+               "dec      %1\n\t"
+               "jz       2f\n\t"
+	       "add      $8, %0\n\t"
+	       "add      $8, %2\n\t"
+               "jmp      1b\n"
+               "2:\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "S" (gfxs->Sop[0]),
+                 "m" (*mask), "m" (*smul), "m" (*alpha)
+               : "%st", "memory");
+}
+
+static void Sop_rgb32_to_Dacc_MMX( GenefxState *gfxs )
+{
+     static const u32 alpha[]  = { 0, 0x00FF0000 };
+     static const u32 zeros[]  = { 0, 0 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm7\n\t"
+	       "movq     %4, %%mm6\n\t"
+               ".align   16\n"
+               "1:\n\t"
+               "movd     (%2), %%mm0\n\t"
+               "punpcklbw %%mm6, %%mm0\n\t"
+               "por      %%mm7, %%mm0\n\t"
+               "movq     %%mm0, (%0)\n\t"
+	       "add      $4, %2\n\t"
+	       "add      $8, %0\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Dacc), "c" (gfxs->length), "S" (gfxs->Sop[0]),
+                 "m" (*alpha), "m" (*zeros)
+               : "%st", "memory");
+}
+
+static void Xacc_blend_invsrcalpha_MMX( GenefxState *gfxs )
+{
+     static const u32 einser[] = { 0x01000100, 0x01000100 };
+     static const u32 zeros[]  = { 0, 0 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm7\n\t"
+               "cmp      $0, %2\n\t"
+               "jne      1f\n\t"
+               "movq     %4, %%mm6\n\t"
+               "movd     %5, %%mm0\n\t"
+               "punpcklbw %%mm6, %%mm0\n\t" /* mm0 = 00aa 00rr 00gg 00bb */
+               "punpcklwd %%mm0, %%mm0\n\t" /* mm0 = 00aa 00aa xxxx xxxx */
+               "movq      %%mm7, %%mm1\n\t"
+               "punpckldq %%mm0, %%mm0\n\t" /* mm0 = 00aa 00aa 00aa 00aa */
+               "psubw     %%mm0, %%mm1\n\t"
+
+               ".align   16\n"
+               "2:\n\t"                 /* blend from color */
+               "testw    $0xF000, 6(%0)\n\t"
+               "jnz      3f\n\t"
+               "movq     (%0), %%mm0\n\t"
+               "pmullw   %%mm1, %%mm0\n\t"
+               "psrlw    $8, %%mm0\n\t"
+               "movq     %%mm0, (%6)\n\t"
+               "jmp      4f\n\t"
+               "3:\n\t"
+               "movq     (%0), %%mm0\n\t"
+               "movq     %%mm0, (%6)\n\t"
+               "4:\n\t"
+	       "add      $8, %0\n\t"
+	       "add      $8, %6\n\t"
+               "dec      %1\n\t"
+               "jnz      2b\n\t"
+               "jmp      9f\n\t"
+
+               ".align   16\n"
+               "1:\n\t"                      /* blend from Sacc */
+               "testw    $0xF000, 6(%0)\n\t"
+               "jnz      5f\n\t"
+               "movq     (%2), %%mm2\n\t"
+               "movq     (%0), %%mm0\n\t"
+	       "punpckhwd %%mm2, %%mm2\n\t" /* mm2 = 00aa 00aa xxxx xxxx */
+               "movq	  %%mm7, %%mm1\n\t"
+               "punpckhdq %%mm2, %%mm2\n\t" /* mm2 = 00aa 00aa 00aa 00aa */
+               "psubw    %%mm2, %%mm1\n\t"
+               "pmullw   %%mm1, %%mm0\n\t"
+               "psrlw    $8, %%mm0\n\t"
+               "movq     %%mm0, (%6)\n\t"
+               "jmp      6f\n\t"
+               "5:\n\t"
+               "movq     (%0), %%mm0\n\t"
+               "movq     %%mm0, (%6)\n\t"
+               "6:\n\t"
+	       "add      $8, %2\n\t"
+	       "add      $8, %0\n\t"
+	       "add      $8, %6\n\t"
+               "dec      %1\n\t"
+               "jnz      1b\n\t"
+               "9:\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Yacc), "c" (gfxs->length), "S" (gfxs->Sacc),
+                 "m" (*einser), "m" (*zeros), "m" (gfxs->color), "r" (gfxs->Xacc)
+               : "%st", "memory");
+}
+
+static void Xacc_blend_srcalpha_MMX( GenefxState *gfxs )
+{
+     static const u32 ones[]  = { 0x00010001, 0x00010001 };
+     static const u32 zeros[] = { 0, 0 };
+
+     __asm__ __volatile__ (
+	       "movq     %3, %%mm7\n\t"
+               "cmp      $0, %2\n\t"
+               "jne      3f\n\t"
+               "movq     %4, %%mm6\n\t"
+               "movd     %5, %%mm0\n\t"
+               "punpcklbw %%mm6, %%mm0\n\t" /* mm0 = 00aa 00rr 00gg 00bb */
+               "punpcklwd %%mm0, %%mm0\n\t" /* mm0 = 00aa 00aa xxxx xxxx */
+               "punpckldq %%mm0, %%mm0\n\t" /* mm0 = 00aa 00aa 00aa 00aa */
+               "paddw     %%mm7, %%mm0\n\t"
+
+               ".align   16\n\t"
+               "4:\n\t"                 /* blend from color */
+               "testw    $0xF000, 6(%0)\n\t"
+               "jnz      6f\n\t"
+               "movq     (%0), %%mm1\n\t"
+               "pmullw   %%mm0, %%mm1\n\t"
+               "psrlw    $8, %%mm1\n\t"
+               "movq     %%mm1, (%6)\n\t"
+               "jmp      1f\n\t"
+               "6:\n\t"
+               "movq     (%0), %%mm1\n\t"
+               "movq     %%mm1, (%6)\n\t"
+               "1:\n\t"
+	       "add      $8, %0\n\t"
+	       "add      $8, %6\n\t"
+               "dec      %1\n\t"
+               "jnz      4b\n\t"
+               "jmp      2f\n\t"
+
+               ".align   16\n\t"
+               "3:\n\t"                      /* blend from Sacc */
+               "testw    $0xF000, 6(%0)\n\t"
+               "jnz      5f\n\t"
+               "movq     (%2), %%mm0\n\t"
+               "movq     (%0), %%mm1\n\t"
+	       "punpckhwd %%mm0, %%mm0\n\t" /* mm2 = 00aa 00aa xxxx xxxx */
+               "punpckhdq %%mm0, %%mm0\n\t" /* mm2 = 00aa 00aa 00aa 00aa */
+               "paddw    %%mm7, %%mm0\n\t"
+               "pmullw   %%mm0, %%mm1\n\t"
+               "psrlw    $8, %%mm1\n\t"
+               "movq     %%mm1, (%6)\n\t"
+               "jmp      7f\n\t"
+               "5:\n\t"
+               "movq     (%0), %%mm1\n\t"
+               "movq     %%mm1, (%6)\n\t"
+               "7:\n\t"
+	       "add      $8, %2\n\t"
+	       "add      $8, %0\n\t"
+	       "add      $8, %6\n\t"
+               "dec      %1\n\t"
+               "jnz      3b\n\t"
+               "2:\n\t"
+               "emms"
+               : /* no outputs */
+               : "D" (gfxs->Yacc), "c" (gfxs->length), "S" (gfxs->Sacc),
+                 "m" (*ones), "m" (*zeros), "m" (gfxs->color), "r" (gfxs->Xacc)
+               : "%st", "memory");
+}
+
+static void Dacc_YCbCr_to_RGB_MMX( GenefxState *gfxs )
+{  
+     static const u16 __aligned(8) sub0[4] = {  16,  16,  16,  16 }; 
+     static const u16 __aligned(8) sub1[4] = { 128, 128, 128, 128 };
+     static const s16 __aligned(8) mul[20] = {
+                     0x253F,  0x253F,  0x253F,  0x253F, // Y       Coeff.
+                     0x3312,  0x3312,  0x3312,  0x3312, // V Red   Coeff.
+                     0x4093,  0x4093,  0x4093,  0x4093, // U Blue  Coeff.
+                    -0x1A04, -0x1A04, -0x1A04, -0x1A04, // V Green Coeff.
+                    -0x0C83, -0x0C83, -0x0C83, -0x0C83  // U Green Coeff.
+     };
+
+     int                w = gfxs->length & 3;
+     GenefxAccumulator *D = gfxs->Dacc;
+     
+     __asm__ __volatile__ (
+          "shrl          $2,    %1\n\t"
+          "jz            2f\n\t"
+          "pxor       %%mm7, %%mm7\n\t"
+               ".align 16\n"
+               "1:\n\t"
+               "movq        (%0), %%mm0\n\t" // 00 a0 00 y0 00 v0 00 u0
+               "movq       8(%0), %%mm1\n\t" // 00 a1 00 y1 00 v1 00 u1
+               "movq      16(%0), %%mm2\n\t" // 00 a2 00 y2 00 v2 00 u2
+               "movq      24(%0), %%mm3\n\t" // 00 a3 00 y3 00 v3 00 u3
+               "movq       %%mm0, %%mm4\n\t" // 00 a0 00 y0 00 v0 00 u0
+               "movq       %%mm2, %%mm5\n\t" // 00 a2 00 y2 00 v2 00 u2
+               "punpcklwd  %%mm1, %%mm0\n\t" // 00 v1 00 v0 00 u1 00 u0
+               "punpcklwd  %%mm3, %%mm2\n\t" // 00 v3 00 v2 00 u3 00 u2
+               "punpckhwd  %%mm1, %%mm4\n\t" // 00 a1 00 a0 00 y1 00 y0
+               "punpckhwd  %%mm3, %%mm5\n\t" // 00 a3 00 a2 00 y3 00 y2
+               "movq       %%mm0, %%mm1\n\t" // 00 v1 00 v1 00 u1 00 u0
+               "movq       %%mm4, %%mm3\n\t" // 00 a1 00 a0 00 y1 00 y0
+               "punpckldq  %%mm2, %%mm0\n\t" // 00 u3 00 u2 00 u1 00 u0
+               "punpckldq  %%mm5, %%mm3\n\t" // 00 y3 00 y2 00 y1 00 y0
+               "punpckhdq  %%mm2, %%mm1\n\t" // 00 v3 00 v2 00 v1 00 v0
+               "punpckhdq  %%mm5, %%mm4\n\t" // 00 a3 00 a2 00 a1 00 a0
+               /* mm0 = u, mm1 = v, mm3 = y, mm4 = a */
+               "psubw         %2, %%mm3\n\t" // y -= 16
+               "psllw         $3, %%mm3\n\t" // precision
+               "pmulhw      (%4), %%mm3\n\t"
+               "psubw         %3, %%mm1\n\t" // v -= 128 
+               "psllw         $3, %%mm1\n\t" // precision
+               "movq       %%mm1, %%mm2\n\t" // 00 v3 00 v2 00 v1 00 v0
+               "pmulhw     8(%4), %%mm2\n\t" // vr
+               "psubw         %3, %%mm0\n\t" // u -= 128 
+               "psllw         $3, %%mm0\n\t" // precision
+               "movq       %%mm0, %%mm5\n\t" // 00 u3 00 u2 00 u1 00 u0
+               "pmulhw    16(%4), %%mm5\n\t" // ub
+               "paddw      %%mm3, %%mm2\n\t" // 00 r3 00 r2 00 r1 00 r0
+               "paddw      %%mm3, %%mm5\n\t" // 00 b3 00 b2 00 b1 00 b0
+               "pmulhw    24(%4), %%mm1\n\t" // vg
+               "packuswb   %%mm2, %%mm2\n\t" // r3 r2 r1 r0 r3 r2 r1 r0
+               "packuswb   %%mm5, %%mm5\n\t" // b3 b2 b1 b0 b3 b2 b1 b0
+               "pmulhw    32(%4), %%mm0\n\t" // ug
+               "punpcklbw  %%mm7, %%mm2\n\t" // 00 r3 00 r2 00 r1 00 r0
+               "punpcklbw  %%mm7, %%mm5\n\t" // 00 b3 00 b2 00 b1 00 b0
+               "paddw      %%mm1, %%mm3\n\t" // y + vg
+               "paddw      %%mm0, %%mm3\n\t" // 00 g3 00 g2 00 g1 00 g0
+               "packuswb   %%mm3, %%mm3\n\t" // g3 g2 g1 g0 g3 g2 g1 g0
+               "punpcklbw  %%mm7, %%mm3\n\t" // 00 g3 00 g2 00 g1 00 g0
+               /* mm5 = b, mm3 = g, mm2 = r, mm4 = a */
+               "movq       %%mm5, %%mm0\n\t" // 00 b3 00 b2 00 b1 00 b0
+               "movq       %%mm3, %%mm1\n\t" // 00 g3 00 g2 00 g1 00 g0
+               "punpcklwd  %%mm2, %%mm0\n\t" // 00 r1 00 b1 00 r0 00 b0
+               "punpcklwd  %%mm4, %%mm1\n\t" // 00 a1 00 g1 00 a0 00 g0
+               "punpckhwd  %%mm2, %%mm5\n\t" // 00 r3 00 b3 00 r2 00 b2
+               "punpckhwd  %%mm4, %%mm3\n\t" // 00 a3 00 g3 00 a2 00 g2
+               "movq       %%mm0, %%mm2\n\t" // 00 r1 00 b1 00 r0 00 b0
+               "movq       %%mm5, %%mm4\n\t" // 00 r3 00 b3 00 r2 00 b2
+               "punpcklwd  %%mm1, %%mm0\n\t" // 00 a0 00 r0 00 g0 00 b0
+               "punpcklwd  %%mm3, %%mm5\n\t" // 00 a2 00 r2 00 g2 00 b2
+               "punpckhwd  %%mm1, %%mm2\n\t" // 00 a1 00 r1 00 g1 00 b1
+               "punpckhwd  %%mm3, %%mm4\n\t" // 00 a3 00 r3 00 g3 00 b3
+               "movq       %%mm0,  (%0)\n\t"
+               "movq       %%mm2, 8(%0)\n\t"
+               "movq       %%mm5,16(%0)\n\t"
+               "movq       %%mm4,24(%0)\n\t"
+               "add          $32,    %0\n\t"
+               "decl          %1\n\t"
+               "jnz           1b\n\t"
+          "emms\n\t"
+          "2:"     
+          : "=&D" (D)
+          : "c" (gfxs->length), "m" (*sub0), "m" (*sub1), "r" (mul), "0" (D)
+          : "memory" );
+
+     while (w) {
+          if (!(D->YUV.a & 0xF000))
+               YCBCR_TO_RGB( D->YUV.y, D->YUV.u, D->YUV.v,
+                             D->RGB.r, D->RGB.g, D->RGB.b );
+
+          D++;
+          w--;
+     }
+}
+
+static void Dacc_RGB_to_YCbCr_MMX( GenefxState *gfxs )
+{
+     static const u16 __aligned(8) add0[4] = { 128, 128, 128, 128 };
+     static const u16 __aligned(8) add1[4] = {  16,  16,  16,  16 };
+     static const u16 __aligned(8) mul[24] = {
+                    0x03A5, 0x03A5, 0x03A5, 0x03A5, // Eb
+                    0x12C8, 0x12C8, 0x12C8, 0x12C8, // Eg
+                    0x0991, 0x0991, 0x0991, 0x0991, // Er
+                    0x0FE1, 0x0FE1, 0x0FE1, 0x0FE1, // Cb
+                    0x140A, 0x140A, 0x140A, 0x140A, // Cr
+                    0x1B7B, 0x1B7B, 0x1B7B, 0x1B7B  // Y
+     };
+      
+     int                w = gfxs->length & 3;
+     GenefxAccumulator *D = gfxs->Dacc;
+     
+     __asm__ __volatile__(
+          "shrl          $2,    %1\n\t"
+          "jz            2f\n\t" 
+          "pxor       %%mm7, %%mm7\n\t"     
+               ".align 16\n"
+               "1:\n\t"
+               "movq        (%0), %%mm0\n\t" // 00 a0 00 r0 00 g0 00 b0
+               "movq       8(%0), %%mm1\n\t" // 00 a1 00 r1 00 g1 00 b1
+               "movq      16(%0), %%mm2\n\t" // 00 a2 00 r2 00 g2 00 b2
+               "movq      24(%0), %%mm3\n\t" // 00 a3 00 r3 00 g3 00 b3
+               "movq       %%mm0, %%mm4\n\t" // 00 a0 00 r0 00 g0 00 b0
+               "movq       %%mm2, %%mm6\n\t" // 00 a2 00 r2 00 g2 00 b2
+               "punpcklwd  %%mm1, %%mm0\n\t" // 00 g1 00 g0 00 b1 00 b0
+               "punpcklwd  %%mm3, %%mm2\n\t" // 00 g3 00 g2 00 b3 00 b2
+               "movq       %%mm0, %%mm5\n\t" // 00 g1 00 g0 00 b1 00 b0
+               "punpckldq  %%mm2, %%mm0\n\t" // 00 b3 00 b2 00 b1 00 b0
+               "punpckhdq  %%mm2, %%mm5\n\t" // 00 g3 00 g2 00 g1 00 g0
+               "punpckhwd  %%mm1, %%mm4\n\t" // 00 a1 00 a0 00 r1 00 r0
+               "punpckhwd  %%mm3, %%mm6\n\t" // 00 a3 00 a2 00 r3 00 r2
+               "movq       %%mm4, %%mm3\n\t" // 00 a1 00 a0 00 r1 00 r0
+               "punpckldq  %%mm6, %%mm4\n\t" // 00 r3 00 r2 00 r1 00 r0
+               "punpckhdq  %%mm6, %%mm3\n\t" // 00 a3 00 a2 00 a1 00 a0
+               /* mm0 = b, mm5 = g, mm4 = r, mm3 = a */
+               "movq       %%mm0, %%mm1\n\t" // save b
+               "psllw         $3, %%mm0\n\t"
+               "pmulhw      (%2), %%mm0\n\t"
+               "movq       %%mm4, %%mm2\n\t" // save r
+               "psllw         $3, %%mm5\n\t"
+               "pmulhw     8(%2), %%mm5\n\t"
+               "psllw         $3, %%mm4\n\t"
+               "pmulhw    16(%2), %%mm4\n\t"
+               "paddw      %%mm5, %%mm0\n\t"
+               "paddw      %%mm4, %%mm0\n\t" // ey
+               "psubw      %%mm0, %%mm1\n\t" // b - ey
+               "psllw         $3, %%mm1\n\t"
+               "pmulhw    24(%2), %%mm1\n\t" // 00 u3 00 u2 00 u1 00 u0
+               "psubw      %%mm0, %%mm2\n\t" // r - ey
+               "psllw         $3, %%mm2\n\t"
+               "pmulhw    32(%2), %%mm2\n\t" // 00 v3 00 v2 00 v1 00 v0
+               "paddw         %3, %%mm1\n\t" // Cb + 128
+               "packuswb   %%mm1, %%mm1\n\t" // u3 u2 u1 u0 u3 u2 u1 u0
+               "psllw         $3, %%mm0\n\t"
+               "pmulhw    40(%2), %%mm0\n\t" // 00 y3 00 y2 00 y1 00 y0
+               "paddw         %3, %%mm2\n\t" // Cr + 128
+               "packuswb   %%mm2, %%mm2\n\t" // v3 v2 v1 v0 v3 v2 v1 v0  
+               "paddw         %4, %%mm0\n\t" // Y + 16
+               "packuswb   %%mm0, %%mm0\n\t" // y3 y2 y1 y0 y3 y2 y1 y0
+               "punpcklbw  %%mm7, %%mm2\n\t" // 00 v3 00 v2 00 v1 00 v0
+               "punpcklbw  %%mm7, %%mm1\n\t" // 00 u3 00 y2 00 u1 00 u0
+               "punpcklbw  %%mm7, %%mm0\n\t" // 00 y3 00 y2 00 y1 00 y0 
+               /* mm1 = u, mm2 = v, mm0 = y, mm3 = a */
+               "movq       %%mm2, %%mm4\n\t" // 00 v3 00 v2 00 v1 00 v0
+               "movq       %%mm1, %%mm5\n\t" // 00 u3 00 y2 00 u1 00 u0
+               "punpcklwd  %%mm3, %%mm2\n\t" // 00 a1 00 v1 00 a0 00 v0
+               "punpcklwd  %%mm0, %%mm1\n\t" // 00 y1 00 u1 00 y0 00 u0
+               "punpckhwd  %%mm3, %%mm4\n\t" // 00 a3 00 v3 00 a2 00 v2
+               "punpckhwd  %%mm0, %%mm5\n\t" // 00 y3 00 u3 00 y2 00 u2
+               "movq       %%mm1, %%mm3\n\t" // 00 y1 00 u1 00 y0 00 u0
+               "movq       %%mm5, %%mm6\n\t" // 00 y3 00 u3 00 y2 00 u2
+               "punpcklwd  %%mm2, %%mm1\n\t" // 00 a0 00 y0 00 v0 00 u0
+               "punpcklwd  %%mm4, %%mm5\n\t" // 00 a2 00 y2 00 v2 00 u2
+               "punpckhwd  %%mm2, %%mm3\n\t" // 00 a1 00 y1 00 v1 00 u1
+               "punpckhwd  %%mm4, %%mm6\n\t" // 00 a3 00 y3 00 v3 00 u3
+               "movq       %%mm1,  (%0)\n\t"
+               "movq       %%mm3, 8(%0)\n\t"
+               "movq       %%mm5,16(%0)\n\t"
+               "movq       %%mm6,24(%0)\n\t"
+               "add          $32, %0\n\t"
+               "decl          %1\n\t"
+               "jnz           1b\n\t"
+          "emms\n\t"
+          "2:"
+          : "=&D" (D)
+          : "c" (gfxs->length), "r" (mul), "m" (*add0), "m" (*add1), "0" (D)
+          : "memory" );
+
+     while (w) {
+          if (!(D->RGB.a & 0xF000))
+               RGB_TO_YCBCR( D->RGB.r, D->RGB.g, D->RGB.b,
+                             D->YUV.y, D->YUV.u, D->YUV.v );
+
+          D++;
+          w--;
+     }
+}
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_hvx_16.h b/Source/DirectFB/src/gfx/generic/stretch_hvx_16.h
new file mode 100755
index 0000000..01cf41f
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_hvx_16.h
@@ -0,0 +1,469 @@
+#ifndef SOURCE_LOOKUP
+#define SOURCE_LOOKUP(x) (x)
+#define SOURCE_LOOKUP_AUTO
+#endif
+
+#ifndef SOURCE_TYPE
+#define SOURCE_TYPE u16
+#define SOURCE_TYPE_AUTO
+#endif
+
+
+#define SHIFT_L5    SHIFT_R5
+#define SHIFT_L6    SHIFT_R6
+#define SHIFT_L10   (16-SHIFT_L6)
+
+#define X_003F      (X_07E0>>SHIFT_R5)
+
+#define X_003E07C0  (X_F81F<<SHIFT_L6)
+#define X_0001F800  (X_07E0<<SHIFT_L6)
+
+#define X_07E0F81F  ((X_07E0<<16) | X_F81F)
+#define X_F81F07E0  ((X_F81F<<16) | X_07E0)
+
+#define X_F81FF81F  ((X_F81F<<16) | X_F81F)
+#define X_07E007E0  ((X_07E0<<16) | X_07E0)
+
+#define X_07C0F83F  (X_F81F07E0>>SHIFT_R5)
+
+#if 0
+#define HVX_DEBUG(x...)  direct_log_printf( NULL, x )
+#else
+#define HVX_DEBUG(x...)  do {} while (0)
+#endif
+
+/* stretch_hvx_up/down_16_KPI */( void             *dst,
+                                  int               dpitch,
+                                  const void       *src,
+                                  int               spitch,
+                                  int               width,
+                                  int               height,
+                                  int               dst_width,
+                                  int               dst_height,
+                                  const StretchCtx *ctx )
+{
+     long  x, y, r = 0;
+     long  head    = ((((ulong) dst) & 2) >> 1) ^ (ctx->clip.x1 & 1);
+     long  cw      = ctx->clip.x2 - ctx->clip.x1 + 1;
+     long  ch      = ctx->clip.y2 - ctx->clip.y1 + 1;
+     long  tail    = (cw - head) & 1;
+     long  w2      = (cw - head) / 2;
+     long  hfraq   = ((long)(width  - MINUS_1) << 18) / (long)(dst_width);
+     long  vfraq   = ((long)(height - MINUS_1) << 18) / (long)(dst_height);
+     long  dp4     = dpitch / 4;
+     long  point0  = POINT_0 + ctx->clip.x1 * hfraq;
+     long  point   = point0;
+     long  line    = LINE_0 + ctx->clip.y1 * vfraq;
+     long  ratios[cw];
+     u32  *dst32;
+
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+     u32   dt;
+     u16   l_, h_;
+#endif
+
+     u32   _lbT[w2+8];
+     u32   _lbB[w2+8];
+
+     u32  *lbX;
+     u32  *lbT = (u32*)((((ulong)(&_lbT[0])) + 31) & ~31);
+     u32  *lbB = (u32*)((((ulong)(&_lbB[0])) + 31) & ~31);
+
+     long  lineT = -2000;
+
+     for (x=0; x<cw; x++) {
+          ratios[x] = POINT_TO_RATIO( point, hfraq );
+
+          point += hfraq;
+     }
+
+     HVX_DEBUG(" %s  %dx%d -> %dx%d  (0x%lx, 0x%lx) prot %lx, key %lx\n",
+               __FUNCTION__, width, height, dst_width, dst_height, hfraq, vfraq, ctx->protect, ctx->key );
+
+     dst += ctx->clip.x1 * 2 + ctx->clip.y1 * dpitch;
+
+     dst32 = dst;
+
+     if (head) {
+          u32 dpT, dpB, L, R;
+
+          u16 *dst16 = dst;
+
+          point = point0;
+
+          for (y=0; y<ch; y++) {
+               long X = LINE_TO_RATIO( line, vfraq );
+
+               const SOURCE_TYPE *srcT = src + spitch * LINE_T( line, vfraq );
+               const SOURCE_TYPE *srcB = src + spitch * LINE_B( line, vfraq );
+
+               /*
+                * Horizontal interpolation
+                */
+               long pl = POINT_L( point, hfraq );
+               HVX_DEBUG("h,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", y, pl,
+                         POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+               D_ASSERT( pl >= 0 );
+               D_ASSERT( pl < width-1 );
+               L = SOURCE_LOOKUP(srcT[pl]);
+               R = SOURCE_LOOKUP(srcT[pl+1]);
+
+               dpT = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                      ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800)) >> SHIFT_R6;
+
+               L = SOURCE_LOOKUP(srcB[pl]);
+               R = SOURCE_LOOKUP(srcB[pl+1]);
+
+               dpB = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                      ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800)) >> SHIFT_R6;
+
+               /*
+                * Vertical interpolation
+                */
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+               l_ = ((((((dpB & X_F81F) - (dpT & X_F81F))*X) >> SHIFT_R5) + (dpT & X_F81F)) & X_F81F) +
+                    ((((((dpB>>SHIFT_R5) & X_003F) - ((dpT>>SHIFT_R5) & X_003F))*X) + (dpT & X_07E0)) & X_07E0);
+#ifdef COLOR_KEY
+               if ((l_ & MASK_RGB) != (COLOR_KEY))
+#endif
+#ifdef KEY_PROTECT
+                    /* Write to destination with color key protection */
+                    dst16[0] = ((l_ & MASK_RGB) == KEY_PROTECT) ? l_^1 : l_;
+#else
+                    /* Write to destination without color key protection */
+                    dst16[0] = l_;
+#endif
+#else
+               /* Write to destination without color key protection */
+               dst16[0] = ((((((dpB & X_F81F) - (dpT & X_F81F))*X) >> SHIFT_R5) + (dpT & X_F81F)) & X_F81F) +
+                          ((((((dpB>>SHIFT_R5) & X_003F) - ((dpT>>SHIFT_R5) & X_003F))*X) + (dpT & X_07E0)) & X_07E0);
+#endif
+
+               dst16 += dpitch / 2;
+               line  += vfraq;
+          }
+
+          /* Adjust */
+          point0 += hfraq;
+          dst32   = dst + 2;
+
+          /* Reset */
+          line = LINE_0 + ctx->clip.y1 * vfraq;
+     }
+
+     /*
+      * Scale line by line.
+      */
+     for (y=0; y<ch; y++) {
+          long X;
+          long nlT = LINE_T( line, vfraq );
+
+          D_ASSERT( nlT >= 0 );
+          D_ASSERT( nlT < height-1 );
+
+          /*
+           * Fill line buffer(s) ?
+           */
+          if (nlT != lineT) {
+               u32 L, R, dpT, dpB;
+               const SOURCE_TYPE *srcT = src + spitch * nlT;
+               const SOURCE_TYPE *srcB = src + spitch * (nlT + 1);
+               long               diff = nlT - lineT;
+
+               if (diff > 1) {
+                    /*
+                     * Two output pixels per step.
+                     */
+                    for (x=0, r=head, point=point0; x<w2; x++) {
+                         /*
+                          * Horizontal interpolation
+                          */
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+                         L = SOURCE_LOOKUP(srcT[pl]);
+                         R = SOURCE_LOOKUP(srcT[pl+1]);
+
+                         dpT = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              << SHIFT_L10;
+#else
+                              >> SHIFT_R6;
+#endif
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         dpB = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              << SHIFT_L10;
+#else
+                              >> SHIFT_R6;
+#endif
+
+                         point += hfraq;
+                         r++;
+
+
+                         pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcT[pl]);
+                         R = SOURCE_LOOKUP(srcT[pl+1]);
+
+                         dpT |= (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                 ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              >> SHIFT_R6;
+#else
+                              << SHIFT_L10;
+#endif
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         dpB |= (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                 ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              >> SHIFT_R6;
+#else
+                              << SHIFT_L10;
+#endif
+
+                         point += hfraq;
+                         r++;
+
+                         /* Store */
+                         lbT[x] = dpT;
+                         lbB[x] = dpB;
+                    }
+               }
+               else {
+                    /* Swap */
+                    lbX = lbT;
+                    lbT = lbB;
+                    lbB = lbX;
+
+                    /*
+                     * Two output pixels per step.
+                     */
+                    for (x=0, r=head, point=point0; x<w2; x++) {
+                         /*
+                          * Horizontal interpolation
+                          */
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         dpB = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              << SHIFT_L10;
+#else
+                              >> SHIFT_R6;
+#endif
+
+                         point += hfraq;
+                         r++;
+
+
+                         pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         dpB |= (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                                 ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800))
+#ifdef WORDS_BIGENDIAN
+                              >> SHIFT_R6;
+#else
+                              << SHIFT_L10;
+#endif
+
+                         point += hfraq;
+                         r++;
+
+                         /* Store */
+                         lbB[x] = dpB;
+                    }
+               }
+
+               lineT = nlT;
+          }
+
+          /*
+           * Vertical interpolation
+           */
+          X = LINE_TO_RATIO( line, vfraq );
+
+          for (x=0; x<w2; x++) {
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+#ifdef HAS_ALPHA
+               dt = ((((((lbB[x] & X_F81FF81F) - (lbT[x] & X_F81FF81F))*X) >> SHIFT_R5) + (lbT[x] & X_F81FF81F)) & X_F81FF81F) +
+                    ((((((lbB[x]>>SHIFT_R5) & X_F81FF81F) - ((lbT[x]>>SHIFT_R5) & X_F81FF81F))*X) + (lbT[x] & X_07E007E0)) & X_07E007E0);
+#else
+               dt = ((((((lbB[x] & X_07E0F81F) - (lbT[x] & X_07E0F81F))*X) >> SHIFT_R5) + (lbT[x] & X_07E0F81F)) & X_07E0F81F) +
+                    ((((((lbB[x]>>SHIFT_R5) & X_07C0F83F) - ((lbT[x]>>SHIFT_R5) & X_07C0F83F))*X) + (lbT[x] & X_F81F07E0)) & X_F81F07E0);
+#endif
+
+               /* Get two new pixels. */
+               l_ = dt;
+               h_ = dt >> 16;
+
+#ifdef COLOR_KEY
+               if ((l_ & MASK_RGB) != (COLOR_KEY)) {
+                    if ((h_ & MASK_RGB) != (COLOR_KEY)) {
+#ifdef KEY_PROTECT
+                         /* Write to destination with color key protection */
+                         dst32[x] = ((((h_ & MASK_RGB) == KEY_PROTECT) ? h_^1 : h_) << 16) | (((l_ & MASK_RGB) == KEY_PROTECT) ? l_^1 : l_);
+#else
+                         /* Write to destination without color key protection */
+                         dst32[x] = dt;
+#endif
+                    }
+                    else {
+                         u16 *_dst16 = (u16*) &dst32[x];
+
+#ifdef KEY_PROTECT
+                         /* Write to destination with color key protection */
+                         *_dst16 = (((l_ & MASK_RGB) == KEY_PROTECT) ? l_^1 : l_);
+#else
+                         /* Write to destination without color key protection */
+                         *_dst16 = l_;
+#endif
+                    }
+               }
+               else if ((h_ & MASK_RGB) != (COLOR_KEY)) {
+                    u16 *_dst16 = ((u16*) &dst32[x]) + 1;
+
+#ifdef KEY_PROTECT
+                    /* Write to destination with color key protection */
+                    *_dst16 = (((h_ & MASK_RGB) == KEY_PROTECT) ? h_^1 : h_);
+#else
+                    /* Write to destination without color key protection */
+                    *_dst16 = h_;
+#endif
+               }
+#else
+               /* Write to destination with color key protection */
+               dst32[x] = ((((h_ & MASK_RGB) == KEY_PROTECT) ? h_^1 : h_) << 16) | (((l_ & MASK_RGB) == KEY_PROTECT) ? l_^1 : l_);
+#endif
+#else
+#ifdef HAS_ALPHA
+               dst32[x] = ((((((lbB[x] & X_F81FF81F) - (lbT[x] & X_F81FF81F))*X) >> SHIFT_R5) + (lbT[x] & X_F81FF81F)) & X_F81FF81F) +
+                          ((((((lbB[x]>>SHIFT_R5) & X_F81FF81F) - ((lbT[x]>>SHIFT_R5) & X_F81FF81F))*X) + (lbT[x] & X_07E007E0)) & X_07E007E0);
+#else
+               dst32[x] = ((((((lbB[x] & X_07E0F81F) - (lbT[x] & X_07E0F81F))*X) >> SHIFT_R5) + (lbT[x] & X_07E0F81F)) & X_07E0F81F) +
+                          ((((((lbB[x]>>SHIFT_R5) & X_07C0F83F) - ((lbT[x]>>SHIFT_R5) & X_07C0F83F))*X) + (lbT[x] & X_F81F07E0)) & X_F81F07E0);
+#endif
+#endif
+          }
+
+          dst32 += dp4;
+          line  += vfraq;
+     }
+
+     if (tail) {
+          u32 dpT, dpB, L, R;
+
+          u16 *dst16 = dst + cw * 2 - 2;
+
+          /* Reset */
+          line = LINE_0 + ctx->clip.y1 * vfraq;
+
+          for (y=0; y<ch; y++) {
+               long X = LINE_TO_RATIO( line, vfraq );
+
+               const SOURCE_TYPE *srcT = src + spitch * LINE_T( line, vfraq );
+               const SOURCE_TYPE *srcB = src + spitch * LINE_B( line, vfraq );
+
+               /*
+                * Horizontal interpolation
+                */
+               long pl = POINT_L( point, hfraq );
+               HVX_DEBUG("t,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", y, pl,
+                         POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+               D_ASSERT( pl >= 0 );
+               D_ASSERT( pl < width-1 );
+               L = SOURCE_LOOKUP(srcT[pl]);
+               R = SOURCE_LOOKUP(srcT[pl+1]);
+
+               dpT = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                      ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800)) >> SHIFT_R6;
+
+               L = SOURCE_LOOKUP(srcB[pl]);
+               R = SOURCE_LOOKUP(srcB[pl+1]);
+
+               dpB = (((((R & X_F81F)-(L & X_F81F))*ratios[r] + ((L & X_F81F)<<SHIFT_L6)) & X_003E07C0) + 
+                      ((((R & X_07E0)-(L & X_07E0))*ratios[r] + ((L & X_07E0)<<SHIFT_L6)) & X_0001F800)) >> SHIFT_R6;
+
+               /*
+                * Vertical interpolation
+                */
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+               l_ = ((((((dpB & X_F81F) - (dpT & X_F81F))*X) >> SHIFT_R5) + (dpT & X_F81F)) & X_F81F) +
+                    ((((((dpB>>SHIFT_R5) & X_003F) - ((dpT>>SHIFT_R5) & X_003F))*X) + (dpT & X_07E0)) & X_07E0);
+
+#ifdef COLOR_KEY
+               if ((l_ & MASK_RGB) != (COLOR_KEY))
+#endif
+#ifdef KEY_PROTECT
+                    /* Write to destination with color key protection */
+                    dst16[0] = ((l_ & MASK_RGB) == KEY_PROTECT) ? l_^1 : l_;
+#else
+                    /* Write to destination without color key protection */
+                    dst16[0] = l_;
+#endif
+#else
+               /* Write to destination without color key protection */
+               dst16[0] = ((((((dpB & X_F81F) - (dpT & X_F81F))*X) >> SHIFT_R5) + (dpT & X_F81F)) & X_F81F) +
+                          ((((((dpB>>SHIFT_R5) & X_003F) - ((dpT>>SHIFT_R5) & X_003F))*X) + (dpT & X_07E0)) & X_07E0);
+#endif
+
+               dst16 += dpitch / 2;
+               line  += vfraq;
+          }
+     }
+}
+
+
+#undef SHIFT_L6
+#undef SHIFT_L10
+
+#undef X_003F
+
+#undef X_003E07C0
+#undef X_0001F800
+
+#undef X_07E0F81F
+#undef X_F81F07E0
+
+#undef X_07C0F83F
+
+
+
+#ifdef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP
+#endif
+
+#ifdef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE
+#endif
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_hvx_32.h b/Source/DirectFB/src/gfx/generic/stretch_hvx_32.h
new file mode 100755
index 0000000..289ff2c
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_hvx_32.h
@@ -0,0 +1,174 @@
+#ifndef SOURCE_LOOKUP
+#define SOURCE_LOOKUP(x) (x)
+#define SOURCE_LOOKUP_AUTO
+#endif
+
+#ifndef SOURCE_TYPE
+#define SOURCE_TYPE u32
+#define SOURCE_TYPE_AUTO
+#endif
+
+#if 0
+#define HVX_DEBUG(x...)  direct_log_printf( NULL, x )
+#else
+#define HVX_DEBUG(x...)  do {} while (0)
+#endif
+
+/* stretch_hvx_up/down_32_KPI */( void             *dst,
+                                  int               dpitch,
+                                  const void       *src,
+                                  int               spitch,
+                                  int               width,
+                                  int               height,
+                                  int               dst_width,
+                                  int               dst_height,
+                                  const StretchCtx *ctx )
+{
+     long  x, y   = 0;
+     long  cw     = ctx->clip.x2 - ctx->clip.x1 + 1;
+     long  ch     = ctx->clip.y2 - ctx->clip.y1 + 1;
+     long  hfraq  = ((long)(width  - MINUS_1) << 18) / (long)(dst_width);
+     long  vfraq  = ((long)(height - MINUS_1) << 18) / (long)(dst_height);
+     long  dp4    = dpitch / 4;
+     long  point0 = POINT_0 + ctx->clip.x1 * hfraq;
+     long  point  = point0;
+     long  line   = LINE_0 + ctx->clip.y1 * vfraq;
+     long  ratios[cw];
+     u32  *dst32;
+
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+     u32   dt;
+#endif
+
+     u32   _lbT[cw+8];
+     u32   _lbB[cw+8];
+
+     u32  *lbX;
+     u32  *lbT = (u32*)((((ulong)(&_lbT[0])) + 31) & ~31);
+     u32  *lbB = (u32*)((((ulong)(&_lbB[0])) + 31) & ~31);
+
+     long  lineT = -2000;
+
+     for (x=0; x<cw; x++) {
+          ratios[x] = POINT_TO_RATIO( point, hfraq );
+
+          point += hfraq;
+     }
+
+     HVX_DEBUG("%dx%d -> %dx%d  (0x%x, 0x%x)\n", width, height, dst_width, dst_height, hfraq, vfraq );
+
+     dst += ctx->clip.x1 * 4 + ctx->clip.y1 * dpitch;
+
+     dst32 = dst;
+
+     /*
+      * Scale line by line.
+      */
+     for (y=0; y<ch; y++) {
+          long X;
+          long nlT = LINE_T( line, vfraq );
+
+          D_ASSERT( nlT >= 0 );
+          D_ASSERT( nlT < height-1 );
+
+          /*
+           * Fill line buffer(s) ?
+           */
+          if (nlT != lineT) {
+               u32 L, R;
+               const SOURCE_TYPE *srcT = src + spitch * nlT;
+               const SOURCE_TYPE *srcB = src + spitch * (nlT + 1);
+               long               diff = nlT - lineT;
+
+               if (diff > 1) {
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcT[pl]);
+                         R = SOURCE_LOOKUP(srcT[pl+1]);
+
+                         lbT[x]= ((((((R & X_00FF00FF) - (L & X_00FF00FF))*ratios[x]) >> SHIFT_R8) + (L & X_00FF00FF)) & X_00FF00FF) +
+                                 ((((((R>>SHIFT_R8) & X_00FF00FF) - ((L>>SHIFT_R8) & X_00FF00FF))*ratios[x]) + (L & X_FF00FF00)) & X_FF00FF00);
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = ((((((R & X_00FF00FF) - (L & X_00FF00FF))*ratios[x]) >> SHIFT_R8) + (L & X_00FF00FF)) & X_00FF00FF) +
+                                  ((((((R>>SHIFT_R8) & X_00FF00FF) - ((L>>SHIFT_R8) & X_00FF00FF))*ratios[x]) + (L & X_FF00FF00)) & X_FF00FF00);
+                    }
+               }
+               else {
+                    /* Swap */
+                    lbX = lbT;
+                    lbT = lbB;
+                    lbB = lbX;
+
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = ((((((R & X_00FF00FF) - (L & X_00FF00FF))*ratios[x]) >> SHIFT_R8) + (L & X_00FF00FF)) & X_00FF00FF) +
+                                  ((((((R>>SHIFT_R8) & X_00FF00FF) - ((L>>SHIFT_R8) & X_00FF00FF))*ratios[x]) + (L & X_FF00FF00)) & X_FF00FF00);
+                    }
+               }
+
+               lineT = nlT;
+          }
+
+          /*
+           * Vertical interpolation
+           */
+          X = LINE_TO_RATIO( line, vfraq );
+
+          for (x=0; x<cw; x++) {
+#if defined (COLOR_KEY) || defined (KEY_PROTECT)
+               dt = ((((((lbB[x] & X_00FF00FF) - (lbT[x] & X_00FF00FF))*X) >> SHIFT_R8) + (lbT[x] & X_00FF00FF)) & X_00FF00FF) +
+                    ((((((lbB[x]>>SHIFT_R8) & X_00FF00FF) - ((lbT[x]>>SHIFT_R8) & X_00FF00FF))*X) + (lbT[x] & X_FF00FF00)) & X_FF00FF00);
+#ifdef COLOR_KEY
+               if (dt != (COLOR_KEY))
+#endif
+#ifdef KEY_PROTECT
+                    /* Write to destination with color key protection */
+                    dst32[x] = ((dt & MASK_RGB) == KEY_PROTECT) ? dt^1 : dt;
+#else
+                    /* Write to destination without color key protection */
+                    dst32[x] = dt;
+#endif
+#else
+               /* Write to destination without color key protection */
+               dst32[x] = ((((((lbB[x] & X_00FF00FF) - (lbT[x] & X_00FF00FF))*X) >> SHIFT_R8) + (lbT[x] & X_00FF00FF)) & X_00FF00FF) +
+                          ((((((lbB[x]>>SHIFT_R8) & X_00FF00FF) - ((lbT[x]>>SHIFT_R8) & X_00FF00FF))*X) + (lbT[x] & X_FF00FF00)) & X_FF00FF00);
+#endif
+          }
+
+          dst32 += dp4;
+          line  += vfraq;
+     }
+}
+
+#ifdef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP
+#endif
+
+#ifdef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE
+#endif
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_hvx_8.h b/Source/DirectFB/src/gfx/generic/stretch_hvx_8.h
new file mode 100755
index 0000000..e809304
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_hvx_8.h
@@ -0,0 +1,149 @@
+#ifndef SOURCE_LOOKUP
+#define SOURCE_LOOKUP(x) (x)
+#define SOURCE_LOOKUP_AUTO
+#endif
+
+#ifndef SOURCE_TYPE
+#define SOURCE_TYPE u8
+#define SOURCE_TYPE_AUTO
+#endif
+
+#if 0
+#define HVX_DEBUG(x...)  direct_log_printf( NULL, x )
+#else
+#define HVX_DEBUG(x...)  do {} while (0)
+#endif
+
+/*** OPTIMIZE by doing four pixels at once (vertically) with a 32 bit line buffer ***/
+
+/*static void STRETCH_HVX_YV12( void       *dst,
+                               int         dpitch,
+                               const void *src,
+                               int         spitch,
+                               int         width,
+                               int         height,
+                               int         dst_width,
+                               int         dst_height,
+                               DFBRegion  *clip )*/
+{
+     long  x, y   = 0;
+     long  cw     = clip->x2 - clip->x1 + 1;
+     long  ch     = clip->y2 - clip->y1 + 1;
+     long  hfraq  = ((long)(width  - MINUS_1) << 18) / (long)(dst_width);
+     long  vfraq  = ((long)(height - MINUS_1) << 18) / (long)(dst_height);
+     long  point0 = POINT_0 + clip->x1 * hfraq;
+     long  point  = point0;
+     long  line   = LINE_0 + clip->y1 * vfraq;
+     long  ratios[cw];
+     u8   *dst8;
+
+     u8    _lbT[cw+32];
+     u8    _lbB[cw+32];
+
+     u8   *lbX;
+     u8   *lbT = (u8*)((((ulong)(&_lbT[0])) + 31) & ~31);
+     u8   *lbB = (u8*)((((ulong)(&_lbB[0])) + 31) & ~31);
+
+     long  lineT = -2000;
+
+     for (x=0; x<cw; x++) {
+          ratios[x] = POINT_TO_RATIO( point, hfraq );
+
+          point += hfraq;
+     }
+
+     HVX_DEBUG("%dx%d -> %dx%d  (0x%x, 0x%x)\n", width, height, dst_width, dst_height, hfraq, vfraq );
+
+     dst += clip->x1 + clip->y1 * dpitch;
+
+     dst8 = dst;
+
+     /*
+      * Scale line by line.
+      */
+     for (y=0; y<ch; y++) {
+          long nlT = LINE_T( line, vfraq );
+
+          D_ASSERT( nlT >= 0 );
+          D_ASSERT( nlT < height-1 );
+
+          /*
+           * Fill line buffer(s) ?
+           */
+          if (nlT != lineT) {
+               u8 L, R;
+               const SOURCE_TYPE *srcT = src + spitch * nlT;
+               const SOURCE_TYPE *srcB = src + spitch * (nlT + 1);
+               long               diff = nlT - lineT;
+
+               if (diff > 1) {
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcT[pl]);
+                         R = SOURCE_LOOKUP(srcT[pl+1]);
+
+                         lbT[x] = (((R - L) * ratios[x]) >> 8) + L;
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = (((R - L) * ratios[x]) >> 8) + L;
+                    }
+               }
+               else {
+                    /* Swap */
+                    lbX = lbT;
+                    lbT = lbB;
+                    lbB = lbX;
+
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = (((R - L) * ratios[x]) >> 8) + L;
+                    }
+               }
+
+               lineT = nlT;
+          }
+
+          /*
+           * Vertical interpolation
+           */
+          long X = LINE_TO_RATIO( line, vfraq );
+
+          for (x=0; x<cw; x++)
+               dst8[x] = (((lbB[x] - lbT[x]) * X) >> 8) + lbT[x];
+
+          dst8 += dpitch;
+          line += vfraq;
+     }
+}
+
+#ifdef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP
+#endif
+
+#ifdef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE
+#endif
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_hvx_88.h b/Source/DirectFB/src/gfx/generic/stretch_hvx_88.h
new file mode 100755
index 0000000..6394b5b
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_hvx_88.h
@@ -0,0 +1,152 @@
+#ifndef SOURCE_LOOKUP
+#define SOURCE_LOOKUP(x) (x)
+#define SOURCE_LOOKUP_AUTO
+#endif
+
+#ifndef SOURCE_TYPE
+#define SOURCE_TYPE u16
+#define SOURCE_TYPE_AUTO
+#endif
+
+#if 0
+#define HVX_DEBUG(x...)  direct_log_printf( NULL, x )
+#else
+#define HVX_DEBUG(x...)  do {} while (0)
+#endif
+
+
+/*** OPTIMIZE by doing two pixels at once (vertically) with a 32 bit line buffer ***/
+
+/*static void STRETCH_HVX_NV16( void       *dst,
+                               int         dpitch,
+                               const void *src,
+                               int         spitch,
+                               int         width,
+                               int         height,
+                               int         dst_width,
+                               int         dst_height,
+                               DFBRegion  *clip )*/
+{
+     long  x, y   = 0;
+     long  cw     = clip->x2 - clip->x1 + 1;
+     long  ch     = clip->y2 - clip->y1 + 1;
+     long  hfraq  = ((long)(width  - MINUS_1) << 18) / (long)(dst_width);
+     long  vfraq  = ((long)(height - MINUS_1) << 18) / (long)(dst_height);
+     long  point0 = POINT_0 + clip->x1 * hfraq;
+     long  point  = point0;
+     long  line   = LINE_0 + clip->y1 * vfraq;
+     long  ratios[cw];
+     u16  *dst16;
+
+     u16   _lbT[cw+16];
+     u16   _lbB[cw+16];
+
+     u16  *lbX;
+     u16  *lbT = (u16*)((((ulong)(&_lbT[0])) + 31) & ~31);
+     u16  *lbB = (u16*)((((ulong)(&_lbB[0])) + 31) & ~31);
+
+     long  lineT = -2000;
+
+     for (x=0; x<cw; x++) {
+          ratios[x] = POINT_TO_RATIO( point, hfraq );
+
+          point += hfraq;
+     }
+
+     dst += clip->x1 * 2 + clip->y1 * dpitch;
+
+     dst16 = dst;
+
+     /*
+      * Scale line by line.
+      */
+     for (y=0; y<ch; y++) {
+          long nlT = LINE_T( line, vfraq );
+
+          D_ASSERT( nlT >= 0 );
+          D_ASSERT( nlT < height-1 );
+
+          /*
+           * Fill line buffer(s) ?
+           */
+          if (nlT != lineT) {
+               u16 L, R;
+               const SOURCE_TYPE *srcT = src + spitch * nlT;
+               const SOURCE_TYPE *srcB = src + spitch * (nlT + 1);
+               long               diff = nlT - lineT;
+
+               if (diff > 1) {
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcT[pl]);
+                         R = SOURCE_LOOKUP(srcT[pl+1]);
+
+                         lbT[x] = (((((R & 0x00ff)-(L & 0x00ff))*ratios[x] + ((L & 0x00ff)<<8)) & 0x00ff00) + 
+                                   ((((R & 0xff00)-(L & 0xff00))*ratios[x] + ((L & 0xff00)<<8)) & 0xff0000)) >> 8;
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = (((((R & 0x00ff)-(L & 0x00ff))*ratios[x] + ((L & 0x00ff)<<8)) & 0x00ff00) + 
+                                   ((((R & 0xff00)-(L & 0xff00))*ratios[x] + ((L & 0xff00)<<8)) & 0xff0000)) >> 8;
+                    }
+               }
+               else {
+                    /* Swap */
+                    lbX = lbT;
+                    lbT = lbB;
+                    lbB = lbX;
+
+                    /*
+                     * Horizontal interpolation
+                     */
+                    for (x=0, point=point0; x<cw; x++, point += hfraq) {
+                         long pl = POINT_L( point, hfraq );
+                         HVX_DEBUG("%ld,%ld %lu  (%lu/%lu)   0x%x  0x%x\n", x, y, pl,
+                                   POINT_L( point, hfraq ), POINT_R( point, hfraq ), point, ratios[r] );
+                         D_ASSERT( pl >= 0 );
+                         D_ASSERT( pl < width-1 );
+
+                         L = SOURCE_LOOKUP(srcB[pl]);
+                         R = SOURCE_LOOKUP(srcB[pl+1]);
+
+                         lbB[x] = (((((R & 0x00ff)-(L & 0x00ff))*ratios[x] + ((L & 0x00ff)<<8)) & 0x00ff00) + 
+                                   ((((R & 0xff00)-(L & 0xff00))*ratios[x] + ((L & 0xff00)<<8)) & 0xff0000)) >> 8;
+                    }
+               }
+
+               lineT = nlT;
+          }
+
+          /*
+           * Vertical interpolation
+           */
+          long X = LINE_TO_RATIO( line, vfraq );
+
+          for (x=0; x<cw; x++)
+               dst16[x] = (((((lbB[x] & 0x00ff)-(lbT[x] & 0x00ff))*X + ((lbT[x] & 0x00ff)<<8)) & 0x00ff00) + 
+                           ((((lbB[x] & 0xff00)-(lbT[x] & 0xff00))*X + ((lbT[x] & 0xff00)<<8)) & 0xff0000)) >> 8;
+
+          dst16 += dpitch / 2;
+          line  += vfraq;
+     }
+}
+
+#ifdef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP_AUTO
+#undef SOURCE_LOOKUP
+#endif
+
+#ifdef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE_AUTO
+#undef SOURCE_TYPE
+#endif
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_hvx_N.h b/Source/DirectFB/src/gfx/generic/stretch_hvx_N.h
new file mode 100755
index 0000000..c4922e1
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_hvx_N.h
@@ -0,0 +1,121 @@
+#if UPDOWN == 1
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(up,K,P,F)
+#else
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(down,K,P,F)
+#endif
+
+
+/* NONE */
+static void FUNC_NAME_(_,_,DST_FORMAT)
+#include STRETCH_HVX_N_H
+
+/* SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,_,DST_FORMAT)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+
+/* PROTECT */
+#define KEY_PROTECT      ctx->protect
+static void FUNC_NAME_(_,P,DST_FORMAT)
+#include STRETCH_HVX_N_H
+
+/* PROTECT SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,P,DST_FORMAT)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+#undef KEY_PROTECT
+
+
+/* INDEXED */
+#define SOURCE_LOOKUP(x) ((const uN*)ctx->colors)[x]
+#define SOURCE_TYPE      u8
+static void FUNC_NAME_(_,_,DSPF_LUT8)
+#include STRETCH_HVX_N_H
+
+/* INDEXED SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,_,DSPF_LUT8)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+
+/* INDEXED PROTECT */
+#define KEY_PROTECT      ctx->protect
+static void FUNC_NAME_(_,P,DSPF_LUT8)
+#include STRETCH_HVX_N_H
+
+/* INDEXED PROTECT SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,P,DSPF_LUT8)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+#undef KEY_PROTECT
+#undef SOURCE_LOOKUP
+#undef SOURCE_TYPE
+
+
+/* FIXME: DST_FORMAT == DSPF_RGB16 doesn't work */
+#ifdef FORMAT_RGB16
+/* ARGB4444 */
+#define SOURCE_LOOKUP(x)   PIXEL_RGB16( (((x) & 0x0f00) >> 4) | (((x) & 0x0f00) >> 8),    \
+                                        (((x) & 0x00f0)     ) | (((x) & 0x00f0) >> 4),    \
+                                        (((x) & 0x000f) << 4) | (((x) & 0x000f)     ) )
+static void FUNC_NAME_(_,_,DSPF_ARGB4444)
+#include STRETCH_HVX_N_H
+
+/* ARGB4444 SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,_,DSPF_ARGB4444)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+
+/* ARGB4444 PROTECT */
+#define KEY_PROTECT      ctx->protect
+static void FUNC_NAME_(_,P,DSPF_ARGB4444)
+#include STRETCH_HVX_N_H
+
+/* ARGB4444 PROTECT SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,P,DSPF_ARGB4444)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+#undef KEY_PROTECT
+#undef SOURCE_LOOKUP
+#undef SOURCE_TYPE
+#endif
+
+
+/* FIXME: DST_FORMAT == DSPF_ARGB4444 doesn't work */
+#ifdef FORMAT_ARGB4444
+/* RGB16 */
+#define SOURCE_LOOKUP(x)   PIXEL_ARGB4444( 0xff,                   \
+                                           (((x) & 0xf800) >> 8),  \
+                                           (((x) & 0x07e0) >> 3),  \
+                                           (((x) & 0x001f) << 3) )
+static void FUNC_NAME_(_,_,DSPF_RGB16)
+#include STRETCH_HVX_N_H
+
+/* RGB16 SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,_,DSPF_RGB16)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+
+/* RGB16 PROTECT */
+#define KEY_PROTECT      ctx->protect
+static void FUNC_NAME_(_,P,DSPF_RGB16)
+#include STRETCH_HVX_N_H
+
+/* RGB16 PROTECT SRCKEY */
+#define COLOR_KEY ctx->key
+static void FUNC_NAME_(K,P,DSPF_RGB16)
+#include STRETCH_HVX_N_H
+#undef COLOR_KEY
+#undef KEY_PROTECT
+#undef SOURCE_LOOKUP
+#undef SOURCE_TYPE
+#endif
+
+#undef FUNC_NAME_
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_16.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_16.h
new file mode 100755
index 0000000..c6e4391
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_16.h
@@ -0,0 +1,68 @@
+#define STRETCH_HVX_N_H  "stretch_hvx_16.h"
+#define uN u16
+
+/**********************************************************************************************************************/
+/* Upscaling */
+
+#define POINT_0               0
+#define LINE_0                0
+#define MINUS_1               1
+#define POINT_TO_RATIO(p,ps)  ( ((p) & 0x3ffff) >> (18-SHIFT_L6) )
+#define LINE_TO_RATIO(l,ls)   ( ((l) & 0x3ffff) >> (18-SHIFT_L5) )
+
+#define POINT_L(p,ps)  ( (((p)) >> 18) )
+#define POINT_R(p,ps)  ( (((p)) >> 18) + 1 )
+
+#define LINE_T(l,ls)  ( (((l)) >> 18) )
+#define LINE_B(l,ls)  ( (((l)) >> 18) + 1 )
+
+#define UPDOWN 1
+#include "stretch_hvx_N.h"
+#undef UPDOWN
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+/* Downscaling */
+
+#define POINT_0               hfraq
+#define LINE_0                vfraq
+#define MINUS_1               0
+#define POINT_TO_RATIO(p,ps)  ( (((((p)) & 0x3ffff) ? : 0x40000) << SHIFT_L6) / (ps) )
+#define LINE_TO_RATIO(l,ls)   ( (((((l)) & 0x3ffff) ? : 0x40000) << SHIFT_L5) / (ls) )
+
+#define POINT_L(p,ps)  ( (((p)-1) >> 18) - 1 )
+#define POINT_R(p,ps)  ( (((p)-1) >> 18) )
+
+#define LINE_T(l,ls)  ( (((l)-1) >> 18) - 1 )
+#define LINE_B(l,ls)  ( (((l)-1) >> 18) )
+
+#define UPDOWN 0
+#include "stretch_hvx_N.h"
+#undef UPDOWN
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+
+#undef STRETCH_HVX_N_H
+#undef uN
+
+#include "stretch_up_down_table.h"
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_32.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_32.h
new file mode 100755
index 0000000..3fca697
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_32.h
@@ -0,0 +1,68 @@
+#define STRETCH_HVX_N_H  "stretch_hvx_32.h"
+#define uN u32
+
+/**********************************************************************************************************************/
+/* Upscaling */
+
+#define POINT_0               0
+#define LINE_0                0
+#define MINUS_1               1
+#define POINT_TO_RATIO(p,ps)  ( ((p) & 0x3ffff) >> (18-SHIFT_L8) )
+#define LINE_TO_RATIO(l,ls)   ( ((l) & 0x3ffff) >> (18-SHIFT_L8) )
+
+#define POINT_L(p,ps)  ( (((p)) >> 18) )
+#define POINT_R(p,ps)  ( (((p)) >> 18) + 1 )
+
+#define LINE_T(l,ls)  ( (((l)) >> 18) )
+#define LINE_B(l,ls)  ( (((l)) >> 18) + 1 )
+
+#define UPDOWN 1
+#include "stretch_hvx_N.h"
+#undef UPDOWN
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+/* Downscaling */
+
+#define POINT_0               hfraq
+#define LINE_0                vfraq
+#define MINUS_1               0
+#define POINT_TO_RATIO(p,ps)  ( (((((p)) & 0x3ffff) ? : 0x40000) << SHIFT_L8) / (ps) )
+#define LINE_TO_RATIO(l,ls)   ( (((((l)) & 0x3ffff) ? : 0x40000) << SHIFT_L8) / (ls) )
+
+#define POINT_L(p,ps)  ( (((p)-1) >> 18) - 1 )
+#define POINT_R(p,ps)  ( (((p)-1) >> 18) )
+
+#define LINE_T(l,ls)  ( (((l)-1) >> 18) - 1 )
+#define LINE_B(l,ls)  ( (((l)-1) >> 18) )
+
+#define UPDOWN 0
+#include "stretch_hvx_N.h"
+#undef UPDOWN
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+
+#undef STRETCH_HVX_N_H
+#undef uN
+
+#include "stretch_up_down_table.h"
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_32_indexed.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_32_indexed.h
new file mode 100755
index 0000000..655bf98
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_32_indexed.h
@@ -0,0 +1,82 @@
+#define SOURCE_LOOKUP(x) (((const u32*)colors)[x])
+#define SOURCE_TYPE      u8
+
+
+#define POINT_0               hfraq
+#define LINE_0                vfraq
+#define MINUS_1               0
+#define POINT_TO_RATIO(p,ps)  ( (((((p)) & 0x3ffff) ? : 0x40000) << SHIFT_L8) / (ps) )
+#define LINE_TO_RATIO(l,ls)   ( (((((l)) & 0x3ffff) ? : 0x40000) << SHIFT_L8) / (ls) )
+
+#define POINT_L(p,ps)  ( (((p)-1) >> 18) - 1 )
+#define POINT_R(p,ps)  ( (((p)-1) >> 18) )
+
+#define LINE_T(l,ls)  ( (((l)-1) >> 18) - 1 )
+#define LINE_B(l,ls)  ( (((l)-1) >> 18) )
+
+static void FUNC_NAME(down)( void       *dst,
+                             int         dpitch,
+                             const void *src,
+                             int         spitch,
+                             int         width,
+                             int         height,
+                             int         dst_width,
+                             int         dst_height,
+                             DFBRegion  *clip,
+                             const void *colors )
+{
+#include "stretch_hvx_32.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+
+#define POINT_0               0
+#define LINE_0                0
+#define MINUS_1               1
+#define POINT_TO_RATIO(p,ps)  ( ((p) & 0x3ffff) >> (18-SHIFT_L8) )
+#define LINE_TO_RATIO(l,ls)   ( ((l) & 0x3ffff) >> (18-SHIFT_L8) )
+
+#define POINT_L(p,ps)  ( (((p)) >> 18) )
+#define POINT_R(p,ps)  ( (((p)) >> 18) + 1 )
+
+#define LINE_T(l,ls)  ( (((l)) >> 18) )
+#define LINE_B(l,ls)  ( (((l)) >> 18) + 1 )
+
+static void FUNC_NAME(up)( void       *dst,
+                           int         dpitch,
+                           const void *src,
+                           int         spitch,
+                           int         width,
+                           int         height,
+                           int         dst_width,
+                           int         dst_height,
+                           DFBRegion  *clip,
+                           const void *colors )
+{
+#include "stretch_hvx_32.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+
+#undef SOURCE_LOOKUP
+#undef SOURCE_TYPE
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_8.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_8.h
new file mode 100755
index 0000000..5b43df9
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_8.h
@@ -0,0 +1,72 @@
+#define POINT_0               hfraq
+#define LINE_0                vfraq
+#define MINUS_1               0
+#define POINT_TO_RATIO(p,ps)  ( (((((p)) & 0x3ffff) ? : 0x40000) << 8) / (ps) )
+#define LINE_TO_RATIO(l,ls)   ( (((((l)) & 0x3ffff) ? : 0x40000) << 8) / (ls) )
+
+#define POINT_L(p,ps)  ( (((p)-1) >> 18) - 1 )
+#define POINT_R(p,ps)  ( (((p)-1) >> 18) )
+
+#define LINE_T(l,ls)  ( (((l)-1) >> 18) - 1 )
+#define LINE_B(l,ls)  ( (((l)-1) >> 18) )
+
+static void FUNC_NAME(down)( void       *dst,
+                             int         dpitch,
+                             const void *src,
+                             int         spitch,
+                             int         width,
+                             int         height,
+                             int         dst_width,
+                             int         dst_height,
+                             DFBRegion  *clip )
+{
+#include "stretch_hvx_8.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+
+#define POINT_0               0
+#define LINE_0                0
+#define MINUS_1               1
+#define POINT_TO_RATIO(p,ps)  ( ((p) & 0x3ffff) >> (18-8) )
+#define LINE_TO_RATIO(l,ls)   ( ((l) & 0x3ffff) >> (18-8) )
+
+#define POINT_L(p,ps)  ( (((p)) >> 18) )
+#define POINT_R(p,ps)  ( (((p)) >> 18) + 1 )
+
+#define LINE_T(l,ls)  ( (((l)) >> 18) )
+#define LINE_B(l,ls)  ( (((l)) >> 18) + 1 )
+
+static void FUNC_NAME(up)( void       *dst,
+                           int         dpitch,
+                           const void *src,
+                           int         spitch,
+                           int         width,
+                           int         height,
+                           int         dst_width,
+                           int         dst_height,
+                           DFBRegion  *clip )
+{
+#include "stretch_hvx_8.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_88.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_88.h
new file mode 100755
index 0000000..a91b6c9
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_88.h
@@ -0,0 +1,72 @@
+#define POINT_0               hfraq
+#define LINE_0                vfraq
+#define MINUS_1               0
+#define POINT_TO_RATIO(p,ps)  ( (((((p)) & 0x3ffff) ? : 0x40000) << 8) / (ps) )
+#define LINE_TO_RATIO(l,ls)   ( (((((l)) & 0x3ffff) ? : 0x40000) << 8) / (ls) )
+
+#define POINT_L(p,ps)  ( (((p)-1) >> 18) - 1 )
+#define POINT_R(p,ps)  ( (((p)-1) >> 18) )
+
+#define LINE_T(l,ls)  ( (((l)-1) >> 18) - 1 )
+#define LINE_B(l,ls)  ( (((l)-1) >> 18) )
+
+static void FUNC_NAME(down)( void       *dst,
+                             int         dpitch,
+                             const void *src,
+                             int         spitch,
+                             int         width,
+                             int         height,
+                             int         dst_width,
+                             int         dst_height,
+                             DFBRegion  *clip )
+{
+#include "stretch_hvx_88.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
+/**********************************************************************************************************************/
+
+#define POINT_0               0
+#define LINE_0                0
+#define MINUS_1               1
+#define POINT_TO_RATIO(p,ps)  ( ((p) & 0x3ffff) >> (18-8) )
+#define LINE_TO_RATIO(l,ls)   ( ((l) & 0x3ffff) >> (18-8) )
+
+#define POINT_L(p,ps)  ( (((p)) >> 18) )
+#define POINT_R(p,ps)  ( (((p)) >> 18) + 1 )
+
+#define LINE_T(l,ls)  ( (((l)) >> 18) )
+#define LINE_B(l,ls)  ( (((l)) >> 18) + 1 )
+
+static void FUNC_NAME(up)( void       *dst,
+                           int         dpitch,
+                           const void *src,
+                           int         spitch,
+                           int         width,
+                           int         height,
+                           int         dst_width,
+                           int         dst_height,
+                           DFBRegion  *clip )
+{
+#include "stretch_hvx_88.h"
+}
+
+#undef POINT_0
+#undef LINE_0
+#undef MINUS_1
+#undef POINT_TO_RATIO
+#undef LINE_TO_RATIO
+#undef POINT_L
+#undef POINT_R
+#undef LINE_T
+#undef LINE_B
+
diff --git a/Source/DirectFB/src/gfx/generic/stretch_up_down_table.h b/Source/DirectFB/src/gfx/generic/stretch_up_down_table.h
new file mode 100755
index 0000000..32f208b
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/stretch_up_down_table.h
@@ -0,0 +1,59 @@
+/**********************************************************************************************************************/
+/* Function table */
+
+static const StretchFunctionTable TABLE_NAME = {
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(up,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].up[STRETCH_NONE]             = FUNC_NAME_(_,_,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].up[STRETCH_PROTECT]          = FUNC_NAME_(_,P,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].up[STRETCH_SRCKEY]           = FUNC_NAME_(K,_,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].up[STRETCH_SRCKEY_PROTECT]   = FUNC_NAME_(K,P,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].up[STRETCH_NONE]              = FUNC_NAME_(_,_,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].up[STRETCH_PROTECT]           = FUNC_NAME_(_,P,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].up[STRETCH_SRCKEY]            = FUNC_NAME_(K,_,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].up[STRETCH_SRCKEY_PROTECT]    = FUNC_NAME_(K,P,DSPF_LUT8),
+#undef FUNC_NAME_
+
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(down,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].down[STRETCH_NONE]           = FUNC_NAME_(_,_,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].down[STRETCH_PROTECT]        = FUNC_NAME_(_,P,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].down[STRETCH_SRCKEY]         = FUNC_NAME_(K,_,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DST_FORMAT)].down[STRETCH_SRCKEY_PROTECT] = FUNC_NAME_(K,P,DST_FORMAT),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].down[STRETCH_NONE]            = FUNC_NAME_(_,_,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].down[STRETCH_PROTECT]         = FUNC_NAME_(_,P,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].down[STRETCH_SRCKEY]          = FUNC_NAME_(K,_,DSPF_LUT8),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_LUT8)].down[STRETCH_SRCKEY_PROTECT]  = FUNC_NAME_(K,P,DSPF_LUT8),
+#undef FUNC_NAME_
+
+/* FIXME: DST_FORMAT == DSPF_RGB16 doesn't work */
+#ifdef FORMAT_RGB16
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(up,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].up[STRETCH_NONE]             = FUNC_NAME_(_,_,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].up[STRETCH_PROTECT]          = FUNC_NAME_(_,P,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].up[STRETCH_SRCKEY]           = FUNC_NAME_(K,_,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].up[STRETCH_SRCKEY_PROTECT]   = FUNC_NAME_(K,P,DSPF_ARGB4444),
+#undef FUNC_NAME_
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(down,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].down[STRETCH_NONE]           = FUNC_NAME_(_,_,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].down[STRETCH_PROTECT]        = FUNC_NAME_(_,P,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].down[STRETCH_SRCKEY]         = FUNC_NAME_(K,_,DSPF_ARGB4444),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_ARGB4444)].down[STRETCH_SRCKEY_PROTECT] = FUNC_NAME_(K,P,DSPF_ARGB4444),
+#undef FUNC_NAME_
+#endif
+
+/* FIXME: DST_FORMAT == DSPF_ARGB4444 doesn't work */
+#ifdef FORMAT_ARGB4444
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(up,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].up[STRETCH_NONE]             = FUNC_NAME_(_,_,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].up[STRETCH_PROTECT]          = FUNC_NAME_(_,P,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].up[STRETCH_SRCKEY]           = FUNC_NAME_(K,_,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].up[STRETCH_SRCKEY_PROTECT]   = FUNC_NAME_(K,P,DSPF_RGB16),
+#undef FUNC_NAME_
+#define FUNC_NAME_(K,P,F)      FUNC_NAME(down,K,P,F)
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].down[STRETCH_NONE]           = FUNC_NAME_(_,_,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].down[STRETCH_PROTECT]        = FUNC_NAME_(_,P,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].down[STRETCH_SRCKEY]         = FUNC_NAME_(K,_,DSPF_RGB16),
+     .f[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)].down[STRETCH_SRCKEY_PROTECT] = FUNC_NAME_(K,P,DSPF_RGB16),
+#undef FUNC_NAME_
+#endif
+};
+
diff --git a/Source/DirectFB/src/gfx/generic/template_acc_16.h b/Source/DirectFB/src/gfx/generic/template_acc_16.h
new file mode 100755
index 0000000..05cea6d
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/template_acc_16.h
@@ -0,0 +1,382 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/*
+ * Example:
+ * #define A_SHIFT 15
+ * #define R_SHIFT 10
+ * #define G_SHIFT 5
+ * #define B_SHIFT 0
+ * #define A_MASK 0x8000
+ * #define R_MASK 0x7c00
+ * #define G_MASK 0x03e0
+ * #define B_MASK 0x001f
+ * #define PIXEL_OUT( a, r, g, b ) PIXEL_ARGB1555( a, r, g, b )
+ * #define EXPAND_Ato8( a ) EXPAND_1to8( a )
+ * #define EXPAND_Rto8( r ) EXPAND_5to8( r )
+ * #define EXPAND_Gto8( g ) EXPAND_5to8( g )
+ * #define EXPAND_Bto8( b ) EXPAND_5to8( b )
+ * #define Sop_PFI_OP_Dacc( op ) Sop_argb1555_##op##_Dacc
+ * #define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_argb1555
+ * #include "template_acc_16.h"
+ */
+
+#define RGB_MASK (R_MASK | G_MASK | B_MASK)
+
+#if RGB_MASK == 0xffff
+#define MASK_RGB( p ) (p)
+#else
+#define MASK_RGB( p ) ((p) & RGB_MASK)
+#endif
+
+#define PIXEL( x ) PIXEL_OUT( ((x).RGB.a & 0xFF00) ? 0xFF : (x).RGB.a, \
+                              ((x).RGB.r & 0xFF00) ? 0xFF : (x).RGB.r, \
+                              ((x).RGB.g & 0xFF00) ? 0xFF : (x).RGB.g, \
+                              ((x).RGB.b & 0xFF00) ? 0xFF : (x).RGB.b )
+
+#define EXPAND( d, s ) do { \
+     (d).RGB.a = EXPAND_Ato8( (s & A_MASK) >> A_SHIFT ); \
+     (d).RGB.r = EXPAND_Rto8( (s & R_MASK) >> R_SHIFT ); \
+     (d).RGB.g = EXPAND_Gto8( (s & G_MASK) >> G_SHIFT ); \
+     (d).RGB.b = EXPAND_Bto8( (s & B_MASK) >> B_SHIFT ); \
+} while (0)
+
+/********************************* Sop_PFI_Sto_Dacc ***************************/
+
+static void Sop_PFI_OP_Dacc(Sto)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     u16               *S     = gfxs->Sop[0];
+     int                Ostep = gfxs->Ostep;
+     GenefxAccumulator *D     = gfxs->Dacc;
+
+     if (Ostep != 1)
+          D_UNIMPLEMENTED();
+
+     while (l--) {
+          u16 s = S[i>>16];
+
+          EXPAND( *D, s );
+
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Sop_PFI_SKto_Dacc **************************/
+
+static void Sop_PFI_OP_Dacc(SKto)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     u16               *S     = gfxs->Sop[0];
+     int                Ostep = gfxs->Ostep;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     u16                Skey  = gfxs->Skey;
+
+     if (Ostep != 1)
+          D_UNIMPLEMENTED();
+
+     while (l--) {
+          u16 s = S[i>>16];
+
+          if (MASK_RGB( s ) != Skey)
+               EXPAND( *D, s );
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Sop_PFI_to_Dacc ****************************/
+
+static void Sop_PFI_OP_Dacc(to)( GenefxState *gfxs )
+{
+     int             w, l = gfxs->length;
+     u16               *S = gfxs->Sop[0];
+     GenefxAccumulator *D = gfxs->Dacc;
+     int                Ostep = gfxs->Ostep;
+
+     if (Ostep != 1) {
+          while (l--) {
+              u16 s = *S;
+
+              EXPAND( *D, s );
+
+              S += Ostep;
+
+              D++;
+          }
+          return;
+     }
+
+     if ((long)S & 2) {
+          u16 s = *S++;
+
+          EXPAND( *D, s );
+
+          D++;
+          l--;
+     }
+
+     w = l >> 1;
+     while (w--) {
+          u32 s = *(u32 *) S;
+
+#ifdef WORDS_BIGENDIAN
+          EXPAND( D[0], s >> 16 );
+          EXPAND( D[1], s );
+#else
+          EXPAND( D[0], s );
+          EXPAND( D[1], s >> 16);
+#endif
+
+          S += 2;
+          D += 2;
+     }
+
+     if (l & 1) {
+          u16 s = *S;
+
+          EXPAND( *D, s );
+     }
+}
+
+/********************************* Sop_PFI_Kto_Dacc ***************************/
+
+static void Sop_PFI_OP_Dacc(Kto)( GenefxState *gfxs )
+{
+     int                l    = gfxs->length;
+     u16               *S    = gfxs->Sop[0];
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u16                Skey = gfxs->Skey;
+     int                Ostep = gfxs->Ostep;
+
+     while (l--) {
+          u16 s = *S;
+
+          if (MASK_RGB( s ) != Skey)
+               EXPAND( *D, s );
+          else
+               D->RGB.a = 0xF000;
+
+          S += Ostep;
+          D++;
+     }
+}
+
+/********************************* Sacc_to_Aop_PFI ****************************/
+
+static void Sacc_OP_Aop_PFI(to)( GenefxState *gfxs )
+{
+     int             w, l = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u16               *D = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+
+     if (Dstep != 1) {
+          while (l--) {
+              if (!(S->RGB.a & 0xF000))
+                   *D = PIXEL( *S );
+
+              S++;
+              D += Dstep;
+          }
+          return;
+     }
+
+     if ((long)D & 2) {
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+
+          S++;
+          D++;
+          l--;
+     }
+
+     w = l >> 1;
+     while (w--) {
+          u32 *D2 = (u32 *) D;
+
+          if (!(S[0].RGB.a & 0xF000) && !(S[1].RGB.a & 0xF000)) {
+#ifdef WORDS_BIGENDIAN
+               *D2 = PIXEL( S[1] ) | PIXEL( S[0] ) << 16;
+#else
+               *D2 = PIXEL( S[0] ) | PIXEL( S[1] ) << 16;
+#endif
+          } else {
+               if (!(S[0].RGB.a & 0xF000))
+                    D[0] = PIXEL( S[0] );
+               else if (!(S[1].RGB.a & 0xF000))
+                    D[1] = PIXEL( S[1] );
+          }
+
+          S += 2;
+          D += 2;
+     }
+
+     if (l & 1) {
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+     }
+}
+
+/********************************* Sacc_Sto_Aop_PFI ***************************/
+
+static void Sacc_OP_Aop_PFI(Sto)( GenefxState *gfxs )
+{
+     int             w, l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u16               *D     = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+
+     if (Dstep != 1) {
+         while (l--) {
+              GenefxAccumulator *S = &Sacc[i>>16];
+
+              if (!(S->RGB.a & 0xF000))
+                   *D = PIXEL( *S );
+
+              D += Dstep;
+              i += SperD;
+         }
+         return;
+     }
+     if ((long)D & 2) {
+          GenefxAccumulator *S = Sacc;
+
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+
+          D++;
+          l--;
+          i += SperD;
+     }
+
+     w = l >> 1;
+     while (w--) {
+          GenefxAccumulator *S0 = &Sacc[i>>16];
+          GenefxAccumulator *S1 = &Sacc[(i+SperD)>>16];
+          u32               *D2 = (u32 *) D;
+
+          if (!(S0->RGB.a & 0xF000) && !(S1->RGB.a & 0xF000)) {
+#ifdef WORDS_BIGENDIAN
+               *D2 = PIXEL( *S1 ) | PIXEL( *S0 ) << 16;
+#else
+               *D2 = PIXEL( *S0 ) | PIXEL( *S1 ) << 16;
+#endif
+          } else {
+               if (!(S0->RGB.a & 0xF000))
+                    D[0] = PIXEL( *S0 );
+               else if (!(S1->RGB.a & 0xF000))
+                    D[1] = PIXEL( *S1 );
+          }
+
+          D += 2;
+          i += SperD << 1;
+     }
+
+     if (l & 1) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+     }
+}
+
+/********************************* Sacc_toK_Aop_PFI ***************************/
+
+static void Sacc_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int                l    = gfxs->length;
+     GenefxAccumulator *S    = gfxs->Sacc;
+     u16               *D    = gfxs->Aop[0];
+     u16                Dkey = gfxs->Dkey;
+     int                Dstep = gfxs->Astep;
+
+     while (l--) {
+          if (!(S->RGB.a & 0xF000) && MASK_RGB( *D ) == Dkey)
+               *D = PIXEL( *S );
+
+          S++;
+          D += Dstep;
+     }
+}
+
+/********************************* Sacc_StoK_Aop_PFI **************************/
+
+static void Sacc_OP_Aop_PFI(StoK)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u16               *D     = gfxs->Aop[0];
+     u16                Dkey  = gfxs->Dkey;
+     int                Dstep = gfxs->Astep;
+
+     while (l--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000) && MASK_RGB( *D ) == Dkey)
+               *D = PIXEL( *S );
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/******************************************************************************/
+
+#undef RGB_MASK
+#undef MASK_RGB
+#undef PIXEL
+#undef EXPAND
+
+#undef A_SHIFT
+#undef R_SHIFT
+#undef G_SHIFT
+#undef B_SHIFT
+#undef A_MASK
+#undef R_MASK
+#undef G_MASK
+#undef B_MASK
+#undef PIXEL_OUT
+#undef EXPAND_Ato8
+#undef EXPAND_Rto8
+#undef EXPAND_Gto8
+#undef EXPAND_Bto8
+#undef Sop_PFI_OP_Dacc
+#undef Sacc_OP_Aop_PFI
diff --git a/Source/DirectFB/src/gfx/generic/template_acc_32.h b/Source/DirectFB/src/gfx/generic/template_acc_32.h
new file mode 100755
index 0000000..313d568
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/template_acc_32.h
@@ -0,0 +1,261 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/*
+ * Example:
+ * #define A_SHIFT 24
+ * #define R_SHIFT 16
+ * #define G_SHIFT 8
+ * #define B_SHIFT 0
+ * #define A_MASK 0xff000000
+ * #define R_MASK 0x00ff0000
+ * #define G_MASK 0x0000ff00
+ * #define B_MASK 0x000000ff
+ * #define PIXEL_OUT( a, r, g, b ) PIXEL_AiRGB( a, r, g, b )
+ * #define EXPAND_Ato8( a ) ((a) ^ 0xff)
+ * #define EXPAND_Rto8( r ) (r)
+ * #define EXPAND_Gto8( g ) (g)
+ * #define EXPAND_Bto8( b ) (b)
+ * #define Sop_PFI_OP_Dacc( op ) Sop_airgb_##op##_Dacc
+ * #define Sacc_OP_Aop_PFI( op ) Sacc_##op##_Aop_airgb
+ * #include "template_acc_32.h"
+ */
+
+#define RGB_MASK (R_MASK | G_MASK | B_MASK)
+
+#define PIXEL( s ) PIXEL_OUT( ((s).RGB.a & 0xFF00) ? 0xFF : (s).RGB.a, \
+                              ((s).RGB.r & 0xFF00) ? 0xFF : (s).RGB.r, \
+                              ((s).RGB.g & 0xFF00) ? 0xFF : (s).RGB.g, \
+                              ((s).RGB.b & 0xFF00) ? 0xFF : (s).RGB.b )
+
+#define EXPAND( d, s ) \
+do { \
+     (d).RGB.a = EXPAND_Ato8( (s & A_MASK) >> A_SHIFT ); \
+     (d).RGB.r = EXPAND_Rto8( (s & R_MASK) >> R_SHIFT ); \
+     (d).RGB.g = EXPAND_Gto8( (s & G_MASK) >> G_SHIFT ); \
+     (d).RGB.b = EXPAND_Bto8( (s & B_MASK) >> B_SHIFT ); \
+} while (0)
+
+/********************************* Sop_PFI_Sto_Dacc ***************************/
+
+static void Sop_PFI_OP_Dacc(Sto)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     u32               *S     = gfxs->Sop[0];
+     int                Ostep = gfxs->Ostep;
+     GenefxAccumulator *D     = gfxs->Dacc;
+
+     if (Ostep != 1)
+          D_UNIMPLEMENTED();
+          
+     while (l--) {
+          u32 s = S[i>>16];
+
+          EXPAND( *D, s );
+          
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Sop_PFI_SKto_Dacc **************************/
+
+static void Sop_PFI_OP_Dacc(SKto)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     u32               *S     = gfxs->Sop[0];
+     int                Ostep = gfxs->Ostep;
+     GenefxAccumulator *D     = gfxs->Dacc;
+     u32                Skey  = gfxs->Skey;
+
+     if (Ostep != 1)
+          D_UNIMPLEMENTED();
+
+     while (l--) {
+          u32 s = S[i>>16];
+
+          if ((s & RGB_MASK) != Skey)
+               EXPAND( *D, s );
+          else
+               D->RGB.a = 0xF000;
+
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Sop_PFI_to_Dacc ****************************/
+
+static void Sop_PFI_OP_Dacc(to)( GenefxState *gfxs )
+{
+     int                l = gfxs->length;
+     u32               *S = gfxs->Sop[0];
+     GenefxAccumulator *D = gfxs->Dacc;
+     int                Ostep = gfxs->Ostep;
+
+     while (l--) {
+          u32 s = *S;
+
+          EXPAND( *D, s );
+
+          S += Ostep;
+
+          D++;
+     }
+}
+
+/********************************* Sop_PFI_Kto_Dacc ***************************/
+
+static void Sop_PFI_OP_Dacc(Kto)( GenefxState *gfxs )
+{
+     int                l    = gfxs->length;
+     u32               *S    = gfxs->Sop[0];
+     GenefxAccumulator *D    = gfxs->Dacc;
+     u32                Skey = gfxs->Skey;
+     int                Ostep = gfxs->Ostep;
+
+     while (l--) {
+          u32 s = *S;
+
+          if ((s & RGB_MASK) != Skey)
+               EXPAND( *D, s );
+          else
+               D->RGB.a = 0xF000;
+
+          S += Ostep;
+          D++;
+     }
+}
+
+/********************************* Sacc_to_Aop_PFI ****************************/
+
+static void Sacc_OP_Aop_PFI(to)( GenefxState *gfxs )
+{
+     int                l = gfxs->length;
+     GenefxAccumulator *S = gfxs->Sacc;
+     u32               *D = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+
+     while (l--) {
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+
+          S++;
+          D += Dstep;
+     }
+}
+
+/********************************* Sacc_Sto_Aop_PFI ***************************/
+
+static void Sacc_OP_Aop_PFI(Sto)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u32               *D     = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+
+     while (l--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000))
+               *D = PIXEL( *S );
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/********************************* Sacc_toK_Aop_PFI ***************************/
+
+static void Sacc_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int                l    = gfxs->length;
+     GenefxAccumulator *S    = gfxs->Sacc;
+     u32               *D    = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+     u32                Dkey = gfxs->Dkey;
+
+     while (l--) {
+          if (!(S->RGB.a & 0xF000) && (*D & RGB_MASK) == Dkey)
+               *D = PIXEL( *S );
+
+          S++;
+          D += Dstep;
+     }
+}
+
+/********************************* Sacc_StoK_Aop_PFI **************************/
+
+static void Sacc_OP_Aop_PFI(StoK)( GenefxState *gfxs )
+{
+     int                l     = gfxs->length;
+     int                i     = gfxs->Xphase;
+     int                SperD = gfxs->SperD;
+     GenefxAccumulator *Sacc  = gfxs->Sacc;
+     u32               *D     = gfxs->Aop[0];
+     int                Dstep = gfxs->Astep;
+     u32                Dkey  = gfxs->Dkey;
+
+     while (l--) {
+          GenefxAccumulator *S = &Sacc[i>>16];
+
+          if (!(S->RGB.a & 0xF000) && (*D & RGB_MASK) == Dkey)
+               *D = PIXEL( *S );
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/******************************************************************************/
+
+#undef RGB_MASK
+#undef PIXEL
+#undef EXPAND
+
+#undef A_SHIFT
+#undef R_SHIFT
+#undef G_SHIFT
+#undef B_SHIFT
+#undef A_MASK
+#undef R_MASK
+#undef G_MASK
+#undef B_MASK
+#undef PIXEL_OUT
+#undef EXPAND_Ato8
+#undef EXPAND_Rto8
+#undef EXPAND_Gto8
+#undef EXPAND_Bto8
+#undef Sop_PFI_OP_Dacc
+#undef Sacc_OP_Aop_PFI
diff --git a/Source/DirectFB/src/gfx/generic/template_colorkey_16.h b/Source/DirectFB/src/gfx/generic/template_colorkey_16.h
new file mode 100755
index 0000000..542dad2
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/template_colorkey_16.h
@@ -0,0 +1,369 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/*
+ * Example:
+ * #define RGB_MASK 0x7fff
+ * #define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_15
+ * #define Bop_PFI_OP_Aop_PFI( op ) Bop_15_##op##_Aop_15
+ * #include "template_ckey_16.h"
+ */
+
+#if RGB_MASK == 0xffff
+#define MASK_RGB( p ) (p)
+#else
+#define MASK_RGB( p ) ((p) & RGB_MASK)
+#endif
+
+#define MASK_RGB_L( p ) ((p) & RGB_MASK)
+#define MASK_RGB_H( p ) ((p) & (RGB_MASK << 16))
+#define MASK_RGB_32( p ) ((p) & (RGB_MASK << 16 | RGB_MASK))
+
+/********************************* Cop_toK_Aop_PFI ****************************/
+
+static void Cop_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int  l    = gfxs->length;
+     u16 *D    = gfxs->Aop[0];
+     u16  Dkey = gfxs->Dkey;
+     u16  Cop  = gfxs->Cop;
+
+     while (l--) {
+          if (MASK_RGB( *D ) == Dkey)
+               *D = Cop;
+
+          D++;
+     }
+}
+
+/********************************* Bop_PFI_Kto_Aop_PFI ************************/
+
+static void Bop_PFI_OP_Aop_PFI(Kto)( GenefxState *gfxs )
+{
+     int  w, l  = gfxs->length;
+     int  Ostep = gfxs->Ostep;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Skey  = gfxs->Skey;
+     u32  SkeyH = gfxs->Skey << 16;
+
+     /* blit direction */
+     if (Ostep < 0) {
+          S += gfxs->length - 1;
+          D += gfxs->length - 1;
+     }
+
+     if (((long)S & 2) != ((long)D & 2)) {
+          /* source and destination misaligned */
+          while (l--) {
+               u16 s = *S;
+
+               if (MASK_RGB( s ) != Skey)
+                    *D = s;
+
+               S += Ostep;
+               D += Ostep;
+          }
+
+          return;
+     }
+
+     /* fix alignment */
+     if (Ostep > 0) {
+          if ((long)D & 2) {
+               /* align / leftmost pixel */
+               u16 s = *S;
+
+               if (MASK_RGB( s ) != Skey)
+                    *D = s;
+
+               S++;
+               D++;
+               l--;
+          }
+     } else { /* Ostep < 0 */
+          if ((long)D & 2) {
+               /* align */
+               S--;
+               D--;
+          } else {
+               /* rightmost pixel */
+               u16 s = *S;
+
+               if (MASK_RGB( s ) != Skey)
+                    *D = s;
+
+               S -= 2;
+               D -= 2;
+               l--;
+          }
+     }
+
+     /* blit */
+     Ostep <<= 1;
+     w = l >> 1;
+     while (w--) {
+          u32 s = *(u32 *) S;
+
+          if (MASK_RGB_L( s ) != Skey) {
+               if (MASK_RGB_H( s ) != SkeyH) {
+                    *(u32 *) D = s;
+               } else {
+#ifdef WORDS_BIGENDIAN
+                    D[1] = (u16) s;
+#else
+                    D[0] = (u16) s;
+#endif
+               }
+          } else if (MASK_RGB_H( s ) != SkeyH) {
+#ifdef WORDS_BIGENDIAN
+               D[0] = (u16) (s >> 16);
+#else
+               D[1] = (u16) (s >> 16);
+#endif
+          }
+
+          S += Ostep;
+          D += Ostep;
+     }
+
+     /* last potential pixel */
+     if (l & 1) {
+          u16 s;
+
+          if (Ostep < 0) {
+               S++;
+               D++;
+          }
+
+          s = *S;
+          if (MASK_RGB( s ) != Skey)
+               *D = s;
+     }
+}
+
+/********************************* Bop_PFI_toK_Aop_PFI ************************/
+
+static void Bop_PFI_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int  w, l  = gfxs->length;
+     int  Ostep = gfxs->Ostep;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Dkey  = gfxs->Dkey;
+     u32  DkeyH = gfxs->Dkey << 16;
+
+     /* blit direction */
+     if (Ostep < 0) {
+          S += gfxs->length - 1;
+          D += gfxs->length - 1;
+     }
+
+     if (((long)S & 2) != ((long)D & 2)) {
+          /* source and destination misaligned */
+          while (l--) {
+               if (MASK_RGB( *D ) == Dkey)
+                    *D = *S;
+
+               S += Ostep;
+               D += Ostep;
+          }
+
+          return;
+     }
+
+     /* fix alignment */
+     if ((Ostep > 0)) {
+          if ((long)D & 2) {
+               /* align / leftmost pixel */
+               if (MASK_RGB( *D ) == Dkey)
+                    *D = *S;
+
+               S++;
+               D++;
+               l--;
+          }
+     } else { /* Ostep < 0 */
+          if ((long)D & 2) {
+               /* align */
+               S--;
+               D--;
+          } else {
+               /* rightmost pixel */
+               if (MASK_RGB( *D ) == Dkey)
+                    *D = *S;
+
+               S -= 2;
+               D -= 2;
+               l--;
+          }
+     }
+
+     /* blit */
+     Ostep <<= 1;
+     w = l >> 1;
+     while (w--) {
+          u32 d = *(u32 *) D;
+
+          if (MASK_RGB_32( d ) == (DkeyH | Dkey)) {
+               *(u32 *) D = *(u32 *) S;
+          } else {
+               if (MASK_RGB_L( d ) == Dkey) {
+#ifdef WORDS_BIGENDIAN
+                    D[0] = S[0];
+#else
+                    D[1] = S[1];
+#endif
+               } else
+               if (MASK_RGB_H( d ) == DkeyH) {
+#ifdef WORDS_BIGENDIAN
+                    D[1] = S[1];
+#else
+                    D[0] = S[0];
+#endif
+               }
+          }
+
+          S += Ostep;
+          D += Ostep;
+     }
+
+     /* last potential pixel */
+     if (l & 1) {
+          if (Ostep < 0) {
+               S++;
+               D++;
+          }
+
+          if (MASK_RGB( *D ) == Dkey)
+               *D = *S;
+     }
+}
+
+/********************************* Bop_PFI_KtoK_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(KtoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  Ostep = gfxs->Ostep;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Skey  = gfxs->Skey;
+     u16  Dkey  = gfxs->Dkey;
+
+     if (Ostep < 0) {
+          S += gfxs->length - 1;
+          D += gfxs->length - 1;
+     }
+
+     while (l--) {
+          u16 s = *S;
+
+          if (MASK_RGB( s ) != Skey && MASK_RGB( *D ) == Dkey)
+               *D = s;
+
+          S += Ostep;
+          D += Ostep;
+     }
+}
+
+/********************************* Bop_PFI_SKto_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(SKto)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Skey  = gfxs->Skey;
+
+     while (l--) {
+          u16 s = S[i>>16];
+
+          if (MASK_RGB( s ) != Skey)
+               *D = s;
+
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Bop_PFI_StoK_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(StoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Dkey  = gfxs->Dkey;
+
+     while (l--) {
+          if (MASK_RGB( *D ) != Dkey)
+               *D = S[i>>16];
+
+          D++;
+          i += SperD;
+     }
+}
+
+/********************************* Bop_PFI_SKtoK_Aop_PFI **********************/
+
+static void Bop_PFI_OP_Aop_PFI(SKtoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u16 *S     = gfxs->Bop[0];
+     u16 *D     = gfxs->Aop[0];
+     u16  Skey  = gfxs->Skey;
+     u16  Dkey  = gfxs->Dkey;
+
+     while (l--) {
+          u16 s = S[i>>16];
+
+          if (MASK_RGB( s ) != Skey && MASK_RGB( *D ) == Dkey)
+               *D = s;
+
+          D++;
+          i += SperD;
+     }
+}
+
+/******************************************************************************/
+
+#undef MASK_RGB
+#undef MASK_RGB_L
+#undef MASK_RGB_H
+#undef MASK_RGB_32
+
+#undef RGB_MASK
+#undef Cop_OP_Aop_PFI
+#undef Bop_PFI_OP_Aop_PFI
diff --git a/Source/DirectFB/src/gfx/generic/template_colorkey_32.h b/Source/DirectFB/src/gfx/generic/template_colorkey_32.h
new file mode 100755
index 0000000..7771d43
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/template_colorkey_32.h
@@ -0,0 +1,206 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+/*
+ * Example:
+ * #define RGB_MASK 0x00ffffff
+ * #define Cop_OP_Aop_PFI( op ) Cop_##op##_Aop_32
+ * #define Bop_PFI_OP_Aop_PFI( op ) Bop_32_##op##_Aop_32
+ * #include "template_colorkey_32.h"
+ */
+
+/********************************* Cop_toK_Aop_PFI ****************************/
+
+static void Cop_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int  l    = gfxs->length;
+     u32 *D    = gfxs->Aop[0];
+     u32  Dkey = gfxs->Dkey;
+     u32  Cop  = gfxs->Cop;
+
+     while (l--) {
+          if ((*D & RGB_MASK) == Dkey)
+               *D = Cop;
+
+          D++;
+     }
+}
+
+/********************************* Bop_PFI_Kto_Aop_PFI ************************/
+
+static void Bop_PFI_OP_Aop_PFI(Kto)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  Sstep = gfxs->Bstep;
+     int  Dstep = gfxs->Astep;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     u32  Skey  = gfxs->Skey;
+
+     if (Sstep < 0) {
+          S += gfxs->length - 1;
+          D += (gfxs->length - 1) * gfxs->Astep;
+     }
+
+     while (l--) {
+          u32 s = *S;
+
+          if ((s & RGB_MASK) != Skey)
+               *D = s;
+
+          S += Sstep;
+          D += Dstep;
+     }
+}
+
+/********************************* Bop_PFI_toK_Aop_PFI ************************/
+
+static void Bop_PFI_OP_Aop_PFI(toK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  Sstep = gfxs->Bstep;
+     int  Dstep = gfxs->Astep;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     u32  Dkey  = gfxs->Dkey;
+
+     if (Sstep < 0) {
+          S += gfxs->length - 1;
+          D += (gfxs->length - 1) * gfxs->Astep;
+     }
+
+     while (l--) {
+          if ((*D & RGB_MASK) == Dkey)
+               *D = *S;
+
+          S += Sstep;
+          D += Dstep;
+     }
+}
+
+/********************************* Bop_PFI_KtoK_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(KtoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  Sstep = gfxs->Bstep;
+     int  Dstep = gfxs->Astep;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     u32  Skey  = gfxs->Skey;
+     u32  Dkey  = gfxs->Dkey;
+
+     if (Sstep < 0) {
+          S += gfxs->length - 1;
+          D += (gfxs->length - 1) * gfxs->Astep;
+     }
+
+     while (l--) {
+          u32 s = *S;
+
+          if ((s & RGB_MASK) != Skey && (*D & RGB_MASK) == Dkey)
+               *D = s;
+
+          S += Sstep;
+          D += Dstep;
+     }
+}
+
+/********************************* Bop_PFI_SKto_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(SKto)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     int  Dstep = gfxs->Astep;
+     u32  Skey  = gfxs->Skey;
+
+     while (l--) {
+          u32 s = S[i>>16];
+
+          if ((s & RGB_MASK) != Skey)
+               *D = s;
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/********************************* Bop_PFI_StoK_Aop_PFI ***********************/
+
+static void Bop_PFI_OP_Aop_PFI(StoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     u32  Dkey  = gfxs->Dkey;
+     int  Dstep = gfxs->Astep;
+
+     while (l--) {
+          if ((*D & RGB_MASK) != Dkey)
+               *D = S[i>>16];
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/********************************* Bop_PFI_SKtoK_Aop_PFI **********************/
+
+static void Bop_PFI_OP_Aop_PFI(SKtoK)( GenefxState *gfxs )
+{
+     int  l     = gfxs->length;
+     int  i     = gfxs->Xphase;
+     int  SperD = gfxs->SperD;
+     u32 *S     = gfxs->Bop[0];
+     u32 *D     = gfxs->Aop[0];
+     u32  Skey  = gfxs->Skey;
+     u32  Dkey  = gfxs->Dkey;
+     int  Dstep = gfxs->Astep;
+
+     while (l--) {
+          u32 s = S[i>>16];
+
+          if ((s & RGB_MASK) != Skey && (*D & RGB_MASK) == Dkey)
+               *D = s;
+
+          D += Dstep;
+          i += SperD;
+     }
+}
+
+/******************************************************************************/
+
+#undef RGB_MASK
+#undef Cop_OP_Aop_PFI
+#undef Bop_PFI_OP_Aop_PFI
diff --git a/Source/DirectFB/src/gfx/generic/yuvtbl-gen.c b/Source/DirectFB/src/gfx/generic/yuvtbl-gen.c
new file mode 100755
index 0000000..43a487d
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/yuvtbl-gen.c
@@ -0,0 +1,199 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* YCbCr->RGB:
+ * Standard ITU Rec. BT.601 derived coefficients.
+ */
+#define Y_FACTOR    1.16400
+#define VR_FACTOR   1.59600
+#define VG_FACTOR  -0.81300
+#define UG_FACTOR  -0.39100
+#define UB_FACTOR   2.01800
+
+/* RGB->YCbCr:
+ * ITU Rec. BT.601 defines the following formula for EyEcbEcr:
+ *   
+ *   Ey  = 0.299 * R + 0.587 * G + 0.114 * B
+ *   Ecb = (B - Ey) * 0.564
+ *   Ecr = (R - Ey) * 0.713
+ *   
+ * Relationship between EyEcbEcr and YCbCr:
+ *
+ *   Y   = Ey  * 219 / 255 + 16
+ *   Cb  = Ecb * 224 / 255 + 128
+ *   Cr  = Ecr * 224 / 255 + 128
+ *
+ * Therefore, to convert RGB to YCbCr, we compute Ey from R G B,
+ * then we derive Y Cb Cr from Ey using 3 lookup tables.
+ */
+#define ECB_FACTOR   0.56400
+#define ECR_FACTOR   0.71300
+
+
+typedef struct {
+     const char *type;
+     const char *name;
+     int         size;
+     struct {
+          int    min;
+          int    max;
+     } range;
+     struct {
+          int    min;
+          int    max;
+     } clamp;
+     float       sub;
+     float       mul;
+     float       add;
+} GenTable;
+     
+
+#define N_PER_LINE 10
+
+static void
+dump_table( GenTable *gt )
+{
+     int i, n;
+     
+     printf( "\n%s %s[%i] = {\n", gt->type, gt->name, gt->size );
+
+     for (i = 0, n = 0; i < gt->size; i++) {
+          float num;
+          
+          num = (i < gt->range.min)
+                ? gt->range.min
+                : ((i > gt->range.max) ? gt->range.max : i);
+          num = ((num - gt->sub) * gt->mul) + gt->add;
+          num = (num < gt->clamp.min) 
+                ? gt->clamp.min
+                : ((num > gt->clamp.max) ? gt->clamp.max : num);
+          
+          if (n == 0)
+               printf( "     " );
+          
+          printf( "%4i", (int) num );
+          
+          if (i < (gt->size-1)) {
+               if (++n == N_PER_LINE) {
+                    printf( ",\n" );
+                    n = 0;
+               } else
+                    printf( ", " );
+          } else
+               printf( "\n" );
+     }
+
+     printf( "};\n\n" );
+}
+
+int
+main( int argc, char **argv )
+{
+     GenTable gt = {
+          .size      = 256,
+          .range.min = 16,
+          .clamp.min = -1000,
+          .clamp.max = +1000,
+     };
+
+     /* headers */
+     puts( "#ifndef __YUV_TABLES_H__" );
+     puts( "#define __YUV_TABLES_H__" );
+     puts( "" );
+     
+/* YUV->RGB */
+     /* luma */
+     gt.type      = "const u16";
+     gt.name      = "y_for_rgb";
+     gt.range.max = 235;
+     gt.sub       = 16;
+     gt.mul       = Y_FACTOR; 
+     gt.add       = 0;
+     dump_table( > );
+
+     /* chroma */
+     gt.type      = "const s16";
+     gt.range.max = 240;
+     gt.sub       = 128;
+
+     gt.name      = "cr_for_r";
+     gt.mul       = VR_FACTOR;
+     dump_table( > );
+
+     gt.name      = "cr_for_g";
+     gt.mul       = VG_FACTOR;
+     dump_table( > );
+
+     gt.name      = "cb_for_g";
+     gt.mul       = UG_FACTOR;
+     dump_table( > );
+
+     gt.name      = "cb_for_b";
+     gt.mul       = UB_FACTOR;
+     dump_table( > );
+
+/* RGB->YUV */
+     gt.size      = 256;
+     gt.range.min = 0;
+     gt.range.max = 255; 
+     gt.clamp.min = 16;
+     gt.sub       = 0;
+     
+     /* luma */
+     gt.type      = "const u16";
+     gt.name      = "y_from_ey";
+     gt.clamp.max = 235;
+     gt.mul       = 219.0/255.0;
+     gt.add       = 16;
+     dump_table( > );
+
+     /* chroma */
+     gt.size      = 512;
+     gt.range.max = 511;
+     gt.clamp.max = 240;
+     gt.sub       = 255;
+     gt.add       = 128;
+     
+     /* cb */
+     gt.type = "const u16";
+     gt.name = "cb_from_bey";
+     gt.mul  = ECB_FACTOR * 224.0 / 255.0;
+     dump_table( > );
+
+     /* cr */
+     gt.type = "const u16";
+     gt.name = "cr_from_rey";
+     gt.mul  = ECR_FACTOR * 224.0 / 255.0;
+     dump_table( > );
+
+     /* end headers */
+     puts( "#endif /* __YUV_TABLES_H__ */" );
+
+     return 0;
+ }
diff --git a/Source/DirectFB/src/gfx/generic/yuvtbl.h b/Source/DirectFB/src/gfx/generic/yuvtbl.h
new file mode 100755
index 0000000..3769a35
--- /dev/null
+++ b/Source/DirectFB/src/gfx/generic/yuvtbl.h
@@ -0,0 +1,296 @@
+#ifndef __YUV_TABLES_H__
+#define __YUV_TABLES_H__
+
+
+const u16 y_for_rgb[256] = {
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    1,    2,    3,
+        4,    5,    6,    8,    9,   10,   11,   12,   13,   15,
+       16,   17,   18,   19,   20,   22,   23,   24,   25,   26,
+       27,   29,   30,   31,   32,   33,   34,   36,   37,   38,
+       39,   40,   41,   43,   44,   45,   46,   47,   48,   50,
+       51,   52,   53,   54,   55,   57,   58,   59,   60,   61,
+       62,   64,   65,   66,   67,   68,   69,   71,   72,   73,
+       74,   75,   76,   77,   79,   80,   81,   82,   83,   84,
+       86,   87,   88,   89,   90,   91,   93,   94,   95,   96,
+       97,   98,  100,  101,  102,  103,  104,  105,  107,  108,
+      109,  110,  111,  112,  114,  115,  116,  117,  118,  119,
+      121,  122,  123,  124,  125,  126,  128,  129,  130,  131,
+      132,  133,  135,  136,  137,  138,  139,  140,  142,  143,
+      144,  145,  146,  147,  148,  150,  151,  152,  153,  154,
+      155,  157,  158,  159,  160,  161,  162,  164,  165,  166,
+      167,  168,  169,  171,  172,  173,  174,  175,  176,  178,
+      179,  180,  181,  182,  183,  185,  186,  187,  188,  189,
+      190,  192,  193,  194,  195,  196,  197,  199,  200,  201,
+      202,  203,  204,  206,  207,  208,  209,  210,  211,  213,
+      214,  215,  216,  217,  218,  219,  221,  222,  223,  224,
+      225,  226,  228,  229,  230,  231,  232,  233,  235,  236,
+      237,  238,  239,  240,  242,  243,  244,  245,  246,  247,
+      249,  250,  251,  252,  253,  254,  254,  254,  254,  254,
+      254,  254,  254,  254,  254,  254,  254,  254,  254,  254,
+      254,  254,  254,  254,  254,  254
+};
+
+
+const s16 cr_for_r[256] = {
+     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,
+     -178, -178, -178, -178, -178, -178, -178, -177, -175, -173,
+     -172, -170, -169, -167, -165, -164, -162, -161, -159, -158,
+     -156, -154, -153, -151, -150, -148, -146, -145, -143, -142,
+     -140, -138, -137, -135, -134, -132, -130, -129, -127, -126,
+     -124, -122, -121, -119, -118, -116, -114, -113, -111, -110,
+     -108, -106, -105, -103, -102, -100,  -98,  -97,  -95,  -94,
+      -92,  -90,  -89,  -87,  -86,  -84,  -82,  -81,  -79,  -78,
+      -76,  -75,  -73,  -71,  -70,  -68,  -67,  -65,  -63,  -62,
+      -60,  -59,  -57,  -55,  -54,  -52,  -51,  -49,  -47,  -46,
+      -44,  -43,  -41,  -39,  -38,  -36,  -35,  -33,  -31,  -30,
+      -28,  -27,  -25,  -23,  -22,  -20,  -19,  -17,  -15,  -14,
+      -12,  -11,   -9,   -7,   -6,   -4,   -3,   -1,    0,    1,
+        3,    4,    6,    7,    9,   11,   12,   14,   15,   17,
+       19,   20,   22,   23,   25,   27,   28,   30,   31,   33,
+       35,   36,   38,   39,   41,   43,   44,   46,   47,   49,
+       51,   52,   54,   55,   57,   59,   60,   62,   63,   65,
+       67,   68,   70,   71,   73,   75,   76,   78,   79,   81,
+       82,   84,   86,   87,   89,   90,   92,   94,   95,   97,
+       98,  100,  102,  103,  105,  106,  108,  110,  111,  113,
+      114,  116,  118,  119,  121,  122,  124,  126,  127,  129,
+      130,  132,  134,  135,  137,  138,  140,  142,  143,  145,
+      146,  148,  150,  151,  153,  154,  156,  158,  159,  161,
+      162,  164,  165,  167,  169,  170,  172,  173,  175,  177,
+      178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
+      178,  178,  178,  178,  178,  178
+};
+
+
+const s16 cr_for_g[256] = {
+       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,
+       91,   91,   91,   91,   91,   91,   91,   90,   89,   88,
+       87,   86,   86,   85,   84,   83,   82,   82,   81,   80,
+       79,   78,   78,   77,   76,   75,   74,   73,   73,   72,
+       71,   70,   69,   69,   68,   67,   66,   65,   65,   64,
+       63,   62,   61,   60,   60,   59,   58,   57,   56,   56,
+       55,   54,   53,   52,   52,   51,   50,   49,   48,   47,
+       47,   46,   45,   44,   43,   43,   42,   41,   40,   39,
+       39,   38,   37,   36,   35,   34,   34,   33,   32,   31,
+       30,   30,   29,   28,   27,   26,   26,   25,   24,   23,
+       22,   21,   21,   20,   19,   18,   17,   17,   16,   15,
+       14,   13,   13,   12,   11,   10,    9,    8,    8,    7,
+        6,    5,    4,    4,    3,    2,    1,    0,    0,    0,
+       -1,   -2,   -3,   -4,   -4,   -5,   -6,   -7,   -8,   -8,
+       -9,  -10,  -11,  -12,  -13,  -13,  -14,  -15,  -16,  -17,
+      -17,  -18,  -19,  -20,  -21,  -21,  -22,  -23,  -24,  -25,
+      -26,  -26,  -27,  -28,  -29,  -30,  -30,  -31,  -32,  -33,
+      -34,  -34,  -35,  -36,  -37,  -38,  -39,  -39,  -40,  -41,
+      -42,  -43,  -43,  -44,  -45,  -46,  -47,  -47,  -48,  -49,
+      -50,  -51,  -52,  -52,  -53,  -54,  -55,  -56,  -56,  -57,
+      -58,  -59,  -60,  -60,  -61,  -62,  -63,  -64,  -65,  -65,
+      -66,  -67,  -68,  -69,  -69,  -70,  -71,  -72,  -73,  -73,
+      -74,  -75,  -76,  -77,  -78,  -78,  -79,  -80,  -81,  -82,
+      -82,  -83,  -84,  -85,  -86,  -86,  -87,  -88,  -89,  -90,
+      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
+      -91,  -91,  -91,  -91,  -91,  -91
+};
+
+
+const s16 cb_for_g[256] = {
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   42,
+       42,   41,   41,   41,   40,   40,   39,   39,   39,   38,
+       38,   37,   37,   37,   36,   36,   35,   35,   35,   34,
+       34,   34,   33,   33,   32,   32,   32,   31,   31,   30,
+       30,   30,   29,   29,   28,   28,   28,   27,   27,   26,
+       26,   26,   25,   25,   25,   24,   24,   23,   23,   23,
+       22,   22,   21,   21,   21,   20,   20,   19,   19,   19,
+       18,   18,   17,   17,   17,   16,   16,   16,   15,   15,
+       14,   14,   14,   13,   13,   12,   12,   12,   11,   11,
+       10,   10,   10,    9,    9,    8,    8,    8,    7,    7,
+        7,    6,    6,    5,    5,    5,    4,    4,    3,    3,
+        3,    2,    2,    1,    1,    1,    0,    0,    0,    0,
+        0,   -1,   -1,   -1,   -2,   -2,   -3,   -3,   -3,   -4,
+       -4,   -5,   -5,   -5,   -6,   -6,   -7,   -7,   -7,   -8,
+       -8,   -8,   -9,   -9,  -10,  -10,  -10,  -11,  -11,  -12,
+      -12,  -12,  -13,  -13,  -14,  -14,  -14,  -15,  -15,  -16,
+      -16,  -16,  -17,  -17,  -17,  -18,  -18,  -19,  -19,  -19,
+      -20,  -20,  -21,  -21,  -21,  -22,  -22,  -23,  -23,  -23,
+      -24,  -24,  -25,  -25,  -25,  -26,  -26,  -26,  -27,  -27,
+      -28,  -28,  -28,  -29,  -29,  -30,  -30,  -30,  -31,  -31,
+      -32,  -32,  -32,  -33,  -33,  -34,  -34,  -34,  -35,  -35,
+      -35,  -36,  -36,  -37,  -37,  -37,  -38,  -38,  -39,  -39,
+      -39,  -40,  -40,  -41,  -41,  -41,  -42,  -42,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,  -43
+};
+
+
+const s16 cb_for_b[256] = {
+     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,
+     -226, -226, -226, -226, -226, -226, -226, -223, -221, -219,
+     -217, -215, -213, -211, -209, -207, -205, -203, -201, -199,
+     -197, -195, -193, -191, -189, -187, -185, -183, -181, -179,
+     -177, -175, -173, -171, -169, -167, -165, -163, -161, -159,
+     -157, -155, -153, -151, -149, -147, -145, -143, -141, -139,
+     -137, -135, -133, -131, -129, -127, -125, -123, -121, -119,
+     -117, -115, -113, -110, -108, -106, -104, -102, -100,  -98,
+      -96,  -94,  -92,  -90,  -88,  -86,  -84,  -82,  -80,  -78,
+      -76,  -74,  -72,  -70,  -68,  -66,  -64,  -62,  -60,  -58,
+      -56,  -54,  -52,  -50,  -48,  -46,  -44,  -42,  -40,  -38,
+      -36,  -34,  -32,  -30,  -28,  -26,  -24,  -22,  -20,  -18,
+      -16,  -14,  -12,  -10,   -8,   -6,   -4,   -2,    0,    2,
+        4,    6,    8,   10,   12,   14,   16,   18,   20,   22,
+       24,   26,   28,   30,   32,   34,   36,   38,   40,   42,
+       44,   46,   48,   50,   52,   54,   56,   58,   60,   62,
+       64,   66,   68,   70,   72,   74,   76,   78,   80,   82,
+       84,   86,   88,   90,   92,   94,   96,   98,  100,  102,
+      104,  106,  108,  110,  113,  115,  117,  119,  121,  123,
+      125,  127,  129,  131,  133,  135,  137,  139,  141,  143,
+      145,  147,  149,  151,  153,  155,  157,  159,  161,  163,
+      165,  167,  169,  171,  173,  175,  177,  179,  181,  183,
+      185,  187,  189,  191,  193,  195,  197,  199,  201,  203,
+      205,  207,  209,  211,  213,  215,  217,  219,  221,  223,
+      226,  226,  226,  226,  226,  226,  226,  226,  226,  226,
+      226,  226,  226,  226,  226,  226
+};
+
+
+const u16 y_from_ey[256] = {
+       16,   16,   17,   18,   19,   20,   21,   22,   22,   23,
+       24,   25,   26,   27,   28,   28,   29,   30,   31,   32,
+       33,   34,   34,   35,   36,   37,   38,   39,   40,   40,
+       41,   42,   43,   44,   45,   46,   46,   47,   48,   49,
+       50,   51,   52,   52,   53,   54,   55,   56,   57,   58,
+       58,   59,   60,   61,   62,   63,   64,   64,   65,   66,
+       67,   68,   69,   70,   70,   71,   72,   73,   74,   75,
+       76,   76,   77,   78,   79,   80,   81,   82,   82,   83,
+       84,   85,   86,   87,   88,   89,   89,   90,   91,   92,
+       93,   94,   95,   95,   96,   97,   98,   99,  100,  101,
+      101,  102,  103,  104,  105,  106,  107,  107,  108,  109,
+      110,  111,  112,  113,  113,  114,  115,  116,  117,  118,
+      119,  119,  120,  121,  122,  123,  124,  125,  125,  126,
+      127,  128,  129,  130,  131,  131,  132,  133,  134,  135,
+      136,  137,  137,  138,  139,  140,  141,  142,  143,  143,
+      144,  145,  146,  147,  148,  149,  149,  150,  151,  152,
+      153,  154,  155,  155,  156,  157,  158,  159,  160,  161,
+      162,  162,  163,  164,  165,  166,  167,  168,  168,  169,
+      170,  171,  172,  173,  174,  174,  175,  176,  177,  178,
+      179,  180,  180,  181,  182,  183,  184,  185,  186,  186,
+      187,  188,  189,  190,  191,  192,  192,  193,  194,  195,
+      196,  197,  198,  198,  199,  200,  201,  202,  203,  204,
+      204,  205,  206,  207,  208,  209,  210,  210,  211,  212,
+      213,  214,  215,  216,  216,  217,  218,  219,  220,  221,
+      222,  222,  223,  224,  225,  226,  227,  228,  228,  229,
+      230,  231,  232,  233,  234,  235
+};
+
+
+const u16 cb_from_bey[512] = {
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   17,   17,   18,   18,   19,   19,   19,   20,   20,
+       21,   21,   22,   22,   23,   23,   24,   24,   25,   25,
+       26,   26,   27,   27,   28,   28,   29,   29,   30,   30,
+       31,   31,   32,   32,   33,   33,   34,   34,   35,   35,
+       36,   36,   37,   37,   38,   38,   39,   39,   40,   40,
+       41,   41,   42,   42,   43,   43,   44,   44,   45,   45,
+       46,   46,   47,   47,   48,   48,   49,   49,   50,   50,
+       51,   51,   52,   52,   53,   53,   54,   54,   55,   55,
+       56,   56,   57,   57,   58,   58,   59,   59,   60,   60,
+       61,   61,   62,   62,   63,   63,   64,   64,   65,   65,
+       66,   66,   67,   67,   68,   68,   69,   69,   70,   70,
+       71,   71,   72,   72,   73,   73,   73,   74,   74,   75,
+       75,   76,   76,   77,   77,   78,   78,   79,   79,   80,
+       80,   81,   81,   82,   82,   83,   83,   84,   84,   85,
+       85,   86,   86,   87,   87,   88,   88,   89,   89,   90,
+       90,   91,   91,   92,   92,   93,   93,   94,   94,   95,
+       95,   96,   96,   97,   97,   98,   98,   99,   99,  100,
+      100,  101,  101,  102,  102,  103,  103,  104,  104,  105,
+      105,  106,  106,  107,  107,  108,  108,  109,  109,  110,
+      110,  111,  111,  112,  112,  113,  113,  114,  114,  115,
+      115,  116,  116,  117,  117,  118,  118,  119,  119,  120,
+      120,  121,  121,  122,  122,  123,  123,  124,  124,  125,
+      125,  126,  126,  127,  127,  128,  128,  128,  129,  129,
+      130,  130,  131,  131,  132,  132,  133,  133,  134,  134,
+      135,  135,  136,  136,  137,  137,  138,  138,  139,  139,
+      140,  140,  141,  141,  142,  142,  143,  143,  144,  144,
+      145,  145,  146,  146,  147,  147,  148,  148,  149,  149,
+      150,  150,  151,  151,  152,  152,  153,  153,  154,  154,
+      155,  155,  156,  156,  157,  157,  158,  158,  159,  159,
+      160,  160,  161,  161,  162,  162,  163,  163,  164,  164,
+      165,  165,  166,  166,  167,  167,  168,  168,  169,  169,
+      170,  170,  171,  171,  172,  172,  173,  173,  174,  174,
+      175,  175,  176,  176,  177,  177,  178,  178,  179,  179,
+      180,  180,  181,  181,  182,  182,  182,  183,  183,  184,
+      184,  185,  185,  186,  186,  187,  187,  188,  188,  189,
+      189,  190,  190,  191,  191,  192,  192,  193,  193,  194,
+      194,  195,  195,  196,  196,  197,  197,  198,  198,  199,
+      199,  200,  200,  201,  201,  202,  202,  203,  203,  204,
+      204,  205,  205,  206,  206,  207,  207,  208,  208,  209,
+      209,  210,  210,  211,  211,  212,  212,  213,  213,  214,
+      214,  215,  215,  216,  216,  217,  217,  218,  218,  219,
+      219,  220,  220,  221,  221,  222,  222,  223,  223,  224,
+      224,  225,  225,  226,  226,  227,  227,  228,  228,  229,
+      229,  230,  230,  231,  231,  232,  232,  233,  233,  234,
+      234,  235,  235,  236,  236,  236,  237,  237,  238,  238,
+      239,  239,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240
+};
+
+
+const u16 cr_from_rey[512] = {
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   17,   17,
+       18,   19,   19,   20,   20,   21,   22,   22,   23,   24,
+       24,   25,   25,   26,   27,   27,   28,   29,   29,   30,
+       30,   31,   32,   32,   33,   34,   34,   35,   35,   36,
+       37,   37,   38,   39,   39,   40,   40,   41,   42,   42,
+       43,   44,   44,   45,   45,   46,   47,   47,   48,   49,
+       49,   50,   50,   51,   52,   52,   53,   54,   54,   55,
+       55,   56,   57,   57,   58,   59,   59,   60,   60,   61,
+       62,   62,   63,   64,   64,   65,   65,   66,   67,   67,
+       68,   69,   69,   70,   71,   71,   72,   72,   73,   74,
+       74,   75,   76,   76,   77,   77,   78,   79,   79,   80,
+       81,   81,   82,   82,   83,   84,   84,   85,   86,   86,
+       87,   87,   88,   89,   89,   90,   91,   91,   92,   92,
+       93,   94,   94,   95,   96,   96,   97,   97,   98,   99,
+       99,  100,  101,  101,  102,  102,  103,  104,  104,  105,
+      106,  106,  107,  107,  108,  109,  109,  110,  111,  111,
+      112,  112,  113,  114,  114,  115,  116,  116,  117,  117,
+      118,  119,  119,  120,  121,  121,  122,  122,  123,  124,
+      124,  125,  126,  126,  127,  128,  128,  129,  129,  130,
+      131,  131,  132,  133,  133,  134,  134,  135,  136,  136,
+      137,  138,  138,  139,  139,  140,  141,  141,  142,  143,
+      143,  144,  144,  145,  146,  146,  147,  148,  148,  149,
+      149,  150,  151,  151,  152,  153,  153,  154,  154,  155,
+      156,  156,  157,  158,  158,  159,  159,  160,  161,  161,
+      162,  163,  163,  164,  164,  165,  166,  166,  167,  168,
+      168,  169,  169,  170,  171,  171,  172,  173,  173,  174,
+      174,  175,  176,  176,  177,  178,  178,  179,  179,  180,
+      181,  181,  182,  183,  183,  184,  184,  185,  186,  186,
+      187,  188,  188,  189,  190,  190,  191,  191,  192,  193,
+      193,  194,  195,  195,  196,  196,  197,  198,  198,  199,
+      200,  200,  201,  201,  202,  203,  203,  204,  205,  205,
+      206,  206,  207,  208,  208,  209,  210,  210,  211,  211,
+      212,  213,  213,  214,  215,  215,  216,  216,  217,  218,
+      218,  219,  220,  220,  221,  221,  222,  223,  223,  224,
+      225,  225,  226,  226,  227,  228,  228,  229,  230,  230,
+      231,  231,  232,  233,  233,  234,  235,  235,  236,  236,
+      237,  238,  238,  239,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240
+};
+
+#endif /* __YUV_TABLES_H__ */
diff --git a/Source/DirectFB/src/gfx/util.c b/Source/DirectFB/src/gfx/util.c
new file mode 100755
index 0000000..9e59b84
--- /dev/null
+++ b/Source/DirectFB/src/gfx/util.c
@@ -0,0 +1,270 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <pthread.h>
+
+#include <directfb.h>
+
+#include <direct/util.h>
+
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+
+#include <gfx/util.h>
+
+#include <misc/util.h>
+
+
+static bool      copy_state_inited;
+static CardState copy_state;
+
+static bool      btf_state_inited;
+static CardState btf_state;
+
+#if FIXME_SC_3
+static bool      cd_state_inited;
+static CardState cd_state;
+#endif
+
+static pthread_mutex_t copy_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t btf_lock  = PTHREAD_MUTEX_INITIALIZER;
+#if FIXME_SC_3
+static pthread_mutex_t cd_lock   = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+
+void
+dfb_gfx_copy( CoreSurface *source, CoreSurface *destination, const DFBRectangle *rect )
+{
+     dfb_gfx_copy_to( source, destination, rect, rect ? rect->x : 0, rect ? rect->y : 0, false );
+}
+
+void
+dfb_gfx_copy_to( CoreSurface *source, CoreSurface *destination, const DFBRectangle *rect, int x, int y, bool from_back )
+{
+     DFBRectangle sourcerect = { 0, 0, source->config.size.w, source->config.size.h };
+
+     pthread_mutex_lock( ©_lock );
+
+     if (!copy_state_inited) {
+          dfb_state_init( ©_state, NULL );
+          copy_state_inited = true;
+     }
+
+     copy_state.modified   |= SMF_CLIP | SMF_SOURCE | SMF_DESTINATION;
+
+     copy_state.clip.x2     = destination->config.size.w - 1;
+     copy_state.clip.y2     = destination->config.size.h - 1;
+     copy_state.source      = source;
+     copy_state.destination = destination;
+     copy_state.from        = from_back ? CSBR_BACK : CSBR_FRONT;
+
+     if (rect) {
+          if (dfb_rectangle_intersect( &sourcerect, rect ))
+               dfb_gfxcard_blit( &sourcerect,
+                                 x + sourcerect.x - rect->x,
+                                 y + sourcerect.y - rect->y, ©_state );
+     }
+     else
+          dfb_gfxcard_blit( &sourcerect, x, y, ©_state );
+
+     /* Signal end of sequence. */
+     dfb_state_stop_drawing( ©_state );
+
+     pthread_mutex_unlock( ©_lock );
+}
+
+static void
+back_to_front_copy( CoreSurface *surface, const DFBRegion *region, DFBSurfaceBlittingFlags flags, int rotation)
+{
+     DFBRectangle rect;
+     int          dx, dy;
+
+     if (region) {
+          rect.x = region->x1;
+          rect.y = region->y1;
+          rect.w = region->x2 - region->x1 + 1;
+          rect.h = region->y2 - region->y1 + 1;
+     }
+     else {
+          rect.x = 0;
+          rect.y = 0;
+          rect.w = surface->config.size.w;
+          rect.h = surface->config.size.h;
+     }
+
+     dx = rect.x;
+     dy = rect.y;
+
+     pthread_mutex_lock( &btf_lock );
+
+     if (!btf_state_inited) {
+          dfb_state_init( &btf_state, NULL );
+
+          btf_state.from = CSBR_BACK;
+          btf_state.to   = CSBR_FRONT;
+
+          btf_state_inited = true;
+     }
+
+     btf_state.modified     |= SMF_CLIP | SMF_SOURCE | SMF_DESTINATION;
+
+     btf_state.clip.x2       = surface->config.size.w - 1;
+     btf_state.clip.y2       = surface->config.size.h - 1;
+     btf_state.source        = surface;
+     btf_state.destination   = surface;
+
+
+     if (rotation == 90) {
+          dx = rect.y;
+          dy = surface->config.size.w - rect.w - rect.x;
+
+          flags |= DSBLIT_ROTATE90;
+     }
+     else if (rotation == 180) {
+          dx = surface->config.size.w - rect.w - rect.x;
+          dy = surface->config.size.h - rect.h - rect.y;
+
+          flags |= DSBLIT_ROTATE180;
+     }
+     else if (rotation == 270) {
+          dx = surface->config.size.h - rect.h - rect.y;
+          dy = rect.x;
+
+          flags |= DSBLIT_ROTATE270;
+     }
+
+
+     dfb_state_set_blitting_flags( &btf_state, flags );
+
+     dfb_gfxcard_blit( &rect, dx, dy, &btf_state );
+
+     /* Signal end of sequence. */
+     dfb_state_stop_drawing( &btf_state );
+
+     pthread_mutex_unlock( &btf_lock );
+}
+
+void
+dfb_back_to_front_copy( CoreSurface *surface, const DFBRegion *region )
+{
+     back_to_front_copy( surface, region, DSBLIT_NOFX, 0);
+}
+
+void
+dfb_back_to_front_copy_rotation( CoreSurface *surface, const DFBRegion *region, int rotation )
+{
+     back_to_front_copy( surface, region, DSBLIT_NOFX, rotation );
+}
+
+void
+dfb_clear_depth( CoreSurface *surface, const DFBRegion *region )
+{
+#if FIXME_SC_3
+     SurfaceBuffer *tmp;
+     DFBRectangle   rect = { 0, 0, surface->config.size.w - 1, surface->config.size.h - 1 };
+
+     if (region && !dfb_rectangle_intersect_by_region( &rect, region ))
+          return;
+
+     pthread_mutex_lock( &cd_lock );
+
+     if (!cd_state_inited) {
+          dfb_state_init( &cd_state, NULL );
+
+          cd_state.color.r = 0xff;
+          cd_state.color.g = 0xff;
+          cd_state.color.b = 0xff;
+
+          cd_state_inited = true;
+     }
+
+     cd_state.modified   |= SMF_CLIP | SMF_DESTINATION;
+
+     cd_state.clip.x2     = surface->config.size.w - 1;
+     cd_state.clip.y2     = surface->config.size.h - 1;
+     cd_state.destination = surface;
+
+     dfb_surfacemanager_lock( surface->manager );
+
+     tmp = surface->back_buffer;
+     surface->back_buffer = surface->depth_buffer;
+
+     dfb_gfxcard_fillrectangles( &rect, 1, &cd_state );
+
+     surface->back_buffer = tmp;
+
+     dfb_surfacemanager_unlock( surface->manager );
+
+     /* Signal end of sequence. */
+     dfb_state_stop_drawing( &cd_state );
+
+     pthread_mutex_unlock( &cd_lock );
+#endif
+}
+
+
+void dfb_sort_triangle( DFBTriangle *tri )
+{
+     int temp;
+
+     if (tri->y1 > tri->y2) {
+          temp = tri->x1;
+          tri->x1 = tri->x2;
+          tri->x2 = temp;
+
+          temp = tri->y1;
+          tri->y1 = tri->y2;
+          tri->y2 = temp;
+     }
+
+     if (tri->y2 > tri->y3) {
+          temp = tri->x2;
+          tri->x2 = tri->x3;
+          tri->x3 = temp;
+
+          temp = tri->y2;
+          tri->y2 = tri->y3;
+          tri->y3 = temp;
+     }
+
+     if (tri->y1 > tri->y2) {
+          temp = tri->x1;
+          tri->x1 = tri->x2;
+          tri->x2 = temp;
+
+          temp = tri->y1;
+          tri->y1 = tri->y2;
+          tri->y2 = temp;
+     }
+}
+
diff --git a/Source/DirectFB/src/gfx/util.h b/Source/DirectFB/src/gfx/util.h
new file mode 100755
index 0000000..79cbd6d
--- /dev/null
+++ b/Source/DirectFB/src/gfx/util.h
@@ -0,0 +1,42 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __GFX__UTIL_H__
+#define __GFX__UTIL_H__
+
+#include <core/surface.h>
+
+void dfb_gfx_copy( CoreSurface *source, CoreSurface *destination, const DFBRectangle *rect );
+void dfb_gfx_copy_to( CoreSurface *source, CoreSurface *destination, const DFBRectangle *rect, int x, int y, bool from_back );
+void dfb_back_to_front_copy( CoreSurface *surface, const DFBRegion *region );
+void dfb_back_to_front_copy_rotation( CoreSurface *surface, const DFBRegion *region, int rotation );
+void dfb_clear_depth( CoreSurface *surface, const DFBRegion *region );
+
+void dfb_sort_triangle( DFBTriangle *tri );
+
+#endif
diff --git a/Source/DirectFB/src/idirectfb.c b/Source/DirectFB/src/idirectfb.c
new file mode 100755
index 0000000..144eaad
--- /dev/null
+++ b/Source/DirectFB/src/idirectfb.c
@@ -0,0 +1,1965 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <string.h>
+
+#include <directfb.h>
+#include <directfb_version.h>
+
+#include <core/core.h>
+#include <core/coretypes.h>
+
+#include <core/clipboard.h>
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/input.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layer_region.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/surface.h>
+#include <core/system.h>
+#include <core/windows.h>
+#include <core/windows_internal.h> /* FIXME */
+#include <core/windowstack.h>
+
+#include <display/idirectfbpalette.h>
+#include <display/idirectfbscreen.h>
+#include <display/idirectfbsurface.h>
+#include <display/idirectfbsurface_layer.h>
+#include <display/idirectfbsurface_window.h>
+#include <display/idirectfbdisplaylayer.h>
+#include <input/idirectfbinputbuffer.h>
+#include <input/idirectfbinputdevice.h>
+#include <media/idirectfbfont.h>
+#include <media/idirectfbimageprovider.h>
+#include <media/idirectfbvideoprovider.h>
+#include <media/idirectfbdatabuffer.h>
+
+#include <idirectfb.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/direct.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <misc/util.h>
+
+D_DEBUG_DOMAIN( IDFB, "IDirectFB", "DirectFB Main Interface" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     DFBScreenCallback  callback;
+     void              *callback_ctx;
+} EnumScreens_Context;
+
+typedef struct {
+     IDirectFBScreen **interface;
+     DFBScreenID       id;
+     DFBResult         ret;
+} GetScreen_Context;
+
+typedef struct {
+     DFBDisplayLayerCallback  callback;
+     void                    *callback_ctx;
+} EnumDisplayLayers_Context;
+
+typedef struct {
+     IDirectFBDisplayLayer **interface;
+     DFBDisplayLayerID       id;
+     DFBResult               ret;
+     CoreDFB                *core;
+} GetDisplayLayer_Context;
+
+typedef struct {
+     DFBInputDeviceCallback  callback;
+     void                   *callback_ctx;
+} EnumInputDevices_Context;
+
+typedef struct {
+     IDirectFBInputDevice **interface;
+     DFBInputDeviceID       id;
+     DFBResult              ret;
+} GetInputDevice_Context;
+
+typedef struct {
+     IDirectFBEventBuffer       **interface;
+     DFBInputDeviceCapabilities   caps;
+} CreateEventBuffer_Context;
+
+/**********************************************************************************************************************/
+
+static DFBEnumerationResult EnumScreens_Callback      ( CoreScreen  *screen,
+                                                        void        *ctx );
+static DFBEnumerationResult GetScreen_Callback        ( CoreScreen  *screen,
+                                                        void        *ctx );
+
+static DFBEnumerationResult EnumDisplayLayers_Callback( CoreLayer   *layer,
+                                                        void        *ctx );
+static DFBEnumerationResult GetDisplayLayer_Callback  ( CoreLayer   *layer,
+                                                        void        *ctx );
+
+static DFBEnumerationResult EnumInputDevices_Callback ( CoreInputDevice *device,
+                                                        void            *ctx );
+static DFBEnumerationResult GetInputDevice_Callback   ( CoreInputDevice *device,
+                                                        void            *ctx );
+
+static DFBEnumerationResult CreateEventBuffer_Callback( CoreInputDevice *device,
+                                                        void            *ctx );
+
+static ReactionResult focus_listener( const void *msg_data,
+                                      void       *ctx );
+
+static bool input_filter_local( DFBEvent *evt,
+                                void     *ctx );
+
+static bool input_filter_global( DFBEvent *evt,
+                                 void     *ctx );
+
+static void drop_window( IDirectFB_data *data );
+
+/**********************************************************************************************************************/
+
+/*
+ * Destructor
+ *
+ * Free data structure and set the pointer to NULL,
+ * to indicate the dead interface.
+ */
+void
+IDirectFB_Destruct( IDirectFB *thiz )
+{
+     int             i;
+     IDirectFB_data *data = (IDirectFB_data*)thiz->priv;
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     drop_window( data );
+
+     if (data->primary.context)
+          dfb_layer_context_unref( data->primary.context );
+
+     dfb_layer_context_unref( data->context );
+
+     for (i=0; i<MAX_LAYERS; i++) {
+          if (data->layers[i].context) {
+               if (data->layers[i].palette)
+                    dfb_palette_unref( data->layers[i].palette );
+
+               dfb_surface_unref( data->layers[i].surface );
+               dfb_layer_region_unref( data->layers[i].region );
+               dfb_layer_context_unref( data->layers[i].context );
+          }
+     }
+
+     dfb_core_destroy( data->core, false );
+
+     idirectfb_singleton = NULL;
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+
+     direct_shutdown();
+}
+
+
+static DirectResult
+IDirectFB_AddRef( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFB_Release( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->ref == 0)
+          IDirectFB_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_SetCooperativeLevel( IDirectFB           *thiz,
+                               DFBCooperativeLevel  level )
+{
+     DFBResult         ret;
+     CoreLayerContext *context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %d )\n", __FUNCTION__, thiz, level );
+
+     if (level == data->level)
+          return DFB_OK;
+
+     switch (level) {
+          case DFSCL_NORMAL:
+               data->primary.focused = false;
+
+               dfb_layer_context_unref( data->primary.context );
+
+               data->primary.context = NULL;
+               break;
+
+          case DFSCL_FULLSCREEN:
+          case DFSCL_EXCLUSIVE:
+               if (dfb_config->force_windowed || dfb_config->force_desktop)
+                    return DFB_ACCESSDENIED;
+
+               if (data->level == DFSCL_NORMAL) {
+                    ret = dfb_layer_create_context( data->layer, &context );
+                    if (ret)
+                         return ret;
+
+                    ret = dfb_layer_activate_context( data->layer, context );
+                    if (ret) {
+                         dfb_layer_context_unref( context );
+                         return ret;
+                    }
+
+                    drop_window( data );
+
+                    data->primary.context = context;
+               }
+
+               data->primary.focused = true;
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     data->level = level;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_GetDeviceDescription( IDirectFB                    *thiz,
+                                DFBGraphicsDeviceDescription *ret_desc )
+{
+     GraphicsDeviceInfo device_info;
+     GraphicsDriverInfo driver_info;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!ret_desc)
+          return DFB_INVARG;
+
+     dfb_gfxcard_get_device_info( &device_info );
+     dfb_gfxcard_get_driver_info( &driver_info );
+
+     ret_desc->acceleration_mask = device_info.caps.accel;
+     ret_desc->blitting_flags    = device_info.caps.blitting;
+     ret_desc->drawing_flags     = device_info.caps.drawing;
+     ret_desc->video_memory      = dfb_gfxcard_memory_length();
+
+     snprintf( ret_desc->name,   DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH, device_info.name );
+     snprintf( ret_desc->vendor, DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH, device_info.vendor );
+
+     ret_desc->driver.major = driver_info.version.major;
+     ret_desc->driver.minor = driver_info.version.minor;
+
+     snprintf( ret_desc->driver.name,   DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,   driver_info.name );
+     snprintf( ret_desc->driver.vendor, DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, driver_info.vendor );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_EnumVideoModes( IDirectFB            *thiz,
+                          DFBVideoModeCallback  callbackfunc,
+                          void                 *callbackdata )
+{
+     VideoMode *m;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %p, %p )\n", __FUNCTION__, thiz, callbackfunc, callbackdata );
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     m = dfb_system_modes();
+     while (m) {
+          if (callbackfunc( m->xres, m->yres,
+                            m->bpp, callbackdata ) == DFENUM_CANCEL)
+               break;
+
+          m = m->next;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_SetVideoMode( IDirectFB    *thiz,
+                        int           width,
+                        int           height,
+                        int           bpp )
+{
+     DFBResult ret;
+     DFBSurfacePixelFormat format;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %dx%d %dbit )\n", __FUNCTION__, thiz, width, height, bpp );
+
+     if (width < 1 || height < 1 || bpp < 1)
+          return DFB_INVARG;
+
+     format = dfb_pixelformat_for_depth( bpp );
+     if (format == DSPF_UNKNOWN)
+          return DFB_INVARG;
+
+     switch (data->level) {
+          case DFSCL_NORMAL:
+               if (data->primary.window) {
+                    ret = dfb_window_resize( data->primary.window, width, height );
+                    if (ret)
+                         return ret;
+               }
+               break;
+
+          case DFSCL_FULLSCREEN:
+          case DFSCL_EXCLUSIVE: {
+               DFBResult ret;
+               DFBDisplayLayerConfig config;
+
+               config.flags       = DLCONF_WIDTH | DLCONF_HEIGHT |
+                                    DLCONF_PIXELFORMAT;
+               config.width       = width;
+               config.height      = height;
+               config.pixelformat = format;
+
+               ret = dfb_layer_context_set_configuration( data->primary.context,
+                                                          &config );
+               if (ret)
+                    return ret;
+
+               break;
+          }
+     }
+
+     data->primary.width  = width;
+     data->primary.height = height;
+     data->primary.format = format;
+
+     return DFB_OK;
+}
+
+static void
+init_palette( CoreSurface *surface, const DFBSurfaceDescription *desc )
+{
+     int          num;
+     CorePalette *palette = surface->palette;
+
+     if (!palette || !(desc->flags & DSDESC_PALETTE))
+          return;
+
+     num = MIN( desc->palette.size, palette->num_entries );
+
+     direct_memcpy( palette->entries, desc->palette.entries, num * sizeof(DFBColor));
+
+     dfb_palette_update( palette, 0, num - 1 );
+}
+
+static DFBResult
+IDirectFB_CreateSurface( IDirectFB                    *thiz,
+                         const DFBSurfaceDescription  *desc,
+                         IDirectFBSurface            **interface )
+{
+     IDirectFBSurface *iface;
+     DFBResult ret;
+     int width = 256;
+     int height = 256;
+     DFBSurfacePixelFormat format;
+     DFBSurfaceCapabilities caps = DSCAPS_NONE;
+     CoreSurface *surface = NULL;
+     unsigned long resource_id = 0;
+     DFBDisplayLayerConfig  config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (data->primary.context)
+          dfb_layer_context_get_configuration( data->primary.context, &config );
+     else
+          dfb_layer_context_get_configuration( data->context, &config );
+
+     if (desc->flags & DSDESC_HINTS && desc->hints & DSHF_FONT) {
+          format = dfb_config->font_format;
+
+          if (dfb_config->font_premult)
+               caps = DSCAPS_PREMULTIPLIED;
+     }
+     else
+          format = config.pixelformat;
+
+     if (!desc || !interface)
+          return DFB_INVARG;
+
+     D_DEBUG_AT( IDFB, "  -> flags  0x%08x\n", desc->flags );
+
+     if (desc->flags & DSDESC_WIDTH) {
+          D_DEBUG_AT( IDFB, "  -> width  %d\n", desc->width );
+
+          width = desc->width;
+          if (width < 1 || width > 20480)
+               return DFB_INVARG;
+     }
+
+     if (desc->flags & DSDESC_HEIGHT) {
+          D_DEBUG_AT( IDFB, "  -> height %d\n", desc->height );
+
+          height = desc->height;
+          if (height < 1 || height > 20480)
+               return DFB_INVARG;
+     }
+
+     if (desc->flags & DSDESC_PALETTE)
+          if (!desc->palette.entries || !desc->palette.size)
+               return DFB_INVARG;
+
+     if (desc->flags & DSDESC_CAPS) {
+          D_DEBUG_AT( IDFB, "  -> caps   0x%08x\n", desc->caps );
+
+          caps = desc->caps;
+     }
+
+     if (desc->flags & DSDESC_PIXELFORMAT) {
+          D_DEBUG_AT( IDFB, "  -> format %s\n", dfb_pixelformat_name(desc->pixelformat) );
+
+          format = desc->pixelformat;
+     }
+
+     if (desc->flags & DSDESC_RESOURCE_ID)
+          resource_id = desc->resource_id;
+
+     switch (format) {
+          case DSPF_A1:
+          case DSPF_A4:
+          case DSPF_A8:
+          case DSPF_ARGB:
+          case DSPF_ARGB1555:
+          case DSPF_ARGB1666:
+          case DSPF_ARGB6666:
+          case DSPF_ARGB2554:
+          case DSPF_ARGB4444:
+          case DSPF_RGBA4444:
+          case DSPF_AYUV:
+          case DSPF_AiRGB:
+          case DSPF_I420:
+          case DSPF_LUT2:
+          case DSPF_LUT8:
+          case DSPF_ALUT44:
+          case DSPF_RGB16:
+          case DSPF_RGB18:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_RGB332:
+          case DSPF_UYVY:
+          case DSPF_YUY2:
+          case DSPF_YV12:
+          case DSPF_NV12:
+          case DSPF_NV21:
+          case DSPF_NV16:
+          case DSPF_RGB444:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     if (caps & DSCAPS_PRIMARY) {
+          if (desc->flags & DSDESC_PREALLOCATED)
+               return DFB_INVARG;
+
+          if (desc->flags & DSDESC_PIXELFORMAT)
+               format = desc->pixelformat;
+          else if (data->primary.format)
+               format = data->primary.format;
+          else if (dfb_config->mode.format)
+               format = dfb_config->mode.format;
+          else
+               format = config.pixelformat;
+
+          if (desc->flags & DSDESC_WIDTH)
+               width = desc->width;
+          else if (data->primary.width)
+               width = data->primary.width;
+          else if (dfb_config->mode.width)
+               width = dfb_config->mode.width;
+          else
+               width = config.width;
+
+          if (desc->flags & DSDESC_HEIGHT)
+               height = desc->height;
+          else if (data->primary.height)
+               height = data->primary.height;
+          else if (dfb_config->mode.height)
+               height = dfb_config->mode.height;
+          else
+               height = config.height;
+
+          /* FIXME: should we allow to create more primaries in windowed mode?
+                    should the primary surface be a singleton?
+                    or should we return an error? */
+          switch (data->level) {
+               case DFSCL_NORMAL:
+                    if (dfb_config->force_desktop) {
+                         CoreSurface *surface;
+
+                         /* Source compatibility with older programs */
+                         if ((caps & DSCAPS_FLIPPING) == DSCAPS_FLIPPING)
+                              caps &= ~DSCAPS_TRIPLE;
+
+                         ret = dfb_surface_create_simple( data->core,
+                                                          width, height,
+                                                          format, caps,
+                                                          CSTF_SHARED, resource_id,
+                                                          NULL, &surface );
+                         if (ret)
+                              return ret;
+
+                         surface->notifications |= CSNF_FLIP;
+
+                         init_palette( surface, desc );
+
+                         DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBSurface );
+
+                         ret = IDirectFBSurface_Construct( iface, NULL,
+                                                           NULL, NULL, NULL, surface, caps, data->core );
+                         if (ret == DFB_OK) {
+                              dfb_windowstack_set_background_image( data->stack, surface );
+                              dfb_windowstack_set_background_mode( data->stack, DLBM_IMAGE );
+                         }
+
+                         dfb_surface_unref( surface );
+
+                         if (!ret)
+                              *interface = iface;
+
+                         return ret;
+                    }
+                    else {
+                         CoreWindow           *window;
+                         DFBWindowDescription  wd;
+
+                         if ((caps & DSCAPS_FLIPPING) == DSCAPS_TRIPLE)
+                              return DFB_UNSUPPORTED;
+
+                         memset( &wd, 0, sizeof(wd) );
+
+                         wd.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT |
+                                    DWDESC_PIXELFORMAT | DWDESC_SURFACE_CAPS | DWDESC_CAPS | DWDESC_RESOURCE_ID;
+
+                         if (dfb_config->scaled.width && dfb_config->scaled.height) {
+                              wd.posx = (config.width  - dfb_config->scaled.width)  / 2;
+                              wd.posy = (config.height - dfb_config->scaled.height) / 2;
+                         }
+                         else {
+                              wd.posx = (config.width  - width)  / 2;
+                              wd.posy = (config.height - height) / 2;
+                         }
+
+                         wd.width        = width;
+                         wd.height       = height;
+                         wd.pixelformat  = format;
+                         wd.surface_caps = caps & ~DSCAPS_FLIPPING;
+                         wd.resource_id  = resource_id;
+
+                         switch (format) {
+                              case DSPF_ARGB4444:
+                              case DSPF_RGBA4444:
+                              case DSPF_ARGB2554:
+                              case DSPF_ARGB1555:
+                              case DSPF_ARGB:
+                              case DSPF_AYUV:
+                              case DSPF_AiRGB:
+                                   wd.caps |= DWCAPS_ALPHACHANNEL;
+                                   break;
+
+                              default:
+                                   break;
+                         }
+
+                         if ((caps & DSCAPS_FLIPPING) == DSCAPS_DOUBLE)
+                              wd.caps |= DWCAPS_DOUBLEBUFFER;
+
+                         ret = dfb_layer_context_create_window( data->core, data->context, &wd, &window );
+                         if (ret)
+                              return ret;
+
+                         drop_window( data );
+
+                         data->primary.window = window;
+
+                         dfb_window_attach( window, focus_listener,
+                                            data, &data->primary.reaction );
+
+                         dfb_window_change_options( window, DWOP_NONE, DWOP_SCALE );
+                         if (dfb_config->scaled.width && dfb_config->scaled.height)
+                              dfb_window_resize( window, dfb_config->scaled.width,
+                                                         dfb_config->scaled.height );
+
+                         init_palette( window->surface, desc );
+
+                         DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBSurface );
+
+                         ret = IDirectFBSurface_Window_Construct( iface, NULL,
+                                                                  NULL, NULL, window,
+                                                                  caps, data->core );
+
+                         if (!ret)
+                              *interface = iface;
+
+                         return ret;
+                    }
+               case DFSCL_FULLSCREEN:
+               case DFSCL_EXCLUSIVE: {
+                    CoreLayerRegion  *region;
+                    CoreLayerContext *context = data->primary.context;
+
+                    config.flags |= DLCONF_BUFFERMODE | DLCONF_PIXELFORMAT |
+                                    DLCONF_WIDTH | DLCONF_HEIGHT;
+
+                    /* Source compatibility with older programs */
+                    if ((caps & DSCAPS_FLIPPING) == DSCAPS_FLIPPING)
+                         caps &= ~DSCAPS_TRIPLE;
+
+                    if (caps & DSCAPS_PREMULTIPLIED) {
+                          config.flags        |= DLCONF_SURFACE_CAPS;
+                          config.surface_caps  = DSCAPS_PREMULTIPLIED;
+                    }
+
+                    if (caps & DSCAPS_TRIPLE) {
+                         if (caps & DSCAPS_SYSTEMONLY)
+                              return DFB_UNSUPPORTED;
+                         config.buffermode = DLBM_TRIPLE;
+                    } else if (caps & DSCAPS_DOUBLE) {
+                         if (caps & DSCAPS_SYSTEMONLY)
+                              config.buffermode = DLBM_BACKSYSTEM;
+                         else
+                              config.buffermode = DLBM_BACKVIDEO;
+                    }
+                    else
+                         config.buffermode = DLBM_FRONTONLY;
+
+                    config.pixelformat = format;
+                    config.width       = width;
+                    config.height      = height;
+
+                    ret = dfb_layer_context_set_configuration( context, &config );
+                    if (ret) {
+                         if (!(caps & (DSCAPS_SYSTEMONLY | DSCAPS_VIDEOONLY)) &&
+                             config.buffermode == DLBM_BACKVIDEO) {
+                              config.buffermode = DLBM_BACKSYSTEM;
+
+                              ret = dfb_layer_context_set_configuration( context, &config );
+                              if (ret)
+                                   return ret;
+                         }
+                         else
+                              return ret;
+                    }
+
+                    ret = dfb_layer_context_get_primary_region( context, true,
+                                                                ®ion );
+                    if (ret)
+                         return ret;
+
+                    ret = dfb_layer_region_get_surface( region, &surface );
+                    if (ret) {
+                         dfb_layer_region_unref( region );
+                         return ret;
+                    }
+
+/* FIXME_SC_3                    if ((caps & DSCAPS_DEPTH) && !(surface->config.caps & DSCAPS_DEPTH)) {
+                         ret = dfb_surface_allocate_depth( surface );
+                         if (ret) {
+                              dfb_surface_unref( surface );
+                              dfb_layer_region_unref( region );
+                              return ret;
+                         }
+                    }
+                    else if (!(caps & DSCAPS_DEPTH) && (surface->config.caps & DSCAPS_DEPTH)) {
+                         dfb_surface_deallocate_depth( surface );
+                    }
+*/
+
+                    init_palette( surface, desc );
+
+                    DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBSurface );
+
+                    ret = IDirectFBSurface_Layer_Construct( iface, NULL,
+                                                            NULL, NULL, region, caps, data->core );
+
+                    dfb_surface_unref( surface );
+                    dfb_layer_region_unref( region );
+
+                    if (!ret)
+                         *interface = iface;
+
+                    return ret;
+               }
+          }
+     }
+
+     /* Source compatibility with older programs */
+     if ((caps & DSCAPS_FLIPPING) == DSCAPS_FLIPPING)
+          caps &= ~DSCAPS_TRIPLE;
+
+     if (caps & DSCAPS_TRIPLE)
+          return DFB_UNSUPPORTED;
+
+     if (desc->flags & DSDESC_PREALLOCATED) {
+          int min_pitch;
+          CoreSurfaceConfig config;
+
+          if (caps & DSCAPS_VIDEOONLY)
+               return DFB_INVARG;
+
+          min_pitch = DFB_BYTES_PER_LINE(format, width);
+
+          if (!desc->preallocated[0].data ||
+               desc->preallocated[0].pitch < min_pitch)
+          {
+               return DFB_INVARG;
+          }
+
+          if ((caps & DSCAPS_DOUBLE) &&
+              (!desc->preallocated[1].data ||
+                desc->preallocated[1].pitch < min_pitch))
+          {
+               return DFB_INVARG;
+          }
+
+          config.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS | CSCONF_PREALLOCATED;
+          config.size.w = width;
+          config.size.h = height;
+          config.format = format;
+          config.caps   = caps;
+
+          config.preallocated[0].addr  = desc->preallocated[0].data;
+          config.preallocated[0].pitch = desc->preallocated[0].pitch;
+
+          config.preallocated[1].addr  = desc->preallocated[1].data;
+          config.preallocated[1].pitch = desc->preallocated[1].pitch;
+
+          ret = dfb_surface_create( data->core, &config, CSTF_PREALLOCATED, resource_id, NULL, &surface );
+          if (ret)
+               return ret;
+     }
+     else {
+          CoreSurfaceConfig config;
+
+          config.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+          config.size.w = width;
+          config.size.h = height;
+          config.format = format;
+          config.caps   = caps;
+
+          ret = dfb_surface_create( data->core, &config, CSTF_NONE, resource_id, NULL, &surface );
+          if (ret)
+               return ret;
+     }
+
+     init_palette( surface, desc );
+
+     DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBSurface );
+
+     ret = IDirectFBSurface_Construct( iface, NULL,
+                                       NULL, NULL, NULL, surface, caps, data->core );
+
+     dfb_surface_unref( surface );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_CreatePalette( IDirectFB                    *thiz,
+                         const DFBPaletteDescription  *desc,
+                         IDirectFBPalette            **interface )
+{
+     DFBResult         ret;
+     IDirectFBPalette *iface;
+     unsigned int      size    = 256;
+     CorePalette      *palette = NULL;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (desc && desc->flags & DPDESC_SIZE) {
+          if (!desc->size)
+               return DFB_INVARG;
+
+          size = desc->size;
+     }
+
+     ret = dfb_palette_create( data->core, size, &palette );
+     if (ret)
+          return ret;
+
+     if (desc && desc->flags & DPDESC_ENTRIES) {
+          direct_memcpy( palette->entries, desc->entries, size * sizeof(DFBColor));
+
+          dfb_palette_update( palette, 0, size - 1 );
+     }
+     else
+          dfb_palette_generate_rgb332_map( palette );
+
+     DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBPalette );
+
+     ret = IDirectFBPalette_Construct( iface, palette );
+
+     dfb_palette_unref( palette );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_EnumScreens( IDirectFB         *thiz,
+                       DFBScreenCallback  callbackfunc,
+                       void              *callbackdata )
+{
+     EnumScreens_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     context.callback     = callbackfunc;
+     context.callback_ctx = callbackdata;
+
+     dfb_screens_enumerate( EnumScreens_Callback, &context );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_GetScreen( IDirectFB        *thiz,
+                     DFBScreenID       id,
+                     IDirectFBScreen **interface )
+{
+     IDirectFBScreen   *iface;
+     GetScreen_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %d )\n", __FUNCTION__, thiz, id );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (dfb_config->primary_only && id != DLID_PRIMARY)
+          return DFB_IDNOTFOUND;
+
+     context.interface = &iface;
+     context.id        = id;
+     context.ret       = DFB_IDNOTFOUND;
+
+     dfb_screens_enumerate( GetScreen_Callback, &context );
+
+     if (!context.ret)
+          *interface = iface;
+
+     return context.ret;
+}
+
+static DFBResult
+IDirectFB_EnumDisplayLayers( IDirectFB               *thiz,
+                             DFBDisplayLayerCallback  callbackfunc,
+                             void                    *callbackdata )
+{
+     EnumDisplayLayers_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     context.callback     = callbackfunc;
+     context.callback_ctx = callbackdata;
+
+     dfb_layers_enumerate( EnumDisplayLayers_Callback, &context );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_GetDisplayLayer( IDirectFB              *thiz,
+                           DFBDisplayLayerID       id,
+                           IDirectFBDisplayLayer **interface )
+{
+     IDirectFBDisplayLayer   *iface;
+     GetDisplayLayer_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %d )\n", __FUNCTION__, thiz, id );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (dfb_config->primary_only && id != DLID_PRIMARY)
+          return DFB_IDNOTFOUND;
+
+     context.interface = &iface;
+     context.id        = id;
+     context.ret       = DFB_IDNOTFOUND;
+     context.core      = data->core;
+
+     dfb_layers_enumerate( GetDisplayLayer_Callback, &context );
+
+     if (!context.ret)
+          *interface = iface;
+
+     return context.ret;
+}
+
+static DFBResult
+IDirectFB_EnumInputDevices( IDirectFB              *thiz,
+                            DFBInputDeviceCallback  callbackfunc,
+                            void                   *callbackdata )
+{
+     EnumInputDevices_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!callbackfunc)
+          return DFB_INVARG;
+
+     context.callback     = callbackfunc;
+     context.callback_ctx = callbackdata;
+
+     dfb_input_enumerate_devices( EnumInputDevices_Callback, &context, DICAPS_ALL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_GetInputDevice( IDirectFB             *thiz,
+                          DFBInputDeviceID       id,
+                          IDirectFBInputDevice **interface )
+{
+     IDirectFBInputDevice   *iface;
+     GetInputDevice_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %d )\n", __FUNCTION__, thiz, id );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     context.interface = &iface;
+     context.id        = id;
+     context.ret       = DFB_IDNOTFOUND;
+
+     dfb_input_enumerate_devices( GetInputDevice_Callback, &context, DICAPS_ALL );
+
+     if (!context.ret)
+          *interface = iface;
+
+     return context.ret;
+}
+
+static DFBResult
+IDirectFB_CreateEventBuffer( IDirectFB             *thiz,
+                             IDirectFBEventBuffer **interface)
+{
+     DFBResult             ret;
+     IDirectFBEventBuffer *iface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBEventBuffer );
+
+     ret = IDirectFBEventBuffer_Construct( iface, NULL, NULL );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_CreateInputEventBuffer( IDirectFB                   *thiz,
+                                  DFBInputDeviceCapabilities   caps,
+                                  DFBBoolean                   global,
+                                  IDirectFBEventBuffer       **interface)
+{
+     DFBResult                  ret;
+     IDirectFBEventBuffer      *iface;
+     CreateEventBuffer_Context context;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBEventBuffer );
+
+     ret = IDirectFBEventBuffer_Construct( iface, global ? input_filter_global :
+                                           input_filter_local, data );
+     if (ret)
+          return ret;
+
+     context.caps      = caps;
+     context.interface = &iface;
+
+     dfb_input_enumerate_devices( CreateEventBuffer_Callback, &context, caps );
+
+     *interface = iface;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_CreateImageProvider( IDirectFB               *thiz,
+                               const char              *filename,
+                               IDirectFBImageProvider **interface )
+{
+     DFBResult                 ret;
+     DFBDataBufferDescription  desc;
+     IDirectFBDataBuffer      *databuffer;
+     IDirectFBImageProvider   *iface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, '%s' )\n", __FUNCTION__, thiz, filename );
+
+     /* Check arguments */
+     if (!filename || !interface)
+          return DFB_INVARG;
+
+     /* Create a data buffer. */
+     desc.flags = DBDESC_FILE;
+     desc.file  = filename;
+
+     ret = thiz->CreateDataBuffer( thiz, &desc, &databuffer );
+     if (ret)
+          return ret;
+
+     /* Create (probing) the image provider. */
+     ret = IDirectFBImageProvider_CreateFromBuffer( databuffer, data->core, &iface );
+
+     /* We don't need it anymore, image provider has its own reference. */
+     databuffer->Release( databuffer );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_CreateVideoProvider( IDirectFB               *thiz,
+                               const char              *filename,
+                               IDirectFBVideoProvider **interface )
+{
+     DFBResult                 ret;
+     DFBDataBufferDescription  desc;
+     IDirectFBDataBuffer      *databuffer;
+     IDirectFBVideoProvider   *iface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, '%s' )\n", __FUNCTION__, thiz, filename );
+
+     /* Check arguments */
+     if (!interface || !filename)
+          return DFB_INVARG;
+
+     /* Create a data buffer. */
+     desc.flags = DBDESC_FILE;
+     desc.file  = filename;
+
+     ret = thiz->CreateDataBuffer( thiz, &desc, &databuffer );
+     if (ret)
+          return ret;
+
+     /* Create (probing) the video provider. */
+     ret = IDirectFBVideoProvider_CreateFromBuffer( databuffer, data->core, &iface );
+
+     /* We don't need it anymore, video provider has its own reference. */
+     databuffer->Release( databuffer );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_CreateFont( IDirectFB                 *thiz,
+                      const char                *filename,
+                      const DFBFontDescription  *desc,
+                      IDirectFBFont            **interface )
+{
+     DFBResult                   ret;
+     DFBDataBufferDescription    dbdesc;
+     IDirectFBDataBuffer        *databuffer;
+     IDirectFBFont              *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, '%s' )\n", __FUNCTION__, thiz, filename );
+
+     /* Check arguments */
+     if (!interface)
+          return DFB_INVARG;
+
+     if (desc) {
+          if ((desc->flags & DFDESC_HEIGHT) && desc->height < 1)
+               return DFB_INVARG;
+
+          if ((desc->flags & DFDESC_WIDTH) && desc->width < 1)
+               return DFB_INVARG;
+     }
+
+     if (filename) {
+          if (!desc)
+               return DFB_INVARG;
+
+          if (access( filename, R_OK ) != 0)
+               return errno2result( errno );
+     }
+
+     /* Create a data buffer. */
+     dbdesc.flags = DBDESC_FILE;
+     dbdesc.file  = filename;
+
+     ret = thiz->CreateDataBuffer( thiz, &dbdesc, &databuffer );
+     if (ret)
+          return ret;
+
+     /* Create (probing) the font. */
+     ret = IDirectFBFont_CreateFromBuffer( databuffer, data->core, desc, &font );
+
+     /* We don't need it anymore, font has its own reference. */
+     databuffer->Release( databuffer );
+
+     if (!ret)
+     *interface = font;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_CreateDataBuffer( IDirectFB                       *thiz,
+                            const DFBDataBufferDescription  *desc,
+                            IDirectFBDataBuffer            **interface )
+{
+     DFBResult            ret = DFB_INVARG;
+     IDirectFBDataBuffer *iface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!interface)
+          return DFB_INVARG;
+
+     if (!desc) {
+          DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_Streamed_Construct( iface, data->core );
+     }
+     else if (desc->flags & DBDESC_FILE) {
+          if (!desc->file)
+               return DFB_INVARG;
+
+          DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_File_Construct( iface, desc->file, data->core );
+     }
+     else if (desc->flags & DBDESC_MEMORY) {
+          if (!desc->memory.data || !desc->memory.length)
+               return DFB_INVARG;
+
+          DIRECT_ALLOCATE_INTERFACE( iface, IDirectFBDataBuffer );
+
+          ret = IDirectFBDataBuffer_Memory_Construct( iface,
+                                                      desc->memory.data,
+                                                      desc->memory.length,
+                                                      data->core );
+     }
+     else
+          return DFB_INVARG;
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_SetClipboardData( IDirectFB      *thiz,
+                            const char     *mime_type,
+                            const void     *clip_data,
+                            unsigned int    size,
+                            struct timeval *timestamp )
+{
+     DFBClipboardCore *clip_core;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!mime_type || !data || !size)
+          return DFB_INVARG;
+
+     clip_core = DFB_CORE( data->core, CLIPBOARD );
+     if (!clip_core)
+          return DFB_NOCORE;
+
+     return dfb_clipboard_set( clip_core, mime_type, clip_data, size, timestamp );
+}
+
+static DFBResult
+IDirectFB_GetClipboardData( IDirectFB     *thiz,
+                            char         **mime_type,
+                            void         **clip_data,
+                            unsigned int  *size )
+{
+     DFBClipboardCore *clip_core;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!mime_type && !data && !size)
+          return DFB_INVARG;
+
+     clip_core = DFB_CORE( data->core, CLIPBOARD );
+     if (!clip_core)
+          return DFB_NOCORE;
+
+     return dfb_clipboard_get( clip_core, mime_type, clip_data, size );
+}
+
+static DFBResult
+IDirectFB_GetClipboardTimeStamp( IDirectFB      *thiz,
+                                 struct timeval *timestamp )
+{
+     DFBClipboardCore *clip_core;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!timestamp)
+          return DFB_INVARG;
+
+     clip_core = DFB_CORE( data->core, CLIPBOARD );
+     if (!clip_core)
+          return DFB_NOCORE;
+
+     return dfb_clipboard_get_timestamp( clip_core, timestamp );
+}
+
+static DFBResult
+IDirectFB_Suspend( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     return dfb_core_suspend( data->core );
+}
+
+static DFBResult
+IDirectFB_Resume( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     return dfb_core_resume( data->core );
+}
+
+static DFBResult
+IDirectFB_WaitIdle( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_gfxcard_sync();
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_WaitForSync( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_layer_wait_vsync( data->layer );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFB_GetInterface( IDirectFB   *thiz,
+                        const char  *type,
+                        const char  *implementation,
+                        void        *arg,
+                        void       **interface )
+{
+     DFBResult             ret;
+     DirectInterfaceFuncs *funcs = NULL;
+     void                 *iface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, '%s' )\n", __FUNCTION__, thiz, type );
+
+     if (!type || !interface)
+          return DFB_INVARG;
+
+     ret = DirectGetInterface( &funcs, type, implementation, DirectProbeInterface, arg );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( &iface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( iface, arg, data->core );
+
+     if (!ret)
+          *interface = iface;
+
+     return ret;
+}
+
+static DFBResult
+IDirectFB_RescanInputDevices( IDirectFB *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p )\n", __FUNCTION__, thiz );
+
+     return dfb_input_rescan_devices( data->core );
+}
+
+static void
+LoadBackgroundImage( IDirectFB       *dfb,
+                     CoreWindowStack *stack,
+                     DFBConfigLayer  *conf )
+{
+     DFBResult               ret;
+     DFBSurfaceDescription   desc;
+     IDirectFBImageProvider *provider;
+     IDirectFBSurface       *image;
+     IDirectFBSurface_data  *image_data;
+
+     ret = dfb->CreateImageProvider( dfb, conf->background.filename, &provider );
+     if (ret) {
+          D_DERROR( ret, "Failed loading background image '%s'!\n", conf->background.filename );
+          return;
+     }
+
+     if (conf->background.mode == DLBM_IMAGE) {
+          desc.flags  = DSDESC_WIDTH | DSDESC_HEIGHT;
+          desc.width  = conf->config.width;
+          desc.height = conf->config.height;
+     }
+     else {
+          provider->GetSurfaceDescription( provider, &desc );
+     }
+
+     desc.flags |= DSDESC_CAPS | DSDESC_PIXELFORMAT;
+     desc.caps = DSCAPS_SHARED;
+     desc.pixelformat = conf->config.pixelformat;
+
+     ret = dfb->CreateSurface( dfb, &desc, &image );
+     if (ret) {
+          DirectFBError( "Failed creating surface for background image", ret );
+          provider->Release( provider );
+          return;
+     }
+
+     ret = provider->RenderTo( provider, image, NULL );
+     if (ret) {
+          DirectFBError( "Failed loading background image", ret );
+          image->Release( image );
+          provider->Release( provider );
+          return;
+     }
+
+     provider->Release( provider );
+
+     image_data = (IDirectFBSurface_data*) image->priv;
+
+     dfb_windowstack_set_background_image( stack, image_data->surface );
+
+     image->Release( image );
+}
+
+static DFBResult
+InitLayerPalette( IDirectFB_data    *data,
+                  DFBConfigLayer    *conf,
+                  CoreSurface       *surface,
+                  CorePalette      **ret_palette )
+{
+     DFBResult    ret;
+     CorePalette *palette;
+
+     ret = dfb_palette_create( data->core, 256, &palette );
+     if (ret) {
+          D_DERROR( ret, "InitLayerPalette: Could not create palette!\n" );
+          return ret;
+     }
+
+     direct_memcpy( palette->entries, conf->palette, sizeof(DFBColor) * 256 );
+
+     ret = dfb_surface_set_palette( surface, palette );
+     if (ret) {
+          D_DERROR( ret, "InitLayerPalette: Could not set palette!\n" );
+          dfb_palette_unref( palette );
+          return ret;
+     }
+
+     *ret_palette = palette;
+
+     return DFB_OK;
+}
+
+static DFBResult
+InitLayers( IDirectFB      *dfb,
+            IDirectFB_data *data )
+{
+     DFBResult ret;
+     int       i;
+     int       num = dfb_layer_num();
+
+     for (i=0; i<num; i++) {
+          CoreLayer      *layer = dfb_layer_at_translated( i );
+          DFBConfigLayer *conf  = &dfb_config->layers[i];
+
+          if (conf->init) {
+               CoreLayerContext           *context;
+               CoreWindowStack            *stack;
+               CardCapabilities            caps;
+               DFBDisplayLayerConfigFlags  fail;
+
+               ret = dfb_layer_get_primary_context( layer, false, &context );
+               if (ret) {
+                    D_DERROR( ret, "InitLayers: Could not get context of layer %d!\n", i );
+                    goto error;
+               }
+
+               stack = dfb_layer_context_windowstack( context );
+               D_ASSERT( stack != NULL );
+
+
+               /* set default desktop configuration */
+               if (!(conf->config.flags & DLCONF_BUFFERMODE)) {
+                    dfb_gfxcard_get_capabilities( &caps );
+
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+                    conf->config.buffermode = (caps.accel & DFXL_BLIT) ? DLBM_BACKVIDEO : DLBM_BACKSYSTEM;
+               }
+
+               if (dfb_layer_context_test_configuration( context, &conf->config, &fail )) {
+                    if (fail & (DLCONF_WIDTH | DLCONF_HEIGHT)) {
+                         D_ERROR( "DirectFB/DirectFBCreate: "
+                                  "Setting desktop resolution to %dx%d failed!\n"
+                                  "     -> Using default resolution.\n",
+                                  conf->config.width, conf->config.height );
+
+                         conf->config.flags &= ~(DLCONF_WIDTH | DLCONF_HEIGHT);
+                    }
+
+                    if (fail & DLCONF_PIXELFORMAT) {
+                         D_ERROR( "DirectFB/DirectFBCreate: "
+                                  "Setting desktop format failed!\n"
+                                  "     -> Using default format.\n" );
+
+                         conf->config.flags &= ~DLCONF_PIXELFORMAT;
+                    }
+
+                    if (fail & DLCONF_BUFFERMODE) {
+                         D_ERROR( "DirectFB/DirectFBCreate: "
+                                  "Setting desktop buffer mode failed!\n"
+                                  "     -> No virtual resolution support or not enough memory?\n"
+                                  "        Falling back to system back buffer.\n" );
+
+                         conf->config.buffermode = DLBM_BACKSYSTEM;
+
+                         if (dfb_layer_context_test_configuration( context, &conf->config, &fail )) {
+                              D_ERROR( "DirectFB/DirectFBCreate: "
+                                       "Setting system memory desktop back buffer failed!\n"
+                                       "     -> Using front buffer only mode.\n" );
+
+                              conf->config.flags &= ~DLCONF_BUFFERMODE;
+                         }
+                    }
+               }
+
+               if (conf->config.flags) {
+                    ret = dfb_layer_context_set_configuration( context, &conf->config );
+                    if (ret) {
+                         D_DERROR( ret, "InitLayers: Could not set configuration for layer %d!\n", i );
+                         dfb_layer_context_unref( context );
+                         goto error;
+                    }
+               }
+
+               ret = dfb_layer_context_get_configuration( context, &conf->config );
+               D_ASSERT( ret == DFB_OK );
+
+               ret = dfb_layer_context_get_primary_region( context, true, &data->layers[i].region );
+               if (ret) {
+                    D_DERROR( ret, "InitLayers: Could not get primary region of layer %d!\n", i );
+                    dfb_layer_context_unref( context );
+                    goto error;
+               }
+
+               ret = dfb_layer_region_get_surface( data->layers[i].region, &data->layers[i].surface );
+               if (ret) {
+                    D_DERROR( ret, "InitLayers: Could not get surface of primary region of layer %d!\n", i );
+                    dfb_layer_region_unref( data->layers[i].region );
+                    dfb_layer_context_unref( context );
+                    goto error;
+               }
+
+               if (conf->palette_set)
+                    InitLayerPalette( data, conf, data->layers[i].surface, &data->layers[i].palette );
+
+               if (conf->src_key_index >= 0 && conf->src_key_index < D_ARRAY_SIZE(conf->palette)) {
+                    dfb_layer_context_set_src_colorkey( context,
+                                                        conf->palette[conf->src_key_index].r,
+                                                        conf->palette[conf->src_key_index].g,
+                                                        conf->palette[conf->src_key_index].b,
+                                                        conf->src_key_index );
+               }
+               else
+                    dfb_layer_context_set_src_colorkey( context, conf->src_key.r, conf->src_key.g, conf->src_key.b, -1 );
+
+               switch (conf->background.mode) {
+                    case DLBM_COLOR:
+                         dfb_windowstack_set_background_color( stack, &conf->background.color );
+                         dfb_windowstack_set_background_color_index( stack, conf->background.color_index );
+                         break;
+
+                    case DLBM_IMAGE:
+                    case DLBM_TILE:
+                         LoadBackgroundImage( dfb, stack, conf );
+                         break;
+
+                    default:
+                         break;
+               }
+
+               dfb_windowstack_set_background_mode( stack, conf->background.mode );
+
+               data->layers[i].context = context;
+          }
+
+          data->layers[i].layer = layer;
+     }
+
+     for (i=0; i<num; i++) {
+          if (data->layers[i].context)
+               dfb_layer_activate_context( data->layers[i].layer, data->layers[i].context );
+     }
+
+     return DFB_OK;
+
+error:
+     for (i=num-1; i>=0; i--) {
+          if (data->layers[i].context) {
+               if (data->layers[i].palette)
+                    dfb_palette_unref( data->layers[i].palette );
+
+               dfb_surface_unref( data->layers[i].surface );
+               dfb_layer_region_unref( data->layers[i].region );
+               dfb_layer_context_unref( data->layers[i].context );
+
+               data->layers[i].context = NULL;
+          }
+     }
+
+     return ret;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+DFBResult
+IDirectFB_Construct( IDirectFB *thiz, CoreDFB *core )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %p )\n", __FUNCTION__, thiz, core );
+
+     data->ref   = 1;
+     data->core  = core;
+     data->level = DFSCL_NORMAL;
+
+     if (dfb_layer_num() < 1) {
+          D_ERROR( "%s: No layers available! Missing driver?\n", __FUNCTION__ );
+          return DFB_UNSUPPORTED;
+     }
+
+     data->layer = dfb_layer_at_translated( DLID_PRIMARY );
+
+     ret = dfb_layer_get_primary_context( data->layer, true, &data->context );
+     if (ret) {
+          D_ERROR( "%s: Could not get default context of primary layer!\n", __FUNCTION__ );
+          DIRECT_DEALLOCATE_INTERFACE(thiz);
+          return ret;
+     }
+
+     data->stack = dfb_layer_context_windowstack( data->context );
+
+     thiz->AddRef = IDirectFB_AddRef;
+     thiz->Release = IDirectFB_Release;
+     thiz->SetCooperativeLevel = IDirectFB_SetCooperativeLevel;
+     thiz->GetDeviceDescription = IDirectFB_GetDeviceDescription;
+     thiz->EnumVideoModes = IDirectFB_EnumVideoModes;
+     thiz->SetVideoMode = IDirectFB_SetVideoMode;
+     thiz->CreateSurface = IDirectFB_CreateSurface;
+     thiz->CreatePalette = IDirectFB_CreatePalette;
+     thiz->EnumScreens = IDirectFB_EnumScreens;
+     thiz->GetScreen = IDirectFB_GetScreen;
+     thiz->EnumDisplayLayers = IDirectFB_EnumDisplayLayers;
+     thiz->GetDisplayLayer = IDirectFB_GetDisplayLayer;
+     thiz->EnumInputDevices = IDirectFB_EnumInputDevices;
+     thiz->GetInputDevice = IDirectFB_GetInputDevice;
+     thiz->CreateEventBuffer = IDirectFB_CreateEventBuffer;
+     thiz->CreateInputEventBuffer = IDirectFB_CreateInputEventBuffer;
+     thiz->CreateImageProvider = IDirectFB_CreateImageProvider;
+     thiz->CreateVideoProvider = IDirectFB_CreateVideoProvider;
+     thiz->CreateFont = IDirectFB_CreateFont;
+     thiz->CreateDataBuffer = IDirectFB_CreateDataBuffer;
+     thiz->SetClipboardData = IDirectFB_SetClipboardData;
+     thiz->GetClipboardData = IDirectFB_GetClipboardData;
+     thiz->GetClipboardTimeStamp = IDirectFB_GetClipboardTimeStamp;
+     thiz->Suspend = IDirectFB_Suspend;
+     thiz->Resume = IDirectFB_Resume;
+     thiz->WaitIdle = IDirectFB_WaitIdle;
+     thiz->WaitForSync = IDirectFB_WaitForSync;
+     thiz->GetInterface = IDirectFB_GetInterface;
+     thiz->RescanInputDevices = IDirectFB_RescanInputDevices;
+
+     if (dfb_core_is_master( core )) {
+          ret = InitLayers( thiz, data );
+          if (ret) {
+               dfb_layer_context_unref( data->context );
+               DIRECT_DEALLOCATE_INTERFACE(thiz);
+               return ret;
+          }
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+IDirectFB_SetAppFocus( IDirectFB *thiz, DFBBoolean focused )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFB)
+
+     D_DEBUG_AT( IDFB, "%s( %p, %s )\n", __FUNCTION__, thiz, focused ? "true" : "false" );
+
+     data->app_focus = focused;
+
+     return DFB_OK;
+}
+
+/*
+ * internal functions
+ */
+
+static DFBEnumerationResult
+EnumScreens_Callback( CoreScreen *screen, void *ctx )
+{
+     DFBScreenDescription  desc;
+     DFBScreenID           id;
+     EnumScreens_Context  *context = (EnumScreens_Context*) ctx;
+
+     id = dfb_screen_id_translated( screen );
+
+     if (dfb_config->primary_only && id != DSCID_PRIMARY)
+          return DFENUM_OK;
+
+     dfb_screen_get_info( screen, NULL, &desc );
+
+     return context->callback( id, desc, context->callback_ctx );
+}
+
+static DFBEnumerationResult
+GetScreen_Callback( CoreScreen *screen, void *ctx )
+{
+     GetScreen_Context *context = (GetScreen_Context*) ctx;
+
+     if (dfb_screen_id_translated( screen ) != context->id)
+          return DFENUM_OK;
+
+     DIRECT_ALLOCATE_INTERFACE( *context->interface, IDirectFBScreen );
+
+     context->ret = IDirectFBScreen_Construct( *context->interface, screen );
+
+     return DFENUM_CANCEL;
+}
+
+static DFBEnumerationResult
+EnumDisplayLayers_Callback( CoreLayer *layer, void *ctx )
+{
+     DFBDisplayLayerDescription  desc;
+     DFBDisplayLayerID           id;
+     EnumDisplayLayers_Context  *context = (EnumDisplayLayers_Context*) ctx;
+
+     id = dfb_layer_id_translated( layer );
+
+     if (dfb_config->primary_only && id != DLID_PRIMARY)
+          return DFENUM_OK;
+
+     dfb_layer_get_description( layer, &desc );
+
+     return context->callback( id, desc, context->callback_ctx );
+}
+
+static DFBEnumerationResult
+GetDisplayLayer_Callback( CoreLayer *layer, void *ctx )
+{
+     GetDisplayLayer_Context *context = (GetDisplayLayer_Context*) ctx;
+
+     if (dfb_layer_id_translated( layer ) != context->id)
+          return DFENUM_OK;
+
+     DIRECT_ALLOCATE_INTERFACE( *context->interface, IDirectFBDisplayLayer );
+
+     context->ret = IDirectFBDisplayLayer_Construct( *context->interface,
+                                                     layer, context->core );
+
+     return DFENUM_CANCEL;
+}
+
+static DFBEnumerationResult
+EnumInputDevices_Callback( CoreInputDevice *device, void *ctx )
+{
+     DFBInputDeviceDescription  desc;
+     EnumInputDevices_Context  *context = (EnumInputDevices_Context*) ctx;
+
+     dfb_input_device_description( device, &desc );
+
+     return context->callback( dfb_input_device_id( device ), desc,
+                               context->callback_ctx );
+}
+
+static DFBEnumerationResult
+GetInputDevice_Callback( CoreInputDevice *device, void *ctx )
+{
+     GetInputDevice_Context *context = (GetInputDevice_Context*) ctx;
+
+     if (dfb_input_device_id( device ) != context->id)
+          return DFENUM_OK;
+
+     DIRECT_ALLOCATE_INTERFACE( *context->interface, IDirectFBInputDevice );
+
+     context->ret = IDirectFBInputDevice_Construct( *context->interface, device );
+
+     return DFENUM_CANCEL;
+}
+
+static DFBEnumerationResult
+CreateEventBuffer_Callback( CoreInputDevice *device, void *ctx )
+{
+     DFBInputDeviceDescription   desc;
+     CreateEventBuffer_Context  *context = (CreateEventBuffer_Context*) ctx;
+
+     dfb_input_device_description( device, &desc );
+
+     IDirectFBEventBuffer_AttachInputDevice( *context->interface, device );
+
+     return DFENUM_OK;
+}
+
+static ReactionResult
+focus_listener( const void *msg_data,
+                void       *ctx )
+{
+     const DFBWindowEvent *evt  = msg_data;
+     IDirectFB_data       *data = ctx;
+
+     switch (evt->type) {
+          case DWET_DESTROYED:
+               dfb_window_unref( data->primary.window );
+               data->primary.window = NULL;
+               data->primary.focused = false;
+               return RS_REMOVE;
+
+          case DWET_GOTFOCUS:
+               data->primary.focused = true;
+               break;
+
+          case DWET_LOSTFOCUS:
+               data->primary.focused = false;
+               break;
+
+          default:
+               break;
+     }
+
+     return RS_OK;
+}
+
+static bool
+input_filter_local( DFBEvent *evt,
+                    void     *ctx )
+{
+     IDirectFB_data *data = (IDirectFB_data*) ctx;
+
+     if (evt->clazz == DFEC_INPUT) {
+          DFBInputEvent *event = &evt->input;
+
+          if (!data->primary.focused && !data->app_focus)
+               return true;
+
+          switch (event->type) {
+               case DIET_BUTTONPRESS:
+                    if (data->primary.window)
+                         dfb_windowstack_cursor_enable( data->core, data->stack, false );
+                    break;
+               case DIET_KEYPRESS:
+                    if (data->primary.window)
+                         dfb_windowstack_cursor_enable( data->core, data->stack,
+                                                        (event->key_symbol ==
+                                                         DIKS_ESCAPE) ||
+                                                        (event->modifiers &
+                                                         DIMM_META) );
+                    break;
+               default:
+                    break;
+          }
+     }
+
+     return false;
+}
+
+static bool
+input_filter_global( DFBEvent *evt,
+                     void     *ctx )
+{
+     IDirectFB_data *data = (IDirectFB_data*) ctx;
+
+     if (evt->clazz == DFEC_INPUT) {
+          DFBInputEvent *event = &evt->input;
+
+          if (!data->primary.focused && !data->app_focus)
+               event->flags |= DIEF_GLOBAL;
+     }
+
+     return false;
+}
+
+static void
+drop_window( IDirectFB_data *data )
+{
+     if (!data->primary.window)
+          return;
+
+     dfb_window_detach( data->primary.window, &data->primary.reaction );
+     dfb_window_unref( data->primary.window );
+
+     data->primary.window  = NULL;
+     data->primary.focused = false;
+
+     dfb_windowstack_cursor_enable( data->core, data->stack, true );
+}
+
diff --git a/Source/DirectFB/src/idirectfb.h b/Source/DirectFB/src/idirectfb.h
new file mode 100755
index 0000000..0d5f4d8
--- /dev/null
+++ b/Source/DirectFB/src/idirectfb.h
@@ -0,0 +1,89 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFB_H__
+#define __IDIRECTFB_H__
+
+#include <directfb.h>
+
+#include <fusion/reactor.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+/*
+ * private data struct of IDirectFB
+ */
+typedef struct {
+     int                         ref;      /* reference counter */
+     CoreDFB                    *core;
+
+     DFBCooperativeLevel         level;    /* current cooperative level */
+
+     CoreLayer                  *layer;    /* primary display layer */
+     CoreLayerContext           *context;  /* shared context of primary layer */
+     CoreWindowStack            *stack;    /* window stack of primary layer */
+
+     struct {
+          int                    width;    /* IDirectFB stores window width    */
+          int                    height;   /* and height and the pixel depth   */
+          DFBSurfacePixelFormat  format;   /* from SetVideoMode() parameters.  */
+
+          CoreWindow            *window;   /* implicitly created window */
+          Reaction               reaction; /* for the focus listener */
+          bool                   focused;  /* primary's window has the focus */
+
+          CoreLayerContext      *context;  /* context for fullscreen primary */
+     } primary;                            /* Used for DFSCL_NORMAL's primary. */
+
+     bool                        app_focus;
+
+     struct {
+          CoreLayer             *layer;
+          CoreLayerContext      *context;
+          CoreLayerRegion       *region;
+          CoreSurface           *surface;
+          CorePalette           *palette;
+     } layers[MAX_LAYERS];
+} IDirectFB_data;
+
+/*
+ * IDirectFB constructor/destructor
+ */
+DFBResult IDirectFB_Construct  ( IDirectFB  *thiz,
+                                 CoreDFB    *core );
+
+void      IDirectFB_Destruct   ( IDirectFB  *thiz );
+
+DFBResult IDirectFB_SetAppFocus( IDirectFB  *thiz,
+                                 DFBBoolean  focused );
+
+
+extern IDirectFB *idirectfb_singleton;
+
+#endif
diff --git a/Source/DirectFB/src/input/Makefile.am b/Source/DirectFB/src/input/Makefile.am
new file mode 100755
index 0000000..b80f078
--- /dev/null
+++ b/Source/DirectFB/src/input/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for DirectFB/src/input
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/input
+
+internalinclude_HEADERS = \
+	idirectfbinputdevice.h	\
+	idirectfbinputbuffer.h
+
+
+noinst_LTLIBRARIES = libdirectfb_input.la
+
+libdirectfb_input_la_SOURCES = \
+	idirectfbinputdevice.c	\
+	idirectfbinputbuffer.c
diff --git a/Source/DirectFB/src/input/Makefile.in b/Source/DirectFB/src/input/Makefile.in
new file mode 100755
index 0000000..2873417
--- /dev/null
+++ b/Source/DirectFB/src/input/Makefile.in
@@ -0,0 +1,556 @@
+# 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@
+subdir = src/input
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_input_la_LIBADD =
+am_libdirectfb_input_la_OBJECTS = idirectfbinputdevice.lo \
+	idirectfbinputbuffer.lo
+libdirectfb_input_la_OBJECTS = $(am_libdirectfb_input_la_OBJECTS)
+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_input_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_input_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/input
+internalinclude_HEADERS = \
+	idirectfbinputdevice.h	\
+	idirectfbinputbuffer.h
+
+noinst_LTLIBRARIES = libdirectfb_input.la
+libdirectfb_input_la_SOURCES = \
+	idirectfbinputdevice.c	\
+	idirectfbinputbuffer.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/input/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/input/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_input.la: $(libdirectfb_input_la_OBJECTS) $(libdirectfb_input_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_input_la_OBJECTS) $(libdirectfb_input_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbinputbuffer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbinputdevice.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/input/idirectfbinputbuffer.c b/Source/DirectFB/src/input/idirectfbinputbuffer.c
new file mode 100755
index 0000000..6a4cf08
--- /dev/null
+++ b/Source/DirectFB/src/input/idirectfbinputbuffer.c
@@ -0,0 +1,1121 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <sys/time.h>
+#include <sys/socket.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <fusion/reactor.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/windows.h>
+#include <core/windows_internal.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include "idirectfbinputbuffer.h"
+
+
+D_DEBUG_DOMAIN( IDFBEvBuf, "IDFBEventBuffer", "IDirectFBEventBuffer Interface" );
+
+
+typedef struct {
+     DirectLink   link;
+     DFBEvent     evt;
+} EventBufferItem;
+
+typedef struct {
+     DirectLink       link;
+
+     CoreInputDevice *device;       /* pointer to input core device struct */
+     Reaction         reaction;
+     
+     DFBInputDeviceDescription desc;
+} AttachedDevice;
+
+typedef struct {
+     DirectLink   link;
+
+     CoreWindow  *window;       /* pointer to core window struct */
+     Reaction     reaction;
+} AttachedWindow;
+
+/*
+ * private data struct of IDirectFBInputDevice
+ */
+typedef struct {
+     int                           ref;            /* reference counter */
+
+     EventBufferFilterCallback     filter;
+     void                         *filter_ctx;
+
+     DirectLink                   *devices;        /* attached devices */
+
+     DirectLink                   *windows;        /* attached windows */
+
+     DirectLink                   *events;         /* linked list containing events */
+
+     pthread_mutex_t               events_mutex;   /* mutex lock for accessing the event queue */
+
+     pthread_cond_t                wait_condition; /* condition for idle wait in WaitForEvent() */
+
+     bool                          pipe;           /* file descriptor mode? */
+     int                           pipe_fds[2];    /* read & write file descriptor */
+
+     DirectThread                 *pipe_thread;    /* thread feeding the pipe */
+
+     DFBEventBufferStats           stats;
+     bool                          stats_enabled;
+} IDirectFBEventBuffer_data;
+
+/*
+ * adds an event to the event queue
+ */
+static void IDirectFBEventBuffer_AddItem( IDirectFBEventBuffer_data *data,
+                                          EventBufferItem           *item );
+
+#ifndef DIRECTFB_PURE_VOODOO
+static ReactionResult IDirectFBEventBuffer_InputReact( const void *msg_data,
+                                                       void       *ctx );
+
+static ReactionResult IDirectFBEventBuffer_WindowReact( const void *msg_data,
+                                                        void       *ctx );
+#endif
+
+static void *IDirectFBEventBuffer_Feed( DirectThread *thread, void *arg );
+
+static void CollectEventStatistics( DFBEventBufferStats *stats,
+                                    const DFBEvent      *event,
+                                    int                  incdec );
+
+
+static void
+IDirectFBEventBuffer_Destruct( IDirectFBEventBuffer *thiz )
+{
+     IDirectFBEventBuffer_data *data = thiz->priv;
+     AttachedDevice            *device;
+     AttachedWindow            *window;
+     EventBufferItem           *item;
+     DirectLink                *n;
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     if (data->pipe) {
+          data->pipe = false;
+
+          pthread_cond_broadcast( &data->wait_condition );
+
+          pthread_mutex_unlock( &data->events_mutex );
+
+          direct_thread_join( data->pipe_thread );
+          direct_thread_destroy( data->pipe_thread );
+
+          pthread_mutex_lock( &data->events_mutex );
+
+          close( data->pipe_fds[0] );
+          close( data->pipe_fds[1] );
+     }
+
+#ifndef DIRECTFB_PURE_VOODOO
+     direct_list_foreach_safe (device, n, data->devices) {
+          dfb_input_detach( device->device, &device->reaction );
+
+          D_FREE( device );
+     }
+
+     direct_list_foreach_safe (window, n, data->windows) {
+          if (window->window) {
+               dfb_window_detach( window->window, &window->reaction );
+               dfb_window_unref( window->window );
+          }
+               
+          D_FREE( window );
+     }
+#endif
+
+     direct_list_foreach_safe (item, n, data->events)
+          D_FREE( item );
+
+     pthread_cond_destroy( &data->wait_condition );
+     pthread_mutex_destroy( &data->events_mutex );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBEventBuffer_AddRef( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBEventBuffer_Release( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->ref == 0)
+          IDirectFBEventBuffer_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_Reset( IDirectFBEventBuffer *thiz )
+{
+     EventBufferItem *item;
+     DirectLink      *n;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     direct_list_foreach_safe (item, n, data->events)
+          D_FREE( item );
+
+     data->events = NULL;
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_WaitForEvent( IDirectFBEventBuffer *thiz )
+{
+     DFBResult ret = DFB_OK;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     if (!data->events)
+          pthread_cond_wait( &data->wait_condition, &data->events_mutex );
+     if (!data->events)
+          ret = DFB_INTERRUPTED;
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBEventBuffer_WaitForEventWithTimeout( IDirectFBEventBuffer *thiz,
+                                              unsigned int          seconds,
+                                              unsigned int          milli_seconds )
+{
+     struct timespec timeout;
+     DFBResult       ret    = DFB_OK;
+     int             locked = 0;
+     long int        nano_seconds = milli_seconds * 1000000;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %u, %u )\n", __FUNCTION__, thiz, seconds, milli_seconds );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     if (pthread_mutex_trylock( &data->events_mutex ) == 0) {
+          if (data->events) {
+               pthread_mutex_unlock ( &data->events_mutex );
+               return ret;
+          }
+          locked = 1;
+     }
+
+     direct_util_get_monotonic_pthread_timeout(&timeout, seconds, nano_seconds);
+
+     if (!locked)
+          pthread_mutex_lock( &data->events_mutex );
+
+     if (!data->events) {
+          if (pthread_cond_timedwait( &data->wait_condition,
+                                      &data->events_mutex,
+                                      &timeout ) == ETIMEDOUT)
+               ret = DFB_TIMEOUT;
+          else if (!data->events)
+               ret = DFB_INTERRUPTED;
+     }
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBEventBuffer_WakeUp( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     pthread_cond_broadcast( &data->wait_condition );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_GetEvent( IDirectFBEventBuffer *thiz,
+                               DFBEvent             *event )
+{
+     EventBufferItem *item;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p )\n", __FUNCTION__, thiz, event );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     if (!data->events) {
+          pthread_mutex_unlock( &data->events_mutex );
+          return DFB_BUFFEREMPTY;
+     }
+
+     item = (EventBufferItem*) data->events;
+
+     switch (item->evt.clazz) {
+          case DFEC_INPUT:
+               event->input = item->evt.input;
+               break;
+
+          case DFEC_WINDOW:
+               event->window = item->evt.window;
+               break;
+
+          case DFEC_USER:
+               event->user = item->evt.user;
+               break;
+
+          case DFEC_VIDEOPROVIDER:
+               event->videoprovider = item->evt.videoprovider;
+               break;
+
+          case DFEC_UNIVERSAL:
+               direct_memcpy( event, &item->evt, item->evt.universal.size );
+               break;
+
+          default:
+               D_BUG("unknown event class");
+     }
+
+     if (data->stats_enabled)
+          CollectEventStatistics( &data->stats, &item->evt, -1 );
+
+     direct_list_remove( &data->events, &item->link );
+
+     D_FREE( item );
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     D_DEBUG_AT( IDFBEvBuf, "  -> class %d, type/size %d, data/id %p\n", event->clazz, event->user.type, event->user.data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_PeekEvent( IDirectFBEventBuffer *thiz,
+                                DFBEvent             *event )
+{
+     EventBufferItem *item;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p )\n", __FUNCTION__, thiz, event );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     if (!data->events) {
+          pthread_mutex_unlock( &data->events_mutex );
+          return DFB_BUFFEREMPTY;
+     }
+
+     item = (EventBufferItem*) data->events;
+
+     switch (item->evt.clazz) {
+          case DFEC_INPUT:
+               event->input = item->evt.input;
+               break;
+
+          case DFEC_WINDOW:
+               event->window = item->evt.window;
+               break;
+
+          case DFEC_USER:
+               event->user = item->evt.user;
+               break;
+
+          case DFEC_VIDEOPROVIDER:
+               event->videoprovider = item->evt.videoprovider;
+               break;
+
+          case DFEC_UNIVERSAL:
+               direct_memcpy( event, &item->evt, item->evt.universal.size );
+               break;
+
+          default:
+               D_BUG("unknown event class");
+     }
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     D_DEBUG_AT( IDFBEvBuf, "  -> class %d, type/size %d, data/id %p\n", event->clazz, event->user.type, event->user.data );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_HasEvent( IDirectFBEventBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p ) <- events: %p, pipe: %d\n", __FUNCTION__, thiz, data->events, data->pipe );
+
+     if (data->pipe)
+          return DFB_UNSUPPORTED;
+
+     return (data->events ? DFB_OK : DFB_BUFFEREMPTY);
+}
+
+static DFBResult
+IDirectFBEventBuffer_PostEvent( IDirectFBEventBuffer *thiz,
+                                const DFBEvent       *event )
+{
+     EventBufferItem *item;
+     int              size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p [class %d, type/size %d, data/id %p] )\n", __FUNCTION__,
+                 thiz, event, event->clazz, event->user.type, event->user.data );
+
+     switch (event->clazz) {
+          case DFEC_INPUT:
+          case DFEC_WINDOW:
+          case DFEC_USER:
+          case DFEC_VIDEOPROVIDER:
+               size = sizeof(EventBufferItem);
+               break;
+
+          case DFEC_UNIVERSAL:
+               size = event->universal.size;
+               if (size < sizeof(DFBUniversalEvent))
+                    return DFB_INVARG;
+               /* We must not exceed the union to avoid crashes in generic code (reading DFBEvents)
+                * and to support pipe mode where each written block has to have a fixed size. */
+               if (size > sizeof(DFBEvent))
+                    return DFB_INVARG;
+               size += sizeof(DirectLink);
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     item = D_CALLOC( 1, size );
+     if (!item)
+          return D_OOM();
+
+     switch (event->clazz) {
+          case DFEC_INPUT:
+               item->evt.input = event->input;
+               break;
+
+          case DFEC_WINDOW:
+               item->evt.window = event->window;
+               break;
+
+          case DFEC_USER:
+               item->evt.user = event->user;
+               break;
+
+          case DFEC_VIDEOPROVIDER:
+               item->evt.videoprovider = event->videoprovider;
+               break;
+
+          case DFEC_UNIVERSAL:
+               direct_memcpy( &item->evt, event, event->universal.size );
+               break;
+
+          default:
+               D_BUG("unexpected event class");
+     }
+
+     IDirectFBEventBuffer_AddItem( data, item );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_CreateFileDescriptor( IDirectFBEventBuffer *thiz,
+                                           int                  *ret_fd )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p )\n", __FUNCTION__, thiz );
+
+     /* Check arguments. */
+     if (!ret_fd)
+          return DFB_INVARG;
+
+     /* Lock the event queue. */
+     pthread_mutex_lock( &data->events_mutex );
+
+     /* Already in pipe mode? */
+     if (data->pipe) {
+          pthread_mutex_unlock( &data->events_mutex );
+          return DFB_BUSY;
+     }
+
+     /* Create the file descriptor(s). */
+     if (socketpair( PF_LOCAL, SOCK_STREAM, 0, data->pipe_fds )) {
+          D_PERROR( "%s(): socketpair( PF_LOCAL, SOCK_STREAM, 0, fds ) failed!\n", __FUNCTION__ );
+          pthread_mutex_unlock( &data->events_mutex );
+          return errno2result( errno );
+     }
+
+     D_DEBUG_AT( IDFBEvBuf, "  -> entering pipe mode\n" );
+
+     /* Enter pipe mode. */
+     data->pipe = true;
+
+     /* Signal any waiting processes. */
+     pthread_cond_broadcast( &data->wait_condition );
+
+     /* Create the feeding thread. */
+     data->pipe_thread = direct_thread_create( DTT_MESSAGING,
+                                               IDirectFBEventBuffer_Feed, data,
+                                               "EventBufferFeed" );
+
+     /* Unlock the event queue. */
+     pthread_mutex_unlock( &data->events_mutex );
+
+     /* Return the file descriptor for reading. */
+     *ret_fd = data->pipe_fds[0];
+
+     D_DEBUG_AT( IDFBEvBuf, "  -> fd %d/%d\n", data->pipe_fds[0], data->pipe_fds[1] );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_EnableStatistics( IDirectFBEventBuffer *thiz,
+                                       DFBBoolean            enable )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %sable )\n", __FUNCTION__, thiz, enable ? "en" : "dis" );
+
+     /* Lock the event queue. */
+     pthread_mutex_lock( &data->events_mutex );
+
+     /* Already enabled/disabled? */
+     if (data->stats_enabled == !!enable) {
+          pthread_mutex_unlock( &data->events_mutex );
+          return DFB_OK;
+     }
+
+     if (enable) {
+          EventBufferItem *item;
+
+          /* Collect statistics for events already in the queue. */
+          direct_list_foreach (item, data->events)
+               CollectEventStatistics( &data->stats, &item->evt, 1 );
+     }
+     else {
+          /* Clear statistics. */
+          memset( &data->stats, 0, sizeof(DFBEventBufferStats) );
+     }
+
+     /* Remember state. */
+     data->stats_enabled = !!enable;
+
+     /* Unlock the event queue. */
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBEventBuffer_GetStatistics( IDirectFBEventBuffer *thiz,
+                                    DFBEventBufferStats  *ret_stats )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p )\n", __FUNCTION__, thiz, ret_stats );
+
+     if (!ret_stats)
+          return DFB_INVARG;
+
+     /* Lock the event queue. */
+     pthread_mutex_lock( &data->events_mutex );
+
+     /* Not enabled? */
+     if (!data->stats_enabled) {
+          pthread_mutex_unlock( &data->events_mutex );
+          return DFB_UNSUPPORTED;
+     }
+
+     /* Return current stats. */
+     *ret_stats = data->stats;
+
+     /* Unlock the event queue. */
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return DFB_OK;
+}
+
+DFBResult
+IDirectFBEventBuffer_Construct( IDirectFBEventBuffer      *thiz,
+                                EventBufferFilterCallback  filter,
+                                void                      *filter_ctx )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBEventBuffer)
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, filter %p, ctx %p )\n", __FUNCTION__, thiz, filter, filter_ctx );
+
+     data->ref        = 1;
+     data->filter     = filter;
+     data->filter_ctx = filter_ctx;
+
+     direct_util_recursive_pthread_mutex_init( &data->events_mutex );
+     direct_util_monotonic_pthread_cond_init( &data->wait_condition );
+
+     thiz->AddRef                  = IDirectFBEventBuffer_AddRef;
+     thiz->Release                 = IDirectFBEventBuffer_Release;
+     thiz->Reset                   = IDirectFBEventBuffer_Reset;
+     thiz->WaitForEvent            = IDirectFBEventBuffer_WaitForEvent;
+     thiz->WaitForEventWithTimeout = IDirectFBEventBuffer_WaitForEventWithTimeout;
+     thiz->GetEvent                = IDirectFBEventBuffer_GetEvent;
+     thiz->PeekEvent               = IDirectFBEventBuffer_PeekEvent;
+     thiz->HasEvent                = IDirectFBEventBuffer_HasEvent;
+     thiz->PostEvent               = IDirectFBEventBuffer_PostEvent;
+     thiz->WakeUp                  = IDirectFBEventBuffer_WakeUp;
+     thiz->CreateFileDescriptor    = IDirectFBEventBuffer_CreateFileDescriptor;
+     thiz->EnableStatistics        = IDirectFBEventBuffer_EnableStatistics;
+     thiz->GetStatistics           = IDirectFBEventBuffer_GetStatistics;
+
+     D_DEBUG_AT( IDFBEvBuf, "  -> %p [%p]\n", thiz, thiz->priv );
+
+     return DFB_OK;
+}
+
+/* directfb internals */
+
+#ifndef DIRECTFB_PURE_VOODOO
+DFBResult IDirectFBEventBuffer_AttachInputDevice( IDirectFBEventBuffer *thiz,
+                                                  CoreInputDevice      *device )
+{
+     AttachedDevice            *attached;
+     DFBInputDeviceDescription  desc;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_ASSERT( device != NULL );
+
+     dfb_input_device_description( device, &desc );
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p [%02u - %s] )\n", __FUNCTION__, thiz, device,
+                 dfb_input_device_id(device), desc.name );
+
+     attached = D_CALLOC( 1, sizeof(AttachedDevice) );
+     attached->device = device;
+     attached->desc   = desc;
+
+     direct_list_prepend( &data->devices, &attached->link );
+
+     dfb_input_attach( device, IDirectFBEventBuffer_InputReact,
+                       data, &attached->reaction );
+
+     return DFB_OK;
+}
+
+DFBResult IDirectFBEventBuffer_DetachInputDevice( IDirectFBEventBuffer *thiz,
+                                                  CoreInputDevice      *device )
+{
+     AttachedDevice *attached;
+     DirectLink     *link;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_ASSERT( device != NULL );
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p [%02u] )\n", __FUNCTION__, thiz, device,
+                 dfb_input_device_id(device) );
+     
+     direct_list_foreach_safe (attached, link, data->devices) {
+          if (attached->device == device) {
+               direct_list_remove( &data->devices, &attached->link );
+               
+               dfb_input_detach( attached->device, &attached->reaction );
+               
+               D_FREE( attached );
+               
+               return DFB_OK;
+          }
+     }
+
+     return DFB_ITEMNOTFOUND;
+}
+
+DFBResult IDirectFBEventBuffer_AttachWindow( IDirectFBEventBuffer *thiz,
+                                             CoreWindow           *window )
+{
+     AttachedWindow *attached;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_ASSERT( window != NULL );
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p [%02u - %d,%d-%dx%d] )\n", __FUNCTION__, thiz,
+                 window, window->id, window->config.bounds.x, window->config.bounds.y,
+                 window->config.bounds.w, window->config.bounds.h );
+
+     attached = D_CALLOC( 1, sizeof(AttachedWindow) );
+     attached->window = window;
+
+     window->caps &= ~DWCAPS_NOFOCUS; //no focus patch PR  brg36mgr#118432
+
+     dfb_window_ref( window );
+
+     direct_list_prepend( &data->windows, &attached->link );
+
+     dfb_window_attach( window, IDirectFBEventBuffer_WindowReact,
+                        data, &attached->reaction );
+
+     return DFB_OK;
+}
+
+DFBResult IDirectFBEventBuffer_DetachWindow( IDirectFBEventBuffer *thiz,
+                                             CoreWindow           *window )
+{
+     AttachedWindow *attached;
+     DirectLink     *link;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBEventBuffer)
+
+     D_ASSERT( window != NULL );
+     
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p [%02u - %d,%d-%dx%d] )\n", __FUNCTION__, thiz,
+                 window, window->id, window->config.bounds.x, window->config.bounds.y,
+                 window->config.bounds.w, window->config.bounds.h );
+
+     direct_list_foreach_safe (attached, link, data->windows) {
+          if (!attached->window || attached->window == window) {
+               direct_list_remove( &data->windows, &attached->link );
+
+               if (attached->window) {
+                    dfb_window_detach( attached->window, &attached->reaction );
+                    dfb_window_unref( attached->window );
+               }
+               
+               D_FREE( attached );
+          }
+     }
+
+     return DFB_OK;
+}
+#endif
+
+/* file internals */
+
+static void IDirectFBEventBuffer_AddItem( IDirectFBEventBuffer_data *data,
+                                          EventBufferItem           *item )
+{
+     if (data->filter && data->filter( &item->evt, data->filter_ctx )) {
+          D_FREE( item );
+          return;
+     }
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     if (data->stats_enabled)
+          CollectEventStatistics( &data->stats, &item->evt, 1 );
+
+     direct_list_append( &data->events, &item->link );
+
+     pthread_cond_broadcast( &data->wait_condition );
+
+     pthread_mutex_unlock( &data->events_mutex );
+}
+
+#ifndef DIRECTFB_PURE_VOODOO
+static ReactionResult IDirectFBEventBuffer_InputReact( const void *msg_data,
+                                                       void       *ctx )
+{
+     const DFBInputEvent       *evt  = msg_data;
+     IDirectFBEventBuffer_data *data = ctx;
+     EventBufferItem           *item;
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p ) <- type %06x\n", __FUNCTION__, evt, data, evt->type );
+
+     if (dfb_config->discard_repeat_events && (evt->flags & DIEF_REPEAT)) {
+          D_DEBUG_AT( IDFBEvBuf, "  -> discarding repeat event!\n" );
+          return DFB_OK;
+     }
+
+     item = D_CALLOC( 1, sizeof(EventBufferItem) );
+
+     item->evt.input = *evt;
+     item->evt.clazz = DFEC_INPUT;
+
+     IDirectFBEventBuffer_AddItem( data, item );
+
+     return RS_OK;
+}
+
+static ReactionResult IDirectFBEventBuffer_WindowReact( const void *msg_data,
+                                                        void       *ctx )
+{
+     const DFBWindowEvent      *evt  = msg_data;
+     IDirectFBEventBuffer_data *data = ctx;
+     EventBufferItem           *item;
+
+     D_DEBUG_AT( IDFBEvBuf, "%s( %p, %p ) <- type %06x\n", __FUNCTION__, evt, data, evt->type );
+
+     if (dfb_config->discard_repeat_events && (evt->flags & DWEF_REPEAT)) {
+          D_DEBUG_AT( IDFBEvBuf, "  -> discarding repeat event!\n" );
+          return DFB_OK;
+     }
+
+     item = D_CALLOC( 1, sizeof(EventBufferItem) );
+
+     item->evt.window = *evt;
+     item->evt.clazz  = DFEC_WINDOW;
+
+     IDirectFBEventBuffer_AddItem( data, item );
+
+     if (evt->type == DWET_DESTROYED) {
+          AttachedWindow *window;
+
+          direct_list_foreach (window, data->windows) {
+               if (!window->window)
+                    continue;
+
+               if (dfb_window_id( window->window ) == evt->window_id) {
+                    /* FIXME: free memory later, because reactor writes to it
+                       after we return RS_REMOVE */
+                    dfb_window_unref( window->window );
+                    window->window = NULL;
+               }
+          }
+
+          return RS_REMOVE;
+     }
+
+     return RS_OK;
+}
+#endif
+
+static void *
+IDirectFBEventBuffer_Feed( DirectThread *thread, void *arg )
+{
+     IDirectFBEventBuffer_data *data = arg;
+
+     pthread_mutex_lock( &data->events_mutex );
+
+     while (data->pipe) {
+          while (data->events && data->pipe) {
+               int              ret;
+               EventBufferItem *item = (EventBufferItem*) data->events;
+
+               if (data->stats_enabled)
+                    CollectEventStatistics( &data->stats, &item->evt, -1 );
+
+               direct_list_remove( &data->events, &item->link );
+
+               if (item->evt.clazz == DFEC_UNIVERSAL) {
+                    D_WARN( "universal events not supported in pipe mode" );
+                    continue;
+               }
+
+               pthread_mutex_unlock( &data->events_mutex );
+
+               D_DEBUG_AT( IDFBEvBuf, "Going to write %zu bytes to file descriptor %d...\n",
+                           sizeof(DFBEvent), data->pipe_fds[1] );
+
+               ret = write( data->pipe_fds[1], &item->evt, sizeof(DFBEvent) );
+
+               D_DEBUG_AT( IDFBEvBuf, "...wrote %d bytes to file descriptor %d.\n",
+                           ret, data->pipe_fds[1] );
+
+               D_FREE( item );
+
+               pthread_mutex_lock( &data->events_mutex );
+          }
+
+          if (data->pipe)
+               pthread_cond_wait( &data->wait_condition, &data->events_mutex );
+     }
+
+     pthread_mutex_unlock( &data->events_mutex );
+
+     return NULL;
+}
+
+static void
+CollectEventStatistics( DFBEventBufferStats *stats,
+                        const DFBEvent      *event,
+                        int                  incdec )
+{
+     stats->num_events += incdec;
+
+     switch (event->clazz) {
+          case DFEC_INPUT:
+               stats->DFEC_INPUT += incdec;
+
+               switch (event->input.type) {
+                    case DIET_KEYPRESS:
+                         stats->DIET_KEYPRESS += incdec;
+                         break;
+
+                    case DIET_KEYRELEASE:
+                         stats->DIET_KEYRELEASE += incdec;
+                         break;
+
+                    case DIET_BUTTONPRESS:
+                         stats->DIET_BUTTONPRESS += incdec;
+                         break;
+
+                    case DIET_BUTTONRELEASE:
+                         stats->DIET_BUTTONRELEASE += incdec;
+                         break;
+
+                    case DIET_AXISMOTION:
+                         stats->DIET_AXISMOTION += incdec;
+                         break;
+
+                    default:
+                         D_BUG( "unknown input event type 0x%08x\n", event->input.type );
+               }
+               break;
+
+          case DFEC_WINDOW:
+               stats->DFEC_WINDOW += incdec;
+
+               switch (event->window.type) {
+                    case DWET_POSITION:
+                         stats->DWET_POSITION += incdec;
+                         break;
+
+                    case DWET_SIZE:
+                         stats->DWET_SIZE += incdec;
+                         break;
+
+                    case DWET_CLOSE:
+                         stats->DWET_CLOSE += incdec;
+                         break;
+
+                    case DWET_DESTROYED:
+                         stats->DWET_DESTROYED += incdec;
+                         break;
+
+                    case DWET_GOTFOCUS:
+                         stats->DWET_GOTFOCUS += incdec;
+                         break;
+
+                    case DWET_LOSTFOCUS:
+                         stats->DWET_LOSTFOCUS += incdec;
+                         break;
+
+                    case DWET_KEYDOWN:
+                         stats->DWET_KEYDOWN += incdec;
+                         break;
+
+                    case DWET_KEYUP:
+                         stats->DWET_KEYUP += incdec;
+                         break;
+
+                    case DWET_BUTTONDOWN:
+                         stats->DWET_BUTTONDOWN += incdec;
+                         break;
+
+                    case DWET_BUTTONUP:
+                         stats->DWET_BUTTONUP += incdec;
+                         break;
+
+                    case DWET_MOTION:
+                         stats->DWET_MOTION += incdec;
+                         break;
+
+                    case DWET_ENTER:
+                         stats->DWET_ENTER += incdec;
+                         break;
+
+                    case DWET_LEAVE:
+                         stats->DWET_LEAVE += incdec;
+                         break;
+
+                    case DWET_WHEEL:
+                         stats->DWET_WHEEL += incdec;
+                         break;
+
+                    case DWET_POSITION_SIZE:
+                         stats->DWET_POSITION_SIZE += incdec;
+                         break;
+
+                    default:
+                         D_BUG( "unknown window event type 0x%08x\n", event->window.type );
+               }
+               break;
+
+          case DFEC_USER:
+               stats->DFEC_USER += incdec;
+               break;
+
+          case DFEC_VIDEOPROVIDER:
+               stats->DFEC_VIDEOPROVIDER +=incdec;
+
+               switch (event->videoprovider.type) {
+                    case DVPET_STARTED:
+                         stats->DVPET_STARTED += incdec;
+                         break;
+
+                    case DVPET_STOPPED:
+                         stats->DVPET_STOPPED += incdec;
+                         break;
+
+                    case DVPET_SPEEDCHANGE:
+                         stats->DVPET_SPEEDCHANGE += incdec;
+                         break;
+
+                    case DVPET_STREAMCHANGE:
+                         stats->DVPET_STREAMCHANGE += incdec;
+                         break;
+
+                    case DVPET_FATALERROR:
+                         stats->DVPET_FATALERROR += incdec;
+                         break;
+                    
+                    case DVPET_FINISHED:
+                         stats->DVPET_FINISHED += incdec;
+                         break;
+                         
+                    case DVPET_SURFACECHANGE:
+                         stats->DVPET_SURFACECHANGE += incdec;
+                         break;
+
+                    case DVPET_FRAMEDECODED:
+                         stats->DVPET_FRAMEDECODED += incdec;
+                         break;
+
+                    case DVPET_FRAMEDISPLAYED:
+                         stats->DVPET_FRAMEDISPLAYED += incdec;
+                         break;
+
+                    case DVPET_DATAEXHAUSTED:
+                         stats->DVPET_DATAEXHAUSTED += incdec;
+                         break;
+
+                    case DVPET_VIDEOACTION:
+                         stats->DVPET_VIDEOACTION += incdec;
+                         break;
+
+                    case DVPET_DATALOW:
+                         stats->DVPET_DATALOW += incdec;
+                         break;
+
+                   case DVPET_DATAHIGH:
+                         stats->DVPET_DATAHIGH += incdec;
+                         break;
+
+                   case DVPET_BUFFERTIMELOW:
+                         stats->DVPET_BUFFERTIMELOW += incdec;
+                         break;
+
+                   case DVPET_BUFFERTIMEHIGH:
+                         stats->DVPET_BUFFERTIMEHIGH += incdec;
+                         break;
+
+                    default:
+                         D_BUG( "unknown video provider event type 0x%08x\n", event->videoprovider.type );
+               }
+               break;
+
+          case DFEC_UNIVERSAL:
+               stats->DFEC_UNIVERSAL += incdec;
+               break;
+
+          default:
+               D_BUG( "unknown event class 0x%08x\n", event->clazz );
+     }
+}
+
diff --git a/Source/DirectFB/src/input/idirectfbinputbuffer.h b/Source/DirectFB/src/input/idirectfbinputbuffer.h
new file mode 100755
index 0000000..53b263b
--- /dev/null
+++ b/Source/DirectFB/src/input/idirectfbinputbuffer.h
@@ -0,0 +1,56 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBEVENTBUFFER_H__
+#define __IDIRECTFBEVENTBUFFER_H__
+
+#include <fusion/types.h>
+#include <core/input.h>
+
+typedef bool (*EventBufferFilterCallback)( DFBEvent *evt,
+                                           void     *ctx );
+
+/*
+ * initializes event buffer, adds it to input listeners and initializes mutexes
+ */
+DFBResult IDirectFBEventBuffer_Construct( IDirectFBEventBuffer      *thiz,
+                                          EventBufferFilterCallback  filter,
+                                          void                      *filter_ctx );
+
+DFBResult IDirectFBEventBuffer_AttachInputDevice( IDirectFBEventBuffer *thiz,
+                                                  CoreInputDevice      *device );
+DFBResult IDirectFBEventBuffer_DetachInputDevice( IDirectFBEventBuffer *thiz,
+                                                  CoreInputDevice      *device );
+
+DFBResult IDirectFBEventBuffer_AttachWindow( IDirectFBEventBuffer *thiz,
+                                             CoreWindow           *window );
+DFBResult IDirectFBEventBuffer_DetachWindow( IDirectFBEventBuffer *thiz,
+                                             CoreWindow           *window );
+
+
+#endif
diff --git a/Source/DirectFB/src/input/idirectfbinputdevice.c b/Source/DirectFB/src/input/idirectfbinputdevice.c
new file mode 100755
index 0000000..f00af8e
--- /dev/null
+++ b/Source/DirectFB/src/input/idirectfbinputdevice.c
@@ -0,0 +1,446 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+
+#include <fusion/reactor.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+
+#include <misc/util.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include "idirectfbinputdevice.h"
+#include "idirectfbinputbuffer.h"
+
+
+/*
+ * processes an event, updates device state
+ * (funcion is added to the event listeners)
+ */
+static ReactionResult
+IDirectFBInputDevice_React( const void *msg_data,
+                            void       *ctx );
+
+/*
+ * private data struct of IDirectFBInputDevice
+ */
+typedef struct {
+     int                         ref;               /* reference counter */
+     CoreInputDevice            *device;            /* pointer to input core
+                                                       device struct*/
+
+     int                         axis[DIAI_LAST+1]; /* position of all axes */
+     DFBInputDeviceKeyState      keystates[DIKI_NUMBER_OF_KEYS];
+                                                    /* state of all keys */
+     DFBInputDeviceModifierMask  modifiers;         /* bitmask reflecting the
+                                                       state of the modifier
+                                                       keys */
+     DFBInputDeviceLockState     locks;             /* bitmask reflecting the
+						       state of the key locks */
+     DFBInputDeviceButtonMask    buttonmask;        /* bitmask reflecting the
+                                                       state of the buttons */
+
+     DFBInputDeviceDescription   desc;              /* device description */
+
+     Reaction                    reaction;
+} IDirectFBInputDevice_data;
+
+
+
+static void
+IDirectFBInputDevice_Destruct( IDirectFBInputDevice *thiz )
+{
+     IDirectFBInputDevice_data *data = (IDirectFBInputDevice_data*)thiz->priv;
+
+     dfb_input_detach( data->device, &data->reaction );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBInputDevice_AddRef( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBInputDevice_Release( IDirectFBInputDevice *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (--data->ref == 0)
+          IDirectFBInputDevice_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetID( IDirectFBInputDevice *thiz,
+                            DFBInputDeviceID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!id)
+          return DFB_INVARG;
+
+     *id = dfb_input_device_id( data->device );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_CreateEventBuffer( IDirectFBInputDevice  *thiz,
+                                        IDirectFBEventBuffer **buffer )
+{
+     IDirectFBEventBuffer *b;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     DIRECT_ALLOCATE_INTERFACE( b, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( b, NULL, NULL );
+
+     IDirectFBEventBuffer_AttachInputDevice( b, data->device );
+
+     *buffer = b;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_AttachEventBuffer( IDirectFBInputDevice  *thiz,
+                                        IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     return IDirectFBEventBuffer_AttachInputDevice( buffer, data->device );
+}
+
+static DFBResult
+IDirectFBInputDevice_DetachEventBuffer( IDirectFBInputDevice  *thiz,
+                                        IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     return IDirectFBEventBuffer_DetachInputDevice( buffer, data->device );
+}
+
+static DFBResult
+IDirectFBInputDevice_GetDescription( IDirectFBInputDevice      *thiz,
+                                     DFBInputDeviceDescription *desc )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!desc)
+          return DFB_INVARG;
+
+     *desc = data->desc;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetKeymapEntry( IDirectFBInputDevice      *thiz,
+                                     int                        keycode,
+                                     DFBInputDeviceKeymapEntry *entry )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!entry)
+          return DFB_INVARG;
+
+     if (data->desc.min_keycode < 0 || data->desc.max_keycode < 0)
+          return DFB_UNSUPPORTED;
+
+     if (keycode < data->desc.min_keycode ||
+         keycode > data->desc.max_keycode)
+          return DFB_INVARG;
+
+     return dfb_input_device_get_keymap_entry( data->device, keycode, entry );
+}
+
+static DFBResult
+IDirectFBInputDevice_SetKeymapEntry( IDirectFBInputDevice      *thiz,
+                                     int                        keycode,
+                                     DFBInputDeviceKeymapEntry *entry )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!entry)
+          return DFB_INVARG;
+
+     if (data->desc.min_keycode < 0 || data->desc.max_keycode < 0)
+          return DFB_UNSUPPORTED;
+
+     if (keycode < data->desc.min_keycode ||
+         keycode > data->desc.max_keycode)
+          return DFB_INVARG;
+
+     return dfb_input_device_set_keymap_entry( data->device, keycode, entry );
+}
+
+static DFBResult
+IDirectFBInputDevice_LoadKeymap ( IDirectFBInputDevice          *thiz,
+                                  char                          *filename )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!filename)
+          return DFB_INVARG;
+
+     return dfb_input_device_load_keymap( data->device, filename );
+}
+
+static DFBResult
+IDirectFBInputDevice_GetKeyState( IDirectFBInputDevice        *thiz,
+                                  DFBInputDeviceKeyIdentifier  key_id,
+                                  DFBInputDeviceKeyState      *state )
+{
+     unsigned int index = key_id - DFB_KEY(IDENTIFIER, 0);
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!state || index >= DIKI_NUMBER_OF_KEYS)
+          return DFB_INVARG;
+
+     *state = data->keystates[index];
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetModifiers( IDirectFBInputDevice       *thiz,
+                                   DFBInputDeviceModifierMask *modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!modifiers)
+          return DFB_INVARG;
+
+     *modifiers = data->modifiers;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetLockState( IDirectFBInputDevice    *thiz,
+                                   DFBInputDeviceLockState *locks )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!locks)
+          return DFB_INVARG;
+
+     *locks = data->locks;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetButtons( IDirectFBInputDevice     *thiz,
+                                 DFBInputDeviceButtonMask *buttons )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!buttons)
+          return DFB_INVARG;
+
+     *buttons = data->buttonmask;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetButtonState( IDirectFBInputDevice           *thiz,
+                                     DFBInputDeviceButtonIdentifier  button,
+                                     DFBInputDeviceButtonState      *state)
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!state || (int)button < DIBI_FIRST || button > DIBI_LAST)
+          return DFB_INVARG;
+
+     *state = (data->buttonmask & (1 << button)) ? DIBS_DOWN : DIBS_UP;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetAxis( IDirectFBInputDevice         *thiz,
+                              DFBInputDeviceAxisIdentifier  axis,
+                              int                          *pos )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!pos || (int)axis < DIAI_FIRST || axis > DIAI_LAST)
+          return DFB_INVARG;
+
+     *pos = data->axis[axis];
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_GetXY( IDirectFBInputDevice *thiz,
+                            int                  *x,
+                            int                  *y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     if (x)
+          *x = data->axis[DIAI_X];
+
+     if (y)
+          *y = data->axis[DIAI_Y];
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBInputDevice_SetSensitivity( IDirectFBInputDevice *thiz,
+                                     int                   sensitivity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     return dfb_input_device_set_sensitivity( data->device, sensitivity );
+}
+
+static DFBResult
+IDirectFBInputDevice_GetState( IDirectFBInputDevice *thiz,
+                               DFBInputDeviceState  *state )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBInputDevice)
+
+     if (!state)
+          return DFB_INVARG;
+
+     return dfb_input_device_get_state( data->device, state );
+}
+
+
+DFBResult
+IDirectFBInputDevice_Construct( IDirectFBInputDevice *thiz,
+                                CoreInputDevice      *device )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBInputDevice)
+
+     data->ref    = 1;
+     data->device = device;
+
+     dfb_input_device_description( device, &data->desc );
+
+     dfb_input_attach( data->device, IDirectFBInputDevice_React,
+                       data, &data->reaction );
+
+     thiz->AddRef = IDirectFBInputDevice_AddRef;
+     thiz->Release = IDirectFBInputDevice_Release;
+     thiz->GetID = IDirectFBInputDevice_GetID;
+     thiz->GetDescription = IDirectFBInputDevice_GetDescription;
+     thiz->GetKeymapEntry = IDirectFBInputDevice_GetKeymapEntry;
+     thiz->SetKeymapEntry = IDirectFBInputDevice_SetKeymapEntry;
+     thiz->LoadKeymap = IDirectFBInputDevice_LoadKeymap;
+     thiz->CreateEventBuffer = IDirectFBInputDevice_CreateEventBuffer;
+     thiz->AttachEventBuffer = IDirectFBInputDevice_AttachEventBuffer;
+     thiz->DetachEventBuffer = IDirectFBInputDevice_DetachEventBuffer;
+     thiz->GetKeyState = IDirectFBInputDevice_GetKeyState;
+     thiz->GetModifiers = IDirectFBInputDevice_GetModifiers;
+     thiz->GetLockState = IDirectFBInputDevice_GetLockState;
+     thiz->GetButtons = IDirectFBInputDevice_GetButtons;
+     thiz->GetButtonState = IDirectFBInputDevice_GetButtonState;
+     thiz->GetAxis = IDirectFBInputDevice_GetAxis;
+     thiz->GetXY = IDirectFBInputDevice_GetXY;
+     thiz->SetSensitivity = IDirectFBInputDevice_SetSensitivity;
+     thiz->GetState = IDirectFBInputDevice_GetState;
+
+     return DFB_OK;
+}
+
+
+/* internals */
+
+static ReactionResult
+IDirectFBInputDevice_React( const void *msg_data,
+                            void       *ctx )
+{
+     const DFBInputEvent       *evt  = msg_data;
+     IDirectFBInputDevice_data *data = ctx;
+     unsigned int               index;
+
+     if (evt->flags & DIEF_MODIFIERS)
+          data->modifiers = evt->modifiers;
+     if (evt->flags & DIEF_LOCKS)
+          data->locks = evt->locks;
+     if (evt->flags & DIEF_BUTTONS)
+          data->buttonmask = evt->buttons;
+
+     switch (evt->type) {
+          case DIET_KEYPRESS:
+               index = evt->key_id - DFB_KEY(IDENTIFIER, 0);
+               if (index < DIKI_NUMBER_OF_KEYS)
+                    data->keystates[index] = DIKS_DOWN;
+	           break;
+
+          case DIET_KEYRELEASE:
+               index = evt->key_id - DFB_KEY(IDENTIFIER, 0);
+               if (index < DIKI_NUMBER_OF_KEYS)
+                    data->keystates[index] = DIKS_UP;
+               break;
+
+          case DIET_AXISMOTION:
+               if (evt->flags & DIEF_AXISREL)
+                    data->axis[evt->axis] += evt->axisrel;
+               if (evt->flags & DIEF_AXISABS)
+                    data->axis[evt->axis] = evt->axisabs;
+               break;
+
+          default:
+               D_DEBUG( "DirectFB/IDirectFBInputDevice: Unknown event type detected (0x%x), skipping!\n", evt->type );
+     }
+
+     return RS_OK;
+}
+
diff --git a/Source/DirectFB/src/input/idirectfbinputdevice.h b/Source/DirectFB/src/input/idirectfbinputdevice.h
new file mode 100755
index 0000000..65bdc23
--- /dev/null
+++ b/Source/DirectFB/src/input/idirectfbinputdevice.h
@@ -0,0 +1,40 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBINPUTDEVICE_H__
+#define __IDIRECTFBINPUTDEVICE_H__
+
+#include <core/input.h>
+
+/*
+ * initializes input device, adds it to input listeners and initializes mutexes
+ */
+DFBResult IDirectFBInputDevice_Construct( IDirectFBInputDevice *thiz,
+                                          CoreInputDevice      *device );
+
+#endif
diff --git a/Source/DirectFB/src/media/Makefile.am b/Source/DirectFB/src/media/Makefile.am
new file mode 100755
index 0000000..cb2ae12
--- /dev/null
+++ b/Source/DirectFB/src/media/Makefile.am
@@ -0,0 +1,29 @@
+## Makefile.am for DirectFB/src/media
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/media
+
+internalinclude_HEADERS = \
+	idirectfbdatabuffer.h		\
+	idirectfbfont.h			\
+	idirectfbimageprovider.h	\
+	idirectfbvideoprovider.h
+
+
+noinst_LTLIBRARIES = libdirectfb_media.la
+
+libdirectfb_media_la_SOURCES = \
+	idirectfbdatabuffer.c		\
+	idirectfbdatabuffer_file.c	\
+	idirectfbdatabuffer_memory.c	\
+	idirectfbdatabuffer_streamed.c	\
+	idirectfbfont.c			\
+	idirectfbimageprovider.c		\
+	idirectfbvideoprovider.c
diff --git a/Source/DirectFB/src/media/Makefile.in b/Source/DirectFB/src/media/Makefile.in
new file mode 100755
index 0000000..930fe11
--- /dev/null
+++ b/Source/DirectFB/src/media/Makefile.in
@@ -0,0 +1,570 @@
+# 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@
+subdir = src/media
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_media_la_LIBADD =
+am_libdirectfb_media_la_OBJECTS = idirectfbdatabuffer.lo \
+	idirectfbdatabuffer_file.lo idirectfbdatabuffer_memory.lo \
+	idirectfbdatabuffer_streamed.lo idirectfbfont.lo \
+	idirectfbimageprovider.lo idirectfbvideoprovider.lo
+libdirectfb_media_la_OBJECTS = $(am_libdirectfb_media_la_OBJECTS)
+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_media_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_media_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/media
+internalinclude_HEADERS = \
+	idirectfbdatabuffer.h		\
+	idirectfbfont.h			\
+	idirectfbimageprovider.h	\
+	idirectfbvideoprovider.h
+
+noinst_LTLIBRARIES = libdirectfb_media.la
+libdirectfb_media_la_SOURCES = \
+	idirectfbdatabuffer.c		\
+	idirectfbdatabuffer_file.c	\
+	idirectfbdatabuffer_memory.c	\
+	idirectfbdatabuffer_streamed.c	\
+	idirectfbfont.c			\
+	idirectfbimageprovider.c		\
+	idirectfbvideoprovider.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/media/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/media/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_media.la: $(libdirectfb_media_la_OBJECTS) $(libdirectfb_media_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_media_la_OBJECTS) $(libdirectfb_media_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer_memory.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbdatabuffer_streamed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbfont.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbimageprovider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbvideoprovider.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/media/idirectfbdatabuffer.c b/Source/DirectFB/src/media/idirectfbdatabuffer.c
new file mode 100755
index 0000000..68ccc4e
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbdatabuffer.c
@@ -0,0 +1,264 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <sys/time.h>
+
+#include <pthread.h>
+
+#include <fusion/reactor.h>
+#include <direct/list.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/windows.h>
+
+#include <misc/util.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <media/idirectfbdatabuffer.h>
+#include <media/idirectfbfont.h>
+#include <media/idirectfbimageprovider.h>
+#include <media/idirectfbvideoprovider.h>
+
+
+void
+IDirectFBDataBuffer_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_data *data = (IDirectFBDataBuffer_data*) thiz->priv;
+
+     if (data->filename)
+          D_FREE( data->filename );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBDataBuffer_AddRef( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBDataBuffer_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     if (--data->ref == 0)
+          IDirectFBDataBuffer_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Flush( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Finish( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_SeekTo( IDirectFBDataBuffer *thiz,
+                            unsigned int         offset )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_GetPosition( IDirectFBDataBuffer *thiz,
+                                 unsigned int        *offset )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_GetLength( IDirectFBDataBuffer *thiz,
+                               unsigned int        *length )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_WaitForData( IDirectFBDataBuffer *thiz,
+                                 unsigned int         length )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                            unsigned int         length,
+                                            unsigned int         seconds,
+                                            unsigned int         milli_seconds )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_GetData( IDirectFBDataBuffer *thiz,
+                             unsigned int         length,
+                             void                *data,
+                             unsigned int        *read )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_PeekData( IDirectFBDataBuffer *thiz,
+                              unsigned int         length,
+                              int                  offset,
+                              void                *data,
+                              unsigned int        *read )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_HasData( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_PutData( IDirectFBDataBuffer *thiz,
+                             const void          *data,
+                             unsigned int         length )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_CreateImageProvider( IDirectFBDataBuffer     *thiz,
+                                         IDirectFBImageProvider **interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     /* Check arguments */
+     if (!interface)
+          return DFB_INVARG;
+
+#ifndef DIRECTFB_PURE_VOODOO
+     return IDirectFBImageProvider_CreateFromBuffer( thiz, data->core, interface );
+#else
+     D_BUG( "%s in pure Voodoo build", __FUNCTION__ );
+     return DFB_BUG;
+#endif
+}
+
+static DFBResult
+IDirectFBDataBuffer_CreateVideoProvider( IDirectFBDataBuffer     *thiz,
+                                         IDirectFBVideoProvider **interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     /* Check arguments */
+     if (!interface)
+          return DFB_INVARG;
+
+#ifndef DIRECTFB_PURE_VOODOO
+     return IDirectFBVideoProvider_CreateFromBuffer( thiz, data->core, interface );
+#else
+     D_BUG( "%s in pure Voodoo build", __FUNCTION__ );
+     return DFB_BUG;
+#endif
+}
+
+static DFBResult
+IDirectFBDataBuffer_CreateFont( IDirectFBDataBuffer       *thiz,
+                                const DFBFontDescription  *desc,
+                                IDirectFBFont            **interface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     /* Check arguments */
+     if (!interface || !desc)
+          return DFB_INVARG;
+
+#ifndef DIRECTFB_PURE_VOODOO
+     return IDirectFBFont_CreateFromBuffer( thiz, data->core, desc, interface );
+#else
+     D_BUG( "%s in pure Voodoo build", __FUNCTION__ );
+     return DFB_BUG;
+#endif
+}
+
+DFBResult
+IDirectFBDataBuffer_Construct( IDirectFBDataBuffer *thiz,
+                               const char          *filename,
+                               CoreDFB             *core )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDataBuffer)
+
+     data->ref  = 1;
+     data->core = core;
+
+     if (filename)
+          data->filename = D_STRDUP( filename );
+
+     thiz->AddRef                 = IDirectFBDataBuffer_AddRef;
+     thiz->Release                = IDirectFBDataBuffer_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_PutData;
+     thiz->CreateImageProvider    = IDirectFBDataBuffer_CreateImageProvider;
+     thiz->CreateVideoProvider    = IDirectFBDataBuffer_CreateVideoProvider;
+     thiz->CreateFont             = IDirectFBDataBuffer_CreateFont;
+     
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbdatabuffer.h b/Source/DirectFB/src/media/idirectfbdatabuffer.h
new file mode 100755
index 0000000..4b19eb0
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbdatabuffer.h
@@ -0,0 +1,104 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBDATABUFFER_H__
+#define __IDIRECTFBDATABUFFER_H__
+
+#include <core/core.h>
+
+/*
+ * private data struct of IDirectFBDataBuffer
+ */
+typedef struct {
+     int          ref;        /* reference counter */
+     char        *filename;   /* Only set if databuffer is created from file. */
+
+     CoreDFB     *core;
+
+     bool         is_memory;
+} IDirectFBDataBuffer_data;
+
+/*
+ * private data struct of IDirectFBDataBuffer_File
+ */
+typedef struct {
+     IDirectFBDataBuffer_data base;
+
+     DirectStream    *stream;
+     pthread_mutex_t  mutex;
+} IDirectFBDataBuffer_File_data;
+
+/*
+ * private data struct of IDirectFBDataBuffer_Memory
+ */
+typedef struct {
+     IDirectFBDataBuffer_data  base;
+
+     const void               *buffer;
+     unsigned int              length;
+
+     unsigned int              pos;
+} IDirectFBDataBuffer_Memory_data;
+
+/*
+ * base constructor
+ *
+ * If the databuffer is created for a file, the filename can be provided
+ * for fallbacks.
+ */
+DFBResult IDirectFBDataBuffer_Construct( IDirectFBDataBuffer *thiz,
+                                         const char          *filename,
+                                         CoreDFB             *core );
+
+/*
+ * base destructor
+ */
+void IDirectFBDataBuffer_Destruct( IDirectFBDataBuffer *thiz );
+
+/*
+ * generic streamed data buffer
+ */
+DFBResult IDirectFBDataBuffer_Streamed_Construct( IDirectFBDataBuffer *thiz,
+                                                  CoreDFB             *core );
+
+/*
+ * file based static data buffer
+ */
+DFBResult IDirectFBDataBuffer_File_Construct( IDirectFBDataBuffer *thiz,
+                                              const char          *filename,
+                                              CoreDFB             *core );
+
+/*
+ * memory based static data buffer
+ */
+DFBResult IDirectFBDataBuffer_Memory_Construct( IDirectFBDataBuffer *thiz,
+                                                const void          *data,
+                                                unsigned int         length,
+                                                CoreDFB             *core );
+
+#endif
diff --git a/Source/DirectFB/src/media/idirectfbdatabuffer_file.c b/Source/DirectFB/src/media/idirectfbdatabuffer_file.c
new file mode 100755
index 0000000..245ce02
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbdatabuffer_file.c
@@ -0,0 +1,297 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+
+#include <pthread.h>
+
+#include <fusion/reactor.h>
+#include <direct/list.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/windows.h>
+
+#include <misc/util.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/stream.h>
+#include <direct/util.h>
+
+#include <media/idirectfbdatabuffer.h>
+
+
+
+static void
+IDirectFBDataBuffer_File_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_File_data *data =
+          (IDirectFBDataBuffer_File_data*) thiz->priv;
+
+     direct_stream_destroy( data->stream );
+
+     pthread_mutex_destroy( &data->mutex );
+
+     IDirectFBDataBuffer_Destruct( thiz );
+}
+
+static DirectResult
+IDirectFBDataBuffer_File_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     if (--data->ref == 0)
+          IDirectFBDataBuffer_File_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_Flush( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_Finish( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_SeekTo( IDirectFBDataBuffer *thiz,
+                                 unsigned int         offset )
+{
+     DFBResult ret;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     if (!direct_stream_seekable( data->stream ))
+          return DFB_UNSUPPORTED;
+          
+     pthread_mutex_lock( &data->mutex );
+     ret = direct_stream_seek( data->stream, offset );
+     pthread_mutex_unlock( &data->mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_GetPosition( IDirectFBDataBuffer *thiz,
+                                      unsigned int        *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     if (!offset)
+          return DFB_INVARG;
+
+     *offset = direct_stream_offset( data->stream );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_GetLength( IDirectFBDataBuffer *thiz,
+                                    unsigned int        *length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     if (!length)
+          return DFB_INVARG;
+
+     *length = direct_stream_length( data->stream );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_WaitForData( IDirectFBDataBuffer *thiz,
+                                      unsigned int         length )
+{
+     DFBResult ret;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     pthread_mutex_lock( &data->mutex );          
+     ret = direct_stream_wait( data->stream, length, NULL );
+     pthread_mutex_unlock( &data->mutex );
+     
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                                 unsigned int         length,
+                                                 unsigned int         seconds,
+                                                 unsigned int         milli_seconds )
+{
+     DFBResult      ret;
+     struct timeval tv;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     tv.tv_sec  = seconds;
+     tv.tv_usec = milli_seconds*1000;
+
+     while (pthread_mutex_trylock( &data->mutex )) {
+          struct timespec t, r;
+          
+          if (errno != EBUSY)
+               return errno2result( errno );
+
+          t.tv_sec  = 0;
+          t.tv_nsec = 10000;
+          nanosleep( &t, &r );
+          
+          tv.tv_usec -= (t.tv_nsec - r.tv_nsec + 500) / 1000;
+          if (tv.tv_usec < 0) {
+               if (tv.tv_sec < 1)
+                    return DFB_TIMEOUT;
+               
+               tv.tv_sec--;
+               tv.tv_usec += 999999;
+          }
+     }
+         
+     ret = direct_stream_wait( data->stream, length, &tv );
+     
+     pthread_mutex_unlock( &data->mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_GetData( IDirectFBDataBuffer *thiz,
+                                  unsigned int         length,
+                                  void                *data_buffer,
+                                  unsigned int        *read_out )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     pthread_mutex_lock( &data->mutex );
+     ret = direct_stream_read( data->stream, length, data_buffer, read_out );
+     pthread_mutex_unlock( &data->mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_PeekData( IDirectFBDataBuffer *thiz,
+                                   unsigned int         length,
+                                   int                  offset,
+                                   void                *data_buffer,
+                                   unsigned int        *read_out )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     pthread_mutex_lock( &data->mutex );
+     ret = direct_stream_peek( data->stream, length,
+                               offset, data_buffer, read_out );
+     pthread_mutex_unlock( &data->mutex );
+     
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_HasData( IDirectFBDataBuffer *thiz )
+{
+     struct timeval tv = {0,0};
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_File)
+        
+     return direct_stream_wait( data->stream, 1, &tv );
+}
+
+static DFBResult
+IDirectFBDataBuffer_File_PutData( IDirectFBDataBuffer *thiz,
+                                  const void          *data_buffer,
+                                  unsigned int         length )
+{
+     return DFB_UNSUPPORTED;
+}
+
+DFBResult
+IDirectFBDataBuffer_File_Construct( IDirectFBDataBuffer *thiz,
+                                    const char          *filename,
+                                    CoreDFB             *core )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDataBuffer_File)
+
+     ret = IDirectFBDataBuffer_Construct( thiz, filename, core );
+     if (ret)
+          return ret;
+
+     ret = direct_stream_create( filename, &data->stream );
+     if (ret) {
+          DIRECT_DEALLOCATE_INTERFACE( thiz );
+          return ret;
+     }
+
+     direct_util_recursive_pthread_mutex_init( &data->mutex );
+
+     thiz->Release                = IDirectFBDataBuffer_File_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_File_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_File_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_File_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_File_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_File_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_File_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_File_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_File_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_File_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_File_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_File_PutData;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbdatabuffer_memory.c b/Source/DirectFB/src/media/idirectfbdatabuffer_memory.c
new file mode 100755
index 0000000..233e4b4
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbdatabuffer_memory.c
@@ -0,0 +1,266 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <sys/time.h>
+
+#include <pthread.h>
+
+#include <fusion/reactor.h>
+#include <direct/list.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/input.h>
+#include <core/windows.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/util.h>
+
+#include <media/idirectfbdatabuffer.h>
+
+
+static void
+IDirectFBDataBuffer_Memory_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_Destruct( thiz );
+}
+
+static DirectResult
+IDirectFBDataBuffer_Memory_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     if (--data->ref == 0)
+          IDirectFBDataBuffer_Memory_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_Flush( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_Finish( IDirectFBDataBuffer *thiz )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_SeekTo( IDirectFBDataBuffer *thiz,
+                                   unsigned int         offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (offset >= data->length)
+          return DFB_INVARG;
+
+     data->pos = offset;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_GetPosition( IDirectFBDataBuffer *thiz,
+                                        unsigned int        *offset )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (!offset)
+          return DFB_INVARG;
+
+     *offset = data->pos;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_GetLength( IDirectFBDataBuffer *thiz,
+                                      unsigned int        *length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (!length)
+          return DFB_INVARG;
+
+     *length = data->length;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_WaitForData( IDirectFBDataBuffer *thiz,
+                                        unsigned int         length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (data->pos + length > data->length)
+          return DFB_EOF;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                                   unsigned int         length,
+                                                   unsigned int         seconds,
+                                                   unsigned int         milli_seconds )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (data->pos + length > data->length)
+          return DFB_EOF;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_GetData( IDirectFBDataBuffer *thiz,
+                                    unsigned int         length,
+                                    void                *data_buffer,
+                                    unsigned int        *read_out )
+{
+     unsigned int size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     if (data->pos >= data->length)
+          return DFB_EOF;
+
+     size = MIN( length, data->length - data->pos );
+
+     direct_memcpy( data_buffer, data->buffer + data->pos, size );
+
+     data->pos += size;
+
+     if (read_out)
+          *read_out = size;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_PeekData( IDirectFBDataBuffer *thiz,
+                                     unsigned int         length,
+                                     int                  offset,
+                                     void                *data_buffer,
+                                     unsigned int        *read_out )
+{
+     unsigned int size;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     if (data->pos + offset >= data->length)
+          return DFB_EOF;
+
+     size = MIN( length, data->length - data->pos - offset );
+
+     direct_memcpy( data_buffer, data->buffer + data->pos + offset, size );
+
+     if (read_out)
+          *read_out = size;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_HasData( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Memory)
+
+     if (data->pos >= data->length)
+          return DFB_EOF;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Memory_PutData( IDirectFBDataBuffer *thiz,
+                                    const void          *data_buffer,
+                                    unsigned int         length )
+{
+     return DFB_UNSUPPORTED;
+}
+
+DFBResult
+IDirectFBDataBuffer_Memory_Construct( IDirectFBDataBuffer *thiz,
+                                      const void          *data_buffer,
+                                      unsigned int         length,
+                                      CoreDFB             *core )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDataBuffer_Memory)
+
+     ret = IDirectFBDataBuffer_Construct( thiz, NULL, core );
+     if (ret)
+          return ret;
+
+     data->buffer = data_buffer;
+     data->length = length;
+
+     data->base.is_memory = true;
+
+     thiz->Release                = IDirectFBDataBuffer_Memory_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_Memory_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_Memory_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_Memory_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_Memory_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_Memory_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_Memory_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_Memory_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_Memory_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_Memory_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_Memory_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_Memory_PutData;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbdatabuffer_streamed.c b/Source/DirectFB/src/media/idirectfbdatabuffer_streamed.c
new file mode 100755
index 0000000..5ce1168
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbdatabuffer_streamed.c
@@ -0,0 +1,529 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include <sys/time.h>
+
+#include <pthread.h>
+
+#include <fusion/reactor.h>
+#include <direct/list.h>
+#include <fusion/lock.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/util.h>
+
+#include <media/idirectfbdatabuffer.h>
+
+typedef struct {
+     DirectLink    link;
+
+     void         *data;   /* actual data hold */
+     unsigned int  length; /* length of chunk */
+
+     unsigned int  done;   /* number of bytes already consumed */
+} DataChunk;
+
+static DataChunk *
+create_chunk( const void *data, int length );
+
+static void
+destroy_chunk( DataChunk *chunk );
+
+/*
+ * private data struct of IDirectFBDataBuffer_Streamed
+ */
+typedef struct {
+     IDirectFBDataBuffer_data  base;
+
+     DirectLink               *chunks;          /* data chunks */
+
+     unsigned int              length;          /* total length of all chunks */
+
+     bool                      finished;        /* whether Finish() has been called */
+
+     pthread_mutex_t           chunks_mutex;    /* mutex lock for accessing
+                                                   the chunk list */
+
+     pthread_cond_t            wait_condition;  /* condition used for idle
+                                                   wait in WaitForEvent() */
+} IDirectFBDataBuffer_Streamed_data;
+
+static void
+DestroyAllChunks( IDirectFBDataBuffer_Streamed_data *data );
+
+static void
+ReadChunkData( IDirectFBDataBuffer_Streamed_data *data,
+               void                              *buffer,
+               unsigned int                       offset,
+               unsigned int                       length,
+               bool                               flush );
+
+
+static void
+IDirectFBDataBuffer_Streamed_Destruct( IDirectFBDataBuffer *thiz )
+{
+     IDirectFBDataBuffer_Streamed_data *data =
+          (IDirectFBDataBuffer_Streamed_data*) thiz->priv;
+
+     pthread_cond_destroy( &data->wait_condition );
+     pthread_mutex_destroy( &data->chunks_mutex );
+
+     IDirectFBDataBuffer_Destruct( thiz );
+}
+
+static DirectResult
+IDirectFBDataBuffer_Streamed_Release( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer)
+
+     if (--data->ref == 0)
+          IDirectFBDataBuffer_Streamed_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_Flush( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     pthread_mutex_lock( &data->chunks_mutex );
+
+     DestroyAllChunks( data );
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_Finish( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     if (!data->finished) {
+          data->finished = true;
+
+          pthread_mutex_lock( &data->chunks_mutex );
+          pthread_cond_broadcast( &data->wait_condition );
+          pthread_mutex_unlock( &data->chunks_mutex );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_SeekTo( IDirectFBDataBuffer *thiz,
+                                     unsigned int         offset )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_GetPosition( IDirectFBDataBuffer *thiz,
+                                          unsigned int        *offset )
+{
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_GetLength( IDirectFBDataBuffer *thiz,
+                                        unsigned int        *length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     /* Check arguments. */
+     if (!length)
+          return DFB_INVARG;
+
+     /* Return total length of all chunks. */
+     *length = data->length;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_WaitForData( IDirectFBDataBuffer *thiz,
+                                          unsigned int         length )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     if (data->finished && !data->chunks)
+          return DFB_EOF;
+          
+     pthread_mutex_lock( &data->chunks_mutex );
+
+     while (data->length < length && !data->finished)
+          pthread_cond_wait( &data->wait_condition, &data->chunks_mutex );
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_WaitForDataWithTimeout( IDirectFBDataBuffer *thiz,
+                                                     unsigned int         length,
+                                                     unsigned int         seconds,
+                                                     unsigned int         milli_seconds )
+{
+     struct timespec timeout;
+     DFBResult       ret          = DFB_OK;
+     bool            locked       = false;
+     long int        nano_seconds = milli_seconds * 1000000;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     if (data->finished && !data->chunks)
+          return DFB_EOF;
+          
+     if (pthread_mutex_trylock( &data->chunks_mutex ) == 0) {
+          if (data->length >= length) {
+               pthread_mutex_unlock( &data->chunks_mutex );
+
+               return DFB_OK;
+          }
+
+          locked = true;
+     }
+
+     direct_util_get_monotonic_pthread_timeout(&timeout, seconds, nano_seconds);
+
+     if (!locked)
+          pthread_mutex_lock( &data->chunks_mutex );
+
+     while (data->length < length && !data->finished) {
+          if (pthread_cond_timedwait( &data->wait_condition,
+                                      &data->chunks_mutex,
+                                      &timeout ) == ETIMEDOUT)
+          {
+               ret = DFB_TIMEOUT;
+               break;
+          }
+     }
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_GetData( IDirectFBDataBuffer *thiz,
+                                      unsigned int         length,
+                                      void                *data_buffer,
+                                      unsigned int        *read_out )
+{
+     unsigned int len;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     pthread_mutex_lock( &data->chunks_mutex );
+
+     if (!data->chunks) {
+          pthread_mutex_unlock( &data->chunks_mutex );
+          return data->finished ? DFB_EOF : DFB_BUFFEREMPTY;
+     }
+
+     /* Calculate maximum number of bytes to be read. */
+     len = MIN( length, data->length );
+
+     /* Read data from chunks (destructive). */
+     ReadChunkData( data, data_buffer, 0, len, true );
+
+     /* Decrease total number of bytes. */
+     data->length -= len;
+
+     /* Return number of bytes read. */
+     if (read_out)
+          *read_out = len;
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_PeekData( IDirectFBDataBuffer *thiz,
+                                       unsigned int         length,
+                                       int                  offset,
+                                       void                *data_buffer,
+                                       unsigned int        *read_out )
+{
+     unsigned int len;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     if (!data_buffer || !length || offset < 0)
+          return DFB_INVARG;
+
+     pthread_mutex_lock( &data->chunks_mutex );
+
+     if (!data->chunks || (unsigned int) offset >= data->length) {
+          pthread_mutex_unlock( &data->chunks_mutex );
+          return data->finished ? DFB_EOF : DFB_BUFFEREMPTY;
+     }
+
+     /* Calculate maximum number of bytes to be read. */
+     len = MIN( length, data->length - offset );
+
+     /* Read data from chunks (non-destructive). */
+     ReadChunkData( data, data_buffer, offset, len, false );
+
+     /* Return number of bytes read. */
+     if (read_out)
+          *read_out = len;
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_HasData( IDirectFBDataBuffer *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+          
+     /* If there's no chunk there's no data. */
+     if (!data->chunks)
+          return data->finished ? DFB_EOF : DFB_BUFFEREMPTY;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBDataBuffer_Streamed_PutData( IDirectFBDataBuffer *thiz,
+                                      const void          *data_buffer,
+                                      unsigned int         length )
+{
+     DataChunk *chunk;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBDataBuffer_Streamed)
+
+     /* Check arguments. */
+     if (!data_buffer || !length)
+          return DFB_INVARG;
+
+     /* Fail if Finish() has been called. */
+     if (data->finished)
+          return DFB_UNSUPPORTED;
+
+     /* Create a chunk containing a copy of the provided data. */
+     chunk = create_chunk( data_buffer, length );
+     if (!chunk)
+          return DFB_NOSYSTEMMEMORY;
+
+     pthread_mutex_lock( &data->chunks_mutex );
+
+     /* Append new chunk. */
+     direct_list_append( &data->chunks, &chunk->link );
+
+     /* Increase total length. */
+     data->length += length;
+
+     pthread_cond_broadcast( &data->wait_condition );
+
+     pthread_mutex_unlock( &data->chunks_mutex );
+
+     return DFB_OK;
+}
+
+DFBResult
+IDirectFBDataBuffer_Streamed_Construct( IDirectFBDataBuffer *thiz,
+                                        CoreDFB             *core )
+{
+     DFBResult ret;
+
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBDataBuffer_Streamed)
+
+     ret = IDirectFBDataBuffer_Construct( thiz, NULL, core );
+     if (ret)
+          return ret;
+
+     direct_util_recursive_pthread_mutex_init( &data->chunks_mutex );
+     direct_util_monotonic_pthread_cond_init( &data->wait_condition );
+
+     thiz->Release                = IDirectFBDataBuffer_Streamed_Release;
+     thiz->Flush                  = IDirectFBDataBuffer_Streamed_Flush;
+     thiz->Finish                 = IDirectFBDataBuffer_Streamed_Finish;
+     thiz->SeekTo                 = IDirectFBDataBuffer_Streamed_SeekTo;
+     thiz->GetPosition            = IDirectFBDataBuffer_Streamed_GetPosition;
+     thiz->GetLength              = IDirectFBDataBuffer_Streamed_GetLength;
+     thiz->WaitForData            = IDirectFBDataBuffer_Streamed_WaitForData;
+     thiz->WaitForDataWithTimeout = IDirectFBDataBuffer_Streamed_WaitForDataWithTimeout;
+     thiz->GetData                = IDirectFBDataBuffer_Streamed_GetData;
+     thiz->PeekData               = IDirectFBDataBuffer_Streamed_PeekData;
+     thiz->HasData                = IDirectFBDataBuffer_Streamed_HasData;
+     thiz->PutData                = IDirectFBDataBuffer_Streamed_PutData;
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static void
+DestroyAllChunks( IDirectFBDataBuffer_Streamed_data *data )
+{
+     DirectLink *l, *n;
+
+     D_ASSERT( data != NULL );
+
+     /* Loop through list. */
+     direct_list_foreach_safe (l, n, data->chunks) {
+          /* Deallocate chunk. */
+          destroy_chunk( (DataChunk*) l );
+     }
+
+     /* Clear lists. */
+     data->chunks = NULL;
+}
+
+static void
+ReadChunkData( IDirectFBDataBuffer_Streamed_data *data,
+               void                              *buffer,
+               unsigned int                       offset,
+               unsigned int                       length,
+               bool                               flush )
+{
+     DirectLink *l, *n;
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( buffer != NULL );
+
+     /* Loop through links. */
+     direct_list_foreach_safe (l, n, data->chunks) {
+          unsigned int  len;
+          unsigned int  off   = 0;
+          DataChunk    *chunk = (DataChunk*) l;
+
+          /* Is there data to be skipped? */
+          if (offset) {
+               /* Calculate number of bytes to be skipped from this chunk. */
+               off = MIN( offset, chunk->length - chunk->done );
+
+               /* Decrease number of bytes to skipped. */
+               offset -= off;
+          }
+
+          /* Calculate number of bytes to be read from this chunk. */
+          len = MIN( length, chunk->length - chunk->done - off );
+
+          /* Can we read from this chunk? */
+          if (len) {
+               /* Copy as many bytes as possible. */
+               direct_memcpy( buffer, chunk->data + chunk->done + off, len );
+
+               /* Increase write pointer. */
+               buffer += len;
+
+               /* Decrease number of bytes to read. */
+               length -= len;
+          }
+
+          /* Destructive read? */
+          if (flush) {
+               /* Increase number of consumed bytes. */
+               chunk->done += len + off;
+
+               /* Completely consumed? */
+               if (chunk->done == chunk->length) {
+                    /* Remove the chunk from the list. */
+                    direct_list_remove( &data->chunks, l );
+
+                    /* Deallocate chunk. */
+                    destroy_chunk( chunk );
+               }
+          }
+     }
+
+     D_ASSERT( length == 0 );
+     D_ASSERT( offset == 0 );
+}
+
+/******************************************************************************/
+
+static DataChunk *
+create_chunk( const void *data, int length )
+{
+     DataChunk *chunk;
+
+     D_ASSERT( data != NULL );
+     D_ASSERT( length > 0 );
+
+     /* Allocate chunk information. */
+     chunk = D_CALLOC( 1, sizeof(DataChunk) );
+     if (!chunk)
+          return NULL;
+
+     /* Allocate chunk data. */
+     chunk->data = D_MALLOC( length );
+     if (!chunk->data) {
+          D_FREE( chunk );
+          return NULL;
+     }
+
+     /* Fill chunk data. */
+     direct_memcpy( chunk->data, data, length );
+
+     /* Remember chunk length. */
+     chunk->length = length;
+
+     return chunk;
+}
+
+static void
+destroy_chunk( DataChunk *chunk )
+{
+     D_ASSERT( chunk != NULL );
+     D_ASSERT( chunk->data != NULL );
+
+     /* Deallocate chunk data. */
+     D_FREE( chunk->data );
+
+     /* Deallocate chunk information. */
+     D_FREE( chunk );
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbfont.c b/Source/DirectFB/src/media/idirectfbfont.c
new file mode 100755
index 0000000..4ce0946
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbfont.c
@@ -0,0 +1,965 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <math.h>
+
+#include <sys/fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include "directfb.h"
+
+#include "core/coretypes.h"
+
+#include "core/fonts.h"
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/tree.h>
+#include <direct/utf8.h>
+
+#include <media/idirectfbfont.h>
+#include <media/idirectfbdatabuffer.h>
+
+#include "misc/util.h"
+
+
+D_DEBUG_DOMAIN( Font, "IDirectFBFont", "DirectFB Font Interface" );
+
+/**********************************************************************************************************************/
+
+void
+IDirectFBFont_Destruct( IDirectFBFont *thiz )
+{
+     IDirectFBFont_data *data = (IDirectFBFont_data*)thiz->priv;
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     dfb_font_destroy (data->font);
+
+     /* release memory, if any */
+     if (data->content) {
+          if (data->content_mapped)
+               munmap( data->content, data->content_size );
+          else
+               D_FREE( data->content );
+     }
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**********************************************************************************************************************/
+
+/*
+ * increments reference count of font
+ */
+static DirectResult
+IDirectFBFont_AddRef( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+/*
+ * decrements reference count, destructs interface data if reference count is 0
+ */
+static DirectResult
+IDirectFBFont_Release( IDirectFBFont *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (--data->ref == 0)
+          IDirectFBFont_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+/*
+ * Get the distance from the baseline to the top.
+ */
+static DFBResult
+IDirectFBFont_GetAscender( IDirectFBFont *thiz, int *ascender )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!ascender)
+          return DFB_INVARG;
+
+     *ascender = data->font->ascender;
+
+     return DFB_OK;
+}
+
+/*
+ * Get the distance from the baseline to the bottom.
+ * This is a negative value!
+ */
+static DFBResult
+IDirectFBFont_GetDescender( IDirectFBFont *thiz, int *descender )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!descender)
+          return DFB_INVARG;
+
+     *descender = data->font->descender;
+
+     return DFB_OK;
+}
+
+/*
+ * Get the height of this font.
+ */
+static DFBResult
+IDirectFBFont_GetHeight( IDirectFBFont *thiz, int *height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!height)
+          return DFB_INVARG;
+
+     *height = data->font->height;
+
+     return DFB_OK;
+}
+
+/*
+ * Get the line spacing vector of this font.
+ */
+static DFBResult
+IDirectFBFont_GetLineSpacingVector( IDirectFBFont *thiz, int *xspacing, int *yspacing )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!xspacing && !yspacing)
+          return DFB_INVARG;
+
+     if (xspacing) {
+          *xspacing = - data->font->height * data->font->up_unit_x;
+     }
+
+     if (yspacing) {
+          *yspacing = - data->font->height * data->font->up_unit_y;
+     }
+
+     return DFB_OK;
+}
+
+/*
+ * Get the maximum character width.
+ */
+static DFBResult
+IDirectFBFont_GetMaxAdvance( IDirectFBFont *thiz, int *maxadvance )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!maxadvance)
+          return DFB_INVARG;
+
+     *maxadvance = data->font->maxadvance;
+
+     return DFB_OK;
+}
+
+/*
+ * Get the kerning to apply between two glyphs.
+ */
+static DFBResult
+IDirectFBFont_GetKerning( IDirectFBFont *thiz,
+                          unsigned int prev, unsigned int current,
+                          int *kern_x, int *kern_y)
+{
+     DFBResult     ret;
+     CoreFont     *font;
+     int           x = 0, y = 0;
+     unsigned int  prev_index, current_index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!kern_x && !kern_y)
+          return DFB_INVARG;
+
+     font = data->font;
+
+     dfb_font_lock( font );
+
+     if (font->GetKerning) {
+          ret = dfb_font_decode_character( font, data->encoding, prev, &prev_index );
+          if (ret)
+               goto error;
+
+          ret = dfb_font_decode_character( font, data->encoding, current, ¤t_index );
+          if (ret)
+               goto error;
+
+          ret = font->GetKerning (font, prev_index, current_index, &x, &y);
+          if (ret)
+               goto error;
+     }
+
+     dfb_font_unlock( font );
+
+     if (kern_x)
+          *kern_x = x;
+     if (kern_y)
+          *kern_y = y;
+
+     return DFB_OK;
+
+
+error:
+     dfb_font_unlock( font );
+
+     return ret;
+}
+
+/*
+ * Get the logical and ink extents of the specified string.
+ */
+static DFBResult
+IDirectFBFont_GetStringExtents( IDirectFBFont *thiz,
+                                const char *text, int bytes,
+                                DFBRectangle *logical_rect,
+                                DFBRectangle *ink_rect )
+{
+     DFBResult  ret;
+     CoreFont  *font;
+     int        xbaseline = 0;
+     int        ybaseline = 0;
+
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+
+     if (!text)
+          return DFB_INVARG;
+
+     if (!logical_rect && !ink_rect)
+          return DFB_INVARG;
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (ink_rect)
+          memset (ink_rect, 0, sizeof (DFBRectangle));
+
+     font = data->font;
+
+     dfb_font_lock( font );
+
+     if (bytes > 0) {
+          int          i, num;
+          unsigned int prev  = 0;
+          unsigned int indices[bytes];
+
+          /* Decode string to character indices. */
+          ret = dfb_font_decode_text( font, data->encoding, text, bytes, indices, &num );
+          if (ret) {
+               dfb_font_unlock( font );
+               return ret;
+          }
+
+          for (i=0; i<num; i++) {
+               unsigned int   current = indices[i];
+               CoreGlyphData *glyph;
+
+               if (dfb_font_get_glyph_data( font, current, 0, &glyph ) == DFB_OK) {  // FIXME: support font layers
+                    int kx, ky = 0;
+
+                    if (prev && font->GetKerning &&
+                        font->GetKerning( font, prev, current, &kx, &ky ) == DFB_OK) {
+                         xbaseline += kx;
+                         ybaseline += ky;
+                    }
+
+                    if (ink_rect) {
+                         DFBRectangle glyph_rect = { xbaseline + glyph->left,
+                              ybaseline + glyph->top,
+                              glyph->width, glyph->height};
+                         dfb_rectangle_union (ink_rect, &glyph_rect);
+                    }
+
+                    xbaseline += glyph->xadvance;
+                    ybaseline += glyph->yadvance;
+               }
+
+               prev = current;
+          }
+     }
+
+     if (logical_rect) {
+          // We already have the text baseline vector in (xbaseline,ybaseline).
+          // Now find the ascender and descender vectors:
+          int xascender =  font->ascender * font->up_unit_x;
+          int yascender =  font->ascender * font->up_unit_y;
+          int xdescender = font->descender * font->up_unit_x;
+          int ydescender = font->descender * font->up_unit_y;
+
+          // Now find top/bottom left/right points relative to the text:
+          int top_left_x     = xascender;
+          int top_left_y     = yascender;
+          int bottom_left_x  = xdescender;
+          int bottom_left_y  = ydescender;
+          int top_right_x    = top_left_x + xbaseline;
+          int top_right_y    = top_left_y + ybaseline;
+          int bottom_right_x = bottom_left_x + xbaseline;
+          int bottom_right_y = bottom_left_y + ybaseline;
+
+          // The logical rectangle is the bounding-box of these points:
+#define MIN4(a,b,c,d) (MIN(MIN((a),(b)),MIN((c),(d))))
+#define MAX4(a,b,c,d) (MAX(MAX((a),(b)),MAX((c),(d))))
+          logical_rect->x = MIN4(top_left_x, bottom_left_x, top_right_x, bottom_right_x);
+          logical_rect->y = MIN4(top_left_y, bottom_left_y, top_right_y, bottom_right_y);
+          logical_rect->w = MAX4(top_left_x, bottom_left_x, top_right_x, bottom_right_x) - logical_rect->x;
+          logical_rect->h = MAX4(top_left_y, bottom_left_y, top_right_y, bottom_right_y) - logical_rect->y;
+     }
+
+     if (ink_rect) {
+          if (ink_rect->w < 0) {  /* PBE FIXME what is this doing? */
+               ink_rect->x += ink_rect->w;
+               ink_rect->w = -ink_rect->w;
+          }
+          ink_rect->x += font->ascender * font->up_unit_x;
+          ink_rect->y += font->ascender * font->up_unit_y;
+     }
+
+     dfb_font_unlock( font );
+
+     return DFB_OK;
+}
+
+/*
+ * Get the logical width of the specified string.
+ */
+static DFBResult
+IDirectFBFont_GetStringWidth( IDirectFBFont *thiz,
+                              const char    *text,
+                              int            bytes,
+                              int           *ret_width )
+{
+     DFBResult ret;
+     int       xsize = 0;
+     int       ysize = 0;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!text || !ret_width)
+          return DFB_INVARG;
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (bytes > 0) {
+          int           i, num, kx, ky;
+          unsigned int  prev = 0;
+          unsigned int  indices[bytes];
+          CoreFont     *font = data->font;
+
+          dfb_font_lock( font );
+
+          /* Decode string to character indices. */
+          ret = dfb_font_decode_text( font, data->encoding, text, bytes, indices, &num );
+          if (ret) {
+               dfb_font_unlock( font );
+               return ret;
+          }
+
+          /* Calculate string width. */
+          for (i=0; i<num; i++) {
+               unsigned int   current = indices[i];
+               CoreGlyphData *glyph;
+
+               if (dfb_font_get_glyph_data( font, current, 0, &glyph ) == DFB_OK) {  // FIXME: support font layers
+                    xsize += glyph->xadvance;
+                    ysize += glyph->yadvance;
+
+                    if (prev && font->GetKerning &&
+                        font->GetKerning( font, prev, current, &kx, &ky ) == DFB_OK) {
+                         xsize += kx;
+                         ysize += ky;
+                    }
+               }
+
+               prev = current;
+          }
+
+          dfb_font_unlock( font );
+     }
+
+     if (!ysize) {
+          *ret_width = xsize;
+     }
+     else if (!xsize) {
+          *ret_width = ysize;
+     }
+     else {
+          *ret_width = sqrt(xsize*xsize + ysize*ysize);
+     }
+
+     return DFB_OK;
+}
+
+/*
+ * Get the extents of the specified glyph.
+ */
+static DFBResult
+IDirectFBFont_GetGlyphExtents( IDirectFBFont *thiz,
+                               unsigned int   character,
+                               DFBRectangle  *rect,
+                               int           *advance )
+{
+     DFBResult      ret;
+     CoreFont      *font;
+     CoreGlyphData *glyph;
+     unsigned int   index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!rect && !advance)
+          return DFB_INVARG;
+
+     font = data->font;
+
+     dfb_font_lock( font );
+
+     ret = dfb_font_decode_character( font, data->encoding, character, &index );
+     if (ret) {
+          dfb_font_unlock( font );
+          return ret;
+     }
+
+     if (dfb_font_get_glyph_data (font, index, 0, &glyph) != DFB_OK) {     // FIXME: support font layers
+          if (rect)
+               rect->x = rect->y = rect->w = rect->h = 0;
+
+          if (advance)
+               *advance = 0;
+     }
+     else {
+          if (rect) {
+               rect->x = glyph->left;
+               rect->y = glyph->top - font->ascender;
+               rect->w = glyph->width;
+               rect->h = glyph->height;
+          }
+
+          if (advance)
+               *advance = glyph->xadvance;
+     }
+
+     dfb_font_unlock( font );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_GetStringBreak( IDirectFBFont *thiz,
+                              const char    *text,
+                              int            bytes,
+                              int            max_width,
+                              int           *ret_width, 
+                              int           *ret_str_length,
+                              const char   **ret_next_line)
+{
+     DFBResult      ret;
+     CoreFont      *font;
+     const u8      *string;
+     const u8      *end;
+     CoreGlyphData *glyph;
+     int            kern_x;
+     int            kern_y;
+     int            length = 0;
+     int            xsize = 0;
+     int            ysize = 0;
+     int            width = 0;
+     unichar        current;
+     unsigned int   index;
+     unsigned int   prev  = 0;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (!text || !ret_next_line || !ret_str_length || !ret_width)
+          return DFB_INVARG;
+
+     /* FIXME: Try to change the font module API *slightly* to support this. */
+     if (data->encoding != DTEID_UTF8)
+          return DFB_UNSUPPORTED;
+
+     if (bytes < 0)
+          bytes = strlen (text);
+
+     if (!bytes) {
+          *ret_next_line = NULL;
+          *ret_str_length = 0;
+          *ret_width = 0;
+
+          return DFB_OK;
+     }
+
+     font   = data->font;
+     string = (const u8*) text;
+     end    = string + bytes;
+     *ret_next_line = NULL;
+
+     dfb_font_lock( font );
+
+     do {
+          *ret_width = width;
+          length ++;          
+
+          current = DIRECT_UTF8_GET_CHAR( string );
+
+          string += DIRECT_UTF8_SKIP( string[0] );
+
+          if (current == ' ' || current == 0x0a) {
+               *ret_next_line = (const char*) string;
+               *ret_str_length = length;
+               *ret_width = width;
+          }
+
+          ret = dfb_font_decode_character( font, data->encoding, current, &index );
+          if (ret)
+               continue;
+
+          ret = dfb_font_get_glyph_data( font, index, 0, &glyph );    // FIXME: support font layers
+          if (ret)
+               continue;
+          
+          xsize += glyph->xadvance;
+          ysize += glyph->yadvance;
+
+          if (prev && font->GetKerning && font->GetKerning( font, prev, index, &kern_x, &kern_y) == DFB_OK) {
+               xsize += kern_x;
+               ysize += kern_y;
+          }
+
+          if (!ysize) {
+               width = xsize;
+          }
+          else if (!xsize) {
+               width = ysize;
+          }
+          else {
+               width = sqrt(xsize*xsize + ysize*ysize);
+          }
+
+          prev = index;
+     } while (width < max_width && string < end && current != 0x0a);
+
+     dfb_font_unlock( font );
+
+     if (width<max_width && string >= end) {
+          *ret_next_line = NULL;
+          *ret_str_length = length;
+          *ret_width = width;
+
+          return DFB_OK;
+     }
+
+     if (*ret_next_line == NULL) {
+          if (length == 1) {
+               *ret_str_length = length;
+               *ret_next_line = (const char*) string;
+               *ret_width = width;
+          } else {
+               *ret_str_length = length-1;
+               *ret_next_line = (const char*) string-1;
+               /* ret_width already set in the loop */
+          }
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_SetEncoding( IDirectFBFont     *thiz,
+                           DFBTextEncodingID  encoding )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p, %d )\n", __FUNCTION__, thiz, encoding );
+
+     if (encoding > data->font->last_encoding)
+          return DFB_IDNOTFOUND;
+
+     data->encoding = encoding;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_EnumEncodings( IDirectFBFont           *thiz,
+                             DFBTextEncodingCallback  callback,
+                             void                    *context )
+{
+     int       i;
+     CoreFont *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (!callback)
+          return DFB_INVARG;
+
+     D_DEBUG_AT( Font, "%s( %p, %p, %p )\n", __FUNCTION__, thiz, callback, context );
+
+     font = data->font;
+
+     if (callback( DTEID_UTF8, "UTF8", context ) == DFENUM_OK) {
+          for (i=DTEID_OTHER; i<=font->last_encoding; i++) {
+               if (callback( i, font->encodings[i]->name, context ) != DFENUM_OK)
+                    break;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBFont_FindEncoding( IDirectFBFont     *thiz,
+                            const char        *name,
+                            DFBTextEncodingID *ret_id )
+{
+     int       i;
+     CoreFont *font;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     if (!name || !ret_id)
+          return DFB_INVARG;
+
+     D_DEBUG_AT( Font, "%s( %p, '%s', %p )\n", __FUNCTION__, thiz, name, ret_id );
+
+     if (!strcasecmp( name, "UTF8" )) {
+          *ret_id = DTEID_UTF8;
+          return DFB_OK;
+     }
+
+     font = data->font;
+
+     for (i=DTEID_OTHER; i<=font->last_encoding; i++) {
+          if (!strcasecmp( name, font->encodings[i]->name )) {
+               *ret_id = i;
+               return DFB_OK;
+          }
+     }
+
+     return DFB_IDNOTFOUND;
+}
+
+/*
+ * Get the extents of the specified glyph.
+ */
+static DFBResult
+IDirectFBFont_GetGlyphExtentsXY( IDirectFBFont *thiz,
+                                 unsigned int   character,
+                                 DFBRectangle  *rect,
+                                 int           *xadvance,
+                                 int           *yadvance )
+{
+     DFBResult      ret;
+     CoreFont      *font;
+     CoreGlyphData *glyph;
+     unsigned int   index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!rect && !xadvance && !yadvance)
+          return DFB_INVARG;
+
+     font = data->font;
+
+     dfb_font_lock( font );
+
+     ret = dfb_font_decode_character( font, data->encoding, character, &index );
+     if (ret) {
+          dfb_font_unlock( font );
+          return ret;
+     }
+
+     if (dfb_font_get_glyph_data (font, index, 0, &glyph) != DFB_OK) {     // FIXME: support font layers
+          if (rect)
+               rect->x = rect->y = rect->w = rect->h = 0;
+
+          if (xadvance)
+               *xadvance = 0;
+
+          if (yadvance)
+               *yadvance = 0;
+     }
+     else {
+          if (rect) {
+               rect->x = glyph->left + font->ascender * font->up_unit_x;
+               rect->y = glyph->top  + font->ascender * font->up_unit_y;
+               rect->w = glyph->width;
+               rect->h = glyph->height;
+          }
+
+          if (xadvance)
+               *xadvance = glyph->xadvance;
+
+          if (yadvance)
+               *yadvance = glyph->yadvance;
+     }
+
+     dfb_font_unlock( font );
+
+     return DFB_OK;
+}
+
+/*
+ * Get the description of the font.
+ */
+static DFBResult
+IDirectFBFont_GetDescription( IDirectFBFont      *thiz,
+                              DFBFontDescription *ret_description )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBFont)
+
+     D_DEBUG_AT( Font, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!ret_description)
+          return DFB_INVARG;
+
+     *ret_description = data->font->description;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+IDirectFBFont_Construct( IDirectFBFont *thiz, CoreFont *font )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBFont)
+
+     data->ref = 1;
+     data->font = font;
+
+     thiz->AddRef = IDirectFBFont_AddRef;
+     thiz->Release = IDirectFBFont_Release;
+     thiz->GetAscender = IDirectFBFont_GetAscender;
+     thiz->GetDescender = IDirectFBFont_GetDescender;
+     thiz->GetHeight = IDirectFBFont_GetHeight;
+     thiz->GetMaxAdvance = IDirectFBFont_GetMaxAdvance;
+     thiz->GetKerning = IDirectFBFont_GetKerning;
+     thiz->GetStringWidth = IDirectFBFont_GetStringWidth;
+     thiz->GetStringExtents = IDirectFBFont_GetStringExtents;
+     thiz->GetGlyphExtents = IDirectFBFont_GetGlyphExtents;
+     thiz->GetStringBreak = IDirectFBFont_GetStringBreak;
+     thiz->SetEncoding = IDirectFBFont_SetEncoding;
+     thiz->EnumEncodings = IDirectFBFont_EnumEncodings;
+     thiz->FindEncoding = IDirectFBFont_FindEncoding;
+     thiz->GetLineSpacingVector = IDirectFBFont_GetLineSpacingVector;
+     thiz->GetGlyphExtentsXY = IDirectFBFont_GetGlyphExtentsXY;
+     thiz->GetDescription = IDirectFBFont_GetDescription;
+
+     return DFB_OK;
+}
+
+static DFBResult
+try_map_file( IDirectFBDataBuffer_data   *buffer_data,
+              IDirectFBFont_ProbeContext *ctx )
+{
+     /* try to map the "file" content first */
+     if (!access( buffer_data->filename, O_RDONLY )) {
+          int         fd;
+          struct stat st;
+
+          fd = open( buffer_data->filename, O_RDONLY );
+          if (fd < 0) {
+               D_PERROR( "IDirectFBFont: Could not open '%s'\n", buffer_data->filename );
+               return DFB_IO;
+          }
+
+          if (fstat( fd, &st )) {
+               D_PERROR( "IDirectFBFont: Could not stat '%s'\n", buffer_data->filename );
+               close( fd );
+               return DFB_IO;
+          }
+
+          ctx->content = mmap( NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0 );
+          if (ctx->content == MAP_FAILED) {
+               D_PERROR( "IDirectFBFont: Could not mmap '%s'\n", buffer_data->filename );
+               close( fd );
+               return DFB_IO;
+          }
+
+          ctx->content_size   = st.st_size;
+          ctx->content_mapped = true;
+
+          close( fd );
+
+          return DFB_OK;
+     }
+
+     return DFB_UNSUPPORTED;
+}
+ 
+static void
+unmap_or_free( IDirectFBFont_ProbeContext *ctx )
+{
+     if (ctx->content) {
+          if (ctx->content_mapped)
+               munmap( ctx->content, ctx->content_size );
+          else
+               D_FREE( ctx->content );
+     }
+}
+ 
+DFBResult
+IDirectFBFont_CreateFromBuffer( IDirectFBDataBuffer       *buffer,
+                                CoreDFB                   *core,
+                                const DFBFontDescription  *desc,
+                                IDirectFBFont            **interface )
+{
+     DFBResult                   ret;
+     DirectInterfaceFuncs       *funcs = NULL;
+     IDirectFBDataBuffer_data   *buffer_data;
+     IDirectFBFont              *ifont;
+     IDirectFBFont_ProbeContext  ctx = {0};
+
+     /* Get the private information of the data buffer. */
+     buffer_data = (IDirectFBDataBuffer_data*) buffer->priv;
+     if (!buffer_data)
+          return DFB_DEAD;
+
+     /* Provide a fallback for image providers without data buffer support. */
+     ctx.filename = buffer_data->filename;
+
+     /* try to map the "file" content first */
+     if (try_map_file( buffer_data, &ctx ) != DFB_OK) {
+          /* try to load the "file" content from the buffer */
+     
+          /* we need to be able to seek (this implies non-streamed,
+             so we also know the size) so we can reuse the buffer */
+          if (buffer->SeekTo( buffer, 0 ) == DFB_OK) {
+               unsigned int size, got;
+     
+               /* get the "file" length */
+               buffer->GetLength( buffer, &size );
+     
+               ctx.content = D_MALLOC( size );
+               if (!ctx.content)
+                    return DR_NOLOCALMEMORY;
+     
+               ctx.content_size = 0;
+     
+               while (ctx.content_size < size) {
+                    unsigned int get = size - ctx.content_size;
+     
+                    if (get > 8192)
+                         get = 8192;
+     
+                    ret = buffer->WaitForData( buffer, get );
+                    if (ret) {
+                         D_DERROR( ret, "%s: WaitForData failed!\n", __FUNCTION__ );
+                         break;
+                    }
+     
+                    ret = buffer->GetData( buffer, get, ctx.content + ctx.content_size, &got );
+                    if (ret) {
+                         D_DERROR( ret, "%s: GetData failed!\n", __FUNCTION__ );
+                         break;
+                    }
+     
+                    if (!got)
+                         break;
+     
+                    ctx.content_size += got;
+               }
+     
+               if (ctx.content_size != size) {
+                    D_ERROR( "%s: Got size %u differs from supposed %u!\n", __FUNCTION__, ctx.content_size, size );
+                    D_FREE( ctx.content );
+                    return DFB_FAILURE;
+               }
+          }
+     }
+
+     /* Find a suitable implementation. */
+     ret = DirectGetInterface( &funcs, "IDirectFBFont", NULL, DirectProbeInterface, &ctx );
+     if (ret) {
+          unmap_or_free( &ctx );
+          return ret;
+     }
+
+     DIRECT_ALLOCATE_INTERFACE( ifont, IDirectFBFont );
+
+     /* Construct the interface. */
+     ret = funcs->Construct( ifont, core, &ctx, desc );
+     if (ret) {
+          unmap_or_free( &ctx );
+          return ret;
+     }
+
+     /* store pointer for deletion at destroy */
+     {
+          IDirectFBFont_data *data = (IDirectFBFont_data*)(ifont->priv);
+          data->content = ctx.content;
+          data->content_size = ctx.content_size;
+          data->content_mapped = ctx.content_mapped;
+     }
+
+     *interface = ifont;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbfont.h b/Source/DirectFB/src/media/idirectfbfont.h
new file mode 100755
index 0000000..85bdb0c
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbfont.h
@@ -0,0 +1,82 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBFONT_H__
+#define __IDIRECTFBFONT_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+/*
+ * probing context
+ */
+typedef struct {
+     /* Only set if databuffer is created from file.
+        deprecated - use memory location below. */
+     const char *filename;
+
+     /* if !=NULL, pointer to the file content */
+     unsigned char *content;
+     unsigned int   content_size;
+     bool           content_mapped;
+} IDirectFBFont_ProbeContext;
+
+DFBResult
+IDirectFBFont_CreateFromBuffer( IDirectFBDataBuffer       *buffer,
+                                CoreDFB                   *core,
+                                const DFBFontDescription  *desc,
+                                IDirectFBFont            **interface );
+                                
+/**********************************************************************************************************************/
+
+/*
+ * private data struct of IDirectFBFont
+ * used by implementors of IDirectFBFont
+ */
+typedef struct {
+     int                ref;       /* reference counter    */
+     CoreFont          *font;      /* pointer to core font */
+     unsigned char     *content;   /* possible allocation, free at intf. close */
+     unsigned int       content_size;
+     bool               content_mapped;
+
+     DFBTextEncodingID  encoding;  /* text encoding */
+} IDirectFBFont_data;
+
+/*
+ * common code to construct the interface (internal usage only)
+ */
+DFBResult IDirectFBFont_Construct( IDirectFBFont *thiz, CoreFont *font );
+
+/*
+ * deinitialize font and its surfaces
+ */
+void IDirectFBFont_Destruct( IDirectFBFont *thiz );
+
+#endif
diff --git a/Source/DirectFB/src/media/idirectfbimageprovider.c b/Source/DirectFB/src/media/idirectfbimageprovider.c
new file mode 100755
index 0000000..f54319c
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbimageprovider.c
@@ -0,0 +1,167 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stddef.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <media/idirectfbimageprovider.h>
+#include <media/idirectfbdatabuffer.h>
+
+
+static DirectResult
+IDirectFBImageProvider_AddRef( IDirectFBImageProvider *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+IDirectFBImageProvider_Release( IDirectFBImageProvider *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_GetSurfaceDescription( IDirectFBImageProvider *thiz,
+                                              DFBSurfaceDescription  *ret_dsc )
+{
+     if (!ret_dsc)
+          return DFB_INVARG;
+          
+     ret_dsc->flags = DSDESC_NONE;
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_GetImageDescription( IDirectFBImageProvider *thiz,
+                                            DFBImageDescription    *ret_dsc )
+{
+     if (!ret_dsc)
+          return DFB_INVARG;
+          
+     ret_dsc->caps = DICAPS_NONE;
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_RenderTo( IDirectFBImageProvider *thiz,
+                                 IDirectFBSurface       *destination,
+                                 const DFBRectangle     *destination_rect )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_SetRenderCallback( IDirectFBImageProvider *thiz,
+                                          DIRenderCallback        callback,
+                                          void                   *callback_data )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBImageProvider_WriteBack( IDirectFBImageProvider *thiz,
+                                  IDirectFBSurface       *surface,
+                                  const DFBRectangle     *src_rect,
+                                  const char             *filename )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static void
+IDirectFBImageProvider_Construct( IDirectFBImageProvider *thiz )
+{
+     thiz->AddRef                = IDirectFBImageProvider_AddRef;
+     thiz->Release               = IDirectFBImageProvider_Release;
+     thiz->GetSurfaceDescription = IDirectFBImageProvider_GetSurfaceDescription;
+     thiz->GetImageDescription   = IDirectFBImageProvider_GetImageDescription;
+     thiz->RenderTo              = IDirectFBImageProvider_RenderTo;
+     thiz->SetRenderCallback     = IDirectFBImageProvider_SetRenderCallback;
+     thiz->WriteBack             = IDirectFBImageProvider_WriteBack;
+}
+     
+DFBResult
+IDirectFBImageProvider_CreateFromBuffer( IDirectFBDataBuffer     *buffer,
+                                         CoreDFB                 *core,
+                                         IDirectFBImageProvider **interface )
+{
+     DFBResult                            ret;
+     DirectInterfaceFuncs                *funcs = NULL;
+     IDirectFBDataBuffer_data            *buffer_data;
+     IDirectFBImageProvider              *imageprovider;
+     IDirectFBImageProvider_ProbeContext  ctx;
+
+     /* Get the private information of the data buffer. */
+     buffer_data = (IDirectFBDataBuffer_data*) buffer->priv;
+     if (!buffer_data)
+          return DFB_DEAD;
+
+     /* Clear for safety, especially header data. */
+     memset( &ctx, 0, sizeof(ctx) );
+
+     /* Provide a fallback for image providers without data buffer support. */
+     ctx.filename = buffer_data->filename;
+
+     /* Wait until 32 bytes are available. */
+     ret = buffer->WaitForData( buffer, 32 );
+     if (ret)
+          return ret;
+
+     /* Read the first 32 bytes. */
+     buffer->PeekData( buffer, 32, 0, ctx.header, NULL );
+
+     /* Find a suitable implementation. */
+     ret = DirectGetInterface( &funcs, "IDirectFBImageProvider", NULL, DirectProbeInterface, &ctx );
+     if (ret)
+          return ret;
+
+     DIRECT_ALLOCATE_INTERFACE( imageprovider, IDirectFBImageProvider );
+     
+     /* Initialize interface pointers. */
+     IDirectFBImageProvider_Construct( imageprovider );
+
+     /* Construct the interface. */
+     ret = funcs->Construct( imageprovider, buffer, core );
+     if (ret)
+          return ret;
+
+     *interface = imageprovider;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbimageprovider.h b/Source/DirectFB/src/media/idirectfbimageprovider.h
new file mode 100755
index 0000000..afbd613
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbimageprovider.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBIMAGEPROVIDER_H__
+#define __IDIRECTFBIMAGEPROVIDER_H__
+
+#include <core/coretypes.h>
+
+/*
+ * probing context
+ */
+typedef struct {
+     unsigned char  header[32];
+
+     const char    *filename; /* Only set if databuffer is created from file. */
+} IDirectFBImageProvider_ProbeContext;
+
+DFBResult
+IDirectFBImageProvider_CreateFromBuffer( IDirectFBDataBuffer     *buffer,
+                                         CoreDFB                 *core,
+                                         IDirectFBImageProvider **interface );
+
+#endif
diff --git a/Source/DirectFB/src/media/idirectfbvideoprovider.c b/Source/DirectFB/src/media/idirectfbvideoprovider.c
new file mode 100755
index 0000000..fcea1ba
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbvideoprovider.c
@@ -0,0 +1,387 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stddef.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <media/idirectfbvideoprovider.h>
+#include <media/idirectfbdatabuffer.h>
+
+
+static DirectResult
+IDirectFBVideoProvider_AddRef( IDirectFBVideoProvider *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DirectResult
+IDirectFBVideoProvider_Release( IDirectFBVideoProvider *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetCapabilities( IDirectFBVideoProvider       *thiz,
+                                        DFBVideoProviderCapabilities *ret_caps )
+{
+     if (!ret_caps)
+          return DFB_INVARG;
+          
+     *ret_caps = 0;
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetSurfaceDescription( IDirectFBVideoProvider *thiz,
+                                              DFBSurfaceDescription  *ret_dsc )
+{
+     if (!ret_dsc)
+          return DFB_INVARG;
+          
+     ret_dsc->flags = DSDESC_NONE;
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetStreamDescription( IDirectFBVideoProvider *thiz,
+                                             DFBStreamDescription   *ret_dsc )
+{
+     if (!ret_dsc)
+          return DFB_INVARG;
+          
+     memset( ret_dsc, 0, sizeof(DFBStreamDescription) );
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetBufferOccupancy( IDirectFBVideoProvider *thiz,
+                                           DFBBufferOccupancy     *ret_occ )
+{
+     if (!ret_occ)
+          return DFB_INVARG;
+          
+     memset( ret_occ, 0, sizeof(DFBBufferOccupancy) );
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetBufferThresholds( IDirectFBVideoProvider *thiz,
+                                            DFBBufferThresholds    *ret_thresh )
+{
+     if (!ret_thresh)
+          return DFB_INVARG;
+          
+     memset( ret_thresh, 0, sizeof(DFBBufferThresholds) );
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetBufferThresholds( IDirectFBVideoProvider *thiz,
+                                            DFBBufferThresholds    thresh )
+{
+    return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_PlayTo( IDirectFBVideoProvider *thiz,
+                               IDirectFBSurface       *destination,
+                               const DFBRectangle     *destination_rect,
+                               DVFrameCallback         callback,
+                               void                   *ctx )
+{    
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_Stop( IDirectFBVideoProvider *thiz )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetStatus( IDirectFBVideoProvider *thiz,
+                                  DFBVideoProviderStatus *ret_status )
+{
+     if (!ret_status)
+          return DFB_INVARG;
+          
+     *ret_status = DVSTATE_UNKNOWN;
+     
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SeekTo( IDirectFBVideoProvider *thiz,
+                               double                  seconds )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetPos( IDirectFBVideoProvider *thiz,
+                               double                 *ret_seconds )
+{
+     if (!ret_seconds)
+          return DFB_INVARG;
+          
+     *ret_seconds = 0.0;
+          
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetLength( IDirectFBVideoProvider *thiz,
+                                  double                 *ret_seconds )
+{
+     if (!ret_seconds)
+          return DFB_INVARG;
+          
+     *ret_seconds = 0.0;
+          
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetColorAdjustment( IDirectFBVideoProvider *thiz,
+                                           DFBColorAdjustment     *ret_adj )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetColorAdjustment( IDirectFBVideoProvider   *thiz,
+                                           const DFBColorAdjustment *adj )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SendEvent( IDirectFBVideoProvider *thiz,
+                                  const DFBEvent         *event )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetPlaybackFlags( IDirectFBVideoProvider        *thiz,
+                                         DFBVideoProviderPlaybackFlags  flags )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetSpeed( IDirectFBVideoProvider *thiz,
+                                 double                  multiplier )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetSpeed( IDirectFBVideoProvider *thiz,
+                                 double                 *ret_multiplier )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetVolume( IDirectFBVideoProvider *thiz,
+                                  float                   level )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetVolume( IDirectFBVideoProvider *thiz,
+                                  float                  *ret_level )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetStreamAttributes(IDirectFBVideoProvider   *thiz,
+          				    DFBStreamAttributes       attr)
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetAudioOutputs(IDirectFBVideoProvider         *thiz,
+                                       DFBVideoProviderAudioUnits*    audioUnits)
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_GetAudioOutputs(IDirectFBVideoProvider         *thiz,
+                                       DFBVideoProviderAudioUnits*    audioUnits)
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_SetAudioDelay( IDirectFBVideoProvider *thiz,
+                                 long                  delay )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_CreateEventBuffer( IDirectFBVideoProvider  *thiz,
+                                          IDirectFBEventBuffer    **buffer )
+{
+    return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_AttachEventBuffer( IDirectFBVideoProvider  *thiz,
+                                          IDirectFBEventBuffer    *buffer )
+{
+    return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_EnableEvents(IDirectFBVideoProvider         *thiz,
+                                    DFBVideoProviderEventType      mask )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_DisableEvents(IDirectFBVideoProvider         *thiz,
+                                     DFBVideoProviderEventType      mask )
+{
+    return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+IDirectFBVideoProvider_DetachEventBuffer( IDirectFBVideoProvider  *thiz,
+                                          IDirectFBEventBuffer    *buffer )
+{
+    return DFB_UNIMPLEMENTED;
+}
+
+static void
+IDirectFBVideoProvider_Construct( IDirectFBVideoProvider *thiz )
+{
+     thiz->AddRef                = IDirectFBVideoProvider_AddRef;
+     thiz->Release               = IDirectFBVideoProvider_Release;
+     thiz->GetCapabilities       = IDirectFBVideoProvider_GetCapabilities;
+     thiz->GetSurfaceDescription = IDirectFBVideoProvider_GetSurfaceDescription;
+     thiz->GetStreamDescription  = IDirectFBVideoProvider_GetStreamDescription;
+     thiz->GetBufferOccupancy    = IDirectFBVideoProvider_GetBufferOccupancy;
+     thiz->SetBufferThresholds   = IDirectFBVideoProvider_SetBufferThresholds;
+     thiz->GetBufferThresholds   = IDirectFBVideoProvider_GetBufferThresholds;
+     thiz->PlayTo                = IDirectFBVideoProvider_PlayTo;
+     thiz->Stop                  = IDirectFBVideoProvider_Stop;
+     thiz->GetStatus             = IDirectFBVideoProvider_GetStatus;
+     thiz->SeekTo                = IDirectFBVideoProvider_SeekTo;
+     thiz->GetPos                = IDirectFBVideoProvider_GetPos;
+     thiz->GetLength             = IDirectFBVideoProvider_GetLength;
+     thiz->GetColorAdjustment    = IDirectFBVideoProvider_GetColorAdjustment;
+     thiz->SetColorAdjustment    = IDirectFBVideoProvider_SetColorAdjustment;
+     thiz->SendEvent             = IDirectFBVideoProvider_SendEvent;
+     thiz->SetPlaybackFlags      = IDirectFBVideoProvider_SetPlaybackFlags;
+     thiz->SetSpeed              = IDirectFBVideoProvider_SetSpeed;
+     thiz->GetSpeed              = IDirectFBVideoProvider_GetSpeed;
+     thiz->SetVolume             = IDirectFBVideoProvider_SetVolume;
+     thiz->GetVolume             = IDirectFBVideoProvider_GetVolume;
+     thiz->SetStreamAttributes   = IDirectFBVideoProvider_SetStreamAttributes;
+     thiz->SetAudioOutputs       = IDirectFBVideoProvider_SetAudioOutputs;
+     thiz->GetAudioOutputs       = IDirectFBVideoProvider_GetAudioOutputs;
+     thiz->CreateEventBuffer     = IDirectFBVideoProvider_CreateEventBuffer;
+     thiz->AttachEventBuffer     = IDirectFBVideoProvider_AttachEventBuffer;
+     thiz->EnableEvents          = IDirectFBVideoProvider_EnableEvents;
+     thiz->DisableEvents         = IDirectFBVideoProvider_DisableEvents;
+     thiz->DetachEventBuffer     = IDirectFBVideoProvider_DetachEventBuffer;
+     thiz->SetAudioDelay         = IDirectFBVideoProvider_SetAudioDelay;
+}
+
+
+DFBResult
+IDirectFBVideoProvider_CreateFromBuffer( IDirectFBDataBuffer     *buffer,
+                                         CoreDFB                 *core,
+                                         IDirectFBVideoProvider **interface )
+{
+     DFBResult                            ret;
+     DirectInterfaceFuncs                *funcs = NULL;
+     IDirectFBDataBuffer_data            *buffer_data;
+     IDirectFBVideoProvider              *videoprovider;
+     IDirectFBVideoProvider_ProbeContext  ctx;
+
+     /* Get the private information of the data buffer. */
+     buffer_data = (IDirectFBDataBuffer_data*) buffer->priv;
+     if (!buffer_data)
+          return DFB_DEAD;
+
+     /* Provide a fallback for video providers without data buffer support. */
+     ctx.filename = buffer_data->filename;
+     ctx.buffer   = buffer;
+     
+     /* Wait until 64 bytes are available. */
+     ret = buffer->WaitForData( buffer, sizeof(ctx.header) );
+     if (ret)
+          return ret;
+
+     /* Clear context header. */
+     memset( ctx.header, 0, sizeof(ctx.header) );
+
+     /* Read the first 64 bytes. */
+     buffer->PeekData( buffer, sizeof(ctx.header), 0, ctx.header, NULL );
+
+     /* Find a suitable implementation. */
+     ret = DirectGetInterface( &funcs, "IDirectFBVideoProvider", NULL, DirectProbeInterface, &ctx );
+     if (ret)
+          return ret;
+
+     DIRECT_ALLOCATE_INTERFACE( videoprovider, IDirectFBVideoProvider );
+     
+     /* Initialize interface pointers. */
+     IDirectFBVideoProvider_Construct( videoprovider );
+
+     /* Construct the interface. */
+     ret = funcs->Construct( videoprovider, buffer, core );
+     if (ret)
+          return ret;
+
+     *interface = videoprovider;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/src/media/idirectfbvideoprovider.h b/Source/DirectFB/src/media/idirectfbvideoprovider.h
new file mode 100755
index 0000000..24e9ea1
--- /dev/null
+++ b/Source/DirectFB/src/media/idirectfbvideoprovider.h
@@ -0,0 +1,54 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBVIDEOPROVIDER_H__
+#define __IDIRECTFBVIDEOPROVIDER_H__
+
+#include <core/coretypes.h>
+
+/*
+ * probing context
+ */
+typedef struct {
+     unsigned char        header[64];
+     
+     /* Only set if databuffer is created from file. */
+     const char          *filename;
+
+     /* Usefull if provider needs more data for probing. */
+     IDirectFBDataBuffer *buffer;
+} IDirectFBVideoProvider_ProbeContext;
+
+
+DFBResult
+IDirectFBVideoProvider_CreateFromBuffer( IDirectFBDataBuffer     *buffer,
+                                         CoreDFB                 *core,
+                                         IDirectFBVideoProvider **interface );
+
+#endif
+
diff --git a/Source/DirectFB/src/misc/Makefile.am b/Source/DirectFB/src/misc/Makefile.am
new file mode 100755
index 0000000..d1e77b7
--- /dev/null
+++ b/Source/DirectFB/src/misc/Makefile.am
@@ -0,0 +1,29 @@
+## Makefile.am for DirectFB/src/misc
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DMODULEDIR=\"@MODULEDIR@\"	\
+	-DSOPATH=\"@SOPATH@\"           \
+	-DSYSCONFDIR=\"@sysconfdir@\"
+
+internalincludedir = $(INTERNALINCLUDEDIR)/misc
+
+internalinclude_HEADERS = \
+	conf.h			\
+	gfx_util.h		\
+	util.h
+
+
+noinst_LTLIBRARIES = libdirectfb_misc.la
+
+libdirectfb_misc_la_SOURCES =	\
+	conf.c			\
+	dither565.h		\
+	gfx_util.c		\
+	util.c
diff --git a/Source/DirectFB/src/misc/Makefile.in b/Source/DirectFB/src/misc/Makefile.in
new file mode 100755
index 0000000..ce04ff7
--- /dev/null
+++ b/Source/DirectFB/src/misc/Makefile.in
@@ -0,0 +1,564 @@
+# 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@
+subdir = src/misc
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_misc_la_LIBADD =
+am_libdirectfb_misc_la_OBJECTS = conf.lo gfx_util.lo util.lo
+libdirectfb_misc_la_OBJECTS = $(am_libdirectfb_misc_la_OBJECTS)
+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_misc_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_misc_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = \
+	-DMODULEDIR=\"@MODULEDIR@\"	\
+	-DSOPATH=\"@SOPATH@\"           \
+	-DSYSCONFDIR=\"@sysconfdir@\"
+
+internalincludedir = $(INTERNALINCLUDEDIR)/misc
+internalinclude_HEADERS = \
+	conf.h			\
+	gfx_util.h		\
+	util.h
+
+noinst_LTLIBRARIES = libdirectfb_misc.la
+libdirectfb_misc_la_SOURCES = \
+	conf.c			\
+	dither565.h		\
+	gfx_util.c		\
+	util.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/misc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/misc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_misc.la: $(libdirectfb_misc_la_OBJECTS) $(libdirectfb_misc_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_misc_la_OBJECTS) $(libdirectfb_misc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfx_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/misc/conf.c b/Source/DirectFB/src/misc/conf.c
new file mode 100755
index 0000000..5772ba9
--- /dev/null
+++ b/Source/DirectFB/src/misc/conf.c
@@ -0,0 +1,1947 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <direct/conf.h>
+#include <direct/log.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/conf.h>
+#include <fusion/vector.h>
+
+#include <voodoo/conf.h>
+
+#include <core/coretypes.h>
+#include <core/surface.h>
+#include <core/layers.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+D_DEBUG_DOMAIN( DirectFB_Config, "DirectFB/Config", "Runtime configuration options for DirectFB" );
+
+DFBConfig *dfb_config = NULL;
+
+static const char *config_usage =
+     "DirectFB version " DIRECTFB_VERSION "\n"
+     "\n"
+     " --dfb-help                      Output DirectFB usage information and exit\n"
+     " --dfb:<option>[,<option>]...    Pass options to DirectFB (see below)\n"
+     "\n"
+     "DirectFB options:\n"
+     "\n"
+     "  system=<system>                Specify the system (FBDev, SDL, etc.)\n"
+     "  fbdev=<device>                 Open <device> instead of /dev/fb0\n"
+     "  busid=<id>                     Specify the bus location of the graphics card (default 1:0:0)\n"
+     "  mode=<width>x<height>          Set the default resolution\n"
+     "  scaled=<width>x<height>        Scale the window to this size for 'force-windowed' apps\n"
+     "  depth=<pixeldepth>             Set the default pixel depth\n"
+     "  pixelformat=<pixelformat>      Set the default pixel format\n"
+     "  surface-shmpool-size=<kb>      Set the size of the shared memory pool used\n"
+     "                                 for shared system memory surfaces.\n"
+     "  session=<num>                  Select multi app world (zero based, -1 = new)\n"
+     "  remote=<host>[:<session>]      Select remote session to connect to\n"
+     "  primary-layer=<id>             Select an alternative primary layer\n"
+     "  primary-only                   Tell application only about the primary layer\n"
+     "  [no-]banner                    Show DirectFB Banner on startup\n"
+     "  [no-]surface-sentinel          Enable surface sentinels at the end of chunks in video memory\n"
+     "  force-windowed                 Primary surface always is a window\n"
+     "  force-desktop                  Primary surface is the desktop background\n"
+     "  [no-]hardware                  Enable/disable hardware acceleration\n"
+     "  [no-]software                  Enable/disable software fallbacks\n"
+     "  [no-]software-warn             Show warnings when doing/dropping software operations\n"
+     "  [no-]software-trace            Show every stage of the software rendering pipeline\n"
+     "  [no-]dma                       Enable DMA acceleration\n"
+     "  [no-]sync                      Do `sync()' (default=no)\n"
+#ifdef USE_MMX
+     "  [no-]mmx                       Enable mmx support\n"
+#endif
+     "  [no-]agp[=<mode>]              Enable AGP support\n"
+     "  [no-]thrifty-surface-buffers   Free sysmem instance on xfer to video memory\n"
+     "  font-format=<pixelformat>      Set the preferred font format\n"
+     "  [no-]font-premult              Enable/disable premultiplied glyph images in ARGB format\n"
+     "  [no-]deinit-check              Enable deinit check at exit\n"
+     "  block-all-signals              Block all signals\n"
+     "  [no-]vt-switch                 Allocate/switch to a new VT\n"
+     "  vt-num=<num>                   Use given VT instead of current/new one\n"
+     "  [no-]vt-switching              Allow Ctrl+Alt+<F?> (EXPERIMENTAL)\n"
+     "  [no-]graphics-vt               Put terminal into graphics mode\n"
+     "  [no-]vt                        Use VT handling code at all?\n"
+     "  mouse-source=<device>          Mouse device for serial mouse\n"
+     "  [no-]mouse-gpm-source          Enable mouse input repeated by GPM\n"
+     "  [no-]motion-compression        Mouse motion event compression\n"
+     "  mouse-protocol=<protocol>      Mouse protocol\n"
+     "  [no-]lefty                     Swap left and right mouse buttons\n"
+     "  [no-]capslock-meta             Map the CapsLock key to Meta\n"
+     "  linux-input-ir-only            Ignore all non-IR Linux Input devices\n"
+     "  [no-]linux-input-grab          Grab Linux Input devices?\n"
+     "  [no-]cursor                    Never create a cursor or handle it\n"
+     "  [no-]cursor-updates            Never show a cursor, but still handle it\n"
+     "  wm=<wm>                        Window manager module ('default' or 'unique')\n"
+     "  init-layer=<id>                Initialize layer with ID (following layer- options apply)\n"
+     "  layer-size=<width>x<height>    Set the pixel resolution\n"
+     "  layer-format=<pixelformat>     Set the pixel format\n"
+     "  layer-depth=<pixeldepth>       Set the pixel depth\n"
+     "  layer-buffer-mode=(auto|triple|backvideo|backsystem|frontonly|windows)\n"
+     "  layer-bg-none                  Disable background clear\n"
+     "  layer-bg-color=AARRGGBB        Use background color (hex)\n"
+     "  layer-bg-color-index=<index>   Use background color index (decimal)\n"
+     "  layer-bg-image=<filename>      Use background image\n"
+     "  layer-bg-tile=<filename>       Use tiled background image\n"
+     "  layer-src-key=AARRGGBB         Enable color keying (hex)\n"
+     "  layer-palette-<index>=AARRGGBB Set palette entry at index (hex)\n"
+     "  layer-rotate=<degree>          Set the layer rotation for double buffer mode (0,90,180,270)\n"
+     "  [no-]smooth-upscale            Enable/disable smooth upscaling per default\n"
+     "  [no-]smooth-downscale          Enable/disable smooth downscaling per default\n"
+     "  [no-]translucent-windows       Allow translucent windows\n"
+     "  [no-]decorations               Enable window decorations (if supported by wm)\n"
+     "  [no-]startstop                 Issue StartDrawing/StopDrawing to driver\n"
+     "  [no-]autoflip-window           Auto flip non-flipping windowed primary surfaces\n"
+     "  [no-]discard-repeat-events     Discard repeat events (option per application)\n"
+     "  videoram-limit=<amount>        Limit amount of Video RAM in kb\n"
+     "  agpmem-limit=<amount>          Limit amount of AGP memory in kb\n"
+     "  screenshot-dir=<directory>     Dump screen content on <Print> key presses\n"
+     "  video-phys=<hexaddress>        Physical start of video memory (devmem system)\n"
+     "  video-length=<bytes>           Length of video memory (devmem system)\n"
+     "  mmio-phys=<hexaddress>         Physical start of MMIO area (devmem system)\n"
+     "  mmio-length=<bytes>            Length of MMIO area (devmem system)\n"
+     "  accelerator=<id>               Accelerator ID selecting graphics driver (devmem system)\n"
+     "\n"
+     "  [no-]matrox-sgram              Use Matrox SGRAM features\n"
+     "  [no-]matrox-crtc2              Experimental Matrox CRTC2 support\n"
+     "  matrox-tv-standard=(pal|ntsc|pal-60)\n"
+     "                                 Matrox TV standard (default=pal)\n"
+     "  matrox-cable-type=(composite|scart-rgb|scart-composite)\n"
+     "                                 Matrox cable type (default=composite)\n"
+     "  h3600-device=<device>          Use this device for the H3600 TS driver\n"
+     "  mut-device=<device>            Use this device for the MuTouch driver\n"
+     "  zytronic-device=<device>       Use this device for the Zytronic driver\n"
+     "  elo-device=<device>            Use this device for the Elo driver\n"
+     "  penmount-device=<device>       Use this device for the PenMount driver\n"
+     "  linux-input-devices=<device>[[,<device>]...]\n"
+     "                                 Use these devices for the Linux Input driver\n"
+     "  tslib-devices=<device>[[,<device>]...]\n"
+     "                                 Use these devices for the tslib driver\n"
+     "  unichrome-revision=<rev>       Override unichrome hardware revision\n"
+     "  i8xx_overlay_pipe_b            Redirect videolayer to pixelpipe B\n"
+     "  include=<config file>          Include the specified file, relative to the current file\n"
+     "  flip-notify-max-latency=<ms>   Set maximum FlipNotify latency (ms from Flip til Notify)\n"
+     "\n"
+     " Window surface swapping policy:\n"
+     "  window-surface-policy=(auto|videohigh|videolow|systemonly|videoonly)\n"
+     "     auto:       DirectFB decides depending on hardware.\n"
+     "     videohigh:  Swapping system/video with high priority.\n"
+     "     videolow:   Swapping system/video with low priority.\n"
+     "     systemonly: Window surface is always stored in system memory.\n"
+     "     videoonly:  Window surface is always stored in video memory.\n"
+     "\n"
+     " Desktop buffer mode:\n"
+     "  desktop-buffer-mode=(auto|triple|backvideo|backsystem|frontonly|windows)\n"
+     "     auto:       DirectFB decides depending on hardware.\n"
+     "     triple:     Triple buffering (video only).\n"
+     "     backvideo:  Front and back buffer are video only.\n"
+     "     backsystem: Back buffer is system only.\n"
+     "     frontonly:  There is no back buffer.\n"
+     "     windows:    Special mode with window buffers directly displayed.\n"
+     "\n"
+     " Force synchronization of vertical retrace:\n"
+     "  vsync-after:   Wait for the vertical retrace after flipping.\n"
+     "  vsync-none:    disable polling for vertical retrace.\n"
+     "\n";
+
+/**********************************************************************************************************************/
+
+/* serial mouse device names */
+#define DEV_NAME     "/dev/mouse"
+#define DEV_NAME_GPM "/dev/gpmdata"
+
+/**********************************************************************************************************************/
+
+DFBSurfacePixelFormat
+dfb_config_parse_pixelformat( const char *format )
+{
+     int    i;
+     size_t length = strlen(format);
+
+     for (i=0; dfb_pixelformat_names[i].format != DSPF_UNKNOWN; i++) {
+          if (!strcasecmp( format, dfb_pixelformat_names[i].name ))
+               return dfb_pixelformat_names[i].format;
+     }
+
+     for (i=0; dfb_pixelformat_names[i].format != DSPF_UNKNOWN; i++) {
+          if (!strncasecmp( format, dfb_pixelformat_names[i].name, length ))
+               return dfb_pixelformat_names[i].format;
+     }
+
+     return DSPF_UNKNOWN;
+}
+
+/**********************************************************************************************************************/
+
+static void
+print_config_usage( void )
+{
+     fprintf( stderr, "%s%s%s", config_usage, fusion_config_usage, direct_config_usage );
+}
+
+static DFBResult
+parse_args( const char *args )
+{
+     char *buf = alloca( strlen(args) + 1 );
+
+     strcpy( buf, args );
+
+     while (buf && buf[0]) {
+          DFBResult  ret;
+          char      *value;
+          char      *next;
+
+          if ((next = strchr( buf, ',' )) != NULL)
+               *next++ = '\0';
+
+          if (strcmp (buf, "help") == 0) {
+               print_config_usage();
+               exit(1);
+          }
+
+          if (strcmp (buf, "memcpy=help") == 0) {
+               direct_print_memcpy_routines();
+               exit(1);
+          }
+
+          if ((value = strchr( buf, '=' )) != NULL)
+               *value++ = '\0';
+
+          ret = dfb_config_set( buf, value );
+          switch (ret) {
+               case DFB_OK:
+                    break;
+               case DFB_UNSUPPORTED:
+                    D_ERROR( "DirectFB/Config: Unknown option '%s'!\n", buf );
+                    break;
+               default:
+                    return ret;
+          }
+
+          buf = next;
+     }
+
+     return DFB_OK;
+}
+
+static void config_values_parse( FusionVector *vector, const char *arg )
+{
+     char *values = D_STRDUP( arg );
+     char *s      = values;
+     char *r, *p  = NULL;
+
+     if (!values) {
+          D_OOM();
+          return;
+     }
+
+     while ((r = strtok_r( s, ",", &p ))) {
+          direct_trim( &r );
+
+          r = D_STRDUP( r );
+          if (!r)
+               D_OOM();
+          else
+               fusion_vector_add( vector, r );
+
+          s = NULL;
+     }
+
+     D_FREE( values );
+}
+
+static void config_values_free( FusionVector *vector )
+{
+     char *value;
+     int   i;
+
+     fusion_vector_foreach (value, i, *vector)
+          D_FREE( value );
+
+     fusion_vector_destroy( vector );
+     fusion_vector_init( vector, 2, NULL );
+}
+
+static int config_read_cmdline( char *cmdbuf, int size, FILE *f )
+{
+     int ret = 0;
+     int len = 0;
+     
+     ret = fread( cmdbuf, 1, 1, f );
+       
+     /* empty dividing 0 */
+     if( ret==1 && *cmdbuf==0 ) {
+          ret = fread( cmdbuf, 1, 1, f );
+     }
+
+     while(ret==1 && len<(size-1)) {
+          len++;
+          ret = fread( ++cmdbuf, 1, 1, f );
+          if( *cmdbuf == 0 )
+               break;
+     }
+     
+     if( len ) {
+          cmdbuf[len]=0;
+     }
+
+     return  len != 0;
+}
+
+/*
+ * The following function isn't used because the configuration should
+ * only go away if the application is completely terminated. In that case
+ * the memory is freed anyway.
+ */
+
+#if 0
+static void config_cleanup( void )
+{
+     if (!dfb_config) {
+          D_BUG("config_cleanup() called with no config allocated!");
+          return;
+     }
+
+     if (dfb_config->fb_device)
+          D_FREE( dfb_config->fb_device );
+
+     if (dfb_config->layer_bg_filename)
+          D_FREE( dfb_config->layer_bg_filename );
+
+     D_FREE( dfb_config );
+     dfb_config = NULL;
+}
+#endif
+
+/*
+ * allocates config and fills it with defaults
+ */
+static void config_allocate( void )
+{
+     int i;
+
+     if (dfb_config)
+          return;
+
+     dfb_config = (DFBConfig*) calloc( 1, sizeof(DFBConfig) );
+
+     for (i=0; i<D_ARRAY_SIZE(dfb_config->layers); i++) {
+          dfb_config->layers[i].src_key_index          = -1;
+
+          dfb_config->layers[i].background.color.a     = 0;
+          dfb_config->layers[i].background.color.r     = 0;
+          dfb_config->layers[i].background.color.g     = 0;
+          dfb_config->layers[i].background.color.b     = 0;
+          dfb_config->layers[i].background.color_index = -1;
+          dfb_config->layers[i].background.mode        = DLBM_COLOR;
+     }
+
+     dfb_config->layers[0].init               = true;
+     dfb_config->layers[0].background.color.a = 0xff;
+     dfb_config->layers[0].background.color.r = 0xc0;
+     dfb_config->layers[0].background.color.g = 0xb0;
+     dfb_config->layers[0].background.color.b = 0x90;
+     dfb_config->layers[0].stacking           = (1 << DWSC_UPPER)  |
+                                                (1 << DWSC_MIDDLE) |
+                                                (1 << DWSC_LOWER);
+
+
+     dfb_config->pci.bus                  = 1;
+     dfb_config->pci.dev                  = 0;
+     dfb_config->pci.func                 = 0;
+
+     dfb_config->banner                   = true;
+     dfb_config->deinit_check             = true;
+     dfb_config->mmx                      = true;
+     dfb_config->vt                       = true;
+     dfb_config->vt_switch                = true;
+     dfb_config->vt_num                   = -1;
+     dfb_config->vt_switching             = true;
+     dfb_config->kd_graphics              = true;
+     dfb_config->translucent_windows      = true;
+     dfb_config->font_premult             = true;
+     dfb_config->mouse_motion_compression = false;
+     dfb_config->mouse_gpm_source         = false;
+     dfb_config->mouse_source             = D_STRDUP( DEV_NAME );
+     dfb_config->linux_input_grab         = false;
+     dfb_config->window_policy            = -1;
+     dfb_config->buffer_mode              = -1;
+     dfb_config->wm                       = D_STRDUP( "default" );
+     dfb_config->decorations              = true;
+     dfb_config->unichrome_revision       = -1;
+     dfb_config->dma                      = false;
+     dfb_config->agp                      = 0;
+     dfb_config->matrox_tv_std            = DSETV_PAL;
+     dfb_config->i8xx_overlay_pipe_b      = false;
+     dfb_config->surface_shmpool_size     = 64 * 1024 * 1024;
+     dfb_config->keep_accumulators        = 1024;
+     dfb_config->font_format              = DSPF_A8;
+     dfb_config->flip_notify_max_latency  = 0;
+
+     /* default to fbdev */
+     dfb_config->system = D_STRDUP( "FBDev" );
+
+     /* default to no-vt-switch if we don't have root privileges */
+     if (geteuid())
+          dfb_config->vt_switch = false;
+
+     fusion_vector_init( &dfb_config->linux_input_devices, 2, NULL );
+     fusion_vector_init( &dfb_config->tslib_devices, 2, NULL );
+}
+
+const char *dfb_config_usage( void )
+{
+     return config_usage;
+}
+
+DFBResult dfb_config_set( const char *name, const char *value )
+{
+     if (strcmp (name, "system" ) == 0) {
+          if (value) {
+               if (dfb_config->system)
+                    D_FREE( dfb_config->system );
+               dfb_config->system = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("DirectFB/Config 'system': No system specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "wm" ) == 0) {
+          if (value) {
+               if (dfb_config->wm)
+                    D_FREE( dfb_config->wm );
+               dfb_config->wm = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("DirectFB/Config 'wm': No window manager specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "fbdev" ) == 0) {
+          if (value) {
+               if (dfb_config->fb_device)
+                    D_FREE( dfb_config->fb_device );
+               dfb_config->fb_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("DirectFB/Config 'fbdev': No device name specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "busid") == 0 || strcmp (name, "pci-id") == 0) {
+          if (value) {
+               int bus, dev, func;
+
+               if (sscanf( value, "%d:%d:%d", &bus, &dev, &func ) != 3) {
+                    D_ERROR( "DirectFB/Config 'busid': Could not parse busid!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->pci.bus  = bus;
+               dfb_config->pci.dev  = dev;
+               dfb_config->pci.func = func;
+          }
+     } else
+     if (strcmp (name, "screenshot-dir" ) == 0) {
+          if (value) {
+               if (dfb_config->screenshot_dir)
+                    D_FREE( dfb_config->screenshot_dir );
+               dfb_config->screenshot_dir = D_STRDUP( value );
+          }
+          else {
+               D_ERROR("DirectFB/Config 'screenshot-dir': No directory name specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "scaled" ) == 0) {
+          if (value) {
+               int width, height;
+
+               if (sscanf( value, "%dx%d", &width, &height ) < 2) {
+                    D_ERROR("DirectFB/Config 'scaled': Could not parse size!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->scaled.width  = width;
+               dfb_config->scaled.height = height;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'scaled': No size specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "primary-layer" ) == 0) {
+          if (value) {
+               int id;
+
+               if (sscanf( value, "%d", &id ) < 1) {
+                    D_ERROR("DirectFB/Config 'primary-layer': Could not parse id!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->primary_layer = id;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'primary-layer': No id specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "primary-only" ) == 0) {
+          dfb_config->primary_only = true;
+     } else
+     if (strcmp (name, "font-format" ) == 0) {
+          if (value) {
+               DFBSurfacePixelFormat format;
+
+               format = dfb_config_parse_pixelformat( value );
+               if (format == DSPF_UNKNOWN) {
+                    D_ERROR("DirectFB/Config 'font-format': Could not parse format!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->font_format = format;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'font-format': No format specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "font-premult" ) == 0) {
+          dfb_config->font_premult = true;
+     } else
+     if (strcmp (name, "no-font-premult" ) == 0) {
+          dfb_config->font_premult = false;
+     } else
+     if (!strcmp( name, "surface-shmpool-size" )) {
+          if (value) {
+               int size_kb;
+
+               if (sscanf( value, "%d", &size_kb ) < 1) {
+                    D_ERROR( "DirectFB/Config '%s': Could not parse value!\n", name);
+                    return DFB_INVARG;
+               }
+
+               dfb_config->surface_shmpool_size = size_kb * 1024;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "session" ) == 0) {
+          if (value) {
+               int session;
+
+               if (sscanf( value, "%d", &session ) < 1) {
+                    D_ERROR("DirectFB/Config 'session': Could not parse value!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->session = session;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'session': No value specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "remote" ) == 0) {
+          if (value) {
+               char *colon;
+
+               colon = strchr( value, ':' );
+               if (colon) {
+                    int len  = (long) colon - (long) value;
+                    int port = 0;
+
+                    if (direct_sscanf( colon + 1, "%d", &port ) < 1) {
+                         D_ERROR("DirectFB/Config 'remote': "
+                                 "Could not parse value (format is <host>[:<port>])!\n");
+                         return DFB_INVARG;
+                    }
+
+                    if (dfb_config->remote.host)
+                         D_FREE( dfb_config->remote.host );
+
+                    dfb_config->remote.host    = D_MALLOC( len+1 );
+                    dfb_config->remote.session = port;
+
+                    direct_snputs( dfb_config->remote.host, value, len+1 );
+               }
+               else {
+                    if (dfb_config->remote.host)
+                         D_FREE( dfb_config->remote.host );
+
+                    dfb_config->remote.host    = D_STRDUP( value );
+                    dfb_config->remote.session = 0;
+               }
+          }
+          else {
+               if (dfb_config->remote.host)
+                    D_FREE( dfb_config->remote.host );
+
+               dfb_config->remote.host    = D_STRDUP( "" );
+               dfb_config->remote.session = 0;
+          }
+     } else
+     if (strcmp (name, "videoram-limit" ) == 0) {
+          if (value) {
+               int limit;
+
+               if (sscanf( value, "%d", &limit ) < 1) {
+                    D_ERROR("DirectFB/Config 'videoram-limit': Could not parse value!\n");
+                    return DFB_INVARG;
+               }
+
+               if (limit < 0)
+                    limit = 0;
+
+               dfb_config->videoram_limit = limit << 10;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'videoram-limit': No value specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "keep-accumulators" ) == 0) {
+          if (value) {
+               int limit;
+
+               if (sscanf( value, "%d", &limit ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse value!\n", name);
+                    return DFB_INVARG;
+               }
+
+               dfb_config->keep_accumulators = limit;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No value specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "banner" ) == 0) {
+          dfb_config->banner = true;
+     } else
+     if (strcmp (name, "no-banner" ) == 0) {
+          dfb_config->banner = false;
+     } else
+     if (strcmp (name, "surface-sentinel" ) == 0) {
+          dfb_config->surface_sentinel = true;
+     } else
+     if (strcmp (name, "no-surface-sentinel" ) == 0) {
+          dfb_config->surface_sentinel = false;
+     } else
+     if (strcmp (name, "force-windowed" ) == 0) {
+          dfb_config->force_windowed = true;
+     } else
+     if (strcmp (name, "force-desktop" ) == 0) {
+          dfb_config->force_desktop = true;
+     } else
+     if (strcmp (name, "hardware" ) == 0) {
+          dfb_config->software_only = false;
+     } else
+     if (strcmp (name, "no-hardware" ) == 0) {
+          dfb_config->software_only = true;
+     } else
+     if (strcmp (name, "software" ) == 0) {
+          dfb_config->hardware_only = false;
+     } else
+     if (strcmp (name, "no-software" ) == 0) {
+          dfb_config->hardware_only = true;
+     } else
+     if (strcmp (name, "software-warn" ) == 0) {
+          dfb_config->software_warn = true;
+     } else
+     if (strcmp (name, "no-software-warn" ) == 0) {
+          dfb_config->software_warn = false;
+     } else
+     if (strcmp (name, "software-trace" ) == 0) {
+          dfb_config->software_trace = true;
+     } else
+     if (strcmp (name, "no-software-trace" ) == 0) {
+          dfb_config->software_trace = false;
+     } else
+     if (strcmp (name, "warn" ) == 0 || strcmp (name, "no-warn" ) == 0) {
+          /* Enable/disable all at once by default. */
+          DFBConfigWarnFlags flags = DMT_ALL;
+
+          /* Find out the specific message type being configured. */
+          if (value) {
+               char *opt = strchr( value, ':' );
+
+               if (opt)
+                    opt++;
+
+               if (!strncmp( value, "create-surface", 14 )) {
+                    flags = DCWF_CREATE_SURFACE;
+
+                    if (opt)
+                         sscanf( opt, "%dx%d",
+                                 &dfb_config->warn.create_surface.min_size.w,
+                                 &dfb_config->warn.create_surface.min_size.h );
+               } else
+               if (!strncmp( value, "create-window", 13 )) {
+                    flags = DCWF_CREATE_WINDOW;
+               } else
+               if (!strncmp( value, "allocate-buffer", 15 )) {
+                    flags = DCWF_ALLOCATE_BUFFER;
+
+                    if (opt)
+                         sscanf( opt, "%dx%d",
+                                 &dfb_config->warn.allocate_buffer.min_size.w,
+                                 &dfb_config->warn.allocate_buffer.min_size.h );
+               }
+               else {
+                    D_ERROR( "DirectFB/Config '%s': Unknown warning type '%s'!\n", name, value );
+                    return DFB_INVARG;
+               }
+          }
+
+          /* Set/clear the corresponding flag in the configuration. */
+          if (name[0] == 'w')
+               dfb_config->warn.flags |= flags;
+          else
+               dfb_config->warn.flags &= ~flags;
+     } else
+     if (strcmp (name, "dma" ) == 0) {
+          dfb_config->dma = true;
+     } else
+     if (strcmp (name, "no-dma" ) == 0) {
+          dfb_config->dma = false;
+     } else
+     if (strcmp (name, "mmx" ) == 0) {
+          dfb_config->mmx = true;
+     } else
+     if (strcmp (name, "no-mmx" ) == 0) {
+          dfb_config->mmx = false;
+     } else
+     if (strcmp (name, "agp" ) == 0) {
+          if (value) {
+               int mode;
+
+               if (sscanf( value, "%d", &mode ) < 1 || mode < 0 || mode > 8) {
+                    D_ERROR( "DirectFB/Config 'agp': "
+                             "invalid agp mode '%s'!\n", value );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->agp = mode;
+          }
+          else {
+               dfb_config->agp = 8; /* maximum possible */
+          }
+     } else
+     if (strcmp (name, "thrifty-surface-buffers" ) == 0) {
+          dfb_config->thrifty_surface_buffers = true;
+     } else
+     if (strcmp (name, "no-thrifty-surface-buffers" ) == 0) {
+          dfb_config->thrifty_surface_buffers = false;
+     } else
+     if (strcmp (name, "no-agp" ) == 0) {
+          dfb_config->agp = 0;
+     } else
+     if (strcmp (name, "agpmem-limit" ) == 0) {
+          if (value) {
+               int limit;
+
+               if (sscanf( value, "%d", &limit ) < 1) {
+                    D_ERROR( "DirectFB/Config 'agpmem-limit': "
+                             "Could not parse value!\n" );
+                    return DFB_INVARG;
+               }
+
+               if (limit < 0)
+                    limit = 0;
+
+               dfb_config->agpmem_limit = limit << 10;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'agpmem-limit': No value specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "vt" ) == 0) {
+          dfb_config->vt = true;
+     } else
+     if (strcmp (name, "no-vt" ) == 0) {
+          dfb_config->vt = false;
+     } else
+     if (strcmp (name, "block-all-signals" ) == 0) {
+          dfb_config->block_all_signals = true;
+     } else
+     if (strcmp (name, "deinit-check" ) == 0) {
+          dfb_config->deinit_check = true;
+     } else
+     if (strcmp (name, "no-deinit-check" ) == 0) {
+          dfb_config->deinit_check = false;
+     } else
+     if (strcmp (name, "cursor" ) == 0) {
+          dfb_config->no_cursor = false;
+     } else
+     if (strcmp (name, "no-cursor" ) == 0) {
+          dfb_config->no_cursor = true;
+     } else
+     if (strcmp (name, "cursor-updates" ) == 0) {
+          dfb_config->no_cursor_updates = false;
+     } else
+     if (strcmp (name, "no-cursor-updates" ) == 0) {
+          dfb_config->no_cursor_updates = true;
+     } else
+     if (strcmp (name, "linux-input-ir-only" ) == 0) {
+          dfb_config->linux_input_ir_only = true;
+     } else
+     if (strcmp (name, "linux-input-grab" ) == 0) {
+          dfb_config->linux_input_grab = true;
+     } else
+     if (strcmp (name, "no-linux-input-grab" ) == 0) {
+          dfb_config->linux_input_grab = false;
+     } else
+     if (strcmp (name, "motion-compression" ) == 0) {
+          dfb_config->mouse_motion_compression = true;
+     } else
+     if (strcmp (name, "no-motion-compression" ) == 0) {
+          dfb_config->mouse_motion_compression = false;
+     } else
+     if (strcmp (name, "mouse-protocol" ) == 0) {
+          if (value) {
+               dfb_config->mouse_protocol = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No mouse protocol specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "mouse-source" ) == 0) {
+          if (value) {
+               D_FREE( dfb_config->mouse_source );
+               dfb_config->mouse_source = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No mouse source specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "mouse-gpm-source" ) == 0) {
+          dfb_config->mouse_gpm_source = true;
+	     D_FREE( dfb_config->mouse_source );
+	     dfb_config->mouse_source = D_STRDUP( DEV_NAME_GPM );
+     } else
+     if (strcmp (name, "no-mouse-gpm-source" ) == 0) {
+          dfb_config->mouse_gpm_source = false;
+          D_FREE( dfb_config->mouse_source );
+          dfb_config->mouse_source = D_STRDUP( DEV_NAME );
+     } else
+     if (strcmp (name, "smooth-upscale" ) == 0) {
+          dfb_config->render_options |= DSRO_SMOOTH_UPSCALE;
+     } else
+     if (strcmp (name, "no-smooth-upscale" ) == 0) {
+          dfb_config->render_options &= ~DSRO_SMOOTH_UPSCALE;
+     } else
+     if (strcmp (name, "smooth-downscale" ) == 0) {
+          dfb_config->render_options |= DSRO_SMOOTH_DOWNSCALE;
+     } else
+     if (strcmp (name, "no-smooth-downscale" ) == 0) {
+          dfb_config->render_options &= ~DSRO_SMOOTH_DOWNSCALE;
+     } else
+     if (strcmp (name, "translucent-windows" ) == 0) {
+          dfb_config->translucent_windows = true;
+     } else
+     if (strcmp (name, "no-translucent-windows" ) == 0) {
+          dfb_config->translucent_windows = false;
+     } else
+     if (strcmp (name, "decorations" ) == 0) {
+          dfb_config->decorations = true;
+     } else
+     if (strcmp (name, "no-decorations" ) == 0) {
+          dfb_config->decorations = false;
+     } else
+     if (strcmp (name, "startstop" ) == 0) {
+          dfb_config->startstop = true;
+     } else
+     if (strcmp (name, "no-startstop" ) == 0) {
+          dfb_config->startstop = false;
+     } else
+     if (strcmp (name, "autoflip-window" ) == 0) {
+          dfb_config->autoflip_window = true;
+     } else
+     if (strcmp (name, "no-autoflip-window" ) == 0) {
+          dfb_config->autoflip_window = false;
+     } else
+     if (strcmp (name, "discard-repeat-events" ) == 0) {
+          dfb_config->discard_repeat_events = true;
+     } else
+     if (strcmp (name, "no-discard-repeat-events" ) == 0) {
+          dfb_config->discard_repeat_events = false;
+     } else
+     if (strcmp (name, "vsync-none" ) == 0) {
+          dfb_config->pollvsync_none = true;
+     } else
+     if (strcmp (name, "vsync-after" ) == 0) {
+          dfb_config->pollvsync_after = true;
+     } else
+     if (strcmp (name, "vt-switch" ) == 0) {
+          dfb_config->vt_switch = true;
+     } else
+     if (strcmp (name, "no-vt-switch" ) == 0) {
+          dfb_config->vt_switch = false;
+     } else
+     if (strcmp (name, "vt-num" ) == 0) {
+          if (value) {
+               int vt_num;
+
+               if (sscanf( value, "%d", &vt_num ) < 1) {
+                    D_ERROR("DirectFB/Config 'vt-num': Could not parse value!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->vt_num = vt_num;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'vt-num': No value specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "vt-switching" ) == 0) {
+          dfb_config->vt_switching = true;
+     } else
+     if (strcmp (name, "no-vt-switching" ) == 0) {
+          dfb_config->vt_switching = false;
+     } else
+     if (strcmp (name, "graphics-vt" ) == 0) {
+          dfb_config->kd_graphics = true;
+     } else
+     if (strcmp (name, "no-graphics-vt" ) == 0) {
+          dfb_config->kd_graphics = false;
+     } else
+     if (strcmp (name, "window-surface-policy" ) == 0) {
+          if (value) {
+               if (strcmp( value, "auto" ) == 0) {
+                    dfb_config->window_policy = -1;
+               } else
+               if (strcmp( value, "videohigh" ) == 0) {
+                    dfb_config->window_policy = CSP_VIDEOHIGH;
+               } else
+               if (strcmp( value, "videolow" ) == 0) {
+                    dfb_config->window_policy = CSP_VIDEOLOW;
+               } else
+               if (strcmp( value, "systemonly" ) == 0) {
+                    dfb_config->window_policy = CSP_SYSTEMONLY;
+               } else
+               if (strcmp( value, "videoonly" ) == 0) {
+                    dfb_config->window_policy = CSP_VIDEOONLY;
+               }
+               else {
+                    D_ERROR( "DirectFB/Config: "
+                             "Unknown window surface policy `%s'!\n", value );
+                    return DFB_INVARG;
+               }
+          }
+          else {
+               D_ERROR( "DirectFB/Config: "
+                        "No window surface policy specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "init-layer" ) == 0) {
+          if (value) {
+               int id;
+
+               if (sscanf( value, "%d", &id ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse id!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (id < 0 || id > D_ARRAY_SIZE(dfb_config->layers)) {
+                    D_ERROR("DirectFB/Config '%s': ID %d out of bounds!\n", name, id);
+                    return DFB_INVARG;
+               }
+
+               dfb_config->layers[id].init = true;
+
+               dfb_config->config_layer = &dfb_config->layers[id];
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No id specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "no-init-layer" ) == 0) {
+          if (value) {
+               int id;
+
+               if (sscanf( value, "%d", &id ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse id!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (id < 0 || id > D_ARRAY_SIZE(dfb_config->layers)) {
+                    D_ERROR("DirectFB/Config '%s': ID %d out of bounds!\n", name, id);
+                    return DFB_INVARG;
+               }
+
+               dfb_config->layers[id].init = false;
+
+               dfb_config->config_layer = &dfb_config->layers[id];
+          }
+          else
+               dfb_config->layers[0].init = false;
+     } else
+     if (strcmp (name, "mode" ) == 0 || strcmp (name, "layer-size" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               int width, height;
+
+               if (sscanf( value, "%dx%d", &width, &height ) < 2) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse width and height!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (conf == &dfb_config->layers[0]) {
+                    dfb_config->mode.width  = width;
+                    dfb_config->mode.height = height;
+               }
+
+               conf->config.width  = width;
+               conf->config.height = height;
+
+               conf->config.flags |= DLCONF_WIDTH | DLCONF_HEIGHT;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No width and height specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "depth" ) == 0 || strcmp (name, "layer-depth" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               int depth;
+
+               if (sscanf( value, "%d", &depth ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse value!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (conf == &dfb_config->layers[0]) {
+                    dfb_config->mode.depth = depth;
+               }
+
+               conf->config.pixelformat = dfb_pixelformat_for_depth( depth );
+               conf->config.flags      |= DLCONF_PIXELFORMAT;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No value specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "pixelformat" ) == 0 || strcmp (name, "layer-format" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               DFBSurfacePixelFormat format;
+
+               format = dfb_config_parse_pixelformat( value );
+               if (format == DSPF_UNKNOWN) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse format!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (conf == &dfb_config->layers[0])
+                    dfb_config->mode.format = format;
+
+               conf->config.pixelformat = format;
+               conf->config.flags      |= DLCONF_PIXELFORMAT;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No format specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "desktop-buffer-mode" ) == 0 || strcmp (name, "layer-buffer-mode" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               if (strcmp( value, "auto" ) == 0) {
+                    conf->config.flags &= ~DLCONF_BUFFERMODE;
+               } else
+               if (strcmp( value, "triple" ) == 0) {
+                    conf->config.buffermode = DLBM_TRIPLE;
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+               } else
+               if (strcmp( value, "backvideo" ) == 0) {
+                    conf->config.buffermode = DLBM_BACKVIDEO;
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+               } else
+               if (strcmp( value, "backsystem" ) == 0) {
+                    conf->config.buffermode = DLBM_BACKSYSTEM;
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+               } else
+               if (strcmp( value, "frontonly" ) == 0) {
+                    conf->config.buffermode = DLBM_FRONTONLY;
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+               } else
+               if (strcmp( value, "windows" ) == 0) {
+                    conf->config.buffermode = DLBM_WINDOWS;
+                    conf->config.flags     |= DLCONF_BUFFERMODE;
+               } else {
+                    D_ERROR( "DirectFB/Config '%s': Unknown mode '%s'!\n", name, value );
+                    return DFB_INVARG;
+               }
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No buffer mode specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "layer-src-key" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               char *error;
+               u32   argb;
+
+               argb = strtoul( value, &error, 16 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in color '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               conf->src_key.b = argb & 0xFF;
+               argb >>= 8;
+               conf->src_key.g = argb & 0xFF;
+               argb >>= 8;
+               conf->src_key.r = argb & 0xFF;
+               argb >>= 8;
+               conf->src_key.a = argb & 0xFF;
+
+               conf->config.options |= DLOP_SRC_COLORKEY;
+               conf->config.flags   |= DLCONF_OPTIONS;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No color specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "layer-src-key-index" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               char *error;
+               u32   index;
+
+               index = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in index '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               conf->src_key_index = index;
+               conf->config.options |= DLOP_SRC_COLORKEY;
+               conf->config.flags   |= DLCONF_OPTIONS;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No index specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "bg-none" ) == 0 || strcmp (name, "layer-bg-none" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          conf->background.mode = DLBM_DONTCARE;
+     } else
+     if (strcmp (name, "bg-image" ) == 0 || strcmp (name, "bg-tile" ) == 0 ||
+         strcmp (name, "layer-bg-image" ) == 0 || strcmp (name, "layer-bg-tile" ) == 0)
+     {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               if (conf->background.filename)
+                    D_FREE( conf->background.filename );
+
+               conf->background.filename = D_STRDUP( value );
+               conf->background.mode     = strcmp (name, "bg-tile" ) ? DLBM_IMAGE : DLBM_TILE;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No filename specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "bg-color" ) == 0 || strcmp (name, "layer-bg-color" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               char *error;
+               u32   argb;
+
+               argb = strtoul( value, &error, 16 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in color '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               conf->background.color.b = argb & 0xFF;
+               argb >>= 8;
+               conf->background.color.g = argb & 0xFF;
+               argb >>= 8;
+               conf->background.color.r = argb & 0xFF;
+               argb >>= 8;
+               conf->background.color.a = argb & 0xFF;
+
+               conf->background.color_index = -1;
+               conf->background.mode        = DLBM_COLOR;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No color specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "layer-bg-color-index" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               char *error;
+               u32   index;
+
+               index = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in index '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               conf->background.color_index = index;
+               conf->background.mode        = DLBM_COLOR;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No index specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "layer-stacking" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               char *stackings = D_STRDUP( value );
+               char *p = NULL, *r, *s = stackings;
+
+               conf->stacking = 0;
+
+               while ((r = strtok_r( s, ",", &p ))) {
+                    direct_trim( &r );
+
+                    if (!strcmp( r, "lower" ))
+                         conf->stacking |= (1 << DWSC_LOWER);
+                    else if (!strcmp( r, "middle" ))
+                         conf->stacking |= (1 << DWSC_MIDDLE);
+                    else if (!strcmp( r, "upper" ))
+                         conf->stacking |= (1 << DWSC_UPPER);
+                    else {
+                         D_ERROR( "DirectFB/Config '%s': Unknown class '%s'!\n", name, r );
+                         D_FREE( stackings );
+                         return DFB_INVARG;
+                    }
+
+                    s = NULL;
+               }
+
+               D_FREE( stackings );
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': Missing value!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strncmp (name, "layer-palette-", 14 ) == 0) {
+          int             index;
+          char           *error;
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          index = strtoul( name + 14, &error, 10 );
+
+          if (*error) {
+               D_ERROR( "DirectFB/Config '%s': Error in index '%s'!\n", name, error );
+               return DFB_INVARG;
+          }
+
+          if (index < 0 || index > 255) {
+               D_ERROR("DirectFB/Config '%s': Index %d out of bounds!\n", name, index);
+               return DFB_INVARG;
+          }
+
+          if (value) {
+               char *error;
+               u32   argb;
+
+               argb = strtoul( value, &error, 16 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in color '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               if (!conf->palette) {
+                    conf->palette = D_CALLOC( 256, sizeof(DFBColor) );
+                    if (!conf->palette)
+                         return D_OOM();
+               }
+
+               conf->palette[index].a = (argb & 0xFF000000) >> 24;
+               conf->palette[index].r = (argb & 0xFF0000) >> 16;
+               conf->palette[index].g = (argb & 0xFF00) >> 8;
+               conf->palette[index].b = (argb & 0xFF);
+
+               conf->palette_set = true;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No color specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "layer-rotate" ) == 0) {
+          DFBConfigLayer *conf = dfb_config->config_layer;
+
+          if (value) {
+               int rotate;
+
+               if (sscanf( value, "%d", &rotate ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse value!\n", name);
+                    return DFB_INVARG;
+               }
+
+               if (rotate != 0 && rotate != 90 && rotate != 180 && rotate != 270) {
+                    D_ERROR("DirectFB/Config '%s': Only 0, 90, 180 or 270 supported!\n", name);
+                    return DFB_UNSUPPORTED;
+               }
+
+               conf->rotate = rotate;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No value specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "video-phys" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long phys;
+
+               phys = strtoul( value, &error, 16 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in hex value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->video_phys = phys;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "video-length" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long length;
+
+               length = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->video_length = length;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "mmio-phys" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long phys;
+
+               phys = strtoul( value, &error, 16 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in hex value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->mmio_phys = phys;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "mmio-length" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long length;
+
+               length = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->mmio_length = length;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "accelerator" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long accel;
+
+               accel = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->accelerator = accel;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "matrox-tv-standard" ) == 0) {
+          if (value) {
+               if (strcmp( value, "pal-60" ) == 0) {
+                    dfb_config->matrox_tv_std = DSETV_PAL_60;
+               } else
+               if (strcmp( value, "pal" ) == 0) {
+                    dfb_config->matrox_tv_std = DSETV_PAL;
+               } else
+               if (strcmp( value, "ntsc" ) == 0) {
+                    dfb_config->matrox_tv_std = DSETV_NTSC;
+               } else {
+                    D_ERROR( "DirectFB/Config: Unknown TV standard "
+                             "'%s'!\n", value );
+                    return DFB_INVARG;
+               }
+          }
+          else {
+               D_ERROR( "DirectFB/Config: "
+                        "No TV standard specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "matrox-cable-type" ) == 0) {
+          if (value) {
+               if (strcmp( value, "composite" ) == 0) {
+                    dfb_config->matrox_cable = 0;
+               } else
+               if (strcmp( value, "scart-rgb" ) == 0) {
+                    dfb_config->matrox_cable = 1;
+               } else
+               if (strcmp( value, "scart-composite" ) == 0) {
+                    dfb_config->matrox_cable = 2;
+               } else {
+                    D_ERROR( "DirectFB/Config: Unknown cable type "
+                             "'%s'!\n", value );
+                    return DFB_INVARG;
+               }
+          }
+          else {
+               D_ERROR( "DirectFB/Config: "
+                        "No cable type specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "matrox-sgram" ) == 0) {
+          dfb_config->matrox_sgram = true;
+     } else
+     if (strcmp (name, "matrox-crtc2" ) == 0) {
+          dfb_config->matrox_crtc2 = true;
+     } else
+     if (strcmp (name, "no-matrox-sgram" ) == 0) {
+          dfb_config->matrox_sgram = false;
+     } else
+     if (strcmp (name, "sync" ) == 0) {
+          dfb_config->sync = true;
+     } else
+     if (strcmp (name, "no-sync" ) == 0) {
+          dfb_config->sync = false;
+     } else
+     if (strcmp (name, "lefty" ) == 0) {
+          dfb_config->lefty = true;
+     } else
+     if (strcmp (name, "no-lefty" ) == 0) {
+          dfb_config->lefty = false;
+     } else
+     if (strcmp (name, "capslock-meta" ) == 0) {
+          dfb_config->capslock_meta = true;
+     } else
+     if (strcmp (name, "no-capslock-meta" ) == 0) {
+          dfb_config->capslock_meta = false;
+     } else
+     if (strcmp (name, "h3600-device" ) == 0) {
+          if (value) {
+               if (dfb_config->h3600_device)
+                    D_FREE( dfb_config->h3600_device );
+
+               dfb_config->h3600_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No H3600 TS device specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "mut-device" ) == 0) {
+          if (value) {
+               if (dfb_config->mut_device)
+                    D_FREE( dfb_config->mut_device );
+
+               dfb_config->mut_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No MuTouch device specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "zytronic-device" ) == 0) {
+          if (value) {
+               if (dfb_config->zytronic_device)
+                    D_FREE( dfb_config->zytronic_device );
+
+               dfb_config->zytronic_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No Zytronic device specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "elo-device" ) == 0) {
+          if (value) {
+               if (dfb_config->elo_device)
+                    D_FREE( dfb_config->elo_device );
+
+               dfb_config->elo_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No Elo device specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "penmount-device" ) == 0) {
+          if (value) {
+               if (dfb_config->penmount_device)
+                    D_FREE( dfb_config->penmount_device );
+
+               dfb_config->penmount_device = D_STRDUP( value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: No PenMount device specified!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "linux-input-devices" ) == 0) {
+          if (value) {
+               config_values_free( &dfb_config->linux_input_devices );
+               config_values_parse( &dfb_config->linux_input_devices, value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: Missing value for linux-input-devices!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "tslib-devices" ) == 0) {
+          if (value) {
+               config_values_free( &dfb_config->tslib_devices );
+               config_values_parse( &dfb_config->tslib_devices, value );
+          }
+          else {
+               D_ERROR( "DirectFB/Config: Missing value for tslib-devices!\n" );
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "unichrome-revision" ) == 0) {
+          if (value) {
+               int rev;
+
+               if (sscanf( value, "%d", &rev ) < 1) {
+                    D_ERROR("DirectFB/Config 'unichrome-revision': Could not parse revision!\n");
+                    return DFB_INVARG;
+               }
+
+               dfb_config->unichrome_revision = rev;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'unichrome-revision': No revision specified!\n");
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "i8xx_overlay_pipe_b") == 0) {
+          dfb_config->i8xx_overlay_pipe_b = true;
+     } else
+     if (strcmp (name, "window-cursor-invisible") == 0) {
+          dfb_config->default_cursor_flags = DWCF_INVISIBLE;
+     } else
+     if (strcmp (name, "max-axis-rate" ) == 0) {
+          if (value) {
+               unsigned int rate;
+
+               if (sscanf( value, "%u", &rate ) < 1) {
+                    D_ERROR("DirectFB/Config '%s': Could not parse value!\n", name);
+                    return DFB_INVARG;
+               }
+
+               dfb_config->max_axis_rate = rate;
+          }
+          else {
+               D_ERROR("DirectFB/Config '%s': No value specified!\n", name);
+               return DFB_INVARG;
+          }
+     } else
+     if (strcmp (name, "include") == 0) {
+          if( value ) {
+               DFBResult ret;
+               ret = dfb_config_read( value );
+               if( ret )
+                    return ret;
+          }
+          else {
+               D_ERROR("DirectFB/Config 'include': No include file specified!\n");
+               return DFB_INVARG; 
+          }
+     } else
+     if (strcmp (name, "flip-notify-max-latency" ) == 0) {
+          if (value) {
+               char *error;
+               unsigned long latency;
+
+               latency = strtoul( value, &error, 10 );
+
+               if (*error) {
+                    D_ERROR( "DirectFB/Config '%s': Error in value '%s'!\n", name, error );
+                    return DFB_INVARG;
+               }
+
+               dfb_config->flip_notify_max_latency = latency;
+          }
+          else {
+               D_ERROR( "DirectFB/Config '%s': No value specified!\n", name );
+               return DFB_INVARG;
+          }
+     } else
+     if (voodoo_config_set( name, value ) && fusion_config_set( name, value ) && direct_config_set( name, value ))
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+DFBResult dfb_config_init( int *argc, char *(*argv[]) )
+{
+     DFBResult ret;
+     int i;
+     char *home = getenv( "HOME" );
+     char *prog = NULL;
+     char *session;
+     char *dfbargs;
+     char  cmdbuf[1024];
+     
+     if (dfb_config)
+          return DFB_OK;
+
+     config_allocate();
+
+     /* Read system settings. */
+     ret = dfb_config_read( SYSCONFDIR"/directfbrc" );
+     if (ret  &&  ret != DFB_IO)
+          return ret;
+
+     /* Read user settings. */
+     if (home) {
+          int  len = strlen(home) + strlen("/.directfbrc") + 1;
+          char buf[len];
+
+          snprintf( buf, len, "%s/.directfbrc", home );
+
+          ret = dfb_config_read( buf );
+          if (ret  &&  ret != DFB_IO)
+               return ret;
+     }
+
+     /* Get application name. */
+     if (argc && *argc && argv && *argv) {
+          prog = strrchr( (*argv)[0], '/' );
+
+          if (prog)
+               prog++;
+          else
+               prog = (*argv)[0];
+     }
+     else {
+          /* if we didn't receive argc/argv we try the proc system */
+          FILE *f;
+          int   len;
+
+          f = fopen( "/proc/self/cmdline", "r" );
+          if (f) {
+               len = fread( cmdbuf, 1, 1023, f );
+               if (len) {
+                    cmdbuf[len] = 0; /* in case of no arguments, or long program name */
+                    prog = strrchr( cmdbuf, '/' );
+                    if (prog)
+                         prog++;
+                    else
+                         prog = cmdbuf;
+               }
+               fprintf(stderr,"commandline read: %s\n", prog );
+               fclose( f );
+          }
+     }
+
+     /* Strip lt- prefix. */
+     if (prog) {
+          if (prog[0] == 'l' && prog[1] == 't' && prog[2] == '-')
+            prog += 3;
+     }
+
+     /* Read global application settings. */
+     if (prog && prog[0]) {
+          int  len = strlen( SYSCONFDIR"/directfbrc." ) + strlen(prog) + 1;
+          char buf[len];
+
+          snprintf( buf, len, SYSCONFDIR"/directfbrc.%s", prog );
+
+          ret = dfb_config_read( buf );
+          if (ret  &&  ret != DFB_IO)
+               return ret;
+     }
+
+     /* Read user application settings. */
+     if (home && prog && prog[0]) {
+          int  len = strlen(home) + strlen("/.directfbrc.") + strlen(prog) + 1;
+          char buf[len];
+
+          snprintf( buf, len, "%s/.directfbrc.%s", home, prog );
+
+          ret = dfb_config_read( buf );
+          if (ret  &&  ret != DFB_IO)
+               return ret;
+     }
+
+     /* Read settings from environment variable. */
+     dfbargs = getenv( "DFBARGS" );
+     if (dfbargs) {
+          ret = parse_args( dfbargs );
+          if (ret)
+               return ret;
+     }
+
+     /* Active session is used if present, only command line can override. */
+     session = getenv( "DIRECTFB_SESSION" );
+     if (session)
+          dfb_config_set( "session", session );
+
+     /* Read settings from command line. */
+     if (argc && argv) {
+          for (i = 1; i < *argc; i++) {
+
+               if (strcmp ((*argv)[i], "--dfb-help") == 0) {
+                    print_config_usage();
+                    exit(1);
+               }
+
+               if (strncmp ((*argv)[i], "--dfb:", 6) == 0) {
+                    ret = parse_args( (*argv)[i] + 6 );
+                    if (ret)
+                         return ret;
+
+                    (*argv)[i] = NULL;
+               }
+          }
+
+          for (i = 1; i < *argc; i++) {
+               int k;
+
+               for (k = i; k < *argc; k++)
+                    if ((*argv)[k] != NULL)
+                         break;
+
+               if (k > i) {
+                    int j;
+
+                    k -= i;
+
+                    for (j = i + k; j < *argc; j++)
+                         (*argv)[j-k] = (*argv)[j];
+
+                    *argc -= k;
+               }
+          }
+     }
+     else if (prog) {
+          /* we have prog, so we try again the proc filesystem */
+          FILE *f;
+          int   len;
+
+          len = strlen( cmdbuf );
+          f = fopen( "/proc/self/cmdline", "r" );
+          if (f) {
+               len = fread( cmdbuf, 1, len, f ); /* skip arg 0 */
+               while( config_read_cmdline( cmdbuf, 1024, f ) ) {
+                    fprintf(stderr,"commandline read: %s\n", cmdbuf );
+                    if (strcmp (cmdbuf, "--dfb-help") == 0) {
+                         print_config_usage();
+                         exit(1);
+                    }
+
+                    if (strncmp (cmdbuf, "--dfb:", 6) == 0) {
+                         ret = parse_args( cmdbuf + 6 );
+                         if (ret) {
+                              fclose( f );
+                              return ret;
+                         }
+                    }
+               }
+               fclose( f );
+          }
+     }
+
+     if (!dfb_config->vt_switch)
+          dfb_config->kd_graphics = true;
+
+     return DFB_OK;
+}
+
+DFBResult dfb_config_read( const char *filename )
+{
+     DFBResult ret = DFB_OK;
+     char line[400];
+     FILE *f;
+
+     char *slash = 0;
+     char *cwd   = 0;
+
+     config_allocate();
+
+     dfb_config->config_layer = &dfb_config->layers[0];
+
+     f = fopen( filename, "r" );
+     if (!f) {
+          D_DEBUG_AT( DirectFB_Config, "Unable to open config file `%s'!\n", filename );
+          return DFB_IO;
+     } else {
+          D_DEBUG_AT( DirectFB_Config, "Parsing config file '%s'.\n", filename );
+     }
+
+     /* store/restore the cwd (needed for the "include" command */
+     slash = strrchr( filename, '/' );
+     if( slash ) {
+          cwd = getcwd(0,0);
+          if( !cwd )
+               return D_OOM();
+
+          /* must copy filename for path, due to const'ness */
+          char nwd[strlen(filename)];
+          strcpy( nwd, filename );
+          nwd[slash-filename] = 0;
+          chdir( nwd );
+
+          D_DEBUG_AT( DirectFB_Config, "changing configuration lookup directory to '%s'.\n", nwd );
+     }
+
+     while (fgets( line, 400, f )) {
+          char *name = line;
+          char *comment = strchr( line, '#');
+          char *value;
+
+          if (comment) {
+               *comment = 0;
+          }
+
+          value = strchr( line, '=' );
+
+          if (value) {
+               *value++ = 0;
+               direct_trim( &value );
+          }
+
+          direct_trim( &name );
+
+          if (!*name  ||  *name == '#')
+               continue;
+
+          ret = dfb_config_set( name, value );
+          if (ret) {
+               if (ret == DFB_UNSUPPORTED) {
+                    D_ERROR( "DirectFB/Config: *********** In config file `%s': "
+                             "Invalid option `%s'! ***********\n", filename, name );
+                    ret = DFB_OK;
+                    continue;
+               }
+               break;
+          }
+     }
+
+     fclose( f );
+
+     /* restore original cwd */
+     if( cwd ) {
+          chdir( cwd );
+          free( cwd );
+     }
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/src/misc/conf.h b/Source/DirectFB/src/misc/conf.h
new file mode 100755
index 0000000..49b5e9a
--- /dev/null
+++ b/Source/DirectFB/src/misc/conf.h
@@ -0,0 +1,287 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CONF_H__
+#define __CONF_H__
+
+#include <signal.h>
+
+#include <directfb.h>
+#include <fusion/types.h>
+#include <fusion/vector.h>
+
+#include <core/coredefs.h>
+
+
+typedef struct {
+     bool                                init;
+
+     DFBDisplayLayerConfig               config;
+     DFBColor                            src_key;
+     int                                 src_key_index;
+
+     struct {
+          DFBDisplayLayerBackgroundMode  mode;
+          DFBColor                       color;
+          int                            color_index;
+          char                          *filename;
+     } background;
+
+     DFBWindowStackingClass              stacking;
+
+     DFBColor                           *palette;
+     bool                                palette_set;
+
+     int                                 rotate;
+} DFBConfigLayer;
+
+typedef enum {
+     DCWF_NONE                          = 0x00000000,
+
+     DCWF_CREATE_SURFACE                = 0x00000001,
+     DCWF_CREATE_WINDOW                 = 0x00000002,
+
+     DCWF_ALLOCATE_BUFFER               = 0x00000010,
+
+     DCWF_ALL                           = 0x00000013,
+} DFBConfigWarnFlags;
+
+typedef struct
+{
+     bool      mouse_motion_compression;          /* use motion compression? */
+     char     *mouse_protocol;                    /* mouse protocol */
+     char     *mouse_source;                      /* mouse source device name */
+     bool      mouse_gpm_source;                  /* mouse source is gpm? */
+
+     int       window_policy;                     /* swapping policy for the
+                                                     surface of a window */
+     int       buffer_mode;                       /* default buffer mode for
+                                                     primary layer */
+
+     bool      pollvsync_after;
+     bool      pollvsync_none;
+
+     bool      software_only;                     /* disable hardware acceleration */
+     bool      hardware_only;                     /* disable software fallbacks */
+
+     bool      mmx;                               /* mmx support */
+
+     bool      banner;                            /* startup banner */
+
+     bool      force_windowed;                    /* prohibit exclusive modes */
+
+     bool      deinit_check;
+
+     bool      vt_switch;                         /* allocate a new VT */
+     int       vt_num;                            /* number of TTY to use or -1
+                                                     if the default */
+     bool      kd_graphics;                       /* put terminal into graphics
+                                                     mode */
+
+     DFBScreenEncoderTVStandards matrox_tv_std;   /* Matrox TV standard */
+     int       matrox_cable;                      /* Matrox cable type */
+     bool      matrox_sgram;                      /* Use Matrox SGRAM features */
+     bool      matrox_crtc2;                      /* Experimental CRTC2 stuff */
+
+     bool      sync;                              /* Do sync() in core_init() */
+     bool      vt_switching;                      /* Allow VT switching by
+                                                     pressing Ctrl+Alt+<F?> */
+
+     char     *fb_device;                         /* Used framebuffer device,
+                                                     e.g. "/dev/fb0" */
+
+     struct {
+          int  bus;                               /* PCI Bus */
+          int  dev;                               /* PCI Device */
+          int  func;                              /* PCI Function */
+     } pci;
+
+     bool      lefty;                             /* Left handed mouse, swaps
+                                                     left/right mouse buttons */
+     bool      no_cursor;                         /* Never create a cursor */
+     bool      translucent_windows;               /* Allow translucent
+                                                     windows */
+
+     struct {
+          int                   width;            /* primary layer width */
+          int                   height;           /* primary layer height */
+          int                   depth;            /* primary layer depth */
+          DFBSurfacePixelFormat format;           /* primary layer format */
+     } mode;
+
+     struct {
+          int                   width;            /* scaled window width */
+          int                   height;           /* scaled window height */
+     } scaled;
+
+     int       videoram_limit;                    /* limit amount of video
+                                                     memory used by DirectFB */
+
+     char     *screenshot_dir;                    /* dump screen content into
+                                                     this directory */
+
+     char     *system;                            /* FBDev, SDL, etc. */
+
+     bool      capslock_meta;                     /* map CapsLock -> Meta */
+
+     bool      block_all_signals;                 /* block all signals */
+
+     int       session;                           /* select multi app world */
+
+     int       primary_layer;                     /* select alternative primary
+                                                     display layer */
+
+     bool      force_desktop;                     /* Desktop background is
+                                                     the primary surface. */
+
+     bool      linux_input_ir_only;               /* Ignore non-IR devices. */
+
+     struct {
+          char *host;                             /* Remote host to connect to. */
+          int   session;                          /* Remote session number. */
+     } remote;
+
+     char      *wm;                               /* Window manager to use. */
+
+     bool       vt;                               /* Use VT stuff at all? */
+
+     bool       decorations;                      /* Enable window decorations. */
+
+     DFBSurfacePixelFormat font_format;           /* Preferred font format. */
+
+     char      *h3600_device;                     /* H3600 Touchscreen Device */
+
+     char      *mut_device;                       /* MuTouch Device */
+
+     char      *penmount_device;                  /* PenMount Device */
+
+     char      *zytronic_device;                  /* Zytronic Device */
+
+     char      *elo_device;                       /* elo Device */
+
+     int        unichrome_revision;               /* Unichrome hardware
+                                                     revision number override */
+
+     bool       dma;                              /* Enable DMA */
+
+     int        agp;                              /* AGP mode */
+     int        agpmem_limit;                     /* Limit of AGP memory
+                                                     used by DirectFB */
+     bool       i8xx_overlay_pipe_b;              /* video overlay output via pixel pipe B */
+     bool       primary_only;                     /* tell application only about primary layer */
+
+     bool       thrifty_surface_buffers;          /* don't keep system instance while video instance is alive */
+     bool       surface_sentinel;
+
+     DFBConfigLayer  layers[MAX_LAYERS];
+     DFBConfigLayer *config_layer;
+
+     DFBSurfaceRenderOptions  render_options;     /* default render options */
+
+     bool       startstop;                        /* Issue StartDrawing/StopDrawing to driver */
+
+     unsigned long video_phys;                    /* Physical base address of video memory */
+     unsigned int  video_length;                  /* Size of video memory */
+     unsigned long mmio_phys;                     /* Physical base address of MMIO area */
+     unsigned int  mmio_length;                   /* Size of MMIO area */
+     int           accelerator;                   /* Accelerator ID */
+
+     bool          font_premult;                  /* Use premultiplied data in case of ARGB glyph images */
+
+     FusionVector  linux_input_devices;
+     FusionVector  tslib_devices;
+
+     bool          thread_block_signals;          /* Call direct_signals_block_all() in direct_thread_main() startup. */
+
+     bool          linux_input_grab;              /* Grab input devices. */
+
+     bool          autoflip_window;               /* If primary surface is non-flipping, but windowed, flip automatically. */
+     bool          software_warn;                 /* Show warnings when doing/dropping software operations. */
+
+     int           surface_shmpool_size;          /* Set the size of the shared memory pool used for
+                                                     shared system memory surfaces. */
+
+     bool          no_cursor_updates;             /* Never show the cursor etc. */
+
+     struct {
+          DFBConfigWarnFlags  flags;              /* Warn on various actions as window/surface creation. */
+
+          struct {
+               DFBDimension   min_size;
+          } create_surface;
+
+          struct {
+               DFBDimension   min_size;
+          } allocate_buffer;
+     } warn;
+
+     int           keep_accumulators;             /* Free accumulators above this limit */
+
+     bool          software_trace;
+
+     unsigned int  max_axis_rate;
+
+     unsigned int  flip_notify_max_latency;
+
+     DFBWindowCursorFlags default_cursor_flags;
+
+     bool                 discard_repeat_events;
+} DFBConfig;
+
+extern DFBConfig *dfb_config;
+
+/*
+ * Allocate Config struct, fill with defaults and parse command line options
+ * for overrides. Options identified as DirectFB options are stripped out
+ * of the array.
+ */
+DFBResult dfb_config_init( int *argc, char *(*argv[]) );
+
+/*
+ * Read configuration options from file. Called by config_init().
+ *
+ * Returns DFB_IO if config file could not be opened.
+ * Returns DFB_UNSUPPORTED if file contains an invalid option.
+ * Returns DFB_INVARG if an invalid option assignment is done,
+ * e.g. "--desktop-buffer-mode=somethingwrong".
+ */
+DFBResult dfb_config_read( const char *filename );
+
+
+/*
+ * Set indiviual option. Used by config_init(), config_read() and
+ * DirectFBSetOption()
+ */
+DFBResult dfb_config_set( const char *name, const char *value );
+
+const char *dfb_config_usage( void );
+
+DFBSurfacePixelFormat dfb_config_parse_pixelformat( const char *format );
+
+#endif
+
diff --git a/Source/DirectFB/src/misc/dither565.h b/Source/DirectFB/src/misc/dither565.h
new file mode 100755
index 0000000..5231aee
--- /dev/null
+++ b/Source/DirectFB/src/misc/dither565.h
@@ -0,0 +1,211 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DITHER565_H__
+#define __DITHER565_H__
+
+
+#ifndef DIRECTFB_VERSION
+#error config.h must be included prior to dither565.h
+#endif
+
+
+/* Dither matrices
+ * ---------------
+ *
+ * Preprocessed matrices for 5-6-5 RGB displays, taken from GdkRGB.
+ */
+
+
+#if (DFB_DITHER565 == DFB_DITHER_ADVANCED)
+
+/* This dither table was generated by Raph Levien using patented
+ * technology (US Patent 5,276,535). The dither table itself is in the
+ * public domain.
+ */
+
+#define DM_WIDTH        128
+#define DM_HEIGHT       128
+#define DM_WIDTH_SHIFT  7
+
+static const u32 DM_565[DM_WIDTH * DM_HEIGHT] =
+{
+  3072, 5243909, 2099202, 3072, 2099202, 4195332, 3072, 1051649, 7340039, 2099202, 5243909, 6291462, 3147779, 5243909, 1051649, 4195332, 6291462, 3147779, 7340039, 3147779, 3072, 7340039, 3147779, 6291462, 4195332, 3072, 5243909, 7340039, 2099202, 4195332, 1051649, 5243909, 3147779, 7340039, 5243909, 4195332, 2099202, 5243909, 4195332, 1051649, 4195332, 3147779, 6291462, 1051649, 7340039, 3072, 5243909, 1051649, 4195332, 1051649, 7340039, 2099202, 3072, 5243909, 1051649, 4195332, 3072, 7340039, 1051649, 5243909, 3072, 6291462, 4195332, 2099202, 4195332, 7340039, 1051649, 6291462, 4195332, 7340039, 1051649, 3147779, 2099202, 1051649, 7340039, 2099202, 5243909, 6291462, 3072, 2099202, 6291462, 1051649, 2099202, 6291462, 4195332, 2099202, 2099202, 4195332, 1051649, 6291462, 2099202, 7340039, 3147779, 1051649, 4195332, 3147779, 6291462, 1051649, 2099202, 5243909, 2099202, 3147779, 3072, 2099202, 6291462, 3147779, 6291462, 2099202, 3072, 4195332, 7340039, 5243909, 3147779, 4195332, 1051649, 6291462, 2099202, 5243909, 3072, 6291462, 1051649, 5243909, 4195332, 6291462, 2099202, 5243909, 1051649, 7340039,
+  3147779, 7340039, 4195332, 6291462, 5243909, 4195332, 6291462, 3147779, 5243909, 3072, 3147779, 3072, 2099202, 4195332, 7340039, 1051649, 5243909, 3072, 2099202, 6291462, 4195332, 2099202, 5243909, 1051649, 3147779, 5243909, 1051649, 4195332, 3072, 6291462, 3147779, 7340039, 1051649, 3147779, 3072, 2099202, 6291462, 1051649, 7340039, 3147779, 5243909, 3072, 4195332, 3147779, 5243909, 2099202, 5243909, 3147779, 7340039, 4195332, 1051649, 4195332, 6291462, 2099202, 7340039, 3147779, 6291462, 2099202, 4195332, 3147779, 6291462, 2099202, 3072, 6291462, 2099202, 1051649, 3147779, 5243909, 3072, 4195332, 5243909, 2099202, 6291462, 5243909, 4195332, 2099202, 3147779, 1051649, 5243909, 3147779, 4195332, 7340039, 3072, 4195332, 1051649, 5243909, 7340039, 3147779, 7340039, 1051649, 5243909, 1051649, 5243909, 3072, 7340039, 3072, 2099202, 6291462, 7340039, 1051649, 6291462, 1051649, 5243909, 7340039, 1051649, 3147779, 3072, 6291462, 5243909, 3147779, 1051649, 6291462, 2099202, 7340039, 5243909, 3072, 4195332, 7340039, 4195332, 2099202, 7340039, 3147779, 2099202, 3072, 7340039, 4195332, 3147779, 4195332,
+  2099202, 1051649, 2099202, 4195332, 3072, 3147779, 1051649, 7340039, 2099202, 5243909, 7340039, 4195332, 6291462, 2099202, 3072, 5243909, 2099202, 4195332, 7340039, 3072, 6291462, 1051649, 7340039, 3072, 7340039, 2099202, 6291462, 3147779, 5243909, 2099202, 3072, 6291462, 1051649, 6291462, 5243909, 6291462, 3147779, 4195332, 3072, 6291462, 2099202, 7340039, 1051649, 6291462, 3072, 4195332, 1051649, 6291462, 2099202, 3147779, 6291462, 1051649, 3147779, 6291462, 3072, 4195332, 1051649, 5243909, 3072, 6291462, 1051649, 4195332, 7340039, 3147779, 7340039, 4195332, 6291462, 1051649, 7340039, 2099202, 3072, 7340039, 3072, 3147779, 3072, 6291462, 7340039, 4195332, 1051649, 7340039, 3072, 3147779, 5243909, 3147779, 6291462, 1051649, 3072, 5243909, 3072, 4195332, 4195332, 6291462, 3147779, 6291462, 4195332, 5243909, 7340039, 3072, 3147779, 4195332, 2099202, 7340039, 3072, 4195332, 5243909, 7340039, 4195332, 2099202, 7340039, 3072, 6291462, 3147779, 3072, 4195332, 2099202, 6291462, 3147779, 1051649, 5243909, 6291462, 1051649, 3072, 7340039, 4195332, 2099202, 6291462, 3072, 5243909,
+  6291462, 6291462, 5243909, 1051649, 5243909, 7340039, 3147779, 4195332, 1051649, 4195332, 2099202, 3072, 3147779, 5243909, 3147779, 7340039, 3072, 6291462, 1051649, 4195332, 3147779, 2099202, 4195332, 4195332, 2099202, 5243909, 3072, 6291462, 1051649, 7340039, 3147779, 4195332, 2099202, 4195332, 2099202, 2099202, 3072, 5243909, 4195332, 2099202, 1051649, 5243909, 3147779, 3147779, 7340039, 2099202, 7340039, 3072, 5243909, 3072, 5243909, 7340039, 3072, 3147779, 5243909, 2099202, 7340039, 3147779, 7340039, 2099202, 4195332, 5243909, 1051649, 5243909, 3072, 4195332, 3072, 4195332, 1051649, 5243909, 6291462, 4195332, 2099202, 6291462, 5243909, 1051649, 2099202, 3072, 6291462, 2099202, 6291462, 5243909, 1051649, 7340039, 2099202, 6291462, 3147779, 6291462, 2099202, 7340039, 1051649, 3072, 7340039, 2099202, 1051649, 2099202, 4195332, 4195332, 2099202, 5243909, 3072, 6291462, 3147779, 4195332, 2099202, 3072, 6291462, 1051649, 3147779, 5243909, 4195332, 2099202, 7340039, 1051649, 5243909, 1051649, 6291462, 2099202, 3072, 4195332, 3147779, 5243909, 3147779, 3072, 6291462, 1051649, 7340039, 3072,
+  2099202, 3147779, 3072, 7340039, 2099202, 1051649, 6291462, 3072, 5243909, 6291462, 1051649, 7340039, 1051649, 6291462, 1051649, 4195332, 2099202, 3147779, 5243909, 1051649, 6291462, 3147779, 5243909, 3072, 6291462, 1051649, 7340039, 1051649, 4195332, 1051649, 6291462, 1051649, 7340039, 3072, 7340039, 5243909, 7340039, 1051649, 6291462, 3147779, 7340039, 4195332, 1051649, 6291462, 3072, 5243909, 3147779, 4195332, 6291462, 2099202, 4195332, 1051649, 6291462, 4195332, 1051649, 6291462, 3072, 2099202, 1051649, 5243909, 3072, 7340039, 1051649, 2099202, 6291462, 2099202, 6291462, 3147779, 7340039, 2099202, 3147779, 1051649, 5243909, 1051649, 3147779, 7340039, 5243909, 4195332, 3147779, 4195332, 1051649, 3147779, 2099202, 4195332, 3072, 5243909, 4195332, 1051649, 6291462, 4195332, 2099202, 5243909, 3147779, 5243909, 3147779, 6291462, 3072, 5243909, 6291462, 1051649, 7340039, 3147779, 1051649, 6291462, 2099202, 5243909, 4195332, 2099202, 4195332, 3072, 6291462, 1051649, 5243909, 4195332, 3072, 7340039, 3147779, 5243909, 7340039, 2099202, 1051649, 7340039, 4195332, 5243909, 1051649, 4195332, 3147779, 4195332,
+  6291462, 4195332, 7340039, 3147779, 4195332, 5243909, 2099202, 7340039, 3072, 4195332, 5243909, 3147779, 5243909, 4195332, 3072, 6291462, 6291462, 1051649, 7340039, 2099202, 5243909, 3072, 7340039, 3147779, 2099202, 5243909, 4195332, 3147779, 7340039, 5243909, 2099202, 4195332, 4195332, 3147779, 5243909, 1051649, 3147779, 2099202, 3072, 5243909, 1051649, 6291462, 3072, 4195332, 2099202, 6291462, 1051649, 2099202, 3072, 7340039, 2099202, 3147779, 6291462, 2099202, 7340039, 3147779, 5243909, 4195332, 7340039, 1051649, 6291462, 4195332, 3147779, 5243909, 2099202, 7340039, 3147779, 1051649, 5243909, 3072, 4195332, 7340039, 1051649, 7340039, 3147779, 3072, 6291462, 1051649, 7340039, 3072, 5243909, 7340039, 3072, 7340039, 3147779, 2099202, 3072, 7340039, 3147779, 1051649, 7340039, 2099202, 5243909, 3072, 7340039, 4195332, 3147779, 1051649, 3147779, 4195332, 1051649, 5243909, 6291462, 3072, 6291462, 1051649, 7340039, 3072, 7340039, 1051649, 3147779, 7340039, 2099202, 6291462, 4195332, 2099202, 4195332, 1051649, 3147779, 6291462, 5243909, 2099202, 3072, 3147779, 7340039, 2099202, 6291462, 1051649,
+  3147779, 3072, 3147779, 1051649, 6291462, 3072, 4195332, 3147779, 2099202, 6291462, 2099202, 7340039, 3072, 7340039, 3147779, 2099202, 3072, 4195332, 3147779, 3072, 6291462, 4195332, 1051649, 6291462, 3147779, 6291462, 2099202, 5243909, 3072, 3147779, 7340039, 3072, 6291462, 1051649, 3147779, 3072, 6291462, 5243909, 7340039, 3147779, 4195332, 1051649, 7340039, 2099202, 5243909, 1051649, 7340039, 4195332, 5243909, 3147779, 5243909, 5243909, 3072, 4195332, 1051649, 5243909, 2099202, 3072, 5243909, 3147779, 3147779, 2099202, 7340039, 3072, 4195332, 3072, 5243909, 4195332, 3147779, 6291462, 2099202, 3147779, 6291462, 3072, 4195332, 7340039, 2099202, 4195332, 2099202, 6291462, 1051649, 5243909, 3147779, 4195332, 1051649, 6291462, 5243909, 3147779, 2099202, 5243909, 4195332, 3072, 6291462, 2099202, 1051649, 1051649, 6291462, 7340039, 3072, 7340039, 5243909, 2099202, 1051649, 3147779, 7340039, 3147779, 3147779, 5243909, 3147779, 6291462, 4195332, 2099202, 5243909, 3072, 3147779, 6291462, 3072, 7340039, 3072, 4195332, 3072, 7340039, 6291462, 5243909, 1051649, 5243909, 3072, 5243909,
+  2099202, 7340039, 5243909, 3072, 7340039, 3147779, 7340039, 1051649, 6291462, 1051649, 4195332, 1051649, 3147779, 5243909, 2099202, 5243909, 7340039, 3147779, 6291462, 4195332, 1051649, 7340039, 2099202, 4195332, 3072, 5243909, 3072, 7340039, 4195332, 2099202, 5243909, 1051649, 5243909, 2099202, 7340039, 5243909, 2099202, 1051649, 4195332, 2099202, 6291462, 4195332, 2099202, 7340039, 3147779, 6291462, 3147779, 3072, 2099202, 6291462, 3072, 7340039, 2099202, 7340039, 3147779, 3072, 7340039, 4195332, 2099202, 7340039, 3072, 6291462, 3072, 5243909, 3147779, 7340039, 1051649, 6291462, 1051649, 7340039, 3072, 2099202, 4195332, 2099202, 5243909, 1051649, 5243909, 3072, 5243909, 3147779, 4195332, 2099202, 6291462, 2099202, 6291462, 5243909, 1051649, 7340039, 3072, 6291462, 1051649, 6291462, 3147779, 4195332, 7340039, 2099202, 5243909, 2099202, 4195332, 3147779, 3072, 6291462, 4195332, 4195332, 3072, 5243909, 1051649, 5243909, 1051649, 2099202, 3072, 6291462, 1051649, 4195332, 7340039, 1051649, 5243909, 2099202, 6291462, 3147779, 5243909, 2099202, 3147779, 1051649, 7340039, 2099202, 4195332, 7340039,
+  6291462, 4195332, 1051649, 5243909, 3147779, 2099202, 5243909, 3072, 4195332, 7340039, 3147779, 5243909, 6291462, 3072, 7340039, 1051649, 5243909, 2099202, 3072, 7340039, 2099202, 1051649, 5243909, 1051649, 7340039, 4195332, 1051649, 3147779, 3072, 6291462, 2099202, 7340039, 4195332, 6291462, 3072, 4195332, 6291462, 3147779, 7340039, 3072, 5243909, 3072, 5243909, 3072, 5243909, 3072, 6291462, 4195332, 7340039, 1051649, 4195332, 1051649, 5243909, 1051649, 4195332, 6291462, 3147779, 6291462, 1051649, 5243909, 2099202, 4195332, 7340039, 1051649, 2099202, 6291462, 4195332, 3072, 5243909, 3147779, 5243909, 6291462, 3072, 6291462, 1051649, 7340039, 3147779, 6291462, 1051649, 7340039, 3072, 6291462, 3072, 7340039, 3072, 4195332, 2099202, 4195332, 5243909, 3147779, 3147779, 7340039, 3072, 1051649, 5243909, 4195332, 3072, 6291462, 1051649, 7340039, 2099202, 5243909, 1051649, 7340039, 2099202, 7340039, 3072, 6291462, 3147779, 7340039, 5243909, 3147779, 6291462, 2099202, 5243909, 3147779, 7340039, 4195332, 2099202, 5243909, 1051649, 4195332, 3072, 6291462, 4195332, 6291462, 2099202, 1051649,
+  3072, 2099202, 5243909, 2099202, 6291462, 1051649, 4195332, 6291462, 2099202, 5243909, 3072, 2099202, 3147779, 4195332, 4195332, 2099202, 3147779, 7340039, 1051649, 4195332, 5243909, 3147779, 7340039, 5243909, 3147779, 2099202, 7340039, 6291462, 5243909, 3147779, 3072, 4195332, 3072, 3147779, 2099202, 7340039, 3072, 1051649, 5243909, 3147779, 6291462, 2099202, 3147779, 6291462, 1051649, 4195332, 2099202, 1051649, 5243909, 3147779, 2099202, 6291462, 3147779, 5243909, 6291462, 1051649, 4195332, 3072, 6291462, 3147779, 6291462, 1051649, 4195332, 3147779, 5243909, 1051649, 2099202, 3147779, 7340039, 1051649, 4195332, 6291462, 2099202, 4195332, 3147779, 3072, 5243909, 2099202, 4195332, 2099202, 3147779, 5243909, 3147779, 4195332, 2099202, 6291462, 3147779, 3072, 7340039, 1051649, 5243909, 2099202, 3147779, 6291462, 2099202, 7340039, 3147779, 4195332, 5243909, 2099202, 6291462, 3147779, 3147779, 1051649, 5243909, 2099202, 4195332, 2099202, 4195332, 3072, 4195332, 1051649, 1051649, 7340039, 3072, 2099202, 1051649, 3072, 7340039, 1051649, 6291462, 3147779, 5243909, 3147779, 1051649, 3072, 3147779, 6291462,
+  5243909, 3147779, 7340039, 3072, 4195332, 7340039, 3147779, 1051649, 7340039, 1051649, 6291462, 7340039, 1051649, 6291462, 1051649, 6291462, 3072, 5243909, 3147779, 6291462, 3072, 4195332, 2099202, 3072, 6291462, 4195332, 3072, 2099202, 1051649, 7340039, 6291462, 1051649, 6291462, 6291462, 5243909, 3147779, 4195332, 7340039, 1051649, 4195332, 1051649, 7340039, 4195332, 1051649, 7340039, 3147779, 7340039, 5243909, 1051649, 6291462, 5243909, 3072, 4195332, 2099202, 3072, 2099202, 7340039, 3147779, 1051649, 5243909, 3072, 6291462, 5243909, 3072, 6291462, 4195332, 6291462, 7340039, 3072, 5243909, 2099202, 3072, 7340039, 3147779, 6291462, 4195332, 7340039, 1051649, 7340039, 3147779, 5243909, 1051649, 7340039, 3072, 5243909, 1051649, 7340039, 5243909, 3147779, 4195332, 3072, 7340039, 5243909, 1051649, 4195332, 3072, 6291462, 1051649, 7340039, 3072, 4195332, 1051649, 5243909, 6291462, 3072, 6291462, 3147779, 3072, 7340039, 6291462, 3147779, 7340039, 5243909, 3147779, 4195332, 5243909, 6291462, 3147779, 5243909, 4195332, 2099202, 7340039, 3072, 7340039, 5243909, 4195332, 7340039, 2099202,
+  3072, 6291462, 1051649, 6291462, 2099202, 5243909, 3072, 5243909, 3147779, 2099202, 5243909, 4195332, 3072, 5243909, 2099202, 3147779, 7340039, 1051649, 4195332, 2099202, 5243909, 6291462, 3147779, 7340039, 1051649, 6291462, 3147779, 5243909, 4195332, 2099202, 2099202, 4195332, 3147779, 1051649, 2099202, 3072, 6291462, 2099202, 4195332, 2099202, 6291462, 3072, 3147779, 5243909, 2099202, 4195332, 3072, 3147779, 4195332, 3072, 7340039, 1051649, 7340039, 4195332, 7340039, 3147779, 5243909, 2099202, 4195332, 7340039, 3147779, 2099202, 1051649, 7340039, 2099202, 3072, 2099202, 2099202, 4195332, 1051649, 7340039, 3147779, 5243909, 1051649, 1051649, 5243909, 2099202, 4195332, 3072, 6291462, 3072, 4195332, 1051649, 6291462, 3147779, 4195332, 2099202, 3072, 6291462, 1051649, 6291462, 4195332, 3147779, 3072, 7340039, 5243909, 1051649, 4195332, 2099202, 6291462, 2099202, 7340039, 3072, 4195332, 4195332, 1051649, 7340039, 5243909, 2099202, 1051649, 5243909, 3072, 4195332, 3072, 6291462, 1051649, 2099202, 6291462, 1051649, 5243909, 3072, 4195332, 2099202, 4195332, 3072, 3147779, 1051649, 4195332,
+  6291462, 4195332, 3147779, 1051649, 6291462, 1051649, 4195332, 6291462, 3072, 7340039, 3072, 2099202, 6291462, 4195332, 7340039, 1051649, 5243909, 3147779, 7340039, 1051649, 6291462, 3072, 3147779, 4195332, 2099202, 5243909, 3072, 7340039, 3072, 4195332, 7340039, 3072, 5243909, 7340039, 4195332, 5243909, 3147779, 5243909, 3072, 7340039, 2099202, 5243909, 6291462, 3072, 4195332, 7340039, 6291462, 2099202, 7340039, 2099202, 5243909, 3147779, 4195332, 3072, 2099202, 5243909, 3072, 6291462, 2099202, 3072, 5243909, 4195332, 6291462, 3147779, 4195332, 7340039, 5243909, 3147779, 6291462, 4195332, 3072, 6291462, 3147779, 5243909, 7340039, 3072, 6291462, 2099202, 5243909, 3147779, 7340039, 2099202, 6291462, 2099202, 7340039, 1051649, 4195332, 7340039, 2099202, 4195332, 2099202, 3072, 6291462, 5243909, 3147779, 2099202, 3147779, 6291462, 3072, 3147779, 5243909, 2099202, 4195332, 7340039, 2099202, 5243909, 3147779, 1051649, 6291462, 4195332, 2099202, 6291462, 3147779, 7340039, 3147779, 7340039, 4195332, 3072, 7340039, 2099202, 6291462, 7340039, 1051649, 6291462, 2099202, 7340039, 5243909, 2099202,
+  2099202, 3072, 7340039, 5243909, 3147779, 7340039, 3072, 2099202, 5243909, 3147779, 4195332, 7340039, 1051649, 3147779, 3072, 6291462, 1051649, 6291462, 3072, 4195332, 2099202, 7340039, 1051649, 5243909, 1051649, 6291462, 2099202, 3147779, 6291462, 3147779, 1051649, 6291462, 2099202, 3072, 6291462, 1051649, 7340039, 1051649, 6291462, 3147779, 4195332, 3072, 3147779, 7340039, 1051649, 2099202, 1051649, 5243909, 3147779, 3072, 4195332, 1051649, 6291462, 6291462, 1051649, 7340039, 1051649, 4195332, 7340039, 4195332, 1051649, 7340039, 3072, 3147779, 2099202, 3072, 5243909, 1051649, 1051649, 5243909, 2099202, 4195332, 1051649, 2099202, 3147779, 4195332, 1051649, 6291462, 3147779, 1051649, 2099202, 5243909, 3072, 4195332, 3072, 5243909, 3147779, 1051649, 6291462, 3072, 7340039, 5243909, 2099202, 4195332, 3072, 7340039, 5243909, 1051649, 4195332, 7340039, 3072, 6291462, 3147779, 3072, 2099202, 6291462, 3072, 7340039, 4195332, 3072, 7340039, 1051649, 2099202, 1051649, 1051649, 4195332, 3147779, 5243909, 4195332, 3072, 3147779, 1051649, 5243909, 3147779, 6291462, 1051649, 3147779, 7340039,
+  6291462, 4195332, 2099202, 4195332, 3072, 5243909, 6291462, 4195332, 6291462, 1051649, 3147779, 6291462, 3147779, 7340039, 4195332, 2099202, 5243909, 2099202, 4195332, 7340039, 2099202, 5243909, 3147779, 3072, 7340039, 4195332, 3147779, 5243909, 1051649, 2099202, 6291462, 4195332, 5243909, 1051649, 3147779, 4195332, 1051649, 3147779, 5243909, 3072, 5243909, 6291462, 2099202, 5243909, 3147779, 5243909, 6291462, 1051649, 7340039, 6291462, 2099202, 7340039, 3072, 3147779, 5243909, 2099202, 4195332, 3147779, 1051649, 6291462, 2099202, 5243909, 1051649, 6291462, 6291462, 4195332, 7340039, 3147779, 7340039, 3147779, 7340039, 3072, 5243909, 7340039, 4195332, 7340039, 2099202, 5243909, 3072, 7340039, 6291462, 1051649, 7340039, 4195332, 6291462, 2099202, 6291462, 3147779, 4195332, 5243909, 1051649, 3147779, 6291462, 1051649, 6291462, 4195332, 2099202, 7340039, 3147779, 1051649, 5243909, 4195332, 2099202, 6291462, 4195332, 3147779, 5243909, 1051649, 3147779, 6291462, 3147779, 4195332, 5243909, 6291462, 7340039, 3072, 6291462, 1051649, 7340039, 2099202, 6291462, 6291462, 3072, 4195332, 1051649, 5243909, 3147779, 3072,
+  5243909, 1051649, 7340039, 3147779, 2099202, 3147779, 2099202, 1051649, 4195332, 3072, 5243909, 1051649, 3072, 5243909, 1051649, 5243909, 3072, 6291462, 3147779, 3072, 4195332, 1051649, 6291462, 4195332, 2099202, 1051649, 6291462, 3072, 5243909, 7340039, 1051649, 3147779, 3072, 7340039, 2099202, 5243909, 3147779, 6291462, 2099202, 7340039, 2099202, 1051649, 7340039, 3072, 6291462, 3072, 4195332, 3147779, 3072, 2099202, 4195332, 5243909, 2099202, 6291462, 3147779, 3072, 6291462, 7340039, 3147779, 4195332, 3072, 7340039, 3147779, 5243909, 3072, 2099202, 1051649, 4195332, 3072, 6291462, 1051649, 5243909, 2099202, 1051649, 3072, 3147779, 6291462, 2099202, 4195332, 4195332, 3072, 5243909, 3147779, 1051649, 1051649, 5243909, 3072, 5243909, 3072, 3147779, 7340039, 3072, 3147779, 7340039, 2099202, 1051649, 3072, 5243909, 2099202, 6291462, 3147779, 3072, 7340039, 1051649, 5243909, 3072, 3147779, 7340039, 3072, 5243909, 2099202, 7340039, 3072, 4195332, 2099202, 3147779, 5243909, 2099202, 3147779, 5243909, 1051649, 3147779, 7340039, 2099202, 6291462, 1051649, 7340039, 3147779,
+  2099202, 6291462, 1051649, 5243909, 7340039, 3072, 7340039, 6291462, 2099202, 7340039, 2099202, 4195332, 7340039, 2099202, 6291462, 3147779, 4195332, 7340039, 1051649, 6291462, 7340039, 5243909, 3147779, 3072, 6291462, 3147779, 7340039, 2099202, 4195332, 3072, 4195332, 7340039, 6291462, 4195332, 5243909, 3072, 7340039, 3072, 4195332, 1051649, 5243909, 4195332, 2099202, 4195332, 3147779, 1051649, 7340039, 3147779, 5243909, 4195332, 1051649, 6291462, 3072, 4195332, 1051649, 7340039, 2099202, 3072, 5243909, 2099202, 5243909, 1051649, 4195332, 2099202, 7340039, 5243909, 3147779, 6291462, 5243909, 1051649, 4195332, 3147779, 7340039, 4195332, 6291462, 3072, 5243909, 1051649, 3147779, 6291462, 3147779, 2099202, 7340039, 5243909, 3147779, 4195332, 7340039, 2099202, 7340039, 2099202, 2099202, 6291462, 4195332, 1051649, 5243909, 7340039, 3147779, 4195332, 6291462, 3072, 4195332, 7340039, 1051649, 6291462, 2099202, 7340039, 1051649, 4195332, 6291462, 3147779, 1051649, 5243909, 1051649, 3147779, 3072, 7340039, 1051649, 6291462, 3072, 7340039, 4195332, 4195332, 2099202, 5243909, 3072, 4195332, 3072, 5243909,
+  3072, 7340039, 2099202, 4195332, 1051649, 5243909, 1051649, 4195332, 3072, 3147779, 6291462, 3147779, 3072, 4195332, 1051649, 7340039, 2099202, 3072, 4195332, 3147779, 2099202, 3072, 6291462, 4195332, 5243909, 1051649, 4195332, 2099202, 7340039, 5243909, 3147779, 1051649, 2099202, 1051649, 7340039, 3147779, 2099202, 6291462, 4195332, 7340039, 3072, 7340039, 1051649, 5243909, 7340039, 5243909, 1051649, 2099202, 6291462, 3072, 7340039, 1051649, 7340039, 3147779, 5243909, 2099202, 4195332, 6291462, 1051649, 7340039, 3147779, 3147779, 6291462, 3072, 4195332, 1051649, 7340039, 3072, 2099202, 7340039, 3072, 6291462, 3072, 2099202, 5243909, 3147779, 7340039, 4195332, 7340039, 1051649, 4195332, 6291462, 2099202, 3072, 7340039, 1051649, 4195332, 3147779, 1051649, 6291462, 5243909, 1051649, 5243909, 2099202, 3147779, 6291462, 3072, 4195332, 1051649, 7340039, 2099202, 5243909, 3147779, 1051649, 5243909, 3147779, 6291462, 2099202, 1051649, 4195332, 6291462, 2099202, 4195332, 6291462, 5243909, 2099202, 4195332, 3147779, 6291462, 2099202, 3072, 5243909, 3072, 6291462, 4195332, 7340039, 3147779, 4195332,
+  5243909, 3147779, 3072, 4195332, 6291462, 3147779, 4195332, 7340039, 3147779, 5243909, 1051649, 5243909, 6291462, 3147779, 6291462, 3072, 5243909, 4195332, 7340039, 1051649, 3147779, 7340039, 2099202, 5243909, 1051649, 7340039, 3072, 5243909, 3072, 2099202, 5243909, 3072, 7340039, 4195332, 1051649, 6291462, 4195332, 3072, 1051649, 3147779, 2099202, 6291462, 3147779, 2099202, 3072, 3147779, 6291462, 5243909, 3147779, 2099202, 5243909, 3147779, 3147779, 5243909, 1051649, 6291462, 4195332, 3072, 5243909, 2099202, 3072, 5243909, 1051649, 6291462, 3147779, 5243909, 2099202, 4195332, 5243909, 3147779, 5243909, 2099202, 3147779, 7340039, 1051649, 6291462, 3072, 1051649, 5243909, 3072, 7340039, 3072, 5243909, 3147779, 6291462, 3072, 6291462, 2099202, 5243909, 4195332, 3072, 3147779, 6291462, 3072, 7340039, 1051649, 5243909, 2099202, 5243909, 3147779, 5243909, 3072, 4195332, 6291462, 3072, 6291462, 3072, 4195332, 5243909, 2099202, 3072, 7340039, 5243909, 3072, 2099202, 7340039, 3072, 5243909, 1051649, 4195332, 6291462, 2099202, 7340039, 1051649, 3147779, 2099202, 6291462, 1051649,
+  7340039, 3147779, 6291462, 2099202, 3072, 7340039, 2099202, 3072, 6291462, 1051649, 6291462, 2099202, 4195332, 1051649, 2099202, 6291462, 3147779, 2099202, 3072, 5243909, 5243909, 3147779, 1051649, 7340039, 2099202, 3147779, 6291462, 4195332, 3147779, 6291462, 3147779, 6291462, 2099202, 3147779, 5243909, 3072, 3147779, 7340039, 5243909, 6291462, 5243909, 3072, 4195332, 7340039, 6291462, 2099202, 4195332, 3072, 6291462, 4195332, 6291462, 1051649, 6291462, 3072, 7340039, 3072, 3147779, 7340039, 3147779, 4195332, 6291462, 3147779, 7340039, 2099202, 6291462, 3072, 4195332, 7340039, 1051649, 6291462, 3072, 7340039, 1051649, 5243909, 4195332, 2099202, 4195332, 6291462, 2099202, 6291462, 3147779, 2099202, 7340039, 4195332, 1051649, 4195332, 5243909, 3072, 7340039, 1051649, 6291462, 7340039, 2099202, 5243909, 3147779, 4195332, 2099202, 7340039, 3072, 6291462, 1051649, 3147779, 7340039, 2099202, 3147779, 5243909, 2099202, 7340039, 3147779, 6291462, 3147779, 4195332, 1051649, 7340039, 1051649, 4195332, 6291462, 3147779, 7340039, 3147779, 1051649, 5243909, 3147779, 4195332, 6291462, 1051649, 5243909, 2099202,
+  1051649, 5243909, 1051649, 6291462, 3147779, 5243909, 1051649, 5243909, 3147779, 3072, 4195332, 7340039, 3072, 7340039, 5243909, 3072, 7340039, 3147779, 6291462, 2099202, 1051649, 6291462, 4195332, 4195332, 3072, 5243909, 1051649, 1051649, 7340039, 3072, 1051649, 4195332, 7340039, 1051649, 2099202, 6291462, 2099202, 1051649, 3147779, 3072, 1051649, 6291462, 2099202, 1051649, 4195332, 1051649, 5243909, 7340039, 1051649, 2099202, 3072, 7340039, 4195332, 2099202, 3147779, 4195332, 5243909, 1051649, 3072, 7340039, 1051649, 4195332, 3072, 4195332, 2099202, 7340039, 3147779, 1051649, 2099202, 6291462, 4195332, 2099202, 5243909, 3147779, 3072, 7340039, 3147779, 1051649, 3147779, 5243909, 1051649, 4195332, 3072, 6291462, 2099202, 7340039, 2099202, 4195332, 1051649, 5243909, 3147779, 3072, 4195332, 1051649, 7340039, 3072, 6291462, 4195332, 3147779, 2099202, 7340039, 6291462, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 5243909, 3072, 7340039, 1051649, 4195332, 3147779, 5243909, 2099202, 3072, 2099202, 3072, 6291462, 3147779, 7340039, 2099202, 3072, 7340039, 3147779, 3072, 6291462,
+  4195332, 3072, 4195332, 1051649, 3147779, 4195332, 6291462, 2099202, 7340039, 5243909, 3147779, 1051649, 3147779, 5243909, 2099202, 4195332, 1051649, 5243909, 1051649, 4195332, 6291462, 3072, 2099202, 6291462, 2099202, 3147779, 6291462, 4195332, 2099202, 5243909, 6291462, 3147779, 3072, 5243909, 5243909, 4195332, 7340039, 4195332, 6291462, 4195332, 7340039, 3147779, 4195332, 5243909, 3147779, 7340039, 3072, 3147779, 4195332, 7340039, 2099202, 5243909, 1051649, 5243909, 7340039, 1051649, 6291462, 3147779, 5243909, 2099202, 1051649, 6291462, 5243909, 1051649, 3147779, 6291462, 3072, 5243909, 4195332, 3072, 3147779, 6291462, 1051649, 6291462, 2099202, 5243909, 3072, 7340039, 5243909, 3072, 7340039, 3147779, 5243909, 1051649, 4195332, 3072, 6291462, 3147779, 7340039, 2099202, 4195332, 6291462, 3147779, 5243909, 2099202, 4195332, 1051649, 1051649, 5243909, 4195332, 3072, 4195332, 3147779, 5243909, 3072, 6291462, 1051649, 7340039, 3147779, 2099202, 5243909, 2099202, 5243909, 6291462, 3072, 7340039, 5243909, 7340039, 4195332, 5243909, 1051649, 3072, 6291462, 4195332, 1051649, 7340039, 5243909, 2099202,
+  7340039, 5243909, 4195332, 7340039, 6291462, 3072, 1051649, 4195332, 1051649, 5243909, 2099202, 6291462, 4195332, 1051649, 7340039, 3147779, 6291462, 3147779, 7340039, 3072, 3147779, 5243909, 7340039, 1051649, 5243909, 7340039, 3072, 7340039, 3147779, 1051649, 4195332, 6291462, 2099202, 7340039, 2099202, 3072, 3147779, 3072, 2099202, 5243909, 1051649, 5243909, 3072, 7340039, 3072, 3147779, 6291462, 1051649, 6291462, 1051649, 3147779, 4195332, 6291462, 3072, 2099202, 4195332, 2099202, 6291462, 3072, 5243909, 7340039, 2099202, 3147779, 7340039, 5243909, 1051649, 3147779, 6291462, 2099202, 7340039, 1051649, 3147779, 4195332, 1051649, 7340039, 1051649, 5243909, 2099202, 2099202, 5243909, 4195332, 1051649, 3147779, 7340039, 5243909, 3147779, 6291462, 3072, 3147779, 7340039, 3072, 1051649, 6291462, 3072, 7340039, 3147779, 6291462, 3147779, 7340039, 1051649, 7340039, 3072, 6291462, 1051649, 5243909, 2099202, 3147779, 5243909, 1051649, 7340039, 1051649, 6291462, 3072, 2099202, 4195332, 4195332, 1051649, 1051649, 3147779, 2099202, 5243909, 4195332, 2099202, 5243909, 3147779, 1051649, 4195332, 2099202,
+  3072, 3147779, 2099202, 3072, 2099202, 6291462, 5243909, 7340039, 2099202, 3072, 7340039, 1051649, 6291462, 2099202, 4195332, 3072, 2099202, 3072, 5243909, 2099202, 6291462, 1051649, 3147779, 4195332, 3072, 2099202, 5243909, 1051649, 5243909, 7340039, 2099202, 3072, 5243909, 1051649, 4195332, 6291462, 3147779, 5243909, 7340039, 2099202, 6291462, 3147779, 2099202, 5243909, 2099202, 5243909, 4195332, 3072, 5243909, 3147779, 7340039, 3072, 2099202, 5243909, 7340039, 3072, 5243909, 1051649, 6291462, 4195332, 3072, 4195332, 5243909, 3072, 2099202, 6291462, 4195332, 3072, 5243909, 4195332, 5243909, 7340039, 3072, 6291462, 4195332, 3147779, 6291462, 4195332, 6291462, 1051649, 6291462, 2099202, 6291462, 3072, 2099202, 3147779, 1051649, 4195332, 6291462, 2099202, 5243909, 3147779, 5243909, 2099202, 4195332, 3072, 2099202, 5243909, 1051649, 4195332, 2099202, 6291462, 2099202, 4195332, 3072, 7340039, 4195332, 3072, 6291462, 4195332, 6291462, 4195332, 3147779, 7340039, 1051649, 6291462, 3147779, 6291462, 7340039, 3072, 7340039, 3147779, 6291462, 3072, 7340039, 3072, 5243909, 7340039,
+  1051649, 6291462, 5243909, 5243909, 7340039, 3147779, 3072, 2099202, 4195332, 6291462, 4195332, 3147779, 5243909, 3072, 5243909, 7340039, 5243909, 6291462, 4195332, 7340039, 3147779, 3072, 5243909, 5243909, 7340039, 4195332, 2099202, 6291462, 3147779, 3072, 4195332, 7340039, 3147779, 6291462, 2099202, 1051649, 5243909, 1051649, 3072, 4195332, 3072, 6291462, 1051649, 7340039, 3147779, 1051649, 6291462, 2099202, 7340039, 1051649, 2099202, 4195332, 6291462, 1051649, 3147779, 4195332, 7340039, 3147779, 2099202, 7340039, 1051649, 7340039, 1051649, 6291462, 3147779, 7340039, 1051649, 7340039, 3147779, 1051649, 5243909, 2099202, 2099202, 4195332, 6291462, 3072, 3147779, 3072, 3147779, 3072, 3147779, 5243909, 4195332, 2099202, 6291462, 7340039, 5243909, 3072, 4195332, 1051649, 3147779, 7340039, 1051649, 6291462, 2099202, 6291462, 5243909, 3072, 6291462, 5243909, 3072, 3147779, 5243909, 7340039, 3147779, 2099202, 6291462, 2099202, 3147779, 1051649, 2099202, 3072, 7340039, 3147779, 5243909, 2099202, 3072, 4195332, 2099202, 4195332, 3147779, 1051649, 5243909, 2099202, 4195332, 6291462, 2099202, 2099202,
+  6291462, 4195332, 3072, 3147779, 1051649, 4195332, 7340039, 5243909, 3147779, 3072, 7340039, 3072, 3147779, 6291462, 2099202, 1051649, 1051649, 4195332, 2099202, 1051649, 4195332, 7340039, 2099202, 1051649, 1051649, 3147779, 6291462, 3072, 5243909, 6291462, 2099202, 1051649, 4195332, 3072, 6291462, 7340039, 3147779, 6291462, 4195332, 7340039, 3147779, 2099202, 6291462, 3072, 4195332, 7340039, 3147779, 3072, 4195332, 6291462, 5243909, 3072, 7340039, 4195332, 6291462, 1051649, 2099202, 6291462, 3072, 3147779, 5243909, 3147779, 4195332, 2099202, 3072, 4195332, 2099202, 5243909, 1051649, 7340039, 3072, 4195332, 7340039, 1051649, 1051649, 7340039, 2099202, 6291462, 7340039, 4195332, 7340039, 1051649, 3072, 7340039, 1051649, 4195332, 2099202, 7340039, 5243909, 3147779, 6291462, 1051649, 4195332, 3072, 7340039, 3147779, 1051649, 4195332, 3147779, 2099202, 7340039, 5243909, 1051649, 1051649, 6291462, 4195332, 3072, 5243909, 7340039, 3147779, 5243909, 4195332, 1051649, 5243909, 3072, 6291462, 3147779, 5243909, 1051649, 6291462, 1051649, 7340039, 3147779, 5243909, 4195332, 3072, 6291462, 3147779,
+  1051649, 4195332, 1051649, 7340039, 6291462, 4195332, 3072, 2099202, 6291462, 1051649, 5243909, 2099202, 5243909, 2099202, 4195332, 7340039, 3147779, 7340039, 3072, 5243909, 6291462, 3072, 4195332, 6291462, 6291462, 3072, 7340039, 4195332, 2099202, 1051649, 7340039, 3147779, 7340039, 2099202, 4195332, 3072, 5243909, 2099202, 3147779, 1051649, 5243909, 4195332, 3147779, 6291462, 2099202, 1051649, 5243909, 7340039, 3147779, 3072, 2099202, 5243909, 2099202, 3147779, 3072, 5243909, 2099202, 4195332, 5243909, 1051649, 6291462, 1051649, 6291462, 3147779, 7340039, 4195332, 6291462, 3072, 4195332, 3147779, 6291462, 2099202, 3147779, 5243909, 2099202, 4195332, 5243909, 2099202, 1051649, 4195332, 2099202, 6291462, 5243909, 3147779, 5243909, 3072, 5243909, 2099202, 1051649, 6291462, 3072, 5243909, 3147779, 5243909, 2099202, 5243909, 7340039, 2099202, 6291462, 1051649, 3147779, 3072, 7340039, 4195332, 5243909, 2099202, 7340039, 4195332, 1051649, 6291462, 3072, 6291462, 3147779, 2099202, 7340039, 2099202, 6291462, 1051649, 7340039, 3072, 4195332, 5243909, 2099202, 3072, 7340039, 3147779, 1051649, 5243909,
+  7340039, 3147779, 5243909, 3147779, 1051649, 2099202, 6291462, 1051649, 7340039, 3147779, 4195332, 7340039, 3072, 6291462, 3147779, 3072, 6291462, 2099202, 4195332, 1051649, 3147779, 3147779, 5243909, 2099202, 3147779, 4195332, 1051649, 3147779, 7340039, 5243909, 1051649, 4195332, 3072, 5243909, 1051649, 4195332, 7340039, 3072, 6291462, 7340039, 3072, 7340039, 1051649, 4195332, 7340039, 2099202, 4195332, 1051649, 6291462, 3147779, 7340039, 1051649, 6291462, 6291462, 4195332, 3147779, 7340039, 3072, 7340039, 3147779, 2099202, 7340039, 4195332, 3072, 5243909, 1051649, 2099202, 5243909, 3072, 7340039, 1051649, 5243909, 3072, 6291462, 4195332, 3072, 7340039, 3147779, 5243909, 6291462, 3072, 4195332, 2099202, 1051649, 7340039, 2099202, 4195332, 7340039, 3072, 3147779, 4195332, 2099202, 7340039, 1051649, 4195332, 3072, 6291462, 3072, 7340039, 4195332, 6291462, 2099202, 4195332, 2099202, 3072, 6291462, 1051649, 5243909, 3072, 2099202, 5243909, 1051649, 7340039, 4195332, 1051649, 5243909, 3072, 4195332, 3147779, 3147779, 7340039, 3072, 4195332, 6291462, 2099202, 5243909, 7340039, 2099202,
+  3072, 6291462, 3072, 4195332, 5243909, 7340039, 2099202, 5243909, 4195332, 1051649, 6291462, 1051649, 4195332, 1051649, 2099202, 5243909, 2099202, 5243909, 3147779, 7340039, 6291462, 1051649, 7340039, 3072, 6291462, 2099202, 5243909, 6291462, 3072, 3147779, 5243909, 2099202, 6291462, 3147779, 7340039, 1051649, 6291462, 2099202, 4195332, 3147779, 2099202, 5243909, 1051649, 5243909, 3072, 5243909, 4195332, 3072, 5243909, 2099202, 4195332, 3147779, 2099202, 3072, 1051649, 6291462, 3147779, 4195332, 2099202, 5243909, 3072, 5243909, 1051649, 7340039, 2099202, 6291462, 3147779, 2099202, 6291462, 3147779, 3147779, 4195332, 7340039, 1051649, 6291462, 3147779, 1051649, 6291462, 3072, 2099202, 4195332, 7340039, 3072, 6291462, 3147779, 5243909, 1051649, 4195332, 6291462, 2099202, 7340039, 4195332, 3072, 7340039, 6291462, 2099202, 4195332, 3147779, 1051649, 4195332, 3072, 3147779, 6291462, 1051649, 6291462, 3147779, 3147779, 7340039, 4195332, 5243909, 1051649, 6291462, 4195332, 3072, 5243909, 3147779, 7340039, 2099202, 6291462, 1051649, 5243909, 2099202, 6291462, 1051649, 4195332, 3072, 3147779, 4195332,
+  5243909, 2099202, 7340039, 2099202, 1051649, 4195332, 3147779, 3072, 3147779, 7340039, 3072, 5243909, 3147779, 7340039, 6291462, 3072, 7340039, 4195332, 3072, 2099202, 4195332, 2099202, 4195332, 5243909, 7340039, 3072, 4195332, 2099202, 5243909, 2099202, 7340039, 3072, 3147779, 5243909, 3072, 4195332, 3147779, 5243909, 1051649, 5243909, 1051649, 3147779, 6291462, 2099202, 6291462, 3147779, 3147779, 6291462, 1051649, 7340039, 3072, 6291462, 3147779, 7340039, 5243909, 3072, 6291462, 1051649, 4195332, 1051649, 6291462, 4195332, 2099202, 3147779, 5243909, 3072, 7340039, 5243909, 1051649, 6291462, 3072, 6291462, 3072, 4195332, 2099202, 5243909, 7340039, 4195332, 2099202, 7340039, 1051649, 2099202, 5243909, 4195332, 3072, 2099202, 7340039, 3072, 5243909, 1051649, 1051649, 3147779, 5243909, 1051649, 3147779, 5243909, 1051649, 6291462, 5243909, 2099202, 5243909, 7340039, 1051649, 5243909, 4195332, 1051649, 5243909, 3072, 2099202, 7340039, 2099202, 3147779, 3072, 6291462, 3147779, 6291462, 1051649, 5243909, 3072, 6291462, 2099202, 7340039, 1051649, 3147779, 6291462, 3147779, 7340039, 2099202,
+  1051649, 4195332, 3147779, 6291462, 4195332, 3072, 7340039, 5243909, 2099202, 6291462, 2099202, 5243909, 1051649, 4195332, 1051649, 5243909, 3147779, 1051649, 7340039, 6291462, 3072, 7340039, 3072, 1051649, 3147779, 3147779, 6291462, 1051649, 7340039, 4195332, 4195332, 2099202, 6291462, 1051649, 7340039, 4195332, 3072, 7340039, 2099202, 4195332, 7340039, 5243909, 3072, 4195332, 1051649, 7340039, 3072, 7340039, 4195332, 2099202, 5243909, 1051649, 4195332, 3072, 4195332, 3147779, 1051649, 7340039, 2099202, 7340039, 3147779, 3072, 6291462, 1051649, 6291462, 2099202, 4195332, 3072, 4195332, 2099202, 5243909, 2099202, 5243909, 3147779, 7340039, 3072, 3147779, 1051649, 4195332, 5243909, 3147779, 6291462, 3147779, 1051649, 7340039, 5243909, 3147779, 6291462, 3147779, 6291462, 5243909, 2099202, 6291462, 2099202, 4195332, 3072, 7340039, 3147779, 1051649, 7340039, 3072, 3147779, 4195332, 3072, 3147779, 7340039, 2099202, 6291462, 3147779, 3072, 7340039, 4195332, 3147779, 7340039, 1051649, 2099202, 4195332, 2099202, 7340039, 1051649, 4195332, 3072, 4195332, 6291462, 1051649, 5243909, 3072, 6291462,
+  5243909, 1051649, 6291462, 3072, 3147779, 7340039, 1051649, 4195332, 1051649, 3147779, 6291462, 2099202, 7340039, 3072, 3147779, 6291462, 3072, 6291462, 3147779, 2099202, 3147779, 4195332, 6291462, 5243909, 3072, 7340039, 1051649, 4195332, 3072, 6291462, 1051649, 5243909, 3072, 5243909, 2099202, 3147779, 6291462, 2099202, 6291462, 3072, 2099202, 3147779, 7340039, 4195332, 1051649, 5243909, 2099202, 4195332, 3072, 6291462, 1051649, 7340039, 2099202, 5243909, 2099202, 7340039, 5243909, 3147779, 4195332, 3072, 6291462, 1051649, 4195332, 5243909, 3072, 6291462, 3147779, 7340039, 1051649, 7340039, 2099202, 7340039, 1051649, 2099202, 5243909, 1051649, 6291462, 6291462, 3072, 5243909, 3072, 7340039, 3072, 6291462, 3147779, 6291462, 1051649, 2099202, 4195332, 3072, 4195332, 7340039, 3072, 5243909, 7340039, 3147779, 3072, 5243909, 3147779, 2099202, 6291462, 4195332, 7340039, 2099202, 6291462, 3072, 5243909, 1051649, 6291462, 4195332, 2099202, 5243909, 3072, 5243909, 4195332, 7340039, 3072, 6291462, 3147779, 3147779, 7340039, 5243909, 3147779, 3072, 7340039, 1051649, 4195332, 3147779,
+  3072, 7340039, 2099202, 5243909, 5243909, 2099202, 6291462, 2099202, 7340039, 4195332, 3072, 5243909, 3147779, 4195332, 6291462, 2099202, 5243909, 4195332, 1051649, 5243909, 6291462, 1051649, 2099202, 4195332, 4195332, 2099202, 6291462, 3147779, 6291462, 3147779, 2099202, 7340039, 3147779, 4195332, 1051649, 6291462, 3072, 4195332, 3147779, 5243909, 6291462, 3072, 2099202, 6291462, 3147779, 7340039, 1051649, 5243909, 3147779, 5243909, 4195332, 3147779, 7340039, 3072, 6291462, 2099202, 3072, 6291462, 2099202, 5243909, 4195332, 3147779, 7340039, 2099202, 7340039, 2099202, 5243909, 1051649, 4195332, 5243909, 3072, 3147779, 4195332, 7340039, 3072, 3147779, 4195332, 2099202, 7340039, 3147779, 1051649, 5243909, 2099202, 4195332, 1051649, 3072, 4195332, 7340039, 2099202, 7340039, 3147779, 1051649, 6291462, 3147779, 1051649, 7340039, 5243909, 2099202, 4195332, 7340039, 4195332, 3072, 2099202, 5243909, 1051649, 4195332, 7340039, 3147779, 3072, 6291462, 3147779, 1051649, 7340039, 2099202, 3072, 5243909, 4195332, 1051649, 5243909, 3072, 3147779, 2099202, 5243909, 4195332, 2099202, 6291462, 2099202, 7340039,
+  5243909, 3147779, 1051649, 7340039, 3072, 4195332, 3072, 5243909, 3072, 5243909, 1051649, 7340039, 3072, 5243909, 1051649, 2099202, 7340039, 1051649, 7340039, 3147779, 3072, 5243909, 7340039, 3072, 7340039, 1051649, 5243909, 2099202, 1051649, 5243909, 1051649, 3072, 6291462, 2099202, 7340039, 3147779, 6291462, 1051649, 7340039, 1051649, 1051649, 7340039, 5243909, 3072, 2099202, 4195332, 6291462, 1051649, 6291462, 3072, 2099202, 6291462, 1051649, 4195332, 1051649, 4195332, 7340039, 1051649, 2099202, 7340039, 1051649, 5243909, 3072, 3147779, 4195332, 1051649, 3147779, 6291462, 2099202, 4195332, 3147779, 6291462, 3072, 3147779, 6291462, 5243909, 3072, 4195332, 1051649, 6291462, 4195332, 6291462, 1051649, 3147779, 5243909, 7340039, 3147779, 3072, 5243909, 1051649, 4195332, 6291462, 2099202, 4195332, 3072, 2099202, 4195332, 1051649, 6291462, 3072, 1051649, 5243909, 6291462, 3147779, 7340039, 3147779, 2099202, 6291462, 4195332, 2099202, 7340039, 3147779, 4195332, 6291462, 4195332, 2099202, 3147779, 6291462, 3072, 6291462, 4195332, 7340039, 1051649, 6291462, 3072, 5243909, 2099202, 4195332,
+  3147779, 3072, 6291462, 1051649, 3147779, 5243909, 6291462, 3147779, 7340039, 3147779, 6291462, 2099202, 4195332, 2099202, 7340039, 3147779, 3072, 5243909, 3147779, 6291462, 2099202, 4195332, 1051649, 3147779, 5243909, 4195332, 3072, 6291462, 3147779, 7340039, 4195332, 6291462, 3147779, 5243909, 3072, 5243909, 1051649, 4195332, 2099202, 4195332, 5243909, 3147779, 1051649, 6291462, 6291462, 3072, 2099202, 5243909, 3147779, 7340039, 4195332, 3072, 7340039, 3147779, 2099202, 5243909, 3147779, 5243909, 6291462, 3072, 3147779, 5243909, 6291462, 1051649, 5243909, 3147779, 7340039, 3072, 6291462, 2099202, 7340039, 1051649, 5243909, 2099202, 1051649, 7340039, 2099202, 7340039, 2099202, 5243909, 3072, 3147779, 7340039, 6291462, 3072, 2099202, 5243909, 6291462, 2099202, 4195332, 5243909, 3072, 3147779, 7340039, 5243909, 6291462, 1051649, 7340039, 2099202, 5243909, 7340039, 3147779, 3072, 6291462, 3072, 5243909, 1051649, 5243909, 3072, 6291462, 1051649, 6291462, 1051649, 3072, 6291462, 1051649, 7340039, 4195332, 2099202, 5243909, 1051649, 3072, 5243909, 2099202, 6291462, 3147779, 7340039, 1051649,
+  5243909, 7340039, 3147779, 4195332, 6291462, 2099202, 1051649, 4195332, 2099202, 5243909, 3072, 4195332, 6291462, 6291462, 1051649, 4195332, 6291462, 2099202, 1051649, 3072, 7340039, 3147779, 5243909, 7340039, 2099202, 2099202, 6291462, 1051649, 5243909, 3072, 3147779, 1051649, 6291462, 2099202, 2099202, 7340039, 3147779, 3072, 5243909, 6291462, 3072, 7340039, 4195332, 2099202, 4195332, 3147779, 7340039, 2099202, 6291462, 1051649, 3147779, 5243909, 1051649, 5243909, 6291462, 3072, 7340039, 3072, 4195332, 6291462, 4195332, 2099202, 2099202, 7340039, 3072, 6291462, 1051649, 4195332, 5243909, 3072, 5243909, 1051649, 4195332, 6291462, 4195332, 2099202, 3147779, 5243909, 3072, 3147779, 7340039, 2099202, 4195332, 2099202, 6291462, 4195332, 1051649, 1051649, 7340039, 3072, 6291462, 2099202, 6291462, 1051649, 2099202, 3072, 6291462, 4195332, 3147779, 1051649, 4195332, 2099202, 4195332, 2099202, 4195332, 2099202, 7340039, 1051649, 3147779, 5243909, 4195332, 2099202, 5243909, 5243909, 3147779, 5243909, 2099202, 3072, 7340039, 3147779, 6291462, 4195332, 3147779, 7340039, 1051649, 4195332, 3072, 6291462,
+  2099202, 4195332, 1051649, 7340039, 3072, 6291462, 3147779, 7340039, 3072, 3147779, 7340039, 1051649, 3072, 3147779, 5243909, 3072, 4195332, 6291462, 7340039, 4195332, 5243909, 1051649, 4195332, 3072, 3147779, 7340039, 4195332, 7340039, 2099202, 7340039, 4195332, 5243909, 3072, 7340039, 4195332, 3072, 5243909, 7340039, 3147779, 2099202, 5243909, 3147779, 1051649, 6291462, 3072, 4195332, 3072, 5243909, 3072, 4195332, 6291462, 2099202, 7340039, 2099202, 1051649, 5243909, 3147779, 2099202, 5243909, 1051649, 3072, 7340039, 1051649, 4195332, 4195332, 2099202, 7340039, 3147779, 1051649, 6291462, 3147779, 7340039, 3147779, 3072, 7340039, 1051649, 6291462, 4195332, 1051649, 6291462, 1051649, 5243909, 3072, 5243909, 1051649, 3147779, 7340039, 5243909, 3147779, 4195332, 2099202, 5243909, 1051649, 7340039, 4195332, 5243909, 3147779, 3072, 5243909, 6291462, 3072, 7340039, 1051649, 6291462, 7340039, 1051649, 3147779, 7340039, 4195332, 2099202, 3072, 7340039, 3147779, 2099202, 7340039, 1051649, 5243909, 3147779, 5243909, 1051649, 2099202, 6291462, 2099202, 3072, 4195332, 3147779, 7340039, 2099202,
+  1051649, 5243909, 3147779, 2099202, 5243909, 4195332, 3072, 6291462, 2099202, 5243909, 1051649, 5243909, 3147779, 7340039, 2099202, 7340039, 3147779, 1051649, 3072, 3147779, 6291462, 1051649, 2099202, 6291462, 5243909, 3072, 3147779, 3072, 5243909, 1051649, 6291462, 1051649, 4195332, 3147779, 2099202, 6291462, 1051649, 4195332, 3072, 7340039, 1051649, 2099202, 5243909, 3147779, 7340039, 1051649, 6291462, 3147779, 7340039, 1051649, 2099202, 3072, 4195332, 6291462, 3147779, 4195332, 3072, 7340039, 1051649, 3147779, 6291462, 5243909, 3147779, 6291462, 1051649, 6291462, 3072, 4195332, 7340039, 4195332, 1051649, 4195332, 6291462, 2099202, 5243909, 3147779, 3072, 4195332, 7340039, 3147779, 6291462, 4195332, 7340039, 2099202, 4195332, 6291462, 3072, 2099202, 6291462, 3072, 7340039, 3147779, 5243909, 2099202, 4195332, 1051649, 6291462, 2099202, 7340039, 2099202, 5243909, 4195332, 3147779, 5243909, 3072, 4195332, 6291462, 3072, 1051649, 5243909, 7340039, 3147779, 3072, 6291462, 3072, 4195332, 6291462, 2099202, 7340039, 4195332, 7340039, 3072, 5243909, 7340039, 1051649, 6291462, 3072, 5243909,
+  4195332, 3072, 6291462, 2099202, 7340039, 1051649, 2099202, 6291462, 3147779, 1051649, 7340039, 3147779, 6291462, 1051649, 5243909, 1051649, 6291462, 5243909, 5243909, 2099202, 3072, 4195332, 7340039, 1051649, 6291462, 2099202, 6291462, 4195332, 3147779, 3072, 3147779, 5243909, 2099202, 7340039, 1051649, 3147779, 6291462, 2099202, 6291462, 3147779, 4195332, 7340039, 4195332, 1051649, 5243909, 3147779, 5243909, 1051649, 4195332, 5243909, 7340039, 3147779, 5243909, 3072, 7340039, 2099202, 6291462, 3147779, 6291462, 4195332, 3147779, 3072, 7340039, 2099202, 5243909, 3147779, 2099202, 5243909, 3072, 2099202, 6291462, 3072, 1051649, 6291462, 2099202, 7340039, 5243909, 2099202, 3072, 5243909, 1051649, 3072, 3147779, 6291462, 1051649, 3147779, 5243909, 3147779, 5243909, 3147779, 1051649, 6291462, 3072, 5243909, 3072, 7340039, 3147779, 5243909, 1051649, 3147779, 1051649, 3072, 6291462, 2099202, 3147779, 5243909, 2099202, 4195332, 6291462, 4195332, 1051649, 5243909, 6291462, 1051649, 7340039, 2099202, 3072, 4195332, 3072, 1051649, 5243909, 3147779, 1051649, 4195332, 5243909, 2099202, 3147779, 6291462,
+  7340039, 4195332, 1051649, 4195332, 3072, 5243909, 4195332, 1051649, 7340039, 4195332, 4195332, 3072, 4195332, 2099202, 6291462, 3072, 3147779, 2099202, 4195332, 7340039, 4195332, 6291462, 3072, 3147779, 4195332, 3072, 5243909, 1051649, 2099202, 6291462, 7340039, 3072, 6291462, 3072, 4195332, 6291462, 3072, 5243909, 1051649, 5243909, 3072, 5243909, 2099202, 6291462, 3072, 7340039, 2099202, 7340039, 2099202, 3072, 4195332, 2099202, 6291462, 1051649, 4195332, 1051649, 5243909, 2099202, 3072, 7340039, 2099202, 5243909, 1051649, 4195332, 3072, 7340039, 1051649, 6291462, 3147779, 7340039, 2099202, 5243909, 7340039, 3147779, 3072, 4195332, 1051649, 6291462, 7340039, 3147779, 5243909, 4195332, 5243909, 1051649, 7340039, 2099202, 7340039, 3072, 4195332, 1051649, 7340039, 4195332, 2099202, 6291462, 4195332, 2099202, 3072, 7340039, 2099202, 6291462, 4195332, 7340039, 3147779, 6291462, 3072, 1051649, 7340039, 3147779, 3072, 7340039, 2099202, 1051649, 4195332, 3147779, 4195332, 6291462, 3147779, 6291462, 2099202, 6291462, 3147779, 4195332, 1051649, 7340039, 3072, 4195332, 7340039, 1051649,
+  2099202, 3147779, 5243909, 6291462, 3147779, 7340039, 1051649, 6291462, 3072, 2099202, 1051649, 5243909, 7340039, 4195332, 2099202, 4195332, 7340039, 3072, 6291462, 1051649, 2099202, 3147779, 7340039, 5243909, 2099202, 7340039, 3147779, 7340039, 5243909, 1051649, 4195332, 2099202, 4195332, 5243909, 2099202, 7340039, 3147779, 4195332, 1051649, 6291462, 3147779, 3072, 7340039, 2099202, 4195332, 3072, 5243909, 1051649, 6291462, 3147779, 6291462, 1051649, 4195332, 3147779, 6291462, 7340039, 2099202, 6291462, 5243909, 1051649, 4195332, 7340039, 2099202, 6291462, 3147779, 4195332, 5243909, 2099202, 4195332, 3072, 5243909, 3147779, 3072, 4195332, 3147779, 6291462, 2099202, 4195332, 2099202, 3072, 7340039, 1051649, 2099202, 6291462, 3147779, 3072, 4195332, 1051649, 7340039, 5243909, 2099202, 1051649, 7340039, 1051649, 7340039, 3147779, 6291462, 4195332, 4195332, 3072, 6291462, 3072, 5243909, 1051649, 7340039, 4195332, 1051649, 6291462, 3147779, 2099202, 6291462, 3147779, 5243909, 3072, 5243909, 1051649, 3072, 7340039, 3147779, 6291462, 3072, 7340039, 5243909, 2099202, 6291462, 3147779, 1051649, 5243909,
+  3072, 7340039, 2099202, 3072, 3147779, 2099202, 4195332, 3147779, 6291462, 5243909, 6291462, 3147779, 2099202, 3072, 7340039, 3147779, 1051649, 5243909, 3147779, 5243909, 6291462, 2099202, 1051649, 5243909, 1051649, 4195332, 1051649, 4195332, 2099202, 7340039, 3147779, 7340039, 1051649, 3147779, 5243909, 1051649, 2099202, 7340039, 3147779, 2099202, 7340039, 4195332, 1051649, 5243909, 6291462, 3147779, 4195332, 4195332, 3072, 3147779, 7340039, 2099202, 7340039, 3072, 2099202, 4195332, 1051649, 4195332, 3072, 6291462, 3147779, 3072, 3147779, 5243909, 1051649, 7340039, 3072, 3147779, 6291462, 2099202, 1051649, 5243909, 7340039, 2099202, 5243909, 3072, 6291462, 3072, 5243909, 3147779, 2099202, 7340039, 5243909, 3072, 4195332, 6291462, 3147779, 6291462, 2099202, 3072, 6291462, 4195332, 3147779, 3147779, 3072, 5243909, 1051649, 1051649, 5243909, 2099202, 3147779, 5243909, 2099202, 3147779, 5243909, 2099202, 5243909, 3072, 4195332, 5243909, 3072, 7340039, 1051649, 6291462, 2099202, 7340039, 2099202, 5243909, 1051649, 1051649, 5243909, 2099202, 1051649, 4195332, 3072, 5243909, 3147779, 6291462,
+  4195332, 1051649, 6291462, 4195332, 5243909, 6291462, 3072, 5243909, 2099202, 1051649, 4195332, 3072, 6291462, 5243909, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 4195332, 3072, 7340039, 3147779, 6291462, 2099202, 6291462, 3072, 6291462, 4195332, 3072, 5243909, 6291462, 3072, 5243909, 3147779, 5243909, 3072, 6291462, 5243909, 1051649, 6291462, 3147779, 2099202, 3072, 7340039, 1051649, 3147779, 6291462, 4195332, 3072, 5243909, 3147779, 5243909, 1051649, 7340039, 3147779, 6291462, 3147779, 4195332, 1051649, 7340039, 5243909, 3072, 4195332, 1051649, 5243909, 7340039, 3072, 4195332, 6291462, 3147779, 1051649, 3147779, 7340039, 2099202, 5243909, 7340039, 1051649, 6291462, 4195332, 3072, 4195332, 1051649, 7340039, 2099202, 3072, 3147779, 5243909, 4195332, 3147779, 1051649, 6291462, 5243909, 2099202, 7340039, 3147779, 6291462, 2099202, 7340039, 4195332, 3072, 7340039, 6291462, 3072, 7340039, 2099202, 3147779, 7340039, 1051649, 6291462, 2099202, 4195332, 2099202, 5243909, 1051649, 4195332, 3147779, 7340039, 5243909, 3147779, 3147779, 6291462, 2099202, 6291462, 1051649, 7340039, 2099202,
+  3147779, 7340039, 2099202, 7340039, 3072, 2099202, 4195332, 1051649, 7340039, 3072, 7340039, 5243909, 1051649, 3147779, 6291462, 3072, 4195332, 6291462, 1051649, 7340039, 2099202, 5243909, 4195332, 3147779, 3072, 6291462, 3147779, 5243909, 1051649, 2099202, 5243909, 1051649, 2099202, 6291462, 1051649, 7340039, 2099202, 4195332, 1051649, 4195332, 2099202, 3072, 5243909, 7340039, 3147779, 5243909, 2099202, 6291462, 2099202, 5243909, 2099202, 6291462, 1051649, 4195332, 5243909, 3072, 5243909, 2099202, 3072, 6291462, 2099202, 5243909, 2099202, 7340039, 3147779, 6291462, 1051649, 4195332, 5243909, 1051649, 6291462, 3072, 7340039, 4195332, 1051649, 4195332, 1051649, 3147779, 4195332, 2099202, 3147779, 7340039, 3147779, 6291462, 2099202, 5243909, 7340039, 1051649, 6291462, 3072, 7340039, 6291462, 3072, 1051649, 5243909, 3072, 4195332, 3072, 5243909, 1051649, 6291462, 3147779, 4195332, 1051649, 4195332, 1051649, 6291462, 5243909, 3072, 4195332, 3147779, 5243909, 3072, 4195332, 7340039, 3147779, 5243909, 3072, 4195332, 1051649, 7340039, 5243909, 3072, 7340039, 3147779, 5243909, 3072, 4195332,
+  3072, 5243909, 1051649, 3147779, 4195332, 7340039, 3147779, 5243909, 2099202, 6291462, 3147779, 2099202, 7340039, 2099202, 2099202, 5243909, 3147779, 3072, 5243909, 2099202, 6291462, 1051649, 1051649, 6291462, 5243909, 1051649, 7340039, 3072, 4195332, 7340039, 2099202, 7340039, 3147779, 6291462, 4195332, 3072, 6291462, 2099202, 7340039, 3072, 7340039, 4195332, 2099202, 4195332, 1051649, 3147779, 6291462, 3072, 4195332, 7340039, 3072, 3147779, 7340039, 3072, 3147779, 6291462, 1051649, 7340039, 5243909, 2099202, 7340039, 3072, 4195332, 2099202, 6291462, 3072, 7340039, 2099202, 2099202, 7340039, 2099202, 3147779, 5243909, 1051649, 6291462, 5243909, 3147779, 6291462, 3072, 6291462, 5243909, 3072, 4195332, 1051649, 4195332, 3072, 4195332, 7340039, 2099202, 5243909, 2099202, 4195332, 3147779, 7340039, 3147779, 6291462, 2099202, 7340039, 4195332, 3147779, 1051649, 3072, 6291462, 2099202, 7340039, 5243909, 3147779, 1051649, 3147779, 7340039, 1051649, 7340039, 6291462, 2099202, 3072, 6291462, 1051649, 6291462, 2099202, 6291462, 3072, 2099202, 4195332, 1051649, 4195332, 7340039, 2099202, 6291462,
+  6291462, 3147779, 5243909, 6291462, 1051649, 6291462, 1051649, 7340039, 4195332, 3072, 4195332, 5243909, 3072, 4195332, 6291462, 1051649, 7340039, 3147779, 7340039, 3072, 3147779, 7340039, 6291462, 1051649, 3147779, 4195332, 2099202, 5243909, 3147779, 4195332, 1051649, 4195332, 3072, 2099202, 3147779, 7340039, 1051649, 4195332, 3147779, 5243909, 2099202, 6291462, 3072, 7340039, 1051649, 7340039, 3072, 5243909, 1051649, 4195332, 1051649, 6291462, 5243909, 2099202, 7340039, 4195332, 3147779, 4195332, 1051649, 6291462, 3147779, 1051649, 6291462, 1051649, 3147779, 5243909, 2099202, 4195332, 6291462, 1051649, 4195332, 7340039, 3072, 4195332, 2099202, 3072, 7340039, 1051649, 5243909, 2099202, 1051649, 5243909, 6291462, 2099202, 7340039, 3147779, 5243909, 3072, 4195332, 3147779, 1051649, 7340039, 5243909, 3072, 4195332, 1051649, 4195332, 2099202, 3072, 6291462, 5243909, 7340039, 2099202, 4195332, 2099202, 3072, 3147779, 7340039, 5243909, 2099202, 5243909, 3147779, 1051649, 7340039, 4195332, 3147779, 2099202, 4195332, 3147779, 4195332, 2099202, 6291462, 5243909, 2099202, 6291462, 3072, 4195332, 1051649,
+  1051649, 4195332, 3072, 2099202, 5243909, 3072, 3147779, 3072, 4195332, 7340039, 3147779, 1051649, 7340039, 3147779, 5243909, 2099202, 5243909, 1051649, 4195332, 5243909, 4195332, 3072, 2099202, 7340039, 5243909, 3072, 6291462, 1051649, 7340039, 3072, 6291462, 3147779, 5243909, 3147779, 5243909, 3072, 5243909, 6291462, 3072, 6291462, 1051649, 3147779, 5243909, 3147779, 6291462, 2099202, 5243909, 4195332, 7340039, 2099202, 5243909, 3147779, 1051649, 5243909, 3072, 2099202, 6291462, 3072, 7340039, 3072, 4195332, 5243909, 3147779, 5243909, 1051649, 6291462, 3072, 6291462, 3072, 5243909, 3072, 3147779, 6291462, 2099202, 7340039, 4195332, 2099202, 7340039, 4195332, 2099202, 7340039, 3147779, 1051649, 6291462, 1051649, 5243909, 1051649, 6291462, 2099202, 6291462, 4195332, 1051649, 2099202, 6291462, 2099202, 7340039, 5243909, 3147779, 5243909, 2099202, 4195332, 1051649, 5243909, 3072, 6291462, 4195332, 6291462, 3072, 2099202, 6291462, 3072, 4195332, 4195332, 1051649, 5243909, 3072, 7340039, 1051649, 7340039, 3072, 7340039, 3147779, 3072, 7340039, 1051649, 5243909, 2099202, 7340039,
+  1051649, 5243909, 7340039, 2099202, 6291462, 3147779, 6291462, 5243909, 2099202, 5243909, 3072, 6291462, 3147779, 3072, 1051649, 6291462, 3072, 6291462, 3147779, 1051649, 7340039, 2099202, 4195332, 3072, 2099202, 7340039, 4195332, 3147779, 1051649, 6291462, 2099202, 7340039, 3072, 7340039, 1051649, 6291462, 3147779, 2099202, 4195332, 3147779, 6291462, 1051649, 1051649, 4195332, 1051649, 3147779, 7340039, 2099202, 3072, 6291462, 1051649, 7340039, 2099202, 7340039, 3147779, 5243909, 2099202, 5243909, 3147779, 2099202, 7340039, 3072, 4195332, 7340039, 3072, 4195332, 3147779, 4195332, 2099202, 7340039, 5243909, 1051649, 6291462, 3147779, 1051649, 5243909, 3147779, 3072, 3147779, 6291462, 3072, 6291462, 5243909, 3147779, 4195332, 3072, 7340039, 3147779, 6291462, 3072, 3147779, 6291462, 4195332, 3072, 5243909, 1051649, 3072, 7340039, 1051649, 7340039, 3072, 6291462, 3147779, 4195332, 7340039, 1051649, 2099202, 6291462, 4195332, 4195332, 2099202, 6291462, 3072, 7340039, 3147779, 6291462, 4195332, 5243909, 2099202, 4195332, 5243909, 1051649, 3147779, 4195332, 6291462, 3147779, 3147779, 5243909,
+  7340039, 3147779, 3072, 4195332, 1051649, 4195332, 2099202, 1051649, 6291462, 1051649, 4195332, 2099202, 4195332, 7340039, 5243909, 4195332, 3147779, 2099202, 7340039, 3147779, 2099202, 5243909, 6291462, 3147779, 5243909, 1051649, 3072, 6291462, 5243909, 2099202, 4195332, 1051649, 5243909, 2099202, 4195332, 4195332, 1051649, 7340039, 3072, 7340039, 4195332, 5243909, 7340039, 3072, 6291462, 5243909, 1051649, 3147779, 6291462, 2099202, 4195332, 3072, 4195332, 1051649, 4195332, 3072, 7340039, 1051649, 4195332, 6291462, 1051649, 5243909, 1051649, 2099202, 4195332, 7340039, 2099202, 7340039, 3147779, 1051649, 4195332, 4195332, 3072, 5243909, 1051649, 6291462, 5243909, 6291462, 5243909, 1051649, 4195332, 2099202, 3072, 2099202, 7340039, 4195332, 2099202, 3072, 5243909, 2099202, 7340039, 1051649, 3147779, 7340039, 3147779, 6291462, 3147779, 6291462, 4195332, 3147779, 6291462, 2099202, 7340039, 1051649, 2099202, 5243909, 3147779, 1051649, 7340039, 1051649, 5243909, 2099202, 4195332, 5243909, 3072, 2099202, 3072, 2099202, 6291462, 1051649, 3072, 6291462, 7340039, 3072, 2099202, 6291462, 3072, 3147779,
+  3072, 5243909, 2099202, 6291462, 7340039, 3072, 7340039, 5243909, 3147779, 6291462, 2099202, 7340039, 5243909, 1051649, 2099202, 3072, 7340039, 4195332, 3072, 6291462, 3072, 5243909, 1051649, 7340039, 3147779, 6291462, 5243909, 2099202, 3072, 5243909, 3072, 7340039, 4195332, 6291462, 3072, 7340039, 2099202, 4195332, 5243909, 2099202, 3072, 2099202, 6291462, 4195332, 2099202, 3072, 6291462, 4195332, 1051649, 5243909, 3147779, 6291462, 3147779, 7340039, 2099202, 6291462, 3147779, 5243909, 3072, 4195332, 3147779, 7340039, 3147779, 6291462, 3147779, 1051649, 6291462, 3072, 5243909, 3147779, 6291462, 2099202, 7340039, 3147779, 7340039, 3072, 3147779, 2099202, 1051649, 7340039, 3147779, 7340039, 4195332, 5243909, 1051649, 3147779, 6291462, 3147779, 4195332, 5243909, 2099202, 5243909, 3072, 6291462, 1051649, 5243909, 1051649, 2099202, 3072, 5243909, 1051649, 5243909, 3072, 3147779, 6291462, 3072, 7340039, 5243909, 3072, 6291462, 3147779, 7340039, 1051649, 6291462, 3147779, 7340039, 5243909, 6291462, 3147779, 5243909, 7340039, 2099202, 4195332, 3147779, 5243909, 1051649, 7340039, 4195332,
+  2099202, 6291462, 3147779, 1051649, 3147779, 2099202, 5243909, 2099202, 3072, 7340039, 1051649, 3147779, 3072, 6291462, 4195332, 6291462, 3147779, 1051649, 5243909, 2099202, 7340039, 1051649, 4195332, 3072, 4195332, 1051649, 3147779, 7340039, 4195332, 3147779, 6291462, 2099202, 3147779, 1051649, 3147779, 5243909, 3072, 6291462, 1051649, 7340039, 3147779, 5243909, 3072, 3147779, 7340039, 5243909, 2099202, 3147779, 7340039, 3072, 5243909, 1051649, 6291462, 1051649, 5243909, 3072, 2099202, 4195332, 7340039, 1051649, 6291462, 3072, 5243909, 1051649, 5243909, 4195332, 2099202, 4195332, 1051649, 7340039, 3072, 2099202, 5243909, 3072, 2099202, 4195332, 1051649, 7340039, 6291462, 1051649, 4195332, 2099202, 1051649, 6291462, 3072, 7340039, 1051649, 7340039, 1051649, 3072, 7340039, 3147779, 4195332, 2099202, 7340039, 3147779, 7340039, 4195332, 2099202, 7340039, 3147779, 4195332, 6291462, 1051649, 5243909, 3147779, 2099202, 4195332, 3147779, 4195332, 3072, 5243909, 1051649, 3147779, 2099202, 4195332, 1051649, 3147779, 3072, 2099202, 3147779, 5243909, 1051649, 7340039, 2099202, 5243909, 1051649, 4195332,
+  6291462, 3072, 7340039, 4195332, 6291462, 4195332, 3072, 7340039, 4195332, 4195332, 1051649, 6291462, 3147779, 7340039, 2099202, 1051649, 6291462, 5243909, 3147779, 4195332, 3147779, 6291462, 3147779, 6291462, 2099202, 7340039, 4195332, 3072, 7340039, 1051649, 5243909, 3072, 6291462, 7340039, 4195332, 2099202, 7340039, 3147779, 5243909, 6291462, 1051649, 2099202, 6291462, 4195332, 1051649, 3147779, 7340039, 3072, 4195332, 5243909, 2099202, 6291462, 3072, 3147779, 4195332, 7340039, 6291462, 1051649, 4195332, 2099202, 5243909, 2099202, 6291462, 3072, 7340039, 3072, 6291462, 2099202, 5243909, 4195332, 6291462, 3147779, 6291462, 4195332, 6291462, 5243909, 3072, 3147779, 4195332, 5243909, 3072, 6291462, 4195332, 5243909, 3147779, 4195332, 5243909, 2099202, 4195332, 6291462, 2099202, 5243909, 1051649, 6291462, 2099202, 3072, 5243909, 2099202, 6291462, 3147779, 1051649, 5243909, 2099202, 7340039, 1051649, 6291462, 4195332, 1051649, 6291462, 1051649, 7340039, 2099202, 7340039, 5243909, 6291462, 3072, 6291462, 7340039, 4195332, 7340039, 3072, 4195332, 1051649, 6291462, 3072, 4195332, 7340039, 2099202,
+  4195332, 5243909, 1051649, 5243909, 3072, 3147779, 5243909, 1051649, 6291462, 2099202, 5243909, 2099202, 5243909, 3072, 4195332, 5243909, 2099202, 3072, 7340039, 1051649, 6291462, 3072, 5243909, 1051649, 2099202, 5243909, 1051649, 5243909, 2099202, 4195332, 3147779, 7340039, 2099202, 3072, 3147779, 5243909, 1051649, 4195332, 2099202, 3072, 4195332, 7340039, 4195332, 1051649, 5243909, 3072, 4195332, 6291462, 2099202, 7340039, 1051649, 4195332, 5243909, 7340039, 2099202, 3072, 5243909, 3147779, 6291462, 1051649, 7340039, 4195332, 3147779, 3147779, 2099202, 5243909, 3147779, 7340039, 3072, 3147779, 1051649, 5243909, 3072, 2099202, 1051649, 6291462, 2099202, 7340039, 3072, 3147779, 7340039, 3072, 3147779, 2099202, 6291462, 3072, 1051649, 7340039, 3072, 3147779, 1051649, 7340039, 3072, 5243909, 3147779, 5243909, 3072, 7340039, 3072, 4195332, 7340039, 3072, 4195332, 3147779, 4195332, 3072, 3147779, 7340039, 3072, 5243909, 3147779, 3072, 4195332, 3072, 3147779, 7340039, 2099202, 1051649, 4195332, 1051649, 6291462, 3147779, 6291462, 3147779, 2099202, 6291462, 1051649, 3147779,
+  3072, 3147779, 2099202, 7340039, 2099202, 6291462, 3072, 4195332, 1051649, 7340039, 3072, 3147779, 7340039, 3147779, 7340039, 3072, 3147779, 5243909, 2099202, 4195332, 2099202, 3147779, 7340039, 4195332, 6291462, 3072, 7340039, 3147779, 3072, 6291462, 1051649, 1051649, 5243909, 4195332, 1051649, 6291462, 6291462, 3072, 7340039, 3147779, 5243909, 1051649, 3072, 7340039, 3147779, 6291462, 3147779, 1051649, 5243909, 3147779, 6291462, 2099202, 1051649, 3147779, 4195332, 6291462, 2099202, 1051649, 6291462, 3072, 3147779, 3072, 6291462, 7340039, 1051649, 6291462, 1051649, 2099202, 6291462, 1051649, 7340039, 4195332, 5243909, 7340039, 4195332, 3072, 5243909, 2099202, 6291462, 4195332, 2099202, 5243909, 7340039, 3072, 4195332, 7340039, 5243909, 3147779, 4195332, 6291462, 2099202, 4195332, 4195332, 1051649, 7340039, 2099202, 4195332, 5243909, 3147779, 1051649, 6291462, 2099202, 5243909, 3072, 6291462, 2099202, 5243909, 2099202, 4195332, 2099202, 6291462, 2099202, 6291462, 3147779, 5243909, 1051649, 4195332, 5243909, 6291462, 5243909, 3072, 4195332, 1051649, 5243909, 7340039, 3072, 5243909, 6291462,
+  7340039, 5243909, 4195332, 1051649, 5243909, 3147779, 7340039, 3147779, 5243909, 3147779, 4195332, 6291462, 1051649, 4195332, 1051649, 5243909, 6291462, 1051649, 7340039, 3072, 6291462, 5243909, 3072, 2099202, 3147779, 4195332, 2099202, 6291462, 3147779, 4195332, 7340039, 5243909, 2099202, 7340039, 4195332, 2099202, 2099202, 4195332, 1051649, 6291462, 3147779, 5243909, 2099202, 5243909, 2099202, 1051649, 5243909, 7340039, 3072, 4195332, 3072, 7340039, 3147779, 6291462, 3072, 3147779, 7340039, 4195332, 5243909, 2099202, 7340039, 4195332, 1051649, 3147779, 4195332, 2099202, 4195332, 5243909, 3147779, 5243909, 2099202, 3072, 3147779, 1051649, 3147779, 7340039, 3147779, 5243909, 1051649, 5243909, 1051649, 6291462, 2099202, 5243909, 2099202, 3147779, 1051649, 5243909, 1051649, 6291462, 3072, 7340039, 3147779, 6291462, 3147779, 3072, 6291462, 2099202, 6291462, 1051649, 4195332, 5243909, 2099202, 7340039, 1051649, 7340039, 3147779, 3072, 7340039, 5243909, 1051649, 5243909, 1051649, 7340039, 2099202, 6291462, 3072, 3147779, 1051649, 2099202, 7340039, 5243909, 3072, 3147779, 1051649, 5243909, 3147779, 2099202,
+  3072, 6291462, 1051649, 6291462, 4195332, 2099202, 1051649, 6291462, 3072, 6291462, 2099202, 3072, 5243909, 6291462, 2099202, 7340039, 3072, 3147779, 4195332, 5243909, 1051649, 3147779, 5243909, 7340039, 1051649, 6291462, 4195332, 3072, 7340039, 1051649, 3147779, 3072, 3147779, 1051649, 6291462, 3072, 5243909, 3147779, 5243909, 2099202, 3072, 7340039, 1051649, 6291462, 4195332, 6291462, 2099202, 1051649, 4195332, 7340039, 2099202, 5243909, 3072, 5243909, 2099202, 5243909, 3072, 6291462, 1051649, 3147779, 5243909, 2099202, 6291462, 3072, 7340039, 3147779, 7340039, 3072, 7340039, 3072, 4195332, 7340039, 6291462, 6291462, 1051649, 4195332, 3072, 2099202, 3147779, 7340039, 3072, 4195332, 1051649, 4195332, 3072, 6291462, 6291462, 3072, 7340039, 1051649, 3147779, 5243909, 2099202, 1051649, 4195332, 7340039, 1051649, 7340039, 3072, 3147779, 7340039, 3072, 6291462, 3147779, 4195332, 1051649, 5243909, 6291462, 3147779, 1051649, 7340039, 4195332, 4195332, 3072, 4195332, 3147779, 7340039, 4195332, 7340039, 3072, 3147779, 2099202, 6291462, 4195332, 7340039, 3147779, 1051649, 5243909,
+  2099202, 3147779, 7340039, 2099202, 3072, 6291462, 4195332, 3147779, 5243909, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 3147779, 4195332, 7340039, 1051649, 2099202, 6291462, 2099202, 3072, 5243909, 3147779, 1051649, 6291462, 5243909, 2099202, 5243909, 6291462, 3147779, 6291462, 5243909, 3147779, 7340039, 3072, 7340039, 1051649, 6291462, 3147779, 4195332, 3147779, 7340039, 3072, 3147779, 5243909, 3147779, 6291462, 2099202, 5243909, 1051649, 4195332, 1051649, 7340039, 3147779, 1051649, 2099202, 7340039, 4195332, 3072, 7340039, 1051649, 4195332, 5243909, 3072, 5243909, 1051649, 3147779, 5243909, 2099202, 1051649, 3072, 4195332, 2099202, 5243909, 7340039, 6291462, 4195332, 3147779, 6291462, 2099202, 7340039, 3147779, 7340039, 1051649, 3147779, 4195332, 2099202, 6291462, 4195332, 3072, 5243909, 6291462, 3072, 4195332, 2099202, 4195332, 3147779, 5243909, 2099202, 4195332, 3147779, 1051649, 6291462, 5243909, 2099202, 4195332, 3072, 6291462, 3147779, 3072, 7340039, 2099202, 6291462, 1051649, 2099202, 3072, 5243909, 3147779, 7340039, 5243909, 1051649, 6291462, 2099202, 3072, 4195332, 7340039,
+  6291462, 3072, 4195332, 3147779, 5243909, 1051649, 7340039, 3072, 7340039, 5243909, 3147779, 3072, 5243909, 1051649, 6291462, 5243909, 1051649, 3147779, 6291462, 5243909, 4195332, 7340039, 4195332, 2099202, 4195332, 7340039, 3072, 2099202, 4195332, 3072, 4195332, 1051649, 5243909, 3072, 2099202, 5243909, 2099202, 3147779, 4195332, 2099202, 7340039, 3072, 5243909, 2099202, 4195332, 7340039, 3072, 4195332, 1051649, 3072, 6291462, 3147779, 7340039, 4195332, 1051649, 6291462, 5243909, 4195332, 2099202, 6291462, 1051649, 4195332, 5243909, 2099202, 6291462, 1051649, 4195332, 6291462, 2099202, 4195332, 6291462, 7340039, 4195332, 3147779, 7340039, 3072, 3147779, 1051649, 3072, 6291462, 1051649, 5243909, 3072, 6291462, 2099202, 5243909, 6291462, 2099202, 5243909, 3072, 3147779, 7340039, 2099202, 4195332, 6291462, 2099202, 5243909, 1051649, 6291462, 1051649, 7340039, 5243909, 3072, 7340039, 3147779, 3072, 7340039, 1051649, 5243909, 4195332, 2099202, 5243909, 1051649, 5243909, 2099202, 5243909, 4195332, 6291462, 4195332, 1051649, 2099202, 4195332, 2099202, 3072, 5243909, 6291462, 4195332, 1051649,
+  4195332, 1051649, 5243909, 1051649, 7340039, 4195332, 2099202, 3147779, 2099202, 4195332, 2099202, 7340039, 3147779, 5243909, 2099202, 7340039, 2099202, 6291462, 3072, 2099202, 3072, 3147779, 1051649, 7340039, 3072, 5243909, 3147779, 7340039, 1051649, 6291462, 2099202, 7340039, 1051649, 7340039, 4195332, 7340039, 1051649, 6291462, 3072, 5243909, 4195332, 1051649, 6291462, 3072, 3147779, 1051649, 6291462, 2099202, 7340039, 5243909, 3147779, 3072, 3147779, 6291462, 2099202, 4195332, 3072, 7340039, 3072, 3147779, 3147779, 1051649, 7340039, 3072, 3147779, 7340039, 3147779, 2099202, 6291462, 3072, 3147779, 1051649, 2099202, 5243909, 1051649, 5243909, 2099202, 4195332, 5243909, 2099202, 7340039, 3147779, 5243909, 1051649, 4195332, 3072, 3147779, 5243909, 3072, 7340039, 4195332, 1051649, 5243909, 1051649, 3147779, 7340039, 3072, 6291462, 2099202, 4195332, 3072, 3147779, 5243909, 4195332, 2099202, 5243909, 3147779, 6291462, 2099202, 1051649, 6291462, 3147779, 7340039, 3072, 6291462, 3072, 7340039, 2099202, 1051649, 5243909, 6291462, 3072, 7340039, 4195332, 3147779, 1051649, 7340039, 3147779,
+  7340039, 6291462, 3147779, 7340039, 2099202, 3072, 5243909, 6291462, 3072, 6291462, 1051649, 6291462, 3072, 2099202, 4195332, 3072, 4195332, 1051649, 7340039, 4195332, 7340039, 6291462, 5243909, 1051649, 6291462, 2099202, 6291462, 1051649, 5243909, 4195332, 3072, 3147779, 6291462, 2099202, 4195332, 3072, 4195332, 4195332, 2099202, 6291462, 1051649, 4195332, 3147779, 6291462, 7340039, 4195332, 2099202, 6291462, 3072, 6291462, 1051649, 7340039, 4195332, 3072, 5243909, 7340039, 1051649, 3147779, 5243909, 6291462, 5243909, 4195332, 2099202, 6291462, 1051649, 5243909, 3072, 7340039, 1051649, 5243909, 6291462, 5243909, 6291462, 1051649, 7340039, 3147779, 6291462, 3072, 7340039, 2099202, 4195332, 1051649, 6291462, 3147779, 7340039, 5243909, 1051649, 7340039, 2099202, 5243909, 2099202, 6291462, 3072, 7340039, 4195332, 3147779, 5243909, 3147779, 1051649, 7340039, 6291462, 2099202, 7340039, 1051649, 7340039, 4195332, 1051649, 3072, 4195332, 7340039, 5243909, 3072, 3147779, 2099202, 4195332, 5243909, 1051649, 3147779, 7340039, 3072, 3147779, 6291462, 4195332, 3072, 7340039, 2099202, 5243909, 3072,
+  2099202, 3072, 5243909, 1051649, 4195332, 6291462, 3147779, 1051649, 7340039, 3147779, 5243909, 3147779, 1051649, 7340039, 6291462, 3147779, 6291462, 5243909, 1051649, 4195332, 2099202, 3072, 3147779, 7340039, 4195332, 3072, 3147779, 5243909, 2099202, 7340039, 3147779, 6291462, 1051649, 5243909, 2099202, 6291462, 1051649, 7340039, 3072, 3147779, 7340039, 5243909, 3072, 5243909, 2099202, 3072, 5243909, 3147779, 4195332, 4195332, 2099202, 5243909, 2099202, 6291462, 1051649, 2099202, 4195332, 6291462, 1051649, 2099202, 3072, 7340039, 2099202, 3147779, 6291462, 2099202, 5243909, 4195332, 4195332, 1051649, 2099202, 3072, 7340039, 4195332, 3072, 6291462, 3147779, 4195332, 1051649, 5243909, 3072, 7340039, 1051649, 4195332, 3072, 3147779, 2099202, 6291462, 4195332, 1051649, 7340039, 3147779, 4195332, 2099202, 3072, 6291462, 1051649, 6291462, 3072, 4195332, 1051649, 5243909, 2099202, 4195332, 3072, 2099202, 6291462, 3147779, 6291462, 3072, 2099202, 7340039, 4195332, 6291462, 2099202, 7340039, 3147779, 5243909, 2099202, 6291462, 5243909, 1051649, 2099202, 5243909, 4195332, 2099202, 6291462, 3147779,
+  7340039, 2099202, 4195332, 6291462, 2099202, 3072, 6291462, 4195332, 2099202, 5243909, 3072, 7340039, 4195332, 3147779, 1051649, 4195332, 3072, 5243909, 1051649, 3147779, 6291462, 2099202, 5243909, 1051649, 3147779, 4195332, 7340039, 3072, 4195332, 1051649, 5243909, 1051649, 4195332, 6291462, 3072, 1051649, 5243909, 3147779, 6291462, 5243909, 2099202, 1051649, 7340039, 1051649, 6291462, 3147779, 7340039, 1051649, 7340039, 1051649, 6291462, 3072, 7340039, 4195332, 3147779, 7340039, 3072, 3147779, 5243909, 7340039, 4195332, 1051649, 5243909, 3072, 4195332, 7340039, 3072, 2099202, 7340039, 3147779, 6291462, 3147779, 2099202, 3147779, 5243909, 2099202, 1051649, 7340039, 3147779, 4195332, 2099202, 5243909, 3147779, 7340039, 2099202, 6291462, 4195332, 3072, 3147779, 5243909, 3072, 5243909, 1051649, 6291462, 5243909, 2099202, 7340039, 2099202, 4195332, 7340039, 3147779, 6291462, 3072, 6291462, 3147779, 7340039, 1051649, 5243909, 2099202, 4195332, 5243909, 3147779, 1051649, 3072, 5243909, 1051649, 6291462, 3072, 4195332, 3147779, 3072, 7340039, 6291462, 3147779, 1051649, 6291462, 3072, 5243909,
+  1051649, 3147779, 7340039, 3072, 5243909, 7340039, 2099202, 4195332, 1051649, 7340039, 4195332, 1051649, 6291462, 3072, 6291462, 2099202, 7340039, 3147779, 7340039, 3072, 5243909, 4195332, 1051649, 7340039, 5243909, 1051649, 6291462, 3147779, 6291462, 2099202, 4195332, 3147779, 7340039, 2099202, 7340039, 3147779, 6291462, 3072, 3147779, 2099202, 4195332, 6291462, 3147779, 4195332, 3072, 5243909, 1051649, 5243909, 3147779, 7340039, 2099202, 4195332, 3147779, 3072, 6291462, 1051649, 3147779, 5243909, 3072, 2099202, 3147779, 6291462, 2099202, 7340039, 3147779, 1051649, 4195332, 6291462, 3072, 5243909, 1051649, 7340039, 5243909, 3072, 6291462, 4195332, 5243909, 3072, 6291462, 1051649, 7340039, 2099202, 3072, 6291462, 1051649, 5243909, 2099202, 7340039, 4195332, 3147779, 6291462, 2099202, 7340039, 3072, 3147779, 4195332, 1051649, 5243909, 3072, 5243909, 3072, 3147779, 5243909, 1051649, 5243909, 4195332, 2099202, 6291462, 3072, 7340039, 1051649, 3147779, 7340039, 4195332, 3147779, 6291462, 2099202, 4195332, 1051649, 6291462, 2099202, 4195332, 1051649, 3072, 5243909, 3147779, 1051649, 5243909,
+  4195332, 1051649, 4195332, 2099202, 3147779, 1051649, 7340039, 3072, 3147779, 6291462, 2099202, 5243909, 2099202, 5243909, 1051649, 5243909, 3072, 6291462, 2099202, 4195332, 2099202, 6291462, 3147779, 4195332, 3072, 6291462, 2099202, 2099202, 3072, 7340039, 3072, 6291462, 3072, 3147779, 4195332, 5243909, 1051649, 4195332, 7340039, 3072, 7340039, 3072, 2099202, 7340039, 2099202, 4195332, 6291462, 2099202, 3072, 5243909, 1051649, 1051649, 6291462, 2099202, 5243909, 4195332, 6291462, 2099202, 7340039, 4195332, 6291462, 3072, 4195332, 5243909, 3072, 6291462, 5243909, 3147779, 2099202, 6291462, 4195332, 2099202, 4195332, 3147779, 1051649, 7340039, 2099202, 4195332, 3147779, 5243909, 3072, 5243909, 6291462, 2099202, 4195332, 3072, 6291462, 1051649, 1051649, 6291462, 1051649, 4195332, 3147779, 5243909, 1051649, 7340039, 3072, 6291462, 3147779, 2099202, 6291462, 6291462, 1051649, 3147779, 7340039, 3072, 6291462, 4195332, 2099202, 5243909, 1051649, 5243909, 3072, 6291462, 2099202, 3072, 6291462, 1051649, 7340039, 5243909, 3072, 5243909, 7340039, 4195332, 7340039, 2099202, 6291462, 3147779,
+  3072, 6291462, 2099202, 5243909, 6291462, 4195332, 3147779, 5243909, 6291462, 3072, 4195332, 1051649, 7340039, 3147779, 4195332, 7340039, 2099202, 3147779, 3072, 7340039, 3147779, 3072, 6291462, 2099202, 7340039, 3147779, 4195332, 7340039, 5243909, 3147779, 4195332, 1051649, 5243909, 7340039, 2099202, 3072, 5243909, 2099202, 6291462, 2099202, 3147779, 5243909, 6291462, 1051649, 5243909, 3072, 7340039, 2099202, 4195332, 7340039, 3147779, 5243909, 3147779, 7340039, 3072, 2099202, 1051649, 5243909, 3072, 4195332, 1051649, 7340039, 3147779, 6291462, 1051649, 3147779, 1051649, 7340039, 4195332, 2099202, 3072, 7340039, 3072, 5243909, 6291462, 3072, 3147779, 1051649, 7340039, 2099202, 6291462, 3147779, 1051649, 5243909, 7340039, 3147779, 4195332, 7340039, 5243909, 2099202, 7340039, 3072, 7340039, 4195332, 6291462, 3147779, 2099202, 4195332, 2099202, 7340039, 3147779, 3072, 4195332, 5243909, 1051649, 4195332, 3147779, 1051649, 7340039, 3147779, 6291462, 2099202, 4195332, 3147779, 7340039, 4195332, 3147779, 4195332, 3147779, 3147779, 7340039, 2099202, 1051649, 3147779, 3072, 4195332, 1051649, 7340039,
+  5243909, 4195332, 7340039, 3072, 2099202, 1051649, 5243909, 3072, 3147779, 7340039, 5243909, 1051649, 4195332, 3072, 4195332, 1051649, 3147779, 6291462, 5243909, 1051649, 4195332, 7340039, 3072, 5243909, 1051649, 6291462, 3072, 5243909, 1051649, 2099202, 6291462, 2099202, 5243909, 1051649, 4195332, 6291462, 3147779, 7340039, 1051649, 5243909, 1051649, 5243909, 1051649, 4195332, 4195332, 3147779, 1051649, 5243909, 3072, 4195332, 3072, 6291462, 1051649, 2099202, 5243909, 6291462, 7340039, 3147779, 7340039, 2099202, 3147779, 5243909, 1051649, 2099202, 5243909, 7340039, 2099202, 4195332, 3072, 6291462, 5243909, 2099202, 6291462, 1051649, 2099202, 5243909, 6291462, 5243909, 3072, 4195332, 1051649, 4195332, 7340039, 3072, 3147779, 1051649, 5243909, 3072, 3147779, 1051649, 5243909, 3147779, 2099202, 3072, 2099202, 6291462, 5243909, 7340039, 3072, 4195332, 1051649, 7340039, 1051649, 6291462, 3147779, 7340039, 2099202, 5243909, 3072, 4195332, 3072, 7340039, 5243909, 1051649, 5243909, 2099202, 7340039, 3072, 6291462, 1051649, 3072, 6291462, 4195332, 6291462, 2099202, 7340039, 5243909, 2099202,
+  1051649, 3072, 3147779, 4195332, 7340039, 6291462, 2099202, 7340039, 2099202, 1051649, 2099202, 6291462, 3147779, 7340039, 2099202, 6291462, 5243909, 1051649, 4195332, 6291462, 2099202, 3147779, 5243909, 2099202, 4195332, 1051649, 7340039, 2099202, 4195332, 5243909, 3072, 7340039, 2099202, 3147779, 7340039, 1051649, 5243909, 3147779, 1051649, 7340039, 4195332, 2099202, 3147779, 7340039, 2099202, 6291462, 3147779, 4195332, 6291462, 2099202, 5243909, 2099202, 4195332, 7340039, 3147779, 3072, 1051649, 4195332, 1051649, 6291462, 3072, 4195332, 7340039, 4195332, 3072, 6291462, 3072, 7340039, 3147779, 4195332, 1051649, 3147779, 4195332, 3147779, 7340039, 1051649, 3147779, 2099202, 7340039, 4195332, 6291462, 3072, 2099202, 4195332, 6291462, 2099202, 7340039, 2099202, 6291462, 4195332, 3072, 5243909, 6291462, 2099202, 5243909, 3072, 3147779, 1051649, 5243909, 3147779, 5243909, 2099202, 6291462, 2099202, 2099202, 3072, 6291462, 3147779, 7340039, 1051649, 5243909, 3147779, 3072, 7340039, 1051649, 6291462, 3072, 5243909, 2099202, 5243909, 4195332, 2099202, 1051649, 3147779, 5243909, 3147779, 3072, 6291462,
+  3147779, 7340039, 5243909, 3072, 3147779, 1051649, 4195332, 3072, 5243909, 6291462, 4195332, 3072, 7340039, 1051649, 5243909, 3147779, 3072, 7340039, 2099202, 3072, 7340039, 1051649, 7340039, 3072, 6291462, 4195332, 3147779, 6291462, 3072, 7340039, 3147779, 5243909, 3072, 6291462, 2099202, 4195332, 3072, 6291462, 3147779, 3072, 6291462, 3072, 6291462, 3147779, 3072, 6291462, 3072, 7340039, 1051649, 3147779, 6291462, 3072, 6291462, 1051649, 5243909, 4195332, 6291462, 3147779, 5243909, 2099202, 6291462, 3147779, 3072, 6291462, 3147779, 4195332, 2099202, 5243909, 1051649, 7340039, 6291462, 1051649, 7340039, 3072, 4195332, 3147779, 7340039, 3072, 4195332, 1051649, 2099202, 7340039, 3147779, 6291462, 3072, 2099202, 4195332, 3072, 7340039, 1051649, 6291462, 3147779, 1051649, 6291462, 4195332, 7340039, 3147779, 6291462, 1051649, 7340039, 1051649, 4195332, 3072, 4195332, 7340039, 4195332, 5243909, 1051649, 4195332, 6291462, 2099202, 2099202, 6291462, 4195332, 3147779, 4195332, 2099202, 7340039, 4195332, 1051649, 7340039, 3147779, 7340039, 3072, 6291462, 1051649, 7340039, 4195332,
+  1051649, 4195332, 2099202, 6291462, 3147779, 5243909, 6291462, 4195332, 3147779, 1051649, 6291462, 4195332, 2099202, 5243909, 3072, 4195332, 6291462, 2099202, 4195332, 3147779, 5243909, 1051649, 3147779, 5243909, 2099202, 3072, 5243909, 1051649, 5243909, 3147779, 1051649, 6291462, 4195332, 3072, 7340039, 2099202, 6291462, 2099202, 7340039, 4195332, 3147779, 5243909, 1051649, 6291462, 5243909, 2099202, 3147779, 1051649, 4195332, 7340039, 3147779, 4195332, 3147779, 3072, 7340039, 2099202, 3072, 7340039, 3072, 5243909, 1051649, 5243909, 2099202, 6291462, 1051649, 7340039, 3147779, 1051649, 5243909, 3072, 2099202, 5243909, 2099202, 5243909, 1051649, 5243909, 1051649, 6291462, 3147779, 6291462, 5243909, 3147779, 1051649, 5243909, 4195332, 7340039, 3147779, 5243909, 3147779, 4195332, 2099202, 7340039, 4195332, 3072, 2099202, 1051649, 5243909, 3072, 4195332, 2099202, 5243909, 6291462, 3147779, 7340039, 1051649, 3072, 6291462, 2099202, 7340039, 3072, 4195332, 6291462, 1051649, 2099202, 7340039, 3072, 5243909, 1051649, 3147779, 6291462, 3072, 3147779, 5243909, 4195332, 2099202, 5243909, 2099202, 6291462,
+  7340039, 2099202, 6291462, 1051649, 1051649, 7340039, 2099202, 1051649, 7340039, 5243909, 3072, 3147779, 6291462, 2099202, 6291462, 3147779, 1051649, 5243909, 3072, 7340039, 2099202, 5243909, 6291462, 1051649, 7340039, 4195332, 3147779, 6291462, 2099202, 7340039, 2099202, 4195332, 1051649, 3147779, 5243909, 1051649, 4195332, 5243909, 3072, 2099202, 1051649, 7340039, 4195332, 3072, 4195332, 1051649, 7340039, 5243909, 3072, 5243909, 1051649, 7340039, 6291462, 2099202, 5243909, 3147779, 4195332, 2099202, 5243909, 2099202, 4195332, 7340039, 2099202, 4195332, 5243909, 3072, 5243909, 2099202, 6291462, 4195332, 3147779, 7340039, 4195332, 3072, 6291462, 2099202, 7340039, 2099202, 5243909, 1051649, 3072, 5243909, 7340039, 1051649, 6291462, 3072, 5243909, 1051649, 6291462, 3072, 5243909, 1051649, 4195332, 6291462, 7340039, 3147779, 4195332, 2099202, 7340039, 5243909, 3072, 3147779, 1051649, 5243909, 3147779, 3147779, 7340039, 1051649, 3147779, 5243909, 1051649, 3147779, 5243909, 6291462, 1051649, 5243909, 2099202, 7340039, 5243909, 2099202, 5243909, 6291462, 1051649, 2099202, 7340039, 3147779, 4195332, 3072,
+  4195332, 3072, 3147779, 5243909, 5243909, 3072, 3147779, 6291462, 3072, 2099202, 7340039, 3147779, 1051649, 7340039, 1051649, 3147779, 7340039, 3147779, 6291462, 2099202, 4195332, 3072, 4195332, 4195332, 2099202, 1051649, 7340039, 3072, 4195332, 1051649, 5243909, 3072, 7340039, 6291462, 3147779, 7340039, 3072, 3147779, 4195332, 6291462, 5243909, 3147779, 1051649, 7340039, 3147779, 5243909, 3147779, 2099202, 6291462, 1051649, 5243909, 3072, 2099202, 4195332, 6291462, 3072, 6291462, 1051649, 3147779, 7340039, 3147779, 3072, 6291462, 3072, 7340039, 3147779, 2099202, 7340039, 3147779, 1051649, 7340039, 1051649, 4195332, 7340039, 3147779, 5243909, 3072, 4195332, 3072, 6291462, 3147779, 4195332, 2099202, 4195332, 1051649, 2099202, 7340039, 2099202, 4195332, 6291462, 1051649, 7340039, 2099202, 3147779, 1051649, 5243909, 7340039, 3072, 3147779, 1051649, 7340039, 2099202, 6291462, 2099202, 6291462, 5243909, 3072, 4195332, 5243909, 2099202, 7340039, 4195332, 3072, 4195332, 3147779, 6291462, 3147779, 3072, 4195332, 1051649, 7340039, 3072, 4195332, 5243909, 3072, 6291462, 1051649, 5243909,
+  2099202, 7340039, 6291462, 3072, 3147779, 7340039, 5243909, 2099202, 4195332, 6291462, 1051649, 5243909, 5243909, 3072, 4195332, 5243909, 3072, 4195332, 1051649, 6291462, 3147779, 6291462, 1051649, 7340039, 3072, 5243909, 2099202, 4195332, 6291462, 1051649, 6291462, 3147779, 5243909, 2099202, 1051649, 4195332, 6291462, 1051649, 5243909, 2099202, 3072, 7340039, 2099202, 4195332, 3072, 6291462, 1051649, 7340039, 3147779, 4195332, 3147779, 7340039, 5243909, 3147779, 1051649, 5243909, 1051649, 7340039, 4195332, 3072, 6291462, 1051649, 4195332, 3147779, 1051649, 6291462, 4195332, 3072, 4195332, 6291462, 3072, 5243909, 2099202, 3072, 4195332, 1051649, 6291462, 4195332, 7340039, 2099202, 7340039, 3072, 6291462, 3147779, 6291462, 4195332, 3147779, 3072, 5243909, 2099202, 3147779, 5243909, 3072, 6291462, 4195332, 3072, 2099202, 3147779, 6291462, 4195332, 2099202, 6291462, 3072, 4195332, 3072, 4195332, 2099202, 6291462, 3072, 6291462, 3147779, 1051649, 7340039, 1051649, 6291462, 3072, 7340039, 4195332, 6291462, 3072, 3147779, 6291462, 3147779, 1051649, 7340039, 2099202, 6291462, 3147779,
+  5243909, 2099202, 1051649, 6291462, 4195332, 2099202, 3072, 7340039, 1051649, 4195332, 3072, 4195332, 2099202, 7340039, 4195332, 2099202, 7340039, 2099202, 5243909, 3072, 4195332, 1051649, 5243909, 3147779, 5243909, 3147779, 6291462, 3147779, 3072, 4195332, 3147779, 6291462, 3072, 7340039, 1051649, 6291462, 2099202, 7340039, 3072, 7340039, 4195332, 1051649, 5243909, 6291462, 2099202, 4195332, 2099202, 5243909, 3072, 7340039, 1051649, 2099202, 3072, 7340039, 2099202, 4195332, 6291462, 3147779, 1051649, 5243909, 2099202, 7340039, 2099202, 6291462, 3147779, 3072, 5243909, 6291462, 1051649, 2099202, 5243909, 3147779, 6291462, 3147779, 6291462, 4195332, 2099202, 3147779, 1051649, 5243909, 1051649, 5243909, 3147779, 5243909, 3072, 1051649, 7340039, 3147779, 6291462, 3072, 7340039, 3147779, 5243909, 2099202, 7340039, 4195332, 7340039, 6291462, 1051649, 5243909, 3072, 4195332, 5243909, 3147779, 7340039, 1051649, 7340039, 2099202, 7340039, 2099202, 3072, 5243909, 2099202, 4195332, 2099202, 5243909, 1051649, 2099202, 3147779, 6291462, 2099202, 3072, 7340039, 4195332, 5243909, 3072, 3147779, 1051649,
+  3072, 7340039, 4195332, 3147779, 1051649, 6291462, 3147779, 5243909, 3147779, 5243909, 7340039, 1051649, 6291462, 3147779, 1051649, 6291462, 3072, 6291462, 4195332, 7340039, 6291462, 2099202, 7340039, 2099202, 1051649, 7340039, 3072, 2099202, 5243909, 7340039, 1051649, 2099202, 4195332, 4195332, 5243909, 3072, 4195332, 2099202, 5243909, 3147779, 3147779, 6291462, 3072, 2099202, 7340039, 3147779, 6291462, 1051649, 4195332, 2099202, 5243909, 6291462, 4195332, 6291462, 3072, 7340039, 2099202, 3072, 7340039, 5243909, 1051649, 4195332, 5243909, 1051649, 7340039, 4195332, 3147779, 1051649, 6291462, 4195332, 1051649, 7340039, 3072, 5243909, 1051649, 7340039, 3072, 6291462, 3147779, 6291462, 2099202, 4195332, 1051649, 2099202, 7340039, 5243909, 4195332, 3072, 6291462, 4195332, 1051649, 6291462, 3072, 4195332, 1051649, 3147779, 3072, 2099202, 4195332, 1051649, 3147779, 7340039, 2099202, 1051649, 2099202, 5243909, 4195332, 1051649, 3147779, 4195332, 5243909, 3147779, 6291462, 3072, 7340039, 3147779, 4195332, 7340039, 3072, 5243909, 4195332, 3147779, 5243909, 1051649, 2099202, 6291462, 4195332, 7340039,
+  5243909, 3147779, 1051649, 7340039, 5243909, 2099202, 4195332, 3072, 7340039, 2099202, 1051649, 6291462, 3147779, 3072, 7340039, 3147779, 2099202, 5243909, 1051649, 3147779, 2099202, 5243909, 3072, 4195332, 6291462, 2099202, 4195332, 7340039, 1051649, 3147779, 6291462, 3072, 7340039, 2099202, 1051649, 6291462, 3147779, 1051649, 6291462, 3072, 6291462, 2099202, 4195332, 5243909, 1051649, 5243909, 3072, 3147779, 6291462, 7340039, 1051649, 3147779, 2099202, 1051649, 4195332, 1051649, 4195332, 5243909, 3147779, 2099202, 6291462, 3147779, 3072, 4195332, 2099202, 5243909, 2099202, 7340039, 3072, 6291462, 2099202, 4195332, 3147779, 2099202, 5243909, 1051649, 2099202, 5243909, 3072, 7340039, 3072, 4195332, 7340039, 5243909, 3147779, 1051649, 2099202, 5243909, 1051649, 2099202, 5243909, 2099202, 7340039, 5243909, 3147779, 6291462, 5243909, 1051649, 7340039, 6291462, 5243909, 1051649, 6291462, 4195332, 7340039, 3072, 3147779, 5243909, 6291462, 3072, 7340039, 1051649, 2099202, 5243909, 3147779, 1051649, 6291462, 4195332, 1051649, 7340039, 1051649, 6291462, 2099202, 7340039, 4195332, 3072, 3147779, 2099202,
+  6291462, 3072, 5243909, 2099202, 3072, 6291462, 1051649, 6291462, 2099202, 4195332, 5243909, 2099202, 4195332, 5243909, 2099202, 5243909, 3072, 7340039, 1051649, 5243909, 3072, 3147779, 7340039, 4195332, 3072, 5243909, 1051649, 5243909, 3147779, 5243909, 1051649, 4195332, 5243909, 3147779, 6291462, 3147779, 7340039, 4195332, 2099202, 5243909, 1051649, 5243909, 3147779, 3072, 6291462, 1051649, 7340039, 4195332, 3072, 4195332, 3072, 5243909, 4195332, 7340039, 3147779, 6291462, 3072, 7340039, 3072, 4195332, 1051649, 5243909, 7340039, 3147779, 6291462, 3072, 3147779, 2099202, 5243909, 1051649, 7340039, 3072, 7340039, 1051649, 4195332, 7340039, 4195332, 6291462, 3147779, 1051649, 3147779, 6291462, 2099202, 3072, 7340039, 5243909, 6291462, 3147779, 4195332, 7340039, 3072, 6291462, 1051649, 3072, 6291462, 2099202, 4195332, 5243909, 3072, 3147779, 3072, 5243909, 3147779, 3072, 4195332, 6291462, 2099202, 7340039, 1051649, 4195332, 2099202, 5243909, 6291462, 3147779, 1051649, 7340039, 3072, 2099202, 5243909, 2099202, 4195332, 3147779, 6291462, 3072, 3147779, 6291462, 5243909, 1051649,
+  4195332, 3147779, 4195332, 7340039, 4195332, 2099202, 5243909, 3072, 7340039, 3147779, 6291462, 3072, 7340039, 1051649, 6291462, 3147779, 4195332, 2099202, 6291462, 4195332, 7340039, 6291462, 1051649, 2099202, 6291462, 3147779, 7340039, 2099202, 3072, 7340039, 3147779, 7340039, 3072, 4195332, 3072, 5243909, 3072, 2099202, 6291462, 3147779, 7340039, 1051649, 7340039, 4195332, 2099202, 4195332, 5243909, 2099202, 6291462, 3147779, 7340039, 1051649, 6291462, 3072, 2099202, 5243909, 2099202, 3147779, 6291462, 2099202, 7340039, 4195332, 1051649, 3072, 5243909, 7340039, 5243909, 1051649, 6291462, 4195332, 3147779, 5243909, 2099202, 6291462, 3147779, 3072, 4195332, 1051649, 5243909, 4195332, 7340039, 1051649, 6291462, 4195332, 2099202, 3147779, 3072, 7340039, 1051649, 4195332, 2099202, 3147779, 4195332, 6291462, 2099202, 1051649, 7340039, 3147779, 6291462, 2099202, 7340039, 2099202, 6291462, 3147779, 5243909, 1051649, 4195332, 3072, 5243909, 3147779, 7340039, 3072, 4195332, 3072, 5243909, 4195332, 6291462, 3147779, 7340039, 3147779, 3072, 7340039, 2099202, 4195332, 7340039, 1051649, 2099202, 7340039,
+  3072, 6291462, 1051649, 1051649, 3147779, 7340039, 3147779, 5243909, 3147779, 3072, 1051649, 5243909, 3147779, 4195332, 2099202, 7340039, 3072, 6291462, 3147779, 3072, 1051649, 3147779, 5243909, 6291462, 1051649, 4195332, 3072, 6291462, 4195332, 2099202, 5243909, 1051649, 4195332, 2099202, 7340039, 1051649, 4195332, 7340039, 1051649, 4195332, 3072, 5243909, 2099202, 5243909, 6291462, 3072, 3147779, 7340039, 1051649, 2099202, 4195332, 3147779, 5243909, 2099202, 6291462, 1051649, 7340039, 4195332, 1051649, 6291462, 3072, 7340039, 3147779, 6291462, 2099202, 3147779, 3072, 4195332, 2099202, 7340039, 3072, 3147779, 5243909, 3072, 6291462, 2099202, 7340039, 2099202, 6291462, 3072, 3147779, 5243909, 2099202, 3072, 6291462, 1051649, 4195332, 6291462, 1051649, 6291462, 4195332, 7340039, 3072, 3147779, 4195332, 5243909, 3072, 3147779, 1051649, 5243909, 4195332, 7340039, 3072, 7340039, 2099202, 6291462, 3147779, 7340039, 2099202, 6291462, 1051649, 4195332, 6291462, 1051649, 7340039, 2099202, 3072, 5243909, 1051649, 5243909, 6291462, 1051649, 5243909, 1051649, 4195332, 4195332, 5243909, 2099202,
+  6291462, 4195332, 2099202, 6291462, 5243909, 3072, 4195332, 1051649, 6291462, 2099202, 4195332, 7340039, 2099202, 3072, 5243909, 1051649, 3147779, 5243909, 1051649, 5243909, 7340039, 3147779, 3072, 4195332, 2099202, 6291462, 3147779, 2099202, 5243909, 3072, 6291462, 3147779, 6291462, 2099202, 5243909, 3147779, 5243909, 2099202, 6291462, 3147779, 7340039, 1051649, 6291462, 3072, 3147779, 7340039, 1051649, 4195332, 5243909, 6291462, 3072, 7340039, 3072, 5243909, 3147779, 3147779, 5243909, 3072, 5243909, 3147779, 4195332, 2099202, 4195332, 1051649, 6291462, 3147779, 4195332, 6291462, 3072, 3147779, 6291462, 1051649, 7340039, 4195332, 2099202, 5243909, 3147779, 3072, 2099202, 6291462, 4195332, 1051649, 7340039, 4195332, 5243909, 7340039, 2099202, 3147779, 3147779, 5243909, 3072, 5243909, 2099202, 7340039, 1051649, 4195332, 7340039, 4195332, 7340039, 3072, 2099202, 1051649, 5243909, 3147779, 1051649, 3072, 5243909, 1051649, 3072, 4195332, 7340039, 2099202, 3147779, 5243909, 1051649, 4195332, 6291462, 2099202, 6291462, 3072, 2099202, 6291462, 3147779, 7340039, 3072, 7340039, 3072, 3147779,
+  1051649, 2099202, 7340039, 3072, 4195332, 7340039, 2099202, 7340039, 4195332, 1051649, 6291462, 3072, 3147779, 7340039, 4195332, 6291462, 3072, 7340039, 2099202, 4195332, 2099202, 5243909, 7340039, 3072, 7340039, 1051649, 6291462, 3072, 7340039, 3147779, 1051649, 5243909, 3072, 6291462, 3072, 7340039, 3072, 4195332, 1051649, 5243909, 3072, 4195332, 3147779, 7340039, 1051649, 4195332, 3147779, 6291462, 3072, 2099202, 5243909, 4195332, 2099202, 7340039, 1051649, 6291462, 1051649, 3147779, 7340039, 1051649, 6291462, 3072, 7340039, 5243909, 3072, 7340039, 1051649, 2099202, 7340039, 4195332, 5243909, 2099202, 4195332, 3072, 6291462, 1051649, 6291462, 3147779, 7340039, 4195332, 3072, 6291462, 1051649, 3147779, 3072, 2099202, 6291462, 3072, 7340039, 1051649, 7340039, 1051649, 5243909, 1051649, 6291462, 2099202, 3072, 2099202, 5243909, 3147779, 6291462, 4195332, 3072, 6291462, 4195332, 7340039, 3147779, 5243909, 6291462, 3147779, 1051649, 6291462, 3072, 7340039, 4195332, 3072, 2099202, 4195332, 3147779, 5243909, 4195332, 3072, 2099202, 5243909, 3147779, 1051649, 6291462, 5243909,
+  7340039, 4195332, 1051649, 6291462, 3147779, 3072, 5243909, 1051649, 3147779, 7340039, 2099202, 5243909, 6291462, 1051649, 1051649, 4195332, 3147779, 6291462, 4195332, 3072, 6291462, 1051649, 3147779, 4195332, 5243909, 3147779, 5243909, 4195332, 3147779, 1051649, 7340039, 2099202, 7340039, 4195332, 3147779, 2099202, 6291462, 3147779, 2099202, 7340039, 3147779, 6291462, 3072, 5243909, 2099202, 5243909, 1051649, 2099202, 7340039, 5243909, 2099202, 3147779, 6291462, 2099202, 4195332, 3072, 6291462, 4195332, 2099202, 5243909, 2099202, 5243909, 2099202, 4195332, 3147779, 5243909, 1051649, 5243909, 1051649, 5243909, 3072, 6291462, 7340039, 2099202, 3147779, 7340039, 3072, 5243909, 1051649, 5243909, 3147779, 2099202, 5243909, 5243909, 7340039, 4195332, 1051649, 5243909, 4195332, 3147779, 2099202, 4195332, 6291462, 3072, 3147779, 5243909, 3147779, 6291462, 1051649, 4195332, 1051649, 7340039, 3147779, 1051649, 2099202, 4195332, 1051649, 7340039, 2099202, 1051649, 5243909, 3147779, 5243909, 2099202, 4195332, 6291462, 7340039, 3072, 7340039, 1051649, 7340039, 3147779, 5243909, 1051649, 4195332, 5243909, 2099202, 3147779,
+  3072, 4195332, 5243909, 2099202, 5243909, 2099202, 4195332, 6291462, 3072, 4195332, 1051649, 3147779, 3072, 3147779, 7340039, 2099202, 6291462, 1051649, 2099202, 7340039, 4195332, 2099202, 6291462, 1051649, 7340039, 3072, 1051649, 2099202, 6291462, 4195332, 5243909, 3072, 4195332, 1051649, 4195332, 5243909, 1051649, 7340039, 5243909, 2099202, 1051649, 3147779, 6291462, 2099202, 7340039, 3072, 4195332, 7340039, 3147779, 1051649, 6291462, 1051649, 3072, 7340039, 4195332, 5243909, 2099202, 7340039, 4195332, 3072, 7340039, 3147779, 3072, 6291462, 1051649, 6291462, 4195332, 3147779, 2099202, 7340039, 2099202, 3147779, 1051649, 5243909, 4195332, 1051649, 5243909, 2099202, 7340039, 3147779, 1051649, 7340039, 3072, 3147779, 1051649, 4195332, 3072, 7340039, 3072, 6291462, 5243909, 3072, 4195332, 3147779, 6291462, 3072, 7340039, 2099202, 5243909, 3072, 5243909, 2099202, 6291462, 5243909, 6291462, 3072, 5243909, 2099202, 4195332, 6291462, 2099202, 7340039, 3072, 3147779, 6291462, 2099202, 1051649, 5243909, 3147779, 2099202, 3072, 6291462, 1051649, 7340039, 3072, 6291462, 1051649, 5243909,
+  2099202, 3147779, 3072, 7340039, 1051649, 6291462, 3072, 2099202, 6291462, 5243909, 7340039, 5243909, 4195332, 6291462, 5243909, 3072, 3147779, 5243909, 3147779, 5243909, 1051649, 5243909, 3072, 6291462, 2099202, 4195332, 7340039, 3147779, 3072, 7340039, 2099202, 3147779, 6291462, 2099202, 7340039, 1051649, 3147779, 4195332, 3072, 5243909, 7340039, 4195332, 1051649, 4195332, 2099202, 6291462, 3147779, 3072, 1051649, 5243909, 3147779, 7340039, 4195332, 3147779, 2099202, 1051649, 6291462, 3072, 3147779, 6291462, 1051649, 5243909, 1051649, 7340039, 4195332, 2099202, 3072, 7340039, 3072, 4195332, 5243909, 7340039, 3147779, 3072, 7340039, 2099202, 4195332, 6291462, 3072, 6291462, 5243909, 4195332, 2099202, 6291462, 7340039, 3147779, 6291462, 2099202, 3147779, 5243909, 2099202, 6291462, 2099202, 7340039, 2099202, 4195332, 1051649, 6291462, 4195332, 7340039, 3147779, 4195332, 3072, 3147779, 2099202, 7340039, 4195332, 1051649, 7340039, 3072, 4195332, 1051649, 6291462, 5243909, 1051649, 3147779, 5243909, 3072, 6291462, 5243909, 6291462, 3147779, 4195332, 3147779, 7340039, 3147779, 4195332, 6291462,
+  7340039, 5243909, 6291462, 1051649, 5243909, 3147779, 7340039, 4195332, 2099202, 2099202, 3147779, 1051649, 7340039, 1051649, 2099202, 7340039, 4195332, 1051649, 7340039, 3072, 7340039, 2099202, 5243909, 3147779, 3072, 5243909, 2099202, 4195332, 5243909, 1051649, 4195332, 6291462, 1051649, 5243909, 3072, 4195332, 6291462, 1051649, 7340039, 2099202, 3072, 5243909, 6291462, 3072, 6291462, 3147779, 4195332, 7340039, 4195332, 5243909, 3072, 1051649, 5243909, 3072, 7340039, 5243909, 3147779, 1051649, 5243909, 2099202, 4195332, 3147779, 6291462, 1051649, 3147779, 5243909, 6291462, 3147779, 6291462, 2099202, 3072, 1051649, 6291462, 4195332, 2099202, 7340039, 3072, 3147779, 1051649, 3147779, 3072, 7340039, 2099202, 4195332, 3072, 5243909, 2099202, 6291462, 1051649, 7340039, 1051649, 3147779, 7340039, 3072, 4195332, 3147779, 7340039, 2099202, 3072, 3147779, 1051649, 6291462, 4195332, 7340039, 1051649, 3147779, 3072, 6291462, 3147779, 3147779, 7340039, 3147779, 4195332, 3072, 7340039, 4195332, 7340039, 3147779, 4195332, 1051649, 2099202, 5243909, 3072, 6291462, 2099202, 3072, 5243909, 1051649,
+  2099202, 3072, 3147779, 4195332, 7340039, 3072, 4195332, 1051649, 6291462, 3072, 5243909, 3072, 2099202, 5243909, 4195332, 3072, 3147779, 6291462, 2099202, 3147779, 4195332, 3147779, 7340039, 1051649, 6291462, 3147779, 6291462, 3072, 7340039, 2099202, 7340039, 3072, 6291462, 2099202, 7340039, 3147779, 3072, 5243909, 1051649, 4195332, 6291462, 1051649, 3147779, 5243909, 2099202, 3072, 5243909, 1051649, 2099202, 7340039, 3147779, 6291462, 2099202, 4195332, 6291462, 1051649, 6291462, 3147779, 5243909, 3072, 7340039, 3072, 7340039, 2099202, 4195332, 3072, 2099202, 1051649, 4195332, 5243909, 6291462, 5243909, 2099202, 3072, 6291462, 1051649, 5243909, 6291462, 4195332, 6291462, 4195332, 1051649, 5243909, 1051649, 3147779, 6291462, 3072, 5243909, 3147779, 3147779, 4195332, 6291462, 1051649, 5243909, 1051649, 5243909, 3072, 5243909, 6291462, 4195332, 7340039, 1051649, 5243909, 3072, 5243909, 6291462, 3147779, 5243909, 2099202, 6291462, 3072, 5243909, 2099202, 5243909, 2099202, 1051649, 3072, 5243909, 1051649, 7340039, 4195332, 2099202, 7340039, 1051649, 4195332, 7340039, 2099202, 6291462,
+  5243909, 4195332, 7340039, 3072, 2099202, 5243909, 3147779, 6291462, 4195332, 3147779, 7340039, 4195332, 6291462, 3072, 6291462, 5243909, 6291462, 3072, 5243909, 1051649, 6291462, 3072, 2099202, 5243909, 4195332, 1051649, 2099202, 5243909, 3147779, 4195332, 1051649, 3147779, 5243909, 4195332, 1051649, 6291462, 4195332, 3147779, 7340039, 2099202, 3072, 7340039, 2099202, 7340039, 3147779, 6291462, 2099202, 4195332, 6291462, 3072, 5243909, 1051649, 6291462, 3072, 2099202, 4195332, 1051649, 7340039, 3072, 6291462, 5243909, 2099202, 4195332, 5243909, 1051649, 7340039, 5243909, 7340039, 1051649, 3147779, 3147779, 1051649, 7340039, 4195332, 3147779, 5243909, 3147779, 2099202, 1051649, 5243909, 2099202, 6291462, 3147779, 7340039, 4195332, 1051649, 4195332, 7340039, 3072, 7340039, 3072, 2099202, 6291462, 3147779, 7340039, 2099202, 4195332, 3147779, 2099202, 3072, 2099202, 5243909, 3147779, 2099202, 4195332, 1051649, 2099202, 6291462, 3072, 5243909, 2099202, 6291462, 1051649, 7340039, 3147779, 6291462, 4195332, 2099202, 7340039, 3147779, 3072, 6291462, 1051649, 5243909, 2099202, 4195332, 1051649, 3147779,
+  1051649, 3072, 5243909, 3147779, 6291462, 1051649, 2099202, 1051649, 6291462, 1051649, 5243909, 2099202, 3147779, 7340039, 2099202, 1051649, 2099202, 4195332, 3147779, 7340039, 2099202, 4195332, 6291462, 1051649, 3147779, 7340039, 4195332, 6291462, 3072, 6291462, 2099202, 5243909, 3072, 3147779, 7340039, 3147779, 2099202, 6291462, 3072, 5243909, 3147779, 4195332, 5243909, 3072, 1051649, 6291462, 3072, 7340039, 2099202, 4195332, 3147779, 6291462, 2099202, 7340039, 5243909, 3147779, 5243909, 2099202, 4195332, 3147779, 1051649, 3147779, 6291462, 3072, 6291462, 3147779, 1051649, 4195332, 6291462, 3072, 4195332, 6291462, 2099202, 5243909, 1051649, 7340039, 1051649, 4195332, 7340039, 3072, 7340039, 1051649, 4195332, 2099202, 3072, 6291462, 1051649, 4195332, 2099202, 5243909, 3147779, 5243909, 1051649, 4195332, 3072, 6291462, 1051649, 7340039, 3147779, 7340039, 5243909, 3072, 6291462, 2099202, 7340039, 4195332, 7340039, 1051649, 4195332, 7340039, 1051649, 3147779, 4195332, 3072, 6291462, 1051649, 5243909, 3147779, 3072, 6291462, 5243909, 3147779, 4195332, 7340039, 3072, 6291462, 3147779, 7340039,
+  7340039, 4195332, 1051649, 7340039, 3072, 4195332, 7340039, 5243909, 3147779, 3072, 5243909, 1051649, 5243909, 3072, 4195332, 7340039, 3147779, 5243909, 1051649, 4195332, 3072, 7340039, 3147779, 7340039, 3072, 6291462, 3072, 5243909, 1051649, 2099202, 7340039, 4195332, 6291462, 1051649, 5243909, 3072, 6291462, 1051649, 5243909, 1051649, 6291462, 3072, 3147779, 6291462, 4195332, 3147779, 5243909, 1051649, 5243909, 1051649, 7340039, 1051649, 4195332, 2099202, 3072, 6291462, 3072, 7340039, 2099202, 5243909, 7340039, 1051649, 2099202, 7340039, 3147779, 3072, 7340039, 3147779, 2099202, 5243909, 7340039, 1051649, 3147779, 3072, 6291462, 3072, 6291462, 3147779, 2099202, 5243909, 3147779, 3072, 5243909, 2099202, 7340039, 3147779, 5243909, 2099202, 6291462, 1051649, 7340039, 2099202, 6291462, 5243909, 2099202, 4195332, 5243909, 3072, 6291462, 1051649, 4195332, 7340039, 2099202, 6291462, 3072, 3147779, 3072, 5243909, 3147779, 2099202, 5243909, 3072, 7340039, 4195332, 2099202, 7340039, 1051649, 6291462, 4195332, 2099202, 1051649, 6291462, 3072, 2099202, 5243909, 1051649, 4195332, 2099202,
+  3072, 3147779, 6291462, 2099202, 5243909, 3147779, 3072, 2099202, 4195332, 7340039, 3147779, 7340039, 2099202, 4195332, 1051649, 1051649, 6291462, 3072, 6291462, 2099202, 5243909, 2099202, 3072, 5243909, 2099202, 4195332, 2099202, 3147779, 7340039, 3147779, 5243909, 3072, 1051649, 6291462, 2099202, 7340039, 2099202, 4195332, 4195332, 7340039, 2099202, 6291462, 4195332, 1051649, 7340039, 2099202, 3072, 7340039, 3147779, 6291462, 3147779, 3072, 7340039, 4195332, 2099202, 5243909, 4195332, 4195332, 1051649, 6291462, 3072, 4195332, 5243909, 2099202, 4195332, 5243909, 2099202, 3072, 6291462, 3147779, 3072, 4195332, 7340039, 4195332, 2099202, 5243909, 4195332, 3072, 6291462, 2099202, 4195332, 6291462, 4195332, 6291462, 3072, 5243909, 1051649, 5243909, 3072, 4195332, 3147779, 3072, 1051649, 7340039, 1051649, 6291462, 1051649, 5243909, 2099202, 5243909, 3147779, 1051649, 4195332, 1051649, 5243909, 5243909, 6291462, 4195332, 3072, 6291462, 2099202, 7340039, 1051649, 3147779, 5243909, 3072, 4195332, 1051649, 7340039, 3147779, 7340039, 2099202, 5243909, 6291462, 2099202, 7340039, 3147779, 5243909,
+  2099202, 6291462, 1051649, 7340039, 4195332, 1051649, 7340039, 3147779, 6291462, 1051649, 6291462, 3072, 7340039, 5243909, 6291462, 4195332, 2099202, 7340039, 3147779, 6291462, 1051649, 4195332, 5243909, 1051649, 6291462, 1051649, 7340039, 4195332, 3072, 5243909, 2099202, 6291462, 3147779, 4195332, 3072, 4195332, 3147779, 1051649, 6291462, 3072, 3147779, 4195332, 2099202, 7340039, 2099202, 5243909, 6291462, 4195332, 3072, 2099202, 5243909, 3147779, 5243909, 1051649, 7340039, 1051649, 3147779, 6291462, 3072, 4195332, 3147779, 6291462, 4195332, 3072, 6291462, 1051649, 5243909, 7340039, 4195332, 1051649, 7340039, 2099202, 5243909, 2099202, 6291462, 3147779, 2099202, 7340039, 5243909, 1051649, 7340039, 3072, 1051649, 3147779, 7340039, 2099202, 7340039, 3147779, 6291462, 2099202, 6291462, 7340039, 3147779, 5243909, 2099202, 3147779, 7340039, 3147779, 4195332, 3072, 6291462, 4195332, 3072, 7340039, 3147779, 2099202, 2099202, 1051649, 7340039, 4195332, 1051649, 3147779, 5243909, 3072, 6291462, 3147779, 7340039, 5243909, 2099202, 3072, 4195332, 5243909, 3072, 3147779, 1051649, 4195332, 3072, 6291462,
+  5243909, 1051649, 4195332, 3147779, 2099202, 6291462, 5243909, 3072, 2099202, 4195332, 2099202, 4195332, 3147779, 3072, 2099202, 7340039, 4195332, 1051649, 4195332, 3072, 7340039, 3147779, 3147779, 7340039, 3072, 5243909, 3147779, 1051649, 7340039, 3072, 4195332, 5243909, 2099202, 7340039, 5243909, 1051649, 5243909, 7340039, 2099202, 3147779, 7340039, 1051649, 5243909, 3072, 4195332, 3147779, 1051649, 4195332, 7340039, 4195332, 1051649, 6291462, 2099202, 4195332, 5243909, 6291462, 1051649, 3147779, 7340039, 2099202, 5243909, 1051649, 3147779, 7340039, 2099202, 7340039, 1051649, 2099202, 4195332, 5243909, 1051649, 6291462, 3072, 5243909, 3072, 1051649, 5243909, 3072, 2099202, 3147779, 5243909, 3147779, 7340039, 5243909, 4195332, 1051649, 4195332, 1051649, 4195332, 3072, 4195332, 1051649, 4195332, 3072, 4195332, 6291462, 3072, 1051649, 7340039, 3147779, 6291462, 1051649, 6291462, 3147779, 3072, 4195332, 7340039, 3147779, 4195332, 2099202, 6291462, 2099202, 4195332, 7340039, 2099202, 4195332, 3072, 1051649, 6291462, 3147779, 6291462, 1051649, 7340039, 3147779, 6291462, 6291462, 1051649, 3147779,
+  3072, 7340039, 5243909, 3072, 6291462, 1051649, 3147779, 5243909, 7340039, 3072, 6291462, 4195332, 6291462, 1051649, 5243909, 3072, 3147779, 6291462, 2099202, 5243909, 2099202, 6291462, 3072, 4195332, 3147779, 3072, 6291462, 5243909, 2099202, 6291462, 3147779, 1051649, 7340039, 3072, 3147779, 7340039, 3072, 2099202, 4195332, 6291462, 3072, 5243909, 3147779, 6291462, 5243909, 2099202, 6291462, 3072, 2099202, 7340039, 5243909, 3072, 7340039, 3072, 2099202, 3147779, 7340039, 3072, 5243909, 3147779, 3072, 6291462, 5243909, 3072, 3147779, 4195332, 3147779, 6291462, 3072, 2099202, 5243909, 3147779, 7340039, 3147779, 7340039, 6291462, 3147779, 7340039, 4195332, 7340039, 3072, 4195332, 2099202, 3072, 3147779, 6291462, 3072, 6291462, 7340039, 2099202, 7340039, 5243909, 2099202, 6291462, 1051649, 5243909, 3147779, 6291462, 2099202, 5243909, 1051649, 4195332, 2099202, 5243909, 7340039, 1051649, 6291462, 3072, 7340039, 3072, 5243909, 7340039, 3072, 3147779, 1051649, 6291462, 3147779, 5243909, 4195332, 5243909, 1051649, 4195332, 2099202, 4195332, 3072, 5243909, 3147779, 7340039,
+  4195332, 3147779, 2099202, 5243909, 4195332, 7340039, 4195332, 1051649, 2099202, 5243909, 3072, 3147779, 1051649, 5243909, 3147779, 6291462, 1051649, 5243909, 4195332, 7340039, 1051649, 4195332, 1051649, 6291462, 4195332, 7340039, 2099202, 3147779, 5243909, 1051649, 3147779, 6291462, 2099202, 5243909, 1051649, 4195332, 6291462, 6291462, 1051649, 5243909, 2099202, 7340039, 1051649, 2099202, 1051649, 7340039, 1051649, 6291462, 5243909, 3072, 3147779, 4195332, 2099202, 5243909, 7340039, 3072, 4195332, 2099202, 6291462, 1051649, 7340039, 1051649, 2099202, 5243909, 7340039, 3072, 6291462, 1051649, 4195332, 7340039, 3147779, 3072, 4195332, 2099202, 4195332, 3072, 4195332, 1051649, 3147779, 1051649, 6291462, 2099202, 4195332, 6291462, 5243909, 2099202, 5243909, 3147779, 1051649, 5243909, 3072, 2099202, 7340039, 3147779, 6291462, 3072, 7340039, 4195332, 3072, 4195332, 7340039, 3072, 7340039, 1051649, 3147779, 6291462, 1051649, 5243909, 2099202, 5243909, 1051649, 3147779, 5243909, 4195332, 6291462, 2099202, 1051649, 7340039, 2099202, 3072, 7340039, 3147779, 6291462, 1051649, 7340039, 1051649, 5243909, 2099202,
+  3072, 6291462, 1051649, 7340039, 2099202, 3072, 3147779, 6291462, 7340039, 2099202, 6291462, 2099202, 7340039, 3147779, 7340039, 1051649, 7340039, 3147779, 3072, 2099202, 4195332, 7340039, 5243909, 2099202, 1051649, 5243909, 1051649, 6291462, 3072, 4195332, 7340039, 3072, 6291462, 3147779, 6291462, 3072, 2099202, 3147779, 3072, 4195332, 6291462, 3072, 4195332, 6291462, 5243909, 3147779, 3072, 3147779, 4195332, 3147779, 6291462, 1051649, 6291462, 3147779, 1051649, 6291462, 3147779, 7340039, 2099202, 5243909, 4195332, 3147779, 6291462, 4195332, 1051649, 5243909, 2099202, 3147779, 6291462, 1051649, 5243909, 2099202, 6291462, 3072, 5243909, 2099202, 7340039, 6291462, 3072, 6291462, 3147779, 7340039, 1051649, 2099202, 3072, 7340039, 2099202, 3072, 6291462, 2099202, 5243909, 4195332, 3072, 4195332, 2099202, 3147779, 1051649, 2099202, 6291462, 2099202, 3147779, 5243909, 3147779, 5243909, 4195332, 3072, 5243909, 4195332, 6291462, 3147779, 6291462, 2099202, 1051649, 7340039, 3072, 4195332, 6291462, 3072, 4195332, 6291462, 3147779, 3072, 5243909, 2099202, 5243909, 4195332, 3072, 6291462,
+  2099202, 5243909, 4195332, 3072, 3147779, 6291462, 4195332, 3072, 4195332, 1051649, 3147779, 5243909, 3072, 4195332, 3072, 2099202, 5243909, 2099202, 5243909, 7340039, 1051649, 3072, 3147779, 6291462, 2099202, 7340039, 4195332, 3147779, 7340039, 2099202, 1051649, 5243909, 2099202, 4195332, 1051649, 5243909, 7340039, 4195332, 7340039, 2099202, 1051649, 5243909, 3147779, 1051649, 3072, 4195332, 7340039, 2099202, 7340039, 1051649, 5243909, 3072, 7340039, 1051649, 6291462, 4195332, 3072, 4195332, 1051649, 5243909, 1051649, 7340039, 3072, 2099202, 6291462, 4195332, 7340039, 4195332, 3072, 7340039, 1051649, 6291462, 1051649, 7340039, 3147779, 5243909, 1051649, 3147779, 5243909, 2099202, 5243909, 1051649, 6291462, 4195332, 5243909, 1051649, 4195332, 6291462, 3147779, 3147779, 7340039, 1051649, 3147779, 5243909, 3147779, 7340039, 6291462, 5243909, 1051649, 7340039, 1051649, 6291462, 3072, 2099202, 6291462, 2099202, 7340039, 2099202, 3072, 1051649, 4195332, 6291462, 4195332, 2099202, 5243909, 3147779, 4195332, 7340039, 2099202, 1051649, 4195332, 6291462, 2099202, 6291462, 3072, 3147779, 7340039, 4195332,
+  7340039, 1051649, 3147779, 6291462, 5243909, 1051649, 7340039, 2099202, 6291462, 5243909, 3072, 6291462, 3147779, 6291462, 4195332, 7340039, 3072, 6291462, 1051649, 3147779, 6291462, 3147779, 5243909, 3072, 4195332, 1051649, 3072, 6291462, 2099202, 5243909, 3147779, 7340039, 3072, 3147779, 6291462, 4195332, 2099202, 1051649, 3147779, 5243909, 7340039, 3147779, 7340039, 4195332, 6291462, 2099202, 3147779, 5243909, 3072, 6291462, 3147779, 2099202, 4195332, 4195332, 1051649, 5243909, 2099202, 6291462, 3147779, 7340039, 3072, 4195332, 3147779, 6291462, 3072, 2099202, 3072, 5243909, 3147779, 4195332, 2099202, 5243909, 4195332, 2099202, 4195332, 3072, 6291462, 4195332, 1051649, 7340039, 3072, 5243909, 3147779, 1051649, 7340039, 3147779, 7340039, 1051649, 5243909, 3072, 4195332, 6291462, 2099202, 7340039, 1051649, 4195332, 3072, 3147779, 5243909, 3072, 4195332, 2099202, 7340039, 4195332, 3072, 4195332, 1051649, 3147779, 7340039, 5243909, 3072, 7340039, 3072, 5243909, 1051649, 7340039, 1051649, 2099202, 5243909, 3147779, 7340039, 1051649, 4195332, 1051649, 7340039, 4195332, 1051649, 2099202,
+  3072, 4195332, 1051649, 5243909, 2099202, 3072, 5243909, 3147779, 1051649, 3147779, 7340039, 2099202, 5243909, 1051649, 4195332, 2099202, 5243909, 4195332, 3072, 5243909, 2099202, 7340039, 1051649, 6291462, 4195332, 7340039, 5243909, 3147779, 4195332, 3072, 6291462, 1051649, 4195332, 7340039, 2099202, 3072, 6291462, 2099202, 7340039, 3072, 4195332, 1051649, 4195332, 3072, 2099202, 6291462, 1051649, 4195332, 5243909, 1051649, 4195332, 7340039, 3147779, 3072, 6291462, 2099202, 7340039, 4195332, 1051649, 3147779, 6291462, 2099202, 7340039, 1051649, 5243909, 3147779, 7340039, 1051649, 6291462, 1051649, 7340039, 3147779, 3072, 6291462, 1051649, 7340039, 1051649, 2099202, 5243909, 3147779, 4195332, 2099202, 6291462, 3072, 5243909, 3072, 4195332, 2099202, 7340039, 3147779, 7340039, 1051649, 5243909, 3072, 6291462, 2099202, 7340039, 4195332, 2099202, 7340039, 3147779, 5243909, 1051649, 5243909, 7340039, 3147779, 6291462, 5243909, 2099202, 4195332, 3147779, 1051649, 6291462, 2099202, 5243909, 3072, 3147779, 6291462, 3072, 6291462, 2099202, 3147779, 7340039, 4195332, 3072, 6291462, 3147779, 5243909,
+  7340039, 5243909, 7340039, 3072, 3147779, 7340039, 2099202, 7340039, 4195332, 4195332, 1051649, 6291462, 3072, 7340039, 1051649, 6291462, 2099202, 7340039, 3147779, 6291462, 3072, 4195332, 3147779, 1051649, 3147779, 3072, 2099202, 7340039, 1051649, 6291462, 2099202, 4195332, 5243909, 3072, 5243909, 3147779, 6291462, 4195332, 1051649, 5243909, 2099202, 6291462, 2099202, 5243909, 7340039, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 6291462, 2099202, 7340039, 3147779, 5243909, 3072, 2099202, 6291462, 4195332, 1051649, 5243909, 3072, 4195332, 5243909, 1051649, 4195332, 6291462, 2099202, 5243909, 3072, 2099202, 7340039, 3147779, 6291462, 3147779, 4195332, 7340039, 2099202, 6291462, 1051649, 7340039, 2099202, 6291462, 3147779, 4195332, 2099202, 6291462, 1051649, 4195332, 3072, 5243909, 3147779, 4195332, 1051649, 5243909, 3147779, 3072, 6291462, 4195332, 3072, 6291462, 4195332, 2099202, 1051649, 5243909, 1051649, 3072, 7340039, 1051649, 5243909, 4195332, 3147779, 7340039, 1051649, 7340039, 2099202, 5243909, 2099202, 4195332, 3072, 5243909, 2099202, 5243909, 3147779, 2099202, 6291462, 1051649,
+  3147779, 1051649, 2099202, 6291462, 4195332, 1051649, 5243909, 1051649, 3072, 6291462, 2099202, 3147779, 5243909, 1051649, 5243909, 3147779, 3072, 3147779, 1051649, 5243909, 2099202, 7340039, 2099202, 6291462, 6291462, 4195332, 5243909, 1051649, 5243909, 3147779, 7340039, 3072, 2099202, 4195332, 1051649, 7340039, 1051649, 3072, 6291462, 3147779, 5243909, 2099202, 6291462, 3072, 3147779, 5243909, 2099202, 3072, 7340039, 3147779, 6291462, 1051649, 5243909, 3147779, 3072, 7340039, 1051649, 6291462, 5243909, 3072, 7340039, 3147779, 3147779, 6291462, 2099202, 7340039, 2099202, 3072, 4195332, 3147779, 6291462, 5243909, 4195332, 1051649, 5243909, 3072, 5243909, 3072, 4195332, 3072, 4195332, 5243909, 3072, 4195332, 1051649, 7340039, 3072, 6291462, 5243909, 2099202, 7340039, 1051649, 6291462, 2099202, 7340039, 1051649, 6291462, 5243909, 1051649, 3147779, 2099202, 1051649, 7340039, 2099202, 6291462, 3147779, 7340039, 3147779, 6291462, 2099202, 4195332, 3072, 6291462, 3072, 3147779, 4195332, 3147779, 6291462, 1051649, 7340039, 5243909, 1051649, 6291462, 3072, 7340039, 5243909, 3072, 4195332,
+  6291462, 3147779, 4195332, 2099202, 6291462, 2099202, 3147779, 6291462, 5243909, 2099202, 7340039, 4195332, 3147779, 7340039, 2099202, 6291462, 4195332, 7340039, 5243909, 4195332, 1051649, 5243909, 3072, 4195332, 3072, 3147779, 1051649, 7340039, 4195332, 3072, 3147779, 5243909, 7340039, 3147779, 6291462, 3147779, 5243909, 7340039, 4195332, 1051649, 7340039, 3072, 3147779, 7340039, 5243909, 3072, 6291462, 5243909, 1051649, 6291462, 2099202, 4195332, 1051649, 5243909, 2099202, 4195332, 5243909, 1051649, 3147779, 5243909, 2099202, 1051649, 7340039, 3072, 6291462, 3147779, 1051649, 5243909, 7340039, 1051649, 3147779, 3072, 2099202, 7340039, 2099202, 4195332, 3147779, 7340039, 2099202, 6291462, 1051649, 6291462, 3147779, 7340039, 4195332, 2099202, 5243909, 3147779, 3072, 5243909, 3147779, 4195332, 3072, 5243909, 2099202, 3147779, 4195332, 2099202, 1051649, 7340039, 5243909, 6291462, 3072, 5243909, 4195332, 3072, 5243909, 2099202, 3147779, 6291462, 1051649, 7340039, 2099202, 5243909, 1051649, 6291462, 3072, 7340039, 4195332, 1051649, 3147779, 7340039, 2099202, 4195332, 1051649, 3147779, 6291462, 2099202,
+  5243909, 3072, 7340039, 1051649, 5243909, 3072, 6291462, 3072, 3147779, 5243909, 3072, 6291462, 3072, 4195332, 4195332, 3072, 1051649, 2099202, 4195332, 3072, 6291462, 3147779, 7340039, 2099202, 5243909, 7340039, 4195332, 2099202, 6291462, 2099202, 6291462, 2099202, 1051649, 5243909, 3072, 4195332, 3072, 3147779, 2099202, 6291462, 1051649, 5243909, 4195332, 1051649, 2099202, 7340039, 3147779, 1051649, 4195332, 3147779, 5243909, 3072, 7340039, 3147779, 6291462, 1051649, 4195332, 2099202, 7340039, 3072, 4195332, 5243909, 2099202, 4195332, 3147779, 3072, 6291462, 3147779, 2099202, 4195332, 7340039, 4195332, 6291462, 1051649, 6291462, 1051649, 5243909, 3072, 5243909, 3147779, 7340039, 3147779, 2099202, 4195332, 3072, 7340039, 2099202, 6291462, 4195332, 3072, 6291462, 1051649, 7340039, 4195332, 3072, 7340039, 3072, 3147779, 6291462, 3072, 2099202, 3147779, 4195332, 3147779, 2099202, 7340039, 4195332, 3072, 7340039, 3072, 5243909, 3147779, 7340039, 4195332, 5243909, 2099202, 4195332, 3072, 3147779, 6291462, 4195332, 3072, 3147779, 5243909, 6291462, 2099202, 7340039, 3072,
+  2099202, 7340039, 3147779, 4195332, 2099202, 7340039, 4195332, 6291462, 1051649, 4195332, 1051649, 7340039, 5243909, 2099202, 6291462, 3147779, 7340039, 6291462, 1051649, 6291462, 2099202, 5243909, 1051649, 6291462, 1051649, 2099202, 6291462, 3072, 3147779, 5243909, 3072, 6291462, 1051649, 4195332, 6291462, 2099202, 5243909, 7340039, 3072, 4195332, 3147779, 1051649, 7340039, 3147779, 6291462, 1051649, 4195332, 6291462, 7340039, 3072, 3147779, 7340039, 2099202, 2099202, 3072, 5243909, 7340039, 3072, 6291462, 2099202, 7340039, 1051649, 6291462, 3072, 5243909, 7340039, 2099202, 6291462, 3072, 6291462, 3072, 2099202, 5243909, 3147779, 3072, 6291462, 2099202, 7340039, 1051649, 3147779, 3072, 5243909, 6291462, 3072, 5243909, 3147779, 1051649, 1051649, 2099202, 7340039, 4195332, 3147779, 5243909, 1051649, 6291462, 2099202, 5243909, 6291462, 4195332, 7340039, 5243909, 3072, 7340039, 1051649, 6291462, 3072, 3147779, 6291462, 2099202, 5243909, 6291462, 1051649, 3147779, 3072, 2099202, 7340039, 3147779, 6291462, 5243909, 3072, 2099202, 6291462, 7340039, 1051649, 4195332, 3072, 5243909, 3147779,
+  4195332, 3072, 5243909, 1051649, 5243909, 3147779, 1051649, 4195332, 3147779, 7340039, 3147779, 2099202, 1051649, 6291462, 1051649, 5243909, 3072, 3147779, 4195332, 3147779, 7340039, 3072, 4195332, 3147779, 7340039, 5243909, 1051649, 7340039, 4195332, 1051649, 5243909, 3147779, 4195332, 7340039, 1051649, 7340039, 2099202, 5243909, 2099202, 7340039, 3147779, 6291462, 2099202, 4195332, 3072, 5243909, 2099202, 3072, 2099202, 6291462, 5243909, 1051649, 6291462, 4195332, 7340039, 2099202, 3147779, 5243909, 3147779, 4195332, 3072, 5243909, 3147779, 7340039, 2099202, 4195332, 1051649, 4195332, 5243909, 2099202, 4195332, 7340039, 1051649, 4195332, 7340039, 2099202, 4195332, 1051649, 6291462, 4195332, 7340039, 1051649, 2099202, 6291462, 1051649, 5243909, 7340039, 5243909, 6291462, 1051649, 6291462, 2099202, 3072, 3147779, 4195332, 7340039, 1051649, 3147779, 3072, 2099202, 6291462, 4195332, 1051649, 5243909, 2099202, 5243909, 4195332, 1051649, 4195332, 3147779, 1051649, 4195332, 7340039, 4195332, 6291462, 1051649, 5243909, 1051649, 2099202, 7340039, 4195332, 2099202, 3072, 5243909, 6291462, 3147779, 1051649, 7340039,
+  6291462, 2099202, 3147779, 6291462, 1051649, 7340039, 3072, 7340039, 2099202, 5243909, 3072, 5243909, 7340039, 4195332, 1051649, 5243909, 2099202, 7340039, 2099202, 4195332, 1051649, 5243909, 2099202, 6291462, 3072, 3147779, 1051649, 5243909, 3147779, 7340039, 2099202, 7340039, 3072, 2099202, 3147779, 4195332, 1051649, 3147779, 4195332, 3072, 5243909, 3072, 5243909, 4195332, 7340039, 2099202, 7340039, 5243909, 3147779, 4195332, 3072, 4195332, 1051649, 5243909, 1051649, 3147779, 6291462, 1051649, 7340039, 1051649, 3147779, 6291462, 1051649, 4195332, 3072, 5243909, 1051649, 7340039, 2099202, 7340039, 1051649, 3147779, 6291462, 3147779, 3072, 3147779, 5243909, 6291462, 3147779, 3072, 2099202, 5243909, 3147779, 4195332, 7340039, 3072, 4195332, 3147779, 3072, 4195332, 2099202, 7340039, 5243909, 6291462, 2099202, 3072, 5243909, 5243909, 6291462, 3147779, 1051649, 7340039, 4195332, 3072, 7340039, 1051649, 6291462, 6291462, 3072, 7340039, 2099202, 5243909, 2099202, 3072, 6291462, 3147779, 3072, 7340039, 4195332, 1051649, 5243909, 3147779, 4195332, 2099202, 3072, 7340039, 4195332, 1051649,
+  2099202, 4195332, 7340039, 3072, 4195332, 3147779, 6291462, 3147779, 3072, 4195332, 6291462, 2099202, 3072, 3147779, 7340039, 3072, 6291462, 1051649, 5243909, 3072, 7340039, 3147779, 6291462, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 6291462, 3072, 4195332, 5243909, 6291462, 3072, 4195332, 6291462, 1051649, 7340039, 6291462, 2099202, 6291462, 2099202, 3072, 1051649, 3147779, 4195332, 1051649, 6291462, 2099202, 7340039, 3147779, 6291462, 3072, 4195332, 6291462, 3072, 4195332, 2099202, 6291462, 4195332, 3072, 6291462, 3147779, 7340039, 3147779, 5243909, 3072, 5243909, 3147779, 6291462, 5243909, 3072, 7340039, 5243909, 1051649, 4195332, 3072, 2099202, 5243909, 6291462, 1051649, 7340039, 3072, 3147779, 4195332, 2099202, 5243909, 2099202, 7340039, 3147779, 3072, 4195332, 1051649, 5243909, 7340039, 3147779, 1051649, 3072, 4195332, 5243909, 2099202, 3147779, 5243909, 3147779, 4195332, 3072, 3147779, 5243909, 1051649, 6291462, 3072, 5243909, 3147779, 3147779, 4195332, 5243909, 2099202, 4195332, 7340039, 3072, 6291462, 7340039, 1051649, 5243909, 2099202, 3147779, 6291462,
+  3072, 3147779, 1051649, 5243909, 6291462, 1051649, 2099202, 6291462, 2099202, 5243909, 1051649, 6291462, 3147779, 5243909, 2099202, 4195332, 4195332, 3147779, 7340039, 4195332, 1051649, 5243909, 3072, 3147779, 5243909, 3072, 6291462, 2099202, 7340039, 2099202, 3147779, 5243909, 1051649, 3147779, 5243909, 2099202, 6291462, 3072, 3147779, 4195332, 1051649, 3147779, 6291462, 4195332, 7340039, 5243909, 3072, 7340039, 3072, 5243909, 1051649, 5243909, 4195332, 3147779, 7340039, 2099202, 2099202, 5243909, 5243909, 3072, 7340039, 4195332, 2099202, 5243909, 2099202, 1051649, 7340039, 3147779, 1051649, 4195332, 3072, 2099202, 4195332, 2099202, 4195332, 7340039, 2099202, 3147779, 7340039, 1051649, 4195332, 5243909, 2099202, 5243909, 7340039, 1051649, 6291462, 1051649, 7340039, 1051649, 6291462, 3147779, 2099202, 7340039, 3147779, 1051649, 4195332, 6291462, 6291462, 2099202, 7340039, 3072, 2099202, 6291462, 1051649, 7340039, 5243909, 2099202, 7340039, 1051649, 4195332, 5243909, 2099202, 7340039, 3072, 7340039, 1051649, 6291462, 3072, 3147779, 5243909, 2099202, 1051649, 6291462, 4195332, 5243909, 3072, 5243909,
+  7340039, 4195332, 7340039, 4195332, 2099202, 4195332, 5243909, 3072, 7340039, 1051649, 4195332, 3072, 6291462, 1051649, 7340039, 3072, 6291462, 2099202, 3072, 3147779, 6291462, 2099202, 7340039, 3147779, 6291462, 3147779, 5243909, 1051649, 5243909, 3072, 7340039, 1051649, 4195332, 6291462, 1051649, 7340039, 3147779, 5243909, 6291462, 1051649, 5243909, 7340039, 3072, 5243909, 2099202, 1051649, 6291462, 3147779, 4195332, 2099202, 7340039, 3072, 2099202, 5243909, 3072, 4195332, 7340039, 3147779, 1051649, 6291462, 2099202, 1051649, 7340039, 3072, 6291462, 4195332, 2099202, 6291462, 6291462, 1051649, 7340039, 5243909, 1051649, 6291462, 3072, 3147779, 5243909, 7340039, 1051649, 6291462, 3072, 3147779, 6291462, 3072, 2099202, 6291462, 4195332, 5243909, 2099202, 5243909, 3072, 5243909, 1051649, 4195332, 2099202, 7340039, 3072, 4195332, 2099202, 1051649, 5243909, 3147779, 7340039, 4195332, 3072, 2099202, 4195332, 1051649, 3147779, 6291462, 3147779, 7340039, 1051649, 6291462, 1051649, 6291462, 3147779, 2099202, 5243909, 3147779, 1051649, 6291462, 4195332, 3072, 3147779, 1051649, 7340039, 1051649,
+  5243909, 2099202, 3072, 6291462, 3072, 7340039, 2099202, 6291462, 3147779, 4195332, 7340039, 3147779, 2099202, 5243909, 3147779, 1051649, 2099202, 5243909, 4195332, 6291462, 2099202, 5243909, 1051649, 4195332, 3072, 2099202, 4195332, 7340039, 2099202, 4195332, 3147779, 6291462, 3072, 2099202, 5243909, 3072, 2099202, 1051649, 7340039, 3147779, 2099202, 4195332, 3147779, 1051649, 6291462, 5243909, 2099202, 1051649, 6291462, 4195332, 1051649, 3147779, 6291462, 1051649, 6291462, 3147779, 3072, 5243909, 6291462, 2099202, 4195332, 5243909, 1051649, 3147779, 3147779, 5243909, 3072, 4195332, 3072, 4195332, 3147779, 3072, 5243909, 5243909, 3147779, 6291462, 3072, 2099202, 4195332, 6291462, 3147779, 7340039, 1051649, 3147779, 6291462, 2099202, 3072, 3147779, 6291462, 3147779, 3147779, 7340039, 2099202, 6291462, 3072, 4195332, 6291462, 1051649, 7340039, 4195332, 6291462, 3072, 2099202, 4195332, 6291462, 7340039, 2099202, 6291462, 4195332, 3072, 4195332, 3072, 4195332, 3147779, 5243909, 2099202, 3072, 7340039, 1051649, 6291462, 4195332, 2099202, 5243909, 7340039, 5243909, 6291462, 3147779, 2099202,
+  3072, 4195332, 6291462, 3147779, 5243909, 1051649, 5243909, 3072, 5243909, 1051649, 2099202, 5243909, 7340039, 3072, 4195332, 5243909, 7340039, 3072, 7340039, 1051649, 6291462, 3072, 6291462, 1051649, 7340039, 5243909, 4195332, 3072, 6291462, 1051649, 7340039, 1051649, 5243909, 3147779, 6291462, 4195332, 7340039, 4195332, 3072, 5243909, 7340039, 3072, 5243909, 7340039, 3072, 3147779, 4195332, 7340039, 3072, 5243909, 3147779, 7340039, 5243909, 1051649, 4195332, 7340039, 2099202, 4195332, 1051649, 3147779, 7340039, 3072, 6291462, 5243909, 1051649, 7340039, 2099202, 7340039, 3147779, 5243909, 7340039, 3147779, 2099202, 1051649, 7340039, 1051649, 4195332, 6291462, 3072, 2099202, 4195332, 1051649, 5243909, 4195332, 1051649, 7340039, 3147779, 6291462, 3072, 7340039, 4195332, 3072, 5243909, 3147779, 6291462, 2099202, 5243909, 3147779, 3072, 3147779, 1051649, 5243909, 6291462, 3147779, 3072, 1051649, 5243909, 3072, 2099202, 6291462, 2099202, 6291462, 2099202, 7340039, 3072, 5243909, 4195332, 5243909, 3072, 4195332, 7340039, 3072, 3147779, 1051649, 2099202, 3072, 4195332, 6291462,
+  3147779, 7340039, 2099202, 1051649, 3147779, 6291462, 3147779, 7340039, 2099202, 4195332, 6291462, 3072, 4195332, 3147779, 7340039, 3147779, 1051649, 4195332, 2099202, 4195332, 3147779, 7340039, 2099202, 5243909, 3147779, 2099202, 1051649, 7340039, 3147779, 2099202, 5243909, 4195332, 1051649, 7340039, 3072, 2099202, 1051649, 6291462, 3147779, 2099202, 1051649, 4195332, 1051649, 4195332, 2099202, 7340039, 3072, 3147779, 2099202, 3147779, 6291462, 3072, 2099202, 7340039, 3147779, 3072, 6291462, 5243909, 3072, 5243909, 2099202, 4195332, 3147779, 2099202, 6291462, 3072, 4195332, 2099202, 6291462, 1051649, 3072, 6291462, 7340039, 2099202, 4195332, 6291462, 1051649, 5243909, 3147779, 4195332, 7340039, 3072, 7340039, 3147779, 4195332, 2099202, 5243909, 1051649, 4195332, 1051649, 5243909, 2099202, 6291462, 3072, 4195332, 1051649, 7340039, 2099202, 6291462, 5243909, 7340039, 3147779, 1051649, 5243909, 7340039, 3147779, 5243909, 3147779, 7340039, 3147779, 5243909, 3147779, 1051649, 5243909, 2099202, 7340039, 1051649, 3147779, 6291462, 1051649, 2099202, 5243909, 3147779, 7340039, 4195332, 7340039, 1051649, 5243909,
+  3147779, 3072, 5243909, 7340039, 4195332, 3072, 2099202, 4195332, 1051649, 7340039, 1051649, 3147779, 6291462, 1051649, 3072, 6291462, 5243909, 2099202, 6291462, 3072, 5243909, 1051649, 4195332, 3072, 6291462, 3147779, 6291462, 4195332, 3072, 6291462, 3072, 6291462, 3147779, 3147779, 4195332, 5243909, 7340039, 3072, 3147779, 7340039, 5243909, 6291462, 3147779, 7340039, 3147779, 5243909, 6291462, 1051649, 6291462, 4195332, 1051649, 4195332, 5243909, 3072, 4195332, 6291462, 1051649, 7340039, 3147779, 6291462, 1051649, 7340039, 3072, 7340039, 4195332, 3147779, 6291462, 3072, 4195332, 5243909, 2099202, 4195332, 1051649, 4195332, 3072, 7340039, 2099202, 5243909, 1051649, 7340039, 2099202, 5243909, 1051649, 6291462, 3072, 7340039, 1051649, 5243909, 2099202, 7340039, 3072, 5243909, 3147779, 1051649, 7340039, 2099202, 4195332, 1051649, 5243909, 2099202, 3072, 4195332, 7340039, 3072, 2099202, 4195332, 3072, 7340039, 1051649, 4195332, 3072, 7340039, 6291462, 4195332, 1051649, 4195332, 6291462, 2099202, 7340039, 3147779, 7340039, 3072, 6291462, 2099202, 3072, 3147779, 5243909, 2099202,
+  4195332, 6291462, 1051649, 6291462, 3072, 5243909, 6291462, 3147779, 5243909, 2099202, 4195332, 7340039, 2099202, 6291462, 5243909, 2099202, 3072, 7340039, 3147779, 7340039, 2099202, 7340039, 3147779, 5243909, 1051649, 6291462, 3072, 2099202, 7340039, 4195332, 2099202, 5243909, 3072, 6291462, 4195332, 1051649, 3147779, 4195332, 6291462, 3072, 2099202, 4195332, 3072, 5243909, 1051649, 3072, 2099202, 5243909, 3072, 7340039, 2099202, 7340039, 2099202, 2099202, 6291462, 2099202, 4195332, 1051649, 3147779, 4195332, 2099202, 4195332, 5243909, 2099202, 3072, 6291462, 1051649, 6291462, 3147779, 1051649, 6291462, 2099202, 6291462, 3147779, 5243909, 2099202, 3072, 6291462, 3147779, 6291462, 3072, 3147779, 5243909, 2099202, 3147779, 6291462, 4195332, 3072, 6291462, 3147779, 4195332, 1051649, 7340039, 4195332, 3147779, 6291462, 3072, 7340039, 3147779, 3147779, 6291462, 2099202, 5243909, 3147779, 6291462, 1051649, 5243909, 2099202, 5243909, 1051649, 6291462, 2099202, 3072, 7340039, 3147779, 6291462, 3072, 5243909, 3072, 4195332, 1051649, 5243909, 2099202, 5243909, 4195332, 6291462, 3072, 7340039,
+  5243909, 1051649, 4195332, 3147779, 2099202, 7340039, 1051649, 4195332, 3072, 6291462, 1051649, 5243909, 3072, 3147779, 1051649, 5243909, 4195332, 5243909, 1051649, 3147779, 3072, 4195332, 1051649, 7340039, 3147779, 2099202, 4195332, 5243909, 1051649, 5243909, 3147779, 7340039, 2099202, 7340039, 1051649, 5243909, 2099202, 7340039, 1051649, 4195332, 1051649, 6291462, 2099202, 3147779, 6291462, 4195332, 6291462, 2099202, 7340039, 3147779, 4195332, 1051649, 6291462, 5243909, 1051649, 3147779, 3072, 7340039, 5243909, 3072, 7340039, 1051649, 1051649, 5243909, 5243909, 3147779, 7340039, 1051649, 4195332, 7340039, 3147779, 5243909, 3072, 7340039, 1051649, 6291462, 4195332, 4195332, 1051649, 1051649, 4195332, 6291462, 3072, 7340039, 2099202, 3072, 3147779, 7340039, 2099202, 1051649, 5243909, 6291462, 2099202, 3072, 6291462, 4195332, 3147779, 5243909, 1051649, 7340039, 3072, 6291462, 1051649, 1051649, 4195332, 7340039, 3147779, 1051649, 7340039, 3147779, 4195332, 2099202, 5243909, 3147779, 1051649, 2099202, 4195332, 3147779, 7340039, 2099202, 6291462, 3147779, 1051649, 6291462, 1051649, 2099202, 5243909, 2099202,
+  3072, 7340039, 1051649, 6291462, 1051649, 3147779, 7340039, 2099202, 6291462, 3147779, 7340039, 2099202, 4195332, 7340039, 3147779, 7340039, 3072, 2099202, 4195332, 6291462, 5243909, 2099202, 5243909, 3072, 5243909, 7340039, 3147779, 3072, 7340039, 1051649, 4195332, 3072, 5243909, 1051649, 3147779, 6291462, 3072, 2099202, 6291462, 5243909, 7340039, 3147779, 6291462, 3072, 7340039, 1051649, 4195332, 3072, 5243909, 1051649, 5243909, 4195332, 3072, 3147779, 5243909, 7340039, 6291462, 4195332, 3072, 6291462, 3147779, 6291462, 3147779, 7340039, 1051649, 2099202, 2099202, 4195332, 5243909, 3072, 3147779, 5243909, 2099202, 4195332, 3147779, 2099202, 7340039, 3072, 5243909, 7340039, 3147779, 2099202, 4195332, 4195332, 5243909, 6291462, 5243909, 2099202, 4195332, 7340039, 3147779, 3072, 4195332, 6291462, 1051649, 1051649, 5243909, 3072, 6291462, 2099202, 4195332, 3147779, 5243909, 6291462, 2099202, 3072, 5243909, 6291462, 3072, 6291462, 3072, 6291462, 1051649, 5243909, 7340039, 4195332, 6291462, 1051649, 3147779, 6291462, 3072, 7340039, 4195332, 2099202, 7340039, 4195332, 1051649, 7340039,
+  4195332, 3147779, 7340039, 2099202, 4195332, 5243909, 3072, 5243909, 3147779, 3072, 4195332, 1051649, 5243909, 3072, 6291462, 2099202, 4195332, 6291462, 3072, 1051649, 3147779, 7340039, 3147779, 6291462, 2099202, 1051649, 4195332, 6291462, 3147779, 5243909, 2099202, 6291462, 3147779, 7340039, 3072, 4195332, 4195332, 5243909, 3072, 2099202, 3147779, 1051649, 4195332, 2099202, 5243909, 1051649, 7340039, 4195332, 3147779, 6291462, 3072, 7340039, 2099202, 7340039, 1051649, 3072, 2099202, 5243909, 2099202, 4195332, 2099202, 4195332, 3072, 3147779, 4195332, 5243909, 7340039, 3072, 6291462, 2099202, 7340039, 1051649, 6291462, 3072, 6291462, 1051649, 5243909, 2099202, 5243909, 3072, 6291462, 1051649, 7340039, 1051649, 3072, 4195332, 1051649, 6291462, 3072, 4195332, 1051649, 6291462, 2099202, 3147779, 5243909, 7340039, 2099202, 7340039, 4195332, 5243909, 2099202, 7340039, 1051649, 4195332, 7340039, 4195332, 1051649, 4195332, 3147779, 4195332, 2099202, 7340039, 4195332, 3072, 2099202, 3072, 3147779, 5243909, 1051649, 2099202, 5243909, 1051649, 6291462, 3072, 3147779, 5243909, 3072, 3147779,
+  3147779, 2099202, 5243909, 3072, 6291462, 1051649, 6291462, 2099202, 4195332, 5243909, 3147779, 6291462, 2099202, 6291462, 3147779, 5243909, 1051649, 2099202, 7340039, 4195332, 6291462, 3072, 4195332, 1051649, 5243909, 6291462, 1051649, 2099202, 7340039, 3072, 6291462, 3147779, 1051649, 5243909, 2099202, 7340039, 1051649, 3147779, 7340039, 4195332, 6291462, 3072, 5243909, 2099202, 6291462, 3147779, 1051649, 5243909, 2099202, 3147779, 4195332, 3147779, 1051649, 6291462, 3147779, 6291462, 3147779, 7340039, 1051649, 5243909, 6291462, 1051649, 7340039, 2099202, 6291462, 3072, 4195332, 1051649, 5243909, 3147779, 4195332, 1051649, 4195332, 3147779, 5243909, 3072, 3147779, 7340039, 4195332, 2099202, 5243909, 3147779, 5243909, 3147779, 7340039, 2099202, 7340039, 1051649, 3147779, 6291462, 3072, 5243909, 7340039, 1051649, 4195332, 3072, 4195332, 1051649, 2099202, 3072, 4195332, 3072, 6291462, 2099202, 3072, 3147779, 7340039, 2099202, 5243909, 1051649, 6291462, 3147779, 1051649, 4195332, 6291462, 4195332, 6291462, 3072, 7340039, 4195332, 2099202, 5243909, 3147779, 4195332, 6291462, 1051649, 6291462, 5243909,
+  6291462, 3072, 5243909, 4195332, 3147779, 7340039, 1051649, 7340039, 3072, 6291462, 3072, 7340039, 1051649, 4195332, 1051649, 3072, 7340039, 3147779, 2099202, 5243909, 1051649, 2099202, 6291462, 7340039, 3072, 3147779, 6291462, 4195332, 2099202, 2099202, 4195332, 3072, 7340039, 3147779, 6291462, 1051649, 6291462, 2099202, 5243909, 3072, 2099202, 7340039, 3147779, 7340039, 3072, 4195332, 6291462, 3072, 7340039, 3072, 7340039, 5243909, 5243909, 2099202, 4195332, 1051649, 5243909, 3072, 4195332, 3147779, 3072, 5243909, 4195332, 6291462, 1051649, 3147779, 7340039, 2099202, 6291462, 3072, 7340039, 6291462, 2099202, 7340039, 1051649, 4195332, 7340039, 3072, 3147779, 7340039, 1051649, 6291462, 3072, 5243909, 2099202, 3147779, 5243909, 2099202, 5243909, 2099202, 7340039, 3147779, 2099202, 5243909, 2099202, 6291462, 3147779, 5243909, 6291462, 7340039, 3147779, 6291462, 3147779, 1051649, 5243909, 6291462, 2099202, 6291462, 3072, 7340039, 3072, 5243909, 1051649, 7340039, 2099202, 5243909, 1051649, 3147779, 6291462, 4195332, 3072, 6291462, 3072, 7340039, 2099202, 5243909, 2099202, 1051649,
+  3147779, 7340039, 2099202, 6291462, 3072, 2099202, 4195332, 3147779, 6291462, 3147779, 1051649, 4195332, 3147779, 5243909, 7340039, 3147779, 4195332, 5243909, 3072, 4195332, 7340039, 5243909, 1051649, 3147779, 4195332, 5243909, 1051649, 3072, 6291462, 4195332, 7340039, 5243909, 2099202, 4195332, 3072, 5243909, 3147779, 3072, 4195332, 6291462, 5243909, 3147779, 1051649, 2099202, 4195332, 7340039, 2099202, 3147779, 4195332, 2099202, 2099202, 1051649, 1051649, 6291462, 3072, 7340039, 2099202, 4195332, 7340039, 2099202, 7340039, 2099202, 3072, 5243909, 2099202, 6291462, 3072, 5243909, 1051649, 3147779, 5243909, 2099202, 3072, 3147779, 6291462, 2099202, 4195332, 2099202, 6291462, 1051649, 4195332, 3147779, 4195332, 6291462, 3072, 6291462, 3072, 7340039, 1051649, 5243909, 3147779, 3072, 6291462, 1051649, 5243909, 3072, 7340039, 1051649, 3072, 3147779, 1051649, 5243909, 2099202, 7340039, 4195332, 1051649, 4195332, 2099202, 4195332, 3147779, 3147779, 7340039, 2099202, 5243909, 3072, 3147779, 7340039, 5243909, 1051649, 2099202, 7340039, 3147779, 5243909, 1051649, 4195332, 3072, 7340039, 4195332,
+  3072, 4195332, 1051649, 4195332, 6291462, 5243909, 3072, 2099202, 1051649, 5243909, 7340039, 2099202, 5243909, 3072, 2099202, 6291462, 1051649, 6291462, 1051649, 7340039, 3147779, 3072, 6291462, 1051649, 7340039, 2099202, 4195332, 7340039, 5243909, 3072, 3147779, 1051649, 4195332, 7340039, 4195332, 2099202, 5243909, 7340039, 1051649, 2099202, 3072, 6291462, 5243909, 1051649, 6291462, 3072, 5243909, 1051649, 6291462, 6291462, 4195332, 7340039, 3147779, 5243909, 4195332, 3147779, 3072, 6291462, 1051649, 6291462, 3147779, 1051649, 5243909, 3147779, 7340039, 4195332, 2099202, 4195332, 4195332, 7340039, 1051649, 4195332, 7340039, 5243909, 1051649, 5243909, 3072, 6291462, 3147779, 5243909, 3072, 7340039, 2099202, 1051649, 4195332, 3147779, 6291462, 4195332, 3072, 4195332, 1051649, 5243909, 4195332, 7340039, 3147779, 2099202, 4195332, 3147779, 5243909, 4195332, 7340039, 1051649, 6291462, 3072, 3147779, 7340039, 3072, 6291462, 1051649, 5243909, 2099202, 5243909, 3072, 4195332, 6291462, 1051649, 4195332, 3072, 7340039, 3147779, 4195332, 1051649, 2099202, 6291462, 7340039, 3147779, 1051649, 6291462,
+  7340039, 3147779, 6291462, 2099202, 1051649, 3147779, 7340039, 4195332, 7340039, 3072, 2099202, 6291462, 1051649, 7340039, 4195332, 3072, 4195332, 3147779, 5243909, 1051649, 5243909, 2099202, 4195332, 5243909, 3147779, 3072, 6291462, 1051649, 3147779, 2099202, 6291462, 1051649, 6291462, 3072, 3147779, 7340039, 1051649, 3147779, 6291462, 7340039, 4195332, 3072, 4195332, 7340039, 3147779, 2099202, 4195332, 7340039, 3072, 1051649, 5243909, 3072, 6291462, 3072, 2099202, 6291462, 5243909, 2099202, 5243909, 3072, 7340039, 4195332, 6291462, 1051649, 5243909, 3072, 7340039, 1051649, 6291462, 3072, 5243909, 3147779, 3072, 2099202, 6291462, 3147779, 7340039, 1051649, 2099202, 7340039, 4195332, 2099202, 6291462, 3147779, 7340039, 1051649, 1051649, 3147779, 7340039, 3147779, 7340039, 6291462, 2099202, 3072, 5243909, 1051649, 6291462, 3072, 7340039, 2099202, 5243909, 2099202, 4195332, 5243909, 4195332, 2099202, 5243909, 3147779, 7340039, 3072, 6291462, 1051649, 7340039, 2099202, 3147779, 7340039, 2099202, 5243909, 3147779, 6291462, 3072, 7340039, 4195332, 3147779, 1051649, 5243909, 4195332, 2099202,
+  1051649, 5243909, 3072, 7340039, 3147779, 5243909, 1051649, 2099202, 6291462, 4195332, 5243909, 3072, 4195332, 3147779, 6291462, 5243909, 7340039, 3072, 2099202, 6291462, 4195332, 1051649, 6291462, 3072, 7340039, 5243909, 3147779, 4195332, 7340039, 1051649, 4195332, 5243909, 2099202, 6291462, 3072, 6291462, 2099202, 5243909, 3072, 3147779, 1051649, 6291462, 3147779, 1051649, 5243909, 6291462, 1051649, 3147779, 5243909, 7340039, 3147779, 3147779, 2099202, 4195332, 7340039, 1051649, 3072, 4195332, 3147779, 5243909, 2099202, 3072, 2099202, 7340039, 3147779, 1051649, 3147779, 6291462, 2099202, 3147779, 5243909, 2099202, 7340039, 4195332, 7340039, 1051649, 3147779, 5243909, 3072, 6291462, 1051649, 5243909, 3072, 5243909, 2099202, 7340039, 4195332, 6291462, 1051649, 5243909, 2099202, 3072, 4195332, 6291462, 3147779, 7340039, 2099202, 4195332, 1051649, 5243909, 3072, 6291462, 3147779, 1051649, 3072, 7340039, 1051649, 5243909, 2099202, 4195332, 3147779, 5243909, 4195332, 6291462, 3072, 5243909, 3072, 6291462, 1051649, 2099202, 6291462, 3147779, 3072, 5243909, 1051649, 7340039, 2099202, 6291462,
+  4195332, 3147779, 6291462, 4195332, 3072, 2099202, 6291462, 5243909, 1051649, 2099202, 3147779, 7340039, 1051649, 7340039, 3072, 2099202, 2099202, 6291462, 3147779, 3072, 2099202, 7340039, 3147779, 2099202, 4195332, 2099202, 3072, 5243909, 1051649, 6291462, 3072, 3147779, 5243909, 2099202, 5243909, 1051649, 4195332, 6291462, 2099202, 7340039, 4195332, 5243909, 2099202, 6291462, 3072, 4195332, 6291462, 2099202, 3072, 4195332, 1051649, 7340039, 6291462, 1051649, 5243909, 3147779, 5243909, 3147779, 7340039, 1051649, 6291462, 4195332, 6291462, 4195332, 3072, 5243909, 6291462, 1051649, 5243909, 7340039, 3072, 6291462, 3147779, 1051649, 4195332, 2099202, 6291462, 4195332, 2099202, 4195332, 1051649, 3147779, 6291462, 4195332, 3072, 5243909, 2099202, 3072, 6291462, 1051649, 6291462, 3147779, 7340039, 1051649, 4195332, 3072, 4195332, 6291462, 2099202, 3147779, 6291462, 1051649, 7340039, 5243909, 3147779, 6291462, 4195332, 3147779, 3072, 6291462, 3072, 2099202, 1051649, 3147779, 7340039, 2099202, 4195332, 3147779, 4195332, 5243909, 1051649, 5243909, 2099202, 7340039, 4195332, 3072, 4195332, 3072,
+  7340039, 2099202, 1051649, 5243909, 7340039, 4195332, 1051649, 3147779, 5243909, 7340039, 3072, 6291462, 4195332, 1051649, 3147779, 6291462, 4195332, 1051649, 5243909, 7340039, 4195332, 3072, 5243909, 6291462, 1051649, 6291462, 7340039, 3147779, 2099202, 5243909, 3147779, 7340039, 1051649, 4195332, 3147779, 7340039, 4195332, 3072, 5243909, 1051649, 4195332, 3072, 7340039, 3147779, 5243909, 2099202, 3072, 6291462, 5243909, 3147779, 5243909, 3072, 2099202, 4195332, 1051649, 7340039, 1051649, 6291462, 3072, 7340039, 1051649, 3147779, 1051649, 4195332, 7340039, 3147779, 2099202, 4195332, 3072, 3147779, 4195332, 3072, 5243909, 6291462, 3072, 5243909, 3147779, 3072, 7340039, 2099202, 7340039, 5243909, 3072, 3147779, 7340039, 2099202, 4195332, 7340039, 3147779, 4195332, 3072, 3147779, 5243909, 2099202, 7340039, 1051649, 6291462, 1051649, 4195332, 7340039, 2099202, 4195332, 3072, 7340039, 2099202, 3072, 1051649, 7340039, 6291462, 4195332, 7340039, 5243909, 6291462, 3072, 5243909, 2099202, 6291462, 3072, 7340039, 3072, 7340039, 2099202, 6291462, 1051649, 3147779, 7340039, 5243909, 2099202,
+  1051649, 7340039, 5243909, 3072, 2099202, 5243909, 7340039, 3072, 4195332, 2099202, 4195332, 3147779, 2099202, 5243909, 6291462, 1051649, 5243909, 7340039, 2099202, 3147779, 1051649, 6291462, 3147779, 3072, 4195332, 4195332, 3147779, 3072, 7340039, 6291462, 3072, 2099202, 7340039, 3072, 5243909, 1051649, 2099202, 6291462, 3147779, 3147779, 7340039, 2099202, 4195332, 1051649, 7340039, 5243909, 2099202, 4195332, 1051649, 7340039, 2099202, 7340039, 5243909, 3147779, 6291462, 4195332, 2099202, 5243909, 3147779, 2099202, 3147779, 7340039, 5243909, 2099202, 3072, 5243909, 1051649, 6291462, 2099202, 6291462, 2099202, 7340039, 3147779, 2099202, 7340039, 1051649, 6291462, 5243909, 1051649, 5243909, 3072, 2099202, 6291462, 4195332, 1051649, 5243909, 1051649, 4195332, 3072, 7340039, 5243909, 2099202, 3072, 6291462, 3147779, 5243909, 2099202, 5243909, 3072, 3147779, 6291462, 2099202, 4195332, 2099202, 5243909, 3147779, 5243909, 1051649, 4195332, 2099202, 1051649, 2099202, 3147779, 6291462, 1051649, 7340039, 1051649, 6291462, 3147779, 4195332, 1051649, 4195332, 3072, 5243909, 4195332, 1051649, 3072, 5243909,
+  4195332, 3072, 4195332, 3147779, 6291462, 1051649, 2099202, 6291462, 5243909, 1051649, 6291462, 3072, 7340039, 3147779, 2099202, 4195332, 3072, 3147779, 5243909, 1051649, 7340039, 4195332, 2099202, 7340039, 6291462, 3072, 1051649, 5243909, 4195332, 1051649, 7340039, 4195332, 3147779, 6291462, 2099202, 7340039, 4195332, 1051649, 7340039, 3072, 5243909, 1051649, 6291462, 3147779, 3072, 3147779, 7340039, 5243909, 2099202, 4195332, 3072, 3147779, 1051649, 6291462, 3072, 2099202, 6291462, 3072, 5243909, 4195332, 6291462, 3072, 2099202, 6291462, 4195332, 1051649, 7340039, 3147779, 7340039, 1051649, 5243909, 1051649, 5243909, 1051649, 4195332, 4195332, 3072, 3147779, 2099202, 6291462, 4195332, 7340039, 3147779, 3072, 7340039, 3147779, 6291462, 2099202, 6291462, 2099202, 3147779, 6291462, 4195332, 1051649, 5243909, 3072, 7340039, 3147779, 7340039, 5243909, 3072, 5243909, 1051649, 6291462, 1051649, 7340039, 3147779, 7340039, 3072, 3147779, 5243909, 7340039, 4195332, 3072, 4195332, 3147779, 5243909, 3147779, 2099202, 5243909, 2099202, 5243909, 3147779, 7340039, 3072, 6291462, 6291462, 3147779,
+  7340039, 3147779, 6291462, 1051649, 4195332, 3147779, 7340039, 3147779, 3072, 7340039, 3147779, 5243909, 1051649, 5243909, 3072, 7340039, 3147779, 6291462, 3072, 4195332, 3147779, 3072, 5243909, 1051649, 2099202, 5243909, 7340039, 3147779, 1051649, 4195332, 2099202, 5243909, 3072, 1051649, 5243909, 3072, 5243909, 1051649, 5243909, 5243909, 2099202, 4195332, 3072, 7340039, 4195332, 1051649, 4195332, 3072, 7340039, 1051649, 6291462, 4195332, 6291462, 2099202, 4195332, 7340039, 4195332, 3147779, 7340039, 3072, 2099202, 7340039, 3147779, 3072, 6291462, 3147779, 5243909, 3072, 2099202, 4195332, 3147779, 6291462, 3072, 6291462, 2099202, 7340039, 3147779, 7340039, 4195332, 3072, 3147779, 1051649, 6291462, 4195332, 2099202, 5243909, 3072, 5243909, 4195332, 3072, 6291462, 1051649, 7340039, 4195332, 2099202, 6291462, 4195332, 1051649, 3147779, 1051649, 7340039, 3147779, 6291462, 4195332, 1051649, 5243909, 3072, 4195332, 5243909, 6291462, 1051649, 2099202, 1051649, 6291462, 7340039, 2099202, 5243909, 3072, 6291462, 3072, 7340039, 1051649, 6291462, 2099202, 3147779, 2099202, 4195332, 2099202,
+  2099202, 5243909, 1051649, 6291462, 3072, 5243909, 1051649, 4195332, 6291462, 2099202, 4195332, 2099202, 6291462, 4195332, 6291462, 1051649, 4195332, 2099202, 7340039, 2099202, 6291462, 2099202, 7340039, 3147779, 6291462, 1051649, 4195332, 6291462, 2099202, 6291462, 3072, 6291462, 4195332, 6291462, 2099202, 3147779, 7340039, 3147779, 3147779, 1051649, 6291462, 2099202, 6291462, 3147779, 5243909, 1051649, 6291462, 2099202, 3147779, 6291462, 2099202, 3072, 4195332, 3072, 5243909, 1051649, 5243909, 1051649, 1051649, 5243909, 1051649, 5243909, 4195332, 6291462, 2099202, 7340039, 3072, 6291462, 4195332, 7340039, 3072, 2099202, 4195332, 4195332, 5243909, 1051649, 5243909, 1051649, 6291462, 2099202, 5243909, 5243909, 1051649, 3147779, 6291462, 1051649, 3147779, 7340039, 1051649, 7340039, 2099202, 5243909, 3147779, 3072, 7340039, 1051649, 5243909, 2099202, 6291462, 4195332, 3147779, 3072, 2099202, 3147779, 7340039, 2099202, 6291462, 2099202, 3147779, 3072, 4195332, 7340039, 5243909, 3147779, 3072, 4195332, 1051649, 7340039, 4195332, 6291462, 2099202, 4195332, 1051649, 5243909, 7340039, 1051649, 6291462, 3072,
+  6291462, 1051649, 7340039, 3147779, 7340039, 2099202, 6291462, 3147779, 3072, 6291462, 1051649, 7340039, 3072, 3147779, 2099202, 7340039, 3072, 5243909, 1051649, 5243909, 5243909, 1051649, 4195332, 3072, 2099202, 7340039, 3147779, 3072, 5243909, 3147779, 7340039, 2099202, 3072, 4195332, 1051649, 7340039, 3072, 6291462, 3072, 7340039, 2099202, 7340039, 3072, 4195332, 2099202, 6291462, 3147779, 7340039, 3072, 5243909, 3147779, 5243909, 7340039, 3147779, 7340039, 2099202, 3147779, 6291462, 4195332, 3147779, 7340039, 3147779, 1051649, 5243909, 3072, 3147779, 5243909, 2099202, 1051649, 3147779, 5243909, 6291462, 7340039, 3072, 3147779, 6291462, 3072, 4195332, 3147779, 7340039, 3072, 4195332, 7340039, 2099202, 3072, 7340039, 5243909, 3072, 5243909, 3147779, 4195332, 3072, 6291462, 2099202, 5243909, 3147779, 3072, 7340039, 4195332, 3072, 6291462, 5243909, 7340039, 4195332, 3072, 5243909, 1051649, 4195332, 7340039, 5243909, 1051649, 2099202, 3072, 6291462, 2099202, 7340039, 3147779, 1051649, 3147779, 3147779, 5243909, 3072, 7340039, 3147779, 3072, 5243909, 3147779, 4195332,
+};
+
+
+#elif (DFB_DITHER565 == DFB_DITHER_SIMPLE)
+
+
+#define DM_WIDTH        8
+#define DM_HEIGHT       8
+#define DM_WIDTH_SHIFT  3
+
+static const u32 DM_565[DM_WIDTH * DM_HEIGHT] =
+{
+  3072, 4195332, 1051649, 5243909, 3072, 4195332, 1051649, 5243909,
+  6291462, 2099202, 7340039, 3147779, 6291462, 2099202, 7340039, 3147779,
+  1051649, 5243909, 3072, 4195332, 1051649, 5243909, 3072, 4195332,
+  7340039, 3147779, 6291462, 2099202, 7340039, 3147779, 6291462, 2099202,
+  3072, 4195332, 1051649, 5243909, 3072, 4195332, 1051649, 5243909,
+  6291462, 2099202, 7340039, 3147779, 6291462, 2099202, 7340039, 3147779,
+  1051649, 5243909, 3072, 4195332, 1051649, 5243909, 3072, 4195332,
+  7340039, 3147779, 6291462, 2099202, 7340039, 3147779, 6291462, 2099202,
+};
+
+#endif
+
+
+#endif  /*  __DITHER565_H__  */
diff --git a/Source/DirectFB/src/misc/gfx_util.c b/Source/DirectFB/src/misc/gfx_util.c
new file mode 100755
index 0000000..1165112
--- /dev/null
+++ b/Source/DirectFB/src/misc/gfx_util.c
@@ -0,0 +1,964 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Scaling routines ported from gdk_pixbuf by Sven Neumann
+   <sven@convergence.de>.
+
+   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 <stdlib.h>
+#include <stdio.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/palette.h>
+#include <core/surface.h>
+
+#include <direct/memcpy.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <misc/util.h>
+#include <misc/dither565.h>
+#include <misc/gfx_util.h>
+
+#include <gfx/clip.h>
+#include <gfx/convert.h>
+
+
+#define SUBSAMPLE_BITS 4
+#define SUBSAMPLE (1 << SUBSAMPLE_BITS)
+#define SUBSAMPLE_MASK ((1 << SUBSAMPLE_BITS)-1)
+#define SCALE_SHIFT 16
+
+
+typedef struct _PixopsFilter PixopsFilter;
+
+struct _PixopsFilter {
+     int *weights;
+     int n_x;
+     int n_y;
+     float x_offset;
+     float y_offset;
+};
+
+
+static void write_argb_span (u32 *src, u8 *dst[], int len,
+                             int dx, int dy, CoreSurface *dst_surface)
+{
+     CorePalette *palette = dst_surface->palette;
+     u8          *d       = dst[0];
+     u8          *d1,*d2;
+     int          i, j;
+
+     if (dst_surface->config.caps & DSCAPS_PREMULTIPLIED) {
+          for (i = 0; i < len; i++) {
+               const u32 s = src[i];
+               const u32 a = (s >> 24) + 1;
+
+               src[i] = ((((s & 0x00ff00ff) * a) >> 8) & 0x00ff00ff) |
+                        ((((s & 0x0000ff00) * a) >> 8) & 0x0000ff00) |
+                        ((((s & 0xff000000)    )     )             );
+          }
+     }
+
+     switch (dst_surface->config.format) {
+          case DSPF_A1:
+               for (i = 0; i < len; i++) {
+                    if (i & 7)
+                         d[i>>3] |= (src[i] >> 31) << (7-(i&7));
+                    else
+                         d[i>>3]  = (src[i] >> 24) & 0x80;
+               }
+               break;
+
+          case DSPF_A4:
+               for (i = 0, j = 0; i < len; i += 2, j++)
+                    d[j] = ((src[i] >> 24) & 0xF0) | (src[i+1] >> 28);
+               break;
+
+          case DSPF_A8:
+               for (i = 0; i < len; i++)
+                    d[i] = src[i] >> 24;
+               break;
+
+          case DSPF_RGB332:
+               for (i = 0; i < len; i++)
+                    d[i] = RGB32_TO_RGB332( src[i] );
+               break;
+
+          case DSPF_ARGB1555:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_ARGB1555( src[i] );
+               break;
+
+          case DSPF_ARGB2554:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_ARGB2554( src[i] );
+               break;
+
+          case DSPF_ARGB4444:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_ARGB4444( src[i] );
+               break;
+
+          case DSPF_RGBA4444:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_RGBA4444( src[i] );
+               break;
+
+          case DSPF_RGB16:
+#ifdef DFB_DITHER565
+               /* use a pre-generated dither matrix to improve the appearance of the result */
+               {
+                    const u32 *dm = DM_565 + ((dy & (DM_HEIGHT - 1)) << DM_WIDTH_SHIFT);
+
+                    for (i = 0; i < len; i++) {
+                         u32 rgb = ((src[i] & 0xFF)          |
+                                    (src[i] & 0xFF00)   << 2 |
+                                    (src[i] & 0xFF0000) << 4);
+
+                         rgb += dm[(dx + i) & (DM_WIDTH - 1)];
+                         rgb += (0x10040100
+                                 - ((rgb & 0x1e0001e0) >> 5)
+                                 - ((rgb & 0x00070000) >> 6));
+
+                         ((u16*)d)[i] = (((rgb & 0x0f800000) >> 12) |
+                                         ((rgb & 0x0003f000) >> 7)  |
+                                         ((rgb & 0x000000f8) >> 3));
+                    }
+               }
+#else
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = RGB32_TO_RGB16( src[i] );
+#endif
+               break;
+
+          case DSPF_ARGB1666:
+               for (i = 0; i < len; i++) {
+                    const u32 pixel = PIXEL_ARGB1666( src[i] >> 24,
+                                                      src[i] >> 16,
+                                                      src[i] >> 8,
+                                                      src[i] );
+
+                    *d++ = pixel;
+                    *d++ = pixel >> 8;
+                    *d++ = pixel >> 16;
+               }
+               break;
+
+          case DSPF_ARGB6666:
+               for (i = 0; i < len; i++) {
+                    const u32 pixel = PIXEL_ARGB6666( src[i] >> 24,
+                                                      src[i] >> 16,
+                                                      src[i] >> 8,
+                                                      src[i] );
+
+                    *d++ = pixel;
+                    *d++ = pixel >> 8;
+                    *d++ = pixel >> 16;
+               }
+               break;
+
+          case DSPF_RGB18:
+               for (i = 0; i < len; i++) {
+                    const u32 pixel = PIXEL_RGB18( src[i] >> 16,
+                                                   src[i] >> 8,
+                                                   src[i] );
+
+                    *d++ = pixel;
+                    *d++ = pixel >> 8;
+                    *d++ = pixel >> 16;
+               }
+               break;
+
+          case DSPF_RGB24:
+               for (i = 0; i < len; i++) {
+#ifdef WORDS_BIGENDIAN
+                    *d++ = src[i] >> 16;
+                    *d++ = src[i] >> 8;
+                    *d++ = src[i];
+#else
+                    *d++ = src[i];
+                    *d++ = src[i] >> 8;
+                    *d++ = src[i] >> 16;
+#endif
+               }
+               break;
+
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               direct_memcpy( d, src, len*4 );
+               break;
+
+          case DSPF_AiRGB:
+               for (i = 0; i < len; i++)
+                    ((u32*)d)[i] = src[i] ^ 0xff000000;
+               break;
+
+          case DSPF_LUT8:
+               if (palette) {
+                    for (i = 0; i < len; i++) {
+                         d[i] = dfb_palette_search( palette,
+                                                    (src[i] >> 16) & 0xff,
+                                                    (src[i] >>  8) & 0xff,
+                                                    (src[i]      ) & 0xff,
+                                                    (src[i] >> 24) & 0xff );
+                    }
+               }
+               break;
+
+          case DSPF_ALUT44:
+               if (palette) {
+                    for (i = 0; i < len; i++) {
+                         d[i] = ((src[i] >> 24) & 0xf0) +
+                                dfb_palette_search( palette,
+                                                    (src[i] >> 16) & 0xff,
+                                                    (src[i] >>  8) & 0xff,
+                                                    (src[i]      ) & 0xff, 0x80 );
+                    }
+               }
+               break;
+
+          case DSPF_YUY2:
+               if (dx & 1) {
+                    u32 y, u, v;
+
+                    RGB_TO_YCBCR( (src[0] >> 16) & 0xff,
+                                  (src[0] >>  8) & 0xff,
+                                  (src[0]      ) & 0xff, y, u, v );
+                    *((u16*)d) = y | (v << 8);
+                    d += 2;
+                    src++;
+                    len--;
+               }
+               for (i = 0; i < (len-1); i += 2) {
+                    u32 y0, u, v;
+                    u32 y1, u1, v1;
+
+                    RGB_TO_YCBCR( (src[i+0] >> 16) & 0xff,
+                                  (src[i+0] >>  8) & 0xff,
+                                  (src[i+0]      ) & 0xff, y0, u, v );
+                    RGB_TO_YCBCR( (src[i+1] >> 16) & 0xff,
+                                  (src[i+1] >>  8) & 0xff,
+                                  (src[i+1]      ) & 0xff, y1, u1, v1 );
+
+                    u = (u + u1) >> 1;
+                    v = (v + v1) >> 1;
+
+                    ((u16*)d)[i+0] = y0 | (u << 8);
+                    ((u16*)d)[i+1] = y1 | (v << 8);
+               }
+               if (len & 1) {
+                    u32 y, u, v;
+
+                    src += len-1;
+                    d   += (len-1) * 2;
+
+                    RGB_TO_YCBCR( (*src >> 16) & 0xff,
+                                  (*src >>  8) & 0xff,
+                                  (*src      ) & 0xff, y, u, v );
+                    *((u16*)d) = y | (u << 8);
+               }
+               break;
+
+          case DSPF_UYVY:
+               if (dx & 1) {
+                    u32 y, u, v;
+
+                    RGB_TO_YCBCR( (src[0] >> 16) & 0xff,
+                                  (src[0] >>  8) & 0xff,
+                                  (src[0]      ) & 0xff, y, u, v );
+                    *((u16*)d) = v | (y << 8);
+                    d += 2;
+                    src++;
+                    len--;
+               }
+               for (i = 0; i < (len-1); i += 2) {
+                    u32 y0, u, v;
+                    u32 y1, u1, v1;
+
+                    RGB_TO_YCBCR( (src[i+0] >> 16) & 0xff,
+                                  (src[i+0] >>  8) & 0xff,
+                                  (src[i+0]      ) & 0xff, y0, u, v );
+                    RGB_TO_YCBCR( (src[i+1] >> 16) & 0xff,
+                                  (src[i+1] >>  8) & 0xff,
+                                  (src[i+1]      ) & 0xff, y1, u1, v1 );
+
+                    u = (u + u1) >> 1;
+                    v = (v + v1) >> 1;
+
+                    ((u16*)d)[i+0] = u | (y0 << 8);
+                    ((u16*)d)[i+1] = v | (y1 << 8);
+               }
+               if (len & 1) {
+                    u32 y, u, v;
+
+                    src += len-1;
+                    d   += (len-1) * 2;
+
+                    RGB_TO_YCBCR( (*src >> 16) & 0xff,
+                                  (*src >>  8) & 0xff,
+                                  (*src      ) & 0xff, y, u, v );
+                    *((u16*)d) = u | (y << 8);
+               }
+               break;
+
+          case DSPF_AYUV:
+               for (i = 0; i < len; i++) {
+                    u32 a, y, u, v;
+
+                    RGB_TO_YCBCR( (src[i] >> 16) & 0xff,
+                                  (src[i] >>  8) & 0xff,
+                                  (src[i]      ) & 0xff, y, u, v );
+                    a = (src[i] >> 24) & 0xff;
+
+                    ((u32*)d)[i] = PIXEL_AYUV( a, y, u, v );
+               }
+               break;
+
+          case DSPF_YV12:
+          case DSPF_I420:
+               d1 = dst[1];
+               d2 = dst[2];
+               for (i = 0; i < (len-1); i += 2) {
+                    u32 y0, u0, v0;
+                    u32 y1, u1, v1;
+
+                    RGB_TO_YCBCR( (src[i+0] >> 16) & 0xff,
+                                  (src[i+0] >>  8) & 0xff,
+                                  (src[i+0]      ) & 0xff, y0, u0, v0 );
+                    RGB_TO_YCBCR( (src[i+1] >> 16) & 0xff,
+                                  (src[i+1] >>  8) & 0xff,
+                                  (src[i+1]      ) & 0xff, y1, u1, v1 );
+
+                    d[i+0] = y0;
+                    d[i+1] = y1;
+
+                    if (dy & 1) {
+                         d1[i>>1] = (u0 + u1) >> 1;
+                         d2[i>>1] = (v0 + v1) >> 1;
+                    }
+               }
+               if (len & 1) {
+                    u32 y, u, v;
+
+                    i = len-1;
+
+                    RGB_TO_YCBCR( (src[i] >> 16) & 0xff,
+                                  (src[i] >>  8) & 0xff,
+                                  (src[i]      ) & 0xff, y, u, v );
+
+                    d[i] = y;
+                    if (dy & 1) {
+                         d1[i>>1] = u;
+                         d2[i>>1] = v;
+                    }
+               }
+               break;
+
+          case DSPF_NV12:
+          case DSPF_NV16:
+               d1 = dst[1];
+               for (i = 0; i < (len-1); i += 2) {
+                    u32 y0, u0, v0;
+                    u32 y1, u1, v1;
+
+                    RGB_TO_YCBCR( (src[i+0] >> 16) & 0xff,
+                                  (src[i+0] >>  8) & 0xff,
+                                  (src[i+0]      ) & 0xff, y0, u0, v0 );
+                    RGB_TO_YCBCR( (src[i+1] >> 16) & 0xff,
+                                  (src[i+1] >>  8) & 0xff,
+                                  (src[i+1]      ) & 0xff, y1, u1, v1 );
+
+                    d[i+0] = y0;
+                    d[i+1] = y1;
+
+                    if (dst_surface->config.format == DSPF_NV16 || dy & 1) {
+#ifdef WORDS_BIGENDIAN
+                         ((u16*)d1)[i>>1] =    ((v0 + v1) >> 1)     |
+                                              (((u0 + u1) >> 1) << 8);
+#else
+                         ((u16*)d1)[i>>1] =    ((u0 + u1) >> 1)     |
+                                              (((v0 + v1) >> 1) << 8);
+#endif
+                    }
+               }
+               if (len & 1) {
+                    u32 y, u, v;
+
+                    i = len-1;
+
+                    RGB_TO_YCBCR( (src[i] >> 16) & 0xff,
+                                  (src[i] >>  8) & 0xff,
+                                  (src[i]      ) & 0xff, y, u, v );
+
+                    d[i] = y;
+                    if (dst_surface->config.format == DSPF_NV16 || dy & 1)
+#ifdef WORDS_BIGENDIAN
+                         ((u16*)d1)[i>>1] = v | (u << 8);
+#else
+                         ((u16*)d1)[i>>1] = u | (v << 8);
+#endif
+               }
+               break;
+
+          case DSPF_NV21:
+               d1 = dst[1];
+               for (i = 0; i < (len-1); i += 2) {
+                    u32 y0, u0, v0;
+                    u32 y1, u1, v1;
+
+                    RGB_TO_YCBCR( (src[i+0] >> 16) & 0xff,
+                                  (src[i+0] >>  8) & 0xff,
+                                  (src[i+0]      ) & 0xff, y0, u0, v0 );
+                    RGB_TO_YCBCR( (src[i+1] >> 16) & 0xff,
+                                  (src[i+1] >>  8) & 0xff,
+                                  (src[i+1]      ) & 0xff, y1, u1, v1 );
+
+                    d[i+0] = y0;
+                    d[i+1] = y1;
+
+                    if (dy & 1) {
+#ifdef WORDS_BIGENDIAN
+                         ((u16*)d1)[i>>1] =    ((u0 + u1) >> 1)     |
+                                              (((v0 + v1) >> 1) << 8);
+#else
+                         ((u16*)d1)[i>>1] =    ((v0 + v1) >> 1)     |
+                                              (((u0 + u1) >> 1) << 8);
+#endif
+                    }
+               }
+               if (len & 1) {
+                    u32 y, u, v;
+
+                    i = len-1;
+
+                    RGB_TO_YCBCR( (src[i] >> 16) & 0xff,
+                                  (src[i] >>  8) & 0xff,
+                                  (src[i]      ) & 0xff, y, u, v );
+
+                    d[i] = y;
+                    if (dy & 1)
+#ifdef WORDS_BIGENDIAN
+                         ((u16*)d1)[i>>1] = u | (v << 8);
+#else
+                         ((u16*)d1)[i>>1] = v | (u << 8);
+#endif
+               }
+               break;
+
+          case DSPF_RGB555:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_RGB555( src[i] );
+               break;
+
+          case DSPF_BGR555:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_BGR555( src[i] );
+               break;
+
+          case DSPF_RGB444:
+               for (i = 0; i < len; i++)
+                    ((u16*)d)[i] = ARGB_TO_RGB444( src[i] );
+               break;
+
+          default:
+               D_ONCE( "unimplemented destination format (0x%08x)", dst_surface->config.format );
+               break;
+     }
+}
+
+#define LINE_PTR(dst,caps,y,h,pitch) \
+     ((caps & DSCAPS_SEPARATED) \
+          ? (((u8*)(dst)) + (y)/2 * (pitch) + (((y)%2) ? (h)/2 * (pitch) : 0)) \
+          : (((u8*)(dst)) + (y) * (pitch)))
+
+void dfb_copy_buffer_32( u32 *src,
+                         void  *dst, int dpitch, DFBRectangle *drect,
+                         CoreSurface *dst_surface, const DFBRegion *dst_clip )
+{
+     void *dst1, *dst2;
+     int   sw = drect->w;
+     int   y, x;
+
+     if (dst_clip) {
+          int sx = 0, sy = 0;
+
+          if (drect->x < dst_clip->x1) {
+               sx = dst_clip->x1 - drect->x;
+               drect->w -= sx;
+               drect->x += sx;
+          }
+          if (drect->y < dst_clip->y1) {
+               sy = dst_clip->y1 - drect->y;
+               drect->h -= sy;
+               drect->y += sy;
+          }
+          if ((drect->x + drect->w - 1) > dst_clip->x2) {
+               drect->w -= drect->x + drect->w - 1 - dst_clip->x2;
+          }
+          if ((drect->y + drect->h - 1) > dst_clip->y2) {
+               drect->h -= drect->y + drect-> h - 1 - dst_clip->y2;
+          }
+
+          src += sy * sw + sx;
+     }
+
+     if (drect->w < 1 || drect->h < 1)
+          return;
+     x = drect->x;
+
+     switch (dst_surface->config.format) {
+          case DSPF_YV12:
+          case DSPF_I420:
+               if (dst_surface->config.format == DSPF_I420) {
+                    dst1 = dst  + dpitch   * dst_surface->config.size.h;
+                    dst2 = dst1 + dpitch/2 * dst_surface->config.size.h/2;
+               } else {
+                    dst2 = dst  + dpitch   * dst_surface->config.size.h;
+                    dst1 = dst2 + dpitch/2 * dst_surface->config.size.h/2;
+               }
+
+               for (y = drect->y; y < drect->y + drect->h; y++) {
+                    u8 *d[3];
+
+                    d[0] = LINE_PTR( dst, dst_surface->config.caps, y,
+                                     dst_surface->config.size.h, dpitch ) + x;
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, y/2,
+                                     dst_surface->config.size.h/2, dpitch/2 ) + x/2;
+                    d[2] = LINE_PTR( dst2, dst_surface->config.caps, y/2,
+                                     dst_surface->config.size.h/2, dpitch/2 ) + x/2;
+
+                    write_argb_span( src, d, drect->w, x, y, dst_surface );
+
+                    src += sw;
+               }
+               break;
+
+          case DSPF_NV12:
+          case DSPF_NV21:
+               dst1 = dst + dpitch * dst_surface->config.size.h;
+
+               for (y = drect->y; y < drect->y + drect->h; y++) {
+                    u8 *d[2];
+
+                    d[0] = LINE_PTR( dst, dst_surface->config.caps, y,
+                                     dst_surface->config.size.h, dpitch ) + x;
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, y/2,
+                                     dst_surface->config.size.h/2, dpitch ) + (x&~1);
+
+                    write_argb_span( src, d, drect->w, x, y, dst_surface );
+
+                    src += sw;
+               }
+               break;
+
+          case DSPF_NV16:
+               dst1 = dst + dpitch * dst_surface->config.size.h;
+
+               for (y = drect->y; y < drect->y + drect->h; y++) {
+                    u8 *d[2];
+
+                    d[0] = LINE_PTR( dst, dst_surface->config.caps, y,
+                                     dst_surface->config.size.h, dpitch ) + x;
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, y,
+                                     dst_surface->config.size.h, dpitch ) + (x&~1);
+
+                    write_argb_span( src, d, drect->w, x, y, dst_surface );
+
+                    src += sw;
+               }
+               break;
+
+          default:
+               for (y = drect->y; y < drect->y + drect->h; y++) {
+                    u8 *d[1];
+
+                    d[0] = LINE_PTR( dst, dst_surface->config.caps,
+                                     y, dst_surface->config.size.h, dpitch ) +
+                           DFB_BYTES_PER_LINE( dst_surface->config.format, x );
+
+                    write_argb_span( src, d, drect->w, x, y, dst_surface );
+
+                    src += sw;
+               }
+               break;
+     }
+}
+
+static int bilinear_make_fast_weights( PixopsFilter *filter,
+                                       const float x_scale, const float y_scale )
+{
+     int i_offset, j_offset;
+     float *x_weights, *y_weights;
+     int n_x, n_y;
+
+     if (x_scale > 1.0) {      /* Bilinear */
+          n_x = 2;
+          filter->x_offset = 0.5 * (1.0 / x_scale - 1);
+     }
+     else {                    /* Tile */
+          n_x = D_ICEIL (1.0 + 1.0 / x_scale);
+          filter->x_offset = 0.0;
+     }
+
+     if (y_scale > 1.0) {      /* Bilinear */
+          n_y = 2;
+          filter->y_offset = 0.5 * (1.0 / y_scale - 1);
+     }
+     else {                    /* Tile */
+          n_y = D_ICEIL (1.0 + 1.0 / y_scale);
+          filter->y_offset = 0.0;
+     }
+
+     if (n_x > 64)
+          n_x = 64;
+
+     if (n_y > 64)
+          n_y = 64;
+
+     filter->n_y = n_y;
+     filter->n_x = n_x;
+     filter->weights = (int *) D_MALLOC( SUBSAMPLE * SUBSAMPLE * n_x * n_y *
+                                         sizeof (int) );
+     if (!filter->weights) {
+          D_WARN ("couldn't allocate memory for scaling");
+          return 0;
+     }
+
+     x_weights = (float *) alloca (n_x * sizeof (float));
+     y_weights = (float *) alloca (n_y * sizeof (float));
+
+     if (!x_weights || !y_weights) {
+          D_FREE( filter->weights );
+
+          D_WARN ("couldn't allocate memory for scaling");
+          return 0;
+     }
+
+     for (i_offset = 0; i_offset < SUBSAMPLE; i_offset++)
+          for (j_offset = 0; j_offset < SUBSAMPLE; j_offset++) {
+               int *pixel_weights = filter->weights
+                                    + ((i_offset * SUBSAMPLE) + j_offset)
+                                    * n_x * n_y;
+
+               float x = (float)j_offset / 16;
+               float y = (float)i_offset / 16;
+               int i, j;
+
+               if (x_scale > 1.0) {     /* Bilinear */
+                    for (i = 0; i < n_x; i++) {
+                         x_weights[i] = ((i == 0) ? (1 - x) : x) / x_scale;
+                    }
+               }
+               else {                   /* Tile */
+                    for (i = 0; i < n_x; i++) {
+                         if (i < x) {
+                              if (i + 1 > x)
+                                   x_weights[i] = MIN( i + 1, x + 1.0 / x_scale ) -x;
+                              else
+                                   x_weights[i] = 0;
+                         }
+                         else {
+                              if (x + 1/x_scale > i)
+                                   x_weights[i] = MIN( i + 1, x + 1.0 / x_scale ) -i;
+                              else
+                                   x_weights[i] = 0;
+                         }
+                    }
+               }
+
+               if (y_scale > 1.0) {     /* Bilinear */
+                    for (i = 0; i < n_y; i++) {
+                         y_weights[i] = ((i == 0) ? (1 - y) : y) / y_scale;
+                    }
+               }
+               else {                   /* Tile */
+                    for (i = 0; i < n_y; i++) {
+                         if (i < y) {
+                              if (i + 1 > y)
+                                   y_weights[i] = MIN( i + 1, y + 1.0 / y_scale ) -y;
+                              else
+                                   y_weights[i] = 0;
+                         }
+                         else {
+                              if (y + 1/y_scale > i)
+                                   y_weights[i] = MIN( i + 1, y + 1.0 / y_scale ) -i;
+                              else
+                                   y_weights[i] = 0;
+                         }
+                    }
+               }
+
+               for (i = 0; i < n_y; i++) {
+                    for (j = 0; j < n_x; j++) {
+                         pixel_weights[n_x * i + j] =
+                              65536.0 * x_weights[j] * x_scale
+                              * y_weights[i] * y_scale;
+                    }
+               }
+          }
+
+     return 1;
+}
+
+static void scale_pixel( const int *weights, int n_x, int n_y,
+                         u32 *dst, const u32 **src, int x, int sw )
+{
+     u32 r = 0, g = 0, b = 0, a = 0;
+     int i, j;
+
+     for (i = 0; i < n_y; i++) {
+          const int *pixel_weights = weights + n_x * i;
+
+          for (j = 0; j < n_x; j++) {
+               const u32 *q;
+
+               if (x + j < 0)
+                    q = src[i];
+               else if (x + j < sw)
+                    q = src[i] + x + j;
+               else
+                    q = src[i] + sw - 1;
+
+               {
+                    const u32 ta = ((*q & 0xFF000000) >> 24) * pixel_weights[j];
+
+                    b += ta * (((*q & 0xFF)) + 1);
+                    g += ta * (((*q & 0xFF00) >> 8) + 1);
+                    r += ta * (((*q & 0xFF0000) >> 16) + 1);
+                    a += ta;
+               }
+          }
+     }
+
+     r = (r >> 24) == 0xFF ? 0xFF : (r + 0x800000) >> 24;
+     g = (g >> 24) == 0xFF ? 0xFF : (g + 0x800000) >> 24;
+     b = (b >> 24) == 0xFF ? 0xFF : (b + 0x800000) >> 24;
+     a = (a >> 16) == 0xFF ? 0xFF : (a + 0x8000) >> 16;
+
+     *dst = (a << 24) | (r << 16) | (g << 8) | b;
+}
+
+static u32* scale_line( const int *weights, int n_x, int n_y,
+                        u32 *dst, u32 *dst_end,
+                        const u32 **src, int x, int x_step, int sw )
+{
+     while (dst < dst_end) {
+          const int  x_scaled      = x >> SCALE_SHIFT;
+          const int *pixel_weights = weights + ((x >> (SCALE_SHIFT -
+                                                       SUBSAMPLE_BITS))
+                                                & SUBSAMPLE_MASK) * n_x * n_y;
+          u32 r = 0, g = 0, b = 0, a = 0;
+          int i, j;
+
+          for (i = 0; i < n_y; i++) {
+               const int *line_weights = pixel_weights + n_x * i;
+               const u32 *q            = src[i] + x_scaled;
+
+               for (j = 0; j < n_x; j++) {
+                    const u32 ta = ((*q & 0xFF000000) >> 24) * line_weights[j];
+
+                    b += ta * (((*q & 0xFF)) + 1);
+                    g += ta * (((*q & 0xFF00) >> 8) + 1);
+                    r += ta * (((*q & 0xFF0000) >> 16) + 1);
+                    a += ta;
+
+                    q++;
+               }
+          }
+
+          r = (r >> 24) == 0xFF ? 0xFF : (r + 0x800000) >> 24;
+          g = (g >> 24) == 0xFF ? 0xFF : (g + 0x800000) >> 24;
+          b = (b >> 24) == 0xFF ? 0xFF : (b + 0x800000) >> 24;
+          a = (a >> 16) == 0xFF ? 0xFF : (a + 0x8000) >> 16;
+
+          *dst++ = (a << 24) | (r << 16) | (g << 8) | b;
+
+          x += x_step;
+     }
+
+     return dst;
+}
+
+void dfb_scale_linear_32( u32 *src, int sw, int sh,
+                          void  *dst, int dpitch, DFBRectangle *drect,
+                          CoreSurface *dst_surface, const DFBRegion *dst_clip )
+{
+     DFBRectangle srect = { 0, 0, sw, sh };
+     float scale_x, scale_y;
+     int i, j;
+     int sx, sy;
+     int x_step, y_step;
+     int scaled_x_offset;
+     PixopsFilter filter;
+     void *dst1 = NULL, *dst2 = NULL;
+     u32  *buf;
+
+     if (drect->w == sw && drect->h == sh) {
+          dfb_copy_buffer_32( src, dst, dpitch, drect, dst_surface, dst_clip );
+          return;
+     }
+
+     if (dst_clip)
+          dfb_clip_stretchblit( dst_clip, &srect, drect );
+
+     if (srect.w < 1 || srect.h < 1 || drect->w < 1 || drect->h < 1)
+          return;
+
+     src += srect.y * sw + srect.x;
+
+     scale_x = (float)drect->w / srect.w;
+     scale_y = (float)drect->h / srect.h;
+
+     x_step = (1 << SCALE_SHIFT) / scale_x;
+     y_step = (1 << SCALE_SHIFT) / scale_y;
+
+     if (! bilinear_make_fast_weights( &filter, scale_x, scale_y ))
+          return;
+
+     scaled_x_offset = D_IFLOOR( filter.x_offset * (1 << SCALE_SHIFT) );
+     sy = D_IFLOOR( filter.y_offset * (1 << SCALE_SHIFT) );
+
+     switch (dst_surface->config.format) {
+          case DSPF_I420:
+               dst1 = dst  + dpitch   * dst_surface->config.size.h;
+               dst2 = dst1 + dpitch/2 * dst_surface->config.size.h/2;
+               break;
+          case DSPF_YV12:
+               dst2 = dst  + dpitch   * dst_surface->config.size.h;
+               dst1 = dst2 + dpitch/2 * dst_surface->config.size.h/2;
+               break;
+          case DSPF_NV12:
+          case DSPF_NV21:
+          case DSPF_NV16:
+               dst1 = dst + dpitch * dst_surface->config.size.h;
+               break;
+          default:
+               break;
+     }
+
+     buf = (u32*) alloca( drect->w * 4 );
+
+     for (i = drect->y; i < drect->y + drect->h; i++) {
+          int         x_start;
+          int         y_start;
+          const int  *run_weights;
+          u32        *outbuf     = buf;
+          u32        *outbuf_end = buf + drect->w;
+          u32        *new_outbuf;
+          const u32 **line_bufs;
+          u8         *d[3];
+
+          y_start = sy >> SCALE_SHIFT;
+
+          run_weights = filter.weights + ((sy >> (SCALE_SHIFT - SUBSAMPLE_BITS))
+                                          & SUBSAMPLE_MASK) * filter.n_x * filter.n_y * SUBSAMPLE;
+
+          line_bufs = (const u32 **) alloca( filter.n_y * sizeof (void *) );
+
+          for (j = 0; j < filter.n_y; j++) {
+               if (y_start <  0)
+                    line_bufs[j] = src;
+               else if (y_start < sh)
+                    line_bufs[j] = src + sw * y_start;
+               else
+                    line_bufs[j] = src + sw * (sh - 1);
+
+               y_start++;
+          }
+
+          sx = scaled_x_offset;
+          x_start = sx >> SCALE_SHIFT;
+
+          while (x_start < 0 && outbuf < outbuf_end) {
+               scale_pixel( run_weights + ((sx >> (SCALE_SHIFT - SUBSAMPLE_BITS))
+                                            & SUBSAMPLE_MASK) * (filter.n_x * filter.n_y),
+                            filter.n_x, filter.n_y,
+                            outbuf, line_bufs, sx >> SCALE_SHIFT, sw );
+               sx += x_step;
+               x_start = sx >> SCALE_SHIFT;
+               outbuf++;
+          }
+
+          new_outbuf = scale_line( run_weights, filter.n_x, filter.n_y,
+                                   outbuf, outbuf_end, line_bufs,
+                                   sx >> SCALE_SHIFT, x_step, sw );
+          sx = ((outbuf_end - outbuf) >> 2) * x_step + scaled_x_offset;
+          outbuf = new_outbuf;
+
+          while (outbuf < outbuf_end) {
+               scale_pixel( run_weights + ((sx >> (SCALE_SHIFT - SUBSAMPLE_BITS))
+                                            & SUBSAMPLE_MASK) * (filter.n_x * filter.n_y),
+                            filter.n_x, filter.n_y,
+                            outbuf, line_bufs, sx >> SCALE_SHIFT, sw );
+               sx += x_step;
+               outbuf++;
+          }
+
+          sy += y_step;
+
+          d[0] = LINE_PTR( dst, dst_surface->config.caps,
+                           i, dst_surface->config.size.h, dpitch ) +
+                 DFB_BYTES_PER_LINE( dst_surface->config.format, drect->x );
+
+          switch (dst_surface->config.format) {
+               case DSPF_I420:
+               case DSPF_YV12:
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, i/2,
+                                     dst_surface->config.size.h/2, dpitch/2 ) + drect->x/2;
+                    d[2] = LINE_PTR( dst2, dst_surface->config.caps, i/2,
+                                     dst_surface->config.size.h/2, dpitch/2 ) + drect->x/2;
+                    break;
+               case DSPF_NV12:
+               case DSPF_NV21:
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, i/2,
+                                     dst_surface->config.size.h/2, dpitch ) + (drect->x&~1);
+                    break;
+               case DSPF_NV16:
+                    d[1] = LINE_PTR( dst1, dst_surface->config.caps, i,
+                                     dst_surface->config.size.h, dpitch ) + (drect->x&~1);
+                    break;
+               default:
+                    break;
+          }
+
+          write_argb_span( buf, d, drect->w, drect->x, i, dst_surface );
+     }
+
+     D_FREE(filter.weights);
+}
+
diff --git a/Source/DirectFB/src/misc/gfx_util.h b/Source/DirectFB/src/misc/gfx_util.h
new file mode 100755
index 0000000..56b7944
--- /dev/null
+++ b/Source/DirectFB/src/misc/gfx_util.h
@@ -0,0 +1,48 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   Scaling routines ported from gdk_pixbuf by Sven Neumann
+   <sven@convergence.de>.
+
+   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 __GFX_UTIL_H__
+#define __GFX_UTIL_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+void dfb_copy_buffer_32( u32 *src,
+                         void  *dst, int dpitch, DFBRectangle *drect,
+                         CoreSurface *dst_surface, const DFBRegion *dst_clip );
+
+void dfb_scale_linear_32( u32 *src, int sw, int sh,
+                          void *dst, int dpitch, DFBRectangle *drect,
+                          CoreSurface *dst_surface, const DFBRegion *dst_clip );
+
+
+#endif
diff --git a/Source/DirectFB/src/misc/util.c b/Source/DirectFB/src/misc/util.c
new file mode 100755
index 0000000..7a80eec
--- /dev/null
+++ b/Source/DirectFB/src/misc/util.c
@@ -0,0 +1,471 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <fcntl.h>
+
+#include <sys/time.h>
+#include <time.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <misc/util.h>
+
+
+D_DEBUG_DOMAIN( DFB_Updates, "DirectFB/Updates", "DirectFB Updates" );
+
+/**********************************************************************************************************************/
+
+const DirectFBPixelFormatNames( dfb_pixelformat_names );
+
+/**********************************************************************************************************************/
+
+bool
+dfb_region_intersect( DFBRegion *region,
+                      int x1, int y1, int x2, int y2 )
+{
+     if (region->x2 < x1 ||
+         region->y2 < y1 ||
+         region->x1 > x2 ||
+         region->y1 > y2)
+          return false;
+
+     if (region->x1 < x1)
+          region->x1 = x1;
+
+     if (region->y1 < y1)
+          region->y1 = y1;
+
+     if (region->x2 > x2)
+          region->x2 = x2;
+
+     if (region->y2 > y2)
+          region->y2 = y2;
+
+     return true;
+}
+
+bool
+dfb_region_region_intersect( DFBRegion       *region,
+                             const DFBRegion *clip )
+{
+     if (region->x2 < clip->x1 ||
+         region->y2 < clip->y1 ||
+         region->x1 > clip->x2 ||
+         region->y1 > clip->y2)
+          return false;
+
+     if (region->x1 < clip->x1)
+          region->x1 = clip->x1;
+
+     if (region->y1 < clip->y1)
+          region->y1 = clip->y1;
+
+     if (region->x2 > clip->x2)
+          region->x2 = clip->x2;
+
+     if (region->y2 > clip->y2)
+          region->y2 = clip->y2;
+
+     return true;
+}
+
+bool
+dfb_region_rectangle_intersect( DFBRegion          *region,
+                                const DFBRectangle *rect )
+{
+     int x2 = rect->x + rect->w - 1;
+     int y2 = rect->y + rect->h - 1;
+
+     if (region->x2 < rect->x ||
+         region->y2 < rect->y ||
+         region->x1 > x2 ||
+         region->y1 > y2)
+          return false;
+
+     if (region->x1 < rect->x)
+          region->x1 = rect->x;
+
+     if (region->y1 < rect->y)
+          region->y1 = rect->y;
+
+     if (region->x2 > x2)
+          region->x2 = x2;
+
+     if (region->y2 > y2)
+          region->y2 = y2;
+
+     return true;
+}
+
+bool
+dfb_unsafe_region_intersect( DFBRegion *region,
+                             int x1, int y1, int x2, int y2 )
+{
+     if (region->x1 > region->x2) {
+          int temp = region->x1;
+          region->x1 = region->x2;
+          region->x2 = temp;
+     }
+
+     if (region->y1 > region->y2) {
+          int temp = region->y1;
+          region->y1 = region->y2;
+          region->y2 = temp;
+     }
+
+     return dfb_region_intersect( region, x1, y1, x2, y2 );
+}
+
+bool
+dfb_unsafe_region_rectangle_intersect( DFBRegion          *region,
+                                       const DFBRectangle *rect )
+{
+     if (region->x1 > region->x2) {
+          int temp = region->x1;
+          region->x1 = region->x2;
+          region->x2 = temp;
+     }
+
+     if (region->y1 > region->y2) {
+          int temp = region->y1;
+          region->y1 = region->y2;
+          region->y2 = temp;
+     }
+
+     return dfb_region_rectangle_intersect( region, rect );
+}
+
+bool
+dfb_rectangle_intersect_by_unsafe_region( DFBRectangle *rectangle,
+                                          DFBRegion    *region )
+{
+     /* validate region */
+     if (region->x1 > region->x2) {
+          int temp = region->x1;
+          region->x1 = region->x2;
+          region->x2 = temp;
+     }
+
+     if (region->y1 > region->y2) {
+          int temp = region->y1;
+          region->y1 = region->y2;
+          region->y2 = temp;
+     }
+
+     /* adjust position */
+     if (region->x1 > rectangle->x) {
+          rectangle->w -= region->x1 - rectangle->x;
+          rectangle->x = region->x1;
+     }
+
+     if (region->y1 > rectangle->y) {
+          rectangle->h -= region->y1 - rectangle->y;
+          rectangle->y = region->y1;
+     }
+
+     /* adjust size */
+     if (region->x2 < rectangle->x + rectangle->w - 1)
+        rectangle->w = region->x2 - rectangle->x + 1;
+
+     if (region->y2 < rectangle->y + rectangle->h - 1)
+        rectangle->h = region->y2 - rectangle->y + 1;
+
+     /* set size to zero if there's no intersection */
+     if (rectangle->w <= 0 || rectangle->h <= 0) {
+          rectangle->w = 0;
+          rectangle->h = 0;
+
+          return false;
+     }
+
+     return true;
+}
+
+bool
+dfb_rectangle_intersect_by_region( DFBRectangle    *rectangle,
+                                   const DFBRegion *region )
+{
+     /* adjust position */
+     if (region->x1 > rectangle->x) {
+          rectangle->w -= region->x1 - rectangle->x;
+          rectangle->x = region->x1;
+     }
+
+     if (region->y1 > rectangle->y) {
+          rectangle->h -= region->y1 - rectangle->y;
+          rectangle->y = region->y1;
+     }
+
+     /* adjust size */
+     if (region->x2 < rectangle->x + rectangle->w - 1)
+        rectangle->w = region->x2 - rectangle->x + 1;
+
+     if (region->y2 < rectangle->y + rectangle->h - 1)
+        rectangle->h = region->y2 - rectangle->y + 1;
+
+     /* set size to zero if there's no intersection */
+     if (rectangle->w <= 0 || rectangle->h <= 0) {
+          rectangle->w = 0;
+          rectangle->h = 0;
+
+          return false;
+     }
+
+     return true;
+}
+
+bool dfb_rectangle_intersect( DFBRectangle       *rectangle,
+                              const DFBRectangle *clip )
+{
+     DFBRegion region = { clip->x, clip->y,
+                          clip->x + clip->w - 1, clip->y + clip->h - 1 };
+
+     /* adjust position */
+     if (region.x1 > rectangle->x) {
+          rectangle->w -= region.x1 - rectangle->x;
+          rectangle->x = region.x1;
+     }
+
+     if (region.y1 > rectangle->y) {
+          rectangle->h -= region.y1 - rectangle->y;
+          rectangle->y = region.y1;
+     }
+
+     /* adjust size */
+     if (region.x2 < rectangle->x + rectangle->w - 1)
+          rectangle->w = region.x2 - rectangle->x + 1;
+
+     if (region.y2 < rectangle->y + rectangle->h - 1)
+          rectangle->h = region.y2 - rectangle->y + 1;
+
+     /* set size to zero if there's no intersection */
+     if (rectangle->w <= 0 || rectangle->h <= 0) {
+          rectangle->w = 0;
+          rectangle->h = 0;
+
+          return false;
+     }
+
+     return true;
+}
+
+void dfb_rectangle_union ( DFBRectangle       *rect1,
+                           const DFBRectangle *rect2 )
+{
+     if (!rect2->w || !rect2->h)
+          return;
+
+     /* FIXME: OPTIMIZE */
+
+     if (rect1->w) {
+          int temp = MIN (rect1->x, rect2->x);
+          rect1->w = MAX (rect1->x + rect1->w, rect2->x + rect2->w) - temp;
+          rect1->x = temp;
+     }
+     else {
+          rect1->x = rect2->x;
+          rect1->w = rect2->w;
+     }
+
+     if (rect1->h) {
+          int temp = MIN (rect1->y, rect2->y);
+          rect1->h = MAX (rect1->y + rect1->h, rect2->y + rect2->h) - temp;
+          rect1->y = temp;
+     }
+     else {
+          rect1->y = rect2->y;
+          rect1->h = rect2->h;
+     }
+}
+
+void
+dfb_updates_init( DFBUpdates *updates,
+                  DFBRegion  *regions,
+                  int         max_regions )
+{
+     D_ASSERT( updates != NULL );
+     D_ASSERT( regions != NULL );
+     D_ASSERT( max_regions > 0 );
+
+     updates->regions     = regions;
+     updates->max_regions = max_regions;
+     updates->num_regions = 0;
+
+     D_MAGIC_SET( updates, DFBUpdates );
+}
+
+void
+dfb_updates_add( DFBUpdates      *updates,
+                 const DFBRegion *region )
+{
+     int i;
+
+     D_MAGIC_ASSERT( updates, DFBUpdates );
+     DFB_REGION_ASSERT( region );
+     D_ASSERT( updates->regions != NULL );
+     D_ASSERT( updates->num_regions >= 0 );
+     D_ASSERT( updates->num_regions <= updates->max_regions );
+
+     D_DEBUG_AT( DFB_Updates, "%s( %p, %4d,%4d-%4dx%4d )\n", __FUNCTION__, updates,
+                 DFB_RECTANGLE_VALS_FROM_REGION(region) );
+
+     if (updates->num_regions == 0) {
+          D_DEBUG_AT( DFB_Updates, "  -> added as first\n" );
+
+          updates->regions[0]  = updates->bounding = *region;
+          updates->num_regions = 1;
+
+          return;
+     }
+
+     for (i=0; i<updates->num_regions; i++) {
+          if (dfb_region_region_extends( &updates->regions[i], region ) ||
+              dfb_region_region_intersects( &updates->regions[i], region ))
+          {
+               D_DEBUG_AT( DFB_Updates, "  -> combined with [%d] %4d,%4d-%4dx%4d\n", i,
+                           DFB_RECTANGLE_VALS_FROM_REGION(&updates->regions[i]) );
+
+               dfb_region_region_union( &updates->regions[i], region );
+
+               dfb_region_region_union( &updates->bounding, region );
+
+               D_DEBUG_AT( DFB_Updates, "  -> resulting in  [%d] %4d,%4d-%4dx%4d\n", i,
+                           DFB_RECTANGLE_VALS_FROM_REGION(&updates->regions[i]) );
+
+               return;
+          }
+     }
+
+     if (updates->num_regions == updates->max_regions) {
+          dfb_region_region_union( &updates->bounding, region );
+
+          updates->regions[0]  = updates->bounding;
+          updates->num_regions = 1;
+
+          D_DEBUG_AT( DFB_Updates, "  -> collapsing to [0] %4d,%4d-%4dx%4d\n",
+                      DFB_RECTANGLE_VALS_FROM_REGION(&updates->regions[0]) );
+     }
+     else {
+          updates->regions[updates->num_regions++] = *region;
+
+          dfb_region_region_union( &updates->bounding, region );
+
+          D_DEBUG_AT( DFB_Updates, "  -> added as      [%d] %4d,%4d-%4dx%4d\n", updates->num_regions - 1,
+                      DFB_RECTANGLE_VALS_FROM_REGION(&updates->regions[updates->num_regions - 1]) );
+     }
+}
+
+void
+dfb_updates_stat( DFBUpdates *updates,
+                  int        *ret_total,
+                  int        *ret_bounding )
+{
+     int i;
+
+     D_MAGIC_ASSERT( updates, DFBUpdates );
+     D_ASSERT( updates->regions != NULL );
+     D_ASSERT( updates->num_regions >= 0 );
+     D_ASSERT( updates->num_regions <= updates->max_regions );
+
+     if (updates->num_regions == 0) {
+          if (ret_total)
+               *ret_total = 0;
+
+          if (ret_bounding)
+               *ret_bounding = 0;
+
+          return;
+     }
+
+     if (ret_total) {
+          int total = 0;
+
+          for (i=0; i<updates->num_regions; i++) {
+               const DFBRegion *r = &updates->regions[i];
+
+               total += (r->x2 - r->x1 + 1) * (r->y2 - r->y1 + 1);
+          }
+
+          *ret_total = total;
+     }
+
+     if (ret_bounding)
+          *ret_bounding = (updates->bounding.x2 - updates->bounding.x1 + 1) *
+                          (updates->bounding.y2 - updates->bounding.y1 + 1);
+}
+
+void
+dfb_updates_get_rectangles( DFBUpdates   *updates,
+                            DFBRectangle *ret_rects,
+                            int          *ret_num )
+{
+     D_MAGIC_ASSERT( updates, DFBUpdates );
+     D_ASSERT( updates->regions != NULL );
+     D_ASSERT( updates->num_regions >= 0 );
+     D_ASSERT( updates->num_regions <= updates->max_regions );
+
+     switch (updates->num_regions) {
+          case 0:
+               *ret_num = 0;
+               break;
+
+          default: {
+               int n, d, total, bounding;
+
+               dfb_updates_stat( updates, &total, &bounding );
+
+               n = updates->max_regions - updates->num_regions + 1;
+               d = n + 1;
+
+               /* Try to optimize updates. Use individual regions only if not too much overhead. */
+               if (total < bounding * n / d) {
+                    *ret_num = updates->num_regions;
+
+                    for (n=0; n<updates->num_regions; n++)
+                         ret_rects[n] = DFB_RECTANGLE_INIT_FROM_REGION( &updates->regions[n] );
+
+                    break;
+               }
+          }
+          /* fall through */
+
+          case 1:
+               *ret_num   = 1;
+               *ret_rects = DFB_RECTANGLE_INIT_FROM_REGION( &updates->bounding );
+               break;
+     }
+}
diff --git a/Source/DirectFB/src/misc/util.h b/Source/DirectFB/src/misc/util.h
new file mode 100755
index 0000000..3d2d8e6
--- /dev/null
+++ b/Source/DirectFB/src/misc/util.h
@@ -0,0 +1,34 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __MISC__UTIL_H__
+#define __MISC__UTIL_H__
+
+#include <directfb_util.h>
+
+#endif
diff --git a/Source/DirectFB/src/windows/Makefile.am b/Source/DirectFB/src/windows/Makefile.am
new file mode 100755
index 0000000..572dc27
--- /dev/null
+++ b/Source/DirectFB/src/windows/Makefile.am
@@ -0,0 +1,20 @@
+## Makefile.am for DirectFB/src/windows
+
+INCLUDES = \
+	-I$(top_builddir)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/windows
+
+internalinclude_HEADERS = \
+	idirectfbwindow.h
+
+
+noinst_LTLIBRARIES = libdirectfb_windows.la
+
+libdirectfb_windows_la_SOURCES = \
+	idirectfbwindow.c
diff --git a/Source/DirectFB/src/windows/Makefile.in b/Source/DirectFB/src/windows/Makefile.in
new file mode 100755
index 0000000..23e44b9
--- /dev/null
+++ b/Source/DirectFB/src/windows/Makefile.in
@@ -0,0 +1,552 @@
+# 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@
+subdir = src/windows
+DIST_COMMON = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdirectfb_windows_la_LIBADD =
+am_libdirectfb_windows_la_OBJECTS = idirectfbwindow.lo
+libdirectfb_windows_la_OBJECTS = $(am_libdirectfb_windows_la_OBJECTS)
+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_windows_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_windows_la_SOURCES)
+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)$(internalincludedir)"
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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)/lib		\
+	-I$(top_builddir)/include	\
+	-I$(top_srcdir)/include		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/windows
+internalinclude_HEADERS = \
+	idirectfbwindow.h
+
+noinst_LTLIBRARIES = libdirectfb_windows.la
+libdirectfb_windows_la_SOURCES = \
+	idirectfbwindow.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/windows/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/windows/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_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_windows.la: $(libdirectfb_windows_la_OBJECTS) $(libdirectfb_windows_la_DEPENDENCIES) 
+	$(LINK)  $(libdirectfb_windows_la_OBJECTS) $(libdirectfb_windows_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idirectfbwindow.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-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	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-internalincludeHEADERS
+
+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-internalincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS 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-internalincludeHEADERS
+
+# 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/src/windows/idirectfbwindow.c b/Source/DirectFB/src/windows/idirectfbwindow.c
new file mode 100755
index 0000000..d3fb281
--- /dev/null
+++ b/Source/DirectFB/src/windows/idirectfbwindow.c
@@ -0,0 +1,1446 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sched.h>
+
+#include <sys/time.h>
+#include <errno.h>
+
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <idirectfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/windows.h>
+#include <core/wm.h>
+#include <core/windowstack.h>
+#include <core/windows_internal.h> /* FIXME */
+
+#include <display/idirectfbsurface.h>
+#include <display/idirectfbsurface_window.h>
+
+#include <input/idirectfbinputbuffer.h>
+
+#include <misc/util.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+
+#include <gfx/convert.h>
+
+#include <windows/idirectfbwindow.h>
+
+
+D_DEBUG_DOMAIN( IDirectFB_Window, "IDirectFBWindow", "DirectFB Window Interface" );
+
+
+/*
+ * adds an window event to the event queue
+ */
+static ReactionResult IDirectFBWindow_React( const void *msg_data,
+                                             void       *ctx );
+
+
+
+typedef struct {
+     int                ref;
+     CoreWindow        *window;
+     CoreLayer         *layer;
+
+     IDirectFBSurface  *surface;
+
+     Reaction           reaction;
+
+     bool               detached;
+     bool               destroyed;
+
+     CoreDFB           *core;
+} IDirectFBWindow_data;
+
+
+static void
+IDirectFBWindow_Destruct( IDirectFBWindow *thiz )
+{
+     IDirectFBWindow_data *data = (IDirectFBWindow_data*)thiz->priv;
+
+     D_DEBUG_AT( IDirectFB_Window, "IDirectFBWindow_Destruct()\n" );
+
+     if (!data->detached) {
+          D_DEBUG_AT( IDirectFB_Window, "  -> detaching...\n" );
+
+          dfb_window_detach( data->window, &data->reaction );
+     }
+
+     /* this will destroy the fusion object and (eventually) the window */
+     D_DEBUG_AT( IDirectFB_Window, "  -> unrefing...\n" );
+
+     dfb_window_unref( data->window );
+
+     D_DEBUG_AT( IDirectFB_Window, "  -> releasing surface...\n" );
+
+     if (data->surface)
+          data->surface->Release( data->surface );
+
+     D_DEBUG_AT( IDirectFB_Window, "  -> done.\n" );
+
+     DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+static DirectResult
+IDirectFBWindow_AddRef( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     data->ref++;
+
+     return DFB_OK;
+}
+
+static DirectResult
+IDirectFBWindow_Release( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (--data->ref == 0)
+          IDirectFBWindow_Destruct( thiz );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_CreateEventBuffer( IDirectFBWindow       *thiz,
+                                   IDirectFBEventBuffer **buffer )
+{
+     IDirectFBEventBuffer *b;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     DIRECT_ALLOCATE_INTERFACE( b, IDirectFBEventBuffer );
+
+     IDirectFBEventBuffer_Construct( b, NULL, NULL );
+
+     IDirectFBEventBuffer_AttachWindow( b, data->window );
+
+     dfb_window_send_configuration( data->window );
+
+     *buffer = b;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_AttachEventBuffer( IDirectFBWindow       *thiz,
+                                   IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     IDirectFBEventBuffer_AttachWindow( buffer, data->window );
+
+     dfb_window_send_configuration( data->window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_DetachEventBuffer( IDirectFBWindow       *thiz,
+                                   IDirectFBEventBuffer  *buffer )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     return IDirectFBEventBuffer_DetachWindow( buffer, data->window );
+}
+
+static DFBResult
+IDirectFBWindow_EnableEvents( IDirectFBWindow       *thiz,
+                              DFBWindowEventType     mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (mask & ~DWET_ALL)
+          return DFB_INVARG;
+
+     return dfb_window_change_events( data->window, DWET_NONE, mask );
+}
+
+static DFBResult
+IDirectFBWindow_DisableEvents( IDirectFBWindow       *thiz,
+                               DFBWindowEventType     mask )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (mask & ~DWET_ALL)
+          return DFB_INVARG;
+
+     return dfb_window_change_events( data->window, mask, DWET_NONE );
+}
+
+static DFBResult
+IDirectFBWindow_GetID( IDirectFBWindow *thiz,
+                       DFBWindowID     *id )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!id)
+          return DFB_INVARG;
+
+     *id = data->window->id;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_GetPosition( IDirectFBWindow *thiz,
+                             int             *x,
+                             int             *y )
+{
+     DFBInsets insets;
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!x && !y)
+          return DFB_INVARG;
+
+     dfb_windowstack_lock( data->window->stack );
+     dfb_wm_get_insets( data->window->stack, data->window, &insets );
+     dfb_windowstack_unlock( data->window->stack );
+
+     if (x)
+          *x = data->window->config.bounds.x-insets.l;
+
+     if (y)
+          *y = data->window->config.bounds.y-insets.t;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_GetSize( IDirectFBWindow *thiz,
+                         int             *width,
+                         int             *height )
+{
+     DFBInsets insets;
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!width && !height)
+          return DFB_INVARG;
+
+     dfb_windowstack_lock( data->window->stack );
+     dfb_wm_get_insets( data->window->stack, data->window, &insets );
+     dfb_windowstack_unlock( data->window->stack );
+
+     if (width)
+          *width = data->window->config.bounds.w-insets.l-insets.r;
+
+     if (height)
+          *height = data->window->config.bounds.h-insets.t-insets.b;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_GetSurface( IDirectFBWindow   *thiz,
+                            IDirectFBSurface **surface )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!surface)
+          return DFB_INVARG;
+
+     if (data->window->caps & (DWCAPS_INPUTONLY | DWCAPS_COLOR))
+          return DFB_UNSUPPORTED;
+
+     if (!data->surface) {
+          DFBResult ret;
+
+          DIRECT_ALLOCATE_INTERFACE( *surface, IDirectFBSurface );
+
+          ret = IDirectFBSurface_Window_Construct( *surface, NULL,
+                                                   NULL, NULL, data->window,
+                                                   DSCAPS_DOUBLE, data->core );
+          if (ret)
+               return ret;
+
+          data->surface = *surface;
+     }
+     else
+          *surface = data->surface;
+
+     data->surface->AddRef( data->surface );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetProperty( IDirectFBWindow   *thiz,
+                             const char        *key,
+                             void              *value,
+                             void            **old_value )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     /* Check arguments */
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     dfb_windowstack_lock( data->window->stack );
+     ret = dfb_wm_set_window_property( data->window->stack, data->window, key, value, old_value );
+     dfb_windowstack_unlock( data->window->stack );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_GetProperty( IDirectFBWindow  *thiz,
+                             const char       *key,
+                             void            **ret_value )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     if (!ret_value)
+          return DFB_INVARG;
+
+     dfb_windowstack_lock( data->window->stack );
+     ret = dfb_wm_get_window_property( data->window->stack, data->window, key, ret_value );
+     dfb_windowstack_unlock( data->window->stack );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_RemoveProperty( IDirectFBWindow  *thiz,
+                                const char       *key,
+                                void            **ret_value )
+{
+     DFBResult ret;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!key)
+          return DFB_INVARG;
+
+     dfb_windowstack_lock( data->window->stack );
+     ret = dfb_wm_remove_window_property( data->window->stack, data->window, key, ret_value );
+     dfb_windowstack_unlock( data->window->stack );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_SetOptions( IDirectFBWindow  *thiz,
+                            DFBWindowOptions  options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     /* Check arguments */
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (options & ~DWOP_ALL)
+          return DFB_INVARG;
+
+     if (!(data->window->caps & DWCAPS_ALPHACHANNEL))
+          options &= ~DWOP_ALPHACHANNEL;
+
+     /* Set new options */
+     return dfb_window_change_options( data->window, DWOP_ALL, options );
+}
+
+static DFBResult
+IDirectFBWindow_GetOptions( IDirectFBWindow  *thiz,
+                            DFBWindowOptions *ret_options )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!ret_options)
+          return DFB_INVARG;
+
+     *ret_options = data->window->config.options;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetColor( IDirectFBWindow *thiz,
+                          u8               r,
+                          u8               g,
+                          u8               b,
+                          u8               a )
+{
+     DFBColor color = { a: a, r: r, g: g, b: b };
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!(data->window->caps & DWCAPS_COLOR))
+          return DFB_UNSUPPORTED;
+
+     dfb_window_set_color( data->window, color );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetColorKey( IDirectFBWindow *thiz,
+                             u8               r,
+                             u8               g,
+                             u8               b )
+{
+     u32          key;
+     CoreSurface *surface;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (data->window->caps & DWCAPS_INPUTONLY)
+          return DFB_UNSUPPORTED;
+
+     surface = data->window->surface;
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format ))
+          key = dfb_palette_search( surface->palette, r, g, b, 0x80 );
+     else
+          key = dfb_color_to_pixel( surface->config.format, r, g, b );
+
+     return dfb_window_set_colorkey( data->window, key );
+}
+
+static DFBResult
+IDirectFBWindow_SetColorKeyIndex( IDirectFBWindow *thiz,
+                                  unsigned int     index )
+{
+     u32 key = index;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (data->window->caps & DWCAPS_INPUTONLY)
+          return DFB_UNSUPPORTED;
+
+     return dfb_window_set_colorkey( data->window, key );
+}
+
+static DFBResult
+IDirectFBWindow_SetOpaqueRegion( IDirectFBWindow *thiz,
+                                 int              x1,
+                                 int              y1,
+                                 int              x2,
+                                 int              y2 )
+{
+     DFBRegion region;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (x1 > x2 || y1 > y2)
+          return DFB_INVAREA;
+
+     region = (DFBRegion) { x1, y1, x2, y2 };
+
+     return dfb_window_set_opaque( data->window, ®ion );
+}
+
+static DFBResult
+IDirectFBWindow_SetOpacity( IDirectFBWindow *thiz,
+                            u8               opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_set_opacity( data->window, opacity );
+}
+
+static DFBResult
+IDirectFBWindow_GetOpacity( IDirectFBWindow *thiz,
+                            u8              *opacity )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!opacity)
+          return DFB_INVARG;
+
+     *opacity = data->window->config.opacity;
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetCursorShape( IDirectFBWindow  *thiz,
+                                IDirectFBSurface *shape,
+                                int               hot_x,
+                                int               hot_y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (shape) {
+          IDirectFBSurface_data *shape_data;
+          CoreSurface           *shape_surface;
+
+          shape_data = (IDirectFBSurface_data*) shape->priv;
+          if (!shape_data)
+               return DFB_DEAD;
+
+          shape_surface = shape_data->surface;
+          if (!shape_surface)
+               return DFB_DESTROYED;
+
+          return dfb_window_set_cursor_shape( data->window, shape_surface, hot_x, hot_y );
+     }
+
+     return dfb_window_set_cursor_shape( data->window, NULL, 0, 0 );
+}
+
+static DFBResult
+IDirectFBWindow_RequestFocus( IDirectFBWindow *thiz )
+{
+     CoreWindow *window;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     window = data->window;
+
+     if (window->config.options & DWOP_GHOST)
+          return DFB_UNSUPPORTED;
+
+     if (!window->config.opacity && !(window->caps & DWCAPS_INPUTONLY))
+          return DFB_UNSUPPORTED;
+
+     return dfb_window_request_focus( window );
+}
+
+static DFBResult
+IDirectFBWindow_GrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_KEYBOARD, true );
+}
+
+static DFBResult
+IDirectFBWindow_UngrabKeyboard( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_KEYBOARD, false );
+}
+
+static DFBResult
+IDirectFBWindow_GrabPointer( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_POINTER, true );
+}
+
+static DFBResult
+IDirectFBWindow_UngrabPointer( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_POINTER, false );
+}
+
+static DFBResult
+IDirectFBWindow_GrabKey( IDirectFBWindow            *thiz,
+                         DFBInputDeviceKeySymbol     symbol,
+                         DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_grab_key( data->window, symbol, modifiers );
+}
+
+static DFBResult
+IDirectFBWindow_UngrabKey( IDirectFBWindow            *thiz,
+                           DFBInputDeviceKeySymbol     symbol,
+                           DFBInputDeviceModifierMask  modifiers )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_ungrab_key( data->window, symbol, modifiers );
+}
+
+static DFBResult
+IDirectFBWindow_Move( IDirectFBWindow *thiz, int dx, int dy )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (dx == 0  &&  dy == 0)
+          return DFB_OK;
+
+     return dfb_window_move( data->window, dx, dy, true );
+}
+
+static DFBResult
+IDirectFBWindow_MoveTo( IDirectFBWindow *thiz, int x, int y )
+{
+     DFBResult ret;
+     DFBInsets insets;
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     dfb_windowstack_lock( data->window->stack );
+
+     dfb_wm_get_insets( data->window->stack, data->window, &insets );
+     x += insets.l;
+     y += insets.t;
+
+     ret = dfb_window_move( data->window, x, y, false );
+
+     dfb_windowstack_unlock( data->window->stack );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Resize( IDirectFBWindow *thiz,
+                        int              width,
+                        int              height )
+{
+     DFBResult ret;
+     DFBInsets insets;
+     
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (width < 1 || width > 4096 || height < 1 || height > 4096)
+          return DFB_INVARG;
+     
+     dfb_windowstack_lock( data->window->stack );
+
+     dfb_wm_get_insets( data->window->stack, data->window, &insets );
+     width  += insets.l+insets.r;
+     height += insets.t+insets.b;
+
+     ret = dfb_window_resize( data->window, width, height );
+
+     dfb_windowstack_unlock( data->window->stack );
+
+     return ret;
+}
+
+static DFBResult
+IDirectFBWindow_Raise( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_raise( data->window );
+}
+
+static DFBResult
+IDirectFBWindow_SetStackingClass( IDirectFBWindow        *thiz,
+                                  DFBWindowStackingClass  stacking_class )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     switch (stacking_class) {
+          case DWSC_MIDDLE:
+          case DWSC_UPPER:
+          case DWSC_LOWER:
+               break;
+          default:
+               return DFB_INVARG;
+     }
+
+     return dfb_window_change_stacking( data->window, stacking_class );
+}
+
+static DFBResult
+IDirectFBWindow_Lower( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_lower( data->window );
+}
+
+static DFBResult
+IDirectFBWindow_RaiseToTop( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_raisetotop( data->window );
+}
+
+static DFBResult
+IDirectFBWindow_LowerToBottom( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_lowertobottom( data->window );
+}
+
+static DFBResult
+IDirectFBWindow_PutAtop( IDirectFBWindow *thiz,
+                         IDirectFBWindow *lower )
+{
+     IDirectFBWindow_data *lower_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!lower)
+          return DFB_INVARG;
+
+     lower_data = (IDirectFBWindow_data*) lower->priv;
+     if (!lower_data)
+          return DFB_DEAD;
+
+     if (!lower_data->window)
+          return DFB_DESTROYED;
+
+     return dfb_window_putatop( data->window, lower_data->window );
+}
+
+static DFBResult
+IDirectFBWindow_PutBelow( IDirectFBWindow *thiz,
+                           IDirectFBWindow *upper )
+{
+     IDirectFBWindow_data *upper_data;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (!upper)
+          return DFB_INVARG;
+
+     upper_data = (IDirectFBWindow_data*) upper->priv;
+     if (!upper_data)
+          return DFB_DEAD;
+
+     if (!upper_data->window)
+          return DFB_DESTROYED;
+
+     return dfb_window_putbelow( data->window, upper_data->window );
+}
+
+static DFBResult
+IDirectFBWindow_Close( IDirectFBWindow *thiz )
+{
+     DFBWindowEvent evt;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     evt.type = DWET_CLOSE;
+
+     dfb_window_post_event( data->window, &evt );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_Destroy( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     D_DEBUG_AT( IDirectFB_Window, "IDirectFBWindow_Destroy()\n" );
+
+     dfb_window_destroy( data->window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetBounds( IDirectFBWindow *thiz,
+                           int              x,
+                           int              y,
+                           int              width,
+                           int              height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     D_DEBUG_AT( IDirectFB_Window, "IDirectFBWindow_SetBounds( %d, %d - %dx%d )\n", x, y, width, height );
+
+     return dfb_window_set_bounds( data->window, x, y, width, height );
+}
+
+static DFBResult
+IDirectFBWindow_ResizeSurface( IDirectFBWindow *thiz,
+                               int              width,
+                               int              height )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (width < 1 || width > 4096 || height < 1 || height > 4096)
+          return DFB_INVARG;
+
+     return dfb_surface_reformat( data->window->surface, width, height, data->window->surface->config.format );
+}
+
+static DFBResult
+IDirectFBWindow_SetKeySelection( IDirectFBWindow               *thiz,
+                                 DFBWindowKeySelection          selection,
+                                 const DFBInputDeviceKeySymbol *keys,
+                                 unsigned int                   num_keys )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     /* What a lovely switch */
+     switch (selection) {
+         case DWKS_ALL:
+         case DWKS_NONE:
+             break;
+         case DWKS_LIST:
+             if (!keys || num_keys == 0)
+         default:
+                 return DFB_INVARG;
+     }
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_set_key_selection( data->window, selection, keys, num_keys );
+}
+
+static DFBResult
+IDirectFBWindow_GrabUnselectedKeys( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_UNSELECTED_KEYS, true );
+}
+
+static DFBResult
+IDirectFBWindow_UngrabUnselectedKeys( IDirectFBWindow *thiz )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_change_grab( data->window, CWMGT_UNSELECTED_KEYS, false );
+}
+
+static DFBResult
+IDirectFBWindow_Bind( IDirectFBWindow *thiz,
+                      IDirectFBWindow *source,
+                      int              x,
+                      int              y )
+{
+     IDirectFBWindow_data *source_data;
+ 
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(source, source_data, IDirectFBWindow);
+
+     if (source_data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_bind( data->window, source_data->window, x, y );
+}
+
+static DFBResult
+IDirectFBWindow_Unbind( IDirectFBWindow *thiz,
+                        IDirectFBWindow *source )
+{
+     IDirectFBWindow_data *source_data;
+ 
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     DIRECT_INTERFACE_GET_DATA_FROM(source, source_data, IDirectFBWindow);
+
+     if (source_data->destroyed)
+          return DFB_DESTROYED;
+
+     return dfb_window_unbind( data->window, source_data->window );
+}
+
+static DFBResult
+CheckGeometry( const DFBWindowGeometry *geometry )
+{
+     if (!geometry)
+          return DFB_INVARG;
+
+     switch (geometry->mode) {
+          case DWGM_DEFAULT:
+          case DWGM_FOLLOW:
+               break;
+
+          case DWGM_RECTANGLE:
+               if (geometry->rectangle.x < 0 ||
+                   geometry->rectangle.y < 0 ||
+                   geometry->rectangle.w < 1 ||
+                   geometry->rectangle.h < 1)
+                    return DFB_INVARG;
+               break;
+
+          case DWGM_LOCATION:
+               if (geometry->location.x < 0.0f ||
+                   geometry->location.y < 0.0f ||
+                   geometry->location.w > 1.0f ||
+                   geometry->location.h > 1.0f ||
+                   geometry->location.w <= 0.0f ||
+                   geometry->location.h <= 0.0f ||
+                   geometry->location.x + geometry->location.w > 1.0f ||
+                   geometry->location.y + geometry->location.h > 1.0f)
+                    return DFB_INVARG;
+               break;
+
+          default:
+               return DFB_INVARG;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetSrcGeometry( IDirectFBWindow         *thiz,
+                                const DFBWindowGeometry *geometry )
+{
+     DFBResult        ret;
+     CoreWindowConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     ret = CheckGeometry( geometry );
+     if (ret)
+          return ret;
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     config.src_geometry = *geometry;
+
+     return dfb_window_set_config( data->window, &config, CWCF_SRC_GEOMETRY );
+}
+
+static DFBResult
+IDirectFBWindow_SetDstGeometry( IDirectFBWindow         *thiz,
+                                const DFBWindowGeometry *geometry )
+{
+     DFBResult        ret;
+     CoreWindowConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     ret = CheckGeometry( geometry );
+     if (ret)
+          return ret;
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     config.dst_geometry = *geometry;
+
+     return dfb_window_set_config( data->window, &config, CWCF_DST_GEOMETRY );
+}
+
+static DFBResult
+IDirectFBWindow_SetRotation(IDirectFBWindow *thiz,
+                          int rotation)
+{
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     return dfb_window_set_rotation( data->window, rotation % 360 );     
+}
+
+static DFBResult
+IDirectFBWindow_SetAssociation( IDirectFBWindow *thiz,
+                                DFBWindowID      window_id )
+{
+     CoreWindowConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     config.association = window_id;
+
+     return dfb_window_set_config( data->window, &config, CWCF_ASSOCIATION );
+}
+
+static DFBResult
+IDirectFBWindow_BeginUpdates( IDirectFBWindow *thiz,
+                              const DFBRegion *update )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     dfb_windowstack_lock( data->window->stack );
+
+     dfb_wm_begin_updates( data->window, update );
+
+     dfb_windowstack_unlock( data->window->stack );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SendEvent( IDirectFBWindow      *thiz,
+                           const DFBWindowEvent *event )
+{
+     DFBWindowEvent evt;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s\n", __FUNCTION__ );
+
+     if (!event)
+          return DFB_INVARG;
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     evt = *event;
+
+     dfb_window_post_event( data->window, &evt );
+
+     return DFB_OK;
+}
+
+static DFBResult
+IDirectFBWindow_SetCursorFlags( IDirectFBWindow      *thiz,
+                                DFBWindowCursorFlags  flags )
+{
+     CoreWindowConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s( 0x%04x )\n", __FUNCTION__, flags );
+
+     if (flags & ~DWCF_ALL)
+          return DFB_INVARG;
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     config.cursor_flags = flags;
+
+     return dfb_window_set_config( data->window, &config, CWCF_CURSOR_FLAGS );
+}
+
+static DFBResult
+IDirectFBWindow_SetCursorResolution( IDirectFBWindow    *thiz,
+                                     const DFBDimension *resolution )
+{
+     CoreWindowConfig config;
+
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     if (resolution)
+          D_DEBUG_AT( IDirectFB_Window, "%s( %dx%d )\n", __FUNCTION__, resolution->w, resolution->h );
+     else
+          D_DEBUG_AT( IDirectFB_Window, "%s( NULL )\n", __FUNCTION__ );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     if (resolution)
+          config.cursor_resolution = *resolution;
+     else {
+          config.cursor_resolution.w = 0;
+          config.cursor_resolution.h = 0;
+     }
+
+     return dfb_window_set_config( data->window, &config, CWCF_CURSOR_RESOLUTION );
+}
+
+static DFBResult
+IDirectFBWindow_SetCursorPosition( IDirectFBWindow    *thiz,
+                                   int                 x,
+                                   int                 y )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "%s( %d,%d )\n", __FUNCTION__, x, y );
+
+     if (data->destroyed)
+          return DFB_DESTROYED;
+
+     dfb_windowstack_lock( data->window->stack );
+
+     dfb_wm_set_cursor_position( data->window, x, y );
+
+     dfb_windowstack_unlock( data->window->stack );
+
+     return DFB_OK;
+}
+
+DFBResult
+IDirectFBWindow_Construct( IDirectFBWindow *thiz,
+                           CoreWindow      *window,
+                           CoreLayer       *layer,
+                           CoreDFB         *core )
+{
+     DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFBWindow)
+
+     D_DEBUG_AT( IDirectFB_Window, "IDirectFBWindow_Construct() <- %d, %d - %dx%d\n",
+                 DFB_RECTANGLE_VALS( &window->config.bounds ) );
+
+     data->ref    = 1;
+     data->window = window;
+     data->layer  = layer;
+     data->core   = core;
+
+     dfb_window_attach( window, IDirectFBWindow_React, data, &data->reaction );
+
+     thiz->AddRef = IDirectFBWindow_AddRef;
+     thiz->Release = IDirectFBWindow_Release;
+     thiz->CreateEventBuffer = IDirectFBWindow_CreateEventBuffer;
+     thiz->AttachEventBuffer = IDirectFBWindow_AttachEventBuffer;
+     thiz->DetachEventBuffer = IDirectFBWindow_DetachEventBuffer;
+     thiz->EnableEvents = IDirectFBWindow_EnableEvents;
+     thiz->DisableEvents = IDirectFBWindow_DisableEvents;
+     thiz->GetID = IDirectFBWindow_GetID;
+     thiz->GetPosition = IDirectFBWindow_GetPosition;
+     thiz->GetSize = IDirectFBWindow_GetSize;
+     thiz->GetSurface = IDirectFBWindow_GetSurface;
+     thiz->SetProperty = IDirectFBWindow_SetProperty;
+     thiz->GetProperty = IDirectFBWindow_GetProperty;
+     thiz->RemoveProperty = IDirectFBWindow_RemoveProperty;
+     thiz->SetOptions = IDirectFBWindow_SetOptions;
+     thiz->GetOptions = IDirectFBWindow_GetOptions;
+     thiz->SetColor = IDirectFBWindow_SetColor;
+     thiz->SetColorKey = IDirectFBWindow_SetColorKey;
+     thiz->SetColorKeyIndex = IDirectFBWindow_SetColorKeyIndex;
+     thiz->SetOpaqueRegion = IDirectFBWindow_SetOpaqueRegion;
+     thiz->SetOpacity = IDirectFBWindow_SetOpacity;
+     thiz->GetOpacity = IDirectFBWindow_GetOpacity;
+     thiz->SetCursorShape = IDirectFBWindow_SetCursorShape;
+     thiz->RequestFocus = IDirectFBWindow_RequestFocus;
+     thiz->GrabKeyboard = IDirectFBWindow_GrabKeyboard;
+     thiz->UngrabKeyboard = IDirectFBWindow_UngrabKeyboard;
+     thiz->GrabPointer = IDirectFBWindow_GrabPointer;
+     thiz->UngrabPointer = IDirectFBWindow_UngrabPointer;
+     thiz->GrabKey = IDirectFBWindow_GrabKey;
+     thiz->UngrabKey = IDirectFBWindow_UngrabKey;
+     thiz->Move = IDirectFBWindow_Move;
+     thiz->MoveTo = IDirectFBWindow_MoveTo;
+     thiz->Resize = IDirectFBWindow_Resize;
+     thiz->SetStackingClass = IDirectFBWindow_SetStackingClass;
+     thiz->Raise = IDirectFBWindow_Raise;
+     thiz->Lower = IDirectFBWindow_Lower;
+     thiz->RaiseToTop = IDirectFBWindow_RaiseToTop;
+     thiz->LowerToBottom = IDirectFBWindow_LowerToBottom;
+     thiz->PutAtop = IDirectFBWindow_PutAtop;
+     thiz->PutBelow = IDirectFBWindow_PutBelow;
+     thiz->Close = IDirectFBWindow_Close;
+     thiz->Destroy = IDirectFBWindow_Destroy;
+     thiz->SetBounds = IDirectFBWindow_SetBounds;
+     thiz->ResizeSurface = IDirectFBWindow_ResizeSurface;
+     thiz->Bind = IDirectFBWindow_Bind;
+     thiz->Unbind = IDirectFBWindow_Unbind;
+     thiz->SetKeySelection = IDirectFBWindow_SetKeySelection;
+     thiz->GrabUnselectedKeys = IDirectFBWindow_GrabUnselectedKeys;
+     thiz->UngrabUnselectedKeys = IDirectFBWindow_UngrabUnselectedKeys;
+     thiz->SetSrcGeometry = IDirectFBWindow_SetSrcGeometry;
+     thiz->SetDstGeometry = IDirectFBWindow_SetDstGeometry;
+     thiz->SetRotation = IDirectFBWindow_SetRotation;
+     thiz->SetAssociation = IDirectFBWindow_SetAssociation;
+     thiz->BeginUpdates = IDirectFBWindow_BeginUpdates;
+     thiz->SendEvent = IDirectFBWindow_SendEvent;
+     thiz->SetCursorFlags = IDirectFBWindow_SetCursorFlags;
+     thiz->SetCursorResolution = IDirectFBWindow_SetCursorResolution;
+     thiz->SetCursorPosition = IDirectFBWindow_SetCursorPosition;
+
+     return DFB_OK;
+}
+
+
+/* internals */
+
+static ReactionResult
+IDirectFBWindow_React( const void *msg_data,
+                       void       *ctx )
+{
+     const DFBWindowEvent *evt  = msg_data;
+     IDirectFBWindow_data *data = ctx;
+
+     D_DEBUG_AT( IDirectFB_Window, "%s()\n", __FUNCTION__ );
+
+     switch (evt->type) {
+          case DWET_DESTROYED:
+               D_DEBUG_AT( IDirectFB_Window, "  -> window destroyed\n" );
+               
+               data->detached = true;
+               data->destroyed = true;
+               
+               return RS_REMOVE;
+
+          case DWET_GOTFOCUS:
+          case DWET_LOSTFOCUS:
+               IDirectFB_SetAppFocus( idirectfb_singleton,
+                                      evt->type == DWET_GOTFOCUS );
+
+          default:
+               break;
+     }
+
+     return RS_OK;
+}
+
diff --git a/Source/DirectFB/src/windows/idirectfbwindow.h b/Source/DirectFB/src/windows/idirectfbwindow.h
new file mode 100755
index 0000000..29c9e6a
--- /dev/null
+++ b/Source/DirectFB/src/windows/idirectfbwindow.h
@@ -0,0 +1,44 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __IDIRECTFBWINDOW_H__
+#define __IDIRECTFBWINDOW_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+/*
+ * initializes a new window and constructs interface
+ */
+DFBResult IDirectFBWindow_Construct( IDirectFBWindow *thiz,
+                                     CoreWindow      *window,
+                                     CoreLayer       *layer,
+                                     CoreDFB         *core );
+
+#endif
diff --git a/Source/DirectFB/systems/Makefile.am b/Source/DirectFB/systems/Makefile.am
new file mode 100755
index 0000000..4137b44
--- /dev/null
+++ b/Source/DirectFB/systems/Makefile.am
@@ -0,0 +1,40 @@
+## Makefile.am for DirectFB/systems
+
+if SDL_CORE
+SDL_DIR = sdl
+else
+SDL_DIR =
+endif
+
+if OSX_CORE
+OSX_DIR = osx
+else
+OSX_DIR =
+endif
+
+if X11_CORE
+X11_DIR = x11
+else
+X11_DIR =
+endif
+
+if DEVMEM_CORE
+DEVMEM_DIR = devmem
+else
+DEVMEM_DIR =
+endif
+
+if FBDEV_CORE
+FBDEV_DIR = fbdev
+else
+FBDEV_DIR =
+endif
+
+if VNC_CORE
+VNC_DIR = vnc
+else
+VNC_DIR =
+endif
+  
+
+SUBDIRS = $(DEVMEM_DIR) $(FBDEV_DIR) $(X11_DIR) $(SDL_DIR) $(OSX_DIR) $(VNC_DIR)
diff --git a/Source/DirectFB/systems/Makefile.in b/Source/DirectFB/systems/Makefile.in
new file mode 100755
index 0000000..54c4641
--- /dev/null
+++ b/Source/DirectFB/systems/Makefile.in
@@ -0,0 +1,568 @@
+# 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@
+subdir = systems
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = devmem fbdev x11 sdl osx vnc
+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@
+@SDL_CORE_FALSE@SDL_DIR = 
+@SDL_CORE_TRUE@SDL_DIR = sdl
+@OSX_CORE_FALSE@OSX_DIR = 
+@OSX_CORE_TRUE@OSX_DIR = osx
+@X11_CORE_FALSE@X11_DIR = 
+@X11_CORE_TRUE@X11_DIR = x11
+@DEVMEM_CORE_FALSE@DEVMEM_DIR = 
+@DEVMEM_CORE_TRUE@DEVMEM_DIR = devmem
+@FBDEV_CORE_FALSE@FBDEV_DIR = 
+@FBDEV_CORE_TRUE@FBDEV_DIR = fbdev
+@VNC_CORE_FALSE@VNC_DIR = 
+@VNC_CORE_TRUE@VNC_DIR = vnc
+SUBDIRS = $(DEVMEM_DIR) $(FBDEV_DIR) $(X11_DIR) $(SDL_DIR) $(OSX_DIR) $(VNC_DIR)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  systems/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+# 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/systems/devmem/Makefile.am b/Source/DirectFB/systems/devmem/Makefile.am
new file mode 100755
index 0000000..b85d92a
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/Makefile.am
@@ -0,0 +1,40 @@
+## Makefile.am for DirectFB/systems/devmem
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/devmem
+
+internalinclude_HEADERS = \
+	devmem.h		\
+	surfacemanager.h
+
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_devmem.o
+endif
+systems_LTLIBRARIES = libdirectfb_devmem.la
+
+libdirectfb_devmem_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_devmem_la_SOURCES = \
+	devmem.c		\
+	devmem_surface_pool.c	\
+	surfacemanager.c
+
+libdirectfb_devmem_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/systems/devmem/Makefile.in b/Source/DirectFB/systems/devmem/Makefile.in
new file mode 100755
index 0000000..54985c4
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/Makefile.in
@@ -0,0 +1,628 @@
+# 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 = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/rules/libobject.make
+subdir = systems/devmem
+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)$(systemsdir)" "$(DESTDIR)$(systemsdir)" \
+	"$(DESTDIR)$(internalincludedir)"
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(systems_LTLIBRARIES)
+libdirectfb_devmem_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_devmem_la_OBJECTS = devmem.lo devmem_surface_pool.lo \
+	surfacemanager.lo
+libdirectfb_devmem_la_OBJECTS = $(am_libdirectfb_devmem_la_OBJECTS)
+libdirectfb_devmem_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_devmem_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_devmem_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_devmem_la_SOURCES)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(systems_DATA)
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+internalincludedir = $(INTERNALINCLUDEDIR)/devmem
+internalinclude_HEADERS = \
+	devmem.h		\
+	surfacemanager.h
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_devmem.o
+systems_LTLIBRARIES = libdirectfb_devmem.la
+libdirectfb_devmem_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_devmem_la_SOURCES = \
+	devmem.c		\
+	devmem_surface_pool.c	\
+	surfacemanager.c
+
+libdirectfb_devmem_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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  systems/devmem/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/devmem/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-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_devmem.la: $(libdirectfb_devmem_la_OBJECTS) $(libdirectfb_devmem_la_DEPENDENCIES) 
+	$(libdirectfb_devmem_la_LINK) -rpath $(systemsdir) $(libdirectfb_devmem_la_OBJECTS) $(libdirectfb_devmem_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devmem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devmem_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surfacemanager.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-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+install-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-systemsLTLIBRARIES \
+	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-internalincludeHEADERS install-systemsDATA \
+	install-systemsLTLIBRARIES
+
+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-internalincludeHEADERS uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-systemsLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	install-systemsDATA install-systemsLTLIBRARIES 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-internalincludeHEADERS \
+	uninstall-systemsDATA uninstall-systemsLTLIBRARIES
+
+%.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/systems/devmem/devmem.c b/Source/DirectFB/systems/devmem/devmem.c
new file mode 100755
index 0000000..9e77777
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/devmem.c
@@ -0,0 +1,374 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fcntl.h>
+#include <sys/mman.h>
+
+#include <directfb.h>
+
+#include <direct/mem.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/surface_pool.h>
+
+#include <misc/conf.h>
+
+#include "devmem.h"
+#include "surfacemanager.h"
+
+
+#include <core/core_system.h>
+
+DFB_CORE_SYSTEM( devmem )
+
+/**********************************************************************************************************************/
+
+static DevMemData *m_data;    /* FIXME: Fix Core System API to pass data in all functions. */
+
+/**********************************************************************************************************************/
+
+static DFBResult
+MapMemAndReg( DevMemData    *data,
+              unsigned long  mem_phys,
+              unsigned int   mem_length,
+              unsigned long  reg_phys,
+              unsigned int   reg_length )
+{
+     int fd;
+
+     fd = open( DEV_MEM, O_RDWR | O_SYNC );
+     if (fd < 0) {
+          D_PERROR( "System/DevMem: Opening '%s' failed!\n", DEV_MEM );
+          return DFB_INIT;
+     }
+
+     data->mem = mmap( NULL, mem_length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mem_phys );
+     if (data->mem == MAP_FAILED) {
+          D_PERROR( "System/DevMem: Mapping %d bytes at 0x%08lx via '%s' failed!\n", mem_length, mem_phys, DEV_MEM );
+          return DFB_INIT;
+     }
+
+     if (reg_phys && reg_length) {
+          data->reg = mmap( NULL, reg_length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, reg_phys );
+          if (data->reg == MAP_FAILED) {
+               D_PERROR( "System/DevMem: Mapping %d bytes at 0x%08lx via '%s' failed!\n", reg_length, reg_phys, DEV_MEM );
+               munmap( data->mem, mem_length );
+               close( fd );
+               return DFB_INIT;
+          }
+     }
+
+     close( fd );
+
+     return DFB_OK;
+}
+
+static void
+UnmapMemAndReg( DevMemData   *data,
+                unsigned int  mem_length,
+                unsigned int  reg_length )
+{
+     munmap( data->mem, mem_length );
+
+     if (reg_length)
+          munmap( (void*) data->reg, reg_length );
+}
+
+/**********************************************************************************************************************/
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_DEVMEM;
+     info->caps = CSCAPS_ACCELERATION;
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "DevMem" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **ret_data )
+{
+     DFBResult            ret;
+     DevMemData          *data;
+     DevMemDataShared    *shared;
+     FusionSHMPoolShared *pool;
+
+     D_ASSERT( m_data == NULL );
+
+     if (!dfb_config->video_phys || !dfb_config->video_length) {
+          D_ERROR( "System/DevMem: Please supply 'video-phys = 0xXXXXXXXX' and 'video-length = XXXX' options!\n" );
+          return DFB_INVARG;
+     }
+
+     if (dfb_config->mmio_phys && !dfb_config->mmio_length) {
+          D_ERROR( "System/DevMem: Please supply both 'mmio-phys = 0xXXXXXXXX' and 'mmio-length = XXXX' options or none!\n" );
+          return DFB_INVARG;
+     }
+
+     data = D_CALLOC( 1, sizeof(DevMemData) );
+     if (!data)
+          return D_OOM();
+
+     pool = dfb_core_shmpool( core );
+
+     shared = SHCALLOC( pool, 1, sizeof(DevMemDataShared) );
+     if (!shared) {
+          D_FREE( data );
+          return D_OOSHM();
+     }
+
+     shared->shmpool = pool;
+
+     data->shared = shared;
+
+     ret = MapMemAndReg( data,
+                         dfb_config->video_phys, dfb_config->video_length,
+                         dfb_config->mmio_phys,  dfb_config->mmio_length );
+     if (ret) {
+          SHFREE( pool, shared );
+          D_FREE( data );
+          return ret;
+     }
+
+
+     *ret_data = m_data = data;
+
+     dfb_surface_pool_initialize( core, &devmemSurfacePoolFuncs, &shared->pool );
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "devmem", shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **ret_data )
+{
+     DFBResult         ret;
+     void             *tmp;
+     DevMemData       *data;
+     DevMemDataShared *shared;
+
+     D_ASSERT( m_data == NULL );
+
+     if (!dfb_config->video_phys || !dfb_config->video_length) {
+          D_ERROR( "System/DevMem: Please supply 'video-phys = 0xXXXXXXXX' and 'video-length = XXXX' options!\n" );
+          return DFB_INVARG;
+     }
+
+     if (dfb_config->mmio_phys && !dfb_config->mmio_length) {
+          D_ERROR( "System/DevMem: Please supply both 'mmio-phys = 0xXXXXXXXX' and 'mmio-length = XXXX' options or none!\n" );
+          return DFB_INVARG;
+     }
+
+     data = D_CALLOC( 1, sizeof(DevMemData) );
+     if (!data)
+          return D_OOM();
+
+     ret = fusion_arena_get_shared_field( dfb_core_arena( core ), "devmem", &tmp );
+     if (ret) {
+          D_FREE( data );
+          return ret;
+     }
+
+     data->shared = shared = tmp;
+
+     ret = MapMemAndReg( data,
+                         dfb_config->video_phys, dfb_config->video_length,
+                         dfb_config->mmio_phys,  dfb_config->mmio_length );
+     if (ret) {
+          D_FREE( data );
+          return ret;
+     }
+
+     *ret_data = m_data = data;
+
+     dfb_surface_pool_join( core, shared->pool, &devmemSurfacePoolFuncs );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     DevMemDataShared *shared;
+
+     D_ASSERT( m_data != NULL );
+
+     shared = m_data->shared;
+     D_ASSERT( shared != NULL );
+
+     dfb_surface_pool_destroy( shared->pool );
+
+     UnmapMemAndReg( m_data, dfb_config->video_length, dfb_config->mmio_length );
+
+     SHFREE( shared->shmpool, shared );
+
+     D_FREE( m_data );
+     m_data = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     DevMemDataShared *shared;
+
+     D_ASSERT( m_data != NULL );
+
+     shared = m_data->shared;
+     D_ASSERT( shared != NULL );
+
+     dfb_surface_pool_leave( shared->pool );
+
+     UnmapMemAndReg( m_data, dfb_config->video_length, dfb_config->mmio_length );
+
+     D_FREE( m_data );
+     m_data = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     D_ASSERT( m_data != NULL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_resume( void )
+{
+     D_ASSERT( m_data != NULL );
+
+     return DFB_OK;
+}
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+     D_ASSERT( m_data != NULL );
+
+     return m_data->reg + offset;
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+}
+
+static int
+system_get_accelerator( void )
+{
+     return dfb_config->accelerator;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return NULL;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return NULL;
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event )
+{
+     return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return dfb_config->video_phys + offset;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     D_ASSERT( m_data != NULL );
+
+     return m_data->mem + offset;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return dfb_config->video_length;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+     return;
+}
+
diff --git a/Source/DirectFB/systems/devmem/devmem.h b/Source/DirectFB/systems/devmem/devmem.h
new file mode 100755
index 0000000..2aa8237
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/devmem.h
@@ -0,0 +1,60 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __DEVMEM_DEVMEM_H__
+#define __DEVMEM_DEVMEM_H__
+
+#include <fusion/shmalloc.h>
+
+#include <core/surface_pool.h>
+
+#include "surfacemanager.h"
+
+
+#define DEV_MEM     "/dev/mem"
+
+extern const SurfacePoolFuncs devmemSurfacePoolFuncs;
+
+
+typedef struct {
+     FusionSHMPoolShared *shmpool;
+
+     CoreSurfacePool     *pool;
+     SurfaceManager      *manager;
+} DevMemDataShared;
+
+typedef struct {
+     DevMemDataShared    *shared;
+
+     void                *mem;
+     volatile void       *reg;
+} DevMemData;
+
+
+#endif
+
diff --git a/Source/DirectFB/systems/devmem/devmem_surface_pool.c b/Source/DirectFB/systems/devmem/devmem_surface_pool.c
new file mode 100755
index 0000000..1d0b6f6
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/devmem_surface_pool.c
@@ -0,0 +1,394 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include "devmem.h"
+#include "surfacemanager.h"
+
+D_DEBUG_DOMAIN( DevMem_Surfaces, "DevMem/Surfaces", "DevMem Framebuffer Surface Pool" );
+D_DEBUG_DOMAIN( DevMem_SurfLock, "DevMem/SurfLock", "DevMem Framebuffer Surface Pool Locks" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int             magic;
+
+     SurfaceManager *manager;
+} DevMemPoolData;
+
+typedef struct {
+     int             magic;
+
+     CoreDFB        *core;
+     void           *mem;
+} DevMemPoolLocalData;
+
+typedef struct {
+     int   magic;
+
+     int   offset;
+     int   pitch;
+     int   size;
+
+     Chunk *chunk;
+} DevMemAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+devmemPoolDataSize( void )
+{
+     return sizeof(DevMemPoolData);
+}
+
+static int
+devmemPoolLocalDataSize( void )
+{
+     return sizeof(DevMemPoolLocalData);
+}
+
+static int
+devmemAllocationDataSize( void )
+{
+     return sizeof(DevMemAllocationData);
+}
+
+static DFBResult
+devmemInitPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data,
+               CoreSurfacePoolDescription *ret_desc )
+{
+     DFBResult            ret;
+     DevMemPoolData      *data   = pool_data;
+     DevMemPoolLocalData *local  = pool_local;
+     DevMemData          *devmem = system_data;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( data != NULL );
+     D_ASSERT( local != NULL );
+     D_ASSERT( devmem != NULL );
+     D_ASSERT( devmem->shared != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     ret = dfb_surfacemanager_create( core, dfb_config->video_length, &data->manager );
+     if (ret)
+          return ret;
+
+     ret_desc->caps              = CSPCAPS_PHYSICAL | CSPCAPS_VIRTUAL;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+     ret_desc->size              = dfb_config->video_length;
+
+     /* For hardware layers */
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER1] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER2] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER3] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER4] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER5] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER6] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER7] = CSAF_READ;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "/dev/mem" );
+
+     local->core = core;
+     local->mem  = devmem->mem;
+
+     D_MAGIC_SET( data, DevMemPoolData );
+     D_MAGIC_SET( local, DevMemPoolLocalData );
+
+     devmem->shared->manager = data->manager;
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemJoinPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data )
+{
+     DevMemPoolData      *data   = pool_data;
+     DevMemPoolLocalData *local  = pool_local;
+     DevMemData          *devmem = system_data;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_ASSERT( local != NULL );
+     D_ASSERT( devmem != NULL );
+     D_ASSERT( devmem->shared != NULL );
+
+     (void) data;
+
+     local->core = core;
+     local->mem  = devmem->mem;
+
+     D_MAGIC_SET( local, DevMemPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemDestroyPool( CoreSurfacePool *pool,
+                  void            *pool_data,
+                  void            *pool_local )
+{
+     DevMemPoolData      *data  = pool_data;
+     DevMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_MAGIC_ASSERT( local, DevMemPoolLocalData );
+
+     dfb_surfacemanager_destroy( data->manager );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemLeavePool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     DevMemPoolData      *data  = pool_data;
+     DevMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_MAGIC_ASSERT( local, DevMemPoolLocalData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemTestConfig( CoreSurfacePool         *pool,
+                 void                    *pool_data,
+                 void                    *pool_local,
+                 CoreSurfaceBuffer       *buffer,
+                 const CoreSurfaceConfig *config )
+{
+     DFBResult           ret;
+     CoreSurface        *surface;
+     DevMemPoolData      *data  = pool_data;
+     DevMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_MAGIC_ASSERT( local, DevMemPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (surface->type & CSTF_LAYER)
+          return DFB_OK;
+
+     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, NULL, NULL );
+
+     D_DEBUG_AT( DevMem_Surfaces, "  -> %s\n", DirectFBErrorString(ret) );
+
+     return ret;
+}
+
+static DFBResult
+devmemAllocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     DFBResult             ret;
+     Chunk                *chunk;
+     CoreSurface          *surface;
+     DevMemPoolData       *data  = pool_data;
+     DevMemPoolLocalData  *local = pool_local;
+     DevMemAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_MAGIC_ASSERT( local, DevMemPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, allocation, &chunk );
+     if (ret)
+          return ret;
+
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     alloc->offset = chunk->offset;
+     alloc->pitch  = chunk->pitch;
+     alloc->size   = chunk->length;
+
+     alloc->chunk  = chunk;
+
+     D_DEBUG_AT( DevMem_Surfaces, "  -> offset %d, pitch %d, size %d\n", alloc->offset, alloc->pitch, alloc->size );
+
+     allocation->size   = alloc->size;
+     allocation->offset = alloc->offset;
+
+     D_MAGIC_SET( alloc, DevMemAllocationData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemDeallocateBuffer( CoreSurfacePool       *pool,
+                       void                  *pool_data,
+                       void                  *pool_local,
+                       CoreSurfaceBuffer     *buffer,
+                       CoreSurfaceAllocation *allocation,
+                       void                  *alloc_data )
+{
+     DevMemPoolData       *data  = pool_data;
+     DevMemAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( DevMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, DevMemPoolData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, DevMemAllocationData );
+
+     if (alloc->chunk)
+          dfb_surfacemanager_deallocate( data->manager, alloc->chunk );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemLock( CoreSurfacePool       *pool,
+            void                  *pool_data,
+            void                  *pool_local,
+            CoreSurfaceAllocation *allocation,
+            void                  *alloc_data,
+            CoreSurfaceBufferLock *lock )
+{
+     DevMemPoolLocalData  *local = pool_local;
+     DevMemAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, DevMemAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( DevMem_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     lock->pitch  = alloc->pitch;
+     lock->offset = alloc->offset;
+     lock->addr   = local->mem + alloc->offset;
+     lock->phys   = dfb_config->video_phys + alloc->offset;
+
+     D_DEBUG_AT( DevMem_SurfLock, "  -> offset %lu, pitch %d, addr %p, phys 0x%08lx\n",
+                 lock->offset, lock->pitch, lock->addr, lock->phys );
+
+     return DFB_OK;
+}
+
+static DFBResult
+devmemUnlock( CoreSurfacePool       *pool,
+             void                  *pool_data,
+             void                  *pool_local,
+             CoreSurfaceAllocation *allocation,
+             void                  *alloc_data,
+             CoreSurfaceBufferLock *lock )
+{
+     DevMemAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, DevMemAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( DevMem_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs devmemSurfacePoolFuncs = {
+     .PoolDataSize       = devmemPoolDataSize,
+     .PoolLocalDataSize  = devmemPoolLocalDataSize,
+     .AllocationDataSize = devmemAllocationDataSize,
+
+     .InitPool           = devmemInitPool,
+     .JoinPool           = devmemJoinPool,
+     .DestroyPool        = devmemDestroyPool,
+     .LeavePool          = devmemLeavePool,
+
+     .TestConfig         = devmemTestConfig,
+     .AllocateBuffer     = devmemAllocateBuffer,
+     .DeallocateBuffer   = devmemDeallocateBuffer,
+
+     .Lock               = devmemLock,
+     .Unlock             = devmemUnlock,
+};
+
diff --git a/Source/DirectFB/systems/devmem/surfacemanager.c b/Source/DirectFB/systems/devmem/surfacemanager.c
new file mode 100755
index 0000000..c3330cf
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/surfacemanager.c
@@ -0,0 +1,575 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/shmalloc.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <core/core.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#include "surfacemanager.h"
+
+D_DEBUG_DOMAIN( SurfMan, "SurfaceManager", "DirectFB Surface Manager" );
+
+
+static Chunk *split_chunk ( SurfaceManager *manager,
+                            Chunk          *chunk,
+                            int             length );
+
+static Chunk *free_chunk  ( SurfaceManager *manager,
+                            Chunk          *chunk );
+
+static Chunk *occupy_chunk( SurfaceManager        *manager,
+                            Chunk                 *chunk,
+                            CoreSurfaceAllocation *allocation,
+                            int                    length,
+                            int                    pitch );
+
+
+DFBResult
+dfb_surfacemanager_create( CoreDFB         *core,
+                           unsigned int     length,
+                           SurfaceManager **ret_manager )
+{
+     FusionSHMPoolShared *pool;
+     SurfaceManager      *manager;
+     Chunk               *chunk;
+
+     D_DEBUG_AT( SurfMan, "%s( %p, %d )\n", __FUNCTION__, core, length );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( ret_manager != NULL );
+
+     pool = dfb_core_shmpool( core );
+
+     manager = SHCALLOC( pool, 1, sizeof(SurfaceManager) );
+     if (!manager)
+          return D_OOSHM();
+
+     chunk = SHCALLOC( pool, 1, sizeof(Chunk) );
+     if (!chunk) {
+          D_OOSHM();
+          SHFREE( pool, manager );
+          return DFB_NOSHAREDMEMORY;
+     }
+
+     manager->shmpool = pool;
+     manager->chunks  = chunk;
+     manager->offset  = 0;
+     manager->length  = length;
+     manager->avail   = manager->length - manager->offset;
+
+     D_MAGIC_SET( manager, SurfaceManager );
+
+     chunk->offset    = manager->offset;
+     chunk->length    = manager->avail;
+
+     D_MAGIC_SET( chunk, Chunk );
+
+     D_DEBUG_AT( SurfMan, "  -> %p\n", manager );
+
+     *ret_manager = manager;
+
+     return DFB_OK;
+}
+
+void
+dfb_surfacemanager_destroy( SurfaceManager *manager )
+{
+     Chunk *chunk;
+     void  *next;
+
+     D_DEBUG_AT( SurfMan, "%s( %p )\n", __FUNCTION__, manager );
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+
+     /* Deallocate all video chunks. */
+     chunk = manager->chunks;
+     while (chunk) {
+          next = chunk->next;
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+
+          chunk = next;
+     }
+
+     D_MAGIC_CLEAR( manager );
+
+     /* Deallocate manager struct. */
+     SHFREE( manager->shmpool, manager );
+}
+
+/** public functions NOT locking the surfacemanger theirself,
+    to be called between lock/unlock of surfacemanager **/
+
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk )
+{
+     int pitch;
+     int length;
+     Chunk *c;
+     CoreGraphicsDevice *device;
+
+     Chunk *best_free = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     if (ret_chunk)
+          D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     else
+          D_ASSUME( allocation == NULL );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     if (manager->suspended)
+          return DFB_SUSPENDED;
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( device, buffer, &pitch, &length );
+
+     D_DEBUG_AT( SurfMan, "  -> pitch %d, length %d\n", pitch, length );
+
+     if (manager->avail < length)
+          return DFB_TEMPUNAVAIL;
+
+     /* examine chunks */
+     c = manager->chunks;
+     D_MAGIC_ASSERT( c, Chunk );
+
+     /* FIXME_SC_2  Workaround creation happening before graphics driver initialization. */
+     if (!c->next) {
+          int length = dfb_gfxcard_memory_length();
+
+          if (c->length != length - manager->offset) {
+               D_WARN( "workaround" );
+
+               manager->length = length;
+               manager->avail  = length - manager->offset;
+
+               c->length = length - manager->offset;
+          }
+     }
+
+     while (c) {
+          D_MAGIC_ASSERT( c, Chunk );
+
+          if (!c->buffer && c->length >= length) {
+               /* NULL means check only. */
+               if (!ret_chunk)
+                    return DFB_OK;
+
+               /* found a nice place to chill */
+               if (!best_free  ||  best_free->length > c->length)
+                    /* first found or better one? */
+                    best_free = c;
+
+               if (c->length == length)
+                    break;
+          }
+
+          c = c->next;
+     }
+
+     /* if we found a place */
+     if (best_free) {
+          D_DEBUG_AT( SurfMan, "  -> found free (%d)\n", best_free->length );
+
+          /* NULL means check only. */
+          if (ret_chunk)
+               *ret_chunk = occupy_chunk( manager, best_free, allocation, length, pitch );
+
+          return DFB_OK;
+     }
+
+     D_DEBUG_AT( SurfMan, "  -> failed (%d/%d avail)\n", manager->avail, manager->length );
+
+     /* no luck */
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer )
+{
+     int                    length;
+     Chunk                 *multi_start = NULL;
+     int                    multi_size  = 0;
+     int                    multi_tsize = 0;
+     int                    multi_count = 0;
+     Chunk                 *bestm_start = NULL;
+     int                    bestm_count = 0;
+     int                    bestm_size  = 0;
+     int                    min_toleration;
+     Chunk                 *chunk;
+     CoreGraphicsDevice    *device;
+     CoreSurfaceAllocation *smallest = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( dfb_core_get_part( core, DFCP_GRAPHICS ), buffer, NULL, &length );
+
+     min_toleration = manager->min_toleration/8 + 2;
+
+     D_DEBUG_AT( SurfMan, "  -> %7d required, min toleration %d\n", length, min_toleration );
+
+     chunk = manager->chunks;
+     while (chunk) {
+          CoreSurfaceAllocation *allocation;
+
+          D_MAGIC_ASSERT( chunk, Chunk );
+
+          allocation = chunk->allocation;
+          if (allocation) {
+               CoreSurfaceBuffer *other;
+               int                size;
+
+               D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+               D_ASSERT( chunk->buffer == allocation->buffer );
+               D_ASSERT( chunk->length >= allocation->size );
+
+               other = allocation->buffer;
+               D_MAGIC_ASSERT( other, CoreSurfaceBuffer );
+
+               if (other->locked) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d locked %dx\n", allocation->size, other->locked );
+                    goto next_reset;
+               }
+
+               if (other->policy > buffer->policy) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy %d > %d\n", allocation->size, other->policy, buffer->policy );
+                    goto next_reset;
+               }
+
+               if (other->policy == CSP_VIDEOONLY) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy videoonly\n", allocation->size );
+                    goto next_reset;
+               }
+
+               chunk->tolerations++;
+               if (chunk->tolerations > 0xff)
+                    chunk->tolerations = 0xff;
+
+               if (other->policy == buffer->policy && chunk->tolerations < min_toleration) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d tolerations %d/%d\n",
+                                allocation->size, chunk->tolerations, min_toleration );
+                    goto next_reset;
+               }
+
+               size = allocation->size;
+
+               if (chunk->prev && !chunk->prev->allocation)
+                    size += chunk->prev->length;
+
+               if (chunk->next && !chunk->next->allocation)
+                    size += chunk->next->length;
+
+               if (size >= length) {
+                    if (!smallest || smallest->size > allocation->size) {
+                         D_DEBUG_AT( SurfMan, "  => %7d [%d] < %d, tolerations %d\n",
+                                     allocation->size, size, smallest ? smallest->size : 0, chunk->tolerations );
+
+                         smallest = allocation;
+                    }
+                    else
+                         D_DEBUG_AT( SurfMan, "  -> %7d [%d] > %d\n", allocation->size, size, smallest->size );
+               }
+               else
+                    D_DEBUG_AT( SurfMan, "  -> %7d [%d]\n", allocation->size, size );
+          }
+          else
+               D_DEBUG_AT( SurfMan, "  -  %7d free\n", chunk->length );
+
+
+          if (!smallest) {
+               if (!multi_start) {
+                    multi_start = chunk;
+                    multi_tsize = chunk->length;
+                    multi_size  = chunk->allocation ? chunk->length : 0;
+                    multi_count = chunk->allocation ? 1 : 0;
+               }
+               else {
+                    multi_tsize += chunk->length;
+                    multi_size  += chunk->allocation ? chunk->length : 0;
+                    multi_count += chunk->allocation ? 1 : 0;
+
+                    while (multi_tsize >= length && multi_count > 1) {
+                         if (!bestm_start || bestm_size > multi_size * multi_count / bestm_count) {
+                              D_DEBUG_AT( SurfMan, "                =====> %7d, %7d %2d used [%7d %2d]\n",
+                                          multi_tsize, multi_size, multi_count, bestm_size, bestm_count );
+
+                              bestm_size  = multi_size;
+                              bestm_start = multi_start;
+                              bestm_count = multi_count;
+                         }
+                         else
+                              D_DEBUG_AT( SurfMan, "                -----> %7d, %7d %2d used\n",
+                                          multi_tsize, multi_size, multi_count );
+
+                         if (multi_count <= 2)
+                              break;
+
+                         if (!multi_start->allocation) {
+                              multi_tsize -= multi_start->length;
+                              multi_start  = multi_start->next;
+                         }
+
+                         D_ASSUME( multi_start->allocation != NULL );
+
+                         multi_tsize -= multi_start->length;
+                         multi_size  -= multi_start->allocation ? multi_start->length : 0;
+                         multi_count -= multi_start->allocation ? 1 : 0;
+                         multi_start  = multi_start->next;
+                    }
+               }
+          }
+
+          chunk = chunk->next;
+
+          continue;
+
+
+next_reset:
+          multi_start = NULL;
+
+          chunk = chunk->next;
+     }
+
+     if (smallest) {
+          D_MAGIC_ASSERT( smallest, CoreSurfaceAllocation );
+          D_MAGIC_ASSERT( smallest->buffer, CoreSurfaceBuffer );
+
+          smallest->flags |= CSALF_MUCKOUT;
+
+          D_DEBUG_AT( SurfMan, "  -> offset %lu, size %d\n", smallest->offset, smallest->size );
+
+          return DFB_OK;
+     }
+
+     if (bestm_start) {
+          chunk = bestm_start;
+
+          while (bestm_count) {
+               CoreSurfaceAllocation *allocation = chunk->allocation;
+
+               if (allocation) {
+                    D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+                    D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+                    
+                    allocation->flags |= CSALF_MUCKOUT;
+
+                    bestm_count--;
+               }
+
+               D_DEBUG_AT( SurfMan, "  ---> offset %d, length %d\n", chunk->offset, chunk->length );
+
+               chunk = chunk->next;
+          }
+
+          return DFB_OK;
+     }
+
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk )
+{
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     buffer = chunk->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     free_chunk( manager, chunk );
+
+     return DFB_OK;
+}
+
+/** internal functions NOT locking the surfacemanager **/
+
+static Chunk *
+split_chunk( SurfaceManager *manager, Chunk *c, int length )
+{
+     Chunk *newchunk;
+
+     D_MAGIC_ASSERT( c, Chunk );
+
+     if (c->length == length)          /* does not need be splitted */
+          return c;
+
+     newchunk = (Chunk*) SHCALLOC( manager->shmpool, 1, sizeof(Chunk) );
+     if (!newchunk) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     /* calculate offsets and lengths of resulting chunks */
+     newchunk->offset = c->offset + c->length - length;
+     newchunk->length = length;
+     c->length -= newchunk->length;
+
+     /* insert newchunk after chunk c */
+     newchunk->prev = c;
+     newchunk->next = c->next;
+     if (c->next)
+          c->next->prev = newchunk;
+     c->next = newchunk;
+
+     D_MAGIC_SET( newchunk, Chunk );
+
+     return newchunk;
+}
+
+static Chunk *
+free_chunk( SurfaceManager *manager, Chunk *chunk )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     if (!chunk->buffer) {
+          D_BUG( "freeing free chunk" );
+          return chunk;
+     }
+     else {
+          D_DEBUG_AT( SurfMan, "Deallocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+     }
+
+     if (chunk->buffer->policy == CSP_VIDEOONLY)
+          manager->avail += chunk->length;
+
+     chunk->allocation = NULL;
+     chunk->buffer     = NULL;
+
+     manager->min_toleration--;
+
+     if (chunk->prev  &&  !chunk->prev->buffer) {
+          Chunk *prev = chunk->prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with previous chunk at %d\n", prev->offset );
+
+          prev->length += chunk->length;
+
+          prev->next = chunk->next;
+          if (prev->next)
+               prev->next->prev = prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> freeing %p (prev %p, next %p)\n", chunk, chunk->prev, chunk->next);
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+          chunk = prev;
+     }
+
+     if (chunk->next  &&  !chunk->next->buffer) {
+          Chunk *next = chunk->next;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with next chunk at %d\n", next->offset );
+
+          chunk->length += next->length;
+
+          chunk->next = next->next;
+          if (chunk->next)
+               chunk->next->prev = chunk;
+
+          D_MAGIC_CLEAR( next );
+
+          SHFREE( manager->shmpool, next );
+     }
+
+     return chunk;
+}
+
+static Chunk *
+occupy_chunk( SurfaceManager *manager, Chunk *chunk, CoreSurfaceAllocation *allocation, int length, int pitch )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+     
+     if (allocation->buffer->policy == CSP_VIDEOONLY)
+          manager->avail -= length;
+
+     chunk = split_chunk( manager, chunk, length );
+     if (!chunk)
+          return NULL;
+
+     D_DEBUG_AT( SurfMan, "Allocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+
+     chunk->allocation = allocation;
+     chunk->buffer     = allocation->buffer;
+     chunk->pitch      = pitch;
+
+     manager->min_toleration++;
+
+     return chunk;
+}
+
diff --git a/Source/DirectFB/systems/devmem/surfacemanager.h b/Source/DirectFB/systems/devmem/surfacemanager.h
new file mode 100755
index 0000000..e6136c5
--- /dev/null
+++ b/Source/DirectFB/systems/devmem/surfacemanager.h
@@ -0,0 +1,110 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SURFACEMANAGER_H__
+#define __SURFACEMANAGER_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+typedef struct _SurfaceManager SurfaceManager;
+typedef struct _Chunk          Chunk;
+
+/*
+ * initially there is one big free chunk,
+ * chunks are splitted into a free and an occupied chunk if memory is allocated,
+ * two chunks are merged to one free chunk if memory is deallocated
+ */
+struct _Chunk {
+     int                  magic;
+
+     int                  offset;      /* offset in memory,
+                                          is greater or equal to the heap offset */
+     int                  length;      /* length of this chunk in bytes */
+
+     int                  pitch;
+     
+     CoreSurfaceBuffer   *buffer;      /* pointer to surface buffer occupying
+                                          this chunk, or NULL if chunk is free */
+     CoreSurfaceAllocation *allocation;
+
+     int                  tolerations; /* number of times this chunk was scanned
+                                          occupied, resetted in assure_video */
+
+     Chunk               *prev;
+     Chunk               *next;
+};
+
+struct _SurfaceManager {
+     int                  magic;
+
+     FusionSHMPoolShared *shmpool;
+
+     Chunk               *chunks;
+
+     int                  offset;
+     int                  length;         /* length of the heap in bytes */
+     int                  avail;          /* amount of available memory in bytes */
+
+     int                  min_toleration;
+     
+     bool                 suspended;
+};
+
+
+DFBResult dfb_surfacemanager_create ( CoreDFB             *core,
+                                      unsigned int         length,
+                                      SurfaceManager     **ret_manager );
+
+void      dfb_surfacemanager_destroy( SurfaceManager      *manager );
+
+/*
+ * finds and allocates one for the surface or fails,
+ * after success the video health is CSH_RESTORE.
+ * NOTE: this does not notify the listeners
+ */
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk );
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer );
+
+/*
+ * sets the video health to CSH_INVALID frees the chunk and
+ * notifies the listeners
+ */
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk );
+
+#endif
+
diff --git a/Source/DirectFB/systems/fbdev/Makefile.am b/Source/DirectFB/systems/fbdev/Makefile.am
new file mode 100755
index 0000000..9aa25b4
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/Makefile.am
@@ -0,0 +1,48 @@
+## Makefile.am for DirectFB/systems/fbdev
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -D_XOPEN_SOURCE=500
+
+
+internalincludedir = $(INTERNALINCLUDEDIR)/fbdev
+
+internalinclude_HEADERS = \
+	agp.h			\
+	fb.h			\
+	fbdev.h			\
+	surfacemanager.h	\
+	vt.h
+
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_fbdev.o
+endif
+systems_LTLIBRARIES = libdirectfb_fbdev.la
+
+libdirectfb_fbdev_la_LDFLAGS = \
+	-avoid-version	\
+	-module	\
+	$(SYSFS_LIBS)
+
+libdirectfb_fbdev_la_SOURCES = \
+	agp.c			\
+	fbdev.c			\
+	fbdev_surface_pool.c	\
+	surfacemanager.c	\
+	vt.c
+
+libdirectfb_fbdev_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/DirectFB/systems/fbdev/Makefile.in b/Source/DirectFB/systems/fbdev/Makefile.in
new file mode 100755
index 0000000..ddf7e26
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/Makefile.in
@@ -0,0 +1,637 @@
+# 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 = $(internalinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/rules/libobject.make
+subdir = systems/fbdev
+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)$(systemsdir)" "$(DESTDIR)$(systemsdir)" \
+	"$(DESTDIR)$(internalincludedir)"
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(systems_LTLIBRARIES)
+libdirectfb_fbdev_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_fbdev_la_OBJECTS = agp.lo fbdev.lo \
+	fbdev_surface_pool.lo surfacemanager.lo vt.lo
+libdirectfb_fbdev_la_OBJECTS = $(am_libdirectfb_fbdev_la_OBJECTS)
+libdirectfb_fbdev_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_fbdev_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_fbdev_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_fbdev_la_SOURCES)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(systems_DATA)
+internalincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(internalinclude_HEADERS)
+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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -D_XOPEN_SOURCE=500
+internalincludedir = $(INTERNALINCLUDEDIR)/fbdev
+internalinclude_HEADERS = \
+	agp.h			\
+	fb.h			\
+	fbdev.h			\
+	surfacemanager.h	\
+	vt.h
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_fbdev.o
+systems_LTLIBRARIES = libdirectfb_fbdev.la
+libdirectfb_fbdev_la_LDFLAGS = \
+	-avoid-version	\
+	-module	\
+	$(SYSFS_LIBS)
+
+libdirectfb_fbdev_la_SOURCES = \
+	agp.c			\
+	fbdev.c			\
+	fbdev_surface_pool.c	\
+	surfacemanager.c	\
+	vt.c
+
+libdirectfb_fbdev_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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  systems/fbdev/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/fbdev/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-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_fbdev.la: $(libdirectfb_fbdev_la_OBJECTS) $(libdirectfb_fbdev_la_DEPENDENCIES) 
+	$(libdirectfb_fbdev_la_LINK) -rpath $(systemsdir) $(libdirectfb_fbdev_la_OBJECTS) $(libdirectfb_fbdev_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdev_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surfacemanager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vt.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-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+install-internalincludeHEADERS: $(internalinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(internalincludedir)" || $(MKDIR_P) "$(DESTDIR)$(internalincludedir)"
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(internalincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  $(internalincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(internalincludedir)/$$f"; \
+	done
+
+uninstall-internalincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(internalinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(internalincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(internalincludedir)/$$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) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(internalincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-systemsLTLIBRARIES \
+	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-internalincludeHEADERS install-systemsDATA \
+	install-systemsLTLIBRARIES
+
+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-internalincludeHEADERS uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-systemsLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-internalincludeHEADERS install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	install-systemsDATA install-systemsLTLIBRARIES 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-internalincludeHEADERS \
+	uninstall-systemsDATA uninstall-systemsLTLIBRARIES
+
+%.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/systems/fbdev/agp.c b/Source/DirectFB/systems/fbdev/agp.c
new file mode 100755
index 0000000..286d4db
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/agp.c
@@ -0,0 +1,511 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#include <asm/types.h>    /* Needs to be included before dfb_types.h */
+
+#include <directfb.h>
+
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <misc/conf.h>
+
+#include "fbdev.h"
+#include "agp.h"
+
+#define PAGE_SIZE direct_pagesize()
+
+/*****************************************************************************/
+
+extern FBDev *dfb_fbdev;
+
+static AGPDevice *dfb_agp = NULL;
+
+/*****************************************************************************/
+
+static DFBResult
+dfb_agp_info( agp_info *info )
+{
+     D_ASSERT( info != NULL );
+
+     if (ioctl( dfb_agp->fd, AGPIOC_INFO, info )) {
+          D_PERROR( "DirectFB/FBDev/agp: Could not get AGP info!\n" );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_setup( u32 mode )
+{
+     agp_setup setup;
+
+     setup.agp_mode = mode;
+
+     if (ioctl( dfb_agp->fd, AGPIOC_SETUP, &setup )) {
+          D_PERROR( "DirectFB/FBDev/agp: AGP setup failed!\n" );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_acquire( void )
+{
+     if (ioctl( dfb_agp->fd, AGPIOC_ACQUIRE, 0 )) {
+          D_PERROR( "DirectFB/FBDev/agp: Acquire failed!\n" );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_release( void )
+{
+     if (ioctl( dfb_agp->fd, AGPIOC_RELEASE, 0 )) {
+          D_PERROR( "DirectFB/FBDev/agp: Release failed!\n" );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_allocate( unsigned long size, int *key )
+{
+     agp_allocate alloc;
+     int          pages;
+
+     D_ASSERT( key != NULL );
+
+     pages = size / PAGE_SIZE;
+     if (pages % PAGE_SIZE)
+          pages++;
+
+     if (pages == 0) {
+          D_BUG( "attempted to allocate 0 pages!");
+          return DFB_BUG;
+     }
+
+     alloc.pg_count = pages;
+     alloc.type     = 0;
+
+     if (ioctl( dfb_agp->fd, AGPIOC_ALLOCATE, &alloc )) {
+          D_PERROR( "DirectFB/FBDev/agp: "
+                    "Could not allocate %d pages!\n", pages );
+          return errno2result( errno );
+     }
+
+     *key = alloc.key;
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_deallocate( int key )
+{
+     if (ioctl( dfb_agp->fd, AGPIOC_DEALLOCATE, key )) {
+          D_PERROR( "DirectFB/FBDev/agp: "
+                    "Deallocate failed (key = %d)!\n", key );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_bind( unsigned int offset, int key )
+{
+     agp_bind bind;
+
+     if (offset % PAGE_SIZE) {
+          D_BUG( "offset is not page-aligned!" );
+          return DFB_BUG;
+     }
+
+     bind.pg_start = offset / PAGE_SIZE;
+     bind.key      = key;
+
+     if (ioctl( dfb_agp->fd, AGPIOC_BIND, &bind )) {
+          D_PERROR( "DirectFB/FBDev/agp: "
+                    "Bind failed (key = %d, offset = 0x%x)!\n",
+                    key, offset );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_agp_unbind( int key )
+{
+     agp_unbind unbind;
+
+     unbind.priority = 0;
+     unbind.key      = key;
+
+     if (ioctl( dfb_agp->fd, AGPIOC_UNBIND, &unbind )) {
+          D_PERROR( "DirectFB/FBDev/agp: "
+                    "Unbind failed (key = %d)!\n",
+                    key );
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+/*****************************************************************************/
+
+static inline u16
+pci_read_word( int fd, int pos )
+{
+    u8 b[2];
+
+    if (pread( fd, b, 2, pos ) < 2)
+         return 0;
+
+    return b[0] | (b[1] << 8);
+}
+
+static inline u8
+pci_read_byte( int fd, int pos )
+{
+     u8 b;
+
+     if (pread( fd, &b, 1, pos ) < 1)
+          return 0;
+
+     return b;
+}
+
+#define PCI_STATUS            0x06
+#define  PCI_STATUS_CAP_LIST  0x10
+#define PCI_CAPABILITY_LIST   0x34
+#define  PCI_CAP_ID_AGP       0x02
+
+static bool
+dfb_agp_capable( int bus, int dev, int func )
+{
+     bool found = false;
+     char path[22];
+     int  fd;
+
+     /* XXX: the following detection method requires suid root */
+
+     snprintf( path, sizeof(path),
+               "/proc/bus/pci/%02x/%02x.%01x", bus, dev, func );
+
+     fd = open( path, O_RDONLY | O_SYNC );
+     if (fd < 0) {
+          D_PERROR( "DirectFB/FBDev/agp: "
+                    "Couldn't open '%s'!\n", path );
+          return false;
+     }
+
+     /* stolen from linux/drivers/pci/pci.c */
+     if (pci_read_word( fd, PCI_STATUS ) & PCI_STATUS_CAP_LIST) {
+          int pos, id;
+          int ttl = 48;
+
+          pos = pci_read_byte( fd, PCI_CAPABILITY_LIST );
+          while (ttl-- && pos >= 0x40) {
+               pos &= ~3;
+
+               id = pci_read_byte( fd, pos );
+               if (id == 0xff)
+                    break;
+               if (id == PCI_CAP_ID_AGP) {
+                    found = true;
+                    break;
+               }
+
+               pos = pci_read_byte( fd, pos+1 );
+          }
+     }
+
+     close( fd );
+
+     return found;
+}
+
+/*****************************************************************************/
+
+DFBResult
+dfb_agp_initialize( void )
+{
+     AGPShared     *shared;
+     unsigned int   agp_avail;
+     DFBResult      ret = DFB_FAILURE;
+
+     if (dfb_agp) {
+          D_BUG( "dfb_agp_initialize() already called!" );
+          return DFB_BUG;
+     }
+
+     /* Precheck for AGP capable device. */
+     if (!dfb_agp_capable( dfb_fbdev->shared->pci.bus,
+                           dfb_fbdev->shared->pci.dev,
+                           dfb_fbdev->shared->pci.func ))
+          return DFB_UNSUPPORTED;
+
+     dfb_agp = D_CALLOC( 1, sizeof(AGPDevice) );
+     if (!dfb_agp)
+          return D_OOM();
+
+     shared = SHCALLOC( dfb_fbdev->shared->shmpool, 1, sizeof(AGPShared) );
+     if (!shared) {
+          D_ERROR( "DirectFB/FBDev/agp: Could not allocate shared memory!\n" );
+          ret = DFB_NOSHAREDMEMORY;
+          goto error0;
+     }
+
+     dfb_agp->fd = direct_try_open( "/dev/agpgart",
+                                    "/dev/misc/agpgart", O_RDWR, true );
+     if (dfb_agp->fd < 0) {
+          ret = errno2result( errno );
+          D_ERROR( "DirectFB/FBDev/agp: Error opening AGP device!\n" );
+          goto error1;
+     }
+
+     ret = dfb_agp_acquire();
+     if (ret)
+          goto error2;
+
+     ret = dfb_agp_info( &shared->info );
+     if (ret)
+          goto error2;
+
+     D_DEBUG( "DirectFB/FBDev/agp: "
+              "Bridge supports: AGP%s%s%s%s%s%s\n",
+              shared->info.agp_mode & 0x001 ? " 1X" : "",
+              shared->info.agp_mode & 0x002 ? " 2X" : "",
+              shared->info.agp_mode & 0x004 ? " 4X" : "",
+              shared->info.agp_mode & 0x008 ? " 8X" : "",
+              shared->info.agp_mode & 0x200 ? ", SBA" : "",
+              shared->info.agp_mode & 0x010 ? ", FW" : "" );
+
+     shared->info.agp_mode &= ~0xf;
+     shared->info.agp_mode |= dfb_config->agp;
+     shared->info.agp_mode |= dfb_config->agp - 1;
+
+     ret = dfb_agp_setup( shared->info.agp_mode );
+     if (ret)
+          goto error2;
+     dfb_agp_info( &shared->info );
+
+     D_DEBUG( "DirectFB/FBDev/agp: "
+              "AGP aperture at 0x%x (%zu MB)\n",
+              (unsigned int)shared->info.aper_base, shared->info.aper_size );
+
+     agp_avail = (shared->info.pg_total - shared->info.pg_used) * PAGE_SIZE;
+     if (agp_avail == 0) {
+          D_ERROR( "DirectFB/FBDev/agp: No AGP memory available!\n" );
+          ret = DFB_INIT;
+          goto error2;
+     }
+
+     shared->agp_mem = shared->info.aper_size << 20;
+     if (shared->agp_mem > agp_avail)
+          shared->agp_mem = agp_avail;
+
+     ret = dfb_agp_allocate( shared->agp_mem, &shared->agp_key );
+     if (ret)
+          goto error3;
+
+     ret = dfb_agp_bind( shared->agp_key, 0 );
+     if (ret)
+          goto error4;
+
+     dfb_agp->base = mmap( NULL, shared->info.aper_size << 20,
+                           PROT_READ | PROT_WRITE, MAP_SHARED,
+                           dfb_agp->fd, 0 );
+     if (dfb_agp->base == MAP_FAILED) {
+          D_PERROR( "DirectFB/FBDev/agp: Could not mmap the AGP aperture!\n" );
+          ret = DFB_INIT;
+          goto error5;
+     }
+
+     dfb_agp_release();
+
+     dfb_fbdev->agp = dfb_agp;
+     dfb_fbdev->shared->agp = shared;
+
+     return DFB_OK;
+
+error5:
+     dfb_agp_unbind( shared->agp_key );
+error4:
+     dfb_agp_deallocate( shared->agp_key );
+error3:
+     dfb_agp_release();
+error2:
+     close( dfb_agp->fd );
+error1:
+     SHFREE( dfb_fbdev->shared->shmpool, shared );
+error0:
+     D_FREE( dfb_agp );
+     dfb_agp = NULL;
+
+     return ret;
+}
+
+DFBResult
+dfb_agp_join( void )
+{
+     AGPShared *shared;
+     DFBResult  ret    = DFB_FAILURE;
+
+     if (dfb_agp) {
+          D_BUG( "dfb_agp_join() already called!" );
+          return DFB_BUG;
+     }
+
+     shared = dfb_fbdev->shared->agp;
+     if (!shared)
+          return DFB_OK;
+
+     dfb_agp = D_CALLOC( 1, sizeof(AGPDevice) );
+     if (!dfb_agp)
+          return D_OOM();
+
+     dfb_agp->fd = direct_try_open( "/dev/agpgart",
+                                    "/dev/misc/agpgart", O_RDWR, true );
+     if (dfb_agp->fd < 0) {
+          ret = errno2result( errno );
+          D_ERROR( "DirectFB/FBDev/agp: Error opening AGP device!\n" );
+          goto error0;
+     }
+
+     ret = dfb_agp_acquire();
+     if (ret)
+          goto error1;
+
+     dfb_agp->base = mmap( NULL, shared->info.aper_size << 20,
+                           PROT_READ | PROT_WRITE, MAP_SHARED,
+                           dfb_agp->fd, 0 );
+     if (dfb_agp->base == MAP_FAILED) {
+          D_PERROR( "DirectFB/FBDev/agp: Could not mmap the AGP aperture!\n" );
+          ret = DFB_INIT;
+          goto error2;
+     }
+
+     D_DEBUG( "DirectFB/FBDev/agp: AGP aperture mapped at %p\n", dfb_agp->base );
+
+     dfb_agp_release();
+
+     dfb_fbdev->agp = dfb_agp;
+
+     return DFB_OK;
+
+error2:
+     dfb_agp_release();
+error1:
+     close( dfb_agp->fd );
+error0:
+     D_FREE( dfb_agp );
+     dfb_agp = NULL;
+
+     return ret;
+}
+
+DFBResult
+dfb_agp_shutdown( void )
+{
+     AGPShared *shared;
+
+     if (!dfb_agp)
+          return DFB_INVARG;
+
+     shared = dfb_fbdev->shared->agp;
+
+     dfb_agp_acquire();
+
+     munmap( dfb_agp->base, shared->info.aper_size << 20 );
+
+     dfb_agp_unbind( shared->agp_key );
+     dfb_agp_deallocate( shared->agp_key );
+
+     dfb_agp_release();
+     close( dfb_agp->fd );
+
+     SHFREE( dfb_fbdev->shared->shmpool, shared );
+     D_FREE( dfb_agp );
+
+     dfb_fbdev->shared->agp = NULL;
+     dfb_fbdev->agp = dfb_agp = NULL;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_agp_leave( void )
+{
+     AGPShared *shared;
+
+     if (!dfb_agp)
+          return DFB_INVARG;
+
+     shared = dfb_fbdev->shared->agp;
+
+     dfb_agp_acquire();
+
+     munmap( dfb_agp->base, shared->info.aper_size << 20 );
+
+     dfb_agp_release();
+
+     close( dfb_agp->fd );
+     D_FREE( dfb_agp );
+
+     dfb_fbdev->agp = dfb_agp = NULL;
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/systems/fbdev/agp.h b/Source/DirectFB/systems/fbdev/agp.h
new file mode 100755
index 0000000..44313a3
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/agp.h
@@ -0,0 +1,53 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __AGP_H__
+#define __AGP_H__
+
+#include <linux/agpgart.h>
+
+typedef struct {
+     unsigned int  agp_mem;
+     int           agp_key;
+     agp_info      info;
+} AGPShared;
+
+typedef struct {
+     int           fd;
+     void         *base;
+} AGPDevice;
+
+
+DFBResult dfb_agp_initialize( void );
+DFBResult dfb_agp_shutdown( void );
+
+DFBResult dfb_agp_join( void );
+DFBResult dfb_agp_leave( void );
+
+#endif /* __AGP_H__ */
+
diff --git a/Source/DirectFB/systems/fbdev/fb.h b/Source/DirectFB/systems/fbdev/fb.h
new file mode 100755
index 0000000..6cc1399
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/fb.h
@@ -0,0 +1,366 @@
+#ifndef _LINUX_FB_H
+#define _LINUX_FB_H
+
+#include <dfb_types.h>
+
+/* Definitions of frame buffers						*/
+
+#define FB_MAJOR		29
+#define FB_MAX			32	/* sufficient for now */
+
+/* ioctls
+   0x46 is 'F'								*/
+#define FBIOGET_VSCREENINFO	0x4600
+#define FBIOPUT_VSCREENINFO	0x4601
+#define FBIOGET_FSCREENINFO	0x4602
+#define FBIOGETCMAP		0x4604
+#define FBIOPUTCMAP		0x4605
+#define FBIOPAN_DISPLAY		0x4606
+#define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)
+/* 0x4607-0x460B are defined below */
+/* #define FBIOGET_MONITORSPEC	0x460C */
+/* #define FBIOPUT_MONITORSPEC	0x460D */
+/* #define FBIOSWITCH_MONIBIT	0x460E */
+#define FBIOGET_CON2FBMAP	0x460F
+#define FBIOPUT_CON2FBMAP	0x4610
+#define FBIOBLANK		0x4611		/* arg: 0 or vesa level + 1 */
+#define FBIOGET_VBLANK		_IOR('F', 0x12, struct fb_vblank)
+#define FBIO_ALLOC              0x4613
+#define FBIO_FREE               0x4614
+#define FBIOGET_GLYPH           0x4615
+#define FBIOGET_HWCINFO         0x4616
+#define FBIOPUT_MODEINFO        0x4617
+#define FBIOGET_DISPINFO        0x4618
+
+
+#define FB_TYPE_PACKED_PIXELS		0	/* Packed Pixels	*/
+#define FB_TYPE_PLANES			1	/* Non interleaved planes */
+#define FB_TYPE_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
+#define FB_TYPE_TEXT			3	/* Text/attributes	*/
+#define FB_TYPE_VGA_PLANES		4	/* EGA/VGA planes	*/
+
+#define FB_AUX_TEXT_MDA		0	/* Monochrome text */
+#define FB_AUX_TEXT_CGA		1	/* CGA/EGA/VGA Color text */
+#define FB_AUX_TEXT_S3_MMIO	2	/* S3 MMIO fasttext */
+#define FB_AUX_TEXT_MGA_STEP16	3	/* MGA Millenium I: text, attr, 14 reserved bytes */
+#define FB_AUX_TEXT_MGA_STEP8	4	/* other MGAs:      text, attr,  6 reserved bytes */
+
+#define FB_AUX_VGA_PLANES_VGA4		0	/* 16 color planes (EGA/VGA) */
+#define FB_AUX_VGA_PLANES_CFB4		1	/* CFB4 in planes (VGA) */
+#define FB_AUX_VGA_PLANES_CFB8		2	/* CFB8 in planes (VGA) */
+
+#define FB_VISUAL_MONO01		0	/* Monochr. 1=Black 0=White */
+#define FB_VISUAL_MONO10		1	/* Monochr. 1=White 0=Black */
+#define FB_VISUAL_TRUECOLOR		2	/* True color	*/
+#define FB_VISUAL_PSEUDOCOLOR		3	/* Pseudo color (like atari) */
+#define FB_VISUAL_DIRECTCOLOR		4	/* Direct color */
+#define FB_VISUAL_STATIC_PSEUDOCOLOR	5	/* Pseudo color readonly */
+
+#define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
+#define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
+#define FB_ACCEL_AMIGABLITT	2	/* Amiga Blitter                */
+#define FB_ACCEL_S3_TRIO64	3	/* Cybervision64 (S3 Trio64)    */
+#define FB_ACCEL_NCR_77C32BLT	4	/* RetinaZ3 (NCR 77C32BLT)      */
+#define FB_ACCEL_S3_VIRGE	5	/* Cybervision64/3D (S3 ViRGE)	*/
+#define FB_ACCEL_ATI_MACH64GX	6	/* ATI Mach 64GX family		*/
+#define FB_ACCEL_DEC_TGA	7	/* DEC 21030 TGA		*/
+#define FB_ACCEL_ATI_MACH64CT	8	/* ATI Mach 64CT family		*/
+#define FB_ACCEL_ATI_MACH64VT	9	/* ATI Mach 64CT family VT class */
+#define FB_ACCEL_ATI_MACH64GT	10	/* ATI Mach 64CT family GT class */
+#define FB_ACCEL_SUN_CREATOR	11	/* Sun Creator/Creator3D	*/
+#define FB_ACCEL_SUN_CGSIX	12	/* Sun cg6			*/
+#define FB_ACCEL_SUN_LEO	13	/* Sun leo/zx			*/
+#define FB_ACCEL_IMS_TWINTURBO	14	/* IMS Twin Turbo		*/
+#define FB_ACCEL_3DLABS_PERMEDIA2 15	/* 3Dlabs Permedia 2		*/
+#define FB_ACCEL_MATROX_MGA2064W 16	/* Matrox MGA2064W (Millenium)	*/
+#define FB_ACCEL_MATROX_MGA1064SG 17	/* Matrox MGA1064SG (Mystique)	*/
+#define FB_ACCEL_MATROX_MGA2164W 18	/* Matrox MGA2164W (Millenium II) */
+#define FB_ACCEL_MATROX_MGA2164W_AGP 19	/* Matrox MGA2164W (Millenium II) */
+#define FB_ACCEL_MATROX_MGAG100	20	/* Matrox G100 (Productiva G100) */
+#define FB_ACCEL_MATROX_MGAG200	21	/* Matrox G200 (Myst, Mill, ...) */
+#define FB_ACCEL_SUN_CG14	22	/* Sun cgfourteen		 */
+#define FB_ACCEL_SUN_BWTWO	23	/* Sun bwtwo			*/
+#define FB_ACCEL_SUN_CGTHREE	24	/* Sun cgthree			*/
+#define FB_ACCEL_SUN_TCX	25	/* Sun tcx			*/
+#define FB_ACCEL_MATROX_MGAG400	26	/* Matrox G400			*/
+#define FB_ACCEL_NV3		27	/* nVidia RIVA 128              */
+#define FB_ACCEL_NV4		28	/* nVidia RIVA TNT		*/
+#define FB_ACCEL_NV5		29	/* nVidia RIVA TNT2		*/
+#define FB_ACCEL_CT_6555x	30	/* C&T 6555x			*/
+#define FB_ACCEL_3DFX_BANSHEE	31	/* 3Dfx Banshee			*/
+#define FB_ACCEL_ATI_RAGE128	32	/* ATI Rage128 family		*/
+#define FB_ACCEL_IGS_CYBER2000	33	/* CyberPro 2000		*/
+#define FB_ACCEL_IGS_CYBER2010	34	/* CyberPro 2010		*/
+#define FB_ACCEL_IGS_CYBER5000	35	/* CyberPro 5000		*/
+#define FB_ACCEL_SIS_GLAMOUR    36	/* SiS 300/630/540              */
+#define FB_ACCEL_3DLABS_PERMEDIA3 37	/* 3Dlabs Permedia 3		*/
+#define FB_ACCEL_ATI_RADEON	38	/* ATI Radeon family		*/
+#define FB_ACCEL_I810           39      /* Intel 810/815                */
+#define FB_ACCEL_SIS_GLAMOUR_2  40	/* SiS 315, 650, 740		*/
+#define FB_ACCEL_SIS_XABRE      41	/* SiS 330 ("Xabre")		*/
+#define FB_ACCEL_I830           42      /* Intel 830M/845G/85x/865G     */
+#define FB_ACCEL_NV_10          43      /* nVidia Arch 10               */
+#define FB_ACCEL_NV_20          44      /* nVidia Arch 20               */
+#define FB_ACCEL_NV_30          45      /* nVidia Arch 30               */
+#define FB_ACCEL_NV_40          46      /* nVidia Arch 40               */
+#define FB_ACCEL_XGI_VOLARI_V	47	/* XGI Volari V3XT, V5, V8      */
+#define FB_ACCEL_XGI_VOLARI_Z	48	/* XGI Volari Z7                */
+#define FB_ACCEL_NEOMAGIC_NM2070 90	/* NeoMagic NM2070              */
+#define FB_ACCEL_NEOMAGIC_NM2090 91	/* NeoMagic NM2090              */
+#define FB_ACCEL_NEOMAGIC_NM2093 92	/* NeoMagic NM2093              */
+#define FB_ACCEL_NEOMAGIC_NM2097 93	/* NeoMagic NM2097              */
+#define FB_ACCEL_NEOMAGIC_NM2160 94	/* NeoMagic NM2160              */
+#define FB_ACCEL_NEOMAGIC_NM2200 95	/* NeoMagic NM2200              */
+#define FB_ACCEL_NEOMAGIC_NM2230 96	/* NeoMagic NM2230              */
+#define FB_ACCEL_NEOMAGIC_NM2360 97	/* NeoMagic NM2360              */
+#define FB_ACCEL_NEOMAGIC_NM2380 98	/* NeoMagic NM2380              */
+#define FB_ACCEL_EP9X            99     /* CirrusLogic EP9X family      */
+
+#define FB_ACCEL_SAVAGE4        0x80	/* S3 Savage4                   */
+#define FB_ACCEL_SAVAGE3D       0x81	/* S3 Savage3D                  */
+#define FB_ACCEL_SAVAGE3D_MV    0x82	/* S3 Savage3D-MV               */
+#define FB_ACCEL_SAVAGE2000     0x83	/* S3 Savage2000                */
+#define FB_ACCEL_SAVAGE_MX_MV   0x84	/* S3 Savage/MX-MV              */
+#define FB_ACCEL_SAVAGE_MX      0x85	/* S3 Savage/MX                 */
+#define FB_ACCEL_SAVAGE_IX_MV   0x86	/* S3 Savage/IX-MV              */
+#define FB_ACCEL_SAVAGE_IX      0x87	/* S3 Savage/IX                 */
+#define FB_ACCEL_PROSAVAGE_PM   0x88	/* S3 ProSavage PM133           */
+#define FB_ACCEL_PROSAVAGE_KM   0x89	/* S3 ProSavage KM133           */
+#define FB_ACCEL_S3TWISTER_P    0x8a	/* S3 Twister                   */
+#define FB_ACCEL_S3TWISTER_K    0x8b	/* S3 TwisterK                  */
+#define FB_ACCEL_SUPERSAVAGE    0x8c    /* S3 Supersavage               */
+#define FB_ACCEL_PROSAVAGE_DDR  0x8d	/* S3 ProSavage DDR             */
+#define FB_ACCEL_PROSAVAGE_DDRK 0x8e	/* S3 ProSavage DDR-K           */
+
+struct fb_fix_screeninfo {
+	char id[16];			/* identification string eg "TT Builtin" */
+	unsigned long smem_start;	/* Start of frame buffer mem */
+					/* (physical address) */
+	u32 smem_len;			/* Length of frame buffer mem */
+	u32 type;			/* see FB_TYPE_*		*/
+	u32 type_aux;			/* Interleave for interleaved Planes */
+	u32 visual;			/* see FB_VISUAL_*		*/
+	u16 xpanstep;			/* zero if no hardware panning  */
+	u16 ypanstep;			/* zero if no hardware panning  */
+	u16 ywrapstep;			/* zero if no hardware ywrap    */
+	u32 line_length;		/* length of a line in bytes    */
+	unsigned long mmio_start;	/* Start of Memory Mapped I/O   */
+					/* (physical address) */
+	u32 mmio_len;			/* Length of Memory Mapped I/O  */
+	u32 accel;			/* Indicate to driver which	*/
+					/*  specific chip/card we have	*/
+	u16 reserved[3];		/* Reserved for future compatibility */
+};
+
+/* Interpretation of offset for color fields: All offsets are from the right,
+ * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
+ * can use the offset as right argument to <<). A pixel afterwards is a bit
+ * stream and is written to video memory as that unmodified. This implies
+ * big-endian byte order if bits_per_pixel is greater than 8.
+ */
+struct fb_bitfield {
+	u32 offset;			/* beginning of bitfield	*/
+	u32 length;			/* length of bitfield		*/
+	u32 msb_right;			/* != 0 : Most significant bit is */
+					/* right */ 
+};
+
+#define FB_NONSTD_HAM		1	/* Hold-And-Modify (HAM)        */
+
+#define FB_ACTIVATE_NOW		0	/* set values immediately (or vbl)*/
+#define FB_ACTIVATE_NXTOPEN	1	/* activate on next open	*/
+#define FB_ACTIVATE_TEST	2	/* don't set, round up impossible */
+#define FB_ACTIVATE_MASK       15
+					/* values			*/
+#define FB_ACTIVATE_VBL	       16	/* activate values on next vbl  */
+#define FB_CHANGE_CMAP_VBL     32	/* change colormap on vbl	*/
+#define FB_ACTIVATE_ALL	       64	/* change all VCs on this fb	*/
+#define FB_ACTIVATE_FORCE     128	/* force apply even when no change*/
+#define FB_ACTIVATE_INV_MODE  256       /* invalidate videomode */
+
+#define FB_ACCELF_TEXT		1	/* (OBSOLETE) see fb_info.flags and vc_mode */
+
+#define FB_SYNC_HOR_HIGH_ACT	1	/* horizontal sync high active	*/
+#define FB_SYNC_VERT_HIGH_ACT	2	/* vertical sync high active	*/
+#define FB_SYNC_EXT		4	/* external sync		*/
+#define FB_SYNC_COMP_HIGH_ACT	8	/* composite sync high active   */
+#define FB_SYNC_BROADCAST	16	/* broadcast video timings      */
+					/* vtotal = 144d/288n/576i => PAL  */
+					/* vtotal = 121d/242n/484i => NTSC */
+#define FB_SYNC_ON_GREEN	32	/* sync on green */
+
+#define FB_VMODE_NONINTERLACED  0	/* non interlaced */
+#define FB_VMODE_INTERLACED	1	/* interlaced	*/
+#define FB_VMODE_DOUBLE		2	/* double scan */
+#define FB_VMODE_MASK		255
+
+#define FB_VMODE_YWRAP		256	/* ywrap instead of panning     */
+#define FB_VMODE_SMOOTH_XPAN	512	/* smooth xpan possible (internally used) */
+#define FB_VMODE_CONUPDATE	512	/* don't update x/yoffset	*/
+
+/*
+ * Display rotation support
+ */
+#define FB_ROTATE_UR      0
+#define FB_ROTATE_CW      1
+#define FB_ROTATE_UD      2
+#define FB_ROTATE_CCW     3
+
+#define PICOS2KHZ(a) (1000000000UL/(a))
+#define KHZ2PICOS(a) (1000000000UL/(a))
+
+struct fb_var_screeninfo {
+	u32 xres;			/* visible resolution		*/
+	u32 yres;
+	u32 xres_virtual;		/* virtual resolution		*/
+	u32 yres_virtual;
+	u32 xoffset;			/* offset from virtual to visible */
+	u32 yoffset;			/* resolution			*/
+
+	u32 bits_per_pixel;		/* guess what			*/
+	u32 grayscale;			/* != 0 Graylevels instead of colors */
+
+	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
+	struct fb_bitfield green;	/* else only length is significant */
+	struct fb_bitfield blue;
+	struct fb_bitfield transp;	/* transparency			*/	
+
+	u32 nonstd;			/* != 0 Non standard pixel format */
+
+	u32 activate;			/* see FB_ACTIVATE_*		*/
+
+	u32 height;			/* height of picture in mm    */
+	u32 width;			/* width of picture in mm     */
+
+	u32 accel_flags;		/* (OBSOLETE) see fb_info.flags */
+
+	/* Timing: All values in pixclocks, except pixclock (of course) */
+	u32 pixclock;			/* pixel clock in ps (pico seconds) */
+	u32 left_margin;		/* time from sync to picture	*/
+	u32 right_margin;		/* time from picture to sync	*/
+	u32 upper_margin;		/* time from sync to picture	*/
+	u32 lower_margin;
+	u32 hsync_len;			/* length of horizontal sync	*/
+	u32 vsync_len;			/* length of vertical sync	*/
+	u32 sync;			/* see FB_SYNC_*		*/
+	u32 vmode;			/* see FB_VMODE_*		*/
+	u32 rotate;			/* angle we rotate counter clockwise */
+	u32 reserved[5];		/* Reserved for future compatibility */
+};
+
+struct fb_cmap {
+	u32 start;			/* First entry	*/
+	u32 len;			/* Number of entries */
+	u16 *red;			/* Red values	*/
+	u16 *green;
+	u16 *blue;
+	u16 *transp;			/* transparency, can be NULL */
+};
+
+struct fb_con2fbmap {
+	u32 console;
+	u32 framebuffer;
+};
+
+/* VESA Blanking Levels */
+#define VESA_NO_BLANKING        0
+#define VESA_VSYNC_SUSPEND      1
+#define VESA_HSYNC_SUSPEND      2
+#define VESA_POWERDOWN          3
+
+
+enum {
+	/* screen: unblanked, hsync: on,  vsync: on */
+	FB_BLANK_UNBLANK       = VESA_NO_BLANKING,
+
+	/* screen: blanked,   hsync: on,  vsync: on */
+	FB_BLANK_NORMAL        = VESA_NO_BLANKING + 1,
+
+	/* screen: blanked,   hsync: on,  vsync: off */
+	FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
+
+	/* screen: blanked,   hsync: off, vsync: on */
+	FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
+
+	/* screen: blanked,   hsync: off, vsync: off */
+	FB_BLANK_POWERDOWN     = VESA_POWERDOWN + 1
+};
+
+#define FB_VBLANK_VBLANKING	0x001	/* currently in a vertical blank */
+#define FB_VBLANK_HBLANKING	0x002	/* currently in a horizontal blank */
+#define FB_VBLANK_HAVE_VBLANK	0x004	/* vertical blanks can be detected */
+#define FB_VBLANK_HAVE_HBLANK	0x008	/* horizontal blanks can be detected */
+#define FB_VBLANK_HAVE_COUNT	0x010	/* global retrace counter is available */
+#define FB_VBLANK_HAVE_VCOUNT	0x020	/* the vcount field is valid */
+#define FB_VBLANK_HAVE_HCOUNT	0x040	/* the hcount field is valid */
+#define FB_VBLANK_VSYNCING	0x080	/* currently in a vsync */
+#define FB_VBLANK_HAVE_VSYNC	0x100	/* verical syncs can be detected */
+
+struct fb_vblank {
+	u32 flags;			/* FB_VBLANK flags */
+	u32 count;			/* counter of retraces since boot */
+	u32 vcount;			/* current scanline position */
+	u32 hcount;			/* current scandot position */
+	u32 reserved[4];		/* reserved for future compatibility */
+};
+
+/* Internal HW accel */
+#define ROP_COPY 0
+#define ROP_XOR  1
+
+struct fb_copyarea {
+	u32 dx;
+	u32 dy;
+	u32 width;
+	u32 height;
+	u32 sx;
+	u32 sy;
+};
+
+struct fb_fillrect {
+	u32 dx;		/* screen-relative */
+	u32 dy;
+	u32 width;
+	u32 height;
+	u32 color;
+	u32 rop;
+};
+
+struct fb_image {
+	u32 dx;			/* Where to place image */
+	u32 dy;
+	u32 width;		/* Size of image */
+	u32 height;
+	u32 fg_color;		/* Only used when a mono bitmap */
+	u32 bg_color;
+	u8  depth;		/* Depth of the image */
+	const char *data;	/* Pointer to image data */
+	struct fb_cmap cmap;	/* color map info */
+};
+
+/*
+ * hardware cursor control
+ */
+
+#define FB_CUR_SETIMAGE 0x01
+#define FB_CUR_SETPOS   0x02
+#define FB_CUR_SETHOT   0x04
+#define FB_CUR_SETCMAP  0x08
+#define FB_CUR_SETSHAPE 0x10
+#define FB_CUR_SETSIZE	0x20
+#define FB_CUR_SETALL   0xFF
+
+struct fbcurpos {
+	u16 x, y;
+};
+
+struct fb_cursor {
+	u16 set;		/* what to set */
+	u16 enable;		/* cursor on/off */
+	u16 rop;		/* bitop operation */
+	const char *mask;	/* cursor mask bits */
+	struct fbcurpos hot;	/* cursor hot spot */
+	struct fb_image	image;	/* Cursor image */
+};
+
+#endif /* _LINUX_FB_H */
diff --git a/Source/DirectFB/systems/fbdev/fbdev.c b/Source/DirectFB/systems/fbdev/fbdev.c
new file mode 100755
index 0000000..3691cff
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/fbdev.c
@@ -0,0 +1,2782 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>    /* Needs to be included before dfb_types.h */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#if defined(HAVE_SYSIO)
+# include <sys/io.h>
+#endif
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/kd.h>
+
+#include <pthread.h>
+
+#ifdef USE_SYSFS
+# include <sysfs/libsysfs.h>
+#endif
+
+#include <fusion/arena.h>
+#include <fusion/fusion.h>
+#include <fusion/reactor.h>
+#include <fusion/shmalloc.h>
+
+#include <directfb.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/layer_control.h>
+#include <core/layers.h>
+#include <core/gfxcard.h>
+#include <core/palette.h>
+#include <core/screen.h>
+#include <core/screens.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/state.h>
+#include <core/windows.h>
+
+#include <gfx/convert.h>
+
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/signals.h>
+#include <direct/system.h>
+#include <direct/util.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include "fbdev.h"
+#include "fb.h"
+#include "vt.h"
+#include "agp.h"
+
+#include <core/core_system.h>
+
+DFB_CORE_SYSTEM( fbdev )
+
+
+D_DEBUG_DOMAIN( FBDev_Mode, "FBDev/Mode", "FBDev System Module Mode Switching" );
+
+/******************************************************************************/
+
+extern const SurfacePoolFuncs fbdevSurfacePoolFuncs;
+
+static FusionCallHandlerResult
+fbdev_ioctl_call_handler( int           caller,
+                          int           call_arg,
+                          void         *call_ptr,
+                          void         *ctx,
+                          unsigned int  serial,
+                          int          *ret_val );
+
+static int fbdev_ioctl( int request, void *arg, int arg_size );
+
+#define FBDEV_IOCTL(request,arg)   fbdev_ioctl( request, arg, sizeof(*(arg)) )
+
+FBDev *dfb_fbdev = NULL;
+
+/******************************************************************************/
+
+static int       primaryLayerDataSize ( void );
+
+static int       primaryRegionDataSize( void );
+
+static DFBResult primaryInitLayer     ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        DFBDisplayLayerDescription *description,
+                                        DFBDisplayLayerConfig      *config,
+                                        DFBColorAdjustment         *adjustment );
+
+static DFBResult primarySetColorAdjustment( CoreLayer              *layer,
+                                            void                   *driver_data,
+                                            void                   *layer_data,
+                                            DFBColorAdjustment     *adjustment );
+
+static DFBResult primaryTestRegion    ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        CoreLayerRegionConfig      *config,
+                                        CoreLayerRegionConfigFlags *failed );
+
+static DFBResult primaryAddRegion     ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        void                       *region_data,
+                                        CoreLayerRegionConfig      *config );
+
+static DFBResult primarySetRegion     ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        void                       *region_data,
+                                        CoreLayerRegionConfig      *config,
+                                        CoreLayerRegionConfigFlags  updated,
+                                        CoreSurface                *surface,
+                                        CorePalette                *palette,
+                                        CoreSurfaceBufferLock      *lock );
+
+static DFBResult primaryRemoveRegion  ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        void                       *region_data );
+
+static DFBResult primaryFlipRegion    ( CoreLayer                  *layer,
+                                        void                       *driver_data,
+                                        void                       *layer_data,
+                                        void                       *region_data,
+                                        CoreSurface                *surface,
+                                        DFBSurfaceFlipFlags         flags,
+                                        CoreSurfaceBufferLock      *lock );
+
+
+static DisplayLayerFuncs primaryLayerFuncs = {
+     .LayerDataSize      = primaryLayerDataSize,
+     .RegionDataSize     = primaryRegionDataSize,
+     .InitLayer          = primaryInitLayer,
+
+     .SetColorAdjustment = primarySetColorAdjustment,
+
+     .TestRegion         = primaryTestRegion,
+     .AddRegion          = primaryAddRegion,
+     .SetRegion          = primarySetRegion,
+     .RemoveRegion       = primaryRemoveRegion,
+     .FlipRegion         = primaryFlipRegion,
+};
+
+/******************************************************************************/
+
+static DFBResult primaryInitScreen  ( CoreScreen           *screen,
+                                      CoreGraphicsDevice   *device,
+                                      void                 *driver_data,
+                                      void                 *screen_data,
+                                      DFBScreenDescription *description );
+
+static DFBResult primarySetPowerMode( CoreScreen           *screen,
+                                      void                 *driver_data,
+                                      void                 *screen_data,
+                                      DFBScreenPowerMode    mode );
+
+static DFBResult primaryWaitVSync   ( CoreScreen           *screen,
+                                      void                 *driver_data,
+                                      void                 *layer_data );
+
+static DFBResult primaryGetScreenSize( CoreScreen           *screen,
+                                       void                 *driver_data,
+                                       void                 *screen_data,
+                                       int                  *ret_width,
+                                       int                  *ret_height );
+
+static ScreenFuncs primaryScreenFuncs = {
+     .InitScreen    = primaryInitScreen,
+     .SetPowerMode  = primarySetPowerMode,
+     .WaitVSync     = primaryWaitVSync,
+     .GetScreenSize = primaryGetScreenSize,
+};
+
+/******************************************************************************/
+
+static DFBResult dfb_fbdev_read_modes( void );
+static DFBResult dfb_fbdev_set_gamma_ramp( DFBSurfacePixelFormat format );
+static DFBResult dfb_fbdev_set_palette( CorePalette *palette );
+static DFBResult dfb_fbdev_set_rgb332_palette( void );
+static DFBResult dfb_fbdev_pan( int xoffset, int yoffset, bool onsync );
+static DFBResult dfb_fbdev_blank( int level );
+static void      dfb_fbdev_var_to_mode( const struct fb_var_screeninfo *var,
+                                        VideoMode                      *mode );
+
+/******************************************************************************/
+
+static inline
+void waitretrace (void)
+{
+#if defined(HAVE_INB_OUTB_IOPL)
+     if (iopl(3))
+          return;
+
+     if (!(inb (0x3cc) & 1)) {
+          while ((inb (0x3ba) & 0x8))
+               ;
+
+          while (!(inb (0x3ba) & 0x8))
+               ;
+     }
+     else {
+          while ((inb (0x3da) & 0x8))
+               ;
+
+          while (!(inb (0x3da) & 0x8))
+               ;
+     }
+#endif
+}
+
+/******************************************************************************/
+
+static DFBResult dfb_fbdev_open( void )
+{
+     DFBResult error_result = DFB_FAILURE;
+
+     if (dfb_config->fb_device) {
+          dfb_fbdev->fd = open( dfb_config->fb_device, O_RDWR );
+          if (dfb_fbdev->fd < 0) {
+               D_PERROR( "DirectFB/FBDev: Error opening '%s'!\n",
+                         dfb_config->fb_device);
+
+               error_result = errno2result( errno );
+               goto error;
+          }
+     }
+     else if (getenv( "FRAMEBUFFER" ) && *getenv( "FRAMEBUFFER" ) != '\0') {
+          dfb_fbdev->fd = open( getenv ("FRAMEBUFFER"), O_RDWR );
+          if (dfb_fbdev->fd < 0) {
+               D_PERROR( "DirectFB/FBDev: Error opening '%s'!\n",
+                          getenv ("FRAMEBUFFER"));
+
+               error_result = errno2result( errno );
+               goto error;
+          }
+     }
+     else {
+          dfb_fbdev->fd = direct_try_open( "/dev/fb0", "/dev/fb/0", O_RDWR, true );
+          if (dfb_fbdev->fd < 0) {
+               D_ERROR( "DirectFB/FBDev: Error opening framebuffer device!\n" );
+               D_ERROR( "DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable.\n" );
+               error_result = DFB_INIT;
+               goto error;
+          }
+     }
+
+     /* should be closed automatically in children upon exec(...) */
+     if (fcntl( dfb_fbdev->fd, F_SETFD, FD_CLOEXEC ) < 0)
+     {
+          D_PERROR( "Fusion/Init: Setting FD_CLOEXEC flag failed!\n" );
+          goto error;
+     }
+
+     return DFB_OK;
+error:
+     return error_result;
+}
+
+/******************************************************************************/
+
+static void
+dfb_fbdev_get_pci_info( FBDevShared *shared )
+{
+     char buf[512];
+     int  vendor = -1;
+     int  model  = -1;
+
+#ifdef USE_SYSFS
+     if (!sysfs_get_mnt_path( buf, 512 )) {
+          struct sysfs_class_device *classdev;
+          struct sysfs_device       *device;
+          struct sysfs_attribute    *attr;
+          char                      *fbdev;
+          char                       dev[5] = { 'f', 'b', '0', 0, 0 };
+
+          fbdev = dfb_config->fb_device;
+          if (!fbdev)
+               fbdev = getenv( "FRAMEBUFFER" );
+
+          if (fbdev) {
+               if (!strncmp( fbdev, "/dev/fb/", 8 ))
+                    snprintf( dev, 5, "fb%s", fbdev+8 );
+               else if (!strncmp( fbdev, "/dev/fb", 7 ))
+                    snprintf( dev, 5, "fb%s", fbdev+7 );
+          }
+
+          classdev = sysfs_open_class_device( "graphics", dev );
+          if (classdev) {
+               device = sysfs_get_classdev_device( classdev );
+
+               if (device) {
+                    attr = sysfs_get_device_attr( device, "vendor" );
+                    if (attr)
+                           sscanf( attr->value, "0x%04x", &vendor );
+
+                    attr = sysfs_get_device_attr( device, "device" );
+                    if (attr)
+                         sscanf( attr->value, "0x%04x", &model );
+
+                    if (vendor != -1 && model != -1) {
+                         sscanf( device->name, "0000:%02x:%02x.%1x",
+                                 &shared->pci.bus,
+                                 &shared->pci.dev,
+                                 &shared->pci.func );
+
+                         shared->device.vendor = vendor;
+                         shared->device.model  = model;
+                    }
+               }
+
+               sysfs_close_class_device( classdev );
+          }
+     }
+#endif /* USE_SYSFS */
+
+     /* try /proc interface */
+     if (vendor == -1 || model == -1) {
+          FILE *fp;
+          int   id;
+          int   bus;
+          int   dev;
+          int   func;
+
+          fp = fopen( "/proc/bus/pci/devices", "r" );
+          if (!fp) {
+               D_DEBUG( "DirectFB/FBDev: "
+                        "couldn't access /proc/bus/pci/devices!\n" );
+               return;
+          }
+
+          while (fgets( buf, 512, fp )) {
+               if (sscanf( buf, "%04x\t%04x%04x", &id, &vendor, &model ) == 3) {
+                    bus  = (id & 0xff00) >> 8;
+                    dev  = (id & 0x00ff) >> 3;
+                    func = (id & 0x0007);
+
+                    if (bus  == dfb_config->pci.bus &&
+                        dev  == dfb_config->pci.dev &&
+                        func == dfb_config->pci.func)
+                    {
+                         shared->pci.bus  = bus;
+                         shared->pci.dev  = dev;
+                         shared->pci.func = func;
+
+                         shared->device.vendor = vendor;
+                         shared->device.model  = model;
+
+                         break;
+                    }
+               }
+          }
+
+          fclose( fp );
+     }
+}
+
+
+/** public **/
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_FBDEV;
+     info->caps = CSCAPS_ACCELERATION;
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "FBDev" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+     DFBResult            ret;
+     CoreScreen          *screen;
+     long                 page_size;
+     FBDevShared         *shared = NULL;
+     FusionSHMPoolShared *pool;
+     FusionSHMPoolShared *pool_data;
+
+     D_ASSERT( dfb_fbdev == NULL );
+
+     pool      = dfb_core_shmpool( core );
+     pool_data = dfb_core_shmpool_data( core );
+
+     dfb_fbdev = D_CALLOC( 1, sizeof(FBDev) );
+     if (!dfb_fbdev)
+          return D_OOM();
+
+     dfb_fbdev->fd = -1;
+
+     shared = (FBDevShared*) SHCALLOC( pool, 1, sizeof(FBDevShared) );
+     if (!shared) {
+          ret = D_OOSHM();
+          goto error;
+     }
+
+     shared->shmpool      = pool;
+     shared->shmpool_data = pool_data;
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "fbdev", shared );
+
+     dfb_fbdev->core   = core;
+     dfb_fbdev->shared = shared;
+
+     page_size = direct_pagesize();
+
+     shared->page_mask = page_size < 0 ? 0 : (page_size - 1);
+
+     ret = dfb_fbdev_open();
+     if (ret)
+          goto error;
+
+     if (dfb_config->vt) {
+          ret = dfb_vt_initialize();
+          if (ret)
+               goto error;
+     }
+
+     ret = DFB_INIT;
+
+     /* Retrieve fixed informations like video ram size */
+     if (ioctl( dfb_fbdev->fd, FBIOGET_FSCREENINFO, &shared->fix ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not get fixed screen information!\n" );
+          goto error;
+     }
+
+     D_INFO( "DirectFB/FBDev: Found '%s' (ID %d) with frame buffer at 0x%08lx, %dk (MMIO 0x%08lx, %dk)\n",
+             shared->fix.id, shared->fix.accel,
+             shared->fix.smem_start, shared->fix.smem_len >> 10,
+             shared->fix.mmio_start, shared->fix.mmio_len >> 10 );
+
+     /* Map the framebuffer */
+     dfb_fbdev->framebuffer_base = mmap( NULL, shared->fix.smem_len,
+                                         PROT_READ | PROT_WRITE, MAP_SHARED,
+                                         dfb_fbdev->fd, 0 );
+     if (dfb_fbdev->framebuffer_base == MAP_FAILED) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not mmap the framebuffer!\n");
+          dfb_fbdev->framebuffer_base = NULL;
+          goto error;
+     }
+
+     if (ioctl( dfb_fbdev->fd, FBIOGET_VSCREENINFO, &shared->orig_var ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not get variable screen information!\n" );
+          goto error;
+     }
+
+     shared->current_var = shared->orig_var;
+     shared->current_var.accel_flags = 0;
+
+     if (ioctl( dfb_fbdev->fd, FBIOPUT_VSCREENINFO, &shared->current_var ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not disable console acceleration!\n" );
+          goto error;
+     }
+
+     dfb_fbdev_var_to_mode( &shared->current_var,
+                            &shared->current_mode );
+
+     shared->orig_cmap_memory = SHMALLOC( pool_data, 256 * 2 * 4 );
+     if (!shared->orig_cmap_memory) {
+          ret = D_OOSHM();
+          goto error;
+     }
+
+     shared->orig_cmap.start  = 0;
+     shared->orig_cmap.len    = 256;
+     shared->orig_cmap.red    = shared->orig_cmap_memory + 256 * 2 * 0;
+     shared->orig_cmap.green  = shared->orig_cmap_memory + 256 * 2 * 1;
+     shared->orig_cmap.blue   = shared->orig_cmap_memory + 256 * 2 * 2;
+     shared->orig_cmap.transp = shared->orig_cmap_memory + 256 * 2 * 3;
+
+     if (ioctl( dfb_fbdev->fd, FBIOGETCMAP, &shared->orig_cmap ) < 0) {
+          D_DEBUG( "DirectFB/FBDev: "
+                   "Could not retrieve palette for backup!\n" );
+
+          memset( &shared->orig_cmap, 0, sizeof(shared->orig_cmap) );
+
+          SHFREE( pool_data, shared->orig_cmap_memory );
+          shared->orig_cmap_memory = NULL;
+     }
+
+     shared->temp_cmap_memory = SHMALLOC( pool_data, 256 * 2 * 4 );
+     if (!shared->temp_cmap_memory) {
+          ret = D_OOSHM();
+          goto error;
+     }
+
+     shared->temp_cmap.start  = 0;
+     shared->temp_cmap.len    = 256;
+     shared->temp_cmap.red    = shared->temp_cmap_memory + 256 * 2 * 0;
+     shared->temp_cmap.green  = shared->temp_cmap_memory + 256 * 2 * 1;
+     shared->temp_cmap.blue   = shared->temp_cmap_memory + 256 * 2 * 2;
+     shared->temp_cmap.transp = shared->temp_cmap_memory + 256 * 2 * 3;
+
+     shared->current_cmap_memory = SHMALLOC( pool_data, 256 * 2 * 4 );
+     if (!shared->current_cmap_memory) {
+          ret = D_OOSHM();
+          goto error;
+     }
+
+     shared->current_cmap.start  = 0;
+     shared->current_cmap.len    = 256;
+     shared->current_cmap.red    = shared->current_cmap_memory + 256 * 2 * 0;
+     shared->current_cmap.green  = shared->current_cmap_memory + 256 * 2 * 1;
+     shared->current_cmap.blue   = shared->current_cmap_memory + 256 * 2 * 2;
+     shared->current_cmap.transp = shared->current_cmap_memory + 256 * 2 * 3;
+
+     dfb_fbdev_get_pci_info( shared );
+
+     if (dfb_config->agp) {
+          /* Do not fail here, AGP slot could be unavailable */
+          ret = dfb_agp_initialize();
+          if (ret) {
+               D_DEBUG( "DirectFB/FBDev: dfb_agp_initialize()\n\t->%s\n",
+                         DirectFBErrorString( ret ) );
+               ret = DFB_OK;
+          }
+     }
+
+     fusion_call_init( &shared->fbdev_ioctl,
+                       fbdev_ioctl_call_handler, NULL, dfb_core_world(core) );
+
+     dfb_surface_pool_initialize( core, &fbdevSurfacePoolFuncs, &dfb_fbdev->shared->pool );
+
+     /* Register primary screen functions */
+     screen = dfb_screens_register( NULL, NULL, &primaryScreenFuncs );
+
+     /* Register primary layer functions */
+     dfb_layers_register( screen, NULL, &primaryLayerFuncs );
+
+     *data = dfb_fbdev;
+
+     return DFB_OK;
+
+
+error:
+     if (shared) {
+          if (shared->orig_cmap_memory)
+               SHFREE( pool_data, shared->orig_cmap_memory );
+
+          if (shared->temp_cmap_memory)
+               SHFREE( pool_data, shared->temp_cmap_memory );
+
+          if (shared->current_cmap_memory)
+               SHFREE( pool_data, shared->current_cmap_memory );
+
+          SHFREE( pool, shared );
+     }
+
+     if (dfb_fbdev->framebuffer_base)
+          munmap( dfb_fbdev->framebuffer_base, shared->fix.smem_len );
+
+     if (dfb_fbdev->fd != -1)
+          close( dfb_fbdev->fd );
+
+     D_FREE( dfb_fbdev );
+     dfb_fbdev = NULL;
+
+     return ret;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+     DFBResult   ret;
+     CoreScreen *screen;
+     void       *shared;
+
+     D_ASSERT( dfb_fbdev == NULL );
+
+     if (dfb_config->vt) {
+          ret = dfb_vt_join();
+          if (ret)
+               return ret;
+     }
+
+     dfb_fbdev = D_CALLOC( 1, sizeof(FBDev) );
+     if (!dfb_fbdev)
+          return D_OOM();
+
+     fusion_arena_get_shared_field( dfb_core_arena( core ),
+                                    "fbdev", &shared );
+
+     dfb_fbdev->core = core;
+     dfb_fbdev->shared = shared;
+
+     /* Open framebuffer device */
+     ret = dfb_fbdev_open();
+     if (ret) {
+          D_FREE( dfb_fbdev );
+          dfb_fbdev = NULL;
+          return ret;
+     }
+
+     /* Map the framebuffer */
+     dfb_fbdev->framebuffer_base = mmap( NULL, dfb_fbdev->shared->fix.smem_len,
+                                         PROT_READ | PROT_WRITE, MAP_SHARED,
+                                         dfb_fbdev->fd, 0 );
+     if (dfb_fbdev->framebuffer_base == MAP_FAILED) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not mmap the framebuffer!\n");
+          close( dfb_fbdev->fd );
+          D_FREE( dfb_fbdev );
+          dfb_fbdev = NULL;
+
+          return DFB_INIT;
+     }
+
+     /* Open AGP device */
+     ret = dfb_agp_join();
+     if (ret) {
+          D_ERROR( "DirectFB/FBDev: Could not join AGP!\n" );
+          munmap( dfb_fbdev->framebuffer_base,
+                  dfb_fbdev->shared->fix.smem_len );
+          close( dfb_fbdev->fd );
+          D_FREE( dfb_fbdev );
+          dfb_fbdev = NULL;
+
+          return ret;
+     }
+
+     dfb_surface_pool_join( core, dfb_fbdev->shared->pool, &fbdevSurfacePoolFuncs );
+
+     /* Register primary screen functions */
+     screen = dfb_screens_register( NULL, NULL, &primaryScreenFuncs );
+
+     /* Register primary layer functions */
+     dfb_layers_register( screen, NULL, &primaryLayerFuncs );
+
+     *data = dfb_fbdev;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     DFBResult            ret;
+     VideoMode           *m;
+     FBDevShared         *shared;
+     FusionSHMPoolShared *pool;
+
+     D_ASSERT( dfb_fbdev != NULL );
+
+     shared = dfb_fbdev->shared;
+
+     D_ASSERT( shared != NULL );
+
+     pool = shared->shmpool;
+
+     D_ASSERT( pool != NULL );
+
+     m = shared->modes;
+     while (m) {
+          VideoMode *next = m->next;
+          SHFREE( pool, m );
+          m = next;
+     }
+
+     if (ioctl( dfb_fbdev->fd, FBIOPUT_VSCREENINFO, &shared->orig_var ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                    "Could not restore variable screen information!\n" );
+     }
+
+     if (shared->orig_cmap.len) {
+          if (ioctl( dfb_fbdev->fd, FBIOPUTCMAP, &shared->orig_cmap ) < 0)
+               D_DEBUG( "DirectFB/FBDev: "
+                        "Could not restore palette!\n" );
+     }
+
+     if (shared->orig_cmap_memory)
+          SHFREE( shared->shmpool_data, shared->orig_cmap_memory );
+
+     if (shared->temp_cmap_memory)
+          SHFREE( shared->shmpool_data, shared->temp_cmap_memory );
+
+     if (shared->current_cmap_memory)
+          SHFREE( shared->shmpool_data, shared->current_cmap_memory );
+
+     fusion_call_destroy( &shared->fbdev_ioctl );
+
+     dfb_agp_shutdown();
+
+     dfb_surface_pool_destroy( dfb_fbdev->shared->pool );
+
+     munmap( dfb_fbdev->framebuffer_base, shared->fix.smem_len );
+
+     if (dfb_config->vt) {
+          ret = dfb_vt_shutdown( emergency );
+          if (ret)
+               return ret;
+     }
+
+     close( dfb_fbdev->fd );
+
+     SHFREE( pool, shared );
+     D_FREE( dfb_fbdev );
+     dfb_fbdev = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     DFBResult ret;
+
+     D_ASSERT( dfb_fbdev != NULL );
+
+     dfb_agp_leave();
+
+     dfb_surface_pool_leave( dfb_fbdev->shared->pool );
+
+     munmap( dfb_fbdev->framebuffer_base,
+             dfb_fbdev->shared->fix.smem_len );
+
+     if (dfb_config->vt) {
+          ret = dfb_vt_leave( emergency );
+          if (ret)
+               return ret;
+     }
+
+     close( dfb_fbdev->fd );
+
+     D_FREE( dfb_fbdev );
+     dfb_fbdev = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+system_resume( void )
+{
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+     void *addr;
+
+     if (length <= 0)
+          length = dfb_fbdev->shared->fix.mmio_len;
+
+     addr = mmap( NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED,
+                  dfb_fbdev->fd, dfb_fbdev->shared->fix.smem_len + offset );
+     if (addr == MAP_FAILED) {
+          D_PERROR( "DirectFB/FBDev: Could not mmap MMIO region "
+                     "(offset %d, length %d)!\n", offset, length );
+          return NULL;
+     }
+
+     return(volatile void*) ((u8*) addr + (dfb_fbdev->shared->fix.mmio_start &
+                                           dfb_fbdev->shared->page_mask));
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+     if (length <= 0)
+          length = dfb_fbdev->shared->fix.mmio_len;
+
+     if (munmap( (void*) ((u8*) addr - (dfb_fbdev->shared->fix.mmio_start &
+                                        dfb_fbdev->shared->page_mask)), length ) < 0)
+          D_PERROR( "DirectFB/FBDev: Could not unmap MMIO region "
+                     "at %p (length %d)!\n", addr, length );
+}
+
+static int
+system_get_accelerator( void )
+{
+#ifdef FB_ACCEL_MATROX_MGAG400
+     if (!strcmp( dfb_fbdev->shared->fix.id, "MATROX DH" ))
+          return FB_ACCEL_MATROX_MGAG400;
+#endif
+#ifdef FB_ACCEL_EP9X
+     if (!strcmp( dfb_fbdev->shared->fix.id, "ep9xfb" ))
+	  return FB_ACCEL_EP9X;
+#endif
+
+     if (dfb_config->accelerator)
+          return dfb_config->accelerator;
+
+     if (dfb_fbdev->shared->fix.mmio_len > 0)
+          return dfb_fbdev->shared->fix.accel;
+     return -1;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return dfb_fbdev->shared->modes;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return &dfb_fbdev->shared->current_mode;
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     if (dfb_config->block_all_signals)
+          direct_signals_block_all();
+
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event )
+{
+     if (dfb_config->vt && dfb_config->vt_switching) {
+          switch (event->type) {
+               case DIET_KEYPRESS:
+                    if (DFB_KEY_TYPE(event->key_symbol) == DIKT_FUNCTION &&
+                        event->modifiers == (DIMM_CONTROL | DIMM_ALT))
+                         return dfb_vt_switch( event->key_symbol - DIKS_F1 + 1 );
+
+                    break;
+
+               case DIET_KEYRELEASE:
+                    if (DFB_KEY_TYPE(event->key_symbol) == DIKT_FUNCTION &&
+                        event->modifiers == (DIMM_CONTROL | DIMM_ALT))
+                         return true;
+
+                    break;
+
+               default:
+                    break;
+          }
+     }
+
+     return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return dfb_fbdev->shared->fix.smem_start + offset;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     return(void*)((u8*)(dfb_fbdev->framebuffer_base) + offset);
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return dfb_fbdev->shared->fix.smem_len;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     if (dfb_fbdev->shared->agp)
+          return dfb_fbdev->shared->agp->info.aper_base + offset;
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     if (dfb_fbdev->agp)
+          return (void*)(u8*)dfb_fbdev->agp->base + offset;
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     if (dfb_fbdev->shared->agp)
+          return dfb_fbdev->shared->agp->agp_mem;
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     *ret_bus  = dfb_fbdev->shared->pci.bus;
+     *ret_dev  = dfb_fbdev->shared->pci.dev;
+     *ret_func = dfb_fbdev->shared->pci.func;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+     *ret_vendor_id = dfb_fbdev->shared->device.vendor;
+     *ret_device_id = dfb_fbdev->shared->device.model;
+}
+
+/******************************************************************************/
+
+static DFBResult
+init_modes( void )
+{
+     dfb_fbdev_read_modes();
+
+     if (!dfb_fbdev->shared->modes) {
+          /* try to use current mode*/
+          dfb_fbdev->shared->modes = (VideoMode*) SHCALLOC( dfb_fbdev->shared->shmpool,
+                                                            1, sizeof(VideoMode) );
+          if (!dfb_fbdev->shared->modes)
+               return D_OOSHM();
+
+          *dfb_fbdev->shared->modes = dfb_fbdev->shared->current_mode;
+
+          if (dfb_fbdev_test_mode_simple(dfb_fbdev->shared->modes)) {
+               D_ERROR("DirectFB/FBDev: "
+                        "No supported modes found in /etc/fb.modes and "
+                        "current mode not supported!\n");
+
+               D_ERROR( "DirectFB/FBDev: Current mode's pixelformat: "
+                         "rgba %d/%d, %d/%d, %d/%d, %d/%d (%dbit)\n",
+                         dfb_fbdev->shared->orig_var.red.length,
+                         dfb_fbdev->shared->orig_var.red.offset,
+                         dfb_fbdev->shared->orig_var.green.length,
+                         dfb_fbdev->shared->orig_var.green.offset,
+                         dfb_fbdev->shared->orig_var.blue.length,
+                         dfb_fbdev->shared->orig_var.blue.offset,
+                         dfb_fbdev->shared->orig_var.transp.length,
+                         dfb_fbdev->shared->orig_var.transp.offset,
+                         dfb_fbdev->shared->orig_var.bits_per_pixel );
+
+               return DFB_INIT;
+          }
+     }
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen           *screen,
+                   CoreGraphicsDevice   *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_VSYNC | DSCCAPS_POWER_MANAGEMENT;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "FBDev Primary Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetPowerMode( CoreScreen         *screen,
+                     void               *driver_data,
+                     void               *screen_data,
+                     DFBScreenPowerMode  mode )
+{
+     int level;
+
+     switch (mode) {
+          case DSPM_OFF:
+               level = 4;
+               break;
+          case DSPM_SUSPEND:
+               level = 3;
+               break;
+          case DSPM_STANDBY:
+               level = 2;
+               break;
+          case DSPM_ON:
+               level = 0;
+               break;
+          default:
+               return DFB_INVARG;
+     }
+
+     return dfb_fbdev_blank( level );
+}
+
+static DFBResult
+primaryWaitVSync( CoreScreen *screen,
+                  void       *driver_data,
+                  void       *screen_data )
+{
+     static const int zero = 0;
+
+     if (dfb_config->pollvsync_none)
+          return DFB_OK;
+
+     if (ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, &zero ))
+          waitretrace();
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     D_ASSERT( dfb_fbdev != NULL );
+     D_ASSERT( dfb_fbdev->shared != NULL );
+
+     *ret_width  = dfb_fbdev->shared->current_mode.xres;
+     *ret_height = dfb_fbdev->shared->current_mode.yres;
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+     return 0;
+}
+
+static int
+primaryRegionDataSize( void )
+{
+     return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  DFBDisplayLayerDescription *description,
+                  DFBDisplayLayerConfig      *config,
+                  DFBColorAdjustment         *adjustment )
+{
+     DFBResult  ret;
+     VideoMode *default_mode;
+
+     /* initialize mode table */
+     ret = init_modes();
+     if (ret)
+          return ret;
+
+     default_mode = dfb_fbdev->shared->modes;
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE    | DLCAPS_CONTRAST |
+                         DLCAPS_SATURATION | DLCAPS_BRIGHTNESS;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "FBDev Primary Layer" );
+
+     /* fill out default color adjustment */
+     adjustment->flags      = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_SATURATION;
+     adjustment->brightness = 0x8000;
+     adjustment->contrast   = 0x8000;
+     adjustment->saturation = 0x8000;
+
+     /* fill out the default configuration */
+     config->flags      = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                          DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+     config->buffermode = DLBM_FRONTONLY;
+     config->width      = dfb_config->mode.width  ? dfb_config->mode.width  : default_mode->xres;
+     config->height     = dfb_config->mode.height ? dfb_config->mode.height : default_mode->yres;
+
+     if (dfb_config->mode.format)
+          config->pixelformat = dfb_config->mode.format;
+     else
+          config->pixelformat = dfb_pixelformat_for_depth( default_mode->bpp );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetColorAdjustment( CoreLayer          *layer,
+                           void               *driver_data,
+                           void               *layer_data,
+                           DFBColorAdjustment *adjustment )
+{
+     struct fb_cmap *cmap       = &dfb_fbdev->shared->current_cmap;
+     struct fb_cmap *temp       = &dfb_fbdev->shared->temp_cmap;
+     int             contrast   = adjustment->contrast >> 8;
+     int             brightness = (adjustment->brightness >> 8) - 128;
+     int             saturation = adjustment->saturation >> 8;
+     int             r, g, b, i;
+
+     if (dfb_fbdev->shared->fix.visual != FB_VISUAL_DIRECTCOLOR)
+          return DFB_UNIMPLEMENTED;
+
+     /* Use gamma ramp to set color attributes */
+     for (i = 0; i < (int)cmap->len; i++) {
+          r = cmap->red[i];
+          g = cmap->green[i];
+          b = cmap->blue[i];
+          r >>= 8;
+          g >>= 8;
+          b >>= 8;
+
+          /*
+        * Brightness Adjustment: Increase/Decrease each color channels
+        * by a constant amount as specified by value of brightness.
+        */
+          if (adjustment->flags & DCAF_BRIGHTNESS) {
+               r += brightness;
+               g += brightness;
+               b += brightness;
+
+               r = CLAMP( r, 0, 255 );
+               g = CLAMP( g, 0, 255 );
+               b = CLAMP( b, 0, 255 );
+          }
+
+          /*
+           * Contrast Adjustment:  We increase/decrease the "separation"
+           * between colors in proportion to the value specified by the
+           * contrast control. Decreasing the contrast has a side effect
+           * of decreasing the brightness.
+           */
+
+          if (adjustment->flags & DCAF_CONTRAST) {
+               /* Increase contrast */
+               if (contrast > 128) {
+                    int c = contrast - 128;
+
+                    r = ((r + c/2)/c) * c;
+                    g = ((g + c/2)/c) * c;
+                    b = ((b + c/2)/c) * c;
+               }
+               /* Decrease contrast */
+               else if (contrast < 127) {
+                    r = (r * contrast) >> 7;
+                    g = (g * contrast) >> 7;
+                    b = (b * contrast) >> 7;
+               }
+
+               r = CLAMP( r, 0, 255 );
+               g = CLAMP( g, 0, 255 );
+               b = CLAMP( b, 0, 255 );
+          }
+
+          /*
+           * Saturation Adjustment:  This is is a better implementation.
+           * Saturation is implemented by "mixing" a proportion of medium
+           * gray to the color value.  On the other side, "removing"
+           * a proportion of medium gray oversaturates the color.
+           */
+          if (adjustment->flags & DCAF_SATURATION) {
+               if (saturation > 128) {
+                    int gray = saturation - 128;
+                    int color = 128 - gray;
+
+                    r = ((r - gray) << 7) / color;
+                    g = ((g - gray) << 7) / color;
+                    b = ((b - gray) << 7) / color;
+               }
+               else if (saturation < 128) {
+                    int color = saturation;
+                    int gray = 128 - color;
+
+                    r = ((r * color) >> 7) + gray;
+                    g = ((g * color) >> 7) + gray;
+                    b = ((b * color) >> 7) + gray;
+               }
+
+               r = CLAMP( r, 0, 255 );
+               g = CLAMP( g, 0, 255 );
+               b = CLAMP( b, 0, 255 );
+          }
+          r |= r << 8;
+          g |= g << 8;
+          b |= b << 8;
+
+          temp->red[i]   =  (unsigned short)r;
+          temp->green[i] =  (unsigned short)g;
+          temp->blue[i]  =  (unsigned short)b;
+     }
+
+     temp->len = cmap->len;
+     temp->start = cmap->start;
+     if (FBDEV_IOCTL( FBIOPUTCMAP, temp ) < 0) {
+          D_PERROR( "DirectFB/FBDev: Could not set the palette!\n" );
+
+          return errno2result(errno);
+     }
+
+     return DFB_OK;
+}
+
+const VideoMode *
+dfb_fbdev_find_mode( int width, int height )
+{
+     FBDevShared     *shared    = dfb_fbdev->shared;
+     const VideoMode *videomode = shared->modes;
+     const VideoMode *highest   = NULL;
+
+     while (videomode) {
+          if (videomode->xres == width && videomode->yres == height) {
+               if (!highest || highest->priority < videomode->priority)
+                    highest = videomode;
+          }
+
+          videomode = videomode->next;
+     }
+
+     if (!highest)
+          D_ERROR( "FBDev/Mode: No mode found for %dx%d!\n", width, height );
+
+     return highest;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed )
+{
+     FBDevShared                *shared = dfb_fbdev->shared;
+     CoreLayerRegionConfigFlags  fail   = CLRCF_NONE;
+     const VideoMode            *mode;
+
+     D_DEBUG_AT( FBDev_Mode, "%s( %dx%d, %s )\n", __FUNCTION__,
+                 config->source.w, config->source.h, dfb_pixelformat_name(config->format) );
+
+     mode = dfb_fbdev_find_mode( config->source.w, config->source.h );
+
+     if (!mode || dfb_fbdev_test_mode( mode, config ))
+          fail |= CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_FORMAT | CLRCF_BUFFERMODE;
+
+     if (config->options)
+          fail |= CLRCF_OPTIONS;
+
+     if ((config->source.x && !shared->fix.xpanstep) ||
+         (config->source.y && !shared->fix.ypanstep && !shared->fix.ywrapstep))
+          fail |= CLRCF_SOURCE;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  void                       *region_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags  updated,
+                  CoreSurface                *surface,
+                  CorePalette                *palette,
+                  CoreSurfaceBufferLock      *lock )
+{
+     DFBResult    ret;
+     FBDevShared *shared = dfb_fbdev->shared;
+
+     if (updated & CLRCF_SOURCE) {
+          if (config->source.w == shared->current_var.xres && config->source.h == shared->current_var.yres) {
+               ret = dfb_fbdev_pan( config->source.x, lock->offset / lock->pitch + config->source.y, true );
+               if (ret)
+                    return ret;
+          }
+          else {
+               const VideoMode *mode;
+
+               D_INFO( "FBDev/Mode: Setting %dx%d %s\n", config->source.w, config->source.h,
+                       dfb_pixelformat_name( surface->config.format ) );
+
+               mode = dfb_fbdev_find_mode( config->source.w, config->source.h );
+               if (!mode)
+                    return DFB_UNSUPPORTED;
+
+               ret = dfb_fbdev_set_mode( mode, surface, config->source.x,
+                                         lock->offset / lock->pitch + config->source.y );
+               if (ret)
+                    return ret;
+          }
+     }
+
+     if ((updated & CLRCF_PALETTE) && palette)
+          dfb_fbdev_set_palette( palette );
+
+     /* remember configuration */
+     shared->config = *config;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer             *layer,
+                   void                  *driver_data,
+                   void                  *layer_data,
+                   void                  *region_data,
+                   CoreSurface           *surface,
+                   DFBSurfaceFlipFlags    flags,
+                   CoreSurfaceBufferLock *lock )
+{
+     DFBResult ret;
+     CoreLayerRegionConfig *config = &dfb_fbdev->shared->config;
+
+     if (((flags & DSFLIP_WAITFORSYNC) == DSFLIP_WAITFORSYNC) &&
+         !dfb_config->pollvsync_after)
+          dfb_screen_wait_vsync( dfb_screens_at(DSCID_PRIMARY) );
+
+     ret = dfb_fbdev_pan( config->source.x,
+                          lock->offset / lock->pitch + config->source.y,
+                          (flags & DSFLIP_WAITFORSYNC) == DSFLIP_ONSYNC );
+     if (ret)
+          return ret;
+
+     if ((flags & DSFLIP_WAIT) &&
+         (dfb_config->pollvsync_after || !(flags & DSFLIP_ONSYNC)))
+          dfb_screen_wait_vsync( dfb_screens_at(DSCID_PRIMARY) );
+
+     dfb_surface_flip( surface, false );
+
+     return DFB_OK;
+}
+
+/** fbdev internal **/
+
+static void
+dfb_fbdev_var_to_mode( const struct fb_var_screeninfo *var,
+                       VideoMode                      *mode )
+{
+     mode->xres          = var->xres;
+     mode->yres          = var->yres;
+     mode->bpp           = var->bits_per_pixel;
+     mode->hsync_len     = var->hsync_len;
+     mode->vsync_len     = var->vsync_len;
+     mode->left_margin   = var->left_margin;
+     mode->right_margin  = var->right_margin;
+     mode->upper_margin  = var->upper_margin;
+     mode->lower_margin  = var->lower_margin;
+     mode->pixclock      = var->pixclock;
+     mode->hsync_high    = (var->sync & FB_SYNC_HOR_HIGH_ACT) ? 1 : 0;
+     mode->vsync_high    = (var->sync & FB_SYNC_VERT_HIGH_ACT) ? 1 : 0;
+     mode->csync_high    = (var->sync & FB_SYNC_COMP_HIGH_ACT) ? 1 : 0;
+     mode->sync_on_green = (var->sync & FB_SYNC_ON_GREEN) ? 1 : 0;
+     mode->external_sync = (var->sync & FB_SYNC_EXT) ? 1 : 0;
+     mode->broadcast     = (var->sync & FB_SYNC_BROADCAST) ? 1 : 0;
+     mode->laced         = (var->vmode & FB_VMODE_INTERLACED) ? 1 : 0;
+     mode->doubled       = (var->vmode & FB_VMODE_DOUBLE) ? 1 : 0;
+}
+
+#if 0
+static int dfb_fbdev_compatible_format( struct fb_var_screeninfo *var,
+                                        int al, int rl, int gl, int bl,
+                                        int ao, int ro, int go, int bo )
+{
+     int ah, rh, gh, bh;
+     int vah, vrh, vgh, vbh;
+
+     ah = al + ao - 1;
+     rh = rl + ro - 1;
+     gh = gl + go - 1;
+     bh = bl + bo - 1;
+
+     vah = var->transp.length + var->transp.offset - 1;
+     vrh = var->red.length + var->red.offset - 1;
+     vgh = var->green.length + var->green.offset - 1;
+     vbh = var->blue.length + var->blue.offset - 1;
+
+     if ((!al || (ah == vah && al >= (int)var->transp.length)) &&
+         (!rl || (rh == vrh && rl >= (int)var->red.length)) &&
+         (!gl || (gh == vgh && gl >= (int)var->green.length)) &&
+         (!bl || (bh == vbh && bl >= (int)var->blue.length)))
+          return 1;
+
+     return 0;
+}
+
+static DFBSurfacePixelFormat dfb_fbdev_get_pixelformat( struct fb_var_screeninfo *var )
+{
+     switch (var->bits_per_pixel) {
+
+          case 8:
+/*
+               This check is omitted, since we want to use RGB332 even if the
+               hardware uses a palette (in that case we initialize a calculated
+               one to have correct colors)
+
+               if (fbdev_compatible_format( var, 0, 3, 3, 2, 0, 5, 2, 0 ))*/
+
+               return DSPF_RGB332;
+
+          case 15:
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 10, 5, 0 ))
+                    return DSPF_RGB555;
+
+               if(dfb_fbdev_compatible_format( var, 1, 5, 5, 5, 15, 10, 5, 0 ))
+                   return DSPF_ARGB1555;
+
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 0, 5, 10 ))
+                    return DSPF_BGR555;
+
+               break;
+
+         case 16:
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 10, 5, 0 ))
+                    return DSPF_RGB555;
+
+               if(dfb_fbdev_compatible_format( var, 1, 5, 5, 5, 15, 10, 5, 0 ))
+                   return DSPF_ARGB1555;
+
+               if (dfb_fbdev_compatible_format( var, 4, 4, 4, 4, 12, 8, 4, 0 ))
+                    return DSPF_ARGB4444;
+
+               if (dfb_fbdev_compatible_format( var, 4, 4, 4, 4,  0, 12, 8, 4 ))
+                    return DSPF_RGBA4444;
+
+               if (dfb_fbdev_compatible_format( var, 0, 4, 4, 4, 0, 8, 4, 0 ))
+                    return DSPF_RGB444;
+
+               if (dfb_fbdev_compatible_format( var, 0, 5, 6, 5, 0, 11, 5, 0 ))
+                    return DSPF_RGB16;
+
+               if (dfb_fbdev_compatible_format( var, 0, 5, 5, 5, 0, 0, 5, 10 ))
+                    return DSPF_BGR555;
+
+               break;
+
+          case 18:
+               if (dfb_fbdev_compatible_format( var, 1, 6, 6, 6, 18, 12, 6, 0 ))
+                    return DSPF_ARGB1666;
+
+               if (dfb_fbdev_compatible_format( var, 6, 6, 6, 6, 18, 12, 6, 0 ))
+                    return DSPF_ARGB6666;
+
+               if (dfb_fbdev_compatible_format( var, 0, 6, 6, 6, 0, 12, 6, 0 ))
+                    return DSPF_RGB18;
+               break;
+
+          case 24:
+               if (dfb_fbdev_compatible_format( var, 0, 8, 8, 8, 0, 16, 8, 0 ))
+                    return DSPF_RGB24;
+
+               if (dfb_fbdev_compatible_format( var, 6, 6, 6, 6, 18, 12, 6, 0 ))
+                    return DSPF_ARGB6666;
+               break;
+
+          case 32:
+               if (dfb_fbdev_compatible_format( var, 0, 8, 8, 8, 0, 16, 8, 0 ))
+                    return DSPF_RGB32;
+
+               if (dfb_fbdev_compatible_format( var, 8, 8, 8, 8, 24, 16, 8, 0 ))
+                    return DSPF_ARGB;
+
+               break;
+     }
+
+     D_ERROR( "DirectFB/FBDev: Unsupported pixelformat: "
+               "rgba %d/%d, %d/%d, %d/%d, %d/%d (%dbit)\n",
+               var->red.length,    var->red.offset,
+               var->green.length,  var->green.offset,
+               var->blue.length,   var->blue.offset,
+               var->transp.length, var->transp.offset,
+               var->bits_per_pixel );
+
+     return DSPF_UNKNOWN;
+}
+#endif
+
+/*
+ * pans display (flips buffer) using fbdev ioctl
+ */
+static DFBResult
+dfb_fbdev_pan( int xoffset, int yoffset, bool onsync )
+{
+//     DFBResult                 ret;
+     int                       result;
+     struct fb_var_screeninfo *var;
+     FBDevShared              *shared = dfb_fbdev->shared;
+
+     if (!shared->fix.xpanstep && !shared->fix.ypanstep && !shared->fix.ywrapstep)
+          return DFB_OK;
+
+     var = &shared->current_var;
+
+     if (var->xres_virtual < xoffset + var->xres) {
+          D_ERROR( "DirectFB/FBDev: xres %d, vxres %d, xoffset %d\n",
+                    var->xres, var->xres_virtual, xoffset );
+          D_BUG( "panning buffer out of range" );
+          return DFB_BUG;
+     }
+
+     if (var->yres_virtual < yoffset + var->yres) {
+          D_ERROR( "DirectFB/FBDev: yres %d, vyres %d, offset %d\n",
+                    var->yres, var->yres_virtual, yoffset );
+          D_BUG( "panning buffer out of range" );
+          return DFB_BUG;
+     }
+
+     if (shared->fix.xpanstep)
+          var->xoffset = xoffset - (xoffset % shared->fix.xpanstep);
+     else
+          var->xoffset = 0;
+
+     if (shared->fix.ywrapstep) {
+          var->yoffset = yoffset - (yoffset % shared->fix.ywrapstep);
+          var->vmode |= FB_VMODE_YWRAP;
+     }
+     else if (shared->fix.ypanstep) {
+          var->yoffset = yoffset - (yoffset % shared->fix.ypanstep);
+          var->vmode &= ~FB_VMODE_YWRAP;
+     }
+     else {
+          var->yoffset = 0;
+     }
+
+     var->activate = onsync ? FB_ACTIVATE_VBL : FB_ACTIVATE_NOW;
+
+#if 0
+     ret = fusion_call_execute( &shared->fbdev_ioctl, FCEF_NONE, FBIOPAN_DISPLAY, var, &result );
+     if (ret)
+          return DFB_FUSION;
+
+     if (result) {
+          errno = result;
+#else
+     if (ioctl( dfb_fbdev->fd, FBIOPAN_DISPLAY, var ) < 0) {
+          result = errno;
+#endif
+          D_PERROR( "DirectFB/FBDev: Panning display failed (x=%u y=%u ywrap=%d vbl=%d)!\n",
+                    var->xoffset, var->yoffset,
+                    (var->vmode & FB_VMODE_YWRAP) ? 1 : 0,
+                    (var->activate & FB_ACTIVATE_VBL) ? 1 : 0);
+
+          return errno2result(result);
+     }
+
+     return DFB_OK;
+}
+
+/*
+ * blanks display using fbdev ioctl
+ */
+static DFBResult
+dfb_fbdev_blank( int level )
+{
+     if (ioctl( dfb_fbdev->fd, FBIOBLANK, level ) < 0) {
+          D_PERROR( "DirectFB/FBDev: Display blanking failed!\n" );
+
+          return errno2result( errno );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_fbdev_mode_to_var( const VideoMode           *mode,
+                       DFBSurfacePixelFormat      pixelformat,
+                       unsigned int               vxres,
+                       unsigned int               vyres,
+                       unsigned int               xoffset,
+                       unsigned int               yoffset,
+                       DFBDisplayLayerBufferMode  buffermode,
+                       struct fb_var_screeninfo  *ret_var )
+{
+     struct fb_var_screeninfo  var;
+     FBDevShared              *shared = dfb_fbdev->shared;
+
+     D_DEBUG_AT( FBDev_Mode, "%s( mode: %p )\n", __FUNCTION__, mode );
+
+     D_ASSERT( mode != NULL );
+     D_ASSERT( ret_var != NULL );
+
+     D_DEBUG_AT( FBDev_Mode, "  -> resolution   %dx%d\n", mode->xres, mode->yres );
+     D_DEBUG_AT( FBDev_Mode, "  -> virtual      %dx%d\n", vxres, vyres );
+     D_DEBUG_AT( FBDev_Mode, "  -> pixelformat  %s\n", dfb_pixelformat_name(pixelformat) );
+     D_DEBUG_AT( FBDev_Mode, "  -> buffermode   %s\n",
+                 buffermode == DLBM_FRONTONLY  ? "FRONTONLY"  :
+                 buffermode == DLBM_BACKVIDEO  ? "BACKVIDEO"  :
+                 buffermode == DLBM_BACKSYSTEM ? "BACKSYSTEM" :
+                 buffermode == DLBM_TRIPLE     ? "TRIPLE"     : "invalid!" );
+
+     /* Start from current information */
+     var              = shared->current_var;
+     var.activate     = FB_ACTIVATE_NOW;
+
+     /* Set timings */
+     var.pixclock     = mode->pixclock;
+     var.left_margin  = mode->left_margin;
+     var.right_margin = mode->right_margin;
+     var.upper_margin = mode->upper_margin;
+     var.lower_margin = mode->lower_margin;
+     var.hsync_len    = mode->hsync_len;
+     var.vsync_len    = mode->vsync_len;
+
+     /* Set resolution */
+     var.xres         = mode->xres;
+     var.yres         = mode->yres;
+     var.xres_virtual = vxres;
+     var.yres_virtual = vyres;
+
+     if (shared->fix.xpanstep)
+          var.xoffset = xoffset - (xoffset % shared->fix.xpanstep);
+     else
+          var.xoffset = 0;
+
+     if (shared->fix.ywrapstep)
+          var.yoffset = yoffset - (yoffset % shared->fix.ywrapstep);
+     else if (shared->fix.ypanstep)
+          var.yoffset = yoffset - (yoffset % shared->fix.ypanstep);
+     else
+          var.yoffset = 0;
+
+     /* Set buffer mode */
+     switch (buffermode) {
+          case DLBM_TRIPLE:
+               if (shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+                    return DFB_UNSUPPORTED;
+
+               var.yres_virtual *= 3;
+               break;
+
+          case DLBM_BACKVIDEO:
+               if (shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+                    return DFB_UNSUPPORTED;
+
+               var.yres_virtual *= 2;
+               break;
+
+          case DLBM_BACKSYSTEM:
+          case DLBM_FRONTONLY:
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     /* Set pixel format */
+     var.bits_per_pixel = DFB_BITS_PER_PIXEL(pixelformat);
+     var.transp.length  = var.transp.offset = 0;
+
+     switch (pixelformat) {
+          case DSPF_ARGB1555:
+               var.transp.length = 1;
+               var.red.length    = 5;
+               var.green.length  = 5;
+               var.blue.length   = 5;
+               var.transp.offset = 15;
+               var.red.offset    = 10;
+               var.green.offset  = 5;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_RGB555:
+               var.red.length    = 5;
+               var.green.length  = 5;
+               var.blue.length   = 5;
+               var.red.offset    = 10;
+               var.green.offset  = 5;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_ARGB4444:
+               var.transp.length = 4;
+               var.red.length    = 4;
+               var.green.length  = 4;
+               var.blue.length   = 4;
+               var.transp.offset = 12;
+               var.red.offset    = 8;
+               var.green.offset  = 4;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_RGBA4444:
+               var.transp.length = 4;
+               var.red.length    = 4;
+               var.green.length  = 4;
+               var.blue.length   = 4;
+               var.transp.offset = 0;
+               var.red.offset    = 12;
+               var.green.offset  = 8;
+               var.blue.offset   = 4;
+               break;
+
+         case DSPF_RGB444:
+               var.red.length    = 4;
+               var.green.length  = 4;
+               var.blue.length   = 4;
+               var.red.offset    = 8;
+               var.green.offset  = 4;
+               var.blue.offset   = 0;
+               break;
+
+         case DSPF_RGB32:
+               var.red.length    = 8;
+               var.green.length  = 8;
+               var.blue.length   = 8;
+               var.red.offset    = 16;
+               var.green.offset  = 8;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_RGB16:
+               var.red.length    = 5;
+               var.green.length  = 6;
+               var.blue.length   = 5;
+               var.red.offset    = 11;
+               var.green.offset  = 5;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_ARGB:
+          case DSPF_AiRGB:
+               var.transp.length = 8;
+               var.red.length    = 8;
+               var.green.length  = 8;
+               var.blue.length   = 8;
+               var.transp.offset = 24;
+               var.red.offset    = 16;
+               var.green.offset  = 8;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_LUT8:
+          case DSPF_RGB24:
+          case DSPF_RGB332:
+               break;
+
+          case DSPF_ARGB1666:
+               var.transp.length = 1;
+               var.red.length    = 6;
+               var.green.length  = 6;
+               var.blue.length   = 6;
+               var.transp.offset = 18;
+               var.red.offset    = 12;
+               var.green.offset  = 6;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_ARGB6666:
+               var.transp.length = 6;
+               var.red.length    = 6;
+               var.green.length  = 6;
+               var.blue.length   = 6;
+               var.transp.offset = 18;
+               var.red.offset    = 12;
+               var.green.offset  = 6;
+               var.blue.offset   = 0;
+               break;
+
+          case DSPF_RGB18:
+               var.red.length    = 6;
+               var.green.length  = 6;
+               var.blue.length   = 6;
+               var.red.offset    = 12;
+               var.green.offset  = 6;
+               var.blue.offset   = 0;
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     /* Set sync options */
+     var.sync = 0;
+     if (mode->hsync_high)
+          var.sync |= FB_SYNC_HOR_HIGH_ACT;
+     if (mode->vsync_high)
+          var.sync |= FB_SYNC_VERT_HIGH_ACT;
+     if (mode->csync_high)
+          var.sync |= FB_SYNC_COMP_HIGH_ACT;
+     if (mode->sync_on_green)
+          var.sync |= FB_SYNC_ON_GREEN;
+     if (mode->external_sync)
+          var.sync |= FB_SYNC_EXT;
+     if (mode->broadcast)
+          var.sync |= FB_SYNC_BROADCAST;
+
+     /* Set interlace/linedouble */
+     var.vmode = 0;
+     if (mode->laced)
+          var.vmode |= FB_VMODE_INTERLACED;
+     if (mode->doubled)
+          var.vmode |= FB_VMODE_DOUBLE;
+
+     *ret_var = var;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_fbdev_test_mode( const VideoMode             *mode,
+                     const CoreLayerRegionConfig *config )
+{
+     DFBResult                  ret;
+     struct fb_var_screeninfo   var;
+     FBDevShared               *shared = dfb_fbdev->shared;
+     const DFBRectangle        *source = &config->source;
+
+     D_DEBUG_AT( FBDev_Mode, "%s( mode: %p, config: %p )\n", __FUNCTION__, mode, config );
+
+     D_ASSERT( mode != NULL );
+     D_ASSERT( config != NULL );
+
+     /* Is panning supported? */
+     if (source->w != mode->xres && shared->fix.xpanstep == 0)
+          return DFB_UNSUPPORTED;
+     if (source->h != mode->yres && shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+          return DFB_UNSUPPORTED;
+
+     ret = dfb_fbdev_mode_to_var( mode, config->format, config->width, config->height,
+                                  0, 0, config->buffermode, &var );
+     if (ret)
+          return ret;
+
+     /* Enable test mode */
+     var.activate = FB_ACTIVATE_TEST;
+
+
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC | GDLF_RESET | GDLF_INVALIDATE );
+
+     if (FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &var ) < 0) {
+          int erno = errno;
+          dfb_gfxcard_unlock();
+          D_DEBUG_AT( FBDev_Mode, "  => FAILED!\n" );
+          return errno2result( erno );
+     }
+
+     dfb_gfxcard_unlock();
+
+     D_DEBUG_AT( FBDev_Mode, "  => SUCCESS\n" );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_fbdev_test_mode_simple( const VideoMode *mode )
+{
+     DFBResult                ret;
+     struct fb_var_screeninfo var;
+
+     D_DEBUG_AT( FBDev_Mode, "%s( mode: %p )\n", __FUNCTION__, mode );
+
+     D_ASSERT( mode != NULL );
+
+     ret = dfb_fbdev_mode_to_var( mode, dfb_pixelformat_for_depth(mode->bpp), mode->xres, mode->yres,
+                                  0, 0, DLBM_FRONTONLY, &var );
+     if (ret)
+          return ret;
+
+     /* Enable test mode */
+     var.activate = FB_ACTIVATE_TEST;
+
+     if (FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &var ) < 0) {
+          D_DEBUG_AT( FBDev_Mode, "  => FAILED!\n" );
+          return errno2result( errno );
+     }
+
+     D_DEBUG_AT( FBDev_Mode, "  => SUCCESS\n" );
+
+     return DFB_OK;
+}
+
+static int num_video_buffers( CoreSurface *surface )
+{
+      int i;
+
+      for (i = 0; i < surface->num_buffers; i++) {
+           if (surface->buffers[i]->policy == CSP_SYSTEMONLY)
+                break;
+      }
+
+      return i;
+}
+
+DFBResult
+dfb_fbdev_set_mode( const VideoMode         *mode,
+                    CoreSurface             *surface,
+                    unsigned int             xoffset,
+                    unsigned int             yoffset )
+{
+     DFBResult                  ret;
+     struct fb_var_screeninfo   var;
+     FBDevShared               *shared     = dfb_fbdev->shared;
+     DFBDisplayLayerBufferMode  buffermode = DLBM_FRONTONLY;
+     const CoreSurfaceConfig   *config     = &surface->config ;
+
+     D_DEBUG_AT( FBDev_Mode, "%s( mode: %p, config: %p )\n", __FUNCTION__, mode, config );
+
+     D_ASSERT( mode != NULL );
+     D_ASSERT( config != NULL );
+
+     switch (num_video_buffers( surface )) {
+          case 3:
+               buffermode = DLBM_TRIPLE;
+               break;
+          case 2:
+               buffermode = DLBM_BACKVIDEO;
+               break;
+          case 1:
+               buffermode = DLBM_FRONTONLY;
+               break;
+          default:
+          D_BUG( "dfb_fbdev_set_mode() called with %d video buffers!", num_video_buffers( surface ) );
+               return DFB_BUG;
+     }
+
+     ret = dfb_fbdev_mode_to_var( mode, config->format, config->size.w, config->size.h,
+                                  xoffset, yoffset, buffermode, &var );
+     if (ret) {
+          D_ERROR( "FBDev/Mode: Failed to switch to %dx%d %s (buffermode %d)\n",
+                   config->size.w, config->size.h, dfb_pixelformat_name(config->format), buffermode );
+          return ret;
+     }
+
+
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC | GDLF_RESET | GDLF_INVALIDATE );
+
+     if (FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &var ) < 0) {
+          int erno = errno;
+
+          dfb_gfxcard_unlock();
+
+          D_DEBUG_AT( FBDev_Mode, "  => FAILED!\n" );
+
+          D_ERROR( "FBDev/Mode: Failed to switched to %dx%d (virtual %dx%d) at %d bit (%s)!\n",
+                   var.xres, var.yres, var.xres_virtual, var.yres_virtual, var.bits_per_pixel,
+                   dfb_pixelformat_name(config->format) );
+
+          return errno2result( erno );
+     }
+
+     D_DEBUG_AT( FBDev_Mode, "  => SUCCESS\n" );
+
+     shared->current_var = var;
+     dfb_fbdev_var_to_mode( &var, &shared->current_mode );
+
+     /* To get the new pitch */
+     FBDEV_IOCTL( FBIOGET_FSCREENINFO, &shared->fix );
+
+     D_INFO( "FBDev/Mode: Switched to %dx%d (virtual %dx%d) at %d bit (%s), pitch %d\n",
+             var.xres, var.yres, var.xres_virtual, var.yres_virtual, var.bits_per_pixel,
+             dfb_pixelformat_name(config->format), shared->fix.line_length );
+
+     if (config->format == DSPF_RGB332)
+          dfb_fbdev_set_rgb332_palette();
+     else
+          dfb_fbdev_set_gamma_ramp( config->format );
+
+     /* invalidate original pan offset */
+     shared->orig_var.xoffset = 0;
+     shared->orig_var.yoffset = 0;
+
+     dfb_surfacemanager_adjust_heap_offset( dfb_fbdev->shared->manager,
+                                            var.yres_virtual * shared->fix.line_length );
+
+     dfb_gfxcard_after_set_var();
+
+     dfb_gfxcard_unlock();
+
+     return DFB_OK;
+}
+
+
+#if 0
+DFBResult
+dfb_fbdev_set_mode( CoreSurface           *surface,
+                    VideoMode             *mode,
+                    CoreLayerRegionConfig *config )
+{
+     unsigned int              vxres, vyres;
+     struct fb_var_screeninfo  var;
+     FBDevShared              *shared = dfb_fbdev->shared;
+     DFBSurfacePixelFormat     format;
+
+     D_DEBUG("DirectFB/FBDev: dfb_fbdev_set_mode (surface: %p, "
+              "mode: %p, buffermode: %d)\n", surface, mode,
+              config ? config->buffermode : DLBM_FRONTONLY);
+
+     if (!mode)
+          mode = &shared->current_mode;
+
+     var = shared->current_var;
+
+     if (config) {
+          DFBRectangle *source = &config->source;
+
+          /* Is panning supported? */
+          if (source->w != mode->xres && shared->fix.xpanstep == 0)
+               return DFB_UNSUPPORTED;
+          if (source->h != mode->yres && shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+               return DFB_UNSUPPORTED;
+
+          vxres = config->width;
+          vyres = config->height;
+
+          var.xoffset = source->x;
+          var.yoffset = source->y;
+
+          switch (config->buffermode) {
+               case DLBM_TRIPLE:
+                    if (shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+                         return DFB_UNSUPPORTED;
+                    vyres *= 3;
+                    break;
+
+               case DLBM_BACKVIDEO:
+                    if (shared->fix.ypanstep == 0 && shared->fix.ywrapstep == 0)
+                         return DFB_UNSUPPORTED;
+                    vyres *= 2;
+                    break;
+
+               case DLBM_BACKSYSTEM:
+               case DLBM_FRONTONLY:
+                    break;
+
+               default:
+                    return DFB_UNSUPPORTED;
+          }
+
+          var.bits_per_pixel = DFB_BYTES_PER_PIXEL(config->format) * 8;
+
+          var.transp.length = var.transp.offset = 0;
+
+          switch (config->format) {
+               case DSPF_ARGB1555:
+                    var.transp.length = 1;
+                    var.red.length    = 5;
+                    var.green.length  = 5;
+                    var.blue.length   = 5;
+                    var.transp.offset = 15;
+                    var.red.offset    = 10;
+                    var.green.offset  = 5;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_RGB555:
+                    var.red.length    = 5;
+                    var.green.length  = 5;
+                    var.blue.length   = 5;
+                    var.red.offset    = 10;
+                    var.green.offset  = 5;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_BGR555:
+                    var.red.length    = 5;
+                    var.green.length  = 5;
+                    var.blue.length   = 5;
+                    var.red.offset    = 0;
+                    var.green.offset  = 5;
+                    var.blue.offset   = 10;
+                    break;
+
+               case DSPF_ARGB4444:
+                    var.transp.length = 4;
+                    var.red.length    = 4;
+                    var.green.length  = 4;
+                    var.blue.length   = 4;
+                    var.transp.offset = 12;
+                    var.red.offset    = 8;
+                    var.green.offset  = 4;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_RGBA4444:
+                    var.transp.length = 4;
+                    var.red.length    = 4;
+                    var.green.length  = 4;
+                    var.blue.length   = 4;
+                    var.transp.offset = 0;
+                    var.red.offset    = 12;
+                    var.green.offset  = 8;
+                    var.blue.offset   = 4;
+                    break;
+
+              case DSPF_RGB444:
+                    var.red.length = 4;
+                    var.green.length = 4;
+                    var.blue.length = 4;
+                    var.red.offset = 8;
+                    var.green.offset = 4;
+                    var.blue.offset =  0;
+                    break;
+
+              case DSPF_RGB32:
+                   var.red.length    = 8;
+                   var.green.length  = 8;
+                   var.blue.length   = 8;
+                   var.red.offset    = 16;
+                   var.green.offset  = 8;
+                   var.blue.offset   = 0;
+                   break;
+
+               case DSPF_RGB16:
+                    var.red.length    = 5;
+                    var.green.length  = 6;
+                    var.blue.length   = 5;
+                    var.red.offset    = 11;
+                    var.green.offset  = 5;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_ARGB:
+               case DSPF_AiRGB:
+                    var.transp.length = 8;
+                    var.red.length    = 8;
+                    var.green.length  = 8;
+                    var.blue.length   = 8;
+                    var.transp.offset = 24;
+                    var.red.offset    = 16;
+                    var.green.offset  = 8;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_LUT8:
+               case DSPF_RGB24:
+               case DSPF_RGB332:
+                    break;
+
+               case DSPF_ARGB1666:
+                    var.transp.length = 1;
+                    var.red.length    = 6;
+                    var.green.length  = 6;
+                    var.blue.length   = 6;
+                    var.transp.offset = 18;
+                    var.red.offset    = 12;
+                    var.green.offset  = 6;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_ARGB6666:
+                    var.transp.length = 6;
+                    var.red.length    = 6;
+                    var.green.length  = 6;
+                    var.blue.length   = 6;
+                    var.transp.offset = 18;
+                    var.red.offset    = 12;
+                    var.green.offset  = 6;
+                    var.blue.offset   = 0;
+                    break;
+
+               case DSPF_RGB18:
+                    var.red.length    = 6;
+                    var.green.length  = 6;
+                    var.blue.length   = 6;
+                    var.red.offset    = 12;
+                    var.green.offset  = 6;
+                    var.blue.offset   = 0;
+                    break;
+
+               default:
+                    return DFB_UNSUPPORTED;
+          }
+     }
+     else {
+          vxres = mode->xres;
+          vyres = mode->yres;
+
+          var.xoffset = 0;
+          var.yoffset = 0;
+
+          var.bits_per_pixel = mode->bpp;
+     }
+
+     var.activate = surface ? FB_ACTIVATE_NOW : FB_ACTIVATE_TEST;
+
+     var.xres = mode->xres;
+     var.yres = mode->yres;
+     var.xres_virtual = vxres;
+     var.yres_virtual = vyres;
+
+     var.pixclock = mode->pixclock;
+     var.left_margin = mode->left_margin;
+     var.right_margin = mode->right_margin;
+     var.upper_margin = mode->upper_margin;
+     var.lower_margin = mode->lower_margin;
+     var.hsync_len = mode->hsync_len;
+     var.vsync_len = mode->vsync_len;
+
+     var.sync = 0;
+     if (mode->hsync_high)
+          var.sync |= FB_SYNC_HOR_HIGH_ACT;
+     if (mode->vsync_high)
+          var.sync |= FB_SYNC_VERT_HIGH_ACT;
+     if (mode->csync_high)
+          var.sync |= FB_SYNC_COMP_HIGH_ACT;
+     if (mode->sync_on_green)
+          var.sync |= FB_SYNC_ON_GREEN;
+     if (mode->external_sync)
+          var.sync |= FB_SYNC_EXT;
+     if (mode->broadcast)
+          var.sync |= FB_SYNC_BROADCAST;
+
+     var.vmode = 0;
+     if (mode->laced)
+          var.vmode |= FB_VMODE_INTERLACED;
+     if (mode->doubled)
+          var.vmode |= FB_VMODE_DOUBLE;
+
+     dfb_gfxcard_lock( GDLF_WAIT | GDLF_SYNC | GDLF_RESET | GDLF_INVALIDATE );
+
+     if (FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &var ) < 0) {
+          int erno = errno;
+
+          if (surface)
+               D_PERROR( "DirectFB/FBDev: "
+                          "Could not set video mode (FBIOPUT_VSCREENINFO)!\n" );
+
+     dfb_gfxcard_unlock();
+
+          return errno2result( erno );
+     }
+
+     /*
+      * the video mode was set successfully, check if there is enough
+      * video ram (for buggy framebuffer drivers)
+      */
+
+     if (shared->fix.smem_len < (var.yres_virtual *
+                                 var.xres_virtual *
+                                 var.bits_per_pixel >> 3)
+         || (var.xres_virtual < vxres)
+         || (var.yres_virtual < vyres))
+     {
+          if (surface) {
+               D_PERROR( "DirectFB/FBDev: "
+                          "Could not set video mode (not enough video ram)!\n" );
+
+               /* restore mode */
+               FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &shared->current_var );
+          }
+
+          dfb_gfxcard_unlock();
+
+          return DFB_INVARG;
+     }
+
+     /* If surface is NULL the mode was only tested, otherwise apply changes. */
+     if (surface) {
+          struct fb_fix_screeninfo  fix;
+
+          FBDEV_IOCTL( FBIOGET_VSCREENINFO, &var );
+
+          vxres = var.xres_virtual;
+          switch (config->buffermode) {
+          case DLBM_TRIPLE:
+               vyres = var.yres_virtual / 3;
+               break;
+          case DLBM_BACKVIDEO:
+               vyres = var.yres_virtual / 2;
+               break;
+          default:
+               vyres = var.yres_virtual;
+               break;
+          }
+
+          format = dfb_fbdev_get_pixelformat( &var );
+          if (format == DSPF_UNKNOWN) {
+               D_WARN( "unknown format" );
+
+               /* restore mode */
+               FBDEV_IOCTL( FBIOPUT_VSCREENINFO, &shared->current_var );
+
+               dfb_gfxcard_unlock();
+
+               return DFB_UNSUPPORTED;
+          }
+
+          if (!config) {
+               dfb_gfxcard_unlock();
+
+               return DFB_OK;
+          }
+
+          if (format != config->format) {
+               if (DFB_BYTES_PER_PIXEL(format) == 1                      ||
+                  (format == DSPF_RGB32 && config->format == DSPF_ARGB)  ||
+                  (format == DSPF_RGB32 && config->format == DSPF_AiRGB) ||
+                  (format == DSPF_ARGB  && config->format == DSPF_AiRGB))
+                    format = config->format;
+          }
+
+          if (config->format == DSPF_RGB332)
+               dfb_fbdev_set_rgb332_palette();
+          else
+               dfb_fbdev_set_gamma_ramp( config->format );
+
+          shared->current_var = var;
+          dfb_fbdev_var_to_mode( &var, &shared->current_mode );
+
+          /* invalidate original pan offset */
+          shared->orig_var.xoffset = 0;
+          shared->orig_var.yoffset = 0;
+
+          surface->config.size.w  = vxres;
+          surface->config.size.h = vyres;
+          surface->config.format = format;
+
+          /* To get the new pitch */
+          FBDEV_IOCTL( FBIOGET_FSCREENINFO, &fix );
+
+          D_INFO( "FBDev/Mode: Switched to %dx%d (%dx%d) at %d bit %s (wanted %s).\n",
+              var.xres, var.yres, var.xres_virtual, var.yres_virtual, var.bits_per_pixel,
+                  dfb_pixelformat_name(format), dfb_pixelformat_name(config->format) );
+
+          /* ++Tony: Other information (such as visual formats) will also change */
+          shared->fix = fix;
+
+          dfb_surfacemanager_adjust_heap_offset( dfb_fbdev->shared->manager,
+                                                 var.yres_virtual * fix.line_length );
+
+          if (shared->fix.xpanstep || shared->fix.ypanstep || shared->fix.ywrapstep)
+               dfb_fbdev_pan( var.xoffset, var.yoffset, false );
+
+          dfb_gfxcard_after_set_var();
+
+          dfb_surface_notify( surface,
+                              CSNF_SIZEFORMAT | CSNF_FLIP |
+                              CSNF_VIDEO      | CSNF_SYSTEM );
+     }
+
+     dfb_gfxcard_unlock();
+
+     return DFB_OK;
+}
+#endif
+
+/*
+ * parses video modes in /etc/fb.modes and stores them in dfb_fbdev->shared->modes
+ * (to be replaced by DirectFB's own config system
+ */
+static DFBResult
+dfb_fbdev_read_modes( void )
+{
+     FILE        *fp;
+     char         line[80],label[32],value[16];
+     int          geometry=0, timings=0;
+     int          dummy;
+     VideoMode    temp_mode;
+     FBDevShared *shared = dfb_fbdev->shared;
+     VideoMode   *prev   = shared->modes;
+
+     D_DEBUG_AT( FBDev_Mode, "%s()\n", __FUNCTION__ );
+
+     if (!(fp = fopen("/etc/fb.modes","r")))
+          return errno2result( errno );
+
+     while (fgets(line,79,fp)) {
+          if (sscanf(line, "mode \"%31[^\"]\"",label) == 1) {
+               memset( &temp_mode, 0, sizeof(VideoMode) );
+
+               geometry = 0;
+               timings = 0;
+
+               while (fgets(line,79,fp) && !(strstr(line,"endmode"))) {
+                    if (5 == sscanf(line," geometry %d %d %d %d %d", &temp_mode.xres, &temp_mode.yres, &dummy, &dummy, &temp_mode.bpp)) {
+                         geometry = 1;
+                    }
+                    else if (7 == sscanf(line," timings %d %d %d %d %d %d %d", &temp_mode.pixclock, &temp_mode.left_margin,  &temp_mode.right_margin,
+                                         &temp_mode.upper_margin, &temp_mode.lower_margin, &temp_mode.hsync_len,    &temp_mode.vsync_len)) {
+                         timings = 1;
+                    }
+                    else if (1 == sscanf(line, " hsync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.hsync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " vsync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.vsync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " csync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.csync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " laced %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.laced = 1;
+                    }
+                    else if (1 == sscanf(line, " double %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.doubled = 1;
+                    }
+                    else if (1 == sscanf(line, " gsync %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.sync_on_green = 1;
+                    }
+                    else if (1 == sscanf(line, " extsync %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.external_sync = 1;
+                    }
+                    else if (1 == sscanf(line, " bcast %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.broadcast = 1;
+                    }
+               }
+
+               if (geometry && timings && !dfb_fbdev_test_mode_simple(&temp_mode)) {
+                    VideoMode *mode = SHCALLOC( shared->shmpool, 1, sizeof(VideoMode) );
+                    if (!mode) {
+                         D_OOSHM();
+                         continue;
+                    }
+
+                    if (!prev)
+                         shared->modes = mode;
+                    else
+                         prev->next = mode;
+
+                    direct_memcpy (mode, &temp_mode, sizeof(VideoMode));
+
+                    prev = mode;
+
+                    D_DEBUG_AT( FBDev_Mode, " +-> %16s %4dx%4d  %s%s\n", label, temp_mode.xres, temp_mode.yres,
+                                temp_mode.laced ? "interlaced " : "", temp_mode.doubled ? "doublescan" : "" );
+               }
+          }
+     }
+
+     fclose (fp);
+
+     return DFB_OK;
+}
+
+/*
+ * some fbdev drivers use the palette as gamma ramp in >8bpp modes, to have
+ * correct colors, the gamme ramp has to be initialized.
+ */
+
+static u16
+dfb_fbdev_calc_gamma(int n, int max)
+{
+     int ret = 65535 * n / max;
+     return CLAMP( ret, 0, 65535 );
+}
+
+static DFBResult
+dfb_fbdev_set_gamma_ramp( DFBSurfacePixelFormat format )
+{
+     int i;
+
+     int red_size   = 0;
+     int green_size = 0;
+     int blue_size  = 0;
+     int red_max    = 0;
+     int green_max  = 0;
+     int blue_max   = 0;
+
+     struct fb_cmap *cmap;
+
+     if (!dfb_fbdev) {
+          D_BUG( "dfb_fbdev_set_gamma_ramp() called while dfb_fbdev == NULL!" );
+
+          return DFB_BUG;
+     }
+
+     switch (format) {
+          case DSPF_ARGB1555:
+          case DSPF_RGB555:
+          case DSPF_BGR555:
+               red_size   = 32;
+               green_size = 32;
+               blue_size  = 32;
+               break;
+          case DSPF_ARGB4444:
+          case DSPF_RGBA4444:
+          case DSPF_RGB444:
+          case DSPF_RGB16:
+               red_size   = 32;
+               green_size = 64;
+               blue_size  = 32;
+               break;
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               red_size   = 256;
+               green_size = 256;
+               blue_size  = 256;
+               break;
+          default:
+               return DFB_OK;
+     }
+
+     /*
+      * ++Tony: The gamma ramp must be set differently if in DirectColor,
+      *         ie, to mimic TrueColor, index == color[index].
+      */
+     if (dfb_fbdev->shared->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+          red_max   = 65536 / (256/red_size);
+          green_max = 65536 / (256/green_size);
+          blue_max  = 65536 / (256/blue_size);
+     }
+     else {
+          red_max   = red_size;
+          green_max = green_size;
+          blue_max  = blue_size;
+     }
+
+     cmap = &dfb_fbdev->shared->current_cmap;
+
+     /* assume green to have most weight */
+     cmap->len = green_size;
+
+     for (i = 0; i < red_size; i++)
+          cmap->red[i] = dfb_fbdev_calc_gamma( i, red_max );
+
+     for (i = 0; i < green_size; i++)
+          cmap->green[i] = dfb_fbdev_calc_gamma( i, green_max );
+
+     for (i = 0; i < blue_size; i++)
+          cmap->blue[i] = dfb_fbdev_calc_gamma( i, blue_max );
+
+     /* ++Tony: Some drivers use the upper byte, some use the lower */
+     if (dfb_fbdev->shared->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+          for (i = 0; i < red_size; i++)
+               cmap->red[i] |= cmap->red[i] << 8;
+
+          for (i = 0; i < green_size; i++)
+               cmap->green[i] |= cmap->green[i] << 8;
+
+          for (i = 0; i < blue_size; i++)
+               cmap->blue[i] |= cmap->blue[i] << 8;
+     }
+
+     if (FBDEV_IOCTL( FBIOPUTCMAP, cmap ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                     "Could not set gamma ramp" );
+
+          return errno2result(errno);
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_fbdev_set_palette( CorePalette *palette )
+{
+     int             i;
+     struct fb_cmap *cmap = &dfb_fbdev->shared->current_cmap;
+
+     D_ASSERT( palette != NULL );
+
+     cmap->len = palette->num_entries <= 256 ? palette->num_entries : 256;
+
+     for (i = 0; i < (int)cmap->len; i++) {
+          cmap->red[i]     = palette->entries[i].r;
+          cmap->green[i]   = palette->entries[i].g;
+          cmap->blue[i]    = palette->entries[i].b;
+          cmap->transp[i]  = 0xff - palette->entries[i].a;
+
+          cmap->red[i]    |= cmap->red[i] << 8;
+          cmap->green[i]  |= cmap->green[i] << 8;
+          cmap->blue[i]   |= cmap->blue[i] << 8;
+          cmap->transp[i] |= cmap->transp[i] << 8;
+     }
+
+     if (FBDEV_IOCTL( FBIOPUTCMAP, cmap ) < 0) {
+          D_PERROR( "DirectFB/FBDev: Could not set the palette!\n" );
+
+          return errno2result(errno);
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_fbdev_set_rgb332_palette( void )
+{
+     DFBResult ret = DFB_OK;
+     int red_val;
+     int green_val;
+     int blue_val;
+     int i = 0;
+     FusionSHMPoolShared *pool = dfb_fbdev->shared->shmpool_data;
+
+     struct fb_cmap cmap;
+
+     if (!dfb_fbdev) {
+          D_BUG( "dfb_fbdev_set_rgb332_palette() called while dfb_fbdev == NULL!" );
+
+          return DFB_BUG;
+     }
+
+     cmap.start  = 0;
+     cmap.len    = 256;
+     cmap.red    = (u16*)SHMALLOC( pool, 2 * 256 );
+     if (!cmap.red) {
+          return D_OOSHM();
+     }
+     cmap.green  = (u16*)SHMALLOC( pool, 2 * 256 );
+     if (!cmap.green) {
+          ret = D_OOSHM();
+          goto free_red;
+     }
+     cmap.blue   = (u16*)SHMALLOC( pool, 2 * 256 );
+     if (!cmap.blue) {
+          ret = D_OOSHM();
+          goto free_green;
+     }
+     cmap.transp = (u16*)SHMALLOC( pool, 2 * 256 );
+     if (!cmap.transp) {
+          ret = D_OOSHM();
+          goto free_blue;
+     }
+
+     for (red_val = 0; red_val  < 8 ; red_val++) {
+          for (green_val = 0; green_val  < 8 ; green_val++) {
+               for (blue_val = 0; blue_val  < 4 ; blue_val++) {
+                    cmap.red[i]    = dfb_fbdev_calc_gamma( red_val, 7 );
+                    cmap.green[i]  = dfb_fbdev_calc_gamma( green_val, 7 );
+                    cmap.blue[i]   = dfb_fbdev_calc_gamma( blue_val, 3 );
+                    cmap.transp[i] = (i ? 0x2000 : 0xffff);
+                    i++;
+               }
+          }
+     }
+
+     if (FBDEV_IOCTL( FBIOPUTCMAP, &cmap ) < 0) {
+          D_PERROR( "DirectFB/FBDev: "
+                     "Could not set rgb332 palette" );
+          ret = errno2result(errno);
+          goto free_transp;
+     }
+
+ free_transp:
+     SHFREE( pool, cmap.transp );
+ free_blue:
+     SHFREE( pool, cmap.blue );
+ free_green:
+     SHFREE( pool, cmap.green );
+ free_red:
+     SHFREE( pool, cmap.red );
+
+     return ret;
+}
+
+static FusionCallHandlerResult
+fbdev_ioctl_call_handler( int           caller,
+                          int           call_arg,
+                          void         *call_ptr,
+                          void         *ctx,
+                          unsigned int  serial,
+                          int          *ret_val )
+{
+     int        ret;
+     const char cursoroff_str[] = "\033[?1;0;0c";
+     const char blankoff_str[] = "\033[9;0]";
+
+     if (dfb_config->vt) {
+          if (!dfb_config->kd_graphics && call_arg == FBIOPUT_VSCREENINFO)
+               ioctl( dfb_fbdev->vt->fd, KDSETMODE, KD_GRAPHICS );
+     }
+
+     ret = ioctl( dfb_fbdev->fd, call_arg, call_ptr );
+     if (ret)
+          ret = errno;
+
+     if (dfb_config->vt) {
+          if (call_arg == FBIOPUT_VSCREENINFO) {
+               if (!dfb_config->kd_graphics) {
+                    ioctl( dfb_fbdev->vt->fd, KDSETMODE, KD_TEXT );
+                    write( dfb_fbdev->vt->fd, cursoroff_str, strlen(cursoroff_str) );
+                    write( dfb_fbdev->vt->fd, blankoff_str, strlen(blankoff_str) );
+               }
+          }
+     }
+
+     *ret_val = ret;
+
+     return FCHR_RETURN;
+}
+
+static int
+fbdev_ioctl( int request, void *arg, int arg_size )
+{
+     int          ret;
+     int          erno;
+     void        *tmp_shm = NULL;
+     FBDevShared *shared;
+
+     D_ASSERT( dfb_fbdev != NULL );
+
+     shared = dfb_fbdev->shared;
+
+     D_ASSERT( shared != NULL );
+
+     if (dfb_core_is_master( dfb_fbdev->core )) {
+          fbdev_ioctl_call_handler( 1, request, arg, NULL, 0, &ret );
+          errno = ret;
+          return errno ? -1 : 0;
+     }
+
+     if (arg) {
+          if (!fusion_is_shared( dfb_core_world(dfb_fbdev->core), arg )) {
+               tmp_shm = SHMALLOC( shared->shmpool, arg_size );
+               if (!tmp_shm) {
+                    errno = ENOMEM;
+                    return -1;
+               }
+
+               direct_memcpy( tmp_shm, arg, arg_size );
+          }
+     }
+
+     ret = fusion_call_execute( &shared->fbdev_ioctl, FCEF_NONE,
+                                request, tmp_shm ? tmp_shm : arg, &erno );
+
+     if (tmp_shm) {
+          direct_memcpy( arg, tmp_shm, arg_size );
+          SHFREE( shared->shmpool, tmp_shm );
+     }
+
+     errno = erno;
+
+     return errno ? -1 : 0;
+}
+
diff --git a/Source/DirectFB/systems/fbdev/fbdev.h b/Source/DirectFB/systems/fbdev/fbdev.h
new file mode 100755
index 0000000..a90a76b
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/fbdev.h
@@ -0,0 +1,142 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __CORE__FBDEV_H__
+#define __CORE__FBDEV_H__
+
+#include <asm/types.h>    /* Needs to be included before dfb_types.h */
+
+#include <core/coretypes.h>
+
+#include <core/layers_internal.h>
+
+#include <core/system.h>
+
+#include <fusion/call.h>
+#include <fusion/reactor.h>
+
+#include "agp.h"
+#include "fb.h"
+#include "surfacemanager.h"
+#include "vt.h"
+
+#ifndef FBIO_WAITFORVSYNC
+#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, u_int32_t)
+#endif
+
+
+typedef struct {
+     /* fbdev fixed screeninfo, contains infos about memory and type of card */
+     struct fb_fix_screeninfo fix;
+
+     VideoMode                *modes;        /* linked list of valid
+                                                video modes */
+     VideoMode                 current_mode; /* current video mode */
+
+     struct fb_var_screeninfo current_var;   /* fbdev variable screeninfo
+                                                set by DirectFB */
+     struct fb_var_screeninfo orig_var;      /* fbdev variable screeninfo
+                                                before DirectFB was started */
+
+     void                    *orig_cmap_memory;
+     void                    *temp_cmap_memory;
+     void                    *current_cmap_memory;
+
+     struct fb_cmap           orig_cmap;     /* original palette */
+
+     struct fb_cmap           current_cmap;  /* our copy of the cmap */
+
+     struct fb_cmap           temp_cmap;     /* scratch */
+
+     FusionCall               fbdev_ioctl;   /* ioctl rpc */
+
+     unsigned long            page_mask;     /* PAGE_SIZE - 1 */
+
+     CoreSurfacePool          *pool;
+     
+     struct {
+          int                 bus;
+          int                 dev;
+          int                 func;
+     } pci;                                  /* PCI Bus ID of graphics device */
+     
+     struct {
+          unsigned short      vendor;        /* Graphics device vendor id */
+          unsigned short      model;         /* Graphics device model id */
+     } device;
+
+     AGPShared               *agp;
+
+     FusionSHMPoolShared     *shmpool;
+     FusionSHMPoolShared     *shmpool_data;
+
+     CoreLayerRegionConfig    config;
+
+     SurfaceManager          *manager;
+} FBDevShared;
+
+typedef struct {
+     FBDevShared             *shared;
+
+     CoreDFB                 *core;
+
+     /* virtual framebuffer address */
+     void                    *framebuffer_base;
+
+     int                      fd;            /* file descriptor for /dev/fb */
+
+     VirtualTerminal         *vt;
+
+     AGPDevice               *agp;
+} FBDev;
+
+/*
+ * core init function, opens /dev/fb, get fbdev screeninfo
+ * disables font acceleration, reads mode list
+ */
+DFBResult dfb_fbdev_initialize( void );
+DFBResult dfb_fbdev_join( void );
+
+/*
+ * deinitializes DirectFB fbdev stuff and restores fbdev settings
+ */
+DFBResult dfb_fbdev_shutdown( bool emergency );
+DFBResult dfb_fbdev_leave   ( bool emergency );
+
+const VideoMode *dfb_fbdev_find_mode( int                          width,
+                                      int                          height );
+DFBResult dfb_fbdev_test_mode       ( const VideoMode             *mode,
+                                      const CoreLayerRegionConfig *config );
+DFBResult dfb_fbdev_test_mode_simple( const VideoMode             *mode );
+
+DFBResult dfb_fbdev_set_mode        ( const VideoMode             *mode,
+                                      CoreSurface                 *surface,
+                                      unsigned int                 xoffset,
+                                      unsigned int                 yoffset );
+
+#endif
diff --git a/Source/DirectFB/systems/fbdev/fbdev_surface_pool.c b/Source/DirectFB/systems/fbdev/fbdev_surface_pool.c
new file mode 100755
index 0000000..c5454a6
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/fbdev_surface_pool.c
@@ -0,0 +1,423 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>
+
+#include <config.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include "fbdev.h"
+#include "surfacemanager.h"
+
+extern FBDev *dfb_fbdev;
+
+D_DEBUG_DOMAIN( FBDev_Surfaces, "FBDev/Surfaces", "FBDev Framebuffer Surface Pool" );
+D_DEBUG_DOMAIN( FBDev_SurfLock, "FBDev/SurfLock", "FBDev Framebuffer Surface Pool Locks" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int             magic;
+
+     SurfaceManager *manager;
+} FBDevPoolData;
+
+typedef struct {
+     int             magic;
+
+     CoreDFB        *core;
+} FBDevPoolLocalData;
+
+typedef struct {
+     int    magic;
+
+     int   offset;
+     int   pitch;
+     int   size;
+
+     Chunk *chunk;
+} FBDevAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+fbdevPoolDataSize( void )
+{
+     return sizeof(FBDevPoolData);
+}
+
+static int
+fbdevPoolLocalDataSize( void )
+{
+     return sizeof(FBDevPoolLocalData);
+}
+
+static int
+fbdevAllocationDataSize( void )
+{
+     return sizeof(FBDevAllocationData);
+}
+
+static DFBResult
+fbdevInitPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data,
+               CoreSurfacePoolDescription *ret_desc )
+{
+     DFBResult           ret;
+     FBDevPoolData      *data  = pool_data;
+     FBDevPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( data != NULL );
+     D_ASSERT( local != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     ret = dfb_surfacemanager_create( core, dfb_fbdev->shared->fix.smem_len, &data->manager );
+     if (ret)
+          return ret;
+
+     ret_desc->caps              = CSPCAPS_PHYSICAL | CSPCAPS_VIRTUAL;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+
+     /* For hardware layers */
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER1] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER2] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER3] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER4] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER5] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER6] = CSAF_READ;
+     ret_desc->access[CSAID_LAYER7] = CSAF_READ;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Frame Buffer Memory" );
+
+     local->core = core;
+
+     D_MAGIC_SET( data, FBDevPoolData );
+     D_MAGIC_SET( local, FBDevPoolLocalData );
+
+
+     D_ASSERT( dfb_fbdev != NULL );
+     D_ASSERT( dfb_fbdev->shared != NULL );
+
+     dfb_fbdev->shared->manager = data->manager;
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevJoinPool( CoreDFB                    *core,
+               CoreSurfacePool            *pool,
+               void                       *pool_data,
+               void                       *pool_local,
+               void                       *system_data )
+{
+     FBDevPoolData      *data  = pool_data;
+     FBDevPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_ASSERT( local != NULL );
+
+     (void) data;
+
+     local->core = core;
+
+     D_MAGIC_SET( local, FBDevPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevDestroyPool( CoreSurfacePool *pool,
+                  void            *pool_data,
+                  void            *pool_local )
+{
+     FBDevPoolData      *data  = pool_data;
+     FBDevPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_MAGIC_ASSERT( local, FBDevPoolLocalData );
+
+     dfb_surfacemanager_destroy( data->manager );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevLeavePool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     FBDevPoolData      *data  = pool_data;
+     FBDevPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_MAGIC_ASSERT( local, FBDevPoolLocalData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevTestConfig( CoreSurfacePool         *pool,
+                 void                    *pool_data,
+                 void                    *pool_local,
+                 CoreSurfaceBuffer       *buffer,
+                 const CoreSurfaceConfig *config )
+{
+     DFBResult           ret;
+     CoreSurface        *surface;
+     FBDevPoolData      *data  = pool_data;
+     FBDevPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_MAGIC_ASSERT( local, FBDevPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == DLID_PRIMARY)
+          return DFB_OK;
+
+     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, NULL, NULL );
+
+     D_DEBUG_AT( FBDev_Surfaces, "  -> %s\n", DirectFBErrorString(ret) );
+
+     return ret;
+}
+
+static DFBResult
+fbdevAllocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     DFBResult            ret;
+     CoreSurface         *surface;
+     FBDevPoolData       *data  = pool_data;
+     FBDevPoolLocalData  *local = pool_local;
+     FBDevAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_MAGIC_ASSERT( local, FBDevPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if ((surface->type & CSTF_LAYER) && surface->resource_id == DLID_PRIMARY) {
+          FBDevShared *shared = dfb_fbdev->shared;
+          int          index  = dfb_surface_buffer_index( buffer );
+
+          D_DEBUG_AT( FBDev_Surfaces, "  -> primary layer buffer (index %d)\n", index );
+
+          if (index == 0) {
+               const VideoMode *highest;
+               /* FIXME: this should use source.w/source.h from layer region config! */
+               unsigned int     width  = surface->config.size.w;
+               unsigned int     height = surface->config.size.h;
+
+               D_INFO( "FBDev/Mode: Setting %dx%d %s\n", width, height, dfb_pixelformat_name(surface->config.format) );
+
+               highest = dfb_fbdev_find_mode( width, height );
+               if (!highest)
+                    return DFB_UNSUPPORTED;
+
+               ret = dfb_fbdev_set_mode( highest, surface, 0, 0 );
+               if (ret)
+                    return ret;
+          }
+
+          alloc->pitch  = shared->fix.line_length;
+          alloc->size   = surface->config.size.h * alloc->pitch;
+          alloc->offset = index * alloc->size;
+
+          D_INFO( "FBDev/Surface: Allocated %dx%d %d bit %s buffer (index %d) at offset %d and pitch %d.\n",
+                  surface->config.size.w, surface->config.size.h, shared->current_var.bits_per_pixel,
+                  dfb_pixelformat_name(buffer->format), index, alloc->offset, alloc->pitch );
+     }
+     else {
+          Chunk *chunk;
+
+          ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, allocation, &chunk );
+          if (ret)
+               return ret;
+
+          D_MAGIC_ASSERT( chunk, Chunk );
+
+          alloc->offset = chunk->offset;
+          alloc->pitch  = chunk->pitch;
+          alloc->size   = chunk->length;
+
+          alloc->chunk  = chunk;
+     }
+
+     D_DEBUG_AT( FBDev_Surfaces, "  -> offset %d, pitch %d, size %d\n", alloc->offset, alloc->pitch, alloc->size );
+
+     allocation->size   = alloc->size;
+     allocation->offset = alloc->offset;
+
+     D_MAGIC_SET( alloc, FBDevAllocationData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevDeallocateBuffer( CoreSurfacePool       *pool,
+                       void                  *pool_data,
+                       void                  *pool_local,
+                       CoreSurfaceBuffer     *buffer,
+                       CoreSurfaceAllocation *allocation,
+                       void                  *alloc_data )
+{
+     FBDevPoolData       *data  = pool_data;
+     FBDevAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( FBDev_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, FBDevPoolData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, FBDevAllocationData );
+
+     if (alloc->chunk)
+          dfb_surfacemanager_deallocate( data->manager, alloc->chunk );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevLock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     FBDevAllocationData *alloc  = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, FBDevAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( FBDev_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     lock->pitch  = alloc->pitch;
+     lock->offset = alloc->offset;
+     lock->addr   = dfb_fbdev->framebuffer_base + alloc->offset;
+     lock->phys   = dfb_fbdev->shared->fix.smem_start + alloc->offset;
+
+     D_DEBUG_AT( FBDev_SurfLock, "  -> offset %lu, pitch %d, addr %p, phys 0x%08lx\n",
+                 lock->offset, lock->pitch, lock->addr, lock->phys );
+
+     return DFB_OK;
+}
+
+static DFBResult
+fbdevUnlock( CoreSurfacePool       *pool,
+             void                  *pool_data,
+             void                  *pool_local,
+             CoreSurfaceAllocation *allocation,
+             void                  *alloc_data,
+             CoreSurfaceBufferLock *lock )
+{
+     FBDevAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, FBDevAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( FBDev_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs fbdevSurfacePoolFuncs = {
+     .PoolDataSize       = fbdevPoolDataSize,
+     .PoolLocalDataSize  = fbdevPoolLocalDataSize,
+     .AllocationDataSize = fbdevAllocationDataSize,
+
+     .InitPool           = fbdevInitPool,
+     .JoinPool           = fbdevJoinPool,
+     .DestroyPool        = fbdevDestroyPool,
+     .LeavePool          = fbdevLeavePool,
+
+     .TestConfig         = fbdevTestConfig,
+     .AllocateBuffer     = fbdevAllocateBuffer,
+     .DeallocateBuffer   = fbdevDeallocateBuffer,
+
+     .Lock               = fbdevLock,
+     .Unlock             = fbdevUnlock,
+};
+
diff --git a/Source/DirectFB/systems/fbdev/surfacemanager.c b/Source/DirectFB/systems/fbdev/surfacemanager.c
new file mode 100755
index 0000000..811288b
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/surfacemanager.c
@@ -0,0 +1,617 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/shmalloc.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <core/core.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#include "surfacemanager.h"
+
+D_DEBUG_DOMAIN( SurfMan, "SurfaceManager", "DirectFB Surface Manager" );
+
+
+static Chunk *split_chunk ( SurfaceManager *manager,
+                            Chunk          *chunk,
+                            int             length );
+
+static Chunk *free_chunk  ( SurfaceManager *manager,
+                            Chunk          *chunk );
+
+static Chunk *occupy_chunk( SurfaceManager        *manager,
+                            Chunk                 *chunk,
+                            CoreSurfaceAllocation *allocation,
+                            int                    length,
+                            int                    pitch );
+
+
+DFBResult
+dfb_surfacemanager_create( CoreDFB         *core,
+                           unsigned int     length,
+                           SurfaceManager **ret_manager )
+{
+     FusionSHMPoolShared *pool;
+     SurfaceManager      *manager;
+     Chunk               *chunk;
+
+     D_DEBUG_AT( SurfMan, "%s( %p, %d )\n", __FUNCTION__, core, length );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( ret_manager != NULL );
+
+     pool = dfb_core_shmpool( core );
+
+     manager = SHCALLOC( pool, 1, sizeof(SurfaceManager) );
+     if (!manager)
+          return D_OOSHM();
+
+     chunk = SHCALLOC( pool, 1, sizeof(Chunk) );
+     if (!chunk) {
+          D_OOSHM();
+          SHFREE( pool, manager );
+          return DFB_NOSHAREDMEMORY;
+     }
+
+     manager->shmpool = pool;
+     manager->chunks  = chunk;
+     manager->offset  = 0;
+     manager->length  = length;
+     manager->avail   = manager->length - manager->offset;
+
+     D_MAGIC_SET( manager, SurfaceManager );
+
+     chunk->offset    = manager->offset;
+     chunk->length    = manager->avail;
+
+     D_MAGIC_SET( chunk, Chunk );
+
+     D_DEBUG_AT( SurfMan, "  -> %p\n", manager );
+
+     *ret_manager = manager;
+
+     return DFB_OK;
+}
+
+void
+dfb_surfacemanager_destroy( SurfaceManager *manager )
+{
+     Chunk *chunk;
+     void  *next;
+
+     D_DEBUG_AT( SurfMan, "%s( %p )\n", __FUNCTION__, manager );
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+
+     /* Deallocate all video chunks. */
+     chunk = manager->chunks;
+     while (chunk) {
+          next = chunk->next;
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+
+          chunk = next;
+     }
+
+     D_MAGIC_CLEAR( manager );
+
+     /* Deallocate manager struct. */
+     SHFREE( manager->shmpool, manager );
+}
+
+DFBResult dfb_surfacemanager_adjust_heap_offset( SurfaceManager *manager,
+                                                 int             offset )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_ASSERT( offset >= 0 );
+
+     D_DEBUG_AT( SurfMan, "%s( %p, %d )\n", __FUNCTION__, manager, offset );
+
+/*FIXME_SC_2     if (manager->limits.surface_byteoffset_alignment > 1) {
+          offset += manager->limits.surface_byteoffset_alignment - 1;
+          offset -= offset % manager->limits.surface_byteoffset_alignment;
+     }
+*/
+     /*
+      * Adjust the offset of the heap.
+      */
+     if (manager->chunks->buffer == NULL) {
+          /* first chunk is free */
+          if (offset <= manager->chunks->offset + manager->chunks->length) {
+               /* ok, just recalculate offset and length */
+               manager->chunks->length = manager->chunks->offset +
+                                         manager->chunks->length - offset;
+               manager->chunks->offset = offset;
+          }
+          else {
+               D_WARN("unable to adjust heap offset");
+               /* more space needed than free at the beginning */
+               /* TODO: move/destroy instances */
+          }
+     }
+     else {
+          D_WARN("unable to adjust heap offset");
+          /* very rare case that the first chunk is occupied */
+          /* TODO: move/destroy instances */
+     }
+
+     manager->avail -= offset - manager->offset;
+     manager->offset = offset;
+
+     return DFB_OK;
+}
+
+/** public functions NOT locking the surfacemanger theirself,
+    to be called between lock/unlock of surfacemanager **/
+
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk )
+{
+     int pitch;
+     int length;
+     Chunk *c;
+     CoreGraphicsDevice *device;
+
+     Chunk *best_free = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     if (ret_chunk)
+          D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     else
+          D_ASSUME( allocation == NULL );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     if (manager->suspended)
+          return DFB_SUSPENDED;
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( device, buffer, &pitch, &length );
+
+     D_DEBUG_AT( SurfMan, "  -> pitch %d, length %d\n", pitch, length );
+
+     if (manager->avail < length)
+          return DFB_TEMPUNAVAIL;
+
+     /* examine chunks */
+     c = manager->chunks;
+     D_MAGIC_ASSERT( c, Chunk );
+
+     /* FIXME_SC_2  Workaround creation happening before graphics driver initialization. */
+     if (!c->next) {
+          int length = dfb_gfxcard_memory_length();
+
+          if (c->length != length - manager->offset) {
+               D_WARN( "workaround" );
+
+               manager->length = length;
+               manager->avail  = length - manager->offset;
+
+               c->length = length - manager->offset;
+          }
+     }
+
+     while (c) {
+          D_MAGIC_ASSERT( c, Chunk );
+
+          if (!c->buffer && c->length >= length) {
+               /* NULL means check only. */
+               if (!ret_chunk)
+                    return DFB_OK;
+
+               /* found a nice place to chill */
+               if (!best_free  ||  best_free->length > c->length)
+                    /* first found or better one? */
+                    best_free = c;
+
+               if (c->length == length)
+                    break;
+          }
+
+          c = c->next;
+     }
+
+     /* if we found a place */
+     if (best_free) {
+          D_DEBUG_AT( SurfMan, "  -> found free (%d)\n", best_free->length );
+
+          /* NULL means check only. */
+          if (ret_chunk)
+               *ret_chunk = occupy_chunk( manager, best_free, allocation, length, pitch );
+
+          return DFB_OK;
+     }
+
+     D_DEBUG_AT( SurfMan, "  -> failed (%d/%d avail)\n", manager->avail, manager->length );
+
+     /* no luck */
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer )
+{
+     int                    length;
+     Chunk                 *multi_start = NULL;
+     int                    multi_size  = 0;
+     int                    multi_tsize = 0;
+     int                    multi_count = 0;
+     Chunk                 *bestm_start = NULL;
+     int                    bestm_count = 0;
+     int                    bestm_size  = 0;
+     int                    min_toleration;
+     Chunk                 *chunk;
+     CoreGraphicsDevice    *device;
+     CoreSurfaceAllocation *smallest = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( dfb_core_get_part( core, DFCP_GRAPHICS ), buffer, NULL, &length );
+
+     min_toleration = manager->min_toleration/8 + 2;
+
+     D_DEBUG_AT( SurfMan, "  -> %7d required, min toleration %d\n", length, min_toleration );
+
+     chunk = manager->chunks;
+     while (chunk) {
+          CoreSurfaceAllocation *allocation;
+
+          D_MAGIC_ASSERT( chunk, Chunk );
+
+          allocation = chunk->allocation;
+          if (allocation) {
+               CoreSurfaceBuffer *other;
+               int                size;
+
+               D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+               D_ASSERT( chunk->buffer == allocation->buffer );
+               D_ASSERT( chunk->length >= allocation->size );
+
+               other = allocation->buffer;
+               D_MAGIC_ASSERT( other, CoreSurfaceBuffer );
+
+               if (other->locked) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d locked %dx\n", allocation->size, other->locked );
+                    goto next_reset;
+               }
+
+               if (other->policy > buffer->policy) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy %d > %d\n", allocation->size, other->policy, buffer->policy );
+                    goto next_reset;
+               }
+
+               if (other->policy == CSP_VIDEOONLY) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy videoonly\n", allocation->size );
+                    goto next_reset;
+               }
+
+               chunk->tolerations++;
+               if (chunk->tolerations > 0xff)
+                    chunk->tolerations = 0xff;
+
+               if (other->policy == buffer->policy && chunk->tolerations < min_toleration) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d tolerations %d/%d\n",
+                                allocation->size, chunk->tolerations, min_toleration );
+                    goto next_reset;
+               }
+
+               size = allocation->size;
+
+               if (chunk->prev && !chunk->prev->allocation)
+                    size += chunk->prev->length;
+
+               if (chunk->next && !chunk->next->allocation)
+                    size += chunk->next->length;
+
+               if (size >= length) {
+                    if (!smallest || smallest->size > allocation->size) {
+                         D_DEBUG_AT( SurfMan, "  => %7d [%d] < %d, tolerations %d\n",
+                                     allocation->size, size, smallest ? smallest->size : 0, chunk->tolerations );
+
+                         smallest = allocation;
+                    }
+                    else
+                         D_DEBUG_AT( SurfMan, "  -> %7d [%d] > %d\n", allocation->size, size, smallest->size );
+               }
+               else
+                    D_DEBUG_AT( SurfMan, "  -> %7d [%d]\n", allocation->size, size );
+          }
+          else
+               D_DEBUG_AT( SurfMan, "  -  %7d free\n", chunk->length );
+
+
+          if (!smallest) {
+               if (!multi_start) {
+                    multi_start = chunk;
+                    multi_tsize = chunk->length;
+                    multi_size  = chunk->allocation ? chunk->length : 0;
+                    multi_count = chunk->allocation ? 1 : 0;
+               }
+               else {
+                    multi_tsize += chunk->length;
+                    multi_size  += chunk->allocation ? chunk->length : 0;
+                    multi_count += chunk->allocation ? 1 : 0;
+
+                    while (multi_tsize >= length && multi_count > 1) {
+                         if (!bestm_start || bestm_size > multi_size * multi_count / bestm_count) {
+                              D_DEBUG_AT( SurfMan, "                =====> %7d, %7d %2d used [%7d %2d]\n",
+                                          multi_tsize, multi_size, multi_count, bestm_size, bestm_count );
+
+                              bestm_size  = multi_size;
+                              bestm_start = multi_start;
+                              bestm_count = multi_count;
+                         }
+                         else
+                              D_DEBUG_AT( SurfMan, "                -----> %7d, %7d %2d used\n",
+                                          multi_tsize, multi_size, multi_count );
+
+                         if (multi_count <= 2)
+                              break;
+
+                         if (!multi_start->allocation) {
+                              multi_tsize -= multi_start->length;
+                              multi_start  = multi_start->next;
+                         }
+
+                         D_ASSUME( multi_start->allocation != NULL );
+
+                         multi_tsize -= multi_start->length;
+                         multi_size  -= multi_start->allocation ? multi_start->length : 0;
+                         multi_count -= multi_start->allocation ? 1 : 0;
+                         multi_start  = multi_start->next;
+                    }
+               }
+          }
+
+          chunk = chunk->next;
+
+          continue;
+
+
+next_reset:
+          multi_start = NULL;
+
+          chunk = chunk->next;
+     }
+
+     if (smallest) {
+          D_MAGIC_ASSERT( smallest, CoreSurfaceAllocation );
+          D_MAGIC_ASSERT( smallest->buffer, CoreSurfaceBuffer );
+
+          smallest->flags |= CSALF_MUCKOUT;
+
+          D_DEBUG_AT( SurfMan, "  -> offset %lu, size %d\n", smallest->offset, smallest->size );
+
+          return DFB_OK;
+     }
+
+     if (bestm_start) {
+          chunk = bestm_start;
+
+          while (bestm_count) {
+               CoreSurfaceAllocation *allocation = chunk->allocation;
+
+               if (allocation) {
+                    D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+                    D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+
+                    allocation->flags |= CSALF_MUCKOUT;
+
+                    bestm_count--;
+               }
+
+               D_DEBUG_AT( SurfMan, "  ---> offset %d, length %d\n", chunk->offset, chunk->length );
+
+               chunk = chunk->next;
+          }
+
+          return DFB_OK;
+     }
+
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk )
+{
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     buffer = chunk->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     free_chunk( manager, chunk );
+
+     return DFB_OK;
+}
+
+/** internal functions NOT locking the surfacemanager **/
+
+static Chunk *
+split_chunk( SurfaceManager *manager, Chunk *c, int length )
+{
+     Chunk *newchunk;
+
+     D_MAGIC_ASSERT( c, Chunk );
+
+     if (c->length == length)          /* does not need be splitted */
+          return c;
+
+     newchunk = (Chunk*) SHCALLOC( manager->shmpool, 1, sizeof(Chunk) );
+     if (!newchunk) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     /* calculate offsets and lengths of resulting chunks */
+     newchunk->offset = c->offset + c->length - length;
+     newchunk->length = length;
+     c->length -= newchunk->length;
+
+     /* insert newchunk after chunk c */
+     newchunk->prev = c;
+     newchunk->next = c->next;
+     if (c->next)
+          c->next->prev = newchunk;
+     c->next = newchunk;
+
+     D_MAGIC_SET( newchunk, Chunk );
+
+     return newchunk;
+}
+
+static Chunk *
+free_chunk( SurfaceManager *manager, Chunk *chunk )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     if (!chunk->buffer) {
+          D_BUG( "freeing free chunk" );
+          return chunk;
+     }
+     else {
+          D_DEBUG_AT( SurfMan, "Deallocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+     }
+
+     if (chunk->buffer->policy == CSP_VIDEOONLY)
+          manager->avail += chunk->length;
+
+     chunk->allocation = NULL;
+     chunk->buffer     = NULL;
+
+     manager->min_toleration--;
+
+     if (chunk->prev  &&  !chunk->prev->buffer) {
+          Chunk *prev = chunk->prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with previous chunk at %d\n", prev->offset );
+
+          prev->length += chunk->length;
+
+          prev->next = chunk->next;
+          if (prev->next)
+               prev->next->prev = prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> freeing %p (prev %p, next %p)\n", chunk, chunk->prev, chunk->next);
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+          chunk = prev;
+     }
+
+     if (chunk->next  &&  !chunk->next->buffer) {
+          Chunk *next = chunk->next;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with next chunk at %d\n", next->offset );
+
+          chunk->length += next->length;
+
+          chunk->next = next->next;
+          if (chunk->next)
+               chunk->next->prev = chunk;
+
+          D_MAGIC_CLEAR( next );
+
+          SHFREE( manager->shmpool, next );
+     }
+
+     return chunk;
+}
+
+static Chunk *
+occupy_chunk( SurfaceManager *manager, Chunk *chunk, CoreSurfaceAllocation *allocation, int length, int pitch )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+
+     if (allocation->buffer->policy == CSP_VIDEOONLY)
+          manager->avail -= length;
+
+     chunk = split_chunk( manager, chunk, length );
+     if (!chunk)
+          return NULL;
+
+     D_DEBUG_AT( SurfMan, "Allocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+
+     chunk->allocation = allocation;
+     chunk->buffer     = allocation->buffer;
+     chunk->pitch      = pitch;
+
+     manager->min_toleration++;
+
+     return chunk;
+}
+
diff --git a/Source/DirectFB/systems/fbdev/surfacemanager.h b/Source/DirectFB/systems/fbdev/surfacemanager.h
new file mode 100755
index 0000000..f7812d1
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/surfacemanager.h
@@ -0,0 +1,117 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SURFACEMANAGER_H__
+#define __SURFACEMANAGER_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+typedef struct _SurfaceManager SurfaceManager;
+typedef struct _Chunk          Chunk;
+
+/*
+ * initially there is one big free chunk,
+ * chunks are splitted into a free and an occupied chunk if memory is allocated,
+ * two chunks are merged to one free chunk if memory is deallocated
+ */
+struct _Chunk {
+     int                  magic;
+
+     int                  offset;      /* offset in memory,
+                                          is greater or equal to the heap offset */
+     int                  length;      /* length of this chunk in bytes */
+
+     int                  pitch;
+     
+     CoreSurfaceBuffer   *buffer;      /* pointer to surface buffer occupying
+                                          this chunk, or NULL if chunk is free */
+     CoreSurfaceAllocation *allocation;
+
+     int                  tolerations; /* number of times this chunk was scanned
+                                          occupied, resetted in assure_video */
+
+     Chunk               *prev;
+     Chunk               *next;
+};
+
+struct _SurfaceManager {
+     int                  magic;
+
+     FusionSHMPoolShared *shmpool;
+
+     Chunk               *chunks;
+
+     int                  offset;
+     int                  length;         /* length of the heap in bytes */
+     int                  avail;          /* amount of available memory in bytes */
+
+     int                  min_toleration;
+     
+     bool                 suspended;
+};
+
+
+DFBResult dfb_surfacemanager_create ( CoreDFB             *core,
+                                      unsigned int         length,
+                                      SurfaceManager     **ret_manager );
+
+void      dfb_surfacemanager_destroy( SurfaceManager      *manager );
+
+/*
+ * adjust the offset within the framebuffer for surface storage,
+ * needs to be called after a resolution switch
+ */
+DFBResult dfb_surfacemanager_adjust_heap_offset( SurfaceManager *manager,
+                                                 int             offset );
+
+/*
+ * finds and allocates one for the surface or fails,
+ * after success the video health is CSH_RESTORE.
+ * NOTE: this does not notify the listeners
+ */
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk );
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer );
+
+/*
+ * sets the video health to CSH_INVALID frees the chunk and
+ * notifies the listeners
+ */
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk );
+
+#endif
+
diff --git a/Source/DirectFB/systems/fbdev/vt.c b/Source/DirectFB/systems/fbdev/vt.c
new file mode 100755
index 0000000..02bad77
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/vt.c
@@ -0,0 +1,675 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <asm/types.h>    /* Needs to be included before dfb_types.h */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/vt.h>
+#include <sys/kd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include <directfb.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+#include <direct/util.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/gfxcard.h>
+
+#include "fbdev.h"
+#include "fb.h"
+#include "vt.h"
+
+D_DEBUG_DOMAIN( VT, "FBDev/VT", "FBDev System Module VT Handling" );
+
+/*
+ *  FIXME: the following looks like a bad hack.
+ *
+ *  SIGUNUSED is no longer unused, but is defined for backwards compatibility.
+ *  sparc, mips and alpha signal.h however do not define SIGUNUSED.
+ */
+
+#ifdef SIGUNUSED
+     #define SIG_SWITCH_FROM  (SIGUNUSED + 10)
+     #define SIG_SWITCH_TO    (SIGUNUSED + 11)
+#else
+     #define SIG_SWITCH_FROM  (31 + 10)
+     #define SIG_SWITCH_TO    (31 + 11)
+#endif
+
+#ifndef SI_KERNEL
+/* glibc 2.1.x doesn't have this in /usr/include/bits/siginfo.h */
+     #define SI_KERNEL 0x80
+#endif
+
+
+extern FBDev *dfb_fbdev;
+
+static VirtualTerminal *dfb_vt = NULL;
+
+static DFBResult vt_init_switching( void );
+static int       vt_get_fb( int vt );
+static void      vt_set_fb( int vt, int fb );
+static void     *vt_thread( DirectThread *thread, void *arg );
+
+static void      vt_start_flushing( void );
+static void      vt_stop_flushing( void );
+static void     *vt_flush_thread( DirectThread *thread, void *arg );
+
+DFBResult
+dfb_vt_initialize( void )
+{
+     DFBResult ret;
+     struct vt_stat vs;
+
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     dfb_vt = D_CALLOC( 1, sizeof(VirtualTerminal) );
+     if (!dfb_vt)
+          return D_OOM();
+
+     setsid();
+     dfb_vt->fd0 = open( "/dev/tty0", O_RDONLY | O_NOCTTY );
+     if (dfb_vt->fd0 < 0) {
+          if (errno == ENOENT) {
+               dfb_vt->fd0 = open( "/dev/vc/0", O_RDONLY | O_NOCTTY );
+               if (dfb_vt->fd0 < 0) {
+                    if (errno == ENOENT) {
+                         D_PERROR( "DirectFB/core/vt: Couldn't open "
+                                    "neither `/dev/tty0' nor `/dev/vc/0'!\n" );
+                    }
+                    else {
+                         D_PERROR( "DirectFB/core/vt: "
+                                    "Error opening `/dev/vc/0'!\n" );
+                    }
+
+                    D_FREE( dfb_vt );
+                    dfb_vt = NULL;
+
+                    return DFB_INIT;
+               }
+          }
+          else {
+               D_PERROR( "DirectFB/core/vt: Error opening `/dev/tty0'!\n");
+
+               D_FREE( dfb_vt );
+               dfb_vt = NULL;
+
+               return DFB_INIT;
+          }
+     }
+
+     if (ioctl( dfb_vt->fd0, VT_GETSTATE, &vs ) < 0) {
+          D_PERROR( "DirectFB/core/vt: VT_GETSTATE failed!\n" );
+          close( dfb_vt->fd0 );
+          D_FREE( dfb_vt );
+          dfb_vt = NULL;
+          return DFB_INIT;
+     }
+
+     dfb_vt->prev = vs.v_active;
+
+
+     if (!dfb_config->vt_switch) {
+          if (dfb_config->vt_num != -1)
+               dfb_vt->num = dfb_config->vt_num;
+          else
+               dfb_vt->num = dfb_vt->prev;
+
+          /* move vt to framebuffer */
+          dfb_vt->old_fb = vt_get_fb( dfb_vt->num );
+          vt_set_fb( dfb_vt->num, -1 );
+     }
+     else {
+          if (dfb_config->vt_num == -1) {
+               int n;
+
+               n = ioctl( dfb_vt->fd0, VT_OPENQRY, &dfb_vt->num );
+               if (n < 0 || dfb_vt->num == -1) {
+                    D_PERROR( "DirectFB/core/vt: Cannot allocate VT!\n" );
+                    close( dfb_vt->fd0 );
+                    D_FREE( dfb_vt );
+                    dfb_vt = NULL;
+                    return DFB_INIT;
+               }
+          }
+          else {
+               dfb_vt->num = dfb_config->vt_num;
+          }
+
+          /* move vt to framebuffer */
+          dfb_vt->old_fb = vt_get_fb( dfb_vt->num );
+          vt_set_fb( dfb_vt->num, -1 );
+
+          /* switch to vt */
+          while (ioctl( dfb_vt->fd0, VT_ACTIVATE, dfb_vt->num ) < 0) {
+               if (errno == EINTR)
+                    continue;
+               D_PERROR( "DirectFB/core/vt: VT_ACTIVATE failed!\n" );
+               close( dfb_vt->fd0 );
+               D_FREE( dfb_vt );
+               dfb_vt = NULL;
+               return DFB_INIT;
+          }
+
+          while (ioctl( dfb_vt->fd0, VT_WAITACTIVE, dfb_vt->num ) < 0) {
+               if (errno == EINTR)
+                    continue;
+               D_PERROR( "DirectFB/core/vt: VT_WAITACTIVE failed!\n" );
+               close( dfb_vt->fd0 );
+               D_FREE( dfb_vt );
+               dfb_vt = NULL;
+               return DFB_INIT;
+          }
+
+          usleep( 40000 );
+     }
+
+     ret = vt_init_switching();
+     if (ret) {
+          if (dfb_config->vt_switch) {
+               D_DEBUG_AT( VT, "  -> switching back...\n" );
+               ioctl( dfb_vt->fd0, VT_ACTIVATE, dfb_vt->prev );
+               ioctl( dfb_vt->fd0, VT_WAITACTIVE, dfb_vt->prev );
+               D_DEBUG_AT( VT, "  -> ...switched back\n" );
+               ioctl( dfb_vt->fd0, VT_DISALLOCATE, dfb_vt->num );
+          }
+
+          close( dfb_vt->fd0 );
+          D_FREE( dfb_vt );
+          dfb_vt = NULL;
+          return ret;
+     }
+
+     vt_start_flushing();
+
+     dfb_fbdev->vt = dfb_vt;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_vt_join( void )
+{
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     dfb_vt_detach( true );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_vt_shutdown( bool emergency )
+{
+     const char cursoron_str[] = "\033[?0;0;0c";
+     const char blankon_str[] = "\033[9;10]";
+
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     if (!dfb_vt)
+          return DFB_OK;
+
+     vt_stop_flushing();
+
+     if (dfb_config->vt_switching) {
+          if (ioctl( dfb_vt->fd, VT_SETMODE, &dfb_vt->vt_mode ) < 0)
+               D_PERROR( "DirectFB/fbdev/vt: Unable to restore VT mode!!!\n" );
+
+          sigaction( SIG_SWITCH_FROM, &dfb_vt->sig_usr1, NULL );
+          sigaction( SIG_SWITCH_TO, &dfb_vt->sig_usr2, NULL );
+
+          direct_thread_cancel( dfb_vt->thread );
+          direct_thread_join( dfb_vt->thread );
+          direct_thread_destroy( dfb_vt->thread );
+
+          pthread_mutex_destroy( &dfb_vt->lock );
+          pthread_cond_destroy( &dfb_vt->wait );
+     }
+
+     if (dfb_config->kd_graphics) {
+          if (ioctl( dfb_vt->fd, KDSETMODE, KD_TEXT ) < 0)
+               D_PERROR( "DirectFB/fbdev/vt: KD_TEXT failed!\n" );
+     }
+     else {
+          write( dfb_vt->fd, blankon_str, sizeof(blankon_str) );
+     }
+     write( dfb_vt->fd, cursoron_str, sizeof(cursoron_str) );
+
+     if (tcsetattr( dfb_vt->fd, TCSAFLUSH, &dfb_vt->old_ts ) < 0)
+          D_PERROR("DirectFB/fbdev/vt: tcsetattr for original values failed!\n");
+
+     if (ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE ) < 0)
+          D_PERROR( "DirectFB/fbdev/vt: K_XLATE failed!\n" );
+
+     if (dfb_config->vt_switch) {
+          D_DEBUG_AT( VT, "  -> switching back...\n" );
+
+          if (ioctl( dfb_vt->fd0, VT_ACTIVATE, dfb_vt->prev ) < 0)
+               D_PERROR( "DirectFB/core/vt: VT_ACTIVATE" );
+
+          if (ioctl( dfb_vt->fd0, VT_WAITACTIVE, dfb_vt->prev ) < 0)
+               D_PERROR( "DirectFB/core/vt: VT_WAITACTIVE" );
+
+          D_DEBUG_AT( VT, "  -> switched back...\n" );
+
+          usleep( 40000 );
+
+          /* restore con2fbmap */
+          vt_set_fb( dfb_vt->num, dfb_vt->old_fb );
+
+          if (close( dfb_vt->fd ) < 0)
+               D_PERROR( "DirectFB/core/vt: Unable to "
+                          "close file descriptor of allocated VT!\n" );
+
+          if (ioctl( dfb_vt->fd0, VT_DISALLOCATE, dfb_vt->num ) < 0)
+               D_PERROR( "DirectFB/core/vt: Unable to disallocate VT!\n" );
+     }
+     else {
+          /* restore con2fbmap */
+          vt_set_fb( dfb_vt->num, dfb_vt->old_fb );
+
+          if (close( dfb_vt->fd ) < 0)
+               D_PERROR( "DirectFB/core/vt: Unable to "
+                          "close file descriptor of current VT!\n" );
+     }
+
+     if (close( dfb_vt->fd0 ) < 0)
+          D_PERROR( "DirectFB/core/vt: Unable to "
+                     "close file descriptor of tty0!\n" );
+
+     D_FREE( dfb_vt );
+     dfb_vt = dfb_fbdev->vt = NULL;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_vt_leave( bool emergency )
+{
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_vt_detach( bool force )
+{
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     if (dfb_config->vt_switch || force) {
+          int            fd;
+          struct vt_stat vt_state;
+
+          fd = open( "/dev/tty", O_RDONLY | O_NOCTTY );
+          if (fd < 0) {
+               if (errno == ENXIO)
+                    return DFB_OK;
+
+               D_PERROR( "DirectFB/VT: Opening /dev/tty failed!\n" );
+               return errno2result( errno );
+          }
+
+          if (ioctl( fd, VT_GETSTATE, &vt_state )) {
+               close( fd );
+               return DFB_OK;
+          }
+
+          if (ioctl( fd, TIOCNOTTY )) {
+               D_PERROR( "DirectFB/VT: TIOCNOTTY on /dev/tty failed\n" );
+               close( fd );
+               return errno2result( errno );
+          }
+
+          close( fd );
+     }
+
+     return DFB_OK;
+}
+
+bool
+dfb_vt_switch( int num )
+{
+     D_DEBUG_AT( VT, "%s( %d )\n", __FUNCTION__, num );
+
+     if (!dfb_config->vt_switching)
+          return false;
+
+     D_DEBUG_AT( VT, "  -> switching to vt %d...\n", num );
+
+     if (ioctl( dfb_vt->fd0, VT_ACTIVATE, num ) < 0)
+          D_PERROR( "DirectFB/fbdev/vt: VT_ACTIVATE failed\n" );
+
+     return true;
+}
+
+static void *
+vt_thread( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( VT, "%s( %p, %p )\n", __FUNCTION__, thread, arg );
+
+     pthread_mutex_lock( &dfb_vt->lock );
+
+     while (true) {
+          direct_thread_testcancel( thread );
+
+          D_DEBUG_AT( VT, "...%s (signal %d)\n", __FUNCTION__, dfb_vt->vt_sig);
+
+          switch (dfb_vt->vt_sig) {
+               default:
+                    D_BUG( "unexpected vt_sig" );
+                    /* fall through */
+
+               case -1:
+                    pthread_cond_wait( &dfb_vt->wait, &dfb_vt->lock );
+                    continue;
+
+               case SIG_SWITCH_FROM:
+                    if (dfb_core_suspend( dfb_fbdev->core ) == DFB_OK) {
+                         if (ioctl( dfb_vt->fd, VT_RELDISP, VT_ACKACQ ) < 0)
+                              D_PERROR( "DirectFB/fbdev/vt: VT_RELDISP failed\n" );
+                    }
+
+                    break;
+
+               case SIG_SWITCH_TO:
+                    if (dfb_core_resume( dfb_fbdev->core ) == DFB_OK) {
+                         if (ioctl( dfb_vt->fd, VT_RELDISP, VT_ACKACQ ) < 0)
+                              D_PERROR( "DirectFB/fbdev/vt: VT_RELDISP failed\n" );
+
+                         if (dfb_config->kd_graphics) {
+                              if (ioctl( dfb_vt->fd, KDSETMODE, KD_GRAPHICS ) < 0)
+                                   D_PERROR( "DirectFB/fbdev/vt: KD_GRAPHICS failed!\n" );
+                         }
+                    }
+
+                    break;
+          }
+
+          dfb_vt->vt_sig = -1;
+
+          pthread_cond_signal( &dfb_vt->wait );
+     }
+
+     return NULL;
+}
+
+static void
+vt_switch_handler( int signum )
+{
+     D_DEBUG_AT( VT, "%s( %d )\n", __FUNCTION__, signum );
+
+     pthread_mutex_lock( &dfb_vt->lock );
+
+     while (dfb_vt->vt_sig != -1)
+          pthread_cond_wait( &dfb_vt->wait, &dfb_vt->lock );
+
+     dfb_vt->vt_sig = signum;
+
+     pthread_cond_signal( &dfb_vt->wait );
+
+     pthread_mutex_unlock( &dfb_vt->lock );
+}
+
+static DFBResult
+vt_init_switching( void )
+{
+     struct termios ts;
+     const char cursoroff_str[] = "\033[?1;0;0c";
+     const char blankoff_str[] = "\033[9;0]";
+     char buf[32];
+
+     D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+     /* FIXME: Opening the device should be moved out of this function. */
+
+     snprintf(buf, 32, "/dev/tty%d", dfb_vt->num);
+     dfb_vt->fd = open( buf, O_RDWR | O_NOCTTY );
+     if (dfb_vt->fd < 0) {
+          if (errno == ENOENT) {
+               snprintf(buf, 32, "/dev/vc/%d", dfb_vt->num);
+               dfb_vt->fd = open( buf, O_RDWR | O_NOCTTY );
+               if (dfb_vt->fd < 0) {
+                    if (errno == ENOENT) {
+                         D_PERROR( "DirectFB/core/vt: Couldn't open "
+                                    "neither `/dev/tty%d' nor `/dev/vc/%d'!\n",
+                                    dfb_vt->num, dfb_vt->num );
+                    }
+                    else {
+                         D_PERROR( "DirectFB/core/vt: "
+                                    "Error opening `%s'!\n", buf );
+                    }
+
+                    return errno2result( errno );
+               }
+          }
+          else {
+               D_PERROR( "DirectFB/core/vt: Error opening `%s'!\n", buf );
+               return errno2result( errno );
+          }
+     }
+
+     /* attach to the new TTY before doing anything like KDSETMODE with it,
+        otherwise we'd get access denied error: */
+     ioctl( dfb_vt->fd, TIOCSCTTY, 0 );
+
+     if (ioctl( dfb_vt->fd, KDSKBMODE, K_MEDIUMRAW ) < 0) {
+          D_PERROR( "DirectFB/fbdev/vt: K_MEDIUMRAW failed!\n" );
+          close( dfb_vt->fd );
+          return DFB_INIT;
+     }
+
+     if (tcgetattr( dfb_vt->fd, &dfb_vt->old_ts ) < 0) {
+          D_PERROR( "DirectFB/fbdev/vt: tcgetattr failed!\n" );
+          ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE );
+          close( dfb_vt->fd );
+          return DFB_INIT;
+     }
+     ts = dfb_vt->old_ts;
+     ts.c_cc[VTIME] = 0;
+     ts.c_cc[VMIN] = 1;
+     ts.c_lflag &= ~(ICANON|ECHO|ISIG);
+     ts.c_iflag = 0;
+     if (tcsetattr( dfb_vt->fd, TCSAFLUSH, &ts ) < 0) {
+          D_PERROR( "DirectFB/fbdev/vt: tcsetattr for new values failed!\n" );
+          ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE );
+          close( dfb_vt->fd );
+          return DFB_INIT;
+     }
+
+     write( dfb_vt->fd, cursoroff_str, sizeof(cursoroff_str) );
+     if (dfb_config->kd_graphics) {
+          if (ioctl( dfb_vt->fd, KDSETMODE, KD_GRAPHICS ) < 0) {
+               D_PERROR( "DirectFB/fbdev/vt: KD_GRAPHICS failed!\n" );
+               tcsetattr( dfb_vt->fd, TCSAFLUSH, &dfb_vt->old_ts );
+               ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE );
+               close( dfb_vt->fd );
+               return DFB_INIT;
+          }
+     }
+     else {
+          write( dfb_vt->fd, blankoff_str, sizeof(blankoff_str) );
+     }
+
+     if (dfb_config->vt_switching) {
+          struct vt_mode vt;
+          struct sigaction sig_tty;
+
+          memset( &sig_tty, 0, sizeof( sig_tty ) );
+          sig_tty.sa_handler = vt_switch_handler;
+          sigfillset( &sig_tty.sa_mask );
+
+          if (sigaction( SIG_SWITCH_FROM, &sig_tty, &dfb_vt->sig_usr1 ) ||
+              sigaction( SIG_SWITCH_TO, &sig_tty, &dfb_vt->sig_usr2 )) {
+               D_PERROR( "DirectFB/fbdev/vt: sigaction failed!\n" );
+               tcsetattr( dfb_vt->fd, TCSAFLUSH, &dfb_vt->old_ts );
+               ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE );
+               close( dfb_vt->fd );
+               return DFB_INIT;
+          }
+
+
+          vt.mode   = VT_PROCESS;
+          vt.waitv  = 0;
+          vt.relsig = SIG_SWITCH_FROM;
+          vt.acqsig = SIG_SWITCH_TO;
+
+          if (ioctl( dfb_vt->fd, VT_SETMODE, &vt ) < 0) {
+               D_PERROR( "DirectFB/fbdev/vt: VT_SETMODE failed!\n" );
+
+               sigaction( SIG_SWITCH_FROM, &dfb_vt->sig_usr1, NULL );
+               sigaction( SIG_SWITCH_TO, &dfb_vt->sig_usr2, NULL );
+
+               tcsetattr( dfb_vt->fd, TCSAFLUSH, &dfb_vt->old_ts );
+               ioctl( dfb_vt->fd, KDSKBMODE, K_XLATE );
+               close( dfb_vt->fd );
+
+               return DFB_INIT;
+          }
+
+          direct_util_recursive_pthread_mutex_init( &dfb_vt->lock );
+
+          pthread_cond_init( &dfb_vt->wait, NULL );
+
+          dfb_vt->vt_sig = -1;
+
+          dfb_vt->thread = direct_thread_create( DTT_CRITICAL, vt_thread, NULL, "VT Switcher" );
+     }
+
+     return DFB_OK;
+}
+
+static int
+vt_get_fb( int vt )
+{
+     struct fb_con2fbmap c2m;
+
+     D_DEBUG_AT( VT, "%s( %d )\n", __FUNCTION__, vt );
+
+     c2m.console = vt;
+
+     if (ioctl( dfb_fbdev->fd, FBIOGET_CON2FBMAP, &c2m )) {
+          D_PERROR( "DirectFB/FBDev/vt: "
+                     "FBIOGET_CON2FBMAP failed!\n" );
+          return 0;
+     }
+
+     D_DEBUG_AT( VT, "  -> %d\n", c2m.framebuffer );
+
+     return c2m.framebuffer;
+}
+
+static void
+vt_set_fb( int vt, int fb )
+{
+     struct fb_con2fbmap c2m;
+     struct stat         sbf;
+
+     D_DEBUG_AT( VT, "%s( %d, %d )\n", __FUNCTION__, vt, fb );
+
+     if (fstat( dfb_fbdev->fd, &sbf )) {
+          D_PERROR( "DirectFB/FBDev/vt: Could not fstat fb device!\n" );
+          return;
+     }
+
+     if (fb >= 0)
+          c2m.framebuffer = fb;
+     else
+          c2m.framebuffer = (sbf.st_rdev & 0xFF) >> 5;
+
+     c2m.console = vt;
+
+     if (ioctl( dfb_fbdev->fd, FBIOPUT_CON2FBMAP, &c2m ) < 0) {
+          D_PERROR( "DirectFB/FBDev/vt: "
+                     "FBIOPUT_CON2FBMAP failed!\n" );
+     }
+}
+
+static void
+vt_start_flushing( void )
+{
+     dfb_vt->flush = true;
+     dfb_vt->flush_thread = direct_thread_create( DTT_DEFAULT, vt_flush_thread, NULL, "VT Flusher" );
+}
+
+static void
+vt_stop_flushing( void )
+{
+     dfb_vt->flush = false;
+     direct_thread_cancel( dfb_vt->flush_thread );
+     direct_thread_join( dfb_vt->flush_thread );
+     direct_thread_destroy( dfb_vt->flush_thread );
+     dfb_vt->flush_thread = NULL;
+}
+
+/*
+ * If the vt buffer in not kept clean the kernel may stop sleeping.
+ */
+static void *
+vt_flush_thread( DirectThread *thread, void *arg )
+{
+     D_DEBUG_AT( VT, "%s( %p, %p )\n", __FUNCTION__, thread, arg );
+
+     while (dfb_vt->flush) {
+          fd_set set;
+          int ret;
+
+          FD_ZERO( &set );
+          FD_SET( dfb_vt->fd, &set );
+
+          ret = select( dfb_vt->fd + 1, &set, NULL, NULL, NULL );
+
+          if (ret < 0 && errno == EINTR)
+               continue;
+
+          if (ret < 0)
+               break;
+
+          tcflush( dfb_vt->fd, TCIFLUSH );
+     }
+
+     return NULL;
+}
diff --git a/Source/DirectFB/systems/fbdev/vt.h b/Source/DirectFB/systems/fbdev/vt.h
new file mode 100755
index 0000000..d9b1019
--- /dev/null
+++ b/Source/DirectFB/systems/fbdev/vt.h
@@ -0,0 +1,83 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VT_H__
+#define __VT_H__
+
+#include <signal.h>
+#include <termios.h>
+#include <unistd.h>
+#include <linux/vt.h>
+
+#include <directfb.h>
+
+typedef struct {
+     int fd0;                      /* file descriptor of /dev/tty0 */
+     int fd;                       /* file descriptor of /dev/ttyN
+                                      where N is the number of the allocated VT,
+                                      may be equal to 'fd0' if VT allocation
+                                      is disabled by "--no-vt-switch" */
+
+     int num;                      /* number of vt where DirectFB runs */
+     int prev;                     /* number of vt DirectFB was started from */
+
+     int old_fb;                   /* original fb mapped to vt */
+
+     struct sigaction sig_usr1;    /* previous signal handler for USR1 */
+     struct sigaction sig_usr2;    /* previous signal handler for USR2 */
+
+     struct vt_mode   vt_mode;     /* previous VT mode */
+
+     DirectThread    *thread;
+     pthread_mutex_t  lock;
+     pthread_cond_t   wait;
+
+     int              vt_sig;
+     struct termios   old_ts;
+
+     bool             flush;
+     DirectThread    *flush_thread;
+} VirtualTerminal;
+
+/*
+ * allocates and switches to a new virtual terminal
+ */
+DFBResult dfb_vt_initialize( void );
+DFBResult dfb_vt_join( void );
+
+/*
+ * deallocates virtual terminal
+ */
+DFBResult dfb_vt_shutdown( bool emergency );
+DFBResult dfb_vt_leave( bool emergency );
+
+DFBResult dfb_vt_detach( bool force );
+
+bool dfb_vt_switch( int num );
+
+#endif
diff --git a/Source/DirectFB/systems/osx/Makefile.am b/Source/DirectFB/systems/osx/Makefile.am
new file mode 100755
index 0000000..7f12422
--- /dev/null
+++ b/Source/DirectFB/systems/osx/Makefile.am
@@ -0,0 +1,59 @@
+## Makefile.am for DirectFB/systems/osx
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+systemsdir = $(MODULEDIR)/systems
+
+systems_LTLIBRARIES = libdirectfb_osx.la
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_osx.o
+endif
+
+
+libdirectfb_osx_la_LDFLAGS = \
+	-framework ApplicationServices	\
+	-avoid-version	\
+	-module
+
+libdirectfb_osx_la_SOURCES = \
+	primary.c	\
+	primary.h	\
+	osx.c		\
+	osx.h
+
+libdirectfb_osx_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+inputdriversdir = $(MODULEDIR)/inputdrivers
+
+inputdrivers_LTLIBRARIES = libdirectfb_osxinput.la
+
+if BUILD_STATIC
+inputdrivers_DATA = libdirectfb_osxinput.o
+endif
+
+
+libdirectfb_osxinput_la_LDFLAGS = \
+	-framework Carbon	\
+	-avoid-version	\
+	-module
+
+libdirectfb_osxinput_la_SOURCES = \
+	osxinput.c
+
+libdirectfb_osxinput_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make	
+
diff --git a/Source/DirectFB/systems/osx/Makefile.in b/Source/DirectFB/systems/osx/Makefile.in
new file mode 100755
index 0000000..84b6c67
--- /dev/null
+++ b/Source/DirectFB/systems/osx/Makefile.in
@@ -0,0 +1,685 @@
+# 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 = systems/osx
+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)$(inputdriversdir)" \
+	"$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(inputdriversdir)" \
+	"$(DESTDIR)$(systemsdir)"
+inputdriversLTLIBRARIES_INSTALL = $(INSTALL)
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(inputdrivers_LTLIBRARIES) $(systems_LTLIBRARIES)
+libdirectfb_osx_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_osx_la_OBJECTS = primary.lo osx.lo
+libdirectfb_osx_la_OBJECTS = $(am_libdirectfb_osx_la_OBJECTS)
+libdirectfb_osx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_osx_la_LDFLAGS) $(LDFLAGS) -o $@
+libdirectfb_osxinput_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_osxinput_la_OBJECTS = osxinput.lo
+libdirectfb_osxinput_la_OBJECTS =  \
+	$(am_libdirectfb_osxinput_la_OBJECTS)
+libdirectfb_osxinput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_osxinput_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_osx_la_SOURCES) \
+	$(libdirectfb_osxinput_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_osx_la_SOURCES) \
+	$(libdirectfb_osxinput_la_SOURCES)
+inputdriversDATA_INSTALL = $(INSTALL_DATA)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(inputdrivers_DATA) $(systems_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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src
+
+systemsdir = $(MODULEDIR)/systems
+systems_LTLIBRARIES = libdirectfb_osx.la
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_osx.o
+libdirectfb_osx_la_LDFLAGS = \
+	-framework ApplicationServices	\
+	-avoid-version	\
+	-module
+
+libdirectfb_osx_la_SOURCES = \
+	primary.c	\
+	primary.h	\
+	osx.c		\
+	osx.h
+
+libdirectfb_osx_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+inputdriversdir = $(MODULEDIR)/inputdrivers
+inputdrivers_LTLIBRARIES = libdirectfb_osxinput.la
+@BUILD_STATIC_TRUE@inputdrivers_DATA = libdirectfb_osxinput.o
+libdirectfb_osxinput_la_LDFLAGS = \
+	-framework Carbon	\
+	-avoid-version	\
+	-module
+
+libdirectfb_osxinput_la_SOURCES = \
+	osxinput.c
+
+libdirectfb_osxinput_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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  systems/osx/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/osx/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-inputdriversLTLIBRARIES: $(inputdrivers_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputdriversLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdriversdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdriversdir)/$$p"; \
+	done
+
+clean-inputdriversLTLIBRARIES:
+	-test -z "$(inputdrivers_LTLIBRARIES)" || rm -f $(inputdrivers_LTLIBRARIES)
+	@list='$(inputdrivers_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
+install-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_osx.la: $(libdirectfb_osx_la_OBJECTS) $(libdirectfb_osx_la_DEPENDENCIES) 
+	$(libdirectfb_osx_la_LINK) -rpath $(systemsdir) $(libdirectfb_osx_la_OBJECTS) $(libdirectfb_osx_la_LIBADD) $(LIBS)
+libdirectfb_osxinput.la: $(libdirectfb_osxinput_la_OBJECTS) $(libdirectfb_osxinput_la_DEPENDENCIES) 
+	$(libdirectfb_osxinput_la_LINK) -rpath $(inputdriversdir) $(libdirectfb_osxinput_la_OBJECTS) $(libdirectfb_osxinput_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osxinput.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primary.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-inputdriversDATA: $(inputdrivers_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  $(inputdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+
+uninstall-inputdriversDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+install-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$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)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)"; 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-inputdriversLTLIBRARIES clean-libtool \
+	clean-systemsLTLIBRARIES 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-inputdriversDATA \
+	install-inputdriversLTLIBRARIES install-systemsDATA \
+	install-systemsLTLIBRARIES
+
+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-inputdriversDATA \
+	uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputdriversLTLIBRARIES clean-libtool \
+	clean-systemsLTLIBRARIES ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-inputdriversDATA \
+	install-inputdriversLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	install-systemsDATA install-systemsLTLIBRARIES 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-inputdriversDATA \
+	uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+%.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/systems/osx/osx.c b/Source/DirectFB/systems/osx/osx.c
new file mode 100755
index 0000000..e051fb8
--- /dev/null
+++ b/Source/DirectFB/systems/osx/osx.c
@@ -0,0 +1,263 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <Carbon/Carbon.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/messages.h>
+
+#include "osx.h"
+#include "primary.h"
+
+#include <core/core_system.h>
+
+DFB_CORE_SYSTEM( osx )
+
+
+DFBOSX  *dfb_osx      = NULL;
+CoreDFB *dfb_osx_core = NULL;
+
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_OSX;
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "OSX" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+     char       *driver;
+     CoreScreen *screen;
+
+     D_ASSERT( dfb_osx == NULL );
+
+     dfb_osx = (DFBOSX*) SHCALLOC( dfb_core_shmpool(dfb_osx_core), 1, sizeof(DFBOSX) );
+     if (!dfb_osx) {
+          D_ERROR( "DirectFB/OSX: Couldn't allocate shared memory!\n" );
+          return D_OOSHM();
+     }
+
+     dfb_osx_core = core;
+
+     /* Initialize OSX */
+     fusion_skirmish_init( &dfb_osx->lock, "OSX System", dfb_core_world(core) );
+
+     fusion_call_init( &dfb_osx->call, dfb_osx_call_handler, NULL, dfb_core_world(core) );
+
+     screen = dfb_screens_register( NULL, NULL, &osxPrimaryScreenFuncs );
+
+     dfb_layers_register( screen, NULL, &osxPrimaryLayerFuncs );
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "OSX", dfb_osx );
+
+     *data = dfb_osx;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+     void       *ret;
+     CoreScreen *screen;
+
+     D_ASSERT( dfb_osx == NULL );
+
+     fusion_arena_get_shared_field( dfb_core_arena( core ), "OSX", &ret );
+
+     dfb_osx = ret;
+     dfb_osx_core = core;
+
+     screen = dfb_screens_register( NULL, NULL, &osxPrimaryScreenFuncs );
+
+     dfb_layers_register( screen, NULL, &osxPrimaryLayerFuncs );
+
+     *data = dfb_osx;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     D_ASSERT( dfb_osx != NULL );
+
+     fusion_call_destroy( &dfb_osx->call );
+
+     fusion_skirmish_prevail( &dfb_osx->lock );
+
+     fusion_skirmish_destroy( &dfb_osx->lock );
+
+     SHFREE( dfb_core_shmpool(dfb_osx_core), dfb_osx );
+     dfb_osx = NULL;
+     dfb_osx_core = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     D_ASSERT( dfb_osx != NULL );
+
+     dfb_osx = NULL;
+     dfb_osx_core = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+system_resume( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+    return NULL;
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+}
+
+static int
+system_get_accelerator( void )
+{
+     return -1;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return NULL;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return NULL;
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice   *device,
+                     DFBInputEvent *event )
+{
+     return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return 0;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+     return;
+}
+
diff --git a/Source/DirectFB/systems/osx/osx.h b/Source/DirectFB/systems/osx/osx.h
new file mode 100755
index 0000000..820a8d5
--- /dev/null
+++ b/Source/DirectFB/systems/osx/osx.h
@@ -0,0 +1,43 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __OSX__OSX_H__
+#define __OSX__OSX_H__
+
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+typedef struct {
+     FusionSkirmish  lock;
+     FusionCall      call;
+
+     CoreSurface    *primary;
+} DFBOSX;
+
+#endif
+
diff --git a/Source/DirectFB/systems/osx/osxinput.c b/Source/DirectFB/systems/osx/osxinput.c
new file mode 100755
index 0000000..056bb0d
--- /dev/null
+++ b/Source/DirectFB/systems/osx/osxinput.c
@@ -0,0 +1,311 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+#include <core/system.h>
+
+#include <direct/mem.h>
+#include <direct/thread.h>
+
+#include <Carbon/Carbon.h>
+
+#include "osx.h"
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( osxinput )
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice  *device;
+     DirectThread *thread;
+     DFBOSX       *dfb_osx;
+     int           stop;
+} OSXInputData;
+
+static DFBInputEvent motionX = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static DFBInputEvent motionY = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static void
+motion_compress( int x, int y )
+{
+     if (motionX.axisabs != x) {
+          motionX.type    = DIET_AXISMOTION;
+          motionX.flags   = DIEF_AXISABS;
+          motionX.axis    = DIAI_X;
+          motionX.axisabs = x;
+     }
+
+    if (motionY.axisabs != y) {
+          motionY.type    = DIET_AXISMOTION;
+          motionY.flags   = DIEF_AXISABS;
+          motionY.axis    = DIAI_Y;
+          motionY.axisabs = y;
+     }
+}
+
+static void
+motion_realize( OSXInputData *data )
+{
+     if (motionX.type != DIET_UNKNOWN) {
+          dfb_input_dispatch( data->device, &motionX );
+
+          motionX.type = DIET_UNKNOWN;
+     }
+
+     if (motionY.type != DIET_UNKNOWN) {
+          dfb_input_dispatch( data->device, &motionY );
+
+          motionY.type = DIET_UNKNOWN;
+     }
+}
+
+
+static bool
+translate_key( unsigned short key, DFBInputEvent *evt )
+{
+     unsigned char charcode = (unsigned char)key;
+     unsigned char keycode  = (unsigned char)(key>>8);
+
+     printf("keycode: %d char: %d\n",keycode,charcode);
+
+     if (charcode) {
+          evt->flags = DIEF_KEYSYMBOL;
+          switch (charcode) {
+               case 28:  evt->key_symbol = DIKS_CURSOR_LEFT; break;
+               case 29:  evt->key_symbol = DIKS_CURSOR_RIGHT; break;
+               case 30:  evt->key_symbol = DIKS_CURSOR_UP; break;
+               case 31:  evt->key_symbol = DIKS_CURSOR_DOWN; break;
+               default:
+                   evt->key_symbol = charcode;
+                   break;
+          }
+          return true;
+     }
+     else if (keycode) {
+          evt->flags = DIEF_KEYID;
+          evt->key_id = keycode;
+          return true;
+     }
+
+     return false;
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+osxEventThread( DirectThread *thread, void *driver_data )
+{
+     OSXInputData *data    = (OSXInputData*) driver_data;
+     DFBOSX       *dfb_osx = data->dfb_osx;
+
+     while (!data->stop) {
+          DFBInputEvent evt;
+          EventRecord   event;
+
+          fusion_skirmish_prevail( &dfb_osx->lock );
+
+          /* Check for events */
+          while ( WaitNextEvent( everyEvent, &event, 0, nil) ) {
+               fusion_skirmish_dismiss( &dfb_osx->lock );
+
+               switch (event.what) {
+                    case keyDown:
+                    case keyUp:
+                    case autoKey:
+                         if (event.what == keyUp)
+                              evt.type = DIET_KEYRELEASE;
+                         else
+                              evt.type = DIET_KEYPRESS;
+
+                         if (translate_key( event.message & (charCodeMask | keyCodeMask), &evt )) {
+                              dfb_input_dispatch( data->device, &evt );
+                         }
+
+                         break;
+                    case mouseDown:
+                         evt.type = DIET_BUTTONPRESS;
+                         evt.button = DIBI_LEFT;
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+                    case mouseUp:
+                         evt.type = DIET_BUTTONRELEASE;
+                         evt.button = DIBI_LEFT;
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+                    default:
+                         printf("%d\n",event.what);
+                         break;
+               }
+
+               fusion_skirmish_prevail( &dfb_osx->lock );
+          }
+
+          fusion_skirmish_dismiss( &dfb_osx->lock );
+
+          usleep(10000);
+
+          direct_thread_testcancel( thread );
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     if (dfb_system_type() == CORE_OSX)
+          return 1;
+
+     return 0;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "OSX Input Driver" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Andreas Hundt" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     OSXInputData *data;
+     DFBOSX       *dfb_osx = dfb_system_data();
+
+     fusion_skirmish_prevail( &dfb_osx->lock );
+
+     fusion_skirmish_dismiss( &dfb_osx->lock );
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "OSX Input" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "OSX" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_KEYBOARD;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_KEYBOARD | DIDTF_MOUSE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_ALL;
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(OSXInputData) );
+
+     data->device  = device;
+     data->dfb_osx = dfb_osx;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, osxEventThread, data, "OSX Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     OSXInputData *data = (OSXInputData*) driver_data;
+
+     /* stop input thread */
+     data->stop = 1;
+
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* free private data */
+     D_FREE ( data );
+}
diff --git a/Source/DirectFB/systems/osx/primary.c b/Source/DirectFB/systems/osx/primary.c
new file mode 100755
index 0000000..0d0cac6
--- /dev/null
+++ b/Source/DirectFB/systems/osx/primary.c
@@ -0,0 +1,623 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <directfb.h>
+
+#include <fusion/shmalloc.h>
+#include <fusion/fusion.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <ApplicationServices/ApplicationServices.h>
+
+#include "osx.h"
+#include "primary.h"
+
+extern DFBOSX  *dfb_osx;
+extern CoreDFB *dfb_osx_core;
+
+/******************************************************************************/
+
+static DFBResult dfb_osx_set_video_mode( CoreDFB *core, CoreLayerRegionConfig *config );
+static DFBResult dfb_osx_update_screen( CoreDFB *core, DFBRegion *region );
+static DFBResult dfb_osx_set_palette( CorePalette *palette );
+
+static DFBResult update_screen( CoreSurface *surface,
+                                int x, int y, int w, int h );
+
+static CGDirectDisplayID screen = NULL;
+
+/******************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen           *screen,
+                   GraphicsDevice       *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_NONE;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "OSX Primary Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     D_ASSERT( dfb_osx != NULL );
+
+     if (dfb_osx->primary) {
+          *ret_width  = dfb_osx->primary->width;
+          *ret_height = dfb_osx->primary->height;
+     }
+     else {
+          if (dfb_config->mode.width)
+               *ret_width  = dfb_config->mode.width;
+          else
+               *ret_width  = 640;
+
+          if (dfb_config->mode.height)
+               *ret_height = dfb_config->mode.height;
+          else
+               *ret_height = 480;
+     }
+
+     return DFB_OK;
+}
+
+ScreenFuncs osxPrimaryScreenFuncs = {
+     .InitScreen    = primaryInitScreen,
+     .GetScreenSize = primaryGetScreenSize,
+};
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+     return 0;
+}
+
+static int
+primaryRegionDataSize( void )
+{
+     return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  DFBDisplayLayerDescription *description,
+                  DFBDisplayLayerConfig      *config,
+                  DFBColorAdjustment         *adjustment )
+{
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "OSX Primary Layer" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+     config->buffermode  = DLBM_FRONTONLY;
+
+     if (dfb_config->mode.width)
+          config->width  = dfb_config->mode.width;
+     else
+          config->width  = 640;
+
+     if (dfb_config->mode.height)
+          config->height = dfb_config->mode.height;
+     else
+          config->height = 480;
+
+     if (dfb_config->mode.format != DSPF_UNKNOWN)
+          config->pixelformat = dfb_config->mode.format;
+     else if (dfb_config->mode.depth > 0)
+          config->pixelformat = dfb_pixelformat_for_depth( dfb_config->mode.depth );
+     else
+          config->pixelformat = DSPF_ARGB1555;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+               break;
+
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+
+     if (config->options)
+          fail |= CLRCF_OPTIONS;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  void                       *region_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags  updated,
+                  CoreSurface                *surface,
+                  CorePalette                *palette )
+{
+     DFBResult ret;
+
+     if (surface)
+          dfb_osx->primary = surface;
+
+     ret = dfb_osx_set_video_mode( dfb_osx_core, config );
+     if (ret)
+          return ret;
+
+     if (palette)
+          dfb_osx_set_palette( palette );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data )
+{
+     dfb_osx->primary = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer           *layer,
+                   void                *driver_data,
+                   void                *layer_data,
+                   void                *region_data,
+                   CoreSurface         *surface,
+                   DFBSurfaceFlipFlags  flags )
+{
+     dfb_surface_flip_buffers( surface, false );
+
+     return dfb_osx_update_screen( dfb_osx_core, NULL );
+}
+
+static DFBResult
+primaryUpdateRegion( CoreLayer           *layer,
+                     void                *driver_data,
+                     void                *layer_data,
+                     void                *region_data,
+                     CoreSurface         *surface,
+                     const DFBRegion     *update )
+{
+
+     if (surface && (surface->caps & DSCAPS_FLIPPING)) {
+          if (update) {
+               DFBRegion region = *update;
+
+               return dfb_osx_update_screen( dfb_osx_core, ®ion );
+          }
+          else
+               return dfb_osx_update_screen( dfb_osx_core, NULL );
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAllocateSurface( CoreLayer              *layer,
+                        void                   *driver_data,
+                        void                   *layer_data,
+                        void                   *region_data,
+                        CoreLayerRegionConfig  *config,
+                        CoreSurface           **ret_surface )
+{
+     DFBSurfaceCapabilities caps = DSCAPS_SYSTEMONLY;
+
+     if (config->buffermode != DLBM_FRONTONLY) {
+          caps |= DSCAPS_DOUBLE;
+          return dfb_surface_create( NULL, config->width, config->height,
+                                config->format, CSP_SYSTEMONLY,
+                                caps, NULL, ret_surface );
+     }
+     else {
+          DFBResult ret;
+          CoreSurface *surface = NULL;
+
+          surface = dfb_core_create_surface( NULL );
+          if (!surface)
+               return DFB_FAILURE;
+
+          /* reallocation just needs an allocated buffer structure */
+          surface->idle_buffer = surface->back_buffer = surface->front_buffer
+                               = SHCALLOC( dfb_core_shmpool(dfb_osx_core), 1, sizeof(SurfaceBuffer) );
+
+          surface->front_buffer->policy = CSP_SYSTEMONLY;
+          surface->front_buffer->format = config->format;
+
+          *ret_surface = surface;
+
+          ret = dfb_surface_init( NULL, surface,
+                             config->width, config->height,
+                             config->format, caps, NULL );
+
+          if (ret)
+             return ret;
+
+          /* activate object */
+          fusion_object_activate( &surface->object );
+
+          return ret;
+     }
+}
+
+static DFBResult
+primaryReallocateSurface( CoreLayer             *layer,
+                          void                  *driver_data,
+                          void                  *layer_data,
+                          void                  *region_data,
+                          CoreLayerRegionConfig *config,
+                          CoreSurface           *surface )
+{
+     DFBResult ret;
+
+     /* FIXME: write surface management functions
+               for easier configuration changes */
+     switch (config->buffermode) {
+          case DLBM_BACKVIDEO:
+          case DLBM_BACKSYSTEM:
+               surface->caps |= DSCAPS_DOUBLE;
+
+               ret = dfb_surface_reconfig( surface,
+                                           CSP_SYSTEMONLY, CSP_SYSTEMONLY );
+               break;
+
+          case DLBM_FRONTONLY:
+               surface->caps &= ~DSCAPS_DOUBLE;
+
+               ret = dfb_surface_reconfig( surface,
+                                           CSP_SYSTEMONLY, CSP_SYSTEMONLY );
+               break;
+
+          default:
+               D_BUG("unknown buffermode");
+               return DFB_BUG;
+     }
+     if (ret)
+          return ret;
+
+     ret = dfb_surface_reformat( NULL, surface, config->width,
+                                 config->height, config->format );
+     if (ret)
+          return ret;
+
+
+     if (DFB_PIXELFORMAT_IS_INDEXED(config->format) && !surface->palette) {
+          DFBResult    ret;
+          CorePalette *palette;
+
+          ret = dfb_palette_create( NULL,    /* FIXME */
+                                    1 << DFB_COLOR_BITS_PER_PIXEL( config->format ),
+                                    &palette );
+          if (ret)
+               return ret;
+
+          if (config->format == DSPF_LUT8)
+               dfb_palette_generate_rgb332_map( palette );
+
+          dfb_surface_set_palette( surface, palette );
+
+          dfb_palette_unref( palette );
+     }
+
+     return DFB_OK;
+}
+
+DisplayLayerFuncs osxPrimaryLayerFuncs = {
+     .LayerDataSize     = primaryLayerDataSize,
+     .RegionDataSize    = primaryRegionDataSize,
+     .InitLayer         = primaryInitLayer,
+
+     .TestRegion        = primaryTestRegion,
+     .AddRegion         = primaryAddRegion,
+     .SetRegion         = primarySetRegion,
+     .RemoveRegion      = primaryRemoveRegion,
+     .FlipRegion        = primaryFlipRegion,
+     .UpdateRegion      = primaryUpdateRegion,
+
+     .AllocateSurface   = primaryAllocateSurface,
+     .ReallocateSurface = primaryReallocateSurface,
+};
+
+/******************************************************************************/
+
+static DFBResult
+update_screen( CoreSurface *surface, int x, int y, int w, int h )
+{
+     int          i;
+     void        *dst;
+     void        *src;
+     int          pitch;
+     int          dst_pitch;
+     DFBResult    ret;
+
+     D_ASSERT( surface != NULL );
+     ret = dfb_surface_soft_lock( dfb_osx_core, surface, DSLF_READ, &src, &pitch, true );
+     if (ret) {
+          D_ERROR( "DirectFB/OSX: Couldn't lock layer surface: %s\n",
+                   DirectFBErrorString( ret ) );
+          return ret;
+     }
+
+     dst = CGDisplayBaseAddress( screen );
+     dst_pitch = CGDisplayBytesPerRow( screen );
+     src += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * pitch;
+     dst += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * dst_pitch;
+
+     for (i=0; i<h; ++i) {
+          direct_memcpy( dst, src, DFB_BYTES_PER_LINE( surface->config.format, w ) );
+
+          src += pitch;
+          dst += dst_pitch;
+     }
+
+     dfb_surface_unlock( surface, true );
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+typedef enum {
+     OSX_SET_VIDEO_MODE,
+     OSX_UPDATE_SCREEN,
+     OSX_SET_PALETTE
+} DFBOSXCall;
+
+static DFBResult
+dfb_osx_set_video_mode_handler( CoreLayerRegionConfig *config )
+{
+     boolean_t exactMatch;
+     CFDictionaryRef mode;
+
+     fusion_skirmish_prevail( &dfb_osx->lock );
+
+     mode = CGDisplayBestModeForParameters( screen, DFB_BITS_PER_PIXEL(config->format),
+                                           config->width, config->height, &exactMatch);
+     if (!mode || !exactMatch)
+     {
+             D_ERROR( "DirectFB/OSX: Couldn't set %dx%dx%d video mode.\n",
+                      config->width, config->height,
+                      DFB_COLOR_BITS_PER_PIXEL(config->format));
+
+             fusion_skirmish_dismiss( &dfb_osx->lock );
+
+             return DFB_FAILURE;
+     }
+     CGDisplaySwitchToMode( screen, mode );
+     CGDisplayCapture(screen);
+
+     if (config->buffermode == DLBM_FRONTONLY) {
+          /* update primary surface information */
+          dfb_osx->primary->front_buffer->system.addr = CGDisplayBaseAddress( screen );
+          dfb_osx->primary->front_buffer->system.pitch =  CGDisplayBytesPerRow( screen );
+     }
+     fusion_skirmish_dismiss( &dfb_osx->lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_osx_update_screen_handler( DFBRegion *region )
+{
+     DFBResult    ret;
+     CoreSurface *surface = dfb_osx->primary;
+
+     fusion_skirmish_prevail( &dfb_osx->lock );
+
+     if (!region)
+          ret = update_screen( surface, 0, 0, surface->config.size.w, surface->config.size.h );
+     else
+          ret = update_screen( surface,
+                               region->x1,  region->y1,
+                               region->x2 - region->x1 + 1,
+                               region->y2 - region->y1 + 1 );
+
+     fusion_skirmish_dismiss( &dfb_osx->lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_osx_set_palette_handler( CorePalette *palette )
+{
+     fusion_skirmish_prevail( &dfb_osx->lock );
+
+// do something usefull
+     fusion_skirmish_dismiss( &dfb_osx->lock );
+
+     return DFB_OK;
+}
+
+FusionCallHandlerResult
+dfb_osx_call_handler( int           caller,
+                      int           call_arg,
+                      void         *call_ptr,
+                      void         *ctx,
+                      unsigned int  serial,
+                      int          *ret_val )
+{
+     switch (call_arg) {
+          case OSX_SET_VIDEO_MODE:
+               *ret_val = dfb_osx_set_video_mode_handler( call_ptr );
+               break;
+
+          case OSX_UPDATE_SCREEN:
+               *ret_val = dfb_osx_update_screen_handler( call_ptr );
+               break;
+
+          case OSX_SET_PALETTE:
+               *ret_val = dfb_osx_set_palette_handler( call_ptr );
+               break;
+
+          default:
+               D_BUG( "unknown call" );
+               *ret_val = DFB_BUG;
+               break;
+     }
+
+     return FCHR_RETURN;
+}
+
+static DFBResult
+dfb_osx_set_video_mode( CoreDFB *core, CoreLayerRegionConfig *config )
+{
+     int                    ret;
+     CoreLayerRegionConfig *tmp = NULL;
+
+     D_ASSERT( config != NULL );
+
+     if (dfb_core_is_master( core ))
+          return dfb_osx_set_video_mode_handler( config );
+
+     if (!fusion_is_shared( dfb_core_world(core), config )) {
+          tmp = SHMALLOC( dfb_core_shmpool(dfb_osx_core), sizeof(CoreLayerRegionConfig) );
+          if (!tmp)
+               return D_OOSHM();
+
+          direct_memcpy( tmp, config, sizeof(CoreLayerRegionConfig) );
+     }
+
+     fusion_call_execute( &dfb_osx->call, FCEF_NONE, OSX_SET_VIDEO_MODE,
+                          tmp ? tmp : config, &ret );
+
+     if (tmp)
+          SHFREE( dfb_core_shmpool(dfb_osx_core), tmp );
+
+     return ret;
+}
+
+static DFBResult
+dfb_osx_update_screen( CoreDFB *core, DFBRegion *region )
+{
+     int        ret;
+     DFBRegion *tmp = NULL;
+
+     if (dfb_core_is_master( core ))
+          return dfb_osx_update_screen_handler( region );
+
+     if (region) {
+          if (!fusion_is_shared( dfb_core_world(core), region )) {
+               tmp = SHMALLOC( dfb_core_shmpool(dfb_osx_core), sizeof(DFBRegion) );
+               if (!tmp)
+                    return D_OOSHM();
+
+               direct_memcpy( tmp, region, sizeof(DFBRegion) );
+          }
+     }
+
+     fusion_call_execute( &dfb_osx->call, FCEF_ONEWAY, OSX_UPDATE_SCREEN,
+                          tmp ? tmp : region, &ret );
+
+     if (tmp)
+          SHFREE( dfb_core_shmpool(dfb_osx_core), tmp );
+
+     return ret;
+}
+
+static DFBResult
+dfb_osx_set_palette( CorePalette *palette )
+{
+     int ret;
+
+     fusion_call_execute( &dfb_osx->call, FCEF_NONE, OSX_SET_PALETTE,
+                          palette, &ret );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/systems/osx/primary.h b/Source/DirectFB/systems/osx/primary.h
new file mode 100755
index 0000000..5399dbc
--- /dev/null
+++ b/Source/DirectFB/systems/osx/primary.h
@@ -0,0 +1,49 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __OSX__PRIMARY_H__
+#define __OSX__PRIMARY_H__
+
+#include <fusion/call.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+extern ScreenFuncs       osxPrimaryScreenFuncs;
+extern DisplayLayerFuncs osxPrimaryLayerFuncs;
+
+FusionCallHandlerResult
+dfb_osx_call_handler( int           caller,
+                      int           call_arg,
+                      void         *call_ptr,
+                      void         *ctx,
+                      unsigned int  serial,
+                      int          *ret_val )
+
+#endif
+
diff --git a/Source/DirectFB/systems/sdl/Makefile.am b/Source/DirectFB/systems/sdl/Makefile.am
new file mode 100755
index 0000000..728362e
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/Makefile.am
@@ -0,0 +1,86 @@
+## Makefile.am for DirectFB/systems/sdl
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	$(SDL_CFLAGS)
+
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_sdl.o
+endif
+
+systems_LTLIBRARIES = libdirectfb_sdl.la
+
+
+inputdriversdir = $(MODULEDIR)/inputdrivers
+
+if BUILD_STATIC
+inputdrivers_DATA = libdirectfb_sdlinput.o
+endif
+
+inputdrivers_LTLIBRARIES = libdirectfb_sdlinput.la
+
+
+gfxdriversdir = $(MODULEDIR)/gfxdrivers
+
+if BUILD_STATIC
+gfxdrivers_DATA = libdirectfb_sdlgraphics.o
+endif
+
+gfxdrivers_LTLIBRARIES = libdirectfb_sdlgraphics.la
+
+
+libdirectfb_sdl_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdl_la_SOURCES = \
+	primary.c		\
+	primary.h		\
+	sdl.c			\
+	sdl.h			\
+	sdl_surface_pool.c
+
+libdirectfb_sdl_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+
+libdirectfb_sdlinput_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdlinput_la_SOURCES = \
+	sdlinput.c
+
+libdirectfb_sdlinput_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+
+libdirectfb_sdlgraphics_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdlgraphics_la_SOURCES = \
+	sdlgfx.c
+
+libdirectfb_sdlgraphics_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/systems/sdl/Makefile.in b/Source/DirectFB/systems/sdl/Makefile.in
new file mode 100755
index 0000000..e628cd6
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/Makefile.in
@@ -0,0 +1,773 @@
+# 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 = systems/sdl
+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)$(gfxdriversdir)" \
+	"$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" \
+	"$(DESTDIR)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" \
+	"$(DESTDIR)$(systemsdir)"
+gfxdriversLTLIBRARIES_INSTALL = $(INSTALL)
+inputdriversLTLIBRARIES_INSTALL = $(INSTALL)
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(gfxdrivers_LTLIBRARIES) $(inputdrivers_LTLIBRARIES) \
+	$(systems_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libdirectfb_sdl_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdl_la_OBJECTS = primary.lo sdl.lo sdl_surface_pool.lo
+libdirectfb_sdl_la_OBJECTS = $(am_libdirectfb_sdl_la_OBJECTS)
+libdirectfb_sdl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_sdl_la_LDFLAGS) $(LDFLAGS) -o $@
+libdirectfb_sdlgraphics_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdlgraphics_la_OBJECTS = sdlgfx.lo
+libdirectfb_sdlgraphics_la_OBJECTS =  \
+	$(am_libdirectfb_sdlgraphics_la_OBJECTS)
+libdirectfb_sdlgraphics_la_LINK = $(LIBTOOL) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(AM_CFLAGS) $(CFLAGS) $(libdirectfb_sdlgraphics_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+libdirectfb_sdlinput_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdlinput_la_OBJECTS = sdlinput.lo
+libdirectfb_sdlinput_la_OBJECTS =  \
+	$(am_libdirectfb_sdlinput_la_OBJECTS)
+libdirectfb_sdlinput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_sdlinput_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_sdl_la_SOURCES) \
+	$(libdirectfb_sdlgraphics_la_SOURCES) \
+	$(libdirectfb_sdlinput_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_sdl_la_SOURCES) \
+	$(libdirectfb_sdlgraphics_la_SOURCES) \
+	$(libdirectfb_sdlinput_la_SOURCES)
+gfxdriversDATA_INSTALL = $(INSTALL_DATA)
+inputdriversDATA_INSTALL = $(INSTALL_DATA)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(gfxdrivers_DATA) $(inputdrivers_DATA) $(systems_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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	$(SDL_CFLAGS)
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_sdl.o
+systems_LTLIBRARIES = libdirectfb_sdl.la
+inputdriversdir = $(MODULEDIR)/inputdrivers
+@BUILD_STATIC_TRUE@inputdrivers_DATA = libdirectfb_sdlinput.o
+inputdrivers_LTLIBRARIES = libdirectfb_sdlinput.la
+gfxdriversdir = $(MODULEDIR)/gfxdrivers
+@BUILD_STATIC_TRUE@gfxdrivers_DATA = libdirectfb_sdlgraphics.o
+gfxdrivers_LTLIBRARIES = libdirectfb_sdlgraphics.la
+libdirectfb_sdl_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdl_la_SOURCES = \
+	primary.c		\
+	primary.h		\
+	sdl.c			\
+	sdl.h			\
+	sdl_surface_pool.c
+
+libdirectfb_sdl_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+libdirectfb_sdlinput_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdlinput_la_SOURCES = \
+	sdlinput.c
+
+libdirectfb_sdlinput_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+libdirectfb_sdlgraphics_la_LDFLAGS = \
+	-avoid-version	\
+	-module
+
+libdirectfb_sdlgraphics_la_SOURCES = \
+	sdlgfx.c
+
+libdirectfb_sdlgraphics_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la \
+	$(SDL_LIBS)
+
+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  systems/sdl/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/sdl/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-gfxdriversLTLIBRARIES: $(gfxdrivers_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(gfxdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(gfxdriversdir)"
+	@list='$(gfxdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(gfxdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(gfxdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-gfxdriversLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(gfxdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(gfxdriversdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(gfxdriversdir)/$$p"; \
+	done
+
+clean-gfxdriversLTLIBRARIES:
+	-test -z "$(gfxdrivers_LTLIBRARIES)" || rm -f $(gfxdrivers_LTLIBRARIES)
+	@list='$(gfxdrivers_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
+install-inputdriversLTLIBRARIES: $(inputdrivers_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputdriversLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdriversdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdriversdir)/$$p"; \
+	done
+
+clean-inputdriversLTLIBRARIES:
+	-test -z "$(inputdrivers_LTLIBRARIES)" || rm -f $(inputdrivers_LTLIBRARIES)
+	@list='$(inputdrivers_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
+install-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_sdl.la: $(libdirectfb_sdl_la_OBJECTS) $(libdirectfb_sdl_la_DEPENDENCIES) 
+	$(libdirectfb_sdl_la_LINK) -rpath $(systemsdir) $(libdirectfb_sdl_la_OBJECTS) $(libdirectfb_sdl_la_LIBADD) $(LIBS)
+libdirectfb_sdlgraphics.la: $(libdirectfb_sdlgraphics_la_OBJECTS) $(libdirectfb_sdlgraphics_la_DEPENDENCIES) 
+	$(libdirectfb_sdlgraphics_la_LINK) -rpath $(gfxdriversdir) $(libdirectfb_sdlgraphics_la_OBJECTS) $(libdirectfb_sdlgraphics_la_LIBADD) $(LIBS)
+libdirectfb_sdlinput.la: $(libdirectfb_sdlinput_la_OBJECTS) $(libdirectfb_sdlinput_la_DEPENDENCIES) 
+	$(libdirectfb_sdlinput_la_LINK) -rpath $(inputdriversdir) $(libdirectfb_sdlinput_la_OBJECTS) $(libdirectfb_sdlinput_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlgfx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlinput.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-gfxdriversDATA: $(gfxdrivers_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(gfxdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(gfxdriversdir)"
+	@list='$(gfxdrivers_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(gfxdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+	  $(gfxdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+	done
+
+uninstall-gfxdriversDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(gfxdrivers_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+	done
+install-inputdriversDATA: $(inputdrivers_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  $(inputdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+
+uninstall-inputdriversDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+install-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$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)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)"; 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-gfxdriversLTLIBRARIES \
+	clean-inputdriversLTLIBRARIES clean-libtool \
+	clean-systemsLTLIBRARIES 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-gfxdriversDATA install-gfxdriversLTLIBRARIES \
+	install-inputdriversDATA install-inputdriversLTLIBRARIES \
+	install-systemsDATA install-systemsLTLIBRARIES
+
+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-gfxdriversDATA uninstall-gfxdriversLTLIBRARIES \
+	uninstall-inputdriversDATA uninstall-inputdriversLTLIBRARIES \
+	uninstall-systemsDATA uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-gfxdriversLTLIBRARIES clean-inputdriversLTLIBRARIES \
+	clean-libtool clean-systemsLTLIBRARIES 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-gfxdriversDATA install-gfxdriversLTLIBRARIES \
+	install-html install-html-am install-info install-info-am \
+	install-inputdriversDATA install-inputdriversLTLIBRARIES \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip install-systemsDATA \
+	install-systemsLTLIBRARIES 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-gfxdriversDATA \
+	uninstall-gfxdriversLTLIBRARIES uninstall-inputdriversDATA \
+	uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+%.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/systems/sdl/primary.c b/Source/DirectFB/systems/sdl/primary.c
new file mode 100755
index 0000000..94c0fb7
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/primary.c
@@ -0,0 +1,669 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+
+#include <directfb.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <SDL.h>
+
+#include "sdl.h"
+#include "primary.h"
+
+D_DEBUG_DOMAIN( SDL_Screen,  "SDL/Screen",  "SDL System Screen" );
+D_DEBUG_DOMAIN( SDL_Updates, "SDL/Updates", "SDL System Screen Updates" );
+
+/******************************************************************************/
+
+static DFBResult update_screen( int x, int y, int w, int h );
+
+/******************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen           *screen,
+                   CoreGraphicsDevice   *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_NONE;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "SDL Primary Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     D_ASSERT( dfb_sdl != NULL );
+
+     if (dfb_sdl->primary) {
+          *ret_width  = dfb_sdl->primary->config.size.w;
+          *ret_height = dfb_sdl->primary->config.size.w;
+     }
+     else {
+          if (dfb_config->mode.width)
+               *ret_width  = dfb_config->mode.width;
+          else
+               *ret_width  = 640;
+
+          if (dfb_config->mode.height)
+               *ret_height = dfb_config->mode.height;
+          else
+               *ret_height = 480;
+     }
+
+     return DFB_OK;
+}
+
+ScreenFuncs sdlPrimaryScreenFuncs = {
+     .InitScreen    = primaryInitScreen,
+     .GetScreenSize = primaryGetScreenSize,
+};
+
+/******************************************************************************/
+
+static void * ScreenUpdateLoop( DirectThread *thread, void *arg );
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+     return 0;
+}
+
+static int
+primaryRegionDataSize( void )
+{
+     return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  DFBDisplayLayerDescription *description,
+                  DFBDisplayLayerConfig      *config,
+                  DFBColorAdjustment         *adjustment )
+{
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "SDL Primary Layer" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+     config->buffermode  = DLBM_FRONTONLY;
+
+     if (dfb_config->mode.width)
+          config->width  = dfb_config->mode.width;
+     else
+          config->width  = 640;
+
+     if (dfb_config->mode.height)
+          config->height = dfb_config->mode.height;
+     else
+          config->height = 480;
+
+     if (dfb_config->mode.format != DSPF_UNKNOWN)
+          config->pixelformat = dfb_config->mode.format;
+     else if (dfb_config->mode.depth > 0)
+          config->pixelformat = dfb_pixelformat_for_depth( dfb_config->mode.depth );
+     else
+          config->pixelformat = DSPF_RGB16;
+
+     /* Initialize update lock and condition. */
+     pthread_mutex_init( &dfb_sdl->update.lock, NULL );
+     pthread_cond_init( &dfb_sdl->update.cond, NULL );
+
+     /* Start update thread. */
+     dfb_sdl->update.thread = direct_thread_create( DTT_OUTPUT, ScreenUpdateLoop, NULL, "Screen Update" );
+     if (!dfb_sdl->update.thread)
+          return DFB_FAILURE;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+               break;
+
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+
+     if (config->options)
+          fail |= CLRCF_OPTIONS;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  void                       *region_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags  updated,
+                  CoreSurface                *surface,
+                  CorePalette                *palette,
+                  CoreSurfaceBufferLock      *lock )
+{
+     if (surface) {
+          pthread_mutex_lock( &dfb_sdl->update.lock );
+          dfb_sdl->primary = surface;
+          dfb_sdl->update.pending = false;
+          pthread_mutex_unlock( &dfb_sdl->update.lock );
+     }
+
+     if (palette)
+          dfb_sdl_set_palette( palette );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data )
+{
+     D_DEBUG_AT( SDL_Updates, "%s( %p )\n", __FUNCTION__, layer );
+
+     D_DEBUG_AT( SDL_Updates, "  -> locking sdl lock...\n" );
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+
+     D_DEBUG_AT( SDL_Updates, "  -> setting primary to NULL...\n" );
+
+     dfb_sdl->primary = NULL;
+
+     D_DEBUG_AT( SDL_Updates, "  -> unlocking sdl lock...\n" );
+
+     fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+     D_DEBUG_AT( SDL_Updates, "  -> done.\n" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer             *layer,
+                   void                  *driver_data,
+                   void                  *layer_data,
+                   void                  *region_data,
+                   CoreSurface           *surface,
+                   DFBSurfaceFlipFlags    flags,
+                   CoreSurfaceBufferLock *lock )
+{
+     dfb_surface_flip( surface, false );
+
+     return dfb_sdl_update_screen( dfb_sdl_core, NULL );
+}
+
+static DFBResult
+primaryUpdateRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data,
+                     CoreSurface           *surface,
+                     const DFBRegion       *update,
+                     CoreSurfaceBufferLock *lock )
+{
+     if (update) {
+          DFBRegion region = *update;
+
+          return dfb_sdl_update_screen( dfb_sdl_core, ®ion );
+     }
+
+     return dfb_sdl_update_screen( dfb_sdl_core, NULL );
+}
+
+DisplayLayerFuncs sdlPrimaryLayerFuncs = {
+     .LayerDataSize     = primaryLayerDataSize,
+     .RegionDataSize    = primaryRegionDataSize,
+     .InitLayer         = primaryInitLayer,
+
+     .TestRegion        = primaryTestRegion,
+     .AddRegion         = primaryAddRegion,
+     .SetRegion         = primarySetRegion,
+     .RemoveRegion      = primaryRemoveRegion,
+     .FlipRegion        = primaryFlipRegion,
+     .UpdateRegion      = primaryUpdateRegion,
+};
+
+/******************************************************************************/
+
+static DFBResult
+update_screen( int x, int y, int w, int h )
+{
+#if 0
+     int                    i, n;
+     void                  *dst;
+     void                  *src;
+     DFBResult              ret;
+     CoreSurface           *surface;
+     CoreSurfaceBuffer     *buffer;
+     CoreSurfaceBufferLock  lock;
+     u16                   *src16, *dst16;
+     u8                    *src8;
+#endif
+
+     D_DEBUG_AT( SDL_Updates, "%s( %d, %d, %d, %d )\n", __FUNCTION__, x, y, w, h );
+
+     D_DEBUG_AT( SDL_Updates, "  -> locking sdl lock...\n" );
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+#if 0
+     surface = dfb_sdl->primary;
+     D_MAGIC_ASSERT_IF( surface, CoreSurface );
+
+     D_DEBUG_AT( SDL_Updates, "  -> primary is %p\n", surface );
+
+     if (!surface) {
+          D_DEBUG_AT( SDL_Updates, "  -> unlocking sdl lock...\n" );
+          fusion_skirmish_dismiss( &dfb_sdl->lock );
+          D_DEBUG_AT( SDL_Updates, "  -> done.\n" );
+          return DFB_OK;
+     }
+
+     buffer = dfb_surface_get_buffer( surface, CSBR_FRONT );
+
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     D_DEBUG_AT( SDL_Updates, "  -> locking sdl surface...\n" );
+
+     if (SDL_LockSurface( screen ) < 0) {
+          D_ERROR( "DirectFB/SDL: "
+                   "Couldn't lock the display surface: %s\n", SDL_GetError() );
+          fusion_skirmish_dismiss( &dfb_sdl->lock );
+          return DFB_FAILURE;
+     }
+
+     D_DEBUG_AT( SDL_Updates, "  -> locking dfb surface...\n" );
+
+     ret = dfb_surface_buffer_lock( buffer, CSAF_CPU_READ, &lock );
+     if (ret) {
+          D_ERROR( "DirectFB/SDL: Couldn't lock layer surface: %s\n",
+                   DirectFBErrorString( ret ) );
+          SDL_UnlockSurface(screen);
+          fusion_skirmish_dismiss( &dfb_sdl->lock );
+          return ret;
+     }
+
+     src = lock.addr;
+     dst = screen->pixels;
+
+     src += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * lock.pitch;
+     dst += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * screen->pitch;
+
+     D_DEBUG_AT( SDL_Updates, "  -> copying pixels...\n" );
+
+     switch (screen->format->BitsPerPixel) {
+          case 16:
+               dfb_convert_to_rgb16( surface->config.format,
+                                     src, lock.pitch, surface->config.size.h,
+                                     dst, screen->pitch, w, h );
+               break;
+
+          default:
+               direct_memcpy( dst, src, DFB_BYTES_PER_LINE( surface->config.format, w ) );
+     }
+
+     D_DEBUG_AT( SDL_Updates, "  -> unlocking dfb surface...\n" );
+
+     dfb_surface_buffer_unlock( &lock );
+
+     D_DEBUG_AT( SDL_Updates, "  -> unlocking sdl surface...\n" );
+
+     SDL_UnlockSurface( screen );
+#endif
+     D_DEBUG_AT( SDL_Updates, "  -> calling SDL_UpdateRect()...\n" );
+
+     SDL_UpdateRect( dfb_sdl->screen, x, y, w, h );
+
+     D_DEBUG_AT( SDL_Updates, "  -> unlocking sdl lock...\n" );
+
+     fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+     D_DEBUG_AT( SDL_Updates, "  -> done.\n" );
+
+     return DFB_OK;
+}
+
+static void *
+ScreenUpdateLoop( DirectThread *thread, void *arg )
+{
+     pthread_mutex_lock( &dfb_sdl->update.lock );
+
+     D_DEBUG_AT( SDL_Updates, "Entering %s()...\n", __FUNCTION__ );
+
+     while (!dfb_sdl->update.quit) {
+          if (dfb_sdl->update.pending) {
+               DFBRectangle update = DFB_RECTANGLE_INIT_FROM_REGION( &dfb_sdl->update.region );
+
+               dfb_sdl->update.pending = false;
+
+               D_DEBUG_AT( SDL_Updates, "Got update %d,%d - %dx%d...\n", DFB_RECTANGLE_VALS( &update ) );
+
+               pthread_mutex_unlock( &dfb_sdl->update.lock );
+
+
+               update_screen( update.x, update.y, update.w, update.h );
+
+
+               pthread_mutex_lock( &dfb_sdl->update.lock );
+          }
+          else
+               pthread_cond_wait( &dfb_sdl->update.cond, &dfb_sdl->update.lock );
+     }
+
+     D_DEBUG_AT( SDL_Updates, "Returning from %s()...\n", __FUNCTION__ );
+
+     pthread_mutex_unlock( &dfb_sdl->update.lock );
+
+     return NULL;
+}
+
+/******************************************************************************/
+
+typedef enum {
+     SDL_SET_VIDEO_MODE,
+     SDL_UPDATE_SCREEN,
+     SDL_SET_PALETTE
+} DFBSDLCall;
+
+static inline int
+get_pixelformat_target_depth( DFBSurfacePixelFormat format )
+{
+     switch (format) {
+          case DSPF_NV16:
+               return 16;
+
+          default:
+               break;
+     }
+
+     return DFB_BITS_PER_PIXEL( format );
+}
+
+static DFBResult
+dfb_sdl_set_video_mode_handler( CoreSurfaceConfig *config )
+{
+     int          depth = get_pixelformat_target_depth( config->format );
+     Uint32       flags = SDL_HWSURFACE | SDL_RESIZABLE;// | SDL_ASYNCBLIT | SDL_FULLSCREEN;
+     SDL_Surface *screen;
+
+     if (config->caps & DSCAPS_FLIPPING)
+          flags |= SDL_DOUBLEBUF;
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+
+     D_DEBUG_AT( SDL_Screen, "  -> SDL_SetVideoMode( %dx%d, %d, 0x%08x )\n",
+                 config->size.w, config->size.h, DFB_BITS_PER_PIXEL(config->format), flags );
+
+     /* Set video mode */
+     screen = SDL_SetVideoMode( config->size.w, config->size.h, depth, flags );
+     if (!screen) {
+          D_ERROR( "DirectFB/SDL: Couldn't set %dx%dx%d video mode: %s\n",
+                   config->size.w, config->size.h, depth, SDL_GetError());
+
+          fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+          return DFB_FAILURE;
+     }
+
+     dfb_sdl->screen = screen;
+
+     /* Hide SDL's cursor */
+     SDL_ShowCursor( SDL_DISABLE );
+
+     fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_sdl_update_screen_handler( const DFBRegion *region )
+{
+     DFBRegion    update;
+     CoreSurface *surface = dfb_sdl->primary;
+
+     DFB_REGION_ASSERT_IF( region );
+
+     if (region)
+          update = *region;
+     else {
+          update.x1 = 0;
+          update.y1 = 0;
+          update.x2 = surface->config.size.w - 1;
+          update.y2 = surface->config.size.h - 1;
+     }
+
+#if 0
+     pthread_mutex_lock( &dfb_sdl->update.lock );
+
+     if (dfb_sdl->update.pending)
+          dfb_region_region_union( &dfb_sdl->update.region, &update );
+     else {
+          dfb_sdl->update.region  = update;
+          dfb_sdl->update.pending = true;
+     }
+
+     pthread_cond_signal( &dfb_sdl->update.cond );
+
+     pthread_mutex_unlock( &dfb_sdl->update.lock );
+#else
+     if (surface->config.caps & DSCAPS_FLIPPING)
+          SDL_Flip( dfb_sdl->screen );
+     else
+          SDL_UpdateRect( dfb_sdl->screen, DFB_RECTANGLE_VALS_FROM_REGION(&update) );
+#endif
+
+     return DFB_OK;
+}
+
+static DFBResult
+dfb_sdl_set_palette_handler( CorePalette *palette )
+{
+     unsigned int i;
+     SDL_Color    colors[palette->num_entries];
+
+     for (i=0; i<palette->num_entries; i++) {
+          colors[i].r = palette->entries[i].r;
+          colors[i].g = palette->entries[i].g;
+          colors[i].b = palette->entries[i].b;
+     }
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+
+     SDL_SetColors( dfb_sdl->screen, colors, 0, palette->num_entries );
+
+     fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+     return DFB_OK;
+}
+
+FusionCallHandlerResult
+dfb_sdl_call_handler( int           caller,
+                      int           call_arg,
+                      void         *call_ptr,
+                      void         *ctx,
+                      unsigned int  serial,
+                      int          *ret_val )
+{
+     switch (call_arg) {
+          case SDL_SET_VIDEO_MODE:
+               *ret_val = dfb_sdl_set_video_mode_handler( call_ptr );
+               break;
+
+          case SDL_UPDATE_SCREEN:
+               *ret_val = dfb_sdl_update_screen_handler( call_ptr );
+               break;
+
+          case SDL_SET_PALETTE:
+               *ret_val = dfb_sdl_set_palette_handler( call_ptr );
+               break;
+
+          default:
+               D_BUG( "unknown call" );
+               *ret_val = DFB_BUG;
+               break;
+     }
+
+     return FCHR_RETURN;
+}
+
+DFBResult
+dfb_sdl_set_video_mode( CoreDFB *core, CoreSurfaceConfig *config )
+{
+     int                ret;
+     CoreSurfaceConfig *tmp = NULL;
+
+     D_ASSERT( config != NULL );
+
+     if (dfb_core_is_master( core ))
+          return dfb_sdl_set_video_mode_handler( config );
+
+     if (!fusion_is_shared( dfb_core_world(core), config )) {
+          tmp = SHMALLOC( dfb_core_shmpool(core), sizeof(CoreSurfaceConfig) );
+          if (!tmp)
+               return D_OOSHM();
+
+          direct_memcpy( tmp, config, sizeof(CoreSurfaceConfig) );
+     }
+
+     fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_SET_VIDEO_MODE,
+                          tmp ? tmp : config, &ret );
+
+     if (tmp)
+          SHFREE( dfb_core_shmpool(core), tmp );
+
+     return ret;
+}
+
+DFBResult
+dfb_sdl_update_screen( CoreDFB *core, DFBRegion *region )
+{
+     int        ret;
+     DFBRegion *tmp = NULL;
+
+     if (dfb_core_is_master( core ))
+          return dfb_sdl_update_screen_handler( region );
+
+     if (region) {
+          tmp = SHMALLOC( dfb_core_shmpool(core), sizeof(DFBRegion) );
+          if (!tmp)
+               return D_OOSHM();
+
+          direct_memcpy( tmp, region, sizeof(DFBRegion) );
+     }
+
+     fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_UPDATE_SCREEN, tmp ? tmp : region, &ret );
+
+     if (tmp)
+          SHFREE( dfb_core_shmpool(core), tmp );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_sdl_set_palette( CorePalette *palette )
+{
+     int ret;
+
+     fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_SET_PALETTE, palette, &ret );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/systems/sdl/primary.h b/Source/DirectFB/systems/sdl/primary.h
new file mode 100755
index 0000000..faa34d2
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/primary.h
@@ -0,0 +1,49 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SDL__PRIMARY_H__
+#define __SDL__PRIMARY_H__
+
+#include <fusion/call.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+extern ScreenFuncs       sdlPrimaryScreenFuncs;
+extern DisplayLayerFuncs sdlPrimaryLayerFuncs;
+
+FusionCallHandlerResult
+dfb_sdl_call_handler( int           caller,
+                      int           call_arg,
+                      void         *call_ptr,
+                      void         *ctx,
+                      unsigned int  serial,
+                      int          *ret_val );
+
+#endif
+
diff --git a/Source/DirectFB/systems/sdl/sdl.c b/Source/DirectFB/systems/sdl/sdl.c
new file mode 100755
index 0000000..8ecc4ca
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl.c
@@ -0,0 +1,396 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <SDL.h>
+
+#include "sdl.h"
+#include "primary.h"
+
+#include <core/core_system.h>
+
+DFB_CORE_SYSTEM( sdl )
+
+
+DFBSDL  *dfb_sdl      = NULL;
+CoreDFB *dfb_sdl_core = NULL;
+
+extern const SurfacePoolFuncs sdlSurfacePoolFuncs;
+
+static DFBResult dfb_fbdev_read_modes( void );
+
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_SDL;
+     info->caps = CSCAPS_ACCELERATION;
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "SDL" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+     char       *driver;
+     CoreScreen *screen;
+
+     D_ASSERT( dfb_sdl == NULL );
+
+     dfb_sdl = (DFBSDL*) SHCALLOC( dfb_core_shmpool(core), 1, sizeof(DFBSDL) );
+     if (!dfb_sdl) {
+          D_ERROR( "DirectFB/SDL: Couldn't allocate shared memory!\n" );
+          return D_OOSHM();
+     }
+
+     dfb_sdl_core = core;
+
+     dfb_fbdev_read_modes();  /* use same mode list as a fake */
+
+     driver = getenv( "SDL_VIDEODRIVER" );
+     if (driver && !strcasecmp( driver, "directfb" )) {
+          D_INFO( "DirectFB/SDL: SDL_VIDEODRIVER is 'directfb', unsetting it.\n" );
+          unsetenv( "SDL_VIDEODRIVER" );
+     }
+
+     /* Initialize SDL */
+     if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+          D_ERROR( "DirectFB/SDL: Couldn't initialize SDL: %s\n", SDL_GetError() );
+
+          SHFREE( dfb_core_shmpool(core), dfb_sdl );
+          dfb_sdl = NULL;
+
+          return DFB_INIT;
+     }
+
+     fusion_skirmish_init( &dfb_sdl->lock, "SDL System", dfb_core_world(core) );
+
+     fusion_call_init( &dfb_sdl->call, dfb_sdl_call_handler, NULL, dfb_core_world(core) );
+
+     screen = dfb_screens_register( NULL, NULL, &sdlPrimaryScreenFuncs );
+
+     dfb_layers_register( screen, NULL, &sdlPrimaryLayerFuncs );
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "sdl", dfb_sdl );
+
+     dfb_surface_pool_initialize( core, &sdlSurfacePoolFuncs, &dfb_sdl->sdl_pool );
+
+     *data = dfb_sdl;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+     void       *ret;
+     CoreScreen *screen;
+
+     D_ASSERT( dfb_sdl == NULL );
+
+     fusion_arena_get_shared_field( dfb_core_arena( core ), "sdl", &ret );
+
+     dfb_sdl = ret;
+     dfb_sdl_core = core;
+
+     screen = dfb_screens_register( NULL, NULL, &sdlPrimaryScreenFuncs );
+
+     dfb_layers_register( screen, NULL, &sdlPrimaryLayerFuncs );
+
+     dfb_surface_pool_join( core, dfb_sdl->sdl_pool, &sdlSurfacePoolFuncs );
+
+     *data = dfb_sdl;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     FusionSHMPoolShared *pool;
+
+     D_ASSERT( dfb_sdl != NULL );
+
+     /* Stop update thread. */
+     if (dfb_sdl->update.thread) {
+          if (!emergency) {
+               dfb_sdl->update.quit = true;
+
+               pthread_cond_signal( &dfb_sdl->update.cond );
+
+               direct_thread_join( dfb_sdl->update.thread );
+          }
+
+          direct_thread_destroy( dfb_sdl->update.thread );
+     }
+
+     dfb_surface_pool_destroy( dfb_sdl->sdl_pool );
+
+     fusion_call_destroy( &dfb_sdl->call );
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+
+     SDL_Quit();
+
+     fusion_skirmish_destroy( &dfb_sdl->lock );
+
+     pool = dfb_core_shmpool(dfb_sdl_core);
+
+     while (dfb_sdl->modes) {
+          VideoMode *next = dfb_sdl->modes->next;
+
+          SHFREE( pool, dfb_sdl->modes );
+
+          dfb_sdl->modes = next;
+     }
+
+     SHFREE( pool, dfb_sdl );
+     dfb_sdl = NULL;
+     dfb_sdl_core = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     D_ASSERT( dfb_sdl != NULL );
+
+     dfb_sdl = NULL;
+     dfb_sdl_core = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+system_resume( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+    return NULL;
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+}
+
+static int
+system_get_accelerator( void )
+{
+     return -1;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return dfb_sdl->modes;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return NULL;
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event )
+{
+     return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return 0;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+     return;
+}
+
+
+/*
+ * parses video modes in /etc/fb.modes and stores them in dfb_fbdev->shared->modes
+ * (to be replaced by DirectFB's own config system
+ */
+static DFBResult dfb_fbdev_read_modes( void )
+{
+     FILE *fp;
+     char line[80],label[32],value[16];
+     int geometry=0, timings=0;
+     int dummy;
+     VideoMode temp_mode;
+     VideoMode *m = dfb_sdl->modes;
+
+     if (!(fp = fopen("/etc/fb.modes","r")))
+          return errno2result( errno );
+
+     while (fgets(line,79,fp)) {
+          if (sscanf(line, "mode \"%31[^\"]\"",label) == 1) {
+               memset( &temp_mode, 0, sizeof(VideoMode) );
+               geometry = 0;
+               timings = 0;
+               while (fgets(line,79,fp) && !(strstr(line,"endmode"))) {
+                    if (5 == sscanf(line," geometry %d %d %d %d %d", &temp_mode.xres, &temp_mode.yres, &dummy, &dummy, &temp_mode.bpp)) {
+                         geometry = 1;
+                    }
+                    else if (7 == sscanf(line," timings %d %d %d %d %d %d %d", &temp_mode.pixclock, &temp_mode.left_margin,  &temp_mode.right_margin,
+                                         &temp_mode.upper_margin, &temp_mode.lower_margin, &temp_mode.hsync_len,    &temp_mode.vsync_len)) {
+                         timings = 1;
+                    }
+                    else if (1 == sscanf(line, " hsync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.hsync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " vsync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.vsync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " csync %15s",value) && 0 == strcasecmp(value,"high")) {
+                         temp_mode.csync_high = 1;
+                    }
+                    else if (1 == sscanf(line, " laced %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.laced = 1;
+                    }
+                    else if (1 == sscanf(line, " double %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.doubled = 1;
+                    }
+                    else if (1 == sscanf(line, " gsync %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.sync_on_green = 1;
+                    }
+                    else if (1 == sscanf(line, " extsync %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.external_sync = 1;
+                    }
+                    else if (1 == sscanf(line, " bcast %15s",value) && 0 == strcasecmp(value,"true")) {
+                         temp_mode.broadcast = 1;
+                    }
+               }
+               if (geometry && timings) {
+                    if (!m) {
+                         dfb_sdl->modes = SHCALLOC( dfb_core_shmpool(dfb_sdl_core), 1, sizeof(VideoMode) );
+                         m = dfb_sdl->modes;
+                    }
+                    else {
+                         m->next = SHCALLOC( dfb_core_shmpool(dfb_sdl_core), 1, sizeof(VideoMode) );
+                         m = m->next;
+                    }
+                    direct_memcpy (m, &temp_mode, sizeof(VideoMode));
+                    D_DEBUG( "DirectFB/FBDev: %20s %4dx%4d  %s%s\n", label, temp_mode.xres, temp_mode.yres,
+                              temp_mode.laced ? "interlaced " : "", temp_mode.doubled ? "doublescan" : "" );
+               }
+          }
+     }
+
+     fclose (fp);
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/systems/sdl/sdl.h b/Source/DirectFB/systems/sdl/sdl.h
new file mode 100755
index 0000000..2ed9ef6
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl.h
@@ -0,0 +1,70 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SDL__SDL_H__
+#define __SDL__SDL_H__
+
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+#include <core/surface_pool.h>
+#include <core/system.h>
+
+typedef struct {
+     FusionSkirmish   lock;
+     FusionCall       call;
+
+     CoreSurface     *primary;
+     CoreSurfacePool *sdl_pool;
+
+     struct {
+          pthread_mutex_t  lock;
+          pthread_cond_t   cond;
+
+          DirectThread    *thread;
+
+          bool             pending;
+          DFBRegion        region;
+
+          bool             quit;
+     } update;
+
+     VideoMode            *modes;        /* linked list of valid video modes */
+
+     SDL_Surface          *screen;
+} DFBSDL;
+
+extern DFBSDL  *dfb_sdl;
+extern CoreDFB *dfb_sdl_core;
+
+DFBResult dfb_sdl_set_video_mode( CoreDFB *core, CoreSurfaceConfig *config );
+DFBResult dfb_sdl_update_screen( CoreDFB *core, DFBRegion *region );
+DFBResult dfb_sdl_set_palette( CorePalette *palette );
+
+#endif
+
diff --git a/Source/DirectFB/systems/sdl/sdl_surface_pool.c b/Source/DirectFB/systems/sdl/sdl_surface_pool.c
new file mode 100755
index 0000000..d1b8703
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl_surface_pool.c
@@ -0,0 +1,349 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <SDL.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <directfb_util.h>
+
+#include "sdl.h"
+
+D_DEBUG_DOMAIN( SDL_Pool, "SDL/Pool", "SDL Surface Pool" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+} SDLPoolData;
+
+typedef struct {
+     int          magic;
+
+     SDL_Surface *sdl_surf;
+} SDLAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+sdlPoolDataSize( void )
+{
+     return sizeof(SDLPoolData);
+}
+
+static int
+sdlAllocationDataSize( void )
+{
+     return sizeof(SDLAllocationData);
+}
+
+static DFBResult
+sdlInitPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data,
+             CoreSurfacePoolDescription *ret_desc )
+{
+     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps              = CSPCAPS_NONE;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE;
+     ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_PREFERED;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "SDL" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlDestroyPool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlTestConfig( CoreSurfacePool         *pool,
+               void                    *pool_data,
+               void                    *pool_local,
+               CoreSurfaceBuffer       *buffer,
+               const CoreSurfaceConfig *config )
+{
+     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     switch (config->format) {
+          case DSPF_A8:
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+               break;
+
+          default:
+               return DFB_UNSUPPORTED;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlAllocateBuffer( CoreSurfacePool       *pool,
+                   void                  *pool_data,
+                   void                  *pool_local,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation,
+                   void                  *alloc_data )
+{
+     DFBResult          ret;
+     CoreSurface       *surface;
+     SDLAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (surface->type & CSTF_LAYER) {
+          dfb_sdl->screen = NULL; /* clear? */
+
+          ret = dfb_sdl_set_video_mode( dfb_sdl_core, &surface->config );
+          if (ret) {
+               D_DERROR( ret, "SDL/Surface: dfb_sdl_set_video_mode() failed!\n" );
+               return ret;
+          }
+
+          D_ASSERT( dfb_sdl->screen != NULL );
+
+          if (!dfb_sdl->screen) {
+               D_ERROR( "SDL/Surface: No screen surface!?\n" );
+               return DFB_BUG;
+          }
+
+          alloc->sdl_surf = dfb_sdl->screen;
+
+          D_DEBUG_AT( SDL_Pool, "  -> screen surface  %dx%d, %d, 0x%08x, pitch %d\n",
+                      dfb_sdl->screen->w, dfb_sdl->screen->h, dfb_sdl->screen->format->BitsPerPixel,
+                      dfb_sdl->screen->flags, dfb_sdl->screen->pitch );
+
+          allocation->flags |= CSALF_ONEFORALL;
+     }
+     else {
+          DFBSurfacePixelFormat  format = surface->config.format;
+          Uint32                 flags  = SDL_HWSURFACE;// | SDL_ASYNCBLIT | SDL_FULLSCREEN;
+          Uint32                 rmask;
+          Uint32                 gmask;
+          Uint32                 bmask;
+          Uint32                 amask;
+
+          if (surface->config.caps & DSCAPS_FLIPPING)
+               flags |= SDL_DOUBLEBUF;
+
+          switch (format) {
+               case DSPF_A8:
+                    rmask = 0x00;
+                    gmask = 0x00;
+                    bmask = 0x00;
+                    amask = 0xff;
+                    break;
+
+               case DSPF_RGB16:
+                    rmask = 0xf800;
+                    gmask = 0x07e0;
+                    bmask = 0x001f;
+                    amask = 0x0000;
+                    break;
+
+               case DSPF_RGB32:
+                    rmask = 0x00ff0000;
+                    gmask = 0x0000ff00;
+                    bmask = 0x000000ff;
+                    amask = 0x00000000;
+                    break;
+
+               case DSPF_ARGB:
+                    rmask = 0x00ff0000;
+                    gmask = 0x0000ff00;
+                    bmask = 0x000000ff;
+                    amask = 0xff000000;
+                    break;
+
+               default:
+                    D_ERROR( "SDL/Surface: %s() has no support for %s!\n",
+                             __FUNCTION__, dfb_pixelformat_name(format) );
+                    return DFB_UNSUPPORTED;
+          }
+
+          D_DEBUG_AT( SDL_Pool, "  -> SDL_CreateRGBSurface( 0x%08x, "
+                      "%dx%d, %d, 0x%08x, 0x%08x, 0x%08x, 0x%08x )\n",
+                      flags, surface->config.size.w, surface->config.size.h,
+                      DFB_BITS_PER_PIXEL(format), rmask, gmask, bmask, amask );
+
+          alloc->sdl_surf = SDL_CreateRGBSurface( flags,
+                                                  surface->config.size.w,
+                                                  surface->config.size.h,
+                                                  DFB_BITS_PER_PIXEL(format),
+                                                  rmask, gmask, bmask, amask );
+          if (!alloc->sdl_surf) {
+               D_ERROR( "SDL/Surface: SDL_CreateRGBSurface( 0x%08x, "
+                        "%dx%d, %d, 0x%08x, 0x%08x, 0x%08x, 0x%08x ) failed!\n",
+                        flags, surface->config.size.w, surface->config.size.h,
+                        DFB_BITS_PER_PIXEL(format), rmask, gmask, bmask, amask );
+
+               return DFB_FAILURE;
+          }
+     }
+
+     D_MAGIC_SET( alloc, SDLAllocationData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlDeallocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     SDLAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, SDLAllocationData );
+
+     SDL_FreeSurface( alloc->sdl_surf );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlLock( CoreSurfacePool       *pool,
+         void                  *pool_data,
+         void                  *pool_local,
+         CoreSurfaceAllocation *allocation,
+         void                  *alloc_data,
+         CoreSurfaceBufferLock *lock )
+{
+     SDLAllocationData *alloc = alloc_data;
+     SDL_Surface       *sdl_surf;
+
+//     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, SDLAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     sdl_surf = alloc->sdl_surf;
+     D_ASSERT( sdl_surf != NULL );
+
+     if (SDL_MUSTLOCK( sdl_surf ) && SDL_LockSurface( sdl_surf )) {
+          D_ERROR( "SDL/Surface: SDL_LockSurface() on a %dx%dx surface failed!\n", sdl_surf->w, sdl_surf->h );
+          return DFB_FAILURE;
+     }
+
+     D_ASSUME( sdl_surf->pixels != NULL );
+     if (!sdl_surf->pixels)
+          return DFB_UNSUPPORTED;
+
+     D_ASSERT( sdl_surf->pitch > 0 );
+
+     lock->addr   = sdl_surf->pixels;
+     lock->pitch  = sdl_surf->pitch;
+     lock->offset = sdl_surf->offset;
+     lock->handle = sdl_surf;
+
+     return DFB_OK;
+}
+
+static DFBResult
+sdlUnlock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     SDLAllocationData *alloc = alloc_data;
+     SDL_Surface       *sdl_surf;
+
+//     D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, SDLAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     sdl_surf = alloc->sdl_surf;
+     D_ASSERT( sdl_surf != NULL );
+
+     if (SDL_MUSTLOCK( sdl_surf ))
+          SDL_UnlockSurface( sdl_surf );
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs sdlSurfacePoolFuncs = {
+     .PoolDataSize       = sdlPoolDataSize,
+     .AllocationDataSize = sdlAllocationDataSize,
+     .InitPool           = sdlInitPool,
+     .DestroyPool        = sdlDestroyPool,
+
+     .TestConfig         = sdlTestConfig,
+
+     .AllocateBuffer     = sdlAllocateBuffer,
+     .DeallocateBuffer   = sdlDeallocateBuffer,
+
+     .Lock               = sdlLock,
+     .Unlock             = sdlUnlock,
+};
+
diff --git a/Source/DirectFB/systems/sdl/sdlgfx.c b/Source/DirectFB/systems/sdl/sdlgfx.c
new file mode 100755
index 0000000..811d545
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdlgfx.c
@@ -0,0 +1,302 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <SDL.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/windows.h>
+#include <core/layers.h>
+#include <core/screens.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( sdlgraphics )
+
+#include "sdl.h"
+
+/* FIXME: support for destination color keying */
+
+#define SDL_DRAWING_FLAGS \
+               (DSDRAW_NOFX)
+
+#define SDL_DRAWING_FUNCTIONS \
+               (DFXL_FILLRECTANGLE)
+
+#define SDL_BLITTING_FLAGS \
+               (DSBLIT_SRC_COLORKEY)
+
+#define SDL_BLITTING_FUNCTIONS \
+               (DFXL_BLIT)
+
+D_DEBUG_DOMAIN( SDL_GFX, "SDL/Graphics", "SDL Graphics" );
+
+typedef struct {
+} SDLDriverData;
+
+typedef struct {
+     SDL_Surface *dest;
+     SDL_Surface *source;
+
+     u32          color;
+
+     bool         color_valid;
+     bool         key_valid;
+} SDLDeviceData;
+
+
+static DFBResult sdlEngineSync( void *drv, void *dev )
+{
+     return DFB_OK;
+}
+
+static void sdlCheckState( void *drv, void *dev,
+                           CardState *state, DFBAccelerationMask accel )
+{
+     /* check destination format first */
+     switch (state->destination->config.format) {
+          case DSPF_RGB16:
+          case DSPF_RGB32:
+               break;
+          default:
+               return;
+     }
+
+     if (DFB_DRAWING_FUNCTION( accel )) {
+          /* if there are no other drawing flags than the supported */
+          if (state->drawingflags & ~SDL_DRAWING_FLAGS)
+               return;
+
+          state->accel |= SDL_DRAWING_FUNCTIONS;
+     }
+     else {
+          /* if there are no other blitting flags than the supported
+             and the source and destination formats are the same */
+          if (state->blittingflags & ~SDL_BLITTING_FLAGS)
+               return;
+
+          /* check source format */
+          switch (state->source->config.format) {
+               case DSPF_RGB16:
+               case DSPF_RGB32:
+                    break;
+               default:
+                    return;
+          }
+
+          state->accel |= SDL_BLITTING_FUNCTIONS;
+     }
+}
+
+static void sdlSetState( void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+                         CardState *state, DFBAccelerationMask accel )
+{
+     SDLDeviceData *sdev = (SDLDeviceData*) dev;
+
+     sdev->dest   = state->dst.handle;
+     sdev->source = state->src.handle;
+
+     if (state->mod_hw & (SMF_SOURCE | SMF_BLITTING_FLAGS | SMF_SRC_COLORKEY))
+          sdev->key_valid = false;
+
+     if (state->mod_hw & (SMF_DESTINATION | SMF_COLOR))
+          sdev->color_valid = false;
+
+     switch (accel) {
+          case DFXL_FILLRECTANGLE:
+               if (!sdev->color_valid) {
+                    switch (state->destination->config.format) {
+                         case DSPF_RGB16:
+                         case DSPF_RGB32:
+                              sdev->color = dfb_color_to_pixel( state->destination->config.format,
+                                                                state->color.r,
+                                                                state->color.g,
+                                                                state->color.b );
+                              break;
+
+                         default:
+                              D_BUG( "unexpected format" );
+                    }
+
+                    sdev->color_valid = true;
+               }
+
+               state->set |= SDL_DRAWING_FUNCTIONS;
+               break;
+
+          case DFXL_BLIT:
+               if (!sdev->key_valid) {
+                    SDL_SetColorKey( sdev->source,
+                                     (state->blittingflags &
+                                      DSBLIT_SRC_COLORKEY) ? SDL_SRCCOLORKEY : 0,
+                                     state->src_colorkey | 0xff000000 );
+
+                    sdev->key_valid = true;
+               }
+
+               state->set |= SDL_BLITTING_FUNCTIONS;
+               break;
+
+          default:
+               D_BUG("unexpected acceleration" );
+               break;
+     }
+
+     state->mod_hw = 0;
+}
+
+static bool sdlFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+     SDLDeviceData *sdev = (SDLDeviceData*) dev;
+     SDL_Rect       dr;
+
+     dr.x = rect->x;
+     dr.y = rect->y;
+     dr.w = rect->w;
+     dr.h = rect->h;
+
+     return SDL_FillRect( sdev->dest, &dr, sdev->color ) == 0;
+}
+
+static bool sdlBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+     SDLDeviceData *sdev = (SDLDeviceData*) dev;
+     SDL_Rect       sr, dr;
+
+     D_DEBUG_AT( SDL_GFX, "%s()\n", __FUNCTION__ );
+
+     sr.x = rect->x;
+     sr.y = rect->y;
+     sr.w = rect->w;
+     sr.h = rect->h;
+
+     dr.x = dx;
+     dr.y = dy;
+     dr.w = rect->w;
+     dr.h = rect->h;
+
+     return SDL_BlitSurface( sdev->source, &sr, sdev->dest, &dr ) == 0;
+}
+
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+     return dfb_system_type() == CORE_SDL;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+                 GraphicsDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf( info->name,
+               DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+               "SDL Graphics Driver" );
+
+     snprintf( info->vendor,
+               DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+               "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+
+     info->driver_data_size = sizeof (SDLDriverData);
+     info->device_data_size = sizeof (SDLDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice  *device,
+                    GraphicsDeviceFuncs *funcs,
+                    void                *driver_data,
+                    void                *device_data,
+                    CoreDFB             *core )
+{
+     /* fill acceleration function table */
+     funcs->EngineSync    = sdlEngineSync;
+     funcs->CheckState    = sdlCheckState;
+     funcs->SetState      = sdlSetState;
+
+     funcs->FillRectangle = sdlFillRectangle;
+     funcs->Blit          = sdlBlit;
+
+     return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+                    GraphicsDeviceInfo *device_info,
+                    void               *driver_data,
+                    void               *device_data )
+{
+     /* fill device info */
+     snprintf( device_info->name,
+               DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Graphics" );
+
+     snprintf( device_info->vendor,
+               DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "SDL" );
+
+
+     device_info->caps.flags    = CCF_READSYSMEM;
+     device_info->caps.accel    = SDL_DRAWING_FUNCTIONS |
+                                  SDL_BLITTING_FUNCTIONS;
+     device_info->caps.drawing  = SDL_DRAWING_FLAGS;
+     device_info->caps.blitting = SDL_BLITTING_FLAGS;
+
+     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/systems/sdl/sdlinput.c b/Source/DirectFB/systems/sdl/sdlinput.c
new file mode 100755
index 0000000..4b94b14
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdlinput.c
@@ -0,0 +1,571 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <SDL.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+#include <core/system.h>
+
+#include <direct/mem.h>
+#include <direct/thread.h>
+
+#include "sdl.h"
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( sdlinput )
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice *device;
+     DirectThread    *thread;
+     DFBSDL          *dfb_sdl;
+     int              stop;
+} SDLInputData;
+
+
+static DFBInputEvent motionX = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static DFBInputEvent motionY = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static void
+motion_compress( int x, int y )
+{
+     if (motionX.axisabs != x) {
+          motionX.type    = DIET_AXISMOTION;
+          motionX.flags   = DIEF_AXISABS;
+          motionX.axis    = DIAI_X;
+          motionX.axisabs = x;
+     }
+
+     if (motionY.axisabs != y) {
+          motionY.type    = DIET_AXISMOTION;
+          motionY.flags   = DIEF_AXISABS;
+          motionY.axis    = DIAI_Y;
+          motionY.axisabs = y;
+     }
+}
+
+static void
+motion_realize( SDLInputData *data )
+{
+     if (motionX.type != DIET_UNKNOWN) {
+          if (motionY.type != DIET_UNKNOWN) {
+               /* let DirectFB know two events are coming */
+               motionX.flags  |= DIEF_FOLLOW;
+          }
+
+          dfb_input_dispatch( data->device, &motionX );
+
+          motionX.type = DIET_UNKNOWN;
+     }
+
+     if (motionY.type != DIET_UNKNOWN) {
+          dfb_input_dispatch( data->device, &motionY );
+
+          motionY.type = DIET_UNKNOWN;
+     }
+}
+
+static bool
+translate_key( SDLKey key, DFBInputEvent *evt )
+{
+     evt->flags = DIEF_KEYID;
+     /* Numeric keypad */
+     if (key >= SDLK_KP0  &&  key <= SDLK_KP9) {
+          evt->key_id = DIKI_KP_0 + key - SDLK_KP0;
+          return true;
+     }
+
+     /* Function keys */
+     if (key >= SDLK_F1  &&  key <= SDLK_F12) {
+          evt->key_id = DIKI_F1 + key - SDLK_F1;
+          return true;
+     }
+
+     /* letter keys */
+     if (key >= SDLK_a  &&  key <= SDLK_z) {
+          evt->key_id = DIKI_A + key - SDLK_a;
+          return true;
+     }
+
+     if (key >= SDLK_0  &&  key <= SDLK_9) {
+          evt->key_id = DIKI_0 + key - SDLK_0;
+          return true;
+     }
+
+     switch (key) {
+          case SDLK_QUOTE:
+               evt->key_id = DIKI_QUOTE_RIGHT;
+               return true;
+          case SDLK_BACKQUOTE:
+               evt->key_id = DIKI_QUOTE_LEFT;
+               return true;
+          case SDLK_COMMA:
+               evt->key_id = DIKI_COMMA;
+               return true;
+          case SDLK_MINUS:
+               evt->key_id = DIKI_MINUS_SIGN;
+               return true;
+          case SDLK_PERIOD:
+               evt->key_id = DIKI_PERIOD;
+               return true;
+          case SDLK_SLASH:
+               evt->key_id = DIKI_SLASH;
+               return true;
+          case SDLK_SEMICOLON:
+               evt->key_id = DIKI_SEMICOLON;
+               return true;
+          case SDLK_LESS:
+               evt->key_id = DIKI_LESS_SIGN;
+               return true;
+          case SDLK_EQUALS:
+               evt->key_id = DIKI_EQUALS_SIGN;
+               return true;
+          case SDLK_LEFTBRACKET:
+               evt->key_id = DIKI_BRACKET_LEFT;
+               return true;
+          case SDLK_RIGHTBRACKET:
+               evt->key_id = DIKI_BRACKET_RIGHT;
+               return true;
+          case SDLK_BACKSLASH:
+               evt->key_id = DIKI_BACKSLASH;
+               return true;
+          /* Numeric keypad */
+          case SDLK_KP_PERIOD:
+               evt->key_id = DIKI_KP_DECIMAL;
+               return true;
+
+          case SDLK_KP_DIVIDE:
+               evt->key_id = DIKI_KP_DIV;
+               return true;
+
+          case SDLK_KP_MULTIPLY:
+               evt->key_id = DIKI_KP_MULT;
+               return true;
+
+          case SDLK_KP_MINUS:
+               evt->key_id = DIKI_KP_MINUS;
+               return true;
+          case SDLK_KP_PLUS:
+               evt->key_id = DIKI_KP_PLUS;
+               return true;
+          case SDLK_KP_ENTER:
+               evt->key_id = DIKI_KP_ENTER;
+               return true;
+
+          case SDLK_KP_EQUALS:
+               evt->key_id = DIKI_KP_EQUAL;
+               return true;
+          case SDLK_ESCAPE:
+               evt->key_id = DIKI_ESCAPE;
+               return true;
+          case SDLK_TAB:
+               evt->key_id = DIKI_TAB;
+               return true;
+          case SDLK_RETURN:
+               evt->key_id = DIKI_ENTER;
+               return true;
+          case SDLK_SPACE:
+               evt->key_id = DIKI_SPACE;
+               return true;
+          case SDLK_BACKSPACE:
+               evt->key_id = DIKI_BACKSPACE;
+               return true;
+          case SDLK_INSERT:
+               evt->key_id = DIKI_INSERT;
+               return true;
+          case SDLK_DELETE:
+               evt->key_id = DIKI_DELETE;
+               return true;
+          case SDLK_PRINT:
+               evt->key_id = DIKI_PRINT;
+               return true;
+          case SDLK_PAUSE:
+               evt->key_id = DIKI_PAUSE;
+               return true;
+          /* Arrows + Home/End pad */
+          case SDLK_UP:
+               evt->key_id = DIKI_UP;
+               return true;
+
+          case SDLK_DOWN:
+               evt->key_id = DIKI_DOWN;
+               return true;
+
+          case SDLK_RIGHT:
+               evt->key_id = DIKI_RIGHT;
+               return true;
+          case SDLK_LEFT:
+               evt->key_id = DIKI_LEFT;
+               return true;
+          case SDLK_HOME:
+               evt->key_id = DIKI_HOME;
+               return true;
+          case SDLK_END:
+               evt->key_id = DIKI_END;
+               return true;
+
+          case SDLK_PAGEUP:
+               evt->key_id = DIKI_PAGE_UP;
+               return true;
+
+          case SDLK_PAGEDOWN:
+               evt->key_id = DIKI_PAGE_DOWN;
+               return true;
+
+
+          /* Key state modifier keys */
+          case SDLK_NUMLOCK:
+               evt->key_id = DIKI_NUM_LOCK;
+               return true;
+
+          case SDLK_CAPSLOCK:
+               evt->key_id = DIKI_CAPS_LOCK;
+               return true;
+          case SDLK_SCROLLOCK:
+               evt->key_id = DIKI_SCROLL_LOCK;
+               return true;
+          case SDLK_RSHIFT:
+               evt->key_id = DIKI_SHIFT_R;
+               return true;
+
+          case SDLK_LSHIFT:
+               evt->key_id = DIKI_SHIFT_L;
+               return true;
+          case SDLK_RCTRL:
+               evt->key_id = DIKI_CONTROL_R;
+               return true;
+
+          case SDLK_LCTRL:
+               evt->key_id = DIKI_CONTROL_L;
+               return true;
+
+          case SDLK_RALT:
+               evt->key_id = DIKI_ALT_R;
+               return true;
+
+          case SDLK_LALT:
+               evt->key_id = DIKI_ALT_L;
+               return true;
+
+          case SDLK_RMETA:
+               evt->key_id = DIKI_META_R;
+               return true;
+
+          case SDLK_LMETA:
+               evt->key_id = DIKI_META_L;
+               return true;
+
+          case SDLK_LSUPER:
+               evt->key_id = DIKI_SUPER_L;
+               return true;
+
+          case SDLK_RSUPER:
+               evt->key_id = DIKI_SUPER_R;
+               return true;
+
+          case SDLK_MODE:
+               evt->key_id     = DIKI_ALT_R;
+               evt->flags     |= DIEF_KEYSYMBOL;
+               evt->key_symbol = DIKS_ALTGR;
+               return true;
+          default:
+               break;
+     }
+
+     evt->flags = DIEF_NONE;
+     return false;
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+sdlEventThread( DirectThread *thread, void *driver_data )
+{
+     SDLInputData *data    = (SDLInputData*) driver_data;
+     DFBSDL       *dfb_sdl = data->dfb_sdl;
+
+     while (!data->stop) {
+          DFBInputEvent evt;
+          SDL_Event     event;
+
+          fusion_skirmish_prevail( &dfb_sdl->lock );
+
+          /* Check for events */
+          while ( SDL_PollEvent(&event) ) {
+               fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+               switch (event.type) {
+                    case SDL_MOUSEMOTION:
+                         motion_compress( event.motion.x, event.motion.y );
+                         break;
+
+                    case SDL_MOUSEBUTTONUP:
+                    case SDL_MOUSEBUTTONDOWN:
+                         motion_realize( data );
+
+                         if (event.type == SDL_MOUSEBUTTONDOWN)
+                              evt.type = DIET_BUTTONPRESS;
+                         else
+                              evt.type = DIET_BUTTONRELEASE;
+
+                         evt.flags = DIEF_NONE;
+
+                         switch (event.button.button) {
+                              case SDL_BUTTON_LEFT:
+                                   evt.button = DIBI_LEFT;
+                                   break;
+                              case SDL_BUTTON_MIDDLE:
+                                   evt.button = DIBI_MIDDLE;
+                                   break;
+                              case SDL_BUTTON_RIGHT:
+                                   evt.button = DIBI_RIGHT;
+                                   break;
+                              case SDL_BUTTON_WHEELUP:
+                              case SDL_BUTTON_WHEELDOWN:
+                                   if (event.type != SDL_MOUSEBUTTONDOWN) {
+                                        fusion_skirmish_prevail( &dfb_sdl->lock );
+                                        continue;
+                                   }
+                                   evt.type  = DIET_AXISMOTION;
+                                   evt.flags = DIEF_AXISREL;
+                                   evt.axis  = DIAI_Z;
+                                   if (event.button.button == SDL_BUTTON_WHEELUP)
+                                        evt.axisrel = -1;
+                                   else
+                                        evt.axisrel = 1;
+                                   break;
+                              default:
+                                   fusion_skirmish_prevail( &dfb_sdl->lock );
+                                   continue;
+                         }
+
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+
+                    case SDL_KEYUP:
+                    case SDL_KEYDOWN:
+                         if (event.type == SDL_KEYDOWN)
+                              evt.type = DIET_KEYPRESS;
+                         else
+                              evt.type = DIET_KEYRELEASE;
+
+                         /* Get a key id first */
+                         translate_key( event.key.keysym.sym, &evt );
+
+                         /* If SDL provided a symbol, use it */
+                         if (event.key.keysym.unicode) {
+                              evt.flags     |= DIEF_KEYSYMBOL;
+                              evt.key_symbol = event.key.keysym.unicode;
+
+                              /**
+                               * Hack to translate the Control+[letter]
+                               * combination to
+                               * Modifier: CONTROL, Key Symbol: [letter]
+                               * A side effect here is that Control+Backspace
+                               * produces Control+h
+                               */
+                              if (evt.modifiers == DIMM_CONTROL &&
+                                  evt.key_symbol >= 1 && evt.key_symbol <= ('z'-'a'+1))
+                              {
+                                  evt.key_symbol += 'a'-1;
+                              }
+                         }
+
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+                    case SDL_QUIT:
+                         evt.type       = DIET_KEYPRESS;
+                         evt.flags      = DIEF_KEYSYMBOL;
+                         evt.key_symbol = DIKS_ESCAPE;
+
+                         dfb_input_dispatch( data->device, &evt );
+
+                         evt.type       = DIET_KEYRELEASE;
+                         evt.flags      = DIEF_KEYSYMBOL;
+                         evt.key_symbol = DIKS_ESCAPE;
+
+                         dfb_input_dispatch( data->device, &evt );
+                         break;
+
+                    default:
+                         break;
+               }
+
+               fusion_skirmish_prevail( &dfb_sdl->lock );
+          }
+
+          fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+          motion_realize( data );
+
+          usleep(10000);
+
+          direct_thread_testcancel( thread );
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     if (dfb_system_type() == CORE_SDL)
+          return 1;
+
+     return 0;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "SDL Input Driver" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Denis Oliver Kropp" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     SDLInputData *data;
+     DFBSDL       *dfb_sdl = dfb_system_data();
+
+     fusion_skirmish_prevail( &dfb_sdl->lock );
+
+     SDL_EnableUNICODE( true );
+
+     SDL_EnableKeyRepeat( 250, 40 );
+
+     fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "SDL Input" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "SDL" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_KEYBOARD;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_JOYSTICK | DIDTF_KEYBOARD | DIDTF_MOUSE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_ALL;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(SDLInputData) );
+
+     data->device  = device;
+     data->dfb_sdl = dfb_sdl;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, sdlEventThread, data, "SDL Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     SDLInputData *data = (SDLInputData*) driver_data;
+
+     /* stop input thread */
+     data->stop = 1;
+
+     direct_thread_join( data->thread );
+     direct_thread_destroy( data->thread );
+
+     /* free private data */
+     D_FREE ( data );
+}
+
diff --git a/Source/DirectFB/systems/vnc/Makefile.am b/Source/DirectFB/systems/vnc/Makefile.am
new file mode 100755
index 0000000..025bf6a
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/Makefile.am
@@ -0,0 +1,55 @@
+## Makefile.am for DirectFB/systems/vnc
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	$(VNC_CFLAGS)
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_vnc.o
+endif
+
+systems_LTLIBRARIES = libdirectfb_vnc.la
+
+inputdriversdir = $(MODULEDIR)/inputdrivers
+
+if BUILD_STATIC
+inputdrivers_DATA = libdirectfb_vncinput.o
+endif
+inputdrivers_LTLIBRARIES = libdirectfb_vncinput.la
+
+libdirectfb_vnc_la_LDFLAGS = \
+	$(VNC_LIBS)	\
+	-avoid-version	\
+	-module
+
+libdirectfb_vnc_la_SOURCES = \
+	primary.c	\
+	primary.h	\
+	vnc.c		\
+	vnc.h
+
+libdirectfb_vnc_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libdirectfb_vncinput_la_LDFLAGS = \
+	$(VNC_LIBS)	\
+	-avoid-version	\
+	-module
+
+libdirectfb_vncinput_la_SOURCES = \
+	vncinput.c
+
+libdirectfb_vncinput_la_LIBADD = \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/systems/vnc/Makefile.in b/Source/DirectFB/systems/vnc/Makefile.in
new file mode 100755
index 0000000..f509745
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/Makefile.in
@@ -0,0 +1,682 @@
+# 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 = systems/vnc
+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)$(inputdriversdir)" \
+	"$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(inputdriversdir)" \
+	"$(DESTDIR)$(systemsdir)"
+inputdriversLTLIBRARIES_INSTALL = $(INSTALL)
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(inputdrivers_LTLIBRARIES) $(systems_LTLIBRARIES)
+libdirectfb_vnc_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_vnc_la_OBJECTS = primary.lo vnc.lo
+libdirectfb_vnc_la_OBJECTS = $(am_libdirectfb_vnc_la_OBJECTS)
+libdirectfb_vnc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_vnc_la_LDFLAGS) $(LDFLAGS) -o $@
+libdirectfb_vncinput_la_DEPENDENCIES =  \
+	$(top_builddir)/src/libdirectfb.la
+am_libdirectfb_vncinput_la_OBJECTS = vncinput.lo
+libdirectfb_vncinput_la_OBJECTS =  \
+	$(am_libdirectfb_vncinput_la_OBJECTS)
+libdirectfb_vncinput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_vncinput_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_vnc_la_SOURCES) \
+	$(libdirectfb_vncinput_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_vnc_la_SOURCES) \
+	$(libdirectfb_vncinput_la_SOURCES)
+inputdriversDATA_INSTALL = $(INSTALL_DATA)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(inputdrivers_DATA) $(systems_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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	$(VNC_CFLAGS)
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_vnc.o
+systems_LTLIBRARIES = libdirectfb_vnc.la
+inputdriversdir = $(MODULEDIR)/inputdrivers
+@BUILD_STATIC_TRUE@inputdrivers_DATA = libdirectfb_vncinput.o
+inputdrivers_LTLIBRARIES = libdirectfb_vncinput.la
+libdirectfb_vnc_la_LDFLAGS = \
+	$(VNC_LIBS)	\
+	-avoid-version	\
+	-module
+
+libdirectfb_vnc_la_SOURCES = \
+	primary.c	\
+	primary.h	\
+	vnc.c		\
+	vnc.h
+
+libdirectfb_vnc_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+libdirectfb_vncinput_la_LDFLAGS = \
+	$(VNC_LIBS)	\
+	-avoid-version	\
+	-module
+
+libdirectfb_vncinput_la_SOURCES = \
+	vncinput.c
+
+libdirectfb_vncinput_la_LIBADD = \
+	$(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  systems/vnc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/vnc/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-inputdriversLTLIBRARIES: $(inputdrivers_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-inputdriversLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdriversdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdriversdir)/$$p"; \
+	done
+
+clean-inputdriversLTLIBRARIES:
+	-test -z "$(inputdrivers_LTLIBRARIES)" || rm -f $(inputdrivers_LTLIBRARIES)
+	@list='$(inputdrivers_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
+install-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_vnc.la: $(libdirectfb_vnc_la_OBJECTS) $(libdirectfb_vnc_la_DEPENDENCIES) 
+	$(libdirectfb_vnc_la_LINK) -rpath $(systemsdir) $(libdirectfb_vnc_la_OBJECTS) $(libdirectfb_vnc_la_LIBADD) $(LIBS)
+libdirectfb_vncinput.la: $(libdirectfb_vncinput_la_OBJECTS) $(libdirectfb_vncinput_la_DEPENDENCIES) 
+	$(libdirectfb_vncinput_la_LINK) -rpath $(inputdriversdir) $(libdirectfb_vncinput_la_OBJECTS) $(libdirectfb_vncinput_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncinput.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-inputdriversDATA: $(inputdrivers_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(inputdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  $(inputdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+
+uninstall-inputdriversDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(inputdrivers_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(inputdriversdir)/$$f"; \
+	done
+install-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$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)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)"; 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-inputdriversLTLIBRARIES clean-libtool \
+	clean-systemsLTLIBRARIES 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-inputdriversDATA \
+	install-inputdriversLTLIBRARIES install-systemsDATA \
+	install-systemsLTLIBRARIES
+
+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-inputdriversDATA \
+	uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-inputdriversLTLIBRARIES clean-libtool \
+	clean-systemsLTLIBRARIES ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-inputdriversDATA \
+	install-inputdriversLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	install-systemsDATA install-systemsLTLIBRARIES 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-inputdriversDATA \
+	uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+%.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/systems/vnc/primary.c b/Source/DirectFB/systems/vnc/primary.c
new file mode 100755
index 0000000..17de20e
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/primary.c
@@ -0,0 +1,993 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/gfxcard.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/state.h>
+#include <core/surface.h>
+#include <core/system.h>
+#include <core/input.h>
+
+#include <gfx/convert.h>
+#include <gfx/util.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <rfb/rfb.h>
+#include <rfb/keysym.h>
+#include "vnc.h"
+#include "primary.h"
+
+
+D_DEBUG_DOMAIN( VNC_Layer,  "VNC/Layer",  "VNC Layer" );
+
+/**********************************************************************************************************************/
+
+/******************************************************************************/
+/*VNC server setup*/
+/* Here we create a structure so that every client has it's own pointer */
+
+typedef struct ClientData {
+     DFBVNC *vnc;
+     int oldButtonMask;
+     int oldx,oldy;
+} ClientData;
+
+static void process_key_event(rfbBool down, rfbKeySym key, struct _rfbClientRec* cl);
+static void process_pointer_event(int buttonMask, int x, int y, struct _rfbClientRec* cl);
+static bool translate_key(rfbKeySym key, DFBInputEvent *evt );
+static void clientgone(rfbClientPtr cl);
+static enum rfbNewClientAction newclient(rfbClientPtr cl);
+
+extern CoreInputDevice *vncInputDevice;
+
+/******************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen           *screen,
+                   CoreGraphicsDevice   *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     int            argc   = 0;
+     char         **argv   = NULL;
+     DFBVNC        *vnc    = driver_data;
+     DFBVNCShared  *shared = vnc->shared;
+
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_NONE;
+
+     /* Set the screen name. */
+     direct_snputs( description->name, "VNC Primary Screen", DFB_SCREEN_DESC_NAME_LENGTH );
+
+     /*
+      * Allocate shared memory for RFB screen frame buffer
+      */
+     shared->screen_buffer = SHCALLOC( dfb_core_shmpool_data(vnc->core), 2 * shared->screen_size.h, 4 * shared->screen_size.w );
+     if (!shared->screen_buffer)
+          return D_OOSHM();
+
+
+     /* Set video mode */
+     vnc->rfb_screen = rfbGetScreen( &argc, argv, shared->screen_size.w, shared->screen_size.h, 8, 3, 4 );
+     if (!vnc->rfb_screen) {
+          D_ERROR( "DirectFB/VNC: rfbGetScreen( %dx%d, 8, 3, 4 ) failed!\n", shared->screen_size.w, shared->screen_size.h );
+          SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer );
+          return DFB_FAILURE;
+     }
+
+     vnc->rfb_screen->screenData = vnc;
+
+     rfbNewFramebuffer( vnc->rfb_screen, shared->screen_buffer, shared->screen_size.w, shared->screen_size.h, 8, 3, 4 );
+
+     vnc->rfb_screen->serverFormat.redShift   = 16;
+     vnc->rfb_screen->serverFormat.greenShift = 8;
+     vnc->rfb_screen->serverFormat.blueShift  = 0;
+     vnc->rfb_screen->serverFormat.redMax     = 255;
+     vnc->rfb_screen->serverFormat.greenMax   = 255;
+     vnc->rfb_screen->serverFormat.blueMax    = 255;
+
+
+     /* Connect key handler */
+
+     vnc->rfb_screen->kbdAddEvent   = process_key_event;
+     vnc->rfb_screen->ptrAddEvent   = process_pointer_event;
+     vnc->rfb_screen->newClientHook = newclient;
+     vnc->rfb_screen->autoPort      = TRUE;
+
+     /* Initialize VNC */
+
+     rfbInitServer(vnc->rfb_screen);
+
+     if (vnc->rfb_screen->listenSock == -1) {
+          D_ERROR( "DirectFB/VNC: rfbInitServer() failed to initialize listening socket!\n" );
+          SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer );
+          return DFB_FAILURE;
+     }
+
+
+     DFBResult         ret;
+     CoreSurfaceConfig config;
+
+     config.flags                  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS | CSCONF_PREALLOCATED;
+     config.size.w                 = shared->screen_size.w;
+     config.size.h                 = shared->screen_size.h;
+     config.format                 = DSPF_ARGB;
+     config.caps                   = DSCAPS_SYSTEMONLY | DSCAPS_DOUBLE;// | DSCAPS_SHARED;
+     config.preallocated[0].addr   = shared->screen_buffer;
+     config.preallocated[0].pitch  = shared->screen_size.w * 4;
+     config.preallocated[1].addr   = shared->screen_buffer + shared->screen_size.w * 4 * shared->screen_size.h;
+     config.preallocated[1].pitch  = shared->screen_size.w * 4;
+
+     ret = dfb_surface_create( vnc->core, &config, CSTF_PREALLOCATED, 0, NULL, &shared->screen_surface );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/VNC: Could not create preallocated screen surface!\n" );
+          SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer );
+          return ret;
+     }
+
+
+     rfbRunEventLoop( vnc->rfb_screen, -1, TRUE );
+
+     return DFB_OK;
+}
+/*
+static DFBResult
+primaryShutdownScreen( CoreScreen *screen,
+                       void       *driver_data,
+                       void       *screen_data )
+{
+     DFBVNC *vnc = driver_data;
+
+     rfbScreenCleanup( vnc->rfb_screen );
+
+     SHFREE( dfb_core_shmpool_data(vnc->core), vnc->shared->screen_buffer );
+
+     return DFB_OK;
+}
+*/
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     DFBVNC *vnc = driver_data;
+
+     *ret_width  = vnc->shared->screen_size.w;
+     *ret_height = vnc->shared->screen_size.h;
+
+     return DFB_OK;
+}
+
+static const ScreenFuncs _vncPrimaryScreenFuncs = {
+     .InitScreen     = primaryInitScreen,
+//     .ShutdownScreen = primaryShutdownScreen,
+     .GetScreenSize  = primaryGetScreenSize,
+};
+
+const ScreenFuncs *vncPrimaryScreenFuncs = &_vncPrimaryScreenFuncs;
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+     return sizeof(VNCLayerData);
+}
+
+static int
+primaryRegionDataSize( void )
+{
+     return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  DFBDisplayLayerDescription *description,
+                  DFBDisplayLayerConfig      *config,
+                  DFBColorAdjustment         *adjustment )
+{
+     DFBVNC       *vnc  = driver_data;
+     VNCLayerData *data = layer_data;
+     const char   *name;
+
+     D_DEBUG( "DirectFB/VNC: primaryInitLayer\n");
+
+     char *names[] = { "Primary", "Secondary", "Tertiary" };
+
+     if (vnc->layer_count < 3)
+          name = names[vnc->layer_count];
+     else
+          name = "Other";
+
+     data->layer_id = vnc->layer_count;
+
+     vnc->shared->layer_data[vnc->layer_count++] = data;
+
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VNC %s Layer", name );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+     config->buffermode  = DLBM_FRONTONLY;
+     config->width       = vnc->shared->screen_size.w;
+     config->height      = vnc->shared->screen_size.h;
+
+     if (dfb_config->mode.format != DSPF_UNKNOWN)
+          config->pixelformat = dfb_config->mode.format;
+     else if (dfb_config->mode.depth > 0)
+          config->pixelformat = dfb_pixelformat_for_depth( dfb_config->mode.depth );
+     else
+          config->pixelformat = DSPF_RGB32;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+          case DLBM_TRIPLE:
+               break;
+
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+
+     if (config->options & ~(DLOP_ALPHACHANNEL | DLOP_OPACITY))
+          fail |= CLRCF_OPTIONS;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+UpdateScreen( DFBVNC                *vnc,
+              const DFBRectangle    *update )
+{
+     DFBVNCShared *shared = vnc->shared;
+     DFBRegion     clip   = { 0, 0, shared->screen_size.w - 1, shared->screen_size.h - 1 };
+     CardState     state;
+     unsigned int  i;
+
+     D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ );
+
+     if (update) {
+          if (!dfb_region_rectangle_intersect( &clip, update )) {
+               D_DEBUG_AT( VNC_Layer, "  -> update not intersecting with screen area!\n" );
+               return DFB_OK;
+          }
+     }
+
+     dfb_state_init( &state, vnc->core );
+
+     state.destination = shared->screen_surface;
+     state.clip        = clip;
+     state.src_blend   = DSBF_ONE;
+     state.dst_blend   = DSBF_INVSRCALPHA;
+
+     // FIXME: optimize out clear
+     DFBRectangle rect = {
+          0, 0, shared->screen_size.w, shared->screen_size.h
+     };
+
+     dfb_gfxcard_fillrectangles( &rect, 1, &state );
+
+
+     for (i=0; i<VNC_MAX_LAYERS; i++) {
+          VNCLayerData *data = shared->layer_data[i];
+
+          if (data->surface) {
+               DFBRectangle src = data->config.source;
+               DFBRectangle dst = data->config.dest;
+
+               state.modified |= SMF_SOURCE | SMF_BLITTING_FLAGS;
+               state.source    = data->surface;
+
+               /* emulate missing hw layer clipping */
+               if (dst.x + dst.w > shared->screen_size.w || dst.y + dst.h > shared->screen_size.h)
+                    return DFB_ACCESSDENIED;
+
+
+               if (data->config.options & DLOP_ALPHACHANNEL) {
+                    state.blittingflags = DSBLIT_BLEND_ALPHACHANNEL;
+
+                    if (!(data->surface->config.caps & DSCAPS_PREMULTIPLIED))
+                         state.blittingflags |= DSBLIT_SRC_PREMULTIPLY;
+               }
+               else
+                    state.blittingflags = DSBLIT_NOFX;
+
+               if ((data->config.options & DLOP_OPACITY) && data->config.opacity != 0xff) {
+                    state.blittingflags |= DSBLIT_BLEND_COLORALPHA;
+
+                    if (data->surface->config.caps & DSCAPS_PREMULTIPLIED)
+                         state.blittingflags |= DSBLIT_SRC_PREMULTCOLOR;
+
+
+                    state.modified |= SMF_COLOR;
+                    state.color.a   = data->config.opacity;
+               }
+
+               dfb_gfxcard_stretchblit( &src, &dst, &state );
+          }
+     }
+
+     state.destination = NULL;
+     state.source      = NULL;
+
+     dfb_state_destroy( &state );
+
+
+     dfb_back_to_front_copy( shared->screen_surface, &clip );
+
+
+     dfb_gfxcard_sync();
+
+     DirectResult             ret;
+     DFBVNCMarkRectAsModified mark;
+
+     mark.region = clip;
+
+     ret = fusion_call_execute( &shared->call, FCEF_ONEWAY,
+                                (int)((clip.x1 << 16) | clip.x2),
+                                (void*)(long)((clip.y1 << 16) | clip.y2),
+                                NULL );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/VNC: fusion_call_execute2() failed!\n" );
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  void                       *region_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags  updated,
+                  CoreSurface                *surface,
+                  CorePalette                *palette,
+                  CoreSurfaceBufferLock      *left_lock )
+{
+     DFBVNC       *vnc  = driver_data;
+     VNCLayerData *data = layer_data;
+
+     D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ );
+
+     data->config = *config;
+
+     if (updated & CLRCF_OPACITY)
+          D_DEBUG_AT( VNC_Layer, "  -> opacity %d\n", config->opacity );
+
+     dfb_surface_link( &vnc->shared->layer_data[data->layer_id]->surface, surface );
+
+     if (data->shown)
+          return UpdateScreen( vnc, NULL );
+     else
+          D_DEBUG_AT( VNC_Layer, "  -> not shown\n" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data )
+{
+     DFBVNC       *vnc  = driver_data;
+     VNCLayerData *data = layer_data;
+
+     D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ );
+
+     D_DEBUG_AT( VNC_Layer, "  -> setting shown to false\n" );
+
+     data->shown = false;
+
+     dfb_surface_unlink( &vnc->shared->layer_data[data->layer_id]->surface );
+
+     return UpdateScreen( vnc, NULL );
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer             *layer,
+                   void                  *driver_data,
+                   void                  *layer_data,
+                   void                  *region_data,
+                   CoreSurface           *surface,
+                   DFBSurfaceFlipFlags    flags,
+                   CoreSurfaceBufferLock *left_lock )
+{
+     DFBVNC       *vnc  = driver_data;
+     VNCLayerData *data = layer_data;
+
+     D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ );
+
+     dfb_surface_flip( surface, false );
+
+     D_DEBUG_AT( VNC_Layer, "  -> setting shown to true\n" );
+
+     data->shown = true;
+
+     return UpdateScreen( vnc, &data->config.dest );
+}
+
+static DFBResult
+primaryUpdateRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data,
+                     CoreSurface           *surface,
+                     const DFBRegion       *left_update,
+                     CoreSurfaceBufferLock *left_lock )
+{
+     DFBVNC       *vnc    = driver_data;
+     VNCLayerData *data   = layer_data;
+
+     DFBRectangle  update = data->config.dest;
+
+     D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ );
+
+     if (left_update) {
+          DFBRegion screen_update = {
+               left_update->x1 + data->config.dest.x,
+               left_update->y1 + data->config.dest.y,
+               left_update->x2 + data->config.dest.x,
+               left_update->y2 + data->config.dest.y
+          };
+
+          D_DEBUG_AT( VNC_Layer, "  -> update %d,%d-%dx%d\n", DFB_RECTANGLE_VALS_FROM_REGION(&screen_update) );
+
+          if (!dfb_rectangle_intersect_by_region( &update, &screen_update )) {
+               D_DEBUG_AT( VNC_Layer, "  -> no intersection with %d,%d-%dx%d!\n", DFB_RECTANGLE_VALS( &data->config.dest ) );
+
+               return DFB_OK;
+          }
+     }
+
+     D_DEBUG_AT( VNC_Layer, "  -> setting shown to true\n" );
+
+     data->shown = true;
+
+     return UpdateScreen( vnc, &update );
+}
+
+static DFBResult
+primaryAllocateSurface( CoreLayer              *layer,
+                        void                   *driver_data,
+                        void                   *layer_data,
+                        void                   *region_data,
+                        CoreLayerRegionConfig  *config,
+                        CoreSurface           **ret_surface )
+{
+     DFBVNC            *vnc = driver_data;
+     CoreSurfaceConfig  conf;
+
+     conf.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+     conf.size.w = config->width;
+     conf.size.h = config->height;
+     conf.format = config->format;
+     conf.caps   = DSCAPS_SYSTEMONLY;
+
+     if (config->buffermode != DLBM_FRONTONLY)
+          conf.caps |= DSCAPS_DOUBLE;
+
+     return dfb_surface_create( vnc->core, &conf, CSTF_LAYER, DLID_PRIMARY, NULL, ret_surface );
+}
+
+static DFBResult
+primaryReallocateSurface( CoreLayer             *layer,
+                          void                  *driver_data,
+                          void                  *layer_data,
+                          void                  *region_data,
+                          CoreLayerRegionConfig *config,
+                          CoreSurface           *surface )
+{
+     DFBResult         ret;
+     CoreSurfaceConfig conf;
+
+     conf.flags  = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS;
+     conf.size.w = config->width;
+     conf.size.h = config->height;
+     conf.format = config->format;
+     conf.caps   = DSCAPS_SYSTEMONLY;
+
+     if (config->buffermode != DLBM_FRONTONLY)
+          conf.caps |= DSCAPS_DOUBLE;
+
+     ret = dfb_surface_reconfig( surface, &conf );
+     if (ret)
+          return ret;
+
+     if (DFB_PIXELFORMAT_IS_INDEXED(config->format) && !surface->palette) {
+          DFBResult    ret;
+          CorePalette *palette;
+
+          ret = dfb_palette_create( NULL,    /* FIXME */
+                                    1 << DFB_COLOR_BITS_PER_PIXEL( config->format ),
+                                    &palette );
+          if (ret)
+               return ret;
+
+          if (config->format == DSPF_LUT8)
+               dfb_palette_generate_rgb332_map( palette );
+
+          dfb_surface_set_palette( surface, palette );
+
+          dfb_palette_unref( palette );
+     }
+
+     return DFB_OK;
+}
+
+static const DisplayLayerFuncs _vncPrimaryLayerFuncs = {
+     .LayerDataSize     = primaryLayerDataSize,
+     .RegionDataSize    = primaryRegionDataSize,
+     .InitLayer         = primaryInitLayer,
+
+     .TestRegion        = primaryTestRegion,
+     .AddRegion         = primaryAddRegion,
+     .SetRegion         = primarySetRegion,
+     .RemoveRegion      = primaryRemoveRegion,
+     .FlipRegion        = primaryFlipRegion,
+     .UpdateRegion      = primaryUpdateRegion,
+
+     .AllocateSurface   = primaryAllocateSurface,
+     .ReallocateSurface = primaryReallocateSurface,
+};
+
+const DisplayLayerFuncs *vncPrimaryLayerFuncs = &_vncPrimaryLayerFuncs;
+
+
+/**********************************************************************************************************************/
+
+/**
+  VNC Server setup
+**/
+
+static void
+clientgone(rfbClientPtr cl)
+{
+     D_FREE( cl->clientData );
+}
+
+static enum rfbNewClientAction
+newclient(rfbClientPtr cl)
+{
+     ClientData *cd;
+     DFBVNC     *vnc = cl->screen->screenData;
+
+     cd = D_CALLOC( 1, sizeof(ClientData) );
+     if (!cd) {
+          D_OOM();
+          return RFB_CLIENT_REFUSE;
+     }
+
+     cd->vnc = vnc;
+
+     cl->clientData     = cd;
+     cl->clientGoneHook = clientgone;
+
+     return RFB_CLIENT_ACCEPT;
+}
+
+static void
+send_button_event( DFBInputDeviceButtonIdentifier button,
+                   bool                           press )
+{
+     if (vncInputDevice) {
+          DFBInputEvent evt;
+     
+          evt.flags  = DIEF_NONE;
+          evt.type   = press ? DIET_BUTTONPRESS : DIET_BUTTONRELEASE;
+          evt.button = button;
+     
+          dfb_input_dispatch( vncInputDevice, &evt );
+     }
+}
+
+static void
+process_pointer_event(int buttonMask, int x, int y, rfbClientPtr cl)
+{
+     if (vncInputDevice) {
+          ClientData    *cd = cl->clientData;
+          DFBInputEvent  evt;
+     
+          evt.type    = DIET_AXISMOTION;
+          evt.flags   = DIEF_AXISABS | DIEF_MIN | DIEF_MAX;
+     
+          if (cd->oldx != x) {
+               cd->oldx = x;
+     
+               evt.axis    = DIAI_X;
+               evt.axisabs = x;
+               evt.min     = 0;
+               evt.max     = cd->vnc->shared->screen_size.w - 1;
+     
+               dfb_input_dispatch( vncInputDevice, &evt );
+          }
+     
+          if (cd->oldy != y) {
+               cd->oldy = y;
+     
+               evt.axis    = DIAI_Y;
+               evt.axisabs = y;
+               evt.min     = 0;
+               evt.max     = cd->vnc->shared->screen_size.h - 1;
+     
+               dfb_input_dispatch( vncInputDevice, &evt );
+          }
+     
+          if (buttonMask != cd->oldButtonMask) {
+               if ((buttonMask & (1 << 0)) != (cd->oldButtonMask & (1 << 0)))
+                    send_button_event( DIBI_LEFT, !!(buttonMask & (1 << 0)) );
+     
+               if ((buttonMask & (1 << 1)) != (cd->oldButtonMask & (1 << 1)))
+                    send_button_event( DIBI_MIDDLE, !!(buttonMask & (1 << 1)) );
+     
+               if ((buttonMask & (1 << 2)) != (cd->oldButtonMask & (1 << 2)))
+                    send_button_event( DIBI_RIGHT, !!(buttonMask & (1 << 2)) );
+     
+               cd->oldButtonMask = buttonMask;
+          }
+     }
+
+     rfbDefaultPtrAddEvent(buttonMask,x,y,cl);
+}
+
+/*
+ * declaration of private data
+ */
+static void
+process_key_event(rfbBool down, rfbKeySym key, rfbClientPtr cl)
+{
+     if (vncInputDevice) {
+          DFBInputEvent evt;
+     
+          if (down)
+               evt.type = DIET_KEYPRESS;
+          else
+               evt.type = DIET_KEYRELEASE;
+     
+          if (translate_key( key, &evt ))
+               dfb_input_dispatch( vncInputDevice, &evt );
+     }
+}
+
+
+static bool
+translate_key(rfbKeySym key, DFBInputEvent *evt )
+{
+     /* Unicode */
+     if (key <= 0xf000) {
+          evt->flags = DIEF_KEYSYMBOL;
+          evt->key_symbol = key;
+          return true;
+     }
+
+     /* Dead keys */
+     /* todo */
+
+     /* Numeric keypad */
+     if (key >= XK_KP_0  &&  key <= XK_KP_9) {
+          evt->flags = DIEF_KEYID;
+          evt->key_id = DIKI_KP_0 + key - XK_KP_0;
+          return true;
+     }
+
+     /* Function keys */
+     if (key >= XK_F1  &&  key <= XK_F11) {
+          evt->flags = DIEF_KEYID;
+          evt->key_id = DIKI_F1 + key - XK_F1;
+          return true;
+     }
+
+     switch (key) {
+          /* Numeric keypad */
+          case XK_KP_Decimal:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_DECIMAL;
+               break;
+
+          case XK_KP_Separator:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_SEPARATOR;
+               break;
+
+          case XK_KP_Divide:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_DIV;
+               break;
+
+          case XK_KP_Multiply:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_MULT;
+               break;
+
+          case XK_KP_Subtract:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_MINUS;
+               break;
+
+          case XK_KP_Add:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_PLUS;
+               break;
+
+          case XK_KP_Enter:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_ENTER;
+               break;
+
+          case XK_KP_Equal:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_KP_EQUAL;
+               break;
+
+
+               /* Arrows + Home/End pad */
+          case XK_Up:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_UP;
+               break;
+
+          case XK_Down:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_DOWN;
+               break;
+
+          case XK_Right:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_RIGHT;
+               break;
+
+          case XK_Left:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_LEFT;
+               break;
+
+          case XK_Insert:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_INSERT;
+               break;
+
+          case XK_Delete:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_DELETE;
+               break;
+
+          case XK_Home:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_HOME;
+               break;
+
+          case XK_End:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_END;
+               break;
+
+          case XK_Page_Up:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_PAGE_UP;
+               break;
+
+          case XK_Page_Down:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_PAGE_DOWN;
+               break;
+
+
+               /* Key state modifier keys */
+          case XK_Num_Lock:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_NUM_LOCK;
+               break;
+
+          case XK_Caps_Lock:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_CAPS_LOCK;
+               break;
+
+          case XK_Scroll_Lock:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_SCROLL_LOCK;
+               break;
+
+          case XK_Shift_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_SHIFT_R;
+               break;
+
+          case XK_Shift_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_SHIFT_L;
+               break;
+
+          case XK_Control_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_CONTROL_R;
+               break;
+
+          case XK_Control_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_CONTROL_L;
+               break;
+
+          case XK_Alt_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_ALT_R;
+               break;
+
+          case XK_Alt_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_ALT_L;
+               break;
+
+          case XK_Meta_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_META_R;
+               break;
+
+          case XK_Meta_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_META_L;
+               break;
+
+          case XK_Super_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_SUPER_L;
+               break;
+
+          case XK_Super_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_SUPER_R;
+               break;
+
+          case XK_Hyper_L:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_HYPER_L;
+               break;
+
+          case XK_Hyper_R:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_HYPER_R;
+               break;
+
+               /*case ??:
+                    evt->flags = DIEF_KEYID;
+                    evt->key_id = DIKI_ALTGR;
+                    break;*/
+
+          case XK_BackSpace:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_BACKSPACE;
+               break;
+
+          case XK_Tab:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_HYPER_L;
+               break;
+
+          case XK_Return:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_ENTER;
+               break;
+
+          case XK_Escape:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_ESCAPE;
+               break;
+
+          case XK_Pause:
+               evt->flags = DIEF_KEYID;
+               evt->key_id = DIKI_PAUSE;
+               break;
+
+               /* Miscellaneous function keys */
+          case XK_Help:
+               evt->flags = DIEF_KEYSYMBOL;
+               evt->key_symbol = DIKS_HELP;
+               break;
+
+          case XK_Print:
+               evt->flags = DIEF_KEYSYMBOL;
+               evt->key_symbol = DIKS_PRINT;
+               break;
+
+          case XK_Break:
+               evt->flags = DIEF_KEYSYMBOL;
+               evt->key_symbol = DIKS_BREAK;
+               break;
+
+          default:
+               return false;
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/systems/vnc/primary.h b/Source/DirectFB/systems/vnc/primary.h
new file mode 100755
index 0000000..6c981b9
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/primary.h
@@ -0,0 +1,50 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SDL__PRIMARY_H__
+#define __SDL__PRIMARY_H__
+
+#include <fusion/call.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+extern const ScreenFuncs       *vncPrimaryScreenFuncs;
+extern const DisplayLayerFuncs *vncPrimaryLayerFuncs;
+
+FusionCallHandlerResult
+dfb_vnc_call_handler( int           caller,
+                      int           call_arg,
+                      void         *call_ptr,
+                      void         *ctx,
+                      unsigned int  serial,
+                      int          *ret_val );
+
+
+#endif
+
diff --git a/Source/DirectFB/systems/vnc/vnc.c b/Source/DirectFB/systems/vnc/vnc.c
new file mode 100755
index 0000000..1277ad3
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/vnc.c
@@ -0,0 +1,313 @@
+/*
+   (c) Copyright 2001-2010  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/messages.h>
+
+#include <rfb/rfb.h>
+#include "vnc.h"
+#include "primary.h"
+
+#include <core/core_system.h>
+
+
+DFB_CORE_SYSTEM( vnc )
+
+
+static DFBVNC *dfb_vnc;
+
+static FusionCallHandlerResult
+VNC_Dispatch( int           caller,
+              int           call_arg,
+              void         *call_ptr,
+              void         *ctx,
+              unsigned int  serial,
+              int          *ret_val );
+
+/**********************************************************************************************************************/
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_VNC;
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "VNC" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+     D_ASSERT( dfb_vnc == NULL );
+
+     dfb_vnc = (DFBVNC*) D_CALLOC( 1, sizeof(DFBVNC) );
+     if (!dfb_vnc)
+          return D_OOM();
+
+     dfb_vnc->core = core;
+
+     dfb_vnc->shared = (DFBVNCShared*) SHCALLOC( dfb_core_shmpool(core), 1, sizeof(DFBVNCShared) );
+     if (!dfb_vnc->shared) {
+          D_FREE( dfb_vnc );
+          return D_OOSHM();
+     }
+
+     dfb_vnc->shared->screen_size.w = dfb_config->mode.width  ? dfb_config->mode.width  : 1280;
+     dfb_vnc->shared->screen_size.h = dfb_config->mode.height ? dfb_config->mode.height :  720;
+
+     fusion_call_init( &dfb_vnc->shared->call, VNC_Dispatch, dfb_vnc, dfb_core_world(core) );
+
+     dfb_vnc->screen = dfb_screens_register( NULL, dfb_vnc, (void*) vncPrimaryScreenFuncs );
+
+     dfb_vnc->layer[0] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs );
+     dfb_vnc->layer[1] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs );
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "vnc", dfb_vnc->shared );
+
+     *data = dfb_vnc;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+     void *ret;
+
+     D_ASSERT( dfb_vnc == NULL );
+
+     fusion_arena_get_shared_field( dfb_core_arena( core ), "vnc", &ret );
+
+     dfb_vnc = (DFBVNC*) D_CALLOC( 1, sizeof(DFBVNC) );
+     if (!dfb_vnc)
+          return D_OOM();
+
+     dfb_vnc->core = core;
+
+     dfb_vnc->shared = ret;
+
+     dfb_vnc->screen = dfb_screens_register( NULL, dfb_vnc, (void*) vncPrimaryScreenFuncs );
+
+     dfb_vnc->layer[0] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs );
+     dfb_vnc->layer[1] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs );
+
+     *data = dfb_vnc;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     D_ASSERT( dfb_vnc != NULL );
+
+     fusion_call_destroy( &dfb_vnc->shared->call );
+
+     SHFREE( dfb_core_shmpool(dfb_vnc->core), dfb_vnc->shared );
+
+     D_FREE( dfb_vnc );
+     dfb_vnc = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     D_ASSERT( dfb_vnc != NULL );
+
+     D_FREE( dfb_vnc );
+     dfb_vnc = NULL;
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+system_resume( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+
+static int
+system_get_accelerator( void )
+{
+     return -1;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return NULL;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return NULL;
+}
+
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+    return NULL;
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event )
+{
+     return false;
+}
+
+
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return 0;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+     return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+     return;
+}
+
+/**********************************************************************************************************************/
+
+static int
+VNC_Dispatch_MarkRectAsModified( DFBVNC                   *vnc,
+                                 DFBVNCMarkRectAsModified *mark )
+{
+     rfbMarkRectAsModified( vnc->rfb_screen, mark->region.x1, mark->region.y1, mark->region.x2 + 1, mark->region.y2 + 1 );
+
+     return 0;
+}
+
+static FusionCallHandlerResult
+VNC_Dispatch( int           caller,
+              int           call_arg,
+              void         *call_ptr,
+              void         *ctx,
+              unsigned int  serial,
+              int          *ret_val )
+{
+     DFBVNC *vnc = ctx;
+
+     DFBVNCMarkRectAsModified modified;
+
+     modified.region.x1 = call_arg >> 16;
+     modified.region.x2 = call_arg & 0xffff;
+
+     modified.region.y1 = (long)call_ptr >> 16;
+     modified.region.y2 = (long)call_ptr & 0xffff;
+
+     *ret_val = VNC_Dispatch_MarkRectAsModified( vnc, &modified );
+
+     return FCHR_RETURN;
+}
+
diff --git a/Source/DirectFB/systems/vnc/vnc.h b/Source/DirectFB/systems/vnc/vnc.h
new file mode 100755
index 0000000..9184aab
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/vnc.h
@@ -0,0 +1,86 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __VNC__VNC_H__
+#define __VNC__VNC_H__
+
+#include <directfb.h>
+
+#include <rfb/rfb.h>
+
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+#define VNC_MAX_LAYERS 2
+
+typedef struct {
+     bool                     shown;
+     CoreLayerRegionConfig    config;
+
+     DFBDisplayLayerID        layer_id;
+
+     CoreSurface             *surface;
+} VNCLayerData;
+
+
+typedef struct {
+     FusionCall          call;
+
+     DFBDimension        screen_size;
+     void               *screen_buffer;
+     CoreSurface        *screen_surface;
+
+     VNCLayerData       *layer_data[VNC_MAX_LAYERS];
+} DFBVNCShared;
+
+typedef struct {
+     DFBVNCShared       *shared;
+
+     CoreDFB            *core;
+
+     CoreScreen         *screen;
+     CoreLayer          *layer[VNC_MAX_LAYERS];
+
+     rfbScreenInfoPtr    rfb_screen;
+
+     unsigned int        layer_count;
+} DFBVNC;
+
+typedef enum {
+     VNC_MARK_RECT_AS_MODIFIED,
+} DFBVNCCall;
+
+typedef struct {
+     DFBRegion           region;
+} DFBVNCMarkRectAsModified;
+
+#endif
+
diff --git a/Source/DirectFB/systems/vnc/vncinput.c b/Source/DirectFB/systems/vnc/vncinput.c
new file mode 100755
index 0000000..e693bba
--- /dev/null
+++ b/Source/DirectFB/systems/vnc/vncinput.c
@@ -0,0 +1,128 @@
+/*
+   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 <stdio.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <core/input_driver.h>
+
+DFB_INPUT_DRIVER( vncinput )
+
+
+CoreInputDevice *vncInputDevice = NULL;
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     if (dfb_system_type() == CORE_VNC)
+          return 1;
+
+     return 0;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,
+                DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "VNC Input Driver" );
+     snprintf ( info->vendor,
+                DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Leonard Schneider" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice      *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     vncInputDevice = device;
+
+     /* set device name */
+     snprintf( info->desc.name,
+               DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "VNC Input" );
+
+     /* set device vendor */
+     snprintf( info->desc.vendor,
+               DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "VNC" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_KEYBOARD;
+
+     /* set type flags */
+     info->desc.type   = /*DIDTF_JOYSTICK |*/ DIDTF_KEYBOARD| DIDTF_MOUSE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_ALL;
+
+     /* set private data pointer */
+     /* *driver_data = device;*/
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     return DFB_UNSUPPORTED;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+}
+
diff --git a/Source/DirectFB/systems/x11/Makefile.am b/Source/DirectFB/systems/x11/Makefile.am
new file mode 100755
index 0000000..23c0b88
--- /dev/null
+++ b/Source/DirectFB/systems/x11/Makefile.am
@@ -0,0 +1,63 @@
+# Makefile.am for DirectFB/systems/x11
+
+INCLUDES = \
+	-I$(top_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	-I$(top_srcdir)/gfxdrivers	\
+	$(X11_CFLAGS)
+
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_x11.o
+endif
+
+systems_LTLIBRARIES = libdirectfb_x11.la
+
+libdirectfb_x11_la_LDFLAGS = \
+	$(X11_LIBS)	\
+	-avoid-version	\
+	-module
+
+if GFX_GLX
+libdirectfb_x11_la_LDFLAGS += -lGL
+endif
+
+libdirectfb_x11_la_SOURCES = \
+	primary.c		\
+	primary.h		\
+	surfacemanager.c	\
+	surfacemanager.h	\
+	vpsmem_surface_pool.c	\
+	vpsmem_surface_pool.h	\
+	x11.c			\
+	x11.h			\
+	x11image.c		\
+	x11image.h		\
+	x11input.c		\
+	x11_surface_pool.c	\
+	x11_surface_pool.h	\
+	x11types.h		\
+	xwindow.h		\
+	xwindow.c
+
+if GFX_GLX
+libdirectfb_x11_la_SOURCES += \
+	glx_surface_pool.c	\
+	glx_surface_pool.h	\
+	x11_surface_pool_bridge.c	\
+	x11_surface_pool_bridge.h
+endif
+
+libdirectfb_x11_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/systems/x11/Makefile.in b/Source/DirectFB/systems/x11/Makefile.in
new file mode 100755
index 0000000..e25aa5b
--- /dev/null
+++ b/Source/DirectFB/systems/x11/Makefile.in
@@ -0,0 +1,624 @@
+# 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@
+
+# Makefile.am for DirectFB/systems/x11
+
+
+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@
+@GFX_GLX_TRUE@am__append_1 = -lGL
+@GFX_GLX_TRUE@am__append_2 = \
+@GFX_GLX_TRUE@	glx_surface_pool.c	\
+@GFX_GLX_TRUE@	glx_surface_pool.h	\
+@GFX_GLX_TRUE@	x11_surface_pool_bridge.c	\
+@GFX_GLX_TRUE@	x11_surface_pool_bridge.h
+
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/rules/libobject.make
+subdir = systems/x11
+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)$(systemsdir)" "$(DESTDIR)$(systemsdir)"
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(systems_LTLIBRARIES)
+libdirectfb_x11_la_DEPENDENCIES =  \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.la \
+	$(top_builddir)/src/libdirectfb.la
+am__libdirectfb_x11_la_SOURCES_DIST = primary.c primary.h \
+	surfacemanager.c surfacemanager.h vpsmem_surface_pool.c \
+	vpsmem_surface_pool.h x11.c x11.h x11image.c x11image.h \
+	x11input.c x11_surface_pool.c x11_surface_pool.h x11types.h \
+	xwindow.h xwindow.c glx_surface_pool.c glx_surface_pool.h \
+	x11_surface_pool_bridge.c x11_surface_pool_bridge.h
+@GFX_GLX_TRUE@am__objects_1 = glx_surface_pool.lo \
+@GFX_GLX_TRUE@	x11_surface_pool_bridge.lo
+am_libdirectfb_x11_la_OBJECTS = primary.lo surfacemanager.lo \
+	vpsmem_surface_pool.lo x11.lo x11image.lo x11input.lo \
+	x11_surface_pool.lo xwindow.lo $(am__objects_1)
+libdirectfb_x11_la_OBJECTS = $(am_libdirectfb_x11_la_OBJECTS)
+libdirectfb_x11_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libdirectfb_x11_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_x11_la_SOURCES)
+DIST_SOURCES = $(am__libdirectfb_x11_la_SOURCES_DIST)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(systems_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_srcdir)/include		\
+	-I$(top_builddir)/include	\
+	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/lib		\
+	-I$(top_srcdir)/src		\
+	-I$(top_srcdir)/gfxdrivers	\
+	$(X11_CFLAGS)
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_x11.o
+systems_LTLIBRARIES = libdirectfb_x11.la
+libdirectfb_x11_la_LDFLAGS = $(X11_LIBS) -avoid-version -module \
+	$(am__append_1)
+libdirectfb_x11_la_SOURCES = primary.c primary.h surfacemanager.c \
+	surfacemanager.h vpsmem_surface_pool.c vpsmem_surface_pool.h \
+	x11.c x11.h x11image.c x11image.h x11input.c \
+	x11_surface_pool.c x11_surface_pool.h x11types.h xwindow.h \
+	xwindow.c $(am__append_2)
+libdirectfb_x11_la_LIBADD = \
+	$(top_builddir)/lib/direct/libdirect.la \
+	$(top_builddir)/lib/fusion/libfusion.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  systems/x11/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  systems/x11/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-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-systemsLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+	done
+
+clean-systemsLTLIBRARIES:
+	-test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+	@list='$(systems_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_x11.la: $(libdirectfb_x11_la_OBJECTS) $(libdirectfb_x11_la_DEPENDENCIES) 
+	$(libdirectfb_x11_la_LINK) -rpath $(systemsdir) $(libdirectfb_x11_la_OBJECTS) $(libdirectfb_x11_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glx_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surfacemanager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpsmem_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_surface_pool_bridge.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11image.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11input.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xwindow.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-systemsDATA: $(systems_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+	done
+
+uninstall-systemsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(systems_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(systemsdir)/$$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)$(systemsdir)" "$(DESTDIR)$(systemsdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-systemsLTLIBRARIES \
+	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-systemsDATA install-systemsLTLIBRARIES
+
+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-systemsDATA uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-systemsLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip install-systemsDATA install-systemsLTLIBRARIES \
+	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-systemsDATA \
+	uninstall-systemsLTLIBRARIES
+
+%.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/systems/x11/README b/Source/DirectFB/systems/x11/README
new file mode 100755
index 0000000..7258175
--- /dev/null
+++ b/Source/DirectFB/systems/x11/README
@@ -0,0 +1,11 @@
+This is an X11 system in very early stages, it is not really usable yet.
+Tested with RGB16, ARGB1555 and ARGB mode.
+
+BUGS
+- occasional segfault during startup
+- does not work with multi-application core
+
+TODO
+- support for RGB32
+- test RGB24, RGB332, and palette mode
+- code cleanup
diff --git a/Source/DirectFB/systems/x11/glx_surface_pool.c b/Source/DirectFB/systems/x11/glx_surface_pool.c
new file mode 100755
index 0000000..98b909d
--- /dev/null
+++ b/Source/DirectFB/systems/x11/glx_surface_pool.c
@@ -0,0 +1,838 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <directfb_util.h>
+
+#include <direct/debug.h>
+#include <direct/hash.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/surface_pool.h>
+
+#include <GL/glx.h>
+#include <GL/glxext.h>
+
+#include "x11.h"
+
+#include "glx_surface_pool.h"
+#include "x11_surface_pool.h"
+
+D_DEBUG_DOMAIN( GLX_Surfaces, "GLX/Surfaces", "GLX Surface Pool" );
+D_DEBUG_DOMAIN( GLX_Pixmaps,  "GLX/Pixmaps",  "GLX Surface Pool Pixmaps" );
+
+/**********************************************************************************************************************/
+
+typedef void (*GLXBindTexImageEXTProc)   ( Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list );
+typedef void (*GLXReleaseTexImageEXTProc)( Display *dpy, GLXDrawable drawable, int buffer );
+
+typedef struct {
+     int                           magic;
+
+     Display                      *display;
+
+     GLXFBConfig                  *configs;
+     int                           num_configs;
+
+     GLXFBConfig                   config24;
+     Visual                       *visual24;
+
+     GLXFBConfig                   config32;
+     Visual                       *visual32;
+
+     GLXBindTexImageEXTProc        BindTexImageEXT;
+     GLXReleaseTexImageEXTProc     ReleaseTexImageEXT;
+
+     DirectHash                   *pixmaps;
+
+     /* Every thread needs its own context! */
+     pthread_key_t                 context_key;
+     pthread_key_t                 context_key2;
+} glxPoolLocalData;
+
+typedef struct {
+} glxPoolData;
+
+/**********************************************************************************************************************/
+
+static void
+destroy_context( void *arg )
+{
+     ThreadContext *ctx = arg;
+
+     XLockDisplay( ctx->display );
+
+     glXDestroyContext( ctx->display, ctx->context );
+
+     XUnlockDisplay( ctx->display );
+
+     D_FREE( ctx );
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+InitLocal( glxPoolLocalData *local,
+           DFBX11           *x11 )
+{
+     DFBResult ret;
+
+     int i;
+     int attribs[] = {
+          GLX_DOUBLEBUFFER,
+          False,
+
+          GLX_DRAWABLE_TYPE,
+          GLX_PIXMAP_BIT,
+
+          GLX_X_RENDERABLE,
+          True,
+
+          GLX_RED_SIZE,
+          8,
+
+          GLX_GREEN_SIZE,
+          8,
+
+          GLX_BLUE_SIZE,
+          8,
+
+          GLX_ALPHA_SIZE,
+          8,
+
+          GLX_DEPTH_SIZE,
+          8,
+
+          GLX_X_VISUAL_TYPE,
+          GLX_TRUE_COLOR,
+
+          None
+     };
+
+
+     local->display = x11->display;
+
+     local->BindTexImageEXT = (GLXBindTexImageEXTProc) glXGetProcAddress( (unsigned char*) "glXBindTexImageEXT" );
+     if (!local->BindTexImageEXT) {
+          D_ERROR( "glXGetProcAddress( 'glXBindTexImageEXT' ) failed!\n" );
+          return DFB_UNSUPPORTED;
+     }
+
+     local->ReleaseTexImageEXT = (GLXReleaseTexImageEXTProc) glXGetProcAddress( (unsigned char*) "glXReleaseTexImageEXT" );
+     if (!local->ReleaseTexImageEXT) {
+          D_ERROR( "glXGetProcAddress( 'glXReleaseTexImageEXT' ) failed!\n" );
+          return DFB_UNSUPPORTED;
+     }
+
+
+     ret = direct_hash_create( 7, &local->pixmaps );
+     if (ret)
+          return ret;
+
+
+     XLockDisplay( local->display );
+
+
+     local->configs = glXChooseFBConfig( local->display, DefaultScreen(local->display), attribs, &local->num_configs );
+
+     D_DEBUG_AT( GLX_Surfaces, "  -> found %d configs\n", local->num_configs );
+
+     for (i=0; i<local->num_configs; i++) {
+          int          depth;
+          XVisualInfo *info = glXGetVisualFromFBConfig( local->display, local->configs[i] );
+
+          glXGetFBConfigAttrib( local->display, local->configs[i], GLX_DEPTH_SIZE, &depth );
+
+          D_DEBUG_AT( GLX_Surfaces, "     [%2d] ID 0x%02lx, depth %d, RGB 0x%06lx/0x%06lx/0x%06lx {%d}, class %d, z %d\n",
+                      i, info->visualid, info->depth,
+                      info->red_mask, info->green_mask, info->blue_mask,
+                      info->bits_per_rgb, info->class, depth );
+
+          if (depth >= 8 && info->class == TrueColor) {
+               switch (info->depth) {
+                    case 32:
+                         local->config32 = local->configs[i];
+                         local->visual32 = info->visual;
+                         break;
+
+                    case 24:
+                         local->config24 = local->configs[i];
+                         local->visual24 = info->visual;
+                         break;
+               }
+          }
+     }
+
+     if (!local->config24 || !local->config32) {
+          D_ERROR( "GLX/Surfaces: Could not find useful visuals!\n" );
+          direct_hash_destroy( local->pixmaps );
+          XUnlockDisplay( local->display );
+          return DFB_UNSUPPORTED;
+     }
+
+     XVisualInfo *info24 = glXGetVisualFromFBConfig( local->display, local->config24 );
+     XVisualInfo *info32 = glXGetVisualFromFBConfig( local->display, local->config32 );
+
+     D_INFO( "GLX/Surfaces: Using visual 0x%02lx (24bit) and 0x%02lx (32bit)\n", info24->visualid, info32->visualid );
+
+     XUnlockDisplay( local->display );
+
+
+     pthread_key_create( &local->context_key,  destroy_context );
+     pthread_key_create( &local->context_key2, destroy_context );
+
+     D_MAGIC_SET( local, glxPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+GetLocalPixmap( glxPoolLocalData       *local,
+                glxAllocationData      *alloc,
+                CoreSurfaceAllocation  *allocation,
+                LocalPixmap           **ret_pixmap )
+{
+     LocalPixmap       *pixmap;
+     CoreSurface       *surface;
+     CoreSurfaceBuffer *buffer;
+
+     surface = allocation->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     pixmap = direct_hash_lookup( local->pixmaps, alloc->pixmap );
+     if (!pixmap) {
+          pixmap = D_CALLOC( 1, sizeof(LocalPixmap) );
+          if (!pixmap)
+               return D_OOM();
+
+          pixmap->pixmap = alloc->pixmap;
+          pixmap->config = (alloc->depth == 24) ? local->config24 : local->config32;
+
+          /*
+           * Create a GLXPixmap
+           */
+          int attribs[] = {
+               GLX_TEXTURE_FORMAT_EXT,  (alloc->depth == 24) ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT,
+               GLX_TEXTURE_TARGET_EXT,  GLX_TEXTURE_RECTANGLE_EXT,
+               None
+          };
+
+
+          XLockDisplay( local->display );
+
+          pixmap->drawable = glXCreatePixmap( local->display, pixmap->config, alloc->pixmap, attribs );
+          if (!pixmap->drawable) {
+               D_ERROR( "GLX/Surfaces: Could not create %dx%d (depth %d) GLXPixmap!\n",
+                        surface->config.size.w, surface->config.size.h, alloc->depth );
+               XUnlockDisplay( local->display );
+               D_FREE( pixmap );
+               return DFB_FAILURE;
+          }
+
+          D_DEBUG_AT( GLX_Surfaces, "  -> drawable 0x%lx\n", pixmap->drawable );
+
+          /*
+           * Create a GC (for writing to pixmap)
+           */
+          pixmap->gc = XCreateGC( local->display, alloc->pixmap, 0, NULL );
+
+          D_DEBUG_AT( GLX_Surfaces, "  -> gc 0x%lx\n", pixmap->drawable );
+
+          XUnlockDisplay( local->display );
+
+
+          /*
+           * Create a texture object
+           */
+          glGenTextures( 1, &pixmap->buffer.texture );
+
+
+          D_DEBUG_AT( GLX_Pixmaps, "  NEW GLXPixmap 0x%lx for 0x%lx [%4dx%4d] %-10s\n", pixmap->drawable, alloc->pixmap,
+                      surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(buffer->format) );
+          D_DEBUG_AT( GLX_Surfaces, "  -> GLXPixmap 0x%lx [%4dx%4d] %-10s (%u)\n", pixmap->drawable,
+                      surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(buffer->format),
+                      pixmap->buffer.texture );
+
+          D_MAGIC_SET( pixmap, LocalPixmap );
+          D_MAGIC_SET( &pixmap->buffer, GLBufferData );
+
+          direct_hash_insert( local->pixmaps, alloc->pixmap, pixmap );
+     }
+     else
+          D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+     *ret_pixmap = pixmap;
+
+     return DFB_OK;
+}
+
+static void
+ReleasePixmap( glxPoolLocalData *local,
+               LocalPixmap      *pixmap )
+{
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+     if (pixmap->bound) {
+          D_DEBUG_AT( GLX_Pixmaps, "  RELEASE 0x%08lx from %p\n", pixmap->drawable, pixmap->bound );
+
+          local->ReleaseTexImageEXT( local->display, pixmap->drawable, GLX_FRONT_EXT );
+
+          pixmap->bound = NULL;
+     }
+}
+
+static void
+DestroyPixmap( glxPoolLocalData *local,
+               LocalPixmap      *pixmap )
+{
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+     D_DEBUG_AT( GLX_Pixmaps, "  DESTROY 0x%08lx (%d)\n", pixmap->drawable, pixmap->buffer.texture );
+
+     glXWaitGL();
+
+     ReleasePixmap( local, pixmap );
+
+     glXWaitX();
+
+     glDeleteTextures( 1, &pixmap->buffer.texture );
+
+     XFreeGC( local->display, pixmap->gc );
+
+     glXDestroyPixmap( local->display, pixmap->drawable );
+
+     direct_hash_remove( local->pixmaps, pixmap->pixmap );
+
+     D_MAGIC_CLEAR( pixmap );
+     D_MAGIC_CLEAR( &pixmap->buffer );
+
+     D_FREE( pixmap );
+}
+
+/**********************************************************************************************************************/
+
+static int
+glxPoolDataSize( void )
+{
+     return sizeof(glxPoolData);
+}
+
+static int
+glxPoolLocalDataSize( void )
+{
+     return sizeof(glxPoolLocalData);
+}
+
+static int
+glxAllocationDataSize( void )
+{
+     return sizeof(glxAllocationData);
+}
+
+static DFBResult
+glxInitPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data,
+             CoreSurfacePoolDescription *ret_desc )
+{
+     glxPoolLocalData *local = pool_local;
+     DFBX11           *x11   = system_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( ret_desc != NULL );
+
+     ret_desc->caps              = CSPCAPS_NONE;
+     ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+
+     /* For showing our X11 window */
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ;
+
+     /* For user contexts via DirectFBGL */
+     ret_desc->access[CSAID_ACCEL1] = CSAF_READ | CSAF_WRITE;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "GLX Drawables" );
+
+
+     return InitLocal( local, x11 );
+}
+
+static DFBResult
+glxJoinPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data )
+{
+     glxPoolLocalData *local = pool_local;
+     DFBX11           *x11   = system_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+
+     return InitLocal( local, x11 );
+}
+
+static DFBResult
+glxDestroyPool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxLeavePool( CoreSurfacePool *pool,
+              void            *pool_data,
+              void            *pool_local )
+{
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxTestConfig( CoreSurfacePool         *pool,
+               void                    *pool_data,
+               void                    *pool_local,
+               CoreSurfaceBuffer       *buffer,
+               const CoreSurfaceConfig *config )
+{
+     glxPoolLocalData *local = pool_local;
+
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+
+     if (!local->configs)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxAllocateBuffer( CoreSurfacePool       *pool,
+                   void                  *pool_data,
+                   void                  *pool_local,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation,
+                   void                  *alloc_data )
+{
+     CoreSurface          *surface;
+     glxPoolLocalData     *local = pool_local;
+     glxAllocationData    *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     XLockDisplay( local->display );
+
+     alloc->depth  = DFB_COLOR_BITS_PER_PIXEL( buffer->format ) + DFB_ALPHA_BITS_PER_PIXEL( buffer->format );
+
+     /*
+      * Create a pixmap
+      */
+     alloc->pixmap = XCreatePixmap( local->display, DefaultRootWindow( local->display ),
+                                    surface->config.size.w, surface->config.size.h, alloc->depth );
+     if (!alloc->pixmap) {
+          D_ERROR( "GLX/Surfaces: Could not create %dx%d (depth %d) pixmap!\n",
+                   surface->config.size.w, surface->config.size.h, alloc->depth );
+
+          XUnlockDisplay( local->display );
+
+          return DFB_FAILURE;
+     }
+
+     D_DEBUG_AT( GLX_Surfaces, "  -> pixmap 0x%lx\n", alloc->pixmap );
+
+     D_DEBUG_AT( GLX_Pixmaps, "  NEW Pixmap 0x%lx [%4dx%4d] %-10s\n", alloc->pixmap,
+                 surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(buffer->format) );
+
+     XUnlockDisplay( local->display );
+
+
+     /* Pseudo calculation */
+     dfb_surface_calc_buffer_size( surface, 8, 2, NULL, &allocation->size );
+
+     D_MAGIC_SET( alloc, glxAllocationData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxDeallocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     LocalPixmap       *pixmap;
+     glxPoolLocalData  *local = pool_local;
+     glxAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, glxAllocationData );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     XLockDisplay( local->display );
+
+     pixmap = direct_hash_lookup( local->pixmaps, alloc->pixmap );
+     if (pixmap)
+          DestroyPixmap( local, pixmap );
+
+     XFreePixmap( local->display, alloc->pixmap );
+
+     XUnlockDisplay( local->display );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxLock( CoreSurfacePool       *pool,
+         void                  *pool_data,
+         void                  *pool_local,
+         CoreSurfaceAllocation *allocation,
+         void                  *alloc_data,
+         CoreSurfaceBufferLock *lock )
+{
+     DFBResult          ret;
+     LocalPixmap       *pixmap;
+     glxPoolLocalData  *local = pool_local;
+     glxAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, glxAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     ret = GetLocalPixmap( local, alloc, allocation, &pixmap );
+     if (ret)
+          return ret;
+
+     if (lock->accessor == CSAID_GPU || lock->accessor == CSAID_ACCEL1) {
+          ThreadContext *ctx;
+
+          ctx = pthread_getspecific( (lock->accessor == CSAID_GPU) ? local->context_key : local->context_key2 );
+          if (!ctx) {
+               ctx = D_CALLOC( 1, sizeof(ThreadContext) );
+               if (!ctx)
+                    return D_OOM();
+
+               ctx->display = local->display;
+
+               XLockDisplay( local->display );
+
+               ctx->context = glXCreateNewContext( local->display, pixmap->config, GLX_RGBA_TYPE, NULL, GL_TRUE );
+               if (!ctx->context) {
+                    D_ERROR( "GLX: Could not create GLXContext!\n" );
+                    XUnlockDisplay( local->display );
+                    D_FREE( ctx );
+                    return DFB_FAILURE;
+               }
+
+               XUnlockDisplay( local->display );
+
+               pthread_setspecific( (lock->accessor == CSAID_GPU) ? local->context_key : local->context_key2, ctx );
+
+               D_DEBUG_AT( GLX_Surfaces, "  -> NEW CONTEXT %p\n", ctx->context );
+          }
+
+          if (lock->access & CSAF_WRITE) {
+               if (ctx->context != glXGetCurrentContext() || ctx->drawable != pixmap->drawable) {
+                    D_DEBUG_AT( GLX_Surfaces, "  -> MAKE CURRENT 0x%08lx <- 0x%08lx\n", pixmap->drawable, glXGetCurrentDrawable() );
+
+                    if (ctx->drawable != pixmap->drawable) {
+                         ctx->drawable = pixmap->drawable;
+
+                         pixmap->buffer.flags |= GLBF_UPDATE_TARGET;
+                    }
+
+                    XLockDisplay( local->display );
+
+                    glXMakeContextCurrent( local->display, pixmap->drawable, pixmap->drawable, ctx->context );
+                    pixmap->current = ctx->context;
+
+                    ReleasePixmap( local, pixmap );
+
+                    XUnlockDisplay( local->display );
+               }
+          }
+          else {
+               if (pixmap->bound != ctx->context) {
+                    D_DEBUG_AT( GLX_Surfaces, "  -> BIND TEXTURE 0x%08lx (%d)\n", pixmap->drawable, pixmap->buffer.texture );
+
+                    XLockDisplay( local->display );
+
+                    ReleasePixmap( local, pixmap );
+
+                    glEnable( GL_TEXTURE_RECTANGLE_ARB );
+                    glBindTexture( GL_TEXTURE_RECTANGLE_ARB, pixmap->buffer.texture );
+
+                    local->BindTexImageEXT( local->display, pixmap->drawable, GLX_FRONT_EXT, NULL );
+                    pixmap->bound = ctx->context;
+
+                    XUnlockDisplay( local->display );
+
+                    pixmap->buffer.flags |= GLBF_UPDATE_TEXTURE;
+               }
+          }
+
+          lock->handle = &pixmap->buffer;
+     }
+     else
+          lock->handle = pixmap;
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxUnlock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+#if 0
+     DFBResult          ret;
+     LocalPixmap       *pixmap;
+     glxPoolLocalData  *local = pool_local;
+     glxAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, glxAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     ret = GetLocalPixmap( local, alloc, allocation, &pixmap );
+     if (ret)
+          return ret;
+
+     if (lock->accessor == CSAID_GPU) {
+          XLockDisplay( local->display );
+
+          if (lock->access & CSAF_WRITE) {
+//               D_DEBUG_AT( GLX_Surfaces, "  -> UNMAKE CURRENT 0x%08lx <- 0x%08lx\n", pixmap->drawable, glXGetCurrentDrawable() );
+
+//               glXMakeContextCurrent( local->display, None, None, NULL );
+//               pixmap->current = NULL;
+          }
+          else {
+               D_DEBUG_AT( GLX_Surfaces, "  -> UNBIND TEXTURE 0x%08lx (%d)\n", pixmap->drawable, pixmap->buffer.texture );
+
+               ReleasePixmap( local, pixmap );
+          }
+
+          XUnlockDisplay( local->display );
+     }
+
+#endif
+     return DFB_OK;
+}
+
+static DFBResult
+glxRead( CoreSurfacePool       *pool,
+         void                  *pool_data,
+         void                  *pool_local,
+         CoreSurfaceAllocation *allocation,
+         void                  *alloc_data,
+         void                  *destination,
+         int                    pitch,
+         const DFBRectangle    *rect )
+{
+     XImage            *image;
+     XImage            *sub;
+     glxPoolLocalData  *local = pool_local;
+     glxAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, glxAllocationData );
+     D_ASSERT( destination != NULL );
+     D_ASSERT( pitch >= 0 );
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_DEBUG_AT( GLX_Surfaces, "  => %p 0x%08lx [%4d,%4d-%4dx%4d]\n", alloc, alloc->pixmap, DFB_RECTANGLE_VALS(rect) );
+
+     XLockDisplay( local->display );
+
+     image = XCreateImage( local->display, (alloc->depth == 24) ? local->visual24 : local->visual32,
+                           alloc->depth, ZPixmap, 0, destination, rect->w, rect->h, 32, pitch );
+     if (!image) {
+          D_ERROR( "GLX/Surfaces: XCreateImage( %dx%d, depth %d ) failed!\n", rect->w, rect->h, alloc->depth );
+          XUnlockDisplay( local->display );
+          return DFB_FAILURE;
+     }
+
+     glXWaitGL();
+
+     sub = XGetSubImage( local->display, alloc->pixmap, rect->x, rect->y, rect->w, rect->h, ~0, ZPixmap, image, 0, 0 );
+
+     glXWaitX();
+
+     /* FIXME: Why the X-hell is XDestroyImage() freeing *MY* data? */
+     image->data = NULL;
+     XDestroyImage( image );
+
+     XUnlockDisplay( local->display );
+
+     if (!sub) {
+          D_ERROR( "GLX/Surfaces: XGetSubImage( %d,%d-%dx%d ) failed!\n", DFB_RECTANGLE_VALS(rect) );
+          return DFB_FAILURE;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+glxWrite( CoreSurfacePool       *pool,
+          void                  *pool_data,
+          void                  *pool_local,
+          CoreSurfaceAllocation *allocation,
+          void                  *alloc_data,
+          const void            *source,
+          int                    pitch,
+          const DFBRectangle    *rect )
+{
+     DFBResult          ret;
+     LocalPixmap       *pixmap;
+     CoreSurface       *surface;
+     XImage            *image;
+     glxPoolLocalData  *local = pool_local;
+     glxAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( GLX_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( local, glxPoolLocalData );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, glxAllocationData );
+     D_ASSERT( source != NULL );
+     D_ASSERT( pitch >= 0 );
+     DFB_RECTANGLE_ASSERT( rect );
+
+     D_DEBUG_AT( GLX_Surfaces, "  <= %p 0x%08lx [%4d,%4d-%4dx%4d]\n", alloc, alloc->pixmap, DFB_RECTANGLE_VALS(rect) );
+
+     surface = allocation->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     ret = GetLocalPixmap( local, alloc, allocation, &pixmap );
+     if (ret)
+          return ret;
+
+     XLockDisplay( local->display );
+
+     image = XCreateImage( local->display, (alloc->depth == 24) ? local->visual24 : local->visual32,
+                           alloc->depth, ZPixmap, 0, (void*) source, rect->w, rect->h, 32, pitch );
+     if (!image) {
+          D_ERROR( "GLX/Surfaces: XCreateImage( %dx%d, depth %d ) failed!\n", rect->w, rect->h, alloc->depth );
+          XUnlockDisplay( local->display );
+          return DFB_FAILURE;
+     }
+
+     glXWaitGL();
+
+     XPutImage( local->display, alloc->pixmap, pixmap->gc, image, 0, 0, rect->x, rect->y, rect->w, rect->h );
+
+     glXWaitX();
+
+     /* FIXME: Why the X-hell is XDestroyImage() freeing *MY* data? */
+     image->data = NULL;
+     XDestroyImage( image );
+
+     XUnlockDisplay( local->display );
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs glxSurfacePoolFuncs = {
+     .PoolDataSize       = glxPoolDataSize,
+     .PoolLocalDataSize  = glxPoolLocalDataSize,
+     .AllocationDataSize = glxAllocationDataSize,
+
+     .InitPool           = glxInitPool,
+     .JoinPool           = glxJoinPool,
+     .DestroyPool        = glxDestroyPool,
+     .LeavePool          = glxLeavePool,
+
+     .TestConfig         = glxTestConfig,
+
+     .AllocateBuffer     = glxAllocateBuffer,
+     .DeallocateBuffer   = glxDeallocateBuffer,
+
+     .Lock               = glxLock,
+     .Unlock             = glxUnlock,
+
+     .Read               = glxRead,
+     .Write              = glxWrite,
+};
+
diff --git a/Source/DirectFB/systems/x11/glx_surface_pool.h b/Source/DirectFB/systems/x11/glx_surface_pool.h
new file mode 100755
index 0000000..d244526
--- /dev/null
+++ b/Source/DirectFB/systems/x11/glx_surface_pool.h
@@ -0,0 +1,79 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__GLX_SURFACE_POOL_H__
+#define __X11SYSTEM__GLX_SURFACE_POOL_H__
+
+
+#include <GL/glx.h>
+
+#include <gl/gl_gfxdriver.h>
+
+#include <core/surface_pool.h>
+
+extern const SurfacePoolFuncs glxSurfacePoolFuncs;
+
+
+typedef struct {
+     int            magic;
+
+     /* Shared resource */
+     Pixmap         pixmap;
+     int            depth;
+} glxAllocationData;
+
+typedef struct {
+     int            magic;
+
+     GLBufferData   buffer;
+
+     /* Shared resource */
+     Pixmap         pixmap;
+
+     /* Process local data */
+     GC             gc;
+
+     GLXFBConfig    config;
+     GLXDrawable    drawable;
+
+     /* Bound to a thread's context? */
+     GLXContext     current;
+     GLXContext     bound;
+} LocalPixmap;
+
+typedef struct {
+     Display       *display;
+
+     /* Thread local data */
+     GLXContext     context;
+
+     GLXDrawable    drawable;
+} ThreadContext;
+
+#endif
+
diff --git a/Source/DirectFB/systems/x11/primary.c b/Source/DirectFB/systems/x11/primary.c
new file mode 100755
index 0000000..2e12d8a
--- /dev/null
+++ b/Source/DirectFB/systems/x11/primary.c
@@ -0,0 +1,664 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <fusion/types.h>
+
+#include <stdio.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef USE_GLX
+#include <GL/glx.h>
+#include "glx_surface_pool.h"
+#endif
+
+#include "xwindow.h"
+#include "x11.h"
+#include "primary.h"
+
+
+D_DEBUG_DOMAIN( X11_Layer,  "X11/Layer",  "X11 Layer" );
+D_DEBUG_DOMAIN( X11_Update, "X11/Update", "X11 Update" );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+dfb_x11_create_window( DFBX11 *x11, const CoreLayerRegionConfig *config )
+{
+     int           ret;
+     DFBX11Shared *shared = x11->shared;
+
+     D_ASSERT( config != NULL );
+
+     shared->setmode.config = *config;
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, X11_CREATE_WINDOW, &shared->setmode, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+static DFBResult
+dfb_x11_destroy_window( DFBX11 *x11 )
+{
+     int           ret;
+     DFBX11Shared *shared = x11->shared;
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, X11_DESTROY_WINDOW, NULL, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+static DFBResult
+dfb_x11_update_screen( DFBX11 *x11, const DFBRegion *region, CoreSurfaceBufferLock *lock )
+{
+     int           ret;
+     DFBX11Shared *shared = x11->shared;
+
+     DFB_REGION_ASSERT( region );
+     D_ASSERT( lock != NULL );
+
+     /* FIXME: Just a hot fix! */
+     while (shared->update.lock)
+          usleep( 10000 );
+
+     shared->update.region = *region;
+     shared->update.lock   = lock;
+
+     if (fusion_call_execute( &shared->call, FCEF_NODIRECT, X11_UPDATE_SCREEN, &shared->update, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+static DFBResult
+dfb_x11_set_palette( DFBX11 *x11, CorePalette *palette )
+{
+     int           ret;
+     DFBX11Shared *shared = x11->shared;
+
+     D_ASSERT( palette != NULL );
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, X11_SET_PALETTE, palette, &ret ))
+          return DFB_FUSION;
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen           *screen,
+                   CoreGraphicsDevice   *device,
+                   void                 *driver_data,
+                   void                 *screen_data,
+                   DFBScreenDescription *description )
+{
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     /* Set the screen capabilities. */
+     description->caps = DSCCAPS_NONE;
+
+     /* Set the screen name. */
+     snprintf( description->name,
+               DFB_SCREEN_DESC_NAME_LENGTH, "X11 Primary Screen" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+                      void       *driver_data,
+                      void       *screen_data,
+                      int        *ret_width,
+                      int        *ret_height )
+{
+     DFBX11       *x11    = driver_data;
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     *ret_width  = shared->screen_size.w;
+     *ret_height = shared->screen_size.h;
+
+     return DFB_OK;
+}
+
+ScreenFuncs x11PrimaryScreenFuncs = {
+     .InitScreen    = primaryInitScreen,
+     .GetScreenSize = primaryGetScreenSize,
+};
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+     return 0;
+}
+
+static int
+primaryRegionDataSize( void )
+{
+     return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  DFBDisplayLayerDescription *description,
+                  DFBDisplayLayerConfig      *config,
+                  DFBColorAdjustment         *adjustment )
+{
+     DFBX11       *x11    = driver_data;
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     /* set capabilities and type */
+     description->caps = DLCAPS_SURFACE;
+     description->type = DLTF_GRAPHICS;
+
+     /* set name */
+     snprintf( description->name,
+               DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "X11 Primary Layer" );
+
+     /* fill out the default configuration */
+     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
+                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+     config->buffermode  = DLBM_FRONTONLY;
+
+     if (dfb_config->mode.width)
+          config->width  = dfb_config->mode.width;
+     else
+          config->width  = shared->screen_size.w;
+
+     if (dfb_config->mode.height)
+          config->height = dfb_config->mode.height;
+     else
+          config->height = shared->screen_size.h;
+
+     if (dfb_config->mode.format != DSPF_UNKNOWN)
+          config->pixelformat = dfb_config->mode.format;
+     else if (dfb_config->mode.depth > 0)
+          config->pixelformat = dfb_pixelformat_for_depth( dfb_config->mode.depth );
+     else {
+          int depth = DefaultDepthOfScreen( x11->screenptr );
+
+          switch (depth) {
+               case 15:
+                    config->pixelformat = DSPF_RGB555;
+                    break;
+               case 16:
+                    config->pixelformat = DSPF_RGB16;
+                    break;
+               case 24:
+                    config->pixelformat = DSPF_RGB32;
+                    break;
+               case 32:
+                    config->pixelformat = DSPF_ARGB;
+                    break;
+               default:
+                    printf(" Unsupported X11 screen depth %d \n",depth);
+                    return DFB_UNSUPPORTED;
+          }
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer                  *layer,
+                   void                       *driver_data,
+                   void                       *layer_data,
+                   CoreLayerRegionConfig      *config,
+                   CoreLayerRegionConfigFlags *failed )
+{
+     CoreLayerRegionConfigFlags fail = 0;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     switch (config->buffermode) {
+          case DLBM_FRONTONLY:
+          case DLBM_BACKSYSTEM:
+          case DLBM_BACKVIDEO:
+          case DLBM_TRIPLE:
+               break;
+
+          default:
+               fail |= CLRCF_BUFFERMODE;
+               break;
+     }
+
+     switch (config->format) {
+          case DSPF_RGB16:
+          case DSPF_NV16:
+          case DSPF_RGB444:
+          case DSPF_ARGB4444:
+          case DSPF_RGBA4444:
+          case DSPF_RGB555:
+          case DSPF_ARGB1555:
+          case DSPF_BGR555:
+          case DSPF_RGB24:
+          case DSPF_RGB32:
+          case DSPF_ARGB:
+          case DSPF_AYUV:
+               break;
+
+          default:
+               fail |= CLRCF_FORMAT;
+               break;
+     }
+
+     if (config->options)
+          fail |= CLRCF_OPTIONS;
+
+     if (failed)
+          *failed = fail;
+
+     if (fail)
+          return DFB_UNSUPPORTED;
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer             *layer,
+                  void                  *driver_data,
+                  void                  *layer_data,
+                  void                  *region_data,
+                  CoreLayerRegionConfig *config )
+{
+     return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer                  *layer,
+                  void                       *driver_data,
+                  void                       *layer_data,
+                  void                       *region_data,
+                  CoreLayerRegionConfig      *config,
+                  CoreLayerRegionConfigFlags  updated,
+                  CoreSurface                *surface,
+                  CorePalette                *palette,
+                  CoreSurfaceBufferLock      *lock )
+{
+     DFBResult  ret;
+     DFBX11    *x11 = driver_data;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     ret = dfb_x11_create_window( x11, config );
+     if (ret)
+          return ret;
+
+     if (palette)
+          dfb_x11_set_palette( x11, palette );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data )
+{
+     DFBX11 *x11 = driver_data;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     dfb_x11_destroy_window( x11 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer             *layer,
+                   void                  *driver_data,
+                   void                  *layer_data,
+                   void                  *region_data,
+                   CoreSurface           *surface,
+                   DFBSurfaceFlipFlags    flags,
+                   CoreSurfaceBufferLock *lock )
+{
+     DFBX11    *x11    = driver_data;
+     DFBRegion  region = DFB_REGION_INIT_FROM_DIMENSION( &surface->config.size );
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     dfb_surface_flip( surface, false );
+
+     return dfb_x11_update_screen( x11, ®ion, lock );
+}
+
+static DFBResult
+primaryUpdateRegion( CoreLayer             *layer,
+                     void                  *driver_data,
+                     void                  *layer_data,
+                     void                  *region_data,
+                     CoreSurface           *surface,
+                     const DFBRegion       *update,
+                     CoreSurfaceBufferLock *lock )
+{
+     DFBX11    *x11    = driver_data;
+     DFBRegion  region = DFB_REGION_INIT_FROM_DIMENSION( &surface->config.size );
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     if (update && !dfb_region_region_intersect( ®ion, update ))
+          return DFB_OK;
+
+     return dfb_x11_update_screen( x11, ®ion, lock );
+}
+
+DisplayLayerFuncs x11PrimaryLayerFuncs = {
+     .LayerDataSize  = primaryLayerDataSize,
+     .RegionDataSize = primaryRegionDataSize,
+     .InitLayer      = primaryInitLayer,
+
+     .TestRegion     = primaryTestRegion,
+     .AddRegion      = primaryAddRegion,
+     .SetRegion      = primarySetRegion,
+     .RemoveRegion   = primaryRemoveRegion,
+     .FlipRegion     = primaryFlipRegion,
+     .UpdateRegion   = primaryUpdateRegion,
+};
+
+/******************************************************************************/
+
+static DFBResult
+update_screen( DFBX11 *x11, const DFBRectangle *clip, CoreSurfaceBufferLock *lock )
+{
+     void                  *dst;
+     void                  *src;
+     unsigned int           offset = 0;
+     XWindow               *xw;
+     XImage                *ximage;
+     CoreSurface           *surface;
+     CoreSurfaceAllocation *allocation;
+     DFBX11Shared          *shared;
+     DFBRectangle           rect;
+     bool                   direct = false;
+
+     D_ASSERT( x11 != NULL );
+     DFB_RECTANGLE_ASSERT( clip );
+
+     D_DEBUG_AT( X11_Update, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS( clip ) );
+
+     CORE_SURFACE_BUFFER_LOCK_ASSERT( lock );
+
+     shared = x11->shared;
+     D_ASSERT( shared != NULL );
+
+     XLockDisplay( x11->display );
+
+     xw = shared->xw;
+     if (!xw) {
+          XUnlockDisplay( x11->display );
+          return DFB_OK;
+     }
+
+     allocation = lock->allocation;
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     surface = allocation->surface;
+     D_ASSERT( surface != NULL );
+
+
+     rect.x = rect.y = 0;
+     rect.w = xw->width;
+     rect.h = xw->height;
+
+     if (!dfb_rectangle_intersect( &rect, clip )) {
+          XUnlockDisplay( x11->display );
+          return DFB_OK;
+     }
+
+     D_DEBUG_AT( X11_Update, "  -> %4d,%4d-%4dx%4d\n", DFB_RECTANGLE_VALS( &rect ) );
+
+#ifdef USE_GLX
+     /* Check for GLX allocation... */
+     if (allocation->pool == shared->glx_pool && lock->handle) {
+          LocalPixmap *pixmap = lock->handle;
+
+          D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+          /* ...and just call SwapBuffers... */
+          //D_DEBUG_AT( X11_Update, "  -> Calling glXSwapBuffers( 0x%lx )...\n", alloc->drawable );
+          //glXSwapBuffers( x11->display, alloc->drawable );
+
+
+          D_DEBUG_AT( X11_Update, "  -> Copying from GLXPixmap...\n" );
+
+          glXWaitGL();
+
+          XCopyArea( x11->display, pixmap->pixmap, xw->window, xw->gc,
+                     rect.x, rect.y, rect.w, rect.h, rect.x, rect.y );
+
+          glXWaitX();
+
+          XUnlockDisplay( x11->display );
+
+          return DFB_OK;
+     }
+#endif
+
+     /* Check for our special native allocation... */
+     if (allocation->pool == shared->x11image_pool && lock->handle) {
+          x11Image *image = lock->handle;
+
+          D_MAGIC_ASSERT( image, x11Image );
+
+          /* ...and directly XShmPutImage from that. */
+          ximage = image->ximage;
+
+          direct = true;
+     }
+     else {
+          /* ...or copy or convert into XShmImage or XImage allocated with the XWindow. */
+          ximage = xw->ximage;
+          offset = xw->ximage_offset;
+
+          xw->ximage_offset = (offset ? 0 : ximage->height / 2);
+          
+          dst = xw->virtualscreen + rect.x * xw->bpp + (rect.y + offset) * ximage->bytes_per_line;
+          src = lock->addr + DFB_BYTES_PER_LINE( surface->config.format, rect.x ) + rect.y * lock->pitch;
+
+          switch (xw->depth) {
+               case 32:
+                    dfb_convert_to_argb( surface->config.format, src, lock->pitch,
+                                         surface->config.size.h, dst, ximage->bytes_per_line, rect.w, rect.h );
+                    break;
+
+               case 24:
+                    dfb_convert_to_rgb32( surface->config.format, src, lock->pitch,
+                                          surface->config.size.h, dst, ximage->bytes_per_line, rect.w, rect.h );
+                    break;
+
+               case 16:
+                    dfb_convert_to_rgb16( surface->config.format, src, lock->pitch,
+                                          surface->config.size.h, dst, ximage->bytes_per_line, rect.w, rect.h );
+                    break;
+
+               case 15:
+                    dfb_convert_to_rgb555( surface->config.format, src, lock->pitch,
+                                           surface->config.size.h, dst, ximage->bytes_per_line, rect.w, rect.h );
+                    break;
+
+               default:
+                    D_ONCE( "unsupported depth %d", xw->depth );
+          }
+     }
+
+     D_ASSERT( ximage != NULL );
+
+
+     /* Wait for previous data to be processed... */
+     XSync( x11->display, False );
+
+     /* ...and immediately queue or send the next! */
+     if (x11->use_shm) {
+          /* Just queue the command, it's XShm :) */
+          XShmPutImage( xw->display, xw->window, xw->gc, ximage,
+                        rect.x, rect.y + offset, rect.x, rect.y, rect.w, rect.h, False );
+
+          /* Make sure the queue has really happened! */
+          XFlush( x11->display );
+     }
+     else
+          /* Initiate transfer of buffer... */
+          XPutImage( xw->display, xw->window, xw->gc, ximage,
+                     rect.x, rect.y + offset, rect.x, rect.y, rect.w, rect.h );
+
+     /* Wait for display if single buffered and not converted... */
+     if (direct && !(surface->config.caps & DSCAPS_FLIPPING))
+          XSync( x11->display, False );
+
+     XUnlockDisplay( x11->display );
+
+     return DFB_OK;
+}
+
+/******************************************************************************/
+
+DFBResult
+dfb_x11_create_window_handler( DFBX11 *x11, CoreLayerRegionConfig *config )
+{
+     XWindow      *xw;
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Layer, "%s( %p )\n", __FUNCTION__, config );
+
+     D_DEBUG_AT( X11_Layer, "  -> %4dx%4d %s\n", config->width, config->height, dfb_pixelformat_name(config->format) );
+
+     XLockDisplay( x11->display );
+
+     xw = shared->xw;
+     if (xw != NULL) {
+          if (xw->width == config->width && xw->height == config->height) {
+               XUnlockDisplay( x11->display );
+               return DFB_OK;
+          }
+
+          shared->xw = NULL;
+          dfb_x11_close_window( x11, xw );
+     }
+
+     bool bSucces = dfb_x11_open_window( x11, &xw, 0, 0, config->width, config->height, config->format );
+
+     /* Set video mode */
+     if ( !bSucces ) {
+          D_ERROR( "DirectFB/X11: Couldn't open %dx%d window!\n", config->width, config->height );
+
+          XUnlockDisplay( x11->display );
+          return DFB_FAILURE;
+     }
+     else
+          shared->xw = xw;
+
+     XUnlockDisplay( x11->display );
+     return DFB_OK;
+}
+
+DFBResult
+dfb_x11_destroy_window_handler( DFBX11 *x11 )
+{
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );
+
+     XLockDisplay( x11->display );
+
+     if (shared->xw) {
+          XWindow *xw = shared->xw;
+
+          shared->xw = NULL;
+
+          dfb_x11_close_window( x11, xw );
+     }
+
+     XSync( x11->display, False );
+
+     XUnlockDisplay( x11->display );
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_x11_update_screen_handler( DFBX11 *x11, UpdateScreenData *data )
+{
+     DFBRectangle rect;
+
+     D_DEBUG_AT( X11_Update, "%s( %p )\n", __FUNCTION__, data );
+
+     rect = DFB_RECTANGLE_INIT_FROM_REGION( &data->region );
+
+     if (data->lock)
+          update_screen( x11, &rect, data->lock );
+
+     data->lock = NULL;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_x11_set_palette_handler( DFBX11 *x11, CorePalette *palette )
+{
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/systems/x11/primary.h b/Source/DirectFB/systems/x11/primary.h
new file mode 100755
index 0000000..a145d83
--- /dev/null
+++ b/Source/DirectFB/systems/x11/primary.h
@@ -0,0 +1,39 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11__PRIMARY_H__
+#define __X11__PRIMARY_H__
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+extern ScreenFuncs       x11PrimaryScreenFuncs;
+extern DisplayLayerFuncs x11PrimaryLayerFuncs;
+
+#endif // __X11__PRIMARY_H__
+
diff --git a/Source/DirectFB/systems/x11/surfacemanager.c b/Source/DirectFB/systems/x11/surfacemanager.c
new file mode 100755
index 0000000..e9f697a
--- /dev/null
+++ b/Source/DirectFB/systems/x11/surfacemanager.c
@@ -0,0 +1,559 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/shmalloc.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+#include <core/core.h>
+
+#include <core/gfxcard.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+
+#include <direct/debug.h>
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#include "surfacemanager.h"
+
+D_DEBUG_DOMAIN( SurfMan, "SurfaceManager", "DirectFB Surface Manager" );
+
+
+static Chunk *split_chunk ( SurfaceManager *manager,
+                            Chunk          *chunk,
+                            int             length );
+
+static Chunk *free_chunk  ( SurfaceManager *manager,
+                            Chunk          *chunk );
+
+static Chunk *occupy_chunk( SurfaceManager        *manager,
+                            Chunk                 *chunk,
+                            CoreSurfaceAllocation *allocation,
+                            int                    length,
+                            int                    pitch );
+
+
+DFBResult
+dfb_surfacemanager_create( CoreDFB         *core,
+                           unsigned int     length,
+                           SurfaceManager **ret_manager )
+{
+     FusionSHMPoolShared *pool;
+     SurfaceManager      *manager;
+     Chunk               *chunk;
+
+     D_DEBUG_AT( SurfMan, "%s( %p, %d )\n", __FUNCTION__, core, length );
+
+     D_ASSERT( core != NULL );
+     D_ASSERT( ret_manager != NULL );
+
+     pool = dfb_core_shmpool( core );
+
+     manager = SHCALLOC( pool, 1, sizeof(SurfaceManager) );
+     if (!manager)
+          return D_OOSHM();
+
+     chunk = SHCALLOC( pool, 1, sizeof(Chunk) );
+     if (!chunk) {
+          D_OOSHM();
+          SHFREE( pool, manager );
+          return DFB_NOSHAREDMEMORY;
+     }
+
+     manager->shmpool = pool;
+     manager->chunks  = chunk;
+     manager->offset  = 0;
+     manager->length  = length;
+     manager->avail   = manager->length - manager->offset;
+
+     D_MAGIC_SET( manager, SurfaceManager );
+
+     chunk->offset    = manager->offset;
+     chunk->length    = manager->avail;
+
+     D_MAGIC_SET( chunk, Chunk );
+
+     D_DEBUG_AT( SurfMan, "  -> %p\n", manager );
+
+     *ret_manager = manager;
+
+     return DFB_OK;
+}
+
+void
+dfb_surfacemanager_destroy( SurfaceManager *manager )
+{
+     Chunk *chunk;
+     void  *next;
+
+     D_DEBUG_AT( SurfMan, "%s( %p )\n", __FUNCTION__, manager );
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+
+     /* Deallocate all video chunks. */
+     chunk = manager->chunks;
+     while (chunk) {
+          next = chunk->next;
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+
+          chunk = next;
+     }
+
+     D_MAGIC_CLEAR( manager );
+
+     /* Deallocate manager struct. */
+     SHFREE( manager->shmpool, manager );
+}
+
+/** public functions NOT locking the surfacemanger theirself,
+    to be called between lock/unlock of surfacemanager **/
+
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk )
+{
+     int pitch;
+     int length;
+     Chunk *c;
+     CoreGraphicsDevice *device;
+
+     Chunk *best_free = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     if (ret_chunk)
+          D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     else
+          D_ASSUME( allocation == NULL );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     if (manager->suspended)
+          return DFB_SUSPENDED;
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( device, buffer, &pitch, &length );
+
+     D_DEBUG_AT( SurfMan, "  -> pitch %d, length %d\n", pitch, length );
+
+     if (manager->avail < length)
+          return DFB_TEMPUNAVAIL;
+
+     /* examine chunks */
+     c = manager->chunks;
+     D_MAGIC_ASSERT( c, Chunk );
+
+     while (c) {
+          D_MAGIC_ASSERT( c, Chunk );
+
+          if (!c->buffer && c->length >= length) {
+               /* NULL means check only. */
+               if (!ret_chunk)
+                    return DFB_OK;
+
+               /* found a nice place to chill */
+               if (!best_free  ||  best_free->length > c->length)
+                    /* first found or better one? */
+                    best_free = c;
+
+               if (c->length == length)
+                    break;
+          }
+
+          c = c->next;
+     }
+
+     /* if we found a place */
+     if (best_free) {
+          D_DEBUG_AT( SurfMan, "  -> found free (%d)\n", best_free->length );
+
+          /* NULL means check only. */
+          if (ret_chunk)
+               *ret_chunk = occupy_chunk( manager, best_free, allocation, length, pitch );
+
+          return DFB_OK;
+     }
+
+     D_DEBUG_AT( SurfMan, "  -> failed (%d/%d avail)\n", manager->avail, manager->length );
+
+     /* no luck */
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer )
+{
+     int                    length;
+     Chunk                 *multi_start = NULL;
+     int                    multi_size  = 0;
+     int                    multi_tsize = 0;
+     int                    multi_count = 0;
+     Chunk                 *bestm_start = NULL;
+     int                    bestm_count = 0;
+     int                    bestm_size  = 0;
+     int                    min_toleration;
+     Chunk                 *chunk;
+     CoreGraphicsDevice    *device;
+     CoreSurfaceAllocation *smallest = NULL;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     /* FIXME: Only one global device at the moment. */
+     device = dfb_core_get_part( core, DFCP_GRAPHICS );
+     D_ASSERT( device != NULL );
+
+     dfb_gfxcard_calc_buffer_size( dfb_core_get_part( core, DFCP_GRAPHICS ), buffer, NULL, &length );
+
+     min_toleration = manager->min_toleration/8 + 2;
+
+     D_DEBUG_AT( SurfMan, "  -> %7d required, min toleration %d\n", length, min_toleration );
+
+     chunk = manager->chunks;
+     while (chunk) {
+          CoreSurfaceAllocation *allocation;
+
+          D_MAGIC_ASSERT( chunk, Chunk );
+
+          allocation = chunk->allocation;
+          if (allocation) {
+               CoreSurfaceBuffer *other;
+               int                size;
+
+               D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+               D_ASSERT( chunk->buffer == allocation->buffer );
+               D_ASSERT( chunk->length >= allocation->size );
+
+               other = allocation->buffer;
+               D_MAGIC_ASSERT( other, CoreSurfaceBuffer );
+
+               if (other->locked) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d locked %dx\n", allocation->size, other->locked );
+                    goto next_reset;
+               }
+
+               if (other->policy > buffer->policy) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy %d > %d\n", allocation->size, other->policy, buffer->policy );
+                    goto next_reset;
+               }
+
+               if (other->policy == CSP_VIDEOONLY) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d policy videoonly\n", allocation->size );
+                    goto next_reset;
+               }
+
+               chunk->tolerations++;
+               if (chunk->tolerations > 0xff)
+                    chunk->tolerations = 0xff;
+
+               if (other->policy == buffer->policy && chunk->tolerations < min_toleration) {
+                    D_DEBUG_AT( SurfMan, "  ++ %7d tolerations %d/%d\n",
+                                allocation->size, chunk->tolerations, min_toleration );
+                    goto next_reset;
+               }
+
+               size = allocation->size;
+
+               if (chunk->prev && !chunk->prev->allocation)
+                    size += chunk->prev->length;
+
+               if (chunk->next && !chunk->next->allocation)
+                    size += chunk->next->length;
+
+               if (size >= length) {
+                    if (!smallest || smallest->size > allocation->size) {
+                         D_DEBUG_AT( SurfMan, "  => %7d [%d] < %d, tolerations %d\n",
+                                     allocation->size, size, smallest ? smallest->size : 0, chunk->tolerations );
+
+                         smallest = allocation;
+                    }
+                    else
+                         D_DEBUG_AT( SurfMan, "  -> %7d [%d] > %d\n", allocation->size, size, smallest->size );
+               }
+               else
+                    D_DEBUG_AT( SurfMan, "  -> %7d [%d]\n", allocation->size, size );
+          }
+          else
+               D_DEBUG_AT( SurfMan, "  -  %7d free\n", chunk->length );
+
+
+          if (!smallest) {
+               if (!multi_start) {
+                    multi_start = chunk;
+                    multi_tsize = chunk->length;
+                    multi_size  = chunk->allocation ? chunk->length : 0;
+                    multi_count = chunk->allocation ? 1 : 0;
+               }
+               else {
+                    multi_tsize += chunk->length;
+                    multi_size  += chunk->allocation ? chunk->length : 0;
+                    multi_count += chunk->allocation ? 1 : 0;
+
+                    while (multi_tsize >= length && multi_count > 1) {
+                         if (!bestm_start || bestm_size > multi_size * multi_count / bestm_count) {
+                              D_DEBUG_AT( SurfMan, "                =====> %7d, %7d %2d used [%7d %2d]\n",
+                                          multi_tsize, multi_size, multi_count, bestm_size, bestm_count );
+
+                              bestm_size  = multi_size;
+                              bestm_start = multi_start;
+                              bestm_count = multi_count;
+                         }
+                         else
+                              D_DEBUG_AT( SurfMan, "                -----> %7d, %7d %2d used\n",
+                                          multi_tsize, multi_size, multi_count );
+
+                         if (multi_count <= 2)
+                              break;
+
+                         if (!multi_start->allocation) {
+                              multi_tsize -= multi_start->length;
+                              multi_start  = multi_start->next;
+                         }
+
+                         D_ASSUME( multi_start->allocation != NULL );
+
+                         multi_tsize -= multi_start->length;
+                         multi_size  -= multi_start->allocation ? multi_start->length : 0;
+                         multi_count -= multi_start->allocation ? 1 : 0;
+                         multi_start  = multi_start->next;
+                    }
+               }
+          }
+
+          chunk = chunk->next;
+
+          continue;
+
+
+next_reset:
+          multi_start = NULL;
+
+          chunk = chunk->next;
+     }
+
+     if (smallest) {
+          D_MAGIC_ASSERT( smallest, CoreSurfaceAllocation );
+          D_MAGIC_ASSERT( smallest->buffer, CoreSurfaceBuffer );
+
+          smallest->flags |= CSALF_MUCKOUT;
+
+          D_DEBUG_AT( SurfMan, "  -> offset %lu, size %d\n", smallest->offset, smallest->size );
+
+          return DFB_OK;
+     }
+
+     if (bestm_start) {
+          chunk = bestm_start;
+
+          while (bestm_count) {
+               CoreSurfaceAllocation *allocation = chunk->allocation;
+
+               if (allocation) {
+                    D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+                    D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+                    
+                    allocation->flags |= CSALF_MUCKOUT;
+
+                    bestm_count--;
+               }
+
+               D_DEBUG_AT( SurfMan, "  ---> offset %d, length %d\n", chunk->offset, chunk->length );
+
+               chunk = chunk->next;
+          }
+
+          return DFB_OK;
+     }
+
+     return DFB_NOVIDEOMEMORY;
+}
+
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk )
+{
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     buffer = chunk->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( buffer->surface, CoreSurface );
+
+     D_DEBUG_AT( SurfMan, "%s( %p ) <- %dx%d %s\n", __FUNCTION__, buffer,
+                 buffer->surface->config.size.w, buffer->surface->config.size.h,
+                 dfb_pixelformat_name( buffer->surface->config.format ) );
+
+     free_chunk( manager, chunk );
+
+     return DFB_OK;
+}
+
+/** internal functions NOT locking the surfacemanager **/
+
+static Chunk *
+split_chunk( SurfaceManager *manager, Chunk *c, int length )
+{
+     Chunk *newchunk;
+
+     D_MAGIC_ASSERT( c, Chunk );
+
+     if (c->length == length)          /* does not need be splitted */
+          return c;
+
+     newchunk = (Chunk*) SHCALLOC( manager->shmpool, 1, sizeof(Chunk) );
+     if (!newchunk) {
+          D_OOSHM();
+          return NULL;
+     }
+
+     /* calculate offsets and lengths of resulting chunks */
+     newchunk->offset = c->offset + c->length - length;
+     newchunk->length = length;
+     c->length -= newchunk->length;
+
+     /* insert newchunk after chunk c */
+     newchunk->prev = c;
+     newchunk->next = c->next;
+     if (c->next)
+          c->next->prev = newchunk;
+     c->next = newchunk;
+
+     D_MAGIC_SET( newchunk, Chunk );
+
+     return newchunk;
+}
+
+static Chunk *
+free_chunk( SurfaceManager *manager, Chunk *chunk )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     if (!chunk->buffer) {
+          D_BUG( "freeing free chunk" );
+          return chunk;
+     }
+     else {
+          D_DEBUG_AT( SurfMan, "Deallocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+     }
+
+     if (chunk->buffer->policy == CSP_VIDEOONLY)
+          manager->avail += chunk->length;
+
+     chunk->allocation = NULL;
+     chunk->buffer     = NULL;
+
+     manager->min_toleration--;
+
+     if (chunk->prev  &&  !chunk->prev->buffer) {
+          Chunk *prev = chunk->prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with previous chunk at %d\n", prev->offset );
+
+          prev->length += chunk->length;
+
+          prev->next = chunk->next;
+          if (prev->next)
+               prev->next->prev = prev;
+
+          //D_DEBUG_AT( SurfMan, "  -> freeing %p (prev %p, next %p)\n", chunk, chunk->prev, chunk->next);
+
+          D_MAGIC_CLEAR( chunk );
+
+          SHFREE( manager->shmpool, chunk );
+          chunk = prev;
+     }
+
+     if (chunk->next  &&  !chunk->next->buffer) {
+          Chunk *next = chunk->next;
+
+          //D_DEBUG_AT( SurfMan, "  -> merging with next chunk at %d\n", next->offset );
+
+          chunk->length += next->length;
+
+          chunk->next = next->next;
+          if (chunk->next)
+               chunk->next->prev = chunk;
+
+          D_MAGIC_CLEAR( next );
+
+          SHFREE( manager->shmpool, next );
+     }
+
+     return chunk;
+}
+
+static Chunk *
+occupy_chunk( SurfaceManager *manager, Chunk *chunk, CoreSurfaceAllocation *allocation, int length, int pitch )
+{
+     D_MAGIC_ASSERT( manager, SurfaceManager );
+     D_MAGIC_ASSERT( chunk, Chunk );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( allocation->buffer, CoreSurfaceBuffer );
+     
+     if (allocation->buffer->policy == CSP_VIDEOONLY)
+          manager->avail -= length;
+
+     chunk = split_chunk( manager, chunk, length );
+
+     D_DEBUG_AT( SurfMan, "Allocating %d bytes at offset %d.\n", chunk->length, chunk->offset );
+
+     chunk->allocation = allocation;
+     chunk->buffer     = allocation->buffer;
+     chunk->pitch      = pitch;
+
+     manager->min_toleration++;
+
+     return chunk;
+}
+
diff --git a/Source/DirectFB/systems/x11/surfacemanager.h b/Source/DirectFB/systems/x11/surfacemanager.h
new file mode 100755
index 0000000..e6136c5
--- /dev/null
+++ b/Source/DirectFB/systems/x11/surfacemanager.h
@@ -0,0 +1,110 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SURFACEMANAGER_H__
+#define __SURFACEMANAGER_H__
+
+#include <directfb.h>
+
+#include <core/coretypes.h>
+
+typedef struct _SurfaceManager SurfaceManager;
+typedef struct _Chunk          Chunk;
+
+/*
+ * initially there is one big free chunk,
+ * chunks are splitted into a free and an occupied chunk if memory is allocated,
+ * two chunks are merged to one free chunk if memory is deallocated
+ */
+struct _Chunk {
+     int                  magic;
+
+     int                  offset;      /* offset in memory,
+                                          is greater or equal to the heap offset */
+     int                  length;      /* length of this chunk in bytes */
+
+     int                  pitch;
+     
+     CoreSurfaceBuffer   *buffer;      /* pointer to surface buffer occupying
+                                          this chunk, or NULL if chunk is free */
+     CoreSurfaceAllocation *allocation;
+
+     int                  tolerations; /* number of times this chunk was scanned
+                                          occupied, resetted in assure_video */
+
+     Chunk               *prev;
+     Chunk               *next;
+};
+
+struct _SurfaceManager {
+     int                  magic;
+
+     FusionSHMPoolShared *shmpool;
+
+     Chunk               *chunks;
+
+     int                  offset;
+     int                  length;         /* length of the heap in bytes */
+     int                  avail;          /* amount of available memory in bytes */
+
+     int                  min_toleration;
+     
+     bool                 suspended;
+};
+
+
+DFBResult dfb_surfacemanager_create ( CoreDFB             *core,
+                                      unsigned int         length,
+                                      SurfaceManager     **ret_manager );
+
+void      dfb_surfacemanager_destroy( SurfaceManager      *manager );
+
+/*
+ * finds and allocates one for the surface or fails,
+ * after success the video health is CSH_RESTORE.
+ * NOTE: this does not notify the listeners
+ */
+DFBResult dfb_surfacemanager_allocate( CoreDFB                *core,
+                                       SurfaceManager         *manager,
+                                       CoreSurfaceBuffer      *buffer,
+                                       CoreSurfaceAllocation  *allocation,
+                                       Chunk                 **ret_chunk );
+
+DFBResult dfb_surfacemanager_displace( CoreDFB           *core,
+                                       SurfaceManager    *manager,
+                                       CoreSurfaceBuffer *buffer );
+
+/*
+ * sets the video health to CSH_INVALID frees the chunk and
+ * notifies the listeners
+ */
+DFBResult dfb_surfacemanager_deallocate( SurfaceManager *manager,
+                                         Chunk          *chunk );
+
+#endif
+
diff --git a/Source/DirectFB/systems/x11/vpsmem_surface_pool.c b/Source/DirectFB/systems/x11/vpsmem_surface_pool.c
new file mode 100755
index 0000000..0cf505d
--- /dev/null
+++ b/Source/DirectFB/systems/x11/vpsmem_surface_pool.c
@@ -0,0 +1,421 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <direct/debug.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include "x11.h"
+#include "surfacemanager.h"
+
+D_DEBUG_DOMAIN( VPSMem_Surfaces, "VPSMem/Surfaces", "VPSMem Framebuffer Surface Pool" );
+D_DEBUG_DOMAIN( VPSMem_SurfLock, "VPSMem/SurfLock", "VPSMem Framebuffer Surface Pool Locks" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int             magic;
+
+     SurfaceManager *manager;
+
+     void           *mem;
+     unsigned int    length;
+} VPSMemPoolData;
+
+typedef struct {
+     int             magic;
+
+     CoreDFB        *core;
+} VPSMemPoolLocalData;
+
+typedef struct {
+     int   magic;
+
+     int   offset;
+     int   pitch;
+     int   size;
+
+     Chunk *chunk;
+} VPSMemAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+vpsmemPoolDataSize( void )
+{
+     return sizeof(VPSMemPoolData);
+}
+
+static int
+vpsmemPoolLocalDataSize( void )
+{
+     return sizeof(VPSMemPoolLocalData);
+}
+
+static int
+vpsmemAllocationDataSize( void )
+{
+     return sizeof(VPSMemAllocationData);
+}
+
+static DFBResult
+vpsmemInitPool( CoreDFB                    *core,
+                CoreSurfacePool            *pool,
+                void                       *pool_data,
+                void                       *pool_local,
+                void                       *system_data,
+                CoreSurfacePoolDescription *ret_desc )
+{
+     DFBResult            ret;
+     VPSMemPoolData      *data   = pool_data;
+     VPSMemPoolLocalData *local  = pool_local;
+     DFBX11              *x11    = system_data;
+     DFBX11Shared        *shared = x11->shared;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( data != NULL );
+     D_ASSERT( local != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     data->mem = SHMALLOC( shared->data_shmpool, shared->vpsmem_length );
+     if (!data->mem) {
+          shared->vpsmem_length = 0;
+          return D_OOSHM();
+     }
+
+     data->length = shared->vpsmem_length;
+
+     ret = dfb_surfacemanager_create( core, data->length, &data->manager );
+     if (ret)
+          return ret;
+
+     ret_desc->caps              = CSPCAPS_PHYSICAL | CSPCAPS_VIRTUAL;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_DEFAULT;
+     ret_desc->size              = data->length;
+
+     /* For testing... */
+     ret_desc->access[CSAID_ACCEL1] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_ACCEL2] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_ACCEL3] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->access[CSAID_ACCEL4] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Virtual Physical" );
+
+     local->core = core;
+
+     D_MAGIC_SET( data, VPSMemPoolData );
+     D_MAGIC_SET( local, VPSMemPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemJoinPool( CoreDFB                    *core,
+                CoreSurfacePool            *pool,
+                void                       *pool_data,
+                void                       *pool_local,
+                void                       *system_data )
+{
+     VPSMemPoolData      *data  = pool_data;
+     VPSMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_ASSERT( core != NULL );
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_ASSERT( local != NULL );
+
+     (void) data;
+
+     local->core = core;
+
+     D_MAGIC_SET( local, VPSMemPoolLocalData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemDestroyPool( CoreSurfacePool *pool,
+                   void            *pool_data,
+                   void            *pool_local )
+{
+     VPSMemPoolData      *data  = pool_data;
+     VPSMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( local, VPSMemPoolLocalData );
+
+     dfb_surfacemanager_destroy( data->manager );
+
+     D_MAGIC_CLEAR( data );
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemLeavePool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     VPSMemPoolData      *data  = pool_data;
+     VPSMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( local, VPSMemPoolLocalData );
+
+     (void) data;
+
+     D_MAGIC_CLEAR( local );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemTestConfig( CoreSurfacePool         *pool,
+                  void                    *pool_data,
+                  void                    *pool_local,
+                  CoreSurfaceBuffer       *buffer,
+                  const CoreSurfaceConfig *config )
+{
+     DFBResult            ret;
+     CoreSurface         *surface;
+     VPSMemPoolData      *data  = pool_data;
+     VPSMemPoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( local, VPSMemPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, NULL, NULL );
+
+     D_DEBUG_AT( VPSMem_Surfaces, "  -> %s\n", DirectFBErrorString(ret) );
+
+     return ret;
+}
+
+static DFBResult
+vpsmemAllocateBuffer( CoreSurfacePool       *pool,
+                      void                  *pool_data,
+                      void                  *pool_local,
+                      CoreSurfaceBuffer     *buffer,
+                      CoreSurfaceAllocation *allocation,
+                      void                  *alloc_data )
+{
+     DFBResult             ret;
+     Chunk                *chunk;
+     CoreSurface          *surface;
+     VPSMemPoolData       *data  = pool_data;
+     VPSMemPoolLocalData  *local = pool_local;
+     VPSMemAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( local, VPSMemPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     ret = dfb_surfacemanager_allocate( local->core, data->manager, buffer, allocation, &chunk );
+     if (ret)
+          return ret;
+
+     D_MAGIC_ASSERT( chunk, Chunk );
+
+     alloc->offset = chunk->offset;
+     alloc->pitch  = chunk->pitch;
+     alloc->size   = surface->config.size.h * alloc->pitch;
+
+     alloc->chunk  = chunk;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "  -> offset %d, pitch %d, size %d (%d)\n",
+                 alloc->offset, alloc->pitch, alloc->size, chunk->length );
+
+     D_ASSERT( chunk->length >= alloc->size );
+
+     alloc->size = chunk->length;
+
+     allocation->size   = alloc->size;
+     allocation->offset = alloc->offset;
+
+     D_MAGIC_SET( alloc, VPSMemAllocationData );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemDeallocateBuffer( CoreSurfacePool       *pool,
+                        void                  *pool_data,
+                        void                  *pool_local,
+                        CoreSurfaceBuffer     *buffer,
+                        CoreSurfaceAllocation *allocation,
+                        void                  *alloc_data )
+{
+     VPSMemPoolData       *data  = pool_data;
+     VPSMemAllocationData *alloc = alloc_data;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+     D_MAGIC_ASSERT( alloc, VPSMemAllocationData );
+
+     dfb_surfacemanager_deallocate( data->manager, alloc->chunk );
+
+     D_MAGIC_CLEAR( alloc );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemMuckOut( CoreSurfacePool   *pool,
+               void              *pool_data,
+               void              *pool_local,
+               CoreSurfaceBuffer *buffer )
+{
+     CoreSurface           *surface;
+     VPSMemPoolData        *data  = pool_data;
+     VPSMemPoolLocalData   *local = pool_local;
+
+     D_DEBUG_AT( VPSMem_Surfaces, "%s( %p )\n", __FUNCTION__, buffer );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( local, VPSMemPoolLocalData );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     return dfb_surfacemanager_displace( local->core, data->manager, buffer );
+}
+
+static DFBResult
+vpsmemLock( CoreSurfacePool       *pool,
+            void                  *pool_data,
+            void                  *pool_local,
+            CoreSurfaceAllocation *allocation,
+            void                  *alloc_data,
+            CoreSurfaceBufferLock *lock )
+{
+     VPSMemPoolData       *data  = pool_data;
+     VPSMemAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( data, VPSMemPoolData );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, VPSMemAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( VPSMem_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     lock->pitch  = alloc->pitch;
+     lock->offset = alloc->offset;
+     lock->addr   = data->mem + alloc->offset;
+     lock->phys   = dfb_config->video_phys + alloc->offset;
+
+     D_DEBUG_AT( VPSMem_SurfLock, "  -> offset %lu, pitch %d, addr %p, phys 0x%08lx\n",
+                 lock->offset, lock->pitch, lock->addr, lock->phys );
+
+     return DFB_OK;
+}
+
+static DFBResult
+vpsmemUnlock( CoreSurfacePool       *pool,
+              void                  *pool_data,
+              void                  *pool_local,
+              CoreSurfaceAllocation *allocation,
+              void                  *alloc_data,
+              CoreSurfaceBufferLock *lock )
+{
+     VPSMemAllocationData *alloc = alloc_data;
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( alloc, VPSMemAllocationData );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     D_DEBUG_AT( VPSMem_SurfLock, "%s( %p )\n", __FUNCTION__, lock->buffer );
+
+     (void) alloc;
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs vpsmemSurfacePoolFuncs = {
+     .PoolDataSize       = vpsmemPoolDataSize,
+     .PoolLocalDataSize  = vpsmemPoolLocalDataSize,
+     .AllocationDataSize = vpsmemAllocationDataSize,
+
+     .InitPool           = vpsmemInitPool,
+     .JoinPool           = vpsmemJoinPool,
+     .DestroyPool        = vpsmemDestroyPool,
+     .LeavePool          = vpsmemLeavePool,
+
+     .TestConfig         = vpsmemTestConfig,
+     .AllocateBuffer     = vpsmemAllocateBuffer,
+     .DeallocateBuffer   = vpsmemDeallocateBuffer,
+
+     .MuckOut            = vpsmemMuckOut,
+
+     .Lock               = vpsmemLock,
+     .Unlock             = vpsmemUnlock,
+};
+
diff --git a/Source/DirectFB/systems/x11/vpsmem_surface_pool.h b/Source/DirectFB/systems/x11/vpsmem_surface_pool.h
new file mode 100755
index 0000000..915469b
--- /dev/null
+++ b/Source/DirectFB/systems/x11/vpsmem_surface_pool.h
@@ -0,0 +1,37 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__VPSMEM_SURFACE_POOL_H__
+#define __X11SYSTEM__VPSMEM_SURFACE_POOL_H__
+
+#include <core/surface_pool.h>
+
+extern const SurfacePoolFuncs vpsmemSurfacePoolFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/systems/x11/x11.c b/Source/DirectFB/systems/x11/x11.c
new file mode 100755
index 0000000..62d329c
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11.c
@@ -0,0 +1,570 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+#include <fusion/lock.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <direct/messages.h>
+
+
+#include "primary.h"
+#include "xwindow.h"
+#include "x11.h"
+#include "x11_surface_pool.h"
+#include "x11_surface_pool_bridge.h"
+
+#ifdef USE_GLX
+#include "glx_surface_pool.h"
+#endif
+
+#include "vpsmem_surface_pool.h"
+
+#include <core/core_system.h>
+
+D_DEBUG_DOMAIN( X11_Core, "X11/Core", "Main X11 system functions" );
+
+DFB_CORE_SYSTEM( x11 )
+
+
+static VideoMode modes[] = {
+     { .xres =  320, .yres =  200 },
+     { .xres =  320, .yres =  240 },
+     { .xres =  512, .yres =  384 },
+     { .xres =  640, .yres =  480 },
+     { .xres =  768, .yres =  576 },
+
+     { .xres = 1024, .yres =  576 },     // 16:9
+     { .xres = 1024, .yres =  600 },     // Where does that mode come from? :-)
+     { .xres = 1024, .yres =  768 },     // 4:3
+
+     { .xres = 1280, .yres =  720 },     // 16:9
+     { .xres = 1280, .yres =  960 },     // 4:3
+     { .xres = 1280, .yres = 1024 },     // 5:4
+
+     { .xres = 1440, .yres =  810 },     // 16:9
+     { .xres = 1440, .yres = 1080 },     // 4:3
+
+     { .xres = 1600, .yres =  900 },     // 16:9, obviously :)
+     { .xres = 1600, .yres = 1200 },     // 4:3
+
+     { .xres = 1920, .yres = 1080 },     // 16:9
+     { .xres = 1920, .yres = 1200 },     // 16:10
+
+     { .xres = 0, .yres = 0 }
+};
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult call_handler( int           caller,
+                                             int           call_arg,
+                                             void         *call_ptr,
+                                             void         *ctx,
+                                             unsigned int  serial,
+                                             int          *ret_val );
+
+/**********************************************************************************************************************/
+
+static DFBResult
+InitLocal( DFBX11 *x11, DFBX11Shared *shared, CoreDFB *core )
+{
+     int i, n;
+
+     XInitThreads();
+
+     x11->shared = shared;
+     x11->core   = core;
+
+     x11->display = XOpenDisplay(getenv("DISPLAY"));
+     if (!x11->display) {
+          D_ERROR("X11: Error in XOpenDisplay for '%s'\n", getenv("DISPLAY"));
+          return DFB_INIT;
+     }
+
+     x11->screenptr = DefaultScreenOfDisplay(x11->display);
+     x11->screennum = DefaultScreen(x11->display);
+
+     for (i=0; i<x11->screenptr->ndepths; i++) {
+          const Depth *depth = &x11->screenptr->depths[i];
+
+          for (n=0; n<depth->nvisuals; n++) {
+               Visual *visual = &depth->visuals[n];
+
+               D_DEBUG_AT( X11_Core, "[Visual %d] ID 0x%02lx, depth %d, RGB 0x%06lx/0x%06lx/0x%06lx, %d bpRGB, %d entr.\n",
+                        n, visual->visualid, depth->depth,
+                        visual->red_mask, visual->green_mask, visual->blue_mask,
+                        visual->bits_per_rgb, visual->map_entries );
+
+               switch (depth->depth) {
+                    case 32:
+                         if (visual->red_mask   == 0xff0000 &&
+                             visual->green_mask == 0x00ff00 &&
+                             visual->blue_mask  == 0x0000ff &&
+                             !x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)])
+                              x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_ARGB)] = visual;
+                         break;
+
+                    case 24:
+                         if (visual->red_mask   == 0xff0000 &&
+                             visual->green_mask == 0x00ff00 &&
+                             visual->blue_mask  == 0x0000ff &&
+                             !x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)])
+                              x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB32)] = visual;
+                         break;
+
+                    case 16:
+                         if (visual->red_mask   == 0xf800 &&
+                             visual->green_mask == 0x07e0 &&
+                             visual->blue_mask  == 0x001f &&
+                             !x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)])
+                              x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB16)] = visual;
+                         break;
+
+                    case 15:
+                         if (visual->red_mask   == 0x7c00 &&
+                             visual->green_mask == 0x03e0 &&
+                             visual->blue_mask  == 0x001f &&
+                             !x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB555)])
+                              x11->visuals[DFB_PIXELFORMAT_INDEX(DSPF_RGB555)] = visual;
+                         break;
+               }
+          }
+     }
+
+     if (XShmQueryExtension( x11->display ))
+          XShmQueryVersion( x11->display, &x11->xshm_major, &x11->xshm_minor, &x11->use_shm );
+
+
+     x11->screen = dfb_screens_register( NULL, x11, &x11PrimaryScreenFuncs );
+
+     dfb_layers_register( x11->screen, x11, &x11PrimaryLayerFuncs );
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+     info->type = CORE_X11;   
+     info->caps = CSCAPS_ACCELERATION;
+
+     D_DEBUG_AT( X11_Core, "%s()\n", __FUNCTION__ );
+
+     snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "X11" );
+}
+
+DFBX11 *dfb_x11 = NULL;
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+     DFBResult     ret;
+     DFBX11       *x11;
+     DFBX11Shared *shared;
+
+     D_DEBUG_AT( X11_Core, "%s()\n", __FUNCTION__ );
+
+     x11 = D_CALLOC( 1, sizeof(DFBX11) );
+     if (!x11)
+          return D_OOM();
+
+     shared = SHCALLOC( dfb_core_shmpool( core ), 1, sizeof(DFBX11Shared) );
+     if (!shared) {
+          D_FREE( x11 );
+          return D_OOSHM();
+     }
+
+
+     /*
+      * Local init (master and slave)
+      */
+     ret = InitLocal( x11, shared, core );
+     if (ret) {
+          SHFREE( dfb_core_shmpool( core ), shared );
+          D_FREE( x11 );
+          return ret;
+     }
+
+
+     /*
+      * Shared init (master only)
+      */
+     shared->data_shmpool = dfb_core_shmpool_data( core );
+
+     shared->screen_size.w = x11->screenptr->width;
+     shared->screen_size.h = x11->screenptr->height;
+
+     fusion_skirmish_init( &shared->lock, "X11 System", dfb_core_world(core) );
+
+     fusion_call_init( &shared->call, call_handler, x11, dfb_core_world(core) );
+
+
+     /*
+      * Must be set before initializing the pools!
+      */
+     *data = x11;
+
+     dfb_x11 = x11;
+
+     /*
+      * Master init
+      */
+     dfb_surface_pool_initialize( core, &x11SurfacePoolFuncs, &shared->x11image_pool );
+
+#ifdef USE_GLX
+     dfb_surface_pool_initialize( core, &glxSurfacePoolFuncs, &shared->glx_pool );
+#endif
+
+     if (dfb_config->video_length) {
+          shared->vpsmem_length = dfb_config->video_length;
+
+          dfb_surface_pool_initialize( core, &vpsmemSurfacePoolFuncs, &shared->vpsmem_pool );
+     }
+
+#ifdef USE_GLX
+     dfb_surface_pool_bridge_initialize( core, &x11SurfacePoolBridgeFuncs, x11, &shared->x11_pool_bridge );
+#endif
+
+     fusion_arena_add_shared_field( dfb_core_arena( core ), "x11", shared );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+     DFBResult     ret;
+     void         *ptr;
+     DFBX11       *x11;
+     DFBX11Shared *shared;
+
+     D_DEBUG_AT( X11_Core, "%s()\n", __FUNCTION__ );
+
+     x11 = D_CALLOC( 1, sizeof(DFBX11) );
+     if (!x11)
+          return D_OOM();
+
+     fusion_arena_get_shared_field( dfb_core_arena( core ), "x11", &ptr );
+     shared = ptr;
+
+
+     /*
+      * Local init (master and slave)
+      */
+     ret = InitLocal( x11, shared, core );
+     if (ret) {
+          D_FREE( x11 );
+          return ret;
+     }
+
+
+     /*
+      * Must be set before joining the pools!
+      */
+     *data = x11;
+
+
+     /*
+      * Slave init
+      */
+     if (shared->x11image_pool)
+          dfb_surface_pool_join( core, shared->x11image_pool, &x11SurfacePoolFuncs );
+
+#ifdef USE_GLX
+     if (shared->glx_pool)
+          dfb_surface_pool_join( core, shared->glx_pool, &glxSurfacePoolFuncs );
+#endif
+
+     if (shared->vpsmem_pool)
+          dfb_surface_pool_join( core, shared->vpsmem_pool, &vpsmemSurfacePoolFuncs );
+
+#ifdef USE_GLX
+     if (shared->x11_pool_bridge)
+          dfb_surface_pool_bridge_join( core, shared->x11_pool_bridge, &x11SurfacePoolBridgeFuncs, x11 );
+#endif
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+     DFBX11       *x11    = dfb_system_data();
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Core, "%s()\n", __FUNCTION__ );
+
+     /*
+      * Master deinit
+      */
+     if (shared->x11_pool_bridge)
+          dfb_surface_pool_bridge_destroy( shared->x11_pool_bridge );
+
+     if (shared->vpsmem_pool)
+          dfb_surface_pool_destroy( shared->vpsmem_pool );
+
+     if (shared->glx_pool)
+          dfb_surface_pool_destroy( shared->glx_pool );
+
+     if (shared->x11image_pool)
+          dfb_surface_pool_destroy( shared->x11image_pool );
+
+
+     /*
+      * Shared deinit (master only)
+      */
+     fusion_call_destroy( &shared->call );
+
+     fusion_skirmish_prevail( &shared->lock );
+
+     if (shared->xw)
+         dfb_x11_close_window( x11, shared->xw );
+
+     fusion_skirmish_destroy( &shared->lock );
+
+
+     SHFREE( dfb_core_shmpool( x11->core ), shared );
+
+
+     /*
+      * Local deinit (master and slave)
+      */
+     if (x11->display)
+         XCloseDisplay( x11->display );
+
+     D_FREE( x11 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+     DFBX11       *x11    = dfb_system_data();
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Core, "%s()\n", __FUNCTION__ );
+
+     /*
+      * Slave deinit
+      */
+     if (shared->x11_pool_bridge)
+          dfb_surface_pool_bridge_leave( shared->x11_pool_bridge );
+
+     if (shared->vpsmem_pool)
+          dfb_surface_pool_leave( shared->vpsmem_pool );
+
+     if (shared->glx_pool)
+          dfb_surface_pool_leave( shared->glx_pool );
+
+     if (shared->x11image_pool)
+          dfb_surface_pool_leave( shared->x11image_pool );
+
+
+     /*
+      * Local deinit (master and slave)
+      */
+     if (x11->display)
+         XCloseDisplay( x11->display );
+
+     D_FREE( x11 );
+
+     return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+system_resume( void )
+{
+     return DFB_UNIMPLEMENTED;
+}
+
+static volatile void *
+system_map_mmio( unsigned int    offset,
+                 int             length )
+{
+     return NULL;
+}
+
+static void
+system_unmap_mmio( volatile void  *addr,
+                   int             length )
+{
+}
+
+static int
+system_get_accelerator( void )
+{
+     return dfb_config->accelerator;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+     return modes;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+     return &modes[0];   /* FIXME */
+}
+
+static DFBResult
+system_thread_init( void )
+{
+     return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+                     DFBInputEvent   *event )
+{
+     return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+     return 0;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+     return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+     return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+     return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+                     unsigned int *ret_device_id )
+{
+}
+
+static FusionCallHandlerResult
+call_handler( int           caller,
+              int           call_arg,
+              void         *call_ptr,
+              void         *ctx,
+              unsigned int  serial,
+              int          *ret_val )
+{
+     DFBX11 *x11 = ctx;
+
+     switch (call_arg) {
+          case X11_CREATE_WINDOW:
+               *ret_val = dfb_x11_create_window_handler( x11, call_ptr );
+               break;
+
+          case X11_DESTROY_WINDOW:
+               *ret_val = dfb_x11_destroy_window_handler( x11 );
+               break;
+
+          case X11_UPDATE_SCREEN:
+               *ret_val = dfb_x11_update_screen_handler( x11, call_ptr );
+               break;
+
+          case X11_SET_PALETTE:
+               *ret_val = dfb_x11_set_palette_handler( x11, call_ptr );
+               break;
+
+          case X11_IMAGE_INIT:
+               *ret_val = dfb_x11_image_init_handler( x11, call_ptr );
+               break;
+
+          case X11_IMAGE_DESTROY:
+               *ret_val = dfb_x11_image_destroy_handler( x11, call_ptr );
+               break;
+
+          default:
+               D_BUG( "unknown call" );
+               *ret_val = DFB_BUG;
+               break;
+     }
+
+     return FCHR_RETURN;
+}
+
diff --git a/Source/DirectFB/systems/x11/x11.h b/Source/DirectFB/systems/x11/x11.h
new file mode 100755
index 0000000..4743f1a
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11.h
@@ -0,0 +1,116 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__X11_H__
+#define __X11SYSTEM__X11_H__
+
+#include <fusion/call.h>
+#include <fusion/lock.h>
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+
+#include "x11image.h"
+#include "xwindow.h"
+
+typedef struct {
+     CoreLayerRegionConfig  config;
+} SetModeData;
+
+typedef struct {
+     DFBRegion              region;
+
+     CoreSurfaceBufferLock *lock;
+} UpdateScreenData;
+
+
+typedef struct {
+     UpdateScreenData     update;
+     SetModeData          setmode;
+                         
+     FusionSkirmish       lock;
+     FusionCall           call;
+
+     FusionSHMPoolShared *data_shmpool;
+ 
+     CoreSurfacePool     *x11image_pool;
+
+     CoreSurfacePool     *glx_pool; /* only used for GL */
+
+     CoreSurfacePool     *vpsmem_pool;
+     unsigned int         vpsmem_length;
+ 
+     CoreSurfacePoolBridge *x11_pool_bridge;
+
+//     CoreSurface         *primary;
+     DFBDimension         screen_size;
+
+     XWindow             *xw;
+} DFBX11Shared;
+
+struct __DFB_X11 {
+     DFBX11Shared        *shared;
+
+     CoreDFB             *core;
+     CoreScreen          *screen;
+
+     Bool                 use_shm;
+     int                  xshm_major;
+     int                  xshm_minor;
+                         
+     Display             *display;
+     Screen              *screenptr;
+     int                  screennum;
+                     
+     Visual              *visuals[DFB_NUM_PIXELFORMATS];
+};
+
+typedef enum {
+     X11_CREATE_WINDOW,
+     X11_UPDATE_SCREEN,
+     X11_SET_PALETTE,
+     X11_IMAGE_INIT,
+     X11_IMAGE_DESTROY,
+     X11_DESTROY_WINDOW,
+} DFBX11Call;
+
+
+
+DFBResult dfb_x11_create_window_handler ( DFBX11 *x11, CoreLayerRegionConfig *config );
+DFBResult dfb_x11_destroy_window_handler( DFBX11 *x11 );
+
+DFBResult dfb_x11_update_screen_handler ( DFBX11 *x11, UpdateScreenData *data );
+DFBResult dfb_x11_set_palette_handler   ( DFBX11 *x11, CorePalette *palette );
+
+DFBResult dfb_x11_image_init_handler    ( DFBX11 *x11, x11Image *image );
+DFBResult dfb_x11_image_destroy_handler ( DFBX11 *x11, x11Image *image );
+
+
+#endif //__X11SYSTEM__X11_H__
+
diff --git a/Source/DirectFB/systems/x11/x11_surface_pool.c b/Source/DirectFB/systems/x11/x11_surface_pool.c
new file mode 100755
index 0000000..4936f2a
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11_surface_pool.c
@@ -0,0 +1,369 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <direct/debug.h>
+#include <direct/hash.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/surface_pool.h>
+
+#include "x11.h"
+#include "x11image.h"
+#include "x11_surface_pool.h"
+
+D_DEBUG_DOMAIN( X11_Surfaces, "X11/Surfaces", "X11 System Surface Pool" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+} x11PoolData;
+
+typedef struct {
+     pthread_mutex_t  lock;
+     DirectHash      *hash;
+
+     DFBX11          *x11;
+} x11PoolLocalData;
+
+/**********************************************************************************************************************/
+
+static int
+x11PoolDataSize( void )
+{
+     return sizeof(x11PoolData);
+}
+
+static int
+x11PoolLocalDataSize( void )
+{
+     return sizeof(x11PoolLocalData);
+}
+
+static int
+x11AllocationDataSize( void )
+{
+     return sizeof(x11AllocationData);
+}
+
+static DFBResult
+x11InitPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data,
+             CoreSurfacePoolDescription *ret_desc )
+{
+     DFBResult         ret;
+     x11PoolLocalData *local = pool_local;
+     DFBX11           *x11   = system_data;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_ASSERT( ret_desc != NULL );
+
+     local->x11 = x11;
+
+     ret_desc->caps              = CSPCAPS_VIRTUAL;
+     ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
+     ret_desc->types             = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+     ret_desc->priority          = CSPP_ULTIMATE;
+
+     /* For showing our X11 window */
+     ret_desc->access[CSAID_LAYER0] = CSAF_READ;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "X11 Shm Images" );
+
+     ret = direct_hash_create( 7, &local->hash );
+     if (ret) {
+          D_DERROR( ret, "X11/Surfaces: Could not create local hash table!\n" );
+          return ret;
+     }
+
+     pthread_mutex_init( &local->lock, NULL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11JoinPool( CoreDFB                    *core,
+             CoreSurfacePool            *pool,
+             void                       *pool_data,
+             void                       *pool_local,
+             void                       *system_data )
+{
+     DFBResult         ret;
+     x11PoolLocalData *local = pool_local;
+     DFBX11           *x11   = system_data;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     local->x11 = x11;
+
+     ret = direct_hash_create( 7, &local->hash );
+     if (ret) {
+          D_DERROR( ret, "X11/Surfaces: Could not create local hash table!\n" );
+          return ret;
+     }
+
+     pthread_mutex_init( &local->lock, NULL );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11DestroyPool( CoreSurfacePool *pool,
+                void            *pool_data,
+                void            *pool_local )
+{
+     x11PoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     pthread_mutex_destroy( &local->lock );
+
+     direct_hash_destroy( local->hash );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11LeavePool( CoreSurfacePool *pool,
+              void            *pool_data,
+              void            *pool_local )
+{
+     x11PoolLocalData *local = pool_local;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+     pthread_mutex_destroy( &local->lock );
+
+     direct_hash_destroy( local->hash );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11TestConfig( CoreSurfacePool         *pool,
+               void                    *pool_data,
+               void                    *pool_local,
+               CoreSurfaceBuffer       *buffer,
+               const CoreSurfaceConfig *config )
+{
+     x11PoolLocalData *local  = pool_local;
+     DFBX11           *x11    = local->x11;
+     DFBX11Shared     *shared = x11->shared;
+
+     /* Provide a fallback only if no virtual physical pool is allocated... */
+     if (!shared->vpsmem_length)
+          return DFB_OK;
+          
+     /* Pass NULL image for probing */
+     return x11ImageInit( x11, NULL, config->size.w, config->size.h, config->format );
+}
+
+static DFBResult
+x11AllocateBuffer( CoreSurfacePool       *pool,
+                   void                  *pool_data,
+                   void                  *pool_local,
+                   CoreSurfaceBuffer     *buffer,
+                   CoreSurfaceAllocation *allocation,
+                   void                  *alloc_data )
+{
+     CoreSurface       *surface;
+     x11AllocationData *alloc = alloc_data;
+     x11PoolLocalData  *local = pool_local;
+     DFBX11            *x11   = local->x11;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     if (x11ImageInit( x11, &alloc->image, surface->config.size.w, surface->config.size.h, surface->config.format ) == DFB_OK) {
+          alloc->real  = true;
+          alloc->pitch = alloc->image.pitch;
+
+          allocation->size = surface->config.size.h * alloc->image.pitch;
+     }
+     else
+          dfb_surface_calc_buffer_size( surface, 8, 2, &alloc->pitch, &allocation->size );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11DeallocateBuffer( CoreSurfacePool       *pool,
+                     void                  *pool_data,
+                     void                  *pool_local,
+                     CoreSurfaceBuffer     *buffer,
+                     CoreSurfaceAllocation *allocation,
+                     void                  *alloc_data )
+{
+     x11AllocationData *alloc  = alloc_data;
+     x11PoolLocalData  *local  = pool_local;
+     DFBX11            *x11    = local->x11;
+     DFBX11Shared      *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     CORE_SURFACE_ALLOCATION_ASSERT( allocation );
+
+     if (alloc->real)
+          return x11ImageDestroy( x11, &alloc->image );
+
+     if (alloc->ptr)
+          SHFREE( shared->data_shmpool, alloc->ptr );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11Lock( CoreSurfacePool       *pool,
+         void                  *pool_data,
+         void                  *pool_local,
+         CoreSurfaceAllocation *allocation,
+         void                  *alloc_data,
+         CoreSurfaceBufferLock *lock )
+{
+     DFBResult          ret;
+     x11PoolLocalData  *local  = pool_local;
+     x11AllocationData *alloc  = alloc_data;
+     DFBX11            *x11    = local->x11;
+     DFBX11Shared      *shared = x11->shared;
+     CoreSurfaceBuffer *buffer;
+     CoreSurface       *surface;
+
+     D_DEBUG_AT( X11_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     buffer = allocation->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     D_ASSERT( local->hash != NULL );
+
+     pthread_mutex_lock( &local->lock );
+
+     if (alloc->real) {
+          void *addr = direct_hash_lookup( local->hash, alloc->image.seginfo.shmid );
+
+          if (!addr) {
+               ret = x11ImageAttach( &alloc->image, &addr );
+               if (ret) {
+                    D_DERROR( ret, "X11/Surfaces: x11ImageAttach() failed!\n" );
+                    pthread_mutex_unlock( &local->lock );
+                    return ret;
+               }
+
+               direct_hash_insert( local->hash, alloc->image.seginfo.shmid, addr );
+
+               /* FIXME: When to remove/detach? */
+          }
+
+          lock->addr   = addr;
+          lock->handle = &alloc->image;
+     }
+     else {
+          if (!alloc->ptr) {
+               alloc->ptr = SHCALLOC( shared->data_shmpool, 1, allocation->size );
+               if (!alloc->ptr)
+                    return D_OOSHM();
+          }
+
+          lock->addr = alloc->ptr;
+     }
+
+     lock->pitch = alloc->pitch;
+
+     pthread_mutex_unlock( &local->lock );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11Unlock( CoreSurfacePool       *pool,
+           void                  *pool_data,
+           void                  *pool_local,
+           CoreSurfaceAllocation *allocation,
+           void                  *alloc_data,
+           CoreSurfaceBufferLock *lock )
+{
+     D_DEBUG_AT( X11_Surfaces, "%s( %p )\n", __FUNCTION__, allocation );
+
+     D_MAGIC_ASSERT( pool, CoreSurfacePool );
+     D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+     D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+     /* FIXME: Check overhead of attach/detach per lock/unlock. */
+
+     return DFB_OK;
+}
+
+const SurfacePoolFuncs x11SurfacePoolFuncs = {
+     .PoolDataSize       = x11PoolDataSize,
+     .PoolLocalDataSize  = x11PoolLocalDataSize,
+     .AllocationDataSize = x11AllocationDataSize,
+
+     .InitPool           = x11InitPool,
+     .JoinPool           = x11JoinPool,
+     .DestroyPool        = x11DestroyPool,
+     .LeavePool          = x11LeavePool,
+
+     .TestConfig         = x11TestConfig,
+
+     .AllocateBuffer     = x11AllocateBuffer,
+     .DeallocateBuffer   = x11DeallocateBuffer,
+
+     .Lock               = x11Lock,
+     .Unlock             = x11Unlock,
+};
+
diff --git a/Source/DirectFB/systems/x11/x11_surface_pool.h b/Source/DirectFB/systems/x11/x11_surface_pool.h
new file mode 100755
index 0000000..b660931
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11_surface_pool.h
@@ -0,0 +1,47 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__X11_SURFACE_POOL_H__
+#define __X11SYSTEM__X11_SURFACE_POOL_H__
+
+#include <core/surface_pool.h>
+
+#include "x11image.h"
+
+extern const SurfacePoolFuncs x11SurfacePoolFuncs;
+
+typedef struct {
+     bool      real;
+     x11Image  image;
+
+     void     *ptr;
+     int       pitch;
+} x11AllocationData;
+
+#endif
+
diff --git a/Source/DirectFB/systems/x11/x11_surface_pool_bridge.c b/Source/DirectFB/systems/x11/x11_surface_pool_bridge.c
new file mode 100755
index 0000000..ce2537e
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11_surface_pool_bridge.c
@@ -0,0 +1,331 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <direct/debug.h>
+#include <direct/hash.h>
+#include <direct/mem.h>
+
+#include <fusion/shmalloc.h>
+
+#include <core/surface_pool_bridge.h>
+
+#include "x11.h"
+#include "x11image.h"
+#include "glx_surface_pool.h"
+#include "x11_surface_pool.h"
+
+D_DEBUG_DOMAIN( X11_Bridge, "X11/Bridge", "X11 System Surface Pool Bridge" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+} x11PoolBridgeData;
+
+typedef struct {
+     DFBX11         *x11;
+     Display        *display;
+} x11PoolBridgeLocalData;
+
+typedef struct {
+} x11PoolTransferData;
+
+/**********************************************************************************************************************/
+
+static int
+x11PoolBridgeDataSize( void )
+{
+     return sizeof(x11PoolBridgeData);
+}
+
+static int
+x11PoolBridgeLocalDataSize( void )
+{
+     return sizeof(x11PoolBridgeLocalData);
+}
+
+static int
+x11PoolTransferDataSize( void )
+{
+     return sizeof(x11PoolTransferData);
+}
+
+static DFBResult
+x11InitPoolBridge( CoreDFB                          *core,
+                   CoreSurfacePoolBridge            *bridge,
+                   void                             *bridge_data,
+                   void                             *bridge_local,
+                   void                             *context,
+                   CoreSurfacePoolBridgeDescription *ret_desc )
+{
+     x11PoolBridgeLocalData *local = bridge_local;
+     DFBX11                 *x11   = context;
+
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+     D_ASSERT( bridge_local != NULL );
+     D_ASSERT( context != NULL );
+     D_ASSERT( ret_desc != NULL );
+
+     local->x11     = x11;
+     local->display = x11->display;
+
+     ret_desc->caps = CSPBCAPS_NONE;
+
+     snprintf( ret_desc->name, DFB_SURFACE_POOL_BRIDGE_DESC_NAME_LENGTH, "X11 Pool Bridge" );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11JoinPoolBridge( CoreDFB                          *core,
+                   CoreSurfacePoolBridge            *bridge,
+                   void                             *bridge_data,
+                   void                             *bridge_local,
+                   void                             *context )
+{
+     x11PoolBridgeLocalData *local = bridge_local;
+     DFBX11                 *x11   = context;
+
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+     D_ASSERT( bridge_local != NULL );
+     D_ASSERT( context != NULL );
+
+     local->x11     = x11;
+     local->display = x11->display;
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11DestroyPoolBridge( CoreSurfacePoolBridge *bridge,
+                      void                  *bridge_data,
+                      void                  *bridge_local )
+{
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11LeavePoolBridge( CoreSurfacePoolBridge *bridge,
+                    void                  *bridge_data,
+                    void                  *bridge_local )
+{
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     D_MAGIC_ASSERT( bridge, CoreSurfacePoolBridge );
+
+     return DFB_OK;
+}
+
+static DFBResult
+x11CheckTransfer( CoreSurfacePoolBridge *bridge,
+                  void                  *bridge_data,
+                  void                  *bridge_local,
+                  CoreSurfaceBuffer     *buffer,
+                  CoreSurfaceAllocation *from,
+                  CoreSurfaceAllocation *to )
+{
+     x11PoolBridgeLocalData *local  = bridge_local;
+     DFBX11                 *x11    = local->x11;
+     DFBX11Shared           *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     if (from->pool == shared->x11image_pool && to->pool == shared->glx_pool) {
+          x11AllocationData *alloc = from->data;
+
+          if (alloc->real) {
+               /* ARGB does not work (BadMatch) */
+               if (buffer->format == DSPF_RGB32)
+                    return DFB_OK;
+          }
+     }
+     else if (from->pool == shared->glx_pool && to->pool == shared->x11image_pool) {
+          x11AllocationData *alloc = to->data;
+
+          if (alloc->real) {
+               /* ARGB does not work (BadMatch) */
+               if (buffer->format == DSPF_RGB32)
+                    return DFB_OK;
+          }
+     }
+
+     return DFB_UNSUPPORTED;
+}
+
+static DFBResult
+x11StartTransfer( CoreSurfacePoolBridge   *bridge,
+                  void                    *bridge_data,
+                  void                    *bridge_local,
+                  CoreSurfacePoolTransfer *transfer,
+                  void                    *transfer_data )
+{
+     DFBResult               ret;
+     int                     i;
+     CoreSurfaceBufferLock   lock;
+     LocalPixmap            *pixmap;
+     x11PoolBridgeLocalData *local  = bridge_local;
+     DFBX11                 *x11    = local->x11;
+     DFBX11Shared           *shared = x11->shared;
+     CoreSurfaceAllocation  *from   = transfer->from;
+     CoreSurfaceAllocation  *to     = transfer->to;
+
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     if (from->pool == shared->x11image_pool && to->pool == shared->glx_pool) {
+          x11AllocationData *alloc = from->data;
+
+          D_ASSERT( alloc->real );
+
+          dfb_surface_buffer_lock_init( &lock, CSAID_ANY, CSAF_WRITE );
+
+          ret = dfb_surface_pool_lock( to->pool, to, &lock );
+          if (ret) {
+               dfb_surface_buffer_lock_deinit( &lock );
+               return ret;
+          }
+
+          pixmap = lock.handle;
+          D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+
+          XLockDisplay( local->display );
+
+          for (i=0; i<transfer->num_rects; i++) {
+               const DFBRectangle *rect = &transfer->rects[i];
+
+               D_DEBUG_AT( X11_Bridge, "  -> XCopyArea( %4d,%4d-%4dx%4d )\n", rect->x, rect->y, rect->w, rect->h );
+
+               XCopyArea( local->display, alloc->image.pixmap, pixmap->pixmap, pixmap->gc,
+                          rect->x, rect->y, rect->w, rect->h, rect->x, rect->y );
+          }
+
+          XFlush( local->display );
+
+          XUnlockDisplay( local->display );
+
+
+          dfb_surface_pool_unlock( to->pool, to, &lock );
+
+          dfb_surface_buffer_lock_deinit( &lock );
+
+          return DFB_OK;
+     }
+
+     if (from->pool == shared->glx_pool && to->pool == shared->x11image_pool) {
+          x11AllocationData *alloc = to->data;
+
+          D_ASSERT( alloc->real );
+
+          dfb_surface_buffer_lock_init( &lock, CSAID_ANY, CSAF_READ );
+
+          ret = dfb_surface_pool_lock( from->pool, from, &lock );
+          if (ret) {
+               dfb_surface_buffer_lock_deinit( &lock );
+               return ret;
+          }
+
+          pixmap = lock.handle;
+          D_MAGIC_ASSERT( pixmap, LocalPixmap );
+
+
+          XLockDisplay( local->display );
+
+          glFinish();
+
+          for (i=0; i<transfer->num_rects; i++) {
+               const DFBRectangle *rect = &transfer->rects[i];
+
+               D_DEBUG_AT( X11_Bridge, "  -> XCopyArea( %4d,%4d-%4dx%4d )\n", rect->x, rect->y, rect->w, rect->h );
+
+               XCopyArea( local->display, pixmap->pixmap, alloc->image.pixmap, alloc->image.gc,
+                          rect->x, rect->y, rect->w, rect->h, rect->x, rect->y );
+          }
+
+          XFlush( local->display );
+
+          XUnlockDisplay( local->display );
+
+
+          dfb_surface_pool_unlock( from->pool, from, &lock );
+
+          dfb_surface_buffer_lock_deinit( &lock );
+
+          return DFB_OK;
+     }
+
+     return DFB_BUG;
+}
+
+static DFBResult
+x11FinishTransfer( CoreSurfacePoolBridge   *bridge,
+                   void                    *bridge_data,
+                   void                    *bridge_local,
+                   CoreSurfacePoolTransfer *transfer,
+                   void                    *transfer_data )
+{
+     x11PoolBridgeLocalData *local = bridge_local;
+
+     D_DEBUG_AT( X11_Bridge, "%s()\n", __FUNCTION__ );
+
+     XLockDisplay( local->display );
+
+     XSync( local->display, False );
+
+     XUnlockDisplay( local->display );
+
+     return DFB_OK;
+}
+
+
+const SurfacePoolBridgeFuncs x11SurfacePoolBridgeFuncs = {
+     .PoolBridgeDataSize      = x11PoolBridgeDataSize,
+     .PoolBridgeLocalDataSize = x11PoolBridgeLocalDataSize,
+     .PoolTransferDataSize    = x11PoolTransferDataSize,
+
+     .InitPoolBridge          = x11InitPoolBridge,
+     .JoinPoolBridge          = x11JoinPoolBridge,
+     .DestroyPoolBridge       = x11DestroyPoolBridge,
+     .LeavePoolBridge         = x11LeavePoolBridge,
+
+     .CheckTransfer           = x11CheckTransfer,
+
+     .StartTransfer           = x11StartTransfer,
+     .FinishTransfer          = x11FinishTransfer,
+};
+
diff --git a/Source/DirectFB/systems/x11/x11_surface_pool_bridge.h b/Source/DirectFB/systems/x11/x11_surface_pool_bridge.h
new file mode 100755
index 0000000..cebb5dc
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11_surface_pool_bridge.h
@@ -0,0 +1,37 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__X11_SURFACE_POOL_BRIDGE_H__
+#define __X11SYSTEM__X11_SURFACE_POOL_BRIDGE_H__
+
+#include <core/surface_pool_bridge.h>
+
+extern const SurfacePoolBridgeFuncs x11SurfacePoolBridgeFuncs;
+
+#endif
+
diff --git a/Source/DirectFB/systems/x11/x11image.c b/Source/DirectFB/systems/x11/x11image.c
new file mode 100755
index 0000000..acf36f0
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11image.c
@@ -0,0 +1,231 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "x11.h"
+#include "x11image.h"
+
+/**********************************************************************************************************************/
+
+DFBResult x11ImageInit( DFBX11                *x11,
+                        x11Image              *image,
+                        int                    width,
+                        int                    height,
+                        DFBSurfacePixelFormat  format )
+{
+     int           ret;
+     Visual       *visual;
+     DFBX11Shared *shared = x11->shared;
+
+     if (!x11->use_shm)
+          return DFB_UNSUPPORTED;
+
+     /* Lookup visual. */
+     visual = x11->visuals[DFB_PIXELFORMAT_INDEX(format)];
+     if (!visual)
+          return DFB_UNSUPPORTED;
+
+     /* For probing. */
+     if (!image)
+          return DFB_OK;
+
+     image->width  = width;
+     image->height = height;
+     image->format = format;
+     image->depth  = DFB_COLOR_BITS_PER_PIXEL( format );
+
+     D_MAGIC_SET( image, x11Image );
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, X11_IMAGE_INIT, image, &ret )) {
+          D_MAGIC_CLEAR( image );
+          return DFB_FUSION;
+     }
+
+     if (ret) {
+          D_DERROR( ret, "X11/Image: X11_IMAGE_INIT call failed!\n" );
+          D_MAGIC_CLEAR( image );
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+DFBResult
+x11ImageDestroy( DFBX11   *x11,
+                 x11Image *image )
+{
+     int           ret;
+     DFBX11Shared *shared = x11->shared;
+
+     D_MAGIC_ASSERT( image, x11Image );
+
+     if (fusion_call_execute( &shared->call, FCEF_NONE, X11_IMAGE_DESTROY, image, &ret ))
+          return DFB_FUSION;
+
+     if (ret) {
+          D_DERROR( ret, "X11/Image: X11_IMAGE_DESTROY call failed!\n" );
+          return ret;
+     }
+
+     D_MAGIC_CLEAR( image );
+
+     return DFB_OK;
+}
+
+DFBResult
+x11ImageAttach( x11Image  *image,
+                void     **ret_addr )
+{
+     void *addr;
+
+     D_MAGIC_ASSERT( image, x11Image );
+     D_ASSERT( ret_addr != NULL );
+
+     /* FIXME: We also need to DETACH! */
+
+     addr = shmat( image->seginfo.shmid, NULL, 0 );
+     if (!addr) {
+          int erno = errno;
+
+          D_PERROR( "X11/Image: shmat( %d ) failed!\n", image->seginfo.shmid );
+
+          return errno2result( erno );
+     }
+
+     *ret_addr = addr;
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+DFBResult
+dfb_x11_image_init_handler( DFBX11 *x11, x11Image *image )
+{
+     Visual *visual;
+     XImage *ximage;
+
+     D_MAGIC_ASSERT( image, x11Image );
+
+     if (!x11->use_shm)
+          return DFB_UNSUPPORTED;
+
+     /* Lookup visual. */
+     visual = x11->visuals[DFB_PIXELFORMAT_INDEX(image->format)];
+     if (!visual)
+          return DFB_UNSUPPORTED;
+
+     image->visual = visual;
+
+     XLockDisplay( x11->display );
+
+     ximage = XShmCreateImage( x11->display, image->visual, image->depth,
+                               ZPixmap, NULL, &image->seginfo, image->width, image->height );
+     if (!ximage) {
+          D_ERROR( "X11/ShmImage: Error creating shared image (XShmCreateImage)!\n");
+          XUnlockDisplay( x11->display );
+          return DFB_FAILURE;
+     }
+
+     /* we firstly create our shared memory segment with the size we need, and
+      correct permissions for the owner, the group and the world --> 0777 */
+     image->seginfo.shmid = shmget( IPC_PRIVATE, 
+                                    ximage->bytes_per_line * ximage->height,
+                                    IPC_CREAT | 0777 );
+     if (image->seginfo.shmid < 0)
+          goto error;
+
+     /* Then, we have to attach the segment to our process, and we let the
+        function search the correct memory place --> NULL. It's safest ! */
+     image->seginfo.shmaddr = shmat( image->seginfo.shmid, NULL, 0 );
+     if (!image->seginfo.shmaddr)
+          goto error_shmat;
+
+     ximage->data = image->seginfo.shmaddr;
+
+     /* We set the buffer in Read and Write mode */
+     image->seginfo.readOnly = False;
+
+     if (!XShmAttach( x11->display, &image->seginfo ))
+          goto error_xshmattach;
+
+     image->ximage = ximage;
+     image->pitch  = ximage->bytes_per_line;
+
+     image->pixmap = XShmCreatePixmap( x11->display, DefaultRootWindow(x11->display), ximage->data,
+                                       &image->seginfo, image->width, image->height, image->depth );
+
+     image->gc = XCreateGC( x11->display, image->pixmap, 0, NULL );
+
+     XUnlockDisplay( x11->display );
+
+     return DFB_OK;
+
+
+error_xshmattach:
+     shmdt( image->seginfo.shmaddr );
+
+error_shmat:
+     shmctl( image->seginfo.shmid, IPC_RMID, NULL );
+
+error:
+     XDestroyImage( ximage );
+
+     XUnlockDisplay( x11->display );
+
+     return DFB_FAILURE;
+}
+
+DFBResult
+dfb_x11_image_destroy_handler( DFBX11 *x11, x11Image *image )
+{
+     D_MAGIC_ASSERT( image, x11Image );
+
+     XLockDisplay( x11->display );
+
+     XFreeGC( x11->display, image->gc );
+     XFreePixmap( x11->display, image->pixmap );
+
+     XShmDetach( x11->display, &image->seginfo );
+
+     XDestroyImage( image->ximage );
+
+     XUnlockDisplay( x11->display );
+
+     shmdt( image->seginfo.shmaddr );
+
+     shmctl( image->seginfo.shmid, IPC_RMID, NULL );
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/systems/x11/x11image.h b/Source/DirectFB/systems/x11/x11image.h
new file mode 100755
index 0000000..3872ef7
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11image.h
@@ -0,0 +1,76 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __X11SYSTEM__X11IMAGE_H__
+#define __X11SYSTEM__X11IMAGE_H__
+
+#include <X11/Xlib.h>    /* fundamentals X datas structures */
+#include <X11/Xutil.h>   /* datas definitions for various functions */
+#include <X11/keysym.h>  /* for a perfect use of keyboard events */
+
+#include <X11/extensions/XShm.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include "x11types.h"
+
+
+typedef struct {
+     int                   magic;
+
+     int                   width;
+     int                   height;
+     DFBSurfacePixelFormat format;
+
+     int                   depth;
+     Visual*               visual;
+
+     XImage*               ximage;
+     int                   pitch;
+
+     XShmSegmentInfo       seginfo;
+
+     Pixmap                pixmap;
+     GC                    gc;
+} x11Image;
+
+
+DFBResult x11ImageInit   ( DFBX11                *x11,
+                           x11Image              *image,
+                           int                    width,
+                           int                    height,
+                           DFBSurfacePixelFormat  format );
+
+DFBResult x11ImageDestroy( DFBX11                *x11,
+                           x11Image              *image );
+
+DFBResult x11ImageAttach ( x11Image              *image,
+                           void                 **ret_addr );
+
+#endif /* __X11SYSTEM__X11IMAGE_H__ */
+
diff --git a/Source/DirectFB/systems/x11/x11input.c b/Source/DirectFB/systems/x11/x11input.c
new file mode 100755
index 0000000..0b711e0
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11input.c
@@ -0,0 +1,768 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <fusion/types.h>
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+#include <core/layer_context.h>
+#include <core/layer_control.h>
+#include <core/layers_internal.h>
+#include <core/system.h>
+
+#include <direct/mem.h>
+#include <direct/thread.h>
+
+#include "xwindow.h"
+
+#include "primary.h"
+#include "x11.h"
+
+#define DFB_INPUTDRIVER_HAS_SENSITIVITY
+
+#include <core/input_driver.h>
+
+D_DEBUG_DOMAIN( X11_Input, "X11/Input", "X11 Input/Key/Mouse handling" );
+
+DFB_INPUT_DRIVER( x11input )
+
+
+extern DFBX11 *dfb_x11;
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+     CoreInputDevice*    device;
+     DirectThread*       thread;
+     DFBX11*             x11;
+     bool                stop;
+} X11InputData;
+
+
+static DFBInputEvent motionX = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static DFBInputEvent motionY = {
+     .type    = DIET_UNKNOWN,
+     .axisabs = 0,
+};
+
+static void
+motion_compress( int x, int y, const XEvent *xEvent )
+{
+     if (motionX.axisabs != x) {
+          motionX.type    = DIET_AXISMOTION;
+          motionX.flags   = DIEF_AXISABS | DIEF_TIMESTAMP;
+          motionX.axis    = DIAI_X;
+          motionX.axisabs = x;
+
+          motionX.timestamp.tv_sec  =  xEvent->xmotion.time / 1000;
+          motionX.timestamp.tv_usec = (xEvent->xmotion.time % 1000) * 1000;
+     }
+
+     if (motionY.axisabs != y) {
+          motionY.type    = DIET_AXISMOTION;
+          motionY.flags   = DIEF_AXISABS | DIEF_TIMESTAMP;
+          motionY.axis    = DIAI_Y;
+          motionY.axisabs = y;
+
+          motionY.timestamp.tv_sec  =  xEvent->xmotion.time / 1000;
+          motionY.timestamp.tv_usec = (xEvent->xmotion.time % 1000) * 1000;
+     }
+}
+
+static void
+motion_realize( X11InputData *data )
+{
+     if (motionX.type != DIET_UNKNOWN) {
+          if (motionY.type != DIET_UNKNOWN)
+               motionX.flags |= DIEF_FOLLOW;
+
+          if (dfb_x11->shared->xw) {
+               motionX.flags |= DIEF_MIN | DIEF_MAX;
+               motionX.min    = 0;
+               motionX.max    = dfb_x11->shared->xw->width - 1;
+          }
+
+          dfb_input_dispatch( data->device, &motionX );
+
+          motionX.type = DIET_UNKNOWN;
+     }
+
+     if (motionY.type != DIET_UNKNOWN) {
+          if (dfb_x11->shared->xw) {
+               motionY.flags |= DIEF_MIN | DIEF_MAX;
+               motionY.min    = 0;
+               motionY.max    = dfb_x11->shared->xw->height - 1;
+          }
+
+          dfb_input_dispatch( data->device, &motionY );
+
+          motionY.type = DIET_UNKNOWN;
+     }
+}
+
+static DFBInputDeviceKeyIdentifier
+xsymbol_to_id( KeySym xKeySymbol )
+{
+     switch (xKeySymbol) {
+          case XK_a                : return DIKI_A;     
+          case XK_b                : return DIKI_B;     
+          case XK_c                : return DIKI_C;     
+          case XK_d                : return DIKI_D;     
+          case XK_e                : return DIKI_E;     
+          case XK_f                : return DIKI_F;     
+          case XK_g                : return DIKI_G;     
+          case XK_h                : return DIKI_H;     
+          case XK_i                : return DIKI_I;     
+          case XK_j                : return DIKI_J;     
+          case XK_k                : return DIKI_K;     
+          case XK_l                : return DIKI_L;     
+          case XK_m                : return DIKI_M;     
+          case XK_n                : return DIKI_N;     
+          case XK_o                : return DIKI_O;     
+          case XK_p                : return DIKI_P;     
+          case XK_q                : return DIKI_Q;     
+          case XK_r                : return DIKI_R;     
+          case XK_s                : return DIKI_S;     
+          case XK_t                : return DIKI_T;     
+          case XK_u                : return DIKI_U;     
+          case XK_v                : return DIKI_V;     
+          case XK_w                : return DIKI_W;     
+          case XK_x                : return DIKI_X;     
+          case XK_y                : return DIKI_Y;     
+          case XK_z                : return DIKI_Z;     
+          case XK_0                : return DIKI_0;     
+          case XK_1                : return DIKI_1;     
+          case XK_2                : return DIKI_2;     
+          case XK_3                : return DIKI_3;     
+          case XK_4                : return DIKI_4;     
+          case XK_5                : return DIKI_5;     
+          case XK_6                : return DIKI_6;     
+          case XK_7                : return DIKI_7;     
+          case XK_8                : return DIKI_8;     
+          case XK_9                : return DIKI_9;     
+          case XK_F1               : return DIKI_F1;    
+          case XK_F2               : return DIKI_F2;    
+          case XK_F3               : return DIKI_F3;    
+          case XK_F4               : return DIKI_F4;    
+          case XK_F5               : return DIKI_F5;    
+          case XK_F6               : return DIKI_F6;    
+          case XK_F7               : return DIKI_F7;    
+          case XK_F8               : return DIKI_F8;    
+          case XK_F9               : return DIKI_F9;    
+          case XK_F10              : return DIKI_F10;   
+          case XK_F11              : return DIKI_F11;   
+          case XK_F12              : return DIKI_F12;   
+
+          case XK_Shift_L          : return DIKI_SHIFT_L;     
+          case XK_Shift_R          : return DIKI_SHIFT_R;     
+          case XK_Control_L        : return DIKI_CONTROL_L;   
+          case XK_Control_R        : return DIKI_CONTROL_R;   
+          case XK_Alt_L            : return DIKI_ALT_L;       
+          case XK_Alt_R            : return DIKI_ALT_R;       
+          case XK_Meta_L           : return DIKI_META_L;      
+          case XK_Meta_R           : return DIKI_META_R;      
+          case XK_Super_L          : return DIKI_SUPER_L;     
+          case XK_Super_R          : return DIKI_SUPER_R;     
+          case XK_Hyper_L          : return DIKI_HYPER_L;     
+          case XK_Hyper_R          : return DIKI_HYPER_R;     
+          case XK_Mode_switch      : return DIKI_ALT_R;
+
+          case XK_Caps_Lock        : return DIKI_CAPS_LOCK;   
+          case XK_Num_Lock         : return DIKI_NUM_LOCK;    
+          case XK_Scroll_Lock      : return DIKI_SCROLL_LOCK; 
+
+          case XK_Escape           : return DIKI_ESCAPE;      
+          case XK_Left             : return DIKI_LEFT;        
+          case XK_Right            : return DIKI_RIGHT;       
+          case XK_Up               : return DIKI_UP;          
+          case XK_Down             : return DIKI_DOWN;        
+
+          case XK_Tab              : return DIKI_TAB;
+          case XK_ISO_Left_Tab     : return DIKI_TAB;
+          case XK_Return           : return DIKI_ENTER;       
+          case XK_space            : return DIKI_SPACE;       
+          case XK_BackSpace        : return DIKI_BACKSPACE;   
+          case XK_Insert           : return DIKI_INSERT;      
+          case XK_Delete           : return DIKI_DELETE;      
+          case XK_Home             : return DIKI_HOME;       
+          case XK_End              : return DIKI_END;        
+          case XK_Page_Up          : return DIKI_PAGE_UP;    
+          case XK_Page_Down        : return DIKI_PAGE_DOWN;  
+          case XK_Print            : return DIKI_PRINT;
+          case XK_Pause            : return DIKI_PAUSE;       
+
+          /*  The labels on these keys depend on the type of keyboard.
+           *  We've choosen the names from a US keyboard layout. The
+           *  comments refer to the ISO 9995 terminology.
+           */
+          case XK_quoteleft        : return DIKI_QUOTE_LEFT;   /*  TLDE  */
+          case XK_minus            : return DIKI_MINUS_SIGN;   /*  AE11  */
+          case XK_equal            : return DIKI_EQUALS_SIGN;  /*  AE12  */
+          case XK_bracketleft      : return DIKI_BRACKET_LEFT; /*  AD11  */
+          case XK_bracketright     : return DIKI_BRACKET_RIGHT;/*  AD12  */
+          case XK_backslash        : return DIKI_BACKSLASH;    /*  BKSL  */
+          case XK_semicolon        : return DIKI_SEMICOLON;    /*  AC10  */
+          case XK_quoteright       : return DIKI_QUOTE_RIGHT;  /*  AC11  */
+          case XK_comma            : return DIKI_COMMA;        /*  AB08  */
+          case XK_period           : return DIKI_PERIOD;       /*  AB09  */
+          case XK_slash            : return DIKI_SLASH;        /*  AB10  */
+          case XK_less             : return DIKI_LESS_SIGN;    /*  103rd  */
+
+          case XK_KP_Divide        : return DIKI_KP_DIV;      
+          case XK_KP_Multiply      : return DIKI_KP_MULT;     
+          case XK_KP_Subtract      : return DIKI_KP_MINUS;    
+          case XK_KP_Add           : return DIKI_KP_PLUS;     
+          case XK_KP_Enter         : return DIKI_KP_ENTER;    
+          case XK_KP_Space         : return DIKI_KP_SPACE;    
+          case XK_KP_Tab           : return DIKI_KP_TAB;      
+          case XK_KP_F1            : return DIKI_KP_F1;       
+          case XK_KP_F2            : return DIKI_KP_F2;       
+          case XK_KP_F3            : return DIKI_KP_F3;       
+          case XK_KP_F4            : return DIKI_KP_F4;       
+          case XK_KP_Equal         : return DIKI_KP_EQUAL;    
+          case XK_KP_Separator     : return DIKI_KP_SEPARATOR;
+                                   
+          case XK_KP_Delete        : return DIKI_KP_DECIMAL;
+          case XK_KP_Insert        : return DIKI_KP_0;      
+          case XK_KP_End           : return DIKI_KP_1;      
+          case XK_KP_Down          : return DIKI_KP_2;      
+          case XK_KP_Page_Down     : return DIKI_KP_3;      
+          case XK_KP_Left          : return DIKI_KP_4;      
+          case XK_KP_Begin         : return DIKI_KP_5;      
+          case XK_KP_Right         : return DIKI_KP_6;      
+          case XK_KP_Home          : return DIKI_KP_7;      
+          case XK_KP_Up            : return DIKI_KP_8;      
+          case XK_KP_Page_Up       : return DIKI_KP_9;
+
+          case XK_KP_Decimal       : return DIKI_KP_DECIMAL;
+          case XK_KP_0             : return DIKI_KP_0;      
+          case XK_KP_1             : return DIKI_KP_1;      
+          case XK_KP_2             : return DIKI_KP_2;      
+          case XK_KP_3             : return DIKI_KP_3;      
+          case XK_KP_4             : return DIKI_KP_4;      
+          case XK_KP_5             : return DIKI_KP_5;      
+          case XK_KP_6             : return DIKI_KP_6;      
+          case XK_KP_7             : return DIKI_KP_7;      
+          case XK_KP_8             : return DIKI_KP_8;      
+          case XK_KP_9             : return DIKI_KP_9;
+
+          case 0                   : break;
+
+          default:
+               D_DEBUG_AT( X11_Input, "Unknown key symbol 0x%lx\n", xKeySymbol);
+     }    
+
+     return DIKI_UNKNOWN;
+}
+
+static DFBInputDeviceKeySymbol
+xsymbol_to_symbol( KeySym xKeySymbol )
+{
+     if (xKeySymbol >= 0x20 && xKeySymbol <= 0xff)
+          return xKeySymbol;
+
+     if (xKeySymbol >= XK_F1 && xKeySymbol <= XK_F35)
+          return DFB_FUNCTION_KEY( xKeySymbol - XK_F1 + 1 );
+
+     switch (xKeySymbol) {
+          case XK_Shift_L          : return DIKS_SHIFT;
+          case XK_Shift_R          : return DIKS_SHIFT;     
+          case XK_Control_L        : return DIKS_CONTROL;   
+          case XK_Control_R        : return DIKS_CONTROL;   
+          case XK_Alt_L            : return DIKS_ALT;       
+          case XK_Alt_R            : return DIKS_ALT;       
+          case XK_Meta_L           : return DIKS_META;      
+          case XK_Meta_R           : return DIKS_META;      
+          case XK_Super_L          : return DIKS_SUPER;     
+          case XK_Super_R          : return DIKS_SUPER;     
+          case XK_Hyper_L          : return DIKS_HYPER;     
+          case XK_Hyper_R          : return DIKS_HYPER;     
+          case XK_Mode_switch      : return DIKS_ALTGR;
+
+          case XK_Caps_Lock        : return DIKS_CAPS_LOCK;   
+          case XK_Num_Lock         : return DIKS_NUM_LOCK;    
+          case XK_Scroll_Lock      : return DIKS_SCROLL_LOCK; 
+
+          case XK_Escape           : return DIKS_ESCAPE;      
+          case XK_Left             : return DIKS_CURSOR_LEFT;
+          case XK_Right            : return DIKS_CURSOR_RIGHT;       
+          case XK_Up               : return DIKS_CURSOR_UP;          
+          case XK_Down             : return DIKS_CURSOR_DOWN;        
+
+          case XK_Tab              : return DIKS_TAB;
+          case XK_ISO_Left_Tab     : return DIKS_TAB;
+          case XK_Return           : return DIKS_ENTER;       
+          case XK_space            : return DIKS_SPACE;       
+          case XK_BackSpace        : return DIKS_BACKSPACE;   
+          case XK_Insert           : return DIKS_INSERT;      
+          case XK_Delete           : return DIKS_DELETE;      
+          case XK_Home             : return DIKS_HOME;       
+          case XK_End              : return DIKS_END;        
+          case XK_Page_Up          : return DIKS_PAGE_UP;    
+          case XK_Page_Down        : return DIKS_PAGE_DOWN;  
+          case XK_Print            : return DIKS_PRINT;
+          case XK_Pause            : return DIKS_PAUSE;       
+
+          case XK_KP_Divide        : return DIKS_SLASH;
+          case XK_KP_Multiply      : return DIKS_ASTERISK;     
+          case XK_KP_Subtract      : return DIKS_MINUS_SIGN;    
+          case XK_KP_Add           : return DIKS_PLUS_SIGN;     
+          case XK_KP_Enter         : return DIKS_ENTER;    
+          case XK_KP_Space         : return DIKS_SPACE;    
+          case XK_KP_Tab           : return DIKS_TAB;      
+          case XK_KP_F1            : return DIKS_F1;       
+          case XK_KP_F2            : return DIKS_F2;       
+          case XK_KP_F3            : return DIKS_F3;       
+          case XK_KP_F4            : return DIKS_F4;       
+          case XK_KP_Equal         : return DIKS_EQUALS_SIGN;    
+          case XK_KP_Separator     : return DIKS_COLON; /* FIXME: what is a separator */
+                                   
+          case XK_KP_Delete        : return DIKS_DELETE;
+          case XK_KP_Insert        : return DIKS_INSERT;      
+          case XK_KP_End           : return DIKS_END;      
+          case XK_KP_Down          : return DIKS_CURSOR_DOWN;      
+          case XK_KP_Page_Down     : return DIKS_PAGE_DOWN;      
+          case XK_KP_Left          : return DIKS_CURSOR_LEFT;      
+          case XK_KP_Begin         : return DIKS_BEGIN;      
+          case XK_KP_Right         : return DIKS_CURSOR_RIGHT;      
+          case XK_KP_Home          : return DIKS_HOME;      
+          case XK_KP_Up            : return DIKS_CURSOR_UP;      
+          case XK_KP_Page_Up       : return DIKS_PAGE_UP;
+
+          case XK_KP_Decimal       : return DIKS_PERIOD;
+          case XK_KP_0             : return DIKS_0;      
+          case XK_KP_1             : return DIKS_1;      
+          case XK_KP_2             : return DIKS_2;      
+          case XK_KP_3             : return DIKS_3;      
+          case XK_KP_4             : return DIKS_4;      
+          case XK_KP_5             : return DIKS_5;      
+          case XK_KP_6             : return DIKS_6;      
+          case XK_KP_7             : return DIKS_7;      
+          case XK_KP_8             : return DIKS_8;      
+          case XK_KP_9             : return DIKS_9;
+
+          case 0                   : break;
+
+          default:
+               D_DEBUG("X11: Unknown key symbol 0x%lx\n", xKeySymbol);
+     }    
+
+     return DIKS_NULL;
+}
+
+
+
+static void handleMouseEvent(XEvent* pXEvent, X11InputData* pData)
+{
+     static int          iMouseEventCount = 0;
+     DFBInputEvent  dfbEvent;
+     if (pXEvent->type == MotionNotify) {
+          motion_compress( pXEvent->xmotion.x, pXEvent->xmotion.y, pXEvent );
+          ++iMouseEventCount;
+     }
+
+     if ( pXEvent->type == ButtonPress || pXEvent->type == ButtonRelease ) {
+          if ( pXEvent->type == ButtonPress )
+               dfbEvent.type = DIET_BUTTONPRESS;
+          else
+               dfbEvent.type = DIET_BUTTONRELEASE;
+
+          dfbEvent.flags = DIEF_TIMESTAMP;
+
+          /* Get pressed button */
+          switch ( pXEvent->xbutton.button ) {
+               case 1:
+                    dfbEvent.button = DIBI_LEFT;
+                    break;
+               case 2:
+                    dfbEvent.button = DIBI_MIDDLE;
+                    break;
+               case 3:
+                    dfbEvent.button = DIBI_RIGHT;
+                    break;
+                    //Wheel events
+               case 4: /*up*/
+               case 5: /*down*/
+               case 6: /*left*/
+               case 7: /*right*/
+                    if (pXEvent->type == ButtonPress) {
+                         dfbEvent.type = DIET_AXISMOTION;
+                         dfbEvent.flags = DIEF_AXISREL;
+                         dfbEvent.axis = DIAI_Z;
+                         /*SCROLL UP*/
+                         if ( pXEvent->xbutton.button == 4 ) {
+                              dfbEvent.axisrel = -1;
+                         }
+                         /*SCROLL DOWN */
+                         else if (pXEvent->xbutton.button == 5) {
+                              dfbEvent.axisrel = 1;
+                         }
+                         /*SCROLL LEFT*/
+                         else if (pXEvent->xbutton.button == 6) {
+                              dfbEvent.axis = DIAI_X;
+                              dfbEvent.axisrel = -1;
+                         }
+                         /*SCROLL RIGHT*/
+                         else if (pXEvent->xbutton.button == 7 ) {
+                              dfbEvent.axis = DIAI_X;
+                              dfbEvent.axisrel = 1;
+                         }
+                    }
+                    else
+                         return;
+                    break;
+               default:
+                    break;
+          }
+
+          dfbEvent.timestamp.tv_sec  =  pXEvent->xbutton.time / 1000;
+          dfbEvent.timestamp.tv_usec = (pXEvent->xbutton.time % 1000) * 1000;
+
+          dfb_input_dispatch( pData->device, &dfbEvent );
+          ++iMouseEventCount;
+     }
+}
+
+static void
+handle_expose( const XExposeEvent *expose )
+{
+     CoreLayer               *layer = dfb_layer_at( DLID_PRIMARY );
+     const DisplayLayerFuncs *funcs = layer->funcs;
+     CoreLayerContext        *context;
+
+     D_ASSERT( funcs != NULL );
+     D_ASSERT( funcs->UpdateRegion != NULL );
+
+     /* Get the currently active context. */
+     if (dfb_layer_get_active_context( layer, &context ) == DFB_OK) {
+          CoreLayerRegion *region;
+
+          /* Get the first region. */
+          if (dfb_layer_context_get_primary_region( context,
+                                                    false, ®ion ) == DFB_OK)
+          {
+               /* Lock the region to avoid tearing due to concurrent updates. */
+               dfb_layer_region_lock( region );
+
+               /* Get the surface of the region. */
+               if (region->surface && region->surface_lock.buffer) {
+                    DFBRegion update = { expose->x, expose->y,
+                                         expose->x + expose->width  - 1,
+                                         expose->y + expose->height - 1 };
+
+                    funcs->UpdateRegion( layer, layer->driver_data, layer->layer_data,
+                                         region->region_data, region->surface, &update, ®ion->surface_lock );
+               }
+
+               /* Unlock the region. */
+               dfb_layer_region_unlock( region );
+
+               /* Release the region. */
+               dfb_layer_region_unref( region );
+          }
+
+          /* Release the context. */
+          dfb_layer_context_unref( context );
+     }
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+x11EventThread( DirectThread *thread, void *driver_data )
+{
+     X11InputData *data   = driver_data;
+     DFBX11       *x11    = data->x11;
+     DFBX11Shared *shared = x11->shared;
+
+     while (!data->stop) {
+          unsigned int  pull = 23;
+          XEvent        xEvent; 
+          DFBInputEvent dfbEvent;
+
+          /* FIXME: Detect key repeats, we're receiving KeyPress, KeyRelease, KeyPress, KeyRelease... !!?? */
+
+          if (!shared->xw || !shared->xw->window) {
+               /* no window, so no event */
+               usleep( 50000 );
+               continue;
+          }
+
+          usleep( 10000 );
+
+          XLockDisplay( x11->display );
+
+          while (!data->stop && pull-- && XPending( x11->display )) {
+               XNextEvent( x11->display, &xEvent );
+
+               XUnlockDisplay( x11->display );
+
+               D_DEBUG_AT( X11_Input, "Event received: %d\n", xEvent.type );
+
+               switch (xEvent.type) {
+                    case ButtonPress:
+                    case ButtonRelease:
+                         motion_realize( data );
+                    case MotionNotify:
+                         handleMouseEvent( &xEvent, data ); // crash ???
+                         break;
+
+                    case KeyPress:
+                    case KeyRelease: {
+                         motion_realize( data );
+
+                         dfbEvent.type     = (xEvent.type == KeyPress) ? DIET_KEYPRESS : DIET_KEYRELEASE;
+                         dfbEvent.flags    = DIEF_KEYCODE | DIEF_TIMESTAMP;
+                         dfbEvent.key_code = xEvent.xkey.keycode;
+
+                         dfbEvent.timestamp.tv_sec  =  xEvent.xkey.time / 1000;
+                         dfbEvent.timestamp.tv_usec = (xEvent.xkey.time % 1000) * 1000;
+
+                         dfb_input_dispatch( data->device, &dfbEvent );
+                         break;
+                    }
+
+                    case Expose:
+                         handle_expose( &xEvent.xexpose );
+                         break;
+
+                    case DestroyNotify:
+                         /* this event is mainly to unblock XNextEvent. */
+                         break;
+
+                    default:
+                         break;
+               }
+
+               XLockDisplay( x11->display );
+          }
+
+          XUnlockDisplay( x11->display );
+
+          if (!data->stop)
+               motion_realize( data );
+     }
+
+     return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+     return dfb_system_type() == CORE_X11;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+     /* fill driver info structure */
+     snprintf ( info->name,   DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "X11 Input Driver" );
+     snprintf ( info->vendor, DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "directfb.org" );
+
+     info->version.major = 0;
+     info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice  *device,
+                    unsigned int      number,
+                    InputDeviceInfo  *info,
+                    void            **driver_data )
+{
+     X11InputData *data;
+     DFBX11       *x11    = dfb_system_data();
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Input, "%s()\n", __FUNCTION__ );
+
+     fusion_skirmish_prevail( &shared->lock );
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     /* set device vendor and name */
+     snprintf( info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "XServer" );
+     snprintf( info->desc.name,   DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "X11 Input" );
+
+     /* set one of the primary input device IDs */
+     info->prefered_id = DIDID_KEYBOARD;
+
+     /* set type flags */
+     info->desc.type   = DIDTF_JOYSTICK | DIDTF_KEYBOARD | DIDTF_MOUSE;
+
+     /* set capabilities */
+     info->desc.caps   = DICAPS_ALL;
+
+     /* enable translation of fake raw hardware keycodes */
+     info->desc.min_keycode = 8;
+     info->desc.max_keycode = 255;
+
+
+     /* allocate and fill private data */
+     data = D_CALLOC( 1, sizeof(X11InputData) );
+
+     data->device = device;
+     data->x11    = x11;
+
+     /* start input thread */
+     data->thread = direct_thread_create( DTT_INPUT, x11EventThread, data, "X11 Input" );
+
+     /* set private data pointer */
+     *driver_data = data;
+
+     return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ * this does a fake mapping based on the orginal DFB code
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice           *device,
+                         void                      *driver_data,
+                         DFBInputDeviceKeymapEntry *entry )
+{
+     int           i;
+     X11InputData *data = driver_data;
+     DFBX11       *x11  = data->x11;
+
+     XLockDisplay( x11->display );
+
+     for (i=0; i<4; i++) {
+          KeySym xSymbol = XKeycodeToKeysym( x11->display, entry->code, i );
+
+          if (i == 0)
+               entry->identifier = xsymbol_to_id( xSymbol );
+
+          entry->symbols[i] = xsymbol_to_symbol( xSymbol );
+     }
+
+     XUnlockDisplay( x11->display );
+
+     /* is CapsLock effective? */
+     if (entry->identifier >= DIKI_A && entry->identifier <= DIKI_Z)
+          entry->locks |= DILS_CAPS;
+
+     /* is NumLock effective? */
+     if (entry->identifier >= DIKI_KP_DECIMAL && entry->identifier <= DIKI_KP_9)
+          entry->locks |= DILS_NUM;
+
+     return DFB_OK;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static DFBResult
+driver_set_sensitivity( CoreInputDevice           *device,
+                        void                      *driver_data,
+                        int                        sensitivity )
+{
+     D_DEBUG_AT( X11_Input, "%s( %d )\n", __FUNCTION__, sensitivity );
+
+     return DFB_OK;
+}
+
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+     X11InputData *data   = driver_data;
+     DFBX11       *x11    = data->x11;
+     DFBX11Shared *shared = x11->shared;
+
+     D_DEBUG_AT( X11_Input, "%s()\n", __FUNCTION__ );
+
+     /* stop input thread */
+     data->stop = true;
+
+     XLockDisplay( x11->display );
+
+     if (shared->xw) {
+          XWindow *xw = shared->xw;
+
+          shared->xw = NULL;
+
+          /* the window must generate an event, otherwise the input thread will not end */
+          dfb_x11_close_window( x11, xw );
+     }
+
+     XSync( x11->display, False );
+
+     XUnlockDisplay( x11->display );
+
+     /* it is possible that this "close" function is called from the same
+      * thread that the input device is actually running on.
+      * This happens when you e.g. click the close box with your mouse.
+      * As a fix, we check if we are this thread. */
+     if (data->thread != direct_thread_self()) {
+          direct_thread_join( data->thread );
+          direct_thread_destroy( data->thread );
+     }
+
+     /* free private data */
+     D_FREE ( data );
+}
+
diff --git a/Source/DirectFB/systems/x11/x11types.h b/Source/DirectFB/systems/x11/x11types.h
new file mode 100755
index 0000000..872f9db
--- /dev/null
+++ b/Source/DirectFB/systems/x11/x11types.h
@@ -0,0 +1,35 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SYSTEMS_X11TYPES_H__
+#define __SYSTEMS_X11TYPES_H__
+
+typedef struct __DFB_X11 DFBX11;
+
+#endif /* __SYSTEMS_X11TYPES_H__ */
+
diff --git a/Source/DirectFB/systems/x11/xwindow.c b/Source/DirectFB/systems/x11/xwindow.c
new file mode 100755
index 0000000..ce5e1fe
--- /dev/null
+++ b/Source/DirectFB/systems/x11/xwindow.c
@@ -0,0 +1,294 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <directfb_util.h>
+
+#include <direct/mem.h>
+
+#include "x11.h"
+
+D_DEBUG_DOMAIN( X11_Window, "X11/Window", "X11 Window handling" );
+
+static bool use_shm = true;
+
+static int
+error_handler_shm( Display *display, XErrorEvent *event )
+{
+     if (use_shm) {
+          D_INFO( "X11/Display: Error! Disabling XShm.\n" );
+
+          use_shm = false;
+     }
+
+     return 0;
+}
+
+
+static int error_code = 0;
+
+static int
+error_handler( Display *display, XErrorEvent *event )
+{
+     char buf[512];
+
+     D_DEBUG_AT( X11_Window, "%s()\n", __FUNCTION__ );
+
+     XGetErrorText( display, event->error_code, buf, sizeof(buf) );
+
+     D_ERROR( "X11/Window: Error! %s\n", buf );
+
+     error_code = event->error_code;
+
+     return 0;
+}
+
+Bool
+dfb_x11_open_window( DFBX11 *x11, XWindow** ppXW, int iXPos, int iYPos, int iWidth, int iHeight, DFBSurfacePixelFormat format )
+{
+     XWindow              *xw;
+     XSetWindowAttributes  attr = { .background_pixmap = 0 };
+
+     D_DEBUG_AT( X11_Window, "Creating %4dx%4d %s window...\n", iWidth, iHeight, dfb_pixelformat_name(format) );
+
+     xw = D_CALLOC( 1, sizeof(XWindow) );
+     if (!xw)
+          return D_OOM();
+
+     /* We set the structure as needed for our window */
+     xw->width   = iWidth;
+     xw->height  = iHeight;
+     xw->display = x11->display;
+
+     xw->screenptr = DefaultScreenOfDisplay(xw->display);
+     xw->screennum = DefaultScreen(xw->display);
+     xw->depth     = DefaultDepthOfScreen(xw->screenptr);
+     xw->visual    = DefaultVisualOfScreen(xw->screenptr);
+
+     attr.event_mask = 
+            ButtonPressMask
+          | ButtonReleaseMask
+          | PointerMotionMask
+          | KeyPressMask
+          | KeyReleaseMask
+          | ExposureMask
+          | StructureNotifyMask;
+
+     XLockDisplay( x11->display );
+
+     XSetErrorHandler( error_handler );
+
+     error_code = 0;
+
+     xw->window = XCreateWindow( xw->display,
+                                 RootWindowOfScreen(xw->screenptr),
+                                 iXPos, iYPos, iWidth, iHeight, 0, xw->depth, InputOutput,
+                                 xw->visual, CWEventMask, &attr );
+     XSync( xw->display, False );
+     if (!xw->window || error_code) {
+          D_FREE( xw );
+          XUnlockDisplay( x11->display );
+          return False;
+     }
+
+
+     XSizeHints Hints;
+
+     /*
+      * Here we inform the function of what we are going to change for the
+      * window (there's also PPosition but it's obsolete)
+      */
+     Hints.flags    =    PSize | PMinSize | PMaxSize;
+
+     /*
+      * Now we set the structure to the values we need for width & height.
+      * For esthetic reasons we set Width=MinWidth=MaxWidth.
+      * The same goes for Height. You can try whith differents values, or
+      * let's use Hints.flags=Psize; and resize your window..
+      */
+     Hints.min_width          =    Hints.max_width          =    Hints.base_width    =    xw->width;
+     Hints.min_height    =    Hints.max_height    =    Hints.base_height   =    xw->height;
+
+     /* Now we can set the size hints for the specified window */
+     XSetWMNormalHints(xw->display,xw->window,&Hints);
+
+     /* We change the title of the window (default:Untitled) */
+     XStoreName(xw->display,xw->window,"DFB X11 system window");
+
+     xw->gc = XCreateGC(xw->display, xw->window, 0, NULL);
+
+     // Create a null cursor
+     XColor  fore;
+     XColor  back;
+     char    zero = 0;
+
+     xw->pixmp1     = XCreateBitmapFromData( xw->display, xw->window, &zero, 1, 1 );
+     xw->pixmp2     = XCreateBitmapFromData( xw->display, xw->window, &zero, 1, 1 );
+
+     xw->NullCursor = XCreatePixmapCursor( xw->display, xw->pixmp1, xw->pixmp2, &fore, &back, 0, 0 );
+
+     XDefineCursor( xw->display, xw->window, xw->NullCursor );
+
+
+     /* maps the window and raises it to the top of the stack */
+     XMapRaised( xw->display, xw->window );
+
+
+     if (x11->use_shm) {
+          // Shared memory 	
+          xw->shmseginfo=(XShmSegmentInfo *)D_CALLOC(1, sizeof(XShmSegmentInfo));
+          if (!xw->shmseginfo) {
+               x11->use_shm = false;
+               goto no_shm;
+          }
+
+          xw->ximage=XShmCreateImage(xw->display, xw->visual, xw->depth, ZPixmap,
+                                     NULL,xw->shmseginfo, xw->width, xw->height * 2);
+          XSync( xw->display, False );
+          if (!xw->ximage || error_code) {
+               D_ERROR("X11: Error creating shared image (XShmCreateImage) \n");
+               x11->use_shm = false;
+               D_FREE(xw->shmseginfo);
+               error_code = 0;
+               goto no_shm;
+          }
+
+          xw->bpp = (xw->ximage->bits_per_pixel + 7) / 8;
+
+          /* we firstly create our shared memory segment with the size we need, and
+          correct permissions for the owner, the group and the world --> 0777 */
+          xw->shmseginfo->shmid=shmget(IPC_PRIVATE, 
+                                       xw->ximage->bytes_per_line * xw->ximage->height * 2,
+                                       IPC_CREAT|0777);
+
+          if (xw->shmseginfo->shmid<0) {
+               x11->use_shm = false;
+               XDestroyImage(xw->ximage);
+               D_FREE(xw->shmseginfo);
+               goto no_shm;
+          }
+
+          /* Then, we have to attach the segment to our process, and we let the
+          function search the correct memory place --> NULL. It's safest ! */
+          xw->shmseginfo->shmaddr = shmat( xw->shmseginfo->shmid, NULL, 0 );
+          if (!xw->shmseginfo->shmaddr) {
+               x11->use_shm = false;
+               shmctl(xw->shmseginfo->shmid,IPC_RMID,NULL);
+               XDestroyImage(xw->ximage);
+               D_FREE(xw->shmseginfo);
+               goto no_shm;
+          }
+
+          /* We set the buffer in Read and Write mode */
+          xw->shmseginfo->readOnly=False;
+
+          xw->virtualscreen= xw->ximage->data = xw->shmseginfo->shmaddr;
+
+
+          XSetErrorHandler( error_handler_shm );
+
+          XShmAttach(x11->display,xw->shmseginfo);
+
+          XShmPutImage(x11->display, xw->window, xw->gc, xw->ximage,
+                       0, 0, 0, 0, 1, 1, False);
+
+          XSync(x11->display, False);
+
+          XSetErrorHandler( error_handler );
+
+          if (!x11->use_shm) {
+               shmdt(xw->shmseginfo->shmaddr);
+               shmctl(xw->shmseginfo->shmid,IPC_RMID,NULL);
+               XDestroyImage(xw->ximage);
+               D_FREE(xw->shmseginfo);
+          }
+     }
+
+no_shm:
+     if (!x11->use_shm) {
+          int pitch;
+
+          xw->bpp = (xw->depth > 16) ? 4 :
+                    (xw->depth >  8) ? 2 : 1;
+
+          pitch = (xw->bpp * xw->width + 3) & ~3;
+
+          /* Use malloc(), not D_MALLOC() here, because XCreateImage()
+           * will call free() on this data.
+           */
+          xw->virtualscreen = malloc ( 2 * xw->height * pitch );
+
+          xw->ximage = XCreateImage( xw->display, xw->visual, xw->depth, ZPixmap, 0,
+                                     xw->virtualscreen, xw->width, xw->height * 2, 32, pitch );
+          XSync( xw->display, False );
+          if (!xw->ximage || error_code) {
+               D_ERROR( "X11/Window: XCreateImage( Visual %02lu, depth %d, size %dx%d, buffer %p [%d] ) failed!\n",
+                        xw->visual->visualid, xw->depth, xw->width, xw->height * 2, xw->virtualscreen, pitch );
+               XFreeGC(xw->display,xw->gc);
+               XDestroyWindow(xw->display,xw->window);
+               XSetErrorHandler( NULL );
+               XUnlockDisplay( x11->display );
+               D_FREE( xw );
+               return False;
+          }
+     }
+
+     XSetErrorHandler( NULL );
+
+     XUnlockDisplay( x11->display );
+
+     D_INFO( "X11/Display: %ssing XShm.\n", x11->use_shm ? "U" : "Not u" );
+
+     (*ppXW) = xw;
+
+     return True;
+}
+
+void
+dfb_x11_close_window( DFBX11 *x11, XWindow* xw )
+{
+     if (x11->use_shm) {
+          XShmDetach(xw->display, xw->shmseginfo);
+          shmdt(xw->shmseginfo->shmaddr);
+          shmctl(xw->shmseginfo->shmid,IPC_RMID,NULL);
+          D_FREE(xw->shmseginfo);
+     }
+
+     XDestroyImage(xw->ximage);
+
+     XFreeGC(xw->display,xw->gc);
+     XDestroyWindow(xw->display,xw->window);
+
+     D_FREE(xw);
+}
+
diff --git a/Source/DirectFB/systems/x11/xwindow.h b/Source/DirectFB/systems/x11/xwindow.h
new file mode 100755
index 0000000..9eddfd7
--- /dev/null
+++ b/Source/DirectFB/systems/x11/xwindow.h
@@ -0,0 +1,77 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.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 __SYSTEMS_XWINDOW_H__
+#define __SYSTEMS_XWINDOW_H__
+
+#include <X11/Xlib.h>    /* fundamentals X datas structures */
+#include <X11/Xutil.h>   /* datas definitions for various functions */
+#include <X11/keysym.h>  /* for a perfect use of keyboard events */
+
+#include <X11/extensions/XShm.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include "x11types.h"
+
+
+typedef struct {
+     Display*            display;
+     Window              window;
+     Screen*             screenptr;
+     int                 screennum;
+     Visual*             visual;
+     GC                  gc;
+     XImage*             ximage;
+     int                 ximage_offset;
+     Colormap            colormap;
+
+     XShmSegmentInfo*    shmseginfo;
+     unsigned char*      videomemory;
+
+     char*               virtualscreen;
+     int                 videoaccesstype;
+
+     int                 width;
+     int                 height;
+     int                 depth;
+     int                 bpp;
+
+     /* (Null) cursor stuff*/
+     Pixmap              pixmp1;
+     Pixmap              pixmp2;
+     Cursor              NullCursor;
+} XWindow;
+
+Bool dfb_x11_open_window ( DFBX11 *x11, XWindow** ppXW, int iXPos, int iYPos, int iWidth, int iHeight, DFBSurfacePixelFormat format );
+void dfb_x11_close_window( DFBX11 *x11, XWindow* pXW );
+
+
+
+#endif /* __SYSTEMS_XWINDOW_H__ */
+
diff --git a/Source/DirectFB/tests/Makefile.am b/Source/DirectFB/tests/Makefile.am
new file mode 100755
index 0000000..ce41711
--- /dev/null
+++ b/Source/DirectFB/tests/Makefile.am
@@ -0,0 +1,58 @@
+## Makefile.am for DirectFB/tests
+
+INCLUDES = \
+	-I$(top_builddir)/lib \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-DLINUX_2_6
+
+
+noinst_PROGRAMS = \
+	dfbtest_blit	\
+	dfbtest_reinit	\
+	dfbtest_scale	\
+	dfbtest_window	\
+	direct_stream	\
+	direct_test	\
+	fusion_fork	\
+	fusion_reactor	\
+	fusion_skirmish	\
+	fusion_stream
+
+libdirectfb = $(top_builddir)/src/libdirectfb.la
+libfusion = $(top_builddir)/lib/fusion/libfusion.la
+libdirect = $(top_builddir)/lib/direct/libdirect.la
+
+dfbtest_blit_SOURCES = dfbtest_blit.c
+dfbtest_blit_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+dfbtest_reinit_SOURCES = dfbtest_reinit.c
+dfbtest_reinit_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+dfbtest_scale_SOURCES = dfbtest_scale.c
+dfbtest_scale_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+dfbtest_window_SOURCES = dfbtest_window.c
+dfbtest_window_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+
+direct_stream_SOURCES = direct_stream.c
+direct_stream_LDADD   = $(libdirect)
+
+direct_test_SOURCES = direct_test.c
+direct_test_LDADD   = $(libdirect)
+
+
+fusion_fork_SOURCES = fusion_fork.c
+fusion_fork_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+fusion_reactor_SOURCES = fusion_reactor.c
+fusion_reactor_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+fusion_skirmish_SOURCES = fusion_skirmish.c
+fusion_skirmish_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
+
+fusion_stream_SOURCES = fusion_stream.c
+fusion_stream_LDADD   = $(libdirectfb) $(libfusion) $(libdirect)
diff --git a/Source/DirectFB/tests/Makefile.in b/Source/DirectFB/tests/Makefile.in
new file mode 100755
index 0000000..a64dd81
--- /dev/null
+++ b/Source/DirectFB/tests/Makefile.in
@@ -0,0 +1,612 @@
+# 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@
+noinst_PROGRAMS = dfbtest_blit$(EXEEXT) dfbtest_reinit$(EXEEXT) \
+	dfbtest_scale$(EXEEXT) dfbtest_window$(EXEEXT) \
+	direct_stream$(EXEEXT) direct_test$(EXEEXT) \
+	fusion_fork$(EXEEXT) fusion_reactor$(EXEEXT) \
+	fusion_skirmish$(EXEEXT) fusion_stream$(EXEEXT)
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+PROGRAMS = $(noinst_PROGRAMS)
+am_dfbtest_blit_OBJECTS = dfbtest_blit.$(OBJEXT)
+dfbtest_blit_OBJECTS = $(am_dfbtest_blit_OBJECTS)
+dfbtest_blit_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_dfbtest_reinit_OBJECTS = dfbtest_reinit.$(OBJEXT)
+dfbtest_reinit_OBJECTS = $(am_dfbtest_reinit_OBJECTS)
+dfbtest_reinit_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_dfbtest_scale_OBJECTS = dfbtest_scale.$(OBJEXT)
+dfbtest_scale_OBJECTS = $(am_dfbtest_scale_OBJECTS)
+dfbtest_scale_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_dfbtest_window_OBJECTS = dfbtest_window.$(OBJEXT)
+dfbtest_window_OBJECTS = $(am_dfbtest_window_OBJECTS)
+dfbtest_window_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_direct_stream_OBJECTS = direct_stream.$(OBJEXT)
+direct_stream_OBJECTS = $(am_direct_stream_OBJECTS)
+direct_stream_DEPENDENCIES = $(libdirect)
+am_direct_test_OBJECTS = direct_test.$(OBJEXT)
+direct_test_OBJECTS = $(am_direct_test_OBJECTS)
+direct_test_DEPENDENCIES = $(libdirect)
+am_fusion_fork_OBJECTS = fusion_fork.$(OBJEXT)
+fusion_fork_OBJECTS = $(am_fusion_fork_OBJECTS)
+fusion_fork_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_fusion_reactor_OBJECTS = fusion_reactor.$(OBJEXT)
+fusion_reactor_OBJECTS = $(am_fusion_reactor_OBJECTS)
+fusion_reactor_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+am_fusion_skirmish_OBJECTS = fusion_skirmish.$(OBJEXT)
+fusion_skirmish_OBJECTS = $(am_fusion_skirmish_OBJECTS)
+fusion_skirmish_DEPENDENCIES = $(libdirectfb) $(libfusion) \
+	$(libdirect)
+am_fusion_stream_OBJECTS = fusion_stream.$(OBJEXT)
+fusion_stream_OBJECTS = $(am_fusion_stream_OBJECTS)
+fusion_stream_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libdirect)
+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 = $(dfbtest_blit_SOURCES) $(dfbtest_reinit_SOURCES) \
+	$(dfbtest_scale_SOURCES) $(dfbtest_window_SOURCES) \
+	$(direct_stream_SOURCES) $(direct_test_SOURCES) \
+	$(fusion_fork_SOURCES) $(fusion_reactor_SOURCES) \
+	$(fusion_skirmish_SOURCES) $(fusion_stream_SOURCES)
+DIST_SOURCES = $(dfbtest_blit_SOURCES) $(dfbtest_reinit_SOURCES) \
+	$(dfbtest_scale_SOURCES) $(dfbtest_window_SOURCES) \
+	$(direct_stream_SOURCES) $(direct_test_SOURCES) \
+	$(fusion_fork_SOURCES) $(fusion_reactor_SOURCES) \
+	$(fusion_skirmish_SOURCES) $(fusion_stream_SOURCES)
+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)/lib \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src	\
+	-DLINUX_2_6
+
+libdirectfb = $(top_builddir)/src/libdirectfb.la
+libfusion = $(top_builddir)/lib/fusion/libfusion.la
+libdirect = $(top_builddir)/lib/direct/libdirect.la
+dfbtest_blit_SOURCES = dfbtest_blit.c
+dfbtest_blit_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+dfbtest_reinit_SOURCES = dfbtest_reinit.c
+dfbtest_reinit_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+dfbtest_scale_SOURCES = dfbtest_scale.c
+dfbtest_scale_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+dfbtest_window_SOURCES = dfbtest_window.c
+dfbtest_window_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+direct_stream_SOURCES = direct_stream.c
+direct_stream_LDADD = $(libdirect)
+direct_test_SOURCES = direct_test.c
+direct_test_LDADD = $(libdirect)
+fusion_fork_SOURCES = fusion_fork.c
+fusion_fork_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+fusion_reactor_SOURCES = fusion_reactor.c
+fusion_reactor_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+fusion_skirmish_SOURCES = fusion_skirmish.c
+fusion_skirmish_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+fusion_stream_SOURCES = fusion_stream.c
+fusion_stream_LDADD = $(libdirectfb) $(libfusion) $(libdirect)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  tests/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+dfbtest_blit$(EXEEXT): $(dfbtest_blit_OBJECTS) $(dfbtest_blit_DEPENDENCIES) 
+	@rm -f dfbtest_blit$(EXEEXT)
+	$(LINK) $(dfbtest_blit_OBJECTS) $(dfbtest_blit_LDADD) $(LIBS)
+dfbtest_reinit$(EXEEXT): $(dfbtest_reinit_OBJECTS) $(dfbtest_reinit_DEPENDENCIES) 
+	@rm -f dfbtest_reinit$(EXEEXT)
+	$(LINK) $(dfbtest_reinit_OBJECTS) $(dfbtest_reinit_LDADD) $(LIBS)
+dfbtest_scale$(EXEEXT): $(dfbtest_scale_OBJECTS) $(dfbtest_scale_DEPENDENCIES) 
+	@rm -f dfbtest_scale$(EXEEXT)
+	$(LINK) $(dfbtest_scale_OBJECTS) $(dfbtest_scale_LDADD) $(LIBS)
+dfbtest_window$(EXEEXT): $(dfbtest_window_OBJECTS) $(dfbtest_window_DEPENDENCIES) 
+	@rm -f dfbtest_window$(EXEEXT)
+	$(LINK) $(dfbtest_window_OBJECTS) $(dfbtest_window_LDADD) $(LIBS)
+direct_stream$(EXEEXT): $(direct_stream_OBJECTS) $(direct_stream_DEPENDENCIES) 
+	@rm -f direct_stream$(EXEEXT)
+	$(LINK) $(direct_stream_OBJECTS) $(direct_stream_LDADD) $(LIBS)
+direct_test$(EXEEXT): $(direct_test_OBJECTS) $(direct_test_DEPENDENCIES) 
+	@rm -f direct_test$(EXEEXT)
+	$(LINK) $(direct_test_OBJECTS) $(direct_test_LDADD) $(LIBS)
+fusion_fork$(EXEEXT): $(fusion_fork_OBJECTS) $(fusion_fork_DEPENDENCIES) 
+	@rm -f fusion_fork$(EXEEXT)
+	$(LINK) $(fusion_fork_OBJECTS) $(fusion_fork_LDADD) $(LIBS)
+fusion_reactor$(EXEEXT): $(fusion_reactor_OBJECTS) $(fusion_reactor_DEPENDENCIES) 
+	@rm -f fusion_reactor$(EXEEXT)
+	$(LINK) $(fusion_reactor_OBJECTS) $(fusion_reactor_LDADD) $(LIBS)
+fusion_skirmish$(EXEEXT): $(fusion_skirmish_OBJECTS) $(fusion_skirmish_DEPENDENCIES) 
+	@rm -f fusion_skirmish$(EXEEXT)
+	$(LINK) $(fusion_skirmish_OBJECTS) $(fusion_skirmish_LDADD) $(LIBS)
+fusion_stream$(EXEEXT): $(fusion_stream_OBJECTS) $(fusion_stream_DEPENDENCIES) 
+	@rm -f fusion_stream$(EXEEXT)
+	$(LINK) $(fusion_stream_OBJECTS) $(fusion_stream_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbtest_blit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbtest_reinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbtest_scale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbtest_window.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct_stream.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion_fork.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion_reactor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion_skirmish.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion_stream.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-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:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-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
+
+# 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/tests/dfbtest_blit.c b/Source/DirectFB/tests/dfbtest_blit.c
new file mode 100755
index 0000000..7a9235f
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_blit.c
@@ -0,0 +1,316 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+#include <directfb_util.h>
+
+static const DirectFBPixelFormatNames( format_names );
+
+/**********************************************************************************************************************/
+
+static DFBBoolean
+parse_format( const char *arg, DFBSurfacePixelFormat *_f )
+{
+     int i = 0;
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          if (!strcasecmp( arg, format_names[i].name )) {
+               *_f = format_names[i].format;
+               return DFB_TRUE;
+          }
+
+          ++i;
+     }
+
+     fprintf (stderr, "\nInvalid format specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static int
+print_usage( const char *prg )
+{
+     int i = 0;
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "== DirectFB Blitting Test (version %s) ==\n", DIRECTFB_VERSION);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Known pixel formats:\n");
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          DFBSurfacePixelFormat format = format_names[i].format;
+
+          fprintf (stderr, "   %-10s %2d bits, %d bytes",
+                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
+                   DFB_BYTES_PER_PIXEL(format));
+
+          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
+               fprintf (stderr, "   ALPHA");
+
+          if (DFB_PIXELFORMAT_IS_INDEXED(format))
+               fprintf (stderr, "   INDEXED");
+
+          if (DFB_PLANAR_PIXELFORMAT(format)) {
+               int planes = DFB_PLANE_MULTIPLY(format, 1000);
+
+               fprintf (stderr, "   PLANAR (x%d.%03d)",
+                        planes / 1000, planes % 1000);
+          }
+
+          fprintf (stderr, "\n");
+
+          ++i;
+     }
+
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Usage: %s [options]\n", prg);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "  -h, --help                        Show this help message\n");
+     fprintf (stderr, "  -v, --version                     Print version information\n");
+     fprintf (stderr, "  -s, --source    <pixelformat>     Source pixel format\n");
+     fprintf (stderr, "  -d, --dest      <pixelformat>     Destination pixel format\n");
+     fprintf (stderr, "  -r, --resize                      Set destination from source size\n");
+     fprintf (stderr, "  -b, --benchmark                   Enable benchmarking mode\n");
+     fprintf (stderr, "  -R, --rerender                    Rerender before every blit (benchmark)\n");
+
+     return -1;
+}
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     int                     i;
+     DFBResult               ret;
+     DFBSurfaceDescription   desc;
+     IDirectFB              *dfb;
+     IDirectFBImageProvider *provider      = NULL;
+     IDirectFBSurface       *source        = NULL;
+     IDirectFBSurface       *dest          = NULL;
+     const char             *url           = NULL;
+     DFBSurfacePixelFormat   source_format = DSPF_UNKNOWN;
+     DFBSurfacePixelFormat   dest_format   = DSPF_UNKNOWN;
+     bool                    dest_resize   = false;
+     bool                    benchmark     = false;
+     bool                    rerender      = false;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+     /* Parse arguments. */
+     for (i=1; i<argc; i++) {
+          const char *arg = argv[i];
+
+          if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
+               return print_usage( argv[0] );
+          else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+          else if (strcmp (arg, "-s") == 0 || strcmp (arg, "--source") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_format( argv[i], &source_format ))
+                    return false;
+          }
+          else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--dest") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_format( argv[i], &dest_format ))
+                    return false;
+          }
+          else if (strcmp (arg, "-r") == 0 || strcmp (arg, "--resize") == 0)
+               dest_resize = true;
+          else if (strcmp (arg, "-b") == 0 || strcmp (arg, "--benchmark") == 0)
+               benchmark = true;
+          else if (strcmp (arg, "-R") == 0 || strcmp (arg, "--rerender") == 0)
+               rerender = true;
+          else if (!url)
+               url = arg;
+          else
+               return print_usage( argv[0] );
+     }
+
+     /* Check if we got an URL. */
+     if (!url)
+          return print_usage( argv[0] );
+          
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     /* Create an image provider for the image to be loaded. */
+     ret = dfb->CreateImageProvider( dfb, url, &provider );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: IDirectFB::CreateImageProvider( '%s' ) failed!\n", url );
+          goto out;
+     }
+
+     /* Get the surface description. */
+     ret = provider->GetSurfaceDescription( provider, &desc );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: IDirectFBImageProvider::GetSurfaceDescription() failed!\n" );
+          goto out;
+     }
+
+     if (source_format != DSPF_UNKNOWN)
+          desc.pixelformat = source_format;
+     
+     D_INFO( "DFBTest/Blit: Source is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+     /* Create a surface for the image. */
+     ret = dfb->CreateSurface( dfb, &desc, &source );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: IDirectFB::CreateSurface() failed!\n" );
+          goto out;
+     }
+     
+     ret = provider->RenderTo( provider, source, NULL );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: IDirectFBImageProvider::RenderTo() failed!\n" );
+          goto out;
+     }
+
+     /* Fill description for a primary surface. */
+     desc.flags = DSDESC_CAPS;
+     desc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
+
+     if (dest_format != DSPF_UNKNOWN) {
+          desc.flags       |= DSDESC_PIXELFORMAT;
+          desc.pixelformat  = dest_format;
+     }
+
+     if (dest_resize)
+          desc.flags |= DSDESC_WIDTH | DSDESC_HEIGHT;
+
+     dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
+
+     /* Create a primary surface. */
+     ret = dfb->CreateSurface( dfb, &desc, &dest );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Blit: IDirectFB::CreateSurface() failed!\n" );
+          goto out;
+     }
+
+     dest->GetSize( dest, &desc.width, &desc.height );
+     dest->GetPixelFormat( dest, &desc.pixelformat );
+
+     D_INFO( "DFBTest/Blit: Destination is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+     dest->StretchBlit( dest, source, NULL, NULL );
+     dest->Flip( dest, NULL, DSFLIP_NONE );
+
+     if (benchmark) {
+          int       num = 0;
+          long long start, diff = 0, speed;
+
+          sync();
+
+          sleep( 1 );
+
+          dest->StretchBlit( dest, source, NULL, NULL );
+
+          D_INFO( "DFBTest/Blit: Benchmarking...\n" );
+
+          dfb->WaitIdle( dfb );
+
+          start = direct_clock_get_millis();
+
+          do {
+               if (rerender) {
+                    ret = provider->RenderTo( provider, source, NULL );
+                    if (ret) {
+                         D_DERROR( ret, "DFBTest/Blit: IDirectFBImageProvider::RenderTo() failed!\n" );
+                         goto out;
+                    }
+               }
+
+               dest->StretchBlit( dest, source, NULL, NULL );
+
+               if ((num & 7) == 7)
+                    diff = direct_clock_get_millis() - start;
+
+               num++;
+          } while (diff < 2300);
+
+          dfb->WaitIdle( dfb );
+
+          diff = direct_clock_get_millis() - start;
+
+          speed = (long long) num * desc.width * desc.height / diff;
+
+          D_INFO( "DFBTest/Blit: Speed is %lld.%03lld MPixel/sec (%dx%d x %d in %lld.%03lld sec)\n",
+                  speed / 1000LL, speed % 1000LL, desc.width, desc.height, num, diff / 1000LL, diff % 1000LL );
+     }
+     else
+          sleep( 2 );
+
+
+out:
+     if (dest)
+          dest->Release( dest );
+
+     if (source)
+          source->Release( source );
+
+     if (provider)
+          provider->Release( provider );
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_font.c b/Source/DirectFB/tests/dfbtest_font.c
new file mode 100755
index 0000000..1876a1d
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_font.c
@@ -0,0 +1,206 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+#include <directfb_util.h>
+
+static const DirectFBPixelFormatNames( format_names );
+
+/**********************************************************************************************************************/
+
+static int
+print_usage( const char *prg )
+{
+     int i = 0;
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "== DirectFB Font Test (version %s) ==\n", DIRECTFB_VERSION);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Known pixel formats:\n");
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          DFBSurfacePixelFormat format = format_names[i].format;
+
+          fprintf (stderr, "   %-10s %2d bits, %d bytes",
+                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
+                   DFB_BYTES_PER_PIXEL(format));
+
+          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
+               fprintf (stderr, "   ALPHA");
+
+          if (DFB_PIXELFORMAT_IS_INDEXED(format))
+               fprintf (stderr, "   INDEXED");
+
+          if (DFB_PLANAR_PIXELFORMAT(format)) {
+               int planes = DFB_PLANE_MULTIPLY(format, 1000);
+
+               fprintf (stderr, "   PLANAR (x%d.%03d)",
+                        planes / 1000, planes % 1000);
+          }
+
+          fprintf (stderr, "\n");
+
+          ++i;
+     }
+
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Usage: %s [options] <file>\n", prg);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "  -h, --help                        Show this help message\n");
+     fprintf (stderr, "  -v, --version                     Print version information\n");
+
+     return -1;
+}
+
+/**********************************************************************************************************************/
+
+static IDirectFBFont *
+CreateFont( IDirectFB *dfb, const char *url, int size )
+{
+     DFBResult           ret;
+     DFBFontDescription  fdesc;
+     IDirectFBFont      *font;
+
+     /* Create the font. */
+     fdesc.flags  = DFDESC_HEIGHT;
+     fdesc.height = size;
+
+     ret = dfb->CreateFont( dfb, url, &fdesc, &font );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Font: IDirectFB::CreateFont( '%s' ) failed!\n", url );
+          return NULL;
+     }
+
+     return font;
+}
+
+int
+main( int argc, char *argv[] )
+{
+     int                     i;
+     DFBResult               ret;
+     DFBSurfaceDescription   desc;
+     IDirectFB              *dfb;
+     IDirectFBSurface       *dest = NULL;
+     const char             *url  = NULL;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Font: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+     /* Parse arguments. */
+     for (i=1; i<argc; i++) {
+          const char *arg = argv[i];
+
+          if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
+               return print_usage( argv[0] );
+          else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+          else if (!url)
+               url = arg;
+          else
+               return print_usage( argv[0] );
+     }
+
+     /* Check if we got an URL. */
+     if (!url)
+          return print_usage( argv[0] );
+          
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Font: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     /* Fill description for a primary surface. */
+     desc.flags = DSDESC_CAPS;
+     desc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
+
+     dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
+
+     /* Create a primary surface. */
+     ret = dfb->CreateSurface( dfb, &desc, &dest );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Font: IDirectFB::CreateSurface() failed!\n" );
+          goto out;
+     }
+
+     dest->GetSize( dest, &desc.width, &desc.height );
+     dest->GetPixelFormat( dest, &desc.pixelformat );
+
+     D_INFO( "DFBTest/Font: Destination is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+     dest->SetColor( dest, 0xff, 0xff, 0xff, 0xff );
+
+
+     IDirectFBFont *font;
+
+     font = CreateFont( dfb, url, 20 );
+
+     for (i=10; i<50; i++) {
+          dest->Clear( dest, 0, 0, 0, 0 );
+
+          dest->SetFont( dest, font );
+          dest->DrawString( dest, "Test string with lots of characters", -1, 100, 100, DSTF_TOPLEFT );
+
+          dest->Flip( dest, NULL, DSFLIP_NONE );
+
+          sleep( 1 );
+     }
+
+     font->Release( font );
+
+
+out:
+     if (dest)
+          dest->Release( dest );
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_reinit.c b/Source/DirectFB/tests/dfbtest_reinit.c
new file mode 100755
index 0000000..2c443c1
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_reinit.c
@@ -0,0 +1,72 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult  ret;
+     IDirectFB *dfb;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Reinit: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Reinit: 1st DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Reinit: 2nd DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_scale.c b/Source/DirectFB/tests/dfbtest_scale.c
new file mode 100755
index 0000000..2d4e090
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_scale.c
@@ -0,0 +1,156 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+
+static int
+show_usage( const char *prg )
+{
+     fprintf( stderr, "Usage: %s <url>\n", prg );
+
+     return -1;
+}
+
+int
+main( int argc, char *argv[] )
+{
+     int                     i;
+     DFBResult               ret;
+     DFBSurfaceDescription   desc;
+     IDirectFB              *dfb;
+     IDirectFBImageProvider *provider = NULL;
+     IDirectFBSurface       *source   = NULL;
+     IDirectFBSurface       *dest     = NULL;
+     const char             *url      = NULL;
+
+     /* Parse arguments. */
+     for (i=1; i<argc; i++) {
+          if (!strcmp( argv[i], "-h" ))
+               return show_usage( argv[0] );
+          else if (!url)
+               url = argv[i];
+          else
+               return show_usage( argv[0] );
+     }
+
+     /* Check if we got an URL. */
+     if (!url)
+          return show_usage( argv[0] );
+          
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     /* Create an image provider for the image to be loaded. */
+     ret = dfb->CreateImageProvider( dfb, url, &provider );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateImageProvider( '%s' ) failed!\n", url );
+          goto out;
+     }
+
+     /* Get the surface description. */
+     ret = provider->GetSurfaceDescription( provider, &desc );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::GetSurfaceDescription() failed!\n" );
+          goto out;
+     }
+     
+     desc.pixelformat = DSPF_LUT8;
+
+     D_INFO( "DFBTest/Scale: Source is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+     /* Create a surface for the image. */
+     ret = dfb->CreateSurface( dfb, &desc, &source );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
+          goto out;
+     }
+     
+     ret = provider->RenderTo( provider, source, NULL );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::RenderTo() failed!\n" );
+          goto out;
+     }
+     
+     desc.width  = desc.width  * 3 / 4;
+     desc.height = desc.height * 3 / 4;
+
+     if (DFB_PIXELFORMAT_IS_INDEXED( desc.pixelformat ))
+          desc.pixelformat = DSPF_ARGB;
+
+     D_INFO( "DFBTest/Scale: Destination is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+     /* Create a surface for the image. */
+     ret = dfb->CreateSurface( dfb, &desc, &dest );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
+          goto out;
+     }
+
+     dest->SetBlittingFlags( dest, DSBLIT_SRC_PREMULTIPLY );
+     dest->StretchBlit( dest, source, NULL, NULL );
+
+     dest->Dump( dest, "dfbtest_scale", NULL );
+
+
+out:
+     if (dest)
+          dest->Release( dest );
+
+     if (source)
+          source->Release( source );
+
+     if (provider)
+          provider->Release( provider );
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_window.c b/Source/DirectFB/tests/dfbtest_window.c
new file mode 100755
index 0000000..ab9f28b
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_window.c
@@ -0,0 +1,1241 @@
+/*
+   (c) Copyright 2001-2009  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+#include <directfb_util.h>
+
+static const DirectFBPixelFormatNames( format_names );
+static const DirectFBWindowCapabilitiesNames( caps_names );
+static const DirectFBWindowOptionsNames( options_names );
+
+/**********************************************************************************************************************/
+
+static DFBWindowDescription m_desc_top = {
+     .flags         = DWDESC_CAPS | DWDESC_POSX | DWDESC_POSY |
+                      DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT | DWDESC_OPTIONS,
+     .posx          = 100,
+     .posy          = 100,
+     .width         = 200,
+     .height        = 200,
+};
+
+static DFBWindowDescription m_desc_sub = {
+     .flags         = DWDESC_CAPS | DWDESC_POSX | DWDESC_POSY |
+                      DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT | DWDESC_OPTIONS | DWDESC_TOPLEVEL_ID,
+     .posx          = 40,
+     .posy          = 40,
+     .width         = 120,
+     .height        = 120,
+};
+
+static DFBColor         m_topcolor;
+static DFBColor         m_subcolor;
+
+static IDirectFBWindow *m_toplevel     = NULL;
+static DFBWindowID      m_toplevel_id  = 0;
+
+static IDirectFBWindow *m_subwindow    = NULL;
+static DFBWindowID      m_subwindow_id = 0;
+
+static DFBBoolean       m_wait_at_end  = DFB_FALSE;
+
+/**********************************************************************************************************************/
+
+typedef DFBResult (*TestFunc)( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static DFBResult Test_CreateWindow( IDirectFBDisplayLayer *layer, void *arg );
+static DFBResult Test_CreateSubWindow( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static DFBResult Test_MoveWindow( IDirectFBDisplayLayer *layer, void *arg );
+static DFBResult Test_ScaleWindow( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static DFBResult Test_RestackWindow( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static DFBResult Test_SrcGeometry( IDirectFBDisplayLayer *layer, void *arg );
+static DFBResult Test_DstGeometry( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static DFBResult Test_HideWindow( IDirectFBDisplayLayer *layer, void *arg );
+static DFBResult Test_DestroyWindow( IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     const char *name;
+     TestFunc    func;
+
+     bool        run_top;
+     bool        run_sub;
+} Test;
+
+static Test m_tests[] = {
+     { "Restack",        Test_RestackWindow },
+     { "Move",           Test_MoveWindow },
+     { "Scale",          Test_ScaleWindow },
+     { "SrcGeometry",    Test_SrcGeometry },
+     { "DstGeometry",    Test_DstGeometry },
+     { "Hide",           Test_HideWindow },
+     { "Destroy",        Test_DestroyWindow },
+};
+
+/**********************************************************************************************************************/
+
+static DFBResult RunTest( TestFunc func, const char *func_name, IDirectFBDisplayLayer *layer, void *arg );
+
+/**********************************************************************************************************************/
+
+static void ShowMessage( unsigned int ms, const char *name,
+                         const char *prefix, const char *format, ... ) D_FORMAT_PRINTF(4);
+
+#define SHOW_TEST(msg...)    ShowMessage( 2000, __FUNCTION__, \
+                                          "===============================================================\n\n", msg )
+#define SHOW_INFO(msg...)    ShowMessage(  500, __FUNCTION__, "", msg )
+#define SHOW_RESULT(msg...)  ShowMessage( 3000, __FUNCTION__, "", msg )
+
+/**********************************************************************************************************************/
+
+static bool parse_command_line( int argc, char *argv[] );
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult              ret;
+     int                    i;
+     IDirectFB             *dfb;
+     IDirectFBDisplayLayer *layer;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     SHOW_INFO( "Starting up..." );
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate() failed", ret );
+          return -3;
+     }
+
+     /* Get the primary layer interface. */
+     ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
+     if (ret) {
+          D_DERROR( ret, "IDirectFB::GetDisplayLayer() failed!\n" );
+          dfb->Release( dfb );
+          return -4;
+     }
+
+
+     if (!m_toplevel_id)
+          RunTest( Test_CreateWindow, "CreateWindow", layer, NULL );
+
+     RunTest( Test_CreateSubWindow, "CreateSubWindow", layer, NULL );
+
+
+     for (i=0; i<D_ARRAY_SIZE(m_tests); i++) {
+          if (m_tests[i].run_top)
+               RunTest( m_tests[i].func, m_tests[i].name, layer, NULL );
+
+          if (m_tests[i].run_sub)
+               RunTest( m_tests[i].func, m_tests[i].name, layer, (void*) (unsigned long) m_subwindow_id );
+     }
+
+     if (m_wait_at_end) {
+          sigset_t block;
+
+          sigemptyset( &block );
+
+          sigsuspend( &block );
+     }
+
+     SHOW_INFO( "Shutting down..." );
+
+     /* Release the sub window. */
+     if (m_subwindow)
+          m_subwindow->Release( m_subwindow );
+
+     /* Release the top level. */
+     if (m_toplevel)
+          m_toplevel->Release( m_toplevel );
+
+     /* Release the layer. */
+     layer->Release( layer );
+
+     /* Release the super interface. */
+     dfb->Release( dfb );
+
+     return EXIT_SUCCESS;
+}
+
+/**********************************************************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     int i = 0;
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "== DirectFB Window Test (version %s) ==\n", DIRECTFB_VERSION);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Known pixel formats:\n");
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          DFBSurfacePixelFormat format = format_names[i].format;
+
+          fprintf (stderr, "   %-10s %2d bits, %d bytes",
+                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
+                   DFB_BYTES_PER_PIXEL(format));
+
+          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
+               fprintf (stderr, "   ALPHA");
+
+          if (DFB_PIXELFORMAT_IS_INDEXED(format))
+               fprintf (stderr, "   INDEXED");
+
+          if (DFB_PLANAR_PIXELFORMAT(format)) {
+               int planes = DFB_PLANE_MULTIPLY(format, 1000);
+
+               fprintf (stderr, "   PLANAR (x%d.%03d)",
+                        planes / 1000, planes % 1000);
+          }
+
+          fprintf (stderr, "\n");
+
+          ++i;
+     }
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Known window capabilities:\n");
+
+     for (i=0; caps_names[i].capability != DWCAPS_NONE; i++)
+          fprintf (stderr, "   %s\n", caps_names[i].name);
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Known window options:\n");
+
+     for (i=0; options_names[i].option != DWOP_NONE; i++)
+          fprintf (stderr, "   %s\n", options_names[i].name);
+
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Usage: %s [options]\n", prg_name);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "  -h, --help                            Show this help message\n");
+     fprintf (stderr, "  -v, --version                         Print version information\n");
+     fprintf (stderr, "  -T, --top-level     <toplevel_id>     WindowID (skips top creation)\n");
+     fprintf (stderr, "  -W, --wait-at-end                     Wait at the end (don't exit)\n");
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Top window:\n");
+     fprintf (stderr, "  -r, --run           <test>            Run test (see list below)\n");
+     fprintf (stderr, "  -p, --pos           <posx>,<posy>     Position     (%d,%d)\n", m_desc_top.posx, m_desc_top.posy);
+     fprintf (stderr, "  -s, --size          <width>x<height>  Size         (%dx%d)\n", m_desc_top.width, m_desc_top.height);
+     fprintf (stderr, "  -f, --format        <pixelformat>     Pixel Format (%s)\n",    dfb_pixelformat_name(m_desc_top.pixelformat));
+     fprintf (stderr, "  -c, --caps          <window_caps>     Capabilities (NONE)\n");
+     fprintf (stderr, "  -l, --color         <aarrggbb>        Fixed Color  (NONE)\n");
+     fprintf (stderr, "  -o, --option        <window_option>   Options      (NONE)\n");
+     fprintf (stderr, "  -a, --associate     <parent_id>       Association  (N/A)\n");
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Sub window:\n");
+     fprintf (stderr, "  -R, --sub-run       <test>            Run test (see list below)\n");
+     fprintf (stderr, "  -P, --sub-pos       <posx>,<posy>     Position     (%d,%d)\n", m_desc_sub.posx, m_desc_sub.posy);
+     fprintf (stderr, "  -S, --sub-size      <width>x<height>  Size         (%dx%d)\n", m_desc_sub.width, m_desc_sub.height);
+     fprintf (stderr, "  -F, --sub-format    <pixelformat>     Format       (%s)\n",    dfb_pixelformat_name(m_desc_sub.pixelformat));
+     fprintf (stderr, "  -C, --sub-caps      <window_caps>     Capabilities (NONE)\n");
+     fprintf (stderr, "  -L, --sub-color     <aarrggbb>        Fixed Color  (NONE)\n");
+     fprintf (stderr, "  -O, --sub-option    <window_option>   Options      (NONE)\n");
+     fprintf (stderr, "  -A, --sub-associate <parent_id>       Association  (N/A)\n");
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "Available tests:\n");
+
+     for (i=0; i<D_ARRAY_SIZE(m_tests); i++)
+          fprintf (stderr, "   %s\n", m_tests[i].name);
+
+     fprintf (stderr, "\n");
+}
+
+static DFBBoolean
+parse_test( const char *arg, bool sub )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(m_tests); i++) {
+          if (!strncasecmp( arg, m_tests[i].name, strlen(arg) )) {
+               if (sub)
+                    m_tests[i].run_sub = true;
+               else
+                    m_tests[i].run_top = true;
+
+               return DFB_TRUE;
+          }
+     }
+
+     fprintf (stderr, "\nInvalid test specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static DFBBoolean
+parse_position( const char *arg, int *_x, int *_y )
+{
+     if (sscanf( arg, "%d,%d", _x, _y ) != 2) {
+          fprintf (stderr, "\nInvalid position specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_size( const char *arg, int *_w, int *_h )
+{
+     if (sscanf( arg, "%dx%d", _w, _h ) != 2 || *_w < 1 || *_h < 1) {
+          fprintf (stderr, "\nInvalid size specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_format( const char *arg, DFBSurfacePixelFormat *_f )
+{
+     int i = 0;
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          if (!strcasecmp( arg, format_names[i].name )) {
+               *_f = format_names[i].format;
+               return DFB_TRUE;
+          }
+
+          ++i;
+     }
+
+     fprintf (stderr, "\nInvalid format specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static DFBBoolean
+parse_caps( const char *arg, DFBWindowCapabilities *_c )
+{
+     int i = 0;
+
+     while (caps_names[i].capability != DWCAPS_NONE) {
+          if (!strncasecmp( arg, caps_names[i].name, strlen(arg) )) {
+               *_c |= caps_names[i].capability;
+               return DFB_TRUE;
+          }
+
+          ++i;
+     }
+
+     fprintf (stderr, "\nInvalid caps specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static DFBBoolean
+parse_color( const char *arg, DFBColor *_c )
+{
+     long int  l   = 0;
+     char     *end = 0;
+     DFBColor  c;
+
+     l = strtol( arg, &end, 16 );
+
+     if( strlen(arg)>8 || (end && *end!=0) ) {
+          fprintf (stderr, "\nInvalid color specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     c.a = (l >> 24)       ;
+     c.r = (l >> 16) & 0xff;
+     c.g = (l >>  8) & 0xff;
+     c.b = (l      ) & 0xff;
+     
+     *_c = c;
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_option( const char *arg, DFBWindowOptions *_o )
+{
+     int i = 0;
+
+     while (options_names[i].option != DWOP_NONE) {
+          if (!strncasecmp( arg, options_names[i].name, strlen(arg) )) {
+               *_o |= options_names[i].option;
+               return DFB_TRUE;
+          }
+
+          ++i;
+     }
+
+     fprintf (stderr, "\nInvalid options specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static DFBBoolean
+parse_id( const char *arg, unsigned int *_id )
+{
+     if (sscanf( arg, "%u", _id ) != 1) {
+          fprintf (stderr, "\nInvalid ID specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static bool
+parse_command_line( int argc, char *argv[] )
+{
+     int n;
+
+     for (n = 1; n < argc; n++) {
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return false;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+
+          if (strcmp (arg, "-T") == 0 || strcmp (arg, "--top-level") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_id( argv[n], &m_toplevel_id ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-W") == 0 || strcmp (arg, "--wait-at-end") == 0) {
+               m_wait_at_end = DFB_TRUE;
+               continue;
+          }
+
+          if (strcmp (arg, "-r") == 0 || strcmp (arg, "--run") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_test( argv[n], false ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-p") == 0 || strcmp (arg, "--pos") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_position( argv[n], &m_desc_top.posx, &m_desc_top.posy ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-s") == 0 || strcmp (arg, "--size") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_size( argv[n], &m_desc_top.width, &m_desc_top.height ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-f") == 0 || strcmp (arg, "--format") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_format( argv[n], &m_desc_top.pixelformat ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-c") == 0 || strcmp (arg, "--caps") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_caps( argv[n], &m_desc_top.caps ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-l") == 0 || strcmp (arg, "--color") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_color( argv[n], &m_topcolor ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-o") == 0 || strcmp (arg, "--option") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_option( argv[n], &m_desc_top.options ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-a") == 0 || strcmp (arg, "--associate") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_id( argv[n], &m_desc_top.parent_id ))
+                    return false;
+
+//               m_desc_top.flags   |= DWDESC_PARENT;
+               m_desc_top.options |= DWOP_FOLLOW_BOUNDS;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-R") == 0 || strcmp (arg, "--sub-run") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_test( argv[n], true ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-P") == 0 || strcmp (arg, "--sub-pos") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_position( argv[n], &m_desc_sub.posx, &m_desc_sub.posy ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-S") == 0 || strcmp (arg, "--sub-size") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_size( argv[n], &m_desc_sub.width, &m_desc_sub.height ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-F") == 0 || strcmp (arg, "--sub-format") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_format( argv[n], &m_desc_sub.pixelformat ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-C") == 0 || strcmp (arg, "--sub-caps") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_caps( argv[n], &m_desc_sub.caps ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-L") == 0 || strcmp (arg, "--sub-color") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_color( argv[n], &m_subcolor ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-O") == 0 || strcmp (arg, "--sub-option") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_option( argv[n], &m_desc_sub.options ))
+                    return false;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-A") == 0 || strcmp (arg, "--sub-associate") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return false;
+               }
+
+               if (!parse_id( argv[n], &m_desc_sub.parent_id ))
+                    return false;
+
+//               m_desc_sub.flags   |= DWDESC_PARENT;
+               m_desc_sub.options |= DWOP_FOLLOW_BOUNDS;
+
+               continue;
+          }
+
+          print_usage (argv[0]);
+
+          return false;
+     }
+
+     return true;
+}
+
+/**********************************************************************************************************************/
+
+static DFBResult
+RunTest( TestFunc               func,
+         const char            *test_name,
+         IDirectFBDisplayLayer *layer,
+         void                  *arg )
+{
+     DFBResult ret;
+
+     /* Run the actual test... */
+     ret = func( layer, arg );
+     if (ret)
+          D_DERROR( ret, "RunTest: '%s' failed!\n", test_name );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static void
+ShowMessage( unsigned int ms, const char *name, const char *prefix, const char *format, ... )
+{
+     char buf[512];
+
+     va_list ap;
+
+     va_start( ap, format );
+
+     vsnprintf( buf, sizeof(buf), format, ap );
+
+     va_end( ap );
+
+     direct_log_printf( NULL, "%s [[ %-30s ]]  %s\n", prefix, name, buf );
+
+     usleep( ms * 1000 );
+}
+
+/**********************************************************************************************************************/
+
+#define _T(x...)  \
+     do {                                                                       \
+          DFBResult ret = x;                                                    \
+                                                                                \
+          if (ret) {                                                            \
+               D_DERROR( ret, "Tests/Window: '%s' failed!\n", #x );             \
+               return ret;                                                      \
+          }                                                                     \
+     } while (0)
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Test_CreateWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     IDirectFBSurface *surface = NULL;
+     IDirectFBWindow  *window;
+     DFBWindowID       window_id;
+     DFBDimension      size = { m_desc_top.width, m_desc_top.height };
+
+     D_ASSERT( m_toplevel_id == 0 );
+
+     /*
+      * Create a new top level window
+      */
+     SHOW_TEST( "CreateWindow( %d,%d - %dx%d %s )...",
+                m_desc_top.posx, m_desc_top.posy, m_desc_top.width, m_desc_top.height,
+                dfb_pixelformat_name( m_desc_top.pixelformat ) );
+
+     _T( layer->CreateWindow( layer, &m_desc_top, &window ) );
+
+     if (m_desc_top.caps & DWCAPS_COLOR) {
+          DFBColor c = m_topcolor;
+
+          SHOW_INFO( "  - SetColor( 0x%02x, 0x%02x, 0x%02x, 0x%02x )...", c.r, c.g, c.b, c.a );
+
+          _T( window->SetColor( window, c.r, c.g, c.b, c.a ) );
+     }
+
+     /*
+      * Query its surface and clear it with light blue (if not input or color only)
+      */
+     if (!(m_desc_top.caps & (DWCAPS_INPUTONLY | DWCAPS_COLOR) )) {
+          SHOW_INFO( "  - GetSurface()..." );
+
+          _T( window->GetSurface( window, &surface ) );
+
+          SHOW_INFO( "  - Clear( 0x20, 0x50, 0xC0, 0xFF )..." );
+
+          _T( surface->Clear( surface, 0x20, 0x50, 0xC0, 0xFF ) );
+
+          _T( surface->SetColor( surface, 0x90, 0xF0, 0xC0, 0xFF ) );
+
+          _T( surface->DrawRectangle( surface, 0, 0, size.w, size.h ) );
+
+          _T( surface->FillRectangle( surface, size.w / 2,          1,          1, size.h - 2 ) );
+          _T( surface->FillRectangle( surface,          1, size.h / 2, size.w - 2,          1 ) );
+     }
+
+     /*
+      * Show the window
+      */
+     SHOW_INFO( "  - SetOpacity( 255 )..." );
+
+     _T( window->SetOpacity( window, 0xff ) );
+
+     /*
+      * Query and print ID of new window
+      */
+     SHOW_INFO( "  - GetID()..." );
+
+     _T( window->GetID( window, &window_id ) );
+
+     /*
+      * Set association of new window
+      */
+     if (m_desc_top.parent_id) {
+          SHOW_INFO( "  - SetAssociation( %u )...", m_desc_top.parent_id );
+
+          _T( window->SetAssociation( window, m_desc_top.parent_id ) );
+     }
+
+     /*
+      * Set top level window ID (user hasn't specified one)
+      */
+     m_toplevel_id = window_id;
+     m_toplevel    = window;
+
+     SHOW_RESULT( "...CreateWindow( %d,%d - %dx%d %s ) done. => Top Window ID %u",
+                  m_desc_top.posx, m_desc_top.posy, m_desc_top.width, m_desc_top.height,
+                  dfb_pixelformat_name( m_desc_top.pixelformat ), window_id );
+
+     if (surface)
+          surface->Release( surface );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_CreateSubWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     IDirectFBWindow      *window;
+     DFBWindowID           window_id;
+     DFBDimension          size = { m_desc_sub.width, m_desc_sub.height };
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /* Write window ID of top level into description */
+     m_desc_sub.toplevel_id = m_toplevel_id;
+
+     /*
+      * Create a new sub window with 75% width/height and positioned at 20,20 within top level window
+      */
+     SHOW_TEST( "CreateWindow( %d,%d - %dx%d %s + toplevel ID %u )...",
+                m_desc_sub.posx, m_desc_sub.posy, m_desc_sub.width, m_desc_sub.height,
+                dfb_pixelformat_name( m_desc_sub.pixelformat ), m_desc_sub.toplevel_id );
+
+     _T( layer->CreateWindow( layer, &m_desc_sub, &window ) );
+
+     if (m_desc_sub.caps & DWCAPS_COLOR) {
+          DFBColor c = m_subcolor;
+
+          SHOW_INFO( "  - SetColor( 0x%02x, 0x%02x, 0x%02x, 0x%02x )...", c.r, c.g, c.b, c.a );
+
+          _T( window->SetColor( window, c.r, c.g, c.b, c.a ) );
+     }
+
+     /*
+      * Query its surface and clear it with light gray (if not input or color only)
+      */
+     if (!(m_desc_sub.caps & (DWCAPS_INPUTONLY | DWCAPS_COLOR) )) {
+          IDirectFBSurface     *surface;
+
+          SHOW_INFO( "  - GetSurface()..." );
+
+          _T( window->GetSurface( window, &surface ) );
+
+          SHOW_INFO( "  - Clear( 0xC0, 0xC0, 0xC0, 0xFF )..." );
+
+          _T( surface->Clear( surface, 0xC0, 0xC0, 0xC0, 0xFF ) );
+
+          _T( surface->DrawRectangle( surface, 0, 0, size.w, size.h ) );
+
+          _T( surface->FillRectangle( surface, size.w / 2,          1,          1, size.h - 2 ) );
+          _T( surface->FillRectangle( surface,          1, size.h / 2, size.w - 2,          1 ) );
+          
+          surface->Release( surface );
+     }
+
+     /*
+      * Show the window
+      */
+     SHOW_INFO( "  - SetOpacity( 255 )..." );
+
+     _T( window->SetOpacity( window, 0xff ) );
+
+     /*
+      * Query and print ID of new window
+      */
+     SHOW_INFO( "  - GetID()..." );
+
+     _T( window->GetID( window, &window_id ) );
+
+     /*
+      * Set association of new window
+      */
+     if (m_desc_sub.parent_id) {
+          SHOW_INFO( "  - SetAssociation( %u )...", m_desc_sub.parent_id );
+
+          _T( window->SetAssociation( window, m_desc_sub.parent_id ) );
+     }
+
+     /*
+      * Set top level window ID (user hasn't specified one)
+      */
+     m_subwindow_id = window_id;
+     m_subwindow    = window;
+
+     SHOW_RESULT( "...CreateWindow( %d,%d - %dx%d %s + toplevel ID %u ) done. => Sub Window ID %u",
+                  m_desc_sub.posx, m_desc_sub.posy, m_desc_sub.width, m_desc_sub.height,
+                  dfb_pixelformat_name( m_desc_sub.pixelformat ), m_desc_sub.toplevel_id, window_id );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_MoveWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     int              i;
+     DFBPoint         pos;
+     IDirectFBWindow *window;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     window->GetPosition( window, &pos.x, &pos.y );
+
+     /*
+      * Move the window
+      */
+     {
+          DFBPoint poss[] = { { pos.x - 40, pos.y - 40 },
+                              { pos.x + 40, pos.y - 40 },
+                              { pos.x + 40, pos.y + 40 },
+                              { pos.x - 40, pos.y + 40 },
+                              { pos.x     , pos.y      } };
+
+          for (i=0; i<D_ARRAY_SIZE(poss); i++) {
+               SHOW_TEST( "MoveTo( %4d,%4d - [%02d] )...", poss[i].x, poss[i].y, i );
+
+               _T( window->MoveTo( window, poss[i].x, poss[i].y ) );
+
+               SHOW_RESULT( "...MoveTo( %4d,%4d - [%02d] ) done.", poss[i].x, poss[i].y, i );
+          }
+     }
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_ScaleWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     int              i;
+     IDirectFBWindow *window;
+     DFBWindowOptions opts;
+     DFBDimension     size;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     window->GetSize( window, &size.w, &size.h );
+
+     /*
+      * Enable scaling
+      */
+     _T( window->GetOptions( window, &opts ) );
+     _T( window->SetOptions( window, opts | DWOP_SCALE ) );
+
+     /*
+      * Scale the window
+      */
+     {
+          DFBDimension sizes[] = { { size.w + 40, size.h      },
+                                   { size.w + 40, size.h + 40 },
+                                   { size.w,      size.h + 40 },
+                                   { size.w + 40, size.h - 40 },
+                                   { size.w - 40, size.h + 40 },
+                                   { size.w,      size.h      } };
+
+          for (i=0; i<D_ARRAY_SIZE(sizes); i++) {
+               SHOW_TEST( "Resize( %4d,%4d - [%02d] )...", sizes[i].w, sizes[i].h, i );
+
+               _T( window->Resize( window, sizes[i].w, sizes[i].h ) );
+
+               SHOW_RESULT( "...Resize( %4d,%4d - [%02d] ) done.", sizes[i].w, sizes[i].h, i );
+          }
+     }
+
+     /*
+      * Restore options
+      */
+     _T( window->SetOptions( window, opts ) );
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_RestackWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     int              i;
+     IDirectFBWindow *window;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     /*
+      * Lower it a few times
+      */
+     for (i=0; i<2; i++) {
+          SHOW_TEST( "Lower() #%d...", i+1 );
+
+          _T( window->Lower( window ) );
+
+          SHOW_RESULT( "...Lower() #%d done.", i+1 );
+     }
+
+     /*
+      * Raise it a few times
+      */
+     for (i=0; i<2; i++) {
+          SHOW_TEST( "Raise() #%d...", i+1 );
+
+          _T( window->Raise( window ) );
+
+          SHOW_RESULT( "...Raise() #%d done.", i+1 );
+     }
+
+     /*
+      * Lower it to the bottom
+      */
+     SHOW_TEST( "LowerToBottom()..." );
+
+     _T( window->LowerToBottom( window ) );
+
+     SHOW_RESULT( "...LowerToBottom() done." );
+
+     /*
+      * Raise it to the top
+      */
+     SHOW_TEST( "RaiseToTop()..." );
+
+     _T( window->RaiseToTop( window ) );
+
+     SHOW_RESULT( "...RaiseToTop() done." );
+
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_SrcGeometry( IDirectFBDisplayLayer *layer, void *arg )
+{
+     int                i;
+     IDirectFBWindow   *window;
+     DFBWindowGeometry  geometry;
+     DFBDimension       size;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     window->GetSize( window, &size.w, &size.h );
+
+     /*
+      * Change source geometry
+      */
+     {
+          DFBRectangle rects[] = { {          0,          0, size.w / 2, size.h / 2 },
+                                   { size.w / 2,          0, size.w / 2, size.h / 2 },
+                                   { size.w / 2, size.h / 2, size.w / 2, size.h / 2 },
+                                   {          0, size.h / 2, size.w / 2, size.h / 2 } };
+
+          for (i=0; i<D_ARRAY_SIZE(rects); i++) {
+               SHOW_TEST( "SetSrcGeometry( %4d,%4d-%4dx%4d - [%02d] )...", DFB_RECTANGLE_VALS(&rects[i]), i );
+
+               geometry.mode      = DWGM_RECTANGLE;
+               geometry.rectangle = rects[i];
+
+               _T( window->SetSrcGeometry( window, &geometry ) );
+
+               SHOW_RESULT( "...SetSrcGeometry( %4d,%4d-%4dx%4d - [%02d] ) done.", DFB_RECTANGLE_VALS(&rects[i]), i );
+          }
+     }
+
+
+     SHOW_TEST( "SetSrcGeometry( DEFAULT )..." );
+
+     geometry.mode = DWGM_DEFAULT;
+
+     _T( window->SetSrcGeometry( window, &geometry ) );
+
+     SHOW_RESULT( "...SetSrcGeometry( DEFAULT ) done." );
+
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_DstGeometry( IDirectFBDisplayLayer *layer, void *arg )
+{
+     int                i;
+     IDirectFBWindow   *window;
+     DFBWindowGeometry  geometry;
+     DFBDimension       size;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     window->GetSize( window, &size.w, &size.h );
+
+     /*
+      * Change destination geometry
+      */
+     {
+          DFBRectangle rects[] = { {          0,          0, size.w / 2, size.h / 2 },
+                                   { size.w / 2,          0, size.w / 2, size.h / 2 },
+                                   { size.w / 2, size.h / 2, size.w / 2, size.h / 2 },
+                                   {          0, size.h / 2, size.w / 2, size.h / 2 } };
+
+          for (i=0; i<D_ARRAY_SIZE(rects); i++) {
+               SHOW_TEST( "SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] )...", DFB_RECTANGLE_VALS(&rects[i]), i );
+
+               geometry.mode      = DWGM_RECTANGLE;
+               geometry.rectangle = rects[i];
+
+               _T( window->SetDstGeometry( window, &geometry ) );
+
+               SHOW_RESULT( "...SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] ) done.", DFB_RECTANGLE_VALS(&rects[i]), i );
+          }
+     }
+
+
+     SHOW_TEST( "SetDstGeometry( DEFAULT )..." );
+
+     geometry.mode = DWGM_DEFAULT;
+
+     _T( window->SetDstGeometry( window, &geometry ) );
+
+     SHOW_RESULT( "...SetDstGeometry( DEFAULT ) done." );
+
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_HideWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     IDirectFBWindow *window;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     /*
+      * Hide it
+      */
+     SHOW_TEST( "SetOpacity( 0 )..." );
+
+     _T( window->SetOpacity( window, 0 ) );
+
+     SHOW_RESULT( "...SetOpacity( 0 ) done." );
+
+     /*
+      * Show it again
+      */
+     SHOW_TEST( "SetOpacity( 0xff )..." );
+
+     _T( window->SetOpacity( window, 0xff ) );
+
+     SHOW_RESULT( "...SetOpacity( 0xff ) done." );
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
+static DFBResult
+Test_DestroyWindow( IDirectFBDisplayLayer *layer, void *arg )
+{
+     IDirectFBWindow *window;
+
+     D_ASSERT( m_toplevel_id != 0 );
+
+     /*
+      * Get the top level window
+      */
+     _T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
+
+     /*
+      * Destroy it
+      */
+     SHOW_TEST( "Destroy()..." );
+
+     _T( window->Destroy( window ) );
+
+     SHOW_RESULT( "...Destroy() done." );
+
+     window->Release( window );
+
+     return DFB_OK;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_windows_watcher.c b/Source/DirectFB/tests/dfbtest_windows_watcher.c
new file mode 100755
index 0000000..89bb140
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_windows_watcher.c
@@ -0,0 +1,227 @@
+/*
+   (c) Copyright 2001-2009  The DirectFB Organization (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+//#define DIRECT_ENABLE_DEBUG
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+#include <directfb_util.h>
+#include <directfb_windows.h>
+
+static const DirectFBPixelFormatNames( format_names );
+static const DirectFBWindowCapabilitiesNames( caps_names );
+static const DirectFBWindowOptionsNames( options_names );
+
+/**********************************************************************************************************************/
+
+static bool parse_command_line( int argc, char *argv[] );
+
+/**********************************************************************************************************************/
+
+static void
+dump_config( const DFBWindowConfig *config )
+{
+     D_INFO( "  -> bounds       %d,%d-%dx%d\n", DFB_RECTANGLE_VALS( &config->bounds ) );
+     D_INFO( "  -> opacity      %d\n", config->opacity );
+}
+
+/**********************************************************************************************************************/
+
+static void
+Test_Watcher_WindowAdd( void                *context,
+                        const DFBWindowInfo *info )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, info->window_id );
+     D_INFO( "  -> caps         0x%08x\n", info->caps );
+     D_INFO( "  -> resource id  0x%016llx\n", (unsigned long long) info->resource_id );
+
+     dump_config( &info->config );
+}
+
+static void
+Test_Watcher_WindowRemove( void        *context,
+                           DFBWindowID  window_id )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, window_id );
+}
+
+static void
+Test_Watcher_WindowConfig( void                  *context,
+                           DFBWindowID            window_id,
+                           const DFBWindowConfig *config,
+                           DFBWindowConfigFlags   flags )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, window_id );
+     D_INFO( "  -> flags        0x%08x\n", flags );
+
+     dump_config( config );
+}
+
+static void
+Test_Watcher_WindowState( void                 *context,
+                          DFBWindowID           window_id,
+                          const DFBWindowState *state )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, window_id );
+     D_INFO( "  -> flags        0x%08x\n", state->flags );
+}
+
+static void
+Test_Watcher_WindowRestack( void         *context,
+                            DFBWindowID   window_id,
+                            unsigned int  index )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, window_id );
+     D_INFO( "  -> index        %u\n", index );
+}
+
+static void
+Test_Watcher_WindowFocus( void        *context,
+                          DFBWindowID  window_id )
+{
+     D_INFO( "%s( ID %u )\n", __FUNCTION__, window_id );
+}
+
+static DFBWindowsWatcher watcher = {
+     .WindowAdd     = Test_Watcher_WindowAdd,
+     .WindowRemove  = Test_Watcher_WindowRemove,
+     .WindowConfig  = Test_Watcher_WindowConfig,
+     .WindowState   = Test_Watcher_WindowState,
+     .WindowRestack = Test_Watcher_WindowRestack,
+     .WindowFocus   = Test_Watcher_WindowFocus,
+};
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult         ret;
+     IDirectFB        *dfb;
+     IDirectFBWindows *windows;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate() failed", ret );
+          return -3;
+     }
+
+     ret = dfb->GetInterface( dfb, "IDirectFBWindows", NULL, NULL, (void**) &windows );
+     if (ret) {
+          D_DERROR( ret, "IDirectFB::GetInterface( 'IDirectFBWindows' ) failed!\n" );
+          return -4;
+     }
+
+     ret = windows->RegisterWatcher( windows, &watcher, NULL );
+     if (ret) {
+          D_DERROR( ret, "IDirectFBWindows::RegisterWatcher() failed!\n" );
+          return -5;
+     }
+
+     pause();
+
+     /* Release the windows interface. */
+     windows->Release( windows );
+
+     /* Release the super interface. */
+     dfb->Release( dfb );
+
+     return EXIT_SUCCESS;
+}
+
+/**********************************************************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     fprintf (stderr, "\n");
+     fprintf (stderr, "== DirectFB Windows Watcher Test (version %s) ==\n", DIRECTFB_VERSION);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Usage: %s [options]\n", prg_name);
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "  -h, --help                            Show this help message\n");
+     fprintf (stderr, "  -v, --version                         Print version information\n");
+     fprintf (stderr, "\n");
+}
+
+static bool
+parse_command_line( int argc, char *argv[] )
+{
+     int n;
+
+     for (n = 1; n < argc; n++) {
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return false;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+
+          print_usage (argv[0]);
+
+          return false;
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/tests/dfbtest_write.c b/Source/DirectFB/tests/dfbtest_write.c
new file mode 100755
index 0000000..c43f4be
--- /dev/null
+++ b/Source/DirectFB/tests/dfbtest_write.c
@@ -0,0 +1,162 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+#include <directfb_util.h>
+
+
+static void
+write_data( void *ptr,
+            int   size )
+{
+     int  i;
+     u16 *p = ptr;
+
+     for (i=0; i<size/2; i++) {
+          p[i] = i%64;
+     }
+}
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult  ret;
+     int        w;
+     IDirectFB *dfb;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Write: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Write: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     IDirectFBDisplayLayer *layer;
+     IDirectFBWindow       *window;
+     IDirectFBSurface      *dest;
+     IDirectFBSurface      *temp;
+
+     dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
+
+     /* Fill description for a primary surface. */
+     DFBSurfaceDescription  sdesc;
+     sdesc.flags        = DSDESC_CAPS | DSDESC_RESOURCE_ID;
+     sdesc.caps         = DSCAPS_VIDEOONLY;
+     sdesc.resource_id  = 1100;
+
+     sdesc.flags       |= DSDESC_PIXELFORMAT;
+     sdesc.pixelformat  = DSPF_ARGB;
+
+     sdesc.flags       |= DSDESC_WIDTH | DSDESC_HEIGHT;
+     sdesc.width        = 320;
+     sdesc.height       = 200;
+
+     /* Create a primary surface. */
+     ret = dfb->CreateSurface( dfb, &sdesc, &temp );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Write: IDirectFB::CreateSurface() failed!\n" );
+          return ret;
+     }
+
+
+     DFBWindowDescription desc;
+
+     desc.flags        = DWDESC_RESOURCE_ID;
+     desc.resource_id  = 1100;
+
+     desc.flags       |= DWDESC_PIXELFORMAT;
+     desc.pixelformat  = DSPF_ARGB;
+
+     desc.flags       |= DWDESC_WIDTH | DWDESC_HEIGHT;
+     desc.width        = 320;
+     desc.height       = 200;
+
+     /* Create a primary surface. */
+     ret = layer->CreateWindow( layer, &desc, &window );
+     if (ret) {
+          D_DERROR( ret, "DFBTest/Write: IDirectFB::CreateWindow() failed!\n" );
+          return ret;
+     }
+
+     window->GetSurface( window, &dest );
+
+     window->SetOpacity( window, 0xff );
+
+     dest->GetSize( dest, &desc.width, &desc.height );
+     dest->GetPixelFormat( dest, &desc.pixelformat );
+
+     D_INFO( "DFBTest/Write: Destination is %dx%d using %s\n",
+             desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
+
+
+     int   pitch = DFB_BYTES_PER_LINE( desc.pixelformat, desc.width );
+     void *buf   = malloc( pitch * desc.height );
+
+     for (w=0; w<10; w++) {
+          memset( buf, w * 0x55, pitch * desc.height );
+
+
+          DFBRectangle rect = { 0, 0, desc.width, desc.height };
+
+          temp->Write( temp, &rect, buf, pitch );
+
+          dest->SetBlittingFlags( dest, DSBLIT_BLEND_ALPHACHANNEL );
+          dest->Blit( dest, temp, NULL, 0, 0 );
+          dest->Blit( dest, temp, NULL, 0, 0 );
+          dest->Blit( dest, temp, NULL, 0, 0 );
+          dest->Blit( dest, temp, NULL, 0, 0 );
+          dest->Flip( dest, NULL, DSFLIP_NONE );
+
+          dfb->WaitIdle( dfb );
+
+//          sleep( 1 );
+     }
+
+     temp->Release( temp );
+     dest->Release( dest );
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/direct_stream.c b/Source/DirectFB/tests/direct_stream.c
new file mode 100755
index 0000000..ca66f00
--- /dev/null
+++ b/Source/DirectFB/tests/direct_stream.c
@@ -0,0 +1,139 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/messages.h>
+#include <direct/stream.h>
+#include <direct/util.h>
+
+
+D_DEBUG_DOMAIN( Direct_Cat, "Direct/Cat", "libdirect cat" );
+
+
+static int
+show_usage( const char *prg )
+{
+     fprintf( stderr, "Usage: %s <url>\n", prg );
+
+     return -1;
+}
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult   ret;
+     int            i, fdo;
+     DirectStream  *stream;
+     const char    *url = NULL;
+
+     /* Parse arguments. */
+     for (i=1; i<argc; i++) {
+          if (!strcmp( argv[i], "-h" ))
+               return show_usage( argv[0] );
+          else if (!url)
+               url = argv[i];
+          else
+               return show_usage( argv[0] );
+     }
+
+     /* Check if we got an URL. */
+     if (!url)
+          return show_usage( argv[0] );
+          
+     /* Initialize libdirect. */
+     direct_initialize();
+
+     D_INFO( "Direct/Cat: Start from '%s'...\n", url );
+
+     /* Open input. */
+     ret = direct_stream_create( url, &stream );
+     if (ret) {
+          D_DERROR( ret, "Direct/Cat: Opening '%s' failed!\n", url );
+          goto out;
+     }
+
+     /* Open output. */
+     fdo = dup( fileno(stdout) );
+     if (fdo < 0) {
+          ret = errno2result( errno );
+          D_PERROR( "Direct/Cat: Duplicating stdout (%d) failed!\n", fileno(stdout) );
+          goto close_in;
+     }
+
+     /* Copy loop. */
+     while (true) {
+          char         buf[16384];
+          unsigned int length;
+
+          /* Wait for full buffer, if supported, otherwise waits for any data. */
+          ret = direct_stream_wait( stream, sizeof(buf), NULL );
+          if (ret) {
+               D_DERROR( ret, "Direct/Cat: Waiting for data from '%s' failed!\n", url );
+               goto close_both;
+          }
+
+          /* Read buffer. */
+          ret = direct_stream_read( stream, sizeof(buf), buf, &length );
+          if (ret) {
+               D_DERROR( ret, "Direct/Cat: Reading from '%s' failed!\n", url );
+               goto close_both;
+          }
+
+          D_DEBUG_AT( Direct_Cat, "Read  %5u bytes\n", length );
+
+          /* Write buffer. */
+          length = write( fdo, buf, length );
+          if (length < 0) {
+               ret = errno2result( errno );
+               D_PERROR( "Direct/Cat: Writing to stdout (%d) failed!\n", fileno(stdout) );
+               goto close_both;
+          }
+
+          D_DEBUG_AT( Direct_Cat, "Wrote %5u bytes\n", length );
+     }
+
+close_both:
+     /* Close output. */
+     close( fdo );
+
+close_in:
+     /* Close input. */
+     direct_stream_destroy( stream );
+
+out:
+     /* Shutdown libdirect. */
+     direct_shutdown();
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tests/direct_test.c b/Source/DirectFB/tests/direct_test.c
new file mode 100755
index 0000000..4c82c91
--- /dev/null
+++ b/Source/DirectFB/tests/direct_test.c
@@ -0,0 +1,119 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <direct/debug.h>
+#include <direct/direct.h>
+#include <direct/log.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/trace.h>
+
+static int
+show_usage( const char *name )
+{
+     fprintf( stderr, "Usage: %s [-f <file>] [-u <host>:<port>]\n", name );
+
+     return -1;
+}
+
+int
+main( int argc, char *argv[] )
+{
+     int            i;
+     DirectResult   ret;
+     DirectLogType  log_type  = DLT_STDERR;
+     const char    *log_param = NULL;
+     DirectLog     *log;
+
+
+     for (i=1; i<argc; i++) {
+          if (!strcmp( argv[i], "-f" )) {
+               if (++i < argc) {
+                    log_type  = DLT_FILE;
+                    log_param = argv[i];
+               }
+               else
+                    return show_usage(argv[0]);
+          }
+          else if (!strcmp( argv[i], "-u" )) {
+               if (++i < argc) {
+                    log_type  = DLT_UDP;
+                    log_param = argv[i];
+               }
+               else
+                    return show_usage(argv[0]);
+          }
+          else
+               return show_usage(argv[0]);
+     }
+
+     /* Initialize logging. */
+     ret = direct_log_create( log_type, log_param, &log );
+     if (ret)
+          return -1;
+
+     /* Set default log to use. */
+     direct_log_set_default( log );
+
+
+     /* Test memory leak detector by not freeing this one. */
+     D_MALLOC( 1351 );
+
+     D_INFO( "Direct/Test: Application starting...\n" );
+
+
+     /* Initialize libdirect. */
+     direct_initialize();
+
+
+     D_INFO( "Direct/Test: Application stopping...\n" );
+
+     /* Shutdown libdirect. */
+     direct_shutdown();
+
+
+     D_INFO( "Direct/Test: You should see a leak message with debug-mem turned on...\n" );
+
+     /* Shutdown logging. */
+     direct_log_destroy( log );
+
+     direct_config->debug = true;
+     direct_print_memleaks();
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tests/fusion_fork.c b/Source/DirectFB/tests/fusion_fork.c
new file mode 100755
index 0000000..f6cb2ae
--- /dev/null
+++ b/Source/DirectFB/tests/fusion_fork.c
@@ -0,0 +1,172 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stddef.h>
+
+#include <directfb.h>
+
+#include <direct/log.h>
+#include <direct/messages.h>
+
+#include <fusion/fusion.h>
+#include <fusion/reactor.h>
+#include <fusion/ref.h>
+
+
+#define MSG(x...)                       \
+do {                                    \
+     direct_log_printf( NULL, "- " x ); \
+} while (0)
+
+
+typedef struct {
+     unsigned int foo;
+} TestMessage;
+
+
+static FusionWorld   *m_world;
+static FusionRef      m_ref;
+static FusionReactor *m_reactor;
+static Reaction       m_reaction;
+
+
+static ReactionResult
+reaction_callback( const void *msg_data,
+                   void       *ctx )
+{
+     MSG( "Received message (FusionID %lu, pid %d)!\n", fusion_id( m_world ), getpid() );
+
+     return RS_OK;
+}
+
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult ret;
+     pid_t        child_pid;
+     TestMessage  message = {0};
+
+     DirectFBInit( &argc, &argv );
+
+     ret = fusion_enter( -1, 0, FER_MASTER, &m_world );
+     if (ret) {
+          D_DERROR( ret, "fusion_enter() failed" );
+          return ret;
+     }
+
+     MSG( "Entered world %d as master (FusionID %lu, pid %d)\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+
+     ret = fusion_ref_init( &m_ref, "Test", m_world );
+     if (ret) {
+          D_DERROR( ret, "fusion_ref_init() failed" );
+          return -1;
+     }
+
+
+     MSG( "Adding local reference...\n" );
+
+     fusion_ref_up( &m_ref, false );
+
+
+     m_reactor = fusion_reactor_new( sizeof(TestMessage), "Test", m_world );
+     if (!m_reactor) {
+          D_ERROR( "fusion_reactor_new() failed\n" );
+          return -1;
+     }
+
+
+     MSG( "Attaching to reactor...\n" );
+
+     ret = fusion_reactor_attach( m_reactor, reaction_callback, NULL, &m_reaction );
+     if (ret) {
+          D_DERROR( ret, "fusion_reactor_attach() failed" );
+          return ret;
+     }
+
+
+     MSG( ".........FORKING NOW.........\n" );
+
+     fusion_world_set_fork_action( m_world, FFA_FORK );
+     child_pid = fork();
+     fusion_world_set_fork_action( m_world, FFA_CLOSE );
+
+     switch (child_pid) {
+          case -1:
+               D_PERROR( "fork() failed" );
+               break;
+
+          case 0:
+               setsid();
+               MSG( "...arrived after fork() in child (pid %d)..\n", getpid() );
+               MSG( "..child (FusionID %lu).\n", fusion_id( m_world ) );
+               break;
+
+          default:
+               usleep( 200000 );
+               MSG( "...returned from fork() in parent, child pid %d.\n", child_pid );
+               break;
+     }
+
+
+     MSG( "Sending message via reactor...\n" );
+
+     fusion_reactor_dispatch( m_reactor, &message, true, NULL );
+
+     usleep( 200000 );
+
+
+     MSG( "Removing local reference...\n" );
+
+     fusion_ref_down( &m_ref, false );
+
+     usleep( 200000 );
+
+
+     MSG( "Exiting from world %d (FusionID %lu, pid %d)...\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+     fusion_exit( m_world, false );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tests/fusion_reactor.c b/Source/DirectFB/tests/fusion_reactor.c
new file mode 100755
index 0000000..28d4ce1
--- /dev/null
+++ b/Source/DirectFB/tests/fusion_reactor.c
@@ -0,0 +1,199 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stddef.h>
+
+#include <directfb.h>
+
+#include <direct/build.h>
+#include <direct/debug.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+
+#include <fusion/fusion.h>
+#include <fusion/reactor.h>
+#include <fusion/ref.h>
+
+
+#if DIRECT_BUILD_DEBUGS
+#define MSG(x...)                       \
+do {                                    \
+     direct_debug( x ); \
+} while (0)
+#else
+#define MSG(x...)                       \
+do {                                    \
+} while (0)
+#endif
+
+
+typedef struct {
+     unsigned int foo;
+} TestMessage;
+
+static FusionWorld   *m_world;
+
+static ReactionResult
+reaction_callback( const void *msg_data,
+                   void       *ctx )
+{
+     MSG( "Received message (FusionID %lu, pid %d)!\n", fusion_id( m_world ), getpid() );
+
+     return RS_REMOVE;
+}
+
+static FusionCallHandlerResult
+dispatch_callback (int           caller,
+                   int           call_arg,
+                   void         *call_ptr,
+                   void         *ctx,
+                   unsigned int  serial,
+                   int          *ret_val )
+{
+     MSG( "Got dispatch callback (FusionID %lu, pid %d)!\n", fusion_id( m_world ), getpid() );
+
+     return FCHR_RETURN;
+}
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult   ret;
+     pid_t          child_pid;
+     TestMessage    message = {0};
+     FusionReactor *reactor;
+     Reaction       reaction;
+     FusionCall     call;
+
+     DirectFBInit( &argc, &argv );
+
+     ret = fusion_enter( -1, 0, FER_MASTER, &m_world );
+     if (ret) {
+          D_DERROR( ret, "fusion_enter() failed" );
+          return ret;
+     }
+
+     MSG( "Entered world %d as master (FusionID %lu, pid %d)\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+
+     reactor = fusion_reactor_new( sizeof(TestMessage), "Test", m_world );
+     if (!reactor) {
+          D_ERROR( "fusion_reactor_new() failed\n" );
+          return -1;
+     }
+
+
+     MSG( "Attaching to reactor...\n" );
+
+     ret = fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction );
+     if (ret) {
+          D_DERROR( ret, "fusion_reactor_attach() failed" );
+          return ret;
+     }
+
+
+     MSG( ".........FORKING NOW.........\n" );
+
+     fusion_world_set_fork_action( m_world, FFA_FORK );
+     child_pid = fork();
+     fusion_world_set_fork_action( m_world, FFA_CLOSE );
+
+     switch (child_pid) {
+          case -1:
+               D_PERROR( "fork() failed" );
+               break;
+
+          case 0:
+               setsid();
+               MSG( "...arrived after fork() in child (pid %d)..\n", getpid() );
+               MSG( "..child (FusionID %lu).\n", fusion_id( m_world ) );
+               usleep( 400000 );
+               break;
+
+          default:
+               usleep( 100000 );
+               MSG( "...returned from fork() in parent, child pid %d.\n", child_pid );
+
+               MSG( "Initializing dispatch callback...\n" );
+
+               ret = fusion_call_init( &call, dispatch_callback, NULL, m_world );
+               if (ret) {
+                    D_DERROR( ret, "fusion_call_init() failed" );
+                    return ret;
+               }
+
+               MSG( "Setting dispatch callback...\n" );
+
+               ret = fusion_reactor_set_dispatch_callback( reactor, &call, NULL );
+               if (ret) {
+                    D_DERROR( ret, "fusion_reactor_set_dispatch_callback() failed" );
+                    return ret;
+               }
+
+
+               MSG( "Sending message via reactor...\n" );
+               fusion_reactor_dispatch( reactor, &message, true, NULL );
+
+               usleep( 100000 );
+
+               MSG( "Destroying reactor...\n" );
+               fusion_reactor_destroy( reactor );
+               MSG( "...destroyed reactor!\n" );
+
+               usleep( 400000 );
+
+               MSG( "Freeing reactor...\n" );
+               fusion_reactor_free( reactor );
+               MSG( "...freed reactor!\n" );
+
+               break;
+     }
+
+
+
+     MSG( "Exiting from world %d (FusionID %lu, pid %d)...\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+     fusion_exit( m_world, false );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tests/fusion_skirmish.c b/Source/DirectFB/tests/fusion_skirmish.c
new file mode 100755
index 0000000..d12cca8
--- /dev/null
+++ b/Source/DirectFB/tests/fusion_skirmish.c
@@ -0,0 +1,131 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stddef.h>
+
+#include <directfb.h>
+
+#include <direct/build.h>
+#include <direct/debug.h>
+#include <direct/log.h>
+#include <direct/messages.h>
+
+#include <fusion/fusion.h>
+#include <fusion/reactor.h>
+#include <fusion/ref.h>
+
+
+#if DIRECT_BUILD_DEBUGS
+#define MSG(x...)                       \
+do {                                    \
+     direct_debug( x ); \
+} while (0)
+#else
+#define MSG(x...)                       \
+do {                                    \
+} while (0)
+#endif
+
+
+static FusionWorld   *m_world;
+
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult   ret;
+     FusionSkirmish skirmish;
+
+     DirectFBInit( &argc, &argv );
+
+     ret = fusion_enter( -1, 0, FER_MASTER, &m_world );
+     if (ret) {
+          D_DERROR( ret, "fusion_enter() failed" );
+          return ret;
+     }
+
+     MSG( "Entered world %d as master (FusionID %lu, pid %d)\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+
+     MSG( "Initializing skirmish...\n" );
+
+     ret = fusion_skirmish_init( &skirmish, "Test", m_world );
+     if (ret) {
+          D_DERROR( ret, "fusion_skirmish_init() failed\n" );
+          return -1;
+     }
+
+
+     MSG( "Locking skirmish...\n" );
+
+     ret = fusion_skirmish_prevail( &skirmish );
+     if (ret) {
+          D_DERROR( ret, "fusion_skirmish_prevail() failed!\n" );
+          return -2;
+     }
+
+
+     MSG( "Waiting at skirmish...\n" );
+
+     ret = fusion_skirmish_wait( &skirmish, 10 );
+     if (ret != DFB_TIMEOUT) {
+          D_DERROR( ret, "fusion_skirmish_wait() did not timeout!\n" );
+          return -3;
+     }
+
+
+     MSG( "Unlocking skirmish...\n" );
+
+     ret = fusion_skirmish_dismiss( &skirmish );
+     if (ret) {
+          D_DERROR( ret, "fusion_skirmish_dismiss() failed!\n" );
+          return -4;
+     }
+
+
+     MSG( "Exiting from world %d (FusionID %lu, pid %d)...\n",
+          fusion_world_index( m_world ), fusion_id( m_world ), getpid() );
+
+     fusion_exit( m_world, false );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tests/fusion_stream.c b/Source/DirectFB/tests/fusion_stream.c
new file mode 100755
index 0000000..dd86e05
--- /dev/null
+++ b/Source/DirectFB/tests/fusion_stream.c
@@ -0,0 +1,545 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <errno.h>
+#include <netdb.h>
+#include <pthread.h>
+
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+
+#include <direct/messages.h>
+
+#include <fusion/call.h>
+#include <fusion/fusion.h>
+#include <fusion/shm/pool.h>
+
+#define MAX_NUM_BLOCKS 10000
+
+#define SIZE_ALIGNMASK   0x3
+#define ALIGN_SIZE(s)    (((s) + SIZE_ALIGNMASK) & ~SIZE_ALIGNMASK)
+
+/**********************************************************************************************************************/
+
+static int parse_cmdline  ( int    argc,
+                            char  *argv[] );
+static int show_usage     ( void );
+
+/**********************************************************************************************************************/
+
+static inline unsigned long
+get_millis( void )
+{
+     struct timeval tv;
+
+     gettimeofday( &tv, NULL );
+
+     return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+}
+
+/**********************************************************************************************************************/
+
+static unsigned int   bit_rate;
+static bool           run_busy;
+static bool           do_fork;
+static bool           do_thread;
+
+/**********************************************************************************************************************/
+
+static long           block_size = 184;
+static long           num_blocks = 16;
+
+/**********************************************************************************************************************/
+
+static int fuser, fnice, fsystem, fidle, ftotal;
+static int cuser, cnice, csystem, cidle, ctotal;
+static int puser, pnice, psystem, pidle, ptotal;
+static int duser, dnice, dsystem, didle, dtotal;
+
+static int
+read_stat( void )
+{
+     char  dummy[4];
+     int   wa = 0, hi = 0, si = 0;
+     FILE *file;
+
+     puser   = cuser;
+     pnice   = cnice;
+     psystem = csystem;
+     pidle   = cidle;
+     ptotal  = ctotal;
+
+     file = fopen( "/proc/stat", "r" );
+     if (!file) {
+          perror( "Could not open '/proc/stat'" );
+          return 0;
+     }
+
+     if (fscanf( file, "%3s %d %d %d %d %d %d %d", dummy, &cuser, &cnice, &csystem, &cidle, &wa, &hi, &si ) < 4) {
+          fprintf( stderr, "Parsing '/proc/stat' failed!\n" );
+          return 0;
+     }
+
+     fclose( file );
+
+     /* Compatibility with 2.6 split up idle times. */
+     cidle += wa + hi + si;
+
+     /* Count nice as idle. */
+     cidle += cnice;
+     cnice  = 0;
+
+     ctotal  = cuser + cnice + csystem + cidle;
+
+     duser   = cuser - puser;
+     dnice   = cnice - pnice;
+     dsystem = csystem - psystem;
+     didle   = cidle - pidle;
+     dtotal  = ctotal - ptotal;
+
+     if (!ftotal) {
+          fuser   = cuser;
+          fnice   = cnice;
+          fsystem = csystem;
+          fidle   = cidle;
+          ftotal  = ctotal;
+     }
+
+     return 1;
+}
+
+/**********************************************************************************************************************/
+
+static pthread_t       busy_thread;
+static pthread_mutex_t busy_lock  = PTHREAD_MUTEX_INITIALIZER;
+static unsigned int    busy_alive = 1;
+static unsigned int    busy_count;
+
+static void *
+busy_loop( void *arg )
+{
+     setpriority( PRIO_PROCESS, 0, 19 );
+
+     while (busy_alive) {
+          int i;
+
+          for (i=0; i<100000; i++);
+
+          pthread_mutex_lock( &busy_lock );
+
+          busy_count++;
+
+          pthread_mutex_unlock( &busy_lock );
+     }
+
+     return NULL;
+}
+
+/**********************************************************************************************************************/
+
+static FusionCallHandlerResult
+call_handler( int           caller,
+              int           call_arg,
+              void         *call_ptr,
+              void         *ctx,
+              unsigned int  serial,
+              int          *ret_val )
+{
+     static u32 checksum = 0;
+
+     int        i;
+     const u32 *values = call_ptr;
+
+
+     for (i=0; i<block_size/4; i++)
+          checksum += values[i];
+
+     *ret_val = checksum;
+
+     return FCHR_RETURN;
+}
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult         ret;
+     FusionWorld         *world;
+     FusionCall           call = {0};
+     FusionSHMPoolShared *pool;
+     void                *buffer;
+     int           i, max_busy = 0, active = 1;
+     long long     t1 = 0, t2;
+     long long     start       = 0;
+     long long     bytes       = 0;
+     long long     last_bytes  = 0;
+     unsigned long blocks      = 0;
+     unsigned long last_blocks = 0;
+     unsigned long last_busy   = 0;
+     u32           checksum    = 0;
+     bool          produce     = true;
+     int           delay       = 66000;
+
+     if (parse_cmdline( argc, argv ))
+          return -1;
+
+     if (bit_rate) {
+          int blocks_per_sec = (bit_rate * 1024 / 8) / block_size;
+
+          if (blocks_per_sec < 100)
+               delay = 900000 / blocks_per_sec - 2000;
+          else
+               delay = 300000 * 100 / blocks_per_sec;
+
+          num_blocks = bit_rate * 1024 / 8 / block_size * delay / 900000;
+
+          if (num_blocks > MAX_NUM_BLOCKS)
+               num_blocks = MAX_NUM_BLOCKS;
+
+          if (!num_blocks) {
+               num_blocks = 1;
+               delay = 970 * block_size / (bit_rate * 1024 / 8) * 1000 - 2000;
+          }
+     }
+
+     sync();
+
+     if (run_busy) {
+          pthread_create( &busy_thread, NULL, busy_loop, NULL );
+
+          printf( "Calibrating...\n" );
+     
+          pthread_mutex_lock( &busy_lock );
+     
+          for (i=0; i<7; i++) {
+               int busy_rate;
+     
+               busy_count = 0;
+     
+               t1 = get_millis();
+               pthread_mutex_unlock( &busy_lock );
+     
+               usleep( 300000 );
+     
+               pthread_mutex_lock( &busy_lock );
+               t2 = get_millis();
+     
+               busy_rate = busy_count * 1000 / (t2 - t1);
+     
+               if (busy_rate > max_busy)
+                    max_busy = busy_rate;
+          }
+     
+          printf( "Calibrating done. (%d busy counts/sec)\n", max_busy );
+     }
+
+     ret = fusion_enter( -1, 23, FER_MASTER, &world );
+     if (ret)
+          return ret;
+
+     ret = fusion_call_init( &call, call_handler, NULL, world );
+     if (ret)
+          return ret;
+
+     ret = fusion_shm_pool_create( world, "Stream Buffer", block_size + 8192, false, &pool );
+     if (ret)
+          return ret;
+
+     ret = fusion_shm_pool_allocate( pool, block_size, false, true, &buffer );
+     if (ret)
+          return ret;
+
+
+
+     /*
+      * Do the fork() magic!
+      */
+     if (do_fork) {
+          fusion_world_set_fork_action( world, FFA_FORK );
+
+          switch (fork()) {
+               case -1:
+                    D_PERROR( "fork() failed!\n" );
+                    return -1;
+
+               case 0:
+                    /* child continues as the producer */
+                    run_busy = false;
+                    break;
+
+               default:
+                    /* parent is the consumer (callback in Fusion Dispatch thread) */
+                    produce = false;
+
+                    usleep( 50000 );
+          }
+
+          fusion_world_set_fork_action( world, FFA_CLOSE );
+     }
+
+
+     start = t1 = get_millis();
+
+     if (run_busy) {
+          busy_count = 0;
+          pthread_mutex_unlock( &busy_lock );
+     }
+
+#ifdef LINUX_2_4
+     delay -= 10000;
+#endif
+
+     do {
+          if (bit_rate || !produce) {
+               if (delay > 10)
+                    usleep( delay );
+          }
+
+          if (produce) {
+               for (i=0; i<num_blocks; i++) {
+                    int  n;
+                    u32  retsum;
+                    u32 *values = buffer;
+
+                    for (n=0; n<block_size/4; n++) {
+                         values[n] = n;
+                         checksum += n;
+                    }
+
+                    bytes += block_size;
+
+                    fusion_call_execute( &call, do_thread ? FCEF_NODIRECT : FCEF_NONE,
+                                         0, buffer, (int*) &retsum );
+
+                    if (retsum != checksum)
+                         D_ERROR( "Checksum returned by consumer (0x%08x) does not match 0x%08x!\n", retsum, checksum );
+               }
+
+               blocks += num_blocks;
+          }
+
+
+          t2 = get_millis();
+          if (t2 - t1 > 2000) {
+               if (produce) {
+                    long long kbits = 0, avgkbits, total_time, diff_time, diff_bytes;
+
+                    printf( "\n\n\n" );
+
+                    total_time = t2 - start;
+                    diff_time  = t2 - t1;
+                    diff_bytes = bytes - last_bytes;
+
+                    avgkbits   = (long long)bytes * 8LL * 1000LL / (long long)total_time / 1024LL;
+
+                    if (diff_time)
+                         kbits = (long long)diff_bytes * 8LL * 1000LL / (long long)diff_time / 1024LL;
+
+                    printf( "Total Time:       %7lld ms\n", total_time );
+                    printf( "Stream Size:      %7lld kb\n", bytes / 1024 );
+                    printf( "Stream Rate:      %7lld kb/sec -> %lld.%03lld MBit (avg. %lld.%03lld MBit)\n",
+                            kbits / 8,
+                            (kbits * 1000 / 1024) / 1000, (kbits * 1000 / 1024) % 1000,
+                            (avgkbits * 1000 / 1024) / 1000, (avgkbits * 1000 / 1024) % 1000 );
+                    printf( "\n" );
+
+
+                    if (last_bytes && bit_rate) {
+                         long long diff_bytes = (bytes - last_bytes) * 1000 / (t2 - t1);
+                         long long need_bytes = bit_rate * 1024 / 8;
+
+                         if (diff_bytes) {
+                              int new_blocks = (num_blocks * need_bytes + diff_bytes/2) / diff_bytes;
+
+                              num_blocks = (new_blocks + num_blocks + 1) / 2;
+
+                              if (num_blocks > MAX_NUM_BLOCKS)
+                                   num_blocks = MAX_NUM_BLOCKS;
+                         }
+                    }
+
+
+                    read_stat();
+
+                    if (ftotal != ctotal && dtotal) {
+                         int load, aload;
+
+                         load  = 1000 - didle * 1000 / dtotal;
+                         aload = 1000 - (cidle - fidle) * 1000 / (ctotal - ftotal);
+
+                         printf( "Overall Stats\n" );
+                         printf( "  Total Time:      %7lld ms\n", t2 - start );
+                         printf( "  Block Size:      %7ld\n", block_size );
+                         printf( "  Blocks/cycle:    %7ld\n", num_blocks );
+                         printf( "  Blocks/second:   %7lld\n", (blocks - last_blocks) * 1000 / diff_time );
+                         printf( "  Delay:           %7d\n", delay );
+                         printf( "  CPU Load:        %5d.%d %% (avg. %d.%d %%)\n",
+                                 load / 10, load % 10, aload / 10, aload % 10 );
+                    }
+
+
+                    last_bytes  = bytes;
+                    last_blocks = blocks;
+               }
+
+               if (run_busy) {
+                    pthread_mutex_lock( &busy_lock );
+
+                    if (last_busy) {
+                         int busy_diff;
+                         int busy_rate, busy_load;
+                         int abusy_rate, abusy_load;
+
+                         busy_diff = busy_count - last_busy;
+                         busy_rate = max_busy - (busy_diff * 1000 / (t2 - t1));
+                         busy_load = busy_rate * 1000 / max_busy;
+                         abusy_rate = max_busy - (busy_count * 1000 / (t2 - start));
+                         abusy_load = abusy_rate * 1000 / max_busy;
+
+                         printf( "  Real CPU Load:   %5d.%d %% (avg. %d.%d %%)\n",
+                                 busy_load / 10, busy_load % 10,
+                                 abusy_load / 10, abusy_load % 10 );
+                    }
+
+                    last_busy = busy_count;
+
+                    pthread_mutex_unlock( &busy_lock );
+               }
+
+               t1 = t2;
+          }
+     } while (active > 0);
+
+
+     if (run_busy) {
+          busy_alive = 0;
+
+          pthread_join( busy_thread, NULL );
+     }
+
+     return -1;
+}
+
+/**********************************************************************************************************************/
+
+static int
+parse_cmdline( int argc, char *argv[] )
+{
+     int   i;
+     char *end;
+
+     for (i=1; i<argc; i++) {
+          if (!strcmp( argv[i], "-s" )) {
+               if (++i < argc) {
+                    block_size = strtoul( argv[i], &end, 10 );
+
+                    if (end && *end) {
+                         D_ERROR( "Parse error in number '%s'!\n", argv[i] );
+                         return -1;
+                    }
+
+                    if (block_size < 1)
+                         return show_usage();
+               }
+               else
+                    return show_usage();
+          }
+          else if (!strcmp( argv[i], "-b" )) {
+               if (++i < argc) {
+                    bit_rate = strtoul( argv[i], &end, 10 );
+
+                    if (end && *end) {
+                         D_ERROR( "Parse error in number '%s'!\n", argv[i] );
+                         return -1;
+                    }
+               }
+               else
+                    return show_usage();
+          }
+          else if (!strcmp( argv[i], "-B" )) {
+               if (++i < argc) {
+                    bit_rate = strtoul( argv[i], &end, 10 ) * 1024;
+
+                    if (end && *end) {
+                         D_ERROR( "Parse error in number '%s'!\n", argv[i] );
+                         return -1;
+                    }
+               }
+               else
+                    return show_usage();
+          }
+          else if (!strcmp( argv[i], "-c" )) {
+               run_busy = 1;
+          }
+          else if (!strcmp( argv[i], "-f" )) {
+               do_fork = 1;
+          }
+          else if (!strcmp( argv[i], "-t" )) {
+               do_thread = 1;
+          }
+          else
+               return show_usage();
+     }
+
+     return 0;
+}
+
+static int
+show_usage( void )
+{
+     fprintf( stderr, "\n"
+                      "Usage:\n"
+                      "   fusion_stream [options]\n"
+                      "\n"
+                      "Options:\n"
+                      "   -s <1-n>  Size of each block of data\n"
+                      "   -b <0-n>  Designated bit rate in kbit (0 = unlimited)\n"
+                      "   -B <0-n>  Designated bit rate in Mbit (0 = unlimited)\n"
+                      "   -c        Run busy loop counting spare CPU cycles to get real CPU load\n"
+                      "   -f        Fork to have the producer in a separate process\n"
+                      "   -t        Force calls to be handled in a separate thread\n"
+                      "\n"
+              );
+
+     return -1;
+}
+
diff --git a/Source/DirectFB/tests/smiley_test.c b/Source/DirectFB/tests/smiley_test.c
new file mode 100755
index 0000000..aab7993
--- /dev/null
+++ b/Source/DirectFB/tests/smiley_test.c
@@ -0,0 +1,215 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <direct/types.h>
+
+#include <directfb.h>
+
+
+/* macro for a safe call to DirectFB functions */
+#define DFBCHECK(x...)                                           \
+do {                                                             \
+     int err = x;                                                \
+     if (err != DFB_OK) {                                        \
+          fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
+          DirectFBErrorFatal( #x, err );                         \
+     }                                                           \
+} while (0)
+
+
+#define ERROR(x...)                                              \
+do {                                                             \
+     fprintf (stderr, "%s <%i>: ", __FILE__, __LINE__);          \
+        fprintf (stderr, x);                                     \
+        fprintf (stderr, "\n");                                  \
+     exit (-1);                                                  \
+} while (0)
+
+
+static char **fontname_list;
+static int fontname_count;
+
+static IDirectFB             *dfb;
+static IDirectFBEventBuffer  *keybuffer;
+static IDirectFBDisplayLayer *layer;
+static IDirectFBSurface      *surface;
+
+static int show_help         = 0;
+static int show_ascender     = 0;
+static int show_descender    = 0;
+static int show_baseline     = 0;
+static int show_glyphrect    = 0;
+static int show_glyphadvance = 0;
+static int show_glyphorigin  = 0;
+
+static int antialias         = 1;
+static int unicode_mode      = 1;
+
+static DFBEnumerationResult
+encoding_callback( DFBTextEncodingID  id,
+                   const char        *name,
+                   void              *context )
+{
+     printf( "  (%02d) %s\n", id, name );
+
+     return DFENUM_OK;
+}
+
+static void
+render_font_page (IDirectFBSurface *surface,
+                  const char       *fontname1,
+                  const char       *fontname2)
+{
+     DFBFontDescription fontdesc;
+     IDirectFBFont *font1, *font2;
+     int width, height;
+     int bwidth, bheight;
+     int xborder, yborder;
+     int baseoffset;
+     int ascender, descender;
+     char label[32];
+     int i, j;
+
+     surface->GetSize (surface, &width, &height);
+
+     bwidth = width * 7 / 8;
+     bheight = height * 7 / 8;
+
+     xborder = (width - bwidth) / 2;
+     yborder = (height - bheight) / 2;
+
+     fontdesc.flags = DFDESC_ATTRIBUTES;
+     fontdesc.attributes = antialias ? 0 : DFFA_MONOCHROME;
+
+//     DFBCHECK(dfb->CreateFont (dfb, NULL, NULL, &fixedfont));
+//     surface->SetFont (surface, fixedfont);
+
+     fontdesc.flags = DFDESC_HEIGHT | DFDESC_ATTRIBUTES;
+     fontdesc.height = 56;//9 * bheight / glyphs_per_yline / 16;
+     fontdesc.attributes = antialias ? 0 : DFFA_MONOCHROME;
+     fontdesc.attributes |= unicode_mode ? 0 : DFFA_NOCHARMAP;
+
+     if (dfb->CreateFont (dfb, fontname1, &fontdesc, &font1) != DFB_OK) {
+
+          static const char *msg = "failed opening '";
+          char text [strlen(msg) + strlen(fontname1) + 2];
+
+          strcpy (text, msg);
+          strcpy (text + strlen(msg), fontname1);
+          strcpy (text + strlen(msg) + strlen(fontname1), "'");
+          printf("GEG: %s\n", text);
+          surface->SetColor (surface, 0xff, 0x00, 0x00, 0xff);
+          surface->DrawString (surface,
+                               text, -1, width/2, 10, DSTF_TOPCENTER);
+          return;
+     }
+
+     if (dfb->CreateFont (dfb, fontname2, &fontdesc, &font2) != DFB_OK) {
+
+          static const char *msg = "failed opening '";
+          char text [strlen(msg) + strlen(fontname2) + 2];
+
+          strcpy (text, msg);
+          strcpy (text + strlen(msg), fontname2);
+          strcpy (text + strlen(msg) + strlen(fontname2), "'");
+          printf("GEG: %s\n", text);
+          surface->SetColor (surface, 0xff, 0x00, 0x00, 0xff);
+          surface->DrawString (surface,
+                               text, -1, width/2, 10, DSTF_TOPCENTER);
+          return;
+     }
+
+     {
+          static bool done = false;
+
+          if (!done) {
+               printf( "\nEncodings %s\n", fontname1 );
+               font1->EnumEncodings( font1, encoding_callback, NULL );
+               done = true;
+          }
+     }
+
+     {
+          static bool done = false;
+
+          if (!done) {
+               printf( "\nEncodings %s\n", fontname2 );
+               font2->EnumEncodings( font2, encoding_callback, NULL );
+               done = true;
+          }
+     }
+
+     surface->SetFont(surface, font1);
+     surface->DrawString(surface, "Hello", -1, 100, 100, DSTF_LEFT);
+     surface->SetFont(surface, font2);
+     surface->DrawString(surface, "AB", -1, 100, 100, DSTF_LEFT);
+
+     font1->Release (font1);
+     font2->Release (font2);
+}
+
+static void
+cleanup( void )
+{
+     if (keybuffer) keybuffer->Release (keybuffer);
+     if (surface)   surface->Release (surface);
+     if (layer)     layer->Release (layer);
+     if (dfb)       dfb->Release (dfb);
+}
+
+static void
+print_usage( void )
+{
+     printf ("DirectFB Font Viewer version " VERSION "\n\n");
+     printf ("Usage: df_fonts <fontfile> ... <fontfile>\n\n");
+}
+
+int
+main( int argc, char *argv[] )
+{
+     DFBSurfaceDescription surface_desc;
+     DFBInputEvent evt;
+     int first_glyph  = 0;
+     int current_font = 0;
+     int update       = 1;
+
+     if (argc < 2 || strcmp(argv[1], "--help") == 0) {
+          print_usage();
+          return EXIT_FAILURE;
+     }
+
+     fontname_count = argc - 1;
+     fontname_list  = argv + 1;
+
+     DFBCHECK(DirectFBInit(&argc, &argv));
+     DFBCHECK(DirectFBSetOption("bg-none", NULL));
+     DFBCHECK(DirectFBCreate(&dfb));
+
+     atexit (cleanup);
+
+     //dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
+
+     surface_desc.flags = DSDESC_CAPS;
+     surface_desc.caps = DSCAPS_PRIMARY /*| DSCAPS_DOUBLE*/;
+
+     DFBCHECK(dfb->CreateSurface(dfb, &surface_desc, &surface));
+
+     DFBCHECK(dfb->CreateInputEventBuffer(dfb, DICAPS_KEYS,
+                                          DFB_FALSE, &keybuffer));
+
+     while (1) {
+          surface->Clear (surface, 0xff, 0xff, 0xff, 0xff);
+          render_font_page (surface, argv[1], argv[2]);
+          surface->Flip (surface, NULL, DSFLIP_WAITFORSYNC);
+
+          keybuffer->WaitForEvent(keybuffer);
+
+          while (keybuffer->GetEvent(keybuffer, DFB_EVENT(&evt)) == DFB_OK) {
+
+          }
+     }
+
+     return EXIT_SUCCESS;
+}
diff --git a/Source/DirectFB/tools/Makefile.am b/Source/DirectFB/tools/Makefile.am
new file mode 100755
index 0000000..f4ddf15
--- /dev/null
+++ b/Source/DirectFB/tools/Makefile.am
@@ -0,0 +1,109 @@
+## Makefile.am for DirectFB/tools
+
+INCLUDES = \
+	-I$(top_builddir)/lib \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -DDATADIR=\"@DATADIR@\"
+
+AM_CFLAGS = $(FREETYPE_CFLAGS)
+
+if BUILD_DIRECTFB_CSOURCE
+DFB_CSOURCE = directfb-csource
+
+directfb_csource_SOURCES = directfb-csource.c
+directfb_csource_LDADD   = $(LIBPNG)
+endif
+
+if HAVE_LINUX
+LINUXONLY_TOOLS =	\
+	fusion_bench	\
+	raw15toraw24	\
+	raw16toraw24	\
+	raw32toraw24
+endif
+
+if ENABLE_VOODOO
+VOODOO_PROGS = dfbproxy
+endif
+
+if PNG_PROVIDER
+PNG_PROGS = mkdfiff mkdgifft
+endif
+
+if FREETYPE_PROVIDER
+FREETYPE_PROGS = mkdgiff
+endif
+
+bin_PROGRAMS = $(DFB_CSOURCE) \
+	dfbdump dfbfx dfbg dfbinfo dfbinput dfbinspector dfblayer \
+	dfbmaster dfbscreen dfbpenmount $(PNG_PROGS) $(FREETYPE_PROGS) $(VOODOO_PROGS)
+
+noinst_PROGRAMS = $(LINUXONLY_TOOLS)
+
+libdirectfb = ../src/libdirectfb.la
+libfusion = ../lib/fusion/libfusion.la
+libdirect = ../lib/direct/libdirect.la
+libvoodoo = ../lib/voodoo/libvoodoo.la
+
+dfbdump_SOURCES = dfbdump.c
+dfbdump_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo)
+
+dfbg_SOURCES = dfbg.c
+dfbg_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfbinfo_SOURCES = dfbinfo.c
+dfbinfo_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfbinput_SOURCES = dfbinput.c
+dfbinput_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfbinspector_SOURCES = dfbinspector.c
+dfbinspector_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfblayer_SOURCES = dfblayer.c
+dfblayer_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfbmaster_SOURCES = dfbmaster.c
+dfbmaster_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+dfbproxy_SOURCES = dfbproxy.c
+dfbproxy_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo)
+
+dfbscreen_SOURCES = dfbscreen.c
+dfbscreen_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo) $(OSX_LIBS)
+
+#dfbsummon_SOURCES = dfbsummon.c
+#dfbsummon_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo)
+
+dfbpenmount_SOURCES = dfbpenmount.c
+dfbpenmount_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo)
+
+mkdfiff_SOURCES = mkdfiff.c
+mkdfiff_LDADD   = $(LIBPNG) $(libdirect)
+
+mkdgiff_SOURCES = mkdgiff.c
+mkdgiff_LDADD   = $(FREETYPE_LIBS) $(libdirect)
+
+mkdgifft_SOURCES = mkdgifft.cpp
+mkdgifft_LDADD   = $(LIBPNG_LIBS) $(libdirectfb) $(libfusion) $(libdirect)
+
+fusion_bench_SOURCES = fusion_bench.c
+fusion_bench_LDADD   = $(libdirectfb) $(libfusion) $(libdirect) $(libvoodoo)
+
+dfbfx_SOURCES = dfbfx.c
+dfbfx_LDADD   = $(libdirect)
+
+raw15toraw24_SOURCES = raw15toraw24.c
+
+raw16toraw24_SOURCES = raw16toraw24.c
+
+raw32toraw24_SOURCES = raw32toraw24.c
+
+EXTRA_DIST = \
+	README			\
+	gendoc.pl		\
+	mknames.sh
diff --git a/Source/DirectFB/tools/Makefile.in b/Source/DirectFB/tools/Makefile.in
new file mode 100755
index 0000000..942f516
--- /dev/null
+++ b/Source/DirectFB/tools/Makefile.in
@@ -0,0 +1,760 @@
+# 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@
+bin_PROGRAMS = $(am__EXEEXT_1) dfbdump$(EXEEXT) dfbfx$(EXEEXT) \
+	dfbg$(EXEEXT) dfbinfo$(EXEEXT) dfbinput$(EXEEXT) \
+	dfbinspector$(EXEEXT) dfblayer$(EXEEXT) dfbmaster$(EXEEXT) \
+	dfbscreen$(EXEEXT) dfbpenmount$(EXEEXT) $(am__EXEEXT_2) \
+	$(am__EXEEXT_3) $(am__EXEEXT_4)
+noinst_PROGRAMS = $(am__EXEEXT_5)
+subdir = tools
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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 =
+@BUILD_DIRECTFB_CSOURCE_TRUE@am__EXEEXT_1 = directfb-csource$(EXEEXT)
+@PNG_PROVIDER_TRUE@am__EXEEXT_2 = mkdfiff$(EXEEXT)
+@FREETYPE_PROVIDER_TRUE@am__EXEEXT_3 = mkdgiff$(EXEEXT)
+@ENABLE_VOODOO_TRUE@am__EXEEXT_4 = dfbproxy$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+@HAVE_LINUX_TRUE@am__EXEEXT_5 = fusion_bench$(EXEEXT) \
+@HAVE_LINUX_TRUE@	raw15toraw24$(EXEEXT) raw16toraw24$(EXEEXT) \
+@HAVE_LINUX_TRUE@	raw32toraw24$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_dfbdump_OBJECTS = dfbdump.$(OBJEXT)
+dfbdump_OBJECTS = $(am_dfbdump_OBJECTS)
+dfbdump_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+am_dfbfx_OBJECTS = dfbfx.$(OBJEXT)
+dfbfx_OBJECTS = $(am_dfbfx_OBJECTS)
+dfbfx_DEPENDENCIES = $(libdirect)
+am_dfbg_OBJECTS = dfbg.$(OBJEXT)
+dfbg_OBJECTS = $(am_dfbg_OBJECTS)
+am__DEPENDENCIES_1 =
+dfbg_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfbinfo_OBJECTS = dfbinfo.$(OBJEXT)
+dfbinfo_OBJECTS = $(am_dfbinfo_OBJECTS)
+dfbinfo_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfbinput_OBJECTS = dfbinput.$(OBJEXT)
+dfbinput_OBJECTS = $(am_dfbinput_OBJECTS)
+dfbinput_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfbinspector_OBJECTS = dfbinspector.$(OBJEXT)
+dfbinspector_OBJECTS = $(am_dfbinspector_OBJECTS)
+dfbinspector_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfblayer_OBJECTS = dfblayer.$(OBJEXT)
+dfblayer_OBJECTS = $(am_dfblayer_OBJECTS)
+dfblayer_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfbmaster_OBJECTS = dfbmaster.$(OBJEXT)
+dfbmaster_OBJECTS = $(am_dfbmaster_OBJECTS)
+dfbmaster_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am_dfbpenmount_OBJECTS = dfbpenmount.$(OBJEXT)
+dfbpenmount_OBJECTS = $(am_dfbpenmount_OBJECTS)
+dfbpenmount_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+am_dfbproxy_OBJECTS = dfbproxy.$(OBJEXT)
+dfbproxy_OBJECTS = $(am_dfbproxy_OBJECTS)
+dfbproxy_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(libvoodoo)
+am_dfbscreen_OBJECTS = dfbscreen.$(OBJEXT)
+dfbscreen_OBJECTS = $(am_dfbscreen_OBJECTS)
+dfbscreen_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) \
+	$(am__DEPENDENCIES_1)
+am__directfb_csource_SOURCES_DIST = directfb-csource.c
+@BUILD_DIRECTFB_CSOURCE_TRUE@am_directfb_csource_OBJECTS =  \
+@BUILD_DIRECTFB_CSOURCE_TRUE@	directfb-csource.$(OBJEXT)
+directfb_csource_OBJECTS = $(am_directfb_csource_OBJECTS)
+@BUILD_DIRECTFB_CSOURCE_TRUE@directfb_csource_DEPENDENCIES =  \
+@BUILD_DIRECTFB_CSOURCE_TRUE@	$(am__DEPENDENCIES_1)
+am_fusion_bench_OBJECTS = fusion_bench.$(OBJEXT)
+fusion_bench_OBJECTS = $(am_fusion_bench_OBJECTS)
+fusion_bench_DEPENDENCIES = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+am_mkdfiff_OBJECTS = mkdfiff.$(OBJEXT)
+mkdfiff_OBJECTS = $(am_mkdfiff_OBJECTS)
+mkdfiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libdirect)
+am_mkdgiff_OBJECTS = mkdgiff.$(OBJEXT)
+mkdgiff_OBJECTS = $(am_mkdgiff_OBJECTS)
+mkdgiff_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libdirect)
+am_raw15toraw24_OBJECTS = raw15toraw24.$(OBJEXT)
+raw15toraw24_OBJECTS = $(am_raw15toraw24_OBJECTS)
+raw15toraw24_LDADD = $(LDADD)
+am_raw16toraw24_OBJECTS = raw16toraw24.$(OBJEXT)
+raw16toraw24_OBJECTS = $(am_raw16toraw24_OBJECTS)
+raw16toraw24_LDADD = $(LDADD)
+am_raw32toraw24_OBJECTS = raw32toraw24.$(OBJEXT)
+raw32toraw24_OBJECTS = $(am_raw32toraw24_OBJECTS)
+raw32toraw24_LDADD = $(LDADD)
+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 = $(dfbdump_SOURCES) $(dfbfx_SOURCES) $(dfbg_SOURCES) \
+	$(dfbinfo_SOURCES) $(dfbinput_SOURCES) $(dfbinspector_SOURCES) \
+	$(dfblayer_SOURCES) $(dfbmaster_SOURCES) \
+	$(dfbpenmount_SOURCES) $(dfbproxy_SOURCES) \
+	$(dfbscreen_SOURCES) $(directfb_csource_SOURCES) \
+	$(fusion_bench_SOURCES) $(mkdfiff_SOURCES) $(mkdgiff_SOURCES) \
+	$(raw15toraw24_SOURCES) $(raw16toraw24_SOURCES) \
+	$(raw32toraw24_SOURCES)
+DIST_SOURCES = $(dfbdump_SOURCES) $(dfbfx_SOURCES) $(dfbg_SOURCES) \
+	$(dfbinfo_SOURCES) $(dfbinput_SOURCES) $(dfbinspector_SOURCES) \
+	$(dfblayer_SOURCES) $(dfbmaster_SOURCES) \
+	$(dfbpenmount_SOURCES) $(dfbproxy_SOURCES) \
+	$(dfbscreen_SOURCES) $(am__directfb_csource_SOURCES_DIST) \
+	$(fusion_bench_SOURCES) $(mkdfiff_SOURCES) $(mkdgiff_SOURCES) \
+	$(raw15toraw24_SOURCES) $(raw16toraw24_SOURCES) \
+	$(raw32toraw24_SOURCES)
+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)/lib \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include	\
+	-I$(top_srcdir)/lib	\
+	-I$(top_srcdir)/src
+
+AM_CPPFLAGS = -DDATADIR=\"@DATADIR@\"
+AM_CFLAGS = $(FREETYPE_CFLAGS)
+@BUILD_DIRECTFB_CSOURCE_TRUE@DFB_CSOURCE = directfb-csource
+@BUILD_DIRECTFB_CSOURCE_TRUE@directfb_csource_SOURCES = directfb-csource.c
+@BUILD_DIRECTFB_CSOURCE_TRUE@directfb_csource_LDADD = $(LIBPNG)
+@HAVE_LINUX_TRUE@LINUXONLY_TOOLS = \
+@HAVE_LINUX_TRUE@	fusion_bench	\
+@HAVE_LINUX_TRUE@	raw15toraw24	\
+@HAVE_LINUX_TRUE@	raw16toraw24	\
+@HAVE_LINUX_TRUE@	raw32toraw24
+
+@ENABLE_VOODOO_TRUE@VOODOO_PROGS = dfbproxy
+@PNG_PROVIDER_TRUE@PNG_PROGS = mkdfiff
+@FREETYPE_PROVIDER_TRUE@FREETYPE_PROGS = mkdgiff
+libdirectfb = ../src/libdirectfb.la
+libfusion = ../lib/fusion/libfusion.la
+libdirect = ../lib/direct/libdirect.la
+libvoodoo = ../lib/voodoo/libvoodoo.la
+dfbdump_SOURCES = dfbdump.c
+dfbdump_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+dfbg_SOURCES = dfbg.c
+dfbg_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfbinfo_SOURCES = dfbinfo.c
+dfbinfo_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfbinput_SOURCES = dfbinput.c
+dfbinput_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfbinspector_SOURCES = dfbinspector.c
+dfbinspector_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfblayer_SOURCES = dfblayer.c
+dfblayer_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfbmaster_SOURCES = dfbmaster.c
+dfbmaster_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+dfbproxy_SOURCES = dfbproxy.c
+dfbproxy_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(libvoodoo)
+dfbscreen_SOURCES = dfbscreen.c
+dfbscreen_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect) $(OSX_LIBS)
+
+#dfbsummon_SOURCES = dfbsummon.c
+#dfbsummon_LDADD   = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+dfbpenmount_SOURCES = dfbpenmount.c
+dfbpenmount_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+mkdfiff_SOURCES = mkdfiff.c
+mkdfiff_LDADD = $(LIBPNG) $(libdirect)
+mkdgiff_SOURCES = mkdgiff.c
+mkdgiff_LDADD = $(FREETYPE_LIBS) $(libdirect)
+fusion_bench_SOURCES = fusion_bench.c
+fusion_bench_LDADD = $(libdirectfb) $(libfusion) $(libvoodoo) $(libdirect)
+dfbfx_SOURCES = dfbfx.c
+dfbfx_LDADD = $(libdirect)
+raw15toraw24_SOURCES = raw15toraw24.c
+raw16toraw24_SOURCES = raw16toraw24.c
+raw32toraw24_SOURCES = raw32toraw24.c
+EXTRA_DIST = \
+	README			\
+	gendoc.pl		\
+	mknames.sh
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  tools/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  tools/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-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+dfbdump$(EXEEXT): $(dfbdump_OBJECTS) $(dfbdump_DEPENDENCIES) 
+	@rm -f dfbdump$(EXEEXT)
+	$(LINK) $(dfbdump_OBJECTS) $(dfbdump_LDADD) $(LIBS)
+dfbfx$(EXEEXT): $(dfbfx_OBJECTS) $(dfbfx_DEPENDENCIES) 
+	@rm -f dfbfx$(EXEEXT)
+	$(LINK) $(dfbfx_OBJECTS) $(dfbfx_LDADD) $(LIBS)
+dfbg$(EXEEXT): $(dfbg_OBJECTS) $(dfbg_DEPENDENCIES) 
+	@rm -f dfbg$(EXEEXT)
+	$(LINK) $(dfbg_OBJECTS) $(dfbg_LDADD) $(LIBS)
+dfbinfo$(EXEEXT): $(dfbinfo_OBJECTS) $(dfbinfo_DEPENDENCIES) 
+	@rm -f dfbinfo$(EXEEXT)
+	$(LINK) $(dfbinfo_OBJECTS) $(dfbinfo_LDADD) $(LIBS)
+dfbinput$(EXEEXT): $(dfbinput_OBJECTS) $(dfbinput_DEPENDENCIES) 
+	@rm -f dfbinput$(EXEEXT)
+	$(LINK) $(dfbinput_OBJECTS) $(dfbinput_LDADD) $(LIBS)
+dfbinspector$(EXEEXT): $(dfbinspector_OBJECTS) $(dfbinspector_DEPENDENCIES) 
+	@rm -f dfbinspector$(EXEEXT)
+	$(LINK) $(dfbinspector_OBJECTS) $(dfbinspector_LDADD) $(LIBS)
+dfblayer$(EXEEXT): $(dfblayer_OBJECTS) $(dfblayer_DEPENDENCIES) 
+	@rm -f dfblayer$(EXEEXT)
+	$(LINK) $(dfblayer_OBJECTS) $(dfblayer_LDADD) $(LIBS)
+dfbmaster$(EXEEXT): $(dfbmaster_OBJECTS) $(dfbmaster_DEPENDENCIES) 
+	@rm -f dfbmaster$(EXEEXT)
+	$(LINK) $(dfbmaster_OBJECTS) $(dfbmaster_LDADD) $(LIBS)
+dfbpenmount$(EXEEXT): $(dfbpenmount_OBJECTS) $(dfbpenmount_DEPENDENCIES) 
+	@rm -f dfbpenmount$(EXEEXT)
+	$(LINK) $(dfbpenmount_OBJECTS) $(dfbpenmount_LDADD) $(LIBS)
+dfbproxy$(EXEEXT): $(dfbproxy_OBJECTS) $(dfbproxy_DEPENDENCIES) 
+	@rm -f dfbproxy$(EXEEXT)
+	$(LINK) $(dfbproxy_OBJECTS) $(dfbproxy_LDADD) $(LIBS)
+dfbscreen$(EXEEXT): $(dfbscreen_OBJECTS) $(dfbscreen_DEPENDENCIES) 
+	@rm -f dfbscreen$(EXEEXT)
+	$(LINK) $(dfbscreen_OBJECTS) $(dfbscreen_LDADD) $(LIBS)
+directfb-csource$(EXEEXT): $(directfb_csource_OBJECTS) $(directfb_csource_DEPENDENCIES) 
+	@rm -f directfb-csource$(EXEEXT)
+	$(LINK) $(directfb_csource_OBJECTS) $(directfb_csource_LDADD) $(LIBS)
+fusion_bench$(EXEEXT): $(fusion_bench_OBJECTS) $(fusion_bench_DEPENDENCIES) 
+	@rm -f fusion_bench$(EXEEXT)
+	$(LINK) $(fusion_bench_OBJECTS) $(fusion_bench_LDADD) $(LIBS)
+mkdfiff$(EXEEXT): $(mkdfiff_OBJECTS) $(mkdfiff_DEPENDENCIES) 
+	@rm -f mkdfiff$(EXEEXT)
+	$(LINK) $(mkdfiff_OBJECTS) $(mkdfiff_LDADD) $(LIBS)
+mkdgiff$(EXEEXT): $(mkdgiff_OBJECTS) $(mkdgiff_DEPENDENCIES) 
+	@rm -f mkdgiff$(EXEEXT)
+	$(LINK) $(mkdgiff_OBJECTS) $(mkdgiff_LDADD) $(LIBS)
+raw15toraw24$(EXEEXT): $(raw15toraw24_OBJECTS) $(raw15toraw24_DEPENDENCIES) 
+	@rm -f raw15toraw24$(EXEEXT)
+	$(LINK) $(raw15toraw24_OBJECTS) $(raw15toraw24_LDADD) $(LIBS)
+raw16toraw24$(EXEEXT): $(raw16toraw24_OBJECTS) $(raw16toraw24_DEPENDENCIES) 
+	@rm -f raw16toraw24$(EXEEXT)
+	$(LINK) $(raw16toraw24_OBJECTS) $(raw16toraw24_LDADD) $(LIBS)
+raw32toraw24$(EXEEXT): $(raw32toraw24_OBJECTS) $(raw32toraw24_DEPENDENCIES) 
+	@rm -f raw32toraw24$(EXEEXT)
+	$(LINK) $(raw32toraw24_OBJECTS) $(raw32toraw24_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbdump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbfx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbinspector.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfblayer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbmaster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbpenmount.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbproxy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfbscreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/directfb-csource.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fusion_bench.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdfiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdgiff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw15toraw24.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw16toraw24.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw32toraw24.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+	clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS
+
+# 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/tools/README b/Source/DirectFB/tools/README
new file mode 100755
index 0000000..6fc0f32
--- /dev/null
+++ b/Source/DirectFB/tools/README
@@ -0,0 +1,24 @@
+This directory holds some tools that you might find useful ...
+
+  dfb_static_build_example  is a shell script that shows how to create 
+        a statically linked DirectFB application. Modify the script to
+        adapt it to your needs.
+
+  dfbdump  is a simple debugging tool for DirectFB that shows a list of
+        surfaces and windows. It needs the multi-application core.
+
+  dfbg  is a utility to configure the background of the DirectFB desktop.
+        It's only useful with the multi-application core. Have a look at
+        the dfbg man-page for more infos. 
+
+  directfb-csource  creates header files from PNG images. Check the
+        directfb-csource man-page for more details.
+
+  gendoc.pl  is a Perl script used to generate HTML documentation from
+	the DirectFB header files.
+
+  raw16toraw24, raw15toraw24 and raw32toraw24  are utilities that help
+        to create screenshots from applications running on the Linux
+        frame buffer. See the file README.screenshots in the toplevel
+        directory to learn how to use them.
+
diff --git a/Source/DirectFB/tools/application.lst b/Source/DirectFB/tools/application.lst
new file mode 100755
index 0000000..0d24fe0
--- /dev/null
+++ b/Source/DirectFB/tools/application.lst
@@ -0,0 +1,15 @@
+# Application Name; executable; arguments
+#PluggIt; ./pluggit; -r 1280x720 -f RGB16 -A 100 -H 20 -F 10
+Doom PIP; ./doom; --destination 0.5,0.0-0.5x0.5 
+Doom Full Screen; ./doom
+Emu Odyssey; ./emuodd
+Emu Colecovision; ./emucol
+Emu VCS; ./emuvcs
+Emu Gameboy; ./emugbo
+Emu SMS; ./emusms
+Emu Gamegear; ./emugg
+Emu Genesis; ./emugen
+Emu PCEngine; ./emupce
+Emu MAME; ./emumame
+
+
diff --git a/Source/DirectFB/tools/dfbdump.c b/Source/DirectFB/tools/dfbdump.c
new file mode 100755
index 0000000..c8f89b2
--- /dev/null
+++ b/Source/DirectFB/tools/dfbdump.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.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+#include <direct/clock.h>
+#include <direct/debug.h>
+
+#include <fusion/build.h>
+#include <fusion/fusion.h>
+#include <fusion/object.h>
+#include <fusion/ref.h>
+#include <fusion/shmalloc.h>
+#include <fusion/shm/shm.h>
+#include <fusion/shm/shm_internal.h>
+
+#include <core/core.h>
+#include <core/layer_control.h>
+#include <core/layer_context.h>
+#include <core/layers.h>
+#include <core/layers_internal.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/surface_pool.h>
+#include <core/windows.h>
+#include <core/windowstack.h>
+#include <core/windows_internal.h>
+#include <core/wm.h>
+
+static DirectFBPixelFormatNames( format_names );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int video;
+     int system;
+     int presys;
+} MemoryUsage;
+
+/**********************************************************************************************************************/
+
+static IDirectFB *dfb;
+
+static MemoryUsage mem;
+
+static bool show_shm;
+static bool show_pools;
+static bool show_allocs;
+static int  dump_layer;       /* ref or -1 (all) or 0 (none) */
+static int  dump_surface;     /* ref or -1 (all) or 0 (none) */
+
+/**********************************************************************************************************************/
+
+static DFBBoolean parse_command_line( int argc, char *argv[] );
+
+/**********************************************************************************************************************/
+
+static inline int
+buffer_size( CoreSurface *surface, CoreSurfaceBuffer *buffer, bool video )
+{
+     int                    i, mem = 0;
+     CoreSurfaceAllocation *allocation;
+
+     fusion_vector_foreach (allocation, i, buffer->allocs) {
+          int size = allocation->size;
+          if (allocation->flags & CSALF_ONEFORALL)
+               size /= surface->num_buffers;
+          if (video) {
+               if (allocation->access[CSAID_GPU])
+                    mem += size;
+          }
+          else if (!allocation->access[CSAID_GPU])
+               mem += size;
+     }
+
+     return mem;
+}
+
+static int
+buffer_sizes( CoreSurface *surface, bool video )
+{
+     int i, mem = 0;
+
+     for (i=0; i<surface->num_buffers; i++) {
+          CoreSurfaceBuffer *buffer = surface->buffers[i];
+
+          mem += buffer_size( surface, buffer, video );
+     }
+
+     return mem;
+}
+
+static int
+buffer_locks( CoreSurface *surface, bool video )
+{
+     int i, locks = 0;
+
+     for (i=0; i<surface->num_buffers; i++) {
+          CoreSurfaceBuffer *buffer = surface->buffers[i];
+
+          locks += buffer->locked;
+     }
+
+     return locks;
+}
+
+static bool
+surface_callback( FusionObjectPool *pool,
+                  FusionObject     *object,
+                  void             *ctx )
+{
+     DirectResult ret;
+     int          i;
+     int          refs;
+     CoreSurface *surface = (CoreSurface*) object;
+     MemoryUsage *mem     = ctx;
+     int          vmem;
+     int          smem;
+
+     if (object->state != FOS_ACTIVE)
+          return true;
+
+     ret = fusion_ref_stat( &object->ref, &refs );
+     if (ret) {
+          printf( "Fusion error %d!\n", ret );
+          return false;
+     }
+
+     if (dump_surface && ((dump_surface < 0 && surface->type & CSTF_SHARED) ||
+                          (dump_surface == object->ref.multi.id)) && surface->num_buffers)
+     {
+          char buf[32];
+
+          snprintf( buf, sizeof(buf), "dfb_surface_0x%08x", object->ref.multi.id );
+
+          dfb_surface_dump_buffer( surface, CSBR_FRONT, ".", buf );
+     }
+
+#if FUSION_BUILD_MULTI
+     printf( "0x%08x [%3lx] : ", object->ref.multi.id, object->ref.multi.creator );
+#else
+     printf( "N/A              : " );
+#endif
+
+     printf( "%3d   ", refs );
+
+     printf( "%4d x %4d   ", surface->config.size.w, surface->config.size.h );
+
+     for (i=0; format_names[i].format; i++) {
+          if (surface->config.format == format_names[i].format)
+               printf( "%8s ", format_names[i].name );
+     }
+
+     vmem = buffer_sizes( surface, true );
+     smem = buffer_sizes( surface, false );
+
+     mem->video += vmem;
+
+     /* FIXME: assumes all buffers have this flag (or none) */
+     /*if (surface->front_buffer->flags & SBF_FOREIGN_SYSTEM)
+          mem->presys += smem;
+     else*/
+          mem->system += smem;
+
+     if (vmem && vmem < 1024)
+          vmem = 1024;
+
+     if (smem && smem < 1024)
+          smem = 1024;
+
+     printf( "%5dk%c  ", vmem >> 10, buffer_locks( surface, true ) ? '*' : ' ' );
+     printf( "%5dk%c  ", smem >> 10, buffer_locks( surface, false ) ? '*' : ' ' );
+
+     /* FIXME: assumes all buffers have this flag (or none) */
+//     if (surface->front_buffer->flags & SBF_FOREIGN_SYSTEM)
+//          printf( "preallocated " );
+
+     if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          printf( "system only  " );
+
+     if (surface->config.caps & DSCAPS_VIDEOONLY)
+          printf( "video only   " );
+
+     if (surface->config.caps & DSCAPS_INTERLACED)
+          printf( "interlaced   " );
+
+     if (surface->config.caps & DSCAPS_DOUBLE)
+          printf( "double       " );
+
+     if (surface->config.caps & DSCAPS_TRIPLE)
+          printf( "triple       " );
+
+     if (surface->config.caps & DSCAPS_PREMULTIPLIED)
+          printf( "premultiplied" );
+
+     printf( "\n" );
+
+     return true;
+}
+
+static void
+dump_surfaces( void )
+{
+     printf( "\n"
+             "-----------------------------[ Surfaces ]-------------------------------------\n" );
+     printf( "Reference   FID  . Refs  Width Height  Format     Video   System  Capabilities\n" );
+     printf( "------------------------------------------------------------------------------\n" );
+
+     dfb_core_enum_surfaces( NULL, surface_callback, &mem );
+
+     printf( "                                                ------   ------\n" );
+     printf( "                                               %6dk  %6dk   -> %dk total\n",
+             mem.video >> 10, (mem.system + mem.presys) >> 10,
+             (mem.video + mem.system + mem.presys) >> 10);
+}
+
+/**********************************************************************************************************************/
+
+static DFBEnumerationResult
+alloc_callback( CoreSurfaceAllocation *alloc,
+                void                  *ctx )
+{
+     int                i, index;
+     CoreSurface       *surface;
+     CoreSurfaceBuffer *buffer;
+
+     D_MAGIC_ASSERT( alloc, CoreSurfaceAllocation );
+
+     buffer  = alloc->buffer;
+     D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+     surface = buffer->surface;
+     D_MAGIC_ASSERT( surface, CoreSurface );
+
+     printf( "%9lu %8d  ", alloc->offset, alloc->size );
+
+     printf( "%4d x %4d   ", surface->config.size.w, surface->config.size.h );
+
+     for (i=0; format_names[i].format; i++) {
+          if (surface->config.format == format_names[i].format)
+               printf( "%8s ", format_names[i].name );
+     }
+
+     index = dfb_surface_buffer_index( alloc->buffer );
+
+     printf( " %-5s ",
+             (dfb_surface_get_buffer( surface, CSBR_FRONT ) == buffer) ? "front" :
+             (dfb_surface_get_buffer( surface, CSBR_BACK  ) == buffer) ? "back"  :
+             (dfb_surface_get_buffer( surface, CSBR_IDLE  ) == buffer) ? "idle"  : "" );
+
+     printf( direct_serial_check(&alloc->serial, &buffer->serial) ? " * " : "   " );
+
+     printf( "%d  %2lu  ", fusion_vector_size( &buffer->allocs ), surface->resource_id );
+
+     if (surface->type & CSTF_SHARED)
+          printf( "SHARED  " );
+     else
+          printf( "PRIVATE " );
+
+     if (surface->type & CSTF_LAYER)
+          printf( "LAYER " );
+
+     if (surface->type & CSTF_WINDOW)
+          printf( "WINDOW " );
+
+     if (surface->type & CSTF_CURSOR)
+          printf( "CURSOR " );
+
+     if (surface->type & CSTF_FONT)
+          printf( "FONT " );
+
+     printf( " " );
+
+     if (surface->type & CSTF_INTERNAL)
+          printf( "INTERNAL " );
+
+     if (surface->type & CSTF_EXTERNAL)
+          printf( "EXTERNAL " );
+
+     printf( " " );
+
+     if (surface->config.caps & DSCAPS_SYSTEMONLY)
+          printf( "system only  " );
+
+     if (surface->config.caps & DSCAPS_VIDEOONLY)
+          printf( "video only   " );
+
+     if (surface->config.caps & DSCAPS_INTERLACED)
+          printf( "interlaced   " );
+
+     if (surface->config.caps & DSCAPS_DOUBLE)
+          printf( "double       " );
+
+     if (surface->config.caps & DSCAPS_TRIPLE)
+          printf( "triple       " );
+
+     if (surface->config.caps & DSCAPS_PREMULTIPLIED)
+          printf( "premultiplied" );
+
+     printf( "\n" );
+
+     return DFENUM_OK;
+}
+
+static DFBEnumerationResult
+surface_pool_callback( CoreSurfacePool *pool,
+                       void            *ctx )
+{
+     int length;
+
+     printf( "\n" );
+     printf( "--------------------[ Surface Buffer Allocations in %s ]-------------------%n\n", pool->desc.name, &length );
+     printf( "Offset    Length   Width Height     Format  Role  Up nA ID  Usage   Type / Storage / Caps\n" );
+
+     while (length--)
+          putc( '-', stdout );
+
+     printf( "\n" );
+
+     dfb_surface_pool_enumerate( pool, alloc_callback, NULL );
+
+     return DFENUM_OK;
+}
+
+static void
+dump_surface_pools( void )
+{
+     dfb_surface_pools_enumerate( surface_pool_callback, NULL );
+}
+
+/**********************************************************************************************************************/
+
+static DFBEnumerationResult
+surface_pool_info_callback( CoreSurfacePool *pool,
+                       void            *ctx )
+{
+     int                    i;
+     unsigned long          total = 0;
+     CoreSurfaceAllocation *alloc;
+
+     fusion_vector_foreach (alloc, i, pool->allocs)
+          total += alloc->size;
+
+     printf( "%-20s ", pool->desc.name );
+
+     switch (pool->desc.priority) {
+          case CSPP_DEFAULT:
+               printf( "DEFAULT  " );
+               break;
+
+          case CSPP_PREFERED:
+               printf( "PREFERED " );
+               break;
+
+          case CSPP_ULTIMATE:
+               printf( "ULTIMATE " );
+               break;
+
+          default:
+               printf( "unknown  " );
+               break;
+     }
+
+     printf( "%6lu/%6luk  ", total / 1024, pool->desc.size / 1024 );
+
+     if (pool->desc.types & CSTF_SHARED)
+          printf( "* " );
+     else
+          printf( "  " );
+
+
+     if (pool->desc.types & CSTF_INTERNAL)
+          printf( "INT " );
+
+     if (pool->desc.types & CSTF_EXTERNAL)
+          printf( "EXT " );
+
+     if (!(pool->desc.types & (CSTF_INTERNAL | CSTF_EXTERNAL)))
+          printf( "    " );
+
+
+     if (pool->desc.types & CSTF_LAYER)
+          printf( "LAYER " );
+     else
+          printf( "      " );
+
+     if (pool->desc.types & CSTF_WINDOW)
+          printf( "WINDOW " );
+     else
+          printf( "       " );
+
+     if (pool->desc.types & CSTF_CURSOR)
+          printf( "CURSOR " );
+     else
+          printf( "       " );
+
+     if (pool->desc.types & CSTF_FONT)
+          printf( "FONT " );
+     else
+          printf( "     " );
+
+
+     for (i=CSAID_CPU; i<=CSAID_GPU; i++) {
+          printf( " %c%c%c",
+                  (pool->desc.access[i] & CSAF_READ)   ? 'r' : '-',
+                  (pool->desc.access[i] & CSAF_WRITE)  ? 'w' : '-',
+                  (pool->desc.access[i] & CSAF_SHARED) ? 's' : '-' );
+     }
+
+     for (i=CSAID_LAYER0; i<=CSAID_LAYER2; i++) {
+          printf( " %c%c%c",
+                  (pool->desc.access[i] & CSAF_READ)   ? 'r' : '-',
+                  (pool->desc.access[i] & CSAF_WRITE)  ? 'w' : '-',
+                  (pool->desc.access[i] & CSAF_SHARED) ? 's' : '-' );
+     }
+
+     printf( "\n" );
+
+     return DFENUM_OK;
+}
+
+static void
+dump_surface_pool_info( void )
+{
+     printf( "\n" );
+     printf( "-------------------------------------[ Surface Buffer Pools ]------------------------------------\n" );
+     printf( "Name                 Priority   Used/Capacity S I/E Resource Type Support     CPU GPU Layer 0 - 2\n" );
+     printf( "-------------------------------------------------------------------------------------------------\n" );
+
+     dfb_surface_pools_enumerate( surface_pool_info_callback, NULL );
+}
+
+/**********************************************************************************************************************/
+
+static bool
+context_callback( FusionObjectPool *pool,
+                  FusionObject     *object,
+                  void             *ctx )
+{
+     DirectResult       ret;
+     int                i;
+     int                refs;
+     int                level;
+     CoreLayer         *layer   = (CoreLayer*) ctx;
+     CoreLayerContext  *context = (CoreLayerContext*) object;
+     CoreLayerRegion   *region  = NULL;
+     CoreSurface       *surface = NULL;
+
+     if (object->state != FOS_ACTIVE)
+          return true;
+
+     if (context->layer_id != dfb_layer_id( layer ))
+          return true;
+
+     ret = fusion_ref_stat( &object->ref, &refs );
+     if (ret) {
+          printf( "Fusion error %d!\n", ret );
+          return false;
+     }
+
+     if (dump_layer && (dump_layer < 0 || dump_layer == object->ref.multi.id)) {
+          if (dfb_layer_context_get_primary_region( context, false, ®ion ) == DFB_OK) {
+               if (dfb_layer_region_get_surface( region, &surface ) == DFB_OK) {
+                    if (surface->num_buffers) {
+                         char buf[32];
+                         
+                         snprintf( buf, sizeof(buf), "dfb_layer_context_0x%08x", object->ref.multi.id );
+
+                         dfb_surface_dump_buffer( surface, CSBR_FRONT, ".", buf );
+                    }
+
+                    dfb_surface_unref( surface );
+               }
+          }
+     }
+
+#if FUSION_BUILD_MULTI
+     printf( "0x%08x [%3lx] : ", object->ref.multi.id, object->ref.multi.creator );
+#else
+     printf( "N/A              : " );
+#endif
+
+     printf( "%3d   ", refs );
+
+     printf( "%4d x %4d  ", context->config.width, context->config.height );
+
+     for (i=0; format_names[i].format; i++) {
+          if (context->config.pixelformat == format_names[i].format) {
+               printf( "%-8s ", format_names[i].name );
+               break;
+          }
+     }
+
+     if (!format_names[i].format)
+          printf( "unknown  " );
+
+     printf( "%.1f, %.1f -> %.1f, %.1f   ",
+             context->screen.location.x,  context->screen.location.y,
+             context->screen.location.x + context->screen.location.w,
+             context->screen.location.y + context->screen.location.h );
+
+     printf( "%2d     ", fusion_vector_size( &context->regions ) );
+
+     printf( context->active ? "(*)    " : "       " );
+
+     if (context == layer->shared->contexts.primary)
+          printf( "SHARED   " );
+     else
+          printf( "PRIVATE  " );
+
+     if (context->rotation)
+          printf( "ROTATED %d ", context->rotation);
+
+     if (dfb_layer_get_level( layer, &level ))
+          printf( "N/A" );
+     else
+          printf( "%3d", level );
+
+     printf( "\n" );
+
+     return true;
+}
+
+static void
+dump_contexts( CoreLayer *layer )
+{
+     if (fusion_vector_size( &layer->shared->contexts.stack ) == 0)
+          return;
+
+     printf( "\n"
+             "----------------------------------[ Contexts of Layer %d ]----------------------------------------\n", dfb_layer_id( layer ));
+     printf( "Reference   FID  . Refs  Width Height Format   Location on screen  Regions  Active  Info    Level\n" );
+     printf( "-------------------------------------------------------------------------------------------------\n" );
+
+     dfb_core_enum_layer_contexts( NULL, context_callback, layer );
+}
+
+static DFBEnumerationResult
+window_callback( CoreWindow *window,
+                 void       *ctx )
+{
+     DirectResult      ret;
+     int               refs;
+     CoreWindowConfig *config = &window->config;
+     DFBRectangle     *bounds = &config->bounds;
+
+     ret = fusion_ref_stat( &window->object.ref, &refs );
+     if (ret) {
+          printf( "Fusion error %d!\n", ret );
+          return DFENUM_OK;
+     }
+
+#if FUSION_BUILD_MULTI
+     printf( "0x%08x [%3lx] : ", window->object.ref.multi.id, window->object.ref.multi.creator );
+#else
+     printf( "N/A              : " );
+#endif
+
+     printf( "%3d   ", refs );
+
+     printf( "%4d, %4d   ", bounds->x, bounds->y );
+
+     printf( "%4d x %4d    ", bounds->w, bounds->h );
+
+     printf( "0x%02x ", config->opacity );
+
+     printf( "%5d  ", window->id );
+
+     switch (config->stacking) {
+          case DWSC_UPPER:
+               printf( "^  " );
+               break;
+          case DWSC_MIDDLE:
+               printf( "-  " );
+               break;
+          case DWSC_LOWER:
+               printf( "v  " );
+               break;
+          default:
+               printf( "?  " );
+               break;
+     }
+
+     if (window->caps & DWCAPS_ALPHACHANNEL)
+          printf( "alphachannel   " );
+
+     if (window->caps & DWCAPS_INPUTONLY)
+          printf( "input only     " );
+
+     if (window->caps & DWCAPS_DOUBLEBUFFER)
+          printf( "double buffer  " );
+
+     if (config->options & DWOP_GHOST)
+          printf( "GHOST          " );
+
+     if (DFB_WINDOW_FOCUSED( window ))
+          printf( "FOCUSED        " );
+
+     if (DFB_WINDOW_DESTROYED( window ))
+          printf( "DESTROYED      " );
+
+     if (window->config.rotation)
+          printf( "ROTATED %d     ", window->config.rotation);
+
+     printf( "\n" );
+
+     return DFENUM_OK;
+}
+
+static void
+dump_windows( CoreLayer *layer )
+{
+     DFBResult         ret;
+     CoreLayerShared  *shared;
+     CoreLayerContext *context;
+     CoreWindowStack  *stack;
+
+     shared = layer->shared;
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret) {
+          D_DERROR( ret, "DirectFB/Dump: Could not lock the shared layer data!\n" );
+          return;
+     }
+
+     context = layer->shared->contexts.primary;
+     if (!context) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return;
+     }
+
+     stack = dfb_layer_context_windowstack( context );
+     if (!stack) {
+          fusion_skirmish_dismiss( &shared->lock );
+          return;
+     }
+
+     dfb_windowstack_lock( stack );
+
+     if (stack->num) {
+          printf( "\n"
+                  "-----------------------------------[ Windows of Layer %d ]-----------------------------------------\n", dfb_layer_id( layer ) );
+          printf( "Reference   FID  . Refs     X     Y   Width Height Opacity   ID     Capabilities   State & Options\n" );
+          printf( "--------------------------------------------------------------------------------------------------\n" );
+
+          dfb_wm_enum_windows( stack, window_callback, NULL );
+     }
+
+     dfb_windowstack_unlock( stack );
+
+     fusion_skirmish_dismiss( &shared->lock );
+}
+
+static DFBEnumerationResult
+layer_callback( CoreLayer *layer,
+                void      *ctx)
+{
+     dump_windows( layer );
+     dump_contexts( layer );
+
+     return DFENUM_OK;
+}
+
+static void
+dump_layers( void )
+{
+     dfb_layers_enumerate( layer_callback, NULL );
+}
+
+/**********************************************************************************************************************/
+
+#if FUSION_BUILD_MULTI
+static DirectEnumerationResult
+dump_shmpool( FusionSHMPool *pool,
+              void          *ctx )
+{
+     DFBResult     ret;
+     SHMemDesc    *desc;
+     unsigned int  total = 0;
+     int           length;
+     FusionSHMPoolShared *shared = pool->shared;
+
+     printf( "\n" );
+     printf( "----------------------------[ Shared Memory in %s ]----------------------------%n\n", shared->name, &length );
+     printf( "      Size          Address      Offset      Function                     FusionID\n" );
+
+     while (length--)
+          putc( '-', stdout );
+
+     putc( '\n', stdout );
+
+     ret = fusion_skirmish_prevail( &shared->lock );
+     if (ret) {
+          D_DERROR( ret, "Could not lock shared memory pool!\n" );
+          return DFENUM_OK;
+     }
+
+     if (shared->allocs) {
+          direct_list_foreach (desc, shared->allocs) {
+               printf( " %9zu bytes at %p [%8lu] in %-30s [%3lx] (%s: %u)\n",
+                       desc->bytes, desc->mem, (ulong)desc->mem - (ulong)shared->heap,
+                       desc->func, desc->fid, desc->file, desc->line );
+
+               total += desc->bytes;
+          }
+
+          printf( "   -------\n  %7dk total\n", total >> 10 );
+     }
+
+     printf( "\nShared memory file size: %dk\n", shared->heap->size >> 10 );
+
+     fusion_skirmish_dismiss( &shared->lock );
+
+     return DFENUM_OK;
+}
+
+static void
+dump_shmpools( void )
+{
+     fusion_shm_enum_pools( dfb_core_world(NULL), dump_shmpool, NULL );
+}
+#endif
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+     long long millis;
+     long int  seconds, minutes, hours, days;
+
+     char *buffer = malloc( 0x100000 );
+
+     setvbuf( stdout, buffer, _IOFBF, 0x100000 );
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate", ret );
+          return -3;
+     }
+
+     millis = direct_clock_get_millis();
+
+     seconds  = millis / 1000;
+     millis  %= 1000;
+
+     minutes  = seconds / 60;
+     seconds %= 60;
+
+     hours    = minutes / 60;
+     minutes %= 60;
+
+     days     = hours / 24;
+     hours   %= 24;
+
+     switch (days) {
+          case 0:
+               printf( "\nDirectFB uptime: %02ld:%02ld:%02ld\n",
+                       hours, minutes, seconds );
+               break;
+
+          case 1:
+               printf( "\nDirectFB uptime: %ld day, %02ld:%02ld:%02ld\n",
+                       days, hours, minutes, seconds );
+               break;
+
+          default:
+               printf( "\nDirectFB uptime: %ld days, %02ld:%02ld:%02ld\n",
+                       days, hours, minutes, seconds );
+               break;
+     }
+
+     dump_surfaces();
+     fflush( stdout );
+
+     dump_layers();
+     fflush( stdout );
+
+#if FUSION_BUILD_MULTI
+     if (show_shm) {
+          printf( "\n" );
+          dump_shmpools();
+          fflush( stdout );
+     }
+#endif
+
+     if (show_pools) {
+          printf( "\n" );
+          dump_surface_pool_info();
+          fflush( stdout );
+     }
+
+     if (show_allocs) {
+          printf( "\n" );
+          dump_surface_pools();
+          fflush( stdout );
+     }
+
+     printf( "\n" );
+
+     /* DirectFB deinitialization. */
+     if (dfb)
+          dfb->Release( dfb );
+
+     return ret;
+}
+
+/**********************************************************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     fprintf (stderr, "\nDirectFB Dump (version %s)\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "   -s,  --shm          Show shared memory pool content (if debug enabled)\n");
+     fprintf (stderr, "   -p,  --pools        Show information about surface pools\n");
+     fprintf (stderr, "   -a,  --allocs       Show surface buffer allocations in surface pools\n");
+     fprintf (stderr, "   -dl, --dumplayer    Dump surfaces of layer contexts into files (dfb_layer_context_REFID...)\n");
+     fprintf (stderr, "   -ds, --dumpsurface  Dump surfaces (front buffers) into files (dfb_surface_REFID...)\n");
+     fprintf (stderr, "   -h,  --help         Show this help message\n");
+     fprintf (stderr, "   -v,  --version      Print version information\n");
+     fprintf (stderr, "\n");
+}
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[] )
+{
+     int n;
+
+     for (n = 1; n < argc; n++) {
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbdump version %s\n", DIRECTFB_VERSION);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-s") == 0 || strcmp (arg, "--shm") == 0) {
+               show_shm = true;
+               continue;
+          }
+
+          if (strcmp (arg, "-p") == 0 || strcmp (arg, "--pools") == 0) {
+               show_pools = true;
+               continue;
+          }
+
+          if (strcmp (arg, "-a") == 0 || strcmp (arg, "--allocs") == 0) {
+               show_allocs = true;
+               continue;
+          }
+
+          if (strcmp (arg, "-dl") == 0 || strcmp (arg, "--dumplayer") == 0) {
+               dump_layer = -1;
+               continue;
+          }
+
+          if (strcmp (arg, "-ds") == 0 || strcmp (arg, "--dumpsurface") == 0) {
+               dump_surface = -1;
+               continue;
+          }
+
+          print_usage (argv[0]);
+
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
diff --git a/Source/DirectFB/tools/dfbfx.c b/Source/DirectFB/tools/dfbfx.c
new file mode 100755
index 0000000..2d0cf1a
--- /dev/null
+++ b/Source/DirectFB/tools/dfbfx.c
@@ -0,0 +1,630 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "config.h"
+
+#include <unistd.h>
+#include <stdio.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+#include <core/state.h>
+
+#include <gfx/convert.h>
+
+
+static DirectFBSurfaceBlittingFlagsNames( m_bflags );
+static DirectFBSurfaceBlendFunctionNames( m_bfuncs );
+
+#define MODULATE(a,b)    do { (a) = (((int)(a) * ((int)(b) + 1)) >> 8); } while (0)
+
+
+static DFBColor
+blit_pixel( CardState *state, DFBColor src, DFBColor dst )
+{
+     /* Scratch for blending stage. */
+     DFBColor x;
+
+     /*
+      * Input => short circuit to Output? (simple blits)
+      */
+
+     /* Without any flag the source is simply copied. */
+     if (!state->blittingflags)
+          return src;
+
+     /* Source color keying is the 2nd simplest operation. */
+     if (state->blittingflags & DSBLIT_SRC_COLORKEY) {
+          /* If the source matches the color key, keep the destination. */
+          if (PIXEL_RGB32(src.r,src.g,src.b) == state->src_colorkey)
+               return dst;
+     }
+
+     /* Destination color keying already requires reading the destination. */
+     if (state->blittingflags & DSBLIT_DST_COLORKEY) {
+          /* If the destination does not match the color key, keep the destination. */
+          if (PIXEL_RGB32(dst.r,dst.g,dst.b) != state->dst_colorkey)
+               return dst;
+     }
+
+     /*
+      * Modulation stage
+      */
+
+     /* Modulate source alpha value with global alpha factor? */
+     if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) {
+          /* Combine with source alpha value... */
+          if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL)
+               MODULATE( src.a, state->color.a );
+          else
+               /* ...or replace it. */
+               src.a = state->color.a;
+     }
+
+     /* Modulate source colors with global color factors? */
+     if (state->blittingflags & DSBLIT_COLORIZE) {
+          MODULATE( src.r, state->color.r );
+          MODULATE( src.g, state->color.g );
+          MODULATE( src.b, state->color.b );
+     }
+
+     /*
+      * Premultiplication stage
+      */
+
+     /* Premultiply source colors with (modulated) source alpha value? */
+     if (state->blittingflags & DSBLIT_SRC_PREMULTIPLY) {
+          MODULATE( src.r, src.a );
+          MODULATE( src.g, src.a );
+          MODULATE( src.b, src.a );
+     }
+
+     /* Premultiply source colors with global alpha factor only? */
+     if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) {
+          MODULATE( src.r, state->color.a );
+          MODULATE( src.g, state->color.a );
+          MODULATE( src.b, state->color.a );
+     }
+
+     /* Premultiply destination colors with destination alpha value? */
+     if (state->blittingflags & DSBLIT_DST_PREMULTIPLY) {
+          MODULATE( dst.r, dst.a );
+          MODULATE( dst.g, dst.a );
+          MODULATE( dst.b, dst.a );
+     }
+
+     /*
+      * XOR comes right before blending, after load, modulate and premultiply.
+      */
+     if (state->blittingflags & DSBLIT_XOR) {
+          src.a ^= dst.a;
+          src.r ^= dst.r;
+          src.g ^= dst.g;
+          src.b ^= dst.b;
+     }
+
+     /*
+      * Blending stage
+      */
+
+     /* Initialize scratch with source values, modify the copy according to the source blend function.
+        Could be done better by writing to the scratch only once after the calculation. */
+     x = src;
+
+     /* Blend scratch (source copy) and destination values accordingly. */
+     if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+          /* Apply the source blend function to the scratch. */
+          switch (state->src_blend) {
+               /* Sargb *= 0.0 */
+               case DSBF_ZERO:
+                    x.a = x.r = x.g = x.b = 0;
+                    break;
+
+               /* Sargb *= 1.0 */
+               case DSBF_ONE:
+                    break;
+
+               /* Sargb *= Sargb */
+               case DSBF_SRCCOLOR:
+                    MODULATE( x.a, src.a );
+                    MODULATE( x.r, src.r );
+                    MODULATE( x.g, src.g );
+                    MODULATE( x.b, src.b );
+                    break;
+
+               /* Sargb *= 1.0 - Sargb */
+               case DSBF_INVSRCCOLOR:
+                    MODULATE( x.a, src.a ^ 0xff );
+                    MODULATE( x.r, src.r ^ 0xff );
+                    MODULATE( x.g, src.g ^ 0xff );
+                    MODULATE( x.b, src.b ^ 0xff );
+                    break;
+
+               /* Sargb *= Saaaa */
+               case DSBF_SRCALPHA:
+                    MODULATE( x.a, src.a );
+                    MODULATE( x.r, src.a );
+                    MODULATE( x.g, src.a );
+                    MODULATE( x.b, src.a );
+                    break;
+
+               /* Sargb *= 1.0 - Saaaa */
+               case DSBF_INVSRCALPHA:
+                    MODULATE( x.a, src.a ^ 0xff );
+                    MODULATE( x.r, src.a ^ 0xff );
+                    MODULATE( x.g, src.a ^ 0xff );
+                    MODULATE( x.b, src.a ^ 0xff );
+                    break;
+
+               /* Sargb *= Daaaa */
+               case DSBF_DESTALPHA:
+                    MODULATE( x.a, dst.a );
+                    MODULATE( x.r, dst.a );
+                    MODULATE( x.g, dst.a );
+                    MODULATE( x.b, dst.a );
+                    break;
+
+               /* Sargb *= 1.0 - Daaaa */
+               case DSBF_INVDESTALPHA:
+                    MODULATE( x.a, dst.a ^ 0xff );
+                    MODULATE( x.r, dst.a ^ 0xff );
+                    MODULATE( x.g, dst.a ^ 0xff );
+                    MODULATE( x.b, dst.a ^ 0xff );
+                    break;
+
+               /* Sargb *= Dargb */
+               case DSBF_DESTCOLOR:
+                    MODULATE( x.a, dst.a );
+                    MODULATE( x.r, dst.r );
+                    MODULATE( x.g, dst.g );
+                    MODULATE( x.b, dst.b );
+                    break;
+
+               /* Sargb *= 1.0 - Dargb */
+               case DSBF_INVDESTCOLOR:
+                    MODULATE( x.a, dst.a ^ 0xff );
+                    MODULATE( x.r, dst.r ^ 0xff );
+                    MODULATE( x.g, dst.g ^ 0xff );
+                    MODULATE( x.b, dst.b ^ 0xff );
+                    break;
+
+               /* ??? */
+               case DSBF_SRCALPHASAT:
+                    D_UNIMPLEMENTED();
+                    break;
+
+               default:
+                    D_BUG( "unknown blend function %d", state->src_blend );
+          }
+
+          /* Apply the destination blend function. */
+          switch (state->dst_blend) {
+               /* Dargb *= 0.0 */
+               case DSBF_ZERO:
+                    dst.a = dst.r = dst.g = dst.b = 0;
+                    break;
+
+               /* Dargb *= 1.0 */
+               case DSBF_ONE:
+                    break;
+
+               /* Dargb *= Sargb */
+               case DSBF_SRCCOLOR:
+                    MODULATE( dst.a, src.a );
+                    MODULATE( dst.r, src.r );
+                    MODULATE( dst.g, src.g );
+                    MODULATE( dst.b, src.b );
+                    break;
+
+               /* Dargb *= 1.0 - Sargb */
+               case DSBF_INVSRCCOLOR:
+                    MODULATE( dst.a, src.a ^ 0xff );
+                    MODULATE( dst.r, src.r ^ 0xff );
+                    MODULATE( dst.g, src.g ^ 0xff );
+                    MODULATE( dst.b, src.b ^ 0xff );
+                    break;
+
+               /* Dargb *= Saaaa */
+               case DSBF_SRCALPHA:
+                    MODULATE( dst.a, src.a );
+                    MODULATE( dst.r, src.a );
+                    MODULATE( dst.g, src.a );
+                    MODULATE( dst.b, src.a );
+                    break;
+
+               /* Dargb *= 1.0 - Saaaa */
+               case DSBF_INVSRCALPHA:
+                    MODULATE( dst.a, src.a ^ 0xff );
+                    MODULATE( dst.r, src.a ^ 0xff );
+                    MODULATE( dst.g, src.a ^ 0xff );
+                    MODULATE( dst.b, src.a ^ 0xff );
+                    break;
+
+               /* Dargb *= Daaaa */
+               case DSBF_DESTALPHA:
+                    MODULATE( dst.r, dst.a );
+                    MODULATE( dst.g, dst.a );
+                    MODULATE( dst.b, dst.a );
+                    MODULATE( dst.a, dst.a ); //
+                    break;
+
+               /* Dargb *= 1.0 - Daaaa */
+               case DSBF_INVDESTALPHA:
+                    MODULATE( dst.r, dst.a ^ 0xff );
+                    MODULATE( dst.g, dst.a ^ 0xff );
+                    MODULATE( dst.b, dst.a ^ 0xff );
+                    MODULATE( dst.a, dst.a ^ 0xff ); //
+                    break;
+
+               /* Dargb *= Dargb */
+               case DSBF_DESTCOLOR:
+                    MODULATE( dst.r, dst.r );
+                    MODULATE( dst.g, dst.g );
+                    MODULATE( dst.b, dst.b );
+                    MODULATE( dst.a, dst.a ); //
+                    break;
+
+               /* Dargb *= 1.0 - Dargb */
+               case DSBF_INVDESTCOLOR:
+                    MODULATE( dst.r, dst.r ^ 0xff );
+                    MODULATE( dst.g, dst.g ^ 0xff );
+                    MODULATE( dst.b, dst.b ^ 0xff );
+                    MODULATE( dst.a, dst.a ^ 0xff ); //
+                    break;
+
+               /* ??? */
+               case DSBF_SRCALPHASAT:
+                    D_UNIMPLEMENTED();
+                    break;
+
+               default:
+                    D_BUG( "unknown blend function %d", state->dst_blend );
+          }
+
+          /*
+           * Add blended destination values to the scratch.
+           */
+          x.a += dst.a;
+          x.r += dst.r;
+          x.g += dst.g;
+          x.b += dst.b;
+     }
+
+     /* Better not use the conversion from premultiplied to non-premultiplied! */
+     if (state->blittingflags & DSBLIT_DEMULTIPLY) {
+          x.r = ((int)x.r << 8) / ((int)x.a + 1);
+          x.g = ((int)x.g << 8) / ((int)x.a + 1);
+          x.b = ((int)x.b << 8) / ((int)x.a + 1);
+     }
+
+     /*
+      * Output
+      */
+     return x;
+}
+
+/**********************************************************************************************************************/
+
+static const char *
+blend_to_string( DFBSurfaceBlendFunction func )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(m_bfuncs); i++) {
+          if (m_bfuncs[i].function == func)
+               return m_bfuncs[i].name;
+     }
+
+     return "<unknown>";
+}
+
+/**********************************************************************************************************************/
+
+static void
+parse_flags( const char *arg, DFBSurfaceBlittingFlags *ret_flags )
+{
+     int i;
+
+     *ret_flags = DSBLIT_NOFX;
+
+     for (i=0; i<D_ARRAY_SIZE(m_bflags); i++) {
+          if (strcasestr( arg, m_bflags[i].name ))
+               *ret_flags |= m_bflags[i].flag;
+     }
+}
+
+static bool
+parse_color( const char *arg, DFBColor *ret_color )
+{
+     char *error;
+     u32   argb;
+
+     if (arg[0] == '#')
+          arg++;
+
+     if (arg[0] == '0' && arg[1] == 'x')
+          arg+=2;
+
+     argb = strtoul( arg, &error, 16 );
+
+     if (*error) {
+          fprintf( stderr, "Invalid characters in color string: '%s'\n", error );
+          return false;
+     }
+
+     ret_color->a =  argb >> 24;
+     ret_color->r = (argb & 0xFF0000) >> 16;
+     ret_color->g = (argb & 0xFF00)   >> 8;
+     ret_color->b =  argb & 0xFF;
+
+     return true;
+}
+
+static bool
+parse_blend_func( const char *arg, DFBSurfaceBlendFunction *ret_func )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(m_bfuncs); i++) {
+          if (!strcasecmp( arg, m_bfuncs[i].name )) {
+               *ret_func = m_bfuncs[i].function;
+               return true;
+          }
+     }
+
+     fprintf( stderr, "Unknown blend function: '%s'\n", arg );
+
+     return false;
+}
+
+static void
+print_usage (const char *prg_name)
+{
+     int i;
+
+     fprintf( stderr, "\n"
+                      "DirectFB Blitting FX Demonstrator (version %s)\n"
+                      "\n"
+                      "Usage: %s [options]\n"
+                      "\n"
+                      "Options:\n"
+                      "   -b, --blittingflags   <flag>[,<flag>]     Set blitting flags\n"
+                      "   -D, --destination     <0xAARRGGBB>        Set destination value (ARGB32 in hex)\n"
+                      "   -S, --source          <0xAARRGGBB>        Set source value (ARGB32 in hex)\n"
+                      "   -c, --color           <0xAARRGGBB>        Set color (ARGB32 in hex)\n"
+                      "   -s, --srcblend        <func>              Set source blend function\n"
+                      "   -d, --dstblend        <func>              Set destination blend function\n"
+                      "\n"
+                      "Blitting flags:\n", DIRECTFB_VERSION, prg_name );
+
+     for (i=0; i<D_ARRAY_SIZE(m_bflags)-1; i++) {
+          fprintf( stderr, "  %-20s", m_bflags[i].name );
+
+          if (i % 4 == 3)
+               fprintf( stderr, "\n" );
+     }
+
+     fprintf( stderr, "(any other value means NOFX)\n"
+                      "\n"
+                      "Blend functions:" );
+
+     for (i=0; i<D_ARRAY_SIZE(m_bfuncs)-1; i++) {
+          if (i % 4 == 0)
+               fprintf( stderr, "\n" );
+
+          fprintf( stderr, "  %-20s", m_bfuncs[i].name );
+     }
+
+     fprintf( stderr, "\n" );
+}
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[], CardState *state, DFBColor *dest, DFBColor *source )
+{
+     int i;
+
+     /* Parse command line arguments. */
+     for (i=1; i<argc; i++) {
+          const char *arg = argv[i];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbfx version %s\n", DIRECTFB_VERSION);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-b") == 0 || strcmp (arg, "--blittingflags") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               parse_flags( argv[i], &state->blittingflags );
+
+               continue;
+          }
+
+          if (strcmp (arg, "-D") == 0 || strcmp (arg, "--destination") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (parse_color( argv[i], dest ))
+                    continue;
+          }
+
+          if (strcmp (arg, "-S") == 0 || strcmp (arg, "--source") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (parse_color( argv[i], source ))
+                    continue;
+          }
+
+          if (strcmp (arg, "-c") == 0 || strcmp (arg, "--color") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (parse_color( argv[i], &state->color ))
+                    continue;
+          }
+
+          if (strcmp (arg, "-s") == 0 || strcmp (arg, "--srcblend") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (parse_blend_func( argv[i], &state->src_blend ))
+                    continue;
+          }
+
+          if (strcmp (arg, "-d") == 0 || strcmp (arg, "--dstblend") == 0) {
+               if (++i == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (parse_blend_func( argv[i], &state->dst_blend ))
+                    continue;
+          }
+
+          print_usage (argv[0]);
+
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     int       i;
+     CardState state = { .blittingflags = DSBLIT_NOFX };
+     DFBColor  result;
+
+     /* Initialize sample source and destination values. */
+     //DFBColor  src = { 0x93, 0x93, 0x93, 0x93 };
+     DFBColor  dst = { 0xf0, 0xe0, 0xe0, 0xe0 };
+
+#define DRAWSTRING_PREMULT_FONT 1
+
+     /* Initialize default rendering state. */
+#if DRAWSTRING_PREMULT_FONT
+     /* Initialize sample source and destination values. */
+     DFBColor  src = { 0x93, 0x93, 0x93, 0x93 };
+
+     state.blittingflags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
+     state.src_blend     = DSBF_ONE;
+     state.dst_blend     = DSBF_INVSRCALPHA;
+     state.color.a       = 0x81;
+     state.color.r       = 0xff;
+     state.color.g       = 0x80;
+     state.color.b       = 0x23;
+#elif DRAWSTRING_NONPREMULT_ALPHADROP
+     /* Initialize sample source and destination values. */
+     DFBColor  src = { 0x93, 0xff, 0xff, 0xff };
+
+     state.blittingflags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
+     state.src_blend     = DSBF_SRCALPHA;
+     state.dst_blend     = DSBF_INVSRCALPHA;
+     state.color.a       = 0x81;
+     state.color.r       = 0xff;
+     state.color.g       = 0x80;
+     state.color.b       = 0x23;
+#endif
+
+     /* Startup the blitting FX demonstrator. */
+     printf( "\ndfbfx v" DIRECTFB_VERSION "\n\n" );
+
+     if (!parse_command_line( argc, argv, &state, &dst, &src ))
+          return -1;
+
+     /* Show blitting flags being used. */
+     printf( "  blit_flags: " );
+     for (i=0; i<D_ARRAY_SIZE(m_bflags); i++) {
+          if (D_FLAGS_IS_SET( state.blittingflags, m_bflags[i].flag ))
+               printf( "%s ", m_bflags[i].name );
+     }
+     printf( "\n" );
+
+     /* Blending needs source and destination blend function. */
+     if (state.blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) {
+          printf( "  src_blend:  %s\n", blend_to_string( state.src_blend ) );
+          printf( "  dst_blend:  %s\n", blend_to_string( state.dst_blend ) );
+     }
+     
+     /* These require one or more global values via the color (for modulation). */
+     if (state.blittingflags & (DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR | DSBLIT_COLORIZE))
+          printf( "  color:      %02x %02x %02x %02x\n",
+                  state.color.a, state.color.r, state.color.g, state.color.b );
+
+     /* Show original source values. */
+     printf( "  src:        %02x %02x %02x %02x\n", src.a, src.r, src.g, src.b );
+
+     /* Show source color key. */
+     if (state.blittingflags & DSBLIT_SRC_COLORKEY)
+          printf( "  src_key:       %02x %02x %02x\n",
+                  state.src_colorkey >> 16, (state.src_colorkey >> 8) & 0xff, state.src_colorkey & 0xff );
+
+     /* Show original destination values. */
+     printf( "  dst:        %02x %02x %02x %02x\n", dst.a, dst.r, dst.g, dst.b );
+
+     /* Show destination color key. */
+     if (state.blittingflags & DSBLIT_DST_COLORKEY)
+          printf( "  dst_key:       %02x %02x %02x\n",
+                  state.dst_colorkey >> 16, (state.dst_colorkey >> 8) & 0xff, state.dst_colorkey & 0xff );
+
+     /* Do magic... */
+     result = blit_pixel( &state, src, dst );
+
+     /* Show resulting values. */
+     printf( "  result:     %02x %02x %02x %02x\n", result.a, result.r, result.g, result.b );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tools/dfbg.c b/Source/DirectFB/tools/dfbg.c
new file mode 100755
index 0000000..eee11a4
--- /dev/null
+++ b/Source/DirectFB/tools/dfbg.c
@@ -0,0 +1,280 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <directfb.h>
+
+
+/*****************************************************************************/
+
+static IDirectFB             *dfb   = NULL;
+static IDirectFBDisplayLayer *layer = NULL;
+
+static const char *filename = NULL;
+static DFBBoolean  color    = DFB_FALSE;
+static DFBBoolean  tiled    = DFB_FALSE;
+
+
+/*****************************************************************************/
+
+static DFBBoolean parse_command_line   ( int argc, char *argv[] );
+static void       set_background_color ( void );
+static void       set_background_image ( void );
+
+/*****************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     DirectFBSetOption( "bg-none", NULL );
+     DirectFBSetOption( "no-cursor", NULL );
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate() failed", ret );
+          return -3;
+     }
+
+     /* Get the primary display layer. */
+     ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
+     if (ret) {
+          DirectFBError( "IDirectFB::GetDisplayLayer() failed", ret );
+          dfb->Release( dfb );
+          return -4;
+     }
+
+     /* Acquire administrative cooperative level. */
+     ret = layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret );
+          layer->Release( layer );
+          dfb->Release( dfb );
+          return -5;
+     }
+
+     /* Set the background according to the users wishes. */
+     if (color)
+          set_background_color();
+     else
+          set_background_image();
+
+     /* Release the display layer. */
+     layer->Release( layer );
+
+     /* Release the super interface. */
+     dfb->Release( dfb );
+
+     return EXIT_SUCCESS;
+}
+
+/*****************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     fprintf (stderr, "\nDirectFB Desktop Background Configuration (version %s)\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options] <imagefile>|<color>\n\n", prg_name);
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "   -c, --color     Set <color> in AARRGGBB format (hexadecimal).\n");
+     fprintf (stderr, "   -t, --tile      Set tiled mode.\n");
+     fprintf (stderr, "   -h, --help      Show this help message\n");
+     fprintf (stderr, "   -v, --version   Print version information\n");
+     fprintf (stderr, "\n");
+}
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[] )
+{
+     int n;
+
+     for (n = 1; n < argc; n++) {
+          const char *a = argv[n];
+
+          if (*a != '-') {
+               if (!filename) {
+                    filename = a;
+                    continue;
+               }
+               else {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+          }
+          if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) {
+               print_usage (argv[0]);
+               return DFB_FALSE;
+          }
+          if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) {
+               fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION);
+               return DFB_FALSE;
+          }
+          if (strcmp (a, "-c") == 0 || strcmp (a, "--color") == 0) {
+               color = DFB_TRUE;
+               continue;
+          }
+          if (strcmp (a, "-t") == 0 || strcmp (a, "--tile") == 0) {
+               tiled = DFB_TRUE;
+               continue;
+          }
+     }
+
+     if (!filename) {
+          print_usage (argv[0]);
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static void
+set_background_color( void )
+{
+     DFBResult  ret;
+     char      *error;
+     u32        argb;
+
+     if (*filename == '#')
+          filename++;
+
+     argb = strtoul( filename, &error, 16 );
+
+     if (*error) {
+          fprintf( stderr,
+                   "Invalid characters in color string: '%s'\n", error );
+          return;
+     }
+
+     ret = layer->SetBackgroundColor( layer,
+                                      (argb & 0xFF0000)   >> 16,
+                                      (argb & 0xFF00)     >> 8,
+                                      (argb & 0xFF)       >> 0,
+                                      (argb & 0xFF000000) >> 24 );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::SetBackgroundColor() failed", ret );
+          return;
+     }
+
+     ret = layer->SetBackgroundMode( layer, DLBM_COLOR );
+     if (ret)
+          DirectFBError( "IDirectFBDisplayLayer::SetBackgroundMode() failed", ret );
+}
+
+static void
+set_background_image( void )
+{
+     DFBResult               ret;
+     DFBSurfaceDescription   desc;
+     IDirectFBSurface       *surface;
+     IDirectFBImageProvider *provider;
+
+     ret = dfb->CreateImageProvider( dfb, filename, &provider );
+     if (ret) {
+          DirectFBError( "IDirectFB::CreateImageProvider() failed", ret );
+          return;
+     }
+
+     ret = provider->GetSurfaceDescription( provider, &desc );
+     if (ret) {
+          DirectFBError( "IDirectFBImageProvider::GetSurfaceDescription() failed", ret );
+          provider->Release( provider );
+          return;
+     }
+
+     desc.flags |= DSDESC_CAPS;
+     desc.caps   = DSCAPS_SHARED;
+
+     if (!tiled) {
+          DFBDisplayLayerConfig   config;
+
+          ret = layer->GetConfiguration( layer, &config );
+          if (ret) {
+               DirectFBError( "IDirectFBDisplayLayer::GetConfiguration() failed", ret );
+               provider->Release( provider );
+               return;
+          }
+
+          desc.width  = config.width;
+          desc.height = config.height;
+     }
+
+     ret = dfb->CreateSurface( dfb, &desc, &surface );
+     if (ret) {
+          DirectFBError( "IDirectFB::CreateSurface() failed", ret );
+          provider->Release( provider );
+          return;
+     }
+
+     ret = provider->RenderTo( provider, surface, NULL );
+     if (ret) {
+          DirectFBError( "IDirectFBImageProvider::RenderTo() failed", ret );
+          surface->Release( surface );
+          provider->Release( provider );
+          return;
+     }
+
+     ret = layer->SetBackgroundImage( layer, surface );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::SetBackgroundImage() failed", ret );
+          surface->Release( surface );
+          provider->Release( provider );
+          return;
+     }
+
+     ret = layer->SetBackgroundMode( layer, tiled ? DLBM_TILE : DLBM_IMAGE );
+     if (ret)
+          DirectFBError( "IDirectFBDisplayLayer::SetBackgroundMode() failed", ret );
+
+     surface->Release( surface );
+     provider->Release( provider );
+}
diff --git a/Source/DirectFB/tools/dfbinfo.c b/Source/DirectFB/tools/dfbinfo.c
new file mode 100755
index 0000000..7cc1591
--- /dev/null
+++ b/Source/DirectFB/tools/dfbinfo.c
@@ -0,0 +1,605 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+static const DirectFBInputDeviceTypeFlagsNames(input_types);
+static const DirectFBInputDeviceCapabilitiesNames(input_caps);
+
+static const DirectFBDisplayLayerTypeFlagsNames(layer_types);
+static const DirectFBDisplayLayerCapabilitiesNames(layer_caps);
+
+static const DirectFBScreenCapabilitiesNames(screen_caps);
+static const DirectFBScreenEncoderCapabilitiesNames(encoder_caps);
+static const DirectFBScreenEncoderTypeNames(encoder_type);
+static const DirectFBScreenEncoderTVStandardsNames(tv_standards);
+static const DirectFBScreenOutputCapabilitiesNames(output_caps);
+static const DirectFBScreenOutputConnectorsNames(connectors);
+static const DirectFBScreenOutputResolutionNames(resolutions);
+static const DirectFBScreenOutputSignalsNames(signals);
+static const DirectFBScreenMixerCapabilitiesNames(mixer_caps);
+
+/*****************************************************************************/
+
+static IDirectFB *dfb = NULL;
+
+/*****************************************************************************/
+
+static DFBBoolean parse_command_line ( int argc, char *argv[] );
+static void       enum_input_devices ( void );
+static void       enum_screens ( void );
+
+/*****************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     DirectFBSetOption( "bg-none", NULL );
+     DirectFBSetOption( "no-cursor", NULL );
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate() failed", ret );
+          return -3;
+     }
+
+     printf( "\n" );
+
+     enum_screens();
+
+     while (1) {
+          printf("\n\n\n\n\n");
+          enum_input_devices();
+          sleep(10);
+     }
+
+     /* Release the super interface. */
+     dfb->Release( dfb );
+
+     return EXIT_SUCCESS;
+}
+
+/*****************************************************************************/
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[] )
+{
+     return DFB_TRUE;
+}
+
+/*****************************************************************************/
+
+static DFBEnumerationResult
+input_device_callback( DFBInputDeviceID           id,
+                       DFBInputDeviceDescription  desc,
+                       void                      *arg )
+{
+     int i;
+
+     /* Name */
+     printf( "Input (%02x) %-30s", id, desc.name );
+
+     switch (id) {
+          case DIDID_JOYSTICK:
+               printf( "  (primary joystick)" );
+               break;
+          case DIDID_KEYBOARD:
+               printf( "  (primary keyboard)" );
+               break;
+          case DIDID_MOUSE:
+               printf( "  (primary mouse)" );
+               break;
+          case DIDID_REMOTE:
+               printf( "  (primary remote control)" );
+               break;
+          default:
+               break;
+     }
+
+     printf( "\n" );
+
+     /* Type */
+     printf( "   Type: " );
+
+     for (i=0; input_types[i].type; i++) {
+          if (desc.type & input_types[i].type)
+               printf( "%s ", input_types[i].name );
+     }
+
+     printf( "\n" );
+
+     /* Caps */
+     printf( "   Caps: " );
+
+     for (i=0; input_caps[i].capability; i++) {
+          if (desc.caps & input_caps[i].capability)
+               printf( "%s ", input_caps[i].name );
+     }
+
+     printf( "\n" );
+     
+     
+     /* Details */
+     if (desc.caps & DICAPS_KEYS)
+          printf( "   Min. Keycode: %d\n", desc.min_keycode );
+     if (desc.caps & DICAPS_KEYS)
+          printf( "   Max. Keycode: %d\n", desc.max_keycode );
+     if (desc.caps & DICAPS_AXES)
+          printf( "   Max. Axis: %d\n", desc.max_axis );
+     if (desc.caps & DICAPS_BUTTONS)
+          printf( "   Max. Button: %d\n", desc.max_button );
+     
+
+     DFBResult             ret;
+     IDirectFBInputDevice *device;
+
+     ret = dfb->GetInputDevice( dfb, id, &device );
+     if (ret == DFB_OK) {
+          DFBInputDeviceState state;
+
+          ret = device->GetState( device, &state );
+          if (ret)
+               D_DERROR( ret, "DFBInfo: IDirectFBInputDevice::GetState() failed!\n" );
+          else {
+               if (state.flags & DISTATE_DISCONNECTED)
+                    printf( "   - DISCONNECTED -\n" );
+          }
+
+          device->Release( device );
+     }
+
+
+     printf( "\n" );
+
+     return DFB_OK;
+}
+
+static void
+enum_input_devices( void )
+{
+     DFBResult ret;
+
+     printf( "\n" );
+
+     ret = dfb->EnumInputDevices( dfb, input_device_callback, NULL );
+     if (ret)
+          DirectFBError( "IDirectFB::EnumInputDevices", ret );
+}
+
+/*****************************************************************************/
+
+static DFBEnumerationResult
+display_layer_callback( DFBDisplayLayerID           id,
+                        DFBDisplayLayerDescription  desc,
+                        void                       *arg )
+{
+     int i;
+
+     /* Name */
+     printf( "     Layer (%02x) %-30s", id, desc.name );
+
+     switch (id) {
+          case DLID_PRIMARY:
+               printf( "  (primary layer)" );
+               break;
+          default:
+               break;
+     }
+
+     printf( "\n" );
+
+
+     /* Type */
+     printf( "        Type:    " );
+
+     for (i=0; layer_types[i].type; i++) {
+          if (desc.type & layer_types[i].type)
+               printf( "%s ", layer_types[i].name );
+     }
+
+     printf( "\n" );
+
+
+     /* Caps */
+     printf( "        Caps:    " );
+
+     for (i=0; layer_caps[i].capability; i++) {
+          if (desc.caps & layer_caps[i].capability)
+               printf( "%s ", layer_caps[i].name );
+     }
+
+     printf( "\n" );
+
+
+     /* Sources */
+     if (desc.caps & DLCAPS_SOURCES) {
+          DFBResult                         ret;
+          IDirectFBDisplayLayer            *layer;
+          DFBDisplayLayerSourceDescription  descs[desc.sources];
+
+          ret = dfb->GetDisplayLayer( dfb, id, &layer );
+          if (ret) {
+               DirectFBError( "DirectFB::GetDisplayLayer() failed", ret );
+          }
+          else {
+               ret = layer->GetSourceDescriptions( layer, descs );
+               if (ret) {
+                    DirectFBError( "DirectFBDisplayLayer::GetSourceDescriptions() failed", ret );
+               }
+               else {
+                    printf( "        Sources: " );
+
+                    for (i=0; i<desc.sources; i++) {
+                         if (i > 0)
+                              printf( ", %s", descs[i].name );
+                         else
+                              printf( "%s", descs[i].name );
+                    }
+
+                    printf( "\n" );
+               }
+
+               layer->Release( layer );
+          }
+     }
+
+
+     printf( "\n" );
+
+     return DFB_OK;
+}
+
+static void
+enum_display_layers( IDirectFBScreen *screen )
+{
+     DFBResult ret;
+
+     ret = screen->EnumDisplayLayers( screen, display_layer_callback, NULL );
+     if (ret)
+          DirectFBError( "IDirectFBScreen::EnumDisplayLayers", ret );
+}
+
+/*****************************************************************************/
+
+static void
+dump_mixers( IDirectFBScreen *screen,
+             int              num )
+{
+     int                       i, n;
+     DFBResult                 ret;
+     DFBScreenMixerDescription descs[num];
+
+     ret = screen->GetMixerDescriptions( screen, descs );
+     if (ret) {
+          DirectFBError( "IDirectFBScreen::GetMixerDescriptions", ret );
+          return;
+     }
+
+     for (i=0; i<num; i++) {
+          printf( "   Mixer (%d) %s\n", i, descs[i].name );
+
+          /* Caps */
+          printf( "     Caps:                    " );
+
+          for (n=0; mixer_caps[n].capability; n++) {
+               if (descs[i].caps & mixer_caps[n].capability)
+                    printf( "%s ", mixer_caps[n].name );
+          }
+
+          printf( "\n" );
+
+
+          /* Full mode layers */
+          if (descs[i].caps & DSMCAPS_FULL) {
+               printf( "     Layers (full mode):      " );
+
+               for (n=0; n<DFB_DISPLAYLAYER_IDS_MAX; n++) {
+                    if (DFB_DISPLAYLAYER_IDS_HAVE( descs[i].layers, n ))
+                         printf( "(%02x) ", n );
+               }
+
+               printf( "\n" );
+          }
+
+
+          /* Sub mode layers */
+          if (descs[i].caps & DSMCAPS_SUB_LAYERS) {
+               printf( "     Layers (sub mode): %2d of ", descs[i].sub_num );
+
+               for (n=0; n<DFB_DISPLAYLAYER_IDS_MAX; n++) {
+                    if (DFB_DISPLAYLAYER_IDS_HAVE( descs[i].sub_layers, n ))
+                         printf( "(%02x) ", n );
+               }
+
+               printf( "\n" );
+          }
+
+          printf( "\n" );
+     }
+
+     printf( "\n" );
+}
+
+static void
+dump_encoders( IDirectFBScreen *screen,
+               int              num )
+{
+     int                         i, n;
+     DFBResult                   ret;
+     DFBScreenEncoderDescription descs[num];
+
+     ret = screen->GetEncoderDescriptions( screen, descs );
+     if (ret) {
+          DirectFBError( "IDirectFBScreen::GetEncoderDescriptions", ret );
+          return;
+     }
+
+     for (i=0; i<num; i++) {
+          printf( "   Encoder (%d) %s\n", i, descs[i].name );
+
+          /* Type */
+          printf( "     Type:           " );
+
+          for (n=0; encoder_type[n].type; n++) {
+               if (descs[i].type & encoder_type[n].type)
+                    printf( "%s ", encoder_type[n].name );
+          }
+
+          printf( "\n" );
+
+
+          /* Caps */
+          printf( "     Caps:           " );
+
+          for (n=0; encoder_caps[n].capability; n++) {
+               if (descs[i].caps & encoder_caps[n].capability)
+                    printf( "%s ", encoder_caps[n].name );
+          }
+
+          printf( "\n" );
+
+
+          /* TV Norms */
+          if (descs[i].caps & DSECAPS_TV_STANDARDS) {
+               printf( "     TV Standards:   " );
+
+               for (n=0; tv_standards[n].standard; n++) {
+                    if (descs[i].tv_standards & tv_standards[n].standard)
+                         printf( "%s ", tv_standards[n].name );
+               }
+
+               printf( "\n" );
+          }
+
+
+          /* Output signals */
+          if (descs[i].caps & DSECAPS_OUT_SIGNALS) {
+               printf( "     Output Signals: " );
+
+               for (n=0; signals[n].signal; n++) {
+                    if (descs[i].out_signals & signals[n].signal)
+                         printf( "%s ", signals[n].name );
+               }
+
+               printf( "\n" );
+          }
+          
+          /* Output Resolutions */
+          if (descs[i].caps & DSECAPS_RESOLUTION) {
+               printf( "     Output Resolutions: " );
+
+               for (n=0; resolutions[n].resolution; n++) {
+                    if (descs[i].all_resolutions & resolutions[n].resolution)
+                         printf( "%s ", resolutions[n].name );
+               }
+
+               printf( "\n" );
+          }
+
+          /* Output connectors */
+          if (descs[i].caps & DSECAPS_CONNECTORS) {
+               printf( "     Output Connectors: " );
+
+               for (n=0; connectors[n].connector; n++) {
+                    if (descs[i].all_connectors & connectors[n].connector)
+                         printf( "%s ", connectors[n].name );
+               }
+
+               printf( "\n" );
+          }
+
+          printf( "\n" );
+     }
+
+     printf( "\n" );
+}
+
+static void
+dump_outputs( IDirectFBScreen *screen,
+              int              num )
+{
+     int                        i, n;
+     DFBResult                  ret;
+     DFBScreenOutputDescription descs[num];
+
+     ret = screen->GetOutputDescriptions( screen, descs );
+     if (ret) {
+          DirectFBError( "IDirectFBScreen::GetOutputDescriptions", ret );
+          return;
+     }
+
+     for (i=0; i<num; i++) {
+          printf( "   Output (%d) %s\n", i, descs[i].name );
+
+
+          /* Caps */
+          printf( "     Caps:       " );
+
+          for (n=0; output_caps[n].capability; n++) {
+               if (descs[i].caps & output_caps[n].capability)
+                    printf( "%s ", output_caps[n].name );
+          }
+
+          printf( "\n" );
+
+	  /* Connectors */
+          if (descs[i].caps & DSOCAPS_CONNECTORS) {
+              printf( "     Connectors: " );
+
+              for (n=0; connectors[n].connector; n++) {
+                   if (descs[i].all_connectors & connectors[n].connector)
+                        printf( "%s ", connectors[n].name );
+              }
+
+              printf( "\n" );
+          }
+
+          /* Output Resolutions */
+          if (descs[i].caps & DSOCAPS_RESOLUTION) {
+               printf( "     Resolutions: " );
+
+               for (n=0; resolutions[n].resolution; n++) {
+                    if (descs[i].all_resolutions & resolutions[n].resolution)
+                         printf( "%s ", resolutions[n].name );
+               }
+
+               printf( "\n" );
+          }
+
+          /* Signals */
+          printf( "     Signals:    " );
+
+          for (n=0; signals[n].signal; n++) {
+               if (descs[i].all_signals & signals[n].signal)
+                    printf( "%s ", signals[n].name );
+          }
+
+          printf( "\n" );
+
+          printf( "\n" );
+     }
+
+     printf( "\n" );
+}
+
+static DFBEnumerationResult
+screen_callback( DFBScreenID           id,
+                 DFBScreenDescription  desc,
+                 void                 *arg )
+{
+     int              i;
+     DFBResult        ret;
+     IDirectFBScreen *screen;
+
+     ret = dfb->GetScreen( dfb, id, &screen );
+     if (ret)
+          DirectFBErrorFatal( "IDirectFB::GetScreen", ret );
+
+     /* Name */
+     printf( "Screen (%02x) %-30s", id, desc.name );
+
+     switch (id) {
+          case DSCID_PRIMARY:
+               printf( "  (primary screen)" );
+               break;
+          default:
+               break;
+     }
+
+     printf( "\n" );
+
+     /* Caps */
+     printf( "   Caps: " );
+
+     for (i=0; screen_caps[i].capability; i++) {
+          if (desc.caps & screen_caps[i].capability)
+               printf( "%s ", screen_caps[i].name );
+     }
+
+     printf( "\n\n" );
+
+
+     /* Mixers */
+     if (desc.mixers)
+          dump_mixers( screen, desc.mixers );
+
+     /* Encoders */
+     if (desc.encoders)
+          dump_encoders( screen, desc.encoders );
+
+     /* Outputs */
+     if (desc.outputs)
+          dump_outputs( screen, desc.outputs );
+
+     /* Display layers */
+     enum_display_layers( screen );
+
+     screen->Release( screen );
+
+     return DFB_OK;
+}
+
+static void
+enum_screens( void )
+{
+     DFBResult ret;
+
+     printf( "\n" );
+
+     ret = dfb->EnumScreens( dfb, screen_callback, NULL );
+     if (ret)
+          DirectFBError( "IDirectFB::EnumScreens", ret );
+}
+
diff --git a/Source/DirectFB/tools/dfbinput.c b/Source/DirectFB/tools/dfbinput.c
new file mode 100755
index 0000000..fa8112d
--- /dev/null
+++ b/Source/DirectFB/tools/dfbinput.c
@@ -0,0 +1,331 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <core/input.h>
+
+#include <directfb.h>
+#include <directfb_keynames.h>
+#include <directfb_strings.h>
+
+
+/**************************************************************************************************/
+
+static const DirectFBKeySymbolNames( symbol_names );
+
+static const char *
+symbol_name( DFBInputDeviceKeySymbol symbol )
+{
+     int i;
+     static char buf[64];
+
+     for (i=0; i<D_ARRAY_SIZE(symbol_names); i++) {
+          if (symbol_names[i].symbol == symbol)
+               return symbol_names[i].name;
+     }
+
+     snprintf( buf, sizeof(buf), "<0x%08x>", symbol );
+
+     return buf;
+}
+
+/**************************************************************************************************/
+
+static IDirectFB                 *dfb;
+static IDirectFBInputDevice      *device;
+static DFBInputDeviceDescription  desc;
+
+/**************************************************************************************************/
+
+static DFBInputDeviceID id     = DIDID_KEYBOARD;
+static unsigned int     reload = false;
+static unsigned int     dump   = false;
+static unsigned int     sensitivity = 0;
+
+/**************************************************************************************************/
+
+static bool parse_command_line( int argc, char *argv[] );
+
+/**************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "Tools/Input: DirectFBInit() failed!\n" );
+          goto error;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          goto error;
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "Tools/Input: DirectFBCreate() failed!\n" );
+          goto error;
+     }
+
+     dfb->RescanInputDevices( dfb );
+
+     /* Get the input device. */
+     ret = dfb->GetInputDevice( dfb, id, &device );
+     if (ret) {
+          if (ret == DFB_IDNOTFOUND)
+               fprintf (stderr, "\nUnknown device id, check 'dfbinfo' for valid values.\n\n");
+          else
+               D_DERROR( ret, "Tools/Input: IDirectFB::GetInputDevice() failed!\n" );
+
+          goto error;
+     }
+
+     if (sensitivity)
+          device->SetSensitivity( device, sensitivity );
+
+     /* Get a description of the device. */
+     ret = device->GetDescription( device, &desc );
+     if (ret) {
+          D_DERROR( ret, "Tools/Input: IDirectFBInputDevice::GetDescription() failed!\n" );
+          goto error;
+     }
+
+     /* Reload the keymap. FIXME: Make public API? */
+     if (reload) {
+          ret = dfb_input_device_reload_keymap( dfb_input_device_at( id ) );
+          if (ret) {
+               D_DERROR( ret, "Tools/Input: Reloading the keymap failed!\n" );
+               goto error;
+          }
+     }
+
+     /* Dump the keymap. */
+     if (dump) {
+          int i;
+
+          printf( "\n" );
+
+          for (i=desc.min_keycode; i<=desc.max_keycode; i++) {
+               DFBInputDeviceKeymapEntry entry;
+
+               ret = device->GetKeymapEntry( device, i, &entry );
+               if (ret) {
+                    D_DERROR( ret, "Tools/Input: IDirectFBInputDevice::GetKeymapEntry( %d ) failed!\n", i );
+                    goto error;
+               }
+
+               printf( "%3d:  %-16s  %-16s  %-16s  %-16s\n", i,
+                       symbol_name(entry.symbols[DIKSI_BASE]),
+                       symbol_name(entry.symbols[DIKSI_BASE_SHIFT]),
+                       symbol_name(entry.symbols[DIKSI_ALT]),
+                       symbol_name(entry.symbols[DIKSI_ALT_SHIFT]) );
+          }
+
+          printf( "\n" );
+     }
+
+error:
+     /* Release the device. */
+     if (device)
+          device->Release( device );
+
+     /* Release the super interface. */
+     if (dfb)
+          dfb->Release( dfb );
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+typedef struct __AnyOption AnyOption;
+
+
+typedef bool (*ParseFunc)( const AnyOption *option,
+                           const char      *arg );
+
+struct __AnyOption {
+     const char   *short_name;
+     const char   *long_name;
+
+     const char   *arg_name;
+     const char   *arg_desc;
+
+     void         *value;
+
+     unsigned int *flags;
+     unsigned int  flag;
+
+     ParseFunc     parse;
+     const void   *data;
+};
+
+typedef struct {
+     int           value;
+     const char   *name;
+} ValueName;
+
+/**************************************************************************************************/
+
+static bool
+parse_int( const AnyOption *option, const char *arg )
+{
+     int   ret;
+     char *end;
+
+     ret = strtoul( arg, &end, option->data ? (unsigned long) option->data : 10 );
+
+     if (*end || ret < 0) {
+          fprintf( stderr, "\nInvalid argument to '%s' or '%s' specified!\n\n",
+                   option->short_name, option->long_name );
+
+          return false;
+     }
+
+     *((int*)option->value) = ret;
+
+     return true;
+}
+
+/**************************************************************************************************/
+
+static const AnyOption options[] = {
+     { "-d",  "--device",       "<id>",       "ID of device to use",
+       &id,      NULL, 0, parse_int, NULL },
+
+     { "-r",  "--reload",       "",           "Reload the keymap",
+       NULL,     &reload, true, NULL, NULL },
+
+     { "-s",  "--sensitivity",  "<value>",    "Set sensitivity of axes (16.16 fixed)",
+       &sensitivity,     NULL, 0, parse_int, NULL },
+
+     { "-k",  "--keymap",       "",           "Show the keymap",
+       NULL,     &dump,   true, NULL, NULL },
+};
+
+/**************************************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     int i;
+
+     fprintf (stderr, "\nDirectFB Input Device Configuration (version %s)\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "   -h   --help                             Show this help message\n");
+     fprintf (stderr, "   -v   --version                          Print version information\n");
+
+     for (i=0; i<D_ARRAY_SIZE(options); i++) {
+          const AnyOption *option = &options[i];
+
+          fprintf( stderr, "   %-3s  %-16s   %-12s    %s\n",
+                   option->short_name, option->long_name, option->arg_name, option->arg_desc );
+     }
+
+     fprintf (stderr, "\n");
+}
+
+/**************************************************************************************************/
+
+static bool
+parse_option( const AnyOption *option, const char *arg )
+{
+     if (option->parse && !option->parse( option, arg ))
+          return false;
+
+     if (option->flags)
+          *option->flags |= option->flag;
+
+     return true;
+}
+
+static bool
+parse_command_line( int argc, char *argv[] )
+{
+     int i, n;
+
+     for (n = 1; n < argc; n++) {
+          bool        ok  = false;
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return false;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbinput version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+
+          for (i=0; i<D_ARRAY_SIZE(options); i++) {
+               const AnyOption *opt = &options[i];
+
+               if (!strcmp (arg, opt->short_name) || !strcmp (arg, opt->long_name)) {
+                    if (opt->parse && ++n == argc) {
+                         print_usage (argv[0]);
+                         return false;
+                    }
+
+                    if (!parse_option( opt, argv[n] ))
+                         return false;
+
+                    ok = true;
+
+                    break;
+               }
+          }
+
+          if (!ok) {
+               print_usage (argv[0]);
+               return false;
+          }
+     }
+
+     return true;
+}
+
diff --git a/Source/DirectFB/tools/dfbinspector.c b/Source/DirectFB/tools/dfbinspector.c
new file mode 100755
index 0000000..52559aa
--- /dev/null
+++ b/Source/DirectFB/tools/dfbinspector.c
@@ -0,0 +1,288 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+/**********************************************************************************************************************/
+
+static const DirectFBPixelFormatNames(format_names);
+static const DirectFBSurfaceBlittingFlagsNames(blittingflags_names);
+static const DirectFBSurfaceDrawingFlagsNames(drawingflags_names);
+static const DirectFBAccelerationMaskNames(accelerationmask_names);
+
+/**********************************************************************************************************************/
+
+typedef enum {
+     NONE         = 0x00000000,
+     CREATE_FILES = 0x00000001
+} Options;
+
+typedef struct {
+     IDirectFB        *dfb;
+     IDirectFBFont    *font;
+
+     Options           options;
+     const char       *directory;
+
+     struct {
+          FILE *formats;
+     }                files;
+
+     bool             device_drawstring;
+} Inspector;
+
+/**********************************************************************************************************************/
+
+static DFBResult
+Inspector_Init( Inspector *inspector, int argc, char *argv[] )
+{
+     int                i;
+     DFBResult          ret;
+     DFBFontDescription desc;
+
+     memset( inspector, 0, sizeof(Inspector) );
+
+     for (i=1; i<argc; i++) {
+          if (!strcmp( argv[i], "-d" )) {
+               if (++i == argc) {
+                    D_ERROR( "Inspector/Init: Missing argument to option '-d'!\n" );
+                    return DFB_INVARG;
+               }
+
+               inspector->directory  = argv[i];
+               inspector->options   |= CREATE_FILES;
+          }
+     }
+
+     ret = DirectFBCreate( &inspector->dfb );
+     if (ret) {
+          D_DERROR( ret, "Inspector/Init: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+     desc.flags  = DFDESC_HEIGHT;
+     desc.height = 24;
+
+     ret = inspector->dfb->CreateFont( inspector->dfb, DATADIR"/decker.ttf", &desc, &inspector->font );
+     if (ret) {
+          D_DERROR( ret, "Inspector/Init: Could not load font '%s'!\n", DATADIR"/decker.ttf" );
+          return ret;
+     }
+
+     return DFB_OK;
+}
+
+static DFBResult
+Inspector_Run( Inspector *inspector )
+{
+     static const DFBSurfacePixelFormat formats[] = {
+          DSPF_LUT8,
+          DSPF_ALUT44,
+          DSPF_RGB332,
+          DSPF_RGB16,
+          DSPF_RGB24,
+          DSPF_RGB32,
+          DSPF_ARGB1555,
+          DSPF_ARGB2554,
+          DSPF_ARGB4444,
+          DSPF_ARGB,
+          DSPF_AiRGB,
+          DSPF_A1,
+          DSPF_A8,
+          DSPF_YUY2,
+          DSPF_UYVY,
+          DSPF_I420,
+          DSPF_YV12,
+          DSPF_NV12,
+          DSPF_NV21,
+          DSPF_NV16,
+          DSPF_AYUV
+     };
+
+     int                    i, j, n;
+     DFBResult              ret;
+     DFBSurfaceDescription  desc;
+     IDirectFBSurface      *surfaces[D_ARRAY_SIZE(formats)];
+     char                   buf[strlen( inspector->directory ? : "" ) + 23];
+
+
+     if (inspector->options & CREATE_FILES) {
+          /* Create the directory. */
+          if (mkdir( inspector->directory, 0755 ) < 0 && errno != EEXIST) {
+               D_PERROR( "Inspector/Init: Could not create directory '%s'!\n", inspector->directory );
+               return DFB_INIT;
+          }
+
+          /* Open file for writing supported format conversions (blitting). */
+          snprintf( buf, sizeof(buf), "%s/blit.formats", inspector->directory );
+          inspector->files.formats = fopen( buf, "w" );
+          if (!inspector->files.formats) {
+               D_PERROR( "Inspector/Init: Could not open file '%s' for writing!\n", buf );
+               return DFB_INIT;
+          }
+     }
+
+     desc.flags  = (DFBSurfaceDescriptionFlags)(DSDESC_WIDTH  |
+                                                DSDESC_HEIGHT |
+                                                DSDESC_PIXELFORMAT);
+     desc.width  = 64;
+     desc.height = 64;
+
+     for (i=0; i<D_ARRAY_SIZE(formats); i++) {
+          desc.pixelformat = formats[i];
+
+          ret = inspector->dfb->CreateSurface( inspector->dfb, &desc, &surfaces[i] );
+          if (ret) {
+               D_DERROR( ret, "Inspector/Init: Could not create %s surface!\n",
+                         format_names[DFB_PIXELFORMAT_INDEX(formats[i])].name );
+               while (i--)
+                    surfaces[i]->Release( surfaces[i] );
+               return ret;
+          }
+
+          surfaces[i]->SetFont( surfaces[i], inspector->font );
+
+          if (inspector->files.formats)
+               fprintf( inspector->files.formats, "%s%s", i ? "," : "",
+                        format_names[DFB_PIXELFORMAT_INDEX(formats[i])].name );
+     }
+
+     if (inspector->files.formats)
+          fprintf( inspector->files.formats, "\n" );
+
+     printf("\n");
+
+
+
+     printf("source ->");
+
+     for (i=0; i<D_ARRAY_SIZE(formats); i++)
+          printf( "%9s", format_names[DFB_PIXELFORMAT_INDEX(formats[i])].name );
+
+     printf("\n");
+
+
+
+     printf("dest.\n");
+
+     for (i=0; i<D_ARRAY_SIZE(formats); i++) {
+          printf( "%9s", format_names[DFB_PIXELFORMAT_INDEX(formats[i])].name );
+
+          for (j=0; j<D_ARRAY_SIZE(formats); j++) {
+               DFBAccelerationMask mask;
+
+               surfaces[i]->GetAccelerationMask( surfaces[i], surfaces[j], &mask );
+
+               if (mask & DFXL_DRAWSTRING)
+                    inspector->device_drawstring = true;
+
+               printf( "%9s", (mask & DFXL_BLIT) ? "X" : "" );
+
+               if (inspector->files.formats)
+                    fputc( (mask & DFXL_BLIT) ? '1' : '0', inspector->files.formats );
+          }
+
+          printf( "  %s", format_names[DFB_PIXELFORMAT_INDEX(formats[i])].name );
+
+          printf("\n");
+
+          if (inspector->files.formats)
+               fprintf( inspector->files.formats, "\n" );
+     }
+
+     for (i=0; i<D_ARRAY_SIZE(formats); i++)
+          surfaces[i]->Release( surfaces[i] );
+
+     if (inspector->options & CREATE_FILES) {
+          FILE                         *f;
+          DFBGraphicsDeviceDescription  desc;
+
+          if (inspector->files.formats)
+               fclose( inspector->files.formats );
+
+          /* Query device and driver information. */
+          inspector->dfb->GetDeviceDescription( inspector->dfb, &desc );
+
+          if (inspector->device_drawstring)
+               desc.acceleration_mask = (DFBAccelerationMask)(desc.acceleration_mask | DFXL_DRAWSTRING);
+
+          /* Write device info to a file. */
+          snprintf( buf, sizeof(buf), "%s/device.info", inspector->directory );
+          f = fopen( buf, "w" );
+          if (!f) {
+               D_PERROR( "Inspector/Init: Could not open file '%s' for writing!\n", buf );
+               return DFB_FAILURE;
+          }
+
+          fprintf( f, "name = %s\n", desc.name );
+          fprintf( f, "vendor = %s\n", desc.vendor );
+
+          fprintf( f, "acceleration_mask = " );
+          for (i=0, n=0; accelerationmask_names[i].mask; i++) {
+               if (desc.acceleration_mask & accelerationmask_names[i].mask)
+                    fprintf( f, "%s%s", n++ ? "," : "", accelerationmask_names[i].name );
+          }
+          fprintf( f, "\n" );
+
+          fprintf( f, "blitting_flags = " );
+          for (i=0, n=0; blittingflags_names[i].flag; i++) {
+               if (desc.blitting_flags & blittingflags_names[i].flag)
+                    fprintf( f, "%s%s", n++ ? "," : "", blittingflags_names[i].name );
+          }
+          fprintf( f, "\n" );
+
+          fprintf( f, "drawing_flags = " );
+          for (i=0, n=0; drawingflags_names[i].flag; i++) {
+               if (desc.drawing_flags & drawingflags_names[i].flag)
+                    fprintf( f, "%s%s", n++ ? "," : "", drawingflags_names[i].name );
+          }
+          fprintf( f, "\n" );
+
+          fclose( f );
+
+
+          /* Write driver info to a file. */
+          snprintf( buf, sizeof(buf), "%s/driver.info", inspector->directory );
+          f = fopen( buf, "w" );
+          if (!f) {
+               D_PERROR( "Inspector/Init: Could not open file '%s' for writing!\n", buf );
+               return DFB_FAILURE;
+          }
+
+          fprintf( f, "name = %s\n", desc.driver.name );
+          fprintf( f, "vendor = %s\n", desc.driver.vendor );
+          fprintf( f, "version = %d.%d\n", desc.driver.major, desc.driver.minor );
+
+          fclose( f );
+     }
+
+     return DFB_OK;
+}
+
+/**********************************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+     Inspector inspector;
+
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "Inspector/Init: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+     ret = Inspector_Init( &inspector, argc, argv );
+     if (ret)
+          return ret;
+          
+     return Inspector_Run( &inspector );
+}
+
diff --git a/Source/DirectFB/tools/dfblayer.c b/Source/DirectFB/tools/dfblayer.c
new file mode 100755
index 0000000..6519be1
--- /dev/null
+++ b/Source/DirectFB/tools/dfblayer.c
@@ -0,0 +1,625 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+static DirectFBPixelFormatNames( format_names );
+
+/*****************************************************************************/
+
+static IDirectFB                  *dfb;
+static IDirectFBDisplayLayer      *layer;
+static DFBDisplayLayerDescription  desc;
+
+/*****************************************************************************/
+
+static DFBDisplayLayerID         id           = DLID_PRIMARY;
+static int                       width        = 0;
+static int                       height       = 0;
+static DFBSurfacePixelFormat     format       = DSPF_UNKNOWN;
+static DFBDisplayLayerBufferMode buffermode   = -1;
+static int                       opacity      = -1;
+static int                       level        = 0;
+static DFBBoolean                set_level    = DFB_FALSE;
+static int                       rotation     = 0;
+static DFBBoolean                set_rotation = DFB_FALSE;
+static DFBSurfaceLockFlags       test_lock    = 0;
+
+/*****************************************************************************/
+
+static DFBBoolean parse_command_line( int argc, char *argv[] );
+static void       set_configuration ( void );
+
+/*****************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          DirectFBError( "DirectFBCreate() failed", ret );
+          return -3;
+     }
+
+     /* Get the primary display layer. */
+     ret = dfb->GetDisplayLayer( dfb, id, &layer );
+     if (ret) {
+          if (ret == DFB_IDNOTFOUND)
+               fprintf (stderr, "\nUnknown layer id, check 'dfbinfo' for valid values.\n\n");
+          else
+               DirectFBError( "IDirectFB::GetDisplayLayer() failed", ret );
+          dfb->Release( dfb );
+          return -4;
+     }
+
+     /* Get a description of the layer. */
+     ret = layer->GetDescription( layer, &desc );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::GetDescription() failed", ret );
+          layer->Release( layer );
+          dfb->Release( dfb );
+          return -5;
+     }
+
+     /* Acquire administrative cooperative level. */
+     ret = layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret );
+          layer->Release( layer );
+          dfb->Release( dfb );
+          return -6;
+     }
+
+     /* Show/change the configuration. */
+     set_configuration();
+
+     /* Test Lock() on layer surface? */
+     if (test_lock) {
+          IDirectFBSurface *surface;
+
+          fprintf( stderr, "\nGetting layer surface...\n" );
+
+          ret = layer->GetSurface( layer, &surface );
+          if (ret)
+               DirectFBError( "IDirectFBDisplayLayer::GetSurface() failed", ret );
+          else {
+               void *data;
+               int   pitch;
+
+               fprintf( stderr, "\nTesting Lock( %s ) on layer surface...\n",
+                        test_lock == DSLF_READ ? "read only" : test_lock == DSLF_WRITE ? "write only" : "read/write" );
+
+               ret = surface->Lock( surface, test_lock, &data, &pitch );
+               if (ret)
+                    DirectFBError( "IDirectFBSurface::Lock() failed", ret );
+               else
+                    fprintf( stderr, "  => OK\n\n" );
+
+               surface->Release( surface );
+          }
+     }
+
+     /* Release the display layer. */
+     layer->Release( layer );
+
+     /* Release the super interface. */
+     dfb->Release( dfb );
+
+     return EXIT_SUCCESS;
+}
+
+/*****************************************************************************/
+
+static void
+print_usage (const char *prg_name)
+{
+     int i = 0;
+
+     fprintf (stderr, "\nDirectFB Layer Configuration (version %s)\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "   -l,  --layer            <id>              Use the specified layer, default is primary\n");
+     fprintf (stderr, "   -m,  --mode             <width>x<height>  Change the resolution (pixels)\n");
+     fprintf (stderr, "   -f,  --format           <pixelformat>     Change the pixel format\n");
+     fprintf (stderr, "   -b,  --buffer           <buffermode>      Change the buffer mode (single/video/system)\n");
+     fprintf (stderr, "   -o,  --opacity          <opacity>         Change the layer's opacity (0-255)\n");
+     fprintf (stderr, "   -L,  --level            <level>           Change the layer's level\n");
+     fprintf (stderr, "   -R,  --rotate           <degree>          Change the layer rotation\n");
+     fprintf (stderr, "   -t,  --test-lock                          Get layer surface and Lock() it (read/write)\n");
+     fprintf (stderr, "   -tr, --test-lock-read                     Get layer surface and Lock() it (read  only)\n");
+     fprintf (stderr, "   -tw, --test-lock-write                    Get layer surface and Lock() it (write only)\n");
+     fprintf (stderr, "   -h,  --help                               Show this help message\n");
+     fprintf (stderr, "   -v,  --version                            Print version information\n");
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "Known pixel formats:\n");
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          DFBSurfacePixelFormat format = format_names[i].format;
+
+          fprintf (stderr, "   %-10s %2d bits, %d bytes",
+                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
+                   DFB_BYTES_PER_PIXEL(format));
+
+          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
+               fprintf (stderr, "   ALPHA");
+
+          if (DFB_PIXELFORMAT_IS_INDEXED(format))
+               fprintf (stderr, "   INDEXED");
+
+          if (DFB_PLANAR_PIXELFORMAT(format)) {
+               int planes = DFB_PLANE_MULTIPLY(format, 1000);
+
+               fprintf (stderr, "   PLANAR (x%d.%03d)",
+                        planes / 1000, planes % 1000);
+          }
+
+          fprintf (stderr, "\n");
+
+          ++i;
+     }
+     fprintf (stderr, "\n");
+
+     fprintf (stderr, "Valid buffer modes:\n");
+     fprintf (stderr, "   FRONTONLY     or 'single'\n");
+     fprintf (stderr, "   BACKVIDEO     or 'video'\n");
+     fprintf (stderr, "   BACKSYSTEM    or 'system'\n");
+     fprintf (stderr, "   TRIPLE\n");
+     fprintf (stderr, "   WINDOWS\n");
+
+     fprintf (stderr, "\n");
+     fprintf (stderr, "Specifying neither mode nor format just displays the current configuration.\n");
+     fprintf (stderr, "\n");
+}
+
+static DFBBoolean
+parse_layer( const char *arg )
+{
+     if (sscanf( arg, "%d", &id ) != 1 || id < 0) {
+          fprintf (stderr, "\n"
+                   "Invalid layer id specified!\n"
+                   "Check 'dfbinfo' for valid values.\n\n");
+
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_mode( const char *arg )
+{
+     if (sscanf( arg, "%dx%d", &width, &height ) != 2 ||
+         width < 1 || height < 1)
+     {
+          fprintf (stderr, "\nInvalid mode specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_format( const char *arg )
+{
+     int i = 0;
+
+     while (format_names[i].format != DSPF_UNKNOWN) {
+          if (!strcasecmp( arg, format_names[i].name )) {
+               format = format_names[i].format;
+               return DFB_TRUE;
+          }
+
+          ++i;
+     }
+
+     fprintf (stderr, "\nInvalid format specified!\n\n" );
+
+     return DFB_FALSE;
+}
+
+static DFBBoolean
+parse_buffermode( const char *arg )
+{
+     if (!strcasecmp( arg, "single" ) || !strcasecmp( arg, "frontonly" ))
+          buffermode = DLBM_FRONTONLY;
+     else if (!strcasecmp( arg, "system" ) || !strcasecmp( arg, "backsystem" ))
+          buffermode = DLBM_BACKSYSTEM;
+     else if (!strcasecmp( arg, "video" ) || !strcasecmp( arg, "backvideo" ))
+          buffermode = DLBM_BACKVIDEO;
+     else if (!strcasecmp( arg, "triple" ))
+          buffermode = DLBM_TRIPLE;
+     else if (!strcasecmp( arg, "windows" ))
+          buffermode = DLBM_WINDOWS;
+     else {
+          fprintf (stderr, "\nInvalid buffer mode specified!\n\n" );
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_opacity( const char *arg )
+{
+     if (sscanf( arg, "%d", &opacity ) != 1 || opacity < 0 || opacity > 255) {
+          fprintf (stderr, "\nInvalid opacity value specified!\n\n");
+
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_level( const char *arg )
+{
+     if (sscanf( arg, "%d", &level ) != 1) {
+          fprintf (stderr, "\nInvalid level specified!\n\n");
+
+          return DFB_FALSE;
+     }
+
+     set_level = DFB_TRUE;
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_rotation( const char *arg )
+{
+     if (sscanf( arg, "%d", &rotation ) != 1) {
+          fprintf (stderr, "\nInvalid rotation specified!\n\n");
+
+          return DFB_FALSE;
+     }
+
+     set_rotation = DFB_TRUE;
+
+     return DFB_TRUE;
+}
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[] )
+{
+     int n;
+
+     for (n = 1; n < argc; n++) {
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION);
+               return DFB_FALSE;
+          }
+
+          if (strcmp (arg, "-l") == 0 || strcmp (arg, "--layer") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_layer( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-m") == 0 || strcmp (arg, "--mode") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_mode( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-f") == 0 || strcmp (arg, "--format") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_format( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-b") == 0 || strcmp (arg, "--buffer") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_buffermode( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-o") == 0 || strcmp (arg, "--opacity") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_opacity( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-L") == 0 || strcmp (arg, "--level") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_level( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-R") == 0 || strcmp (arg, "--rotate") == 0) {
+               if (++n == argc) {
+                    print_usage (argv[0]);
+                    return DFB_FALSE;
+               }
+
+               if (!parse_rotation( argv[n] ))
+                    return DFB_FALSE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-t") == 0 || strcmp (arg, "--test-lock") == 0) {
+               test_lock = DSLF_READ | DSLF_WRITE;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-tr") == 0 || strcmp (arg, "--test-lock-read") == 0) {
+               test_lock = DSLF_READ;
+
+               continue;
+          }
+
+          if (strcmp (arg, "-tw") == 0 || strcmp (arg, "--test-lock-write") == 0) {
+               test_lock = DSLF_WRITE;
+
+               continue;
+          }
+
+          print_usage (argv[0]);
+
+          return DFB_FALSE;
+     }
+
+     return DFB_TRUE;
+}
+
+static void
+set_configuration( void )
+{
+     DFBResult             ret;
+     DFBDisplayLayerConfig config;
+
+     printf( "\n" );
+     printf( "%s\n", desc.name );
+     printf( "\n" );
+
+     config.flags = DLCONF_NONE;
+
+     if (width) {
+          config.flags |= DLCONF_WIDTH;
+          config.width  = width;
+     }
+
+     if (height) {
+          config.flags  |= DLCONF_HEIGHT;
+          config.height  = height;
+     }
+
+     if (format != DSPF_UNKNOWN) {
+          config.flags       |= DLCONF_PIXELFORMAT;
+          config.pixelformat  = format;
+     }
+
+     if (buffermode != -1) {
+          config.flags      |= DLCONF_BUFFERMODE;
+          config.buffermode  = buffermode;
+     }
+
+     /* Set the configuration if anything changed. */
+     if (config.flags) {
+          ret = layer->TestConfiguration( layer, &config, NULL );
+          if (ret) {
+               DirectFBError( "IDirectFBDisplayLayer::TestConfiguration() failed", ret );
+               return;
+          }
+
+          ret = layer->SetConfiguration( layer, &config );
+          if (ret) {
+               DirectFBError( "IDirectFBDisplayLayer::SetConfiguration() failed", ret );
+               return;
+          }
+     }
+
+     /* Get and show the current (new) configuration. */
+     ret = layer->GetConfiguration( layer, &config );
+     if (ret) {
+          DirectFBError( "IDirectFBDisplayLayer::GetConfiguration() failed", ret );
+          return;
+     }
+
+     /* Set the opacity if requested. */
+     if (opacity != -1) {
+          ret = layer->SetOpacity( layer, opacity );
+          if (ret == DFB_UNSUPPORTED)
+               fprintf( stderr, "Opacity value (%d) not supported!\n\n", opacity );
+          else if (ret)
+               DirectFBError( "IDirectFBDisplayLayer::SetOpacity() failed", ret );
+     }
+
+     /* Set the level if requested. */
+     if (set_level) {
+          ret = layer->SetLevel( layer, level );
+          if (ret == DFB_UNSUPPORTED)
+               fprintf( stderr, "Level (%d) not supported!\n\n", level );
+          else if (ret)
+               DirectFBError( "IDirectFBDisplayLayer::SetLevel() failed", ret );
+     }
+
+     /* Set the rotation if requested. */
+     if (set_rotation) {
+          ret = layer->SetRotation( layer, rotation );
+          if (ret == DFB_UNSUPPORTED)
+               fprintf( stderr, "Rotation (%d) not supported!\n\n", level );
+          else if (ret)
+               DirectFBError( "IDirectFBDisplayLayer::SetRotation() failed", ret );
+     }
+
+
+     if (config.flags & DLCONF_WIDTH)
+          printf( "Width       %d\n", config.width );
+
+     if (config.flags & DLCONF_HEIGHT)
+          printf( "Height      %d\n", config.height );
+
+     if (config.flags & DLCONF_PIXELFORMAT)
+          printf( "Format      %s\n",
+                  format_names[DFB_PIXELFORMAT_INDEX(config.pixelformat)].name );
+
+     if (config.flags & DLCONF_BUFFERMODE) {
+          printf( "Buffermode  " );
+
+          switch (config.buffermode) {
+               case DLBM_FRONTONLY:
+                    printf( "FRONTONLY\n" );
+                    break;
+               case DLBM_BACKVIDEO:
+                    printf( "BACKVIDEO\n" );
+                    break;
+               case DLBM_BACKSYSTEM:
+                    printf( "BACKSYSTEM\n" );
+                    break;
+               case DLBM_TRIPLE:
+                    printf( "TRIPLE\n" );
+                    break;
+               case DLBM_WINDOWS:
+                    printf( "WINDOWS\n" );
+                    break;
+               default:
+                    printf( "unknown!\n" );
+                    break;
+          }
+     }
+
+     if (config.flags & DLCONF_OPTIONS) {
+          printf( "Options     " );
+
+          if (config.options == DLOP_NONE) {
+               printf( "none\n" );
+          }
+          else {
+               if (config.options & DLOP_ALPHACHANNEL)
+                    printf( "ALPHA CHANNEL       " );
+
+               if (config.options & DLOP_DEINTERLACING)
+                    printf( "DEINTERLACING       " );
+
+               if (config.options & DLOP_DST_COLORKEY)
+                    printf( "DST COLOR KEY       " );
+
+               if (config.options & DLOP_FIELD_PARITY)
+                    printf( "FIELD PARITY        " );
+
+               if (config.options & DLOP_FLICKER_FILTERING)
+                    printf( "FLICKER FILTERING   " );
+
+               if (config.options & DLOP_OPACITY)
+                    printf( "OPACITY             " );
+
+               if (config.options & DLOP_SRC_COLORKEY)
+                    printf( "SRC COLOR KEY       " );
+
+               printf( "\n" );
+          }
+     }
+
+     /* Query current level. */
+     if (desc.caps & DLCAPS_LEVELS) {
+          int l;
+
+          ret = layer->GetLevel( layer, &l );
+          if (ret)
+               DirectFBError( "IDirectFBDisplayLayer::GetLevel() failed", ret );
+          else
+               printf( "Level       %d\n", l );
+     }
+
+     printf( "\n" );
+}
+
diff --git a/Source/DirectFB/tools/dfbmaster.c b/Source/DirectFB/tools/dfbmaster.c
new file mode 100755
index 0000000..8707f0d
--- /dev/null
+++ b/Source/DirectFB/tools/dfbmaster.c
@@ -0,0 +1,68 @@
+/*
+   (c) Copyright 2008  Denis Oliver Kropp
+
+   All rights reserved.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <direct/messages.h>
+
+#include <directfb.h>
+
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult  ret;
+     IDirectFB *dfb;
+     sigset_t   block;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "DFBMaster: DirectFBInit() failed!\n" );
+          return ret;
+     }
+
+
+     /* Create super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "DFBMaster: DirectFBCreate() failed!\n" );
+          return ret;
+     }
+
+
+     sigemptyset( &block );
+
+     sigsuspend( &block );
+
+
+     /* Shutdown DirectFB. */
+     dfb->Release( dfb );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tools/dfbpenmount.c b/Source/DirectFB/tools/dfbpenmount.c
new file mode 100755
index 0000000..ce3100b
--- /dev/null
+++ b/Source/DirectFB/tools/dfbpenmount.c
@@ -0,0 +1,228 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Nikita Egorov <nikego@gmail.com>
+   
+   Calibration utility for PenMount's touchscreen panel. Run the program 
+   and touch to center of left/top cross ( active cross is blinked ). 
+   Then touch to right/bottom cross. The program will create four values for 
+   penmout's driver. The values will be printed to the console.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <directfb.h>
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string.h>
+
+static IDirectFB *dfb;
+static IDirectFBSurface *primary;
+static IDirectFBEventBuffer *buffer;
+static int sx,sy;
+
+int
+main( int argc, char *argv[] )
+{
+     int quit = 0;
+     DFBResult err;
+     DFBGraphicsDeviceDescription gdesc;
+     
+     char init_str[64];
+     const char* dev = "/dev/ttyS0";
+     char buf[4096]={0};
+     
+     char *home = getenv( "HOME" );
+     int   file;
+
+     int leftx, topy, rightx, bottomy, ofs;
+     int mouse_x, mouse_y, tx1, ty1;
+     int touch, count, color; 
+	struct timespec rqtp,rmtp;
+     
+     if(home)
+         sprintf(init_str,"%s/.directfbrc",home);
+	 else
+	     strcpy(init_str,"root/.directfbrc");
+	 		   
+	 file = open ( init_str, O_RDONLY );
+	 if ( file != -1 ){
+	 	 char *pos, *pos2;
+           read(file, buf, sizeof(buf));
+		 close(file);
+	 
+		 pos = strstr( buf, "penmount-device" );
+		 if(pos){
+	 		 pos = strchr(pos,'=');
+		 	 if(pos){
+		 	 	*pos++ = '\0';
+	 		 	if( (pos2=strchr(pos,':'))||(pos2=strchr(pos,'\n')) )
+	 	 			*pos2 = '\0';
+		 	 	dev = pos;	
+		 	 }
+		 } 
+	 }
+	 printf( "penmount device '%s'\n", dev );
+	 
+	 sprintf( init_str,"--dfb:penmount-device=%s:raw", dev);
+	 argv[argc++] = init_str;
+	 	
+     if (DirectFBInit( &argc, &argv ) != DFB_OK)
+          return 1;
+
+     if (DirectFBCreate( &dfb ) != DFB_OK)
+          return 1;
+
+     dfb->GetDeviceDescription( dfb, &gdesc );
+
+	 err = dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
+     if (err != DFB_OK)
+          DirectFBError( "Failed requesting exclusive access", err );
+
+     err = dfb->CreateInputEventBuffer( dfb, DICAPS_ALL, DFB_FALSE, &buffer );
+     if (err != DFB_OK) {
+          DirectFBError( "CreateInputEventBuffer failed", err );
+          dfb->Release( dfb );
+          return 1;
+     }
+
+     {
+          DFBSurfaceDescription dsc;
+
+          dsc.flags = DSDESC_CAPS;
+          dsc.caps = (gdesc.drawing_flags & DSDRAW_BLEND) ?
+                         DSCAPS_PRIMARY | DSCAPS_FLIPPING :
+                         DSCAPS_PRIMARY | DSCAPS_FLIPPING | DSCAPS_SYSTEMONLY;
+
+          err = dfb->CreateSurface( dfb, &dsc, &primary );
+          if (err != DFB_OK) {
+               DirectFBError( "Failed creating primary surface", err );
+               buffer->Release( buffer );
+               dfb->Release( dfb );
+               return 1;
+          }
+
+          primary->GetSize( primary, &sx, &sy );
+     }
+
+     primary->Clear( primary, 0x0, 0x0, 0x0, 0xFF );
+     
+     leftx = sx/10;
+     topy = sy/10;
+     rightx = sx*9/10;
+     bottomy = sy*9/10;
+     ofs = 10;
+
+     primary->SetColor( primary,0xFF,0,0,0xFF );
+   	 primary->DrawLine( primary,rightx-ofs,bottomy,rightx+ofs,bottomy );
+     primary->DrawLine( primary,rightx,bottomy-ofs,rightx,bottomy+ofs );
+	      
+     err = primary->Flip( primary, NULL, 0 );
+     if (err != DFB_OK) {
+          DirectFBError( "Failed flipping the primary surface", err );
+          primary->Release( primary );
+          buffer->Release( buffer );
+          dfb->Release( dfb );
+          return 1;
+     }
+
+	mouse_x=0,mouse_y=0,tx1=0,ty1=0;
+	touch=0,count=0,color=0;
+      
+     while (!quit) {
+          DFBInputEvent evt;
+          rqtp.tv_nsec = 10000;
+          rqtp.tv_sec = 0;
+          nanosleep( &rqtp,&rmtp );
+          if (count++ >= 30){
+          	count = 0;
+          	color = !color;
+          	if (color)
+          		primary->SetColor( primary,0x00,0xFF,0,0xFF );
+          	else
+          		primary->SetColor( primary,0xFF,0x00,0,0xFF );
+          	
+          	switch(touch){
+          		case 0:
+          			primary->DrawLine( primary,leftx-ofs,topy,leftx+ofs,topy );
+     				primary->DrawLine( primary,leftx,topy-ofs,leftx,topy+ofs );
+     				break;
+     			case 1:
+				    primary->DrawLine( primary,rightx-ofs,bottomy,rightx+ofs,bottomy );
+				    primary->DrawLine( primary,rightx,bottomy-ofs,rightx,bottomy+ofs );  			
+     				break;
+          	}
+          	primary->Flip( primary, NULL, 0 );
+          }		 
+
+          while (buffer->GetEvent( buffer, DFB_EVENT(&evt) ) == DFB_OK) {
+          	if ( evt.type == DIET_AXISMOTION){
+          		if (evt.flags & DIEF_AXISABS) {
+	               	switch (evt.axis) {
+	               	case DIAI_X:
+	                    mouse_x = evt.axisabs;
+	               		break;
+	               	case DIAI_Y:
+	                    mouse_y = evt.axisabs;
+	                    break;
+	               default:
+	                    break;
+	               }
+          		}
+          	}
+          	if ( evt.type == DIET_BUTTONPRESS ){
+          		switch(++touch){
+          			case 1: //save first touchscreen position
+          				tx1=mouse_x;
+          				ty1=mouse_y;
+          				break;
+          			case 2://build new calibration values and quit
+          			{	
+          				float dx = ((float)mouse_x-tx1)/(rightx-leftx);
+          				float dy = ((float)mouse_y-ty1)/(bottomy-topy);
+          				printf( "Insert followed values into source code of penmount's driver\n'inputdrivers/penmount/penmount.c:96,99' and rebuild:\n" );
+          				printf( "min_x=%d min_y=%d\n",(int)(tx1-leftx*dx+.5),(int)(ty1-topy*dy+.5));
+           				printf( "max_x=%d max_y=%d\n",(int)(mouse_x+leftx*dx+.5),(int)(mouse_y+topy*dy+.5));
+ 	                 	quit = 1;
+ 	                 	break;
+          			}
+           		}
+           	}
+            if (evt.type == DIET_KEYPRESS  &&  evt.key_id == DIKI_ESCAPE)
+                 quit = 1;
+          }
+     }
+     primary->Release( primary );
+     buffer->Release( buffer );
+     dfb->Release( dfb );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tools/dfbproxy.c b/Source/DirectFB/tools/dfbproxy.c
new file mode 100755
index 0000000..bf48af0
--- /dev/null
+++ b/Source/DirectFB/tools/dfbproxy.c
@@ -0,0 +1,162 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <directfb.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/mem.h>
+#include <direct/messages.h>
+
+#include <voodoo/play.h>
+#include <voodoo/server.h>
+
+/*****************************************************************************/
+
+static DFBBoolean parse_command_line( int argc, char *argv[] );
+static DFBResult  server_run();
+
+/*****************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          DirectFBError( "DirectFBInit() failed", ret );
+          return -1;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          return -2;
+
+     /* Run the server. */
+     return server_run();
+}
+
+/*****************************************************************************/
+
+static DirectResult
+ConstructDispatcher( VoodooServer     *server,
+                     VoodooManager    *manager,
+                     const char       *name,
+                     void             *ctx,
+                     VoodooInstanceID *ret_instance )
+{
+     DirectResult          ret;
+     DirectInterfaceFuncs *funcs;
+     void                 *interface;
+     VoodooInstanceID      instance;
+
+     D_ASSERT( server != NULL );
+     D_ASSERT( manager != NULL );
+     D_ASSERT( name != NULL );
+     D_ASSERT( ret_instance != NULL );
+
+     ret = DirectGetInterface( &funcs, name, "Dispatcher", NULL, NULL );
+     if (ret)
+          return ret;
+
+     ret = funcs->Allocate( &interface );
+     if (ret)
+          return ret;
+
+     ret = funcs->Construct( interface, manager, &instance );
+     if (ret)
+          return ret;
+
+     *ret_instance = instance;
+
+     return DFB_OK;
+}
+
+/*****************************************************************************/
+
+static DFBBoolean
+parse_command_line( int argc, char *argv[] )
+{
+     return DFB_TRUE;
+}
+
+static DFBResult
+server_run()
+{
+     DFBResult     ret;
+     VoodooPlayer *player = NULL;
+     VoodooServer *server = NULL;
+
+     ret = voodoo_player_create( NULL, &player );
+     if (ret) {
+          D_ERROR( "Voodoo/Proxy: Could not create the player (%s)!\n", DirectFBErrorString(ret) );
+          goto out;
+     }
+
+     ret = voodoo_server_create( &server );
+     if (ret) {
+          D_ERROR( "Voodoo/Proxy: Could not create the server (%s)!\n", DirectFBErrorString(ret) );
+          goto out;
+     }
+
+     ret = voodoo_server_register( server, "IDirectFB", ConstructDispatcher, NULL );
+     if (ret) {
+          D_ERROR( "Voodoo/Proxy: Could not register super interface 'IDirectFB'!\n" );
+          goto out;
+     }
+
+     ret = voodoo_server_register( server, "IDiVine", ConstructDispatcher, NULL );
+     if (ret) {
+          D_ERROR( "Voodoo/Proxy: Could not register super interface 'IDiVine'!\n" );
+          goto out;
+     }
+
+     ret = voodoo_server_run( server, true );
+     if (ret)
+          D_ERROR( "Voodoo/Proxy: Server exiting with error (%s)!\n", DirectFBErrorString(ret) );
+
+out:
+     if (server)
+     voodoo_server_destroy( server );
+
+     if (player)
+          voodoo_player_destroy( player );
+
+     return ret;
+}
+
diff --git a/Source/DirectFB/tools/dfbscreen.c b/Source/DirectFB/tools/dfbscreen.c
new file mode 100755
index 0000000..b961d38
--- /dev/null
+++ b/Source/DirectFB/tools/dfbscreen.c
@@ -0,0 +1,660 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <direct/messages.h>
+#include <direct/util.h>
+
+#include <directfb.h>
+#include <directfb_strings.h>
+
+static const DirectFBScreenMixerTreeNames( tree_names );
+static const DirectFBScreenEncoderScanModeNames( scan_mode_names );
+static const DirectFBScreenEncoderTestPictureNames( test_picture_names );
+static const DirectFBScreenEncoderTVStandardsNames( tv_standard_names );
+static const DirectFBScreenOutputSignalsNames( signal_names );
+
+/**************************************************************************************************/
+
+static IDirectFB            *dfb;
+static IDirectFBScreen      *screen;
+static DFBScreenDescription  desc;
+
+/**************************************************************************************************/
+
+static DFBScreenID id      = DSCID_PRIMARY;
+static int         mixer   = 0;
+static int         encoder = 0;
+static int         output  = 0;
+
+/**************************************************************************************************/
+
+static DFBScreenMixerConfig   mixer_config;
+static DFBScreenEncoderConfig encoder_config;
+static DFBScreenOutputConfig  output_config;
+
+/**************************************************************************************************/
+
+static bool parse_command_line( int argc, char *argv[] );
+
+/**************************************************************************************************/
+
+static void dump_mixer_config  ( const DFBScreenMixerConfig   *config );
+static void dump_encoder_config( const DFBScreenEncoderConfig *config );
+
+/**************************************************************************************************/
+
+int
+main( int argc, char *argv[] )
+{
+     DFBResult ret;
+
+     /* Initialize DirectFB including command line parsing. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret) {
+          D_DERROR( ret, "Tools/Screen: DirectFBInit() failed!\n" );
+          goto error;
+     }
+
+     /* Parse the command line. */
+     if (!parse_command_line( argc, argv ))
+          goto error;
+
+     /* Create the super interface. */
+     ret = DirectFBCreate( &dfb );
+     if (ret) {
+          D_DERROR( ret, "Tools/Screen: DirectFBCreate() failed!\n" );
+          goto error;
+     }
+
+     /* Get the primary display screen. */
+     ret = dfb->GetScreen( dfb, id, &screen );
+     if (ret) {
+          if (ret == DFB_IDNOTFOUND)
+               fprintf (stderr, "\nUnknown screen id, check 'dfbinfo' for valid values.\n\n");
+          else
+               D_DERROR( ret, "Tools/Screen: IDirectFB::GetScreen() failed!\n" );
+
+          goto error;
+     }
+
+     /* Get a description of the screen. */
+     ret = screen->GetDescription( screen, &desc );
+     if (ret) {
+          D_DERROR( ret, "Tools/Screen: IDirectFBScreen::GetDescription() failed!\n" );
+          goto error;
+     }
+
+     /* Check arguments. */
+     if (mixer_config.flags && (mixer < 0 || mixer >= desc.mixers)) {
+          fprintf (stderr, "\nUnknown mixer (%d), check 'dfbinfo' for valid values.\n\n", mixer);
+          goto error;
+     }
+
+     if (encoder_config.flags && (encoder < 0 || encoder >= desc.encoders)) {
+          fprintf (stderr, "\nUnknown encoder (%d), check 'dfbinfo' for valid values.\n\n", encoder);
+          goto error;
+     }
+
+     if (output_config.flags && (output < 0 || output >= desc.outputs)) {
+          fprintf (stderr, "\nUnknown output (%d), check 'dfbinfo' for valid values.\n\n", output);
+          goto error;
+     }
+
+     printf( "\n" );
+
+     /* Do mixer. */
+     if (mixer < desc.mixers && mixer >= 0) {
+          DFBScreenMixerConfig config;
+
+          printf( "\nMixer %d\n", mixer );
+
+          if (mixer_config.flags) {
+               ret = screen->SetMixerConfiguration( screen, mixer, &mixer_config );
+               if (ret) {
+                    D_DERROR( ret, "Tools/Screen: "
+                              "IDirectFBScreen::SetMixerConfiguration(%d) failed!\n", mixer );
+                    goto error;
+               }
+          }
+
+          ret = screen->GetMixerConfiguration( screen, mixer, &config );
+          if (ret) {
+               D_DERROR( ret, "Tools/Screen: "
+                         "IDirectFBScreen::GetMixerConfiguration(%d) failed!\n", mixer );
+               goto error;
+          }
+
+          dump_mixer_config( &config );
+     }
+
+     /* Do encoder. */
+     if (encoder < desc.encoders && encoder >= 0) {
+          DFBScreenEncoderConfig config;
+
+          printf( "\nEncoder %d\n", encoder );
+
+          if (encoder_config.flags) {
+               ret = screen->SetEncoderConfiguration( screen, encoder, &encoder_config );
+               if (ret) {
+                    D_DERROR( ret, "Tools/Screen: "
+                              "IDirectFBScreen::SetEncoderConfiguration(%d) failed!\n", encoder );
+                    goto error;
+               }
+          }
+
+          ret = screen->GetEncoderConfiguration( screen, encoder, &config );
+          if (ret) {
+               D_DERROR( ret, "Tools/Screen: "
+                         "IDirectFBScreen::GetEncoderConfiguration(%d) failed!\n", mixer );
+               goto error;
+          }
+
+          dump_encoder_config( &config );
+     }
+
+error:
+     /* Release the display screen. */
+     if (screen)
+          screen->Release( screen );
+
+     /* Release the super interface. */
+     if (dfb)
+          dfb->Release( dfb );
+
+     return ret;
+}
+
+/**************************************************************************************************/
+
+typedef struct __AnyOption AnyOption;
+
+
+typedef bool (*ParseFunc)( const AnyOption *option,
+                           const char      *arg );
+
+struct __AnyOption {
+     const char   *short_name;
+     const char   *long_name;
+
+     const char   *arg_name;
+     const char   *arg_desc;
+
+     void         *value;
+
+     unsigned int *flags;
+     unsigned int  flag;
+
+     ParseFunc     parse;
+     const void   *data;
+};
+
+typedef struct {
+     int           value;
+     const char   *name;
+} ValueName;
+
+/**************************************************************************************************/
+
+static bool parse_int  ( const AnyOption *option,
+                         const char      *arg );
+
+static bool parse_enum ( const AnyOption *option,
+                         const char      *arg );
+
+static bool parse_ids  ( const AnyOption *option,
+                         const char      *arg );
+
+static bool parse_color( const AnyOption *option,
+                         const char      *arg );
+
+/**************************************************************************************************/
+
+static const AnyOption options[] = {
+     { "-s",  "--screen",       "<id>",       "ID of screen to use",
+       &id,      NULL, 0, parse_int, NULL },
+
+
+     { "-m",  "--mixer",        "<index>",    "Index of mixer to use",
+       &mixer,   NULL, 0, parse_int, NULL },
+
+     { "-mt", "--tree",         "<mode>",     "Set (sub) tree mode",
+       &mixer_config.tree, &mixer_config.flags,
+       DSMCONF_TREE, parse_enum, tree_names },
+
+     { "-mm", "--max-level",    "<level>",    "Set maximum level for SUB_LEVEL mode",
+       &mixer_config.level, &mixer_config.flags,
+       DSMCONF_LEVEL, parse_int, NULL },
+
+     { "-ml", "--layers",       "<layers>",   "Select layers for SUB_LAYERS mode",
+       &mixer_config.layers, &mixer_config.flags,
+       DSMCONF_LAYERS, parse_ids, NULL },
+
+     { "-mb", "--background",   "<rgb>",      "Set background color (hex)",
+       &mixer_config.background, &mixer_config.flags,
+       DSMCONF_BACKGROUND, parse_color, NULL },
+
+
+     { "-e",  "--encoder",      "<index>",    "Index of encoder to use",
+       &encoder, NULL, 0, parse_int, NULL },
+
+     { "-et", "--tv-standard",  "<standard>", "Set TV standard",
+       &encoder_config.tv_standard, &encoder_config.flags,
+       DSECONF_TV_STANDARD, parse_enum, tv_standard_names },
+
+     { "-ep", "--test-picture", "<mode>",     "Set test picture mode",
+       &encoder_config.test_picture, &encoder_config.flags,
+       DSECONF_TEST_PICTURE, parse_enum, test_picture_names },
+
+     { "-em", "--sel-mixer",    "<index>",    "Select mixer for input",
+       &encoder_config.mixer, &encoder_config.flags,
+       DSECONF_MIXER, parse_int, NULL },
+
+     { "-es", "--encode-sigs",  "<signals>",  "Select signal(s) to encode",
+       &encoder_config.out_signals, &encoder_config.flags,
+       DSECONF_OUT_SIGNALS, parse_enum, signal_names },
+
+     { "-ec", "--scan-mode",    "<mode>",     "Set scan mode",
+       &encoder_config.scanmode, &encoder_config.flags,
+       DSECONF_SCANMODE, parse_enum, scan_mode_names },
+
+
+     { "-o",  "--output",       "<index>",    "Index of output to use",
+       &output,  NULL, 0, parse_int, NULL }
+};
+
+static void
+print_usage (const char *prg_name)
+{
+     int i;
+
+     fprintf (stderr, "\nDirectFB Screen Configuration (version %s)\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
+     fprintf (stderr, "Options:\n");
+     fprintf (stderr, "   -h   --help                             Show this help message\n");
+     fprintf (stderr, "   -v   --version                          Print version information\n");
+
+     for (i=0; i<D_ARRAY_SIZE(options); i++) {
+          const AnyOption *option = &options[i];
+
+          fprintf( stderr, "   %-3s  %-16s   %-12s    %s\n",
+                   option->short_name, option->long_name, option->arg_name, option->arg_desc );
+     }
+
+     fprintf (stderr, "\n");
+}
+
+static bool
+parse_int( const AnyOption *option, const char *arg )
+{
+     int   ret;
+     char *end;
+
+     ret = strtoul( arg, &end, option->data ? (unsigned long) option->data : 10 );
+
+     if (*end || ret < 0) {
+          fprintf( stderr, "\nInvalid argument to '%s' or '%s' specified!\n\n",
+                   option->short_name, option->long_name );
+
+          return false;
+     }
+
+     *((int*)option->value) = ret;
+
+     return true;
+}
+
+static bool
+parse_enum( const AnyOption *option, const char *arg )
+{
+     int val = 0;
+
+     if (! strcasecmp( arg, "help" )) {
+          const ValueName *vn = option->data;
+
+          fprintf( stderr, "\nPossible arguments to '%s' or '%s':\n",
+                   option->short_name, option->long_name );
+
+          do {
+               fprintf( stderr, "    %s\n", vn->name );
+          } while (vn++->value);
+
+          fprintf (stderr, "\n");
+
+          return false;
+     }
+
+     while (arg[0] == ',')
+          arg++;
+
+     while (arg[0]) {
+          char            *p;
+          int              len;
+          int              vc = 0;
+          bool             ok = false;
+          const ValueName *vn = option->data;
+
+          p = strchr( arg, ',' );
+          if (p)
+               len = p - arg;
+          else
+               len = strlen( arg );
+
+          do {
+               int vlen = strlen(vn->name);
+
+               if (strncasecmp( vn->name, arg, len ))
+                    continue;
+
+               vc = vn->value;
+               ok = true;
+
+               if (vlen == len)
+                    break;
+          } while (vn++->value);
+
+          if (ok)
+               val |= vc;
+          else {
+               fprintf( stderr, "\nInvalid argument to '%s' or '%s' specified, "
+                        "pass 'help' for a list!\n\n", option->short_name, option->long_name );
+               return false;
+          }
+
+          arg += len;
+
+          while (arg[0] == ',')
+               arg++;
+     }
+
+     *((int*)option->value) = val;
+
+     return true;
+}
+
+static bool
+parse_ids( const AnyOption *option, const char *arg )
+{
+     u32    val  = 0;
+     int    alen = strlen( arg );
+     char  *abuf = alloca( alen + 1 );
+
+     memcpy( abuf, arg, alen + 1 );
+
+     if (! strcasecmp( arg, "help" )) {
+          fprintf( stderr, "\nCheck 'dfbinfo' for valid values.\n\n" );
+          return false;
+     }
+
+     while (abuf[0] == ',')
+          abuf++;
+
+     while (abuf[0]) {
+          char *p;
+          int   len;
+          int   ret;
+
+          p = strchr( abuf, ',' );
+          if (p) {
+               len = p - abuf;
+
+               abuf[len++] = 0;
+          }
+          else
+               len = strlen( abuf );
+
+          ret = strtoul( abuf, &p, 10 );
+
+          if (*p || ret < 0) {
+               fprintf( stderr, "\nInvalid argument (%s) to '%s' or '%s' specified!\n\n",
+                        p, option->short_name, option->long_name );
+
+               return false;
+          }
+
+          val |= (1 << ret);
+
+          abuf += len;
+
+          while (abuf[0] == ',')
+               abuf++;
+     }
+
+     *((u32*)option->value) = val;
+
+     return true;
+}
+
+static bool
+parse_color( const AnyOption *option, const char *arg )
+{
+     unsigned long  ret;
+     char          *end;
+     DFBColor      *color = option->value;
+
+     ret = strtoul( arg, &end, 16 );
+
+     if (*end) {
+          fprintf( stderr, "\nInvalid argument (%s) to '%s' or '%s' specified!\n\n",
+                   end, option->short_name, option->long_name );
+
+          return false;
+     }
+
+     color->a = (ret >> 24) & 0xff;
+     color->r = (ret >> 16) & 0xff;
+     color->g = (ret >>  8) & 0xff;
+     color->b = (ret      ) & 0xff;
+
+     return true;
+}
+
+static bool
+parse_option( const AnyOption *option, const char *arg )
+{
+     if (!option->parse( option, arg ))
+          return false;
+
+     if (option->flags)
+          *option->flags |= option->flag;
+
+     return true;
+}
+
+static bool
+parse_command_line( int argc, char *argv[] )
+{
+     int i, n;
+
+     for (n = 1; n < argc; n++) {
+          bool        ok  = false;
+          const char *arg = argv[n];
+
+          if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) {
+               print_usage (argv[0]);
+               return false;
+          }
+
+          if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
+               fprintf (stderr, "dfbscreen version %s\n", DIRECTFB_VERSION);
+               return false;
+          }
+
+          for (i=0; i<D_ARRAY_SIZE(options); i++) {
+               const AnyOption *opt = &options[i];
+
+               if (!strcmp (arg, opt->short_name) || !strcmp (arg, opt->long_name)) {
+                    if (++n == argc) {
+                         print_usage (argv[0]);
+                         return false;
+                    }
+
+                    if (!parse_option( opt, argv[n] ))
+                         return false;
+
+                    ok = true;
+
+                    break;
+               }
+          }
+
+          if (!ok) {
+               print_usage (argv[0]);
+               return false;
+          }
+     }
+
+     return true;
+}
+
+/**************************************************************************************************/
+
+static const char *
+tree_name( DFBScreenMixerTree tree )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(tree_names); i++) {
+          if (tree_names[i].tree == tree)
+               return tree_names[i].name;
+     }
+
+     return "<invalid>";
+}
+
+static void
+dump_mixer_config( const DFBScreenMixerConfig *config )
+{
+     int n;
+
+     printf( "\n" );
+
+     if (config->flags & DSMCONF_TREE)
+          printf( "Tree:          %s\n", tree_name( config->tree ) );
+
+     if (config->flags & DSMCONF_LEVEL)
+          printf( "Level:         %d\n", config->level );
+
+     if (config->flags & DSMCONF_LAYERS) {
+          printf( "Layers:        " );
+
+          for (n=0; n<DFB_DISPLAYLAYER_IDS_MAX; n++) {
+               if (DFB_DISPLAYLAYER_IDS_HAVE( config->layers, n ))
+                    printf( "(%02x) ", n );
+          }
+
+          printf( "\n" );
+     }
+
+     if (config->flags & DSMCONF_BACKGROUND)
+          printf( "Background:    0x%02x, 0x%02x, 0x%02x (RGB)\n",
+                  config->background.r, config->background.g, config->background.b );
+
+     printf( "\n" );
+}
+
+/**************************************************************************************************/
+
+static const char *
+test_picture_name( DFBScreenEncoderTestPicture test_picture )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(test_picture_names); i++) {
+          if (test_picture_names[i].test_picture == test_picture)
+               return test_picture_names[i].name;
+     }
+
+     return "<invalid>";
+}
+
+static const char *
+scan_mode_name( DFBScreenEncoderTestPicture scan_mode )
+{
+     int i;
+
+     for (i=0; i<D_ARRAY_SIZE(scan_mode_names); i++) {
+          if (scan_mode_names[i].scan_mode == scan_mode)
+               return scan_mode_names[i].name;
+     }
+
+     return "<invalid>";
+}
+
+static void
+dump_encoder_config( const DFBScreenEncoderConfig *config )
+{
+     int i;
+
+     printf( "\n" );
+
+     if (config->flags & DSECONF_TV_STANDARD) {
+          printf( "TV Standard:   " );
+
+          for (i=0; i<D_ARRAY_SIZE(tv_standard_names); i++) {
+               if (config->tv_standard & tv_standard_names[i].standard)
+                    printf( "%s ", tv_standard_names[i].name );
+          }
+
+          printf( "\n" );
+     }
+
+     if (config->flags & DSECONF_TEST_PICTURE)
+          printf( "Test Picture:  %s\n", test_picture_name( config->test_picture ) );
+
+     if (config->flags & DSECONF_MIXER)
+          printf( "Mixer:         %d\n", config->mixer );
+
+     if (config->flags & DSECONF_OUT_SIGNALS) {
+          printf( "Signals:       " );
+
+          for (i=0; i<D_ARRAY_SIZE(signal_names); i++) {
+               if (config->out_signals & signal_names[i].signal)
+                    printf( "%s ", signal_names[i].name );
+          }
+
+          printf( "\n" );
+     }
+
+     if (config->flags & DSECONF_SCANMODE)
+          printf( "Scan Mode:     %s\n", scan_mode_name( config->scanmode ) );
+
+     printf( "\n" );
+}
+
diff --git a/Source/DirectFB/tools/directfb-csource.c b/Source/DirectFB/tools/directfb-csource.c
new file mode 100755
index 0000000..027bd83
--- /dev/null
+++ b/Source/DirectFB/tools/directfb-csource.c
@@ -0,0 +1,894 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   directfb-csource is based on gdk-pixbuf-csource, a GdkPixbuf
+   based image CSource generator  Copyright (C) 1999, 2001 Tim Janik
+
+   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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <png.h>
+
+#include <directfb.h>
+
+#include <direct/types.h>
+#include <direct/util.h>
+
+#include <gfx/convert.h>
+
+#define DFB_DITHER565 DFB_DITHER_ADVANCED
+#include <misc/dither565.h>
+
+
+static struct {
+     DFBSurfacePixelFormat  format;
+     const char             *name;
+} pixelformats[] = {
+     { DSPF_ARGB,     "ARGB"     },
+     { DSPF_ARGB1555, "ARGB1555" },
+     { DSPF_ARGB2554, "ARGB2554" },
+     { DSPF_ARGB4444, "ARGB4444" },
+     { DSPF_RGB32,    "RGB32"    },
+     { DSPF_RGB24,    "RGB24"    },
+     { DSPF_RGB16,    "RGB16"    },
+     { DSPF_RGB332,   "RGB332"   },
+     { DSPF_A8,       "A8"       },
+     { DSPF_LUT8,     "LUT8"     }
+};
+static int n_pixelformats = D_ARRAY_SIZE( pixelformats );
+
+
+static void       print_usage     (const char             *prg_name);
+static DFBResult  load_image      (const char             *filename,
+                                   DFBSurfaceDescription  *desc,
+                                   DFBColor               *palette,
+                                   int                    *palette_size,
+                                   DFBSurfacePixelFormat   rgbformat,
+                                   bool                    dither565);
+static void       dither_rgb16    (const u32              *src,
+                                   u16                    *dest,
+                                   int                     y,
+                                   int                     width);
+static DFBResult  merge_images    (DFBSurfaceDescription  *images,
+                                   int                     num_images,
+                                   DFBSurfaceDescription  *dest,
+                                   DFBRectangle           *rectangles);
+static DFBResult  dump_raw_data   (const char             *name,
+                                   const unsigned char    *data,
+                                   unsigned int            len);
+static DFBResult  dump_image      (const char             *name,
+                                   DFBSurfaceDescription  *desc,
+                                   DFBColor               *palette,
+                                   int                     palette_size);
+static DFBResult  dump_rectangles (const char             *name,
+                                   DFBRectangle           *rectangles,
+                                   const char            **names,
+                                   int                     num_rects);
+static char *     variable_name   (const char             *name);
+static char *     base_name       (const char             *name);
+
+
+int main (int         argc,
+          const char *argv[])
+{
+     DFBSurfaceDescription desc      = { flags: 0 };
+     DFBSurfacePixelFormat format    = DSPF_UNKNOWN;
+     DFBSurfacePixelFormat rgbformat = DSPF_UNKNOWN;
+     DFBColor  palette[256];
+
+     const char *filename[argc];
+     const char *name           = NULL;
+     int         palette_size   = 0;
+     int         num_images     = 0;
+     int         i, n;
+     bool        rawmode        = 0;
+     bool        dither565      = 0;
+
+     /*  parse command line  */
+
+     for (n = 1; n < argc; n++) {
+          if (strncmp (argv[n], "--", 2) == 0) {
+
+               const char *arg = argv[n] + 2;
+
+               if (strcmp (arg, "help") == 0) {
+                    print_usage (argv[0]);
+                    return EXIT_SUCCESS;
+               }
+               if (strcmp (arg, "version") == 0) {
+                    fprintf (stderr, "directfb-csource version %s\n",
+                             DIRECTFB_VERSION);
+                    return EXIT_SUCCESS;
+               }
+               if (strcmp (arg, "raw") == 0) {
+                    rawmode = 1;
+                    continue;
+               }
+               if (strcmp (arg, "dither-rgb16") == 0) {
+                    dither565 = 1;
+                    continue;
+               }
+               if (strncmp (arg, "format=", 7) == 0 && !format) {
+                    for (i = 0; i < n_pixelformats && !format; i++)
+                         if (!strcasecmp (pixelformats[i].name, arg + 7))
+                              format = pixelformats[i].format;
+                    if (format)
+                         continue;
+               }
+               if (strncmp (arg, "rgbformat=", 10) == 0 && !rgbformat) {
+                    for (i = 0; i < n_pixelformats && !rgbformat; i++)
+                         if (!strcasecmp (pixelformats[i].name, arg + 10))
+                              rgbformat = pixelformats[i].format;
+                    if (rgbformat)
+                         continue;
+               }
+               if (strncmp (arg, "name=", 5) == 0 && !name) {
+                    name = arg + 5;
+                    if (*name)
+                         continue;
+               }
+
+               print_usage (argv[0]);
+               return EXIT_FAILURE;
+          }
+
+          filename[num_images++] = argv[n];
+     }
+
+     /*  check parameters  */
+
+     if (! num_images) {
+          print_usage (argv[0]);
+          return EXIT_FAILURE;
+     }
+
+     if (num_images > 1 && rawmode) {
+          fprintf (stderr,
+                   "Multiple input files not allowed in raw mode.\n");
+          return EXIT_FAILURE;
+     }
+
+     if (num_images > 1 && !name) {
+          fprintf (stderr,
+                   "You must specify a variable name when using multiple images.\n");
+          return EXIT_FAILURE;
+     }
+
+     /*  load the first image  */
+
+     if (rawmode) {
+
+          struct stat statbuf; 
+          if (0 == stat(filename[0], &statbuf))
+          {
+               FILE *f;
+               unsigned char *data = alloca(statbuf.st_size);
+               memset(data, 0, statbuf.st_size);
+
+               f = fopen(filename[0], "r");
+               if (f)
+               {
+                    fread(data, statbuf.st_size, 1, f);
+                    fclose(f);
+               }
+
+               return dump_raw_data(name ? : strrchr (filename[0], '/') ? : filename[0],
+                                    data, statbuf.st_size);
+          }
+          
+     }
+     else {
+          if (format) {
+               desc.flags = DSDESC_PIXELFORMAT;
+               desc.pixelformat = format;
+          }
+
+          if (load_image (filename[0],
+                          &desc, palette, &palette_size,
+                          rgbformat, dither565) != DFB_OK)
+               return EXIT_FAILURE;
+
+          /*  dump it and quit if this is the only image on the command line  */
+          
+          if (num_images == 1)
+               return dump_image (name ? : strrchr (filename[0], '/') ? : filename[0],
+                                  &desc, palette, palette_size);
+     }
+
+     /*  merge multiple images into one surface  */
+     {
+          DFBSurfaceDescription  image[num_images];
+          DFBRectangle           rect[num_images];
+          DFBColor               foo[256];
+          int                    foo_size;
+
+          image[0] = desc;
+
+          for (i = 1; i < num_images; i++) {
+               image[i].flags = DSDESC_PIXELFORMAT;
+               image[i].pixelformat = desc.pixelformat;
+
+               if (load_image (filename[i],
+                               image + i, foo, &foo_size, rgbformat,
+                               dither565) != DFB_OK)
+                    return EXIT_FAILURE;
+          }
+
+          if (merge_images (image, num_images, &desc, rect) != DFB_OK)
+               return EXIT_FAILURE;
+
+          /*  dump the rectangles, then the surface  */
+
+          if (dump_rectangles (name, rect, filename, num_images) != DFB_OK)
+               return EXIT_FAILURE;
+
+          return dump_image (name, &desc, palette, palette_size);
+     }
+}
+
+static void print_usage (const char *prg_name)
+{
+     fprintf (stderr, "directfb-csource version %s\n\n", DIRECTFB_VERSION);
+     fprintf (stderr, "Usage: %s [options] <imagefile>\n", prg_name);
+     fprintf (stderr, "   --name=<identifer>      specifies variable name\n");
+     fprintf (stderr, "   --format=<identifer>    specifies surface format\n");
+     fprintf (stderr, "   --rgbformat=<identifer> specifies format for non-alpha images\n");
+     fprintf (stderr, "   --multi                 multiple images\n");
+     fprintf (stderr, "   --raw                   dump a single file directly to header\n");
+     fprintf (stderr, "   --dither-rgb16          dither images rendered to RGB16 surfaces\n");
+     fprintf (stderr, "   --help                  show this help message\n");
+     fprintf (stderr, "   --version               print version information\n");
+     fprintf (stderr, "\n");
+     fprintf (stderr, "See the directfb-csource(1) man-page for more information.\n");
+     fprintf (stderr, "\n");
+}
+
+static DFBResult load_image (const char            *filename,
+                             DFBSurfaceDescription *desc,
+                             DFBColor              *palette,
+                             int                   *palette_size,
+                             DFBSurfacePixelFormat  rgbformat,
+                             bool                   dither565)
+{
+     DFBSurfacePixelFormat dest_format;
+     DFBSurfacePixelFormat src_format;
+     FILE          *fp;
+     png_structp    png_ptr  = NULL;
+     png_infop      info_ptr = NULL;
+     png_uint_32    width, height;
+     unsigned char *data     = NULL;
+     int            type;
+     char           header[8];
+     int            bytes, pitch;
+
+     dest_format =
+       (desc->flags & DSDESC_PIXELFORMAT) ? desc->pixelformat : DSPF_UNKNOWN;
+
+     desc->flags = 0;
+     desc->preallocated[0].data = NULL;
+
+     if (!(fp = fopen (filename, "rb"))) {
+          fprintf (stderr, "Failed to open file '%s': %s.\n",
+                   filename, strerror (errno));
+          goto cleanup;
+     }
+
+     bytes = fread (header, 1, sizeof(header), fp);
+     if (png_sig_cmp ((unsigned char*) header, 0, bytes)) {
+          fprintf (stderr, "File '%s' doesn't seem to be a PNG image file.\n",
+                   filename);
+          goto cleanup;
+     }
+
+     png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
+                                       NULL, NULL, NULL);
+     if (!png_ptr)
+          goto cleanup;
+
+     if (setjmp (png_ptr->jmpbuf)) {
+          if (desc->preallocated[0].data) {
+               free (desc->preallocated[0].data);
+               desc->preallocated[0].data = NULL;
+          }
+
+          /* data might have been clobbered,
+             set it to NULL and leak instead of crashing */
+          data = NULL;
+
+          goto cleanup;
+     }
+
+     info_ptr = png_create_info_struct (png_ptr);
+     if (!info_ptr)
+          goto cleanup;
+
+     png_init_io (png_ptr, fp);
+     png_set_sig_bytes (png_ptr, bytes);
+
+     png_read_info (png_ptr, info_ptr);
+
+     png_get_IHDR (png_ptr, info_ptr,
+                   &width, &height, &bytes, &type, NULL, NULL, NULL);
+
+     if (bytes == 16)
+          png_set_strip_16 (png_ptr);
+
+#ifdef WORDS_BIGENDIAN
+     png_set_swap_alpha (png_ptr);
+#else
+     png_set_bgr (png_ptr);
+#endif
+
+     src_format = (type & PNG_COLOR_MASK_ALPHA) ? DSPF_ARGB : DSPF_RGB32;
+     switch (type) {
+          case PNG_COLOR_TYPE_GRAY:
+               if (dest_format == DSPF_A8) {
+                    src_format = DSPF_A8;
+                    break;
+               }
+               /* fallthru */
+          case PNG_COLOR_TYPE_GRAY_ALPHA:
+               png_set_gray_to_rgb (png_ptr);
+               if (rgbformat)
+                    dest_format = rgbformat;
+               break;
+
+          case PNG_COLOR_TYPE_PALETTE:
+               if (dest_format == DSPF_LUT8) {
+                    src_format = DSPF_LUT8;
+                    break;
+               }
+               png_set_palette_to_rgb (png_ptr);
+               /* fallthru */
+          case PNG_COLOR_TYPE_RGB:
+               if (rgbformat)
+                    dest_format = rgbformat;
+          case PNG_COLOR_TYPE_RGB_ALPHA:
+               if (dest_format == DSPF_RGB24) {
+                    png_set_strip_alpha (png_ptr);
+                    src_format = DSPF_RGB24;
+               }
+               break;
+       }
+
+     switch (src_format) {
+          case DSPF_LUT8:
+               if (info_ptr->num_palette) {
+                    png_byte *alpha;
+                    int       i, num;
+
+                    *palette_size = MIN (info_ptr->num_palette, 256);
+                    for (i = 0; i < *palette_size; i++) {
+                         palette[i].a = 0xFF;
+                         palette[i].r = info_ptr->palette[i].red;
+                         palette[i].g = info_ptr->palette[i].green;
+                         palette[i].b = info_ptr->palette[i].blue;
+                    }
+                    if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
+                         png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL);
+                         for (i = 0; i < MIN (num, *palette_size); i++)
+                              palette[i].a = alpha[i];
+                    }
+               }
+               break;
+          case DSPF_RGB32:
+                png_set_filler (png_ptr, 0xFF,
+#ifdef WORDS_BIGENDIAN
+                                PNG_FILLER_BEFORE
+#else
+                                PNG_FILLER_AFTER
+#endif
+                                );
+                break;
+          case DSPF_ARGB:
+          case DSPF_A8:
+               if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
+                    png_set_tRNS_to_alpha (png_ptr);
+               break;
+          default:
+               break;
+     }
+
+     pitch = width * DFB_BYTES_PER_PIXEL (src_format);
+     if (pitch & 3)
+          pitch += 4 - (pitch & 3);
+
+     data  = malloc (height * pitch);
+     if (!data) {
+          fprintf (stderr, "Failed to allocate %ld bytes.\n", height * pitch);
+          goto cleanup;
+     }
+
+     {
+          unsigned int i;
+          png_bytep bptrs[height];
+
+          for (i = 0; i < height; i++)
+               bptrs[i] = data + i * pitch;
+
+          png_read_image (png_ptr, bptrs);
+     }
+
+     if (!dest_format)
+          dest_format = src_format;
+
+     if (DFB_BYTES_PER_PIXEL(src_format) != DFB_BYTES_PER_PIXEL(dest_format)) {
+          unsigned char *s, *d, *dest;
+          int            d_pitch, h;
+
+          assert (DFB_BYTES_PER_PIXEL (src_format) == 4);
+
+          d_pitch = width * DFB_BYTES_PER_PIXEL (dest_format);
+          if (d_pitch & 3)
+               d_pitch += 4 - (d_pitch & 3);
+
+          dest = malloc (height * d_pitch);
+          if (!dest) {
+               fprintf (stderr, "Failed to allocate %ld bytes.\n",
+                        height * d_pitch);
+               goto cleanup;
+          }
+
+          h = height;
+          switch (dest_format) {
+               case DSPF_RGB16:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         if (dither565)
+                              dither_rgb16 ((u32 *) s, (u16 *) d, height - h, width);
+                         else
+                              dfb_argb_to_rgb16 ((u32 *) s, (u16 *) d, width);
+                    break;
+               case DSPF_ARGB1555:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         dfb_argb_to_argb1555 ((u32 *) s, (u16 *) d, width);
+                    break;
+               case DSPF_ARGB2554:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         dfb_argb_to_argb2554 ((u32 *) s, (u16 *) d, width);
+                    break;
+               case DSPF_ARGB4444:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         dfb_argb_to_argb4444 ((u32 *) s, (u16 *) d, width);
+                    break;
+               case DSPF_RGB332:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         dfb_argb_to_rgb332 ((u32 *) s, (u8 *) d, width);
+                    break;
+               case DSPF_A8:
+                    for (s = data, d = dest; h; h--, s += pitch, d += d_pitch)
+                         dfb_argb_to_a8 ((u32 *) s, (u8 *) d, width);
+                    break;
+               default:
+                    fprintf (stderr,
+                             "Sorry, unsupported format conversion.\n");
+                    goto cleanup;
+          }
+
+          free (data);
+          data = dest;
+          pitch = d_pitch;
+     }
+
+     desc->flags = (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |
+                    DSDESC_PREALLOCATED);
+     desc->width       = width;
+     desc->height      = height;
+     desc->pixelformat = dest_format;
+     desc->preallocated[0].pitch = pitch;
+     desc->preallocated[0].data  = data;
+
+     data = NULL;
+
+ cleanup:
+     if (fp)
+          fclose (fp);
+
+     if (png_ptr)
+          png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
+
+     if (data)
+          free (data);
+
+     return ((desc->flags) ? DFB_OK : DFB_FAILURE);
+}
+
+static DFBResult merge_images (DFBSurfaceDescription *images,
+                               int                    num_images,
+                               DFBSurfaceDescription *dest,
+                               DFBRectangle          *rectangles)
+{
+  DFBSurfaceDescription *image = images;
+  DFBRectangle          *rect  = rectangles;
+  unsigned char         *data;
+  int                    bpp;
+  int                    pitch, i;
+
+  rect->x = 0;
+  rect->y = 0;
+  rect->w = image->width;
+  rect->h = image->height;
+
+  dest->flags       = (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |
+                       DSDESC_PREALLOCATED);
+  dest->pixelformat = image->pixelformat;
+
+  bpp = DFB_BYTES_PER_PIXEL (dest->pixelformat);
+
+  if (bpp == 1)
+       dest->width  = (rect->w + 3) & ~3;
+  else
+       dest->width  = rect->w;
+
+  dest->height      = rect->h;
+
+  for (i = 1; i < num_images; i++) {
+       image++;
+       rect++;
+
+       if (image->pixelformat != dest->pixelformat)
+            return DFB_INVARG;
+
+       rect->x = dest->width;
+       rect->y = 0;
+       rect->w = image->width;
+       rect->h = image->height;
+
+       if (bpp == 1)
+            dest->width += (rect->w + 3) & ~3;
+       else
+            dest->width += rect->w;
+
+       if (dest->height < rect->h)
+            dest->height = rect->h;
+  }
+
+  pitch = (dest->width * bpp + 3) &~ 3;
+  data  = malloc (dest->height * pitch);
+  if (!data) {
+       fprintf (stderr, "Failed to allocate %ld bytes.\n",
+                (long) dest->height * pitch);
+       return DFB_FAILURE;
+  }
+
+
+  for (i = 0, image = images, rect = rectangles;
+       i < num_images;
+       i++, image++, rect++) {
+
+       unsigned char *dest   = data + rect->x * bpp;
+       unsigned char *src    = image->preallocated[0].data;
+       int            height = rect->h;
+
+       do {
+            memcpy (dest, src, rect->w * bpp);
+            src  += image->preallocated[0].pitch;
+            dest += pitch;
+       }
+       while (--height);
+  }
+
+  dest->preallocated[0].pitch = pitch;
+  dest->preallocated[0].data  = data;
+
+  return DFB_OK;
+}
+
+static void
+dither_rgb16 (const u32 *src, u16 *dest, int y, int width)
+{
+     const u32 *dm = DM_565 + ((y & (DM_HEIGHT - 1)) << DM_WIDTH_SHIFT);
+     int        x;
+
+     for (x = 0; x < width; x++) {
+          u32 rgb = ((src[x] & 0xFF)          |
+                     (src[x] & 0xFF00)   << 2 |
+                     (src[x] & 0xFF0000) << 4);
+
+          rgb += dm[x & (DM_WIDTH - 1)];
+          rgb += (0x10040100
+                  - ((rgb & 0x1e0001e0) >> 5)
+                  - ((rgb & 0x00070000) >> 6));
+
+          dest[x] = (((rgb & 0x0f800000) >> 12) |
+                     ((rgb & 0x0003f000) >> 7)  |
+                     ((rgb & 0x000000f8) >> 3));
+     }
+}
+
+
+typedef struct {
+     FILE  *fp;
+     int     pos;
+     bool    pad;
+} CSourceData;
+
+static inline void save_uchar (CSourceData   *csource,
+                               unsigned char  d)
+{
+     if (csource->pos > 70) {
+          fprintf (csource->fp, "\"\n  \"");
+
+          csource->pos = 3;
+          csource->pad = false;
+     }
+     if (d < 33 || d > 126) {
+          fprintf (csource->fp, "\\%o", d);
+          csource->pos += 1 + 1 + (d > 7) + (d > 63);
+          csource->pad = d < 64;
+          return;
+     }
+     if (d == '\\') {
+          fprintf (csource->fp, "\\\\");
+          csource->pos += 2;
+     }
+     else if (d == '"') {
+          fprintf (csource->fp, "\\\"");
+          csource->pos += 2;
+     }
+     else if (csource->pad && d >= '0' && d <= '9') {
+          fprintf (csource->fp, "\"\"%c", d);
+          csource->pos += 3;
+     }
+     else {
+          fputc (d, csource->fp);
+          csource->pos += 1;
+     }
+     csource->pad = false;
+
+     return;
+}
+
+static void dump_data(CSourceData         *csource,
+                      const char          *name,
+                      const unsigned char *data,
+                      unsigned int         len)
+{
+     fprintf (csource->fp,
+              "static const unsigned char %s_data[] =\n", name);
+     fprintf (csource->fp, "  \"");
+     
+     csource->pos = 3;
+     do
+          save_uchar (csource, *data++);
+     while (--len);
+
+     fprintf (csource->fp, "\";\n\n");
+}
+
+static DFBResult dump_raw_data(const char          *name,
+                               const unsigned char *data,
+                               unsigned int         len)
+{
+     CSourceData  csource = { stdout, 0, 0 };
+     char        *vname   = variable_name (name);
+
+     if (!data || !len)
+          return DFB_INVARG;
+
+     fprintf (csource.fp,
+              "/* DirectFB raw data dump created by directfb-csource %s */\n\n",
+              DIRECTFB_VERSION);
+
+     dump_data(&csource, vname, data, len);
+
+     free (vname);
+
+     return DFB_OK;
+}
+
+
+static DFBResult dump_image (const char            *name,
+                             DFBSurfaceDescription *desc,
+                             DFBColor              *palette,
+                             int                    palette_size)
+{
+     CSourceData    csource = { stdout, 0, 0 };
+     const char    *format  = NULL;
+     char          *vname   = variable_name (name);
+     unsigned char *data;
+     unsigned long  len;
+     int            i;
+
+     if (desc &&
+         desc->flags != (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |
+                         DSDESC_PREALLOCATED))
+          return DFB_INVARG;
+
+     for (i = 0; i < n_pixelformats && !format; i++)
+          if (pixelformats[i].format == desc->pixelformat)
+               format = pixelformats[i].name;
+
+     if (!format)
+          return DFB_INVARG;
+
+     data = (unsigned char *) desc->preallocated[0].data;
+     len = desc->height * desc->preallocated[0].pitch;
+
+     if (!len)
+          return DFB_INVARG;
+
+     /* dump comment */
+     fprintf (csource.fp,
+              "/* DirectFB surface dump created by directfb-csource %s */\n\n",
+              DIRECTFB_VERSION);
+
+     /* dump data */
+     dump_data(&csource, vname, data, len);
+
+     /* dump palette */
+     if (palette_size > 0) {
+          fprintf (csource.fp,
+                   "static const DFBColor %s_palette[%d] = {\n", vname, palette_size);
+          for (i = 0; i < palette_size; i++)
+               fprintf (csource.fp,
+                        "  { 0x%02x, 0x%02x, 0x%02x, 0x%02x }%c\n",
+                        palette[i].a, palette[i].r, palette[i].g, palette[i].b,
+                        i+1 < palette_size ? ',' : ' ');
+          fprintf (csource.fp, "};\n\n");
+     }
+
+     /* dump description */
+     fprintf (csource.fp,
+              "static const DFBSurfaceDescription %s_desc = {\n", vname);
+     fprintf (csource.fp,
+              "  flags                   : DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |\n"
+              "                            DSDESC_PREALLOCATED");
+     if (palette_size > 0)
+          fprintf (csource.fp, " | DSDESC_PALETTE");
+     fprintf (csource.fp, ",\n");
+     fprintf (csource.fp,
+              "  width                   : %d,\n", desc->width);
+     fprintf (csource.fp,
+              "  height                  : %d,\n", desc->height);
+     fprintf (csource.fp,
+              "  pixelformat             : DSPF_%s,\n", format);
+     fprintf (csource.fp,
+              "  preallocated : {{  data : (void *) %s_data,\n", vname);
+     fprintf (csource.fp,
+              "                    pitch : %d  }}", desc->preallocated[0].pitch);
+     if (palette_size > 0) {
+          fprintf (csource.fp, ",\n");
+          fprintf (csource.fp,
+                   "  palette :    {  entries : %s_palette,\n", vname);
+          fprintf (csource.fp,
+                   "                     size : %d  }", palette_size);
+     }
+     fprintf (csource.fp, "\n};\n\n");
+
+     free (vname);
+
+     return DFB_OK;
+}
+
+static DFBResult dump_rectangles (const char    *name,
+                                  DFBRectangle  *rectangles,
+                                  const char   **names,
+                                  int            num_rects)
+{
+     DFBRectangle *rect;
+     const char   *blanks = "                                  ";
+     char         *vname  = variable_name (name);
+     FILE         *fp     = stdout;
+     int           len, i;
+
+     if (num_rects < 1)
+          return DFB_INVARG;
+
+     fprintf (fp,
+              "/* DirectFB multi-surface dump created by directfb-csource %s */\n\n",
+              DIRECTFB_VERSION);
+
+     fprintf (fp,
+              "static const struct {\n"
+              "  const char   *name;\n"
+              "  DFBRectangle  rect;\n"
+              "} %s[] = {\n", vname);
+
+     for (i = 0, len = 0; i < num_rects; i++)
+          len = MAX (len, strlen (names[i]));
+
+     len = len + 4 - strlen (blanks);
+
+     for (i = 0, rect = rectangles; i < num_rects; i++, rect++) {
+
+          char *v = base_name (names[i]);
+
+          if (i)
+               fprintf (fp, ",\n");
+
+          if (len < 0) {
+               int l = fprintf (fp, "  { \"%s\", ", v);
+
+               fprintf (fp, blanks - len + l);
+               fprintf (fp, "{ x : %4d, y : %4d, w : %4d, h : %4d } }",
+                        rect->x, rect->y, rect->w, rect->h);
+          }
+          else {
+               fprintf (fp,
+                        "  { \"%s\",\n"
+                        "    { x : %4d, y : %4d, w : %4d, h : %4d } }",
+                        v, rect->x, rect->y, rect->w, rect->h);
+          }
+
+          free (v);
+     }
+     fprintf (fp, "\n};\n\n");
+
+     free (vname);
+
+     return DFB_OK;
+}
+
+static char *
+variable_name (const char *name)
+{
+     char *vname = strdup (name);
+     char *v     = vname;
+
+     while (DFB_TRUE) {
+          switch (*v) {
+               case 0:
+                    return vname;
+               case 'a'...'z':
+               case 'A'...'Z':
+               case '0'...'9':
+               case '_':
+                    break;
+               default:
+                    *v = '_';
+          }
+          v++;
+     }
+}
+
+static char *
+base_name (const char *name)
+{
+     char *vname = strdup (name);
+     char *v     = vname;
+
+     while (DFB_TRUE) {
+          switch (*v) {
+               case '.':
+                    *v = 0;
+               case 0:
+                    return vname;
+               default:
+                    break;
+          }
+          v++;
+     }
+}
diff --git a/Source/DirectFB/tools/fusion_bench.c b/Source/DirectFB/tools/fusion_bench.c
new file mode 100755
index 0000000..8ea04df
--- /dev/null
+++ b/Source/DirectFB/tools/fusion_bench.c
@@ -0,0 +1,537 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This file is subject to the terms and conditions of the MIT License:
+
+   Permission is hereby granted, free of charge, to any person
+   obtaining a copy of this software and associated documentation
+   files (the "Software"), to deal in the Software without restriction,
+   including without limitation the rights to use, copy, modify, merge,
+   publish, distribute, sublicense, and/or sell copies of the Software,
+   and to permit persons to whom the Software is furnished to do so,
+   subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <sys/file.h>
+
+#include <pthread.h>
+
+#include <direct/clock.h>
+
+#include <fusion/build.h>
+#include <fusion/fusion.h>
+#include <fusion/lock.h>
+#include <fusion/property.h>
+#include <fusion/reactor.h>
+#include <fusion/ref.h>
+#include <fusion/shmalloc.h>
+
+#include <directfb.h>
+
+#include <core/system.h>
+
+
+static long long     t1, t2;
+static unsigned int  loops;
+static FusionWorld  *world;
+
+#define BENCH_START()       do { sync(); usleep(100000); sync(); t1 = direct_clock_get_millis(); loops = 0; } while (0)
+#define BENCH_STOP()        do { t2 = direct_clock_get_millis(); } while (0)
+
+#define BENCH_LOOP()        while ((++loops & 0xfff) || (direct_clock_get_millis() - t1 < 1000))
+
+#define BENCH_RESULT()      (loops / (float)(t2 - t1))
+#define BENCH_RESULT_BY(x)  ((loops * x) / (float)(t2 - t1))
+
+
+static ReactionResult
+reaction_callback (const void *msg_data,
+                   void       *ctx)
+{
+     return RS_OK;
+}
+
+static void
+bench_reactor( void )
+{
+     FusionReactor  *reactor;
+     Reaction        reaction;
+     Reaction        reaction2;
+     GlobalReaction  global_reaction;
+
+     reactor = fusion_reactor_new( 16, "Benchmark", world );
+     if (!reactor) {
+          fprintf( stderr, "Fusion Error\n" );
+          return;
+     }
+
+
+     /* reactor attach/detach */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction );
+          fusion_reactor_detach( reactor, &reaction );
+     }
+
+     BENCH_STOP();
+
+     printf( "reactor attach/detach                 -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     /* reactor attach/detach (2nd) */
+     fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction );
+
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction2 );
+          fusion_reactor_detach( reactor, &reaction2 );
+     }
+
+     BENCH_STOP();
+
+     fusion_reactor_detach( reactor, &reaction );
+
+     printf( "reactor attach/detach (2nd)           -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     /* reactor attach/detach (global) */
+     fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction );
+
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_reactor_attach_global( reactor, 0, NULL, &global_reaction );
+          fusion_reactor_detach_global( reactor, &global_reaction );
+     }
+
+     BENCH_STOP();
+
+     fusion_reactor_detach( reactor, &reaction );
+
+     printf( "reactor attach/detach (global)        -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     /* reactor dispatch */
+     fusion_reactor_attach( reactor, reaction_callback, NULL, &reaction );
+
+     BENCH_START();
+
+     BENCH_LOOP() {
+          char msg[16];
+
+          fusion_reactor_dispatch( reactor, msg, true, NULL );
+     }
+
+     BENCH_STOP();
+
+     printf( "reactor dispatch                      -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     fusion_reactor_detach( reactor, &reaction );
+
+
+     fusion_reactor_free( reactor );
+
+     printf( "\n" );
+}
+
+static void
+bench_ref( void )
+{
+     DirectResult ret;
+     FusionRef    ref;
+
+     ret = fusion_ref_init( &ref, "Benchmark", world );
+     if (ret) {
+          fprintf( stderr, "Fusion Error %d\n", ret );
+          return;
+     }
+
+
+     /* ref up/down (local) */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_ref_up( &ref, false );
+          fusion_ref_down( &ref, false );
+     }
+
+     BENCH_STOP();
+
+     printf( "ref up/down (local)                   -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     /* ref up/down (global) */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_ref_up( &ref, true );
+          fusion_ref_down( &ref, true );
+     }
+
+     BENCH_STOP();
+
+     printf( "ref up/down (global)                  -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     fusion_ref_destroy( &ref );
+
+     printf( "\n" );
+}
+
+static void
+bench_property( void )
+{
+     DirectResult   ret;
+     FusionProperty property;
+
+     ret = fusion_property_init( &property, world );
+     if (ret) {
+          fprintf( stderr, "Fusion Error %d\n", ret );
+          return;
+     }
+
+
+     /* property lease/cede */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_property_lease( &property );
+          fusion_property_cede( &property );
+     }
+
+     BENCH_STOP();
+
+     printf( "property lease/cede                   -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     fusion_property_destroy( &property );
+
+     printf( "\n" );
+}
+
+static void
+bench_skirmish( void )
+{
+     DirectResult   ret;
+     FusionSkirmish skirmish;
+
+     ret = fusion_skirmish_init( &skirmish, "Benchmark", world );
+     if (ret) {
+          fprintf( stderr, "Fusion Error %d\n", ret );
+          return;
+     }
+
+
+     /* skirmish prevail/dismiss */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          fusion_skirmish_prevail( &skirmish );
+          fusion_skirmish_dismiss( &skirmish );
+     }
+
+     BENCH_STOP();
+
+     printf( "skirmish prevail/dismiss              -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     fusion_skirmish_destroy( &skirmish );
+
+     printf( "\n" );
+}
+
+static void *
+prevail_dismiss_loop( void *arg )
+{
+     FusionSkirmish *skirmish = (FusionSkirmish *) arg;
+
+     BENCH_LOOP() {
+          fusion_skirmish_prevail( skirmish );
+          fusion_skirmish_dismiss( skirmish );
+     }
+
+     return NULL;
+}
+
+static void
+bench_skirmish_threaded( void )
+{
+     int            i;
+     DirectResult   ret;
+     FusionSkirmish skirmish;
+
+     ret = fusion_skirmish_init( &skirmish, "Threaded Benchmark", world );
+     if (ret) {
+          fprintf( stderr, "Fusion Error %d\n", ret );
+          return;
+     }
+
+
+     /* skirmish prevail/dismiss (2-5 threads) */
+     for (i=2; i<=5; i++) {
+          int       t;
+          pthread_t threads[i];
+
+          BENCH_START();
+
+          for (t=0; t<i; t++)
+               pthread_create( &threads[t], NULL, prevail_dismiss_loop, &skirmish );
+
+          for (t=0; t<i; t++)
+               pthread_join( threads[t], NULL );
+
+          BENCH_STOP();
+
+          printf( "skirmish prevail/dismiss (%d threads)  -> %8.2f k/sec\n", i, BENCH_RESULT() );
+     }
+
+
+     fusion_skirmish_destroy( &skirmish );
+
+     printf( "\n" );
+}
+
+static void *
+mutex_lock_unlock_loop( void *arg )
+{
+     pthread_mutex_t *lock = (pthread_mutex_t *) arg;
+
+     BENCH_LOOP() {
+          pthread_mutex_lock( lock );
+          pthread_mutex_unlock( lock );
+     }
+
+     return NULL;
+}
+
+static void
+bench_mutex_threaded( void )
+{
+     int             i;
+     pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+
+     /* mutex lock/unlock (2-5 threads) */
+     for (i=2; i<=5; i++) {
+          int       t;
+          pthread_t threads[i];
+
+          BENCH_START();
+
+          for (t=0; t<i; t++)
+               pthread_create( &threads[t], NULL, mutex_lock_unlock_loop, &lock );
+
+          for (t=0; t<i; t++)
+               pthread_join( threads[t], NULL );
+
+          BENCH_STOP();
+
+          printf( "mutex lock/unlock (rec., %d threads)   -> %8.2f k/sec\n", i, BENCH_RESULT() );
+     }
+
+
+     pthread_mutex_destroy( &lock );
+
+     printf( "\n" );
+}
+
+static void
+bench_mutex( void )
+{
+     pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+     pthread_mutex_t rmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+
+     /* pthread_mutex lock/unlock */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          pthread_mutex_lock( &mutex );
+          pthread_mutex_unlock( &mutex );
+     }
+
+     BENCH_STOP();
+
+     printf( "mutex lock/unlock                     -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     /* pthread_mutex lock/unlock */
+     BENCH_START();
+
+     BENCH_LOOP() {
+          pthread_mutex_lock( &rmutex );
+          pthread_mutex_unlock( &rmutex );
+     }
+
+     BENCH_STOP();
+
+     printf( "mutex lock/unlock (recursive)         -> %8.2f k/sec\n", BENCH_RESULT() );
+
+
+     pthread_mutex_destroy( &mutex );
+     pthread_mutex_destroy( &rmutex );
+
+     printf( "\n" );
+}
+
+static void
+bench_flock( void )
+{
+     int   fd;
+     FILE *tmp;
+
+     tmp = tmpfile();
+     if (!tmp) {
+          perror( "tmpfile()" );
+          return;
+     }
+
+     fd = fileno( tmp );
+     if (fd < 0) {
+          perror( "fileno()" );
+          fclose( tmp );
+          return;
+     }
+
+     BENCH_START();
+
+     BENCH_LOOP() {
+          flock( fd, LOCK_EX );
+          flock( fd, LOCK_UN );
+     }
+
+     BENCH_STOP();
+
+     printf( "flock lock/unlock                     -> %8.2f k/sec\n", BENCH_RESULT() );
+     printf( "\n" );
+
+     fclose( tmp );
+}
+
+static void
+bench_shmpool( bool debug )
+{
+     DirectResult  ret;
+     void         *mem[256];
+     const int     sizes[8] = { 12, 36, 200, 120, 39, 3082, 8, 1040 };
+
+     FusionSHMPoolShared *pool;
+
+     ret = fusion_shm_pool_create( world, "Benchmark Pool", 524288, debug, &pool );
+     if (ret) {
+          DirectFBError( "fusion_shm_pool_create() failed", ret );
+          return;
+     }
+
+     BENCH_START();
+
+     BENCH_LOOP() {
+          int i;
+
+          for (i=0; i<128; i++)
+               mem[i] = SHMALLOC( pool, sizes[i&7] );
+
+          for (i=0; i<64; i++)
+               SHFREE( pool, mem[i] );
+
+          for (i=128; i<192; i++)
+               mem[i] = SHMALLOC( pool, sizes[i&7] );
+
+          for (i=64; i<128; i++)
+               SHFREE( pool, mem[i] );
+
+          for (i=192; i<256; i++)
+               mem[i] = SHMALLOC( pool, sizes[i&7] );
+
+          for (i=128; i<256; i++)
+               SHFREE( pool, mem[i] );
+     }
+
+     BENCH_STOP();
+
+     printf( "shm pool alloc/free %s           -> %8.2f k/sec\n",
+             debug ? "(debug)" : "       ", BENCH_RESULT_BY(256) );
+
+     fusion_shm_pool_destroy( world, pool );
+}
+
+int
+main( int argc, char *argv[] )
+{
+     DirectResult ret;
+
+     /* Initialize DirectFB. */
+     ret = DirectFBInit( &argc, &argv );
+     if (ret)
+          return DirectFBError( "DirectFBInit()", ret );
+
+     dfb_system_lookup();
+
+     ret = fusion_enter( -1, 0, FER_MASTER, &world );
+     if (ret)
+          return DirectFBError( "fusion_enter()", ret );
+
+     printf( "\n" );
+
+#if FUSION_BUILD_MULTI
+     printf( "Fusion Benchmark (Multi Application Core)\n" );
+#else
+     printf( "Fusion Benchmark (Single Application Core)\n" );
+#endif
+
+     printf( "\n" );
+
+     bench_flock();
+
+     bench_mutex();
+     bench_mutex_threaded();
+
+     bench_skirmish();
+     bench_skirmish_threaded();
+
+     //bench_spinlock_threaded();
+
+     bench_property();
+
+     bench_ref();
+
+     bench_reactor();
+
+     bench_shmpool( false );
+     bench_shmpool( true );
+
+     printf( "\n" );
+
+     fusion_exit( world, false );
+
+     return 0;
+}
+
diff --git a/Source/DirectFB/tools/gendoc.pl b/Source/DirectFB/tools/gendoc.pl
new file mode 100755
index 0000000..a86035a
--- /dev/null
+++ b/Source/DirectFB/tools/gendoc.pl
@@ -0,0 +1,936 @@
+#!/usr/bin/perl
+#
+#   (c) Copyright 2001-2007  The DirectFB Organization (directfb.org)
+#   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+#
+#   All rights reserved.
+#
+#   Written by Denis Oliver Kropp <dok@directfb.org>,
+#              Andreas Hundt <andi@fischlustig.de>,
+#              Sven Neumann <neo@directfb.org>,
+#              Ville Syrjälä <syrjala@sci.fi> and
+#              Claudio Ciccani <klan@users.sf.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.
+#
+
+##################################
+# TODO: CLEANUP CODE FURTHER !!!
+##################################
+
+#####################################################################################
+#                                                                                   #
+#  Documentation generator written by Denis Oliver Kropp <dok@directfb.org>         #
+#                                                                                   #
+#  - Uses first argument as project name and second as version                      #
+#  - Reads header files from stdin, parsing is tied to the coding style             #
+#  - Writes HTML 3.x to different files: 'index', 'types', <interfaces>, <methods>  #
+#                                                                                   #
+#  FIXME: remove all copy'n'waste code, cleanup more, simplify more, ...            #
+#                                                                                   #
+#####################################################################################
+
+$COLOR_BG                = "#F8F4D8";
+$COLOR_LINK              = "#2369E0";
+$COLOR_TEXT              = "#232323";
+
+$COLOR_TOP_BG            = "#C0B090";
+$COLOR_TOP_LINK          = "#203040";
+
+$COLOR_TITLE             = "#E09040";
+$COLOR_TITLE_BG          = "#284460";
+$COLOR_TITLE_MAIN        = "#D0D0D0";
+
+$COLOR_ENTRIES_BG        = "#F8F8F0";
+$COLOR_ENTRIES_PTR       = "#424242";
+$COLOR_ENTRIES_ID        = "#234269";
+$COLOR_ENTRIES_DESC      = "#303030";
+
+$COLOR_ENUM_NAME         = "#B04223";
+$COLOR_ENUM_ENTRY_ID     = "#429023";
+$COLOR_ENUM_ENTRY_VAL    = "#234269";
+
+$COLOR_STRUCT_NAME       = "#238423";
+
+$COLOR_FUNCTYPE_NAME     = "#D06923";
+$COLOR_FUNCTYPE_HEAD     = "#232342";
+
+$COLOR_MACRO_NAME        = "#2342A0";
+$COLOR_MACRO_PARAMS      = "#606080";
+$COLOR_MACRO_VALUE       = "#232342";
+
+$COLOR_METHOD_HEAD       = "#425469";
+
+$COLOR_COPYRIGHT_BG      = "#E0E8F0";
+
+########################################################################################################################
+## Top level just calls main function with args
+#
+
+$PROJECT = shift @ARGV;
+$VERSION = shift @ARGV;
+
+gen_doc( $PROJECT, $VERSION );
+
+########################################################################################################################
+
+########################################################################################################################
+## Utilities
+#
+
+sub trim ($) {
+   local (*str) = @_;
+
+   # remove leading white space
+   $str =~ s/^\s*//g;
+
+   # remove trailing white space and new line
+   $str =~ s/\s*$//g;
+}
+
+sub print_list ($$) {
+   local (*list, $title) = @_;
+
+   print INDEX "<P>\n",
+               "  <CENTER>\n",
+               "    <H3>$title</H3>\n",
+               "    <TABLE width=90% border=0 cellpadding=2>\n";
+
+   foreach $key (sort keys %list)
+      {
+         print INDEX "    <TR><TD valign=top>\n",
+                     "      <A href=\"types.html#$key\">$key</A>\n",
+                     "    </TD><TD valign=top>\n",
+                     "      $list{$key}\n",
+                     "    </TD></TR>\n";
+      }
+
+   print INDEX "  </TABLE></CENTER>\n",
+               "</P>\n";
+}
+
+sub substitute_links ($) {
+   local (*str) = @_;
+
+   # Interface Methods
+   $str =~ s/(I\w+)\:\:(\w+)\(\)/\<a\ href=\"\1\_\2\.html\"\>\1\:\:\2\(\)\<\/a\>/g;
+
+   # Automatic type links
+   $str =~ s/(\s)([A-Z][A-Z][A-Z][A-Z]?[a-z][a-z][a-z]?[\w0-9]+)/\1\<a\ href=\"types\.html#\2\"\>\2\<\/a\>/g;
+
+   # Automatic type links
+   $str =~ s/(\s)($PROJECT[\w0-9]+)/\1\<a\ href=\"types\.html#\2\"\>\2\<\/a\>/g;
+
+   # Explicit type links
+   $str =~ s/(\s)\@\_(\w[\w0-9]+)/\1\<a\ href=\"types\.html#\2\"\>\2\<\/a\>/g;
+}
+
+sub type_link ($) {
+   my ($type) = @_;
+
+   trim( \$type );
+
+   if (defined($type_list{$type}))
+      {
+         return "<A href=\"types.html#$type\">$type</A>";
+      }
+   elsif (defined($interfaces{$type}))
+      {
+         return "<A href=\"$type.html\">$type</A>";
+      }
+
+   return "$type";
+}
+
+########################################################################################################################
+## Generic parsers
+#
+
+sub parse_comment ($$$$) {
+   local (*head, *body, *options, $inithead) = @_;
+
+   local $headline_mode = 1;
+   local $list_open     = 0;
+
+   $head = "\n";
+   $body = "\n";
+
+   if ($inithead ne "") {
+      $headline_mode = 0;
+
+      $head .= "        $inithead\n";
+   }
+
+   %options = ();
+
+   while (<>)
+      {
+         chomp;
+         last if /^\s*\*+\/\s*$/;
+
+         # Prepend asterisk if first non-whitespace isn't an asterisk
+         s/^\s*([^\*\s])/\* $1/;
+
+         # In head line mode append to $head
+         if ($headline_mode == 1)
+            {
+               if (/^\s*\*+\s*$/)
+                  {
+                     $headline_mode = 0;
+                  }
+               elsif (/^\s*\*+\s*@(\w+)\s*=?\s*(.*)$/)
+                  {
+                     $options{$1} = $2;
+                  }
+               elsif (/^\s*\*+\s*(.+)\*\/\s*$/)
+                  {
+                     $head .= "        $1\n";
+                     last;
+                  }
+               elsif (/^\s*\*+\s*(.+)$/)
+                  {
+                     $head .= "        $1\n";
+                  }
+            }
+         else
+            # Otherwise append to $body
+            {
+               if (/^\s*\*+\s*(.+)\*\/\s*$/)
+                  {
+                     $body .= "        $1\n";
+                     last;
+                  }
+               elsif (/^\s*\*+\s*$/)
+                  {
+                     $body .= " </P><P>\n";
+                  }
+               elsif (/^\s*\*+\s\-\s(.+)$/)
+                  {
+                     if ($list_open == 0)
+                        {
+                           $list_open = 1;
+
+                           $body .= " <UL><LI>\n";
+                        }
+                     else
+                        {
+                           $body .= " </LI><LI>\n";
+                        }
+
+                     $body .= "        $1\n";
+                  }
+               elsif (/^\s*\*+\s\s(.+)$/)
+                  {
+                     $body .= "        $1\n";
+                  }
+               elsif (/^\s*\*+\s(.+)$/)
+                  {
+                     if ($list_open == 1)
+                        {
+                           $list_open = 0;
+
+                           $body .= " </LI></UL>\n";
+                        }
+
+                     $body .= "        $1\n";
+                  }
+            }
+      }
+
+   if ($list_open == 1)
+      {
+         $body .= " </LI></UL>\n";
+      }
+
+   substitute_links (\$head);
+   substitute_links (\$body);
+}
+
+#
+# Reads stdin until the end of the parameter list is reached.
+# Returns list of parameter records.
+#
+# TODO: Add full comment support and use it for function types as well.
+#
+sub parse_params () {
+   local @entries;
+
+   while (<>)
+      {
+         chomp;
+         last if /^\s*\)\;\s*$/;
+
+         if ( /^\s*(const )?\s*([\w\ ]+)\s+(\**)(\w+,?)\s*$/ )
+            {
+               local $const = $1;
+               local $type  = $2;
+               local $ptr   = $3;
+               local $name  = $4;
+
+               local $rec = {
+                  TYPE   => $const . type_link( $type ),
+                  PTR    => $ptr,
+                  NAME   => $name
+               };
+
+               push (@entries, $rec);
+            }
+      }
+
+   return @entries;
+}
+
+########################################################################################################################
+## Type parsers
+#
+
+#
+# Reads stdin until the end of the interface is reached.
+# Writes formatted HTML to one file for the interface and one file per method.
+# Parameter is the interface name.
+#
+sub parse_interface ($)
+   {
+      local ($interface) = @_;
+
+      local $section;
+
+      trim( \$interface );
+
+      if (!defined ($interfaces{$interface})) {
+         print "WARNING: Interface definition '$interface' has no declaration!\n"
+      }
+
+      html_create( INTERFACE, "$interface.html",
+                              "<A href=\"index.html\">" .
+                              "  <FONT color=$COLOR_TITLE_MAIN>$PROJECT Interfaces</FONT>" .
+                              "</A>", $interface, $interface );
+
+      print INTERFACE "<P>\n",
+                      "  $headline\n",
+                      "  $detailed\n",
+                      "</P>";
+
+      print INTERFACE "<P>\n",
+                      "  <CENTER><TABLE width=93% border=1 rules=groups cellpadding=4 cellspacing=2>\n";
+
+      print INTERFACE "    <THEAD>\n";
+      print INTERFACE "      <TR><TH colspan=3>Methods of $interface</TH></TR>\n";
+      print INTERFACE "    </THEAD>\n";
+
+      print INTERFACE "    <TBODY>\n";
+
+      while (<>)
+         {
+            chomp;
+            last if /^\s*\)\s*$/;
+
+            if ( /^\s*\/\*\*\s*(.+)\s*\*\*\/\s*$/ )
+               {
+                  $section = $1;
+               }
+            elsif ( /^\s*(\w+)\s*\(\s*\*\s*(\w+)\s*\)\s*\(?\s*$/ )
+               {
+                  print INTERFACE "    <TR><TD valign=top>\n",
+                                  "      <B><SMALL>$section</SMALL></B>\n",
+                                  "    </TD><TD valign=top>\n",
+                                  "      <A href=\"${interface}_$2.html\">",
+                                  "      <B>$2</B></A>\n",
+                                  "    </TD><TD valign=top>\n",
+                                  "      $headline\n",
+                                  "    </TD></TR>\n";
+
+                  html_create( FUNCTION, "${interface}_$2.html",
+                               "<A href=\"$interface.html\">" .
+                               "  <FONT color=$COLOR_TITLE_MAIN>$interface</FONT>" .
+                               "</A>", $2, "$interface - $2" );
+
+                  print FUNCTION "<H4>$headline</H4>\n",
+                                 "  <TABLE border=0 cellspacing=4 cellpadding=2 bgcolor=$COLOR_ENTRIES_BG>\n",
+                                 "    <TR><TD colspan=5><I><FONT color=$COLOR_METHOD_HEAD><A href=\"types.html#$1\">$1</A> <b>$2 (</b></FONT></I></TD></TR>\n";
+
+                  local @params = parse_params();
+                  local $param;
+
+                  for $param (@params)
+                     {
+                        print FUNCTION "    <TR><TD width=50>\n",
+                                       "       \n",
+                                       "    </TD><TD valign=top>\n",
+                                       "      $param->{TYPE}\n",
+                                       "    </TD><TD width=20> </TD><TD align=right>\n",
+                                       "      <FONT color=$COLOR_ENTRIES_PTR><B>$param->{PTR}</B></FONT>\n",
+                                       "    </TD><TD valign=top>\n",
+                                       "      <FONT color=$COLOR_ENTRIES_ID><B>$param->{NAME}</B></FONT>\n",
+                                       "    </TD></TR>\n";
+                     }
+
+                  print FUNCTION "    <TR><TD colspan=5><I><FONT color=$COLOR_METHOD_HEAD><b>);</b></FONT></I></TD></TR>\n",
+                                 "  </TABLE>\n",
+                                 "</P>\n";
+
+                  print FUNCTION "<P>$detailed</P>\n";
+
+                  $headline = "";
+                  $detailed = "";
+                  $section = "";
+
+                  html_close( FUNCTION );
+               }
+            elsif ( /^\s*\/\*\s*$/ )
+               {
+                  parse_comment( \$headline, \$detailed, \$options, "" );
+               }
+         }
+
+      print INTERFACE "    </TBODY>\n";
+
+      print INTERFACE "  </TABLE></CENTER>\n",
+                      "</P>\n";
+
+      html_close( INTERFACE );
+   }
+
+#
+# Reads stdin until the end of the enum is reached.
+# Writes formatted HTML to "types.html".
+#
+sub parse_enum
+   {
+      local %entries;
+      local @list;
+
+      local $pre;
+
+      while (<>)
+         {
+            chomp;
+
+            local $entry;
+
+            # entry with assignment (complete comment)
+            if ( /^\s*(\w+)\s*=\s*([\w\d\(\)\,\|\!\s]+[^\,\s])\s*,?\s*\/\*\s*(.+)\s*\*\/\s*$/ )
+               {
+                  $entry = $1;
+                  $values{ $entry } = $2;
+                  $entries{ $entry } = $3;
+               }
+            # entry with assignment (opening comment)
+            elsif ( /^\s*(\w+)\s*=\s*([\w\d\(\)\,\|\!\s]+[^\,\s])\s*,?\s*\/\*\s*(.+)\s*$/ )
+               {
+                  $entry = $1;
+                  $values{ $entry } = $2;
+
+                  parse_comment( \$t1, \$t2, \$opt, $3 );
+
+                  $entries{ $entry } = $t1.$t2;
+               }
+            # entry with assignment (none or preceding comment)
+            elsif ( /^\s*(\w+)\s*=\s*([\w\d\(\)\,\|\!\s]+[^\,\s])\s*,?\s*$/ )
+               {
+                  $entry = $1;
+                  $values{ $entry } = $2;
+                  $entries{ $entry } = $pre;
+               }
+            # entry without assignment (complete comment)
+            elsif ( /^\s*(\w+)\s*,?\s*\/\*\s*(.+)\s*\*\/\s*$/ )
+               {
+                  $entry = $1;
+                  $entries{ $entry } = $2;
+               }
+            # entry without assignment (opening comment)
+            elsif ( /^\s*(\w+)\s*,?\s*\/\*\s*(.+)\s*$/ )
+               {
+                  $entry = $1;
+
+                  parse_comment( \$t1, \$t2, \$opt, $2 );
+
+                  $entries{ $entry } = $t1.$t2;
+               }
+            # entry without assignment (none or preceding comment)
+            elsif ( /^\s*(\w+)\s*,?\s*$/ )
+               {
+                  $entry = $1;
+                  $entries{ $entry } = $pre;
+               }
+            # preceding comment (complete)
+            elsif ( /^\s*\/\*\s*(.+)\s*\*\/\s*$/ )
+               {
+                  $pre = $1;
+               }
+            # preceding comment (opening)
+            elsif ( /^\s*\/\*\s*(.+)\s*$/ )
+               {
+                  parse_comment( \$t1, \$t2, \$opt, $1 );
+
+                  $pre = $t1.$t2;
+               }
+            # end of enum
+            elsif ( /^\s*\}\s*(\w+)\s*\;\s*$/ )
+               {
+                  $enum = $1;
+
+                  trim( \$enum );
+
+                  $enum_list{$enum} = $headline;
+                  $type_list{$enum} = $headline;
+
+                  last;
+               }
+            # blank line?
+            else
+               {
+                  $pre = "";
+               }
+
+            if ($entry ne "")
+               {
+                  push (@list, $entry);
+               }
+         }
+
+      if (scalar @list > 0)
+         {
+            print TYPES "<p>\n",
+                        "  <a name=\"$enum\" href=\"#$enum\">\n",
+                        "    <h3><font color=$COLOR_ENUM_NAME>$enum</font></h3>\n",
+                        "  </a>\n",
+                        "  <h4>$headline</h4>\n",
+                        "  <TABLE border=0 cellspacing=4 cellpadding=2 bgcolor=$COLOR_ENTRIES_BG>\n";
+
+            foreach $key (@list)
+               {
+                  substitute_links (\$entries{$key});
+
+                  print TYPES "    <TR><TD width=32> </TD><TD valign=top>\n",
+                              "      <font color=$COLOR_ENUM_ENTRY_ID><b>$key</b></font>\n",
+                              "    </TD><TD width=20> </TD><TD valign=top>\n",
+                              "      <font color=$COLOR_ENUM_ENTRY_VAL>$values{$key}</font>\n",
+                              "    </TD><TD width=20> </TD><TD valign=top>\n",
+                              "      <font color=$COLOR_ENTRIES_DESC>$entries{$key}</font>\n",
+                              "    </TD></TR>\n";
+               }
+
+            print TYPES "  </TABLE>\n",
+                        "</p><p>\n",
+                        "  $detailed\n",
+                        "</p><hr>\n";
+         }
+   }
+
+#
+# Reads stdin until the end of the enum is reached.
+# Writes formatted HTML to "types.html".
+#
+sub parse_struct
+   {
+      local @entries;
+      local %entries_params;
+      local %entries_types;
+      local %entries_ptrs;
+
+      while (<>)
+         {
+            chomp;
+
+            local $entry;
+
+            # without comment
+            if ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?;\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+                  $text = "";
+               }
+            # complete one line entry
+            elsif ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?;\s*\/\*\s*(.+)\*\/\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+                  $text = $6;
+               }
+            # with comment opening
+            elsif ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?;\s*\/\*\s*(.+)\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+
+                  parse_comment( \$t1, \$t2, \$opt, $6 );
+
+                  $text = $t1.$t2;
+               }
+            elsif ( /^\s*\}\s*(\w+)\s*\;\s*$/ )
+               {
+                  $struct = $1;
+
+                  trim( \$struct );
+
+                  $struct_list{$struct} = $headline;
+                  $type_list{$struct} = $headline;
+
+                  last;
+               }
+
+            if ($entry ne "")
+               {
+                  # TODO: Use structure
+                  $entries_types{$entry} = $const . type_link( $type );
+                  $entries_ptrs{$entry} = $ptr;
+                  $entries_params{$entry} = $text;
+
+                  push (@entries, $entry);
+               }
+         }
+
+      if (scalar @entries > 0)
+         {
+            print TYPES "<p>",
+                        "  <a name=\"$struct\" href=\"#$struct\">\n",
+                        "    <h3><font color=$COLOR_STRUCT_NAME>$struct</font></h3>\n",
+                        "  </a>\n",
+                        "  <h4>$headline</h4>\n",
+                        "  <TABLE border=0 cellspacing=4 cellpadding=2 bgcolor=$COLOR_ENTRIES_BG>\n";
+
+            foreach $key (@entries)
+               {
+                  substitute_links (\$entries_params{$key});
+
+                  print TYPES "    <TR><TD width=32> </TD><TD valign=top>\n",
+                              "      $entries_types{$key}\n",
+                              "    </TD><TD width=20> </TD><TD valign=top align=right>\n",
+                              "      <FONT color=$COLOR_ENTRIES_PTR>$entries_ptrs{$key}</FONT>\n",
+                              "    </TD><TD valign=top>\n",
+                              "      <FONT color=$COLOR_ENTRIES_ID><B>$key</B></FONT>\n",
+                              "    </TD><TD width=20> </TD><TD valign=top>\n",
+                              "      <font color=$COLOR_ENTRIES_DESC>$entries_params{$key}</font>\n",
+                              "    </TD></TR>\n";
+               }
+
+            print TYPES "  </TABLE>\n",
+                        "</p><p>\n",
+                        "  $detailed\n",
+                        "</p><hr>\n";
+         }
+   }
+
+#
+# Reads stdin until the end of the function type is reached.
+# Writes formatted HTML to "types.html".
+# Parameters are the return type and function type name.
+#
+sub parse_func ($$)
+   {
+      local ($rtype, $name) = @_;
+
+      local @entries;
+      local %entries_params;
+      local %entries_types;
+      local %entries_ptrs;
+
+      trim( \$rtype );
+      trim( \$name );
+
+      while (<>)
+         {
+            chomp;
+
+            local $entry;
+
+            # without comment
+            if ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?,?\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+                  $text = "";
+               }
+            # complete one line entry
+            elsif ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?,?\s*\/\*\s*(.+)\*\/\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+                  $text = $6;
+               }
+            # with comment opening
+            elsif ( /^\s*(const )?\s*([\w ]+)\s+(\**)([\w\d\+\[\]]+)(\s*:\s*\d+)?,?\s*\/\*\s*(.+)\s*$/ )
+               {
+                  $const = $1;
+                  $type = $2;
+                  $ptr = $3;
+                  $entry = $4.$5;
+
+                  parse_comment( \$t1, \$t2, \$opt, $6 );
+
+                  $text = $t1.$t2;
+               }
+            elsif ( /^\s*\)\;\s*$/ )
+               {
+                  $func_list{$name} = $headline;
+                  $type_list{$name} = $headline;
+
+                  last;
+               }
+
+            if ($entry ne "")
+               {
+                  # TODO: Use structure
+                  $entries_types{$entry} = $const . type_link( $type );
+                  $entries_ptrs{$entry} = $ptr;
+                  $entries_params{$entry} = $text;
+
+                  push (@entries, $entry);
+               }
+         }
+
+      $rtype = type_link( $rtype );
+
+      if (scalar @entries > 0)
+         {
+            print TYPES "<p>",
+                        "  <a name=\"$name\" href=\"#$name\">\n",
+                        "    <h3><font color=$COLOR_FUNCTYPE_NAME>$name</font></h3>\n",
+                        "  </a>\n",
+                        "  <h4>$headline</h4>\n",
+                        "  <TABLE border=0 cellspacing=4 cellpadding=2 bgcolor=$COLOR_ENTRIES_BG>\n",
+                        "    <TR><TD colspan=4>\n",
+                        "         <I>$rtype (*<FONT color=$COLOR_FUNCTYPE_HEAD>$name</FONT>) (</I>\n",
+                        "    </TD></TR>\n";
+
+            foreach $key (@entries)
+               {
+                  print TYPES "    <TR><TD width=32>\n",
+                              "       \n",
+                              "    </TD><TD valign=top>\n",
+                              "      $entries_types{$key}\n",
+                              "    </TD><TD width=20> </TD><TD valign=top align=right>\n",
+                              "      <FONT color=$COLOR_ENTRIES_PTR>$entries_ptrs{$key}</FONT>\n",
+                              "    </TD><TD valign=top>\n",
+                              "      <FONT color=$COLOR_ENTRIES_ID><B>$key</B></FONT>\n",
+                              "    </TD><TD width=20> </TD><TD valign=top>\n",
+                              "      <font color=$COLOR_ENTRIES_DESC>$entries_params{$key}</font>\n",
+                              "    </TD></TR>\n";
+               }
+
+            print TYPES "    <TR><TD colspan=4><I>);</I></TD></TR>\n",
+                        "  </TABLE>\n",
+                        "</p><p>\n",
+                        "  $detailed\n",
+                        "</p><hr>\n";
+         }
+   }
+
+#
+# Reads stdin until the end of the macro is reached.
+# Writes formatted HTML to "types.html".
+# Parameters are the macro name, parameters and value.
+#
+sub parse_macro ($$$)
+   {
+      local ($macro, $params, $value) = @_;
+
+      trim( \$macro );
+      trim( \$params );
+      trim( \$value );
+
+      while (<>)
+         {
+            chomp;
+
+            last unless /\\$/;
+         }
+
+      if (!defined ($options{"internal"}) && $value ne "") {
+         $macro_list{$macro} = $headline;
+         $type_list{$macro} = $headline;
+
+         $value =~ s/^\s*\\\s*$//;
+
+         print TYPES "<p>\n",
+                     "  <a name=\"$macro\" href=\"#$macro\">\n",
+                     "    <h3>\n",
+                     "        <font color=$COLOR_MACRO_NAME>$macro</font>\n",
+                     "        <font color=$COLOR_MACRO_PARAMS>$params</font>\n",
+                     "    </h3>\n",
+                     "  </a>\n",
+                     "  <h4>$headline</h4>\n",
+                     "  <font color=$COLOR_MACRO_VALUE size=+1><b>$value</b></font>\n",
+                     "</p><p>\n",
+                     "  $detailed\n",
+                     "</p><hr>\n";
+      }
+   }
+
+########################################################################################################################
+## HTML Files
+#
+
+sub html_create ($$$$$)
+   {
+      local ($FILE, $filename, $title, $subtitle, $singletitle) = @_;
+
+      open( $FILE, ">$filename" )
+          or die ("*** Can not open '$filename' for writing:\n*** $!");
+
+      print $FILE "<HTML>\n",
+                  "<STYLE>\n",
+                  "  <!--\n",
+                  "    A{textdecoration:none}\n",
+                  "  -->\n",
+                  "</STYLE>\n",
+                  "<STYLE type=\"text/css\">\n",
+                  "  A:link, A:visited, A:active { text-decoration: none; }\n",
+                  "</STYLE>\n",
+                  "<HEAD>\n",
+                  "  <TITLE>$singletitle [$PROJECT Reference Manual]\n",
+                  "\n",
+                  "\n",
+                  "\n",
+                  "\n",
+                  "  \n",
+                  "  \n",
+                  "
\n", + " \n", + " \n", + "   ", + " Reference Manual - $VERSION\n", + "
\n"; + + if ($subtitle) + { + print $FILE " \n", + " \n", + "
\n", + " $title \n", + " \n", + "  $subtitle\n", + "
\n"; + } + else + { + print $FILE " $title\n"; + } + + print $FILE "
\n", + "\n"; + } + +sub html_close ($) + { + local ($FILE) = @_; + + print $FILE "\n", + "\n", + " \n", + "
\n", + " ", + " \"Creative", + " ", + " \n", + " This work is licensed under a", + " ", + " Creative Commons Attribution-Share Alike 3.0 License", + "
\n", + "\n", + "\n"; + + close( $FILE ); + } + + +######################################################################################################################## +## Main Function +# + +sub gen_doc ($$) { + local ($project, $version) = @_; + + trim( \$project ); + trim( \$version ); + + html_create( INDEX, "index.html", "$PROJECT Reference", "API Overview", "Index" ); + html_create( TYPES, "types.html", "$PROJECT Reference", "Type Definitions", "Types" ); + + print INDEX "

\n", + "

\n", + "

Interfaces

\n", + " \n"; + + while (<>) { + chomp; + + if ( /^\s*DECLARE_INTERFACE\s*\(\s*(\w+)\s\)\s*$/ ) { + $interface = $1; + + trim( \$interface ); + + if (!defined ($interfaces{$interface})) { + print INDEX " \n"; + + $interfaces{$interface} = "$headline $detailed"; + } + } + elsif ( /^\s*DEFINE_INTERFACE\s*\(\s*(\w+),\s*$/ ) { + parse_interface( $1 ); + } + elsif ( /^\s*typedef\s+enum\s*\{?\s*$/ ) { + parse_enum(); + } + elsif ( /^\s*typedef\s+(struct|union)\s*\{?\s*$/ ) { + parse_struct(); + } + elsif ( /^\s*typedef\s+(\w+)\s+\(\*(\w+)\)\s*\(\s*$/ ) { + parse_func( $1, $2 ); + } + elsif ( /^\s*#define\s+([^\(\s]+)(\([^\)]*\))?\s*(.*)/ ) { + parse_macro( $1, $2, $3 ); + } + elsif ( /^\s*\/\*\s*$/ ) { + parse_comment( \$headline, \$detailed, \$options, "" ); + } + else { + $headline = ""; + $detailed = ""; + %options = (); + } + } + + print INDEX "
\n", + " $1\n", + " \n", + " $headline $detailed\n", + "
\n", + "

\n"; + + print_list( \%func_list, "Function Types" ); + print_list( \%enum_list, "Enumerated Types" ); + print_list( \%struct_list, "Structured Types" ); + print_list( \%macro_list, "Definitions" ); + + + html_close( INDEX ); + html_close( TYPES ); +} + diff --git a/Source/DirectFB/tools/mkdfiff.c b/Source/DirectFB/tools/mkdfiff.c new file mode 100755 index 0000000..b2fec18 --- /dev/null +++ b/Source/DirectFB/tools/mkdfiff.c @@ -0,0 +1,444 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#include + +static DirectFBPixelFormatNames( format_names ); + +static const char *filename; +static DFBSurfacePixelFormat format = DSPF_UNKNOWN; +static DFBSurfacePixelFormat rgbformat = DSPF_UNKNOWN; + +/**********************************************************************************************************************/ + +static DFBResult +load_image (const char *filename, + DFBSurfaceDescription *desc) +{ + DFBSurfacePixelFormat dest_format; + DFBSurfacePixelFormat src_format; + FILE *fp; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + png_uint_32 width, height; + unsigned char *data = NULL; + int type; + char header[8]; + int bytes, pitch; + + dest_format = + (desc->flags & DSDESC_PIXELFORMAT) ? desc->pixelformat : DSPF_UNKNOWN; + + desc->flags = 0; + desc->preallocated[0].data = NULL; + + if (!(fp = fopen (filename, "rb"))) { + fprintf (stderr, "Failed to open file '%s': %s.\n", + filename, strerror (errno)); + goto cleanup; + } + + bytes = fread (header, 1, sizeof(header), fp); + if (png_sig_cmp ((unsigned char*) header, 0, bytes)) { + fprintf (stderr, "File '%s' doesn't seem to be a PNG image file.\n", + filename); + goto cleanup; + } + + png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, + NULL, NULL, NULL); + if (!png_ptr) + goto cleanup; + + if (setjmp (png_ptr->jmpbuf)) { + if (desc->preallocated[0].data) { + free (desc->preallocated[0].data); + desc->preallocated[0].data = NULL; + } + + /* data might have been clobbered, + set it to NULL and leak instead of crashing */ + data = NULL; + + goto cleanup; + } + + info_ptr = png_create_info_struct (png_ptr); + if (!info_ptr) + goto cleanup; + + png_init_io (png_ptr, fp); + png_set_sig_bytes (png_ptr, bytes); + + png_read_info (png_ptr, info_ptr); + + png_get_IHDR (png_ptr, info_ptr, + &width, &height, &bytes, &type, NULL, NULL, NULL); + + if (bytes == 16) + png_set_strip_16 (png_ptr); + +#ifdef WORDS_BIGENDIAN + png_set_swap_alpha (png_ptr); +#else + png_set_bgr (png_ptr); +#endif + + src_format = (type & PNG_COLOR_MASK_ALPHA) ? DSPF_ARGB : DSPF_RGB32; + switch (type) { + case PNG_COLOR_TYPE_GRAY: + if (dest_format == DSPF_A8) { + src_format = DSPF_A8; + break; + } + /* fallthru */ + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_set_gray_to_rgb (png_ptr); + if (rgbformat) + dest_format = rgbformat; + break; + + case PNG_COLOR_TYPE_PALETTE: + png_set_palette_to_rgb (png_ptr); + /* fallthru */ + case PNG_COLOR_TYPE_RGB: + if (rgbformat) + dest_format = rgbformat; + case PNG_COLOR_TYPE_RGB_ALPHA: + if (dest_format == DSPF_RGB24) { + png_set_strip_alpha (png_ptr); + src_format = DSPF_RGB24; + } + break; + } + + switch (src_format) { + case DSPF_RGB32: + png_set_filler (png_ptr, 0xFF, +#ifdef WORDS_BIGENDIAN + PNG_FILLER_BEFORE +#else + PNG_FILLER_AFTER +#endif + ); + break; + case DSPF_ARGB: + case DSPF_A8: + if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha (png_ptr); + break; + default: + break; + } + + pitch = (DFB_BYTES_PER_LINE( src_format, width ) + 7) & ~7; + + data = malloc (height * pitch); + if (!data) { + fprintf (stderr, "Failed to allocate %ld bytes.\n", height * pitch); + goto cleanup; + } + + { + unsigned int i; + png_bytep bptrs[height]; + + for (i = 0; i < height; i++) + bptrs[i] = data + i * pitch; + + png_read_image (png_ptr, bptrs); + } + + if (!dest_format) + dest_format = src_format; + + if (DFB_BYTES_PER_PIXEL(src_format) != DFB_BYTES_PER_PIXEL(dest_format)) { + unsigned char *s, *d, *dest; + int d_pitch, h; + + D_ASSERT( DFB_BYTES_PER_PIXEL(src_format) == 4 ); + + d_pitch = (DFB_BYTES_PER_LINE(dest_format, width) + 7) & ~7; + + dest = malloc (height * d_pitch); + if (!dest) { + fprintf (stderr, "Failed to allocate %ld bytes.\n", + height * d_pitch); + goto cleanup; + } + + h = height; + switch (dest_format) { + case DSPF_RGB16: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_rgb16 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB1555: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb1555 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB2554: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb2554 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB4444: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb4444 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_RGB332: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_rgb332 ((u32 *) s, (u8 *) d, width); + break; + case DSPF_A8: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_a8 ((u32 *) s, (u8 *) d, width); + break; + default: + fprintf (stderr, + "Sorry, unsupported format conversion.\n"); + goto cleanup; + } + + free (data); + data = dest; + pitch = d_pitch; + } + + desc->flags = (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | + DSDESC_PREALLOCATED); + desc->width = width; + desc->height = height; + desc->pixelformat = dest_format; + desc->preallocated[0].pitch = pitch; + desc->preallocated[0].data = data; + + data = NULL; + + cleanup: + if (fp) + fclose (fp); + + if (png_ptr) + png_destroy_read_struct (&png_ptr, &info_ptr, NULL); + + if (data) + free (data); + + return ((desc->flags) ? DFB_OK : DFB_FAILURE); +} + +/**********************************************************************************************************************/ + +static void +print_usage (const char *prg_name) +{ + int i = 0; + + fprintf (stderr, "\nDirectFB Fast Image File Format Tool (version %s)\n\n", DIRECTFB_VERSION); + fprintf (stderr, "Usage: %s [options]\n\n", prg_name); + fprintf (stderr, "Options:\n"); + fprintf (stderr, " -f, --format Choose the pixel format (in all cases)\n"); + fprintf (stderr, " -r, --rgbformat Choose the pixel format (in case of RGB)\n"); + fprintf (stderr, " -h, --help Show this help message\n"); + fprintf (stderr, " -v, --version Print version information\n"); + fprintf (stderr, "\n"); + + fprintf (stderr, "Known pixel formats:\n"); + + while (format_names[i].format != DSPF_UNKNOWN) { + DFBSurfacePixelFormat format = format_names[i].format; + + fprintf (stderr, " %-10s %2d bits, %d bytes", + format_names[i].name, DFB_BITS_PER_PIXEL(format), + DFB_BYTES_PER_PIXEL(format)); + + if (DFB_PIXELFORMAT_HAS_ALPHA(format)) + fprintf (stderr, " ALPHA"); + + if (DFB_PIXELFORMAT_IS_INDEXED(format)) + fprintf (stderr, " INDEXED"); + + if (DFB_PLANAR_PIXELFORMAT(format)) { + int planes = DFB_PLANE_MULTIPLY(format, 1000); + + fprintf (stderr, " PLANAR (x%d.%03d)", + planes / 1000, planes % 1000); + } + + fprintf (stderr, "\n"); + + ++i; + } + fprintf (stderr, "\n"); +} + +static DFBBoolean +parse_format( const char *arg, DFBSurfacePixelFormat *ret_format ) +{ + int i = 0; + + while (format_names[i].format != DSPF_UNKNOWN) { + if (!strcasecmp( arg, format_names[i].name )) { + *ret_format = format_names[i].format; + return DFB_TRUE; + } + + ++i; + } + + fprintf (stderr, "\nInvalid format specified!\n\n" ); + + return DFB_FALSE; +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + + for (n = 1; n < argc; n++) { + const char *arg = argv[n]; + + if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) { + fprintf (stderr, "mkdfiff version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + + if (strcmp (arg, "-f") == 0 || strcmp (arg, "--format") == 0) { + if (++n == argc) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (!parse_format( argv[n], &format )) + return DFB_FALSE; + + continue; + } + + if (strcmp (arg, "-r") == 0 || strcmp (arg, "--rgbformat") == 0) { + if (++n == argc) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (!parse_format( argv[n], &rgbformat )) + return DFB_FALSE; + + continue; + } + + if (filename || access( arg, R_OK )) { + print_usage (argv[0]); + return DFB_FALSE; + } + + filename = arg; + } + + if (!filename) { + print_usage (argv[0]); + return DFB_FALSE; + } + + return DFB_TRUE; +} + +/**********************************************************************************************************************/ + +static DFIFFHeader header = { + magic: { 'D', 'F', 'I', 'F', 'F' }, + major: 0, + minor: 0, + flags: DFIFF_FLAG_LITTLE_ENDIAN +}; + +int +main( int argc, char *argv[] ) +{ + int i; + DFBSurfaceDescription desc = { flags: DSDESC_NONE }; + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -1; + + if (format != DSPF_UNKNOWN) { + desc.flags |= DSDESC_PIXELFORMAT; + desc.pixelformat = format; + } + + if (load_image( filename, &desc )) + return -2; + + for (i=0; i, + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#undef SIZEOF_LONG +#include +#include FT_GLYPH_H + +#define MAX_SIZE_COUNT 256 +#define MAX_ROW_WIDTH 2047 + +D_DEBUG_DOMAIN( mkdgiff, "mkdgiff", "DirectFB Glyph Image File Format Tool" ); + +static DirectFBPixelFormatNames( format_names ); + +static const char *filename; +static int face_index; +static DFBSurfacePixelFormat format = DSPF_A8; + +static int size_count; +static int face_sizes[MAX_SIZE_COUNT]; + +/**********************************************************************************************************************/ + +static void +print_usage (const char *prg_name) +{ + int i = 0; + + fprintf (stderr, "\nDirectFB Glyph Image File Format Tool (version %s)\n\n", DIRECTFB_VERSION); + fprintf (stderr, "Usage: %s [options]\n\n", prg_name); + fprintf (stderr, "Options:\n"); + fprintf (stderr, " -f, --format Choose the pixel format (default A8)\n"); + fprintf (stderr, " -s, --sizes [,s2...] Choose sizes to generate glyph images for\n"); + fprintf (stderr, " -h, --help Show this help message\n"); + fprintf (stderr, " -v, --version Print version information\n"); + fprintf (stderr, "\n"); + + fprintf (stderr, "Known pixel formats with alpha:\n"); + + while (format_names[i].format != DSPF_UNKNOWN) { + DFBSurfacePixelFormat format = format_names[i].format; + + if (DFB_PIXELFORMAT_HAS_ALPHA(format)) { + fprintf (stderr, " %-10s %2d bits, %d bytes", + format_names[i].name, DFB_BITS_PER_PIXEL(format), + DFB_BYTES_PER_PIXEL(format)); + + if (DFB_PIXELFORMAT_IS_INDEXED(format)) + fprintf (stderr, " INDEXED"); + + if (DFB_PLANAR_PIXELFORMAT(format)) { + int planes = DFB_PLANE_MULTIPLY(format, 1000); + + fprintf (stderr, " PLANAR (x%d.%03d)", + planes / 1000, planes % 1000); + } + + fprintf (stderr, "\n"); + } + + ++i; + } + fprintf (stderr, "\n"); +} + +static DFBBoolean +parse_format( const char *arg, DFBSurfacePixelFormat *ret_format ) +{ + int i = 0; + + while (format_names[i].format != DSPF_UNKNOWN) { + if (!strcasecmp( arg, format_names[i].name )) { + *ret_format = format_names[i].format; + return DFB_TRUE; + } + + ++i; + } + + fprintf (stderr, "\nInvalid format specified!\n\n" ); + + return DFB_FALSE; +} + +static DFBBoolean +parse_sizes( const char *arg ) +{ + int i = 0; + int size = 0; + + for (i=0; arg[i]; i++) { + switch (arg[i]) { + case '0' ... '9': + if (size_count == MAX_SIZE_COUNT) { + fprintf (stderr, "\nMaximum number of sizes (%d) exceeded!\n\n", MAX_SIZE_COUNT ); + return DFB_FALSE; + } + size = size * 10 + arg[i] - '0'; + break; + + case ',': + if (size) { + face_sizes[size_count++] = size; + size = 0; + } + break; + + default: + fprintf (stderr, "\nInvalid character used in sizes argument!\n\n" ); + return DFB_FALSE; + } + } + + if (size) + face_sizes[size_count++] = size; + + return DFB_TRUE; +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + + for (n = 1; n < argc; n++) { + const char *arg = argv[n]; + + if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) { + fprintf (stderr, "mkdgiff version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + + if (strcmp (arg, "-f") == 0 || strcmp (arg, "--format") == 0) { + if (++n == argc) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (!parse_format( argv[n], &format )) + return DFB_FALSE; + + continue; + } + + if (strcmp (arg, "-s") == 0 || strcmp (arg, "--sizes") == 0) { + if (++n == argc) { + print_usage (argv[0]); + return DFB_FALSE; + } + + if (!parse_sizes( argv[n] )) + return DFB_FALSE; + + continue; + } + + if (filename || access( arg, R_OK )) { + print_usage (argv[0]); + return DFB_FALSE; + } + + filename = arg; + } + + if (!filename) { + print_usage (argv[0]); + return DFB_FALSE; + } + + return DFB_TRUE; +} + +/**********************************************************************************************************************/ + +static void +write_glyph( DGIFFGlyphInfo *glyph, FT_GlyphSlot slot, void *dst, int pitch ) +{ + int y; + u8 *src = slot->bitmap.buffer; + + D_DEBUG_AT( mkdgiff, "%s( %p, %p, %p, %d ) <- width %d\n", + __FUNCTION__, glyph, slot, dst, pitch, glyph->width ); + + for (y=0; y < glyph->height; y++) { + int i, j, n; + u8 *dst8 = dst; + u16 *dst16 = dst; + u32 *dst32 = dst; + + switch (slot->bitmap.pixel_mode) { + case ft_pixel_mode_grays: + switch (format) { + case DSPF_ARGB: + if (0){//FIXME thiz->surface_caps & DSCAPS_PREMULTIPLIED) { + for (i=0; iwidth; i++) + dst32[i] = ((src[i] << 24) | + (src[i] << 16) | + (src[i] << 8) | src[i]); + } + else + for (i=0; iwidth; i++) + dst32[i] = (src[i] << 24) | 0xFFFFFF; + break; + case DSPF_AiRGB: + for (i=0; iwidth; i++) + dst32[i] = ((src[i] ^ 0xFF) << 24) | 0xFFFFFF; + break; + case DSPF_ARGB4444: + for (i=0; iwidth; i++) + dst16[i] = (src[i] << 8) | 0xFFF; + break; + case DSPF_ARGB2554: + for (i=0; iwidth; i++) + dst16[i] = (src[i] << 8) | 0x3FFF; + break; + case DSPF_ARGB1555: + for (i=0; iwidth; i++) + dst16[i] = (src[i] << 8) | 0x7FFF; + break; + case DSPF_A8: + direct_memcpy( dst, src, glyph->width ); + break; + case DSPF_A4: + for (i=0, j=0; iwidth; i+=2, j++) + dst8[j] = (src[i] & 0xF0) | (src[i+1] >> 4); + break; + case DSPF_A1: + for (i=0, j=0; i < glyph->width; ++j) { + register u8 p = 0; + + for (n=0; n<8 && iwidth; ++i, ++n) + p |= (src[i] & 0x80) >> n; + + dst8[j] = p; + } + break; + default: + break; + } + break; + + case ft_pixel_mode_mono: + switch (format) { + case DSPF_ARGB: + for (i=0; iwidth; i++) + dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ? + 0xFF : 0x00) << 24) | 0xFFFFFF; + break; + case DSPF_AiRGB: + for (i=0; iwidth; i++) + dst32[i] = (((src[i>>3] & (1<<(7-(i%8)))) ? + 0x00 : 0xFF) << 24) | 0xFFFFFF; + break; + case DSPF_ARGB4444: + for (i=0; iwidth; i++) + dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ? + 0xF : 0x0) << 12) | 0xFFF; + break; + case DSPF_ARGB2554: + for (i=0; iwidth; i++) + dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ? + 0x3 : 0x0) << 14) | 0x3FFF; + break; + case DSPF_ARGB1555: + for (i=0; iwidth; i++) + dst16[i] = (((src[i>>3] & (1<<(7-(i%8)))) ? + 0x1 : 0x0) << 15) | 0x7FFF; + break; + case DSPF_A8: + for (i=0; iwidth; i++) + dst8[i] = (src[i>>3] & + (1<<(7-(i%8)))) ? 0xFF : 0x00; + break; + case DSPF_A4: + for (i=0, j=0; iwidth; i+=2, j++) + dst8[j] = ((src[i>>3] & + (1<<(7-(i%8)))) ? 0xF0 : 0x00) | + ((src[(i+1)>>3] & + (1<<(7-((i+1)%8)))) ? 0x0F : 0x00); + break; + case DSPF_A1: + direct_memcpy( dst, src, DFB_BYTES_PER_LINE(DSPF_A1, glyph->width) ); + break; + default: + break; + } + break; + + default: + break; + + } + + src += slot->bitmap.pitch; + dst += pitch; + } +} + +static int +do_face( FT_Face face, int size ) +{ + int i, ret; + int align = DFB_PIXELFORMAT_ALIGNMENT( format ); + int num_glyphs = 0; + int num_rows = 1; + int row_index = 0; + int row_offset = 0; + int next_face = sizeof(DGIFFFaceHeader); + int total_height = 0; + FT_ULong code; + FT_UInt index; + DGIFFFaceHeader header; + DGIFFGlyphInfo *glyphs; + DGIFFGlyphRow *rows; + void **row_data; + + D_DEBUG_AT( mkdgiff, "%s( %p, %d ) <- %ld glyphs\n", __FUNCTION__, face, size, face->num_glyphs ); + + /* Clear to not leak any data into file. */ + memset( &header, 0, sizeof(header) ); + + /* Set the desired size. */ + ret = FT_Set_Char_Size( face, 0, size << 6, 0, 0 ); + if (ret) { + D_ERROR( "Could not set pixel size to %d!\n", size ); + return ret; + } + + /* Allocate glyph info array. */ + glyphs = D_CALLOC( face->num_glyphs, sizeof(DGIFFGlyphInfo) ); + rows = D_CALLOC( face->num_glyphs, sizeof(DGIFFGlyphRow) ); /* WORST case :) */ + row_data = D_CALLOC( face->num_glyphs, sizeof(void*) ); /* WORST case :) */ + + for (code = FT_Get_First_Char( face, &index ); + index; + code = FT_Get_Next_Char( face, code, &index )) + { + FT_GlyphSlot slot; + DGIFFGlyphInfo *glyph = &glyphs[num_glyphs]; + DGIFFGlyphRow *row = &rows[num_rows - 1]; + + D_DEBUG_AT( mkdgiff, " -> code %3lu - index %3u\n", code, index ); + + if (num_glyphs == face->num_glyphs) { + D_ERROR( "Actual number of characters is bigger than number of glyphs!\n" ); + break; + } + + ret = FT_Load_Glyph( face, index, FT_LOAD_RENDER ); + if (ret) { + D_ERROR( "Could not render glyph for character index %d!\n", index ); + goto out; + } + + slot = face->glyph; + + glyph->unicode = code; + + glyph->width = slot->bitmap.width; + glyph->height = slot->bitmap.rows; + + glyph->left = slot->bitmap_left; + glyph->top = (face->size->metrics.ascender >> 6) - slot->bitmap_top; + glyph->advance = slot->advance.x >> 6; + + num_glyphs++; + + if (row->width > 0 && row->width + glyph->width > MAX_ROW_WIDTH) { + num_rows++; + row++; + } + + row->width += (glyph->width + align) & ~align; + + if (row->height < glyph->height) + row->height = glyph->height; + } + + for (i=0; i row %d, width %d, height %d\n", i, row->width, row->height ); + + total_height += row->height; + + row->pitch = (DFB_BYTES_PER_LINE( format, row->width ) + 7) & ~7; + + row_data[i] = D_CALLOC( row->height, row->pitch ); + + next_face += row->height * row->pitch; + } + + D_DEBUG_AT( mkdgiff, " -> %d glyphs, %d rows, total height %d\n", num_glyphs, num_rows, total_height ); + + next_face += num_glyphs * sizeof(DGIFFGlyphInfo); + next_face += num_rows * sizeof(DGIFFGlyphRow); + + for (i=0; i reloading character 0x%x (%d)\n", glyph->unicode, i ); + + ret = FT_Load_Char( face, glyph->unicode, FT_LOAD_RENDER ); + if (ret) { + D_ERROR( "Could not render glyph for unicode character 0x%x!\n", glyph->unicode ); + goto out; + } + + if (row_offset > 0 && row_offset + glyph->width > MAX_ROW_WIDTH) { + row_index++; + row_offset = 0; + } + + + D_DEBUG_AT( mkdgiff, " -> row offset %d\n", row_offset ); + + write_glyph( glyph, face->glyph, + row_data[row_index] + DFB_BYTES_PER_LINE( format, row_offset ), + rows[row_index].pitch ); + + glyph->row = row_index; + glyph->offset = row_offset; + + row_offset += (glyph->width + align) & ~align; + } + + D_ASSERT( row_index == num_rows - 1 ); + + header.next_face = next_face; + header.size = size; + + header.ascender = face->size->metrics.ascender >> 6; + header.descender = face->size->metrics.descender >> 6; + header.height = header.ascender - header.descender + 1; + + header.max_advance = face->size->metrics.max_advance >> 6; + + header.pixelformat = format; + + header.num_glyphs = num_glyphs; + header.num_rows = num_rows; + + D_DEBUG_AT( mkdgiff, " -> ascender %d, descender %d\n", header.ascender, header.descender ); + D_DEBUG_AT( mkdgiff, " -> height %d, max advance %d\n", header.height, header.max_advance ); + + fwrite( &header, sizeof(header), 1, stdout ); + + fwrite( glyphs, sizeof(*glyphs), num_glyphs, stdout ); + + for (i=0; ipitch, row->height, stdout ); + } + +out: + for (i=0; idebug = true; + direct_config->debugmem = true; + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -1; + + if (!size_count) { + fprintf( stderr, "\n\nUsing default sizes 8, 10, 12, 16, 22, 32\n" ); + + size_count = 6; + + face_sizes[0] = 8; + face_sizes[1] = 10; + face_sizes[2] = 12; + face_sizes[3] = 16; + face_sizes[4] = 22; + face_sizes[5] = 32; + } + + header.num_faces = size_count; + + + ret = FT_Init_FreeType( &library ); + if (ret) { + D_ERROR( "Initialization of the FreeType2 library failed!\n" ); + goto out; + } + + ret = FT_New_Face( library, filename, face_index, &face ); + if (ret) { + if (ret == FT_Err_Unknown_File_Format) + D_ERROR( "Unsupported font format in file `%s'!\n", filename ); + else + D_ERROR( "Failed loading face %d from font file `%s'!\n", face_index, filename ); + + goto out; + } + + ret = FT_Select_Charmap( face, ft_encoding_unicode ); + if (ret) { + D_ERROR( "Couldn't select Unicode encoding, falling back to Latin1.\n" ); + + ret = FT_Select_Charmap( face, ft_encoding_latin_1 ); + if (ret) + D_ERROR( "Couldn't even select Latin1 encoding!\n" ); + } + + fwrite( &header, sizeof(header), 1, stdout ); + + for (i=0; i, + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#define DIRECT_ENABLE_DEBUG + +#include + +extern "C" { +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +} + +#include +#include +#include +#include + + +#define MAX_ROW_WIDTH 2047 + +D_DEBUG_DOMAIN( mkdgiff, "mkdgiff", "DirectFB Glyph Image File Format Tool" ); + +/**********************************************************************************************************************/ + +static DirectFBPixelFormatNames( format_names ); +static DirectFBSurfaceBlittingFlagsNames( m_bflags ); + +static const char *filename; +static DFBSurfacePixelFormat m_format = DSPF_ARGB; + +/**********************************************************************************************************************/ + +static void +print_usage (const char *prg_name) +{ + int i = 0; + + fprintf (stderr, "\nDirectFB Glyph Image File Format Tool (version %s)\n\n", DIRECTFB_VERSION); + fprintf (stderr, "Usage: %s [options]\n\n", prg_name); + fprintf (stderr, "Options:\n"); + fprintf (stderr, " -f, --format Choose the pixel format (default ARGB)\n"); + fprintf (stderr, " -s, --sizes [,s2...] Choose sizes to generate glyph images for\n"); + fprintf (stderr, " -h, --help Show this help message\n"); + fprintf (stderr, " -v, --version Print version information\n"); + fprintf (stderr, "\n"); + + fprintf (stderr, "Known pixel formats with alpha:\n"); + + while (format_names[i].format != DSPF_UNKNOWN) { + DFBSurfacePixelFormat format = format_names[i].format; + + if (DFB_PIXELFORMAT_HAS_ALPHA(format)) { + fprintf (stderr, " %-10s %2d bits, %d bytes", + format_names[i].name, DFB_BITS_PER_PIXEL(format), + DFB_BYTES_PER_PIXEL(format)); + + if (DFB_PIXELFORMAT_IS_INDEXED(format)) + fprintf (stderr, " INDEXED"); + + if (DFB_PLANAR_PIXELFORMAT(format)) { + int planes = DFB_PLANE_MULTIPLY(format, 1000); + + fprintf (stderr, " PLANAR (x%d.%03d)", + planes / 1000, planes % 1000); + } + + fprintf (stderr, "\n"); + } + + ++i; + } + fprintf (stderr, "\n"); +} + +static DFBBoolean +parse_format( const char *arg, DFBSurfacePixelFormat *ret_format ) +{ + int i = 0; + + while (format_names[i].format != DSPF_UNKNOWN) { + if (!strcasecmp( arg, format_names[i].name )) { + *ret_format = format_names[i].format; + return DFB_TRUE; + } + + ++i; + } + + fprintf (stderr, "\nInvalid format specified!\n\n" ); + + return DFB_FALSE; +} + +static void +parse_flags( const char *arg, DFBSurfaceBlittingFlags *ret_flags ) +{ + int i; + + *ret_flags = DSBLIT_NOFX; + + for (i=0; i list; + typedef std::vector vector; +}; + +class Face : public Entity +{ +public: + Face() + : + Entity(), + size( 0 ), + height( 0 ), + ascender( 0 ), + descender( 0 ), + maxadvance( 0 ), + blittingflags( DSBLIT_NOFX ) + { + } + + + virtual Type GetType() const { return ENTITY_FACE; } + + + virtual void Dump() const; + + virtual void SetProperty( const std::string &name, const std::string &value ); + + + unsigned int size; + unsigned int height; + int ascender; + int descender; + int maxadvance; + DFBSurfaceBlittingFlags blittingflags; +}; + +class Glyph : public Entity +{ +public: + Glyph() + : + Entity(), + unicode( 0 ), + left( 0 ), + top( 0 ), + advance( 0 ) + { + } + + + virtual Type GetType() const { return ENTITY_GLYPH; } + + + virtual void Dump() const; + + virtual void SetProperty( const std::string &name, const std::string &value ); + + + unsigned int unicode; + int left; + int top; + int advance; + std::string file; +}; + +/**********************************************************************************************************************/ + +void +Entity::Dump() const +{ + direct_log_printf( NULL, "\n" ); + direct_log_printf( NULL, "Entity (TYPE %d)\n", GetType() ); + direct_log_printf( NULL, " Buffer at %p [%zu]\n", buf, length ); +} + +void +Face::Dump() const +{ + Entity::Dump(); + + direct_log_printf( NULL, " Size %u\n", size ); + direct_log_printf( NULL, " Height %u\n", height ); + direct_log_printf( NULL, " Ascender %d\n", ascender ); + direct_log_printf( NULL, " Descender %d\n", descender ); + direct_log_printf( NULL, " MaxAdvance %d\n", maxadvance ); + direct_log_printf( NULL, " BlittingFlags 0x%08x\n", blittingflags ); +} + +void +Glyph::Dump() const +{ + Entity::Dump(); + + direct_log_printf( NULL, " Unicode 0x%04x\n", unicode ); + direct_log_printf( NULL, " Left %d\n", left ); + direct_log_printf( NULL, " Top %d\n", top ); + direct_log_printf( NULL, " Advance %d\n", advance ); + direct_log_printf( NULL, " File '%s'\n", file.c_str() ); +} + +/**********************************************************************************************************************/ + +void +Entity::SetProperty( const std::string &name, + const std::string &value ) +{ +} + +void +Face::SetProperty( const std::string &name, + const std::string &value ) +{ + if (name == "size") { + sscanf( value.c_str(), "%u", &size ); + return; + } + + if (name == "height") { + sscanf( value.c_str(), "%u", &height ); + return; + } + + if (name == "ascender") { + sscanf( value.c_str(), "%d", &ascender ); + return; + } + + if (name == "descender") { + sscanf( value.c_str(), "%d", &descender ); + return; + } + + if (name == "maxadvance") { + sscanf( value.c_str(), "%d", &maxadvance ); + return; + } + + if (name == "blittingflags") { + parse_flags( value.c_str(), &blittingflags ); + return; + } +} + +void +Glyph::SetProperty( const std::string &name, + const std::string &value ) +{ + if (name == "unicode") { + sscanf( value.c_str(), "%x", &unicode ); + return; + } + + if (name == "left") { + sscanf( value.c_str(), "%d", &left ); + return; + } + + if (name == "top") { + sscanf( value.c_str(), "%d", &top ); + return; + } + + if (name == "advance") { + sscanf( value.c_str(), "%d", &advance ); + return; + } + + if (name == "file") { + file = value; + return; + } +} + +/**********************************************************************************************************************/ + +static void +get_entities( const char *buf, + size_t length, + Entity::vector &out_vector ) +{ + size_t i; + unsigned int level = 0; + bool quote = false; + + std::string name; + std::map names; + + Entity *entity = NULL; + + D_DEBUG_AT( mkdgiff, "%s( buf %p, length %zu )\n", __func__, buf, length ); + + for (i=0; i '%c' <-\n", level*2, "", level, buf[i] ); + + if (quote) { + switch (buf[i]) { + case '"': + quote = false; + break; + + default: + name += buf[i]; + } + } + else { + switch (buf[i]) { + case '"': + quote = true; + break; + + case '-': + case '_': + case 'a' ... 'z': + case 'A' ... 'Z': + case '0' ... '9': + name += buf[i]; + break; + + default: + if (!name.empty()) { + D_DEBUG_AT( mkdgiff, "%*s=-> name = '%s'\n", level*2, "", name.c_str() ); + + if (!names[level].empty()) { + switch (level) { + case 1: + D_DEBUG_AT( mkdgiff, "%*s#### setting property '%s' = '%s'\n", + level*2, "", names[level].c_str(), name.c_str() ); + + D_ASSERT( entity != NULL ); + + entity->SetProperty( names[level], name ); + break; + + default: + break; + } + + name = ""; + } + + names[level] = name; + name = ""; + } + + switch (buf[i]) { + case '{': + case '}': + switch (buf[i]) { + case '{': + switch (level) { + case 0: + if (names[level] == "face") { + D_ASSERT( entity == NULL ); + + entity = new Face(); + + entity->buf = &buf[i + 1]; + + D_DEBUG_AT( mkdgiff, "%*s#### open entity %p (Face)\n", level*2, "", entity ); + } + if (names[level] == "glyph") { + D_ASSERT( entity == NULL ); + + entity = new Glyph(); + + entity->buf = &buf[i + 1]; + + D_DEBUG_AT( mkdgiff, "%*s#### open entity %p (Glyph)\n", level*2, "", entity ); + } + break; + + default: + break; + } + + names[level] = ""; + + level++; + break; + + case '}': + D_ASSERT( names[level].empty() ); + + level--; + + switch (level) { + case 0: + D_DEBUG_AT( mkdgiff, "%*s#### close entity %p\n", level*2, "", entity ); + + D_ASSERT( entity != NULL ); + + entity->length = &buf[i-1] - entity->buf; + + out_vector.push_back( entity ); + + entity = NULL; + break; + + case 1: + break; + + default: + break; + } + break; + } + + D_DEBUG_AT( mkdgiff, "%*s=-> level => %u\n", level*2, "", level ); + break; + + case ' ': + case '\t': + case '\n': + case '\r': + break; + + default: + break; + } + break; + } + } + } +} + +/**********************************************************************************************************************/ + +static DFBResult +load_image (const char *filename, + DFBSurfaceDescription *desc) +{ + DFBSurfacePixelFormat dest_format; + DFBSurfacePixelFormat src_format; + FILE *fp; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + png_uint_32 width, height; + unsigned char *data = NULL; + int type; + char header[8]; + int bytes, pitch; + + dest_format = (desc->flags & DSDESC_PIXELFORMAT) ? desc->pixelformat : DSPF_UNKNOWN; + + desc->flags = DSDESC_NONE; + desc->preallocated[0].data = NULL; + + if (!(fp = fopen (filename, "rb"))) { + fprintf (stderr, "Failed to open file '%s': %s.\n", + filename, strerror (errno)); + goto cleanup; + } + + bytes = fread (header, 1, sizeof(header), fp); + if (png_sig_cmp ((unsigned char*) header, 0, bytes)) { + fprintf (stderr, "File '%s' doesn't seem to be a PNG image file.\n", + filename); + goto cleanup; + } + + png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, + NULL, NULL, NULL); + if (!png_ptr) + goto cleanup; + + if (setjmp (png_ptr->jmpbuf)) { + if (desc->preallocated[0].data) { + free (desc->preallocated[0].data); + desc->preallocated[0].data = NULL; + } + + /* data might have been clobbered, + set it to NULL and leak instead of crashing */ + data = NULL; + + goto cleanup; + } + + info_ptr = png_create_info_struct (png_ptr); + if (!info_ptr) + goto cleanup; + + png_init_io (png_ptr, fp); + png_set_sig_bytes (png_ptr, bytes); + + png_read_info (png_ptr, info_ptr); + + png_get_IHDR (png_ptr, info_ptr, + &width, &height, &bytes, &type, NULL, NULL, NULL); + + if (bytes == 16) + png_set_strip_16 (png_ptr); + +#ifdef WORDS_BIGENDIAN + png_set_swap_alpha (png_ptr); +#else + png_set_bgr (png_ptr); +#endif + + src_format = (type & PNG_COLOR_MASK_ALPHA) ? DSPF_ARGB : DSPF_RGB32; + switch (type) { + case PNG_COLOR_TYPE_GRAY: + if (dest_format == DSPF_A8) { + src_format = DSPF_A8; + break; + } + /* fallthru */ + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_set_gray_to_rgb (png_ptr); +// if (rgbformat) +// dest_format = rgbformat; + break; + + case PNG_COLOR_TYPE_PALETTE: + png_set_palette_to_rgb (png_ptr); + /* fallthru */ + case PNG_COLOR_TYPE_RGB: +// if (rgbformat) +// dest_format = rgbformat; + case PNG_COLOR_TYPE_RGB_ALPHA: + if (dest_format == DSPF_RGB24) { + png_set_strip_alpha (png_ptr); + src_format = DSPF_RGB24; + } + break; + } + + switch (src_format) { + case DSPF_RGB32: + png_set_filler (png_ptr, 0xFF, +#ifdef WORDS_BIGENDIAN + PNG_FILLER_BEFORE +#else + PNG_FILLER_AFTER +#endif + ); + break; + case DSPF_ARGB: + case DSPF_A8: + if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha (png_ptr); + break; + default: + break; + } + + pitch = (DFB_BYTES_PER_LINE( src_format, width ) + 7) & ~7; + + data = (unsigned char*) malloc (height * pitch); + if (!data) { + fprintf (stderr, "Failed to allocate %ld bytes.\n", height * pitch); + goto cleanup; + } + + { + unsigned int i; + png_bytep bptrs[height]; + + for (i = 0; i < height; i++) + bptrs[i] = data + i * pitch; + + png_read_image (png_ptr, bptrs); + } + + if (!dest_format) + dest_format = src_format; + + if (DFB_BYTES_PER_PIXEL(src_format) != DFB_BYTES_PER_PIXEL(dest_format)) { + unsigned char *s, *d, *dest; + int d_pitch, h; + + D_ASSERT( DFB_BYTES_PER_PIXEL(src_format) == 4 ); + + d_pitch = (DFB_BYTES_PER_LINE(dest_format, width) + 7) & ~7; + + dest = (unsigned char*) malloc (height * d_pitch); + if (!dest) { + fprintf (stderr, "Failed to allocate %ld bytes.\n", + height * d_pitch); + goto cleanup; + } + + h = height; + switch (dest_format) { + case DSPF_RGB16: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_rgb16 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB1555: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb1555 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB2554: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb2554 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_ARGB4444: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_argb4444 ((u32 *) s, (u16 *) d, width); + break; + case DSPF_RGB332: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_rgb332 ((u32 *) s, (u8 *) d, width); + break; + case DSPF_A8: + for (s = data, d = dest; h; h--, s += pitch, d += d_pitch) + dfb_argb_to_a8 ((u32 *) s, (u8 *) d, width); + break; + default: + fprintf (stderr, + "Sorry, unsupported format conversion.\n"); + goto cleanup; + } + + free (data); + data = dest; + pitch = d_pitch; + } + + desc->flags = (DFBSurfaceDescriptionFlags)(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | + DSDESC_PREALLOCATED); + desc->width = width; + desc->height = height; + desc->pixelformat = dest_format; + desc->preallocated[0].pitch = pitch; + desc->preallocated[0].data = data; + + data = NULL; + + cleanup: + if (fp) + fclose (fp); + + if (png_ptr) + png_destroy_read_struct (&png_ptr, &info_ptr, NULL); + + if (data) + free (data); + + return ((desc->flags) ? DFB_OK : DFB_FAILURE); +} + +/**********************************************************************************************************************/ + +static void +write_glyph( DGIFFGlyphInfo *glyph, const DFBSurfaceDescription &desc, void *dst, int pitch ) +{ + D_DEBUG_AT( mkdgiff, "%s( %p, %p, %d ) <- size %ux%u\n", + __FUNCTION__, glyph, dst, pitch, desc.width, desc.height ); + + switch (m_format) { + case DSPF_ARGB: + dfb_convert_to_argb( desc.pixelformat, desc.preallocated[0].data, desc.preallocated[0].pitch, + desc.height, (u32*) dst, pitch, desc.width, desc.height ); + break; + + default: + D_UNIMPLEMENTED(); + break; + } +} + +static int +do_face( const Face *face ) +{ + int i, ret; + int align = DFB_PIXELFORMAT_ALIGNMENT( m_format ); + int num_glyphs = 0; + int num_rows = 1; + int row_index = 0; + int row_offset = 0; + int next_face = sizeof(DGIFFFaceHeader); + int total_height = 0; + + Entity::vector glyph_vector; + unsigned int glyph_count = 0; + + DGIFFFaceHeader header; + DGIFFGlyphInfo *glyphs; + DGIFFGlyphRow *rows; + void **row_data; + + DFBSurfaceDescription *descs; + + D_DEBUG_AT( mkdgiff, "%s( %p )\n", __FUNCTION__, face ); + + get_entities( face->buf, face->length, glyph_vector ); + + glyph_count = glyph_vector.size(); + + + /* Clear to not leak any data into file. */ + memset( &header, 0, sizeof(header) ); + + + /* Allocate glyph info array. */ + glyphs = (DGIFFGlyphInfo*) D_CALLOC( glyph_count, sizeof(DGIFFGlyphInfo) ); + rows = (DGIFFGlyphRow*) D_CALLOC( glyph_count, sizeof(DGIFFGlyphRow) ); /* WORST case :) */ + row_data = (void**) D_CALLOC( glyph_count, sizeof(void*) ); /* WORST case :) */ + descs = (DFBSurfaceDescription*) D_CALLOC( glyph_count, sizeof(DFBSurfaceDescription) ); /* WORST case :) */ + + for (Entity::vector::const_iterator iter = glyph_vector.begin(); iter != glyph_vector.end(); iter++) { + const Glyph *glyph = dynamic_cast( *iter ); + + glyph->Dump(); + + + DGIFFGlyphInfo *info = &glyphs[num_glyphs]; + DGIFFGlyphRow *row = &rows[num_rows - 1]; + + D_DEBUG_AT( mkdgiff, " -> code %3u\n", glyph->unicode ); + + ret = load_image( glyph->file.c_str(), &descs[num_glyphs] ); + if (ret) + continue; + + info->unicode = glyph->unicode; + + info->width = descs[num_glyphs].width; + info->height = descs[num_glyphs].height; + + info->left = glyph->left; + info->top = glyph->top; + info->advance = glyph->advance; + + num_glyphs++; + + if (row->width > 0 && row->width + info->width > MAX_ROW_WIDTH) { + num_rows++; + row++; + } + + row->width += (info->width + align) & ~align; + + if (row->height < info->height) + row->height = info->height; + } + + for (i=0; i row %d, width %d, height %d\n", i, row->width, row->height ); + + total_height += row->height; + + row->pitch = (DFB_BYTES_PER_LINE( m_format, row->width ) + 7) & ~7; + + row_data[i] = D_CALLOC( row->height, row->pitch ); + + next_face += row->height * row->pitch; + } + + D_DEBUG_AT( mkdgiff, " -> %d glyphs, %d rows, total height %d\n", num_glyphs, num_rows, total_height ); + + next_face += num_glyphs * sizeof(DGIFFGlyphInfo); + next_face += num_rows * sizeof(DGIFFGlyphRow); + + for (i=0; i writing character 0x%x (%d)\n", glyph->unicode, i ); + + if (row_offset > 0 && row_offset + glyph->width > MAX_ROW_WIDTH) { + row_index++; + row_offset = 0; + } + + + D_DEBUG_AT( mkdgiff, " -> row offset %d\n", row_offset ); + + write_glyph( glyph, descs[i], + (char*) row_data[row_index] + DFB_BYTES_PER_LINE( m_format, row_offset ), + rows[row_index].pitch ); + + glyph->row = row_index; + glyph->offset = row_offset; + + row_offset += (glyph->width + align) & ~align; + } + + D_ASSERT( row_index == num_rows - 1 ); + + header.next_face = next_face; + header.size = face->size; + + header.ascender = face->ascender; + header.descender = face->descender; + header.height = face->height; + + header.max_advance = face->maxadvance; + + header.pixelformat = m_format; + + header.num_glyphs = num_glyphs; + header.num_rows = num_rows; + + header.blittingflags = face->blittingflags; + + D_DEBUG_AT( mkdgiff, " -> ascender %d, descender %d\n", header.ascender, header.descender ); + D_DEBUG_AT( mkdgiff, " -> height %d, max advance %d\n", header.height, header.max_advance ); + + fwrite( &header, sizeof(header), 1, stdout ); + + fwrite( glyphs, sizeof(*glyphs), num_glyphs, stdout ); + + for (i=0; ipitch, row->height, stdout ); + } + + for (i=0; idebug = true; + direct_config->debugmem = true; + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -1; + + + /* Open the file. */ + fd = open( filename, O_RDONLY ); + if (fd < 0) { + ret = errno2result( errno ); + D_PERROR( "Font/DGIFF: Failure during open() of '%s'!\n", filename ); + return ret; + } + + /* Query file size etc. */ + if (fstat( fd, &stat ) < 0) { + ret = errno2result( errno ); + D_PERROR( "Font/DGIFF: Failure during fstat() of '%s'!\n", filename ); + goto out; + } + + /* Memory map the file. */ + ptr = mmap( NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0 ); + if (ptr == MAP_FAILED) { + ret = errno2result( errno ); + D_PERROR( "Font/DGIFF: Failure during mmap() of '%s'!\n", filename ); + goto out; + } + + + get_entities( (const char*) ptr, stat.st_size, faces ); + + header.num_faces = faces.size(); + + + + fwrite( &header, sizeof(header), 1, stdout ); + + for (Entity::vector::const_iterator iter = faces.begin(); iter != faces.end(); iter++) { + const Face *face = dynamic_cast( *iter ); + + face->Dump(); + + ret = do_face( face ); + if (ret) + goto out; + } + + +out: + if (ptr != MAP_FAILED) + munmap( ptr, stat.st_size ); + + close( fd ); + + direct_print_memleaks(); + + direct_shutdown(); + + return ret; +} + diff --git a/Source/DirectFB/tools/mknames.sh b/Source/DirectFB/tools/mknames.sh new file mode 100755 index 0000000..8e4ca2f --- /dev/null +++ b/Source/DirectFB/tools/mknames.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +if test -z "$6"; then + echo "Usage: $0
" + echo "Example: $0 DFBSurfacePixelFormat DSPF UNKNOWN PixelFormat format directfb.h" + exit 1 +fi + +ENUM=$1 +PREFIX=$2 +NULL=$3 +NAME=$4 +VALUE=$5 +HEADER=$6 + + +cat << EOF + + +struct DFB${NAME}Name { + ${ENUM} ${VALUE}; + const char *name; +}; + +#define DirectFB${NAME}Names(Identifier) struct DFB${NAME}Name Identifier[] = { \\ +EOF + +egrep "^ +${PREFIX}_[0-9A-Za-z_]+[ ,]" $HEADER | grep -v ${PREFIX}_${NULL} | perl -p -e "s/^\\s*(${PREFIX}_)([\\w_]+)[ ,].*/ \\{ \\1\\2, \\\"\\2\\\" \\}, \\\\/" + +cat << EOF + { ${PREFIX}_${NULL}, "${NULL}" } \\ +}; +EOF diff --git a/Source/DirectFB/tools/raw15toraw24.c b/Source/DirectFB/tools/raw15toraw24.c new file mode 100755 index 0000000..56132de --- /dev/null +++ b/Source/DirectFB/tools/raw15toraw24.c @@ -0,0 +1,61 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +int main( void ) +{ + unsigned char byt; + unsigned short wrd; + + do { + fread (&wrd, 2, 1, stdin); + +#ifdef WORDS_BIGENDIAN + swab (&wrd, &wrd, 2); +#endif + + byt = (wrd & 0x7800) >> 7; + fwrite (&byt, 1, 1, stdout); + byt = (wrd & 0x03E0) >> 2; + fwrite (&byt, 1, 1, stdout); + byt = (wrd & 0x001F) << 3; + fwrite (&byt, 1, 1, stdout); + } while (!feof (stdin)); + + return 0; +} diff --git a/Source/DirectFB/tools/raw16toraw24.c b/Source/DirectFB/tools/raw16toraw24.c new file mode 100755 index 0000000..b9b89c4 --- /dev/null +++ b/Source/DirectFB/tools/raw16toraw24.c @@ -0,0 +1,61 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +int main( void ) +{ + unsigned char byt; + unsigned short wrd; + + do { + fread (&wrd, 2, 1, stdin); + +#ifdef WORDS_BIGENDIAN + swab (&wrd, &wrd, 2); +#endif + + byt = (wrd & 0xf800) >> 8; + fwrite (&byt, 1, 1, stdout); + byt = (wrd & 0x07E0) >> 3; + fwrite (&byt, 1, 1, stdout); + byt = (wrd & 0x001F) << 3; + fwrite (&byt, 1, 1, stdout); + } while (!feof (stdin)); + + return 0; +} diff --git a/Source/DirectFB/tools/raw32toraw24.c b/Source/DirectFB/tools/raw32toraw24.c new file mode 100755 index 0000000..df68fe1 --- /dev/null +++ b/Source/DirectFB/tools/raw32toraw24.c @@ -0,0 +1,63 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +#include "dfb_types.h" + +int main( void ) +{ + u8 byt; + u32 pixel32; + + do { + fread (&pixel32, 4, 1, stdin); + +#ifdef WORDS_BIGENDIAN + pixel32 = (pixel32 << 16) | (pixel32 >> 16); +#endif + + byt = (pixel32 & 0xff0000) >> 16; + fwrite (&byt, 1, 1, stdout); + byt = (pixel32 & 0x00ff00) >> 8; + fwrite (&byt, 1, 1, stdout); + byt = (pixel32 & 0x0000ff); + fwrite (&byt, 1, 1, stdout); + } while (!feof (stdin)); + + return 0; +} diff --git a/Source/DirectFB/tools/voodooplay.c b/Source/DirectFB/tools/voodooplay.c new file mode 100755 index 0000000..2d50ddf --- /dev/null +++ b/Source/DirectFB/tools/voodooplay.c @@ -0,0 +1,164 @@ +/* + (c) Copyright 2001-2010 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +static const char *m_name = NULL; +static bool m_run = false; +static const char *m_lookup = NULL; + +/**********************************************************************************************************************/ + +static DFBBoolean parse_command_line( int argc, char *argv[] ); + +/**********************************************************************************************************************/ + +static DirectEnumerationResult +player_callback( void *ctx, + const VoodooPlayInfo *info, + const VoodooPlayVersion *version, + const char *address, + unsigned int ms_since_last_seen ) +{ + D_INFO( "Voodoo/Play: <%4ums> [ %-30s ] %s%s (vendor: %s, model: %s)\n", + ms_since_last_seen, info->name, address, (info->flags & VPIF_LEVEL2) ? " *" : "", + info->vendor, info->model ); + + return DENUM_OK; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + int i; + VoodooPlayInfo info; + VoodooPlayer *player = NULL; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + if (m_name) { + direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH ); + } + + ret = voodoo_player_create( m_name ? &info : NULL, &player ); + if (ret) { + D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) ); + goto out; + } + + + do { + voodoo_player_broadcast( player ); + + usleep( 100000 ); + + voodoo_player_enumerate( player, player_callback, NULL ); + + if (m_lookup) { + for (i=1; i] [-r]\n", name ); + + return DFB_FALSE; +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int i; + + for (i=1; i, + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include + +static const char *m_name; +static bool m_launch_app; +static u8 m_launch_app_uuid[16]; +static u8 m_launch_player_uuid[16]; +static bool m_stop_instance; +static u8 m_stop_instance_uuid[16]; +static bool m_wait_instance; +static u8 m_wait_instance_uuid[16]; + +/**********************************************************************************************************************/ + +static DFBBoolean parse_command_line( int argc, char *argv[] ); + +/**********************************************************************************************************************/ + +static DirectEnumerationResult +player_callback( void *ctx, + const VoodooPlayInfo *info, + const VoodooPlayVersion *version, + const char *address, + unsigned int ms_since_last_seen ) +{ + DirectResult ret; + int i; + char buf[33]; + char buf2[33]; + char buf3[33]; + + snprintf( buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + info->uuid[0], info->uuid[1], info->uuid[2], info->uuid[3], info->uuid[4], + info->uuid[5], info->uuid[6], info->uuid[7], info->uuid[8], info->uuid[9], + info->uuid[10], info->uuid[11], info->uuid[12], info->uuid[13], info->uuid[14], + info->uuid[15] ); + + D_INFO( "Voodoo/Play: <%4ums> [ %-30s ] { %s } %s%s\n", + ms_since_last_seen, info->name, buf, address, (info->flags & VPIF_LEVEL2) ? " *" : "" ); + + DirectFBSetOption( "remote", address ); + + IVoodooPlayer *player; + + ret = VoodooPlayerCreate( &player ); + if (ret) { + D_DERROR( ret, "Voodoo/Play/Client: VoodooPlayerCreate() failed!\n" ); + return DENUM_OK; + } + + + + VoodooAppDescription apps[100]; + unsigned int num; + + ret = player->GetApps( player, 100, &num, apps ); + if (ret) { + D_DERROR( ret, "Voodoo/Play/Client: IVoodooPlayer::GetApps() failed!\n" ); + player->Release( player ); + return DENUM_OK; + } + + for (i=0; i launching on %s!\n", buf ); + + ret = player->LaunchApp( player, m_launch_app_uuid, m_launch_player_uuid, instance_uuid ); + if (ret) + D_DERROR( ret, "Voodoo/Play/Client: IVoodooPlayer::LaunchApp() failed!\n" ); + + snprintf( buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + instance_uuid[0], instance_uuid[1], instance_uuid[2], instance_uuid[3], instance_uuid[4], + instance_uuid[5], instance_uuid[6], instance_uuid[7], instance_uuid[8], instance_uuid[9], + instance_uuid[10], instance_uuid[11], instance_uuid[12], instance_uuid[13], instance_uuid[14], + instance_uuid[15] ); + + D_INFO( " => instance UUID is %s!\n", buf ); + } + } + + + + VoodooAppInstanceDescription instances[100]; + + ret = player->GetInstances( player, 100, &num, instances ); + if (ret) { + D_DERROR( ret, "Voodoo/Play/Client: IVoodooPlayer::GetInstances() failed!\n" ); + player->Release( player ); + return DENUM_OK; + } + + for (i=0; i stopping!\n" ); + + ret = player->StopInstance( player, m_stop_instance_uuid ); + if (ret) + D_DERROR( ret, "Voodoo/Play/Client: IVoodooPlayer::StopInstance() failed!\n" ); + } + + if (m_wait_instance && !memcmp( m_wait_instance_uuid, instances[i].uuid, 16 )) { + D_INFO( " -> waiting!\n" ); + + ret = player->WaitInstance( player, m_wait_instance_uuid ); + if (ret) + D_DERROR( ret, "Voodoo/Play/Client: IVoodooPlayer::WaitInstance() failed!\n" ); + } + } + + + player->Release( player ); + + return DENUM_OK; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + VoodooPlayInfo info; + VoodooPlayer *player = NULL; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + if (m_name) { + direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH ); + } + + ret = voodoo_player_create( m_name ? &info : NULL, &player ); + if (ret) { + D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) ); + goto out; + } + + + voodoo_player_broadcast( player ); + + sleep( 1 ); + + voodoo_player_enumerate( player, player_callback, NULL ); + + +out: + if (player) + voodoo_player_destroy( player ); + + return ret; +} + +/**********************************************************************************************************************/ + +static DFBBoolean +print_usage( const char *name ) +{ + fprintf( stderr, "Usage: %s [-n ] [-l app_uuid player_uuid] [-s instance_uuid] [-w instance_uuid]\n", name ); + + return DFB_FALSE; +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int i; + + for (i=1; i, + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define APPFILENAME "./application.lst" +#define LINE_LENGTH (255) +#define MAXAPPS (256) + +typedef struct +{ + char name[VOODOO_APP_DESCRIPTION_NAME_LENGTH]; + char exe[256]; + char arg[256]; +} AppInfo; + +static AppInfo appstable[MAXAPPS]; +static int nbapps = 0; +static const char *m_name = NULL; +static pid_t oldp=-1; + +/**********************************************************************************************************************/ + +static DFBBoolean parse_command_line( int argc, char *argv[] ); + +/**********************************************************************************************************************/ + +/* + * FIXME + */ +static void +generate_uuid( u8 *buf ) +{ + int i; + + for (i=0; i<16; i++) { + buf[i] = rand(); + } +} + +static void +player_exec( const char *prog, + const char *arg, + const char *addr ) +{ + char addr_arg[100]; + char argcopy[256]; // Total argument string < 256 chars + char * argv[64]; // Max 64 arguments! + int i,j; + int argsize; + + snprintf( addr_arg, sizeof(addr_arg), "--dfb:remote=%s", addr ); + + i = 0; + argv[i++] = (char*)prog; + argv[i++] = addr_arg; + j = 0; + strcpy(argcopy, arg); + argsize = strlen(arg); + while ( (arg[j]) && (i<64) && (jname, player_info->name, player_addr ); + + pid_t p = fork(); + + switch (p) { + case 0: + for (i=0; iname, appstable[i].name )) + { + if (oldp > 0) + { + kill( oldp, SIGKILL ); + } + oldp = p; + player_exec( appstable[i].exe, appstable[i].arg, player_addr ); + } + } + + D_BUG( "Invalid application" ); + exit(1); + + break; + + default: + D_INFO( "Child process has pid %d\n", p ); + *ret_data = (void*) p; + break; + } + + return DR_OK; +} + +static DirectResult +player_stop( VoodooPlayer *player, + void *ctx, + void *data ) +{ + pid_t p = (pid_t) data; + + D_INFO( "Received stop request for pid %d\n", p ); + + kill( p, SIGTERM ); + + sleep( 1 ); + + kill( p, SIGKILL ); + + return DR_OK; +} + +static void FindString( char **param, int size, char *result ) +{ + char *Cptr = NULL; + + Cptr = *param; + while( *Cptr == ' ' ) + { + Cptr++; + } + while( ( *Cptr != ';' ) && ( *Cptr != ':' ) && ( *Cptr != '\0' ) && ( *Cptr != '\n' ) && ( *Cptr != '\r' ) && (size>0) ) + { + *result = *Cptr; + result++; + Cptr++; + size--; + } + *result = '\0'; + Cptr++; + *param = Cptr; +} + + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + VoodooPlayInfo info = {0}; + VoodooPlayer *player = NULL; + FILE* fd = NULL; + char Line[ LINE_LENGTH ]; + char *Cptr; + + srand( direct_clock_get_abs_micros() ); + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + if (m_name) { + direct_snputs( info.name, m_name, VOODOO_PLAYER_NAME_LENGTH ); + } + + ret = voodoo_player_create( m_name ? &info : NULL, &player ); + if (ret) { + D_ERROR( "Voodoo/Play: Could not create the player (%s)!\n", DirectFBErrorString(ret) ); + goto out; + } + + voodoo_player_broadcast( player ); + + sleep( 2 ); + + + + if ( (fd = fopen( APPFILENAME, "r" )) ) + { + nbapps = 0; + while( (fgets( Line, LINE_LENGTH - 1, fd ) != NULL) && (nbapps < MAXAPPS) ) + { + Cptr = Line; + if( *Cptr != '#' ) // skip comment lines + { + FindString( &Cptr, VOODOO_APP_DESCRIPTION_NAME_LENGTH, appstable[nbapps].name ); + if ( !strlen(appstable[nbapps].name) ) continue; + FindString( &Cptr, 256, appstable[nbapps].exe ); + if ( !strlen(appstable[nbapps].exe) ) continue; + FindString( &Cptr, 256, appstable[nbapps].arg ); + printf("%s %s %s\n", appstable[nbapps].name, appstable[nbapps].exe, appstable[nbapps].arg); + generate_uuid( apps[nbapps].uuid ); + apps[nbapps].flags = VADESC_NAME; + direct_snputs( apps[nbapps].name, appstable[nbapps].name, VOODOO_APP_DESCRIPTION_NAME_LENGTH ); + nbapps++; + } + } + + fclose( fd ); + } + + voodoo_player_run_server( player, apps, nbapps, player_launch, player_stop, NULL ); + +out: + if (player) + voodoo_player_destroy( player ); + + return ret; +} + +/**********************************************************************************************************************/ + +static DFBBoolean +print_usage( const char *name ) +{ + fprintf( stderr, "Usage: %s [-n ] [-r]\n", name ); + + return DFB_FALSE; +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int i; + + for (i=1; i/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# 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/wm/default/Makefile.am b/Source/DirectFB/wm/default/Makefile.am new file mode 100755 index 0000000..dce61ab --- /dev/null +++ b/Source/DirectFB/wm/default/Makefile.am @@ -0,0 +1,33 @@ +## Makefile.am for DirectFB/wm/default + +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src + + +wmdir = $(MODULEDIR)/wm + +if BUILD_STATIC +wm_DATA = libdirectfbwm_default.o +endif + +wm_LTLIBRARIES = libdirectfbwm_default.la + + +libdirectfbwm_default_la_LDFLAGS = \ + -avoid-version \ + -module + +libdirectfbwm_default_la_SOURCES = \ + default.c + +libdirectfbwm_default_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +include $(top_srcdir)/rules/libobject.make diff --git a/Source/DirectFB/wm/default/Makefile.in b/Source/DirectFB/wm/default/Makefile.in new file mode 100755 index 0000000..38ddacf --- /dev/null +++ b/Source/DirectFB/wm/default/Makefile.in @@ -0,0 +1,595 @@ +# 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 = wm/default +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)$(wmdir)" "$(DESTDIR)$(wmdir)" +wmLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(wm_LTLIBRARIES) +libdirectfbwm_default_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfbwm_default_la_OBJECTS = default.lo +libdirectfbwm_default_la_OBJECTS = \ + $(am_libdirectfbwm_default_la_OBJECTS) +libdirectfbwm_default_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfbwm_default_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 = $(libdirectfbwm_default_la_SOURCES) +DIST_SOURCES = $(libdirectfbwm_default_la_SOURCES) +wmDATA_INSTALL = $(INSTALL_DATA) +DATA = $(wm_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_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src + +wmdir = $(MODULEDIR)/wm +@BUILD_STATIC_TRUE@wm_DATA = libdirectfbwm_default.o +wm_LTLIBRARIES = libdirectfbwm_default.la +libdirectfbwm_default_la_LDFLAGS = \ + -avoid-version \ + -module + +libdirectfbwm_default_la_SOURCES = \ + default.c + +libdirectfbwm_default_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.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 wm/default/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/default/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-wmLTLIBRARIES: $(wm_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + else :; fi; \ + done + +uninstall-wmLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(wmdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(wmdir)/$$p"; \ + done + +clean-wmLTLIBRARIES: + -test -z "$(wm_LTLIBRARIES)" || rm -f $(wm_LTLIBRARIES) + @list='$(wm_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 +libdirectfbwm_default.la: $(libdirectfbwm_default_la_OBJECTS) $(libdirectfbwm_default_la_DEPENDENCIES) + $(libdirectfbwm_default_la_LINK) -rpath $(wmdir) $(libdirectfbwm_default_la_OBJECTS) $(libdirectfbwm_default_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default.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-wmDATA: $(wm_DATA) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(wmDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(wmDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + done + +uninstall-wmDATA: + @$(NORMAL_UNINSTALL) + @list='$(wm_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(wmdir)/$$f'"; \ + rm -f "$(DESTDIR)$(wmdir)/$$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)$(wmdir)" "$(DESTDIR)$(wmdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-wmLTLIBRARIES \ + 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-wmDATA install-wmLTLIBRARIES + +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-wmDATA uninstall-wmLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-wmLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip install-wmDATA install-wmLTLIBRARIES \ + 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-wmDATA \ + uninstall-wmLTLIBRARIES + +%.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/wm/default/default.c b/Source/DirectFB/wm/default/default.c new file mode 100755 index 0000000..2049c2d --- /dev/null +++ b/Source/DirectFB/wm/default/default.c @@ -0,0 +1,4073 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + + +D_DEBUG_DOMAIN( WM_Default, "WM/Default", "Default window manager module" ); + + +DFB_WINDOW_MANAGER( default ) + + +typedef struct { + DirectLink link; + + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceModifierMask modifiers; + + CoreWindow *owner; +} GrabbedKey; + +/**************************************************************************************************/ + +#define MAX_KEYS 16 +#define MAX_UPDATE_REGIONS 8 + +typedef struct { + CoreDFB *core; +} WMData; + +typedef struct { + int magic; + + CoreWindowStack *stack; + + DFBUpdates updates; + DFBRegion update_regions[MAX_UPDATE_REGIONS]; + + DFBInputDeviceButtonMask buttons; + DFBInputDeviceModifierMask modifiers; + DFBInputDeviceLockState locks; + + bool active; + + int wm_level; + int wm_cycle; + + FusionVector windows; + + CoreWindow *pointer_window; /* window grabbing the pointer */ + CoreWindow *keyboard_window; /* window grabbing the keyboard */ + CoreWindow *focused_window; /* window having the focus */ + CoreWindow *entered_window; /* window under the pointer */ + CoreWindow *unselkeys_window; /* window grabbing unselected keys */ + + DirectLink *grabbed_keys; /* List of currently grabbed keys. */ + + struct { + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceKeyIdentifier id; + int code; + CoreWindow *owner; + } keys[MAX_KEYS]; + + CoreSurface *cursor_bs; /* backing store for region under cursor */ + bool cursor_bs_valid; + DFBRegion cursor_region; + bool cursor_drawn; + + int cursor_dx; + int cursor_dy; +} StackData; + +typedef struct { + int magic; + + CoreWindow *window; + + StackData *stack_data; + + int priority; /* derived from stacking class */ + + CoreLayerRegionConfig config; +} WindowData; + +/**************************************************************************************************/ + +static DFBResult +restack_window( CoreWindow *window, + WindowData *window_data, + CoreWindow *relative, + WindowData *relative_data, + int relation, + DFBWindowStackingClass stacking ); + +static DFBResult +update_window( CoreWindow *window, + WindowData *window_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool force_complete, + bool force_invisible, + bool scale_region ); + +/**************************************************************************************************/ + +static int keys_compare( const void *key1, + const void *key2 ) +{ + return *(const DFBInputDeviceKeySymbol*) key1 - *(const DFBInputDeviceKeySymbol*) key2; +} + +/**************************************************************************************************/ + +static inline void +transform_point_in_window( CoreWindow *window, + int *x, + int *y ) +{ + int _x = *x, _y = *y; + + switch (window->config.rotation) { + default: + D_BUG( "invalid rotation %d", window->config.rotation ); + case 0: + break; + + case 90: + *x = window->config.bounds.w - _y - 1; + *y = _x; + break; + + case 180: + *x = window->config.bounds.w - _x - 1; + *y = window->config.bounds.h - _y - 1; + break; + + case 270: + *x = _y; + *y = window->config.bounds.h - _x - 1; + break; + } +} + +static void +post_event( CoreWindow *window, + StackData *data, + DFBWindowEvent *event ) +{ + D_ASSERT( window != NULL ); + D_ASSERT( window->stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + + event->buttons = data->buttons; + event->modifiers = data->modifiers; + event->locks = data->locks; + + dfb_window_post_event( window, event ); +} + +static void +send_key_event( CoreWindow *window, + StackData *data, + const DFBInputEvent *event ) +{ + DFBWindowEvent we; + + D_ASSERT( window != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + + we.type = (event->type == DIET_KEYPRESS) ? DWET_KEYDOWN : DWET_KEYUP; + we.key_code = event->key_code; + we.key_id = event->key_id; + we.key_symbol = event->key_symbol; + + post_event( window, data, &we ); +} + +static void +send_button_event( CoreWindow *window, + StackData *data, + const DFBInputEvent *event ) +{ + DFBWindowEvent we; + + D_ASSERT( window != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + + we.type = (event->type == DIET_BUTTONPRESS) ? DWET_BUTTONDOWN : DWET_BUTTONUP; + we.x = window->stack->cursor.x - window->config.bounds.x; + we.y = window->stack->cursor.y - window->config.bounds.y; + we.button = (data->wm_level & 2) ? (event->button + 2) : event->button; + + transform_point_in_window( window, &we.x, &we.y ); + + post_event( window, data, &we ); +} + +/**************************************************************************************************/ + +static inline void +transform_window_to_stack( CoreWindow *window, + const DFBRectangle *rect, + DFBRectangle *ret_rect ) +{ + DFB_RECTANGLE_ASSERT( rect ); + + ret_rect->x = rect->x; + ret_rect->y = rect->y; + + switch (window->config.rotation) { + default: + D_BUG( "invalid rotation %d", window->config.rotation ); + case 0: + case 180: + ret_rect->w = rect->w; + ret_rect->h = rect->h; + break; + + case 90: + case 270: + ret_rect->w = rect->h; + ret_rect->h = rect->w; + break; + } +} + +static inline int +get_priority( const CoreWindow *window ) +{ + D_ASSERT( window != NULL ); + + switch (window->config.stacking) { + case DWSC_UPPER: + return 1; + + case DWSC_MIDDLE: + return 0; + + case DWSC_LOWER: + return -1; + + default: + D_BUG( "unknown stacking class" ); + break; + } + + return 0; +} + +static inline int +get_index( const StackData *data, + const CoreWindow *window ) +{ + D_ASSERT( data != NULL ); + D_ASSERT( window != NULL ); + + D_ASSERT( fusion_vector_contains( &data->windows, window ) ); + + return fusion_vector_index_of( &data->windows, window ); +} + +static CoreWindow * +get_keyboard_window( CoreWindowStack *stack, + StackData *data, + const DFBInputEvent *event ) +{ + DirectLink *l; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_KEYPRESS || event->type == DIET_KEYRELEASE ); + + /* Check explicit key grabs first. */ + direct_list_foreach (l, data->grabbed_keys) { + GrabbedKey *key = (GrabbedKey*) l; + + if (key->symbol == event->key_symbol && + key->modifiers == data->modifiers) + return key->owner; + } + + /* Don't do implicit grabs on keys without a hardware index. */ + if (event->key_code == -1) + return (data->keyboard_window ? + data->keyboard_window : data->focused_window); + + /* Implicitly grab (press) or ungrab (release) key. */ + if (event->type == DIET_KEYPRESS) { + int i; + int free_key = -1; + CoreWindow *window; + + /* Check active grabs. */ + for (i=0; ikeys[i].code == event->key_code) + return data->keys[i].owner; + + /* Remember first free array item. */ + if (free_key == -1 && data->keys[i].code == -1) + free_key = i; + } + + /* Key is not grabbed, check for explicit keyboard grab or focus. */ + window = data->keyboard_window ? + data->keyboard_window : data->focused_window; + if (!window) + return NULL; + + /* Check key selection. */ + switch (window->config.key_selection) { + case DWKS_ALL: + break; + + case DWKS_LIST: + D_ASSERT( window->config.keys != NULL ); + D_ASSERT( window->config.num_keys > 0 ); + + if (bsearch( &event->key_symbol, + window->config.keys, window->config.num_keys, + sizeof(DFBInputDeviceKeySymbol), keys_compare )) + break; + + /* fall through */ + + case DWKS_NONE: + return data->unselkeys_window; + } + + /* Check if a free array item was found. */ + if (free_key == -1) { + D_WARN( "maximum number of owned keys reached" ); + return NULL; + } + + /* Implicitly grab the key. */ + data->keys[free_key].symbol = event->key_symbol; + data->keys[free_key].id = event->key_id; + data->keys[free_key].code = event->key_code; + data->keys[free_key].owner = window; + + return window; + } + else { + int i; + + /* Lookup owner and ungrab the key. */ + for (i=0; ikeys[i].code == event->key_code) { + data->keys[i].code = -1; + + /* Return owner (NULL if destroyed). */ + return data->keys[i].owner; + } + } + } + + /* No owner for release event found, discard it. */ + return NULL; +} + +static CoreWindow* +window_at_pointer( CoreWindowStack *stack, + StackData *data, + WMData *wmdata, + int x, + int y ) +{ + int i; + CoreWindow *window; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + + if (!stack->cursor.enabled) { + fusion_vector_foreach_reverse (window, i, data->windows) + if (window->config.opacity && !(window->config.options & DWOP_GHOST)) + return window; + + return NULL; + } + + if (x < 0) + x = stack->cursor.x; + if (y < 0) + y = stack->cursor.y; + + fusion_vector_foreach_reverse (window, i, data->windows) { + CoreWindowConfig *config = &window->config; + DFBWindowOptions options = config->options; + DFBRectangle rotated; + DFBRectangle *bounds = &rotated; + + transform_window_to_stack( window, &config->bounds, &rotated ); + + if (!(options & DWOP_GHOST) && config->opacity && + x >= bounds->x && x < bounds->x + bounds->w && + y >= bounds->y && y < bounds->y + bounds->h) + { + int wx = x - bounds->x; + int wy = y - bounds->y; + + if ( !(options & DWOP_SHAPED) || + !(options &(DWOP_ALPHACHANNEL|DWOP_COLORKEYING)) + || !window->surface || + ((options & DWOP_OPAQUE_REGION) && + (wx >= config->opaque.x1 && wx <= config->opaque.x2 && + wy >= config->opaque.y1 && wy <= config->opaque.y2))) + { + return window; + } + else { + u8 buf[8]; + CoreSurface *surface = window->surface; + DFBSurfacePixelFormat format = surface->config.format; + DFBRectangle rect = { wx, wy, 1, 1 }; + + if (dfb_surface_read_buffer( surface, CSBR_FRONT, buf, 8, &rect ) == DFB_OK) { + if (options & DWOP_ALPHACHANNEL) { + int alpha = -1; + + D_ASSERT( DFB_PIXELFORMAT_HAS_ALPHA( format ) ); + + switch (format) { + case DSPF_AiRGB: + alpha = 0xff - (*(u32*)(buf) >> 24); + break; + case DSPF_ARGB: + case DSPF_AYUV: + alpha = *(u32*)(buf) >> 24; + break; + case DSPF_ARGB1555: + case DSPF_ARGB2554: + case DSPF_ARGB4444: + alpha = *(u16*)(buf) & 0x8000; + alpha = alpha ? 0xff : 0x00; + break; + case DSPF_RGBA4444: + alpha = *(u16*)(buf) & 0x0008; + alpha = alpha ? 0xff : 0x00; + break; + case DSPF_ALUT44: + alpha = *(u8*)(buf) & 0xf0; + alpha |= alpha >> 4; + break; + case DSPF_LUT2: + case DSPF_LUT8: { + CorePalette *palette = surface->palette; + u8 pix = *((u8*) buf); + + if (palette && pix < palette->num_entries) { + alpha = palette->entries[pix].a; + break; + } + + + /* fall through */ + } + + default: + D_ONCE( "unknown format 0x%x", surface->config.format ); + break; + } + + if (alpha) /* alpha == -1 on error */ + return window; + } + if (options & DWOP_COLORKEYING) { + int pixel = 0; + u8 *p; + switch (format) { + case DSPF_ARGB: + case DSPF_AiRGB: + case DSPF_RGB32: + pixel = *(u32*)(buf) & 0x00ffffff; + break; + + case DSPF_RGB24: + p = (buf); +#ifdef WORDS_BIGENDIAN + pixel = (p[0] << 16) | (p[1] << 8) | p[2]; +#else + pixel = (p[2] << 16) | (p[1] << 8) | p[0]; +#endif + break; + + case DSPF_RGB16: + pixel = *(u16*)(buf); + break; + + case DSPF_ARGB4444: + case DSPF_RGB444: + pixel = *(u16*)(buf) + & 0x0fff; + break; + + case DSPF_RGBA4444: + pixel = *(u16*)(buf) + & 0xfff0; + break; + + case DSPF_ARGB1555: + case DSPF_RGB555: + case DSPF_BGR555: + pixel = *(u16*)(buf) + & 0x7fff; + break; + + case DSPF_RGB332: + case DSPF_LUT8: + pixel = *(u8*)(buf); + break; + + case DSPF_ALUT44: + pixel = *(u8*)(buf) + & 0x0f; + break; + + default: + D_ONCE( "unknown format 0x%x", surface->config.format ); + break; + } + + if (pixel != config->color_key) + return window; + } + } + } + } + } + + return NULL; +} + +static void +switch_focus( CoreWindowStack *stack, + StackData *data, + CoreWindow *to ) +{ + DFBWindowEvent evt; + CoreWindow *from; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + + from = data->focused_window; + + if (from == to) + return; + + if (to && to->caps & DWCAPS_NOFOCUS) + return; + + if (from) { + evt.type = DWET_LOSTFOCUS; + + post_event( from, data, &evt ); + } + + if (to) { + if (to->surface && to->surface->palette && !stack->hw_mode) { + CoreSurface *surface; + + D_ASSERT( to->primary_region != NULL ); + + if (dfb_layer_region_get_surface( to->primary_region, &surface ) == DFB_OK) { + if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format )) + dfb_surface_set_palette( surface, to->surface->palette ); + + dfb_surface_unref( surface ); + } + } + + evt.type = DWET_GOTFOCUS; + + post_event( to, data, &evt ); + } + + data->focused_window = to; +} + +static bool +update_focus( CoreWindowStack *stack, + StackData *data, + WMData *wmdata ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + + /* if pointer is not grabbed */ + if (!data->pointer_window) { + CoreWindow *before = data->entered_window; + CoreWindow *after = window_at_pointer( stack, data, wmdata, -1, -1 ); + + /* and the window under the cursor is another one now */ + if (before != after) { + DFBWindowEvent we; + + /* send leave event */ + if (before) { + we.type = DWET_LEAVE; + we.x = stack->cursor.x - before->config.bounds.x; + we.y = stack->cursor.y - before->config.bounds.y; + + transform_point_in_window( before, &we.x, &we.y ); + + post_event( before, data, &we ); + } + + /* switch focus and send enter event */ + switch_focus( stack, data, after ); + + if (after) { + we.type = DWET_ENTER; + we.x = stack->cursor.x - after->config.bounds.x; + we.y = stack->cursor.y - after->config.bounds.y; + + transform_point_in_window( after, &we.x, &we.y ); + + post_event( after, data, &we ); + } + + /* update pointer to window under the cursor */ + data->entered_window = after; + + return true; + } + } + + return false; +} + +static void +ensure_focus( CoreWindowStack *stack, + StackData *data ) +{ + int i; + CoreWindow *window; + + if (data->focused_window) + return; + + fusion_vector_foreach_reverse (window, i, data->windows) { + if (window->config.opacity && !(window->config.options & DWOP_GHOST)) { + switch_focus( stack, data, window ); + break; + } + } +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static inline void +transform_stack_to_dest( CoreWindowStack *stack, + const DFBRegion *region, + DFBRegion *ret_dest ) +{ + DFBDimension size = { stack->width, stack->height }; + + DFB_REGION_ASSERT( region ); + + dfb_region_from_rotated( ret_dest, region, &size, stack->rotation ); +} + +static void +draw_cursor( CoreWindowStack *stack, StackData *data, CardState *state, const DFBRegion *region ) +{ + DFBRectangle src; + DFBRegion dest; + DFBSurfaceBlittingFlags flags = DSBLIT_BLEND_ALPHACHANNEL; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( data, StackData ); + D_MAGIC_ASSERT( state, CardState ); + DFB_REGION_ASSERT( region ); + + D_ASSUME( stack->cursor.opacity > 0 ); + + /* Initialize destination region. */ + transform_stack_to_dest( stack, region, &dest ); + + /* Initialize source rectangle. */ + src.x = region->x1 - stack->cursor.x + stack->cursor.hot.x; + src.y = region->y1 - stack->cursor.y + stack->cursor.hot.y; + src.w = region->x2 - region->x1 + 1; + src.h = region->y2 - region->y1 + 1; + + /* Use global alpha blending. */ + if (stack->cursor.opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != stack->cursor.opacity) { + state->color.a = stack->cursor.opacity; + state->modified |= SMF_COLOR; + } + } + + /* Different compositing methods depending on destination format. */ + if (flags & DSBLIT_BLEND_ALPHACHANNEL) { + if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->config.format )) { + /* + * Always use compliant Porter/Duff SRC_OVER, + * if the destination has an alpha channel. + * + * Cd = destination color (non-premultiplied) + * Ad = destination alpha + * + * Cs = source color (non-premultiplied) + * As = source alpha + * + * Ac = color alpha + * + * cd = Cd * Ad (premultiply destination) + * cs = Cs * As (premultiply source) + * + * The full equation to calculate resulting color and alpha (premultiplied): + * + * cx = cd * (1-As*Ac) + cs * Ac + * ax = Ad * (1-As*Ac) + As * Ac + */ + dfb_state_set_src_blend( state, DSBF_ONE ); + + /* Need to premultiply source with As*Ac or only with Ac? */ + if (! (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED)) + flags |= DSBLIT_SRC_PREMULTIPLY; + else if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + /* Need to premultiply/demultiply destination? */ +// if (! (state->destination->caps & DSCAPS_PREMULTIPLIED)) +// flags |= DSBLIT_DST_PREMULTIPLY | DSBLIT_DEMULTIPLY; + } + else { + /* + * We can avoid DSBLIT_SRC_PREMULTIPLY for destinations without an alpha channel + * by using another blending function, which is more likely that it's accelerated + * than premultiplication at this point in time. + * + * This way the resulting alpha (ax) doesn't comply with SRC_OVER, + * but as the destination doesn't have an alpha channel it's no problem. + * + * As the destination's alpha value is always 1.0 there's no need for + * premultiplication. The resulting alpha value will also be 1.0 without + * exceptions, therefore no need for demultiplication. + * + * cx = Cd * (1-As*Ac) + Cs*As * Ac (still same effect as above) + * ax = Ad * (1-As*Ac) + As*As * Ac (wrong, but discarded anyways) + */ + if (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED) { + /* Need to premultiply source with Ac? */ + if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + dfb_state_set_src_blend( state, DSBF_ONE ); + } + else + dfb_state_set_src_blend( state, DSBF_SRCALPHA ); + } + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags | stack->rotated_blit ); + + /* Set blitting source. */ + state->source = stack->cursor.surface; + state->modified |= SMF_SOURCE; + + /* Blit from the window to the region being updated. */ + dfb_gfxcard_blit( &src, dest.x1, dest.y1, state ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +static void +draw_window( CoreWindow *window, CardState *state, + const DFBRegion *region, bool alpha_channel ) +{ + DFBRegion dest; + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + CoreWindowStack *stack; + CoreWindowConfig *config; + CoreSurface *surface; + int rotation; + + D_ASSERT( window != NULL ); + D_MAGIC_ASSERT( state, CardState ); + DFB_REGION_ASSERT( region ); + + stack = window->stack; + D_MAGIC_ASSERT( stack, CoreWindowStack ); + + surface = window->surface; + D_MAGIC_ASSERT( surface, CoreSurface ); + + config = &window->config; + + /* Initialize destination region. */ + transform_stack_to_dest( stack, region, &dest ); + + /* Use per pixel alpha blending. */ + if (alpha_channel && (config->options & DWOP_ALPHACHANNEL)) + flags |= DSBLIT_BLEND_ALPHACHANNEL; + + /* Use global alpha blending. */ + if (config->opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != config->opacity) { + state->color.a = config->opacity; + state->modified |= SMF_COLOR; + } + } + + /* Use source color keying. */ + if (config->options & DWOP_COLORKEYING) { + flags |= DSBLIT_SRC_COLORKEY; + + /* Set window color key. */ + dfb_state_set_src_colorkey( state, config->color_key ); + } + + /* Use automatic deinterlacing. */ + if (surface->config.caps & DSCAPS_INTERLACED) + flags |= DSBLIT_DEINTERLACE; + + /* Different compositing methods depending on destination format. */ + if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) { + if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->config.format )) { + /* + * Always use compliant Porter/Duff SRC_OVER, + * if the destination has an alpha channel. + * + * Cd = destination color (non-premultiplied) + * Ad = destination alpha + * + * Cs = source color (non-premultiplied) + * As = source alpha + * + * Ac = color alpha + * + * cd = Cd * Ad (premultiply destination) + * cs = Cs * As (premultiply source) + * + * The full equation to calculate resulting color and alpha (premultiplied): + * + * cx = cd * (1-As*Ac) + cs * Ac + * ax = Ad * (1-As*Ac) + As * Ac + */ + dfb_state_set_src_blend( state, DSBF_ONE ); + + /* Need to premultiply source with As*Ac or only with Ac? */ + if (! (surface->config.caps & DSCAPS_PREMULTIPLIED)) + flags |= DSBLIT_SRC_PREMULTIPLY; + else if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + /* Need to premultiply/demultiply destination? */ +// if (! (state->destination->caps & DSCAPS_PREMULTIPLIED)) +// flags |= DSBLIT_DST_PREMULTIPLY | DSBLIT_DEMULTIPLY; + } + else { + /* + * We can avoid DSBLIT_SRC_PREMULTIPLY for destinations without an alpha channel + * by using another blending function, which is more likely that it's accelerated + * than premultiplication at this point in time. + * + * This way the resulting alpha (ax) doesn't comply with SRC_OVER, + * but as the destination doesn't have an alpha channel it's no problem. + * + * As the destination's alpha value is always 1.0 there's no need for + * premultiplication. The resulting alpha value will also be 1.0 without + * exceptions, therefore no need for demultiplication. + * + * cx = Cd * (1-As*Ac) + Cs*As * Ac (still same effect as above) + * ax = Ad * (1-As*Ac) + As*As * Ac (wrong, but discarded anyways) + */ + if (surface->config.caps & DSCAPS_PREMULTIPLIED) { + /* Need to premultiply source with Ac? */ + if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + dfb_state_set_src_blend( state, DSBF_ONE ); + } + else + dfb_state_set_src_blend( state, DSBF_SRCALPHA ); + } + } + + rotation = (window->config.rotation + stack->rotation) % 360; + switch (rotation) { + default: + D_BUG( "invalid rotation %d", rotation ); + case 0: + break; + + case 90: + flags |= DSBLIT_ROTATE90; + break; + + case 180: + flags |= DSBLIT_ROTATE180; + break; + + case 270: + flags |= DSBLIT_ROTATE270; + break; + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = surface; + state->modified |= SMF_SOURCE; + + if (window->config.options & DWOP_SCALE) { + DFBDimension size = { stack->width, stack->height }; + DFBRegion clip = state->clip; + DFBRectangle src = { 0, 0, surface->config.size.w, surface->config.size.h }; + DFBRectangle dst; + DFBRectangle bounds; + + transform_window_to_stack( window, &window->config.bounds, &bounds ); + + dfb_rectangle_from_rotated( &dst, &bounds, &size, stack->rotation ); + + /* Change clipping region. */ + dfb_state_set_clip( state, &dest ); + + /* Scale window to the screen clipped by the region being updated. */ + dfb_gfxcard_stretchblit( &src, &dst, state ); + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + } + else { + DFBDimension size = { config->bounds.w, config->bounds.h }; + DFBRectangle rect, src; + + D_ASSERT( surface->config.size.w == config->bounds.w ); + D_ASSERT( surface->config.size.h == config->bounds.h ); + + /* Initialize source rectangle. */ + dfb_rectangle_from_region( &rect, region ); + + /* Subtract window offset. */ + rect.x -= config->bounds.x; + rect.y -= config->bounds.y; + + /* Rotate back to window surface. */ + if (window->config.rotation == 90 || window->config.rotation == 270) + D_UTIL_SWAP( size.w, size.h ); + + dfb_rectangle_from_rotated( &src, &rect, &size, (360 - window->config.rotation) % 360 ); + + /* Blit from the window to the region being updated. */ + dfb_gfxcard_blit( &src, dest.x1, dest.y1, state ); + } + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +static void +draw_background( CoreWindowStack *stack, CardState *state, const DFBRegion *region ) +{ + DFBRegion dest; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( state, CardState ); + DFB_REGION_ASSERT( region ); + + D_ASSERT( stack->bg.image != NULL || (stack->bg.mode != DLBM_IMAGE && + stack->bg.mode != DLBM_TILE) ); + + /* Initialize destination region. */ + transform_stack_to_dest( stack, region, &dest ); + + if (!dfb_region_intersect( &dest, 0, 0, + state->destination->config.size.w - 1, state->destination->config.size.h - 1 )) + return; + + switch (stack->bg.mode) { + case DLBM_COLOR: { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &dest ); + CoreSurface *dst = state->destination; + DFBColor *color = &stack->bg.color; + + D_MAGIC_ASSERT( dst, CoreSurface ); + + /* Set the background color. */ + if (DFB_PIXELFORMAT_IS_INDEXED( dst->config.format )) + dfb_state_set_color_index( state, /* FIXME: don't search every time */ + dfb_palette_search( dst->palette, color->r, + color->g, color->b, color->a ) ); + else + dfb_state_set_color( state, color ); + + /* Simply fill the background. */ + dfb_gfxcard_fillrectangles( &rect, 1, state ); + break; + } + + case DLBM_IMAGE: { + CoreSurface *bg = stack->bg.image; + DFBRegion clip = state->clip; + DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h }; + DFBRectangle dst = { 0, 0, stack->rotated_width, stack->rotated_height }; + + D_MAGIC_ASSERT( bg, CoreSurface ); + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, stack->rotated_blit ); + + /* Set clipping region. */ + dfb_state_set_clip( state, &dest ); + + /* Blit background image. */ + dfb_gfxcard_stretchblit( &src, &dst, state ); + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_TILE: { + CoreSurface *bg = stack->bg.image; + DFBRegion clip = state->clip; + DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h }; + + D_MAGIC_ASSERT( bg, CoreSurface ); + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, stack->rotated_blit ); + + /* Change clipping region. */ + dfb_state_set_clip( state, &dest ); + + /* Tiled blit (aligned). */ + dfb_gfxcard_tileblit( &src, + (region->x1 / src.w) * src.w, + (region->y1 / src.h) * src.h, + (region->x2 / src.w + 1) * src.w, + (region->y2 / src.h + 1) * src.h, + state ); + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_DONTCARE: + break; + + default: + D_BUG( "unknown background mode" ); + break; + } +} + +static void +update_region( CoreWindowStack *stack, + StackData *data, + CardState *state, + int start, + int x1, + int y1, + int x2, + int y2 ) +{ + int i = start; + DFBRegion region = { x1, y1, x2, y2 }; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_MAGIC_ASSERT( state, CardState ); + D_ASSERT( start < fusion_vector_size( &data->windows ) ); + D_ASSERT( x1 <= x2 ); + D_ASSERT( y1 <= y2 ); + + /* Find next intersecting window. */ + while (i >= 0) { + CoreWindow *window = fusion_vector_at( &data->windows, i ); + + if (VISIBLE_WINDOW( window )) { + DFBRectangle rotated; + + transform_window_to_stack( window, &window->config.bounds, &rotated ); + + if (dfb_region_intersect( ®ion, + DFB_REGION_VALS_FROM_RECTANGLE( &rotated ))) + break; + } + + i--; + } + + /* Intersecting window found? */ + if (i >= 0) { + CoreWindow *window = fusion_vector_at( &data->windows, i ); + CoreWindowConfig *config = &window->config; + + if (D_FLAGS_ARE_SET( config->options, DWOP_ALPHACHANNEL | DWOP_OPAQUE_REGION )) { + DFBRegion opaque = DFB_REGION_INIT_TRANSLATED( &config->opaque, + config->bounds.x, + config->bounds.y ); + + if (!dfb_region_region_intersect( &opaque, ®ion )) { + update_region( stack, data, state, i-1, x1, y1, x2, y2 ); + + draw_window( window, state, ®ion, true ); + } + else { + if ((config->opacity < 0xff) || (config->options & DWOP_COLORKEYING)) { + /* draw everything below */ + update_region( stack, data, state, i-1, x1, y1, x2, y2 ); + } + else { + /* left */ + if (opaque.x1 != x1) + update_region( stack, data, state, i-1, x1, opaque.y1, opaque.x1-1, opaque.y2 ); + + /* upper */ + if (opaque.y1 != y1) + update_region( stack, data, state, i-1, x1, y1, x2, opaque.y1-1 ); + + /* right */ + if (opaque.x2 != x2) + update_region( stack, data, state, i-1, opaque.x2+1, opaque.y1, x2, opaque.y2 ); + + /* lower */ + if (opaque.y2 != y2) + update_region( stack, data, state, i-1, x1, opaque.y2+1, x2, y2 ); + } + + /* left */ + if (opaque.x1 != region.x1) { + DFBRegion r = { region.x1, opaque.y1, opaque.x1 - 1, opaque.y2 }; + draw_window( window, state, &r, true ); + } + + /* upper */ + if (opaque.y1 != region.y1) { + DFBRegion r = { region.x1, region.y1, region.x2, opaque.y1 - 1 }; + draw_window( window, state, &r, true ); + } + + /* right */ + if (opaque.x2 != region.x2) { + DFBRegion r = { opaque.x2 + 1, opaque.y1, region.x2, opaque.y2 }; + draw_window( window, state, &r, true ); + } + + /* lower */ + if (opaque.y2 != region.y2) { + DFBRegion r = { region.x1, opaque.y2 + 1, region.x2, region.y2 }; + draw_window( window, state, &r, true ); + } + + /* inner */ + draw_window( window, state, &opaque, false ); + } + } + else { + if (TRANSLUCENT_WINDOW( window )) { + /* draw everything below */ + update_region( stack, data, state, i-1, x1, y1, x2, y2 ); + } + else { + /* left */ + if (region.x1 != x1) + update_region( stack, data, state, i-1, x1, region.y1, region.x1-1, region.y2 ); + + /* upper */ + if (region.y1 != y1) + update_region( stack, data, state, i-1, x1, y1, x2, region.y1-1 ); + + /* right */ + if (region.x2 != x2) + update_region( stack, data, state, i-1, region.x2+1, region.y1, x2, region.y2 ); + + /* lower */ + if (region.y2 != y2) + update_region( stack, data, state, i-1, x1, region.y2+1, x2, y2 ); + } + + draw_window( window, state, ®ion, true ); + } + } + else + draw_background( stack, state, ®ion ); +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static void +repaint_stack( CoreWindowStack *stack, + StackData *data, + CoreLayerRegion *region, + const DFBRegion *updates, + int num_updates, + DFBSurfaceFlipFlags flags ) +{ + int i; + CoreLayer *layer; + CardState *state; + CoreSurface *surface; + DFBRegion flips[num_updates]; + int num_flips = 0; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->context != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( region != NULL ); + D_ASSERT( num_updates > 0 ); + + layer = dfb_layer_at( stack->context->layer_id ); + state = &layer->state; + surface = region->surface; + + if (!data->active || !surface) + return; + + D_DEBUG_AT( WM_Default, "repaint_stack( %d region(s), flags %x )\n", num_updates, flags ); + + /* Set destination. */ + state->destination = surface; + state->modified |= SMF_DESTINATION; + + for (i=0; i %d, %d - %dx%d (%d)\n", + DFB_RECTANGLE_VALS_FROM_REGION( update ), i ); + + transform_stack_to_dest( stack, update, &dest ); + + if (!dfb_region_intersect( &dest, 0, 0, surface->config.size.w - 1, surface->config.size.h - 1 )) + continue; + + /* Set clipping region. */ + dfb_state_set_clip( state, &dest ); + + /* Compose updated region. */ + update_region( stack, data, state, + fusion_vector_size( &data->windows ) - 1, + DFB_REGION_VALS( update ) ); + + flips[num_flips++] = dest; + + /* Update cursor? */ + if (data->cursor_drawn) { + DFBRegion cursor_rotated; + + D_ASSUME( data->cursor_bs_valid ); + + transform_stack_to_dest( stack, &data->cursor_region, &cursor_rotated ); + + if (dfb_region_region_intersect( &dest, &cursor_rotated )) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &dest ); + + dfb_gfx_copy_to( surface, data->cursor_bs, &rect, + rect.x - cursor_rotated.x1, + rect.y - cursor_rotated.y1, true ); + + draw_cursor( stack, data, state, &data->cursor_region ); + } + } + } + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + /* Software cursor code relies on a valid back buffer. */ + if (stack->cursor.enabled) + flags |= DSFLIP_BLIT; + + for (i=0; icontext; + D_ASSERT( context != NULL ); + + if (!data->updates.num_regions) + return DFB_OK; + + /* Get the primary region. */ + if (!region) { + ret = dfb_layer_context_get_primary_region( stack->context, false, &primary ); + if (ret) + return ret; + } + + + dfb_updates_stat( &data->updates, &total, &bounding ); + + n = data->updates.max_regions - data->updates.num_regions + 1; + d = n + 1; + + /* FIXME: depend on buffer mode, hw accel etc. */ + if (total > stack->width * stack->height * 9 / 10) { + DFBRegion region = { 0, 0, stack->width - 1, stack->height - 1 }; + +// direct_log_printf( NULL, "%s() <- %d regions, total %d, bounding %d (%d/%d: %d), FULL UPDATE\n", +// __FUNCTION__, data->updates.num_regions, total, bounding, n, d, bounding*n/d ); + +// if (context->config.buffermode == DLBM_FRONTONLY) +// dfb_region_transpose(®ion, context->rotation); + + repaint_stack( stack, data, primary, ®ion, 1, flags ); + } + else if (data->updates.num_regions < 2 || total < bounding * n / d) + repaint_stack( stack, data, primary, data->updates.regions, data->updates.num_regions, flags ); + else { +// direct_log_printf( NULL, "%s() <- %d regions, total %d, bounding %d (%d/%d: %d)\n", +// __FUNCTION__, data->updates.num_regions, total, bounding, n, d, bounding*n/d ); + + repaint_stack( stack, data, primary, &data->updates.bounding, 1, flags ); + } + + + dfb_updates_reset( &data->updates ); + + /* Unref primary region. */ + if (!region) + dfb_layer_region_unref( primary ); + + return DFB_OK; +} + +/* + skipping opaque windows that are above the window that changed +*/ +static void +wind_of_change( CoreWindowStack *stack, + StackData *data, + CoreLayerRegion *region, + DFBRegion *update, + DFBSurfaceFlipFlags flags, + int current, + int changed ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( region != NULL ); + D_ASSERT( update != NULL ); + + /* + loop through windows above + */ + for (; current > changed; current--) { + CoreWindow *window; + CoreWindowConfig *config; + DFBRegion opaque; + DFBRectangle rotated; + DFBRectangle *bounds = &rotated; + DFBWindowOptions options; + + D_ASSERT( changed >= 0 ); + D_ASSERT( current >= changed ); + D_ASSERT( current < fusion_vector_size( &data->windows ) ); + + window = fusion_vector_at( &data->windows, current ); + config = &window->config; + options = config->options; + + transform_window_to_stack( window, &config->bounds, &rotated ); + + /* + can skip opaque region + */ + if (( + //can skip all opaque window? + (config->opacity == 0xff) && + !(options & (DWOP_COLORKEYING | DWOP_ALPHACHANNEL)) && + (opaque=*update,dfb_region_intersect( &opaque, + bounds->x, bounds->y, + bounds->x + bounds->w - 1, + bounds->y + bounds->h -1 ) ) + )||( + //can skip opaque region? + (options & DWOP_ALPHACHANNEL) && + (options & DWOP_OPAQUE_REGION) && + (config->opacity == 0xff) && + !(options & DWOP_COLORKEYING) && + (opaque=*update,dfb_region_intersect( &opaque, + bounds->x + config->opaque.x1, + bounds->y + config->opaque.y1, + bounds->x + config->opaque.x2, + bounds->y + config->opaque.y2 )) + )) + { + /* left */ + if (opaque.x1 != update->x1) { + DFBRegion left = { update->x1, opaque.y1, opaque.x1-1, opaque.y2}; + wind_of_change( stack, data, region, &left, flags, current-1, changed ); + } + /* upper */ + if (opaque.y1 != update->y1) { + DFBRegion upper = { update->x1, update->y1, update->x2, opaque.y1-1}; + wind_of_change( stack, data, region, &upper, flags, current-1, changed ); + } + /* right */ + if (opaque.x2 != update->x2) { + DFBRegion right = { opaque.x2+1, opaque.y1, update->x2, opaque.y2}; + wind_of_change( stack, data, region, &right, flags, current-1, changed ); + } + /* lower */ + if (opaque.y2 != update->y2) { + DFBRegion lower = { update->x1, opaque.y2+1, update->x2, update->y2}; + wind_of_change( stack, data, region, &lower, flags, current-1, changed ); + } + + return; + } + } + + dfb_updates_add( &data->updates, update ); +} + +static void +repaint_stack_for_window( CoreWindowStack *stack, + StackData *data, + CoreLayerRegion *region, + DFBRegion *update, + DFBSurfaceFlipFlags flags, + int window ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( region != NULL ); + D_ASSERT( update != NULL ); + D_ASSERT( window >= 0 ); + D_ASSERT( window < fusion_vector_size( &data->windows ) ); + + if (fusion_vector_has_elements( &data->windows ) && window >= 0) { + int num = fusion_vector_size( &data->windows ); + + D_ASSERT( window < num ); + + wind_of_change( stack, data, region, update, flags, num - 1, window ); + } + else + dfb_updates_add( &data->updates, update ); +} + +/**************************************************************************************************/ + +static DFBResult +update_window( CoreWindow *window, + WindowData *window_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool force_complete, + bool force_invisible, + bool scale_region ) +{ + DFBRegion area; + DFBRegion update; + StackData *data; + CoreWindowStack *stack; + DFBRectangle *bounds; + DFBDimension size; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + D_ASSERT( window_data->stack_data->stack != NULL ); + + DFB_REGION_ASSERT_IF( region ); + + data = window_data->stack_data; + stack = data->stack; + + if (!VISIBLE_WINDOW(window) && !force_invisible) + return DFB_OK; + + if (stack->hw_mode) + return DFB_OK; + + bounds = &window->config.bounds; + size.w = bounds->w; + size.h = bounds->h; + + if (region) { + if (scale_region && (window->config.options & DWOP_SCALE)) { + int sw = window->surface->config.size.w; + int sh = window->surface->config.size.h; + + /* horizontal */ + if (bounds->w > sw) { + /* upscaling */ + area.x1 = (region->x1 - 1) * bounds->w / sw; + area.x2 = (region->x2 + 1) * bounds->w / sw; + } + else { + /* downscaling */ + area.x1 = region->x1 * bounds->w / sw - 1; + area.x2 = region->x2 * bounds->w / sw + 1; + } + + /* vertical */ + if (bounds->h > sh) { + /* upscaling */ + area.y1 = (region->y1 - 1) * bounds->h / sh; + area.y2 = (region->y2 + 1) * bounds->h / sh; + } + else { + /* downscaling */ + area.y1 = region->y1 * bounds->h / sh - 1; + area.y2 = region->y2 * bounds->h / sh + 1; + } + + /* limit to window area */ + dfb_region_clip( &area, 0, 0, bounds->w - 1, bounds->h - 1 ); + } + else + area = *region; + } + else { + area.x1 = area.y1 = 0; + area.x2 = bounds->w - 1; + area.y2 = bounds->h - 1; + } + + dfb_region_from_rotated( &update, &area, &size, window->config.rotation ); + + /* screen offset */ + dfb_region_translate( &update, bounds->x, bounds->y ); + + if (!dfb_unsafe_region_intersect( &update, 0, 0, stack->width - 1, stack->height - 1 )) + return DFB_OK; + + if (force_complete) + dfb_updates_add( &data->updates, &update ); + else + repaint_stack_for_window( stack, data, window->primary_region, + &update, flags, get_index( data, window ) ); + + return DFB_OK; +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static void +insert_window( CoreWindowStack *stack, + StackData *data, + CoreWindow *window, + WindowData *window_data ) +{ + int index; + CoreWindow *other; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + /* + * Iterate from bottom to top, + * stopping at the first window with a higher priority. + */ + fusion_vector_foreach (other, index, data->windows) { + WindowData *other_data = other->window_data; + + D_ASSERT( other->window_data != NULL ); + + if (other_data->priority > window_data->priority) + break; + } + + /* Insert the window at the acquired position. */ + fusion_vector_insert( &data->windows, window, index ); +} + +static void +withdraw_window( CoreWindowStack *stack, + StackData *data, + CoreWindow *window, + WindowData *window_data ) +{ + int i; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_ASSERT( window->stack != NULL ); + + D_ASSERT( DFB_WINDOW_INITIALIZED( window ) ); + + /* No longer be the 'entered window'. */ + if (data->entered_window == window) + data->entered_window = NULL; + + /* Remove focus from window. */ + if (data->focused_window == window) + data->focused_window = NULL; + + /* Release explicit keyboard grab. */ + if (data->keyboard_window == window) + data->keyboard_window = NULL; + + /* Release explicit pointer grab. */ + if (data->pointer_window == window) + data->pointer_window = NULL; + + /* Release all implicit key grabs. */ + for (i=0; ikeys[i].code != -1 && data->keys[i].owner == window) { + if (!DFB_WINDOW_DESTROYED( window )) { + DFBWindowEvent we; + + we.type = DWET_KEYUP; + we.key_code = data->keys[i].code; + we.key_id = data->keys[i].id; + we.key_symbol = data->keys[i].symbol; + + post_event( window, data, &we ); + } + + data->keys[i].code = -1; + data->keys[i].owner = NULL; + } + } + + /* Release grab of unselected keys. */ + if (data->unselkeys_window == window) + data->unselkeys_window = NULL; +} + +static void +remove_window( CoreWindowStack *stack, + StackData *data, + CoreWindow *window, + WindowData *window_data ) +{ + DirectLink *l, *n; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_ASSERT( window->config.opacity == 0 ); + D_ASSERT( DFB_WINDOW_INITIALIZED( window ) ); + + D_ASSERT( fusion_vector_contains( &data->windows, window ) ); + + /* Release implicit grabs, focus etc. */ + withdraw_window( stack, data, window, window_data ); + + /* Release all explicit key grabs. */ + direct_list_foreach_safe (l, n, data->grabbed_keys) { + GrabbedKey *key = (GrabbedKey*) l; + + if (key->owner == window) { + direct_list_remove( &data->grabbed_keys, &key->link ); + SHFREE( stack->shmpool, key ); + } + } + + fusion_vector_remove( &data->windows, fusion_vector_index_of( &data->windows, window ) ); +} + +/**************************************************************************************************/ + +static DFBResult +move_window( CoreWindow *window, + WindowData *data, + int dx, + int dy ) +{ + DFBResult ret; + DFBWindowEvent evt; + DFBRectangle *bounds = &window->config.bounds; + + if (window->region) { + data->config.dest.x += dx; + data->config.dest.y += dy; + + ret = dfb_layer_region_set_configuration( window->region, &data->config, CLRCF_DEST ); + if (ret) { + data->config.dest.x -= dx; + data->config.dest.y -= dy; + + return ret; + } + + bounds->x += dx; + bounds->y += dy; + } + else { + update_window( window, data, NULL, 0, false, false, false ); + + bounds->x += dx; + bounds->y += dy; + + update_window( window, data, NULL, 0, false, false, false ); + } + + /* Send new position */ + evt.type = DWET_POSITION; + evt.x = bounds->x; + evt.y = bounds->y; + + post_event( window, data->stack_data, &evt ); + + return DFB_OK; +} + +static DFBResult +resize_window( CoreWindow *window, + WMData *wm_data, + WindowData *data, + int width, + int height ) +{ + DFBResult ret; + DFBWindowEvent evt; + CoreWindowStack *stack = window->stack; + DFBRectangle *bounds = &window->config.bounds; + int ow = bounds->w; + int oh = bounds->h; + + D_DEBUG_AT( WM_Default, "resize_window( %d, %d )\n", width, height ); + + D_ASSERT( wm_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + if (width > 4096 || height > 4096) + return DFB_LIMITEXCEEDED; + + if (window->surface && !(window->config.options & DWOP_SCALE)) { + CoreSurfaceConfig config; + + config.flags = CSCONF_SIZE; + config.size.w = width; + config.size.h = height; + + ret = dfb_surface_reconfig( window->surface, &config ); + if (ret) + return ret; + } + + if (window->region) { + data->config.dest.w = data->config.source.w = data->config.width = width; + data->config.dest.h = data->config.source.h = data->config.height = height; + + ret = dfb_layer_region_set_configuration( window->region, &data->config, + CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_SURFACE | + CLRCF_DEST | CLRCF_SOURCE ); + if (ret) { + data->config.dest.w = data->config.source.w = data->config.width = bounds->w = ow; + data->config.dest.h = data->config.source.h = data->config.height = bounds->h = oh; + + return ret; + } + } + else { + dfb_region_intersect( &window->config.opaque, 0, 0, width - 1, height - 1 ); + + if (VISIBLE_WINDOW (window)) { + if (ow > width) { + DFBRegion region = { width, 0, ow - 1, MIN(height, oh) - 1 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + + if (oh > height) { + DFBRegion region = { 0, height, MAX(width, ow) - 1, oh - 1 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + } + } + + bounds->w = width; + bounds->h = height; + + /* Send new size */ + evt.type = DWET_SIZE; + evt.w = bounds->w; + evt.h = bounds->h; + + post_event( window, data->stack_data, &evt ); + + update_focus( stack, data->stack_data, wm_data ); + + return DFB_OK; +} + +static DFBResult +set_window_bounds( CoreWindow *window, + WMData *wm_data, + WindowData *data, + int x, + int y, + int width, + int height) +{ + DFBResult ret; + DFBWindowEvent evt; + CoreWindowStack *stack = window->stack; + DFBRegion old_region; + DFBRegion new_region; + + D_DEBUG_AT( WM_Default, "%s( %p [%d] %d, %d - %dx%d )\n", __FUNCTION__, window, window->id, x, y, width, height ); + + D_ASSERT( wm_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + if (width > 4096 || height > 4096) + return DFB_LIMITEXCEEDED; + + if (window->surface && !(window->config.options & DWOP_SCALE)) { + ret = dfb_surface_reformat( window->surface, + width, height, window->surface->config.format ); + if (ret) + return ret; + } + + old_region.x1 = window->config.bounds.x - x; + old_region.y1 = window->config.bounds.y - y; + old_region.x2 = old_region.x1 + window->config.bounds.w - 1; + old_region.y2 = old_region.y1 + window->config.bounds.h - 1; + + window->config.bounds.x = x; + window->config.bounds.y = y; + window->config.bounds.w = width; + window->config.bounds.h = height; + + new_region.x1 = 0; + new_region.y1 = 0; + new_region.x2 = width - 1; + new_region.y2 = height - 1; + + if (!dfb_region_region_intersect( &window->config.opaque, &new_region )) + window->config.opaque = new_region; + + /* Update exposed area. */ + if (VISIBLE_WINDOW( window )) { + if (dfb_region_region_intersect( &new_region, &old_region )) { + /* left */ + if (new_region.x1 > old_region.x1) { + DFBRegion region = { old_region.x1, old_region.y1, + new_region.x1 - 1, new_region.y2 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + + /* upper */ + if (new_region.y1 > old_region.y1) { + DFBRegion region = { old_region.x1, old_region.y1, + old_region.x2, new_region.y1 - 1 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + + /* right */ + if (new_region.x2 < old_region.x2) { + DFBRegion region = { new_region.x2 + 1, new_region.y1, + old_region.x2, new_region.y2 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + + /* lower */ + if (new_region.y2 < old_region.y2) { + DFBRegion region = { old_region.x1, new_region.y2 + 1, + old_region.x2, old_region.y2 }; + + update_window( window, data, ®ion, 0, false, false, false ); + } + } + else + update_window( window, data, &old_region, 0, false, false, false ); + } + + /* Send new position and size */ + evt.type = DWET_POSITION_SIZE; + evt.x = window->config.bounds.x; + evt.y = window->config.bounds.y; + evt.w = window->config.bounds.w; + evt.h = window->config.bounds.h; + + post_event( window, data->stack_data, &evt ); + + update_focus( stack, data->stack_data, wm_data ); + + return DFB_OK; +} + +static DFBResult +restack_window( CoreWindow *window, + WindowData *window_data, + CoreWindow *relative, + WindowData *relative_data, + int relation, + DFBWindowStackingClass stacking ) +{ + StackData *data; + int old; + int index; + int priority; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + D_ASSERT( relative == NULL || relative_data != NULL ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + data = window_data->stack_data; + + /* Change stacking class. */ + if (stacking != window->config.stacking) { + window->config.stacking = stacking; + + window_data->priority = get_priority( window ); + } + + /* Get the (new) priority. */ + priority = window_data->priority; + + /* Get the old index. */ + old = get_index( data, window ); + + /* Calculate the desired index. */ + if (relative) { + index = get_index( data, relative ); + + if (relation > 0) { + if (old < index) + index--; + } + else if (relation < 0) { + if (old > index) + index++; + } + + index += relation; + + if (index < 0) + index = 0; + else if (index > fusion_vector_size( &data->windows ) - 1) + index = fusion_vector_size( &data->windows ) - 1; + } + else if (relation) + index = fusion_vector_size( &data->windows ) - 1; + else + index = 0; + + /* Assure window won't be above any window with a higher priority. */ + while (index > 0) { + int below = (old < index) ? index : index - 1; + CoreWindow *other = fusion_vector_at( &data->windows, below ); + WindowData *other_data = other->window_data; + + D_ASSERT( other->window_data != NULL ); + + if (priority < other_data->priority) + index--; + else + break; + } + + /* Assure window won't be below any window with a lower priority. */ + while (index < fusion_vector_size( &data->windows ) - 1) { + int above = (old > index) ? index : index + 1; + CoreWindow *other = fusion_vector_at( &data->windows, above ); + WindowData *other_data = other->window_data; + + D_ASSERT( other->window_data != NULL ); + + if (priority > other_data->priority) + index++; + else + break; + } + + /* Return if index hasn't changed. */ + if (index == old) + return DFB_OK; + + /* Actually change the stacking order now. */ + fusion_vector_move( &data->windows, old, index ); + + update_window( window, window_data, NULL, DSFLIP_NONE, (index < old), false, false ); + + return DFB_OK; +} + +static void +set_opacity( CoreWindow *window, + WindowData *window_data, + WMData *wmdata, + u8 opacity ) +{ + u8 old; + StackData *data; + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + D_ASSERT( window_data->stack_data->stack != NULL ); + + old = window->config.opacity; + data = window_data->stack_data; + stack = data->stack; + + if (!stack->hw_mode && !dfb_config->translucent_windows && opacity) + opacity = 0xFF; + + if (old != opacity) { + bool show = !old && opacity; + bool hide = old && !opacity; + + window->config.opacity = opacity; + + if (window->region) { + window_data->config.opacity = opacity; + + dfb_layer_region_set_configuration( window->region, &window_data->config, CLRCF_OPACITY ); + } + else + update_window( window, window_data, NULL, DSFLIP_NONE, false, true, false ); + + + /* Check focus after window appeared or disappeared */ + if (show || hide) + update_focus( stack, data, wmdata ); + + /* If window disappeared... */ + if (hide) { + /* Ungrab pointer/keyboard */ + withdraw_window( stack, data, window, window_data ); + + /* Always try to have a focused window */ + ensure_focus( stack, data ); + } + } +} + +static DFBResult +grab_keyboard( CoreWindow *window, + WindowData *window_data ) +{ + StackData *data; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + data = window_data->stack_data; + + if (data->keyboard_window) + return DFB_LOCKED; + + data->keyboard_window = window; + + return DFB_OK; +} + +static DFBResult +ungrab_keyboard( CoreWindow *window, + WindowData *window_data ) +{ + StackData *data; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + data = window_data->stack_data; + + if (data->keyboard_window == window) + data->keyboard_window = NULL; + + return DFB_OK; +} + +static DFBResult +grab_pointer( CoreWindow *window, + WindowData *window_data ) +{ + StackData *data; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + data = window_data->stack_data; + + if (data->pointer_window) + return DFB_LOCKED; + + data->pointer_window = window; + + return DFB_OK; +} + +static DFBResult +ungrab_pointer( CoreWindow *window, + WindowData *window_data, + WMData *wmdata ) +{ + StackData *data; + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + data = window_data->stack_data; + stack = data->stack; + + if (data->pointer_window == window) { + data->pointer_window = NULL; + + /* Possibly change focus to window that's now under the cursor */ + update_focus( stack, data, wmdata ); + } + + return DFB_OK; +} + +static DFBResult +grab_key( CoreWindow *window, + WindowData *window_data, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ) +{ + int i; + StackData *data; + GrabbedKey *grab; + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + D_ASSERT( window_data->stack_data->stack != NULL ); + + data = window_data->stack_data; + stack = data->stack; + + /* Reject if already grabbed. */ + direct_list_foreach (grab, data->grabbed_keys) + if (grab->symbol == symbol && grab->modifiers == modifiers) + return DFB_LOCKED; + + /* Allocate grab information. */ + grab = SHCALLOC( stack->shmpool, 1, sizeof(GrabbedKey) ); + + /* Fill grab information. */ + grab->symbol = symbol; + grab->modifiers = modifiers; + grab->owner = window; + + /* Add to list of key grabs. */ + direct_list_append( &data->grabbed_keys, &grab->link ); + + /* Remove implicit grabs for this key. */ + for (i=0; ikeys[i].code != -1 && data->keys[i].symbol == symbol) + data->keys[i].code = -1; + + return DFB_OK; +} + +static DFBResult +ungrab_key( CoreWindow *window, + WindowData *window_data, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ) +{ + DirectLink *l; + StackData *data; + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + D_ASSERT( window_data->stack_data->stack != NULL ); + + data = window_data->stack_data; + stack = data->stack; + + direct_list_foreach (l, data->grabbed_keys) { + GrabbedKey *key = (GrabbedKey*) l; + + if (key->symbol == symbol && key->modifiers == modifiers && key->owner == window) { + direct_list_remove( &data->grabbed_keys, &key->link ); + SHFREE( stack->shmpool, key ); + return DFB_OK; + } + } + + return DFB_IDNOTFOUND; +} + +static DFBResult +request_focus( CoreWindow *window, + WindowData *window_data ) +{ + StackData *data; + CoreWindowStack *stack; + CoreWindow *entered; + + D_ASSERT( window != NULL ); + D_ASSERT( !(window->config.options & DWOP_GHOST) ); + D_ASSERT( window_data != NULL ); + D_ASSERT( window_data->stack_data != NULL ); + + data = window_data->stack_data; + stack = data->stack; + + switch_focus( stack, data, window ); + + entered = data->entered_window; + + if (entered && entered != window) { + DFBWindowEvent we; + + we.type = DWET_LEAVE; + we.x = stack->cursor.x - entered->config.bounds.x; + we.y = stack->cursor.y - entered->config.bounds.y; + + transform_point_in_window( entered, &we.x, &we.y ); + + post_event( entered, data, &we ); + + data->entered_window = NULL; + } + + return DFB_OK; +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static bool +handle_wm_key( CoreWindowStack *stack, + StackData *data, + WMData *wmdata, + const DFBInputEvent *event ) +{ + int i, num; + CoreWindow *entered; + CoreWindow *focused; + CoreWindow *window; + DFBRegion region; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( data->wm_level > 0 ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_KEYPRESS ); + + entered = data->entered_window; + focused = data->focused_window; + + switch (DFB_LOWER_CASE(event->key_symbol)) { + case DIKS_SMALL_X: + num = fusion_vector_size( &data->windows ); + + if (data->wm_cycle <= 0) + data->wm_cycle = num; + + if (num) { + int looped = 0; + int index = MIN( num, data->wm_cycle ); + + while (index--) { + CoreWindow *window = fusion_vector_at( &data->windows, index ); + + if ((window->config.options & (DWOP_GHOST | DWOP_KEEP_STACKING)) || + ! VISIBLE_WINDOW(window) || window == data->focused_window) + { + if (index == 0 && !looped) { + looped = 1; + index = num - 1; + } + + continue; + } + + restack_window( window, window->window_data, + NULL, NULL, 1, window->config.stacking ); + request_focus( window, window->window_data ); + + break; + } + + data->wm_cycle = index; + } + break; + + case DIKS_SMALL_S: + fusion_vector_foreach (window, i, data->windows) { + if (VISIBLE_WINDOW(window) && window->config.stacking == DWSC_MIDDLE && + ! (window->config.options & (DWOP_GHOST | DWOP_KEEP_STACKING))) + { + restack_window( window, window->window_data, + NULL, NULL, 1, window->config.stacking ); + request_focus( window, window->window_data ); + + break; + } + } + break; + + case DIKS_SMALL_C: + if (entered) { + DFBWindowEvent event; + + event.type = DWET_CLOSE; + + post_event( entered, data, &event ); + } + break; + + case DIKS_SMALL_E: + update_focus( stack, data, wmdata ); + break; + + case DIKS_SMALL_A: + if (focused && !(focused->config.options & DWOP_KEEP_STACKING)) { + restack_window( focused, focused->window_data, + NULL, NULL, 0, focused->config.stacking ); + update_focus( stack, data, wmdata ); + } + break; + + case DIKS_SMALL_W: + if (focused && !(focused->config.options & DWOP_KEEP_STACKING)) + restack_window( focused, focused->window_data, + NULL, NULL, 1, focused->config.stacking ); + break; + + case DIKS_SMALL_D: + if (entered && !(entered->config.options & DWOP_INDESTRUCTIBLE)) + dfb_window_destroy( entered ); + + break; + + case DIKS_SMALL_P: + /* Enable and show cursor. */ + if (stack->cursor.set) { + dfb_windowstack_cursor_set_opacity( stack, 0xff ); + dfb_windowstack_cursor_enable( wmdata->core, stack, true ); + } + + /* Ungrab pointer. */ + data->pointer_window = NULL; + + /* TODO: set new cursor shape, the current one might be completely transparent */ + break; + + case DIKS_SMALL_R: + if (focused && !(focused->config.options & DWOP_KEEP_POSITION)) + dfb_window_set_rotation( focused, (focused->config.rotation + 90) % 360 ); + break; + + case DIKS_PRINT: + if (dfb_config->screenshot_dir && focused && focused->surface) + dfb_surface_dump_buffer( focused->surface, CSBR_FRONT, dfb_config->screenshot_dir, "dfb_window" ); + break; + + case DIKS_F12: + region.x1 = 0; + region.y1 = 0; + region.x2 = stack->width; + region.y2 = stack->height; + + dfb_updates_reset( &data->updates ); + dfb_updates_add( &data->updates, ®ion ); + break; + + default: + return false; + } + + return true; +} + +static bool +is_wm_key( DFBInputDeviceKeySymbol key_symbol ) +{ + switch (DFB_LOWER_CASE(key_symbol)) { + case DIKS_SMALL_X: + case DIKS_SMALL_S: + case DIKS_SMALL_C: + case DIKS_SMALL_E: + case DIKS_SMALL_A: + case DIKS_SMALL_W: + case DIKS_SMALL_D: + case DIKS_SMALL_P: + case DIKS_SMALL_R: + case DIKS_PRINT: + break; + + default: + return false; + } + + return true; +} + + +/**************************************************************************************************/ + +static DFBResult +handle_key_press( CoreWindowStack *stack, + StackData *data, + WMData *wmdata, + const DFBInputEvent *event ) +{ + CoreWindow *window; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_KEYPRESS ); + + if (data->wm_level) { + switch (event->key_symbol) { + case DIKS_META: + data->wm_level |= 1; + break; + + case DIKS_CONTROL: + data->wm_level |= 2; + break; + + case DIKS_ALT: + data->wm_level |= 4; + break; + + default: + if (handle_wm_key( stack, data, wmdata, event )) + return DFB_OK; + + break; + } + } + else if (event->key_symbol == DIKS_META) { + data->wm_level |= 1; + data->wm_cycle = 0; + } + + window = get_keyboard_window( stack, data, event ); + if (window) + send_key_event( window, data, event ); + + return DFB_OK; +} + +static DFBResult +handle_key_release( CoreWindowStack *stack, + StackData *data, + const DFBInputEvent *event ) +{ + CoreWindow *window; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_KEYRELEASE ); + + if (data->wm_level) { + switch (event->key_symbol) { + case DIKS_META: + data->wm_level &= ~1; + break; + + case DIKS_CONTROL: + data->wm_level &= ~2; + break; + + case DIKS_ALT: + data->wm_level &= ~4; + break; + + default: + if (is_wm_key( event->key_symbol )) + return DFB_OK; + + break; + } + } + + window = get_keyboard_window( stack, data, event ); + if (window) + send_key_event( window, data, event ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +handle_button_press( CoreWindowStack *stack, + StackData *data, + const DFBInputEvent *event ) +{ + CoreWindow *window; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_BUTTONPRESS ); + + if (!stack->cursor.enabled) + return DFB_OK; + + switch (data->wm_level) { + case 1: + window = data->entered_window; + if (window && !(window->config.options & DWOP_KEEP_STACKING)) + dfb_window_raisetotop( data->entered_window ); + + break; + + default: + window = data->pointer_window ? data->pointer_window : data->entered_window; + if (window) + send_button_event( window, data, event ); + + break; + } + + return DFB_OK; +} + +static DFBResult +handle_button_release( CoreWindowStack *stack, + StackData *data, + const DFBInputEvent *event ) +{ + CoreWindow *window; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_BUTTONRELEASE ); + + if (!stack->cursor.enabled) + return DFB_OK; + + switch (data->wm_level) { + case 1: + break; + + default: + window = data->pointer_window ? data->pointer_window : data->entered_window; + if (window) + send_button_event( window, data, event ); + + break; + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +static void +perform_motion( CoreWindowStack *stack, + StackData *data, + WMData *wmdata, + int dx, + int dy ) +{ + int old_cx, old_cy; + DFBWindowEvent we; + CoreWindow *entered; + CoreWindowConfig *config = NULL; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + + if (!stack->cursor.enabled) + return; + + + old_cx = stack->cursor.x; + old_cy = stack->cursor.y; + + dfb_windowstack_cursor_warp( stack, old_cx + dx, old_cy + dy ); + + dx = stack->cursor.x - old_cx; + dy = stack->cursor.y - old_cy; + + if (!dx && !dy) + return; + + + entered = data->entered_window; + if (entered) + config = &entered->config; + + switch (data->wm_level) { + case 7: + case 6: + case 5: + case 4: + if (entered) { + int opacity = config->opacity + dx; + + if (opacity < 8) + opacity = 8; + else if (opacity > 255) + opacity = 255; + + dfb_window_set_opacity( entered, opacity ); + } + + break; + + case 3: + case 2: + if (entered && !(config->options & DWOP_KEEP_SIZE)) { + int width = config->bounds.w + dx; + int height = config->bounds.h + dy; + + if (width < 48) width = 48; + if (height < 48) height = 48; + if (width > 2048) width = 2048; + if (height > 2048) height = 2048; + + dfb_window_resize( entered, width, height ); + } + + break; + + case 1: + if (entered && !(config->options & DWOP_KEEP_POSITION)) + dfb_window_move( entered, dx, dy, true ); + + break; + + case 0: + if (data->pointer_window) { + CoreWindow *window = data->pointer_window; + + we.type = DWET_MOTION; + we.x = stack->cursor.x - window->config.bounds.x; + we.y = stack->cursor.y - window->config.bounds.y; + + transform_point_in_window( window, &we.x, &we.y ); + + post_event( window, data, &we ); + } + else if (!update_focus( stack, data, wmdata ) && data->entered_window) { + CoreWindow *window = data->entered_window; + + we.type = DWET_MOTION; + we.x = stack->cursor.x - window->config.bounds.x; + we.y = stack->cursor.y - window->config.bounds.y; + + transform_point_in_window( window, &we.x, &we.y ); + + post_event( window, data, &we ); + } + + break; + + default: + ; + } +} + +static void +flush_motion( CoreWindowStack *stack, + StackData *data, + WMData *wmdata ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( wmdata != NULL ); + + if (data->cursor_dx || data->cursor_dy) { + perform_motion( stack, data, wmdata, data->cursor_dx, data->cursor_dy ); + + data->cursor_dx = 0; + data->cursor_dy = 0; + } +} + +static void +handle_wheel( CoreWindowStack *stack, + StackData *data, + int dz ) +{ + DFBWindowEvent we; + CoreWindow *window = NULL; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + + if (!stack->cursor.enabled) + return; + + window = data->pointer_window ? data->pointer_window : data->entered_window; + + if (window) { + if (data->wm_level) { + int opacity = window->config.opacity + dz*7; + + if (opacity < 0x01) + opacity = 1; + if (opacity > 0xFF) + opacity = 0xFF; + + dfb_window_set_opacity( window, opacity ); + } + else { + we.type = DWET_WHEEL; + we.x = stack->cursor.x - window->config.bounds.x; + we.y = stack->cursor.y - window->config.bounds.y; + we.step = dz; + + transform_point_in_window( window, &we.x, &we.y ); + + post_event( window, data, &we ); + } + } +} + +static DFBResult +handle_axis_motion( CoreWindowStack *stack, + StackData *data, + WMData *wmdata, + const DFBInputEvent *event ) +{ + CoreLayerContext *context; + DFBInputEvent rotated_event; + + D_ASSERT( stack != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( event != NULL ); + D_ASSERT( event->type == DIET_AXISMOTION ); + + context = stack->context; + D_MAGIC_ASSERT( context, CoreLayerContext ); + + if (event->flags & DIEF_AXISREL) { + rotated_event = *event; + event = &rotated_event; + + if (event->axis == DIAI_X) { + if (context->rotation == 90) { + rotated_event.axis = DIAI_Y; + } + else if (context->rotation == 180) { + rotated_event.axisrel = -rotated_event.axisrel; + } + else if (context->rotation == 270) { + rotated_event.axis = DIAI_Y; + rotated_event.axisrel = -rotated_event.axisrel; + } + } + else if (event->axis == DIAI_Y) { + if (context->rotation == 90) { + rotated_event.axis = DIAI_X; + rotated_event.axisrel = -rotated_event.axisrel; + } + else if (context->rotation == 180) { + rotated_event.axisrel = -rotated_event.axisrel; + } + else if (context->rotation == 270) { + rotated_event.axis = DIAI_X; + } + } + } + else if (event->flags & DIEF_AXISABS) { + rotated_event = *event; + event = &rotated_event; + + if (event->axis == DIAI_X) { + if (context->rotation == 90) { + rotated_event.axis = DIAI_Y; + } + else if (context->rotation == 180) { + rotated_event.axisabs = stack->rotated_width - rotated_event.axisabs; + } + else if (context->rotation == 270) { + rotated_event.axis = DIAI_Y; + rotated_event.axisabs = stack->rotated_width - rotated_event.axisabs; + } + } + else if (event->axis == DIAI_Y) { + if (context->rotation == 90) { + rotated_event.axis = DIAI_X; + rotated_event.axisabs = stack->rotated_height - rotated_event.axisabs; + } + else if (context->rotation == 180) { + rotated_event.axisabs = stack->rotated_height - rotated_event.axisabs; + } + else if (context->rotation == 270) { + rotated_event.axis = DIAI_X; + } + } + } + + if (event->flags & DIEF_AXISREL) { + int rel = event->axisrel; + + /* handle cursor acceleration */ + if (rel > stack->cursor.threshold) + rel += (rel - stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + else if (rel < -stack->cursor.threshold) + rel += (rel + stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + + switch (event->axis) { + case DIAI_X: + data->cursor_dx += rel; + break; + + case DIAI_Y: + data->cursor_dy += rel; + break; + + case DIAI_Z: + flush_motion( stack, data, wmdata ); + + handle_wheel( stack, data, - event->axisrel ); + break; + + default: + ; + } + } + else if (event->flags & DIEF_AXISABS) { + int axismin = 0; + int axisabs = event->axisabs; + + if (event->flags & DIEF_MIN) { + axismin = event->min; + + axisabs -= axismin; + } + + switch (event->axis) { + case DIAI_X: + if (event->flags & DIEF_MAX) + axisabs = axisabs * stack->width / (event->max - axismin + 1); + + data->cursor_dx = axisabs - stack->cursor.x; + break; + + case DIAI_Y: + if (event->flags & DIEF_MAX) + axisabs = axisabs * stack->height / (event->max - axismin + 1); + + data->cursor_dy = axisabs - stack->cursor.y; + break; + + default: + ; + } + } + + return DFB_OK; +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static void +wm_get_info( CoreWMInfo *info ) +{ + info->version.major = 0; + info->version.minor = 3; + info->version.binary = 2; + + snprintf( info->name, DFB_CORE_WM_INFO_NAME_LENGTH, "Default" ); + snprintf( info->vendor, DFB_CORE_WM_INFO_VENDOR_LENGTH, "directfb.org" ); + + info->wm_data_size = sizeof(WMData); + info->stack_data_size = sizeof(StackData); + info->window_data_size = sizeof(WindowData); +} + +static DFBResult +wm_initialize( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + + data->core = core; + + return DFB_OK; +} + +static DFBResult +wm_join( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + + data->core = core; + + return DFB_OK; +} + +static DFBResult +wm_shutdown( bool emergency, void *wm_data, void *shared_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_leave( bool emergency, void *wm_data, void *shared_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_suspend( void *wm_data, void *shared_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_resume( void *wm_data, void *shared_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_post_init( void *wm_data, void *shared_data ) +{ + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +wm_init_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + int i; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + data->stack = stack; + + /* Initialize update manager. */ + dfb_updates_init( &data->updates, data->update_regions, MAX_UPDATE_REGIONS ); + + fusion_vector_init( &data->windows, 64, stack->shmpool ); + + for (i=0; ikeys[i].code = -1; + + D_MAGIC_SET( data, StackData ); + + return DFB_OK; +} + +static DFBResult +wm_close_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + DirectLink *l, *next; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + D_MAGIC_CLEAR( data ); + + D_ASSUME( fusion_vector_is_empty( &data->windows ) ); + + if (fusion_vector_has_elements( &data->windows )) { + int i; + CoreWindow *window; + + fusion_vector_foreach (window, i, data->windows) { + D_WARN( "setting window->stack = NULL" ); + window->stack = NULL; + } + } + + fusion_vector_destroy( &data->windows ); + + /* Destroy backing store of software cursor. */ + if (data->cursor_bs) + dfb_surface_unlink( &data->cursor_bs ); + + /* Free grabbed keys. */ + direct_list_foreach_safe (l, next, data->grabbed_keys) + SHFREE( stack->shmpool, l ); + + return DFB_OK; +} + +static DFBResult +wm_set_active( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + bool active ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_ASSUME( data->active != active ); + + if (data->active == active) + return DFB_OK; + + data->active = active; + + if (active) + return dfb_windowstack_repaint_all( stack ); + + /* Force release of all pressed keys. */ + return wm_flush_keys( stack, wm_data, stack_data ); +} + +static DFBResult +wm_resize_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int width, + int height ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + return DFB_OK; +} + +static DFBResult +wm_process_input( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBInputEvent *event ) +{ + DFBResult ret; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_DEBUG_AT( WM_Default, "Processing input event (device %d, type 0x%08x, flags 0x%08x)...\n", + event->device_id, event->type, event->flags ); + + /* FIXME: handle multiple devices */ + if (event->flags & DIEF_BUTTONS) + data->buttons = event->buttons; + + if (event->flags & DIEF_MODIFIERS) + data->modifiers = event->modifiers; + + if (event->flags & DIEF_LOCKS) + data->locks = event->locks; + + if (event->type != DIET_AXISMOTION) + flush_motion( stack, data, wm_data ); + + switch (event->type) { + case DIET_KEYPRESS: + ret = handle_key_press( stack, data, wm_data, event ); + break; + + case DIET_KEYRELEASE: + ret = handle_key_release( stack, data, event ); + break; + + case DIET_BUTTONPRESS: + ret = handle_button_press( stack, data, event ); + break; + + case DIET_BUTTONRELEASE: + ret = handle_button_release( stack, data, event ); + break; + + case DIET_AXISMOTION: + ret = handle_axis_motion( stack, data, wm_data, event ); + break; + + default: + D_ONCE( "unknown input event type" ); + ret = DFB_UNSUPPORTED; + break; + } + + if (!D_FLAGS_IS_SET( event->flags, DIEF_FOLLOW )) + flush_motion( stack, data, wm_data ); + + process_updates( data, wm_data, stack, NULL, DSFLIP_NONE ); + + return ret; +} + +static DFBResult +wm_flush_keys( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + int i; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + for (i=0; ikeys[i].code != -1) { + DFBWindowEvent we; + + we.type = DWET_KEYUP; + we.key_code = data->keys[i].code; + we.key_id = data->keys[i].id; + we.key_symbol = data->keys[i].symbol; + + post_event( data->keys[i].owner, data, &we ); + + data->keys[i].code = -1; + } + } + + return DFB_OK; +} + +static DFBResult +wm_window_at( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int x, + int y, + CoreWindow **ret_window ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + *ret_window = window_at_pointer( stack, data, wm_data, x, y ); + + return DFB_OK; +} + +static DFBResult +wm_window_lookup( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + DFBWindowID window_id, + CoreWindow **ret_window ) +{ + int i; + CoreWindow *window = NULL; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + fusion_vector_foreach_reverse (window, i, data->windows) { + if (window->id == window_id) { + break; + } + } + + *ret_window = window; + return DFB_OK; +} + +static DFBResult +wm_enum_windows( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWMWindowCallback callback, + void *callback_ctx ) +{ + int i; + CoreWindow *window = NULL; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( callback != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + fusion_vector_foreach_reverse (window, i, data->windows) { + if (callback( window, callback_ctx ) != DFENUM_OK) + break; + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +wm_get_insets( CoreWindowStack *stack, + CoreWindow *window, + DFBInsets *insets ) +{ + insets->l = 0; + insets->t = 0; + insets->r = 0; + insets->b = 0; + + return DFB_OK; +} + + +static DFBResult +wm_preconfigure_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + if (window->config.association) + return DFB_UNIMPLEMENTED; + + return DFB_OK; +} + +static DFBResult +wm_set_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void *value, + void **ret_old_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_set_property((FusionObject*)window, + key,value,ret_old_value); + return DFB_OK; +} + +static DFBResult +wm_get_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + D_ASSERT( ret_value != NULL ); + + *ret_value = fusion_object_get_property((FusionObject*)window,key); + return DFB_OK; +} + + +static DFBResult +wm_remove_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_remove_property((FusionObject*)window,key,ret_value); + return DFB_OK; +} + +static DFBResult +wm_add_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + WindowData *data = window_data; + StackData *sdata = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( sdata, StackData ); + + /* Initialize window data. */ + data->window = window; + data->stack_data = stack_data; + data->priority = get_priority( window ); + + if (window->region) + dfb_layer_region_get_configuration( window->region, &data->config ); + + D_MAGIC_SET( data, WindowData ); + + /* Actually add the window to the stack. */ + insert_window( stack, sdata, window, data ); + + /* Possibly switch focus to the new window. */ + update_focus( stack, sdata, wm_data ); + + process_updates( sdata, wm_data, stack, window->primary_region, DSFLIP_NONE ); + + return DFB_OK; +} + +static DFBResult +wm_remove_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + WindowData *data = window_data; + StackData *sdata = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + D_MAGIC_ASSERT( sdata, StackData ); + + remove_window( stack, sdata, window, data ); + + /* Free key list. */ + if (window->config.keys) { + SHFREE( stack->shmpool, window->config.keys ); + + window->config.keys = NULL; + window->config.num_keys = 0; + } + + D_MAGIC_CLEAR( data ); + + return DFB_OK; +} + +static DFBResult +wm_set_window_config( CoreWindow *window, + void *wm_data, + void *window_data, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ) +{ + DFBResult ret; + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( window->stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( config != NULL ); + + stack = window->stack; + D_ASSERT( stack != NULL ); + + if (flags & CWCF_OPTIONS) { + if ((window->config.options & DWOP_SCALE) && !(config->options & DWOP_SCALE) && window->surface) { + if (window->config.bounds.w != window->surface->config.size.w || + window->config.bounds.h != window->surface->config.size.h) + { + ret = dfb_surface_reformat( window->surface, + window->config.bounds.w, + window->config.bounds.h, + window->surface->config.format ); + if (ret) { + D_DERROR( ret, "WM/Default: Could not resize surface " + "(%dx%d -> %dx%d) to remove DWOP_SCALE!\n", + window->surface->config.size.w, + window->surface->config.size.h, + window->config.bounds.w, + window->config.bounds.h ); + return ret; + } + } + } + + window->config.options = config->options; + } + + if (flags & CWCF_EVENTS) + window->config.events = config->events; + + if (flags & CWCF_COLOR) + return DFB_UNSUPPORTED; + + if (flags & CWCF_COLOR_KEY) + window->config.color_key = config->color_key; + + if (flags & CWCF_OPAQUE) + window->config.opaque = config->opaque; + + if (flags & CWCF_OPACITY && !config->opacity) + set_opacity( window, window_data, wm_data, config->opacity ); + + if (flags == (CWCF_POSITION | CWCF_SIZE)) { + ret = set_window_bounds (window, wm_data, window_data, + config->bounds.x, config->bounds.y, + config->bounds.w, config->bounds.h); + if (ret) + return ret; + } + else { + if (flags & CWCF_POSITION) { + ret = move_window( window, window_data, + config->bounds.x - window->config.bounds.x, + config->bounds.y - window->config.bounds.y ); + if (ret) + return ret; + } + + if (flags & CWCF_SIZE) { + ret = resize_window( window, wm_data, window_data, config->bounds.w, config->bounds.h ); + if (ret) + return ret; + } + } + + if (flags & CWCF_ROTATION) { + update_window( window, window_data, NULL, DSFLIP_NONE, false, false, false ); + + window->config.rotation = config->rotation; + + update_window( window, window_data, NULL, DSFLIP_NONE, false, false, false ); + } + + if (flags & CWCF_STACKING) + restack_window( window, window_data, window, window_data, 0, config->stacking ); + + if (flags & CWCF_OPACITY && config->opacity) + set_opacity( window, window_data, wm_data, config->opacity ); + + if (flags & CWCF_KEY_SELECTION) { + if (config->key_selection == DWKS_LIST) { + unsigned int bytes = sizeof(DFBInputDeviceKeySymbol) * config->num_keys; + DFBInputDeviceKeySymbol *keys; + + D_ASSERT( config->keys != NULL ); + D_ASSERT( config->num_keys > 0 ); + + keys = SHMALLOC( window->stack->shmpool, bytes ); + if (!keys) { + D_ERROR( "WM/Default: Could not allocate %d bytes for list " + "of selected keys (%d)!\n", bytes, config->num_keys ); + return D_OOSHM(); + } + + direct_memcpy( keys, config->keys, bytes ); + + qsort( keys, config->num_keys, sizeof(DFBInputDeviceKeySymbol), keys_compare ); + + if (window->config.keys) + SHFREE( window->stack->shmpool, window->config.keys ); + + window->config.keys = keys; + window->config.num_keys = config->num_keys; + } + else if (window->config.keys) { + SHFREE( window->stack->shmpool, window->config.keys ); + + window->config.keys = NULL; + window->config.num_keys = 0; + } + + window->config.key_selection = config->key_selection; + } + + process_updates( stack->stack_data, wm_data, stack, window->primary_region, DSFLIP_NONE ); + + return DFB_OK; +} + +static DFBResult +wm_restack_window( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWindow *relative, + void *relative_data, + int relation ) +{ + DFBResult ret; + WindowData *data = window_data; + StackData *sdata; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + D_ASSERT( relative == NULL || relative_data != NULL ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + sdata = data->stack_data; + D_ASSERT( sdata != NULL ); + D_ASSERT( sdata->stack != NULL ); + + ret = restack_window( window, window_data, relative, + relative_data, relation, window->config.stacking ); + if (ret) + return ret; + + /* Possibly switch focus to window now under the cursor */ + update_focus( sdata->stack, sdata, wm_data ); + + process_updates( sdata, wm_data, window->stack, window->primary_region, DSFLIP_NONE ); + + return DFB_OK; +} + +static DFBResult +wm_grab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + StackData *sdata; + WindowData *wdata = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + D_ASSERT( wdata->stack_data != NULL ); + + sdata = wdata->stack_data; + + switch (grab->target) { + case CWMGT_KEYBOARD: + return grab_keyboard( window, window_data ); + + case CWMGT_POINTER: + return grab_pointer( window, window_data ); + + case CWMGT_KEY: + return grab_key( window, window_data, grab->symbol, grab->modifiers ); + + case CWMGT_UNSELECTED_KEYS: + if (sdata->unselkeys_window) + return DFB_LOCKED; + + sdata->unselkeys_window = window; + return DFB_OK; + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_BUG; +} + +static DFBResult +wm_ungrab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + StackData *sdata; + WindowData *wdata = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + D_ASSERT( wdata->stack_data != NULL ); + + sdata = wdata->stack_data; + + switch (grab->target) { + case CWMGT_KEYBOARD: + return ungrab_keyboard( window, window_data ); + + case CWMGT_POINTER: + return ungrab_pointer( window, window_data, wm_data ); + + case CWMGT_KEY: + return ungrab_key( window, window_data, grab->symbol, grab->modifiers ); + + case CWMGT_UNSELECTED_KEYS: + if (sdata->unselkeys_window == window) + sdata->unselkeys_window = NULL; + + return DFB_OK; + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_BUG; +} + +static DFBResult +wm_request_focus( CoreWindow *window, + void *wm_data, + void *window_data ) +{ + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + return request_focus( window, window_data ); +} + +static DFBResult +wm_begin_updates( CoreWindow *window, + void *wm_data, + void *window_data, + const DFBRegion *update ) +{ + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +wm_update_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBRegion *region, /* stack coordinates */ + DFBSurfaceFlipFlags flags ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( region != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + dfb_updates_add( &data->updates, region ); + + process_updates( data, wm_data, stack, NULL, flags ); + + return DFB_OK; +} + +static DFBResult +wm_update_window( CoreWindow *window, + void *wm_data, + void *window_data, + const DFBRegion *region, /* surface coordinates! */ + DFBSurfaceFlipFlags flags ) +{ + CoreWindowStack *stack; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + DFB_REGION_ASSERT_IF( region ); + + stack = window->stack; + D_ASSERT( stack != NULL ); + + update_window( window, window_data, region, flags, false, false, true ); + + process_updates( stack->stack_data, wm_data, stack, window->primary_region, flags ); + + return DFB_OK; +} + +static DFBResult +wm_update_cursor( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreCursorUpdateFlags flags ) +{ + DFBResult ret; + DFBRegion old_dest; + DFBRegion old_region; + WMData *wmdata = wm_data; + StackData *data = stack_data; + bool restored = false; + CoreLayerContext *context; + CoreLayerRegion *primary; + CoreSurface *surface; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + old_region = data->cursor_region; + + transform_stack_to_dest( stack, &old_region, &old_dest ); + + if (flags & (CCUF_ENABLE | CCUF_POSITION | CCUF_SIZE)) { + data->cursor_bs_valid = false; + + data->cursor_region.x1 = stack->cursor.x - stack->cursor.hot.x; + data->cursor_region.y1 = stack->cursor.y - stack->cursor.hot.y; + data->cursor_region.x2 = data->cursor_region.x1 + stack->cursor.size.w - 1; + data->cursor_region.y2 = data->cursor_region.y1 + stack->cursor.size.h - 1; + + if (!dfb_region_intersect( &data->cursor_region, 0, 0, stack->width - 1, stack->height - 1 )) { + D_BUG( "invalid cursor region" ); + return DFB_BUG; + } + } + + /* Optimize case of invisible cursor moving. */ + if (!(flags & ~(CCUF_POSITION | CCUF_SHAPE)) && (!stack->cursor.opacity || !stack->cursor.enabled)) + return DFB_OK; + + context = stack->context; + D_ASSERT( context != NULL ); + + if (!data->cursor_bs) { + CoreSurface *cursor_bs; + DFBSurfaceCapabilities caps = DSCAPS_NONE; + DFBDimension size = stack->cursor.size; + + D_ASSUME( flags & CCUF_ENABLE ); + + dfb_surface_caps_apply_policy( stack->cursor.policy, &caps ); + + if (stack->rotation == 90 || stack->rotation == 270) + D_UTIL_SWAP( size.w, size.h ); + + /* Create the cursor backing store surface. */ + ret = dfb_surface_create_simple( wmdata->core, size.w, size.h, + context->config.pixelformat, caps, CSTF_SHARED | CSTF_CURSOR, + 0, /* FIXME: no shared cursor objects, no cursor id */ + NULL, &cursor_bs ); + if (ret) { + D_ERROR( "WM/Default: Failed creating backing store for cursor!\n" ); + return ret; + } + + ret = dfb_surface_globalize( cursor_bs ); + D_ASSERT( ret == DFB_OK ); + + data->cursor_bs = cursor_bs; + } + + D_ASSERT( data->cursor_bs != NULL ); + + /* Get the primary region. */ + ret = dfb_layer_context_get_primary_region( context, false, &primary ); + if (ret) + return ret; + + surface = primary->surface; + D_MAGIC_ASSERT( surface, CoreSurface ); + + if (flags & CCUF_ENABLE) { + /* Ensure valid back buffer. From now on swapping is prevented until cursor is disabled. + * FIXME: Keep a flag to know when back/front have been swapped and need a sync. + */ + switch (context->config.buffermode) { + case DLBM_BACKVIDEO: + case DLBM_TRIPLE: + dfb_gfx_copy( surface, surface, NULL ); + break; + + default: + break; + } + } + + /* restore region under cursor */ + if (data->cursor_drawn && dfb_region_intersect( &old_dest, 0, 0, + surface->config.size.w - 1, surface->config.size.h - 1 )) + { + DFBRectangle rect = { 0, 0, + old_dest.x2 - old_dest.x1 + 1, + old_dest.y2 - old_dest.y1 + 1 }; + + D_ASSERT( stack->cursor.opacity || (flags & CCUF_OPACITY) ); + + dfb_gfx_copy_to( data->cursor_bs, surface, &rect, old_dest.x1, old_dest.y1, false ); + + data->cursor_drawn = false; + + restored = true; + } + + if (flags & CCUF_SIZE) { + DFBDimension size = stack->cursor.size; + + if (stack->rotation == 90 || stack->rotation == 270) + D_UTIL_SWAP( size.w, size.h ); + + ret = dfb_surface_reformat( data->cursor_bs, size.w, size.h, data->cursor_bs->config.format ); + if (ret) + D_DERROR( ret, "WM/Default: Failed resizing backing store for cursor from %dx%d to %dx%d!\n", + data->cursor_bs->config.size.w, data->cursor_bs->config.size.h, + stack->cursor.size.w, stack->cursor.size.h ); + } + + if (flags & CCUF_DISABLE) { + dfb_surface_unlink( &data->cursor_bs ); + } + else if (stack->cursor.opacity) { + DFBRegion dest; + CoreLayer *layer = dfb_layer_at( context->layer_id ); + CardState *state = &layer->state; + + transform_stack_to_dest( stack, &data->cursor_region, &dest ); + + if (!dfb_region_intersect( &dest, 0, 0, surface->config.size.w - 1, surface->config.size.h - 1 )) { + if (restored) + dfb_layer_region_flip_update( primary, &old_dest, DSFLIP_BLIT ); + dfb_layer_region_unref( primary ); + return DFB_OK; + } + + /* backup region under cursor */ + if (!data->cursor_bs_valid) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &dest ); + + D_ASSERT( !data->cursor_drawn ); + + /* FIXME: this requires using blitted flipping all the time, + but fixing it seems impossible, for now DSFLIP_BLIT is forced + in repaint_stack() when the cursor is enabled. */ + dfb_gfx_copy_to( surface, data->cursor_bs, &rect, 0, 0, true ); + + data->cursor_bs_valid = true; + } + + /* Set destination. */ + state->destination = surface; + state->modified |= SMF_DESTINATION; + + /* Set clipping region. */ + dfb_state_set_clip( state, &dest ); + + /* draw cursor */ + draw_cursor( stack, data, state, &data->cursor_region ); + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + data->cursor_drawn = true; + + if (restored) { + if (dfb_region_region_intersects( &old_dest, &dest )) + dfb_region_region_union( &old_dest, &dest ); + else + dfb_layer_region_flip_update( primary, &dest, DSFLIP_BLIT ); + + dfb_layer_region_flip_update( primary, &old_dest, DSFLIP_BLIT ); + } + else + dfb_layer_region_flip_update( primary, &dest, DSFLIP_BLIT ); + + /* Pan to follow the cursor? */ + if (primary->config.source.w < surface->config.size.w || primary->config.source.h < surface->config.size.h) { + DFBRectangle source = primary->config.source; + + if (stack->rotation) + D_UNIMPLEMENTED(); + + if (source.x > stack->cursor.x) + source.x = stack->cursor.x; + else if (source.x + source.w - 1 < stack->cursor.x) + source.x = stack->cursor.x - source.w + 1; + + if (source.y > stack->cursor.y) + source.y = stack->cursor.y; + else if (source.y + source.h - 1 < stack->cursor.y) + source.y = stack->cursor.y - source.h + 1; + + dfb_layer_context_set_sourcerectangle( context, &source ); + } + } + else if (restored) + dfb_layer_region_flip_update( primary, &old_dest, DSFLIP_BLIT ); + + /* Unref primary region. */ + dfb_layer_region_unref( primary ); + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/Makefile.am b/Source/DirectFB/wm/unique/Makefile.am new file mode 100755 index 0000000..3395c2f --- /dev/null +++ b/Source/DirectFB/wm/unique/Makefile.am @@ -0,0 +1,150 @@ +## Makefile.am for DirectFB/wm/unique + +SUBDIRS = classes data devices + +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm \ + -I$(top_builddir)/wm + +bin_PROGRAMS = uwmdump + +noinst_PROGRAMS = test_color test_foo stret_test + + +uwmdump_SOURCES = uwmdump.c + +uwmdump_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +test_color_SOURCES = test_color.c + +test_color_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +test_foo_SOURCES = test_foo.c + +test_foo_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +stret_test_SOURCES = stret_test.c + +stret_test_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + + +# Set module installation directory +wmdir = $(MODULEDIR)/wm + +# Build wm module +wm_LTLIBRARIES = libdirectfbwm_unique.la + +if BUILD_STATIC +wm_DATA = libdirectfbwm_unique.o +endif + +libdirectfbwm_unique_la_SOURCES = \ + unique.c + +# Link module against uniquewm library +libdirectfbwm_unique_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la \ + libuniquewm.la + +libdirectfbwm_unique_la_LDFLAGS = \ + -avoid-version \ + -module + +# Set header installation directory +includedir = @INCLUDEDIR@/unique + +# Install uniquewm's library header files +include_HEADERS = \ + context.h \ + decoration.h \ + device.h \ + input_channel.h \ + input_events.h \ + input_switch.h \ + stret.h \ + stret_iteration.h \ + types.h \ + uniquewm.h \ + window.h + +# Build uniquewm library +lib_LTLIBRARIES = libuniquewm.la + +libuniquewm_la_SOURCES = \ + context.c \ + decoration.c \ + device.c \ + input_channel.c \ + input_switch.c \ + internal.h \ + stret.c \ + stret_iteration.c \ + uniquewm.c \ + window.c + +libuniquewm_la_LIBADD = \ + classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libuniquewm_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -release $(LT_RELEASE) \ + $(DFB_LDFLAGS) + + +include $(top_srcdir)/rules/libobject.make + +# +## and now rebuild the static version with the *correct* object files +# +if BUILD_STATIC + +clean-local: + rm -f libuniquewm_fixed.a + +all-local: libuniquewm_fixed.a + +libuniquewm_fixed.a: .libs/libuniquewm.a + rm -f libuniquewm_fixed.a + ${AR} cru libuniquewm_fixed.a `find . -name "*.o" | grep -v '.libs'` + ${RANLIB} libuniquewm_fixed.a + cp -pf libuniquewm_fixed.a .libs/libuniquewm.a + +.libs/libuniquewm.a: libuniquewm.la + +else + +clean-local: + +all-local: + +endif diff --git a/Source/DirectFB/wm/unique/Makefile.in b/Source/DirectFB/wm/unique/Makefile.in new file mode 100755 index 0000000..23aeb55 --- /dev/null +++ b/Source/DirectFB/wm/unique/Makefile.in @@ -0,0 +1,979 @@ +# 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@ +bin_PROGRAMS = uwmdump$(EXEEXT) +noinst_PROGRAMS = test_color$(EXEEXT) test_foo$(EXEEXT) \ + stret_test$(EXEEXT) +DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/rules/libobject.make +subdir = wm/unique +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)$(libdir)" "$(DESTDIR)$(wmdir)" \ + "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wmdir)" \ + "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +wmLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) $(wm_LTLIBRARIES) +libdirectfbwm_unique_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la libuniquewm.la +am_libdirectfbwm_unique_la_OBJECTS = unique.lo +libdirectfbwm_unique_la_OBJECTS = \ + $(am_libdirectfbwm_unique_la_OBJECTS) +libdirectfbwm_unique_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfbwm_unique_la_LDFLAGS) $(LDFLAGS) -o $@ +libuniquewm_la_DEPENDENCIES = classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_libuniquewm_la_OBJECTS = context.lo decoration.lo device.lo \ + input_channel.lo input_switch.lo stret.lo stret_iteration.lo \ + uniquewm.lo window.lo +libuniquewm_la_OBJECTS = $(am_libuniquewm_la_OBJECTS) +libuniquewm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libuniquewm_la_LDFLAGS) $(LDFLAGS) -o $@ +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_stret_test_OBJECTS = stret_test.$(OBJEXT) +stret_test_OBJECTS = $(am_stret_test_OBJECTS) +stret_test_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la +am_test_color_OBJECTS = test_color.$(OBJEXT) +test_color_OBJECTS = $(am_test_color_OBJECTS) +test_color_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_test_foo_OBJECTS = test_foo.$(OBJEXT) +test_foo_OBJECTS = $(am_test_foo_OBJECTS) +test_foo_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_uwmdump_OBJECTS = uwmdump.$(OBJEXT) +uwmdump_OBJECTS = $(am_uwmdump_OBJECTS) +uwmdump_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +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 = $(libdirectfbwm_unique_la_SOURCES) $(libuniquewm_la_SOURCES) \ + $(stret_test_SOURCES) $(test_color_SOURCES) \ + $(test_foo_SOURCES) $(uwmdump_SOURCES) +DIST_SOURCES = $(libdirectfbwm_unique_la_SOURCES) \ + $(libuniquewm_la_SOURCES) $(stret_test_SOURCES) \ + $(test_color_SOURCES) $(test_foo_SOURCES) $(uwmdump_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +wmDATA_INSTALL = $(INSTALL_DATA) +DATA = $(wm_DATA) +includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +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@ + +# Set header installation directory +includedir = @INCLUDEDIR@/unique +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@ +SUBDIRS = classes data devices +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm \ + -I$(top_builddir)/wm + +uwmdump_SOURCES = uwmdump.c +uwmdump_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +test_color_SOURCES = test_color.c +test_color_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +test_foo_SOURCES = test_foo.c +test_foo_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +stret_test_SOURCES = stret_test.c +stret_test_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + + +# Set module installation directory +wmdir = $(MODULEDIR)/wm + +# Build wm module +wm_LTLIBRARIES = libdirectfbwm_unique.la +@BUILD_STATIC_TRUE@wm_DATA = libdirectfbwm_unique.o +libdirectfbwm_unique_la_SOURCES = \ + unique.c + + +# Link module against uniquewm library +libdirectfbwm_unique_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la \ + libuniquewm.la + +libdirectfbwm_unique_la_LDFLAGS = \ + -avoid-version \ + -module + + +# Install uniquewm's library header files +include_HEADERS = \ + context.h \ + decoration.h \ + device.h \ + input_channel.h \ + input_events.h \ + input_switch.h \ + stret.h \ + stret_iteration.h \ + types.h \ + uniquewm.h \ + window.h + + +# Build uniquewm library +lib_LTLIBRARIES = libuniquewm.la +libuniquewm_la_SOURCES = \ + context.c \ + decoration.c \ + device.c \ + input_channel.c \ + input_switch.c \ + internal.h \ + stret.c \ + stret_iteration.c \ + uniquewm.c \ + window.c + +libuniquewm_la_LIBADD = \ + classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libuniquewm_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -release $(LT_RELEASE) \ + $(DFB_LDFLAGS) + +all: all-recursive + +.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 wm/unique/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/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-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_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 +install-wmLTLIBRARIES: $(wm_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + else :; fi; \ + done + +uninstall-wmLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(wmdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(wmdir)/$$p"; \ + done + +clean-wmLTLIBRARIES: + -test -z "$(wm_LTLIBRARIES)" || rm -f $(wm_LTLIBRARIES) + @list='$(wm_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 +libdirectfbwm_unique.la: $(libdirectfbwm_unique_la_OBJECTS) $(libdirectfbwm_unique_la_DEPENDENCIES) + $(libdirectfbwm_unique_la_LINK) -rpath $(wmdir) $(libdirectfbwm_unique_la_OBJECTS) $(libdirectfbwm_unique_la_LIBADD) $(LIBS) +libuniquewm.la: $(libuniquewm_la_OBJECTS) $(libuniquewm_la_DEPENDENCIES) + $(libuniquewm_la_LINK) -rpath $(libdir) $(libuniquewm_la_OBJECTS) $(libuniquewm_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +stret_test$(EXEEXT): $(stret_test_OBJECTS) $(stret_test_DEPENDENCIES) + @rm -f stret_test$(EXEEXT) + $(LINK) $(stret_test_OBJECTS) $(stret_test_LDADD) $(LIBS) +test_color$(EXEEXT): $(test_color_OBJECTS) $(test_color_DEPENDENCIES) + @rm -f test_color$(EXEEXT) + $(LINK) $(test_color_OBJECTS) $(test_color_LDADD) $(LIBS) +test_foo$(EXEEXT): $(test_foo_OBJECTS) $(test_foo_DEPENDENCIES) + @rm -f test_foo$(EXEEXT) + $(LINK) $(test_foo_OBJECTS) $(test_foo_LDADD) $(LIBS) +uwmdump$(EXEEXT): $(uwmdump_OBJECTS) $(uwmdump_DEPENDENCIES) + @rm -f uwmdump$(EXEEXT) + $(LINK) $(uwmdump_OBJECTS) $(uwmdump_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_channel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_switch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret_iteration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_foo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unique.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniquewm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uwmdump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.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-wmDATA: $(wm_DATA) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(wmDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(wmDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + done + +uninstall-wmDATA: + @$(NORMAL_UNINSTALL) + @list='$(wm_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(wmdir)/$$f'"; \ + rm -f "$(DESTDIR)$(wmdir)/$$f"; \ + done +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + 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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \ + all-local +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(wmdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wmdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-local clean-noinstPROGRAMS \ + clean-wmLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS install-wmDATA \ + install-wmLTLIBRARIES + +install-dvi: install-dvi-recursive + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-wmDATA \ + uninstall-wmLTLIBRARIES + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am all-local check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ + clean-noinstPROGRAMS clean-wmLTLIBRARIES ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip install-wmDATA \ + install-wmLTLIBRARIES installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-wmDATA uninstall-wmLTLIBRARIES + +%.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) + +# +# + +@BUILD_STATIC_TRUE@clean-local: +@BUILD_STATIC_TRUE@ rm -f libuniquewm_fixed.a + +@BUILD_STATIC_TRUE@all-local: libuniquewm_fixed.a + +@BUILD_STATIC_TRUE@libuniquewm_fixed.a: .libs/libuniquewm.a +@BUILD_STATIC_TRUE@ rm -f libuniquewm_fixed.a +@BUILD_STATIC_TRUE@ ${AR} cru libuniquewm_fixed.a `find . -name "*.o" | grep -v '.libs'` +@BUILD_STATIC_TRUE@ ${RANLIB} libuniquewm_fixed.a +@BUILD_STATIC_TRUE@ cp -pf libuniquewm_fixed.a .libs/libuniquewm.a + +@BUILD_STATIC_TRUE@.libs/libuniquewm.a: libuniquewm.la + +@BUILD_STATIC_FALSE@clean-local: + +@BUILD_STATIC_FALSE@all-local: +# 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/wm/unique/classes/Makefile.am b/Source/DirectFB/wm/unique/classes/Makefile.am new file mode 100755 index 0000000..85b10d2 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for DirectFB/wm/unique/classes + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + + +noinst_LTLIBRARIES = libunique_classes.la + +libunique_classes_la_SOURCES = \ + foo.c \ + frame.c \ + root.c \ + window.c diff --git a/Source/DirectFB/wm/unique/classes/Makefile.in b/Source/DirectFB/wm/unique/classes/Makefile.in new file mode 100755 index 0000000..7a43f3e --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/Makefile.in @@ -0,0 +1,527 @@ +# 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@ +subdir = wm/unique/classes +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libunique_classes_la_LIBADD = +am_libunique_classes_la_OBJECTS = foo.lo frame.lo root.lo window.lo +libunique_classes_la_OBJECTS = $(am_libunique_classes_la_OBJECTS) +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 = $(libunique_classes_la_SOURCES) +DIST_SOURCES = $(libunique_classes_la_SOURCES) +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)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + +noinst_LTLIBRARIES = libunique_classes.la +libunique_classes_la_SOURCES = \ + foo.c \ + frame.c \ + root.c \ + window.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu wm/unique/classes/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/classes/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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 +libunique_classes.la: $(libunique_classes_la_OBJECTS) $(libunique_classes_la_DEPENDENCIES) + $(LINK) $(libunique_classes_la_OBJECTS) $(libunique_classes_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.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 + +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) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-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 + +# 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/wm/unique/classes/foo.c b/Source/DirectFB/wm/unique/classes/foo.c new file mode 100755 index 0000000..3eafdd1 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/foo.c @@ -0,0 +1,232 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Foo, "UniQuE/Foo", "UniQuE's Foo Region Class" ); + +static DFBResult +foo_get_input( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + UniqueContext *context; + UniqueWindow *window = region_data; + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_channel != NULL ); + + D_DEBUG_AT( UniQuE_Foo, "foo_get_input( region %p, window %p, index %d, x %d, y %d )\n", + region, window, index, x, y ); + + switch (index) { + case UDCI_KEYBOARD: + case UDCI_WHEEL: + *ret_channel = window->channel; + break; + + case UDCI_POINTER: +// *ret_channel = window->channel; + *ret_channel = context->foo_channel; + break; + + default: + *ret_channel = NULL; + break; + } + + return DFB_OK; +} + +static void +foo_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + DFBRegion clip; + DFBDimension size; + bool visible; + WMShared *shared; + UniqueContext *context; + UniqueWindow *window = region_data; + CardState *state = update_data; + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + + D_ASSERT( region != NULL ); + D_ASSERT( region_data != NULL ); + D_ASSERT( update_data != NULL ); + D_ASSERT( updates != NULL ); + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( state, CardState ); + + shared = window->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( shared->foo_surface != NULL ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + visible = D_FLAGS_IS_SET( window->flags, UWF_VISIBLE ); + + D_DEBUG_AT( UniQuE_Foo, "foo_update( region %p, window %p, visible %s, num %d )\n", + region, window, visible ? "yes" : "no", num ); +#if D_DEBUG_ENABLED + for (i=0; iopacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != window->opacity) { + state->color.a = window->opacity; + state->modified |= SMF_COLOR; + } + } + + /* Use colorizing if the color is not white. */ + if (context->color.r != 0xff || context->color.g != 0xff || context->color.b != 0xff) { + flags |= DSBLIT_COLORIZE; + + state->color.r = context->color.r; + state->color.g = context->color.g; + state->color.b = context->color.b; + + state->modified |= SMF_COLOR; + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = shared->foo_surface; + state->modified |= SMF_SOURCE; + + switch (arg) { + case UFI_N: + case UFI_E: + case UFI_S: + case UFI_W: + clip = state->clip; + +/* for (i=0; ifoo_rects[arg]; + DFBRectangle dest = { x, y, size.w, size.h }; + + dfb_state_set_clip( state, &update ); + + dfb_gfxcard_stretchblit( &source, &dest, state ); + }*/ + for (i=0; ifoo_rects[arg]; + + dfb_state_set_clip( state, &update ); + + dfb_gfxcard_tileblit( &source, x, y, x + size.w - 1, y + size.h - 1, state ); + } + + dfb_state_set_clip( state, &clip ); + break; + + case UFI_NE: + case UFI_SE: + case UFI_SW: + case UFI_NW: + for (i=0; ifoo_rects[arg].x, shared->foo_rects[arg].y ); + + dfb_gfxcard_blit( &rect, x + updates[i].x1, y + updates[i].y1, state ); + } + break; + + default: + D_BUG( "invalid arg" ); + } + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +const StretRegionClass unique_foo_region_class = { + .GetInput = foo_get_input, + .Update = foo_update, +}; + diff --git a/Source/DirectFB/wm/unique/classes/frame.c b/Source/DirectFB/wm/unique/classes/frame.c new file mode 100755 index 0000000..a07ad03 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/frame.c @@ -0,0 +1,53 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +//D_DEBUG_DOMAIN( UniQuE_Frame, "UniQuE/Frame", "UniQuE's Frame Region Class" ); + +const StretRegionClass unique_frame_region_class = { + .GetInput = NULL, +}; + diff --git a/Source/DirectFB/wm/unique/classes/root.c b/Source/DirectFB/wm/unique/classes/root.c new file mode 100755 index 0000000..72dcf87 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/root.c @@ -0,0 +1,206 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Root, "UniQuE/Root", "UniQuE's Root Region Class" ); + + +static void +root_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + CoreWindowStack *stack; + UniqueContext *context = region_data; + CardState *state = update_data; + + D_ASSERT( region != NULL ); + D_ASSERT( region_data != NULL ); + D_ASSERT( update_data != NULL ); + D_ASSERT( updates != NULL ); + + D_ASSERT( x == 0 ); + D_ASSERT( y == 0 ); + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( state, CardState ); + + stack = context->stack; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->bg.image != NULL || (stack->bg.mode != DLBM_IMAGE && + stack->bg.mode != DLBM_TILE) ); + + D_DEBUG_AT( UniQuE_Root, "root_update( region %p, num %d )\n", region, num ); +#if D_DEBUG_ENABLED + for (i=0; ibg.mode) { + case DLBM_COLOR: { + CoreSurface *dest = state->destination; + DFBColor *color = &stack->bg.color; + DFBRectangle rects[num]; + + /* Set the background color. */ + if (DFB_PIXELFORMAT_IS_INDEXED( dest->config.format )) + dfb_state_set_color_index( state, + dfb_palette_search( dest->palette, color->r, + color->g, color->b, color->a ) ); + else + dfb_state_set_color( state, color ); + + for (i=0; ibg.image; + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); + + /* Check the size of the background image. */ + if (bg->config.size.w == stack->width && bg->config.size.h == stack->height) { + for (i=0; iclip; + + for (i=0; iconfig.size.w, bg->config.size.h }; + DFBRectangle dst = { 0, 0, stack->width, stack->height }; + + /* Change clipping region. */ + dfb_state_set_clip( state, &updates[i] ); + + /* Stretch blit for non fitting background images. */ + dfb_gfxcard_stretchblit( &src, &dst, state ); + } + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + } + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_TILE: { + CoreSurface *bg = stack->bg.image; + DFBRegion clip = state->clip; + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); + + for (i=0; iconfig.size.w, bg->config.size.h }; + + /* Change clipping region. */ + dfb_state_set_clip( state, &updates[i] ); + + /* Tiled blit (aligned). */ + dfb_gfxcard_tileblit( &src, 0, 0, stack->width, stack->height, state ); + } + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_DONTCARE: + break; + + default: + D_BUG( "unknown background mode" ); + break; + } +} + +/* + * The root region is the desktop background. + */ +const StretRegionClass unique_root_region_class = { + .Update = root_update, +}; + diff --git a/Source/DirectFB/wm/unique/classes/window.c b/Source/DirectFB/wm/unique/classes/window.c new file mode 100755 index 0000000..db9cbaf --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/window.c @@ -0,0 +1,165 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Window, "UniQuE/WindowReg", "UniQuE's Window Region Class" ); + +static DFBResult +window_get_input( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + UniqueWindow *window = region_data; + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( ret_channel != NULL ); + + D_DEBUG_AT( UniQuE_Window, "window_get_input( region %p, window %p, index %d, x %d, y %d )\n", + region, window, index, x, y ); + + *ret_channel = window->channel; + + return DFB_OK; +} + +static void +window_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + UniqueWindow *window = region_data; + CardState *state = update_data; + bool alpha = arg; + bool visible; + + D_ASSERT( updates != NULL ); + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( state, CardState ); + + D_ASSERT( window->surface != NULL ); + + visible = D_FLAGS_IS_SET( window->flags, UWF_VISIBLE ); + + D_DEBUG_AT( UniQuE_Window, "window_update( region %p, window %p, visible %s, num %d )\n", + region, window, visible ? "yes" : "no", num ); +#if D_DEBUG_ENABLED + for (i=0; ioptions & DWOP_ALPHACHANNEL)) + flags |= DSBLIT_BLEND_ALPHACHANNEL; + + /* Use global alpha blending. */ + if (window->opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != window->opacity) { + state->color.a = window->opacity; + state->modified |= SMF_COLOR; + } + } + + /* Use source color keying. */ + if (window->options & DWOP_COLORKEYING) { + flags |= DSBLIT_SRC_COLORKEY; + + /* Set window color key. */ + dfb_state_set_src_colorkey( state, window->color_key ); + } + + /* Use automatic deinterlacing. */ + if (window->surface->config.caps & DSCAPS_INTERLACED) + flags |= DSBLIT_DEINTERLACE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = window->surface; + state->modified |= SMF_SOURCE; + + for (i=0; isource = NULL; + state->modified |= SMF_SOURCE; +} + +const StretRegionClass unique_window_region_class = { + .GetInput = window_get_input, + .Update = window_update, +}; + diff --git a/Source/DirectFB/wm/unique/context.c b/Source/DirectFB/wm/unique/context.c new file mode 100755 index 0000000..cb77b39 --- /dev/null +++ b/Source/DirectFB/wm/unique/context.c @@ -0,0 +1,711 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include /* FIXME */ +#include +#include +#include +#include /* FIXME */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Context, "UniQuE/Context", "UniQuE's Stack Context" ); + + +static const ReactionFunc unique_context_globals[] = { + _unique_wm_module_context_listener, + NULL +}; + +/**************************************************************************************************/ + +static void +context_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + int i; + UniqueContext *context = (UniqueContext*) object; + + D_DEBUG_AT( UniQuE_Context, "destroying %p (stack %p)%s\n", + context, context->stack, zombie ? " (ZOMBIE)" : ""); + + D_ASSUME( fusion_vector_is_empty( &context->windows ) ); + + unique_context_notify( context, UCNF_DESTROYED ); + + unique_device_detach_global( context->devices[UDCI_POINTER], &context->cursor_reaction ); + + + unique_input_switch_drop( context->input_switch, context->foo_channel ); + + unique_input_channel_destroy( context->foo_channel ); + + unique_input_switch_destroy( context->input_switch ); + + + for (i=0; i<_UDCI_NUM; i++) + unique_device_destroy( context->devices[i] ); + + + while (fusion_vector_has_elements( &context->windows )) { + unique_window_destroy( fusion_vector_at( &context->windows, 0 ) ); + } + + stret_region_destroy( context->root ); + + + fusion_vector_destroy( &context->windows ); + + dfb_surface_unlink( &context->surface ); + + dfb_layer_region_unlink( &context->region ); + + D_MAGIC_CLEAR( context ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_context_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Context Pool", sizeof(UniqueContext), + sizeof(UniqueContextNotification), context_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +static DFBEnumerationResult +connect_device( CoreInputDevice *source, + void *ctx ) +{ + UniqueDevice *device = ctx; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + unique_device_connect( device, source ); + + return DFENUM_OK; +} + +static DFBResult +create_devices( CoreDFB *core, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBResult ret; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_UDCI_NUM; i++) { + DFBInputDeviceCapabilities caps; + + ret = unique_device_create( core, context, shared->device_classes[i], + context, &context->devices[i] ); + if (ret) + goto error; + + ret = unique_input_switch_add( context->input_switch, context->devices[i] ); + if (ret) + goto error_add; + + switch (i) { + case UDCI_POINTER: + caps = DICAPS_AXES | DICAPS_BUTTONS; + break; + + case UDCI_WHEEL: + caps = DICAPS_AXES; + break; + + case UDCI_KEYBOARD: + caps = DICAPS_KEYS; + break; + + default: + caps = DICAPS_ALL; + break; + } + + dfb_input_enumerate_devices( connect_device, context->devices[i], caps ); + } + + return DFB_OK; + + +error_add: + unique_device_destroy( context->devices[i] ); + +error: + while (--i >= 0) + unique_device_destroy( context->devices[i] ); + + return ret; +} + +/**************************************************************************************************/ + +DFBResult +unique_context_create( CoreDFB *core, + CoreWindowStack *stack, + CoreLayerRegion *region, + DFBDisplayLayerID layer_id, + WMShared *shared, + UniqueContext **ret_context ) +{ + int i; + DFBResult ret; + UniqueContext *context; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( ret_context != NULL ); + + context = unique_wm_create_context(); + if (!context) + return DFB_FUSION; + + context->stack = stack; + context->shared = shared; + context->layer_id = layer_id; + context->color = (DFBColor) { 0xff, 0xa0, 0xd0, 0xf0 }; + context->shmpool = stack->shmpool; + + fusion_vector_init( &context->windows, 16, context->shmpool ); + + /* Create Root Region. */ + ret = stret_region_create( shared->region_classes[URCI_ROOT], context, 0, + SRF_ACTIVE | SRF_OUTPUT, _UNRL_NUM, + 0, 0, INT_MAX, INT_MAX, + NULL, 0, context->shmpool, &context->root ); + if (ret) + goto error; + + /* Link layer region. */ + ret = dfb_layer_region_link( &context->region, region ); + if (ret) + goto error; + + /* Get the region's surface. */ + ret = dfb_layer_region_get_surface( region, &context->surface ); + if (ret) + goto error; + + /* Make it global. */ + ret = dfb_surface_globalize( context->surface ); + if (ret) { + dfb_surface_unref( context->surface ); + goto error; + } + + D_MAGIC_SET( context, UniqueContext ); + + ret = unique_input_switch_create( context, &context->input_switch ); + if (ret) + goto error_switch; + + ret = create_devices( core, context, shared ); + if (ret) + goto error_devices; + + ret = unique_input_channel_create( core, context, &context->foo_channel ); + if (ret) + goto error_foo_channel; + + ret = unique_device_attach_global( context->devices[UDCI_POINTER], + UNIQUE_CURSOR_DEVICE_LISTENER, + context, &context->cursor_reaction ); + if (ret) + goto error_attach_cursor; + + /* Change global reaction lock. */ + fusion_object_set_lock( &context->object, &context->stack->context->lock ); + + /* Activate Object. */ + fusion_object_activate( &context->object ); + + /* Return new context. */ + *ret_context = context; + + return DFB_OK; + + +error_attach_cursor: + unique_input_channel_destroy( context->foo_channel ); + +error_foo_channel: + for (i=0; i<_UDCI_NUM; i++) + unique_device_destroy( context->devices[i] ); + +error_devices: + unique_input_switch_destroy( context->input_switch ); + +error_switch: + D_MAGIC_CLEAR( context ); + + dfb_surface_unlink( &context->surface ); + +error: + if (context->region) + dfb_layer_region_unlink( &context->region ); + + if (context->root) + stret_region_destroy( context->root ); + + fusion_vector_destroy( &context->windows ); + + fusion_object_destroy( &context->object ); + + return ret; +} + +DFBResult +unique_context_notify( UniqueContext *context, + UniqueContextNotificationFlags flags ) +{ + UniqueContextNotification notification; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( flags != UCNF_NONE ); + + D_ASSERT( ! (flags & ~UCNF_ALL) ); + + notification.flags = flags; + notification.context = context; + + return unique_context_dispatch( context, ¬ification, unique_context_globals ); +} + +DFBResult +unique_context_set_active( UniqueContext *context, + bool active ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSUME( context->active != active ); + + if (context->active == active) + return DFB_OK; + + context->active = active; + + if (active) + return dfb_windowstack_repaint_all( context->stack ); + + /* Force release of all pressed keys. */ + return unique_context_flush_keys( context ); +} + +DFBResult +unique_context_set_color( UniqueContext *context, + const DFBColor *color ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( color != NULL ); + + context->color = *color; + + return dfb_windowstack_repaint_all( context->stack ); +} + +/* HACK: dumped in here for now, will move into cursor class */ +void +unique_draw_cursor( CoreWindowStack *stack, UniqueContext *context, CardState *state, DFBRegion *region ) +{ + DFBRectangle src; + DFBSurfaceBlittingFlags flags = DSBLIT_BLEND_ALPHACHANNEL; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( state, CardState ); + DFB_REGION_ASSERT( region ); + + D_ASSUME( stack->cursor.opacity > 0 ); + + /* Initialize source rectangle. */ + src.x = region->x1 - stack->cursor.x + stack->cursor.hot.x; + src.y = region->y1 - stack->cursor.y + stack->cursor.hot.y; + src.w = region->x2 - region->x1 + 1; + src.h = region->y2 - region->y1 + 1; + + /* Use global alpha blending. */ + if (stack->cursor.opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != stack->cursor.opacity) { + state->color.a = stack->cursor.opacity; + state->modified |= SMF_COLOR; + } + } + + /* Different compositing methods depending on destination format. */ + if (flags & DSBLIT_BLEND_ALPHACHANNEL) { + if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->config.format )) { + /* + * Always use compliant Porter/Duff SRC_OVER, + * if the destination has an alpha channel. + * + * Cd = destination color (non-premultiplied) + * Ad = destination alpha + * + * Cs = source color (non-premultiplied) + * As = source alpha + * + * Ac = color alpha + * + * cd = Cd * Ad (premultiply destination) + * cs = Cs * As (premultiply source) + * + * The full equation to calculate resulting color and alpha (premultiplied): + * + * cx = cd * (1-As*Ac) + cs * Ac + * ax = Ad * (1-As*Ac) + As * Ac + */ + dfb_state_set_src_blend( state, DSBF_ONE ); + + /* Need to premultiply source with As*Ac or only with Ac? */ + if (! (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED)) + flags |= DSBLIT_SRC_PREMULTIPLY; + else if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + /* Need to premultiply/demultiply destination? */ +// if (! (state->destination->caps & DSCAPS_PREMULTIPLIED)) +// flags |= DSBLIT_DST_PREMULTIPLY | DSBLIT_DEMULTIPLY; + } + else { + /* + * We can avoid DSBLIT_SRC_PREMULTIPLY for destinations without an alpha channel + * by using another blending function, which is more likely that it's accelerated + * than premultiplication at this point in time. + * + * This way the resulting alpha (ax) doesn't comply with SRC_OVER, + * but as the destination doesn't have an alpha channel it's no problem. + * + * As the destination's alpha value is always 1.0 there's no need for + * premultiplication. The resulting alpha value will also be 1.0 without + * exceptions, therefore no need for demultiplication. + * + * cx = Cd * (1-As*Ac) + Cs*As * Ac (still same effect as above) + * ax = Ad * (1-As*Ac) + As*As * Ac (wrong, but discarded anyways) + */ + if (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED) { + /* Need to premultiply source with Ac? */ + if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + dfb_state_set_src_blend( state, DSBF_ONE ); + } + else + dfb_state_set_src_blend( state, DSBF_SRCALPHA ); + } + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = stack->cursor.surface; + state->modified |= SMF_SOURCE; + + /* Blit from the window to the region being updated. */ + dfb_gfxcard_blit( &src, region->x1, region->y1, state ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +DFBResult +unique_context_update( UniqueContext *context, + const DFBRegion *updates, + int num, + DFBSurfaceFlipFlags flags ) +{ + int i; + CoreLayer *layer; + CardState *state; + int count = 0; + DFBRegion root; + DFBRegion regions[num]; + DFBRegion cursor_inter; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_ASSERT( context->stack != NULL ); + + D_ASSERT( updates != NULL ); + D_ASSERT( num > 0 ); + + if (!context->active) + return DFB_OK; + + D_DEBUG_AT( UniQuE_Context, "unique_context_update( num %d, flags 0x%08x )\n", num, flags ); + + layer = dfb_layer_at( context->layer_id ); + state = dfb_layer_state( layer ); + + root = DFB_REGION_INIT_FROM_RECTANGLE_VALS( 0, 0, context->width, context->height ); + + for (i=0; i No intersection with root!\n" ); + return DFB_OK; + } + + /* Set destination. */ + state->destination = context->surface; + state->modified |= SMF_DESTINATION; + + for (i=0; iroot, update, state ); + + /* Update cursor? */ + cursor_inter = context->cursor_region; + if (context->cursor_drawn && dfb_region_region_intersect( &cursor_inter, update )) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &cursor_inter ); + + D_ASSUME( context->cursor_bs_valid ); + + dfb_gfx_copy_to( context->surface, context->cursor_bs, &rect, + rect.x - context->cursor_region.x1, + rect.y - context->cursor_region.y1, true ); + + unique_draw_cursor( context->stack, context, state, &cursor_inter ); + } + } + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + /* Software cursor code relies on a valid back buffer. */ + if (context->stack->cursor.enabled) + flags |= DSFLIP_BLIT; + + /* Flip all updated regions. */ + for (i=0; iregion, update, flags ); + } + + return DFB_OK; +} + +DFBResult +unique_context_resize( UniqueContext *context, + int width, + int height ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + context->width = width; + context->height = height; + + stret_region_resize( context->root, width, height ); + + return DFB_OK; +} + +DFBResult +unique_context_flush_keys( UniqueContext *context ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + return DFB_OK; +} + +DFBResult +unique_context_window_at( UniqueContext *context, + int x, + int y, + UniqueWindow **ret_window ) +{ + int i; + CoreWindowStack *stack; + WMShared *shared; + UniqueWindow *window = NULL; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_window != NULL ); + + stack = context->stack; + shared = context->shared; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( shared, WMShared ); + + if (stack->cursor.enabled) { + StretRegion *region; + + if (x < 0) + x = stack->cursor.x; + if (y < 0) + y = stack->cursor.y; + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region && (region->clazz == shared->region_classes[URCI_FOO] || + region->clazz == shared->region_classes[URCI_WINDOW])) + { + window = stret_region_data( region ); + + D_MAGIC_ASSERT( window, UniqueWindow ); + } + } + else { + fusion_vector_foreach_reverse (window, i, context->windows) + if (window->opacity && !(window->options & DWOP_GHOST)) + break; + + if (i < 0) + window = NULL; + } + + D_MAGIC_ASSERT_IF( window, UniqueWindow ); + + *ret_window = window; + + return DFB_OK; +} + +DFBResult +unique_context_lookup_window( UniqueContext *context, + DFBWindowID window_id, + UniqueWindow **ret_window ) +{ + int i; + UniqueWindow *window = NULL; + + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + fusion_vector_foreach_reverse (window, i, context->windows) { + if (window->window->id == window_id) + break; + } + + *ret_window = window; + + return DFB_OK; +} + +DFBResult +unique_context_enum_windows( UniqueContext *context, + CoreWMWindowCallback callback, + void *callback_ctx ) +{ + int i; + UniqueWindow *window = NULL; + + D_ASSERT( callback != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + fusion_vector_foreach_reverse (window, i, context->windows) { + if (callback( window->window, callback_ctx ) != DFENUM_OK) + break; + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +ReactionResult +_unique_cursor_device_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueContext *context = ctx; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_Context, "_unique_cursor_device_listener( %p, %p )\n", event, context ); + + switch (event->type) { + case UIET_MOTION: + dfb_windowstack_cursor_warp( context->stack, event->pointer.x, event->pointer.y ); + break; + + default: + break; + } + + return RS_OK; +} + diff --git a/Source/DirectFB/wm/unique/context.h b/Source/DirectFB/wm/unique/context.h new file mode 100755 index 0000000..5361caf --- /dev/null +++ b/Source/DirectFB/wm/unique/context.h @@ -0,0 +1,134 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__CONTEXT_H__ +#define __UNIQUE__CONTEXT_H__ + +#include + +#include + +#include + +#include + + +typedef enum { + UCNF_NONE = 0x00000000, + + UCNF_DESTROYED = 0x00000001, + + UCNF_WINDOW_ADDED = 0x00000010, + UCNF_WINDOW_REMOVED = 0x00000020, + + UCNF_ACTIVATE = 0x00000100, + UCNF_DEACTIVATE = 0x00000200, + + UCNF_RESIZE = 0x00001000, + + UCNF_WARP_CURSOR = 0x00010000, + + UCNF_ALL = 0x00011331 +} UniqueContextNotificationFlags; + +typedef struct { + UniqueContextNotificationFlags flags; + UniqueContext *context; + + DFBPoint pos; /* New cursor position (UCNF_WARP_CURSOR) */ + DFBDimension size; /* New root (desktop) size (UCNF_RESIZE) */ +} UniqueContextNotification; + + + +DFBResult unique_context_create ( CoreDFB *core, + CoreWindowStack *stack, + CoreLayerRegion *region, + DFBDisplayLayerID layer_id, + WMShared *shared, + UniqueContext **ret_context ); + +DFBResult unique_context_notify ( UniqueContext *context, + UniqueContextNotificationFlags flags ); + +DFBResult unique_context_set_active ( UniqueContext *context, + bool active ); + +DFBResult unique_context_set_color ( UniqueContext *context, + const DFBColor *color ); + + +DFBResult unique_context_update ( UniqueContext *context, + const DFBRegion *updates, + int num, + DFBSurfaceFlipFlags flags ); + +DFBResult unique_context_resize ( UniqueContext *context, + int width, + int height ); + +DFBResult unique_context_flush_keys ( UniqueContext *context ); + +DFBResult unique_context_window_at ( UniqueContext *context, + int x, + int y, + UniqueWindow **ret_window ); + +DFBResult unique_context_lookup_window( UniqueContext *context, + DFBWindowID window_id, + UniqueWindow **ret_window ); + +DFBResult unique_context_enum_windows ( UniqueContext *context, + CoreWMWindowCallback callback, + void *callback_ctx ); + +DFBResult unique_context_warp_cursor ( UniqueContext *context, + int x, + int y ); + + + +/* + * Creates a pool of context objects. + */ +FusionObjectPool *unique_context_pool_create( const FusionWorld *world ); + +/* + * Generates unique_context_ref(), unique_context_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueContext, unique_context ) + + +/* global reactions */ + +typedef enum { + UNIQUE_WM_MODULE_CONTEXT_LISTENER +} UNIQUE_CONTEXT_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/data/Makefile.am b/Source/DirectFB/wm/unique/data/Makefile.am new file mode 100755 index 0000000..cd63bfb --- /dev/null +++ b/Source/DirectFB/wm/unique/data/Makefile.am @@ -0,0 +1,31 @@ +## Makefile.am for DirectFB/wm/unique/data + +uniquedatadir = $(DATADIR)/unique + +all-local: foo.h + +clean-local: + rm -f foo.h + +EXTRA_DIST = \ + foo_n.png \ + foo_ne.png \ + foo_e.png \ + foo_se.png \ + foo_s.png \ + foo_sw.png \ + foo_w.png \ + foo_nw.png + +if CROSS_COMPILING + directfb_csource = $(DIRECTFB_CSOURCE) +else +if BUILD_TOOLS + directfb_csource = $(top_builddir)/tools/directfb-csource +else + directfb_csource = $(DIRECTFB_CSOURCE) +endif +endif + +foo.h: $(EXTRA_DIST) + $(directfb_csource) --name=foo $(EXTRA_DIST:%=$(srcdir)/%) > foo.h diff --git a/Source/DirectFB/wm/unique/data/Makefile.in b/Source/DirectFB/wm/unique/data/Makefile.in new file mode 100755 index 0000000..ad17ea8 --- /dev/null +++ b/Source/DirectFB/wm/unique/data/Makefile.in @@ -0,0 +1,420 @@ +# 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@ +subdir = wm/unique/data +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +SOURCES = +DIST_SOURCES = +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@ +uniquedatadir = $(DATADIR)/unique +EXTRA_DIST = \ + foo_n.png \ + foo_ne.png \ + foo_e.png \ + foo_se.png \ + foo_s.png \ + foo_sw.png \ + foo_w.png \ + foo_nw.png + +@BUILD_TOOLS_FALSE@@CROSS_COMPILING_FALSE@directfb_csource = $(DIRECTFB_CSOURCE) +@BUILD_TOOLS_TRUE@@CROSS_COMPILING_FALSE@directfb_csource = $(top_builddir)/tools/directfb-csource +@CROSS_COMPILING_TRUE@directfb_csource = $(DIRECTFB_CSOURCE) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu wm/unique/data/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/data/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 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +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 all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + + +all-local: foo.h + +clean-local: + rm -f foo.h + +foo.h: $(EXTRA_DIST) + $(directfb_csource) --name=foo $(EXTRA_DIST:%=$(srcdir)/%) > foo.h +# 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/wm/unique/data/foo_e.png b/Source/DirectFB/wm/unique/data/foo_e.png new file mode 100755 index 0000000..db1d2d9 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_e.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_n.png b/Source/DirectFB/wm/unique/data/foo_n.png new file mode 100755 index 0000000..ed915dc Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_n.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_ne.png b/Source/DirectFB/wm/unique/data/foo_ne.png new file mode 100755 index 0000000..0d94587 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_ne.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_nw.png b/Source/DirectFB/wm/unique/data/foo_nw.png new file mode 100755 index 0000000..a411202 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_nw.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_s.png b/Source/DirectFB/wm/unique/data/foo_s.png new file mode 100755 index 0000000..fe4e9ff Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_s.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_se.png b/Source/DirectFB/wm/unique/data/foo_se.png new file mode 100755 index 0000000..4e15605 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_se.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_sw.png b/Source/DirectFB/wm/unique/data/foo_sw.png new file mode 100755 index 0000000..8cb7617 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_sw.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_w.png b/Source/DirectFB/wm/unique/data/foo_w.png new file mode 100755 index 0000000..6e75788 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_w.png differ diff --git a/Source/DirectFB/wm/unique/decoration.c b/Source/DirectFB/wm/unique/decoration.c new file mode 100755 index 0000000..5b98dcd --- /dev/null +++ b/Source/DirectFB/wm/unique/decoration.c @@ -0,0 +1,190 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include + +#include + +#include +#include /* FIXME */ +#include /* FIXME */ + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Decoration, "UniQuE/Decoration", "UniQuE's Decoration Object" ); + + +static const ReactionFunc unique_decoration_globals[] = { +/* _unique_foo_decoration_listener,*/ + NULL +}; + +/**************************************************************************************************/ + +static void +decoration_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + UniqueDecoration *decoration = (UniqueDecoration*) object; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_DEBUG_AT( UniQuE_Decoration, "destroying %p%s\n", decoration, zombie ? " (ZOMBIE)" : ""); + + unique_window_unlink( &decoration->window ); + unique_context_unlink( &decoration->context ); + + D_MAGIC_CLEAR( decoration ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_decoration_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Decoration Pool", + sizeof(UniqueDecoration), + sizeof(UniqueDecorationNotification), + decoration_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +DFBResult +unique_decoration_create( UniqueWindow *window, + UniqueDecorationFlags flags, + UniqueDecoration **ret_decoration ) +{ + DFBResult ret; + UniqueDecoration *decoration; + UniqueContext *context; + + D_ASSERT( window != NULL ); + D_ASSERT( D_FLAGS_ARE_IN( flags, UDF_ALL ) ); + D_ASSERT( ret_decoration != NULL ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + + /* Create a decoration object. */ + decoration = unique_wm_create_decoration(); + if (!decoration) + return DFB_FUSION; + + /* Initialize deocration data. */ + decoration->flags = flags; + + ret = unique_window_link( &decoration->window, window ); + if (ret) + goto error; + + ret = unique_context_link( &decoration->context, window->context ); + if (ret) + goto error; + + + D_MAGIC_SET( decoration, UniqueDecoration ); + + + /* Change global reaction lock. */ + fusion_object_set_lock( &decoration->object, &context->stack->context->lock ); + + /* activate object */ + fusion_object_activate( &decoration->object ); + + /* return the new decoration */ + *ret_decoration = decoration; + + return DFB_OK; + +error: + if (decoration->context) + unique_context_unlink( &decoration->context ); + + if (decoration->window) + unique_window_unlink( &decoration->window ); + + fusion_object_destroy( &decoration->object ); + + return ret; +} + +DFBResult +unique_decoration_destroy( UniqueDecoration *decoration ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_FLAGS_SET( decoration->flags, UDF_DESTROYED ); + + unique_decoration_notify( decoration, UDNF_DESTROYED ); + + return DFB_OK; +} + +DFBResult +unique_decoration_notify( UniqueDecoration *decoration, + UniqueDecorationNotificationFlags flags ) +{ + UniqueDecorationNotification notification; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_ASSERT( flags != UDNF_NONE ); + + D_ASSERT( ! (flags & ~UDNF_ALL) ); + + notification.flags = flags; + notification.decoration = decoration; + + return unique_decoration_dispatch( decoration, ¬ification, unique_decoration_globals ); +} + +DFBResult +unique_decoration_update( UniqueDecoration *decoration, + const DFBRegion *region ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + DFB_REGION_ASSERT_IF( region ); + + D_UNIMPLEMENTED(); + + return DFB_UNIMPLEMENTED; +} + diff --git a/Source/DirectFB/wm/unique/decoration.h b/Source/DirectFB/wm/unique/decoration.h new file mode 100755 index 0000000..47e9927 --- /dev/null +++ b/Source/DirectFB/wm/unique/decoration.h @@ -0,0 +1,132 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__DECORATION_H__ +#define __UNIQUE__DECORATION_H__ + +#include + +#include + +typedef enum { + UDF_NONE = 0x00000000, + + UDF_DESTROYED = 0x00000001, + + UDF_ALL = 0x00000001 +} UniqueDecorationFlags; + + +typedef enum { + UDNF_NONE = 0x00000000, + + UDNF_DESTROYED = 0x00000001, + + UDNF_ALL = 0x00000001 +} UniqueDecorationNotificationFlags; + +typedef struct { + UniqueDecorationNotificationFlags flags; + UniqueDecoration *decoration; +} UniqueDecorationNotification; + + +typedef enum { + UPOR_TOP_LEFT, + UPOR_TOP_MIDDLE, + UPOR_TOP_RIGHT, + UPOR_MIDDLE_LEFT, + UPOR_MIDDLE_MIDDLE, + UPOR_MIDDLE_RIGHT, + UPOR_BOTTOM_LEFT, + UPOR_BOTTOM_MIDDLE, + UPOR_BOTTOM_RIGHT +} UniquePointOfReference; + +typedef enum { + UDSM_BOTH_ABSOLUTE, + UDSM_BOTH_RELATIVE, + UDSM_ABSOLUTE_WIDTH, + UDSM_ABSOLUTE_HEIGHT +} UniqueDecorationSizeMode; + + +typedef struct { + const UniqueLayout *other; + UniquePointOfReference first; + UniquePointOfReference second; + DFBPoint offset; +} UniqueLayoutRelation; + +struct __UniQuE_UniqueLayout { + UniqueLayoutRelation origin; + UniqueLayoutRelation extent; + UniqueLayoutRelation optional; +}; + + + +DFBResult unique_decoration_create ( UniqueWindow *window, + UniqueDecorationFlags flags, + UniqueDecoration **ret_decoration ); + +DFBResult unique_decoration_destroy ( UniqueDecoration *decoration ); + + +DFBResult unique_decoration_notify ( UniqueDecoration *decoration, + UniqueDecorationNotificationFlags flags ); + + +DFBResult unique_decoration_update ( UniqueDecoration *decoration, + const DFBRegion *region ); + + +DFBResult unique_decoration_add_item( UniqueDecoration *decoration, + const UniqueLayout *layout, + UniqueDecorationItem **ret_item ); + +/* + * Creates a pool of decoration objects. + */ +FusionObjectPool *unique_decoration_pool_create( const FusionWorld *world ); + +/* + * Generates unique_decoration_ref(), unique_decoration_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueDecoration, unique_decoration ) + + +/* global reactions */ + +typedef enum { + UNIQUE_FOO_DECORATION_LISTENER +} UNIQUE_DECORATION_GLOBALS; + + +#endif + diff --git a/Source/DirectFB/wm/unique/device.c b/Source/DirectFB/wm/unique/device.c new file mode 100755 index 0000000..d6b5625 --- /dev/null +++ b/Source/DirectFB/wm/unique/device.c @@ -0,0 +1,495 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + + +#define MAX_CLASSES 16 + + +D_DEBUG_DOMAIN( UniQuE_Device, "UniQuE/Device", "UniQuE's Devices" ); + + +static const ReactionFunc unique_device_globals[] = { + _unique_input_switch_device_listener, + _unique_cursor_device_listener, + NULL +}; + +/**************************************************************************************************/ + +typedef struct { + DirectLink link; + + int magic; + + DFBInputDeviceID source; + + GlobalReaction reaction; +} DeviceConnection; + +/**************************************************************************************************/ + +static void purge_connection( UniqueDevice *device, + DeviceConnection *connection ); + +/**************************************************************************************************/ + +static const UniqueDeviceClass *classes[MAX_CLASSES] = { NULL }; + +static pthread_mutex_t classes_lock = PTHREAD_MUTEX_INITIALIZER; +static int classes_count = 0; + +/**************************************************************************************************/ + +DFBResult +unique_device_class_register( const UniqueDeviceClass *clazz, + UniqueDeviceClassID *ret_id ) +{ + int i; + + D_DEBUG_AT( UniQuE_Device, "unique_device_class_register( %p )\n", clazz ); + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_id != NULL ); + + pthread_mutex_lock( &classes_lock ); + + if (classes_count == MAX_CLASSES) { + D_WARN( "too many classes" ); + pthread_mutex_unlock( &classes_lock ); + return DFB_LIMITEXCEEDED; + } + + classes_count++; + + for (i=0; i New class ID is %d.\n", i ); + + D_ASSERT( i < MAX_CLASSES ); + + *ret_id = i; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +DFBResult +unique_device_class_unregister( UniqueDeviceClassID id ) +{ + D_DEBUG_AT( UniQuE_Device, "unique_device_class_unregister( %d )\n", id ); + + pthread_mutex_lock( &classes_lock ); + + D_ASSERT( id >= 0 ); + D_ASSERT( id < MAX_CLASSES ); + D_ASSERT( classes[id] != NULL ); + + classes[id] = NULL; + + classes_count--; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +DFBResult +unique_device_create( CoreDFB *core, + UniqueContext *context, + UniqueDeviceClassID class_id, + void *ctx, + UniqueDevice **ret_device ) +{ + DFBResult ret; + UniqueDevice *device; + const UniqueDeviceClass *clazz; + + D_DEBUG_AT( UniQuE_Device, "unique_device_create( class %d )\n", class_id ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + + clazz = classes[class_id]; + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_device != NULL ); + + /* Allocate device data. */ + device = SHCALLOC( context->shmpool, 1, sizeof(UniqueDevice) ); + if (!device) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize device data. */ + device->context = context; + device->clazz = class_id; + device->ctx = ctx; + + /* Allocate private device data. */ + if (clazz->data_size) { + device->data = SHCALLOC( context->shmpool, 1, clazz->data_size ); + if (!device->data) { + ret = D_OOSHM(); + goto error; + } + } + + /* Create reactor for dispatching generated events. */ + device->reactor = fusion_reactor_new( sizeof(UniqueInputEvent), + "UniQuE Device", dfb_core_world(core) ); + if (!device->reactor) { + ret = DFB_FUSION; + goto error; + } + + fusion_reactor_set_lock( device->reactor, &context->stack->context->lock ); + + D_MAGIC_SET( device, UniqueDevice ); + + if (clazz->Initialize) { + ret = clazz->Initialize( device, device->data, device->ctx ); + if (ret) { + D_MAGIC_CLEAR( device ); + goto error; + } + } + + D_DEBUG_AT( UniQuE_Device, " -> device created (%p)\n", device ); + + *ret_device = device; + + return DFB_OK; + + +error: + if (device->reactor) + fusion_reactor_free( device->reactor ); + + if (device->data) + SHFREE( context->shmpool, device->data ); + + SHFREE( context->shmpool, device ); + + return ret; +} + +DFBResult +unique_device_destroy( UniqueDevice *device ) +{ + DirectLink *n; + DeviceConnection *connection; + UniqueContext *context; + const UniqueDeviceClass *clazz; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + + clazz = classes[device->clazz]; + + D_ASSERT( clazz != NULL ); + + D_DEBUG_AT( UniQuE_Device, "unique_device_destroy( %p )\n", device ); + + direct_list_foreach_safe (connection, n, device->connections) { + D_MAGIC_ASSERT( connection, DeviceConnection ); + + purge_connection( device, connection ); + } + + D_ASSERT( device->connections == NULL ); + + if (clazz->Shutdown) + clazz->Shutdown( device, device->data, device->ctx ); + + fusion_reactor_free( device->reactor ); + + if (device->data) + SHFREE( context->shmpool, device->data ); + + D_MAGIC_CLEAR( device ); + + SHFREE( context->shmpool, device ); + + return DFB_OK; +} + +DFBResult +unique_device_connect( UniqueDevice *device, + CoreInputDevice *source ) +{ + DFBResult ret; + WMShared *shared; + UniqueContext *context; + DeviceConnection *connection; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( source != NULL ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + D_DEBUG_AT( UniQuE_Device, "unique_device_connect( %p, %p, ID %d )\n", + device, source, dfb_input_device_id( source ) ); + + /* Allocate connection structure. */ + connection = SHCALLOC( context->shmpool, 1, sizeof(DeviceConnection) ); + if (!connection) + return D_OOSHM(); + + /* Initialize connection structure. */ + connection->source = dfb_input_device_id( source ); + + /* Attach global reaction for processing events. */ + ret = dfb_input_attach_global( source, shared->device_listener, + device, &connection->reaction ); + if (ret) { + SHFREE( context->shmpool, connection ); + return ret; + } + + /* Add the new connection to the list. */ + direct_list_append( &device->connections, &connection->link ); + + D_MAGIC_SET( connection, DeviceConnection ); + + if (classes[device->clazz]->Connected) + classes[device->clazz]->Connected( device, device->data, device->ctx, source ); + + return DFB_OK; +} + +DFBResult +unique_device_disconnect( UniqueDevice *device, + CoreInputDevice *source ) +{ + DFBInputDeviceID source_id; + DeviceConnection *connection; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( source != NULL ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + + source_id = dfb_input_device_id( source ); + + direct_list_foreach (connection, device->connections) { + D_MAGIC_ASSERT( connection, DeviceConnection ); + + if (connection->source == source_id) + break; + } + + if (!connection) { + D_WARN( "source not found amoung connections" ); + return DFB_ITEMNOTFOUND; + } + + purge_connection( device, connection ); + + return DFB_OK; +} + +DFBResult +unique_device_attach( UniqueDevice *device, + ReactionFunc func, + void *ctx, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_attach( device->reactor, func, ctx, reaction ); +} + +DFBResult +unique_device_detach( UniqueDevice *device, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_detach( device->reactor, reaction ); +} + +DFBResult +unique_device_attach_global( UniqueDevice *device, + int index, + void *ctx, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_attach_global( device->reactor, index, ctx, reaction ); +} + +DFBResult +unique_device_detach_global( UniqueDevice *device, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_detach_global( device->reactor, reaction ); +} + +DFBResult +unique_device_dispatch( UniqueDevice *device, + const UniqueInputEvent *event ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_dispatch( device->reactor, event, true, unique_device_globals ); +} + +bool +unique_device_filter ( UniqueDeviceClassID class_id, + const UniqueInputEvent *event, + const UniqueInputEvent *filter ) +{ + const UniqueDeviceClass *clazz; + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + + D_ASSERT( event != NULL ); + D_ASSERT( filter != NULL ); + + clazz = classes[class_id]; + + D_ASSERT( clazz != NULL ); + + if (clazz->FilterEvent) + return clazz->FilterEvent( event, filter ); + + return false; +} + +/**************************************************************************************************/ + +ReactionResult +_unique_device_listener( const void *msg_data, + void *ctx ) +{ + const DFBInputEvent *event = msg_data; + UniqueDevice *device = ctx; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + D_ASSERT( classes[device->clazz]->ProcessEvent != NULL ); + + classes[device->clazz]->ProcessEvent( device, device->data, device->ctx, event ); + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +purge_connection( UniqueDevice *device, + DeviceConnection *connection ) +{ + CoreInputDevice *source; + UniqueContext *context; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( connection, DeviceConnection ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + source = dfb_input_device_at( connection->source ); + + D_ASSERT( source != NULL ); + + /* Detach global reaction for processing events. */ + dfb_input_detach_global( source, &connection->reaction ); + + direct_list_remove( &device->connections, &connection->link ); + + if (classes[device->clazz]->Disconnected) + classes[device->clazz]->Disconnected( device, device->data, device->ctx, source ); + + D_MAGIC_CLEAR( connection ); + + SHFREE( context->shmpool, connection ); +} + diff --git a/Source/DirectFB/wm/unique/device.h b/Source/DirectFB/wm/unique/device.h new file mode 100755 index 0000000..d03aa82 --- /dev/null +++ b/Source/DirectFB/wm/unique/device.h @@ -0,0 +1,139 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__DEVICE_H__ +#define __UNIQUE__DEVICE_H__ + +#include + +#include + +#include + +#include + + +typedef struct { + int data_size; + + + DFBResult (*Initialize) ( UniqueDevice *device, + void *data, + void *ctx ); + + void (*Shutdown) ( UniqueDevice *device, + void *data, + void *ctx ); + + + void (*Connected) ( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ); + + void (*Disconnected)( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ); + + void (*ProcessEvent)( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ); + + + bool (*FilterEvent) ( const UniqueInputEvent *event, + const UniqueInputEvent *filter ); +} UniqueDeviceClass; + +typedef unsigned int UniqueDeviceID; +typedef unsigned int UniqueDeviceClassID; + +typedef enum { + UDCI_POINTER, + UDCI_WHEEL, + UDCI_KEYBOARD, + + _UDCI_NUM +} UniqueDeviceClassIndex; + + +DFBResult unique_device_class_register ( const UniqueDeviceClass *clazz, + UniqueDeviceClassID *ret_id ); + +DFBResult unique_device_class_unregister( UniqueDeviceClassID id ); + + +DFBResult unique_device_create ( CoreDFB *core, + UniqueContext *context, + UniqueDeviceClassID class_id, + void *ctx, + UniqueDevice **ret_device ); + +DFBResult unique_device_destroy ( UniqueDevice *device ); + + +DFBResult unique_device_connect ( UniqueDevice *device, + CoreInputDevice *source ); + +DFBResult unique_device_disconnect ( UniqueDevice *device, + CoreInputDevice *source ); + +DFBResult unique_device_attach ( UniqueDevice *device, + ReactionFunc func, + void *ctx, + Reaction *reaction ); + +DFBResult unique_device_detach ( UniqueDevice *device, + Reaction *reaction ); + +DFBResult unique_device_attach_global( UniqueDevice *device, + int index, + void *ctx, + GlobalReaction *reaction ); + +DFBResult unique_device_detach_global( UniqueDevice *device, + GlobalReaction *reaction ); + +DFBResult unique_device_dispatch ( UniqueDevice *device, + const UniqueInputEvent *event ); + +bool unique_device_filter ( UniqueDeviceClassID class_id, + const UniqueInputEvent *event, + const UniqueInputEvent *filter ); + + +/* global reactions */ + +typedef enum { + UNIQUE_INPUT_SWITCH_DEVICE_LISTENER, + UNIQUE_CURSOR_DEVICE_LISTENER +} UNIQUE_DEVICE_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/devices/Makefile.am b/Source/DirectFB/wm/unique/devices/Makefile.am new file mode 100755 index 0000000..c42f697 --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/Makefile.am @@ -0,0 +1,21 @@ +## Makefile.am for DirectFB/wm/unique/devices + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + + +noinst_LTLIBRARIES = libunique_devices.la + +libunique_devices_la_SOURCES = \ + pointer.c \ + wheel.c \ + keyboard.c diff --git a/Source/DirectFB/wm/unique/devices/Makefile.in b/Source/DirectFB/wm/unique/devices/Makefile.in new file mode 100755 index 0000000..baef097 --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/Makefile.in @@ -0,0 +1,525 @@ +# 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@ +subdir = wm/unique/devices +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libunique_devices_la_LIBADD = +am_libunique_devices_la_OBJECTS = pointer.lo wheel.lo keyboard.lo +libunique_devices_la_OBJECTS = $(am_libunique_devices_la_OBJECTS) +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 = $(libunique_devices_la_SOURCES) +DIST_SOURCES = $(libunique_devices_la_SOURCES) +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)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + +noinst_LTLIBRARIES = libunique_devices.la +libunique_devices_la_SOURCES = \ + pointer.c \ + wheel.c \ + keyboard.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu wm/unique/devices/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/devices/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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 +libunique_devices.la: $(libunique_devices_la_OBJECTS) $(libunique_devices_la_DEPENDENCIES) + $(LINK) $(libunique_devices_la_OBJECTS) $(libunique_devices_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pointer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wheel.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 + +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) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-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 + +# 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/wm/unique/devices/keyboard.c b/Source/DirectFB/wm/unique/devices/keyboard.c new file mode 100755 index 0000000..fa4b94a --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/keyboard.c @@ -0,0 +1,192 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Keyboard, "UniQuE/Keyboard", "UniQuE's Keyboard Device Class" ); + + +typedef struct { + int magic; +} KeyboardData; + +/**************************************************************************************************/ + +static DFBResult +keyboard_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + KeyboardData *keyboard = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( keyboard, KeyboardData ); + + return DFB_OK; +} + +static void +keyboard_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + KeyboardData *keyboard = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( keyboard ); +} + +static void +keyboard_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +keyboard_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +keyboard_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + switch (event->type) { + case DIET_KEYPRESS: + case DIET_KEYRELEASE: + evt.type = UIET_KEY; + + evt.keyboard.device_id = event->device_id; + evt.keyboard.press = (event->type == DIET_KEYPRESS); + evt.keyboard.key_code = event->key_code; + evt.keyboard.key_id = event->key_id; + evt.keyboard.key_symbol = event->key_symbol; + evt.keyboard.modifiers = event->modifiers; + evt.keyboard.locks = event->locks; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } +} + +static bool +keyboard_filter_event( const UniqueInputEvent *event, + const UniqueInputEvent *filter ) +{ + D_ASSERT( event != NULL ); + D_ASSERT( filter != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_filter_event( %p, %p )\n", event, filter ); + + if (filter->keyboard.key_code != -1) + return (filter->keyboard.key_code == event->keyboard.key_code); + + return (event->keyboard.modifiers == filter->keyboard.modifiers && + event->keyboard.key_symbol == filter->keyboard.key_symbol); +} + + +const UniqueDeviceClass unique_keyboard_device_class = { + data_size: sizeof(KeyboardData), + + Initialize: keyboard_initialize, + Shutdown: keyboard_shutdown, + Connected: keyboard_connected, + Disconnected: keyboard_disconnected, + ProcessEvent: keyboard_process_event, + FilterEvent: keyboard_filter_event +}; + diff --git a/Source/DirectFB/wm/unique/devices/pointer.c b/Source/DirectFB/wm/unique/devices/pointer.c new file mode 100755 index 0000000..4434cba --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/pointer.c @@ -0,0 +1,259 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Pointer, "UniQuE/Pointer", "UniQuE's Pointer Device Class" ); + + +typedef struct { + int magic; + + int x; + int y; +} PointerData; + +/**************************************************************************************************/ + +static DFBResult +pointer_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + PointerData *pointer = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( pointer, PointerData ); + + return DFB_OK; +} + +static void +pointer_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + PointerData *pointer = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( pointer ); +} + +static void +pointer_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + PointerData *pointer = data; + + (void) pointer; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +pointer_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + PointerData *pointer = data; + + (void) pointer; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +pointer_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + PointerData *pointer = data; + UniqueContext *context = ctx; + CoreWindowStack *stack; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + stack = context->stack; + + D_ASSERT( stack != NULL ); + + switch (event->type) { + case DIET_AXISMOTION: { + /*int x = pointer->x; + int y = pointer->y;*/ + int x = stack->cursor.x; + int y = stack->cursor.y; + + if (event->flags & DIEF_AXISREL) { + int rel = event->axisrel; + + /* handle cursor acceleration */ + if (rel > stack->cursor.threshold) + rel += (rel - stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + else if (rel < -stack->cursor.threshold) + rel += (rel + stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + + switch (event->axis) { + case DIAI_X: + x += rel; + break; + + case DIAI_Y: + y += rel; + break; + + default: + return; + } + } + else if (event->flags & DIEF_AXISABS) { + switch (event->axis) { + case DIAI_X: + x = event->axisabs; + break; + + case DIAI_Y: + y = event->axisabs; + break; + + default: + return; + } + } + else + return; + + if (x < 0) + x = 0; + else if (x >= context->width) + x = context->width - 1; + + if (y < 0) + y = 0; + else if (y >= context->height) + y = context->height - 1; + + if (x == pointer->x && y == pointer->y) + return; + + pointer->x = x; + pointer->y = y; + + evt.type = UIET_MOTION; + + evt.pointer.device_id = event->device_id; + evt.pointer.x = x; + evt.pointer.y = y; + evt.pointer.buttons = event->buttons; + + unique_device_dispatch( device, &evt ); + break; + } + + case DIET_BUTTONPRESS: + case DIET_BUTTONRELEASE: + evt.type = UIET_BUTTON; + + evt.pointer.device_id = event->device_id; + evt.pointer.press = (event->type == DIET_BUTTONPRESS); + evt.pointer.x = pointer->x; + evt.pointer.y = pointer->y; + evt.pointer.button = event->button; + evt.pointer.buttons = event->buttons; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } +} + + +const UniqueDeviceClass unique_pointer_device_class = { + data_size: sizeof(PointerData), + + Initialize: pointer_initialize, + Shutdown: pointer_shutdown, + Connected: pointer_connected, + Disconnected: pointer_disconnected, + ProcessEvent: pointer_process_event +}; + diff --git a/Source/DirectFB/wm/unique/devices/wheel.c b/Source/DirectFB/wm/unique/devices/wheel.c new file mode 100755 index 0000000..3328d8f --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/wheel.c @@ -0,0 +1,182 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Wheel, "UniQuE/Wheel", "UniQuE's Wheel Device Class" ); + + +typedef struct { + int magic; +} WheelData; + +/**************************************************************************************************/ + +static DFBResult +wheel_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + WheelData *wheel = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( wheel, WheelData ); + + return DFB_OK; +} + +static void +wheel_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + WheelData *wheel = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( wheel ); +} + +static void +wheel_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +wheel_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +wheel_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + switch (event->type) { + case DIET_AXISMOTION: + switch (event->axis) { + case DIAI_Z: + evt.type = UIET_WHEEL; + + evt.wheel.device_id = event->device_id; + + if (event->flags & DIEF_AXISREL) + evt.wheel.value = -event->axisrel; + else if (event->flags & DIEF_AXISABS) + evt.wheel.value = event->axisabs; + else + break; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } + break; + + default: + break; + } +} + + +const UniqueDeviceClass unique_wheel_device_class = { + data_size: sizeof(WheelData), + + Initialize: wheel_initialize, + Shutdown: wheel_shutdown, + Connected: wheel_connected, + Disconnected: wheel_disconnected, + ProcessEvent: wheel_process_event +}; + diff --git a/Source/DirectFB/wm/unique/input_channel.c b/Source/DirectFB/wm/unique/input_channel.c new file mode 100755 index 0000000..69dee79 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_channel.c @@ -0,0 +1,206 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_InputChan, "UniQuE/InputChan", "UniQuE's Input Channel" ); + + +static const ReactionFunc unique_input_channel_globals[] = { + _unique_window_input_channel_listener, + NULL +}; + +/**************************************************************************************************/ + +DFBResult +unique_input_channel_create( CoreDFB *core, + UniqueContext *context, + UniqueInputChannel **ret_channel ) +{ + UniqueInputChannel *channel; + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_create( context %p )\n", context ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_channel != NULL ); + + /* Allocate channel data. */ + channel = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputChannel) ); + if (!channel) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize channel data. */ + channel->context = context; + + /* Create reactor for dispatching events. */ + channel->reactor = fusion_reactor_new( sizeof(UniqueInputEvent), + "UniQuE Input Channel", dfb_core_world(core) ); + if (!channel->reactor) { + SHFREE( context->shmpool, channel ); + return DFB_FUSION; + } + + fusion_reactor_set_lock( channel->reactor, &context->stack->context->lock ); + + D_MAGIC_SET( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InputChan, " -> channel created (%p)\n", channel ); + + *ret_channel = channel; + + return DFB_OK; +} + +DFBResult +unique_input_channel_destroy( UniqueInputChannel *channel ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + context = channel->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_destroy( %p )\n", channel ); + + fusion_reactor_free( channel->reactor ); + + D_MAGIC_CLEAR( channel ); + + SHFREE( context->shmpool, channel ); + + return DFB_OK; +} + + +DFBResult +unique_input_channel_attach( UniqueInputChannel *channel, + ReactionFunc func, + void *ctx, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_attach( channel->reactor, func, ctx, reaction ); +} + +DFBResult +unique_input_channel_detach( UniqueInputChannel *channel, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_detach( channel->reactor, reaction ); +} + +DFBResult +unique_input_channel_attach_global( UniqueInputChannel *channel, + int index, + void *ctx, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_attach_global( channel->reactor, index, ctx, reaction ); +} + +DFBResult +unique_input_channel_detach_global( UniqueInputChannel *channel, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_detach_global( channel->reactor, reaction ); +} + +DFBResult +unique_input_channel_dispatch( UniqueInputChannel *channel, + const UniqueInputEvent *event ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_dispatch( %p, %p ) <- type 0x%08x\n", + channel, event, event->type ); + + switch (event->type) { + case UIET_MOTION: + D_DEBUG_AT( UniQuE_InputChan, " -> MOTION %d, %d, buttons 0x%04x\n", + event->pointer.x, event->pointer.y, event->pointer.buttons ); + break; + case UIET_BUTTON: + D_DEBUG_AT( UniQuE_InputChan, " -> BUTTON %d, %d, buttons 0x%04x, button %d, %s\n", + event->pointer.x, event->pointer.y, + event->pointer.buttons, event->pointer.button, + event->pointer.press ? "pressed" : "released" ); + break; + case UIET_WHEEL: + D_DEBUG_AT( UniQuE_InputChan, " -> WHEEL %d\n", event->wheel.value ); + break; + case UIET_KEY: + D_DEBUG_AT( UniQuE_InputChan, " -> KEY 0x%08x, modifiers 0x%04x, %s\n", + event->keyboard.key_symbol, event->keyboard.modifiers, + event->keyboard.press ? "pressed" : "released" ); + break; + case UIET_CHANNEL: + D_DEBUG_AT( UniQuE_InputChan, " -> CHANNEL %d, %d, index %d, %s\n", + event->channel.x, event->channel.y, event->channel.index, + event->channel.selected ? "selected" : "deselected" ); + break; + default: + D_DEBUG_AT( UniQuE_InputChan, " -> unknown type 0x%08x\n", event->type ); + break; + } + + return fusion_reactor_dispatch( channel->reactor, event, true, unique_input_channel_globals ); +} + diff --git a/Source/DirectFB/wm/unique/input_channel.h b/Source/DirectFB/wm/unique/input_channel.h new file mode 100755 index 0000000..a61b92e --- /dev/null +++ b/Source/DirectFB/wm/unique/input_channel.h @@ -0,0 +1,74 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__INPUT_CHANNEL_H__ +#define __UNIQUE__INPUT_CHANNEL_H__ + +#include + +#include + +#include +#include + + +DFBResult unique_input_channel_create ( CoreDFB *core, + UniqueContext *context, + UniqueInputChannel **ret_channel ); + +DFBResult unique_input_channel_destroy ( UniqueInputChannel *channel ); + + +DFBResult unique_input_channel_attach ( UniqueInputChannel *channel, + ReactionFunc func, + void *ctx, + Reaction *reaction ); + +DFBResult unique_input_channel_detach ( UniqueInputChannel *channel, + Reaction *reaction ); + +DFBResult unique_input_channel_attach_global( UniqueInputChannel *channel, + int index, + void *ctx, + GlobalReaction *reaction ); + +DFBResult unique_input_channel_detach_global( UniqueInputChannel *channel, + GlobalReaction *reaction ); + +DFBResult unique_input_channel_dispatch ( UniqueInputChannel *channel, + const UniqueInputEvent *event ); + + +/* global reactions */ + +typedef enum { + UNIQUE_WINDOW_INPUT_CHANNEL_LISTENER +} UNIQUE_INPUT_CHANNEL_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/input_events.h b/Source/DirectFB/wm/unique/input_events.h new file mode 100755 index 0000000..c0400bb --- /dev/null +++ b/Source/DirectFB/wm/unique/input_events.h @@ -0,0 +1,114 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__INPUT_EVENTS_H__ +#define __UNIQUE__INPUT_EVENTS_H__ + +#include + +#include +#include + +typedef enum { + UIET_NONE = 0x00000000, + + UIET_MOTION = 0x00000001, + UIET_BUTTON = 0x00000002, + + UIET_WHEEL = 0x00000010, + + UIET_KEY = 0x00000100, + + UIET_CHANNEL = 0x00001000, + + UIET_ALL = 0x00001113 +} UniqueInputEventType; + + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + bool press; + + int x; + int y; + + DFBInputDeviceButtonIdentifier button; + + DFBInputDeviceButtonMask buttons; +} UniqueInputPointerEvent; + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + int value; +} UniqueInputWheelEvent; + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + bool press; + + int key_code; + DFBInputDeviceKeyIdentifier key_id; + DFBInputDeviceKeySymbol key_symbol; + + DFBInputDeviceModifierMask modifiers; + DFBInputDeviceLockState locks; +} UniqueInputKeyboardEvent; + +typedef struct { + UniqueInputEventType type; + + bool selected; + + UniqueDeviceClassIndex index; + + int x; + int y; +} UniqueInputChannelEvent; + + +union __UniQuE_UniqueInputEvent { + UniqueInputEventType type; + + UniqueInputPointerEvent pointer; + UniqueInputWheelEvent wheel; + UniqueInputKeyboardEvent keyboard; + UniqueInputChannelEvent channel; +}; + + +#endif + diff --git a/Source/DirectFB/wm/unique/input_switch.c b/Source/DirectFB/wm/unique/input_switch.c new file mode 100755 index 0000000..08fa0e2 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_switch.c @@ -0,0 +1,776 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + + +D_DEBUG_DOMAIN( UniQuE_InpSw, "UniQuE/InpSwitch", "UniQuE's Input Switch" ); + + +typedef struct { + DirectLink link; + + int magic; + + UniqueDevice *device; + + GlobalReaction reaction; +} SwitchConnection; + +/**************************************************************************************************/ + +static void purge_connection( UniqueInputSwitch *input_switch, + SwitchConnection *connection ); + +static bool target_switch ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +static bool update_targets ( UniqueInputSwitch *input_switch ); + +/**************************************************************************************************/ + +DFBResult +unique_input_switch_create( UniqueContext *context, + UniqueInputSwitch **ret_switch ) +{ + int i; + WMShared *shared; + UniqueInputSwitch *input_switch; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_create( context %p )\n", context ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_switch != NULL ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + /* Allocate switch data. */ + input_switch = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputSwitch) ); + if (!input_switch) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize input_switch data. */ + input_switch->context = context; + + /* Set class ID of each target. */ + for (i=0; i<_UDCI_NUM; i++) + input_switch->targets[i].clazz = shared->device_classes[i]; + + D_MAGIC_SET( input_switch, UniqueInputSwitch ); + + D_DEBUG_AT( UniQuE_InpSw, " -> input_switch created (%p)\n", input_switch ); + + *ret_switch = input_switch; + + return DFB_OK; +} + +DFBResult +unique_input_switch_destroy( UniqueInputSwitch *input_switch ) +{ + int i; + DirectLink *n; + SwitchConnection *connection; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_destroy( %p )\n", input_switch ); + + direct_list_foreach_safe (connection, n, input_switch->connections) { + D_MAGIC_ASSERT( connection, SwitchConnection ); + + purge_connection( input_switch, connection ); + } + + D_ASSERT( input_switch->connections == NULL ); + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputFilter *filter; + UniqueInputTarget *target = &input_switch->targets[i]; + + direct_list_foreach_safe (filter, n, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + D_MAGIC_ASSERT( filter->channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, " -> filter %p, index %d, channel %p\n", + filter, filter->index, filter->channel ); + + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + } + + D_ASSERT( target->filters == NULL ); + } + + D_MAGIC_CLEAR( input_switch ); + + SHFREE( context->shmpool, input_switch ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_add( UniqueInputSwitch *input_switch, + UniqueDevice *device ) +{ + DFBResult ret; + SwitchConnection *connection; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( device, UniqueDevice ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_add( %p, %p )\n", input_switch, device ); + + /* Allocate connection structure. */ + connection = SHCALLOC( context->shmpool, 1, sizeof(SwitchConnection) ); + if (!connection) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize connection structure. */ + connection->device = device; + + /* Attach global reaction for processing events. */ + ret = unique_device_attach_global( device, UNIQUE_INPUT_SWITCH_DEVICE_LISTENER, + input_switch, &connection->reaction ); + if (ret) { + D_DERROR( ret, "UniQuE/InpSwitch: Could not attach global device reaction!\n" ); + SHFREE( context->shmpool, connection ); + return ret; + } + + /* Add the new connection to the list. */ + direct_list_append( &input_switch->connections, &connection->link ); + + D_MAGIC_SET( connection, SwitchConnection ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_remove( UniqueInputSwitch *input_switch, + UniqueDevice *device ) +{ + SwitchConnection *connection; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_remove( %p, %p )\n", input_switch, device ); + + direct_list_foreach (connection, input_switch->connections) { + D_MAGIC_ASSERT( connection, SwitchConnection ); + + if (connection->device == device) + break; + } + + if (!connection) { + D_WARN( "device not found amoung connections" ); + return DFB_ITEMNOTFOUND; + } + + purge_connection( input_switch, connection ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_select( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_select( %p, %d, %p )\n", + input_switch, index, channel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + target->normal = channel; + + if (!target->fixed && !target->implicit) + target_switch( input_switch, index, channel ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_set( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_set( %p, %d, %p )\n", + input_switch, index, channel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + if (target->fixed) + return DFB_BUSY; + + target->fixed = channel; + + target_switch( input_switch, index, channel ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_unset( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_unset( %p, %d, %p )\n", + input_switch, index, channel ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + if (target->fixed != channel) + return DFB_ACCESSDENIED; + + target->fixed = NULL; + + + update_targets( input_switch ); + //target_switch( input_switch, index, target->normal ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_set_filter( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel, + const UniqueInputEvent *event, + UniqueInputFilter **ret_filter ) +{ + UniqueInputFilter *filter; + UniqueInputTarget *target; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_set_filter( %p, %d, %p, %p )\n", + input_switch, index, channel, event ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + D_ASSERT( event != NULL ); + D_ASSERT( ret_filter != NULL ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + target = &input_switch->targets[index]; + + direct_list_foreach (filter, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + if (unique_device_filter( target->clazz, event, &filter->filter )) + return DFB_BUSY; + } + + /* Allocate new filter. */ + filter = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputFilter) ); + if (!filter) + return D_OOSHM(); + + filter->index = index; + filter->channel = channel; + filter->filter = *event; + + direct_list_append( &target->filters, &filter->link ); + + D_MAGIC_SET( filter, UniqueInputFilter ); + + *ret_filter = filter; + + return DFB_OK; +} + +DFBResult +unique_input_switch_unset_filter( UniqueInputSwitch *input_switch, + UniqueInputFilter *filter ) +{ + UniqueInputTarget *target; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_unset_filter( %p, %p )\n", + input_switch, filter ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( filter->index >= 0 ); + D_ASSERT( filter->index < _UDCI_NUM ); + + target = &input_switch->targets[filter->index]; + + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_drop( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ) +{ + int i; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_drop( %p, %p )\n", input_switch, channel ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + for (i=0; i<_UDCI_NUM; i++) { + DirectLink *n; + UniqueInputFilter *filter; + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + target->normal = NULL; + + if (target->fixed == channel) + target->fixed = NULL; + + if (target->implicit == channel) + target->implicit = NULL; + + if (target->current == channel) + target->current = NULL; + + D_DEBUG_AT( UniQuE_InpSw, " -> index %d, filters %p\n", i, target->filters ); + + direct_list_foreach_safe (filter, n, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + D_MAGIC_ASSERT( filter->channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, + " -> filter %p, channel %p\n", filter, filter->channel ); + + D_ASSUME( filter->channel != channel ); + + if (filter->channel == channel) { + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + } + } + } + + if (!input_switch->targets[UDCI_POINTER].fixed) + update_targets( input_switch ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_update( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ) +{ + int x, y, i; + StretRegion *region; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + x = input_switch->x; + y = input_switch->y; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_update( %d, %d )\n", x, y ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region) { + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + stret_region_get_input( region, i, x, y, &target->normal ); + } + } + else { + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + target->normal = NULL; + } + } + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + target_switch( input_switch, i, target->fixed ? : target->implicit ? : target->normal ); + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +static bool +target_switch( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputEvent evt; + UniqueInputTarget *target; + UniqueInputChannel *current; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + current = target->current; + + D_MAGIC_ASSERT_IF( channel, UniqueInputChannel ); + D_MAGIC_ASSERT_IF( current, UniqueInputChannel ); + + if (channel == current) + return false; + + D_DEBUG_AT( UniQuE_InpSw, "target_switch( index %d, x %d, y %d, channel %p )\n", + index, input_switch->x, input_switch->y, channel ); + + evt.type = UIET_CHANNEL; + + evt.channel.index = index; + evt.channel.x = input_switch->x; + evt.channel.y = input_switch->y; + + if (current) { + evt.channel.selected = false; + + unique_input_channel_dispatch( current, &evt ); + } + + target->current = channel; + + if (channel) { + evt.channel.selected = true; + + unique_input_channel_dispatch( channel, &evt ); + } + + return true; +} + +static void +target_dispatch( UniqueInputTarget *target, + const UniqueInputEvent *event ) +{ + UniqueInputFilter *filter; + UniqueInputChannel *channel; + + D_ASSERT( target != NULL ); + D_ASSERT( event != NULL ); + + channel = target->current; + + D_MAGIC_ASSERT_IF( channel, UniqueInputChannel ); + + + direct_list_foreach (filter, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + if (unique_device_filter( target->clazz, event, &filter->filter )) { + channel = filter->channel; + + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + break; + } + } + + if (channel) + unique_input_channel_dispatch( channel, event ); + else + D_DEBUG_AT( UniQuE_InpSw, "target_dispatch( class %d ) " + "<- no selected channel, dropping event.\n", target->clazz ); +} + +static bool +update_targets( UniqueInputSwitch *input_switch ) +{ + int x, y, i; + StretRegion *region; + UniqueContext *context; + bool updated[_UDCI_NUM]; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + x = input_switch->x; + y = input_switch->y; + + D_DEBUG_AT( UniQuE_InpSw, "update_targets( %d, %d )\n", x, y ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region) { + for (i=0; i<_UDCI_NUM; i++) + stret_region_get_input( region, i, x, y, &input_switch->targets[i].normal ); + } + else { + for (i=0; i<_UDCI_NUM; i++) + input_switch->targets[i].normal = NULL; + } + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + updated[i] = target_switch( input_switch, i, + target->fixed ? : target->implicit ? : target->normal ); + } + + return updated[UDCI_POINTER]; +} + +ReactionResult +_unique_input_switch_device_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueInputSwitch *inpsw = ctx; + UniqueInputTarget *target = NULL; + UniqueContext *context; + + (void) event; + (void) inpsw; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( inpsw, UniqueInputSwitch ); + + context = inpsw->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + if (dfb_windowstack_lock( context->stack )) + return RS_OK; + + if (!context->active) { + dfb_windowstack_unlock( context->stack ); + return RS_OK; + } + + D_DEBUG_AT( UniQuE_InpSw, "_unique_input_switch_device_listener( %p, %p )\n", + event, inpsw ); + + switch (event->type) { + case UIET_MOTION: + target = &inpsw->targets[UDCI_POINTER]; + + inpsw->x = event->pointer.x; + inpsw->y = event->pointer.y; + + if (!target->fixed && !target->implicit && update_targets( inpsw )) + break; + + target_dispatch( target, event ); + break; + + case UIET_BUTTON: + target = &inpsw->targets[UDCI_POINTER]; + + if (event->pointer.press && !target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit pointer grab, %p\n", target->current ); + + target->implicit = target->current; + } + + target_dispatch( target, event ); + + if (!event->pointer.press && !event->pointer.buttons) { + D_ASSUME( target->implicit != NULL ); + + if (target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit pointer ungrab, %p\n", target->implicit ); + + target->implicit = NULL; + + if (!target->fixed) + update_targets( inpsw ); + } + } + break; + + case UIET_WHEEL: + target_dispatch( &inpsw->targets[UDCI_WHEEL], event ); + break; + + case UIET_KEY: + target = &inpsw->targets[UDCI_KEYBOARD]; + + if (event->keyboard.press && !target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit keyboard grab, %p\n", target->current ); + + target->implicit = target->current; + } + + target_dispatch( target, event ); + + if (!event->keyboard.press && !event->keyboard.modifiers) { + //D_ASSUME( target->implicit != NULL ); + + if (target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit keyboard ungrab, %p\n", target->implicit ); + + if (!target->fixed) + target_switch( inpsw, UDCI_KEYBOARD, target->normal ); + + target->implicit = NULL; + } + } + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + dfb_windowstack_unlock( context->stack ); + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +purge_connection( UniqueInputSwitch *input_switch, + SwitchConnection *connection ) +{ + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "purge_connection( %p, %p )\n", input_switch, connection ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( connection, SwitchConnection ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Detach global reaction for receiving events. */ + unique_device_detach_global( connection->device, &connection->reaction ); + + direct_list_remove( &input_switch->connections, &connection->link ); + + D_MAGIC_CLEAR( connection ); + + SHFREE( context->shmpool, connection ); +} + diff --git a/Source/DirectFB/wm/unique/input_switch.h b/Source/DirectFB/wm/unique/input_switch.h new file mode 100755 index 0000000..cccb8c6 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_switch.h @@ -0,0 +1,78 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__INPUT_SWITCH_H__ +#define __UNIQUE__INPUT_SWITCH_H__ + +#include + +#include +#include + + +DFBResult unique_input_switch_create ( UniqueContext *context, + UniqueInputSwitch **ret_switch ); + +DFBResult unique_input_switch_destroy ( UniqueInputSwitch *input_switch ); + +DFBResult unique_input_switch_add ( UniqueInputSwitch *input_switch, + UniqueDevice *device ); + +DFBResult unique_input_switch_remove ( UniqueInputSwitch *input_switch, + UniqueDevice *device ); + +DFBResult unique_input_switch_select ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_set ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_unset ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_set_filter ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel, + const UniqueInputEvent *event, + UniqueInputFilter **ret_filter ); + +DFBResult unique_input_switch_unset_filter( UniqueInputSwitch *input_switch, + UniqueInputFilter *filter ); + +DFBResult unique_input_switch_drop ( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_update ( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ); + + +#endif + diff --git a/Source/DirectFB/wm/unique/internal.h b/Source/DirectFB/wm/unique/internal.h new file mode 100755 index 0000000..0dbf9b4 --- /dev/null +++ b/Source/DirectFB/wm/unique/internal.h @@ -0,0 +1,378 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__INTERNAL_H__ +#define __UNIQUE__INTERNAL_H__ + +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +#define UNIQUE_WM_ABI_VERSION 12 + + +extern const StretRegionClass unique_root_region_class; +extern const StretRegionClass unique_frame_region_class; +extern const StretRegionClass unique_window_region_class; +extern const StretRegionClass unique_foo_region_class; + +extern const UniqueDeviceClass unique_pointer_device_class; +extern const UniqueDeviceClass unique_wheel_device_class; +extern const UniqueDeviceClass unique_keyboard_device_class; + +typedef enum { + URCI_ROOT, + URCI_FRAME, + URCI_WINDOW, + URCI_FOO, + + _URCI_NUM +} UniqueRegionClassIndex; + +typedef enum { + UFI_N, + UFI_NE, + UFI_E, + UFI_SE, + UFI_S, + UFI_SW, + UFI_W, + UFI_NW +} UniqueFooIndex; + +typedef ReactionResult (*UniqueWMContextNotify)( WMData *data, + const UniqueContextNotification *notification, + void *ctx ); + +typedef ReactionResult (*UniqueWMWindowNotify) ( WMData *data, + const UniqueWindowNotification *notification, + void *ctx ); + + +struct __UniQuE_WMData { + int module_abi; + + CoreDFB *core; + FusionWorld *world; + + WMShared *shared; + + UniqueWMContextNotify context_notify; + UniqueWMWindowNotify window_notify; +}; + +struct __UniQuE_WMShared { + int magic; + + FusionObjectPool *context_pool; + FusionObjectPool *decoration_pool; + FusionObjectPool *window_pool; + + StretRegionClassID region_classes[_URCI_NUM]; + UniqueDeviceClassID device_classes[_UDCI_NUM]; + + int device_listener; /* index of the registered global */ + + DFBInsets insets; + + DFBRectangle foo_rects[8]; + + CoreSurface *foo_surface; +}; + + +typedef enum { + UNRL_DESKTOP, /* Icons, redirected fullscreen apps (force-desktop) */ + UNRL_USER, /* User windows (all currently available stacking classes) */ + UNRL_SYSTEM, /* Dock/Panel, Glass, Expos?, Clipboard, Virtual Keyboard, IMs */ + UNRL_CURSOR, /* Cursor shape and attached objects, e.g. Drag'N'Drop */ + UNRL_SCREEN, /* Display Locking, Screensaver */ + + _UNRL_NUM +} UniqueRootLevel; + +typedef enum { + UNFL_BACKGROUND, /* Background for blended content, effects, decorations */ + UNFL_CONTENT, /* The actual DirectFB Window, i.e. its content */ + UNFL_FOREGROUND, /* Decorations, effects, any other content overlay */ + + _UNFL_NUM +} UniqueFrameLevel; + +typedef struct { + DirectLink link; + + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceModifierMask modifiers; + + UniqueWindow *owner; +} GrabbedKey; + + +struct __UniQuE_UniqueContext { + FusionObject object; + + int magic; + + CoreWindowStack *stack; + WMShared *shared; + + CoreLayerRegion *region; + CoreSurface *surface; + + DFBDisplayLayerID layer_id; + + bool active; + + DFBColor color; + + int width; + int height; + + StretRegion *root; + + FusionVector windows; + + + UniqueInputSwitch *input_switch; + + UniqueDevice *devices[_UDCI_NUM]; + + GlobalReaction cursor_reaction; + + FusionSHMPoolShared *shmpool; + + UniqueInputChannel *foo_channel; + + CoreSurface *cursor_bs; /* backing store for region under cursor */ + bool cursor_bs_valid; + DFBRegion cursor_region; + bool cursor_drawn; +}; + +struct __UniQuE_UniqueWindow { + FusionObject object; + + int magic; + + CoreWindow *window; + UniqueContext *context; + WMShared *shared; + + CoreSurface *surface; + + UniqueInputChannel *channel; + GlobalReaction channel_reaction; + + DirectLink *filters; + + DFBWindowCapabilities caps; + + UniqueWindowFlags flags; + + StretRegion *frame; + StretRegion *region; + StretRegion *foos[8]; + DFBPoint foo_motion; + + DFBInsets insets; + + DFBRectangle bounds; /* absolute bounds of the content */ + DFBRectangle full; /* absolute bounds of the full frame */ + + int opacity; /* global alpha factor */ + + DFBWindowStackingClass stacking; /* level boundaries */ + int priority; /* derived from stacking class */ + + DFBWindowOptions options; /* flags for appearance/behaviour */ + DFBWindowEventType events; /* mask of enabled events */ + + u32 color_key; /* transparent pixel */ + DFBRegion opaque; /* region of the window forced to be opaque */ +}; + +struct __UniQuE_UniqueDecoration { + FusionObject object; + + int magic; + + UniqueWindow *window; + UniqueContext *context; + + UniqueDecorationFlags flags; +}; + +struct __UniQuE_UniqueDecorationItem { + const UniqueLayout *layout; + + DFBPoint pos; /* current offset from window origin */ + DFBDimension size; /* current dimensions */ +}; + +struct __UniQuE_StretRegion { + int magic; + + StretRegion *parent; /* Is NULL for the root region. */ + + int level; /* Level within the parent. */ + int index; /* Index within the level. */ + + int levels; /* Number of levels provided. */ + FusionVector *children; /* Children of each level. */ + + StretRegionFlags flags; /* Control appearance and activity. */ + + DFBRegion bounds; /* Relative to its parent. */ + + StretRegionClassID clazz; /* Region class (implementation) used for rendering etc. */ + + void *data; /* Optional private data of region class. */ + unsigned long arg; /* Optional argument for region class instance. */ + + FusionSHMPoolShared *shmpool; +}; + +struct __UniQuE_UniqueDevice { + int magic; + + UniqueContext *context; + + UniqueDeviceClassID clazz; /* Device class (implementation) used for processing etc. */ + + void *data; /* Optional private data of device class. */ + void *ctx; /* Optional context for device class instance. */ + + FusionReactor *reactor; /* UniqueInputEvent deployment */ + + DirectLink *connections; /* CoreInputDevice connections */ +}; + + +struct __UniQuE_UniqueInputFilter { + DirectLink link; + + int magic; + + UniqueDeviceClassIndex index; + + UniqueInputChannel *channel; + + UniqueInputEvent filter; +}; + +typedef struct { + UniqueDeviceClassID clazz; + + UniqueInputChannel *current; + + UniqueInputChannel *normal; + UniqueInputChannel *fixed; + + UniqueInputChannel *implicit; + + DirectLink *filters; +} UniqueInputTarget; + + +struct __UniQuE_UniqueInputSwitch { + int magic; + + UniqueContext *context; + + DirectLink *connections; /* UniqueDevice connections */ + + int x; + int y; + + UniqueInputTarget targets[_UDCI_NUM]; +}; + +struct __UniQuE_UniqueInputChannel { + int magic; + + UniqueContext *context; + + FusionReactor *reactor; /* UniqueInputEvent arrival */ +}; + + +DFBResult unique_wm_module_init ( CoreDFB *core, + WMData *data, + WMShared *shared, + bool master ); + +void unique_wm_module_deinit( WMData *data, + WMShared *shared, + bool master, + bool emergency ); + +UniqueContext *unique_wm_create_context( void ); +UniqueDecoration *unique_wm_create_decoration( void ); +UniqueWindow *unique_wm_create_window( void ); + +/* HACK: temporary, will move into cursor class */ +void unique_draw_cursor( CoreWindowStack *stack, UniqueContext *context, CardState *state, DFBRegion *region ); + + +/* global reactions */ +ReactionResult _unique_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_wm_module_context_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_wm_module_window_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_cursor_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_input_switch_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_window_input_channel_listener( const void *msg_data, + void *ctx ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret.c b/Source/DirectFB/wm/unique/stret.c new file mode 100755 index 0000000..0ae2326 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret.c @@ -0,0 +1,837 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + + +#define MAX_CLASSES 16 + +D_DEBUG_DOMAIN( UniQuE_StReT, "UniQuE/StReT", "UniQuE's Stack Region Tree" ); + +/**************************************************************************************************/ + +static void +default_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + D_DEBUG_AT( UniQuE_StReT, "default_update( %p, %p, %p, %lu, %d, %d, %p, %d )\n", + region, region_data, update_data, arg, x, y, updates, num ); +} + +static const StretRegionClass default_class = { + .Update = default_update, +}; + +/**************************************************************************************************/ + +static const StretRegionClass *classes[MAX_CLASSES] = { &default_class, NULL }; + +static pthread_mutex_t classes_lock = PTHREAD_MUTEX_INITIALIZER; +static int classes_count = 1; + +/**************************************************************************************************/ + +DFBResult +stret_class_register( const StretRegionClass *clazz, + StretRegionClassID *ret_id ) +{ + int i; + + D_DEBUG_AT( UniQuE_StReT, "stret_class_register( %p )\n", clazz ); + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_id != NULL ); + + pthread_mutex_lock( &classes_lock ); + + if (classes_count == MAX_CLASSES) { + D_WARN( "too many classes" ); + pthread_mutex_unlock( &classes_lock ); + return DFB_LIMITEXCEEDED; + } + + classes_count++; + + for (i=0; i New class ID is %d.\n", i ); + + D_ASSERT( i < MAX_CLASSES ); + + *ret_id = i; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +DFBResult +stret_class_unregister( StretRegionClassID id ) +{ + D_DEBUG_AT( UniQuE_StReT, "stret_class_unregister( %d )\n", id ); + + pthread_mutex_lock( &classes_lock ); + + D_ASSERT( id >= 0 ); + D_ASSERT( id < MAX_CLASSES ); + D_ASSERT( classes[id] != NULL ); + + classes[id] = NULL; + + classes_count--; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + + + +DFBResult +stret_region_create( StretRegionClassID class_id, + void *data, + unsigned long arg, + StretRegionFlags flags, + int levels, + int x, + int y, + int width, + int height, + StretRegion *parent, + int level, + FusionSHMPoolShared *pool, + StretRegion **ret_region ) +{ + int i; + StretRegion *region; + + D_DEBUG_AT( UniQuE_StReT, "stret_region_create( class %d, flags 0x%08x, %d,%d - %dx%d (%d), " + "parent %p [%d/%d] )\n", class_id, flags, x, y, width, height, levels, parent, + level, parent ? parent->levels-1 : 0 ); + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + D_ASSERT( classes[class_id] != NULL ); + + D_ASSERT( ! (flags & ~SRF_ALL) ); + + D_ASSERT( levels > 0 ); + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + D_MAGIC_ASSERT_IF( parent, StretRegion ); + + if (parent) + D_ASSERT( level < parent->levels ); + + D_ASSERT( ret_region != NULL ); + + /* Allocate region data. */ + region = SHCALLOC( pool, 1, sizeof(StretRegion) + sizeof(FusionVector) * levels ); + if (!region) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize region data. */ + region->parent = parent; + region->level = level; + region->levels = levels; + region->children = (FusionVector*)(region + 1); + region->flags = flags; + region->bounds = (DFBRegion) { x, y, x + width - 1, y + height - 1 }; + region->clazz = class_id; + region->data = data; + region->arg = arg; + region->shmpool = pool; + + /* Initialize levels. */ + for (i=0; ichildren[i], 4, pool ); + + + /* Add the region to its parent. */ + if (parent) { + FusionVector *children = &parent->children[level]; + + region->index = fusion_vector_size( children ); + + if (fusion_vector_add( children, region )) { + D_WARN( "out of (shared) memory" ); + SHFREE( pool, region ); + return D_OOSHM(); + } + } + + + D_MAGIC_SET( region, StretRegion ); + +#if D_DEBUG_ENABLED +{ + DFBRegion bounds; + + stret_region_get_abs( region, &bounds ); + + D_DEBUG_AT( UniQuE_StReT, " -> Index %d, absolute bounds: %d,%d - %dx%d\n", + region->index, DFB_RECTANGLE_VALS_FROM_REGION( &bounds ) ); +} +#endif + + *ret_region = region; + + return DFB_OK; +} + +DFBResult +stret_region_destroy( StretRegion *region ) +{ + int i; + int index; + StretRegion *parent; + StretRegion *child; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, + "stret_region_destroy( %d, %d - %dx%d, level %d, index %d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ), region->level, region->index ); + + parent = region->parent; + if (parent) { + FusionVector *children = &parent->children[region->level]; + + D_MAGIC_ASSERT( parent, StretRegion ); + + index = region->index; + + D_ASSERT( index >= 0 ); + D_ASSERT( index == fusion_vector_index_of( children, region ) ); + + fusion_vector_remove( children, index ); + + for (; indexindex = index; + } + } + + for (i=0; ilevels; i++) { + FusionVector *children = ®ion->children[i]; + + D_ASSUME( ! fusion_vector_has_elements( children ) ); + + fusion_vector_foreach( child, index, *children ) { + D_MAGIC_ASSERT( child, StretRegion ); + D_ASSERT( child->parent == region ); + + child->parent = NULL; + } + + fusion_vector_destroy( children ); + } + + D_MAGIC_CLEAR( region ); + + SHFREE( region->shmpool, region ); + + return DFB_OK; +} + + +DFBResult +stret_region_enable( StretRegion *region, + StretRegionFlags flags ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + region->flags |= flags; + + return DFB_OK; +} + +DFBResult +stret_region_disable( StretRegion *region, + StretRegionFlags flags ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + region->flags &= ~flags; + + return DFB_OK; +} + + +DFBResult +stret_region_move( StretRegion *region, + int dx, + int dy ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + dfb_region_translate( ®ion->bounds, dx, dy ); + + return DFB_OK; +} + +DFBResult +stret_region_resize( StretRegion *region, + int width, + int height ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + dfb_region_resize( ®ion->bounds, width, height ); + + return DFB_OK; +} + +DFBResult +stret_region_restack( StretRegion *region, + int index ) +{ + StretRegion *parent; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSUME( region->parent != NULL ); + + parent = region->parent; + if (parent) { + int old; + FusionVector *children = &parent->children[region->level]; + + D_MAGIC_ASSERT( parent, StretRegion ); + + old = region->index; + + D_ASSERT( old >= 0 ); + D_ASSERT( old == fusion_vector_index_of( children, region ) ); + + fusion_vector_move( children, old, index ); + + for (index = MIN(index,old); indexindex = index; + } + } + + return DFB_OK; +} + +void +stret_region_get_abs( StretRegion *region, + DFBRegion *ret_bounds ) +{ + DFBRegion bounds; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_bounds != NULL ); + + bounds = region->bounds; + + while (region->parent) { + StretRegion *parent = region->parent; + + D_MAGIC_ASSERT( parent, StretRegion ); + + dfb_region_translate( &bounds, parent->bounds.x1, parent->bounds.y1 ); + + region = parent; + } + + *ret_bounds = bounds; +} + +void +stret_region_get_size( StretRegion *region, + DFBDimension *ret_size ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_size != NULL ); + + ret_size->w = region->bounds.x2 - region->bounds.x1 + 1; + ret_size->h = region->bounds.y2 - region->bounds.y1 + 1; +} + +DFBResult +stret_region_get_input( StretRegion *region, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + const StretRegionClass *clazz; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_channel != NULL ); + + D_ASSERT( region->clazz >= 0 ); + D_ASSERT( region->clazz < MAX_CLASSES ); + + clazz = classes[region->clazz]; + + D_ASSERT( clazz != NULL ); + + if (clazz->GetInput) + return clazz->GetInput( region, region->data, region->arg, index, x, y, ret_channel ); + + return DFB_UNSUPPORTED; +} + + +typedef struct { + int num; + int max; + DFBRegion *regions; + StretRegion *region; +} ClipOutContext; + +static void +clip_out( StretIteration *iteration, + ClipOutContext *context, + int x1, + int y1, + int x2, + int y2 ) +{ + StretRegion *region; + DFBRegion cutout; + DFBRegion area = { x1, y1, x2, y2 }; + + D_DEBUG_AT( UniQuE_StReT, " clip_out( %4d, %4d - %4dx%4d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( &area ) ); + + D_ASSERT( x1 <= x2 ); + D_ASSERT( y1 <= y2 ); + + while (true) { + region = stret_iteration_next( iteration, &area ); + if (!region || region == context->region) { + context->num++; + + if (context->num <= context->max) { + DFBRegion *region = &context->regions[ context->num - 1 ]; + + D_DEBUG_AT( UniQuE_StReT, " (%2d) %4d, %4d - %4dx%4d\n", + context->num - 1, x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); + + region->x1 = x1; + region->y1 = y1; + region->x2 = x2; + region->y2 = y2; + } + else + D_DEBUG_AT( UniQuE_StReT, " Maximum number of regions exceeded, dropping...\n" ); + + if (region) + stret_iteration_abort( iteration ); + + return; + } + + D_MAGIC_ASSERT( region, StretRegion ); + + if (D_FLAGS_ARE_SET( region->flags, SRF_OUTPUT | SRF_OPAQUE )) + break; + } + + cutout = DFB_REGION_INIT_TRANSLATED( ®ion->bounds, iteration->x0, iteration->y0 ); + + dfb_region_clip( &cutout, x1, y1, x2, y2 ); + + /* upper */ + if (cutout.y1 != y1) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, y1, x2, cutout.y1 - 1 ); + } + + /* left */ + if (cutout.x1 != x1) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, cutout.y1, cutout.x1 - 1, cutout.y2 ); + } + + /* right */ + if (cutout.x2 != x2) { + StretIteration fork = *iteration; + + clip_out( &fork, context, cutout.x2 + 1, cutout.y1, x2, cutout.y2 ); + } + + /* lower */ + if (cutout.y2 != y2) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, cutout.y2 + 1, x2, y2 ); + } + + stret_iteration_abort( iteration ); +} + +DFBResult +stret_region_visible( StretRegion *region, + const DFBRegion *base, + bool children, + DFBRegion *ret_regions, + int max_num, + int *ret_num ) +{ + bool visible = true; + DFBRegion area; + ClipOutContext context; + StretIteration iteration; + StretRegion *root; + + int x0, y0; + + D_MAGIC_ASSERT( region, StretRegion ); + + DFB_REGION_ASSERT_IF( base ); + + D_ASSERT( ret_regions != NULL ); + D_ASSERT( max_num > 0 ); + D_ASSERT( ret_num != NULL ); + + if (base) { + D_DEBUG_AT( UniQuE_StReT, + "stret_region_visible( %d, %d - %dx%d of %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( base ), + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + area = *base; + } + else { + D_DEBUG_AT( UniQuE_StReT, + "stret_region_visible( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + area.x1 = 0; + area.y1 = 0; + area.x2 = region->bounds.x2 - region->bounds.x1; + area.y2 = region->bounds.y2 - region->bounds.y1; + } + + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active and therefore invisible!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + + context.num = 0; + context.max = max_num; + context.regions = ret_regions; + context.region = region; + + x0 = region->bounds.x1; + y0 = region->bounds.y1; + + root = region; + + if (region->parent) { + int rx2; + int ry2; + StretRegion *parent = region->parent; + + do { + D_MAGIC_ASSERT( parent, StretRegion ); + + if (! D_FLAGS_IS_SET( parent->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> At least one parent is not active!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + x0 += parent->bounds.x1; + y0 += parent->bounds.y1; + + rx2 = parent->bounds.x2; + ry2 = parent->bounds.y2; + + root = parent; + + visible = dfb_region_intersect( &area, - x0, - y0, rx2 - x0, ry2 - y0 ); + + parent = parent->parent; + } while (visible && parent); + } + else if (base) + visible = dfb_region_intersect( &area, 0, 0, region->bounds.x2, region->bounds.y2 ); + + + if (!visible) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is fully clipped by ancestors!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + + stret_iteration_init( &iteration, root, children ? region : NULL ); + + clip_out( &iteration, &context, x0 + area.x1, y0 + area.y1, x0 + area.x2, y0 + area.y2 ); + + + *ret_num = context.num; + + if (context.num > context.max) { + D_DEBUG_AT( UniQuE_StReT, " -> Failed with %d/%d regions!\n", + context.num, context.max ); + + return DFB_LIMITEXCEEDED; + } + + D_DEBUG_AT( UniQuE_StReT, " -> Succeeded with %d/%d regions.\n", context.num, context.max ); + + return DFB_OK; +} + + +typedef struct { + StretIteration iteration; + void *update_data; +} UpdateContext; + +static void +region_update( UpdateContext *context, + int x1, + int y1, + int x2, + int y2 ) +{ + int x0, y0; + DFBRegion area = { x1, y1, x2, y2 }; + StretRegion *region; + + D_DEBUG_AT( UniQuE_StReT, " region_update( %4d, %4d - %4dx%4d )\n", + x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); + + D_ASSERT( x1 <= x2 ); + D_ASSERT( y1 <= y2 ); + + while (true) { + region = stret_iteration_next( &context->iteration, &area ); + if (!region) + return; + + D_MAGIC_ASSERT( region, StretRegion ); + + if (D_FLAGS_IS_SET( region->flags, SRF_OUTPUT )) + break; + } + + x0 = context->iteration.x0; + y0 = context->iteration.y0; + + D_DEBUG_AT( UniQuE_StReT, " -> %4d, %4d - %4dx%4d @ %4d, %4d (class %d, index %d)\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ), + x0, y0, region->clazz, region->index ); + + dfb_region_clip( &area, DFB_REGION_VALS_TRANSLATED( ®ion->bounds, x0, y0 ) ); + + + + if (D_FLAGS_IS_SET( region->flags, SRF_OPAQUE )) { + /* upper */ + if (area.y1 != y1) { + UpdateContext fork = *context; + + region_update( &fork, x1, y1, x2, area.y1 - 1 ); + } + + /* left */ + if (area.x1 != x1) { + UpdateContext fork = *context; + + region_update( &fork, x1, area.y1, area.x1 - 1, area.y2 ); + } + + /* right */ + if (area.x2 != x2) { + UpdateContext fork = *context; + + region_update( &fork, area.x2 + 1, area.y1, x2, area.y2 ); + } + + /* lower */ + if (area.y2 != y2) { + UpdateContext fork = *context; + + region_update( &fork, x1, area.y2 + 1, x2, y2 ); + } + + stret_iteration_abort( &context->iteration ); + } + else + region_update( context, x1, y1, x2, y2 ); + + + x0 += region->bounds.x1; + y0 += region->bounds.y1; + + dfb_region_translate( &area, - x0, - y0 ); + + D_DEBUG_AT( UniQuE_StReT, " => %4d, %4d - %4dx%4d @ %4d, %4d (class %d, index %d)\n", + DFB_RECTANGLE_VALS_FROM_REGION( &area ), + x0, y0, region->clazz, region->index ); + + D_ASSERT( classes[region->clazz]->Update ); + + classes[region->clazz]->Update( region, region->data, context->update_data, + region->arg, x0, y0, &area, 1 ); +} + +DFBResult +stret_region_update( StretRegion *region, + const DFBRegion *clip, + void *update_data ) +{ + DFBRegion area; + UpdateContext context; + + D_MAGIC_ASSERT( region, StretRegion ); + + DFB_REGION_ASSERT_IF( clip ); + + if (clip) + D_DEBUG_AT( UniQuE_StReT, + "stret_region_update( %d, %d - %dx%d of %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( clip ), + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + else + D_DEBUG_AT( UniQuE_StReT, + "stret_region_update( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active and therefore invisible.\n" ); + return DFB_OK; + } + + area.x1 = 0; + area.y1 = 0; + area.x2 = region->bounds.x2 - region->bounds.x1; + area.y2 = region->bounds.y2 - region->bounds.y1; + + if (clip && !dfb_region_region_intersect( &area, clip )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region doesn't intersect with clip.\n" ); + return DFB_OK; + } + + + stret_iteration_init( &context.iteration, region, NULL ); + + context.update_data = update_data; + + region_update( &context, area.x1, area.y1, area.x2, area.y2 ); + + return DFB_OK; +} + +StretRegion * +stret_region_at( StretRegion *region, + int x, + int y, + StretRegionFlags flags, + StretRegionClassID class_id ) +{ + StretIteration iteration; + DFBRegion area = { x, y, x, y }; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, "stret_region_at( %p, %d, %d, 0x%08x )\n", region, x, y, flags ); + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active.\n" ); + return NULL; + } + + + stret_iteration_init( &iteration, region, NULL ); + + while ((region = stret_iteration_next( &iteration, &area )) != NULL) { + if (! D_FLAGS_ARE_SET( region->flags, flags )) + continue; + + if (class_id != SRCID_UNKNOWN && region->clazz != class_id) + continue; + + return region; + } + + return NULL; +} + +void * +stret_region_data( const StretRegion *region ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + return region->data; +} + diff --git a/Source/DirectFB/wm/unique/stret.h b/Source/DirectFB/wm/unique/stret.h new file mode 100755 index 0000000..01bcc97 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret.h @@ -0,0 +1,155 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__STRET_H__ +#define __UNIQUE__STRET_H__ + +#include + +#include + +/* + * A 'StReT' is a Stack Region Tree. + */ + + +typedef enum { + SRF_NONE = 0x00000000, + + SRF_INPUT = 0x00000001, + SRF_OUTPUT = 0x00000002, + SRF_ACTIVE = 0x00000004, + + SRF_OPAQUE = 0x00000010, + SRF_SHAPED = 0x00000020, + + SRF_ALL = 0x00000037 +} StretRegionFlags; + + +typedef struct { + DFBResult (*GetInput)( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ); + + void (*Update) ( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ); +} StretRegionClass; + +typedef int StretRegionClassID; + +#define SRCID_UNKNOWN -1 +#define SRCID_DEFAULT 0 + + +DFBResult stret_class_register ( const StretRegionClass *clazz, + StretRegionClassID *ret_id ); + +DFBResult stret_class_unregister( StretRegionClassID id ); + + + +DFBResult stret_region_create ( StretRegionClassID class_id, + void *data, + unsigned long arg, + StretRegionFlags flags, + int levels, + int x, + int y, + int width, + int height, + StretRegion *parent, + int level, + FusionSHMPoolShared *pool, + StretRegion **ret_region ); + +DFBResult stret_region_destroy ( StretRegion *region ); + + +DFBResult stret_region_enable ( StretRegion *region, + StretRegionFlags flags ); + +DFBResult stret_region_disable ( StretRegion *region, + StretRegionFlags flags ); + + +DFBResult stret_region_move ( StretRegion *region, + int dx, + int dy ); + +DFBResult stret_region_resize ( StretRegion *region, + int width, + int height ); + +DFBResult stret_region_restack ( StretRegion *region, + int index ); + + +void stret_region_get_abs ( StretRegion *region, + DFBRegion *ret_bounds ); + +void stret_region_get_size ( StretRegion *region, + DFBDimension *ret_size ); + +DFBResult stret_region_get_input( StretRegion *region, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ); + +DFBResult stret_region_visible ( StretRegion *region, + const DFBRegion *base, + bool children, + DFBRegion *ret_regions, + int max_num, + int *ret_num ); + +DFBResult stret_region_update ( StretRegion *region, + const DFBRegion *update, + void *update_data ); + +StretRegion *stret_region_at ( StretRegion *region, + int x, + int y, + StretRegionFlags flags, + StretRegionClassID class_id ); + +void *stret_region_data ( const StretRegion *region ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret_iteration.c b/Source/DirectFB/wm/unique/stret_iteration.c new file mode 100755 index 0000000..30c84e6 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_iteration.c @@ -0,0 +1,209 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include + +#include + +#include +#include + +D_DEBUG_DOMAIN( UniQuE_StReT, "UniQuE/StReT", "UniQuE's Stack Region Tree" ); + +static inline bool +accept_region( StretRegion *region, int x0, int y0, const DFBRegion *clip ) +{ + if (!D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) + return false; + + if (!clip) + return true; + + return dfb_region_intersects( clip, DFB_REGION_VALS_TRANSLATED( ®ion->bounds, x0, y0 ) ); +} + +static inline bool +check_depth( int frame ) +{ + if (frame >= STRET_ITERATION_MAX_DEPTH) { + D_WARN( "refusing to exceed depth limit of %d", STRET_ITERATION_MAX_DEPTH ); + return false; + } + + return true; +} + +void +stret_iteration_init( StretIteration *iteration, StretRegion *region, StretRegion *abort_at ) +{ + D_ASSERT( iteration != NULL ); + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT_IF( abort_at, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_init()\n" ); + + iteration->frame = -1; + iteration->x0 = 0; + iteration->y0 = 0; + iteration->abort = abort_at; + + do { + int last_level = region->levels - 1; + int last_child = fusion_vector_size( ®ion->children[last_level] ) - 1; + + iteration->frame++; + + iteration->x0 += region->bounds.x1; + iteration->y0 += region->bounds.y1; + + iteration->stack[iteration->frame].region = region; + iteration->stack[iteration->frame].level = last_level; + iteration->stack[iteration->frame].index = last_child - 1; + + D_DEBUG_AT( UniQuE_StReT, " -> (%d) %p, last level %d, last index %d\n", + iteration->frame, region, last_level, last_child ); + + if (last_child >= 0) { + region = fusion_vector_at( ®ion->children[last_level], last_child ); + + D_MAGIC_ASSERT( region, StretRegion ); + } + } while (fusion_vector_size( ®ion->children[region->levels - 1] ) && check_depth( iteration->frame + 1 )); + + iteration->stack[iteration->frame].index++; + + D_MAGIC_SET( iteration, StretIteration ); +} + +StretRegion * +stret_iteration_next( StretIteration *iteration, + const DFBRegion *clip ) +{ + int index; + int level; + StretRegion *region; + + D_MAGIC_ASSERT( iteration, StretIteration ); + + DFB_REGION_ASSERT_IF( clip ); + + if (clip) + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_next( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( clip ) ); + else + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_next()\n" ); + + while (iteration->frame >= 0) { + StretIterationStackFrame *frame = &iteration->stack[iteration->frame]; + + region = frame->region; + level = frame->level; + index = frame->index--; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, " -> (%d) %p, level [%d/%d], index %d\n", + iteration->frame, region, level, region->levels - 1, index ); + + if (iteration->abort && region == iteration->abort) { + D_MAGIC_CLEAR( iteration ); + return NULL; + } + + if (index < 0) { + level = --frame->level; + + if (level < 0) { + iteration->frame--; + + iteration->x0 -= region->bounds.x1; + iteration->y0 -= region->bounds.y1; + + if (accept_region( region, iteration->x0, iteration->y0, clip )) + return region; + } + else { + frame->index = fusion_vector_size( ®ion->children[level] ) - 1; + } + } + else { + region = fusion_vector_at( ®ion->children[level], index ); + + D_MAGIC_ASSERT( region, StretRegion ); + + if (iteration->abort && region == iteration->abort) { + D_MAGIC_CLEAR( iteration ); + return NULL; + } + + if (accept_region( region, iteration->x0, iteration->y0, clip )) { + level = region->levels - 1; + + while (fusion_vector_is_empty( ®ion->children[level] )) { + if (level) + level--; + else + return region; + } + + if (check_depth( iteration->frame + 1 )) { + frame = &iteration->stack[++iteration->frame]; + + iteration->x0 += region->bounds.x1; + iteration->y0 += region->bounds.y1; + + frame->region = region; + frame->level = level; + frame->index = fusion_vector_size( ®ion->children[level] ) - 1; + + continue; + } + + return region; + } + } + } + + D_ASSUME( iteration->x0 == 0 ); + D_ASSUME( iteration->y0 == 0 ); + + D_MAGIC_CLEAR( iteration ); + + return NULL; +} + +void +stret_iteration_abort( StretIteration *iteration ) +{ + D_MAGIC_CLEAR( iteration ); +} + diff --git a/Source/DirectFB/wm/unique/stret_iteration.h b/Source/DirectFB/wm/unique/stret_iteration.h new file mode 100755 index 0000000..251280a --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_iteration.h @@ -0,0 +1,68 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__STRET_ITERATION_H__ +#define __UNIQUE__STRET_ITERATION_H__ + +#include + +#include + + +#define STRET_ITERATION_MAX_DEPTH 4 + +typedef struct { + StretRegion *region; + int level; + int index; +} StretIterationStackFrame; + +typedef struct { + int magic; + + StretIterationStackFrame stack[STRET_ITERATION_MAX_DEPTH]; + int frame; + + int x0; + int y0; + + StretRegion *abort; +} StretIteration; + + +void stret_iteration_init ( StretIteration *iteration, + StretRegion *region, + StretRegion *abort_at ); + +StretRegion *stret_iteration_next ( StretIteration *iteration, + const DFBRegion *clip ); + +void stret_iteration_abort( StretIteration *iteration ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret_test.c b/Source/DirectFB/wm/unique/stret_test.c new file mode 100755 index 0000000..62839d0 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_test.c @@ -0,0 +1,153 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +int +main( int argc, char *argv[] ) +{ + DirectResult ret; + FusionWorld *world; + StretRegion *root; + StretRegion *child[16]; + int child_num = 0; + StretIteration iteration; + DFBRegion clip; + FusionSHMPoolShared *pool; + + ret = fusion_enter( -1, 0, FER_ANY, &world ); + if (ret) + return -1; + + ret = fusion_shm_pool_create( world, "StReT Test Pool", 0x10000, direct_config->debug, &pool ); + if (ret) { + fusion_exit( world, false ); + return -1; + } + + D_INFO( "StReT/Test: Starting...\n" ); + + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 2, 0, 0, 1000, 1000, NULL, 0, pool, &root ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create root region!\n" ); + goto error_root; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 10, 10, 100, 100, root, 1, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 50, 50, 30, 30, child[0], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 20, 20, 30, 30, child[0], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 10, 10, 10, 10, child[2], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 20, 20, 10, 10, child[2], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + } + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 200, 10, 200, 200, root, 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + } + + + + + stret_iteration_init( &iteration, root, NULL ); + + clip = (DFBRegion) { 50, 50, 200, 59 }; + + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[4] ); + //D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[3] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[2] ); + //D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[1] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[0] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[5] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == root ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == NULL ); + + + stret_region_destroy( child[child_num-1] ); + +error_child: + while (--child_num) + stret_region_destroy( child[child_num-1] ); + + stret_region_destroy( root ); + +error_root: + fusion_shm_pool_destroy( world, pool ); + + fusion_exit( world, false ); + + return 0; +} + diff --git a/Source/DirectFB/wm/unique/test_color.c b/Source/DirectFB/wm/unique/test_color.c new file mode 100755 index 0000000..66bedba --- /dev/null +++ b/Source/DirectFB/wm/unique/test_color.c @@ -0,0 +1,221 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include +#include + +/*****************************************************************************/ + +static IDirectFB *dfb = NULL; + +static const char *filename = NULL; +static DFBBoolean color = DFB_FALSE; + + +/*****************************************************************************/ + +static DFBBoolean parse_command_line ( int argc, char *argv[] ); +static void set_color ( void ); + +/*****************************************************************************/ + +static UniqueContext *context; + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + if (object->state != FOS_ACTIVE) + return true; + + context = (UniqueContext*) object; + if (unique_context_ref( context )) { + D_ERROR( "UniQuE/Test: unique_context_ref() failed!\n" ); + return true; + } + + return false; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = DirectFBCreate( &dfb ); + if (ret) { + DirectFBError( "DirectFBCreate() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + unique_wm_enum_contexts( context_callback, NULL ); + + if (!context) { + D_ERROR( "UniQuE/Test: No context available!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + /* Set the background according to the users wishes. */ + if (color) + set_color(); + + unique_context_unref( context ); + + /* Release the super interface. */ + dfb->Release( dfb ); + + return EXIT_SUCCESS; +} + +/*****************************************************************************/ + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Test Application (version %s)\n" + "\n" + "Usage: %s [options] \n" + "\n" + "Options:\n" + " -c, --color Set in AARRGGBB format (hexadecimal)\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + if (!filename) { + filename = a; + continue; + } + else { + print_usage( prg_name ); + return DFB_FALSE; + } + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + if (strcmp (a, "-c") == 0 || strcmp (a, "--color") == 0) { + color = DFB_TRUE; + continue; + } + } + + if (!filename) { + print_usage( prg_name ); + return DFB_FALSE; + } + + return DFB_TRUE; +} + +static void +set_color( void ) +{ + DFBResult ret; + char *error; + u32 argb; + DFBColor color; + + if (*filename == '#') + filename++; + + argb = strtoul( filename, &error, 16 ); + + if (*error) { + fprintf( stderr, "Invalid characters in color string: '%s'\n", error ); + return; + } + + color.a = (argb & 0xFF000000) >> 24; + color.r = (argb & 0xFF0000) >> 16; + color.g = (argb & 0xFF00) >> 8; + color.b = (argb & 0xFF); + + ret = unique_context_set_color( context, &color ); + if (ret) + D_DERROR( ret, "UniQuE/Test: unique_context_set_color() failed!\n" ); +} + diff --git a/Source/DirectFB/wm/unique/test_foo.c b/Source/DirectFB/wm/unique/test_foo.c new file mode 100755 index 0000000..02bfc56 --- /dev/null +++ b/Source/DirectFB/wm/unique/test_foo.c @@ -0,0 +1,288 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include + +D_DEBUG_DOMAIN( UniQuE_TestFoo, "UniQuE/TestFoo", "UniQuE's Test Foo Application" ); + +/*****************************************************************************/ + +static IDirectFB *dfb = NULL; + +/*****************************************************************************/ + +static DFBBoolean parse_command_line( int argc, char *argv[] ); + +/*****************************************************************************/ + +static UniqueContext *context; + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + if (object->state != FOS_ACTIVE) + return true; + + context = (UniqueContext*) object; + if (unique_context_ref( context )) { + D_ERROR( "UniQuE/Test: unique_context_ref() failed!\n" ); + return true; + } + + return false; +} + +static void +dispatch_motion( UniqueWindow *window, + const UniqueInputPointerEvent *event ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + D_ASSERT( event != NULL ); + + if (event->buttons) { + CoreWindowConfig config; + + unique_window_get_config( window, &config ); + + config.bounds.x -= window->foo_motion.x - event->x; + config.bounds.y -= window->foo_motion.y - event->y; + + unique_window_set_config( window, &config, CWCF_POSITION ); + } + + window->foo_motion.x = event->x; + window->foo_motion.y = event->y; +} + +static void +dispatch_button( UniqueWindow *window, + const UniqueInputPointerEvent *event ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + D_ASSERT( event != NULL ); + + if (event->press) + unique_window_restack( window, NULL, 1 ); +} + +static ReactionResult +foo_channel_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueContext *context = ctx; + CoreLayerRegion *region; + StretRegion *stret; + WMShared *shared; + static UniqueWindow *window; + + (void) context; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_TestFoo, "foo_channel_listener( %p, %p )\n", event, context ); + + region = context->region; + D_ASSERT( region != NULL ); + D_ASSERT( region->context != NULL ); + + shared = context->shared; + D_MAGIC_ASSERT( shared, WMShared ); + + dfb_layer_context_lock( region->context ); + + switch (event->type) { + case UIET_MOTION: + case UIET_BUTTON: + /* FIXME: This is a workaround because of the global input channel used for all windows. */ + stret = stret_region_at( context->root, event->pointer.x, event->pointer.y, + SRF_INPUT, shared->region_classes[URCI_FOO] ); + if (stret) + window = stret->data; + else if (event->type == UIET_BUTTON && !event->pointer.buttons) + window = NULL; + + if (window) { + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (event->type == UIET_MOTION) + dispatch_motion( window, &event->pointer ); + else + dispatch_button( window, &event->pointer ); + } + break; + + case UIET_WHEEL: + break; + + case UIET_KEY: + break; + + case UIET_CHANNEL: + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + dfb_layer_context_unlock( region->context ); + + return RS_OK; +} + + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + Reaction reaction; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = DirectFBCreate( &dfb ); + if (ret) { + DirectFBError( "DirectFBCreate() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + unique_wm_enum_contexts( context_callback, NULL ); + + if (!context) { + D_ERROR( "UniQuE/Test: No context available!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + + unique_input_channel_attach( context->foo_channel, foo_channel_listener, context, &reaction ); + + pause(); + + unique_input_channel_detach( context->foo_channel, &reaction ); + + unique_context_unref( context ); + + /* Release the super interface. */ + dfb->Release( dfb ); + + return EXIT_SUCCESS; +} + +/*****************************************************************************/ + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Foo Test (version %s)\n" + "\n" + "Usage: %s [options]\n" + "\n" + "Options:\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + } + + return DFB_TRUE; +} + diff --git a/Source/DirectFB/wm/unique/types.h b/Source/DirectFB/wm/unique/types.h new file mode 100755 index 0000000..221ae6b --- /dev/null +++ b/Source/DirectFB/wm/unique/types.h @@ -0,0 +1,53 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__TYPES_H__ +#define __UNIQUE__TYPES_H__ + + +typedef struct __UniQuE_UniqueContext UniqueContext; +typedef struct __UniQuE_UniqueDecoration UniqueDecoration; +typedef struct __UniQuE_UniqueDecorationItem UniqueDecorationItem; +typedef struct __UniQuE_UniqueDevice UniqueDevice; +typedef struct __UniQuE_UniqueLayout UniqueLayout; +typedef struct __UniQuE_UniqueWindow UniqueWindow; + +typedef struct __UniQuE_UniqueInputChannel UniqueInputChannel; +typedef union __UniQuE_UniqueInputEvent UniqueInputEvent; +typedef struct __UniQuE_UniqueInputFilter UniqueInputFilter; +typedef struct __UniQuE_UniqueInputSwitch UniqueInputSwitch; + + +typedef struct __UniQuE_StretRegion StretRegion; + + +typedef struct __UniQuE_WMData WMData; +typedef struct __UniQuE_WMShared WMShared; + +#endif + diff --git a/Source/DirectFB/wm/unique/unique.c b/Source/DirectFB/wm/unique/unique.c new file mode 100755 index 0000000..bb0c5ec --- /dev/null +++ b/Source/DirectFB/wm/unique/unique.c @@ -0,0 +1,1064 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( WM_Unique, "WM/UniQuE", "UniQuE - Universal Quark Emitter" ); + + +DFB_WINDOW_MANAGER( unique ); + +/**************************************************************************************************/ + +typedef struct { + int magic; + + CoreWindowStack *stack; + + UniqueContext *context; + + GlobalReaction context_reaction; +} StackData; + +typedef struct { + int magic; + + UniqueContext *context; + + UniqueWindow *window; + + GlobalReaction window_reaction; +} WindowData; + +/**************************************************************************************************/ + +static ReactionResult +context_notify( WMData *data, + const UniqueContextNotification *notification, + void *ctx ) +{ + StackData *stack_data = ctx; + + D_ASSERT( data != NULL ); + + D_ASSERT( notification != NULL ); + D_ASSERT( notification->context != NULL ); + + D_MAGIC_ASSERT( stack_data, StackData ); + + D_ASSERT( notification->context == stack_data->context ); + + D_MAGIC_ASSERT( stack_data->context, UniqueContext ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UCNF_ALL ) ); + + D_DEBUG_AT( WM_Unique, "context_notify( wm_data %p, stack_data %p )\n", data, stack_data ); + + if (notification->flags & UCNF_DESTROYED) { + D_DEBUG_AT( WM_Unique, " -> context destroyed.\n" ); + + if (notification->context == stack_data->context) + stack_data->context = NULL; + + return RS_REMOVE; + } + + return RS_OK; +} + +static ReactionResult +window_notify( WMData *data, + const UniqueWindowNotification *notification, + void *ctx ) +{ + WindowData *window_data = ctx; + + D_ASSERT( data != NULL ); + + D_ASSERT( notification != NULL ); + D_ASSERT( notification->window != NULL ); + + D_MAGIC_ASSERT( window_data, WindowData ); + + D_ASSERT( notification->window == window_data->window ); + + D_MAGIC_ASSERT( window_data->window, UniqueWindow ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UWNF_ALL ) ); + + D_DEBUG_AT( WM_Unique, "window_notify( wm_data %p, window_data %p )\n", data, window_data ); + + if (notification->flags & UWNF_DESTROYED) { + D_DEBUG_AT( WM_Unique, " -> window destroyed.\n" ); + + window_data->window = NULL; + + return RS_REMOVE; + } + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +initialize_data( CoreDFB *core, WMData *data, WMShared *shared ) +{ + D_ASSERT( data != NULL ); + + /* Initialize local data. */ + data->core = core; + data->world = dfb_core_world( core ); + data->shared = shared; + data->module_abi = UNIQUE_WM_ABI_VERSION; + + /* Set module callbacks. */ + data->context_notify = context_notify; + data->window_notify = window_notify; +} + +/**************************************************************************************************/ + +static void +wm_get_info( CoreWMInfo *info ) +{ + info->version.major = 0; + info->version.minor = 4; + info->version.binary = UNIQUE_WM_ABI_VERSION; + + snprintf( info->name, DFB_CORE_WM_INFO_NAME_LENGTH, "UniQuE" ); + snprintf( info->vendor, DFB_CORE_WM_INFO_VENDOR_LENGTH, "Denis Oliver Kropp" ); + + info->wm_data_size = sizeof(WMData); + info->wm_shared_size = sizeof(WMShared); + info->stack_data_size = sizeof(StackData); + info->window_data_size = sizeof(WindowData); +} + +static DFBResult +wm_initialize( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + WMShared *shared = shared_data; + + D_DEBUG_AT( WM_Unique, "wm_initialize()\n" ); + + initialize_data( core, data, shared ); + + D_MAGIC_SET( shared, WMShared ); + + return unique_wm_module_init( core, data, shared, true ); +} + +static DFBResult +wm_join( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + WMShared *shared = shared_data; + + D_DEBUG_AT( WM_Unique, "wm_join()\n" ); + + initialize_data( core, data, shared ); + + return unique_wm_module_init( core, data, shared, false ); +} + +static DFBResult +wm_shutdown( bool emergency, void *wm_data, void *shared_data ) +{ + WMShared *shared = shared_data; + + (void) shared; + + D_DEBUG_AT( WM_Unique, "wm_shutdown()\n" ); + + unique_wm_module_deinit( wm_data, shared_data, true, emergency ); + + D_MAGIC_CLEAR( shared ); + + return DFB_OK; +} + +static DFBResult +wm_leave( bool emergency, void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_leave()\n" ); + + unique_wm_module_deinit( wm_data, shared_data, false, emergency ); + + return DFB_OK; +} + +static DFBResult +wm_suspend( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_suspend()\n" ); + + return DFB_OK; +} + +static DFBResult +wm_resume( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_resume()\n" ); + + return DFB_OK; +} + +static DFBResult +wm_post_init( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_post_init()\n" ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +wm_init_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + DFBResult ret; + StackData *data = stack_data; + WMData *wmdata = wm_data; + CoreLayerContext *context; + CoreLayerRegion *region; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->context != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + context = stack->context; + + D_ASSERT( context != NULL ); + + ret = dfb_layer_context_get_primary_region( context, true, ®ion ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not get the primary region!\n" ); + return ret; + } + + /* Create the unique context. */ + ret = unique_context_create( wmdata->core, stack, region, context->layer_id, + wmdata->shared, &data->context ); + dfb_layer_region_unref( region ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not create the context!\n" ); + return ret; + } + + /* Attach the global context listener. */ + ret = unique_context_attach_global( data->context, + UNIQUE_WM_MODULE_CONTEXT_LISTENER, + data, &data->context_reaction ); + if (ret) { + unique_context_unref( data->context ); + D_DERROR( ret, "WM/UniQuE: Could not attach global context listener!\n" ); + return ret; + } + + /* Inherit all local references from the layer context. */ + ret = unique_context_inherit( data->context, context ); + unique_context_unref( data->context ); + if (ret) { + unique_context_detach_global( data->context, &data->context_reaction ); + D_DERROR( ret, "WM/UniQuE: Could not inherit from layer context!\n" ); + return ret; + } + + + + data->stack = stack; + + D_MAGIC_SET( data, StackData ); + + return DFB_OK; +} + +static DFBResult +wm_close_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_ASSUME( data->context == NULL ); + + if (data->context) + unique_context_detach_global( data->context, &data->context_reaction ); + + D_MAGIC_CLEAR( data ); + + return DFB_OK; +} + +static DFBResult +wm_set_active( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + bool active ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_DEBUG_AT( WM_Unique, "%s( stack %p, wm_data %p, stack_data %p, %sactive )\n", + __FUNCTION__, stack, wm_data, stack_data, active ? "" : "in" ); + + if (!data->context) { + D_ASSERT( !active ); + return DFB_OK; + } + + return unique_context_set_active( data->context, active ); +} + +static DFBResult +wm_resize_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int width, + int height ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_resize( data->context, width, height ); +} + +static DFBResult +wm_process_input( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBInputEvent *event ) +{ + StackData *data = stack_data; + + (void) data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + return DFB_OK; +} + +static DFBResult +wm_flush_keys( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_flush_keys( data->context ); +} + +static DFBResult +wm_window_at( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int x, + int y, + CoreWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *window; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + ret = unique_context_window_at( data->context, x, y, &window ); + if (ret) + return ret; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + *ret_window = window->window; + + return DFB_OK; +} + +static DFBResult +wm_window_lookup( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + DFBWindowID window_id, + CoreWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *window; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + ret = unique_context_lookup_window( data->context, window_id, &window ); + if (ret) + return ret; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + *ret_window = window->window; + + return DFB_OK; +} + +static DFBResult +wm_enum_windows( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWMWindowCallback callback, + void *callback_ctx ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( callback != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_enum_windows( data->context, callback, callback_ctx ); +} + +/**************************************************************************************************/ + +static DFBResult +wm_get_insets( CoreWindowStack *stack, + CoreWindow *window, + DFBInsets *insets ) +{ + if( insets ) { + insets->l=0; + insets->t=0; + insets->r=0; + insets->b=0; + } + return DFB_OK; +} + +static DFBResult +wm_preconfigure_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_set_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void *value, + void **ret_old_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_set_property((FusionObject*)window, + key,value,ret_old_value); + return DFB_OK; +} + +static DFBResult +wm_get_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + D_ASSERT( ret_value != NULL ); + + *ret_value=fusion_object_get_property((FusionObject*)window,key); + return DFB_OK; +} + + +static DFBResult +wm_remove_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_remove_property((FusionObject*)window,key,ret_value); + return DFB_OK; +} + +static DFBResult +wm_add_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + DFBResult ret; + StackData *sdata = stack_data; + WindowData *data = window_data; + WMData *wmdata = wm_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( sdata, StackData ); + D_MAGIC_ASSERT( sdata->context, UniqueContext ); + + data->context = sdata->context; + + /* Create the unique window. */ + ret = unique_window_create( wmdata->core, window, data->context, + window->caps, &window->config, &data->window ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not create window!\n" ); + return ret; + } + + /* Attach the global window listener. */ + ret = unique_window_attach_global( data->window, + UNIQUE_WM_MODULE_WINDOW_LISTENER, + data, &data->window_reaction ); + if (ret) { + unique_window_unref( data->window ); + D_DERROR( ret, "WM/UniQuE: Could not attach global window listener!\n" ); + return ret; + } + + /* Inherit all local references from the layer window. */ + ret = unique_window_inherit( data->window, window ); + unique_window_unref( data->window ); + if (ret) { + unique_window_detach_global( data->window, &data->window_reaction ); + D_DERROR( ret, "WM/UniQuE: Could not inherit from core window!\n" ); + return ret; + } + + unique_window_get_config( data->window, &window->config ); + + + D_MAGIC_SET( data, WindowData ); + + return DFB_OK; +} + +static DFBResult +wm_remove_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + WindowData *data = window_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + +// D_ASSUME( data->window == NULL ); + + if (data->window) + unique_window_detach_global( data->window, &data->window_reaction ); + + D_MAGIC_CLEAR( data ); + + return DFB_OK; +} + +static DFBResult +wm_set_window_config( CoreWindow *window, + void *wm_data, + void *window_data, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ) +{ + DFBResult ret; + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( config != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + ret = unique_window_set_config( data->window, config, flags ); + + unique_window_get_config( data->window, &window->config ); + + return ret; +} + +static DFBResult +wm_restack_window( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWindow *relative, + void *relative_data, + int relation ) +{ + WindowData *data = window_data; + WindowData *rel_data = relative_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + D_ASSERT( relative == NULL || relative_data != NULL ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_restack( data->window, rel_data ? rel_data->window : NULL, relation ); +} + +static DFBResult +wm_grab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_grab( data->window, grab ); +} + +static DFBResult +wm_ungrab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_ungrab( data->window, grab ); +} + +static DFBResult +wm_request_focus( CoreWindow *window, + void *wm_data, + void *window_data ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_request_focus( data->window ); +} + +/**************************************************************************************************/ + +static DFBResult +wm_update_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + DFB_REGION_ASSERT( region ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_update( data->context, region, 1, flags ); +} + +static DFBResult +wm_update_window( CoreWindow *window, + void *wm_data, + void *window_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + DFB_REGION_ASSERT_IF( region ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_update( data->window, region, flags ); +} + +/**************************************************************************************************/ + +/* HACK: implementation dumped in here for now, will move into context */ +static DFBResult +wm_update_cursor( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreCursorUpdateFlags flags ) +{ + DFBResult ret; + DFBRegion old_region; + WMData *wmdata = wm_data; + StackData *data = stack_data; + bool restored = false; + CoreLayer *layer; + CoreLayerRegion *region; + CardState *state; + CoreSurface *surface; + UniqueContext *context; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->context != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + context = data->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Optimize case of invisible cursor moving. */ + if (!(flags & ~(CCUF_POSITION | CCUF_SHAPE)) && (!stack->cursor.opacity || !stack->cursor.enabled)) { + context->cursor_bs_valid = false; + return DFB_OK; + } + + layer = dfb_layer_at( context->layer_id ); + state = &layer->state; + region = context->region; + surface = context->surface; + + D_ASSERT( region != NULL ); + D_ASSERT( surface != NULL ); + + if (flags & CCUF_ENABLE) { + CoreSurface *cursor_bs; + DFBSurfaceCapabilities caps = DSCAPS_NONE; + + dfb_surface_caps_apply_policy( stack->cursor.policy, &caps ); + + D_ASSERT( context->cursor_bs == NULL ); + + /* Create the cursor backing store surface. */ + ret = dfb_surface_create_simple( wmdata->core, stack->cursor.size.w, stack->cursor.size.h, + region->config.format, caps, CSTF_SHARED | CSTF_CURSOR, + 0, /* FIXME: no shared cursor objects, no cursor id */ + NULL, &cursor_bs ); + if (ret) { + D_ERROR( "WM/Default: Failed creating backing store for cursor!\n" ); + return ret; + } + + ret = dfb_surface_globalize( cursor_bs ); + D_ASSERT( ret == DFB_OK ); + + /* Ensure valid back buffer for now. + * FIXME: Keep a flag to know when back/front have been swapped and need a sync. + */ + switch (region->config.buffermode) { + case DLBM_BACKVIDEO: + case DLBM_TRIPLE: + dfb_gfx_copy( surface, surface, NULL ); + break; + + default: + break; + } + + context->cursor_bs = cursor_bs; + } + else { + D_ASSERT( context->cursor_bs != NULL ); + + /* restore region under cursor */ + if (context->cursor_drawn) { + DFBRectangle rect = { 0, 0, + context->cursor_region.x2 - context->cursor_region.x1 + 1, + context->cursor_region.y2 - context->cursor_region.y1 + 1 }; + + D_ASSERT( stack->cursor.opacity || (flags & CCUF_OPACITY) ); + D_ASSERT( context->cursor_bs_valid ); + + dfb_gfx_copy_to( context->cursor_bs, surface, &rect, + context->cursor_region.x1, context->cursor_region.y1, false ); + + context->cursor_drawn = false; + + old_region = context->cursor_region; + restored = true; + } + + if (flags & CCUF_SIZE) { + ret = dfb_surface_reformat( context->cursor_bs, + stack->cursor.size.w, stack->cursor.size.h, + context->cursor_bs->config.format ); + if (ret) { + D_ERROR( "WM/Default: Failed resizing backing store for cursor!\n" ); + return ret; + } + } + } + + if (flags & (CCUF_ENABLE | CCUF_POSITION | CCUF_SIZE | CCUF_OPACITY)) { + context->cursor_bs_valid = false; + + context->cursor_region.x1 = stack->cursor.x - stack->cursor.hot.x; + context->cursor_region.y1 = stack->cursor.y - stack->cursor.hot.y; + context->cursor_region.x2 = context->cursor_region.x1 + stack->cursor.size.w - 1; + context->cursor_region.y2 = context->cursor_region.y1 + stack->cursor.size.h - 1; + + if (!dfb_region_intersect( &context->cursor_region, 0, 0, stack->width - 1, stack->height - 1 )) { + D_BUG( "invalid cursor region" ); + return DFB_BUG; + } + } + + D_ASSERT( context->cursor_bs != NULL ); + + if (flags & CCUF_DISABLE) { + dfb_surface_unlink( &context->cursor_bs ); + } + else if (stack->cursor.opacity) { + /* backup region under cursor */ + if (!context->cursor_bs_valid) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &context->cursor_region ); + + D_ASSERT( !context->cursor_drawn ); + + /* FIXME: this requires using blitted flipping all the time, + but fixing it seems impossible, for now DSFLIP_BLIT is forced + in repaint_stack() when the cursor is enabled. */ + dfb_gfx_copy_to( surface, context->cursor_bs, &rect, 0, 0, true ); + + context->cursor_bs_valid = true; + } + + /* Set destination. */ + state->destination = surface; + state->modified |= SMF_DESTINATION; + + /* Set clipping region. */ + dfb_state_set_clip( state, &context->cursor_region ); + + /* draw cursor */ + unique_draw_cursor( stack, context, state, &context->cursor_region ); + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + context->cursor_drawn = true; + + if (restored) { + if (dfb_region_region_intersects( &old_region, &context->cursor_region )) + dfb_region_region_union( &old_region, &context->cursor_region ); + else + dfb_layer_region_flip_update( region, &context->cursor_region, DSFLIP_BLIT ); + + dfb_layer_region_flip_update( region, &old_region, DSFLIP_BLIT ); + } + else + dfb_layer_region_flip_update( region, &context->cursor_region, DSFLIP_BLIT ); + } + else if (restored) + dfb_layer_region_flip_update( region, &old_region, DSFLIP_BLIT ); + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/uniquewm.c b/Source/DirectFB/wm/unique/uniquewm.c new file mode 100755 index 0000000..8247556 --- /dev/null +++ b/Source/DirectFB/wm/unique/uniquewm.c @@ -0,0 +1,451 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + + +D_DEBUG_DOMAIN( UniQuE_WM, "UniQuE/WM", "UniQuE - Universal Quark Emitter" ); + +/**************************************************************************************************/ + +static CoreDFB *dfb_core; +static WMData *wm_data; +static WMShared *wm_shared; + +/**************************************************************************************************/ + +static const StretRegionClass *region_classes[_URCI_NUM] = { + &unique_root_region_class, + &unique_frame_region_class, + &unique_window_region_class, + &unique_foo_region_class +}; + +static DFBResult register_region_classes ( WMShared *shared, + bool master ); + +static DFBResult unregister_region_classes( WMShared *shared ); + +/**************************************************************************************************/ + +static const UniqueDeviceClass *device_classes[_UDCI_NUM] = { + &unique_pointer_device_class, + &unique_wheel_device_class, + &unique_keyboard_device_class +}; + +static DFBResult register_device_classes ( WMShared *shared, + bool master ); + +static DFBResult unregister_device_classes( WMShared *shared ); + +/**************************************************************************************************/ + +static DFBResult +load_foo( CoreDFB *core, WMShared *shared ) +{ + DFBResult ret; + + D_ASSERT( core != NULL ); + + D_MAGIC_ASSERT( shared, WMShared ); + + ret = dfb_surface_create_simple( core, foo_desc.width, foo_desc.height, foo_desc.pixelformat, + DSCAPS_NONE, CSTF_SHARED, 0, NULL, &shared->foo_surface ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Could not create %dx%d surface for border tiles!\n", + foo_desc.width, foo_desc.height ); + return ret; + } + + ret = dfb_surface_write_buffer( shared->foo_surface, CSBR_BACK, + foo_desc.preallocated[0].data, foo_desc.preallocated[0].pitch, NULL ); + if (ret) + D_DERROR( ret, "UniQuE/WM: Could not write to %dx%d surface for border tiles!\n", + foo_desc.width, foo_desc.height ); + + dfb_surface_globalize( shared->foo_surface ); + + return DFB_OK; +} + +static void +unload_foo( WMShared *shared ) +{ + D_MAGIC_ASSERT( shared, WMShared ); + + dfb_surface_unlink( &shared->foo_surface ); +} + +/**************************************************************************************************/ + +DFBResult +unique_wm_module_init( CoreDFB *core, WMData *data, WMShared *shared, bool master ) +{ + DFBResult ret; + + D_DEBUG_AT( UniQuE_WM, "unique_wm_init( core %p, data %p, shared %p, %s )\n", + core, data, shared, master ? "master" : "slave" ); + + D_ASSERT( core != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( data->context_notify != NULL ); + D_ASSERT( data->window_notify != NULL ); + + D_MAGIC_ASSERT( shared, WMShared ); + + D_ASSERT( dfb_core == NULL ); + D_ASSERT( wm_data == NULL ); + D_ASSERT( wm_shared == NULL ); + + if (data->module_abi != UNIQUE_WM_ABI_VERSION) { + D_ERROR( "UniQuE/WM: Module ABI version (%d) does not match %d!\n", + data->module_abi, UNIQUE_WM_ABI_VERSION ); + return DFB_VERSIONMISMATCH; + } + + ret = register_region_classes( shared, master ); + if (ret) + return ret; + + ret = register_device_classes( shared, master ); + if (ret) + goto error_device; + + if (master) { + int i; + + ret = load_foo( core, shared ); + if (ret) + goto error_foo; + + ret = dfb_input_add_global( _unique_device_listener, &shared->device_listener ); + if (ret) + goto error_global; + + shared->context_pool = unique_context_pool_create( data->world ); + shared->decoration_pool = unique_decoration_pool_create( data->world ); + shared->window_pool = unique_window_pool_create( data->world ); + + shared->insets.l = foo[UFI_W].rect.w; + shared->insets.t = foo[UFI_N].rect.h; + shared->insets.r = foo[UFI_E].rect.w; + shared->insets.b = foo[UFI_S].rect.h; + + for (i=0; i<8; i++) + shared->foo_rects[i] = foo[i].rect; + } + else + dfb_input_set_global( _unique_device_listener, shared->device_listener ); + + dfb_core = core; + wm_data = data; + wm_shared = shared; + + return DFB_OK; + +error_global: + unload_foo( shared ); + +error_foo: + unregister_device_classes( shared ); + +error_device: + unregister_region_classes( shared ); + + return ret; +} + +void +unique_wm_module_deinit( WMData *data, WMShared *shared, bool master, bool emergency ) +{ + D_DEBUG_AT( UniQuE_WM, "unique_wm_deinit( %s%s ) <- core %p, data %p, shared %p\n", + master ? "master" : "slave", emergency ? ", emergency" : "", + dfb_core, wm_data, wm_shared ); + + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data == data ); + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( wm_shared == shared ); + + if (master) { + fusion_object_pool_destroy( shared->window_pool, data->world ); + fusion_object_pool_destroy( shared->decoration_pool, data->world ); + fusion_object_pool_destroy( shared->context_pool, data->world ); + } + + unregister_device_classes( shared ); + unregister_region_classes( shared ); + + if (master) + unload_foo( wm_shared ); + + dfb_core = NULL; + wm_data = NULL; + wm_shared = NULL; +} + +ReactionResult +_unique_wm_module_context_listener( const void *msg_data, + void *ctx ) +{ + const UniqueContextNotification *notification = msg_data; + + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data->context_notify != NULL ); + + D_ASSERT( notification != NULL ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UCNF_ALL ) ); + + D_DEBUG_AT( UniQuE_WM, "%s( context %p, flags 0x%08x )\n", + __FUNCTION__, notification->context, notification->flags ); + + return wm_data->context_notify( wm_data, notification, ctx ); +} + +ReactionResult +_unique_wm_module_window_listener ( const void *msg_data, + void *ctx ) +{ + const UniqueWindowNotification *notification = msg_data; + + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data->window_notify != NULL ); + + D_ASSERT( notification != NULL ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UWNF_ALL ) ); + + D_DEBUG_AT( UniQuE_WM, "%s( window %p, flags 0x%08x )\n", + __FUNCTION__, notification->window, notification->flags ); + + return wm_data->window_notify( wm_data, notification, ctx ); +} + +UniqueContext * +unique_wm_create_context( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return (UniqueContext*) fusion_object_create( wm_shared->context_pool, wm_data->world ); +} + +UniqueDecoration * +unique_wm_create_decoration( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->decoration_pool != NULL ); + + return (UniqueDecoration*) fusion_object_create( wm_shared->decoration_pool, wm_data->world ); +} + +UniqueWindow * +unique_wm_create_window( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->window_pool != NULL ); + + return (UniqueWindow*) fusion_object_create( wm_shared->window_pool, wm_data->world ); +} + +/**************************************************************************************************/ + +bool +unique_wm_running( void ) +{ + if (dfb_core) { + if (!wm_data || !wm_shared) { + D_BUG( "partly initialized module (%p,%p,%p)", dfb_core, wm_data, wm_shared ); + return false; + } + + return true; + } + + return false; +} + +DirectResult +unique_wm_enum_contexts( FusionObjectCallback callback, + void *ctx ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return fusion_object_pool_enum( wm_shared->context_pool, callback, ctx ); +} + +DirectResult +unique_wm_enum_windows( FusionObjectCallback callback, + void *ctx ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return fusion_object_pool_enum( wm_shared->window_pool, callback, ctx ); +} + +/**************************************************************************************************/ + +static DFBResult +register_region_classes( WMShared *shared, + bool master ) +{ + int i; + DFBResult ret; + StretRegionClassID class_id; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_URCI_NUM; i++) { + ret = stret_class_register( region_classes[i], &class_id ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Failed to register region class %d!\n", i ); + + goto error; + } + + if (master) + shared->region_classes[i] = class_id; + else if (shared->region_classes[i] != class_id) { + D_ERROR( "UniQuE/WM: Class IDs mismatch (%d/%d)!\n", + class_id, shared->region_classes[i] ); + + stret_class_unregister( class_id ); + + ret = DFB_VERSIONMISMATCH; + goto error; + } + } + + return DFB_OK; + +error: + while (--i >= 0) + stret_class_unregister( shared->region_classes[i] ); + + return ret; +} + +static DFBResult +unregister_region_classes( WMShared *shared ) +{ + int i; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=_URCI_NUM-1; i>=0; i--) + stret_class_unregister( shared->region_classes[i] ); + + return DFB_OK; +} + +static DFBResult +register_device_classes( WMShared *shared, + bool master ) +{ + int i; + DFBResult ret; + UniqueDeviceClassID class_id; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_UDCI_NUM; i++) { + ret = unique_device_class_register( device_classes[i], &class_id ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Failed to register device class %d!\n", i ); + + goto error; + } + + if (master) + shared->device_classes[i] = class_id; + else if (shared->device_classes[i] != class_id) { + D_ERROR( "UniQuE/WM: Class IDs mismatch (%d/%d)!\n", + class_id, shared->device_classes[i] ); + + unique_device_class_unregister( class_id ); + + ret = DFB_VERSIONMISMATCH; + goto error; + } + } + + return DFB_OK; + +error: + while (--i >= 0) + unique_device_class_unregister( shared->device_classes[i] ); + + return ret; +} + +static DFBResult +unregister_device_classes( WMShared *shared ) +{ + int i; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=_UDCI_NUM-1; i>=0; i--) + unique_device_class_unregister( shared->device_classes[i] ); + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/uniquewm.h b/Source/DirectFB/wm/unique/uniquewm.h new file mode 100755 index 0000000..9b1913b --- /dev/null +++ b/Source/DirectFB/wm/unique/uniquewm.h @@ -0,0 +1,48 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__UNIQUEWM_H__ +#define __UNIQUE__UNIQUEWM_H__ + +#include +#include + +#include + + +bool unique_wm_running ( void ); + +DirectResult unique_wm_enum_contexts( FusionObjectCallback callback, + void *ctx ); + +DirectResult unique_wm_enum_windows ( FusionObjectCallback callback, + void *ctx ); + + +#endif + diff --git a/Source/DirectFB/wm/unique/uwmdump.c b/Source/DirectFB/wm/unique/uwmdump.c new file mode 100755 index 0000000..811d344 --- /dev/null +++ b/Source/DirectFB/wm/unique/uwmdump.c @@ -0,0 +1,267 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Dump (version %s)\n" + "\n" + "Usage: %s [options]\n" + "\n" + "Options:\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + } + + return DFB_TRUE; +} + +static bool +window_callback( UniqueWindow *window ) +{ + int refs; + DirectResult ret; + DFBRectangle *bounds = &window->bounds; + + if (window->object.state != FOS_ACTIVE) + return true; + + ret = fusion_ref_stat( &window->object.ref, &refs ); + if (ret) { + printf( "Fusion error %d!\n", ret ); + return false; + } + +#if FUSION_BUILD_MULTI + printf( "0x%08x : ", window->object.ref.multi.id ); +#else + printf( "N/A : " ); +#endif + + printf( "%3d ", refs ); + + + printf( "%4d, %4d ", bounds->x, bounds->y ); + + printf( "%4d x %4d ", bounds->w, bounds->h ); + + printf( "0x%02x ", window->opacity ); + + printf( "%5d ", dfb_window_id( window->window ) ); + + switch (window->stacking) { + case DWSC_UPPER: + printf( "^ " ); + break; + case DWSC_MIDDLE: + printf( "- " ); + break; + case DWSC_LOWER: + printf( "v " ); + break; + default: + printf( "? " ); + break; + } + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) + printf( "VISIBLE " ); + + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) + printf( "DECORATED " ); + + if (D_FLAGS_IS_SET( window->flags, UWF_DESTROYED )) + printf( "DESTROYED " ); + + + printf( "\n" ); + + return true; +} + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + int refs; + DirectResult ret; + UniqueContext *context = (UniqueContext*) object; + + if (object->state != FOS_ACTIVE) + return true; + + ret = fusion_ref_stat( &object->ref, &refs ); + if (ret) { + printf( "Fusion error %d!\n", ret ); + return false; + } + + printf( "\n" + "-------[ Contexts ]-------\n" + "Reference . Refs Windows\n" + "--------------------------\n" ); + +#if FUSION_BUILD_MULTI + printf( "0x%08x : ", object->ref.multi.id ); +#else + printf( "N/A : " ); +#endif + + printf( "%3d ", refs ); + + printf( "%2d ", fusion_vector_size( &context->windows ) ); + + printf( "\n" ); + + + ret = dfb_windowstack_lock( context->stack ); + if (ret) { + D_DERROR( ret, "UniQuE/Dump: Could not lock window stack!\n" ); + return true; + } + + if (fusion_vector_has_elements( &context->windows )) { + int index; + UniqueWindow *window; + + printf( "\n" + "-----------------------------------[ Windows ]------------------------------------\n" ); + printf( "Reference . Refs X Y Width Height Opacity ID Flags\n" ); + printf( "----------------------------------------------------------------------------------\n" ); + + fusion_vector_foreach_reverse( window, index, context->windows ) + window_callback( window ); + } + + dfb_windowstack_unlock( context->stack ); + + printf( "\n" ); + + return true; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + CoreDFB *core; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = dfb_core_create( &core ); + if (ret) { + DirectFBError( "dfb_core_create() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Dump: This session doesn't run UniQuE!\n" ); + dfb_core_destroy( core, false ); + return EXIT_FAILURE; + } + + + unique_wm_enum_contexts( context_callback, NULL ); + + + /* Release the super interface. */ + dfb_core_destroy( core, false ); + + return EXIT_SUCCESS; +} + diff --git a/Source/DirectFB/wm/unique/window.c b/Source/DirectFB/wm/unique/window.c new file mode 100755 index 0000000..eed319c --- /dev/null +++ b/Source/DirectFB/wm/unique/window.c @@ -0,0 +1,1525 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include + +#include +#include + +#include +#include /* FIXME */ +#include +#include +#include /* FIXME */ +#include + +#include +#include + +#include +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Window, "UniQuE/Window", "UniQuE's Window" ); + + +static const ReactionFunc unique_window_globals[] = { + _unique_wm_module_window_listener, + NULL +}; + +/**************************************************************************************************/ + +typedef struct { + DirectLink link; + + int magic; + + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceModifierMask modifiers; + + UniqueInputFilter *filter; +} KeyFilter; + +/**************************************************************************************************/ + +static DFBResult add_key_filter ( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers, + UniqueInputFilter *filter ); + +static DFBResult remove_key_filter ( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ); + +static void remove_all_filters( UniqueWindow *window ); + +/**************************************************************************************************/ + +static DFBResult create_regions ( UniqueWindow *window ); + +static void insert_window ( UniqueContext *context, + UniqueWindow *window ); + +static void remove_window ( UniqueWindow *window ); + +static void update_foo_frame( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ); + +static DFBResult update_window ( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ); + +static void update_flags ( UniqueWindow *window ); + +static void set_opacity ( UniqueWindow *window, + u8 opacity ); + +static DFBResult move_window ( UniqueWindow *window, + int dx, + int dy ); + +static DFBResult resize_window ( UniqueWindow *window, + int width, + int height ); + +static DFBResult restack_window ( UniqueWindow *window, + UniqueWindow *relative, + int relation, + DFBWindowStackingClass stacking ); + +/**************************************************************************************************/ + +static inline int get_priority( DFBWindowCapabilities caps, DFBWindowStackingClass stacking ); + +/**************************************************************************************************/ + +static void +window_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + int i; + UniqueContext *context; + UniqueWindow *window = (UniqueWindow*) object; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_DEBUG_AT( UniQuE_Window, "destroying %p (%dx%d - %dx%d)%s\n", + window, DFB_RECTANGLE_VALS( &window->bounds ), zombie ? " (ZOMBIE)" : ""); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + + D_FLAGS_SET( window->flags, UWF_DESTROYED ); + + unique_window_notify( window, UWNF_DESTROYED ); + + + set_opacity( window, 0 ); + + remove_window( window ); + + for (i=0; i<8; i++) { + if (window->foos[i]) + stret_region_destroy( window->foos[i] ); + } + + stret_region_destroy( window->region ); + + stret_region_destroy( window->frame ); + + + remove_all_filters( window ); + + unique_input_switch_drop( context->input_switch, window->channel ); + + unique_input_channel_detach_global( window->channel, &window->channel_reaction ); + + unique_input_channel_destroy( window->channel ); + + + if (window->surface) + dfb_surface_unlink( &window->surface ); + + unique_context_unlink( &window->context ); + + dfb_window_unlink( &window->window ); + + D_MAGIC_CLEAR( window ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_window_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Window Pool", sizeof(UniqueWindow), + sizeof(UniqueWindowNotification), window_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +DFBResult +unique_window_create( CoreDFB *core, + CoreWindow *window, + UniqueContext *context, + DFBWindowCapabilities caps, + const CoreWindowConfig *config, + UniqueWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *uniwin; + WMShared *shared; + CoreSurface *surface; + DFBRectangle bounds; + + D_ASSERT( window != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + surface = dfb_window_surface( window ); + + D_ASSERT( surface != NULL || (caps & DWCAPS_INPUTONLY)); + + uniwin = unique_wm_create_window(); + if (!uniwin) + return DFB_FUSION; + + bounds = config->bounds; + + /*if (bounds.x == 0 && bounds.y == 0) { + bounds.x = (context->width - bounds.w) / 2; + bounds.y = (context->height - bounds.h) / 2; + }*/ + + /* Initialize window data. */ + uniwin->shared = context->shared; + + uniwin->caps = caps; + uniwin->flags = UWF_NONE; + + uniwin->bounds = bounds; + uniwin->opacity = config->opacity; + uniwin->stacking = config->stacking; + uniwin->priority = get_priority( caps, config->stacking ); + uniwin->options = config->options; + uniwin->events = config->events; + uniwin->color_key = config->color_key; + uniwin->opaque = config->opaque; + + if (dfb_config->decorations && ! (caps & (DWCAPS_INPUTONLY | DWCAPS_NODECORATION))) { + uniwin->flags |= UWF_DECORATED; + uniwin->insets = shared->insets; + } + + dfb_rectangle_from_rectangle_plus_insets( &uniwin->full, &uniwin->bounds, &uniwin->insets ); + + ret = dfb_window_link( &uniwin->window, window ); + if (ret) + goto error; + + ret = unique_context_link( &uniwin->context, context ); + if (ret) + goto error; + + if (surface) { + ret = dfb_surface_link( &uniwin->surface, surface ); + if (ret) + goto error; + } + + + ret = unique_input_channel_create( core, context, &uniwin->channel ); + if (ret) + goto error; + + ret = unique_input_channel_attach_global( uniwin->channel, + UNIQUE_WINDOW_INPUT_CHANNEL_LISTENER, + uniwin, &uniwin->channel_reaction ); + if (ret) + goto error; + + + D_MAGIC_SET( uniwin, UniqueWindow ); + + ret = create_regions( uniwin ); + if (ret) { + D_MAGIC_CLEAR( uniwin ); + goto error; + } + + + /* Change global reaction lock. */ + fusion_object_set_lock( &uniwin->object, &context->stack->context->lock ); + + /* activate object */ + fusion_object_activate( &uniwin->object ); + + /* Actually add the window to the stack. */ + insert_window( context, uniwin ); + + /* Possibly switch focus to the new window. */ + //unique_context_update_focus( context ); + + /* return the new context */ + *ret_window = uniwin; + + return DFB_OK; + +error: + if (uniwin->channel_reaction.attached) + unique_input_channel_detach_global( uniwin->channel, &uniwin->channel_reaction ); + + if (uniwin->channel) + unique_input_channel_destroy( uniwin->channel ); + + if (uniwin->surface) + dfb_surface_unlink( &uniwin->surface ); + + if (uniwin->context) + unique_context_unlink( &uniwin->context ); + + if (uniwin->window) + dfb_window_unlink( &uniwin->window ); + + fusion_object_destroy( &uniwin->object ); + + return ret; +} + +DFBResult +unique_window_close( UniqueWindow *window ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_UNIMPLEMENTED(); + + return DFB_OK; +} + +DFBResult +unique_window_destroy( UniqueWindow *window ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_UNIMPLEMENTED(); + + return DFB_OK; +} + +DFBResult +unique_window_notify( UniqueWindow *window, + UniqueWindowNotificationFlags flags ) +{ + UniqueWindowNotification notification; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( flags != UWNF_NONE ); + + D_ASSERT( ! (flags & ~UWNF_ALL) ); + + notification.flags = flags; + notification.window = window; + + return unique_window_dispatch( window, ¬ification, unique_window_globals ); +} + +DFBResult +unique_window_update( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + return update_window( window, region, flags, false ); +} + +DFBResult +unique_window_post_event( UniqueWindow *window, + DFBWindowEvent *event ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + if (!D_FLAGS_IS_SET( window->events, event->type )) + return DFB_OK; + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + dfb_window_post_event( window->window, event ); + + return DFB_OK; +} + +DFBResult +unique_window_set_config( UniqueWindow *window, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (flags & CWCF_OPTIONS) { + window->options = config->options; + update_flags( window ); + } + + if (flags & CWCF_EVENTS) + window->events = config->events; + + if (flags & CWCF_COLOR) + return DFB_UNSUPPORTED; + + if (flags & CWCF_COLOR_KEY) + window->color_key = config->color_key; + + if (flags & CWCF_OPAQUE) + window->opaque = config->opaque; + + if (flags & CWCF_OPACITY && !config->opacity) + set_opacity( window, config->opacity ); + + if (flags & CWCF_POSITION) + move_window( window, + config->bounds.x - window->bounds.x, + config->bounds.y - window->bounds.y ); + + if (flags & CWCF_STACKING) + restack_window( window, window, 0, config->stacking ); + + if (flags & CWCF_OPACITY && config->opacity) + set_opacity( window, config->opacity ); + + if (flags & CWCF_SIZE) + return resize_window( window, config->bounds.w, config->bounds.h ); + + return DFB_OK; +} + +DFBResult +unique_window_get_config( UniqueWindow *window, + CoreWindowConfig *config ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( config != NULL ); + + config->bounds = window->bounds; + config->opacity = window->opacity; + config->stacking = window->stacking; + config->options = window->options; + config->events = window->events; + config->color_key = window->color_key; + config->opaque = window->opaque; + + return DFB_OK; +} + + +DFBResult +unique_window_restack( UniqueWindow *window, + UniqueWindow *relative, + int relation ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + return restack_window( window, relative, relation, window->stacking ); +} + + +DFBResult +unique_window_grab( UniqueWindow *window, + const CoreWMGrab *grab ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + switch (grab->target) { + case CWMGT_KEYBOARD: + return unique_input_switch_set( context->input_switch, + UDCI_KEYBOARD, window->channel ); + + case CWMGT_POINTER: + return unique_input_switch_set( context->input_switch, + UDCI_POINTER, window->channel ); + + case CWMGT_KEY: { + DFBResult ret; + UniqueInputEvent event; + UniqueInputFilter *filter; + + event.keyboard.key_code = -1; + event.keyboard.key_symbol = grab->symbol; + event.keyboard.modifiers = grab->modifiers; + + ret = unique_input_switch_set_filter( context->input_switch, UDCI_KEYBOARD, + window->channel, &event, &filter ); + if (ret) { + D_DERROR( ret, "UniQuE/Window: Could not set input filter for key grab!\n" ); + return ret; + } + + ret = add_key_filter( window, grab->symbol, grab->modifiers, filter ); + if (ret) { + unique_input_switch_unset_filter( context->input_switch, filter ); + return ret; + } + + break; + } + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_OK; +} + +DFBResult +unique_window_ungrab( UniqueWindow *window, + const CoreWMGrab *grab ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + switch (grab->target) { + case CWMGT_KEYBOARD: + return unique_input_switch_unset( context->input_switch, + UDCI_KEYBOARD, window->channel ); + + case CWMGT_POINTER: + return unique_input_switch_unset( context->input_switch, + UDCI_POINTER, window->channel ); + + case CWMGT_KEY: + return remove_key_filter( window, grab->symbol, grab->modifiers ); + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_OK; +} + +DFBResult +unique_window_request_focus( UniqueWindow *window ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + return unique_input_switch_select( context->input_switch, UDCI_KEYBOARD, window->channel ); +} + +/**************************************************************************************************/ + +static DFBResult +add_key_filter( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers, + UniqueInputFilter *filter ) +{ + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + key = SHCALLOC( context->shmpool, 1, sizeof(KeyFilter) ); + if (!key) + return D_OOSHM(); + + key->symbol = symbol; + key->modifiers = modifiers; + key->filter = filter; + + direct_list_append( &window->filters, &key->link ); + + D_MAGIC_SET( key, KeyFilter ); + + return DFB_OK; +} + +static DFBResult +remove_key_filter( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ) +{ + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + direct_list_foreach (key, window->filters) { + D_MAGIC_ASSERT( key, KeyFilter ); + + if (key->symbol == symbol && key->modifiers == modifiers) + break; + } + + if (!key) + return DFB_ITEMNOTFOUND; + + unique_input_switch_unset_filter( context->input_switch, key->filter ); + + direct_list_remove( &window->filters, &key->link ); + + D_MAGIC_CLEAR( key ); + + SHFREE( context->shmpool, key ); + + return DFB_OK; +} + +static void +remove_all_filters( UniqueWindow *window ) +{ + DirectLink *n; + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + direct_list_foreach_safe (key, n, window->filters) { + D_MAGIC_ASSERT( key, KeyFilter ); + + unique_input_switch_unset_filter( context->input_switch, key->filter ); + + D_MAGIC_CLEAR( key ); + + SHFREE( context->shmpool, key ); + } + + window->filters = NULL; +} + +/**************************************************************************************************/ + +static void +dispatch_motion( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = DWET_MOTION; + evt.cx = event->pointer.x; + evt.cy = event->pointer.y; + evt.x = event->pointer.x - window->bounds.x; + evt.y = event->pointer.y - window->bounds.y; + evt.buttons = event->pointer.buttons; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_button( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = event->pointer.press ? DWET_BUTTONDOWN : DWET_BUTTONUP; + evt.cx = event->pointer.x; + evt.cy = event->pointer.y; + evt.x = event->pointer.x - window->bounds.x; + evt.y = event->pointer.y - window->bounds.y; + evt.button = event->pointer.button; + evt.buttons = event->pointer.buttons; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_wheel( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = DWET_WHEEL; + evt.step = event->wheel.value; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_key( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = event->keyboard.press ? DWET_KEYDOWN : DWET_KEYUP; + evt.key_code = event->keyboard.key_code; + evt.key_id = event->keyboard.key_id; + evt.key_symbol = event->keyboard.key_symbol; + evt.modifiers = event->keyboard.modifiers; + evt.locks = event->keyboard.locks; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_channel( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + switch (event->channel.index) { + case UDCI_POINTER: + evt.type = event->channel.selected ? DWET_ENTER : DWET_LEAVE; + break; + + case UDCI_KEYBOARD: + evt.type = event->channel.selected ? DWET_GOTFOCUS : DWET_LOSTFOCUS; + break; + + default: + return; + } + + evt.cx = event->channel.x; + evt.cy = event->channel.y; + evt.x = event->channel.x - window->bounds.x; + evt.y = event->channel.y - window->bounds.y; + + dfb_window_post_event( window->window, &evt ); +} + +ReactionResult +_unique_window_input_channel_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueWindow *window = ctx; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Window, "_unique_window_input_channel_listener( %p, %p )\n", + event, window ); + + switch (event->type) { + case UIET_MOTION: + dispatch_motion( window, event ); + break; + + case UIET_BUTTON: + dispatch_button( window, event ); + break; + + case UIET_WHEEL: + dispatch_wheel( window, event ); + break; + + case UIET_KEY: + dispatch_key( window, event ); + break; + + case UIET_CHANNEL: + dispatch_channel( window, event ); + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + return RS_OK; +} + +/**************************************************************************************************/ + +static inline int +get_priority( DFBWindowCapabilities caps, DFBWindowStackingClass stacking ) +{ + switch (stacking) { + case DWSC_UPPER: + return 1; + + case DWSC_MIDDLE: + return 0; + + case DWSC_LOWER: + return -1; + + default: + D_BUG( "unknown stacking class" ); + break; + } + + return 0; +} + +static inline int +get_index( UniqueWindow *window ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( fusion_vector_contains( &context->windows, window ) ); + + return fusion_vector_index_of( &context->windows, window ); +} + +static DFBResult +update_window( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ) +{ + DFBRegion regions[32]; + int num_regions; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + if (complete || stret_region_visible( window->region, region, true, regions, 32, &num_regions )) { + if (region) { + DFBRegion area = DFB_REGION_INIT_TRANSLATED( region, + window->bounds.x, + window->bounds.y ); + + unique_context_update( window->context, &area, 1, flags ); + } + else { + DFBRegion area = DFB_REGION_INIT_FROM_RECTANGLE( &window->bounds ); + unique_context_update( window->context, &area, 1, flags ); + } + } + else if (num_regions > 0) + unique_context_update( window->context, regions, num_regions, flags ); + + return DFB_OK; +} + +static DFBResult +update_frame( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ) +{ + DFBRegion regions[32]; + int num_regions; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + if (complete || stret_region_visible( window->frame, region, true, regions, 32, &num_regions )) { + if (region) { + DFBRegion area = DFB_REGION_INIT_TRANSLATED( region, + window->full.x, + window->full.y ); + + unique_context_update( window->context, &area, 1, flags ); + } + else { + DFBRegion area = DFB_REGION_INIT_FROM_RECTANGLE( &window->full ); + unique_context_update( window->context, &area, 1, flags ); + } + } + else if (num_regions > 0) + unique_context_update( window->context, regions, num_regions, flags ); + + return DFB_OK; +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static void +insert_window( UniqueContext *context, + UniqueWindow *window ) +{ + int index; + UniqueWindow *other; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + /* + * Iterate from bottom to top, + * stopping at the first window with a higher priority. + */ + fusion_vector_foreach (other, index, context->windows) { + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (other->priority > window->priority) + break; + } + + /* Insert the window at the acquired position. */ + fusion_vector_insert( &context->windows, window, index ); + + stret_region_restack( window->frame, index ); +} + +static void +remove_window( UniqueWindow *window ) +{ + int index; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( fusion_vector_contains( &context->windows, window ) ); + + index = fusion_vector_index_of( &context->windows, window ); + + fusion_vector_remove( &context->windows, index ); +} + +/**************************************************************************************************/ + +static DFBResult +move_window( UniqueWindow *window, + int dx, + int dy ) +{ + DFBWindowEvent evt; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + dfb_rectangle_translate( &window->bounds, dx, dy ); + dfb_rectangle_translate( &window->full, dx, dy ); + + stret_region_move( window->frame, dx, dy ); + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) { + DFBRegion region = { 0, 0, window->full.w - 1, window->full.h - 1 }; + + if (dx > 0) + region.x1 -= dx; + else if (dx < 0) + region.x2 -= dx; + + if (dy > 0) + region.y1 -= dy; + else if (dy < 0) + region.y2 -= dy; + + update_frame( window, ®ion, DSFLIP_NONE, false ); + } + + /* Send new position */ + evt.type = DWET_POSITION; + evt.x = window->bounds.x; + evt.y = window->bounds.y; + + unique_window_post_event( window, &evt ); + + return DFB_OK; +} + +static DFBResult +resize_window( UniqueWindow *window, + int width, + int height ) +{ + DFBResult ret; + DFBWindowEvent evt; + int ow; + int oh; + UniqueContext *context; + WMShared *shared; + DFBRectangle *sizes; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + sizes = shared->foo_rects; + + if (width > 4096 || height > 4096) + return DFB_LIMITEXCEEDED; + + if (window->surface) { + ret = dfb_surface_reformat( window->surface, width, height, window->surface->config.format ); + if (ret) + return ret; + } + + ow = window->bounds.w; + oh = window->bounds.h; + + window->bounds.w = width; + window->bounds.h = height; + + window->full.w += width - ow; + window->full.h += height - oh; + + stret_region_resize( window->frame, window->full.w, window->full.h ); + stret_region_resize( window->region, window->bounds.w, window->bounds.h ); + + update_foo_frame( window, window->context, window->shared ); + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) { + int dw = ow - width; + int dh = oh - height; + + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) { + int bw = dw - sizes[UFI_NE].w + sizes[UFI_E].w; + int bh = dh - sizes[UFI_SW].h + sizes[UFI_S].h; + DFBInsets *in = &window->insets; + + if (bw < 0) { + DFBRegion region = { in->l + width + bw, 0, in->l + width - 1, in->t - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (bh < 0) { + DFBRegion region = { 0, in->t + height + bh, in->l - 1, in->t + height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dw < 0) + dw = 0; + + if (dh < 0) + dh = 0; + + dw += in->r; + dh += in->b; + + if (dw > 0) { + DFBRegion region = { in->l + width, 0, in->l + width + dw - 1, in->t + height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dh > 0) { + DFBRegion region = { 0, in->t + height, in->l + width + dw - 1, in->t + height + dh - 1 }; + + update_frame( window, ®ion, 0, false ); + } + } + else { + if (dw < 0) + dw = 0; + + if (dh < 0) + dh = 0; + + if (dw > 0) { + DFBRegion region = { width, 0, width + dw - 1, height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dh > 0) { + DFBRegion region = { 0, height, width + dw - 1, height + dh - 1 }; + + update_frame( window, ®ion, 0, false ); + } + } + } + + /* Send new size */ + evt.type = DWET_SIZE; + evt.w = window->bounds.w; + evt.h = window->bounds.h; + + unique_window_post_event( window, &evt ); + + unique_input_switch_update( context->input_switch, window->channel ); + //unique_context_update_focus( context ); + + return DFB_OK; +} + +static DFBResult +restack_window( UniqueWindow *window, + UniqueWindow *relative, + int relation, + DFBWindowStackingClass stacking ) +{ + int old; + int index; + int priority; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_MAGIC_ASSERT_IF( relative, UniqueWindow ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Change stacking class. */ + if (stacking != window->stacking) { + window->stacking = stacking; + window->priority = get_priority( window->caps, stacking ); + } + + /* Get the (new) priority. */ + priority = window->priority; + + /* Get the old index. */ + old = get_index( window ); + + /* Calculate the desired index. */ + if (relative) { + index = get_index( relative ); + + if (relation > 0) { + if (old < index) + index--; + } + else if (relation < 0) { + if (old > index) + index++; + } + + index += relation; + + if (index < 0) + index = 0; + else if (index > fusion_vector_size( &context->windows ) - 1) + index = fusion_vector_size( &context->windows ) - 1; + } + else if (relation) + index = fusion_vector_size( &context->windows ) - 1; + else + index = 0; + + /* Assure window won't be above any window with a higher priority. */ + while (index > 0) { + int below = (old < index) ? index : index - 1; + UniqueWindow *other = fusion_vector_at( &context->windows, below ); + + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (priority < other->priority) + index--; + else + break; + } + + /* Assure window won't be below any window with a lower priority. */ + while (index < fusion_vector_size( &context->windows ) - 1) { + int above = (old > index) ? index : index + 1; + UniqueWindow *other = fusion_vector_at( &context->windows, above ); + + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (priority > other->priority) + index++; + else + break; + } + + /* Return if index hasn't changed. */ + if (index == old) + return DFB_OK; + + /* Actually change the stacking order now. */ + fusion_vector_move( &context->windows, old, index ); + + stret_region_restack( window->frame, index ); + + update_frame( window, NULL, DSFLIP_NONE, (index < old) ); + + if (index < old) + unique_input_switch_update( context->input_switch, window->channel ); + + return DFB_OK; +} + +static void +set_opacity( UniqueWindow *window, + u8 opacity ) +{ + u8 old; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + old = window->opacity; + + if (!dfb_config->translucent_windows && opacity) + opacity = 0xFF; + + if (old != opacity) { + bool show = !old && opacity; + bool hide = old && !opacity; + + window->opacity = opacity; + + if (show) { + stret_region_enable( window->frame, SRF_ACTIVE ); + + D_FLAGS_SET( window->flags, UWF_VISIBLE ); + } + + if (hide) + D_FLAGS_CLEAR( window->flags, UWF_VISIBLE ); + + if (! (window->options & (DWOP_ALPHACHANNEL | DWOP_COLORKEYING))) { + if (opacity == 0xff && old != 0xff) + stret_region_enable( window->region, SRF_OPAQUE ); + else if (opacity != 0xff && old == 0xff) + stret_region_disable( window->region, SRF_OPAQUE ); + } + + update_frame( window, NULL, DSFLIP_NONE, false ); + + + /* Check focus after window appeared or disappeared */ + if (/*show ||*/ hide) + unique_input_switch_update( context->input_switch, window->channel ); +// unique_context_update_focus( context ); + + /* If window disappeared... */ + if (hide) { + stret_region_disable( window->frame, SRF_ACTIVE ); + + /* Ungrab pointer/keyboard, release focus */ + unique_input_switch_drop( context->input_switch, window->channel ); + } + } +} + +/**************************************************************************************************/ + +static void +foo_rects( UniqueWindow *window, + UniqueContext *context, + WMShared *shared, + DFBRectangle *ret_rects ) +{ + int width; + int height; + DFBRectangle *sizes; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( ret_rects != NULL ); + + width = window->full.w; + height = window->full.h; + + sizes = shared->foo_rects; + + if (width <= sizes[UFI_NW].w + sizes[UFI_NE].w) + width = sizes[UFI_NW].w + sizes[UFI_NE].w + 1; + + if (width <= sizes[UFI_SW].w + sizes[UFI_SE].w) + width = sizes[UFI_SW].w + sizes[UFI_SE].w + 1; + + if (height <= sizes[UFI_NW].h + sizes[UFI_SW].h) + height = sizes[UFI_NW].h + sizes[UFI_SW].h + 1; + + if (height <= sizes[UFI_NE].h + sizes[UFI_SE].h) + height = sizes[UFI_NE].h + sizes[UFI_SE].h + 1; + + ret_rects[UFI_N].x = sizes[UFI_NW].w; + ret_rects[UFI_N].y = 0; + ret_rects[UFI_N].w = width - sizes[UFI_NW].w - sizes[UFI_NE].w; + ret_rects[UFI_N].h = sizes[UFI_N].h; + + ret_rects[UFI_NE].x = width - sizes[UFI_NE].w; + ret_rects[UFI_NE].y = 0; + ret_rects[UFI_NE].w = sizes[UFI_NE].w; + ret_rects[UFI_NE].h = sizes[UFI_NE].h; + + ret_rects[UFI_E].x = width - sizes[UFI_E].w; + ret_rects[UFI_E].y = sizes[UFI_NE].h; + ret_rects[UFI_E].w = sizes[UFI_E].w; + ret_rects[UFI_E].h = height - sizes[UFI_NE].h - sizes[UFI_SE].h; + + ret_rects[UFI_SE].x = width - sizes[UFI_SE].w; + ret_rects[UFI_SE].y = height - sizes[UFI_SE].h; + ret_rects[UFI_SE].w = sizes[UFI_SE].w; + ret_rects[UFI_SE].h = sizes[UFI_SE].h; + + ret_rects[UFI_S].x = sizes[UFI_SW].w; + ret_rects[UFI_S].y = height - sizes[UFI_S].h; + ret_rects[UFI_S].w = width - sizes[UFI_SE].w - sizes[UFI_SW].w; + ret_rects[UFI_S].h = sizes[UFI_S].h; + + ret_rects[UFI_SW].x = 0; + ret_rects[UFI_SW].y = height - sizes[UFI_SW].h; + ret_rects[UFI_SW].w = sizes[UFI_SW].w; + ret_rects[UFI_SW].h = sizes[UFI_SW].h; + + ret_rects[UFI_W].x = 0; + ret_rects[UFI_W].y = sizes[UFI_NW].h; + ret_rects[UFI_W].w = sizes[UFI_W].w; + ret_rects[UFI_W].h = height - sizes[UFI_NW].h - sizes[UFI_SW].h; + + ret_rects[UFI_NW].x = 0; + ret_rects[UFI_NW].y = 0; + ret_rects[UFI_NW].w = sizes[UFI_NW].w; + ret_rects[UFI_NW].h = sizes[UFI_NW].h; +} + +static void +update_foo_frame( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBRectangle rects[8]; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + if (!window->foos[0]) + return; + + foo_rects( window, context, shared, rects ); + + for (i=0; i<8; i++) + window->foos[i]->bounds = DFB_REGION_INIT_FROM_RECTANGLE( &rects[i] ); +} + +static void +update_flags( UniqueWindow *window ) +{ + int i; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (! (window->options & DWOP_GHOST)) { + if (window->foos[0]) { + for (i=0; i<8; i++) + window->foos[i]->flags |= SRF_INPUT; + } + + window->region->flags |= SRF_INPUT; + } + else { + if (window->foos[0]) { + for (i=0; i<8; i++) + window->foos[i]->flags &= ~SRF_INPUT; + } + + window->region->flags &= ~SRF_INPUT; + } +} + +static DFBResult +create_foos( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBResult ret; + DFBRectangle rects[8]; + StretRegionFlags flags = SRF_ACTIVE | SRF_OUTPUT; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + + foo_rects( window, context, shared, rects ); + + if (! (window->options & DWOP_GHOST)) + flags |= SRF_INPUT; + + for (i=0; i<8; i++) { + ret = stret_region_create( shared->region_classes[URCI_FOO], window, i, flags, 1, + DFB_RECTANGLE_VALS( &rects[i] ), + window->frame, UNFL_FOREGROUND, + context->shmpool, &window->foos[i] ); + if (ret) + goto error; + } + + return DFB_OK; + +error: + for (--i; i>0; --i) + stret_region_destroy( window->foos[i] ); + + return ret; +} + +static DFBResult +create_regions( UniqueWindow *window ) +{ + DFBResult ret; + UniqueContext *context; + WMShared *shared; + StretRegionFlags flags = SRF_ACTIVE; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + if (! (window->options & DWOP_GHOST)) + flags |= SRF_INPUT; + + if (! (window->caps & DWCAPS_INPUTONLY)) + flags |= SRF_OUTPUT; + + if (window->options & DWOP_SHAPED) + flags |= SRF_SHAPED; + + /* Frame */ + ret = stret_region_create( shared->region_classes[URCI_FRAME], window, 0, SRF_NONE, _UNFL_NUM, + DFB_RECTANGLE_VALS( &window->full ), + context->root, UNRL_USER, context->shmpool, &window->frame ); + if (ret) + return ret; + + /* Content */ + ret = stret_region_create( shared->region_classes[URCI_WINDOW], window, true, flags, 1, + window->insets.l, window->insets.t, + window->bounds.w, window->bounds.h, + window->frame, UNFL_CONTENT, context->shmpool, &window->region ); + if (ret) { + stret_region_destroy( window->frame ); + return ret; + } + + /* Foos */ + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) { + ret = create_foos( window, context, shared ); + if (ret) { + stret_region_destroy( window->region ); + stret_region_destroy( window->frame ); + return ret; + } + } + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/window.h b/Source/DirectFB/wm/unique/window.h new file mode 100755 index 0000000..be75e96 --- /dev/null +++ b/Source/DirectFB/wm/unique/window.h @@ -0,0 +1,135 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __UNIQUE__WINDOW_H__ +#define __UNIQUE__WINDOW_H__ + +#include +#include + +#include + + +typedef enum { + UWF_NONE = 0x00000000, + + UWF_VISIBLE = 0x00000001, + UWF_DECORATED = 0x00000002, + + UWF_DESTROYED = 0x00000010, + + UWF_ALL = 0x00000013 +} UniqueWindowFlags; + + +typedef enum { + UWNF_NONE = 0x00000000, + + UWNF_DESTROYED = 0x00000001, + + UWNF_UPDATE = 0x00000010, + + UWNF_ALL = 0x00000011 +} UniqueWindowNotificationFlags; + +typedef struct { + UniqueWindowNotificationFlags flags; + UniqueWindow *window; + + DFBRegion update; +} UniqueWindowNotification; + + + +DFBResult unique_window_create ( CoreDFB *core, + CoreWindow *window, + UniqueContext *context, + DFBWindowCapabilities caps, + const CoreWindowConfig *config, + UniqueWindow **ret_window ); + +DFBResult unique_window_close ( UniqueWindow *window ); + +DFBResult unique_window_destroy ( UniqueWindow *window ); + + +DFBResult unique_window_notify ( UniqueWindow *window, + UniqueWindowNotificationFlags flags ); + + +DFBResult unique_window_update ( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ); + +DFBResult unique_window_post_event ( UniqueWindow *window, + DFBWindowEvent *event ); + +DFBResult unique_window_set_config ( UniqueWindow *window, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ); + +DFBResult unique_window_get_config ( UniqueWindow *window, + CoreWindowConfig *config ); + + +DFBResult unique_window_restack ( UniqueWindow *window, + UniqueWindow *relative, + int relation ); + + +DFBResult unique_window_grab ( UniqueWindow *window, + const CoreWMGrab *grab ); + +DFBResult unique_window_ungrab ( UniqueWindow *window, + const CoreWMGrab *grab ); + +DFBResult unique_window_request_focus( UniqueWindow *window ); + + + + +/* + * Creates a pool of window objects. + */ +FusionObjectPool *unique_window_pool_create( const FusionWorld *world ); + +/* + * Generates unique_window_ref(), unique_window_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueWindow, unique_window ) + + +/* global reactions */ + +typedef enum { + UNIQUE_WM_MODULE_WINDOW_LISTENER +} UNIQUE_WINDOW_GLOBALS; + + +#endif + -- cgit